@g4rcez/components 5.0.1 → 5.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AnimatePresence-j36AYeOQ.js +181 -0
- package/dist/AnimatePresence-j36AYeOQ.js.map +1 -0
- package/dist/Calendar.es-xICmgvjq.js +23 -0
- package/dist/Calendar.es-xICmgvjq.js.map +1 -0
- package/dist/Funnel.es-DjKVl8Nj.js +23 -0
- package/dist/Funnel.es-DjKVl8Nj.js.map +1 -0
- package/dist/{MotionConfig-DKKYqBH2.js → MotionConfig-CXHoPGbK.js} +2 -2
- package/dist/{MotionConfig-DKKYqBH2.js.map → MotionConfig-CXHoPGbK.js.map} +1 -1
- package/dist/Plus.es-DbyRkEE2.js +23 -0
- package/dist/Plus.es-DbyRkEE2.js.map +1 -0
- package/dist/Trash.es-BFAc8PMf.js +23 -0
- package/dist/Trash.es-BFAc8PMf.js.map +1 -0
- package/dist/{calendar-PCCZDUIL.js → calendar-DEPkz8sw.js} +364 -502
- package/dist/calendar-DEPkz8sw.js.map +1 -0
- package/dist/calendar-header-Dfr-CwkY.js +174 -0
- package/dist/calendar-header-Dfr-CwkY.js.map +1 -0
- package/dist/chunk-jwUa06l-.js +23 -0
- package/dist/components/core/button.d.ts +77 -0
- package/dist/components/core/button.d.ts.map +1 -0
- package/dist/components/core/button.js +1 -1
- package/dist/components/core/button.jsx +79 -0
- package/dist/components/core/heading.d.ts +3 -0
- package/dist/components/core/heading.d.ts.map +1 -0
- package/dist/components/core/heading.js +11 -0
- package/dist/components/core/heading.js.map +1 -0
- package/dist/components/core/heading.jsx +4 -0
- package/dist/components/core/polymorph.d.ts +10 -0
- package/dist/components/core/polymorph.d.ts.map +1 -0
- package/dist/{polymorph-BLXhrn9n.js → components/core/polymorph.js} +2 -2
- package/dist/components/core/polymorph.js.map +1 -0
- package/dist/components/core/polymorph.jsx +5 -0
- package/dist/components/core/render-on-view.d.ts +7 -0
- package/dist/components/core/render-on-view.d.ts.map +1 -0
- package/dist/components/core/render-on-view.js +29 -0
- package/dist/components/core/render-on-view.js.map +1 -0
- package/dist/components/core/render-on-view.jsx +31 -0
- package/dist/components/core/resizable.d.ts +9 -0
- package/dist/components/core/resizable.d.ts.map +1 -0
- package/dist/components/core/resizable.js +60 -0
- package/dist/components/core/resizable.js.map +1 -0
- package/dist/components/core/resizable.jsx +57 -0
- package/dist/components/core/slot.d.ts +16 -0
- package/dist/components/core/slot.d.ts.map +1 -0
- package/dist/{slot-pC8kH9De.js → components/core/slot.js} +2 -2
- package/dist/components/core/slot.js.map +1 -0
- package/dist/components/core/slot.jsx +156 -0
- package/dist/components/core/tag.d.ts +35 -0
- package/dist/components/core/tag.d.ts.map +1 -0
- package/dist/components/core/tag.js +1 -1
- package/dist/components/core/tag.jsx +53 -0
- package/dist/components/core/typography.d.ts +25 -0
- package/dist/components/core/typography.d.ts.map +1 -0
- package/dist/components/core/typography.js +40 -0
- package/dist/components/core/typography.js.map +1 -0
- package/dist/components/core/typography.jsx +20 -0
- package/dist/components/display/alert.d.ts +28 -0
- package/dist/components/display/alert.d.ts.map +1 -0
- package/dist/components/display/alert.js +83 -102
- package/dist/components/display/alert.js.map +1 -1
- package/dist/components/display/alert.jsx +58 -0
- package/dist/components/display/calendar.d.ts +42 -0
- package/dist/components/display/calendar.d.ts.map +1 -0
- package/dist/components/display/calendar.js +1 -1
- package/dist/components/display/calendar.jsx +323 -0
- package/dist/components/display/card.d.ts +29 -0
- package/dist/components/display/card.d.ts.map +1 -0
- package/dist/components/display/card.js +2 -2
- package/dist/components/display/card.jsx +43 -0
- package/dist/components/display/empty.d.ts +8 -0
- package/dist/components/display/empty.d.ts.map +1 -0
- package/dist/components/display/empty.js +25 -0
- package/dist/components/display/empty.js.map +1 -0
- package/dist/components/display/empty.jsx +13 -0
- package/dist/components/display/list.d.ts +16 -0
- package/dist/components/display/list.d.ts.map +1 -0
- package/dist/components/display/list.js +132 -122
- package/dist/components/display/list.js.map +1 -1
- package/dist/components/display/list.jsx +90 -0
- package/dist/components/display/notifications.d.ts +27 -0
- package/dist/components/display/notifications.d.ts.map +1 -0
- package/dist/components/display/notifications.js +1 -1
- package/dist/components/display/notifications.jsx +132 -0
- package/dist/components/display/progress.d.ts +16 -0
- package/dist/components/display/progress.d.ts.map +1 -0
- package/dist/components/display/progress.js +3 -0
- package/dist/components/display/progress.jsx +19 -0
- package/dist/components/display/shortcut.d.ts +4 -0
- package/dist/components/display/shortcut.d.ts.map +1 -0
- package/dist/components/display/shortcut.js +2 -0
- package/dist/components/display/shortcut.jsx +23 -0
- package/dist/components/display/skeleton.d.ts +12 -0
- package/dist/components/display/skeleton.d.ts.map +1 -0
- package/dist/components/display/skeleton.js +41 -0
- package/dist/components/display/skeleton.js.map +1 -0
- package/dist/components/display/skeleton.jsx +19 -0
- package/dist/components/display/spinner.d.ts +5 -0
- package/dist/components/display/spinner.d.ts.map +1 -0
- package/dist/components/display/spinner.js +17 -0
- package/dist/components/display/spinner.js.map +1 -0
- package/dist/components/display/spinner.jsx +11 -0
- package/dist/components/display/stats.d.ts +12 -0
- package/dist/components/display/stats.d.ts.map +1 -0
- package/dist/components/display/stats.jsx +16 -0
- package/dist/components/display/step.d.ts +24 -0
- package/dist/components/display/step.d.ts.map +1 -0
- package/dist/components/display/step.js +3 -0
- package/dist/components/display/step.jsx +145 -0
- package/dist/components/display/tabs.d.ts +24 -0
- package/dist/components/display/tabs.d.ts.map +1 -0
- package/dist/components/display/tabs.js +1 -1
- package/dist/components/display/tabs.jsx +125 -0
- package/dist/components/display/timeline.d.ts +10 -0
- package/dist/components/display/timeline.d.ts.map +1 -0
- package/dist/components/display/timeline.js +1 -1
- package/dist/components/display/timeline.jsx +25 -0
- package/dist/components/floating/command-palette.d.ts +49 -0
- package/dist/components/floating/command-palette.d.ts.map +1 -0
- package/dist/components/floating/command-palette.js +255 -0
- package/dist/components/floating/command-palette.js.map +1 -0
- package/dist/components/floating/command-palette.jsx +232 -0
- package/dist/components/floating/dropdown.d.ts +15 -0
- package/dist/components/floating/dropdown.d.ts.map +1 -0
- package/dist/components/floating/dropdown.js +1 -1
- package/dist/components/floating/dropdown.js.map +1 -1
- package/dist/components/floating/dropdown.jsx +56 -0
- package/dist/components/floating/expand.d.ts +11 -0
- package/dist/components/floating/expand.d.ts.map +1 -0
- package/dist/components/floating/expand.js +15 -14
- package/dist/components/floating/expand.js.map +1 -1
- package/dist/components/floating/expand.jsx +44 -0
- package/dist/components/floating/menu.d.ts +52 -0
- package/dist/components/floating/menu.d.ts.map +1 -0
- package/dist/components/floating/menu.js +1 -1
- package/dist/components/floating/menu.jsx +165 -0
- package/dist/components/floating/modal.d.ts +63 -0
- package/dist/components/floating/modal.d.ts.map +1 -0
- package/dist/components/floating/modal.js +1 -1
- package/dist/components/floating/modal.jsx +375 -0
- package/dist/components/floating/toolbar.d.ts +6 -0
- package/dist/components/floating/toolbar.d.ts.map +1 -0
- package/dist/components/floating/toolbar.js +20 -0
- package/dist/components/floating/toolbar.js.map +1 -0
- package/dist/components/floating/toolbar.jsx +9 -0
- package/dist/components/floating/tooltip.d.ts +17 -0
- package/dist/components/floating/tooltip.d.ts.map +1 -0
- package/dist/components/floating/tooltip.js +2 -2
- package/dist/components/floating/tooltip.js.map +1 -1
- package/dist/components/floating/tooltip.jsx +67 -0
- package/dist/components/floating/wizard.d.ts +26 -0
- package/dist/components/floating/wizard.d.ts.map +1 -0
- package/dist/components/floating/wizard.js +3 -0
- package/dist/components/floating/wizard.jsx +165 -0
- package/dist/components/form/autocomplete.d.ts +16 -0
- package/dist/components/form/autocomplete.d.ts.map +1 -0
- package/dist/components/form/autocomplete.js +344 -2
- package/dist/components/form/autocomplete.js.map +1 -0
- package/dist/components/form/autocomplete.jsx +299 -0
- package/dist/components/form/checkbox.d.ts +12 -0
- package/dist/components/form/checkbox.d.ts.map +1 -0
- package/dist/components/form/checkbox.js +29 -27
- package/dist/components/form/checkbox.js.map +1 -1
- package/dist/components/form/checkbox.jsx +27 -0
- package/dist/components/form/date-picker.d.ts +10 -0
- package/dist/components/form/date-picker.d.ts.map +1 -0
- package/dist/components/form/date-picker.js +1 -1
- package/dist/components/form/date-picker.jsx +115 -0
- package/dist/components/form/file-upload.d.ts +20 -0
- package/dist/components/form/file-upload.d.ts.map +1 -0
- package/dist/components/form/file-upload.js +1 -1
- package/dist/components/form/file-upload.jsx +160 -0
- package/dist/components/form/form.d.ts +3 -0
- package/dist/components/form/form.d.ts.map +1 -0
- package/dist/components/form/form.jsx +10 -0
- package/dist/components/form/formReset.d.ts +2 -0
- package/dist/components/form/formReset.d.ts.map +1 -0
- package/dist/components/form/formReset.js +10 -0
- package/dist/components/form/formReset.js.map +1 -0
- package/dist/components/form/formReset.jsx +17 -0
- package/dist/components/form/free-text.d.ts +11 -0
- package/dist/components/form/free-text.d.ts.map +1 -0
- package/dist/components/form/free-text.js +70 -0
- package/dist/components/form/free-text.js.map +1 -0
- package/dist/components/form/free-text.jsx +41 -0
- package/dist/components/form/input-field.d.ts +34 -0
- package/dist/components/form/input-field.d.ts.map +1 -0
- package/dist/components/form/input-field.js +3 -0
- package/dist/components/form/input-field.jsx +64 -0
- package/dist/components/form/input.d.ts +52 -0
- package/dist/components/form/input.d.ts.map +1 -0
- package/dist/components/form/input.js +1 -1
- package/dist/components/form/input.jsx +36 -0
- package/dist/components/form/multi-select.d.ts +19 -0
- package/dist/components/form/multi-select.d.ts.map +1 -0
- package/dist/components/form/multi-select.js +420 -0
- package/dist/components/form/multi-select.js.map +1 -0
- package/dist/components/form/multi-select.jsx +352 -0
- package/dist/components/form/radiobox.d.ts +7 -0
- package/dist/components/form/radiobox.d.ts.map +1 -0
- package/dist/components/form/radiobox.jsx +6 -0
- package/dist/components/form/select.d.ts +13 -0
- package/dist/components/form/select.d.ts.map +1 -0
- package/dist/components/form/select.js +55 -51
- package/dist/components/form/select.js.map +1 -1
- package/dist/components/form/select.jsx +47 -0
- package/dist/components/form/slider.d.ts +7 -0
- package/dist/components/form/slider.d.ts.map +1 -0
- package/dist/components/form/slider.js +3 -0
- package/dist/components/form/slider.jsx +45 -0
- package/dist/components/form/switch.d.ts +10 -0
- package/dist/components/form/switch.d.ts.map +1 -0
- package/dist/components/form/switch.js +32 -26
- package/dist/components/form/switch.js.map +1 -1
- package/dist/components/form/switch.jsx +59 -0
- package/dist/components/form/task-list.d.ts +3 -0
- package/dist/components/form/task-list.d.ts.map +1 -0
- package/dist/components/form/task-list.jsx +26 -0
- package/dist/components/form/textarea.d.ts +5 -0
- package/dist/components/form/textarea.d.ts.map +1 -0
- package/dist/components/form/textarea.js +19 -0
- package/dist/components/form/textarea.js.map +1 -0
- package/dist/components/form/textarea.jsx +26 -0
- package/dist/components/index.d.ts +45 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +44 -0
- package/dist/components/page-calendar/calendar-header.d.ts +16 -0
- package/dist/components/page-calendar/calendar-header.d.ts.map +1 -0
- package/dist/components/page-calendar/calendar-header.js +2 -0
- package/dist/components/page-calendar/calendar-header.jsx +85 -0
- package/dist/components/page-calendar/day-view.d.ts +12 -0
- package/dist/components/page-calendar/day-view.d.ts.map +1 -0
- package/dist/components/page-calendar/day-view.js +124 -0
- package/dist/components/page-calendar/day-view.js.map +1 -0
- package/dist/components/page-calendar/day-view.jsx +89 -0
- package/dist/components/page-calendar/event-pill.d.ts +9 -0
- package/dist/components/page-calendar/event-pill.d.ts.map +1 -0
- package/dist/components/page-calendar/event-pill.js +44 -0
- package/dist/components/page-calendar/event-pill.js.map +1 -0
- package/dist/components/page-calendar/event-pill.jsx +25 -0
- package/dist/components/page-calendar/index.d.ts +4 -0
- package/dist/components/page-calendar/index.d.ts.map +1 -0
- package/dist/components/page-calendar/index.js +2 -0
- package/dist/components/page-calendar/month-view.d.ts +11 -0
- package/dist/components/page-calendar/month-view.d.ts.map +1 -0
- package/dist/components/page-calendar/month-view.js +109 -0
- package/dist/components/page-calendar/month-view.js.map +1 -0
- package/dist/components/page-calendar/month-view.jsx +93 -0
- package/dist/components/page-calendar/page-calendar.d.ts +18 -0
- package/dist/components/page-calendar/page-calendar.d.ts.map +1 -0
- package/dist/components/page-calendar/page-calendar.js +75 -0
- package/dist/components/page-calendar/page-calendar.js.map +1 -0
- package/dist/components/page-calendar/page-calendar.jsx +41 -0
- package/dist/components/page-calendar/page-calendar.types.d.ts +18 -0
- package/dist/components/page-calendar/page-calendar.types.d.ts.map +1 -0
- package/dist/components/page-calendar/page-calendar.types.js +1 -0
- package/dist/components/page-calendar/page-calendar.utils.d.ts +24 -0
- package/dist/components/page-calendar/page-calendar.utils.d.ts.map +1 -0
- package/dist/components/page-calendar/page-calendar.utils.js +93 -0
- package/dist/components/page-calendar/week-view.d.ts +11 -0
- package/dist/components/page-calendar/week-view.d.ts.map +1 -0
- package/dist/components/page-calendar/week-view.js +88 -0
- package/dist/components/page-calendar/week-view.js.map +1 -0
- package/dist/components/page-calendar/week-view.jsx +66 -0
- package/dist/components/table/filter.d.ts +42 -0
- package/dist/components/table/filter.d.ts.map +1 -0
- package/dist/components/table/filter.js +239 -0
- package/dist/components/table/filter.js.map +1 -0
- package/dist/components/table/filter.jsx +174 -0
- package/dist/components/table/group.d.ts +17 -0
- package/dist/components/table/group.d.ts.map +1 -0
- package/dist/components/table/group.js +3 -0
- package/dist/components/table/group.jsx +77 -0
- package/dist/components/table/index.d.ts +19 -0
- package/dist/components/table/index.d.ts.map +1 -0
- package/dist/components/table/index.js +102 -0
- package/dist/components/table/index.js.map +1 -0
- package/dist/components/table/index.jsx +63 -0
- package/dist/components/table/inner-table.d.ts +29 -0
- package/dist/components/table/inner-table.d.ts.map +1 -0
- package/dist/components/table/inner-table.js +2 -0
- package/dist/components/table/inner-table.jsx +102 -0
- package/dist/components/table/metadata.d.ts +4 -0
- package/dist/components/table/metadata.d.ts.map +1 -0
- package/dist/components/table/metadata.js +73 -0
- package/dist/components/table/metadata.js.map +1 -0
- package/dist/components/table/metadata.jsx +36 -0
- package/dist/components/table/pagination.d.ts +5 -0
- package/dist/components/table/pagination.d.ts.map +1 -0
- package/dist/components/table/pagination.js +70 -0
- package/dist/components/table/pagination.js.map +1 -0
- package/dist/components/table/pagination.jsx +74 -0
- package/dist/components/table/row.d.ts +11 -0
- package/dist/components/table/row.d.ts.map +1 -0
- package/dist/components/table/row.js +58 -0
- package/dist/components/table/row.js.map +1 -0
- package/dist/components/table/row.jsx +49 -0
- package/dist/components/table/sort.d.ts +28 -0
- package/dist/components/table/sort.d.ts.map +1 -0
- package/dist/components/table/sort.js +3 -0
- package/dist/components/table/sort.jsx +111 -0
- package/dist/components/table/table-lib.d.ts +135 -0
- package/dist/components/table/table-lib.d.ts.map +1 -0
- package/dist/components/table/table-lib.js +83 -0
- package/dist/components/table/table.context.d.ts +10 -0
- package/dist/components/table/table.context.d.ts.map +1 -0
- package/dist/components/table/table.context.jsx +5 -0
- package/dist/components/table/thead.d.ts +9 -0
- package/dist/components/table/thead.d.ts.map +1 -0
- package/dist/components/table/thead.js +3 -0
- package/dist/components/table/thead.jsx +103 -0
- package/dist/config/context.d.ts +21 -0
- package/dist/config/context.d.ts.map +1 -0
- package/dist/config/context.js +12 -0
- package/dist/config/default-translations.d.ts +112 -0
- package/dist/config/default-translations.d.ts.map +1 -0
- package/dist/config/default-translations.jsx +105 -0
- package/dist/config/default-tweaks.d.ts +13 -0
- package/dist/config/default-tweaks.d.ts.map +1 -0
- package/dist/config/default-tweaks.js +4 -0
- package/dist/constants.d.ts +3 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +2 -0
- package/dist/{use-translations-DTLfPE3_.js → context-CsnUsfeP.js} +55 -40
- package/dist/context-CsnUsfeP.js.map +1 -0
- package/dist/{date-picker-BhKEFZew.js → date-picker-DNzupG8R.js} +301 -317
- package/dist/date-picker-DNzupG8R.js.map +1 -0
- package/dist/dict-CisoYSMO.js +28 -0
- package/dist/dict-CisoYSMO.js.map +1 -0
- package/dist/dist-ChfJ5LO9.js +498 -0
- package/dist/dist-ChfJ5LO9.js.map +1 -0
- package/dist/{dist-BrGpYRaj.js → dist-DIjUECx9.js} +56 -56
- package/dist/{dist-BrGpYRaj.js.map → dist-DIjUECx9.js.map} +1 -1
- package/dist/dom-Bn4wY_Zx.js.map +1 -1
- package/dist/{file-upload-DWbZfeG5.js → file-upload-C2zNnv9n.js} +501 -481
- package/dist/{file-upload-DWbZfeG5.js.map → file-upload-C2zNnv9n.js.map} +1 -1
- package/dist/fzf-CPGDDCoU.js +64 -0
- package/dist/fzf-CPGDDCoU.js.map +1 -0
- package/dist/getISOWeek-EcB4Ebqp.js +72 -0
- package/dist/getISOWeek-EcB4Ebqp.js.map +1 -0
- package/dist/group-Dl14TJXO.js +222 -0
- package/dist/group-Dl14TJXO.js.map +1 -0
- package/dist/hooks/use-click-outside.d.ts +3 -0
- package/dist/hooks/use-click-outside.d.ts.map +1 -0
- package/dist/hooks/use-click-outside.js +17 -0
- package/dist/hooks/use-color-parser.d.ts +2 -0
- package/dist/hooks/use-color-parser.d.ts.map +1 -0
- package/dist/hooks/use-color-parser.js +9 -0
- package/dist/hooks/use-components-provider.d.ts +15 -0
- package/dist/hooks/use-components-provider.d.ts.map +1 -0
- package/dist/hooks/use-components-provider.jsx +22 -0
- package/dist/hooks/use-debounce.d.ts +5 -0
- package/dist/hooks/use-debounce.d.ts.map +1 -0
- package/dist/hooks/use-debounce.js +12 -0
- package/dist/hooks/use-floating-ref.d.ts +2 -0
- package/dist/hooks/use-floating-ref.d.ts.map +1 -0
- package/dist/hooks/use-floating-ref.js +6 -0
- package/dist/hooks/use-form.d.ts +394 -0
- package/dist/hooks/use-form.d.ts.map +1 -0
- package/dist/hooks/use-form.js +563 -0
- package/dist/hooks/use-hover.d.ts +3 -0
- package/dist/hooks/use-hover.d.ts.map +1 -0
- package/dist/hooks/use-hover.js +18 -0
- package/dist/hooks/use-input-id.d.ts +4 -0
- package/dist/hooks/use-input-id.d.ts.map +1 -0
- package/dist/hooks/use-input-id.js +5 -0
- package/dist/hooks/use-is-coarse-device.d.ts +2 -0
- package/dist/hooks/use-is-coarse-device.d.ts.map +1 -0
- package/dist/hooks/use-is-coarse-device.js +12 -0
- package/dist/hooks/use-locale.d.ts +3 -0
- package/dist/hooks/use-locale.d.ts.map +1 -0
- package/dist/hooks/use-locale.js +10 -0
- package/dist/hooks/use-media-query.d.ts +2 -0
- package/dist/hooks/use-media-query.d.ts.map +1 -0
- package/dist/hooks/use-media-query.js +25 -0
- package/dist/hooks/use-on-event.d.ts +4 -0
- package/dist/hooks/use-on-event.d.ts.map +1 -0
- package/dist/hooks/use-on-event.js +10 -0
- package/dist/hooks/use-parent.d.ts +3 -0
- package/dist/hooks/use-parent.d.ts.map +1 -0
- package/dist/hooks/use-parent.js +21 -0
- package/dist/hooks/use-preferences.d.ts +2 -0
- package/dist/hooks/use-preferences.d.ts.map +1 -0
- package/dist/hooks/use-preferences.js +23 -0
- package/dist/hooks/use-previous.d.ts +2 -0
- package/dist/hooks/use-previous.d.ts.map +1 -0
- package/dist/hooks/use-previous.js +9 -0
- package/dist/hooks/use-reactive.d.ts +2 -0
- package/dist/hooks/use-reactive.d.ts.map +1 -0
- package/dist/hooks/use-reactive.js +9 -0
- package/dist/hooks/use-remove-scroll.d.ts +4 -0
- package/dist/hooks/use-remove-scroll.d.ts.map +1 -0
- package/dist/hooks/use-remove-scroll.js +48 -0
- package/dist/hooks/use-resize-observer.d.ts +2 -0
- package/dist/hooks/use-resize-observer.d.ts.map +1 -0
- package/dist/hooks/use-resize-observer.js +17 -0
- package/dist/hooks/use-stable-ref.d.ts +2 -0
- package/dist/hooks/use-stable-ref.d.ts.map +1 -0
- package/dist/hooks/use-stable-ref.js +9 -0
- package/dist/hooks/use-swipe.d.ts +8 -0
- package/dist/hooks/use-swipe.d.ts.map +1 -0
- package/dist/hooks/use-swipe.js +17 -0
- package/dist/hooks/use-translations.d.ts +110 -0
- package/dist/hooks/use-translations.d.ts.map +1 -0
- package/dist/hooks/use-translations.js +9 -0
- package/dist/hooks/use-tweaks.d.ts +3 -0
- package/dist/hooks/use-tweaks.d.ts.map +1 -0
- package/dist/hooks/use-tweaks.js +9 -0
- package/dist/hooks/use-window-size.d.ts +5 -0
- package/dist/hooks/use-window-size.d.ts.map +1 -0
- package/dist/hooks/use-window-size.js +14 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -7932
- package/dist/index.js.map +1 -1
- package/dist/inner-table-CeDX60cL.js +151 -0
- package/dist/inner-table-CeDX60cL.js.map +1 -0
- package/dist/input-Cmyuea4Y.js +412 -0
- package/dist/input-Cmyuea4Y.js.map +1 -0
- package/dist/{input-field-B_whI66Q.js → input-field-ffx1MbHo.js} +29 -16
- package/dist/input-field-ffx1MbHo.js.map +1 -0
- package/dist/isSameMonth-C3lsSwcg.js +10 -0
- package/dist/isSameMonth-C3lsSwcg.js.map +1 -0
- package/dist/isToday-COXfxFui.js +32 -0
- package/dist/isToday-COXfxFui.js.map +1 -0
- package/dist/lib/combi-keys.d.ts +15 -0
- package/dist/lib/combi-keys.d.ts.map +1 -0
- package/dist/lib/combi-keys.js +60 -0
- package/dist/lib/dict.d.ts +9 -0
- package/dist/lib/dict.d.ts.map +1 -0
- package/dist/lib/dict.js +28 -0
- package/dist/lib/dom.d.ts +20 -0
- package/dist/lib/dom.d.ts.map +1 -0
- package/dist/lib/dom.js +185 -0
- package/dist/lib/fns.d.ts +11 -0
- package/dist/lib/fns.d.ts.map +1 -0
- package/dist/lib/fns.js +46 -0
- package/dist/lib/fzf.d.ts +16 -0
- package/dist/lib/fzf.d.ts.map +1 -0
- package/dist/lib/fzf.js +115 -0
- package/dist/lib/keyboard-area.d.ts +16 -0
- package/dist/lib/keyboard-area.d.ts.map +1 -0
- package/dist/lib/keyboard-area.js +14 -0
- package/dist/modal-Df8-6i-o.js +408 -0
- package/dist/modal-Df8-6i-o.js.map +1 -0
- package/dist/notifications-NhCESJUV.js +1697 -0
- package/dist/notifications-NhCESJUV.js.map +1 -0
- package/dist/page-calendar.utils-Bd0PHktL.js +102 -0
- package/dist/page-calendar.utils-Bd0PHktL.js.map +1 -0
- package/dist/preset/preset.tailwind.d.ts.map +1 -1
- package/dist/preset/preset.tailwind.js +6 -7
- package/dist/preset/src/styles/dark.js +1 -1
- package/dist/progress-8LO5gWLp.js +104 -0
- package/dist/progress-8LO5gWLp.js.map +1 -0
- package/dist/{proxy-BcJ_5Dwq.js → proxy-fP2NxmhM.js} +658 -844
- package/dist/proxy-fP2NxmhM.js.map +1 -0
- package/dist/shim-Czv-YhKR.js +93 -0
- package/dist/shim-Czv-YhKR.js.map +1 -0
- package/dist/shortcut-CQCmgmlU.js +100 -0
- package/dist/shortcut-CQCmgmlU.js.map +1 -0
- package/dist/slider-TX9hiHO-.js +1196 -0
- package/dist/slider-TX9hiHO-.js.map +1 -0
- package/dist/sort-DGmiselV.js +195 -0
- package/dist/sort-DGmiselV.js.map +1 -0
- package/dist/step-DFpJ7zCG.js +185 -0
- package/dist/step-DFpJ7zCG.js.map +1 -0
- package/dist/styles/dark.js +1 -1
- package/dist/subMonths-QcCnE3Yh.js +43 -0
- package/dist/subMonths-QcCnE3Yh.js.map +1 -0
- package/dist/table-lib-1bkYSklk.js +174 -0
- package/dist/table-lib-1bkYSklk.js.map +1 -0
- package/dist/{tabs-Ciy0l9OF.js → tabs-Brc963EW.js} +2 -2
- package/dist/{tabs-Ciy0l9OF.js.map → tabs-Brc963EW.js.map} +1 -1
- package/dist/thead-B6WELJZ-.js +211 -0
- package/dist/thead-B6WELJZ-.js.map +1 -0
- package/dist/types.d.ts +26 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/dist/use-locale-DPM_sg4s.js +12 -0
- package/dist/use-locale-DPM_sg4s.js.map +1 -0
- package/dist/use-remove-scroll-pAgC09Sq.js +38 -0
- package/dist/use-remove-scroll-pAgC09Sq.js.map +1 -0
- package/dist/use-translations-BE4PuhLm.js +11 -0
- package/dist/use-translations-BE4PuhLm.js.map +1 -0
- package/dist/useAnimationFrame-DnKbaXfi.js +223 -0
- package/dist/useAnimationFrame-DnKbaXfi.js.map +1 -0
- package/dist/valueToPercent-DZc_m1tm.js +43 -0
- package/dist/valueToPercent-DZc_m1tm.js.map +1 -0
- package/dist/visuallyHidden-B7wI86yi.js +303 -0
- package/dist/visuallyHidden-B7wI86yi.js.map +1 -0
- package/dist/with-selector-BFW5n-pb.js +102 -0
- package/dist/with-selector-BFW5n-pb.js.map +1 -0
- package/dist/wizard-7u_qZ-78.js +218 -0
- package/dist/wizard-7u_qZ-78.js.map +1 -0
- package/package.json +19 -11
- package/dist/autocomplete-D3VOTihi.js +0 -415
- package/dist/autocomplete-D3VOTihi.js.map +0 -1
- package/dist/calendar-PCCZDUIL.js.map +0 -1
- package/dist/components/table/table.js +0 -3
- package/dist/date-picker-BhKEFZew.js.map +0 -1
- package/dist/input-B7jqwPG4.js +0 -473
- package/dist/input-B7jqwPG4.js.map +0 -1
- package/dist/input-field-B_whI66Q.js.map +0 -1
- package/dist/modal-Bz-61ays.js +0 -373
- package/dist/modal-Bz-61ays.js.map +0 -1
- package/dist/notifications-MT4XkLov.js +0 -2203
- package/dist/notifications-MT4XkLov.js.map +0 -1
- package/dist/polymorph-BLXhrn9n.js.map +0 -1
- package/dist/proxy-BcJ_5Dwq.js.map +0 -1
- package/dist/skeleton-CBYEq3lM.js +0 -26
- package/dist/skeleton-CBYEq3lM.js.map +0 -1
- package/dist/slot-pC8kH9De.js.map +0 -1
- package/dist/table-CUFbAI2k.js +0 -1914
- package/dist/table-CUFbAI2k.js.map +0 -1
- package/dist/use-translations-DTLfPE3_.js.map +0 -1
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { l as e, t } from "./context-CsnUsfeP.js";
|
|
2
|
+
import { t as n } from "./proxy-fP2NxmhM.js";
|
|
3
|
+
import r, { Fragment as i, createContext as a, useContext as o, useEffect as s, useRef as c, useState as l } from "react";
|
|
4
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
5
|
+
//#region src/hooks/use-color-parser.ts
|
|
6
|
+
var f = () => {
|
|
7
|
+
let n = o(t);
|
|
8
|
+
return n ? n.parser : e.hsla;
|
|
9
|
+
}, p = .3, m = {
|
|
10
|
+
duration: p,
|
|
11
|
+
type: "tween",
|
|
12
|
+
ease: "easeInOut"
|
|
13
|
+
}, h = a(null), g = {
|
|
14
|
+
delay: .2,
|
|
15
|
+
duration: .3,
|
|
16
|
+
type: "tween",
|
|
17
|
+
ease: "easeOut"
|
|
18
|
+
}, _ = {
|
|
19
|
+
initial: {
|
|
20
|
+
pathLength: 0,
|
|
21
|
+
opacity: 0
|
|
22
|
+
},
|
|
23
|
+
animate: {
|
|
24
|
+
pathLength: 1,
|
|
25
|
+
opacity: 1
|
|
26
|
+
}
|
|
27
|
+
}, v = (e) => /* @__PURE__ */ d("svg", {
|
|
28
|
+
...e,
|
|
29
|
+
"aria-hidden": "true",
|
|
30
|
+
focusable: "false",
|
|
31
|
+
viewBox: "0 0 24 24",
|
|
32
|
+
fill: "currentColor",
|
|
33
|
+
stroke: "currentColor",
|
|
34
|
+
strokeWidth: "2",
|
|
35
|
+
strokeLinecap: "round",
|
|
36
|
+
strokeLinejoin: "round",
|
|
37
|
+
children: [/* @__PURE__ */ u(n.path, {
|
|
38
|
+
className: "currentColor",
|
|
39
|
+
initial: _.initial,
|
|
40
|
+
animate: _.animate,
|
|
41
|
+
transition: g,
|
|
42
|
+
d: "M18 6 6 18"
|
|
43
|
+
}), /* @__PURE__ */ u(n.path, {
|
|
44
|
+
className: "currentColor",
|
|
45
|
+
initial: _.initial,
|
|
46
|
+
animate: _.animate,
|
|
47
|
+
transition: g,
|
|
48
|
+
d: "m6 6 12 12"
|
|
49
|
+
})]
|
|
50
|
+
}), y = (e) => /* @__PURE__ */ u("svg", {
|
|
51
|
+
...e,
|
|
52
|
+
"aria-hidden": "true",
|
|
53
|
+
focusable: "false",
|
|
54
|
+
fill: "none",
|
|
55
|
+
viewBox: "0 0 24 24",
|
|
56
|
+
stroke: "currentColor",
|
|
57
|
+
strokeWidth: 3,
|
|
58
|
+
children: /* @__PURE__ */ u(n.path, {
|
|
59
|
+
d: "M5 13l4 4L19 7",
|
|
60
|
+
strokeLinecap: "round",
|
|
61
|
+
strokeLinejoin: "round",
|
|
62
|
+
animate: _.animate,
|
|
63
|
+
initial: _.initial,
|
|
64
|
+
transition: g
|
|
65
|
+
})
|
|
66
|
+
}), b = {
|
|
67
|
+
complete: { scale: 1.25 },
|
|
68
|
+
active: {
|
|
69
|
+
scale: 1,
|
|
70
|
+
transition: {
|
|
71
|
+
delay: 0,
|
|
72
|
+
duration: .3
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}, x = {
|
|
76
|
+
duration: .6,
|
|
77
|
+
delay: .2,
|
|
78
|
+
type: "tween",
|
|
79
|
+
ease: "circOut"
|
|
80
|
+
}, S = (e, t, n) => n === "error" ? "error" : t === e ? "active" : t < e ? "inactive" : "complete", C = (e, t, n, r) => t === n ? 0 : t > n ? e <= n || e > t ? 0 : (e - n) / (t - n) * r : e <= t || e > n ? 0 : (n - e) / (n - t) * r, w = () => o(h), T = ({ step: e, currentStep: t, status: r, title: a, titleClassName: o, ...c }) => {
|
|
81
|
+
let p = f(), h = w(), [g, _] = l(t);
|
|
82
|
+
s(() => {
|
|
83
|
+
if (!h) {
|
|
84
|
+
_(t);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
let n = C(e, h.currentStep, h.previousStep, h.progressBarDuration);
|
|
88
|
+
if (n === 0) {
|
|
89
|
+
_(t);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
let r = setTimeout(() => {
|
|
93
|
+
_(t);
|
|
94
|
+
}, n * 1e3);
|
|
95
|
+
return () => clearTimeout(r);
|
|
96
|
+
}, [
|
|
97
|
+
t,
|
|
98
|
+
h,
|
|
99
|
+
e
|
|
100
|
+
]);
|
|
101
|
+
let T = S(e, g, r);
|
|
102
|
+
return h?.steps && 100 / h?.steps, /* @__PURE__ */ d(i, { children: [/* @__PURE__ */ u("div", { className: `hidden h-step-connector-h w-full bg-card-border first:hidden xl:block ${T === "active" || T === "complete" ? "bg-success" : ""}` }), /* @__PURE__ */ d(n.button, {
|
|
103
|
+
...c,
|
|
104
|
+
type: "button",
|
|
105
|
+
"aria-current": T === "active" ? "step" : void 0,
|
|
106
|
+
"data-step": e,
|
|
107
|
+
animate: T,
|
|
108
|
+
className: "relative flex w-auto items-center justify-center text-center",
|
|
109
|
+
children: [
|
|
110
|
+
/* @__PURE__ */ u(n.div, {
|
|
111
|
+
variants: b,
|
|
112
|
+
transition: x,
|
|
113
|
+
className: `absolute inset-0 hidden rounded-full text-center xl:block ${T === "error" ? "bg-danger" : ""}`
|
|
114
|
+
}),
|
|
115
|
+
/* @__PURE__ */ u(n.div, {
|
|
116
|
+
initial: !1,
|
|
117
|
+
animate: T,
|
|
118
|
+
transition: m,
|
|
119
|
+
className: "relative flex aspect-square size-step-size items-center justify-center rounded-full font-medium",
|
|
120
|
+
variants: {
|
|
121
|
+
error: {
|
|
122
|
+
color: p("var(--danger-foreground)"),
|
|
123
|
+
borderColor: p("var(--danger-hover)"),
|
|
124
|
+
backgroundColor: p("var(--danger-DEFAULT)")
|
|
125
|
+
},
|
|
126
|
+
inactive: {
|
|
127
|
+
transition: m,
|
|
128
|
+
color: p("var(--disabled)"),
|
|
129
|
+
borderColor: p("var(--card-border)"),
|
|
130
|
+
backgroundColor: p("var(--background)")
|
|
131
|
+
},
|
|
132
|
+
active: {
|
|
133
|
+
transition: m,
|
|
134
|
+
color: p("var(--primary-foreground)"),
|
|
135
|
+
borderColor: p("var(--primary-DEFAULT)"),
|
|
136
|
+
backgroundColor: p("var(--primary-DEFAULT)")
|
|
137
|
+
},
|
|
138
|
+
complete: {
|
|
139
|
+
transition: m,
|
|
140
|
+
color: p("var(--success-foreground)"),
|
|
141
|
+
borderColor: p("var(--success-DEFAULT)"),
|
|
142
|
+
backgroundColor: p("var(--success-DEFAULT)")
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
children: /* @__PURE__ */ u("div", {
|
|
146
|
+
className: "flex items-center justify-center",
|
|
147
|
+
children: T === "complete" ? /* @__PURE__ */ u(y, { className: "size-step-icon-size text-primary-foreground" }) : T === "error" ? /* @__PURE__ */ u(v, { className: "size-step-icon-size text-danger-foreground" }) : /* @__PURE__ */ u(i, { children: /* @__PURE__ */ u("span", { children: e }) })
|
|
148
|
+
})
|
|
149
|
+
}),
|
|
150
|
+
/* @__PURE__ */ u("div", {
|
|
151
|
+
className: "flex flex-col items-start justify-start px-step-label-px",
|
|
152
|
+
children: /* @__PURE__ */ u("h3", {
|
|
153
|
+
className: `flex h-full items-center whitespace-nowrap font-normal ${o}`,
|
|
154
|
+
children: a
|
|
155
|
+
})
|
|
156
|
+
})
|
|
157
|
+
]
|
|
158
|
+
})] });
|
|
159
|
+
}, E = (e) => {
|
|
160
|
+
let t = c(e.currentStep), [n, i] = l(e.currentStep);
|
|
161
|
+
s(() => {
|
|
162
|
+
t.current = n;
|
|
163
|
+
let r = setTimeout(() => {
|
|
164
|
+
i(e.currentStep);
|
|
165
|
+
}, p * 1e3);
|
|
166
|
+
return () => clearTimeout(r);
|
|
167
|
+
}, [e.currentStep, n]);
|
|
168
|
+
let a = {
|
|
169
|
+
currentStep: e.currentStep,
|
|
170
|
+
previousStep: t.current,
|
|
171
|
+
progressBarDuration: p,
|
|
172
|
+
steps: r.Children.count(e.children)
|
|
173
|
+
};
|
|
174
|
+
return /* @__PURE__ */ u(h.Provider, {
|
|
175
|
+
value: a,
|
|
176
|
+
children: /* @__PURE__ */ u("div", {
|
|
177
|
+
className: "relative flex w-full flex-col items-start justify-center gap-step-gap lg:flex-row lg:items-center lg:justify-between",
|
|
178
|
+
children: e.children
|
|
179
|
+
})
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
//#endregion
|
|
183
|
+
export { f as i, E as n, w as r, T as t };
|
|
184
|
+
|
|
185
|
+
//# sourceMappingURL=step-DFpJ7zCG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-DFpJ7zCG.js","names":[],"sources":["../src/hooks/use-color-parser.ts","../src/components/display/step.tsx"],"sourcesContent":["import { useContext } from \"react\";\nimport { Context } from \"../config/context\";\nimport { parsers } from \"../styles/design-tokens\";\n\nexport const useColorParser = () => {\n const ctx = useContext(Context);\n if (!ctx) return parsers.hsla;\n return ctx.parser!;\n};\n","\"use client\";\nimport { HTMLMotionProps, motion, Transition } from \"motion/react\";\nimport React, { ComponentProps, createContext, Fragment, PropsWithChildren, useContext, useEffect, useRef, useState } from \"react\";\nimport { useColorParser } from \"../../hooks/use-color-parser\";\nimport { Label } from \"../../types\";\n\nconst PROGRESS_BAR_DURATION = 0.3;\n\nconst transition: Transition = {\n duration: PROGRESS_BAR_DURATION,\n type: \"tween\",\n ease: \"easeInOut\",\n};\n\ntype StepContextValue = {\n currentStep: number;\n previousStep: number;\n progressBarDuration: number;\n steps: number;\n};\n\nconst StepContext = createContext<StepContextValue | null>(null);\n\nconst iconTransitions: Transition = {\n delay: 0.2,\n duration: 0.3,\n type: \"tween\",\n ease: \"easeOut\",\n};\n\nconst states = {\n initial: { pathLength: 0, opacity: 0 },\n animate: { pathLength: 1, opacity: 1 },\n};\n\nconst ErrorIcon = (props: ComponentProps<\"svg\">) => (\n <svg\n {...props}\n aria-hidden=\"true\"\n focusable=\"false\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <motion.path className=\"currentColor\" initial={states.initial} animate={states.animate} transition={iconTransitions} d=\"M18 6 6 18\" />\n <motion.path className=\"currentColor\" initial={states.initial} animate={states.animate} transition={iconTransitions} d=\"m6 6 12 12\" />\n </svg>\n);\n\nconst CheckIcon = (props: ComponentProps<\"svg\">) => (\n <svg {...props} aria-hidden=\"true\" focusable=\"false\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" strokeWidth={3}>\n <motion.path\n d=\"M5 13l4 4L19 7\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n animate={states.animate}\n initial={states.initial}\n transition={iconTransitions}\n />\n </svg>\n);\n\ntype StepStatus = \"active\" | \"inactive\" | \"complete\" | \"error\";\n\nexport type StepProps = React.ComponentProps<\"button\"> & {\n step: number;\n title?: Label;\n currentStep: number;\n status?: StepStatus;\n titleClassName?: string;\n};\n\nconst variants = {\n complete: { scale: 1.25 },\n active: { scale: 1, transition: { delay: 0, duration: 0.3 } },\n};\n\nconst transitions: Transition = {\n duration: 0.6,\n delay: 0.2,\n type: \"tween\",\n ease: \"circOut\",\n};\n\nconst getCurrentStatus = (step: StepProps[\"step\"], currentStep: StepProps[\"currentStep\"], status: StepProps[\"status\"]): StepStatus => {\n if (status === \"error\") return \"error\";\n if (currentStep === step) return \"active\";\n if (currentStep < step) return \"inactive\";\n return \"complete\";\n};\n\nconst calculateStepDelay = (step: number, currentStep: number, previousStep: number, duration: number): number => {\n if (currentStep === previousStep) return 0;\n const isForward = currentStep > previousStep;\n if (isForward) {\n if (step <= previousStep || step > currentStep) return 0;\n return ((step - previousStep) / (currentStep - previousStep)) * duration;\n }\n if (step <= currentStep || step > previousStep) return 0;\n return ((previousStep - step) / (previousStep - currentStep)) * duration;\n};\n\nexport const useStepContext = () => useContext(StepContext);\n\nexport const Step = ({ step, currentStep, status, title, titleClassName, ...props }: StepProps) => {\n const parser = useColorParser();\n const context = useStepContext();\n const [visualCurrentStep, setVisualCurrentStep] = useState(currentStep);\n\n useEffect(() => {\n if (!context) {\n setVisualCurrentStep(currentStep);\n return;\n }\n const delay = calculateStepDelay(step, context.currentStep, context.previousStep, context.progressBarDuration);\n\n if (delay === 0) {\n setVisualCurrentStep(currentStep);\n return;\n }\n\n const timer = setTimeout(() => {\n setVisualCurrentStep(currentStep);\n }, delay * 1000);\n return () => clearTimeout(timer);\n }, [currentStep, context, step]);\n\n const innerStatus = getCurrentStatus(step, visualCurrentStep, status);\n\n const _widthPerStep = context?.steps ? 100 / context?.steps : undefined;\n\n return (\n <Fragment>\n <div\n className={`hidden h-step-connector-h w-full bg-card-border first:hidden xl:block ${innerStatus === \"active\" || innerStatus === \"complete\" ? \"bg-success\" : \"\"}`}\n />\n <motion.button\n {...(props as unknown as HTMLMotionProps<\"button\">)}\n type=\"button\"\n aria-current={innerStatus === \"active\" ? \"step\" : undefined}\n data-step={step}\n animate={innerStatus}\n className=\"relative flex w-auto items-center justify-center text-center\"\n >\n <motion.div\n variants={variants}\n transition={transitions}\n className={`absolute inset-0 hidden rounded-full text-center xl:block ${innerStatus === \"error\" ? \"bg-danger\" : \"\"}`}\n />\n <motion.div\n initial={false}\n animate={innerStatus}\n transition={transition}\n className=\"relative flex aspect-square size-step-size items-center justify-center rounded-full font-medium\"\n variants={{\n error: {\n color: parser(\"var(--danger-foreground)\"),\n borderColor: parser(\"var(--danger-hover)\"),\n backgroundColor: parser(\"var(--danger-DEFAULT)\"),\n },\n inactive: {\n transition,\n color: parser(\"var(--disabled)\"),\n borderColor: parser(\"var(--card-border)\"),\n backgroundColor: parser(\"var(--background)\"),\n },\n active: {\n transition,\n color: parser(\"var(--primary-foreground)\"),\n borderColor: parser(\"var(--primary-DEFAULT)\"),\n backgroundColor: parser(\"var(--primary-DEFAULT)\"),\n },\n complete: {\n transition,\n color: parser(\"var(--success-foreground)\"),\n borderColor: parser(\"var(--success-DEFAULT)\"),\n backgroundColor: parser(\"var(--success-DEFAULT)\"),\n },\n }}\n >\n <div className=\"flex items-center justify-center\">\n {innerStatus === \"complete\" ? (\n <CheckIcon className=\"size-step-icon-size text-primary-foreground\" />\n ) : innerStatus === \"error\" ? (\n <ErrorIcon className=\"size-step-icon-size text-danger-foreground\" />\n ) : (\n <Fragment>\n <span>{step}</span>\n </Fragment>\n )}\n </div>\n </motion.div>\n <div className=\"flex flex-col items-start justify-start px-step-label-px\">\n <h3 className={`flex h-full items-center whitespace-nowrap font-normal ${titleClassName}`}>{title}</h3>\n </div>\n </motion.button>\n </Fragment>\n );\n};\n\nexport const Steps = (props: PropsWithChildren<{ steps: number; currentStep: number }>) => {\n const previousStepRef = useRef(props.currentStep);\n const [previousStep, setPreviousStep] = useState(props.currentStep);\n\n useEffect(() => {\n previousStepRef.current = previousStep;\n const timer = setTimeout(() => {\n setPreviousStep(props.currentStep);\n }, PROGRESS_BAR_DURATION * 1000);\n return () => clearTimeout(timer);\n }, [props.currentStep, previousStep]);\n\n const contextValue: StepContextValue = {\n currentStep: props.currentStep,\n previousStep: previousStepRef.current,\n progressBarDuration: PROGRESS_BAR_DURATION,\n steps: React.Children.count(props.children),\n };\n\n return (\n <StepContext.Provider value={contextValue}>\n <div className=\"relative flex w-full flex-col items-start justify-center gap-step-gap lg:flex-row lg:items-center lg:justify-between\">\n {props.children}\n </div>\n </StepContext.Provider>\n );\n};\n"],"mappings":";;;;;AAIA,IAAa,UAAuB;CAChC,IAAM,IAAM,EAAW,CAAO;CAE9B,OADK,IACE,EAAI,SADM,EAAQ;AAE7B,GCFM,IAAwB,IAExB,IAAyB;CAC3B,UAAU;CACV,MAAM;CACN,MAAM;AACV,GASM,IAAc,EAAuC,IAAI,GAEzD,IAA8B;CAChC,OAAO;CACP,UAAU;CACV,MAAM;CACN,MAAM;AACV,GAEM,IAAS;CACX,SAAS;EAAE,YAAY;EAAG,SAAS;CAAE;CACrC,SAAS;EAAE,YAAY;EAAG,SAAS;CAAE;AACzC,GAEM,KAAa,MACf,kBAAC,OAAD;CACI,GAAI;CACJ,eAAY;CACZ,WAAU;CACV,SAAQ;CACR,MAAK;CACL,QAAO;CACP,aAAY;CACZ,eAAc;CACd,gBAAe;WATnB,CAWI,kBAAC,EAAO,MAAR;EAAa,WAAU;EAAe,SAAS,EAAO;EAAS,SAAS,EAAO;EAAS,YAAY;EAAiB,GAAE;CAAc,CAAA,GACrI,kBAAC,EAAO,MAAR;EAAa,WAAU;EAAe,SAAS,EAAO;EAAS,SAAS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K,WAAU;cACX,kBAAC,MAAD;KAAI,WAAW,0DAA0D;eAAmB;IAAU,CAAA;GACrG,CAAA;EACM;GACT,EAAA,CAAA;AAElB,GAEa,KAAS,MAAqE;CACvF,IAAM,IAAkB,EAAO,EAAM,WAAW,GAC1C,CAAC,GAAc,KAAmB,EAAS,EAAM,WAAW;CAElE,QAAgB;EACZ,EAAgB,UAAU;EAC1B,IAAM,IAAQ,iBAAiB;GAC3B,EAAgB,EAAM,WAAW;EACrC,GAAG,IAAwB,GAAI;EAC/B,aAAa,aAAa,CAAK;CACnC,GAAG,CAAC,EAAM,aAAa,CAAY,CAAC;CAEpC,IAAM,IAAiC;EACnC,aAAa,EAAM;EACnB,cAAc,EAAgB;EAC9B,qBAAqB;EACrB,OAAO,EAAM,SAAS,MAAM,EAAM,QAAQ;CAC9C;CAEA,OACI,kBAAC,EAAY,UAAb;EAAsB,OAAO;YACzB,kBAAC,OAAD;GAAK,WAAU;aACV,EAAM;EACN,CAAA;CACa,CAAA;AAE9B"}
|
package/dist/styles/dark.js
CHANGED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { t as e } from "./IconBase.es-BlJQ9IXo.js";
|
|
2
|
+
import { c as t, l as n, s as r } from "./getISOWeek-EcB4Ebqp.js";
|
|
3
|
+
import * as i from "react";
|
|
4
|
+
//#region ../../node_modules/.pnpm/@phosphor-icons+react@2.1.10_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@phosphor-icons/react/dist/defs/CaretLeft.es.js
|
|
5
|
+
var a = /* @__PURE__ */ new Map([
|
|
6
|
+
["bold", /* @__PURE__ */ i.createElement(i.Fragment, null, /* @__PURE__ */ i.createElement("path", { d: "M168.49,199.51a12,12,0,0,1-17,17l-80-80a12,12,0,0,1,0-17l80-80a12,12,0,0,1,17,17L97,128Z" }))],
|
|
7
|
+
["duotone", /* @__PURE__ */ i.createElement(i.Fragment, null, /* @__PURE__ */ i.createElement("path", {
|
|
8
|
+
d: "M160,48V208L80,128Z",
|
|
9
|
+
opacity: "0.2"
|
|
10
|
+
}), /* @__PURE__ */ i.createElement("path", { d: "M163.06,40.61a8,8,0,0,0-8.72,1.73l-80,80a8,8,0,0,0,0,11.32l80,80A8,8,0,0,0,168,208V48A8,8,0,0,0,163.06,40.61ZM152,188.69,91.31,128,152,67.31Z" }))],
|
|
11
|
+
["fill", /* @__PURE__ */ i.createElement(i.Fragment, null, /* @__PURE__ */ i.createElement("path", { d: "M168,48V208a8,8,0,0,1-13.66,5.66l-80-80a8,8,0,0,1,0-11.32l80-80A8,8,0,0,1,168,48Z" }))],
|
|
12
|
+
["light", /* @__PURE__ */ i.createElement(i.Fragment, null, /* @__PURE__ */ i.createElement("path", { d: "M164.24,203.76a6,6,0,1,1-8.48,8.48l-80-80a6,6,0,0,1,0-8.48l80-80a6,6,0,0,1,8.48,8.48L88.49,128Z" }))],
|
|
13
|
+
["regular", /* @__PURE__ */ i.createElement(i.Fragment, null, /* @__PURE__ */ i.createElement("path", { d: "M165.66,202.34a8,8,0,0,1-11.32,11.32l-80-80a8,8,0,0,1,0-11.32l80-80a8,8,0,0,1,11.32,11.32L91.31,128Z" }))],
|
|
14
|
+
["thin", /* @__PURE__ */ i.createElement(i.Fragment, null, /* @__PURE__ */ i.createElement("path", { d: "M162.83,205.17a4,4,0,0,1-5.66,5.66l-80-80a4,4,0,0,1,0-5.66l80-80a4,4,0,1,1,5.66,5.66L85.66,128Z" }))]
|
|
15
|
+
]), o = i.forwardRef((t, n) => /* @__PURE__ */ i.createElement(e, {
|
|
16
|
+
ref: n,
|
|
17
|
+
...t,
|
|
18
|
+
weights: a
|
|
19
|
+
}));
|
|
20
|
+
o.displayName = "CaretLeftIcon";
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region ../../node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/addMonths.js
|
|
23
|
+
function s(e, r, i) {
|
|
24
|
+
let a = t(e, i?.in);
|
|
25
|
+
if (isNaN(r)) return n(i?.in || e, NaN);
|
|
26
|
+
if (!r) return a;
|
|
27
|
+
let o = a.getDate(), s = n(i?.in || e, a.getTime());
|
|
28
|
+
return s.setMonth(a.getMonth() + r + 1, 0), o >= s.getDate() ? s : (a.setFullYear(s.getFullYear(), s.getMonth(), o), a);
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region ../../node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/subDays.js
|
|
32
|
+
function c(e, t, n) {
|
|
33
|
+
return r(e, -t, n);
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region ../../node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/subMonths.js
|
|
37
|
+
function l(e, t, n) {
|
|
38
|
+
return s(e, -t, n);
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export { o as i, c as n, s as r, l as t };
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=subMonths-QcCnE3Yh.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subMonths-QcCnE3Yh.js","names":["a","f"],"sources":["../../../node_modules/.pnpm/@phosphor-icons+react@2.1.10_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@phosphor-icons/react/dist/defs/CaretLeft.es.js","../../../node_modules/.pnpm/@phosphor-icons+react@2.1.10_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@phosphor-icons/react/dist/csr/CaretLeft.es.js","../../../node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/addMonths.js","../../../node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/subDays.js","../../../node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/subMonths.js"],"sourcesContent":["import * as e from \"react\";\nconst a = /* @__PURE__ */ new Map([\n [\n \"bold\",\n /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(\"path\", { d: \"M168.49,199.51a12,12,0,0,1-17,17l-80-80a12,12,0,0,1,0-17l80-80a12,12,0,0,1,17,17L97,128Z\" }))\n ],\n [\n \"duotone\",\n /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(\"path\", { d: \"M160,48V208L80,128Z\", opacity: \"0.2\" }), /* @__PURE__ */ e.createElement(\"path\", { d: \"M163.06,40.61a8,8,0,0,0-8.72,1.73l-80,80a8,8,0,0,0,0,11.32l80,80A8,8,0,0,0,168,208V48A8,8,0,0,0,163.06,40.61ZM152,188.69,91.31,128,152,67.31Z\" }))\n ],\n [\n \"fill\",\n /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(\"path\", { d: \"M168,48V208a8,8,0,0,1-13.66,5.66l-80-80a8,8,0,0,1,0-11.32l80-80A8,8,0,0,1,168,48Z\" }))\n ],\n [\n \"light\",\n /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(\"path\", { d: \"M164.24,203.76a6,6,0,1,1-8.48,8.48l-80-80a6,6,0,0,1,0-8.48l80-80a6,6,0,0,1,8.48,8.48L88.49,128Z\" }))\n ],\n [\n \"regular\",\n /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(\"path\", { d: \"M165.66,202.34a8,8,0,0,1-11.32,11.32l-80-80a8,8,0,0,1,0-11.32l80-80a8,8,0,0,1,11.32,11.32L91.31,128Z\" }))\n ],\n [\n \"thin\",\n /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(\"path\", { d: \"M162.83,205.17a4,4,0,0,1-5.66,5.66l-80-80a4,4,0,0,1,0-5.66l80-80a4,4,0,1,1,5.66,5.66L85.66,128Z\" }))\n ]\n]);\nexport {\n a as default\n};\n","import * as e from \"react\";\nimport a from \"../lib/IconBase.es.js\";\nimport f from \"../defs/CaretLeft.es.js\";\nconst t = e.forwardRef((o, r) => /* @__PURE__ */ e.createElement(a, { ref: r, ...o, weights: f }));\nt.displayName = \"CaretLeftIcon\";\nconst s = t;\nexport {\n s as CaretLeft,\n t as CaretLeftIcon\n};\n","import { constructFrom } from \"./constructFrom.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link addMonths} function options.\n */\n\n/**\n * @name addMonths\n * @category Month Helpers\n * @summary Add the specified number of months to the given date.\n *\n * @description\n * Add the specified number of months to the given date.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The date to be changed\n * @param amount - The amount of months to be added.\n * @param options - The options object\n *\n * @returns The new date with the months added\n *\n * @example\n * // Add 5 months to 1 September 2014:\n * const result = addMonths(new Date(2014, 8, 1), 5)\n * //=> Sun Feb 01 2015 00:00:00\n *\n * // Add one month to 30 January 2023:\n * const result = addMonths(new Date(2023, 0, 30), 1)\n * //=> Tue Feb 28 2023 00:00:00\n */\nexport function addMonths(date, amount, options) {\n const _date = toDate(date, options?.in);\n if (isNaN(amount)) return constructFrom(options?.in || date, NaN);\n if (!amount) {\n // If 0 months, no-op to avoid changing times in the hour before end of DST\n return _date;\n }\n const dayOfMonth = _date.getDate();\n\n // The JS Date object supports date math by accepting out-of-bounds values for\n // month, day, etc. For example, new Date(2020, 0, 0) returns 31 Dec 2019 and\n // new Date(2020, 13, 1) returns 1 Feb 2021. This is *almost* the behavior we\n // want except that dates will wrap around the end of a month, meaning that\n // new Date(2020, 13, 31) will return 3 Mar 2021 not 28 Feb 2021 as desired. So\n // we'll default to the end of the desired month by adding 1 to the desired\n // month and using a date of 0 to back up one day to the end of the desired\n // month.\n const endOfDesiredMonth = constructFrom(options?.in || date, _date.getTime());\n endOfDesiredMonth.setMonth(_date.getMonth() + amount + 1, 0);\n const daysInMonth = endOfDesiredMonth.getDate();\n if (dayOfMonth >= daysInMonth) {\n // If we're already at the end of the month, then this is the correct date\n // and we're done.\n return endOfDesiredMonth;\n } else {\n // Otherwise, we now know that setting the original day-of-month value won't\n // cause an overflow, so set the desired day-of-month. Note that we can't\n // just set the date of `endOfDesiredMonth` because that object may have had\n // its time changed in the unusual case where where a DST transition was on\n // the last day of the month and its local time was in the hour skipped or\n // repeated next to a DST transition. So we use `date` instead which is\n // guaranteed to still have the original time.\n _date.setFullYear(\n endOfDesiredMonth.getFullYear(),\n endOfDesiredMonth.getMonth(),\n dayOfMonth,\n );\n return _date;\n }\n}\n\n// Fallback for modularized imports:\nexport default addMonths;\n","import { addDays } from \"./addDays.js\";\n\n/**\n * The {@link subDays} function options.\n */\n\n/**\n * @name subDays\n * @category Day Helpers\n * @summary Subtract the specified number of days from the given date.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The date to be changed\n * @param amount - The amount of days to be subtracted.\n * @param options - An object with options\n *\n * @returns The new date with the days subtracted\n *\n * @example\n * // Subtract 10 days from 1 September 2014:\n * const result = subDays(new Date(2014, 8, 1), 10)\n * //=> Fri Aug 22 2014 00:00:00\n */\nexport function subDays(date, amount, options) {\n return addDays(date, -amount, options);\n}\n\n// Fallback for modularized imports:\nexport default subDays;\n","import { addMonths } from \"./addMonths.js\";\n\n/**\n * The subMonths function options.\n */\n\n/**\n * @name subMonths\n * @category Month Helpers\n * @summary Subtract the specified number of months from the given date.\n *\n * @description\n * Subtract the specified number of months from the given date.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The date to be changed\n * @param amount - The amount of months to be subtracted.\n * @param options - An object with options\n *\n * @returns The new date with the months subtracted\n *\n * @example\n * // Subtract 5 months from 1 February 2015:\n * const result = subMonths(new Date(2015, 1, 1), 5)\n * //=> Mon Sep 01 2014 00:00:00\n */\nexport function subMonths(date, amount, options) {\n return addMonths(date, -amount, options);\n}\n\n// Fallback for modularized imports:\nexport default subMonths;\n"],"x_google_ignoreList":[0,1,2,3,4],"mappings":";;;;AACA,IAAM,oBAAoB,IAAI,IAAI;CAChC,CACE,QACgB,kBAAE,cAAc,EAAE,UAAU,MAAsB,kBAAE,cAAc,QAAQ,EAAE,GAAG,2FAA2F,CAAC,CAAC,CAC9L;CACA,CACE,WACgB,kBAAE,cAAc,EAAE,UAAU,MAAsB,kBAAE,cAAc,QAAQ;EAAE,GAAG;EAAuB,SAAS;CAAM,CAAC,GAAmB,kBAAE,cAAc,QAAQ,EAAE,GAAG,gJAAgJ,CAAC,CAAC,CAC1U;CACA,CACE,QACgB,kBAAE,cAAc,EAAE,UAAU,MAAsB,kBAAE,cAAc,QAAQ,EAAE,GAAG,oFAAoF,CAAC,CAAC,CACvL;CACA,CACE,SACgB,kBAAE,cAAc,EAAE,UAAU,MAAsB,kBAAE,cAAc,QAAQ,EAAE,GAAG,kGAAkG,CAAC,CAAC,CACrM;CACA,CACE,WACgB,kBAAE,cAAc,EAAE,UAAU,MAAsB,kBAAE,cAAc,QAAQ,EAAE,GAAG,uGAAuG,CAAC,CAAC,CAC1M;CACA,CACE,QACgB,kBAAE,cAAc,EAAE,UAAU,MAAsB,kBAAE,cAAc,QAAQ,EAAE,GAAG,kGAAkG,CAAC,CAAC,CACrM;AACF,CAAC,GCvBK,IAAI,EAAE,YAAY,GAAG,MAAsB,kBAAE,cAAcA,GAAG;CAAE,KAAK;CAAG,GAAG;CAAG,SAASC;AAAE,CAAC,CAAC;AACjG,EAAE,cAAc;;;AC6BhB,SAAgB,EAAU,GAAM,GAAQ,GAAS;CAC/C,IAAM,IAAQ,EAAO,GAAM,GAAS,EAAE;CACtC,IAAI,MAAM,CAAM,GAAG,OAAO,EAAc,GAAS,MAAM,GAAM,GAAG;CAChE,IAAI,CAAC,GAEH,OAAO;CAET,IAAM,IAAa,EAAM,QAAQ,GAU3B,IAAoB,EAAc,GAAS,MAAM,GAAM,EAAM,QAAQ,CAAC;CAoB1E,OAnBF,EAAkB,SAAS,EAAM,SAAS,IAAI,IAAS,GAAG,CAAC,GAEvD,KADgB,EAAkB,QACV,IAGnB,KASP,EAAM,YACJ,EAAkB,YAAY,GAC9B,EAAkB,SAAS,GAC3B,CACF,GACO;AAEX;;;AC/CA,SAAgB,EAAQ,GAAM,GAAQ,GAAS;CAC7C,OAAO,EAAQ,GAAM,CAAC,GAAQ,CAAO;AACvC;;;ACCA,SAAgB,EAAU,GAAM,GAAQ,GAAS;CAC/C,OAAO,EAAU,GAAM,CAAC,GAAQ,CAAO;AACzC"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { t as e } from "./chunk-jwUa06l-.js";
|
|
2
|
+
import { n as t } from "./fns-KbsWlOTG.js";
|
|
3
|
+
import { t as n } from "./use-stable-ref-D5LFCx0u.js";
|
|
4
|
+
import { t as r } from "./dist-DIjUECx9.js";
|
|
5
|
+
import { useCallback as i, useRef as a } from "react";
|
|
6
|
+
//#region ../../node_modules/.pnpm/storage-manager-js@4.2.6-5/node_modules/storage-manager-js/dist/index.js
|
|
7
|
+
var o = /* @__PURE__ */ e(((e) => {
|
|
8
|
+
Object.defineProperty(e, Symbol.toStringTag, { value: "Module" });
|
|
9
|
+
var t = (e, t) => {
|
|
10
|
+
try {
|
|
11
|
+
Object.keys(e).forEach(t);
|
|
12
|
+
} catch (e) {
|
|
13
|
+
window.console.log(e);
|
|
14
|
+
}
|
|
15
|
+
}, n = (e) => e == null, r = (e) => {
|
|
16
|
+
let t = typeof e;
|
|
17
|
+
return t === "string" || t === "number" || t === "boolean" || n(e);
|
|
18
|
+
}, i = (e, t) => {
|
|
19
|
+
let n = t.getItem(e);
|
|
20
|
+
try {
|
|
21
|
+
return JSON.parse(n);
|
|
22
|
+
} catch {
|
|
23
|
+
return n ?? null;
|
|
24
|
+
}
|
|
25
|
+
}, a = (e) => Object.keys(e).reduce((t, n) => ({
|
|
26
|
+
...t,
|
|
27
|
+
[n]: i(n, e)
|
|
28
|
+
}), {}), o = (e) => e instanceof Date ? e : typeof e == "number" ? /* @__PURE__ */ new Date(/* @__PURE__ */ new Date() * 1 + e * 864e5) : e, s = "1969-12-31T23:59:59.000Z", c = () => document.cookie === "" ? {} : document.cookie.split("; ").map((e) => e.split("=")).reduce((e, t) => (e[decodeURIComponent(t[0].trim())] = decodeURIComponent(t[1].trim()), e), {}), l = /* @__PURE__ */ new Set(), u = () => {
|
|
29
|
+
let e = c();
|
|
30
|
+
l.forEach((t) => t(e));
|
|
31
|
+
}, d = [
|
|
32
|
+
{
|
|
33
|
+
name: "expires",
|
|
34
|
+
parse: (e) => `expires=${o(e.expires ?? s)}`
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: "maxAge",
|
|
38
|
+
parse: (e) => e.maxAge ? `max-age=${o(e.expires ?? s)}` : ""
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: "path",
|
|
42
|
+
parse: (e) => `path=${e.path ?? "/"}`
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: "sameSite",
|
|
46
|
+
parse: (e) => `samesite=${e.sameSite ?? "strict"}`
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: "useSecure",
|
|
50
|
+
parse: (e) => `${e.useSecure ?? !0 ? "secure" : ""}`
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: "domain",
|
|
54
|
+
parse: (e) => {
|
|
55
|
+
let t = e.domain ?? "";
|
|
56
|
+
return t === "" ? "" : `domain=${e.multiDomain ? "." : ""}${t}`;
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: "partitioned",
|
|
61
|
+
parse: (e) => e.partitioned ? "Partitioned" : ""
|
|
62
|
+
}
|
|
63
|
+
], f = {
|
|
64
|
+
json: c,
|
|
65
|
+
listener: (e) => (l.add(e), () => l.delete(e)),
|
|
66
|
+
clearListeners: () => l.clear(),
|
|
67
|
+
has: (e) => document.cookie.split(";").some((t) => t.trim().startsWith(`${e}=`)),
|
|
68
|
+
deleteAll: () => {
|
|
69
|
+
document.cookie.split(";").forEach((e) => {
|
|
70
|
+
document.cookie = e.replace(/^ +/, "").replace(/=.*/, `=;expires=${(/* @__PURE__ */ new Date()).toUTCString()};path=/`);
|
|
71
|
+
}), u();
|
|
72
|
+
},
|
|
73
|
+
get: (e) => {
|
|
74
|
+
let t = f.json()[e];
|
|
75
|
+
if (n(t)) return null;
|
|
76
|
+
try {
|
|
77
|
+
return JSON.parse(decodeURIComponent(t));
|
|
78
|
+
} catch {
|
|
79
|
+
return t;
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
delete: (e) => {
|
|
83
|
+
document.cookie = `${encodeURIComponent(e)}=;expires=${(/* @__PURE__ */ new Date()).toUTCString()}`, u();
|
|
84
|
+
},
|
|
85
|
+
set: (e, t, n = {}) => {
|
|
86
|
+
let i = r(t) ? t : encodeURIComponent(JSON.stringify(t)), a = d.reduce((e, t) => {
|
|
87
|
+
let r = t.parse(n);
|
|
88
|
+
return r === "" ? e : e.concat(r);
|
|
89
|
+
}, [`${encodeURIComponent(e)}=${i}`]).join(";");
|
|
90
|
+
document.cookie = a, u();
|
|
91
|
+
}
|
|
92
|
+
}, p = (e) => {
|
|
93
|
+
let r = /* @__PURE__ */ new Set(), o = (t) => {
|
|
94
|
+
e().removeItem(t);
|
|
95
|
+
let n = a(e());
|
|
96
|
+
r.forEach((e) => e(n));
|
|
97
|
+
};
|
|
98
|
+
return {
|
|
99
|
+
delete: o,
|
|
100
|
+
listener: (e) => (r.add(e), () => r.delete(e)),
|
|
101
|
+
clearListeners: () => r.clear(),
|
|
102
|
+
json: (t = !1) => t ? a(e()) : e(),
|
|
103
|
+
has: (t) => !n(e().getItem(t)),
|
|
104
|
+
deleteAll: () => {
|
|
105
|
+
t(e(), o), r.forEach((t) => t(e()));
|
|
106
|
+
},
|
|
107
|
+
get: (t) => i(t, e()),
|
|
108
|
+
set: (t, n) => {
|
|
109
|
+
e().setItem(t, JSON.stringify(n)), r.forEach((t) => t(e()));
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
}, m = p(() => window.sessionStorage), h = p(() => window.localStorage);
|
|
113
|
+
e.Cookie = f, e.LocalStorage = h, e.SessionStorage = m, e.createStorage = p;
|
|
114
|
+
})), s = o(), c = (e) => e.headerLabel ?? e.thead ?? e.id, l = (e) => e.map((e) => ({
|
|
115
|
+
value: e.id,
|
|
116
|
+
label: e.thead ?? e.headerLabel ?? e.id
|
|
117
|
+
})), u = /* @__PURE__ */ function(e) {
|
|
118
|
+
return e.Boolean = "boolean", e.Number = "number", e.Select = "select", e.Text = "text", e;
|
|
119
|
+
}({}), d = (e) => e.type === "number" ? e.valueAsNumber : e.value, f = (e) => {
|
|
120
|
+
let t = [];
|
|
121
|
+
return e({
|
|
122
|
+
add: (e, n, r) => t.push({
|
|
123
|
+
...r,
|
|
124
|
+
id: e,
|
|
125
|
+
thead: n
|
|
126
|
+
}),
|
|
127
|
+
remove: (e) => t = t.filter((t) => t.id !== e),
|
|
128
|
+
getAll: () => Array.from(t),
|
|
129
|
+
filter: (e) => t = Array.from(t.filter(e))
|
|
130
|
+
}), t;
|
|
131
|
+
}, p = {}, m = (e, t) => {
|
|
132
|
+
if (!Array.isArray(t)) return e;
|
|
133
|
+
let n = new Set(t.map((e) => e.id));
|
|
134
|
+
if (!e.every((e) => n.has(e.id))) return e;
|
|
135
|
+
let r = new Map(e.map((e) => [e.id, e]));
|
|
136
|
+
return t.map((t, n) => {
|
|
137
|
+
let i = r.get(t.id);
|
|
138
|
+
return i === void 0 ? e[n] : i;
|
|
139
|
+
});
|
|
140
|
+
}, h = (e, n, i = p) => {
|
|
141
|
+
let a = t() ? null : s.LocalStorage.get(`@components/table-${e}`) || null, [o, c] = r({
|
|
142
|
+
name: e,
|
|
143
|
+
groups: i.groups || a?.groups || [],
|
|
144
|
+
sorters: i.sorters || a?.sorters || [],
|
|
145
|
+
filters: i.filters || a?.filters || [],
|
|
146
|
+
cols: m(n, a?.cols)
|
|
147
|
+
}, (e) => {
|
|
148
|
+
let n = (n) => {
|
|
149
|
+
let r = e.state(), i = {
|
|
150
|
+
...r,
|
|
151
|
+
...n
|
|
152
|
+
};
|
|
153
|
+
return t() || s.LocalStorage.set(`@components/table-${r.name}`, i), i;
|
|
154
|
+
};
|
|
155
|
+
return n(e.state()), { set: (e) => n(e) };
|
|
156
|
+
});
|
|
157
|
+
return {
|
|
158
|
+
...o,
|
|
159
|
+
...c,
|
|
160
|
+
name: e
|
|
161
|
+
};
|
|
162
|
+
}, g = (e) => {
|
|
163
|
+
let t = n(e), r = a(null);
|
|
164
|
+
return [r, i((e) => {
|
|
165
|
+
t.current(e), e.forEach((e) => {
|
|
166
|
+
let t = r.current.querySelector(`th[data-tableheader="${e.id}"]`);
|
|
167
|
+
t && (t.style.width = "auto");
|
|
168
|
+
});
|
|
169
|
+
}, [t])];
|
|
170
|
+
}, _ = () => t() ? void 0 : document.querySelector("[data-component=\"modal-body\"]");
|
|
171
|
+
//#endregion
|
|
172
|
+
export { _ as a, d as c, c as i, o as l, f as n, h as o, l as r, g as s, u as t };
|
|
173
|
+
|
|
174
|
+
//# sourceMappingURL=table-lib-1bkYSklk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-lib-1bkYSklk.js","names":[],"sources":["../../../node_modules/.pnpm/storage-manager-js@4.2.6-5/node_modules/storage-manager-js/dist/index.js","../src/components/table/table-lib.ts"],"sourcesContent":["\"use strict\";Object.defineProperty(exports,Symbol.toStringTag,{value:\"Module\"});const k=(e,t)=>{try{Object.keys(e).forEach(t)}catch(o){window.console.log(o)}},i=e=>e==null,w=e=>{const t=typeof e;return t===\"string\"||t===\"number\"||t===\"boolean\"||i(e)},h=(e,t)=>{const o=t.getItem(e);try{return JSON.parse(o)}catch{return o??null}},u=e=>Object.keys(e).reduce((t,o)=>({...t,[o]:h(o,e)}),{}),p=e=>e instanceof Date?e:typeof e==\"number\"?new Date(new Date*1+e*864e5):e,d=\"1969-12-31T23:59:59.000Z\",S=()=>document.cookie===\"\"?{}:document.cookie.split(\"; \").map(t=>t.split(\"=\")).reduce((t,o)=>(t[decodeURIComponent(o[0].trim())]=decodeURIComponent(o[1].trim()),t),{}),c=new Set,a=()=>{const e=S();c.forEach(t=>t(e))},y=[{name:\"expires\",parse:e=>`expires=${p(e.expires??d)}`},{name:\"maxAge\",parse:e=>e.maxAge?`max-age=${p(e.expires??d)}`:\"\"},{name:\"path\",parse:e=>`path=${e.path??\"/\"}`},{name:\"sameSite\",parse:e=>`samesite=${e.sameSite??\"strict\"}`},{name:\"useSecure\",parse:e=>`${e.useSecure??!0?\"secure\":\"\"}`},{name:\"domain\",parse:e=>{const t=e.domain??\"\";return t===\"\"?\"\":`domain=${e.multiDomain?\".\":\"\"}${t}`}},{name:\"partitioned\",parse:e=>e.partitioned?\"Partitioned\":\"\"}],f={json:S,listener:e=>(c.add(e),()=>c.delete(e)),clearListeners:()=>c.clear(),has:e=>document.cookie.split(\";\").some(t=>t.trim().startsWith(`${e}=`)),deleteAll:()=>{document.cookie.split(\";\").forEach(e=>{document.cookie=e.replace(/^ +/,\"\").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}),a()},get:e=>{const t=f.json()[e];if(i(t))return null;try{return JSON.parse(decodeURIComponent(t))}catch{return t}},delete:e=>{document.cookie=`${encodeURIComponent(e)}=;expires=${new Date().toUTCString()}`,a()},set:(e,t,o={})=>{const n=w(t)?t:encodeURIComponent(JSON.stringify(t)),s=y.reduce((r,$)=>{const m=$.parse(o);return m===\"\"?r:r.concat(m)},[`${encodeURIComponent(e)}=${n}`]).join(\";\");document.cookie=s,a()}},l=e=>{const t=new Set,o=n=>{e().removeItem(n);const s=u(e());t.forEach(r=>r(s))};return{delete:o,listener:n=>(t.add(n),()=>t.delete(n)),clearListeners:()=>t.clear(),json:(n=!1)=>n?u(e()):e(),has:n=>{const s=e().getItem(n);return!i(s)},deleteAll:()=>{k(e(),o),t.forEach(n=>n(e()))},get:n=>h(n,e()),set:(n,s)=>{e().setItem(n,JSON.stringify(s)),t.forEach(r=>r(e()))}}},I=l(()=>window.sessionStorage),C=l(()=>window.localStorage);exports.Cookie=f;exports.LocalStorage=C;exports.SessionStorage=I;exports.createStorage=l;\n//# sourceMappingURL=index.js.map\n","\"use client\";\nimport React, { useCallback, useRef } from \"react\";\nimport { AllPaths } from \"sidekicker\";\nimport { LocalStorage } from \"storage-manager-js\";\nimport { useReducer } from \"use-typed-reducer\";\nimport { useStableRef } from \"../../hooks/use-stable-ref\";\nimport { isSsr } from \"../../lib/fns\";\nimport { Any, POJO, SetState } from \"../../types\";\nimport { OptionProps } from \"../form/select\";\nimport { FilterConfig } from \"./filter\";\nimport { GroupItem } from \"./group\";\nimport { Sorter } from \"./sort\";\n\nexport const getLabel = <T extends POJO>(col: Col<T>) => col.headerLabel ?? col.thead ?? (col.id as string);\n\nexport type TableConfiguration<T extends POJO, M extends POJO = Any> = M & {\n cols: Col<T>[];\n options: OptionProps[];\n};\n\nexport const createOptionCols = <T extends POJO>(cols: Col<T>[]): OptionProps[] =>\n cols.map((opt) => ({\n value: opt.id as string,\n label: (opt.thead ?? opt.headerLabel ?? (opt.id as string)) as string,\n }));\n\nexport enum ColType {\n Boolean = \"boolean\",\n Number = \"number\",\n Select = \"select\",\n Text = \"text\",\n}\n\nexport const valueFromType = (input: HTMLInputElement) => (input.type === \"number\" ? input.valueAsNumber : input.value);\n\ntype THead = React.ReactElement | React.ReactNode;\n\nexport type ColMatrix = `${number},${number}`;\n\n// ref: https://github.com/gvergnaud/hotscript/blob/main/src/internals/objects/impl/objects.ts\ntype ParsePath<path, output extends string[] = [], currentChunk extends string = \"\"> = path extends number\n ? [`${path}`]\n : path extends `${infer first}${infer rest}`\n ? first extends \".\" | \"[\" | \"]\"\n ? ParsePath<rest, [...output, ...(currentChunk extends \"\" ? [] : [currentChunk])], \"\">\n : ParsePath<rest, output, `${currentChunk}${first}`>\n : [...output, ...(currentChunk extends \"\" ? [] : [currentChunk])];\n\ntype RecursiveGet<Obj, pathList> = Obj extends any\n ? pathList extends [infer first, ...infer rest]\n ? first extends keyof Obj\n ? RecursiveGet<Obj[first], rest>\n : [first, Obj] extends [`${number}` | \"number\", readonly any[]]\n ? RecursiveGet<Extract<Obj, any[]>[number], rest>\n : undefined\n : Obj\n : never;\n\ntype GetFromPath<Obj, path> = RecursiveGet<Obj, ParsePath<path>>;\n\nexport type CellAsideElement<T extends POJO> = {\n row: T;\n rowIndex: number;\n col: ColOptions<T, AllPaths<T>>;\n};\n\nexport type CellPropsElement<T extends POJO, K extends AllPaths<T>> = {\n row: T;\n value: GetFromPath<T, K>;\n rowIndex: number;\n matrix: ColMatrix;\n col: ColOptions<T, K> & { id: K; thead: THead };\n};\n\ntype ColOptions<T extends POJO, K extends AllPaths<T>> = Partial<{\n type: ColType;\n allowSort: boolean;\n headerLabel: string;\n allowFilter: boolean;\n Element: React.FC<CellPropsElement<T, K>>;\n thProps: React.HTMLAttributes<HTMLTableCellElement>;\n cellProps: React.HTMLAttributes<HTMLTableCellElement>;\n}>;\n\nexport type ColConstructor<T extends POJO> = {\n getAll: () => Col<T>[];\n remove: <K extends AllPaths<T>>(id: K) => void;\n filter: (c: (c: Col<T>) => boolean) => Col<T>[];\n add: <K extends AllPaths<T>>(id: K, thead: THead, props?: ColOptions<T, K>) => void;\n};\n\nconst cols =\n <T extends POJO>() =>\n <K extends AllPaths<T>>(id: K, thead: THead, options: ColOptions<T, K>) => ({ ...options, id, thead });\n\nexport type Col<T extends POJO> = ReturnType<ReturnType<typeof cols<T>>>;\n\nexport type TablePagination = {\n size: number;\n pages: number;\n current: number;\n hasNext: boolean;\n sizes?: number[];\n totalItems: number;\n hasPrevious: boolean;\n onChangeSize?: (size: number) => void;\n asLink?: React.FC<React.PropsWithChildren<{ href: number | \"previous\" | \"next\"; className: string }>>;\n};\n\nexport type TableGetters<T extends POJO> = {\n rows: T[];\n cols: Col<T>[];\n sorters: Sorter<T>[];\n groups: GroupItem<T>[];\n filters: FilterConfig<T>[];\n pagination: TablePagination | null;\n};\n\ntype TableSetters<T extends POJO> = {\n setCols: SetState<Col<T>[]>;\n setSorters: SetState<Sorter<T>[]>;\n setGroups: SetState<GroupItem<T>[]>;\n setFilters: SetState<FilterConfig<T>[]>;\n};\n\nexport type TableOperationProps<T extends POJO> = TableConfiguration<\n T,\n TableSetters<T> &\n TableGetters<T> & {\n set?: (v: TableGetters<T>) => void;\n } & {\n inlineSorter: boolean;\n inlineFilter: boolean;\n }\n>;\n\nexport const createColumns = <T extends POJO>(callback: (o: ColConstructor<T>) => void) => {\n let items: Col<T>[] = [];\n const add: ColConstructor<T>[\"add\"] = (id, thead, options) => items.push({ ...options, id, thead } as Col<T>);\n const remove: ColConstructor<T>[\"remove\"] = (id) => (items = items.filter((x) => x.id !== id));\n const getAll: ColConstructor<T>[\"getAll\"] = () => Array.from(items);\n const filter: ColConstructor<T>[\"filter\"] = (c) => (items = Array.from(items.filter(c)));\n callback({ add, remove, getAll, filter });\n return items;\n};\n\ntype TablePreferenceState<T extends POJO> = {\n name: string;\n cols: Col<T>[];\n groups: GroupItem<T>[];\n sorters: Sorter<T>[];\n filters: FilterConfig<T>[];\n};\n\nconst noop = {};\n\nconst mergeCols = <T extends POJO>(cols: Col<T>[], saved?: Col<T>[]) => {\n if (!Array.isArray(saved)) return cols;\n const savedSet = new Set(saved.map((x) => x.id));\n if (!cols.every((x) => savedSet.has(x.id))) {\n return cols;\n }\n const map = new Map(cols.map((x) => [x.id, x]));\n return saved.map((mock, index) => {\n const original = map.get(mock.id);\n if (original === undefined) return cols[index];\n return original;\n });\n};\n\nexport const useTablePreferences = <T extends POJO>(name: string, cols: Col<T>[], options: Partial<TableGetters<T>> = noop) => {\n const init: TableGetters<T> | null = isSsr() ? null : (LocalStorage.get(`@components/table-${name}`) as TableGetters<T>) || null;\n const [state, dispatch] = useReducer(\n {\n name,\n groups: options.groups || init?.groups || [],\n sorters: options.sorters || init?.sorters || [],\n filters: options.filters || init?.filters || [],\n cols: mergeCols(cols, init?.cols),\n } as Omit<TableGetters<T>, \"rows\"> & { name: string },\n (get) => {\n const intercept = (partial: Partial<TablePreferenceState<T>>) => {\n const prev = get.state();\n const result = { ...prev, ...partial };\n if (!isSsr()) LocalStorage.set(`@components/table-${prev.name}`, result);\n return result;\n };\n intercept(get.state());\n return {\n set: (getters: TableGetters<T>) => intercept(getters),\n };\n }\n );\n return { ...state, ...dispatch, name };\n};\n\nexport const useWidthControl = <T extends object>(reorder: (c: Col<T>[]) => void) => {\n const stableRef = useStableRef(reorder);\n const ref = useRef<HTMLTableRowElement>(null);\n const onChange = useCallback(\n (cols: Col<T>[]) => {\n stableRef.current(cols);\n cols.forEach((x) => {\n const c = ref.current!.querySelector(`th[data-tableheader=\"${x.id}\"]`) as HTMLElement | null;\n if (!c) return;\n c.style.width = \"auto\";\n });\n },\n [stableRef]\n );\n return [ref, onChange] as const;\n};\n\nexport const getModalScrollerRef = () => (isSsr() ? undefined : (document.querySelector(`[data-component=\"modal-body\"]`) as HTMLElement));\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;CAAa,OAAO,eAAe,GAAQ,OAAO,aAAY,EAAC,OAAM,SAAQ,CAAC;CAAE,IAAM,KAAG,GAAE,MAAI;EAAC,IAAG;GAAC,OAAO,KAAK,CAAC,EAAE,QAAQ,CAAC;EAAC,SAAO,GAAE;GAAC,OAAO,QAAQ,IAAI,CAAC;EAAC;CAAC,GAAE,KAAE,MAAG,KAAG,MAAK,KAAE,MAAG;EAAC,IAAM,IAAE,OAAO;EAAE,OAAO,MAAI,YAAU,MAAI,YAAU,MAAI,aAAW,EAAE,CAAC;CAAC,GAAE,KAAG,GAAE,MAAI;EAAC,IAAM,IAAE,EAAE,QAAQ,CAAC;EAAE,IAAG;GAAC,OAAO,KAAK,MAAM,CAAC;EAAC,QAAM;GAAC,OAAO,KAAG;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C,MAAmC;CACjF,IAAM,IAAY,EAAa,CAAO,GAChC,IAAM,EAA4B,IAAI;CAY5C,OAAO,CAAC,GAXS,GACZ,MAAmB;EAEhB,AADA,EAAU,QAAQ,CAAI,GACtB,EAAK,SAAS,MAAM;GAChB,IAAM,IAAI,EAAI,QAAS,cAAc,wBAAwB,EAAE,GAAG,GAAG;GAChE,MACL,EAAE,MAAM,QAAQ;EACpB,CAAC;CACL,GACA,CAAC,CAAS,CAED,CAAQ;AACzB,GAEa,UAA6B,EAAM,IAAI,KAAA,IAAa,SAAS,cAAc,iCAA+B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { p as e, t } from "./dom-Bn4wY_Zx.js";
|
|
2
|
-
import {
|
|
2
|
+
import { Polymorph as n } from "./components/core/polymorph.js";
|
|
3
3
|
import { t as r } from "./use-stable-ref-D5LFCx0u.js";
|
|
4
4
|
import { Card as i } from "./components/display/card.js";
|
|
5
5
|
import a, { createContext as o, useContext as s, useEffect as c, useRef as l, useState as u } from "react";
|
|
@@ -119,4 +119,4 @@ var p = (e, t) => {
|
|
|
119
119
|
//#endregion
|
|
120
120
|
export { x as n, p as r, C as t };
|
|
121
121
|
|
|
122
|
-
//# sourceMappingURL=tabs-
|
|
122
|
+
//# sourceMappingURL=tabs-Brc963EW.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs-Ciy0l9OF.js","names":[],"sources":["../src/hooks/use-reactive.ts","../src/lib/keyboard-area.ts","../src/components/display/tabs.tsx"],"sourcesContent":["\"use client\";\nimport { useEffect, useState } from \"react\";\n\nexport const useReactive = <T>(t: T, initial?: T) => {\n const [state, setState] = useState(() => (initial ? initial : t));\n useEffect(() => {\n setState(t);\n }, [t]);\n return [state, setState] as const;\n};\n","import React from \"react\";\n\ntype EventKey =\n | \"Backspace\"\n | \"Tab\"\n | \"Enter\"\n | \"Shift\"\n | \"Control\"\n | \"Alt\"\n | \"Pause\"\n | \"CapsLock\"\n | \"Escape\"\n | \"Space\"\n | \"PageUp\"\n | \"PageDown\"\n | \"End\"\n | \"Home\"\n | \"ArrowLeft\"\n | \"ArrowUp\"\n | \"ArrowRight\"\n | \"ArrowDown\"\n | \"PrintScreen\"\n | \"Insert\"\n | \"Delete\"\n | \"0\"\n | \"1\"\n | \"2\"\n | \"3\"\n | \"4\"\n | \"5\"\n | \"6\"\n | \"7\"\n | \"8\"\n | \"9\"\n | \"a\"\n | \"b\"\n | \"c\"\n | \"d\"\n | \"e\"\n | \"f\"\n | \"g\"\n | \"h\"\n | \"i\"\n | \"j\"\n | \"k\"\n | \"l\"\n | \"m\"\n | \"n\"\n | \"o\"\n | \"p\"\n | \"q\"\n | \"r\"\n | \"s\"\n | \"t\"\n | \"u\"\n | \"v\"\n | \"w\"\n | \"x\"\n | \"y\"\n | \"z\"\n | \"Meta\"\n | \"ContextMenu\"\n | \"F1\"\n | \"F2\"\n | \"F3\"\n | \"F4\"\n | \"F5\"\n | \"F6\"\n | \"F7\"\n | \"F8\"\n | \"F9\"\n | \"F10\"\n | \"F11\"\n | \"F12\"\n | \"NumLock\"\n | \"ScrollLock\"\n | \"AudioVolumeMute\"\n | \"AudioVolumeUp\"\n | \"AudioVolumeDown\"\n | \"MediaTrackNext\"\n | \"MediaTrackPrevious\"\n | \"MediaStop\"\n | \"MediaPlayPause\"\n | \"LaunchMail\"\n | \"LaunchMediaPlayer\"\n | \"LaunchApplication1\"\n | \"LaunchApplication2\"\n | \"Semicolon\"\n | \"Equal\"\n | \"Comma\"\n | \"Minus\"\n | \"Period\"\n | \"Slash\"\n | \"Backquote\"\n | \"BracketLeft\"\n | \"Backslash\"\n | \"BracketRight\"\n | \"Quote\";\n\nexport const keyboardKeys = {\n ArrowUp: \"ArrowUp\",\n ArrowDown: \"ArrowDown\",\n ArrowLeft: \"ArrowLeft\",\n ArrowRight: \"ArrowRight\",\n} as const;\n\ntype Callback<T extends HTMLElement = HTMLElement> = (e: KeyboardEvent | React.KeyboardEvent<T>) => void;\n\nexport class KeyboardArea<T extends HTMLElement> {\n private set = new Set();\n\n public key(key: EventKey, callback: Callback<T>) {\n const fn: Callback<T> = (e) => (e.key === key ? callback(e) : undefined);\n return () => this.set.delete(fn);\n }\n\n public onKeyDown(_: Callback<T>) {}\n}\n","\"use client\";\nimport React, { createContext, PropsWithChildren, useContext, useEffect, useRef } from \"react\";\nimport { Is, Nullable } from \"sidekicker\";\nimport { useReactive } from \"../../hooks/use-reactive\";\nimport { useStableRef } from \"../../hooks/use-stable-ref\";\nimport { css } from \"../../lib/dom\";\nimport { keyboardKeys } from \"../../lib/keyboard-area\";\nimport { Label } from \"../../types\";\nimport { Polymorph } from \"../core/polymorph\";\nimport { Card, CardProps } from \"./card\";\n\nexport type TabsProps = Omit<CardProps<\"div\">, \"onChange\"> & {\n active: string;\n container?: string;\n className?: string;\n onChange?: (id: string) => void;\n};\n\nconst Context = createContext<string>(\"\");\n\nconst isElementDisabled = (element: HTMLElement): boolean => element.hasAttribute(\"disabled\") || element.getAttribute(\"aria-disabled\") === \"true\";\n\nconst getNElement = (elements: HTMLElement[], currentIndex: number, direction: \"backward\" | \"forward\"): HTMLElement | null => {\n const step = direction === \"forward\" ? 1 : -1;\n const startIndex = currentIndex + step;\n for (let i = startIndex; i >= 0 && i < elements.length; i += step) {\n const element = elements[i];\n if (!isElementDisabled(element)) return element;\n }\n return direction === \"backward\" ? getNElement(elements, elements.length - 1, \"backward\") : getNElement(elements, -1, \"forward\");\n};\n\nconst moveOn = (ul: HTMLUListElement, direction: \"backward\" | \"forward\") => {\n const items = Array.from(ul.querySelectorAll(\"li\"));\n const find = items.findIndex((x) => x.dataset.active === \"true\");\n if (find === -1) return null;\n const item = getNElement(items, find, direction);\n if (item === null) return null;\n item.querySelector(\"button\")?.focus({ preventScroll: false });\n return item.getAttribute(\"data-id\") || \"\";\n};\n\nconst moveToEdge = (ul: HTMLUListElement, edge: \"first\" | \"last\") => {\n const items = Array.from(ul.querySelectorAll(\"li\"));\n const ordered = edge === \"first\" ? items : [...items].reverse();\n for (const item of ordered) {\n if (!isElementDisabled(item)) {\n item.querySelector(\"button\")?.focus({ preventScroll: false });\n return item.getAttribute(\"data-id\") || \"\";\n }\n }\n return null;\n};\n\nconst actionKeys = {\n [keyboardKeys.ArrowLeft]: (_: unknown, ul: HTMLUListElement): Nullable<string> => moveOn(ul, \"backward\"),\n [keyboardKeys.ArrowRight]: (_: unknown, ul: HTMLUListElement): Nullable<string> => moveOn(ul, \"forward\"),\n};\n\nexport const Tabs = (props: PropsWithChildren<TabsProps>) => {\n const [active, setActive] = useReactive(props.active);\n const ref = useRef<HTMLUListElement | null>(null);\n const onChangeRef = useStableRef(props.onChange);\n\n useEffect(() => {\n const header = ref.current;\n if (header === null) return;\n let first = header.querySelector<HTMLElement>(`li[data-active=true]`);\n if (first === null) {\n first = header.querySelector<HTMLElement>(`li[data-id]`)!;\n const id = first.getAttribute(\"data-id\") || \"\";\n setActive(id);\n }\n }, [props.active, setActive]);\n\n useEffect(() => {\n if (onChangeRef.current) onChangeRef.current(active);\n }, [onChangeRef, active]);\n\n const items = React.Children.toArray(props.children as React.ReactElement<TabProps>) as Array<React.ReactElement<TabProps>>;\n\n const onClick = (e: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>) => {\n const anchor = e.currentTarget;\n setActive(anchor.dataset.id || \"\");\n };\n\n const onKeyDown = (e: React.KeyboardEvent<HTMLUListElement>) => {\n if (ref.current === null) return;\n const k = e.key;\n if (Is.keyof(actionKeys, k)) {\n const fn = actionKeys[k];\n const result = fn(e, ref.current);\n if (result === null) return;\n setActive(result);\n } else if (k === \"Home\") {\n e.preventDefault();\n const result = moveToEdge(ref.current, \"first\");\n if (result) setActive(result);\n } else if (k === \"End\") {\n e.preventDefault();\n const result = moveToEdge(ref.current, \"last\");\n if (result) setActive(result);\n }\n };\n\n return (\n <Context.Provider value={active}>\n <Card\n className={props.className}\n container={css(\"pt-0 max-w-full w-full min-w-0\", props.container)}\n header={\n <header className=\"relative mb-tabs-header-mb overflow-x-auto\">\n <div className=\"absolute bottom-0 h-tabs-divider-h w-full bg-card-border\" />\n <nav className=\"min-w-0\">\n <ul role=\"tablist\" onKeyDown={onKeyDown} ref={ref} className=\"flex w-0 min-w-full flex-1 justify-start overflow-x-auto\">\n {items.map((x: React.ReactElement<TabProps>) => {\n const inner = x.props;\n const current = active === inner.id;\n return (\n <li\n data-id={inner.id}\n data-active={current}\n key={`tab-header-${inner.id}`}\n className={css(\n \"relative w-fit border-b border-transparent transition-all\",\n current ? \"border-primary font-medium text-primary\" : \"\",\n inner.disabled ? \"aria-disabled:text-disabled\" : \"\"\n )}\n >\n <Polymorph\n role=\"tab\"\n as=\"button\"\n type=\"button\"\n data-id={inner.id}\n id={`${inner.id}-tab`}\n aria-selected={current}\n disabled={inner.disabled}\n tabIndex={current ? 0 : -1}\n aria-controls={`${inner.id}-panel`}\n onClick={inner.disabled ? undefined : onClick}\n className=\"block w-full whitespace-nowrap px-tabs-item-px py-tabs-item-py disabled:cursor-not-allowed\"\n >\n {inner.title as React.ReactNode}\n </Polymorph>\n </li>\n );\n })}\n </ul>\n </nav>\n </header>\n }\n >\n {props.children}\n </Card>\n </Context.Provider>\n );\n};\n\nconst useTabs = () => useContext(Context);\n\ntype CommonTabProps = { id: string; disabled?: boolean };\n\nexport type TabProps = CommonTabProps &\n (\n | { title: string; label?: undefined }\n | {\n label: string;\n title: Omit<Label, string>;\n }\n );\n\nexport const Tab = (props: PropsWithChildren<TabProps>) => {\n const active = useTabs();\n if (props.id !== active) return null;\n return (\n <div role=\"tabpanel\" tabIndex={0} id={`${props.id}-panel`} aria-labelledby={`${props.id}-tab`}>\n {props.children}\n </div>\n );\n};\n"],"mappings":";;;;;;;AAGA,IAAa,KAAkB,GAAM,MAAgB;CACjD,IAAM,CAAC,GAAO,KAAY,QAAgB,KAAoB,CAAE;CAIhE,OAHA,QAAgB;EACZ,EAAS,CAAC;CACd,GAAG,CAAC,CAAC,CAAC,GACC,CAAC,GAAO,CAAQ;AA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S,OAAO;QAC9C,AAAI,KAAQ,EAAU,CAAM;OAChC,OAAO,IAAI,MAAM,OAAO;QACpB,EAAE,eAAe;QACjB,IAAM,IAAS,EAAW,EAAI,SAAS,MAAM;QAC7C,AAAI,KAAQ,EAAU,CAAM;OAChC;MACJ;MAWsE;MAAK,WAAU;gBACxD,EAAM,KAAK,MAAoC;OAC5C,IAAM,IAAQ,EAAE,OACV,IAAU,MAAW,EAAM;OACjC,OACI,kBAAC,MAAD;QACI,WAAS,EAAM;QACf,eAAa;QAEb,WAAW,EACP,6DACA,IAAU,4CAA4C,IACtD,EAAM,WAAW,gCAAgC,EACrD;kBAEA,kBAAC,GAAD;SACI,MAAK;SACL,IAAG;SACH,MAAK;SACL,WAAS,EAAM;SACf,IAAI,GAAG,EAAM,GAAG;SAChB,iBAAe;SACf,UAAU,EAAM;SAChB,UAAU,IAAU,IAAI;SACxB,iBAAe,GAAG,EAAM,GAAG;SAC3B,SAAS,EAAM,WAAW,KAAA,IAAY;SACtC,WAAU;mBAET,EAAM;QACA,CAAA;OACX,GAtBK,cAAc,EAAM,IAsBzB;MAEZ,CAAC;KACD,CAAA;IACH,CAAA,CACD;;aAGX,EAAM;EACL,CAAA;CACQ,CAAA;AAE1B,GAEM,UAAgB,EAAW,CAAO,GAa3B,KAAO,MAAuC;CACvD,IAAM,IAAS,EAAQ;CAEvB,OADI,EAAM,OAAO,IAEb,kBAAC,OAAD;EAAK,MAAK;EAAW,UAAU;EAAG,IAAI,GAAG,EAAM,GAAG;EAAS,mBAAiB,GAAG,EAAM,GAAG;YACnF,EAAM;CACN,CAAA,IAJuB;AAMpC"}
|
|
1
|
+
{"version":3,"file":"tabs-Brc963EW.js","names":[],"sources":["../src/hooks/use-reactive.ts","../src/lib/keyboard-area.ts","../src/components/display/tabs.tsx"],"sourcesContent":["\"use client\";\nimport { useEffect, useState } from \"react\";\n\nexport const useReactive = <T>(t: T, initial?: T) => {\n const [state, setState] = useState(() => (initial ? initial : t));\n useEffect(() => {\n setState(t);\n }, [t]);\n return [state, setState] as const;\n};\n","import React from \"react\";\n\ntype EventKey =\n | \"Backspace\"\n | \"Tab\"\n | \"Enter\"\n | \"Shift\"\n | \"Control\"\n | \"Alt\"\n | \"Pause\"\n | \"CapsLock\"\n | \"Escape\"\n | \"Space\"\n | \"PageUp\"\n | \"PageDown\"\n | \"End\"\n | \"Home\"\n | \"ArrowLeft\"\n | \"ArrowUp\"\n | \"ArrowRight\"\n | \"ArrowDown\"\n | \"PrintScreen\"\n | \"Insert\"\n | \"Delete\"\n | \"0\"\n | \"1\"\n | \"2\"\n | \"3\"\n | \"4\"\n | \"5\"\n | \"6\"\n | \"7\"\n | \"8\"\n | \"9\"\n | \"a\"\n | \"b\"\n | \"c\"\n | \"d\"\n | \"e\"\n | \"f\"\n | \"g\"\n | \"h\"\n | \"i\"\n | \"j\"\n | \"k\"\n | \"l\"\n | \"m\"\n | \"n\"\n | \"o\"\n | \"p\"\n | \"q\"\n | \"r\"\n | \"s\"\n | \"t\"\n | \"u\"\n | \"v\"\n | \"w\"\n | \"x\"\n | \"y\"\n | \"z\"\n | \"Meta\"\n | \"ContextMenu\"\n | \"F1\"\n | \"F2\"\n | \"F3\"\n | \"F4\"\n | \"F5\"\n | \"F6\"\n | \"F7\"\n | \"F8\"\n | \"F9\"\n | \"F10\"\n | \"F11\"\n | \"F12\"\n | \"NumLock\"\n | \"ScrollLock\"\n | \"AudioVolumeMute\"\n | \"AudioVolumeUp\"\n | \"AudioVolumeDown\"\n | \"MediaTrackNext\"\n | \"MediaTrackPrevious\"\n | \"MediaStop\"\n | \"MediaPlayPause\"\n | \"LaunchMail\"\n | \"LaunchMediaPlayer\"\n | \"LaunchApplication1\"\n | \"LaunchApplication2\"\n | \"Semicolon\"\n | \"Equal\"\n | \"Comma\"\n | \"Minus\"\n | \"Period\"\n | \"Slash\"\n | \"Backquote\"\n | \"BracketLeft\"\n | \"Backslash\"\n | \"BracketRight\"\n | \"Quote\";\n\nexport const keyboardKeys = {\n ArrowUp: \"ArrowUp\",\n ArrowDown: \"ArrowDown\",\n ArrowLeft: \"ArrowLeft\",\n ArrowRight: \"ArrowRight\",\n} as const;\n\ntype Callback<T extends HTMLElement = HTMLElement> = (e: KeyboardEvent | React.KeyboardEvent<T>) => void;\n\nexport class KeyboardArea<T extends HTMLElement> {\n private set = new Set();\n\n public key(key: EventKey, callback: Callback<T>) {\n const fn: Callback<T> = (e) => (e.key === key ? callback(e) : undefined);\n return () => this.set.delete(fn);\n }\n\n public onKeyDown(_: Callback<T>) {}\n}\n","\"use client\";\nimport React, { createContext, PropsWithChildren, useContext, useEffect, useRef } from \"react\";\nimport { Is, Nullable } from \"sidekicker\";\nimport { useReactive } from \"../../hooks/use-reactive\";\nimport { useStableRef } from \"../../hooks/use-stable-ref\";\nimport { css } from \"../../lib/dom\";\nimport { keyboardKeys } from \"../../lib/keyboard-area\";\nimport { Label } from \"../../types\";\nimport { Polymorph } from \"../core/polymorph\";\nimport { Card, CardProps } from \"./card\";\n\nexport type TabsProps = Omit<CardProps<\"div\">, \"onChange\"> & {\n active: string;\n container?: string;\n className?: string;\n onChange?: (id: string) => void;\n};\n\nconst Context = createContext<string>(\"\");\n\nconst isElementDisabled = (element: HTMLElement): boolean => element.hasAttribute(\"disabled\") || element.getAttribute(\"aria-disabled\") === \"true\";\n\nconst getNElement = (elements: HTMLElement[], currentIndex: number, direction: \"backward\" | \"forward\"): HTMLElement | null => {\n const step = direction === \"forward\" ? 1 : -1;\n const startIndex = currentIndex + step;\n for (let i = startIndex; i >= 0 && i < elements.length; i += step) {\n const element = elements[i];\n if (!isElementDisabled(element)) return element;\n }\n return direction === \"backward\" ? getNElement(elements, elements.length - 1, \"backward\") : getNElement(elements, -1, \"forward\");\n};\n\nconst moveOn = (ul: HTMLUListElement, direction: \"backward\" | \"forward\") => {\n const items = Array.from(ul.querySelectorAll(\"li\"));\n const find = items.findIndex((x) => x.dataset.active === \"true\");\n if (find === -1) return null;\n const item = getNElement(items, find, direction);\n if (item === null) return null;\n item.querySelector(\"button\")?.focus({ preventScroll: false });\n return item.getAttribute(\"data-id\") || \"\";\n};\n\nconst moveToEdge = (ul: HTMLUListElement, edge: \"first\" | \"last\") => {\n const items = Array.from(ul.querySelectorAll(\"li\"));\n const ordered = edge === \"first\" ? items : [...items].reverse();\n for (const item of ordered) {\n if (!isElementDisabled(item)) {\n item.querySelector(\"button\")?.focus({ preventScroll: false });\n return item.getAttribute(\"data-id\") || \"\";\n }\n }\n return null;\n};\n\nconst actionKeys = {\n [keyboardKeys.ArrowLeft]: (_: unknown, ul: HTMLUListElement): Nullable<string> => moveOn(ul, \"backward\"),\n [keyboardKeys.ArrowRight]: (_: unknown, ul: HTMLUListElement): Nullable<string> => moveOn(ul, \"forward\"),\n};\n\nexport const Tabs = (props: PropsWithChildren<TabsProps>) => {\n const [active, setActive] = useReactive(props.active);\n const ref = useRef<HTMLUListElement | null>(null);\n const onChangeRef = useStableRef(props.onChange);\n\n useEffect(() => {\n const header = ref.current;\n if (header === null) return;\n let first = header.querySelector<HTMLElement>(`li[data-active=true]`);\n if (first === null) {\n first = header.querySelector<HTMLElement>(`li[data-id]`)!;\n const id = first.getAttribute(\"data-id\") || \"\";\n setActive(id);\n }\n }, [props.active, setActive]);\n\n useEffect(() => {\n if (onChangeRef.current) onChangeRef.current(active);\n }, [onChangeRef, active]);\n\n const items = React.Children.toArray(props.children as React.ReactElement<TabProps>) as Array<React.ReactElement<TabProps>>;\n\n const onClick = (e: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>) => {\n const anchor = e.currentTarget;\n setActive(anchor.dataset.id || \"\");\n };\n\n const onKeyDown = (e: React.KeyboardEvent<HTMLUListElement>) => {\n if (ref.current === null) return;\n const k = e.key;\n if (Is.keyof(actionKeys, k)) {\n const fn = actionKeys[k];\n const result = fn(e, ref.current);\n if (result === null) return;\n setActive(result);\n } else if (k === \"Home\") {\n e.preventDefault();\n const result = moveToEdge(ref.current, \"first\");\n if (result) setActive(result);\n } else if (k === \"End\") {\n e.preventDefault();\n const result = moveToEdge(ref.current, \"last\");\n if (result) setActive(result);\n }\n };\n\n return (\n <Context.Provider value={active}>\n <Card\n className={props.className}\n container={css(\"pt-0 max-w-full w-full min-w-0\", props.container)}\n header={\n <header className=\"relative mb-tabs-header-mb overflow-x-auto\">\n <div className=\"absolute bottom-0 h-tabs-divider-h w-full bg-card-border\" />\n <nav className=\"min-w-0\">\n <ul role=\"tablist\" onKeyDown={onKeyDown} ref={ref} className=\"flex w-0 min-w-full flex-1 justify-start overflow-x-auto\">\n {items.map((x: React.ReactElement<TabProps>) => {\n const inner = x.props;\n const current = active === inner.id;\n return (\n <li\n data-id={inner.id}\n data-active={current}\n key={`tab-header-${inner.id}`}\n className={css(\n \"relative w-fit border-b border-transparent transition-all\",\n current ? \"border-primary font-medium text-primary\" : \"\",\n inner.disabled ? \"aria-disabled:text-disabled\" : \"\"\n )}\n >\n <Polymorph\n role=\"tab\"\n as=\"button\"\n type=\"button\"\n data-id={inner.id}\n id={`${inner.id}-tab`}\n aria-selected={current}\n disabled={inner.disabled}\n tabIndex={current ? 0 : -1}\n aria-controls={`${inner.id}-panel`}\n onClick={inner.disabled ? undefined : onClick}\n className=\"block w-full whitespace-nowrap px-tabs-item-px py-tabs-item-py disabled:cursor-not-allowed\"\n >\n {inner.title as React.ReactNode}\n </Polymorph>\n </li>\n );\n })}\n </ul>\n </nav>\n </header>\n }\n >\n {props.children}\n </Card>\n </Context.Provider>\n );\n};\n\nconst useTabs = () => useContext(Context);\n\ntype CommonTabProps = { id: string; disabled?: boolean };\n\nexport type TabProps = CommonTabProps &\n (\n | { title: string; label?: undefined }\n | {\n label: string;\n title: Omit<Label, string>;\n }\n );\n\nexport const Tab = (props: PropsWithChildren<TabProps>) => {\n const active = useTabs();\n if (props.id !== active) return null;\n return (\n <div role=\"tabpanel\" tabIndex={0} id={`${props.id}-panel`} aria-labelledby={`${props.id}-tab`}>\n {props.children}\n </div>\n );\n};\n"],"mappings":";;;;;;;AAGA,I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