Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-analog-clock

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-analog-clock - npm Package Compare versions

Comparing version 1.6.0 to 2.0.0

1061

dist/react-analog-clock.js

@@ -10,3 +10,3 @@ (function webpackUniversalModuleDefinition(root, factory) {

root["ReactSexyClock"] = factory(root["React"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_2__) {
})(this, function(__WEBPACK_EXTERNAL_MODULE_7__) {
return /******/ (function(modules) { // webpackBootstrap

@@ -56,3 +56,3 @@ /******/ // The module cache

/* 0 */
/***/ function(module, exports, __webpack_require__) {
/***/ (function(module, exports, __webpack_require__) {

@@ -66,3 +66,3 @@ 'use strict';

var _AnalogClock = __webpack_require__(3);
var _AnalogClock = __webpack_require__(8);

@@ -82,5 +82,5 @@ var _AnalogClock2 = _interopRequireDefault(_AnalogClock);

/***/ },
/***/ }),
/* 1 */
/***/ function(module, exports) {
/***/ (function(module, exports) {

@@ -152,14 +152,232 @@ 'use strict';

/***/ },
/***/ }),
/* 2 */
/***/ function(module, exports) {
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_2__;
"use strict";
/***/ },
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
function makeEmptyFunction(arg) {
return function () {
return arg;
};
}
/**
* This function accepts and discards inputs; it has no side effects. This is
* primarily useful idiomatically for overridable function endpoints which
* always need to be callable, since JS lacks a null-call idiom ala Cocoa.
*/
var emptyFunction = function emptyFunction() {};
emptyFunction.thatReturns = makeEmptyFunction;
emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
emptyFunction.thatReturnsNull = makeEmptyFunction(null);
emptyFunction.thatReturnsThis = function () {
return this;
};
emptyFunction.thatReturnsArgument = function (arg) {
return arg;
};
module.exports = emptyFunction;
/***/ }),
/* 3 */
/***/ function(module, exports, __webpack_require__) {
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
'use strict';
/**
* Use invariant() to assert state which your program assumes to be true.
*
* Provide sprintf-style format (only %s is supported) and arguments
* to provide information about what broke and what you were
* expecting.
*
* The invariant message will be stripped in production, but the invariant
* will remain to ensure logic does not differ in production.
*/
var validateFormat = function validateFormat(format) {};
if (true) {
validateFormat = function validateFormat(format) {
if (format === undefined) {
throw new Error('invariant requires an error message argument');
}
};
}
function invariant(condition, format, a, b, c, d, e, f) {
validateFormat(format);
if (!condition) {
var error;
if (format === undefined) {
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
} else {
var args = [a, b, c, d, e, f];
var argIndex = 0;
error = new Error(format.replace(/%s/g, function () {
return args[argIndex++];
}));
error.name = 'Invariant Violation';
}
error.framesToPop = 1; // we don't care about invariant's own frame
throw error;
}
}
module.exports = invariant;
/***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright (c) 2014-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
'use strict';
var emptyFunction = __webpack_require__(2);
/**
* Similar to invariant but only logs a warning if the condition is not met.
* This can be used to log issues in development environments in critical
* paths. Removing the logging code for production environments will keep the
* same logic and follow the same code paths.
*/
var warning = emptyFunction;
if (true) {
var printWarning = function printWarning(format) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
var argIndex = 0;
var message = 'Warning: ' + format.replace(/%s/g, function () {
return args[argIndex++];
});
if (typeof console !== 'undefined') {
console.error(message);
}
try {
// --- Welcome to debugging React ---
// This error was thrown as a convenience so that you can use this stack
// to find the callsite that caused this warning to fire.
throw new Error(message);
} catch (x) {}
};
warning = function warning(condition, format) {
if (format === undefined) {
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
}
if (format.indexOf('Failed Composite propType: ') === 0) {
return; // Ignore CompositeComponent proptype check.
}
if (!condition) {
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
args[_key2 - 2] = arguments[_key2];
}
printWarning.apply(undefined, [format].concat(args));
}
};
}
module.exports = warning;
/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
if (true) {
var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' &&
Symbol.for &&
Symbol.for('react.element')) ||
0xeac7;
var isValidElement = function(object) {
return typeof object === 'object' &&
object !== null &&
object.$$typeof === REACT_ELEMENT_TYPE;
};
// By explicitly using `prop-types` you are opting into new development behavior.
// http://fb.me/prop-types-in-prod
var throwOnDirectAccess = true;
module.exports = __webpack_require__(14)(isValidElement, throwOnDirectAccess);
} else {
// By explicitly using `prop-types` you are opting into new production behavior.
// http://fb.me/prop-types-in-prod
module.exports = require('./factoryWithThrowingShims')();
}
/***/ }),
/* 6 */
/***/ (function(module, exports) {
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
module.exports = ReactPropTypesSecret;
/***/ }),
/* 7 */
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_7__;
/***/ }),
/* 8 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {

@@ -173,15 +391,19 @@ value: true

var _react = __webpack_require__(2);
var _react = __webpack_require__(7);
var _react2 = _interopRequireDefault(_react);
var _AnalogClockLayout = __webpack_require__(4);
var _propTypes = __webpack_require__(5);
var _propTypes2 = _interopRequireDefault(_propTypes);
var _AnalogClockLayout = __webpack_require__(9);
var _AnalogClockLayout2 = _interopRequireDefault(_AnalogClockLayout);
var _styles = __webpack_require__(5);
var _styles = __webpack_require__(10);
var _styles2 = _interopRequireDefault(_styles);
var _util = __webpack_require__(6);
var _util = __webpack_require__(11);

@@ -204,3 +426,3 @@ var _themes = __webpack_require__(1);

var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(AnalogClock).call(this));
var _this = _possibleConstructorReturn(this, (AnalogClock.__proto__ || Object.getPrototypeOf(AnalogClock)).call(this));

@@ -262,13 +484,13 @@ var date = _this.initializeTime(props.gmtOffset);

AnalogClock.propTypes = {
theme: _react.PropTypes.shape({
background: _react.PropTypes.string.isRequired,
border: _react.PropTypes.string.isRequired,
center: _react.PropTypes.string.isRequired,
seconds: _react.PropTypes.string.isRequired,
minutes: _react.PropTypes.string.isRequired,
hour: _react.PropTypes.string.isRequired,
tick: _react.PropTypes.string.isRequired
theme: _propTypes2.default.shape({
background: _propTypes2.default.string.isRequired,
border: _propTypes2.default.string.isRequired,
center: _propTypes2.default.string.isRequired,
seconds: _propTypes2.default.string.isRequired,
minutes: _propTypes2.default.string.isRequired,
hour: _propTypes2.default.string.isRequired,
tick: _propTypes2.default.string.isRequired
}),
width: _react.PropTypes.number,
gmtOffset: _react.PropTypes.string
width: _propTypes2.default.number,
gmtOffset: _propTypes2.default.string
};

@@ -281,7 +503,7 @@

/***/ },
/* 4 */
/***/ function(module, exports, __webpack_require__) {
/***/ }),
/* 9 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
'use strict';

@@ -293,11 +515,15 @@ Object.defineProperty(exports, "__esModule", {

var _react = __webpack_require__(2);
var _react = __webpack_require__(7);
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__(5);
var _propTypes2 = _interopRequireDefault(_propTypes);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function renderNotches(_ref) {
var smallTick = _ref.smallTick;
var largeTick = _ref.largeTick;
var smallTick = _ref.smallTick,
largeTick = _ref.largeTick;

@@ -307,5 +533,5 @@ var notches = [];

var style = Object.assign({}, i % 5 === 0 ? largeTick : smallTick, {
transform: "translateX(-50%) translateY(-100%) rotate(" + i * 6 + "deg)"
transform: 'translateX(-50%) translateY(-100%) rotate(' + i * 6 + 'deg)'
});
notches.push(_react2.default.createElement("span", { key: i, style: style }));
notches.push(_react2.default.createElement('span', { key: i, style: style }));
}

@@ -316,26 +542,26 @@ return notches;

function AnalogClockLayout(_ref2) {
var hour = _ref2.hour;
var minutes = _ref2.minutes;
var seconds = _ref2.seconds;
var styles = _ref2.styles;
var hour = _ref2.hour,
minutes = _ref2.minutes,
seconds = _ref2.seconds,
styles = _ref2.styles;
// +1 to center align
var secondStyle = Object.assign({}, styles.second, {
transform: "translateX(-50%) translateY(-100%) rotate(" + (seconds * 6 + 1) + "deg)"
transform: 'translateX(-50%) translateY(-100%) rotate(' + (seconds * 6 + 1) + 'deg)'
});
// +1 to center align
var minuteStyle = Object.assign({}, styles.minute, {
transform: "translateX(-50%) translateY(-100%) rotate(" + (minutes * 6 + 1) + "deg)"
transform: 'translateX(-50%) translateY(-100%) rotate(' + (minutes * 6 + 1) + 'deg)'
});
// +1.5 to center align
var hourStyle = Object.assign({}, styles.hour, {
transform: "translateX(-50%) translateY(-100%) rotate(" + (hour * 30 + 1.5) + "deg)"
transform: 'translateX(-50%) translateY(-100%) rotate(' + (hour * 30 + 1.5) + 'deg)'
});
return _react2.default.createElement(
"div",
'div',
{ style: styles.base },
_react2.default.createElement("div", { "data-testid": "seconds", style: secondStyle }),
_react2.default.createElement("div", { "data-testid": "minutes", style: minuteStyle }),
_react2.default.createElement("div", { "data-testid": "hour", style: hourStyle }),
_react2.default.createElement("div", { style: styles.center }),
_react2.default.createElement('div', { 'data-testid': 'seconds', style: secondStyle }),
_react2.default.createElement('div', { 'data-testid': 'minutes', style: minuteStyle }),
_react2.default.createElement('div', { 'data-testid': 'hour', style: hourStyle }),
_react2.default.createElement('div', { style: styles.center }),
renderNotches(styles)

@@ -346,15 +572,15 @@ );

AnalogClockLayout.propTypes = {
hour: _react.PropTypes.number.isRequired,
minutes: _react.PropTypes.number.isRequired,
seconds: _react.PropTypes.number.isRequired,
styles: _react.PropTypes.shape({
second: _react.PropTypes.object.isRequired,
minute: _react.PropTypes.object.isRequired,
hour: _react.PropTypes.object.isRequired
hour: _propTypes2.default.number.isRequired,
minutes: _propTypes2.default.number.isRequired,
seconds: _propTypes2.default.number.isRequired,
styles: _propTypes2.default.shape({
second: _propTypes2.default.object.isRequired,
minute: _propTypes2.default.object.isRequired,
hour: _propTypes2.default.object.isRequired
}).isRequired
};
/***/ },
/* 5 */
/***/ function(module, exports) {
/***/ }),
/* 10 */
/***/ (function(module, exports) {

@@ -475,5 +701,5 @@ 'use strict';

/***/ },
/* 6 */
/***/ function(module, exports) {
/***/ }),
/* 11 */
/***/ (function(module, exports) {

@@ -503,5 +729,5 @@ 'use strict';

function updateTime(_ref) {
var seconds = _ref.seconds;
var minutes = _ref.minutes;
var hour = _ref.hour;
var seconds = _ref.seconds,
minutes = _ref.minutes,
hour = _ref.hour;

@@ -523,5 +749,714 @@ seconds += 1;

/***/ }
/***/ }),
/* 12 */
/***/ (function(module, exports) {
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/
'use strict';
/* eslint-disable no-unused-vars */
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
var hasOwnProperty = Object.prototype.hasOwnProperty;
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
function toObject(val) {
if (val === null || val === undefined) {
throw new TypeError('Object.assign cannot be called with null or undefined');
}
return Object(val);
}
function shouldUseNative() {
try {
if (!Object.assign) {
return false;
}
// Detect buggy property enumeration order in older V8 versions.
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
test1[5] = 'de';
if (Object.getOwnPropertyNames(test1)[0] === '5') {
return false;
}
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
var test2 = {};
for (var i = 0; i < 10; i++) {
test2['_' + String.fromCharCode(i)] = i;
}
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
return test2[n];
});
if (order2.join('') !== '0123456789') {
return false;
}
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
var test3 = {};
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
test3[letter] = letter;
});
if (Object.keys(Object.assign({}, test3)).join('') !==
'abcdefghijklmnopqrst') {
return false;
}
return true;
} catch (err) {
// We don't expect any of the above to throw, but better to be safe.
return false;
}
}
module.exports = shouldUseNative() ? Object.assign : function (target, source) {
var from;
var to = toObject(target);
var symbols;
for (var s = 1; s < arguments.length; s++) {
from = Object(arguments[s]);
for (var key in from) {
if (hasOwnProperty.call(from, key)) {
to[key] = from[key];
}
}
if (getOwnPropertySymbols) {
symbols = getOwnPropertySymbols(from);
for (var i = 0; i < symbols.length; i++) {
if (propIsEnumerable.call(from, symbols[i])) {
to[symbols[i]] = from[symbols[i]];
}
}
}
}
return to;
};
/***/ }),
/* 13 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';
if (true) {
var invariant = __webpack_require__(3);
var warning = __webpack_require__(4);
var ReactPropTypesSecret = __webpack_require__(6);
var loggedTypeFailures = {};
}
/**
* Assert that the values match with the type specs.
* Error messages are memorized and will only be shown once.
*
* @param {object} typeSpecs Map of name to a ReactPropType
* @param {object} values Runtime values that need to be type-checked
* @param {string} location e.g. "prop", "context", "child context"
* @param {string} componentName Name of the component for error messages.
* @param {?Function} getStack Returns the component stack.
* @private
*/
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
if (true) {
for (var typeSpecName in typeSpecs) {
if (typeSpecs.hasOwnProperty(typeSpecName)) {
var error;
// Prop type validation may throw. In case they do, we don't want to
// fail the render phase where it didn't fail before. So we log it.
// After these have been cleaned up, we'll let them throw.
try {
// This is intentionally an invariant that gets caught. It's the same
// behavior as without this statement except with a better message.
invariant(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'the `prop-types` package, but received `%s`.', componentName || 'React class', location, typeSpecName, typeof typeSpecs[typeSpecName]);
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
} catch (ex) {
error = ex;
}
warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error);
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
// Only monitor this failure once because there tends to be a lot of the
// same error.
loggedTypeFailures[error.message] = true;
var stack = getStack ? getStack() : '';
warning(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : '');
}
}
}
}
}
module.exports = checkPropTypes;
/***/ }),
/* 14 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';
var emptyFunction = __webpack_require__(2);
var invariant = __webpack_require__(3);
var warning = __webpack_require__(4);
var assign = __webpack_require__(12);
var ReactPropTypesSecret = __webpack_require__(6);
var checkPropTypes = __webpack_require__(13);
module.exports = function(isValidElement, throwOnDirectAccess) {
/* global Symbol */
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
/**
* Returns the iterator method function contained on the iterable object.
*
* Be sure to invoke the function with the iterable as context:
*
* var iteratorFn = getIteratorFn(myIterable);
* if (iteratorFn) {
* var iterator = iteratorFn.call(myIterable);
* ...
* }
*
* @param {?object} maybeIterable
* @return {?function}
*/
function getIteratorFn(maybeIterable) {
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
if (typeof iteratorFn === 'function') {
return iteratorFn;
}
}
/**
* Collection of methods that allow declaration and validation of props that are
* supplied to React components. Example usage:
*
* var Props = require('ReactPropTypes');
* var MyArticle = React.createClass({
* propTypes: {
* // An optional string prop named "description".
* description: Props.string,
*
* // A required enum prop named "category".
* category: Props.oneOf(['News','Photos']).isRequired,
*
* // A prop named "dialog" that requires an instance of Dialog.
* dialog: Props.instanceOf(Dialog).isRequired
* },
* render: function() { ... }
* });
*
* A more formal specification of how these methods are used:
*
* type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
* decl := ReactPropTypes.{type}(.isRequired)?
*
* Each and every declaration produces a function with the same signature. This
* allows the creation of custom validation functions. For example:
*
* var MyLink = React.createClass({
* propTypes: {
* // An optional string or URI prop named "href".
* href: function(props, propName, componentName) {
* var propValue = props[propName];
* if (propValue != null && typeof propValue !== 'string' &&
* !(propValue instanceof URI)) {
* return new Error(
* 'Expected a string or an URI for ' + propName + ' in ' +
* componentName
* );
* }
* }
* },
* render: function() {...}
* });
*
* @internal
*/
var ANONYMOUS = '<<anonymous>>';
// Important!
// Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
var ReactPropTypes = {
array: createPrimitiveTypeChecker('array'),
bool: createPrimitiveTypeChecker('boolean'),
func: createPrimitiveTypeChecker('function'),
number: createPrimitiveTypeChecker('number'),
object: createPrimitiveTypeChecker('object'),
string: createPrimitiveTypeChecker('string'),
symbol: createPrimitiveTypeChecker('symbol'),
any: createAnyTypeChecker(),
arrayOf: createArrayOfTypeChecker,
element: createElementTypeChecker(),
instanceOf: createInstanceTypeChecker,
node: createNodeChecker(),
objectOf: createObjectOfTypeChecker,
oneOf: createEnumTypeChecker,
oneOfType: createUnionTypeChecker,
shape: createShapeTypeChecker,
exact: createStrictShapeTypeChecker,
};
/**
* inlined Object.is polyfill to avoid requiring consumers ship their own
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
*/
/*eslint-disable no-self-compare*/
function is(x, y) {
// SameValue algorithm
if (x === y) {
// Steps 1-5, 7-10
// Steps 6.b-6.e: +0 != -0
return x !== 0 || 1 / x === 1 / y;
} else {
// Step 6.a: NaN == NaN
return x !== x && y !== y;
}
}
/*eslint-enable no-self-compare*/
/**
* We use an Error-like object for backward compatibility as people may call
* PropTypes directly and inspect their output. However, we don't use real
* Errors anymore. We don't inspect their stack anyway, and creating them
* is prohibitively expensive if they are created too often, such as what
* happens in oneOfType() for any type before the one that matched.
*/
function PropTypeError(message) {
this.message = message;
this.stack = '';
}
// Make `instanceof Error` still work for returned errors.
PropTypeError.prototype = Error.prototype;
function createChainableTypeChecker(validate) {
if (true) {
var manualPropTypeCallCache = {};
var manualPropTypeWarningCount = 0;
}
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
componentName = componentName || ANONYMOUS;
propFullName = propFullName || propName;
if (secret !== ReactPropTypesSecret) {
if (throwOnDirectAccess) {
// New behavior only for users of `prop-types` package
invariant(
false,
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
'Use `PropTypes.checkPropTypes()` to call them. ' +
'Read more at http://fb.me/use-check-prop-types'
);
} else if (("development") !== 'production' && typeof console !== 'undefined') {
// Old behavior for people using React.PropTypes
var cacheKey = componentName + ':' + propName;
if (
!manualPropTypeCallCache[cacheKey] &&
// Avoid spamming the console because they are often not actionable except for lib authors
manualPropTypeWarningCount < 3
) {
warning(
false,
'You are manually calling a React.PropTypes validation ' +
'function for the `%s` prop on `%s`. This is deprecated ' +
'and will throw in the standalone `prop-types` package. ' +
'You may be seeing this warning due to a third-party PropTypes ' +
'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.',
propFullName,
componentName
);
manualPropTypeCallCache[cacheKey] = true;
manualPropTypeWarningCount++;
}
}
}
if (props[propName] == null) {
if (isRequired) {
if (props[propName] === null) {
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
}
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
}
return null;
} else {
return validate(props, propName, componentName, location, propFullName);
}
}
var chainedCheckType = checkType.bind(null, false);
chainedCheckType.isRequired = checkType.bind(null, true);
return chainedCheckType;
}
function createPrimitiveTypeChecker(expectedType) {
function validate(props, propName, componentName, location, propFullName, secret) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== expectedType) {
// `propValue` being instance of, say, date/regexp, pass the 'object'
// check, but we can offer a more precise error message here rather than
// 'of type `object`'.
var preciseType = getPreciseType(propValue);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createAnyTypeChecker() {
return createChainableTypeChecker(emptyFunction.thatReturnsNull);
}
function createArrayOfTypeChecker(typeChecker) {
function validate(props, propName, componentName, location, propFullName) {
if (typeof typeChecker !== 'function') {
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
}
var propValue = props[propName];
if (!Array.isArray(propValue)) {
var propType = getPropType(propValue);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
}
for (var i = 0; i < propValue.length; i++) {
var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
if (error instanceof Error) {
return error;
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function createElementTypeChecker() {
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
if (!isValidElement(propValue)) {
var propType = getPropType(propValue);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createInstanceTypeChecker(expectedClass) {
function validate(props, propName, componentName, location, propFullName) {
if (!(props[propName] instanceof expectedClass)) {
var expectedClassName = expectedClass.name || ANONYMOUS;
var actualClassName = getClassName(props[propName]);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createEnumTypeChecker(expectedValues) {
if (!Array.isArray(expectedValues)) {
true ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0;
return emptyFunction.thatReturnsNull;
}
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
for (var i = 0; i < expectedValues.length; i++) {
if (is(propValue, expectedValues[i])) {
return null;
}
}
var valuesString = JSON.stringify(expectedValues);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
}
return createChainableTypeChecker(validate);
}
function createObjectOfTypeChecker(typeChecker) {
function validate(props, propName, componentName, location, propFullName) {
if (typeof typeChecker !== 'function') {
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
}
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== 'object') {
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
}
for (var key in propValue) {
if (propValue.hasOwnProperty(key)) {
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
if (error instanceof Error) {
return error;
}
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function createUnionTypeChecker(arrayOfTypeCheckers) {
if (!Array.isArray(arrayOfTypeCheckers)) {
true ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
return emptyFunction.thatReturnsNull;
}
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
var checker = arrayOfTypeCheckers[i];
if (typeof checker !== 'function') {
warning(
false,
'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
'received %s at index %s.',
getPostfixForTypeWarning(checker),
i
);
return emptyFunction.thatReturnsNull;
}
}
function validate(props, propName, componentName, location, propFullName) {
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
var checker = arrayOfTypeCheckers[i];
if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {
return null;
}
}
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
}
return createChainableTypeChecker(validate);
}
function createNodeChecker() {
function validate(props, propName, componentName, location, propFullName) {
if (!isNode(props[propName])) {
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createShapeTypeChecker(shapeTypes) {
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== 'object') {
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
}
for (var key in shapeTypes) {
var checker = shapeTypes[key];
if (!checker) {
continue;
}
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
if (error) {
return error;
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function createStrictShapeTypeChecker(shapeTypes) {
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== 'object') {
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
}
// We need to check all keys in case some are required but missing from
// props.
var allKeys = assign({}, props[propName], shapeTypes);
for (var key in allKeys) {
var checker = shapeTypes[key];
if (!checker) {
return new PropTypeError(
'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
'\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
'\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
);
}
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
if (error) {
return error;
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function isNode(propValue) {
switch (typeof propValue) {
case 'number':
case 'string':
case 'undefined':
return true;
case 'boolean':
return !propValue;
case 'object':
if (Array.isArray(propValue)) {
return propValue.every(isNode);
}
if (propValue === null || isValidElement(propValue)) {
return true;
}
var iteratorFn = getIteratorFn(propValue);
if (iteratorFn) {
var iterator = iteratorFn.call(propValue);
var step;
if (iteratorFn !== propValue.entries) {
while (!(step = iterator.next()).done) {
if (!isNode(step.value)) {
return false;
}
}
} else {
// Iterator will provide entry [k,v] tuples rather than values.
while (!(step = iterator.next()).done) {
var entry = step.value;
if (entry) {
if (!isNode(entry[1])) {
return false;
}
}
}
}
} else {
return false;
}
return true;
default:
return false;
}
}
function isSymbol(propType, propValue) {
// Native Symbol.
if (propType === 'symbol') {
return true;
}
// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
if (propValue['@@toStringTag'] === 'Symbol') {
return true;
}
// Fallback for non-spec compliant Symbols which are polyfilled.
if (typeof Symbol === 'function' && propValue instanceof Symbol) {
return true;
}
return false;
}
// Equivalent of `typeof` but with special handling for array and regexp.
function getPropType(propValue) {
var propType = typeof propValue;
if (Array.isArray(propValue)) {
return 'array';
}
if (propValue instanceof RegExp) {
// Old webkits (at least until Android 4.0) return 'function' rather than
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/
// passes PropTypes.object.
return 'object';
}
if (isSymbol(propType, propValue)) {
return 'symbol';
}
return propType;
}
// This handles more types than `getPropType`. Only used for error messages.
// See `createPrimitiveTypeChecker`.
function getPreciseType(propValue) {
if (typeof propValue === 'undefined' || propValue === null) {
return '' + propValue;
}
var propType = getPropType(propValue);
if (propType === 'object') {
if (propValue instanceof Date) {
return 'date';
} else if (propValue instanceof RegExp) {
return 'regexp';
}
}
return propType;
}
// Returns a string that is postfixed to a warning about an invalid type.
// For example, "undefined" or "of type array"
function getPostfixForTypeWarning(value) {
var type = getPreciseType(value);
switch (type) {
case 'array':
case 'object':
return 'an ' + type;
case 'boolean':
case 'date':
case 'regexp':
return 'a ' + type;
default:
return type;
}
}
// Returns class name of the object, if any.
function getClassName(propValue) {
if (!propValue.constructor || !propValue.constructor.name) {
return ANONYMOUS;
}
return propValue.constructor.name;
}
ReactPropTypes.checkPropTypes = checkPropTypes;
ReactPropTypes.PropTypes = ReactPropTypes;
return ReactPropTypes;
};
/***/ })
/******/ ])
});
;

2

dist/react-analog-clock.min.js

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.ReactSexyClock=t(require("react")):e.ReactSexyClock=t(e.React)}(this,function(e){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function o(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Themes=void 0;var i=r(3),u=o(i),s=r(1),c=n(s);t.Themes=c;t.default=u.default},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.light={background:"#fff",border:"#ececec",center:"#000",seconds:"#f56c6c",minutes:"#ccc",hour:"#000",tick:"#000"},t.dark={background:"#000",border:"#000",center:"#fff",seconds:"#fff",minutes:"#ccc",hour:"#fff",tick:"#fff"},t.aqua={background:"#eaeaea",border:"#3dd4c1",center:"#000",seconds:"#f56c6c",minutes:"#9c9c9c",hour:"#000",tick:"#000"},t.lime={background:"#a4f181",border:"#fff",center:"#ccc",seconds:"#fff",minutes:"#ccc",hour:"#fff",tick:"#fff"},t.sherbert={background:"linear-gradient(to left, #fee , #ddefbb)",border:"#fff",center:"#fff",seconds:"#fff",minutes:"#ccc",hour:"#fff",tick:"#fff"},t.navy={background:"linear-gradient(#2a70a0,#102d42)",border:"#fff",center:"#fff",seconds:"#fff",minutes:"#ccc",hour:"#fff",tick:"#fff"}},function(t,r){t.exports=e},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},c=function(){function e(e,t){for(var r=0;t.length>r;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=r(2),f=n(a),d=r(4),l=n(d),p=r(5),h=n(p),b=r(6),m=r(1),y=function(e){function t(e){o(this,t);var r=i(this,Object.getPrototypeOf(t).call(this)),n=r.initializeTime(e.gmtOffset);return r.state={seconds:n[2],minutes:n[1],hour:n[0]},r.styles=(0,b.cssTransform)(h.default,e),r}return u(t,e),c(t,[{key:"componentDidMount",value:function(){var e=this;this.interval=setInterval(function(){e.setState((0,b.updateTime)(e.state))},1e3)}},{key:"componentWillReceiveProps",value:function(e){this.styles=(0,b.cssTransform)(h.default,e)}},{key:"componentWillUnmount",value:function(){clearInterval(this.interval)}},{key:"initializeTime",value:function(e){var t=new Date;if(e&&"undefined"!==e){var r=new Date(t.valueOf()+1e3*parseFloat(e)*60*60);return[r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds()]}return[t.getHours(),t.getMinutes(),t.getSeconds()]}},{key:"render",value:function(){return f.default.createElement(l.default,s({},this.state,{styles:this.styles}))}}]),t}(a.Component);t.default=y,y.propTypes={theme:a.PropTypes.shape({background:a.PropTypes.string.isRequired,border:a.PropTypes.string.isRequired,center:a.PropTypes.string.isRequired,seconds:a.PropTypes.string.isRequired,minutes:a.PropTypes.string.isRequired,hour:a.PropTypes.string.isRequired,tick:a.PropTypes.string.isRequired}),width:a.PropTypes.number,gmtOffset:a.PropTypes.string},y.defaultProps={theme:m.dark,width:400}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){for(var t=e.smallTick,r=e.largeTick,n=[],o=0;60>o;o++){var i=Object.assign({},o%5===0?r:t,{transform:"translateX(-50%) translateY(-100%) rotate("+6*o+"deg)"});n.push(s.default.createElement("span",{key:o,style:i}))}return n}function i(e){var t=e.hour,r=e.minutes,n=e.seconds,i=e.styles,u=Object.assign({},i.second,{transform:"translateX(-50%) translateY(-100%) rotate("+(6*n+1)+"deg)"}),c=Object.assign({},i.minute,{transform:"translateX(-50%) translateY(-100%) rotate("+(6*r+1)+"deg)"}),a=Object.assign({},i.hour,{transform:"translateX(-50%) translateY(-100%) rotate("+(30*t+1.5)+"deg)"});return s.default.createElement("div",{style:i.base},s.default.createElement("div",{"data-testid":"seconds",style:u}),s.default.createElement("div",{"data-testid":"minutes",style:c}),s.default.createElement("div",{"data-testid":"hour",style:a}),s.default.createElement("div",{style:i.center}),o(i))}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var u=r(2),s=n(u);i.propTypes={hour:u.PropTypes.number.isRequired,minutes:u.PropTypes.number.isRequired,seconds:u.PropTypes.number.isRequired,styles:u.PropTypes.shape({second:u.PropTypes.object.isRequired,minute:u.PropTypes.object.isRequired,hour:u.PropTypes.object.isRequired}).isRequired}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={background:function(e){return e.theme.background},backgroundSize:"cover",backgroundPosition:"center",borderRadius:"100%",border:function(e){return e.width/20+"px solid "+e.theme.border},height:function(e){return e.width},position:"relative",width:function(e){return e.width}},n={background:function(e){return e.theme.center},borderRadius:"100%",height:"12px",left:"50%",position:"absolute",top:"50%",transform:"translateX(-50%) translateY(-50%)",width:"12px"},o={left:"50%",position:"absolute",top:"50%",transformOrigin:"50% 100%"},i=Object.assign({},o,{background:function(e){return e.theme.seconds},height:function(e){return Math.floor(.425*e.width)},width:3}),u=Object.assign({},o,{background:function(e){return e.theme.minutes},height:function(e){return Math.floor(.35*e.width)},width:6}),s=Object.assign({},o,{background:function(e){return e.theme.hour},height:function(e){return Math.floor(.2*e.width)},width:8}),c={background:function(e){return e.theme.tick},height:6,left:"50%",position:"absolute",top:6,transformOrigin:function(e){return"0 "+Math.ceil(e.width/2)+"px"},width:2},a={background:function(e){return e.theme.tick},height:10,left:function(e){return Math.ceil(e.width/2)+2},position:"absolute",top:10,transformOrigin:function(e){return"0 "+Math.ceil(e.width/2)+"px"},width:4};t.default={base:r,center:n,second:i,minute:u,hour:s,smallTick:c,largeTick:a}},function(e,t){"use strict";function r(e,t){return Object.keys(e).reduce(function(r,n){var o=e[n];return r[n]=Object.keys(o).reduce(function(e,r){return e[r]="function"==typeof o[r]?o[r](t):o[r],e},{}),r},{})}function n(e){var t=e.seconds,r=e.minutes,n=e.hour;return t+=1,60===t&&(t=0,r+=1),60===r&&(r=0,n+=1),12===n&&(n=0),{seconds:t,minutes:r,hour:n}}Object.defineProperty(t,"__esModule",{value:!0}),t.cssTransform=r,t.updateTime=n}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.ReactSexyClock=t(require("react")):e.ReactSexyClock=t(e.React)}(this,function(e){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Themes=void 0;var i=r(4),u=o(i),s=r(1),a=n(s);t.Themes=a;t.default=u.default},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.light={background:"#fff",border:"#ececec",center:"#000",seconds:"#f56c6c",minutes:"#ccc",hour:"#000",tick:"#000"},t.dark={background:"#000",border:"#000",center:"#fff",seconds:"#fff",minutes:"#ccc",hour:"#fff",tick:"#fff"},t.aqua={background:"#eaeaea",border:"#3dd4c1",center:"#000",seconds:"#f56c6c",minutes:"#9c9c9c",hour:"#000",tick:"#000"},t.lime={background:"#a4f181",border:"#fff",center:"#ccc",seconds:"#fff",minutes:"#ccc",hour:"#fff",tick:"#fff"},t.sherbert={background:"linear-gradient(to left, #fee , #ddefbb)",border:"#fff",center:"#fff",seconds:"#fff",minutes:"#ccc",hour:"#fff",tick:"#fff"},t.navy={background:"linear-gradient(#2a70a0,#102d42)",border:"#fff",center:"#fff",seconds:"#fff",minutes:"#ccc",hour:"#fff",tick:"#fff"}},function(e,t,r){e.exports=r(10)()},function(t,r){t.exports=e},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},a=function(){function e(e,t){for(var r=0;t.length>r;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),c=r(3),f=n(c),d=r(2),l=n(d),p=r(5),h=n(p),b=r(6),m=n(b),g=r(7),y=r(1),v=function(e){function t(e){o(this,t);var r=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this)),n=r.initializeTime(e.gmtOffset);return r.state={seconds:n[2],minutes:n[1],hour:n[0]},r.styles=(0,g.cssTransform)(m.default,e),r}return u(t,e),a(t,[{key:"componentDidMount",value:function(){var e=this;this.interval=setInterval(function(){e.setState((0,g.updateTime)(e.state))},1e3)}},{key:"componentWillReceiveProps",value:function(e){this.styles=(0,g.cssTransform)(m.default,e)}},{key:"componentWillUnmount",value:function(){clearInterval(this.interval)}},{key:"initializeTime",value:function(e){var t=new Date;if(e&&"undefined"!==e){var r=new Date(t.valueOf()+1e3*parseFloat(e)*60*60);return[r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds()]}return[t.getHours(),t.getMinutes(),t.getSeconds()]}},{key:"render",value:function(){return f.default.createElement(h.default,s({},this.state,{styles:this.styles}))}}]),t}(c.Component);t.default=v,v.propTypes={theme:l.default.shape({background:l.default.string.isRequired,border:l.default.string.isRequired,center:l.default.string.isRequired,seconds:l.default.string.isRequired,minutes:l.default.string.isRequired,hour:l.default.string.isRequired,tick:l.default.string.isRequired}),width:l.default.number,gmtOffset:l.default.string},v.defaultProps={theme:y.dark,width:400}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){for(var t=e.smallTick,r=e.largeTick,n=[],o=0;60>o;o++){var i=Object.assign({},o%5===0?r:t,{transform:"translateX(-50%) translateY(-100%) rotate("+6*o+"deg)"});n.push(s.default.createElement("span",{key:o,style:i}))}return n}function i(e){var t=e.hour,r=e.minutes,n=e.seconds,i=e.styles,u=Object.assign({},i.second,{transform:"translateX(-50%) translateY(-100%) rotate("+(6*n+1)+"deg)"}),a=Object.assign({},i.minute,{transform:"translateX(-50%) translateY(-100%) rotate("+(6*r+1)+"deg)"}),c=Object.assign({},i.hour,{transform:"translateX(-50%) translateY(-100%) rotate("+(30*t+1.5)+"deg)"});return s.default.createElement("div",{style:i.base},s.default.createElement("div",{"data-testid":"seconds",style:u}),s.default.createElement("div",{"data-testid":"minutes",style:a}),s.default.createElement("div",{"data-testid":"hour",style:c}),s.default.createElement("div",{style:i.center}),o(i))}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var u=r(3),s=n(u),a=r(2),c=n(a);i.propTypes={hour:c.default.number.isRequired,minutes:c.default.number.isRequired,seconds:c.default.number.isRequired,styles:c.default.shape({second:c.default.object.isRequired,minute:c.default.object.isRequired,hour:c.default.object.isRequired}).isRequired}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={background:function(e){return e.theme.background},backgroundSize:"cover",backgroundPosition:"center",borderRadius:"100%",border:function(e){return e.width/20+"px solid "+e.theme.border},height:function(e){return e.width},position:"relative",width:function(e){return e.width}},n={background:function(e){return e.theme.center},borderRadius:"100%",height:"12px",left:"50%",position:"absolute",top:"50%",transform:"translateX(-50%) translateY(-50%)",width:"12px"},o={left:"50%",position:"absolute",top:"50%",transformOrigin:"50% 100%"},i=Object.assign({},o,{background:function(e){return e.theme.seconds},height:function(e){return Math.floor(.425*e.width)},width:3}),u=Object.assign({},o,{background:function(e){return e.theme.minutes},height:function(e){return Math.floor(.35*e.width)},width:6}),s=Object.assign({},o,{background:function(e){return e.theme.hour},height:function(e){return Math.floor(.2*e.width)},width:8}),a={background:function(e){return e.theme.tick},height:6,left:"50%",position:"absolute",top:6,transformOrigin:function(e){return"0 "+Math.ceil(e.width/2)+"px"},width:2},c={background:function(e){return e.theme.tick},height:10,left:function(e){return Math.ceil(e.width/2)+2},position:"absolute",top:10,transformOrigin:function(e){return"0 "+Math.ceil(e.width/2)+"px"},width:4};t.default={base:r,center:n,second:i,minute:u,hour:s,smallTick:a,largeTick:c}},function(e,t){"use strict";function r(e,t){return Object.keys(e).reduce(function(r,n){var o=e[n];return r[n]=Object.keys(o).reduce(function(e,r){return e[r]="function"==typeof o[r]?o[r](t):o[r],e},{}),r},{})}function n(e){var t=e.seconds,r=e.minutes,n=e.hour;return t+=1,60===t&&(t=0,r+=1),60===r&&(r=0,n+=1),12===n&&(n=0),{seconds:t,minutes:r,hour:n}}Object.defineProperty(t,"__esModule",{value:!0}),t.cssTransform=r,t.updateTime=n},function(e,t){"use strict";function r(e){return function(){return e}}var n=function(){};n.thatReturns=r,n.thatReturnsFalse=r(!1),n.thatReturnsTrue=r(!0),n.thatReturnsNull=r(null),n.thatReturnsThis=function(){return this},n.thatReturnsArgument=function(e){return e},e.exports=n},function(e,t,r){"use strict";function n(e,t,r,n,i,u,s,a){if(o(t),!e){var c;if(void 0===t)c=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var f=[r,n,i,u,s,a],d=0;c=Error(t.replace(/%s/g,function(){return f[d++]})),c.name="Invariant Violation"}throw c.framesToPop=1,c}}var o=function(e){};e.exports=n},function(e,t,r){"use strict";var n=r(8),o=r(9),i=r(11);e.exports=function(){function e(e,t,r,n,u,s){s!==i&&o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function t(){return e}e.isRequired=e;var r={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return r.checkPropTypes=n,r.PropTypes=r,r}},function(e,t){"use strict";var r="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";e.exports=r}])});

@@ -15,2 +15,6 @@ 'use strict';

var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _AnalogClockLayout = require('./AnalogClockLayout');

@@ -42,3 +46,3 @@

var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(AnalogClock).call(this));
var _this = _possibleConstructorReturn(this, (AnalogClock.__proto__ || Object.getPrototypeOf(AnalogClock)).call(this));

@@ -100,13 +104,13 @@ var date = _this.initializeTime(props.gmtOffset);

AnalogClock.propTypes = {
theme: _react.PropTypes.shape({
background: _react.PropTypes.string.isRequired,
border: _react.PropTypes.string.isRequired,
center: _react.PropTypes.string.isRequired,
seconds: _react.PropTypes.string.isRequired,
minutes: _react.PropTypes.string.isRequired,
hour: _react.PropTypes.string.isRequired,
tick: _react.PropTypes.string.isRequired
theme: _propTypes2.default.shape({
background: _propTypes2.default.string.isRequired,
border: _propTypes2.default.string.isRequired,
center: _propTypes2.default.string.isRequired,
seconds: _propTypes2.default.string.isRequired,
minutes: _propTypes2.default.string.isRequired,
hour: _propTypes2.default.string.isRequired,
tick: _propTypes2.default.string.isRequired
}),
width: _react.PropTypes.number,
gmtOffset: _react.PropTypes.string
width: _propTypes2.default.number,
gmtOffset: _propTypes2.default.string
};

@@ -113,0 +117,0 @@

@@ -1,2 +0,2 @@

"use strict";
'use strict';

@@ -8,11 +8,15 @@ Object.defineProperty(exports, "__esModule", {

var _react = require("react");
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 renderNotches(_ref) {
var smallTick = _ref.smallTick;
var largeTick = _ref.largeTick;
var smallTick = _ref.smallTick,
largeTick = _ref.largeTick;

@@ -22,5 +26,5 @@ var notches = [];

var style = Object.assign({}, i % 5 === 0 ? largeTick : smallTick, {
transform: "translateX(-50%) translateY(-100%) rotate(" + i * 6 + "deg)"
transform: 'translateX(-50%) translateY(-100%) rotate(' + i * 6 + 'deg)'
});
notches.push(_react2.default.createElement("span", { key: i, style: style }));
notches.push(_react2.default.createElement('span', { key: i, style: style }));
}

@@ -31,26 +35,26 @@ return notches;

function AnalogClockLayout(_ref2) {
var hour = _ref2.hour;
var minutes = _ref2.minutes;
var seconds = _ref2.seconds;
var styles = _ref2.styles;
var hour = _ref2.hour,
minutes = _ref2.minutes,
seconds = _ref2.seconds,
styles = _ref2.styles;
// +1 to center align
var secondStyle = Object.assign({}, styles.second, {
transform: "translateX(-50%) translateY(-100%) rotate(" + (seconds * 6 + 1) + "deg)"
transform: 'translateX(-50%) translateY(-100%) rotate(' + (seconds * 6 + 1) + 'deg)'
});
// +1 to center align
var minuteStyle = Object.assign({}, styles.minute, {
transform: "translateX(-50%) translateY(-100%) rotate(" + (minutes * 6 + 1) + "deg)"
transform: 'translateX(-50%) translateY(-100%) rotate(' + (minutes * 6 + 1) + 'deg)'
});
// +1.5 to center align
var hourStyle = Object.assign({}, styles.hour, {
transform: "translateX(-50%) translateY(-100%) rotate(" + (hour * 30 + 1.5) + "deg)"
transform: 'translateX(-50%) translateY(-100%) rotate(' + (hour * 30 + 1.5) + 'deg)'
});
return _react2.default.createElement(
"div",
'div',
{ style: styles.base },
_react2.default.createElement("div", { "data-testid": "seconds", style: secondStyle }),
_react2.default.createElement("div", { "data-testid": "minutes", style: minuteStyle }),
_react2.default.createElement("div", { "data-testid": "hour", style: hourStyle }),
_react2.default.createElement("div", { style: styles.center }),
_react2.default.createElement('div', { 'data-testid': 'seconds', style: secondStyle }),
_react2.default.createElement('div', { 'data-testid': 'minutes', style: minuteStyle }),
_react2.default.createElement('div', { 'data-testid': 'hour', style: hourStyle }),
_react2.default.createElement('div', { style: styles.center }),
renderNotches(styles)

@@ -61,10 +65,10 @@ );

AnalogClockLayout.propTypes = {
hour: _react.PropTypes.number.isRequired,
minutes: _react.PropTypes.number.isRequired,
seconds: _react.PropTypes.number.isRequired,
styles: _react.PropTypes.shape({
second: _react.PropTypes.object.isRequired,
minute: _react.PropTypes.object.isRequired,
hour: _react.PropTypes.object.isRequired
hour: _propTypes2.default.number.isRequired,
minutes: _propTypes2.default.number.isRequired,
seconds: _propTypes2.default.number.isRequired,
styles: _propTypes2.default.shape({
second: _propTypes2.default.object.isRequired,
minute: _propTypes2.default.object.isRequired,
hour: _propTypes2.default.object.isRequired
}).isRequired
};

@@ -24,5 +24,5 @@ 'use strict';

function updateTime(_ref) {
var seconds = _ref.seconds;
var minutes = _ref.minutes;
var hour = _ref.hour;
var seconds = _ref.seconds,
minutes = _ref.minutes,
hour = _ref.hour;

@@ -29,0 +29,0 @@ seconds += 1;

@@ -15,2 +15,6 @@ 'use strict';

var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _AnalogClockLayout = require('./AnalogClockLayout');

@@ -42,3 +46,3 @@

var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(AnalogClock).call(this));
var _this = _possibleConstructorReturn(this, (AnalogClock.__proto__ || Object.getPrototypeOf(AnalogClock)).call(this));

@@ -100,13 +104,13 @@ var date = _this.initializeTime(props.gmtOffset);

AnalogClock.propTypes = {
theme: _react.PropTypes.shape({
background: _react.PropTypes.string.isRequired,
border: _react.PropTypes.string.isRequired,
center: _react.PropTypes.string.isRequired,
seconds: _react.PropTypes.string.isRequired,
minutes: _react.PropTypes.string.isRequired,
hour: _react.PropTypes.string.isRequired,
tick: _react.PropTypes.string.isRequired
theme: _propTypes2.default.shape({
background: _propTypes2.default.string.isRequired,
border: _propTypes2.default.string.isRequired,
center: _propTypes2.default.string.isRequired,
seconds: _propTypes2.default.string.isRequired,
minutes: _propTypes2.default.string.isRequired,
hour: _propTypes2.default.string.isRequired,
tick: _propTypes2.default.string.isRequired
}),
width: _react.PropTypes.number,
gmtOffset: _react.PropTypes.string
width: _propTypes2.default.number,
gmtOffset: _propTypes2.default.string
};

@@ -113,0 +117,0 @@

@@ -1,2 +0,2 @@

"use strict";
'use strict';

@@ -8,11 +8,15 @@ Object.defineProperty(exports, "__esModule", {

var _react = require("react");
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 renderNotches(_ref) {
var smallTick = _ref.smallTick;
var largeTick = _ref.largeTick;
var smallTick = _ref.smallTick,
largeTick = _ref.largeTick;

@@ -22,5 +26,5 @@ var notches = [];

var style = Object.assign({}, i % 5 === 0 ? largeTick : smallTick, {
transform: "translateX(-50%) translateY(-100%) rotate(" + i * 6 + "deg)"
transform: 'translateX(-50%) translateY(-100%) rotate(' + i * 6 + 'deg)'
});
notches.push(_react2.default.createElement("span", { key: i, style: style }));
notches.push(_react2.default.createElement('span', { key: i, style: style }));
}

@@ -31,26 +35,26 @@ return notches;

function AnalogClockLayout(_ref2) {
var hour = _ref2.hour;
var minutes = _ref2.minutes;
var seconds = _ref2.seconds;
var styles = _ref2.styles;
var hour = _ref2.hour,
minutes = _ref2.minutes,
seconds = _ref2.seconds,
styles = _ref2.styles;
// +1 to center align
var secondStyle = Object.assign({}, styles.second, {
transform: "translateX(-50%) translateY(-100%) rotate(" + (seconds * 6 + 1) + "deg)"
transform: 'translateX(-50%) translateY(-100%) rotate(' + (seconds * 6 + 1) + 'deg)'
});
// +1 to center align
var minuteStyle = Object.assign({}, styles.minute, {
transform: "translateX(-50%) translateY(-100%) rotate(" + (minutes * 6 + 1) + "deg)"
transform: 'translateX(-50%) translateY(-100%) rotate(' + (minutes * 6 + 1) + 'deg)'
});
// +1.5 to center align
var hourStyle = Object.assign({}, styles.hour, {
transform: "translateX(-50%) translateY(-100%) rotate(" + (hour * 30 + 1.5) + "deg)"
transform: 'translateX(-50%) translateY(-100%) rotate(' + (hour * 30 + 1.5) + 'deg)'
});
return _react2.default.createElement(
"div",
'div',
{ style: styles.base },
_react2.default.createElement("div", { "data-testid": "seconds", style: secondStyle }),
_react2.default.createElement("div", { "data-testid": "minutes", style: minuteStyle }),
_react2.default.createElement("div", { "data-testid": "hour", style: hourStyle }),
_react2.default.createElement("div", { style: styles.center }),
_react2.default.createElement('div', { 'data-testid': 'seconds', style: secondStyle }),
_react2.default.createElement('div', { 'data-testid': 'minutes', style: minuteStyle }),
_react2.default.createElement('div', { 'data-testid': 'hour', style: hourStyle }),
_react2.default.createElement('div', { style: styles.center }),
renderNotches(styles)

@@ -61,10 +65,10 @@ );

AnalogClockLayout.propTypes = {
hour: _react.PropTypes.number.isRequired,
minutes: _react.PropTypes.number.isRequired,
seconds: _react.PropTypes.number.isRequired,
styles: _react.PropTypes.shape({
second: _react.PropTypes.object.isRequired,
minute: _react.PropTypes.object.isRequired,
hour: _react.PropTypes.object.isRequired
hour: _propTypes2.default.number.isRequired,
minutes: _propTypes2.default.number.isRequired,
seconds: _propTypes2.default.number.isRequired,
styles: _propTypes2.default.shape({
second: _propTypes2.default.object.isRequired,
minute: _propTypes2.default.object.isRequired,
hour: _propTypes2.default.object.isRequired
}).isRequired
};

@@ -24,5 +24,5 @@ 'use strict';

function updateTime(_ref) {
var seconds = _ref.seconds;
var minutes = _ref.minutes;
var hour = _ref.hour;
var seconds = _ref.seconds,
minutes = _ref.minutes,
hour = _ref.hour;

@@ -29,0 +29,0 @@ seconds += 1;

{
"name": "react-analog-clock",
"version": "1.6.0",
"version": "2.0.0",
"description": "A themable analog clock component",

@@ -29,4 +29,5 @@ "main": "lib/index.js",

"peerDependencies": {
"react": "^0.14.8",
"react-dom": "^0.14.8"
"react": "^16.0.0",
"react-dom": "^16.0.0",
"prop-types": "^15.6.0"
},

@@ -33,0 +34,0 @@ "devDependencies": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc