@flikk/ui 1.0.0-beta.2 → 1.0.0-beta.3
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/components/ai/ApprovalCard/ApprovalCard.js +2 -2
- package/dist/components/ai/ApprovalCard/ApprovalCard.types.d.ts +2 -2
- package/dist/components/ai/PromptInput/PromptInput.js +173 -13
- package/dist/components/ai/PromptInput/PromptInput.theme.js +1 -0
- package/dist/components/ai/PromptInput/PromptInput.types.d.ts +20 -0
- package/dist/components/core/Accordion/Accordion.theme.js +2 -2
- package/dist/components/core/Alert/Alert.js +2 -2
- package/dist/components/core/Alert/Alert.types.d.ts +2 -2
- package/dist/components/core/AlertDialog/AlertDialog.d.ts +1 -1
- package/dist/components/core/AlertDialog/AlertDialog.js +2 -2
- package/dist/components/core/AlertDialog/AlertDialog.types.d.ts +2 -2
- package/dist/components/core/Badge/Badge.js +11 -9
- package/dist/components/core/Badge/Badge.theme.js +13 -14
- package/dist/components/core/Badge/Badge.types.d.ts +6 -1
- package/dist/components/core/Button/Button.theme.js +8 -9
- package/dist/components/core/Calendar/Calendar.theme.js +1 -1
- package/dist/components/core/Card/Card.d.ts +2 -2
- package/dist/components/core/Card/Card.js +6 -7
- package/dist/components/core/Card/Card.theme.js +4 -4
- package/dist/components/core/Card/Card.types.d.ts +5 -20
- package/dist/components/core/Card/CardSubtitle.d.ts +3 -0
- package/dist/components/core/Card/CardSubtitle.js +11 -0
- package/dist/components/core/Card/index.d.ts +2 -2
- package/dist/components/core/CommandPalette/CommandItem.d.ts +1 -1
- package/dist/components/core/CommandPalette/CommandItem.js +2 -2
- package/dist/components/core/CommandPalette/CommandPalette.js +2 -2
- package/dist/components/core/CommandPalette/CommandPalette.theme.js +2 -2
- package/dist/components/core/CommandPalette/CommandPalette.types.d.ts +2 -2
- package/dist/components/core/ContextMenu/ContextMenu.types.d.ts +1 -1
- package/dist/components/core/ContextMenu/ContextMenuItem.js +2 -2
- package/dist/components/core/Drawer/Drawer.d.ts +13 -1
- package/dist/components/core/Drawer/Drawer.js +23 -10
- package/dist/components/core/Drawer/Drawer.theme.js +1 -1
- package/dist/components/core/Drawer/Drawer.types.d.ts +21 -4
- package/dist/components/core/Drawer/DrawerHeader.d.ts +5 -0
- package/dist/components/core/Drawer/DrawerHeader.js +14 -0
- package/dist/components/core/Drawer/DrawerSubtitle.d.ts +5 -0
- package/dist/components/core/Drawer/DrawerSubtitle.js +11 -0
- package/dist/components/core/Drawer/DrawerTitle.d.ts +5 -0
- package/dist/components/core/Drawer/DrawerTitle.js +11 -0
- package/dist/components/core/Drawer/index.d.ts +1 -1
- package/dist/components/core/Dropdown/Dropdown.types.d.ts +4 -4
- package/dist/components/core/Dropdown/DropdownItem.js +2 -2
- package/dist/components/core/Empty/Empty.js +2 -2
- package/dist/components/core/Empty/Empty.theme.d.ts +1 -1
- package/dist/components/core/Empty/Empty.theme.js +3 -3
- package/dist/components/core/Empty/Empty.types.d.ts +2 -2
- package/dist/components/core/MenuItem/MenuItem.js +2 -2
- package/dist/components/core/MenuItem/MenuItem.theme.d.ts +1 -2
- package/dist/components/core/MenuItem/MenuItem.theme.js +7 -9
- package/dist/components/core/MenuItem/MenuItem.types.d.ts +1 -1
- package/dist/components/core/Message/Message.d.ts +3 -2
- package/dist/components/core/Message/Message.js +30 -24
- package/dist/components/core/Message/Message.theme.d.ts +1 -1
- package/dist/components/core/Message/Message.theme.js +22 -24
- package/dist/components/core/Message/Message.types.d.ts +0 -7
- package/dist/components/core/Message/MessageList.animations.d.ts +6 -0
- package/dist/components/core/Message/MessageList.animations.js +32 -0
- package/dist/components/core/Message/MessageList.d.ts +5 -0
- package/dist/components/core/Message/MessageList.js +78 -0
- package/dist/components/core/Message/MessageList.theme.d.ts +2 -0
- package/dist/components/core/Message/MessageList.theme.js +6 -0
- package/dist/components/core/Message/MessageList.types.d.ts +32 -0
- package/dist/components/core/Message/index.d.ts +2 -0
- package/dist/components/core/Modal/Modal.d.ts +2 -2
- package/dist/components/core/Modal/Modal.js +5 -5
- package/dist/components/core/Modal/Modal.theme.js +5 -5
- package/dist/components/core/Modal/Modal.types.d.ts +4 -4
- package/dist/components/core/Modal/ModalSubtitle.d.ts +5 -0
- package/dist/components/core/Modal/ModalSubtitle.js +11 -0
- package/dist/components/core/ModalStack/ModalStack.animations.js +3 -3
- package/dist/components/core/ModalStack/ModalStackModal.js +3 -3
- package/dist/components/core/PageHeading/PageHeading.d.ts +8 -0
- package/dist/components/core/PageHeading/PageHeading.js +28 -0
- package/dist/components/core/PageHeading/PageHeading.theme.d.ts +2 -0
- package/dist/components/core/PageHeading/PageHeading.theme.js +11 -0
- package/dist/components/core/PageHeading/PageHeading.types.d.ts +55 -0
- package/dist/components/core/PageHeading/PageHeadingActions.d.ts +3 -0
- package/dist/components/core/PageHeading/PageHeadingActions.js +11 -0
- package/dist/components/core/PageHeading/PageHeadingBackButton.d.ts +3 -0
- package/dist/components/core/PageHeading/PageHeadingBackButton.js +12 -0
- package/dist/components/core/PageHeading/PageHeadingIcon.d.ts +3 -0
- package/dist/components/core/PageHeading/PageHeadingIcon.js +11 -0
- package/dist/components/core/PageHeading/PageHeadingSubtitle.d.ts +3 -0
- package/dist/components/core/PageHeading/PageHeadingSubtitle.js +11 -0
- package/dist/components/core/PageHeading/PageHeadingTitle.d.ts +3 -0
- package/dist/components/core/PageHeading/PageHeadingTitle.js +11 -0
- package/dist/components/core/PageHeading/index.d.ts +2 -0
- package/dist/components/core/Popover/Popover.theme.js +1 -1
- package/dist/components/core/Segmented/Segmented.theme.js +3 -3
- package/dist/components/core/Sidebar/Sidebar.js +1 -0
- package/dist/components/core/SocialIcon/SocialIcon.d.ts +3 -0
- package/dist/components/core/SocialIcon/SocialIcon.js +30 -0
- package/dist/components/core/SocialIcon/SocialIcon.theme.d.ts +2 -0
- package/dist/components/core/SocialIcon/SocialIcon.theme.js +12 -0
- package/dist/components/core/SocialIcon/SocialIcon.types.d.ts +18 -0
- package/dist/components/core/SocialIcon/index.d.ts +2 -0
- package/dist/components/core/SocialIcon/platforms.d.ts +17 -0
- package/dist/components/core/SocialIcon/platforms.js +234 -0
- package/dist/components/core/Toast/Toast.js +4 -4
- package/dist/components/core/Toast/Toast.theme.js +1 -1
- package/dist/components/core/Toast/Toast.types.d.ts +9 -9
- package/dist/components/core/Toast/useToast.js +6 -6
- package/dist/components/core/index.d.ts +2 -7
- package/dist/components/core/index.js +9 -19
- package/dist/components/{core → data-display}/DescriptionList/DescriptionList.theme.js +1 -1
- package/dist/components/{core → data-display}/Feed/Feed.js +2 -2
- package/dist/components/data-display/GanttChart/GanttChart.animations.d.ts +4 -0
- package/dist/components/data-display/GanttChart/GanttChart.animations.js +21 -0
- package/dist/components/data-display/GanttChart/GanttChart.d.ts +8 -0
- package/dist/components/data-display/GanttChart/GanttChart.js +170 -0
- package/dist/components/data-display/GanttChart/GanttChart.theme.d.ts +2 -0
- package/dist/components/data-display/GanttChart/GanttChart.theme.js +23 -0
- package/dist/components/data-display/GanttChart/GanttChart.types.d.ts +162 -0
- package/dist/components/data-display/GanttChart/GanttChart.types.js +9 -0
- package/dist/components/data-display/GanttChart/GanttChart.utils.d.ts +80 -0
- package/dist/components/data-display/GanttChart/GanttChart.utils.js +274 -0
- package/dist/components/data-display/GanttChart/GanttChartPanel.d.ts +9 -0
- package/dist/components/data-display/GanttChart/GanttChartPanel.js +82 -0
- package/dist/components/data-display/GanttChart/GanttDependencyArrows.d.ts +2 -0
- package/dist/components/data-display/GanttChart/GanttDependencyArrows.js +35 -0
- package/dist/components/data-display/GanttChart/GanttGroupBar.d.ts +8 -0
- package/dist/components/data-display/GanttChart/GanttGroupBar.js +26 -0
- package/dist/components/data-display/GanttChart/GanttMilestone.d.ts +9 -0
- package/dist/components/data-display/GanttChart/GanttMilestone.js +44 -0
- package/dist/components/data-display/GanttChart/GanttProgressCircle.d.ts +9 -0
- package/dist/components/data-display/GanttChart/GanttProgressCircle.js +11 -0
- package/dist/components/data-display/GanttChart/GanttSplitter.d.ts +2 -0
- package/dist/components/data-display/GanttChart/GanttSplitter.js +39 -0
- package/dist/components/data-display/GanttChart/GanttTableGroupRow.d.ts +7 -0
- package/dist/components/data-display/GanttChart/GanttTableGroupRow.js +23 -0
- package/dist/components/data-display/GanttChart/GanttTableHeader.d.ts +2 -0
- package/dist/components/data-display/GanttChart/GanttTableHeader.js +13 -0
- package/dist/components/data-display/GanttChart/GanttTablePanel.d.ts +6 -0
- package/dist/components/data-display/GanttChart/GanttTablePanel.js +20 -0
- package/dist/components/data-display/GanttChart/GanttTableTaskRow.d.ts +8 -0
- package/dist/components/data-display/GanttChart/GanttTableTaskRow.js +30 -0
- package/dist/components/data-display/GanttChart/GanttTaskBar.d.ts +9 -0
- package/dist/components/data-display/GanttChart/GanttTaskBar.js +206 -0
- package/dist/components/data-display/GanttChart/GanttTaskContextMenu.d.ts +8 -0
- package/dist/components/data-display/GanttChart/GanttTaskContextMenu.js +17 -0
- package/dist/components/data-display/GanttChart/GanttTimelineGrid.d.ts +7 -0
- package/dist/components/data-display/GanttChart/GanttTimelineGrid.js +33 -0
- package/dist/components/data-display/GanttChart/GanttTimelineHeader.d.ts +8 -0
- package/dist/components/data-display/GanttChart/GanttTimelineHeader.js +43 -0
- package/dist/components/data-display/GanttChart/GanttToolbar.d.ts +2 -0
- package/dist/components/data-display/GanttChart/GanttToolbar.js +28 -0
- package/dist/components/data-display/GanttChart/hooks/useGanttDates.d.ts +12 -0
- package/dist/components/data-display/GanttChart/hooks/useGanttDates.js +25 -0
- package/dist/components/data-display/GanttChart/hooks/useGanttDrag.d.ts +25 -0
- package/dist/components/data-display/GanttChart/hooks/useGanttDrag.js +144 -0
- package/dist/components/data-display/GanttChart/hooks/useGanttLayout.d.ts +2 -0
- package/dist/components/data-display/GanttChart/hooks/useGanttLayout.js +33 -0
- package/dist/components/data-display/GanttChart/hooks/useGanttScrollSync.d.ts +6 -0
- package/dist/components/data-display/GanttChart/hooks/useGanttScrollSync.js +32 -0
- package/dist/components/data-display/GanttChart/index.d.ts +3 -0
- package/dist/components/{core → data-display}/KPI/KPI.js +10 -8
- package/dist/components/{core → data-display}/KPI/KPI.theme.js +2 -1
- package/dist/components/{core → data-display}/KPI/KPI.types.d.ts +5 -5
- package/dist/components/{core → data-display}/KPI/index.d.ts +1 -0
- package/dist/components/{core → data-display}/Metric/Metric.js +4 -7
- package/dist/components/{core → data-display}/Metric/Metric.theme.js +9 -9
- package/dist/components/{core → data-display}/Metric/Metric.types.d.ts +6 -6
- package/dist/components/{core → data-display}/Table/Table.theme.js +2 -2
- package/dist/components/{core → data-display}/Table/TableActions.js +8 -8
- package/dist/components/{core → data-display}/Table/TableColumnManager.js +4 -4
- package/dist/components/{core → data-display}/Table/TableFilter.js +3 -3
- package/dist/components/data-display/Table/TablePagination.js +25 -0
- package/dist/components/{core → data-display}/Table/TableRow.js +1 -1
- package/dist/components/{core → data-display}/Table/TableSelectionHeader.js +1 -1
- package/dist/components/data-display/index.d.ts +7 -0
- package/dist/components/data-display/index.js +20 -0
- package/dist/components/effects/Aurora/Aurora.d.ts +24 -0
- package/dist/components/effects/Aurora/Aurora.js +119 -0
- package/dist/components/effects/Aurora/Aurora.types.d.ts +15 -0
- package/dist/components/effects/Aurora/index.d.ts +2 -0
- package/dist/components/effects/DotPattern/DotPattern.d.ts +18 -0
- package/dist/components/effects/DotPattern/DotPattern.js +65 -0
- package/dist/components/effects/DotPattern/DotPattern.types.d.ts +47 -0
- package/dist/components/effects/DotPattern/index.d.ts +2 -0
- package/dist/components/effects/GridPattern/GridPattern.d.ts +18 -0
- package/dist/components/effects/GridPattern/GridPattern.js +64 -0
- package/dist/components/effects/GridPattern/GridPattern.types.d.ts +47 -0
- package/dist/components/effects/GridPattern/index.d.ts +2 -0
- package/dist/components/effects/MagneticElement/MagneticElement.d.ts +30 -0
- package/dist/components/effects/MagneticElement/MagneticElement.js +110 -0
- package/dist/components/effects/MagneticElement/MagneticElement.types.d.ts +44 -0
- package/dist/components/effects/MagneticElement/index.d.ts +2 -0
- package/dist/components/effects/MorphingText/MorphingText.d.ts +17 -0
- package/dist/components/effects/MorphingText/MorphingText.js +91 -0
- package/dist/components/effects/MorphingText/MorphingText.types.d.ts +18 -0
- package/dist/components/effects/MorphingText/index.d.ts +2 -0
- package/dist/components/effects/NoiseOverlay/NoiseOverlay.d.ts +28 -0
- package/dist/components/effects/NoiseOverlay/NoiseOverlay.js +61 -0
- package/dist/components/effects/NoiseOverlay/NoiseOverlay.types.d.ts +35 -0
- package/dist/components/effects/NoiseOverlay/index.d.ts +2 -0
- package/dist/components/effects/ParallaxSection/ParallaxSection.d.ts +26 -0
- package/dist/components/effects/ParallaxSection/ParallaxSection.js +71 -0
- package/dist/components/effects/ParallaxSection/ParallaxSection.types.d.ts +11 -0
- package/dist/components/effects/ParallaxSection/index.d.ts +2 -0
- package/dist/components/effects/Particles/Particles.d.ts +22 -0
- package/dist/components/effects/Particles/Particles.js +33 -0
- package/dist/components/effects/Particles/Particles.scene.d.ts +3 -0
- package/dist/components/effects/Particles/Particles.scene.js +284 -0
- package/dist/components/effects/Particles/Particles.types.d.ts +65 -0
- package/dist/components/effects/Particles/index.d.ts +2 -0
- package/dist/components/effects/ProgressiveBlur/ProgressiveBlur.d.ts +3 -0
- package/dist/components/effects/ProgressiveBlur/ProgressiveBlur.js +75 -0
- package/dist/components/effects/ProgressiveBlur/ProgressiveBlur.theme.d.ts +7 -0
- package/dist/components/effects/ProgressiveBlur/ProgressiveBlur.theme.js +12 -0
- package/dist/components/effects/ProgressiveBlur/ProgressiveBlur.types.d.ts +47 -0
- package/dist/components/effects/ProgressiveBlur/index.d.ts +2 -0
- package/dist/components/effects/ScrollReveal/ScrollReveal.d.ts +29 -0
- package/dist/components/effects/ScrollReveal/ScrollReveal.js +121 -0
- package/dist/components/effects/ScrollReveal/ScrollReveal.types.d.ts +25 -0
- package/dist/components/effects/ScrollReveal/index.d.ts +2 -0
- package/dist/components/effects/Spotlight/Spotlight.d.ts +36 -0
- package/dist/components/effects/Spotlight/Spotlight.js +112 -0
- package/dist/components/effects/Spotlight/Spotlight.types.d.ts +29 -0
- package/dist/components/effects/Spotlight/index.d.ts +2 -0
- package/dist/components/effects/StickyScroll/StickyScroll.d.ts +30 -0
- package/dist/components/effects/StickyScroll/StickyScroll.js +128 -0
- package/dist/components/effects/StickyScroll/StickyScroll.types.d.ts +19 -0
- package/dist/components/effects/StickyScroll/index.d.ts +2 -0
- package/dist/components/effects/index.d.ts +24 -0
- package/dist/components/effects/index.js +12 -0
- package/dist/components/forms/Checkbox/Checkbox.js +3 -3
- package/dist/components/forms/Checkbox/Checkbox.theme.js +3 -5
- package/dist/components/forms/ColorPicker/ColorPicker.theme.js +2 -2
- package/dist/components/forms/CronInput/CronInput.d.ts +3 -0
- package/dist/components/forms/CronInput/CronInput.js +107 -0
- package/dist/components/forms/CronInput/CronInput.theme.d.ts +6 -0
- package/dist/components/forms/CronInput/CronInput.theme.js +84 -0
- package/dist/components/forms/CronInput/CronInput.types.d.ts +98 -0
- package/dist/components/forms/CronInput/CronInput.utils.d.ts +67 -0
- package/dist/components/forms/CronInput/CronInput.utils.js +505 -0
- package/dist/components/forms/CronInput/index.d.ts +4 -0
- package/dist/components/forms/DatePicker/DatePicker.theme.js +2 -2
- package/dist/components/forms/FileUpload/FileUpload.js +78 -0
- package/dist/components/forms/InputOTP/InputOTP.theme.js +1 -1
- package/dist/components/forms/Mention/Mention.d.ts +3 -0
- package/dist/components/forms/Mention/Mention.js +410 -0
- package/dist/components/forms/Mention/Mention.theme.d.ts +6 -0
- package/dist/components/forms/Mention/Mention.theme.js +56 -0
- package/dist/components/forms/Mention/Mention.types.d.ts +111 -0
- package/dist/components/forms/Mention/index.d.ts +3 -0
- package/dist/components/forms/Radio/Radio.js +8 -12
- package/dist/components/forms/Radio/Radio.theme.js +28 -5
- package/dist/components/forms/SelectableCard/SelectableCard.animations.d.ts +2 -0
- package/dist/components/forms/SelectableCard/SelectableCard.animations.js +9 -0
- package/dist/components/forms/SelectableCard/SelectableCard.d.ts +5 -0
- package/dist/components/forms/SelectableCard/SelectableCard.js +58 -0
- package/dist/components/forms/SelectableCard/SelectableCard.theme.d.ts +2 -0
- package/dist/components/forms/SelectableCard/SelectableCard.theme.js +38 -0
- package/dist/components/forms/SelectableCard/SelectableCard.types.d.ts +34 -0
- package/dist/components/forms/SelectableCard/SelectableCardContext.d.ts +3 -0
- package/dist/components/forms/SelectableCard/SelectableCardContext.js +12 -0
- package/dist/components/forms/SelectableCard/SelectableCardGroup.d.ts +3 -0
- package/dist/components/forms/SelectableCard/SelectableCardGroup.js +37 -0
- package/dist/components/forms/SelectableCard/index.d.ts +3 -0
- package/dist/components/forms/TimePicker/TimePickerContent.js +78 -1
- package/dist/components/forms/TransferList/TransferList.animations.d.ts +10 -0
- package/dist/components/forms/TransferList/TransferList.animations.js +32 -0
- package/dist/components/forms/TransferList/TransferList.d.ts +28 -0
- package/dist/components/forms/TransferList/TransferList.js +199 -0
- package/dist/components/forms/TransferList/TransferList.theme.d.ts +6 -0
- package/dist/components/forms/TransferList/TransferList.theme.js +60 -0
- package/dist/components/forms/TransferList/TransferList.types.d.ts +101 -0
- package/dist/components/forms/TransferList/index.d.ts +3 -0
- package/dist/components/forms/index.d.ts +13 -0
- package/dist/components/forms/index.js +87 -0
- package/dist/components/layout/FormLayout/FormLayout.d.ts +8 -0
- package/dist/components/layout/FormLayout/FormLayout.js +22 -0
- package/dist/components/layout/FormLayout/FormLayout.theme.d.ts +2 -0
- package/dist/components/layout/FormLayout/FormLayout.theme.js +16 -0
- package/dist/components/layout/FormLayout/FormLayout.types.d.ts +61 -0
- package/dist/components/layout/FormLayout/FormLayoutBody.d.ts +3 -0
- package/dist/components/layout/FormLayout/FormLayoutBody.js +91 -0
- package/dist/components/layout/FormLayout/FormLayoutFooter.d.ts +3 -0
- package/dist/components/layout/FormLayout/FormLayoutFooter.js +12 -0
- package/dist/components/layout/FormLayout/FormLayoutHeader.d.ts +3 -0
- package/dist/components/layout/FormLayout/FormLayoutHeader.js +12 -0
- package/dist/components/layout/FormLayout/FormLayoutSection.d.ts +3 -0
- package/dist/components/layout/FormLayout/FormLayoutSection.js +12 -0
- package/dist/components/layout/FormLayout/index.d.ts +3 -0
- package/dist/components/layout/PageLayout/PageLayout.d.ts +7 -0
- package/dist/components/layout/PageLayout/PageLayout.js +33 -0
- package/dist/components/layout/PageLayout/PageLayout.theme.d.ts +2 -0
- package/dist/components/layout/PageLayout/PageLayout.theme.js +10 -0
- package/dist/components/layout/PageLayout/PageLayout.types.d.ts +39 -0
- package/dist/components/layout/PageLayout/PageLayoutContent.d.ts +3 -0
- package/dist/components/layout/PageLayout/PageLayoutContent.js +12 -0
- package/dist/components/layout/PageLayout/PageLayoutHeader.d.ts +3 -0
- package/dist/components/layout/PageLayout/PageLayoutHeader.js +12 -0
- package/dist/components/layout/PageLayout/PageLayoutSidebar.d.ts +3 -0
- package/dist/components/layout/PageLayout/PageLayoutSidebar.js +12 -0
- package/dist/components/layout/PageLayout/index.d.ts +3 -0
- package/dist/components/layout/index.d.ts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +208 -167
- package/dist/styles.css +1 -1
- package/dist/utils/dateUtils.d.ts +30 -0
- package/dist/utils/dateUtils.js +58 -1
- package/dist/utils/index.d.ts +1 -1
- package/package.json +5 -1
- package/dist/components/core/Card/CardDescription.d.ts +0 -3
- package/dist/components/core/Card/CardDescription.js +0 -11
- package/dist/components/core/Modal/ModalDescription.d.ts +0 -5
- package/dist/components/core/Modal/ModalDescription.js +0 -11
- package/dist/components/core/ProgressiveBlur/ProgressiveBlur.d.ts +0 -34
- package/dist/components/core/ProgressiveBlur/ProgressiveBlur.js +0 -218
- package/dist/components/core/ProgressiveBlur/ProgressiveBlur.theme.d.ts +0 -9
- package/dist/components/core/ProgressiveBlur/ProgressiveBlur.types.d.ts +0 -48
- package/dist/components/core/ProgressiveBlur/index.d.ts +0 -2
- package/dist/components/core/Table/TablePagination.js +0 -25
- /package/dist/components/{core → data-display}/DescriptionList/DescriptionList.d.ts +0 -0
- /package/dist/components/{core → data-display}/DescriptionList/DescriptionList.js +0 -0
- /package/dist/components/{core → data-display}/DescriptionList/DescriptionList.theme.d.ts +0 -0
- /package/dist/components/{core → data-display}/DescriptionList/DescriptionList.types.d.ts +0 -0
- /package/dist/components/{core → data-display}/DescriptionList/index.d.ts +0 -0
- /package/dist/components/{core → data-display}/Feed/Feed.d.ts +0 -0
- /package/dist/components/{core → data-display}/Feed/Feed.theme.d.ts +0 -0
- /package/dist/components/{core → data-display}/Feed/Feed.theme.js +0 -0
- /package/dist/components/{core → data-display}/Feed/Feed.types.d.ts +0 -0
- /package/dist/components/{core → data-display}/Feed/index.d.ts +0 -0
- /package/dist/components/{core → data-display}/KPI/KPI.d.ts +0 -0
- /package/dist/components/{core → data-display}/KPI/KPI.theme.d.ts +0 -0
- /package/dist/components/{core → data-display}/Metric/Metric.d.ts +0 -0
- /package/dist/components/{core → data-display}/Metric/Metric.theme.d.ts +0 -0
- /package/dist/components/{core → data-display}/Metric/index.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/Table.animations.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/Table.animations.js +0 -0
- /package/dist/components/{core → data-display}/Table/Table.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/Table.filterUtils.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/Table.filterUtils.js +0 -0
- /package/dist/components/{core → data-display}/Table/Table.js +0 -0
- /package/dist/components/{core → data-display}/Table/Table.theme.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/Table.types.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/Table.utils.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/Table.utils.js +0 -0
- /package/dist/components/{core → data-display}/Table/TableActions.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/TableActionsMenu.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/TableActionsMenu.js +0 -0
- /package/dist/components/{core → data-display}/Table/TableBody.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/TableBody.js +0 -0
- /package/dist/components/{core → data-display}/Table/TableCell.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/TableCell.js +0 -0
- /package/dist/components/{core → data-display}/Table/TableColumnManager.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/TableDeclarative.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/TableDeclarative.js +0 -0
- /package/dist/components/{core → data-display}/Table/TableFilter.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/TableHeader.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/TableHeader.js +0 -0
- /package/dist/components/{core → data-display}/Table/TablePagination.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/TableRow.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/TableSelectionHeader.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/hooks/index.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/hooks/useTableColumns.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/hooks/useTableColumns.js +0 -0
- /package/dist/components/{core → data-display}/Table/hooks/useTableExpansion.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/hooks/useTableExpansion.js +0 -0
- /package/dist/components/{core → data-display}/Table/hooks/useTableFilter.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/hooks/useTableFilter.js +0 -0
- /package/dist/components/{core → data-display}/Table/hooks/useTablePagination.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/hooks/useTablePagination.js +0 -0
- /package/dist/components/{core → data-display}/Table/hooks/useTableSelection.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/hooks/useTableSelection.js +0 -0
- /package/dist/components/{core → data-display}/Table/index.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/index.js +0 -0
- /package/dist/components/{core → data-display}/Timeline/Timeline.animations.d.ts +0 -0
- /package/dist/components/{core → data-display}/Timeline/Timeline.animations.js +0 -0
- /package/dist/components/{core → data-display}/Timeline/Timeline.d.ts +0 -0
- /package/dist/components/{core → data-display}/Timeline/Timeline.js +0 -0
- /package/dist/components/{core → data-display}/Timeline/Timeline.theme.d.ts +0 -0
- /package/dist/components/{core → data-display}/Timeline/Timeline.theme.js +0 -0
- /package/dist/components/{core → data-display}/Timeline/Timeline.types.d.ts +0 -0
- /package/dist/components/{core → data-display}/Timeline/TimelineContent.d.ts +0 -0
- /package/dist/components/{core → data-display}/Timeline/TimelineContent.js +0 -0
- /package/dist/components/{core → data-display}/Timeline/TimelineItem.d.ts +0 -0
- /package/dist/components/{core → data-display}/Timeline/TimelineItem.js +0 -0
- /package/dist/components/{core → data-display}/Timeline/TimelineMarker.d.ts +0 -0
- /package/dist/components/{core → data-display}/Timeline/TimelineMarker.js +0 -0
- /package/dist/components/{core → data-display}/Timeline/index.d.ts +0 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
import { cn } from '../../../utils/cn.js';
|
|
4
|
+
import { useGanttContext, useGanttInteraction } from './GanttChart.js';
|
|
5
|
+
import { GanttTaskContextMenu } from './GanttTaskContextMenu.js';
|
|
6
|
+
|
|
7
|
+
function getCellValue(task, group, column) {
|
|
8
|
+
if (column.cell) {
|
|
9
|
+
return column.cell(task, group);
|
|
10
|
+
}
|
|
11
|
+
const raw = typeof column.accessor === "function"
|
|
12
|
+
? column.accessor(task)
|
|
13
|
+
: task[column.accessor];
|
|
14
|
+
return raw != null ? String(raw) : "";
|
|
15
|
+
}
|
|
16
|
+
const GanttTableTaskRow = React__default.memo(({ task, group, }) => {
|
|
17
|
+
const { theme, columns, rowHeight, onTaskClick } = useGanttContext();
|
|
18
|
+
const { focusedTaskId } = useGanttInteraction();
|
|
19
|
+
return (jsx(GanttTaskContextMenu, { task: task, children: jsx("div", { className: cn(theme.tableTaskRowStyle, "group", onTaskClick && "cursor-pointer", focusedTaskId === task.id && "bg-[var(--color-primary)]/5"), style: { height: rowHeight }, onClick: onTaskClick ? (e) => onTaskClick(task, e) : undefined, onKeyDown: onTaskClick ? (e) => {
|
|
20
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
21
|
+
e.preventDefault();
|
|
22
|
+
onTaskClick(task, e);
|
|
23
|
+
}
|
|
24
|
+
} : undefined, role: onTaskClick ? "button" : "row", tabIndex: onTaskClick ? 0 : undefined, "aria-label": task.title, children: columns.map((col) => {
|
|
25
|
+
var _a;
|
|
26
|
+
return (jsx("div", { className: cn(theme.tableCellStyle, "flex items-center", col.align === "center" && "justify-center", col.align === "right" && "justify-end"), style: { width: (_a = col.width) !== null && _a !== void 0 ? _a : 120 }, children: getCellValue(task, group, col) }, col.id));
|
|
27
|
+
}) }) }));
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export { GanttTableTaskRow };
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import React__default, { useState, useCallback, useMemo } from 'react';
|
|
3
|
+
import { motion } from 'motion/react';
|
|
4
|
+
import { cn } from '../../../utils/cn.js';
|
|
5
|
+
import { useGanttContext, useGanttInteraction } from './GanttChart.js';
|
|
6
|
+
import { getDayOffset, calculateExpectedProgress, formatDateShort, formatDuration } from './GanttChart.utils.js';
|
|
7
|
+
import { ChartTooltip } from '../../charts/shared/ChartTooltip/ChartTooltip.js';
|
|
8
|
+
import { Avatar } from '../../core/Avatar/Avatar.js';
|
|
9
|
+
import { GanttTaskContextMenu } from './GanttTaskContextMenu.js';
|
|
10
|
+
import { taskBarVariants } from './GanttChart.animations.js';
|
|
11
|
+
import { useGanttDrag } from './hooks/useGanttDrag.js';
|
|
12
|
+
import { getDaysBetween, addDays, toDate } from '../../../utils/dateUtils.js';
|
|
13
|
+
|
|
14
|
+
const GanttTaskBar = React__default.memo(({ task, group, top, }) => {
|
|
15
|
+
var _a;
|
|
16
|
+
const { theme, dayWidth, rangeStart, rowHeight, readonly, readonlyDates, readonlyProgress, onTaskUpdate, onTaskClick, tasks, } = useGanttContext();
|
|
17
|
+
const { hoveredTaskId, setHoveredTaskId, focusedTaskId, setActiveDrag, } = useGanttInteraction();
|
|
18
|
+
const [tooltipPos, setTooltipPos] = useState(null);
|
|
19
|
+
const offset = getDayOffset(task.startDate, rangeStart);
|
|
20
|
+
const span = getDaysBetween(task.startDate, task.endDate);
|
|
21
|
+
const left = offset * dayWidth;
|
|
22
|
+
const width = Math.max(span * dayWidth, dayWidth);
|
|
23
|
+
const barColor = (_a = task.color) !== null && _a !== void 0 ? _a : group.color;
|
|
24
|
+
const barHeight = rowHeight - 8;
|
|
25
|
+
const canDragDates = !readonly && !readonlyDates && !!onTaskUpdate;
|
|
26
|
+
const canDragProgress = !readonly && !readonlyProgress && !!onTaskUpdate;
|
|
27
|
+
const expectedProgress = calculateExpectedProgress(task.startDate, task.endDate);
|
|
28
|
+
const isBehindSchedule = !task.completed && task.progress < expectedProgress;
|
|
29
|
+
// ----- Drag: Move -----
|
|
30
|
+
const handleMoveDragEnd = useCallback((result) => {
|
|
31
|
+
if (!onTaskUpdate || result.daysDelta === 0)
|
|
32
|
+
return;
|
|
33
|
+
const newStart = addDays(task.startDate, result.daysDelta);
|
|
34
|
+
const newEnd = addDays(task.endDate, result.daysDelta);
|
|
35
|
+
onTaskUpdate(task.id, {
|
|
36
|
+
startDate: newStart,
|
|
37
|
+
endDate: newEnd,
|
|
38
|
+
});
|
|
39
|
+
}, [onTaskUpdate, task.id, task.startDate, task.endDate]);
|
|
40
|
+
const moveDrag = useGanttDrag({
|
|
41
|
+
dayWidth,
|
|
42
|
+
mode: "move",
|
|
43
|
+
barWidthPx: width,
|
|
44
|
+
originalProgress: task.progress,
|
|
45
|
+
disabled: !canDragDates,
|
|
46
|
+
onDragEnd: handleMoveDragEnd,
|
|
47
|
+
onDragStateChange: useCallback((isDragging, deltaX) => {
|
|
48
|
+
setActiveDrag(isDragging ? { taskId: task.id, mode: "move", deltaX } : null);
|
|
49
|
+
}, [setActiveDrag, task.id]),
|
|
50
|
+
});
|
|
51
|
+
// ----- Drag: Resize left -----
|
|
52
|
+
const handleResizeLeftEnd = useCallback((result) => {
|
|
53
|
+
if (!onTaskUpdate || result.daysDelta === 0)
|
|
54
|
+
return;
|
|
55
|
+
const newStart = addDays(task.startDate, result.daysDelta);
|
|
56
|
+
// Ensure start doesn't go past end
|
|
57
|
+
if (toDate(newStart).getTime() >= toDate(task.endDate).getTime())
|
|
58
|
+
return;
|
|
59
|
+
onTaskUpdate(task.id, { startDate: newStart });
|
|
60
|
+
}, [onTaskUpdate, task.id, task.startDate, task.endDate]);
|
|
61
|
+
const resizeLeftDrag = useGanttDrag({
|
|
62
|
+
dayWidth,
|
|
63
|
+
mode: "resize-left",
|
|
64
|
+
barWidthPx: width,
|
|
65
|
+
originalProgress: task.progress,
|
|
66
|
+
disabled: !canDragDates,
|
|
67
|
+
onDragEnd: handleResizeLeftEnd,
|
|
68
|
+
onDragStateChange: useCallback((isDragging, deltaX) => {
|
|
69
|
+
setActiveDrag(isDragging ? { taskId: task.id, mode: "resize-left", deltaX } : null);
|
|
70
|
+
}, [setActiveDrag, task.id]),
|
|
71
|
+
});
|
|
72
|
+
// ----- Drag: Resize right -----
|
|
73
|
+
const handleResizeRightEnd = useCallback((result) => {
|
|
74
|
+
if (!onTaskUpdate || result.daysDelta === 0)
|
|
75
|
+
return;
|
|
76
|
+
const newEnd = addDays(task.endDate, result.daysDelta);
|
|
77
|
+
// Ensure end doesn't go before start
|
|
78
|
+
if (toDate(newEnd).getTime() <= toDate(task.startDate).getTime())
|
|
79
|
+
return;
|
|
80
|
+
onTaskUpdate(task.id, { endDate: newEnd });
|
|
81
|
+
}, [onTaskUpdate, task.id, task.startDate, task.endDate]);
|
|
82
|
+
const resizeRightDrag = useGanttDrag({
|
|
83
|
+
dayWidth,
|
|
84
|
+
mode: "resize-right",
|
|
85
|
+
barWidthPx: width,
|
|
86
|
+
originalProgress: task.progress,
|
|
87
|
+
disabled: !canDragDates,
|
|
88
|
+
onDragEnd: handleResizeRightEnd,
|
|
89
|
+
onDragStateChange: useCallback((isDragging, deltaX) => {
|
|
90
|
+
setActiveDrag(isDragging ? { taskId: task.id, mode: "resize-right", deltaX } : null);
|
|
91
|
+
}, [setActiveDrag, task.id]),
|
|
92
|
+
});
|
|
93
|
+
// ----- Drag: Progress -----
|
|
94
|
+
const handleProgressDragEnd = useCallback((result) => {
|
|
95
|
+
if (!onTaskUpdate)
|
|
96
|
+
return;
|
|
97
|
+
onTaskUpdate(task.id, {
|
|
98
|
+
progress: result.newProgress,
|
|
99
|
+
completed: result.newProgress === 100,
|
|
100
|
+
});
|
|
101
|
+
}, [onTaskUpdate, task.id]);
|
|
102
|
+
const progressDrag = useGanttDrag({
|
|
103
|
+
dayWidth,
|
|
104
|
+
mode: "progress",
|
|
105
|
+
barWidthPx: width,
|
|
106
|
+
originalProgress: task.progress,
|
|
107
|
+
disabled: !canDragProgress,
|
|
108
|
+
onDragEnd: handleProgressDragEnd,
|
|
109
|
+
});
|
|
110
|
+
const anyDragging = moveDrag.isDragging ||
|
|
111
|
+
resizeLeftDrag.isDragging ||
|
|
112
|
+
resizeRightDrag.isDragging ||
|
|
113
|
+
progressDrag.isDragging;
|
|
114
|
+
const anyDidDrag = moveDrag.didDrag ||
|
|
115
|
+
resizeLeftDrag.didDrag ||
|
|
116
|
+
resizeRightDrag.didDrag ||
|
|
117
|
+
progressDrag.didDrag;
|
|
118
|
+
// ----- Computed visual positions during drag -----
|
|
119
|
+
let visualLeft = left;
|
|
120
|
+
let visualWidth = width;
|
|
121
|
+
let displayProgress = task.progress;
|
|
122
|
+
if (moveDrag.isDragging) {
|
|
123
|
+
visualLeft = left + moveDrag.dragDeltaX;
|
|
124
|
+
}
|
|
125
|
+
else if (resizeLeftDrag.isDragging) {
|
|
126
|
+
const delta = resizeLeftDrag.dragDeltaX;
|
|
127
|
+
// Clamp so width never goes below 1 day
|
|
128
|
+
const maxDelta = width - dayWidth;
|
|
129
|
+
const clampedDelta = Math.min(delta, maxDelta);
|
|
130
|
+
visualLeft = left + clampedDelta;
|
|
131
|
+
visualWidth = width - clampedDelta;
|
|
132
|
+
}
|
|
133
|
+
else if (resizeRightDrag.isDragging) {
|
|
134
|
+
const delta = resizeRightDrag.dragDeltaX;
|
|
135
|
+
// Clamp so width never goes below 1 day
|
|
136
|
+
visualWidth = Math.max(width + delta, dayWidth);
|
|
137
|
+
}
|
|
138
|
+
if (progressDrag.isDragging) {
|
|
139
|
+
displayProgress = progressDrag.dragProgress;
|
|
140
|
+
}
|
|
141
|
+
const isNarrow = visualWidth <= 80;
|
|
142
|
+
// ----- Hover highlighting (dependency connections) -----
|
|
143
|
+
const isHighlighted = useMemo(() => {
|
|
144
|
+
var _a, _b, _c;
|
|
145
|
+
if (!hoveredTaskId || hoveredTaskId === task.id)
|
|
146
|
+
return false;
|
|
147
|
+
// Check if this task depends on hovered task
|
|
148
|
+
if ((_a = task.dependencies) === null || _a === void 0 ? void 0 : _a.includes(hoveredTaskId))
|
|
149
|
+
return true;
|
|
150
|
+
// Check if hovered task depends on this task
|
|
151
|
+
const hoveredTask = tasks.find((t) => t.id === hoveredTaskId);
|
|
152
|
+
return (_c = (_b = hoveredTask === null || hoveredTask === void 0 ? void 0 : hoveredTask.dependencies) === null || _b === void 0 ? void 0 : _b.includes(task.id)) !== null && _c !== void 0 ? _c : false;
|
|
153
|
+
}, [hoveredTaskId, task.id, task.dependencies, tasks]);
|
|
154
|
+
const isFaded = hoveredTaskId !== null &&
|
|
155
|
+
hoveredTaskId !== task.id &&
|
|
156
|
+
!isHighlighted;
|
|
157
|
+
const isFocused = focusedTaskId === task.id;
|
|
158
|
+
// ----- Click handler -----
|
|
159
|
+
const handleClick = (e) => {
|
|
160
|
+
if (anyDidDrag)
|
|
161
|
+
return;
|
|
162
|
+
onTaskClick === null || onTaskClick === void 0 ? void 0 : onTaskClick(task, e);
|
|
163
|
+
};
|
|
164
|
+
// ----- Tooltip -----
|
|
165
|
+
const tooltipContent = (jsxs("div", { className: "text-xs space-y-2 min-w-[180px]", children: [jsx("div", { className: "font-semibold text-sm", children: task.title }), jsxs("div", { className: "flex items-center gap-1.5 opacity-70", children: [jsx("span", { className: "inline-block size-2 rounded-full shrink-0", style: { backgroundColor: group.color } }), group.title] }), jsxs("div", { className: "space-y-0.5", children: [jsxs("div", { children: [formatDateShort(task.startDate), " \u2014 ", formatDateShort(task.endDate)] }), jsx("div", { className: "opacity-70", children: formatDuration(task.startDate, task.endDate) })] }), jsxs("div", { children: [jsxs("div", { className: "flex justify-between mb-1", children: [jsx("span", { children: "Progress" }), jsxs("span", { className: "font-medium", children: [task.progress, "%"] })] }), jsx("div", { className: "h-1.5 rounded-full bg-white/20 overflow-hidden", children: jsx("div", { className: "h-full rounded-full", style: {
|
|
166
|
+
width: `${task.progress}%`,
|
|
167
|
+
backgroundColor: barColor,
|
|
168
|
+
} }) })] }), task.assignee && (jsxs("div", { className: "flex items-center gap-1.5 pt-0.5", children: [jsx(Avatar, { src: task.assignee.avatar, alt: task.assignee.name, size: "xs" }), jsx("span", { children: task.assignee.name })] })), isBehindSchedule && (jsxs("div", { className: "text-[var(--color-warning)] text-[10px]", children: ["Behind schedule (expected ", expectedProgress, "%)"] }))] }));
|
|
169
|
+
return (jsxs(Fragment, { children: [jsx(GanttTaskContextMenu, { task: task, children: jsxs("div", { className: "absolute", style: {
|
|
170
|
+
left: visualLeft,
|
|
171
|
+
top: top + (rowHeight - barHeight) / 2,
|
|
172
|
+
}, onMouseEnter: (e) => {
|
|
173
|
+
if (!anyDragging) {
|
|
174
|
+
setTooltipPos({ x: e.clientX, y: e.clientY });
|
|
175
|
+
setHoveredTaskId(task.id);
|
|
176
|
+
}
|
|
177
|
+
}, onMouseMove: (e) => {
|
|
178
|
+
if (!anyDragging) {
|
|
179
|
+
setTooltipPos({ x: e.clientX, y: e.clientY });
|
|
180
|
+
}
|
|
181
|
+
}, onMouseLeave: () => {
|
|
182
|
+
setTooltipPos(null);
|
|
183
|
+
setHoveredTaskId(null);
|
|
184
|
+
}, onClick: onTaskClick ? handleClick : undefined, onPointerDown: canDragDates ? moveDrag.handlePointerDown : undefined, role: "button", "aria-label": task.title, children: [jsxs(motion.div, { className: cn(theme.taskBarStyle, "group", task.completed && "opacity-60", canDragDates && !anyDragging && "cursor-grab", anyDragging && "cursor-grabbing", !canDragDates && "cursor-default", isHighlighted && "ring-2 ring-white/60", isFaded && "opacity-40", isFocused && "ring-2 ring-[var(--color-primary)] ring-offset-1"), style: {
|
|
185
|
+
width: visualWidth,
|
|
186
|
+
height: barHeight,
|
|
187
|
+
backgroundColor: barColor,
|
|
188
|
+
border: "1px solid rgba(0,0,0,0.12)",
|
|
189
|
+
borderRadius: "2rem",
|
|
190
|
+
transformOrigin: "left center",
|
|
191
|
+
transition: anyDragging ? "none" : undefined,
|
|
192
|
+
}, variants: taskBarVariants, initial: "hidden", animate: "visible", whileHover: anyDragging ? undefined : { filter: "brightness(0.96)" }, children: [jsx("div", { className: "absolute inset-0 rounded-full", style: {
|
|
193
|
+
width: `${displayProgress}%`,
|
|
194
|
+
background: "linear-gradient(rgba(0,0,0,0.15), rgba(0,0,0,0.15))",
|
|
195
|
+
} }), isBehindSchedule && (jsx("div", { className: "absolute top-0 bottom-0 w-px", style: {
|
|
196
|
+
left: `${expectedProgress}%`,
|
|
197
|
+
borderLeft: "2px dashed rgba(255,255,255,0.5)",
|
|
198
|
+
} })), task.completed && (jsx("div", { className: "absolute top-1/2 left-2 right-2 h-px bg-white/60", style: { transform: "translateY(-0.5px)" } })), canDragDates && (jsx("div", { className: "absolute left-0 top-0 bottom-0 w-2 cursor-ew-resize z-20 rounded-l-full opacity-0 group-hover:opacity-100 transition-opacity hover:bg-black/10", onPointerDown: resizeLeftDrag.handlePointerDown })), canDragDates && (jsx("div", { className: "absolute right-0 top-0 bottom-0 w-2 cursor-ew-resize z-20 rounded-r-full opacity-0 group-hover:opacity-100 transition-opacity hover:bg-black/10", onPointerDown: resizeRightDrag.handlePointerDown })), canDragProgress && !isNarrow && (jsx("div", { className: "absolute top-0 bottom-0 w-3 cursor-ew-resize z-20 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity", style: { left: `calc(${displayProgress}% - 6px)` }, onPointerDown: progressDrag.handlePointerDown, children: jsx("div", { className: "w-0.5 h-3 rounded-full bg-white/80 shadow" }) })), !isNarrow && (jsxs("div", { className: "relative flex items-center gap-1.5 px-1 z-10 min-w-0 pointer-events-none", children: [task.assignee && (jsx(Avatar, { src: task.assignee.avatar, alt: task.assignee.name, size: "xs" })), jsx("span", { className: "truncate text-xs text-[var(--color-text-inverse)] font-medium", children: task.title })] }))] }), isNarrow && (jsx("span", { className: "absolute text-xs font-medium whitespace-nowrap pointer-events-none", style: {
|
|
199
|
+
left: visualWidth + 6,
|
|
200
|
+
top: barHeight / 2,
|
|
201
|
+
transform: "translateY(-50%)",
|
|
202
|
+
color: barColor,
|
|
203
|
+
}, children: task.title }))] }) }), jsx(ChartTooltip, { active: !!tooltipPos && !anyDragging, position: tooltipPos !== null && tooltipPos !== void 0 ? tooltipPos : { x: 0, y: 0 }, content: tooltipContent })] }));
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
export { GanttTaskBar };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React, { ReactElement } from "react";
|
|
2
|
+
import type { GanttTask } from "./GanttChart.types";
|
|
3
|
+
interface GanttTaskContextMenuProps {
|
|
4
|
+
task: GanttTask;
|
|
5
|
+
children: ReactElement;
|
|
6
|
+
}
|
|
7
|
+
export declare const GanttTaskContextMenu: React.FC<GanttTaskContextMenuProps>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { CheckCircleIcon, DocumentDuplicateIcon, TrashIcon } from '@heroicons/react/24/outline';
|
|
3
|
+
import { ContextMenu } from '../../core/ContextMenu/ContextMenu.js';
|
|
4
|
+
import '../../core/ContextMenu/ContextMenu.theme.js';
|
|
5
|
+
import { useGanttContext } from './GanttChart.js';
|
|
6
|
+
|
|
7
|
+
const PROGRESS_STEPS = [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100];
|
|
8
|
+
const GanttTaskContextMenu = ({ task, children, }) => {
|
|
9
|
+
const { onTaskUpdate, onTaskDuplicate, onTaskDelete, readonly } = useGanttContext();
|
|
10
|
+
// If readonly or no callbacks, just render children without wrapping
|
|
11
|
+
if (readonly || (!onTaskUpdate && !onTaskDuplicate && !onTaskDelete)) {
|
|
12
|
+
return jsx(Fragment, { children: children });
|
|
13
|
+
}
|
|
14
|
+
return (jsxs(ContextMenu, { children: [jsx(ContextMenu.Trigger, { children: children }), jsxs(ContextMenu.Content, { children: [onTaskUpdate && (jsxs(ContextMenu.Item, { onSelect: () => onTaskUpdate(task.id, { completed: !task.completed, progress: task.completed ? 0 : 100 }), children: [jsx(CheckCircleIcon, { className: "size-4 mr-2" }), task.completed ? "Mark as incomplete" : "Mark as done"] })), onTaskUpdate && (jsxs(ContextMenu.Sub, { children: [jsx(ContextMenu.SubTrigger, { children: "Progress" }), jsx(ContextMenu.SubContent, { children: PROGRESS_STEPS.map((val) => (jsxs(ContextMenu.Item, { onSelect: () => onTaskUpdate(task.id, { progress: val, completed: val === 100 }), children: [val, "%"] }, val))) })] })), (onTaskDuplicate || onTaskDelete) && jsx(ContextMenu.Separator, {}), onTaskDuplicate && (jsxs(ContextMenu.Item, { onSelect: () => onTaskDuplicate(task.id), children: [jsx(DocumentDuplicateIcon, { className: "size-4 mr-2" }), "Duplicate"] })), onTaskDelete && (jsxs(ContextMenu.Item, { onSelect: () => onTaskDelete(task.id), className: "text-[var(--color-danger)]", children: [jsx(TrashIcon, { className: "size-4 mr-2" }), "Delete"] }))] })] }));
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { GanttTaskContextMenu };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { cn } from '../../../utils/cn.js';
|
|
4
|
+
import { useGanttContext } from './GanttChart.js';
|
|
5
|
+
import { toDate, isWeekend } from '../../../utils/dateUtils.js';
|
|
6
|
+
|
|
7
|
+
const GanttTimelineGrid = ({ days, height, }) => {
|
|
8
|
+
const { theme, dayWidth, todayMarker, todayOffset, rows, rowHeight, holidays, gridLines, } = useGanttContext();
|
|
9
|
+
const totalWidth = days.length * dayWidth;
|
|
10
|
+
const showVertical = gridLines === "both" || gridLines === "vertical";
|
|
11
|
+
const showHorizontal = gridLines === "both" || gridLines === "horizontal";
|
|
12
|
+
// Build a dateKey -> holiday lookup
|
|
13
|
+
const holidayMap = useMemo(() => {
|
|
14
|
+
const map = new Map();
|
|
15
|
+
for (const h of holidays) {
|
|
16
|
+
const d = toDate(h.date);
|
|
17
|
+
const key = `${d.getFullYear()}-${d.getMonth()}-${d.getDate()}`;
|
|
18
|
+
map.set(key, { label: h.label, color: h.color });
|
|
19
|
+
}
|
|
20
|
+
return map;
|
|
21
|
+
}, [holidays]);
|
|
22
|
+
return (jsxs("div", { className: "absolute inset-0 pointer-events-none", style: { width: totalWidth, height }, children: [days.map((day, i) => {
|
|
23
|
+
var _a, _b;
|
|
24
|
+
const key = `${day.getFullYear()}-${day.getMonth()}-${day.getDate()}`;
|
|
25
|
+
const holiday = holidayMap.get(key);
|
|
26
|
+
return (jsx("div", { className: cn("absolute top-0 bottom-0", showVertical && theme.gridLineStyle, isWeekend(day) && theme.weekendStyle), style: { left: i * dayWidth, width: dayWidth }, children: holiday && (jsxs(Fragment, { children: [jsx("div", { className: "absolute inset-0", style: {
|
|
27
|
+
backgroundColor: (_a = holiday.color) !== null && _a !== void 0 ? _a : "var(--color-warning-100, rgba(245, 158, 11, 0.08))",
|
|
28
|
+
} }), jsx("span", { className: "absolute bottom-1 left-1/2 -translate-x-1/2 text-[8px] whitespace-nowrap opacity-60", style: { color: (_b = holiday.color) !== null && _b !== void 0 ? _b : "var(--color-warning, #F59E0B)" }, children: holiday.label })] })) }, i));
|
|
29
|
+
}), showHorizontal &&
|
|
30
|
+
rows.map((_, i) => (jsx("div", { className: "absolute left-0 right-0 border-b border-[var(--color-border)]/20", style: { top: (i + 1) * rowHeight } }, `h-${i}`))), todayMarker && todayOffset !== null && (jsxs(Fragment, { children: [jsx("div", { className: cn("absolute top-0 bottom-0", theme.todayColumnStyle), style: { left: todayOffset * dayWidth, width: dayWidth } }), jsx("div", { className: cn("absolute top-0 bottom-0 z-10", theme.todayMarkerStyle), style: { left: todayOffset * dayWidth + dayWidth / 2 } })] }))] }));
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { GanttTimelineGrid };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { cn } from '../../../utils/cn.js';
|
|
3
|
+
import { useGanttContext } from './GanttChart.js';
|
|
4
|
+
import { formatDayLabel } from './GanttChart.utils.js';
|
|
5
|
+
import { isSameDay, isWeekend } from '../../../utils/dateUtils.js';
|
|
6
|
+
|
|
7
|
+
function getDayLabel(day, zoom) {
|
|
8
|
+
switch (zoom) {
|
|
9
|
+
case "day":
|
|
10
|
+
return formatDayLabel(day, zoom);
|
|
11
|
+
case "week":
|
|
12
|
+
// Show day number only on Mondays
|
|
13
|
+
return day.getDay() === 1 ? `${day.getDate()}` : "";
|
|
14
|
+
case "quarter":
|
|
15
|
+
// Show day number on 1st, 8th, 15th, 22nd
|
|
16
|
+
return [1, 8, 15, 22].includes(day.getDate())
|
|
17
|
+
? `${day.getDate()}`
|
|
18
|
+
: "";
|
|
19
|
+
case "month":
|
|
20
|
+
// Show day number on 1st and 15th
|
|
21
|
+
return day.getDate() === 1 || day.getDate() === 15
|
|
22
|
+
? `${day.getDate()}`
|
|
23
|
+
: "";
|
|
24
|
+
case "year":
|
|
25
|
+
// Show only on 1st of each month
|
|
26
|
+
return day.getDate() === 1
|
|
27
|
+
? day.toLocaleDateString("en-US", { month: "short" })
|
|
28
|
+
: "";
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const GanttTimelineHeader = ({ days, monthSpans, }) => {
|
|
32
|
+
const { theme, dayWidth, zoom } = useGanttContext();
|
|
33
|
+
const totalWidth = days.length * dayWidth;
|
|
34
|
+
const today = new Date();
|
|
35
|
+
today.setHours(0, 0, 0, 0);
|
|
36
|
+
return (jsxs("div", { className: cn(theme.timelineHeaderStyle), style: { width: totalWidth }, children: [jsx("div", { className: "flex", style: { height: 28 }, children: monthSpans.map((span) => (jsx("div", { className: cn(theme.timelineMonthStyle), style: { width: span.span * dayWidth }, children: span.label }, `${span.label}-${span.startIndex}`))) }), jsx("div", { className: "flex", style: { height: 28 }, children: days.map((day, i) => {
|
|
37
|
+
const isToday = isSameDay(day, today);
|
|
38
|
+
const weekend = isWeekend(day);
|
|
39
|
+
return (jsx("div", { className: cn(theme.timelineDayStyle, weekend && "bg-[var(--color-background-secondary)]/50", isToday && "font-semibold text-[var(--color-primary)]"), style: { width: dayWidth }, children: getDayLabel(day, zoom) }, i));
|
|
40
|
+
}) })] }));
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export { GanttTimelineHeader };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { CalendarIcon, PlusIcon } from '@heroicons/react/24/outline';
|
|
3
|
+
import { cn } from '../../../utils/cn.js';
|
|
4
|
+
import { useGanttContext } from './GanttChart.js';
|
|
5
|
+
import { Segmented } from '../../core/Segmented/Segmented.js';
|
|
6
|
+
import { Button } from '../../core/Button/Button.js';
|
|
7
|
+
import { Checkbox } from '../../forms/Checkbox/Checkbox.js';
|
|
8
|
+
|
|
9
|
+
const ZOOM_OPTIONS = [
|
|
10
|
+
{ value: "day", label: "Day" },
|
|
11
|
+
{ value: "week", label: "Week" },
|
|
12
|
+
{ value: "quarter", label: "Quarter" },
|
|
13
|
+
{ value: "month", label: "Month" },
|
|
14
|
+
{ value: "year", label: "Year" },
|
|
15
|
+
];
|
|
16
|
+
const GanttToolbar = () => {
|
|
17
|
+
const { theme, zoom, setZoom, hideCompleted, setHideCompleted, onGroupAdd, todayOffset, dayWidth, readonly, } = useGanttContext();
|
|
18
|
+
const handleScrollToToday = () => {
|
|
19
|
+
const container = document.querySelector("[data-gantt-chart-scroll]");
|
|
20
|
+
if (!container || todayOffset === null)
|
|
21
|
+
return;
|
|
22
|
+
const targetScroll = todayOffset * dayWidth - container.clientWidth / 2;
|
|
23
|
+
container.scrollTo({ left: targetScroll, behavior: "smooth" });
|
|
24
|
+
};
|
|
25
|
+
return (jsxs("div", { className: cn(theme.toolbarStyle), children: [jsxs("div", { className: "flex items-center gap-3", children: [todayOffset !== null && (jsxs(Button, { variant: "outline", color: "neutral", size: "sm", onClick: handleScrollToToday, children: [jsx(CalendarIcon, { className: "size-4" }), "Today"] })), jsx(Segmented, { value: zoom, onChange: (val) => setZoom(val), size: "sm", children: ZOOM_OPTIONS.map((opt) => (jsx(Segmented.Item, { value: opt.value, children: opt.label }, opt.value))) }), jsx(Checkbox, { id: "gantt-hide-completed", name: "hideCompleted", value: "hideCompleted", checked: hideCompleted, onChange: (checked) => setHideCompleted(checked), label: "Hide completed", size: "sm" })] }), jsx("div", { className: "flex items-center gap-2", children: onGroupAdd && !readonly && (jsxs(Button, { variant: "ghost", size: "sm", onClick: onGroupAdd, children: [jsx(PlusIcon, { className: "size-3.5" }), "Add group"] })) })] }));
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export { GanttToolbar };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { GanttTask, GanttZoom } from "../GanttChart.types";
|
|
2
|
+
import type { MonthSpan } from "../GanttChart.utils";
|
|
3
|
+
export interface UseGanttDatesResult {
|
|
4
|
+
rangeStart: Date;
|
|
5
|
+
rangeEnd: Date;
|
|
6
|
+
days: Date[];
|
|
7
|
+
monthSpans: MonthSpan[];
|
|
8
|
+
totalDays: number;
|
|
9
|
+
dayWidth: number;
|
|
10
|
+
todayOffset: number | null;
|
|
11
|
+
}
|
|
12
|
+
export declare function useGanttDates(tasks: GanttTask[], zoom: GanttZoom, startDate?: Date | string, endDate?: Date | string): UseGanttDatesResult;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { DAY_WIDTHS } from '../GanttChart.types.js';
|
|
3
|
+
import { autoDateRange, generateDayColumns, generateMonthSpans, getDayOffset } from '../GanttChart.utils.js';
|
|
4
|
+
import { toDate, isSameDay } from '../../../../utils/dateUtils.js';
|
|
5
|
+
|
|
6
|
+
function useGanttDates(tasks, zoom, startDate, endDate) {
|
|
7
|
+
return useMemo(() => {
|
|
8
|
+
const auto = autoDateRange(tasks);
|
|
9
|
+
const rangeStart = startDate ? toDate(startDate) : auto.start;
|
|
10
|
+
const rangeEnd = endDate ? toDate(endDate) : auto.end;
|
|
11
|
+
const days = generateDayColumns(rangeStart, rangeEnd);
|
|
12
|
+
const monthSpans = generateMonthSpans(days);
|
|
13
|
+
const totalDays = days.length;
|
|
14
|
+
const dayWidth = DAY_WIDTHS[zoom];
|
|
15
|
+
const today = new Date();
|
|
16
|
+
today.setHours(0, 0, 0, 0);
|
|
17
|
+
const todayInRange = days.some((d) => isSameDay(d, today));
|
|
18
|
+
const todayOffset = todayInRange
|
|
19
|
+
? getDayOffset(today, rangeStart)
|
|
20
|
+
: null;
|
|
21
|
+
return { rangeStart, rangeEnd, days, monthSpans, totalDays, dayWidth, todayOffset };
|
|
22
|
+
}, [tasks, zoom, startDate, endDate]);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { useGanttDates };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
export type DragMode = "move" | "resize-left" | "resize-right" | "progress";
|
|
3
|
+
export interface DragResult {
|
|
4
|
+
mode: DragMode;
|
|
5
|
+
daysDelta: number;
|
|
6
|
+
newProgress: number;
|
|
7
|
+
}
|
|
8
|
+
interface UseGanttDragOptions {
|
|
9
|
+
dayWidth: number;
|
|
10
|
+
mode: DragMode;
|
|
11
|
+
barWidthPx: number;
|
|
12
|
+
originalProgress: number;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
onDragEnd: (result: DragResult) => void;
|
|
15
|
+
onDragStateChange?: (isDragging: boolean, deltaX: number) => void;
|
|
16
|
+
}
|
|
17
|
+
interface UseGanttDragReturn {
|
|
18
|
+
isDragging: boolean;
|
|
19
|
+
didDrag: boolean;
|
|
20
|
+
dragDeltaX: number;
|
|
21
|
+
dragProgress: number;
|
|
22
|
+
handlePointerDown: (e: React.PointerEvent) => void;
|
|
23
|
+
}
|
|
24
|
+
export declare function useGanttDrag({ dayWidth, mode, barWidthPx, originalProgress, disabled, onDragEnd, onDragStateChange, }: UseGanttDragOptions): UseGanttDragReturn;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { useState, useRef, useEffect, useCallback } from 'react';
|
|
2
|
+
|
|
3
|
+
// ---------------------------------------------------------------------------
|
|
4
|
+
// Constants
|
|
5
|
+
// ---------------------------------------------------------------------------
|
|
6
|
+
const DRAG_THRESHOLD = 3; // px dead zone before drag activates
|
|
7
|
+
// ---------------------------------------------------------------------------
|
|
8
|
+
// Hook
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
function useGanttDrag({ dayWidth, mode, barWidthPx, originalProgress, disabled = false, onDragEnd, onDragStateChange, }) {
|
|
11
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
12
|
+
const [dragDeltaX, setDragDeltaX] = useState(0);
|
|
13
|
+
const [dragProgress, setDragProgress] = useState(originalProgress);
|
|
14
|
+
const didDragRef = useRef(false);
|
|
15
|
+
const startXRef = useRef(0);
|
|
16
|
+
const activatedRef = useRef(false);
|
|
17
|
+
const cancelledRef = useRef(false);
|
|
18
|
+
const cleanupRef = useRef(null);
|
|
19
|
+
// Reset didDrag after a tick so click handler can read it
|
|
20
|
+
const [didDrag, setDidDrag] = useState(false);
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
if (didDrag) {
|
|
23
|
+
const timer = setTimeout(() => setDidDrag(false), 0);
|
|
24
|
+
return () => clearTimeout(timer);
|
|
25
|
+
}
|
|
26
|
+
}, [didDrag]);
|
|
27
|
+
const handlePointerDown = useCallback((e) => {
|
|
28
|
+
if (disabled || e.button !== 0)
|
|
29
|
+
return;
|
|
30
|
+
e.preventDefault();
|
|
31
|
+
e.stopPropagation();
|
|
32
|
+
startXRef.current = e.clientX;
|
|
33
|
+
activatedRef.current = false;
|
|
34
|
+
cancelledRef.current = false;
|
|
35
|
+
didDragRef.current = false;
|
|
36
|
+
const onPointerMove = (ev) => {
|
|
37
|
+
var _a;
|
|
38
|
+
if (cancelledRef.current)
|
|
39
|
+
return;
|
|
40
|
+
const rawDelta = ev.clientX - startXRef.current;
|
|
41
|
+
// Dead zone: don't activate drag until threshold crossed
|
|
42
|
+
if (!activatedRef.current) {
|
|
43
|
+
if (Math.abs(rawDelta) < DRAG_THRESHOLD)
|
|
44
|
+
return;
|
|
45
|
+
activatedRef.current = true;
|
|
46
|
+
didDragRef.current = true;
|
|
47
|
+
setIsDragging(true);
|
|
48
|
+
}
|
|
49
|
+
if (mode === "progress") {
|
|
50
|
+
// Progress: map delta to 0-100 range
|
|
51
|
+
const progressDelta = barWidthPx > 0 ? (rawDelta / barWidthPx) * 100 : 0;
|
|
52
|
+
const newProgress = Math.round(Math.max(0, Math.min(100, originalProgress + progressDelta)));
|
|
53
|
+
setDragProgress(newProgress);
|
|
54
|
+
setDragDeltaX(rawDelta);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
// Move/resize: snap to day grid
|
|
58
|
+
const snappedDelta = Math.round(rawDelta / dayWidth) * dayWidth;
|
|
59
|
+
setDragDeltaX(snappedDelta);
|
|
60
|
+
(_a = onDragStateChangeRef.current) === null || _a === void 0 ? void 0 : _a.call(onDragStateChangeRef, true, snappedDelta);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
const onPointerUp = () => {
|
|
64
|
+
var _a, _b;
|
|
65
|
+
document.removeEventListener("pointermove", onPointerMove);
|
|
66
|
+
document.removeEventListener("pointerup", onPointerUp);
|
|
67
|
+
document.removeEventListener("keydown", onKeyDown);
|
|
68
|
+
cleanupRef.current = null;
|
|
69
|
+
if (cancelledRef.current) {
|
|
70
|
+
setIsDragging(false);
|
|
71
|
+
setDragDeltaX(0);
|
|
72
|
+
setDragProgress(originalProgress);
|
|
73
|
+
(_a = onDragStateChangeRef.current) === null || _a === void 0 ? void 0 : _a.call(onDragStateChangeRef, false, 0);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (activatedRef.current) {
|
|
77
|
+
setDidDrag(true);
|
|
78
|
+
const finalDelta = dragDeltaXRef.current;
|
|
79
|
+
const daysDelta = Math.round(finalDelta / dayWidth);
|
|
80
|
+
if (mode === "progress") {
|
|
81
|
+
onDragEnd({
|
|
82
|
+
mode,
|
|
83
|
+
daysDelta: 0,
|
|
84
|
+
newProgress: dragProgressRef.current,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
else if (daysDelta !== 0) {
|
|
88
|
+
onDragEnd({ mode, daysDelta, newProgress: originalProgress });
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
(_b = onDragStateChangeRef.current) === null || _b === void 0 ? void 0 : _b.call(onDragStateChangeRef, false, 0);
|
|
92
|
+
setIsDragging(false);
|
|
93
|
+
setDragDeltaX(0);
|
|
94
|
+
setDragProgress(originalProgress);
|
|
95
|
+
};
|
|
96
|
+
const onKeyDown = (ev) => {
|
|
97
|
+
var _a;
|
|
98
|
+
if (ev.key === "Escape") {
|
|
99
|
+
cancelledRef.current = true;
|
|
100
|
+
setIsDragging(false);
|
|
101
|
+
setDragDeltaX(0);
|
|
102
|
+
setDragProgress(originalProgress);
|
|
103
|
+
(_a = onDragStateChangeRef.current) === null || _a === void 0 ? void 0 : _a.call(onDragStateChangeRef, false, 0);
|
|
104
|
+
document.removeEventListener("pointermove", onPointerMove);
|
|
105
|
+
document.removeEventListener("pointerup", onPointerUp);
|
|
106
|
+
document.removeEventListener("keydown", onKeyDown);
|
|
107
|
+
cleanupRef.current = null;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
document.addEventListener("pointermove", onPointerMove);
|
|
111
|
+
document.addEventListener("pointerup", onPointerUp);
|
|
112
|
+
document.addEventListener("keydown", onKeyDown);
|
|
113
|
+
// Store cleanup so useEffect can remove listeners if component unmounts mid-drag
|
|
114
|
+
cleanupRef.current = () => {
|
|
115
|
+
document.removeEventListener("pointermove", onPointerMove);
|
|
116
|
+
document.removeEventListener("pointerup", onPointerUp);
|
|
117
|
+
document.removeEventListener("keydown", onKeyDown);
|
|
118
|
+
cleanupRef.current = null;
|
|
119
|
+
};
|
|
120
|
+
}, [disabled, dayWidth, mode, barWidthPx, originalProgress, onDragEnd]);
|
|
121
|
+
// Remove dangling listeners on unmount
|
|
122
|
+
useEffect(() => {
|
|
123
|
+
return () => {
|
|
124
|
+
var _a;
|
|
125
|
+
(_a = cleanupRef.current) === null || _a === void 0 ? void 0 : _a.call(cleanupRef);
|
|
126
|
+
};
|
|
127
|
+
}, []);
|
|
128
|
+
// Keep refs in sync with state/callbacks so closures read current values
|
|
129
|
+
const dragDeltaXRef = useRef(dragDeltaX);
|
|
130
|
+
dragDeltaXRef.current = dragDeltaX;
|
|
131
|
+
const dragProgressRef = useRef(dragProgress);
|
|
132
|
+
dragProgressRef.current = dragProgress;
|
|
133
|
+
const onDragStateChangeRef = useRef(onDragStateChange);
|
|
134
|
+
onDragStateChangeRef.current = onDragStateChange;
|
|
135
|
+
return {
|
|
136
|
+
isDragging,
|
|
137
|
+
didDrag,
|
|
138
|
+
dragDeltaX,
|
|
139
|
+
dragProgress,
|
|
140
|
+
handlePointerDown,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export { useGanttDrag };
|