@taiv/ui 1.14.1 → 2.0.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 +54 -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/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/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.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 +2 -2
- 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.map +1 -1
- package/dist/components/Info/Modals/Modal/Modal.js +9 -1
- package/dist/components/Info/Modals/StepperModal/StepperModal.d.ts +21 -0
- package/dist/components/Info/Modals/StepperModal/StepperModal.d.ts.map +1 -0
- package/dist/components/Info/Modals/StepperModal/StepperModal.js +50 -0
- package/dist/components/Info/Modals/StepperModal/StepperModal.stories.d.ts +10 -0
- package/dist/components/Info/Modals/StepperModal/StepperModal.stories.d.ts.map +1 -0
- package/dist/components/Info/Modals/StepperModal/StepperModal.stories.js +169 -0
- 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/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 +25 -19
- 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/InfoTooltip/InfoTooltip.d.ts +1 -1
- 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/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 +40 -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/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/SegmentedControl/SegmentedControl.d.ts +11 -8
- 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.map +1 -1
- package/dist/components/Inputs/Dates/DatePicker/DatePicker.js +23 -7
- package/dist/components/Inputs/Dates/DateTimePicker/DateTimePicker.d.ts +12 -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 +19 -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/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 +2 -2
- 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.map +1 -1
- package/dist/components/Inputs/Dropdowns/Select/Select.js +5 -3
- package/dist/components/Inputs/Dropzone/Dropzone.d.ts +23 -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/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/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/Card/Card.d.ts +1 -1
- package/dist/components/Layout/Card/Card.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.map +1 -1
- package/dist/components/Layout/Divider/Divider.js +4 -2
- package/dist/components/Layout/Group/Group.d.ts +1 -1
- package/dist/components/Layout/Group/Group.d.ts.map +1 -1
- package/dist/components/Layout/Loader/Loader.d.ts +1 -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 +23 -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/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.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 +6 -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/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/Stepper/Step.stories.d.ts +118 -118
- 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/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/index.d.ts +149 -66
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +110 -67
- 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/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 +26 -2
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { IconCloudUpload, IconPhoto, IconUpload, IconX } from '@tabler/icons-react';
|
|
4
|
+
import { Dropzone, IMAGE_MIME_TYPE, PDF_MIME_TYPE } from './Dropzone';
|
|
5
|
+
import { Group } from '../../Layout/Group/Group';
|
|
6
|
+
import { Stack } from '../../Layout/Stack/Stack';
|
|
7
|
+
import { Text } from '../../Typography/Text/Text';
|
|
8
|
+
import { Title } from '../../Typography/Title/Title';
|
|
9
|
+
import { error, neutral, primary } from '../../../constants/colors';
|
|
10
|
+
import { spacing } from '../../../constants/spacing';
|
|
11
|
+
const meta = {
|
|
12
|
+
title: 'Components/Inputs/Dropzone',
|
|
13
|
+
component: Dropzone,
|
|
14
|
+
parameters: {
|
|
15
|
+
layout: 'centered',
|
|
16
|
+
docs: {
|
|
17
|
+
description: {
|
|
18
|
+
component: '[View Mantine Docs](https://v6.mantine.dev/others/dropzone/)\n\nDropzone captures files via click or drag-and-drop. It extends Mantine v6\'s `Dropzone` with Taiv styling: Poppins font, dashed neutral border, `primary[25]` fill on accept, `error[25]` fill on reject.\n\nUse `Dropzone.Accept`, `Dropzone.Reject`, and `Dropzone.Idle` inside children to show different content per state.',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
decorators: [
|
|
23
|
+
(Story) => (_jsx("div", { style: { width: '520px' }, children: _jsx(Story, {}) })),
|
|
24
|
+
],
|
|
25
|
+
argTypes: {
|
|
26
|
+
onDrop: {
|
|
27
|
+
action: 'files dropped',
|
|
28
|
+
description: 'Called with valid files',
|
|
29
|
+
table: { type: { summary: '(files: FileWithPath[]) => void' } },
|
|
30
|
+
},
|
|
31
|
+
onReject: {
|
|
32
|
+
action: 'files rejected',
|
|
33
|
+
description: 'Called with rejected files (wrong type, too large, etc.)',
|
|
34
|
+
table: { type: { summary: '(rejections: FileRejection[]) => void' } },
|
|
35
|
+
},
|
|
36
|
+
accept: {
|
|
37
|
+
control: false,
|
|
38
|
+
description: 'File MIME types to accept. Use the exported `IMAGE_MIME_TYPE`, `PDF_MIME_TYPE`, etc.',
|
|
39
|
+
table: { type: { summary: 'Accept | string[]' } },
|
|
40
|
+
},
|
|
41
|
+
maxSize: {
|
|
42
|
+
control: { type: 'number' },
|
|
43
|
+
description: 'Maximum file size in bytes',
|
|
44
|
+
table: { type: { summary: 'number' } },
|
|
45
|
+
},
|
|
46
|
+
maxFiles: {
|
|
47
|
+
control: { type: 'number' },
|
|
48
|
+
description: 'Max number of files',
|
|
49
|
+
table: { type: { summary: 'number' } },
|
|
50
|
+
},
|
|
51
|
+
multiple: {
|
|
52
|
+
control: { type: 'boolean' },
|
|
53
|
+
description: 'Allow selecting multiple files',
|
|
54
|
+
table: { type: { summary: 'boolean' }, defaultValue: { summary: 'true' } },
|
|
55
|
+
},
|
|
56
|
+
loading: {
|
|
57
|
+
control: { type: 'boolean' },
|
|
58
|
+
description: 'Display a loading overlay',
|
|
59
|
+
table: { type: { summary: 'boolean' }, defaultValue: { summary: 'false' } },
|
|
60
|
+
},
|
|
61
|
+
disabled: {
|
|
62
|
+
control: { type: 'boolean' },
|
|
63
|
+
description: 'Disable the dropzone',
|
|
64
|
+
table: { type: { summary: 'boolean' }, defaultValue: { summary: 'false' } },
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
export default meta;
|
|
69
|
+
const StateContent = () => (_jsxs(Group, { position: 'center', spacing: spacing.xl, style: { minHeight: 120, pointerEvents: 'none' }, children: [_jsx(Dropzone.Accept, { children: _jsx(IconUpload, { size: 48, color: primary[200] }) }), _jsx(Dropzone.Reject, { children: _jsx(IconX, { size: 48, color: error[200] }) }), _jsx(Dropzone.Idle, { children: _jsx(IconCloudUpload, { size: 48, color: neutral[200] }) }), _jsxs(Stack, { spacing: spacing.xxs, children: [_jsx(Title, { variant: 'cardHeader', children: "Drop files here or click to browse" }), _jsx(Text, { variant: 'subtle', children: "Attach as many files as you like, each up to 5 MB" })] })] }));
|
|
70
|
+
// ─── Default ─────────────────────────────────────────────────────────────────
|
|
71
|
+
export const Default = {
|
|
72
|
+
args: {
|
|
73
|
+
maxSize: 5 * 1024 ** 2,
|
|
74
|
+
onDrop: (files) => console.log('dropped', files),
|
|
75
|
+
onReject: (rejections) => console.log('rejected', rejections),
|
|
76
|
+
},
|
|
77
|
+
render: (args) => (_jsx(Dropzone, { ...args, children: _jsx(StateContent, {}) })),
|
|
78
|
+
};
|
|
79
|
+
// ─── Image uploads only ──────────────────────────────────────────────────────
|
|
80
|
+
export const ImagesOnly = {
|
|
81
|
+
render: () => (_jsx(Dropzone, { accept: IMAGE_MIME_TYPE, maxSize: 5 * 1024 ** 2, onDrop: () => { }, children: _jsxs(Group, { position: 'center', spacing: spacing.xl, style: { minHeight: 120, pointerEvents: 'none' }, children: [_jsx(Dropzone.Accept, { children: _jsx(IconUpload, { size: 48, color: primary[200] }) }), _jsx(Dropzone.Reject, { children: _jsx(IconX, { size: 48, color: error[200] }) }), _jsx(Dropzone.Idle, { children: _jsx(IconPhoto, { size: 48, color: neutral[200] }) }), _jsxs(Stack, { spacing: spacing.xxs, children: [_jsx(Title, { variant: 'cardHeader', children: "Upload images" }), _jsx(Text, { variant: 'subtle', children: "PNG, JPG, GIF, WEBP \u2014 up to 5 MB each" })] })] }) })),
|
|
82
|
+
parameters: {
|
|
83
|
+
docs: {
|
|
84
|
+
description: { story: 'Restrict accepted files with `accept={IMAGE_MIME_TYPE}`. MIME-type presets are re-exported from `@taiv/ui`.' },
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
// ─── PDFs only ───────────────────────────────────────────────────────────────
|
|
89
|
+
export const PdfsOnly = {
|
|
90
|
+
render: () => (_jsx(Dropzone, { accept: PDF_MIME_TYPE, maxFiles: 1, onDrop: () => { }, children: _jsx(StateContent, {}) })),
|
|
91
|
+
};
|
|
92
|
+
// ─── Loading state ───────────────────────────────────────────────────────────
|
|
93
|
+
export const Loading = {
|
|
94
|
+
args: { loading: true, onDrop: () => { } },
|
|
95
|
+
render: (args) => (_jsx(Dropzone, { ...args, children: _jsx(StateContent, {}) })),
|
|
96
|
+
};
|
|
97
|
+
// ─── Disabled state ──────────────────────────────────────────────────────────
|
|
98
|
+
export const Disabled = {
|
|
99
|
+
args: { disabled: true, onDrop: () => { } },
|
|
100
|
+
render: (args) => (_jsx(Dropzone, { ...args, children: _jsx(StateContent, {}) })),
|
|
101
|
+
};
|
|
102
|
+
// ─── With captured file list ─────────────────────────────────────────────────
|
|
103
|
+
export const WithFileList = {
|
|
104
|
+
render: () => {
|
|
105
|
+
const [files, setFiles] = useState([]);
|
|
106
|
+
return (_jsxs(Stack, { spacing: spacing.md, children: [_jsx(Dropzone, { onDrop: setFiles, maxSize: 5 * 1024 ** 2, children: _jsx(StateContent, {}) }), files.length > 0 && (_jsxs(Stack, { spacing: spacing.xxs, children: [_jsxs(Text, { variant: 'label', children: [files.length, " file(s) selected"] }), files.map((f, i) => (_jsxs(Text, { variant: 'subtle', children: [f.name, " \u2014 ", (f.size / 1024).toFixed(1), " KB"] }, i)))] }))] }));
|
|
107
|
+
},
|
|
108
|
+
parameters: {
|
|
109
|
+
docs: {
|
|
110
|
+
description: { story: 'Typical usage pattern — hold dropped files in local state and render them below.' },
|
|
111
|
+
source: { code: false },
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumberInput.d.ts","sourceRoot":"","sources":["../../../../../src/components/Inputs/TextInputs/NumberInput/NumberInput.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,gBAAgB,IAAI,uBAAuB,EAC5C,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,UAAU,gBAAiB,SAAQ,uBAAuB;IACxD,IAAI,CAAC,EAAE,MAAM,OAAO,cAAc,CAAC;IACnC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CACpC;AAED,QAAA,MAAM,WAAW,GAAI,oDAOlB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"NumberInput.d.ts","sourceRoot":"","sources":["../../../../../src/components/Inputs/TextInputs/NumberInput/NumberInput.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,gBAAgB,IAAI,uBAAuB,EAC5C,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,UAAU,gBAAiB,SAAQ,uBAAuB;IACxD,IAAI,CAAC,EAAE,MAAM,OAAO,cAAc,CAAC;IACnC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CACpC;AAED,QAAA,MAAM,WAAW,GAAI,oDAOlB,gBAAgB,4CAsElB,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -8,6 +8,9 @@ const NumberInput = ({ size = 'md', width, fullWidth = false, styles, step = 1,
|
|
|
8
8
|
const computedWidth = fullWidth ? '100%' : width || `${selectedSize.width}px`;
|
|
9
9
|
const hasError = !!props.error;
|
|
10
10
|
const style = {
|
|
11
|
+
root: {
|
|
12
|
+
width: computedWidth,
|
|
13
|
+
},
|
|
11
14
|
input: {
|
|
12
15
|
height: `${selectedSize.height}px`,
|
|
13
16
|
fontSize: selectedSize.fontSize,
|
|
@@ -58,6 +61,6 @@ const NumberInput = ({ size = 'md', width, fullWidth = false, styles, step = 1,
|
|
|
58
61
|
},
|
|
59
62
|
...styles,
|
|
60
63
|
};
|
|
61
|
-
return (_jsx(MantineNumberInput, {
|
|
64
|
+
return (_jsx(MantineNumberInput, { size: size, step: step, hideControls: false, styles: style, type: "number", ...props }));
|
|
62
65
|
};
|
|
63
66
|
export { NumberInput };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { componentSizes } from '../shared/sizes';
|
|
2
|
+
export interface ResponsiveNumberInputProps {
|
|
3
|
+
value: number;
|
|
4
|
+
onChange: (value: number) => void;
|
|
5
|
+
min?: number;
|
|
6
|
+
max?: number;
|
|
7
|
+
step?: number;
|
|
8
|
+
/** Suffix rendered after the value in the mobile stepper (e.g. `s`, `px`).
|
|
9
|
+
* Desktop ignores this — the NumberInput shows the bare number. */
|
|
10
|
+
unit?: string;
|
|
11
|
+
/** Forwarded to the desktop `NumberInput` label. On mobile the stepper is
|
|
12
|
+
* control-only; render your own label in the surrounding layout. */
|
|
13
|
+
label?: string;
|
|
14
|
+
error?: string;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
fullWidth?: boolean;
|
|
17
|
+
size?: keyof typeof componentSizes;
|
|
18
|
+
/** Accessible name for the mobile value readout / stepper buttons. */
|
|
19
|
+
'aria-label'?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Override the internal `useMobile()` (<640px) viewport check. Pass this
|
|
22
|
+
* when the host surface uses a different breakpoint than the component's
|
|
23
|
+
* default — e.g. an editor that already switches to a touch layout at
|
|
24
|
+
* `useTablet()` (<768px) wants the stepper across that whole range, not
|
|
25
|
+
* just below 640px. Omit to let the component decide by viewport.
|
|
26
|
+
*/
|
|
27
|
+
isMobile?: boolean;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Numeric input that swaps presentation by viewport:
|
|
31
|
+
*
|
|
32
|
+
* - **Desktop / laptop** → the standard `NumberInput` (typed entry plus the
|
|
33
|
+
* stacked spinner controls on the right edge).
|
|
34
|
+
* - **Mobile** → a touch stepper: a read-only value pill on the left with
|
|
35
|
+
* `[−]` / `[+]` buttons grouped to its right. The value is *display-only*
|
|
36
|
+
* (not a native `<input type=number>`) on purpose — focusing one on iOS
|
|
37
|
+
* pops the on-screen numeric keyboard, which on canvas-style editors
|
|
38
|
+
* covers content and can steal focus. The buttons are full-size tap
|
|
39
|
+
* targets, unlike the desktop spinner chevrons.
|
|
40
|
+
*
|
|
41
|
+
* Same `value` / `onChange` / `min` / `max` / `step` contract on both, so a
|
|
42
|
+
* caller can drop it in wherever a `NumberInput` lived and get the
|
|
43
|
+
* responsive treatment for free.
|
|
44
|
+
*/
|
|
45
|
+
export declare const ResponsiveNumberInput: React.FC<ResponsiveNumberInputProps>;
|
|
46
|
+
//# sourceMappingURL=ResponsiveNumberInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResponsiveNumberInput.d.ts","sourceRoot":"","sources":["../../../../../src/components/Inputs/TextInputs/NumberInput/ResponsiveNumberInput.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,MAAM,WAAW,0BAA0B;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;wEACoE;IACpE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;yEACqE;IACrE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,OAAO,cAAc,CAAC;IACnC,sEAAsE;IACtE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAKD;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC,0BAA0B,CAgGtE,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { IconMinus, IconPlus } from '@tabler/icons-react';
|
|
3
|
+
import { neutral, red } from '../../../../constants/colors';
|
|
4
|
+
import { fontBase } from '../../../../constants/font';
|
|
5
|
+
import { spacing } from '../../../../constants/spacing';
|
|
6
|
+
import { useMobile } from '../../../../hooks/useMediaQuery';
|
|
7
|
+
import { IconButton } from '../../Buttons/IconButton/IconButton';
|
|
8
|
+
import { Group } from '../../../Layout/Group/Group';
|
|
9
|
+
import { Text } from '../../../Typography/Text/Text';
|
|
10
|
+
import { NumberInput } from './NumberInput';
|
|
11
|
+
const clamp = (n, min, max) => Math.min(Math.max(n, min), max);
|
|
12
|
+
/**
|
|
13
|
+
* Numeric input that swaps presentation by viewport:
|
|
14
|
+
*
|
|
15
|
+
* - **Desktop / laptop** → the standard `NumberInput` (typed entry plus the
|
|
16
|
+
* stacked spinner controls on the right edge).
|
|
17
|
+
* - **Mobile** → a touch stepper: a read-only value pill on the left with
|
|
18
|
+
* `[−]` / `[+]` buttons grouped to its right. The value is *display-only*
|
|
19
|
+
* (not a native `<input type=number>`) on purpose — focusing one on iOS
|
|
20
|
+
* pops the on-screen numeric keyboard, which on canvas-style editors
|
|
21
|
+
* covers content and can steal focus. The buttons are full-size tap
|
|
22
|
+
* targets, unlike the desktop spinner chevrons.
|
|
23
|
+
*
|
|
24
|
+
* Same `value` / `onChange` / `min` / `max` / `step` contract on both, so a
|
|
25
|
+
* caller can drop it in wherever a `NumberInput` lived and get the
|
|
26
|
+
* responsive treatment for free.
|
|
27
|
+
*/
|
|
28
|
+
export const ResponsiveNumberInput = ({ value, onChange, min = 0, max = 100, step = 1, unit, label, error, disabled = false, fullWidth = false, size = 'md', 'aria-label': ariaLabel, isMobile: isMobileProp, }) => {
|
|
29
|
+
// Always call the hook (rules-of-hooks), but let an explicit prop win so
|
|
30
|
+
// callers can align the switch with their own breakpoint.
|
|
31
|
+
const detectedMobile = useMobile();
|
|
32
|
+
const isMobile = isMobileProp !== null && isMobileProp !== void 0 ? isMobileProp : detectedMobile;
|
|
33
|
+
if (!isMobile) {
|
|
34
|
+
return (_jsx(NumberInput, { label: label, error: error, min: min, max: max, step: step, value: value, disabled: disabled, fullWidth: fullWidth, size: size, "aria-label": ariaLabel, onChange: (v) => {
|
|
35
|
+
const n = Number(v);
|
|
36
|
+
if (!Number.isFinite(n))
|
|
37
|
+
return;
|
|
38
|
+
onChange(n);
|
|
39
|
+
} }));
|
|
40
|
+
}
|
|
41
|
+
const handleStep = (dir) => onChange(clamp(value + dir * step, min, max));
|
|
42
|
+
const display = `${value}${unit ? ` ${unit}` : ''}`;
|
|
43
|
+
// Flanking layout: `[−] value [+]`, matching the app's other steppers
|
|
44
|
+
// (font size, canvas zoom). When `fullWidth`, the group spans its row and
|
|
45
|
+
// the value pill flexes to fill the space between the buttons; otherwise
|
|
46
|
+
// it's a compact, content-width stepper.
|
|
47
|
+
return (_jsxs(Group, { spacing: spacing.xs, noWrap: true, style: fullWidth ? { width: '100%' } : undefined, children: [_jsx(IconButton, { variant: 'secondary', subtle: true, "aria-label": `Decrease${ariaLabel ? ` ${ariaLabel}` : ''}`, onClick: () => handleStep(-1), disabled: disabled || value <= min, children: _jsx(IconMinus, { size: 14 }) }), _jsx("div", { role: 'status', "aria-label": ariaLabel, style: {
|
|
48
|
+
alignItems: 'center',
|
|
49
|
+
border: `1px solid ${error ? red[200] : neutral[50]}`,
|
|
50
|
+
borderRadius: 8,
|
|
51
|
+
display: 'flex',
|
|
52
|
+
flex: fullWidth ? 1 : undefined,
|
|
53
|
+
height: 40,
|
|
54
|
+
justifyContent: 'center',
|
|
55
|
+
minWidth: 64,
|
|
56
|
+
padding: `0 ${spacing.sm}`,
|
|
57
|
+
...fontBase,
|
|
58
|
+
color: neutral[200],
|
|
59
|
+
}, children: _jsx(Text, { variant: 'body', children: display }) }), _jsx(IconButton, { variant: 'secondary', subtle: true, "aria-label": `Increase${ariaLabel ? ` ${ariaLabel}` : ''}`, onClick: () => handleStep(1), disabled: disabled || value >= max, children: _jsx(IconPlus, { size: 14 }) })] }));
|
|
60
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AccordionProps as MantineAccordionProps, CSSObject } from '@mantine/core';
|
|
3
|
+
export interface AccordionProps extends Omit<MantineAccordionProps, 'chevron' | 'styles' | 'multiple' | 'value' | 'defaultValue' | 'onChange'> {
|
|
4
|
+
chevron?: React.ReactNode;
|
|
5
|
+
styles?: Record<string, CSSObject>;
|
|
6
|
+
multiple?: boolean;
|
|
7
|
+
value?: string | string[] | null;
|
|
8
|
+
defaultValue?: string | string[];
|
|
9
|
+
onChange?: (value: string | string[] | null) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const Accordion: (({ chevron, styles, ...props }: AccordionProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
12
|
+
Item: React.ForwardRefExoticComponent<import("@mantine/core").AccordionItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
13
|
+
Control: React.ForwardRefExoticComponent<import("@mantine/core").AccordionControlProps & React.RefAttributes<HTMLButtonElement>>;
|
|
14
|
+
Panel: typeof import("@mantine/core/lib/Accordion/AccordionPanel/AccordionPanel").AccordionPanel;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=Accordion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Accordion.d.ts","sourceRoot":"","sources":["../../../../src/components/Layout/Accordion/Accordion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAEL,cAAc,IAAI,qBAAqB,EACvC,SAAS,EACV,MAAM,eAAe,CAAC;AAMvB,MAAM,WAAW,cACf,SAAQ,IAAI,CAAC,qBAAqB,EAAE,SAAS,GAAG,QAAQ,GAAG,UAAU,GAAG,OAAO,GAAG,cAAc,GAAG,UAAU,CAAC;IAC9G,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC;IACjC,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACjC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,KAAK,IAAI,CAAC;CACtD;AA+DD,eAAO,MAAM,SAAS,mCA7DqC,cAAc;;;;CAiEvE,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Accordion as MantineAccordion, } from '@mantine/core';
|
|
3
|
+
import { IconChevronRight } from '@tabler/icons-react';
|
|
4
|
+
import { colors } from '../../../constants/colors';
|
|
5
|
+
import { fontBase, fontSize } from '../../../constants/font';
|
|
6
|
+
import { spacing } from '../../../constants/spacing';
|
|
7
|
+
const AccordionComponent = ({ chevron, styles, ...props }) => {
|
|
8
|
+
const style = {
|
|
9
|
+
root: {
|
|
10
|
+
width: '100%',
|
|
11
|
+
},
|
|
12
|
+
item: {
|
|
13
|
+
border: 'none',
|
|
14
|
+
borderBottom: `1px solid ${colors.neutral[100]}`,
|
|
15
|
+
backgroundColor: 'transparent',
|
|
16
|
+
transition: 'background-color 150ms ease',
|
|
17
|
+
'&:first-of-type': {
|
|
18
|
+
borderTop: `1px solid ${colors.neutral[100]}`,
|
|
19
|
+
},
|
|
20
|
+
'&[data-active]': {
|
|
21
|
+
backgroundColor: 'transparent',
|
|
22
|
+
},
|
|
23
|
+
// Lift Control's hover/focus to the whole row so action buttons rendered
|
|
24
|
+
// as siblings of Accordion.Control feel part of one cohesive surface.
|
|
25
|
+
'&:has([data-accordion-control]:hover)': {
|
|
26
|
+
backgroundColor: colors.neutral[25],
|
|
27
|
+
},
|
|
28
|
+
'&:has([data-accordion-control]:focus-visible)': {
|
|
29
|
+
outline: `2px solid ${colors.primary[200]}`,
|
|
30
|
+
outlineOffset: '-2px',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
control: {
|
|
34
|
+
padding: `${spacing.md} ${spacing.lg}`,
|
|
35
|
+
backgroundColor: 'transparent',
|
|
36
|
+
'&:focus-visible': {
|
|
37
|
+
outline: 'none',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
chevron: {
|
|
41
|
+
color: colors.neutral[200],
|
|
42
|
+
transition: 'transform 200ms ease',
|
|
43
|
+
'&[data-rotate]': {
|
|
44
|
+
transform: 'rotate(90deg)',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
label: {
|
|
48
|
+
...fontBase,
|
|
49
|
+
...fontSize['md'],
|
|
50
|
+
color: colors.neutral[300],
|
|
51
|
+
},
|
|
52
|
+
panel: {
|
|
53
|
+
padding: `0 ${spacing.lg} ${spacing.md}`,
|
|
54
|
+
},
|
|
55
|
+
...styles,
|
|
56
|
+
};
|
|
57
|
+
return (_jsx(MantineAccordion, { chevron: chevron !== null && chevron !== void 0 ? chevron : _jsx(IconChevronRight, { size: 16 }), chevronPosition: 'right', styles: style, ...props }));
|
|
58
|
+
};
|
|
59
|
+
export const Accordion = Object.assign(AccordionComponent, {
|
|
60
|
+
Item: MantineAccordion.Item,
|
|
61
|
+
Control: MantineAccordion.Control,
|
|
62
|
+
Panel: MantineAccordion.Panel,
|
|
63
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { Accordion } from './Accordion';
|
|
3
|
+
declare const meta: Meta<typeof Accordion>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const MultiExpand: Story;
|
|
8
|
+
export declare const CustomHeader: Story;
|
|
9
|
+
export declare const DisabledItem: Story;
|
|
10
|
+
export declare const Controlled: Story;
|
|
11
|
+
//# sourceMappingURL=Accordion.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Accordion.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/Layout/Accordion/Accordion.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AASxC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,SAAS,CAsDhC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAInC,eAAO,MAAM,OAAO,EAAE,KAwCrB,CAAC;AAIF,eAAO,MAAM,WAAW,EAAE,KA6BzB,CAAC;AAWF,eAAO,MAAM,YAAY,EAAE,KA4D1B,CAAC;AAIF,eAAO,MAAM,YAAY,EAAE,KA6B1B,CAAC;AAIF,eAAO,MAAM,UAAU,EAAE,KA6BxB,CAAC"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Accordion } from './Accordion';
|
|
4
|
+
import { Badge } from '../../Info/Badge/Badge';
|
|
5
|
+
import { Group } from '../Group/Group';
|
|
6
|
+
import { Stack } from '../Stack/Stack';
|
|
7
|
+
import { Text } from '../../Typography/Text/Text';
|
|
8
|
+
import { Toggle } from '../../Inputs/Controls/Toggle/Toggle';
|
|
9
|
+
import { neutral } from '../../../constants/colors';
|
|
10
|
+
import { spacing } from '../../../constants/spacing';
|
|
11
|
+
const meta = {
|
|
12
|
+
title: 'Components/Layout/Accordion',
|
|
13
|
+
component: Accordion,
|
|
14
|
+
parameters: {
|
|
15
|
+
layout: 'centered',
|
|
16
|
+
docs: {
|
|
17
|
+
description: {
|
|
18
|
+
component: '[View Mantine Docs](https://v6.mantine.dev/core/accordion/)\n\nAccordion renders a list of expandable items. It extends Mantine v6\'s Accordion with Taiv styling: Poppins font, neutral dividers, `neutral[25]` hover, and a right-chevron that rotates 90° on expand.\n\nSupports controlled and uncontrolled modes, multi-expand via the `multiple` prop, and fully custom control content via `Accordion.Control`.',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
decorators: [
|
|
23
|
+
(Story) => (_jsx("div", { style: { width: '560px' }, children: _jsx(Story, {}) })),
|
|
24
|
+
],
|
|
25
|
+
argTypes: {
|
|
26
|
+
multiple: {
|
|
27
|
+
control: { type: 'boolean' },
|
|
28
|
+
description: 'Allow multiple items to be open simultaneously',
|
|
29
|
+
table: {
|
|
30
|
+
type: { summary: 'boolean' },
|
|
31
|
+
defaultValue: { summary: 'false' },
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
defaultValue: {
|
|
35
|
+
control: { type: 'text' },
|
|
36
|
+
description: 'Uncontrolled default open item value',
|
|
37
|
+
table: { type: { summary: 'string | string[]' } },
|
|
38
|
+
},
|
|
39
|
+
value: {
|
|
40
|
+
control: false,
|
|
41
|
+
description: 'Controlled open item value',
|
|
42
|
+
table: { type: { summary: 'string | string[] | null' } },
|
|
43
|
+
},
|
|
44
|
+
onChange: {
|
|
45
|
+
action: 'changed',
|
|
46
|
+
description: 'Called when the open item changes',
|
|
47
|
+
table: { type: { summary: '(value: string | string[] | null) => void' } },
|
|
48
|
+
},
|
|
49
|
+
chevron: {
|
|
50
|
+
control: false,
|
|
51
|
+
description: 'Override the default right-chevron icon',
|
|
52
|
+
table: { type: { summary: 'ReactNode' } },
|
|
53
|
+
},
|
|
54
|
+
styles: {
|
|
55
|
+
control: { type: 'object' },
|
|
56
|
+
description: 'Style overrides using Mantine styles API',
|
|
57
|
+
table: { type: { summary: 'Record<string, CSSObject>' } },
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
export default meta;
|
|
62
|
+
// ─── Single-expand (default) ────────────────────────────────────────────────
|
|
63
|
+
export const Default = {
|
|
64
|
+
args: { defaultValue: 'item-1' },
|
|
65
|
+
render: (args) => (_jsxs(Accordion, { ...args, children: [_jsxs(Accordion.Item, { value: 'item-1', children: [_jsx(Accordion.Control, { children: "Section one" }), _jsx(Accordion.Panel, { children: _jsx(Text, { variant: 'subtle', children: "Content for section one. Click the header to collapse." }) })] }), _jsxs(Accordion.Item, { value: 'item-2', children: [_jsx(Accordion.Control, { children: "Section two" }), _jsx(Accordion.Panel, { children: _jsx(Text, { variant: 'subtle', children: "Content for section two." }) })] }), _jsxs(Accordion.Item, { value: 'item-3', children: [_jsx(Accordion.Control, { children: "Section three" }), _jsx(Accordion.Panel, { children: _jsx(Text, { variant: 'subtle', children: "Content for section three." }) })] })] })),
|
|
66
|
+
parameters: {
|
|
67
|
+
docs: {
|
|
68
|
+
source: {
|
|
69
|
+
code: `<Accordion defaultValue="item-1">
|
|
70
|
+
<Accordion.Item value="item-1">
|
|
71
|
+
<Accordion.Control>Section one</Accordion.Control>
|
|
72
|
+
<Accordion.Panel>Content for section one.</Accordion.Panel>
|
|
73
|
+
</Accordion.Item>
|
|
74
|
+
<Accordion.Item value="item-2">
|
|
75
|
+
<Accordion.Control>Section two</Accordion.Control>
|
|
76
|
+
<Accordion.Panel>Content for section two.</Accordion.Panel>
|
|
77
|
+
</Accordion.Item>
|
|
78
|
+
</Accordion>`,
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
// ─── Multi-expand ────────────────────────────────────────────────────────────
|
|
84
|
+
export const MultiExpand = {
|
|
85
|
+
render: () => (_jsxs(Accordion, { multiple: true, children: [_jsxs(Accordion.Item, { value: 'item-1', children: [_jsx(Accordion.Control, { children: "Open simultaneously" }), _jsx(Accordion.Panel, { children: _jsx(Text, { variant: 'subtle', children: "Both panels can be open at once when `multiple` is set." }) })] }), _jsxs(Accordion.Item, { value: 'item-2', children: [_jsx(Accordion.Control, { children: "Also open" }), _jsx(Accordion.Panel, { children: _jsx(Text, { variant: 'subtle', children: "This one is open too." }) })] }), _jsxs(Accordion.Item, { value: 'item-3', children: [_jsx(Accordion.Control, { children: "Collapsed" }), _jsx(Accordion.Panel, { children: _jsx(Text, { variant: 'subtle', children: "This panel starts collapsed." }) })] })] })),
|
|
86
|
+
parameters: {
|
|
87
|
+
docs: {
|
|
88
|
+
description: { story: 'Pass `multiple` to allow any number of items to be open at once.' },
|
|
89
|
+
source: { code: `<Accordion multiple defaultValue={['item-1', 'item-2']}>...</Accordion>` },
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
// ─── Custom header content (Ad Preferences-style row) ───────────────────────
|
|
94
|
+
const categories = [
|
|
95
|
+
{ value: 'adult', emoji: '🔞', label: 'Adult Content', badge: null },
|
|
96
|
+
{ value: 'gambling', emoji: '🎰', label: 'Gambling', badge: null },
|
|
97
|
+
{ value: 'food', emoji: '🍽️', label: 'Food & Drink', badge: '1 of 9 blocked' },
|
|
98
|
+
{ value: 'health', emoji: '💪', label: 'Health & Fitness', badge: '1 of 14 blocked' },
|
|
99
|
+
];
|
|
100
|
+
export const CustomHeader = {
|
|
101
|
+
render: () => {
|
|
102
|
+
const [blocked, setBlocked] = useState({});
|
|
103
|
+
const toggle = (value, e) => {
|
|
104
|
+
e.stopPropagation();
|
|
105
|
+
setBlocked((prev) => ({ ...prev, [value]: !prev[value] }));
|
|
106
|
+
};
|
|
107
|
+
return (_jsx(Accordion, { children: categories.map(({ value, emoji, label, badge }) => (_jsxs(Accordion.Item, { value: value, children: [_jsx(Accordion.Control, { children: _jsxs(Group, { position: 'apart', noWrap: true, children: [_jsxs(Group, { spacing: spacing.sm, noWrap: true, children: [_jsx("span", { style: { fontSize: '20px', lineHeight: 1 }, children: emoji }), _jsx(Text, { variant: 'body', children: label })] }), _jsxs(Group, { spacing: spacing.sm, noWrap: true, onClick: (e) => e.stopPropagation(), children: [badge ? (_jsx(Badge, { variant: 'filled', color: 'warning', size: 'sm', children: badge })) : (_jsx(Text, { variant: 'label', color: neutral[200], children: "Not blocked" })), _jsx(Toggle, { size: 'sm', checked: !!blocked[value], variant: 'error', onChange: (e) => {
|
|
108
|
+
e.stopPropagation();
|
|
109
|
+
setBlocked((prev) => ({ ...prev, [value]: e.currentTarget.checked }));
|
|
110
|
+
} })] })] }) }), _jsx(Accordion.Panel, { children: _jsx(Stack, { spacing: spacing.sm, children: _jsxs(Text, { variant: 'subtle', children: ["Subcategories for ", label, " would appear here."] }) }) })] }, value))) }));
|
|
111
|
+
},
|
|
112
|
+
parameters: {
|
|
113
|
+
docs: {
|
|
114
|
+
description: {
|
|
115
|
+
story: 'Compose any content inside `Accordion.Control`. Wrap interactive elements (toggles, buttons) in a click-stopping container so they don\'t trigger expand/collapse.',
|
|
116
|
+
},
|
|
117
|
+
source: { code: false },
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
// ─── Disabled item ───────────────────────────────────────────────────────────
|
|
122
|
+
export const DisabledItem = {
|
|
123
|
+
render: () => (_jsxs(Accordion, { children: [_jsxs(Accordion.Item, { value: 'active', children: [_jsx(Accordion.Control, { children: "Available category" }), _jsx(Accordion.Panel, { children: _jsx(Text, { variant: 'subtle', children: "This item can be expanded." }) })] }), _jsxs(Accordion.Item, { value: 'disabled', disabled: true, children: [_jsx(Accordion.Control, { children: "Disabled category" }), _jsx(Accordion.Panel, { children: _jsx(Text, { variant: 'subtle', children: "This content is inaccessible." }) })] })] })),
|
|
124
|
+
parameters: {
|
|
125
|
+
docs: {
|
|
126
|
+
description: { story: 'Pass `disabled` on an `Accordion.Item` to prevent it from being opened.' },
|
|
127
|
+
source: {
|
|
128
|
+
code: `<Accordion.Item value="disabled" disabled>
|
|
129
|
+
<Accordion.Control>Disabled</Accordion.Control>
|
|
130
|
+
<Accordion.Panel>...</Accordion.Panel>
|
|
131
|
+
</Accordion.Item>`,
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
// ─── Controlled ──────────────────────────────────────────────────────────────
|
|
137
|
+
export const Controlled = {
|
|
138
|
+
render: () => {
|
|
139
|
+
const [value, setValue] = useState('item-1');
|
|
140
|
+
return (_jsxs(Stack, { spacing: spacing.md, children: [_jsxs(Text, { variant: 'label', children: ["Open item: ", value !== null && value !== void 0 ? value : 'none'] }), _jsxs(Accordion, { value: value, onChange: (v) => setValue(v), children: [_jsxs(Accordion.Item, { value: 'item-1', children: [_jsx(Accordion.Control, { children: "Controlled item 1" }), _jsx(Accordion.Panel, { children: _jsx(Text, { variant: 'subtle', children: "Controlled via external state." }) })] }), _jsxs(Accordion.Item, { value: 'item-2', children: [_jsx(Accordion.Control, { children: "Controlled item 2" }), _jsx(Accordion.Panel, { children: _jsx(Text, { variant: 'subtle', children: "Only one open at a time." }) })] })] })] }));
|
|
141
|
+
},
|
|
142
|
+
parameters: {
|
|
143
|
+
docs: {
|
|
144
|
+
description: { story: 'Pass `value` and `onChange` for full controlled behaviour.' },
|
|
145
|
+
source: { code: false },
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
};
|
|
@@ -1,8 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { type SimpleGridProps } from '@mantine/core';
|
|
2
|
+
import type React from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Tailwind-style responsive column map. Missing entries inherit from the
|
|
5
|
+
* next-smaller breakpoint. `base` applies at viewports below `sm` (640px).
|
|
6
|
+
*/
|
|
7
|
+
export type ResponsiveCols = {
|
|
8
|
+
base?: number;
|
|
9
|
+
sm?: number;
|
|
10
|
+
md?: number;
|
|
11
|
+
lg?: number;
|
|
12
|
+
xl?: number;
|
|
13
|
+
};
|
|
14
|
+
export interface AutoGridProps extends Omit<SimpleGridProps, 'cols'> {
|
|
4
15
|
children: React.ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* Number of columns. Accepts a number, or a Tailwind-style responsive map
|
|
18
|
+
* (`{ base: 1, sm: 2, lg: 3 }`). Defaults to `1`.
|
|
19
|
+
*/
|
|
20
|
+
cols?: number | ResponsiveCols;
|
|
5
21
|
}
|
|
6
|
-
declare const AutoGrid: ({ children, ...props }: AutoGridProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
export { AutoGrid };
|
|
22
|
+
export declare const AutoGrid: ({ cols, children, ...props }: AutoGridProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
23
|
//# sourceMappingURL=AutoGrid.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutoGrid.d.ts","sourceRoot":"","sources":["../../../../src/components/Layout/AutoGrid/AutoGrid.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,
|
|
1
|
+
{"version":3,"file":"AutoGrid.d.ts","sourceRoot":"","sources":["../../../../src/components/Layout/AutoGrid/AutoGrid.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC;IAClE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC;CAChC;AAqDD,eAAO,MAAM,QAAQ,GAAI,8BAAkC,aAAa,4CAmBvE,CAAC"}
|
|
@@ -1,6 +1,54 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { SimpleGrid } from '@mantine/core';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { breakpoints } from '../../../constants/breakpoints';
|
|
4
|
+
const BP_WIDTH_PX = {
|
|
5
|
+
base: 0,
|
|
6
|
+
lg: breakpoints.LAPTOP, // 1024
|
|
7
|
+
md: breakpoints.TABLET, // 768
|
|
8
|
+
sm: breakpoints.MOBILE, // 640
|
|
9
|
+
xl: breakpoints.DESKTOP, // 1280
|
|
10
|
+
};
|
|
11
|
+
const RESPONSIVE_KEYS = [
|
|
12
|
+
'base',
|
|
13
|
+
'sm',
|
|
14
|
+
'md',
|
|
15
|
+
'lg',
|
|
16
|
+
'xl',
|
|
17
|
+
];
|
|
18
|
+
/**
|
|
19
|
+
* Translate a mobile-first responsive cols map into Mantine v6's
|
|
20
|
+
* `{ cols, breakpoints: [{ maxWidth, cols }, …] }` shape. Mantine applies
|
|
21
|
+
* breakpoints below a `maxWidth` so we resolve the largest entry as the base
|
|
22
|
+
* `cols` and emit descending `maxWidth` thresholds for smaller steps.
|
|
23
|
+
*/
|
|
24
|
+
const resolveResponsiveCols = (map) => {
|
|
25
|
+
// Forward-fill so `{ base: 1, lg: 3 }` implies sm/md also pick up 1 until lg.
|
|
26
|
+
let last = 1;
|
|
27
|
+
const filled = RESPONSIVE_KEYS.reduce((acc, k) => {
|
|
28
|
+
const v = map[k];
|
|
29
|
+
if (typeof v === 'number')
|
|
30
|
+
last = v;
|
|
31
|
+
acc[k] = last;
|
|
32
|
+
return acc;
|
|
33
|
+
}, { base: 1, lg: 1, md: 1, sm: 1, xl: 1 });
|
|
34
|
+
const baseCols = filled.xl;
|
|
35
|
+
const stops = [];
|
|
36
|
+
// Walk descending: each step fires when viewport drops below its threshold.
|
|
37
|
+
const descending = ['xl', 'lg', 'md', 'sm'];
|
|
38
|
+
for (const key of descending) {
|
|
39
|
+
const smaller = RESPONSIVE_KEYS[RESPONSIVE_KEYS.indexOf(key) - 1];
|
|
40
|
+
if (!smaller)
|
|
41
|
+
continue;
|
|
42
|
+
if (filled[smaller] !== filled[key]) {
|
|
43
|
+
stops === null || stops === void 0 ? void 0 : stops.push({ cols: filled[smaller], maxWidth: BP_WIDTH_PX[key] });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return { breakpoints: stops, cols: baseCols };
|
|
47
|
+
};
|
|
48
|
+
export const AutoGrid = ({ cols = 1, children, ...props }) => {
|
|
49
|
+
if (typeof cols === 'number') {
|
|
50
|
+
return (_jsx(SimpleGrid, { cols: cols, ...props, children: children }));
|
|
51
|
+
}
|
|
52
|
+
const { cols: resolvedCols, breakpoints: resolvedBreakpoints } = resolveResponsiveCols(cols);
|
|
53
|
+
return (_jsx(SimpleGrid, { breakpoints: resolvedBreakpoints, cols: resolvedCols, ...props, children: children }));
|
|
5
54
|
};
|
|
6
|
-
export { AutoGrid };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutoGrid.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/Layout/AutoGrid/AutoGrid.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"AutoGrid.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/Layout/AutoGrid/AutoGrid.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,QAAQ,CAqD/B,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAwBnC,eAAO,MAAM,OAAO,EAAE,KAwBrB,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KAoB5B,CAAC"}
|