@salutejs/plasma-new-hope 0.176.0-canary.1506.11556906282.0 → 0.176.0-canary.1506.11570845312.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/Autocomplete/Autocomplete.css +1 -1
- package/cjs/components/Autocomplete/ui/TextField/TextField.styles.js +1 -1
- package/cjs/components/Autocomplete/ui/TextField/TextField.styles.js.map +1 -1
- package/cjs/components/Autocomplete/ui/TextField/{TextField.styles_1ye9068.css → TextField.styles_kcgaix.css} +1 -1
- package/cjs/components/Calendar/CalendarBase/CalendarBase.css +9 -9
- package/cjs/components/Calendar/CalendarDouble/CalendarDouble.css +9 -9
- package/cjs/components/Calendar/ui/CalendarHeader/CalendarHeader.css +9 -9
- package/cjs/components/Calendar/ui/CalendarHeader/CalendarHeader.styles.js +1 -1
- package/cjs/components/Calendar/ui/CalendarHeader/CalendarHeader.styles.js.map +1 -1
- package/{es/components/Calendar/ui/CalendarHeader/CalendarHeader.styles_1xijs8w.css → cjs/components/Calendar/ui/CalendarHeader/CalendarHeader.styles_zgya4j.css} +1 -1
- package/cjs/components/Combobox/ComboboxNew/Combobox.css +12 -12
- package/cjs/components/Combobox/ComboboxNew/Combobox.styles.js +10 -10
- package/cjs/components/Combobox/ComboboxNew/Combobox.styles.js.map +1 -1
- package/{es/components/Combobox/ComboboxNew/Combobox.styles_1nqrvms.css → cjs/components/Combobox/ComboboxNew/Combobox.styles_18a8p75.css} +1 -1
- package/cjs/components/Combobox/ComboboxNew/Combobox.tokens.js +0 -26
- package/cjs/components/Combobox/ComboboxNew/Combobox.tokens.js.map +1 -1
- package/cjs/components/Combobox/ComboboxNew/ui/Inner/Inner.css +12 -12
- package/cjs/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.css +12 -12
- package/cjs/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.styles.js +5 -5
- package/cjs/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.styles.js.map +1 -1
- package/{es/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.styles_1jh6ez1.css → cjs/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.styles_1kzr84z.css} +2 -2
- package/cjs/components/Combobox/ComboboxOld/Combobox.css +4 -4
- package/cjs/components/Combobox/ComboboxOld/ui/ComboboxDivider/ComboboxDivider.css +4 -4
- package/cjs/components/Combobox/ComboboxOld/ui/ComboboxFooter/ComboboxFooter.css +4 -4
- package/cjs/components/Combobox/ComboboxOld/ui/ComboboxGroup/ComboboxGroup.css +4 -4
- package/cjs/components/Combobox/ComboboxOld/ui/ComboboxHeader/ComboboxHeader.css +4 -4
- package/cjs/components/DatePicker/RangeDate/RangeDate.css +9 -9
- package/cjs/components/DatePicker/RangeDate/RangeDatePopover/RangeDatePopover.css +9 -9
- package/cjs/components/DatePicker/SingleDate/SingleDate.css +9 -9
- package/cjs/components/Dropdown/Dropdown.css +4 -4
- package/cjs/components/Dropdown/Dropdown.tokens.js.map +1 -1
- package/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.css +4 -4
- package/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.styles.js +1 -1
- package/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.styles.js.map +1 -1
- package/cjs/components/Dropdown/ui/DropdownItem/{DropdownItem.styles_ksnuz.css → DropdownItem.styles_1b439rx.css} +1 -1
- package/cjs/components/Slider/Slider.css +15 -13
- package/cjs/components/Slider/Slider.js +11 -2
- package/cjs/components/Slider/Slider.js.map +1 -1
- package/cjs/components/Slider/Slider.tokens.js +23 -17
- package/cjs/components/Slider/Slider.tokens.js.map +1 -1
- package/cjs/components/Slider/components/Double/Double.css +8 -8
- package/cjs/components/Slider/components/Double/Double.js +58 -23
- package/cjs/components/Slider/components/Double/Double.js.map +1 -1
- package/cjs/components/Slider/components/DoubleUncontrolled/DoubleUncontrolled.css +98 -0
- package/cjs/components/Slider/components/Single/Single.css +14 -14
- package/cjs/components/Slider/components/Single/Single.js +64 -33
- package/cjs/components/Slider/components/Single/Single.js.map +1 -1
- package/cjs/components/Slider/components/Single/Single.styles.js +4 -4
- package/cjs/components/Slider/components/Single/Single.styles.js.map +1 -1
- package/cjs/components/Slider/components/Single/Single.styles_1h7n2s2.css +6 -0
- package/cjs/components/Slider/components/SliderBase/SliderBase.css +5 -5
- package/cjs/components/Slider/components/SliderBase/SliderBase.js +31 -12
- package/cjs/components/Slider/components/SliderBase/SliderBase.js.map +1 -1
- package/cjs/components/Slider/components/SliderBase/SliderBase.styles.js +7 -7
- package/cjs/components/Slider/components/SliderBase/SliderBase.styles.js.map +1 -1
- package/cjs/components/Slider/components/SliderBase/SliderBase.styles_1qt1224.css +5 -0
- package/cjs/components/Slider/ui/Handler/Handler.css +3 -3
- package/cjs/components/Slider/ui/Handler/Handler.js +49 -88
- package/cjs/components/Slider/ui/Handler/Handler.js.map +1 -1
- package/cjs/components/Slider/ui/Handler/Handler.styles.js +17 -7
- package/cjs/components/Slider/ui/Handler/Handler.styles.js.map +1 -1
- package/cjs/components/Slider/ui/Handler/Handler.styles_irtcgm.css +2 -0
- package/cjs/components/Slider/ui/Handler/computeKeyPressData.js +122 -0
- package/cjs/components/Slider/ui/Handler/computeKeyPressData.js.map +1 -0
- package/cjs/components/Slider/ui/Thumb/Thumb.css +1 -1
- package/cjs/components/Slider/ui/Thumb/Thumb.js +3 -2
- package/cjs/components/Slider/ui/Thumb/Thumb.js.map +1 -1
- package/cjs/components/Slider/ui/Thumb/Thumb.styles.js +1 -1
- package/cjs/components/Slider/ui/Thumb/Thumb.styles.js.map +1 -1
- package/cjs/components/Slider/ui/Thumb/Thumb.styles_uyn20e.css +1 -0
- package/cjs/components/Slider/utils/index.js +28 -10
- package/cjs/components/Slider/utils/index.js.map +1 -1
- package/cjs/components/Slider/variations/_view/base.js +1 -1
- package/cjs/components/Slider/variations/_view/base.js.map +1 -1
- package/cjs/components/Slider/variations/_view/base_1s3f6q8.css +1 -0
- package/cjs/index.css +41 -39
- package/cjs/utils/index.js.map +1 -1
- package/emotion/cjs/components/Autocomplete/ui/TextField/TextField.styles.js +1 -1
- package/emotion/cjs/components/Calendar/ui/CalendarHeader/CalendarHeader.styles.js +9 -9
- package/emotion/cjs/components/Combobox/ComboboxNew/Combobox.styles.js +7 -7
- package/emotion/cjs/components/Combobox/ComboboxNew/Combobox.tokens.js +0 -1
- package/emotion/cjs/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.styles.js +12 -12
- package/emotion/cjs/components/Dropdown/Dropdown.tokens.js +0 -1
- package/emotion/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.styles.js +6 -6
- package/emotion/cjs/components/Slider/Slider.js +10 -2
- package/emotion/cjs/components/Slider/Slider.template-doc.mdx +26 -0
- package/emotion/cjs/components/Slider/Slider.tokens.js +23 -17
- package/emotion/cjs/components/Slider/components/Double/Double.js +54 -19
- package/emotion/cjs/components/Slider/components/Single/Single.js +64 -33
- package/emotion/cjs/components/Slider/components/Single/Single.styles.js +18 -9
- package/emotion/cjs/components/Slider/components/SliderBase/SliderBase.js +31 -12
- package/emotion/cjs/components/Slider/components/SliderBase/SliderBase.styles.js +10 -10
- package/emotion/cjs/components/Slider/ui/Handler/Handler.js +52 -88
- package/emotion/cjs/components/Slider/ui/Handler/Handler.styles.js +9 -15
- package/emotion/cjs/components/Slider/ui/Handler/computeKeyPressData.js +121 -0
- package/emotion/cjs/components/Slider/ui/Thumb/Thumb.js +3 -2
- package/emotion/cjs/components/Slider/ui/Thumb/Thumb.styles.js +3 -3
- package/emotion/cjs/components/Slider/utils/index.js +28 -10
- package/emotion/cjs/components/Slider/variations/_view/base.js +2 -1
- package/emotion/cjs/examples/plasma_b2c/components/Autocomplete/Autocomplete.config.js +12 -12
- package/emotion/cjs/examples/plasma_b2c/components/Calendar/CalendarBase.config.js +5 -5
- package/emotion/cjs/examples/plasma_b2c/components/Calendar/CalendarDouble.config.js +5 -5
- package/emotion/cjs/examples/plasma_b2c/components/Combobox/Combobox.config.js +12 -12
- package/emotion/cjs/examples/plasma_b2c/components/DatePicker/DatePicker.config.js +7 -7
- package/emotion/cjs/examples/plasma_b2c/components/Dropdown/Dropdown.config.js +5 -5
- package/emotion/cjs/examples/plasma_b2c/components/Slider/Slider.config.js +7 -7
- package/emotion/cjs/examples/plasma_b2c/components/Slider/Slider.stories.tsx +98 -16
- package/emotion/cjs/examples/plasma_b2c/components/Toast/Toast.config.js +5 -5
- package/emotion/cjs/examples/plasma_web/components/Autocomplete/Autocomplete.config.js +12 -12
- package/emotion/cjs/examples/plasma_web/components/Calendar/CalendarBase.config.js +5 -5
- package/emotion/cjs/examples/plasma_web/components/Calendar/CalendarDouble.config.js +5 -5
- package/emotion/cjs/examples/plasma_web/components/Combobox/Combobox.config.js +12 -12
- package/emotion/cjs/examples/plasma_web/components/DatePicker/DatePicker.config.js +7 -7
- package/emotion/cjs/examples/plasma_web/components/Dropdown/Dropdown.config.js +5 -5
- package/emotion/cjs/examples/plasma_web/components/Slider/Slider.config.js +7 -7
- package/emotion/cjs/examples/plasma_web/components/Slider/Slider.stories.tsx +98 -15
- package/emotion/cjs/examples/plasma_web/components/Toast/Toast.config.js +5 -5
- package/emotion/es/components/Autocomplete/ui/TextField/TextField.styles.js +1 -1
- package/emotion/es/components/Calendar/ui/CalendarHeader/CalendarHeader.styles.js +9 -9
- package/emotion/es/components/Combobox/ComboboxNew/Combobox.styles.js +7 -7
- package/emotion/es/components/Combobox/ComboboxNew/Combobox.tokens.js +0 -1
- package/emotion/es/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.styles.js +12 -12
- package/emotion/es/components/Dropdown/Dropdown.tokens.js +0 -1
- package/emotion/es/components/Dropdown/ui/DropdownItem/DropdownItem.styles.js +6 -6
- package/emotion/es/components/Slider/Slider.js +11 -2
- package/emotion/es/components/Slider/Slider.template-doc.mdx +26 -0
- package/emotion/es/components/Slider/Slider.tokens.js +23 -17
- package/emotion/es/components/Slider/components/Double/Double.js +54 -19
- package/emotion/es/components/Slider/components/Single/Single.js +65 -34
- package/emotion/es/components/Slider/components/Single/Single.styles.js +17 -8
- package/emotion/es/components/Slider/components/SliderBase/SliderBase.js +31 -12
- package/emotion/es/components/Slider/components/SliderBase/SliderBase.styles.js +11 -11
- package/emotion/es/components/Slider/ui/Handler/Handler.js +51 -86
- package/emotion/es/components/Slider/ui/Handler/Handler.styles.js +10 -16
- package/emotion/es/components/Slider/ui/Handler/computeKeyPressData.js +115 -0
- package/emotion/es/components/Slider/ui/Thumb/Thumb.js +3 -2
- package/emotion/es/components/Slider/ui/Thumb/Thumb.styles.js +3 -3
- package/emotion/es/components/Slider/utils/index.js +28 -10
- package/emotion/es/components/Slider/variations/_view/base.js +2 -1
- package/emotion/es/examples/plasma_b2c/components/Autocomplete/Autocomplete.config.js +12 -12
- package/emotion/es/examples/plasma_b2c/components/Calendar/CalendarBase.config.js +5 -5
- package/emotion/es/examples/plasma_b2c/components/Calendar/CalendarDouble.config.js +5 -5
- package/emotion/es/examples/plasma_b2c/components/Combobox/Combobox.config.js +12 -12
- package/emotion/es/examples/plasma_b2c/components/DatePicker/DatePicker.config.js +7 -7
- package/emotion/es/examples/plasma_b2c/components/Dropdown/Dropdown.config.js +5 -5
- package/emotion/es/examples/plasma_b2c/components/Slider/Slider.config.js +7 -7
- package/emotion/es/examples/plasma_b2c/components/Slider/Slider.stories.tsx +98 -16
- package/emotion/es/examples/plasma_b2c/components/Toast/Toast.config.js +5 -5
- package/emotion/es/examples/plasma_web/components/Autocomplete/Autocomplete.config.js +12 -12
- package/emotion/es/examples/plasma_web/components/Calendar/CalendarBase.config.js +5 -5
- package/emotion/es/examples/plasma_web/components/Calendar/CalendarDouble.config.js +5 -5
- package/emotion/es/examples/plasma_web/components/Combobox/Combobox.config.js +12 -12
- package/emotion/es/examples/plasma_web/components/DatePicker/DatePicker.config.js +7 -7
- package/emotion/es/examples/plasma_web/components/Dropdown/Dropdown.config.js +5 -5
- package/emotion/es/examples/plasma_web/components/Slider/Slider.config.js +7 -7
- package/emotion/es/examples/plasma_web/components/Slider/Slider.stories.tsx +98 -15
- package/emotion/es/examples/plasma_web/components/Toast/Toast.config.js +5 -5
- package/es/components/Autocomplete/Autocomplete.css +1 -1
- package/es/components/Autocomplete/ui/TextField/TextField.styles.js +1 -1
- package/es/components/Autocomplete/ui/TextField/TextField.styles.js.map +1 -1
- package/es/components/Autocomplete/ui/TextField/{TextField.styles_1ye9068.css → TextField.styles_kcgaix.css} +1 -1
- package/es/components/Calendar/CalendarBase/CalendarBase.css +9 -9
- package/es/components/Calendar/CalendarDouble/CalendarDouble.css +9 -9
- package/es/components/Calendar/ui/CalendarHeader/CalendarHeader.css +9 -9
- package/es/components/Calendar/ui/CalendarHeader/CalendarHeader.styles.js +1 -1
- package/es/components/Calendar/ui/CalendarHeader/CalendarHeader.styles.js.map +1 -1
- package/{cjs/components/Calendar/ui/CalendarHeader/CalendarHeader.styles_1xijs8w.css → es/components/Calendar/ui/CalendarHeader/CalendarHeader.styles_zgya4j.css} +1 -1
- package/es/components/Combobox/ComboboxNew/Combobox.css +12 -12
- package/es/components/Combobox/ComboboxNew/Combobox.styles.js +11 -11
- package/es/components/Combobox/ComboboxNew/Combobox.styles.js.map +1 -1
- package/{cjs/components/Combobox/ComboboxNew/Combobox.styles_1nqrvms.css → es/components/Combobox/ComboboxNew/Combobox.styles_18a8p75.css} +1 -1
- package/es/components/Combobox/ComboboxNew/Combobox.tokens.js +1 -26
- package/es/components/Combobox/ComboboxNew/Combobox.tokens.js.map +1 -1
- package/es/components/Combobox/ComboboxNew/ui/Inner/Inner.css +12 -12
- package/es/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.css +12 -12
- package/es/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.styles.js +5 -5
- package/es/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.styles.js.map +1 -1
- package/{cjs/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.styles_1jh6ez1.css → es/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.styles_1kzr84z.css} +2 -2
- package/es/components/Combobox/ComboboxOld/Combobox.css +4 -4
- package/es/components/Combobox/ComboboxOld/ui/ComboboxDivider/ComboboxDivider.css +4 -4
- package/es/components/Combobox/ComboboxOld/ui/ComboboxFooter/ComboboxFooter.css +4 -4
- package/es/components/Combobox/ComboboxOld/ui/ComboboxGroup/ComboboxGroup.css +4 -4
- package/es/components/Combobox/ComboboxOld/ui/ComboboxHeader/ComboboxHeader.css +4 -4
- package/es/components/DatePicker/RangeDate/RangeDate.css +9 -9
- package/es/components/DatePicker/RangeDate/RangeDatePopover/RangeDatePopover.css +9 -9
- package/es/components/DatePicker/SingleDate/SingleDate.css +9 -9
- package/es/components/Dropdown/Dropdown.css +4 -4
- package/es/components/Dropdown/Dropdown.tokens.js.map +1 -1
- package/es/components/Dropdown/ui/DropdownItem/DropdownItem.css +4 -4
- package/es/components/Dropdown/ui/DropdownItem/DropdownItem.styles.js +1 -1
- package/es/components/Dropdown/ui/DropdownItem/DropdownItem.styles.js.map +1 -1
- package/es/components/Dropdown/ui/DropdownItem/{DropdownItem.styles_ksnuz.css → DropdownItem.styles_1b439rx.css} +1 -1
- package/es/components/Slider/Slider.css +15 -13
- package/es/components/Slider/Slider.js +11 -2
- package/es/components/Slider/Slider.js.map +1 -1
- package/es/components/Slider/Slider.tokens.js +23 -17
- package/es/components/Slider/Slider.tokens.js.map +1 -1
- package/es/components/Slider/components/Double/Double.css +8 -8
- package/es/components/Slider/components/Double/Double.js +54 -19
- package/es/components/Slider/components/Double/Double.js.map +1 -1
- package/es/components/Slider/components/DoubleUncontrolled/DoubleUncontrolled.css +98 -0
- package/es/components/Slider/components/Single/Single.css +14 -14
- package/es/components/Slider/components/Single/Single.js +65 -34
- package/es/components/Slider/components/Single/Single.js.map +1 -1
- package/es/components/Slider/components/Single/Single.styles.js +4 -4
- package/es/components/Slider/components/Single/Single.styles.js.map +1 -1
- package/es/components/Slider/components/Single/Single.styles_1h7n2s2.css +6 -0
- package/es/components/Slider/components/SliderBase/SliderBase.css +5 -5
- package/es/components/Slider/components/SliderBase/SliderBase.js +31 -12
- package/es/components/Slider/components/SliderBase/SliderBase.js.map +1 -1
- package/es/components/Slider/components/SliderBase/SliderBase.styles.js +7 -7
- package/es/components/Slider/components/SliderBase/SliderBase.styles.js.map +1 -1
- package/es/components/Slider/components/SliderBase/SliderBase.styles_1qt1224.css +5 -0
- package/es/components/Slider/ui/Handler/Handler.css +3 -3
- package/es/components/Slider/ui/Handler/Handler.js +48 -87
- package/es/components/Slider/ui/Handler/Handler.js.map +1 -1
- package/es/components/Slider/ui/Handler/Handler.styles.js +17 -7
- package/es/components/Slider/ui/Handler/Handler.styles.js.map +1 -1
- package/es/components/Slider/ui/Handler/Handler.styles_irtcgm.css +2 -0
- package/es/components/Slider/ui/Handler/computeKeyPressData.js +118 -0
- package/es/components/Slider/ui/Handler/computeKeyPressData.js.map +1 -0
- package/es/components/Slider/ui/Thumb/Thumb.css +1 -1
- package/es/components/Slider/ui/Thumb/Thumb.js +3 -2
- package/es/components/Slider/ui/Thumb/Thumb.js.map +1 -1
- package/es/components/Slider/ui/Thumb/Thumb.styles.js +1 -1
- package/es/components/Slider/ui/Thumb/Thumb.styles.js.map +1 -1
- package/es/components/Slider/ui/Thumb/Thumb.styles_uyn20e.css +1 -0
- package/es/components/Slider/utils/index.js +28 -10
- package/es/components/Slider/utils/index.js.map +1 -1
- package/es/components/Slider/variations/_view/base.js +1 -1
- package/es/components/Slider/variations/_view/base.js.map +1 -1
- package/es/components/Slider/variations/_view/base_1s3f6q8.css +1 -0
- package/es/index.css +41 -39
- package/es/utils/index.js.map +1 -1
- package/package.json +2 -2
- package/styled-components/cjs/components/Autocomplete/ui/TextField/TextField.styles.js +1 -1
- package/styled-components/cjs/components/Calendar/ui/CalendarHeader/CalendarHeader.styles.js +1 -1
- package/styled-components/cjs/components/Combobox/ComboboxNew/Combobox.styles.js +2 -2
- package/styled-components/cjs/components/Combobox/ComboboxNew/Combobox.tokens.js +0 -1
- package/styled-components/cjs/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.styles.js +3 -3
- package/styled-components/cjs/components/Dropdown/Dropdown.tokens.js +0 -1
- package/styled-components/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.styles.js +2 -2
- package/styled-components/cjs/components/Slider/Slider.js +10 -2
- package/styled-components/cjs/components/Slider/Slider.template-doc.mdx +26 -0
- package/styled-components/cjs/components/Slider/Slider.tokens.js +23 -17
- package/styled-components/cjs/components/Slider/components/Double/Double.js +54 -19
- package/styled-components/cjs/components/Slider/components/Single/Single.js +64 -33
- package/styled-components/cjs/components/Slider/components/Single/Single.styles.js +6 -6
- package/styled-components/cjs/components/Slider/components/SliderBase/SliderBase.js +31 -12
- package/styled-components/cjs/components/Slider/components/SliderBase/SliderBase.styles.js +6 -6
- package/styled-components/cjs/components/Slider/ui/Handler/Handler.js +52 -88
- package/styled-components/cjs/components/Slider/ui/Handler/Handler.styles.js +7 -4
- package/styled-components/cjs/components/Slider/ui/Handler/computeKeyPressData.js +121 -0
- package/styled-components/cjs/components/Slider/ui/Thumb/Thumb.js +3 -2
- package/styled-components/cjs/components/Slider/ui/Thumb/Thumb.styles.js +2 -2
- package/styled-components/cjs/components/Slider/utils/index.js +28 -10
- package/styled-components/cjs/components/Slider/variations/_view/base.js +2 -1
- package/styled-components/cjs/examples/plasma_b2c/components/Autocomplete/Autocomplete.config.js +4 -4
- package/styled-components/cjs/examples/plasma_b2c/components/Calendar/CalendarBase.config.js +1 -1
- package/styled-components/cjs/examples/plasma_b2c/components/Calendar/CalendarDouble.config.js +1 -1
- package/styled-components/cjs/examples/plasma_b2c/components/Combobox/Combobox.config.js +4 -4
- package/styled-components/cjs/examples/plasma_b2c/components/DatePicker/DatePicker.config.js +1 -1
- package/styled-components/cjs/examples/plasma_b2c/components/Dropdown/Dropdown.config.js +1 -1
- package/styled-components/cjs/examples/plasma_b2c/components/Slider/Slider.config.js +3 -3
- package/styled-components/cjs/examples/plasma_b2c/components/Slider/Slider.stories.tsx +98 -16
- package/styled-components/cjs/examples/plasma_b2c/components/Toast/Toast.config.js +1 -1
- package/styled-components/cjs/examples/plasma_web/components/Autocomplete/Autocomplete.config.js +4 -4
- package/styled-components/cjs/examples/plasma_web/components/Calendar/CalendarBase.config.js +1 -1
- package/styled-components/cjs/examples/plasma_web/components/Calendar/CalendarDouble.config.js +1 -1
- package/styled-components/cjs/examples/plasma_web/components/Combobox/Combobox.config.js +4 -4
- package/styled-components/cjs/examples/plasma_web/components/DatePicker/DatePicker.config.js +1 -1
- package/styled-components/cjs/examples/plasma_web/components/Dropdown/Dropdown.config.js +1 -1
- package/styled-components/cjs/examples/plasma_web/components/Slider/Slider.config.js +3 -3
- package/styled-components/cjs/examples/plasma_web/components/Slider/Slider.stories.tsx +98 -15
- package/styled-components/cjs/examples/plasma_web/components/Toast/Toast.config.js +1 -1
- package/styled-components/es/components/Autocomplete/ui/TextField/TextField.styles.js +1 -1
- package/styled-components/es/components/Calendar/ui/CalendarHeader/CalendarHeader.styles.js +1 -1
- package/styled-components/es/components/Combobox/ComboboxNew/Combobox.styles.js +2 -2
- package/styled-components/es/components/Combobox/ComboboxNew/Combobox.tokens.js +0 -1
- package/styled-components/es/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.styles.js +3 -3
- package/styled-components/es/components/Dropdown/Dropdown.tokens.js +0 -1
- package/styled-components/es/components/Dropdown/ui/DropdownItem/DropdownItem.styles.js +2 -2
- package/styled-components/es/components/Slider/Slider.js +11 -2
- package/styled-components/es/components/Slider/Slider.template-doc.mdx +26 -0
- package/styled-components/es/components/Slider/Slider.tokens.js +23 -17
- package/styled-components/es/components/Slider/components/Double/Double.js +54 -19
- package/styled-components/es/components/Slider/components/Single/Single.js +65 -34
- package/styled-components/es/components/Slider/components/Single/Single.styles.js +5 -5
- package/styled-components/es/components/Slider/components/SliderBase/SliderBase.js +31 -12
- package/styled-components/es/components/Slider/components/SliderBase/SliderBase.styles.js +7 -7
- package/styled-components/es/components/Slider/ui/Handler/Handler.js +51 -86
- package/styled-components/es/components/Slider/ui/Handler/Handler.styles.js +8 -5
- package/styled-components/es/components/Slider/ui/Handler/computeKeyPressData.js +115 -0
- package/styled-components/es/components/Slider/ui/Thumb/Thumb.js +3 -2
- package/styled-components/es/components/Slider/ui/Thumb/Thumb.styles.js +2 -2
- package/styled-components/es/components/Slider/utils/index.js +28 -10
- package/styled-components/es/components/Slider/variations/_view/base.js +2 -1
- package/styled-components/es/examples/plasma_b2c/components/Autocomplete/Autocomplete.config.js +4 -4
- package/styled-components/es/examples/plasma_b2c/components/Calendar/CalendarBase.config.js +1 -1
- package/styled-components/es/examples/plasma_b2c/components/Calendar/CalendarDouble.config.js +1 -1
- package/styled-components/es/examples/plasma_b2c/components/Combobox/Combobox.config.js +4 -4
- package/styled-components/es/examples/plasma_b2c/components/DatePicker/DatePicker.config.js +1 -1
- package/styled-components/es/examples/plasma_b2c/components/Dropdown/Dropdown.config.js +1 -1
- package/styled-components/es/examples/plasma_b2c/components/Slider/Slider.config.js +3 -3
- package/styled-components/es/examples/plasma_b2c/components/Slider/Slider.stories.tsx +98 -16
- package/styled-components/es/examples/plasma_b2c/components/Toast/Toast.config.js +1 -1
- package/styled-components/es/examples/plasma_web/components/Autocomplete/Autocomplete.config.js +4 -4
- package/styled-components/es/examples/plasma_web/components/Calendar/CalendarBase.config.js +1 -1
- package/styled-components/es/examples/plasma_web/components/Calendar/CalendarDouble.config.js +1 -1
- package/styled-components/es/examples/plasma_web/components/Combobox/Combobox.config.js +4 -4
- package/styled-components/es/examples/plasma_web/components/DatePicker/DatePicker.config.js +1 -1
- package/styled-components/es/examples/plasma_web/components/Dropdown/Dropdown.config.js +1 -1
- package/styled-components/es/examples/plasma_web/components/Slider/Slider.config.js +3 -3
- package/styled-components/es/examples/plasma_web/components/Slider/Slider.stories.tsx +98 -15
- package/styled-components/es/examples/plasma_web/components/Toast/Toast.config.js +1 -1
- package/types/components/Combobox/ComboboxNew/Combobox.styles.d.ts.map +1 -1
- package/types/components/Combobox/ComboboxNew/Combobox.tokens.d.ts +0 -1
- package/types/components/Combobox/ComboboxNew/Combobox.tokens.d.ts.map +1 -1
- package/types/components/Dropdown/Dropdown.tokens.d.ts +0 -1
- package/types/components/Dropdown/Dropdown.tokens.d.ts.map +1 -1
- package/types/components/Slider/Slider.d.ts.map +1 -1
- package/types/components/Slider/Slider.tokens.d.ts +22 -16
- package/types/components/Slider/Slider.tokens.d.ts.map +1 -1
- package/types/components/Slider/components/Double/Double.d.ts.map +1 -1
- package/types/components/Slider/components/Double/Double.types.d.ts +1 -0
- package/types/components/Slider/components/Double/Double.types.d.ts.map +1 -1
- package/types/components/Slider/components/Single/Single.d.ts.map +1 -1
- package/types/components/Slider/components/Single/Single.styles.d.ts +1 -1
- package/types/components/Slider/components/Single/Single.styles.d.ts.map +1 -1
- package/types/components/Slider/components/Single/Single.types.d.ts +79 -7
- package/types/components/Slider/components/Single/Single.types.d.ts.map +1 -1
- package/types/components/Slider/components/SliderBase/SliderBase.d.ts.map +1 -1
- package/types/components/Slider/components/SliderBase/SliderBase.styles.d.ts +1 -1
- package/types/components/Slider/components/SliderBase/SliderBase.styles.d.ts.map +1 -1
- package/types/components/Slider/components/SliderBase/SliderBase.types.d.ts +6 -0
- package/types/components/Slider/components/SliderBase/SliderBase.types.d.ts.map +1 -1
- package/types/components/Slider/ui/Handler/Handler.d.ts.map +1 -1
- package/types/components/Slider/ui/Handler/Handler.styles.d.ts +6 -2
- package/types/components/Slider/ui/Handler/Handler.styles.d.ts.map +1 -1
- package/types/components/Slider/ui/Handler/Handler.types.d.ts +5 -1
- package/types/components/Slider/ui/Handler/Handler.types.d.ts.map +1 -1
- package/types/components/Slider/ui/Handler/computeKeyPressData.d.ts +12 -0
- package/types/components/Slider/ui/Handler/computeKeyPressData.d.ts.map +1 -0
- package/types/components/Slider/ui/Thumb/Thumb.d.ts +1 -1
- package/types/components/Slider/ui/Thumb/Thumb.d.ts.map +1 -1
- package/types/components/Slider/ui/Thumb/Thumb.styles.d.ts.map +1 -1
- package/types/components/Slider/ui/Thumb/Thumb.types.d.ts +1 -0
- package/types/components/Slider/ui/Thumb/Thumb.types.d.ts.map +1 -1
- package/types/components/Slider/utils/index.d.ts +26 -8
- package/types/components/Slider/utils/index.d.ts.map +1 -1
- package/types/components/Slider/variations/_view/base.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Autocomplete/Autocomplete.config.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Calendar/CalendarBase.config.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Calendar/CalendarDouble.config.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Combobox/Combobox.config.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/DatePicker/DatePicker.config.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Dropdown/Dropdown.config.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Slider/Slider.config.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Slider/Slider.d.ts +80 -2
- package/types/examples/plasma_b2c/components/Slider/Slider.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Autocomplete/Autocomplete.config.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Calendar/CalendarBase.config.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Calendar/CalendarDouble.config.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Combobox/Combobox.config.d.ts.map +1 -1
- package/types/examples/plasma_web/components/DatePicker/DatePicker.config.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Dropdown/Dropdown.config.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Slider/Slider.config.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Slider/Slider.d.ts +80 -2
- package/types/examples/plasma_web/components/Slider/Slider.d.ts.map +1 -1
- package/types/utils/index.d.ts +1 -1
- package/types/utils/index.d.ts.map +1 -1
- package/cjs/components/Slider/components/Single/Single.styles_1r9f1e0.css +0 -6
- package/cjs/components/Slider/components/SliderBase/SliderBase.styles_9s4eb3.css +0 -5
- package/cjs/components/Slider/ui/Handler/Handler.styles_8crx5z.css +0 -2
- package/cjs/components/Slider/ui/Thumb/Thumb.styles_4w4gzn.css +0 -1
- package/cjs/components/Slider/variations/_view/base_x642ct.css +0 -1
- package/es/components/Slider/components/Single/Single.styles_1r9f1e0.css +0 -6
- package/es/components/Slider/components/SliderBase/SliderBase.styles_9s4eb3.css +0 -5
- package/es/components/Slider/ui/Handler/Handler.styles_8crx5z.css +0 -2
- package/es/components/Slider/ui/Thumb/Thumb.styles_4w4gzn.css +0 -1
- package/es/components/Slider/variations/_view/base_x642ct.css +0 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"SliderBase.js","sources":["../../../../../src/components/Slider/components/SliderBase/SliderBase.tsx"],"sourcesContent":["import React, { PropsWithChildren, useRef, MouseEventHandler, useEffect } from 'react';\nimport { DraggableData } from 'react-draggable';\n\nimport { useIsomorphicLayoutEffect } from '../../../../hooks';\n\nimport type { SliderViewProps } from './SliderBase.types';\nimport { Fill, Rail, RailWrap, Slider } from './SliderBase.styles';\n\nexport const SliderBase: React.FC<PropsWithChildren<SliderViewProps>> = ({\n max,\n min,\n setStepSize,\n railFillWidth,\n children,\n railFillXPosition = 0,\n disabled,\n labelPlacement,\n rangeValuesPlacement,\n onChange,\n settings = {},\n}) => {\n const { indent = 0.75, fontSizeMultiplier = 16 } = settings;\n\n const ref = useRef<HTMLDivElement | null>(null);\n const gap = indent * fontSizeMultiplier * 2;\n\n useEffect(() => {\n const resizeHandler = () => {\n if (ref.current) {\n const railSize = ref.current.offsetWidth - gap;\n const totalSteps = max - min;\n\n setStepSize(railSize / totalSteps);\n }\n };\n\n resizeHandler();\n }, [labelPlacement
|
1
|
+
{"version":3,"file":"SliderBase.js","sources":["../../../../../src/components/Slider/components/SliderBase/SliderBase.tsx"],"sourcesContent":["import React, { PropsWithChildren, useRef, MouseEventHandler, useEffect } from 'react';\nimport { DraggableData } from 'react-draggable';\n\nimport { useIsomorphicLayoutEffect } from '../../../../hooks';\nimport { classes } from '../../Slider.tokens';\nimport { cx } from '../../../../utils';\n\nimport type { SliderViewProps } from './SliderBase.types';\nimport { Fill, Rail, RailWrap, Slider } from './SliderBase.styles';\n\nexport const SliderBase: React.FC<PropsWithChildren<SliderViewProps>> = ({\n max,\n min,\n setStepSize,\n railFillWidth,\n children,\n railFillXPosition = 0,\n disabled,\n labelPlacement,\n rangeValuesPlacement,\n onChange,\n orientation,\n size,\n sliderAlign,\n settings = {},\n}) => {\n const { indent = 0.75, fontSizeMultiplier = 16 } = settings;\n\n const ref = useRef<HTMLDivElement | null>(null);\n const gap = indent * fontSizeMultiplier * 2;\n const isVertical = orientation === 'vertical';\n\n useEffect(() => {\n const resizeHandler = () => {\n if (ref.current) {\n const railSize = isVertical ? ref.current.offsetHeight - gap : ref.current.offsetWidth - gap;\n const totalSteps = max - min;\n\n setStepSize(railSize / totalSteps);\n }\n };\n\n resizeHandler();\n }, [\n labelPlacement,\n rangeValuesPlacement,\n gap,\n isVertical,\n // для перерасчета размеров\n size,\n sliderAlign,\n ]);\n\n const onHandleChange: MouseEventHandler<HTMLDivElement> = (e) => {\n if (!onChange || disabled) {\n return;\n }\n\n const { x, width, y, height } = e.currentTarget.getBoundingClientRect();\n\n const lastPos = isVertical ? e.clientY - y : e.clientX - x;\n const sliderWidth = isVertical ? height : width;\n\n const position = min + (lastPos / (sliderWidth - gap)) * (max - min);\n const result = Math.max(min, Math.min(max, position));\n\n const data = isVertical ? { lastY: lastPos } : { lastX: lastPos };\n onChange(result, (data as unknown) as DraggableData);\n };\n\n useIsomorphicLayoutEffect(() => {\n const resizeHandler = () => {\n if (ref.current) {\n const railSize = isVertical ? ref.current.offsetHeight - gap : ref.current.offsetWidth - gap;\n const totalSteps = max - min;\n\n setStepSize(railSize / totalSteps);\n }\n };\n\n resizeHandler();\n window.addEventListener('resize', resizeHandler);\n\n return () => window.removeEventListener('resize', resizeHandler);\n }, [min, max, setStepSize, gap, labelPlacement, rangeValuesPlacement, isVertical]);\n\n const fillStyle = isVertical\n ? { top: `${railFillXPosition}px`, height: `${railFillWidth}px`, width: '100%' }\n : { left: `${railFillXPosition}px`, width: `${railFillWidth}px` };\n\n return (\n <Slider ref={ref} className={cx(orientation === 'vertical' && classes.verticalOrientation)}>\n <RailWrap aria-hidden=\"true\" onMouseDown={onHandleChange}>\n <Rail>\n <Fill style={fillStyle} />\n </Rail>\n </RailWrap>\n\n {children}\n </Slider>\n );\n};\n"],"names":["SliderBase","_ref","max","min","setStepSize","railFillWidth","children","_ref$railFillXPositio","railFillXPosition","disabled","labelPlacement","rangeValuesPlacement","onChange","orientation","size","sliderAlign","_ref$settings","settings","_settings$indent","indent","_settings$fontSizeMul","fontSizeMultiplier","ref","useRef","gap","isVertical","useEffect","resizeHandler","current","railSize","offsetHeight","offsetWidth","totalSteps","onHandleChange","e","_e$currentTarget$getB","currentTarget","getBoundingClientRect","x","width","y","height","lastPos","clientY","clientX","sliderWidth","position","result","Math","data","lastY","lastX","useIsomorphicLayoutEffect","window","addEventListener","removeEventListener","fillStyle","top","concat","left","React","createElement","Slider","className","cx","classes","verticalOrientation","RailWrap","onMouseDown","Rail","Fill","style"],"mappings":";;;;;;IAUaA,UAAwD,GAAG,SAA3DA,UAAwDA,CAAAC,IAAA,EAe/D;AAAA,EAAA,IAdFC,GAAG,GAAAD,IAAA,CAAHC,GAAG;IACHC,GAAG,GAAAF,IAAA,CAAHE,GAAG;IACHC,WAAW,GAAAH,IAAA,CAAXG,WAAW;IACXC,aAAa,GAAAJ,IAAA,CAAbI,aAAa;IACbC,QAAQ,GAAAL,IAAA,CAARK,QAAQ;IAAAC,qBAAA,GAAAN,IAAA,CACRO,iBAAiB;AAAjBA,IAAAA,iBAAiB,GAAAD,qBAAA,KAAG,KAAA,CAAA,GAAA,CAAC,GAAAA,qBAAA;IACrBE,QAAQ,GAAAR,IAAA,CAARQ,QAAQ;IACRC,cAAc,GAAAT,IAAA,CAAdS,cAAc;IACdC,oBAAoB,GAAAV,IAAA,CAApBU,oBAAoB;IACpBC,QA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ACnD,WAAW,KAAK,UAAU,IAAIoD,OAAO,CAACC,mBAAmB,CAAA;AAAE,GAAA,eACvFN,KAAA,CAAAC,aAAA,CAACM,QAAQ,EAAA;AAAC,IAAA,aAAA,EAAY,MAAM;AAACC,IAAAA,WAAW,EAAEnC,cAAAA;GACtC2B,eAAAA,KAAA,CAAAC,aAAA,CAACQ,IAAI,qBACDT,KAAA,CAAAC,aAAA,CAACS,IAAI,EAAA;AAACC,IAAAA,KAAK,EAAEf,SAAAA;AAAU,GAAE,CACvB,CACA,CAAC,EAEVlD,QACG,CAAC,CAAA;AAEjB;;;;"}
|
@@ -1,18 +1,18 @@
|
|
1
|
-
import './SliderBase.
|
1
|
+
import './SliderBase.styles_1qt1224.css';
|
2
2
|
import { styled } from '@linaria/react';
|
3
3
|
|
4
|
+
var Rail = /*#__PURE__*/styled('div')({
|
5
|
+
name: "Rail",
|
6
|
+
"class": "r33crq1",
|
7
|
+
propsAsIs: false
|
8
|
+
});
|
4
9
|
var Slider = /*#__PURE__*/styled('div')({
|
5
10
|
name: "Slider",
|
6
|
-
"class": "
|
11
|
+
"class": "snaoqfb",
|
7
12
|
propsAsIs: false
|
8
13
|
});
|
9
14
|
var RailWrap = /*#__PURE__*/styled('div')({
|
10
15
|
name: "RailWrap",
|
11
|
-
"class": "rnaoqfb",
|
12
|
-
propsAsIs: false
|
13
|
-
});
|
14
|
-
var Rail = /*#__PURE__*/styled('div')({
|
15
|
-
name: "Rail",
|
16
16
|
"class": "r1bro5xo",
|
17
17
|
propsAsIs: false
|
18
18
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"SliderBase.styles.js","sources":["../../../../../src/components/Slider/components/SliderBase/SliderBase.styles.ts"],"sourcesContent":["import { styled } from '@linaria/react';\n\nimport { applyHidden } from '../../../../mixins';\nimport { tokens } from '../../Slider.tokens';\n\nexport const
|
1
|
+
{"version":3,"file":"SliderBase.styles.js","sources":["../../../../../src/components/Slider/components/SliderBase/SliderBase.styles.ts"],"sourcesContent":["import { styled } from '@linaria/react';\n\nimport { applyHidden } from '../../../../mixins';\nimport { classes, tokens } from '../../Slider.tokens';\n\nexport const Rail = styled.div`\n position: relative;\n top: 50%;\n\n height: var(${tokens.railThickness});\n\n border-radius: var(${tokens.railBorderRadius});\n background-color: var(${tokens.railBackgroundColor});\n\n overflow: hidden;\n transform: translateY(-50%);\n`;\n\nexport const Slider = styled.div`\n flex: 1;\n position: relative;\n user-select: none;\n height: var(${tokens.size});\n\n &.${classes.verticalOrientation} {\n width: var(${tokens.size});\n height: auto;\n\n ${Rail} {\n top: 0;\n left: 50%;\n transform: translateX(-50%);\n width: var(${tokens.railThickness});\n height: 100%;\n }\n }\n`;\n\nexport const RailWrap = styled.div`\n height: 100%;\n`;\n\nexport const Fill = styled.div`\n position: absolute;\n height: 100%;\n top: 0;\n left: 0;\n background: var(${tokens.fillColor});\n width: 0;\n`;\n\nexport const InputHidden = styled.input`\n ${applyHidden()};\n`;\n"],"names":["Rail","styled","name","class","propsAsIs","Slider","RailWrap","Fill","InputHidden"],"mappings":";;AAKO,IAAMA,IAAI,gBAAGC,MAAM,CAAA,KAAA,CAAA,CAAA;AAAAC,EAAAA,IAAA,EAAA,MAAA;AAAAC,EAAAA,OAAAA,EAAA,SAAA;AAAAC,EAAAA,SAAA,EAAA,KAAA;AAAA,CAWzB,EAAA;AAEM,IAAMC,MAAM,gBAAGJ,MAAM,CAAA,KAAA,CAAA,CAAA;AAAAC,EAAAA,IAAA,EAAA,QAAA;AAAAC,EAAAA,OAAAA,EAAA,SAAA;AAAAC,EAAAA,SAAA,EAAA,KAAA;AAAA,CAkB3B,EAAA;AAEM,IAAME,QAAQ,gBAAGL,MAAM,CAAA,KAAA,CAAA,CAAA;AAAAC,EAAAA,IAAA,EAAA,UAAA;AAAAC,EAAAA,OAAAA,EAAA,UAAA;AAAAC,EAAAA,SAAA,EAAA,KAAA;AAAA,CAE7B,EAAA;AAEM,IAAMG,IAAI,gBAAGN,MAAM,CAAA,KAAA,CAAA,CAAA;AAAAC,EAAAA,IAAA,EAAA,MAAA;AAAAC,EAAAA,OAAAA,EAAA,SAAA;AAAAC,EAAAA,SAAA,EAAA,KAAA;AAAA,CAOzB,EAAA;AAEM,IAAMI,WAAW,gBAAGP,MAAM,CAAA,OAAA,CAAA,CAAA;AAAAC,EAAAA,IAAA,EAAA,aAAA;AAAAC,EAAAA,OAAAA,EAAA,UAAA;AAAAC,EAAAA,SAAA,EAAA,KAAA;AAAA,CAEhC;;;;"}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
.r33crq1{position:relative;top:50%;height:var(--plasma-slider-rail-thickness);border-radius:var(--plasma-slider-rail-border-radius);background-color:var(--plasma-slider-rail-background-color);overflow:hidden;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);}
|
2
|
+
.snaoqfb{-webkit-flex:1;-ms-flex:1;flex:1;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;height:var(--plasma-slider-size);}.snaoqfb.slider-vertical-orientation{width:var(--plasma-slider-size);height:auto;}.snaoqfb.slider-vertical-orientation .r33crq1{top:0;left:50%;-webkit-transform:translateX(-50%);-ms-transform:translateX(-50%);transform:translateX(-50%);width:var(--plasma-slider-rail-thickness);height:100%;}
|
3
|
+
.r1bro5xo{height:100%;}
|
4
|
+
.fdg7yhg{position:absolute;height:100%;top:0;left:0;background:var(--plasma-slider-fill-color);width:0;}
|
5
|
+
.i17ya4q3{visibility:hidden;width:0;height:0;opacity:0;margin:0;padding:0;border:none;}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
.
|
1
|
+
.Thumb_styles_uyn20e_tqbdf8b__de0962c7{width:var(--thumb-size);height:var(--thumb-size);min-width:var(--thumb-size);min-height:var(--thumb-size);position:relative;border-radius:50%;box-sizing:border-box;background:var(--plasma-slider-thumb-background-color);margin:0.0625rem;-webkit-transition:border-color 0.1s ease-in-out;transition:border-color 0.1s ease-in-out;position:relative;}.Thumb_styles_uyn20e_tqbdf8b__de0962c7:after{background:var(--plasma-slider-thumb-border-color);margin:-0.0625rem;content:'';position:absolute;inset:0;z-index:-1;border-radius:inherit;}.Thumb_styles_uyn20e_tqbdf8b__de0962c7:not([disabled]):hover:after,.Thumb_styles_uyn20e_tqbdf8b__de0962c7:not([disabled]):active:after{background:var(--plasma-slider-thumb-focus-border-color);}.Thumb_styles_uyn20e_tqbdf8b__de0962c7[disabled]{cursor:not-allowed;}.Thumb_styles_uyn20e_tqbdf8b__de0962c7:focus{outline:none;}.Thumb_styles_uyn20e_tqbdf8b__de0962c7::before{content:'';position:absolute;top:0.0625rem;left:0.0625rem;right:0.0625rem;bottom:0.0625rem;z-index:1;display:block;box-sizing:content-box;border:0.125rem solid transparent;border-radius:50%;-webkit-transition:box-shadow 0.2s ease-in-out;transition:box-shadow 0.2s ease-in-out;pointer-events:none;}.Thumb_styles_uyn20e_tqbdf8b__de0962c7.Thumb_styles_uyn20e_focusVisible__de0962c7:focus::before,.Thumb_styles_uyn20e_tqbdf8b__de0962c7[data-focus-visible-added]::before{outline:none;box-shadow:0 0 0 0.125rem var(--plasma-slider-thumb-focus-border-color);}
|
2
2
|
|
3
|
-
.
|
4
|
-
.
|
3
|
+
.Handler_styles_irtcgm_s1tnrnip__e8f853c5{position:absolute;z-index:1;top:var(--plasma-slider-current-value-top-offset);text-align:center;width:100%;margin-left:-0.125rem;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;font-family:var(--plasma-slider-value-font-family);font-size:var(--plasma-slider-value-font-size);font-style:var(--plasma-slider-value-font-style);font-weight:var(--plasma-slider-value-font-weight);-webkit-letter-spacing:var(--plasma-slider-value-letter-spacing);-moz-letter-spacing:var(--plasma-slider-value-letter-spacing);-ms-letter-spacing:var(--plasma-slider-value-letter-spacing);letter-spacing:var(--plasma-slider-value-letter-spacing);line-height:var(--plasma-slider-value-line-height);}
|
4
|
+
.Handler_styles_irtcgm_h12uu2lj__e8f853c5{cursor:pointer;position:absolute;z-index:1;top:0;left:0;bottom:0;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;--thumb-size:var(--h12uu2lj-0);}.Handler_styles_irtcgm_h12uu2lj__e8f853c5.Handler_styles_irtcgm_sliderVerticalOrientation__e8f853c5{right:0;bottom:auto;-webkit-align-items:flex-start;-webkit-box-align:flex-start;-ms-flex-align:flex-start;align-items:flex-start;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;}.Handler_styles_irtcgm_h12uu2lj__e8f853c5.Handler_styles_irtcgm_sliderVerticalOrientation__e8f853c5 .Handler_styles_irtcgm_s1tnrnip__e8f853c5{margin:0;top:0;bottom:0;right:0;left:calc(var(--plasma-slider-size) - (var(--plasma-slider-size) - var(--thumb-size)) / 2 + 0.25rem);-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:start;-webkit-justify-content:flex-start;-ms-flex-pack:start;justify-content:flex-start;}.Handler_styles_irtcgm_h12uu2lj__e8f853c5.Handler_styles_irtcgm_sliderValuePlacementLeft__e8f853c5 .Handler_styles_irtcgm_s1tnrnip__e8f853c5{left:auto;right:calc(var(--plasma-slider-size) - (var(--plasma-slider-size) - var(--thumb-size)) / 2 + 0.3125rem);-webkit-box-pack:end;-webkit-justify-content:flex-end;-ms-flex-pack:end;justify-content:flex-end;}
|
@@ -1,30 +1,25 @@
|
|
1
|
-
import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, extends as _extends } from '../../../../_virtual/_rollupPluginBabelHelpers.js';
|
1
|
+
import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, defineProperty as _defineProperty, extends as _extends } from '../../../../_virtual/_rollupPluginBabelHelpers.js';
|
2
2
|
import React, { forwardRef, useRef } from 'react';
|
3
3
|
import Draggable from 'react-draggable';
|
4
|
+
import { cx } from '../../../../utils/index.js';
|
4
5
|
import { getOffsets, getSliderThumbValue } from '../../utils/index.js';
|
5
6
|
import { Thumb } from '../Thumb/Thumb.js';
|
7
|
+
import { classes } from '../../Slider.tokens.js';
|
6
8
|
import { HandlerStyled, StyledValue } from './Handler.styles.js';
|
9
|
+
import { computeKeyPressData } from './computeKeyPressData.js';
|
7
10
|
|
8
|
-
var _excluded = ["stepSize", "onChangeCommitted", "onChange", "
|
11
|
+
var _excluded = ["size", "orientation", "stepSize", "onChangeCommitted", "onChange", "position", "min", "max", "bounds", "zIndex", "disabled", "side", "showCurrentValue", "startOffset", "endOffset", "value", "valuePlacement"];
|
9
12
|
|
10
13
|
// TODO: PLASMA-1707
|
11
14
|
|
12
|
-
var KeyboardSupport = {
|
13
|
-
PageUp: 33,
|
14
|
-
PageDown: 34,
|
15
|
-
End: 35,
|
16
|
-
Home: 36,
|
17
|
-
ArrowLeft: 37,
|
18
|
-
ArrowUp: 38,
|
19
|
-
ArrowRight: 39,
|
20
|
-
ArrowDown: 40
|
21
|
-
};
|
22
15
|
var Handler = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
23
|
-
var
|
16
|
+
var size = _ref.size,
|
17
|
+
orientation = _ref.orientation,
|
18
|
+
stepSize = _ref.stepSize,
|
24
19
|
onChangeCommitted = _ref.onChangeCommitted,
|
25
20
|
onChange = _ref.onChange,
|
26
|
-
_ref$
|
27
|
-
|
21
|
+
_ref$position = _ref.position,
|
22
|
+
position = _ref$position === void 0 ? 0 : _ref$position,
|
28
23
|
min = _ref.min,
|
29
24
|
max = _ref.max,
|
30
25
|
_ref$bounds = _ref.bounds,
|
@@ -39,123 +34,89 @@ var Handler = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
39
34
|
_ref$endOffset = _ref.endOffset,
|
40
35
|
endOffset = _ref$endOffset === void 0 ? 0 : _ref$endOffset,
|
41
36
|
value = _ref.value,
|
37
|
+
valuePlacement = _ref.valuePlacement,
|
42
38
|
rest = _objectWithoutProperties(_ref, _excluded);
|
39
|
+
var isVertical = orientation === 'vertical';
|
43
40
|
var lastOnChangeValue = useRef();
|
44
|
-
var _getOffsets = getOffsets(ref, side),
|
41
|
+
var _getOffsets = getOffsets(ref, side, isVertical),
|
45
42
|
_getOffsets2 = _slicedToArray(_getOffsets, 2),
|
46
|
-
|
47
|
-
|
43
|
+
startClientOffset = _getOffsets2[0],
|
44
|
+
endClientOffset = _getOffsets2[1];
|
48
45
|
var _bounds = _slicedToArray(bounds, 2),
|
49
|
-
|
50
|
-
|
51
|
-
var
|
52
|
-
var
|
53
|
-
var
|
54
|
-
x:
|
55
|
-
y: 0
|
46
|
+
startValueBound = _bounds[0],
|
47
|
+
endValueBound = _bounds[1];
|
48
|
+
var startPositionBound = startValueBound ? (startValueBound - min) * stepSize : null;
|
49
|
+
var endPositionBound = endValueBound ? (endValueBound - min) * stepSize : null;
|
50
|
+
var dragPosition = typeof position === 'number' ? {
|
51
|
+
x: isVertical ? 0 : position,
|
52
|
+
y: isVertical ? position : 0
|
56
53
|
} : undefined;
|
57
54
|
var tabIndex = disabled ? -1 : 0;
|
58
|
-
var computedBounds = {
|
59
|
-
|
60
|
-
right: (rightPositionBound !== null && rightPositionBound !== void 0 ? rightPositionBound : stepSize * (max - min)) - (offsetRight ? stepSize : 0)
|
61
|
-
};
|
62
|
-
var showCurrentValueCondition = showCurrentValue && (xPosition >= startOffset && xPosition <= max * stepSize - endOffset || xPosition === 0 && value !== 0);
|
55
|
+
var computedBounds = _defineProperty(_defineProperty({}, isVertical ? 'top' : 'left', (startPositionBound !== null && startPositionBound !== void 0 ? startPositionBound : 0) - (startClientOffset ? stepSize : 0)), isVertical ? 'bottom' : 'right', (endPositionBound !== null && endPositionBound !== void 0 ? endPositionBound : stepSize * (max - min)) - (endClientOffset ? stepSize : 0));
|
56
|
+
var showCurrentValueCondition = showCurrentValue && (position >= startOffset && position <= max * stepSize - endOffset || position === 0 && value !== 0);
|
63
57
|
var onDrag = function onDrag(_, data) {
|
64
|
-
var newValue = getSliderThumbValue(data.x, stepSize, min, max);
|
58
|
+
var newValue = getSliderThumbValue(isVertical ? data.y : data.x, stepSize, min, max);
|
65
59
|
if (lastOnChangeValue.current !== newValue) {
|
66
60
|
onChange === null || onChange === void 0 || onChange(newValue, data);
|
67
61
|
lastOnChangeValue.current = newValue;
|
68
62
|
}
|
69
63
|
};
|
70
64
|
var onStop = function onStop(_, data) {
|
71
|
-
var newValue = getSliderThumbValue(data.x, stepSize, min, max);
|
65
|
+
var newValue = getSliderThumbValue(isVertical ? data.y : data.x, stepSize, min, max);
|
72
66
|
onChangeCommitted && onChangeCommitted(newValue, data);
|
73
67
|
};
|
74
68
|
var onKeyPress = function onKeyPress(event) {
|
75
69
|
event.persist();
|
76
|
-
var keyCode = event.keyCode,
|
77
|
-
target = event.target;
|
78
|
-
if (!Object.values(KeyboardSupport).includes(keyCode)) {
|
79
|
-
return;
|
80
|
-
}
|
81
|
-
var ArrowUp = KeyboardSupport.ArrowUp,
|
82
|
-
ArrowRight = KeyboardSupport.ArrowRight,
|
83
|
-
ArrowDown = KeyboardSupport.ArrowDown,
|
84
|
-
ArrowLeft = KeyboardSupport.ArrowLeft,
|
85
|
-
Home = KeyboardSupport.Home,
|
86
|
-
End = KeyboardSupport.End,
|
87
|
-
PageDown = KeyboardSupport.PageDown,
|
88
|
-
PageUp = KeyboardSupport.PageUp;
|
89
70
|
var computedMultipleSteps = stepSize * (rest.multipleStepSize / 100 * max);
|
90
|
-
var data = {
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
switch (keyCode) {
|
100
|
-
case ArrowUp:
|
101
|
-
case ArrowRight:
|
102
|
-
data.x = xPosition + stepSize;
|
103
|
-
break;
|
104
|
-
case ArrowDown:
|
105
|
-
case ArrowLeft:
|
106
|
-
data.x = xPosition - stepSize;
|
107
|
-
data.deltaX = -stepSize;
|
108
|
-
break;
|
109
|
-
case PageUp:
|
110
|
-
data.x = xPosition + computedMultipleSteps;
|
111
|
-
data.deltaX = computedMultipleSteps;
|
112
|
-
break;
|
113
|
-
case PageDown:
|
114
|
-
data.x = xPosition - computedMultipleSteps;
|
115
|
-
data.deltaX = -computedMultipleSteps;
|
116
|
-
break;
|
117
|
-
case End:
|
118
|
-
data.x = max * stepSize;
|
119
|
-
break;
|
120
|
-
case Home:
|
121
|
-
data.x = 0;
|
122
|
-
break;
|
123
|
-
default:
|
124
|
-
data.x = 0;
|
71
|
+
var data = computeKeyPressData(event, {
|
72
|
+
isVertical: isVertical,
|
73
|
+
stepSize: stepSize,
|
74
|
+
position: position,
|
75
|
+
max: max,
|
76
|
+
computedMultipleSteps: computedMultipleSteps
|
77
|
+
});
|
78
|
+
if (!data) {
|
79
|
+
return;
|
125
80
|
}
|
126
81
|
var left = computedBounds.left,
|
127
|
-
right = computedBounds.right
|
82
|
+
right = computedBounds.right,
|
83
|
+
top = computedBounds.top,
|
84
|
+
bottom = computedBounds.bottom;
|
128
85
|
|
129
86
|
/*
|
130
87
|
* INFO: Находим значение в диапазоне между указанными левой и правой границами.
|
88
|
+
* Или между верхней и нижней
|
131
89
|
* Необходимо для правильного расчета положения SliderThumb.
|
132
90
|
* см. функция clamp
|
133
91
|
*/
|
134
|
-
var boundedValue = Math.max(Math.min(right, data.x), left);
|
92
|
+
var boundedValue = isVertical ? Math.max(Math.min(bottom, data.y), top) : Math.max(Math.min(right, data.x), left);
|
135
93
|
var computedValue = getSliderThumbValue(boundedValue, stepSize, min, max);
|
136
94
|
lastOnChangeValue.current = computedValue;
|
137
95
|
onChangeCommitted && onChangeCommitted(computedValue, data);
|
138
96
|
};
|
139
97
|
return /*#__PURE__*/React.createElement(Draggable, {
|
140
|
-
axis:
|
98
|
+
axis: isVertical ? 'y' : 'x',
|
141
99
|
bounds: computedBounds,
|
142
|
-
grid: [stepSize, 1],
|
100
|
+
grid: isVertical ? [1, stepSize] : [stepSize, 1],
|
143
101
|
onStop: onStop,
|
144
102
|
onDrag: onDrag,
|
145
|
-
position:
|
103
|
+
position: dragPosition,
|
146
104
|
disabled: disabled
|
147
105
|
}, /*#__PURE__*/React.createElement(HandlerStyled, {
|
148
106
|
ref: ref,
|
149
107
|
style: {
|
150
108
|
zIndex: zIndex
|
151
109
|
},
|
110
|
+
className: cx(isVertical && classes.verticalOrientation, valuePlacement === 'left' && classes.valuePlacementLeft),
|
111
|
+
isLarge: size === 'large',
|
152
112
|
onKeyDown: onKeyPress
|
153
|
-
}, /*#__PURE__*/React.createElement(Thumb, _extends({
|
113
|
+
}, size !== 'none' && /*#__PURE__*/React.createElement(Thumb, _extends({
|
154
114
|
tabIndex: tabIndex,
|
155
115
|
min: min,
|
156
116
|
max: max,
|
157
117
|
value: value,
|
158
|
-
disabled: disabled
|
118
|
+
disabled: disabled,
|
119
|
+
orientation: orientation
|
159
120
|
}, rest)), showCurrentValueCondition && /*#__PURE__*/React.createElement(StyledValue, null, value)));
|
160
121
|
});
|
161
122
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Handler.js","sources":["../../../../../src/components/Slider/ui/Handler/Handler.tsx"],"sourcesContent":["import React, { useRef, forwardRef, KeyboardEvent } from 'react';\nimport Draggable, { DraggableEventHandler } from 'react-draggable';\nimport type { DraggableData } from 'react-draggable';\n\nimport { getSliderThumbValue, getOffsets } from '../../utils';\nimport { Thumb } from '../Thumb/Thumb';\n\nimport type { HandlerProps } from './Handler.types';\nimport { HandlerStyled, StyledValue } from './Handler.styles';\n\n// TODO: PLASMA-1707\ndeclare module 'react-draggable' {\n export interface DraggableProps {\n children: React.ReactNode;\n }\n}\n\nconst KeyboardSupport = {\n PageUp: 33,\n PageDown: 34,\n End: 35,\n Home: 36,\n ArrowLeft: 37,\n ArrowUp: 38,\n ArrowRight: 39,\n ArrowDown: 40,\n};\n\nexport const Handler = forwardRef<HTMLDivElement, HandlerProps>(\n (\n {\n stepSize,\n onChangeCommitted,\n onChange,\n xPosition = 0,\n min,\n max,\n bounds = [],\n zIndex,\n disabled,\n side,\n showCurrentValue = false,\n startOffset = 0,\n endOffset = 0,\n value,\n ...rest\n },\n ref,\n ) => {\n const lastOnChangeValue = useRef<number>();\n\n const [offsetLeft, offsetRight] = getOffsets(ref, side);\n\n const [leftValueBound, rightValueBound] = bounds;\n const leftPositionBound = leftValueBound ? (leftValueBound - min) * stepSize : null;\n const rightPositionBound = rightValueBound ? (rightValueBound - min) * stepSize : null;\n\n const position = typeof xPosition === 'number' ? { x: xPosition, y: 0 } : undefined;\n const tabIndex = disabled ? -1 : 0;\n\n const computedBounds = {\n left: (leftPositionBound ?? 0) - (offsetLeft ? stepSize : 0),\n right: (rightPositionBound ?? stepSize * (max - min)) - (offsetRight ? stepSize : 0),\n };\n\n const showCurrentValueCondition =\n showCurrentValue &&\n ((xPosition >= startOffset && xPosition <= max * stepSize - endOffset) || (xPosition === 0 && value !== 0));\n\n const onDrag: DraggableEventHandler = (_, data) => {\n const newValue = getSliderThumbValue(data.x, stepSize, min, max);\n if (lastOnChangeValue.current !== newValue) {\n onChange?.(newValue, data);\n lastOnChangeValue.current = newValue;\n }\n };\n\n const onStop: DraggableEventHandler = (_, data) => {\n const newValue = getSliderThumbValue(data.x, stepSize, min, max);\n onChangeCommitted && onChangeCommitted(newValue, data);\n };\n\n const onKeyPress = (event: KeyboardEvent<HTMLDivElement>) => {\n event.persist();\n\n const { keyCode, target } = event;\n\n if (!Object.values(KeyboardSupport).includes(keyCode)) {\n return;\n }\n\n const { ArrowUp, ArrowRight, ArrowDown, ArrowLeft, Home, End, PageDown, PageUp } = KeyboardSupport;\n\n const computedMultipleSteps = stepSize * ((rest.multipleStepSize / 100) * max);\n\n const data: DraggableData = {\n x: 0,\n deltaX: stepSize,\n lastX: xPosition,\n y: 0,\n deltaY: 0,\n lastY: 0,\n node: target as HTMLDivElement,\n };\n\n switch (keyCode) {\n case ArrowUp:\n case ArrowRight:\n data.x = xPosition + stepSize;\n break;\n case ArrowDown:\n case ArrowLeft:\n data.x = xPosition - stepSize;\n data.deltaX = -stepSize;\n break;\n case PageUp:\n data.x = xPosition + computedMultipleSteps;\n data.deltaX = computedMultipleSteps;\n break;\n case PageDown:\n data.x = xPosition - computedMultipleSteps;\n data.deltaX = -computedMultipleSteps;\n break;\n case End:\n data.x = max * stepSize;\n break;\n case Home:\n data.x = 0;\n break;\n default:\n data.x = 0;\n }\n\n const { left, right } = computedBounds;\n\n /*\n * INFO: Находим значение в диапазоне между указанными левой и правой границами.\n * Необходимо для правильного расчета положения SliderThumb.\n * см. функция clamp\n */\n const boundedValue = Math.max(Math.min(right, data.x), left);\n\n const computedValue = getSliderThumbValue(boundedValue, stepSize, min, max);\n lastOnChangeValue.current = computedValue;\n\n onChangeCommitted && onChangeCommitted(computedValue, data);\n };\n\n return (\n <Draggable\n axis=\"x\"\n bounds={computedBounds}\n grid={[stepSize, 1]}\n onStop={onStop}\n onDrag={onDrag}\n position={position}\n disabled={disabled}\n >\n <HandlerStyled ref={ref} style={{ zIndex }} onKeyDown={onKeyPress}>\n <Thumb tabIndex={tabIndex} min={min} max={max} value={value} disabled={disabled} {...rest} />\n {showCurrentValueCondition && <StyledValue>{value}</StyledValue>}\n </HandlerStyled>\n </Draggable>\n );\n },\n);\n"],"names":["KeyboardSupport","PageUp","PageDown","End","Home","ArrowLeft","ArrowUp","ArrowRight","ArrowDown","Handler","forwardRef","_ref","ref","stepSize","onChangeCommitted","onChange","_ref$xPosition","xPosition","min","max","_ref$bounds","bounds","zIndex","disabled","side","_ref$showCurrentValue","showCurrentValue","_ref$startOffset","startOffset","_ref$endOffset","endOffset","value","rest","_objectWithoutProperties","_excluded","lastOnChangeValue","useRef","_getOffsets","getOffsets","_getOffsets2","_slicedToArray","offsetLeft","offsetRight","_bounds","leftValueBound","rightValueBound","leftPositionBound","rightPositionBound","position","x","y","undefined","tabIndex","computedBounds","left","right","showCurrentValueCondition","onDrag","_","data","newValue","getSliderThumbValue","current","onStop","onKeyPress","event","persist","keyCode","target","Object","values","includes","computedMultipleSteps","multipleStepSize","deltaX","lastX","deltaY","lastY","node","boundedValue","Math","computedValue","React","createElement","Draggable","axis","grid","HandlerStyled","style","onKeyDown","Thumb","_extends","StyledValue"],"mappings":";;;;;;;;;AAUA;;AAOA,IAAMA,eAAe,GAAG;AACpBC,EAAAA,MAAM,EAAE,EAAE;AACVC,EAAAA,QAAQ,EAAE,EAAE;AACZC,EAAAA,GAAG,EAAE,EAAE;AACPC,EAAAA,IAAI,EAAE,EAAE;AACRC,EAAAA,SAAS,EAAE,EAAE;AACbC,EAAAA,OAAO,EAAE,EAAE;AACXC,EAAAA,UAAU,EAAE,EAAE;AACdC,EAAAA,SAAS,EAAE,EAAA;AACf,CAAC,CAAA;AAEM,IAAMC,OAAO,gBAAGC,UAAU,CAC7B,UAAAC,IAAA,EAkBIC,GAAG,EACF;AAAA,EAAA,IAjBGC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,iBAAiB,GAAAH,IAAA,CAAjBG,iBAAiB;IACjBC,QAAQ,GAAAJ,IAAA,CAARI,QAAQ;IAAAC,cAAA,GAAAL,IAAA,CACRM,SAAS;AAATA,IAAAA,SAAS,GAAAD,cAAA,KAAG,KAAA,CAAA,GAAA,CAAC,GAAAA,cAAA;IACbE,GAAG,GAAAP,IAAA,CAAHO,GAAG;IACHC,GAAG,GAAAR,IAAA,CAAHQ,GAAG;IAAAC,WAAA,GAAAT,IAAA,CACHU,MAAM;AAANA,IAAAA,MAAM,GAAAD,WAAA,KAAG,KAAA,CAAA,GAAA,EAAE,GAAAA,WAAA;IACXE,MAAM,GAAAX,IAAA,CAANW,MAAM;IACNC,QAAQ,GAAAZ,IAAA,CAARY,QAAQ;IACRC,IAAI,GAAAb,IAAA,CAAJa,IAAI;IAAAC,qBAAA,GAAAd,IAAA,CACJe,gBAAgB;AAAhBA,IAAAA,gBAAgB,GAAAD,qBAAA,KAAG,KAAA,CAAA,GAAA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"file":"Handler.js","sources":["../../../../../src/components/Slider/ui/Handler/Handler.tsx"],"sourcesContent":["import React, { useRef, forwardRef, KeyboardEvent } from 'react';\nimport Draggable, { DraggableEventHandler } from 'react-draggable';\n\nimport { cx } from '../../../../utils';\nimport { getSliderThumbValue, getOffsets } from '../../utils';\nimport { Thumb } from '../Thumb/Thumb';\nimport { classes } from '../../Slider.tokens';\n\nimport type { HandlerProps } from './Handler.types';\nimport { HandlerStyled, StyledValue } from './Handler.styles';\nimport { computeKeyPressData } from './computeKeyPressData';\n\n// TODO: PLASMA-1707\ndeclare module 'react-draggable' {\n export interface DraggableProps {\n children: React.ReactNode;\n }\n}\n\nexport const Handler = forwardRef<HTMLDivElement, HandlerProps>(\n (\n {\n size,\n orientation,\n stepSize,\n onChangeCommitted,\n onChange,\n position = 0,\n min,\n max,\n bounds = [],\n zIndex,\n disabled,\n side,\n showCurrentValue = false,\n startOffset = 0,\n endOffset = 0,\n value,\n valuePlacement,\n ...rest\n },\n ref,\n ) => {\n const isVertical = orientation === 'vertical';\n\n const lastOnChangeValue = useRef<number>();\n const [startClientOffset, endClientOffset] = getOffsets(ref, side, isVertical);\n\n const [startValueBound, endValueBound] = bounds;\n const startPositionBound = startValueBound ? (startValueBound - min) * stepSize : null;\n const endPositionBound = endValueBound ? (endValueBound - min) * stepSize : null;\n\n const dragPosition =\n typeof position === 'number' ? { x: isVertical ? 0 : position, y: isVertical ? position : 0 } : undefined;\n const tabIndex = disabled ? -1 : 0;\n\n const computedBounds = {\n [isVertical ? 'top' : 'left']: (startPositionBound ?? 0) - (startClientOffset ? stepSize : 0),\n [isVertical ? 'bottom' : 'right']:\n (endPositionBound ?? stepSize * (max - min)) - (endClientOffset ? stepSize : 0),\n };\n\n const showCurrentValueCondition =\n showCurrentValue &&\n ((position >= startOffset && position <= max * stepSize - endOffset) || (position === 0 && value !== 0));\n\n const onDrag: DraggableEventHandler = (_, data) => {\n const newValue = getSliderThumbValue(isVertical ? data.y : data.x, stepSize, min, max);\n if (lastOnChangeValue.current !== newValue) {\n onChange?.(newValue, data);\n lastOnChangeValue.current = newValue;\n }\n };\n\n const onStop: DraggableEventHandler = (_, data) => {\n const newValue = getSliderThumbValue(isVertical ? data.y : data.x, stepSize, min, max);\n onChangeCommitted && onChangeCommitted(newValue, data);\n };\n\n const onKeyPress = (event: KeyboardEvent<HTMLDivElement>) => {\n event.persist();\n\n const computedMultipleSteps = stepSize * ((rest.multipleStepSize / 100) * max);\n\n const data = computeKeyPressData(event, {\n isVertical,\n stepSize,\n position,\n max,\n computedMultipleSteps,\n });\n\n if (!data) {\n return;\n }\n\n const { left, right, top, bottom } = computedBounds;\n\n /*\n * INFO: Находим значение в диапазоне между указанными левой и правой границами.\n * Или между верхней и нижней\n * Необходимо для правильного расчета положения SliderThumb.\n * см. функция clamp\n */\n const boundedValue = isVertical\n ? Math.max(Math.min(bottom, data.y), top)\n : Math.max(Math.min(right, data.x), left);\n\n const computedValue = getSliderThumbValue(boundedValue, stepSize, min, max);\n lastOnChangeValue.current = computedValue;\n\n onChangeCommitted && onChangeCommitted(computedValue, data);\n };\n\n return (\n <Draggable\n axis={isVertical ? 'y' : 'x'}\n bounds={computedBounds}\n grid={isVertical ? [1, stepSize] : [stepSize, 1]}\n onStop={onStop}\n onDrag={onDrag}\n position={dragPosition}\n disabled={disabled}\n >\n <HandlerStyled\n ref={ref}\n style={{ zIndex }}\n className={cx(\n isVertical && classes.verticalOrientation,\n valuePlacement === 'left' && classes.valuePlacementLeft,\n )}\n isLarge={size === 'large'}\n onKeyDown={onKeyPress}\n >\n {size !== 'none' && (\n <Thumb\n tabIndex={tabIndex}\n min={min}\n max={max}\n value={value}\n disabled={disabled}\n orientation={orientation}\n {...rest}\n />\n )}\n {showCurrentValueCondition && <StyledValue>{value}</StyledValue>}\n </HandlerStyled>\n </Draggable>\n );\n },\n);\n"],"names":["Handler","forwardRef","_ref","ref","size","orientation","stepSize","onChangeCommitted","onChange","_ref$position","position","min","max","_ref$bounds","bounds","zIndex","disabled","side","_ref$showCurrentValue","showCurrentValue","_ref$startOffset","startOffset","_ref$endOffset","endOffset","value","valuePlacement","rest","_objectWithoutProperties","_excluded","isVertical","lastOnChangeValue","useRef","_getOffsets","getOffsets","_getOffsets2","_slicedToArray","startClientOffset","endClientOffset","_bounds","startValueBound","endValueBound","startPositionBound","endPositionBound","dragPosition","x","y","undefined","tabIndex","computedBounds","_defineProperty","showCurrentValueCondition","onDrag","_","data","newValue","getSliderThumbValue","current","onStop","onKeyPress","event","persist","computedMultipleSteps","multipleStepSize","computeKeyPressData","left","right","top","bottom","boundedValue","Math","computedValue","React","createElement","Draggable","axis","grid","HandlerStyled","style","className","cx","classes","verticalOrientation","valuePlacementLeft","isLarge","onKeyDown","Thumb","_extends","StyledValue"],"mappings":";;;;;;;;;;;;AAYA;;AAOO,IAAMA,OAAO,gBAAGC,UAAU,CAC7B,UAAAC,IAAA,EAqBIC,GAAG,EACF;AAAA,EAAA,IApBGC,IAAI,GAAAF,IAAA,CAAJE,IAAI;IACJC,WAAW,GAAAH,IAAA,CAAXG,WAAW;IACXC,QAAQ,GAAAJ,IAAA,CAARI,QAAQ;IACRC,iBAAiB,GAAAL,IAAA,CAAjBK,iBAAiB;IACjBC,QAAQ,GAAAN,IAAA,CAARM,QAAQ;IAAAC,aAAA,GAAAP,IAAA,CACRQ,QAAQ;AAARA,IAAAA,QAAQ,GAAAD,aAAA,KAAG,KAAA,CAAA,GAAA,CAAC,GAAAA,aAAA;IACZE,GAAG,GAAAT,IAAA,CAAHS,GAAG;IACHC,GAAG,GAAAV,IAAA,CAAHU,GAAG;IAAAC,WAAA,GAAAX,IAAA,CACHY,MAAM;AAANA,IAAAA,MAAM,GAAAD,WAAA,KAAG,KAAA,CAAA,GAAA,EAAE,GAAAA,WAAA;IACXE,MAAM,GAAAb,IAAA,CAANa,MAAM;IACNC,QAAQ,GAAAd,IAAA,CAARc,QAAQ;IACRC,IAAI,GAAAf,IAAA,CAAJe,IAAI;IAAAC,qBAAA,G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CACTlD,UAAU,IAAImD,OAAO,CAACC,mBAAmB,EACzCxD,cAAc,KAAK,MAAM,IAAIuD,OAAO,CAACE,kBACzC,CAAE;IACFC,OAAO,EAAE/E,IAAI,KAAK,OAAQ;AAC1BgF,IAAAA,SAAS,EAAE1B,UAAAA;GAEVtD,EAAAA,IAAI,KAAK,MAAM,iBACZmE,KAAA,CAAAC,aAAA,CAACa,KAAK,EAAAC,QAAA,CAAA;AACFvC,IAAAA,QAAQ,EAAEA,QAAS;AACnBpC,IAAAA,GAAG,EAAEA,GAAI;AACTC,IAAAA,GAAG,EAAEA,GAAI;AACTY,IAAAA,KAAK,EAAEA,KAAM;AACbR,IAAAA,QAAQ,EAAEA,QAAS;AACnBX,IAAAA,WAAW,EAAEA,WAAAA;AAAY,GAAA,EACrBqB,IAAI,CACX,CACJ,EACAwB,yBAAyB,iBAAIqB,KAAA,CAAAC,aAAA,CAACe,WAAW,EAAA,IAAA,EAAE/D,KAAmB,CACpD,CACR,CAAC,CAAA;AAEpB,CACJ;;;;"}
|
@@ -1,16 +1,26 @@
|
|
1
|
-
import './Handler.
|
1
|
+
import './Handler.styles_irtcgm.css';
|
2
2
|
import { styled } from '@linaria/react';
|
3
|
+
import { tokens } from '../../Slider.tokens.js';
|
3
4
|
|
4
|
-
var HandlerStyled = /*#__PURE__*/styled('div')({
|
5
|
-
name: "HandlerStyled",
|
6
|
-
"class": "h1tnrnip",
|
7
|
-
propsAsIs: false
|
8
|
-
});
|
9
5
|
var StyledValue = /*#__PURE__*/styled('span')({
|
10
6
|
name: "StyledValue",
|
11
|
-
"class": "
|
7
|
+
"class": "s1tnrnip",
|
12
8
|
propsAsIs: false
|
13
9
|
});
|
10
|
+
var _exp8 = function _exp8() {
|
11
|
+
return function (_ref) {
|
12
|
+
var isLarge = _ref.isLarge;
|
13
|
+
return isLarge ? "var(".concat(tokens.thumbSizeLarge, ")") : "var(".concat(tokens.thumbSize, ")");
|
14
|
+
};
|
15
|
+
};
|
16
|
+
var HandlerStyled = /*#__PURE__*/styled('div')({
|
17
|
+
name: "HandlerStyled",
|
18
|
+
"class": "h12uu2lj",
|
19
|
+
propsAsIs: false,
|
20
|
+
vars: {
|
21
|
+
"h12uu2lj-0": [/*#__PURE__*/_exp8()]
|
22
|
+
}
|
23
|
+
});
|
14
24
|
|
15
25
|
export { HandlerStyled, StyledValue };
|
16
26
|
//# sourceMappingURL=Handler.styles.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Handler.styles.js","sources":["../../../../../src/components/Slider/ui/Handler/Handler.styles.ts"],"sourcesContent":["import { styled } from '@linaria/react';\n\nimport { tokens } from '../../Slider.tokens';\n\nexport const
|
1
|
+
{"version":3,"file":"Handler.styles.js","sources":["../../../../../src/components/Slider/ui/Handler/Handler.styles.ts"],"sourcesContent":["import { styled } from '@linaria/react';\n\nimport { classes, tokens } from '../../Slider.tokens';\n\nexport const StyledValue = styled.span<{ isLargeThumb?: boolean }>`\n position: absolute;\n z-index: 1;\n top: var(${tokens.currentValueTopOffset});\n text-align: center;\n width: 100%;\n margin-left: -0.125rem;\n display: flex;\n justify-content: center;\n font-family: var(${tokens.valueFontFamily});\n font-size: var(${tokens.valueFontSize});\n font-style: var(${tokens.valueFontStyle});\n font-weight: var(${tokens.valueFontWeight});\n letter-spacing: var(${tokens.valueLetterSpacing});\n line-height: var(${tokens.valueLineHeight});\n`;\n\nexport const HandlerStyled = styled.div<{ isLarge?: boolean }>`\n cursor: pointer;\n position: absolute;\n z-index: 1;\n top: 0;\n left: 0;\n bottom: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n\n --thumb-size: ${({ isLarge }) => (isLarge ? `var(${tokens.thumbSizeLarge})` : `var(${tokens.thumbSize})`)};\n\n &.${classes.verticalOrientation} {\n right: 0;\n bottom: auto;\n align-items: flex-start;\n justify-content: center;\n\n ${StyledValue} {\n margin: 0;\n top: 0;\n bottom: 0;\n right: 0;\n left: calc(var(${tokens.size}) - (var(${tokens.size}) - var(--thumb-size)) / 2 + 0.25rem);\n align-items: center;\n justify-content: flex-start;\n }\n }\n\n &.${classes.valuePlacementLeft} {\n ${StyledValue} {\n left: auto;\n right: calc(var(${tokens.size}) - (var(${tokens.size}) - var(--thumb-size)) / 2 + 0.3125rem);\n justify-content: flex-end;\n }\n }\n`;\n"],"names":["StyledValue","styled","name","class","propsAsIs","_exp8","_ref","isLarge","concat","tokens","thumbSizeLarge","thumbSize","HandlerStyled","vars"],"mappings":";;;AAIO,IAAMA,WAAW,gBAAGC,MAAM,CAAA,MAAA,CAAA,CAAA;AAAAC,EAAAA,IAAA,EAAA,aAAA;AAAAC,EAAAA,OAAAA,EAAA,UAAA;AAAAC,EAAAA,SAAA,EAAA,KAAA;AAAA,CAehC,EAAA;AAAC,IAAAC,KAAA,GAlBgBA,SAkBhBA,KAAAA,GAAA;AAAA,EAAA,OAakB,UAAAC,IAAA,EAAA;AAAA,IAAA,IAAGC,OAAAA,GAAAA,IAAAA,CAAAA,OAAAA,CAAAA;AAAAA,IAAAA,OAAeA,OAAO,GAAA,MAAA,CAAAC,MAAA,CAAUC,MAAM,CAACC,cAAe,EAAA,GAAA,CAAA,GAAA,MAAA,CAAAF,MAAA,CAAYC,MAAM,CAACE,SAAU,EAAG,GAAA,CAAA,CAAA;AAAA,GAAA,CAAA;AAAA,CAAA,CAAA;AAXtG,IAAMC,aAAa,gBAAGX,MAAM,CAAA,KAAA,CAAA,CAAA;AAAAC,EAAAA,IAAA,EAAA,eAAA;AAAAC,EAAAA,OAAAA,EAAA,UAAA;AAAAC,EAAAA,SAAA,EAAA,KAAA;AAAAS,EAAAA,IAAA,EAAA;AAAA,IAAA,YAAA,EAAA,cAWfR,KAAyF,EAAA,CAAA;AAAA,GAAA;AAAA,CA0B5G;;;;"}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
.s1tnrnip{position:absolute;z-index:1;top:var(--plasma-slider-current-value-top-offset);text-align:center;width:100%;margin-left:-0.125rem;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;font-family:var(--plasma-slider-value-font-family);font-size:var(--plasma-slider-value-font-size);font-style:var(--plasma-slider-value-font-style);font-weight:var(--plasma-slider-value-font-weight);-webkit-letter-spacing:var(--plasma-slider-value-letter-spacing);-moz-letter-spacing:var(--plasma-slider-value-letter-spacing);-ms-letter-spacing:var(--plasma-slider-value-letter-spacing);letter-spacing:var(--plasma-slider-value-letter-spacing);line-height:var(--plasma-slider-value-line-height);}
|
2
|
+
.h12uu2lj{cursor:pointer;position:absolute;z-index:1;top:0;left:0;bottom:0;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;--thumb-size:var(--h12uu2lj-0);}.h12uu2lj.slider-vertical-orientation{right:0;bottom:auto;-webkit-align-items:flex-start;-webkit-box-align:flex-start;-ms-flex-align:flex-start;align-items:flex-start;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;}.h12uu2lj.slider-vertical-orientation .s1tnrnip{margin:0;top:0;bottom:0;right:0;left:calc(var(--plasma-slider-size) - (var(--plasma-slider-size) - var(--thumb-size)) / 2 + 0.25rem);-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:start;-webkit-justify-content:flex-start;-ms-flex-pack:start;justify-content:flex-start;}.h12uu2lj.slider-value-placement-left .s1tnrnip{left:auto;right:calc(var(--plasma-slider-size) - (var(--plasma-slider-size) - var(--thumb-size)) / 2 + 0.3125rem);-webkit-box-pack:end;-webkit-justify-content:flex-end;-ms-flex-pack:end;justify-content:flex-end;}
|
@@ -0,0 +1,118 @@
|
|
1
|
+
var KeyboardSupport = {
|
2
|
+
PageUp: 33,
|
3
|
+
PageDown: 34,
|
4
|
+
End: 35,
|
5
|
+
Home: 36,
|
6
|
+
ArrowLeft: 37,
|
7
|
+
ArrowUp: 38,
|
8
|
+
ArrowRight: 39,
|
9
|
+
ArrowDown: 40
|
10
|
+
};
|
11
|
+
var ArrowUp = KeyboardSupport.ArrowUp,
|
12
|
+
ArrowRight = KeyboardSupport.ArrowRight,
|
13
|
+
ArrowDown = KeyboardSupport.ArrowDown,
|
14
|
+
ArrowLeft = KeyboardSupport.ArrowLeft,
|
15
|
+
Home = KeyboardSupport.Home,
|
16
|
+
End = KeyboardSupport.End,
|
17
|
+
PageDown = KeyboardSupport.PageDown,
|
18
|
+
PageUp = KeyboardSupport.PageUp;
|
19
|
+
var computeVerticalMovement = function computeVerticalMovement(event, _ref) {
|
20
|
+
var stepSize = _ref.stepSize,
|
21
|
+
position = _ref.position,
|
22
|
+
max = _ref.max,
|
23
|
+
computedMultipleSteps = _ref.computedMultipleSteps;
|
24
|
+
var keyCode = event.keyCode,
|
25
|
+
target = event.target;
|
26
|
+
var data = {
|
27
|
+
x: 0,
|
28
|
+
deltaX: 0,
|
29
|
+
lastX: 0,
|
30
|
+
y: 0,
|
31
|
+
deltaY: stepSize,
|
32
|
+
lastY: position,
|
33
|
+
node: target
|
34
|
+
};
|
35
|
+
switch (keyCode) {
|
36
|
+
case ArrowUp:
|
37
|
+
case ArrowRight:
|
38
|
+
data.y = position - stepSize;
|
39
|
+
data.deltaY = -stepSize;
|
40
|
+
break;
|
41
|
+
case ArrowDown:
|
42
|
+
case ArrowLeft:
|
43
|
+
data.y = position + stepSize;
|
44
|
+
break;
|
45
|
+
case PageUp:
|
46
|
+
data.y = position - computedMultipleSteps;
|
47
|
+
data.deltaY = -computedMultipleSteps;
|
48
|
+
break;
|
49
|
+
case PageDown:
|
50
|
+
data.y = position + computedMultipleSteps;
|
51
|
+
data.deltaY = computedMultipleSteps;
|
52
|
+
break;
|
53
|
+
case End:
|
54
|
+
data.y = max * stepSize;
|
55
|
+
break;
|
56
|
+
case Home:
|
57
|
+
data.y = 0;
|
58
|
+
break;
|
59
|
+
default:
|
60
|
+
data.y = 0;
|
61
|
+
}
|
62
|
+
return data;
|
63
|
+
};
|
64
|
+
var computeHorizontalMovement = function computeHorizontalMovement(event, _ref2) {
|
65
|
+
var stepSize = _ref2.stepSize,
|
66
|
+
position = _ref2.position,
|
67
|
+
max = _ref2.max,
|
68
|
+
computedMultipleSteps = _ref2.computedMultipleSteps;
|
69
|
+
var keyCode = event.keyCode,
|
70
|
+
target = event.target;
|
71
|
+
var data = {
|
72
|
+
x: 0,
|
73
|
+
deltaX: stepSize,
|
74
|
+
lastX: position,
|
75
|
+
y: 0,
|
76
|
+
deltaY: 0,
|
77
|
+
lastY: 0,
|
78
|
+
node: target
|
79
|
+
};
|
80
|
+
switch (keyCode) {
|
81
|
+
case ArrowUp:
|
82
|
+
case ArrowRight:
|
83
|
+
data.x = position + stepSize;
|
84
|
+
break;
|
85
|
+
case ArrowDown:
|
86
|
+
case ArrowLeft:
|
87
|
+
data.x = position - stepSize;
|
88
|
+
data.deltaX = -stepSize;
|
89
|
+
break;
|
90
|
+
case PageUp:
|
91
|
+
data.x = position + computedMultipleSteps;
|
92
|
+
data.deltaX = computedMultipleSteps;
|
93
|
+
break;
|
94
|
+
case PageDown:
|
95
|
+
data.x = position - computedMultipleSteps;
|
96
|
+
data.deltaX = -computedMultipleSteps;
|
97
|
+
break;
|
98
|
+
case End:
|
99
|
+
data.x = max * stepSize;
|
100
|
+
break;
|
101
|
+
case Home:
|
102
|
+
data.x = 0;
|
103
|
+
break;
|
104
|
+
default:
|
105
|
+
data.x = 0;
|
106
|
+
}
|
107
|
+
return data;
|
108
|
+
};
|
109
|
+
var computeKeyPressData = function computeKeyPressData(event, params) {
|
110
|
+
var keyCode = event.keyCode;
|
111
|
+
if (!Object.values(KeyboardSupport).includes(keyCode)) {
|
112
|
+
return null;
|
113
|
+
}
|
114
|
+
return params.isVertical ? computeVerticalMovement(event, params) : computeHorizontalMovement(event, params);
|
115
|
+
};
|
116
|
+
|
117
|
+
export { computeKeyPressData };
|
118
|
+
//# sourceMappingURL=computeKeyPressData.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"computeKeyPressData.js","sources":["../../../../../src/components/Slider/ui/Handler/computeKeyPressData.ts"],"sourcesContent":["import { KeyboardEvent } from 'react';\nimport type { DraggableData } from 'react-draggable';\n\nconst KeyboardSupport = {\n PageUp: 33,\n PageDown: 34,\n End: 35,\n Home: 36,\n ArrowLeft: 37,\n ArrowUp: 38,\n ArrowRight: 39,\n ArrowDown: 40,\n};\n\ninterface Params {\n isVertical: boolean;\n stepSize: number;\n position: number;\n max: number;\n computedMultipleSteps: number;\n}\n\nconst { ArrowUp, ArrowRight, ArrowDown, ArrowLeft, Home, End, PageDown, PageUp } = KeyboardSupport;\n\nconst computeVerticalMovement = (\n event: KeyboardEvent<HTMLDivElement>,\n { stepSize, position, max, computedMultipleSteps }: Params,\n) => {\n const { keyCode, target } = event;\n\n const data: DraggableData = {\n x: 0,\n deltaX: 0,\n lastX: 0,\n y: 0,\n deltaY: stepSize,\n lastY: position,\n node: target as HTMLDivElement,\n };\n\n switch (keyCode) {\n case ArrowUp:\n case ArrowRight:\n data.y = position - stepSize;\n data.deltaY = -stepSize;\n break;\n case ArrowDown:\n case ArrowLeft:\n data.y = position + stepSize;\n break;\n case PageUp:\n data.y = position - computedMultipleSteps;\n data.deltaY = -computedMultipleSteps;\n break;\n case PageDown:\n data.y = position + computedMultipleSteps;\n data.deltaY = computedMultipleSteps;\n break;\n case End:\n data.y = max * stepSize;\n break;\n case Home:\n data.y = 0;\n break;\n default:\n data.y = 0;\n }\n\n return data;\n};\n\nconst computeHorizontalMovement = (\n event: KeyboardEvent<HTMLDivElement>,\n { stepSize, position, max, computedMultipleSteps }: Params,\n) => {\n const { keyCode, target } = event;\n\n const data: DraggableData = {\n x: 0,\n deltaX: stepSize,\n lastX: position,\n y: 0,\n deltaY: 0,\n lastY: 0,\n node: target as HTMLDivElement,\n };\n\n switch (keyCode) {\n case ArrowUp:\n case ArrowRight:\n data.x = position + stepSize;\n break;\n case ArrowDown:\n case ArrowLeft:\n data.x = position - stepSize;\n data.deltaX = -stepSize;\n break;\n case PageUp:\n data.x = position + computedMultipleSteps;\n data.deltaX = computedMultipleSteps;\n break;\n case PageDown:\n data.x = position - computedMultipleSteps;\n data.deltaX = -computedMultipleSteps;\n break;\n case End:\n data.x = max * stepSize;\n break;\n case Home:\n data.x = 0;\n break;\n default:\n data.x = 0;\n }\n\n return data;\n};\n\nexport const computeKeyPressData = (event: KeyboardEvent<HTMLDivElement>, params: Params) => {\n const { keyCode } = event;\n\n if (!Object.values(KeyboardSupport).includes(keyCode)) {\n return null;\n }\n\n return params.isVertical ? computeVerticalMovement(event, params) : computeHorizontalMovement(event, params);\n};\n"],"names":["KeyboardSupport","PageUp","PageDown","End","Home","ArrowLeft","ArrowUp","ArrowRight","ArrowDown","computeVerticalMovement","event","_ref","stepSize","position","max","computedMultipleSteps","keyCode","target","data","x","deltaX","lastX","y","deltaY","lastY","node","computeHorizontalMovement","_ref2","computeKeyPressData","params","Object","values","includes","isVertical"],"mappings":"AAGA,IAAMA,eAAe,GAAG;AACpBC,EAAAA,MAAM,EAAE,EAAE;AACVC,EAAAA,QAAQ,EAAE,EAAE;AACZC,EAAAA,GAAG,EAAE,EAAE;AACPC,EAAAA,IAAI,EAAE,EAAE;AACRC,EAAAA,SAAS,EAAE,EAAE;AACbC,EAAAA,OAAO,EAAE,EAAE;AACXC,EAAAA,UAAU,EAAE,EAAE;AACdC,EAAAA,SAAS,EAAE,EAAA;AACf,CAAC,CAAA;AAUD,IAAQF,OAAO,GAAoEN,eAAe,CAA1FM,OAAO;EAAEC,UAAU,GAAwDP,eAAe,CAAjFO,UAAU;EAAEC,SAAS,GAA6CR,eAAe,CAArEQ,SAAS;EAAEH,SAAS,GAAkCL,eAAe,CAA1DK,SAAS;EAAED,IAAI,GAA4BJ,eAAe,CAA/CI,IAAI;EAAED,GAAG,GAAuBH,eAAe,CAAzCG,GAAG;EAAED,QAAQ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AuB,CAACC,KAAK,EAAEmB,MAAM,CAAC,GAAGH,yBAAyB,CAAChB,KAAK,EAAEmB,MAAM,CAAC,CAAA;AAChH;;;;"}
|
@@ -1 +1 @@
|
|
1
|
-
.
|
1
|
+
.Thumb_styles_uyn20e_tqbdf8b__de0962c7{width:var(--thumb-size);height:var(--thumb-size);min-width:var(--thumb-size);min-height:var(--thumb-size);position:relative;border-radius:50%;box-sizing:border-box;background:var(--plasma-slider-thumb-background-color);margin:0.0625rem;-webkit-transition:border-color 0.1s ease-in-out;transition:border-color 0.1s ease-in-out;position:relative;}.Thumb_styles_uyn20e_tqbdf8b__de0962c7:after{background:var(--plasma-slider-thumb-border-color);margin:-0.0625rem;content:'';position:absolute;inset:0;z-index:-1;border-radius:inherit;}.Thumb_styles_uyn20e_tqbdf8b__de0962c7:not([disabled]):hover:after,.Thumb_styles_uyn20e_tqbdf8b__de0962c7:not([disabled]):active:after{background:var(--plasma-slider-thumb-focus-border-color);}.Thumb_styles_uyn20e_tqbdf8b__de0962c7[disabled]{cursor:not-allowed;}.Thumb_styles_uyn20e_tqbdf8b__de0962c7:focus{outline:none;}.Thumb_styles_uyn20e_tqbdf8b__de0962c7::before{content:'';position:absolute;top:0.0625rem;left:0.0625rem;right:0.0625rem;bottom:0.0625rem;z-index:1;display:block;box-sizing:content-box;border:0.125rem solid transparent;border-radius:50%;-webkit-transition:box-shadow 0.2s ease-in-out;transition:box-shadow 0.2s ease-in-out;pointer-events:none;}.Thumb_styles_uyn20e_tqbdf8b__de0962c7.Thumb_styles_uyn20e_focusVisible__de0962c7:focus::before,.Thumb_styles_uyn20e_tqbdf8b__de0962c7[data-focus-visible-added]::before{outline:none;box-shadow:0 0 0 0.125rem var(--plasma-slider-thumb-focus-border-color);}
|
@@ -2,7 +2,7 @@ import { objectWithoutProperties as _objectWithoutProperties, extends as _extend
|
|
2
2
|
import React from 'react';
|
3
3
|
import { ThumbBase } from './Thumb.styles.js';
|
4
4
|
|
5
|
-
var _excluded = ["min", "max", "value", "ariaValueMin", "ariaLabel", "disabled"];
|
5
|
+
var _excluded = ["min", "max", "value", "ariaValueMin", "ariaLabel", "disabled", "orientation"];
|
6
6
|
var Thumb = function Thumb(_ref) {
|
7
7
|
var min = _ref.min,
|
8
8
|
max = _ref.max,
|
@@ -11,6 +11,7 @@ var Thumb = function Thumb(_ref) {
|
|
11
11
|
ariaValueMin = _ref$ariaValueMin === void 0 ? min : _ref$ariaValueMin,
|
12
12
|
ariaLabel = _ref.ariaLabel,
|
13
13
|
disabled = _ref.disabled,
|
14
|
+
orientation = _ref.orientation,
|
14
15
|
rest = _objectWithoutProperties(_ref, _excluded);
|
15
16
|
return /*#__PURE__*/React.createElement(ThumbBase, _extends({
|
16
17
|
role: "slider",
|
@@ -19,7 +20,7 @@ var Thumb = function Thumb(_ref) {
|
|
19
20
|
"aria-valuemax": max,
|
20
21
|
"aria-valuenow": value,
|
21
22
|
disabled: disabled,
|
22
|
-
"aria-orientation":
|
23
|
+
"aria-orientation": orientation
|
23
24
|
}, rest));
|
24
25
|
};
|
25
26
|
|