@desynova-digital/components 8.19.59 → 8.19.61

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.timeToSeconds = timeToSeconds;
7
+ function timeToSeconds() {
8
+ var time = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '00:00:00:00';
9
+ var frameRate = arguments.length > 1 ? arguments[1] : undefined;
10
+ var timeObj = time.split(':'); // split it at the colons
11
+
12
+ // minutes are worth 60 seconds. Hours are worth 60 minutes.
13
+ var seconds = +timeObj[0] * 60 * 60 + +timeObj[1] * 60 + +timeObj[2];
14
+ if (timeObj.length > 3 && frameRate) {
15
+ var frames = timeObj[3] * (1 / frameRate);
16
+ seconds += frames;
17
+ }
18
+ return seconds;
19
+ }
@@ -14,7 +14,7 @@ var _timeCodeInput2 = _interopRequireDefault(_timeCodeInput);
14
14
 
15
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
16
 
17
- (0, _react3.storiesOf)("InputText").add("dark theme", function () {
17
+ (0, _react3.storiesOf)("TimeCodeInput").add("dark theme", function () {
18
18
  return _react2.default.createElement(
19
19
  _storyHelpers.Example,
20
20
  { title: "Appearances" },
@@ -16,7 +16,7 @@ var _styledComponents = require('styled-components');
16
16
 
17
17
  var _styledComponents2 = _interopRequireDefault(_styledComponents);
18
18
 
19
- var _utils = require('@desynova-digital/player/utils');
19
+ var _utils = require('../../_helpers/utils');
20
20
 
21
21
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22
22
 
@@ -56,7 +56,7 @@ var TimeCodeInput = function TimeCodeInput(_ref) {
56
56
  if ((cursorPosition === 2 || cursorPosition === 5 || cursorPosition === 8) && e.nativeEvent.inputType !== 'insertText' && inputTime.length >= 11) {
57
57
  formattedTime = inputTime;
58
58
  } else {
59
- var cleanedTime = inputTime.replace(/:/g, '');
59
+ var cleanedTime = inputTime.replace(/[^\d]/g, '');
60
60
  formattedTime = cleanedTime.replace(/(\d{2})(?=\d)/g, '$1:');
61
61
  }
62
62
  e.target.value = formattedTime;
@@ -101,6 +101,7 @@ var TimeCodeInput = function TimeCodeInput(_ref) {
101
101
  document.activeElement.blur();
102
102
  }
103
103
  };
104
+ checkIfTimeValid(inputValue);
104
105
  setCustomInputValue(inputValue);
105
106
  document.addEventListener('keydown', handleEscapeKey);
106
107
  return function () {
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@desynova-digital/components",
3
- "version": "8.19.59",
3
+ "version": "8.19.61",
4
4
  "description": "Components for Desynova Digital",
5
5
  "main": "index.js",
6
6
  "author": "desynova-digital",
7
7
  "license": "MIT",
8
8
  "repository": "desynova-digital",
9
9
  "dependencies": {
10
- "@desynova-digital/tokens": "8.19.59",
10
+ "@desynova-digital/tokens": "8.19.61",
11
11
  "prop-types": "^15.7.2",
12
12
  "styled-components": "^4.3.2"
13
13
  },