@taiv/ui 1.15.0 → 2.1.0
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/dist/assets/assets.d.ts +12 -1
- package/dist/assets/assets.d.ts.map +1 -1
- package/dist/assets/assets.js +22 -16
- package/dist/assets/brand/taiv-favicon-dark.png +0 -0
- package/dist/assets/brand/taiv-favicon-light.png +0 -0
- package/dist/assets/brand/taiv-icon-black.svg +10 -0
- package/dist/assets/brand/taiv-icon-dark.svg +17 -0
- package/dist/assets/brand/taiv-icon-white.svg +17 -0
- package/dist/assets/brand/taiv-logo-black.svg +16 -0
- package/dist/assets/brand/taiv-logo-dark.svg +23 -0
- package/dist/assets/brand/taiv-logo-old.svg +1 -0
- package/dist/assets/brand/taiv-logo-purple.svg +16 -0
- package/dist/assets/brand/taiv-logo-white.svg +23 -0
- package/dist/assets/icons.d.ts +1 -1
- package/dist/assets/icons.d.ts.map +1 -1
- package/dist/assets/icons.js +57 -53
- package/dist/assets/index.d.ts +3 -0
- package/dist/assets/index.d.ts.map +1 -0
- package/dist/assets/index.js +2 -0
- package/dist/components/Data/BigCalendar/BigCalendar.d.ts +26 -0
- package/dist/components/Data/BigCalendar/BigCalendar.d.ts.map +1 -0
- package/dist/components/Data/BigCalendar/BigCalendar.js +92 -0
- package/dist/components/Data/BigCalendar/BigCalendar.stories.d.ts +8 -0
- package/dist/components/Data/BigCalendar/BigCalendar.stories.d.ts.map +1 -0
- package/dist/components/Data/BigCalendar/BigCalendar.stories.js +77 -0
- package/dist/components/Data/Calendar/Calendar.d.ts +102 -0
- package/dist/components/Data/Calendar/Calendar.d.ts.map +1 -0
- package/dist/components/Data/Calendar/Calendar.js +671 -0
- package/dist/components/Data/Calendar/Calendar.stories.d.ts +10 -0
- package/dist/components/Data/Calendar/Calendar.stories.d.ts.map +1 -0
- package/dist/components/Data/Calendar/Calendar.stories.js +87 -0
- package/dist/components/Data/Cards/StatsCard/StatsCard.d.ts +1 -1
- package/dist/components/Data/Cards/StatsCard/StatsCard.d.ts.map +1 -1
- package/dist/components/Data/CheckboxTable/CheckboxTable.d.ts +1 -1
- package/dist/components/Data/CheckboxTable/CheckboxTable.d.ts.map +1 -1
- package/dist/components/Data/MediaPill/MediaPill.d.ts +27 -0
- package/dist/components/Data/MediaPill/MediaPill.d.ts.map +1 -0
- package/dist/components/Data/MediaPill/MediaPill.js +53 -0
- package/dist/components/Data/MediaPill/MediaPill.stories.d.ts +10 -0
- package/dist/components/Data/MediaPill/MediaPill.stories.d.ts.map +1 -0
- package/dist/components/Data/MediaPill/MediaPill.stories.js +51 -0
- package/dist/components/Data/Progress/Progress.d.ts +1 -1
- package/dist/components/Data/Progress/Progress.d.ts.map +1 -1
- package/dist/components/Data/RemovableItemList/RemovableItemList.d.ts +1 -1
- package/dist/components/Data/RemovableItemList/RemovableItemList.d.ts.map +1 -1
- package/dist/components/Data/StatsBadge/StatsBadge.d.ts +2 -1
- package/dist/components/Data/StatsBadge/StatsBadge.d.ts.map +1 -1
- package/dist/components/Info/Avatar/Avatar.d.ts +9 -0
- package/dist/components/Info/Avatar/Avatar.d.ts.map +1 -0
- package/dist/components/Info/Avatar/Avatar.js +36 -0
- package/dist/components/Info/Avatar/Avatar.stories.d.ts +9 -0
- package/dist/components/Info/Avatar/Avatar.stories.d.ts.map +1 -0
- package/dist/components/Info/Avatar/Avatar.stories.js +78 -0
- package/dist/components/Info/Badge/Badge.d.ts +1 -1
- package/dist/components/Info/Badge/Badge.d.ts.map +1 -1
- package/dist/components/Info/Badge/Badge.stories.d.ts.map +1 -1
- package/dist/components/Info/Badge/Badge.stories.js +21 -6
- package/dist/components/Info/Badge/sizes.d.ts +10 -10
- package/dist/components/Info/Badge/sizes.js +16 -16
- package/dist/components/Info/Badge/variants.d.ts +4 -4
- package/dist/components/Info/Badge/variants.d.ts.map +1 -1
- package/dist/components/Info/Badge/variants.js +26 -13
- package/dist/components/Info/Drawer/Drawer.d.ts +24 -0
- package/dist/components/Info/Drawer/Drawer.d.ts.map +1 -0
- package/dist/components/Info/Drawer/Drawer.js +44 -0
- package/dist/components/Info/Drawer/Drawer.stories.d.ts +10 -0
- package/dist/components/Info/Drawer/Drawer.stories.d.ts.map +1 -0
- package/dist/components/Info/Drawer/Drawer.stories.js +47 -0
- package/dist/components/Info/HoverCard/HoverCard.d.ts +16 -0
- package/dist/components/Info/HoverCard/HoverCard.d.ts.map +1 -0
- package/dist/components/Info/HoverCard/HoverCard.js +26 -0
- package/dist/components/Info/HoverCard/HoverCard.stories.d.ts +11 -0
- package/dist/components/Info/HoverCard/HoverCard.stories.d.ts.map +1 -0
- package/dist/components/Info/HoverCard/HoverCard.stories.js +86 -0
- package/dist/components/Info/HoverCard/HoverCardMenuItem.d.ts +12 -0
- package/dist/components/Info/HoverCard/HoverCardMenuItem.d.ts.map +1 -0
- package/dist/components/Info/HoverCard/HoverCardMenuItem.js +22 -0
- package/dist/components/Info/Indicator/Indicator.d.ts +3 -0
- package/dist/components/Info/Indicator/Indicator.d.ts.map +1 -0
- package/dist/components/Info/Indicator/Indicator.js +1 -0
- package/dist/components/Info/Indicator/Indicator.stories.d.ts +11 -0
- package/dist/components/Info/Indicator/Indicator.stories.d.ts.map +1 -0
- package/dist/components/Info/Indicator/Indicator.stories.js +123 -0
- package/dist/components/Info/InfoCard/InfoCard.d.ts +3 -3
- package/dist/components/Info/InfoCard/InfoCard.d.ts.map +1 -1
- package/dist/components/Info/InfoCard/InfoCard.js +5 -5
- package/dist/components/Info/MobileDrawer/MobileDrawer.d.ts +30 -0
- package/dist/components/Info/MobileDrawer/MobileDrawer.d.ts.map +1 -0
- package/dist/components/Info/MobileDrawer/MobileDrawer.js +52 -0
- package/dist/components/Info/MobileDrawer/MobileDrawer.stories.d.ts +9 -0
- package/dist/components/Info/MobileDrawer/MobileDrawer.stories.d.ts.map +1 -0
- package/dist/components/Info/MobileDrawer/MobileDrawer.stories.js +38 -0
- package/dist/components/Info/Modals/FormModal/FormModal.d.ts +17 -1
- package/dist/components/Info/Modals/FormModal/FormModal.d.ts.map +1 -1
- package/dist/components/Info/Modals/FormModal/FormModal.js +30 -12
- package/dist/components/Info/Modals/FormModalV2/FormModalV2.d.ts +60 -0
- package/dist/components/Info/Modals/FormModalV2/FormModalV2.d.ts.map +1 -0
- package/dist/components/Info/Modals/FormModalV2/FormModalV2.js +96 -0
- package/dist/components/Info/Modals/Modal/Modal.d.ts +1 -1
- package/dist/components/Info/Modals/Modal/Modal.d.ts.map +1 -1
- package/dist/components/Info/Modals/Modal/Modal.js +9 -1
- package/dist/components/Info/Modals/ModalProvider/ModalProvider.d.ts +1 -1
- package/dist/components/Info/Modals/ModalProvider/ModalProvider.d.ts.map +1 -1
- package/dist/components/Info/Modals/StepperModal/StepperModal.d.ts +1 -1
- package/dist/components/Info/Modals/StepperModal/StepperModal.d.ts.map +1 -1
- package/dist/components/Info/Modals/variants.d.ts +61 -41
- package/dist/components/Info/Modals/variants.d.ts.map +1 -1
- package/dist/components/Info/Modals/variants.js +58 -38
- package/dist/components/Info/Notifications/NotificationProvider/NotificationProvider.d.ts +2 -1
- package/dist/components/Info/Notifications/NotificationProvider/NotificationProvider.d.ts.map +1 -1
- package/dist/components/Info/Notifications/Notifications.stories.d.ts +1 -0
- package/dist/components/Info/Notifications/Notifications.stories.d.ts.map +1 -1
- package/dist/components/Info/Notifications/Notifications.stories.js +31 -0
- package/dist/components/Info/Notifications/variants.d.ts +30 -23
- package/dist/components/Info/Notifications/variants.d.ts.map +1 -1
- package/dist/components/Info/Notifications/variants.js +30 -24
- package/dist/components/Info/ResponsiveDrawer/ResponsiveDrawer.d.ts +37 -0
- package/dist/components/Info/ResponsiveDrawer/ResponsiveDrawer.d.ts.map +1 -0
- package/dist/components/Info/ResponsiveDrawer/ResponsiveDrawer.js +17 -0
- package/dist/components/Info/ResponsiveDrawer/ResponsiveDrawer.stories.d.ts +7 -0
- package/dist/components/Info/ResponsiveDrawer/ResponsiveDrawer.stories.d.ts.map +1 -0
- package/dist/components/Info/ResponsiveDrawer/ResponsiveDrawer.stories.js +26 -0
- package/dist/components/Info/Tooltips/FormulaTooltip/FormulaTooltip.d.ts +2 -1
- package/dist/components/Info/Tooltips/FormulaTooltip/FormulaTooltip.d.ts.map +1 -1
- package/dist/components/Info/Tooltips/InfoTooltip/InfoTooltip.d.ts +2 -2
- package/dist/components/Info/Tooltips/InfoTooltip/InfoTooltip.d.ts.map +1 -1
- package/dist/components/Info/Tooltips/InfoTooltip/InfoTooltip.js +9 -3
- package/dist/components/Info/Tooltips/Popover/Popover.d.ts +16 -0
- package/dist/components/Info/Tooltips/Popover/Popover.d.ts.map +1 -0
- package/dist/components/Info/Tooltips/Popover/Popover.js +32 -0
- package/dist/components/Info/Tooltips/Tooltip/Tooltip.d.ts +5 -1
- package/dist/components/Info/Tooltips/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/components/Info/Tooltips/Tooltip/Tooltip.js +10 -8
- package/dist/components/Inputs/Buttons/Button/Button.d.ts +3 -1
- package/dist/components/Inputs/Buttons/Button/Button.d.ts.map +1 -1
- package/dist/components/Inputs/Buttons/Button/Button.js +38 -5
- package/dist/components/Inputs/Buttons/Button/Button.stories.d.ts +1 -0
- package/dist/components/Inputs/Buttons/Button/Button.stories.d.ts.map +1 -1
- package/dist/components/Inputs/Buttons/Button/Button.stories.js +105 -79
- package/dist/components/Inputs/Buttons/IconButton/IconButton.d.ts +7 -2
- package/dist/components/Inputs/Buttons/IconButton/IconButton.d.ts.map +1 -1
- package/dist/components/Inputs/Buttons/IconButton/IconButton.js +35 -11
- package/dist/components/Inputs/Buttons/IconButton/IconButton.stories.d.ts +1 -0
- package/dist/components/Inputs/Buttons/IconButton/IconButton.stories.d.ts.map +1 -1
- package/dist/components/Inputs/Buttons/IconButton/IconButton.stories.js +100 -74
- package/dist/components/Inputs/Buttons/IconButton/sizes.d.ts +15 -0
- package/dist/components/Inputs/Buttons/IconButton/sizes.d.ts.map +1 -1
- package/dist/components/Inputs/Buttons/IconButton/sizes.js +3 -0
- package/dist/components/Inputs/Buttons/SSOButton/SSOButton.d.ts +2 -2
- package/dist/components/Inputs/Buttons/SSOButton/SSOButton.d.ts.map +1 -1
- package/dist/components/Inputs/Buttons/UnstyledButton/UnstyledButton.d.ts +1 -1
- package/dist/components/Inputs/Buttons/UnstyledButton/UnstyledButton.d.ts.map +1 -1
- package/dist/components/Inputs/Buttons/shared/variants.d.ts +399 -164
- package/dist/components/Inputs/Buttons/shared/variants.d.ts.map +1 -1
- package/dist/components/Inputs/Buttons/shared/variants.js +353 -143
- package/dist/components/Inputs/ColorPickerTrigger/ColorPickerTrigger.d.ts +41 -0
- package/dist/components/Inputs/ColorPickerTrigger/ColorPickerTrigger.d.ts.map +1 -0
- package/dist/components/Inputs/ColorPickerTrigger/ColorPickerTrigger.js +139 -0
- package/dist/components/Inputs/ColorPickerTrigger/ColorPickerTrigger.stories.d.ts +13 -0
- package/dist/components/Inputs/ColorPickerTrigger/ColorPickerTrigger.stories.d.ts.map +1 -0
- package/dist/components/Inputs/ColorPickerTrigger/ColorPickerTrigger.stories.js +75 -0
- package/dist/components/Inputs/ColorSwatch/ColorSwatch.d.ts +27 -0
- package/dist/components/Inputs/ColorSwatch/ColorSwatch.d.ts.map +1 -0
- package/dist/components/Inputs/ColorSwatch/ColorSwatch.js +46 -0
- package/dist/components/Inputs/Controls/Checkbox/Checkbox.d.ts +2 -1
- package/dist/components/Inputs/Controls/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/components/Inputs/Controls/DaysOfWeek/DaysOfWeek.d.ts +32 -0
- package/dist/components/Inputs/Controls/DaysOfWeek/DaysOfWeek.d.ts.map +1 -0
- package/dist/components/Inputs/Controls/DaysOfWeek/DaysOfWeek.js +92 -0
- package/dist/components/Inputs/Controls/Radio/Radio.d.ts +2 -1
- package/dist/components/Inputs/Controls/Radio/Radio.d.ts.map +1 -1
- package/dist/components/Inputs/Controls/RadioList/RadioList.d.ts +1 -1
- package/dist/components/Inputs/Controls/RadioList/RadioList.d.ts.map +1 -1
- package/dist/components/Inputs/Controls/SegmentedControl/SegmentedControl.d.ts +13 -9
- package/dist/components/Inputs/Controls/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/dist/components/Inputs/Controls/SegmentedControl/SegmentedControl.js +20 -12
- package/dist/components/Inputs/Controls/Toggle/Toggle.d.ts +25 -11
- package/dist/components/Inputs/Controls/Toggle/Toggle.d.ts.map +1 -1
- package/dist/components/Inputs/Controls/Toggle/Toggle.js +67 -20
- package/dist/components/Inputs/Controls/Toggle/Toggle.stories.d.ts +1 -0
- package/dist/components/Inputs/Controls/Toggle/Toggle.stories.d.ts.map +1 -1
- package/dist/components/Inputs/Controls/Toggle/Toggle.stories.js +86 -69
- package/dist/components/Inputs/Dates/DatePicker/DatePicker.d.ts +2 -1
- package/dist/components/Inputs/Dates/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/components/Inputs/Dates/DatePicker/DatePicker.js +23 -7
- package/dist/components/Inputs/Dates/DateTimePicker/DateTimePicker.d.ts +13 -0
- package/dist/components/Inputs/Dates/DateTimePicker/DateTimePicker.d.ts.map +1 -0
- package/dist/components/Inputs/Dates/DateTimePicker/DateTimePicker.js +87 -0
- package/dist/components/Inputs/Dates/DateTimePicker/DateTimePicker.stories.d.ts +13 -0
- package/dist/components/Inputs/Dates/DateTimePicker/DateTimePicker.stories.d.ts.map +1 -0
- package/dist/components/Inputs/Dates/DateTimePicker/DateTimePicker.stories.js +239 -0
- package/dist/components/Inputs/Dates/TimeInput/TimeInput.d.ts +20 -0
- package/dist/components/Inputs/Dates/TimeInput/TimeInput.d.ts.map +1 -0
- package/dist/components/Inputs/Dates/TimeInput/TimeInput.js +51 -0
- package/dist/components/Inputs/Dropdowns/CascadingSelect/CascadingSelect.d.ts +1 -1
- package/dist/components/Inputs/Dropdowns/CascadingSelect/CascadingSelect.d.ts.map +1 -1
- package/dist/components/Inputs/Dropdowns/FontSelect/FontSelect.d.ts +2 -1
- package/dist/components/Inputs/Dropdowns/FontSelect/FontSelect.d.ts.map +1 -1
- package/dist/components/Inputs/Dropdowns/FontSelect/FontSelect.js +8 -1
- package/dist/components/Inputs/Dropdowns/MultiSelect/MultiSelect.d.ts +4 -3
- package/dist/components/Inputs/Dropdowns/MultiSelect/MultiSelect.d.ts.map +1 -1
- package/dist/components/Inputs/Dropdowns/MultiSelect/MultiSelect.js +76 -57
- package/dist/components/Inputs/Dropdowns/Select/Select.d.ts +2 -1
- package/dist/components/Inputs/Dropdowns/Select/Select.d.ts.map +1 -1
- package/dist/components/Inputs/Dropdowns/Select/Select.js +5 -3
- package/dist/components/Inputs/Dropzone/Dropzone.d.ts +24 -0
- package/dist/components/Inputs/Dropzone/Dropzone.d.ts.map +1 -0
- package/dist/components/Inputs/Dropzone/Dropzone.js +44 -0
- package/dist/components/Inputs/Dropzone/Dropzone.stories.d.ts +12 -0
- package/dist/components/Inputs/Dropzone/Dropzone.stories.d.ts.map +1 -0
- package/dist/components/Inputs/Dropzone/Dropzone.stories.js +114 -0
- package/dist/components/Inputs/Sliders/Slider/Slider.d.ts +1 -1
- package/dist/components/Inputs/Sliders/Slider/Slider.d.ts.map +1 -1
- package/dist/components/Inputs/Sliders/VolumeSlider/VolumeSlider.d.ts +2 -1
- package/dist/components/Inputs/Sliders/VolumeSlider/VolumeSlider.d.ts.map +1 -1
- package/dist/components/Inputs/TextInputs/AutoComplete/AutoComplete.d.ts +2 -1
- package/dist/components/Inputs/TextInputs/AutoComplete/AutoComplete.d.ts.map +1 -1
- package/dist/components/Inputs/TextInputs/NumberInput/NumberInput.d.ts +2 -1
- package/dist/components/Inputs/TextInputs/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/components/Inputs/TextInputs/NumberInput/NumberInput.js +4 -1
- package/dist/components/Inputs/TextInputs/NumberInput/ResponsiveNumberInput.d.ts +46 -0
- package/dist/components/Inputs/TextInputs/NumberInput/ResponsiveNumberInput.d.ts.map +1 -0
- package/dist/components/Inputs/TextInputs/NumberInput/ResponsiveNumberInput.js +60 -0
- package/dist/components/Inputs/TextInputs/PasswordInput/PasswordInput.d.ts +2 -1
- package/dist/components/Inputs/TextInputs/PasswordInput/PasswordInput.d.ts.map +1 -1
- package/dist/components/Inputs/TextInputs/SearchBar/SearchBar.d.ts +2 -1
- package/dist/components/Inputs/TextInputs/SearchBar/SearchBar.d.ts.map +1 -1
- package/dist/components/Inputs/TextInputs/TextArea/TextArea.d.ts +2 -1
- package/dist/components/Inputs/TextInputs/TextArea/TextArea.d.ts.map +1 -1
- package/dist/components/Inputs/TextInputs/TextInput/TextInput.d.ts +2 -1
- package/dist/components/Inputs/TextInputs/TextInput/TextInput.d.ts.map +1 -1
- package/dist/components/Layout/Accordion/Accordion.d.ts +16 -0
- package/dist/components/Layout/Accordion/Accordion.d.ts.map +1 -0
- package/dist/components/Layout/Accordion/Accordion.js +63 -0
- package/dist/components/Layout/Accordion/Accordion.stories.d.ts +11 -0
- package/dist/components/Layout/Accordion/Accordion.stories.d.ts.map +1 -0
- package/dist/components/Layout/Accordion/Accordion.stories.js +148 -0
- package/dist/components/Layout/AutoGrid/AutoGrid.d.ts +20 -5
- package/dist/components/Layout/AutoGrid/AutoGrid.d.ts.map +1 -1
- package/dist/components/Layout/AutoGrid/AutoGrid.js +51 -3
- package/dist/components/Layout/AutoGrid/AutoGrid.stories.d.ts +1 -0
- package/dist/components/Layout/AutoGrid/AutoGrid.stories.d.ts.map +1 -1
- package/dist/components/Layout/AutoGrid/AutoGrid.stories.js +39 -29
- package/dist/components/Layout/BottomActionBar/BottomActionBar.d.ts +40 -0
- package/dist/components/Layout/BottomActionBar/BottomActionBar.d.ts.map +1 -0
- package/dist/components/Layout/BottomActionBar/BottomActionBar.js +79 -0
- package/dist/components/Layout/BottomActionBar/BottomActionBar.stories.d.ts +10 -0
- package/dist/components/Layout/BottomActionBar/BottomActionBar.stories.d.ts.map +1 -0
- package/dist/components/Layout/BottomActionBar/BottomActionBar.stories.js +102 -0
- package/dist/components/Layout/Box/Box.d.ts +2 -1
- package/dist/components/Layout/Box/Box.d.ts.map +1 -1
- package/dist/components/Layout/Card/Card.d.ts +2 -2
- package/dist/components/Layout/Card/Card.d.ts.map +1 -1
- package/dist/components/Layout/Center/Center.d.ts +2 -1
- package/dist/components/Layout/Center/Center.d.ts.map +1 -1
- package/dist/components/Layout/Container/Container.d.ts +3 -0
- package/dist/components/Layout/Container/Container.d.ts.map +1 -0
- package/dist/components/Layout/Container/Container.js +1 -0
- package/dist/components/Layout/Container/Container.stories.d.ts +8 -0
- package/dist/components/Layout/Container/Container.stories.d.ts.map +1 -0
- package/dist/components/Layout/Container/Container.stories.js +52 -0
- package/dist/components/Layout/DataState/DataState.d.ts +34 -0
- package/dist/components/Layout/DataState/DataState.d.ts.map +1 -0
- package/dist/components/Layout/DataState/DataState.js +22 -0
- package/dist/components/Layout/DataState/DataState.stories.d.ts +11 -0
- package/dist/components/Layout/DataState/DataState.stories.d.ts.map +1 -0
- package/dist/components/Layout/DataState/DataState.stories.js +38 -0
- package/dist/components/Layout/Divider/Divider.d.ts +2 -1
- package/dist/components/Layout/Divider/Divider.d.ts.map +1 -1
- package/dist/components/Layout/Divider/Divider.js +4 -2
- package/dist/components/Layout/Frame/Frame.d.ts +2 -1
- package/dist/components/Layout/Frame/Frame.d.ts.map +1 -1
- package/dist/components/Layout/Grid/Grid.d.ts +1 -1
- package/dist/components/Layout/Group/Group.d.ts +3 -2
- package/dist/components/Layout/Group/Group.d.ts.map +1 -1
- package/dist/components/Layout/Loader/Loader.d.ts +2 -1
- package/dist/components/Layout/Loader/Loader.d.ts.map +1 -1
- package/dist/components/Layout/Loader/Loader.js +3 -2
- package/dist/components/Layout/Navbar/Navbar.d.ts +15 -0
- package/dist/components/Layout/Navbar/Navbar.d.ts.map +1 -0
- package/dist/components/Layout/Navbar/Navbar.js +20 -0
- package/dist/components/Layout/Navbar/Navbar.stories.d.ts +9 -0
- package/dist/components/Layout/Navbar/Navbar.stories.d.ts.map +1 -0
- package/dist/components/Layout/Navbar/Navbar.stories.js +98 -0
- package/dist/components/Layout/Page/Page.d.ts +13 -0
- package/dist/components/Layout/Page/Page.d.ts.map +1 -0
- package/dist/components/Layout/Page/Page.js +13 -0
- package/dist/components/Layout/Pagination/Pagination.d.ts +24 -0
- package/dist/components/Layout/Pagination/Pagination.d.ts.map +1 -0
- package/dist/components/Layout/Pagination/Pagination.js +53 -0
- package/dist/components/Layout/Pagination/Pagination.stories.d.ts +10 -0
- package/dist/components/Layout/Pagination/Pagination.stories.d.ts.map +1 -0
- package/dist/components/Layout/Pagination/Pagination.stories.js +76 -0
- package/dist/components/Layout/ScrollArea/ScrollArea.d.ts +3 -0
- package/dist/components/Layout/ScrollArea/ScrollArea.d.ts.map +1 -0
- package/dist/components/Layout/ScrollArea/ScrollArea.js +1 -0
- package/dist/components/Layout/ScrollArea/ScrollArea.stories.d.ts +8 -0
- package/dist/components/Layout/ScrollArea/ScrollArea.stories.d.ts.map +1 -0
- package/dist/components/Layout/ScrollArea/ScrollArea.stories.js +62 -0
- package/dist/components/Layout/SectionCard/SectionCard.d.ts +1 -1
- package/dist/components/Layout/SectionCard/SectionCard.d.ts.map +1 -1
- package/dist/components/Layout/Stack/Stack.d.ts +2 -1
- package/dist/components/Layout/Stack/Stack.d.ts.map +1 -1
- package/dist/components/Layout/Table/Table.d.ts +1 -1
- package/dist/components/Layout/Table/Table.d.ts.map +1 -1
- package/dist/components/Layout/Tabs/Tabs.d.ts +16 -5
- package/dist/components/Layout/Tabs/Tabs.d.ts.map +1 -1
- package/dist/components/Layout/Tabs/Tabs.js +53 -18
- package/dist/components/Layout/Tabs/Tabs.stories.d.ts.map +1 -1
- package/dist/components/Layout/Tabs/Tabs.stories.js +39 -39
- package/dist/components/Layout/VirtualGrid/VirtualGrid.d.ts +63 -0
- package/dist/components/Layout/VirtualGrid/VirtualGrid.d.ts.map +1 -0
- package/dist/components/Layout/VirtualGrid/VirtualGrid.js +159 -0
- package/dist/components/Misc/Burger/Burger.d.ts +6 -0
- package/dist/components/Misc/Burger/Burger.d.ts.map +1 -0
- package/dist/components/Misc/Burger/Burger.js +7 -0
- package/dist/components/Misc/Burger/Burger.stories.d.ts +10 -0
- package/dist/components/Misc/Burger/Burger.stories.d.ts.map +1 -0
- package/dist/components/Misc/Burger/Burger.stories.js +86 -0
- package/dist/components/Misc/Carousel/Carousel.d.ts +32 -0
- package/dist/components/Misc/Carousel/Carousel.d.ts.map +1 -0
- package/dist/components/Misc/Carousel/Carousel.js +16 -0
- package/dist/components/Misc/DragHandle/DragHandle.d.ts +19 -0
- package/dist/components/Misc/DragHandle/DragHandle.d.ts.map +1 -0
- package/dist/components/Misc/DragHandle/DragHandle.js +39 -0
- package/dist/components/Misc/DragHandle/DragHandle.stories.d.ts +9 -0
- package/dist/components/Misc/DragHandle/DragHandle.stories.d.ts.map +1 -0
- package/dist/components/Misc/DragHandle/DragHandle.stories.js +54 -0
- package/dist/components/Misc/FAB/FAB.d.ts +54 -0
- package/dist/components/Misc/FAB/FAB.d.ts.map +1 -0
- package/dist/components/Misc/FAB/FAB.js +53 -0
- package/dist/components/Misc/FAB/FAB.stories.d.ts +10 -0
- package/dist/components/Misc/FAB/FAB.stories.d.ts.map +1 -0
- package/dist/components/Misc/FAB/FAB.stories.js +100 -0
- package/dist/components/Misc/FloatingToolbar/FloatingToolbar.d.ts +50 -0
- package/dist/components/Misc/FloatingToolbar/FloatingToolbar.d.ts.map +1 -0
- package/dist/components/Misc/FloatingToolbar/FloatingToolbar.js +40 -0
- package/dist/components/Misc/FloatingToolbar/FloatingToolbar.stories.d.ts +9 -0
- package/dist/components/Misc/FloatingToolbar/FloatingToolbar.stories.d.ts.map +1 -0
- package/dist/components/Misc/FloatingToolbar/FloatingToolbar.stories.js +53 -0
- package/dist/components/Misc/HoverAction/HoverAction.d.ts +50 -0
- package/dist/components/Misc/HoverAction/HoverAction.d.ts.map +1 -0
- package/dist/components/Misc/HoverAction/HoverAction.js +61 -0
- package/dist/components/Misc/HoverAction/HoverAction.stories.d.ts +12 -0
- package/dist/components/Misc/HoverAction/HoverAction.stories.d.ts.map +1 -0
- package/dist/components/Misc/HoverAction/HoverAction.stories.js +96 -0
- package/dist/components/Misc/IconBadge/IconBadge.d.ts +1 -1
- package/dist/components/Misc/IconBadge/IconBadge.d.ts.map +1 -1
- package/dist/components/Misc/IconBadge/IconBadge.js +8 -6
- package/dist/components/Misc/Image/Image.d.ts +3 -0
- package/dist/components/Misc/Image/Image.d.ts.map +1 -0
- package/dist/components/Misc/Image/Image.js +1 -0
- package/dist/components/Misc/Image/Image.stories.d.ts +11 -0
- package/dist/components/Misc/Image/Image.stories.d.ts.map +1 -0
- package/dist/components/Misc/Image/Image.stories.js +63 -0
- package/dist/components/Misc/Kbd/Kbd.d.ts +7 -0
- package/dist/components/Misc/Kbd/Kbd.d.ts.map +1 -0
- package/dist/components/Misc/Kbd/Kbd.js +16 -0
- package/dist/components/Misc/Kbd/Kbd.stories.d.ts +9 -0
- package/dist/components/Misc/Kbd/Kbd.stories.d.ts.map +1 -0
- package/dist/components/Misc/Kbd/Kbd.stories.js +52 -0
- package/dist/components/Misc/LoadingOverlay/LoadingOverlay.d.ts +2 -1
- package/dist/components/Misc/LoadingOverlay/LoadingOverlay.d.ts.map +1 -1
- package/dist/components/Misc/Menu/Menu.d.ts +17 -0
- package/dist/components/Misc/Menu/Menu.d.ts.map +1 -0
- package/dist/components/Misc/Menu/Menu.js +52 -0
- package/dist/components/Misc/OverflowFade/OverflowFade.d.ts +42 -0
- package/dist/components/Misc/OverflowFade/OverflowFade.d.ts.map +1 -0
- package/dist/components/Misc/OverflowFade/OverflowFade.js +110 -0
- package/dist/components/Misc/OverflowFade/OverflowFade.stories.d.ts +11 -0
- package/dist/components/Misc/OverflowFade/OverflowFade.stories.d.ts.map +1 -0
- package/dist/components/Misc/OverflowFade/OverflowFade.stories.js +112 -0
- package/dist/components/Misc/Picker/Picker.d.ts +62 -0
- package/dist/components/Misc/Picker/Picker.d.ts.map +1 -0
- package/dist/components/Misc/Picker/Picker.js +111 -0
- package/dist/components/Misc/Picker/Picker.stories.d.ts +14 -0
- package/dist/components/Misc/Picker/Picker.stories.d.ts.map +1 -0
- package/dist/components/Misc/Picker/Picker.stories.js +154 -0
- package/dist/components/Misc/SelectableObject/SelectableObject.d.ts +38 -0
- package/dist/components/Misc/SelectableObject/SelectableObject.d.ts.map +1 -0
- package/dist/components/Misc/SelectableObject/SelectableObject.js +70 -0
- package/dist/components/Misc/SelectableObject/SelectableObject.stories.d.ts +11 -0
- package/dist/components/Misc/SelectableObject/SelectableObject.stories.d.ts.map +1 -0
- package/dist/components/Misc/SelectableObject/SelectableObject.stories.js +84 -0
- package/dist/components/Misc/SelectionToolbar/SelectionToolbar.d.ts +26 -0
- package/dist/components/Misc/SelectionToolbar/SelectionToolbar.d.ts.map +1 -0
- package/dist/components/Misc/SelectionToolbar/SelectionToolbar.js +41 -0
- package/dist/components/Misc/SelectionToolbar/SelectionToolbar.stories.d.ts +10 -0
- package/dist/components/Misc/SelectionToolbar/SelectionToolbar.stories.d.ts.map +1 -0
- package/dist/components/Misc/SelectionToolbar/SelectionToolbar.stories.js +48 -0
- package/dist/components/Misc/Skeleton/Skeleton.d.ts +1 -1
- package/dist/components/Misc/Skeleton/Skeleton.d.ts.map +1 -1
- package/dist/components/Misc/Stepper/Step.d.ts +1 -1
- package/dist/components/Misc/Stepper/Step.d.ts.map +1 -1
- package/dist/components/Misc/Stepper/Step.stories.d.ts +120 -120
- package/dist/components/Misc/Stepper/Stepper.d.ts +1 -1
- package/dist/components/Misc/Stepper/Stepper.d.ts.map +1 -1
- package/dist/components/Misc/Stepper/variants.d.ts +1 -1
- package/dist/components/Misc/Timeline/Timeline.d.ts +18 -0
- package/dist/components/Misc/Timeline/Timeline.d.ts.map +1 -0
- package/dist/components/Misc/Timeline/Timeline.js +38 -0
- package/dist/components/Misc/Timeline/Timeline.stories.d.ts +8 -0
- package/dist/components/Misc/Timeline/Timeline.stories.d.ts.map +1 -0
- package/dist/components/Misc/Timeline/Timeline.stories.js +54 -0
- package/dist/components/Misc/Transition/Transition.d.ts +2 -1
- package/dist/components/Misc/Transition/Transition.d.ts.map +1 -1
- package/dist/components/Typography/CollapsibleText/CollapsibleText.d.ts +1 -1
- package/dist/components/Typography/CollapsibleText/CollapsibleText.d.ts.map +1 -1
- package/dist/components/Typography/CollapsibleTitle/CollapsibleTitle.d.ts +1 -1
- package/dist/components/Typography/CollapsibleTitle/CollapsibleTitle.d.ts.map +1 -1
- package/dist/components/Typography/Formula/Formula.d.ts +2 -1
- package/dist/components/Typography/Formula/Formula.d.ts.map +1 -1
- package/dist/components/Typography/Fraction/Fraction.d.ts +1 -1
- package/dist/components/Typography/Fraction/Fraction.d.ts.map +1 -1
- package/dist/components/Typography/InlineEditableText/InlineEditableText.d.ts +35 -0
- package/dist/components/Typography/InlineEditableText/InlineEditableText.d.ts.map +1 -0
- package/dist/components/Typography/InlineEditableText/InlineEditableText.js +112 -0
- package/dist/components/Typography/InlineEditableText/InlineEditableText.stories.d.ts +11 -0
- package/dist/components/Typography/InlineEditableText/InlineEditableText.stories.d.ts.map +1 -0
- package/dist/components/Typography/InlineEditableText/InlineEditableText.stories.js +48 -0
- package/dist/components/Typography/Text/Text.d.ts +1 -1
- package/dist/components/Typography/Text/Text.d.ts.map +1 -1
- package/dist/components/Typography/Title/Title.d.ts +1 -1
- package/dist/components/Typography/Title/Title.d.ts.map +1 -1
- package/dist/components/index.d.ts +148 -66
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +110 -68
- package/dist/constants/colors.d.ts +117 -91
- package/dist/constants/colors.d.ts.map +1 -1
- package/dist/constants/colors.js +56 -43
- package/dist/constants/font.d.ts +4 -4
- package/dist/constants/font.js +2 -2
- package/dist/docs/AIGeneratedBanner.d.ts +1 -1
- package/dist/docs/AIGeneratedBanner.d.ts.map +1 -1
- package/dist/hooks/index.d.ts +9 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +7 -1
- package/dist/hooks/useConfirmationModal.d.ts.map +1 -1
- package/dist/hooks/useConfirmationModal.js +20 -1
- package/dist/hooks/useDisclosure.d.ts +11 -0
- package/dist/hooks/useDisclosure.d.ts.map +1 -0
- package/dist/hooks/useDisclosure.js +10 -0
- package/dist/hooks/useHeadroom.d.ts +18 -0
- package/dist/hooks/useHeadroom.d.ts.map +1 -0
- package/dist/hooks/useHeadroom.js +17 -0
- package/dist/hooks/useInfoModal.d.ts.map +1 -1
- package/dist/hooks/useInfoModal.js +13 -1
- package/dist/hooks/useMediaQuery.d.ts +1 -0
- package/dist/hooks/useMediaQuery.d.ts.map +1 -1
- package/dist/hooks/useMediaQuery.js +1 -0
- package/dist/hooks/useNotifications.d.ts +39 -7
- package/dist/hooks/useNotifications.d.ts.map +1 -1
- package/dist/hooks/useNotifications.js +108 -5
- package/dist/hooks/usePagination.d.ts +11 -0
- package/dist/hooks/usePagination.d.ts.map +1 -0
- package/dist/hooks/usePagination.js +2 -0
- package/dist/hooks/useScrollLock.d.ts +21 -0
- package/dist/hooks/useScrollLock.d.ts.map +1 -0
- package/dist/hooks/useScrollLock.js +20 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.js +5 -5
- package/dist/styles/iosInputZoomFix.d.ts +31 -0
- package/dist/styles/iosInputZoomFix.d.ts.map +1 -0
- package/dist/styles/iosInputZoomFix.js +135 -0
- package/dist/utils/bytes.d.ts +10 -0
- package/dist/utils/bytes.d.ts.map +1 -0
- package/dist/utils/bytes.js +17 -0
- package/dist/utils/datetime.d.ts +18 -0
- package/dist/utils/datetime.d.ts.map +1 -0
- package/dist/utils/datetime.js +42 -0
- package/dist/utils/duration.d.ts +17 -0
- package/dist/utils/duration.d.ts.map +1 -0
- package/dist/utils/duration.js +30 -0
- package/dist/utils/index.d.ts +8 -2
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +7 -2
- package/dist/utils/sort.d.ts +44 -0
- package/dist/utils/sort.d.ts.map +1 -0
- package/dist/utils/sort.js +53 -0
- package/dist/utils/string.d.ts +22 -0
- package/dist/utils/string.d.ts.map +1 -0
- package/dist/utils/string.js +25 -0
- package/package.json +28 -4
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Popover, Portal, UnstyledButton } from '@mantine/core';
|
|
3
|
+
import { forwardRef, useEffect, useMemo, useState, } from 'react';
|
|
4
|
+
import { neutral, primary, white } from '../../../constants/colors';
|
|
5
|
+
import { fontBase } from '../../../constants/font';
|
|
6
|
+
import { spacing } from '../../../constants/spacing';
|
|
7
|
+
import { useMobile } from '../../../hooks/useMediaQuery';
|
|
8
|
+
import { Tooltip } from '../../Info/Tooltips/Tooltip/Tooltip';
|
|
9
|
+
import { SearchBar } from '../../Inputs/TextInputs/SearchBar/SearchBar';
|
|
10
|
+
import { Stack } from '../../Layout/Stack/Stack';
|
|
11
|
+
import { Text } from '../../Typography/Text/Text';
|
|
12
|
+
const PickerItemRow = ({ item, onSelect }) => {
|
|
13
|
+
// Use Text for the label so it inherits Poppins via fontBase rather than
|
|
14
|
+
// relying on the host button to push fontFamily down. fontBase is still
|
|
15
|
+
// applied to the button itself for browsers that style buttons with the
|
|
16
|
+
// default UI font (Mantine UnstyledButton sets fontFamily: inherit, but
|
|
17
|
+
// belt-and-suspenders).
|
|
18
|
+
const button = (_jsxs(UnstyledButton, { disabled: item.disabled, onClick: item.disabled ? undefined : onSelect, sx: {
|
|
19
|
+
...fontBase,
|
|
20
|
+
'&:hover': item.disabled ? {} : { backgroundColor: neutral[25] },
|
|
21
|
+
alignItems: 'center',
|
|
22
|
+
color: item.disabled ? neutral[100] : neutral[300],
|
|
23
|
+
cursor: item.disabled ? 'not-allowed' : 'pointer',
|
|
24
|
+
display: 'flex',
|
|
25
|
+
gap: spacing.sm,
|
|
26
|
+
justifyContent: 'space-between',
|
|
27
|
+
padding: `${spacing.sm} ${spacing.md}`,
|
|
28
|
+
transition: 'background-color 120ms ease',
|
|
29
|
+
width: '100%',
|
|
30
|
+
}, children: [_jsx(Text, { style: {
|
|
31
|
+
color: item.disabled ? neutral[100] : neutral[300],
|
|
32
|
+
minWidth: 0,
|
|
33
|
+
}, truncate: true, variant: 'body', children: item.label }), item.meta && (_jsx("span", { style: { color: neutral[200], flexShrink: 0 }, children: item.meta }))] }));
|
|
34
|
+
if (item.disabled && item.disabledReason) {
|
|
35
|
+
return _jsx(Tooltip, { text: item.disabledReason, children: button });
|
|
36
|
+
}
|
|
37
|
+
return button;
|
|
38
|
+
};
|
|
39
|
+
const PickerTarget = forwardRef(({ children }, ref) => (_jsx(Popover.Target, { ref: ref, children: children })));
|
|
40
|
+
PickerTarget.displayName = 'Picker.Target';
|
|
41
|
+
const PickerComponent = ({ items, recentCount = 3, onSelect, searchPlaceholder = 'Search…', emptyMessage = 'No items', footer, opened, onOpenChange, position = 'bottom-end', width = 280, withinPortal = true, searchOnDesktopOnly = false, disableShowAll = false, children, }) => {
|
|
42
|
+
const [internalOpen, setInternalOpen] = useState(false);
|
|
43
|
+
const isControlled = opened !== undefined;
|
|
44
|
+
const isOpen = isControlled ? opened : internalOpen;
|
|
45
|
+
const setOpen = (next) => {
|
|
46
|
+
if (!isControlled)
|
|
47
|
+
setInternalOpen(next);
|
|
48
|
+
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(next);
|
|
49
|
+
};
|
|
50
|
+
const isMobile = useMobile();
|
|
51
|
+
const showSearch = !searchOnDesktopOnly || !isMobile;
|
|
52
|
+
const [query, setQuery] = useState('');
|
|
53
|
+
const [showAll, setShowAll] = useState(false);
|
|
54
|
+
// Reset transient view state every time the popover closes so it opens
|
|
55
|
+
// fresh next time (no stale search query / "show all" stuck on).
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
if (!isOpen) {
|
|
58
|
+
setQuery('');
|
|
59
|
+
setShowAll(false);
|
|
60
|
+
}
|
|
61
|
+
}, [isOpen]);
|
|
62
|
+
const sortedByRecency = useMemo(() => [...items].sort((a, b) => { var _a, _b; return ((_a = b.recencyKey) !== null && _a !== void 0 ? _a : 0) - ((_b = a.recencyKey) !== null && _b !== void 0 ? _b : 0); }), [items]);
|
|
63
|
+
const filtered = useMemo(() => {
|
|
64
|
+
const q = query.trim().toLowerCase();
|
|
65
|
+
if (!q)
|
|
66
|
+
return sortedByRecency;
|
|
67
|
+
return sortedByRecency.filter((i) => i.label.toLowerCase().includes(q));
|
|
68
|
+
}, [sortedByRecency, query]);
|
|
69
|
+
const isSearching = query.trim().length > 0;
|
|
70
|
+
// Compact dropdowns (e.g. card kebabs) opt out of the "Recent" header and
|
|
71
|
+
// "Show all N" toggle — they always show only `recentCount` in idle view.
|
|
72
|
+
const showShowAllToggle = !disableShowAll && !isSearching && !showAll && items.length > recentCount;
|
|
73
|
+
const showRecentHeader = showShowAllToggle;
|
|
74
|
+
const visibleItems = useMemo(() => {
|
|
75
|
+
if (isSearching)
|
|
76
|
+
return filtered;
|
|
77
|
+
if (disableShowAll)
|
|
78
|
+
return sortedByRecency.slice(0, recentCount);
|
|
79
|
+
if (showAll || items.length <= recentCount)
|
|
80
|
+
return sortedByRecency;
|
|
81
|
+
return sortedByRecency.slice(0, recentCount);
|
|
82
|
+
}, [
|
|
83
|
+
isSearching,
|
|
84
|
+
filtered,
|
|
85
|
+
showAll,
|
|
86
|
+
items.length,
|
|
87
|
+
recentCount,
|
|
88
|
+
sortedByRecency,
|
|
89
|
+
disableShowAll,
|
|
90
|
+
]);
|
|
91
|
+
return (_jsxs(_Fragment, { children: [isOpen && (_jsx(Portal, { children: _jsx("div", { onClick: () => setOpen(false), style: { inset: 0, position: 'fixed', zIndex: 299 } }) })), _jsxs(Popover, { offset: 8, onChange: setOpen, opened: isOpen, position: position, radius: 8, shadow: 'md', styles: {
|
|
92
|
+
dropdown: {
|
|
93
|
+
backgroundColor: white,
|
|
94
|
+
border: `1px solid ${neutral[50]}`,
|
|
95
|
+
padding: 0,
|
|
96
|
+
},
|
|
97
|
+
}, width: width, withinPortal: withinPortal, children: [children, _jsx(Popover.Dropdown, { children: _jsxs(Stack, { spacing: 0, children: [showSearch && (_jsx(Box, { p: spacing.xs, style: { borderBottom: `1px solid ${neutral[50]}` }, children: _jsx(SearchBar, { fullWidth: true, onChange: (e) => setQuery(e.target.value), placeholder: searchPlaceholder, size: 'sm', value: query }) })), showRecentHeader && (_jsx(Box, { pb: spacing.xs, pt: spacing.sm, px: spacing.md, style: { ...fontBase }, children: _jsx(Text, { style: { color: neutral[200] }, variant: 'label', children: "Recent" }) })), _jsx(Box, { style: { maxHeight: 280, overflowY: 'auto' }, children: visibleItems.length === 0 ? (_jsx(Box, { p: spacing.md, style: { textAlign: 'center' }, children: _jsx(Text, { variant: 'subtle', children: emptyMessage }) })) : (visibleItems.map((item) => (_jsx(PickerItemRow, { item: item, onSelect: () => {
|
|
98
|
+
onSelect(item);
|
|
99
|
+
setOpen(false);
|
|
100
|
+
} }, item.id)))) }), showShowAllToggle && (_jsx(Box, { p: spacing.xs, style: { borderTop: `1px solid ${neutral[50]}` }, children: _jsx(UnstyledButton, { onClick: () => setShowAll(true), sx: {
|
|
101
|
+
...fontBase,
|
|
102
|
+
'&:hover': { color: primary[200] },
|
|
103
|
+
color: primary[200],
|
|
104
|
+
cursor: 'pointer',
|
|
105
|
+
display: 'block',
|
|
106
|
+
padding: `${spacing.xs} ${spacing.sm}`,
|
|
107
|
+
textAlign: 'center',
|
|
108
|
+
width: '100%',
|
|
109
|
+
}, children: _jsxs(Text, { style: { color: 'inherit', textAlign: 'center' }, variant: 'label', children: ["Show all ", items.length] }) }) })), footer && (_jsx(Box, { p: spacing.xs, style: { borderTop: `1px solid ${neutral[50]}` }, children: footer }))] }) })] })] }));
|
|
110
|
+
};
|
|
111
|
+
export const Picker = Object.assign(PickerComponent, { Target: PickerTarget });
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { Picker } from './Picker';
|
|
3
|
+
declare const meta: Meta<typeof Picker>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Picker>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const WithRecentAndShowAll: Story;
|
|
8
|
+
export declare const WithFooter: Story;
|
|
9
|
+
export declare const Empty: Story;
|
|
10
|
+
export declare const WithDisabledItems: Story;
|
|
11
|
+
export declare const Controlled: Story;
|
|
12
|
+
export declare const AnchoredToIconButton: Story;
|
|
13
|
+
export declare const OnDarkSurface: Story;
|
|
14
|
+
//# sourceMappingURL=Picker.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Picker.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/Misc/Picker/Picker.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AASlC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,MAAM,CA4B7B,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,MAAM,CAAC,CAAC;AAmBrC,eAAO,MAAM,OAAO,EAAE,KAqBrB,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,KA6BlC,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,KA+BxB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KA6BnB,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,KA+B/B,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,KA4BxB,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,KAqBlC,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KA0C3B,CAAC"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { IconPlus } from '@tabler/icons-react';
|
|
4
|
+
import { Picker } from './Picker';
|
|
5
|
+
import { Button } from '../../Inputs/Buttons/Button/Button';
|
|
6
|
+
import { IconButton } from '../../Inputs/Buttons/IconButton/IconButton';
|
|
7
|
+
import { Group } from '../../Layout/Group/Group';
|
|
8
|
+
import { Stack } from '../../Layout/Stack/Stack';
|
|
9
|
+
import { Text } from '../../Typography/Text/Text';
|
|
10
|
+
import { spacing } from '../../../constants/spacing';
|
|
11
|
+
const meta = {
|
|
12
|
+
title: 'Components/Misc/Picker',
|
|
13
|
+
component: Picker,
|
|
14
|
+
parameters: {
|
|
15
|
+
layout: 'centered',
|
|
16
|
+
docs: {
|
|
17
|
+
description: {
|
|
18
|
+
component: 'A searchable list popover for picking a single item. Idle state ' +
|
|
19
|
+
'surfaces the most recent N items + a "Show all" toggle; typing in ' +
|
|
20
|
+
'the search filters across the full list. Use for "add to playlist", ' +
|
|
21
|
+
'"move to folder", or any compact pick-one flow.\n\n' +
|
|
22
|
+
'Compose via `Picker.Target` for the trigger; the dropdown is owned ' +
|
|
23
|
+
'by the component. For nested triggers (e.g. inside another Menu), ' +
|
|
24
|
+
'use the controlled `opened` prop.',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
argTypes: {
|
|
29
|
+
recentCount: {
|
|
30
|
+
control: { type: 'number' },
|
|
31
|
+
table: { defaultValue: { summary: '3' } },
|
|
32
|
+
},
|
|
33
|
+
width: {
|
|
34
|
+
control: { type: 'number' },
|
|
35
|
+
table: { defaultValue: { summary: '280' } },
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
export default meta;
|
|
40
|
+
const fewPlaylists = [
|
|
41
|
+
{ id: 'p1', label: 'Morning Mix', meta: '12 slides', recencyKey: Date.now() },
|
|
42
|
+
{ id: 'p2', label: 'Lunch Specials', meta: '4 slides', recencyKey: Date.now() - 1000 },
|
|
43
|
+
{ id: 'p3', label: 'Evening Wind-down', meta: '7 slides', recencyKey: Date.now() - 2000 },
|
|
44
|
+
];
|
|
45
|
+
const manyPlaylists = [
|
|
46
|
+
{ id: 'p1', label: 'Morning Mix', meta: '12 slides', recencyKey: 9 },
|
|
47
|
+
{ id: 'p2', label: 'Lunch Specials', meta: '4 slides', recencyKey: 8 },
|
|
48
|
+
{ id: 'p3', label: 'Evening Wind-down', meta: '7 slides', recencyKey: 7 },
|
|
49
|
+
{ id: 'p4', label: 'Trivia Night', meta: '20 slides', recencyKey: 6 },
|
|
50
|
+
{ id: 'p5', label: 'Weekend Brunch', meta: '8 slides', recencyKey: 5 },
|
|
51
|
+
{ id: 'p6', label: 'Holidays — December', meta: '15 slides', recencyKey: 4 },
|
|
52
|
+
{ id: 'p7', label: 'Local Sports', meta: '10 slides', recencyKey: 3 },
|
|
53
|
+
{ id: 'p8', label: 'Promotions', meta: '6 slides', recencyKey: 2 },
|
|
54
|
+
];
|
|
55
|
+
export const Default = {
|
|
56
|
+
render: () => {
|
|
57
|
+
const [picked, setPicked] = useState(null);
|
|
58
|
+
return (_jsxs(Stack, { gap: spacing.sm, align: 'center', children: [_jsx(Picker, { items: fewPlaylists, onSelect: (item) => setPicked(item.label), searchPlaceholder: 'Search playlists\u2026', emptyMessage: 'No playlists yet', children: _jsx(Picker.Target, { children: _jsx(Button, { children: "Add to playlist" }) }) }), picked && (_jsxs(Text, { variant: 'subtle', children: ["You picked: ", picked] }))] }));
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
export const WithRecentAndShowAll = {
|
|
62
|
+
parameters: {
|
|
63
|
+
docs: {
|
|
64
|
+
description: {
|
|
65
|
+
story: 'When `items.length > recentCount`, the idle view shows only the top N (sorted by `recencyKey` desc) with a "Show all N" toggle. Typing in search jumps to filtered full list.',
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
render: () => {
|
|
70
|
+
const [picked, setPicked] = useState(null);
|
|
71
|
+
return (_jsxs(Stack, { gap: spacing.sm, align: 'center', children: [_jsx(Picker, { items: manyPlaylists, recentCount: 3, onSelect: (item) => setPicked(item.label), searchPlaceholder: 'Search 8 playlists\u2026', children: _jsx(Picker.Target, { children: _jsx(Button, { children: "Pick one of 8" }) }) }), picked && (_jsxs(Text, { variant: 'subtle', children: ["You picked: ", picked] }))] }));
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
export const WithFooter = {
|
|
75
|
+
parameters: {
|
|
76
|
+
docs: {
|
|
77
|
+
description: {
|
|
78
|
+
story: 'A common pattern: a "+ Create new …" button below the list. The footer slot is always visible regardless of search state.',
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
render: () => (_jsx(Picker, { items: manyPlaylists, recentCount: 3, onSelect: () => undefined, searchPlaceholder: 'Search playlists\u2026', footer: _jsx(Button, { variant: 'text', size: 'sm', leftIcon: _jsx(IconPlus, { size: 14 }), fullWidth: true, children: "Create new playlist" }), children: _jsx(Picker.Target, { children: _jsx(Button, { children: "Add to playlist" }) }) })),
|
|
83
|
+
};
|
|
84
|
+
export const Empty = {
|
|
85
|
+
parameters: {
|
|
86
|
+
docs: {
|
|
87
|
+
description: {
|
|
88
|
+
story: 'Empty state shows the configured message when no items exist.',
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
render: () => (_jsx(Picker, { items: [], onSelect: () => undefined, emptyMessage: 'No playlists yet', footer: _jsx(Button, { variant: 'text', size: 'sm', leftIcon: _jsx(IconPlus, { size: 14 }), fullWidth: true, children: "Create your first playlist" }), children: _jsx(Picker.Target, { children: _jsx(Button, { children: "Add to playlist" }) }) })),
|
|
93
|
+
};
|
|
94
|
+
export const WithDisabledItems = {
|
|
95
|
+
parameters: {
|
|
96
|
+
docs: {
|
|
97
|
+
description: {
|
|
98
|
+
story: 'Items can be disabled with an explanatory tooltip — useful for ' +
|
|
99
|
+
'"already in playlist" or permission-gated entries.',
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
render: () => (_jsx(Picker, { items: [
|
|
104
|
+
{ id: 'p1', label: 'Morning Mix', meta: '12 slides', recencyKey: 3 },
|
|
105
|
+
{
|
|
106
|
+
id: 'p2',
|
|
107
|
+
label: 'Lunch Specials',
|
|
108
|
+
meta: 'Already in this playlist',
|
|
109
|
+
recencyKey: 2,
|
|
110
|
+
disabled: true,
|
|
111
|
+
disabledReason: 'This slide is already in "Lunch Specials".',
|
|
112
|
+
},
|
|
113
|
+
{ id: 'p3', label: 'Evening Wind-down', meta: '7 slides', recencyKey: 1 },
|
|
114
|
+
], onSelect: () => undefined, children: _jsx(Picker.Target, { children: _jsx(Button, { children: "Add to playlist" }) }) })),
|
|
115
|
+
};
|
|
116
|
+
export const Controlled = {
|
|
117
|
+
parameters: {
|
|
118
|
+
docs: {
|
|
119
|
+
description: {
|
|
120
|
+
story: 'Controlled-open mode for triggering programmatically — e.g. when ' +
|
|
121
|
+
'the trigger lives in another popover that needs to close first.',
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
render: () => {
|
|
126
|
+
const [open, setOpen] = useState(false);
|
|
127
|
+
return (_jsxs(Group, { gap: spacing.sm, align: 'center', children: [_jsx(Button, { onClick: () => setOpen(true), children: "Open Picker" }), _jsx(Picker, { items: fewPlaylists, onSelect: () => setOpen(false), opened: open, onOpenChange: setOpen, children: _jsx(Picker.Target, { children: _jsx("span", { style: { display: 'inline-block', width: 1, height: 1 } }) }) })] }));
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
export const AnchoredToIconButton = {
|
|
131
|
+
parameters: {
|
|
132
|
+
docs: {
|
|
133
|
+
description: {
|
|
134
|
+
story: 'Mounting on an IconButton trigger — common in card kebabs.',
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
render: () => (_jsx(Picker, { items: fewPlaylists, onSelect: () => undefined, position: 'bottom-end', children: _jsx(Picker.Target, { children: _jsx(IconButton, { "aria-label": 'Add to playlist', variant: 'secondary', subtle: true, children: _jsx(IconPlus, { size: 16 }) }) }) })),
|
|
139
|
+
};
|
|
140
|
+
export const OnDarkSurface = {
|
|
141
|
+
parameters: {
|
|
142
|
+
docs: {
|
|
143
|
+
description: {
|
|
144
|
+
story: 'Picker dropdown stays light/neutral against a dark anchor surface ' +
|
|
145
|
+
'(e.g. when triggered from a dark selection toolbar).',
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
render: () => (_jsx("div", { style: {
|
|
150
|
+
background: '#1a1a22',
|
|
151
|
+
borderRadius: 12,
|
|
152
|
+
padding: spacing.md,
|
|
153
|
+
}, children: _jsx(Picker, { items: manyPlaylists, recentCount: 3, onSelect: () => undefined, position: 'top-end', footer: _jsx(Button, { variant: 'text', size: 'sm', leftIcon: _jsx(IconPlus, { size: 14 }), fullWidth: true, children: "Create new playlist" }), children: _jsx(Picker.Target, { children: _jsx(Button, { variant: 'ghost', size: 'sm', children: "Add to playlist" }) }) }) })),
|
|
154
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
export type SelectableObjectHandle = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
3
|
+
export interface SelectableObjectProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
/** Render the selection chrome (border + handles). Default `true`. */
|
|
6
|
+
selected?: boolean;
|
|
7
|
+
/** Render the 4 corner handles when selected. Default `true`. */
|
|
8
|
+
showHandles?: boolean;
|
|
9
|
+
/** Animated marching-ants border when selected. Default `true`. */
|
|
10
|
+
animated?: boolean;
|
|
11
|
+
/** Border color. Default `primary[200]`. */
|
|
12
|
+
color?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Cursor used on the wrapper. Default `'move'` when selected, otherwise
|
|
15
|
+
* `'pointer'`.
|
|
16
|
+
*/
|
|
17
|
+
cursor?: React.CSSProperties['cursor'];
|
|
18
|
+
/**
|
|
19
|
+
* Fires for a click anywhere inside the object. Consumers use this to
|
|
20
|
+
* promote the object to the selected state.
|
|
21
|
+
*/
|
|
22
|
+
onSelect?: (event: React.MouseEvent) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Fires when a corner handle is pressed. Consumers implement the actual
|
|
25
|
+
* resize math on top of this.
|
|
26
|
+
*/
|
|
27
|
+
onHandlePointerDown?: (handle: SelectableObjectHandle, event: React.PointerEvent) => void;
|
|
28
|
+
style?: React.CSSProperties;
|
|
29
|
+
className?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Chrome wrapper that renders an animated dashed selection border and four
|
|
33
|
+
* corner resize handles around arbitrary content. Purely presentational —
|
|
34
|
+
* drag + resize math lives in the consumer. SVG rather than CSS `dashed`
|
|
35
|
+
* borders because dash offsets are not animatable on standard borders.
|
|
36
|
+
*/
|
|
37
|
+
export declare const SelectableObject: ({ children, selected, showHandles, animated, color, cursor, onSelect, onHandlePointerDown, style, className, }: SelectableObjectProps) => React.JSX.Element;
|
|
38
|
+
//# sourceMappingURL=SelectableObject.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectableObject.d.ts","sourceRoot":"","sources":["../../../../src/components/Misc/SelectableObject/SelectableObject.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,MAAM,MAAM,sBAAsB,GAC9B,UAAU,GACV,WAAW,GACX,aAAa,GACb,cAAc,CAAC;AAEnB,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,sEAAsE;IACtE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iEAAiE;IACjE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,4CAA4C;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IACvC;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IAC7C;;;OAGG;IACH,mBAAmB,CAAC,EAAE,CACpB,MAAM,EAAE,sBAAsB,EAC9B,KAAK,EAAE,KAAK,CAAC,YAAY,KACtB,IAAI,CAAC;IACV,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAiBD;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAAI,gHAW9B,qBAAqB,sBAiGvB,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { primary, white } from '../../../constants/colors';
|
|
3
|
+
const HANDLE_SIZE = 10;
|
|
4
|
+
const HANDLE_HALF = HANDLE_SIZE / 2;
|
|
5
|
+
const HANDLE_POSITIONS = {
|
|
6
|
+
'bottom-left': { cursor: 'nesw-resize', left: '0%', top: '100%' },
|
|
7
|
+
'bottom-right': { cursor: 'nwse-resize', left: '100%', top: '100%' },
|
|
8
|
+
'top-left': { cursor: 'nwse-resize', left: '0%', top: '0%' },
|
|
9
|
+
'top-right': { cursor: 'nesw-resize', left: '100%', top: '0%' },
|
|
10
|
+
};
|
|
11
|
+
const ANIMATION_NAME = 'taiv-ui-marching-ants';
|
|
12
|
+
/**
|
|
13
|
+
* Chrome wrapper that renders an animated dashed selection border and four
|
|
14
|
+
* corner resize handles around arbitrary content. Purely presentational —
|
|
15
|
+
* drag + resize math lives in the consumer. SVG rather than CSS `dashed`
|
|
16
|
+
* borders because dash offsets are not animatable on standard borders.
|
|
17
|
+
*/
|
|
18
|
+
export const SelectableObject = ({ children, selected = true, showHandles = true, animated = true, color = primary[200], cursor, onSelect, onHandlePointerDown, style, className, }) => {
|
|
19
|
+
const resolvedCursor = cursor !== null && cursor !== void 0 ? cursor : (selected ? 'move' : 'pointer');
|
|
20
|
+
const interactive = Boolean(onSelect);
|
|
21
|
+
return (_jsxs("div", { className: className, ...(interactive
|
|
22
|
+
? {
|
|
23
|
+
onClick: onSelect,
|
|
24
|
+
onKeyDown: (e) => {
|
|
25
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
26
|
+
e.preventDefault();
|
|
27
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect(e);
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
role: 'button',
|
|
31
|
+
tabIndex: 0,
|
|
32
|
+
}
|
|
33
|
+
: {}), style: {
|
|
34
|
+
cursor: resolvedCursor,
|
|
35
|
+
display: 'inline-block',
|
|
36
|
+
position: 'relative',
|
|
37
|
+
...style,
|
|
38
|
+
}, children: [children, selected ? (_jsxs(_Fragment, { children: [_jsx("style", { children: `@keyframes ${ANIMATION_NAME} { to { stroke-dashoffset: -16; } }` }), _jsxs("svg", { role: 'presentation', style: {
|
|
39
|
+
height: '100%',
|
|
40
|
+
left: 0,
|
|
41
|
+
overflow: 'visible',
|
|
42
|
+
pointerEvents: 'none',
|
|
43
|
+
position: 'absolute',
|
|
44
|
+
top: 0,
|
|
45
|
+
width: '100%',
|
|
46
|
+
}, children: [_jsx("title", { children: "Selection border" }), _jsx("rect", { fill: 'none', height: '100%', stroke: color, strokeDasharray: '6 4', strokeWidth: 2, style: animated
|
|
47
|
+
? { animation: `${ANIMATION_NAME} 1s linear infinite` }
|
|
48
|
+
: undefined, width: '100%', x: 0, y: 0 })] }), showHandles
|
|
49
|
+
? Object.keys(HANDLE_POSITIONS).map((handle) => {
|
|
50
|
+
const pos = HANDLE_POSITIONS[handle];
|
|
51
|
+
return (_jsx("button", { "aria-label": `Resize ${handle}`, onPointerDown: (e) => {
|
|
52
|
+
e.stopPropagation();
|
|
53
|
+
onHandlePointerDown === null || onHandlePointerDown === void 0 ? void 0 : onHandlePointerDown(handle, e);
|
|
54
|
+
}, style: {
|
|
55
|
+
backgroundColor: white,
|
|
56
|
+
border: `2px solid ${color}`,
|
|
57
|
+
borderRadius: 2,
|
|
58
|
+
cursor: pos.cursor,
|
|
59
|
+
height: HANDLE_SIZE,
|
|
60
|
+
left: pos.left,
|
|
61
|
+
marginLeft: -HANDLE_HALF,
|
|
62
|
+
marginTop: -HANDLE_HALF,
|
|
63
|
+
padding: 0,
|
|
64
|
+
position: 'absolute',
|
|
65
|
+
top: pos.top,
|
|
66
|
+
width: HANDLE_SIZE,
|
|
67
|
+
}, type: 'button' }, handle));
|
|
68
|
+
})
|
|
69
|
+
: null] })) : null] }));
|
|
70
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { SelectableObject } from './SelectableObject';
|
|
3
|
+
declare const meta: Meta<typeof SelectableObject>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const TextObject: Story;
|
|
7
|
+
export declare const ImageObject: Story;
|
|
8
|
+
export declare const ToggleSelection: Story;
|
|
9
|
+
export declare const NoHandles: Story;
|
|
10
|
+
export declare const StaticBorder: Story;
|
|
11
|
+
//# sourceMappingURL=SelectableObject.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectableObject.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/Misc/SelectableObject/SelectableObject.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAO5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,gBAAgB,CAYvC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAYnC,eAAO,MAAM,UAAU,EAAE,KAoBxB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAyBzB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KA+B7B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAiBvB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAiB1B,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { neutral, primary, white } from '../../../constants/colors';
|
|
4
|
+
import { spacing } from '../../../constants/spacing';
|
|
5
|
+
import { Group } from '../../Layout/Group/Group';
|
|
6
|
+
import { Stack } from '../../Layout/Stack/Stack';
|
|
7
|
+
import { Text } from '../../Typography/Text/Text';
|
|
8
|
+
import { SelectableObject } from './SelectableObject';
|
|
9
|
+
const meta = {
|
|
10
|
+
component: SelectableObject,
|
|
11
|
+
parameters: {
|
|
12
|
+
docs: {
|
|
13
|
+
description: {
|
|
14
|
+
component: 'Selection chrome for canvas-like editors — animated marching-ants border + 4 corner resize handles wrapped around arbitrary children. Drag / resize math stays in the consumer; this component only renders the chrome.',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
layout: 'centered',
|
|
18
|
+
},
|
|
19
|
+
title: 'Components/Misc/SelectableObject',
|
|
20
|
+
};
|
|
21
|
+
export default meta;
|
|
22
|
+
const CANVAS = {
|
|
23
|
+
background: neutral[25],
|
|
24
|
+
border: `1px solid ${neutral[50]}`,
|
|
25
|
+
borderRadius: 8,
|
|
26
|
+
height: 260,
|
|
27
|
+
padding: spacing.xl,
|
|
28
|
+
position: 'relative',
|
|
29
|
+
width: 420,
|
|
30
|
+
};
|
|
31
|
+
export const TextObject = {
|
|
32
|
+
render: () => (_jsx("div", { style: CANVAS, children: _jsx(SelectableObject, { children: _jsx("div", { style: {
|
|
33
|
+
background: white,
|
|
34
|
+
border: `1px solid ${neutral[50]}`,
|
|
35
|
+
borderRadius: 6,
|
|
36
|
+
color: neutral[300],
|
|
37
|
+
fontSize: 28,
|
|
38
|
+
fontWeight: 600,
|
|
39
|
+
padding: `${spacing.sm} ${spacing.md}`,
|
|
40
|
+
}, children: "Heading text" }) }) })),
|
|
41
|
+
};
|
|
42
|
+
export const ImageObject = {
|
|
43
|
+
render: () => (_jsx("div", { style: CANVAS, children: _jsx(SelectableObject, { children: _jsx("div", { style: {
|
|
44
|
+
background: `linear-gradient(135deg, ${primary[100]}, ${primary[200]})`,
|
|
45
|
+
borderRadius: 6,
|
|
46
|
+
color: white,
|
|
47
|
+
display: 'flex',
|
|
48
|
+
fontSize: 12,
|
|
49
|
+
fontWeight: 500,
|
|
50
|
+
height: 140,
|
|
51
|
+
letterSpacing: 0.5,
|
|
52
|
+
placeContent: 'center',
|
|
53
|
+
placeItems: 'center',
|
|
54
|
+
textTransform: 'uppercase',
|
|
55
|
+
width: 200,
|
|
56
|
+
}, children: "Image" }) }) })),
|
|
57
|
+
};
|
|
58
|
+
export const ToggleSelection = {
|
|
59
|
+
render: () => {
|
|
60
|
+
const [selected, setSelected] = useState('one');
|
|
61
|
+
return (_jsxs(Stack, { spacing: spacing.sm, children: [_jsx(Text, { variant: 'subtle', children: "Click an object to select it." }), _jsx("div", { style: { ...CANVAS, width: 520 }, children: _jsx(Group, { spacing: spacing.xl, children: ['one', 'two'].map((id) => (_jsx(SelectableObject, { onSelect: () => setSelected(id), selected: selected === id, children: _jsxs("div", { style: {
|
|
62
|
+
background: white,
|
|
63
|
+
border: `1px solid ${neutral[50]}`,
|
|
64
|
+
borderRadius: 6,
|
|
65
|
+
padding: `${spacing.md} ${spacing.lg}`,
|
|
66
|
+
}, children: ["Object ", id] }) }, id))) }) })] }));
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
export const NoHandles = {
|
|
70
|
+
render: () => (_jsx("div", { style: CANVAS, children: _jsx(SelectableObject, { showHandles: false, children: _jsx("div", { style: {
|
|
71
|
+
background: white,
|
|
72
|
+
border: `1px solid ${neutral[50]}`,
|
|
73
|
+
borderRadius: 6,
|
|
74
|
+
padding: `${spacing.md} ${spacing.lg}`,
|
|
75
|
+
}, children: "Lightweight hover / focus chrome" }) }) })),
|
|
76
|
+
};
|
|
77
|
+
export const StaticBorder = {
|
|
78
|
+
render: () => (_jsx("div", { style: CANVAS, children: _jsx(SelectableObject, { animated: false, children: _jsx("div", { style: {
|
|
79
|
+
background: white,
|
|
80
|
+
border: `1px solid ${neutral[50]}`,
|
|
81
|
+
borderRadius: 6,
|
|
82
|
+
padding: `${spacing.md} ${spacing.lg}`,
|
|
83
|
+
}, children: "Dashed border, no animation" }) }) })),
|
|
84
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
export interface SelectionToolbarProps {
|
|
3
|
+
/** Whether the toolbar is visible. Drives the transition. */
|
|
4
|
+
opened: boolean;
|
|
5
|
+
/** Number of currently-selected items. Rendered as `{count} selected`. */
|
|
6
|
+
count: number;
|
|
7
|
+
/** Right-aligned action buttons — typically `<Button />`s. */
|
|
8
|
+
actions: React.ReactNode;
|
|
9
|
+
/** Optional slot between count and actions (e.g. a `<Select />`). */
|
|
10
|
+
dropdownSlot?: React.ReactNode;
|
|
11
|
+
/** Fired when the dismiss (×) button is clicked. */
|
|
12
|
+
onDismiss: () => void;
|
|
13
|
+
/** Override the default `{count} selected` label. */
|
|
14
|
+
label?: (count: number) => React.ReactNode;
|
|
15
|
+
/** Fine-tune the bottom offset. Default `16px`. */
|
|
16
|
+
bottomOffset?: number;
|
|
17
|
+
/** Max-width cap on large viewports. Default `768px`. */
|
|
18
|
+
maxWidth?: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Floating bottom action bar shown while items are selected across Library /
|
|
22
|
+
* Playlists / Slides. Pinned above content, below modals. Single row that
|
|
23
|
+
* never wraps.
|
|
24
|
+
*/
|
|
25
|
+
export declare const SelectionToolbar: ({ opened, count, actions, dropdownSlot, onDismiss, label, bottomOffset, maxWidth, }: SelectionToolbarProps) => React.JSX.Element;
|
|
26
|
+
//# sourceMappingURL=SelectionToolbar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectionToolbar.d.ts","sourceRoot":"","sources":["../../../../src/components/Misc/SelectionToolbar/SelectionToolbar.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B,MAAM,WAAW,qBAAqB;IACpC,6DAA6D;IAC7D,MAAM,EAAE,OAAO,CAAC;IAChB,0EAA0E;IAC1E,KAAK,EAAE,MAAM,CAAC;IACd,8DAA8D;IAC9D,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,qEAAqE;IACrE,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC/B,oDAAoD;IACpD,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,qDAAqD;IACrD,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC;IAC3C,mDAAmD;IACnD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,yDAAyD;IACzD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAAI,qFAS9B,qBAAqB,sBAmEvB,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { IconX } from '@tabler/icons-react';
|
|
3
|
+
import { neutral, white } from '../../../constants/colors';
|
|
4
|
+
import { fontBase, fontSize } from '../../../constants/font';
|
|
5
|
+
import { spacing } from '../../../constants/spacing';
|
|
6
|
+
import { IconButton } from '../../Inputs/Buttons/IconButton/IconButton';
|
|
7
|
+
import { Group } from '../../Layout/Group/Group';
|
|
8
|
+
import { Transition } from '../Transition/Transition';
|
|
9
|
+
/**
|
|
10
|
+
* Floating bottom action bar shown while items are selected across Library /
|
|
11
|
+
* Playlists / Slides. Pinned above content, below modals. Single row that
|
|
12
|
+
* never wraps.
|
|
13
|
+
*/
|
|
14
|
+
export const SelectionToolbar = ({ opened, count, actions, dropdownSlot, onDismiss, label = (n) => `${n} selected`, bottomOffset = 16, maxWidth = 768, }) => {
|
|
15
|
+
return (_jsx(Transition, { duration: 200, mounted: opened, timingFunction: 'ease-out', transition: 'slide-up', children: (transitionStyles) => (_jsx("div", { style: {
|
|
16
|
+
bottom: bottomOffset,
|
|
17
|
+
left: '50%',
|
|
18
|
+
maxWidth: `min(${maxWidth}px, calc(100% - 2rem))`,
|
|
19
|
+
position: 'fixed',
|
|
20
|
+
transform: 'translateX(-50%)',
|
|
21
|
+
width: 'max-content',
|
|
22
|
+
zIndex: 30,
|
|
23
|
+
...transitionStyles,
|
|
24
|
+
}, children: _jsxs(Group, { noWrap: true, position: 'apart', spacing: spacing.md, style: {
|
|
25
|
+
backgroundColor: white,
|
|
26
|
+
border: `1px solid ${neutral[50]}`,
|
|
27
|
+
borderRadius: '12px',
|
|
28
|
+
boxShadow: '0 8px 24px rgba(0, 0, 0, 0.12)',
|
|
29
|
+
flexWrap: 'nowrap',
|
|
30
|
+
maxWidth: '100%',
|
|
31
|
+
padding: `${spacing.xs} ${spacing.sm}`,
|
|
32
|
+
whiteSpace: 'nowrap',
|
|
33
|
+
width: '100%',
|
|
34
|
+
}, children: [_jsxs(Group, { noWrap: true, spacing: spacing.sm, style: { flexShrink: 0 }, children: [_jsx(IconButton, { onClick: onDismiss, size: 'sm', styles: { root: { height: 28, width: 28 } }, variant: 'secondary', children: _jsx(IconX, {}) }), _jsx("span", { style: {
|
|
35
|
+
...fontBase,
|
|
36
|
+
...fontSize.sm,
|
|
37
|
+
color: neutral[300],
|
|
38
|
+
flexShrink: 0,
|
|
39
|
+
fontWeight: 600,
|
|
40
|
+
}, children: label(count) })] }), _jsxs(Group, { noWrap: true, spacing: spacing.xs, style: { flexShrink: 0 }, children: [dropdownSlot, actions] })] }) })) }));
|
|
41
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { SelectionToolbar } from './SelectionToolbar';
|
|
3
|
+
declare const meta: Meta<typeof SelectionToolbar>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const OneSelected: Story;
|
|
7
|
+
export declare const ThreeSelected: Story;
|
|
8
|
+
export declare const TwelveWithDropdown: Story;
|
|
9
|
+
export declare const Playground: Story;
|
|
10
|
+
//# sourceMappingURL=SelectionToolbar.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectionToolbar.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/Misc/SelectionToolbar/SelectionToolbar.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAM5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,gBAAgB,CAYvC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,WAAW,EAAE,KAYzB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KAmB3B,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,KAwBhC,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,KAsBxB,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Button } from '../../Inputs/Buttons/Button/Button';
|
|
4
|
+
import { Select } from '../../Inputs/Dropdowns/Select/Select';
|
|
5
|
+
import { Stack } from '../../Layout/Stack/Stack';
|
|
6
|
+
import { Text } from '../../Typography/Text/Text';
|
|
7
|
+
import { SelectionToolbar } from './SelectionToolbar';
|
|
8
|
+
const meta = {
|
|
9
|
+
component: SelectionToolbar,
|
|
10
|
+
parameters: {
|
|
11
|
+
docs: {
|
|
12
|
+
description: {
|
|
13
|
+
component: 'Floating bottom toolbar that surfaces while items are selected. Pinned above page content and below modals (`z-index: 30`). Never wraps — all children should be shrink-0.',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
layout: 'fullscreen',
|
|
17
|
+
},
|
|
18
|
+
title: 'Components/Misc/SelectionToolbar',
|
|
19
|
+
};
|
|
20
|
+
export default meta;
|
|
21
|
+
export const OneSelected = {
|
|
22
|
+
render: () => {
|
|
23
|
+
const [opened, setOpened] = useState(true);
|
|
24
|
+
return (_jsx(SelectionToolbar, { actions: _jsx(Button, { size: 'sm', children: "Append to playlist" }), count: 1, onDismiss: () => setOpened(false), opened: opened }));
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
export const ThreeSelected = {
|
|
28
|
+
render: () => {
|
|
29
|
+
const [opened, setOpened] = useState(true);
|
|
30
|
+
return (_jsx(SelectionToolbar, { actions: _jsxs(_Fragment, { children: [_jsx(Button, { size: 'sm', variant: 'cancel', children: "Delete" }), _jsx(Button, { size: 'sm', children: "Append to playlist" })] }), count: 3, onDismiss: () => setOpened(false), opened: opened }));
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
export const TwelveWithDropdown = {
|
|
34
|
+
render: () => {
|
|
35
|
+
const [opened, setOpened] = useState(true);
|
|
36
|
+
const [target, setTarget] = useState('main');
|
|
37
|
+
return (_jsx(SelectionToolbar, { actions: _jsx(Button, { size: 'sm', children: "Append" }), count: 12, dropdownSlot: _jsx(Select, { data: [
|
|
38
|
+
{ label: 'Main playlist', value: 'main' },
|
|
39
|
+
{ label: 'Holiday playlist', value: 'holiday' },
|
|
40
|
+
], onChange: setTarget, size: 'sm', value: target }), onDismiss: () => setOpened(false), opened: opened }));
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
export const Playground = {
|
|
44
|
+
render: () => {
|
|
45
|
+
const [opened, setOpened] = useState(true);
|
|
46
|
+
return (_jsxs(Stack, { children: [_jsx(Text, { children: "Scroll content \u2014 toolbar stays pinned to the viewport bottom." }), Array.from({ length: 40 }, (_, i) => `row-${i + 1}`).map((key, i) => (_jsxs(Text, { variant: 'subtle', children: ["Row ", i + 1] }, key))), _jsx(SelectionToolbar, { actions: _jsx(Button, { size: 'sm', children: "Append to playlist" }), count: 4, onDismiss: () => setOpened(false), opened: opened })] }));
|
|
47
|
+
},
|
|
48
|
+
};
|