@salutejs/plasma-new-hope 0.167.0-dev.0 → 0.168.0-canary.1459.11360824834.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/Autocomplete/Autocomplete.css +34 -19
- package/cjs/components/Autocomplete/Autocomplete.js +4 -2
- package/cjs/components/Autocomplete/Autocomplete.js.map +1 -1
- package/cjs/components/Combobox/ComboboxNew/Combobox.css +38 -18
- package/cjs/components/Combobox/ComboboxNew/ui/Inner/Inner.css +38 -18
- package/cjs/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.css +38 -18
- package/cjs/components/DatePicker/RangeDate/RangeDate.css +34 -19
- package/cjs/components/DatePicker/RangeDate/RangeDate.js +77 -15
- package/cjs/components/DatePicker/RangeDate/RangeDate.js.map +1 -1
- package/cjs/components/DatePicker/RangeDate/RangeDatePopover/RangeDatePopover.css +33 -18
- package/cjs/components/DatePicker/RangeDate/RangeDatePopover/RangeDatePopover.js +14 -7
- package/cjs/components/DatePicker/RangeDate/RangeDatePopover/RangeDatePopover.js.map +1 -1
- package/cjs/components/DatePicker/RangeDate/variations/_size/base.js +1 -1
- package/cjs/components/DatePicker/RangeDate/variations/_size/base.js.map +1 -1
- package/cjs/components/DatePicker/RangeDate/variations/_size/base_1d0sbzw.css +1 -0
- package/cjs/components/DatePicker/SingleDate/SingleDate.css +35 -20
- package/cjs/components/DatePicker/SingleDate/SingleDate.js +33 -8
- package/cjs/components/DatePicker/SingleDate/SingleDate.js.map +1 -1
- package/cjs/components/DatePicker/hooks/useDatePicker.js +20 -48
- package/cjs/components/DatePicker/hooks/useDatePicker.js.map +1 -1
- package/cjs/components/DatePicker/hooks/useKeyboardNavigation.js +11 -1
- package/cjs/components/DatePicker/hooks/useKeyboardNavigation.js.map +1 -1
- package/cjs/components/DatePicker/utils/dateHelper.js +31 -0
- package/cjs/components/DatePicker/utils/dateHelper.js.map +1 -1
- package/cjs/components/Range/Range.css +39 -19
- package/cjs/components/Slider/Slider.css +39 -19
- package/cjs/components/Slider/Slider.js +2 -0
- package/cjs/components/Slider/Slider.js.map +1 -1
- package/cjs/components/Slider/components/Double/Double.css +39 -19
- package/cjs/components/TextArea/TextArea.js +109 -18
- package/cjs/components/TextArea/TextArea.js.map +1 -1
- package/cjs/components/TextArea/TextArea.styles.js +160 -63
- package/cjs/components/TextArea/TextArea.styles.js.map +1 -1
- package/cjs/components/TextArea/TextArea.styles_mcxlmk.css +17 -0
- package/cjs/components/TextArea/TextArea.tokens.js +43 -4
- package/cjs/components/TextArea/TextArea.tokens.js.map +1 -1
- package/cjs/components/TextArea/hooks/useAutoResize.js +2 -4
- package/cjs/components/TextArea/hooks/useAutoResize.js.map +1 -1
- package/cjs/components/TextArea/variations/_clear/base.js +1 -1
- package/cjs/components/TextArea/variations/_clear/base.js.map +1 -1
- package/cjs/components/TextArea/variations/_clear/base_1ezvvtt.css +1 -0
- package/cjs/components/TextArea/variations/_hint-size/base.js +9 -0
- package/cjs/components/TextArea/variations/_hint-size/base.js.map +1 -0
- package/cjs/components/TextArea/variations/_hint-size/base_1ipgv90.css +1 -0
- package/cjs/components/TextArea/variations/_hint-view/base.js +9 -0
- package/cjs/components/TextArea/variations/_hint-view/base.js.map +1 -0
- package/cjs/components/TextArea/variations/_hint-view/base_111a0qe.css +1 -0
- package/cjs/components/TextArea/variations/_view/base.js +1 -1
- package/cjs/components/TextArea/variations/_view/base.js.map +1 -1
- package/cjs/components/TextArea/variations/_view/base_1xgrm3x.css +1 -0
- package/cjs/components/TextField/TextField.js +97 -9
- package/cjs/components/TextField/TextField.js.map +1 -1
- package/cjs/components/TextField/TextField.styles.js +76 -23
- package/cjs/components/TextField/TextField.styles.js.map +1 -1
- package/cjs/components/TextField/TextField.styles_17xt45g.css +21 -0
- package/cjs/components/TextField/TextField.tokens.js +40 -1
- package/cjs/components/TextField/TextField.tokens.js.map +1 -1
- package/cjs/components/TextField/variations/_clear/base.js +1 -1
- package/cjs/components/TextField/variations/_clear/base.js.map +1 -1
- package/cjs/components/TextField/variations/_clear/base_1pkwm4m.css +1 -0
- package/cjs/components/TextField/variations/_disabled/base.js +1 -1
- package/cjs/components/TextField/variations/_disabled/{base_2tv0nz.css → base_4d3opa.css} +1 -1
- package/cjs/components/TextField/variations/_hint-size/base.js +9 -0
- package/cjs/components/TextField/variations/_hint-size/base.js.map +1 -0
- package/cjs/components/TextField/variations/_hint-size/base_1x99605.css +1 -0
- package/cjs/components/TextField/variations/_hint-view/base.js +9 -0
- package/cjs/components/TextField/variations/_hint-view/base.js.map +1 -0
- package/cjs/components/TextField/variations/_hint-view/base_l8etux.css +1 -0
- package/cjs/components/TextField/variations/_label-placement/base.js +1 -1
- package/cjs/components/TextField/variations/_label-placement/base.js.map +1 -1
- package/cjs/components/TextField/variations/_label-placement/base_3domm.css +1 -0
- package/cjs/components/TextField/variations/_read-only/base.js +1 -1
- package/cjs/components/TextField/variations/_read-only/base.js.map +1 -1
- package/cjs/components/TextField/variations/_read-only/base_17ypmu7.css +1 -0
- package/cjs/components/TextField/variations/_size/base.js +1 -1
- package/cjs/components/TextField/variations/_size/base.js.map +1 -1
- package/cjs/components/TextField/variations/_size/base_1xdmaqh.css +1 -0
- package/cjs/components/TextField/variations/_view/base.js +1 -1
- package/cjs/components/TextField/variations/_view/base.js.map +1 -1
- package/cjs/components/TextField/variations/_view/base_qhyte8.css +1 -0
- package/cjs/components/TextFieldGroup/TextFieldGroup.css +1 -1
- package/cjs/components/TextFieldGroup/variations/_shape/base.js +1 -1
- package/cjs/components/TextFieldGroup/variations/_shape/base_52bndd.css +1 -0
- package/cjs/components/_Icon/Icon.assets/InfoCircleOutline.js +23 -0
- package/cjs/components/_Icon/Icon.assets/InfoCircleOutline.js.map +1 -0
- package/cjs/components/_Icon/Icons/IconInfoCircleOutline.js +23 -0
- package/cjs/components/_Icon/Icons/IconInfoCircleOutline.js.map +1 -0
- package/cjs/index.css +55 -35
- package/emotion/cjs/components/Autocomplete/Autocomplete.js +4 -2
- package/emotion/cjs/components/DatePicker/RangeDate/RangeDate.js +77 -15
- package/emotion/cjs/components/DatePicker/RangeDate/RangeDatePopover/RangeDatePopover.js +14 -7
- package/emotion/cjs/components/DatePicker/RangeDate/variations/_size/base.js +1 -1
- package/emotion/cjs/components/DatePicker/SingleDate/SingleDate.js +33 -8
- package/emotion/cjs/components/DatePicker/hooks/useDatePicker.js +20 -48
- package/emotion/cjs/components/DatePicker/hooks/useKeyboardNavigation.js +11 -1
- package/emotion/cjs/components/DatePicker/utils/dateHelper.js +31 -1
- package/emotion/cjs/components/TextArea/TextArea.js +112 -23
- package/emotion/cjs/components/TextArea/TextArea.styles.js +99 -41
- package/emotion/cjs/components/TextArea/TextArea.template-doc.mdx +6 -1
- package/emotion/cjs/components/TextArea/TextArea.tokens.js +43 -4
- package/emotion/cjs/components/TextArea/hooks/useAutoResize.js +2 -4
- package/emotion/cjs/components/TextArea/variations/_clear/base.js +1 -1
- package/emotion/cjs/components/TextArea/variations/_hint-size/base.js +11 -0
- package/emotion/cjs/components/TextArea/variations/_hint-size/tokens.json +21 -0
- package/emotion/cjs/components/TextArea/variations/_hint-view/base.js +11 -0
- package/emotion/cjs/components/TextArea/variations/_hint-view/tokens.json +5 -0
- package/emotion/cjs/components/TextArea/variations/_view/base.js +2 -1
- package/emotion/cjs/components/TextField/TextField.js +99 -12
- package/emotion/cjs/components/TextField/TextField.styles.js +84 -37
- package/emotion/cjs/components/TextField/TextField.template-doc.mdx +6 -1
- package/emotion/cjs/components/TextField/TextField.tokens.js +40 -1
- package/emotion/cjs/components/TextField/variations/_clear/base.js +1 -1
- package/emotion/cjs/components/TextField/variations/_hint-size/base.js +11 -0
- package/emotion/cjs/components/TextField/variations/_hint-size/tokens.json +21 -0
- package/emotion/cjs/components/TextField/variations/_hint-view/base.js +11 -0
- package/emotion/cjs/components/TextField/variations/_hint-view/tokens.json +5 -0
- package/emotion/cjs/components/TextField/variations/_label-placement/base.js +1 -1
- package/emotion/cjs/components/TextField/variations/_read-only/base.js +1 -1
- package/emotion/cjs/components/TextField/variations/_size/base.js +1 -1
- package/emotion/cjs/components/TextField/variations/_view/base.js +1 -1
- package/emotion/cjs/components/_Icon/Icon.assets/InfoCircleOutline.js +22 -0
- package/emotion/cjs/components/_Icon/Icons/IconInfoCircleOutline.js +22 -0
- package/emotion/cjs/components/_Icon/index.js +8 -1
- package/emotion/cjs/examples/plasma_b2c/components/TextArea/TextArea.config.js +19 -10
- package/emotion/cjs/examples/plasma_b2c/components/TextArea/TextArea.stories.tsx +72 -0
- package/emotion/cjs/examples/plasma_b2c/components/TextField/TextField.config.js +22 -13
- package/emotion/cjs/examples/plasma_b2c/components/TextField/TextField.stories.tsx +73 -1
- package/emotion/cjs/examples/plasma_web/components/TextArea/TextArea.config.js +19 -10
- package/emotion/cjs/examples/plasma_web/components/TextArea/TextArea.stories.tsx +72 -0
- package/emotion/cjs/examples/plasma_web/components/TextField/TextField.config.js +22 -13
- package/emotion/cjs/examples/plasma_web/components/TextField/TextField.stories.tsx +82 -10
- package/emotion/es/components/Autocomplete/Autocomplete.js +4 -2
- package/emotion/es/components/DatePicker/RangeDate/RangeDate.js +79 -17
- package/emotion/es/components/DatePicker/RangeDate/RangeDatePopover/RangeDatePopover.js +14 -7
- package/emotion/es/components/DatePicker/RangeDate/variations/_size/base.js +1 -1
- package/emotion/es/components/DatePicker/SingleDate/SingleDate.js +34 -9
- package/emotion/es/components/DatePicker/hooks/useDatePicker.js +21 -49
- package/emotion/es/components/DatePicker/hooks/useKeyboardNavigation.js +11 -1
- package/emotion/es/components/DatePicker/utils/dateHelper.js +30 -0
- package/emotion/es/components/TextArea/TextArea.js +113 -24
- package/emotion/es/components/TextArea/TextArea.styles.js +98 -40
- package/emotion/es/components/TextArea/TextArea.template-doc.mdx +6 -1
- package/emotion/es/components/TextArea/TextArea.tokens.js +43 -4
- package/emotion/es/components/TextArea/hooks/useAutoResize.js +2 -4
- package/emotion/es/components/TextArea/variations/_clear/base.js +2 -2
- package/emotion/es/components/TextArea/variations/_hint-size/base.js +5 -0
- package/emotion/es/components/TextArea/variations/_hint-size/tokens.json +21 -0
- package/emotion/es/components/TextArea/variations/_hint-view/base.js +5 -0
- package/emotion/es/components/TextArea/variations/_hint-view/tokens.json +5 -0
- package/emotion/es/components/TextArea/variations/_view/base.js +2 -1
- package/emotion/es/components/TextField/TextField.js +99 -12
- package/emotion/es/components/TextField/TextField.styles.js +83 -36
- package/emotion/es/components/TextField/TextField.template-doc.mdx +6 -1
- package/emotion/es/components/TextField/TextField.tokens.js +40 -1
- package/emotion/es/components/TextField/variations/_clear/base.js +2 -2
- package/emotion/es/components/TextField/variations/_hint-size/base.js +5 -0
- package/emotion/es/components/TextField/variations/_hint-size/tokens.json +21 -0
- package/emotion/es/components/TextField/variations/_hint-view/base.js +5 -0
- package/emotion/es/components/TextField/variations/_hint-view/tokens.json +5 -0
- package/emotion/es/components/TextField/variations/_label-placement/base.js +1 -1
- package/emotion/es/components/TextField/variations/_read-only/base.js +2 -2
- package/emotion/es/components/TextField/variations/_size/base.js +2 -2
- package/emotion/es/components/TextField/variations/_view/base.js +2 -2
- package/emotion/es/components/_Icon/Icon.assets/InfoCircleOutline.js +15 -0
- package/emotion/es/components/_Icon/Icons/IconInfoCircleOutline.js +15 -0
- package/emotion/es/components/_Icon/index.js +2 -1
- package/emotion/es/examples/plasma_b2c/components/TextArea/TextArea.config.js +19 -10
- package/emotion/es/examples/plasma_b2c/components/TextArea/TextArea.stories.tsx +72 -0
- package/emotion/es/examples/plasma_b2c/components/TextField/TextField.config.js +22 -13
- package/emotion/es/examples/plasma_b2c/components/TextField/TextField.stories.tsx +73 -1
- package/emotion/es/examples/plasma_web/components/TextArea/TextArea.config.js +19 -10
- package/emotion/es/examples/plasma_web/components/TextArea/TextArea.stories.tsx +72 -0
- package/emotion/es/examples/plasma_web/components/TextField/TextField.config.js +22 -13
- package/emotion/es/examples/plasma_web/components/TextField/TextField.stories.tsx +82 -10
- package/es/components/Autocomplete/Autocomplete.css +34 -19
- package/es/components/Autocomplete/Autocomplete.js +4 -2
- package/es/components/Autocomplete/Autocomplete.js.map +1 -1
- package/es/components/Combobox/ComboboxNew/Combobox.css +38 -18
- package/es/components/Combobox/ComboboxNew/ui/Inner/Inner.css +38 -18
- package/es/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.css +38 -18
- package/es/components/DatePicker/RangeDate/RangeDate.css +34 -19
- package/es/components/DatePicker/RangeDate/RangeDate.js +79 -17
- package/es/components/DatePicker/RangeDate/RangeDate.js.map +1 -1
- package/es/components/DatePicker/RangeDate/RangeDatePopover/RangeDatePopover.css +33 -18
- package/es/components/DatePicker/RangeDate/RangeDatePopover/RangeDatePopover.js +14 -7
- package/es/components/DatePicker/RangeDate/RangeDatePopover/RangeDatePopover.js.map +1 -1
- package/es/components/DatePicker/RangeDate/variations/_size/base.js +1 -1
- package/es/components/DatePicker/RangeDate/variations/_size/base.js.map +1 -1
- package/es/components/DatePicker/RangeDate/variations/_size/base_1d0sbzw.css +1 -0
- package/es/components/DatePicker/SingleDate/SingleDate.css +35 -20
- package/es/components/DatePicker/SingleDate/SingleDate.js +34 -9
- package/es/components/DatePicker/SingleDate/SingleDate.js.map +1 -1
- package/es/components/DatePicker/hooks/useDatePicker.js +21 -49
- package/es/components/DatePicker/hooks/useDatePicker.js.map +1 -1
- package/es/components/DatePicker/hooks/useKeyboardNavigation.js +11 -1
- package/es/components/DatePicker/hooks/useKeyboardNavigation.js.map +1 -1
- package/es/components/DatePicker/utils/dateHelper.js +31 -1
- package/es/components/DatePicker/utils/dateHelper.js.map +1 -1
- package/es/components/Range/Range.css +39 -19
- package/es/components/Slider/Slider.css +39 -19
- package/es/components/Slider/Slider.js +2 -0
- package/es/components/Slider/Slider.js.map +1 -1
- package/es/components/Slider/components/Double/Double.css +39 -19
- package/es/components/TextArea/TextArea.js +113 -22
- package/es/components/TextArea/TextArea.js.map +1 -1
- package/es/components/TextArea/TextArea.styles.js +155 -64
- package/es/components/TextArea/TextArea.styles.js.map +1 -1
- package/es/components/TextArea/TextArea.styles_mcxlmk.css +17 -0
- package/es/components/TextArea/TextArea.tokens.js +43 -4
- package/es/components/TextArea/TextArea.tokens.js.map +1 -1
- package/es/components/TextArea/hooks/useAutoResize.js +2 -4
- package/es/components/TextArea/hooks/useAutoResize.js.map +1 -1
- package/es/components/TextArea/variations/_clear/base.js +1 -1
- package/es/components/TextArea/variations/_clear/base.js.map +1 -1
- package/es/components/TextArea/variations/_clear/base_1ezvvtt.css +1 -0
- package/es/components/TextArea/variations/_hint-size/base.js +5 -0
- package/es/components/TextArea/variations/_hint-size/base.js.map +1 -0
- package/es/components/TextArea/variations/_hint-size/base_1ipgv90.css +1 -0
- package/es/components/TextArea/variations/_hint-view/base.js +5 -0
- package/es/components/TextArea/variations/_hint-view/base.js.map +1 -0
- package/es/components/TextArea/variations/_hint-view/base_111a0qe.css +1 -0
- package/es/components/TextArea/variations/_view/base.js +1 -1
- package/es/components/TextArea/variations/_view/base.js.map +1 -1
- package/es/components/TextArea/variations/_view/base_1xgrm3x.css +1 -0
- package/es/components/TextField/TextField.js +99 -11
- package/es/components/TextField/TextField.js.map +1 -1
- package/es/components/TextField/TextField.styles.js +71 -24
- package/es/components/TextField/TextField.styles.js.map +1 -1
- package/es/components/TextField/TextField.styles_17xt45g.css +21 -0
- package/es/components/TextField/TextField.tokens.js +40 -1
- package/es/components/TextField/TextField.tokens.js.map +1 -1
- package/es/components/TextField/variations/_clear/base.js +1 -1
- package/es/components/TextField/variations/_clear/base.js.map +1 -1
- package/es/components/TextField/variations/_clear/base_1pkwm4m.css +1 -0
- package/es/components/TextField/variations/_disabled/base.js +1 -1
- package/es/components/TextField/variations/_disabled/{base_2tv0nz.css → base_4d3opa.css} +1 -1
- package/es/components/TextField/variations/_hint-size/base.js +5 -0
- package/es/components/TextField/variations/_hint-size/base.js.map +1 -0
- package/es/components/TextField/variations/_hint-size/base_1x99605.css +1 -0
- package/es/components/TextField/variations/_hint-view/base.js +5 -0
- package/es/components/TextField/variations/_hint-view/base.js.map +1 -0
- package/es/components/TextField/variations/_hint-view/base_l8etux.css +1 -0
- package/es/components/TextField/variations/_label-placement/base.js +1 -1
- package/es/components/TextField/variations/_label-placement/base.js.map +1 -1
- package/es/components/TextField/variations/_label-placement/base_3domm.css +1 -0
- package/es/components/TextField/variations/_read-only/base.js +1 -1
- package/es/components/TextField/variations/_read-only/base.js.map +1 -1
- package/es/components/TextField/variations/_read-only/base_17ypmu7.css +1 -0
- package/es/components/TextField/variations/_size/base.js +1 -1
- package/es/components/TextField/variations/_size/base.js.map +1 -1
- package/es/components/TextField/variations/_size/base_1xdmaqh.css +1 -0
- package/es/components/TextField/variations/_view/base.js +1 -1
- package/es/components/TextField/variations/_view/base.js.map +1 -1
- package/es/components/TextField/variations/_view/base_qhyte8.css +1 -0
- package/es/components/TextFieldGroup/TextFieldGroup.css +1 -1
- package/es/components/TextFieldGroup/variations/_shape/base.js +1 -1
- package/es/components/TextFieldGroup/variations/_shape/base_52bndd.css +1 -0
- package/es/components/_Icon/Icon.assets/InfoCircleOutline.js +19 -0
- package/es/components/_Icon/Icon.assets/InfoCircleOutline.js.map +1 -0
- package/es/components/_Icon/Icons/IconInfoCircleOutline.js +19 -0
- package/es/components/_Icon/Icons/IconInfoCircleOutline.js.map +1 -0
- package/es/index.css +55 -35
- package/package.json +2 -2
- package/styled-components/cjs/components/Autocomplete/Autocomplete.js +4 -2
- package/styled-components/cjs/components/DatePicker/RangeDate/RangeDate.js +77 -15
- package/styled-components/cjs/components/DatePicker/RangeDate/RangeDatePopover/RangeDatePopover.js +14 -7
- package/styled-components/cjs/components/DatePicker/RangeDate/variations/_size/base.js +1 -1
- package/styled-components/cjs/components/DatePicker/SingleDate/SingleDate.js +33 -8
- package/styled-components/cjs/components/DatePicker/hooks/useDatePicker.js +20 -48
- package/styled-components/cjs/components/DatePicker/hooks/useKeyboardNavigation.js +11 -1
- package/styled-components/cjs/components/DatePicker/utils/dateHelper.js +31 -1
- package/styled-components/cjs/components/TextArea/TextArea.js +111 -22
- package/styled-components/cjs/components/TextArea/TextArea.styles.js +85 -42
- package/styled-components/cjs/components/TextArea/TextArea.template-doc.mdx +6 -1
- package/styled-components/cjs/components/TextArea/TextArea.tokens.js +43 -4
- package/styled-components/cjs/components/TextArea/hooks/useAutoResize.js +2 -4
- package/styled-components/cjs/components/TextArea/variations/_clear/base.js +1 -1
- package/styled-components/cjs/components/TextArea/variations/_hint-size/base.js +11 -0
- package/styled-components/cjs/components/TextArea/variations/_hint-size/tokens.json +21 -0
- package/styled-components/cjs/components/TextArea/variations/_hint-view/base.js +11 -0
- package/styled-components/cjs/components/TextArea/variations/_hint-view/tokens.json +5 -0
- package/styled-components/cjs/components/TextArea/variations/_view/base.js +2 -1
- package/styled-components/cjs/components/TextField/TextField.js +98 -11
- package/styled-components/cjs/components/TextField/TextField.styles.js +46 -21
- package/styled-components/cjs/components/TextField/TextField.template-doc.mdx +6 -1
- package/styled-components/cjs/components/TextField/TextField.tokens.js +40 -1
- package/styled-components/cjs/components/TextField/variations/_clear/base.js +1 -1
- package/styled-components/cjs/components/TextField/variations/_hint-size/base.js +11 -0
- package/styled-components/cjs/components/TextField/variations/_hint-size/tokens.json +21 -0
- package/styled-components/cjs/components/TextField/variations/_hint-view/base.js +11 -0
- package/styled-components/cjs/components/TextField/variations/_hint-view/tokens.json +5 -0
- package/styled-components/cjs/components/TextField/variations/_label-placement/base.js +1 -1
- package/styled-components/cjs/components/TextField/variations/_read-only/base.js +1 -1
- package/styled-components/cjs/components/TextField/variations/_size/base.js +1 -1
- package/styled-components/cjs/components/TextField/variations/_view/base.js +1 -1
- package/styled-components/cjs/components/_Icon/Icon.assets/InfoCircleOutline.js +22 -0
- package/styled-components/cjs/components/_Icon/Icons/IconInfoCircleOutline.js +22 -0
- package/styled-components/cjs/components/_Icon/index.js +8 -1
- package/styled-components/cjs/examples/plasma_b2c/components/TextArea/TextArea.config.js +18 -9
- package/styled-components/cjs/examples/plasma_b2c/components/TextArea/TextArea.stories.tsx +72 -0
- package/styled-components/cjs/examples/plasma_b2c/components/TextField/TextField.config.js +18 -9
- package/styled-components/cjs/examples/plasma_b2c/components/TextField/TextField.stories.tsx +73 -1
- package/styled-components/cjs/examples/plasma_web/components/TextArea/TextArea.config.js +18 -9
- package/styled-components/cjs/examples/plasma_web/components/TextArea/TextArea.stories.tsx +72 -0
- package/styled-components/cjs/examples/plasma_web/components/TextField/TextField.config.js +18 -9
- package/styled-components/cjs/examples/plasma_web/components/TextField/TextField.stories.tsx +82 -10
- package/styled-components/es/components/Autocomplete/Autocomplete.js +4 -2
- package/styled-components/es/components/DatePicker/RangeDate/RangeDate.js +79 -17
- package/styled-components/es/components/DatePicker/RangeDate/RangeDatePopover/RangeDatePopover.js +14 -7
- package/styled-components/es/components/DatePicker/RangeDate/variations/_size/base.js +1 -1
- package/styled-components/es/components/DatePicker/SingleDate/SingleDate.js +34 -9
- package/styled-components/es/components/DatePicker/hooks/useDatePicker.js +21 -49
- package/styled-components/es/components/DatePicker/hooks/useKeyboardNavigation.js +11 -1
- package/styled-components/es/components/DatePicker/utils/dateHelper.js +30 -0
- package/styled-components/es/components/TextArea/TextArea.js +112 -23
- package/styled-components/es/components/TextArea/TextArea.styles.js +84 -41
- package/styled-components/es/components/TextArea/TextArea.template-doc.mdx +6 -1
- package/styled-components/es/components/TextArea/TextArea.tokens.js +43 -4
- package/styled-components/es/components/TextArea/hooks/useAutoResize.js +2 -4
- package/styled-components/es/components/TextArea/variations/_clear/base.js +2 -2
- package/styled-components/es/components/TextArea/variations/_hint-size/base.js +5 -0
- package/styled-components/es/components/TextArea/variations/_hint-size/tokens.json +21 -0
- package/styled-components/es/components/TextArea/variations/_hint-view/base.js +5 -0
- package/styled-components/es/components/TextArea/variations/_hint-view/tokens.json +5 -0
- package/styled-components/es/components/TextArea/variations/_view/base.js +2 -1
- package/styled-components/es/components/TextField/TextField.js +98 -11
- package/styled-components/es/components/TextField/TextField.styles.js +45 -20
- package/styled-components/es/components/TextField/TextField.template-doc.mdx +6 -1
- package/styled-components/es/components/TextField/TextField.tokens.js +40 -1
- package/styled-components/es/components/TextField/variations/_clear/base.js +2 -2
- package/styled-components/es/components/TextField/variations/_hint-size/base.js +5 -0
- package/styled-components/es/components/TextField/variations/_hint-size/tokens.json +21 -0
- package/styled-components/es/components/TextField/variations/_hint-view/base.js +5 -0
- package/styled-components/es/components/TextField/variations/_hint-view/tokens.json +5 -0
- package/styled-components/es/components/TextField/variations/_label-placement/base.js +1 -1
- package/styled-components/es/components/TextField/variations/_read-only/base.js +2 -2
- package/styled-components/es/components/TextField/variations/_size/base.js +2 -2
- package/styled-components/es/components/TextField/variations/_view/base.js +2 -2
- package/styled-components/es/components/_Icon/Icon.assets/InfoCircleOutline.js +15 -0
- package/styled-components/es/components/_Icon/Icons/IconInfoCircleOutline.js +15 -0
- package/styled-components/es/components/_Icon/index.js +2 -1
- package/styled-components/es/examples/plasma_b2c/components/TextArea/TextArea.config.js +18 -9
- package/styled-components/es/examples/plasma_b2c/components/TextArea/TextArea.stories.tsx +72 -0
- package/styled-components/es/examples/plasma_b2c/components/TextField/TextField.config.js +18 -9
- package/styled-components/es/examples/plasma_b2c/components/TextField/TextField.stories.tsx +73 -1
- package/styled-components/es/examples/plasma_web/components/TextArea/TextArea.config.js +18 -9
- package/styled-components/es/examples/plasma_web/components/TextArea/TextArea.stories.tsx +72 -0
- package/styled-components/es/examples/plasma_web/components/TextField/TextField.config.js +18 -9
- package/styled-components/es/examples/plasma_web/components/TextField/TextField.stories.tsx +82 -10
- package/types/components/Autocomplete/Autocomplete.d.ts.map +1 -1
- package/types/components/Autocomplete/ui/TextField/TextField.styles.d.ts +408 -0
- package/types/components/Autocomplete/ui/TextField/TextField.styles.d.ts.map +1 -1
- package/types/components/Combobox/ComboboxNew/ui/Target/Target.styles.d.ts +408 -0
- package/types/components/Combobox/ComboboxNew/ui/Target/Target.styles.d.ts.map +1 -1
- package/types/components/DatePicker/DatePickerBase.types.d.ts +8 -6
- package/types/components/DatePicker/DatePickerBase.types.d.ts.map +1 -1
- package/types/components/DatePicker/RangeDate/RangeDate.d.ts +10 -10
- package/types/components/DatePicker/RangeDate/RangeDate.d.ts.map +1 -1
- package/types/components/DatePicker/RangeDate/RangeDate.types.d.ts +16 -6
- package/types/components/DatePicker/RangeDate/RangeDate.types.d.ts.map +1 -1
- package/types/components/DatePicker/RangeDate/RangeDatePopover/RangeDatePopover.d.ts +1 -1
- package/types/components/DatePicker/RangeDate/RangeDatePopover/RangeDatePopover.d.ts.map +1 -1
- package/types/components/DatePicker/RangeDate/RangeDatePopover/RangeDatePopover.types.d.ts +2 -1
- package/types/components/DatePicker/RangeDate/RangeDatePopover/RangeDatePopover.types.d.ts.map +1 -1
- package/types/components/DatePicker/RangeDate/variations/_size/base.d.ts.map +1 -1
- package/types/components/DatePicker/SingleDate/SingleDate.d.ts +2 -2
- package/types/components/DatePicker/SingleDate/SingleDate.d.ts.map +1 -1
- package/types/components/DatePicker/SingleDate/SingleDate.styles.d.ts +408 -0
- package/types/components/DatePicker/SingleDate/SingleDate.styles.d.ts.map +1 -1
- package/types/components/DatePicker/SingleDate/SingleDate.types.d.ts +14 -4
- package/types/components/DatePicker/SingleDate/SingleDate.types.d.ts.map +1 -1
- package/types/components/DatePicker/hooks/useDatePicker.d.ts +2 -3
- package/types/components/DatePicker/hooks/useDatePicker.d.ts.map +1 -1
- package/types/components/DatePicker/hooks/useKeyboardNavigation.d.ts +3 -1
- package/types/components/DatePicker/hooks/useKeyboardNavigation.d.ts.map +1 -1
- package/types/components/DatePicker/utils/dateHelper.d.ts +10 -0
- package/types/components/DatePicker/utils/dateHelper.d.ts.map +1 -1
- package/types/components/Popover/Popover.types.d.ts +1 -1
- package/types/components/Range/Range.styles.d.ts +408 -0
- package/types/components/Range/Range.styles.d.ts.map +1 -1
- package/types/components/Slider/components/Double/Double.styles.d.ts +408 -0
- package/types/components/Slider/components/Double/Double.styles.d.ts.map +1 -1
- package/types/components/TextArea/TextArea.d.ts +9 -3
- package/types/components/TextArea/TextArea.d.ts.map +1 -1
- package/types/components/TextArea/TextArea.styles.d.ts +11 -1
- package/types/components/TextArea/TextArea.styles.d.ts.map +1 -1
- package/types/components/TextArea/TextArea.tokens.d.ts +39 -0
- package/types/components/TextArea/TextArea.tokens.d.ts.map +1 -1
- package/types/components/TextArea/TextArea.types.d.ts +78 -3
- package/types/components/TextArea/TextArea.types.d.ts.map +1 -1
- package/types/components/TextArea/hooks/useAutoResize.d.ts.map +1 -1
- package/types/components/TextArea/variations/_clear/base.d.ts.map +1 -1
- package/types/components/TextArea/variations/_hint-size/base.d.ts +2 -0
- package/types/components/TextArea/variations/_hint-size/base.d.ts.map +1 -0
- package/types/components/TextArea/variations/_hint-view/base.d.ts +2 -0
- package/types/components/TextArea/variations/_hint-view/base.d.ts.map +1 -0
- package/types/components/TextArea/variations/_view/base.d.ts.map +1 -1
- package/types/components/TextField/TextField.d.ts +9 -3
- package/types/components/TextField/TextField.d.ts.map +1 -1
- package/types/components/TextField/TextField.styles.d.ts +8 -0
- package/types/components/TextField/TextField.styles.d.ts.map +1 -1
- package/types/components/TextField/TextField.tokens.d.ts +39 -0
- package/types/components/TextField/TextField.tokens.d.ts.map +1 -1
- package/types/components/TextField/TextField.types.d.ts +73 -2
- package/types/components/TextField/TextField.types.d.ts.map +1 -1
- package/types/components/TextField/variations/_clear/base.d.ts.map +1 -1
- package/types/components/TextField/variations/_hint-size/base.d.ts +2 -0
- package/types/components/TextField/variations/_hint-size/base.d.ts.map +1 -0
- package/types/components/TextField/variations/_hint-view/base.d.ts +2 -0
- package/types/components/TextField/variations/_hint-view/base.d.ts.map +1 -0
- package/types/components/TextField/variations/_label-placement/base.d.ts.map +1 -1
- package/types/components/TextField/variations/_read-only/base.d.ts.map +1 -1
- package/types/components/TextField/variations/_size/base.d.ts.map +1 -1
- package/types/components/TextField/variations/_view/base.d.ts.map +1 -1
- package/types/components/_Icon/Icon.assets/InfoCircleOutline.d.ts +4 -0
- package/types/components/_Icon/Icon.assets/InfoCircleOutline.d.ts.map +1 -0
- package/types/components/_Icon/Icons/IconInfoCircleOutline.d.ts +4 -0
- package/types/components/_Icon/Icons/IconInfoCircleOutline.d.ts.map +1 -0
- package/types/components/_Icon/index.d.ts +1 -0
- package/types/components/_Icon/index.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/DatePicker/DatePicker.d.ts +6 -6
- package/types/examples/plasma_b2c/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Mask/Mask.d.ts +772 -12
- package/types/examples/plasma_b2c/components/Mask/Mask.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/TextArea/TextArea.config.d.ts +9 -0
- package/types/examples/plasma_b2c/components/TextArea/TextArea.config.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/TextArea/TextArea.d.ts +457 -0
- package/types/examples/plasma_b2c/components/TextArea/TextArea.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/TextField/TextField.config.d.ts +9 -0
- package/types/examples/plasma_b2c/components/TextField/TextField.config.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/TextField/TextField.d.ts +417 -0
- package/types/examples/plasma_b2c/components/TextField/TextField.d.ts.map +1 -1
- package/types/examples/plasma_web/components/DatePicker/DatePicker.d.ts +6 -6
- package/types/examples/plasma_web/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Mask/Mask.d.ts +772 -12
- package/types/examples/plasma_web/components/Mask/Mask.d.ts.map +1 -1
- package/types/examples/plasma_web/components/TextArea/TextArea.config.d.ts +9 -0
- package/types/examples/plasma_web/components/TextArea/TextArea.config.d.ts.map +1 -1
- package/types/examples/plasma_web/components/TextArea/TextArea.d.ts +457 -0
- package/types/examples/plasma_web/components/TextArea/TextArea.d.ts.map +1 -1
- package/types/examples/plasma_web/components/TextField/TextField.config.d.ts +9 -0
- package/types/examples/plasma_web/components/TextField/TextField.config.d.ts.map +1 -1
- package/types/examples/plasma_web/components/TextField/TextField.d.ts +417 -0
- package/types/examples/plasma_web/components/TextField/TextField.d.ts.map +1 -1
- package/cjs/components/DatePicker/RangeDate/variations/_size/base_1911nyw.css +0 -1
- package/cjs/components/TextArea/TextArea.styles_es0miz.css +0 -11
- package/cjs/components/TextArea/variations/_clear/base_vidplj.css +0 -1
- package/cjs/components/TextArea/variations/_view/base_td55th.css +0 -1
- package/cjs/components/TextField/TextField.styles_1d2ryq.css +0 -15
- package/cjs/components/TextField/variations/_clear/base_rit6gc.css +0 -1
- package/cjs/components/TextField/variations/_label-placement/base_1ghihns.css +0 -1
- package/cjs/components/TextField/variations/_read-only/base_1n7tghz.css +0 -1
- package/cjs/components/TextField/variations/_size/base_1h8l0kj.css +0 -1
- package/cjs/components/TextField/variations/_view/base_1noe46b.css +0 -1
- package/cjs/components/TextFieldGroup/variations/_shape/base_1e0je21.css +0 -1
- package/es/components/DatePicker/RangeDate/variations/_size/base_1911nyw.css +0 -1
- package/es/components/TextArea/TextArea.styles_es0miz.css +0 -11
- package/es/components/TextArea/variations/_clear/base_vidplj.css +0 -1
- package/es/components/TextArea/variations/_view/base_td55th.css +0 -1
- package/es/components/TextField/TextField.styles_1d2ryq.css +0 -15
- package/es/components/TextField/variations/_clear/base_rit6gc.css +0 -1
- package/es/components/TextField/variations/_label-placement/base_1ghihns.css +0 -1
- package/es/components/TextField/variations/_read-only/base_1n7tghz.css +0 -1
- package/es/components/TextField/variations/_size/base_1h8l0kj.css +0 -1
- package/es/components/TextField/variations/_view/base_1noe46b.css +0 -1
- package/es/components/TextFieldGroup/variations/_shape/base_1e0je21.css +0 -1
@@ -1,4 +1,4 @@
|
|
1
|
-
var _excluded = ["className", "isDoubleCalendar", "opened", "label", "leftHelper", "contentLeft", "contentRight", "view", "size", "readOnly", "disabled", "name", "dividerVariant", "dividerIcon", "defaultFirstDate", "defaultSecondDate", "firstValueError", "secondValueError", "firstValueSuccess", "secondValueSuccess", "firstPlaceholder", "secondPlaceholder", "firstTextfieldContentLeft", "firstTextfieldContentRight", "secondTextfieldContentLeft", "secondTextfieldContentRight", "firstTextfieldTextBefore", "secondTextfieldTextBefore", "firstTextfieldTextAfter", "secondTextfieldTextAfter", "format", "lang", "maskWithFormat", "min", "max", "includeEdgeDates", "eventList", "disabledList", "eventMonthList", "disabledMonthList", "eventQuarterList", "disabledQuarterList", "eventYearList", "disabledYearList", "type", "placement", "closeOnOverlayClick", "closeOnEsc", "offset", "onToggle", "onChange", "onChangeFirstValue", "onChangeSecondValue", "onCommitFirstDate", "onCommitSecondDate", "onFocusFirstTextfield", "onFocusSecondTextfield", "onBlurFirstTextfield", "onBlurSecondTextfield"];
|
1
|
+
var _excluded = ["className", "isDoubleCalendar", "opened", "label", "leftHelper", "contentLeft", "contentRight", "view", "size", "readOnly", "disabled", "name", "dividerVariant", "dividerIcon", "defaultFirstDate", "defaultSecondDate", "firstValueError", "secondValueError", "firstValueSuccess", "secondValueSuccess", "firstPlaceholder", "secondPlaceholder", "firstTextfieldContentLeft", "firstTextfieldContentRight", "secondTextfieldContentLeft", "secondTextfieldContentRight", "firstTextfieldTextBefore", "secondTextfieldTextBefore", "firstTextfieldTextAfter", "secondTextfieldTextAfter", "format", "lang", "maskWithFormat", "min", "max", "includeEdgeDates", "eventList", "disabledList", "eventMonthList", "disabledMonthList", "eventQuarterList", "disabledQuarterList", "eventYearList", "disabledYearList", "type", "frame", "usePortal", "placement", "closeOnOverlayClick", "closeOnEsc", "offset", "onToggle", "onChange", "onChangeFirstValue", "onChangeSecondValue", "onCommitFirstDate", "onCommitSecondDate", "onFocusFirstTextfield", "onFocusSecondTextfield", "onBlurFirstTextfield", "onBlurSecondTextfield"];
|
2
2
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
3
3
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
4
4
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
@@ -10,11 +10,12 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
10
10
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
11
11
|
import React, { createRef, forwardRef, useCallback, useEffect, useRef, useState } from 'react';
|
12
12
|
import { cx, noop } from '../../../utils';
|
13
|
-
import { formatCalendarValue, formatInputValue, getDateFormatDelimiter } from '../utils/dateHelper';
|
13
|
+
import { formatCalendarValue, formatInputValue, getDateFormatDelimiter, getDateFromFormat } from '../utils/dateHelper';
|
14
14
|
import { useDatePicker } from '../hooks/useDatePicker';
|
15
15
|
import { classes } from '../DatePicker.tokens';
|
16
|
-
import { useKeyNavigation } from '../hooks/useKeyboardNavigation';
|
16
|
+
import { keys, useKeyNavigation } from '../hooks/useKeyboardNavigation';
|
17
17
|
import { InputHidden } from '../DatePickerBase.styles';
|
18
|
+
import { getSortedValues } from '../../Calendar/utils';
|
18
19
|
import { base as sizeCSS } from './variations/_size/base';
|
19
20
|
import { base as viewCSS } from './variations/_view/base';
|
20
21
|
import { base as disabledCSS } from './variations/_disabled/base';
|
@@ -80,6 +81,10 @@ export var datePickerRangeRoot = function datePickerRangeRoot(Root) {
|
|
80
81
|
disabledYearList = _ref.disabledYearList,
|
81
82
|
_ref$type = _ref.type,
|
82
83
|
type = _ref$type === void 0 ? 'Days' : _ref$type,
|
84
|
+
_ref$frame = _ref.frame,
|
85
|
+
frame = _ref$frame === void 0 ? 'document' : _ref$frame,
|
86
|
+
_ref$usePortal = _ref.usePortal,
|
87
|
+
usePortal = _ref$usePortal === void 0 ? false : _ref$usePortal,
|
83
88
|
_ref$placement = _ref.placement,
|
84
89
|
placement = _ref$placement === void 0 ? ['top', 'bottom'] : _ref$placement,
|
85
90
|
_ref$closeOnOverlayCl = _ref.closeOnOverlayClick,
|
@@ -95,8 +100,8 @@ export var datePickerRangeRoot = function datePickerRangeRoot(Root) {
|
|
95
100
|
onCommitSecondDate = _ref.onCommitSecondDate,
|
96
101
|
onFocusFirstTextfield = _ref.onFocusFirstTextfield,
|
97
102
|
onFocusSecondTextfield = _ref.onFocusSecondTextfield,
|
98
|
-
|
99
|
-
|
103
|
+
_onBlurFirstTextfield = _ref.onBlurFirstTextfield,
|
104
|
+
_onBlurSecondTextfield = _ref.onBlurSecondTextfield,
|
100
105
|
rest = _objectWithoutProperties(_ref, _excluded);
|
101
106
|
var rangeRef = ref && 'current' in ref ? ref : /*#__PURE__*/createRef();
|
102
107
|
var rootRef = useRef(null);
|
@@ -167,7 +172,6 @@ export var datePickerRangeRoot = function datePickerRangeRoot(Root) {
|
|
167
172
|
currentValue: inputFirstValue,
|
168
173
|
setInputValue: setFirstInputValue,
|
169
174
|
setCalendarValue: setCalendarFirstValue,
|
170
|
-
setIsInnerOpen: setIsInnerOpen,
|
171
175
|
dateFormatDelimiter: dateFormatDelimiter,
|
172
176
|
format: format,
|
173
177
|
lang: lang,
|
@@ -176,7 +180,6 @@ export var datePickerRangeRoot = function datePickerRangeRoot(Root) {
|
|
176
180
|
maskWithFormat: maskWithFormat,
|
177
181
|
valueError: firstValueError,
|
178
182
|
valueSuccess: firstValueSuccess,
|
179
|
-
inputRef: firstInputRef,
|
180
183
|
name: name,
|
181
184
|
onChangeValue: onChangeFirstValue,
|
182
185
|
onCommitDate: onCommitFirstDate
|
@@ -187,7 +190,6 @@ export var datePickerRangeRoot = function datePickerRangeRoot(Root) {
|
|
187
190
|
currentValue: inputSecondValue,
|
188
191
|
setInputValue: setSecondInputValue,
|
189
192
|
setCalendarValue: setCalendarSecondValue,
|
190
|
-
setIsInnerOpen: setIsInnerOpen,
|
191
193
|
dateFormatDelimiter: dateFormatDelimiter,
|
192
194
|
format: format,
|
193
195
|
lang: lang,
|
@@ -196,7 +198,6 @@ export var datePickerRangeRoot = function datePickerRangeRoot(Root) {
|
|
196
198
|
maskWithFormat: maskWithFormat,
|
197
199
|
valueError: secondValueError,
|
198
200
|
valueSuccess: secondValueSuccess,
|
199
|
-
inputRef: secondInputRef,
|
200
201
|
onChangeValue: onChangeSecondValue,
|
201
202
|
onCommitDate: onCommitSecondDate
|
202
203
|
}),
|
@@ -207,15 +208,59 @@ export var datePickerRangeRoot = function datePickerRangeRoot(Root) {
|
|
207
208
|
if (disabled || readOnly) {
|
208
209
|
return;
|
209
210
|
}
|
210
|
-
var isCalendarOpen = firstInputRef !== null && firstInputRef !== void 0 && (_firstInputRef$curren = firstInputRef.current) !== null && _firstInputRef$curren !== void 0 && _firstInputRef$curren.contains(event.target || null) || secondInputRef !== null && secondInputRef !== void 0 && (_secondInputRef$curre = secondInputRef.current) !== null && _secondInputRef$curre !== void 0 && _secondInputRef$curre.contains(event.target || null) ? true : opened;
|
211
|
+
var isCalendarOpen = (firstInputRef !== null && firstInputRef !== void 0 && (_firstInputRef$curren = firstInputRef.current) !== null && _firstInputRef$curren !== void 0 && _firstInputRef$curren.contains(event.target || null) || secondInputRef !== null && secondInputRef !== void 0 && (_secondInputRef$curre = secondInputRef.current) !== null && _secondInputRef$curre !== void 0 && _secondInputRef$curre.contains(event.target || null)) && event.code !== keys.Escape ? true : opened;
|
212
|
+
if (!isCalendarOpen) {
|
213
|
+
if (calendarFirstValue && !calendarSecondValue) {
|
214
|
+
var _secondInputRef$curre2;
|
215
|
+
secondInputRef === null || secondInputRef === void 0 || (_secondInputRef$curre2 = secondInputRef.current) === null || _secondInputRef$curre2 === void 0 || _secondInputRef$curre2.focus();
|
216
|
+
}
|
217
|
+
if (calendarSecondValue || !calendarFirstValue) {
|
218
|
+
var _firstInputRef$curren2;
|
219
|
+
firstInputRef === null || firstInputRef === void 0 || (_firstInputRef$curren2 = firstInputRef.current) === null || _firstInputRef$curren2 === void 0 || _firstInputRef$curren2.focus();
|
220
|
+
}
|
221
|
+
}
|
211
222
|
if (onToggle) {
|
212
223
|
return onToggle(isCalendarOpen, event);
|
213
224
|
}
|
214
225
|
setIsInnerOpen(isCalendarOpen);
|
215
226
|
};
|
227
|
+
var handleBlur = function handleBlur(event, outerHandler) {
|
228
|
+
if (!inputFirstValue || !inputSecondValue) {
|
229
|
+
outerHandler === null || outerHandler === void 0 || outerHandler(event);
|
230
|
+
return;
|
231
|
+
}
|
232
|
+
var _getDateFromFormat = getDateFromFormat(inputFirstValue, format, lang),
|
233
|
+
firstDate = _getDateFromFormat.value,
|
234
|
+
firstIsSuccess = _getDateFromFormat.isSuccess;
|
235
|
+
var _getDateFromFormat2 = getDateFromFormat(inputSecondValue, format, lang),
|
236
|
+
secondDate = _getDateFromFormat2.value,
|
237
|
+
secondIsSuccess = _getDateFromFormat2.isSuccess;
|
238
|
+
if (!firstIsSuccess || !secondIsSuccess) {
|
239
|
+
outerHandler === null || outerHandler === void 0 || outerHandler(event);
|
240
|
+
return;
|
241
|
+
}
|
242
|
+
var _getSortedValues = getSortedValues([new Date(firstDate), new Date(secondDate)]),
|
243
|
+
_getSortedValues2 = _slicedToArray(_getSortedValues, 2),
|
244
|
+
startValue = _getSortedValues2[0],
|
245
|
+
endValue = _getSortedValues2[1];
|
246
|
+
setFirstInputValue(formatInputValue({
|
247
|
+
value: startValue,
|
248
|
+
format: format,
|
249
|
+
lang: lang
|
250
|
+
}));
|
251
|
+
setSecondInputValue(formatInputValue({
|
252
|
+
value: endValue,
|
253
|
+
format: format,
|
254
|
+
lang: lang
|
255
|
+
}));
|
256
|
+
setCalendarFirstValue(formatCalendarValue(startValue, format, lang));
|
257
|
+
setCalendarSecondValue(formatCalendarValue(endValue, format, lang));
|
258
|
+
outerHandler === null || outerHandler === void 0 || outerHandler(event);
|
259
|
+
};
|
216
260
|
var _useKeyNavigation = useKeyNavigation({
|
217
261
|
isCalendarOpen: isInnerOpen,
|
218
|
-
onToggle: handleToggle
|
262
|
+
onToggle: handleToggle,
|
263
|
+
closeOnEsc: closeOnEsc
|
219
264
|
}),
|
220
265
|
onKeyDown = _useKeyNavigation.onKeyDown;
|
221
266
|
var RangeComponent = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StyledRange, {
|
@@ -261,8 +306,12 @@ export var datePickerRangeRoot = function datePickerRangeRoot(Root) {
|
|
261
306
|
},
|
262
307
|
onFocusFirstTextfield: onFocusFirstTextfield,
|
263
308
|
onFocusSecondTextfield: onFocusSecondTextfield,
|
264
|
-
onBlurFirstTextfield: onBlurFirstTextfield
|
265
|
-
|
309
|
+
onBlurFirstTextfield: function onBlurFirstTextfield(event) {
|
310
|
+
return handleBlur(event, _onBlurFirstTextfield);
|
311
|
+
},
|
312
|
+
onBlurSecondTextfield: function onBlurSecondTextfield(event) {
|
313
|
+
return handleBlur(event, _onBlurSecondTextfield);
|
314
|
+
},
|
266
315
|
onKeyDown: onKeyDown
|
267
316
|
}));
|
268
317
|
useEffect(function () {
|
@@ -305,6 +354,16 @@ export var datePickerRangeRoot = function datePickerRangeRoot(Root) {
|
|
305
354
|
lang: lang
|
306
355
|
}));
|
307
356
|
}, [format, lang]);
|
357
|
+
var RootWrapper = useCallback(function (_ref2) {
|
358
|
+
var children = _ref2.children;
|
359
|
+
return /*#__PURE__*/React.createElement(Root, {
|
360
|
+
view: view,
|
361
|
+
size: size,
|
362
|
+
className: cx(classes.datePickerRoot, className),
|
363
|
+
disabled: disabled,
|
364
|
+
readOnly: !disabled && readOnly
|
365
|
+
}, children);
|
366
|
+
}, [view, size, disabled, readOnly]);
|
308
367
|
return /*#__PURE__*/React.createElement(Root, _extends({
|
309
368
|
ref: rootRef,
|
310
369
|
view: view,
|
@@ -327,6 +386,8 @@ export var datePickerRangeRoot = function datePickerRangeRoot(Root) {
|
|
327
386
|
disabledYearList: disabledYearList,
|
328
387
|
min: min,
|
329
388
|
max: max,
|
389
|
+
frame: frame,
|
390
|
+
usePortal: usePortal,
|
330
391
|
placement: placement,
|
331
392
|
closeOnOverlayClick: closeOnOverlayClick,
|
332
393
|
closeOnEsc: closeOnEsc,
|
@@ -335,14 +396,15 @@ export var datePickerRangeRoot = function datePickerRangeRoot(Root) {
|
|
335
396
|
onToggle: handleToggle,
|
336
397
|
lang: lang,
|
337
398
|
isDoubleCalendar: isDoubleCalendar,
|
399
|
+
rootWrapper: RootWrapper,
|
338
400
|
onChangeStartOfRange: function onChangeStartOfRange(firstDate, dateInfo) {
|
339
401
|
handleCommitFirstDate(firstDate, false, true, dateInfo);
|
340
402
|
handleCommitSecondDate('');
|
341
403
|
},
|
342
|
-
onChangeValue: function onChangeValue(
|
343
|
-
var
|
344
|
-
firstDate =
|
345
|
-
secondDate =
|
404
|
+
onChangeValue: function onChangeValue(_ref3, dateInfo) {
|
405
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
406
|
+
firstDate = _ref4[0],
|
407
|
+
secondDate = _ref4[1];
|
346
408
|
firstDate && handleCommitFirstDate(firstDate, false, true, dateInfo);
|
347
409
|
secondDate && handleCommitSecondDate(secondDate, false, true, dateInfo);
|
348
410
|
if (firstDate && secondDate && !firstValueError && !secondValueError) {
|
package/styled-components/es/components/DatePicker/RangeDate/RangeDatePopover/RangeDatePopover.js
CHANGED
@@ -3,7 +3,8 @@ import { getPlacements } from '../../../../utils';
|
|
3
3
|
import { StyledPopover } from '../RangeDate.styles';
|
4
4
|
import { StyledCalendar, StyledCalendarDouble } from './RangeDatePopover.styles';
|
5
5
|
export var RangeDatePopover = function RangeDatePopover(_ref) {
|
6
|
-
var
|
6
|
+
var Root = _ref.rootWrapper,
|
7
|
+
target = _ref.target,
|
7
8
|
isOpen = _ref.isOpen,
|
8
9
|
opened = _ref.opened,
|
9
10
|
isDoubleCalendar = _ref.isDoubleCalendar,
|
@@ -19,6 +20,10 @@ export var RangeDatePopover = function RangeDatePopover(_ref) {
|
|
19
20
|
disabledQuarterList = _ref.disabledQuarterList,
|
20
21
|
eventYearList = _ref.eventYearList,
|
21
22
|
disabledYearList = _ref.disabledYearList,
|
23
|
+
_ref$frame = _ref.frame,
|
24
|
+
frame = _ref$frame === void 0 ? 'document' : _ref$frame,
|
25
|
+
_ref$usePortal = _ref.usePortal,
|
26
|
+
usePortal = _ref$usePortal === void 0 ? false : _ref$usePortal,
|
22
27
|
_ref$placement = _ref.placement,
|
23
28
|
placement = _ref$placement === void 0 ? ['top', 'bottom'] : _ref$placement,
|
24
29
|
_ref$closeOnOverlayCl = _ref.closeOnOverlayClick,
|
@@ -36,7 +41,8 @@ export var RangeDatePopover = function RangeDatePopover(_ref) {
|
|
36
41
|
if (isDoubleCalendar) {
|
37
42
|
return /*#__PURE__*/React.createElement(StyledPopover, {
|
38
43
|
opened: innerIsOpen,
|
39
|
-
|
44
|
+
frame: frame,
|
45
|
+
usePortal: usePortal,
|
40
46
|
onToggle: onToggle,
|
41
47
|
offset: offset,
|
42
48
|
placement: getPlacements(placement),
|
@@ -45,7 +51,7 @@ export var RangeDatePopover = function RangeDatePopover(_ref) {
|
|
45
51
|
isFocusTrapped: false,
|
46
52
|
target: target,
|
47
53
|
preventOverflow: false
|
48
|
-
}, /*#__PURE__*/React.createElement(StyledCalendarDouble, {
|
54
|
+
}, /*#__PURE__*/React.createElement(Root, null, /*#__PURE__*/React.createElement(StyledCalendarDouble, {
|
49
55
|
size: size,
|
50
56
|
value: calendarValue,
|
51
57
|
eventList: eventList,
|
@@ -62,11 +68,12 @@ export var RangeDatePopover = function RangeDatePopover(_ref) {
|
|
62
68
|
includeEdgeDates: includeEdgeDates,
|
63
69
|
onChangeValue: onChangeValue,
|
64
70
|
onChangeStartOfRange: onChangeStartOfRange
|
65
|
-
}));
|
71
|
+
})));
|
66
72
|
}
|
67
73
|
return /*#__PURE__*/React.createElement(StyledPopover, {
|
68
74
|
opened: innerIsOpen,
|
69
|
-
|
75
|
+
frame: frame,
|
76
|
+
usePortal: usePortal,
|
70
77
|
onToggle: onToggle,
|
71
78
|
offset: offset,
|
72
79
|
placement: getPlacements(placement),
|
@@ -76,7 +83,7 @@ export var RangeDatePopover = function RangeDatePopover(_ref) {
|
|
76
83
|
target: target,
|
77
84
|
preventOverflow: false,
|
78
85
|
closeOnEsc: closeOnEsc
|
79
|
-
}, /*#__PURE__*/React.createElement(StyledCalendar, {
|
86
|
+
}, /*#__PURE__*/React.createElement(Root, null, /*#__PURE__*/React.createElement(StyledCalendar, {
|
80
87
|
size: size,
|
81
88
|
value: calendarValue,
|
82
89
|
eventList: eventList,
|
@@ -94,5 +101,5 @@ export var RangeDatePopover = function RangeDatePopover(_ref) {
|
|
94
101
|
includeEdgeDates: includeEdgeDates,
|
95
102
|
onChangeValue: onChangeValue,
|
96
103
|
onChangeStartOfRange: onChangeStartOfRange
|
97
|
-
}));
|
104
|
+
})));
|
98
105
|
};
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import { css } from 'styled-components';
|
2
2
|
import { tokens } from '../../../DatePicker.tokens';
|
3
3
|
import { StyledLabel, LeftHelper } from '../../RangeDate.styles';
|
4
|
-
export var base = /*#__PURE__*/css(["
|
4
|
+
export var base = /*#__PURE__*/css(["", "{margin:var(", ");font-family:var(", ");font-size:var(", ");font-style:var(", ");font-weight:var(", ");letter-spacing:var(", ");line-height:var(", ");}", "{margin:var(", ");font-family:var(", ");font-size:var(", ");font-style:var(", ");font-weight:var(", ");letter-spacing:var(", ");line-height:var(", ");}"], StyledLabel, tokens.labelOffset, tokens.labelFontFamily, tokens.labelFontSize, tokens.labelFontStyle, tokens.labelFontWeight, tokens.labelLetterSpacing, tokens.labelLineHeight, LeftHelper, tokens.leftHelperOffset, tokens.leftHelperFontFamily, tokens.leftHelperFontSize, tokens.leftHelperFontStyle, tokens.leftHelperFontWeight, tokens.leftHelperLetterSpacing, tokens.leftHelperLineHeight);
|
@@ -1,4 +1,4 @@
|
|
1
|
-
var _excluded = ["className", "opened", "label", "labelPlacement", "placeholder", "leftHelper", "contentLeft", "contentRight", "textBefore", "textAfter", "view", "size", "readOnly", "disabled", "name", "defaultDate", "valueError", "valueSuccess", "format", "lang", "maskWithFormat", "min", "max", "includeEdgeDates", "eventList", "disabledList", "eventMonthList", "disabledMonthList", "eventQuarterList", "disabledQuarterList", "eventYearList", "disabledYearList", "type", "placement", "closeOnOverlayClick", "offset", "onChangeValue", "onCommitDate", "onToggle", "onFocus", "onBlur", "onChange"];
|
1
|
+
var _excluded = ["className", "opened", "label", "labelPlacement", "placeholder", "leftHelper", "contentLeft", "contentRight", "textBefore", "textAfter", "view", "size", "readOnly", "disabled", "name", "defaultDate", "valueError", "valueSuccess", "format", "lang", "maskWithFormat", "min", "max", "includeEdgeDates", "eventList", "disabledList", "eventMonthList", "disabledMonthList", "eventQuarterList", "disabledQuarterList", "eventYearList", "disabledYearList", "type", "frame", "usePortal", "placement", "closeOnOverlayClick", "closeOnEsc", "offset", "onChangeValue", "onCommitDate", "onToggle", "onFocus", "onBlur", "onChange"];
|
2
2
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
3
3
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
4
4
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
@@ -14,7 +14,7 @@ import { formatCalendarValue, formatInputValue, getDateFormatDelimiter } from '.
|
|
14
14
|
import { useDatePicker } from '../hooks/useDatePicker';
|
15
15
|
import { classes } from '../DatePicker.tokens';
|
16
16
|
import { InputHidden, StyledCalendar } from '../DatePickerBase.styles';
|
17
|
-
import { useKeyNavigation } from '../hooks/useKeyboardNavigation';
|
17
|
+
import { keys, useKeyNavigation } from '../hooks/useKeyboardNavigation';
|
18
18
|
import { base as sizeCSS } from './variations/_size/base';
|
19
19
|
import { base as viewCSS } from './variations/_view/base';
|
20
20
|
import { base as disabledCSS } from './variations/_disabled/base';
|
@@ -64,10 +64,16 @@ export var datePickerRoot = function datePickerRoot(Root) {
|
|
64
64
|
disabledYearList = _ref.disabledYearList,
|
65
65
|
_ref$type = _ref.type,
|
66
66
|
type = _ref$type === void 0 ? 'Days' : _ref$type,
|
67
|
+
_ref$frame = _ref.frame,
|
68
|
+
frame = _ref$frame === void 0 ? 'document' : _ref$frame,
|
69
|
+
_ref$usePortal = _ref.usePortal,
|
70
|
+
usePortal = _ref$usePortal === void 0 ? false : _ref$usePortal,
|
67
71
|
_ref$placement = _ref.placement,
|
68
72
|
placement = _ref$placement === void 0 ? ['top', 'bottom'] : _ref$placement,
|
69
73
|
_ref$closeOnOverlayCl = _ref.closeOnOverlayClick,
|
70
74
|
closeOnOverlayClick = _ref$closeOnOverlayCl === void 0 ? true : _ref$closeOnOverlayCl,
|
75
|
+
_ref$closeOnEsc = _ref.closeOnEsc,
|
76
|
+
closeOnEsc = _ref$closeOnEsc === void 0 ? true : _ref$closeOnEsc,
|
71
77
|
offset = _ref.offset,
|
72
78
|
onChangeValue = _ref.onChangeValue,
|
73
79
|
onCommitDate = _ref.onCommitDate,
|
@@ -102,7 +108,6 @@ export var datePickerRoot = function datePickerRoot(Root) {
|
|
102
108
|
currentValue: inputValue,
|
103
109
|
setInputValue: setInputValue,
|
104
110
|
setCalendarValue: setCalendarValue,
|
105
|
-
setIsInnerOpen: setIsInnerOpen,
|
106
111
|
dateFormatDelimiter: dateFormatDelimiter,
|
107
112
|
format: format,
|
108
113
|
lang: lang,
|
@@ -111,21 +116,34 @@ export var datePickerRoot = function datePickerRoot(Root) {
|
|
111
116
|
maskWithFormat: maskWithFormat,
|
112
117
|
valueError: valueError,
|
113
118
|
valueSuccess: valueSuccess,
|
114
|
-
inputRef: inputRef,
|
115
119
|
name: name,
|
116
|
-
onToggle: onToggle,
|
117
120
|
onChangeValue: onChangeValue,
|
118
121
|
onCommitDate: onCommitDate,
|
119
122
|
onChange: onChange
|
120
123
|
}),
|
121
124
|
datePickerErrorClass = _useDatePicker.datePickerErrorClass,
|
122
125
|
datePickerSuccessClass = _useDatePicker.datePickerSuccessClass,
|
123
|
-
handleToggle = _useDatePicker.handleToggle,
|
124
126
|
handleChangeValue = _useDatePicker.handleChangeValue,
|
125
127
|
handleCommitDate = _useDatePicker.handleCommitDate;
|
128
|
+
var handleToggle = function handleToggle(opened, event) {
|
129
|
+
if (disabled || readOnly) {
|
130
|
+
return;
|
131
|
+
}
|
132
|
+
var isCalendarOpen = event.target === (inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) && event.code !== keys.Escape ? true : opened;
|
133
|
+
if (!isCalendarOpen && inputValue) {
|
134
|
+
var _inputRef$current;
|
135
|
+
inputRef === null || inputRef === void 0 || (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus();
|
136
|
+
}
|
137
|
+
if (onToggle) {
|
138
|
+
onToggle(isCalendarOpen, event);
|
139
|
+
return;
|
140
|
+
}
|
141
|
+
setIsInnerOpen(isCalendarOpen);
|
142
|
+
};
|
126
143
|
var _useKeyNavigation = useKeyNavigation({
|
127
144
|
isCalendarOpen: isInnerOpen,
|
128
|
-
onToggle: handleToggle
|
145
|
+
onToggle: handleToggle,
|
146
|
+
closeOnEsc: closeOnEsc
|
129
147
|
}),
|
130
148
|
onKeyDown = _useKeyNavigation.onKeyDown;
|
131
149
|
var DatePickerInput = /*#__PURE__*/React.createElement(StyledInput, _extends({
|
@@ -181,7 +199,8 @@ export var datePickerRoot = function datePickerRoot(Root) {
|
|
181
199
|
ref: ref
|
182
200
|
}, rest), !innerLabelPlacement && label && /*#__PURE__*/React.createElement(StyledLabel, null, label), /*#__PURE__*/React.createElement(StyledPopover, {
|
183
201
|
opened: isInnerOpen,
|
184
|
-
usePortal:
|
202
|
+
usePortal: usePortal,
|
203
|
+
frame: frame,
|
185
204
|
onToggle: handleToggle,
|
186
205
|
offset: offset,
|
187
206
|
placement: getPlacements(placement),
|
@@ -190,6 +209,12 @@ export var datePickerRoot = function datePickerRoot(Root) {
|
|
190
209
|
isFocusTrapped: false,
|
191
210
|
target: DatePickerInput,
|
192
211
|
preventOverflow: false
|
212
|
+
}, /*#__PURE__*/React.createElement(Root, {
|
213
|
+
view: view,
|
214
|
+
size: size,
|
215
|
+
className: cx(classes.datePickerRoot, className),
|
216
|
+
disabled: disabled,
|
217
|
+
readOnly: !disabled && readOnly
|
193
218
|
}, /*#__PURE__*/React.createElement(StyledCalendar, {
|
194
219
|
size: size,
|
195
220
|
value: calendarValue,
|
@@ -210,7 +235,7 @@ export var datePickerRoot = function datePickerRoot(Root) {
|
|
210
235
|
onChangeValue: function onChangeValue(date, dateInfo) {
|
211
236
|
return handleCommitDate(date, false, true, dateInfo);
|
212
237
|
}
|
213
|
-
})), leftHelper && /*#__PURE__*/React.createElement(LeftHelper, null, leftHelper), /*#__PURE__*/React.createElement(InputHidden, _extends({
|
238
|
+
}))), leftHelper && /*#__PURE__*/React.createElement(LeftHelper, null, leftHelper), /*#__PURE__*/React.createElement(InputHidden, _extends({
|
214
239
|
type: "hidden",
|
215
240
|
datatype: "datepicker-single",
|
216
241
|
name: name,
|
@@ -1,11 +1,9 @@
|
|
1
1
|
import { classes } from '../DatePicker.tokens';
|
2
|
-
import { formatCalendarValue, formatInputValue, getDateFromFormat, getMaskedDateOnInput } from '../utils/dateHelper';
|
3
|
-
import { customDayjs } from '../../../utils/datejs';
|
2
|
+
import { formatCalendarValue, formatInputValue, getDateFromFormat, getMaskedDateOnInput, validateDateWithFullMonth } from '../utils/dateHelper';
|
4
3
|
export var useDatePicker = function useDatePicker(_ref) {
|
5
4
|
var currentValue = _ref.currentValue,
|
6
5
|
setInputValue = _ref.setInputValue,
|
7
6
|
setCalendarValue = _ref.setCalendarValue,
|
8
|
-
setIsInnerOpen = _ref.setIsInnerOpen,
|
9
7
|
dateFormatDelimiter = _ref.dateFormatDelimiter,
|
10
8
|
format = _ref.format,
|
11
9
|
_ref$lang = _ref.lang,
|
@@ -15,24 +13,12 @@ export var useDatePicker = function useDatePicker(_ref) {
|
|
15
13
|
maskWithFormat = _ref.maskWithFormat,
|
16
14
|
valueError = _ref.valueError,
|
17
15
|
valueSuccess = _ref.valueSuccess,
|
18
|
-
inputRef = _ref.inputRef,
|
19
16
|
name = _ref.name,
|
20
|
-
onToggle = _ref.onToggle,
|
21
17
|
onChangeValue = _ref.onChangeValue,
|
22
18
|
onCommitDate = _ref.onCommitDate,
|
23
19
|
onChange = _ref.onChange;
|
24
20
|
var datePickerErrorClass = valueError ? classes.datePickerError : undefined;
|
25
21
|
var datePickerSuccessClass = valueSuccess ? classes.datePickerSuccess : undefined;
|
26
|
-
var handleToggle = function handleToggle(opened, event) {
|
27
|
-
if (disabled || readOnly) {
|
28
|
-
return;
|
29
|
-
}
|
30
|
-
var isCalendarOpen = event.target === (inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) ? true : opened;
|
31
|
-
if (onToggle) {
|
32
|
-
return onToggle(isCalendarOpen, event);
|
33
|
-
}
|
34
|
-
setIsInnerOpen(isCalendarOpen);
|
35
|
-
};
|
36
22
|
var handleChangeValue = function handleChangeValue(event) {
|
37
23
|
if (disabled || readOnly) {
|
38
24
|
return;
|
@@ -55,24 +41,14 @@ export var useDatePicker = function useDatePicker(_ref) {
|
|
55
41
|
});
|
56
42
|
return;
|
57
43
|
}
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
var isLengthEqual;
|
67
|
-
if (hasMonthFullName) {
|
68
|
-
customDayjs.locale(lang);
|
69
|
-
var firstIndexOfMonth = format.indexOf('M');
|
70
|
-
var lastIndexOfMonth = newValue.indexOf(dateFormatDelimiter(), firstIndexOfMonth);
|
71
|
-
var fullMonthName = !lastIndexOfMonth ? newValue.slice(firstIndexOfMonth) : newValue.slice(firstIndexOfMonth, lastIndexOfMonth);
|
72
|
-
var monthFormatting = format.replace(/[^M]/g, '');
|
73
|
-
isValidMonth = customDayjs("01 ".concat(fullMonthName, " 1970"), "DD ".concat(monthFormatting, " YYYY"), true).isValid();
|
74
|
-
isLengthEqual = format.length - monthFormatting.length === newValue.length - fullMonthName.length;
|
75
|
-
}
|
44
|
+
var _validateDateWithFull = validateDateWithFullMonth({
|
45
|
+
currentValue: newValue,
|
46
|
+
format: format,
|
47
|
+
lang: lang
|
48
|
+
}),
|
49
|
+
hasMonthFullName = _validateDateWithFull.hasMonthFullName,
|
50
|
+
isValidMonth = _validateDateWithFull.isValidMonth,
|
51
|
+
isLengthEqual = _validateDateWithFull.isLengthEqual;
|
76
52
|
if (!hasMonthFullName && (newValue === null || newValue === void 0 ? void 0 : newValue.length) === (format === null || format === void 0 ? void 0 : format.length) || isValidMonth && isLengthEqual) {
|
77
53
|
setCalendarValue(formatCalendarValue(newValue, format, lang));
|
78
54
|
}
|
@@ -102,20 +78,18 @@ export var useDatePicker = function useDatePicker(_ref) {
|
|
102
78
|
return onCommitDate === null || onCommitDate === void 0 ? void 0 : onCommitDate('', false, true);
|
103
79
|
}
|
104
80
|
if (isCalendarValue) {
|
105
|
-
|
106
|
-
setInputValue(formatInputValue({
|
81
|
+
var _formattedInputValue = formatInputValue({
|
107
82
|
value: date,
|
108
83
|
format: format,
|
109
84
|
lang: lang
|
110
|
-
})
|
85
|
+
});
|
86
|
+
setCalendarValue(formatCalendarValue(date, format, lang));
|
87
|
+
setInputValue(_formattedInputValue);
|
111
88
|
onCommitDate === null || onCommitDate === void 0 || onCommitDate(date, false, true, dateInfo);
|
89
|
+
onChangeValue === null || onChangeValue === void 0 || onChangeValue(null, _formattedInputValue);
|
112
90
|
onChange === null || onChange === void 0 || onChange({
|
113
91
|
target: {
|
114
|
-
value:
|
115
|
-
value: date,
|
116
|
-
format: format,
|
117
|
-
lang: lang
|
118
|
-
}),
|
92
|
+
value: _formattedInputValue,
|
119
93
|
name: name
|
120
94
|
}
|
121
95
|
});
|
@@ -126,19 +100,18 @@ export var useDatePicker = function useDatePicker(_ref) {
|
|
126
100
|
newDate = _getDateFromFormat.value,
|
127
101
|
isError = _getDateFromFormat.isError,
|
128
102
|
isSuccess = _getDateFromFormat.isSuccess;
|
129
|
-
|
130
|
-
setInputValue(formatInputValue({
|
103
|
+
var formattedInputValue = formatInputValue({
|
131
104
|
value: newDate,
|
132
105
|
format: format,
|
133
106
|
lang: lang
|
134
|
-
})
|
107
|
+
});
|
108
|
+
setCalendarValue(formatCalendarValue(newDate, format, lang));
|
109
|
+
setInputValue(formattedInputValue);
|
135
110
|
onCommitDate === null || onCommitDate === void 0 || onCommitDate(newDate, isError, isSuccess);
|
111
|
+
onChangeValue === null || onChangeValue === void 0 || onChangeValue(null, formattedInputValue);
|
136
112
|
onChange === null || onChange === void 0 || onChange({
|
137
113
|
target: {
|
138
|
-
value:
|
139
|
-
value: date,
|
140
|
-
format: format
|
141
|
-
}),
|
114
|
+
value: formattedInputValue,
|
142
115
|
name: name
|
143
116
|
}
|
144
117
|
});
|
@@ -146,7 +119,6 @@ export var useDatePicker = function useDatePicker(_ref) {
|
|
146
119
|
return {
|
147
120
|
datePickerErrorClass: datePickerErrorClass,
|
148
121
|
datePickerSuccessClass: datePickerSuccessClass,
|
149
|
-
handleToggle: handleToggle,
|
150
122
|
handleChangeValue: handleChangeValue,
|
151
123
|
handleCommitDate: handleCommitDate
|
152
124
|
};
|
@@ -1,8 +1,10 @@
|
|
1
1
|
export var keys = {
|
2
|
-
Space: 'Space'
|
2
|
+
Space: 'Space',
|
3
|
+
Escape: 'Escape'
|
3
4
|
};
|
4
5
|
export var useKeyNavigation = function useKeyNavigation(_ref) {
|
5
6
|
var isCalendarOpen = _ref.isCalendarOpen,
|
7
|
+
closeOnEsc = _ref.closeOnEsc,
|
6
8
|
onToggle = _ref.onToggle;
|
7
9
|
var onKeyDown = function onKeyDown(event) {
|
8
10
|
switch (event.code) {
|
@@ -14,6 +16,14 @@ export var useKeyNavigation = function useKeyNavigation(_ref) {
|
|
14
16
|
}
|
15
17
|
break;
|
16
18
|
}
|
19
|
+
case keys.Escape:
|
20
|
+
{
|
21
|
+
if (isCalendarOpen && closeOnEsc) {
|
22
|
+
event.preventDefault();
|
23
|
+
onToggle(false, event);
|
24
|
+
}
|
25
|
+
break;
|
26
|
+
}
|
17
27
|
default:
|
18
28
|
{
|
19
29
|
break;
|
@@ -78,4 +78,34 @@ export var getMaskedDateOnInput = function getMaskedDateOnInput(value, format, d
|
|
78
78
|
return value + delimiter;
|
79
79
|
}
|
80
80
|
return value;
|
81
|
+
};
|
82
|
+
export var validateDateWithFullMonth = function validateDateWithFullMonth(_ref2) {
|
83
|
+
var currentValue = _ref2.currentValue,
|
84
|
+
format = _ref2.format,
|
85
|
+
lang = _ref2.lang;
|
86
|
+
/**
|
87
|
+
* NOTE: если в формате даты есть месяц в полном названии или сокращенном,
|
88
|
+
* нужно дополнительно проводить валидацию на полноту введенной даты.
|
89
|
+
* Иначе dayjs циклически будет пытаться отформатировать некорректную дату.
|
90
|
+
*/
|
91
|
+
var hasMonthFullName = /M{3,4}/g.test(format);
|
92
|
+
if (!hasMonthFullName) {
|
93
|
+
return {
|
94
|
+
hasMonthFullName: hasMonthFullName,
|
95
|
+
isValidMonth: false,
|
96
|
+
isLengthEqual: false
|
97
|
+
};
|
98
|
+
}
|
99
|
+
customDayjs.locale(lang);
|
100
|
+
var firstIndexOfMonth = format.indexOf('M');
|
101
|
+
var lastIndexOfMonth = currentValue.indexOf(getDateFormatDelimiter(format), firstIndexOfMonth);
|
102
|
+
var fullMonthName = !lastIndexOfMonth ? currentValue.slice(firstIndexOfMonth) : currentValue.slice(firstIndexOfMonth, lastIndexOfMonth);
|
103
|
+
var monthFormatting = format.replace(/[^M]/g, '');
|
104
|
+
var isValidMonth = customDayjs("01 ".concat(fullMonthName, " 1970"), "DD ".concat(monthFormatting, " YYYY"), true).isValid();
|
105
|
+
var isLengthEqual = format.length - monthFormatting.length === currentValue.length - fullMonthName.length;
|
106
|
+
return {
|
107
|
+
hasMonthFullName: hasMonthFullName,
|
108
|
+
isValidMonth: isValidMonth,
|
109
|
+
isLengthEqual: isLengthEqual
|
110
|
+
};
|
81
111
|
};
|