@salutejs/plasma-new-hope 0.325.0 → 0.326.0-canary.1973.15344107057.0
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/cjs/components/CodeInput/CodeInput.css +14 -0
- package/cjs/components/CodeInput/CodeInput.js +292 -0
- package/cjs/components/CodeInput/CodeInput.js.map +1 -0
- package/cjs/components/CodeInput/CodeInput.styles.js +78 -0
- package/cjs/components/CodeInput/CodeInput.styles.js.map +1 -0
- package/cjs/components/CodeInput/CodeInput.styles_29ush3.css +8 -0
- package/cjs/components/CodeInput/CodeInput.tokens.js +72 -0
- package/cjs/components/CodeInput/CodeInput.tokens.js.map +1 -0
- package/cjs/components/CodeInput/utils/constants.js +14 -0
- package/cjs/components/CodeInput/utils/constants.js.map +1 -0
- package/cjs/components/CodeInput/utils/handleCodeError.js +55 -0
- package/cjs/components/CodeInput/utils/handleCodeError.js.map +1 -0
- package/cjs/components/CodeInput/utils/handleItemError.js +53 -0
- package/cjs/components/CodeInput/utils/handleItemError.js.map +1 -0
- package/cjs/components/CodeInput/utils/initialValuesHelper.js +33 -0
- package/cjs/components/CodeInput/utils/initialValuesHelper.js.map +1 -0
- package/cjs/components/CodeInput/variations/_disabled/base.js +9 -0
- package/cjs/components/CodeInput/variations/_disabled/base.js.map +1 -0
- package/cjs/components/CodeInput/variations/_disabled/base_vkh53h.css +1 -0
- package/cjs/components/CodeInput/variations/_size/base.js +9 -0
- package/cjs/components/CodeInput/variations/_size/base.js.map +1 -0
- package/cjs/components/CodeInput/variations/_size/base_fhdb3l.css +1 -0
- package/cjs/components/CodeInput/variations/_view/base.js +9 -0
- package/cjs/components/CodeInput/variations/_view/base.js.map +1 -0
- package/cjs/components/CodeInput/variations/_view/base_lzwhmf.css +1 -0
- package/cjs/index.css +15 -0
- package/cjs/index.js +6 -0
- package/cjs/index.js.map +1 -1
- package/emotion/cjs/components/CodeInput/CodeInput.js +301 -0
- package/emotion/cjs/components/CodeInput/CodeInput.styles.js +76 -0
- package/emotion/cjs/components/CodeInput/CodeInput.tokens.js +70 -0
- package/emotion/cjs/components/CodeInput/CodeInput.types.js +5 -0
- package/emotion/cjs/components/CodeInput/index.js +31 -0
- package/emotion/cjs/components/CodeInput/utils/constants.js +12 -0
- package/emotion/cjs/components/CodeInput/utils/handleCodeError.js +58 -0
- package/emotion/cjs/components/CodeInput/utils/handleItemError.js +56 -0
- package/emotion/cjs/components/CodeInput/utils/index.js +38 -0
- package/emotion/cjs/components/CodeInput/utils/initialValuesHelper.js +30 -0
- package/emotion/cjs/components/CodeInput/variations/_disabled/base.js +9 -0
- package/emotion/cjs/components/CodeInput/variations/_disabled/tokens.json +4 -0
- package/emotion/cjs/components/CodeInput/variations/_size/base.js +10 -0
- package/emotion/cjs/components/CodeInput/variations/_size/tokens.json +19 -0
- package/emotion/cjs/components/CodeInput/variations/_view/base.js +10 -0
- package/emotion/cjs/components/CodeInput/variations/_view/tokens.json +1 -0
- package/emotion/cjs/examples/plasma_b2c/components/CodeInput/CodeInput.config.js +27 -0
- package/emotion/cjs/examples/plasma_b2c/components/CodeInput/CodeInput.js +11 -0
- package/emotion/cjs/examples/plasma_b2c/components/CodeInput/CodeInput.stories.tsx +107 -0
- package/emotion/cjs/examples/plasma_web/components/CodeInput/CodeInput.config.js +27 -0
- package/emotion/cjs/examples/plasma_web/components/CodeInput/CodeInput.js +11 -0
- package/emotion/cjs/examples/plasma_web/components/CodeInput/CodeInput.stories.tsx +107 -0
- package/emotion/cjs/index.js +11 -0
- package/emotion/es/components/CodeInput/CodeInput.js +292 -0
- package/emotion/es/components/CodeInput/CodeInput.styles.js +69 -0
- package/emotion/es/components/CodeInput/CodeInput.tokens.js +64 -0
- package/emotion/es/components/CodeInput/CodeInput.types.js +1 -0
- package/emotion/es/components/CodeInput/index.js +2 -0
- package/emotion/es/components/CodeInput/utils/constants.js +6 -0
- package/emotion/es/components/CodeInput/utils/handleCodeError.js +52 -0
- package/emotion/es/components/CodeInput/utils/handleItemError.js +50 -0
- package/emotion/es/components/CodeInput/utils/index.js +3 -0
- package/emotion/es/components/CodeInput/utils/initialValuesHelper.js +24 -0
- package/emotion/es/components/CodeInput/variations/_disabled/base.js +3 -0
- package/emotion/es/components/CodeInput/variations/_disabled/tokens.json +4 -0
- package/emotion/es/components/CodeInput/variations/_size/base.js +4 -0
- package/emotion/es/components/CodeInput/variations/_size/tokens.json +19 -0
- package/emotion/es/components/CodeInput/variations/_view/base.js +4 -0
- package/emotion/es/components/CodeInput/variations/_view/tokens.json +1 -0
- package/emotion/es/examples/plasma_b2c/components/CodeInput/CodeInput.config.js +21 -0
- package/emotion/es/examples/plasma_b2c/components/CodeInput/CodeInput.js +5 -0
- package/emotion/es/examples/plasma_b2c/components/CodeInput/CodeInput.stories.tsx +107 -0
- package/emotion/es/examples/plasma_web/components/CodeInput/CodeInput.config.js +21 -0
- package/emotion/es/examples/plasma_web/components/CodeInput/CodeInput.js +5 -0
- package/emotion/es/examples/plasma_web/components/CodeInput/CodeInput.stories.tsx +107 -0
- package/emotion/es/index.js +1 -0
- package/es/components/CodeInput/CodeInput.css +14 -0
- package/es/components/CodeInput/CodeInput.js +282 -0
- package/es/components/CodeInput/CodeInput.js.map +1 -0
- package/es/components/CodeInput/CodeInput.styles.js +67 -0
- package/es/components/CodeInput/CodeInput.styles.js.map +1 -0
- package/es/components/CodeInput/CodeInput.styles_29ush3.css +8 -0
- package/es/components/CodeInput/CodeInput.tokens.js +67 -0
- package/es/components/CodeInput/CodeInput.tokens.js.map +1 -0
- package/es/components/CodeInput/utils/constants.js +7 -0
- package/es/components/CodeInput/utils/constants.js.map +1 -0
- package/es/components/CodeInput/utils/handleCodeError.js +51 -0
- package/es/components/CodeInput/utils/handleCodeError.js.map +1 -0
- package/es/components/CodeInput/utils/handleItemError.js +49 -0
- package/es/components/CodeInput/utils/handleItemError.js.map +1 -0
- package/es/components/CodeInput/utils/initialValuesHelper.js +27 -0
- package/es/components/CodeInput/utils/initialValuesHelper.js.map +1 -0
- package/es/components/CodeInput/variations/_disabled/base.js +5 -0
- package/es/components/CodeInput/variations/_disabled/base.js.map +1 -0
- package/es/components/CodeInput/variations/_disabled/base_vkh53h.css +1 -0
- package/es/components/CodeInput/variations/_size/base.js +5 -0
- package/es/components/CodeInput/variations/_size/base.js.map +1 -0
- package/es/components/CodeInput/variations/_size/base_fhdb3l.css +1 -0
- package/es/components/CodeInput/variations/_view/base.js +5 -0
- package/es/components/CodeInput/variations/_view/base.js.map +1 -0
- package/es/components/CodeInput/variations/_view/base_lzwhmf.css +1 -0
- package/es/index.css +15 -0
- package/es/index.js +2 -0
- package/es/index.js.map +1 -1
- package/package.json +2 -2
- package/styled-components/cjs/components/CodeInput/CodeInput.js +301 -0
- package/styled-components/cjs/components/CodeInput/CodeInput.styles.js +47 -0
- package/styled-components/cjs/components/CodeInput/CodeInput.tokens.js +70 -0
- package/styled-components/cjs/components/CodeInput/CodeInput.types.js +5 -0
- package/styled-components/cjs/components/CodeInput/index.js +31 -0
- package/styled-components/cjs/components/CodeInput/utils/constants.js +12 -0
- package/styled-components/cjs/components/CodeInput/utils/handleCodeError.js +58 -0
- package/styled-components/cjs/components/CodeInput/utils/handleItemError.js +56 -0
- package/styled-components/cjs/components/CodeInput/utils/index.js +38 -0
- package/styled-components/cjs/components/CodeInput/utils/initialValuesHelper.js +30 -0
- package/styled-components/cjs/components/CodeInput/variations/_disabled/base.js +9 -0
- package/styled-components/cjs/components/CodeInput/variations/_disabled/tokens.json +4 -0
- package/styled-components/cjs/components/CodeInput/variations/_size/base.js +10 -0
- package/styled-components/cjs/components/CodeInput/variations/_size/tokens.json +19 -0
- package/styled-components/cjs/components/CodeInput/variations/_view/base.js +10 -0
- package/styled-components/cjs/components/CodeInput/variations/_view/tokens.json +1 -0
- package/styled-components/cjs/examples/plasma_b2c/components/CodeInput/CodeInput.config.js +27 -0
- package/styled-components/cjs/examples/plasma_b2c/components/CodeInput/CodeInput.js +11 -0
- package/styled-components/cjs/examples/plasma_b2c/components/CodeInput/CodeInput.stories.tsx +107 -0
- package/styled-components/cjs/examples/plasma_web/components/CodeInput/CodeInput.config.js +27 -0
- package/styled-components/cjs/examples/plasma_web/components/CodeInput/CodeInput.js +11 -0
- package/styled-components/cjs/examples/plasma_web/components/CodeInput/CodeInput.stories.tsx +107 -0
- package/styled-components/cjs/index.js +11 -0
- package/styled-components/es/components/CodeInput/CodeInput.js +292 -0
- package/styled-components/es/components/CodeInput/CodeInput.styles.js +39 -0
- package/styled-components/es/components/CodeInput/CodeInput.tokens.js +64 -0
- package/styled-components/es/components/CodeInput/CodeInput.types.js +1 -0
- package/styled-components/es/components/CodeInput/index.js +2 -0
- package/styled-components/es/components/CodeInput/utils/constants.js +6 -0
- package/styled-components/es/components/CodeInput/utils/handleCodeError.js +52 -0
- package/styled-components/es/components/CodeInput/utils/handleItemError.js +50 -0
- package/styled-components/es/components/CodeInput/utils/index.js +3 -0
- package/styled-components/es/components/CodeInput/utils/initialValuesHelper.js +24 -0
- package/styled-components/es/components/CodeInput/variations/_disabled/base.js +3 -0
- package/styled-components/es/components/CodeInput/variations/_disabled/tokens.json +4 -0
- package/styled-components/es/components/CodeInput/variations/_size/base.js +4 -0
- package/styled-components/es/components/CodeInput/variations/_size/tokens.json +19 -0
- package/styled-components/es/components/CodeInput/variations/_view/base.js +4 -0
- package/styled-components/es/components/CodeInput/variations/_view/tokens.json +1 -0
- package/styled-components/es/examples/plasma_b2c/components/CodeInput/CodeInput.config.js +21 -0
- package/styled-components/es/examples/plasma_b2c/components/CodeInput/CodeInput.js +5 -0
- package/styled-components/es/examples/plasma_b2c/components/CodeInput/CodeInput.stories.tsx +107 -0
- package/styled-components/es/examples/plasma_web/components/CodeInput/CodeInput.config.js +21 -0
- package/styled-components/es/examples/plasma_web/components/CodeInput/CodeInput.js +5 -0
- package/styled-components/es/examples/plasma_web/components/CodeInput/CodeInput.stories.tsx +107 -0
- package/styled-components/es/index.js +1 -0
- package/types/components/CodeInput/CodeInput.d.ts +67 -0
- package/types/components/CodeInput/CodeInput.d.ts.map +1 -0
- package/types/components/CodeInput/CodeInput.styles.d.ts +17 -0
- package/types/components/CodeInput/CodeInput.styles.d.ts.map +1 -0
- package/types/components/CodeInput/CodeInput.tokens.d.ts +65 -0
- package/types/components/CodeInput/CodeInput.tokens.d.ts.map +1 -0
- package/types/components/CodeInput/CodeInput.types.d.ts +96 -0
- package/types/components/CodeInput/CodeInput.types.d.ts.map +1 -0
- package/types/components/CodeInput/index.d.ts +3 -0
- package/types/components/CodeInput/index.d.ts.map +1 -0
- package/types/components/CodeInput/utils/constants.d.ts +7 -0
- package/types/components/CodeInput/utils/constants.d.ts.map +1 -0
- package/types/components/CodeInput/utils/handleCodeError.d.ts +15 -0
- package/types/components/CodeInput/utils/handleCodeError.d.ts.map +1 -0
- package/types/components/CodeInput/utils/handleItemError.d.ts +14 -0
- package/types/components/CodeInput/utils/handleItemError.d.ts.map +1 -0
- package/types/components/CodeInput/utils/index.d.ts +4 -0
- package/types/components/CodeInput/utils/index.d.ts.map +1 -0
- package/types/components/CodeInput/utils/initialValuesHelper.d.ts +4 -0
- package/types/components/CodeInput/utils/initialValuesHelper.d.ts.map +1 -0
- package/types/components/CodeInput/variations/_disabled/base.d.ts +2 -0
- package/types/components/CodeInput/variations/_disabled/base.d.ts.map +1 -0
- package/types/components/CodeInput/variations/_size/base.d.ts +2 -0
- package/types/components/CodeInput/variations/_size/base.d.ts.map +1 -0
- package/types/components/CodeInput/variations/_view/base.d.ts +2 -0
- package/types/components/CodeInput/variations/_view/base.d.ts.map +1 -0
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
@@ -0,0 +1,70 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.tokens = exports.classes = void 0;
|
7
|
+
var classes = exports.classes = {
|
8
|
+
itemError: 'codeinput-item-error',
|
9
|
+
itemErrorAnimation: 'codeinput-item-error-animation',
|
10
|
+
itemErrorFade: 'codeinput-item-error-fade',
|
11
|
+
itemCirlceFilled: 'codeinput-item-circle-filled',
|
12
|
+
captionError: 'codeinput-caption-error',
|
13
|
+
codeError: 'codeinput-code-error',
|
14
|
+
codeErrorAnimation: 'codeinput-code-error-animation',
|
15
|
+
codeErrorFade: 'codeinput-code-error-fade',
|
16
|
+
captionAlignLeft: 'codeinput-caption-align-left',
|
17
|
+
hoverEnabled: 'codeinput-item-hover-enabled',
|
18
|
+
segmented: 'codeinput-shape-segmented',
|
19
|
+
"default": 'codeinput-shape-default',
|
20
|
+
largeScreen: 'codeinput-large-screen',
|
21
|
+
mediumScreen: 'codeinput-medium-screen',
|
22
|
+
smallScreen: 'codeinput-small-screen',
|
23
|
+
disabled: 'codeinput-disabled'
|
24
|
+
};
|
25
|
+
var tokens = exports.tokens = {
|
26
|
+
captionGap: '--plasma-codeinput-caption-gap',
|
27
|
+
codeItemsGap: '--plasma-codeinput-code-item-gap',
|
28
|
+
separatorWidth: '--plasma-codeinput-separator-width',
|
29
|
+
codeItemLargeWidth: '--plasma-codeinput-item-large-width',
|
30
|
+
codeItemLargeHeight: '--plasma-codeinput-item-large-height',
|
31
|
+
codeItemMediumWidth: '--plasma-codeinput-item-medium-width',
|
32
|
+
codeItemMediumHeight: '--plasma-codeinput-item-medium-height',
|
33
|
+
codeItemSmallWidth: '--plasma-codeinput-item-small-width',
|
34
|
+
codeItemSmallHeight: '--plasma-codeinput-item-small-height',
|
35
|
+
codeItemCircleSize: '--plasma-codeinput-item-circle-size',
|
36
|
+
codeItemCircleBorderWidth: '--plasma-codeinput-item-circle-border-width',
|
37
|
+
fontStyle: '--plasma-codeinput-font-style',
|
38
|
+
fontFamily: '--plasma-codeinput-font-family',
|
39
|
+
fontWeight: '--plasma-codeinput-font-weight',
|
40
|
+
letterSpacing: '--plasma-codeinput-letter-spacing',
|
41
|
+
largeScreenFontSize: '--plasma-codeinput-large-screen-font-size',
|
42
|
+
largeScreenLineHeight: '--plasma-codeinput-large-screen-line-height',
|
43
|
+
mediumScreenFontSize: '--plasma-codeinput-medium-screen-font-size',
|
44
|
+
mediumScreenLineHeight: '--plasma-codeinput-medium-screen-line-height',
|
45
|
+
smallScreenFontSize: '--plasma-codeinput-small-screen-font-size',
|
46
|
+
smallScreenLineHeight: '--plasma-codeinput-small-screen-line-height',
|
47
|
+
captionFontFamily: '--plasma-codeinput-caption-font-family',
|
48
|
+
captionFontSize: '--plasma-codeinput-caption-font-style',
|
49
|
+
captionFontStyle: '--plasma-codeinput-caption-font-size',
|
50
|
+
captionFontWeight: '--plasma-codeinput-caption-font-weight',
|
51
|
+
captionLetterSpacing: '--plasma-codeinput-caption-letter-spacing',
|
52
|
+
captionLineHeight: '--plasma-codeinput-caption-line-height',
|
53
|
+
borderRadius: '--plasma-codeinput-code-item-border-radius',
|
54
|
+
borderRadiusSegmented: '--plasma-codeinput-code-item-border-radius-segmented',
|
55
|
+
segmentedSideBorderRadius: '--plasma-codeinput-code-item-segmented-side-border-radius',
|
56
|
+
captionColor: '--plasma-codeinput-caption-color',
|
57
|
+
captionColorError: '--plasma-codeinput-caption-color-error',
|
58
|
+
codeColor: '--plasma-codeinput-code-color',
|
59
|
+
codeColorError: '--plasma-codeinput-code-color-error',
|
60
|
+
backgroundColor: '--plasma-codeinput-background-color',
|
61
|
+
backgroundColorHover: '--plasma-codeinput-background-color-hover',
|
62
|
+
backgroundColorFocus: '--plasma-codeinput-background-color-focus',
|
63
|
+
backgroundErrorColor: '--plasma-codeinput-background-error-color',
|
64
|
+
borderWidth: '--plasma-codeinput-border-width',
|
65
|
+
borderColor: '--plasma-codeinput-border-color',
|
66
|
+
borderColorHover: '--plasma-codeinput-border-color-hover',
|
67
|
+
borderColorFocus: '--plasma-codeinput-border-color-focus',
|
68
|
+
borderErrorColor: '--plasma-codeinput-border-error-color',
|
69
|
+
disabledOpacity: '--plasma-codeinput-disabled-opacity'
|
70
|
+
};
|
@@ -0,0 +1,31 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
Object.defineProperty(exports, "codeInputClasses", {
|
7
|
+
enumerable: true,
|
8
|
+
get: function get() {
|
9
|
+
return _CodeInput2.classes;
|
10
|
+
}
|
11
|
+
});
|
12
|
+
Object.defineProperty(exports, "codeInputConfig", {
|
13
|
+
enumerable: true,
|
14
|
+
get: function get() {
|
15
|
+
return _CodeInput.codeInputConfig;
|
16
|
+
}
|
17
|
+
});
|
18
|
+
Object.defineProperty(exports, "codeInputRoot", {
|
19
|
+
enumerable: true,
|
20
|
+
get: function get() {
|
21
|
+
return _CodeInput.codeInputRoot;
|
22
|
+
}
|
23
|
+
});
|
24
|
+
Object.defineProperty(exports, "codeInputTokens", {
|
25
|
+
enumerable: true,
|
26
|
+
get: function get() {
|
27
|
+
return _CodeInput2.tokens;
|
28
|
+
}
|
29
|
+
});
|
30
|
+
var _CodeInput = /*#__PURE__*/require("./CodeInput");
|
31
|
+
var _CodeInput2 = /*#__PURE__*/require("./CodeInput.tokens");
|
@@ -0,0 +1,12 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.ONLY_DIGITS_PATTERN = exports.ONLY_DIGITS_AND_CHARS_PATTERN = exports.ONLY_CHARS_PATTERN = exports.FORBIDDEN_KEYS = exports.BACKSPACE_KEY = exports.ANIMATION_TIMEOUT = void 0;
|
7
|
+
var ONLY_DIGITS_PATTERN = exports.ONLY_DIGITS_PATTERN = '^\\d+$';
|
8
|
+
var ONLY_CHARS_PATTERN = exports.ONLY_CHARS_PATTERN = '^[a-zA-Z]+$';
|
9
|
+
var ONLY_DIGITS_AND_CHARS_PATTERN = exports.ONLY_DIGITS_AND_CHARS_PATTERN = '^[a-zA-Z0-9]+$';
|
10
|
+
var FORBIDDEN_KEYS = exports.FORBIDDEN_KEYS = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Delete'];
|
11
|
+
var BACKSPACE_KEY = exports.BACKSPACE_KEY = 'Backspace';
|
12
|
+
var ANIMATION_TIMEOUT = exports.ANIMATION_TIMEOUT = 300;
|
@@ -0,0 +1,58 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.handleCodeError = void 0;
|
7
|
+
var _CodeInput = /*#__PURE__*/require("../CodeInput.tokens");
|
8
|
+
var _constants = /*#__PURE__*/require("./constants");
|
9
|
+
var _initialValuesHelper = /*#__PURE__*/require("./initialValuesHelper");
|
10
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
11
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
12
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
13
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
14
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
15
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
16
|
+
var handleCodeError = exports.handleCodeError = function handleCodeError(_ref) {
|
17
|
+
var _captionRef$current, _captionRef$current2;
|
18
|
+
var codeLength = _ref.codeLength,
|
19
|
+
codeErrorBehavior = _ref.codeErrorBehavior,
|
20
|
+
currentCode = _ref.currentCode,
|
21
|
+
inputRefs = _ref.inputRefs,
|
22
|
+
inputContainerRef = _ref.inputContainerRef,
|
23
|
+
captionRef = _ref.captionRef,
|
24
|
+
setCode = _ref.setCode,
|
25
|
+
codeSetter = _ref.codeSetter;
|
26
|
+
if (!inputContainerRef.current) {
|
27
|
+
return;
|
28
|
+
}
|
29
|
+
switch (codeErrorBehavior) {
|
30
|
+
case 'keep':
|
31
|
+
inputContainerRef.current.classList.add(_CodeInput.classes.codeError, _CodeInput.classes.codeErrorAnimation);
|
32
|
+
(_captionRef$current = captionRef.current) === null || _captionRef$current === void 0 || _captionRef$current.classList.add(_CodeInput.classes.captionError);
|
33
|
+
setTimeout(function () {
|
34
|
+
var _inputContainerRef$cu;
|
35
|
+
var newCode = _toConsumableArray(currentCode);
|
36
|
+
newCode.pop();
|
37
|
+
codeSetter(newCode);
|
38
|
+
setCode(currentCode);
|
39
|
+
(_inputContainerRef$cu = inputContainerRef.current) === null || _inputContainerRef$cu === void 0 || _inputContainerRef$cu.classList.remove(_CodeInput.classes.codeErrorAnimation);
|
40
|
+
setTimeout(function () {
|
41
|
+
var _inputRefs$current, _inputRefs$current2;
|
42
|
+
(_inputRefs$current = inputRefs.current[inputRefs.current.length - 1]) === null || _inputRefs$current === void 0 || _inputRefs$current.setSelectionRange(0, 1);
|
43
|
+
(_inputRefs$current2 = inputRefs.current[inputRefs.current.length - 1]) === null || _inputRefs$current2 === void 0 || _inputRefs$current2.focus();
|
44
|
+
}, 0);
|
45
|
+
}, _constants.ANIMATION_TIMEOUT);
|
46
|
+
break;
|
47
|
+
case 'remove-code':
|
48
|
+
default:
|
49
|
+
inputContainerRef.current.classList.add(_CodeInput.classes.codeError, _CodeInput.classes.codeErrorAnimation, _CodeInput.classes.codeErrorFade);
|
50
|
+
(_captionRef$current2 = captionRef.current) === null || _captionRef$current2 === void 0 || _captionRef$current2.classList.add(_CodeInput.classes.captionError);
|
51
|
+
setTimeout(function () {
|
52
|
+
var _inputRefs$current$, _inputContainerRef$cu2;
|
53
|
+
codeSetter((0, _initialValuesHelper.getCodeValue)(codeLength, ''));
|
54
|
+
(_inputRefs$current$ = inputRefs.current[0]) === null || _inputRefs$current$ === void 0 || _inputRefs$current$.focus();
|
55
|
+
(_inputContainerRef$cu2 = inputContainerRef.current) === null || _inputContainerRef$cu2 === void 0 || _inputContainerRef$cu2.classList.remove(_CodeInput.classes.codeError, _CodeInput.classes.codeErrorAnimation, _CodeInput.classes.codeErrorFade);
|
56
|
+
}, _constants.ANIMATION_TIMEOUT);
|
57
|
+
}
|
58
|
+
};
|
@@ -0,0 +1,56 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.handleItemError = void 0;
|
7
|
+
var _CodeInput = /*#__PURE__*/require("../CodeInput.tokens");
|
8
|
+
var _constants = /*#__PURE__*/require("./constants");
|
9
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
10
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
11
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
12
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
13
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
14
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
15
|
+
var handleItemError = exports.handleItemError = function handleItemError(_ref) {
|
16
|
+
var _inputRefs$current$in, _inputRefs$current$in4;
|
17
|
+
var currentSymbol = _ref.currentSymbol,
|
18
|
+
itemErrorBehavior = _ref.itemErrorBehavior,
|
19
|
+
index = _ref.index,
|
20
|
+
newCode = _ref.newCode,
|
21
|
+
inputRefs = _ref.inputRefs,
|
22
|
+
setCode = _ref.setCode,
|
23
|
+
codeSetter = _ref.codeSetter;
|
24
|
+
if (!inputRefs.current[index] || currentSymbol === ' ') {
|
25
|
+
return;
|
26
|
+
}
|
27
|
+
switch (itemErrorBehavior) {
|
28
|
+
case 'keep':
|
29
|
+
setCode(newCode);
|
30
|
+
(_inputRefs$current$in = inputRefs.current[index]) === null || _inputRefs$current$in === void 0 || _inputRefs$current$in.classList.add(_CodeInput.classes.itemError, _CodeInput.classes.itemErrorAnimation);
|
31
|
+
setTimeout(function () {
|
32
|
+
var _inputRefs$current$in2;
|
33
|
+
(_inputRefs$current$in2 = inputRefs.current[index]) === null || _inputRefs$current$in2 === void 0 || _inputRefs$current$in2.classList.remove(_CodeInput.classes.itemErrorAnimation);
|
34
|
+
setTimeout(function () {
|
35
|
+
var _inputRefs$current$in3;
|
36
|
+
return (_inputRefs$current$in3 = inputRefs.current[index]) === null || _inputRefs$current$in3 === void 0 ? void 0 : _inputRefs$current$in3.setSelectionRange(0, 1);
|
37
|
+
}, 0);
|
38
|
+
}, _constants.ANIMATION_TIMEOUT);
|
39
|
+
break;
|
40
|
+
case 'forbid-enter':
|
41
|
+
newCode[index] = '';
|
42
|
+
codeSetter(newCode);
|
43
|
+
break;
|
44
|
+
case 'remove-symbol':
|
45
|
+
default:
|
46
|
+
setCode(newCode);
|
47
|
+
(_inputRefs$current$in4 = inputRefs.current[index]) === null || _inputRefs$current$in4 === void 0 || _inputRefs$current$in4.classList.add(_CodeInput.classes.itemError, _CodeInput.classes.itemErrorFade, _CodeInput.classes.itemErrorAnimation);
|
48
|
+
setTimeout(function () {
|
49
|
+
var _inputRefs$current$in5;
|
50
|
+
var updatedCode = _toConsumableArray(newCode);
|
51
|
+
updatedCode[index] = '';
|
52
|
+
codeSetter(updatedCode);
|
53
|
+
(_inputRefs$current$in5 = inputRefs.current[index]) === null || _inputRefs$current$in5 === void 0 || _inputRefs$current$in5.classList.remove(_CodeInput.classes.itemError, _CodeInput.classes.itemErrorFade, _CodeInput.classes.itemErrorAnimation);
|
54
|
+
}, _constants.ANIMATION_TIMEOUT);
|
55
|
+
}
|
56
|
+
};
|
@@ -0,0 +1,38 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
Object.defineProperty(exports, "getCodeValue", {
|
7
|
+
enumerable: true,
|
8
|
+
get: function get() {
|
9
|
+
return _initialValuesHelper.getCodeValue;
|
10
|
+
}
|
11
|
+
});
|
12
|
+
Object.defineProperty(exports, "getFieldPattern", {
|
13
|
+
enumerable: true,
|
14
|
+
get: function get() {
|
15
|
+
return _initialValuesHelper.getFieldPattern;
|
16
|
+
}
|
17
|
+
});
|
18
|
+
Object.defineProperty(exports, "getPlaceholderValue", {
|
19
|
+
enumerable: true,
|
20
|
+
get: function get() {
|
21
|
+
return _initialValuesHelper.getPlaceholderValue;
|
22
|
+
}
|
23
|
+
});
|
24
|
+
Object.defineProperty(exports, "handleCodeError", {
|
25
|
+
enumerable: true,
|
26
|
+
get: function get() {
|
27
|
+
return _handleCodeError.handleCodeError;
|
28
|
+
}
|
29
|
+
});
|
30
|
+
Object.defineProperty(exports, "handleItemError", {
|
31
|
+
enumerable: true,
|
32
|
+
get: function get() {
|
33
|
+
return _handleItemError.handleItemError;
|
34
|
+
}
|
35
|
+
});
|
36
|
+
var _initialValuesHelper = /*#__PURE__*/require("./initialValuesHelper");
|
37
|
+
var _handleItemError = /*#__PURE__*/require("./handleItemError");
|
38
|
+
var _handleCodeError = /*#__PURE__*/require("./handleCodeError");
|
@@ -0,0 +1,30 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.getPlaceholderValue = exports.getFieldPattern = exports.getCodeValue = void 0;
|
7
|
+
var getFieldPattern = exports.getFieldPattern = function getFieldPattern(allowedSymbols) {
|
8
|
+
if (!allowedSymbols) {
|
9
|
+
return null;
|
10
|
+
}
|
11
|
+
if (typeof allowedSymbols === 'string') {
|
12
|
+
return new RegExp(allowedSymbols, 'g');
|
13
|
+
}
|
14
|
+
return allowedSymbols;
|
15
|
+
};
|
16
|
+
var getCodeValue = exports.getCodeValue = function getCodeValue(codeLength, value) {
|
17
|
+
if (!value.length) {
|
18
|
+
return new Array(codeLength).fill('');
|
19
|
+
}
|
20
|
+
return value.slice(0, codeLength).split('');
|
21
|
+
};
|
22
|
+
var getPlaceholderValue = exports.getPlaceholderValue = function getPlaceholderValue(codeLength, placeholder) {
|
23
|
+
if (!placeholder || typeof placeholder !== 'string') {
|
24
|
+
return null;
|
25
|
+
}
|
26
|
+
if (placeholder.length === 1) {
|
27
|
+
return Array(codeLength).fill(placeholder);
|
28
|
+
}
|
29
|
+
return placeholder.slice(0, codeLength).split('');
|
30
|
+
};
|
@@ -0,0 +1,9 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.base = void 0;
|
7
|
+
var _styledComponents = /*#__PURE__*/require("styled-components");
|
8
|
+
var _CodeInput = /*#__PURE__*/require("../../CodeInput.tokens");
|
9
|
+
var base = exports.base = /*#__PURE__*/(0, _styledComponents.css)(["&&[disabled]{opacity:var(", ");cursor:not-allowed;& > *{pointer-events:none;}}"], _CodeInput.tokens.disabledOpacity);
|
@@ -0,0 +1,10 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.base = void 0;
|
7
|
+
var _styledComponents = /*#__PURE__*/require("styled-components");
|
8
|
+
var _CodeInput = /*#__PURE__*/require("../../CodeInput.styles");
|
9
|
+
var _CodeInput2 = /*#__PURE__*/require("../../CodeInput.tokens");
|
10
|
+
var base = exports.base = /*#__PURE__*/(0, _styledComponents.css)(["gap:var(", ");", ",", "{gap:var(", ");}&& .", "{", "{width:var(", ");height:var(", ");font-size:var(", ");line-height:var(", ");}}&& .", "{", "{width:var(", ");height:var(", ");font-size:var(", ");line-height:var(", ");}}&& .", "{", "{width:var(", ");height:var(", ");font-size:var(", ");line-height:var(", ");}}", "{font-family:var(", ");font-style:var(", ");font-weight:var(", ");letter-spacing:var(", ");}", "{font-family:var(", ");font-size:var(", ");font-style:var(", ");font-weight:var(", ");letter-spacing:var(", ");line-height:var(", ");}"], _CodeInput2.tokens.captionGap, _CodeInput.CodeWrapper, _CodeInput.CodeGroup, _CodeInput2.tokens.codeItemsGap, _CodeInput2.classes.largeScreen, _CodeInput.ItemInput, _CodeInput2.tokens.codeItemLargeWidth, _CodeInput2.tokens.codeItemLargeHeight, _CodeInput2.tokens.largeScreenFontSize, _CodeInput2.tokens.largeScreenLineHeight, _CodeInput2.classes.mediumScreen, _CodeInput.ItemInput, _CodeInput2.tokens.codeItemMediumWidth, _CodeInput2.tokens.codeItemMediumHeight, _CodeInput2.tokens.mediumScreenFontSize, _CodeInput2.tokens.mediumScreenLineHeight, _CodeInput2.classes.smallScreen, _CodeInput.ItemInput, _CodeInput2.tokens.codeItemSmallWidth, _CodeInput2.tokens.codeItemSmallHeight, _CodeInput2.tokens.smallScreenFontSize, _CodeInput2.tokens.smallScreenLineHeight, _CodeInput.ItemInput, _CodeInput2.tokens.fontFamily, _CodeInput2.tokens.fontStyle, _CodeInput2.tokens.fontWeight, _CodeInput2.tokens.letterSpacing, _CodeInput.CaptionWrapper, _CodeInput2.tokens.captionFontFamily, _CodeInput2.tokens.captionFontSize, _CodeInput2.tokens.captionFontStyle, _CodeInput2.tokens.captionFontWeight, _CodeInput2.tokens.captionLetterSpacing, _CodeInput2.tokens.captionLineHeight);
|
@@ -0,0 +1,19 @@
|
|
1
|
+
[
|
2
|
+
"--plasma-codeinput-caption-gap",
|
3
|
+
"--plasma-codeinput-code-item-gap",
|
4
|
+
"--plasma-codeinput-separator-width",
|
5
|
+
"--plasma-codeinput-item-width",
|
6
|
+
"--plasma-codeinput-item-height",
|
7
|
+
"--plasma-codeinput-font-family",
|
8
|
+
"--plasma-codeinput-font-style",
|
9
|
+
"--plasma-codeinput-font-size",
|
10
|
+
"--plasma-codeinput-font-weight",
|
11
|
+
"--plasma-codeinput-letter-spacing",
|
12
|
+
"--plasma-codeinput-line-height",
|
13
|
+
"--plasma-codeinput-caption-font-family",
|
14
|
+
"--plasma-codeinput-caption-font-style",
|
15
|
+
"--plasma-codeinput-caption-font-size",
|
16
|
+
"--plasma-codeinput-caption-font-weight",
|
17
|
+
"--plasma-codeinput-caption-letter-spacing",
|
18
|
+
"--plasma-codeinput-caption-line-height"
|
19
|
+
]
|
@@ -0,0 +1,10 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.base = void 0;
|
7
|
+
var _styledComponents = /*#__PURE__*/require("styled-components");
|
8
|
+
var _CodeInput = /*#__PURE__*/require("../../CodeInput.styles");
|
9
|
+
var _CodeInput2 = /*#__PURE__*/require("../../CodeInput.tokens");
|
10
|
+
var base = exports.base = /*#__PURE__*/(0, _styledComponents.css)(["", "{color:var(", ");&.", "{color:var(", ");}}", "{color:var(", ");background-color:var(", ");box-shadow:inset 0 0 0 var(", ") var(", ");}&:hover{.", "{background-color:var(", ");box-shadow:inset 0 0 0 var(", ") var(", ");}}&:focus-within{", ":focus-within{background-color:var(", ");box-shadow:inset 0 0 0 var(", ") var(", ");}}&& .", "{animation:shakingError 0.3s forwards;}&& .", "{", "{color:var(", ");background-color:var(", ");box-shadow:inset 0 0 0 var(", ") var(", ");}", "{border:var(", ") solid var(", ");&.", "{background-color:var(", ");}}&:focus-within{", "{background-color:var(", ");box-shadow:inset 0 0 0 var(", ") var(", ");}}&.", "{", "{animation:fadeError 0.3s forwards;}}}&& .", "{animation:shakingError 0.3s forwards;}&& .", ",&& .", ":focus-within{color:var(", ");background-color:var(", ");box-shadow:inset 0 0 0 var(", ") var(", ");&.", "{animation:shakingError 0.3s forwards fadeError 0.3s forwards;}}@keyframes shakingError{14%{transform:translateX(-0.125rem);}28%{transform:translateX(0.125rem);}42%{transform:translateX(-0.125rem);}57%{transform:translateX(0.125rem);}71%{transform:translateX(-0.125rem);}85%{transform:translateX(0.125rem);}100%{transform:translateX(-0.125rem);}}@keyframes fadeError{50%{color:var(", ");}100%{color:transparent;}}"], _CodeInput.CaptionWrapper, _CodeInput2.tokens.captionColor, _CodeInput2.classes.captionError, _CodeInput2.tokens.captionColorError, _CodeInput.ItemInput, _CodeInput2.tokens.codeColor, _CodeInput2.tokens.backgroundColor, _CodeInput2.tokens.borderWidth, _CodeInput2.tokens.borderColor, _CodeInput2.classes.hoverEnabled, _CodeInput2.tokens.backgroundColorHover, _CodeInput2.tokens.borderWidth, _CodeInput2.tokens.borderColorHover, _CodeInput.ItemInput, _CodeInput2.tokens.backgroundColorFocus, _CodeInput2.tokens.borderWidth, _CodeInput2.tokens.borderColorFocus, _CodeInput2.classes.codeErrorAnimation, _CodeInput2.classes.codeError, _CodeInput.ItemInput, _CodeInput2.tokens.codeColorError, _CodeInput2.tokens.backgroundErrorColor, _CodeInput2.tokens.borderWidth, _CodeInput2.tokens.borderErrorColor, _CodeInput.ItemCircle, _CodeInput2.tokens.codeItemCircleBorderWidth, _CodeInput2.tokens.codeColorError, _CodeInput2.classes.itemCirlceFilled, _CodeInput2.tokens.codeColorError, _CodeInput.ItemInput, _CodeInput2.tokens.backgroundErrorColor, _CodeInput2.tokens.borderWidth, _CodeInput2.tokens.borderErrorColor, _CodeInput2.classes.codeErrorFade, _CodeInput.ItemInput, _CodeInput2.classes.itemErrorAnimation, _CodeInput2.classes.itemError, _CodeInput2.classes.itemError, _CodeInput2.tokens.codeColorError, _CodeInput2.tokens.backgroundErrorColor, _CodeInput2.tokens.borderWidth, _CodeInput2.tokens.borderErrorColor, _CodeInput2.classes.codeErrorFade, _CodeInput2.tokens.codeColorError);
|
@@ -0,0 +1 @@
|
|
1
|
+
[]
|
@@ -0,0 +1,27 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.config = void 0;
|
7
|
+
var _styledComponents = /*#__PURE__*/require("styled-components");
|
8
|
+
var _CodeInput = /*#__PURE__*/require("../../../../components/CodeInput");
|
9
|
+
var config = exports.config = {
|
10
|
+
defaults: {
|
11
|
+
view: 'default',
|
12
|
+
size: 'l'
|
13
|
+
},
|
14
|
+
variations: {
|
15
|
+
view: {
|
16
|
+
"default": /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--text-secondary);", ":var(--text-negative);", ":var(--text-primary);", ":var(--text-negative);"], _CodeInput.codeInputTokens.captionColor, _CodeInput.codeInputTokens.captionColorError, _CodeInput.codeInputTokens.codeColor, _CodeInput.codeInputTokens.codeColorError)
|
17
|
+
},
|
18
|
+
size: {
|
19
|
+
l: /*#__PURE__*/(0, _styledComponents.css)(["", ":2.5rem;", ":0.75rem;", ":1rem;", ":var(--plasma-typo-dspl-l-font-family);", ":var(--plasma-typo-dspl-l-font-style);", ":var(--plasma-typo-dspl-l-bold-font-weight);", ":var(--plasma-typo-dspl-l-letter-spacing);", ":8rem;", ":8rem;", ":7rem;", ":7rem;", ":5.5rem;", ":5.75rem;", ":var(--plasma-typo-h3-font-family);", ":var(--plasma-typo-h3-font-size);", ":var(--plasma-typo-h3-font-style);", ":var(--plasma-typo-h3-font-weight);", ":var(--plasma-typo-h3-letter-spacing);", ":var(--plasma-typo-h3-line-height);", ":5rem;", ":8rem;", ":4.5rem;", ":7rem;", ":3.5rem;", ":5.75rem;", ":0.125rem;", ":1.5rem;"], _CodeInput.codeInputTokens.captionGap, _CodeInput.codeInputTokens.codeItemsGap, _CodeInput.codeInputTokens.separatorWidth, _CodeInput.codeInputTokens.fontFamily, _CodeInput.codeInputTokens.fontStyle, _CodeInput.codeInputTokens.fontWeight, _CodeInput.codeInputTokens.letterSpacing, _CodeInput.codeInputTokens.largeScreenFontSize, _CodeInput.codeInputTokens.largeScreenLineHeight, _CodeInput.codeInputTokens.mediumScreenFontSize, _CodeInput.codeInputTokens.mediumScreenLineHeight, _CodeInput.codeInputTokens.smallScreenFontSize, _CodeInput.codeInputTokens.smallScreenLineHeight, _CodeInput.codeInputTokens.captionFontFamily, _CodeInput.codeInputTokens.captionFontSize, _CodeInput.codeInputTokens.captionFontStyle, _CodeInput.codeInputTokens.captionFontWeight, _CodeInput.codeInputTokens.captionLetterSpacing, _CodeInput.codeInputTokens.captionLineHeight, _CodeInput.codeInputTokens.codeItemLargeWidth, _CodeInput.codeInputTokens.codeItemLargeHeight, _CodeInput.codeInputTokens.codeItemMediumWidth, _CodeInput.codeInputTokens.codeItemMediumHeight, _CodeInput.codeInputTokens.codeItemSmallWidth, _CodeInput.codeInputTokens.codeItemSmallHeight, _CodeInput.codeInputTokens.codeItemCircleBorderWidth, _CodeInput.codeInputTokens.codeItemCircleSize),
|
20
|
+
m: /*#__PURE__*/(0, _styledComponents.css)(["", ":1.75rem;", ":0.5rem;", ":1rem;", ":var(--plasma-typo-dspl-m-font-family);", ":var(--plasma-typo-body-m-font-style);", ":var(--plasma-typo-body-m-bold-font-weight);", ":var(--plasma-typo-body-m-letter-spacing);", ":5.5rem;", ":5.75rem;", ":4.5rem;", ":4.75rem;", ":3.5rem;", ":3.75rem;", ":var(--plasma-typo-h4-font-family);", ":var(--plasma-typo-h4-font-size);", ":var(--plasma-typo-h4-font-style);", ":var(--plasma-typo-h4-font-weight);", ":var(--plasma-typo-h4-letter-spacing);", ":var(--plasma-typo-h4-line-height);", ":3.5rem;", ":5.75rem;", ":3rem;", ":4.75rem;", ":2.25rem;", ":3.75rem;", ":0.094rem;", ":1rem;"], _CodeInput.codeInputTokens.captionGap, _CodeInput.codeInputTokens.codeItemsGap, _CodeInput.codeInputTokens.separatorWidth, _CodeInput.codeInputTokens.fontFamily, _CodeInput.codeInputTokens.fontStyle, _CodeInput.codeInputTokens.fontWeight, _CodeInput.codeInputTokens.letterSpacing, _CodeInput.codeInputTokens.largeScreenFontSize, _CodeInput.codeInputTokens.largeScreenLineHeight, _CodeInput.codeInputTokens.mediumScreenFontSize, _CodeInput.codeInputTokens.mediumScreenLineHeight, _CodeInput.codeInputTokens.smallScreenFontSize, _CodeInput.codeInputTokens.smallScreenLineHeight, _CodeInput.codeInputTokens.captionFontFamily, _CodeInput.codeInputTokens.captionFontSize, _CodeInput.codeInputTokens.captionFontStyle, _CodeInput.codeInputTokens.captionFontWeight, _CodeInput.codeInputTokens.captionLetterSpacing, _CodeInput.codeInputTokens.captionLineHeight, _CodeInput.codeInputTokens.codeItemLargeWidth, _CodeInput.codeInputTokens.codeItemLargeHeight, _CodeInput.codeInputTokens.codeItemMediumWidth, _CodeInput.codeInputTokens.codeItemMediumHeight, _CodeInput.codeInputTokens.codeItemSmallWidth, _CodeInput.codeInputTokens.codeItemSmallHeight, _CodeInput.codeInputTokens.codeItemCircleBorderWidth, _CodeInput.codeInputTokens.codeItemCircleSize),
|
21
|
+
s: /*#__PURE__*/(0, _styledComponents.css)(["", ":1.5rem;", ":0.25rem;", ":0.5rem;", ":var(--plasma-typo-dspl-s-font-family);", ":var(--plasma-typo-body-s-font-style);", ":var(--plasma-typo-body-s-bold-font-weight);", ":var(--plasma-typo-body-s-letter-spacing);", ":4rem;", ":4.25rem;", ":3rem;", ":3.25rem;", ":2.5rem;", ":2.75rem;", ":var(--plasma-typo-h5-font-family);", ":var(--plasma-typo-h5-font-size);", ":var(--plasma-typo-h5-font-style);", ":var(--plasma-typo-h5-font-weight);", ":var(--plasma-typo-h5-letter-spacing);", ":var(--plasma-typo-h5-line-height);", ":2.5rem;", ":4.25rem;", ":2rem;", ":3.25rem;", ":1.625rem;", ":2.75rem;", ":0.063rem;", ":0.75rem;"], _CodeInput.codeInputTokens.captionGap, _CodeInput.codeInputTokens.codeItemsGap, _CodeInput.codeInputTokens.separatorWidth, _CodeInput.codeInputTokens.fontFamily, _CodeInput.codeInputTokens.fontStyle, _CodeInput.codeInputTokens.fontWeight, _CodeInput.codeInputTokens.letterSpacing, _CodeInput.codeInputTokens.largeScreenFontSize, _CodeInput.codeInputTokens.largeScreenLineHeight, _CodeInput.codeInputTokens.mediumScreenFontSize, _CodeInput.codeInputTokens.mediumScreenLineHeight, _CodeInput.codeInputTokens.smallScreenFontSize, _CodeInput.codeInputTokens.smallScreenLineHeight, _CodeInput.codeInputTokens.captionFontFamily, _CodeInput.codeInputTokens.captionFontSize, _CodeInput.codeInputTokens.captionFontStyle, _CodeInput.codeInputTokens.captionFontWeight, _CodeInput.codeInputTokens.captionLetterSpacing, _CodeInput.codeInputTokens.captionLineHeight, _CodeInput.codeInputTokens.codeItemLargeWidth, _CodeInput.codeInputTokens.codeItemLargeHeight, _CodeInput.codeInputTokens.codeItemMediumWidth, _CodeInput.codeInputTokens.codeItemMediumHeight, _CodeInput.codeInputTokens.codeItemSmallWidth, _CodeInput.codeInputTokens.codeItemSmallHeight, _CodeInput.codeInputTokens.codeItemCircleBorderWidth, _CodeInput.codeInputTokens.codeItemCircleSize)
|
22
|
+
},
|
23
|
+
disabled: {
|
24
|
+
"true": /*#__PURE__*/(0, _styledComponents.css)(["", ":0.4;"], _CodeInput.codeInputTokens.disabledOpacity)
|
25
|
+
}
|
26
|
+
}
|
27
|
+
};
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.CodeInput = void 0;
|
7
|
+
var _CodeInput = /*#__PURE__*/require("../../../../components/CodeInput");
|
8
|
+
var _engines = /*#__PURE__*/require("../../../../engines");
|
9
|
+
var _CodeInput2 = /*#__PURE__*/require("./CodeInput.config");
|
10
|
+
var mergedConfig = /*#__PURE__*/(0, _engines.mergeConfig)(_CodeInput.codeInputConfig, _CodeInput2.config);
|
11
|
+
var CodeInput = exports.CodeInput = /*#__PURE__*/(0, _engines.component)(mergedConfig);
|
@@ -0,0 +1,107 @@
|
|
1
|
+
import React, { ComponentProps, useState } from 'react';
|
2
|
+
import type { StoryObj, Meta } from '@storybook/react';
|
3
|
+
import { action } from '@storybook/addon-actions';
|
4
|
+
import { getConfigVariations } from '@salutejs/plasma-sb-utils';
|
5
|
+
|
6
|
+
import { WithTheme } from '../../../_helpers';
|
7
|
+
|
8
|
+
import { CodeInput } from './CodeInput';
|
9
|
+
import { config } from './CodeInput.config';
|
10
|
+
|
11
|
+
const onChange = action('onChange');
|
12
|
+
const onFullCodeEnter = action('onFullCodeEnter');
|
13
|
+
|
14
|
+
const { views, sizes } = getConfigVariations(config);
|
15
|
+
const codeLengths = [4, 5, 6];
|
16
|
+
const captionAlignVariants = ['left', 'center'];
|
17
|
+
const itemErrorBehaviorVariants = ['remove-symbol', 'keep', 'forbid-enter'];
|
18
|
+
const codeErrorBehaviorVariants = ['remove-code', 'keep'];
|
19
|
+
|
20
|
+
const meta: Meta<typeof CodeInput> = {
|
21
|
+
title: 'b2c/Data Entry/CodeInput',
|
22
|
+
component: CodeInput,
|
23
|
+
decorators: [WithTheme],
|
24
|
+
argTypes: {
|
25
|
+
view: {
|
26
|
+
options: views,
|
27
|
+
control: {
|
28
|
+
type: 'select',
|
29
|
+
},
|
30
|
+
},
|
31
|
+
size: {
|
32
|
+
options: sizes,
|
33
|
+
control: {
|
34
|
+
type: 'inline-radio',
|
35
|
+
},
|
36
|
+
},
|
37
|
+
screen: {
|
38
|
+
options: ['large', 'medium', 'small'],
|
39
|
+
control: {
|
40
|
+
type: 'inline-radio',
|
41
|
+
},
|
42
|
+
},
|
43
|
+
captionAlign: {
|
44
|
+
options: captionAlignVariants,
|
45
|
+
control: {
|
46
|
+
type: 'inline-radio',
|
47
|
+
},
|
48
|
+
},
|
49
|
+
codeLength: {
|
50
|
+
options: codeLengths,
|
51
|
+
control: {
|
52
|
+
type: 'inline-radio',
|
53
|
+
},
|
54
|
+
},
|
55
|
+
itemErrorBehavior: {
|
56
|
+
options: itemErrorBehaviorVariants,
|
57
|
+
control: {
|
58
|
+
type: 'inline-radio',
|
59
|
+
},
|
60
|
+
},
|
61
|
+
codeErrorBehavior: {
|
62
|
+
options: codeErrorBehaviorVariants,
|
63
|
+
control: {
|
64
|
+
type: 'inline-radio',
|
65
|
+
},
|
66
|
+
},
|
67
|
+
},
|
68
|
+
parameters: {
|
69
|
+
controls: {
|
70
|
+
exclude: ['view'],
|
71
|
+
},
|
72
|
+
},
|
73
|
+
};
|
74
|
+
|
75
|
+
export default meta;
|
76
|
+
|
77
|
+
type StoryPropsDefault = ComponentProps<typeof CodeInput>;
|
78
|
+
|
79
|
+
const StoryDefault = (args: StoryPropsDefault) => {
|
80
|
+
const [value, setValue] = useState('');
|
81
|
+
|
82
|
+
const handleChange = (newValue: string) => {
|
83
|
+
setValue(newValue);
|
84
|
+
onChange(newValue);
|
85
|
+
};
|
86
|
+
|
87
|
+
return <CodeInput {...args} value={value} onChange={handleChange} onFullCodeEnter={onFullCodeEnter} />;
|
88
|
+
};
|
89
|
+
|
90
|
+
export const Default: StoryObj<StoryPropsDefault> = {
|
91
|
+
args: {
|
92
|
+
view: 'default',
|
93
|
+
size: 'm',
|
94
|
+
codeLength: 6,
|
95
|
+
caption: 'Caption',
|
96
|
+
captionAlign: 'center',
|
97
|
+
width: '',
|
98
|
+
screen: 'medium',
|
99
|
+
isError: false,
|
100
|
+
itemErrorBehavior: 'remove-symbol',
|
101
|
+
codeErrorBehavior: 'remove-code',
|
102
|
+
autoFocus: true,
|
103
|
+
disabled: false,
|
104
|
+
hidden: false,
|
105
|
+
},
|
106
|
+
render: StoryDefault,
|
107
|
+
};
|
@@ -0,0 +1,27 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.config = void 0;
|
7
|
+
var _styledComponents = /*#__PURE__*/require("styled-components");
|
8
|
+
var _CodeInput = /*#__PURE__*/require("../../../../components/CodeInput");
|
9
|
+
var config = exports.config = {
|
10
|
+
defaults: {
|
11
|
+
view: 'default',
|
12
|
+
size: 'l'
|
13
|
+
},
|
14
|
+
variations: {
|
15
|
+
view: {
|
16
|
+
"default": /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--text-secondary);", ":var(--text-negative);", ":var(--text-primary);", ":var(--text-negative);"], _CodeInput.codeInputTokens.captionColor, _CodeInput.codeInputTokens.captionColorError, _CodeInput.codeInputTokens.codeColor, _CodeInput.codeInputTokens.codeColorError)
|
17
|
+
},
|
18
|
+
size: {
|
19
|
+
l: /*#__PURE__*/(0, _styledComponents.css)(["", ":2.5rem;", ":0.75rem;", ":1rem;", ":var(--plasma-typo-dspl-l-font-family);", ":var(--plasma-typo-dspl-l-font-style);", ":var(--plasma-typo-dspl-l-bold-font-weight);", ":var(--plasma-typo-dspl-l-letter-spacing);", ":8rem;", ":8rem;", ":7rem;", ":7rem;", ":5.5rem;", ":5.75rem;", ":var(--plasma-typo-h3-font-family);", ":var(--plasma-typo-h3-font-size);", ":var(--plasma-typo-h3-font-style);", ":var(--plasma-typo-h3-font-weight);", ":var(--plasma-typo-h3-letter-spacing);", ":var(--plasma-typo-h3-line-height);", ":5rem;", ":8rem;", ":4.5rem;", ":7rem;", ":3.5rem;", ":5.75rem;", ":0.125rem;", ":1.5rem;"], _CodeInput.codeInputTokens.captionGap, _CodeInput.codeInputTokens.codeItemsGap, _CodeInput.codeInputTokens.separatorWidth, _CodeInput.codeInputTokens.fontFamily, _CodeInput.codeInputTokens.fontStyle, _CodeInput.codeInputTokens.fontWeight, _CodeInput.codeInputTokens.letterSpacing, _CodeInput.codeInputTokens.largeScreenFontSize, _CodeInput.codeInputTokens.largeScreenLineHeight, _CodeInput.codeInputTokens.mediumScreenFontSize, _CodeInput.codeInputTokens.mediumScreenLineHeight, _CodeInput.codeInputTokens.smallScreenFontSize, _CodeInput.codeInputTokens.smallScreenLineHeight, _CodeInput.codeInputTokens.captionFontFamily, _CodeInput.codeInputTokens.captionFontSize, _CodeInput.codeInputTokens.captionFontStyle, _CodeInput.codeInputTokens.captionFontWeight, _CodeInput.codeInputTokens.captionLetterSpacing, _CodeInput.codeInputTokens.captionLineHeight, _CodeInput.codeInputTokens.codeItemLargeWidth, _CodeInput.codeInputTokens.codeItemLargeHeight, _CodeInput.codeInputTokens.codeItemMediumWidth, _CodeInput.codeInputTokens.codeItemMediumHeight, _CodeInput.codeInputTokens.codeItemSmallWidth, _CodeInput.codeInputTokens.codeItemSmallHeight, _CodeInput.codeInputTokens.codeItemCircleBorderWidth, _CodeInput.codeInputTokens.codeItemCircleSize),
|
20
|
+
m: /*#__PURE__*/(0, _styledComponents.css)(["", ":1.75rem;", ":0.5rem;", ":1rem;", ":var(--plasma-typo-dspl-m-font-family);", ":var(--plasma-typo-body-m-font-style);", ":var(--plasma-typo-body-m-bold-font-weight);", ":var(--plasma-typo-body-m-letter-spacing);", ":5.5rem;", ":5.75rem;", ":4.5rem;", ":4.75rem;", ":3.5rem;", ":3.75rem;", ":var(--plasma-typo-h4-font-family);", ":var(--plasma-typo-h4-font-size);", ":var(--plasma-typo-h4-font-style);", ":var(--plasma-typo-h4-font-weight);", ":var(--plasma-typo-h4-letter-spacing);", ":var(--plasma-typo-h4-line-height);", ":3.5rem;", ":5.75rem;", ":3rem;", ":4.75rem;", ":2.25rem;", ":3.75rem;", ":0.09375rem;", ":1rem;"], _CodeInput.codeInputTokens.captionGap, _CodeInput.codeInputTokens.codeItemsGap, _CodeInput.codeInputTokens.separatorWidth, _CodeInput.codeInputTokens.fontFamily, _CodeInput.codeInputTokens.fontStyle, _CodeInput.codeInputTokens.fontWeight, _CodeInput.codeInputTokens.letterSpacing, _CodeInput.codeInputTokens.largeScreenFontSize, _CodeInput.codeInputTokens.largeScreenLineHeight, _CodeInput.codeInputTokens.mediumScreenFontSize, _CodeInput.codeInputTokens.mediumScreenLineHeight, _CodeInput.codeInputTokens.smallScreenFontSize, _CodeInput.codeInputTokens.smallScreenLineHeight, _CodeInput.codeInputTokens.captionFontFamily, _CodeInput.codeInputTokens.captionFontSize, _CodeInput.codeInputTokens.captionFontStyle, _CodeInput.codeInputTokens.captionFontWeight, _CodeInput.codeInputTokens.captionLetterSpacing, _CodeInput.codeInputTokens.captionLineHeight, _CodeInput.codeInputTokens.codeItemLargeWidth, _CodeInput.codeInputTokens.codeItemLargeHeight, _CodeInput.codeInputTokens.codeItemMediumWidth, _CodeInput.codeInputTokens.codeItemMediumHeight, _CodeInput.codeInputTokens.codeItemSmallWidth, _CodeInput.codeInputTokens.codeItemSmallHeight, _CodeInput.codeInputTokens.codeItemCircleBorderWidth, _CodeInput.codeInputTokens.codeItemCircleSize),
|
21
|
+
s: /*#__PURE__*/(0, _styledComponents.css)(["", ":1.5rem;", ":0.25rem;", ":0.5rem;", ":var(--plasma-typo-dspl-s-font-family);", ":var(--plasma-typo-body-s-font-style);", ":var(--plasma-typo-body-s-bold-font-weight);", ":var(--plasma-typo-body-s-letter-spacing);", ":4rem;", ":4.25rem;", ":3rem;", ":3.25rem;", ":2.5rem;", ":2.75rem;", ":var(--plasma-typo-h5-font-family);", ":var(--plasma-typo-h5-font-size);", ":var(--plasma-typo-h5-font-style);", ":var(--plasma-typo-h5-font-weight);", ":var(--plasma-typo-h5-letter-spacing);", ":var(--plasma-typo-h5-line-height);", ":2.5rem;", ":4.25rem;", ":2rem;", ":3.25rem;", ":1.625rem;", ":2.75rem;", ":0.0625rem;", ":0.75rem;"], _CodeInput.codeInputTokens.captionGap, _CodeInput.codeInputTokens.codeItemsGap, _CodeInput.codeInputTokens.separatorWidth, _CodeInput.codeInputTokens.fontFamily, _CodeInput.codeInputTokens.fontStyle, _CodeInput.codeInputTokens.fontWeight, _CodeInput.codeInputTokens.letterSpacing, _CodeInput.codeInputTokens.largeScreenFontSize, _CodeInput.codeInputTokens.largeScreenLineHeight, _CodeInput.codeInputTokens.mediumScreenFontSize, _CodeInput.codeInputTokens.mediumScreenLineHeight, _CodeInput.codeInputTokens.smallScreenFontSize, _CodeInput.codeInputTokens.smallScreenLineHeight, _CodeInput.codeInputTokens.captionFontFamily, _CodeInput.codeInputTokens.captionFontSize, _CodeInput.codeInputTokens.captionFontStyle, _CodeInput.codeInputTokens.captionFontWeight, _CodeInput.codeInputTokens.captionLetterSpacing, _CodeInput.codeInputTokens.captionLineHeight, _CodeInput.codeInputTokens.codeItemLargeWidth, _CodeInput.codeInputTokens.codeItemLargeHeight, _CodeInput.codeInputTokens.codeItemMediumWidth, _CodeInput.codeInputTokens.codeItemMediumHeight, _CodeInput.codeInputTokens.codeItemSmallWidth, _CodeInput.codeInputTokens.codeItemSmallHeight, _CodeInput.codeInputTokens.codeItemCircleBorderWidth, _CodeInput.codeInputTokens.codeItemCircleSize)
|
22
|
+
},
|
23
|
+
disabled: {
|
24
|
+
"true": /*#__PURE__*/(0, _styledComponents.css)(["", ":0.4;"], _CodeInput.codeInputTokens.disabledOpacity)
|
25
|
+
}
|
26
|
+
}
|
27
|
+
};
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.CodeInput = void 0;
|
7
|
+
var _CodeInput = /*#__PURE__*/require("../../../../components/CodeInput");
|
8
|
+
var _engines = /*#__PURE__*/require("../../../../engines");
|
9
|
+
var _CodeInput2 = /*#__PURE__*/require("./CodeInput.config");
|
10
|
+
var mergedConfig = /*#__PURE__*/(0, _engines.mergeConfig)(_CodeInput.codeInputConfig, _CodeInput2.config);
|
11
|
+
var CodeInput = exports.CodeInput = /*#__PURE__*/(0, _engines.component)(mergedConfig);
|