@kumix/ui 0.1.3 → 0.2.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/README.md +115 -95
- package/dist/components/reui/alert.d.ts +12 -0
- package/dist/components/reui/alert.d.ts.map +1 -0
- package/dist/components/reui/alert.js +58 -0
- package/dist/components/reui/alert.js.map +1 -0
- package/dist/components/reui/autocomplete.d.ts +43 -0
- package/dist/components/reui/autocomplete.d.ts.map +1 -0
- package/dist/components/reui/autocomplete.js +165 -0
- package/dist/components/reui/autocomplete.js.map +1 -0
- package/dist/components/reui/badge.d.ts +17 -0
- package/dist/components/reui/badge.d.ts.map +1 -0
- package/dist/components/reui/badge.js +75 -0
- package/dist/components/reui/badge.js.map +1 -0
- package/dist/components/reui/data-grid/data-grid-column-filter.d.ts +17 -0
- package/dist/components/reui/data-grid/data-grid-column-filter.d.ts.map +1 -0
- package/dist/components/reui/data-grid/data-grid-column-filter.js +127 -0
- package/dist/components/reui/data-grid/data-grid-column-filter.js.map +1 -0
- package/dist/components/reui/data-grid/data-grid-column-header.d.ts +18 -0
- package/dist/components/reui/data-grid/data-grid-column-header.d.ts.map +1 -0
- package/dist/components/reui/data-grid/data-grid-column-header.js +228 -0
- package/dist/components/reui/data-grid/data-grid-column-header.js.map +1 -0
- package/dist/components/reui/data-grid/data-grid-column-visibility.d.ts +10 -0
- package/dist/components/reui/data-grid/data-grid-column-visibility.d.ts.map +1 -0
- package/dist/components/reui/data-grid/data-grid-column-visibility.js +28 -0
- package/dist/components/reui/data-grid/data-grid-column-visibility.js.map +1 -0
- package/dist/components/reui/data-grid/data-grid-pagination.d.ts +22 -0
- package/dist/components/reui/data-grid/data-grid-pagination.d.ts.map +1 -0
- package/dist/components/reui/data-grid/data-grid-pagination.js +144 -0
- package/dist/components/reui/data-grid/data-grid-pagination.js.map +1 -0
- package/dist/components/reui/data-grid/data-grid-scroll-area.d.ts +12 -0
- package/dist/components/reui/data-grid/data-grid-scroll-area.d.ts.map +1 -0
- package/dist/components/reui/data-grid/data-grid-scroll-area.js +289 -0
- package/dist/components/reui/data-grid/data-grid-scroll-area.js.map +1 -0
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.d.ts +14 -0
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.d.ts.map +1 -0
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js +166 -0
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js.map +1 -0
- package/dist/components/reui/data-grid/data-grid-table-dnd.d.ts +10 -0
- package/dist/components/reui/data-grid/data-grid-table-dnd.d.ts.map +1 -0
- package/dist/components/reui/data-grid/data-grid-table-dnd.js +171 -0
- package/dist/components/reui/data-grid/data-grid-table-dnd.js.map +1 -0
- package/dist/components/reui/data-grid/data-grid-table-virtual.d.ts +29 -0
- package/dist/components/reui/data-grid/data-grid-table-virtual.d.ts.map +1 -0
- package/dist/components/reui/data-grid/data-grid-table-virtual.js +269 -0
- package/dist/components/reui/data-grid/data-grid-table-virtual.js.map +1 -0
- package/dist/components/reui/data-grid/data-grid-table.d.ts +116 -0
- package/dist/components/reui/data-grid/data-grid-table.d.ts.map +1 -0
- package/dist/components/reui/data-grid/data-grid-table.js +864 -0
- package/dist/components/reui/data-grid/data-grid-table.js.map +1 -0
- package/dist/components/reui/data-grid/data-grid.d.ts +112 -0
- package/dist/components/reui/data-grid/data-grid.d.ts.map +1 -0
- package/dist/components/reui/data-grid/data-grid.js +134 -0
- package/dist/components/reui/data-grid/data-grid.js.map +1 -0
- package/dist/components/reui/date-selector.d.ts +131 -0
- package/dist/components/reui/date-selector.d.ts.map +1 -0
- package/dist/components/reui/date-selector.js +783 -0
- package/dist/components/reui/date-selector.js.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-agenda-view.d.ts +7 -0
- package/dist/components/reui/event-calendar/event-calendar-agenda-view.d.ts.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-agenda-view.js +108 -0
- package/dist/components/reui/event-calendar/event-calendar-agenda-view.js.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-content.d.ts +15 -0
- package/dist/components/reui/event-calendar/event-calendar-content.d.ts.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-content.js +44 -0
- package/dist/components/reui/event-calendar/event-calendar-content.js.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-dnd.d.ts +30 -0
- package/dist/components/reui/event-calendar/event-calendar-dnd.d.ts.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-dnd.js +581 -0
- package/dist/components/reui/event-calendar/event-calendar-dnd.js.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-event.d.ts +73 -0
- package/dist/components/reui/event-calendar/event-calendar-event.d.ts.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-event.js +299 -0
- package/dist/components/reui/event-calendar/event-calendar-event.js.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-i18n.d.ts +103 -0
- package/dist/components/reui/event-calendar/event-calendar-i18n.d.ts.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-i18n.js +141 -0
- package/dist/components/reui/event-calendar/event-calendar-i18n.js.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-lib.d.ts +111 -0
- package/dist/components/reui/event-calendar/event-calendar-lib.d.ts.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-lib.js +398 -0
- package/dist/components/reui/event-calendar/event-calendar-lib.js.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-month-view.d.ts +29 -0
- package/dist/components/reui/event-calendar/event-calendar-month-view.d.ts.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-month-view.js +530 -0
- package/dist/components/reui/event-calendar/event-calendar-month-view.js.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-nav.d.ts +71 -0
- package/dist/components/reui/event-calendar/event-calendar-nav.d.ts.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-nav.js +319 -0
- package/dist/components/reui/event-calendar/event-calendar-nav.js.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-recurrence.d.ts +32 -0
- package/dist/components/reui/event-calendar/event-calendar-recurrence.d.ts.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-recurrence.js +300 -0
- package/dist/components/reui/event-calendar/event-calendar-recurrence.js.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-resource-view.d.ts +14 -0
- package/dist/components/reui/event-calendar/event-calendar-resource-view.d.ts.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-resource-view.js +355 -0
- package/dist/components/reui/event-calendar/event-calendar-resource-view.js.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-time-grid.d.ts +35 -0
- package/dist/components/reui/event-calendar/event-calendar-time-grid.d.ts.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-time-grid.js +651 -0
- package/dist/components/reui/event-calendar/event-calendar-time-grid.js.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-types.d.ts +236 -0
- package/dist/components/reui/event-calendar/event-calendar-types.d.ts.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-types.js +2 -0
- package/dist/components/reui/event-calendar/event-calendar.d.ts +561 -0
- package/dist/components/reui/event-calendar/event-calendar.d.ts.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar.js +817 -0
- package/dist/components/reui/event-calendar/event-calendar.js.map +1 -0
- package/dist/components/reui/filters.d.ts +176 -0
- package/dist/components/reui/filters.d.ts.map +1 -0
- package/dist/components/reui/filters.js +1216 -0
- package/dist/components/reui/filters.js.map +1 -0
- package/dist/components/reui/frame.d.ts +32 -0
- package/dist/components/reui/frame.d.ts.map +1 -0
- package/dist/components/reui/frame.js +115 -0
- package/dist/components/reui/frame.js.map +1 -0
- package/dist/components/reui/gantt/gantt-bar.d.ts +44 -0
- package/dist/components/reui/gantt/gantt-bar.d.ts.map +1 -0
- package/dist/components/reui/gantt/gantt-bar.js +229 -0
- package/dist/components/reui/gantt/gantt-bar.js.map +1 -0
- package/dist/components/reui/gantt/gantt-dnd.d.ts +36 -0
- package/dist/components/reui/gantt/gantt-dnd.d.ts.map +1 -0
- package/dist/components/reui/gantt/gantt-dnd.js +615 -0
- package/dist/components/reui/gantt/gantt-dnd.js.map +1 -0
- package/dist/components/reui/gantt/gantt-i18n.d.ts +91 -0
- package/dist/components/reui/gantt/gantt-i18n.d.ts.map +1 -0
- package/dist/components/reui/gantt/gantt-i18n.js +131 -0
- package/dist/components/reui/gantt/gantt-i18n.js.map +1 -0
- package/dist/components/reui/gantt/gantt-lib.d.ts +123 -0
- package/dist/components/reui/gantt/gantt-lib.d.ts.map +1 -0
- package/dist/components/reui/gantt/gantt-lib.js +354 -0
- package/dist/components/reui/gantt/gantt-lib.js.map +1 -0
- package/dist/components/reui/gantt/gantt-nav.d.ts +60 -0
- package/dist/components/reui/gantt/gantt-nav.d.ts.map +1 -0
- package/dist/components/reui/gantt/gantt-nav.js +266 -0
- package/dist/components/reui/gantt/gantt-nav.js.map +1 -0
- package/dist/components/reui/gantt/gantt-recurrence.d.ts +37 -0
- package/dist/components/reui/gantt/gantt-recurrence.d.ts.map +1 -0
- package/dist/components/reui/gantt/gantt-recurrence.js +230 -0
- package/dist/components/reui/gantt/gantt-recurrence.js.map +1 -0
- package/dist/components/reui/gantt/gantt-types.d.ts +251 -0
- package/dist/components/reui/gantt/gantt-types.d.ts.map +1 -0
- package/dist/components/reui/gantt/gantt-types.js +2 -0
- package/dist/components/reui/gantt/gantt-view.d.ts +10 -0
- package/dist/components/reui/gantt/gantt-view.d.ts.map +1 -0
- package/dist/components/reui/gantt/gantt-view.js +2193 -0
- package/dist/components/reui/gantt/gantt-view.js.map +1 -0
- package/dist/components/reui/gantt/gantt.d.ts +602 -0
- package/dist/components/reui/gantt/gantt.d.ts.map +1 -0
- package/dist/components/reui/gantt/gantt.js +796 -0
- package/dist/components/reui/gantt/gantt.js.map +1 -0
- package/dist/components/reui/icon-stack.d.ts +7 -0
- package/dist/components/reui/icon-stack.d.ts.map +1 -0
- package/dist/components/reui/icon-stack.js +76 -0
- package/dist/components/reui/icon-stack.js.map +1 -0
- package/dist/components/reui/kanban.d.ts +70 -0
- package/dist/components/reui/kanban.d.ts.map +1 -0
- package/dist/components/reui/kanban.js +519 -0
- package/dist/components/reui/kanban.js.map +1 -0
- package/dist/components/reui/number-field.d.ts +29 -0
- package/dist/components/reui/number-field.d.ts.map +1 -0
- package/dist/components/reui/number-field.js +127 -0
- package/dist/components/reui/number-field.js.map +1 -0
- package/dist/components/reui/phone-input.d.ts +13 -0
- package/dist/components/reui/phone-input.d.ts.map +1 -0
- package/dist/components/reui/phone-input.js +126 -0
- package/dist/components/reui/phone-input.js.map +1 -0
- package/dist/components/reui/rating.d.ts +34 -0
- package/dist/components/reui/rating.d.ts.map +1 -0
- package/dist/components/reui/rating.js +94 -0
- package/dist/components/reui/rating.js.map +1 -0
- package/dist/components/reui/scrollspy.d.ts +17 -0
- package/dist/components/reui/scrollspy.d.ts.map +1 -0
- package/dist/components/reui/scrollspy.js +130 -0
- package/dist/components/reui/scrollspy.js.map +1 -0
- package/dist/components/reui/sortable.d.ts +48 -0
- package/dist/components/reui/sortable.d.ts.map +1 -0
- package/dist/components/reui/sortable.js +230 -0
- package/dist/components/reui/sortable.js.map +1 -0
- package/dist/components/reui/stepper.d.ts +63 -0
- package/dist/components/reui/stepper.d.ts.map +1 -0
- package/dist/components/reui/stepper.js +234 -0
- package/dist/components/reui/stepper.js.map +1 -0
- package/dist/components/reui/timeline.d.ts +24 -0
- package/dist/components/reui/timeline.d.ts.map +1 -0
- package/dist/components/reui/timeline.js +123 -0
- package/dist/components/reui/timeline.js.map +1 -0
- package/dist/components/reui/tree.d.ts +23 -0
- package/dist/components/reui/tree.d.ts.map +1 -0
- package/dist/components/reui/tree.js +115 -0
- package/dist/components/reui/tree.js.map +1 -0
- package/dist/components/ui/accordion.d.ts +9 -0
- package/dist/components/ui/accordion.d.ts.map +1 -0
- package/dist/components/ui/accordion.js +56 -0
- package/dist/components/ui/accordion.js.map +1 -0
- package/dist/components/ui/alert-dialog.d.ts +21 -0
- package/dist/components/ui/alert-dialog.d.ts.map +1 -0
- package/dist/components/ui/alert-dialog.js +96 -0
- package/dist/components/ui/alert-dialog.js.map +1 -0
- package/dist/components/ui/alert.d.ts +13 -0
- package/dist/components/ui/alert.d.ts.map +1 -0
- package/dist/components/ui/alert.js +45 -0
- package/dist/components/ui/alert.js.map +1 -0
- package/dist/components/ui/aspect-ratio.d.ts +8 -0
- package/dist/components/ui/aspect-ratio.d.ts.map +1 -0
- package/dist/components/ui/aspect-ratio.js +16 -0
- package/dist/components/ui/aspect-ratio.js.map +1 -0
- package/dist/components/ui/attachment.d.ts +26 -0
- package/dist/components/ui/attachment.d.ts.map +1 -0
- package/dist/components/ui/attachment.js +106 -0
- package/dist/components/ui/attachment.js.map +1 -0
- package/dist/components/ui/avatar.d.ts +14 -0
- package/dist/components/ui/avatar.d.ts.map +1 -0
- package/dist/components/ui/avatar.js +52 -0
- package/dist/components/ui/avatar.js.map +1 -0
- package/dist/components/ui/badge.d.ts +10 -0
- package/dist/components/ui/badge.d.ts.map +1 -0
- package/dist/components/ui/badge.js +32 -0
- package/dist/components/ui/badge.js.map +1 -0
- package/dist/components/ui/breadcrumb.d.ts +13 -0
- package/dist/components/ui/breadcrumb.d.ts.map +1 -0
- package/dist/components/ui/breadcrumb.js +72 -0
- package/dist/components/ui/breadcrumb.js.map +1 -0
- package/dist/components/ui/bubble.d.ts +19 -0
- package/dist/components/ui/bubble.d.ts.map +1 -0
- package/dist/components/ui/bubble.js +75 -0
- package/dist/components/ui/bubble.js.map +1 -0
- package/dist/components/ui/button-group.d.ts +14 -0
- package/dist/components/ui/button-group.d.ts.map +1 -0
- package/dist/components/ui/button-group.js +44 -0
- package/dist/components/ui/button-group.js.map +1 -0
- package/dist/components/ui/button.d.ts +11 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/button.js +47 -0
- package/dist/components/ui/button.js.map +1 -0
- package/dist/components/ui/calendar.d.ts +13 -0
- package/dist/components/ui/calendar.d.ts.map +1 -0
- package/dist/components/ui/calendar.js +110 -0
- package/dist/components/ui/calendar.js.map +1 -0
- package/dist/components/ui/card.d.ts +14 -0
- package/dist/components/ui/card.d.ts.map +1 -0
- package/dist/components/ui/card.js +58 -0
- package/dist/components/ui/card.js.map +1 -0
- package/dist/components/ui/carousel.d.ts +31 -0
- package/dist/components/ui/carousel.d.ts.map +1 -0
- package/dist/components/ui/carousel.js +135 -0
- package/dist/components/ui/carousel.js.map +1 -0
- package/dist/components/ui/chart.d.ts +47 -0
- package/dist/components/ui/chart.d.ts.map +1 -0
- package/dist/components/ui/chart.js +151 -0
- package/dist/components/ui/chart.js.map +1 -0
- package/dist/components/ui/checkbox.d.ts +6 -0
- package/dist/components/ui/checkbox.d.ts.map +1 -0
- package/dist/components/ui/checkbox.js +22 -0
- package/dist/components/ui/checkbox.js.map +1 -0
- package/dist/components/ui/collapsible.d.ts +8 -0
- package/dist/components/ui/collapsible.d.ts.map +1 -0
- package/dist/components/ui/collapsible.js +26 -0
- package/dist/components/ui/collapsible.js.map +1 -0
- package/dist/components/ui/combobox.d.ts +27 -0
- package/dist/components/ui/combobox.d.ts.map +1 -0
- package/dist/components/ui/combobox.js +164 -0
- package/dist/components/ui/combobox.js.map +1 -0
- package/dist/components/ui/command.d.ts +22 -0
- package/dist/components/ui/command.d.ts.map +1 -0
- package/dist/components/ui/command.js +89 -0
- package/dist/components/ui/command.js.map +1 -0
- package/dist/components/ui/context-menu.d.ts +32 -0
- package/dist/components/ui/context-menu.d.ts.map +1 -0
- package/dist/components/ui/context-menu.js +134 -0
- package/dist/components/ui/context-menu.js.map +1 -0
- package/dist/components/ui/dialog.d.ts +20 -0
- package/dist/components/ui/dialog.d.ts.map +1 -0
- package/dist/components/ui/dialog.js +93 -0
- package/dist/components/ui/dialog.js.map +1 -0
- package/dist/components/ui/direction.d.ts +2 -0
- package/dist/components/ui/direction.js +3 -0
- package/dist/components/ui/drawer.d.ts +19 -0
- package/dist/components/ui/drawer.d.ts.map +1 -0
- package/dist/components/ui/drawer.js +125 -0
- package/dist/components/ui/drawer.js.map +1 -0
- package/dist/components/ui/dropdown-menu.d.ts +32 -0
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu.js +138 -0
- package/dist/components/ui/dropdown-menu.js.map +1 -0
- package/dist/components/ui/empty.d.ts +15 -0
- package/dist/components/ui/empty.d.ts.map +1 -0
- package/dist/components/ui/empty.js +62 -0
- package/dist/components/ui/empty.js.map +1 -0
- package/dist/components/ui/field.d.ts +28 -0
- package/dist/components/ui/field.d.ts.map +1 -0
- package/dist/components/ui/field.js +112 -0
- package/dist/components/ui/field.js.map +1 -0
- package/dist/components/ui/hover-card.d.ts +8 -0
- package/dist/components/ui/hover-card.d.ts.map +1 -0
- package/dist/components/ui/hover-card.js +38 -0
- package/dist/components/ui/hover-card.js.map +1 -0
- package/dist/components/ui/input-group.d.ts +21 -0
- package/dist/components/ui/input-group.d.ts.map +1 -0
- package/dist/components/ui/input-group.js +80 -0
- package/dist/components/ui/input-group.js.map +1 -0
- package/dist/components/ui/input-otp.d.ts +14 -0
- package/dist/components/ui/input-otp.d.ts.map +1 -0
- package/dist/components/ui/input-otp.js +49 -0
- package/dist/components/ui/input-otp.js.map +1 -0
- package/dist/components/ui/input.d.ts +6 -0
- package/dist/components/ui/input.d.ts.map +1 -0
- package/dist/components/ui/input.js +17 -0
- package/dist/components/ui/input.js.map +1 -0
- package/dist/components/ui/item.d.ts +25 -0
- package/dist/components/ui/item.d.ts.map +1 -0
- package/dist/components/ui/item.js +123 -0
- package/dist/components/ui/item.js.map +1 -0
- package/dist/components/ui/kbd.d.ts +7 -0
- package/dist/components/ui/kbd.d.ts.map +1 -0
- package/dist/components/ui/kbd.js +22 -0
- package/dist/components/ui/kbd.js.map +1 -0
- package/dist/components/ui/label.d.ts +6 -0
- package/dist/components/ui/label.d.ts.map +1 -0
- package/dist/components/ui/label.js +15 -0
- package/dist/components/ui/label.js.map +1 -0
- package/dist/components/ui/marker.d.ts +13 -0
- package/dist/components/ui/marker.d.ts.map +1 -0
- package/dist/components/ui/marker.js +45 -0
- package/dist/components/ui/marker.js.map +1 -0
- package/dist/components/ui/menubar.d.ts +32 -0
- package/dist/components/ui/menubar.d.ts.map +1 -0
- package/dist/components/ui/menubar.js +137 -0
- package/dist/components/ui/menubar.js.map +1 -0
- package/dist/components/ui/message-scroller.d.ts +13 -0
- package/dist/components/ui/message-scroller.d.ts.map +1 -0
- package/dist/components/ui/message-scroller.js +62 -0
- package/dist/components/ui/message-scroller.js.map +1 -0
- package/dist/components/ui/message.d.ts +13 -0
- package/dist/components/ui/message.d.ts.map +1 -0
- package/dist/components/ui/message.js +51 -0
- package/dist/components/ui/message.js.map +1 -0
- package/dist/components/ui/native-select.d.ts +11 -0
- package/dist/components/ui/native-select.d.ts.map +1 -0
- package/dist/components/ui/native-select.js +40 -0
- package/dist/components/ui/native-select.js.map +1 -0
- package/dist/components/ui/navigation-menu.d.ts +15 -0
- package/dist/components/ui/navigation-menu.d.ts.map +1 -0
- package/dist/components/ui/navigation-menu.js +85 -0
- package/dist/components/ui/navigation-menu.js.map +1 -0
- package/dist/components/ui/pagination.d.ts +20 -0
- package/dist/components/ui/pagination.d.ts.map +1 -0
- package/dist/components/ui/pagination.js +81 -0
- package/dist/components/ui/pagination.js.map +1 -0
- package/dist/components/ui/popover.d.ts +12 -0
- package/dist/components/ui/popover.d.ts.map +1 -0
- package/dist/components/ui/popover.js +56 -0
- package/dist/components/ui/popover.js.map +1 -0
- package/dist/components/ui/progress.d.ts +10 -0
- package/dist/components/ui/progress.d.ts.map +1 -0
- package/dist/components/ui/progress.js +46 -0
- package/dist/components/ui/progress.js.map +1 -0
- package/dist/components/ui/radio-group.d.ts +8 -0
- package/dist/components/ui/radio-group.d.ts.map +1 -0
- package/dist/components/ui/radio-group.js +29 -0
- package/dist/components/ui/radio-group.js.map +1 -0
- package/dist/components/ui/resizable.d.ts +10 -0
- package/dist/components/ui/resizable.d.ts.map +1 -0
- package/dist/components/ui/resizable.js +30 -0
- package/dist/components/ui/resizable.js.map +1 -0
- package/dist/components/ui/scroll-area.d.ts +7 -0
- package/dist/components/ui/scroll-area.d.ts.map +1 -0
- package/dist/components/ui/scroll-area.js +38 -0
- package/dist/components/ui/scroll-area.js.map +1 -0
- package/dist/components/ui/select.d.ts +18 -0
- package/dist/components/ui/select.d.ts.map +1 -0
- package/dist/components/ui/select.js +99 -0
- package/dist/components/ui/select.js.map +1 -0
- package/dist/components/ui/separator.d.ts +6 -0
- package/dist/components/ui/separator.d.ts.map +1 -0
- package/dist/components/ui/separator.js +17 -0
- package/dist/components/ui/separator.js.map +1 -0
- package/dist/components/ui/sheet.d.ts +17 -0
- package/dist/components/ui/sheet.d.ts.map +1 -0
- package/dist/components/ui/sheet.js +90 -0
- package/dist/components/ui/sheet.js.map +1 -0
- package/dist/components/ui/sidebar.d.ts +66 -0
- package/dist/components/ui/sidebar.d.ts.map +1 -0
- package/dist/components/ui/sidebar.js +383 -0
- package/dist/components/ui/sidebar.js.map +1 -0
- package/dist/components/ui/skeleton.d.ts +6 -0
- package/dist/components/ui/skeleton.d.ts.map +1 -0
- package/dist/components/ui/skeleton.js +15 -0
- package/dist/components/ui/skeleton.js.map +1 -0
- package/dist/components/ui/slider.d.ts +6 -0
- package/dist/components/ui/slider.d.ts.map +1 -0
- package/dist/components/ui/slider.js +36 -0
- package/dist/components/ui/slider.js.map +1 -0
- package/dist/components/ui/sonner.d.ts +7 -0
- package/dist/components/ui/sonner.d.ts.map +1 -0
- package/dist/components/ui/sonner.js +32 -0
- package/dist/components/ui/sonner.js.map +1 -0
- package/dist/components/ui/spinner.d.ts +6 -0
- package/dist/components/ui/spinner.d.ts.map +1 -0
- package/dist/components/ui/spinner.js +18 -0
- package/dist/components/ui/spinner.js.map +1 -0
- package/dist/components/ui/switch.d.ts +8 -0
- package/dist/components/ui/switch.d.ts.map +1 -0
- package/dist/components/ui/switch.js +21 -0
- package/dist/components/ui/switch.js.map +1 -0
- package/dist/components/ui/table.d.ts +13 -0
- package/dist/components/ui/table.d.ts.map +1 -0
- package/dist/components/ui/table.js +68 -0
- package/dist/components/ui/table.js.map +1 -0
- package/dist/components/ui/tabs.d.ts +13 -0
- package/dist/components/ui/tabs.d.ts.map +1 -0
- package/dist/components/ui/tabs.js +47 -0
- package/dist/components/ui/tabs.js.map +1 -0
- package/dist/components/ui/textarea.d.ts +6 -0
- package/dist/components/ui/textarea.d.ts.map +1 -0
- package/dist/components/ui/textarea.js +15 -0
- package/dist/components/ui/textarea.js.map +1 -0
- package/dist/components/ui/toggle-group.d.ts +14 -0
- package/dist/components/ui/toggle-group.d.ts.map +1 -0
- package/dist/components/ui/toggle-group.js +54 -0
- package/dist/components/ui/toggle-group.js.map +1 -0
- package/dist/components/ui/toggle.d.ts +11 -0
- package/dist/components/ui/toggle.d.ts.map +1 -0
- package/dist/components/ui/toggle.js +38 -0
- package/dist/components/ui/toggle.js.map +1 -0
- package/dist/components/ui/tooltip.d.ts +9 -0
- package/dist/components/ui/tooltip.d.ts.map +1 -0
- package/dist/components/ui/tooltip.js +43 -0
- package/dist/components/ui/tooltip.js.map +1 -0
- package/dist/hooks/use-body-classes.d.ts +27 -0
- package/dist/hooks/use-body-classes.d.ts.map +1 -0
- package/dist/hooks/use-body-classes.js +52 -0
- package/dist/hooks/use-body-classes.js.map +1 -0
- package/dist/hooks/use-copy-to-clipboard.d.ts +43 -0
- package/dist/hooks/use-copy-to-clipboard.d.ts.map +1 -0
- package/dist/hooks/use-copy-to-clipboard.js +69 -0
- package/dist/hooks/use-copy-to-clipboard.js.map +1 -0
- package/dist/hooks/use-file-upload.d.ts +49 -0
- package/dist/hooks/use-file-upload.d.ts.map +1 -0
- package/dist/hooks/use-file-upload.js +227 -0
- package/dist/hooks/use-file-upload.js.map +1 -0
- package/dist/hooks/use-hydrated.d.ts +37 -0
- package/dist/hooks/use-hydrated.d.ts.map +1 -0
- package/dist/hooks/use-hydrated.js +50 -0
- package/dist/hooks/use-hydrated.js.map +1 -0
- package/dist/hooks/use-intersection-observer.d.ts +55 -0
- package/dist/hooks/use-intersection-observer.d.ts.map +1 -0
- package/dist/hooks/use-intersection-observer.js +144 -0
- package/dist/hooks/use-intersection-observer.js.map +1 -0
- package/dist/hooks/use-is-mac.d.ts +28 -0
- package/dist/hooks/use-is-mac.d.ts.map +1 -0
- package/dist/hooks/use-is-mac.js +38 -0
- package/dist/hooks/use-is-mac.js.map +1 -0
- package/dist/hooks/use-media-query.d.ts +44 -0
- package/dist/hooks/use-media-query.d.ts.map +1 -0
- package/dist/hooks/use-media-query.js +58 -0
- package/dist/hooks/use-media-query.js.map +1 -0
- package/dist/hooks/use-meta-color.d.ts +78 -0
- package/dist/hooks/use-meta-color.d.ts.map +1 -0
- package/dist/hooks/use-meta-color.js +138 -0
- package/dist/hooks/use-meta-color.js.map +1 -0
- package/dist/hooks/use-mobile.d.ts +5 -0
- package/dist/hooks/use-mobile.d.ts.map +1 -0
- package/dist/hooks/use-mobile.js +21 -0
- package/dist/hooks/use-mobile.js.map +1 -0
- package/dist/hooks/use-mutation-observer.d.ts +61 -0
- package/dist/hooks/use-mutation-observer.d.ts.map +1 -0
- package/dist/hooks/use-mutation-observer.js +96 -0
- package/dist/hooks/use-mutation-observer.js.map +1 -0
- package/dist/hooks/use-scroll-position.d.ts +76 -0
- package/dist/hooks/use-scroll-position.d.ts.map +1 -0
- package/dist/hooks/use-scroll-position.js +97 -0
- package/dist/hooks/use-scroll-position.js.map +1 -0
- package/dist/hooks/use-slider-input.d.ts +94 -0
- package/dist/hooks/use-slider-input.d.ts.map +1 -0
- package/dist/hooks/use-slider-input.js +116 -0
- package/dist/hooks/use-slider-input.js.map +1 -0
- package/dist/hooks/use-viewport.d.ts +72 -0
- package/dist/hooks/use-viewport.d.ts.map +1 -0
- package/dist/hooks/use-viewport.js +91 -0
- package/dist/hooks/use-viewport.js.map +1 -0
- package/dist/style.css +0 -247
- package/dist/theme.css +244 -0
- package/dist/theme.css.d.ts +3 -0
- package/package.json +101 -40
- package/dist/hooks.d.ts +0 -957
- package/dist/hooks.d.ts.map +0 -1
- package/dist/hooks.js +0 -1391
- package/dist/hooks.js.map +0 -1
- package/dist/index.d.ts +0 -1993
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -10647
- package/dist/index.js.map +0 -1
- package/dist/source.css +0 -1
- package/dist/source.css.d.ts +0 -3
- package/dist/use-is-mobile-Dln4-L1O.js +0 -210
- package/dist/use-is-mobile-Dln4-L1O.js.map +0 -1
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Button } from "../../ui/button.js";
|
|
3
|
+
import { Calendar } from "../../ui/calendar.js";
|
|
4
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuTrigger } from "../../ui/dropdown-menu.js";
|
|
5
|
+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../../ui/tooltip.js";
|
|
6
|
+
import { Popover, PopoverContent, PopoverTrigger } from "../../ui/popover.js";
|
|
7
|
+
import { toZoned } from "./gantt-lib.js";
|
|
8
|
+
import { useGanttNavigation, useGanttScale, useGanttSettings, useGanttViewConfig } from "./gantt.js";
|
|
9
|
+
import { useState } from "react";
|
|
10
|
+
import { cn } from "@kumix/utils";
|
|
11
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { CalendarIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
|
|
13
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
14
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
15
|
+
import { format } from "date-fns";
|
|
16
|
+
//#region src/components/reui/gantt/gantt-nav.tsx
|
|
17
|
+
const GANTT_SCALES = [
|
|
18
|
+
"day",
|
|
19
|
+
"week",
|
|
20
|
+
"month",
|
|
21
|
+
"quarter",
|
|
22
|
+
"year"
|
|
23
|
+
];
|
|
24
|
+
/** Configured nav button variant/size (viewConfig.navButtonVariant/Size). */
|
|
25
|
+
function useNavButtonProps() {
|
|
26
|
+
const viewConfig = useGanttViewConfig();
|
|
27
|
+
return {
|
|
28
|
+
variant: viewConfig.navButtonVariant,
|
|
29
|
+
size: viewConfig.navButtonSize,
|
|
30
|
+
iconSize: viewConfig.navButtonSize === "sm" ? "icon-sm" : "icon"
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/** Hover/focus-visible tooltip wrapper; renders the bare button when disabled. */
|
|
34
|
+
function NavTooltip({ content, children }) {
|
|
35
|
+
if (content === null || content === void 0) return children;
|
|
36
|
+
return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, { render: children }), /* @__PURE__ */ jsx(TooltipContent, {
|
|
37
|
+
side: "bottom",
|
|
38
|
+
children: content
|
|
39
|
+
})] });
|
|
40
|
+
}
|
|
41
|
+
function GanttNavToday({ className, render, children, tooltip, ...props }) {
|
|
42
|
+
const { today, isToday } = useGanttNavigation();
|
|
43
|
+
const settings = useGanttSettings();
|
|
44
|
+
const nav = useNavButtonProps();
|
|
45
|
+
const defaultTooltip = format(toZoned(/* @__PURE__ */ new Date(), settings.timeZone), settings.i18n.formats.dayTitle, { locale: settings.locale });
|
|
46
|
+
return /* @__PURE__ */ jsx(NavTooltip, {
|
|
47
|
+
content: tooltip === void 0 ? defaultTooltip : tooltip,
|
|
48
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
49
|
+
variant: nav.variant,
|
|
50
|
+
size: nav.size,
|
|
51
|
+
"data-slot": "gantt-nav-today",
|
|
52
|
+
"data-active": isToday || void 0,
|
|
53
|
+
className: cn(className),
|
|
54
|
+
onClick: today,
|
|
55
|
+
render,
|
|
56
|
+
...props,
|
|
57
|
+
children: children ?? settings.i18n.labels.today
|
|
58
|
+
})
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function GanttNavPrev({ className, render, children, tooltip, ...props }) {
|
|
62
|
+
const { prev } = useGanttNavigation();
|
|
63
|
+
const settings = useGanttSettings();
|
|
64
|
+
const nav = useNavButtonProps();
|
|
65
|
+
return /* @__PURE__ */ jsx(NavTooltip, {
|
|
66
|
+
content: tooltip === void 0 ? settings.i18n.labels.previous : tooltip,
|
|
67
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
68
|
+
variant: nav.variant,
|
|
69
|
+
size: nav.iconSize,
|
|
70
|
+
"data-slot": "gantt-nav-prev",
|
|
71
|
+
"aria-label": settings.i18n.labels.previous,
|
|
72
|
+
className: cn(className),
|
|
73
|
+
onClick: prev,
|
|
74
|
+
render,
|
|
75
|
+
...props,
|
|
76
|
+
children: children ?? /* @__PURE__ */ jsx(ChevronLeftIcon, {
|
|
77
|
+
className: "size-4",
|
|
78
|
+
"aria-hidden": "true"
|
|
79
|
+
})
|
|
80
|
+
})
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
function GanttNavNext({ className, render, children, tooltip, ...props }) {
|
|
84
|
+
const { next } = useGanttNavigation();
|
|
85
|
+
const settings = useGanttSettings();
|
|
86
|
+
const nav = useNavButtonProps();
|
|
87
|
+
return /* @__PURE__ */ jsx(NavTooltip, {
|
|
88
|
+
content: tooltip === void 0 ? settings.i18n.labels.next : tooltip,
|
|
89
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
90
|
+
variant: nav.variant,
|
|
91
|
+
size: nav.iconSize,
|
|
92
|
+
"data-slot": "gantt-nav-next",
|
|
93
|
+
"aria-label": settings.i18n.labels.next,
|
|
94
|
+
className: cn(className),
|
|
95
|
+
onClick: next,
|
|
96
|
+
render,
|
|
97
|
+
...props,
|
|
98
|
+
children: children ?? /* @__PURE__ */ jsx(ChevronRightIcon, {
|
|
99
|
+
className: "size-4",
|
|
100
|
+
"aria-hidden": "true"
|
|
101
|
+
})
|
|
102
|
+
})
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
function GanttTitle({ className, render, format: formatTitle, ...props }) {
|
|
106
|
+
const { title } = useGanttNavigation();
|
|
107
|
+
return useRender({
|
|
108
|
+
defaultTagName: "div",
|
|
109
|
+
render,
|
|
110
|
+
props: mergeProps({
|
|
111
|
+
"data-slot": "gantt-title",
|
|
112
|
+
"aria-live": "polite",
|
|
113
|
+
className: cn("min-w-0 truncate font-semibold text-sm", className),
|
|
114
|
+
children: formatTitle?.({ title }) ?? title
|
|
115
|
+
}, props)
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Scale switcher ("Select view"): Day / Week / Month / Quarter / Year, a ghost
|
|
120
|
+
* dropdown button (same shape as the event-calendar view switcher).
|
|
121
|
+
*/
|
|
122
|
+
function GanttScaleSwitcher({ className, render, children, tooltip, scales = GANTT_SCALES, ...props }) {
|
|
123
|
+
const { scale, setScale } = useGanttScale();
|
|
124
|
+
const settings = useGanttSettings();
|
|
125
|
+
const nav = useNavButtonProps();
|
|
126
|
+
const labels = settings.i18n.labels;
|
|
127
|
+
const [open, setOpen] = useState(false);
|
|
128
|
+
const [tipOpen, setTipOpen] = useState(false);
|
|
129
|
+
const selectScale = (next) => {
|
|
130
|
+
setOpen(false);
|
|
131
|
+
setScale(next);
|
|
132
|
+
};
|
|
133
|
+
return /* @__PURE__ */ jsxs(DropdownMenu, {
|
|
134
|
+
open,
|
|
135
|
+
onOpenChange: (next) => {
|
|
136
|
+
setOpen(next);
|
|
137
|
+
if (next) setTipOpen(false);
|
|
138
|
+
},
|
|
139
|
+
children: [/* @__PURE__ */ jsxs(Tooltip, {
|
|
140
|
+
open: tipOpen && !open,
|
|
141
|
+
onOpenChange: (next, details) => {
|
|
142
|
+
if (next && details?.reason !== "trigger-hover") return;
|
|
143
|
+
setTipOpen(next);
|
|
144
|
+
},
|
|
145
|
+
children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
|
|
146
|
+
render: /* @__PURE__ */ jsx(TooltipTrigger, { render: /* @__PURE__ */ jsx(Button, {
|
|
147
|
+
variant: nav.variant,
|
|
148
|
+
size: nav.size,
|
|
149
|
+
"data-slot": "gantt-scale-switcher",
|
|
150
|
+
"aria-label": labels.selectView,
|
|
151
|
+
className: cn("gap-1", className)
|
|
152
|
+
}) }),
|
|
153
|
+
...props,
|
|
154
|
+
children: children ?? /* @__PURE__ */ jsxs(Fragment$1, { children: [labels.scales[scale], /* @__PURE__ */ jsx(ChevronDownIcon, {
|
|
155
|
+
className: "size-4 opacity-60",
|
|
156
|
+
"aria-hidden": "true"
|
|
157
|
+
})] })
|
|
158
|
+
}), tipOpen && !open && tooltip !== null && /* @__PURE__ */ jsx(TooltipContent, {
|
|
159
|
+
side: "bottom",
|
|
160
|
+
children: tooltip ?? labels.selectView
|
|
161
|
+
})]
|
|
162
|
+
}), /* @__PURE__ */ jsx(DropdownMenuContent, {
|
|
163
|
+
align: "start",
|
|
164
|
+
className: "min-w-36",
|
|
165
|
+
children: /* @__PURE__ */ jsxs(DropdownMenuGroup, { children: [/* @__PURE__ */ jsx(DropdownMenuLabel, {
|
|
166
|
+
className: "font-normal text-muted-foreground",
|
|
167
|
+
children: labels.selectView
|
|
168
|
+
}), scales.map((value) => /* @__PURE__ */ jsx(DropdownMenuItem, {
|
|
169
|
+
"data-active": scale === value || void 0,
|
|
170
|
+
onClick: () => selectScale(value),
|
|
171
|
+
children: labels.scales[value]
|
|
172
|
+
}, value))] })
|
|
173
|
+
})]
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Compact go-to-date picker (shadcn Calendar in a popover). No tooltip by
|
|
178
|
+
* design: it opens an overlay (see the NavButtonProps tooltip policy).
|
|
179
|
+
*/
|
|
180
|
+
function GanttDatePicker({ className }) {
|
|
181
|
+
const { date, goTo } = useGanttNavigation();
|
|
182
|
+
const settings = useGanttSettings();
|
|
183
|
+
const nav = useNavButtonProps();
|
|
184
|
+
const [open, setOpen] = useState(false);
|
|
185
|
+
const zoned = toZoned(date, settings.timeZone);
|
|
186
|
+
return /* @__PURE__ */ jsxs(Popover, {
|
|
187
|
+
open,
|
|
188
|
+
onOpenChange: setOpen,
|
|
189
|
+
children: [/* @__PURE__ */ jsx(PopoverTrigger, {
|
|
190
|
+
render: /* @__PURE__ */ jsx(Button, {
|
|
191
|
+
variant: nav.variant,
|
|
192
|
+
size: nav.iconSize,
|
|
193
|
+
"data-slot": "gantt-date-picker",
|
|
194
|
+
"aria-label": settings.i18n.labels.goToDate,
|
|
195
|
+
className: cn(className)
|
|
196
|
+
}),
|
|
197
|
+
children: /* @__PURE__ */ jsx(CalendarIcon, {
|
|
198
|
+
className: "size-4",
|
|
199
|
+
"aria-hidden": "true"
|
|
200
|
+
})
|
|
201
|
+
}), /* @__PURE__ */ jsx(PopoverContent, {
|
|
202
|
+
align: "start",
|
|
203
|
+
className: "w-auto p-0!",
|
|
204
|
+
children: /* @__PURE__ */ jsx(Calendar, {
|
|
205
|
+
mode: "single",
|
|
206
|
+
selected: zoned,
|
|
207
|
+
defaultMonth: zoned,
|
|
208
|
+
locale: settings.locale,
|
|
209
|
+
weekStartsOn: settings.weekStartsOn,
|
|
210
|
+
onSelect: (next) => {
|
|
211
|
+
if (next) {
|
|
212
|
+
goTo(next);
|
|
213
|
+
setOpen(false);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
})
|
|
217
|
+
})]
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
/** Free slot for consumer toolbar buttons; pure layout shell. */
|
|
221
|
+
function GanttToolbar({ className, render, ...props }) {
|
|
222
|
+
return useRender({
|
|
223
|
+
defaultTagName: "div",
|
|
224
|
+
render,
|
|
225
|
+
props: mergeProps({
|
|
226
|
+
"data-slot": "gantt-toolbar",
|
|
227
|
+
className: cn("flex items-center gap-2", useGanttViewConfig().classNames?.toolbar, className),
|
|
228
|
+
children: props.children
|
|
229
|
+
}, props)
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Default composed nav (event-calendar parity): Today, time-period switcher,
|
|
234
|
+
* prev/next, title, spacer. GanttDatePicker stays available for custom
|
|
235
|
+
* compositions. Pass children to use it as a pure layout shell instead.
|
|
236
|
+
*/
|
|
237
|
+
function GanttNav({ className, render, children, ...props }) {
|
|
238
|
+
const viewConfig = useGanttViewConfig();
|
|
239
|
+
return useRender({
|
|
240
|
+
defaultTagName: "div",
|
|
241
|
+
render,
|
|
242
|
+
props: mergeProps({
|
|
243
|
+
"data-slot": "gantt-nav",
|
|
244
|
+
className: cn("flex min-w-0 flex-wrap items-center gap-2 border-b px-3 py-2", viewConfig.stickyNav && "sticky top-0 z-30 bg-background", viewConfig.classNames?.nav, className),
|
|
245
|
+
children: children ?? /* @__PURE__ */ jsxs(TooltipProvider, {
|
|
246
|
+
delay: 600,
|
|
247
|
+
closeDelay: 0,
|
|
248
|
+
timeout: 300,
|
|
249
|
+
children: [
|
|
250
|
+
/* @__PURE__ */ jsx(GanttNavToday, {}),
|
|
251
|
+
/* @__PURE__ */ jsx(GanttScaleSwitcher, {}),
|
|
252
|
+
/* @__PURE__ */ jsxs("div", {
|
|
253
|
+
className: "flex items-center",
|
|
254
|
+
children: [/* @__PURE__ */ jsx(GanttNavPrev, {}), /* @__PURE__ */ jsx(GanttNavNext, {})]
|
|
255
|
+
}),
|
|
256
|
+
/* @__PURE__ */ jsx(GanttTitle, {}),
|
|
257
|
+
/* @__PURE__ */ jsx("div", { className: "grow" })
|
|
258
|
+
]
|
|
259
|
+
})
|
|
260
|
+
}, props)
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
//#endregion
|
|
264
|
+
export { GANTT_SCALES, GanttDatePicker, GanttNav, GanttNavNext, GanttNavPrev, GanttNavToday, GanttScaleSwitcher, GanttTitle, GanttToolbar };
|
|
265
|
+
|
|
266
|
+
//# sourceMappingURL=gantt-nav.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gantt-nav.js","names":[],"sources":["../../../../src/components/reui/gantt/gantt-nav.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useState } from \"react\";\nimport { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport { format } from \"date-fns\";\nimport { CalendarIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from \"lucide-react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { Button } from \"../../ui/button\";\nimport { Calendar } from \"../../ui/calendar\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuTrigger,\n} from \"../../ui/dropdown-menu\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../../ui/popover\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"../../ui/tooltip\";\nimport { useGanttNavigation, useGanttScale, useGanttSettings, useGanttViewConfig } from \"./gantt\";\nimport { toZoned } from \"./gantt-lib\";\nimport type { GanttScale } from \"./gantt-types\";\n\nconst GANTT_SCALES: GanttScale[] = [\"day\", \"week\", \"month\", \"quarter\", \"year\"];\n\n/** Configured nav button variant/size (viewConfig.navButtonVariant/Size). */\nfunction useNavButtonProps(): {\n variant: \"ghost\" | \"outline\" | \"secondary\" | \"default\";\n size: \"sm\" | \"default\";\n iconSize: \"icon-sm\" | \"icon\";\n} {\n const viewConfig = useGanttViewConfig();\n return {\n variant: viewConfig.navButtonVariant,\n size: viewConfig.navButtonSize,\n iconSize: viewConfig.navButtonSize === \"sm\" ? \"icon-sm\" : \"icon\",\n };\n}\n\ntype NavButtonProps = Omit<useRender.ComponentProps<\"button\">, \"children\"> & {\n children?: ReactNode;\n /**\n * Tooltip policy (the part that usually goes wrong on clickable elements):\n * tooltips appear ONLY on hover or keyboard focus-visible - a pointer click\n * never re-triggers them, and buttons that open overlays (the period\n * selector, consumer dialog buttons) get NO tooltip at all so nothing\n * flashes when focus returns. Icon-only buttons default to their accessible\n * label; Today defaults to the actual current date. Pass null to disable.\n */\n tooltip?: ReactNode | null;\n};\n\n/** Hover/focus-visible tooltip wrapper; renders the bare button when disabled. */\nfunction NavTooltip({\n content,\n children,\n}: {\n content: ReactNode | null;\n children: React.ReactElement;\n}) {\n if (content === null || content === undefined) return children;\n return (\n <Tooltip>\n <TooltipTrigger render={children} />\n <TooltipContent side=\"bottom\">{content}</TooltipContent>\n </Tooltip>\n );\n}\n\nfunction GanttNavToday({ className, render, children, tooltip, ...props }: NavButtonProps) {\n const { today, isToday } = useGanttNavigation();\n const settings = useGanttSettings();\n const nav = useNavButtonProps();\n // zoned: a system-zone new Date() can name a different day than Today opens\n const defaultTooltip = format(\n toZoned(new Date(), settings.timeZone),\n settings.i18n.formats.dayTitle,\n { locale: settings.locale },\n );\n return (\n <NavTooltip content={tooltip === undefined ? defaultTooltip : tooltip}>\n <Button\n variant={nav.variant}\n size={nav.size}\n data-slot=\"gantt-nav-today\"\n data-active={isToday || undefined}\n className={cn(className)}\n onClick={today}\n render={render}\n {...props}\n >\n {children ?? settings.i18n.labels.today}\n </Button>\n </NavTooltip>\n );\n}\n\nfunction GanttNavPrev({ className, render, children, tooltip, ...props }: NavButtonProps) {\n const { prev } = useGanttNavigation();\n const settings = useGanttSettings();\n const nav = useNavButtonProps();\n return (\n <NavTooltip content={tooltip === undefined ? settings.i18n.labels.previous : tooltip}>\n <Button\n variant={nav.variant}\n size={nav.iconSize}\n data-slot=\"gantt-nav-prev\"\n aria-label={settings.i18n.labels.previous}\n className={cn(className)}\n onClick={prev}\n render={render}\n {...props}\n >\n {children ?? <ChevronLeftIcon className=\"size-4\" aria-hidden=\"true\" />}\n </Button>\n </NavTooltip>\n );\n}\n\nfunction GanttNavNext({ className, render, children, tooltip, ...props }: NavButtonProps) {\n const { next } = useGanttNavigation();\n const settings = useGanttSettings();\n const nav = useNavButtonProps();\n return (\n <NavTooltip content={tooltip === undefined ? settings.i18n.labels.next : tooltip}>\n <Button\n variant={nav.variant}\n size={nav.iconSize}\n data-slot=\"gantt-nav-next\"\n aria-label={settings.i18n.labels.next}\n className={cn(className)}\n onClick={next}\n render={render}\n {...props}\n >\n {children ?? <ChevronRightIcon className=\"size-4\" aria-hidden=\"true\" />}\n </Button>\n </NavTooltip>\n );\n}\n\ninterface GanttTitleProps extends useRender.ComponentProps<\"div\"> {\n format?: (ctx: { title: string }) => ReactNode;\n}\n\nfunction GanttTitle({ className, render, format: formatTitle, ...props }: GanttTitleProps) {\n const { title } = useGanttNavigation();\n const defaultProps = {\n \"data-slot\": \"gantt-title\",\n \"aria-live\": \"polite\" as const,\n className: cn(\"min-w-0 truncate font-semibold text-sm\", className),\n children: formatTitle?.({ title }) ?? title,\n };\n return useRender({\n defaultTagName: \"div\",\n render,\n props: mergeProps<\"div\">(defaultProps, props),\n });\n}\n\ninterface GanttScaleSwitcherProps extends Omit<useRender.ComponentProps<\"button\">, \"children\"> {\n children?: ReactNode;\n /** Hover/focus-visible hint; defaults to the \"Select view\" label. Pass\n * null to disable (overlay-opener policy). */\n tooltip?: ReactNode | null;\n /** The offered scales, in menu order. Default: all five. */\n scales?: GanttScale[];\n}\n\n/**\n * Scale switcher (\"Select view\"): Day / Week / Month / Quarter / Year, a ghost\n * dropdown button (same shape as the event-calendar view switcher).\n */\nfunction GanttScaleSwitcher({\n className,\n render,\n children,\n tooltip,\n scales = GANTT_SCALES,\n ...props\n}: GanttScaleSwitcherProps) {\n const { scale, setScale } = useGanttScale();\n const settings = useGanttSettings();\n const nav = useNavButtonProps();\n const labels = settings.i18n.labels;\n // Controlled open: selecting a scale swaps the whole track subtree in the\n // same click, so closing must not depend on the menu's internal handler.\n const [open, setOpen] = useState(false);\n // Hover-only tooltip: when the menu closes, Base UI focuses the trigger\n // again and a focus-opened tooltip would flash - ignore focus opens.\n const [tipOpen, setTipOpen] = useState(false);\n\n const selectScale = (next: GanttScale) => {\n setOpen(false);\n setScale(next);\n };\n\n return (\n <DropdownMenu\n open={open}\n onOpenChange={(next: boolean) => {\n setOpen(next);\n if (next) setTipOpen(false);\n }}\n >\n {/* Tooltip on an overlay-opener: hover-only (focus opens ignored) and\n force-closed while the menu is up, so it never lingers or flashes\n when focus returns on close. */}\n <Tooltip\n open={tipOpen && !open}\n onOpenChange={(next: boolean, details: { reason?: string }) => {\n // opens are hover-only; the trigger-focus open that follows a\n // menu close is ignored, closes always land\n if (next && details?.reason !== \"trigger-hover\") return;\n setTipOpen(next);\n }}\n >\n <DropdownMenuTrigger\n render={\n <TooltipTrigger\n render={\n <Button\n variant={nav.variant}\n size={nav.size}\n data-slot=\"gantt-scale-switcher\"\n aria-label={labels.selectView}\n className={cn(\"gap-1\", className)}\n />\n }\n />\n }\n {...props}\n >\n {children ?? (\n <>\n {labels.scales[scale]}\n <ChevronDownIcon className=\"size-4 opacity-60\" aria-hidden=\"true\" />\n </>\n )}\n </DropdownMenuTrigger>\n {tipOpen && !open && tooltip !== null && (\n <TooltipContent side=\"bottom\">{tooltip ?? labels.selectView}</TooltipContent>\n )}\n </Tooltip>\n <DropdownMenuContent align=\"start\" className=\"min-w-36\">\n {/* Base UI contract: GroupLabel must live inside Menu.Group */}\n <DropdownMenuGroup>\n <DropdownMenuLabel className=\"font-normal text-muted-foreground\">\n {labels.selectView}\n </DropdownMenuLabel>\n {scales.map((value) => (\n <DropdownMenuItem\n key={value}\n data-active={scale === value || undefined}\n onClick={() => selectScale(value)}\n >\n {labels.scales[value]}\n </DropdownMenuItem>\n ))}\n </DropdownMenuGroup>\n </DropdownMenuContent>\n </DropdownMenu>\n );\n}\n\ninterface GanttDatePickerProps {\n className?: string;\n}\n\n/**\n * Compact go-to-date picker (shadcn Calendar in a popover). No tooltip by\n * design: it opens an overlay (see the NavButtonProps tooltip policy).\n */\nfunction GanttDatePicker({ className }: GanttDatePickerProps) {\n const { date, goTo } = useGanttNavigation();\n const settings = useGanttSettings();\n const nav = useNavButtonProps();\n const [open, setOpen] = useState(false);\n const zoned = toZoned(date, settings.timeZone);\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger\n render={\n <Button\n variant={nav.variant}\n size={nav.iconSize}\n data-slot=\"gantt-date-picker\"\n aria-label={settings.i18n.labels.goToDate}\n className={cn(className)}\n />\n }\n >\n <CalendarIcon className=\"size-4\" aria-hidden=\"true\" />\n </PopoverTrigger>\n <PopoverContent align=\"start\" className=\"w-auto p-0!\">\n <Calendar\n mode=\"single\"\n selected={zoned}\n defaultMonth={zoned}\n locale={settings.locale}\n weekStartsOn={settings.weekStartsOn}\n onSelect={(next: Date | undefined) => {\n if (next) {\n goTo(next);\n setOpen(false);\n }\n }}\n />\n </PopoverContent>\n </Popover>\n );\n}\n\ntype GanttToolbarProps = useRender.ComponentProps<\"div\">;\n\n/** Free slot for consumer toolbar buttons; pure layout shell. */\nfunction GanttToolbar({ className, render, ...props }: GanttToolbarProps) {\n const viewConfig = useGanttViewConfig();\n const defaultProps = {\n \"data-slot\": \"gantt-toolbar\",\n className: cn(\"flex items-center gap-2\", viewConfig.classNames?.toolbar, className),\n children: props.children,\n };\n return useRender({\n defaultTagName: \"div\",\n render,\n props: mergeProps<\"div\">(defaultProps, props),\n });\n}\n\ninterface GanttNavProps extends useRender.ComponentProps<\"div\"> {}\n\n/**\n * Default composed nav (event-calendar parity): Today, time-period switcher,\n * prev/next, title, spacer. GanttDatePicker stays available for custom\n * compositions. Pass children to use it as a pure layout shell instead.\n */\nfunction GanttNav({ className, render, children, ...props }: GanttNavProps) {\n const viewConfig = useGanttViewConfig();\n const defaultProps = {\n \"data-slot\": \"gantt-nav\",\n className: cn(\n // px so the toolbar controls do not hug the container edge; border-b\n // separates the toolbar from the column header below it\n \"flex min-w-0 flex-wrap items-center gap-2 border-b px-3 py-2\",\n viewConfig.stickyNav && \"sticky top-0 z-30 bg-background\",\n viewConfig.classNames?.nav,\n className,\n ),\n children: children ?? (\n // Shared provider: first tooltip waits, moving between buttons is instant\n <TooltipProvider delay={600} closeDelay={0} timeout={300}>\n <GanttNavToday />\n <GanttScaleSwitcher />\n <div className=\"flex items-center\">\n <GanttNavPrev />\n <GanttNavNext />\n </div>\n <GanttTitle />\n <div className=\"grow\" />\n </TooltipProvider>\n ),\n };\n return useRender({\n defaultTagName: \"div\",\n render,\n props: mergeProps<\"div\">(defaultProps, props),\n });\n}\n\nexport type { GanttNavProps, GanttScaleSwitcherProps, GanttTitleProps, GanttToolbarProps };\nexport {\n GANTT_SCALES,\n GanttDatePicker,\n GanttNav,\n GanttNavNext,\n GanttNavPrev,\n GanttNavToday,\n GanttScaleSwitcher,\n GanttTitle,\n GanttToolbar,\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAyBA,MAAM,eAA6B;CAAC;CAAO;CAAQ;CAAS;CAAW;AAAM;;AAG7E,SAAS,oBAIP;CACA,MAAM,aAAa,mBAAmB;CACtC,OAAO;EACL,SAAS,WAAW;EACpB,MAAM,WAAW;EACjB,UAAU,WAAW,kBAAkB,OAAO,YAAY;CAC5D;AACF;;AAgBA,SAAS,WAAW,EAClB,SACA,YAIC;CACD,IAAI,YAAY,QAAQ,YAAY,KAAA,GAAW,OAAO;CACtD,OACE,qBAAC,SAAD,EAAA,UAAA,CACE,oBAAC,gBAAD,EAAgB,QAAQ,SAAW,CAAA,GACnC,oBAAC,gBAAD;EAAgB,MAAK;EAAU,UAAA;CAAwB,CAAA,CAChD,EAAA,CAAA;AAEb;AAEA,SAAS,cAAc,EAAE,WAAW,QAAQ,UAAU,SAAS,GAAG,SAAyB;CACzF,MAAM,EAAE,OAAO,YAAY,mBAAmB;CAC9C,MAAM,WAAW,iBAAiB;CAClC,MAAM,MAAM,kBAAkB;CAE9B,MAAM,iBAAiB,OACrB,wBAAQ,IAAI,KAAK,GAAG,SAAS,QAAQ,GACrC,SAAS,KAAK,QAAQ,UACtB,EAAE,QAAQ,SAAS,OAAO,CAC5B;CACA,OACE,oBAAC,YAAD;EAAY,SAAS,YAAY,KAAA,IAAY,iBAAiB;EAC5D,UAAA,oBAAC,QAAD;GACE,SAAS,IAAI;GACb,MAAM,IAAI;GACV,aAAU;GACV,eAAa,WAAW,KAAA;GACxB,WAAW,G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AAS;GAClF,UAAU,MAAM;EAKoB,GAAG,KAAK;CAC9C,CAAC;AACH;;;;;;AASA,SAAS,SAAS,EAAE,WAAW,QAAQ,UAAU,GAAG,SAAwB;CAC1E,MAAM,aAAa,mBAAmB;CAyBtC,OAAO,UAAU;EACf,gBAAgB;EAChB;EACA,OAAO,WAAkB;GA1BzB,aAAa;GACb,WAAW,GAGT,gEACA,WAAW,aAAa,mCACxB,WAAW,YAAY,KACvB,SACF;GACA,UAAU,YAER,qBAAC,iBAAD;IAAiB,OAAO;IAAK,YAAY;IAAG,SAAS;IAArD,UAAA;KACE,oBAAC,eAAD,CAAgB,CAAA;KAChB,oBAAC,oBAAD,CAAqB,CAAA;KACrB,qBAAC,OAAD;MAAK,WAAU;MAAf,UAAA,CACE,oBAAC,cAAD,CAAe,CAAA,GACf,oBAAC,cAAD,CAAe,CAAA,CACZ;;KACL,oBAAC,YAAD,CAAa,CAAA;KACb,oBAAC,OAAD,EAAK,WAAU,OAAQ,CAAA;IACR;;EAMiB,GAAG,KAAK;CAC9C,CAAC;AACH"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { GanttDateRange, GanttEvent, GanttOccurrence, GanttRecurrenceRule } from "./gantt-types.js";
|
|
2
|
+
//#region src/components/reui/gantt/gantt-recurrence.d.ts
|
|
3
|
+
/** Guard: max occurrences per event per expansion. */
|
|
4
|
+
declare const MAX_OCCURRENCES = 1000;
|
|
5
|
+
declare class GanttRecurrenceError extends Error {
|
|
6
|
+
constructor(part: string);
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Parses a raw RRULE line (with or without the "RRULE:" prefix) into the
|
|
10
|
+
* structured subset. Pass the display time zone so a floating UNTIL
|
|
11
|
+
* (no trailing Z) resolves there instead of in the runtime's local zone.
|
|
12
|
+
*/
|
|
13
|
+
declare function parseRRuleString(input: string, timeZone?: string): GanttRecurrenceRule;
|
|
14
|
+
/** Serializes the structured subset back to an RRULE line (without prefix). */
|
|
15
|
+
declare function formatRRuleString(rule: GanttRecurrenceRule): string;
|
|
16
|
+
/**
|
|
17
|
+
* Expands one event into its occurrences intersecting the range.
|
|
18
|
+
* Non-recurring events yield at most one occurrence. Recurrence iteration is
|
|
19
|
+
* wall-time based in the display zone (DST-safe day/week/month steps).
|
|
20
|
+
*
|
|
21
|
+
* Supported subset: FREQ daily/weekly/monthly/yearly, INTERVAL, COUNT, UNTIL,
|
|
22
|
+
* weekly BYDAY (no ordinals). Parsed-but-unimplemented filters (BYMONTHDAY,
|
|
23
|
+
* BYMONTH, BYDAY outside weekly) throw a GanttRecurrenceError instead of
|
|
24
|
+
* silently mis-expanding; plug the getOccurrences prop for a full engine.
|
|
25
|
+
* WKST parses and round-trips; week emission is Sunday-anchored.
|
|
26
|
+
*
|
|
27
|
+
* exDates remove exactly-matching instants (after COUNT numbering,
|
|
28
|
+
* Google-style: an exception still consumes its COUNT slot); rDates add extra
|
|
29
|
+
* instants with the same duration. RECURRENCE-ID override replacement lives
|
|
30
|
+
* in buildEventIndex, where the override event and its parent series meet.
|
|
31
|
+
*/
|
|
32
|
+
declare function expandRecurrence<TData>(event: GanttEvent<TData>, range: GanttDateRange, ctx: {
|
|
33
|
+
timeZone: string;
|
|
34
|
+
}): GanttOccurrence<TData>[];
|
|
35
|
+
//#endregion
|
|
36
|
+
export { GanttRecurrenceError, MAX_OCCURRENCES, expandRecurrence, formatRRuleString, parseRRuleString };
|
|
37
|
+
//# sourceMappingURL=gantt-recurrence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gantt-recurrence.d.ts","names":[],"sources":["../../../../src/components/reui/gantt/gantt-recurrence.tsx"],"mappings":";;;cAcM;cAIA,6BAA6B;EACrB,YAAA;;;;;;;iBAaL,iBAAiB,eAAe,oBAAoB;;iBA4EpD,kBAAkB,MAAM;;;;;;;;;;;;;;;;;iBA+CxB,iBAAiB,OACxB,OAAO,WAAW,QAClB,OAAO,gBACP;EAAO;IACN,gBAAgB"}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { addDays, addMonths, addWeeks, addYears } from "date-fns";
|
|
3
|
+
import { TZDate } from "@date-fns/tz";
|
|
4
|
+
//#region src/components/reui/gantt/gantt-recurrence.tsx
|
|
5
|
+
/** Guard: max occurrences per event per expansion. */
|
|
6
|
+
const MAX_OCCURRENCES = 1e3;
|
|
7
|
+
const WEEKDAYS = [
|
|
8
|
+
"SU",
|
|
9
|
+
"MO",
|
|
10
|
+
"TU",
|
|
11
|
+
"WE",
|
|
12
|
+
"TH",
|
|
13
|
+
"FR",
|
|
14
|
+
"SA"
|
|
15
|
+
];
|
|
16
|
+
var GanttRecurrenceError = class extends Error {
|
|
17
|
+
constructor(part) {
|
|
18
|
+
super(`Unsupported recurrence part: ${part}. Use the getOccurrences prop to plug a full RRULE engine for exotic rules.`);
|
|
19
|
+
this.name = "GanttRecurrenceError";
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Parses a raw RRULE line (with or without the "RRULE:" prefix) into the
|
|
24
|
+
* structured subset. Pass the display time zone so a floating UNTIL
|
|
25
|
+
* (no trailing Z) resolves there instead of in the runtime's local zone.
|
|
26
|
+
*/
|
|
27
|
+
function parseRRuleString(input, timeZone) {
|
|
28
|
+
const body = input.trim().replace(/^RRULE:/i, "");
|
|
29
|
+
const rule = {};
|
|
30
|
+
for (const pair of body.split(";")) {
|
|
31
|
+
if (!pair) continue;
|
|
32
|
+
const [rawKey, rawValue] = pair.split("=");
|
|
33
|
+
const key = rawKey?.toUpperCase();
|
|
34
|
+
const value = rawValue ?? "";
|
|
35
|
+
switch (key) {
|
|
36
|
+
case "FREQ": {
|
|
37
|
+
const freq = value.toLowerCase();
|
|
38
|
+
if (freq !== "daily" && freq !== "weekly" && freq !== "monthly" && freq !== "yearly") throw new GanttRecurrenceError(`FREQ=${value}`);
|
|
39
|
+
rule.freq = freq;
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
case "INTERVAL":
|
|
43
|
+
rule.interval = Math.max(1, parseInt(value, 10) || 1);
|
|
44
|
+
break;
|
|
45
|
+
case "COUNT":
|
|
46
|
+
rule.count = Math.max(1, parseInt(value, 10) || 1);
|
|
47
|
+
break;
|
|
48
|
+
case "UNTIL":
|
|
49
|
+
rule.until = parseRRuleDate(value, timeZone);
|
|
50
|
+
break;
|
|
51
|
+
case "BYDAY":
|
|
52
|
+
rule.byWeekday = value.split(",").map((token) => {
|
|
53
|
+
const match = /^(-?\d+)?(SU|MO|TU|WE|TH|FR|SA)$/.exec(token.trim());
|
|
54
|
+
if (!match) throw new GanttRecurrenceError(`BYDAY=${token}`);
|
|
55
|
+
const day = match[2];
|
|
56
|
+
return match[1] ? {
|
|
57
|
+
day,
|
|
58
|
+
ordinal: parseInt(match[1], 10)
|
|
59
|
+
} : day;
|
|
60
|
+
});
|
|
61
|
+
break;
|
|
62
|
+
case "BYMONTHDAY":
|
|
63
|
+
rule.byMonthDay = value.split(",").map((v) => parseInt(v, 10));
|
|
64
|
+
break;
|
|
65
|
+
case "BYMONTH":
|
|
66
|
+
rule.byMonth = value.split(",").map((v) => parseInt(v, 10));
|
|
67
|
+
break;
|
|
68
|
+
case "WKST":
|
|
69
|
+
if (!WEEKDAYS.includes(value)) throw new GanttRecurrenceError(`WKST=${value}`);
|
|
70
|
+
rule.weekStart = value;
|
|
71
|
+
break;
|
|
72
|
+
default: throw new GanttRecurrenceError(key ?? pair);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (!rule.freq) throw new GanttRecurrenceError("missing FREQ");
|
|
76
|
+
return rule;
|
|
77
|
+
}
|
|
78
|
+
function parseRRuleDate(value, timeZone) {
|
|
79
|
+
const match = /^(\d{4})(\d{2})(\d{2})(?:T(\d{2})(\d{2})(\d{2})(Z)?)?$/.exec(value);
|
|
80
|
+
if (!match) throw new GanttRecurrenceError(`UNTIL=${value}`);
|
|
81
|
+
const [, y, m, d, hh = "23", mm = "59", ss = "59", z] = match;
|
|
82
|
+
const date = !z && timeZone ? new TZDate(+y, +m - 1, +d, +hh, +mm, +ss, timeZone) : /* @__PURE__ */ new Date(`${y}-${m}-${d}T${hh}:${mm}:${ss}${z ? "Z" : ""}`);
|
|
83
|
+
if (Number.isNaN(date.getTime())) throw new GanttRecurrenceError(`UNTIL=${value}`);
|
|
84
|
+
return new Date(date.getTime());
|
|
85
|
+
}
|
|
86
|
+
/** Serializes the structured subset back to an RRULE line (without prefix). */
|
|
87
|
+
function formatRRuleString(rule) {
|
|
88
|
+
const parts = [`FREQ=${rule.freq.toUpperCase()}`];
|
|
89
|
+
if (rule.interval && rule.interval > 1) parts.push(`INTERVAL=${rule.interval}`);
|
|
90
|
+
if (rule.count) parts.push(`COUNT=${rule.count}`);
|
|
91
|
+
if (rule.until) {
|
|
92
|
+
const u = rule.until;
|
|
93
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
94
|
+
parts.push(`UNTIL=${u.getUTCFullYear()}${pad(u.getUTCMonth() + 1)}${pad(u.getUTCDate())}T${pad(u.getUTCHours())}${pad(u.getUTCMinutes())}${pad(u.getUTCSeconds())}Z`);
|
|
95
|
+
}
|
|
96
|
+
if (rule.byWeekday?.length) parts.push(`BYDAY=${rule.byWeekday.map((d) => typeof d === "string" ? d : `${d.ordinal}${d.day}`).join(",")}`);
|
|
97
|
+
if (rule.byMonthDay?.length) parts.push(`BYMONTHDAY=${rule.byMonthDay.join(",")}`);
|
|
98
|
+
if (rule.byMonth?.length) parts.push(`BYMONTH=${rule.byMonth.join(",")}`);
|
|
99
|
+
if (rule.weekStart) parts.push(`WKST=${rule.weekStart}`);
|
|
100
|
+
return parts.join(";");
|
|
101
|
+
}
|
|
102
|
+
function resolveRule(recurrence, timeZone) {
|
|
103
|
+
return typeof recurrence === "string" ? parseRRuleString(recurrence, timeZone) : recurrence;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Expands one event into its occurrences intersecting the range.
|
|
107
|
+
* Non-recurring events yield at most one occurrence. Recurrence iteration is
|
|
108
|
+
* wall-time based in the display zone (DST-safe day/week/month steps).
|
|
109
|
+
*
|
|
110
|
+
* Supported subset: FREQ daily/weekly/monthly/yearly, INTERVAL, COUNT, UNTIL,
|
|
111
|
+
* weekly BYDAY (no ordinals). Parsed-but-unimplemented filters (BYMONTHDAY,
|
|
112
|
+
* BYMONTH, BYDAY outside weekly) throw a GanttRecurrenceError instead of
|
|
113
|
+
* silently mis-expanding; plug the getOccurrences prop for a full engine.
|
|
114
|
+
* WKST parses and round-trips; week emission is Sunday-anchored.
|
|
115
|
+
*
|
|
116
|
+
* exDates remove exactly-matching instants (after COUNT numbering,
|
|
117
|
+
* Google-style: an exception still consumes its COUNT slot); rDates add extra
|
|
118
|
+
* instants with the same duration. RECURRENCE-ID override replacement lives
|
|
119
|
+
* in buildEventIndex, where the override event and its parent series meet.
|
|
120
|
+
*/
|
|
121
|
+
function expandRecurrence(event, range, ctx) {
|
|
122
|
+
const allDay = event.allDay ?? false;
|
|
123
|
+
if (!event.recurrence) {
|
|
124
|
+
if (event.start < range.end && event.end > range.start) return [{
|
|
125
|
+
key: `${event.id}::${event.start.toISOString()}`,
|
|
126
|
+
eventId: event.id,
|
|
127
|
+
event,
|
|
128
|
+
start: event.start,
|
|
129
|
+
end: event.end,
|
|
130
|
+
allDay,
|
|
131
|
+
isRecurring: false
|
|
132
|
+
}];
|
|
133
|
+
return [];
|
|
134
|
+
}
|
|
135
|
+
const rule = resolveRule(event.recurrence, ctx.timeZone);
|
|
136
|
+
if (rule.byMonthDay?.length) throw new GanttRecurrenceError("BYMONTHDAY");
|
|
137
|
+
if (rule.byMonth?.length) throw new GanttRecurrenceError("BYMONTH");
|
|
138
|
+
if (rule.byWeekday?.length && rule.freq !== "weekly") throw new GanttRecurrenceError("BYDAY outside FREQ=WEEKLY");
|
|
139
|
+
const interval = Math.max(1, rule.interval ?? 1);
|
|
140
|
+
const durationMs = event.end.getTime() - event.start.getTime();
|
|
141
|
+
const zonedStart = new TZDate(event.start.getTime(), ctx.timeZone);
|
|
142
|
+
const exTimes = new Set((rule.exDates ?? []).map((d) => d.getTime()));
|
|
143
|
+
const weeklyDays = rule.freq === "weekly" && rule.byWeekday?.length ? rule.byWeekday.map((d) => {
|
|
144
|
+
if (typeof d !== "string") throw new GanttRecurrenceError("BYDAY ordinal outside monthly/yearly");
|
|
145
|
+
return WEEKDAYS.indexOf(d);
|
|
146
|
+
}) : null;
|
|
147
|
+
const occurrences = [];
|
|
148
|
+
let produced = 0;
|
|
149
|
+
let index = 0;
|
|
150
|
+
let cursor = zonedStart;
|
|
151
|
+
const advance = (from, steps) => rule.freq === "daily" ? addDays(from, steps * interval) : rule.freq === "weekly" ? addWeeks(from, steps * interval) : rule.freq === "monthly" ? addMonths(from, steps * interval) : addYears(from, steps * interval);
|
|
152
|
+
if (rule.count === void 0) {
|
|
153
|
+
const weekSlackMs = weeklyDays ? 6 * 864e5 : 0;
|
|
154
|
+
const maxStepMs = (rule.freq === "daily" ? 24 : rule.freq === "weekly" ? 168 : rule.freq === "monthly" ? 744 : 366 * 24) * 36e5 * interval + 36e5;
|
|
155
|
+
for (let pass = 0; pass < 2; pass++) {
|
|
156
|
+
const gap = range.start.getTime() - durationMs - weekSlackMs - cursor.getTime();
|
|
157
|
+
const skip = Math.floor(gap / maxStepMs);
|
|
158
|
+
if (skip <= 0) break;
|
|
159
|
+
cursor = advance(cursor, skip);
|
|
160
|
+
index += skip * (weeklyDays ? weeklyDays.length : 1);
|
|
161
|
+
}
|
|
162
|
+
let guard = 0;
|
|
163
|
+
while (guard++ < 1e4 && !(rule.until && cursor.getTime() > rule.until.getTime()) && cursor.getTime() + durationMs + weekSlackMs < range.start.getTime()) {
|
|
164
|
+
cursor = advance(cursor, 1);
|
|
165
|
+
index += weeklyDays ? weeklyDays.length : 1;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
const pushIfVisible = (rawStart) => {
|
|
169
|
+
const start = new Date(rawStart.getTime());
|
|
170
|
+
if (exTimes.has(start.getTime())) return;
|
|
171
|
+
const end = new Date(start.getTime() + durationMs);
|
|
172
|
+
if (start < range.end && end > range.start) occurrences.push({
|
|
173
|
+
key: `${event.id}::${start.toISOString()}`,
|
|
174
|
+
eventId: event.id,
|
|
175
|
+
event,
|
|
176
|
+
start,
|
|
177
|
+
end,
|
|
178
|
+
allDay,
|
|
179
|
+
isRecurring: true,
|
|
180
|
+
recurrenceIndex: index
|
|
181
|
+
});
|
|
182
|
+
};
|
|
183
|
+
while (produced < MAX_OCCURRENCES) {
|
|
184
|
+
if (rule.until && cursor.getTime() > rule.until.getTime()) break;
|
|
185
|
+
if (rule.count !== void 0 && produced >= rule.count) break;
|
|
186
|
+
if ((weeklyDays ? addDays(cursor, -cursor.getDay()).getTime() : cursor.getTime()) >= range.end.getTime() && rule.count === void 0) break;
|
|
187
|
+
if (rule.freq === "weekly" && weeklyDays) for (let d = 0; d < 7; d++) {
|
|
188
|
+
const candidate = addDays(cursor, d - cursor.getDay());
|
|
189
|
+
if (!weeklyDays.includes(candidate.getDay())) continue;
|
|
190
|
+
if (candidate.getTime() < zonedStart.getTime()) continue;
|
|
191
|
+
if (rule.until && candidate.getTime() > rule.until.getTime()) continue;
|
|
192
|
+
if (rule.count !== void 0 && produced >= rule.count) break;
|
|
193
|
+
pushIfVisible(candidate);
|
|
194
|
+
produced++;
|
|
195
|
+
index++;
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
pushIfVisible(cursor);
|
|
199
|
+
produced++;
|
|
200
|
+
index++;
|
|
201
|
+
}
|
|
202
|
+
cursor = advance(cursor, 1);
|
|
203
|
+
}
|
|
204
|
+
if (rule.rDates?.length) {
|
|
205
|
+
const seen = new Set(occurrences.map((o) => o.start.getTime()));
|
|
206
|
+
for (const rDate of rule.rDates) {
|
|
207
|
+
const start = new Date(rDate.getTime());
|
|
208
|
+
if (seen.has(start.getTime()) || exTimes.has(start.getTime())) continue;
|
|
209
|
+
const end = new Date(start.getTime() + durationMs);
|
|
210
|
+
if (start >= range.end || end <= range.start) continue;
|
|
211
|
+
seen.add(start.getTime());
|
|
212
|
+
occurrences.push({
|
|
213
|
+
key: `${event.id}::${start.toISOString()}`,
|
|
214
|
+
eventId: event.id,
|
|
215
|
+
event,
|
|
216
|
+
start,
|
|
217
|
+
end,
|
|
218
|
+
allDay,
|
|
219
|
+
isRecurring: true,
|
|
220
|
+
recurrenceIndex: index++
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
occurrences.sort((a, b) => a.start.getTime() - b.start.getTime());
|
|
224
|
+
}
|
|
225
|
+
return occurrences;
|
|
226
|
+
}
|
|
227
|
+
//#endregion
|
|
228
|
+
export { GanttRecurrenceError, MAX_OCCURRENCES, expandRecurrence, formatRRuleString, parseRRuleString };
|
|
229
|
+
|
|
230
|
+
//# sourceMappingURL=gantt-recurrence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gantt-recurrence.js","names":[],"sources":["../../../../src/components/reui/gantt/gantt-recurrence.tsx"],"sourcesContent":["\"use client\";\n\nimport { TZDate } from \"@date-fns/tz\";\nimport { addDays, addMonths, addWeeks, addYears } from \"date-fns\";\n\nimport type {\n GanttDateRange,\n GanttEvent,\n GanttOccurrence,\n GanttRecurrenceRule,\n GanttWeekday,\n} from \"./gantt-types\";\n\n/** Guard: max occurrences per event per expansion. */\nconst MAX_OCCURRENCES = 1000;\n\nconst WEEKDAYS: GanttWeekday[] = [\"SU\", \"MO\", \"TU\", \"WE\", \"TH\", \"FR\", \"SA\"];\n\nclass GanttRecurrenceError extends Error {\n constructor(part: string) {\n super(\n `Unsupported recurrence part: ${part}. Use the getOccurrences prop to plug a full RRULE engine for exotic rules.`,\n );\n this.name = \"GanttRecurrenceError\";\n }\n}\n\n/**\n * Parses a raw RRULE line (with or without the \"RRULE:\" prefix) into the\n * structured subset. Pass the display time zone so a floating UNTIL\n * (no trailing Z) resolves there instead of in the runtime's local zone.\n */\nfunction parseRRuleString(input: string, timeZone?: string): GanttRecurrenceRule {\n const body = input.trim().replace(/^RRULE:/i, \"\");\n const rule: Partial<GanttRecurrenceRule> = {};\n\n for (const pair of body.split(\";\")) {\n if (!pair) continue;\n const [rawKey, rawValue] = pair.split(\"=\");\n const key = rawKey?.toUpperCase();\n const value = rawValue ?? \"\";\n\n switch (key) {\n case \"FREQ\": {\n const freq = value.toLowerCase();\n if (freq !== \"daily\" && freq !== \"weekly\" && freq !== \"monthly\" && freq !== \"yearly\") {\n throw new GanttRecurrenceError(`FREQ=${value}`);\n }\n rule.freq = freq;\n break;\n }\n case \"INTERVAL\":\n rule.interval = Math.max(1, parseInt(value, 10) || 1);\n break;\n case \"COUNT\":\n rule.count = Math.max(1, parseInt(value, 10) || 1);\n break;\n case \"UNTIL\":\n rule.until = parseRRuleDate(value, timeZone);\n break;\n case \"BYDAY\":\n rule.byWeekday = value.split(\",\").map((token) => {\n const match = /^(-?\\d+)?(SU|MO|TU|WE|TH|FR|SA)$/.exec(token.trim());\n if (!match) throw new GanttRecurrenceError(`BYDAY=${token}`);\n const day = match[2] as GanttWeekday;\n return match[1] ? { day, ordinal: parseInt(match[1], 10) } : day;\n });\n break;\n case \"BYMONTHDAY\":\n rule.byMonthDay = value.split(\",\").map((v) => parseInt(v, 10));\n break;\n case \"BYMONTH\":\n rule.byMonth = value.split(\",\").map((v) => parseInt(v, 10));\n break;\n case \"WKST\": {\n if (!WEEKDAYS.includes(value as GanttWeekday)) {\n throw new GanttRecurrenceError(`WKST=${value}`);\n }\n rule.weekStart = value as GanttWeekday;\n break;\n }\n default:\n throw new GanttRecurrenceError(key ?? pair);\n }\n }\n\n if (!rule.freq) throw new GanttRecurrenceError(\"missing FREQ\");\n return rule as GanttRecurrenceRule;\n}\n\nfunction parseRRuleDate(value: string, timeZone?: string): Date {\n // RFC 5545 basic formats: YYYYMMDD or YYYYMMDDTHHMMSS(Z)\n const match = /^(\\d{4})(\\d{2})(\\d{2})(?:T(\\d{2})(\\d{2})(\\d{2})(Z)?)?$/.exec(value);\n if (!match) throw new GanttRecurrenceError(`UNTIL=${value}`);\n const [, y, m, d, hh = \"23\", mm = \"59\", ss = \"59\", z] = match;\n // Floating (non-Z) boundaries resolve in the DISPLAY zone when known -\n // local-zone parsing would shift the series end per visitor machine.\n const date =\n !z && timeZone\n ? new TZDate(+y, +m - 1, +d, +hh, +mm, +ss, timeZone)\n : new Date(`${y}-${m}-${d}T${hh}:${mm}:${ss}${z ? \"Z\" : \"\"}`);\n if (Number.isNaN(date.getTime())) {\n throw new GanttRecurrenceError(`UNTIL=${value}`);\n }\n return new Date(date.getTime());\n}\n\n/** Serializes the structured subset back to an RRULE line (without prefix). */\nfunction formatRRuleString(rule: GanttRecurrenceRule): string {\n const parts: string[] = [`FREQ=${rule.freq.toUpperCase()}`];\n if (rule.interval && rule.interval > 1) parts.push(`INTERVAL=${rule.interval}`);\n if (rule.count) parts.push(`COUNT=${rule.count}`);\n if (rule.until) {\n const u = rule.until;\n const pad = (n: number) => String(n).padStart(2, \"0\");\n parts.push(\n `UNTIL=${u.getUTCFullYear()}${pad(u.getUTCMonth() + 1)}${pad(u.getUTCDate())}T${pad(u.getUTCHours())}${pad(u.getUTCMinutes())}${pad(u.getUTCSeconds())}Z`,\n );\n }\n if (rule.byWeekday?.length) {\n parts.push(\n `BYDAY=${rule.byWeekday\n .map((d) => (typeof d === \"string\" ? d : `${d.ordinal}${d.day}`))\n .join(\",\")}`,\n );\n }\n if (rule.byMonthDay?.length) parts.push(`BYMONTHDAY=${rule.byMonthDay.join(\",\")}`);\n if (rule.byMonth?.length) parts.push(`BYMONTH=${rule.byMonth.join(\",\")}`);\n if (rule.weekStart) parts.push(`WKST=${rule.weekStart}`);\n return parts.join(\";\");\n}\n\nfunction resolveRule(\n recurrence: GanttRecurrenceRule | string,\n timeZone?: string,\n): GanttRecurrenceRule {\n return typeof recurrence === \"string\" ? parseRRuleString(recurrence, timeZone) : recurrence;\n}\n\n/**\n * Expands one event into its occurrences intersecting the range.\n * Non-recurring events yield at most one occurrence. Recurrence iteration is\n * wall-time based in the display zone (DST-safe day/week/month steps).\n *\n * Supported subset: FREQ daily/weekly/monthly/yearly, INTERVAL, COUNT, UNTIL,\n * weekly BYDAY (no ordinals). Parsed-but-unimplemented filters (BYMONTHDAY,\n * BYMONTH, BYDAY outside weekly) throw a GanttRecurrenceError instead of\n * silently mis-expanding; plug the getOccurrences prop for a full engine.\n * WKST parses and round-trips; week emission is Sunday-anchored.\n *\n * exDates remove exactly-matching instants (after COUNT numbering,\n * Google-style: an exception still consumes its COUNT slot); rDates add extra\n * instants with the same duration. RECURRENCE-ID override replacement lives\n * in buildEventIndex, where the override event and its parent series meet.\n */\nfunction expandRecurrence<TData>(\n event: GanttEvent<TData>,\n range: GanttDateRange,\n ctx: { timeZone: string },\n): GanttOccurrence<TData>[] {\n const allDay = event.allDay ?? false;\n\n if (!event.recurrence) {\n if (event.start < range.end && event.end > range.start) {\n return [\n {\n key: `${event.id}::${event.start.toISOString()}`,\n eventId: event.id,\n event,\n start: event.start,\n end: event.end,\n allDay,\n isRecurring: false,\n },\n ];\n }\n return [];\n }\n\n const rule = resolveRule(event.recurrence, ctx.timeZone);\n // Loud contract: silently ignoring a filter would emit WRONG occurrences.\n if (rule.byMonthDay?.length) throw new GanttRecurrenceError(\"BYMONTHDAY\");\n if (rule.byMonth?.length) throw new GanttRecurrenceError(\"BYMONTH\");\n if (rule.byWeekday?.length && rule.freq !== \"weekly\") {\n throw new GanttRecurrenceError(\"BYDAY outside FREQ=WEEKLY\");\n }\n const interval = Math.max(1, rule.interval ?? 1);\n const durationMs = event.end.getTime() - event.start.getTime();\n const zonedStart = new TZDate(event.start.getTime(), ctx.timeZone);\n // Excluded instants matched exactly; filtering happens at push time so an\n // exception still consumes its COUNT slot (Google-style numbering).\n const exTimes = new Set((rule.exDates ?? []).map((d) => d.getTime()));\n\n const weeklyDays: number[] | null =\n rule.freq === \"weekly\" && rule.byWeekday?.length\n ? rule.byWeekday.map((d) => {\n if (typeof d !== \"string\") {\n throw new GanttRecurrenceError(\"BYDAY ordinal outside monthly/yearly\");\n }\n return WEEKDAYS.indexOf(d);\n })\n : null;\n\n const occurrences: GanttOccurrence<TData>[] = [];\n let produced = 0;\n let index = 0;\n let cursor = zonedStart;\n\n const advance = (from: TZDate, steps: number): TZDate =>\n rule.freq === \"daily\"\n ? addDays(from, steps * interval)\n : rule.freq === \"weekly\"\n ? addWeeks(from, steps * interval)\n : rule.freq === \"monthly\"\n ? addMonths(from, steps * interval)\n : addYears(from, steps * interval);\n\n // Fast-forward past periods entirely before the range: they produce\n // nothing and must not consume the occurrence cap (an old-enough daily\n // series would otherwise exhaust MAX_OCCURRENCES before reaching the\n // window and silently vanish). COUNT rules keep full iteration - every\n // period consumes the count, so they stay exact and are bounded by count.\n if (rule.count === undefined) {\n // weekly BYDAY emits across the cursor's whole Sunday week\n const weekSlackMs = weeklyDays ? 6 * 86_400_000 : 0;\n // divide by the LONGEST possible step so the jump can never overshoot\n const maxStepMs =\n (rule.freq === \"daily\"\n ? 24\n : rule.freq === \"weekly\"\n ? 7 * 24\n : rule.freq === \"monthly\"\n ? 31 * 24\n : 366 * 24) *\n 3_600_000 *\n interval +\n 3_600_000;\n for (let pass = 0; pass < 2; pass++) {\n const gap = range.start.getTime() - durationMs - weekSlackMs - cursor.getTime();\n const skip = Math.floor(gap / maxStepMs);\n if (skip <= 0) break;\n cursor = advance(cursor, skip);\n index += skip * (weeklyDays ? weeklyDays.length : 1);\n }\n // close the remainder step by step (bounded by the jump math)\n let guard = 0;\n while (\n guard++ < 10_000 &&\n !(rule.until && cursor.getTime() > rule.until.getTime()) &&\n cursor.getTime() + durationMs + weekSlackMs < range.start.getTime()\n ) {\n cursor = advance(cursor, 1);\n index += weeklyDays ? weeklyDays.length : 1;\n }\n }\n\n const pushIfVisible = (rawStart: Date) => {\n // normalize to a plain instant so consumers never receive zone-carrying\n // TZDate instances (mixed-zone formatting bugs)\n const start = new Date(rawStart.getTime());\n if (exTimes.has(start.getTime())) return;\n const end = new Date(start.getTime() + durationMs);\n if (start < range.end && end > range.start) {\n occurrences.push({\n key: `${event.id}::${start.toISOString()}`,\n eventId: event.id,\n event,\n start,\n end,\n allDay,\n isRecurring: true,\n recurrenceIndex: index,\n });\n }\n };\n\n while (produced < MAX_OCCURRENCES) {\n if (rule.until && cursor.getTime() > rule.until.getTime()) break;\n if (rule.count !== undefined && produced >= rule.count) break;\n // Past the visible window with no count to honor - stop iterating. For\n // weekly BYDAY the WEEK START decides: selected days earlier in the\n // anchor's week can still fall before range.end.\n const horizonMs = weeklyDays ? addDays(cursor, -cursor.getDay()).getTime() : cursor.getTime();\n if (horizonMs >= range.end.getTime() && rule.count === undefined) {\n break;\n }\n\n if (rule.freq === \"weekly\" && weeklyDays) {\n // Emit each selected weekday within the cursor's week\n for (let d = 0; d < 7; d++) {\n const candidate = addDays(cursor, d - cursor.getDay());\n if (!weeklyDays.includes(candidate.getDay())) continue;\n if (candidate.getTime() < zonedStart.getTime()) continue;\n if (rule.until && candidate.getTime() > rule.until.getTime()) continue;\n if (rule.count !== undefined && produced >= rule.count) break;\n pushIfVisible(candidate);\n produced++;\n index++;\n }\n } else {\n pushIfVisible(cursor);\n produced++;\n index++;\n }\n\n cursor = advance(cursor, 1);\n }\n\n // RDATE: extra instants join the set (deduped against generated starts and\n // exclusions) with the same wall-time duration. Sorted so direct consumers\n // still receive chronological order (buildEventIndex re-sorts regardless).\n if (rule.rDates?.length) {\n const seen = new Set(occurrences.map((o) => o.start.getTime()));\n for (const rDate of rule.rDates) {\n const start = new Date(rDate.getTime());\n if (seen.has(start.getTime()) || exTimes.has(start.getTime())) continue;\n const end = new Date(start.getTime() + durationMs);\n if (start >= range.end || end <= range.start) continue;\n seen.add(start.getTime());\n occurrences.push({\n key: `${event.id}::${start.toISOString()}`,\n eventId: event.id,\n event,\n start,\n end,\n allDay,\n isRecurring: true,\n // keep counting past the generated instants: an RDATE with no index\n // would fall back to 0 and collide with the series' first occurrence\n // in any consumer that identifies an instance by its position\n recurrenceIndex: index++,\n });\n }\n occurrences.sort((a, b) => a.start.getTime() - b.start.getTime());\n }\n\n return occurrences;\n}\n\nexport {\n expandRecurrence,\n formatRRuleString,\n GanttRecurrenceError,\n MAX_OCCURRENCES,\n parseRRuleString,\n};\n"],"mappings":";;;;;AAcA,MAAM,kBAAkB;AAExB,MAAM,WAA2B;CAAC;CAAM;CAAM;CAAM;CAAM;CAAM;CAAM;AAAI;AAE1E,IAAM,uBAAN,cAAmC,MAAM;CACvC,YAAY,MAAc;EACxB,MACE,gCAAgC,KAAK,4EACvC;EACA,KAAK,OAAO;CACd;AACF;;;;;;AAOA,SAAS,iBAAiB,OAAe,UAAwC;CAC/E,MAAM,OAAO,MAAM,KAAK,CAAC,CAAC,QAAQ,YAAY,EAAE;CAChD,MAAM,OAAqC,CAAC;CAE5C,KAAK,MAAM,QAAQ,KAAK,MAAM,GAAG,GAAG;EAClC,IAAI,CAAC,MAAM;EACX,MAAM,CAAC,QAAQ,YAAY,KAAK,MAAM,GAAG;EACzC,MAAM,MAAM,QAAQ,YAAY;EAChC,MAAM,QAAQ,YAAY;EAE1B,QAAQ,KAAR;GACE,KAAK,QAAQ;IACX,MAAM,OAAO,MAAM,YAAY;IAC/B,IAAI,SAAS,WAAW,SAAS,YAAY,SAAS,aAAa,SAAS,UAC1E,MAAM,IAAI,qBAAqB,QAAQ,OAAO;IAEhD,KAAK,OAAO;IACZ;GACF;GACA,KAAK;IACH,KAAK,WAAW,KAAK,IAAI,GAAG,SAAS,OAAO,EAAE,KAAK,CAAC;IACpD;GACF,KAAK;IACH,KAAK,QAAQ,KAAK,IAAI,GAAG,SAAS,OAAO,EAAE,KAAK,CAAC;IACjD;GACF,KAAK;IACH,KAAK,QAAQ,eAAe,OAAO,QAAQ;IAC3C;GACF,KAAK;IACH,KAAK,YAAY,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,UAAU;KAC/C,MAAM,QAAQ,mCAAmC,KAAK,MAAM,KAAK,CAAC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