@salutejs/plasma-new-hope 0.187.0-canary.1539.11742294440.0 → 0.187.0-dev.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/NumberInput/NumberInput.css +52 -0
- package/cjs/components/NumberInput/NumberInput.js +205 -0
- package/cjs/components/NumberInput/NumberInput.js.map +1 -0
- package/cjs/components/NumberInput/NumberInput.styles.js +9 -0
- package/cjs/components/NumberInput/NumberInput.styles.js.map +1 -0
- package/cjs/components/NumberInput/NumberInput.styles_jeawjl.css +1 -0
- package/cjs/components/NumberInput/NumberInput.tokens.js +102 -0
- package/cjs/components/NumberInput/NumberInput.tokens.js.map +1 -0
- package/cjs/components/NumberInput/ui/ActionButton/ActionButton.js +19 -0
- package/cjs/components/NumberInput/ui/ActionButton/ActionButton.js.map +1 -0
- package/cjs/components/NumberInput/ui/ActionButton/ActionButton.styles.js +22 -0
- package/cjs/components/NumberInput/ui/ActionButton/ActionButton.styles.js.map +1 -0
- package/cjs/components/NumberInput/ui/ActionButton/ActionButton.styles_x642ct.css +1 -0
- package/cjs/components/NumberInput/ui/Input/Input.css +15 -0
- package/cjs/components/NumberInput/ui/Input/Input.js +205 -0
- package/cjs/components/NumberInput/ui/Input/Input.js.map +1 -0
- package/cjs/components/NumberInput/ui/Input/Input.styles.js +96 -0
- package/cjs/components/NumberInput/ui/Input/Input.styles.js.map +1 -0
- package/cjs/components/NumberInput/ui/Input/Input.styles_fhgb95.css +8 -0
- package/cjs/components/NumberInput/utils/index.js +12 -0
- package/cjs/components/NumberInput/utils/index.js.map +1 -0
- package/cjs/components/{Switch/_toggleSize → NumberInput/variations/_background-type}/base.js +2 -2
- package/cjs/components/NumberInput/variations/_background-type/base.js.map +1 -0
- package/cjs/components/NumberInput/variations/_background-type/base_dx9knv.css +1 -0
- package/cjs/components/NumberInput/variations/_disabled/base.js +9 -0
- package/cjs/components/NumberInput/variations/_disabled/base.js.map +1 -0
- package/cjs/components/NumberInput/variations/_disabled/base_1sl0mh8.css +1 -0
- package/cjs/components/NumberInput/variations/_segmentation/base.js +9 -0
- package/cjs/components/NumberInput/variations/_segmentation/base.js.map +1 -0
- package/cjs/components/NumberInput/variations/_segmentation/base_14s5rot.css +1 -0
- package/cjs/components/NumberInput/variations/_shape/base.js +9 -0
- package/cjs/components/NumberInput/variations/_shape/base.js.map +1 -0
- package/cjs/components/NumberInput/variations/_shape/base_k05biw.css +1 -0
- package/cjs/components/NumberInput/variations/_size/base.js +9 -0
- package/cjs/components/NumberInput/variations/_size/base.js.map +1 -0
- package/cjs/components/NumberInput/variations/_size/base_yqdmk4.css +1 -0
- package/cjs/components/NumberInput/variations/_view/base.js +9 -0
- package/cjs/components/NumberInput/variations/_view/base.js.map +1 -0
- package/cjs/components/NumberInput/variations/_view/base_tnfbb5.css +1 -0
- package/cjs/components/Switch/Switch.css +7 -11
- package/cjs/components/Switch/Switch.js +7 -16
- package/cjs/components/Switch/Switch.js.map +1 -1
- package/cjs/components/Switch/Switch.styles.js +4 -16
- package/cjs/components/Switch/Switch.styles.js.map +1 -1
- package/cjs/components/Switch/Switch.styles_1kk0qzz.css +4 -0
- package/cjs/components/Switch/Switch.tokens.js +0 -11
- package/cjs/components/Switch/Switch.tokens.js.map +1 -1
- package/cjs/components/Switch/_focused/base.js +1 -1
- package/{es/components/Switch/_focused/base_sz3n0x.css → cjs/components/Switch/_focused/base_j4murk.css} +1 -1
- package/cjs/components/Switch/_size/base.js +1 -1
- package/cjs/components/Switch/_size/base.js.map +1 -1
- package/cjs/components/Switch/_size/base_1rjzpi4.css +1 -0
- package/cjs/components/Switch/_view/base.js +1 -1
- package/cjs/components/Switch/_view/base.js.map +1 -1
- package/cjs/components/Switch/_view/base_1mtyz12.css +1 -0
- package/cjs/index.css +30 -11
- package/cjs/index.js +6 -0
- package/cjs/index.js.map +1 -1
- package/emotion/cjs/components/NumberInput/NumberInput.js +214 -0
- package/emotion/cjs/components/NumberInput/NumberInput.styles.js +17 -0
- package/emotion/cjs/components/NumberInput/NumberInput.template-doc.mdx +214 -0
- package/emotion/cjs/components/NumberInput/NumberInput.tokens.js +99 -0
- package/emotion/cjs/components/NumberInput/NumberInput.types.js +5 -0
- package/emotion/cjs/components/NumberInput/index.js +31 -0
- package/emotion/cjs/components/NumberInput/ui/ActionButton/ActionButton.js +18 -0
- package/emotion/cjs/components/NumberInput/ui/ActionButton/ActionButton.styles.js +16 -0
- package/emotion/cjs/components/NumberInput/ui/ActionButton/ActionButton.types.js +5 -0
- package/emotion/cjs/components/NumberInput/ui/Input/Input.js +213 -0
- package/emotion/cjs/components/NumberInput/ui/Input/Input.styles.js +81 -0
- package/emotion/cjs/components/NumberInput/ui/Input/Input.types.js +5 -0
- package/emotion/cjs/components/NumberInput/ui/index.js +19 -0
- package/emotion/cjs/components/NumberInput/utils/index.js +9 -0
- package/emotion/cjs/components/NumberInput/variations/_background-type/base.js +10 -0
- package/emotion/cjs/components/NumberInput/variations/_background-type/tokens.json +6 -0
- package/emotion/cjs/components/NumberInput/variations/_disabled/base.js +9 -0
- package/emotion/cjs/components/NumberInput/variations/_disabled/tokens.json +4 -0
- package/emotion/cjs/components/NumberInput/variations/_segmentation/base.js +12 -0
- package/emotion/cjs/components/NumberInput/variations/_segmentation/tokens.json +1 -0
- package/emotion/cjs/components/NumberInput/variations/_shape/base.js +11 -0
- package/emotion/cjs/components/NumberInput/variations/_shape/tokens.json +1 -0
- package/emotion/cjs/components/NumberInput/variations/_size/base.js +13 -0
- package/emotion/cjs/components/NumberInput/variations/_size/tokens.json +22 -0
- package/emotion/cjs/components/NumberInput/variations/_view/base.js +13 -0
- package/emotion/cjs/components/NumberInput/variations/_view/tokens.json +14 -0
- package/emotion/cjs/components/Switch/Switch.js +8 -17
- package/emotion/cjs/components/Switch/Switch.styles.js +5 -21
- package/emotion/cjs/components/Switch/Switch.template-doc.mdx +1 -37
- package/emotion/cjs/components/Switch/Switch.tokens.js +0 -11
- package/emotion/cjs/components/Switch/_size/base.js +1 -1
- package/emotion/cjs/components/Switch/_view/base.js +1 -1
- package/emotion/cjs/examples/plasma_b2c/components/NumberInput/NumberInput.config.js +46 -0
- package/emotion/cjs/examples/plasma_b2c/components/NumberInput/NumberInput.js +11 -0
- package/emotion/cjs/examples/plasma_b2c/components/NumberInput/NumberInput.stories.tsx +108 -0
- package/emotion/cjs/examples/plasma_b2c/components/Switch/Switch.config.js +4 -11
- package/emotion/cjs/examples/plasma_b2c/components/Switch/Switch.stories.tsx +1 -7
- package/emotion/cjs/examples/plasma_web/components/NumberInput/NumberInput.config.js +46 -0
- package/emotion/cjs/examples/plasma_web/components/NumberInput/NumberInput.js +11 -0
- package/emotion/cjs/examples/plasma_web/components/NumberInput/NumberInput.stories.tsx +108 -0
- package/emotion/cjs/examples/plasma_web/components/Switch/Switch.config.js +4 -11
- package/emotion/cjs/examples/plasma_web/components/Switch/Switch.stories.tsx +1 -14
- package/emotion/cjs/index.js +11 -0
- package/emotion/es/components/NumberInput/NumberInput.js +206 -0
- package/emotion/es/components/NumberInput/NumberInput.styles.js +11 -0
- package/emotion/es/components/NumberInput/NumberInput.template-doc.mdx +214 -0
- package/emotion/es/components/NumberInput/NumberInput.tokens.js +93 -0
- package/emotion/es/components/NumberInput/NumberInput.types.js +1 -0
- package/emotion/es/components/NumberInput/index.js +2 -0
- package/emotion/es/components/NumberInput/ui/ActionButton/ActionButton.js +11 -0
- package/emotion/es/components/NumberInput/ui/ActionButton/ActionButton.styles.js +9 -0
- package/emotion/es/components/NumberInput/ui/ActionButton/ActionButton.types.js +1 -0
- package/emotion/es/components/NumberInput/ui/Input/Input.js +204 -0
- package/emotion/es/components/NumberInput/ui/Input/Input.styles.js +74 -0
- package/emotion/es/components/NumberInput/ui/Input/Input.types.js +1 -0
- package/emotion/es/components/NumberInput/ui/index.js +2 -0
- package/emotion/es/components/NumberInput/utils/index.js +3 -0
- package/emotion/es/components/NumberInput/variations/_background-type/base.js +4 -0
- package/emotion/es/components/NumberInput/variations/_background-type/tokens.json +6 -0
- package/emotion/es/components/NumberInput/variations/_disabled/base.js +3 -0
- package/emotion/es/components/NumberInput/variations/_disabled/tokens.json +4 -0
- package/emotion/es/components/NumberInput/variations/_segmentation/base.js +6 -0
- package/emotion/es/components/NumberInput/variations/_segmentation/tokens.json +1 -0
- package/emotion/es/components/NumberInput/variations/_shape/base.js +5 -0
- package/emotion/es/components/NumberInput/variations/_shape/tokens.json +1 -0
- package/emotion/es/components/NumberInput/variations/_size/base.js +7 -0
- package/emotion/es/components/NumberInput/variations/_size/tokens.json +22 -0
- package/emotion/es/components/NumberInput/variations/_view/base.js +7 -0
- package/emotion/es/components/NumberInput/variations/_view/tokens.json +14 -0
- package/emotion/es/components/Switch/Switch.js +4 -13
- package/emotion/es/components/Switch/Switch.styles.js +4 -20
- package/emotion/es/components/Switch/Switch.template-doc.mdx +1 -37
- package/emotion/es/components/Switch/Switch.tokens.js +0 -11
- package/emotion/es/components/Switch/_size/base.js +2 -2
- package/emotion/es/components/Switch/_view/base.js +2 -2
- package/emotion/es/examples/plasma_b2c/components/NumberInput/NumberInput.config.js +40 -0
- package/emotion/es/examples/plasma_b2c/components/NumberInput/NumberInput.js +5 -0
- package/emotion/es/examples/plasma_b2c/components/NumberInput/NumberInput.stories.tsx +108 -0
- package/emotion/es/examples/plasma_b2c/components/Switch/Switch.config.js +4 -11
- package/emotion/es/examples/plasma_b2c/components/Switch/Switch.stories.tsx +1 -7
- package/emotion/es/examples/plasma_web/components/NumberInput/NumberInput.config.js +40 -0
- package/emotion/es/examples/plasma_web/components/NumberInput/NumberInput.js +5 -0
- package/emotion/es/examples/plasma_web/components/NumberInput/NumberInput.stories.tsx +108 -0
- package/emotion/es/examples/plasma_web/components/Switch/Switch.config.js +4 -11
- package/emotion/es/examples/plasma_web/components/Switch/Switch.stories.tsx +1 -14
- package/emotion/es/index.js +2 -1
- package/es/components/NumberInput/NumberInput.css +52 -0
- package/es/components/NumberInput/NumberInput.js +200 -0
- package/es/components/NumberInput/NumberInput.js.map +1 -0
- package/es/components/NumberInput/NumberInput.styles.js +5 -0
- package/es/components/NumberInput/NumberInput.styles.js.map +1 -0
- package/es/components/NumberInput/NumberInput.styles_jeawjl.css +1 -0
- package/es/components/NumberInput/NumberInput.tokens.js +96 -0
- package/es/components/NumberInput/NumberInput.tokens.js.map +1 -0
- package/es/components/NumberInput/ui/ActionButton/ActionButton.js +15 -0
- package/es/components/NumberInput/ui/ActionButton/ActionButton.js.map +1 -0
- package/es/components/NumberInput/ui/ActionButton/ActionButton.styles.js +18 -0
- package/es/components/NumberInput/ui/ActionButton/ActionButton.styles.js.map +1 -0
- package/es/components/NumberInput/ui/ActionButton/ActionButton.styles_x642ct.css +1 -0
- package/es/components/NumberInput/ui/Input/Input.css +15 -0
- package/es/components/NumberInput/ui/Input/Input.js +201 -0
- package/es/components/NumberInput/ui/Input/Input.js.map +1 -0
- package/es/components/NumberInput/ui/Input/Input.styles.js +85 -0
- package/es/components/NumberInput/ui/Input/Input.styles.js.map +1 -0
- package/es/components/NumberInput/ui/Input/Input.styles_fhgb95.css +8 -0
- package/es/components/NumberInput/utils/index.js +6 -0
- package/es/components/NumberInput/utils/index.js.map +1 -0
- package/es/components/{Switch/_toggleSize → NumberInput/variations/_background-type}/base.js +2 -2
- package/es/components/NumberInput/variations/_background-type/base.js.map +1 -0
- package/es/components/NumberInput/variations/_background-type/base_dx9knv.css +1 -0
- package/es/components/NumberInput/variations/_disabled/base.js +5 -0
- package/es/components/NumberInput/variations/_disabled/base.js.map +1 -0
- package/es/components/NumberInput/variations/_disabled/base_1sl0mh8.css +1 -0
- package/es/components/NumberInput/variations/_segmentation/base.js +5 -0
- package/es/components/NumberInput/variations/_segmentation/base.js.map +1 -0
- package/es/components/NumberInput/variations/_segmentation/base_14s5rot.css +1 -0
- package/es/components/NumberInput/variations/_shape/base.js +5 -0
- package/es/components/NumberInput/variations/_shape/base.js.map +1 -0
- package/es/components/NumberInput/variations/_shape/base_k05biw.css +1 -0
- package/es/components/NumberInput/variations/_size/base.js +5 -0
- package/es/components/NumberInput/variations/_size/base.js.map +1 -0
- package/es/components/NumberInput/variations/_size/base_yqdmk4.css +1 -0
- package/es/components/NumberInput/variations/_view/base.js +5 -0
- package/es/components/NumberInput/variations/_view/base.js.map +1 -0
- package/es/components/NumberInput/variations/_view/base_tnfbb5.css +1 -0
- package/es/components/Switch/Switch.css +7 -11
- package/es/components/Switch/Switch.js +8 -17
- package/es/components/Switch/Switch.js.map +1 -1
- package/es/components/Switch/Switch.styles.js +5 -15
- package/es/components/Switch/Switch.styles.js.map +1 -1
- package/es/components/Switch/Switch.styles_1kk0qzz.css +4 -0
- package/es/components/Switch/Switch.tokens.js +0 -11
- package/es/components/Switch/Switch.tokens.js.map +1 -1
- package/es/components/Switch/_focused/base.js +1 -1
- package/{cjs/components/Switch/_focused/base_sz3n0x.css → es/components/Switch/_focused/base_j4murk.css} +1 -1
- package/es/components/Switch/_size/base.js +1 -1
- package/es/components/Switch/_size/base.js.map +1 -1
- package/es/components/Switch/_size/base_1rjzpi4.css +1 -0
- package/es/components/Switch/_view/base.js +1 -1
- package/es/components/Switch/_view/base.js.map +1 -1
- package/es/components/Switch/_view/base_1mtyz12.css +1 -0
- package/es/index.css +30 -11
- package/es/index.js +2 -0
- package/es/index.js.map +1 -1
- package/package.json +2 -2
- package/styled-components/cjs/components/NumberInput/NumberInput.js +214 -0
- package/styled-components/cjs/components/NumberInput/NumberInput.styles.js +8 -0
- package/styled-components/cjs/components/NumberInput/NumberInput.template-doc.mdx +214 -0
- package/styled-components/cjs/components/NumberInput/NumberInput.tokens.js +99 -0
- package/styled-components/cjs/components/NumberInput/NumberInput.types.js +5 -0
- package/styled-components/cjs/components/NumberInput/index.js +31 -0
- package/styled-components/cjs/components/NumberInput/ui/ActionButton/ActionButton.js +18 -0
- package/styled-components/cjs/components/NumberInput/ui/ActionButton/ActionButton.styles.js +15 -0
- package/styled-components/cjs/components/NumberInput/ui/ActionButton/ActionButton.types.js +5 -0
- package/styled-components/cjs/components/NumberInput/ui/Input/Input.js +213 -0
- package/styled-components/cjs/components/NumberInput/ui/Input/Input.styles.js +48 -0
- package/styled-components/cjs/components/NumberInput/ui/Input/Input.types.js +5 -0
- package/styled-components/cjs/components/NumberInput/ui/index.js +19 -0
- package/styled-components/cjs/components/NumberInput/utils/index.js +9 -0
- package/styled-components/cjs/components/NumberInput/variations/_background-type/base.js +10 -0
- package/styled-components/cjs/components/NumberInput/variations/_background-type/tokens.json +6 -0
- package/styled-components/cjs/components/NumberInput/variations/_disabled/base.js +9 -0
- package/styled-components/cjs/components/NumberInput/variations/_disabled/tokens.json +4 -0
- package/styled-components/cjs/components/NumberInput/variations/_segmentation/base.js +12 -0
- package/styled-components/cjs/components/NumberInput/variations/_segmentation/tokens.json +1 -0
- package/styled-components/cjs/components/NumberInput/variations/_shape/base.js +11 -0
- package/styled-components/cjs/components/NumberInput/variations/_shape/tokens.json +1 -0
- package/styled-components/cjs/components/NumberInput/variations/_size/base.js +13 -0
- package/styled-components/cjs/components/NumberInput/variations/_size/tokens.json +22 -0
- package/styled-components/cjs/components/NumberInput/variations/_view/base.js +13 -0
- package/styled-components/cjs/components/NumberInput/variations/_view/tokens.json +14 -0
- package/styled-components/cjs/components/Switch/Switch.js +8 -17
- package/styled-components/cjs/components/Switch/Switch.styles.js +5 -11
- package/styled-components/cjs/components/Switch/Switch.template-doc.mdx +1 -37
- package/styled-components/cjs/components/Switch/Switch.tokens.js +0 -11
- package/styled-components/cjs/components/Switch/_size/base.js +1 -1
- package/styled-components/cjs/components/Switch/_view/base.js +1 -1
- package/styled-components/cjs/examples/plasma_b2c/components/NumberInput/NumberInput.config.js +46 -0
- package/styled-components/cjs/examples/plasma_b2c/components/NumberInput/NumberInput.js +11 -0
- package/styled-components/cjs/examples/plasma_b2c/components/NumberInput/NumberInput.stories.tsx +108 -0
- package/styled-components/cjs/examples/plasma_b2c/components/Switch/Switch.config.js +2 -9
- package/styled-components/cjs/examples/plasma_b2c/components/Switch/Switch.stories.tsx +1 -7
- package/styled-components/cjs/examples/plasma_web/components/NumberInput/NumberInput.config.js +46 -0
- package/styled-components/cjs/examples/plasma_web/components/NumberInput/NumberInput.js +11 -0
- package/styled-components/cjs/examples/plasma_web/components/NumberInput/NumberInput.stories.tsx +108 -0
- package/styled-components/cjs/examples/plasma_web/components/Switch/Switch.config.js +2 -9
- package/styled-components/cjs/examples/plasma_web/components/Switch/Switch.stories.tsx +1 -14
- package/styled-components/cjs/index.js +11 -0
- package/styled-components/es/components/NumberInput/NumberInput.js +206 -0
- package/styled-components/es/components/NumberInput/NumberInput.styles.js +2 -0
- package/styled-components/es/components/NumberInput/NumberInput.template-doc.mdx +214 -0
- package/styled-components/es/components/NumberInput/NumberInput.tokens.js +93 -0
- package/styled-components/es/components/NumberInput/NumberInput.types.js +1 -0
- package/styled-components/es/components/NumberInput/index.js +2 -0
- package/styled-components/es/components/NumberInput/ui/ActionButton/ActionButton.js +11 -0
- package/styled-components/es/components/NumberInput/ui/ActionButton/ActionButton.styles.js +8 -0
- package/styled-components/es/components/NumberInput/ui/ActionButton/ActionButton.types.js +1 -0
- package/styled-components/es/components/NumberInput/ui/Input/Input.js +204 -0
- package/styled-components/es/components/NumberInput/ui/Input/Input.styles.js +41 -0
- package/styled-components/es/components/NumberInput/ui/Input/Input.types.js +1 -0
- package/styled-components/es/components/NumberInput/ui/index.js +2 -0
- package/styled-components/es/components/NumberInput/utils/index.js +3 -0
- package/styled-components/es/components/NumberInput/variations/_background-type/base.js +4 -0
- package/styled-components/es/components/NumberInput/variations/_background-type/tokens.json +6 -0
- package/styled-components/es/components/NumberInput/variations/_disabled/base.js +3 -0
- package/styled-components/es/components/NumberInput/variations/_disabled/tokens.json +4 -0
- package/styled-components/es/components/NumberInput/variations/_segmentation/base.js +6 -0
- package/styled-components/es/components/NumberInput/variations/_segmentation/tokens.json +1 -0
- package/styled-components/es/components/NumberInput/variations/_shape/base.js +5 -0
- package/styled-components/es/components/NumberInput/variations/_shape/tokens.json +1 -0
- package/styled-components/es/components/NumberInput/variations/_size/base.js +7 -0
- package/styled-components/es/components/NumberInput/variations/_size/tokens.json +22 -0
- package/styled-components/es/components/NumberInput/variations/_view/base.js +7 -0
- package/styled-components/es/components/NumberInput/variations/_view/tokens.json +14 -0
- package/styled-components/es/components/Switch/Switch.js +4 -13
- package/styled-components/es/components/Switch/Switch.styles.js +4 -10
- package/styled-components/es/components/Switch/Switch.template-doc.mdx +1 -37
- package/styled-components/es/components/Switch/Switch.tokens.js +0 -11
- package/styled-components/es/components/Switch/_size/base.js +2 -2
- package/styled-components/es/components/Switch/_view/base.js +2 -2
- package/styled-components/es/examples/plasma_b2c/components/NumberInput/NumberInput.config.js +40 -0
- package/styled-components/es/examples/plasma_b2c/components/NumberInput/NumberInput.js +5 -0
- package/styled-components/es/examples/plasma_b2c/components/NumberInput/NumberInput.stories.tsx +108 -0
- package/styled-components/es/examples/plasma_b2c/components/Switch/Switch.config.js +2 -9
- package/styled-components/es/examples/plasma_b2c/components/Switch/Switch.stories.tsx +1 -7
- package/styled-components/es/examples/plasma_web/components/NumberInput/NumberInput.config.js +40 -0
- package/styled-components/es/examples/plasma_web/components/NumberInput/NumberInput.js +5 -0
- package/styled-components/es/examples/plasma_web/components/NumberInput/NumberInput.stories.tsx +108 -0
- package/styled-components/es/examples/plasma_web/components/Switch/Switch.config.js +2 -9
- package/styled-components/es/examples/plasma_web/components/Switch/Switch.stories.tsx +1 -14
- package/styled-components/es/index.js +2 -1
- package/types/components/NumberInput/NumberInput.d.ts +38 -0
- package/types/components/NumberInput/NumberInput.d.ts.map +1 -0
- package/types/components/NumberInput/NumberInput.styles.d.ts +2 -0
- package/types/components/NumberInput/NumberInput.styles.d.ts.map +1 -0
- package/types/components/NumberInput/NumberInput.tokens.d.ts +88 -0
- package/types/components/NumberInput/NumberInput.tokens.d.ts.map +1 -0
- package/types/components/NumberInput/NumberInput.types.d.ts +112 -0
- package/types/components/NumberInput/NumberInput.types.d.ts.map +1 -0
- package/types/components/NumberInput/index.d.ts +3 -0
- package/types/components/NumberInput/index.d.ts.map +1 -0
- package/types/components/NumberInput/ui/ActionButton/ActionButton.d.ts +4 -0
- package/types/components/NumberInput/ui/ActionButton/ActionButton.d.ts.map +1 -0
- package/types/components/NumberInput/ui/ActionButton/ActionButton.styles.d.ts +45 -0
- package/types/components/NumberInput/ui/ActionButton/ActionButton.styles.d.ts.map +1 -0
- package/types/components/NumberInput/ui/ActionButton/ActionButton.types.d.ts +7 -0
- package/types/components/NumberInput/ui/ActionButton/ActionButton.types.d.ts.map +1 -0
- package/types/components/NumberInput/ui/Input/Input.d.ts +19 -0
- package/types/components/NumberInput/ui/Input/Input.d.ts.map +1 -0
- package/types/components/NumberInput/ui/Input/Input.styles.d.ts +30 -0
- package/types/components/NumberInput/ui/Input/Input.styles.d.ts.map +1 -0
- package/types/components/NumberInput/ui/Input/Input.types.d.ts +19 -0
- package/types/components/NumberInput/ui/Input/Input.types.d.ts.map +1 -0
- package/types/components/NumberInput/ui/index.d.ts +3 -0
- package/types/components/NumberInput/ui/index.d.ts.map +1 -0
- package/types/components/NumberInput/utils/index.d.ts +4 -0
- package/types/components/NumberInput/utils/index.d.ts.map +1 -0
- package/types/components/NumberInput/variations/_background-type/base.d.ts.map +1 -0
- package/types/components/NumberInput/variations/_disabled/base.d.ts +2 -0
- package/types/components/NumberInput/variations/_disabled/base.d.ts.map +1 -0
- package/types/components/NumberInput/variations/_segmentation/base.d.ts +2 -0
- package/types/components/NumberInput/variations/_segmentation/base.d.ts.map +1 -0
- package/types/components/NumberInput/variations/_shape/base.d.ts +2 -0
- package/types/components/NumberInput/variations/_shape/base.d.ts.map +1 -0
- package/types/components/NumberInput/variations/_size/base.d.ts +2 -0
- package/types/components/NumberInput/variations/_size/base.d.ts.map +1 -0
- package/types/components/NumberInput/variations/_view/base.d.ts +2 -0
- package/types/components/NumberInput/variations/_view/base.d.ts.map +1 -0
- package/types/components/Switch/Switch.d.ts +0 -3
- package/types/components/Switch/Switch.d.ts.map +1 -1
- package/types/components/Switch/Switch.styles.d.ts +0 -2
- package/types/components/Switch/Switch.styles.d.ts.map +1 -1
- package/types/components/Switch/Switch.tokens.d.ts +0 -9
- package/types/components/Switch/Switch.tokens.d.ts.map +1 -1
- package/types/components/Switch/Switch.types.d.ts +2 -10
- package/types/components/Switch/Switch.types.d.ts.map +1 -1
- package/types/components/Switch/_size/base.d.ts.map +1 -1
- package/types/components/Switch/_view/base.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/NumberInput/NumberInput.config.d.ts +39 -0
- package/types/examples/plasma_b2c/components/NumberInput/NumberInput.config.d.ts.map +1 -0
- package/types/examples/plasma_b2c/components/NumberInput/NumberInput.d.ts +82 -0
- package/types/examples/plasma_b2c/components/NumberInput/NumberInput.d.ts.map +1 -0
- package/types/examples/plasma_b2c/components/Switch/Switch.config.d.ts +0 -7
- package/types/examples/plasma_b2c/components/Switch/Switch.config.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Switch/Switch.d.ts +0 -6
- package/types/examples/plasma_b2c/components/Switch/Switch.d.ts.map +1 -1
- package/types/examples/plasma_web/components/NumberInput/NumberInput.config.d.ts +39 -0
- package/types/examples/plasma_web/components/NumberInput/NumberInput.config.d.ts.map +1 -0
- package/types/examples/plasma_web/components/NumberInput/NumberInput.d.ts +82 -0
- package/types/examples/plasma_web/components/NumberInput/NumberInput.d.ts.map +1 -0
- package/types/examples/plasma_web/components/Switch/Switch.config.d.ts +0 -7
- package/types/examples/plasma_web/components/Switch/Switch.config.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Switch/Switch.d.ts +0 -6
- package/types/examples/plasma_web/components/Switch/Switch.d.ts.map +1 -1
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
- package/cjs/components/Switch/Switch.styles_bei7bh.css +0 -6
- package/cjs/components/Switch/_size/base_1tcl212.css +0 -1
- package/cjs/components/Switch/_toggleSize/base.js.map +0 -1
- package/cjs/components/Switch/_toggleSize/base_6i0904.css +0 -1
- package/cjs/components/Switch/_view/base_yxkf3s.css +0 -1
- package/emotion/cjs/components/Switch/_toggleSize/base.js +0 -10
- package/emotion/es/components/Switch/_toggleSize/base.js +0 -4
- package/es/components/Switch/Switch.styles_bei7bh.css +0 -6
- package/es/components/Switch/_size/base_1tcl212.css +0 -1
- package/es/components/Switch/_toggleSize/base.js.map +0 -1
- package/es/components/Switch/_toggleSize/base_6i0904.css +0 -1
- package/es/components/Switch/_view/base_yxkf3s.css +0 -1
- package/styled-components/cjs/components/Switch/_toggleSize/base.js +0 -10
- package/styled-components/es/components/Switch/_toggleSize/base.js +0 -4
- package/types/components/Switch/_toggleSize/base.d.ts.map +0 -1
- /package/types/components/{Switch/_toggleSize → NumberInput/variations/_background-type}/base.d.ts +0 -0
@@ -0,0 +1,200 @@
|
|
1
|
+
import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, extends as _extends, objectSpread2 as _objectSpread2, defineProperty as _defineProperty } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
2
|
+
import React, { forwardRef, useState, useEffect } from 'react';
|
3
|
+
import { cx } from '../../utils/index.js';
|
4
|
+
import { classes, privateTokens } from './NumberInput.tokens.js';
|
5
|
+
import { base } from './NumberInput.styles.js';
|
6
|
+
import { base as base$1 } from './variations/_view/base.js';
|
7
|
+
import { base as base$2 } from './variations/_size/base.js';
|
8
|
+
import { base as base$3 } from './variations/_shape/base.js';
|
9
|
+
import { base as base$4 } from './variations/_background-type/base.js';
|
10
|
+
import { base as base$5 } from './variations/_segmentation/base.js';
|
11
|
+
import { base as base$6 } from './variations/_disabled/base.js';
|
12
|
+
import { isNumber } from '../../utils/isNumber.js';
|
13
|
+
import { ActionButton } from './ui/ActionButton/ActionButton.js';
|
14
|
+
import { IconMinus } from '../_Icon/Icons/IconMinus.js';
|
15
|
+
import { NumberInput } from './ui/Input/Input.js';
|
16
|
+
import { IconPlus } from '../_Icon/Icons/IconPlus.js';
|
17
|
+
import { getSizeValueFromProp } from '../../utils/getSizeValueFromProp.js';
|
18
|
+
|
19
|
+
var _excluded = ["className", "style", "width", "value", "min", "max", "step", "isLoading", "loader", "size", "view", "clear", "shape", "segmentation", "inputBackgroundType", "disabled", "textBefore", "textAfter", "customIncrementButton", "incrementIcon", "customDecrementButton", "decrementIcon", "isManualInput", "onChange", "onIncrement", "onDecrement"];
|
20
|
+
var numberInputRoot = function numberInputRoot(Root) {
|
21
|
+
return /*#__PURE__*/forwardRef(function (_ref, ref) {
|
22
|
+
var _ref2;
|
23
|
+
var className = _ref.className,
|
24
|
+
style = _ref.style,
|
25
|
+
width = _ref.width,
|
26
|
+
value = _ref.value,
|
27
|
+
min = _ref.min,
|
28
|
+
max = _ref.max,
|
29
|
+
_ref$step = _ref.step,
|
30
|
+
step = _ref$step === void 0 ? 1 : _ref$step,
|
31
|
+
isLoading = _ref.isLoading,
|
32
|
+
loader = _ref.loader,
|
33
|
+
size = _ref.size,
|
34
|
+
view = _ref.view,
|
35
|
+
clear = _ref.clear,
|
36
|
+
shape = _ref.shape,
|
37
|
+
segmentation = _ref.segmentation,
|
38
|
+
_ref$inputBackgroundT = _ref.inputBackgroundType,
|
39
|
+
inputBackgroundType = _ref$inputBackgroundT === void 0 ? 'fill' : _ref$inputBackgroundT,
|
40
|
+
disabled = _ref.disabled,
|
41
|
+
textBefore = _ref.textBefore,
|
42
|
+
textAfter = _ref.textAfter,
|
43
|
+
customIncrementButton = _ref.customIncrementButton,
|
44
|
+
incrementIcon = _ref.incrementIcon,
|
45
|
+
customDecrementButton = _ref.customDecrementButton,
|
46
|
+
decrementIcon = _ref.decrementIcon,
|
47
|
+
isManualInput = _ref.isManualInput,
|
48
|
+
onChange = _ref.onChange,
|
49
|
+
onIncrement = _ref.onIncrement,
|
50
|
+
onDecrement = _ref.onDecrement,
|
51
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
52
|
+
var _useState = useState((_ref2 = value !== null && value !== void 0 ? value : min) !== null && _ref2 !== void 0 ? _ref2 : 0),
|
53
|
+
_useState2 = _slicedToArray(_useState, 2),
|
54
|
+
innerValue = _useState2[0],
|
55
|
+
setInnerValue = _useState2[1];
|
56
|
+
var _useState3 = useState(false),
|
57
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
58
|
+
isInputFocused = _useState4[0],
|
59
|
+
setIsInputFocused = _useState4[1];
|
60
|
+
var _useState5 = useState(false),
|
61
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
62
|
+
isAnimationRun = _useState6[0],
|
63
|
+
setIsAnimationRun = _useState6[1];
|
64
|
+
var innerWidth = width ? getSizeValueFromProp(width) : '100%';
|
65
|
+
var actionIconSize = size === 'xs' ? 'xs' : 's';
|
66
|
+
var solidViewClass = segmentation === 'solid' ? classes.solidView : undefined;
|
67
|
+
var segmentedViewClass = segmentation === 'segmented' ? classes.segmentedView : undefined;
|
68
|
+
var clearViewClass = clear ? classes.clearView : undefined;
|
69
|
+
var disabledClass = disabled ? classes.disabled : undefined;
|
70
|
+
var loadingClass = isLoading ? classes.loading : undefined;
|
71
|
+
var focusedClass = isInputFocused ? classes.focused : undefined;
|
72
|
+
var isMinValue = function isMinValue(currentValue) {
|
73
|
+
return min !== undefined && currentValue <= min;
|
74
|
+
};
|
75
|
+
var isMaxValue = function isMaxValue(currentValue) {
|
76
|
+
return max !== undefined && currentValue >= max;
|
77
|
+
};
|
78
|
+
var decrementButtonDisabled = isMinValue(Number(innerValue)) && !isAnimationRun || isLoading ? classes.actionButtonDecrementDisabled : undefined;
|
79
|
+
var incrementButtonDisabled = isMaxValue(Number(innerValue)) && !isAnimationRun || isLoading ? classes.actionButtonIncrementDisabled : undefined;
|
80
|
+
var handleDecrement = function handleDecrement() {
|
81
|
+
if (isLoading || disabled || isAnimationRun) {
|
82
|
+
return;
|
83
|
+
}
|
84
|
+
var diffValue = Number(innerValue) - step;
|
85
|
+
var resValue = min !== undefined && diffValue <= min ? min : diffValue;
|
86
|
+
setInnerValue(resValue);
|
87
|
+
if (onDecrement) {
|
88
|
+
onDecrement(resValue);
|
89
|
+
}
|
90
|
+
if (onChange) {
|
91
|
+
onChange(null, resValue);
|
92
|
+
}
|
93
|
+
};
|
94
|
+
var handleIncrement = function handleIncrement() {
|
95
|
+
if (isLoading || disabled || isAnimationRun) {
|
96
|
+
return;
|
97
|
+
}
|
98
|
+
var diffValue = Number(innerValue) + step;
|
99
|
+
var resValue = max !== undefined && diffValue >= max ? max : diffValue;
|
100
|
+
setInnerValue(resValue);
|
101
|
+
if (onIncrement) {
|
102
|
+
onIncrement(resValue);
|
103
|
+
}
|
104
|
+
if (onChange) {
|
105
|
+
onChange(null, resValue);
|
106
|
+
}
|
107
|
+
};
|
108
|
+
useEffect(function () {
|
109
|
+
if (value === undefined || !isNumber(value)) {
|
110
|
+
return;
|
111
|
+
}
|
112
|
+
setInnerValue(function (prevValue) {
|
113
|
+
return prevValue !== value ? value : prevValue;
|
114
|
+
});
|
115
|
+
}, [value]);
|
116
|
+
return /*#__PURE__*/React.createElement(Root, _extends({
|
117
|
+
view: view,
|
118
|
+
size: size,
|
119
|
+
disabled: disabled,
|
120
|
+
clear: clear,
|
121
|
+
shape: shape,
|
122
|
+
segmentation: segmentation,
|
123
|
+
isLoading: isLoading
|
124
|
+
}, segmentation === 'solid' ? {
|
125
|
+
inputBackgroundType: 'clear'
|
126
|
+
} : {
|
127
|
+
inputBackgroundType: inputBackgroundType
|
128
|
+
}, {
|
129
|
+
className: cx(className, solidViewClass, segmentedViewClass, clearViewClass, disabledClass, loadingClass, focusedClass),
|
130
|
+
style: _objectSpread2(_objectSpread2({}, style), {}, _defineProperty({}, privateTokens.inputWidth, innerWidth))
|
131
|
+
}), customDecrementButton || /*#__PURE__*/React.createElement(ActionButton, {
|
132
|
+
className: cx(classes.actionButtonDecrement, decrementButtonDisabled, solidViewClass, segmentedViewClass),
|
133
|
+
icon: decrementIcon || /*#__PURE__*/React.createElement(IconMinus, {
|
134
|
+
color: "inherit",
|
135
|
+
size: actionIconSize
|
136
|
+
}),
|
137
|
+
onClick: handleDecrement
|
138
|
+
}), /*#__PURE__*/React.createElement(NumberInput, _extends({
|
139
|
+
ref: ref,
|
140
|
+
segmentation: segmentation,
|
141
|
+
value: innerValue,
|
142
|
+
min: min,
|
143
|
+
max: max,
|
144
|
+
isManualInput: isManualInput,
|
145
|
+
textBefore: textBefore,
|
146
|
+
textAfter: textAfter,
|
147
|
+
isLoading: isLoading,
|
148
|
+
loader: loader,
|
149
|
+
disabled: disabled,
|
150
|
+
isInputFocused: isInputFocused,
|
151
|
+
setIsInputFocused: setIsInputFocused,
|
152
|
+
setIsAnimationRun: setIsAnimationRun,
|
153
|
+
setInnerValue: setInnerValue,
|
154
|
+
onChange: onChange
|
155
|
+
}, rest)), customIncrementButton || /*#__PURE__*/React.createElement(ActionButton, {
|
156
|
+
className: cx(classes.actionButtonIncrement, incrementButtonDisabled, solidViewClass, segmentedViewClass),
|
157
|
+
icon: incrementIcon || /*#__PURE__*/React.createElement(IconPlus, {
|
158
|
+
color: "inherit",
|
159
|
+
size: actionIconSize
|
160
|
+
}),
|
161
|
+
onClick: handleIncrement
|
162
|
+
}));
|
163
|
+
});
|
164
|
+
};
|
165
|
+
var numberInputConfig = {
|
166
|
+
name: 'NumberInput',
|
167
|
+
tag: 'div',
|
168
|
+
layout: numberInputRoot,
|
169
|
+
base: base,
|
170
|
+
variations: {
|
171
|
+
view: {
|
172
|
+
css: base$1
|
173
|
+
},
|
174
|
+
size: {
|
175
|
+
css: base$2
|
176
|
+
},
|
177
|
+
shape: {
|
178
|
+
css: base$3
|
179
|
+
},
|
180
|
+
inputBackgroundType: {
|
181
|
+
css: base$4
|
182
|
+
},
|
183
|
+
segmentation: {
|
184
|
+
css: base$5
|
185
|
+
},
|
186
|
+
disabled: {
|
187
|
+
css: base$6,
|
188
|
+
attrs: true
|
189
|
+
}
|
190
|
+
},
|
191
|
+
defaults: {
|
192
|
+
view: 'default',
|
193
|
+
size: 'l',
|
194
|
+
shape: 'cornered',
|
195
|
+
segmentation: 'default'
|
196
|
+
}
|
197
|
+
};
|
198
|
+
|
199
|
+
export { numberInputConfig, numberInputRoot };
|
200
|
+
//# sourceMappingURL=NumberInput.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"NumberInput.js","sources":["../../../src/components/NumberInput/NumberInput.tsx"],"sourcesContent":["import React, { CSSProperties, forwardRef, useEffect, useState } from 'react';\n\nimport type { RootProps } from '../../engines';\nimport { cx, getSizeValueFromProp, isNumber } from '../../utils';\nimport { IconMinus, IconPlus } from '../_Icon';\n\nimport type { NumberInputProps, NumberInputRootProps } from './NumberInput.types';\nimport { ActionButton, NumberInput } from './ui';\nimport { classes, privateTokens } from './NumberInput.tokens';\nimport { base } from './NumberInput.styles';\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { base as shapeCSS } from './variations/_shape/base';\nimport { base as inputBackgroundTypeCSS } from './variations/_background-type/base';\nimport { base as segmentationCSS } from './variations/_segmentation/base';\nimport { base as disabledCSS } from './variations/_disabled/base';\n\nexport const numberInputRoot = (Root: RootProps<HTMLDivElement, NumberInputRootProps>) =>\n forwardRef<HTMLInputElement, NumberInputProps>(\n (\n {\n className,\n style,\n width,\n value,\n min,\n max,\n step = 1,\n isLoading,\n loader,\n size,\n view,\n clear,\n shape,\n segmentation,\n inputBackgroundType = 'fill',\n disabled,\n textBefore,\n textAfter,\n customIncrementButton,\n incrementIcon,\n customDecrementButton,\n decrementIcon,\n isManualInput,\n onChange,\n onIncrement,\n onDecrement,\n ...rest\n },\n ref,\n ) => {\n const [innerValue, setInnerValue] = useState<number | string>(value ?? min ?? 0);\n const [isInputFocused, setIsInputFocused] = useState(false);\n const [isAnimationRun, setIsAnimationRun] = useState(false);\n\n const innerWidth = width ? getSizeValueFromProp(width) : '100%';\n\n const actionIconSize = size === 'xs' ? 'xs' : 's';\n const solidViewClass = segmentation === 'solid' ? classes.solidView : undefined;\n const segmentedViewClass = segmentation === 'segmented' ? classes.segmentedView : undefined;\n const clearViewClass = clear ? classes.clearView : undefined;\n const disabledClass = disabled ? classes.disabled : undefined;\n const loadingClass = isLoading ? classes.loading : undefined;\n const focusedClass = isInputFocused ? classes.focused : undefined;\n\n const isMinValue = (currentValue: number) => min !== undefined && currentValue <= min;\n const isMaxValue = (currentValue: number) => max !== undefined && currentValue >= max;\n\n const decrementButtonDisabled =\n (isMinValue(Number(innerValue)) && !isAnimationRun) || isLoading\n ? classes.actionButtonDecrementDisabled\n : undefined;\n const incrementButtonDisabled =\n (isMaxValue(Number(innerValue)) && !isAnimationRun) || isLoading\n ? classes.actionButtonIncrementDisabled\n : undefined;\n\n const handleDecrement = () => {\n if (isLoading || disabled || isAnimationRun) {\n return;\n }\n\n const diffValue = Number(innerValue) - step;\n const resValue = min !== undefined && diffValue <= min ? min : diffValue;\n\n setInnerValue(resValue);\n\n if (onDecrement) {\n onDecrement(resValue);\n }\n\n if (onChange) {\n onChange(null, resValue);\n }\n };\n\n const handleIncrement = () => {\n if (isLoading || disabled || isAnimationRun) {\n return;\n }\n\n const diffValue = Number(innerValue) + step;\n const resValue = max !== undefined && diffValue >= max ? max : diffValue;\n\n setInnerValue(resValue);\n\n if (onIncrement) {\n onIncrement(resValue);\n }\n\n if (onChange) {\n onChange(null, resValue);\n }\n };\n\n useEffect(() => {\n if (value === undefined || !isNumber(value)) {\n return;\n }\n\n setInnerValue((prevValue) => (prevValue !== value ? value : prevValue));\n }, [value]);\n\n return (\n <Root\n view={view}\n size={size}\n disabled={disabled}\n clear={clear}\n shape={shape}\n segmentation={segmentation}\n isLoading={isLoading}\n {...(segmentation === 'solid' ? { inputBackgroundType: 'clear' } : { inputBackgroundType })}\n className={cx(\n className,\n solidViewClass,\n segmentedViewClass,\n clearViewClass,\n disabledClass,\n loadingClass,\n focusedClass,\n )}\n style={\n {\n ...style,\n [privateTokens.inputWidth]: innerWidth,\n } as CSSProperties\n }\n >\n {customDecrementButton || (\n <ActionButton\n className={cx(\n classes.actionButtonDecrement,\n decrementButtonDisabled,\n solidViewClass,\n segmentedViewClass,\n )}\n icon={decrementIcon || <IconMinus color=\"inherit\" size={actionIconSize} />}\n onClick={handleDecrement}\n />\n )}\n <NumberInput\n ref={ref}\n segmentation={segmentation}\n value={innerValue}\n min={min}\n max={max}\n isManualInput={isManualInput}\n textBefore={textBefore}\n textAfter={textAfter}\n isLoading={isLoading}\n loader={loader}\n disabled={disabled}\n isInputFocused={isInputFocused}\n setIsInputFocused={setIsInputFocused}\n setIsAnimationRun={setIsAnimationRun}\n setInnerValue={setInnerValue}\n onChange={onChange}\n {...rest}\n />\n {customIncrementButton || (\n <ActionButton\n className={cx(\n classes.actionButtonIncrement,\n incrementButtonDisabled,\n solidViewClass,\n segmentedViewClass,\n )}\n icon={incrementIcon || <IconPlus color=\"inherit\" size={actionIconSize} />}\n onClick={handleIncrement}\n />\n )}\n </Root>\n );\n },\n );\n\nexport const numberInputConfig = {\n name: 'NumberInput',\n tag: 'div',\n layout: numberInputRoot,\n base,\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n shape: {\n css: shapeCSS,\n },\n inputBackgroundType: {\n css: inputBackgroundTypeCSS,\n },\n segmentation: {\n css: segmentationCSS,\n },\n disabled: {\n css: disabledCSS,\n attrs: true,\n },\n },\n defaults: {\n view: 'default',\n size: 'l',\n shape: 'cornered',\n segmentation: 'default',\n },\n};\n"],"names":["numberInputRoot","Root","forwardRef","_ref","ref","_ref2","className","style","width","value","min","max","_ref$step","step","isLoading","loader","size","view","clear","shape","segmentation","_ref$inputBackgroundT","inputBackgroundType","disabled","textBefore","textAfter","customIncrementButton","incrementIcon","customDecrementButton","decrementIcon","isManualInput","onChange","onIncrement","onDecrement","rest","_objectWithoutProperties","_excluded","_useState","useState","_useState2","_slicedToArray","innerValue","setInnerValue","_useState3","_useState4","isInputFocused","setIsInputFocused","_useState5","_useState6","isAnimationRun","setIsAnimationRun","innerWidth","getSizeValueFromProp","actionIconSize","solidViewClass","classes","solidView","undefined","segmentedViewClass","segmentedView","clearViewClass","clearView","disabledClass","loadingClass","loading","focusedClass","focused","isMinValue","currentValue","isMaxValue","decrementButtonDisabled","Number","actionButtonDecrementDisabled","incrementButtonDisabled","actionButtonIncrementDisabled","handleDecrement","diffValue","resValue","handleIncrement","useEffect","isNumber","prevValue","React","createElement","_extends","cx","_objectSpread","_defineProperty","privateTokens","inputWidth","ActionButton","actionButtonDecrement","icon","IconMinus","color","onClick","NumberInput","actionButtonIncrement","IconPlus","numberInputConfig","name","tag","layout","base","variations","css","viewCSS","sizeCSS","shapeCSS","inputBackgroundTypeCSS","segmentationCSS","disabledCSS","attrs","defaults"],"mappings":";;;;;;;;;;;;;;;;;;;IAiBaA,eAAe,GAAG,SAAlBA,eAAeA,CAAIC,IAAqD,EAAA;AAAA,EAAA,oBACjFC,UAAU,CACN,UAAAC,IAAA,EA8BIC,GAAG,EACF;AAAA,IAAA,IAAAC,KAAA,CAAA;AAAA,IAAA,IA7BGC,SAAS,GAAAH,IAAA,CAATG,SAAS;MACTC,KAAK,GAAAJ,IAAA,CAALI,KAAK;MACLC,KAAK,GAAAL,IAAA,CAALK,KAAK;MACLC,KAAK,GAAAN,IAAA,CAALM,KAAK;MACLC,GAAG,GAAAP,IAAA,CAAHO,GAAG;MACHC,GAAG,GAAAR,IAAA,CAAHQ,GAAG;MAAAC,SAAA,GAAAT,IAAA,CACHU,IAAI;AAAJA,MAAAA,IAAI,GAAAD,SAAA,KAAG,KAAA,CAAA,GAAA,CAAC,GAAAA,SAAA;MACRE,SAAS,GAAAX,IAAA,CAATW,SAAS;MACTC,MAAM,GAAAZ,IAAA,CAANY,MAAM;MACNC,IAAI,GAAAb,IAAA,CAAJa,IAAI;MACJC,IAAI,GAAAd,IAAA,CAAJc,IAAI;MACJC,KAAK,GAAAf,IAAA,CAALe,KAAK;MACLC,KAAK,GAAAhB,IAAA,CAALgB,KAAK;MACLC,YAAY,GAAAjB,IAAA,CAAZiB,YAAY;MAAAC,qBAAA,GAAAlB,IAAA,CACZmB,mBAAmB;AAAnBA,MAAAA,mBAAmB,GAAAD,qBAAA,KAAG,KAA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berInput/NumberInput.styles.ts"],"sourcesContent":["import { css } from '@linaria/core';\n\nexport const base = css`\n display: flex;\n align-items: center;\n`;\n"],"names":["base"],"mappings":"AAEO,IAAMA,IAAI,GAGhB;;;;"}
|
@@ -0,0 +1 @@
|
|
1
|
+
.bwds6g{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}
|
@@ -0,0 +1,96 @@
|
|
1
|
+
var classes = {
|
2
|
+
actionButtonDecrement: 'action-button-decrement',
|
3
|
+
actionButtonDecrementDisabled: 'action-button-decrement-disabled',
|
4
|
+
actionButtonIncrement: 'action-button-increment',
|
5
|
+
actionButtonIncrementDisabled: 'action-button-increment-disabled',
|
6
|
+
textBefore: 'text-before',
|
7
|
+
textAfter: 'text-after',
|
8
|
+
solidView: 'solid-view',
|
9
|
+
segmentedView: 'segmented-view',
|
10
|
+
clearView: 'clear-view',
|
11
|
+
errorAnimation: 'error-animation',
|
12
|
+
disabled: 'number-input-disabled',
|
13
|
+
loading: 'number-input-loading',
|
14
|
+
focused: 'number-input-focused',
|
15
|
+
manualInput: 'manual-input-number-input'
|
16
|
+
};
|
17
|
+
var privateTokens = {
|
18
|
+
inputWidth: '--plasma_private-number-input_width',
|
19
|
+
segmentationBorderRadius: '--plasma_private-segmentation-border-radius',
|
20
|
+
segmentationInputBorderRadius: '--plasma_private-segmentation_input_border-radius',
|
21
|
+
topBoxShadow: '--plasma_private-number-input_top-box-shadow',
|
22
|
+
bottomBoxShadow: '--plasma_private-number-input_bottom-box-shadow',
|
23
|
+
leftBoxShadow: '--plasma_private-number-input_left-box-shadow',
|
24
|
+
rightBoxShadow: '--plasma_private-number-input_right-box-shadow'
|
25
|
+
};
|
26
|
+
var tokens = {
|
27
|
+
// Root size tokens
|
28
|
+
rootMinWidth: '--plasma-number-input_min-width',
|
29
|
+
disabledOpacity: '--plasma-number-input_disabled-opacity',
|
30
|
+
rootBorderWidth: '--plasma-number-input_input-border-width',
|
31
|
+
wrapperBorderColor: '--plasma-number-input_wrapper_border-color',
|
32
|
+
wrapperBorderColorFocus: '--plasma-number-input_wrapper_border-color_focus',
|
33
|
+
// Action button view tokens
|
34
|
+
iconButtonColor: '--plasma-number-input_icon-button_color',
|
35
|
+
iconButtonBackgroundColor: '--plasma-number-input_icon-button_background-color',
|
36
|
+
iconButtonColorHover: '--plasma-number-input_icon-button_color-hover',
|
37
|
+
iconButtonColorSolidHover: '--plasma-number-input_icon-button_color_solid-hover',
|
38
|
+
iconButtonBackgroundColorHover: '--plasma-number-input_icon-button_background-color-hover',
|
39
|
+
iconButtonColorActive: '--plasma-number-input_icon-button_color-active',
|
40
|
+
iconButtonColorSolidActive: '--plasma-number-input_icon-button_color_solid-active',
|
41
|
+
iconButtonBackgroundColorActive: '--plasma-number-input_icon-button_background-color-active',
|
42
|
+
actionButtonDisabledOpacity: '--plasma-number-input_action-button_disabled-opacity',
|
43
|
+
// Action button size tokens
|
44
|
+
iconButtonHeight: '--plasma-number-input_icon-button_height',
|
45
|
+
iconButtonWidth: '--plasma-number-input_icon-button_width',
|
46
|
+
iconButtonPadding: '--plasma-number-input_icon-button_padding',
|
47
|
+
iconButtonRadius: '--plasma-number-input_icon-button_radius',
|
48
|
+
iconButtonSegmentationRadius: '--plasma-number-input_icon-button_segmentation_radius',
|
49
|
+
iconButtonFontFamily: '--plasma-number-input_icon-button_font-family',
|
50
|
+
iconButtonFontSize: '--plasma-number-input_icon-button_font-size',
|
51
|
+
iconButtonFontStyle: '--plasma-number-input_icon-button_font-style',
|
52
|
+
iconButtonFontWeight: '--plasma-number-input_icon-button_font-weight',
|
53
|
+
iconButtonLetterSpacing: '--plasma-number-input_icon-button_letter-spacing',
|
54
|
+
iconButtonLineHeight: '--plasma-number-input_icon-button_line-height',
|
55
|
+
// Input size tokens
|
56
|
+
inputWrapperBorderWidth: '--plasma-number-input_input-wrapper_border-width',
|
57
|
+
inputWrapperMargin: '--plasma-number-input_input-wrapper_margin',
|
58
|
+
inputWrapperBorderRadius: '--plasma-number-input_input-wrapper_border-radius',
|
59
|
+
textWrapperHeight: '--plasma-number-input_text-wrapper_height',
|
60
|
+
textWrapperPadding: '--plasma-number-input_text-wrapper_padding',
|
61
|
+
fontFamily: '--plasma-number-input_font-family',
|
62
|
+
fontStyle: '--plasma-number-input_font-style',
|
63
|
+
fontSize: '--plasma-number-input_font-size',
|
64
|
+
fontWeight: '--plasma-number-input_font-weight',
|
65
|
+
letterSpacing: '--plasma-number-input_letter-spacing',
|
66
|
+
lineHeight: '--plasma-number-input_line-height',
|
67
|
+
textBeforeMarginRight: '--plasma-number-input_text-before_margin-right',
|
68
|
+
textAfterMarginLeft: '--plasma-number-input_text-after_margin-left',
|
69
|
+
// Input view tokens
|
70
|
+
caretColor: '--plasma-number-input_caret_color',
|
71
|
+
caretColorSolid: '--plasma-number-input_caret_color-solid',
|
72
|
+
color: '--plasma-number-input_color',
|
73
|
+
colorSolid: '--plasma-number-input_color-solid',
|
74
|
+
backgroundColor: '--plasma-number-input_background-color',
|
75
|
+
backgroundColorHover: '--plasma-number-input_background-color-hover',
|
76
|
+
backgroundColorFocus: '--plasma-number-input_background-color-focus',
|
77
|
+
backgroundColorSolidFocus: '--plasma-number-input_background-color-solid-focus',
|
78
|
+
backgroundColorSolid: '--plasma-number-input_background-color-solid',
|
79
|
+
borderColor: '--plasma-number-input_border-color',
|
80
|
+
borderColorHover: '--plasma-number-input_border-color-hover',
|
81
|
+
borderColorFocus: '--plasma-number-input_border-color-focus',
|
82
|
+
borderColorSolidFocus: '--plasma-number-input_border-color-solid-focus',
|
83
|
+
borderColorSolid: '--plasma-number-input_border-color-solid',
|
84
|
+
additionalTextColor: '--plasma-number-input_additional-text_color',
|
85
|
+
additionalTextColorSolid: '--plasma-number-input_additional-text_color-solid',
|
86
|
+
errorColor: '--plasma-number-input_error-color',
|
87
|
+
backgroundErrorColor: '--plasma-number-input_background_error-color',
|
88
|
+
borderErrorColor: '--plasma-number-input_border_error-color',
|
89
|
+
// Loader tokens
|
90
|
+
loaderSpinnerSize: '--plasma-number-input_loader-spinner_size',
|
91
|
+
loaderSpinnerColor: '--plasma-number-input_loader-spinner_color',
|
92
|
+
loaderSpinnerColorSolid: '--plasma-number-input_loader-spinner_color-solid'
|
93
|
+
};
|
94
|
+
|
95
|
+
export { classes, privateTokens, tokens };
|
96
|
+
//# sourceMappingURL=NumberInput.tokens.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"NumberInput.tokens.js","sources":["../../../src/components/NumberInput/NumberInput.tokens.ts"],"sourcesContent":["export const classes = {\n actionButtonDecrement: 'action-button-decrement',\n actionButtonDecrementDisabled: 'action-button-decrement-disabled',\n actionButtonIncrement: 'action-button-increment',\n actionButtonIncrementDisabled: 'action-button-increment-disabled',\n textBefore: 'text-before',\n textAfter: 'text-after',\n solidView: 'solid-view',\n segmentedView: 'segmented-view',\n clearView: 'clear-view',\n errorAnimation: 'error-animation',\n disabled: 'number-input-disabled',\n loading: 'number-input-loading',\n focused: 'number-input-focused',\n manualInput: 'manual-input-number-input',\n};\n\nexport const privateTokens = {\n inputWidth: '--plasma_private-number-input_width',\n segmentationBorderRadius: '--plasma_private-segmentation-border-radius',\n segmentationInputBorderRadius: '--plasma_private-segmentation_input_border-radius',\n topBoxShadow: '--plasma_private-number-input_top-box-shadow',\n bottomBoxShadow: '--plasma_private-number-input_bottom-box-shadow',\n leftBoxShadow: '--plasma_private-number-input_left-box-shadow',\n rightBoxShadow: '--plasma_private-number-input_right-box-shadow',\n};\n\nexport const tokens = {\n // Root size tokens\n rootMinWidth: '--plasma-number-input_min-width',\n disabledOpacity: '--plasma-number-input_disabled-opacity',\n rootBorderWidth: '--plasma-number-input_input-border-width',\n wrapperBorderColor: '--plasma-number-input_wrapper_border-color',\n wrapperBorderColorFocus: '--plasma-number-input_wrapper_border-color_focus',\n\n // Action button view tokens\n iconButtonColor: '--plasma-number-input_icon-button_color',\n iconButtonBackgroundColor: '--plasma-number-input_icon-button_background-color',\n iconButtonColorHover: '--plasma-number-input_icon-button_color-hover',\n iconButtonColorSolidHover: '--plasma-number-input_icon-button_color_solid-hover',\n iconButtonBackgroundColorHover: '--plasma-number-input_icon-button_background-color-hover',\n iconButtonColorActive: '--plasma-number-input_icon-button_color-active',\n iconButtonColorSolidActive: '--plasma-number-input_icon-button_color_solid-active',\n iconButtonBackgroundColorActive: '--plasma-number-input_icon-button_background-color-active',\n\n actionButtonDisabledOpacity: '--plasma-number-input_action-button_disabled-opacity',\n\n // Action button size tokens\n iconButtonHeight: '--plasma-number-input_icon-button_height',\n iconButtonWidth: '--plasma-number-input_icon-button_width',\n iconButtonPadding: '--plasma-number-input_icon-button_padding',\n iconButtonRadius: '--plasma-number-input_icon-button_radius',\n iconButtonSegmentationRadius: '--plasma-number-input_icon-button_segmentation_radius',\n iconButtonFontFamily: '--plasma-number-input_icon-button_font-family',\n iconButtonFontSize: '--plasma-number-input_icon-button_font-size',\n iconButtonFontStyle: '--plasma-number-input_icon-button_font-style',\n iconButtonFontWeight: '--plasma-number-input_icon-button_font-weight',\n iconButtonLetterSpacing: '--plasma-number-input_icon-button_letter-spacing',\n iconButtonLineHeight: '--plasma-number-input_icon-button_line-height',\n\n // Input size tokens\n inputWrapperBorderWidth: '--plasma-number-input_input-wrapper_border-width',\n inputWrapperMargin: '--plasma-number-input_input-wrapper_margin',\n inputWrapperBorderRadius: '--plasma-number-input_input-wrapper_border-radius',\n textWrapperHeight: '--plasma-number-input_text-wrapper_height',\n textWrapperPadding: '--plasma-number-input_text-wrapper_padding',\n\n fontFamily: '--plasma-number-input_font-family',\n fontStyle: '--plasma-number-input_font-style',\n fontSize: '--plasma-number-input_font-size',\n fontWeight: '--plasma-number-input_font-weight',\n letterSpacing: '--plasma-number-input_letter-spacing',\n lineHeight: '--plasma-number-input_line-height',\n\n textBeforeMarginRight: '--plasma-number-input_text-before_margin-right',\n textAfterMarginLeft: '--plasma-number-input_text-after_margin-left',\n\n // Input view tokens\n caretColor: '--plasma-number-input_caret_color',\n caretColorSolid: '--plasma-number-input_caret_color-solid',\n color: '--plasma-number-input_color',\n colorSolid: '--plasma-number-input_color-solid',\n backgroundColor: '--plasma-number-input_background-color',\n backgroundColorHover: '--plasma-number-input_background-color-hover',\n backgroundColorFocus: '--plasma-number-input_background-color-focus',\n backgroundColorSolidFocus: '--plasma-number-input_background-color-solid-focus',\n backgroundColorSolid: '--plasma-number-input_background-color-solid',\n borderColor: '--plasma-number-input_border-color',\n borderColorHover: '--plasma-number-input_border-color-hover',\n borderColorFocus: '--plasma-number-input_border-color-focus',\n borderColorSolidFocus: '--plasma-number-input_border-color-solid-focus',\n borderColorSolid: '--plasma-number-input_border-color-solid',\n additionalTextColor: '--plasma-number-input_additional-text_color',\n additionalTextColorSolid: '--plasma-number-input_additional-text_color-solid',\n\n errorColor: '--plasma-number-input_error-color',\n backgroundErrorColor: '--plasma-number-input_background_error-color',\n borderErrorColor: '--plasma-number-input_border_error-color',\n\n // Loader tokens\n loaderSpinnerSize: '--plasma-number-input_loader-spinner_size',\n loaderSpinnerColor: '--plasma-number-input_loader-spinner_color',\n loaderSpinnerColorSolid: '--plasma-number-input_loader-spinner_color-solid',\n};\n"],"names":["classes","actionButtonDecrement","actionButtonDecrementDisabled","actionButtonIncrement","actionButtonIncrementDisabled","textBefore","textAfter","solidView","segmentedView","clearView","errorAnimation","disabled","loading","focused","manualInput","privateTokens","inputWidth","segmentationBorderRadius","segmentationInputBorderRadius","topBoxShadow","bottomBoxShadow","leftBoxShadow","rightBoxShadow","tokens","rootMinWidth","disabledOpacity","rootBorderWidth","wrapperBorderColor","wrapperBorderColorFocus","iconButtonColor","iconButtonBackgroundColor","iconButtonColorHover","iconButtonColorSolidHover","iconButtonBackgroundColorHover","iconButtonColorActive","iconButtonColorSolidActive","iconButtonBackgroundColorActive","actionButtonDisabledOpacity","iconButtonHeight","iconButtonWidth","iconButtonPadding","iconButtonRadius","iconButtonSegmentationRadius","iconButtonFontFamily","iconButtonFontSize","iconButtonFontStyle","iconButtonFontWeight","iconButtonLetterSpacing","iconButtonLineHeight","inputWrapperBorderWidth","inputWrapperMargin","inputWrapperBorderRadius","textWrapperHeight","textWrapperPadding","fontFamily","fontStyle","fontSize","fontWeight","letterSpacing","lineHeight","textBeforeMarginRight","textAfterMarginLeft","caretColor","caretColorSolid","color","colorSolid","backgroundColor","backgroundColorHover","backgroundColorFocus","backgroundColorSolidFocus","backgroundColorSolid","borderColor","borderColorHover","borderColorFocus","borderColorSolidFocus","borderColorSolid","additionalTextColor","additionalTextColorSolid","errorColor","backgroundErrorColor","borderErrorColor","loaderSpinnerSize","loaderSpinnerColor","loaderSpinnerColorSolid"],"mappings":"AAAO,IAAMA,OAAO,GAAG;AACnBC,EAAAA,qBAAqB,EAAE,yBAAyB;AAChDC,EAAAA,6BAA6B,EAAE,kCAAkC;AACjEC,EAAAA,qBAAqB,EAAE,yBAAyB;AAChDC,EAAAA,6BAA6B,EAAE,kCAAkC;AACjEC,EAAAA,UAAU,EAAE,aAAa;AACzBC,EAAAA,SAAS,EAAE,YAAY;AACvBC,EAAAA,SAAS,EAAE,YAAY;AACvBC,EAAAA,aAAa,EAAE,gBAAgB;AAC/BC,EAAAA,SAAS,EAAE,YAAY;AACvBC,EAAAA,cAAc,EAAE,iBAAiB;AACjCC,EAAAA,QAAQ,EAAE,uBAAuB;AACjCC,EAAAA,OAAO,EAAE,sBAAsB;AAC/BC,EAAAA,OAAO,EAAE,sBAAsB;AAC/BC,EAAAA,WAAW,EAAE,2BAAA;AACjB,EAAC;AAEM,IAAMC,aAAa,GAAG;AACzBC,EAAAA,UAAU,EAAE,qCAAqC;AACjDC,EAAAA,wBAAwB,EAAE,6CAA6C;AACvEC,EAAAA,6BAA6B,EAAE,mDAAmD;AAClFC,EAAAA,YAAY,EAAE,8CAA8C;AAC5DC,EAAAA,eAAe,EAAE,iDAAiD;AAClEC,EAAAA,aAAa,EAAE,+CAA+C;AAC9DC,EAAAA,cAAc,EAAE,gDAA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AAA,SAAS,EAAE,kCAAkC;AAC7CC,EAAAA,QAAQ,EAAE,iCAAiC;AAC3CC,EAAAA,UAAU,EAAE,mCAAmC;AAC/CC,EAAAA,aAAa,EAAE,sCAAsC;AACrDC,EAAAA,UAAU,EAAE,mCAAmC;AAE/CC,EAAAA,qBAAqB,EAAE,gDAAgD;AACvEC,EAAAA,mBAAmB,EAAE,8CAA8C;AAEnE;AACAC,EAAAA,UAAU,EAAE,mCAAmC;AAC/CC,EAAAA,eAAe,EAAE,yCAAyC;AAC1DC,EAAAA,KAAK,EAAE,6BAA6B;AACpCC,EAAAA,UAAU,EAAE,mCAAmC;AAC/CC,EAAAA,eAAe,EAAE,wCAAwC;AACzDC,EAAAA,oBAAoB,EAAE,8CAA8C;AACpEC,EAAAA,oBAAoB,EAAE,8CAA8C;AACpEC,EAAAA,yBAAyB,EAAE,oDAAoD;AAC/EC,EAAAA,oBAAoB,EAAE,8CAA8C;AACpEC,EAAAA,WAAW,EAAE,oCAAoC;AACjDC,EAAAA,gBAAgB,EAAE,0CAA0C;AAC5DC,EAAAA,gBAAgB,EAAE,0CAA0C;AAC5DC,EAAAA,qBAAqB,EAAE,gDAAgD;AACvEC,EAAAA,gBAAgB,EAAE,0CAA0C;AAC5DC,EAAAA,mBAAmB,EAAE,6CAA6C;AAClEC,EAAAA,wBAAwB,EAAE,mDAAmD;AAE7EC,EAAAA,UAAU,EAAE,mCAAmC;AAC/CC,EAAAA,oBAAoB,EAAE,8CAA8C;AACpEC,EAAAA,gBAAgB,EAAE,0CAA0C;AAE5D;AACAC,EAAAA,iBAAiB,EAAE,2CAA2C;AAC9DC,EAAAA,kBAAkB,EAAE,4CAA4C;AAChEC,EAAAA,uBAAuB,EAAE,kDAAA;AAC7B;;;;"}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { StyledIconButton } from './ActionButton.styles.js';
|
3
|
+
|
4
|
+
var ActionButton = function ActionButton(_ref) {
|
5
|
+
var icon = _ref.icon,
|
6
|
+
className = _ref.className,
|
7
|
+
onClick = _ref.onClick;
|
8
|
+
return /*#__PURE__*/React.createElement(StyledIconButton, {
|
9
|
+
className: className,
|
10
|
+
onClick: onClick
|
11
|
+
}, icon);
|
12
|
+
};
|
13
|
+
|
14
|
+
export { ActionButton };
|
15
|
+
//# sourceMappingURL=ActionButton.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ActionButton.js","sources":["../../../../../src/components/NumberInput/ui/ActionButton/ActionButton.tsx"],"sourcesContent":["import React, { FC } from 'react';\n\nimport { StyledIconButton } from './ActionButton.styles';\nimport type { ActionButtonProps } from './ActionButton.types';\n\nexport const ActionButton: FC<ActionButtonProps> = ({ icon, className, onClick }) => {\n return (\n <StyledIconButton className={className} onClick={onClick}>\n {icon}\n </StyledIconButton>\n );\n};\n"],"names":["ActionButton","_ref","icon","className","onClick","React","createElement","StyledIconButton"],"mappings":";;;IAKaA,YAAmC,GAAG,SAAtCA,YAAmCA,CAAAC,IAAA,EAAqC;AAAA,EAAA,IAA/BC,IAAI,GAAAD,IAAA,CAAJC,IAAI;IAAEC,SAAS,GAAAF,IAAA,CAATE,SAAS;IAAEC,OAAO,GAAAH,IAAA,CAAPG,OAAO,CAAA;AAC1E,EAAA,oBACIC,KAAA,CAAAC,aAAA,CAACC,gBAAgB,EAAA;AAACJ,IAAAA,SAAS,EAAEA,SAAU;AAACC,IAAAA,OAAO,EAAEA,OAAAA;AAAQ,GAAA,EACpDF,IACa,CAAC,CAAA;AAE3B;;;;"}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import './ActionButton.styles_x642ct.css';
|
2
|
+
import { styled } from '@linaria/react';
|
3
|
+
import { component, mergeConfig } from '../../../../engines/common.js';
|
4
|
+
import { iconButtonConfig } from '../../../IconButton/IconButton.js';
|
5
|
+
|
6
|
+
var mergedIconButtonConfig = /*#__PURE__*/mergeConfig(iconButtonConfig);
|
7
|
+
var IconButton = /*#__PURE__*/component(mergedIconButtonConfig);
|
8
|
+
var _exp = function _exp() {
|
9
|
+
return IconButton;
|
10
|
+
};
|
11
|
+
var StyledIconButton = /*#__PURE__*/styled(_exp())({
|
12
|
+
name: "StyledIconButton",
|
13
|
+
"class": "sj0ab1b",
|
14
|
+
propsAsIs: true
|
15
|
+
});
|
16
|
+
|
17
|
+
export { StyledIconButton };
|
18
|
+
//# sourceMappingURL=ActionButton.styles.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ActionButton.styles.js","sources":["../../../../../src/components/NumberInput/ui/ActionButton/ActionButton.styles.ts"],"sourcesContent":["import { styled } from '@linaria/react';\n\nimport { iconButtonConfig } from '../../../IconButton';\nimport { component, mergeConfig } from '../../../../engines';\n\nconst mergedIconButtonConfig = mergeConfig(iconButtonConfig);\nconst IconButton = component(mergedIconButtonConfig);\n\nexport const StyledIconButton = styled(IconButton)``;\n"],"names":["mergedIconButtonConfig","mergeConfig","iconButtonConfig","IconButton","component","_exp","StyledIconButton","styled","name","class","propsAsIs"],"mappings":";;;;AAKA,IAAMA,sBAAsB,gBAAGC,WAAW,CAACC,gBAAgB,CAAC,CAAA;AAC5D,IAAMC,UAAU,gBAAGC,SAAS,CAACJ,sBAAsB,CAAC,CAAA;AAAC,IAAAK,IAAA,GALnCA,SAKmCA,IAAAA,GAAA;AAAA,EAAA,OAEdF,UAAU,CAAA;AAAA,CAAA,CAAA;AAA1C,IAAMG,gBAAgB,gBAAGC,MAAM,CAAAF,IAAA,EAAA,CAAA,CAAA;AAAAG,EAAAA,IAAA,EAAA,kBAAA;AAAAC,EAAAA,OAAAA,EAAA,SAAA;AAAAC,EAAAA,SAAA,EAAA,IAAA;AAAA,CAAc;;;;"}
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
.base_1gusher_b1chvyq8__76b641f5{color:var(--plasma-spinner-color);}
|
2
|
+
|
3
|
+
.base_ova69f_bw56nfh__55225c7f{width:var(--plasma-spinner-size);height:var(--plasma-spinner-size);}
|
4
|
+
|
5
|
+
.Spinner_styles_13q7ndk_b1hp2dsz__af962114{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;box-sizing:border-box;}
|
6
|
+
.Spinner_styles_13q7ndk_s122r4cn__af962114{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;width:var(--s122r4cn-0);height:var(--s122r4cn-1);-webkit-animation:Spinner_styles_13q7ndk_rotateS122r4cn__af962114 1s linear infinite;animation:Spinner_styles_13q7ndk_rotateS122r4cn__af962114 1s linear infinite;}@-webkit-keyframes Spinner_styles_13q7ndk_rotateS122r4cn__af962114{from{-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0);}to{-webkit-transform:rotate(360deg);-ms-transform:rotate(360deg);transform:rotate(360deg);}}@keyframes Spinner_styles_13q7ndk_rotateS122r4cn__af962114{from{-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0);}to{-webkit-transform:rotate(360deg);-ms-transform:rotate(360deg);transform:rotate(360deg);}}
|
7
|
+
|
8
|
+
.Input_styles_fhgb95_i1s8bsh6__3bed5c8f{overflow-x:auto;overflow-y:hidden;-webkit-flex:1;-ms-flex:1;flex:1;cursor:var(--i1s8bsh6-0);-webkit-scrollbar-width:none;-moz-scrollbar-width:none;-ms-scrollbar-width:none;scrollbar-width:none;overscroll-behavior:contain;}.Input_styles_fhgb95_i1s8bsh6__3bed5c8f::-webkit-scrollbar{display:none;}
|
9
|
+
.Input_styles_fhgb95_t6wb9c__3bed5c8f{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;margin:0 auto;box-sizing:border-box;}
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
.Input_styles_fhgb95_d1n4jo6t__3bed5c8f{position:relative;}
|
14
|
+
.Input_styles_fhgb95_i1tgbhg7__3bed5c8f{box-sizing:border-box;-webkit-appearance:none;-moz-appearance:none;appearance:none;border:0;padding:0;background-color:transparent;outline:none;width:var(--i1tgbhg7-0);box-sizing:border-box;cursor:var(--i1tgbhg7-1);pointer-events:var(--i1tgbhg7-2);-webkit-transition:width 0.1s;transition:width 0.1s;}
|
15
|
+
.Input_styles_fhgb95_i1il5xze__3bed5c8f{position:absolute;z-index:-999;visibility:hidden;top:0;left:0;opacity:0;height:0;white-space:pre;}
|
@@ -0,0 +1,201 @@
|
|
1
|
+
import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, extends as _extends } from '../../../../_virtual/_rollupPluginBabelHelpers.js';
|
2
|
+
import React, { forwardRef, useState, useRef, useEffect } from 'react';
|
3
|
+
import { useForkRef } from '@salutejs/plasma-core';
|
4
|
+
import { classes } from '../../NumberInput.tokens.js';
|
5
|
+
import { cx } from '../../../../utils/index.js';
|
6
|
+
import { defaultCharacterWidth, excludingNumberSchema, numberSchema } from '../../utils/index.js';
|
7
|
+
import { keyCodes } from '../../../../utils/constants.js';
|
8
|
+
import { InputWrapper, TextWrapper, AdditionalText, Loader, StyledSpinner, DynamicInput, Input, InputWidthHelper } from './Input.styles.js';
|
9
|
+
import { useDidMountEffect } from '../../../../hooks/useDidMountEffect.js';
|
10
|
+
import { isNumber } from '../../../../utils/isNumber.js';
|
11
|
+
|
12
|
+
var _StyledSpinner;
|
13
|
+
var _excluded = ["value", "min", "max", "isLoading", "loader", "disabled", "segmentation", "textBefore", "textAfter", "isManualInput", "isInputFocused", "setIsInputFocused", "setIsAnimationRun", "setInnerValue", "onChange", "onBlur", "onKeyDown"];
|
14
|
+
var NumberInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
15
|
+
var value = _ref.value,
|
16
|
+
min = _ref.min,
|
17
|
+
max = _ref.max,
|
18
|
+
isLoading = _ref.isLoading,
|
19
|
+
loader = _ref.loader,
|
20
|
+
disabled = _ref.disabled,
|
21
|
+
segmentation = _ref.segmentation,
|
22
|
+
textBefore = _ref.textBefore,
|
23
|
+
textAfter = _ref.textAfter,
|
24
|
+
isManualInput = _ref.isManualInput,
|
25
|
+
isInputFocused = _ref.isInputFocused,
|
26
|
+
setIsInputFocused = _ref.setIsInputFocused,
|
27
|
+
setIsAnimationRun = _ref.setIsAnimationRun,
|
28
|
+
setInnerValue = _ref.setInnerValue,
|
29
|
+
onChange = _ref.onChange,
|
30
|
+
onBlur = _ref.onBlur,
|
31
|
+
onKeyDown = _ref.onKeyDown,
|
32
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
33
|
+
var _useState = useState(value ? "".concat(String(value).length, "ch") : defaultCharacterWidth),
|
34
|
+
_useState2 = _slicedToArray(_useState, 2),
|
35
|
+
dynamicWidth = _useState2[0],
|
36
|
+
setDynamicWidth = _useState2[1];
|
37
|
+
var _useState3 = useState(Number(value)),
|
38
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
39
|
+
lastValidValue = _useState4[0],
|
40
|
+
setLastValidValue = _useState4[1];
|
41
|
+
var _useState5 = useState(undefined),
|
42
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
43
|
+
errorClass = _useState6[0],
|
44
|
+
setErrorClass = _useState6[1];
|
45
|
+
var _useState7 = useState(),
|
46
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
47
|
+
errorValue = _useState8[0],
|
48
|
+
setErrorValue = _useState8[1];
|
49
|
+
var inputHelperRef = useRef(null);
|
50
|
+
var wrapperRef = useRef(null);
|
51
|
+
var textWrapperRef = useRef(null);
|
52
|
+
var inputRef = useRef(null);
|
53
|
+
var inputForkRef = useForkRef(inputRef, ref);
|
54
|
+
var solidViewClass = segmentation === 'solid' ? classes.solidView : undefined;
|
55
|
+
var manualInputClass = isManualInput ? classes.manualInput : undefined;
|
56
|
+
var getInputWidth = function getInputWidth() {
|
57
|
+
var _inputHelperRef$curre;
|
58
|
+
var firstRender = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
59
|
+
if (!firstRender && (_inputHelperRef$curre = inputHelperRef.current) !== null && _inputHelperRef$curre !== void 0 && _inputHelperRef$curre.clientWidth) {
|
60
|
+
var _inputHelperRef$curre2;
|
61
|
+
return "".concat((_inputHelperRef$curre2 = inputHelperRef.current) === null || _inputHelperRef$curre2 === void 0 ? void 0 : _inputHelperRef$curre2.clientWidth, "px");
|
62
|
+
}
|
63
|
+
if (value) {
|
64
|
+
return "".concat(String(value).length, "ch");
|
65
|
+
}
|
66
|
+
return defaultCharacterWidth;
|
67
|
+
};
|
68
|
+
var setValues = function setValues(event, newValue) {
|
69
|
+
setLastValidValue(newValue);
|
70
|
+
setInnerValue(newValue);
|
71
|
+
if (onChange) {
|
72
|
+
onChange(event, newValue);
|
73
|
+
}
|
74
|
+
};
|
75
|
+
var validateValue = function validateValue(newValue) {
|
76
|
+
if (!newValue || !isNumber(newValue)) {
|
77
|
+
setValues(null, lastValidValue);
|
78
|
+
setIsAnimationRun(false);
|
79
|
+
return;
|
80
|
+
}
|
81
|
+
if (String(newValue).endsWith('.')) {
|
82
|
+
setValues(null, Number(newValue));
|
83
|
+
setIsAnimationRun(false);
|
84
|
+
return;
|
85
|
+
}
|
86
|
+
var resValue = Number(newValue);
|
87
|
+
if (max !== undefined && resValue > max) {
|
88
|
+
setErrorClass(classes.errorAnimation);
|
89
|
+
setErrorValue(max);
|
90
|
+
setIsAnimationRun(true);
|
91
|
+
return;
|
92
|
+
}
|
93
|
+
if (min !== undefined && resValue < min) {
|
94
|
+
setErrorClass(classes.errorAnimation);
|
95
|
+
setErrorValue(min);
|
96
|
+
setIsAnimationRun(true);
|
97
|
+
}
|
98
|
+
setIsAnimationRun(false);
|
99
|
+
};
|
100
|
+
var handleManualInputChange = function handleManualInputChange(event) {
|
101
|
+
var _textWrapperRef$curre, _wrapperRef$current;
|
102
|
+
if (!isManualInput || disabled) {
|
103
|
+
return;
|
104
|
+
}
|
105
|
+
setIsAnimationRun(true);
|
106
|
+
var newValue = event.target.value;
|
107
|
+
if (!newValue) {
|
108
|
+
setInnerValue('');
|
109
|
+
if (onChange) {
|
110
|
+
onChange(event, '');
|
111
|
+
}
|
112
|
+
return;
|
113
|
+
}
|
114
|
+
var cleanValue = newValue.replace(excludingNumberSchema, '');
|
115
|
+
if (cleanValue.endsWith('.') || cleanValue === '-') {
|
116
|
+
setInnerValue(cleanValue);
|
117
|
+
if (onChange) {
|
118
|
+
onChange(event, cleanValue);
|
119
|
+
}
|
120
|
+
return;
|
121
|
+
}
|
122
|
+
var isValid = numberSchema.test(cleanValue);
|
123
|
+
if (!isValid) {
|
124
|
+
setValues(event, lastValidValue);
|
125
|
+
return;
|
126
|
+
}
|
127
|
+
if (textWrapperRef !== null && textWrapperRef !== void 0 && textWrapperRef.current && wrapperRef !== null && wrapperRef !== void 0 && wrapperRef.current && (textWrapperRef === null || textWrapperRef === void 0 || (_textWrapperRef$curre = textWrapperRef.current) === null || _textWrapperRef$curre === void 0 ? void 0 : _textWrapperRef$curre.clientWidth) > (wrapperRef === null || wrapperRef === void 0 || (_wrapperRef$current = wrapperRef.current) === null || _wrapperRef$current === void 0 ? void 0 : _wrapperRef$current.clientWidth)) {
|
128
|
+
wrapperRef.current.scrollLeft = textWrapperRef.current.offsetWidth - textWrapperRef.current.offsetLeft || 0;
|
129
|
+
}
|
130
|
+
setValues(event, Number(cleanValue));
|
131
|
+
};
|
132
|
+
var handleClickInputWrapper = function handleClickInputWrapper() {
|
133
|
+
if (!isManualInput || !inputRef.current) {
|
134
|
+
return;
|
135
|
+
}
|
136
|
+
if (!isInputFocused) {
|
137
|
+
inputRef.current.select();
|
138
|
+
}
|
139
|
+
setIsInputFocused(true);
|
140
|
+
};
|
141
|
+
var handleBlur = function handleBlur(event) {
|
142
|
+
validateValue(value);
|
143
|
+
setIsInputFocused(false);
|
144
|
+
if (onBlur) {
|
145
|
+
onBlur(event);
|
146
|
+
}
|
147
|
+
};
|
148
|
+
var handleKeyDown = function handleKeyDown(event) {
|
149
|
+
if (!isManualInput || disabled) {
|
150
|
+
return;
|
151
|
+
}
|
152
|
+
if (event.keyCode === keyCodes.Enter) {
|
153
|
+
event.preventDefault();
|
154
|
+
validateValue(value);
|
155
|
+
if (onKeyDown) {
|
156
|
+
onKeyDown(event);
|
157
|
+
}
|
158
|
+
}
|
159
|
+
};
|
160
|
+
var handleEndErrorAnimation = function handleEndErrorAnimation(correctValue) {
|
161
|
+
setIsAnimationRun(false);
|
162
|
+
setIsInputFocused(false);
|
163
|
+
setErrorClass(undefined);
|
164
|
+
setValues(null, correctValue);
|
165
|
+
};
|
166
|
+
useEffect(function () {
|
167
|
+
setDynamicWidth(getInputWidth());
|
168
|
+
}, []);
|
169
|
+
useDidMountEffect(function () {
|
170
|
+
setDynamicWidth(getInputWidth(false));
|
171
|
+
}, [value]);
|
172
|
+
return /*#__PURE__*/React.createElement(InputWrapper, {
|
173
|
+
ref: wrapperRef,
|
174
|
+
className: cx(solidViewClass, errorClass, manualInputClass),
|
175
|
+
isManualInput: Boolean(isManualInput),
|
176
|
+
onClick: handleClickInputWrapper
|
177
|
+
}, /*#__PURE__*/React.createElement(TextWrapper, {
|
178
|
+
ref: textWrapperRef
|
179
|
+
}, !isLoading && textBefore && /*#__PURE__*/React.createElement(AdditionalText, {
|
180
|
+
className: classes.textBefore
|
181
|
+
}, textBefore), isLoading ? /*#__PURE__*/React.createElement(Loader, null, loader || _StyledSpinner || (_StyledSpinner = /*#__PURE__*/React.createElement(StyledSpinner, null))) : /*#__PURE__*/React.createElement(DynamicInput, null, /*#__PURE__*/React.createElement(Input, _extends({
|
182
|
+
ref: inputForkRef,
|
183
|
+
dynamicWidth: dynamicWidth,
|
184
|
+
value: value,
|
185
|
+
isManualInput: Boolean(isManualInput),
|
186
|
+
tabIndex: disabled || !isManualInput ? -1 : 0,
|
187
|
+
onChange: handleManualInputChange,
|
188
|
+
onBlur: handleBlur,
|
189
|
+
onKeyDown: handleKeyDown,
|
190
|
+
onAnimationEnd: function onAnimationEnd() {
|
191
|
+
return handleEndErrorAnimation(Number(errorValue));
|
192
|
+
}
|
193
|
+
}, rest)), /*#__PURE__*/React.createElement(InputWidthHelper, {
|
194
|
+
ref: inputHelperRef
|
195
|
+
}, value)), !isLoading && textAfter && /*#__PURE__*/React.createElement(AdditionalText, {
|
196
|
+
className: classes.textAfter
|
197
|
+
}, textAfter)));
|
198
|
+
});
|
199
|
+
|
200
|
+
export { NumberInput };
|
201
|
+
//# sourceMappingURL=Input.js.map
|