@commercetools-uikit/utils 12.2.0 → 12.2.5
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.
- package/dist/commercetools-uikit-utils.cjs.dev.js +30 -23
- package/dist/commercetools-uikit-utils.cjs.prod.js +26 -19
- package/dist/commercetools-uikit-utils.esm.js +17 -10
- package/dist/declarations/src/add-static-fields.d.ts +4 -4
- package/dist/declarations/src/create-sequential-id.d.ts +3 -3
- package/dist/declarations/src/filter-aria-attributes.d.ts +3 -3
- package/dist/declarations/src/filter-data-attributes.d.ts +3 -3
- package/dist/declarations/src/filter-invalid-attributes.d.ts +3 -3
- package/dist/declarations/src/get-field-id.d.ts +6 -6
- package/dist/declarations/src/helpers/exenv.d.ts +1 -1
- package/dist/declarations/src/helpers/safeHTMLElement.d.ts +2 -2
- package/dist/declarations/src/index.d.ts +14 -14
- package/dist/declarations/src/is-numberish.d.ts +1 -1
- package/dist/declarations/src/parse-time.d.ts +8 -8
- package/dist/declarations/src/version.d.ts +2 -2
- package/dist/declarations/src/warn-deprecated-component.d.ts +1 -1
- package/dist/declarations/src/warn-deprecated-prop.d.ts +1 -1
- package/dist/declarations/src/warning.d.ts +3 -3
- package/package.json +13 -10
|
@@ -8,7 +8,7 @@ var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/ins
|
|
|
8
8
|
var _Object$entries = require('@babel/runtime-corejs3/core-js-stable/object/entries');
|
|
9
9
|
var isPropValid = require('@emotion/is-prop-valid');
|
|
10
10
|
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
11
|
-
var warning$
|
|
11
|
+
var warning$2 = require('warning');
|
|
12
12
|
var _trimInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/trim');
|
|
13
13
|
var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
|
|
14
14
|
|
|
@@ -19,42 +19,42 @@ var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInsta
|
|
|
19
19
|
var _Object$entries__default = /*#__PURE__*/_interopDefault(_Object$entries);
|
|
20
20
|
var isPropValid__default = /*#__PURE__*/_interopDefault(isPropValid);
|
|
21
21
|
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
22
|
-
var warning__default = /*#__PURE__*/_interopDefault(warning$
|
|
22
|
+
var warning__default = /*#__PURE__*/_interopDefault(warning$2);
|
|
23
23
|
var _trimInstanceProperty__default = /*#__PURE__*/_interopDefault(_trimInstanceProperty);
|
|
24
24
|
var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
|
|
25
25
|
|
|
26
|
-
var regexpData = /^data-/;
|
|
26
|
+
var regexpData$1 = /^data-/;
|
|
27
27
|
function filterDataAttributes(obj) {
|
|
28
28
|
var _context;
|
|
29
29
|
|
|
30
|
-
return _Object$fromEntries__default[
|
|
30
|
+
return _Object$fromEntries__default["default"](_filterInstanceProperty__default["default"](_context = _Object$entries__default["default"](obj)).call(_context, function (_ref) {
|
|
31
31
|
var _ref2 = _slicedToArray(_ref, 1),
|
|
32
32
|
propFromEntry = _ref2[0];
|
|
33
33
|
|
|
34
|
-
return regexpData.test(propFromEntry);
|
|
34
|
+
return regexpData$1.test(propFromEntry);
|
|
35
35
|
}));
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
var regexpData
|
|
38
|
+
var regexpData = /^aria-/;
|
|
39
39
|
function filterAriaAttributes(obj) {
|
|
40
40
|
var _context;
|
|
41
41
|
|
|
42
|
-
return _Object$fromEntries__default[
|
|
42
|
+
return _Object$fromEntries__default["default"](_filterInstanceProperty__default["default"](_context = _Object$entries__default["default"](obj)).call(_context, function (_ref) {
|
|
43
43
|
var _ref2 = _slicedToArray(_ref, 1),
|
|
44
44
|
propFromEntry = _ref2[0];
|
|
45
45
|
|
|
46
|
-
return regexpData
|
|
46
|
+
return regexpData.test(propFromEntry);
|
|
47
47
|
}));
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
function filterInvalidAttributes(obj) {
|
|
51
51
|
var _context;
|
|
52
52
|
|
|
53
|
-
return _Object$fromEntries__default[
|
|
53
|
+
return _Object$fromEntries__default["default"](_filterInstanceProperty__default["default"](_context = _Object$entries__default["default"](obj)).call(_context, function (_ref) {
|
|
54
54
|
var _ref2 = _slicedToArray(_ref, 1),
|
|
55
55
|
propFromEntry = _ref2[0];
|
|
56
56
|
|
|
57
|
-
return isPropValid__default[
|
|
57
|
+
return isPropValid__default["default"](propFromEntry);
|
|
58
58
|
}));
|
|
59
59
|
}
|
|
60
60
|
|
|
@@ -69,9 +69,9 @@ function warnDeprecatedComponent(componentName) {
|
|
|
69
69
|
|
|
70
70
|
var additionalMessage = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
71
71
|
|
|
72
|
-
var message = _concatInstanceProperty__default[
|
|
72
|
+
var message = _concatInstanceProperty__default["default"](_context = "\"".concat(componentName, "\" has been deprecated and will be removed in the next major version.")).call(_context, additionalMessage);
|
|
73
73
|
|
|
74
|
-
process.env.NODE_ENV !== "production" ? warning__default[
|
|
74
|
+
process.env.NODE_ENV !== "production" ? warning__default["default"](false, message) : void 0;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
function warnDeprecatedProp(propName, componentName) {
|
|
@@ -79,9 +79,9 @@ function warnDeprecatedProp(propName, componentName) {
|
|
|
79
79
|
|
|
80
80
|
var additionalMessage = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
81
81
|
|
|
82
|
-
var message = _concatInstanceProperty__default[
|
|
82
|
+
var message = _concatInstanceProperty__default["default"](_context = _concatInstanceProperty__default["default"](_context2 = "\"".concat(propName, "\" property of \"")).call(_context2, componentName, "\" has been deprecated and will be removed in the next major version.")).call(_context, additionalMessage);
|
|
83
83
|
|
|
84
|
-
process.env.NODE_ENV !== "production" ? warning__default[
|
|
84
|
+
process.env.NODE_ENV !== "production" ? warning__default["default"](false, message) : void 0;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
// Whenever a field requires a unique id, this factory can be used
|
|
@@ -96,7 +96,7 @@ function createSequentialId(prefix) {
|
|
|
96
96
|
var _context;
|
|
97
97
|
|
|
98
98
|
id += 1;
|
|
99
|
-
return _concatInstanceProperty__default[
|
|
99
|
+
return _concatInstanceProperty__default["default"](_context = "".concat(prefix)).call(_context, id);
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
102
|
|
|
@@ -104,6 +104,8 @@ var getFieldId = function getFieldId(props, state, createId) {
|
|
|
104
104
|
return props.id || state.id || createId();
|
|
105
105
|
};
|
|
106
106
|
|
|
107
|
+
var getFieldId$1 = getFieldId;
|
|
108
|
+
|
|
107
109
|
// Attempts to parse a string containing a time in either 12h or 24h format,
|
|
108
110
|
// with precision of up to three milliseconds
|
|
109
111
|
// Valid inputs:
|
|
@@ -121,7 +123,7 @@ var getFieldId = function getFieldId(props, state, createId) {
|
|
|
121
123
|
var parseTime = function parseTime(rawTime) {
|
|
122
124
|
if (!rawTime || typeof rawTime !== 'string') return null;
|
|
123
125
|
|
|
124
|
-
var time = _trimInstanceProperty__default[
|
|
126
|
+
var time = _trimInstanceProperty__default["default"](rawTime).call(rawTime).toLowerCase();
|
|
125
127
|
|
|
126
128
|
var match = time.match(/^(\d{1,2})(?::(\d{1,2})(?::(\d{1,2})(?:\.(\d{1,3}))?)?)?\s*(am|pm)?$/);
|
|
127
129
|
if (!match) return null; // As we accept eg "3 AM" there might not be a value for minutes, seconds or
|
|
@@ -171,15 +173,18 @@ var parseTime = function parseTime(rawTime) {
|
|
|
171
173
|
};
|
|
172
174
|
};
|
|
173
175
|
|
|
176
|
+
var parseTime$1 = parseTime;
|
|
177
|
+
|
|
174
178
|
// eslint-disable-next-line import/prefer-default-export
|
|
175
179
|
var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
176
180
|
|
|
177
181
|
var SafeHTMLElement = canUseDOM ? window.HTMLElement : {};
|
|
182
|
+
var SafeHTMLElement$1 = SafeHTMLElement;
|
|
178
183
|
|
|
179
184
|
function addStaticFields(Component, fields) {
|
|
180
185
|
var _context;
|
|
181
186
|
|
|
182
|
-
_forEachInstanceProperty__default[
|
|
187
|
+
_forEachInstanceProperty__default["default"](_context = _Object$entries__default["default"](fields)).call(_context, function (_ref) {
|
|
183
188
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
184
189
|
key = _ref2[0],
|
|
185
190
|
value = _ref2[1];
|
|
@@ -216,20 +221,22 @@ var warning = function warning(condition, message) {
|
|
|
216
221
|
throw new Error("".concat(prefix, ": ").concat(message || ''));
|
|
217
222
|
};
|
|
218
223
|
|
|
219
|
-
|
|
220
|
-
|
|
224
|
+
var warning$1 = warning;
|
|
225
|
+
|
|
226
|
+
// NOTE: This string will be replaced on build time with the package version.
|
|
227
|
+
var version = "12.2.5";
|
|
221
228
|
|
|
222
|
-
exports.SafeHTMLElement = SafeHTMLElement;
|
|
229
|
+
exports.SafeHTMLElement = SafeHTMLElement$1;
|
|
223
230
|
exports.addStaticFields = addStaticFields;
|
|
224
231
|
exports.canUseDOM = canUseDOM;
|
|
225
232
|
exports.createSequentialId = createSequentialId;
|
|
226
233
|
exports.filterAriaAttributes = filterAriaAttributes;
|
|
227
234
|
exports.filterDataAttributes = filterDataAttributes;
|
|
228
235
|
exports.filterInvalidAttributes = filterInvalidAttributes;
|
|
229
|
-
exports.getFieldId = getFieldId;
|
|
236
|
+
exports.getFieldId = getFieldId$1;
|
|
230
237
|
exports.isNumberish = isNumberish;
|
|
231
|
-
exports.parseTime = parseTime;
|
|
238
|
+
exports.parseTime = parseTime$1;
|
|
232
239
|
exports.version = version;
|
|
233
240
|
exports.warnDeprecatedComponent = warnDeprecatedComponent;
|
|
234
241
|
exports.warnDeprecatedProp = warnDeprecatedProp;
|
|
235
|
-
exports.warning = warning;
|
|
242
|
+
exports.warning = warning$1;
|
|
@@ -22,38 +22,38 @@ var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInsta
|
|
|
22
22
|
var _trimInstanceProperty__default = /*#__PURE__*/_interopDefault(_trimInstanceProperty);
|
|
23
23
|
var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
|
|
24
24
|
|
|
25
|
-
var regexpData = /^data-/;
|
|
25
|
+
var regexpData$1 = /^data-/;
|
|
26
26
|
function filterDataAttributes(obj) {
|
|
27
27
|
var _context;
|
|
28
28
|
|
|
29
|
-
return _Object$fromEntries__default[
|
|
29
|
+
return _Object$fromEntries__default["default"](_filterInstanceProperty__default["default"](_context = _Object$entries__default["default"](obj)).call(_context, function (_ref) {
|
|
30
30
|
var _ref2 = _slicedToArray(_ref, 1),
|
|
31
31
|
propFromEntry = _ref2[0];
|
|
32
32
|
|
|
33
|
-
return regexpData.test(propFromEntry);
|
|
33
|
+
return regexpData$1.test(propFromEntry);
|
|
34
34
|
}));
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
var regexpData
|
|
37
|
+
var regexpData = /^aria-/;
|
|
38
38
|
function filterAriaAttributes(obj) {
|
|
39
39
|
var _context;
|
|
40
40
|
|
|
41
|
-
return _Object$fromEntries__default[
|
|
41
|
+
return _Object$fromEntries__default["default"](_filterInstanceProperty__default["default"](_context = _Object$entries__default["default"](obj)).call(_context, function (_ref) {
|
|
42
42
|
var _ref2 = _slicedToArray(_ref, 1),
|
|
43
43
|
propFromEntry = _ref2[0];
|
|
44
44
|
|
|
45
|
-
return regexpData
|
|
45
|
+
return regexpData.test(propFromEntry);
|
|
46
46
|
}));
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
function filterInvalidAttributes(obj) {
|
|
50
50
|
var _context;
|
|
51
51
|
|
|
52
|
-
return _Object$fromEntries__default[
|
|
52
|
+
return _Object$fromEntries__default["default"](_filterInstanceProperty__default["default"](_context = _Object$entries__default["default"](obj)).call(_context, function (_ref) {
|
|
53
53
|
var _ref2 = _slicedToArray(_ref, 1),
|
|
54
54
|
propFromEntry = _ref2[0];
|
|
55
55
|
|
|
56
|
-
return isPropValid__default[
|
|
56
|
+
return isPropValid__default["default"](propFromEntry);
|
|
57
57
|
}));
|
|
58
58
|
}
|
|
59
59
|
|
|
@@ -68,7 +68,7 @@ function warnDeprecatedComponent(componentName) {
|
|
|
68
68
|
|
|
69
69
|
var additionalMessage = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
70
70
|
|
|
71
|
-
_concatInstanceProperty__default[
|
|
71
|
+
_concatInstanceProperty__default["default"](_context = "\"".concat(componentName, "\" has been deprecated and will be removed in the next major version.")).call(_context, additionalMessage);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
function warnDeprecatedProp(propName, componentName) {
|
|
@@ -76,7 +76,7 @@ function warnDeprecatedProp(propName, componentName) {
|
|
|
76
76
|
|
|
77
77
|
var additionalMessage = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
78
78
|
|
|
79
|
-
_concatInstanceProperty__default[
|
|
79
|
+
_concatInstanceProperty__default["default"](_context = _concatInstanceProperty__default["default"](_context2 = "\"".concat(propName, "\" property of \"")).call(_context2, componentName, "\" has been deprecated and will be removed in the next major version.")).call(_context, additionalMessage);
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
// Whenever a field requires a unique id, this factory can be used
|
|
@@ -91,7 +91,7 @@ function createSequentialId(prefix) {
|
|
|
91
91
|
var _context;
|
|
92
92
|
|
|
93
93
|
id += 1;
|
|
94
|
-
return _concatInstanceProperty__default[
|
|
94
|
+
return _concatInstanceProperty__default["default"](_context = "".concat(prefix)).call(_context, id);
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
97
|
|
|
@@ -99,6 +99,8 @@ var getFieldId = function getFieldId(props, state, createId) {
|
|
|
99
99
|
return props.id || state.id || createId();
|
|
100
100
|
};
|
|
101
101
|
|
|
102
|
+
var getFieldId$1 = getFieldId;
|
|
103
|
+
|
|
102
104
|
// Attempts to parse a string containing a time in either 12h or 24h format,
|
|
103
105
|
// with precision of up to three milliseconds
|
|
104
106
|
// Valid inputs:
|
|
@@ -116,7 +118,7 @@ var getFieldId = function getFieldId(props, state, createId) {
|
|
|
116
118
|
var parseTime = function parseTime(rawTime) {
|
|
117
119
|
if (!rawTime || typeof rawTime !== 'string') return null;
|
|
118
120
|
|
|
119
|
-
var time = _trimInstanceProperty__default[
|
|
121
|
+
var time = _trimInstanceProperty__default["default"](rawTime).call(rawTime).toLowerCase();
|
|
120
122
|
|
|
121
123
|
var match = time.match(/^(\d{1,2})(?::(\d{1,2})(?::(\d{1,2})(?:\.(\d{1,3}))?)?)?\s*(am|pm)?$/);
|
|
122
124
|
if (!match) return null; // As we accept eg "3 AM" there might not be a value for minutes, seconds or
|
|
@@ -166,15 +168,18 @@ var parseTime = function parseTime(rawTime) {
|
|
|
166
168
|
};
|
|
167
169
|
};
|
|
168
170
|
|
|
171
|
+
var parseTime$1 = parseTime;
|
|
172
|
+
|
|
169
173
|
// eslint-disable-next-line import/prefer-default-export
|
|
170
174
|
var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
171
175
|
|
|
172
176
|
var SafeHTMLElement = canUseDOM ? window.HTMLElement : {};
|
|
177
|
+
var SafeHTMLElement$1 = SafeHTMLElement;
|
|
173
178
|
|
|
174
179
|
function addStaticFields(Component, fields) {
|
|
175
180
|
var _context;
|
|
176
181
|
|
|
177
|
-
_forEachInstanceProperty__default[
|
|
182
|
+
_forEachInstanceProperty__default["default"](_context = _Object$entries__default["default"](fields)).call(_context, function (_ref) {
|
|
178
183
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
179
184
|
key = _ref2[0],
|
|
180
185
|
value = _ref2[1];
|
|
@@ -197,20 +202,22 @@ var warning = function warning(condition, message) {
|
|
|
197
202
|
}
|
|
198
203
|
};
|
|
199
204
|
|
|
200
|
-
|
|
201
|
-
|
|
205
|
+
var warning$1 = warning;
|
|
206
|
+
|
|
207
|
+
// NOTE: This string will be replaced on build time with the package version.
|
|
208
|
+
var version = "12.2.5";
|
|
202
209
|
|
|
203
|
-
exports.SafeHTMLElement = SafeHTMLElement;
|
|
210
|
+
exports.SafeHTMLElement = SafeHTMLElement$1;
|
|
204
211
|
exports.addStaticFields = addStaticFields;
|
|
205
212
|
exports.canUseDOM = canUseDOM;
|
|
206
213
|
exports.createSequentialId = createSequentialId;
|
|
207
214
|
exports.filterAriaAttributes = filterAriaAttributes;
|
|
208
215
|
exports.filterDataAttributes = filterDataAttributes;
|
|
209
216
|
exports.filterInvalidAttributes = filterInvalidAttributes;
|
|
210
|
-
exports.getFieldId = getFieldId;
|
|
217
|
+
exports.getFieldId = getFieldId$1;
|
|
211
218
|
exports.isNumberish = isNumberish;
|
|
212
|
-
exports.parseTime = parseTime;
|
|
219
|
+
exports.parseTime = parseTime$1;
|
|
213
220
|
exports.version = version;
|
|
214
221
|
exports.warnDeprecatedComponent = warnDeprecatedComponent;
|
|
215
222
|
exports.warnDeprecatedProp = warnDeprecatedProp;
|
|
216
|
-
exports.warning = warning;
|
|
223
|
+
exports.warning = warning$1;
|
|
@@ -4,11 +4,11 @@ import _filterInstanceProperty from '@babel/runtime-corejs3/core-js-stable/insta
|
|
|
4
4
|
import _Object$entries from '@babel/runtime-corejs3/core-js-stable/object/entries';
|
|
5
5
|
import isPropValid from '@emotion/is-prop-valid';
|
|
6
6
|
import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
7
|
-
import warning$
|
|
7
|
+
import warning$2 from 'warning';
|
|
8
8
|
import _trimInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/trim';
|
|
9
9
|
import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/for-each';
|
|
10
10
|
|
|
11
|
-
var regexpData = /^data-/;
|
|
11
|
+
var regexpData$1 = /^data-/;
|
|
12
12
|
function filterDataAttributes(obj) {
|
|
13
13
|
var _context;
|
|
14
14
|
|
|
@@ -16,11 +16,11 @@ function filterDataAttributes(obj) {
|
|
|
16
16
|
var _ref2 = _slicedToArray(_ref, 1),
|
|
17
17
|
propFromEntry = _ref2[0];
|
|
18
18
|
|
|
19
|
-
return regexpData.test(propFromEntry);
|
|
19
|
+
return regexpData$1.test(propFromEntry);
|
|
20
20
|
}));
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
var regexpData
|
|
23
|
+
var regexpData = /^aria-/;
|
|
24
24
|
function filterAriaAttributes(obj) {
|
|
25
25
|
var _context;
|
|
26
26
|
|
|
@@ -28,7 +28,7 @@ function filterAriaAttributes(obj) {
|
|
|
28
28
|
var _ref2 = _slicedToArray(_ref, 1),
|
|
29
29
|
propFromEntry = _ref2[0];
|
|
30
30
|
|
|
31
|
-
return regexpData
|
|
31
|
+
return regexpData.test(propFromEntry);
|
|
32
32
|
}));
|
|
33
33
|
}
|
|
34
34
|
|
|
@@ -56,7 +56,7 @@ function warnDeprecatedComponent(componentName) {
|
|
|
56
56
|
|
|
57
57
|
var message = _concatInstanceProperty(_context = "\"".concat(componentName, "\" has been deprecated and will be removed in the next major version.")).call(_context, additionalMessage);
|
|
58
58
|
|
|
59
|
-
process.env.NODE_ENV !== "production" ? warning$
|
|
59
|
+
process.env.NODE_ENV !== "production" ? warning$2(false, message) : void 0;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
function warnDeprecatedProp(propName, componentName) {
|
|
@@ -66,7 +66,7 @@ function warnDeprecatedProp(propName, componentName) {
|
|
|
66
66
|
|
|
67
67
|
var message = _concatInstanceProperty(_context = _concatInstanceProperty(_context2 = "\"".concat(propName, "\" property of \"")).call(_context2, componentName, "\" has been deprecated and will be removed in the next major version.")).call(_context, additionalMessage);
|
|
68
68
|
|
|
69
|
-
process.env.NODE_ENV !== "production" ? warning$
|
|
69
|
+
process.env.NODE_ENV !== "production" ? warning$2(false, message) : void 0;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
// Whenever a field requires a unique id, this factory can be used
|
|
@@ -89,6 +89,8 @@ var getFieldId = function getFieldId(props, state, createId) {
|
|
|
89
89
|
return props.id || state.id || createId();
|
|
90
90
|
};
|
|
91
91
|
|
|
92
|
+
var getFieldId$1 = getFieldId;
|
|
93
|
+
|
|
92
94
|
// Attempts to parse a string containing a time in either 12h or 24h format,
|
|
93
95
|
// with precision of up to three milliseconds
|
|
94
96
|
// Valid inputs:
|
|
@@ -156,10 +158,13 @@ var parseTime = function parseTime(rawTime) {
|
|
|
156
158
|
};
|
|
157
159
|
};
|
|
158
160
|
|
|
161
|
+
var parseTime$1 = parseTime;
|
|
162
|
+
|
|
159
163
|
// eslint-disable-next-line import/prefer-default-export
|
|
160
164
|
var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
161
165
|
|
|
162
166
|
var SafeHTMLElement = canUseDOM ? window.HTMLElement : {};
|
|
167
|
+
var SafeHTMLElement$1 = SafeHTMLElement;
|
|
163
168
|
|
|
164
169
|
function addStaticFields(Component, fields) {
|
|
165
170
|
var _context;
|
|
@@ -201,7 +206,9 @@ var warning = function warning(condition, message) {
|
|
|
201
206
|
throw new Error("".concat(prefix, ": ").concat(message || ''));
|
|
202
207
|
};
|
|
203
208
|
|
|
204
|
-
|
|
205
|
-
|
|
209
|
+
var warning$1 = warning;
|
|
210
|
+
|
|
211
|
+
// NOTE: This string will be replaced on build time with the package version.
|
|
212
|
+
var version = "12.2.5";
|
|
206
213
|
|
|
207
|
-
export { SafeHTMLElement, addStaticFields, canUseDOM, createSequentialId, filterAriaAttributes, filterDataAttributes, filterInvalidAttributes, getFieldId, isNumberish, parseTime, version, warnDeprecatedComponent, warnDeprecatedProp, warning };
|
|
214
|
+
export { SafeHTMLElement$1 as SafeHTMLElement, addStaticFields, canUseDOM, createSequentialId, filterAriaAttributes, filterDataAttributes, filterInvalidAttributes, getFieldId$1 as getFieldId, isNumberish, parseTime$1 as parseTime, version, warnDeprecatedComponent, warnDeprecatedProp, warning$1 as warning };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FC } from 'react';
|
|
2
|
-
declare type TStaticFields = Record<string, unknown>;
|
|
3
|
-
export default function addStaticFields<TProps extends {}, TFields extends TStaticFields>(Component: FC<TProps>, fields: TFields): FC<TProps> & TFields;
|
|
4
|
-
export {};
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
declare type TStaticFields = Record<string, unknown>;
|
|
3
|
+
export default function addStaticFields<TProps extends {}, TFields extends TStaticFields>(Component: FC<TProps>, fields: TFields): FC<TProps> & TFields;
|
|
4
|
+
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare type SequentialIdFn = () => string;
|
|
2
|
-
declare function createSequentialId(prefix: string): SequentialIdFn;
|
|
3
|
-
export default createSequentialId;
|
|
1
|
+
export declare type SequentialIdFn = () => string;
|
|
2
|
+
declare function createSequentialId(prefix: string): SequentialIdFn;
|
|
3
|
+
export default createSequentialId;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
declare type Props = Record<string, unknown>;
|
|
2
|
-
export default function filterAriaAttributes(obj: Props): Props;
|
|
3
|
-
export {};
|
|
1
|
+
declare type Props = Record<string, unknown>;
|
|
2
|
+
export default function filterAriaAttributes(obj: Props): Props;
|
|
3
|
+
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
declare type Props = Record<string, unknown>;
|
|
2
|
-
export default function filterDataAttributes(obj: Props): Props;
|
|
3
|
-
export {};
|
|
1
|
+
declare type Props = Record<string, unknown>;
|
|
2
|
+
export default function filterDataAttributes(obj: Props): Props;
|
|
3
|
+
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
declare type Props = Record<string, unknown>;
|
|
2
|
-
export default function filterInvalidAttributes(obj: Props): Props;
|
|
3
|
-
export {};
|
|
1
|
+
declare type Props = Record<string, unknown>;
|
|
2
|
+
export default function filterInvalidAttributes(obj: Props): Props;
|
|
3
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
declare type ObjectWithId = {
|
|
2
|
-
id?: string;
|
|
3
|
-
};
|
|
4
|
-
declare type CreateIdFn = () => string;
|
|
5
|
-
declare const getFieldId: (props: ObjectWithId, state: ObjectWithId, createId: CreateIdFn) => string;
|
|
6
|
-
export default getFieldId;
|
|
1
|
+
declare type ObjectWithId = {
|
|
2
|
+
id?: string;
|
|
3
|
+
};
|
|
4
|
+
declare type CreateIdFn = () => string;
|
|
5
|
+
declare const getFieldId: (props: ObjectWithId, state: ObjectWithId, createId: CreateIdFn) => string;
|
|
6
|
+
export default getFieldId;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const canUseDOM: boolean;
|
|
1
|
+
export declare const canUseDOM: boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const SafeHTMLElement: HTMLElement | {};
|
|
2
|
-
export default SafeHTMLElement;
|
|
1
|
+
declare const SafeHTMLElement: HTMLElement | {};
|
|
2
|
+
export default SafeHTMLElement;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export { default as filterDataAttributes } from './filter-data-attributes';
|
|
2
|
-
export { default as filterAriaAttributes } from './filter-aria-attributes';
|
|
3
|
-
export { default as filterInvalidAttributes } from './filter-invalid-attributes';
|
|
4
|
-
export { default as isNumberish } from './is-numberish';
|
|
5
|
-
export { default as warnDeprecatedComponent } from './warn-deprecated-component';
|
|
6
|
-
export { default as warnDeprecatedProp } from './warn-deprecated-prop';
|
|
7
|
-
export { default as createSequentialId } from './create-sequential-id';
|
|
8
|
-
export { default as getFieldId } from './get-field-id';
|
|
9
|
-
export { default as parseTime } from './parse-time';
|
|
10
|
-
export { canUseDOM } from './helpers/exenv';
|
|
11
|
-
export { default as SafeHTMLElement } from './helpers/safeHTMLElement';
|
|
12
|
-
export { default as addStaticFields } from './add-static-fields';
|
|
13
|
-
export { default as warning } from './warning';
|
|
14
|
-
export { default as version } from './version';
|
|
1
|
+
export { default as filterDataAttributes } from './filter-data-attributes';
|
|
2
|
+
export { default as filterAriaAttributes } from './filter-aria-attributes';
|
|
3
|
+
export { default as filterInvalidAttributes } from './filter-invalid-attributes';
|
|
4
|
+
export { default as isNumberish } from './is-numberish';
|
|
5
|
+
export { default as warnDeprecatedComponent } from './warn-deprecated-component';
|
|
6
|
+
export { default as warnDeprecatedProp } from './warn-deprecated-prop';
|
|
7
|
+
export { default as createSequentialId } from './create-sequential-id';
|
|
8
|
+
export { default as getFieldId } from './get-field-id';
|
|
9
|
+
export { default as parseTime } from './parse-time';
|
|
10
|
+
export { canUseDOM } from './helpers/exenv';
|
|
11
|
+
export { default as SafeHTMLElement } from './helpers/safeHTMLElement';
|
|
12
|
+
export { default as addStaticFields } from './add-static-fields';
|
|
13
|
+
export { default as warning } from './warning';
|
|
14
|
+
export { default as version } from './version';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function isNumberish(number: string): boolean;
|
|
1
|
+
export default function isNumberish(number: string): boolean;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
declare type ParsedTime = {
|
|
2
|
-
hours: number;
|
|
3
|
-
minutes: number;
|
|
4
|
-
seconds: number;
|
|
5
|
-
milliseconds: number;
|
|
6
|
-
};
|
|
7
|
-
declare const parseTime: (rawTime?: string | undefined) => ParsedTime | null;
|
|
8
|
-
export default parseTime;
|
|
1
|
+
declare type ParsedTime = {
|
|
2
|
+
hours: number;
|
|
3
|
+
minutes: number;
|
|
4
|
+
seconds: number;
|
|
5
|
+
milliseconds: number;
|
|
6
|
+
};
|
|
7
|
+
declare const parseTime: (rawTime?: string | undefined) => ParsedTime | null;
|
|
8
|
+
export default parseTime;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "
|
|
2
|
-
export default _default;
|
|
1
|
+
declare const _default: "__@UI_KIT_PACKAGE/VERSION_OF_RELEASE__";
|
|
2
|
+
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function warnDeprecatedComponent(componentName: string, additionalMessage?: string): void;
|
|
1
|
+
export default function warnDeprecatedComponent(componentName: string, additionalMessage?: string): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function warnDeprecatedProp(propName: string, componentName: string, additionalMessage?: string): void;
|
|
1
|
+
export default function warnDeprecatedProp(propName: string, componentName: string, additionalMessage?: string): void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
declare type TWarningFunction = (condition: unknown, message?: string) => asserts condition is boolean;
|
|
2
|
-
declare const warning: TWarningFunction;
|
|
3
|
-
export default warning;
|
|
1
|
+
declare type TWarningFunction = (condition: unknown, message?: string) => asserts condition is boolean;
|
|
2
|
+
declare const warning: TWarningFunction;
|
|
3
|
+
export default warning;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-uikit/utils",
|
|
3
3
|
"description": "A collection of utilities shared across the other packages.",
|
|
4
|
-
"version": "12.2.
|
|
4
|
+
"version": "12.2.5",
|
|
5
5
|
"bugs": "https://github.com/commercetools/ui-kit/issues",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -9,23 +9,26 @@
|
|
|
9
9
|
"directory": "packages/utils"
|
|
10
10
|
},
|
|
11
11
|
"homepage": "https://uikit.commercetools.com",
|
|
12
|
-
"keywords": [
|
|
12
|
+
"keywords": [
|
|
13
|
+
"javascript",
|
|
14
|
+
"design system",
|
|
15
|
+
"react",
|
|
16
|
+
"uikit"
|
|
17
|
+
],
|
|
13
18
|
"license": "MIT",
|
|
14
|
-
"private": false,
|
|
15
19
|
"publishConfig": {
|
|
16
20
|
"access": "public"
|
|
17
21
|
},
|
|
18
22
|
"sideEffects": false,
|
|
19
23
|
"main": "dist/commercetools-uikit-utils.cjs.js",
|
|
20
24
|
"module": "dist/commercetools-uikit-utils.esm.js",
|
|
21
|
-
"files": [
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist"
|
|
27
|
+
],
|
|
25
28
|
"dependencies": {
|
|
26
|
-
"@babel/runtime": "7.
|
|
27
|
-
"@babel/runtime-corejs3": "7.
|
|
28
|
-
"@emotion/is-prop-valid": "1.1.
|
|
29
|
+
"@babel/runtime": "7.16.3",
|
|
30
|
+
"@babel/runtime-corejs3": "7.16.3",
|
|
31
|
+
"@emotion/is-prop-valid": "1.1.1",
|
|
29
32
|
"@types/warning": "^3.0.0",
|
|
30
33
|
"warning": "4.0.3"
|
|
31
34
|
}
|