@skbkontur/react-ui 0.0.0-66a28a30fb → 0.0.0-68e286f9fe
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +98 -0
- package/README.md +1 -1
- package/cjs/components/Autocomplete/Autocomplete.d.ts +0 -22
- package/cjs/components/Autocomplete/Autocomplete.js +2 -40
- package/cjs/components/Autocomplete/Autocomplete.js.map +1 -1
- package/cjs/components/Button/Button.styles.js +2 -1
- package/cjs/components/Button/Button.styles.js.map +1 -1
- package/cjs/components/Calendar/CalendarDay.js +18 -2
- package/cjs/components/Calendar/CalendarDay.js.map +1 -1
- package/cjs/components/Calendar/DayCellView.js +7 -15
- package/cjs/components/Calendar/DayCellView.js.map +1 -1
- package/cjs/components/Checkbox/Checkbox.d.ts +0 -12
- package/cjs/components/Checkbox/Checkbox.js +1 -14
- package/cjs/components/Checkbox/Checkbox.js.map +1 -1
- package/cjs/components/ComboBox/ComboBox.d.ts +7 -1
- package/cjs/components/ComboBox/ComboBox.js +8 -1
- package/cjs/components/ComboBox/ComboBox.js.map +1 -1
- package/cjs/components/ComboBox/ComboBox.md +2 -2
- package/cjs/components/CurrencyInput/CurrencyInput.d.ts +1 -24
- package/cjs/components/CurrencyInput/CurrencyInput.js +2 -29
- package/cjs/components/CurrencyInput/CurrencyInput.js.map +1 -1
- package/cjs/components/CurrencyLabel/CurrencyLabel.js +21 -27
- package/cjs/components/CurrencyLabel/CurrencyLabel.js.map +1 -1
- package/cjs/components/DateInput/DateInput.d.ts +1 -0
- package/cjs/components/DateInput/DateInput.js +37 -14
- package/cjs/components/DateInput/DateInput.js.map +1 -1
- package/cjs/components/DateInput/helpers/InternalDateMediator.d.ts +1 -1
- package/cjs/components/DateInput/helpers/InternalDateMediator.js +10 -1
- package/cjs/components/DateInput/helpers/InternalDateMediator.js.map +1 -1
- package/cjs/components/DatePicker/DatePicker.d.ts +4 -33
- package/cjs/components/DatePicker/DatePicker.js +5 -60
- package/cjs/components/DatePicker/DatePicker.js.map +1 -1
- package/cjs/components/DateRangePicker/DateRangePicker.d.ts +3 -1
- package/cjs/components/DateRangePicker/DateRangePicker.js +61 -23
- package/cjs/components/DateRangePicker/DateRangePicker.js.map +1 -1
- package/cjs/components/DateRangePicker/DateRangePicker.styles.d.ts +0 -1
- package/cjs/components/DateRangePicker/DateRangePicker.styles.js +13 -18
- package/cjs/components/DateRangePicker/DateRangePicker.styles.js.map +1 -1
- package/cjs/components/DateRangePicker/DateRangePickerInput.js +4 -8
- package/cjs/components/DateRangePicker/DateRangePickerInput.js.map +1 -1
- package/cjs/components/DateRangePicker/helpers/validateDateRangePicker.js +17 -17
- package/cjs/components/DateRangePicker/helpers/validateDateRangePicker.js.map +1 -1
- package/cjs/components/Dropdown/Dropdown.d.ts +0 -47
- package/cjs/components/Dropdown/Dropdown.js +2 -83
- package/cjs/components/Dropdown/Dropdown.js.map +1 -1
- package/cjs/components/DropdownMenu/DropdownMenu.md +8 -8
- package/cjs/components/FileUploader/FileUploader.js +14 -2
- package/cjs/components/FileUploader/FileUploader.js.map +1 -1
- package/cjs/components/FxInput/FxInput.d.ts +1 -6
- package/cjs/components/FxInput/FxInput.js +1 -7
- package/cjs/components/FxInput/FxInput.js.map +1 -1
- package/cjs/components/Gapped/Gapped.d.ts +0 -15
- package/cjs/components/Gapped/Gapped.js +1 -25
- package/cjs/components/Gapped/Gapped.js.map +1 -1
- package/cjs/components/Group/Group.d.ts +3 -4
- package/cjs/components/Group/Group.js +90 -40
- package/cjs/components/Group/Group.js.map +1 -1
- package/cjs/components/Group/Group.md +4 -4
- package/cjs/components/Group/Group.styles.d.ts +1 -0
- package/cjs/components/Group/Group.styles.js +12 -6
- package/cjs/components/Group/Group.styles.js.map +1 -1
- package/cjs/components/Input/Input.md +4 -5
- package/cjs/components/Input/InputLayout/InputLayout.d.ts +1 -0
- package/cjs/components/Input/InputLayout/InputLayout.js +4 -2
- package/cjs/components/Input/InputLayout/InputLayout.js.map +1 -1
- package/cjs/components/Kebab/Kebab.d.ts +0 -1
- package/cjs/components/Kebab/Kebab.js +1 -26
- package/cjs/components/Kebab/Kebab.js.map +1 -1
- package/cjs/components/Kebab/Kebab.md +32 -32
- package/cjs/components/Link/Link.js +5 -0
- package/cjs/components/Link/Link.js.map +1 -1
- package/cjs/components/Link/Link.mixins.js +1 -2
- package/cjs/components/Link/Link.mixins.js.map +1 -1
- package/cjs/components/Link/Link.styles.js +3 -2
- package/cjs/components/Link/Link.styles.js.map +1 -1
- package/cjs/components/Loader/Loader.d.ts +4 -36
- package/cjs/components/Loader/Loader.js +3 -58
- package/cjs/components/Loader/Loader.js.map +1 -1
- package/cjs/components/MenuItem/MenuItem.d.ts +0 -12
- package/cjs/components/MenuItem/MenuItem.js +1 -22
- package/cjs/components/MenuItem/MenuItem.js.map +1 -1
- package/cjs/components/MenuItem/MenuItem.md +6 -6
- package/cjs/components/MiniModal/MiniModal.styles.d.ts +1 -0
- package/cjs/components/MiniModal/MiniModal.styles.js +14 -7
- package/cjs/components/MiniModal/MiniModal.styles.js.map +1 -1
- package/cjs/components/MiniModal/MiniModalBody.js +17 -2
- package/cjs/components/MiniModal/MiniModalBody.js.map +1 -1
- package/cjs/components/Modal/Modal.styles.d.ts +1 -1
- package/cjs/components/Modal/Modal.styles.js +6 -6
- package/cjs/components/Modal/Modal.styles.js.map +1 -1
- package/cjs/components/Modal/ModalSeparator.js +1 -1
- package/cjs/components/Modal/ModalSeparator.js.map +1 -1
- package/cjs/components/Paging/Paging.d.ts +0 -1
- package/cjs/components/Paging/Paging.js +2 -28
- package/cjs/components/Paging/Paging.js.map +1 -1
- package/cjs/components/PasswordInput/PasswordInput.d.ts +0 -7
- package/cjs/components/PasswordInput/PasswordInput.js +1 -11
- package/cjs/components/PasswordInput/PasswordInput.js.map +1 -1
- package/cjs/components/RadioGroup/RadioGroup.d.ts +1 -0
- package/cjs/components/RadioGroup/RadioGroup.js +18 -1
- package/cjs/components/RadioGroup/RadioGroup.js.map +1 -1
- package/cjs/components/RadioGroup/RadioGroup.styles.d.ts +1 -0
- package/cjs/components/RadioGroup/RadioGroup.styles.js +10 -4
- package/cjs/components/RadioGroup/RadioGroup.styles.js.map +1 -1
- package/cjs/components/ScrollContainer/ScrollContainer.d.ts +0 -9
- package/cjs/components/ScrollContainer/ScrollContainer.js +1 -11
- package/cjs/components/ScrollContainer/ScrollContainer.js.map +1 -1
- package/cjs/components/Select/Select.d.ts +3 -0
- package/cjs/components/Select/Select.js +4 -1
- package/cjs/components/Select/Select.js.map +1 -1
- package/cjs/components/Select/Select.md +3 -3
- package/cjs/components/SidePage/SidePage.js +1 -1
- package/cjs/components/SidePage/SidePage.js.map +1 -1
- package/cjs/components/SidePage/SidePageHeader.js +4 -1
- package/cjs/components/SidePage/SidePageHeader.js.map +1 -1
- package/cjs/components/SingleToast/SingleToast.d.ts +3 -3
- package/cjs/components/SingleToast/SingleToast.js.map +1 -1
- package/cjs/components/Spinner/Spinner.d.ts +0 -18
- package/cjs/components/Spinner/Spinner.js +1 -32
- package/cjs/components/Spinner/Spinner.js.map +1 -1
- package/cjs/components/Sticky/Sticky.d.ts +3 -13
- package/cjs/components/Sticky/Sticky.js +12 -19
- package/cjs/components/Sticky/Sticky.js.map +1 -1
- package/cjs/components/Switcher/Switcher.d.ts +4 -21
- package/cjs/components/Switcher/Switcher.js +11 -21
- package/cjs/components/Switcher/Switcher.js.map +1 -1
- package/cjs/components/Switcher/Switcher.styles.d.ts +1 -0
- package/cjs/components/Switcher/Switcher.styles.js +17 -9
- package/cjs/components/Switcher/Switcher.styles.js.map +1 -1
- package/cjs/components/Textarea/Textarea.d.ts +6 -45
- package/cjs/components/Textarea/Textarea.js +16 -58
- package/cjs/components/Textarea/Textarea.js.map +1 -1
- package/cjs/components/Textarea/Textarea.styles.js +2 -1
- package/cjs/components/Textarea/Textarea.styles.js.map +1 -1
- package/cjs/components/Textarea/TextareaCounter.js +2 -13
- package/cjs/components/Textarea/TextareaCounter.js.map +1 -1
- package/cjs/components/Toast/Toast.d.ts +8 -6
- package/cjs/components/Toast/Toast.js +18 -4
- package/cjs/components/Toast/Toast.js.map +1 -1
- package/cjs/components/Toast/ToastStatic.d.ts +3 -2
- package/cjs/components/Toast/ToastStatic.js.map +1 -1
- package/cjs/components/Toast/ToastView.d.ts +1 -15
- package/cjs/components/Toast/ToastView.js +3 -23
- package/cjs/components/Toast/ToastView.js.map +1 -1
- package/cjs/components/Toggle/Toggle.d.ts +0 -10
- package/cjs/components/Toggle/Toggle.js +1 -12
- package/cjs/components/Toggle/Toggle.js.map +1 -1
- package/cjs/components/Token/Token.md +0 -83
- package/cjs/components/TokenInput/TokenInput.d.ts +2 -2
- package/cjs/components/TokenInput/TokenInput.js +2 -1
- package/cjs/components/TokenInput/TokenInput.js.map +1 -1
- package/cjs/components/TokenInput/TokenInput.md +2 -33
- package/cjs/components/TokenInput/TokenInputMenu.d.ts +12 -3
- package/cjs/components/TokenInput/TokenInputMenu.js +23 -1
- package/cjs/components/TokenInput/TokenInputMenu.js.map +1 -1
- package/cjs/components/Tooltip/Tooltip.d.ts +2 -3
- package/cjs/components/Tooltip/Tooltip.js +7 -9
- package/cjs/components/Tooltip/Tooltip.js.map +1 -1
- package/cjs/components/Tooltip/Tooltip.md +8 -8
- package/cjs/components/TooltipMenu/TooltipMenu.md +12 -12
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js.map +1 -1
- package/cjs/internal/ClearCrossIcon/ClearCrossIcon.d.ts +1 -0
- package/cjs/internal/ClearCrossIcon/ClearCrossIcon.js +16 -7
- package/cjs/internal/ClearCrossIcon/ClearCrossIcon.js.map +1 -1
- package/cjs/internal/ClearCrossIcon/ClearCrossIcon.styles.d.ts +3 -0
- package/cjs/internal/ClearCrossIcon/ClearCrossIcon.styles.js +27 -9
- package/cjs/internal/ClearCrossIcon/ClearCrossIcon.styles.js.map +1 -1
- package/cjs/internal/ComponentTable.js +2 -3
- package/cjs/internal/ComponentTable.js.map +1 -1
- package/cjs/internal/CustomComboBox/ComboBoxView.d.ts +6 -2
- package/cjs/internal/CustomComboBox/ComboBoxView.js +37 -2
- package/cjs/internal/CustomComboBox/ComboBoxView.js.map +1 -1
- package/cjs/internal/CustomComboBox/CustomComboBox.d.ts +4 -2
- package/cjs/internal/CustomComboBox/CustomComboBox.js +4 -1
- package/cjs/internal/CustomComboBox/CustomComboBox.js.map +1 -1
- package/cjs/internal/DateSelect/DateSelect.d.ts +0 -10
- package/cjs/internal/DateSelect/DateSelect.js +12 -18
- package/cjs/internal/DateSelect/DateSelect.js.map +1 -1
- package/cjs/internal/InputLikeText/InputLikeText.styles.d.ts +1 -0
- package/cjs/internal/InputLikeText/InputLikeText.styles.js +12 -4
- package/cjs/internal/InputLikeText/InputLikeText.styles.js.map +1 -1
- package/cjs/internal/InternalTextareaWithLayout/InternalTextareaWithLayout.d.ts +36 -0
- package/cjs/internal/InternalTextareaWithLayout/InternalTextareaWithLayout.js +233 -0
- package/cjs/internal/InternalTextareaWithLayout/InternalTextareaWithLayout.js.map +1 -0
- package/cjs/internal/InternalTextareaWithLayout/InternalTextareaWithLayout.styles.d.ts +3 -0
- package/cjs/internal/InternalTextareaWithLayout/InternalTextareaWithLayout.styles.js +10 -0
- package/cjs/internal/InternalTextareaWithLayout/InternalTextareaWithLayout.styles.js.map +1 -0
- package/cjs/internal/Popup/Popup.d.ts +41 -60
- package/cjs/internal/Popup/Popup.js +27 -78
- package/cjs/internal/Popup/Popup.js.map +1 -1
- package/cjs/internal/Popup/PopupPin.d.ts +23 -33
- package/cjs/internal/Popup/PopupPin.js +2 -35
- package/cjs/internal/Popup/PopupPin.js.map +1 -1
- package/cjs/internal/RenderContainer/RenderInnerContainer.d.ts +0 -6
- package/cjs/internal/RenderContainer/RenderInnerContainer.js +0 -9
- package/cjs/internal/RenderContainer/RenderInnerContainer.js.map +1 -1
- package/cjs/internal/RenderLayer/RenderLayer.d.ts +0 -3
- package/cjs/internal/RenderLayer/RenderLayer.js +2 -12
- package/cjs/internal/RenderLayer/RenderLayer.js.map +1 -1
- package/cjs/internal/ThemePlayground/Playground.js +16 -16
- package/cjs/internal/ThemePlayground/Playground.js.map +1 -1
- package/cjs/internal/ThemePlayground/SizesGroup.js +4 -4
- package/cjs/internal/ThemePlayground/SizesGroup.js.map +1 -1
- package/cjs/internal/ThemePlayground/ThemeContextPlayground.js +1 -1
- package/cjs/internal/ThemePlayground/ThemeContextPlayground.js.map +1 -1
- package/cjs/internal/ThemePlayground/VariableValue.js +4 -4
- package/cjs/internal/ThemePlayground/VariableValue.js.map +1 -1
- package/cjs/internal/ThemeShowcase/VariablesCollector.d.ts +1 -1
- package/cjs/internal/ZIndex/ZIndex.d.ts +1 -3
- package/cjs/internal/ZIndex/ZIndex.js +5 -2
- package/cjs/internal/ZIndex/ZIndex.js.map +1 -1
- package/cjs/internal/themes/BasicTheme.d.ts +4 -0
- package/cjs/internal/themes/BasicTheme.js +6 -2
- package/cjs/internal/themes/BasicTheme.js.map +1 -1
- package/cjs/internal/themes/DarkTheme5_2.js +1 -1
- package/cjs/internal/themes/DarkTheme5_2.js.map +1 -1
- package/cjs/internal/themes/DarkTheme5_3.d.ts +1 -0
- package/cjs/internal/themes/DarkTheme5_3.js +13 -0
- package/cjs/internal/themes/DarkTheme5_3.js.map +1 -0
- package/cjs/internal/themes/LightTheme5_3.d.ts +1 -0
- package/cjs/internal/themes/LightTheme5_3.js +13 -0
- package/cjs/internal/themes/LightTheme5_3.js.map +1 -0
- package/cjs/lib/date/InternalDateGetter.d.ts +1 -1
- package/cjs/lib/date/InternalDateGetter.js +8 -1
- package/cjs/lib/date/InternalDateGetter.js.map +1 -1
- package/cjs/lib/featureFlagsContext/FeatureFlagsHelpers.d.ts +5 -0
- package/cjs/lib/featureFlagsContext/ReactUIFeatureFlagsContext.d.ts +5 -0
- package/cjs/lib/featureFlagsContext/ReactUIFeatureFlagsContext.js +11 -1
- package/cjs/lib/featureFlagsContext/ReactUIFeatureFlagsContext.js.map +1 -1
- package/cjs/lib/forwardRefAndName.d.ts +1 -1
- package/cjs/lib/forwardRefAndName.js +0 -1
- package/cjs/lib/forwardRefAndName.js.map +1 -1
- package/cjs/lib/getMenuPositions.d.ts +21 -1
- package/cjs/lib/getMenuPositions.js +45 -8
- package/cjs/lib/getMenuPositions.js.map +1 -1
- package/cjs/lib/theming/ThemeVersions.d.ts +1 -1
- package/cjs/lib/theming/ThemeVersions.js.map +1 -1
- package/cjs/lib/theming/themes/DarkTheme.d.ts +1 -0
- package/cjs/lib/theming/themes/DarkTheme.js +4 -2
- package/cjs/lib/theming/themes/DarkTheme.js.map +1 -1
- package/cjs/lib/theming/themes/LightTheme.d.ts +1 -0
- package/cjs/lib/theming/themes/LightTheme.js +4 -2
- package/cjs/lib/theming/themes/LightTheme.js.map +1 -1
- package/cjs/lib/utils.d.ts +4 -0
- package/cjs/lib/utils.js +5 -1
- package/cjs/lib/utils.js.map +1 -1
- package/components/Autocomplete/Autocomplete/Autocomplete.js +3 -23
- package/components/Autocomplete/Autocomplete/Autocomplete.js.map +1 -1
- package/components/Autocomplete/Autocomplete.d.ts +0 -22
- package/components/Button/Button.styles/Button.styles.js +1 -1
- package/components/Button/Button.styles/Button.styles.js.map +1 -1
- package/components/Calendar/CalendarDay/CalendarDay.js +9 -2
- package/components/Calendar/CalendarDay/CalendarDay.js.map +1 -1
- package/components/Calendar/DayCellView/DayCellView.js +6 -10
- package/components/Calendar/DayCellView/DayCellView.js.map +1 -1
- package/components/Checkbox/Checkbox/Checkbox.js +0 -11
- package/components/Checkbox/Checkbox/Checkbox.js.map +1 -1
- package/components/Checkbox/Checkbox.d.ts +0 -12
- package/components/ComboBox/ComboBox/ComboBox.js +2 -1
- package/components/ComboBox/ComboBox/ComboBox.js.map +1 -1
- package/components/ComboBox/ComboBox.d.ts +7 -1
- package/components/ComboBox/ComboBox.md +2 -2
- package/components/CurrencyInput/CurrencyInput/CurrencyInput.js +9 -36
- package/components/CurrencyInput/CurrencyInput/CurrencyInput.js.map +1 -1
- package/components/CurrencyInput/CurrencyInput.d.ts +1 -24
- package/components/CurrencyLabel/CurrencyLabel/CurrencyLabel.js +10 -22
- package/components/CurrencyLabel/CurrencyLabel/CurrencyLabel.js.map +1 -1
- package/components/DateInput/DateInput/DateInput.js +25 -16
- package/components/DateInput/DateInput/DateInput.js.map +1 -1
- package/components/DateInput/DateInput.d.ts +1 -0
- package/components/DateInput/helpers/InternalDateMediator/InternalDateMediator.js +2 -2
- package/components/DateInput/helpers/InternalDateMediator/InternalDateMediator.js.map +1 -1
- package/components/DateInput/helpers/InternalDateMediator.d.ts +1 -1
- package/components/DatePicker/DatePicker/DatePicker.js +1 -32
- package/components/DatePicker/DatePicker/DatePicker.js.map +1 -1
- package/components/DatePicker/DatePicker.d.ts +4 -33
- package/components/DateRangePicker/DateRangePicker/DateRangePicker.js +41 -22
- package/components/DateRangePicker/DateRangePicker/DateRangePicker.js.map +1 -1
- package/components/DateRangePicker/DateRangePicker.d.ts +3 -1
- package/components/DateRangePicker/DateRangePicker.styles/DateRangePicker.styles.js +12 -15
- package/components/DateRangePicker/DateRangePicker.styles/DateRangePicker.styles.js.map +1 -1
- package/components/DateRangePicker/DateRangePicker.styles.d.ts +0 -1
- package/components/DateRangePicker/DateRangePickerInput/DateRangePickerInput.js +5 -8
- package/components/DateRangePicker/DateRangePickerInput/DateRangePickerInput.js.map +1 -1
- package/components/DateRangePicker/helpers/validateDateRangePicker/validateDateRangePicker.js +16 -15
- package/components/DateRangePicker/helpers/validateDateRangePicker/validateDateRangePicker.js.map +1 -1
- package/components/Dropdown/Dropdown/Dropdown.js +1 -47
- package/components/Dropdown/Dropdown/Dropdown.js.map +1 -1
- package/components/Dropdown/Dropdown.d.ts +0 -47
- package/components/DropdownMenu/DropdownMenu.md +8 -8
- package/components/FileUploader/FileUploader/FileUploader.js +7 -2
- package/components/FileUploader/FileUploader/FileUploader.js.map +1 -1
- package/components/FxInput/FxInput/FxInput.js +1 -5
- package/components/FxInput/FxInput/FxInput.js.map +1 -1
- package/components/FxInput/FxInput.d.ts +1 -6
- package/components/Gapped/Gapped/Gapped.js +1 -15
- package/components/Gapped/Gapped/Gapped.js.map +1 -1
- package/components/Gapped/Gapped.d.ts +0 -15
- package/components/Group/Group/Group.js +64 -28
- package/components/Group/Group/Group.js.map +1 -1
- package/components/Group/Group.d.ts +3 -4
- package/components/Group/Group.md +4 -4
- package/components/Group/Group.styles/Group.styles.js +9 -6
- package/components/Group/Group.styles/Group.styles.js.map +1 -1
- package/components/Group/Group.styles.d.ts +1 -0
- package/components/Input/Input.md +4 -5
- package/components/Input/InputLayout/InputLayout/InputLayout.js +5 -2
- package/components/Input/InputLayout/InputLayout/InputLayout.js.map +1 -1
- package/components/Input/InputLayout/InputLayout.d.ts +1 -0
- package/components/Kebab/Kebab/Kebab.js +2 -20
- package/components/Kebab/Kebab/Kebab.js.map +1 -1
- package/components/Kebab/Kebab.d.ts +0 -1
- package/components/Kebab/Kebab.md +32 -32
- package/components/Link/Link/Link.js +4 -0
- package/components/Link/Link/Link.js.map +1 -1
- package/components/Link/Link.mixins/Link.mixins.js +1 -1
- package/components/Link/Link.mixins/Link.mixins.js.map +1 -1
- package/components/Link/Link.styles/Link.styles.js +1 -1
- package/components/Link/Link.styles/Link.styles.js.map +1 -1
- package/components/Loader/Loader/Loader.js +0 -33
- package/components/Loader/Loader/Loader.js.map +1 -1
- package/components/Loader/Loader.d.ts +4 -36
- package/components/MenuItem/MenuItem/MenuItem.js +1 -12
- package/components/MenuItem/MenuItem/MenuItem.js.map +1 -1
- package/components/MenuItem/MenuItem.d.ts +0 -12
- package/components/MenuItem/MenuItem.md +6 -6
- package/components/MiniModal/MiniModal.styles/MiniModal.styles.js +10 -7
- package/components/MiniModal/MiniModal.styles/MiniModal.styles.js.map +1 -1
- package/components/MiniModal/MiniModal.styles.d.ts +1 -0
- package/components/MiniModal/MiniModalBody/MiniModalBody.js +13 -5
- package/components/MiniModal/MiniModalBody/MiniModalBody.js.map +1 -1
- package/components/Modal/Modal.styles/Modal.styles.js +3 -3
- package/components/Modal/Modal.styles/Modal.styles.js.map +1 -1
- package/components/Modal/Modal.styles.d.ts +1 -1
- package/components/Modal/ModalSeparator/ModalSeparator.js +1 -1
- package/components/Modal/ModalSeparator/ModalSeparator.js.map +1 -1
- package/components/Paging/Paging/Paging.js +1 -22
- package/components/Paging/Paging/Paging.js.map +1 -1
- package/components/Paging/Paging.d.ts +0 -1
- package/components/PasswordInput/PasswordInput/PasswordInput.js +1 -7
- package/components/PasswordInput/PasswordInput/PasswordInput.js.map +1 -1
- package/components/PasswordInput/PasswordInput.d.ts +0 -7
- package/components/RadioGroup/RadioGroup/RadioGroup.js +23 -17
- package/components/RadioGroup/RadioGroup/RadioGroup.js.map +1 -1
- package/components/RadioGroup/RadioGroup.d.ts +1 -0
- package/components/RadioGroup/RadioGroup.styles/RadioGroup.styles.js +7 -4
- package/components/RadioGroup/RadioGroup.styles/RadioGroup.styles.js.map +1 -1
- package/components/RadioGroup/RadioGroup.styles.d.ts +1 -0
- package/components/ScrollContainer/ScrollContainer/ScrollContainer.js +1 -9
- package/components/ScrollContainer/ScrollContainer/ScrollContainer.js.map +1 -1
- package/components/ScrollContainer/ScrollContainer.d.ts +0 -9
- package/components/Select/Select/Select.js +3 -2
- package/components/Select/Select/Select.js.map +1 -1
- package/components/Select/Select.d.ts +3 -0
- package/components/Select/Select.md +3 -3
- package/components/SidePage/SidePage/SidePage.js +1 -1
- package/components/SidePage/SidePage/SidePage.js.map +1 -1
- package/components/SidePage/SidePageHeader/SidePageHeader.js +6 -1
- package/components/SidePage/SidePageHeader/SidePageHeader.js.map +1 -1
- package/components/SingleToast/SingleToast/SingleToast.js.map +1 -1
- package/components/SingleToast/SingleToast.d.ts +3 -3
- package/components/Spinner/Spinner/Spinner.js +1 -18
- package/components/Spinner/Spinner/Spinner.js.map +1 -1
- package/components/Spinner/Spinner.d.ts +0 -18
- package/components/Sticky/Sticky/Sticky.js +10 -14
- package/components/Sticky/Sticky/Sticky.js.map +1 -1
- package/components/Sticky/Sticky.d.ts +3 -13
- package/components/Switcher/Switcher/Switcher.js +19 -16
- package/components/Switcher/Switcher/Switcher.js.map +1 -1
- package/components/Switcher/Switcher.d.ts +4 -21
- package/components/Switcher/Switcher.styles/Switcher.styles.js +12 -9
- package/components/Switcher/Switcher.styles/Switcher.styles.js.map +1 -1
- package/components/Switcher/Switcher.styles.d.ts +1 -0
- package/components/Textarea/Textarea/Textarea.js +12 -46
- package/components/Textarea/Textarea/Textarea.js.map +1 -1
- package/components/Textarea/Textarea.d.ts +6 -45
- package/components/Textarea/Textarea.styles/Textarea.styles.js +1 -1
- package/components/Textarea/Textarea.styles/Textarea.styles.js.map +1 -1
- package/components/Textarea/TextareaCounter/TextareaCounter.js +1 -11
- package/components/Textarea/TextareaCounter/TextareaCounter.js.map +1 -1
- package/components/Toast/Toast/Toast.js +8 -10
- package/components/Toast/Toast/Toast.js.map +1 -1
- package/components/Toast/Toast.d.ts +8 -6
- package/components/Toast/ToastStatic/ToastStatic.js.map +1 -1
- package/components/Toast/ToastStatic.d.ts +3 -2
- package/components/Toast/ToastView/ToastView.js +3 -17
- package/components/Toast/ToastView/ToastView.js.map +1 -1
- package/components/Toast/ToastView.d.ts +1 -15
- package/components/Toggle/Toggle/Toggle.js +1 -10
- package/components/Toggle/Toggle/Toggle.js.map +1 -1
- package/components/Toggle/Toggle.d.ts +0 -10
- package/components/Token/Token.md +0 -83
- package/components/TokenInput/TokenInput/TokenInput.js +2 -1
- package/components/TokenInput/TokenInput/TokenInput.js.map +1 -1
- package/components/TokenInput/TokenInput.d.ts +2 -2
- package/components/TokenInput/TokenInput.md +2 -33
- package/components/TokenInput/TokenInputMenu/TokenInputMenu.js +16 -6
- package/components/TokenInput/TokenInputMenu/TokenInputMenu.js.map +1 -1
- package/components/TokenInput/TokenInputMenu.d.ts +12 -3
- package/components/Tooltip/Tooltip/Tooltip.js +8 -7
- package/components/Tooltip/Tooltip/Tooltip.js.map +1 -1
- package/components/Tooltip/Tooltip.d.ts +2 -3
- package/components/Tooltip/Tooltip.md +8 -8
- package/components/TooltipMenu/TooltipMenu.md +12 -12
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/internal/ClearCrossIcon/ClearCrossIcon/ClearCrossIcon.js +21 -7
- package/internal/ClearCrossIcon/ClearCrossIcon/ClearCrossIcon.js.map +1 -1
- package/internal/ClearCrossIcon/ClearCrossIcon.d.ts +1 -0
- package/internal/ClearCrossIcon/ClearCrossIcon.styles/ClearCrossIcon.styles.js +14 -5
- package/internal/ClearCrossIcon/ClearCrossIcon.styles/ClearCrossIcon.styles.js.map +1 -1
- package/internal/ClearCrossIcon/ClearCrossIcon.styles.d.ts +3 -0
- package/internal/ComponentTable/ComponentTable.js +0 -2
- package/internal/ComponentTable/ComponentTable.js.map +1 -1
- package/internal/CustomComboBox/ComboBoxView/ComboBoxView.js +59 -27
- package/internal/CustomComboBox/ComboBoxView/ComboBoxView.js.map +1 -1
- package/internal/CustomComboBox/ComboBoxView.d.ts +6 -2
- package/internal/CustomComboBox/CustomComboBox/CustomComboBox.js +2 -1
- package/internal/CustomComboBox/CustomComboBox/CustomComboBox.js.map +1 -1
- package/internal/CustomComboBox/CustomComboBox.d.ts +4 -2
- package/internal/DateSelect/DateSelect/DateSelect.js +3 -10
- package/internal/DateSelect/DateSelect/DateSelect.js.map +1 -1
- package/internal/DateSelect/DateSelect.d.ts +0 -10
- package/internal/InputLikeText/InputLikeText.styles/InputLikeText.styles.js +7 -4
- package/internal/InputLikeText/InputLikeText.styles/InputLikeText.styles.js.map +1 -1
- package/internal/InputLikeText/InputLikeText.styles.d.ts +1 -0
- package/internal/InternalTextareaWithLayout/InternalTextareaWithLayout/InternalTextareaWithLayout.js +244 -0
- package/internal/InternalTextareaWithLayout/InternalTextareaWithLayout/InternalTextareaWithLayout.js.map +1 -0
- package/internal/InternalTextareaWithLayout/InternalTextareaWithLayout/package.json +6 -0
- package/internal/InternalTextareaWithLayout/InternalTextareaWithLayout.d.ts +36 -0
- package/internal/InternalTextareaWithLayout/InternalTextareaWithLayout.styles/InternalTextareaWithLayout.styles.js +8 -0
- package/internal/InternalTextareaWithLayout/InternalTextareaWithLayout.styles/InternalTextareaWithLayout.styles.js.map +1 -0
- package/internal/InternalTextareaWithLayout/InternalTextareaWithLayout.styles/package.json +6 -0
- package/internal/InternalTextareaWithLayout/InternalTextareaWithLayout.styles.d.ts +3 -0
- package/internal/Popup/Popup/Popup.js +13 -66
- package/internal/Popup/Popup/Popup.js.map +1 -1
- package/internal/Popup/Popup.d.ts +41 -60
- package/internal/Popup/PopupPin/PopupPin.js +1 -34
- package/internal/Popup/PopupPin/PopupPin.js.map +1 -1
- package/internal/Popup/PopupPin.d.ts +23 -33
- package/internal/RenderContainer/RenderInnerContainer/RenderInnerContainer.js +0 -8
- package/internal/RenderContainer/RenderInnerContainer/RenderInnerContainer.js.map +1 -1
- package/internal/RenderContainer/RenderInnerContainer.d.ts +0 -6
- package/internal/RenderLayer/RenderLayer/RenderLayer.js +3 -11
- package/internal/RenderLayer/RenderLayer/RenderLayer.js.map +1 -1
- package/internal/RenderLayer/RenderLayer.d.ts +0 -3
- package/internal/ThemePlayground/Playground/Playground.js +13 -13
- package/internal/ThemePlayground/Playground/Playground.js.map +1 -1
- package/internal/ThemePlayground/SizesGroup/SizesGroup.js +4 -4
- package/internal/ThemePlayground/SizesGroup/SizesGroup.js.map +1 -1
- package/internal/ThemePlayground/ThemeContextPlayground/ThemeContextPlayground.js +2 -2
- package/internal/ThemePlayground/ThemeContextPlayground/ThemeContextPlayground.js.map +1 -1
- package/internal/ThemePlayground/VariableValue/VariableValue.js +4 -4
- package/internal/ThemePlayground/VariableValue/VariableValue.js.map +1 -1
- package/internal/ThemeShowcase/VariablesCollector.d.ts +1 -1
- package/internal/ZIndex/ZIndex/ZIndex.js +8 -10
- package/internal/ZIndex/ZIndex/ZIndex.js.map +1 -1
- package/internal/ZIndex/ZIndex.d.ts +1 -3
- package/internal/themes/BasicTheme/BasicTheme.js +4 -0
- package/internal/themes/BasicTheme/BasicTheme.js.map +1 -1
- package/internal/themes/BasicTheme.d.ts +4 -0
- package/internal/themes/DarkTheme5_2/DarkTheme5_2.js +3 -3
- package/internal/themes/DarkTheme5_2/DarkTheme5_2.js.map +1 -1
- package/internal/themes/DarkTheme5_3/DarkTheme5_3.js +16 -0
- package/internal/themes/DarkTheme5_3/DarkTheme5_3.js.map +1 -0
- package/internal/themes/DarkTheme5_3/package.json +6 -0
- package/internal/themes/DarkTheme5_3.d.ts +1 -0
- package/internal/themes/LightTheme5_3/LightTheme5_3.js +16 -0
- package/internal/themes/LightTheme5_3/LightTheme5_3.js.map +1 -0
- package/internal/themes/LightTheme5_3/package.json +6 -0
- package/internal/themes/LightTheme5_3.d.ts +1 -0
- package/lib/date/InternalDateGetter/InternalDateGetter.js +4 -1
- package/lib/date/InternalDateGetter/InternalDateGetter.js.map +1 -1
- package/lib/date/InternalDateGetter.d.ts +1 -1
- package/lib/featureFlagsContext/FeatureFlagsHelpers.d.ts +5 -0
- package/lib/featureFlagsContext/ReactUIFeatureFlagsContext/ReactUIFeatureFlagsContext.js +6 -1
- package/lib/featureFlagsContext/ReactUIFeatureFlagsContext/ReactUIFeatureFlagsContext.js.map +1 -1
- package/lib/featureFlagsContext/ReactUIFeatureFlagsContext.d.ts +5 -0
- package/lib/forwardRefAndName/forwardRefAndName.js.map +1 -1
- package/lib/forwardRefAndName.d.ts +1 -1
- package/lib/getMenuPositions/getMenuPositions.js +33 -4
- package/lib/getMenuPositions/getMenuPositions.js.map +1 -1
- package/lib/getMenuPositions.d.ts +21 -1
- package/lib/theming/ThemeVersions/ThemeVersions.js.map +1 -1
- package/lib/theming/ThemeVersions.d.ts +1 -1
- package/lib/theming/themes/DarkTheme/DarkTheme.js +3 -1
- package/lib/theming/themes/DarkTheme/DarkTheme.js.map +1 -1
- package/lib/theming/themes/DarkTheme.d.ts +1 -0
- package/lib/theming/themes/LightTheme/LightTheme.js +3 -1
- package/lib/theming/themes/LightTheme/LightTheme.js.map +1 -1
- package/lib/theming/themes/LightTheme.d.ts +1 -0
- package/lib/utils/utils.js +2 -0
- package/lib/utils/utils.js.map +1 -1
- package/lib/utils.d.ts +4 -0
- package/package.json +7 -11
- package/cjs/lib/SSRSafe.d.ts +0 -2
- package/cjs/lib/SSRSafe.js +0 -5
- package/cjs/lib/SSRSafe.js.map +0 -1
- package/lib/SSRSafe/SSRSafe.js +0 -4
- package/lib/SSRSafe/SSRSafe.js.map +0 -1
- package/lib/SSRSafe/package.json +0 -6
- package/lib/SSRSafe.d.ts +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_propTypes","_shallowequal","_globalObject","LayoutEvents","_interopRequireWildcard","_utils","_ZIndex","_CommonWrapper","_Emotion","_rootNode","_getDOMRect3","_createPropsGetter","_Sticky2","_class","_Sticky","MAX_REFLOW_RETRIES","StickyDataTids","exports","root","Sticky","rootNode","_React$Component","_this","_len","arguments","length","args","Array","_key","call","apply","concat","getProps","createPropsGetter","defaultProps","state","fixed","deltaHeight","stopped","relativeTop","layoutSubscription","remove","reflowCounter","refWrapper","ref","wrapper","refInner","inner","reflow","_globalObject$documen","globalObject","document","documentElement","Error","windowHeight","innerHeight","clientHeight","_getDOMRect","getDOMRect","top","bottom","left","width","_getDOMRect2","height","_this$props","props","getStop","side","_this$state","prevFixed","_this$state$height","prevHeight","offset","Math","ceil","floor","setState","stop","stopRect","outerHeight","_inheritsLoose2","default","_proto","prototype","componentDidMount","addListener","componentWillUnmount","componentDidUpdate","prevProps","prevState","shallowEqual","emit","render","_cx","children","_this$state2","innerStyle","isFunction","createElement","CommonWrapper","_extends2","rootNodeRef","setRootNode","className","styles","ZIndex","priority","applyZIndex","cx","style","wrapperRef","container","React","Component","__KONTUR_REACT_UI__","displayName","propTypes","PropTypes","oneOfType","node","func","number","oneOf","isRequired"],"sources":["Sticky.tsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport shallowEqual from 'shallowequal';\nimport { globalObject } from '@skbkontur/global-object';\n\nimport * as LayoutEvents from '../../lib/LayoutEvents';\nimport type { Nullable } from '../../typings/utility-types';\nimport { isFunction } from '../../lib/utils';\nimport { ZIndex } from '../../internal/ZIndex';\nimport type { CommonProps } from '../../internal/CommonWrapper';\nimport { CommonWrapper } from '../../internal/CommonWrapper';\nimport { cx } from '../../lib/theming/Emotion';\nimport type { TSetRootNode } from '../../lib/rootNode';\nimport { rootNode } from '../../lib/rootNode';\nimport { getDOMRect } from '../../lib/dom/getDOMRect';\nimport { createPropsGetter } from '../../lib/createPropsGetter';\n\nimport { styles } from './Sticky.styles';\n\nconst MAX_REFLOW_RETRIES = 5;\n\nexport interface StickyProps extends Omit<CommonProps, 'children'> {\n /** Задает сторону залипания. */\n side: 'top' | 'bottom';\n\n /** Задает отступ от края экрана в пикселях, на который сдвигается элемент в залипшем состоянии.\n * @default 0 */\n offset?: number;\n\n /** Задает функцию, которая возвращает DOM-элемент, который нельзя пересекать. */\n getStop?: () => Nullable<HTMLElement>;\n\n /** @ignore */\n children?: React.ReactNode | ((fixed: boolean) => React.ReactNode);\n}\n\nexport interface StickyState {\n fixed: boolean;\n deltaHeight: number;\n height?: number;\n width?: number;\n left?: number;\n stopped: boolean;\n relativeTop: number;\n}\n\nexport const StickyDataTids = {\n root: 'Sticky__root',\n} as const;\n\ntype DefaultProps = Required<Pick<StickyProps, 'offset'>>;\n\n/**\n * `Sticky` позволяет закреплять элемент интерфейса в определенной позиции на экране при прокрутке страницы.\n * Это полезно для создания \"прилипающих\" элементов, которые остаются видимыми при прокрутке содержимого.\n */\n@rootNode\nexport class Sticky extends React.Component<StickyProps, StickyState> {\n public static __KONTUR_REACT_UI__ = 'Sticky';\n public static displayName = 'Sticky';\n\n public static propTypes = {\n children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),\n\n /**\n * Функция, которая возвращает DOM-элемент, который нельзя пересекать.\n */\n getStop: PropTypes.func,\n\n /**\n * Отступ от границы в пикселях\n */\n offset: PropTypes.number,\n\n side: PropTypes.oneOf(['top', 'bottom']).isRequired,\n };\n\n public static defaultProps: DefaultProps = { offset: 0 };\n\n private getProps = createPropsGetter(Sticky.defaultProps);\n\n public state: StickyState = {\n fixed: false,\n deltaHeight: 0,\n stopped: false,\n relativeTop: 0,\n };\n\n private wrapper: Nullable<HTMLElement>;\n private inner: Nullable<HTMLElement>;\n private layoutSubscription: { remove: Nullable<() => void> } = { remove: null };\n private reflowCounter = 0;\n private setRootNode!: TSetRootNode;\n\n public componentDidMount() {\n this.reflow();\n\n this.layoutSubscription = LayoutEvents.addListener(this.reflow);\n }\n\n public componentWillUnmount() {\n if (this.layoutSubscription.remove) {\n this.layoutSubscription.remove();\n }\n }\n\n public componentDidUpdate(prevProps: StickyProps, prevState: StickyState) {\n if (!shallowEqual(prevProps, this.props) || !shallowEqual(prevState, this.state)) {\n if (this.reflowCounter < MAX_REFLOW_RETRIES) {\n LayoutEvents.emit();\n this.reflowCounter += 1;\n return;\n }\n }\n this.reflowCounter = 0;\n }\n\n public render() {\n let { children } = this.props;\n const { side } = this.props;\n const offset = this.getProps().offset;\n const { fixed, stopped, relativeTop, deltaHeight, width, height, left } = this.state;\n const innerStyle: React.CSSProperties = {};\n\n if (fixed) {\n if (stopped) {\n innerStyle.top = relativeTop;\n innerStyle[side === 'top' ? 'marginTop' : 'marginBottom'] = deltaHeight;\n } else {\n innerStyle.width = width;\n innerStyle[side] = offset;\n innerStyle.left = left;\n }\n }\n\n if (isFunction(children)) {\n children = children(fixed);\n }\n\n return (\n <CommonWrapper rootNodeRef={this.setRootNode} {...this.props}>\n <div data-tid={StickyDataTids.root} ref={this.refWrapper} className={styles.wrapper()}>\n <ZIndex\n priority=\"Sticky\"\n applyZIndex={fixed}\n className={cx(styles.inner(), {\n [styles.fixed()]: fixed && !stopped,\n [styles.stopped()]: stopped,\n })}\n style={innerStyle}\n wrapperRef={this.refInner}\n >\n <div className={styles.container()}>{children}</div>\n </ZIndex>\n {fixed && !stopped ? <div style={{ width, height }} /> : null}\n </div>\n </CommonWrapper>\n );\n }\n\n private refWrapper = (ref: Nullable<HTMLElement>) => (this.wrapper = ref);\n\n private refInner = (ref: Nullable<HTMLElement>) => (this.inner = ref);\n\n /**\n * Пересчитать габариты и позицию залипшего элемента\n *\n * @public\n */\n public reflow = () => {\n if (!globalObject.document?.documentElement) {\n throw Error('There is no \"documentElement\" in document');\n }\n\n const windowHeight = globalObject.innerHeight || globalObject.document.documentElement.clientHeight;\n if (!this.wrapper || !this.inner) {\n return;\n }\n const { top, bottom, left, width } = getDOMRect(this.wrapper);\n const { height } = getDOMRect(this.inner);\n const { getStop, side } = this.props;\n const { fixed: prevFixed, height: prevHeight = height } = this.state;\n const offset = this.getProps().offset;\n const fixed = side === 'top' ? Math.ceil(top) < offset : Math.floor(bottom) > windowHeight - offset;\n\n this.setState({ fixed, left });\n\n if (fixed && !prevFixed) {\n this.setState({ width, height });\n }\n\n if (fixed) {\n this.setState({ width });\n const stop = getStop && getStop();\n if (stop) {\n const deltaHeight = prevHeight - height;\n const stopRect = getDOMRect(stop);\n const outerHeight = height + offset;\n let stopped = false;\n let relativeTop = 0;\n\n if (side === 'top') {\n stopped = stopRect.top - outerHeight < 0;\n relativeTop = stopRect.top - prevHeight - top;\n } else {\n stopped = stopRect.bottom + outerHeight > windowHeight;\n relativeTop = stopRect.bottom - top;\n }\n\n this.setState({ relativeTop, deltaHeight, stopped });\n }\n }\n };\n}\n"],"mappings":"ocAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,aAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;;AAEA,IAAAI,YAAA,GAAAC,uBAAA,CAAAL,OAAA;;AAEA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;;AAEA,IAAAQ,cAAA,GAAAR,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I,EAEvB;AACJ;AACA,KACIhD,MAAM,EAAE6C,kBAAS,CAACI,MAAM,EAExBtD,IAAI,EAAEkD,kBAAS,CAACK,KAAK,CAAC,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAACC,UAAU,CACrD,CAAC,EAAA9G,OAAA,CAEaoB,YAAY,GAAiB,EAAEuC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAA3D,OAAA,MAAAD,MAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_shallowequal","_globalObject","LayoutEvents","_interopRequireWildcard","_utils","_ZIndex","_CommonWrapper","_Emotion","_rootNode","_getDOMRect3","_createPropsGetter","_featureFlagsContext","_Sticky2","_class","_Sticky","MAX_REFLOW_RETRIES","StickyDataTids","exports","root","Sticky","rootNode","_React$Component","_this","_len","arguments","length","args","Array","_key","call","apply","concat","getProps","createPropsGetter","defaultProps","state","fixed","deltaHeight","stopped","relativeTop","layoutSubscription","remove","reflowCounter","refWrapper","ref","wrapper","refInner","inner","reflow","_globalObject$documen","globalObject","document","documentElement","Error","windowHeight","innerHeight","clientHeight","_getDOMRect","getDOMRect","top","bottom","left","width","_getDOMRect2","height","_this$props","props","getStop","side","_this$state","prevFixed","_this$state$height","prevHeight","offset","Math","ceil","floor","setState","stop","stopRect","outerHeight","_inheritsLoose2","default","_proto","prototype","componentDidMount","addListener","componentWillUnmount","componentDidUpdate","prevProps","prevState","shallowEqual","featureFlags","stickyReduceLayoutEvents","emit","render","_this2","createElement","ReactUIFeatureFlagsContext","Consumer","flags","getFullReactUIFlagsContext","renderMain","_cx","children","_this$state2","innerStyle","isFunction","CommonWrapper","_extends2","rootNodeRef","setRootNode","className","styles","ZIndex","priority","applyZIndex","cx","style","wrapperRef","container","React","Component","__KONTUR_REACT_UI__","displayName"],"sources":["Sticky.tsx"],"sourcesContent":["import React from 'react';\nimport shallowEqual from 'shallowequal';\nimport { globalObject } from '@skbkontur/global-object';\n\nimport * as LayoutEvents from '../../lib/LayoutEvents';\nimport type { Nullable } from '../../typings/utility-types';\nimport { isFunction } from '../../lib/utils';\nimport { ZIndex } from '../../internal/ZIndex';\nimport type { CommonProps } from '../../internal/CommonWrapper';\nimport { CommonWrapper } from '../../internal/CommonWrapper';\nimport { cx } from '../../lib/theming/Emotion';\nimport type { TSetRootNode } from '../../lib/rootNode';\nimport { rootNode } from '../../lib/rootNode';\nimport { getDOMRect } from '../../lib/dom/getDOMRect';\nimport { createPropsGetter } from '../../lib/createPropsGetter';\nimport type { ReactUIFeatureFlags } from '../../lib/featureFlagsContext';\nimport { getFullReactUIFlagsContext, ReactUIFeatureFlagsContext } from '../../lib/featureFlagsContext';\n\nimport { styles } from './Sticky.styles';\n\nconst MAX_REFLOW_RETRIES = 5;\n\nexport interface StickyProps extends Omit<CommonProps, 'children'> {\n /** Задает сторону залипания. */\n side: 'top' | 'bottom';\n\n /** Задает отступ от края экрана в пикселях, на который сдвигается элемент в залипшем состоянии.\n * @default 0 */\n offset?: number;\n\n /** Задает функцию, которая возвращает DOM-элемент, который нельзя пересекать. */\n getStop?: () => Nullable<HTMLElement>;\n\n /** @ignore */\n children?: React.ReactNode | ((fixed: boolean) => React.ReactNode);\n}\n\nexport interface StickyState {\n fixed: boolean;\n deltaHeight: number;\n height?: number;\n width?: number;\n left?: number;\n stopped: boolean;\n relativeTop: number;\n}\n\nexport const StickyDataTids = {\n root: 'Sticky__root',\n} as const;\n\ntype DefaultProps = Required<Pick<StickyProps, 'offset'>>;\n\n/**\n * `Sticky` позволяет закреплять элемент интерфейса в определенной позиции на экране при прокрутке страницы.\n * Это полезно для создания \"прилипающих\" элементов, которые остаются видимыми при прокрутке содержимого.\n */\n@rootNode\nexport class Sticky extends React.Component<StickyProps, StickyState> {\n public static __KONTUR_REACT_UI__ = 'Sticky';\n public static displayName = 'Sticky';\n\n public static defaultProps: DefaultProps = { offset: 0 };\n\n private getProps = createPropsGetter(Sticky.defaultProps);\n\n public state: StickyState = {\n fixed: false,\n deltaHeight: 0,\n stopped: false,\n relativeTop: 0,\n };\n\n private wrapper: Nullable<HTMLElement>;\n private inner: Nullable<HTMLElement>;\n private layoutSubscription: { remove: Nullable<() => void> } = { remove: null };\n private reflowCounter = 0;\n private setRootNode!: TSetRootNode;\n public featureFlags!: ReactUIFeatureFlags;\n\n public componentDidMount() {\n this.reflow();\n\n this.layoutSubscription = LayoutEvents.addListener(this.reflow);\n }\n\n public componentWillUnmount() {\n if (this.layoutSubscription.remove) {\n this.layoutSubscription.remove();\n }\n }\n\n public componentDidUpdate(prevProps: StickyProps, prevState: StickyState) {\n if (!shallowEqual(prevProps, this.props) || !shallowEqual(prevState, this.state)) {\n if (this.reflowCounter < MAX_REFLOW_RETRIES) {\n this.featureFlags.stickyReduceLayoutEvents ? this.reflow() : LayoutEvents.emit();\n this.reflowCounter += 1;\n return;\n }\n }\n this.reflowCounter = 0;\n }\n\n public render() {\n return (\n <ReactUIFeatureFlagsContext.Consumer>\n {(flags) => {\n this.featureFlags = getFullReactUIFlagsContext(flags);\n return this.renderMain();\n }}\n </ReactUIFeatureFlagsContext.Consumer>\n );\n }\n\n private renderMain() {\n let { children } = this.props;\n const { side } = this.props;\n const offset = this.getProps().offset;\n const { fixed, stopped, relativeTop, deltaHeight, width, height, left } = this.state;\n const innerStyle: React.CSSProperties = {};\n\n if (fixed) {\n if (stopped) {\n innerStyle.top = relativeTop;\n innerStyle[side === 'top' ? 'marginTop' : 'marginBottom'] = deltaHeight;\n } else {\n innerStyle.width = width;\n innerStyle[side] = offset;\n innerStyle.left = left;\n }\n }\n\n if (isFunction(children)) {\n children = children(fixed);\n }\n\n return (\n <CommonWrapper rootNodeRef={this.setRootNode} {...this.props}>\n <div data-tid={StickyDataTids.root} ref={this.refWrapper} className={styles.wrapper()}>\n <ZIndex\n priority=\"Sticky\"\n applyZIndex={fixed}\n className={cx(styles.inner(), {\n [styles.fixed()]: fixed && !stopped,\n [styles.stopped()]: stopped,\n })}\n style={innerStyle}\n wrapperRef={this.refInner}\n >\n <div className={styles.container()}>{children}</div>\n </ZIndex>\n {fixed && !stopped ? <div style={{ width, height }} /> : null}\n </div>\n </CommonWrapper>\n );\n }\n\n private refWrapper = (ref: Nullable<HTMLElement>) => (this.wrapper = ref);\n\n private refInner = (ref: Nullable<HTMLElement>) => (this.inner = ref);\n\n /**\n * Пересчитать габариты и позицию залипшего элемента\n *\n * @public\n */\n public reflow = () => {\n if (!globalObject.document?.documentElement) {\n throw Error('There is no \"documentElement\" in document');\n }\n\n const windowHeight = globalObject.innerHeight || globalObject.document.documentElement.clientHeight;\n if (!this.wrapper || !this.inner) {\n return;\n }\n const { top, bottom, left, width } = getDOMRect(this.wrapper);\n const { height } = getDOMRect(this.inner);\n const { getStop, side } = this.props;\n const { fixed: prevFixed, height: prevHeight = height } = this.state;\n const offset = this.getProps().offset;\n const fixed = side === 'top' ? Math.ceil(top) < offset : Math.floor(bottom) > windowHeight - offset;\n\n this.setState({ fixed, left });\n\n if (fixed && !prevFixed) {\n this.setState({ width, height });\n }\n\n if (fixed) {\n this.setState({ width });\n const stop = getStop && getStop();\n if (stop) {\n const deltaHeight = prevHeight - height;\n const stopRect = getDOMRect(stop);\n const outerHeight = height + offset;\n let stopped = false;\n let relativeTop = 0;\n\n if (side === 'top') {\n stopped = stopRect.top - outerHeight < 0;\n relativeTop = stopRect.top - prevHeight - top;\n } else {\n stopped = stopRect.bottom + outerHeight > windowHeight;\n relativeTop = stopRect.bottom - top;\n }\n\n this.setState({ relativeTop, deltaHeight, stopped });\n }\n }\n };\n}\n"],"mappings":"ocAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;;AAEA,IAAAG,YAAA,GAAAC,uBAAA,CAAAJ,OAAA;;AAEA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;;AAEA,IAAAO,cAAA,GAAAP,OAAA;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,KAAK,EAAEE,MAAM,EAANA,MAAM,CAAC,CAAE,EAAE,CAAC,GAAG,IACtD,CACQ,CAAC,CAEpB,CAAC,QAAA7C,MAAA,GAjGyBsG,cAAK,CAACC,SAAS,GAAA5G,OAAA,CAC3B6G,mBAAmB,GAAG,QAAQ,EAAA7G,OAAA,CAC9B8G,WAAW,GAAG,QAAQ,EAAA9G,OAAA,CAEtBoB,YAAY,GAAiB,EAAEuC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAA3D,OAAA,MAAAD,MAAA","ignoreList":[]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { HTMLAttributes } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
3
|
import type { ButtonProps } from '../Button';
|
|
5
4
|
import type { Nullable } from '../../typings/utility-types';
|
|
6
5
|
import type { CommonProps } from '../../internal/CommonWrapper';
|
|
@@ -10,7 +9,7 @@ export declare const SwitcherDataTids: {
|
|
|
10
9
|
readonly root: "Switcher__root";
|
|
11
10
|
};
|
|
12
11
|
export interface SwitcherProps extends Pick<HTMLAttributes<unknown>, 'role'>, CommonProps {
|
|
13
|
-
/** Задает список строк или
|
|
12
|
+
/** Задает список элементов в свитчере. Это массив строк или объектов типа `{ label: string, value: string, buttonProps?: Partial<ButtonProps> }` */
|
|
14
13
|
items: SwitcherItems[];
|
|
15
14
|
/** Устанавливает значение свитчера. */
|
|
16
15
|
value?: string;
|
|
@@ -22,15 +21,11 @@ export interface SwitcherProps extends Pick<HTMLAttributes<unknown>, 'role'>, Co
|
|
|
22
21
|
error?: boolean;
|
|
23
22
|
/** Задает размер контрола. */
|
|
24
23
|
size?: SizeProp;
|
|
24
|
+
/** Задает ширину контрола. С этим пропом элементы внутри автоматически равномерно растянутся. */
|
|
25
|
+
width?: React.CSSProperties['width'];
|
|
25
26
|
/** Делает компонент недоступным. */
|
|
26
27
|
disabled?: boolean;
|
|
27
|
-
/** Задает функцию отрисовки элемента.
|
|
28
|
-
* @param `label` -
|
|
29
|
-
* @param `value` -
|
|
30
|
-
* @param `buttonProps` -
|
|
31
|
-
* @param `renderDefault` -
|
|
32
|
-
* @param `ariaLabel` -
|
|
33
|
-
*/
|
|
28
|
+
/** Задает функцию отрисовки элемента. Параметр `renderDefault` - это встроенная дефолтная функция отрисовки элемента, которую можно вызывать в `renderItem`. */
|
|
34
29
|
renderItem?: (label: string, value: string, buttonProps: ButtonProps, renderDefault: () => React.ReactNode, ariaLabel?: string) => React.ReactNode;
|
|
35
30
|
}
|
|
36
31
|
type DefaultProps = Required<Pick<SwitcherProps, 'role'>>;
|
|
@@ -52,18 +47,6 @@ export declare class Switcher extends React.Component<SwitcherProps, SwitcherSta
|
|
|
52
47
|
static __KONTUR_REACT_UI__: string;
|
|
53
48
|
static displayName: string;
|
|
54
49
|
static defaultProps: DefaultProps;
|
|
55
|
-
static propTypes: {
|
|
56
|
-
error: PropTypes.Requireable<boolean>;
|
|
57
|
-
disabled: PropTypes.Requireable<boolean>;
|
|
58
|
-
items: PropTypes.Validator<NonNullable<NonNullable<(string | null | undefined)[] | (PropTypes.InferProps<{
|
|
59
|
-
label: PropTypes.Requireable<string>;
|
|
60
|
-
value: PropTypes.Requireable<string>;
|
|
61
|
-
}> | null | undefined)[] | null | undefined>>>;
|
|
62
|
-
caption: PropTypes.Requireable<string>;
|
|
63
|
-
value: PropTypes.Requireable<string>;
|
|
64
|
-
onValueChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
65
|
-
renderItem: PropTypes.Requireable<(...args: any[]) => any>;
|
|
66
|
-
};
|
|
67
50
|
state: SwitcherState;
|
|
68
51
|
private theme;
|
|
69
52
|
private setRootNode;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;exports.__esModule = true;exports.SwitcherDataTids = exports.Switcher = void 0;var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
|
|
2
2
|
var _react = _interopRequireDefault(require("react"));
|
|
3
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
4
3
|
|
|
5
4
|
var _identifiers = require("../../lib/events/keyboard/identifiers");
|
|
6
5
|
var _Group = require("../Group");
|
|
@@ -16,6 +15,7 @@ var _Emotion = require("../../lib/theming/Emotion");
|
|
|
16
15
|
var _rootNode = require("../../lib/rootNode");
|
|
17
16
|
|
|
18
17
|
var _ThemeHelpers = require("../../lib/theming/ThemeHelpers");
|
|
18
|
+
var _featureFlagsContext = require("../../lib/featureFlagsContext");
|
|
19
19
|
|
|
20
20
|
var _Switcher2 = require("./Switcher.styles");
|
|
21
21
|
var _switcherTheme = require("./switcherTheme");
|
|
@@ -71,9 +71,6 @@ var SwitcherDataTids = exports.SwitcherDataTids = {
|
|
|
71
71
|
|
|
72
72
|
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
74
|
|
|
78
75
|
|
|
79
76
|
|
|
@@ -92,6 +89,9 @@ Switcher = exports.Switcher = (0, _rootNode.rootNode)(_class = (_Switcher = /*#_
|
|
|
92
89
|
|
|
93
90
|
|
|
94
91
|
|
|
92
|
+
state = {
|
|
93
|
+
focusedIndex: null
|
|
94
|
+
};_this.
|
|
95
95
|
|
|
96
96
|
|
|
97
97
|
|
|
@@ -110,20 +110,6 @@ Switcher = exports.Switcher = (0, _rootNode.rootNode)(_class = (_Switcher = /*#_
|
|
|
110
110
|
|
|
111
111
|
|
|
112
112
|
|
|
113
|
-
state = {
|
|
114
|
-
focusedIndex: null
|
|
115
|
-
};_this.
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
113
|
|
|
128
114
|
|
|
129
115
|
|
|
@@ -241,7 +227,8 @@ Switcher = exports.Switcher = (0, _rootNode.rootNode)(_class = (_Switcher = /*#_
|
|
|
241
227
|
};_this.
|
|
242
228
|
|
|
243
229
|
_renderItems = function () {
|
|
244
|
-
var _this$props2 = _this.props,items = _this$props2.items,value = _this$props2.value,size = _this$props2.size,disabled = _this$props2.disabled,role = _this$props2.role,renderItem = _this$props2.renderItem;
|
|
230
|
+
var _this$props2 = _this.props,items = _this$props2.items,value = _this$props2.value,size = _this$props2.size,width = _this$props2.width,disabled = _this$props2.disabled,role = _this$props2.role,renderItem = _this$props2.renderItem;
|
|
231
|
+
|
|
245
232
|
return items.map(function (item, i) {
|
|
246
233
|
var _this$_extractPropsFr4 =
|
|
247
234
|
|
|
@@ -270,8 +257,11 @@ Switcher = exports.Switcher = (0, _rootNode.rootNode)(_class = (_Switcher = /*#_
|
|
|
270
257
|
customButtonProps);
|
|
271
258
|
|
|
272
259
|
|
|
273
|
-
|
|
260
|
+
if (!buttonProps.width && width) {
|
|
261
|
+
buttonProps.width = '100%';
|
|
262
|
+
}
|
|
274
263
|
|
|
264
|
+
var renderDefault = function renderDefault() {return _this.renderDefaultItem(label, itemValue, buttonProps, ariaLabel);};
|
|
275
265
|
return renderItem ? renderItem(label, itemValue, buttonProps, renderDefault, ariaLabel) : renderDefault();
|
|
276
266
|
});
|
|
277
267
|
};_this.
|
|
@@ -292,4 +282,4 @@ Switcher = exports.Switcher = (0, _rootNode.rootNode)(_class = (_Switcher = /*#_
|
|
|
292
282
|
default:
|
|
293
283
|
return _Switcher2.styles.captionSmall(_this.theme);
|
|
294
284
|
}
|
|
295
|
-
};return _this;}(0, _inheritsLoose2.default)(Switcher, _React$Component);var _proto = Switcher.prototype;_proto.render = function render() {var _this2 = this;return /*#__PURE__*/_react.default.createElement(_ThemeContext.ThemeContext.Consumer, null, function (theme) {_this2.theme = (0, _switcherTheme.getSwitcherTheme)(theme);return /*#__PURE__*/_react.default.createElement(_ThemeContext.ThemeContext.Provider, { value: _this2.theme }, _this2.renderMain());});};_proto.renderMain = function renderMain() {var inputProps = { type: 'checkbox', onKeyDown: this.handleKey, onFocus: this._handleFocus, onBlur: this._handleBlur, className: _Switcher2.styles.input() };var isThemeGTE_5_1 = (0, _ThemeHelpers.isThemeGTE)(this.theme, '5.1');var isTheme_5_0 = !isThemeGTE_5_1;var items = /*#__PURE__*/_react.default.createElement(_Group.Group,
|
|
285
|
+
};return _this;}(0, _inheritsLoose2.default)(Switcher, _React$Component);var _proto = Switcher.prototype;_proto.render = function render() {var _this2 = this;return /*#__PURE__*/_react.default.createElement(_ThemeContext.ThemeContext.Consumer, null, function (theme) {_this2.theme = (0, _switcherTheme.getSwitcherTheme)(theme);return /*#__PURE__*/_react.default.createElement(_ThemeContext.ThemeContext.Provider, { value: _this2.theme }, _this2.renderMain());});};_proto.renderMain = function renderMain() {var _cx, _cx2;var inputProps = { type: 'checkbox', onKeyDown: this.handleKey, onFocus: this._handleFocus, onBlur: this._handleBlur, className: _Switcher2.styles.input() };var isThemeGTE_5_1 = (0, _ThemeHelpers.isThemeGTE)(this.theme, '5.1');var isTheme_5_0 = !isThemeGTE_5_1;var items = /*#__PURE__*/_react.default.createElement(_featureFlagsContext.ReactUIFeatureFlagsContext.Provider, { value: { groupAddHintAndTooltipSupport: true } }, /*#__PURE__*/_react.default.createElement(_Group.Group, { width: '100%' }, this._renderItems()));var captionClassName = (0, _Emotion.cx)(_Switcher2.styles.caption(this.theme), this.getLabelSizeClassName());var wrapperClassName = (0, _Emotion.cx)(_Switcher2.styles.wrap(), (_cx = {}, _cx[_Switcher2.styles.error5_1(this.theme)] = isThemeGTE_5_1 && this.props.error, _cx[_Switcher2.styles.wrapCustomWidth()] = this.props.width !== undefined, _cx));var errorClassName = (0, _Emotion.cx)((_cx2 = {}, _cx2[_Switcher2.styles.error(this.theme)] = isTheme_5_0 && this.props.error, _cx2));return /*#__PURE__*/_react.default.createElement(_CommonWrapper.CommonWrapper, (0, _extends2.default)({ rootNodeRef: this.setRootNode }, this.props), /*#__PURE__*/_react.default.createElement("div", { "data-tid": SwitcherDataTids.root, className: _Switcher2.styles.root(), style: { width: this.props.width } }, this.props.caption ? /*#__PURE__*/_react.default.createElement("div", { className: captionClassName }, this.props.caption) : null, /*#__PURE__*/_react.default.createElement("div", { className: wrapperClassName }, /*#__PURE__*/_react.default.createElement("input", inputProps), isThemeGTE_5_1 ? items : /*#__PURE__*/_react.default.createElement("div", { className: errorClassName }, items))));};return Switcher;}(_react.default.Component), _Switcher.__KONTUR_REACT_UI__ = 'Switcher', _Switcher.displayName = 'Switcher', _Switcher.defaultProps = { role: 'switch' }, _Switcher)) || _class;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_propTypes","_identifiers","_Group","_Button","_ThemeContext","_CommonWrapper","_Emotion","_rootNode","_ThemeHelpers","_Switcher2","_switcherTheme","_helpers","_class","_Switcher","SwitcherDataTids","exports","root","Switcher","rootNode","_React$Component","_this","_len","arguments","length","args","Array","_key","call","apply","concat","state","focusedIndex","selectItem","value","props","onValueChange","_extractPropsFromItem","item","label","_extractValuesFromItems","items","map","_this$_extractPropsFr","_focus","index","setState","handleKey","e","isKeyEnter","_this$_extractPropsFr2","buttonProps","disabled","isKeyArrowHorizontal","preventDefault","move","isKeyArrowLeft","left","selectedIndex","newFocusedIndex","_getNextFocusedIndex","_this$props","i","mod","_this$_extractPropsFr3","_handleFocus","currentIndex","indexOf","_handleBlur","_renderItems","_this$props2","size","role","renderItem","_this$_extractPropsFr4","ariaLabel","itemValue","customButtonProps","isChecked","commonButtonProps","checked","visuallyFocused","onClick","disableFocus","corners","getButtonCorners","_extends2","default","renderDefault","renderDefaultItem","createElement","Button","key","getLabelSizeClassName","styles","captionLarge","theme","captionMedium","captionSmall","_inheritsLoose2","_proto","prototype","render","_this2","ThemeContext","Consumer","getSwitcherTheme","Provider","renderMain","inputProps","type","onKeyDown","onFocus","onBlur","className","input","isThemeGTE_5_1","isThemeGTE","isTheme_5_0","Group","captionClassName","cx","caption","wrapperClassName","wrap","error","error5_1","errorClassName","CommonWrapper","rootNodeRef","setRootNode","React","Component","__KONTUR_REACT_UI__","displayName","defaultProps","propTypes","PropTypes","bool","oneOfType","arrayOf","string","shape","isRequired","func"],"sources":["Switcher.tsx"],"sourcesContent":["import type { HTMLAttributes } from 'react';\nimport React from 'react';\nimport PropTypes from 'prop-types';\n\nimport { isKeyArrowHorizontal, isKeyArrowLeft, isKeyEnter } from '../../lib/events/keyboard/identifiers';\nimport { getButtonCorners, Group } from '../Group';\nimport type { ButtonProps } from '../Button';\nimport { Button } from '../Button';\nimport type { Nullable } from '../../typings/utility-types';\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport type { Theme } from '../../lib/theming/Theme';\nimport type { CommonProps } from '../../internal/CommonWrapper';\nimport { CommonWrapper } from '../../internal/CommonWrapper';\nimport { cx } from '../../lib/theming/Emotion';\nimport type { TSetRootNode } from '../../lib/rootNode';\nimport { rootNode } from '../../lib/rootNode';\nimport type { SizeProp } from '../../lib/types/props';\nimport { isThemeGTE } from '../../lib/theming/ThemeHelpers';\n\nimport { styles } from './Switcher.styles';\nimport { getSwitcherTheme } from './switcherTheme';\nimport { mod } from './helpers';\n\nexport type SwitcherItems = string | SwitcherItem;\n\nexport const SwitcherDataTids = {\n root: 'Switcher__root',\n} as const;\n\nexport interface SwitcherProps extends Pick<HTMLAttributes<unknown>, 'role'>, CommonProps {\n /** Задает список строк или список элементов типа `{ label: string, value: string, buttonProps?: Partial<ButtonProps> }`. */\n items: SwitcherItems[];\n\n /** Устанавливает значение свитчера. */\n value?: string;\n\n /** Задает функцию, которая вызывается при изменении значения свитчера (value). */\n onValueChange?: (value: string) => void;\n\n /** Задает подпись около свитчера. */\n caption?: string;\n\n /** Переводит контрол в состояние валидации \"ошибка\". */\n error?: boolean;\n\n /** Задает размер контрола. */\n size?: SizeProp;\n\n /** Делает компонент недоступным. */\n disabled?: boolean;\n\n /** Задает функцию отрисовки элемента.\n * @param `label` -\n * @param `value` -\n * @param `buttonProps` -\n * @param `renderDefault` -\n * @param `ariaLabel` -\n */\n renderItem?: (\n label: string,\n value: string,\n buttonProps: ButtonProps,\n renderDefault: () => React.ReactNode,\n ariaLabel?: string,\n ) => React.ReactNode;\n}\n\ntype DefaultProps = Required<Pick<SwitcherProps, 'role'>>;\n\nexport interface SwitcherState {\n focusedIndex: Nullable<number>;\n}\n\ninterface SwitcherItem {\n value: string;\n label: string;\n 'aria-label'?: string;\n buttonProps?: Partial<ButtonProps>;\n}\n\n/**\n * Переключатель `Switcher` — это замена RadioGroup.\n *\n * Не используйте переключатель в качестве навигации, для этого лучше подходят Tabs.\n */\n@rootNode\nexport class Switcher extends React.Component<SwitcherProps, SwitcherState> {\n public static __KONTUR_REACT_UI__ = 'Switcher';\n public static displayName = 'Switcher';\n\n public static defaultProps: DefaultProps = {\n role: 'switch',\n };\n\n public static propTypes = {\n error: PropTypes.bool,\n disabled: PropTypes.bool,\n items: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.string),\n PropTypes.arrayOf(\n PropTypes.shape({\n label: PropTypes.string,\n value: PropTypes.string,\n }),\n ),\n ]).isRequired,\n caption: PropTypes.string,\n value: PropTypes.string,\n onValueChange: PropTypes.func,\n renderItem: PropTypes.func,\n };\n\n public state: SwitcherState = {\n focusedIndex: null,\n };\n\n private theme!: Theme;\n private setRootNode!: TSetRootNode;\n\n public render() {\n return (\n <ThemeContext.Consumer>\n {(theme) => {\n this.theme = getSwitcherTheme(theme);\n return <ThemeContext.Provider value={this.theme}>{this.renderMain()}</ThemeContext.Provider>;\n }}\n </ThemeContext.Consumer>\n );\n }\n\n private renderMain() {\n const inputProps = {\n type: 'checkbox',\n onKeyDown: this.handleKey,\n onFocus: this._handleFocus,\n onBlur: this._handleBlur,\n className: styles.input(),\n };\n const isThemeGTE_5_1 = isThemeGTE(this.theme, '5.1');\n const isTheme_5_0 = !isThemeGTE_5_1;\n const items = <Group>{this._renderItems()}</Group>;\n\n const captionClassName = cx(styles.caption(this.theme), this.getLabelSizeClassName());\n const wrapperClassName = cx(styles.wrap(), isThemeGTE_5_1 && this.props.error && styles.error5_1(this.theme));\n const errorClassName = cx(isTheme_5_0 && this.props.error && styles.error(this.theme));\n\n return (\n <CommonWrapper rootNodeRef={this.setRootNode} {...this.props}>\n <div data-tid={SwitcherDataTids.root} className={styles.root()}>\n {this.props.caption ? <div className={captionClassName}>{this.props.caption}</div> : null}\n <div className={wrapperClassName}>\n <input {...inputProps} />\n {isThemeGTE_5_1 ? items : <div className={errorClassName}>{items}</div>}\n </div>\n </div>\n </CommonWrapper>\n );\n }\n\n private selectItem = (value: string) => {\n if (this.props.onValueChange) {\n this.props.onValueChange(value);\n }\n };\n\n private _extractPropsFromItem = (item: string | SwitcherItem): SwitcherItem => {\n return typeof item === 'object' ? item : { label: item, value: item };\n };\n\n private _extractValuesFromItems = (): string[] => {\n return this.props.items.map((item) => {\n const { value } = this._extractPropsFromItem(item);\n return value;\n });\n };\n\n private _focus = (index: number) => {\n this.setState({ focusedIndex: index });\n };\n\n private handleKey = (e: React.KeyboardEvent<HTMLInputElement>) => {\n const focusedIndex = this.state.focusedIndex;\n if (typeof focusedIndex !== 'number') {\n return;\n }\n\n if (isKeyEnter(e)) {\n if (this.props.onValueChange) {\n const { value, buttonProps } = this._extractPropsFromItem(this.props.items[focusedIndex]);\n if (!buttonProps?.disabled) {\n this.selectItem(value);\n }\n }\n return;\n }\n\n if (isKeyArrowHorizontal(e)) {\n e.preventDefault();\n this.move(isKeyArrowLeft(e));\n }\n };\n\n private move = (left: boolean) => {\n const selectedIndex = this.state.focusedIndex;\n\n if (typeof selectedIndex !== 'number') {\n return;\n }\n const newFocusedIndex = this._getNextFocusedIndex(left, selectedIndex);\n this._focus(newFocusedIndex);\n };\n\n private _getNextFocusedIndex = (left: boolean, focusedIndex: number): number => {\n const { items, disabled } = this.props;\n if (disabled) {\n return focusedIndex;\n }\n\n for (let i = 1; i < items.length; i++) {\n const index = mod(focusedIndex + (left ? -i : i), items.length);\n const { buttonProps } = this._extractPropsFromItem(items[index]);\n if (!buttonProps?.disabled) {\n return index;\n }\n }\n return focusedIndex;\n };\n\n private _handleFocus = () => {\n const { value } = this.props;\n\n const items = this._extractValuesFromItems();\n const currentIndex = [...items].indexOf(value as string);\n const index = currentIndex > -1 ? currentIndex : 0;\n\n this.setState({ focusedIndex: index });\n };\n\n private _handleBlur = () => {\n this.setState({ focusedIndex: null });\n };\n\n private _renderItems = () => {\n const { items, value, size, disabled, role, renderItem } = this.props;\n return items.map((item, i) => {\n const {\n 'aria-label': ariaLabel,\n label,\n value: itemValue,\n buttonProps: customButtonProps,\n } = this._extractPropsFromItem(item);\n\n const isChecked = value === itemValue;\n const commonButtonProps = {\n 'aria-checked': isChecked,\n role,\n checked: isChecked,\n visuallyFocused: this.state.focusedIndex === i,\n onClick: () => {\n this.selectItem(itemValue);\n },\n disableFocus: true,\n size,\n disabled,\n corners: getButtonCorners(i === 0, i === items.length - 1),\n };\n\n const buttonProps = {\n ...commonButtonProps,\n ...customButtonProps,\n };\n\n const renderDefault = () => this.renderDefaultItem(label, itemValue, buttonProps, ariaLabel);\n\n return renderItem ? renderItem(label, itemValue, buttonProps, renderDefault, ariaLabel) : renderDefault();\n });\n };\n\n private renderDefaultItem = (label: string, value: string, buttonProps: ButtonProps, ariaLabel?: string) => (\n <Button aria-label={ariaLabel} key={value} {...buttonProps}>\n {label}\n </Button>\n );\n\n private getLabelSizeClassName = (): string => {\n switch (this.props.size) {\n case 'large':\n return styles.captionLarge(this.theme);\n case 'medium':\n return styles.captionMedium(this.theme);\n case 'small':\n default:\n return styles.captionSmall(this.theme);\n }\n };\n}\n"],"mappings":";AACA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;;AAEA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;;AAEA,IAAAI,OAAA,GAAAJ,OAAA;;AAEA,IAAAK,aAAA,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aAAA,UAAKwB,SAAS,EAAES,gBAAiB,iBAC/B7H,MAAA,CAAAyF,OAAA,CAAAG,aAAA,UAAWmB,UAAa,CAAC,EACxBO,cAAc,GAAG3E,KAAK,gBAAG3C,MAAA,CAAAyF,OAAA,CAAAG,aAAA,UAAKwB,SAAS,EAAEa,cAAe,IAAEtF,KAAW,CACnE,CACF,CACQ,CAAC,CAEpB,CAAC,QAAAvB,QAAA,GAvE2BiH,cAAK,CAACC,SAAS,GAAAtH,SAAA,CAC7BuH,mBAAmB,GAAG,UAAU,EAAAvH,SAAA,CAChCwH,WAAW,GAAG,UAAU,EAAAxH,SAAA,CAExByH,YAAY,GAAiB,EACzC/D,IAAI,EAAE,QAAQ,CAChB,CAAC,EAAA1D,SAAA,CAEa0H,SAAS,GAAG,EACxBX,KAAK,EAAEY,kBAAS,CAACC,IAAI,EACrBtF,QAAQ,EAAEqF,kBAAS,CAACC,IAAI,EACxBjG,KAAK,EAAEgG,kBAAS,CAACE,SAAS,CAAC,CACzBF,kBAAS,CAACG,OAAO,CAACH,kBAAS,CAACI,MAAM,CAAC,EACnCJ,kBAAS,CAACG,OAAO,CACfH,kBAAS,CAACK,KAAK,CAAC,EACdvG,KAAK,EAAEkG,kBAAS,CAACI,MAAM,EACvB3G,KAAK,EAAEuG,kBAAS,CAACI,MAAM,CACzB,CAAC,CACH,CAAC,CACF,CAAC,CAACE,UAAU,EACbrB,OAAO,EAAEe,kBAAS,CAACI,MAAM,EACzB3G,KAAK,EAAEuG,kBAAS,CAACI,MAAM,EACvBzG,aAAa,EAAEqG,kBAAS,CAACO,IAAI,EAC7BvE,UAAU,EAAEgE,kBAAS,CAACO,IAAI,CAC5B,CAAC,EAAAlI,SAAA,MAAAD,MAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_identifiers","_Group","_Button","_ThemeContext","_CommonWrapper","_Emotion","_rootNode","_ThemeHelpers","_featureFlagsContext","_Switcher2","_switcherTheme","_helpers","_class","_Switcher","SwitcherDataTids","exports","root","Switcher","rootNode","_React$Component","_this","_len","arguments","length","args","Array","_key","call","apply","concat","state","focusedIndex","selectItem","value","props","onValueChange","_extractPropsFromItem","item","label","_extractValuesFromItems","items","map","_this$_extractPropsFr","_focus","index","setState","handleKey","e","isKeyEnter","_this$_extractPropsFr2","buttonProps","disabled","isKeyArrowHorizontal","preventDefault","move","isKeyArrowLeft","left","selectedIndex","newFocusedIndex","_getNextFocusedIndex","_this$props","i","mod","_this$_extractPropsFr3","_handleFocus","currentIndex","indexOf","_handleBlur","_renderItems","_this$props2","size","width","role","renderItem","_this$_extractPropsFr4","ariaLabel","itemValue","customButtonProps","isChecked","commonButtonProps","checked","visuallyFocused","onClick","disableFocus","corners","getButtonCorners","_extends2","default","renderDefault","renderDefaultItem","createElement","Button","key","getLabelSizeClassName","styles","captionLarge","theme","captionMedium","captionSmall","_inheritsLoose2","_proto","prototype","render","_this2","ThemeContext","Consumer","getSwitcherTheme","Provider","renderMain","_cx","_cx2","inputProps","type","onKeyDown","onFocus","onBlur","className","input","isThemeGTE_5_1","isThemeGTE","isTheme_5_0","ReactUIFeatureFlagsContext","groupAddHintAndTooltipSupport","Group","captionClassName","cx","caption","wrapperClassName","wrap","error5_1","error","wrapCustomWidth","undefined","errorClassName","CommonWrapper","rootNodeRef","setRootNode","style","React","Component","__KONTUR_REACT_UI__","displayName","defaultProps"],"sources":["Switcher.tsx"],"sourcesContent":["import type { HTMLAttributes } from 'react';\nimport React from 'react';\n\nimport { isKeyArrowHorizontal, isKeyArrowLeft, isKeyEnter } from '../../lib/events/keyboard/identifiers';\nimport { getButtonCorners, Group } from '../Group';\nimport type { ButtonProps } from '../Button';\nimport { Button } from '../Button';\nimport type { Nullable } from '../../typings/utility-types';\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport type { Theme } from '../../lib/theming/Theme';\nimport type { CommonProps } from '../../internal/CommonWrapper';\nimport { CommonWrapper } from '../../internal/CommonWrapper';\nimport { cx } from '../../lib/theming/Emotion';\nimport type { TSetRootNode } from '../../lib/rootNode';\nimport { rootNode } from '../../lib/rootNode';\nimport type { SizeProp } from '../../lib/types/props';\nimport { isThemeGTE } from '../../lib/theming/ThemeHelpers';\nimport { ReactUIFeatureFlagsContext } from '../../lib/featureFlagsContext';\n\nimport { styles } from './Switcher.styles';\nimport { getSwitcherTheme } from './switcherTheme';\nimport { mod } from './helpers';\n\nexport type SwitcherItems = string | SwitcherItem;\n\nexport const SwitcherDataTids = {\n root: 'Switcher__root',\n} as const;\n\nexport interface SwitcherProps extends Pick<HTMLAttributes<unknown>, 'role'>, CommonProps {\n /** Задает список элементов в свитчере. Это массив строк или объектов типа `{ label: string, value: string, buttonProps?: Partial<ButtonProps> }` */\n items: SwitcherItems[];\n\n /** Устанавливает значение свитчера. */\n value?: string;\n\n /** Задает функцию, которая вызывается при изменении значения свитчера (value). */\n onValueChange?: (value: string) => void;\n\n /** Задает подпись около свитчера. */\n caption?: string;\n\n /** Переводит контрол в состояние валидации \"ошибка\". */\n error?: boolean;\n\n /** Задает размер контрола. */\n size?: SizeProp;\n\n /** Задает ширину контрола. С этим пропом элементы внутри автоматически равномерно растянутся. */\n width?: React.CSSProperties['width'];\n\n /** Делает компонент недоступным. */\n disabled?: boolean;\n\n /** Задает функцию отрисовки элемента. Параметр `renderDefault` - это встроенная дефолтная функция отрисовки элемента, которую можно вызывать в `renderItem`. */\n renderItem?: (\n label: string,\n value: string,\n buttonProps: ButtonProps,\n renderDefault: () => React.ReactNode,\n ariaLabel?: string,\n ) => React.ReactNode;\n}\n\ntype DefaultProps = Required<Pick<SwitcherProps, 'role'>>;\n\nexport interface SwitcherState {\n focusedIndex: Nullable<number>;\n}\n\ninterface SwitcherItem {\n value: string;\n label: string;\n 'aria-label'?: string;\n buttonProps?: Partial<ButtonProps>;\n}\n\n/**\n * Переключатель `Switcher` — это замена RadioGroup.\n *\n * Не используйте переключатель в качестве навигации, для этого лучше подходят Tabs.\n */\n@rootNode\nexport class Switcher extends React.Component<SwitcherProps, SwitcherState> {\n public static __KONTUR_REACT_UI__ = 'Switcher';\n public static displayName = 'Switcher';\n\n public static defaultProps: DefaultProps = {\n role: 'switch',\n };\n\n public state: SwitcherState = {\n focusedIndex: null,\n };\n\n private theme!: Theme;\n private setRootNode!: TSetRootNode;\n\n public render() {\n return (\n <ThemeContext.Consumer>\n {(theme) => {\n this.theme = getSwitcherTheme(theme);\n return <ThemeContext.Provider value={this.theme}>{this.renderMain()}</ThemeContext.Provider>;\n }}\n </ThemeContext.Consumer>\n );\n }\n\n private renderMain() {\n const inputProps = {\n type: 'checkbox',\n onKeyDown: this.handleKey,\n onFocus: this._handleFocus,\n onBlur: this._handleBlur,\n className: styles.input(),\n };\n const isThemeGTE_5_1 = isThemeGTE(this.theme, '5.1');\n const isTheme_5_0 = !isThemeGTE_5_1;\n const items = (\n <ReactUIFeatureFlagsContext.Provider value={{ groupAddHintAndTooltipSupport: true }}>\n <Group width={'100%'}>{this._renderItems()}</Group>\n </ReactUIFeatureFlagsContext.Provider>\n );\n\n const captionClassName = cx(styles.caption(this.theme), this.getLabelSizeClassName());\n const wrapperClassName = cx(styles.wrap(), {\n [styles.error5_1(this.theme)]: isThemeGTE_5_1 && this.props.error,\n [styles.wrapCustomWidth()]: this.props.width !== undefined,\n });\n const errorClassName = cx({ [styles.error(this.theme)]: isTheme_5_0 && this.props.error });\n\n return (\n <CommonWrapper rootNodeRef={this.setRootNode} {...this.props}>\n <div data-tid={SwitcherDataTids.root} className={styles.root()} style={{ width: this.props.width }}>\n {this.props.caption ? <div className={captionClassName}>{this.props.caption}</div> : null}\n <div className={wrapperClassName}>\n <input {...inputProps} />\n {isThemeGTE_5_1 ? items : <div className={errorClassName}>{items}</div>}\n </div>\n </div>\n </CommonWrapper>\n );\n }\n\n private selectItem = (value: string) => {\n if (this.props.onValueChange) {\n this.props.onValueChange(value);\n }\n };\n\n private _extractPropsFromItem = (item: string | SwitcherItem): SwitcherItem => {\n return typeof item === 'object' ? item : { label: item, value: item };\n };\n\n private _extractValuesFromItems = (): string[] => {\n return this.props.items.map((item) => {\n const { value } = this._extractPropsFromItem(item);\n return value;\n });\n };\n\n private _focus = (index: number) => {\n this.setState({ focusedIndex: index });\n };\n\n private handleKey = (e: React.KeyboardEvent<HTMLInputElement>) => {\n const focusedIndex = this.state.focusedIndex;\n if (typeof focusedIndex !== 'number') {\n return;\n }\n\n if (isKeyEnter(e)) {\n if (this.props.onValueChange) {\n const { value, buttonProps } = this._extractPropsFromItem(this.props.items[focusedIndex]);\n if (!buttonProps?.disabled) {\n this.selectItem(value);\n }\n }\n return;\n }\n\n if (isKeyArrowHorizontal(e)) {\n e.preventDefault();\n this.move(isKeyArrowLeft(e));\n }\n };\n\n private move = (left: boolean) => {\n const selectedIndex = this.state.focusedIndex;\n\n if (typeof selectedIndex !== 'number') {\n return;\n }\n const newFocusedIndex = this._getNextFocusedIndex(left, selectedIndex);\n this._focus(newFocusedIndex);\n };\n\n private _getNextFocusedIndex = (left: boolean, focusedIndex: number): number => {\n const { items, disabled } = this.props;\n if (disabled) {\n return focusedIndex;\n }\n\n for (let i = 1; i < items.length; i++) {\n const index = mod(focusedIndex + (left ? -i : i), items.length);\n const { buttonProps } = this._extractPropsFromItem(items[index]);\n if (!buttonProps?.disabled) {\n return index;\n }\n }\n return focusedIndex;\n };\n\n private _handleFocus = () => {\n const { value } = this.props;\n\n const items = this._extractValuesFromItems();\n const currentIndex = [...items].indexOf(value as string);\n const index = currentIndex > -1 ? currentIndex : 0;\n\n this.setState({ focusedIndex: index });\n };\n\n private _handleBlur = () => {\n this.setState({ focusedIndex: null });\n };\n\n private _renderItems = () => {\n const { items, value, size, width, disabled, role, renderItem } = this.props;\n\n return items.map((item, i) => {\n const {\n 'aria-label': ariaLabel,\n label,\n value: itemValue,\n buttonProps: customButtonProps,\n } = this._extractPropsFromItem(item);\n\n const isChecked = value === itemValue;\n const commonButtonProps = {\n 'aria-checked': isChecked,\n role,\n checked: isChecked,\n visuallyFocused: this.state.focusedIndex === i,\n onClick: () => {\n this.selectItem(itemValue);\n },\n disableFocus: true,\n size,\n disabled,\n corners: getButtonCorners(i === 0, i === items.length - 1),\n };\n\n const buttonProps = {\n ...commonButtonProps,\n ...customButtonProps,\n };\n\n if (!buttonProps.width && width) {\n buttonProps.width = '100%';\n }\n\n const renderDefault = () => this.renderDefaultItem(label, itemValue, buttonProps, ariaLabel);\n return renderItem ? renderItem(label, itemValue, buttonProps, renderDefault, ariaLabel) : renderDefault();\n });\n };\n\n private renderDefaultItem = (label: string, value: string, buttonProps: ButtonProps, ariaLabel?: string) => (\n <Button aria-label={ariaLabel} key={value} {...buttonProps}>\n {label}\n </Button>\n );\n\n private getLabelSizeClassName = (): string => {\n switch (this.props.size) {\n case 'large':\n return styles.captionLarge(this.theme);\n case 'medium':\n return styles.captionMedium(this.theme);\n case 'small':\n default:\n return styles.captionSmall(this.theme);\n }\n };\n}\n"],"mappings":";AACA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;;AAEA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;;AAEA,IAAAG,OAAA,GAAAH,OAAA;;AAEA,IAAAI,aAAA,GAAAJ,OAAA;;;AAGA,IAAAK,cAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;;AAEA,IAAAO,SAAA,GAAAP,OAAA;;AAEA,IAAAQ,aAAA,GAAAR,OAAA;AACA,IAAAS,oBAAA,GAAAT,OAAA;;AAEA,IAAAU,UAAA,GAAAV,OAAA;AACA,IAAAW,cAAA,GAAAX,OAAA;AACA,IAAAY,QAAA,GAAAZ,OAAA,cAAgC,IAAAa,MAAA,EAAAC,SAAA;;;;AAIzB,IAAMC,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAG;EAC9BE,IAAI,EAAE;AACR,CAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDV;AACA;AACA;AACA;AACA,GAJA;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,OAAA,CAAAG,aAAA,UAAK0B,SAAS,EAAEQ,gBAAiB,IAAE,IAAI,CAAC1F,KAAK,CAAC4F,OAAa,CAAC,GAAG,IAAI,eACzFjI,MAAA,CAAA0F,OAAA,CAAAG,aAAA,UAAK0B,SAAS,EAAEW,gBAAiB,iBAC/BlI,MAAA,CAAA0F,OAAA,CAAAG,aAAA,UAAWqB,UAAa,CAAC,EACxBO,cAAc,GAAG9E,KAAK,gBAAG3C,MAAA,CAAA0F,OAAA,CAAAG,aAAA,UAAK0B,SAAS,EAAEiB,cAAe,IAAE7F,KAAW,CACnE,CACF,CACQ,CAAC,CAEpB,CAAC,QAAAvB,QAAA,GA5D2ByH,cAAK,CAACC,SAAS,GAAA9H,SAAA,CAC7B+H,mBAAmB,GAAG,UAAU,EAAA/H,SAAA,CAChCgI,WAAW,GAAG,UAAU,EAAAhI,SAAA,CAExBiI,YAAY,GAAiB,EACzCtE,IAAI,EAAE,QAAQ,CAChB,CAAC,EAAA3D,SAAA,MAAAD,MAAA","ignoreList":[]}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;exports.__esModule = true;exports.styles = void 0;var _taggedTemplateLiteralLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteralLoose"));var _Emotion = require("../../lib/theming/Emotion");var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
|
|
1
|
+
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;exports.__esModule = true;exports.styles = void 0;var _taggedTemplateLiteralLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteralLoose"));var _Emotion = require("../../lib/theming/Emotion");var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
var styles = exports.styles = (0, _Emotion.memoizeStyle)({
|
|
5
5
|
root: function root() {
|
|
6
|
-
return (0, _Emotion.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteralLoose2.default)(["\n line-height: normal;\n "])));
|
|
6
|
+
return (0, _Emotion.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteralLoose2.default)(["\n display: flex;\n align-items: center;\n line-height: normal;\n "])));
|
|
7
|
+
|
|
8
|
+
|
|
7
9
|
|
|
8
10
|
|
|
9
11
|
},
|
|
@@ -13,10 +15,16 @@ var styles = exports.styles = (0, _Emotion.memoizeStyle)({
|
|
|
13
15
|
|
|
14
16
|
|
|
15
17
|
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
wrapCustomWidth: function wrapCustomWidth() {
|
|
21
|
+
return (0, _Emotion.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteralLoose2.default)(["\n flex-grow: 1;\n "])));
|
|
22
|
+
|
|
23
|
+
|
|
16
24
|
},
|
|
17
25
|
|
|
18
26
|
input: function input() {
|
|
19
|
-
return (0, _Emotion.css)(
|
|
27
|
+
return (0, _Emotion.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteralLoose2.default)(["\n height: 0;\n opacity: 0;\n position: absolute;\n width: 0;\n "])));
|
|
20
28
|
|
|
21
29
|
|
|
22
30
|
|
|
@@ -25,7 +33,7 @@ var styles = exports.styles = (0, _Emotion.memoizeStyle)({
|
|
|
25
33
|
},
|
|
26
34
|
|
|
27
35
|
caption: function caption(t) {
|
|
28
|
-
return (0, _Emotion.css)(
|
|
36
|
+
return (0, _Emotion.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteralLoose2.default)(["\n color: ", ";\n vertical-align: middle;\n display: inline-block;\n "])),
|
|
29
37
|
t.switcherTextColor);
|
|
30
38
|
|
|
31
39
|
|
|
@@ -33,7 +41,7 @@ var styles = exports.styles = (0, _Emotion.memoizeStyle)({
|
|
|
33
41
|
},
|
|
34
42
|
|
|
35
43
|
captionSmall: function captionSmall(t) {
|
|
36
|
-
return (0, _Emotion.css)(
|
|
44
|
+
return (0, _Emotion.css)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteralLoose2.default)(["\n margin-right: ", ";\n font-size: ", ";\n line-height: ", ";\n "])),
|
|
37
45
|
t.switcherCaptionGapSmall,
|
|
38
46
|
t.switcherCaptionFontSizeSmall,
|
|
39
47
|
t.switcherCaptionLineHeightSmall);
|
|
@@ -41,7 +49,7 @@ var styles = exports.styles = (0, _Emotion.memoizeStyle)({
|
|
|
41
49
|
},
|
|
42
50
|
|
|
43
51
|
captionMedium: function captionMedium(t) {
|
|
44
|
-
return (0, _Emotion.css)(
|
|
52
|
+
return (0, _Emotion.css)(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteralLoose2.default)(["\n margin-right: ", ";\n font-size: ", ";\n line-height: ", ";\n "])),
|
|
45
53
|
t.switcherCaptionGapMedium,
|
|
46
54
|
t.switcherCaptionFontSizeMedium,
|
|
47
55
|
t.switcherCaptionLineHeightMedium);
|
|
@@ -49,7 +57,7 @@ var styles = exports.styles = (0, _Emotion.memoizeStyle)({
|
|
|
49
57
|
},
|
|
50
58
|
|
|
51
59
|
captionLarge: function captionLarge(t) {
|
|
52
|
-
return (0, _Emotion.css)(
|
|
60
|
+
return (0, _Emotion.css)(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteralLoose2.default)(["\n margin-right: ", ";\n font-size: ", ";\n line-height: ", ";\n "])),
|
|
53
61
|
t.switcherCaptionGapLarge,
|
|
54
62
|
t.switcherCaptionFontSizeLarge,
|
|
55
63
|
t.switcherCaptionLineHeightLarge);
|
|
@@ -59,7 +67,7 @@ var styles = exports.styles = (0, _Emotion.memoizeStyle)({
|
|
|
59
67
|
error: function error(t) {
|
|
60
68
|
var insideWidth = parseInt(t.btnBorderWidth);
|
|
61
69
|
var outsideWidth = parseInt(t.switcherOutlineWidth) - insideWidth + "px";
|
|
62
|
-
return (0, _Emotion.css)(
|
|
70
|
+
return (0, _Emotion.css)(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteralLoose2.default)(["\n border-radius: ", ";\n box-shadow:\n inset 0 0 0 ", "px ", ",\n 0 0 0 ", " ", ";\n "])),
|
|
63
71
|
t.switcherBorderRadius,
|
|
64
72
|
|
|
65
73
|
insideWidth, t.borderColorError,
|
|
@@ -68,7 +76,7 @@ var styles = exports.styles = (0, _Emotion.memoizeStyle)({
|
|
|
68
76
|
},
|
|
69
77
|
|
|
70
78
|
error5_1: function error5_1(t) {
|
|
71
|
-
return (0, _Emotion.css)(
|
|
79
|
+
return (0, _Emotion.css)(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteralLoose2.default)(["\n position: relative;\n\n &:before {\n content: '';\n position: absolute;\n pointer-events: none;\n top: 1px;\n right: 1px;\n bottom: 1px;\n left: 1px;\n z-index: 1;\n border-radius: ", ";\n box-shadow: 0 0 0 ", " ", ";\n }\n "])),
|
|
72
80
|
|
|
73
81
|
|
|
74
82
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_Emotion","require","_templateObject","_templateObject2","_templateObject3","_templateObject4","_templateObject5","_templateObject6","_templateObject7","_templateObject8","_templateObject9","styles","exports","memoizeStyle","root","css","_taggedTemplateLiteralLoose2","default","wrap","input","caption","t","switcherTextColor","captionSmall","switcherCaptionGapSmall","switcherCaptionFontSizeSmall","switcherCaptionLineHeightSmall","captionMedium","switcherCaptionGapMedium","switcherCaptionFontSizeMedium","switcherCaptionLineHeightMedium","captionLarge","switcherCaptionGapLarge","switcherCaptionFontSizeLarge","switcherCaptionLineHeightLarge","error","insideWidth","parseInt","btnBorderWidth","outsideWidth","switcherOutlineWidth","switcherBorderRadius","borderColorError","error5_1"],"sources":["Switcher.styles.ts"],"sourcesContent":["import { css, memoizeStyle } from '../../lib/theming/Emotion';\nimport type { Theme } from '../../lib/theming/Theme';\n\nexport const styles = memoizeStyle({\n root() {\n return css`\n line-height: normal;\n `;\n },\n\n wrap() {\n return css`\n display: inline-block;\n vertical-align: middle;\n `;\n },\n\n input() {\n return css`\n height: 0;\n opacity: 0;\n position: absolute;\n width: 0;\n `;\n },\n\n caption(t: Theme) {\n return css`\n color: ${t.switcherTextColor};\n vertical-align: middle;\n display: inline-block;\n `;\n },\n\n captionSmall(t: Theme) {\n return css`\n margin-right: ${t.switcherCaptionGapSmall};\n font-size: ${t.switcherCaptionFontSizeSmall};\n line-height: ${t.switcherCaptionLineHeightSmall};\n `;\n },\n\n captionMedium(t: Theme) {\n return css`\n margin-right: ${t.switcherCaptionGapMedium};\n font-size: ${t.switcherCaptionFontSizeMedium};\n line-height: ${t.switcherCaptionLineHeightMedium};\n `;\n },\n\n captionLarge(t: Theme) {\n return css`\n margin-right: ${t.switcherCaptionGapLarge};\n font-size: ${t.switcherCaptionFontSizeLarge};\n line-height: ${t.switcherCaptionLineHeightLarge};\n `;\n },\n\n error(t: Theme) {\n const insideWidth = parseInt(t.btnBorderWidth);\n const outsideWidth = `${parseInt(t.switcherOutlineWidth) - insideWidth}px`;\n return css`\n border-radius: ${t.switcherBorderRadius};\n box-shadow:\n inset 0 0 0 ${insideWidth}px ${t.borderColorError},\n 0 0 0 ${outsideWidth} ${t.borderColorError};\n `;\n },\n\n error5_1(t: Theme) {\n return css`\n position: relative;\n\n &:before {\n content: '';\n position: absolute;\n pointer-events: none;\n top: 1px;\n right: 1px;\n bottom: 1px;\n left: 1px;\n z-index: 1;\n border-radius: ${t.switcherBorderRadius};\n box-shadow: 0 0 0 ${t.switcherOutlineWidth} ${t.borderColorError};\n }\n `;\n },\n});\n"],"mappings":"oRAAA,IAAAA,QAAA,GAAAC,OAAA,8BAA8D,IAAAC,eAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA;;;AAGvD,IAAMC,MAAM,GAAAC,OAAA,CAAAD,MAAA,GAAG,IAAAE,qBAAY,EAAC;EACjCC,IAAI,WAAAA,KAAA,EAAG;IACL,WAAOC,YAAG,
|
|
1
|
+
{"version":3,"names":["_Emotion","require","_templateObject","_templateObject2","_templateObject3","_templateObject4","_templateObject5","_templateObject6","_templateObject7","_templateObject8","_templateObject9","_templateObject10","styles","exports","memoizeStyle","root","css","_taggedTemplateLiteralLoose2","default","wrap","wrapCustomWidth","input","caption","t","switcherTextColor","captionSmall","switcherCaptionGapSmall","switcherCaptionFontSizeSmall","switcherCaptionLineHeightSmall","captionMedium","switcherCaptionGapMedium","switcherCaptionFontSizeMedium","switcherCaptionLineHeightMedium","captionLarge","switcherCaptionGapLarge","switcherCaptionFontSizeLarge","switcherCaptionLineHeightLarge","error","insideWidth","parseInt","btnBorderWidth","outsideWidth","switcherOutlineWidth","switcherBorderRadius","borderColorError","error5_1"],"sources":["Switcher.styles.ts"],"sourcesContent":["import { css, memoizeStyle } from '../../lib/theming/Emotion';\nimport type { Theme } from '../../lib/theming/Theme';\n\nexport const styles = memoizeStyle({\n root() {\n return css`\n display: flex;\n align-items: center;\n line-height: normal;\n `;\n },\n\n wrap() {\n return css`\n display: inline-block;\n vertical-align: middle;\n `;\n },\n\n wrapCustomWidth() {\n return css`\n flex-grow: 1;\n `;\n },\n\n input() {\n return css`\n height: 0;\n opacity: 0;\n position: absolute;\n width: 0;\n `;\n },\n\n caption(t: Theme) {\n return css`\n color: ${t.switcherTextColor};\n vertical-align: middle;\n display: inline-block;\n `;\n },\n\n captionSmall(t: Theme) {\n return css`\n margin-right: ${t.switcherCaptionGapSmall};\n font-size: ${t.switcherCaptionFontSizeSmall};\n line-height: ${t.switcherCaptionLineHeightSmall};\n `;\n },\n\n captionMedium(t: Theme) {\n return css`\n margin-right: ${t.switcherCaptionGapMedium};\n font-size: ${t.switcherCaptionFontSizeMedium};\n line-height: ${t.switcherCaptionLineHeightMedium};\n `;\n },\n\n captionLarge(t: Theme) {\n return css`\n margin-right: ${t.switcherCaptionGapLarge};\n font-size: ${t.switcherCaptionFontSizeLarge};\n line-height: ${t.switcherCaptionLineHeightLarge};\n `;\n },\n\n error(t: Theme) {\n const insideWidth = parseInt(t.btnBorderWidth);\n const outsideWidth = `${parseInt(t.switcherOutlineWidth) - insideWidth}px`;\n return css`\n border-radius: ${t.switcherBorderRadius};\n box-shadow:\n inset 0 0 0 ${insideWidth}px ${t.borderColorError},\n 0 0 0 ${outsideWidth} ${t.borderColorError};\n `;\n },\n\n error5_1(t: Theme) {\n return css`\n position: relative;\n\n &:before {\n content: '';\n position: absolute;\n pointer-events: none;\n top: 1px;\n right: 1px;\n bottom: 1px;\n left: 1px;\n z-index: 1;\n border-radius: ${t.switcherBorderRadius};\n box-shadow: 0 0 0 ${t.switcherOutlineWidth} ${t.borderColorError};\n }\n `;\n },\n});\n"],"mappings":"oRAAA,IAAAA,QAAA,GAAAC,OAAA,8BAA8D,IAAAC,eAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,iBAAA;;;AAGvD,IAAMC,MAAM,GAAAC,OAAA,CAAAD,MAAA,GAAG,IAAAE,qBAAY,EAAC;EACjCC,IAAI,WAAAA,KAAA,EAAG;IACL,WAAOC,YAAG,EAAAd,eAAA,KAAAA,eAAA,OAAAe,4BAAA,CAAAC,OAAA;;;;;EAKZ,CAAC;;EAEDC,IAAI,WAAAA,KAAA,EAAG;IACL,WAAOH,YAAG,EAAAb,gBAAA,KAAAA,gBAAA,OAAAc,4BAAA,CAAAC,OAAA;;;;EAIZ,CAAC;;EAEDE,eAAe,WAAAA,gBAAA,EAAG;IAChB,WAAOJ,YAAG,EAAAZ,gBAAA,KAAAA,gBAAA,OAAAa,4BAAA,CAAAC,OAAA;;;EAGZ,CAAC;;EAEDG,KAAK,WAAAA,MAAA,EAAG;IACN,WAAOL,YAAG,EAAAX,gBAAA,KAAAA,gBAAA,OAAAY,4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BAAgB;;EAEhD,CAAC;;EAEDC,QAAQ,WAAAA,SAACtB,CAAQ,EAAE;IACjB,WAAOP,YAAG,EAAAL,iBAAA,KAAAA,iBAAA,OAAAM,4BAAA,CAAAC,OAAA;;;;;;;;;;;;IAYWK,CAAC,CAACoB,oBAAoB;IACnBpB,CAAC,CAACmB,oBAAoB,EAAInB,CAAC,CAACqB,gBAAgB;;;EAGtE;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { AriaAttributes, ReactNode } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
3
|
import type { Override } from '../../typings/utility-types';
|
|
5
4
|
import type { CommonProps } from '../../internal/CommonWrapper';
|
|
6
5
|
import type { SizeProp } from '../../lib/types/props';
|
|
7
|
-
|
|
6
|
+
import type { InputAlign } from '../Input';
|
|
7
|
+
export declare const DEFAULT_WIDTH = 250;
|
|
8
|
+
export interface TextareaProps extends Pick<AriaAttributes, 'aria-controls' | 'aria-label'>, CommonProps, Override<React.TextareaHTMLAttributes<HTMLTextAreaElement>, {
|
|
8
9
|
/** Переводит контрол в состояние валидации "ошибка". */
|
|
9
10
|
error?: boolean;
|
|
10
11
|
/** Переводит контрол в состояние валидации "предупреждение". */
|
|
@@ -46,6 +47,8 @@ export interface TextareaProps extends Pick<AriaAttributes, 'aria-label'>, Commo
|
|
|
46
47
|
extraRow?: boolean;
|
|
47
48
|
/** Отключает анимацию при авто-ресайзе. Автоматически отключается когда в `extraRow` передан `false`. */
|
|
48
49
|
disableAnimations?: boolean;
|
|
50
|
+
/** Выравнивание текста */
|
|
51
|
+
align?: InputAlign;
|
|
49
52
|
}> {
|
|
50
53
|
}
|
|
51
54
|
export interface TextareaState {
|
|
@@ -67,50 +70,8 @@ type DefaultProps = Required<Pick<TextareaProps, 'rows' | 'maxRows' | 'extraRow'
|
|
|
67
70
|
export declare class Textarea extends React.Component<TextareaProps, TextareaState> {
|
|
68
71
|
static __KONTUR_REACT_UI__: string;
|
|
69
72
|
static displayName: string;
|
|
70
|
-
static propTypes: {
|
|
71
|
-
error: PropTypes.Requireable<boolean>;
|
|
72
|
-
warning: PropTypes.Requireable<boolean>;
|
|
73
|
-
disabled: PropTypes.Requireable<boolean>;
|
|
74
|
-
autoResize: PropTypes.Requireable<boolean>;
|
|
75
|
-
extraRow: PropTypes.Requireable<boolean>;
|
|
76
|
-
disableAnimations: PropTypes.Requireable<boolean>;
|
|
77
|
-
maxRows: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
78
|
-
resize: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
79
|
-
width: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
80
|
-
id: PropTypes.Requireable<string>;
|
|
81
|
-
name: PropTypes.Requireable<string>;
|
|
82
|
-
title: PropTypes.Requireable<string>;
|
|
83
|
-
spellCheck: PropTypes.Requireable<boolean>;
|
|
84
|
-
role: PropTypes.Requireable<string>;
|
|
85
|
-
maxLength: PropTypes.Requireable<number>;
|
|
86
|
-
tabIndex: PropTypes.Requireable<number>;
|
|
87
|
-
rows: PropTypes.Requireable<number>;
|
|
88
|
-
placeholder: PropTypes.Requireable<string>;
|
|
89
|
-
value: PropTypes.Requireable<string>;
|
|
90
|
-
defaultValue: PropTypes.Requireable<string>;
|
|
91
|
-
onValueChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
92
|
-
onMouseEnter: PropTypes.Requireable<(...args: any[]) => any>;
|
|
93
|
-
onMouseLeave: PropTypes.Requireable<(...args: any[]) => any>;
|
|
94
|
-
onMouseOver: PropTypes.Requireable<(...args: any[]) => any>;
|
|
95
|
-
onMouseMove: PropTypes.Requireable<(...args: any[]) => any>;
|
|
96
|
-
onMouseOut: PropTypes.Requireable<(...args: any[]) => any>;
|
|
97
|
-
onMouseUp: PropTypes.Requireable<(...args: any[]) => any>;
|
|
98
|
-
onMouseDown: PropTypes.Requireable<(...args: any[]) => any>;
|
|
99
|
-
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
100
|
-
onDoubleClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
101
|
-
onKeyDown: PropTypes.Requireable<(...args: any[]) => any>;
|
|
102
|
-
onKeyPress: PropTypes.Requireable<(...args: any[]) => any>;
|
|
103
|
-
onKeyUp: PropTypes.Requireable<(...args: any[]) => any>;
|
|
104
|
-
onInput: PropTypes.Requireable<(...args: any[]) => any>;
|
|
105
|
-
onFocus: PropTypes.Requireable<(...args: any[]) => any>;
|
|
106
|
-
onBlur: PropTypes.Requireable<(...args: any[]) => any>;
|
|
107
|
-
onScroll: PropTypes.Requireable<(...args: any[]) => any>;
|
|
108
|
-
onWheel: PropTypes.Requireable<(...args: any[]) => any>;
|
|
109
|
-
onCut: PropTypes.Requireable<(...args: any[]) => any>;
|
|
110
|
-
onPaste: PropTypes.Requireable<(...args: any[]) => any>;
|
|
111
|
-
onCopy: PropTypes.Requireable<(...args: any[]) => any>;
|
|
112
|
-
};
|
|
113
73
|
static defaultProps: DefaultProps;
|
|
74
|
+
clear: () => void;
|
|
114
75
|
private getProps;
|
|
115
76
|
private getRootSizeClassName;
|
|
116
77
|
private getTextareaSizeClassName;
|