@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,24 @@
|
|
1
|
+
export var getFieldPattern = function getFieldPattern(allowedSymbols) {
|
2
|
+
if (!allowedSymbols) {
|
3
|
+
return null;
|
4
|
+
}
|
5
|
+
if (typeof allowedSymbols === 'string') {
|
6
|
+
return new RegExp(allowedSymbols, 'g');
|
7
|
+
}
|
8
|
+
return allowedSymbols;
|
9
|
+
};
|
10
|
+
export var getCodeValue = function getCodeValue(codeLength, value) {
|
11
|
+
if (!value.length) {
|
12
|
+
return new Array(codeLength).fill('');
|
13
|
+
}
|
14
|
+
return value.slice(0, codeLength).split('');
|
15
|
+
};
|
16
|
+
export var getPlaceholderValue = function getPlaceholderValue(codeLength, placeholder) {
|
17
|
+
if (!placeholder || typeof placeholder !== 'string') {
|
18
|
+
return null;
|
19
|
+
}
|
20
|
+
if (placeholder.length === 1) {
|
21
|
+
return Array(codeLength).fill(placeholder);
|
22
|
+
}
|
23
|
+
return placeholder.slice(0, codeLength).split('');
|
24
|
+
};
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import { css } from 'styled-components';
|
2
|
+
import { CaptionWrapper, CodeGroup, CodeWrapper, ItemInput } from "../../CodeInput.styles";
|
3
|
+
import { tokens, classes } from "../../CodeInput.tokens";
|
4
|
+
export var base = /*#__PURE__*/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(", ");}"], tokens.captionGap, CodeWrapper, CodeGroup, tokens.codeItemsGap, classes.largeScreen, ItemInput, tokens.codeItemLargeWidth, tokens.codeItemLargeHeight, tokens.largeScreenFontSize, tokens.largeScreenLineHeight, classes.mediumScreen, ItemInput, tokens.codeItemMediumWidth, tokens.codeItemMediumHeight, tokens.mediumScreenFontSize, tokens.mediumScreenLineHeight, classes.smallScreen, ItemInput, tokens.codeItemSmallWidth, tokens.codeItemSmallHeight, tokens.smallScreenFontSize, tokens.smallScreenLineHeight, ItemInput, tokens.fontFamily, tokens.fontStyle, tokens.fontWeight, tokens.letterSpacing, CaptionWrapper, tokens.captionFontFamily, tokens.captionFontSize, tokens.captionFontStyle, tokens.captionFontWeight, tokens.captionLetterSpacing, 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,4 @@
|
|
1
|
+
import { css } from 'styled-components';
|
2
|
+
import { CaptionWrapper, ItemInput, ItemCircle } from "../../CodeInput.styles";
|
3
|
+
import { classes, tokens } from "../../CodeInput.tokens";
|
4
|
+
export var base = /*#__PURE__*/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;}}"], CaptionWrapper, tokens.captionColor, classes.captionError, tokens.captionColorError, ItemInput, tokens.codeColor, tokens.backgroundColor, tokens.borderWidth, tokens.borderColor, classes.hoverEnabled, tokens.backgroundColorHover, tokens.borderWidth, tokens.borderColorHover, ItemInput, tokens.backgroundColorFocus, tokens.borderWidth, tokens.borderColorFocus, classes.codeErrorAnimation, classes.codeError, ItemInput, tokens.codeColorError, tokens.backgroundErrorColor, tokens.borderWidth, tokens.borderErrorColor, ItemCircle, tokens.codeItemCircleBorderWidth, tokens.codeColorError, classes.itemCirlceFilled, tokens.codeColorError, ItemInput, tokens.backgroundErrorColor, tokens.borderWidth, tokens.borderErrorColor, classes.codeErrorFade, ItemInput, classes.itemErrorAnimation, classes.itemError, classes.itemError, tokens.codeColorError, tokens.backgroundErrorColor, tokens.borderWidth, tokens.borderErrorColor, classes.codeErrorFade, tokens.codeColorError);
|
@@ -0,0 +1 @@
|
|
1
|
+
[]
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { css } from 'styled-components';
|
2
|
+
import { codeInputTokens as tokens } from "../../../../components/CodeInput";
|
3
|
+
export var config = {
|
4
|
+
defaults: {
|
5
|
+
view: 'default',
|
6
|
+
size: 'l'
|
7
|
+
},
|
8
|
+
variations: {
|
9
|
+
view: {
|
10
|
+
"default": /*#__PURE__*/css(["", ":var(--text-secondary);", ":var(--text-negative);", ":var(--text-primary);", ":var(--text-negative);"], tokens.captionColor, tokens.captionColorError, tokens.codeColor, tokens.codeColorError)
|
11
|
+
},
|
12
|
+
size: {
|
13
|
+
l: /*#__PURE__*/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;"], tokens.captionGap, tokens.codeItemsGap, tokens.separatorWidth, tokens.fontFamily, tokens.fontStyle, tokens.fontWeight, tokens.letterSpacing, tokens.largeScreenFontSize, tokens.largeScreenLineHeight, tokens.mediumScreenFontSize, tokens.mediumScreenLineHeight, tokens.smallScreenFontSize, tokens.smallScreenLineHeight, tokens.captionFontFamily, tokens.captionFontSize, tokens.captionFontStyle, tokens.captionFontWeight, tokens.captionLetterSpacing, tokens.captionLineHeight, tokens.codeItemLargeWidth, tokens.codeItemLargeHeight, tokens.codeItemMediumWidth, tokens.codeItemMediumHeight, tokens.codeItemSmallWidth, tokens.codeItemSmallHeight, tokens.codeItemCircleBorderWidth, tokens.codeItemCircleSize),
|
14
|
+
m: /*#__PURE__*/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;"], tokens.captionGap, tokens.codeItemsGap, tokens.separatorWidth, tokens.fontFamily, tokens.fontStyle, tokens.fontWeight, tokens.letterSpacing, tokens.largeScreenFontSize, tokens.largeScreenLineHeight, tokens.mediumScreenFontSize, tokens.mediumScreenLineHeight, tokens.smallScreenFontSize, tokens.smallScreenLineHeight, tokens.captionFontFamily, tokens.captionFontSize, tokens.captionFontStyle, tokens.captionFontWeight, tokens.captionLetterSpacing, tokens.captionLineHeight, tokens.codeItemLargeWidth, tokens.codeItemLargeHeight, tokens.codeItemMediumWidth, tokens.codeItemMediumHeight, tokens.codeItemSmallWidth, tokens.codeItemSmallHeight, tokens.codeItemCircleBorderWidth, tokens.codeItemCircleSize),
|
15
|
+
s: /*#__PURE__*/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;"], tokens.captionGap, tokens.codeItemsGap, tokens.separatorWidth, tokens.fontFamily, tokens.fontStyle, tokens.fontWeight, tokens.letterSpacing, tokens.largeScreenFontSize, tokens.largeScreenLineHeight, tokens.mediumScreenFontSize, tokens.mediumScreenLineHeight, tokens.smallScreenFontSize, tokens.smallScreenLineHeight, tokens.captionFontFamily, tokens.captionFontSize, tokens.captionFontStyle, tokens.captionFontWeight, tokens.captionLetterSpacing, tokens.captionLineHeight, tokens.codeItemLargeWidth, tokens.codeItemLargeHeight, tokens.codeItemMediumWidth, tokens.codeItemMediumHeight, tokens.codeItemSmallWidth, tokens.codeItemSmallHeight, tokens.codeItemCircleBorderWidth, tokens.codeItemCircleSize)
|
16
|
+
},
|
17
|
+
disabled: {
|
18
|
+
"true": /*#__PURE__*/css(["", ":0.4;"], tokens.disabledOpacity)
|
19
|
+
}
|
20
|
+
}
|
21
|
+
};
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { codeInputConfig } from "../../../../components/CodeInput";
|
2
|
+
import { component, mergeConfig } from "../../../../engines";
|
3
|
+
import { config } from "./CodeInput.config";
|
4
|
+
var mergedConfig = /*#__PURE__*/mergeConfig(codeInputConfig, config);
|
5
|
+
export var CodeInput = /*#__PURE__*/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,21 @@
|
|
1
|
+
import { css } from 'styled-components';
|
2
|
+
import { codeInputTokens as tokens } from "../../../../components/CodeInput";
|
3
|
+
export var config = {
|
4
|
+
defaults: {
|
5
|
+
view: 'default',
|
6
|
+
size: 'l'
|
7
|
+
},
|
8
|
+
variations: {
|
9
|
+
view: {
|
10
|
+
"default": /*#__PURE__*/css(["", ":var(--text-secondary);", ":var(--text-negative);", ":var(--text-primary);", ":var(--text-negative);"], tokens.captionColor, tokens.captionColorError, tokens.codeColor, tokens.codeColorError)
|
11
|
+
},
|
12
|
+
size: {
|
13
|
+
l: /*#__PURE__*/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;"], tokens.captionGap, tokens.codeItemsGap, tokens.separatorWidth, tokens.fontFamily, tokens.fontStyle, tokens.fontWeight, tokens.letterSpacing, tokens.largeScreenFontSize, tokens.largeScreenLineHeight, tokens.mediumScreenFontSize, tokens.mediumScreenLineHeight, tokens.smallScreenFontSize, tokens.smallScreenLineHeight, tokens.captionFontFamily, tokens.captionFontSize, tokens.captionFontStyle, tokens.captionFontWeight, tokens.captionLetterSpacing, tokens.captionLineHeight, tokens.codeItemLargeWidth, tokens.codeItemLargeHeight, tokens.codeItemMediumWidth, tokens.codeItemMediumHeight, tokens.codeItemSmallWidth, tokens.codeItemSmallHeight, tokens.codeItemCircleBorderWidth, tokens.codeItemCircleSize),
|
14
|
+
m: /*#__PURE__*/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;"], tokens.captionGap, tokens.codeItemsGap, tokens.separatorWidth, tokens.fontFamily, tokens.fontStyle, tokens.fontWeight, tokens.letterSpacing, tokens.largeScreenFontSize, tokens.largeScreenLineHeight, tokens.mediumScreenFontSize, tokens.mediumScreenLineHeight, tokens.smallScreenFontSize, tokens.smallScreenLineHeight, tokens.captionFontFamily, tokens.captionFontSize, tokens.captionFontStyle, tokens.captionFontWeight, tokens.captionLetterSpacing, tokens.captionLineHeight, tokens.codeItemLargeWidth, tokens.codeItemLargeHeight, tokens.codeItemMediumWidth, tokens.codeItemMediumHeight, tokens.codeItemSmallWidth, tokens.codeItemSmallHeight, tokens.codeItemCircleBorderWidth, tokens.codeItemCircleSize),
|
15
|
+
s: /*#__PURE__*/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;"], tokens.captionGap, tokens.codeItemsGap, tokens.separatorWidth, tokens.fontFamily, tokens.fontStyle, tokens.fontWeight, tokens.letterSpacing, tokens.largeScreenFontSize, tokens.largeScreenLineHeight, tokens.mediumScreenFontSize, tokens.mediumScreenLineHeight, tokens.smallScreenFontSize, tokens.smallScreenLineHeight, tokens.captionFontFamily, tokens.captionFontSize, tokens.captionFontStyle, tokens.captionFontWeight, tokens.captionLetterSpacing, tokens.captionLineHeight, tokens.codeItemLargeWidth, tokens.codeItemLargeHeight, tokens.codeItemMediumWidth, tokens.codeItemMediumHeight, tokens.codeItemSmallWidth, tokens.codeItemSmallHeight, tokens.codeItemCircleBorderWidth, tokens.codeItemCircleSize)
|
16
|
+
},
|
17
|
+
disabled: {
|
18
|
+
"true": /*#__PURE__*/css(["", ":0.4;"], tokens.disabledOpacity)
|
19
|
+
}
|
20
|
+
}
|
21
|
+
};
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { codeInputConfig } from "../../../../components/CodeInput";
|
2
|
+
import { component, mergeConfig } from "../../../../engines";
|
3
|
+
import { config } from "./CodeInput.config";
|
4
|
+
var mergedConfig = /*#__PURE__*/mergeConfig(codeInputConfig, config);
|
5
|
+
export var CodeInput = /*#__PURE__*/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: 'web/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
|
+
};
|
@@ -78,5 +78,6 @@ export * from "./components/NumberFormat";
|
|
78
78
|
export * from "./components/Toast/ToastNew";
|
79
79
|
export * from "./components/Carousel";
|
80
80
|
export * from "./components/PaginationDots";
|
81
|
+
export * from "./components/CodeInput";
|
81
82
|
export * from "./components/CodeField";
|
82
83
|
export * from "./components/List";
|
@@ -0,0 +1,67 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import type { RootProps } from '../../../src/engines';
|
3
|
+
import type { CodeInputProps } from './CodeInput.types';
|
4
|
+
export declare const codeInputRoot: (Root: RootProps<HTMLDivElement, CodeInputProps>) => React.ForwardRefExoticComponent<{
|
5
|
+
value?: string | undefined;
|
6
|
+
placeholder?: string | undefined;
|
7
|
+
autoFocus?: boolean | undefined;
|
8
|
+
codeLength?: 4 | 6 | 5 | undefined;
|
9
|
+
caption?: React.ReactNode;
|
10
|
+
captionAlign?: "center" | "left" | undefined;
|
11
|
+
hidden?: boolean | undefined;
|
12
|
+
view?: string | undefined;
|
13
|
+
size?: string | undefined;
|
14
|
+
screen?: "small" | "medium" | "large" | undefined;
|
15
|
+
disabled?: boolean | undefined;
|
16
|
+
isError?: boolean | undefined;
|
17
|
+
width?: string | number | undefined;
|
18
|
+
setIsError?: React.Dispatch<React.SetStateAction<boolean>> | undefined;
|
19
|
+
allowedSymbols?: string | RegExp | undefined;
|
20
|
+
itemErrorBehavior?: import("./CodeInput.types").ItemErrorBehavior | undefined;
|
21
|
+
codeErrorBehavior?: import("./CodeInput.types").CodeErrorBehavior | undefined;
|
22
|
+
onChange?: ((value: string) => void) | undefined;
|
23
|
+
onFullCodeEnter?: ((code: string) => void) | undefined;
|
24
|
+
} & Pick<React.InputHTMLAttributes<HTMLInputElement>, "aria-label" | "autoComplete"> & Omit<React.HTMLAttributes<HTMLDivElement>, "onChange"> & React.RefAttributes<HTMLInputElement>>;
|
25
|
+
export declare const codeInputConfig: {
|
26
|
+
name: string;
|
27
|
+
tag: string;
|
28
|
+
layout: (Root: RootProps<HTMLDivElement, CodeInputProps>) => React.ForwardRefExoticComponent<{
|
29
|
+
value?: string | undefined;
|
30
|
+
placeholder?: string | undefined;
|
31
|
+
autoFocus?: boolean | undefined;
|
32
|
+
codeLength?: 4 | 6 | 5 | undefined;
|
33
|
+
caption?: React.ReactNode;
|
34
|
+
captionAlign?: "center" | "left" | undefined;
|
35
|
+
hidden?: boolean | undefined;
|
36
|
+
view?: string | undefined;
|
37
|
+
size?: string | undefined;
|
38
|
+
screen?: "small" | "medium" | "large" | undefined;
|
39
|
+
disabled?: boolean | undefined;
|
40
|
+
isError?: boolean | undefined;
|
41
|
+
width?: string | number | undefined;
|
42
|
+
setIsError?: React.Dispatch<React.SetStateAction<boolean>> | undefined;
|
43
|
+
allowedSymbols?: string | RegExp | undefined;
|
44
|
+
itemErrorBehavior?: import("./CodeInput.types").ItemErrorBehavior | undefined;
|
45
|
+
codeErrorBehavior?: import("./CodeInput.types").CodeErrorBehavior | undefined;
|
46
|
+
onChange?: ((value: string) => void) | undefined;
|
47
|
+
onFullCodeEnter?: ((code: string) => void) | undefined;
|
48
|
+
} & Pick<React.InputHTMLAttributes<HTMLInputElement>, "aria-label" | "autoComplete"> & Omit<React.HTMLAttributes<HTMLDivElement>, "onChange"> & React.RefAttributes<HTMLInputElement>>;
|
49
|
+
base: import("@linaria/core").LinariaClassName;
|
50
|
+
variations: {
|
51
|
+
view: {
|
52
|
+
css: import("@linaria/core").LinariaClassName;
|
53
|
+
};
|
54
|
+
size: {
|
55
|
+
css: import("@linaria/core").LinariaClassName;
|
56
|
+
};
|
57
|
+
disabled: {
|
58
|
+
css: import("@linaria/core").LinariaClassName;
|
59
|
+
attrs: boolean;
|
60
|
+
};
|
61
|
+
};
|
62
|
+
defaults: {
|
63
|
+
size: string;
|
64
|
+
view: string;
|
65
|
+
};
|
66
|
+
};
|
67
|
+
//# sourceMappingURL=CodeInput.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"CodeInput.d.ts","sourceRoot":"","sources":["../../../src/components/CodeInput/CodeInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyE,MAAM,OAAO,CAAC;AAG9F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAI7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAkBxD,eAAO,MAAM,aAAa,SAAU,UAAU,cAAc,EAAE,cAAc,CAAC;;;;;;;;;;;;;;;;;;;;sLAgSxE,CAAC;AAEN,eAAO,MAAM,eAAe;;;mBAlSQ,UAAU,cAAc,EAAE,cAAc,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuT5E,CAAC"}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
export declare const base: import("@linaria/core").LinariaClassName;
|
3
|
+
export declare const CodeWrapper: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
4
|
+
export declare const CodeGroup: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
5
|
+
export declare const Separator: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
6
|
+
export declare const ItemInput: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLInputElement> & import("react").InputHTMLAttributes<HTMLInputElement> & {
|
7
|
+
hide?: boolean | undefined;
|
8
|
+
}>;
|
9
|
+
export declare const ItemWrapper: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
10
|
+
export declare const ItemCircle: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
11
|
+
filled?: boolean | undefined;
|
12
|
+
}>;
|
13
|
+
export declare const CaptionWrapper: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
14
|
+
captionAlign: 'left' | 'center';
|
15
|
+
widthValue?: string | undefined;
|
16
|
+
}>;
|
17
|
+
//# sourceMappingURL=CodeInput.styles.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"CodeInput.styles.d.ts","sourceRoot":"","sources":["../../../src/components/CodeInput/CodeInput.styles.ts"],"names":[],"mappings":";AAKA,eAAO,MAAM,IAAI,0CAUhB,CAAC;AAEF,eAAO,MAAM,WAAW,qKAGvB,CAAC;AAEF,eAAO,MAAM,SAAS,qKAGrB,CAAC;AAEF,eAAO,MAAM,SAAS,qKAErB,CAAC;AAEF,eAAO,MAAM,SAAS;;EAWrB,CAAC;AAEF,eAAO,MAAM,WAAW,qKAEvB,CAAC;AAEF,eAAO,MAAM,UAAU;;EActB,CAAC;AAEF,eAAO,MAAM,cAAc;kBAA8B,MAAM,GAAG,QAAQ;;EAKzE,CAAC"}
|
@@ -0,0 +1,65 @@
|
|
1
|
+
export declare const classes: {
|
2
|
+
itemError: string;
|
3
|
+
itemErrorAnimation: string;
|
4
|
+
itemErrorFade: string;
|
5
|
+
itemCirlceFilled: string;
|
6
|
+
captionError: string;
|
7
|
+
codeError: string;
|
8
|
+
codeErrorAnimation: string;
|
9
|
+
codeErrorFade: string;
|
10
|
+
captionAlignLeft: string;
|
11
|
+
hoverEnabled: string;
|
12
|
+
segmented: string;
|
13
|
+
default: string;
|
14
|
+
largeScreen: string;
|
15
|
+
mediumScreen: string;
|
16
|
+
smallScreen: string;
|
17
|
+
disabled: string;
|
18
|
+
};
|
19
|
+
export declare const tokens: {
|
20
|
+
captionGap: string;
|
21
|
+
codeItemsGap: string;
|
22
|
+
separatorWidth: string;
|
23
|
+
codeItemLargeWidth: string;
|
24
|
+
codeItemLargeHeight: string;
|
25
|
+
codeItemMediumWidth: string;
|
26
|
+
codeItemMediumHeight: string;
|
27
|
+
codeItemSmallWidth: string;
|
28
|
+
codeItemSmallHeight: string;
|
29
|
+
codeItemCircleSize: string;
|
30
|
+
codeItemCircleBorderWidth: string;
|
31
|
+
fontStyle: string;
|
32
|
+
fontFamily: string;
|
33
|
+
fontWeight: string;
|
34
|
+
letterSpacing: string;
|
35
|
+
largeScreenFontSize: string;
|
36
|
+
largeScreenLineHeight: string;
|
37
|
+
mediumScreenFontSize: string;
|
38
|
+
mediumScreenLineHeight: string;
|
39
|
+
smallScreenFontSize: string;
|
40
|
+
smallScreenLineHeight: string;
|
41
|
+
captionFontFamily: string;
|
42
|
+
captionFontSize: string;
|
43
|
+
captionFontStyle: string;
|
44
|
+
captionFontWeight: string;
|
45
|
+
captionLetterSpacing: string;
|
46
|
+
captionLineHeight: string;
|
47
|
+
borderRadius: string;
|
48
|
+
borderRadiusSegmented: string;
|
49
|
+
segmentedSideBorderRadius: string;
|
50
|
+
captionColor: string;
|
51
|
+
captionColorError: string;
|
52
|
+
codeColor: string;
|
53
|
+
codeColorError: string;
|
54
|
+
backgroundColor: string;
|
55
|
+
backgroundColorHover: string;
|
56
|
+
backgroundColorFocus: string;
|
57
|
+
backgroundErrorColor: string;
|
58
|
+
borderWidth: string;
|
59
|
+
borderColor: string;
|
60
|
+
borderColorHover: string;
|
61
|
+
borderColorFocus: string;
|
62
|
+
borderErrorColor: string;
|
63
|
+
disabledOpacity: string;
|
64
|
+
};
|
65
|
+
//# sourceMappingURL=CodeInput.tokens.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"CodeInput.tokens.d.ts","sourceRoot":"","sources":["../../../src/components/CodeInput/CodeInput.tokens.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;CAsBnB,CAAC;AAEF,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6DlB,CAAC"}
|
@@ -0,0 +1,96 @@
|
|
1
|
+
import type { Dispatch, HTMLAttributes, InputHTMLAttributes, ReactNode, SetStateAction } from 'react';
|
2
|
+
export declare type ItemErrorBehavior = 'remove-symbol' | 'keep' | 'remove-code' | 'forbid-enter';
|
3
|
+
export declare type CodeErrorBehavior = 'remove-code' | 'keep';
|
4
|
+
export declare type CodeInputProps = {
|
5
|
+
/**
|
6
|
+
* Значение поля ввода
|
7
|
+
*/
|
8
|
+
value?: string;
|
9
|
+
/**
|
10
|
+
* Строка равная, длине кода или же один символ,
|
11
|
+
* для отображения в качестве placeholder
|
12
|
+
*/
|
13
|
+
placeholder?: string;
|
14
|
+
/**
|
15
|
+
* Автофокус на компоненте
|
16
|
+
*/
|
17
|
+
autoFocus?: boolean;
|
18
|
+
/**
|
19
|
+
* Длина кода
|
20
|
+
* @default 6
|
21
|
+
*/
|
22
|
+
codeLength?: 4 | 5 | 6;
|
23
|
+
/**
|
24
|
+
* Подпись к компоненту
|
25
|
+
*/
|
26
|
+
caption?: ReactNode;
|
27
|
+
/**
|
28
|
+
* Выравнивание подписи
|
29
|
+
* @default left
|
30
|
+
*/
|
31
|
+
captionAlign?: 'left' | 'center';
|
32
|
+
/**
|
33
|
+
* Скрытые поля
|
34
|
+
*/
|
35
|
+
hidden?: boolean;
|
36
|
+
/**
|
37
|
+
* Вид компонента
|
38
|
+
*/
|
39
|
+
view?: string;
|
40
|
+
/**
|
41
|
+
* Размер компонента
|
42
|
+
*/
|
43
|
+
size?: string;
|
44
|
+
/**
|
45
|
+
* Размер экрана
|
46
|
+
*/
|
47
|
+
screen?: 'large' | 'medium' | 'small';
|
48
|
+
/**
|
49
|
+
* Компонент не активен
|
50
|
+
*/
|
51
|
+
disabled?: boolean;
|
52
|
+
/**
|
53
|
+
* Флаг ошибки кода
|
54
|
+
*/
|
55
|
+
isError?: boolean;
|
56
|
+
/**
|
57
|
+
* Ширина компонента
|
58
|
+
* @description
|
59
|
+
* Значение может принимать строку с единицой измерения CSS (px, rem и тд.).
|
60
|
+
* Если передано число без единицы измерения - рассчитывается в rem.
|
61
|
+
*/
|
62
|
+
width?: string | number;
|
63
|
+
/**
|
64
|
+
* Колбек для установки флага ошибки
|
65
|
+
*/
|
66
|
+
setIsError?: Dispatch<SetStateAction<boolean>>;
|
67
|
+
/**
|
68
|
+
* Регулярное выражение или строка, по которой проверяется символ при вводе
|
69
|
+
* @default '^\\d+$' - только цифры
|
70
|
+
*/
|
71
|
+
allowedSymbols?: string | RegExp;
|
72
|
+
/**
|
73
|
+
* Поведение элемента поля ввода, при вводе некорректного значения
|
74
|
+
* - `remove-symbol` - проигрывается анимация ошибки, значение элемента очищается
|
75
|
+
* - `keep` - проигрывается анимация ошибки, значение остается
|
76
|
+
* - `remove-code` - проигрывается анимация ошибки, значение всего поля очищается
|
77
|
+
* @default 'remove-symbol'
|
78
|
+
*/
|
79
|
+
itemErrorBehavior?: ItemErrorBehavior;
|
80
|
+
/**
|
81
|
+
* Поведение элемента поля ввода, при вводе некорректного значения
|
82
|
+
* - `remove-code` - проигрывается анимация ошибки, значение всего поля очищается
|
83
|
+
* - `keep` - проигрывается анимация ошибки, значение остается
|
84
|
+
* @default 'remove-code'
|
85
|
+
*/
|
86
|
+
codeErrorBehavior?: CodeErrorBehavior;
|
87
|
+
/**
|
88
|
+
* Коллбек, вызываемый при изменении значения кода
|
89
|
+
*/
|
90
|
+
onChange?: (value: string) => void;
|
91
|
+
/**
|
92
|
+
* Коллбек, вызываемый при вводе полного значения в поле
|
93
|
+
*/
|
94
|
+
onFullCodeEnter?: (code: string) => void;
|
95
|
+
} & Pick<InputHTMLAttributes<HTMLInputElement>, 'aria-label' | 'autoComplete'> & Omit<HTMLAttributes<HTMLDivElement>, 'onChange'>;
|
96
|
+
//# sourceMappingURL=CodeInput.types.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"CodeInput.types.d.ts","sourceRoot":"","sources":["../../../src/components/CodeInput/CodeInput.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,mBAAmB,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEtG,oBAAY,iBAAiB,GAAG,eAAe,GAAG,MAAM,GAAG,aAAa,GAAG,cAAc,CAAC;AAC1F,oBAAY,iBAAiB,GAAG,aAAa,GAAG,MAAM,CAAC;AAEvD,oBAAY,cAAc,GAAG;IACzB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACvB;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IACjC;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACtC;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB;;OAEG;IACH,UAAU,CAAC,EAAE,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IAC/C;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACjC;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC;;OAEG;IACH,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C,GAAG,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,YAAY,GAAG,cAAc,CAAC,GAC1E,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/CodeInput/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|