@salutejs/plasma-new-hope 0.174.0-canary.1505.11515852860.0 → 0.174.0-canary.1511.11518967304.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/Combobox/ComboboxNew/Combobox.js +22 -27
- package/cjs/components/Combobox/ComboboxNew/Combobox.js.map +1 -1
- package/cjs/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +5 -9
- package/cjs/components/Combobox/ComboboxNew/utils/initialItemsTransform.js.map +1 -1
- package/cjs/components/NumberInput/NumberInput.css +54 -0
- package/cjs/components/NumberInput/NumberInput.js +188 -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 +90 -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 +190 -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_jszc0c.css +8 -0
- package/cjs/components/NumberInput/utils/index.js +8 -0
- package/cjs/components/NumberInput/utils/index.js.map +1 -0
- package/cjs/components/NumberInput/variations/_background-type/base.js +9 -0
- package/cjs/components/NumberInput/variations/_background-type/base.js.map +1 -0
- package/cjs/components/NumberInput/variations/_background-type/base_1jmdljr.css +1 -0
- package/cjs/components/NumberInput/variations/_clear/base.js +9 -0
- package/cjs/components/NumberInput/variations/_clear/base.js.map +1 -0
- package/cjs/components/NumberInput/variations/_clear/base_3l8dqb.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_nl8ve.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_1pju5qf.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_cghr9q.css +1 -0
- package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
- package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js.map +1 -1
- package/cjs/components/Select/Select.js +25 -13
- package/cjs/components/Select/Select.js.map +1 -1
- package/cjs/components/Select/hooks/useKeyboardNavigation.js +1 -1
- package/cjs/components/Select/hooks/useKeyboardNavigation.js.map +1 -1
- package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
- package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.js.map +1 -1
- package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +1 -1
- package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.styles.js.map +1 -1
- package/cjs/components/Select/utils/getButtonLabel.js +1 -1
- package/cjs/components/Select/utils/getButtonLabel.js.map +1 -1
- package/cjs/components/Select/utils/initialItemsTransform.js +6 -9
- package/cjs/components/Select/utils/initialItemsTransform.js.map +1 -1
- package/cjs/index.css +25 -0
- package/cjs/index.js +6 -0
- package/cjs/index.js.map +1 -1
- package/emotion/cjs/components/Combobox/ComboboxNew/Combobox.js +22 -26
- package/emotion/cjs/components/Combobox/ComboboxNew/utils/index.js +1 -8
- package/emotion/cjs/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +5 -19
- package/emotion/cjs/components/NumberInput/NumberInput.js +198 -0
- package/emotion/cjs/components/NumberInput/NumberInput.styles.js +17 -0
- package/emotion/cjs/components/NumberInput/NumberInput.tokens.js +87 -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 +198 -0
- package/emotion/cjs/components/NumberInput/ui/Input/Input.styles.js +82 -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 +7 -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/_clear/base.js +12 -0
- package/emotion/cjs/components/NumberInput/variations/_clear/tokens.json +5 -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/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
- package/emotion/cjs/components/Select/Select.js +25 -12
- package/emotion/cjs/components/Select/hooks/useKeyboardNavigation.js +1 -1
- package/emotion/cjs/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
- package/emotion/cjs/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +13 -13
- package/emotion/cjs/components/Select/utils/getButtonLabel.js +1 -1
- package/emotion/cjs/components/Select/utils/index.js +1 -8
- package/emotion/cjs/components/Select/utils/initialItemsTransform.js +6 -19
- package/emotion/cjs/examples/plasma_b2c/components/Combobox/Combobox.stories.tsx +0 -6
- package/emotion/cjs/examples/plasma_b2c/components/NumberInput/NumberInput.config.js +48 -0
- package/emotion/cjs/examples/plasma_b2c/components/NumberInput/NumberInput.js +11 -0
- package/emotion/cjs/examples/plasma_b2c/components/NumberInput/NumberInput.stories.tsx +109 -0
- package/emotion/cjs/examples/plasma_web/components/Combobox/Combobox.stories.tsx +0 -6
- package/emotion/cjs/examples/plasma_web/components/NumberInput/NumberInput.config.js +48 -0
- package/emotion/cjs/examples/plasma_web/components/NumberInput/NumberInput.js +11 -0
- package/emotion/cjs/examples/plasma_web/components/NumberInput/NumberInput.stories.tsx +109 -0
- package/emotion/cjs/index.js +11 -0
- package/emotion/es/components/Combobox/ComboboxNew/Combobox.js +23 -27
- package/emotion/es/components/Combobox/ComboboxNew/utils/index.js +1 -2
- package/emotion/es/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +5 -19
- package/emotion/es/components/NumberInput/NumberInput.js +190 -0
- package/emotion/es/components/NumberInput/NumberInput.styles.js +11 -0
- package/emotion/es/components/NumberInput/NumberInput.tokens.js +81 -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 +189 -0
- package/emotion/es/components/NumberInput/ui/Input/Input.styles.js +75 -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 +1 -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/_clear/base.js +6 -0
- package/emotion/es/components/NumberInput/variations/_clear/tokens.json +5 -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/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
- package/emotion/es/components/Select/Select.js +26 -13
- package/emotion/es/components/Select/hooks/useKeyboardNavigation.js +1 -1
- package/emotion/es/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
- package/emotion/es/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +13 -13
- package/emotion/es/components/Select/utils/getButtonLabel.js +1 -1
- package/emotion/es/components/Select/utils/index.js +1 -2
- package/emotion/es/components/Select/utils/initialItemsTransform.js +6 -19
- package/emotion/es/examples/plasma_b2c/components/Combobox/Combobox.stories.tsx +0 -6
- package/emotion/es/examples/plasma_b2c/components/NumberInput/NumberInput.config.js +42 -0
- package/emotion/es/examples/plasma_b2c/components/NumberInput/NumberInput.js +5 -0
- package/emotion/es/examples/plasma_b2c/components/NumberInput/NumberInput.stories.tsx +109 -0
- package/emotion/es/examples/plasma_web/components/Combobox/Combobox.stories.tsx +0 -6
- package/emotion/es/examples/plasma_web/components/NumberInput/NumberInput.config.js +42 -0
- package/emotion/es/examples/plasma_web/components/NumberInput/NumberInput.js +5 -0
- package/emotion/es/examples/plasma_web/components/NumberInput/NumberInput.stories.tsx +109 -0
- package/emotion/es/index.js +2 -1
- package/es/components/Combobox/ComboboxNew/Combobox.js +22 -27
- package/es/components/Combobox/ComboboxNew/Combobox.js.map +1 -1
- package/es/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +5 -9
- package/es/components/Combobox/ComboboxNew/utils/initialItemsTransform.js.map +1 -1
- package/es/components/NumberInput/NumberInput.css +54 -0
- package/es/components/NumberInput/NumberInput.js +183 -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 +84 -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 +186 -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_jszc0c.css +8 -0
- package/es/components/NumberInput/utils/index.js +4 -0
- package/es/components/NumberInput/utils/index.js.map +1 -0
- package/es/components/NumberInput/variations/_background-type/base.js +5 -0
- package/es/components/NumberInput/variations/_background-type/base.js.map +1 -0
- package/es/components/NumberInput/variations/_background-type/base_1jmdljr.css +1 -0
- package/es/components/NumberInput/variations/_clear/base.js +5 -0
- package/es/components/NumberInput/variations/_clear/base.js.map +1 -0
- package/es/components/NumberInput/variations/_clear/base_3l8dqb.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_nl8ve.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_1pju5qf.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_cghr9q.css +1 -0
- package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
- package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js.map +1 -1
- package/es/components/Select/Select.js +26 -14
- package/es/components/Select/Select.js.map +1 -1
- package/es/components/Select/hooks/useKeyboardNavigation.js +1 -1
- package/es/components/Select/hooks/useKeyboardNavigation.js.map +1 -1
- package/es/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
- package/es/components/Select/ui/Target/ui/Textfield/Textfield.js.map +1 -1
- package/es/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +1 -1
- package/es/components/Select/ui/Target/ui/Textfield/Textfield.styles.js.map +1 -1
- package/es/components/Select/utils/getButtonLabel.js +1 -1
- package/es/components/Select/utils/getButtonLabel.js.map +1 -1
- package/es/components/Select/utils/initialItemsTransform.js +6 -9
- package/es/components/Select/utils/initialItemsTransform.js.map +1 -1
- package/es/index.css +25 -0
- package/es/index.js +2 -0
- package/es/index.js.map +1 -1
- package/package.json +2 -2
- package/styled-components/cjs/components/Combobox/ComboboxNew/Combobox.js +22 -26
- package/styled-components/cjs/components/Combobox/ComboboxNew/utils/index.js +1 -8
- package/styled-components/cjs/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +5 -19
- package/styled-components/cjs/components/NumberInput/NumberInput.js +198 -0
- package/styled-components/cjs/components/NumberInput/NumberInput.styles.js +8 -0
- package/styled-components/cjs/components/NumberInput/NumberInput.tokens.js +87 -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 +198 -0
- package/styled-components/cjs/components/NumberInput/ui/Input/Input.styles.js +49 -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 +7 -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/_clear/base.js +12 -0
- package/styled-components/cjs/components/NumberInput/variations/_clear/tokens.json +5 -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/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
- package/styled-components/cjs/components/Select/Select.js +25 -12
- package/styled-components/cjs/components/Select/hooks/useKeyboardNavigation.js +1 -1
- package/styled-components/cjs/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
- package/styled-components/cjs/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +1 -1
- package/styled-components/cjs/components/Select/utils/getButtonLabel.js +1 -1
- package/styled-components/cjs/components/Select/utils/index.js +1 -8
- package/styled-components/cjs/components/Select/utils/initialItemsTransform.js +6 -19
- package/styled-components/cjs/examples/plasma_b2c/components/Combobox/Combobox.stories.tsx +0 -6
- package/styled-components/cjs/examples/plasma_b2c/components/NumberInput/NumberInput.config.js +48 -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 +109 -0
- package/styled-components/cjs/examples/plasma_web/components/Combobox/Combobox.stories.tsx +0 -6
- package/styled-components/cjs/examples/plasma_web/components/NumberInput/NumberInput.config.js +48 -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 +109 -0
- package/styled-components/cjs/index.js +11 -0
- package/styled-components/es/components/Combobox/ComboboxNew/Combobox.js +23 -27
- package/styled-components/es/components/Combobox/ComboboxNew/utils/index.js +1 -2
- package/styled-components/es/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +5 -19
- package/styled-components/es/components/NumberInput/NumberInput.js +190 -0
- package/styled-components/es/components/NumberInput/NumberInput.styles.js +2 -0
- package/styled-components/es/components/NumberInput/NumberInput.tokens.js +81 -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 +189 -0
- package/styled-components/es/components/NumberInput/ui/Input/Input.styles.js +42 -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 +1 -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/_clear/base.js +6 -0
- package/styled-components/es/components/NumberInput/variations/_clear/tokens.json +5 -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/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
- package/styled-components/es/components/Select/Select.js +26 -13
- package/styled-components/es/components/Select/hooks/useKeyboardNavigation.js +1 -1
- package/styled-components/es/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
- package/styled-components/es/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +1 -1
- package/styled-components/es/components/Select/utils/getButtonLabel.js +1 -1
- package/styled-components/es/components/Select/utils/index.js +1 -2
- package/styled-components/es/components/Select/utils/initialItemsTransform.js +6 -19
- package/styled-components/es/examples/plasma_b2c/components/Combobox/Combobox.stories.tsx +0 -6
- package/styled-components/es/examples/plasma_b2c/components/NumberInput/NumberInput.config.js +42 -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 +109 -0
- package/styled-components/es/examples/plasma_web/components/Combobox/Combobox.stories.tsx +0 -6
- package/styled-components/es/examples/plasma_web/components/NumberInput/NumberInput.config.js +42 -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 +109 -0
- package/styled-components/es/index.js +2 -1
- package/types/components/Combobox/ComboboxNew/Combobox.d.ts.map +1 -1
- package/types/components/Combobox/ComboboxNew/Combobox.types.d.ts +3 -14
- package/types/components/Combobox/ComboboxNew/Combobox.types.d.ts.map +1 -1
- package/types/components/Combobox/ComboboxNew/utils/index.d.ts +0 -1
- package/types/components/Combobox/ComboboxNew/utils/index.d.ts.map +1 -1
- package/types/components/Combobox/ComboboxNew/utils/initialItemsTransform.d.ts.map +1 -1
- package/types/components/NumberInput/NumberInput.d.ts +42 -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 +76 -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 +16 -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 +16 -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 +2 -0
- package/types/components/NumberInput/utils/index.d.ts.map +1 -0
- package/types/components/NumberInput/variations/_background-type/base.d.ts +2 -0
- package/types/components/NumberInput/variations/_background-type/base.d.ts.map +1 -0
- package/types/components/NumberInput/variations/_clear/base.d.ts +2 -0
- package/types/components/NumberInput/variations/_clear/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/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.styles.d.ts +8 -8
- package/types/components/Select/Select.d.ts +2 -2
- package/types/components/Select/Select.d.ts.map +1 -1
- package/types/components/Select/Select.types.d.ts +1 -2
- package/types/components/Select/Select.types.d.ts.map +1 -1
- package/types/components/Select/hooks/useKeyboardNavigation.d.ts +2 -2
- package/types/components/Select/hooks/useKeyboardNavigation.d.ts.map +1 -1
- package/types/components/Select/ui/Target/Target.types.d.ts +2 -2
- package/types/components/Select/ui/Target/Target.types.d.ts.map +1 -1
- package/types/components/Select/ui/Target/ui/Textfield/Textfield.styles.d.ts +4 -4
- package/types/components/Select/ui/Target/ui/Textfield/Textfield.styles.d.ts.map +1 -1
- package/types/components/Select/utils/index.d.ts +0 -1
- package/types/components/Select/utils/index.d.ts.map +1 -1
- package/types/components/Select/utils/initialItemsTransform.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Combobox/Combobox.d.ts +6 -30
- package/types/examples/plasma_b2c/components/Combobox/Combobox.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/NumberInput/NumberInput.config.d.ts +41 -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 +84 -0
- package/types/examples/plasma_b2c/components/NumberInput/NumberInput.d.ts.map +1 -0
- package/types/examples/plasma_b2c/components/Select/Select.d.ts +8 -8
- package/types/examples/plasma_web/components/Combobox/Combobox.d.ts +6 -30
- package/types/examples/plasma_web/components/Combobox/Combobox.d.ts.map +1 -1
- package/types/examples/plasma_web/components/NumberInput/NumberInput.config.d.ts +41 -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 +84 -0
- package/types/examples/plasma_web/components/NumberInput/NumberInput.d.ts.map +1 -0
- package/types/examples/plasma_web/components/Select/Select.d.ts +8 -8
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
- package/cjs/components/Combobox/ComboboxNew/utils/getInitialValue.js +0 -21
- package/cjs/components/Combobox/ComboboxNew/utils/getInitialValue.js.map +0 -1
- package/cjs/components/Select/utils/getInitialValue.js +0 -21
- package/cjs/components/Select/utils/getInitialValue.js.map +0 -1
- package/emotion/cjs/components/Combobox/ComboboxNew/utils/getInitialValue.js +0 -20
- package/emotion/cjs/components/Select/utils/getInitialValue.js +0 -20
- package/emotion/es/components/Combobox/ComboboxNew/utils/getInitialValue.js +0 -14
- package/emotion/es/components/Select/utils/getInitialValue.js +0 -14
- package/es/components/Combobox/ComboboxNew/utils/getInitialValue.js +0 -17
- package/es/components/Combobox/ComboboxNew/utils/getInitialValue.js.map +0 -1
- package/es/components/Select/utils/getInitialValue.js +0 -17
- package/es/components/Select/utils/getInitialValue.js.map +0 -1
- package/styled-components/cjs/components/Combobox/ComboboxNew/utils/getInitialValue.js +0 -20
- package/styled-components/cjs/components/Select/utils/getInitialValue.js +0 -20
- package/styled-components/es/components/Combobox/ComboboxNew/utils/getInitialValue.js +0 -14
- package/styled-components/es/components/Select/utils/getInitialValue.js +0 -14
- package/types/components/Combobox/ComboboxNew/utils/getInitialValue.d.ts +0 -4
- package/types/components/Combobox/ComboboxNew/utils/getInitialValue.d.ts.map +0 -1
- package/types/components/Select/utils/getInitialValue.d.ts +0 -4
- package/types/components/Select/utils/getInitialValue.d.ts.map +0 -1
@@ -0,0 +1,183 @@
|
|
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 } 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/_clear/base.js';
|
12
|
+
import { base as base$7 } from './variations/_disabled/base.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 innerWidth = width ? getSizeValueFromProp(width) : '100%';
|
57
|
+
var actionIconSize = size === 'xs' ? 'xs' : 's';
|
58
|
+
var solidViewClass = segmentation === 'solid' ? classes.solidView : undefined;
|
59
|
+
var segmentedViewClass = segmentation === 'segmented' ? classes.segmentedView : undefined;
|
60
|
+
var clearViewClass = clear ? classes.clearView : undefined;
|
61
|
+
var disabledClass = disabled ? classes.disabled : undefined;
|
62
|
+
var isMinValue = function isMinValue(currentValue) {
|
63
|
+
return min && currentValue <= min;
|
64
|
+
};
|
65
|
+
var isMaxValue = function isMaxValue(currentValue) {
|
66
|
+
return max && currentValue >= max;
|
67
|
+
};
|
68
|
+
var decrementButtonDisabled = isMinValue(Number(innerValue)) || isLoading ? classes.actionButtonDecrementDisabled : undefined;
|
69
|
+
var incrementButtonDisabled = isMaxValue(Number(innerValue)) || isLoading ? classes.actionButtonIncrementDisabled : undefined;
|
70
|
+
var handleDecrement = function handleDecrement() {
|
71
|
+
if (isLoading || disabled) {
|
72
|
+
return;
|
73
|
+
}
|
74
|
+
var diffValue = Number(innerValue) - step;
|
75
|
+
var resValue = !isMinValue(diffValue) ? diffValue : Number(min);
|
76
|
+
setInnerValue(resValue);
|
77
|
+
if (onDecrement) {
|
78
|
+
onDecrement(resValue);
|
79
|
+
}
|
80
|
+
if (onChange) {
|
81
|
+
onChange(null, resValue);
|
82
|
+
}
|
83
|
+
};
|
84
|
+
var handleIncrement = function handleIncrement() {
|
85
|
+
if (isLoading || disabled) {
|
86
|
+
return;
|
87
|
+
}
|
88
|
+
var diffValue = Number(innerValue) + step;
|
89
|
+
var resValue = !isMaxValue(diffValue) ? diffValue : Number(max);
|
90
|
+
setInnerValue(resValue);
|
91
|
+
if (onIncrement) {
|
92
|
+
onIncrement(resValue);
|
93
|
+
}
|
94
|
+
if (onChange) {
|
95
|
+
onChange(null, resValue);
|
96
|
+
}
|
97
|
+
};
|
98
|
+
return /*#__PURE__*/React.createElement(Root, _extends({
|
99
|
+
view: view,
|
100
|
+
size: size,
|
101
|
+
disabled: disabled,
|
102
|
+
clear: clear,
|
103
|
+
shape: shape,
|
104
|
+
segmentation: segmentation,
|
105
|
+
isLoading: isLoading
|
106
|
+
}, segmentation === 'solid' ? {
|
107
|
+
inputBackgroundType: 'clear'
|
108
|
+
} : {
|
109
|
+
inputBackgroundType: inputBackgroundType
|
110
|
+
}, {
|
111
|
+
className: cx(className, solidViewClass, clearViewClass, disabledClass),
|
112
|
+
style: _objectSpread2(_objectSpread2({}, style), {}, _defineProperty({}, privateTokens.inputWidth, innerWidth))
|
113
|
+
}), customDecrementButton || /*#__PURE__*/React.createElement(ActionButton, {
|
114
|
+
className: cx(classes.actionButtonDecrement, decrementButtonDisabled, solidViewClass, segmentedViewClass),
|
115
|
+
icon: decrementIcon || /*#__PURE__*/React.createElement(IconMinus, {
|
116
|
+
color: "inherit",
|
117
|
+
size: actionIconSize
|
118
|
+
}),
|
119
|
+
onClick: handleDecrement
|
120
|
+
}), /*#__PURE__*/React.createElement(NumberInput, _extends({
|
121
|
+
ref: ref,
|
122
|
+
segmentation: segmentation,
|
123
|
+
value: innerValue,
|
124
|
+
min: min,
|
125
|
+
max: max,
|
126
|
+
isManualInput: isManualInput,
|
127
|
+
textBefore: textBefore,
|
128
|
+
textAfter: textAfter,
|
129
|
+
isLoading: isLoading,
|
130
|
+
loader: loader,
|
131
|
+
disabled: disabled,
|
132
|
+
setInnerValue: setInnerValue,
|
133
|
+
onChange: onChange
|
134
|
+
}, rest)), customIncrementButton || /*#__PURE__*/React.createElement(ActionButton, {
|
135
|
+
className: cx(classes.actionButtonIncrement, incrementButtonDisabled, solidViewClass, segmentedViewClass),
|
136
|
+
icon: incrementIcon || /*#__PURE__*/React.createElement(IconPlus, {
|
137
|
+
color: "inherit",
|
138
|
+
size: actionIconSize
|
139
|
+
}),
|
140
|
+
onClick: handleIncrement
|
141
|
+
}));
|
142
|
+
});
|
143
|
+
};
|
144
|
+
var numberInputConfig = {
|
145
|
+
name: 'NumberInput',
|
146
|
+
tag: 'div',
|
147
|
+
layout: numberInputRoot,
|
148
|
+
base: base,
|
149
|
+
variations: {
|
150
|
+
view: {
|
151
|
+
css: base$1
|
152
|
+
},
|
153
|
+
size: {
|
154
|
+
css: base$2
|
155
|
+
},
|
156
|
+
shape: {
|
157
|
+
css: base$3
|
158
|
+
},
|
159
|
+
inputBackgroundType: {
|
160
|
+
css: base$4
|
161
|
+
},
|
162
|
+
segmentation: {
|
163
|
+
css: base$5
|
164
|
+
},
|
165
|
+
clear: {
|
166
|
+
css: base$6,
|
167
|
+
attrs: true
|
168
|
+
},
|
169
|
+
disabled: {
|
170
|
+
css: base$7,
|
171
|
+
attrs: true
|
172
|
+
}
|
173
|
+
},
|
174
|
+
defaults: {
|
175
|
+
view: 'default',
|
176
|
+
size: 'l',
|
177
|
+
shape: 'cornered',
|
178
|
+
segmentation: 'default'
|
179
|
+
}
|
180
|
+
};
|
181
|
+
|
182
|
+
export { numberInputConfig, numberInputRoot };
|
183
|
+
//# sourceMappingURL=NumberInput.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"NumberInput.js","sources":["../../../src/components/NumberInput/NumberInput.tsx"],"sourcesContent":["import React, { CSSProperties, forwardRef, useState } from 'react';\n\nimport type { RootProps } from '../../engines';\nimport { cx, getSizeValueFromProp } 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 clearCSS } from './variations/_clear/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\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\n const isMinValue = (currentValue: number) => min && currentValue <= min;\n const isMaxValue = (currentValue: number) => max && currentValue >= max;\n\n const decrementButtonDisabled =\n isMinValue(Number(innerValue)) || isLoading ? classes.actionButtonDecrementDisabled : undefined;\n const incrementButtonDisabled =\n isMaxValue(Number(innerValue)) || isLoading ? classes.actionButtonIncrementDisabled : undefined;\n\n const handleDecrement = () => {\n if (isLoading || disabled) {\n return;\n }\n\n const diffValue = Number(innerValue) - step;\n const resValue = !isMinValue(diffValue) ? diffValue : Number(min);\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) {\n return;\n }\n\n const diffValue = Number(innerValue) + step;\n const resValue = !isMaxValue(diffValue) ? diffValue : Number(max);\n\n setInnerValue(resValue);\n\n if (onIncrement) {\n onIncrement(resValue);\n }\n\n if (onChange) {\n onChange(null, resValue);\n }\n };\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(className, solidViewClass, clearViewClass, disabledClass)}\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 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 clear: {\n css: clearCSS,\n attrs: true,\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","innerWidth","getSizeValueFromProp","actionIconSize","solidViewClass","classes","solidView","undefined","segmentedViewClass","segmentedView","clearViewClass","clearView","disabledClass","isMinValue","currentValue","isMaxValue","decrementButtonDisabled","Number","actionButtonDecrementDisabled","incrementButtonDisabled","actionButtonIncrementDisabled","handleDecrement","diffValue","resValue","handleIncrement","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","clearCSS","attrs","disabledCSS","defaults"],"mappings":";;;;;;;;;;;;;;;;;;;IAkBaA,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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U;AACjBC,IAAAA,YAAY,EAAE,SAAA;AAClB,GAAA;AACJ;;;;"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"NumberInput.styles.js","sources":["../../../src/components/NumberInput/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,84 @@
|
|
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
|
+
};
|
14
|
+
var privateTokens = {
|
15
|
+
inputWidth: '--plasma_private-number-input_width',
|
16
|
+
segmentationBorderRadius: '--plasma_private-segemntation-border-radius'
|
17
|
+
};
|
18
|
+
var tokens = {
|
19
|
+
// Root size tokens
|
20
|
+
rootMinWidth: '--plasma-number-input_min-width',
|
21
|
+
disabledOpacity: '--plasma-number-input_disabled-opacity',
|
22
|
+
// Action button view tokens
|
23
|
+
iconButtonColor: '--plasma-number-input_icon-button_color',
|
24
|
+
iconButtonBackgroundColor: '--plasma-number-input_icon-button_background-color',
|
25
|
+
iconButtonColorHover: '--plasma-number-input_icon-button_color-hover',
|
26
|
+
iconButtonBackgroundColorHover: '--plasma-number-input_icon-button_background-color-hover',
|
27
|
+
iconButtonColorActive: '--plasma-number-input_icon-button_color-active',
|
28
|
+
iconButtonBackgroundColorActive: '--plasma-number-input_icon-button_background-color-active',
|
29
|
+
iconButtonColorClear: '--plasma-number-input_icon-button_color-clear',
|
30
|
+
actionButtonDisabledOpacity: '--plasma-number-input_action-button_disabled-opacity',
|
31
|
+
// Action button size tokens
|
32
|
+
iconButtonHeight: '--plasma-number-input_icon-button_height',
|
33
|
+
iconButtonWidth: '--plasma-number-input_icon-button_width',
|
34
|
+
iconButtonPadding: '--plasma-number-input_icon-button_padding',
|
35
|
+
iconButtonRadius: '--plasma-number-input_icon-button_radius',
|
36
|
+
iconButtonSegmentationRadius: '--plasma-number-input_icon-button_segmentation_radius',
|
37
|
+
iconButtonFontFamily: '--plasma-number-input_icon-button_font-family',
|
38
|
+
iconButtonFontSize: '--plasma-number-input_icon-button_font-size',
|
39
|
+
iconButtonFontStyle: '--plasma-number-input_icon-button_font-style',
|
40
|
+
iconButtonFontWeight: '--plasma-number-input_icon-button_font-weight',
|
41
|
+
iconButtonLetterSpacing: '--plasma-number-input_icon-button_letter-spacing',
|
42
|
+
iconButtonLineHeight: '--plasma-number-input_icon-button_line-height',
|
43
|
+
// Input size tokens
|
44
|
+
inputWrapperBorderWidth: '--plasma-number-input_input-wrapper_border-width',
|
45
|
+
inputWrapperMargin: '--plasma-number-input_input-wrapper_margin',
|
46
|
+
inputWrapperBorderRadius: '--plasma-number-input_input-wrapper_border-radius',
|
47
|
+
textWrapperHeight: '--plasma-number-input_text-wrapper_height',
|
48
|
+
textWrapperPadding: '--plasma-number-input_text-wrapper_padding',
|
49
|
+
fontFamily: '--plasma-number-input_font-family',
|
50
|
+
fontStyle: '--plasma-number-input_font-style',
|
51
|
+
fontSize: '--plasma-number-input_font-size',
|
52
|
+
fontWeight: '--plasma-number-input_font-weight',
|
53
|
+
letterSpacing: '--plasma-number-input_letter-spacing',
|
54
|
+
lineHeight: '--plasma-number-input_line-height',
|
55
|
+
textBeforeMarginRight: '--plasma-number-input_text-before_margin-right',
|
56
|
+
textAfterMarginLeft: '--plasma-number-input_text-after_margin-left',
|
57
|
+
// Input view tokens
|
58
|
+
caretColor: '--plasma-number-input_caret_color',
|
59
|
+
caretColorSolid: '--plasma-number-input_caret_color-solid',
|
60
|
+
color: '--plasma-number-input_color',
|
61
|
+
colorSolid: '--plasma-number-input_color-solid',
|
62
|
+
colorClear: '--plasma-number-input_color-clear',
|
63
|
+
backgroundColor: '--plasma-number-input_background-color',
|
64
|
+
backgroundColorHover: '--plasma-number-input_background-color-hover',
|
65
|
+
backgroundColorFocus: '--plasma-number-input_background-color-focus',
|
66
|
+
backgroundColorSolidFocus: '--plasma-number-input_background-color-solid-focus',
|
67
|
+
backgroundColorSolid: '--plasma-number-input_background-color-solid',
|
68
|
+
borderColor: '--plasma-number-input_border-color',
|
69
|
+
borderColorHover: '--plasma-number-input_border-color-hover',
|
70
|
+
borderColorFocus: '--plasma-number-input_border-color-focus',
|
71
|
+
borderColorSolidFocus: '--plasma-number-input_border-color-solid-focus',
|
72
|
+
borderColorSolid: '--plasma-number-input_border-color-solid',
|
73
|
+
additionalTextColor: '--plasma-number-input_additional-text_color',
|
74
|
+
additionalTextColorSolid: '--plasma-number-input_additional-text_color-solid',
|
75
|
+
additionalTextColorClear: '--plasma-number-input_additional-text_color-clear',
|
76
|
+
errorColor: '--plasma-number-input_error-color',
|
77
|
+
// Loader tokens
|
78
|
+
loaderSpinnerSize: '--plasma-number-input_loader-spinner_size',
|
79
|
+
loaderSpinnerColor: '--plasma-number-input_loader-spinner_color',
|
80
|
+
loaderSpinnerColorSolid: '--plasma-number-input_loader-spinner_color-solid'
|
81
|
+
};
|
82
|
+
|
83
|
+
export { classes, privateTokens, tokens };
|
84
|
+
//# 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};\n\nexport const privateTokens = {\n inputWidth: '--plasma_private-number-input_width',\n segmentationBorderRadius: '--plasma_private-segemntation-border-radius',\n};\n\nexport const tokens = {\n // Root size tokens\n rootMinWidth: '--plasma-number-input_min-width',\n disabledOpacity: '--plasma-number-input_disabled-opacity',\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 iconButtonBackgroundColorHover: '--plasma-number-input_icon-button_background-color-hover',\n iconButtonColorActive: '--plasma-number-input_icon-button_color-active',\n iconButtonBackgroundColorActive: '--plasma-number-input_icon-button_background-color-active',\n\n iconButtonColorClear: '--plasma-number-input_icon-button_color-clear',\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 colorClear: '--plasma-number-input_color-clear',\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 additionalTextColorClear: '--plasma-number-input_additional-text_color-clear',\n\n errorColor: '--plasma-number-input_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","privateTokens","inputWidth","segmentationBorderRadius","tokens","rootMinWidth","disabledOpacity","iconButtonColor","iconButtonBackgroundColor","iconButtonColorHover","iconButtonBackgroundColorHover","iconButtonColorActive","iconButtonBackgroundColorActive","iconButtonColorClear","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","colorClear","backgroundColor","backgroundColorHover","backgroundColorFocus","backgroundColorSolidFocus","backgroundColorSolid","borderColor","borderColorHover","borderColorFocus","borderColorSolidFocus","borderColorSolid","additionalTextColor","additionalTextColorSolid","additionalTextColorClear","errorColor","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,uBAAA;AACd,EAAC;AAEM,IAAMC,aAAa,GAAG;AACzBC,EAAAA,UAAU,EAAE,qCAAqC;AACjDC,EAAAA,wBAA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C;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,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;AAC7EC,EAAAA,wBAAwB,EAAE,mDAAmD;AAE7EC,EAAAA,UAAU,EAAE,mCAAmC;AAE/C;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_jszc0c_i1s8bsh6__6eb57599{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_jszc0c_i1s8bsh6__6eb57599::-webkit-scrollbar{display:none;}
|
9
|
+
.Input_styles_jszc0c_t6wb9c__6eb57599{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_jszc0c_d1n4jo6t__6eb57599{position:relative;}
|
14
|
+
.Input_styles_jszc0c_i1tgbhg7__6eb57599{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;}.Input_styles_jszc0c_i1tgbhg7__6eb57599.Input_styles_jszc0c_i1tgbhg7__6eb57599.Input_styles_jszc0c_errorAnimation__6eb57599{color:var(--plasma-number-input_error-color);-webkit-animation:Input_styles_jszc0c_shakingErrorI1tgbhg7__6eb57599 0.5s forwards;animation:Input_styles_jszc0c_shakingErrorI1tgbhg7__6eb57599 0.5s forwards;}@-webkit-keyframes Input_styles_jszc0c_shakingErrorI1tgbhg7__6eb57599{0%{opacity:1;}12.5%{-webkit-transform:translateX(0.188rem);-ms-transform:translateX(0.188rem);transform:translateX(0.188rem);}25%{-webkit-transform:translateX(-0.188rem);-ms-transform:translateX(-0.188rem);transform:translateX(-0.188rem);}37.5%{-webkit-transform:translateX(0.188rem);-ms-transform:translateX(0.188rem);transform:translateX(0.188rem);}50%{opacity:1;-webkit-transform:translateX(-0.188rem);-ms-transform:translateX(-0.188rem);transform:translateX(-0.188rem);}62.5%{-webkit-transform:translateX(0.188rem);-ms-transform:translateX(0.188rem);transform:translateX(0.188rem);}75%{-webkit-transform:translateX(-0.188rem);-ms-transform:translateX(-0.188rem);transform:translateX(-0.188rem);}87.5%{-webkit-transform:translateX(0.188rem);-ms-transform:translateX(0.188rem);transform:translateX(0.188rem);}100%{opacity:0;-webkit-transform:translateX(-0.188rem);-ms-transform:translateX(-0.188rem);transform:translateX(-0.188rem);}}@keyframes Input_styles_jszc0c_shakingErrorI1tgbhg7__6eb57599{0%{opacity:1;}12.5%{-webkit-transform:translateX(0.188rem);-ms-transform:translateX(0.188rem);transform:translateX(0.188rem);}25%{-webkit-transform:translateX(-0.188rem);-ms-transform:translateX(-0.188rem);transform:translateX(-0.188rem);}37.5%{-webkit-transform:translateX(0.188rem);-ms-transform:translateX(0.188rem);transform:translateX(0.188rem);}50%{opacity:1;-webkit-transform:translateX(-0.188rem);-ms-transform:translateX(-0.188rem);transform:translateX(-0.188rem);}62.5%{-webkit-transform:translateX(0.188rem);-ms-transform:translateX(0.188rem);transform:translateX(0.188rem);}75%{-webkit-transform:translateX(-0.188rem);-ms-transform:translateX(-0.188rem);transform:translateX(-0.188rem);}87.5%{-webkit-transform:translateX(0.188rem);-ms-transform:translateX(0.188rem);transform:translateX(0.188rem);}100%{opacity:0;-webkit-transform:translateX(-0.188rem);-ms-transform:translateX(-0.188rem);transform:translateX(-0.188rem);}}
|
15
|
+
.Input_styles_jszc0c_i1il5xze__6eb57599{position:absolute;z-index:-999;visibility:hidden;top:0;left:0;opacity:0;height:0;white-space:pre;}
|
@@ -0,0 +1,186 @@
|
|
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 { numberPettern } 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", "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
|
+
setInnerValue = _ref.setInnerValue,
|
26
|
+
onChange = _ref.onChange,
|
27
|
+
onBlur = _ref.onBlur,
|
28
|
+
onKeyDown = _ref.onKeyDown,
|
29
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
30
|
+
var _useState = useState(value ? "".concat(String(value).length, "ch") : '1ch'),
|
31
|
+
_useState2 = _slicedToArray(_useState, 2),
|
32
|
+
dynamicWidth = _useState2[0],
|
33
|
+
setDynamicWidth = _useState2[1];
|
34
|
+
var _useState3 = useState(Number(value)),
|
35
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
36
|
+
lastValidValue = _useState4[0],
|
37
|
+
setLastValidValue = _useState4[1];
|
38
|
+
var _useState5 = useState(undefined),
|
39
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
40
|
+
errorClass = _useState6[0],
|
41
|
+
setErrorClass = _useState6[1];
|
42
|
+
var _useState7 = useState(),
|
43
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
44
|
+
errorValue = _useState8[0],
|
45
|
+
setErrorValue = _useState8[1];
|
46
|
+
var inputHelperRef = useRef(null);
|
47
|
+
var wrapperRef = useRef(null);
|
48
|
+
var textWrapperRef = useRef(null);
|
49
|
+
var inputRef = useRef(null);
|
50
|
+
var inputForkRef = useForkRef(inputRef, ref);
|
51
|
+
var solidViewClass = segmentation === 'solid' ? classes.solidView : undefined;
|
52
|
+
var handleClickInputWrapper = function handleClickInputWrapper() {
|
53
|
+
var _inputRef$current;
|
54
|
+
if (!isManualInput) {
|
55
|
+
return;
|
56
|
+
}
|
57
|
+
inputRef === null || inputRef === void 0 || (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus();
|
58
|
+
};
|
59
|
+
var getInputWidth = function getInputWidth() {
|
60
|
+
var _inputHelperRef$curre;
|
61
|
+
var firstRender = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
62
|
+
if (!firstRender && (_inputHelperRef$curre = inputHelperRef.current) !== null && _inputHelperRef$curre !== void 0 && _inputHelperRef$curre.clientWidth) {
|
63
|
+
var _inputHelperRef$curre2;
|
64
|
+
return "".concat((_inputHelperRef$curre2 = inputHelperRef.current) === null || _inputHelperRef$curre2 === void 0 ? void 0 : _inputHelperRef$curre2.clientWidth, "px");
|
65
|
+
}
|
66
|
+
if (value) {
|
67
|
+
return "".concat(String(value).length, "ch");
|
68
|
+
}
|
69
|
+
return '1ch';
|
70
|
+
};
|
71
|
+
var setValues = function setValues(event, newValue) {
|
72
|
+
setLastValidValue(newValue);
|
73
|
+
setInnerValue(newValue);
|
74
|
+
if (onChange) {
|
75
|
+
onChange(event, newValue);
|
76
|
+
}
|
77
|
+
};
|
78
|
+
var handleManualInputChange = function handleManualInputChange(event) {
|
79
|
+
var _textWrapperRef$curre, _wrapperRef$current;
|
80
|
+
if (!isManualInput || disabled) {
|
81
|
+
return;
|
82
|
+
}
|
83
|
+
var newValue = event.target.value;
|
84
|
+
if (!newValue) {
|
85
|
+
setInnerValue('');
|
86
|
+
if (onChange) {
|
87
|
+
onChange(event, '');
|
88
|
+
}
|
89
|
+
return;
|
90
|
+
}
|
91
|
+
var cleanValue = newValue.replace(/[^-.\d]/g, '');
|
92
|
+
if (cleanValue.endsWith('.')) {
|
93
|
+
setInnerValue(cleanValue);
|
94
|
+
if (onChange) {
|
95
|
+
onChange(event, cleanValue);
|
96
|
+
}
|
97
|
+
return;
|
98
|
+
}
|
99
|
+
var isValid = numberPettern.test(cleanValue);
|
100
|
+
if (!isValid) {
|
101
|
+
setValues(event, lastValidValue);
|
102
|
+
return;
|
103
|
+
}
|
104
|
+
var resValue = Number(cleanValue);
|
105
|
+
if (max && resValue > max) {
|
106
|
+
setErrorClass(classes.errorAnimation);
|
107
|
+
setErrorValue(max);
|
108
|
+
return;
|
109
|
+
}
|
110
|
+
if (min && resValue < min) {
|
111
|
+
setErrorClass(classes.errorAnimation);
|
112
|
+
setErrorValue(min);
|
113
|
+
return;
|
114
|
+
}
|
115
|
+
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)) {
|
116
|
+
wrapperRef.current.scrollLeft = textWrapperRef.current.offsetWidth - textWrapperRef.current.offsetLeft || 0;
|
117
|
+
}
|
118
|
+
setValues(event, resValue);
|
119
|
+
};
|
120
|
+
var handleBlur = function handleBlur(event) {
|
121
|
+
if (!value || !isNumber(value)) {
|
122
|
+
setValues(null, lastValidValue);
|
123
|
+
} else if (String(value).endsWith('.')) {
|
124
|
+
setValues(null, Number(value));
|
125
|
+
}
|
126
|
+
if (onBlur) {
|
127
|
+
onBlur(event);
|
128
|
+
}
|
129
|
+
};
|
130
|
+
var handleKeyDown = function handleKeyDown(event) {
|
131
|
+
if (!isManualInput || disabled) {
|
132
|
+
return;
|
133
|
+
}
|
134
|
+
if (event.keyCode === keyCodes.Enter) {
|
135
|
+
event.preventDefault();
|
136
|
+
if (!value || !isNumber(value)) {
|
137
|
+
setValues(null, lastValidValue);
|
138
|
+
} else if (String(value).endsWith('.')) {
|
139
|
+
setValues(null, Number(value));
|
140
|
+
}
|
141
|
+
if (onKeyDown) {
|
142
|
+
onKeyDown(event);
|
143
|
+
}
|
144
|
+
}
|
145
|
+
};
|
146
|
+
var handleEndErrorAnimation = function handleEndErrorAnimation(correctValue) {
|
147
|
+
setErrorClass(undefined);
|
148
|
+
setValues(null, correctValue);
|
149
|
+
};
|
150
|
+
useEffect(function () {
|
151
|
+
setDynamicWidth(getInputWidth());
|
152
|
+
}, []);
|
153
|
+
useDidMountEffect(function () {
|
154
|
+
setDynamicWidth(getInputWidth(false));
|
155
|
+
}, [value]);
|
156
|
+
return /*#__PURE__*/React.createElement(InputWrapper, {
|
157
|
+
ref: wrapperRef,
|
158
|
+
className: cx(solidViewClass),
|
159
|
+
isManualInput: Boolean(isManualInput),
|
160
|
+
onClick: handleClickInputWrapper
|
161
|
+
}, /*#__PURE__*/React.createElement(TextWrapper, {
|
162
|
+
ref: textWrapperRef
|
163
|
+
}, textBefore && /*#__PURE__*/React.createElement(AdditionalText, {
|
164
|
+
className: classes.textBefore
|
165
|
+
}, 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({
|
166
|
+
ref: inputForkRef,
|
167
|
+
className: cx(errorClass),
|
168
|
+
dynamicWidth: dynamicWidth,
|
169
|
+
value: value,
|
170
|
+
isManualInput: Boolean(isManualInput),
|
171
|
+
tabIndex: disabled || !isManualInput ? -1 : 0,
|
172
|
+
onChange: handleManualInputChange,
|
173
|
+
onBlur: handleBlur,
|
174
|
+
onKeyDown: handleKeyDown,
|
175
|
+
onAnimationEnd: function onAnimationEnd() {
|
176
|
+
return handleEndErrorAnimation(Number(errorValue));
|
177
|
+
}
|
178
|
+
}, rest)), /*#__PURE__*/React.createElement(InputWidthHelper, {
|
179
|
+
ref: inputHelperRef
|
180
|
+
}, value)), textAfter && /*#__PURE__*/React.createElement(AdditionalText, {
|
181
|
+
className: classes.textAfter
|
182
|
+
}, textAfter)));
|
183
|
+
});
|
184
|
+
|
185
|
+
export { NumberInput };
|
186
|
+
//# sourceMappingURL=Input.js.map
|