@salutejs/plasma-new-hope 0.72.0-canary.1174.8614735539.0 → 0.73.0-canary.1160.8627071767.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/Combobox/Combobox.css +10 -10
- package/cjs/components/Combobox/Combobox.styles.js +5 -5
- package/cjs/components/Combobox/Combobox.styles.js.map +1 -1
- package/cjs/components/Combobox/{Combobox.styles_17ei5vn.css → Combobox.styles_dw6hnk.css} +1 -1
- package/cjs/components/Combobox/ui/ComboboxDivider/ComboboxDivider.css +4 -4
- package/cjs/components/Combobox/ui/ComboboxFooter/ComboboxFooter.css +4 -4
- package/cjs/components/Combobox/ui/ComboboxGroup/ComboboxGroup.css +4 -4
- package/cjs/components/Combobox/ui/ComboboxHeader/ComboboxHeader.css +4 -4
- package/cjs/components/Combobox/ui/ComboboxItem/ComboboxItem.css +4 -4
- package/cjs/components/Dropdown/Dropdown.css +4 -4
- package/cjs/components/Dropdown/Dropdown.js +0 -1
- package/cjs/components/Dropdown/Dropdown.js.map +1 -1
- package/cjs/components/Pagination/Pagination.css +9 -9
- package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.css +9 -9
- package/cjs/components/Popover/Popover.css +4 -4
- package/cjs/components/Popover/Popover.js +33 -43
- package/cjs/components/Popover/Popover.js.map +1 -1
- package/cjs/components/Popover/Popover.styles.js +1 -1
- package/cjs/components/Popover/Popover.styles.js.map +1 -1
- package/{es/components/Popover/Popover.styles_1rk9t6z.css → cjs/components/Popover/Popover.styles_1ggb66y.css} +1 -1
- package/cjs/components/Select/Select.css +9 -9
- package/cjs/components/Select/Select.styles.js +7 -7
- package/cjs/components/Select/Select.styles.js.map +1 -1
- package/{es/components/Select/Select.styles_ls547o.css → cjs/components/Select/Select.styles_1q3i6gw.css} +1 -1
- package/cjs/components/Select/ui/SelectDivider/SelectDivider.css +23 -0
- package/cjs/components/Select/ui/SelectDivider/SelectDivider.js +40 -0
- package/cjs/components/Select/ui/SelectDivider/SelectDivider.js.map +1 -0
- package/cjs/components/Select/ui/SelectDivider/SelectDivider.styles.js +12 -0
- package/cjs/components/Select/ui/SelectDivider/SelectDivider.styles.js.map +1 -0
- package/cjs/components/Select/ui/SelectDivider/SelectDivider.styles_673hj6.css +1 -0
- package/cjs/components/{TextField/_disabled → Select/ui/SelectDivider/variations/_size}/base.js +2 -2
- package/cjs/components/Select/ui/SelectDivider/variations/_size/base.js.map +1 -0
- package/cjs/components/{TextField/_size → Select/ui/SelectDivider/variations/_view}/base.js +2 -2
- package/cjs/components/Select/ui/SelectDivider/variations/_view/base.js.map +1 -0
- package/cjs/components/Select/ui/SelectFooter/SelectFooter.css +23 -0
- package/cjs/components/Select/ui/SelectFooter/SelectFooter.js +40 -0
- package/cjs/components/Select/ui/SelectFooter/SelectFooter.js.map +1 -0
- package/cjs/components/Select/ui/SelectFooter/SelectFooter.styles.js +12 -0
- package/cjs/components/Select/ui/SelectFooter/SelectFooter.styles.js.map +1 -0
- package/cjs/components/Select/ui/SelectFooter/SelectFooter.styles_11hk6tt.css +1 -0
- package/cjs/components/Select/ui/SelectFooter/variations/_size/base.js +9 -0
- package/cjs/components/Select/ui/SelectFooter/variations/_size/base.js.map +1 -0
- package/cjs/components/Select/ui/SelectFooter/variations/_size/base_x642ct.css +1 -0
- package/cjs/components/{TextField → Select/ui/SelectFooter/variations}/_view/base.js +2 -2
- package/cjs/components/Select/ui/SelectFooter/variations/_view/base.js.map +1 -0
- package/cjs/components/Select/ui/SelectFooter/variations/_view/base_x642ct.css +1 -0
- package/cjs/components/Select/ui/SelectGroup/SelectGroup.css +23 -0
- package/cjs/components/Select/ui/SelectGroup/SelectGroup.js +40 -0
- package/cjs/components/Select/ui/SelectGroup/SelectGroup.js.map +1 -0
- package/cjs/components/Select/ui/SelectGroup/SelectGroup.styles.js +12 -0
- package/cjs/components/Select/ui/SelectGroup/SelectGroup.styles.js.map +1 -0
- package/cjs/components/Select/ui/SelectGroup/SelectGroup.styles_mktu7e.css +1 -0
- package/cjs/components/Select/ui/SelectGroup/variations/_size/base.js +9 -0
- package/cjs/components/Select/ui/SelectGroup/variations/_size/base.js.map +1 -0
- package/cjs/components/Select/ui/SelectGroup/variations/_size/base_x642ct.css +1 -0
- package/cjs/components/Select/ui/SelectGroup/variations/_view/base.js +9 -0
- package/cjs/components/Select/ui/SelectGroup/variations/_view/base.js.map +1 -0
- package/cjs/components/Select/ui/SelectGroup/variations/_view/base_x642ct.css +1 -0
- package/cjs/components/Select/ui/SelectHeader/SelectHeader.css +23 -0
- package/cjs/components/Select/ui/SelectHeader/SelectHeader.js +40 -0
- package/cjs/components/Select/ui/SelectHeader/SelectHeader.js.map +1 -0
- package/cjs/components/Select/ui/SelectHeader/SelectHeader.styles.js +12 -0
- package/cjs/components/Select/ui/SelectHeader/SelectHeader.styles.js.map +1 -0
- package/cjs/components/Select/ui/SelectHeader/SelectHeader.styles_24gqog.css +1 -0
- package/cjs/components/Select/ui/SelectHeader/variations/_size/base.js +9 -0
- package/cjs/components/Select/ui/SelectHeader/variations/_size/base.js.map +1 -0
- package/cjs/components/Select/ui/SelectHeader/variations/_size/base_x642ct.css +1 -0
- package/cjs/components/Select/ui/SelectHeader/variations/_view/base.js +9 -0
- package/cjs/components/Select/ui/SelectHeader/variations/_view/base.js.map +1 -0
- package/cjs/components/Select/ui/SelectHeader/variations/_view/base_x642ct.css +1 -0
- package/cjs/components/Select/ui/SelectItem/SelectItem.css +4 -4
- package/cjs/components/Select/ui/SelectTarget/SelectTarget.js +2 -1
- package/cjs/components/Select/ui/SelectTarget/SelectTarget.js.map +1 -1
- package/cjs/components/TextField/TextField.js +166 -40
- package/cjs/components/TextField/TextField.js.map +1 -1
- package/cjs/components/TextField/TextField.styles.js +27 -11
- package/cjs/components/TextField/TextField.styles.js.map +1 -1
- package/cjs/components/TextField/TextField.styles_1b1mddp.css +8 -0
- package/cjs/components/TextField/TextField.tokens.js +68 -20
- package/cjs/components/TextField/TextField.tokens.js.map +1 -1
- package/cjs/components/TextField/TextField_wctd2m.css +1 -0
- package/cjs/components/TextField/hooks/useKeyNavigation.js +132 -0
- package/cjs/components/TextField/hooks/useKeyNavigation.js.map +1 -0
- package/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.css +19 -0
- package/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.js +38 -0
- package/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.js.map +1 -0
- package/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.styles.js +26 -0
- package/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.styles.js.map +1 -0
- package/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.styles_1y8n7la.css +1 -0
- package/cjs/components/TextField/variations/_disabled/base.js +9 -0
- package/cjs/components/TextField/variations/_disabled/base.js.map +1 -0
- package/cjs/components/TextField/variations/_disabled/base_1tnjoy9.css +1 -0
- package/cjs/components/TextField/{_label-placement → variations/_label-placement}/base.js +1 -1
- package/cjs/components/TextField/variations/_label-placement/base.js.map +1 -0
- package/cjs/components/TextField/variations/_label-placement/base_x642ct.css +1 -0
- package/cjs/components/TextField/{_label-placement → variations/_label-placement}/inner.js +2 -2
- package/cjs/components/TextField/variations/_label-placement/inner.js.map +1 -0
- package/cjs/components/TextField/variations/_label-placement/inner_gqlcj2.css +1 -0
- package/cjs/components/TextField/{_label-placement → variations/_label-placement}/outer.js +2 -2
- package/cjs/components/TextField/variations/_label-placement/outer.js.map +1 -0
- package/cjs/components/TextField/variations/_label-placement/outer_is41nj.css +1 -0
- package/cjs/components/TextField/variations/_read-only/base.js +9 -0
- package/cjs/components/TextField/variations/_read-only/base.js.map +1 -0
- package/cjs/components/TextField/variations/_read-only/base_134hshp.css +1 -0
- package/cjs/components/TextField/variations/_size/base.js +9 -0
- package/cjs/components/TextField/variations/_size/base.js.map +1 -0
- package/cjs/components/TextField/variations/_size/base_1khzr9t.css +1 -0
- package/cjs/components/TextField/variations/_view/base.js +9 -0
- package/cjs/components/TextField/variations/_view/base.js.map +1 -0
- package/cjs/components/TextField/variations/_view/base_1qd77x6.css +1 -0
- package/cjs/index.css +49 -42
- package/cjs/index.js +41 -6
- package/cjs/index.js.map +1 -1
- package/cjs/utils/index.js +13 -1
- package/cjs/utils/index.js.map +1 -1
- package/cjs/utils/react.js +12 -2
- package/cjs/utils/react.js.map +1 -1
- package/es/components/Combobox/Combobox.css +10 -10
- package/es/components/Combobox/Combobox.styles.js +5 -5
- package/es/components/Combobox/Combobox.styles.js.map +1 -1
- package/es/components/Combobox/{Combobox.styles_17ei5vn.css → Combobox.styles_dw6hnk.css} +1 -1
- package/es/components/Combobox/ui/ComboboxDivider/ComboboxDivider.css +4 -4
- package/es/components/Combobox/ui/ComboboxFooter/ComboboxFooter.css +4 -4
- package/es/components/Combobox/ui/ComboboxGroup/ComboboxGroup.css +4 -4
- package/es/components/Combobox/ui/ComboboxHeader/ComboboxHeader.css +4 -4
- package/es/components/Combobox/ui/ComboboxItem/ComboboxItem.css +4 -4
- package/es/components/Dropdown/Dropdown.css +4 -4
- package/es/components/Dropdown/Dropdown.js +0 -1
- package/es/components/Dropdown/Dropdown.js.map +1 -1
- package/es/components/Pagination/Pagination.css +9 -9
- package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.css +9 -9
- package/es/components/Popover/Popover.css +4 -4
- package/es/components/Popover/Popover.js +33 -43
- package/es/components/Popover/Popover.js.map +1 -1
- package/es/components/Popover/Popover.styles.js +1 -1
- package/es/components/Popover/Popover.styles.js.map +1 -1
- package/{cjs/components/Popover/Popover.styles_1rk9t6z.css → es/components/Popover/Popover.styles_1ggb66y.css} +1 -1
- package/es/components/Select/Select.css +9 -9
- package/es/components/Select/Select.styles.js +7 -7
- package/es/components/Select/Select.styles.js.map +1 -1
- package/{cjs/components/Select/Select.styles_ls547o.css → es/components/Select/Select.styles_1q3i6gw.css} +1 -1
- package/es/components/Select/ui/SelectDivider/SelectDivider.css +23 -0
- package/es/components/Select/ui/SelectDivider/SelectDivider.js +35 -0
- package/es/components/Select/ui/SelectDivider/SelectDivider.js.map +1 -0
- package/es/components/Select/ui/SelectDivider/SelectDivider.styles.js +7 -0
- package/es/components/Select/ui/SelectDivider/SelectDivider.styles.js.map +1 -0
- package/es/components/Select/ui/SelectDivider/SelectDivider.styles_673hj6.css +1 -0
- package/es/components/{TextField/_disabled → Select/ui/SelectDivider/variations/_size}/base.js +2 -2
- package/es/components/Select/ui/SelectDivider/variations/_size/base.js.map +1 -0
- package/es/components/Select/ui/SelectDivider/variations/_size/base_x642ct.css +1 -0
- package/es/components/{TextField/_size → Select/ui/SelectDivider/variations/_view}/base.js +2 -2
- package/es/components/Select/ui/SelectDivider/variations/_view/base.js.map +1 -0
- package/es/components/Select/ui/SelectDivider/variations/_view/base_x642ct.css +1 -0
- package/es/components/Select/ui/SelectFooter/SelectFooter.css +23 -0
- package/es/components/Select/ui/SelectFooter/SelectFooter.js +35 -0
- package/es/components/Select/ui/SelectFooter/SelectFooter.js.map +1 -0
- package/es/components/Select/ui/SelectFooter/SelectFooter.styles.js +7 -0
- package/es/components/Select/ui/SelectFooter/SelectFooter.styles.js.map +1 -0
- package/es/components/Select/ui/SelectFooter/SelectFooter.styles_11hk6tt.css +1 -0
- package/es/components/Select/ui/SelectFooter/variations/_size/base.js +5 -0
- package/es/components/Select/ui/SelectFooter/variations/_size/base.js.map +1 -0
- package/es/components/Select/ui/SelectFooter/variations/_size/base_x642ct.css +1 -0
- package/es/components/{TextField → Select/ui/SelectFooter/variations}/_view/base.js +2 -2
- package/es/components/Select/ui/SelectFooter/variations/_view/base.js.map +1 -0
- package/es/components/Select/ui/SelectFooter/variations/_view/base_x642ct.css +1 -0
- package/es/components/Select/ui/SelectGroup/SelectGroup.css +23 -0
- package/es/components/Select/ui/SelectGroup/SelectGroup.js +35 -0
- package/es/components/Select/ui/SelectGroup/SelectGroup.js.map +1 -0
- package/es/components/Select/ui/SelectGroup/SelectGroup.styles.js +7 -0
- package/es/components/Select/ui/SelectGroup/SelectGroup.styles.js.map +1 -0
- package/es/components/Select/ui/SelectGroup/SelectGroup.styles_mktu7e.css +1 -0
- package/es/components/Select/ui/SelectGroup/variations/_size/base.js +5 -0
- package/es/components/Select/ui/SelectGroup/variations/_size/base.js.map +1 -0
- package/es/components/Select/ui/SelectGroup/variations/_size/base_x642ct.css +1 -0
- package/es/components/Select/ui/SelectGroup/variations/_view/base.js +5 -0
- package/es/components/Select/ui/SelectGroup/variations/_view/base.js.map +1 -0
- package/es/components/Select/ui/SelectGroup/variations/_view/base_x642ct.css +1 -0
- package/es/components/Select/ui/SelectHeader/SelectHeader.css +23 -0
- package/es/components/Select/ui/SelectHeader/SelectHeader.js +35 -0
- package/es/components/Select/ui/SelectHeader/SelectHeader.js.map +1 -0
- package/es/components/Select/ui/SelectHeader/SelectHeader.styles.js +7 -0
- package/es/components/Select/ui/SelectHeader/SelectHeader.styles.js.map +1 -0
- package/es/components/Select/ui/SelectHeader/SelectHeader.styles_24gqog.css +1 -0
- package/es/components/Select/ui/SelectHeader/variations/_size/base.js +5 -0
- package/es/components/Select/ui/SelectHeader/variations/_size/base.js.map +1 -0
- package/es/components/Select/ui/SelectHeader/variations/_size/base_x642ct.css +1 -0
- package/es/components/Select/ui/SelectHeader/variations/_view/base.js +5 -0
- package/es/components/Select/ui/SelectHeader/variations/_view/base.js.map +1 -0
- package/es/components/Select/ui/SelectHeader/variations/_view/base_x642ct.css +1 -0
- package/es/components/Select/ui/SelectItem/SelectItem.css +4 -4
- package/es/components/Select/ui/SelectTarget/SelectTarget.js +2 -1
- package/es/components/Select/ui/SelectTarget/SelectTarget.js.map +1 -1
- package/es/components/TextField/TextField.js +169 -44
- package/es/components/TextField/TextField.js.map +1 -1
- package/es/components/TextField/TextField.styles.js +25 -12
- package/es/components/TextField/TextField.styles.js.map +1 -1
- package/es/components/TextField/TextField.styles_1b1mddp.css +8 -0
- package/es/components/TextField/TextField.tokens.js +68 -21
- package/es/components/TextField/TextField.tokens.js.map +1 -1
- package/es/components/TextField/TextField_wctd2m.css +1 -0
- package/es/components/TextField/hooks/useKeyNavigation.js +127 -0
- package/es/components/TextField/hooks/useKeyNavigation.js.map +1 -0
- package/es/components/TextField/ui/TextFieldChip/TextFieldChip.css +19 -0
- package/es/components/TextField/ui/TextFieldChip/TextFieldChip.js +34 -0
- package/es/components/TextField/ui/TextFieldChip/TextFieldChip.js.map +1 -0
- package/es/components/TextField/ui/TextFieldChip/TextFieldChip.styles.js +22 -0
- package/es/components/TextField/ui/TextFieldChip/TextFieldChip.styles.js.map +1 -0
- package/es/components/TextField/ui/TextFieldChip/TextFieldChip.styles_1y8n7la.css +1 -0
- package/es/components/TextField/variations/_disabled/base.js +5 -0
- package/es/components/TextField/variations/_disabled/base.js.map +1 -0
- package/es/components/TextField/variations/_disabled/base_1tnjoy9.css +1 -0
- package/es/components/TextField/{_label-placement → variations/_label-placement}/base.js +1 -1
- package/es/components/TextField/variations/_label-placement/base.js.map +1 -0
- package/es/components/TextField/variations/_label-placement/base_x642ct.css +1 -0
- package/es/components/TextField/variations/_label-placement/inner.js +5 -0
- package/es/components/TextField/variations/_label-placement/inner.js.map +1 -0
- package/es/components/TextField/variations/_label-placement/inner_gqlcj2.css +1 -0
- package/es/components/TextField/variations/_label-placement/outer.js +5 -0
- package/es/components/TextField/variations/_label-placement/outer.js.map +1 -0
- package/es/components/TextField/variations/_label-placement/outer_is41nj.css +1 -0
- package/es/components/TextField/variations/_read-only/base.js +5 -0
- package/es/components/TextField/variations/_read-only/base.js.map +1 -0
- package/es/components/TextField/variations/_read-only/base_134hshp.css +1 -0
- package/es/components/TextField/variations/_size/base.js +5 -0
- package/es/components/TextField/variations/_size/base.js.map +1 -0
- package/es/components/TextField/variations/_size/base_1khzr9t.css +1 -0
- package/es/components/TextField/variations/_view/base.js +5 -0
- package/es/components/TextField/variations/_view/base.js.map +1 -0
- package/es/components/TextField/variations/_view/base_1qd77x6.css +1 -0
- package/es/index.css +49 -42
- package/es/index.js +15 -2
- package/es/index.js.map +1 -1
- package/es/utils/index.js +11 -2
- package/es/utils/index.js.map +1 -1
- package/es/utils/react.js +9 -2
- package/es/utils/react.js.map +1 -1
- package/package.json +2 -2
- package/styled-components/cjs/components/Combobox/Combobox.styles.js +1 -1
- package/styled-components/cjs/components/Dropdown/Dropdown.js +0 -1
- package/styled-components/cjs/components/Popover/Popover.js +33 -43
- package/styled-components/cjs/components/Popover/Popover.styles.js +1 -1
- package/styled-components/cjs/components/Select/Select.styles.js +1 -1
- package/styled-components/cjs/components/Select/ui/SelectTarget/SelectTarget.js +2 -1
- package/styled-components/cjs/components/TextField/TextField.js +173 -43
- package/styled-components/cjs/components/TextField/TextField.styles.js +18 -10
- package/styled-components/cjs/components/TextField/TextField.template-doc.mdx +24 -0
- package/styled-components/cjs/components/TextField/TextField.tokens.js +68 -21
- package/styled-components/cjs/components/TextField/hooks/index.js +12 -0
- package/styled-components/cjs/components/TextField/hooks/useKeyNavigation.js +138 -0
- package/styled-components/cjs/components/TextField/index.js +2 -2
- package/styled-components/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.js +39 -0
- package/styled-components/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.styles.js +25 -0
- package/styled-components/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.types.js +5 -0
- package/styled-components/cjs/components/TextField/ui/index.js +12 -0
- package/styled-components/cjs/components/TextField/variations/_disabled/base.js +10 -0
- package/styled-components/cjs/components/TextField/variations/_label-placement/inner.js +10 -0
- package/styled-components/cjs/components/TextField/{_label-placement → variations/_label-placement}/outer.js +3 -3
- package/styled-components/cjs/components/TextField/variations/_read-only/base.js +10 -0
- package/styled-components/cjs/components/TextField/variations/_read-only/tokens.json +1 -0
- package/styled-components/cjs/components/TextField/variations/_size/base.js +10 -0
- package/styled-components/cjs/components/TextField/variations/_view/base.js +10 -0
- package/styled-components/cjs/examples/plasma_b2c/components/Popover/Popover.stories.tsx +0 -7
- package/styled-components/cjs/examples/plasma_b2c/components/TextField/TextField.config.js +43 -0
- package/styled-components/cjs/examples/plasma_b2c/components/TextField/TextField.js +11 -0
- package/styled-components/cjs/examples/plasma_b2c/components/TextField/TextField.stories.tsx +181 -0
- package/styled-components/cjs/examples/plasma_web/components/TextField/TextField.config.js +40 -0
- package/styled-components/cjs/examples/plasma_web/components/TextField/TextField.js +11 -0
- package/styled-components/cjs/examples/plasma_web/components/TextField/TextField.stories.tsx +181 -0
- package/styled-components/cjs/examples/sds_engineer/components/TextField/TextField.config.js +43 -0
- package/styled-components/cjs/examples/sds_engineer/components/TextField/TextField.js +11 -0
- package/styled-components/cjs/examples/sds_engineer/components/TextField/TextField.stories.tsx +181 -0
- package/styled-components/cjs/index.js +22 -0
- package/styled-components/es/components/Combobox/Combobox.styles.js +1 -1
- package/styled-components/es/components/Dropdown/Dropdown.js +0 -1
- package/styled-components/es/components/Popover/Popover.js +33 -43
- package/styled-components/es/components/Popover/Popover.styles.js +1 -1
- package/styled-components/es/components/Select/Select.styles.js +1 -1
- package/styled-components/es/components/Select/ui/SelectTarget/SelectTarget.js +2 -1
- package/styled-components/es/components/TextField/TextField.js +177 -47
- package/styled-components/es/components/TextField/TextField.styles.js +17 -9
- package/styled-components/es/components/TextField/TextField.template-doc.mdx +24 -0
- package/styled-components/es/components/TextField/TextField.tokens.js +67 -20
- package/styled-components/es/components/TextField/hooks/index.js +1 -0
- package/styled-components/es/components/TextField/hooks/useKeyNavigation.js +132 -0
- package/styled-components/es/components/TextField/index.js +2 -2
- package/styled-components/es/components/TextField/ui/TextFieldChip/TextFieldChip.js +30 -0
- package/styled-components/es/components/TextField/ui/TextFieldChip/TextFieldChip.styles.js +19 -0
- package/styled-components/es/components/TextField/ui/TextFieldChip/TextFieldChip.types.js +1 -0
- package/styled-components/es/components/TextField/ui/index.js +1 -0
- package/styled-components/es/components/TextField/variations/_disabled/base.js +4 -0
- package/styled-components/es/components/TextField/variations/_label-placement/inner.js +4 -0
- package/styled-components/es/components/TextField/variations/_label-placement/outer.js +4 -0
- package/styled-components/es/components/TextField/variations/_read-only/base.js +4 -0
- package/styled-components/es/components/TextField/variations/_read-only/tokens.json +1 -0
- package/styled-components/es/components/TextField/variations/_size/base.js +4 -0
- package/styled-components/es/components/TextField/variations/_view/base.js +4 -0
- package/styled-components/es/examples/plasma_b2c/components/Popover/Popover.stories.tsx +0 -7
- package/styled-components/es/examples/plasma_b2c/components/TextField/TextField.config.js +37 -0
- package/styled-components/es/examples/plasma_b2c/components/TextField/TextField.js +5 -0
- package/styled-components/es/examples/plasma_b2c/components/TextField/TextField.stories.tsx +181 -0
- package/styled-components/es/examples/plasma_web/components/TextField/TextField.config.js +34 -0
- package/styled-components/es/examples/plasma_web/components/TextField/TextField.js +5 -0
- package/styled-components/es/examples/plasma_web/components/TextField/TextField.stories.tsx +181 -0
- package/styled-components/es/examples/sds_engineer/components/TextField/TextField.config.js +37 -0
- package/styled-components/es/examples/sds_engineer/components/TextField/TextField.js +5 -0
- package/styled-components/es/examples/sds_engineer/components/TextField/TextField.stories.tsx +181 -0
- package/styled-components/es/index.js +2 -0
- package/types/components/Combobox/Combobox.styles.d.ts +2 -8
- package/types/components/Combobox/Combobox.styles.d.ts.map +1 -1
- package/types/components/Dropdown/Dropdown.d.ts.map +1 -1
- package/types/components/Dropdown/Dropdown.styles.d.ts +1 -7
- package/types/components/Dropdown/Dropdown.styles.d.ts.map +1 -1
- package/types/components/Popover/Popover.d.ts +2 -2
- package/types/components/Popover/Popover.d.ts.map +1 -1
- package/types/components/Popover/Popover.styles.d.ts.map +1 -1
- package/types/components/Popover/Popover.types.d.ts +12 -19
- package/types/components/Popover/Popover.types.d.ts.map +1 -1
- package/types/components/Select/Select.styles.d.ts +2 -8
- package/types/components/Select/Select.styles.d.ts.map +1 -1
- package/types/components/Select/ui/SelectTarget/SelectTarget.d.ts.map +1 -1
- package/types/components/TextField/TextField.d.ts +8 -3
- package/types/components/TextField/TextField.d.ts.map +1 -1
- package/types/components/TextField/TextField.styles.d.ts +6 -3
- package/types/components/TextField/TextField.styles.d.ts.map +1 -1
- package/types/components/TextField/TextField.tokens.d.ts +57 -8
- package/types/components/TextField/TextField.tokens.d.ts.map +1 -1
- package/types/components/TextField/TextField.types.d.ts +71 -6
- package/types/components/TextField/TextField.types.d.ts.map +1 -1
- package/types/components/TextField/hooks/index.d.ts +2 -0
- package/types/components/TextField/hooks/index.d.ts.map +1 -0
- package/types/components/TextField/hooks/useKeyNavigation.d.ts +17 -0
- package/types/components/TextField/hooks/useKeyNavigation.d.ts.map +1 -0
- package/types/components/TextField/index.d.ts +3 -2
- package/types/components/TextField/index.d.ts.map +1 -1
- package/types/components/TextField/ui/TextFieldChip/TextFieldChip.d.ts +7 -0
- package/types/components/TextField/ui/TextFieldChip/TextFieldChip.d.ts.map +1 -0
- package/types/components/TextField/ui/TextFieldChip/TextFieldChip.styles.d.ts +3 -0
- package/types/components/TextField/ui/TextFieldChip/TextFieldChip.styles.d.ts.map +1 -0
- package/types/components/TextField/ui/TextFieldChip/TextFieldChip.types.d.ts +37 -0
- package/types/components/TextField/ui/TextFieldChip/TextFieldChip.types.d.ts.map +1 -0
- package/types/components/TextField/ui/index.d.ts +2 -0
- package/types/components/TextField/ui/index.d.ts.map +1 -0
- package/types/components/TextField/variations/_disabled/base.d.ts.map +1 -0
- package/types/components/TextField/variations/_label-placement/base.d.ts.map +1 -0
- package/types/components/TextField/variations/_label-placement/index.d.ts.map +1 -0
- package/types/components/TextField/variations/_label-placement/inner.d.ts.map +1 -0
- package/types/components/TextField/variations/_label-placement/outer.d.ts.map +1 -0
- package/types/components/TextField/variations/_read-only/base.d.ts.map +1 -0
- package/types/components/TextField/variations/_size/base.d.ts.map +1 -0
- package/types/components/TextField/variations/_view/base.d.ts +2 -0
- package/types/components/TextField/variations/_view/base.d.ts.map +1 -0
- package/types/examples/plasma_b2c/components/Popover/Popover.d.ts +1 -7
- package/types/examples/plasma_b2c/components/Popover/Popover.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/TextField/TextField.config.d.ts +32 -0
- package/types/examples/plasma_b2c/components/TextField/TextField.config.d.ts.map +1 -0
- package/types/examples/plasma_b2c/components/TextField/TextField.d.ts +60 -0
- package/types/examples/plasma_b2c/components/TextField/TextField.d.ts.map +1 -0
- package/types/examples/plasma_web/components/Popover/Popover.d.ts +1 -7
- package/types/examples/plasma_web/components/Popover/Popover.d.ts.map +1 -1
- package/types/examples/plasma_web/components/TextField/TextField.config.d.ts +32 -0
- package/types/examples/plasma_web/components/TextField/TextField.config.d.ts.map +1 -0
- package/types/examples/plasma_web/components/TextField/TextField.d.ts +60 -0
- package/types/examples/plasma_web/components/TextField/TextField.d.ts.map +1 -0
- package/types/examples/sds_engineer/components/Popover/Popover.d.ts +1 -7
- package/types/examples/sds_engineer/components/Popover/Popover.d.ts.map +1 -1
- package/types/examples/sds_engineer/components/TextField/TextField.config.d.ts +32 -0
- package/types/examples/sds_engineer/components/TextField/TextField.config.d.ts.map +1 -0
- package/types/examples/sds_engineer/components/TextField/TextField.d.ts +60 -0
- package/types/examples/sds_engineer/components/TextField/TextField.d.ts.map +1 -0
- package/types/index.d.ts +2 -0
- package/types/index.d.ts.map +1 -1
- package/cjs/components/TextField/TextField.styles_2qw1n8.css +0 -5
- package/cjs/components/TextField/TextField_1lzb2r1.css +0 -1
- package/cjs/components/TextField/_disabled/base.js.map +0 -1
- package/cjs/components/TextField/_disabled/base_so3w81.css +0 -1
- package/cjs/components/TextField/_label-placement/base.js.map +0 -1
- package/cjs/components/TextField/_label-placement/inner.js.map +0 -1
- package/cjs/components/TextField/_label-placement/inner_1tyuicp.css +0 -1
- package/cjs/components/TextField/_label-placement/outer.js.map +0 -1
- package/cjs/components/TextField/_label-placement/outer_19ekaek.css +0 -1
- package/cjs/components/TextField/_size/base.js.map +0 -1
- package/cjs/components/TextField/_size/base_b5smyu.css +0 -1
- package/cjs/components/TextField/_view/base.js.map +0 -1
- package/cjs/components/TextField/_view/base_5bqzed.css +0 -1
- package/es/components/TextField/TextField.styles_2qw1n8.css +0 -5
- package/es/components/TextField/TextField_1lzb2r1.css +0 -1
- package/es/components/TextField/_disabled/base.js.map +0 -1
- package/es/components/TextField/_disabled/base_so3w81.css +0 -1
- package/es/components/TextField/_label-placement/base.js.map +0 -1
- package/es/components/TextField/_label-placement/inner.js +0 -5
- package/es/components/TextField/_label-placement/inner.js.map +0 -1
- package/es/components/TextField/_label-placement/inner_1tyuicp.css +0 -1
- package/es/components/TextField/_label-placement/outer.js +0 -5
- package/es/components/TextField/_label-placement/outer.js.map +0 -1
- package/es/components/TextField/_label-placement/outer_19ekaek.css +0 -1
- package/es/components/TextField/_size/base.js.map +0 -1
- package/es/components/TextField/_size/base_b5smyu.css +0 -1
- package/es/components/TextField/_view/base.js.map +0 -1
- package/es/components/TextField/_view/base_5bqzed.css +0 -1
- package/styled-components/cjs/components/TextField/_disabled/base.js +0 -9
- package/styled-components/cjs/components/TextField/_label-placement/inner.js +0 -10
- package/styled-components/cjs/components/TextField/_size/base.js +0 -10
- package/styled-components/cjs/components/TextField/_view/base.js +0 -10
- package/styled-components/es/components/TextField/_disabled/base.js +0 -3
- package/styled-components/es/components/TextField/_label-placement/inner.js +0 -4
- package/styled-components/es/components/TextField/_label-placement/outer.js +0 -4
- package/styled-components/es/components/TextField/_size/base.js +0 -4
- package/styled-components/es/components/TextField/_view/base.js +0 -4
- package/types/components/TextField/_disabled/base.d.ts.map +0 -1
- package/types/components/TextField/_label-placement/base.d.ts.map +0 -1
- package/types/components/TextField/_label-placement/index.d.ts.map +0 -1
- package/types/components/TextField/_label-placement/inner.d.ts.map +0 -1
- package/types/components/TextField/_label-placement/outer.d.ts.map +0 -1
- package/types/components/TextField/_size/base.d.ts.map +0 -1
- package/types/components/TextField/_view/base.d.ts.map +0 -1
- /package/cjs/components/{TextField/_label-placement → Select/ui/SelectDivider/variations/_size}/base_x642ct.css +0 -0
- /package/{es/components/TextField/_label-placement → cjs/components/Select/ui/SelectDivider/variations/_view}/base_x642ct.css +0 -0
- /package/styled-components/cjs/components/TextField/{_disabled → variations/_disabled}/tokens.json +0 -0
- /package/styled-components/cjs/components/TextField/{_label-placement → variations/_label-placement}/base.js +0 -0
- /package/styled-components/cjs/components/TextField/{_label-placement → variations/_label-placement}/index.js +0 -0
- /package/styled-components/cjs/components/TextField/{_size → variations/_size}/tokens.json +0 -0
- /package/styled-components/cjs/components/TextField/{_view → variations/_view}/tokens.json +0 -0
- /package/styled-components/es/components/TextField/{_disabled → variations/_disabled}/tokens.json +0 -0
- /package/styled-components/es/components/TextField/{_label-placement → variations/_label-placement}/base.js +0 -0
- /package/styled-components/es/components/TextField/{_label-placement → variations/_label-placement}/index.js +0 -0
- /package/styled-components/es/components/TextField/{_size → variations/_size}/tokens.json +0 -0
- /package/styled-components/es/components/TextField/{_view → variations/_view}/tokens.json +0 -0
- /package/types/components/TextField/{_disabled → variations/_disabled}/base.d.ts +0 -0
- /package/types/components/TextField/{_label-placement → variations/_label-placement}/base.d.ts +0 -0
- /package/types/components/TextField/{_label-placement → variations/_label-placement}/index.d.ts +0 -0
- /package/types/components/TextField/{_label-placement → variations/_label-placement}/inner.d.ts +0 -0
- /package/types/components/TextField/{_label-placement → variations/_label-placement}/outer.d.ts +0 -0
- /package/types/components/TextField/{_size → variations/_read-only}/base.d.ts +0 -0
- /package/types/components/TextField/{_view → variations/_size}/base.d.ts +0 -0
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"SelectTarget.js","sources":["../../../../../src/components/Select/ui/SelectTarget/SelectTarget.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useRef } from 'react';\n\nimport { classes } from '../../Select.tokens';\nimport { cx } from '../../../../utils';\nimport { SelectChip } from '../SelectChip/SelectChip';\nimport type { SelectPrimitiveValue } from '../../Select.types';\nimport { Keys } from '../../hooks/useKeyNavigation';\n\nimport {\n StyledArrow,\n StyledChips,\n StyledChipsWrapper,\n StyledLabel,\n StyledSelectTarget,\n StyledText,\n} from './SelectTarget.styles';\nimport type { SelectTargetProps } from './SelectTarget.types';\n\nconst {\n hasNoFocus,\n hasChips,\n innerLabelUp,\n arrowInverse,\n selectTarget,\n selectTargetArrow,\n selectTargeText,\n selectTargetLabel,\n} = classes;\n\n/**\n * Элемент для выпадающего списка\n */\nexport const SelectTarget = forwardRef<HTMLButtonElement, SelectTargetProps>(\n (\n {\n values,\n target = 'textField-like',\n label,\n opened,\n readOnly,\n disabled,\n enumerationType,\n size,\n id,\n chipsRefs,\n onChange,\n onKeyDown,\n ...rest\n },\n ref,\n ) => {\n const hasText = Boolean(values?.some(([value]) => value));\n\n const hasLabel = label && size !== 'xs' && target === 'textField-like';\n const textContent = values?.map(([, text]) => text).join(', ');\n const contentRef = useRef<HTMLDivElement>(null);\n\n const withArrowInverse = opened ? arrowInverse : undefined;\n const withInnerLabelUp = hasLabel && hasText ? innerLabelUp : undefined;\n const withHasChips =\n hasText && enumerationType === 'chip' && target === 'textField-like' ? hasChips : undefined;\n\n const withNoFocus = target === 'textField-like' ? hasNoFocus : undefined;\n\n const isLabelVisible = !hasText || (hasLabel && enumerationType === 'comma');\n\n const onChipClick = useCallback((event: React.MouseEvent<HTMLButtonElement>) => {\n event.stopPropagation();\n }, []);\n\n const onChipClear = useCallback(\n (value: SelectPrimitiveValue, text: SelectPrimitiveValue, index: number) => {\n const newValue = values\n ?.filter(([itemValue, itemText]) => !(itemValue === value && itemText === text))\n .map(([itemValue]) => itemValue);\n\n chipsRefs?.current.splice(index, 1);\n onChange?.(newValue);\n },\n [values, onChange],\n );\n\n const onChipKeyDown = useCallback(\n (\n value: SelectPrimitiveValue,\n text: SelectPrimitiveValue,\n index: number,\n event: React.KeyboardEvent<HTMLButtonElement>,\n ) => {\n const { code, shiftKey } = event;\n\n if (code === Keys.Tab || (code === Keys.Tab && shiftKey)) {\n event.preventDefault();\n }\n\n if (code === Keys.Backspace) {\n onChipClear(value, text, index);\n }\n },\n [onChipClear],\n );\n\n const onWheel = useCallback((event: React.WheelEvent<HTMLButtonElement>) => {\n const { deltaY } = event;\n\n if (contentRef.current) {\n contentRef.current.scrollLeft += Math.round(deltaY);\n }\n }, []);\n\n const getRef = useCallback((element: HTMLButtonElement | null, index: number) => {\n if (element && chipsRefs && chipsRefs.current) {\n chipsRefs.current[index] = element;\n }\n }, []);\n\n // INFO: Нужно очищать на каждый ререндер компонента для актуализации состояния рефов\n if (chipsRefs) {\n chipsRefs.current = [];\n }\n\n return (\n <StyledSelectTarget\n {...rest}\n ref={ref}\n opened={opened}\n target={target}\n readOnly={readOnly}\n disabled={disabled}\n title={textContent}\n aria-label={label}\n className={cx(withInnerLabelUp, withHasChips, withNoFocus, selectTarget)}\n onWheel={onWheel}\n onKeyDown={onKeyDown}\n >\n {hasText &&\n (enumerationType === 'comma' || target === 'button-like' ? (\n <StyledText className={selectTargeText}>{textContent}</StyledText>\n ) : (\n <StyledChipsWrapper ref={contentRef}>\n <StyledChips>\n {values?.map(([value, text], index) => (\n <SelectChip\n index={index}\n ref={(element) => getRef(element, index)}\n key={`${value}_${text}`}\n disabled={disabled}\n readOnly={readOnly}\n value={value}\n text={text}\n onClear={(v, t) => onChipClear(v, t, index)}\n onClick={onChipClick}\n onKeyDown={onChipKeyDown}\n />\n ))}\n </StyledChips>\n </StyledChipsWrapper>\n ))}\n {isLabelVisible && (\n <StyledLabel className={selectTargetLabel} htmlFor={id}>\n {label}\n </StyledLabel>\n )}\n <StyledArrow size=\"s\" color=\"inherit\" className={cx(selectTargetArrow, withArrowInverse)} />\n </StyledSelectTarget>\n );\n },\n);\n"],"names":["hasNoFocus","classes","hasChips","innerLabelUp","arrowInverse","selectTarget","selectTargetArrow","selectTargeText","selectTargetLabel","SelectTarget","forwardRef","_ref","ref","values","_ref$target","target","label","opened","readOnly","disabled","enumerationType","size","id","chipsRefs","onChange","onKeyDown","rest","_objectWithoutProperties","_excluded","hasText","Boolean","some","_ref2","_ref3","_slicedToArray","value","hasLabel","textContent","map","_ref4","_ref5","text","join","contentRef","useRef","withArrowInverse","undefined","withInnerLabelUp","withHasChips","withNoFocus","isLabelVisible","onChipClick","useCallback","event","stopPropagation","onChipClear","index","newValue","filter","_ref6","_ref7","itemValue","itemText","_ref8","_ref9","current","splice","onChipKeyDown","code","shiftKey","Keys","Tab","preventDefault","Backspace","onWheel","deltaY","scrollLeft","Math","round","getRef","element","React","createElement","StyledSelectTarget","_extends","title","className","cx","StyledText","StyledChipsWrapper","StyledChips","_ref10","_ref11","SelectChip","key","concat","onClear","v","t","onClick","StyledLabel","htmlFor","StyledArrow","color"],"mappings":";;;;;;;;;;;;;AAkBA,IACIA,UAAU,GAQVC,qBAAO,CARPD,UAAU;EACVE,QAAQ,GAORD,qBAAO,CAPPC,QAAQ;EACRC,YAAY,GAMZF,qBAAO,CANPE,YAAY;EACZC,YAAY,GAKZH,qBAAO,CALPG,YAAY;EACZC,YAAY,GAIZJ,qBAAO,CAJPI,YAAY;EACZC,iBAAiB,GAGjBL,qBAAO,CAHPK,iBAAiB;EACjBC,eAAe,GAEfN,qBAAO,CAFPM,eAAe;EACfC,iBAAiB,GACjBP,qBAAO,CADPO,iBAAiB,CAAA;;AAGrB;AACA;AACA;AACO,IAAMC,YAAY,gBAAGC,gBAAU,CAClC,UAAAC,IAAA,EAgBIC,GAAG,EACF;AAAA,EAAA,IAfGC,MAAM,GAAAF,IAAA,CAANE,MAAM;IAAAC,WAAA,GAAAH,IAAA,CACNI,MAAM;AAANA,IAAAA,MAAM,GAAAD,WAAA,KAAG,KAAA,CAAA,GAAA,gBAAgB,GAAAA,WAAA;IACzBE,KAAK,GAAAL,IAAA,CAALK,KAAK;IACLC,MAAM,GAAAN,IAAA,CAANM,MAAM;IACNC,QAAQ,GAAAP,IAAA,CAARO,QAAQ;IACRC,QAAQ,GAAAR,IAAA,CAARQ,QAAQ;IACRC,eAAe,GAAAT,IAAA,CAAfS,eAAe;IACfC,IAAI,GAAAV,IAAA,CAAJU,IAAI;IACJC,EAAE,GAAAX,IAAA,CAAFW,EAAE;IACFC,SAAS,GAAAZ,IAAA,CAATY,SAAS;IACTC,QAAQ,GAAAb,IAAA,CAARa,QAAQ;IACRC,SAAS,GAAAd,IAAA,CAATc,SAAS;AACN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
+
{"version":3,"file":"SelectTarget.js","sources":["../../../../../src/components/Select/ui/SelectTarget/SelectTarget.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useRef } from 'react';\n\nimport { classes } from '../../Select.tokens';\nimport { cx } from '../../../../utils';\nimport { SelectChip } from '../SelectChip/SelectChip';\nimport type { SelectPrimitiveValue } from '../../Select.types';\nimport { Keys } from '../../hooks/useKeyNavigation';\n\nimport {\n StyledArrow,\n StyledChips,\n StyledChipsWrapper,\n StyledLabel,\n StyledSelectTarget,\n StyledText,\n} from './SelectTarget.styles';\nimport type { SelectTargetProps } from './SelectTarget.types';\n\nconst {\n hasNoFocus,\n hasChips,\n innerLabelUp,\n arrowInverse,\n selectTarget,\n selectTargetArrow,\n selectTargeText,\n selectTargetLabel,\n} = classes;\n\n/**\n * Элемент для выпадающего списка\n */\nexport const SelectTarget = forwardRef<HTMLButtonElement, SelectTargetProps>(\n (\n {\n values,\n target = 'textField-like',\n label,\n opened,\n readOnly,\n disabled,\n enumerationType,\n size,\n id,\n chipsRefs,\n onChange,\n onKeyDown,\n ...rest\n },\n ref,\n ) => {\n const hasText = Boolean(values?.some(([value]) => value));\n\n const hasLabel = label && size !== 'xs' && target === 'textField-like';\n const textContent = values?.map(([, text]) => text).join(', ');\n const contentRef = useRef<HTMLDivElement>(null);\n\n const withArrowInverse = opened ? arrowInverse : undefined;\n const withInnerLabelUp = hasLabel && hasText ? innerLabelUp : undefined;\n const withHasChips =\n hasText && enumerationType === 'chip' && target === 'textField-like' ? hasChips : undefined;\n\n const withNoFocus = target === 'textField-like' ? hasNoFocus : undefined;\n\n const isLabelVisible = !hasText || (hasLabel && enumerationType === 'comma');\n\n const onChipClick = useCallback((event: React.MouseEvent<HTMLButtonElement>) => {\n event.stopPropagation();\n }, []);\n\n const onChipClear = useCallback(\n (value: SelectPrimitiveValue, text: SelectPrimitiveValue, index: number) => {\n const newValue = values\n ?.filter(([itemValue, itemText]) => !(itemValue === value && itemText === text))\n .map(([itemValue]) => itemValue);\n\n chipsRefs?.current.splice(index, 1);\n onChange?.(newValue);\n },\n [values, onChange],\n );\n\n const onChipKeyDown = useCallback(\n (\n value: SelectPrimitiveValue,\n text: SelectPrimitiveValue,\n index: number,\n event: React.KeyboardEvent<HTMLButtonElement>,\n ) => {\n const { code, shiftKey } = event;\n\n if (code === Keys.Tab || (code === Keys.Tab && shiftKey)) {\n event.preventDefault();\n }\n\n if (code === Keys.Backspace) {\n onChipClear(value, text, index);\n }\n },\n [onChipClear],\n );\n\n const onWheel = useCallback((event: React.WheelEvent<HTMLButtonElement>) => {\n const { deltaY } = event;\n\n if (contentRef.current) {\n contentRef.current.scrollLeft += Math.round(deltaY);\n }\n }, []);\n\n const getRef = useCallback((element: HTMLButtonElement | null, index: number) => {\n if (element && chipsRefs && chipsRefs.current) {\n chipsRefs.current[index] = element;\n }\n }, []);\n\n // INFO: Нужно очищать на каждый ререндер компонента для актуализации состояния рефов\n if (chipsRefs) {\n chipsRefs.current = [];\n }\n\n return (\n <StyledSelectTarget\n {...rest}\n ref={ref}\n opened={opened}\n target={target}\n readOnly={readOnly}\n disabled={disabled}\n title={textContent}\n aria-label={label}\n className={cx(withInnerLabelUp, withHasChips, withNoFocus, selectTarget)}\n onWheel={onWheel}\n onKeyDown={onKeyDown}\n stretching=\"filled\"\n >\n {hasText &&\n (enumerationType === 'comma' || target === 'button-like' ? (\n <StyledText className={selectTargeText}>{textContent}</StyledText>\n ) : (\n <StyledChipsWrapper ref={contentRef}>\n <StyledChips>\n {values?.map(([value, text], index) => (\n <SelectChip\n index={index}\n ref={(element) => getRef(element, index)}\n key={`${value}_${text}`}\n disabled={disabled}\n readOnly={readOnly}\n value={value}\n text={text}\n onClear={(v, t) => onChipClear(v, t, index)}\n onClick={onChipClick}\n onKeyDown={onChipKeyDown}\n />\n ))}\n </StyledChips>\n </StyledChipsWrapper>\n ))}\n {isLabelVisible && (\n <StyledLabel className={selectTargetLabel} htmlFor={id}>\n {label}\n </StyledLabel>\n )}\n <StyledArrow size=\"s\" color=\"inherit\" className={cx(selectTargetArrow, withArrowInverse)} />\n </StyledSelectTarget>\n );\n },\n);\n"],"names":["hasNoFocus","classes","hasChips","innerLabelUp","arrowInverse","selectTarget","selectTargetArrow","selectTargeText","selectTargetLabel","SelectTarget","forwardRef","_ref","ref","values","_ref$target","target","label","opened","readOnly","disabled","enumerationType","size","id","chipsRefs","onChange","onKeyDown","rest","_objectWithoutProperties","_excluded","hasText","Boolean","some","_ref2","_ref3","_slicedToArray","value","hasLabel","textContent","map","_ref4","_ref5","text","join","contentRef","useRef","withArrowInverse","undefined","withInnerLabelUp","withHasChips","withNoFocus","isLabelVisible","onChipClick","useCallback","event","stopPropagation","onChipClear","index","newValue","filter","_ref6","_ref7","itemValue","itemText","_ref8","_ref9","current","splice","onChipKeyDown","code","shiftKey","Keys","Tab","preventDefault","Backspace","onWheel","deltaY","scrollLeft","Math","round","getRef","element","React","createElement","StyledSelectTarget","_extends","title","className","cx","stretching","StyledText","StyledChipsWrapper","StyledChips","_ref10","_ref11","SelectChip","key","concat","onClear","v","t","onClick","StyledLabel","htmlFor","StyledArrow","color"],"mappings":";;;;;;;;;;;;;AAkBA,IACIA,UAAU,GAQVC,qBAAO,CARPD,UAAU;EACVE,QAAQ,GAORD,qBAAO,CAPPC,QAAQ;EACRC,YAAY,GAMZF,qBAAO,CANPE,YAAY;EACZC,YAAY,GAKZH,qBAAO,CALPG,YAAY;EACZC,YAAY,GAIZJ,qBAAO,CAJPI,YAAY;EACZC,iBAAiB,GAGjBL,qBAAO,CAHPK,iBAAiB;EACjBC,eAAe,GAEfN,qBAAO,CAFPM,eAAe;EACfC,iBAAiB,GACjBP,qBAAO,CADPO,iBAAiB,CAAA;;AAGrB;AACA;AACA;AACO,IAAMC,YAAY,gBAAGC,gBAAU,CAClC,UAAAC,IAAA,EAgBIC,GAAG,EACF;AAAA,EAAA,IAfGC,MAAM,GAAAF,IAAA,CAANE,MAAM;IAAAC,WAAA,GAAAH,IAAA,CACNI,MA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EjD,WAAY;AACrB1B,MAAAA,SAAS,EAAE0C,aAAAA;AAAc,KAC5B,CAAC,CAAA;GACL,CACQ,CACG,CACvB,CAAC,EACLjB,cAAc,iBACX+B,KAAA,CAAAC,aAAA,CAACmB,+BAAW,EAAA;AAACf,IAAAA,SAAS,EAAE9E,iBAAkB;AAAC8F,IAAAA,OAAO,EAAEhF,EAAAA;AAAG,GAAA,EAClDN,KACQ,CAChB,eACDiE,KAAA,CAAAC,aAAA,CAACqB,+BAAW,EAAA;AAAClF,IAAAA,IAAI,EAAC,GAAG;AAACmF,IAAAA,KAAK,EAAC,SAAS;AAAClB,IAAAA,SAAS,EAAEC,QAAE,CAACjF,iBAAiB,EAAEuC,gBAAgB,CAAA;AAAE,GAAE,CAC3E,CAAC,CAAA;AAE7B,CACJ;;;;"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import './
|
1
|
+
import './TextField_wctd2m.css';
|
2
2
|
'use strict';
|
3
3
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
@@ -6,70 +6,190 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
6
6
|
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
7
7
|
var React = require('react');
|
8
8
|
var plasmaCore = require('@salutejs/plasma-core');
|
9
|
-
var
|
10
|
-
var base$
|
11
|
-
var base$
|
12
|
-
var base$
|
9
|
+
var index = require('../../utils/index.js');
|
10
|
+
var base$2 = require('./variations/_size/base.js');
|
11
|
+
var base$1 = require('./variations/_view/base.js');
|
12
|
+
var base$3 = require('./variations/_disabled/base.js');
|
13
|
+
var base$4 = require('./variations/_read-only/base.js');
|
14
|
+
var base$5 = require('./variations/_label-placement/base.js');
|
13
15
|
var TextField_styles = require('./TextField.styles.js');
|
16
|
+
var TextField_tokens = require('./TextField.tokens.js');
|
17
|
+
var TextFieldChip = require('./ui/TextFieldChip/TextFieldChip.js');
|
18
|
+
var useKeyNavigation = require('./hooks/useKeyNavigation.js');
|
14
19
|
|
15
|
-
var _excluded = ["
|
20
|
+
var _excluded = ["id", "contentLeft", "contentRight", "label", "labelPlacement", "placeholder", "leftHelper", "enumerationType", "view", "size", "readOnly", "disabled", "chips", "onChange", "onChangeChips", "onSearch"];
|
16
21
|
var base = "bpunezx";
|
17
22
|
var textFieldRoot = function textFieldRoot(Root) {
|
18
|
-
return /*#__PURE__*/React.forwardRef(function (
|
19
|
-
var
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
23
|
+
return /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
24
|
+
var id = _ref.id,
|
25
|
+
contentLeft = _ref.contentLeft,
|
26
|
+
contentRight = _ref.contentRight,
|
27
|
+
label = _ref.label,
|
28
|
+
labelPlacement = _ref.labelPlacement,
|
29
|
+
placeholder = _ref.placeholder,
|
30
|
+
leftHelper = _ref.leftHelper,
|
31
|
+
_ref$enumerationType = _ref.enumerationType,
|
32
|
+
enumerationType = _ref$enumerationType === void 0 ? 'plain' : _ref$enumerationType,
|
33
|
+
view = _ref.view,
|
34
|
+
size = _ref.size,
|
35
|
+
_ref$readOnly = _ref.readOnly,
|
36
|
+
readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,
|
37
|
+
_ref$disabled = _ref.disabled,
|
38
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
39
|
+
values = _ref.chips,
|
40
|
+
onChange = _ref.onChange,
|
41
|
+
onChangeChips = _ref.onChangeChips,
|
42
|
+
onSearch = _ref.onSearch,
|
43
|
+
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
44
|
+
var contentRef = React.useRef(null);
|
45
|
+
var inputRef = React.useRef(null);
|
46
|
+
var chipsRefs = React.useRef([]);
|
47
|
+
var controlledRefs = {
|
48
|
+
contentRef: contentRef,
|
49
|
+
inputRef: inputRef,
|
50
|
+
chipsRefs: chipsRefs
|
51
|
+
};
|
52
|
+
var _useState = React.useState([]),
|
53
|
+
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
54
|
+
chips = _useState2[0],
|
55
|
+
setChips = _useState2[1];
|
56
|
+
var uniqId = plasmaCore.safeUseId();
|
57
|
+
var innerId = id || uniqId;
|
58
|
+
var labelId = plasmaCore.safeUseId();
|
59
|
+
var helperTextId = plasmaCore.safeUseId();
|
60
|
+
var isChipEnumeration = enumerationType === 'chip';
|
61
|
+
var hideLabel = (size === 'xs' || isChipEnumeration) && labelPlacement === 'inner';
|
62
|
+
var labelInside = size !== 'xs' && labelPlacement === 'inner';
|
63
|
+
var innerLabelPlacementValue = hideLabel ? 'outer' : labelPlacement;
|
64
|
+
var innerPlaceholderValue = hideLabel ? label : placeholder;
|
65
|
+
var innerLabelValue = hideLabel ? undefined : label;
|
66
|
+
var isChipsVisible = isChipEnumeration && (chips === null || chips === void 0 ? void 0 : chips.length);
|
67
|
+
var withHasChips = isChipsVisible ? TextField_tokens.classes.hasChips : undefined;
|
68
|
+
var wrapperWithoutLeftContent = !contentLeft && isChipsVisible ? TextField_tokens.classes.hasEmptyContentLeft : undefined;
|
69
|
+
var wrapperWithoutRightContent = !contentRight && isChipsVisible ? TextField_tokens.classes.hasEmptyContentRight : undefined;
|
31
70
|
var handleChange = function handleChange(event) {
|
71
|
+
if (disabled || readOnly) {
|
72
|
+
return;
|
73
|
+
}
|
32
74
|
var _event$target = event.target,
|
33
75
|
maxLength = _event$target.maxLength,
|
34
76
|
value = _event$target.value;
|
35
|
-
if (
|
77
|
+
if (maxLength !== -1 && value.length > maxLength) {
|
36
78
|
return;
|
37
79
|
}
|
38
|
-
onChange(event);
|
80
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
39
81
|
};
|
40
|
-
var
|
41
|
-
|
42
|
-
|
82
|
+
var updateChips = function updateChips(newChips, newValues) {
|
83
|
+
setChips(newChips);
|
84
|
+
onChangeChips === null || onChangeChips === void 0 ? void 0 : onChangeChips(newValues);
|
85
|
+
};
|
86
|
+
var _useKeyNavigation = useKeyNavigation.useKeyNavigation({
|
87
|
+
controlledRefs: controlledRefs,
|
88
|
+
disabled: disabled,
|
89
|
+
readOnly: readOnly,
|
90
|
+
chips: chips,
|
91
|
+
enumerationType: enumerationType,
|
92
|
+
updateChips: updateChips,
|
93
|
+
onSearch: onSearch,
|
94
|
+
onChange: onChange
|
95
|
+
}),
|
96
|
+
handleInputKeydown = _useKeyNavigation.handleInputKeydown,
|
97
|
+
handleChipKeyDown = _useKeyNavigation.handleChipKeyDown,
|
98
|
+
onChipClear = _useKeyNavigation.onChipClear,
|
99
|
+
handleContentKeyDown = _useKeyNavigation.handleContentKeyDown;
|
100
|
+
var onChipClick = function onChipClick(event) {
|
101
|
+
return event.stopPropagation();
|
102
|
+
};
|
103
|
+
var handleInputFocus = function handleInputFocus() {
|
104
|
+
if (readOnly || disabled || !(inputRef !== null && inputRef !== void 0 && inputRef.current)) {
|
105
|
+
return;
|
43
106
|
}
|
107
|
+
inputRef.current.scrollIntoView({
|
108
|
+
behavior: 'smooth',
|
109
|
+
block: 'center',
|
110
|
+
inline: 'center'
|
111
|
+
});
|
112
|
+
inputRef.current.focus({
|
113
|
+
preventScroll: true
|
114
|
+
});
|
44
115
|
};
|
45
|
-
var
|
46
|
-
|
47
|
-
|
116
|
+
var getRef = function getRef(element, index) {
|
117
|
+
if (element && chipsRefs !== null && chipsRefs !== void 0 && chipsRefs.current) {
|
118
|
+
chipsRefs.current[index] = element;
|
119
|
+
}
|
120
|
+
};
|
121
|
+
React.useEffect(function () {
|
122
|
+
if (!isChipEnumeration && !(values !== null && values !== void 0 && values.length)) {
|
123
|
+
return;
|
124
|
+
}
|
125
|
+
var newChips = (values === null || values === void 0 ? void 0 : values.map(function (value, index) {
|
126
|
+
return {
|
127
|
+
id: "".concat(index, "_").concat(value),
|
128
|
+
text: value
|
129
|
+
};
|
130
|
+
})) || [];
|
131
|
+
setChips(newChips);
|
132
|
+
}, [isChipEnumeration, values]);
|
48
133
|
return /*#__PURE__*/React.createElement(Root, {
|
134
|
+
ref: ref,
|
49
135
|
view: view,
|
50
136
|
size: size,
|
51
137
|
disabled: disabled,
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
},
|
56
|
-
|
57
|
-
|
138
|
+
readOnly: !disabled && readOnly,
|
139
|
+
labelPlacement: innerLabelPlacementValue,
|
140
|
+
onClick: handleInputFocus
|
141
|
+
}, labelInside || innerLabelValue && /*#__PURE__*/React.createElement(TextField_styles.Label, {
|
142
|
+
id: labelId,
|
143
|
+
htmlFor: id
|
144
|
+
}, innerLabelValue), /*#__PURE__*/React.createElement(TextField_styles.InputWrapper, {
|
145
|
+
className: index.cx(withHasChips, wrapperWithoutLeftContent, wrapperWithoutRightContent)
|
146
|
+
}, contentLeft && /*#__PURE__*/React.createElement(TextField_styles.StyledContentLeft, null, contentLeft), /*#__PURE__*/React.createElement(TextField_styles.InputLabelWrapper, {
|
147
|
+
tabIndex: -1,
|
148
|
+
ref: contentRef,
|
149
|
+
onKeyDown: handleContentKeyDown,
|
150
|
+
className: withHasChips
|
151
|
+
}, isChipEnumeration && Boolean(chips === null || chips === void 0 ? void 0 : chips.length) && /*#__PURE__*/React.createElement(TextField_styles.StyledChips, null, chips === null || chips === void 0 ? void 0 : chips.map(function (_ref2, index) {
|
152
|
+
var chipId = _ref2.id,
|
153
|
+
text = _ref2.text;
|
154
|
+
return /*#__PURE__*/React.createElement(TextFieldChip.TextFieldChip, {
|
155
|
+
id: chipId,
|
156
|
+
ref: function ref(element) {
|
157
|
+
return getRef(element, index);
|
158
|
+
},
|
159
|
+
key: "".concat(chipId, "_").concat(index),
|
160
|
+
disabled: disabled,
|
161
|
+
readOnly: readOnly,
|
162
|
+
value: text,
|
163
|
+
text: text,
|
164
|
+
onKeyDown: function onKeyDown(event) {
|
165
|
+
return handleChipKeyDown(event, chipId, index);
|
166
|
+
},
|
167
|
+
onClear: function onClear() {
|
168
|
+
return onChipClear(chipId, index);
|
169
|
+
},
|
170
|
+
onClick: onChipClick
|
171
|
+
});
|
172
|
+
})), /*#__PURE__*/React.createElement(TextField_styles.Input, _rollupPluginBabelHelpers.extends({}, rest, {
|
173
|
+
ref: inputRef,
|
174
|
+
id: innerId,
|
175
|
+
"aria-labelledby": labelId,
|
58
176
|
"aria-describedby": helperTextId,
|
59
|
-
placeholder:
|
177
|
+
placeholder: innerPlaceholderValue,
|
60
178
|
disabled: disabled,
|
179
|
+
readOnly: !disabled && readOnly,
|
61
180
|
onChange: handleChange,
|
62
|
-
|
181
|
+
onKeyDown: handleInputKeydown
|
63
182
|
})), labelInside && /*#__PURE__*/React.createElement(TextField_styles.Label, {
|
64
|
-
id:
|
65
|
-
|
183
|
+
id: labelId,
|
184
|
+
htmlFor: innerId
|
185
|
+
}, innerLabelValue)), contentRight && /*#__PURE__*/React.createElement(TextField_styles.StyledContentRight, null, contentRight)), leftHelper && /*#__PURE__*/React.createElement(TextField_styles.LeftHelper, {
|
66
186
|
id: helperTextId
|
67
187
|
}, leftHelper));
|
68
188
|
});
|
69
189
|
};
|
70
190
|
var textFieldConfig = {
|
71
191
|
name: 'TextField',
|
72
|
-
tag: '
|
192
|
+
tag: 'div',
|
73
193
|
layout: textFieldRoot,
|
74
194
|
base: base,
|
75
195
|
variations: {
|
@@ -83,15 +203,21 @@ var textFieldConfig = {
|
|
83
203
|
css: base$3.base,
|
84
204
|
attrs: true
|
85
205
|
},
|
206
|
+
readOnly: {
|
207
|
+
css: base$4.base,
|
208
|
+
attrs: true
|
209
|
+
},
|
86
210
|
labelPlacement: {
|
87
|
-
css: base$
|
211
|
+
css: base$5.base
|
88
212
|
}
|
89
213
|
},
|
90
214
|
defaults: {
|
91
|
-
size: 'm'
|
215
|
+
size: 'm',
|
216
|
+
view: 'default'
|
92
217
|
}
|
93
218
|
};
|
94
219
|
|
220
|
+
exports.base = base;
|
95
221
|
exports.textFieldConfig = textFieldConfig;
|
96
222
|
exports.textFieldRoot = textFieldRoot;
|
97
223
|
//# sourceMappingURL=TextField.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"TextField.js","sources":["../../../src/components/TextField/TextField.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport type { ChangeEventHandler, KeyboardEventHandler, LabelHTMLAttributes } from 'react';\nimport { css } from '@linaria/core';\nimport { safeUseId } from '@salutejs/plasma-core';\n\nimport type { RootProps } from '../../engines';\n\nimport type { TextFieldProps } from './TextField.types';\nimport { base as size } from './_size/base';\nimport { base as view } from './_view/base';\nimport { base as disabled } from './_disabled/base';\nimport { base as labelPlacement } from './_label-placement/base';\nimport { Input, LeftHelper, Label, InputWrapper, InputLabelWrapper } from './TextField.styles';\n\nconst base = css`\n /* NOTE: Webkit не применяет opacity к inline тегам */\n display: block;\n`;\n\nexport const textFieldRoot = (\n Root: RootProps<HTMLInputElement, TextFieldProps & LabelHTMLAttributes<HTMLLabelElement>>,\n) =>\n forwardRef<HTMLInputElement, TextFieldProps>((props, ref) => {\n const {\n // layout\n contentLeft,\n contentRight,\n children,\n label,\n labelPlacement,\n placeholder,\n leftHelper,\n\n // variations\n view,\n size,\n disabled,\n\n // events\n onChange,\n onSearch,\n\n ...rest\n } = props;\n\n const handleChange: ChangeEventHandler<HTMLInputElement> = (event) => {\n const { maxLength, value } = event.target;\n\n if (!onChange || (maxLength !== -1 && value.length > maxLength)) {\n return;\n }\n\n onChange(event);\n };\n\n const handleKeyUp: KeyboardEventHandler<HTMLInputElement> = (event) => {\n if (event.key === 'Enter' && onSearch) {\n onSearch((event.target as HTMLInputElement).value, event);\n }\n };\n\n const labelInside = labelPlacement === 'inner';\n const lableId = safeUseId();\n const helperTextId = safeUseId();\n\n return (\n <Root view={view} size={size} disabled={disabled} labelPlacement={labelPlacement}>\n {labelInside || (label && <Label id={lableId}>{label}</Label>)}\n <InputWrapper>\n {contentLeft}\n <InputLabelWrapper>\n <Input\n {...rest}\n ref={ref}\n aria-labelledby={lableId}\n aria-describedby={helperTextId}\n placeholder={placeholder}\n disabled={disabled}\n onChange={handleChange}\n onKeyUp={handleKeyUp}\n />\n {labelInside && <Label id={lableId}>{label}</Label>}\n </InputLabelWrapper>\n {contentRight}\n </InputWrapper>\n {leftHelper && <LeftHelper id={helperTextId}>{leftHelper}</LeftHelper>}\n </Root>\n );\n });\n\nexport const textFieldConfig = {\n name: 'TextField',\n tag: 'label',\n layout: textFieldRoot,\n base,\n variations: {\n view: {\n css: view,\n },\n size: {\n css: size,\n },\n disabled: {\n css: disabled,\n attrs: true,\n },\n labelPlacement: {\n css: labelPlacement,\n },\n },\n defaults: {\n size: 'm',\n },\n};\n"],"names":["base","textFieldRoot","Root","forwardRef","props","ref","contentLeft","contentRight","label","labelPlacement","placeholder","leftHelper","view","size","disabled","onChange","onSearch","rest","_excluded","handleChange","event","_event$target","target","maxLength","value","length","handleKeyUp","key","labelInside","lableId","safeUseId","helperTextId","React","createElement","Label","id","InputWrapper","InputLabelWrapper","Input","_extends","onKeyUp","LeftHelper","textFieldConfig","name","tag","layout","variations","css","attrs","defaults"],"mappings":";;;;;;;;;;;;;;AAcA,IAAMA,IAAI,GAGT,SAAA,CAAA;IAEYC,aAAa,GAAGA,SAAhBA,aAAaA,CACtBC,IAAyF,EAAA;AAAA,EAAA,oBAEzFC,gBAAU,CAAmC,UAACC,KAAK,EAAEC,GAAG,EAAK;AACzD,IAAA,IAEIC,WAAW,GAkBXF,KAAK,CAlBLE,WAAW,CAAA;MACXC,YAAY,GAiBZH,KAAK,CAjBLG,YAAY,CAAA;MAEZC,KAAK,GAeLJ,KAAK,CAfLI,KAAK,CAAA;MACLC,cAAc,GAcdL,KAAK,CAdLK,cAAc,CAAA;MACdC,WAAW,GAaXN,KAAK,CAbLM,WAAW,CAAA;MACXC,UAAU,GAYVP,KAAK,CAZLO,UAAU,CAAA;MAGVC,IAAI,GASJR,KAAK,CATLQ,IAAI,CAAA;MACJC,IAAI,GAQJT,KAAK,CARLS,IAAI,CAAA;MACJC,QAAQ,GAOR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A,QAAQ,EAAE;AACNiC,MAAAA,GAAG,EAAEjC,WAAQ;AACbkC,MAAAA,KAAK,EAAE,IAAA;KACV;AACDvC,IAAAA,cAAc,EAAE;AACZsC,MAAAA,GAAG,EAAEtC,WAAAA;AACT,KAAA;GACH;AACDwC,EAAAA,QAAQ,EAAE;AACNpC,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;;"}
|
1
|
+
{"version":3,"file":"TextField.js","sources":["../../../src/components/TextField/TextField.tsx"],"sourcesContent":["import React, { forwardRef, useEffect, useRef, useState } from 'react';\nimport type { ChangeEventHandler } from 'react';\nimport { safeUseId } from '@salutejs/plasma-core';\nimport { css } from '@linaria/core';\n\nimport type { RootProps } from '../../engines';\nimport { cx } from '../../utils';\n\nimport type { ChipValues, TextFieldPrimitiveValue, TextFieldProps } from './TextField.types';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as disabledCSS } from './variations/_disabled/base';\nimport { base as readOnlyCSS } from './variations/_read-only/base';\nimport { base as labelPlacementCSS } from './variations/_label-placement/base';\nimport {\n Input,\n LeftHelper,\n Label,\n InputWrapper,\n InputLabelWrapper,\n StyledContentLeft,\n StyledContentRight,\n StyledChips,\n} from './TextField.styles';\nimport { classes } from './TextField.tokens';\nimport { TextFieldChip } from './ui';\nimport { useKeyNavigation } from './hooks/useKeyNavigation';\n\nexport const base = css`\n /* NOTE: Webkit не применяет opacity к inline тегам */\n display: block;\n overflow: hidden;\n`;\n\nexport const textFieldRoot = (Root: RootProps<HTMLDivElement, TextFieldProps>) =>\n forwardRef<HTMLDivElement, TextFieldProps>(\n (\n {\n id,\n\n // layout\n contentLeft,\n contentRight,\n label,\n labelPlacement,\n placeholder,\n leftHelper,\n enumerationType = 'plain',\n\n // variations\n view,\n size,\n readOnly = false,\n disabled = false,\n\n // controlled\n chips: values,\n\n // events\n onChange,\n onChangeChips,\n onSearch,\n\n ...rest\n },\n ref,\n ) => {\n const contentRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const chipsRefs = useRef<Array<HTMLButtonElement>>([]);\n\n const controlledRefs = { contentRef, inputRef, chipsRefs };\n\n const [chips, setChips] = useState<Array<ChipValues>>([]);\n\n const uniqId = safeUseId();\n const innerId = id || uniqId;\n const labelId = safeUseId();\n const helperTextId = safeUseId();\n\n const isChipEnumeration = enumerationType === 'chip';\n const hideLabel = (size === 'xs' || isChipEnumeration) && labelPlacement === 'inner';\n const labelInside = size !== 'xs' && labelPlacement === 'inner';\n const innerLabelPlacementValue = hideLabel ? 'outer' : labelPlacement;\n const innerPlaceholderValue = hideLabel ? label : placeholder;\n const innerLabelValue = hideLabel ? undefined : label;\n\n const isChipsVisible = isChipEnumeration && chips?.length;\n const withHasChips = isChipsVisible ? classes.hasChips : undefined;\n const wrapperWithoutLeftContent = !contentLeft && isChipsVisible ? classes.hasEmptyContentLeft : undefined;\n const wrapperWithoutRightContent =\n !contentRight && isChipsVisible ? classes.hasEmptyContentRight : undefined;\n\n const handleChange: ChangeEventHandler<HTMLInputElement> = (event) => {\n if (disabled || readOnly) {\n return;\n }\n\n const { maxLength, value } = event.target;\n\n if (maxLength !== -1 && value.length > maxLength) {\n return;\n }\n\n onChange?.(event);\n };\n\n const updateChips = (newChips: Array<ChipValues>, newValues: Array<TextFieldPrimitiveValue>) => {\n setChips(newChips);\n onChangeChips?.(newValues);\n };\n\n const { handleInputKeydown, handleChipKeyDown, onChipClear, handleContentKeyDown } = useKeyNavigation({\n controlledRefs,\n disabled,\n readOnly,\n chips,\n enumerationType,\n updateChips,\n onSearch,\n onChange,\n });\n\n const onChipClick = (event: React.MouseEvent<HTMLButtonElement>) => event.stopPropagation();\n\n const handleInputFocus = () => {\n if (readOnly || disabled || !inputRef?.current) {\n return;\n }\n\n inputRef.current.scrollIntoView({\n behavior: 'smooth',\n block: 'center',\n inline: 'center',\n });\n inputRef.current.focus({ preventScroll: true });\n };\n\n const getRef = (element: HTMLButtonElement | null, index: number) => {\n if (element && chipsRefs?.current) {\n chipsRefs.current[index] = element;\n }\n };\n\n useEffect(() => {\n if (!isChipEnumeration && !values?.length) {\n return;\n }\n\n const newChips =\n values?.map((value, index) => ({\n id: `${index}_${value}`,\n text: value,\n })) || [];\n\n setChips(newChips);\n }, [isChipEnumeration, values]);\n\n return (\n <Root\n ref={ref}\n view={view}\n size={size}\n disabled={disabled}\n readOnly={!disabled && readOnly}\n labelPlacement={innerLabelPlacementValue}\n onClick={handleInputFocus}\n >\n {labelInside ||\n (innerLabelValue && (\n <Label id={labelId} htmlFor={id}>\n {innerLabelValue}\n </Label>\n ))}\n <InputWrapper className={cx(withHasChips, wrapperWithoutLeftContent, wrapperWithoutRightContent)}>\n {contentLeft && <StyledContentLeft>{contentLeft}</StyledContentLeft>}\n <InputLabelWrapper\n tabIndex={-1}\n ref={contentRef}\n onKeyDown={handleContentKeyDown}\n className={withHasChips}\n >\n {isChipEnumeration && Boolean(chips?.length) && (\n <StyledChips>\n {chips?.map(({ id: chipId, text }, index) => {\n return (\n <TextFieldChip\n id={chipId}\n ref={(element) => getRef(element, index)}\n key={`${chipId}_${index}`}\n disabled={disabled}\n readOnly={readOnly}\n value={text}\n text={text}\n onKeyDown={(event) => handleChipKeyDown(event, chipId, index)}\n onClear={() => onChipClear(chipId, index)}\n onClick={onChipClick}\n />\n );\n })}\n </StyledChips>\n )}\n <Input\n {...rest}\n ref={inputRef}\n id={innerId}\n aria-labelledby={labelId}\n aria-describedby={helperTextId}\n placeholder={innerPlaceholderValue}\n disabled={disabled}\n readOnly={!disabled && readOnly}\n onChange={handleChange}\n onKeyDown={handleInputKeydown}\n />\n {labelInside && (\n <Label id={labelId} htmlFor={innerId}>\n {innerLabelValue}\n </Label>\n )}\n </InputLabelWrapper>\n {contentRight && <StyledContentRight>{contentRight}</StyledContentRight>}\n </InputWrapper>\n {leftHelper && <LeftHelper id={helperTextId}>{leftHelper}</LeftHelper>}\n </Root>\n );\n },\n );\n\nexport const textFieldConfig = {\n name: 'TextField',\n tag: 'div',\n layout: textFieldRoot,\n base,\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n disabled: {\n css: disabledCSS,\n attrs: true,\n },\n readOnly: {\n css: readOnlyCSS,\n attrs: true,\n },\n labelPlacement: {\n css: labelPlacementCSS,\n },\n },\n defaults: {\n size: 'm',\n view: 'default',\n },\n};\n"],"names":["base","textFieldRoot","Root","forwardRef","_ref","ref","id","contentLeft","contentRight","label","labelPlacement","placeholder","leftHelper","_ref$enumerationType","enumerationType","view","size","_ref$readOnly","readOnly","_ref$disabled","disabled","values","chips","onChange","onChangeChips","onSearch","rest","contentRef","useRef","inputRef","chipsRefs","controlledRefs","_useState","useState","_useState2","_slicedToArray","setChips","uniqId","safeUseId","innerId","labelId","helperTextId","isChipEnumeration","hideLabel","labelInside","innerLabelPlacementValue","innerPlaceholderValue","innerLabelValue","undefined","isChipsVisible","length","withHasChips","classes","hasChips","wrapperWithoutLeftContent","hasEmptyContentLeft","wrapperWithoutRightContent","hasEmptyContentRight","handleChange","event","_event$target","target","maxLength","value","updateChips","newChips","newValues","_useKeyNavigation","useKeyNavigation","handleInputKeydown","handleChipKeyDown","onChipClear","handleContentKeyDown","onChipClick","stopPropagation","handleInputFocus","current","scrollIntoView","behavior","block","inline","focus","preventScroll","getRef","element","index","useEffect","map","concat","text","React","createElement","onClick","Label","htmlFor","InputWrapper","className","cx","StyledContentLeft","InputLabelWrapper","tabIndex","onKeyDown","Boolean","StyledChips","_ref2","chipId","TextFieldChip","key","onClear","Input","_extends","StyledContentRight","LeftHelper","textFieldConfig","name","tag","layout","variations","css","viewCSS","sizeCSS","disabledCSS","attrs","readOnlyCSS","labelPlacementCSS","defaults"],"mappings":";;;;;;;;;;;;;;;;;;;AA4BO,IAAMA,IAAI,GAIhB,UAAA;IAEYC,aAAa,GAAGA,SAAhBA,aAAaA,CAAIC,IAA+C,EAAA;AAAA,EAAA,oBACzEC,gBAAU,CACN,UAAAC,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AA;AAEE,IAAMqG,eAAe,GAAG;AAC3BC,EAAAA,IAAI,EAAE,WAAW;AACjBC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAEnH,aAAa;AACrBD,EAAAA,IAAI,EAAJA,IAAI;AACJqH,EAAAA,UAAU,EAAE;AACRtG,IAAAA,IAAI,EAAE;AACFuG,MAAAA,GAAG,EAAEC,WAAAA;KACR;AACDvG,IAAAA,IAAI,EAAE;AACFsG,MAAAA,GAAG,EAAEE,WAAAA;KACR;AACDpG,IAAAA,QAAQ,EAAE;AACNkG,MAAAA,GAAG,EAAEG,WAAW;AAChBC,MAAAA,KAAK,EAAE,IAAA;KACV;AACDxG,IAAAA,QAAQ,EAAE;AACNoG,MAAAA,GAAG,EAAEK,WAAW;AAChBD,MAAAA,KAAK,EAAE,IAAA;KACV;AACDhH,IAAAA,cAAc,EAAE;AACZ4G,MAAAA,GAAG,EAAEM,WAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACN7G,IAAAA,IAAI,EAAE,GAAG;AACTD,IAAAA,IAAI,EAAE,SAAA;AACV,GAAA;AACJ;;;;;;"}
|
@@ -1,12 +1,12 @@
|
|
1
|
-
import './TextField.
|
1
|
+
import './TextField.styles_1b1mddp.css';
|
2
2
|
'use strict';
|
3
3
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
5
5
|
|
6
6
|
var react = require('@linaria/react');
|
7
7
|
|
8
|
-
var
|
9
|
-
name: "
|
8
|
+
var InputWrapper = /*#__PURE__*/react.styled('div')({
|
9
|
+
name: "InputWrapper",
|
10
10
|
"class": "iq39zt5",
|
11
11
|
propsAsIs: false
|
12
12
|
});
|
@@ -15,21 +15,34 @@ var InputLabelWrapper = /*#__PURE__*/react.styled('div')({
|
|
15
15
|
"class": "i1j28rg8",
|
16
16
|
propsAsIs: false
|
17
17
|
});
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
name: "InputWrapper",
|
22
|
-
"class": "i13zudoe",
|
18
|
+
var StyledChips = /*#__PURE__*/react.styled('div')({
|
19
|
+
name: "StyledChips",
|
20
|
+
"class": "s13zudoe",
|
23
21
|
propsAsIs: false
|
24
22
|
});
|
25
|
-
var
|
23
|
+
var Input = /*#__PURE__*/react.styled('input')({
|
24
|
+
name: "Input",
|
25
|
+
"class": "io4bpie",
|
26
|
+
propsAsIs: false
|
27
|
+
});
|
28
|
+
var Label = /*#__PURE__*/react.styled('label')({
|
26
29
|
name: "Label",
|
27
|
-
"class": "
|
30
|
+
"class": "l13qvwoy",
|
31
|
+
propsAsIs: false
|
32
|
+
});
|
33
|
+
var StyledContentLeft = /*#__PURE__*/react.styled('div')({
|
34
|
+
name: "StyledContentLeft",
|
35
|
+
"class": "s19ry60d",
|
36
|
+
propsAsIs: false
|
37
|
+
});
|
38
|
+
var StyledContentRight = /*#__PURE__*/react.styled('div')({
|
39
|
+
name: "StyledContentRight",
|
40
|
+
"class": "sbt1ohz",
|
28
41
|
propsAsIs: false
|
29
42
|
});
|
30
43
|
var LeftHelper = /*#__PURE__*/react.styled('div')({
|
31
44
|
name: "LeftHelper",
|
32
|
-
"class": "
|
45
|
+
"class": "llv9av6",
|
33
46
|
propsAsIs: false
|
34
47
|
});
|
35
48
|
|
@@ -38,4 +51,7 @@ exports.InputLabelWrapper = InputLabelWrapper;
|
|
38
51
|
exports.InputWrapper = InputWrapper;
|
39
52
|
exports.Label = Label;
|
40
53
|
exports.LeftHelper = LeftHelper;
|
54
|
+
exports.StyledChips = StyledChips;
|
55
|
+
exports.StyledContentLeft = StyledContentLeft;
|
56
|
+
exports.StyledContentRight = StyledContentRight;
|
41
57
|
//# sourceMappingURL=TextField.styles.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"TextField.styles.js","sources":["../../../src/components/TextField/TextField.styles.ts"],"sourcesContent":["import { styled } from '@linaria/react';\n\nexport const
|
1
|
+
{"version":3,"file":"TextField.styles.js","sources":["../../../src/components/TextField/TextField.styles.ts"],"sourcesContent":["import { styled } from '@linaria/react';\n\nimport { classes, tokens } from './TextField.tokens';\n\nexport const InputWrapper = styled.div`\n position: relative;\n display: flex;\n align-items: center;\n box-sizing: border-box;\n`;\n\nexport const InputLabelWrapper = styled.div`\n flex: 1;\n overflow: scroll;\n position: relative;\n width: 100%;\n display: inline-flex;\n align-items: center;\n\n ::-webkit-scrollbar {\n display: none;\n }\n\n scrollbar-width: none;\n\n overscroll-behavior: contain;\n\n &.${String(classes.hasChips)} {\n height: var(${tokens.chipHeight});\n border-radius: var(${tokens.chipBorderRadius});\n }\n`;\n\nexport const StyledChips = styled.div`\n display: flex;\n gap: var(${tokens.chipGap});\n margin-right: var(${tokens.chipGap});\n user-select: none;\n`;\n\nexport const Input = styled.input`\n box-sizing: border-box;\n appearance: none;\n border: 0;\n padding: 0;\n background-color: transparent;\n outline: none;\n flex: 1;\n min-width: 60%;\n`;\n\nexport const Label = styled.label``;\n\nexport const StyledContentLeft = styled.div`\n margin: var(${tokens.leftContentMargin});\n`;\n\nexport const StyledContentRight = styled.div`\n margin: var(${tokens.rightContentMargin});\n`;\n\nexport const LeftHelper = styled.div``;\n"],"names":["InputWrapper","styled","name","class","propsAsIs","InputLabelWrapper","StyledChips","Input","Label","StyledContentLeft","StyledContentRight","LeftHelper"],"mappings":";;;;;;AAIO,IAAMA,YAAY,gBAAGC,YAAM,CAAA,KAAA,CAAA,CAAA;AAAAC,EAAAA,IAAA,EAAA,cAAA;AAAAC,EAAAA,OAAAA,EAAA,SAAA;AAAAC,EAAAA,SAAA,EAAA,KAAA;AAAA,CAKjC,EAAA;AAEM,IAAMC,iBAAiB,gBAAGJ,YAAM,CAAA,KAAA,CAAA,CAAA;AAAAC,EAAAA,IAAA,EAAA,mBAAA;AAAAC,EAAAA,OAAAA,EAAA,UAAA;AAAAC,EAAAA,SAAA,EAAA,KAAA;AAAA,CAoBtC,EAAA;AAEM,IAAME,WAAW,gBAAGL,YAAM,CAAA,KAAA,CAAA,CAAA;AAAAC,EAAAA,IAAA,EAAA,aAAA;AAAAC,EAAAA,OAAAA,EAAA,UAAA;AAAAC,EAAAA,SAAA,EAAA,KAAA;AAAA,CAKhC,EAAA;AAEM,IAAMG,KAAK,gBAAGN,YAAM,CAAA,OAAA,CAAA,CAAA;AAAAC,EAAAA,IAAA,EAAA,OAAA;AAAAC,EAAAA,OAAAA,EAAA,SAAA;AAAAC,EAAAA,SAAA,EAAA,KAAA;AAAA,CAS1B,EAAA;AAEM,IAAMI,KAAK,gBAAGP,YAAM,CAAA,OAAA,CAAA,CAAA;AAAAC,EAAAA,IAAA,EAAA,OAAA;AAAAC,EAAAA,OAAAA,EAAA,UAAA;AAAAC,EAAAA,SAAA,EAAA,KAAA;AAAA,CAAQ,EAAA;AAE5B,IAAMK,iBAAiB,gBAAGR,YAAM,CAAA,KAAA,CAAA,CAAA;AAAAC,EAAAA,IAAA,EAAA,mBAAA;AAAAC,EAAAA,OAAAA,EAAA,UAAA;AAAAC,EAAAA,SAAA,EAAA,KAAA;AAAA,CAEtC,EAAA;AAEM,IAAMM,kBAAkB,gBAAGT,YAAM,CAAA,KAAA,CAAA,CAAA;AAAAC,EAAAA,IAAA,EAAA,oBAAA;AAAAC,EAAAA,OAAAA,EAAA,SAAA;AAAAC,EAAAA,SAAA,EAAA,KAAA;AAAA,CAEvC,EAAA;AAEM,IAAMO,UAAU,gBAAGV,YAAM,CAAA,KAAA,CAAA,CAAA;AAAAC,EAAAA,IAAA,EAAA,YAAA;AAAAC,EAAAA,OAAAA,EAAA,SAAA;AAAAC,EAAAA,SAAA,EAAA,KAAA;AAAA,CAAM;;;;;;;;;;;"}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
.iq39zt5{position:relative;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;box-sizing:border-box;}
|
2
|
+
.i1j28rg8{-webkit-flex:1;-ms-flex:1;flex:1;overflow:scroll;position:relative;width:100%;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-scrollbar-width:none;-moz-scrollbar-width:none;-ms-scrollbar-width:none;scrollbar-width:none;overscroll-behavior:contain;}.i1j28rg8::-webkit-scrollbar{display:none;}.i1j28rg8.has-chips{height:var(--plasma-textfield__chip-height);border-radius:var(--plasma-textfield__chip-border-radius);}
|
3
|
+
.s13zudoe{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;gap:var(--plasma-textfield__chip-gap);margin-right:var(--plasma-textfield__chip-gap);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}
|
4
|
+
.io4bpie{box-sizing:border-box;-webkit-appearance:none;-moz-appearance:none;appearance:none;border:0;padding:0;background-color:transparent;outline:none;-webkit-flex:1;-ms-flex:1;flex:1;min-width:60%;}
|
5
|
+
|
6
|
+
.s19ry60d{margin:var(--plasma-textfield__left-content-margin);}
|
7
|
+
.sbt1ohz{margin:var(--plasma-textfield__right-content-margin);}
|
8
|
+
|
@@ -2,34 +2,45 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
+
var classes = {
|
6
|
+
hasChips: 'has-chips',
|
7
|
+
hasEmptyContentLeft: 'has-empty-content-left',
|
8
|
+
hasEmptyContentRight: 'has-empty-content-right'
|
9
|
+
};
|
5
10
|
var tokens = {
|
6
11
|
color: '--plasma-textfield-color',
|
7
12
|
backgroundColor: '--plasma-textfield-bg-color',
|
8
13
|
backgroundColorHover: '--plasma-textfield-bg-color-hover',
|
9
14
|
backgroundColorFocus: '--plasma-textfield-bg-color-focus',
|
10
|
-
/** Цвет каретки */
|
11
|
-
caretColor: '--plasma-textfield__caret-color',
|
12
|
-
placeholderColor: '--plasma-textfield__placeholder-color',
|
13
15
|
borderColor: '--plasma-textfield-border-color',
|
14
16
|
borderColorHover: '--plasma-textfield-border-color-hover',
|
15
17
|
borderColorFocus: '--plasma-textfield-border-color-focus',
|
18
|
+
/** Цвета для read-only состояния */
|
19
|
+
colorReadOnly: '--plasma-textfield-color-readonly',
|
20
|
+
backgroundColorReadOnly: '--plasma-textfield-bg-color-readonly',
|
21
|
+
borderColorReadOnly: '--plasma-textfield-border-color-readonly',
|
22
|
+
placeholderColorReadOnly: '--plasma-textfield__placeholder-color-readonly',
|
23
|
+
/** Цвет каретки */
|
24
|
+
caretColor: '--plasma-textfield__caret-color',
|
25
|
+
placeholderColor: '--plasma-textfield__placeholder-color',
|
16
26
|
height: '--plasma-textfield-height',
|
17
27
|
borderWidth: '--plasmas-textfield-border-width',
|
18
28
|
borderRadius: '--plasma-textfield-border-radius',
|
19
|
-
/**
|
29
|
+
/** Отступ от границы ТextField */
|
20
30
|
padding: '--plasma-textfield-padding',
|
21
|
-
|
22
|
-
/*
|
23
|
-
|
24
|
-
|
31
|
+
paddingWithChips: '--plasma-textfield-padding-with-chips',
|
32
|
+
/* Токены для инпута */
|
33
|
+
leftContentMargin: '--plasma-textfield__left-content-margin',
|
34
|
+
rightContentMargin: '--plasma-textfield__right-content-margin',
|
25
35
|
fontFamily: '--plasma-textfield-font-family',
|
26
36
|
fontStyle: '--plasma-textfield-font-style',
|
27
37
|
fontSize: '--plasma-textfield-font-size',
|
28
38
|
fontWeight: '--plasma-textfield-font-weight',
|
29
39
|
letterSpacing: '--plasma-textfield-letter-spacing',
|
30
40
|
lineHeight: '--plasma-textfield-line-height',
|
31
|
-
/**
|
41
|
+
/** Токены лейбла */
|
32
42
|
labelColor: '--plasma-textfield__label-color',
|
43
|
+
labelColorReadOnly: '--plasma-textfield__label-color-readonly',
|
33
44
|
labelOffset: '--plasma-textfield__label-offset',
|
34
45
|
labelFontFamily: '--plasma-textfield__label-font-family',
|
35
46
|
labelFontStyle: '--plasma-textfield__label-font-style',
|
@@ -44,19 +55,56 @@ var tokens = {
|
|
44
55
|
labelInnerFontWeight: '--plasma-textfield-placement_inner__label-font-weight',
|
45
56
|
labelInnerLetterSpacing: '--plasma-textfield-placement_inner__label-letter-spacing',
|
46
57
|
labelInnerLineHeight: '--plasma-textfield-placement_inner__label-line-height',
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
58
|
+
labelInnerPadding: '--plasma-textfield-placement_inner__label-padding',
|
59
|
+
contentLabelInnerPadding: '--plasma-textfield-placement_inner__content-padding',
|
60
|
+
leftHelperColor: '--plasma-textfield__left-helper-color',
|
61
|
+
leftHelperColorReadOnly: '--plasma-textfield__left-helper-color-readonly',
|
62
|
+
leftHelperOffset: '--plasma-textfield__left-helper-offset',
|
63
|
+
leftHelperFontFamily: '--plasma-textfield__left-helper-font-family',
|
64
|
+
leftHelperFontStyle: '--plasma-textfield__left-helper-font-style',
|
65
|
+
leftHelperFontSize: '--plasma-textfield__left-helper-font-size',
|
66
|
+
leftHelperFontWeight: '--plasma-textfield__left-helper-font-weight',
|
67
|
+
leftHelperLetterSpacing: '--plasma-textfield__left-helper-letter-spacing',
|
68
|
+
leftHelperLineHeight: '--plasma-textfield__left-helper-line-height',
|
57
69
|
/** Прозрачность для всего компонента в состоянии disabled */
|
58
|
-
disabledOpacity: '--plasma-textfield-disabled-opacity'
|
70
|
+
disabledOpacity: '--plasma-textfield-disabled-opacity',
|
71
|
+
/** Токены чипа */
|
72
|
+
chipHeight: '--plasma-textfield__chip-height',
|
73
|
+
chipBorderRadius: '--plasma-textfield__chip-border-radius',
|
74
|
+
chipGap: '--plasma-textfield__chip-gap',
|
75
|
+
chipBackground: '--plasma-textfield__chip-background',
|
76
|
+
chipColor: '--plasma-textfield__chip-color',
|
77
|
+
chipBackgroundHover: '--plasma-textfield__chip-background-hover',
|
78
|
+
chipColorHover: '--plasma-textfield__chip-color-hover',
|
79
|
+
chipScaleHover: '--plasma-textfield__chip-scale-hover',
|
80
|
+
chipBackgroundReadOnly: '--plasma-textfield__chip-background-readonly',
|
81
|
+
chipColorReadOnly: '--plasma-textfield__chip-color-readonly',
|
82
|
+
chipBackgroundReadOnlyHover: '--plasma-textfield__chip-background-readonly-hover',
|
83
|
+
chipColorReadOnlyHover: '--plasma-textfield__chip-color-readonly-hover',
|
84
|
+
chipBackgroundActive: '--plasma-textfield__chip-background-active',
|
85
|
+
chipColorActive: '--plasma-textfield__chip-color-active',
|
86
|
+
chipScaleActive: '--plasma-textfield__chip-scale-active',
|
87
|
+
chipFocusColor: '--plasma-textfield__chip-focus-color',
|
88
|
+
chipCloseIconColor: '--plasma-textfield__chip-close-icon-color',
|
89
|
+
chipOutlineSize: '--plasma-textfield__chip-outline-size',
|
90
|
+
chipWidth: '--plasma-textfield__chip-width',
|
91
|
+
chipPaddingTop: '--plasma-textfield__chip-padding-top',
|
92
|
+
chipPaddingRight: '--plasma-textfield__chip-padding-right',
|
93
|
+
chipPaddingBottom: '--plasma-textfield__chip-padding-bottom',
|
94
|
+
chipPaddingLeft: '--plasma-textfield__chip-padding-left',
|
95
|
+
chipCloseIconSize: '--plasma-textfield__chip-close-icon-size',
|
96
|
+
chipFontFamily: '--plasma-textfield__chip-font-family',
|
97
|
+
chipFontSize: '--plasma-textfield__chip-font-size',
|
98
|
+
chipFontStyle: '--plasma-textfield__chip-font-style',
|
99
|
+
chipFontWeight: '--plasma-textfield__chip-font-weight',
|
100
|
+
chipLetterSpacing: '--plasma-textfield__chip-letter-spacing',
|
101
|
+
chipLineHeight: '--plasma-textfield__chip-line-height',
|
102
|
+
chipClearContentMarginLeft: '--plasma-textfield__chip-clear-content-margin-left',
|
103
|
+
chipClearContentMarginRight: '--plasma-textfield__chip-clear-content-margin-right',
|
104
|
+
chipOpacityReadonly: '--plasma-textfield__chip-opacity-readonly',
|
105
|
+
focusColor: '--plasma-textfield-focus-color'
|
59
106
|
};
|
60
107
|
|
108
|
+
exports.classes = classes;
|
61
109
|
exports.tokens = tokens;
|
62
110
|
//# sourceMappingURL=TextField.tokens.js.map
|