@forgedevstack/bear 1.1.3 → 1.1.8
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/README.md +19 -0
- package/dist/components/ActionIcon/ActionIcon.cjs +1 -0
- package/dist/components/ActionIcon/ActionIcon.const.cjs +1 -0
- package/dist/components/ActionIcon/ActionIcon.const.d.ts +7 -0
- package/dist/components/ActionIcon/ActionIcon.const.js +68 -0
- package/dist/components/ActionIcon/ActionIcon.d.ts +4 -0
- package/dist/components/ActionIcon/ActionIcon.js +42 -0
- package/dist/components/ActionIcon/ActionIcon.types.d.ts +11 -0
- package/dist/components/ActionIcon/index.d.ts +2 -0
- package/dist/components/Affix/Affix.cjs +1 -0
- package/dist/components/Affix/Affix.const.cjs +1 -0
- package/dist/components/Affix/Affix.const.d.ts +6 -0
- package/dist/components/Affix/Affix.const.js +9 -0
- package/dist/components/Affix/Affix.d.ts +4 -0
- package/dist/components/Affix/Affix.js +69 -0
- package/dist/components/Affix/Affix.types.d.ts +10 -0
- package/dist/components/Affix/index.d.ts +2 -0
- package/dist/components/Anchor/Anchor.cjs +1 -0
- package/dist/components/Anchor/Anchor.const.cjs +1 -0
- package/dist/components/Anchor/Anchor.const.d.ts +9 -0
- package/dist/components/Anchor/Anchor.const.js +11 -0
- package/dist/components/Anchor/Anchor.d.ts +4 -0
- package/dist/components/Anchor/Anchor.js +83 -0
- package/dist/components/Anchor/Anchor.types.d.ts +16 -0
- package/dist/components/Anchor/Anchor.utils.cjs +1 -0
- package/dist/components/Anchor/Anchor.utils.d.ts +2 -0
- package/dist/components/Anchor/Anchor.utils.js +12 -0
- package/dist/components/Anchor/index.d.ts +2 -0
- package/dist/components/Autocomplete/Autocomplete.cjs +1 -1
- package/dist/components/Autocomplete/Autocomplete.js +60 -67
- package/dist/components/Autocomplete/Autocomplete.utils.cjs +1 -0
- package/dist/components/Autocomplete/Autocomplete.utils.d.ts +2 -0
- package/dist/components/Autocomplete/Autocomplete.utils.js +12 -0
- package/dist/components/BackTop/BackTop.cjs +1 -1
- package/dist/components/BackTop/BackTop.js +10 -11
- package/dist/components/Blockquote/Blockquote.cjs +1 -0
- package/dist/components/Blockquote/Blockquote.const.cjs +1 -0
- package/dist/components/Blockquote/Blockquote.const.d.ts +5 -0
- package/dist/components/Blockquote/Blockquote.const.js +19 -0
- package/dist/components/Blockquote/Blockquote.d.ts +4 -0
- package/dist/components/Blockquote/Blockquote.js +56 -0
- package/dist/components/Blockquote/Blockquote.types.d.ts +9 -0
- package/dist/components/Blockquote/index.d.ts +2 -0
- package/dist/components/Button/Button.cjs +1 -1
- package/dist/components/Button/Button.constants.cjs +2 -2
- package/dist/components/Button/Button.constants.d.ts +1 -0
- package/dist/components/Button/Button.constants.js +12 -5
- package/dist/components/Button/Button.d.ts +0 -27
- package/dist/components/Button/Button.js +93 -105
- package/dist/components/Button/Button.types.d.ts +1 -0
- package/dist/components/Button/Button.utils.cjs +1 -0
- package/dist/components/Button/Button.utils.d.ts +2 -0
- package/dist/components/Button/Button.utils.js +5 -0
- package/dist/components/Button/useSpotlight.cjs +1 -0
- package/dist/components/Button/useSpotlight.d.ts +21 -0
- package/dist/components/Button/useSpotlight.js +28 -0
- package/dist/components/Chart/Chart.cjs +1 -1
- package/dist/components/Chart/Chart.const.cjs +1 -0
- package/dist/components/Chart/Chart.const.js +21 -0
- package/dist/components/Chart/Chart.js +55 -71
- package/dist/components/Chart/Chart.utils.cjs +1 -0
- package/dist/components/Chart/Chart.utils.js +5 -0
- package/dist/components/CheckboxCard/CheckboxCard.cjs +1 -0
- package/dist/components/CheckboxCard/CheckboxCard.const.cjs +1 -0
- package/dist/components/CheckboxCard/CheckboxCard.const.d.ts +7 -0
- package/dist/components/CheckboxCard/CheckboxCard.const.js +22 -0
- package/dist/components/CheckboxCard/CheckboxCard.d.ts +5 -0
- package/dist/components/CheckboxCard/CheckboxCard.js +132 -0
- package/dist/components/CheckboxCard/CheckboxCard.types.d.ts +21 -0
- package/dist/components/CheckboxCard/index.d.ts +2 -0
- package/dist/components/ColorPicker/ColorPicker.cjs +1 -1
- package/dist/components/ColorPicker/ColorPicker.const.cjs +1 -0
- package/dist/components/ColorPicker/ColorPicker.const.d.ts +26 -0
- package/dist/components/ColorPicker/ColorPicker.const.js +38 -0
- package/dist/components/ColorPicker/ColorPicker.js +61 -78
- package/dist/components/ColorSwatch/ColorSwatch.cjs +1 -0
- package/dist/components/ColorSwatch/ColorSwatch.const.cjs +1 -0
- package/dist/components/ColorSwatch/ColorSwatch.const.d.ts +16 -0
- package/dist/components/ColorSwatch/ColorSwatch.const.js +19 -0
- package/dist/components/ColorSwatch/ColorSwatch.d.ts +5 -0
- package/dist/components/ColorSwatch/ColorSwatch.js +92 -0
- package/dist/components/ColorSwatch/ColorSwatch.types.d.ts +23 -0
- package/dist/components/ColorSwatch/ColorSwatch.utils.cjs +1 -0
- package/dist/components/ColorSwatch/ColorSwatch.utils.d.ts +6 -0
- package/dist/components/ColorSwatch/ColorSwatch.utils.js +14 -0
- package/dist/components/ColorSwatch/index.d.ts +2 -0
- package/dist/components/Confetti/Confetti.cjs +1 -1
- package/dist/components/Confetti/Confetti.js +37 -34
- package/dist/components/ContextMenu/ContextMenu.cjs +1 -0
- package/dist/components/ContextMenu/ContextMenu.const.cjs +1 -0
- package/dist/components/ContextMenu/ContextMenu.const.d.ts +9 -0
- package/dist/components/ContextMenu/ContextMenu.const.js +12 -0
- package/dist/components/ContextMenu/ContextMenu.d.ts +4 -0
- package/dist/components/ContextMenu/ContextMenu.js +65 -0
- package/dist/components/ContextMenu/ContextMenu.types.d.ts +23 -0
- package/dist/components/ContextMenu/ContextMenu.utils.cjs +1 -0
- package/dist/components/ContextMenu/ContextMenu.utils.d.ts +5 -0
- package/dist/components/ContextMenu/ContextMenu.utils.js +4 -0
- package/dist/components/ContextMenu/index.d.ts +2 -0
- package/dist/components/CountdownTimer/CountdownTimer.cjs +1 -1
- package/dist/components/CountdownTimer/CountdownTimer.js +62 -71
- package/dist/components/CountdownTimer/CountdownTimer.utils.cjs +1 -0
- package/dist/components/CountdownTimer/CountdownTimer.utils.d.ts +3 -0
- package/dist/components/CountdownTimer/CountdownTimer.utils.js +16 -0
- package/dist/components/DateRangePicker/DateRangePicker.cjs +1 -0
- package/dist/components/DateRangePicker/DateRangePicker.const.cjs +1 -0
- package/dist/components/DateRangePicker/DateRangePicker.const.d.ts +27 -0
- package/dist/components/DateRangePicker/DateRangePicker.const.js +74 -0
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +4 -0
- package/dist/components/DateRangePicker/DateRangePicker.js +115 -0
- package/dist/components/DateRangePicker/DateRangePicker.types.d.ts +26 -0
- package/dist/components/DateRangePicker/DateRangePicker.utils.cjs +1 -0
- package/dist/components/DateRangePicker/DateRangePicker.utils.d.ts +4 -0
- package/dist/components/DateRangePicker/DateRangePicker.utils.js +22 -0
- package/dist/components/DateRangePicker/index.d.ts +2 -0
- package/dist/components/Descriptions/Descriptions.cjs +1 -0
- package/dist/components/Descriptions/Descriptions.const.cjs +1 -0
- package/dist/components/Descriptions/Descriptions.const.d.ts +24 -0
- package/dist/components/Descriptions/Descriptions.const.js +27 -0
- package/dist/components/Descriptions/Descriptions.d.ts +4 -0
- package/dist/components/Descriptions/Descriptions.js +65 -0
- package/dist/components/Descriptions/Descriptions.types.d.ts +16 -0
- package/dist/components/Descriptions/index.d.ts +2 -0
- package/dist/components/Dock/Dock.cjs +1 -1
- package/dist/components/Dock/Dock.js +38 -43
- package/dist/components/Dock/Dock.utils.cjs +1 -0
- package/dist/components/Dock/Dock.utils.d.ts +1 -0
- package/dist/components/Dock/Dock.utils.js +10 -0
- package/dist/components/Dropdown/Dropdown.cjs +1 -1
- package/dist/components/Dropdown/Dropdown.js +59 -60
- package/dist/components/Fieldset/Fieldset.cjs +1 -0
- package/dist/components/Fieldset/Fieldset.const.cjs +1 -0
- package/dist/components/Fieldset/Fieldset.const.d.ts +5 -0
- package/dist/components/Fieldset/Fieldset.const.js +16 -0
- package/dist/components/Fieldset/Fieldset.d.ts +4 -0
- package/dist/components/Fieldset/Fieldset.js +47 -0
- package/dist/components/Fieldset/Fieldset.types.d.ts +10 -0
- package/dist/components/Fieldset/index.d.ts +2 -0
- package/dist/components/FileTree/FileTree.cjs +1 -1
- package/dist/components/FileTree/FileTree.js +20 -32
- package/dist/components/FileTree/FileTree.utils.cjs +1 -0
- package/dist/components/FileTree/FileTree.utils.d.ts +4 -0
- package/dist/components/FileTree/FileTree.utils.js +15 -0
- package/dist/components/GradientText/GradientText.cjs +1 -1
- package/dist/components/GradientText/GradientText.js +27 -29
- package/dist/components/Icon/icons/bear.cjs +1 -0
- package/dist/components/Icon/icons/bear.d.ts +12 -0
- package/dist/components/Icon/icons/bear.js +47 -0
- package/dist/components/Icon/index.cjs +1 -1
- package/dist/components/Icon/index.d.ts +18 -0
- package/dist/components/Icon/index.js +17 -15
- package/dist/components/ImageGallery/ImageGallery.cjs +1 -0
- package/dist/components/ImageGallery/ImageGallery.const.cjs +1 -0
- package/dist/components/ImageGallery/ImageGallery.const.d.ts +13 -0
- package/dist/components/ImageGallery/ImageGallery.const.js +16 -0
- package/dist/components/ImageGallery/ImageGallery.d.ts +4 -0
- package/dist/components/ImageGallery/ImageGallery.js +61 -0
- package/dist/components/ImageGallery/ImageGallery.types.d.ts +22 -0
- package/dist/components/ImageGallery/index.d.ts +2 -0
- package/dist/components/Indicator/Indicator.cjs +1 -0
- package/dist/components/Indicator/Indicator.const.cjs +1 -0
- package/dist/components/Indicator/Indicator.const.d.ts +15 -0
- package/dist/components/Indicator/Indicator.const.js +26 -0
- package/dist/components/Indicator/Indicator.d.ts +4 -0
- package/dist/components/Indicator/Indicator.js +56 -0
- package/dist/components/Indicator/Indicator.types.d.ts +16 -0
- package/dist/components/Indicator/index.d.ts +2 -0
- package/dist/components/InfiniteScroll/InfiniteScroll.cjs +1 -0
- package/dist/components/InfiniteScroll/InfiniteScroll.const.cjs +1 -0
- package/dist/components/InfiniteScroll/InfiniteScroll.const.d.ts +7 -0
- package/dist/components/InfiniteScroll/InfiniteScroll.const.js +9 -0
- package/dist/components/InfiniteScroll/InfiniteScroll.d.ts +4 -0
- package/dist/components/InfiniteScroll/InfiniteScroll.js +51 -0
- package/dist/components/InfiniteScroll/InfiniteScroll.types.d.ts +13 -0
- package/dist/components/InfiniteScroll/index.d.ts +2 -0
- package/dist/components/Input/Input.cjs +1 -1
- package/dist/components/Input/Input.js +99 -66
- package/dist/components/Input/Input.types.d.ts +10 -0
- package/dist/components/Input/Input.utils.cjs +1 -0
- package/dist/components/Input/Input.utils.d.ts +2 -0
- package/dist/components/Input/Input.utils.js +15 -0
- package/dist/components/Input/index.d.ts +1 -1
- package/dist/components/LoadingOverlay/LoadingOverlay.cjs +1 -0
- package/dist/components/LoadingOverlay/LoadingOverlay.const.cjs +1 -0
- package/dist/components/LoadingOverlay/LoadingOverlay.const.d.ts +6 -0
- package/dist/components/LoadingOverlay/LoadingOverlay.const.js +9 -0
- package/dist/components/LoadingOverlay/LoadingOverlay.d.ts +4 -0
- package/dist/components/LoadingOverlay/LoadingOverlay.js +42 -0
- package/dist/components/LoadingOverlay/LoadingOverlay.types.d.ts +11 -0
- package/dist/components/LoadingOverlay/index.d.ts +2 -0
- package/dist/components/MentionsInput/MentionsInput.cjs +1 -1
- package/dist/components/MentionsInput/MentionsInput.js +64 -68
- package/dist/components/MentionsInput/MentionsInput.utils.cjs +1 -0
- package/dist/components/MentionsInput/MentionsInput.utils.d.ts +2 -0
- package/dist/components/MentionsInput/MentionsInput.utils.js +9 -0
- package/dist/components/NumberFormatter/NumberFormatter.cjs +1 -0
- package/dist/components/NumberFormatter/NumberFormatter.const.cjs +1 -0
- package/dist/components/NumberFormatter/NumberFormatter.const.d.ts +5 -0
- package/dist/components/NumberFormatter/NumberFormatter.const.js +8 -0
- package/dist/components/NumberFormatter/NumberFormatter.d.ts +4 -0
- package/dist/components/NumberFormatter/NumberFormatter.js +53 -0
- package/dist/components/NumberFormatter/NumberFormatter.types.d.ts +20 -0
- package/dist/components/NumberFormatter/NumberFormatter.utils.cjs +1 -0
- package/dist/components/NumberFormatter/NumberFormatter.utils.d.ts +2 -0
- package/dist/components/NumberFormatter/NumberFormatter.utils.js +19 -0
- package/dist/components/NumberFormatter/index.d.ts +2 -0
- package/dist/components/PageNav/PageNav.cjs +1 -0
- package/dist/components/PageNav/PageNav.const.cjs +1 -0
- package/dist/components/PageNav/PageNav.const.d.ts +22 -0
- package/dist/components/PageNav/PageNav.const.js +42 -0
- package/dist/components/PageNav/PageNav.d.ts +3 -0
- package/dist/components/PageNav/PageNav.js +81 -0
- package/dist/components/PageNav/PageNav.types.d.ts +17 -0
- package/dist/components/PageNav/index.d.ts +2 -0
- package/dist/components/Popconfirm/Popconfirm.cjs +1 -0
- package/dist/components/Popconfirm/Popconfirm.const.cjs +1 -0
- package/dist/components/Popconfirm/Popconfirm.const.d.ts +13 -0
- package/dist/components/Popconfirm/Popconfirm.const.js +20 -0
- package/dist/components/Popconfirm/Popconfirm.d.ts +4 -0
- package/dist/components/Popconfirm/Popconfirm.js +65 -0
- package/dist/components/Popconfirm/Popconfirm.types.d.ts +16 -0
- package/dist/components/Popconfirm/index.d.ts +2 -0
- package/dist/components/Progress/Progress.cjs +1 -1
- package/dist/components/Progress/Progress.js +6 -6
- package/dist/components/PropsPlayground/PropsPlayground.cjs +1 -0
- package/dist/components/PropsPlayground/PropsPlayground.const.cjs +1 -0
- package/dist/components/PropsPlayground/PropsPlayground.const.d.ts +11 -0
- package/dist/components/PropsPlayground/PropsPlayground.const.js +23 -0
- package/dist/components/PropsPlayground/PropsPlayground.d.ts +3 -0
- package/dist/components/PropsPlayground/PropsPlayground.js +221 -0
- package/dist/components/PropsPlayground/PropsPlayground.types.d.ts +29 -0
- package/dist/components/PropsPlayground/PropsPlayground.utils.cjs +1 -0
- package/dist/components/PropsPlayground/PropsPlayground.utils.d.ts +2 -0
- package/dist/components/PropsPlayground/PropsPlayground.utils.js +9 -0
- package/dist/components/PropsPlayground/index.d.ts +2 -0
- package/dist/components/RadioCard/RadioCard.cjs +1 -0
- package/dist/components/RadioCard/RadioCard.const.cjs +1 -0
- package/dist/components/RadioCard/RadioCard.const.d.ts +7 -0
- package/dist/components/RadioCard/RadioCard.const.js +22 -0
- package/dist/components/RadioCard/RadioCard.d.ts +5 -0
- package/dist/components/RadioCard/RadioCard.js +111 -0
- package/dist/components/RadioCard/RadioCard.types.d.ts +22 -0
- package/dist/components/RadioCard/index.d.ts +2 -0
- package/dist/components/Result/Result.cjs +1 -0
- package/dist/components/Result/Result.const.cjs +1 -0
- package/dist/components/Result/Result.const.d.ts +10 -0
- package/dist/components/Result/Result.const.js +20 -0
- package/dist/components/Result/Result.d.ts +4 -0
- package/dist/components/Result/Result.icons.cjs +1 -0
- package/dist/components/Result/Result.icons.d.ts +3 -0
- package/dist/components/Result/Result.icons.js +31 -0
- package/dist/components/Result/Result.js +35 -0
- package/dist/components/Result/Result.types.d.ts +10 -0
- package/dist/components/Result/index.d.ts +2 -0
- package/dist/components/RingProgress/RingProgress.cjs +1 -0
- package/dist/components/RingProgress/RingProgress.const.cjs +1 -0
- package/dist/components/RingProgress/RingProgress.const.d.ts +4 -0
- package/dist/components/RingProgress/RingProgress.const.js +7 -0
- package/dist/components/RingProgress/RingProgress.d.ts +4 -0
- package/dist/components/RingProgress/RingProgress.js +67 -0
- package/dist/components/RingProgress/RingProgress.types.d.ts +15 -0
- package/dist/components/RingProgress/index.d.ts +2 -0
- package/dist/components/Select/Select.cjs +1 -1
- package/dist/components/Select/Select.js +28 -30
- package/dist/components/SignPad/SignPad.cjs +1 -1
- package/dist/components/SignPad/SignPad.const.cjs +1 -1
- package/dist/components/SignPad/SignPad.const.js +10 -11
- package/dist/components/SignPad/SignPad.d.ts +4 -6
- package/dist/components/SignPad/SignPad.js +114 -122
- package/dist/components/SignPad/SignPad.types.d.ts +2 -2
- package/dist/components/Skeleton/Skeleton.cjs +1 -1
- package/dist/components/Skeleton/Skeleton.js +89 -94
- package/dist/components/Skeleton/Skeleton.utils.cjs +1 -0
- package/dist/components/Skeleton/Skeleton.utils.d.ts +1 -0
- package/dist/components/Skeleton/Skeleton.utils.js +10 -0
- package/dist/components/SliderRange/SliderRange.cjs +1 -1
- package/dist/components/SliderRange/SliderRange.js +61 -63
- package/dist/components/SliderRange/SliderRange.utils.cjs +1 -0
- package/dist/components/SliderRange/SliderRange.utils.d.ts +1 -0
- package/dist/components/SliderRange/SliderRange.utils.js +7 -0
- package/dist/components/SplitButton/SplitButton.cjs +1 -0
- package/dist/components/SplitButton/SplitButton.const.cjs +1 -0
- package/dist/components/SplitButton/SplitButton.const.d.ts +25 -0
- package/dist/components/SplitButton/SplitButton.const.js +27 -0
- package/dist/components/SplitButton/SplitButton.d.ts +4 -0
- package/dist/components/SplitButton/SplitButton.js +73 -0
- package/dist/components/SplitButton/SplitButton.types.d.ts +21 -0
- package/dist/components/SplitButton/index.d.ts +2 -0
- package/dist/components/Spoiler/Spoiler.cjs +1 -0
- package/dist/components/Spoiler/Spoiler.const.cjs +1 -0
- package/dist/components/Spoiler/Spoiler.const.d.ts +6 -0
- package/dist/components/Spoiler/Spoiler.const.js +9 -0
- package/dist/components/Spoiler/Spoiler.d.ts +4 -0
- package/dist/components/Spoiler/Spoiler.js +59 -0
- package/dist/components/Spoiler/Spoiler.types.d.ts +10 -0
- package/dist/components/Spoiler/index.d.ts +2 -0
- package/dist/components/Spotlight/Spotlight.cjs +1 -1
- package/dist/components/Spotlight/Spotlight.js +62 -73
- package/dist/components/Spotlight/Spotlight.utils.cjs +1 -0
- package/dist/components/Spotlight/Spotlight.utils.d.ts +3 -0
- package/dist/components/Spotlight/Spotlight.utils.js +18 -0
- package/dist/components/Tabs/Tabs.cjs +1 -1
- package/dist/components/Tabs/Tabs.js +39 -38
- package/dist/components/Tabs/Tabs.types.d.ts +3 -1
- package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.cjs +1 -1
- package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.js +63 -57
- package/dist/components/TimePicker/helpers/ClockFaceSvg.cjs +1 -1
- package/dist/components/TimePicker/helpers/ClockFaceSvg.d.ts +0 -7
- package/dist/components/TimePicker/helpers/ClockFaceSvg.js +32 -31
- package/dist/components/Toast/Toast.cjs +1 -1
- package/dist/components/Toast/Toast.js +18 -17
- package/dist/components/Toast/Toast.utils.cjs +1 -0
- package/dist/components/Toast/Toast.utils.d.ts +1 -0
- package/dist/components/Toast/Toast.utils.js +4 -0
- package/dist/components/Tooltip/Tooltip.cjs +1 -1
- package/dist/components/Tooltip/Tooltip.js +10 -11
- package/dist/components/Tour/Tour.cjs +1 -1
- package/dist/components/Tour/Tour.js +1 -2
- package/dist/components/TreeSelect/TreeSelect.cjs +1 -0
- package/dist/components/TreeSelect/TreeSelect.const.cjs +1 -0
- package/dist/components/TreeSelect/TreeSelect.const.d.ts +19 -0
- package/dist/components/TreeSelect/TreeSelect.const.js +22 -0
- package/dist/components/TreeSelect/TreeSelect.d.ts +4 -0
- package/dist/components/TreeSelect/TreeSelect.js +128 -0
- package/dist/components/TreeSelect/TreeSelect.types.d.ts +25 -0
- package/dist/components/TreeSelect/TreeSelect.utils.cjs +1 -0
- package/dist/components/TreeSelect/TreeSelect.utils.d.ts +5 -0
- package/dist/components/TreeSelect/TreeSelect.utils.js +25 -0
- package/dist/components/TreeSelect/index.d.ts +2 -0
- package/dist/components/VirtualList/VirtualList.cjs +1 -1
- package/dist/components/VirtualList/VirtualList.js +38 -43
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +48 -0
- package/dist/components/index.js +351 -300
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +60 -58
- package/dist/hooks/useResizeObserver/index.d.ts +2 -0
- package/dist/hooks/useResizeObserver/useResizeObserver.cjs +1 -0
- package/dist/hooks/useResizeObserver/useResizeObserver.d.ts +3 -0
- package/dist/hooks/useResizeObserver/useResizeObserver.js +20 -0
- package/dist/hooks/useResizeObserver/useResizeObserver.types.d.ts +8 -0
- package/dist/icons.cjs +1 -0
- package/dist/icons.d.ts +2 -0
- package/dist/icons.js +6 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +443 -390
- package/dist/postcss/bear-plugin.cjs +86 -0
- package/dist/styles/_alerts.css +14 -0
- package/dist/styles/_base.css +60 -0
- package/dist/styles/_buttons.css +108 -0
- package/dist/styles/_effects.css +90 -0
- package/dist/styles/_marquee.css +25 -0
- package/dist/styles/main.css +5 -0
- package/dist/styles.css +1 -1
- package/package.json +15 -3
|
@@ -1,46 +1,47 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { cn as
|
|
1
|
+
import { jsxs as T, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { cn as A } from "../../../utils/cn.js";
|
|
3
3
|
import "react";
|
|
4
|
-
import { CLOCK_RADIUS as
|
|
5
|
-
const
|
|
6
|
-
values:
|
|
7
|
-
isHourMode:
|
|
8
|
-
format:
|
|
9
|
-
selectedHour:
|
|
10
|
-
selectedMinute:
|
|
4
|
+
import { CLOCK_RADIUS as n, CLOCK_CENTER as c } from "../TimePicker.constants.js";
|
|
5
|
+
const I = 16, O = 14, E = 0.85, x = 0.6, N = 30, t = 90, s = Math.PI / 180, C = ({
|
|
6
|
+
values: _,
|
|
7
|
+
isHourMode: i,
|
|
8
|
+
format: m,
|
|
9
|
+
selectedHour: r,
|
|
10
|
+
selectedMinute: k,
|
|
11
11
|
onSelect: g,
|
|
12
|
-
className:
|
|
12
|
+
className: p
|
|
13
13
|
}) => {
|
|
14
|
-
const d = (e) =>
|
|
15
|
-
return /* @__PURE__ */
|
|
16
|
-
/* @__PURE__ */
|
|
14
|
+
const d = (e) => i ? (e * N - t) * s : (e * (360 / _.length) - t) * s, b = (i ? (m === "12h" ? r === 12 ? 0 : r % 12 : r) * N - t : k * 6 - t) * s;
|
|
15
|
+
return /* @__PURE__ */ T("svg", { viewBox: "0 0 200 200", className: A("Bear-TimePicker__clock-face bear-w-full bear-h-full", p), children: [
|
|
16
|
+
/* @__PURE__ */ a(
|
|
17
17
|
"circle",
|
|
18
18
|
{
|
|
19
|
-
cx:
|
|
20
|
-
cy:
|
|
21
|
-
r:
|
|
19
|
+
cx: c,
|
|
20
|
+
cy: c,
|
|
21
|
+
r: n,
|
|
22
22
|
className: "Bear-TimePicker__clock-face-circle bear-fill-none bear-stroke-gray-200 dark:bear-stroke-zinc-700 bear-stroke-2"
|
|
23
23
|
}
|
|
24
24
|
),
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
return /* @__PURE__ */
|
|
25
|
+
_.map((e, S) => {
|
|
26
|
+
const f = d(S), l = c + n * E * Math.cos(f), o = c + n * E * Math.sin(f), h = i ? m === "12h" ? e === 12 ? r === 12 : r % 12 === e : r === e : k === e;
|
|
27
|
+
return /* @__PURE__ */ T(
|
|
28
28
|
"g",
|
|
29
29
|
{
|
|
30
30
|
onClick: () => g(e),
|
|
31
31
|
className: "Bear-TimePicker__clock-face-item bear-cursor-pointer",
|
|
32
32
|
children: [
|
|
33
|
-
|
|
34
|
-
/* @__PURE__ */
|
|
33
|
+
/* @__PURE__ */ a("circle", { cx: l, cy: o, r: I, fill: "transparent" }),
|
|
34
|
+
h && /* @__PURE__ */ a("circle", { cx: l, cy: o, r: O, className: "Bear-TimePicker__clock-face-dot bear-fill-blue-500" }),
|
|
35
|
+
/* @__PURE__ */ a(
|
|
35
36
|
"text",
|
|
36
37
|
{
|
|
37
|
-
x:
|
|
38
|
-
y:
|
|
38
|
+
x: l,
|
|
39
|
+
y: o,
|
|
39
40
|
textAnchor: "middle",
|
|
40
41
|
dominantBaseline: "middle",
|
|
41
|
-
className:
|
|
42
|
+
className: A(
|
|
42
43
|
"Bear-TimePicker__clock-face-text bear-text-sm bear-font-medium bear-pointer-events-none",
|
|
43
|
-
|
|
44
|
+
h ? "bear-fill-white" : "bear-fill-gray-700 dark:bear-fill-zinc-300"
|
|
44
45
|
),
|
|
45
46
|
children: typeof e == "number" ? e.toString().padStart(2, "0") : e
|
|
46
47
|
}
|
|
@@ -50,13 +51,13 @@ const T = ({
|
|
|
50
51
|
e
|
|
51
52
|
);
|
|
52
53
|
}),
|
|
53
|
-
/* @__PURE__ */
|
|
54
|
+
/* @__PURE__ */ a(
|
|
54
55
|
"line",
|
|
55
56
|
{
|
|
56
|
-
x1:
|
|
57
|
-
y1:
|
|
58
|
-
x2:
|
|
59
|
-
y2:
|
|
57
|
+
x1: c,
|
|
58
|
+
y1: c,
|
|
59
|
+
x2: c + n * x * Math.cos(b),
|
|
60
|
+
y2: c + n * x * Math.sin(b),
|
|
60
61
|
className: "Bear-TimePicker__clock-face-hand bear-stroke-blue-500 bear-stroke-2",
|
|
61
62
|
strokeLinecap: "round"
|
|
62
63
|
}
|
|
@@ -64,5 +65,5 @@ const T = ({
|
|
|
64
65
|
] });
|
|
65
66
|
};
|
|
66
67
|
export {
|
|
67
|
-
|
|
68
|
+
C as ClockFaceSvg
|
|
68
69
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("react"),y=require("../../utils/cn.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("react"),y=require("../../utils/cn.cjs"),w=require("./Toast.utils.cjs"),p={success:e.jsxs("svg",{width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[e.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),e.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),info:e.jsxs("svg",{width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),e.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]}),warning:e.jsxs("svg",{width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[e.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),e.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),e.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),error:e.jsxs("svg",{width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),e.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]})},k=()=>e.jsxs("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),C={success:"bear-bg-green-500 bear-text-white",info:"bear-bg-blue-500 bear-text-white",warning:"bear-bg-amber-500 bear-text-white",error:"bear-bg-red-500 bear-text-white"},S={"top-left":"bear-top-4 bear-left-4","top-center":"bear-top-4 bear-left-1/2 bear-transform bear--translate-x-1/2","top-right":"bear-top-4 bear-right-4","bottom-left":"bear-bottom-4 bear-left-4","bottom-center":"bear-bottom-4 bear-left-1/2 bear-transform bear--translate-x-1/2","bottom-right":"bear-bottom-4 bear-right-4"},v=s.createContext(null),I=()=>{const i=s.useContext(v);if(!i)throw new Error("useToast must be used within a ToastProvider");return i},N=({message:i,title:c,severity:b="info",duration:n=5e3,closable:l=!0,icon:r,action:x,onClose:a,onRemove:u,className:m})=>{const[f,d]=s.useState(!1);s.useEffect(()=>{if(n>0){const t=setTimeout(()=>{d(!0),setTimeout(()=>{u(),a==null||a()},200)},n);return()=>clearTimeout(t)}},[n,u,a]);const g=()=>{d(!0),setTimeout(()=>{u(),a==null||a()},200)},h=()=>r===!1?null:r||p[b];return e.jsxs("div",{role:"alert",className:y.cn("bear-flex bear-items-start bear-gap-3 bear-p-4 bear-rounded-lg bear-shadow-lg bear-min-w-[300px] bear-max-w-[400px]","bear-transition-all bear-duration-200",f?"bear-opacity-0 bear-translate-x-2":"bear-opacity-100 bear-translate-x-0",C[b],m),children:[h()&&e.jsx("span",{className:"bear-flex-shrink-0 bear-mt-0.5",children:h()}),e.jsxs("div",{className:"bear-flex-1 bear-min-w-0",children:[c&&e.jsx("div",{className:"bear-font-semibold bear-mb-0.5",children:c}),e.jsx("div",{className:"bear-text-sm bear-opacity-90",children:i})]}),x&&e.jsx("div",{className:"bear-flex-shrink-0",children:x}),l&&e.jsx("button",{type:"button",onClick:g,className:"bear-flex-shrink-0 bear-p-1 bear-rounded hover:bear-bg-white/20 bear-transition-colors bear-bg-transparent bear-border-none bear-cursor-pointer","aria-label":"Close",children:e.jsx(k,{})})]})},T=({position:i="top-right",maxToasts:c=5,className:b})=>{const n=s.useContext(v);if(!n)return null;const{_toasts:l,_removeToast:r}=n,x=l.slice(0,c);return e.jsx("div",{className:y.cn("bear-fixed bear-z-50 bear-flex bear-flex-col bear-gap-2",S[i],b),children:x.map(a=>e.jsx(N,{...a,onRemove:()=>r(a.id)},a.id))})},E=({children:i,position:c="top-right"})=>{const[b,n]=s.useState([]),l=s.useCallback(t=>{n(o=>o.filter(j=>j.id!==t))},[]),r=s.useCallback(t=>{const o=t.id||w.generateId();return n(j=>[...j,{...t,id:o}]),o},[]),x=s.useCallback(t=>r(t),[r]),a=s.useCallback((t,o)=>r({message:t,severity:"success",...o}),[r]),u=s.useCallback((t,o)=>r({message:t,severity:"info",...o}),[r]),m=s.useCallback((t,o)=>r({message:t,severity:"warning",...o}),[r]),f=s.useCallback((t,o)=>r({message:t,severity:"error",...o}),[r]),d=s.useCallback(t=>l(t),[l]),g=s.useCallback(()=>n([]),[]),h={toast:x,success:a,info:u,warning:m,error:f,dismiss:d,dismissAll:g,_toasts:b,_removeToast:l};return e.jsxs(v.Provider,{value:h,children:[i,e.jsx(T,{position:c})]})};exports.ToastContainer=T;exports.ToastProvider=E;exports.useToast=I;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as e, jsxs as c } from "react/jsx-runtime";
|
|
2
2
|
import { createContext as I, useContext as y, useState as T, useCallback as i, useEffect as N } from "react";
|
|
3
3
|
import { cn as k } from "../../utils/cn.js";
|
|
4
|
-
|
|
4
|
+
import { generateId as E } from "./Toast.utils.js";
|
|
5
|
+
const S = {
|
|
5
6
|
success: /* @__PURE__ */ c("svg", { width: 20, height: 20, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
|
|
6
7
|
/* @__PURE__ */ e("path", { d: "M22 11.08V12a10 10 0 1 1-5.93-9.14" }),
|
|
7
8
|
/* @__PURE__ */ e("polyline", { points: "22 4 12 14.01 9 11.01" })
|
|
@@ -36,7 +37,7 @@ const E = () => `toast-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
|
|
|
36
37
|
"bottom-left": "bear-bottom-4 bear-left-4",
|
|
37
38
|
"bottom-center": "bear-bottom-4 bear-left-1/2 bear-transform bear--translate-x-1/2",
|
|
38
39
|
"bottom-right": "bear-bottom-4 bear-right-4"
|
|
39
|
-
}, w = I(null),
|
|
40
|
+
}, w = I(null), z = () => {
|
|
40
41
|
const n = y(w);
|
|
41
42
|
if (!n)
|
|
42
43
|
throw new Error("useToast must be used within a ToastProvider");
|
|
@@ -47,7 +48,7 @@ const E = () => `toast-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
|
|
|
47
48
|
severity: d = "info",
|
|
48
49
|
duration: o = 5e3,
|
|
49
50
|
closable: l = !0,
|
|
50
|
-
icon:
|
|
51
|
+
icon: t,
|
|
51
52
|
action: h,
|
|
52
53
|
onClose: a,
|
|
53
54
|
onRemove: x,
|
|
@@ -56,19 +57,19 @@ const E = () => `toast-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
|
|
|
56
57
|
const [g, m] = T(!1);
|
|
57
58
|
N(() => {
|
|
58
59
|
if (o > 0) {
|
|
59
|
-
const
|
|
60
|
+
const r = setTimeout(() => {
|
|
60
61
|
m(!0), setTimeout(() => {
|
|
61
62
|
x(), a == null || a();
|
|
62
63
|
}, 200);
|
|
63
64
|
}, o);
|
|
64
|
-
return () => clearTimeout(
|
|
65
|
+
return () => clearTimeout(r);
|
|
65
66
|
}
|
|
66
67
|
}, [o, x, a]);
|
|
67
68
|
const p = () => {
|
|
68
69
|
m(!0), setTimeout(() => {
|
|
69
70
|
x(), a == null || a();
|
|
70
71
|
}, 200);
|
|
71
|
-
}, u = () =>
|
|
72
|
+
}, u = () => t === !1 ? null : t || S[d];
|
|
72
73
|
return /* @__PURE__ */ c(
|
|
73
74
|
"div",
|
|
74
75
|
{
|
|
@@ -107,7 +108,7 @@ const E = () => `toast-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
|
|
|
107
108
|
}) => {
|
|
108
109
|
const o = y(w);
|
|
109
110
|
if (!o) return null;
|
|
110
|
-
const { _toasts: l, _removeToast:
|
|
111
|
+
const { _toasts: l, _removeToast: t } = o, h = l.slice(0, b);
|
|
111
112
|
return /* @__PURE__ */ e(
|
|
112
113
|
"div",
|
|
113
114
|
{
|
|
@@ -120,22 +121,22 @@ const E = () => `toast-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
|
|
|
120
121
|
C,
|
|
121
122
|
{
|
|
122
123
|
...a,
|
|
123
|
-
onRemove: () =>
|
|
124
|
+
onRemove: () => t(a.id)
|
|
124
125
|
},
|
|
125
126
|
a.id
|
|
126
127
|
))
|
|
127
128
|
}
|
|
128
129
|
);
|
|
129
|
-
},
|
|
130
|
+
}, M = ({
|
|
130
131
|
children: n,
|
|
131
132
|
position: b = "top-right"
|
|
132
133
|
}) => {
|
|
133
|
-
const [d, o] = T([]), l = i((
|
|
134
|
-
o((s) => s.filter((v) => v.id !==
|
|
135
|
-
}, []),
|
|
136
|
-
const s =
|
|
137
|
-
return o((v) => [...v, { ...
|
|
138
|
-
}, []), h = i((
|
|
134
|
+
const [d, o] = T([]), l = i((r) => {
|
|
135
|
+
o((s) => s.filter((v) => v.id !== r));
|
|
136
|
+
}, []), t = i((r) => {
|
|
137
|
+
const s = r.id || E();
|
|
138
|
+
return o((v) => [...v, { ...r, id: s }]), s;
|
|
139
|
+
}, []), h = i((r) => t(r), [t]), a = i((r, s) => t({ message: r, severity: "success", ...s }), [t]), x = i((r, s) => t({ message: r, severity: "info", ...s }), [t]), f = i((r, s) => t({ message: r, severity: "warning", ...s }), [t]), g = i((r, s) => t({ message: r, severity: "error", ...s }), [t]), m = i((r) => l(r), [l]), p = i(() => o([]), []), u = {
|
|
139
140
|
toast: h,
|
|
140
141
|
success: a,
|
|
141
142
|
info: x,
|
|
@@ -153,6 +154,6 @@ const E = () => `toast-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
|
|
|
153
154
|
};
|
|
154
155
|
export {
|
|
155
156
|
L as ToastContainer,
|
|
156
|
-
|
|
157
|
-
|
|
157
|
+
M as ToastProvider,
|
|
158
|
+
z as useToast
|
|
158
159
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=()=>`toast-${Date.now()}-${Math.random().toString(36).slice(2,9)}`;exports.generateId=e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const generateId: () => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),r=require("react"),j=require("react-dom"),k=require("../../utils/cn.cjs"),v=({content:m,children:x,position:w,placement:R,delay:y=200,className:T,disabled:M=!1})=>{const c=R||w||"top",[l,d]=r.useState(!1),[b,B]=r.useState({x:0,y:0}),u=r.useRef(null),h=r.useRef(null),n=r.useRef(),f=r.useCallback(()=>{if(!u.current||!h.current)return;const e=u.current.getBoundingClientRect(),t=h.current.getBoundingClientRect(),s=8;let o=0,i=0;switch(c){case"top":o=e.left+(e.width-t.width)/2,i=e.top-t.height-s;break;case"bottom":o=e.left+(e.width-t.width)/2,i=e.bottom+s;break;case"left":o=e.left-t.width-s,i=e.top+(e.height-t.height)/2;break;case"right":o=e.right+s,i=e.top+(e.height-t.height)/2;break}o=Math.max(8,Math.min(o,window.innerWidth-t.width-8)),i=Math.max(8,Math.min(i,window.innerHeight-t.height-8)),B({x:o,y:i})},[c]),g=()=>{M||(n.current=setTimeout(()=>{d(!0)},y))},p=()=>{n.current&&clearTimeout(n.current),d(!1)};return r.useEffect(()=>{l&&f()},[l,f]),r.useEffect(()=>()=>{n.current&&clearTimeout(n.current)},[]),a.jsxs(a.Fragment,{children:[a.jsx("div",{ref:u,onMouseEnter:g,onMouseLeave:p,onFocus:g,onBlur:p,className:"Bear-Tooltip__trigger bear-inline-block",children:x}),l&&j.createPortal(a.jsx("div",{ref:h,role:"tooltip",style:{left:b.x,top:b.y},className:k.cn("bear-fixed bear-z-[9999]","Bear-Tooltip",`Bear-Tooltip--${c}`,"bear-px-3 bear-py-2 bear-rounded-lg","bear-bg-gray-800 bear-text-white bear-text-sm","bear-border bear-border-gray-700","bear-shadow-lg","bear-animate-in bear-fade-in bear-duration-150",T),children:a.jsx("span",{className:"Bear-Tooltip__content",children:m})}),document.body)]})};exports.Tooltip=v;
|
|
@@ -2,7 +2,7 @@ import { jsxs as C, Fragment as _, jsx as u } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState as m, useRef as h, useCallback as E, useEffect as w } from "react";
|
|
3
3
|
import { createPortal as N } from "react-dom";
|
|
4
4
|
import { cn as j } from "../../utils/cn.js";
|
|
5
|
-
const
|
|
5
|
+
const z = ({
|
|
6
6
|
content: x,
|
|
7
7
|
children: y,
|
|
8
8
|
position: M,
|
|
@@ -30,11 +30,11 @@ const V = ({
|
|
|
30
30
|
break;
|
|
31
31
|
}
|
|
32
32
|
r = Math.max(8, Math.min(r, window.innerWidth - t.width - 8)), o = Math.max(8, Math.min(o, window.innerHeight - t.height - 8)), v({ x: r, y: o });
|
|
33
|
-
}, [a]),
|
|
33
|
+
}, [a]), g = () => {
|
|
34
34
|
k || (i.current = setTimeout(() => {
|
|
35
35
|
d(!0);
|
|
36
36
|
}, T));
|
|
37
|
-
},
|
|
37
|
+
}, p = () => {
|
|
38
38
|
i.current && clearTimeout(i.current), d(!1);
|
|
39
39
|
};
|
|
40
40
|
return w(() => {
|
|
@@ -46,10 +46,10 @@ const V = ({
|
|
|
46
46
|
"div",
|
|
47
47
|
{
|
|
48
48
|
ref: c,
|
|
49
|
-
onMouseEnter:
|
|
50
|
-
onMouseLeave:
|
|
51
|
-
onFocus:
|
|
52
|
-
onBlur:
|
|
49
|
+
onMouseEnter: g,
|
|
50
|
+
onMouseLeave: p,
|
|
51
|
+
onFocus: g,
|
|
52
|
+
onBlur: p,
|
|
53
53
|
className: "Bear-Tooltip__trigger bear-inline-block",
|
|
54
54
|
children: y
|
|
55
55
|
}
|
|
@@ -61,12 +61,11 @@ const V = ({
|
|
|
61
61
|
ref: l,
|
|
62
62
|
role: "tooltip",
|
|
63
63
|
style: {
|
|
64
|
-
position: "fixed",
|
|
65
64
|
left: b.x,
|
|
66
|
-
top: b.y
|
|
67
|
-
zIndex: 9999
|
|
65
|
+
top: b.y
|
|
68
66
|
},
|
|
69
67
|
className: j(
|
|
68
|
+
"bear-fixed bear-z-[9999]",
|
|
70
69
|
"Bear-Tooltip",
|
|
71
70
|
`Bear-Tooltip--${a}`,
|
|
72
71
|
"bear-px-3 bear-py-2 bear-rounded-lg",
|
|
@@ -84,5 +83,5 @@ const V = ({
|
|
|
84
83
|
] });
|
|
85
84
|
};
|
|
86
85
|
export {
|
|
87
|
-
|
|
86
|
+
z as Tooltip
|
|
88
87
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),s=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),s=require("react"),R=require("../../utils/cn.cjs"),g=require("../Button/Button.cjs"),v=require("../Typography/Typography.cjs"),a=require("./Tour.const.cjs"),G=({steps:T,open:u=!1,current:A,onClose:d,onStepChange:b,onFinish:f,showIndicators:N=a.TOUR_DEFAULTS.SHOW_INDICATORS,showCloseButton:I=a.TOUR_DEFAULTS.SHOW_CLOSE_BUTTON,showSkipButton:w=a.TOUR_DEFAULTS.SHOW_SKIP_BUTTON,showPrevButton:P=a.TOUR_DEFAULTS.SHOW_PREV_BUTTON,finishText:D=a.TOUR_DEFAULTS.FINISH_TEXT,skipText:y=a.TOUR_DEFAULTS.SKIP_TEXT,maskOpacity:U=a.TOUR_DEFAULTS.MASK_OPACITY,maskColor:m=a.TOUR_DEFAULTS.MASK_COLOR,animated:E=a.TOUR_DEFAULTS.ANIMATED,className:k,testId:j})=>{const[B,x]=s.useState(0),[r,F]=s.useState(null),[L,M]=s.useState({top:0,left:0}),z=s.useRef(null),c=A??B,e=T[c],_=c===T.length-1,H=c===0,O=s.useCallback(()=>e?typeof e.target=="function"?e.target():document.querySelector(e.target):null,[e]),S=s.useCallback(()=>{const t=O();if(t){const n=t.getBoundingClientRect();F(n)}},[O]);s.useEffect(()=>{if(!r||!e)return;const t=e.placement||a.TOUR_DEFAULTS.PLACEMENT,n=e.spotlightPadding??a.TOUR_DEFAULTS.SPOTLIGHT_PADDING;let l=0,i=0;switch(t){case"top":case"top-start":case"top-end":l=r.top-a.TOUR_TOOLTIP_OFFSET-n,i=t==="top"?r.left+r.width/2:t==="top-start"?r.left:r.right;break;case"bottom":case"bottom-start":case"bottom-end":l=r.bottom+a.TOUR_TOOLTIP_OFFSET+n,i=t==="bottom"?r.left+r.width/2:t==="bottom-start"?r.left:r.right;break;case"left":case"left-start":case"left-end":i=r.left-a.TOUR_TOOLTIP_OFFSET-n,l=t==="left"?r.top+r.height/2:t==="left-start"?r.top:r.bottom;break;case"right":case"right-start":case"right-end":i=r.right+a.TOUR_TOOLTIP_OFFSET+n,l=t==="right"?r.top+r.height/2:t==="right-start"?r.top:r.bottom;break}M({top:l,left:i})},[r,e]),s.useEffect(()=>{if(!u)return;S();const t=()=>S();return window.addEventListener("resize",t),window.addEventListener("scroll",t,!0),()=>{window.removeEventListener("resize",t),window.removeEventListener("scroll",t,!0)}},[u,c,S]),s.useEffect(()=>{if(!u)return;const t=O();t&&t.scrollIntoView({behavior:"smooth",block:"center"})},[u,c,O]);const X=s.useCallback(async()=>{var t,n,l;if(e!=null&&e.onAfterStep&&await e.onAfterStep(),_)f==null||f(),d==null||d();else{const i=c+1;x(i),b==null||b(i),(t=T[i])!=null&&t.onBeforeStep&&await((l=(n=T[i]).onBeforeStep)==null?void 0:l.call(n))}},[c,_,e,T,f,d,b]),q=s.useCallback(async()=>{var n,l,i;e!=null&&e.onAfterStep&&await e.onAfterStep();const t=c-1;x(t),b==null||b(t),(n=T[t])!=null&&n.onBeforeStep&&await((i=(l=T[t]).onBeforeStep)==null?void 0:i.call(l))},[c,e,T,b]),p=s.useCallback(()=>{d==null||d()},[d]),W=(e==null?void 0:e.placement)||a.TOUR_DEFAULTS.PLACEMENT,h=(e==null?void 0:e.spotlightPadding)??a.TOUR_DEFAULTS.SPOTLIGHT_PADDING;return!u||!e?null:o.jsxs("div",{className:R.cn("Bear-Tour",k),"data-testid":j,children:[o.jsx("div",{className:"Bear-Tour__overlay bear-fixed bear-inset-0",style:{zIndex:a.TOUR_Z_INDEX.OVERLAY,backgroundColor:m,opacity:U,transition:E?"opacity 0.3s":"none"},onClick:p}),r&&o.jsx("div",{className:"Bear-Tour__spotlight bear-fixed bear-pointer-events-none bear-rounded-lg",style:{zIndex:a.TOUR_Z_INDEX.SPOTLIGHT,top:r.top-h,left:r.left-h,width:r.width+h*2,height:r.height+h*2,boxShadow:`0 0 0 9999px ${m}`,opacity:U,transition:E?"all 0.3s ease":"none"}}),o.jsxs("div",{ref:z,className:"Bear-Tour__tooltip bear-fixed bear-bg-white dark:bear-bg-neutral-800 bear-rounded-lg bear-shadow-xl bear-p-4",style:{zIndex:a.TOUR_Z_INDEX.TOOLTIP,top:L.top,left:L.left,minWidth:280,maxWidth:360,...a.TOUR_PLACEMENT_STYLES[W],transition:E?"all 0.3s ease":"none"},children:[I&&o.jsx("button",{className:"Bear-Tour__close bear-absolute bear-top-2 bear-right-2 bear-p-1 bear-text-neutral-400 hover:bear-text-neutral-600 dark:hover:bear-text-neutral-300 bear-cursor-pointer bear-bg-transparent bear-border-none",onClick:p,"aria-label":"Close tour",children:o.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:o.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})}),o.jsxs("div",{className:"Bear-Tour__content bear-pr-6",children:[e.title&&o.jsx(v.Typography,{variant:"h6",className:"bear-mb-2",children:e.title}),e.description&&o.jsx(v.Typography,{variant:"body2",color:"secondary",className:"bear-mb-4",children:e.description}),e.content]}),o.jsxs("div",{className:"Bear-Tour__footer bear-flex bear-items-center bear-justify-between bear-mt-4 bear-pt-3 bear-border-t bear-border-neutral-200 dark:bear-border-neutral-700",children:[N&&o.jsx("div",{className:"bear-flex bear-gap-1.5",children:T.map((t,n)=>o.jsx("div",{className:R.cn("bear-w-2 bear-h-2 bear-rounded-full bear-transition-colors",n===c?"bear-bg-[var(--bear-primary-500)]":"bear-bg-neutral-300 dark:bear-bg-neutral-600")},n))}),o.jsxs("div",{className:"bear-flex bear-gap-2 bear-ml-auto",children:[w&&!_&&o.jsx(g.Button,{variant:"ghost",size:"sm",onClick:p,children:y}),P&&!H&&o.jsx(g.Button,{variant:"outline",size:"sm",onClick:q,children:e.prevText||a.TOUR_DEFAULTS.PREV_TEXT}),o.jsx(g.Button,{variant:"primary",size:"sm",onClick:X,children:_?D:e.nextText||a.TOUR_DEFAULTS.NEXT_TEXT})]})]})]})]})};exports.Tour=G;
|
|
@@ -107,14 +107,13 @@ const ot = ({
|
|
|
107
107
|
r && /* @__PURE__ */ n(
|
|
108
108
|
"div",
|
|
109
109
|
{
|
|
110
|
-
className: "Bear-Tour__spotlight bear-fixed bear-pointer-events-none",
|
|
110
|
+
className: "Bear-Tour__spotlight bear-fixed bear-pointer-events-none bear-rounded-lg",
|
|
111
111
|
style: {
|
|
112
112
|
zIndex: S.SPOTLIGHT,
|
|
113
113
|
top: r.top - g,
|
|
114
114
|
left: r.left - g,
|
|
115
115
|
width: r.width + g * 2,
|
|
116
116
|
height: r.height + g * 2,
|
|
117
|
-
borderRadius: 8,
|
|
118
117
|
boxShadow: `0 0 0 9999px ${P}`,
|
|
119
118
|
opacity: I,
|
|
120
119
|
transition: v ? "all 0.3s ease" : "none"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("react"),m=require("../../utils/cn.cjs"),a=require("./TreeSelect.const.cjs"),E=require("./TreeSelect.utils.cjs"),_=({node:s,depth:c,selected:o,expanded:t,multiple:i,onToggleExpand:h,onSelect:p})=>{const d=s.children&&s.children.length>0,f=t.has(s.id),S=o.has(s.id);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:m.cn(a.NODE_CLASSES,S&&a.NODE_SELECTED_CLASSES,s.disabled&&a.NODE_DISABLED_CLASSES),style:{paddingLeft:c*a.INDENT_PX+12},onClick:()=>!s.disabled&&p(s.id),role:"treeitem","aria-selected":S,"aria-expanded":d?f:void 0,children:[d?e.jsx("svg",{className:m.cn(a.CHEVRON_CLASSES,f&&"bear-rotate-90"),onClick:x=>{x.stopPropagation(),h(s.id)},fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}):e.jsx("span",{className:"bear-w-4 bear-mr-1"}),i&&e.jsx("span",{className:m.cn("bear-w-4 bear-h-4 bear-mr-2 bear-border bear-rounded bear-flex bear-items-center bear-justify-center bear-text-xs",S?"bear-bg-pink-500 bear-border-pink-500 bear-text-white":"bear-border-gray-300 dark:bear-border-zinc-600"),children:S&&"✓"}),s.icon&&e.jsx("span",{className:"bear-mr-1.5",children:s.icon}),e.jsx("span",{className:"bear-truncate",children:s.label})]}),d&&f&&s.children.map(x=>e.jsx(_,{node:x,depth:c+1,selected:o,expanded:t,multiple:i,onToggleExpand:h,onSelect:p},x.id))]})},z=s=>{const{nodes:c,value:o,onChange:t,multiple:i=!1,label:h,placeholder:p="Select…",disabled:d=!1,clearable:f=!0,searchable:S=!0,expandAll:x=!1,size:g="md",error:N,helperText:v,maxHeight:w=a.DEFAULT_MAX_HEIGHT,className:R,testId:T,...O}=s,[j,A]=n.useState(!1),[L,C]=n.useState(""),y=n.useRef(null),I=n.useMemo(()=>E.collectAllIds(c),[c]),[D,B]=n.useState(()=>x?I:new Set),b=n.useMemo(()=>o?new Set(Array.isArray(o)?o:[o]):new Set,[o]);n.useEffect(()=>{const r=l=>{y.current&&!y.current.contains(l.target)&&(A(!1),C(""))};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[]);const H=n.useCallback(r=>{B(l=>{const u=new Set(l);return u.has(r)?u.delete(r):u.add(r),u})},[]),M=n.useCallback(r=>{if(i){const l=new Set(b);l.has(r)?l.delete(r):l.add(r),t==null||t(Array.from(l))}else t==null||t(r),A(!1),C("")},[i,b,t]),P=n.useCallback(()=>{t==null||t(i?[]:"")},[i,t]),k=L?E.filterNodes(c,L):c,q=()=>{if(b.size===0)return e.jsx("span",{className:"bear-text-gray-400 dark:bear-text-zinc-500",children:p});if(i)return e.jsx("div",{className:"bear-flex bear-flex-wrap bear-gap-1",children:Array.from(b).map(l=>{const u=E.findNodeById(c,l);return u?e.jsx("span",{className:a.TAG_CLASSES,children:u.label},l):null})});const r=E.findNodeById(c,Array.from(b)[0]);return(r==null?void 0:r.label)??p};return e.jsxs("div",{ref:y,className:m.cn(a.ROOT_CLASSES,R),"data-testid":T,...O,children:[h&&e.jsx("label",{className:a.LABEL_CLASSES,children:h}),e.jsxs("button",{type:"button",disabled:d,onClick:()=>!d&&A(!j),className:m.cn(a.TRIGGER_CLASSES,a.SIZE_CLASSES[g],d&&"bear-opacity-50 bear-cursor-not-allowed"),children:[e.jsx("span",{className:"bear-flex-1 bear-text-left bear-truncate",children:q()}),e.jsxs("div",{className:"bear-flex bear-items-center bear-gap-1",children:[f&&b.size>0&&e.jsx("span",{className:"bear-text-gray-400 hover:bear-text-gray-600 bear-cursor-pointer",onClick:r=>{r.stopPropagation(),P()},children:"✕"}),e.jsx("svg",{className:m.cn("bear-w-4 bear-h-4 bear-text-gray-400 bear-transition-transform",j&&"bear-rotate-180"),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})]}),j&&e.jsxs("div",{className:a.DROPDOWN_CLASSES,children:[S&&e.jsx("input",{className:a.SEARCH_CLASSES,placeholder:"Search…",value:L,onChange:r=>C(r.target.value),autoFocus:!0}),e.jsx("div",{style:{maxHeight:w},className:"bear-overflow-y-auto",role:"tree",children:k.length>0?k.map(r=>e.jsx(_,{node:r,depth:0,selected:b,expanded:D,multiple:i,onToggleExpand:H,onSelect:M},r.id)):e.jsx("div",{className:"bear-py-6 bear-text-center bear-text-sm bear-text-gray-400",children:"No results"})})]}),N&&e.jsx("p",{className:a.ERROR_CLASSES,children:N}),!N&&v&&e.jsx("p",{className:a.HELPER_CLASSES,children:v})]})};exports.TreeSelect=z;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=280,r=20,a={sm:"bear-py-1.5 bear-px-3 bear-text-sm",md:"bear-py-2 bear-px-4 bear-text-base",lg:"bear-py-2.5 bear-px-5 bear-text-lg"},b="Bear-TreeSelect bear-relative bear-inline-block bear-w-full",t="bear-w-full bear-flex bear-items-center bear-justify-between bear-rounded-lg bear-border bear-border-gray-300 dark:bear-border-zinc-600 bear-bg-white dark:bear-bg-zinc-800 bear-text-gray-900 dark:bear-text-white bear-transition-colors focus:bear-ring-2 focus:bear-ring-pink-500 bear-outline-none",S="bear-absolute bear-z-[9999] bear-w-full bear-mt-1 bear-bg-white dark:bear-bg-zinc-800 bear-border bear-border-gray-200 dark:bear-border-zinc-700 bear-rounded-xl bear-shadow-xl bear-overflow-hidden",n="bear-w-full bear-px-3 bear-py-2 bear-text-sm bear-bg-transparent bear-border-b bear-border-gray-200 dark:bear-border-zinc-700 bear-outline-none bear-text-gray-900 dark:bear-text-white",o="bear-flex bear-items-center bear-py-1.5 bear-px-3 bear-cursor-pointer bear-transition-colors hover:bear-bg-gray-50 dark:hover:bear-bg-zinc-700 bear-text-sm bear-text-gray-700 dark:bear-text-zinc-300",E="bear-bg-pink-50 dark:bear-bg-pink-900/20 bear-text-pink-700 dark:bear-text-pink-300",i="bear-opacity-40 bear-cursor-not-allowed",s="bear-w-4 bear-h-4 bear-mr-1 bear-text-gray-400 dark:bear-text-zinc-500 bear-transition-transform bear-cursor-pointer",c="bear-inline-flex bear-items-center bear-gap-1 bear-bg-pink-100 dark:bear-bg-pink-900/30 bear-text-pink-700 dark:bear-text-pink-300 bear-rounded bear-px-1.5 bear-py-0.5 bear-text-xs",d="Bear-TreeSelect__label bear-block bear-text-sm bear-font-medium bear-text-gray-700 dark:bear-text-zinc-300 bear-mb-1.5",x="bear-mt-1 bear-text-xs bear-text-red-500",A="bear-mt-1 bear-text-xs bear-text-gray-500 dark:bear-text-zinc-500";exports.CHEVRON_CLASSES=s;exports.DEFAULT_MAX_HEIGHT=e;exports.DROPDOWN_CLASSES=S;exports.ERROR_CLASSES=x;exports.HELPER_CLASSES=A;exports.INDENT_PX=r;exports.LABEL_CLASSES=d;exports.NODE_CLASSES=o;exports.NODE_DISABLED_CLASSES=i;exports.NODE_SELECTED_CLASSES=E;exports.ROOT_CLASSES=b;exports.SEARCH_CLASSES=n;exports.SIZE_CLASSES=a;exports.TAG_CLASSES=c;exports.TRIGGER_CLASSES=t;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const DEFAULT_MAX_HEIGHT = 280;
|
|
2
|
+
export declare const INDENT_PX = 20;
|
|
3
|
+
export declare const SIZE_CLASSES: {
|
|
4
|
+
readonly sm: "bear-py-1.5 bear-px-3 bear-text-sm";
|
|
5
|
+
readonly md: "bear-py-2 bear-px-4 bear-text-base";
|
|
6
|
+
readonly lg: "bear-py-2.5 bear-px-5 bear-text-lg";
|
|
7
|
+
};
|
|
8
|
+
export declare const ROOT_CLASSES = "Bear-TreeSelect bear-relative bear-inline-block bear-w-full";
|
|
9
|
+
export declare const TRIGGER_CLASSES = "bear-w-full bear-flex bear-items-center bear-justify-between bear-rounded-lg bear-border bear-border-gray-300 dark:bear-border-zinc-600 bear-bg-white dark:bear-bg-zinc-800 bear-text-gray-900 dark:bear-text-white bear-transition-colors focus:bear-ring-2 focus:bear-ring-pink-500 bear-outline-none";
|
|
10
|
+
export declare const DROPDOWN_CLASSES = "bear-absolute bear-z-[9999] bear-w-full bear-mt-1 bear-bg-white dark:bear-bg-zinc-800 bear-border bear-border-gray-200 dark:bear-border-zinc-700 bear-rounded-xl bear-shadow-xl bear-overflow-hidden";
|
|
11
|
+
export declare const SEARCH_CLASSES = "bear-w-full bear-px-3 bear-py-2 bear-text-sm bear-bg-transparent bear-border-b bear-border-gray-200 dark:bear-border-zinc-700 bear-outline-none bear-text-gray-900 dark:bear-text-white";
|
|
12
|
+
export declare const NODE_CLASSES = "bear-flex bear-items-center bear-py-1.5 bear-px-3 bear-cursor-pointer bear-transition-colors hover:bear-bg-gray-50 dark:hover:bear-bg-zinc-700 bear-text-sm bear-text-gray-700 dark:bear-text-zinc-300";
|
|
13
|
+
export declare const NODE_SELECTED_CLASSES = "bear-bg-pink-50 dark:bear-bg-pink-900/20 bear-text-pink-700 dark:bear-text-pink-300";
|
|
14
|
+
export declare const NODE_DISABLED_CLASSES = "bear-opacity-40 bear-cursor-not-allowed";
|
|
15
|
+
export declare const CHEVRON_CLASSES = "bear-w-4 bear-h-4 bear-mr-1 bear-text-gray-400 dark:bear-text-zinc-500 bear-transition-transform bear-cursor-pointer";
|
|
16
|
+
export declare const TAG_CLASSES = "bear-inline-flex bear-items-center bear-gap-1 bear-bg-pink-100 dark:bear-bg-pink-900/30 bear-text-pink-700 dark:bear-text-pink-300 bear-rounded bear-px-1.5 bear-py-0.5 bear-text-xs";
|
|
17
|
+
export declare const LABEL_CLASSES = "Bear-TreeSelect__label bear-block bear-text-sm bear-font-medium bear-text-gray-700 dark:bear-text-zinc-300 bear-mb-1.5";
|
|
18
|
+
export declare const ERROR_CLASSES = "bear-mt-1 bear-text-xs bear-text-red-500";
|
|
19
|
+
export declare const HELPER_CLASSES = "bear-mt-1 bear-text-xs bear-text-gray-500 dark:bear-text-zinc-500";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const e = 280, r = 20, a = {
|
|
2
|
+
sm: "bear-py-1.5 bear-px-3 bear-text-sm",
|
|
3
|
+
md: "bear-py-2 bear-px-4 bear-text-base",
|
|
4
|
+
lg: "bear-py-2.5 bear-px-5 bear-text-lg"
|
|
5
|
+
}, b = "Bear-TreeSelect bear-relative bear-inline-block bear-w-full", t = "bear-w-full bear-flex bear-items-center bear-justify-between bear-rounded-lg bear-border bear-border-gray-300 dark:bear-border-zinc-600 bear-bg-white dark:bear-bg-zinc-800 bear-text-gray-900 dark:bear-text-white bear-transition-colors focus:bear-ring-2 focus:bear-ring-pink-500 bear-outline-none", n = "bear-absolute bear-z-[9999] bear-w-full bear-mt-1 bear-bg-white dark:bear-bg-zinc-800 bear-border bear-border-gray-200 dark:bear-border-zinc-700 bear-rounded-xl bear-shadow-xl bear-overflow-hidden", o = "bear-w-full bear-px-3 bear-py-2 bear-text-sm bear-bg-transparent bear-border-b bear-border-gray-200 dark:bear-border-zinc-700 bear-outline-none bear-text-gray-900 dark:bear-text-white", i = "bear-flex bear-items-center bear-py-1.5 bear-px-3 bear-cursor-pointer bear-transition-colors hover:bear-bg-gray-50 dark:hover:bear-bg-zinc-700 bear-text-sm bear-text-gray-700 dark:bear-text-zinc-300", S = "bear-bg-pink-50 dark:bear-bg-pink-900/20 bear-text-pink-700 dark:bear-text-pink-300", s = "bear-opacity-40 bear-cursor-not-allowed", x = "bear-w-4 bear-h-4 bear-mr-1 bear-text-gray-400 dark:bear-text-zinc-500 bear-transition-transform bear-cursor-pointer", c = "bear-inline-flex bear-items-center bear-gap-1 bear-bg-pink-100 dark:bear-bg-pink-900/30 bear-text-pink-700 dark:bear-text-pink-300 bear-rounded bear-px-1.5 bear-py-0.5 bear-text-xs", d = "Bear-TreeSelect__label bear-block bear-text-sm bear-font-medium bear-text-gray-700 dark:bear-text-zinc-300 bear-mb-1.5", l = "bear-mt-1 bear-text-xs bear-text-red-500", E = "bear-mt-1 bear-text-xs bear-text-gray-500 dark:bear-text-zinc-500";
|
|
6
|
+
export {
|
|
7
|
+
x as CHEVRON_CLASSES,
|
|
8
|
+
e as DEFAULT_MAX_HEIGHT,
|
|
9
|
+
n as DROPDOWN_CLASSES,
|
|
10
|
+
l as ERROR_CLASSES,
|
|
11
|
+
E as HELPER_CLASSES,
|
|
12
|
+
r as INDENT_PX,
|
|
13
|
+
d as LABEL_CLASSES,
|
|
14
|
+
i as NODE_CLASSES,
|
|
15
|
+
s as NODE_DISABLED_CLASSES,
|
|
16
|
+
S as NODE_SELECTED_CLASSES,
|
|
17
|
+
b as ROOT_CLASSES,
|
|
18
|
+
o as SEARCH_CLASSES,
|
|
19
|
+
a as SIZE_CLASSES,
|
|
20
|
+
c as TAG_CLASSES,
|
|
21
|
+
t as TRIGGER_CLASSES
|
|
22
|
+
};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { jsxs as S, jsx as r, Fragment as W } from "react/jsx-runtime";
|
|
2
|
+
import { useState as v, useRef as V, useMemo as w, useEffect as X, useCallback as y } from "react";
|
|
3
|
+
import { cn as p } from "../../utils/cn.js";
|
|
4
|
+
import { DEFAULT_MAX_HEIGHT as U, LABEL_CLASSES as Z, SIZE_CLASSES as q, TRIGGER_CLASSES as J, DROPDOWN_CLASSES as K, SEARCH_CLASSES as Q, ERROR_CLASSES as Y, HELPER_CLASSES as $, ROOT_CLASSES as ee, TAG_CLASSES as re, CHEVRON_CLASSES as ae, INDENT_PX as te, NODE_DISABLED_CLASSES as se, NODE_SELECTED_CLASSES as le, NODE_CLASSES as ne } from "./TreeSelect.const.js";
|
|
5
|
+
import { collectAllIds as ce, filterNodes as oe, findNodeById as g } from "./TreeSelect.utils.js";
|
|
6
|
+
const R = ({ node: a, depth: l, selected: c, expanded: t, multiple: n, onToggleExpand: u, onSelect: h }) => {
|
|
7
|
+
const o = a.children && a.children.length > 0, f = t.has(a.id), b = c.has(a.id);
|
|
8
|
+
return /* @__PURE__ */ S(W, { children: [
|
|
9
|
+
/* @__PURE__ */ S(
|
|
10
|
+
"div",
|
|
11
|
+
{
|
|
12
|
+
className: p(ne, b && le, a.disabled && se),
|
|
13
|
+
style: { paddingLeft: l * te + 12 },
|
|
14
|
+
onClick: () => !a.disabled && h(a.id),
|
|
15
|
+
role: "treeitem",
|
|
16
|
+
"aria-selected": b,
|
|
17
|
+
"aria-expanded": o ? f : void 0,
|
|
18
|
+
children: [
|
|
19
|
+
o ? /* @__PURE__ */ r(
|
|
20
|
+
"svg",
|
|
21
|
+
{
|
|
22
|
+
className: p(ae, f && "bear-rotate-90"),
|
|
23
|
+
onClick: (m) => {
|
|
24
|
+
m.stopPropagation(), u(a.id);
|
|
25
|
+
},
|
|
26
|
+
fill: "none",
|
|
27
|
+
viewBox: "0 0 24 24",
|
|
28
|
+
stroke: "currentColor",
|
|
29
|
+
children: /* @__PURE__ */ r("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" })
|
|
30
|
+
}
|
|
31
|
+
) : /* @__PURE__ */ r("span", { className: "bear-w-4 bear-mr-1" }),
|
|
32
|
+
n && /* @__PURE__ */ r("span", { className: p("bear-w-4 bear-h-4 bear-mr-2 bear-border bear-rounded bear-flex bear-items-center bear-justify-center bear-text-xs", b ? "bear-bg-pink-500 bear-border-pink-500 bear-text-white" : "bear-border-gray-300 dark:bear-border-zinc-600"), children: b && "✓" }),
|
|
33
|
+
a.icon && /* @__PURE__ */ r("span", { className: "bear-mr-1.5", children: a.icon }),
|
|
34
|
+
/* @__PURE__ */ r("span", { className: "bear-truncate", children: a.label })
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
),
|
|
38
|
+
o && f && a.children.map((m) => /* @__PURE__ */ r(R, { node: m, depth: l + 1, selected: c, expanded: t, multiple: n, onToggleExpand: u, onSelect: h }, m.id))
|
|
39
|
+
] });
|
|
40
|
+
}, pe = (a) => {
|
|
41
|
+
const {
|
|
42
|
+
nodes: l,
|
|
43
|
+
value: c,
|
|
44
|
+
onChange: t,
|
|
45
|
+
multiple: n = !1,
|
|
46
|
+
label: u,
|
|
47
|
+
placeholder: h = "Select…",
|
|
48
|
+
disabled: o = !1,
|
|
49
|
+
clearable: f = !0,
|
|
50
|
+
searchable: b = !0,
|
|
51
|
+
expandAll: m = !1,
|
|
52
|
+
size: O = "md",
|
|
53
|
+
error: E,
|
|
54
|
+
helperText: k,
|
|
55
|
+
maxHeight: D = U,
|
|
56
|
+
className: I,
|
|
57
|
+
testId: T,
|
|
58
|
+
...H
|
|
59
|
+
} = a, [N, x] = v(!1), [A, L] = v(""), C = V(null), j = w(() => ce(l), [l]), [z, B] = v(() => m ? j : /* @__PURE__ */ new Set()), i = w(() => c ? new Set(Array.isArray(c) ? c : [c]) : /* @__PURE__ */ new Set(), [c]);
|
|
60
|
+
X(() => {
|
|
61
|
+
const e = (s) => {
|
|
62
|
+
C.current && !C.current.contains(s.target) && (x(!1), L(""));
|
|
63
|
+
};
|
|
64
|
+
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
65
|
+
}, []);
|
|
66
|
+
const P = y((e) => {
|
|
67
|
+
B((s) => {
|
|
68
|
+
const d = new Set(s);
|
|
69
|
+
return d.has(e) ? d.delete(e) : d.add(e), d;
|
|
70
|
+
});
|
|
71
|
+
}, []), G = y((e) => {
|
|
72
|
+
if (n) {
|
|
73
|
+
const s = new Set(i);
|
|
74
|
+
s.has(e) ? s.delete(e) : s.add(e), t == null || t(Array.from(s));
|
|
75
|
+
} else
|
|
76
|
+
t == null || t(e), x(!1), L("");
|
|
77
|
+
}, [n, i, t]), M = y(() => {
|
|
78
|
+
t == null || t(n ? [] : "");
|
|
79
|
+
}, [n, t]), _ = A ? oe(l, A) : l, F = () => {
|
|
80
|
+
if (i.size === 0) return /* @__PURE__ */ r("span", { className: "bear-text-gray-400 dark:bear-text-zinc-500", children: h });
|
|
81
|
+
if (n)
|
|
82
|
+
return /* @__PURE__ */ r("div", { className: "bear-flex bear-flex-wrap bear-gap-1", children: Array.from(i).map((s) => {
|
|
83
|
+
const d = g(l, s);
|
|
84
|
+
return d ? /* @__PURE__ */ r("span", { className: re, children: d.label }, s) : null;
|
|
85
|
+
}) });
|
|
86
|
+
const e = g(l, Array.from(i)[0]);
|
|
87
|
+
return (e == null ? void 0 : e.label) ?? h;
|
|
88
|
+
};
|
|
89
|
+
return /* @__PURE__ */ S("div", { ref: C, className: p(ee, I), "data-testid": T, ...H, children: [
|
|
90
|
+
u && /* @__PURE__ */ r("label", { className: Z, children: u }),
|
|
91
|
+
/* @__PURE__ */ S(
|
|
92
|
+
"button",
|
|
93
|
+
{
|
|
94
|
+
type: "button",
|
|
95
|
+
disabled: o,
|
|
96
|
+
onClick: () => !o && x(!N),
|
|
97
|
+
className: p(J, q[O], o && "bear-opacity-50 bear-cursor-not-allowed"),
|
|
98
|
+
children: [
|
|
99
|
+
/* @__PURE__ */ r("span", { className: "bear-flex-1 bear-text-left bear-truncate", children: F() }),
|
|
100
|
+
/* @__PURE__ */ S("div", { className: "bear-flex bear-items-center bear-gap-1", children: [
|
|
101
|
+
f && i.size > 0 && /* @__PURE__ */ r("span", { className: "bear-text-gray-400 hover:bear-text-gray-600 bear-cursor-pointer", onClick: (e) => {
|
|
102
|
+
e.stopPropagation(), M();
|
|
103
|
+
}, children: "✕" }),
|
|
104
|
+
/* @__PURE__ */ r("svg", { className: p("bear-w-4 bear-h-4 bear-text-gray-400 bear-transition-transform", N && "bear-rotate-180"), fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ r("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" }) })
|
|
105
|
+
] })
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
),
|
|
109
|
+
N && /* @__PURE__ */ S("div", { className: K, children: [
|
|
110
|
+
b && /* @__PURE__ */ r(
|
|
111
|
+
"input",
|
|
112
|
+
{
|
|
113
|
+
className: Q,
|
|
114
|
+
placeholder: "Search…",
|
|
115
|
+
value: A,
|
|
116
|
+
onChange: (e) => L(e.target.value),
|
|
117
|
+
autoFocus: !0
|
|
118
|
+
}
|
|
119
|
+
),
|
|
120
|
+
/* @__PURE__ */ r("div", { style: { maxHeight: D }, className: "bear-overflow-y-auto", role: "tree", children: _.length > 0 ? _.map((e) => /* @__PURE__ */ r(R, { node: e, depth: 0, selected: i, expanded: z, multiple: n, onToggleExpand: P, onSelect: G }, e.id)) : /* @__PURE__ */ r("div", { className: "bear-py-6 bear-text-center bear-text-sm bear-text-gray-400", children: "No results" }) })
|
|
121
|
+
] }),
|
|
122
|
+
E && /* @__PURE__ */ r("p", { className: Y, children: E }),
|
|
123
|
+
!E && k && /* @__PURE__ */ r("p", { className: $, children: k })
|
|
124
|
+
] });
|
|
125
|
+
};
|
|
126
|
+
export {
|
|
127
|
+
pe as TreeSelect
|
|
128
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
export interface TreeNode {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
children?: TreeNode[];
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
icon?: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export interface TreeSelectProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
10
|
+
nodes: TreeNode[];
|
|
11
|
+
value?: string | string[];
|
|
12
|
+
onChange?: (value: string | string[]) => void;
|
|
13
|
+
multiple?: boolean;
|
|
14
|
+
label?: string;
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
clearable?: boolean;
|
|
18
|
+
searchable?: boolean;
|
|
19
|
+
expandAll?: boolean;
|
|
20
|
+
size?: 'sm' | 'md' | 'lg';
|
|
21
|
+
error?: string;
|
|
22
|
+
helperText?: string;
|
|
23
|
+
maxHeight?: number;
|
|
24
|
+
testId?: string;
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=(t,r)=>{for(const e of t){if(e.id===r)return e;if(e.children){const n=d(e.children,r);if(n)return n}}},c=(t,r)=>{const e=r.toLowerCase();return t.reduce((n,l)=>{const o=l.children?c(l.children,r):[];return(l.label.toLowerCase().includes(e)||o.length>0)&&n.push({...l,children:o.length>0?o:l.children}),n},[])},i=t=>{const r=new Set;for(const e of t)r.add(e.id),e.children&&i(e.children).forEach(n=>r.add(n));return r};exports.collectAllIds=i;exports.filterNodes=c;exports.findNodeById=d;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { TreeNode } from './TreeSelect.types';
|
|
2
|
+
export declare const flattenNodes: (nodes: TreeNode[]) => TreeNode[];
|
|
3
|
+
export declare const findNodeById: (nodes: TreeNode[], id: string) => TreeNode | undefined;
|
|
4
|
+
export declare const filterNodes: (nodes: TreeNode[], query: string) => TreeNode[];
|
|
5
|
+
export declare const collectAllIds: (nodes: TreeNode[]) => Set<string>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const l = (t, r) => {
|
|
2
|
+
for (const e of t) {
|
|
3
|
+
if (e.id === r) return e;
|
|
4
|
+
if (e.children) {
|
|
5
|
+
const n = l(e.children, r);
|
|
6
|
+
if (n) return n;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
}, d = (t, r) => {
|
|
10
|
+
const e = r.toLowerCase();
|
|
11
|
+
return t.reduce((n, c) => {
|
|
12
|
+
const o = c.children ? d(c.children, r) : [];
|
|
13
|
+
return (c.label.toLowerCase().includes(e) || o.length > 0) && n.push({ ...c, children: o.length > 0 ? o : c.children }), n;
|
|
14
|
+
}, []);
|
|
15
|
+
}, i = (t) => {
|
|
16
|
+
const r = /* @__PURE__ */ new Set();
|
|
17
|
+
for (const e of t)
|
|
18
|
+
r.add(e.id), e.children && i(e.children).forEach((n) => r.add(n));
|
|
19
|
+
return r;
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
i as collectAllIds,
|
|
23
|
+
d as filterNodes,
|
|
24
|
+
l as findNodeById
|
|
25
|
+
};
|