react-time-picker
Advanced tools
Comparing version 2.0.0 to 2.1.0
{ | ||
"name": "react-time-picker", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "An input component for picking time for your React application.", | ||
"main": "build/entry.js", | ||
"main": "dist/entry.js", | ||
"es6": "src/entry.js", | ||
"scripts": { | ||
"build": "npm run build-js && npm run build-styles && npm run copy-styles", | ||
"build-js": "babel src -d build --ignore **/__tests__", | ||
"build-js": "babel src -d dist --ignore **/__tests__", | ||
"build-styles": "lessc ./src/TimePicker.less ./src/TimePicker.css", | ||
@@ -20,3 +20,2 @@ "copy-styles": "node ./copy-styles.js", | ||
"setupFiles": [ | ||
"<rootDir>/jest.shim.js", | ||
"<rootDir>/jest.setup.js" | ||
@@ -40,3 +39,3 @@ ], | ||
"dependencies": { | ||
"detect-element-overflow": "^1.1.0", | ||
"detect-element-overflow": "^1.1.1", | ||
"lodash.once": "^4.1.1", | ||
@@ -46,3 +45,3 @@ "merge-class-names": "^1.1.1", | ||
"react": ">=15.5", | ||
"react-clock": "^2.1.0", | ||
"react-clock": "^2.2.0", | ||
"react-dom": ">=15.5" | ||
@@ -67,3 +66,4 @@ }, | ||
"eslint-plugin-react": "^7.5.1", | ||
"jest": "^21.2.1", | ||
"jest": "^22.0.4", | ||
"jest-cli": "^22.0.4", | ||
"less": "^2.7.3", | ||
@@ -76,3 +76,3 @@ "react-test-renderer": "^16.2.0" | ||
"index.d.ts", | ||
"build/", | ||
"dist/", | ||
"src/" | ||
@@ -79,0 +79,0 @@ ], |
@@ -78,3 +78,3 @@ ![downloads](https://img.shields.io/npm/dt/react-time-picker.svg) ![build](https://img.shields.io/travis/wojtekmaj/react-time-picker.svg) ![dependencies](https://img.shields.io/david/wojtekmaj/react-time-picker.svg | ||
If you don't want to use default React-Time-Picker styling to build upon it, you can import React-Time-Picker by using `import TimePicker from 'react-time-picker/build/entry.nostyle';` instead. | ||
If you don't want to use default React-Time-Picker styling to build upon it, you can import React-Time-Picker by using `import TimePicker from 'react-time-picker/dist/entry.nostyle';` instead. | ||
@@ -81,0 +81,0 @@ ## User guide |
import PropTypes from 'prop-types'; | ||
// eslint-disable-next-line import/prefer-default-export | ||
export const isTime = PropTypes.string; // TODO better check | ||
const allViews = ['hour', 'minute', 'second']; | ||
const hourOptionalSecondsRegExp = /^(([0-1])?[0-9]|2[0-3]):[0-5][0-9](:([0-5][0-9]))?$/; | ||
export const isTime = (props, propName, componentName) => { | ||
const time = props[propName]; | ||
if (time) { | ||
if (!hourOptionalSecondsRegExp.test(time)) { | ||
return new Error(`Warning: Failed prop type: Invalid prop \`${propName}\` of type \`${typeof minDate}\` supplied to \`${componentName}\`, expected time in HH:mm(:ss) format.`); | ||
} | ||
} | ||
// Everything is fine | ||
return null; | ||
}; | ||
export const isDetail = PropTypes.oneOf(allViews); | ||
export const isValueType = PropTypes.oneOf(allViews); | ||
export const isValueType = isDetail; |
@@ -12,3 +12,3 @@ export const min = (...args) => Math.min(...args.filter(a => typeof a === 'number')); | ||
const width = span.clientWidth + 4; | ||
const width = span.getBoundingClientRect().width + 4; | ||
element.style.width = `${width}px`; | ||
@@ -15,0 +15,0 @@ |
@@ -54,6 +54,8 @@ import React, { Component } from 'react'; | ||
.split('') | ||
// We don't want spaces in time | ||
.filter(a => a.charCodeAt(0) !== 32) | ||
// Internet Explorer specific | ||
.filter(a => a.charCodeAt(0) !== 8206) | ||
.filter(a => ( | ||
// We don't want spaces in dates | ||
a.charCodeAt(0) !== 32 && | ||
// Internet Explorer specific | ||
a.charCodeAt(0) !== 8206 | ||
)) | ||
.join(''); | ||
@@ -230,3 +232,3 @@ | ||
if (this.props.onChange) { | ||
const formElements = [this.hourInput, this.minuteInput, this.secondInput].filter(a => a); | ||
const formElements = [this.hourInput, this.minuteInput, this.secondInput].filter(Boolean); | ||
@@ -308,3 +310,3 @@ const values = {}; | ||
}) | ||
.filter(part => part) | ||
.filter(Boolean) | ||
.reduce((result, element, index, array) => { | ||
@@ -311,0 +313,0 @@ result.push(element); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
94688
2299
1
20
Updatedreact-clock@^2.2.0