react-simple-timefield
Advanced tools
Comparing version 3.0.0 to 3.1.0
@@ -1,280 +0,207 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
exports.isNumber = isNumber; | ||
exports.formatTimeItem = formatTimeItem; | ||
exports.validateTimeAndCursor = validateTimeAndCursor; | ||
var _react = require('react'); | ||
var _react2 = _interopRequireDefault(_react); | ||
var _propTypes = require('prop-types'); | ||
var _propTypes2 = _interopRequireDefault(_propTypes); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = function (d, b) { | ||
extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
}; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
var __rest = (this && this.__rest) || function (s, e) { | ||
var t = {}; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | ||
t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | ||
t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
}; | ||
import React from 'react'; | ||
var DEFAULT_COLON = ':'; | ||
var DEFAULT_VALUE_SHORT = '00' + DEFAULT_COLON + '00'; | ||
var DEFAULT_VALUE_FULL = '00' + DEFAULT_COLON + '00' + DEFAULT_COLON + '00'; | ||
function isNumber(value) { | ||
var number = Number(value); | ||
return !isNaN(number) && String(value) === String(number); | ||
var DEFAULT_VALUE_SHORT = "00" + DEFAULT_COLON + "00"; | ||
var DEFAULT_VALUE_FULL = "00" + DEFAULT_COLON + "00" + DEFAULT_COLON + "00"; | ||
export function isNumber(value) { | ||
var number = Number(value); | ||
return !isNaN(number) && String(value) === String(number); | ||
} | ||
function formatTimeItem(value) { | ||
return ((value || '') + '00').substr(0, 2); | ||
export function formatTimeItem(value) { | ||
return ((value || '') + "00").substr(0, 2); | ||
} | ||
function validateTimeAndCursor() { | ||
var showSeconds = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; | ||
var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; | ||
var defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; | ||
var colon = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : DEFAULT_COLON; | ||
var cursorPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0; | ||
var _defaultValue$split = defaultValue.split(colon), | ||
_defaultValue$split2 = _slicedToArray(_defaultValue$split, 3), | ||
oldH = _defaultValue$split2[0], | ||
oldM = _defaultValue$split2[1], | ||
oldS = _defaultValue$split2[2]; | ||
var newCursorPosition = Number(cursorPosition); | ||
var _String$split = String(value).split(colon), | ||
_String$split2 = _slicedToArray(_String$split, 3), | ||
newH = _String$split2[0], | ||
newM = _String$split2[1], | ||
newS = _String$split2[2]; | ||
newH = formatTimeItem(newH); | ||
if (Number(newH[0]) > 2) { | ||
newH = oldH; | ||
newCursorPosition -= 1; | ||
} else if (Number(newH[0]) === 2) { | ||
if (Number(oldH[0]) === 2 && Number(newH[1]) > 3) { | ||
newH = '2' + oldH[1]; | ||
newCursorPosition -= 2; | ||
} else if (Number(newH[1]) > 3) { | ||
newH = '23'; | ||
export function validateTimeAndCursor(showSeconds, value, defaultValue, colon, cursorPosition) { | ||
if (showSeconds === void 0) { showSeconds = false; } | ||
if (value === void 0) { value = ''; } | ||
if (defaultValue === void 0) { defaultValue = ''; } | ||
if (colon === void 0) { colon = DEFAULT_COLON; } | ||
if (cursorPosition === void 0) { cursorPosition = 0; } | ||
var _a = defaultValue.split(colon), oldH = _a[0], oldM = _a[1], oldS = _a[2]; | ||
var newCursorPosition = Number(cursorPosition); | ||
var _b = String(value).split(colon), newH = _b[0], newM = _b[1], newS = _b[2]; | ||
newH = formatTimeItem(newH); | ||
if (Number(newH[0]) > 2) { | ||
newH = oldH; | ||
newCursorPosition -= 1; | ||
} | ||
} | ||
newM = formatTimeItem(newM); | ||
if (Number(newM[0]) > 5) { | ||
newM = oldM; | ||
newCursorPosition -= 1; | ||
} | ||
if (showSeconds) { | ||
newS = formatTimeItem(newS); | ||
if (Number(newS[0]) > 5) { | ||
newS = oldS; | ||
newCursorPosition -= 1; | ||
else if (Number(newH[0]) === 2) { | ||
if (Number(oldH[0]) === 2 && Number(newH[1]) > 3) { | ||
newH = "2" + oldH[1]; | ||
newCursorPosition -= 2; | ||
} | ||
else if (Number(newH[1]) > 3) { | ||
newH = '23'; | ||
} | ||
} | ||
} | ||
var validatedValue = showSeconds ? '' + newH + colon + newM + colon + newS : '' + newH + colon + newM; | ||
return [validatedValue, newCursorPosition]; | ||
newM = formatTimeItem(newM); | ||
if (Number(newM[0]) > 5) { | ||
newM = oldM; | ||
newCursorPosition -= 1; | ||
} | ||
if (showSeconds) { | ||
newS = formatTimeItem(newS); | ||
if (Number(newS[0]) > 5) { | ||
newS = oldS; | ||
newCursorPosition -= 1; | ||
} | ||
} | ||
var validatedValue = showSeconds ? "" + newH + colon + newM + colon + newS : "" + newH + colon + newM; | ||
return [validatedValue, newCursorPosition]; | ||
} | ||
var TimeField = function (_React$Component) { | ||
_inherits(TimeField, _React$Component); | ||
function TimeField(props) { | ||
var _ref; | ||
_classCallCheck(this, TimeField); | ||
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
args[_key - 1] = arguments[_key]; | ||
var TimeField = /** @class */ (function (_super) { | ||
__extends(TimeField, _super); | ||
function TimeField(props) { | ||
var _this = _super.call(this, props) || this; | ||
var _showSeconds = Boolean(props.showSeconds); | ||
var _defaultValue = _showSeconds ? DEFAULT_VALUE_FULL : DEFAULT_VALUE_SHORT; | ||
var _colon = props.colon && props.colon.length === 1 ? props.colon : DEFAULT_COLON; | ||
var validatedTime = validateTimeAndCursor(_showSeconds, _this.props.value, _defaultValue, _colon)[0]; | ||
_this.state = { | ||
value: validatedTime, | ||
_colon: _colon, | ||
_showSeconds: _showSeconds, | ||
_defaultValue: _defaultValue, | ||
_maxLength: _defaultValue.length | ||
}; | ||
_this.onInputChange = _this.onInputChange.bind(_this); | ||
return _this; | ||
} | ||
var _this = _possibleConstructorReturn(this, (_ref = TimeField.__proto__ || Object.getPrototypeOf(TimeField)).call.apply(_ref, [this, props].concat(args))); | ||
var _showSeconds = Boolean(props.showSeconds); | ||
var _defaultValue = _showSeconds ? DEFAULT_VALUE_FULL : DEFAULT_VALUE_SHORT; | ||
var _colon = props.colon && props.colon.length === 1 ? props.colon : DEFAULT_COLON; | ||
var _validateTimeAndCurso = validateTimeAndCursor(_showSeconds, _this.props.value, _defaultValue, _colon), | ||
_validateTimeAndCurso2 = _slicedToArray(_validateTimeAndCurso, 1), | ||
validatedTime = _validateTimeAndCurso2[0]; | ||
_this.state = { | ||
value: validatedTime, | ||
_colon: _colon, | ||
_showSeconds: _showSeconds, | ||
_defaultValue: _defaultValue, | ||
_maxLength: _defaultValue.length | ||
TimeField.prototype.componentDidUpdate = function (prevProps) { | ||
if (this.props.value !== prevProps.value) { | ||
var validatedTime = validateTimeAndCursor(this.state._showSeconds, this.props.value, this.state._defaultValue, this.state._colon)[0]; | ||
this.setState({ | ||
value: validatedTime | ||
}); | ||
} | ||
}; | ||
_this.onInputChange = _this.onInputChange.bind(_this); | ||
return _this; | ||
} | ||
_createClass(TimeField, [{ | ||
key: 'componentDidUpdate', | ||
value: function componentDidUpdate(prevProps) { | ||
if (this.props.value !== prevProps.value) { | ||
var _validateTimeAndCurso3 = validateTimeAndCursor(this.state._showSeconds, this.props.value, this.state._defaultValue, this.state._colon), | ||
_validateTimeAndCurso4 = _slicedToArray(_validateTimeAndCurso3, 1), | ||
validatedTime = _validateTimeAndCurso4[0]; | ||
this.setState({ | ||
value: validatedTime | ||
}); | ||
} | ||
} | ||
}, { | ||
key: 'onInputChange', | ||
value: function onInputChange(event, callback) { | ||
var oldValue = this.state.value; | ||
var inputEl = event.target; | ||
var inputValue = inputEl.value; | ||
var position = inputEl.selectionEnd; | ||
var isTyped = inputValue.length > oldValue.length; | ||
var cursorCharacter = inputValue[position - 1]; | ||
var addedCharacter = isTyped ? cursorCharacter : null; | ||
var removedCharacter = isTyped ? null : oldValue[position]; | ||
var replacedSingleCharacter = inputValue.length === oldValue.length ? oldValue[position - 1] : null; | ||
var colon = this.state._colon; | ||
var newValue = oldValue; | ||
var newPosition = position; | ||
if (addedCharacter !== null) { | ||
if (position > this._maxLength) { | ||
newPosition = this._maxLength; | ||
} else if ((position === 3 || position === 6) && addedCharacter === colon) { | ||
newValue = '' + inputValue.substr(0, position - 1) + colon + inputValue.substr(position + 1); | ||
} else if ((position === 3 || position === 6) && isNumber(addedCharacter)) { | ||
newValue = '' + inputValue.substr(0, position - 1) + colon + addedCharacter + inputValue.substr(position + 2); | ||
newPosition = position + 1; | ||
} else if (isNumber(addedCharacter)) { | ||
// user typed a number | ||
newValue = inputValue.substr(0, position - 1) + addedCharacter + inputValue.substr(position + 1); | ||
if (position === 2 || position === 5) { | ||
newPosition = position + 1; | ||
} | ||
} else { | ||
// if user typed NOT a number, then keep old value & position | ||
newPosition = position - 1; | ||
TimeField.prototype.onInputChange = function (event, callback) { | ||
var oldValue = this.state.value; | ||
var inputEl = event.target; | ||
var inputValue = inputEl.value; | ||
var position = inputEl.selectionEnd || 0; | ||
var isTyped = inputValue.length > oldValue.length; | ||
var cursorCharacter = inputValue[position - 1]; | ||
var addedCharacter = isTyped ? cursorCharacter : null; | ||
var removedCharacter = isTyped ? null : oldValue[position]; | ||
var replacedSingleCharacter = inputValue.length === oldValue.length ? oldValue[position - 1] : null; | ||
var colon = this.state._colon; | ||
var newValue = oldValue; | ||
var newPosition = position; | ||
if (addedCharacter !== null) { | ||
if (position > this.state._maxLength) { | ||
newPosition = this.state._maxLength; | ||
} | ||
else if ((position === 3 || position === 6) && addedCharacter === colon) { | ||
newValue = "" + inputValue.substr(0, position - 1) + colon + inputValue.substr(position + 1); | ||
} | ||
else if ((position === 3 || position === 6) && isNumber(addedCharacter)) { | ||
newValue = "" + inputValue.substr(0, position - 1) + colon + addedCharacter + inputValue.substr(position + 2); | ||
newPosition = position + 1; | ||
} | ||
else if (isNumber(addedCharacter)) { | ||
// user typed a number | ||
newValue = inputValue.substr(0, position - 1) + addedCharacter + inputValue.substr(position + 1); | ||
if (position === 2 || position === 5) { | ||
newPosition = position + 1; | ||
} | ||
} | ||
else { | ||
// if user typed NOT a number, then keep old value & position | ||
newPosition = position - 1; | ||
} | ||
} | ||
} else if (replacedSingleCharacter !== null) { | ||
// user replaced only a single character | ||
if (isNumber(cursorCharacter)) { | ||
if (position - 1 === 2 || position - 1 === 5) { | ||
newValue = '' + inputValue.substr(0, position - 1) + colon + inputValue.substr(position); | ||
} else { | ||
newValue = inputValue; | ||
} | ||
} else { | ||
// user replaced a number on some non-number character | ||
newValue = oldValue; | ||
newPosition = position - 1; | ||
else if (replacedSingleCharacter !== null) { | ||
// user replaced only a single character | ||
if (isNumber(cursorCharacter)) { | ||
if (position - 1 === 2 || position - 1 === 5) { | ||
newValue = "" + inputValue.substr(0, position - 1) + colon + inputValue.substr(position); | ||
} | ||
else { | ||
newValue = inputValue; | ||
} | ||
} | ||
else { | ||
// user replaced a number on some non-number character | ||
newValue = oldValue; | ||
newPosition = position - 1; | ||
} | ||
} | ||
} else if (typeof cursorCharacter !== 'undefined' && cursorCharacter !== colon && !isNumber(cursorCharacter)) { | ||
// set of characters replaced by non-number | ||
newValue = oldValue; | ||
newPosition = position - 1; | ||
} else if (removedCharacter !== null) { | ||
if ((position === 2 || position === 5) && removedCharacter === colon) { | ||
newValue = inputValue.substr(0, position - 1) + '0' + colon + inputValue.substr(position); | ||
newPosition = position - 1; | ||
} else { | ||
// user removed a number | ||
newValue = inputValue.substr(0, position) + '0' + inputValue.substr(position); | ||
else if (typeof cursorCharacter !== 'undefined' && cursorCharacter !== colon && !isNumber(cursorCharacter)) { | ||
// set of characters replaced by non-number | ||
newValue = oldValue; | ||
newPosition = position - 1; | ||
} | ||
} | ||
var _validateTimeAndCurso5 = validateTimeAndCursor(this.state._showSeconds, newValue, oldValue, colon, newPosition), | ||
_validateTimeAndCurso6 = _slicedToArray(_validateTimeAndCurso5, 2), | ||
validatedTime = _validateTimeAndCurso6[0], | ||
validatedCursorPosition = _validateTimeAndCurso6[1]; | ||
this.setState({ value: validatedTime }, function () { | ||
inputEl.selectionStart = validatedCursorPosition; | ||
inputEl.selectionEnd = validatedCursorPosition; | ||
callback(event, validatedTime); | ||
}); | ||
event.persist(); | ||
} | ||
}, { | ||
key: 'render', | ||
value: function render() { | ||
var _this2 = this; | ||
var value = this.state.value; | ||
var _props = this.props, | ||
onChange = _props.onChange, | ||
style = _props.style, | ||
showSeconds = _props.showSeconds, | ||
input = _props.input, | ||
colon = _props.colon, | ||
props = _objectWithoutProperties(_props, ['onChange', 'style', 'showSeconds', 'input', 'colon']); //eslint-disable-line no-unused-vars | ||
var onChangeHandler = function onChangeHandler(event) { | ||
return _this2.onInputChange(event, function (e, v) { | ||
return onChange && onChange(e, v); | ||
else if (removedCharacter !== null) { | ||
if ((position === 2 || position === 5) && removedCharacter === colon) { | ||
newValue = inputValue.substr(0, position - 1) + "0" + colon + inputValue.substr(position); | ||
newPosition = position - 1; | ||
} | ||
else { | ||
// user removed a number | ||
newValue = inputValue.substr(0, position) + "0" + inputValue.substr(position); | ||
} | ||
} | ||
var _a = validateTimeAndCursor(this.state._showSeconds, newValue, oldValue, colon, newPosition), validatedTime = _a[0], validatedCursorPosition = _a[1]; | ||
this.setState({ value: validatedTime }, function () { | ||
inputEl.selectionStart = validatedCursorPosition; | ||
inputEl.selectionEnd = validatedCursorPosition; | ||
callback(event, validatedTime); | ||
}); | ||
}; | ||
if (input) { | ||
return _react2.default.cloneElement(input, _extends({}, props, { | ||
value: value, | ||
style: style, | ||
onChange: onChangeHandler | ||
})); | ||
} | ||
return _react2.default.createElement('input', _extends({ | ||
type: 'text' | ||
}, props, { | ||
value: value, | ||
onChange: onChangeHandler, | ||
style: _extends({ width: showSeconds ? 54 : 35 }, style) | ||
})); | ||
} | ||
}]); | ||
return TimeField; | ||
}(_react2.default.Component); | ||
TimeField.propTypes = { | ||
value: _propTypes2.default.string.isRequired, | ||
onChange: _propTypes2.default.func.isRequired, | ||
showSeconds: _propTypes2.default.bool, | ||
input: _propTypes2.default.element, | ||
colon: _propTypes2.default.string, | ||
style: _propTypes2.default.object | ||
}; | ||
TimeField.defaultProps = { | ||
showSeconds: false, | ||
input: null, | ||
style: {}, | ||
colon: DEFAULT_COLON | ||
}; | ||
exports.default = TimeField; | ||
event.persist(); | ||
}; | ||
TimeField.prototype.render = function () { | ||
var _this = this; | ||
var value = this.state.value; | ||
var _a = this.props, onChange = _a.onChange, style = _a.style, showSeconds = _a.showSeconds, input = _a.input, inputRef = _a.inputRef, colon = _a.colon, props = __rest(_a, ["onChange", "style", "showSeconds", "input", "inputRef", "colon"]); //eslint-disable-line no-unused-vars | ||
var onChangeHandler = function (event) { | ||
return _this.onInputChange(event, function (e, v) { return onChange && onChange(e, v); }); | ||
}; | ||
if (input) { | ||
return React.cloneElement(input, __assign(__assign({}, props), { value: value, | ||
style: style, onChange: onChangeHandler })); | ||
} | ||
return (React.createElement("input", __assign({ type: "text" }, props, { ref: inputRef, value: value, onChange: onChangeHandler, style: __assign({ width: showSeconds ? 54 : 35 }, style) }))); | ||
}; | ||
TimeField.defaultProps = { | ||
showSeconds: false, | ||
input: null, | ||
style: {}, | ||
colon: DEFAULT_COLON | ||
}; | ||
return TimeField; | ||
}(React.Component)); | ||
export default TimeField; |
{ | ||
"name": "react-simple-timefield", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"description": "Simple React time input field", | ||
"author": { | ||
"name": "Anton Fisher", | ||
"email": "a.fschr@gmail.com", | ||
"url": "http://antonfisher.com" | ||
}, | ||
"author": "Anton Fisher <a.fschr@gmail.com> (http://antonfisher.com)", | ||
"license": "MIT", | ||
"main": "index.js", | ||
"typings": "dist/index.d.ts", | ||
"scripts": { | ||
"build": "babel -d dist src && cd ./demo && npm run build && cd -", | ||
"build": "tsc && cd ./demo && npm run build && cd -", | ||
"test": "jest", | ||
"lint": "eslint --ignore-path .gitignore --ignore-pattern docs -- .", | ||
"prettier": "prettier --ignore-path .gitignore --write './**/*.js'", | ||
"typecheck": "tsc", | ||
"format": "npm run prettier && npm run lint", | ||
@@ -22,3 +20,4 @@ "cover": "jest --coverage", | ||
"release:minor": "npm run format && npm test && npm run build && npx standard-version -r minor && git push --follow-tags origin master", | ||
"release:major": "npm run format && npm test && npm run build && npx standard-version -r major && git push --follow-tags origin master" | ||
"release:major": "npm run format && npm test && npm run build && npx standard-version -r major && git push --follow-tags origin master", | ||
"update-contributors": "npx contributor" | ||
}, | ||
@@ -49,28 +48,46 @@ "repository": { | ||
"devDependencies": { | ||
"@types/enzyme": "3.10.4", | ||
"@types/jest": "24.0.25", | ||
"@types/react": "16.9.17", | ||
"@types/react-dom": "16.9.8", | ||
"@typescript-eslint/eslint-plugin": "2.15.0", | ||
"@typescript-eslint/parser": "2.15.0", | ||
"babel-cli": "6.26.0", | ||
"babel-eslint": "10.0.3", | ||
"babel-jest": "23.6.0", | ||
"babel-jest": "24.9.0", | ||
"babel-preset-es2015": "6.24.1", | ||
"babel-preset-react": "6.24.1", | ||
"babel-preset-stage-0": "6.24.1", | ||
"coveralls": "3.0.6", | ||
"enzyme": "3.10.0", | ||
"enzyme-adapter-react-16": "1.14.0", | ||
"eslint": "6.5.0", | ||
"coveralls": "3.0.9", | ||
"enzyme": "3.11.0", | ||
"enzyme-adapter-react-16": "1.15.2", | ||
"eslint": "6.8.0", | ||
"eslint-config-fbjs": "3.1.1", | ||
"eslint-config-prettier": "6.3.0", | ||
"eslint-config-prettier": "6.9.0", | ||
"eslint-plugin-babel": "5.3.0", | ||
"eslint-plugin-flowtype": "4.3.0", | ||
"eslint-plugin-import": "2.18.2", | ||
"eslint-plugin-flowtype": "4.6.0", | ||
"eslint-plugin-import": "2.20.0", | ||
"eslint-plugin-jsx-a11y": "6.2.3", | ||
"eslint-plugin-prettier": "3.1.1", | ||
"eslint-plugin-react": "7.14.3", | ||
"eslint-plugin-relay": "1.3.12", | ||
"jest": "23.6.0", | ||
"prettier": "1.18.2", | ||
"prop-types": "15.7.2", | ||
"react": "16.10.1", | ||
"react-dom": "16.10.1", | ||
"react-test-renderer": "16.10.1" | ||
"eslint-plugin-prettier": "3.1.2", | ||
"eslint-plugin-react": "7.17.0", | ||
"eslint-plugin-relay": "1.5.0", | ||
"jest": "24.9.0", | ||
"prettier": "1.19.1", | ||
"react": "16.12.0", | ||
"react-dom": "16.12.0", | ||
"react-test-renderer": "16.12.0", | ||
"ts-jest": "24.3.0", | ||
"typescript": "3.7.4" | ||
}, | ||
"dependencies": { | ||
"@types/enzyme-adapter-react-16": "1.0.5" | ||
}, | ||
"contributors": [ | ||
"Anton Fisher (https://github.com/antonfisher)", | ||
"Nicholas Yang (https://github.com/NicholasLYang)" | ||
], | ||
"directories": { | ||
"doc": "docs", | ||
"test": "tests" | ||
} | ||
} |
@@ -28,2 +28,3 @@ # react-simple-timefield | ||
input={<MyCustomInputElement />} // {Element} default: <input type="text" /> | ||
inputRef={(ref) => {...}} // {Function} input's ref | ||
colon=":" // {String} default: ":" | ||
@@ -63,3 +64,3 @@ showSeconds // {Boolean} default: false | ||
## Version 2 to 3 migration | ||
## Migrate version 2.x to version 3.x | ||
@@ -73,3 +74,3 @@ There is a breaking change in version 3. | ||
//After | ||
// After: | ||
<TimeField onChange={(event, value) => console.log(event, value)} /> | ||
@@ -87,3 +88,3 @@ ``` | ||
``` | ||
in `demo/index.js` file. | ||
in `demo/index.tsx` file. | ||
@@ -93,2 +94,4 @@ ```bash | ||
cd demo | ||
npm install | ||
npm install --only=dev | ||
npm run dev | ||
@@ -99,2 +102,4 @@ ``` | ||
```bash | ||
npm install | ||
npm install --only=dev | ||
npm test | ||
@@ -101,0 +106,0 @@ npm run format |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
39394
14
719
106
4
32
1
+ Added@types/cheerio@0.22.35(transitive)
+ Added@types/enzyme@3.10.18(transitive)
+ Added@types/enzyme-adapter-react-16@1.0.5(transitive)
+ Added@types/node@22.10.2(transitive)
+ Added@types/prop-types@15.7.14(transitive)
+ Added@types/react@16.14.62(transitive)
+ Added@types/scheduler@0.16.8(transitive)
+ Addedcsstype@3.1.3(transitive)
+ Addedundici-types@6.20.0(transitive)