@salutejs/plasma-new-hope 0.174.0-canary.1505.11518120718.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/Select/Select.d.ts.map +1 -1
- package/types/components/Select/Select.types.d.ts +0 -1
- 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_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/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,81 @@
|
|
1
|
+
export 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
|
+
export var privateTokens = {
|
15
|
+
inputWidth: '--plasma_private-number-input_width',
|
16
|
+
segmentationBorderRadius: '--plasma_private-segemntation-border-radius'
|
17
|
+
};
|
18
|
+
export 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
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { StyledIconButton } from './ActionButton.styles';
|
3
|
+
export var ActionButton = function ActionButton(_ref) {
|
4
|
+
var icon = _ref.icon,
|
5
|
+
className = _ref.className,
|
6
|
+
onClick = _ref.onClick;
|
7
|
+
return /*#__PURE__*/React.createElement(StyledIconButton, {
|
8
|
+
className: className,
|
9
|
+
onClick: onClick
|
10
|
+
}, icon);
|
11
|
+
};
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import styled from 'styled-components';
|
2
|
+
import { iconButtonConfig } from '../../../IconButton';
|
3
|
+
import { component, mergeConfig } from '../../../../engines';
|
4
|
+
var mergedIconButtonConfig = /*#__PURE__*/mergeConfig(iconButtonConfig);
|
5
|
+
var IconButton = /*#__PURE__*/component(mergedIconButtonConfig);
|
6
|
+
export var StyledIconButton = /*#__PURE__*/styled(IconButton).withConfig({
|
7
|
+
componentId: "plasma-new-hope__sc-kcpqrq-0"
|
8
|
+
})([""]);
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,189 @@
|
|
1
|
+
var _StyledSpinner;
|
2
|
+
var _excluded = ["value", "min", "max", "isLoading", "loader", "disabled", "segmentation", "textBefore", "textAfter", "isManualInput", "setInnerValue", "onChange", "onBlur", "onKeyDown"];
|
3
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
4
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
5
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
6
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
7
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
8
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
9
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
10
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
11
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
12
|
+
import React, { forwardRef, useEffect, useRef, useState } from 'react';
|
13
|
+
import { useForkRef } from '@salutejs/plasma-core';
|
14
|
+
import { classes } from '../../NumberInput.tokens';
|
15
|
+
import { cx, isNumber } from '../../../../utils';
|
16
|
+
import { useDidMountEffect } from '../../../../hooks';
|
17
|
+
import { numberPettern } from '../../utils';
|
18
|
+
import { keyCodes } from '../../../../utils/constants';
|
19
|
+
import { AdditionalText, Input, InputWrapper, DynamicInput, InputWidthHelper, TextWrapper, StyledSpinner, Loader } from './Input.styles';
|
20
|
+
export var NumberInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
21
|
+
var value = _ref.value,
|
22
|
+
min = _ref.min,
|
23
|
+
max = _ref.max,
|
24
|
+
isLoading = _ref.isLoading,
|
25
|
+
loader = _ref.loader,
|
26
|
+
disabled = _ref.disabled,
|
27
|
+
segmentation = _ref.segmentation,
|
28
|
+
textBefore = _ref.textBefore,
|
29
|
+
textAfter = _ref.textAfter,
|
30
|
+
isManualInput = _ref.isManualInput,
|
31
|
+
setInnerValue = _ref.setInnerValue,
|
32
|
+
onChange = _ref.onChange,
|
33
|
+
onBlur = _ref.onBlur,
|
34
|
+
onKeyDown = _ref.onKeyDown,
|
35
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
36
|
+
var _useState = useState(value ? "".concat(String(value).length, "ch") : '1ch'),
|
37
|
+
_useState2 = _slicedToArray(_useState, 2),
|
38
|
+
dynamicWidth = _useState2[0],
|
39
|
+
setDynamicWidth = _useState2[1];
|
40
|
+
var _useState3 = useState(Number(value)),
|
41
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
42
|
+
lastValidValue = _useState4[0],
|
43
|
+
setLastValidValue = _useState4[1];
|
44
|
+
var _useState5 = useState(undefined),
|
45
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
46
|
+
errorClass = _useState6[0],
|
47
|
+
setErrorClass = _useState6[1];
|
48
|
+
var _useState7 = useState(),
|
49
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
50
|
+
errorValue = _useState8[0],
|
51
|
+
setErrorValue = _useState8[1];
|
52
|
+
var inputHelperRef = useRef(null);
|
53
|
+
var wrapperRef = useRef(null);
|
54
|
+
var textWrapperRef = useRef(null);
|
55
|
+
var inputRef = useRef(null);
|
56
|
+
var inputForkRef = useForkRef(inputRef, ref);
|
57
|
+
var solidViewClass = segmentation === 'solid' ? classes.solidView : undefined;
|
58
|
+
var handleClickInputWrapper = function handleClickInputWrapper() {
|
59
|
+
var _inputRef$current;
|
60
|
+
if (!isManualInput) {
|
61
|
+
return;
|
62
|
+
}
|
63
|
+
inputRef === null || inputRef === void 0 || (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus();
|
64
|
+
};
|
65
|
+
var getInputWidth = function getInputWidth() {
|
66
|
+
var _inputHelperRef$curre;
|
67
|
+
var firstRender = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
68
|
+
if (!firstRender && (_inputHelperRef$curre = inputHelperRef.current) !== null && _inputHelperRef$curre !== void 0 && _inputHelperRef$curre.clientWidth) {
|
69
|
+
var _inputHelperRef$curre2;
|
70
|
+
return "".concat((_inputHelperRef$curre2 = inputHelperRef.current) === null || _inputHelperRef$curre2 === void 0 ? void 0 : _inputHelperRef$curre2.clientWidth, "px");
|
71
|
+
}
|
72
|
+
if (value) {
|
73
|
+
return "".concat(String(value).length, "ch");
|
74
|
+
}
|
75
|
+
return '1ch';
|
76
|
+
};
|
77
|
+
var setValues = function setValues(event, newValue) {
|
78
|
+
setLastValidValue(newValue);
|
79
|
+
setInnerValue(newValue);
|
80
|
+
if (onChange) {
|
81
|
+
onChange(event, newValue);
|
82
|
+
}
|
83
|
+
};
|
84
|
+
var handleManualInputChange = function handleManualInputChange(event) {
|
85
|
+
var _textWrapperRef$curre, _wrapperRef$current;
|
86
|
+
if (!isManualInput || disabled) {
|
87
|
+
return;
|
88
|
+
}
|
89
|
+
var newValue = event.target.value;
|
90
|
+
if (!newValue) {
|
91
|
+
setInnerValue('');
|
92
|
+
if (onChange) {
|
93
|
+
onChange(event, '');
|
94
|
+
}
|
95
|
+
return;
|
96
|
+
}
|
97
|
+
var cleanValue = newValue.replace(/[^-.\d]/g, '');
|
98
|
+
if (cleanValue.endsWith('.')) {
|
99
|
+
setInnerValue(cleanValue);
|
100
|
+
if (onChange) {
|
101
|
+
onChange(event, cleanValue);
|
102
|
+
}
|
103
|
+
return;
|
104
|
+
}
|
105
|
+
var isValid = numberPettern.test(cleanValue);
|
106
|
+
if (!isValid) {
|
107
|
+
setValues(event, lastValidValue);
|
108
|
+
return;
|
109
|
+
}
|
110
|
+
var resValue = Number(cleanValue);
|
111
|
+
if (max && resValue > max) {
|
112
|
+
setErrorClass(classes.errorAnimation);
|
113
|
+
setErrorValue(max);
|
114
|
+
return;
|
115
|
+
}
|
116
|
+
if (min && resValue < min) {
|
117
|
+
setErrorClass(classes.errorAnimation);
|
118
|
+
setErrorValue(min);
|
119
|
+
return;
|
120
|
+
}
|
121
|
+
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)) {
|
122
|
+
wrapperRef.current.scrollLeft = textWrapperRef.current.offsetWidth - textWrapperRef.current.offsetLeft || 0;
|
123
|
+
}
|
124
|
+
setValues(event, resValue);
|
125
|
+
};
|
126
|
+
var handleBlur = function handleBlur(event) {
|
127
|
+
if (!value || !isNumber(value)) {
|
128
|
+
setValues(null, lastValidValue);
|
129
|
+
} else if (String(value).endsWith('.')) {
|
130
|
+
setValues(null, Number(value));
|
131
|
+
}
|
132
|
+
if (onBlur) {
|
133
|
+
onBlur(event);
|
134
|
+
}
|
135
|
+
};
|
136
|
+
var handleKeyDown = function handleKeyDown(event) {
|
137
|
+
if (!isManualInput || disabled) {
|
138
|
+
return;
|
139
|
+
}
|
140
|
+
if (event.keyCode === keyCodes.Enter) {
|
141
|
+
event.preventDefault();
|
142
|
+
if (!value || !isNumber(value)) {
|
143
|
+
setValues(null, lastValidValue);
|
144
|
+
} else if (String(value).endsWith('.')) {
|
145
|
+
setValues(null, Number(value));
|
146
|
+
}
|
147
|
+
if (onKeyDown) {
|
148
|
+
onKeyDown(event);
|
149
|
+
}
|
150
|
+
}
|
151
|
+
};
|
152
|
+
var handleEndErrorAnimation = function handleEndErrorAnimation(correctValue) {
|
153
|
+
setErrorClass(undefined);
|
154
|
+
setValues(null, correctValue);
|
155
|
+
};
|
156
|
+
useEffect(function () {
|
157
|
+
setDynamicWidth(getInputWidth());
|
158
|
+
}, []);
|
159
|
+
useDidMountEffect(function () {
|
160
|
+
setDynamicWidth(getInputWidth(false));
|
161
|
+
}, [value]);
|
162
|
+
return /*#__PURE__*/React.createElement(InputWrapper, {
|
163
|
+
ref: wrapperRef,
|
164
|
+
className: cx(solidViewClass),
|
165
|
+
isManualInput: Boolean(isManualInput),
|
166
|
+
onClick: handleClickInputWrapper
|
167
|
+
}, /*#__PURE__*/React.createElement(TextWrapper, {
|
168
|
+
ref: textWrapperRef
|
169
|
+
}, textBefore && /*#__PURE__*/React.createElement(AdditionalText, {
|
170
|
+
className: classes.textBefore
|
171
|
+
}, 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({
|
172
|
+
ref: inputForkRef,
|
173
|
+
className: cx(errorClass),
|
174
|
+
dynamicWidth: dynamicWidth,
|
175
|
+
value: value,
|
176
|
+
isManualInput: Boolean(isManualInput),
|
177
|
+
tabIndex: disabled || !isManualInput ? -1 : 0,
|
178
|
+
onChange: handleManualInputChange,
|
179
|
+
onBlur: handleBlur,
|
180
|
+
onKeyDown: handleKeyDown,
|
181
|
+
onAnimationEnd: function onAnimationEnd() {
|
182
|
+
return handleEndErrorAnimation(Number(errorValue));
|
183
|
+
}
|
184
|
+
}, rest)), /*#__PURE__*/React.createElement(InputWidthHelper, {
|
185
|
+
ref: inputHelperRef
|
186
|
+
}, value)), textAfter && /*#__PURE__*/React.createElement(AdditionalText, {
|
187
|
+
className: classes.textAfter
|
188
|
+
}, textAfter)));
|
189
|
+
});
|
@@ -0,0 +1,42 @@
|
|
1
|
+
import styled from 'styled-components';
|
2
|
+
import { component, mergeConfig } from '../../../../engines';
|
3
|
+
import { spinnerConfig } from '../../../Spinner';
|
4
|
+
import { classes, tokens } from '../../NumberInput.tokens';
|
5
|
+
var mergedConfig = /*#__PURE__*/mergeConfig(spinnerConfig);
|
6
|
+
var Spinner = /*#__PURE__*/component(mergedConfig);
|
7
|
+
export var InputWrapper = /*#__PURE__*/styled.div.withConfig({
|
8
|
+
componentId: "plasma-new-hope__sc-i0o2ki-0"
|
9
|
+
})(["overflow-x:auto;overflow-y:hidden;flex:1;cursor:", ";::-webkit-scrollbar{display:none;}scrollbar-width:none;overscroll-behavior:contain;"], function (_ref) {
|
10
|
+
var isManualInput = _ref.isManualInput;
|
11
|
+
return isManualInput ? 'text' : 'default';
|
12
|
+
});
|
13
|
+
export var TextWrapper = /*#__PURE__*/styled.div.withConfig({
|
14
|
+
componentId: "plasma-new-hope__sc-i0o2ki-1"
|
15
|
+
})(["display:flex;align-items:center;justify-content:center;width:fit-content;margin:0 auto;box-sizing:border-box;"]);
|
16
|
+
export var AdditionalText = /*#__PURE__*/styled.span.withConfig({
|
17
|
+
componentId: "plasma-new-hope__sc-i0o2ki-2"
|
18
|
+
})([""]);
|
19
|
+
export var Loader = /*#__PURE__*/styled.div.withConfig({
|
20
|
+
componentId: "plasma-new-hope__sc-i0o2ki-3"
|
21
|
+
})([""]);
|
22
|
+
export var StyledSpinner = /*#__PURE__*/styled(Spinner).withConfig({
|
23
|
+
componentId: "plasma-new-hope__sc-i0o2ki-4"
|
24
|
+
})([""]);
|
25
|
+
export var DynamicInput = /*#__PURE__*/styled.div.withConfig({
|
26
|
+
componentId: "plasma-new-hope__sc-i0o2ki-5"
|
27
|
+
})(["position:relative;"]);
|
28
|
+
export var Input = /*#__PURE__*/styled.input.withConfig({
|
29
|
+
componentId: "plasma-new-hope__sc-i0o2ki-6"
|
30
|
+
})(["box-sizing:border-box;appearance:none;border:0;padding:0;background-color:transparent;outline:none;width:", ";box-sizing:border-box;cursor:", ";pointer-events:", ";transition:width 0.1s;&&.", "{color:var(", ");animation:shakingError 0.5s forwards;}@keyframes shakingError{0%{opacity:1;}12.5%{transform:translateX(0.188rem);}25%{transform:translateX(-0.188rem);}37.5%{transform:translateX(0.188rem);}50%{opacity:1;transform:translateX(-0.188rem);}62.5%{transform:translateX(0.188rem);}75%{transform:translateX(-0.188rem);}87.5%{transform:translateX(0.188rem);}100%{opacity:0;transform:translateX(-0.188rem);}}"], function (_ref2) {
|
31
|
+
var dynamicWidth = _ref2.dynamicWidth;
|
32
|
+
return dynamicWidth;
|
33
|
+
}, function (_ref3) {
|
34
|
+
var isManualInput = _ref3.isManualInput;
|
35
|
+
return isManualInput ? 'text' : 'default';
|
36
|
+
}, function (_ref4) {
|
37
|
+
var isManualInput = _ref4.isManualInput;
|
38
|
+
return isManualInput ? 'initial' : 'none';
|
39
|
+
}, classes.errorAnimation, tokens.errorColor);
|
40
|
+
export var InputWidthHelper = /*#__PURE__*/styled.span.withConfig({
|
41
|
+
componentId: "plasma-new-hope__sc-i0o2ki-7"
|
42
|
+
})(["position:absolute;z-index:-999;visibility:hidden;top:0;left:0;opacity:0;height:0;white-space:pre;"]);
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export var numberPettern = /^(-)?\d+(\.\d+)?$/;
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import { css } from 'styled-components';
|
2
|
+
import { tokens } from '../../NumberInput.tokens';
|
3
|
+
import { InputWrapper } from '../../ui/Input/Input.styles';
|
4
|
+
export var base = /*#__PURE__*/css(["", "{background-color:var(", ");box-shadow:inset 0 0 0 var(", ") var(", ");&:hover{background-color:var(", ");box-shadow:inset 0 0 0 var(", ") var(", ");}}"], InputWrapper, tokens.backgroundColor, tokens.inputWrapperBorderWidth, tokens.borderColor, tokens.backgroundColorHover, tokens.inputWrapperBorderWidth, tokens.borderColorHover);
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { css } from 'styled-components';
|
2
|
+
import { classes, tokens } from '../../NumberInput.tokens';
|
3
|
+
import { iconButtonTokens } from '../../../IconButton';
|
4
|
+
import { StyledIconButton } from '../../ui/ActionButton/ActionButton.styles';
|
5
|
+
import { AdditionalText, Input, InputWrapper } from '../../ui/Input/Input.styles';
|
6
|
+
export var base = /*#__PURE__*/css(["&.", "{background:transparent;", "{", ":var(", ");", ":transparent;", ":var(", ");", ":transparent;", ":var(", ");", ":transparent;:hover,:active{color:var(", ");background-color:transparent;}&.", ",&.", "{:hover,:active{color:var(", ");background-color:transparent;}}}&& ", "{background-color:transparent;box-shadow:transparent;&:focus-within{background-color:var(", ");box-shadow:inset 0 0 0 var(", ") var(", ");}}", "{caret-color:var(", ");&:not(.", "){color:var(", ");}}", "{color:var(", ");}}"], classes.clearView, StyledIconButton, iconButtonTokens.iconButtonColor, tokens.iconButtonColorClear, iconButtonTokens.iconButtonBackgroundColor, iconButtonTokens.iconButtonColorHover, tokens.iconButtonColorClear, iconButtonTokens.iconButtonBackgroundColorHover, iconButtonTokens.iconButtonColorActive, tokens.iconButtonColorClear, iconButtonTokens.iconButtonBackgroundColorActive, tokens.iconButtonColorClear, classes.actionButtonDecrementDisabled, classes.actionButtonIncrementDisabled, tokens.iconButtonColorClear, InputWrapper, tokens.backgroundColorFocus, tokens.inputWrapperBorderWidth, tokens.borderColorFocus, Input, tokens.caretColor, classes.errorAnimation, tokens.colorClear, AdditionalText, tokens.additionalTextColorClear);
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { css } from 'styled-components';
|
2
|
+
import { classes, privateTokens, tokens } from '../../NumberInput.tokens';
|
3
|
+
import { StyledIconButton } from '../../ui/ActionButton/ActionButton.styles';
|
4
|
+
import { AdditionalText, Input, InputWrapper, StyledSpinner } from '../../ui/Input/Input.styles';
|
5
|
+
import { spinnerTokens } from '../../../Spinner';
|
6
|
+
export var base = /*#__PURE__*/css(["", "{", ":var(", ");&.", ",&.", "{", ":var(", ",var(", "));}&.", "{border-radius:var(", ") var(", ") var(", ") var(", ");}&.", "{border-radius:var(", ") var(", ") var(", ") var(", ");}&.", "{background:transparent;:hover{background-color:var(", ");}:active{background-color:var(", ");}&.", ",&.", "{:hover,:active{background-color:transparent;}}}&.", "{&.", ",&.", "{opacity:1;svg{opacity:var(", ");}:hover,:active{svg{opacity:var(", ");}}}}}&.", "{background:var(", ");border-radius:var(", ");", "{position:relative;color:var(", ");&:focus-within{background-color:var(", ");box-shadow:inset 0 0 0 var(", ") var(", ");}}", "{", ":var(", ");}", "{caret-color:var(", ",var(", "));&:not(.", "){color:var(", ");}}", "{color:var(", ");}}"], StyledIconButton, privateTokens.segmentationBorderRadius, tokens.iconButtonRadius, classes.segmentedView, classes.solidView, privateTokens.segmentationBorderRadius, tokens.iconButtonSegmentationRadius, tokens.iconButtonRadius, classes.actionButtonDecrement, tokens.iconButtonRadius, privateTokens.segmentationBorderRadius, privateTokens.segmentationBorderRadius, tokens.iconButtonRadius, classes.actionButtonIncrement, privateTokens.segmentationBorderRadius, tokens.iconButtonRadius, tokens.iconButtonRadius, privateTokens.segmentationBorderRadius, classes.solidView, tokens.iconButtonBackgroundColorHover, tokens.iconButtonBackgroundColorActive, classes.actionButtonDecrementDisabled, classes.actionButtonIncrementDisabled, classes.solidView, classes.actionButtonDecrementDisabled, classes.actionButtonIncrementDisabled, tokens.actionButtonDisabledOpacity, tokens.actionButtonDisabledOpacity, classes.solidView, tokens.backgroundColorSolid, tokens.iconButtonRadius, InputWrapper, tokens.colorSolid, tokens.backgroundColorSolidFocus, tokens.inputWrapperBorderWidth, tokens.borderColorSolidFocus, StyledSpinner, spinnerTokens.color, tokens.loaderSpinnerColorSolid, Input, tokens.caretColorSolid, tokens.caretColor, classes.errorAnimation, tokens.colorSolid, AdditionalText, tokens.additionalTextColorSolid);
|
@@ -0,0 +1 @@
|
|
1
|
+
["--plasma-number-input_icon-button_segmentation_radius", "--plasma-number-input_background-color-solid"]
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { css } from 'styled-components';
|
2
|
+
import { tokens } from '../../NumberInput.tokens';
|
3
|
+
import { iconButtonTokens } from '../../../IconButton';
|
4
|
+
import { StyledIconButton } from '../../ui/ActionButton/ActionButton.styles';
|
5
|
+
export var base = /*#__PURE__*/css(["", "{", ":var(", ");}"], StyledIconButton, iconButtonTokens.iconButtonRadius, tokens.iconButtonRadius);
|
@@ -0,0 +1 @@
|
|
1
|
+
["--plasma-number-input_icon-button_radius"]
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { css } from 'styled-components';
|
2
|
+
import { classes, privateTokens, tokens } from '../../NumberInput.tokens';
|
3
|
+
import { iconButtonTokens } from '../../../IconButton';
|
4
|
+
import { StyledIconButton } from '../../ui/ActionButton/ActionButton.styles';
|
5
|
+
import { AdditionalText, DynamicInput, Input, InputWrapper, StyledSpinner, TextWrapper } from '../../ui/Input/Input.styles';
|
6
|
+
import { spinnerTokens } from '../../../Spinner';
|
7
|
+
export var base = /*#__PURE__*/css(["width:var(", ");min-width:var(", ");", "{", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");}", "{margin:var(", ");border-radius:var(", ");}", "{height:var(", ");padding:var(", ");}", ",", ",", "{font-family:var(", ");font-size:var(", ");font-style:var(", ");font-weight:var(", ");letter-spacing:var(", ");line-height:var(", ");}", "{&.", "{margin-right:var(", ");}&.", "{margin-left:var(", ");}}", "{", ":var(", ");}"], privateTokens.inputWidth, tokens.rootMinWidth, StyledIconButton, iconButtonTokens.iconButtonHeight, tokens.iconButtonHeight, iconButtonTokens.iconButtonWidth, tokens.iconButtonWidth, iconButtonTokens.iconButtonPadding, tokens.iconButtonPadding, iconButtonTokens.iconButtonFontFamily, tokens.iconButtonFontFamily, iconButtonTokens.iconButtonFontSize, tokens.iconButtonFontSize, iconButtonTokens.iconButtonFontStyle, tokens.iconButtonFontStyle, iconButtonTokens.iconButtonFontWeight, tokens.iconButtonFontWeight, iconButtonTokens.iconButtonLetterSpacing, tokens.iconButtonLetterSpacing, iconButtonTokens.iconButtonLineHeight, tokens.iconButtonLineHeight, InputWrapper, tokens.inputWrapperMargin, tokens.inputWrapperBorderRadius, TextWrapper, tokens.textWrapperHeight, tokens.textWrapperPadding, DynamicInput, Input, AdditionalText, tokens.fontFamily, tokens.fontSize, tokens.fontStyle, tokens.fontWeight, tokens.letterSpacing, tokens.lineHeight, AdditionalText, classes.textBefore, tokens.textBeforeMarginRight, classes.textAfter, tokens.textAfterMarginLeft, StyledSpinner, spinnerTokens.size, tokens.loaderSpinnerSize);
|
@@ -0,0 +1,22 @@
|
|
1
|
+
[
|
2
|
+
"--plasma-number-input_icon-button_height",
|
3
|
+
"--plasma-number-input_icon-button_width",
|
4
|
+
"--plasma-number-input_icon-button_padding",
|
5
|
+
"--plasma-number-input_icon-button_font-family",
|
6
|
+
"--plasma-number-input_icon-button_font-size",
|
7
|
+
"--plasma-number-input_icon-button_font-style",
|
8
|
+
"--plasma-number-input_icon-button_font-weight",
|
9
|
+
"--plasma-number-input_icon-button_letter-spacing",
|
10
|
+
"--plasma-number-input_icon-button_line-height",
|
11
|
+
"--plasma-number-input_font-family",
|
12
|
+
"--plasma-number-input_font-style",
|
13
|
+
"--plasma-number-input_font-size",
|
14
|
+
"--plasma-number-input_font-weight",
|
15
|
+
"--plasma-number-input_letter-spacing",
|
16
|
+
"--plasma-number-input_line-height",
|
17
|
+
"--plasma-number-input_text-wrapper_height",
|
18
|
+
"--plasma-number-input_text-wrapper_padding",
|
19
|
+
"--plasma-number-input_loader-spinner_size",
|
20
|
+
"--plasma-number-input_text-before_margin-right",
|
21
|
+
"--plasma-number-input_text-after_margin-left"
|
22
|
+
]
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { css } from 'styled-components';
|
2
|
+
import { classes, tokens } from '../../NumberInput.tokens';
|
3
|
+
import { iconButtonTokens } from '../../../IconButton';
|
4
|
+
import { StyledIconButton } from '../../ui/ActionButton/ActionButton.styles';
|
5
|
+
import { AdditionalText, Input, InputWrapper, StyledSpinner } from '../../ui/Input/Input.styles';
|
6
|
+
import { spinnerTokens } from '../../../Spinner';
|
7
|
+
export var base = /*#__PURE__*/css(["", "{", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");&.", ",&.", "{opacity:var(", ");cursor:not-allowed;:hover,:active{scale:none;color:var(", ");background-color:var(", ");}}}&& ", "{&:focus-within{background-color:var(", ");box-shadow:inset 0 0 0 var(", ") var(", ");}}", "{", ":var(", ");}", "{color:var(", ");caret-color:var(", ");}", "{color:var(", ");}"], StyledIconButton, iconButtonTokens.iconButtonColor, tokens.iconButtonColor, iconButtonTokens.iconButtonBackgroundColor, tokens.iconButtonBackgroundColor, iconButtonTokens.iconButtonColorHover, tokens.iconButtonColorHover, iconButtonTokens.iconButtonBackgroundColorHover, tokens.iconButtonBackgroundColorHover, iconButtonTokens.iconButtonColorActive, tokens.iconButtonColorActive, iconButtonTokens.iconButtonBackgroundColorActive, tokens.iconButtonBackgroundColorActive, classes.actionButtonDecrementDisabled, classes.actionButtonIncrementDisabled, tokens.actionButtonDisabledOpacity, tokens.iconButtonColor, tokens.iconButtonBackgroundColor, InputWrapper, tokens.backgroundColorFocus, tokens.inputWrapperBorderWidth, tokens.borderColorFocus, StyledSpinner, spinnerTokens.color, tokens.loaderSpinnerColor, Input, tokens.color, tokens.caretColor, AdditionalText, tokens.additionalTextColor);
|
@@ -0,0 +1,14 @@
|
|
1
|
+
[
|
2
|
+
"--plasma-number-input_icon-button_color",
|
3
|
+
"--plasma-number-input_icon-button_background-color",
|
4
|
+
"--plasma-number-input_icon-button_color-hover",
|
5
|
+
"--plasma-number-input_icon-button_background-color-hover",
|
6
|
+
"--plasma-number-input_icon-button_color-active",
|
7
|
+
"--plasma-number-input_icon-button_background-color-active",
|
8
|
+
"--plasma-number-input_loader-spinner_color",
|
9
|
+
"--plasma-number-input_color",
|
10
|
+
"--plasma-number-input_additional-text_color",
|
11
|
+
"--plasma-number-input_action-button_disabled-opacity",
|
12
|
+
"--plasma-number-input_background-color-focus",
|
13
|
+
"--plasma-number-input_border-color-focus"
|
14
|
+
]
|
@@ -17,8 +17,8 @@ export var PaginationSelectPerPage = function PaginationSelectPerPage(_ref) {
|
|
17
17
|
listWidth = _ref.listWidth,
|
18
18
|
rest = _objectWithoutProperties(_ref, _excluded);
|
19
19
|
var handleSelectChange = function handleSelectChange(newValue) {
|
20
|
-
if (newValue
|
21
|
-
onChangeValue(Number(newValue));
|
20
|
+
if (newValue) {
|
21
|
+
onChangeValue === null || onChangeValue === void 0 || onChangeValue(Number(newValue));
|
22
22
|
}
|
23
23
|
};
|
24
24
|
var transformedList = perPageList.map(function (num) {
|
@@ -12,7 +12,7 @@ import React, { forwardRef, useState, useReducer, useMemo, createContext, useLay
|
|
12
12
|
import { isEmpty, getPlacements } from '../../utils';
|
13
13
|
import { useOutsideClick } from '../../hooks';
|
14
14
|
import { useKeyNavigation } from './hooks/useKeyboardNavigation';
|
15
|
-
import { initialItemsTransform, updateAncestors, updateDescendants, updateSingleAncestors, getView
|
15
|
+
import { initialItemsTransform, updateAncestors, updateDescendants, updateSingleAncestors, getView } from './utils';
|
16
16
|
import { Inner, Target } from './ui';
|
17
17
|
import { pathReducer, focusedPathReducer, focusedChipIndexReducer } from './reducers';
|
18
18
|
import { usePathMaps } from './hooks/usePathMaps';
|
@@ -58,6 +58,17 @@ export var selectRoot = function selectRoot(Root) {
|
|
58
58
|
separator = props.separator,
|
59
59
|
outerCloseAfterSelect = props.closeAfterSelect,
|
60
60
|
rest = _objectWithoutProperties(props, _excluded);
|
61
|
+
var _useState = useState(outerValue || props.multiselect ? [] : ''),
|
62
|
+
_useState2 = _slicedToArray(_useState, 2),
|
63
|
+
internalValue = _useState2[0],
|
64
|
+
setInternalValue = _useState2[1];
|
65
|
+
var value = outerValue || internalValue;
|
66
|
+
var onChange = function onChange(e) {
|
67
|
+
if (outerOnChange) {
|
68
|
+
outerOnChange(e);
|
69
|
+
}
|
70
|
+
setInternalValue(e);
|
71
|
+
};
|
61
72
|
var transformedItems = useMemo(function () {
|
62
73
|
return initialItemsTransform(items || []);
|
63
74
|
}, [items]);
|
@@ -67,12 +78,6 @@ export var selectRoot = function selectRoot(Root) {
|
|
67
78
|
focusedToValueMap = _usePathMaps2[1],
|
68
79
|
valueToCheckedMap = _usePathMaps2[2],
|
69
80
|
valueToItemMap = _usePathMaps2[3];
|
70
|
-
var value = getInitialValue(outerValue, valueToItemMap);
|
71
|
-
var onChange = function onChange(e) {
|
72
|
-
if (outerOnChange) {
|
73
|
-
outerOnChange(e);
|
74
|
-
}
|
75
|
-
};
|
76
81
|
var _useReducer = useReducer(pathReducer, []),
|
77
82
|
_useReducer2 = _slicedToArray(_useReducer, 2),
|
78
83
|
path = _useReducer2[0],
|
@@ -85,10 +90,10 @@ export var selectRoot = function selectRoot(Root) {
|
|
85
90
|
_useReducer6 = _slicedToArray(_useReducer5, 2),
|
86
91
|
focusedChipIndex = _useReducer6[0],
|
87
92
|
dispatchFocusedChipIndex = _useReducer6[1];
|
88
|
-
var
|
89
|
-
|
90
|
-
checked =
|
91
|
-
setChecked =
|
93
|
+
var _useState3 = useState(valueToCheckedMap),
|
94
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
95
|
+
checked = _useState4[0],
|
96
|
+
setChecked = _useState4[1];
|
92
97
|
var closeAfterSelect = outerCloseAfterSelect !== null && outerCloseAfterSelect !== void 0 ? outerCloseAfterSelect : !props.multiselect;
|
93
98
|
var targetRef = useOutsideClick(function () {
|
94
99
|
if (focusedChipIndex != null) {
|
@@ -154,7 +159,15 @@ export var selectRoot = function selectRoot(Root) {
|
|
154
159
|
if (e) {
|
155
160
|
e.stopPropagation();
|
156
161
|
}
|
157
|
-
var
|
162
|
+
var checkedCopy = new Map(checked);
|
163
|
+
var isCurrentChecked = checkedCopy.get(item.value);
|
164
|
+
checkedCopy.forEach(function (_, key) {
|
165
|
+
checkedCopy.set(key, false);
|
166
|
+
});
|
167
|
+
if (!isCurrentChecked) {
|
168
|
+
checkedCopy.set(item.value, 'done');
|
169
|
+
updateSingleAncestors(item, checkedCopy, 'dot');
|
170
|
+
}
|
158
171
|
if (closeAfterSelect) {
|
159
172
|
dispatchPath({
|
160
173
|
type: 'reset'
|
@@ -226,7 +239,7 @@ export var selectRoot = function selectRoot(Root) {
|
|
226
239
|
}
|
227
240
|
}
|
228
241
|
setChecked(checkedCopy);
|
229
|
-
}, [
|
242
|
+
}, [value]);
|
230
243
|
return /*#__PURE__*/React.createElement(Root, _extends({
|
231
244
|
ref: ref,
|
232
245
|
size: size,
|
@@ -153,7 +153,7 @@ export var useKeyNavigation = function useKeyNavigation(_ref) {
|
|
153
153
|
}
|
154
154
|
case keys.Backspace:
|
155
155
|
{
|
156
|
-
if (!multiselect
|
156
|
+
if (!multiselect) break;
|
157
157
|
if (focusedChipIndex !== null) {
|
158
158
|
var _currentItem = valueToItemMap.get(value[focusedChipIndex]);
|
159
159
|
handlePressDown(_currentItem);
|
@@ -34,7 +34,7 @@ var getLabel = function getLabel(_ref) {
|
|
34
34
|
text: renderValue ? renderValue(valueToItemMap.get(currentValue)) : itemLabel,
|
35
35
|
onClick: function onClick(e) {
|
36
36
|
e.stopPropagation();
|
37
|
-
onChipClick(currentValue
|
37
|
+
onChipClick(currentValue);
|
38
38
|
},
|
39
39
|
focused: focusedChipIndex === index
|
40
40
|
});
|
@@ -47,7 +47,7 @@ export var ChipWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
47
47
|
})(["width:100%;display:flex;min-width:0;padding:", ";gap:0.25rem;overflow-x:scroll;border-top-right-radius:var(", ");border-bottom-right-radius:var(", ");-ms-overflow-style:none;scrollbar-width:none;&::-webkit-scrollbar{display:none;}"], function (_ref6) {
|
48
48
|
var multiselect = _ref6.multiselect,
|
49
49
|
value = _ref6.value;
|
50
|
-
return "calc(".concat(constants.focusSize, " + ").concat(multiselect && value && value.
|
50
|
+
return "calc(".concat(constants.focusSize, " + ").concat(multiselect && value && value.length > 0 ? "var(".concat(tokens.focusOffset, ")") : 0, ")");
|
51
51
|
}, tokens.chipBorderRadius, tokens.chipBorderRadius);
|
52
52
|
export var Label = /*#__PURE__*/styled.label.withConfig({
|
53
53
|
componentId: "plasma-new-hope__sc-1akl2tk-6"
|
@@ -16,7 +16,7 @@ export var getButtonLabel = function getButtonLabel(_ref3) {
|
|
16
16
|
if (isEmpty(value) && typeof value !== 'number') {
|
17
17
|
return label || '';
|
18
18
|
}
|
19
|
-
if (selectProps.multiselect &&
|
19
|
+
if (selectProps.multiselect && selectProps.isTargetAmount) {
|
20
20
|
return "\u0412\u044B\u0431\u0440\u0430\u043D\u043E: ".concat(value.length);
|
21
21
|
}
|
22
22
|
if (selectProps.multiselect && Array.isArray(value)) {
|