@kumix/ui 0.1.3 → 0.2.1
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 +42 -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,61 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
//#region src/hooks/use-mutation-observer.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Hook to observe DOM mutations on a referenced element
|
|
5
|
+
*
|
|
6
|
+
* This hook provides a React-friendly way to use the MutationObserver API.
|
|
7
|
+
* It automatically handles observer creation, cleanup, and ref management.
|
|
8
|
+
* Useful for detecting DOM changes that occur outside of React's control.
|
|
9
|
+
*
|
|
10
|
+
* Features:
|
|
11
|
+
* - Automatic observer lifecycle management
|
|
12
|
+
* - Configurable observation options
|
|
13
|
+
* - Ref-based element targeting
|
|
14
|
+
* - Automatic cleanup on unmount
|
|
15
|
+
*
|
|
16
|
+
* @param ref - React ref pointing to the element to observe
|
|
17
|
+
* @param callback - Function called when mutations are detected
|
|
18
|
+
* @param options - MutationObserver configuration options
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* function DynamicContent() {
|
|
23
|
+
* const contentRef = useRef<HTMLDivElement>(null);
|
|
24
|
+
*
|
|
25
|
+
* // Watch for any changes to the content div
|
|
26
|
+
* useMutationObserver(
|
|
27
|
+
* contentRef,
|
|
28
|
+
* (mutations) => {
|
|
29
|
+
* mutations.forEach((mutation) => {
|
|
30
|
+
* console.log('DOM changed:', mutation.type);
|
|
31
|
+
* });
|
|
32
|
+
* }
|
|
33
|
+
* );
|
|
34
|
+
*
|
|
35
|
+
* return <div ref={contentRef}>Dynamic content here</div>;
|
|
36
|
+
* }
|
|
37
|
+
*
|
|
38
|
+
* // Watch only for attribute changes
|
|
39
|
+
* function AttributeWatcher() {
|
|
40
|
+
* const elementRef = useRef<HTMLElement>(null);
|
|
41
|
+
*
|
|
42
|
+
* useMutationObserver(
|
|
43
|
+
* elementRef,
|
|
44
|
+
* (mutations) => {
|
|
45
|
+
* mutations.forEach((mutation) => {
|
|
46
|
+
* if (mutation.type === 'attributes') {
|
|
47
|
+
* console.log('Attribute changed:', mutation.attributeName);
|
|
48
|
+
* }
|
|
49
|
+
* });
|
|
50
|
+
* },
|
|
51
|
+
* { attributes: true, childList: false, subtree: false }
|
|
52
|
+
* );
|
|
53
|
+
*
|
|
54
|
+
* return <div ref={elementRef}>Watched element</div>;
|
|
55
|
+
* }
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
declare const useMutationObserver: (ref: React$1.RefObject<HTMLElement | null>, callback: MutationCallback, options?: MutationObserverInit) => void;
|
|
59
|
+
//#endregion
|
|
60
|
+
export { useMutationObserver };
|
|
61
|
+
//# sourceMappingURL=use-mutation-observer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-mutation-observer.d.ts","names":[],"sources":["../../src/hooks/use-mutation-observer.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAgFa,sBACX,KAAK,QAAM,UAAU,qBACrB,UAAU,kBACV,UAAS"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
//#region src/hooks/use-mutation-observer.ts
|
|
4
|
+
/**
|
|
5
|
+
* DOM Mutation Observer hook for React components
|
|
6
|
+
* Provides a React-friendly interface for observing DOM changes
|
|
7
|
+
* with automatic cleanup and ref integration
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Default options for MutationObserver
|
|
11
|
+
* Observes all types of mutations by default
|
|
12
|
+
*/
|
|
13
|
+
const DEFAULT_OPTIONS = {
|
|
14
|
+
/** Watch for attribute changes */
|
|
15
|
+
attributes: true,
|
|
16
|
+
/** Watch for text content changes */
|
|
17
|
+
characterData: true,
|
|
18
|
+
/** Watch for child element additions/removals */
|
|
19
|
+
childList: true,
|
|
20
|
+
/** Watch for changes in descendant elements */
|
|
21
|
+
subtree: true
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Hook to observe DOM mutations on a referenced element
|
|
25
|
+
*
|
|
26
|
+
* This hook provides a React-friendly way to use the MutationObserver API.
|
|
27
|
+
* It automatically handles observer creation, cleanup, and ref management.
|
|
28
|
+
* Useful for detecting DOM changes that occur outside of React's control.
|
|
29
|
+
*
|
|
30
|
+
* Features:
|
|
31
|
+
* - Automatic observer lifecycle management
|
|
32
|
+
* - Configurable observation options
|
|
33
|
+
* - Ref-based element targeting
|
|
34
|
+
* - Automatic cleanup on unmount
|
|
35
|
+
*
|
|
36
|
+
* @param ref - React ref pointing to the element to observe
|
|
37
|
+
* @param callback - Function called when mutations are detected
|
|
38
|
+
* @param options - MutationObserver configuration options
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```tsx
|
|
42
|
+
* function DynamicContent() {
|
|
43
|
+
* const contentRef = useRef<HTMLDivElement>(null);
|
|
44
|
+
*
|
|
45
|
+
* // Watch for any changes to the content div
|
|
46
|
+
* useMutationObserver(
|
|
47
|
+
* contentRef,
|
|
48
|
+
* (mutations) => {
|
|
49
|
+
* mutations.forEach((mutation) => {
|
|
50
|
+
* console.log('DOM changed:', mutation.type);
|
|
51
|
+
* });
|
|
52
|
+
* }
|
|
53
|
+
* );
|
|
54
|
+
*
|
|
55
|
+
* return <div ref={contentRef}>Dynamic content here</div>;
|
|
56
|
+
* }
|
|
57
|
+
*
|
|
58
|
+
* // Watch only for attribute changes
|
|
59
|
+
* function AttributeWatcher() {
|
|
60
|
+
* const elementRef = useRef<HTMLElement>(null);
|
|
61
|
+
*
|
|
62
|
+
* useMutationObserver(
|
|
63
|
+
* elementRef,
|
|
64
|
+
* (mutations) => {
|
|
65
|
+
* mutations.forEach((mutation) => {
|
|
66
|
+
* if (mutation.type === 'attributes') {
|
|
67
|
+
* console.log('Attribute changed:', mutation.attributeName);
|
|
68
|
+
* }
|
|
69
|
+
* });
|
|
70
|
+
* },
|
|
71
|
+
* { attributes: true, childList: false, subtree: false }
|
|
72
|
+
* );
|
|
73
|
+
*
|
|
74
|
+
* return <div ref={elementRef}>Watched element</div>;
|
|
75
|
+
* }
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
const useMutationObserver = (ref, callback, options = DEFAULT_OPTIONS) => {
|
|
79
|
+
React$1.useEffect(() => {
|
|
80
|
+
if (ref.current) {
|
|
81
|
+
const observer = new MutationObserver(callback);
|
|
82
|
+
observer.observe(ref.current, options);
|
|
83
|
+
return () => {
|
|
84
|
+
observer.disconnect();
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}, [
|
|
88
|
+
ref,
|
|
89
|
+
callback,
|
|
90
|
+
options
|
|
91
|
+
]);
|
|
92
|
+
};
|
|
93
|
+
//#endregion
|
|
94
|
+
export { useMutationObserver };
|
|
95
|
+
|
|
96
|
+
//# sourceMappingURL=use-mutation-observer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-mutation-observer.js","names":[],"sources":["../../src/hooks/use-mutation-observer.ts"],"sourcesContent":["/**\n * DOM Mutation Observer hook for React components\n * Provides a React-friendly interface for observing DOM changes\n * with automatic cleanup and ref integration\n */\n\n\"use client\";\n\nimport * as React from \"react\";\n\n/**\n * Default options for MutationObserver\n * Observes all types of mutations by default\n */\nconst DEFAULT_OPTIONS: MutationObserverInit = {\n /** Watch for attribute changes */\n attributes: true,\n /** Watch for text content changes */\n characterData: true,\n /** Watch for child element additions/removals */\n childList: true,\n /** Watch for changes in descendant elements */\n subtree: true,\n};\n\n/**\n * Hook to observe DOM mutations on a referenced element\n *\n * This hook provides a React-friendly way to use the MutationObserver API.\n * It automatically handles observer creation, cleanup, and ref management.\n * Useful for detecting DOM changes that occur outside of React's control.\n *\n * Features:\n * - Automatic observer lifecycle management\n * - Configurable observation options\n * - Ref-based element targeting\n * - Automatic cleanup on unmount\n *\n * @param ref - React ref pointing to the element to observe\n * @param callback - Function called when mutations are detected\n * @param options - MutationObserver configuration options\n *\n * @example\n * ```tsx\n * function DynamicContent() {\n * const contentRef = useRef<HTMLDivElement>(null);\n *\n * // Watch for any changes to the content div\n * useMutationObserver(\n * contentRef,\n * (mutations) => {\n * mutations.forEach((mutation) => {\n * console.log('DOM changed:', mutation.type);\n * });\n * }\n * );\n *\n * return <div ref={contentRef}>Dynamic content here</div>;\n * }\n *\n * // Watch only for attribute changes\n * function AttributeWatcher() {\n * const elementRef = useRef<HTMLElement>(null);\n *\n * useMutationObserver(\n * elementRef,\n * (mutations) => {\n * mutations.forEach((mutation) => {\n * if (mutation.type === 'attributes') {\n * console.log('Attribute changed:', mutation.attributeName);\n * }\n * });\n * },\n * { attributes: true, childList: false, subtree: false }\n * );\n *\n * return <div ref={elementRef}>Watched element</div>;\n * }\n * ```\n */\nexport const useMutationObserver = (\n ref: React.RefObject<HTMLElement | null>,\n callback: MutationCallback,\n options: MutationObserverInit = DEFAULT_OPTIONS,\n) => {\n React.useEffect(() => {\n // Only proceed if ref has a current element\n if (ref.current) {\n // Create new MutationObserver instance\n const observer = new MutationObserver(callback);\n\n // Start observing the target element\n observer.observe(ref.current, options);\n\n // Cleanup function to disconnect observer\n return () => {\n observer.disconnect();\n };\n }\n }, [ref, callback, options]); // Re-run effect when dependencies change\n};\n"],"mappings":";;;;;;;;;;;;AAcA,MAAM,kBAAwC;;CAE5C,YAAY;;CAEZ,eAAe;;CAEf,WAAW;;CAEX,SAAS;AACX;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyDA,MAAa,uBACX,KACA,UACA,UAAgC,oBAC7B;CACH,QAAM,gBAAgB;EAEpB,IAAI,IAAI,SAAS;GAEf,MAAM,WAAW,IAAI,iBAAiB,QAAQ;GAG9C,SAAS,QAAQ,IAAI,SAAS,OAAO;GAGrC,aAAa;IACX,SAAS,WAAW;GACtB;EACF;CACF,GAAG;EAAC;EAAK;EAAU;CAAO,CAAC;AAC7B"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { RefObject } from "react";
|
|
2
|
+
//#region src/hooks/use-scroll-position.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Configuration options for the scroll position hook
|
|
5
|
+
*/
|
|
6
|
+
interface UseScrollPositionProps {
|
|
7
|
+
/** Optional ref to a specific scrollable element (defaults to document) */
|
|
8
|
+
targetRef?: RefObject<HTMLElement | Document | undefined>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Hook to track scroll position of window or specific elements
|
|
12
|
+
*
|
|
13
|
+
* This hook provides real-time tracking of scroll position with support
|
|
14
|
+
* for both window scrolling and element-specific scrolling. It automatically
|
|
15
|
+
* handles event listener management and cleanup.
|
|
16
|
+
*
|
|
17
|
+
* Features:
|
|
18
|
+
* - Real-time scroll position tracking
|
|
19
|
+
* - Support for window and element scrolling
|
|
20
|
+
* - Automatic event listener cleanup
|
|
21
|
+
* - SSR-safe implementation
|
|
22
|
+
* - Performance optimized
|
|
23
|
+
*
|
|
24
|
+
* @param options - Configuration options for the hook
|
|
25
|
+
* @returns Current scroll position in pixels
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```tsx
|
|
29
|
+
* // Track window scroll position
|
|
30
|
+
* function ScrollIndicator() {
|
|
31
|
+
* const scrollPosition = useScrollPosition();
|
|
32
|
+
*
|
|
33
|
+
* return (
|
|
34
|
+
* <div className="scroll-indicator">
|
|
35
|
+
* Scrolled: {scrollPosition}px
|
|
36
|
+
* </div>
|
|
37
|
+
* );
|
|
38
|
+
* }
|
|
39
|
+
*
|
|
40
|
+
* // Track specific element scroll position
|
|
41
|
+
* function ScrollableContent() {
|
|
42
|
+
* const contentRef = useRef<HTMLDivElement>(null);
|
|
43
|
+
* const scrollPosition = useScrollPosition({ targetRef: contentRef });
|
|
44
|
+
*
|
|
45
|
+
* return (
|
|
46
|
+
* <div
|
|
47
|
+
* ref={contentRef}
|
|
48
|
+
* className="h-96 overflow-y-auto"
|
|
49
|
+
* >
|
|
50
|
+
* <div className="h-[1000px]">
|
|
51
|
+
* <p>Scroll position: {scrollPosition}px</p>
|
|
52
|
+
* <p>Long content here...</p>
|
|
53
|
+
* </div>
|
|
54
|
+
* </div>
|
|
55
|
+
* );
|
|
56
|
+
* }
|
|
57
|
+
*
|
|
58
|
+
* // Show/hide header based on scroll
|
|
59
|
+
* function StickyHeader() {
|
|
60
|
+
* const scrollPosition = useScrollPosition();
|
|
61
|
+
* const isVisible = scrollPosition < 100;
|
|
62
|
+
*
|
|
63
|
+
* return (
|
|
64
|
+
* <header className={`transition-transform ${
|
|
65
|
+
* isVisible ? 'translate-y-0' : '-translate-y-full'
|
|
66
|
+
* }`}>
|
|
67
|
+
* Header content
|
|
68
|
+
* </header>
|
|
69
|
+
* );
|
|
70
|
+
* }
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
declare const useScrollPosition: ({ targetRef }?: UseScrollPositionProps) => number;
|
|
74
|
+
//#endregion
|
|
75
|
+
export { useScrollPosition };
|
|
76
|
+
//# sourceMappingURL=use-scroll-position.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-scroll-position.d.ts","names":[],"sources":["../../src/hooks/use-scroll-position.ts"],"mappings":";;;;;UAaU;;EAER,YAAY,UAAU,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAkEzB,sBAAqB,cAAe"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
//#region src/hooks/use-scroll-position.ts
|
|
4
|
+
/**
|
|
5
|
+
* Scroll position tracking hook for React components
|
|
6
|
+
* Monitors scroll position of window or specific elements
|
|
7
|
+
* with real-time updates and automatic cleanup
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Hook to track scroll position of window or specific elements
|
|
11
|
+
*
|
|
12
|
+
* This hook provides real-time tracking of scroll position with support
|
|
13
|
+
* for both window scrolling and element-specific scrolling. It automatically
|
|
14
|
+
* handles event listener management and cleanup.
|
|
15
|
+
*
|
|
16
|
+
* Features:
|
|
17
|
+
* - Real-time scroll position tracking
|
|
18
|
+
* - Support for window and element scrolling
|
|
19
|
+
* - Automatic event listener cleanup
|
|
20
|
+
* - SSR-safe implementation
|
|
21
|
+
* - Performance optimized
|
|
22
|
+
*
|
|
23
|
+
* @param options - Configuration options for the hook
|
|
24
|
+
* @returns Current scroll position in pixels
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```tsx
|
|
28
|
+
* // Track window scroll position
|
|
29
|
+
* function ScrollIndicator() {
|
|
30
|
+
* const scrollPosition = useScrollPosition();
|
|
31
|
+
*
|
|
32
|
+
* return (
|
|
33
|
+
* <div className="scroll-indicator">
|
|
34
|
+
* Scrolled: {scrollPosition}px
|
|
35
|
+
* </div>
|
|
36
|
+
* );
|
|
37
|
+
* }
|
|
38
|
+
*
|
|
39
|
+
* // Track specific element scroll position
|
|
40
|
+
* function ScrollableContent() {
|
|
41
|
+
* const contentRef = useRef<HTMLDivElement>(null);
|
|
42
|
+
* const scrollPosition = useScrollPosition({ targetRef: contentRef });
|
|
43
|
+
*
|
|
44
|
+
* return (
|
|
45
|
+
* <div
|
|
46
|
+
* ref={contentRef}
|
|
47
|
+
* className="h-96 overflow-y-auto"
|
|
48
|
+
* >
|
|
49
|
+
* <div className="h-[1000px]">
|
|
50
|
+
* <p>Scroll position: {scrollPosition}px</p>
|
|
51
|
+
* <p>Long content here...</p>
|
|
52
|
+
* </div>
|
|
53
|
+
* </div>
|
|
54
|
+
* );
|
|
55
|
+
* }
|
|
56
|
+
*
|
|
57
|
+
* // Show/hide header based on scroll
|
|
58
|
+
* function StickyHeader() {
|
|
59
|
+
* const scrollPosition = useScrollPosition();
|
|
60
|
+
* const isVisible = scrollPosition < 100;
|
|
61
|
+
*
|
|
62
|
+
* return (
|
|
63
|
+
* <header className={`transition-transform ${
|
|
64
|
+
* isVisible ? 'translate-y-0' : '-translate-y-full'
|
|
65
|
+
* }`}>
|
|
66
|
+
* Header content
|
|
67
|
+
* </header>
|
|
68
|
+
* );
|
|
69
|
+
* }
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
const useScrollPosition = ({ targetRef } = {}) => {
|
|
73
|
+
/** State to track current scroll position */
|
|
74
|
+
const [scrollPosition, setScrollPosition] = useState(0);
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
const target = targetRef?.current || document;
|
|
77
|
+
const scrollable = target === document ? window : target;
|
|
78
|
+
/**
|
|
79
|
+
* Update scroll position state
|
|
80
|
+
* Handles both window and element scrolling
|
|
81
|
+
*/
|
|
82
|
+
const updatePosition = () => {
|
|
83
|
+
const scrollY = target === document ? window.scrollY || window.pageYOffset : target.scrollTop;
|
|
84
|
+
setScrollPosition(scrollY);
|
|
85
|
+
};
|
|
86
|
+
scrollable.addEventListener("scroll", updatePosition, { passive: true });
|
|
87
|
+
updatePosition();
|
|
88
|
+
return () => {
|
|
89
|
+
scrollable.removeEventListener("scroll", updatePosition);
|
|
90
|
+
};
|
|
91
|
+
}, [targetRef]);
|
|
92
|
+
return scrollPosition;
|
|
93
|
+
};
|
|
94
|
+
//#endregion
|
|
95
|
+
export { useScrollPosition };
|
|
96
|
+
|
|
97
|
+
//# sourceMappingURL=use-scroll-position.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-scroll-position.js","names":[],"sources":["../../src/hooks/use-scroll-position.ts"],"sourcesContent":["/**\n * Scroll position tracking hook for React components\n * Monitors scroll position of window or specific elements\n * with real-time updates and automatic cleanup\n */\n\n\"use client\";\n\nimport { type RefObject, useEffect, useState } from \"react\";\n\n/**\n * Configuration options for the scroll position hook\n */\ninterface UseScrollPositionProps {\n /** Optional ref to a specific scrollable element (defaults to document) */\n targetRef?: RefObject<HTMLElement | Document | undefined>;\n}\n\n/**\n * Hook to track scroll position of window or specific elements\n *\n * This hook provides real-time tracking of scroll position with support\n * for both window scrolling and element-specific scrolling. It automatically\n * handles event listener management and cleanup.\n *\n * Features:\n * - Real-time scroll position tracking\n * - Support for window and element scrolling\n * - Automatic event listener cleanup\n * - SSR-safe implementation\n * - Performance optimized\n *\n * @param options - Configuration options for the hook\n * @returns Current scroll position in pixels\n *\n * @example\n * ```tsx\n * // Track window scroll position\n * function ScrollIndicator() {\n * const scrollPosition = useScrollPosition();\n *\n * return (\n * <div className=\"scroll-indicator\">\n * Scrolled: {scrollPosition}px\n * </div>\n * );\n * }\n *\n * // Track specific element scroll position\n * function ScrollableContent() {\n * const contentRef = useRef<HTMLDivElement>(null);\n * const scrollPosition = useScrollPosition({ targetRef: contentRef });\n *\n * return (\n * <div\n * ref={contentRef}\n * className=\"h-96 overflow-y-auto\"\n * >\n * <div className=\"h-[1000px]\">\n * <p>Scroll position: {scrollPosition}px</p>\n * <p>Long content here...</p>\n * </div>\n * </div>\n * );\n * }\n *\n * // Show/hide header based on scroll\n * function StickyHeader() {\n * const scrollPosition = useScrollPosition();\n * const isVisible = scrollPosition < 100;\n *\n * return (\n * <header className={`transition-transform ${\n * isVisible ? 'translate-y-0' : '-translate-y-full'\n * }`}>\n * Header content\n * </header>\n * );\n * }\n * ```\n */\nexport const useScrollPosition = ({ targetRef }: UseScrollPositionProps = {}): number => {\n /** State to track current scroll position */\n const [scrollPosition, setScrollPosition] = useState<number>(0);\n\n useEffect(() => {\n // Determine the target element (fallback to document if not provided)\n const target = targetRef?.current || document;\n\n // Determine the scrollable element (window for document, element for others)\n const scrollable = target === document ? window : target;\n\n /**\n * Update scroll position state\n * Handles both window and element scrolling\n */\n const updatePosition = () => {\n // Get scroll position based on target type\n const scrollY =\n target === document\n ? window.scrollY || window.pageYOffset // Fallback for older browsers\n : (target as HTMLElement).scrollTop;\n\n setScrollPosition(scrollY);\n };\n\n // Add scroll event listener\n scrollable.addEventListener(\"scroll\", updatePosition, { passive: true });\n\n // Set initial scroll position\n updatePosition();\n\n // Cleanup function to remove event listener\n return () => {\n scrollable.removeEventListener(\"scroll\", updatePosition);\n };\n }, [targetRef]); // Re-run effect when targetRef changes\n\n return scrollPosition;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiFA,MAAa,qBAAqB,EAAE,cAAsC,CAAC,MAAc;;CAEvF,MAAM,CAAC,gBAAgB,qBAAqB,SAAiB,CAAC;CAE9D,gBAAgB;EAEd,MAAM,SAAS,WAAW,WAAW;EAGrC,MAAM,aAAa,WAAW,WAAW,SAAS;;;;;EAMlD,MAAM,uBAAuB;GAE3B,MAAM,UACJ,WAAW,WACP,OAAO,WAAW,OAAO,cACxB,OAAuB;GAE9B,kBAAkB,OAAO;EAC3B;EAGA,WAAW,iBAAiB,UAAU,gBAAgB,EAAE,SAAS,KAAK,CAAC;EAGvE,eAAe;EAGf,aAAa;GACX,WAAW,oBAAoB,UAAU,cAAc;EACzD;CACF,GAAG,CAAC,SAAS,CAAC;CAEd,OAAO;AACT"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
//#region src/hooks/use-slider-input.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Configuration options for the slider input hook
|
|
5
|
+
*/
|
|
6
|
+
interface UseSliderInputProps {
|
|
7
|
+
/** Minimum allowed value for the range */
|
|
8
|
+
minValue: number;
|
|
9
|
+
/** Maximum allowed value for the range */
|
|
10
|
+
maxValue: number;
|
|
11
|
+
/** Initial values for the range [min, max] */
|
|
12
|
+
initialValue: [number, number];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Hook for managing dual slider input with synchronized state
|
|
16
|
+
*
|
|
17
|
+
* This hook provides state management for components that need both
|
|
18
|
+
* a range slider and corresponding number inputs. It handles synchronization
|
|
19
|
+
* between the two input types, validation, and boundary enforcement.
|
|
20
|
+
*
|
|
21
|
+
* Features:
|
|
22
|
+
* - Synchronized slider and input values
|
|
23
|
+
* - Automatic validation and boundary enforcement
|
|
24
|
+
* - Prevents invalid range configurations (min > max)
|
|
25
|
+
* - Optimized with useCallback for performance
|
|
26
|
+
*
|
|
27
|
+
* @param props - Configuration options for the hook
|
|
28
|
+
* @returns Object containing state and handlers for slider and inputs
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```tsx
|
|
32
|
+
* function PriceRangeFilter() {
|
|
33
|
+
* const {
|
|
34
|
+
* sliderValues,
|
|
35
|
+
* inputValues,
|
|
36
|
+
* handleSliderChange,
|
|
37
|
+
* handleInputChange,
|
|
38
|
+
* validateAndUpdateValue
|
|
39
|
+
* } = useSliderInput({
|
|
40
|
+
* minValue: 0,
|
|
41
|
+
* maxValue: 1000,
|
|
42
|
+
* initialValue: [100, 500]
|
|
43
|
+
* });
|
|
44
|
+
*
|
|
45
|
+
* return (
|
|
46
|
+
* <div className="price-range">
|
|
47
|
+
* <div className="inputs">
|
|
48
|
+
* <input
|
|
49
|
+
* type="number"
|
|
50
|
+
* value={inputValues[0]}
|
|
51
|
+
* onChange={(e) => handleInputChange(e, 0)}
|
|
52
|
+
* onBlur={() => validateAndUpdateValue(inputValues[0], 0)}
|
|
53
|
+
* placeholder="Min price"
|
|
54
|
+
* />
|
|
55
|
+
* <input
|
|
56
|
+
* type="number"
|
|
57
|
+
* value={inputValues[1]}
|
|
58
|
+
* onChange={(e) => handleInputChange(e, 1)}
|
|
59
|
+
* onBlur={() => validateAndUpdateValue(inputValues[1], 1)}
|
|
60
|
+
* placeholder="Max price"
|
|
61
|
+
* />
|
|
62
|
+
* </div>
|
|
63
|
+
*
|
|
64
|
+
* <Slider
|
|
65
|
+
* value={sliderValues}
|
|
66
|
+
* onValueChange={handleSliderChange}
|
|
67
|
+
* min={0}
|
|
68
|
+
* max={1000}
|
|
69
|
+
* step={10}
|
|
70
|
+
* />
|
|
71
|
+
* </div>
|
|
72
|
+
* );
|
|
73
|
+
* }
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
declare function useSliderInput({ minValue, maxValue, initialValue }: UseSliderInputProps): {
|
|
77
|
+
/** Function to manually set slider values */
|
|
78
|
+
setSliderValues: React$1.Dispatch<React$1.SetStateAction<[number, number]>>;
|
|
79
|
+
/** Function to manually set input values */
|
|
80
|
+
setInputValues: React$1.Dispatch<React$1.SetStateAction<[number, number]>>;
|
|
81
|
+
/** Current slider values [min, max] */
|
|
82
|
+
sliderValues: [number, number];
|
|
83
|
+
/** Current input values [min, max] */
|
|
84
|
+
inputValues: [number, number];
|
|
85
|
+
/** Handler for slider value changes */
|
|
86
|
+
handleSliderChange: (values: [number, number]) => void;
|
|
87
|
+
/** Handler for input field changes */
|
|
88
|
+
handleInputChange: (e: React$1.ChangeEvent<HTMLInputElement>, index: 0 | 1) => void;
|
|
89
|
+
/** Function to validate and update values from inputs */
|
|
90
|
+
validateAndUpdateValue: (value: number, index: 0 | 1) => void;
|
|
91
|
+
};
|
|
92
|
+
//#endregion
|
|
93
|
+
export { useSliderInput };
|
|
94
|
+
//# sourceMappingURL=use-slider-input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-slider-input.d.ts","names":[],"sources":["../../src/hooks/use-slider-input.ts"],"mappings":";;;;;UAcU;;EAER;;EAEA;;EAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiEc,iBAAiB,UAAU,UAAU,gBAAgB;;;;;;;;;;EAanB,qBAAA;;EAa1C,oBAAA,GAAA,QAAM,YAAY,mBAAiB;;EAsB/B,yBAAA,eAAM"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback, useState } from "react";
|
|
3
|
+
//#region src/hooks/use-slider-input.ts
|
|
4
|
+
/**
|
|
5
|
+
* Dual slider input management hook for React components
|
|
6
|
+
* Provides synchronized state management between range slider and number inputs
|
|
7
|
+
* with validation and boundary enforcement
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Hook for managing dual slider input with synchronized state
|
|
11
|
+
*
|
|
12
|
+
* This hook provides state management for components that need both
|
|
13
|
+
* a range slider and corresponding number inputs. It handles synchronization
|
|
14
|
+
* between the two input types, validation, and boundary enforcement.
|
|
15
|
+
*
|
|
16
|
+
* Features:
|
|
17
|
+
* - Synchronized slider and input values
|
|
18
|
+
* - Automatic validation and boundary enforcement
|
|
19
|
+
* - Prevents invalid range configurations (min > max)
|
|
20
|
+
* - Optimized with useCallback for performance
|
|
21
|
+
*
|
|
22
|
+
* @param props - Configuration options for the hook
|
|
23
|
+
* @returns Object containing state and handlers for slider and inputs
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* function PriceRangeFilter() {
|
|
28
|
+
* const {
|
|
29
|
+
* sliderValues,
|
|
30
|
+
* inputValues,
|
|
31
|
+
* handleSliderChange,
|
|
32
|
+
* handleInputChange,
|
|
33
|
+
* validateAndUpdateValue
|
|
34
|
+
* } = useSliderInput({
|
|
35
|
+
* minValue: 0,
|
|
36
|
+
* maxValue: 1000,
|
|
37
|
+
* initialValue: [100, 500]
|
|
38
|
+
* });
|
|
39
|
+
*
|
|
40
|
+
* return (
|
|
41
|
+
* <div className="price-range">
|
|
42
|
+
* <div className="inputs">
|
|
43
|
+
* <input
|
|
44
|
+
* type="number"
|
|
45
|
+
* value={inputValues[0]}
|
|
46
|
+
* onChange={(e) => handleInputChange(e, 0)}
|
|
47
|
+
* onBlur={() => validateAndUpdateValue(inputValues[0], 0)}
|
|
48
|
+
* placeholder="Min price"
|
|
49
|
+
* />
|
|
50
|
+
* <input
|
|
51
|
+
* type="number"
|
|
52
|
+
* value={inputValues[1]}
|
|
53
|
+
* onChange={(e) => handleInputChange(e, 1)}
|
|
54
|
+
* onBlur={() => validateAndUpdateValue(inputValues[1], 1)}
|
|
55
|
+
* placeholder="Max price"
|
|
56
|
+
* />
|
|
57
|
+
* </div>
|
|
58
|
+
*
|
|
59
|
+
* <Slider
|
|
60
|
+
* value={sliderValues}
|
|
61
|
+
* onValueChange={handleSliderChange}
|
|
62
|
+
* min={0}
|
|
63
|
+
* max={1000}
|
|
64
|
+
* step={10}
|
|
65
|
+
* />
|
|
66
|
+
* </div>
|
|
67
|
+
* );
|
|
68
|
+
* }
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
function useSliderInput({ minValue, maxValue, initialValue }) {
|
|
72
|
+
/** State for slider component values */
|
|
73
|
+
const [sliderValues, setSliderValues] = useState(initialValue);
|
|
74
|
+
/** State for input field values (may temporarily differ from slider) */
|
|
75
|
+
const [inputValues, setInputValues] = useState(initialValue);
|
|
76
|
+
return {
|
|
77
|
+
/** Function to manually set slider values */
|
|
78
|
+
setSliderValues,
|
|
79
|
+
/** Function to manually set input values */
|
|
80
|
+
setInputValues,
|
|
81
|
+
/** Current slider values [min, max] */
|
|
82
|
+
sliderValues,
|
|
83
|
+
/** Current input values [min, max] */
|
|
84
|
+
inputValues,
|
|
85
|
+
/** Handler for slider value changes */
|
|
86
|
+
handleSliderChange: useCallback((values) => {
|
|
87
|
+
setSliderValues(values);
|
|
88
|
+
setInputValues(values);
|
|
89
|
+
}, []),
|
|
90
|
+
/** Handler for input field changes */
|
|
91
|
+
handleInputChange: useCallback((e, index) => {
|
|
92
|
+
const newValue = parseFloat(e.target.value);
|
|
93
|
+
if (!Number.isNaN(newValue)) {
|
|
94
|
+
const updatedInputs = [...inputValues];
|
|
95
|
+
updatedInputs[index] = newValue;
|
|
96
|
+
setInputValues(updatedInputs);
|
|
97
|
+
}
|
|
98
|
+
}, [inputValues]),
|
|
99
|
+
/** Function to validate and update values from inputs */
|
|
100
|
+
validateAndUpdateValue: useCallback((value, index) => {
|
|
101
|
+
const updatedSlider = [...sliderValues];
|
|
102
|
+
if (index === 0) updatedSlider[0] = Math.max(minValue, Math.min(value, sliderValues[1]));
|
|
103
|
+
else updatedSlider[1] = Math.min(maxValue, Math.max(value, sliderValues[0]));
|
|
104
|
+
setSliderValues(updatedSlider);
|
|
105
|
+
setInputValues(updatedSlider);
|
|
106
|
+
}, [
|
|
107
|
+
sliderValues,
|
|
108
|
+
minValue,
|
|
109
|
+
maxValue
|
|
110
|
+
])
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
//#endregion
|
|
114
|
+
export { useSliderInput };
|
|
115
|
+
|
|
116
|
+
//# sourceMappingURL=use-slider-input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-slider-input.js","names":[],"sources":["../../src/hooks/use-slider-input.ts"],"sourcesContent":["/**\n * Dual slider input management hook for React components\n * Provides synchronized state management between range slider and number inputs\n * with validation and boundary enforcement\n */\n\n\"use client\";\n\nimport type * as React from \"react\";\nimport { useCallback, useState } from \"react\";\n\n/**\n * Configuration options for the slider input hook\n */\ninterface UseSliderInputProps {\n /** Minimum allowed value for the range */\n minValue: number;\n /** Maximum allowed value for the range */\n maxValue: number;\n /** Initial values for the range [min, max] */\n initialValue: [number, number];\n}\n\n/**\n * Hook for managing dual slider input with synchronized state\n *\n * This hook provides state management for components that need both\n * a range slider and corresponding number inputs. It handles synchronization\n * between the two input types, validation, and boundary enforcement.\n *\n * Features:\n * - Synchronized slider and input values\n * - Automatic validation and boundary enforcement\n * - Prevents invalid range configurations (min > max)\n * - Optimized with useCallback for performance\n *\n * @param props - Configuration options for the hook\n * @returns Object containing state and handlers for slider and inputs\n *\n * @example\n * ```tsx\n * function PriceRangeFilter() {\n * const {\n * sliderValues,\n * inputValues,\n * handleSliderChange,\n * handleInputChange,\n * validateAndUpdateValue\n * } = useSliderInput({\n * minValue: 0,\n * maxValue: 1000,\n * initialValue: [100, 500]\n * });\n *\n * return (\n * <div className=\"price-range\">\n * <div className=\"inputs\">\n * <input\n * type=\"number\"\n * value={inputValues[0]}\n * onChange={(e) => handleInputChange(e, 0)}\n * onBlur={() => validateAndUpdateValue(inputValues[0], 0)}\n * placeholder=\"Min price\"\n * />\n * <input\n * type=\"number\"\n * value={inputValues[1]}\n * onChange={(e) => handleInputChange(e, 1)}\n * onBlur={() => validateAndUpdateValue(inputValues[1], 1)}\n * placeholder=\"Max price\"\n * />\n * </div>\n *\n * <Slider\n * value={sliderValues}\n * onValueChange={handleSliderChange}\n * min={0}\n * max={1000}\n * step={10}\n * />\n * </div>\n * );\n * }\n * ```\n */\nexport function useSliderInput({ minValue, maxValue, initialValue }: UseSliderInputProps) {\n /** State for slider component values */\n const [sliderValues, setSliderValues] = useState<[number, number]>(initialValue);\n\n /** State for input field values (may temporarily differ from slider) */\n const [inputValues, setInputValues] = useState<[number, number]>(initialValue);\n\n /**\n * Handle slider value changes and sync with input values\n * Called when user interacts with the range slider\n *\n * @param values - New slider values [min, max]\n */\n const handleSliderChange = useCallback((values: [number, number]) => {\n setSliderValues(values);\n setInputValues(values); // Keep inputs in sync with slider\n }, []);\n\n /**\n * Handle input field changes\n * Updates input state without immediately affecting slider\n *\n * @param e - Input change event\n * @param index - Index of the input (0 for min, 1 for max)\n */\n const handleInputChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>, index: 0 | 1) => {\n const newValue = parseFloat(e.target.value);\n\n // Only update if the value is a valid number\n if (!Number.isNaN(newValue)) {\n const updatedInputs = [...inputValues] as [number, number];\n updatedInputs[index] = newValue;\n setInputValues(updatedInputs);\n }\n },\n [inputValues],\n );\n\n /**\n * Validate and update slider values from input\n * Called when input loses focus or user presses Enter\n * Enforces boundaries and prevents invalid ranges\n *\n * @param value - Value to validate and apply\n * @param index - Index of the value (0 for min, 1 for max)\n */\n const validateAndUpdateValue = useCallback(\n (value: number, index: 0 | 1) => {\n const updatedSlider = [...sliderValues] as [number, number];\n\n if (index === 0) {\n // Validate minimum value\n // Ensure it's not less than minValue and not greater than current max\n updatedSlider[0] = Math.max(minValue, Math.min(value, sliderValues[1]));\n } else {\n // Validate maximum value\n // Ensure it's not greater than maxValue and not less than current min\n updatedSlider[1] = Math.min(maxValue, Math.max(value, sliderValues[0]));\n }\n\n // Update both slider and input values to validated values\n setSliderValues(updatedSlider);\n setInputValues(updatedSlider);\n },\n [sliderValues, minValue, maxValue],\n );\n\n return {\n /** Function to manually set slider values */\n setSliderValues,\n /** Function to manually set input values */\n setInputValues,\n /** Current slider values [min, max] */\n sliderValues,\n /** Current input values [min, max] */\n inputValues,\n /** Handler for slider value changes */\n handleSliderChange,\n /** Handler for input field changes */\n handleInputChange,\n /** Function to validate and update values from inputs */\n validateAndUpdateValue,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqFA,SAAgB,eAAe,EAAE,UAAU,UAAU,gBAAqC;;CAExF,MAAM,CAAC,cAAc,mBAAmB,SAA2B,YAAY;;CAG/E,MAAM,CAAC,aAAa,kBAAkB,SAA2B,YAAY;CA+D7E,OAAO;;EAEL;;EAEA;;EAEA;;EAEA;;EAEA,oBAjEyB,aAAa,WAA6B;GACnE,gBAAgB,MAAM;GACtB,eAAe,MAAM;EACvB,GAAG,CAAC,CA8De;;EAEjB,mBAvDwB,aACvB,GAAwC,UAAiB;GACxD,MAAM,WAAW,WAAW,EAAE,OAAO,KAAK;GAG1C,IAAI,CAAC,OAAO,MAAM,QAAQ,GAAG;IAC3B,MAAM,gBAAgB,CAAC,GAAG,WAAW;IACrC,cAAc,SAAS;IACvB,eAAe,aAAa;GAC9B;EACF,GACA,CAAC,WAAW,CA4CI;;EAEhB,wBAnC6B,aAC5B,OAAe,UAAiB;GAC/B,MAAM,gBAAgB,CAAC,GAAG,YAAY;GAEtC,IAAI,UAAU,GAGZ,cAAc,KAAK,KAAK,IAAI,UAAU,KAAK,IAAI,OAAO,aAAa,EAAE,CAAC;QAItE,cAAc,KAAK,KAAK,IAAI,UAAU,KAAK,IAAI,OAAO,aAAa,EAAE,CAAC;GAIxE,gBAAgB,aAAa;GAC7B,eAAe,aAAa;EAC9B,GACA;GAAC;GAAc;GAAU;EAAQ,CAiBZ;CACvB;AACF"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
//#region src/hooks/use-viewport.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Viewport dimensions tracking hook for React components
|
|
4
|
+
* Provides real-time viewport width and height with automatic updates
|
|
5
|
+
* on window resize events with SSR-safe implementation
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Type definition for viewport dimensions
|
|
9
|
+
* Returns tuple of [width, height] in pixels
|
|
10
|
+
*/
|
|
11
|
+
type ViewportDimensions = [number, number];
|
|
12
|
+
/**
|
|
13
|
+
* Hook to track viewport dimensions with real-time updates
|
|
14
|
+
*
|
|
15
|
+
* This hook provides the current viewport dimensions and automatically
|
|
16
|
+
* updates when the window is resized. It's useful for responsive layouts,
|
|
17
|
+
* conditional rendering based on screen size, and dynamic calculations.
|
|
18
|
+
*
|
|
19
|
+
* Features:
|
|
20
|
+
* - Real-time viewport dimension tracking
|
|
21
|
+
* - Automatic updates on window resize
|
|
22
|
+
* - Performance optimized with passive event listeners
|
|
23
|
+
* - SSR-safe implementation
|
|
24
|
+
* - Returns both width and height
|
|
25
|
+
*
|
|
26
|
+
* @returns Tuple containing [width, height] in pixels
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* // Basic usage
|
|
31
|
+
* function ResponsiveComponent() {
|
|
32
|
+
* const [width, height] = useViewport();
|
|
33
|
+
*
|
|
34
|
+
* return (
|
|
35
|
+
* <div>
|
|
36
|
+
* <p>Viewport: {width}x{height}</p>
|
|
37
|
+
* {width > 768 ? <DesktopLayout /> : <MobileLayout />}
|
|
38
|
+
* </div>
|
|
39
|
+
* );
|
|
40
|
+
* }
|
|
41
|
+
*
|
|
42
|
+
* // Destructured usage
|
|
43
|
+
* function ViewportInfo() {
|
|
44
|
+
* const [width, height] = useViewport();
|
|
45
|
+
* const aspectRatio = (width / height).toFixed(2);
|
|
46
|
+
*
|
|
47
|
+
* return (
|
|
48
|
+
* <div className="viewport-info">
|
|
49
|
+
* <p>Width: {width}px</p>
|
|
50
|
+
* <p>Height: {height}px</p>
|
|
51
|
+
* <p>Aspect Ratio: {aspectRatio}</p>
|
|
52
|
+
* </div>
|
|
53
|
+
* );
|
|
54
|
+
* }
|
|
55
|
+
*
|
|
56
|
+
* // Conditional rendering based on viewport
|
|
57
|
+
* function AdaptiveGrid() {
|
|
58
|
+
* const [width] = useViewport();
|
|
59
|
+
* const columns = width > 1200 ? 4 : width > 768 ? 3 : width > 480 ? 2 : 1;
|
|
60
|
+
*
|
|
61
|
+
* return (
|
|
62
|
+
* <div className={`grid grid-cols-${columns} gap-4`}>
|
|
63
|
+
* {items.map(item => <GridItem key={item.id} {...item} />)}
|
|
64
|
+
* </div>
|
|
65
|
+
* );
|
|
66
|
+
* }
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
declare const useViewport: () => ViewportDimensions;
|
|
70
|
+
//#endregion
|
|
71
|
+
export { useViewport };
|
|
72
|
+
//# sourceMappingURL=use-viewport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-viewport.d.ts","names":[],"sources":["../../src/hooks/use-viewport.ts"],"mappings":";;;;;;;;;;KAcK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA2DQ,mBAAkB"}
|