@kumix/ui 0.1.2 → 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 +118 -88
- 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/theme.css +244 -0
- package/dist/theme.css.d.ts +3 -0
- package/package.json +105 -36
- 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/use-is-mobile-Dln4-L1O.js +0 -210
- package/dist/use-is-mobile-Dln4-L1O.js.map +0 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
4
|
+
import { DndContext, DragCancelEvent, DragEndEvent, DragOverlay, DragStartEvent, Modifiers, UniqueIdentifier } from "@dnd-kit/core";
|
|
5
|
+
//#region src/components/reui/sortable.d.ts
|
|
6
|
+
interface SortableCommitMeta<T> {
|
|
7
|
+
event: DragEndEvent;
|
|
8
|
+
activeIndex: number;
|
|
9
|
+
overIndex: number;
|
|
10
|
+
previousValue: T[];
|
|
11
|
+
}
|
|
12
|
+
interface SortableRootProps<T> extends Omit<useRender.ComponentProps<"div">, "onDragStart" | "onDragEnd" | "children"> {
|
|
13
|
+
value: T[];
|
|
14
|
+
onValueChange: (value: T[]) => void;
|
|
15
|
+
getItemValue: (item: T) => string;
|
|
16
|
+
children: ReactNode;
|
|
17
|
+
onMove?: (event: {
|
|
18
|
+
event: DragEndEvent;
|
|
19
|
+
activeIndex: number;
|
|
20
|
+
overIndex: number;
|
|
21
|
+
}) => void;
|
|
22
|
+
onValueCommit?: (value: T[], meta: SortableCommitMeta<T>) => void;
|
|
23
|
+
strategy?: "horizontal" | "vertical" | "grid";
|
|
24
|
+
onDragStart?: (event: DragStartEvent) => void;
|
|
25
|
+
onDragEnd?: (event: DragEndEvent) => void;
|
|
26
|
+
onDragCancel?: (event: DragCancelEvent) => void;
|
|
27
|
+
accessibility?: React$1.ComponentProps<typeof DndContext>["accessibility"];
|
|
28
|
+
modifiers?: Modifiers;
|
|
29
|
+
}
|
|
30
|
+
declare function Sortable<T>({ value, onValueChange, getItemValue, className, render, onMove, onValueCommit, strategy, onDragStart, onDragEnd, onDragCancel, accessibility, modifiers, children, ...props }: SortableRootProps<T>): React$1.JSX.Element;
|
|
31
|
+
interface SortableItemProps extends useRender.ComponentProps<"div"> {
|
|
32
|
+
value: string;
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
}
|
|
35
|
+
declare function SortableItem({ value, className, render, disabled, ...props }: SortableItemProps): React$1.JSX.Element;
|
|
36
|
+
interface SortableItemHandleProps extends useRender.ComponentProps<"div"> {
|
|
37
|
+
cursor?: boolean;
|
|
38
|
+
}
|
|
39
|
+
declare function SortableItemHandle({ className, render, cursor, ...props }: SortableItemHandleProps): React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>>;
|
|
40
|
+
interface SortableOverlayProps extends Omit<React$1.ComponentProps<typeof DragOverlay>, "children"> {
|
|
41
|
+
children?: ReactNode | ((params: {
|
|
42
|
+
value: UniqueIdentifier;
|
|
43
|
+
}) => ReactNode);
|
|
44
|
+
}
|
|
45
|
+
declare function SortableOverlay({ children, className, ...props }: SortableOverlayProps): React$1.ReactPortal | null;
|
|
46
|
+
//#endregion
|
|
47
|
+
export { Sortable, SortableCommitMeta, SortableItem, SortableItemHandle, SortableItemHandleProps, SortableItemProps, SortableOverlay, SortableOverlayProps, SortableRootProps };
|
|
48
|
+
//# sourceMappingURL=sortable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sortable.d.ts","names":[],"sources":["../../../src/components/reui/sortable.tsx"],"mappings":";;;;;UAuGiB,mBAAmB;EAClC,OAAO;EACP;EACA;EACA,eAAe;;UAGA,kBAAkB,WACzB,KAAK,UAAU;EACvB,OAAO;EACP,gBAAgB,OAAO;EACvB,eAAe,MAAM;EACrB,UAAU;EACV,UAAU;IAAS,OAAO;IAAc;IAAqB;;EAC7D,iBAAiB,OAAO,KAAK,MAAM,mBAAmB;EACtD;EACA,eAAe,OAAO;EACtB,aAAa,OAAO;EACpB,gBAAgB,OAAO;EACvB,gBAAgB,QAAM,sBAAsB;EAC5C,YAAY;;iBAGL,SAAS,KAChB,OACA,eACA,cACA,WACA,QACA,QACA,eACA,UACA,aACA,WACA,cACA,eACA,WACA,aACG,SACF,kBAAkB,KAAE,QAAA,IAAA;UA4IN,0BAA0B,UAAU;EACnD;EACA;;iBAGO,eAAe,OAAO,WAAW,QAAQ,aAAa,SAAS,oBAAiB,QAAA,IAAA;UA0DxE,gCAAgC,UAAU;EACzD;;iBAGO,qBACP,WACA,QACA,WACG,SACF,0BAAuB,QAAA,+BAAA,QAAA;UAmBT,6BACP,KAAK,QAAM,sBAAsB;EACzC,WAAW,cAAc;IAAU,OAAO;QAAuB;;iBAG1D,kBAAkB,UAAU,cAAc,SAAS,uBAAoB,QAAA"}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Children, cloneElement, createContext, isValidElement, useCallback, useContext, useLayoutEffect, useMemo, useState } from "react";
|
|
3
|
+
import { cn } from "@kumix/utils";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
6
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
7
|
+
import { DndContext, DragOverlay, KeyboardSensor, MeasuringStrategy, MouseSensor, TouchSensor, defaultDropAnimationSideEffects, useSensor, useSensors } from "@dnd-kit/core";
|
|
8
|
+
import { SortableContext, arrayMove, defaultAnimateLayoutChanges, rectSortingStrategy, sortableKeyboardCoordinates, useSortable, verticalListSortingStrategy } from "@dnd-kit/sortable";
|
|
9
|
+
import { CSS } from "@dnd-kit/utilities";
|
|
10
|
+
import { createPortal } from "react-dom";
|
|
11
|
+
//#region src/components/reui/sortable.tsx
|
|
12
|
+
const SortableItemContext = createContext({
|
|
13
|
+
listeners: void 0,
|
|
14
|
+
isDragging: false,
|
|
15
|
+
disabled: false
|
|
16
|
+
});
|
|
17
|
+
const IsOverlayContext = createContext(false);
|
|
18
|
+
const SortableInternalContext = createContext({
|
|
19
|
+
activeId: null,
|
|
20
|
+
modifiers: void 0
|
|
21
|
+
});
|
|
22
|
+
const animateLayoutChanges = (args) => defaultAnimateLayoutChanges({
|
|
23
|
+
...args,
|
|
24
|
+
wasDragging: true
|
|
25
|
+
});
|
|
26
|
+
const dropAnimationConfig = { sideEffects: defaultDropAnimationSideEffects({ styles: { active: { opacity: "0.4" } } }) };
|
|
27
|
+
const MOUSE_SENSOR_OPTIONS = { activationConstraint: { distance: 10 } };
|
|
28
|
+
const TOUCH_SENSOR_OPTIONS = { activationConstraint: {
|
|
29
|
+
delay: 250,
|
|
30
|
+
tolerance: 5
|
|
31
|
+
} };
|
|
32
|
+
const KEYBOARD_SENSOR_OPTIONS = { coordinateGetter: sortableKeyboardCoordinates };
|
|
33
|
+
const MEASURING_CONFIG = { droppable: { strategy: MeasuringStrategy.Always } };
|
|
34
|
+
const STRATEGY_MAP = {
|
|
35
|
+
horizontal: rectSortingStrategy,
|
|
36
|
+
grid: rectSortingStrategy,
|
|
37
|
+
vertical: verticalListSortingStrategy
|
|
38
|
+
};
|
|
39
|
+
function Sortable({ value, onValueChange, getItemValue, className, render, onMove, onValueCommit, strategy = "vertical", onDragStart, onDragEnd, onDragCancel, accessibility, modifiers, children, ...props }) {
|
|
40
|
+
const [activeId, setActiveId] = useState(null);
|
|
41
|
+
const [mounted, setMounted] = useState(false);
|
|
42
|
+
useLayoutEffect(() => setMounted(true), []);
|
|
43
|
+
const sensors = useSensors(useSensor(MouseSensor, MOUSE_SENSOR_OPTIONS), useSensor(TouchSensor, TOUCH_SENSOR_OPTIONS), useSensor(KeyboardSensor, KEYBOARD_SENSOR_OPTIONS));
|
|
44
|
+
const handleDragStart = useCallback((event) => {
|
|
45
|
+
setActiveId(event.active.id);
|
|
46
|
+
onDragStart?.(event);
|
|
47
|
+
}, [onDragStart]);
|
|
48
|
+
const handleDragEnd = useCallback((event) => {
|
|
49
|
+
const { active, over } = event;
|
|
50
|
+
setActiveId(null);
|
|
51
|
+
onDragEnd?.(event);
|
|
52
|
+
if (!over) return;
|
|
53
|
+
const activeIndex = value.findIndex((item) => getItemValue(item) === active.id);
|
|
54
|
+
const overIndex = value.findIndex((item) => getItemValue(item) === over.id);
|
|
55
|
+
if (activeIndex === -1 || overIndex === -1) return;
|
|
56
|
+
if (activeIndex !== overIndex) if (onMove) onMove({
|
|
57
|
+
event,
|
|
58
|
+
activeIndex,
|
|
59
|
+
overIndex
|
|
60
|
+
});
|
|
61
|
+
else {
|
|
62
|
+
const newValue = arrayMove(value, activeIndex, overIndex);
|
|
63
|
+
onValueChange(newValue);
|
|
64
|
+
onValueCommit?.(newValue, {
|
|
65
|
+
event,
|
|
66
|
+
activeIndex,
|
|
67
|
+
overIndex,
|
|
68
|
+
previousValue: value
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}, [
|
|
72
|
+
value,
|
|
73
|
+
getItemValue,
|
|
74
|
+
onValueChange,
|
|
75
|
+
onMove,
|
|
76
|
+
onDragEnd,
|
|
77
|
+
onValueCommit
|
|
78
|
+
]);
|
|
79
|
+
const handleDragCancel = useCallback((event) => {
|
|
80
|
+
setActiveId(null);
|
|
81
|
+
onDragCancel?.(event);
|
|
82
|
+
}, [onDragCancel]);
|
|
83
|
+
const itemIds = useMemo(() => {
|
|
84
|
+
const ids = value.map(getItemValue);
|
|
85
|
+
if (process.env.NODE_ENV !== "production") {
|
|
86
|
+
const seen = /* @__PURE__ */ new Set();
|
|
87
|
+
for (const id of ids) {
|
|
88
|
+
if (seen.has(id)) {
|
|
89
|
+
console.warn(`[Sortable] Duplicate item id "${id}". Item ids must be unique, or drag and drop will misbehave.`);
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
seen.add(id);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return ids;
|
|
96
|
+
}, [value, getItemValue]);
|
|
97
|
+
const contextValue = useMemo(() => ({
|
|
98
|
+
activeId,
|
|
99
|
+
modifiers
|
|
100
|
+
}), [activeId, modifiers]);
|
|
101
|
+
const defaultProps = {
|
|
102
|
+
"data-slot": "sortable",
|
|
103
|
+
"data-dragging": activeId !== null,
|
|
104
|
+
className: cn(activeId !== null && "cursor-grabbing!", className),
|
|
105
|
+
children
|
|
106
|
+
};
|
|
107
|
+
const overlayContent = useMemo(() => {
|
|
108
|
+
if (!activeId) return null;
|
|
109
|
+
let result = null;
|
|
110
|
+
Children.forEach(children, (child) => {
|
|
111
|
+
if (!isValidElement(child)) return;
|
|
112
|
+
const props = child.props;
|
|
113
|
+
if (props.value === activeId) result = cloneElement(child, {
|
|
114
|
+
...props,
|
|
115
|
+
className: cn(props.className, "z-50")
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
return result;
|
|
119
|
+
}, [activeId, children]);
|
|
120
|
+
return /* @__PURE__ */ jsx(SortableInternalContext.Provider, {
|
|
121
|
+
value: contextValue,
|
|
122
|
+
children: /* @__PURE__ */ jsxs(DndContext, {
|
|
123
|
+
sensors,
|
|
124
|
+
modifiers,
|
|
125
|
+
accessibility,
|
|
126
|
+
measuring: MEASURING_CONFIG,
|
|
127
|
+
onDragStart: handleDragStart,
|
|
128
|
+
onDragEnd: handleDragEnd,
|
|
129
|
+
onDragCancel: handleDragCancel,
|
|
130
|
+
children: [/* @__PURE__ */ jsx(SortableContext, {
|
|
131
|
+
items: itemIds,
|
|
132
|
+
strategy: STRATEGY_MAP[strategy] ?? verticalListSortingStrategy,
|
|
133
|
+
children: useRender({
|
|
134
|
+
defaultTagName: "div",
|
|
135
|
+
render,
|
|
136
|
+
props: mergeProps(defaultProps, props)
|
|
137
|
+
})
|
|
138
|
+
}), mounted && createPortal(/* @__PURE__ */ jsx(DragOverlay, {
|
|
139
|
+
dropAnimation: dropAnimationConfig,
|
|
140
|
+
modifiers,
|
|
141
|
+
className: cn("z-50", activeId && "cursor-grabbing"),
|
|
142
|
+
children: /* @__PURE__ */ jsx(IsOverlayContext.Provider, {
|
|
143
|
+
value: true,
|
|
144
|
+
children: overlayContent
|
|
145
|
+
})
|
|
146
|
+
}), document.body)]
|
|
147
|
+
})
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
function SortableItem({ value, className, render, disabled, ...props }) {
|
|
151
|
+
const isOverlay = useContext(IsOverlayContext);
|
|
152
|
+
const { setNodeRef, transform, transition, attributes, listeners, isDragging: isSortableDragging } = useSortable({
|
|
153
|
+
id: value,
|
|
154
|
+
disabled: disabled || isOverlay,
|
|
155
|
+
animateLayoutChanges
|
|
156
|
+
});
|
|
157
|
+
const style = {
|
|
158
|
+
transition,
|
|
159
|
+
transform: CSS.Transform.toString(transform)
|
|
160
|
+
};
|
|
161
|
+
const defaultProps = isOverlay ? {
|
|
162
|
+
"data-slot": "sortable-item",
|
|
163
|
+
"data-value": value,
|
|
164
|
+
"data-dragging": true,
|
|
165
|
+
className: cn(className),
|
|
166
|
+
children: props.children
|
|
167
|
+
} : {
|
|
168
|
+
"data-slot": "sortable-item",
|
|
169
|
+
"data-value": value,
|
|
170
|
+
"data-dragging": isSortableDragging,
|
|
171
|
+
"data-disabled": disabled,
|
|
172
|
+
ref: setNodeRef,
|
|
173
|
+
style,
|
|
174
|
+
...attributes,
|
|
175
|
+
className: cn(isSortableDragging && "z-50 opacity-50", disabled && "opacity-50", className),
|
|
176
|
+
children: props.children
|
|
177
|
+
};
|
|
178
|
+
return /* @__PURE__ */ jsx(SortableItemContext.Provider, {
|
|
179
|
+
value: isOverlay ? {
|
|
180
|
+
listeners: void 0,
|
|
181
|
+
isDragging: true,
|
|
182
|
+
disabled: false
|
|
183
|
+
} : {
|
|
184
|
+
listeners,
|
|
185
|
+
isDragging: isSortableDragging,
|
|
186
|
+
disabled
|
|
187
|
+
},
|
|
188
|
+
children: useRender({
|
|
189
|
+
defaultTagName: "div",
|
|
190
|
+
render,
|
|
191
|
+
props: mergeProps(defaultProps, props)
|
|
192
|
+
})
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
function SortableItemHandle({ className, render, cursor = true, ...props }) {
|
|
196
|
+
const { listeners, isDragging, disabled } = useContext(SortableItemContext);
|
|
197
|
+
return useRender({
|
|
198
|
+
defaultTagName: "div",
|
|
199
|
+
render,
|
|
200
|
+
props: mergeProps({
|
|
201
|
+
"data-slot": "sortable-item-handle",
|
|
202
|
+
"data-dragging": isDragging,
|
|
203
|
+
"data-disabled": disabled,
|
|
204
|
+
...listeners,
|
|
205
|
+
className: cn(cursor && (isDragging ? "cursor-grabbing!" : "cursor-grab!"), className),
|
|
206
|
+
children: props.children
|
|
207
|
+
}, props)
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
function SortableOverlay({ children, className, ...props }) {
|
|
211
|
+
const { activeId, modifiers } = useContext(SortableInternalContext);
|
|
212
|
+
const [mounted, setMounted] = useState(false);
|
|
213
|
+
useLayoutEffect(() => setMounted(true), []);
|
|
214
|
+
const content = activeId && children ? typeof children === "function" ? children({ value: activeId }) : children : null;
|
|
215
|
+
if (!mounted) return null;
|
|
216
|
+
return createPortal(/* @__PURE__ */ jsx(DragOverlay, {
|
|
217
|
+
dropAnimation: dropAnimationConfig,
|
|
218
|
+
modifiers,
|
|
219
|
+
className: cn("z-50", activeId && "cursor-grabbing", className),
|
|
220
|
+
...props,
|
|
221
|
+
children: /* @__PURE__ */ jsx(IsOverlayContext.Provider, {
|
|
222
|
+
value: true,
|
|
223
|
+
children: content
|
|
224
|
+
})
|
|
225
|
+
}), document.body);
|
|
226
|
+
}
|
|
227
|
+
//#endregion
|
|
228
|
+
export { Sortable, SortableItem, SortableItemHandle, SortableOverlay };
|
|
229
|
+
|
|
230
|
+
//# sourceMappingURL=sortable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sortable.js","names":[],"sources":["../../../src/components/reui/sortable.tsx"],"sourcesContent":["\"use client\";\n\nimport type * as React from \"react\";\nimport {\n Children,\n type CSSProperties,\n cloneElement,\n createContext,\n isValidElement,\n type ReactElement,\n type ReactNode,\n useCallback,\n useContext,\n useLayoutEffect,\n useMemo,\n useState,\n} from \"react\";\nimport { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport {\n DndContext,\n type DragCancelEvent,\n type DragEndEvent,\n type DraggableSyntheticListeners,\n DragOverlay,\n type DragStartEvent,\n type DropAnimation,\n defaultDropAnimationSideEffects,\n KeyboardSensor,\n MeasuringStrategy,\n type Modifiers,\n MouseSensor,\n TouchSensor,\n type UniqueIdentifier,\n useSensor,\n useSensors,\n} from \"@dnd-kit/core\";\nimport {\n type AnimateLayoutChanges,\n arrayMove,\n defaultAnimateLayoutChanges,\n rectSortingStrategy,\n SortableContext,\n sortableKeyboardCoordinates,\n useSortable,\n verticalListSortingStrategy,\n} from \"@dnd-kit/sortable\";\nimport { CSS } from \"@dnd-kit/utilities\";\nimport { createPortal } from \"react-dom\";\n\nimport { cn } from \"@kumix/utils\";\n\n// Sortable Item Context\nconst SortableItemContext = createContext<{\n listeners: DraggableSyntheticListeners | undefined;\n isDragging?: boolean;\n disabled?: boolean;\n}>({\n listeners: undefined,\n isDragging: false,\n disabled: false,\n});\n\nconst IsOverlayContext = createContext(false);\n\nconst SortableInternalContext = createContext<{\n activeId: UniqueIdentifier | null;\n modifiers?: Modifiers;\n}>({\n activeId: null,\n modifiers: undefined,\n});\n\nconst animateLayoutChanges: AnimateLayoutChanges = (args) =>\n defaultAnimateLayoutChanges({ ...args, wasDragging: true });\n\nconst dropAnimationConfig: DropAnimation = {\n sideEffects: defaultDropAnimationSideEffects({\n styles: {\n active: {\n opacity: \"0.4\",\n },\n },\n }),\n};\n\nconst MOUSE_SENSOR_OPTIONS = { activationConstraint: { distance: 10 } };\nconst TOUCH_SENSOR_OPTIONS = {\n activationConstraint: { delay: 250, tolerance: 5 },\n};\nconst KEYBOARD_SENSOR_OPTIONS = {\n coordinateGetter: sortableKeyboardCoordinates,\n};\nconst MEASURING_CONFIG = {\n droppable: { strategy: MeasuringStrategy.Always },\n};\nconst STRATEGY_MAP = {\n horizontal: rectSortingStrategy,\n grid: rectSortingStrategy,\n vertical: verticalListSortingStrategy,\n} as const;\n\n// Multipurpose Sortable Component\nexport interface SortableCommitMeta<T> {\n event: DragEndEvent;\n activeIndex: number;\n overIndex: number;\n previousValue: T[];\n}\n\nexport interface SortableRootProps<T>\n extends Omit<useRender.ComponentProps<\"div\">, \"onDragStart\" | \"onDragEnd\" | \"children\"> {\n value: T[];\n onValueChange: (value: T[]) => void;\n getItemValue: (item: T) => string;\n children: ReactNode;\n onMove?: (event: { event: DragEndEvent; activeIndex: number; overIndex: number }) => void;\n onValueCommit?: (value: T[], meta: SortableCommitMeta<T>) => void;\n strategy?: \"horizontal\" | \"vertical\" | \"grid\";\n onDragStart?: (event: DragStartEvent) => void;\n onDragEnd?: (event: DragEndEvent) => void;\n onDragCancel?: (event: DragCancelEvent) => void;\n accessibility?: React.ComponentProps<typeof DndContext>[\"accessibility\"];\n modifiers?: Modifiers;\n}\n\nfunction Sortable<T>({\n value,\n onValueChange,\n getItemValue,\n className,\n render,\n onMove,\n onValueCommit,\n strategy = \"vertical\",\n onDragStart,\n onDragEnd,\n onDragCancel,\n accessibility,\n modifiers,\n children,\n ...props\n}: SortableRootProps<T>) {\n const [activeId, setActiveId] = useState<UniqueIdentifier | null>(null);\n const [mounted, setMounted] = useState(false);\n\n useLayoutEffect(() => setMounted(true), []);\n\n const sensors = useSensors(\n useSensor(MouseSensor, MOUSE_SENSOR_OPTIONS),\n useSensor(TouchSensor, TOUCH_SENSOR_OPTIONS),\n useSensor(KeyboardSensor, KEYBOARD_SENSOR_OPTIONS),\n );\n\n const handleDragStart = useCallback(\n (event: DragStartEvent) => {\n setActiveId(event.active.id);\n onDragStart?.(event);\n },\n [onDragStart],\n );\n\n const handleDragEnd = useCallback(\n (event: DragEndEvent) => {\n const { active, over } = event;\n setActiveId(null);\n onDragEnd?.(event);\n\n if (!over) return;\n\n // Handle item reordering\n const activeIndex = value.findIndex((item: T) => getItemValue(item) === active.id);\n const overIndex = value.findIndex((item: T) => getItemValue(item) === over.id);\n\n if (activeIndex === -1 || overIndex === -1) return;\n\n if (activeIndex !== overIndex) {\n if (onMove) {\n onMove({ event, activeIndex, overIndex });\n } else {\n const newValue = arrayMove(value, activeIndex, overIndex);\n onValueChange(newValue);\n onValueCommit?.(newValue, {\n event,\n activeIndex,\n overIndex,\n previousValue: value,\n });\n }\n }\n },\n [value, getItemValue, onValueChange, onMove, onDragEnd, onValueCommit],\n );\n\n const handleDragCancel = useCallback(\n (event: DragCancelEvent) => {\n setActiveId(null);\n onDragCancel?.(event);\n },\n [onDragCancel],\n );\n\n const itemIds = useMemo(() => {\n const ids = value.map(getItemValue);\n if (process.env.NODE_ENV !== \"production\") {\n const seen = new Set<string>();\n for (const id of ids) {\n if (seen.has(id)) {\n console.warn(\n `[Sortable] Duplicate item id \"${id}\". Item ids must be unique, or drag and drop will misbehave.`,\n );\n break;\n }\n seen.add(id);\n }\n }\n return ids;\n }, [value, getItemValue]);\n\n const contextValue = useMemo(() => ({ activeId, modifiers }), [activeId, modifiers]);\n\n const defaultProps = {\n \"data-slot\": \"sortable\",\n \"data-dragging\": activeId !== null,\n className: cn(activeId !== null && \"cursor-grabbing!\", className),\n children,\n };\n\n // Find the active child for the overlay\n const overlayContent = useMemo(() => {\n if (!activeId) return null;\n let result: ReactNode = null;\n Children.forEach(children, (child) => {\n if (!isValidElement(child)) return;\n const props = child.props as { value?: UniqueIdentifier; className?: string };\n if (props.value === activeId) {\n result = cloneElement(child as ReactElement<{ className?: string }>, {\n ...props,\n className: cn(props.className, \"z-50\"),\n });\n }\n });\n return result;\n }, [activeId, children]);\n\n return (\n <SortableInternalContext.Provider value={contextValue}>\n <DndContext\n sensors={sensors}\n modifiers={modifiers}\n accessibility={accessibility}\n measuring={MEASURING_CONFIG}\n onDragStart={handleDragStart}\n onDragEnd={handleDragEnd}\n onDragCancel={handleDragCancel}\n >\n <SortableContext\n items={itemIds}\n strategy={STRATEGY_MAP[strategy] ?? verticalListSortingStrategy}\n >\n {useRender({\n defaultTagName: \"div\",\n render,\n props: mergeProps<\"div\">(defaultProps, props),\n })}\n </SortableContext>\n {mounted &&\n createPortal(\n <DragOverlay\n dropAnimation={dropAnimationConfig}\n modifiers={modifiers}\n className={cn(\"z-50\", activeId && \"cursor-grabbing\")}\n >\n <IsOverlayContext.Provider value={true}>{overlayContent}</IsOverlayContext.Provider>\n </DragOverlay>,\n document.body,\n )}\n </DndContext>\n </SortableInternalContext.Provider>\n );\n}\n\nexport interface SortableItemProps extends useRender.ComponentProps<\"div\"> {\n value: string;\n disabled?: boolean;\n}\n\nfunction SortableItem({ value, className, render, disabled, ...props }: SortableItemProps) {\n const isOverlay = useContext(IsOverlayContext);\n\n const {\n setNodeRef,\n transform,\n transition,\n attributes,\n listeners,\n isDragging: isSortableDragging,\n } = useSortable({\n id: value,\n disabled: disabled || isOverlay,\n animateLayoutChanges,\n });\n\n const style = {\n transition,\n transform: CSS.Transform.toString(transform),\n } as CSSProperties;\n\n const defaultProps = isOverlay\n ? {\n \"data-slot\": \"sortable-item\",\n \"data-value\": value,\n \"data-dragging\": true,\n className: cn(className),\n children: props.children,\n }\n : {\n \"data-slot\": \"sortable-item\",\n \"data-value\": value,\n \"data-dragging\": isSortableDragging,\n \"data-disabled\": disabled,\n ref: setNodeRef,\n style,\n ...attributes,\n className: cn(isSortableDragging && \"z-50 opacity-50\", disabled && \"opacity-50\", className),\n children: props.children,\n };\n\n return (\n <SortableItemContext.Provider\n value={\n isOverlay\n ? { listeners: undefined, isDragging: true, disabled: false }\n : { listeners, isDragging: isSortableDragging, disabled }\n }\n >\n {useRender({\n defaultTagName: \"div\",\n render,\n props: mergeProps<\"div\">(defaultProps, props),\n })}\n </SortableItemContext.Provider>\n );\n}\n\nexport interface SortableItemHandleProps extends useRender.ComponentProps<\"div\"> {\n cursor?: boolean;\n}\n\nfunction SortableItemHandle({\n className,\n render,\n cursor = true,\n ...props\n}: SortableItemHandleProps) {\n const { listeners, isDragging, disabled } = useContext(SortableItemContext);\n\n const defaultProps = {\n \"data-slot\": \"sortable-item-handle\",\n \"data-dragging\": isDragging,\n \"data-disabled\": disabled,\n ...listeners,\n className: cn(cursor && (isDragging ? \"cursor-grabbing!\" : \"cursor-grab!\"), className),\n children: props.children,\n };\n\n return useRender({\n defaultTagName: \"div\",\n render,\n props: mergeProps<\"div\">(defaultProps, props),\n });\n}\n\nexport interface SortableOverlayProps\n extends Omit<React.ComponentProps<typeof DragOverlay>, \"children\"> {\n children?: ReactNode | ((params: { value: UniqueIdentifier }) => ReactNode);\n}\n\nfunction SortableOverlay({ children, className, ...props }: SortableOverlayProps) {\n const { activeId, modifiers } = useContext(SortableInternalContext);\n const [mounted, setMounted] = useState(false);\n\n useLayoutEffect(() => setMounted(true), []);\n\n const content =\n activeId && children\n ? typeof children === \"function\"\n ? children({ value: activeId })\n : children\n : null;\n\n if (!mounted) return null;\n\n return createPortal(\n <DragOverlay\n dropAnimation={dropAnimationConfig}\n modifiers={modifiers}\n className={cn(\"z-50\", activeId && \"cursor-grabbing\", className)}\n {...props}\n >\n <IsOverlayContext.Provider value={true}>{content}</IsOverlayContext.Provider>\n </DragOverlay>,\n document.body,\n );\n}\n\nexport { Sortable, SortableItem, SortableItemHandle, SortableOverlay };\n"],"mappings":";;;;;;;;;;;AAqDA,MAAM,sBAAsB,cAIzB;CACD,WAAW,KAAA;CACX,YAAY;CACZ,UAAU;AACZ,CAAC;AAED,MAAM,mBAAmB,cAAc,KAAK;AAE5C,MAAM,0BAA0B,cAG7B;CACD,UAAU;CACV,WAAW,KAAA;AACb,CAAC;AAED,MAAM,wBAA8C,SAClD,4BAA4B;CAAE,GAAG;CAAM,aAAa;AAAK,CAAC;AAE5D,MAAM,sBAAqC,EACzC,aAAa,gCAAgC,EAC3C,QAAQ,EACN,QAAQ,EACN,SAAS,MACX,EACF,EACF,CAAC,EACH;AAEA,MAAM,uBAAu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;GACb,iBAAiB;GACjB,iBAAiB;GACjB,GAAG;GACH,WAAW,GAAG,WAAW,aAAa,qBAAqB,iBAAiB,SAAS;GACrF,UAAU,MAAM;EAMoB,GAAG,KAAK;CAC9C,CAAC;AACH;AAOA,SAAS,gBAAgB,EAAE,UAAU,WAAW,GAAG,SAA+B;CAChF,MAAM,EAAE,UAAU,cAAc,WAAW,uBAAuB;CAClE,MAAM,CAAC,SAAS,cAAc,SAAS,KAAK;CAE5C,sBAAsB,WAAW,IAAI,GAAG,CAAC,CAAC;CAE1C,MAAM,UACJ,YAAY,WACR,OAAO,aAAa,aAClB,SAAS,EAAE,OAAO,SAAS,CAAC,IAC5B,WACF;CAEN,IAAI,CAAC,SAAS,OAAO;CAErB,OAAO,aACL,oBAAC,aAAD;EACE,eAAe;EACJ;EACX,WAAW,GAAG,QAAQ,YAAY,mBAAmB,SAAS;EAC9D,GAAI;EAEJ,UAAA,oBAAC,iBAAiB,UAAlB;GAA2B,OAAO;GAAO,UAAA;EAAmC,CAAA;CACjE,CAAA,GACb,SAAS,IACX;AACF"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactElement } from "react";
|
|
2
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
3
|
+
//#region src/components/reui/stepper.d.ts
|
|
4
|
+
type StepperOrientation = "horizontal" | "vertical";
|
|
5
|
+
type StepState = "active" | "completed" | "inactive" | "loading";
|
|
6
|
+
type StepIndicators = {
|
|
7
|
+
active?: React.ReactNode;
|
|
8
|
+
completed?: React.ReactNode;
|
|
9
|
+
inactive?: React.ReactNode;
|
|
10
|
+
loading?: React.ReactNode;
|
|
11
|
+
};
|
|
12
|
+
interface StepperContextValue {
|
|
13
|
+
activeStep: number;
|
|
14
|
+
setActiveStep: (step: number) => void;
|
|
15
|
+
stepsCount: number;
|
|
16
|
+
orientation: StepperOrientation;
|
|
17
|
+
registerTrigger: (node: HTMLButtonElement | null) => void;
|
|
18
|
+
triggerNodes: HTMLButtonElement[];
|
|
19
|
+
focusNext: (currentIdx: number) => void;
|
|
20
|
+
focusPrev: (currentIdx: number) => void;
|
|
21
|
+
focusFirst: () => void;
|
|
22
|
+
focusLast: () => void;
|
|
23
|
+
indicators: StepIndicators;
|
|
24
|
+
}
|
|
25
|
+
interface StepItemContextValue {
|
|
26
|
+
step: number;
|
|
27
|
+
state: StepState;
|
|
28
|
+
isDisabled: boolean;
|
|
29
|
+
isLoading: boolean;
|
|
30
|
+
}
|
|
31
|
+
declare function useStepper(): StepperContextValue;
|
|
32
|
+
declare function useStepItem(): StepItemContextValue;
|
|
33
|
+
interface StepperProps extends HTMLAttributes<HTMLDivElement> {
|
|
34
|
+
defaultValue?: number;
|
|
35
|
+
value?: number;
|
|
36
|
+
onValueChange?: (value: number) => void;
|
|
37
|
+
orientation?: StepperOrientation;
|
|
38
|
+
indicators?: StepIndicators;
|
|
39
|
+
}
|
|
40
|
+
declare function Stepper({ defaultValue, value, onValueChange, orientation, className, children, indicators, ...props }: StepperProps): import("react").JSX.Element;
|
|
41
|
+
interface StepperItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
42
|
+
step: number;
|
|
43
|
+
completed?: boolean;
|
|
44
|
+
disabled?: boolean;
|
|
45
|
+
loading?: boolean;
|
|
46
|
+
}
|
|
47
|
+
declare function StepperItem({ step, completed, disabled, loading, className, children, ...props }: StepperItemProps): import("react").JSX.Element;
|
|
48
|
+
type StepperTriggerProps = useRender.ComponentProps<"button">;
|
|
49
|
+
declare function StepperTrigger({ className, children, tabIndex, render, ...props }: StepperTriggerProps): ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
50
|
+
declare function StepperIndicator({ children, className }: React.ComponentProps<"div">): import("react").JSX.Element;
|
|
51
|
+
declare function StepperSeparator({ className }: React.ComponentProps<"div">): import("react").JSX.Element;
|
|
52
|
+
declare function StepperTitle({ children, className }: React.ComponentProps<"h3">): import("react").JSX.Element;
|
|
53
|
+
declare function StepperDescription({ children, className }: React.ComponentProps<"div">): import("react").JSX.Element;
|
|
54
|
+
declare function StepperNav({ children, className }: React.ComponentProps<"nav">): import("react").JSX.Element;
|
|
55
|
+
declare function StepperPanel({ children, className }: React.ComponentProps<"div">): import("react").JSX.Element;
|
|
56
|
+
interface StepperContentProps extends React.ComponentProps<"div"> {
|
|
57
|
+
value: number;
|
|
58
|
+
forceMount?: boolean;
|
|
59
|
+
}
|
|
60
|
+
declare function StepperContent({ value, forceMount, children, className }: StepperContentProps): import("react").JSX.Element | null;
|
|
61
|
+
//#endregion
|
|
62
|
+
export { Stepper, StepperContent, type StepperContentProps, StepperDescription, StepperIndicator, StepperItem, type StepperItemProps, StepperNav, StepperPanel, type StepperProps, StepperSeparator, StepperTitle, StepperTrigger, type StepperTriggerProps, useStepItem, useStepper };
|
|
63
|
+
//# sourceMappingURL=stepper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stepper.d.ts","names":[],"sources":["../../../src/components/reui/stepper.tsx"],"mappings":";;;KAqBK;KACA;KACA;EACH,SAAS,MAAM;EACf,YAAY,MAAM;EAClB,WAAW,MAAM;EACjB,UAAU,MAAM;;UAGR;EACR;EACA,gBAAgB;EAChB;EACA,aAAa;EACb,kBAAkB,MAAM;EACxB,cAAc;EACd,YAAY;EACZ,YAAY;EACZ;EACA;EACA,YAAY;;UAGJ;EACR;EACA,OAAO;EACP;EACA;;iBAMO,cAAU;iBAMV,eAAW;UAMV,qBAAqB,eAAe;EAC5C;EACA;EACA,iBAAiB;EACjB,cAAc;EACd,aAAa;;iBAGN,UACP,cACA,OACA,eACA,aACA,WACA,UACA,eACG,SACF,+BAAY,IAAA;UAqGL,yBAAyB,MAAM,eAAe;EACtD;EACA;EACA;EACA;;iBAGO,cACP,MACA,WACA,UACA,SACA,WACA,aACG,SACF,mCAAgB,IAAA;KA0Bd,sBAAsB,UAAU;iBAE5B,iBAAiB,WAAW,UAAU,UAAU,WAAW,SAAS,sBAAmB,+CAAA;iBAwFvF,mBAAmB,UAAU,aAAa,MAAM,wCAAqB,IAAA;iBA8BrE,mBAAmB,aAAa,MAAM,wCAAqB,IAAA;iBAe3D,eAAe,UAAU,aAAa,MAAM,uCAAoB,IAAA;iBAchE,qBAAqB,UAAU,aAAa,MAAM,wCAAqB,IAAA;iBAcvE,aAAa,UAAU,aAAa,MAAM,wCAAqB,IAAA;iBAkB/D,eAAe,UAAU,aAAa,MAAM,wCAAqB,IAAA;UAUhE,4BAA4B,MAAM;EAC1C;EACA;;iBAGO,iBAAiB,OAAO,YAAY,UAAU,aAAa,sCAAmB,IAAA"}
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Children, createContext, isValidElement, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { cn } from "@kumix/utils";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
6
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
7
|
+
//#region src/components/reui/stepper.tsx
|
|
8
|
+
const StepperContext = createContext(void 0);
|
|
9
|
+
const StepItemContext = createContext(void 0);
|
|
10
|
+
function useStepper() {
|
|
11
|
+
const ctx = useContext(StepperContext);
|
|
12
|
+
if (!ctx) throw new Error("useStepper must be used within a Stepper");
|
|
13
|
+
return ctx;
|
|
14
|
+
}
|
|
15
|
+
function useStepItem() {
|
|
16
|
+
const ctx = useContext(StepItemContext);
|
|
17
|
+
if (!ctx) throw new Error("useStepItem must be used within a StepperItem");
|
|
18
|
+
return ctx;
|
|
19
|
+
}
|
|
20
|
+
function Stepper({ defaultValue = 1, value, onValueChange, orientation = "horizontal", className, children, indicators = {}, ...props }) {
|
|
21
|
+
const [activeStep, setActiveStep] = useState(defaultValue);
|
|
22
|
+
const [triggerNodes, setTriggerNodes] = useState([]);
|
|
23
|
+
const registerTrigger = useCallback((node) => {
|
|
24
|
+
setTriggerNodes((prev) => {
|
|
25
|
+
if (node && !prev.includes(node)) return [...prev, node];
|
|
26
|
+
else if (!node && prev.includes(node)) return prev.filter((n) => n !== node);
|
|
27
|
+
else return prev;
|
|
28
|
+
});
|
|
29
|
+
}, []);
|
|
30
|
+
const handleSetActiveStep = useCallback((step) => {
|
|
31
|
+
if (value === void 0) setActiveStep(step);
|
|
32
|
+
onValueChange?.(step);
|
|
33
|
+
}, [value, onValueChange]);
|
|
34
|
+
const currentStep = value ?? activeStep;
|
|
35
|
+
const focusTrigger = useCallback((idx) => {
|
|
36
|
+
if (triggerNodes[idx]) triggerNodes[idx].focus();
|
|
37
|
+
}, [triggerNodes]);
|
|
38
|
+
const focusNext = useCallback((currentIdx) => focusTrigger((currentIdx + 1) % triggerNodes.length), [focusTrigger, triggerNodes.length]);
|
|
39
|
+
const focusPrev = useCallback((currentIdx) => focusTrigger((currentIdx - 1 + triggerNodes.length) % triggerNodes.length), [focusTrigger, triggerNodes.length]);
|
|
40
|
+
const focusFirst = useCallback(() => focusTrigger(0), [focusTrigger]);
|
|
41
|
+
const focusLast = useCallback(() => focusTrigger(triggerNodes.length - 1), [focusTrigger, triggerNodes.length]);
|
|
42
|
+
const contextValue = useMemo(() => ({
|
|
43
|
+
activeStep: currentStep,
|
|
44
|
+
setActiveStep: handleSetActiveStep,
|
|
45
|
+
stepsCount: Children.toArray(children).filter((child) => isValidElement(child) && child.type.displayName === "StepperItem").length,
|
|
46
|
+
orientation,
|
|
47
|
+
registerTrigger,
|
|
48
|
+
focusNext,
|
|
49
|
+
focusPrev,
|
|
50
|
+
focusFirst,
|
|
51
|
+
focusLast,
|
|
52
|
+
triggerNodes,
|
|
53
|
+
indicators
|
|
54
|
+
}), [
|
|
55
|
+
currentStep,
|
|
56
|
+
handleSetActiveStep,
|
|
57
|
+
children,
|
|
58
|
+
orientation,
|
|
59
|
+
registerTrigger,
|
|
60
|
+
triggerNodes,
|
|
61
|
+
focusNext,
|
|
62
|
+
indicators,
|
|
63
|
+
focusLast,
|
|
64
|
+
focusPrev,
|
|
65
|
+
focusFirst
|
|
66
|
+
]);
|
|
67
|
+
return /* @__PURE__ */ jsx(StepperContext.Provider, {
|
|
68
|
+
value: contextValue,
|
|
69
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
70
|
+
role: "tablist",
|
|
71
|
+
"aria-orientation": orientation,
|
|
72
|
+
"data-slot": "stepper",
|
|
73
|
+
className: cn("w-full", className),
|
|
74
|
+
"data-orientation": orientation,
|
|
75
|
+
...props,
|
|
76
|
+
children
|
|
77
|
+
})
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
function StepperItem({ step, completed = false, disabled = false, loading = false, className, children, ...props }) {
|
|
81
|
+
const { activeStep } = useStepper();
|
|
82
|
+
const state = completed || step < activeStep ? "completed" : activeStep === step ? "active" : "inactive";
|
|
83
|
+
const isLoading = loading && step === activeStep;
|
|
84
|
+
return /* @__PURE__ */ jsx(StepItemContext.Provider, {
|
|
85
|
+
value: {
|
|
86
|
+
step,
|
|
87
|
+
state,
|
|
88
|
+
isDisabled: disabled,
|
|
89
|
+
isLoading
|
|
90
|
+
},
|
|
91
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
92
|
+
"data-slot": "stepper-item",
|
|
93
|
+
className: cn("group/step flex not-last:flex-1 items-center justify-center group-data-[orientation=horizontal]/stepper-nav:flex-row group-data-[orientation=vertical]/stepper-nav:flex-col", className),
|
|
94
|
+
"data-state": state,
|
|
95
|
+
...isLoading ? { "data-loading": true } : {},
|
|
96
|
+
...props,
|
|
97
|
+
children
|
|
98
|
+
})
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
function StepperTrigger({ className, children, tabIndex, render, ...props }) {
|
|
102
|
+
const { state, isLoading } = useStepItem();
|
|
103
|
+
const { setActiveStep, activeStep, registerTrigger, triggerNodes, focusNext, focusPrev, focusFirst, focusLast } = useStepper();
|
|
104
|
+
const { step, isDisabled } = useStepItem();
|
|
105
|
+
const isSelected = activeStep === step;
|
|
106
|
+
const id = `stepper-tab-${step}`;
|
|
107
|
+
const panelId = `stepper-panel-${step}`;
|
|
108
|
+
const btnRef = useRef(null);
|
|
109
|
+
useEffect(() => {
|
|
110
|
+
if (btnRef.current) registerTrigger(btnRef.current);
|
|
111
|
+
}, [registerTrigger]);
|
|
112
|
+
const myIdx = useMemo(() => triggerNodes.findIndex((n) => n === btnRef.current), [triggerNodes]);
|
|
113
|
+
const handleKeyDown = (e) => {
|
|
114
|
+
switch (e.key) {
|
|
115
|
+
case "ArrowRight":
|
|
116
|
+
case "ArrowDown":
|
|
117
|
+
e.preventDefault();
|
|
118
|
+
if (myIdx !== -1 && focusNext) focusNext(myIdx);
|
|
119
|
+
break;
|
|
120
|
+
case "ArrowLeft":
|
|
121
|
+
case "ArrowUp":
|
|
122
|
+
e.preventDefault();
|
|
123
|
+
if (myIdx !== -1 && focusPrev) focusPrev(myIdx);
|
|
124
|
+
break;
|
|
125
|
+
case "Home":
|
|
126
|
+
e.preventDefault();
|
|
127
|
+
if (focusFirst) focusFirst();
|
|
128
|
+
break;
|
|
129
|
+
case "End":
|
|
130
|
+
e.preventDefault();
|
|
131
|
+
if (focusLast) focusLast();
|
|
132
|
+
break;
|
|
133
|
+
case "Enter":
|
|
134
|
+
case " ":
|
|
135
|
+
e.preventDefault();
|
|
136
|
+
setActiveStep(step);
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
return useRender({
|
|
141
|
+
defaultTagName: "button",
|
|
142
|
+
render,
|
|
143
|
+
ref: btnRef,
|
|
144
|
+
props: mergeProps({
|
|
145
|
+
role: "tab",
|
|
146
|
+
id,
|
|
147
|
+
"aria-selected": isSelected,
|
|
148
|
+
"aria-controls": panelId,
|
|
149
|
+
tabIndex: typeof tabIndex === "number" ? tabIndex : isSelected ? 0 : -1,
|
|
150
|
+
"data-slot": "stepper-trigger",
|
|
151
|
+
"data-state": state,
|
|
152
|
+
"data-loading": isLoading,
|
|
153
|
+
className: cn("inline-flex cursor-pointer items-center outline-none focus-visible:z-10 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-60", "gap-2.5 rounded-full", className),
|
|
154
|
+
onClick: () => setActiveStep(step),
|
|
155
|
+
onKeyDown: handleKeyDown,
|
|
156
|
+
disabled: isDisabled,
|
|
157
|
+
children
|
|
158
|
+
}, props)
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
function StepperIndicator({ children, className }) {
|
|
162
|
+
const { state, isLoading } = useStepItem();
|
|
163
|
+
const { indicators } = useStepper();
|
|
164
|
+
return /* @__PURE__ */ jsx("div", {
|
|
165
|
+
"data-slot": "stepper-indicator",
|
|
166
|
+
"data-state": state,
|
|
167
|
+
className: cn("relative flex size-6 shrink-0 items-center justify-center overflow-hidden border-background bg-accent text-accent-foreground data-[state=active]:bg-primary data-[state=completed]:bg-primary data-[state=active]:text-primary-foreground data-[state=completed]:text-primary-foreground", "rounded-full text-xs", className),
|
|
168
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
169
|
+
className: "absolute",
|
|
170
|
+
children: indicators && (isLoading && indicators.loading || state === "completed" && indicators.completed || state === "active" && indicators.active || state === "inactive" && indicators.inactive) ? isLoading && indicators.loading || state === "completed" && indicators.completed || state === "active" && indicators.active || state === "inactive" && indicators.inactive : children
|
|
171
|
+
})
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
function StepperSeparator({ className }) {
|
|
175
|
+
const { state } = useStepItem();
|
|
176
|
+
return /* @__PURE__ */ jsx("div", {
|
|
177
|
+
"data-slot": "stepper-separator",
|
|
178
|
+
"data-state": state,
|
|
179
|
+
className: cn("m-0.5 rounded-sm bg-muted group-data-[orientation=horizontal]/stepper-nav:h-0.5 group-data-[orientation=vertical]/stepper-nav:h-12 group-data-[orientation=vertical]/stepper-nav:w-0.5 group-data-[orientation=horizontal]/stepper-nav:flex-1", className)
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
function StepperTitle({ children, className }) {
|
|
183
|
+
const { state } = useStepItem();
|
|
184
|
+
return /* @__PURE__ */ jsx("h3", {
|
|
185
|
+
"data-slot": "stepper-title",
|
|
186
|
+
"data-state": state,
|
|
187
|
+
className: cn("font-medium text-sm leading-none", className),
|
|
188
|
+
children
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
function StepperDescription({ children, className }) {
|
|
192
|
+
const { state } = useStepItem();
|
|
193
|
+
return /* @__PURE__ */ jsx("div", {
|
|
194
|
+
"data-slot": "stepper-description",
|
|
195
|
+
"data-state": state,
|
|
196
|
+
className: cn("text-muted-foreground text-sm", className),
|
|
197
|
+
children
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
function StepperNav({ children, className }) {
|
|
201
|
+
const { activeStep, orientation } = useStepper();
|
|
202
|
+
return /* @__PURE__ */ jsx("nav", {
|
|
203
|
+
"data-slot": "stepper-nav",
|
|
204
|
+
"data-state": activeStep,
|
|
205
|
+
"data-orientation": orientation,
|
|
206
|
+
className: cn("group/stepper-nav inline-flex data-[orientation=horizontal]:w-full data-[orientation=horizontal]:flex-row data-[orientation=vertical]:flex-col", className),
|
|
207
|
+
children
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
function StepperPanel({ children, className }) {
|
|
211
|
+
const { activeStep } = useStepper();
|
|
212
|
+
return /* @__PURE__ */ jsx("div", {
|
|
213
|
+
"data-slot": "stepper-panel",
|
|
214
|
+
"data-state": activeStep,
|
|
215
|
+
className: cn("w-full", className),
|
|
216
|
+
children
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
function StepperContent({ value, forceMount, children, className }) {
|
|
220
|
+
const { activeStep } = useStepper();
|
|
221
|
+
const isActive = value === activeStep;
|
|
222
|
+
if (!forceMount && !isActive) return null;
|
|
223
|
+
return /* @__PURE__ */ jsx("div", {
|
|
224
|
+
"data-slot": "stepper-content",
|
|
225
|
+
"data-state": activeStep,
|
|
226
|
+
className: cn("w-full", className, !isActive && forceMount && "hidden"),
|
|
227
|
+
hidden: !isActive && forceMount,
|
|
228
|
+
children
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
//#endregion
|
|
232
|
+
export { Stepper, StepperContent, StepperDescription, StepperIndicator, StepperItem, StepperNav, StepperPanel, StepperSeparator, StepperTitle, StepperTrigger, useStepItem, useStepper };
|
|
233
|
+
|
|
234
|
+
//# sourceMappingURL=stepper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stepper.js","names":[],"sources":["../../../src/components/reui/stepper.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n Children,\n createContext,\n type HTMLAttributes,\n isValidElement,\n type ReactElement,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\n\nimport { cn } from \"@kumix/utils\";\n\n// Types\ntype StepperOrientation = \"horizontal\" | \"vertical\";\ntype StepState = \"active\" | \"completed\" | \"inactive\" | \"loading\";\ntype StepIndicators = {\n active?: React.ReactNode;\n completed?: React.ReactNode;\n inactive?: React.ReactNode;\n loading?: React.ReactNode;\n};\n\ninterface StepperContextValue {\n activeStep: number;\n setActiveStep: (step: number) => void;\n stepsCount: number;\n orientation: StepperOrientation;\n registerTrigger: (node: HTMLButtonElement | null) => void;\n triggerNodes: HTMLButtonElement[];\n focusNext: (currentIdx: number) => void;\n focusPrev: (currentIdx: number) => void;\n focusFirst: () => void;\n focusLast: () => void;\n indicators: StepIndicators;\n}\n\ninterface StepItemContextValue {\n step: number;\n state: StepState;\n isDisabled: boolean;\n isLoading: boolean;\n}\n\nconst StepperContext = createContext<StepperContextValue | undefined>(undefined);\nconst StepItemContext = createContext<StepItemContextValue | undefined>(undefined);\n\nfunction useStepper() {\n const ctx = useContext(StepperContext);\n if (!ctx) throw new Error(\"useStepper must be used within a Stepper\");\n return ctx;\n}\n\nfunction useStepItem() {\n const ctx = useContext(StepItemContext);\n if (!ctx) throw new Error(\"useStepItem must be used within a StepperItem\");\n return ctx;\n}\n\ninterface StepperProps extends HTMLAttributes<HTMLDivElement> {\n defaultValue?: number;\n value?: number;\n onValueChange?: (value: number) => void;\n orientation?: StepperOrientation;\n indicators?: StepIndicators;\n}\n\nfunction Stepper({\n defaultValue = 1,\n value,\n onValueChange,\n orientation = \"horizontal\",\n className,\n children,\n indicators = {},\n ...props\n}: StepperProps) {\n const [activeStep, setActiveStep] = useState(defaultValue);\n const [triggerNodes, setTriggerNodes] = useState<HTMLButtonElement[]>([]);\n\n // Register/unregister triggers\n const registerTrigger = useCallback((node: HTMLButtonElement | null) => {\n setTriggerNodes((prev) => {\n if (node && !prev.includes(node)) {\n return [...prev, node];\n } else if (!node && prev.includes(node!)) {\n return prev.filter((n) => n !== node);\n } else {\n return prev;\n }\n });\n }, []);\n\n const handleSetActiveStep = useCallback(\n (step: number) => {\n if (value === undefined) {\n setActiveStep(step);\n }\n onValueChange?.(step);\n },\n [value, onValueChange],\n );\n\n const currentStep = value ?? activeStep;\n\n // Keyboard navigation logic\n const focusTrigger = useCallback(\n (idx: number) => {\n if (triggerNodes[idx]) triggerNodes[idx].focus();\n },\n [triggerNodes],\n );\n const focusNext = useCallback(\n (currentIdx: number) => focusTrigger((currentIdx + 1) % triggerNodes.length),\n [focusTrigger, triggerNodes.length],\n );\n const focusPrev = useCallback(\n (currentIdx: number) =>\n focusTrigger((currentIdx - 1 + triggerNodes.length) % triggerNodes.length),\n [focusTrigger, triggerNodes.length],\n );\n const focusFirst = useCallback(() => focusTrigger(0), [focusTrigger]);\n const focusLast = useCallback(\n () => focusTrigger(triggerNodes.length - 1),\n [focusTrigger, triggerNodes.length],\n );\n\n // Context value\n const contextValue = useMemo<StepperContextValue>(\n () => ({\n activeStep: currentStep,\n setActiveStep: handleSetActiveStep,\n stepsCount: Children.toArray(children).filter(\n (child): child is ReactElement =>\n isValidElement(child) &&\n (child.type as { displayName?: string }).displayName === \"StepperItem\",\n ).length,\n orientation,\n registerTrigger,\n focusNext,\n focusPrev,\n focusFirst,\n focusLast,\n triggerNodes,\n indicators,\n }),\n [\n currentStep,\n handleSetActiveStep,\n children,\n orientation,\n registerTrigger,\n triggerNodes,\n focusNext,\n indicators,\n focusLast,\n focusPrev,\n focusFirst,\n ],\n );\n\n return (\n <StepperContext.Provider value={contextValue}>\n <div\n role=\"tablist\"\n aria-orientation={orientation}\n data-slot=\"stepper\"\n className={cn(\"w-full\", className)}\n data-orientation={orientation}\n {...props}\n >\n {children}\n </div>\n </StepperContext.Provider>\n );\n}\n\ninterface StepperItemProps extends React.HTMLAttributes<HTMLDivElement> {\n step: number;\n completed?: boolean;\n disabled?: boolean;\n loading?: boolean;\n}\n\nfunction StepperItem({\n step,\n completed = false,\n disabled = false,\n loading = false,\n className,\n children,\n ...props\n}: StepperItemProps) {\n const { activeStep } = useStepper();\n\n const state: StepState =\n completed || step < activeStep ? \"completed\" : activeStep === step ? \"active\" : \"inactive\";\n\n const isLoading = loading && step === activeStep;\n\n return (\n <StepItemContext.Provider value={{ step, state, isDisabled: disabled, isLoading }}>\n <div\n data-slot=\"stepper-item\"\n className={cn(\n \"group/step flex not-last:flex-1 items-center justify-center group-data-[orientation=horizontal]/stepper-nav:flex-row group-data-[orientation=vertical]/stepper-nav:flex-col\",\n className,\n )}\n data-state={state}\n {...(isLoading ? { \"data-loading\": true } : {})}\n {...props}\n >\n {children}\n </div>\n </StepItemContext.Provider>\n );\n}\n\ntype StepperTriggerProps = useRender.ComponentProps<\"button\">;\n\nfunction StepperTrigger({ className, children, tabIndex, render, ...props }: StepperTriggerProps) {\n const { state, isLoading } = useStepItem();\n const stepperCtx = useStepper();\n const {\n setActiveStep,\n activeStep,\n registerTrigger,\n triggerNodes,\n focusNext,\n focusPrev,\n focusFirst,\n focusLast,\n } = stepperCtx;\n const { step, isDisabled } = useStepItem();\n const isSelected = activeStep === step;\n const id = `stepper-tab-${step}`;\n const panelId = `stepper-panel-${step}`;\n\n // Register this trigger for keyboard navigation\n const btnRef = useRef<HTMLButtonElement>(null);\n useEffect(() => {\n if (btnRef.current) {\n registerTrigger(btnRef.current);\n }\n }, [registerTrigger]);\n\n // Find our index among triggers for navigation\n const myIdx = useMemo(\n () => triggerNodes.findIndex((n: HTMLButtonElement) => n === btnRef.current),\n [triggerNodes],\n );\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLButtonElement>) => {\n switch (e.key) {\n case \"ArrowRight\":\n case \"ArrowDown\":\n e.preventDefault();\n if (myIdx !== -1 && focusNext) focusNext(myIdx);\n break;\n case \"ArrowLeft\":\n case \"ArrowUp\":\n e.preventDefault();\n if (myIdx !== -1 && focusPrev) focusPrev(myIdx);\n break;\n case \"Home\":\n e.preventDefault();\n if (focusFirst) focusFirst();\n break;\n case \"End\":\n e.preventDefault();\n if (focusLast) focusLast();\n break;\n case \"Enter\":\n case \" \":\n e.preventDefault();\n setActiveStep(step);\n break;\n }\n };\n\n const defaultProps = {\n role: \"tab\",\n id,\n \"aria-selected\": isSelected,\n \"aria-controls\": panelId,\n tabIndex: typeof tabIndex === \"number\" ? tabIndex : isSelected ? 0 : -1,\n \"data-slot\": \"stepper-trigger\",\n \"data-state\": state,\n \"data-loading\": isLoading,\n className: cn(\n \"inline-flex cursor-pointer items-center outline-none focus-visible:z-10 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-60\",\n \"gap-2.5 rounded-full\",\n className,\n ),\n onClick: () => setActiveStep(step),\n onKeyDown: handleKeyDown,\n disabled: isDisabled,\n children,\n };\n\n return useRender({\n defaultTagName: \"button\",\n render,\n ref: btnRef,\n props: mergeProps<\"button\">(defaultProps, props),\n });\n}\n\nfunction StepperIndicator({ children, className }: React.ComponentProps<\"div\">) {\n const { state, isLoading } = useStepItem();\n const { indicators } = useStepper();\n\n return (\n <div\n data-slot=\"stepper-indicator\"\n data-state={state}\n className={cn(\n \"relative flex size-6 shrink-0 items-center justify-center overflow-hidden border-background bg-accent text-accent-foreground data-[state=active]:bg-primary data-[state=completed]:bg-primary data-[state=active]:text-primary-foreground data-[state=completed]:text-primary-foreground\",\n \"rounded-full text-xs\",\n className,\n )}\n >\n <div className=\"absolute\">\n {indicators &&\n ((isLoading && indicators.loading) ||\n (state === \"completed\" && indicators.completed) ||\n (state === \"active\" && indicators.active) ||\n (state === \"inactive\" && indicators.inactive))\n ? (isLoading && indicators.loading) ||\n (state === \"completed\" && indicators.completed) ||\n (state === \"active\" && indicators.active) ||\n (state === \"inactive\" && indicators.inactive)\n : children}\n </div>\n </div>\n );\n}\n\nfunction StepperSeparator({ className }: React.ComponentProps<\"div\">) {\n const { state } = useStepItem();\n\n return (\n <div\n data-slot=\"stepper-separator\"\n data-state={state}\n className={cn(\n \"m-0.5 rounded-sm bg-muted group-data-[orientation=horizontal]/stepper-nav:h-0.5 group-data-[orientation=vertical]/stepper-nav:h-12 group-data-[orientation=vertical]/stepper-nav:w-0.5 group-data-[orientation=horizontal]/stepper-nav:flex-1\",\n className,\n )}\n />\n );\n}\n\nfunction StepperTitle({ children, className }: React.ComponentProps<\"h3\">) {\n const { state } = useStepItem();\n\n return (\n <h3\n data-slot=\"stepper-title\"\n data-state={state}\n className={cn(\"font-medium text-sm leading-none\", className)}\n >\n {children}\n </h3>\n );\n}\n\nfunction StepperDescription({ children, className }: React.ComponentProps<\"div\">) {\n const { state } = useStepItem();\n\n return (\n <div\n data-slot=\"stepper-description\"\n data-state={state}\n className={cn(\"text-muted-foreground text-sm\", className)}\n >\n {children}\n </div>\n );\n}\n\nfunction StepperNav({ children, className }: React.ComponentProps<\"nav\">) {\n const { activeStep, orientation } = useStepper();\n\n return (\n <nav\n data-slot=\"stepper-nav\"\n data-state={activeStep}\n data-orientation={orientation}\n className={cn(\n \"group/stepper-nav inline-flex data-[orientation=horizontal]:w-full data-[orientation=horizontal]:flex-row data-[orientation=vertical]:flex-col\",\n className,\n )}\n >\n {children}\n </nav>\n );\n}\n\nfunction StepperPanel({ children, className }: React.ComponentProps<\"div\">) {\n const { activeStep } = useStepper();\n\n return (\n <div data-slot=\"stepper-panel\" data-state={activeStep} className={cn(\"w-full\", className)}>\n {children}\n </div>\n );\n}\n\ninterface StepperContentProps extends React.ComponentProps<\"div\"> {\n value: number;\n forceMount?: boolean;\n}\n\nfunction StepperContent({ value, forceMount, children, className }: StepperContentProps) {\n const { activeStep } = useStepper();\n const isActive = value === activeStep;\n\n if (!forceMount && !isActive) {\n return null;\n }\n\n return (\n <div\n data-slot=\"stepper-content\"\n data-state={activeStep}\n className={cn(\"w-full\", className, !isActive && forceMount && \"hidden\")}\n hidden={!isActive && forceMount}\n >\n {children}\n </div>\n );\n}\n\nexport {\n Stepper,\n StepperContent,\n type StepperContentProps,\n StepperDescription,\n StepperIndicator,\n StepperItem,\n type StepperItemProps,\n StepperNav,\n StepperPanel,\n type StepperProps,\n StepperSeparator,\n StepperTitle,\n StepperTrigger,\n type StepperTriggerProps,\n useStepItem,\n useStepper,\n};\n"],"mappings":";;;;;;;AAmDA,MAAM,iBAAiB,cAA+C,KAAA,CAAS;AAC/E,MAAM,kBAAkB,cAAgD,KAAA,CAAS;AAEjF,SAAS,aAAa;CACpB,MAAM,MAAM,WAAW,cAAc;CACrC,IAAI,CAAC,KAAK,MAAM,IAAI,MAAM,0CAA0C;CACpE,OAAO;AACT;AAEA,SAAS,cAAc;CACrB,MAAM,MAAM,WAAW,eAAe;CACtC,IAAI,CAAC,KAAK,MAAM,IAAI,MAAM,+CAA+C;CACzE,OAAO;AACT;AAUA,SAAS,QAAQ,EACf,eAAe,GACf,OACA,eACA,cAAc,cACd,WACA,UACA,aAAa,CAAC,GACd,GAAG,SACY;CACf,MAAM,CAAC,YAAY,iBAAiB,SAAS,YAAY;CACzD,MAAM,CAAC,cAAc,mBAAmB,SAA8B,CAAC,CAAC;CAGxE,MAAM,kBAAkB,aAAa,SAAmC;EACtE,iBAAiB,SAAS;GACxB,IAAI,QAAQ,CAAC,KAAK,SAAS,IAAI,GAC7B,OAAO,CAAC,GAAG,MAAM,IAAI;Q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