@salutejs/plasma-new-hope 0.325.0-canary.1954.15277675821.0 → 0.325.0-canary.1967.15291487889.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/CodeField/CodeField.css +14 -0
- package/cjs/components/CodeField/CodeField.js +290 -0
- package/cjs/components/CodeField/CodeField.js.map +1 -0
- package/cjs/components/CodeField/CodeField.styles.js +57 -0
- package/cjs/components/CodeField/CodeField.styles.js.map +1 -0
- package/cjs/components/CodeField/CodeField.styles_7zxgpc.css +6 -0
- package/cjs/components/CodeField/CodeField.tokens.js +59 -0
- package/cjs/components/CodeField/CodeField.tokens.js.map +1 -0
- package/cjs/components/CodeField/utils/constants.js +18 -0
- package/cjs/components/CodeField/utils/constants.js.map +1 -0
- package/cjs/components/CodeField/utils/handleCodeError.js +55 -0
- package/cjs/components/CodeField/utils/handleCodeError.js.map +1 -0
- package/cjs/components/CodeField/utils/handleItemError.js +53 -0
- package/cjs/components/CodeField/utils/handleItemError.js.map +1 -0
- package/cjs/components/CodeField/utils/initialValuesHelper.js +33 -0
- package/cjs/components/CodeField/utils/initialValuesHelper.js.map +1 -0
- package/cjs/components/{List/variations/_view → CodeField/variations/_disabled}/base.js +2 -2
- package/cjs/components/CodeField/variations/_disabled/base.js.map +1 -0
- package/cjs/components/CodeField/variations/_disabled/base_obsae2.css +1 -0
- package/cjs/components/{List/variations/_variant → CodeField/variations/_shape}/base.js +2 -2
- package/cjs/components/CodeField/variations/_shape/base.js.map +1 -0
- package/cjs/components/CodeField/variations/_shape/base_1scsyya.css +1 -0
- package/cjs/components/{List/variations/_disabled → CodeField/variations/_size}/base.js +2 -2
- package/cjs/components/CodeField/variations/_size/base.js.map +1 -0
- package/cjs/components/CodeField/variations/_size/base_1wrvbr5.css +1 -0
- package/cjs/components/{List/variations/_size → CodeField/variations/_view}/base.js +2 -2
- package/cjs/components/CodeField/variations/_view/base.js.map +1 -0
- package/cjs/components/CodeField/variations/_view/base_9a5yza.css +1 -0
- package/cjs/components/Notification/Notification.css +12 -12
- package/cjs/components/Notification/Notification.js +5 -1
- package/cjs/components/Notification/Notification.js.map +1 -1
- package/cjs/components/Notification/Notification.styles.js +63 -48
- package/cjs/components/Notification/Notification.styles.js.map +1 -1
- package/cjs/components/Notification/{Notification.styles_1yt699o.css → Notification.styles_1uyb7ob.css} +1 -1
- package/cjs/components/Notification/Notification.types.js.map +1 -1
- package/cjs/components/Notification/NotificationsProvider.css +11 -11
- package/cjs/components/Notification/variations/_layout/base.js +1 -1
- package/cjs/components/Notification/variations/_layout/base.js.map +1 -1
- package/cjs/components/Notification/variations/_layout/base_1g9g70c.css +1 -0
- package/cjs/components/NumberInput/ui/Input/Input.js +0 -3
- package/cjs/components/NumberInput/ui/Input/Input.js.map +1 -1
- package/cjs/index.css +27 -17
- package/cjs/index.js +10 -8
- package/cjs/index.js.map +1 -1
- package/emotion/cjs/components/CodeField/CodeField.js +299 -0
- package/emotion/cjs/components/CodeField/CodeField.styles.js +65 -0
- package/emotion/cjs/components/CodeField/CodeField.template-doc.mdx +150 -0
- package/emotion/cjs/components/CodeField/CodeField.tokens.js +57 -0
- package/emotion/cjs/components/CodeField/index.js +50 -0
- package/emotion/cjs/components/CodeField/utils/constants.js +12 -0
- package/emotion/cjs/components/CodeField/utils/handleCodeError.js +58 -0
- package/emotion/cjs/components/CodeField/utils/handleItemError.js +56 -0
- package/emotion/cjs/components/CodeField/utils/index.js +38 -0
- package/emotion/cjs/components/CodeField/utils/initialValuesHelper.js +30 -0
- package/emotion/cjs/components/CodeField/variations/_disabled/base.js +9 -0
- package/emotion/cjs/components/CodeField/variations/_disabled/tokens.json +4 -0
- package/emotion/cjs/components/CodeField/variations/_shape/base.js +10 -0
- package/emotion/cjs/components/CodeField/variations/_shape/tokens.json +1 -0
- package/emotion/cjs/components/CodeField/variations/_size/base.js +10 -0
- package/emotion/cjs/components/CodeField/variations/_size/tokens.json +19 -0
- package/emotion/cjs/components/CodeField/variations/_view/base.js +10 -0
- package/emotion/cjs/components/CodeField/variations/_view/tokens.json +0 -0
- package/emotion/cjs/components/Notification/Notification.js +5 -1
- package/emotion/cjs/components/Notification/Notification.styles.js +43 -36
- package/emotion/cjs/components/Notification/Notification.template-doc.mdx +44 -0
- package/emotion/cjs/components/Notification/variations/_layout/base.js +1 -1
- package/emotion/cjs/components/NumberInput/ui/Input/Input.js +0 -3
- package/emotion/cjs/examples/fixtures/Notification.js +1 -1
- package/emotion/cjs/examples/plasma_b2c/components/CodeField/CodeField.config.js +31 -0
- package/emotion/cjs/examples/plasma_b2c/components/CodeField/CodeField.js +11 -0
- package/emotion/cjs/examples/plasma_b2c/components/CodeField/CodeField.stories.tsx +107 -0
- package/emotion/cjs/examples/plasma_b2c/components/Notification/Notification.stories.tsx +5 -1
- package/emotion/cjs/examples/plasma_web/components/CodeField/CodeField.config.js +31 -0
- package/emotion/cjs/examples/plasma_web/components/CodeField/CodeField.js +11 -0
- package/emotion/cjs/examples/plasma_web/components/CodeField/CodeField.stories.tsx +107 -0
- package/emotion/cjs/examples/plasma_web/components/Notification/Notification.stories.tsx +5 -1
- package/emotion/cjs/index.js +11 -11
- package/emotion/es/components/CodeField/CodeField.js +290 -0
- package/emotion/es/components/CodeField/CodeField.styles.js +58 -0
- package/emotion/es/components/CodeField/CodeField.template-doc.mdx +150 -0
- package/emotion/es/components/CodeField/CodeField.tokens.js +51 -0
- package/emotion/es/components/CodeField/index.js +3 -0
- package/emotion/es/components/CodeField/utils/constants.js +6 -0
- package/emotion/es/components/CodeField/utils/handleCodeError.js +52 -0
- package/emotion/es/components/CodeField/utils/handleItemError.js +50 -0
- package/emotion/es/components/CodeField/utils/index.js +3 -0
- package/emotion/es/components/CodeField/utils/initialValuesHelper.js +24 -0
- package/emotion/es/components/CodeField/variations/_disabled/base.js +3 -0
- package/emotion/es/components/CodeField/variations/_disabled/tokens.json +4 -0
- package/emotion/es/components/CodeField/variations/_shape/base.js +4 -0
- package/emotion/es/components/CodeField/variations/_shape/tokens.json +1 -0
- package/emotion/es/components/CodeField/variations/_size/base.js +4 -0
- package/emotion/es/components/CodeField/variations/_size/tokens.json +19 -0
- package/emotion/es/components/CodeField/variations/_view/base.js +4 -0
- package/emotion/es/components/CodeField/variations/_view/tokens.json +0 -0
- package/emotion/es/components/Notification/Notification.js +5 -1
- package/emotion/es/components/Notification/Notification.styles.js +43 -36
- package/emotion/es/components/Notification/Notification.template-doc.mdx +44 -0
- package/emotion/es/components/Notification/variations/_layout/base.js +1 -1
- package/emotion/es/components/NumberInput/ui/Input/Input.js +0 -3
- package/emotion/es/examples/fixtures/Notification.js +1 -1
- package/emotion/es/examples/plasma_b2c/components/CodeField/CodeField.config.js +25 -0
- package/emotion/es/examples/plasma_b2c/components/CodeField/CodeField.js +5 -0
- package/emotion/es/examples/plasma_b2c/components/CodeField/CodeField.stories.tsx +107 -0
- package/emotion/es/examples/plasma_b2c/components/Notification/Notification.stories.tsx +5 -1
- package/emotion/es/examples/plasma_web/components/CodeField/CodeField.config.js +25 -0
- package/emotion/es/examples/plasma_web/components/CodeField/CodeField.js +5 -0
- package/emotion/es/examples/plasma_web/components/CodeField/CodeField.stories.tsx +107 -0
- package/emotion/es/examples/plasma_web/components/Notification/Notification.stories.tsx +5 -1
- package/emotion/es/index.js +1 -2
- package/es/components/CodeField/CodeField.css +14 -0
- package/es/components/CodeField/CodeField.js +280 -0
- package/es/components/CodeField/CodeField.js.map +1 -0
- package/es/components/CodeField/CodeField.styles.js +48 -0
- package/es/components/CodeField/CodeField.styles.js.map +1 -0
- package/es/components/CodeField/CodeField.styles_7zxgpc.css +6 -0
- package/es/components/CodeField/CodeField.tokens.js +54 -0
- package/es/components/CodeField/CodeField.tokens.js.map +1 -0
- package/es/components/CodeField/utils/constants.js +9 -0
- package/es/components/CodeField/utils/constants.js.map +1 -0
- package/es/components/CodeField/utils/handleCodeError.js +51 -0
- package/es/components/CodeField/utils/handleCodeError.js.map +1 -0
- package/es/components/CodeField/utils/handleItemError.js +49 -0
- package/es/components/CodeField/utils/handleItemError.js.map +1 -0
- package/es/components/CodeField/utils/initialValuesHelper.js +27 -0
- package/es/components/CodeField/utils/initialValuesHelper.js.map +1 -0
- package/es/components/{List/variations/_view → CodeField/variations/_disabled}/base.js +2 -2
- package/es/components/CodeField/variations/_disabled/base.js.map +1 -0
- package/es/components/CodeField/variations/_disabled/base_obsae2.css +1 -0
- package/es/components/CodeField/variations/_shape/base.js +5 -0
- package/es/components/CodeField/variations/_shape/base.js.map +1 -0
- package/es/components/CodeField/variations/_shape/base_1scsyya.css +1 -0
- package/es/components/{List/variations/_disabled → CodeField/variations/_size}/base.js +2 -2
- package/es/components/CodeField/variations/_size/base.js.map +1 -0
- package/es/components/CodeField/variations/_size/base_1wrvbr5.css +1 -0
- package/es/components/{List/variations/_size → CodeField/variations/_view}/base.js +2 -2
- package/es/components/CodeField/variations/_view/base.js.map +1 -0
- package/es/components/CodeField/variations/_view/base_9a5yza.css +1 -0
- package/es/components/Notification/Notification.css +12 -12
- package/es/components/Notification/Notification.js +5 -1
- package/es/components/Notification/Notification.js.map +1 -1
- package/es/components/Notification/Notification.styles.js +63 -48
- package/es/components/Notification/Notification.styles.js.map +1 -1
- package/es/components/Notification/{Notification.styles_1yt699o.css → Notification.styles_1uyb7ob.css} +1 -1
- package/es/components/Notification/Notification.types.js.map +1 -1
- package/es/components/Notification/NotificationsProvider.css +11 -11
- package/es/components/Notification/variations/_layout/base.js +1 -1
- package/es/components/Notification/variations/_layout/base.js.map +1 -1
- package/es/components/Notification/variations/_layout/base_1g9g70c.css +1 -0
- package/es/components/NumberInput/ui/Input/Input.js +0 -3
- package/es/components/NumberInput/ui/Input/Input.js.map +1 -1
- package/es/index.css +27 -17
- package/es/index.js +3 -3
- package/package.json +2 -2
- package/styled-components/cjs/components/CodeField/CodeField.js +299 -0
- package/styled-components/cjs/components/CodeField/CodeField.styles.js +38 -0
- package/styled-components/cjs/components/CodeField/CodeField.template-doc.mdx +150 -0
- package/styled-components/cjs/components/CodeField/CodeField.tokens.js +57 -0
- package/styled-components/cjs/components/CodeField/index.js +50 -0
- package/styled-components/cjs/components/CodeField/utils/constants.js +12 -0
- package/styled-components/cjs/components/CodeField/utils/handleCodeError.js +58 -0
- package/styled-components/cjs/components/CodeField/utils/handleItemError.js +56 -0
- package/styled-components/cjs/components/CodeField/utils/index.js +38 -0
- package/styled-components/cjs/components/CodeField/utils/initialValuesHelper.js +30 -0
- package/styled-components/cjs/components/{List/variations/_view → CodeField/variations/_disabled}/base.js +2 -1
- package/styled-components/cjs/components/CodeField/variations/_disabled/tokens.json +4 -0
- package/styled-components/cjs/components/CodeField/variations/_shape/base.js +10 -0
- package/styled-components/cjs/components/CodeField/variations/_shape/tokens.json +1 -0
- package/styled-components/cjs/components/CodeField/variations/_size/base.js +10 -0
- package/styled-components/cjs/components/CodeField/variations/_size/tokens.json +19 -0
- package/styled-components/cjs/components/CodeField/variations/_view/base.js +10 -0
- package/styled-components/cjs/components/CodeField/variations/_view/tokens.json +0 -0
- package/styled-components/cjs/components/Notification/Notification.js +5 -1
- package/styled-components/cjs/components/Notification/Notification.styles.js +33 -26
- package/styled-components/cjs/components/Notification/Notification.template-doc.mdx +44 -0
- package/styled-components/cjs/components/Notification/variations/_layout/base.js +1 -1
- package/styled-components/cjs/components/NumberInput/ui/Input/Input.js +0 -3
- package/styled-components/cjs/examples/fixtures/Notification.js +1 -1
- package/styled-components/cjs/examples/plasma_b2c/components/CodeField/CodeField.config.js +31 -0
- package/styled-components/cjs/examples/plasma_b2c/components/CodeField/CodeField.js +11 -0
- package/styled-components/cjs/examples/plasma_b2c/components/CodeField/CodeField.stories.tsx +107 -0
- package/styled-components/cjs/examples/plasma_b2c/components/Notification/Notification.stories.tsx +5 -1
- package/styled-components/cjs/examples/plasma_web/components/CodeField/CodeField.config.js +31 -0
- package/styled-components/cjs/examples/plasma_web/components/CodeField/CodeField.js +11 -0
- package/styled-components/cjs/examples/plasma_web/components/CodeField/CodeField.stories.tsx +107 -0
- package/styled-components/cjs/examples/plasma_web/components/Notification/Notification.stories.tsx +5 -1
- package/styled-components/cjs/index.js +11 -11
- package/styled-components/es/components/CodeField/CodeField.js +290 -0
- package/styled-components/es/components/CodeField/CodeField.styles.js +30 -0
- package/styled-components/es/components/CodeField/CodeField.template-doc.mdx +150 -0
- package/styled-components/es/components/CodeField/CodeField.tokens.js +51 -0
- package/styled-components/es/components/CodeField/index.js +3 -0
- package/styled-components/es/components/CodeField/utils/constants.js +6 -0
- package/styled-components/es/components/CodeField/utils/handleCodeError.js +52 -0
- package/styled-components/es/components/CodeField/utils/handleItemError.js +50 -0
- package/styled-components/es/components/CodeField/utils/index.js +3 -0
- package/styled-components/es/components/CodeField/utils/initialValuesHelper.js +24 -0
- package/styled-components/es/components/CodeField/variations/_disabled/base.js +3 -0
- package/styled-components/es/components/CodeField/variations/_disabled/tokens.json +4 -0
- package/styled-components/es/components/CodeField/variations/_shape/base.js +4 -0
- package/styled-components/es/components/CodeField/variations/_shape/tokens.json +1 -0
- package/styled-components/es/components/CodeField/variations/_size/base.js +4 -0
- package/styled-components/es/components/CodeField/variations/_size/tokens.json +19 -0
- package/styled-components/es/components/CodeField/variations/_view/base.js +4 -0
- package/styled-components/es/components/CodeField/variations/_view/tokens.json +0 -0
- package/styled-components/es/components/Notification/Notification.js +5 -1
- package/styled-components/es/components/Notification/Notification.styles.js +33 -26
- package/styled-components/es/components/Notification/Notification.template-doc.mdx +44 -0
- package/styled-components/es/components/Notification/variations/_layout/base.js +1 -1
- package/styled-components/es/components/NumberInput/ui/Input/Input.js +0 -3
- package/styled-components/es/examples/fixtures/Notification.js +1 -1
- package/styled-components/es/examples/plasma_b2c/components/CodeField/CodeField.config.js +25 -0
- package/styled-components/es/examples/plasma_b2c/components/CodeField/CodeField.js +5 -0
- package/styled-components/es/examples/plasma_b2c/components/CodeField/CodeField.stories.tsx +107 -0
- package/styled-components/es/examples/plasma_b2c/components/Notification/Notification.stories.tsx +5 -1
- package/styled-components/es/examples/plasma_web/components/CodeField/CodeField.config.js +25 -0
- package/styled-components/es/examples/plasma_web/components/CodeField/CodeField.js +5 -0
- package/styled-components/es/examples/plasma_web/components/CodeField/CodeField.stories.tsx +107 -0
- package/styled-components/es/examples/plasma_web/components/Notification/Notification.stories.tsx +5 -1
- package/styled-components/es/index.js +1 -2
- package/types/components/CodeField/CodeField.d.ts +69 -0
- package/types/components/CodeField/CodeField.d.ts.map +1 -0
- package/types/components/CodeField/CodeField.styles.d.ts +11 -0
- package/types/components/CodeField/CodeField.styles.d.ts.map +1 -0
- package/types/components/CodeField/CodeField.tokens.d.ts +52 -0
- package/types/components/CodeField/CodeField.tokens.d.ts.map +1 -0
- package/types/components/CodeField/CodeField.types.d.ts +93 -0
- package/types/components/CodeField/CodeField.types.d.ts.map +1 -0
- package/types/components/CodeField/index.d.ts +4 -0
- package/types/components/CodeField/index.d.ts.map +1 -0
- package/types/components/CodeField/utils/constants.d.ts +7 -0
- package/types/components/CodeField/utils/constants.d.ts.map +1 -0
- package/types/components/CodeField/utils/handleCodeError.d.ts +15 -0
- package/types/components/CodeField/utils/handleCodeError.d.ts.map +1 -0
- package/types/components/CodeField/utils/handleItemError.d.ts +14 -0
- package/types/components/CodeField/utils/handleItemError.d.ts.map +1 -0
- package/types/components/CodeField/utils/index.d.ts +4 -0
- package/types/components/CodeField/utils/index.d.ts.map +1 -0
- package/types/components/CodeField/utils/initialValuesHelper.d.ts +4 -0
- package/types/components/CodeField/utils/initialValuesHelper.d.ts.map +1 -0
- package/types/components/CodeField/variations/_disabled/base.d.ts.map +1 -0
- package/types/components/CodeField/variations/_shape/base.d.ts.map +1 -0
- package/types/components/CodeField/variations/_size/base.d.ts.map +1 -0
- package/types/components/CodeField/variations/_view/base.d.ts.map +1 -0
- package/types/components/Notification/Notification.d.ts.map +1 -1
- package/types/components/Notification/Notification.styles.d.ts +3 -1
- package/types/components/Notification/Notification.styles.d.ts.map +1 -1
- package/types/components/Notification/Notification.types.d.ts +9 -0
- package/types/components/Notification/Notification.types.d.ts.map +1 -1
- package/types/components/NumberInput/ui/Input/Input.d.ts.map +1 -1
- package/types/index.d.ts +1 -2
- package/types/index.d.ts.map +1 -1
- package/cjs/components/List/List.css +0 -1
- package/cjs/components/List/List.js +0 -63
- package/cjs/components/List/List.js.map +0 -1
- package/cjs/components/List/List.styles.js +0 -9
- package/cjs/components/List/List.styles.js.map +0 -1
- package/cjs/components/List/List.styles_9yg2yl.css +0 -1
- package/cjs/components/List/List.tokens.js +0 -41
- package/cjs/components/List/List.tokens.js.map +0 -1
- package/cjs/components/List/ui/ListItem.css +0 -18
- package/cjs/components/List/ui/ListItem.js +0 -27
- package/cjs/components/List/ui/ListItem.js.map +0 -1
- package/cjs/components/List/ui/ListItem.styles.js +0 -28
- package/cjs/components/List/ui/ListItem.styles.js.map +0 -1
- package/cjs/components/List/ui/ListItem.styles_1eo5k14.css +0 -2
- package/cjs/components/List/variations/_disabled/base.js.map +0 -1
- package/cjs/components/List/variations/_disabled/base_x642ct.css +0 -1
- package/cjs/components/List/variations/_size/base.js.map +0 -1
- package/cjs/components/List/variations/_size/base_x642ct.css +0 -1
- package/cjs/components/List/variations/_variant/base.js.map +0 -1
- package/cjs/components/List/variations/_variant/base_x642ct.css +0 -1
- package/cjs/components/List/variations/_view/base.js.map +0 -1
- package/cjs/components/List/variations/_view/base_x642ct.css +0 -1
- package/cjs/components/Notification/variations/_layout/base_qkc3i4.css +0 -1
- package/emotion/cjs/components/List/List.js +0 -59
- package/emotion/cjs/components/List/List.styles.js +0 -9
- package/emotion/cjs/components/List/List.tokens.js +0 -39
- package/emotion/cjs/components/List/index.js +0 -38
- package/emotion/cjs/components/List/ui/ListItem.js +0 -24
- package/emotion/cjs/components/List/ui/ListItem.styles.js +0 -21
- package/emotion/cjs/components/List/variations/_disabled/base.js +0 -8
- package/emotion/cjs/components/List/variations/_disabled/tokens.json +0 -1
- package/emotion/cjs/components/List/variations/_size/base.js +0 -8
- package/emotion/cjs/components/List/variations/_size/tokens.json +0 -1
- package/emotion/cjs/components/List/variations/_variant/base.js +0 -8
- package/emotion/cjs/components/List/variations/_variant/tokens.json +0 -1
- package/emotion/cjs/components/List/variations/_view/base.js +0 -8
- package/emotion/cjs/components/List/variations/_view/tokens.json +0 -1
- package/emotion/cjs/examples/plasma_b2c/components/List/List.config.js +0 -34
- package/emotion/cjs/examples/plasma_b2c/components/List/List.js +0 -12
- package/emotion/cjs/examples/plasma_b2c/components/List/List.stories.tsx +0 -60
- package/emotion/cjs/examples/plasma_web/components/List/List.config.js +0 -34
- package/emotion/cjs/examples/plasma_web/components/List/List.js +0 -12
- package/emotion/cjs/examples/plasma_web/components/List/List.stories.tsx +0 -60
- package/emotion/es/components/List/List.js +0 -50
- package/emotion/es/components/List/List.styles.js +0 -3
- package/emotion/es/components/List/List.tokens.js +0 -33
- package/emotion/es/components/List/index.js +0 -3
- package/emotion/es/components/List/ui/ListItem.js +0 -17
- package/emotion/es/components/List/ui/ListItem.styles.js +0 -14
- package/emotion/es/components/List/variations/_disabled/base.js +0 -2
- package/emotion/es/components/List/variations/_disabled/tokens.json +0 -1
- package/emotion/es/components/List/variations/_size/base.js +0 -2
- package/emotion/es/components/List/variations/_size/tokens.json +0 -1
- package/emotion/es/components/List/variations/_variant/base.js +0 -2
- package/emotion/es/components/List/variations/_variant/tokens.json +0 -1
- package/emotion/es/components/List/variations/_view/base.js +0 -2
- package/emotion/es/components/List/variations/_view/tokens.json +0 -1
- package/emotion/es/examples/plasma_b2c/components/List/List.config.js +0 -28
- package/emotion/es/examples/plasma_b2c/components/List/List.js +0 -6
- package/emotion/es/examples/plasma_b2c/components/List/List.stories.tsx +0 -60
- package/emotion/es/examples/plasma_web/components/List/List.config.js +0 -28
- package/emotion/es/examples/plasma_web/components/List/List.js +0 -6
- package/emotion/es/examples/plasma_web/components/List/List.stories.tsx +0 -60
- package/es/components/List/List.css +0 -1
- package/es/components/List/List.js +0 -54
- package/es/components/List/List.js.map +0 -1
- package/es/components/List/List.styles.js +0 -5
- package/es/components/List/List.styles.js.map +0 -1
- package/es/components/List/List.styles_9yg2yl.css +0 -1
- package/es/components/List/List.tokens.js +0 -36
- package/es/components/List/List.tokens.js.map +0 -1
- package/es/components/List/ui/ListItem.css +0 -18
- package/es/components/List/ui/ListItem.js +0 -19
- package/es/components/List/ui/ListItem.js.map +0 -1
- package/es/components/List/ui/ListItem.styles.js +0 -23
- package/es/components/List/ui/ListItem.styles.js.map +0 -1
- package/es/components/List/ui/ListItem.styles_1eo5k14.css +0 -2
- package/es/components/List/variations/_disabled/base.js.map +0 -1
- package/es/components/List/variations/_disabled/base_x642ct.css +0 -1
- package/es/components/List/variations/_size/base.js.map +0 -1
- package/es/components/List/variations/_size/base_x642ct.css +0 -1
- package/es/components/List/variations/_variant/base.js +0 -5
- package/es/components/List/variations/_variant/base.js.map +0 -1
- package/es/components/List/variations/_variant/base_x642ct.css +0 -1
- package/es/components/List/variations/_view/base.js.map +0 -1
- package/es/components/List/variations/_view/base_x642ct.css +0 -1
- package/es/components/Notification/variations/_layout/base_qkc3i4.css +0 -1
- package/styled-components/cjs/components/List/List.js +0 -59
- package/styled-components/cjs/components/List/List.styles.js +0 -9
- package/styled-components/cjs/components/List/List.tokens.js +0 -39
- package/styled-components/cjs/components/List/List.types.js +0 -5
- package/styled-components/cjs/components/List/index.js +0 -38
- package/styled-components/cjs/components/List/ui/ListItem.js +0 -24
- package/styled-components/cjs/components/List/ui/ListItem.styles.js +0 -19
- package/styled-components/cjs/components/List/ui/ListItem.types.js +0 -5
- package/styled-components/cjs/components/List/variations/_disabled/base.js +0 -8
- package/styled-components/cjs/components/List/variations/_disabled/tokens.json +0 -1
- package/styled-components/cjs/components/List/variations/_size/base.js +0 -8
- package/styled-components/cjs/components/List/variations/_size/tokens.json +0 -1
- package/styled-components/cjs/components/List/variations/_variant/base.js +0 -8
- package/styled-components/cjs/components/List/variations/_variant/tokens.json +0 -1
- package/styled-components/cjs/components/List/variations/_view/tokens.json +0 -1
- package/styled-components/cjs/examples/plasma_b2c/components/List/List.config.js +0 -34
- package/styled-components/cjs/examples/plasma_b2c/components/List/List.js +0 -12
- package/styled-components/cjs/examples/plasma_b2c/components/List/List.stories.tsx +0 -60
- package/styled-components/cjs/examples/plasma_web/components/List/List.config.js +0 -34
- package/styled-components/cjs/examples/plasma_web/components/List/List.js +0 -12
- package/styled-components/cjs/examples/plasma_web/components/List/List.stories.tsx +0 -60
- package/styled-components/es/components/List/List.js +0 -50
- package/styled-components/es/components/List/List.styles.js +0 -3
- package/styled-components/es/components/List/List.tokens.js +0 -33
- package/styled-components/es/components/List/List.types.js +0 -1
- package/styled-components/es/components/List/index.js +0 -3
- package/styled-components/es/components/List/ui/ListItem.js +0 -17
- package/styled-components/es/components/List/ui/ListItem.styles.js +0 -12
- package/styled-components/es/components/List/ui/ListItem.types.js +0 -1
- package/styled-components/es/components/List/variations/_disabled/base.js +0 -2
- package/styled-components/es/components/List/variations/_disabled/tokens.json +0 -1
- package/styled-components/es/components/List/variations/_size/base.js +0 -2
- package/styled-components/es/components/List/variations/_size/tokens.json +0 -1
- package/styled-components/es/components/List/variations/_variant/base.js +0 -2
- package/styled-components/es/components/List/variations/_variant/tokens.json +0 -1
- package/styled-components/es/components/List/variations/_view/base.js +0 -2
- package/styled-components/es/components/List/variations/_view/tokens.json +0 -1
- package/styled-components/es/examples/plasma_b2c/components/List/List.config.js +0 -28
- package/styled-components/es/examples/plasma_b2c/components/List/List.js +0 -6
- package/styled-components/es/examples/plasma_b2c/components/List/List.stories.tsx +0 -60
- package/styled-components/es/examples/plasma_web/components/List/List.config.js +0 -28
- package/styled-components/es/examples/plasma_web/components/List/List.js +0 -6
- package/styled-components/es/examples/plasma_web/components/List/List.stories.tsx +0 -60
- package/types/components/List/List.d.ts +0 -43
- package/types/components/List/List.d.ts.map +0 -1
- package/types/components/List/List.styles.d.ts +0 -2
- package/types/components/List/List.styles.d.ts.map +0 -1
- package/types/components/List/List.tokens.d.ts +0 -34
- package/types/components/List/List.tokens.d.ts.map +0 -1
- package/types/components/List/List.types.d.ts +0 -24
- package/types/components/List/List.types.d.ts.map +0 -1
- package/types/components/List/index.d.ts +0 -5
- package/types/components/List/index.d.ts.map +0 -1
- package/types/components/List/ui/ListItem.d.ts +0 -4
- package/types/components/List/ui/ListItem.d.ts.map +0 -1
- package/types/components/List/ui/ListItem.styles.d.ts +0 -36
- package/types/components/List/ui/ListItem.styles.d.ts.map +0 -1
- package/types/components/List/ui/ListItem.types.d.ts +0 -15
- package/types/components/List/ui/ListItem.types.d.ts.map +0 -1
- package/types/components/List/variations/_disabled/base.d.ts.map +0 -1
- package/types/components/List/variations/_size/base.d.ts.map +0 -1
- package/types/components/List/variations/_variant/base.d.ts.map +0 -1
- package/types/components/List/variations/_view/base.d.ts.map +0 -1
- /package/emotion/cjs/components/{List/List.types.js → CodeField/CodeField.types.js} +0 -0
- /package/emotion/es/components/{List/List.types.js → CodeField/CodeField.types.js} +0 -0
- /package/{emotion/cjs/components/List/ui/ListItem.types.js → styled-components/cjs/components/CodeField/CodeField.types.js} +0 -0
- /package/{emotion/es/components/List/ui/ListItem.types.js → styled-components/es/components/CodeField/CodeField.types.js} +0 -0
- /package/types/components/{List → CodeField}/variations/_disabled/base.d.ts +0 -0
- /package/types/components/{List/variations/_size → CodeField/variations/_shape}/base.d.ts +0 -0
- /package/types/components/{List/variations/_variant → CodeField/variations/_size}/base.d.ts +0 -0
- /package/types/components/{List → CodeField}/variations/_view/base.d.ts +0 -0
package/emotion/cjs/index.js
CHANGED
@@ -784,17 +784,6 @@ Object.keys(_Table).forEach(function (key) {
|
|
784
784
|
}
|
785
785
|
});
|
786
786
|
});
|
787
|
-
var _List = /*#__PURE__*/require("./components/List");
|
788
|
-
Object.keys(_List).forEach(function (key) {
|
789
|
-
if (key === "default" || key === "__esModule") return;
|
790
|
-
if (key in exports && exports[key] === _List[key]) return;
|
791
|
-
Object.defineProperty(exports, key, {
|
792
|
-
enumerable: true,
|
793
|
-
get: function get() {
|
794
|
-
return _List[key];
|
795
|
-
}
|
796
|
-
});
|
797
|
-
});
|
798
787
|
var _LinkButton = /*#__PURE__*/require("./components/LinkButton");
|
799
788
|
Object.keys(_LinkButton).forEach(function (key) {
|
800
789
|
if (key === "default" || key === "__esModule") return;
|
@@ -849,4 +838,15 @@ Object.keys(_PaginationDots).forEach(function (key) {
|
|
849
838
|
return _PaginationDots[key];
|
850
839
|
}
|
851
840
|
});
|
841
|
+
});
|
842
|
+
var _CodeField = /*#__PURE__*/require("./components/CodeField");
|
843
|
+
Object.keys(_CodeField).forEach(function (key) {
|
844
|
+
if (key === "default" || key === "__esModule") return;
|
845
|
+
if (key in exports && exports[key] === _CodeField[key]) return;
|
846
|
+
Object.defineProperty(exports, key, {
|
847
|
+
enumerable: true,
|
848
|
+
get: function get() {
|
849
|
+
return _CodeField[key];
|
850
|
+
}
|
851
|
+
});
|
852
852
|
});
|
@@ -0,0 +1,290 @@
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
2
|
+
var _Separator;
|
3
|
+
var _excluded = ["className", "value", "placeholder", "autoFocus", "codeLength", "caption", "captionAlign", "width", "shape", "view", "size", "disabled", "isError", "allowedSymbols", "itemErrorBehavior", "codeErrorBehavior", "autoComplete", "setIsError", "onChange", "onFullCodeEnter"];
|
4
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
5
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
7
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
8
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
9
|
+
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."); }
|
10
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
11
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
12
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
13
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
14
|
+
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; } }
|
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
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
17
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
18
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
19
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
20
|
+
import React, { forwardRef, Fragment, useCallback, useEffect, useRef, useState } from 'react';
|
21
|
+
import cls from 'classnames';
|
22
|
+
import { useDidMountEffect } from "../../hooks";
|
23
|
+
import { getSizeValueFromProp } from "../../utils";
|
24
|
+
import { BACKSPACE_KEY, FORBIDDEN_KEYS, ONLY_DIGITS_PATTERN } from "./utils/constants";
|
25
|
+
import { getCodeValue, getFieldPattern, getPlaceholderValue, handleCodeError, handleItemError } from "./utils";
|
26
|
+
import { classes } from "./CodeField.tokens";
|
27
|
+
import { base, CaptionWrapper, CodeGroup, CodeWrapper, ItemInput, Separator } from "./CodeField.styles";
|
28
|
+
import { base as viewCSS } from "./variations/_view/base";
|
29
|
+
import { base as sizeCSS } from "./variations/_size/base";
|
30
|
+
import { base as shapeCSS } from "./variations/_shape/base";
|
31
|
+
import { base as disabledCSS } from "./variations/_disabled/base";
|
32
|
+
export var codeFieldRoot = function codeFieldRoot(Root) {
|
33
|
+
return /*#__PURE__*/forwardRef(function (_ref, ref) {
|
34
|
+
var className = _ref.className,
|
35
|
+
outerValue = _ref.value,
|
36
|
+
placeholder = _ref.placeholder,
|
37
|
+
autoFocus = _ref.autoFocus,
|
38
|
+
_ref$codeLength = _ref.codeLength,
|
39
|
+
codeLength = _ref$codeLength === void 0 ? 6 : _ref$codeLength,
|
40
|
+
caption = _ref.caption,
|
41
|
+
_ref$captionAlign = _ref.captionAlign,
|
42
|
+
captionAlign = _ref$captionAlign === void 0 ? 'left' : _ref$captionAlign,
|
43
|
+
width = _ref.width,
|
44
|
+
_ref$shape = _ref.shape,
|
45
|
+
shape = _ref$shape === void 0 ? 'default' : _ref$shape,
|
46
|
+
view = _ref.view,
|
47
|
+
size = _ref.size,
|
48
|
+
disabled = _ref.disabled,
|
49
|
+
isError = _ref.isError,
|
50
|
+
_ref$allowedSymbols = _ref.allowedSymbols,
|
51
|
+
allowedSymbols = _ref$allowedSymbols === void 0 ? ONLY_DIGITS_PATTERN : _ref$allowedSymbols,
|
52
|
+
_ref$itemErrorBehavio = _ref.itemErrorBehavior,
|
53
|
+
itemErrorBehavior = _ref$itemErrorBehavio === void 0 ? 'remove-symbol' : _ref$itemErrorBehavio,
|
54
|
+
_ref$codeErrorBehavio = _ref.codeErrorBehavior,
|
55
|
+
codeErrorBehavior = _ref$codeErrorBehavio === void 0 ? 'remove-code' : _ref$codeErrorBehavio,
|
56
|
+
_ref$autoComplete = _ref.autoComplete,
|
57
|
+
autoComplete = _ref$autoComplete === void 0 ? 'one-time-code' : _ref$autoComplete,
|
58
|
+
setIsError = _ref.setIsError,
|
59
|
+
onChange = _ref.onChange,
|
60
|
+
onFullCodeEnter = _ref.onFullCodeEnter,
|
61
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
62
|
+
var _useState = useState(getCodeValue(codeLength, outerValue || '')),
|
63
|
+
_useState2 = _slicedToArray(_useState, 2),
|
64
|
+
code = _useState2[0],
|
65
|
+
setCode = _useState2[1];
|
66
|
+
var _useState3 = useState(code.join('')),
|
67
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
68
|
+
originalValue = _useState4[0],
|
69
|
+
setOriginalValue = _useState4[1];
|
70
|
+
var inputRefs = useRef([]);
|
71
|
+
var inputContainerRef = useRef(null);
|
72
|
+
var captionRef = useRef(null);
|
73
|
+
var fieldPattern = getFieldPattern(allowedSymbols);
|
74
|
+
var placeholderValue = getPlaceholderValue(codeLength, placeholder);
|
75
|
+
var parts = codeLength === 6 ? 2 : 1;
|
76
|
+
var widthValue = width ? getSizeValueFromProp(width, 'rem') : undefined;
|
77
|
+
var getLastActiveIndex = function getLastActiveIndex() {
|
78
|
+
if (code.length && code.length < codeLength) {
|
79
|
+
return code.length;
|
80
|
+
}
|
81
|
+
var lastEmptyIndex = code.findIndex(function (digit) {
|
82
|
+
return digit === '';
|
83
|
+
});
|
84
|
+
return lastEmptyIndex >= 0 ? lastEmptyIndex : codeLength - 1;
|
85
|
+
};
|
86
|
+
var handleClick = function handleClick() {
|
87
|
+
if (disabled) {
|
88
|
+
return;
|
89
|
+
}
|
90
|
+
var lastActiveIndex = getLastActiveIndex();
|
91
|
+
if (inputRefs.current[lastActiveIndex]) {
|
92
|
+
inputRefs.current[lastActiveIndex].focus();
|
93
|
+
}
|
94
|
+
};
|
95
|
+
var handleOnKeyDown = function handleOnKeyDown(event, index) {
|
96
|
+
if (disabled) {
|
97
|
+
return;
|
98
|
+
}
|
99
|
+
var key = event.key;
|
100
|
+
if (FORBIDDEN_KEYS.includes(key)) {
|
101
|
+
event.preventDefault();
|
102
|
+
return;
|
103
|
+
}
|
104
|
+
if (key === BACKSPACE_KEY) {
|
105
|
+
if (index > 0 && code[index] === '') {
|
106
|
+
var _inputRefs$current;
|
107
|
+
(_inputRefs$current = inputRefs.current[index - 1]) === null || _inputRefs$current === void 0 || _inputRefs$current.focus();
|
108
|
+
}
|
109
|
+
}
|
110
|
+
};
|
111
|
+
var codeSetter = function codeSetter(newCode) {
|
112
|
+
setCode(newCode);
|
113
|
+
setOriginalValue(newCode.join(''));
|
114
|
+
if (onChange) {
|
115
|
+
onChange(newCode.join(''));
|
116
|
+
}
|
117
|
+
};
|
118
|
+
var handleChange = function handleChange(event, index) {
|
119
|
+
var _inputRefs$current$in;
|
120
|
+
if (disabled) {
|
121
|
+
return;
|
122
|
+
}
|
123
|
+
var rawSymbol = event.currentTarget.value;
|
124
|
+
var symbol = rawSymbol.charAt(rawSymbol.length - 1);
|
125
|
+
var newCode = _toConsumableArray(code);
|
126
|
+
(_inputRefs$current$in = inputRefs.current[index]) === null || _inputRefs$current$in === void 0 || _inputRefs$current$in.classList.remove(classes.itemError);
|
127
|
+
if (isError) {
|
128
|
+
var _captionRef$current;
|
129
|
+
(_captionRef$current = captionRef.current) === null || _captionRef$current === void 0 || _captionRef$current.classList.remove(classes.captionError);
|
130
|
+
if (codeErrorBehavior === 'keep') {
|
131
|
+
var _inputContainerRef$cu;
|
132
|
+
(_inputContainerRef$cu = inputContainerRef.current) === null || _inputContainerRef$cu === void 0 || _inputContainerRef$cu.classList.remove(classes.codeError, classes.codeErrorAnimation);
|
133
|
+
}
|
134
|
+
if (setIsError) {
|
135
|
+
setIsError(false);
|
136
|
+
}
|
137
|
+
}
|
138
|
+
if (!fieldPattern) {
|
139
|
+
newCode[index] = symbol;
|
140
|
+
codeSetter(newCode);
|
141
|
+
if (symbol && index < codeLength - 1) {
|
142
|
+
var _inputRefs$current2;
|
143
|
+
(_inputRefs$current2 = inputRefs.current[index + 1]) === null || _inputRefs$current2 === void 0 || _inputRefs$current2.focus();
|
144
|
+
}
|
145
|
+
return;
|
146
|
+
}
|
147
|
+
if (!symbol) {
|
148
|
+
newCode[index] = '';
|
149
|
+
codeSetter(newCode);
|
150
|
+
return;
|
151
|
+
}
|
152
|
+
if (fieldPattern.test(symbol)) {
|
153
|
+
newCode[index] = symbol.charAt(symbol.length - 1);
|
154
|
+
codeSetter(newCode);
|
155
|
+
if (index < codeLength - 1) {
|
156
|
+
var _inputRefs$current3;
|
157
|
+
(_inputRefs$current3 = inputRefs.current[index + 1]) === null || _inputRefs$current3 === void 0 || _inputRefs$current3.focus();
|
158
|
+
}
|
159
|
+
} else {
|
160
|
+
newCode[index] = symbol.charAt(symbol.length - 1);
|
161
|
+
handleItemError({
|
162
|
+
currentSymbol: symbol,
|
163
|
+
itemErrorBehavior: itemErrorBehavior,
|
164
|
+
index: index,
|
165
|
+
newCode: newCode,
|
166
|
+
inputRefs: inputRefs,
|
167
|
+
setCode: setCode,
|
168
|
+
codeSetter: codeSetter
|
169
|
+
});
|
170
|
+
}
|
171
|
+
};
|
172
|
+
var handlePaste = function handlePaste(event) {
|
173
|
+
var _inputRefs$current$ac;
|
174
|
+
if (disabled) {
|
175
|
+
return;
|
176
|
+
}
|
177
|
+
event.preventDefault();
|
178
|
+
var rawData = event.clipboardData.getData('text/plain');
|
179
|
+
var pastedData = (fieldPattern ? rawData.split('').map(function (symb) {
|
180
|
+
var _symb$match;
|
181
|
+
return ((_symb$match = symb.match(fieldPattern)) === null || _symb$match === void 0 ? void 0 : _symb$match[0]) || '';
|
182
|
+
}).filter(Boolean) || [] : rawData.split('')).slice(0, codeLength);
|
183
|
+
var activeIndex = Math.min(pastedData.length, codeLength - 1);
|
184
|
+
(_inputRefs$current$ac = inputRefs.current[activeIndex]) === null || _inputRefs$current$ac === void 0 || _inputRefs$current$ac.focus();
|
185
|
+
codeSetter(pastedData);
|
186
|
+
};
|
187
|
+
var handleFullCodeEnter = useCallback(function (fullCode) {
|
188
|
+
if (onFullCodeEnter) {
|
189
|
+
onFullCodeEnter(fullCode);
|
190
|
+
}
|
191
|
+
}, []);
|
192
|
+
useEffect(function () {
|
193
|
+
inputRefs.current = inputRefs.current.slice(0, codeLength);
|
194
|
+
}, [codeLength]);
|
195
|
+
useEffect(function () {
|
196
|
+
if (autoFocus && !disabled) {
|
197
|
+
var _inputRefs$current$la;
|
198
|
+
var lastActiveIndex = getLastActiveIndex();
|
199
|
+
(_inputRefs$current$la = inputRefs.current[lastActiveIndex]) === null || _inputRefs$current$la === void 0 || _inputRefs$current$la.focus();
|
200
|
+
}
|
201
|
+
}, [autoFocus]);
|
202
|
+
useDidMountEffect(function () {
|
203
|
+
if (handleFullCodeEnter && originalValue.length === codeLength) {
|
204
|
+
handleFullCodeEnter(originalValue);
|
205
|
+
}
|
206
|
+
}, [originalValue, handleFullCodeEnter]);
|
207
|
+
useDidMountEffect(function () {
|
208
|
+
if (isError) {
|
209
|
+
handleCodeError({
|
210
|
+
codeLength: codeLength,
|
211
|
+
codeErrorBehavior: codeErrorBehavior,
|
212
|
+
currentCode: code,
|
213
|
+
inputRefs: inputRefs,
|
214
|
+
inputContainerRef: inputContainerRef,
|
215
|
+
captionRef: captionRef,
|
216
|
+
setCode: setCode,
|
217
|
+
codeSetter: codeSetter
|
218
|
+
});
|
219
|
+
}
|
220
|
+
}, [isError]);
|
221
|
+
return /*#__PURE__*/React.createElement(Root, _extends({
|
222
|
+
ref: ref,
|
223
|
+
view: view,
|
224
|
+
size: size,
|
225
|
+
shape: shape,
|
226
|
+
disabled: disabled,
|
227
|
+
onClick: handleClick,
|
228
|
+
className: cls(className, _defineProperty({}, classes.captionAlignLeft, captionAlign === 'left'))
|
229
|
+
}, rest), /*#__PURE__*/React.createElement(CodeWrapper, {
|
230
|
+
ref: inputContainerRef
|
231
|
+
}, _toConsumableArray(Array(parts)).map(function (_, partIndex) {
|
232
|
+
return /*#__PURE__*/React.createElement(Fragment, {
|
233
|
+
key: partIndex
|
234
|
+
}, /*#__PURE__*/React.createElement(CodeGroup, {
|
235
|
+
role: "group"
|
236
|
+
}, _toConsumableArray(Array(codeLength / parts)).map(function (_, i) {
|
237
|
+
var inputCorrectIndex = i + codeLength / parts * partIndex;
|
238
|
+
return /*#__PURE__*/React.createElement(ItemInput, _extends({
|
239
|
+
key: partIndex + i + partIndex * i,
|
240
|
+
ref: function ref(element) {
|
241
|
+
inputRefs.current[inputCorrectIndex] = element;
|
242
|
+
},
|
243
|
+
className: cls(_defineProperty(_defineProperty({}, classes.segmented, shape === 'segmented'), classes.hoverEnabled, !disabled && inputCorrectIndex >= originalValue.length)),
|
244
|
+
value: code[inputCorrectIndex] || '',
|
245
|
+
autoComplete: autoComplete,
|
246
|
+
onChange: function onChange(e) {
|
247
|
+
handleChange(e, inputCorrectIndex);
|
248
|
+
},
|
249
|
+
onKeyDown: function onKeyDown(e) {
|
250
|
+
handleOnKeyDown(e, inputCorrectIndex);
|
251
|
+
},
|
252
|
+
onPaste: handlePaste,
|
253
|
+
tabIndex: !disabled && originalValue.length === inputCorrectIndex ? 0 : -1
|
254
|
+
}, placeholderValue && {
|
255
|
+
placeholder: placeholderValue[inputCorrectIndex]
|
256
|
+
}));
|
257
|
+
})), partIndex !== parts - 1 && (_Separator || (_Separator = /*#__PURE__*/React.createElement(Separator, null))));
|
258
|
+
})), caption && /*#__PURE__*/React.createElement(CaptionWrapper, {
|
259
|
+
ref: captionRef,
|
260
|
+
captionAlign: captionAlign,
|
261
|
+
widthValue: widthValue
|
262
|
+
}, caption));
|
263
|
+
});
|
264
|
+
};
|
265
|
+
export var codeFieldConfig = {
|
266
|
+
name: 'CodeField',
|
267
|
+
tag: 'div',
|
268
|
+
layout: codeFieldRoot,
|
269
|
+
base: base,
|
270
|
+
variations: {
|
271
|
+
view: {
|
272
|
+
css: viewCSS
|
273
|
+
},
|
274
|
+
size: {
|
275
|
+
css: sizeCSS
|
276
|
+
},
|
277
|
+
shape: {
|
278
|
+
css: shapeCSS
|
279
|
+
},
|
280
|
+
disabled: {
|
281
|
+
css: disabledCSS,
|
282
|
+
attrs: true
|
283
|
+
}
|
284
|
+
},
|
285
|
+
defaults: {
|
286
|
+
size: 'm',
|
287
|
+
view: 'default',
|
288
|
+
shape: 'default'
|
289
|
+
}
|
290
|
+
};
|
@@ -0,0 +1,58 @@
|
|
1
|
+
import _styled from "@emotion/styled/base";
|
2
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
3
|
+
import { css } from '@emotion/react';
|
4
|
+
import { classes, tokens } from "./CodeField.tokens";
|
5
|
+
export var base = /*#__PURE__*/css("display:flex;flex-direction:column;justify-content:center;width:min-content;align-items:center;&.", classes.captionAlignLeft, "{align-items:start;};label:plasma-new-hope__base;" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy1lbW90aW9uL2NvbXBvbmVudHMvQ29kZUZpZWxkL0NvZGVGaWVsZC5zdHlsZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBS3VCIiwiZmlsZSI6Ii4uLy4uLy4uLy4uL3NyYy1lbW90aW9uL2NvbXBvbmVudHMvQ29kZUZpZWxkL0NvZGVGaWVsZC5zdHlsZXMudHMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBjc3MgfSBmcm9tICdAZW1vdGlvbi9yZWFjdCc7XG5pbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCc7XG5cbmltcG9ydCB7IGNsYXNzZXMsIHRva2VucyB9IGZyb20gJy4vQ29kZUZpZWxkLnRva2Vucyc7XG5cbmV4cG9ydCBjb25zdCBiYXNlID0gY3NzYFxuICAgIGRpc3BsYXk6IGZsZXg7XG4gICAgZmxleC1kaXJlY3Rpb246IGNvbHVtbjtcbiAgICBqdXN0aWZ5LWNvbnRlbnQ6IGNlbnRlcjtcbiAgICB3aWR0aDogbWluLWNvbnRlbnQ7XG4gICAgYWxpZ24taXRlbXM6IGNlbnRlcjtcblxuICAgICYuJHtjbGFzc2VzLmNhcHRpb25BbGlnbkxlZnR9IHtcbiAgICAgICAgYWxpZ24taXRlbXM6IHN0YXJ0O1xuICAgIH1cbmA7XG5cbmV4cG9ydCBjb25zdCBDb2RlV3JhcHBlciA9IHN0eWxlZC5kaXZgXG4gICAgZGlzcGxheTogZmxleDtcbiAgICBhbGlnbi1pdGVtczogY2VudGVyO1xuYDtcblxuZXhwb3J0IGNvbnN0IENvZGVHcm91cCA9IHN0eWxlZC5kaXZgXG4gICAgZGlzcGxheTogZmxleDtcbiAgICBhbGlnbi1pdGVtczogY2VudGVyO1xuYDtcblxuZXhwb3J0IGNvbnN0IFNlcGFyYXRvciA9IHN0eWxlZC5kaXZgXG4gICAgd2lkdGg6IHZhcigke3Rva2Vucy5zZXBhcmF0b3JXaWR0aH0pO1xuYDtcblxuZXhwb3J0IGNvbnN0IEl0ZW1JbnB1dCA9IHN0eWxlZC5pbnB1dGBcbiAgICBib3gtc2l6aW5nOiBib3JkZXItYm94O1xuICAgIGFwcGVhcmFuY2U6IG5vbmU7XG4gICAgYm9yZGVyOiAwO1xuICAgIHBhZGRpbmc6IDA7XG4gICAgb3V0bGluZTogbm9uZTtcbiAgICBwb2ludGVyLWV2ZW50czogbm9uZTtcbiAgICB0ZXh0LWFsaWduOiBjZW50ZXI7XG5gO1xuXG5leHBvcnQgY29uc3QgQ2FwdGlvbldyYXBwZXIgPSBzdHlsZWQuZGl2PHsgY2FwdGlvbkFsaWduOiAnbGVmdCcgfCAnY2VudGVyJzsgd2lkdGhWYWx1ZT86IHN0cmluZyB9PmBcbiAgICB0ZXh0LWFsaWduOiAkeyh7IGNhcHRpb25BbGlnbiB9KSA9PiBjYXB0aW9uQWxpZ259O1xuICAgIGFsaWduLXNlbGY6ICR7KHsgY2FwdGlvbkFsaWduIH0pID0+IGNhcHRpb25BbGlnbn07XG4gICAgd2lkdGg6ICR7KHsgd2lkdGhWYWx1ZSB9KSA9PiB3aWR0aFZhbHVlIHx8ICdhdXRvJ307XG4gICAgd2hpdGUtc3BhY2U6IHByZS1saW5lO1xuYDtcbiJdfQ== */"));
|
6
|
+
export var CodeWrapper = /*#__PURE__*/_styled("div", {
|
7
|
+
target: "eytpek44",
|
8
|
+
label: "plasma-new-hope__CodeWrapper"
|
9
|
+
})(process.env.NODE_ENV === "production" ? {
|
10
|
+
name: "s5xdrg",
|
11
|
+
styles: "display:flex;align-items:center"
|
12
|
+
} : {
|
13
|
+
name: "s5xdrg",
|
14
|
+
styles: "display:flex;align-items:center",
|
15
|
+
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy1lbW90aW9uL2NvbXBvbmVudHMvQ29kZUZpZWxkL0NvZGVGaWVsZC5zdHlsZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBaUJxQyIsImZpbGUiOiIuLi8uLi8uLi8uLi9zcmMtZW1vdGlvbi9jb21wb25lbnRzL0NvZGVGaWVsZC9Db2RlRmllbGQuc3R5bGVzLnRzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgY3NzIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnO1xuaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnO1xuXG5pbXBvcnQgeyBjbGFzc2VzLCB0b2tlbnMgfSBmcm9tICcuL0NvZGVGaWVsZC50b2tlbnMnO1xuXG5leHBvcnQgY29uc3QgYmFzZSA9IGNzc2BcbiAgICBkaXNwbGF5OiBmbGV4O1xuICAgIGZsZXgtZGlyZWN0aW9uOiBjb2x1bW47XG4gICAganVzdGlmeS1jb250ZW50OiBjZW50ZXI7XG4gICAgd2lkdGg6IG1pbi1jb250ZW50O1xuICAgIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG5cbiAgICAmLiR7Y2xhc3Nlcy5jYXB0aW9uQWxpZ25MZWZ0fSB7XG4gICAgICAgIGFsaWduLWl0ZW1zOiBzdGFydDtcbiAgICB9XG5gO1xuXG5leHBvcnQgY29uc3QgQ29kZVdyYXBwZXIgPSBzdHlsZWQuZGl2YFxuICAgIGRpc3BsYXk6IGZsZXg7XG4gICAgYWxpZ24taXRlbXM6IGNlbnRlcjtcbmA7XG5cbmV4cG9ydCBjb25zdCBDb2RlR3JvdXAgPSBzdHlsZWQuZGl2YFxuICAgIGRpc3BsYXk6IGZsZXg7XG4gICAgYWxpZ24taXRlbXM6IGNlbnRlcjtcbmA7XG5cbmV4cG9ydCBjb25zdCBTZXBhcmF0b3IgPSBzdHlsZWQuZGl2YFxuICAgIHdpZHRoOiB2YXIoJHt0b2tlbnMuc2VwYXJhdG9yV2lkdGh9KTtcbmA7XG5cbmV4cG9ydCBjb25zdCBJdGVtSW5wdXQgPSBzdHlsZWQuaW5wdXRgXG4gICAgYm94LXNpemluZzogYm9yZGVyLWJveDtcbiAgICBhcHBlYXJhbmNlOiBub25lO1xuICAgIGJvcmRlcjogMDtcbiAgICBwYWRkaW5nOiAwO1xuICAgIG91dGxpbmU6IG5vbmU7XG4gICAgcG9pbnRlci1ldmVudHM6IG5vbmU7XG4gICAgdGV4dC1hbGlnbjogY2VudGVyO1xuYDtcblxuZXhwb3J0IGNvbnN0IENhcHRpb25XcmFwcGVyID0gc3R5bGVkLmRpdjx7IGNhcHRpb25BbGlnbjogJ2xlZnQnIHwgJ2NlbnRlcic7IHdpZHRoVmFsdWU/OiBzdHJpbmcgfT5gXG4gICAgdGV4dC1hbGlnbjogJHsoeyBjYXB0aW9uQWxpZ24gfSkgPT4gY2FwdGlvbkFsaWdufTtcbiAgICBhbGlnbi1zZWxmOiAkeyh7IGNhcHRpb25BbGlnbiB9KSA9PiBjYXB0aW9uQWxpZ259O1xuICAgIHdpZHRoOiAkeyh7IHdpZHRoVmFsdWUgfSkgPT4gd2lkdGhWYWx1ZSB8fCAnYXV0byd9O1xuICAgIHdoaXRlLXNwYWNlOiBwcmUtbGluZTtcbmA7XG4iXX0= */",
|
16
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
17
|
+
});
|
18
|
+
export var CodeGroup = /*#__PURE__*/_styled("div", {
|
19
|
+
target: "eytpek43",
|
20
|
+
label: "plasma-new-hope__CodeGroup"
|
21
|
+
})(process.env.NODE_ENV === "production" ? {
|
22
|
+
name: "s5xdrg",
|
23
|
+
styles: "display:flex;align-items:center"
|
24
|
+
} : {
|
25
|
+
name: "s5xdrg",
|
26
|
+
styles: "display:flex;align-items:center",
|
27
|
+
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy1lbW90aW9uL2NvbXBvbmVudHMvQ29kZUZpZWxkL0NvZGVGaWVsZC5zdHlsZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBc0JtQyIsImZpbGUiOiIuLi8uLi8uLi8uLi9zcmMtZW1vdGlvbi9jb21wb25lbnRzL0NvZGVGaWVsZC9Db2RlRmllbGQuc3R5bGVzLnRzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgY3NzIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnO1xuaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnO1xuXG5pbXBvcnQgeyBjbGFzc2VzLCB0b2tlbnMgfSBmcm9tICcuL0NvZGVGaWVsZC50b2tlbnMnO1xuXG5leHBvcnQgY29uc3QgYmFzZSA9IGNzc2BcbiAgICBkaXNwbGF5OiBmbGV4O1xuICAgIGZsZXgtZGlyZWN0aW9uOiBjb2x1bW47XG4gICAganVzdGlmeS1jb250ZW50OiBjZW50ZXI7XG4gICAgd2lkdGg6IG1pbi1jb250ZW50O1xuICAgIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG5cbiAgICAmLiR7Y2xhc3Nlcy5jYXB0aW9uQWxpZ25MZWZ0fSB7XG4gICAgICAgIGFsaWduLWl0ZW1zOiBzdGFydDtcbiAgICB9XG5gO1xuXG5leHBvcnQgY29uc3QgQ29kZVdyYXBwZXIgPSBzdHlsZWQuZGl2YFxuICAgIGRpc3BsYXk6IGZsZXg7XG4gICAgYWxpZ24taXRlbXM6IGNlbnRlcjtcbmA7XG5cbmV4cG9ydCBjb25zdCBDb2RlR3JvdXAgPSBzdHlsZWQuZGl2YFxuICAgIGRpc3BsYXk6IGZsZXg7XG4gICAgYWxpZ24taXRlbXM6IGNlbnRlcjtcbmA7XG5cbmV4cG9ydCBjb25zdCBTZXBhcmF0b3IgPSBzdHlsZWQuZGl2YFxuICAgIHdpZHRoOiB2YXIoJHt0b2tlbnMuc2VwYXJhdG9yV2lkdGh9KTtcbmA7XG5cbmV4cG9ydCBjb25zdCBJdGVtSW5wdXQgPSBzdHlsZWQuaW5wdXRgXG4gICAgYm94LXNpemluZzogYm9yZGVyLWJveDtcbiAgICBhcHBlYXJhbmNlOiBub25lO1xuICAgIGJvcmRlcjogMDtcbiAgICBwYWRkaW5nOiAwO1xuICAgIG91dGxpbmU6IG5vbmU7XG4gICAgcG9pbnRlci1ldmVudHM6IG5vbmU7XG4gICAgdGV4dC1hbGlnbjogY2VudGVyO1xuYDtcblxuZXhwb3J0IGNvbnN0IENhcHRpb25XcmFwcGVyID0gc3R5bGVkLmRpdjx7IGNhcHRpb25BbGlnbjogJ2xlZnQnIHwgJ2NlbnRlcic7IHdpZHRoVmFsdWU/OiBzdHJpbmcgfT5gXG4gICAgdGV4dC1hbGlnbjogJHsoeyBjYXB0aW9uQWxpZ24gfSkgPT4gY2FwdGlvbkFsaWdufTtcbiAgICBhbGlnbi1zZWxmOiAkeyh7IGNhcHRpb25BbGlnbiB9KSA9PiBjYXB0aW9uQWxpZ259O1xuICAgIHdpZHRoOiAkeyh7IHdpZHRoVmFsdWUgfSkgPT4gd2lkdGhWYWx1ZSB8fCAnYXV0byd9O1xuICAgIHdoaXRlLXNwYWNlOiBwcmUtbGluZTtcbmA7XG4iXX0= */",
|
28
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
29
|
+
});
|
30
|
+
export var Separator = /*#__PURE__*/_styled("div", {
|
31
|
+
target: "eytpek42",
|
32
|
+
label: "plasma-new-hope__Separator"
|
33
|
+
})("width:var(", tokens.separatorWidth, ");" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy1lbW90aW9uL2NvbXBvbmVudHMvQ29kZUZpZWxkL0NvZGVGaWVsZC5zdHlsZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBMkJtQyIsImZpbGUiOiIuLi8uLi8uLi8uLi9zcmMtZW1vdGlvbi9jb21wb25lbnRzL0NvZGVGaWVsZC9Db2RlRmllbGQuc3R5bGVzLnRzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgY3NzIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnO1xuaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnO1xuXG5pbXBvcnQgeyBjbGFzc2VzLCB0b2tlbnMgfSBmcm9tICcuL0NvZGVGaWVsZC50b2tlbnMnO1xuXG5leHBvcnQgY29uc3QgYmFzZSA9IGNzc2BcbiAgICBkaXNwbGF5OiBmbGV4O1xuICAgIGZsZXgtZGlyZWN0aW9uOiBjb2x1bW47XG4gICAganVzdGlmeS1jb250ZW50OiBjZW50ZXI7XG4gICAgd2lkdGg6IG1pbi1jb250ZW50O1xuICAgIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG5cbiAgICAmLiR7Y2xhc3Nlcy5jYXB0aW9uQWxpZ25MZWZ0fSB7XG4gICAgICAgIGFsaWduLWl0ZW1zOiBzdGFydDtcbiAgICB9XG5gO1xuXG5leHBvcnQgY29uc3QgQ29kZVdyYXBwZXIgPSBzdHlsZWQuZGl2YFxuICAgIGRpc3BsYXk6IGZsZXg7XG4gICAgYWxpZ24taXRlbXM6IGNlbnRlcjtcbmA7XG5cbmV4cG9ydCBjb25zdCBDb2RlR3JvdXAgPSBzdHlsZWQuZGl2YFxuICAgIGRpc3BsYXk6IGZsZXg7XG4gICAgYWxpZ24taXRlbXM6IGNlbnRlcjtcbmA7XG5cbmV4cG9ydCBjb25zdCBTZXBhcmF0b3IgPSBzdHlsZWQuZGl2YFxuICAgIHdpZHRoOiB2YXIoJHt0b2tlbnMuc2VwYXJhdG9yV2lkdGh9KTtcbmA7XG5cbmV4cG9ydCBjb25zdCBJdGVtSW5wdXQgPSBzdHlsZWQuaW5wdXRgXG4gICAgYm94LXNpemluZzogYm9yZGVyLWJveDtcbiAgICBhcHBlYXJhbmNlOiBub25lO1xuICAgIGJvcmRlcjogMDtcbiAgICBwYWRkaW5nOiAwO1xuICAgIG91dGxpbmU6IG5vbmU7XG4gICAgcG9pbnRlci1ldmVudHM6IG5vbmU7XG4gICAgdGV4dC1hbGlnbjogY2VudGVyO1xuYDtcblxuZXhwb3J0IGNvbnN0IENhcHRpb25XcmFwcGVyID0gc3R5bGVkLmRpdjx7IGNhcHRpb25BbGlnbjogJ2xlZnQnIHwgJ2NlbnRlcic7IHdpZHRoVmFsdWU/OiBzdHJpbmcgfT5gXG4gICAgdGV4dC1hbGlnbjogJHsoeyBjYXB0aW9uQWxpZ24gfSkgPT4gY2FwdGlvbkFsaWdufTtcbiAgICBhbGlnbi1zZWxmOiAkeyh7IGNhcHRpb25BbGlnbiB9KSA9PiBjYXB0aW9uQWxpZ259O1xuICAgIHdpZHRoOiAkeyh7IHdpZHRoVmFsdWUgfSkgPT4gd2lkdGhWYWx1ZSB8fCAnYXV0byd9O1xuICAgIHdoaXRlLXNwYWNlOiBwcmUtbGluZTtcbmA7XG4iXX0= */"));
|
34
|
+
export var ItemInput = /*#__PURE__*/_styled("input", {
|
35
|
+
target: "eytpek41",
|
36
|
+
label: "plasma-new-hope__ItemInput"
|
37
|
+
})(process.env.NODE_ENV === "production" ? {
|
38
|
+
name: "1bnqsy",
|
39
|
+
styles: "box-sizing:border-box;appearance:none;border:0;padding:0;outline:none;pointer-events:none;text-align:center"
|
40
|
+
} : {
|
41
|
+
name: "1bnqsy",
|
42
|
+
styles: "box-sizing:border-box;appearance:none;border:0;padding:0;outline:none;pointer-events:none;text-align:center",
|
43
|
+
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy1lbW90aW9uL2NvbXBvbmVudHMvQ29kZUZpZWxkL0NvZGVGaWVsZC5zdHlsZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBK0JxQyIsImZpbGUiOiIuLi8uLi8uLi8uLi9zcmMtZW1vdGlvbi9jb21wb25lbnRzL0NvZGVGaWVsZC9Db2RlRmllbGQuc3R5bGVzLnRzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgY3NzIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnO1xuaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnO1xuXG5pbXBvcnQgeyBjbGFzc2VzLCB0b2tlbnMgfSBmcm9tICcuL0NvZGVGaWVsZC50b2tlbnMnO1xuXG5leHBvcnQgY29uc3QgYmFzZSA9IGNzc2BcbiAgICBkaXNwbGF5OiBmbGV4O1xuICAgIGZsZXgtZGlyZWN0aW9uOiBjb2x1bW47XG4gICAganVzdGlmeS1jb250ZW50OiBjZW50ZXI7XG4gICAgd2lkdGg6IG1pbi1jb250ZW50O1xuICAgIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG5cbiAgICAmLiR7Y2xhc3Nlcy5jYXB0aW9uQWxpZ25MZWZ0fSB7XG4gICAgICAgIGFsaWduLWl0ZW1zOiBzdGFydDtcbiAgICB9XG5gO1xuXG5leHBvcnQgY29uc3QgQ29kZVdyYXBwZXIgPSBzdHlsZWQuZGl2YFxuICAgIGRpc3BsYXk6IGZsZXg7XG4gICAgYWxpZ24taXRlbXM6IGNlbnRlcjtcbmA7XG5cbmV4cG9ydCBjb25zdCBDb2RlR3JvdXAgPSBzdHlsZWQuZGl2YFxuICAgIGRpc3BsYXk6IGZsZXg7XG4gICAgYWxpZ24taXRlbXM6IGNlbnRlcjtcbmA7XG5cbmV4cG9ydCBjb25zdCBTZXBhcmF0b3IgPSBzdHlsZWQuZGl2YFxuICAgIHdpZHRoOiB2YXIoJHt0b2tlbnMuc2VwYXJhdG9yV2lkdGh9KTtcbmA7XG5cbmV4cG9ydCBjb25zdCBJdGVtSW5wdXQgPSBzdHlsZWQuaW5wdXRgXG4gICAgYm94LXNpemluZzogYm9yZGVyLWJveDtcbiAgICBhcHBlYXJhbmNlOiBub25lO1xuICAgIGJvcmRlcjogMDtcbiAgICBwYWRkaW5nOiAwO1xuICAgIG91dGxpbmU6IG5vbmU7XG4gICAgcG9pbnRlci1ldmVudHM6IG5vbmU7XG4gICAgdGV4dC1hbGlnbjogY2VudGVyO1xuYDtcblxuZXhwb3J0IGNvbnN0IENhcHRpb25XcmFwcGVyID0gc3R5bGVkLmRpdjx7IGNhcHRpb25BbGlnbjogJ2xlZnQnIHwgJ2NlbnRlcic7IHdpZHRoVmFsdWU/OiBzdHJpbmcgfT5gXG4gICAgdGV4dC1hbGlnbjogJHsoeyBjYXB0aW9uQWxpZ24gfSkgPT4gY2FwdGlvbkFsaWdufTtcbiAgICBhbGlnbi1zZWxmOiAkeyh7IGNhcHRpb25BbGlnbiB9KSA9PiBjYXB0aW9uQWxpZ259O1xuICAgIHdpZHRoOiAkeyh7IHdpZHRoVmFsdWUgfSkgPT4gd2lkdGhWYWx1ZSB8fCAnYXV0byd9O1xuICAgIHdoaXRlLXNwYWNlOiBwcmUtbGluZTtcbmA7XG4iXX0= */",
|
44
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
45
|
+
});
|
46
|
+
export var CaptionWrapper = /*#__PURE__*/_styled("div", {
|
47
|
+
target: "eytpek40",
|
48
|
+
label: "plasma-new-hope__CaptionWrapper"
|
49
|
+
})("text-align:", function (_ref) {
|
50
|
+
var captionAlign = _ref.captionAlign;
|
51
|
+
return captionAlign;
|
52
|
+
}, ";align-self:", function (_ref2) {
|
53
|
+
var captionAlign = _ref2.captionAlign;
|
54
|
+
return captionAlign;
|
55
|
+
}, ";width:", function (_ref3) {
|
56
|
+
var widthValue = _ref3.widthValue;
|
57
|
+
return widthValue || 'auto';
|
58
|
+
}, ";white-space:pre-line;" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy1lbW90aW9uL2NvbXBvbmVudHMvQ29kZUZpZWxkL0NvZGVGaWVsZC5zdHlsZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBeUNrRyIsImZpbGUiOiIuLi8uLi8uLi8uLi9zcmMtZW1vdGlvbi9jb21wb25lbnRzL0NvZGVGaWVsZC9Db2RlRmllbGQuc3R5bGVzLnRzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgY3NzIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnO1xuaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnO1xuXG5pbXBvcnQgeyBjbGFzc2VzLCB0b2tlbnMgfSBmcm9tICcuL0NvZGVGaWVsZC50b2tlbnMnO1xuXG5leHBvcnQgY29uc3QgYmFzZSA9IGNzc2BcbiAgICBkaXNwbGF5OiBmbGV4O1xuICAgIGZsZXgtZGlyZWN0aW9uOiBjb2x1bW47XG4gICAganVzdGlmeS1jb250ZW50OiBjZW50ZXI7XG4gICAgd2lkdGg6IG1pbi1jb250ZW50O1xuICAgIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG5cbiAgICAmLiR7Y2xhc3Nlcy5jYXB0aW9uQWxpZ25MZWZ0fSB7XG4gICAgICAgIGFsaWduLWl0ZW1zOiBzdGFydDtcbiAgICB9XG5gO1xuXG5leHBvcnQgY29uc3QgQ29kZVdyYXBwZXIgPSBzdHlsZWQuZGl2YFxuICAgIGRpc3BsYXk6IGZsZXg7XG4gICAgYWxpZ24taXRlbXM6IGNlbnRlcjtcbmA7XG5cbmV4cG9ydCBjb25zdCBDb2RlR3JvdXAgPSBzdHlsZWQuZGl2YFxuICAgIGRpc3BsYXk6IGZsZXg7XG4gICAgYWxpZ24taXRlbXM6IGNlbnRlcjtcbmA7XG5cbmV4cG9ydCBjb25zdCBTZXBhcmF0b3IgPSBzdHlsZWQuZGl2YFxuICAgIHdpZHRoOiB2YXIoJHt0b2tlbnMuc2VwYXJhdG9yV2lkdGh9KTtcbmA7XG5cbmV4cG9ydCBjb25zdCBJdGVtSW5wdXQgPSBzdHlsZWQuaW5wdXRgXG4gICAgYm94LXNpemluZzogYm9yZGVyLWJveDtcbiAgICBhcHBlYXJhbmNlOiBub25lO1xuICAgIGJvcmRlcjogMDtcbiAgICBwYWRkaW5nOiAwO1xuICAgIG91dGxpbmU6IG5vbmU7XG4gICAgcG9pbnRlci1ldmVudHM6IG5vbmU7XG4gICAgdGV4dC1hbGlnbjogY2VudGVyO1xuYDtcblxuZXhwb3J0IGNvbnN0IENhcHRpb25XcmFwcGVyID0gc3R5bGVkLmRpdjx7IGNhcHRpb25BbGlnbjogJ2xlZnQnIHwgJ2NlbnRlcic7IHdpZHRoVmFsdWU/OiBzdHJpbmcgfT5gXG4gICAgdGV4dC1hbGlnbjogJHsoeyBjYXB0aW9uQWxpZ24gfSkgPT4gY2FwdGlvbkFsaWdufTtcbiAgICBhbGlnbi1zZWxmOiAkeyh7IGNhcHRpb25BbGlnbiB9KSA9PiBjYXB0aW9uQWxpZ259O1xuICAgIHdpZHRoOiAkeyh7IHdpZHRoVmFsdWUgfSkgPT4gd2lkdGhWYWx1ZSB8fCAnYXV0byd9O1xuICAgIHdoaXRlLXNwYWNlOiBwcmUtbGluZTtcbmA7XG4iXX0= */"));
|
@@ -0,0 +1,150 @@
|
|
1
|
+
---
|
2
|
+
id: codefield
|
3
|
+
title: CodeField
|
4
|
+
---
|
5
|
+
|
6
|
+
import { PropsTable, Description } from '@site/src/components';
|
7
|
+
|
8
|
+
# CodeField
|
9
|
+
Компонент `CodeField` используется для ввода OTP-кодов.
|
10
|
+
|
11
|
+
<Description name="CodeField" />
|
12
|
+
<PropsTable name="CodeField" />
|
13
|
+
|
14
|
+
## Примеры
|
15
|
+
|
16
|
+
### Размер
|
17
|
+
Размер задается с помощью свойства `size`.
|
18
|
+
Ширина компонента так же может регулироваться при помощи свойства `width`:
|
19
|
+
|
20
|
+
```tsx live
|
21
|
+
import React from 'react';
|
22
|
+
import { CodeField } from '@salutejs/{{ package }}';
|
23
|
+
|
24
|
+
export function App() {
|
25
|
+
return (
|
26
|
+
<div style=\{{ flexDirection: 'column', gap: '2rem' }}>
|
27
|
+
<CodeField
|
28
|
+
size="l"
|
29
|
+
caption="Осталось попыток: 4"
|
30
|
+
captionAlign="center"
|
31
|
+
/>
|
32
|
+
<CodeField
|
33
|
+
size="m"
|
34
|
+
caption="Чтобы выслать вам код повторно подождите: 20 секунд"
|
35
|
+
captionAlign="left"
|
36
|
+
/>
|
37
|
+
<CodeField
|
38
|
+
width="25"
|
39
|
+
caption="Не передавайте никому код из СМС. Иначе ваш аккаунт могут взломать"
|
40
|
+
captionAlign="center"
|
41
|
+
/>
|
42
|
+
</div>
|
43
|
+
);
|
44
|
+
}
|
45
|
+
```
|
46
|
+
|
47
|
+
### Форма компонента и длина кода
|
48
|
+
Форма компонента задается с помощью свойства `shape`, а длина кода с помощью `codeLength`:
|
49
|
+
|
50
|
+
```tsx live
|
51
|
+
import React from 'react';
|
52
|
+
import { CodeField } from '@salutejs/{{ package }}';
|
53
|
+
|
54
|
+
export function App() {
|
55
|
+
return (
|
56
|
+
<div style=\{{ flexDirection: 'column', gap: '2rem' }}>
|
57
|
+
<div style=\{{ display: 'flex', gap: '2rem' }}>
|
58
|
+
<CodeField shape="default" codeLength={4} />
|
59
|
+
<CodeField shape="segmented" codeLength={4} />
|
60
|
+
</div>
|
61
|
+
<div style=\{{ display: 'flex', gap: '2rem' }}>
|
62
|
+
<CodeField shape="default" codeLength={5} />
|
63
|
+
<CodeField shape="segmented" codeLength={5} />
|
64
|
+
</div>
|
65
|
+
<div style=\{{ display: 'flex', gap: '2rem' }}>
|
66
|
+
<CodeField shape="default" codeLength={6} />
|
67
|
+
<CodeField shape="segmented" codeLength={6} />
|
68
|
+
</div>
|
69
|
+
</div>
|
70
|
+
);
|
71
|
+
}
|
72
|
+
```
|
73
|
+
|
74
|
+
### Допустимые символы и поведение ячейки при вводе некорректного символа
|
75
|
+
За допустимые символы для ввода отвечает свойство `allowedSymbols`. Задается строкой или регулярным выражением.
|
76
|
+
Библиотека экспортирует наиболее используемые вариации допустимых символов:
|
77
|
+
`import { ONLY_DIGITS_PATTERN, ONLY_CHARS_PATTERN, ONLY_DIGITS_AND_CHARS_PATTERN } from '@salutejs/{{ package }}';`
|
78
|
+
|
79
|
+
Поведение ячейки при вводе некорректного символа регулируется свойством `itemErrorBehavior`:
|
80
|
+
|
81
|
+
```tsx live
|
82
|
+
import React from 'react';
|
83
|
+
import { CodeField } from '@salutejs/{{ package }}';
|
84
|
+
|
85
|
+
export function App() {
|
86
|
+
return (
|
87
|
+
<div>
|
88
|
+
<CodeField value="123" itemErrorBehavior="remove-symbol" />
|
89
|
+
<CodeField value="123" itemErrorBehavior="keep" />
|
90
|
+
<CodeField value="123" itemErrorBehavior="forbid-enter" />
|
91
|
+
</div>
|
92
|
+
);
|
93
|
+
}
|
94
|
+
```
|
95
|
+
|
96
|
+
### Поведение компонента при вводе некорректного кода и индикация ошибки
|
97
|
+
При заполнении всех полей ввода срабатывает колбэк `onFullCodeEnter`.
|
98
|
+
При неверном вводе кода, поведние компонента управляется с помощью свойства `codeErrorBehavior`.
|
99
|
+
Индикация ошибки происходит с помощью флага `isError` и колбека `setIsError`:
|
100
|
+
|
101
|
+
```tsx live
|
102
|
+
import React, { useState, useRef, Dispatch, SetStateAction } from 'react';
|
103
|
+
import { CodeField } from '@salutejs/{{ package }}';
|
104
|
+
|
105
|
+
export function App() {
|
106
|
+
const [disabledFirst, setDisabledFirst] = useState(false);
|
107
|
+
const [isErrorFirst, setIsErrorFirst] = useState(false);
|
108
|
+
|
109
|
+
const [disabledSecond, setDisabledSecond] = useState(false);
|
110
|
+
const [isErrorSecond, setIsErrorSecond] = useState(false);
|
111
|
+
|
112
|
+
const onFullCodeEnter = (
|
113
|
+
code: string,
|
114
|
+
errorSetter: Dispatch<SetStateAction<boolean>>,
|
115
|
+
disableSetter: Dispatch<SetStateAction<boolean>>
|
116
|
+
) => {
|
117
|
+
disableSetter(true);
|
118
|
+
|
119
|
+
// имитация запроса на сервер
|
120
|
+
setTimeout(() => {
|
121
|
+
disableSetter(false);
|
122
|
+
|
123
|
+
if (code !== '123456') {
|
124
|
+
errorSetter(true);
|
125
|
+
}
|
126
|
+
}, 3000)
|
127
|
+
}
|
128
|
+
|
129
|
+
return (
|
130
|
+
<div style=\{{ flexDirection: 'column', gap: '2rem' }}>
|
131
|
+
<CodeField
|
132
|
+
itemErrorBehavior="remove-symbol"
|
133
|
+
codeErrorBehavior="remove-code"
|
134
|
+
disabled={disabledFirst}
|
135
|
+
isError={isErrorFirst}
|
136
|
+
setIsError={setIsErrorFirst}
|
137
|
+
onFullCodeEnter={(code) => onFullCodeEnter(code, setIsErrorFirst, setDisabledFirst)}
|
138
|
+
/>
|
139
|
+
<CodeField
|
140
|
+
itemErrorBehavior="remove-symbol"
|
141
|
+
codeErrorBehavior="keep"
|
142
|
+
disabled={disabledSecond}
|
143
|
+
isError={isErrorSecond}
|
144
|
+
setIsError={setIsErrorSecond}
|
145
|
+
onFullCodeEnter={(code) => onFullCodeEnter(code, setIsErrorSecond, setDisabledSecond)}
|
146
|
+
/>
|
147
|
+
</div>
|
148
|
+
);
|
149
|
+
}
|
150
|
+
```
|
@@ -0,0 +1,51 @@
|
|
1
|
+
export var classes = {
|
2
|
+
itemError: 'codefield-item-error',
|
3
|
+
itemErrorAnimation: 'codefield-item-error-animation',
|
4
|
+
itemErrorFade: 'codefield-item-error-fade',
|
5
|
+
captionError: 'codefield-caption-error',
|
6
|
+
codeError: 'codefield-code-error',
|
7
|
+
codeErrorAnimation: 'codefield-code-error-animation',
|
8
|
+
codeErrorFade: 'codefield-code-error-fade',
|
9
|
+
captionAlignLeft: 'codefield-caption-align-left',
|
10
|
+
hoverEnabled: 'codefield-item-hover-enabled',
|
11
|
+
segmented: 'codefield-shape-segmented',
|
12
|
+
"default": 'codefield-shape-default',
|
13
|
+
disabled: 'codefield-disabled'
|
14
|
+
};
|
15
|
+
export var tokens = {
|
16
|
+
captionGap: '--plasma-codefield-caption-gap',
|
17
|
+
codeItemsGap: '--plasma-codefield-code-item-gap',
|
18
|
+
separatorWidth: '--plasma-codefield-separator-width',
|
19
|
+
codeItemWidth: '--plasma-codefield-item-width',
|
20
|
+
codeItemHeight: '--plasma-codefield-item-height',
|
21
|
+
fontFamily: '--plasma-codefield-font-family',
|
22
|
+
fontStyle: '--plasma-codefield-font-style',
|
23
|
+
fontSize: '--plasma-codefield-font-size',
|
24
|
+
fontWeight: '--plasma-codefield-font-weight',
|
25
|
+
letterSpacing: '--plasma-codefield-letter-spacing',
|
26
|
+
lineHeight: '--plasma-codefield-line-height',
|
27
|
+
captionFontFamily: '--plasma-codefield-caption-font-family',
|
28
|
+
captionFontSize: '--plasma-codefield-caption-font-style',
|
29
|
+
captionFontStyle: '--plasma-codefield-caption-font-size',
|
30
|
+
captionFontWeight: '--plasma-codefield-caption-font-weight',
|
31
|
+
captionLetterSpacing: '--plasma-codefield-caption-letter-spacing',
|
32
|
+
captionLineHeight: '--plasma-codefield-caption-line-height',
|
33
|
+
borderRadius: '--plasma-codefield-code-item-border-radius',
|
34
|
+
borderRadiusSegmented: '--plasma-codefield-code-item-border-radius-segmented',
|
35
|
+
segmentedSideBorderRadius: '--plasma-codefield-code-item-segmented-side-border-radius',
|
36
|
+
captionColor: '--plasma-codefield-caption-color',
|
37
|
+
captionColorError: '--plasma-codefield-caption-color-error',
|
38
|
+
codeColor: '--plasma-codefield-code-color',
|
39
|
+
codeColorError: '--plasma-codefield-code-color-error',
|
40
|
+
backgroundColor: '--plasma-codefield-background-color',
|
41
|
+
backgroundColorHover: '--plasma-codefield-background-color-hover',
|
42
|
+
backgroundColorFocus: '--plasma-codefield-background-color-focus',
|
43
|
+
backgroundErrorColor: '--plasma-codefield-background-error-color',
|
44
|
+
borderWidth: '--plasma-codefield-border-width',
|
45
|
+
borderColor: '--plasma-codefield-border-color',
|
46
|
+
borderColorHover: '--plasma-codefield-border-color-hover',
|
47
|
+
borderColorFocus: '--plasma-codefield-border-color-focus',
|
48
|
+
borderErrorColor: '--plasma-codefield-border-error-color',
|
49
|
+
caretColor: '--plasma-codefield-caret-color',
|
50
|
+
disabledOpacity: '--plasma-codefield-disabled-opacity'
|
51
|
+
};
|
@@ -0,0 +1,6 @@
|
|
1
|
+
export var ONLY_DIGITS_PATTERN = '^\\d+$';
|
2
|
+
export var ONLY_CHARS_PATTERN = '^[a-zA-Z]+$';
|
3
|
+
export var ONLY_DIGITS_AND_CHARS_PATTERN = '^[a-zA-Z0-9]+$';
|
4
|
+
export var FORBIDDEN_KEYS = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Delete'];
|
5
|
+
export var BACKSPACE_KEY = 'Backspace';
|
6
|
+
export var ANIMATION_TIMEOUT = 300;
|