@skbkontur/react-ui 5.0.12 → 5.1.0-next.1
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/cjs/components/Autocomplete/Autocomplete.d.ts +16 -17
- package/cjs/components/Autocomplete/Autocomplete.js +13 -2
- package/cjs/components/Autocomplete/Autocomplete.js.map +1 -1
- package/cjs/components/Autocomplete/Autocomplete.md +9 -7
- package/cjs/components/Autocomplete/__docs__/Autocomplete.mdx +26 -0
- package/cjs/components/Autocomplete/locale/types.js +1 -1
- package/cjs/components/Button/Button.d.ts +20 -62
- package/cjs/components/Button/Button.js +0 -42
- package/cjs/components/Button/Button.js.map +1 -1
- package/cjs/components/Button/Button.md +40 -26
- package/cjs/components/Button/__docs__/Button.mdx +28 -0
- package/cjs/components/Calendar/Calendar.d.ts +22 -45
- package/cjs/components/Calendar/Calendar.js +1 -15
- package/cjs/components/Calendar/Calendar.js.map +1 -1
- package/cjs/components/Calendar/Calendar.md +12 -12
- package/cjs/components/Calendar/CalendarDay.d.ts +7 -0
- package/cjs/components/Calendar/CalendarDay.js +11 -0
- package/cjs/components/Calendar/CalendarDay.js.map +1 -1
- package/cjs/components/Calendar/CalendarDay.md +32 -32
- package/cjs/components/Calendar/__docs__/Calendar.mdx +28 -0
- package/cjs/components/Calendar/__docs__/CalendarDay.mdx +24 -0
- package/cjs/components/Calendar/locale/types.js +1 -1
- package/cjs/components/Center/Center.d.ts +4 -6
- package/cjs/components/Center/Center.js +3 -5
- package/cjs/components/Center/Center.js.map +1 -1
- package/cjs/components/Center/Center.md +1 -1
- package/cjs/components/Center/__docs__/Center.mdx +24 -0
- package/cjs/components/Checkbox/Checkbox.d.ts +20 -28
- package/cjs/components/Checkbox/Checkbox.js +7 -6
- package/cjs/components/Checkbox/Checkbox.js.map +1 -1
- package/cjs/components/Checkbox/Checkbox.md +6 -5
- package/cjs/components/Checkbox/__docs__/Checkbox.mdx +28 -0
- package/cjs/components/ComboBox/ComboBox.d.ts +67 -86
- package/cjs/components/ComboBox/ComboBox.js +12 -28
- package/cjs/components/ComboBox/ComboBox.js.map +1 -1
- package/cjs/components/ComboBox/ComboBox.md +41 -40
- package/cjs/components/ComboBox/__docs__/ComboBox.mdx +28 -0
- package/cjs/components/CurrencyInput/CurrencyHelper.d.ts +4 -0
- package/cjs/components/CurrencyInput/CurrencyHelper.js +7 -0
- package/cjs/components/CurrencyInput/CurrencyHelper.js.map +1 -1
- package/cjs/components/CurrencyInput/CurrencyInput.d.ts +12 -12
- package/cjs/components/CurrencyInput/CurrencyInput.js +8 -2
- package/cjs/components/CurrencyInput/CurrencyInput.js.map +1 -1
- package/cjs/components/CurrencyInput/CurrencyInput.md +3 -1
- package/cjs/components/CurrencyInput/CurrencyInputHelper.d.ts +3 -0
- package/cjs/components/CurrencyInput/CurrencyInputHelper.js +5 -0
- package/cjs/components/CurrencyInput/CurrencyInputHelper.js.map +1 -1
- package/cjs/components/CurrencyInput/__docs__/CurrencyInput.mdx +28 -0
- package/cjs/components/CurrencyLabel/CurrencyLabel.d.ts +8 -5
- package/cjs/components/CurrencyLabel/CurrencyLabel.js +6 -0
- package/cjs/components/CurrencyLabel/CurrencyLabel.js.map +1 -1
- package/cjs/components/CurrencyLabel/CurrencyLabel.md +5 -5
- package/cjs/components/CurrencyLabel/__docs__/CurrencyLabel.mdx +24 -0
- package/cjs/components/DateInput/DateInput.d.ts +21 -29
- package/cjs/components/DateInput/DateInput.js +14 -2
- package/cjs/components/DateInput/DateInput.js.map +1 -1
- package/cjs/components/DateInput/DateInput.md +7 -2
- package/cjs/components/DateInput/__docs__/DateInput.mdx +26 -0
- package/cjs/components/DateInput/helpers/DateInputKeyboardActions.js +1 -1
- package/cjs/components/DateInput/helpers/DateInputKeyboardActions.js.map +1 -1
- package/cjs/components/DatePicker/DatePicker.d.ts +33 -23
- package/cjs/components/DatePicker/DatePicker.js +53 -4
- package/cjs/components/DatePicker/DatePicker.js.map +1 -1
- package/cjs/components/DatePicker/DatePicker.md +2 -2
- package/cjs/components/DatePicker/__docs__/DatePicker.mdx +28 -0
- package/cjs/components/DatePicker/locale/types.js +1 -1
- package/cjs/components/Dropdown/Dropdown.d.ts +25 -30
- package/cjs/components/Dropdown/Dropdown.js +8 -1
- package/cjs/components/Dropdown/Dropdown.js.map +1 -1
- package/cjs/components/Dropdown/Dropdown.md +2 -1
- package/cjs/components/Dropdown/__docs__/Dropdown.mdx +28 -0
- package/cjs/components/DropdownMenu/DropdownMenu.d.ts +1 -1
- package/cjs/components/DropdownMenu/DropdownMenu.js +1 -1
- package/cjs/components/DropdownMenu/DropdownMenu.js.map +1 -1
- package/cjs/components/DropdownMenu/DropdownMenu.md +12 -10
- package/cjs/components/DropdownMenu/__docs__/DropdownMenu.mdx +28 -0
- package/cjs/components/FileUploader/FileUploader.d.ts +16 -20
- package/cjs/components/FileUploader/FileUploader.js +5 -3
- package/cjs/components/FileUploader/FileUploader.js.map +1 -1
- package/cjs/components/FileUploader/FileUploader.md +9 -9
- package/cjs/components/FileUploader/__docs__/FileUploader.mdx +28 -0
- package/cjs/components/FileUploader/locale/types.js +1 -1
- package/cjs/components/FxInput/FxInput.d.ts +15 -9
- package/cjs/components/FxInput/FxInput.js +14 -1
- package/cjs/components/FxInput/FxInput.js.map +1 -1
- package/cjs/components/FxInput/FxInput.md +2 -0
- package/cjs/components/FxInput/__docs__/FxInput.mdx +28 -0
- package/cjs/components/Gapped/Gapped.d.ts +6 -17
- package/cjs/components/Gapped/Gapped.js +1 -8
- package/cjs/components/Gapped/Gapped.js.map +1 -1
- package/cjs/components/Gapped/Gapped.md +3 -2
- package/cjs/components/Gapped/__docs__/Gapped.mdx +24 -0
- package/cjs/components/GlobalLoader/GlobalLoader.d.ts +22 -32
- package/cjs/components/GlobalLoader/GlobalLoader.js +14 -14
- package/cjs/components/GlobalLoader/GlobalLoader.js.map +1 -1
- package/cjs/components/GlobalLoader/GlobalLoader.md +4 -5
- package/cjs/components/GlobalLoader/GlobalLoaderView.d.ts +4 -0
- package/cjs/components/GlobalLoader/GlobalLoaderView.js +7 -0
- package/cjs/components/GlobalLoader/GlobalLoaderView.js.map +1 -1
- package/cjs/components/GlobalLoader/__docs__/GlobalLoader.mdx +28 -0
- package/cjs/components/Group/Group.d.ts +6 -0
- package/cjs/components/Group/Group.js +7 -1
- package/cjs/components/Group/Group.js.map +1 -1
- package/cjs/components/Group/Group.md +1 -0
- package/cjs/components/Group/__docs__/Group.mdx +24 -0
- package/cjs/components/Hint/Hint.d.ts +18 -40
- package/cjs/components/Hint/Hint.js +4 -16
- package/cjs/components/Hint/Hint.js.map +1 -1
- package/cjs/components/Hint/Hint.md +9 -8
- package/cjs/components/Hint/__docs__/Hint.mdx +29 -0
- package/cjs/components/Input/Input.d.ts +46 -68
- package/cjs/components/Input/Input.js +10 -9
- package/cjs/components/Input/Input.js.map +1 -1
- package/cjs/components/Input/Input.md +11 -2
- package/cjs/components/Input/Input.typings.js +1 -1
- package/cjs/components/Input/__docs__/Input.mdx +28 -0
- package/cjs/components/Kebab/Kebab.d.ts +12 -16
- package/cjs/components/Kebab/Kebab.js +4 -2
- package/cjs/components/Kebab/Kebab.js.map +1 -1
- package/cjs/components/Kebab/Kebab.md +9 -9
- package/cjs/components/Kebab/__docs__/Kebab.mdx +28 -0
- package/cjs/components/Link/Link.d.ts +13 -37
- package/cjs/components/Link/Link.js +0 -13
- package/cjs/components/Link/Link.js.map +1 -1
- package/cjs/components/Link/Link.md +12 -11
- package/cjs/components/Link/__docs__/Link.mdx +28 -0
- package/cjs/components/Loader/Loader.d.ts +13 -25
- package/cjs/components/Loader/Loader.js +2 -8
- package/cjs/components/Loader/Loader.js.map +1 -1
- package/cjs/components/Loader/Loader.md +1 -0
- package/cjs/components/Loader/__docs__/Loader.mdx +26 -0
- package/cjs/components/MaskedInput/MaskedInput.d.ts +13 -33
- package/cjs/components/MaskedInput/MaskedInput.js +0 -13
- package/cjs/components/MaskedInput/MaskedInput.js.map +1 -1
- package/cjs/components/MaskedInput/MaskedInput.md +7 -5
- package/cjs/components/MaskedInput/__docs__/MaskedInput.mdx +28 -0
- package/cjs/components/MenuFooter/MenuFooter.d.ts +6 -4
- package/cjs/components/MenuFooter/MenuFooter.js +7 -3
- package/cjs/components/MenuFooter/MenuFooter.js.map +1 -1
- package/cjs/components/MenuFooter/MenuFooter.md +2 -2
- package/cjs/components/MenuFooter/__docs__/MenuFooter.mdx +24 -0
- package/cjs/components/MenuHeader/MenuHeader.d.ts +6 -4
- package/cjs/components/MenuHeader/MenuHeader.js +7 -3
- package/cjs/components/MenuHeader/MenuHeader.js.map +1 -1
- package/cjs/components/MenuHeader/MenuHeader.md +2 -2
- package/cjs/components/MenuHeader/__docs__/MenuHeader.mdx +24 -0
- package/cjs/components/MenuItem/MenuItem.d.ts +22 -55
- package/cjs/components/MenuItem/MenuItem.js +1 -18
- package/cjs/components/MenuItem/MenuItem.js.map +1 -1
- package/cjs/components/MenuItem/MenuItem.md +34 -30
- package/cjs/components/MenuItem/__docs__/MenuItem.mdx +24 -0
- package/cjs/components/MenuSeparator/MenuSeparator.d.ts +2 -2
- package/cjs/components/MenuSeparator/MenuSeparator.js +3 -2
- package/cjs/components/MenuSeparator/MenuSeparator.js.map +1 -1
- package/cjs/components/MenuSeparator/MenuSeparator.md +1 -1
- package/cjs/components/MenuSeparator/__docs__/MenuSeparator.mdx +24 -0
- package/cjs/components/MiniModal/MiniModal.d.ts +6 -0
- package/cjs/components/MiniModal/MiniModal.js +6 -0
- package/cjs/components/MiniModal/MiniModal.js.map +1 -1
- package/cjs/components/MiniModal/MiniModal.md +1 -3
- package/cjs/components/MiniModal/MiniModalFooter.d.ts +2 -7
- package/cjs/components/MiniModal/MiniModalFooter.js +0 -5
- package/cjs/components/MiniModal/MiniModalFooter.js.map +1 -1
- package/cjs/components/MiniModal/MiniModalHeader.d.ts +2 -5
- package/cjs/components/MiniModal/MiniModalHeader.js +0 -3
- package/cjs/components/MiniModal/MiniModalHeader.js.map +1 -1
- package/cjs/components/MiniModal/__docs__/MiniModal.mdx +28 -0
- package/cjs/components/MiniModal/__docs__/MiniModalBody.mdx +17 -0
- package/cjs/components/MiniModal/__docs__/MiniModalFooter.mdx +17 -0
- package/cjs/components/MiniModal/__docs__/MiniModalHeader.mdx +18 -0
- package/cjs/components/MiniModal/__docs__/MiniModalIndent.mdx +11 -0
- package/cjs/components/MiniModal/getMiniModalTheme.d.ts +1 -1
- package/cjs/components/Modal/Modal.d.ts +12 -33
- package/cjs/components/Modal/Modal.js +4 -24
- package/cjs/components/Modal/Modal.js.map +1 -1
- package/cjs/components/Modal/Modal.md +3 -1
- package/cjs/components/Modal/Modal.styles.d.ts +4 -1
- package/cjs/components/Modal/Modal.styles.js +68 -31
- package/cjs/components/Modal/Modal.styles.js.map +1 -1
- package/cjs/components/Modal/ModalBody.d.ts +2 -4
- package/cjs/components/Modal/ModalBody.js +1 -3
- package/cjs/components/Modal/ModalBody.js.map +1 -1
- package/cjs/components/Modal/ModalClose.js +7 -2
- package/cjs/components/Modal/ModalClose.js.map +1 -1
- package/cjs/components/Modal/ModalContext.d.ts +2 -0
- package/cjs/components/Modal/ModalContext.js +3 -0
- package/cjs/components/Modal/ModalContext.js.map +1 -1
- package/cjs/components/Modal/ModalFooter.d.ts +5 -15
- package/cjs/components/Modal/ModalFooter.js +0 -7
- package/cjs/components/Modal/ModalFooter.js.map +1 -1
- package/cjs/components/Modal/ModalHeader.d.ts +3 -1
- package/cjs/components/Modal/ModalHeader.js +4 -1
- package/cjs/components/Modal/ModalHeader.js.map +1 -1
- package/cjs/components/Modal/ModalSeparator.d.ts +1 -0
- package/cjs/components/Modal/ModalSeparator.js +1 -0
- package/cjs/components/Modal/ModalSeparator.js.map +1 -1
- package/cjs/components/Modal/__creevey__/Modal.creevey.mts +15 -1
- package/cjs/components/Modal/__docs__/Modal.mdx +28 -0
- package/cjs/components/Modal/__docs__/ModalBody.mdx +15 -0
- package/cjs/components/Modal/__docs__/ModalFooter.mdx +15 -0
- package/cjs/components/Modal/__docs__/ModalHeader.mdx +15 -0
- package/cjs/components/Modal/__docs__/ModalSeparator.mdx +15 -0
- package/cjs/components/Modal/locale/types.js +1 -1
- package/cjs/components/Paging/Paging.d.ts +20 -15
- package/cjs/components/Paging/Paging.js +17 -1
- package/cjs/components/Paging/Paging.js.map +1 -1
- package/cjs/components/Paging/Paging.md +3 -2
- package/cjs/components/Paging/PagingDefaultComponent.d.ts +2 -0
- package/cjs/components/Paging/PagingDefaultComponent.js +3 -0
- package/cjs/components/Paging/PagingDefaultComponent.js.map +1 -1
- package/cjs/components/Paging/__docs__/Paging.mdx +28 -0
- package/cjs/components/Paging/locale/types.js +1 -1
- package/cjs/components/PasswordInput/PasswordInput.d.ts +10 -3
- package/cjs/components/PasswordInput/PasswordInput.js +35 -9
- package/cjs/components/PasswordInput/PasswordInput.js.map +1 -1
- package/cjs/components/PasswordInput/PasswordInput.md +3 -2
- package/cjs/components/PasswordInput/__docs__/PasswordInput.mdx +28 -0
- package/cjs/components/PasswordInput/locale/types.js +1 -1
- package/cjs/components/Radio/Radio.d.ts +13 -28
- package/cjs/components/Radio/Radio.js +1 -8
- package/cjs/components/Radio/Radio.js.map +1 -1
- package/cjs/components/Radio/Radio.md +3 -2
- package/cjs/components/Radio/__docs__/Radio.mdx +28 -0
- package/cjs/components/RadioGroup/RadioGroup.d.ts +28 -54
- package/cjs/components/RadioGroup/RadioGroup.js +4 -15
- package/cjs/components/RadioGroup/RadioGroup.js.map +1 -1
- package/cjs/components/RadioGroup/RadioGroup.md +1 -0
- package/cjs/components/RadioGroup/__docs__/RadioGroup.mdx +28 -0
- package/cjs/components/ResponsiveLayout/ResponsiveLayout.d.ts +4 -1
- package/cjs/components/ResponsiveLayout/ResponsiveLayout.js +6 -2
- package/cjs/components/ResponsiveLayout/ResponsiveLayout.js.map +1 -1
- package/cjs/components/ResponsiveLayout/ResponsiveLayout.md +4 -3
- package/cjs/components/ResponsiveLayout/__docs__/ResponsiveLayout.mdx +97 -0
- package/cjs/components/ResponsiveLayout/types.js +1 -1
- package/cjs/components/ScrollContainer/ScrollBar.d.ts +7 -0
- package/cjs/components/ScrollContainer/ScrollBar.js +13 -0
- package/cjs/components/ScrollContainer/ScrollBar.js.map +1 -1
- package/cjs/components/ScrollContainer/ScrollContainer.d.ts +23 -29
- package/cjs/components/ScrollContainer/ScrollContainer.js +8 -1
- package/cjs/components/ScrollContainer/ScrollContainer.js.map +1 -1
- package/cjs/components/ScrollContainer/ScrollContainer.md +5 -3
- package/cjs/components/ScrollContainer/__docs__/ScrollContainer.mdx +24 -0
- package/cjs/components/Select/Item.d.ts +2 -0
- package/cjs/components/Select/Item.js +3 -0
- package/cjs/components/Select/Item.js.map +1 -1
- package/cjs/components/Select/Select.d.ts +54 -38
- package/cjs/components/Select/Select.js +57 -1
- package/cjs/components/Select/Select.js.map +1 -1
- package/cjs/components/Select/Select.md +7 -6
- package/cjs/components/Select/__docs__/Select.mdx +28 -0
- package/cjs/components/Select/locale/types.js +1 -1
- package/cjs/components/SidePage/SidePage.d.ts +17 -38
- package/cjs/components/SidePage/SidePage.js +15 -28
- package/cjs/components/SidePage/SidePage.js.map +1 -1
- package/cjs/components/SidePage/SidePage.md +2 -1
- package/cjs/components/SidePage/SidePage.styles.d.ts +8 -1
- package/cjs/components/SidePage/SidePage.styles.js +83 -26
- package/cjs/components/SidePage/SidePage.styles.js.map +1 -1
- package/cjs/components/SidePage/SidePageCloseButton.d.ts +6 -1
- package/cjs/components/SidePage/SidePageCloseButton.js +14 -2
- package/cjs/components/SidePage/SidePageCloseButton.js.map +1 -1
- package/cjs/components/SidePage/SidePageFooter.d.ts +4 -9
- package/cjs/components/SidePage/SidePageFooter.js +0 -2
- package/cjs/components/SidePage/SidePageFooter.js.map +1 -1
- package/cjs/components/SidePage/SidePageHeader.d.ts +2 -1
- package/cjs/components/SidePage/SidePageHeader.js +14 -7
- package/cjs/components/SidePage/SidePageHeader.js.map +1 -1
- package/cjs/components/SidePage/__creevey__/SidePage.creevey.mts +103 -1
- package/cjs/components/SidePage/__docs__/SidePage.mdx +28 -0
- package/cjs/components/SidePage/__docs__/SidePageBody.mdx +15 -0
- package/cjs/components/SidePage/__docs__/SidePageContainer.mdx +15 -0
- package/cjs/components/SidePage/__docs__/SidePageFooter.mdx +15 -0
- package/cjs/components/SidePage/__docs__/SidePageHeader.mdx +15 -0
- package/cjs/components/SidePage/locale/types.js +1 -1
- package/cjs/components/SingleToast/SingleToast.d.ts +5 -1
- package/cjs/components/SingleToast/SingleToast.js +5 -1
- package/cjs/components/SingleToast/SingleToast.js.map +1 -1
- package/cjs/components/SingleToast/SingleToast.md +2 -1
- package/cjs/components/SingleToast/__docs__/SingleToast.mdx +28 -0
- package/cjs/components/Spinner/Spinner.d.ts +15 -20
- package/cjs/components/Spinner/Spinner.js +6 -7
- package/cjs/components/Spinner/Spinner.js.map +1 -1
- package/cjs/components/Spinner/Spinner.md +2 -1
- package/cjs/components/Spinner/__docs__/Spinner.mdx +28 -0
- package/cjs/components/Sticky/Sticky.d.ts +9 -4
- package/cjs/components/Sticky/Sticky.js +9 -1
- package/cjs/components/Sticky/Sticky.js.map +1 -1
- package/cjs/components/Sticky/Sticky.md +1 -0
- package/cjs/components/Sticky/__docs__/Sticky.mdx +24 -0
- package/cjs/components/Switcher/Switcher.d.ts +18 -7
- package/cjs/components/Switcher/Switcher.js +14 -3
- package/cjs/components/Switcher/Switcher.js.map +1 -1
- package/cjs/components/Switcher/Switcher.md +6 -2
- package/cjs/components/Switcher/Switcher.styles.d.ts +1 -0
- package/cjs/components/Switcher/Switcher.styles.js +20 -1
- package/cjs/components/Switcher/Switcher.styles.js.map +1 -1
- package/cjs/components/Switcher/__docs__/Switcher.mdx +28 -0
- package/cjs/components/Tabs/Tab.d.ts +12 -31
- package/cjs/components/Tabs/Tab.js +1 -20
- package/cjs/components/Tabs/Tab.js.map +1 -1
- package/cjs/components/Tabs/Tab.md +2 -0
- package/cjs/components/Tabs/Tabs.d.ts +14 -25
- package/cjs/components/Tabs/Tabs.js +6 -17
- package/cjs/components/Tabs/Tabs.js.map +1 -1
- package/cjs/components/Tabs/Tabs.md +3 -2
- package/cjs/components/Tabs/__docs__/Tab.mdx +28 -0
- package/cjs/components/Tabs/__docs__/Tabs.mdx +28 -0
- package/cjs/components/Textarea/Textarea.d.ts +26 -52
- package/cjs/components/Textarea/Textarea.js +3 -23
- package/cjs/components/Textarea/Textarea.js.map +1 -1
- package/cjs/components/Textarea/Textarea.md +4 -2
- package/cjs/components/Textarea/__docs__/Textarea.mdx +28 -0
- package/cjs/components/Toast/Toast.d.ts +12 -9
- package/cjs/components/Toast/Toast.js +13 -5
- package/cjs/components/Toast/Toast.js.map +1 -1
- package/cjs/components/Toast/Toast.md +4 -4
- package/cjs/components/Toast/ToastStatic.d.ts +2 -2
- package/cjs/components/Toast/ToastStatic.js +15 -5
- package/cjs/components/Toast/ToastStatic.js.map +1 -1
- package/cjs/components/Toast/ToastView.d.ts +3 -6
- package/cjs/components/Toast/ToastView.js +3 -5
- package/cjs/components/Toast/ToastView.js.map +1 -1
- package/cjs/components/Toast/ToastView.styles.js +4 -4
- package/cjs/components/Toast/ToastView.styles.js.map +1 -1
- package/cjs/components/Toast/__creevey__/Toast.creevey.mts +23 -0
- package/cjs/components/Toast/__docs__/Toast.mdx +28 -0
- package/cjs/components/Toast/locale/types.js +1 -1
- package/cjs/components/Toggle/Toggle.d.ts +25 -48
- package/cjs/components/Toggle/Toggle.js +4 -12
- package/cjs/components/Toggle/Toggle.js.map +1 -1
- package/cjs/components/Toggle/Toggle.md +9 -9
- package/cjs/components/Toggle/__docs__/Toggle.mdx +28 -0
- package/cjs/components/Token/Token.d.ts +17 -9
- package/cjs/components/Token/Token.js +9 -1
- package/cjs/components/Token/Token.js.map +1 -1
- package/cjs/components/Token/Token.md +86 -3
- package/cjs/components/Token/TokenView.d.ts +3 -0
- package/cjs/components/Token/TokenView.js +3 -0
- package/cjs/components/Token/TokenView.js.map +1 -1
- package/cjs/components/Token/__docs__/Token.mdx +28 -0
- package/cjs/components/Token/locale/types.js +1 -1
- package/cjs/components/TokenInput/TextWidthHelper.d.ts +3 -0
- package/cjs/components/TokenInput/TextWidthHelper.js +5 -0
- package/cjs/components/TokenInput/TextWidthHelper.js.map +1 -1
- package/cjs/components/TokenInput/TokenInput.d.ts +54 -97
- package/cjs/components/TokenInput/TokenInput.js +7 -18
- package/cjs/components/TokenInput/TokenInput.js.map +1 -1
- package/cjs/components/TokenInput/TokenInput.md +12 -10
- package/cjs/components/TokenInput/TokenInputMenu.d.ts +5 -5
- package/cjs/components/TokenInput/TokenInputMenu.js.map +1 -1
- package/cjs/components/TokenInput/__docs__/TokenInput.mdx +28 -0
- package/cjs/components/TokenInput/locale/types.js +1 -1
- package/cjs/components/Tooltip/Tooltip.d.ts +28 -68
- package/cjs/components/Tooltip/Tooltip.js +9 -63
- package/cjs/components/Tooltip/Tooltip.js.map +1 -1
- package/cjs/components/Tooltip/Tooltip.md +5 -0
- package/cjs/components/Tooltip/__docs__/Tooltip.mdx +28 -0
- package/cjs/components/TooltipMenu/TooltipMenu.d.ts +13 -28
- package/cjs/components/TooltipMenu/TooltipMenu.js +1 -16
- package/cjs/components/TooltipMenu/TooltipMenu.js.map +1 -1
- package/cjs/components/TooltipMenu/TooltipMenu.md +13 -10
- package/cjs/components/TooltipMenu/__docs__/TooltipMenu.mdx +24 -0
- package/cjs/index.d.ts +1 -2
- package/cjs/index.js +1 -2
- package/cjs/index.js.map +1 -1
- package/cjs/internal/CommonWrapper/types.js +1 -1
- package/cjs/internal/CustomComboBox/CustomComboBox.d.ts +4 -1
- package/cjs/internal/CustomComboBox/CustomComboBox.js +12 -2
- package/cjs/internal/CustomComboBox/CustomComboBox.js.map +1 -1
- package/cjs/internal/CustomComboBox/CustomComboBoxReducer.d.ts +1 -0
- package/cjs/internal/CustomComboBox/CustomComboBoxReducer.js +1 -1
- package/cjs/internal/CustomComboBox/CustomComboBoxReducer.js.map +1 -1
- package/cjs/internal/CustomComboBox/CustomComboBoxTypes.js +1 -1
- package/cjs/internal/CustomComboBox/CustomComboBoxTypes.js.map +1 -1
- package/cjs/internal/CustomComboBox/locale/types.js +1 -1
- package/cjs/internal/DateSelect/locale/types.js +1 -1
- package/cjs/internal/FileUploaderControl/fileUtils.js +1 -1
- package/cjs/internal/FileUploaderControl/fileUtils.js.map +1 -1
- package/cjs/internal/InputLikeText/InputLikeText.js +12 -11
- package/cjs/internal/InputLikeText/InputLikeText.js.map +1 -1
- package/cjs/internal/Popup/types.js +1 -1
- package/cjs/internal/RenderContainer/RenderContainerTypes.js +1 -1
- package/cjs/internal/ThemePlayground/Playground.styles.js +2 -1
- package/cjs/internal/ThemePlayground/Playground.styles.js.map +1 -1
- package/cjs/internal/ThemePlayground/__creevey__/Theme5_0.creevey.mts +36 -0
- package/cjs/internal/ThemePlayground/__creevey__/Theme5_0.stories.d.ts +4 -0
- package/cjs/internal/ThemePlayground/constants.js +1 -1
- package/cjs/internal/ThemePlayground/constants.js.map +1 -1
- package/cjs/internal/ThemeShowcase/VariablesCollector.d.ts +1 -1
- package/cjs/internal/ThemeShowcase/VariablesCollector.js +0 -1
- package/cjs/internal/ThemeShowcase/VariablesCollector.js.map +1 -1
- package/cjs/internal/themes/BasicLightTheme.d.ts +5 -1198
- package/cjs/internal/themes/BasicLightTheme.js +2 -2512
- package/cjs/internal/themes/BasicLightTheme.js.map +1 -1
- package/cjs/internal/themes/BasicTheme.d.ts +1217 -0
- package/cjs/internal/themes/BasicTheme.js +2536 -0
- package/cjs/internal/themes/BasicTheme.js.map +1 -0
- package/cjs/internal/themes/DarkTheme5_0.d.ts +1 -0
- package/cjs/internal/themes/DarkTheme5_0.js +556 -0
- package/cjs/internal/themes/DarkTheme5_0.js.map +1 -0
- package/cjs/internal/themes/DarkTheme5_1.d.ts +1 -0
- package/cjs/internal/themes/DarkTheme5_1.js +41 -0
- package/cjs/internal/themes/DarkTheme5_1.js.map +1 -0
- package/cjs/internal/themes/LightTheme5_0.d.ts +1 -0
- package/cjs/internal/themes/LightTheme5_0.js +9 -0
- package/cjs/internal/themes/LightTheme5_0.js.map +1 -0
- package/cjs/internal/themes/LightTheme5_1.d.ts +1 -0
- package/cjs/internal/themes/LightTheme5_1.js +41 -0
- package/cjs/internal/themes/LightTheme5_1.js.map +1 -0
- package/cjs/lib/ModalStack.d.ts +1 -0
- package/cjs/lib/ModalStack.js +6 -4
- package/cjs/lib/ModalStack.js.map +1 -1
- package/cjs/lib/date/types.js +6 -6
- package/cjs/lib/date/types.js.map +1 -1
- package/cjs/lib/events/MouseDrag.js +1 -1
- package/cjs/lib/events/MouseDrag.js.map +1 -1
- package/cjs/lib/events/keyboard/KeyboardEventCodes.js +1 -1
- package/cjs/lib/events/keyboard/KeyboardEventCodes.js.map +1 -1
- package/cjs/lib/locale/types.js +1 -1
- package/cjs/lib/locale/types.js.map +1 -1
- package/cjs/lib/theming/Theme.d.ts +4 -3
- package/cjs/lib/theming/Theme.js +1 -1
- package/cjs/lib/theming/Theme.js.map +1 -1
- package/cjs/lib/theming/ThemeContext.d.ts +1 -1
- package/cjs/lib/theming/ThemeContext.js +2 -2
- package/cjs/lib/theming/ThemeContext.js.map +1 -1
- package/cjs/lib/theming/ThemeFactory.d.ts +9 -0
- package/cjs/lib/theming/ThemeFactory.js +28 -9
- package/cjs/lib/theming/ThemeFactory.js.map +1 -1
- package/cjs/lib/theming/ThemeHelpers.d.ts +55 -8
- package/cjs/lib/theming/ThemeHelpers.js +94 -22
- package/cjs/lib/theming/ThemeHelpers.js.map +1 -1
- package/cjs/lib/theming/ThemeVersions.d.ts +25 -0
- package/cjs/lib/theming/ThemeVersions.js +58 -0
- package/cjs/lib/theming/ThemeVersions.js.map +1 -0
- package/cjs/lib/theming/themes/DarkTheme.d.ts +3 -1
- package/cjs/lib/theming/themes/DarkTheme.js +6 -4
- package/cjs/lib/theming/themes/DarkTheme.js.map +1 -1
- package/cjs/lib/theming/themes/LightTheme.d.ts +3 -1
- package/cjs/lib/theming/themes/LightTheme.js +6 -4
- package/cjs/lib/theming/themes/LightTheme.js.map +1 -1
- package/cjs/lib/theming/themes/LightThemeMobile.d.ts +1 -1
- package/cjs/lib/theming/useTheme.d.ts +1 -1
- package/cjs/lib/types/button-link.js +1 -1
- package/cjs/lib/types/polymorphic-component.js +1 -1
- package/cjs/lib/types/props.js +1 -1
- package/components/Autocomplete/Autocomplete/Autocomplete.js +3 -2
- package/components/Autocomplete/Autocomplete/Autocomplete.js.map +1 -1
- package/components/Autocomplete/Autocomplete.d.ts +16 -17
- package/components/Autocomplete/Autocomplete.md +9 -7
- package/components/Autocomplete/__docs__/Autocomplete.mdx +26 -0
- package/components/Autocomplete/locale/types/types.js +0 -1
- package/components/Button/Button/Button.js.map +1 -1
- package/components/Button/Button.d.ts +20 -62
- package/components/Button/Button.md +40 -26
- package/components/Button/__docs__/Button.mdx +28 -0
- package/components/Calendar/Calendar/Calendar.js +1 -1
- package/components/Calendar/Calendar/Calendar.js.map +1 -1
- package/components/Calendar/Calendar.d.ts +22 -45
- package/components/Calendar/Calendar.md +12 -12
- package/components/Calendar/CalendarDay/CalendarDay.js +2 -0
- package/components/Calendar/CalendarDay/CalendarDay.js.map +1 -1
- package/components/Calendar/CalendarDay.d.ts +7 -0
- package/components/Calendar/CalendarDay.md +32 -32
- package/components/Calendar/__docs__/Calendar.mdx +28 -0
- package/components/Calendar/__docs__/CalendarDay.mdx +24 -0
- package/components/Calendar/locale/types/types.js +0 -1
- package/components/Center/Center/Center.js +3 -1
- package/components/Center/Center/Center.js.map +1 -1
- package/components/Center/Center.d.ts +4 -6
- package/components/Center/Center.md +1 -1
- package/components/Center/__docs__/Center.mdx +24 -0
- package/components/Checkbox/Checkbox/Checkbox.js +7 -0
- package/components/Checkbox/Checkbox/Checkbox.js.map +1 -1
- package/components/Checkbox/Checkbox.d.ts +20 -28
- package/components/Checkbox/Checkbox.md +6 -5
- package/components/Checkbox/__docs__/Checkbox.mdx +28 -0
- package/components/ComboBox/ComboBox/ComboBox.js +13 -2
- package/components/ComboBox/ComboBox/ComboBox.js.map +1 -1
- package/components/ComboBox/ComboBox.d.ts +67 -86
- package/components/ComboBox/ComboBox.md +41 -40
- package/components/ComboBox/__docs__/ComboBox.mdx +28 -0
- package/components/CurrencyInput/CurrencyHelper/CurrencyHelper.js.map +1 -1
- package/components/CurrencyInput/CurrencyHelper.d.ts +4 -0
- package/components/CurrencyInput/CurrencyInput/CurrencyInput.js +5 -2
- package/components/CurrencyInput/CurrencyInput/CurrencyInput.js.map +1 -1
- package/components/CurrencyInput/CurrencyInput.d.ts +12 -12
- package/components/CurrencyInput/CurrencyInput.md +3 -1
- package/components/CurrencyInput/CurrencyInputHelper/CurrencyInputHelper.js.map +1 -1
- package/components/CurrencyInput/CurrencyInputHelper.d.ts +3 -0
- package/components/CurrencyInput/__docs__/CurrencyInput.mdx +28 -0
- package/components/CurrencyLabel/CurrencyLabel/CurrencyLabel.js +4 -0
- package/components/CurrencyLabel/CurrencyLabel/CurrencyLabel.js.map +1 -1
- package/components/CurrencyLabel/CurrencyLabel.d.ts +8 -5
- package/components/CurrencyLabel/CurrencyLabel.md +5 -5
- package/components/CurrencyLabel/__docs__/CurrencyLabel.mdx +24 -0
- package/components/DateInput/DateInput/DateInput.js +8 -1
- package/components/DateInput/DateInput/DateInput.js.map +1 -1
- package/components/DateInput/DateInput.d.ts +21 -29
- package/components/DateInput/DateInput.md +7 -2
- package/components/DateInput/__docs__/DateInput.mdx +26 -0
- package/components/DateInput/helpers/DateInputKeyboardActions/DateInputKeyboardActions.js +3 -3
- package/components/DateInput/helpers/DateInputKeyboardActions/DateInputKeyboardActions.js.map +1 -1
- package/components/DatePicker/DatePicker/DatePicker.js +33 -5
- package/components/DatePicker/DatePicker/DatePicker.js.map +1 -1
- package/components/DatePicker/DatePicker.d.ts +33 -23
- package/components/DatePicker/DatePicker.md +2 -2
- package/components/DatePicker/__docs__/DatePicker.mdx +28 -0
- package/components/DatePicker/locale/types/types.js +0 -1
- package/components/Dropdown/Dropdown/Dropdown.js +7 -1
- package/components/Dropdown/Dropdown/Dropdown.js.map +1 -1
- package/components/Dropdown/Dropdown.d.ts +25 -30
- package/components/Dropdown/Dropdown.md +2 -1
- package/components/Dropdown/__docs__/Dropdown.mdx +28 -0
- package/components/DropdownMenu/DropdownMenu/DropdownMenu.js +1 -1
- package/components/DropdownMenu/DropdownMenu/DropdownMenu.js.map +1 -1
- package/components/DropdownMenu/DropdownMenu.d.ts +1 -1
- package/components/DropdownMenu/DropdownMenu.md +12 -10
- package/components/DropdownMenu/__docs__/DropdownMenu.mdx +28 -0
- package/components/FileUploader/FileUploader/FileUploader.js +6 -0
- package/components/FileUploader/FileUploader/FileUploader.js.map +1 -1
- package/components/FileUploader/FileUploader.d.ts +16 -20
- package/components/FileUploader/FileUploader.md +9 -9
- package/components/FileUploader/__docs__/FileUploader.mdx +28 -0
- package/components/FileUploader/locale/types/types.js +0 -1
- package/components/FxInput/FxInput/FxInput.js +7 -1
- package/components/FxInput/FxInput/FxInput.js.map +1 -1
- package/components/FxInput/FxInput.d.ts +15 -9
- package/components/FxInput/FxInput.md +2 -0
- package/components/FxInput/__docs__/FxInput.mdx +28 -0
- package/components/Gapped/Gapped/Gapped.js +1 -1
- package/components/Gapped/Gapped/Gapped.js.map +1 -1
- package/components/Gapped/Gapped.d.ts +6 -17
- package/components/Gapped/Gapped.md +3 -2
- package/components/Gapped/__docs__/Gapped.mdx +24 -0
- package/components/GlobalLoader/GlobalLoader/GlobalLoader.js +13 -0
- package/components/GlobalLoader/GlobalLoader/GlobalLoader.js.map +1 -1
- package/components/GlobalLoader/GlobalLoader.d.ts +22 -32
- package/components/GlobalLoader/GlobalLoader.md +4 -5
- package/components/GlobalLoader/GlobalLoaderView/GlobalLoaderView.js.map +1 -1
- package/components/GlobalLoader/GlobalLoaderView.d.ts +4 -0
- package/components/GlobalLoader/__docs__/GlobalLoader.mdx +28 -0
- package/components/Group/Group/Group.js +6 -0
- package/components/Group/Group/Group.js.map +1 -1
- package/components/Group/Group.d.ts +6 -0
- package/components/Group/Group.md +1 -0
- package/components/Group/__docs__/Group.mdx +24 -0
- package/components/Hint/Hint/Hint.js +4 -1
- package/components/Hint/Hint/Hint.js.map +1 -1
- package/components/Hint/Hint.d.ts +18 -40
- package/components/Hint/Hint.md +9 -8
- package/components/Hint/__docs__/Hint.mdx +29 -0
- package/components/Input/Input/Input.js +10 -1
- package/components/Input/Input/Input.js.map +1 -1
- package/components/Input/Input.d.ts +46 -68
- package/components/Input/Input.md +11 -2
- package/components/Input/Input.typings/Input.typings.js +0 -1
- package/components/Input/__docs__/Input.mdx +28 -0
- package/components/Kebab/Kebab/Kebab.js +4 -0
- package/components/Kebab/Kebab/Kebab.js.map +1 -1
- package/components/Kebab/Kebab.d.ts +12 -16
- package/components/Kebab/Kebab.md +9 -9
- package/components/Kebab/__docs__/Kebab.mdx +28 -0
- package/components/Link/Link/Link.js.map +1 -1
- package/components/Link/Link.d.ts +13 -37
- package/components/Link/Link.md +12 -11
- package/components/Link/__docs__/Link.mdx +28 -0
- package/components/Loader/Loader/Loader.js +2 -2
- package/components/Loader/Loader/Loader.js.map +1 -1
- package/components/Loader/Loader.d.ts +13 -25
- package/components/Loader/Loader.md +1 -0
- package/components/Loader/__docs__/Loader.mdx +26 -0
- package/components/MaskedInput/MaskedInput/MaskedInput.js.map +1 -1
- package/components/MaskedInput/MaskedInput.d.ts +13 -33
- package/components/MaskedInput/MaskedInput.md +7 -5
- package/components/MaskedInput/__docs__/MaskedInput.mdx +28 -0
- package/components/MenuFooter/MenuFooter/MenuFooter.js +3 -3
- package/components/MenuFooter/MenuFooter/MenuFooter.js.map +1 -1
- package/components/MenuFooter/MenuFooter.d.ts +6 -4
- package/components/MenuFooter/MenuFooter.md +2 -2
- package/components/MenuFooter/__docs__/MenuFooter.mdx +24 -0
- package/components/MenuHeader/MenuHeader/MenuHeader.js +3 -3
- package/components/MenuHeader/MenuHeader/MenuHeader.js.map +1 -1
- package/components/MenuHeader/MenuHeader.d.ts +6 -4
- package/components/MenuHeader/MenuHeader.md +2 -2
- package/components/MenuHeader/__docs__/MenuHeader.mdx +24 -0
- package/components/MenuItem/MenuItem/MenuItem.js +1 -2
- package/components/MenuItem/MenuItem/MenuItem.js.map +1 -1
- package/components/MenuItem/MenuItem.d.ts +22 -55
- package/components/MenuItem/MenuItem.md +34 -30
- package/components/MenuItem/__docs__/MenuItem.mdx +24 -0
- package/components/MenuSeparator/MenuSeparator/MenuSeparator.js +3 -2
- package/components/MenuSeparator/MenuSeparator/MenuSeparator.js.map +1 -1
- package/components/MenuSeparator/MenuSeparator.d.ts +2 -2
- package/components/MenuSeparator/MenuSeparator.md +1 -1
- package/components/MenuSeparator/__docs__/MenuSeparator.mdx +24 -0
- package/components/MiniModal/MiniModal/MiniModal.js +7 -0
- package/components/MiniModal/MiniModal/MiniModal.js.map +1 -1
- package/components/MiniModal/MiniModal.d.ts +6 -0
- package/components/MiniModal/MiniModal.md +1 -3
- package/components/MiniModal/MiniModalFooter/MiniModalFooter.js.map +1 -1
- package/components/MiniModal/MiniModalFooter.d.ts +2 -7
- package/components/MiniModal/MiniModalHeader/MiniModalHeader.js.map +1 -1
- package/components/MiniModal/MiniModalHeader.d.ts +2 -5
- package/components/MiniModal/__docs__/MiniModal.mdx +28 -0
- package/components/MiniModal/__docs__/MiniModalBody.mdx +17 -0
- package/components/MiniModal/__docs__/MiniModalFooter.mdx +17 -0
- package/components/MiniModal/__docs__/MiniModalHeader.mdx +18 -0
- package/components/MiniModal/__docs__/MiniModalIndent.mdx +11 -0
- package/components/MiniModal/getMiniModalTheme.d.ts +1 -1
- package/components/Modal/Modal/Modal.js +4 -9
- package/components/Modal/Modal/Modal.js.map +1 -1
- package/components/Modal/Modal.d.ts +12 -33
- package/components/Modal/Modal.md +3 -1
- package/components/Modal/Modal.styles/Modal.styles.js +40 -31
- package/components/Modal/Modal.styles/Modal.styles.js.map +1 -1
- package/components/Modal/Modal.styles.d.ts +4 -1
- package/components/Modal/ModalBody/ModalBody.js +1 -1
- package/components/Modal/ModalBody/ModalBody.js.map +1 -1
- package/components/Modal/ModalBody.d.ts +2 -4
- package/components/Modal/ModalClose/ModalClose.js +3 -1
- package/components/Modal/ModalClose/ModalClose.js.map +1 -1
- package/components/Modal/ModalContext/ModalContext.js.map +1 -1
- package/components/Modal/ModalContext.d.ts +2 -0
- package/components/Modal/ModalFooter/ModalFooter.js.map +1 -1
- package/components/Modal/ModalFooter.d.ts +5 -15
- package/components/Modal/ModalHeader/ModalHeader.js +1 -1
- package/components/Modal/ModalHeader/ModalHeader.js.map +1 -1
- package/components/Modal/ModalHeader.d.ts +3 -1
- package/components/Modal/ModalSeparator/ModalSeparator.js.map +1 -1
- package/components/Modal/ModalSeparator.d.ts +1 -0
- package/components/Modal/__creevey__/Modal.creevey.mts +15 -1
- package/components/Modal/__docs__/Modal.mdx +28 -0
- package/components/Modal/__docs__/ModalBody.mdx +15 -0
- package/components/Modal/__docs__/ModalFooter.mdx +15 -0
- package/components/Modal/__docs__/ModalHeader.mdx +15 -0
- package/components/Modal/__docs__/ModalSeparator.mdx +15 -0
- package/components/Modal/locale/types/types.js +0 -1
- package/components/Paging/Paging/Paging.js +4 -0
- package/components/Paging/Paging/Paging.js.map +1 -1
- package/components/Paging/Paging.d.ts +20 -15
- package/components/Paging/Paging.md +3 -2
- package/components/Paging/PagingDefaultComponent/PagingDefaultComponent.js.map +1 -1
- package/components/Paging/PagingDefaultComponent.d.ts +2 -0
- package/components/Paging/__docs__/Paging.mdx +28 -0
- package/components/Paging/locale/types/types.js +0 -1
- package/components/PasswordInput/PasswordInput/PasswordInput.js +32 -10
- package/components/PasswordInput/PasswordInput/PasswordInput.js.map +1 -1
- package/components/PasswordInput/PasswordInput.d.ts +10 -3
- package/components/PasswordInput/PasswordInput.md +3 -2
- package/components/PasswordInput/__docs__/PasswordInput.mdx +28 -0
- package/components/PasswordInput/locale/types/types.js +0 -1
- package/components/Radio/Radio/Radio.js +1 -1
- package/components/Radio/Radio/Radio.js.map +1 -1
- package/components/Radio/Radio.d.ts +13 -28
- package/components/Radio/Radio.md +3 -2
- package/components/Radio/__docs__/Radio.mdx +28 -0
- package/components/RadioGroup/RadioGroup/RadioGroup.js +4 -5
- package/components/RadioGroup/RadioGroup/RadioGroup.js.map +1 -1
- package/components/RadioGroup/RadioGroup.d.ts +28 -54
- package/components/RadioGroup/RadioGroup.md +1 -0
- package/components/RadioGroup/__docs__/RadioGroup.mdx +28 -0
- package/components/ResponsiveLayout/ResponsiveLayout/ResponsiveLayout.js +1 -2
- package/components/ResponsiveLayout/ResponsiveLayout/ResponsiveLayout.js.map +1 -1
- package/components/ResponsiveLayout/ResponsiveLayout.d.ts +4 -1
- package/components/ResponsiveLayout/ResponsiveLayout.md +4 -3
- package/components/ResponsiveLayout/__docs__/ResponsiveLayout.mdx +97 -0
- package/components/ResponsiveLayout/types/types.js +0 -1
- package/components/ScrollContainer/ScrollBar/ScrollBar.js.map +1 -1
- package/components/ScrollContainer/ScrollBar.d.ts +7 -0
- package/components/ScrollContainer/ScrollContainer/ScrollContainer.js +4 -0
- package/components/ScrollContainer/ScrollContainer/ScrollContainer.js.map +1 -1
- package/components/ScrollContainer/ScrollContainer.d.ts +23 -29
- package/components/ScrollContainer/ScrollContainer.md +5 -3
- package/components/ScrollContainer/__docs__/ScrollContainer.mdx +24 -0
- package/components/Select/Item/Item.js.map +1 -1
- package/components/Select/Item.d.ts +2 -0
- package/components/Select/Select/Select.js +11 -0
- package/components/Select/Select/Select.js.map +1 -1
- package/components/Select/Select.d.ts +54 -38
- package/components/Select/Select.md +7 -6
- package/components/Select/__docs__/Select.mdx +28 -0
- package/components/Select/locale/types/types.js +0 -1
- package/components/SidePage/SidePage/SidePage.js +28 -16
- package/components/SidePage/SidePage/SidePage.js.map +1 -1
- package/components/SidePage/SidePage.d.ts +17 -38
- package/components/SidePage/SidePage.md +2 -1
- package/components/SidePage/SidePage.styles/SidePage.styles.js +48 -26
- package/components/SidePage/SidePage.styles/SidePage.styles.js.map +1 -1
- package/components/SidePage/SidePage.styles.d.ts +8 -1
- package/components/SidePage/SidePageCloseButton/SidePageCloseButton.js +6 -2
- package/components/SidePage/SidePageCloseButton/SidePageCloseButton.js.map +1 -1
- package/components/SidePage/SidePageCloseButton.d.ts +6 -1
- package/components/SidePage/SidePageFooter/SidePageFooter.js.map +1 -1
- package/components/SidePage/SidePageFooter.d.ts +4 -9
- package/components/SidePage/SidePageHeader/SidePageHeader.js +13 -5
- package/components/SidePage/SidePageHeader/SidePageHeader.js.map +1 -1
- package/components/SidePage/SidePageHeader.d.ts +2 -1
- package/components/SidePage/__creevey__/SidePage.creevey.mts +103 -1
- package/components/SidePage/__docs__/SidePage.mdx +28 -0
- package/components/SidePage/__docs__/SidePageBody.mdx +15 -0
- package/components/SidePage/__docs__/SidePageContainer.mdx +15 -0
- package/components/SidePage/__docs__/SidePageFooter.mdx +15 -0
- package/components/SidePage/__docs__/SidePageHeader.mdx +15 -0
- package/components/SidePage/locale/types/types.js +0 -1
- package/components/SingleToast/SingleToast/SingleToast.js +5 -1
- package/components/SingleToast/SingleToast/SingleToast.js.map +1 -1
- package/components/SingleToast/SingleToast.d.ts +5 -1
- package/components/SingleToast/SingleToast.md +2 -1
- package/components/SingleToast/__docs__/SingleToast.mdx +28 -0
- package/components/Spinner/Spinner/Spinner.js +6 -2
- package/components/Spinner/Spinner/Spinner.js.map +1 -1
- package/components/Spinner/Spinner.d.ts +15 -20
- package/components/Spinner/Spinner.md +2 -1
- package/components/Spinner/__docs__/Spinner.mdx +28 -0
- package/components/Sticky/Sticky/Sticky.js +5 -0
- package/components/Sticky/Sticky/Sticky.js.map +1 -1
- package/components/Sticky/Sticky.d.ts +9 -4
- package/components/Sticky/Sticky.md +1 -0
- package/components/Sticky/__docs__/Sticky.mdx +24 -0
- package/components/Switcher/Switcher/Switcher.js +16 -6
- package/components/Switcher/Switcher/Switcher.js.map +1 -1
- package/components/Switcher/Switcher.d.ts +18 -7
- package/components/Switcher/Switcher.md +6 -2
- package/components/Switcher/Switcher.styles/Switcher.styles.js +4 -1
- package/components/Switcher/Switcher.styles/Switcher.styles.js.map +1 -1
- package/components/Switcher/Switcher.styles.d.ts +1 -0
- package/components/Switcher/__docs__/Switcher.mdx +28 -0
- package/components/Tabs/Tab/Tab.js +1 -1
- package/components/Tabs/Tab/Tab.js.map +1 -1
- package/components/Tabs/Tab.d.ts +12 -31
- package/components/Tabs/Tab.md +2 -0
- package/components/Tabs/Tabs/Tabs.js +6 -1
- package/components/Tabs/Tabs/Tabs.js.map +1 -1
- package/components/Tabs/Tabs.d.ts +14 -25
- package/components/Tabs/Tabs.md +3 -2
- package/components/Tabs/__docs__/Tab.mdx +28 -0
- package/components/Tabs/__docs__/Tabs.mdx +28 -0
- package/components/Textarea/Textarea/Textarea.js +3 -4
- package/components/Textarea/Textarea/Textarea.js.map +1 -1
- package/components/Textarea/Textarea.d.ts +26 -52
- package/components/Textarea/Textarea.md +4 -2
- package/components/Textarea/__docs__/Textarea.mdx +28 -0
- package/components/Toast/Toast/Toast.js +17 -12
- package/components/Toast/Toast/Toast.js.map +1 -1
- package/components/Toast/Toast.d.ts +12 -9
- package/components/Toast/Toast.md +4 -4
- package/components/Toast/ToastStatic/ToastStatic.js +5 -5
- package/components/Toast/ToastStatic/ToastStatic.js.map +1 -1
- package/components/Toast/ToastStatic.d.ts +2 -2
- package/components/Toast/ToastView/ToastView.js +2 -1
- package/components/Toast/ToastView/ToastView.js.map +1 -1
- package/components/Toast/ToastView.d.ts +3 -6
- package/components/Toast/ToastView.styles/ToastView.styles.js +2 -2
- package/components/Toast/ToastView.styles/ToastView.styles.js.map +1 -1
- package/components/Toast/__creevey__/Toast.creevey.mts +23 -0
- package/components/Toast/__docs__/Toast.mdx +28 -0
- package/components/Toast/locale/types/types.js +0 -1
- package/components/Toggle/Toggle/Toggle.js +4 -1
- package/components/Toggle/Toggle/Toggle.js.map +1 -1
- package/components/Toggle/Toggle.d.ts +25 -48
- package/components/Toggle/Toggle.md +9 -9
- package/components/Toggle/__docs__/Toggle.mdx +28 -0
- package/components/Token/Token/Token.js +6 -0
- package/components/Token/Token/Token.js.map +1 -1
- package/components/Token/Token.d.ts +17 -9
- package/components/Token/Token.md +86 -3
- package/components/Token/TokenView/TokenView.js.map +1 -1
- package/components/Token/TokenView.d.ts +3 -0
- package/components/Token/__docs__/Token.mdx +28 -0
- package/components/Token/locale/types/types.js +0 -1
- package/components/TokenInput/TextWidthHelper/TextWidthHelper.js.map +1 -1
- package/components/TokenInput/TextWidthHelper.d.ts +3 -0
- package/components/TokenInput/TokenInput/TokenInput.js +9 -3
- package/components/TokenInput/TokenInput/TokenInput.js.map +1 -1
- package/components/TokenInput/TokenInput.d.ts +54 -97
- package/components/TokenInput/TokenInput.md +12 -10
- package/components/TokenInput/TokenInputMenu/TokenInputMenu.js.map +1 -1
- package/components/TokenInput/TokenInputMenu.d.ts +5 -5
- package/components/TokenInput/__docs__/TokenInput.mdx +28 -0
- package/components/TokenInput/locale/types/types.js +0 -1
- package/components/Tooltip/Tooltip/Tooltip.js +9 -0
- package/components/Tooltip/Tooltip/Tooltip.js.map +1 -1
- package/components/Tooltip/Tooltip.d.ts +28 -68
- package/components/Tooltip/Tooltip.md +5 -0
- package/components/Tooltip/__docs__/Tooltip.mdx +28 -0
- package/components/TooltipMenu/TooltipMenu/TooltipMenu.js +1 -1
- package/components/TooltipMenu/TooltipMenu/TooltipMenu.js.map +1 -1
- package/components/TooltipMenu/TooltipMenu.d.ts +13 -28
- package/components/TooltipMenu/TooltipMenu.md +13 -10
- package/components/TooltipMenu/__docs__/TooltipMenu.mdx +24 -0
- package/index.d.ts +1 -2
- package/index.js +1 -2
- package/index.js.map +1 -1
- package/internal/CommonWrapper/index/index.js +1 -2
- package/internal/CommonWrapper/index/index.js.map +1 -1
- package/internal/CommonWrapper/types/types.js +0 -1
- package/internal/CustomComboBox/CustomComboBox/CustomComboBox.js +10 -2
- package/internal/CustomComboBox/CustomComboBox/CustomComboBox.js.map +1 -1
- package/internal/CustomComboBox/CustomComboBox.d.ts +4 -1
- package/internal/CustomComboBox/CustomComboBoxReducer/CustomComboBoxReducer.js +1 -1
- package/internal/CustomComboBox/CustomComboBoxReducer/CustomComboBoxReducer.js.map +1 -1
- package/internal/CustomComboBox/CustomComboBoxReducer.d.ts +1 -0
- package/internal/CustomComboBox/CustomComboBoxTypes/CustomComboBoxTypes.js +3 -3
- package/internal/CustomComboBox/CustomComboBoxTypes/CustomComboBoxTypes.js.map +1 -1
- package/internal/CustomComboBox/locale/types/types.js +0 -1
- package/internal/DateSelect/locale/types/types.js +0 -1
- package/internal/FileUploaderControl/fileUtils/fileUtils.js +3 -3
- package/internal/FileUploaderControl/fileUtils/fileUtils.js.map +1 -1
- package/internal/InputLikeText/InputLikeText/InputLikeText.js +12 -6
- package/internal/InputLikeText/InputLikeText/InputLikeText.js.map +1 -1
- package/internal/Popup/types/types.js +0 -1
- package/internal/RenderContainer/RenderContainerTypes/RenderContainerTypes.js +0 -1
- package/internal/ThemePlayground/Playground.styles/Playground.styles.js +1 -1
- package/internal/ThemePlayground/Playground.styles/Playground.styles.js.map +1 -1
- package/internal/ThemePlayground/__creevey__/Theme5_0.creevey.d.mts +1 -0
- package/internal/ThemePlayground/__creevey__/Theme5_0.creevey.mts +36 -0
- package/internal/ThemePlayground/__creevey__/Theme5_0.stories.d.ts +4 -0
- package/internal/ThemePlayground/constants/constants.js +3 -3
- package/internal/ThemePlayground/constants/constants.js.map +1 -1
- package/internal/ThemeShowcase/VariablesCollector/VariablesCollector.js.map +1 -1
- package/internal/ThemeShowcase/VariablesCollector.d.ts +1 -1
- package/internal/ZIndex/index/index.js +1 -2
- package/internal/ZIndex/index/index.js.map +1 -1
- package/internal/themes/BasicLightTheme/BasicLightTheme.js +5 -3338
- package/internal/themes/BasicLightTheme/BasicLightTheme.js.map +1 -1
- package/internal/themes/BasicLightTheme.d.ts +5 -1198
- package/internal/themes/BasicTheme/BasicTheme.js +3360 -0
- package/internal/themes/BasicTheme/BasicTheme.js.map +1 -0
- package/internal/themes/BasicTheme/package.json +6 -0
- package/internal/themes/BasicTheme.d.ts +1217 -0
- package/internal/themes/DarkTheme5_0/DarkTheme5_0.js +409 -0
- package/internal/themes/DarkTheme5_0/DarkTheme5_0.js.map +1 -0
- package/internal/themes/DarkTheme5_0/package.json +6 -0
- package/internal/themes/DarkTheme5_0.d.ts +1 -0
- package/internal/themes/DarkTheme5_1/DarkTheme5_1.js +52 -0
- package/internal/themes/DarkTheme5_1/DarkTheme5_1.js.map +1 -0
- package/internal/themes/DarkTheme5_1/package.json +6 -0
- package/internal/themes/DarkTheme5_1.d.ts +1 -0
- package/internal/themes/LightTheme5_0/LightTheme5_0.js +14 -0
- package/internal/themes/LightTheme5_0/LightTheme5_0.js.map +1 -0
- package/internal/themes/LightTheme5_0/package.json +6 -0
- package/internal/themes/LightTheme5_0.d.ts +1 -0
- package/internal/themes/LightTheme5_1/LightTheme5_1.js +52 -0
- package/internal/themes/LightTheme5_1/LightTheme5_1.js.map +1 -0
- package/internal/themes/LightTheme5_1/package.json +6 -0
- package/internal/themes/LightTheme5_1.d.ts +1 -0
- package/lib/ModalStack/ModalStack.js +8 -8
- package/lib/ModalStack/ModalStack.js.map +1 -1
- package/lib/ModalStack.d.ts +1 -0
- package/lib/date/types/types.js +18 -18
- package/lib/date/types/types.js.map +1 -1
- package/lib/events/MouseDrag/MouseDrag.js +3 -3
- package/lib/events/MouseDrag/MouseDrag.js.map +1 -1
- package/lib/events/keyboard/KeyboardEventCodes/KeyboardEventCodes.js +3 -3
- package/lib/events/keyboard/KeyboardEventCodes/KeyboardEventCodes.js.map +1 -1
- package/lib/locale/types/types.js +3 -3
- package/lib/locale/types/types.js.map +1 -1
- package/lib/theming/Theme/Theme.js +2 -1
- package/lib/theming/Theme/Theme.js.map +1 -1
- package/lib/theming/Theme.d.ts +4 -3
- package/lib/theming/ThemeContext/ThemeContext.js +2 -2
- package/lib/theming/ThemeContext/ThemeContext.js.map +1 -1
- package/lib/theming/ThemeContext.d.ts +1 -1
- package/lib/theming/ThemeFactory/ThemeFactory.js +21 -7
- package/lib/theming/ThemeFactory/ThemeFactory.js.map +1 -1
- package/lib/theming/ThemeFactory.d.ts +9 -0
- package/lib/theming/ThemeHelpers/ThemeHelpers.js +85 -18
- package/lib/theming/ThemeHelpers/ThemeHelpers.js.map +1 -1
- package/lib/theming/ThemeHelpers.d.ts +55 -8
- package/lib/theming/ThemeVersions/ThemeVersions.js +50 -0
- package/lib/theming/ThemeVersions/ThemeVersions.js.map +1 -0
- package/lib/theming/ThemeVersions/package.json +6 -0
- package/lib/theming/ThemeVersions.d.ts +25 -0
- package/lib/theming/themes/DarkTheme/DarkTheme.js +5 -4
- package/lib/theming/themes/DarkTheme/DarkTheme.js.map +1 -1
- package/lib/theming/themes/DarkTheme.d.ts +3 -1
- package/lib/theming/themes/LightTheme/LightTheme.js +5 -4
- package/lib/theming/themes/LightTheme/LightTheme.js.map +1 -1
- package/lib/theming/themes/LightTheme.d.ts +3 -1
- package/lib/theming/themes/LightThemeMobile.d.ts +1 -1
- package/lib/theming/useTheme.d.ts +1 -1
- package/lib/types/button-link/button-link.js +0 -1
- package/lib/types/polymorphic-component/polymorphic-component.js +0 -1
- package/lib/types/props/props.js +0 -1
- package/package.json +9 -5
- package/cjs/internal/themes/BasicDarkTheme.d.ts +0 -289
- package/cjs/internal/themes/BasicDarkTheme.js +0 -597
- package/cjs/internal/themes/BasicDarkTheme.js.map +0 -1
- package/cjs/lib/theming/themes/DarkTheme2022_0.d.ts +0 -1
- package/cjs/lib/theming/themes/DarkTheme2022_0.js +0 -5
- package/cjs/lib/theming/themes/DarkTheme2022_0.js.map +0 -1
- package/cjs/lib/theming/themes/LightTheme2022_0.d.ts +0 -1
- package/cjs/lib/theming/themes/LightTheme2022_0.js +0 -5
- package/cjs/lib/theming/themes/LightTheme2022_0.js.map +0 -1
- package/internal/themes/BasicDarkTheme/BasicDarkTheme.js +0 -641
- package/internal/themes/BasicDarkTheme/BasicDarkTheme.js.map +0 -1
- package/internal/themes/BasicDarkTheme/package.json +0 -6
- package/internal/themes/BasicDarkTheme.d.ts +0 -289
- package/lib/theming/themes/DarkTheme2022_0/DarkTheme2022_0.js +0 -3
- package/lib/theming/themes/DarkTheme2022_0/DarkTheme2022_0.js.map +0 -1
- package/lib/theming/themes/DarkTheme2022_0/package.json +0 -6
- package/lib/theming/themes/DarkTheme2022_0.d.ts +0 -1
- package/lib/theming/themes/LightTheme2022_0/LightTheme2022_0.js +0 -3
- package/lib/theming/themes/LightTheme2022_0/LightTheme2022_0.js.map +0 -1
- package/lib/theming/themes/LightTheme2022_0/package.json +0 -6
- package/lib/theming/themes/LightTheme2022_0.d.ts +0 -1
|
@@ -4,30 +4,20 @@ import { CommonProps } from '../../internal/CommonWrapper';
|
|
|
4
4
|
declare const types: readonly ["big", "mini", "normal"];
|
|
5
5
|
export type SpinnerType = (typeof types)[number];
|
|
6
6
|
export interface SpinnerProps extends CommonProps {
|
|
7
|
-
/**
|
|
8
|
-
*
|
|
9
|
-
*/
|
|
7
|
+
/** Задает подпись под спиннером.
|
|
8
|
+
* @default "Загрузка" */
|
|
10
9
|
caption?: React.ReactNode;
|
|
11
|
-
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* Цвет спиннера в "затемнённом режиме" определяется переменной `spinnerDimmedColor`
|
|
15
|
-
*/
|
|
10
|
+
/** Переводит спиннер в "затемнённый режим".
|
|
11
|
+
* Цвет спиннера в "затемнённом режиме" определяется переменной `spinnerDimmedColor`. */
|
|
16
12
|
dimmed?: boolean;
|
|
17
|
-
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* @default normal
|
|
21
|
-
*/
|
|
13
|
+
/** Задает размер спиннера и текста.
|
|
14
|
+
* @default normal. */
|
|
22
15
|
type?: SpinnerType;
|
|
16
|
+
/** Уменьшает спиннер для вставки в инлайн элемент. При type = "big"|"normal" размер спиннера уменьшается. */
|
|
23
17
|
inline?: boolean;
|
|
24
|
-
/**
|
|
25
|
-
* Толщина спиннера
|
|
26
|
-
*/
|
|
18
|
+
/** Задает толщину спиннера. */
|
|
27
19
|
width?: number;
|
|
28
|
-
/**
|
|
29
|
-
* Цвет спиннера
|
|
30
|
-
*/
|
|
20
|
+
/** Задает цвет спиннера. Не работает с пропом dimmed. */
|
|
31
21
|
color?: React.CSSProperties['color'];
|
|
32
22
|
}
|
|
33
23
|
export declare const SpinnerDataTids: {
|
|
@@ -35,7 +25,12 @@ export declare const SpinnerDataTids: {
|
|
|
35
25
|
};
|
|
36
26
|
type DefaultProps = Required<Pick<SpinnerProps, 'type'>>;
|
|
37
27
|
/**
|
|
38
|
-
*
|
|
28
|
+
* `Spinner` — это зацикленный индикатор, не отображающий прогресс выполнения задачи.
|
|
29
|
+
*
|
|
30
|
+
* Используйте `Spinner`, чтобы показать, что система выполняет команду, которую дал пользователь.
|
|
31
|
+
* Не применяйте `Spinner` для заполнения паузы при загрузке контента, для этого предназначен GlobalLoader.
|
|
32
|
+
*
|
|
33
|
+
* Используйте компонент `Spinner`, если вам нужен спиннер, без дополнительного функционала, который предоставляет компонент Loader.
|
|
39
34
|
*/
|
|
40
35
|
export declare class Spinner extends React.Component<SpinnerProps> {
|
|
41
36
|
static __KONTUR_REACT_UI__: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
### Базовый пример
|
|
1
2
|
```jsx harmony
|
|
2
3
|
import { Gapped, Spinner } from '@skbkontur/react-ui';
|
|
3
4
|
|
|
@@ -18,7 +19,7 @@ const reactNodeCaption = (
|
|
|
18
19
|
</Gapped>;
|
|
19
20
|
```
|
|
20
21
|
|
|
21
|
-
|
|
22
|
+
### Локали по умолчанию
|
|
22
23
|
|
|
23
24
|
```typescript static
|
|
24
25
|
interface SpinnerLocale {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as SpinnerStories from './Spinner.docs.stories.tsx';
|
|
2
|
+
import { Primary, ArgTypes, Stories, Description } from '@storybook/blocks';
|
|
3
|
+
import { Meta } from '../../../.storybook/Meta';
|
|
4
|
+
|
|
5
|
+
<Meta of={SpinnerStories} />
|
|
6
|
+
|
|
7
|
+
# Spinner
|
|
8
|
+
|
|
9
|
+
[Компонент в Контур.Гайдах](https://guides.kontur.ru/components/progress-indicators/spinner/)
|
|
10
|
+
|
|
11
|
+
[Компонент в Figma](https://www.figma.com/file/87ScqxPzJpF9DcVBNYWOjM/%E2%9A%A1-Kontur-UI-Modern-Layout?node-id=396%3A15631)
|
|
12
|
+
|
|
13
|
+
<Description />
|
|
14
|
+
|
|
15
|
+
## Базовый пример
|
|
16
|
+
|
|
17
|
+
<Primary />
|
|
18
|
+
|
|
19
|
+
## Пропы
|
|
20
|
+
|
|
21
|
+
<details>
|
|
22
|
+
<summary>Открыть таблицу с пропами</summary>
|
|
23
|
+
<ArgTypes />
|
|
24
|
+
</details>
|
|
25
|
+
|
|
26
|
+
## Примеры использования
|
|
27
|
+
|
|
28
|
+
<Stories title="" includePrimary={false} />
|
|
@@ -18,6 +18,11 @@ var MAX_REFLOW_RETRIES = 5;
|
|
|
18
18
|
export var StickyDataTids = {
|
|
19
19
|
root: 'Sticky__root'
|
|
20
20
|
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* `Sticky` позволяет закреплять элемент интерфейса в определенной позиции на экране при прокрутке страницы.
|
|
24
|
+
* Это полезно для создания "прилипающих" элементов, которые остаются видимыми при прокрутке содержимого.
|
|
25
|
+
*/
|
|
21
26
|
export var Sticky = rootNode(_class = (_Sticky = /*#__PURE__*/function (_React$Component) {
|
|
22
27
|
function Sticky() {
|
|
23
28
|
var _this;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","PropTypes","shallowEqual","globalObject","LayoutEvents","isFunction","ZIndex","CommonWrapper","cx","rootNode","getDOMRect","createPropsGetter","styles","MAX_REFLOW_RETRIES","StickyDataTids","root","Sticky","_class","_Sticky","_React$Component","_this","_len","arguments","length","args","Array","_key","call","apply","concat","getProps","defaultProps","state","fixed","deltaHeight","stopped","relativeTop","layoutSubscription","remove","reflowCounter","refWrapper","ref","wrapper","refInner","inner","reflow","_globalObject$documen","document","documentElement","Error","windowHeight","innerHeight","clientHeight","_getDOMRect","top","bottom","left","width","_getDOMRect2","height","_this$props","props","getStop","side","_this$state","prevFixed","_this$state$height","prevHeight","offset","Math","floor","setState","stop","stopRect","outerHeight","_inheritsLoose","_proto","prototype","componentDidMount","addListener","componentWillUnmount","componentDidUpdate","prevProps","prevState","emit","render","_cx","children","_this$state2","innerStyle","createElement","_extends","rootNodeRef","setRootNode","className","priority","applyZIndex","style","wrapperRef","container","Component","__KONTUR_REACT_UI__","displayName","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 { Nullable } from '../../typings/utility-types';\nimport { isFunction } from '../../lib/utils';\nimport { ZIndex } from '../../internal/ZIndex';\nimport { CommonWrapper, CommonProps } from '../../internal/CommonWrapper';\nimport { cx } from '../../lib/theming/Emotion';\nimport { rootNode, TSetRootNode } 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 side: 'top' | 'bottom';\n /**\n * Отступ в пикселях от края экрана, на сколько сдвигается элемент в залипшем состоянии\n * @default 0\n */\n offset?: number;\n getStop?: () => Nullable<HTMLElement>;\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@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' ? 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":"oJAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,YAAY,MA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,EAAE,QAAQ,CAAC,CAAC,CAACC,UAAU,CACrD,CAAC,EAAA3F,OAAA,CAEaa,YAAY,GAAiB,EAAEqC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAAlD,OAAA,MAAAD,MAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["React","PropTypes","shallowEqual","globalObject","LayoutEvents","isFunction","ZIndex","CommonWrapper","cx","rootNode","getDOMRect","createPropsGetter","styles","MAX_REFLOW_RETRIES","StickyDataTids","root","Sticky","_class","_Sticky","_React$Component","_this","_len","arguments","length","args","Array","_key","call","apply","concat","getProps","defaultProps","state","fixed","deltaHeight","stopped","relativeTop","layoutSubscription","remove","reflowCounter","refWrapper","ref","wrapper","refInner","inner","reflow","_globalObject$documen","document","documentElement","Error","windowHeight","innerHeight","clientHeight","_getDOMRect","top","bottom","left","width","_getDOMRect2","height","_this$props","props","getStop","side","_this$state","prevFixed","_this$state$height","prevHeight","offset","Math","floor","setState","stop","stopRect","outerHeight","_inheritsLoose","_proto","prototype","componentDidMount","addListener","componentWillUnmount","componentDidUpdate","prevProps","prevState","emit","render","_cx","children","_this$state2","innerStyle","createElement","_extends","rootNodeRef","setRootNode","className","priority","applyZIndex","style","wrapperRef","container","Component","__KONTUR_REACT_UI__","displayName","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 { Nullable } from '../../typings/utility-types';\nimport { isFunction } from '../../lib/utils';\nimport { ZIndex } from '../../internal/ZIndex';\nimport { CommonWrapper, CommonProps } from '../../internal/CommonWrapper';\nimport { cx } from '../../lib/theming/Emotion';\nimport { rootNode, TSetRootNode } 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' ? 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":"oJAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,YAAY,MAAM,cAAc;AACvC,SAASC,YAAY,QAAQ,0BAA0B;;AAEvD,OAAO,KAAKC,YAAY,MAAM,wBAAwB;;AAEtD,SAASC,UAAU,QAAQ,iBAAiB;AAC5C,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,aAAa,QAAqB,8BAA8B;AACzE,SAASC,EAAE,QAAQ,2BAA2B;AAC9C,SAASC,QAAQ,QAAsB,oBAAoB;AAC3D,SAASC,UAAU,QAAQ,0BAA0B;AACrD,SAASC,iBAAiB,QAAQ,6BAA6B;;AAE/D,SAASC,MAAM,QAAQ,iBAAiB;;AAExC,IAAMC,kBAAkB,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2B5B,OAAO,IAAMC,cAAc,GAAG;EAC5BC,IAAI,EAAE;AACR,CAAU;;;;AAIV;AACA;AACA;AACA;AACA;AACaC,MAAM,GADlBP,QAAQ,CAAAQ,MAAA,IAAAC,OAAA,0BAAAC,gBAAA,YAAAH,OAAA,OAAAI,KAAA,UAAAC,I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O,gBAAGnC,KAAA,CAAA0F,aAAA,UAAKO,KAAK,EAAE,EAAExC,KAAK,EAALA,KAAK,EAAEE,MAAM,EAANA,MAAM,CAAC,CAAE,EAAE,CAAC,GAAG,IACtD,CACQ,CAAC,CAEpB,CAAC,QAAA3C,MAAA,GArGyBhB,KAAK,CAACoG,SAAS,GAAAlF,OAAA,CAC3BmF,mBAAmB,GAAG,QAAQ,EAAAnF,OAAA,CAC9BoF,WAAW,GAAG,QAAQ,EAAApF,OAAA,CAEtBqF,SAAS,GAAG,EACxBhB,QAAQ,EAAEtF,SAAS,CAACuG,SAAS,CAAC,CAACvG,SAAS,CAACwG,IAAI,EAAExG,SAAS,CAACyG,IAAI,CAAC,CAAC,EAE/D;AACJ;AACA,KACI5C,OAAO,EAAE7D,SAAS,CAACyG,IAAI,EAEvB;AACJ;AACA,KACItC,MAAM,EAAEnE,SAAS,CAAC0G,MAAM,EAExB5C,IAAI,EAAE9D,SAAS,CAAC2G,KAAK,CAAC,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAACC,UAAU,CACrD,CAAC,EAAA3F,OAAA,CAEaa,YAAY,GAAiB,EAAEqC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAAlD,OAAA,MAAAD,MAAA","ignoreList":[]}
|
|
@@ -3,13 +3,14 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import { Nullable } from '../../typings/utility-types';
|
|
4
4
|
import { CommonProps } from '../../internal/CommonWrapper';
|
|
5
5
|
export interface StickyProps extends Omit<CommonProps, 'children'> {
|
|
6
|
+
/** Задает сторону залипания. */
|
|
6
7
|
side: 'top' | 'bottom';
|
|
7
|
-
/**
|
|
8
|
-
*
|
|
9
|
-
* @default 0
|
|
10
|
-
*/
|
|
8
|
+
/** Задает отступ от края экрана в пикселях, на который сдвигается элемент в залипшем состоянии.
|
|
9
|
+
* @default 0 */
|
|
11
10
|
offset?: number;
|
|
11
|
+
/** Задает функцию, которая возвращает DOM-элемент, который нельзя пересекать. */
|
|
12
12
|
getStop?: () => Nullable<HTMLElement>;
|
|
13
|
+
/** @ignore */
|
|
13
14
|
children?: React.ReactNode | ((fixed: boolean) => React.ReactNode);
|
|
14
15
|
}
|
|
15
16
|
export interface StickyState {
|
|
@@ -25,6 +26,10 @@ export declare const StickyDataTids: {
|
|
|
25
26
|
readonly root: "Sticky__root";
|
|
26
27
|
};
|
|
27
28
|
type DefaultProps = Required<Pick<StickyProps, 'offset'>>;
|
|
29
|
+
/**
|
|
30
|
+
* `Sticky` позволяет закреплять элемент интерфейса в определенной позиции на экране при прокрутке страницы.
|
|
31
|
+
* Это полезно для создания "прилипающих" элементов, которые остаются видимыми при прокрутке содержимого.
|
|
32
|
+
*/
|
|
28
33
|
export declare class Sticky extends React.Component<StickyProps, StickyState> {
|
|
29
34
|
static __KONTUR_REACT_UI__: string;
|
|
30
35
|
static displayName: string;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as StickyStories from './Sticky.docs.stories.tsx';
|
|
2
|
+
import { Primary, ArgTypes, Stories, Description } from '@storybook/blocks';
|
|
3
|
+
import { Meta } from '../../../.storybook/Meta';
|
|
4
|
+
|
|
5
|
+
<Meta of={StickyStories} />
|
|
6
|
+
|
|
7
|
+
# Sticky
|
|
8
|
+
|
|
9
|
+
<Description />
|
|
10
|
+
|
|
11
|
+
## Базовый пример
|
|
12
|
+
|
|
13
|
+
<Primary />
|
|
14
|
+
|
|
15
|
+
## Пропы
|
|
16
|
+
|
|
17
|
+
<details>
|
|
18
|
+
<summary>Открыть таблицу с пропами</summary>
|
|
19
|
+
<ArgTypes />
|
|
20
|
+
</details>
|
|
21
|
+
|
|
22
|
+
## Примеры использования
|
|
23
|
+
|
|
24
|
+
<Stories title="" includePrimary={false} />
|
|
@@ -10,12 +10,19 @@ import { ThemeContext } from "../../../lib/theming/ThemeContext";
|
|
|
10
10
|
import { CommonWrapper } from "../../../internal/CommonWrapper";
|
|
11
11
|
import { cx } from "../../../lib/theming/Emotion";
|
|
12
12
|
import { rootNode } from "../../../lib/rootNode";
|
|
13
|
+
import { isThemeGTE } from "../../../lib/theming/ThemeHelpers";
|
|
13
14
|
import { styles } from "../Switcher.styles";
|
|
14
15
|
import { getSwitcherTheme } from "../switcherTheme";
|
|
15
16
|
import { mod } from "../helpers";
|
|
16
17
|
export var SwitcherDataTids = {
|
|
17
18
|
root: 'Switcher__root'
|
|
18
19
|
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Переключатель `Switcher` — это замена RadioGroup.
|
|
23
|
+
*
|
|
24
|
+
* Не используйте переключатель в качестве навигации, для этого лучше подходят Tabs.
|
|
25
|
+
*/
|
|
19
26
|
export var Switcher = rootNode(_class = (_Switcher = /*#__PURE__*/function (_React$Component) {
|
|
20
27
|
function Switcher() {
|
|
21
28
|
var _this;
|
|
@@ -177,8 +184,6 @@ export var Switcher = rootNode(_class = (_Switcher = /*#__PURE__*/function (_Rea
|
|
|
177
184
|
});
|
|
178
185
|
};
|
|
179
186
|
_proto.renderMain = function renderMain() {
|
|
180
|
-
var _cx;
|
|
181
|
-
var listClassName = cx((_cx = {}, _cx[styles.error(this.theme)] = !!this.props.error, _cx));
|
|
182
187
|
var inputProps = {
|
|
183
188
|
type: 'checkbox',
|
|
184
189
|
onKeyDown: this.handleKey,
|
|
@@ -186,7 +191,12 @@ export var Switcher = rootNode(_class = (_Switcher = /*#__PURE__*/function (_Rea
|
|
|
186
191
|
onBlur: this._handleBlur,
|
|
187
192
|
className: styles.input()
|
|
188
193
|
};
|
|
194
|
+
var isThemeGTE_5_1 = isThemeGTE(this.theme, '5.1');
|
|
195
|
+
var isTheme_5_0 = !isThemeGTE_5_1;
|
|
196
|
+
var items = /*#__PURE__*/React.createElement(Group, null, this._renderItems());
|
|
189
197
|
var captionClassName = cx(styles.caption(this.theme), this.getLabelSizeClassName());
|
|
198
|
+
var wrapperClassName = cx(styles.wrap(), isThemeGTE_5_1 && this.props.error && styles.error5_1(this.theme));
|
|
199
|
+
var errorClassName = cx(isTheme_5_0 && this.props.error && styles.error(this.theme));
|
|
190
200
|
return /*#__PURE__*/React.createElement(CommonWrapper, _extends({
|
|
191
201
|
rootNodeRef: this.setRootNode
|
|
192
202
|
}, this.props), /*#__PURE__*/React.createElement("div", {
|
|
@@ -195,10 +205,10 @@ export var Switcher = rootNode(_class = (_Switcher = /*#__PURE__*/function (_Rea
|
|
|
195
205
|
}, this.props.caption ? /*#__PURE__*/React.createElement("div", {
|
|
196
206
|
className: captionClassName
|
|
197
207
|
}, this.props.caption) : null, /*#__PURE__*/React.createElement("div", {
|
|
198
|
-
className:
|
|
199
|
-
}, /*#__PURE__*/React.createElement("input", inputProps), /*#__PURE__*/React.createElement("div", {
|
|
200
|
-
className:
|
|
201
|
-
},
|
|
208
|
+
className: wrapperClassName
|
|
209
|
+
}, /*#__PURE__*/React.createElement("input", inputProps), isThemeGTE_5_1 ? items : /*#__PURE__*/React.createElement("div", {
|
|
210
|
+
className: errorClassName
|
|
211
|
+
}, items))));
|
|
202
212
|
};
|
|
203
213
|
return Switcher;
|
|
204
214
|
}(React.Component), _Switcher.__KONTUR_REACT_UI__ = 'Switcher', _Switcher.displayName = 'Switcher', _Switcher.defaultProps = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","PropTypes","isKeyArrowHorizontal","isKeyArrowLeft","isKeyEnter","getButtonCorners","Group","Button","ThemeContext","CommonWrapper","cx","rootNode","styles","getSwitcherTheme","mod","SwitcherDataTids","root","Switcher","_class","_Switcher","_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","_this$_extractPropsFr2","buttonProps","disabled","preventDefault","move","left","selectedIndex","newFocusedIndex","_getNextFocusedIndex","_this$props","i","_this$_extractPropsFr3","_handleFocus","currentIndex","indexOf","_handleBlur","_renderItems","_this$props2","size","role","renderItem","_this$_extractPropsFr4","ariaLabel","itemValue","customButtonProps","isChecked","commonButtonProps","checked","visuallyFocused","onClick","disableFocus","corners","_extends","renderDefault","renderDefaultItem","createElement","key","getLabelSizeClassName","captionLarge","theme","captionMedium","captionSmall","_inheritsLoose","_proto","prototype","render","_this2","Consumer","Provider","renderMain","_cx","listClassName","error","inputProps","type","onKeyDown","onFocus","onBlur","className","input","captionClassName","caption","rootNodeRef","setRootNode","wrap","Component","__KONTUR_REACT_UI__","displayName","defaultProps","propTypes","bool","oneOfType","arrayOf","string","shape","isRequired","func"],"sources":["Switcher.tsx"],"sourcesContent":["import React, { HTMLAttributes } from 'react';\nimport PropTypes from 'prop-types';\n\nimport { isKeyArrowHorizontal, isKeyArrowLeft, isKeyEnter } from '../../lib/events/keyboard/identifiers';\nimport { getButtonCorners, Group } from '../Group';\nimport { Button, ButtonProps } from '../Button';\nimport { Nullable } from '../../typings/utility-types';\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport { Theme } from '../../lib/theming/Theme';\nimport { CommonProps, CommonWrapper } from '../../internal/CommonWrapper';\nimport { cx } from '../../lib/theming/Emotion';\nimport { rootNode, TSetRootNode } from '../../lib/rootNode';\nimport { SizeProp } from '../../lib/types/props';\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 /**\n * Список строк или список элементов типа `{ label: string, value: string, buttonProps?: Partial<ButtonProps> }`\n */\n items: SwitcherItems[];\n\n value?: string;\n\n onValueChange?: (value: string) => void;\n\n caption?: string;\n\n error?: boolean;\n\n /** Размер */\n size?: SizeProp;\n\n disabled?: boolean;\n\n /**\n * Функция для отрисовки элемента. Аргументы — `label`,\n * `value`, `buttonProps`, `renderDefault`, `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@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 listClassName = cx({\n [styles.error(this.theme)]: !!this.props.error,\n });\n\n const inputProps = {\n type: 'checkbox',\n onKeyDown: this.handleKey,\n onFocus: this._handleFocus,\n onBlur: this._handleBlur,\n className: styles.input(),\n };\n\n const captionClassName = cx(styles.caption(this.theme), this.getLabelSizeClassName());\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={styles.wrap()}>\n <input {...inputProps} />\n <div className={listClassName}>\n <Group>{this._renderItems()}</Group>\n </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":"sJAAA,OAAOA,KAAK,MAA0B,OAAO;AAC7C,OAAOC,SAAS,MAAM,YAAY;;AAElC,SAASC,oBAAoB,EAAEC,cAAc,EAAEC,UAAU,QAAQ,uCAAuC;AACxG,SAASC,gBAAgB,EAAEC,KAAK,QAAQ,UAAU;AAClD,SAASC,MAAM,QAAqB,WAAW;;AAE/C,SAASC,YAAY,QAAQ,gCAAgC;;AAE7D,SAAsBC,aAAa,QAAQ,8BAA8B;AACzE,SAASC,EAAE,QAAQ,2BAA2B;AAC9C,SAASC,QAAQ,QAAsB,oBAAoB;;;AAG3D,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,gBAAgB,QAAQ,iBAAiB;AAClD,SAASC,GAAG,QAAQ,WAAW;;;;AAI/B,OAAO,IAAMC,gBAAgB,GAAG;EAC9BC,IAAI,EAAE;AACR,CA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IAAI,CAC5B,CAAC,EAAA1G,SAAA,MAAAD,MAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["React","PropTypes","isKeyArrowHorizontal","isKeyArrowLeft","isKeyEnter","getButtonCorners","Group","Button","ThemeContext","CommonWrapper","cx","rootNode","isThemeGTE","styles","getSwitcherTheme","mod","SwitcherDataTids","root","Switcher","_class","_Switcher","_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","_this$_extractPropsFr2","buttonProps","disabled","preventDefault","move","left","selectedIndex","newFocusedIndex","_getNextFocusedIndex","_this$props","i","_this$_extractPropsFr3","_handleFocus","currentIndex","indexOf","_handleBlur","_renderItems","_this$props2","size","role","renderItem","_this$_extractPropsFr4","ariaLabel","itemValue","customButtonProps","isChecked","commonButtonProps","checked","visuallyFocused","onClick","disableFocus","corners","_extends","renderDefault","renderDefaultItem","createElement","key","getLabelSizeClassName","captionLarge","theme","captionMedium","captionSmall","_inheritsLoose","_proto","prototype","render","_this2","Consumer","Provider","renderMain","inputProps","type","onKeyDown","onFocus","onBlur","className","input","isThemeGTE_5_1","isTheme_5_0","captionClassName","caption","wrapperClassName","wrap","error","error5_1","errorClassName","rootNodeRef","setRootNode","Component","__KONTUR_REACT_UI__","displayName","defaultProps","propTypes","bool","oneOfType","arrayOf","string","shape","isRequired","func"],"sources":["Switcher.tsx"],"sourcesContent":["import React, { HTMLAttributes } from 'react';\nimport PropTypes from 'prop-types';\n\nimport { isKeyArrowHorizontal, isKeyArrowLeft, isKeyEnter } from '../../lib/events/keyboard/identifiers';\nimport { getButtonCorners, Group } from '../Group';\nimport { Button, ButtonProps } from '../Button';\nimport { Nullable } from '../../typings/utility-types';\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport { Theme } from '../../lib/theming/Theme';\nimport { CommonProps, CommonWrapper } from '../../internal/CommonWrapper';\nimport { cx } from '../../lib/theming/Emotion';\nimport { rootNode, TSetRootNode } from '../../lib/rootNode';\nimport { 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":"sJAAA,OAAOA,KAAK,MAA0B,OAAO;AAC7C,OAAOC,SAAS,MAAM,YAAY;;AAElC,SAASC,oBAAoB,EAAEC,cAAc,EAAEC,UAAU,QAAQ,uCAAuC;AACxG,SAASC,gBAAgB,EAAEC,KAAK,QAAQ,UAAU;AAClD,SAASC,MAAM,QAAqB,WAAW;;AAE/C,SAASC,YAAY,QAAQ,gCAAgC;;AAE7D,SAAsBC,aAAa,QAAQ,8BAA8B;AACzE,SAASC,EAAE,QAAQ,2BAA2B;AAC9C,SAASC,QAAQ,QAAsB,oBAAoB;;AAE3D,SAASC,UAAU,QAAQ,gCAAgC;;AAE3D,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,gBAAgB,QAAQ,iBAAiB;AAClD,SAASC,GAAG,QAAQ,WAAW;;;;AAI/B,OAAO,IAAMC,gBAAgB,GAAG;EAC9BC,IAAI,EAAE;AACR,CAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDV;AACA;AACA;AACA;AACA;AACA;AACaC,QAAQ,GADpBP,QAAQ,CAAAQ,MAAA,IAAAC,SAAA,0BAAAC,gBAAA,YAAAH,SAA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,EAAE7G,SAAS,CAAC6H,MAAM,EACzB3F,KAAK,EAAElC,SAAS,CAAC6H,MAAM,EACvBzF,aAAa,EAAEpC,SAAS,CAACgI,IAAI,EAC7B3D,UAAU,EAAErE,SAAS,CAACgI,IAAI,CAC5B,CAAC,EAAA7G,SAAA,MAAAD,MAAA","ignoreList":[]}
|
|
@@ -9,20 +9,26 @@ export declare const SwitcherDataTids: {
|
|
|
9
9
|
readonly root: "Switcher__root";
|
|
10
10
|
};
|
|
11
11
|
export interface SwitcherProps extends Pick<HTMLAttributes<unknown>, 'role'>, CommonProps {
|
|
12
|
-
/**
|
|
13
|
-
* Список строк или список элементов типа `{ label: string, value: string, buttonProps?: Partial<ButtonProps> }`
|
|
14
|
-
*/
|
|
12
|
+
/** Задает список строк или список элементов типа `{ label: string, value: string, buttonProps?: Partial<ButtonProps> }`. */
|
|
15
13
|
items: SwitcherItems[];
|
|
14
|
+
/** Устанавливает значение свитчера. */
|
|
16
15
|
value?: string;
|
|
16
|
+
/** Задает функцию, которая вызывается при изменении значения свитчера (value). */
|
|
17
17
|
onValueChange?: (value: string) => void;
|
|
18
|
+
/** Задает подпись около свитчера. */
|
|
18
19
|
caption?: string;
|
|
20
|
+
/** Переводит контрол в состояние валидации "ошибка". */
|
|
19
21
|
error?: boolean;
|
|
20
|
-
/**
|
|
22
|
+
/** Задает размер контрола. */
|
|
21
23
|
size?: SizeProp;
|
|
24
|
+
/** Делает компонент недоступным. */
|
|
22
25
|
disabled?: boolean;
|
|
23
|
-
/**
|
|
24
|
-
*
|
|
25
|
-
* `value
|
|
26
|
+
/** Задает функцию отрисовки элемента.
|
|
27
|
+
* @param `label` -
|
|
28
|
+
* @param `value` -
|
|
29
|
+
* @param `buttonProps` -
|
|
30
|
+
* @param `renderDefault` -
|
|
31
|
+
* @param `ariaLabel` -
|
|
26
32
|
*/
|
|
27
33
|
renderItem?: (label: string, value: string, buttonProps: ButtonProps, renderDefault: () => React.ReactNode, ariaLabel?: string) => React.ReactNode;
|
|
28
34
|
}
|
|
@@ -36,6 +42,11 @@ interface SwitcherItem {
|
|
|
36
42
|
'aria-label'?: string;
|
|
37
43
|
buttonProps?: Partial<ButtonProps>;
|
|
38
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Переключатель `Switcher` — это замена RadioGroup.
|
|
47
|
+
*
|
|
48
|
+
* Не используйте переключатель в качестве навигации, для этого лучше подходят Tabs.
|
|
49
|
+
*/
|
|
39
50
|
export declare class Switcher extends React.Component<SwitcherProps, SwitcherState> {
|
|
40
51
|
static __KONTUR_REACT_UI__: string;
|
|
41
52
|
static displayName: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
### Базовый пример
|
|
1
2
|
```jsx harmony
|
|
2
3
|
const [value, setValue] = React.useState();
|
|
3
4
|
|
|
@@ -9,7 +10,8 @@ const [value, setValue] = React.useState();
|
|
|
9
10
|
/>;
|
|
10
11
|
```
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
### items в виде объектов
|
|
14
|
+
Случай, когда `items` принимает объект типа `{ label: string, value: string }`
|
|
13
15
|
|
|
14
16
|
```jsx harmony
|
|
15
17
|
const [value, setValue] = React.useState();
|
|
@@ -36,7 +38,8 @@ const items = [
|
|
|
36
38
|
/>;
|
|
37
39
|
```
|
|
38
40
|
|
|
39
|
-
|
|
41
|
+
### Кастомизация кнопки
|
|
42
|
+
Вариант `items` с полем `buttonProps`, который позволяет кастомизировать кнопку
|
|
40
43
|
|
|
41
44
|
```jsx harmony
|
|
42
45
|
const [value, setValue] = React.useState();
|
|
@@ -75,6 +78,7 @@ const items = [
|
|
|
75
78
|
/>;
|
|
76
79
|
```
|
|
77
80
|
|
|
81
|
+
### Кастомизация items
|
|
78
82
|
Пример с методом `renderItem` для кастомизации `items`:
|
|
79
83
|
|
|
80
84
|
```jsx harmony
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _taggedTemplateLiteralLoose from "@babel/runtime/helpers/esm/taggedTemplateLiteralLoose";
|
|
2
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
|
|
3
3
|
import { css, memoizeStyle } from "../../../lib/theming/Emotion";
|
|
4
4
|
export var styles = memoizeStyle({
|
|
5
5
|
root: function root() {
|
|
@@ -27,5 +27,8 @@ export var styles = memoizeStyle({
|
|
|
27
27
|
var insideWidth = parseInt(t.btnBorderWidth);
|
|
28
28
|
var outsideWidth = parseInt(t.switcherOutlineWidth) - insideWidth + "px";
|
|
29
29
|
return css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteralLoose(["\n border-radius: ", ";\n box-shadow:\n inset 0 0 0 ", "px ", ",\n 0 0 0 ", " ", ";\n "])), t.switcherBorderRadius, insideWidth, t.borderColorError, outsideWidth, t.borderColorError);
|
|
30
|
+
},
|
|
31
|
+
error5_1: function error5_1(t) {
|
|
32
|
+
return css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteralLoose(["\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 "])), t.switcherBorderRadius, t.switcherOutlineWidth, t.borderColorError);
|
|
30
33
|
}
|
|
31
34
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["css","memoizeStyle","styles","root","_templateObject","_taggedTemplateLiteralLoose","wrap","_templateObject2","input","_templateObject3","caption","t","_templateObject4","switcherTextColor","captionSmall","_templateObject5","switcherCaptionGapSmall","switcherCaptionFontSizeSmall","switcherCaptionLineHeightSmall","captionMedium","_templateObject6","switcherCaptionGapMedium","switcherCaptionFontSizeMedium","switcherCaptionLineHeightMedium","captionLarge","_templateObject7","switcherCaptionGapLarge","switcherCaptionFontSizeLarge","switcherCaptionLineHeightLarge","error","insideWidth","parseInt","btnBorderWidth","outsideWidth","switcherOutlineWidth","_templateObject8","switcherBorderRadius","borderColorError"],"sources":["Switcher.styles.ts"],"sourcesContent":["import { css, memoizeStyle } from '../../lib/theming/Emotion';\nimport { 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"],"mappings":"
|
|
1
|
+
{"version":3,"names":["css","memoizeStyle","styles","root","_templateObject","_taggedTemplateLiteralLoose","wrap","_templateObject2","input","_templateObject3","caption","t","_templateObject4","switcherTextColor","captionSmall","_templateObject5","switcherCaptionGapSmall","switcherCaptionFontSizeSmall","switcherCaptionLineHeightSmall","captionMedium","_templateObject6","switcherCaptionGapMedium","switcherCaptionFontSizeMedium","switcherCaptionLineHeightMedium","captionLarge","_templateObject7","switcherCaptionGapLarge","switcherCaptionFontSizeLarge","switcherCaptionLineHeightLarge","error","insideWidth","parseInt","btnBorderWidth","outsideWidth","switcherOutlineWidth","_templateObject8","switcherBorderRadius","borderColorError","error5_1","_templateObject9"],"sources":["Switcher.styles.ts"],"sourcesContent":["import { css, memoizeStyle } from '../../lib/theming/Emotion';\nimport { 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;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B;IAC5Bf,CAAC,CAACgB,4BAA4B;IAC5BhB,CAAC,CAACiB,8BAA8B;;EAEnD,CAAC;;EAEDC,KAAK,WAAAA,MAAClB,CAAQ,EAAE;IACd,IAAMmB,WAAW,GAAGC,QAAQ,CAACpB,CAAC,CAACqB,cAAc,CAAC;IAC9C,IAAMC,YAAY,GAAMF,QAAQ,CAACpB,CAAC,CAACuB,oBAAoB,CAAC,GAAGJ,WAAW,OAAI;IAC1E,OAAO9B,GAAG,CAAAmC,gBAAA,KAAAA,gBAAA,GAAA9B,2BAAA;IACSM,CAAC,CAACyB,oBAAoB;;IAEvBN,WAAW,EAAMnB,CAAC,CAAC0B,gBAAgB;IACzCJ,YAAY,EAAItB,CAAC,CAAC0B,gBAAgB;;EAEhD,CAAC;;EAEDC,QAAQ,WAAAA,SAAC3B,CAAQ,EAAE;IACjB,OAAOX,GAAG,CAAAuC,gBAAA,KAAAA,gBAAA,GAAAlC,2BAAA;;;;;;;;;;;;IAYWM,CAAC,CAACyB,oBAAoB;IACnBzB,CAAC,CAACuB,oBAAoB,EAAIvB,CAAC,CAAC0B,gBAAgB;;;EAGtE;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as SwitcherStories from './Switcher.docs.stories.tsx';
|
|
2
|
+
import { Primary, ArgTypes, Stories, Description } from '@storybook/blocks';
|
|
3
|
+
import { Meta } from '../../../.storybook/Meta';
|
|
4
|
+
|
|
5
|
+
<Meta of={SwitcherStories} />
|
|
6
|
+
|
|
7
|
+
# Switcher
|
|
8
|
+
|
|
9
|
+
[Компонент в Контур.Гайдах](https://guides.kontur.ru/components/selection-elements/switcher/)
|
|
10
|
+
|
|
11
|
+
[Компонент в Figma](https://www.figma.com/file/87ScqxPzJpF9DcVBNYWOjM/%E2%9A%A1-Kontur-UI-Modern-Layout?node-id=281%3A17973)
|
|
12
|
+
|
|
13
|
+
<Description />
|
|
14
|
+
|
|
15
|
+
## Базовый пример
|
|
16
|
+
|
|
17
|
+
<Primary />
|
|
18
|
+
|
|
19
|
+
## Пропы
|
|
20
|
+
|
|
21
|
+
<details>
|
|
22
|
+
<summary>Открыть таблицу с пропами</summary>
|
|
23
|
+
<ArgTypes />
|
|
24
|
+
</details>
|
|
25
|
+
|
|
26
|
+
## Примеры использования
|
|
27
|
+
|
|
28
|
+
<Stories title="" includePrimary={false} />
|