@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,671 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createViewDay, createViewMonthGrid, createViewWeek, } from '@schedule-x/calendar';
|
|
3
|
+
import { createCurrentTimePlugin } from '@schedule-x/current-time';
|
|
4
|
+
import { createDragAndDropPlugin } from '@schedule-x/drag-and-drop';
|
|
5
|
+
import { createEventsServicePlugin } from '@schedule-x/events-service';
|
|
6
|
+
import { ScheduleXCalendar, useNextCalendarApp } from '@schedule-x/react';
|
|
7
|
+
import { createResizePlugin } from '@schedule-x/resize';
|
|
8
|
+
import { IconChevronLeft, IconChevronRight } from '@tabler/icons-react';
|
|
9
|
+
import dayjs from 'dayjs';
|
|
10
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
11
|
+
import { error, neutral, primary, purple, salmon, success, warning, white, } from '../../../constants/colors';
|
|
12
|
+
import { spacing } from '../../../constants/spacing';
|
|
13
|
+
import { Button } from '../../Inputs/Buttons/Button/Button';
|
|
14
|
+
import { IconButton } from '../../Inputs/Buttons/IconButton/IconButton';
|
|
15
|
+
import { SegmentedControl } from '../../Inputs/Controls/SegmentedControl/SegmentedControl';
|
|
16
|
+
import { Group } from '../../Layout/Group/Group';
|
|
17
|
+
import { Title } from '../../Typography/Title/Title';
|
|
18
|
+
import '@schedule-x/theme-default/dist/index.css';
|
|
19
|
+
/**
|
|
20
|
+
* Default Schedule-X `calendars` map, keyed by Taiv semantic color names.
|
|
21
|
+
* Consumers using `calendarId: 'primary' | 'success' | …` get Taiv-tokenized
|
|
22
|
+
* chips out of the box. To category-code events with custom keys (e.g.
|
|
23
|
+
* `'one-time' | 'weekly'`), pass your own map via the `calendars` prop —
|
|
24
|
+
* it replaces this default rather than merging.
|
|
25
|
+
*
|
|
26
|
+
* Schedule-X paints the chip from `lightColors`:
|
|
27
|
+
* - `main` drives the 4px left-border accent and the icon stroke
|
|
28
|
+
* - `container` is the filled background
|
|
29
|
+
* - `onContainer` is the text painted on top of `container`
|
|
30
|
+
*/
|
|
31
|
+
export const TAIV_CALENDAR_PALETTE = {
|
|
32
|
+
error: {
|
|
33
|
+
colorName: 'error',
|
|
34
|
+
lightColors: {
|
|
35
|
+
container: error[25],
|
|
36
|
+
main: error[200],
|
|
37
|
+
onContainer: error[300],
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
neutral: {
|
|
41
|
+
colorName: 'neutral',
|
|
42
|
+
lightColors: {
|
|
43
|
+
container: neutral[25],
|
|
44
|
+
main: neutral[200],
|
|
45
|
+
onContainer: neutral[300],
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
primary: {
|
|
49
|
+
colorName: 'primary',
|
|
50
|
+
lightColors: {
|
|
51
|
+
container: primary[25],
|
|
52
|
+
main: primary[200],
|
|
53
|
+
onContainer: primary[200],
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
purple: {
|
|
57
|
+
colorName: 'purple',
|
|
58
|
+
lightColors: {
|
|
59
|
+
container: purple[50],
|
|
60
|
+
main: purple[200],
|
|
61
|
+
onContainer: purple[200],
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
salmon: {
|
|
65
|
+
colorName: 'salmon',
|
|
66
|
+
lightColors: {
|
|
67
|
+
container: salmon[50],
|
|
68
|
+
main: salmon[200],
|
|
69
|
+
onContainer: salmon[200],
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
success: {
|
|
73
|
+
colorName: 'success',
|
|
74
|
+
lightColors: {
|
|
75
|
+
container: success[25],
|
|
76
|
+
main: success[200],
|
|
77
|
+
onContainer: success[300],
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
warning: {
|
|
81
|
+
colorName: 'warning',
|
|
82
|
+
lightColors: {
|
|
83
|
+
container: warning[25],
|
|
84
|
+
main: warning[200],
|
|
85
|
+
onContainer: warning[300],
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
90
|
+
// Internal helpers
|
|
91
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
92
|
+
const D_FMT = 'YYYY-MM-DD';
|
|
93
|
+
// Schedule-X uses 'month-grid' / 'week' / 'day' internally.
|
|
94
|
+
const toSxView = (v) => v === 'month' ? 'month-grid' : v;
|
|
95
|
+
const fromSxView = (n) => {
|
|
96
|
+
if (n === 'day' || n === 'week')
|
|
97
|
+
return n;
|
|
98
|
+
if (n === 'month-grid')
|
|
99
|
+
return 'month';
|
|
100
|
+
return null;
|
|
101
|
+
};
|
|
102
|
+
const viewFactories = {
|
|
103
|
+
day: createViewDay,
|
|
104
|
+
month: createViewMonthGrid,
|
|
105
|
+
week: createViewWeek,
|
|
106
|
+
};
|
|
107
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
108
|
+
// Taiv theme overlay — frame only
|
|
109
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
110
|
+
// Schedule-X ships Material-Design typography and palette. This overlay
|
|
111
|
+
// rebrands the *frame* (header chrome, day-of-week labels, date numbers,
|
|
112
|
+
// time gutter, today bubble) under `.taiv-calendar`. Event chips intentionally
|
|
113
|
+
// fall through to Schedule-X's native rendering driven by `calendarId` — that
|
|
114
|
+
// path is robust and avoids the layout pitfalls that custom event renderers
|
|
115
|
+
// historically introduced.
|
|
116
|
+
const TAIV_CALENDAR_CSS = `
|
|
117
|
+
.taiv-calendar {
|
|
118
|
+
/* Brand */
|
|
119
|
+
--sx-color-primary: ${primary[200]};
|
|
120
|
+
--sx-color-on-primary: ${white};
|
|
121
|
+
--sx-color-primary-container: ${primary[25]};
|
|
122
|
+
--sx-color-on-primary-container: ${primary[200]};
|
|
123
|
+
--sx-color-surface-tint: ${primary[200]};
|
|
124
|
+
|
|
125
|
+
/* Secondary — neutral, since Taiv has no second brand hue */
|
|
126
|
+
--sx-color-secondary: ${neutral[200]};
|
|
127
|
+
--sx-color-on-secondary: ${white};
|
|
128
|
+
--sx-color-secondary-container: ${neutral[25]};
|
|
129
|
+
--sx-color-on-secondary-container: ${neutral[300]};
|
|
130
|
+
|
|
131
|
+
/* Surfaces */
|
|
132
|
+
--sx-color-background: ${white};
|
|
133
|
+
--sx-color-on-background: ${neutral[300]};
|
|
134
|
+
--sx-color-surface: ${white};
|
|
135
|
+
--sx-color-surface-bright: ${white};
|
|
136
|
+
--sx-color-surface-dim: ${neutral[25]};
|
|
137
|
+
--sx-color-on-surface: ${neutral[300]};
|
|
138
|
+
--sx-color-surface-container: ${neutral[25]};
|
|
139
|
+
--sx-color-surface-container-low: ${white};
|
|
140
|
+
--sx-color-surface-container-high: ${neutral[25]};
|
|
141
|
+
|
|
142
|
+
/* Borders & outlines */
|
|
143
|
+
--sx-color-outline: ${neutral[100]};
|
|
144
|
+
--sx-color-outline-variant: ${neutral[50]};
|
|
145
|
+
--sx-color-neutral: ${neutral[200]};
|
|
146
|
+
--sx-color-neutral-variant: ${neutral[100]};
|
|
147
|
+
--sx-internal-color-light-gray: ${neutral[25]};
|
|
148
|
+
--sx-internal-color-text: ${neutral[300]};
|
|
149
|
+
--sx-internal-color-gray-ripple-background: ${neutral[50]};
|
|
150
|
+
|
|
151
|
+
--sx-border: 1px solid ${neutral[50]};
|
|
152
|
+
|
|
153
|
+
/* Typography — sizes aligned to Taiv text variants */
|
|
154
|
+
--sx-font-extra-small: 12px;
|
|
155
|
+
--sx-font-small: 14px;
|
|
156
|
+
--sx-font-large: 16px;
|
|
157
|
+
--sx-font-extra-large: 20px;
|
|
158
|
+
|
|
159
|
+
font-family: 'Poppins', sans-serif;
|
|
160
|
+
-webkit-font-smoothing: antialiased;
|
|
161
|
+
-moz-osx-font-smoothing: grayscale;
|
|
162
|
+
color: ${neutral[300]};
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/* Force Poppins on every SX text surface — SX sets font-family per-selector. */
|
|
166
|
+
.taiv-calendar,
|
|
167
|
+
.taiv-calendar * {
|
|
168
|
+
font-family: 'Poppins', sans-serif !important;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/* Day-of-week labels: Taiv 'label' (12 / medium / neutral[200]), sentence case */
|
|
172
|
+
.taiv-calendar .sx__week-grid__day-name,
|
|
173
|
+
.taiv-calendar .sx__month-grid-day__header-day-name,
|
|
174
|
+
.taiv-calendar .sx__month-agenda-day-name,
|
|
175
|
+
.taiv-calendar .sx__date-picker__day-name {
|
|
176
|
+
font-size: 12px;
|
|
177
|
+
font-weight: 500;
|
|
178
|
+
color: ${neutral[200]};
|
|
179
|
+
text-transform: none;
|
|
180
|
+
letter-spacing: 0;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/* Today's day-of-week label picks up primary */
|
|
184
|
+
.taiv-calendar .sx__week-grid__date--is-today .sx__week-grid__day-name {
|
|
185
|
+
color: ${primary[200]};
|
|
186
|
+
font-weight: 600;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/* Month-grid day number ("29", "30") — Taiv 'body' size, medium weight */
|
|
190
|
+
.taiv-calendar .sx__month-grid-day__header-date {
|
|
191
|
+
font-size: 14px;
|
|
192
|
+
font-weight: 500;
|
|
193
|
+
color: ${neutral[300]};
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/* Week-view big date number — cardHeader-ish */
|
|
197
|
+
.taiv-calendar .sx__week-grid__date-number {
|
|
198
|
+
font-size: 20px;
|
|
199
|
+
font-weight: 500;
|
|
200
|
+
color: ${neutral[300]};
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/* Today bubble: primary fill, white text */
|
|
204
|
+
.taiv-calendar .sx__month-grid-day__header-date.sx__is-today,
|
|
205
|
+
.taiv-calendar .sx__week-grid__date--is-today .sx__week-grid__date-number {
|
|
206
|
+
background-color: ${primary[200]};
|
|
207
|
+
color: ${white};
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/* Time-gutter hour labels — Taiv 'label' */
|
|
211
|
+
.taiv-calendar .sx__week-grid__hour,
|
|
212
|
+
.taiv-calendar .sx__week-grid__hour-text,
|
|
213
|
+
.taiv-calendar .sx__time-grid-hour,
|
|
214
|
+
.taiv-calendar .sx__time-grid__hour-text {
|
|
215
|
+
font-size: 12px;
|
|
216
|
+
font-weight: 500;
|
|
217
|
+
color: ${neutral[200]};
|
|
218
|
+
text-transform: none;
|
|
219
|
+
letter-spacing: 0;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/* "N more" pill in cramped month cells */
|
|
223
|
+
.taiv-calendar .sx__month-grid-day__events-more {
|
|
224
|
+
font-size: 12px;
|
|
225
|
+
font-weight: 500;
|
|
226
|
+
color: ${neutral[200]};
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/* Floor month-grid week-row height so cells read closer to square. */
|
|
230
|
+
.taiv-calendar .sx__month-grid-week {
|
|
231
|
+
min-height: 120px;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/* Always hide Schedule-X's internal header — we own the toolbar surface. */
|
|
235
|
+
.taiv-calendar .sx__calendar-header {
|
|
236
|
+
display: none !important;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/* Drag-to-create overlay. Painted as an absolutely-positioned ghost over the
|
|
240
|
+
grid while the user drags an empty slot. Pointer-events: none so the gesture
|
|
241
|
+
keeps reading through to Schedule-X's cells (we need to keep resolving
|
|
242
|
+
data-time-grid-date / data-date during the drag). */
|
|
243
|
+
.taiv-calendar .taiv-cal-drag-ghost {
|
|
244
|
+
background: ${primary[25]};
|
|
245
|
+
border: 1px dashed ${primary[200]};
|
|
246
|
+
border-radius: 6px;
|
|
247
|
+
pointer-events: none;
|
|
248
|
+
position: fixed;
|
|
249
|
+
z-index: 5;
|
|
250
|
+
}
|
|
251
|
+
`;
|
|
252
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
253
|
+
// Drag-to-create helpers
|
|
254
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
255
|
+
// Movement past this distance in pixels turns a click into a drag. Anything
|
|
256
|
+
// shorter falls through to `onClickDateTime` / `onClickDate` so a click and
|
|
257
|
+
// a drag stay UX-interchangeable for the same gesture.
|
|
258
|
+
const DRAG_THRESHOLD_PX = 6;
|
|
259
|
+
// Parse `'HH:mm'` to minutes since midnight. Used to translate the
|
|
260
|
+
// `dayBoundaries` prop into the pixel-to-minute math for time-grid drags.
|
|
261
|
+
const minutesOfHHmm = (hhmm) => {
|
|
262
|
+
const [h, m] = hhmm.split(':').map((n) => Number(n) || 0);
|
|
263
|
+
return h * 60 + m;
|
|
264
|
+
};
|
|
265
|
+
// Format a YYYY-MM-DD date + minutes-since-midnight into Schedule-X's
|
|
266
|
+
// `YYYY-MM-DD HH:mm` datetime string, snapped to `step` minutes.
|
|
267
|
+
const formatDateTime = (date, minutes, step) => {
|
|
268
|
+
const snapped = Math.max(0, Math.round(minutes / step) * step);
|
|
269
|
+
const clamped = Math.min(snapped, 23 * 60 + 59);
|
|
270
|
+
const hh = String(Math.floor(clamped / 60)).padStart(2, '0');
|
|
271
|
+
const mm = String(clamped % 60).padStart(2, '0');
|
|
272
|
+
return `${date} ${hh}:${mm}`;
|
|
273
|
+
};
|
|
274
|
+
// Snap a `YYYY-MM-DD HH:mm` ISO (Schedule-X format) to `step` minutes.
|
|
275
|
+
// Date-only ISOs (`YYYY-MM-DD` from `onClickDate`) pass through untouched
|
|
276
|
+
// — there's no time component to round. Used to align the click ISO and
|
|
277
|
+
// the drag-start ISO that Schedule-X hands us to the same grid as our own
|
|
278
|
+
// drag-end math, so a single-click create + a drag both produce
|
|
279
|
+
// minuteStep-aligned times in the editor.
|
|
280
|
+
const snapISO = (iso, step) => {
|
|
281
|
+
const space = iso.indexOf(' ');
|
|
282
|
+
if (space < 0)
|
|
283
|
+
return iso;
|
|
284
|
+
const date = iso.slice(0, space);
|
|
285
|
+
const time = iso.slice(space + 1);
|
|
286
|
+
const [hStr, mStr] = time.split(':');
|
|
287
|
+
const minutes = (Number(hStr) || 0) * 60 + (Number(mStr) || 0);
|
|
288
|
+
return formatDateTime(date, minutes, step);
|
|
289
|
+
};
|
|
290
|
+
// Fraction (0..1) of where `x` sits inside `rect` along the horizontal axis.
|
|
291
|
+
// Used by the "mostly covered" snap to decide whether the user's pointer was
|
|
292
|
+
// on the include-this-day side of a cell boundary (left half) or the
|
|
293
|
+
// skip-this-day side (right half). Returns 0.5 for missing rects so the
|
|
294
|
+
// caller's threshold logic stays well-defined.
|
|
295
|
+
const xPctInCell = (rect, x) => {
|
|
296
|
+
if (!rect || rect.width === 0)
|
|
297
|
+
return 0.5;
|
|
298
|
+
return Math.max(0, Math.min(1, (x - rect.left) / rect.width));
|
|
299
|
+
};
|
|
300
|
+
// Add/subtract whole days from a `YYYY-MM-DD` date string. Used to walk one
|
|
301
|
+
// day forward (snap start past a barely-touched left day) or backward (snap
|
|
302
|
+
// end past a barely-touched right day).
|
|
303
|
+
const addDaysToDateISO = (dateStr, delta) => dayjs(dateStr, 'YYYY-MM-DD').add(delta, 'day').format('YYYY-MM-DD');
|
|
304
|
+
// Resolve a pointer event to a `YYYY-MM-DD HH:mm` datetime by reading the
|
|
305
|
+
// `.sx__time-grid-day` cell under the cursor and using the same Y-percent
|
|
306
|
+
// math Schedule-X uses internally for click → time. Returns null when the
|
|
307
|
+
// cursor is outside the time-grid (e.g. dragged into the all-day row or
|
|
308
|
+
// header).
|
|
309
|
+
const dateTimeFromPointer = (e, dayStart, dayEnd, minuteStep) => {
|
|
310
|
+
const node = document.elementFromPoint(e.clientX, e.clientY);
|
|
311
|
+
const cell = node === null || node === void 0 ? void 0 : node.closest('.sx__time-grid-day');
|
|
312
|
+
if (!cell)
|
|
313
|
+
return null;
|
|
314
|
+
const date = cell.getAttribute('data-time-grid-date');
|
|
315
|
+
if (!date)
|
|
316
|
+
return null;
|
|
317
|
+
const rect = cell.getBoundingClientRect();
|
|
318
|
+
const y = Math.max(0, Math.min(rect.height, e.clientY - rect.top));
|
|
319
|
+
const pct = rect.height === 0 ? 0 : y / rect.height;
|
|
320
|
+
const minutesIntoDay = dayStart + pct * (dayEnd - dayStart);
|
|
321
|
+
return formatDateTime(date, minutesIntoDay, minuteStep);
|
|
322
|
+
};
|
|
323
|
+
// Resolve a pointer event to a `YYYY-MM-DD` date by reading the
|
|
324
|
+
// `[data-date]` attribute Schedule-X stamps on month-grid day cells.
|
|
325
|
+
const dateFromPointer = (e) => {
|
|
326
|
+
var _a;
|
|
327
|
+
const node = document.elementFromPoint(e.clientX, e.clientY);
|
|
328
|
+
const cell = node === null || node === void 0 ? void 0 : node.closest('[data-date]');
|
|
329
|
+
return (_a = cell === null || cell === void 0 ? void 0 : cell.getAttribute('data-date')) !== null && _a !== void 0 ? _a : null;
|
|
330
|
+
};
|
|
331
|
+
// CSS selectors for the cell types Schedule-X renders day-column data on.
|
|
332
|
+
// Time-grid cells expose the date via `data-time-grid-date`; month-grid
|
|
333
|
+
// cells via `data-date`. The horizontal snap math uses these to find the
|
|
334
|
+
// cell under a given pointer position (start at mousedown, end at pointerup).
|
|
335
|
+
const CELL_SELECTOR = {
|
|
336
|
+
time: '.sx__time-grid-day',
|
|
337
|
+
date: '[data-date]',
|
|
338
|
+
};
|
|
339
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
340
|
+
// Component
|
|
341
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
342
|
+
const Calendar = ({ events, calendars = TAIV_CALENDAR_PALETTE, view, onViewChange, views = ['month', 'week', 'day'], currentDate, onDateChange, onEventClick, onClickDateTime, onClickDate, onSlotRange, onEventUpdate, readOnly = false, minuteStep = 15, toolbar, firstDayOfWeek = 0, dayBoundaries, }) => {
|
|
343
|
+
// Single source of truth for the focused date. Synced both ways with
|
|
344
|
+
// the `currentDate` prop and Schedule-X's internal datePickerState.
|
|
345
|
+
const [internalDate, setInternalDate] = useState(currentDate !== null && currentDate !== void 0 ? currentDate : new Date());
|
|
346
|
+
// ── Drag-to-create plumbing ──────────────────────────────────────────────
|
|
347
|
+
// `dragRef` holds the in-flight gesture. Lives in a ref so per-frame
|
|
348
|
+
// pointermove updates don't re-render the whole calendar — only the ghost
|
|
349
|
+
// overlay (driven by `ghost` useState below) does.
|
|
350
|
+
const dragRef = useRef(null);
|
|
351
|
+
// After a drag, Schedule-X fires a `click` event because the pointerdown
|
|
352
|
+
// and pointerup landed on the same element. We suppress one such click
|
|
353
|
+
// so the consumer doesn't get both `onSlotRange` and a stale
|
|
354
|
+
// `onClickDateTime` / `onClickDate` for the same gesture.
|
|
355
|
+
const suppressNextClickRef = useRef(false);
|
|
356
|
+
// Ghost overlay position. `null` while idle. `kind` carries through so the
|
|
357
|
+
// overlay can theme itself differently per drag type later if we want.
|
|
358
|
+
const [ghost, setGhost] = useState(null);
|
|
359
|
+
// Day-boundary minute window. Used by the time-grid pointer→datetime math.
|
|
360
|
+
const dayStartMin = useMemo(() => { var _a; return minutesOfHHmm((_a = dayBoundaries === null || dayBoundaries === void 0 ? void 0 : dayBoundaries.start) !== null && _a !== void 0 ? _a : '00:00'); }, [dayBoundaries === null || dayBoundaries === void 0 ? void 0 : dayBoundaries.start]);
|
|
361
|
+
const dayEndMin = useMemo(() => {
|
|
362
|
+
var _a;
|
|
363
|
+
// Schedule-X accepts `'24:00'` to mean end-of-day; treat it as 1440.
|
|
364
|
+
const raw = (_a = dayBoundaries === null || dayBoundaries === void 0 ? void 0 : dayBoundaries.end) !== null && _a !== void 0 ? _a : '24:00';
|
|
365
|
+
return raw === '24:00' ? 1440 : minutesOfHHmm(raw);
|
|
366
|
+
}, [dayBoundaries === null || dayBoundaries === void 0 ? void 0 : dayBoundaries.end]);
|
|
367
|
+
// Update the ghost overlay bounding box to bridge from the gesture's start
|
|
368
|
+
// pointer position to its current pointer position. Stored in viewport
|
|
369
|
+
// coordinates (the overlay is `position: fixed`).
|
|
370
|
+
const updateGhost = useCallback((e, kind, startX, startY) => {
|
|
371
|
+
const left = Math.min(startX, e.clientX);
|
|
372
|
+
const top = Math.min(startY, e.clientY);
|
|
373
|
+
const width = Math.abs(e.clientX - startX);
|
|
374
|
+
const height = Math.abs(e.clientY - startY);
|
|
375
|
+
setGhost({ kind, left, top, width, height });
|
|
376
|
+
}, []);
|
|
377
|
+
// Pointermove during a drag. Promotes the gesture from "click" to "drag"
|
|
378
|
+
// once movement exceeds threshold, then updates the ghost on every frame.
|
|
379
|
+
const handlePointerMove = useCallback((e) => {
|
|
380
|
+
const drag = dragRef.current;
|
|
381
|
+
if (!drag)
|
|
382
|
+
return;
|
|
383
|
+
const dx = e.clientX - drag.startX;
|
|
384
|
+
const dy = e.clientY - drag.startY;
|
|
385
|
+
if (!drag.isDragging && Math.hypot(dx, dy) >= DRAG_THRESHOLD_PX) {
|
|
386
|
+
drag.isDragging = true;
|
|
387
|
+
}
|
|
388
|
+
if (drag.isDragging) {
|
|
389
|
+
updateGhost(e, drag.kind, drag.startX, drag.startY);
|
|
390
|
+
}
|
|
391
|
+
}, [updateGhost]);
|
|
392
|
+
// Pointerup ends the gesture. If the drag never crossed threshold, we let
|
|
393
|
+
// Schedule-X's click handlers run as-is. If it did, we compute the end ISO
|
|
394
|
+
// from the cell under the cursor, apply the half-column "mostly covered"
|
|
395
|
+
// snap on the horizontal axis, fire `onSlotRange`, and suppress the
|
|
396
|
+
// imminent click event.
|
|
397
|
+
const handlePointerUp = useCallback((e) => {
|
|
398
|
+
const drag = dragRef.current;
|
|
399
|
+
dragRef.current = null;
|
|
400
|
+
window.removeEventListener('pointermove', handlePointerMove);
|
|
401
|
+
window.removeEventListener('pointerup', handlePointerUp);
|
|
402
|
+
setGhost(null);
|
|
403
|
+
if (!drag)
|
|
404
|
+
return;
|
|
405
|
+
if (!drag.isDragging)
|
|
406
|
+
return; // tap → onClick* fires normally
|
|
407
|
+
let endISO = null;
|
|
408
|
+
if (drag.kind === 'time') {
|
|
409
|
+
endISO = dateTimeFromPointer(e, dayStartMin, dayEndMin, minuteStep);
|
|
410
|
+
}
|
|
411
|
+
else {
|
|
412
|
+
endISO = dateFromPointer(e);
|
|
413
|
+
}
|
|
414
|
+
if (!endISO)
|
|
415
|
+
return;
|
|
416
|
+
// Normalize: callbacks should always receive start <= end. Easier for
|
|
417
|
+
// consumers than checking which way the user dragged.
|
|
418
|
+
let [startISO, finalEndISO] = endISO < drag.startISO
|
|
419
|
+
? [endISO, drag.startISO]
|
|
420
|
+
: [drag.startISO, endISO];
|
|
421
|
+
// ── Horizontal "mostly covered" day snap ──────────────────────────
|
|
422
|
+
// Round each side of the range to the nearest day boundary so a drag
|
|
423
|
+
// that barely touches a day on its way in/out doesn't drag that day
|
|
424
|
+
// into the range. Skipped when start and end are in the same day
|
|
425
|
+
// cell — there a horizontal snap would always turn a one-day drag
|
|
426
|
+
// into the wrong shape. Skipped if the snap would invert the range
|
|
427
|
+
// (e.g. tiny gesture across one boundary with both sides in the
|
|
428
|
+
// "exclude" half).
|
|
429
|
+
const startDatePart = startISO.split(' ')[0];
|
|
430
|
+
const endDatePart = finalEndISO.split(' ')[0];
|
|
431
|
+
if (startDatePart !== endDatePart) {
|
|
432
|
+
// Identify which pointer (mousedown vs pointerup) became the LEFT
|
|
433
|
+
// (earlier) side after normalization. The unflipped case is the
|
|
434
|
+
// common one; we only swap when the user dragged right-to-left.
|
|
435
|
+
const mousedownIsLeft = startISO === drag.startISO;
|
|
436
|
+
const leftRect = mousedownIsLeft ? drag.startCellRect : undefined;
|
|
437
|
+
const leftX = mousedownIsLeft ? drag.startX : e.clientX;
|
|
438
|
+
const rightRect = mousedownIsLeft ? undefined : drag.startCellRect;
|
|
439
|
+
const rightX = mousedownIsLeft ? e.clientX : drag.startX;
|
|
440
|
+
// If we lost a rect (e.g. mousedown target wasn't inside a known
|
|
441
|
+
// cell, or pointerup landed outside the grid), look it up via
|
|
442
|
+
// `elementFromPoint` at the relevant pointer position.
|
|
443
|
+
const resolveRect = (rect, x, y) => {
|
|
444
|
+
var _a;
|
|
445
|
+
if (rect)
|
|
446
|
+
return rect;
|
|
447
|
+
const cell = (_a = document.elementFromPoint(x, y)) === null || _a === void 0 ? void 0 : _a.closest(CELL_SELECTOR[drag.kind]);
|
|
448
|
+
return cell === null || cell === void 0 ? void 0 : cell.getBoundingClientRect();
|
|
449
|
+
};
|
|
450
|
+
const resolvedLeftRect = resolveRect(leftRect, leftX, mousedownIsLeft ? drag.startY : e.clientY);
|
|
451
|
+
const resolvedRightRect = resolveRect(rightRect, rightX, mousedownIsLeft ? e.clientY : drag.startY);
|
|
452
|
+
const leftXPct = xPctInCell(resolvedLeftRect, leftX);
|
|
453
|
+
const rightXPct = xPctInCell(resolvedRightRect, rightX);
|
|
454
|
+
let snappedLeftDate = startDatePart;
|
|
455
|
+
let snappedRightDate = endDatePart;
|
|
456
|
+
// Left side: pointer in right half → user mostly skipped this day
|
|
457
|
+
// → bump start forward one day.
|
|
458
|
+
if (leftXPct >= 0.5) {
|
|
459
|
+
snappedLeftDate = addDaysToDateISO(startDatePart, 1);
|
|
460
|
+
}
|
|
461
|
+
// Right side: pointer in left half → user barely entered this day
|
|
462
|
+
// → bump end back one day.
|
|
463
|
+
if (rightXPct < 0.5) {
|
|
464
|
+
snappedRightDate = addDaysToDateISO(endDatePart, -1);
|
|
465
|
+
}
|
|
466
|
+
// If both snaps pulled the range past itself, fall back to the
|
|
467
|
+
// raw dates — the original swept range is what the user touched.
|
|
468
|
+
if (snappedLeftDate > snappedRightDate) {
|
|
469
|
+
snappedLeftDate = startDatePart;
|
|
470
|
+
snappedRightDate = endDatePart;
|
|
471
|
+
}
|
|
472
|
+
// Stitch snapped dates back to their time-of-day component (the
|
|
473
|
+
// snap is date-axis-only — time stayed wherever the pointer was).
|
|
474
|
+
if (drag.kind === 'time') {
|
|
475
|
+
const startTimePart = startISO.slice(11); // 'HH:mm'
|
|
476
|
+
const endTimePart = finalEndISO.slice(11);
|
|
477
|
+
startISO = `${snappedLeftDate} ${startTimePart}`;
|
|
478
|
+
finalEndISO = `${snappedRightDate} ${endTimePart}`;
|
|
479
|
+
}
|
|
480
|
+
else {
|
|
481
|
+
startISO = snappedLeftDate;
|
|
482
|
+
finalEndISO = snappedRightDate;
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
suppressNextClickRef.current = true;
|
|
486
|
+
onSlotRange === null || onSlotRange === void 0 ? void 0 : onSlotRange(startISO, finalEndISO, drag.kind);
|
|
487
|
+
}, [handlePointerMove, dayStartMin, dayEndMin, minuteStep, onSlotRange]);
|
|
488
|
+
// Schedule-X's mousedown callbacks are our drag-start signal. They fire
|
|
489
|
+
// with the precise snap-aligned ISO Schedule-X derives from the click Y
|
|
490
|
+
// position (time-grid) or the cell `data-date` (month-grid), so we can
|
|
491
|
+
// trust whatever they hand us as the canonical start of the range.
|
|
492
|
+
const handleMouseDownDateTime = useCallback((iso, e) => {
|
|
493
|
+
var _a;
|
|
494
|
+
if (readOnly)
|
|
495
|
+
return;
|
|
496
|
+
// Snapshot the start cell's rect so we can compute the pointer's
|
|
497
|
+
// horizontal position within it at pointerup — used by the half-column
|
|
498
|
+
// "mostly covered" snap.
|
|
499
|
+
const startCell = (_a = e.target) === null || _a === void 0 ? void 0 : _a.closest(CELL_SELECTOR.time);
|
|
500
|
+
dragRef.current = {
|
|
501
|
+
kind: 'time',
|
|
502
|
+
// Schedule-X's mousedown ISO is at 1-minute resolution — snap to
|
|
503
|
+
// `minuteStep` so a drag's start aligns to the same grid as its
|
|
504
|
+
// end (which `formatDateTime` already snaps in `dateTimeFromPointer`).
|
|
505
|
+
startISO: snapISO(iso, minuteStep),
|
|
506
|
+
startX: e.clientX,
|
|
507
|
+
startY: e.clientY,
|
|
508
|
+
startCellRect: startCell === null || startCell === void 0 ? void 0 : startCell.getBoundingClientRect(),
|
|
509
|
+
isDragging: false,
|
|
510
|
+
};
|
|
511
|
+
window.addEventListener('pointermove', handlePointerMove);
|
|
512
|
+
window.addEventListener('pointerup', handlePointerUp);
|
|
513
|
+
}, [readOnly, minuteStep, handlePointerMove, handlePointerUp]);
|
|
514
|
+
const handleMouseDownMonthGridDate = useCallback((iso, e) => {
|
|
515
|
+
var _a;
|
|
516
|
+
if (readOnly)
|
|
517
|
+
return;
|
|
518
|
+
const startCell = (_a = e.target) === null || _a === void 0 ? void 0 : _a.closest(CELL_SELECTOR.date);
|
|
519
|
+
dragRef.current = {
|
|
520
|
+
kind: 'date',
|
|
521
|
+
startISO: iso,
|
|
522
|
+
startX: e.clientX,
|
|
523
|
+
startY: e.clientY,
|
|
524
|
+
startCellRect: startCell === null || startCell === void 0 ? void 0 : startCell.getBoundingClientRect(),
|
|
525
|
+
isDragging: false,
|
|
526
|
+
};
|
|
527
|
+
window.addEventListener('pointermove', handlePointerMove);
|
|
528
|
+
window.addEventListener('pointerup', handlePointerUp);
|
|
529
|
+
}, [readOnly, handlePointerMove, handlePointerUp]);
|
|
530
|
+
useEffect(() => {
|
|
531
|
+
if (currentDate)
|
|
532
|
+
setInternalDate(currentDate);
|
|
533
|
+
}, [currentDate]);
|
|
534
|
+
const sxViews = useMemo(() => views.map((v) => viewFactories[v]()), [views]);
|
|
535
|
+
const plugins = useMemo(() => {
|
|
536
|
+
const list = [
|
|
537
|
+
createEventsServicePlugin(),
|
|
538
|
+
createCurrentTimePlugin(),
|
|
539
|
+
];
|
|
540
|
+
if (!readOnly) {
|
|
541
|
+
list.push(createDragAndDropPlugin(minuteStep));
|
|
542
|
+
list.push(createResizePlugin(minuteStep));
|
|
543
|
+
}
|
|
544
|
+
return list;
|
|
545
|
+
}, [readOnly, minuteStep]);
|
|
546
|
+
const calendarApp = useNextCalendarApp({
|
|
547
|
+
calendars,
|
|
548
|
+
callbacks: {
|
|
549
|
+
// DnD + resize merge into one callback. Schedule-X already mutates
|
|
550
|
+
// the event's start/end before this fires, so we just forward.
|
|
551
|
+
onBeforeEventUpdate: (_old, next) => {
|
|
552
|
+
if (readOnly)
|
|
553
|
+
return false;
|
|
554
|
+
onEventUpdate === null || onEventUpdate === void 0 ? void 0 : onEventUpdate(next);
|
|
555
|
+
return true;
|
|
556
|
+
},
|
|
557
|
+
onClickDateTime: (iso) => {
|
|
558
|
+
// Suppress when the click trails a real drag — `onSlotRange`
|
|
559
|
+
// already fired with the dragged range, we don't want a stale
|
|
560
|
+
// single-slot create on top of it.
|
|
561
|
+
if (suppressNextClickRef.current) {
|
|
562
|
+
suppressNextClickRef.current = false;
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
565
|
+
// Snap to `minuteStep` so single-click creates align to the same
|
|
566
|
+
// grid as drag-creates. Schedule-X gives us the click time at
|
|
567
|
+
// 1-minute resolution.
|
|
568
|
+
onClickDateTime === null || onClickDateTime === void 0 ? void 0 : onClickDateTime(snapISO(iso, minuteStep));
|
|
569
|
+
},
|
|
570
|
+
onClickDate: (iso) => {
|
|
571
|
+
if (suppressNextClickRef.current) {
|
|
572
|
+
suppressNextClickRef.current = false;
|
|
573
|
+
return;
|
|
574
|
+
}
|
|
575
|
+
onClickDate === null || onClickDate === void 0 ? void 0 : onClickDate(iso);
|
|
576
|
+
},
|
|
577
|
+
onMouseDownDateTime: handleMouseDownDateTime,
|
|
578
|
+
onMouseDownMonthGridDate: handleMouseDownMonthGridDate,
|
|
579
|
+
onEventClick: (e) => {
|
|
580
|
+
onEventClick === null || onEventClick === void 0 ? void 0 : onEventClick(e);
|
|
581
|
+
},
|
|
582
|
+
onSelectedDateUpdate: (d) => {
|
|
583
|
+
const next = dayjs(d, D_FMT).toDate();
|
|
584
|
+
setInternalDate(next);
|
|
585
|
+
onDateChange === null || onDateChange === void 0 ? void 0 : onDateChange(next);
|
|
586
|
+
},
|
|
587
|
+
},
|
|
588
|
+
dayBoundaries,
|
|
589
|
+
defaultView: toSxView(view),
|
|
590
|
+
events,
|
|
591
|
+
firstDayOfWeek: firstDayOfWeek,
|
|
592
|
+
selectedDate: dayjs(internalDate).format(D_FMT),
|
|
593
|
+
views: sxViews,
|
|
594
|
+
}, plugins);
|
|
595
|
+
// ── External → Schedule-X sync ──────────────────────────────────────────
|
|
596
|
+
// Re-sync events when the consumer-supplied array identity changes.
|
|
597
|
+
useEffect(() => {
|
|
598
|
+
if (!calendarApp)
|
|
599
|
+
return;
|
|
600
|
+
calendarApp.events.set(events);
|
|
601
|
+
}, [events, calendarApp]);
|
|
602
|
+
// Push view changes from props down into Schedule-X.
|
|
603
|
+
useEffect(() => {
|
|
604
|
+
var _a, _b, _c;
|
|
605
|
+
if (!calendarApp)
|
|
606
|
+
return;
|
|
607
|
+
const target = toSxView(view);
|
|
608
|
+
// biome-ignore lint/suspicious/noExplicitAny: $app is private in TS but stable
|
|
609
|
+
const state = (_a = calendarApp.$app) === null || _a === void 0 ? void 0 : _a.calendarState;
|
|
610
|
+
if (((_b = state === null || state === void 0 ? void 0 : state.view) === null || _b === void 0 ? void 0 : _b.value) !== target) {
|
|
611
|
+
(_c = state === null || state === void 0 ? void 0 : state.setView) === null || _c === void 0 ? void 0 : _c.call(state, target, dayjs(internalDate).format(D_FMT));
|
|
612
|
+
}
|
|
613
|
+
}, [view, internalDate, calendarApp]);
|
|
614
|
+
// Push internalDate into SX's selectedDate signal so the toolbar's
|
|
615
|
+
// prev/next/today buttons drive the calendar grid.
|
|
616
|
+
useEffect(() => {
|
|
617
|
+
var _a, _b;
|
|
618
|
+
if (!calendarApp)
|
|
619
|
+
return;
|
|
620
|
+
const target = dayjs(internalDate).format(D_FMT);
|
|
621
|
+
// biome-ignore lint/suspicious/noExplicitAny: writing into a preact Signal
|
|
622
|
+
const sig = (_b = (_a = calendarApp.$app) === null || _a === void 0 ? void 0 : _a.datePickerState) === null || _b === void 0 ? void 0 : _b.selectedDate;
|
|
623
|
+
if (sig && sig.value !== target)
|
|
624
|
+
sig.value = target;
|
|
625
|
+
}, [internalDate, calendarApp]);
|
|
626
|
+
// ── Schedule-X → External sync ──────────────────────────────────────────
|
|
627
|
+
// Subscribe to view changes Schedule-X drives internally.
|
|
628
|
+
useEffect(() => {
|
|
629
|
+
var _a, _b;
|
|
630
|
+
if (!calendarApp)
|
|
631
|
+
return;
|
|
632
|
+
// biome-ignore lint/suspicious/noExplicitAny: preact signal has .subscribe
|
|
633
|
+
const signal = (_b = (_a = calendarApp.$app) === null || _a === void 0 ? void 0 : _a.calendarState) === null || _b === void 0 ? void 0 : _b.view;
|
|
634
|
+
if (typeof (signal === null || signal === void 0 ? void 0 : signal.subscribe) !== 'function')
|
|
635
|
+
return;
|
|
636
|
+
const unsub = signal.subscribe((v) => {
|
|
637
|
+
const mapped = fromSxView(v);
|
|
638
|
+
if (mapped && mapped !== view)
|
|
639
|
+
onViewChange(mapped);
|
|
640
|
+
});
|
|
641
|
+
return typeof unsub === 'function' ? unsub : undefined;
|
|
642
|
+
}, [calendarApp, onViewChange, view]);
|
|
643
|
+
// ── Default toolbar ─────────────────────────────────────────────────────
|
|
644
|
+
const shiftDate = (amount) => {
|
|
645
|
+
const unit = view === 'day' ? 'day' : view === 'week' ? 'week' : 'month';
|
|
646
|
+
const next = dayjs(internalDate).add(amount, unit).toDate();
|
|
647
|
+
setInternalDate(next);
|
|
648
|
+
onDateChange === null || onDateChange === void 0 ? void 0 : onDateChange(next);
|
|
649
|
+
};
|
|
650
|
+
const goToday = () => {
|
|
651
|
+
const next = new Date();
|
|
652
|
+
setInternalDate(next);
|
|
653
|
+
onDateChange === null || onDateChange === void 0 ? void 0 : onDateChange(next);
|
|
654
|
+
};
|
|
655
|
+
const dateLabel = useMemo(() => dayjs(internalDate).format(view === 'day' ? 'MMMM D, YYYY' : 'MMMM YYYY'), [internalDate, view]);
|
|
656
|
+
const defaultToolbar = (_jsxs(Group, { position: 'apart', style: {
|
|
657
|
+
borderBottom: `1px solid ${neutral[50]}`,
|
|
658
|
+
padding: spacing.sm,
|
|
659
|
+
}, children: [_jsxs(Group, { spacing: spacing.xs, children: [_jsx(Button, { onClick: goToday, size: 'sm', variant: 'secondary', children: "Today" }), _jsx(IconButton, { onClick: () => shiftDate(-1), size: 'sm', variant: 'secondary', children: _jsx(IconChevronLeft, {}) }), _jsx(IconButton, { onClick: () => shiftDate(1), size: 'sm', variant: 'secondary', children: _jsx(IconChevronRight, {}) }), _jsx(Title, { variant: 'cardHeader', children: dateLabel })] }), views.length > 1 && (_jsx(SegmentedControl, { data: views.map((v) => ({
|
|
660
|
+
label: v.charAt(0).toUpperCase() + v.slice(1),
|
|
661
|
+
value: v,
|
|
662
|
+
})), onChange: (v) => onViewChange(v), size: 'sm', value: view }))] }));
|
|
663
|
+
const resolvedToolbar = toolbar === null ? null : toolbar === undefined ? defaultToolbar : toolbar;
|
|
664
|
+
return (_jsxs("div", { className: 'taiv-calendar', children: [_jsx("style", { children: TAIV_CALENDAR_CSS }), resolvedToolbar, _jsx(ScheduleXCalendar, { calendarApp: calendarApp }), ghost && (_jsx("div", { "aria-hidden": true, className: 'taiv-cal-drag-ghost', style: {
|
|
665
|
+
left: ghost.left,
|
|
666
|
+
top: ghost.top,
|
|
667
|
+
width: ghost.width,
|
|
668
|
+
height: ghost.height,
|
|
669
|
+
} }))] }));
|
|
670
|
+
};
|
|
671
|
+
export { Calendar };
|