@g4rcez/components 5.0.0 → 5.0.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/dist/{MotionConfig-BLwtdAWy.js → MotionConfig-DKKYqBH2.js} +2 -2
- package/dist/{MotionConfig-BLwtdAWy.js.map → MotionConfig-DKKYqBH2.js.map} +1 -1
- package/dist/{autocomplete-DVKTP0Il.js → autocomplete-D3VOTihi.js} +2 -2
- package/dist/{autocomplete-DVKTP0Il.js.map → autocomplete-D3VOTihi.js.map} +1 -1
- package/dist/{calendar-_DZjphH8.js → calendar-PCCZDUIL.js} +4 -4
- package/dist/{calendar-_DZjphH8.js.map → calendar-PCCZDUIL.js.map} +1 -1
- package/dist/components/display/alert.js +1 -1
- package/dist/components/display/calendar.js +1 -1
- package/dist/components/display/list.js +2 -2
- package/dist/components/display/notifications.js +1 -1
- package/dist/components/floating/expand.js +1 -1
- package/dist/components/floating/modal.js +1 -1
- package/dist/components/form/autocomplete.js +1 -1
- package/dist/components/form/date-picker.js +1 -1
- package/dist/components/form/file-upload.js +1 -1
- package/dist/components/table/table.js +1 -1
- package/dist/{date-picker-9q_Ki5Vu.js → date-picker-BhKEFZew.js} +2 -2
- package/dist/{date-picker-9q_Ki5Vu.js.map → date-picker-BhKEFZew.js.map} +1 -1
- package/dist/{dist-Buc00Zls.js → dist-BrGpYRaj.js} +56 -55
- package/dist/{dist-Buc00Zls.js.map → dist-BrGpYRaj.js.map} +1 -1
- package/dist/{file-upload-COk6_Bs5.js → file-upload-DWbZfeG5.js} +15 -15
- package/dist/{file-upload-COk6_Bs5.js.map → file-upload-DWbZfeG5.js.map} +1 -1
- package/dist/index.js +646 -647
- package/dist/index.js.map +1 -1
- package/dist/{modal-Cn-OaKRp.js → modal-Bz-61ays.js} +3 -3
- package/dist/{modal-Cn-OaKRp.js.map → modal-Bz-61ays.js.map} +1 -1
- package/dist/{notifications-l_B9J4Gx.js → notifications-MT4XkLov.js} +270 -269
- package/dist/{notifications-l_B9J4Gx.js.map → notifications-MT4XkLov.js.map} +1 -1
- package/dist/{proxy-Drpz0Avo.js → proxy-BcJ_5Dwq.js} +465 -468
- package/dist/{proxy-Drpz0Avo.js.map → proxy-BcJ_5Dwq.js.map} +1 -1
- package/dist/{table-Dql6Yzag.js → table-CUFbAI2k.js} +3 -3
- package/dist/{table-Dql6Yzag.js.map → table-CUFbAI2k.js.map} +1 -1
- package/package.json +1 -1
- package/dist/src/components/core/button.d.ts +0 -77
- package/dist/src/components/core/button.d.ts.map +0 -1
- package/dist/src/components/core/button.jsx +0 -79
- package/dist/src/components/core/heading.d.ts +0 -3
- package/dist/src/components/core/heading.d.ts.map +0 -1
- package/dist/src/components/core/heading.jsx +0 -4
- package/dist/src/components/core/polymorph.d.ts +0 -10
- package/dist/src/components/core/polymorph.d.ts.map +0 -1
- package/dist/src/components/core/polymorph.jsx +0 -5
- package/dist/src/components/core/render-on-view.d.ts +0 -7
- package/dist/src/components/core/render-on-view.d.ts.map +0 -1
- package/dist/src/components/core/render-on-view.jsx +0 -31
- package/dist/src/components/core/resizable.d.ts +0 -3
- package/dist/src/components/core/resizable.d.ts.map +0 -1
- package/dist/src/components/core/resizable.jsx +0 -51
- package/dist/src/components/core/slot.d.ts +0 -16
- package/dist/src/components/core/slot.d.ts.map +0 -1
- package/dist/src/components/core/slot.jsx +0 -156
- package/dist/src/components/core/tag.d.ts +0 -35
- package/dist/src/components/core/tag.d.ts.map +0 -1
- package/dist/src/components/core/tag.jsx +0 -53
- package/dist/src/components/core/typography.d.ts +0 -25
- package/dist/src/components/core/typography.d.ts.map +0 -1
- package/dist/src/components/core/typography.jsx +0 -20
- package/dist/src/components/display/alert.d.ts +0 -28
- package/dist/src/components/display/alert.d.ts.map +0 -1
- package/dist/src/components/display/alert.jsx +0 -61
- package/dist/src/components/display/calendar.d.ts +0 -42
- package/dist/src/components/display/calendar.d.ts.map +0 -1
- package/dist/src/components/display/calendar.jsx +0 -318
- package/dist/src/components/display/card.d.ts +0 -29
- package/dist/src/components/display/card.d.ts.map +0 -1
- package/dist/src/components/display/card.jsx +0 -43
- package/dist/src/components/display/empty.d.ts +0 -8
- package/dist/src/components/display/empty.d.ts.map +0 -1
- package/dist/src/components/display/empty.jsx +0 -11
- package/dist/src/components/display/list.d.ts +0 -16
- package/dist/src/components/display/list.d.ts.map +0 -1
- package/dist/src/components/display/list.jsx +0 -85
- package/dist/src/components/display/notifications.d.ts +0 -27
- package/dist/src/components/display/notifications.d.ts.map +0 -1
- package/dist/src/components/display/notifications.jsx +0 -130
- package/dist/src/components/display/progress.d.ts +0 -16
- package/dist/src/components/display/progress.d.ts.map +0 -1
- package/dist/src/components/display/progress.jsx +0 -21
- package/dist/src/components/display/shortcut.d.ts +0 -4
- package/dist/src/components/display/shortcut.d.ts.map +0 -1
- package/dist/src/components/display/shortcut.jsx +0 -23
- package/dist/src/components/display/skeleton.d.ts +0 -12
- package/dist/src/components/display/skeleton.d.ts.map +0 -1
- package/dist/src/components/display/skeleton.jsx +0 -19
- package/dist/src/components/display/spinner.d.ts +0 -5
- package/dist/src/components/display/spinner.d.ts.map +0 -1
- package/dist/src/components/display/spinner.jsx +0 -11
- package/dist/src/components/display/stats.d.ts +0 -12
- package/dist/src/components/display/stats.d.ts.map +0 -1
- package/dist/src/components/display/stats.jsx +0 -16
- package/dist/src/components/display/step.d.ts +0 -24
- package/dist/src/components/display/step.d.ts.map +0 -1
- package/dist/src/components/display/step.jsx +0 -145
- package/dist/src/components/display/tabs.d.ts +0 -24
- package/dist/src/components/display/tabs.d.ts.map +0 -1
- package/dist/src/components/display/tabs.jsx +0 -125
- package/dist/src/components/display/timeline.d.ts +0 -10
- package/dist/src/components/display/timeline.d.ts.map +0 -1
- package/dist/src/components/display/timeline.jsx +0 -25
- package/dist/src/components/floating/command-palette.d.ts +0 -49
- package/dist/src/components/floating/command-palette.d.ts.map +0 -1
- package/dist/src/components/floating/command-palette.jsx +0 -223
- package/dist/src/components/floating/dropdown.d.ts +0 -15
- package/dist/src/components/floating/dropdown.d.ts.map +0 -1
- package/dist/src/components/floating/dropdown.jsx +0 -56
- package/dist/src/components/floating/expand.d.ts +0 -11
- package/dist/src/components/floating/expand.d.ts.map +0 -1
- package/dist/src/components/floating/expand.jsx +0 -44
- package/dist/src/components/floating/menu.d.ts +0 -52
- package/dist/src/components/floating/menu.d.ts.map +0 -1
- package/dist/src/components/floating/menu.jsx +0 -165
- package/dist/src/components/floating/modal.d.ts +0 -60
- package/dist/src/components/floating/modal.d.ts.map +0 -1
- package/dist/src/components/floating/modal.jsx +0 -336
- package/dist/src/components/floating/toolbar.d.ts +0 -6
- package/dist/src/components/floating/toolbar.d.ts.map +0 -1
- package/dist/src/components/floating/toolbar.jsx +0 -5
- package/dist/src/components/floating/tooltip.d.ts +0 -17
- package/dist/src/components/floating/tooltip.d.ts.map +0 -1
- package/dist/src/components/floating/tooltip.jsx +0 -67
- package/dist/src/components/floating/wizard.d.ts +0 -26
- package/dist/src/components/floating/wizard.d.ts.map +0 -1
- package/dist/src/components/floating/wizard.jsx +0 -165
- package/dist/src/components/form/autocomplete.d.ts +0 -16
- package/dist/src/components/form/autocomplete.d.ts.map +0 -1
- package/dist/src/components/form/autocomplete.jsx +0 -290
- package/dist/src/components/form/checkbox.d.ts +0 -12
- package/dist/src/components/form/checkbox.d.ts.map +0 -1
- package/dist/src/components/form/checkbox.jsx +0 -12
- package/dist/src/components/form/date-picker.d.ts +0 -10
- package/dist/src/components/form/date-picker.d.ts.map +0 -1
- package/dist/src/components/form/date-picker.jsx +0 -115
- package/dist/src/components/form/file-upload.d.ts +0 -15
- package/dist/src/components/form/file-upload.d.ts.map +0 -1
- package/dist/src/components/form/file-upload.jsx +0 -138
- package/dist/src/components/form/form.d.ts +0 -3
- package/dist/src/components/form/form.d.ts.map +0 -1
- package/dist/src/components/form/form.jsx +0 -10
- package/dist/src/components/form/formReset.d.ts +0 -2
- package/dist/src/components/form/formReset.d.ts.map +0 -1
- package/dist/src/components/form/formReset.jsx +0 -17
- package/dist/src/components/form/free-text.d.ts +0 -11
- package/dist/src/components/form/free-text.d.ts.map +0 -1
- package/dist/src/components/form/free-text.jsx +0 -41
- package/dist/src/components/form/input-field.d.ts +0 -34
- package/dist/src/components/form/input-field.d.ts.map +0 -1
- package/dist/src/components/form/input-field.jsx +0 -58
- package/dist/src/components/form/input.d.ts +0 -52
- package/dist/src/components/form/input.d.ts.map +0 -1
- package/dist/src/components/form/input.jsx +0 -36
- package/dist/src/components/form/multi-select.d.ts +0 -19
- package/dist/src/components/form/multi-select.d.ts.map +0 -1
- package/dist/src/components/form/multi-select.jsx +0 -344
- package/dist/src/components/form/radiobox.d.ts +0 -7
- package/dist/src/components/form/radiobox.d.ts.map +0 -1
- package/dist/src/components/form/radiobox.jsx +0 -6
- package/dist/src/components/form/select.d.ts +0 -13
- package/dist/src/components/form/select.d.ts.map +0 -1
- package/dist/src/components/form/select.jsx +0 -44
- package/dist/src/components/form/slider.d.ts +0 -7
- package/dist/src/components/form/slider.d.ts.map +0 -1
- package/dist/src/components/form/slider.jsx +0 -45
- package/dist/src/components/form/switch.d.ts +0 -9
- package/dist/src/components/form/switch.d.ts.map +0 -1
- package/dist/src/components/form/switch.jsx +0 -46
- package/dist/src/components/form/task-list.d.ts +0 -3
- package/dist/src/components/form/task-list.d.ts.map +0 -1
- package/dist/src/components/form/task-list.jsx +0 -26
- package/dist/src/components/form/textarea.d.ts +0 -5
- package/dist/src/components/form/textarea.d.ts.map +0 -1
- package/dist/src/components/form/textarea.jsx +0 -26
- package/dist/src/components/index.d.ts +0 -45
- package/dist/src/components/index.d.ts.map +0 -1
- package/dist/src/components/index.js +0 -44
- package/dist/src/components/page-calendar/calendar-header.d.ts +0 -16
- package/dist/src/components/page-calendar/calendar-header.d.ts.map +0 -1
- package/dist/src/components/page-calendar/calendar-header.jsx +0 -83
- package/dist/src/components/page-calendar/day-view.d.ts +0 -12
- package/dist/src/components/page-calendar/day-view.d.ts.map +0 -1
- package/dist/src/components/page-calendar/day-view.jsx +0 -89
- package/dist/src/components/page-calendar/event-pill.d.ts +0 -9
- package/dist/src/components/page-calendar/event-pill.d.ts.map +0 -1
- package/dist/src/components/page-calendar/event-pill.jsx +0 -25
- package/dist/src/components/page-calendar/index.d.ts +0 -4
- package/dist/src/components/page-calendar/index.d.ts.map +0 -1
- package/dist/src/components/page-calendar/index.js +0 -2
- package/dist/src/components/page-calendar/month-view.d.ts +0 -11
- package/dist/src/components/page-calendar/month-view.d.ts.map +0 -1
- package/dist/src/components/page-calendar/month-view.jsx +0 -46
- package/dist/src/components/page-calendar/page-calendar.d.ts +0 -18
- package/dist/src/components/page-calendar/page-calendar.d.ts.map +0 -1
- package/dist/src/components/page-calendar/page-calendar.jsx +0 -41
- package/dist/src/components/page-calendar/page-calendar.types.d.ts +0 -18
- package/dist/src/components/page-calendar/page-calendar.types.d.ts.map +0 -1
- package/dist/src/components/page-calendar/page-calendar.types.js +0 -1
- package/dist/src/components/page-calendar/page-calendar.utils.d.ts +0 -24
- package/dist/src/components/page-calendar/page-calendar.utils.d.ts.map +0 -1
- package/dist/src/components/page-calendar/page-calendar.utils.js +0 -93
- package/dist/src/components/page-calendar/week-view.d.ts +0 -11
- package/dist/src/components/page-calendar/week-view.d.ts.map +0 -1
- package/dist/src/components/page-calendar/week-view.jsx +0 -66
- package/dist/src/components/table/filter.d.ts +0 -42
- package/dist/src/components/table/filter.d.ts.map +0 -1
- package/dist/src/components/table/filter.jsx +0 -169
- package/dist/src/components/table/group.d.ts +0 -17
- package/dist/src/components/table/group.d.ts.map +0 -1
- package/dist/src/components/table/group.jsx +0 -75
- package/dist/src/components/table/index.d.ts +0 -19
- package/dist/src/components/table/index.d.ts.map +0 -1
- package/dist/src/components/table/index.jsx +0 -63
- package/dist/src/components/table/inner-table.d.ts +0 -29
- package/dist/src/components/table/inner-table.d.ts.map +0 -1
- package/dist/src/components/table/inner-table.jsx +0 -102
- package/dist/src/components/table/metadata.d.ts +0 -4
- package/dist/src/components/table/metadata.d.ts.map +0 -1
- package/dist/src/components/table/metadata.jsx +0 -36
- package/dist/src/components/table/pagination.d.ts +0 -5
- package/dist/src/components/table/pagination.d.ts.map +0 -1
- package/dist/src/components/table/pagination.jsx +0 -74
- package/dist/src/components/table/row.d.ts +0 -11
- package/dist/src/components/table/row.d.ts.map +0 -1
- package/dist/src/components/table/row.jsx +0 -49
- package/dist/src/components/table/sort.d.ts +0 -28
- package/dist/src/components/table/sort.d.ts.map +0 -1
- package/dist/src/components/table/sort.jsx +0 -109
- package/dist/src/components/table/table-lib.d.ts +0 -135
- package/dist/src/components/table/table-lib.d.ts.map +0 -1
- package/dist/src/components/table/table-lib.js +0 -83
- package/dist/src/components/table/table.context.d.ts +0 -10
- package/dist/src/components/table/table.context.d.ts.map +0 -1
- package/dist/src/components/table/table.context.jsx +0 -5
- package/dist/src/components/table/thead.d.ts +0 -9
- package/dist/src/components/table/thead.d.ts.map +0 -1
- package/dist/src/components/table/thead.jsx +0 -103
- package/dist/src/config/context.d.ts +0 -21
- package/dist/src/config/context.d.ts.map +0 -1
- package/dist/src/config/context.js +0 -12
- package/dist/src/config/default-translations.d.ts +0 -94
- package/dist/src/config/default-translations.d.ts.map +0 -1
- package/dist/src/config/default-translations.jsx +0 -87
- package/dist/src/config/default-tweaks.d.ts +0 -13
- package/dist/src/config/default-tweaks.d.ts.map +0 -1
- package/dist/src/config/default-tweaks.js +0 -4
- package/dist/src/constants.d.ts +0 -3
- package/dist/src/constants.d.ts.map +0 -1
- package/dist/src/constants.js +0 -2
- package/dist/src/hooks/use-click-outside.d.ts +0 -3
- package/dist/src/hooks/use-click-outside.d.ts.map +0 -1
- package/dist/src/hooks/use-click-outside.js +0 -17
- package/dist/src/hooks/use-color-parser.d.ts +0 -2
- package/dist/src/hooks/use-color-parser.d.ts.map +0 -1
- package/dist/src/hooks/use-color-parser.js +0 -9
- package/dist/src/hooks/use-components-provider.d.ts +0 -15
- package/dist/src/hooks/use-components-provider.d.ts.map +0 -1
- package/dist/src/hooks/use-components-provider.jsx +0 -22
- package/dist/src/hooks/use-debounce.d.ts +0 -5
- package/dist/src/hooks/use-debounce.d.ts.map +0 -1
- package/dist/src/hooks/use-debounce.js +0 -12
- package/dist/src/hooks/use-floating-ref.d.ts +0 -2
- package/dist/src/hooks/use-floating-ref.d.ts.map +0 -1
- package/dist/src/hooks/use-floating-ref.js +0 -6
- package/dist/src/hooks/use-form.d.ts +0 -394
- package/dist/src/hooks/use-form.d.ts.map +0 -1
- package/dist/src/hooks/use-form.js +0 -563
- package/dist/src/hooks/use-hover.d.ts +0 -3
- package/dist/src/hooks/use-hover.d.ts.map +0 -1
- package/dist/src/hooks/use-hover.js +0 -18
- package/dist/src/hooks/use-input-id.d.ts +0 -4
- package/dist/src/hooks/use-input-id.d.ts.map +0 -1
- package/dist/src/hooks/use-input-id.js +0 -5
- package/dist/src/hooks/use-is-coarse-device.d.ts +0 -2
- package/dist/src/hooks/use-is-coarse-device.d.ts.map +0 -1
- package/dist/src/hooks/use-is-coarse-device.js +0 -12
- package/dist/src/hooks/use-locale.d.ts +0 -3
- package/dist/src/hooks/use-locale.d.ts.map +0 -1
- package/dist/src/hooks/use-locale.js +0 -10
- package/dist/src/hooks/use-media-query.d.ts +0 -2
- package/dist/src/hooks/use-media-query.d.ts.map +0 -1
- package/dist/src/hooks/use-media-query.js +0 -25
- package/dist/src/hooks/use-on-event.d.ts +0 -4
- package/dist/src/hooks/use-on-event.d.ts.map +0 -1
- package/dist/src/hooks/use-on-event.js +0 -10
- package/dist/src/hooks/use-parent.d.ts +0 -3
- package/dist/src/hooks/use-parent.d.ts.map +0 -1
- package/dist/src/hooks/use-parent.js +0 -21
- package/dist/src/hooks/use-preferences.d.ts +0 -2
- package/dist/src/hooks/use-preferences.d.ts.map +0 -1
- package/dist/src/hooks/use-preferences.js +0 -23
- package/dist/src/hooks/use-previous.d.ts +0 -2
- package/dist/src/hooks/use-previous.d.ts.map +0 -1
- package/dist/src/hooks/use-previous.js +0 -9
- package/dist/src/hooks/use-reactive.d.ts +0 -2
- package/dist/src/hooks/use-reactive.d.ts.map +0 -1
- package/dist/src/hooks/use-reactive.js +0 -9
- package/dist/src/hooks/use-remove-scroll.d.ts +0 -4
- package/dist/src/hooks/use-remove-scroll.d.ts.map +0 -1
- package/dist/src/hooks/use-remove-scroll.js +0 -48
- package/dist/src/hooks/use-resize-observer.d.ts +0 -2
- package/dist/src/hooks/use-resize-observer.d.ts.map +0 -1
- package/dist/src/hooks/use-resize-observer.js +0 -17
- package/dist/src/hooks/use-stable-ref.d.ts +0 -2
- package/dist/src/hooks/use-stable-ref.d.ts.map +0 -1
- package/dist/src/hooks/use-stable-ref.js +0 -9
- package/dist/src/hooks/use-swipe.d.ts +0 -8
- package/dist/src/hooks/use-swipe.d.ts.map +0 -1
- package/dist/src/hooks/use-swipe.js +0 -17
- package/dist/src/hooks/use-translations.d.ts +0 -92
- package/dist/src/hooks/use-translations.d.ts.map +0 -1
- package/dist/src/hooks/use-translations.js +0 -9
- package/dist/src/hooks/use-tweaks.d.ts +0 -3
- package/dist/src/hooks/use-tweaks.d.ts.map +0 -1
- package/dist/src/hooks/use-tweaks.js +0 -9
- package/dist/src/hooks/use-window-size.d.ts +0 -5
- package/dist/src/hooks/use-window-size.d.ts.map +0 -1
- package/dist/src/hooks/use-window-size.js +0 -14
- package/dist/src/index.d.ts +0 -22
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -20
- package/dist/src/lib/combi-keys.d.ts +0 -15
- package/dist/src/lib/combi-keys.d.ts.map +0 -1
- package/dist/src/lib/combi-keys.js +0 -60
- package/dist/src/lib/dict.d.ts +0 -9
- package/dist/src/lib/dict.d.ts.map +0 -1
- package/dist/src/lib/dict.js +0 -28
- package/dist/src/lib/dom.d.ts +0 -20
- package/dist/src/lib/dom.d.ts.map +0 -1
- package/dist/src/lib/dom.js +0 -185
- package/dist/src/lib/fns.d.ts +0 -11
- package/dist/src/lib/fns.d.ts.map +0 -1
- package/dist/src/lib/fns.js +0 -46
- package/dist/src/lib/fzf.d.ts +0 -16
- package/dist/src/lib/fzf.d.ts.map +0 -1
- package/dist/src/lib/fzf.js +0 -115
- package/dist/src/lib/keyboard-area.d.ts +0 -16
- package/dist/src/lib/keyboard-area.d.ts.map +0 -1
- package/dist/src/lib/keyboard-area.js +0 -14
- package/dist/src/styles/common.d.ts +0 -8
- package/dist/src/styles/common.d.ts.map +0 -1
- package/dist/src/styles/common.js +0 -20
- package/dist/src/styles/components.d.ts +0 -3
- package/dist/src/styles/components.d.ts.map +0 -1
- package/dist/src/styles/components.js +0 -397
- package/dist/src/styles/dark.d.ts +0 -3
- package/dist/src/styles/dark.d.ts.map +0 -1
- package/dist/src/styles/dark.js +0 -217
- package/dist/src/styles/default-tokens.d.ts +0 -74
- package/dist/src/styles/default-tokens.d.ts.map +0 -1
- package/dist/src/styles/default-tokens.js +0 -41
- package/dist/src/styles/design-tokens.d.ts +0 -29
- package/dist/src/styles/design-tokens.d.ts.map +0 -1
- package/dist/src/styles/design-tokens.js +0 -73
- package/dist/src/styles/light.d.ts +0 -3
- package/dist/src/styles/light.d.ts.map +0 -1
- package/dist/src/styles/light.js +0 -217
- package/dist/src/styles/theme.d.ts +0 -3
- package/dist/src/styles/theme.d.ts.map +0 -1
- package/dist/src/styles/theme.js +0 -4
- package/dist/src/styles/theme.types.d.ts +0 -540
- package/dist/src/styles/theme.types.d.ts.map +0 -1
- package/dist/src/styles/theme.types.js +0 -1
- package/dist/src/types.d.ts +0 -26
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/types.js +0 -1
- package/dist/tsconfig.lib.tsbuildinfo +0 -1
- package/dist/with-selector-BAUQ-vKK.js +0 -187
- package/dist/with-selector-BAUQ-vKK.js.map +0 -1
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { autoUpdate, flip, FloatingFocusManager, FloatingList, FloatingNode, FloatingPortal, FloatingTree, offset, safePolygon, shift, useClick, useDismiss, useFloating, useFloatingNodeId, useFloatingParentNodeId, useFloatingTree, useHover, useInteractions, useListItem, useListNavigation, useRole, useTypeahead, } from "@floating-ui/react";
|
|
3
|
-
import { Slot } from "../core/slot";
|
|
4
|
-
import { CaretRightIcon } from "@phosphor-icons/react";
|
|
5
|
-
import React, { createContext, Fragment, useContext, useEffect, useRef, useState } from "react";
|
|
6
|
-
import { FLOATING_DELAY, TYPEAHEAD_RESET_DELAY } from "../../constants";
|
|
7
|
-
import { css, mergeRefs } from "../../lib/dom";
|
|
8
|
-
const menuItemClassName = (highlight = "") => css("w-full min-w-36 outline-none p-menu-item-p items-center flex justify-between text-left", "hover:bg-primary focus:bg-primary aria-expanded:opacity-80", "focus:text-primary-foreground hover:text-primary-foreground", "first-of-type:rounded-t-menu-radius last-of-type:rounded-b-menu-radius", "disabled:opacity-40 disabled:cursor-not-allowed", highlight);
|
|
9
|
-
const MenuContext = createContext({
|
|
10
|
-
isOpen: false,
|
|
11
|
-
activeIndex: null,
|
|
12
|
-
getItemProps: () => ({}),
|
|
13
|
-
setActiveIndex: () => { },
|
|
14
|
-
setHasFocusInside: () => { },
|
|
15
|
-
});
|
|
16
|
-
const MenuComponent = React.forwardRef(({ children, FloatingComponent = "div", hover = true, open, isParent = false, restoreFocus = false, floatingClassName = "", label, ...props }, forwardedRef) => {
|
|
17
|
-
const [isOpen, setIsOpen] = useState(open ?? false);
|
|
18
|
-
const [hasFocusInside, setHasFocusInside] = useState(false);
|
|
19
|
-
const [activeIndex, setActiveIndex] = useState(null);
|
|
20
|
-
const elementsRef = useRef([]);
|
|
21
|
-
const labelsRef = useRef([]);
|
|
22
|
-
const parent = useContext(MenuContext);
|
|
23
|
-
const parentId = useFloatingParentNodeId();
|
|
24
|
-
const tree = useFloatingTree();
|
|
25
|
-
const nodeId = useFloatingNodeId();
|
|
26
|
-
const item = useListItem();
|
|
27
|
-
const isNested = parentId !== null;
|
|
28
|
-
const { floatingStyles, refs, context } = useFloating({
|
|
29
|
-
nodeId,
|
|
30
|
-
open: isOpen,
|
|
31
|
-
transform: true,
|
|
32
|
-
strategy: "absolute",
|
|
33
|
-
onOpenChange: setIsOpen,
|
|
34
|
-
whileElementsMounted: autoUpdate,
|
|
35
|
-
placement: isNested ? "right" : "bottom-start",
|
|
36
|
-
middleware: [
|
|
37
|
-
offset({
|
|
38
|
-
mainAxis: isNested ? 0 : 4,
|
|
39
|
-
alignmentAxis: isNested ? -4 : 0,
|
|
40
|
-
}),
|
|
41
|
-
flip(),
|
|
42
|
-
shift(),
|
|
43
|
-
],
|
|
44
|
-
});
|
|
45
|
-
const role = useRole(context, { role: "menu" });
|
|
46
|
-
const dismiss = useDismiss(context, { bubbles: true });
|
|
47
|
-
const hoverModule = useHover(context, {
|
|
48
|
-
move: false,
|
|
49
|
-
enabled: hover,
|
|
50
|
-
delay: { open: FLOATING_DELAY },
|
|
51
|
-
handleClose: safePolygon({
|
|
52
|
-
blockPointerEvents: true,
|
|
53
|
-
requireIntent: false,
|
|
54
|
-
}),
|
|
55
|
-
});
|
|
56
|
-
const click = useClick(context, {
|
|
57
|
-
toggle: !isNested,
|
|
58
|
-
event: "mousedown",
|
|
59
|
-
ignoreMouse: isNested,
|
|
60
|
-
keyboardHandlers: true,
|
|
61
|
-
});
|
|
62
|
-
const listNavigation = useListNavigation(context, {
|
|
63
|
-
loop: true,
|
|
64
|
-
activeIndex,
|
|
65
|
-
nested: isNested,
|
|
66
|
-
listRef: elementsRef,
|
|
67
|
-
onNavigate: setActiveIndex,
|
|
68
|
-
});
|
|
69
|
-
const typeahead = useTypeahead(context, {
|
|
70
|
-
activeIndex,
|
|
71
|
-
listRef: labelsRef,
|
|
72
|
-
resetMs: TYPEAHEAD_RESET_DELAY,
|
|
73
|
-
onMatch: isOpen ? setActiveIndex : undefined,
|
|
74
|
-
});
|
|
75
|
-
const { getReferenceProps, getFloatingProps, getItemProps } = useInteractions([hoverModule, click, role, dismiss, listNavigation, typeahead]);
|
|
76
|
-
useEffect(() => {
|
|
77
|
-
if (!tree)
|
|
78
|
-
return;
|
|
79
|
-
const handleTreeClick = () => setIsOpen(false);
|
|
80
|
-
const onSubMenuOpen = (event) => {
|
|
81
|
-
if (event.nodeId !== nodeId && event.parentId === parentId)
|
|
82
|
-
setIsOpen(false);
|
|
83
|
-
};
|
|
84
|
-
tree.events.on("click", handleTreeClick);
|
|
85
|
-
tree.events.on("menuopen", onSubMenuOpen);
|
|
86
|
-
return () => {
|
|
87
|
-
tree.events.off("click", handleTreeClick);
|
|
88
|
-
tree.events.off("menuopen", onSubMenuOpen);
|
|
89
|
-
};
|
|
90
|
-
}, [tree, nodeId, parentId]);
|
|
91
|
-
useEffect(() => {
|
|
92
|
-
if (isOpen && tree)
|
|
93
|
-
tree.events.emit("menuopen", { parentId, nodeId });
|
|
94
|
-
}, [tree, isOpen, nodeId, parentId]);
|
|
95
|
-
const className = isParent ? props.className : css(menuItemClassName(props.className));
|
|
96
|
-
return (<FloatingNode id={nodeId}>
|
|
97
|
-
<Fragment>
|
|
98
|
-
{props.asChild ? (<Slot {...getReferenceProps(parent.getItemProps({
|
|
99
|
-
...props,
|
|
100
|
-
onFocus(event) {
|
|
101
|
-
props.onFocus?.(event);
|
|
102
|
-
setHasFocusInside(false);
|
|
103
|
-
parent.setHasFocusInside(true);
|
|
104
|
-
},
|
|
105
|
-
}))} className={className} data-open={isOpen ? "" : undefined} data-nested={isNested ? "" : undefined} role={isNested ? "menuitem" : undefined} data-focus-inside={hasFocusInside ? "" : undefined} ref={mergeRefs(refs.setReference, item.ref, forwardedRef)} tabIndex={!isNested ? undefined : parent.activeIndex === item.index ? 0 : -1}>
|
|
106
|
-
{label}
|
|
107
|
-
</Slot>) : (<button type="button" className={className} data-open={isOpen ? "" : undefined} data-nested={isNested ? "" : undefined} role={isNested ? "menuitem" : undefined} data-focus-inside={hasFocusInside ? "" : undefined} ref={mergeRefs(refs.setReference, item.ref, forwardedRef)} tabIndex={!isNested ? undefined : parent.activeIndex === item.index ? 0 : -1} {...getReferenceProps(parent.getItemProps({
|
|
108
|
-
...props,
|
|
109
|
-
onFocus(event) {
|
|
110
|
-
props.onFocus?.(event);
|
|
111
|
-
setHasFocusInside(false);
|
|
112
|
-
parent.setHasFocusInside(true);
|
|
113
|
-
},
|
|
114
|
-
}))}>
|
|
115
|
-
{label}
|
|
116
|
-
{isNested && (<span style={{ marginLeft: 10, fontSize: 10 }}>
|
|
117
|
-
<span className="sr-only">Next menu</span>
|
|
118
|
-
<CaretRightIcon size={14}/>
|
|
119
|
-
</span>)}
|
|
120
|
-
</button>)}
|
|
121
|
-
</Fragment>
|
|
122
|
-
<MenuContext.Provider value={{
|
|
123
|
-
activeIndex,
|
|
124
|
-
setActiveIndex,
|
|
125
|
-
getItemProps,
|
|
126
|
-
setHasFocusInside,
|
|
127
|
-
isOpen,
|
|
128
|
-
}}>
|
|
129
|
-
<FloatingList elementsRef={elementsRef} labelsRef={labelsRef}>
|
|
130
|
-
{isOpen && (<FloatingPortal>
|
|
131
|
-
<FloatingFocusManager context={context} modal={false} initialFocus={isNested ? -1 : 0} returnFocus={isParent ? restoreFocus : !isNested}>
|
|
132
|
-
<FloatingComponent {...getFloatingProps()} ref={refs.setFloating} style={{ ...props.style, ...floatingStyles }} className={css("isolate z-tooltip flex max-h-menu-max-h flex-col items-start overflow-y-auto rounded-menu-radius border border-floating-border bg-floating-background text-left shadow-shadow-floating outline-none", floatingClassName)}>
|
|
133
|
-
{children}
|
|
134
|
-
</FloatingComponent>
|
|
135
|
-
</FloatingFocusManager>
|
|
136
|
-
</FloatingPortal>)}
|
|
137
|
-
</FloatingList>
|
|
138
|
-
</MenuContext.Provider>
|
|
139
|
-
</FloatingNode>);
|
|
140
|
-
});
|
|
141
|
-
export const MenuItem = React.forwardRef(({ title, Right, disabled, children, ...props }, forwardedRef) => {
|
|
142
|
-
const menu = useContext(MenuContext);
|
|
143
|
-
const item = useListItem({ label: disabled ? null : title });
|
|
144
|
-
const tree = useFloatingTree();
|
|
145
|
-
const isActive = item.index === menu.activeIndex;
|
|
146
|
-
return (<button {...props} title={title} type="button" role="menuitem" disabled={disabled} data-active={isActive} data-open={menu.isOpen} tabIndex={isActive ? 0 : -1} ref={mergeRefs(item.ref, forwardedRef)} className={menuItemClassName(`${props.className ?? ""} ${isActive ? "bg-primary text-primary-foreground" : ""}`)} {...menu.getItemProps({
|
|
147
|
-
onClick(event) {
|
|
148
|
-
props.onClick?.(event);
|
|
149
|
-
tree?.events.emit("click");
|
|
150
|
-
},
|
|
151
|
-
onFocus(event) {
|
|
152
|
-
props.onFocus?.(event);
|
|
153
|
-
menu.setHasFocusInside(true);
|
|
154
|
-
},
|
|
155
|
-
})}>
|
|
156
|
-
{children}
|
|
157
|
-
{Right ? <Right size={16}/> : null}
|
|
158
|
-
</button>);
|
|
159
|
-
});
|
|
160
|
-
export const Menu = React.forwardRef((props, ref) => {
|
|
161
|
-
const parentId = useFloatingParentNodeId();
|
|
162
|
-
return parentId === null ? (<FloatingTree>
|
|
163
|
-
<MenuComponent {...props} isParent ref={ref}/>
|
|
164
|
-
</FloatingTree>) : (<MenuComponent {...props} isParent={false} ref={ref}/>);
|
|
165
|
-
});
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { type ElementProps, type FloatingContext } from "@floating-ui/react";
|
|
2
|
-
import { HTMLMotionProps } from "motion/react";
|
|
3
|
-
import React from "react";
|
|
4
|
-
import { Label, Override } from "../../types";
|
|
5
|
-
import { ButtonProps } from "../core/button";
|
|
6
|
-
export declare const useConfirm: () => (options: ConfirmOptions) => Promise<boolean>;
|
|
7
|
-
export type ModalType = "dialog" | "drawer" | "sheet";
|
|
8
|
-
export type DrawerPosition = "left" | "right";
|
|
9
|
-
export type ModalProps = Override<HTMLMotionProps<"div">, ({
|
|
10
|
-
title: Label;
|
|
11
|
-
ariaTitle?: string;
|
|
12
|
-
} | {
|
|
13
|
-
ariaTitle: string;
|
|
14
|
-
title?: Label;
|
|
15
|
-
}) & {
|
|
16
|
-
open: boolean;
|
|
17
|
-
onChange: (nextState: boolean) => void;
|
|
18
|
-
} & Partial<{
|
|
19
|
-
footer: Label;
|
|
20
|
-
type: ModalType;
|
|
21
|
-
animated: boolean;
|
|
22
|
-
asChild: boolean;
|
|
23
|
-
layoutId: string;
|
|
24
|
-
resizer: boolean;
|
|
25
|
-
className: string;
|
|
26
|
-
closable: boolean;
|
|
27
|
-
forceType: boolean;
|
|
28
|
-
bodyClassName: string;
|
|
29
|
-
overlayClassName: string;
|
|
30
|
-
position: DrawerPosition;
|
|
31
|
-
overlayClickClose: boolean;
|
|
32
|
-
closeOnFocusOut: boolean;
|
|
33
|
-
role: "dialog";
|
|
34
|
-
interactions: ElementProps[];
|
|
35
|
-
trigger: Label;
|
|
36
|
-
}>>;
|
|
37
|
-
export type ModalRef = {
|
|
38
|
-
context: FloatingContext;
|
|
39
|
-
floating: HTMLElement | null;
|
|
40
|
-
};
|
|
41
|
-
type ModalComponent = React.FC<ModalProps> & {
|
|
42
|
-
confirm: <T>(options: ConfirmOptions) => Promise<T>;
|
|
43
|
-
};
|
|
44
|
-
export declare const Modal: ModalComponent;
|
|
45
|
-
type ButtonConfirmationAction = {
|
|
46
|
-
value?: unknown;
|
|
47
|
-
text?: Label;
|
|
48
|
-
theme?: ButtonProps["theme"];
|
|
49
|
-
};
|
|
50
|
-
export type ConfirmOptions = {
|
|
51
|
-
title?: Label;
|
|
52
|
-
description?: Label;
|
|
53
|
-
cancel?: ButtonConfirmationAction;
|
|
54
|
-
confirm?: ButtonConfirmationAction;
|
|
55
|
-
};
|
|
56
|
-
export declare const ModalConfirmProvider: ({ children }: {
|
|
57
|
-
children: React.ReactNode;
|
|
58
|
-
}) => React.JSX.Element;
|
|
59
|
-
export {};
|
|
60
|
-
//# sourceMappingURL=modal.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../../../src/components/floating/modal.tsx"],"names":[],"mappings":"AACA,OAAO,EASH,KAAK,YAAY,EACjB,KAAK,eAAe,EACvB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAEH,eAAe,EAQlB,MAAM,cAAc,CAAC;AAEtB,OAAO,KAWN,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,KAAK,EAAO,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGnD,OAAO,EAAU,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAMrD,eAAO,MAAM,UAAU,kBAF8B,cAAc,KAAK,OAAO,CAAC,OAAO,CAEvB,CAAC;AAEjE,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEtD,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,OAAO,CAAC;AA2E9C,MAAM,MAAM,UAAU,GAAG,QAAQ,CAC7B,eAAe,CAAC,KAAK,CAAC,EACtB,CAAC;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC,GAAG;IAC5E,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C,GAAG,OAAO,CAAC;IACJ,MAAM,EAAE,KAAK,CAAC;IACd,IAAI,EAAE,SAAS,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,cAAc,CAAC;IACzB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,eAAe,EAAE,OAAO,CAAC;IACzB,IAAI,EAAE,QAAQ,CAAC;IACf,YAAY,EAAE,YAAY,EAAE,CAAC;IAC7B,OAAO,EAAE,KAAK,CAAC;CAClB,CAAC,CACT,CAAC;AAkFF,MAAM,MAAM,QAAQ,GAAG;IACnB,OAAO,EAAE,eAAe,CAAC;IACzB,QAAQ,EAAE,WAAW,GAAG,IAAI,CAAC;CAChC,CAAC;AAIF,KAAK,cAAc,GAAG,KAAK,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG;IACzC,OAAO,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;CACvD,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,cA4QU,CAAC;AAE/B,KAAK,wBAAwB,GAAG;IAC5B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,KAAK,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IACzB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,WAAW,CAAC,EAAE,KAAK,CAAC;IACpB,MAAM,CAAC,EAAE,wBAAwB,CAAC;IAClC,OAAO,CAAC,EAAE,wBAAwB,CAAC;CACtC,CAAC;AAaF,eAAO,MAAM,oBAAoB,GAAI,cAAc;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,sBA2D/E,CAAC"}
|
|
@@ -1,336 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { FloatingFocusManager, FloatingOverlay, FloatingPortal, useClick, useDismiss, useFloating, useInteractions, useRole, } from "@floating-ui/react";
|
|
3
|
-
import { cva } from "class-variance-authority";
|
|
4
|
-
import { XIcon } from "@phosphor-icons/react";
|
|
5
|
-
import { AnimatePresence, motion, MotionConfig, useMotionValue, animate, } from "motion/react";
|
|
6
|
-
import { Slot } from "../core/slot";
|
|
7
|
-
import React, { forwardRef, Fragment, useEffect, useId, useImperativeHandle, useRef, useState, useCallback, } from "react";
|
|
8
|
-
import { useMediaQuery } from "../../hooks/use-media-query";
|
|
9
|
-
import { css, mergeRefs } from "../../lib/dom";
|
|
10
|
-
import { useFloatingRef } from "../../hooks/use-floating-ref";
|
|
11
|
-
import { useTranslations } from "../../hooks/use-translations";
|
|
12
|
-
import { Button } from "../core/button";
|
|
13
|
-
const ConfirmContext = React.createContext(async () => false);
|
|
14
|
-
export const useConfirm = () => React.useContext(ConfirmContext);
|
|
15
|
-
const animationDuration = "500ms";
|
|
16
|
-
const drawerLeft = {
|
|
17
|
-
exit: { x: ["0%", "-30%"], opacity: 0, animationDuration },
|
|
18
|
-
enter: { x: ["-30%", "0%"], opacity: 1, animationDuration },
|
|
19
|
-
initial: { x: ["-30%", "0%"], opacity: 0.8, animationDuration },
|
|
20
|
-
};
|
|
21
|
-
const drawerRight = {
|
|
22
|
-
enter: { x: "0%", opacity: 1, animationDuration },
|
|
23
|
-
exit: { x: ["0%", "30%"], opacity: 0, animationDuration },
|
|
24
|
-
initial: { x: ["30%", "0%"], opacity: 0.8, animationDuration },
|
|
25
|
-
};
|
|
26
|
-
const animations = {
|
|
27
|
-
drawer: (type) => (type === "left" ? drawerLeft : drawerRight),
|
|
28
|
-
sheet: {
|
|
29
|
-
enter: {
|
|
30
|
-
opacity: 1,
|
|
31
|
-
y: "0%",
|
|
32
|
-
animationDuration,
|
|
33
|
-
transformOrigin: "bottom",
|
|
34
|
-
},
|
|
35
|
-
exit: {
|
|
36
|
-
opacity: 0.4,
|
|
37
|
-
y: "10%",
|
|
38
|
-
animationDuration,
|
|
39
|
-
transformOrigin: "bottom",
|
|
40
|
-
},
|
|
41
|
-
initial: {
|
|
42
|
-
opacity: 0.7,
|
|
43
|
-
y: "10%",
|
|
44
|
-
animationDuration,
|
|
45
|
-
transformOrigin: "bottom",
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
dialog: {
|
|
49
|
-
exit: { opacity: 0, scale: 0.95, animationDuration },
|
|
50
|
-
enter: { opacity: 1, scale: [1.05, 1], animationDuration },
|
|
51
|
-
initial: {
|
|
52
|
-
opacity: 0.5,
|
|
53
|
-
scale: 0.95,
|
|
54
|
-
animationDuration,
|
|
55
|
-
transition: { duration: 0.5, ease: "easeInOut" },
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
const variants = cva("z-floating flex min-w-xs appearance-none flex-col flex-nowrap gap-modal-gap border border-floating-border bg-floating-background outline-0 ring-0", {
|
|
60
|
-
variants: {
|
|
61
|
-
type: {
|
|
62
|
-
drawer: "absolute h-screen max-h-screen min-h-0 w-fit max-w-modal-dialog-max-w-mobile",
|
|
63
|
-
dialog: "container relative h-min max-h-modal-sheet-max-h-lvh rounded-modal-radius py-modal-padding-y",
|
|
64
|
-
sheet: "absolute bottom-0 h-screen max-h-modal-sheet-max-h-svh max-h-modal-sheet-max-h-vh w-screen rounded-t-modal-radius pb-modal-sheet-pb pt-modal-sheet-pt",
|
|
65
|
-
},
|
|
66
|
-
position: {
|
|
67
|
-
none: "",
|
|
68
|
-
right: "absolute right-0 top-0 rounded-l-modal-radius py-modal-padding-y",
|
|
69
|
-
left: "absolute left-0 top-0 rounded-r-modal-radius py-modal-padding-y",
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
defaultVariants: { position: "right", type: "dialog" },
|
|
73
|
-
});
|
|
74
|
-
const dragConstraints = { top: 0, left: 0, right: 0, bottom: 0 };
|
|
75
|
-
const calculateClose = (n) => n * 0.6;
|
|
76
|
-
const Draggable = (props) => {
|
|
77
|
-
const onDrag = (e, info) => {
|
|
78
|
-
if (props.parent.current) {
|
|
79
|
-
e.stopPropagation();
|
|
80
|
-
e.stopImmediatePropagation();
|
|
81
|
-
if (props.sheet) {
|
|
82
|
-
const div = props.parent.current;
|
|
83
|
-
const rect = div.getBoundingClientRect();
|
|
84
|
-
const v = props.value.get() || rect.height;
|
|
85
|
-
const result = Math.abs(v - info.delta.y);
|
|
86
|
-
const max = window.outerHeight;
|
|
87
|
-
const screenHeightToClose = calculateClose(max);
|
|
88
|
-
if (result >= screenHeightToClose)
|
|
89
|
-
return props.value.set(result);
|
|
90
|
-
if (document.activeElement instanceof HTMLElement) {
|
|
91
|
-
document.activeElement?.blur();
|
|
92
|
-
}
|
|
93
|
-
props.onChange(false);
|
|
94
|
-
return setTimeout(() => props.value.set(undefined), 350);
|
|
95
|
-
}
|
|
96
|
-
const div = props.parent.current;
|
|
97
|
-
const v = props.value.get() || div.getBoundingClientRect().width;
|
|
98
|
-
const delta = props.position === "right" ? -info.delta.x : info.delta.x;
|
|
99
|
-
const value = Math.abs(v + delta);
|
|
100
|
-
return props.value.set(value);
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
return (<motion.button draggable dragListener dragMomentum tabIndex={-1} type="button" animate={false} dragElastic={0} dragPropagation initial={false} onDrag={onDrag} dragSnapToOrigin dragDirectionLock aria-hidden="true" drag={props.sheet ? "y" : "x"} dragConstraints={dragConstraints} whileDrag={{ cursor: "grabbing" }} className={css("absolute isolate z-calendar rounded-modal-resizer-radius", props.sheet ? "cursor-row-resize" : "cursor-col-resize bg-floating-border", props.sheet
|
|
104
|
-
? "top-1 flex h-modal-sheet-handle-h w-full justify-center py-modal-sheet-handle-py"
|
|
105
|
-
: props.position === "left"
|
|
106
|
-
? "right-5 top-1/2 h-modal-drawer-resizer-h w-modal-drawer-resizer-w"
|
|
107
|
-
: "left-2 top-1/2 h-modal-drawer-resizer-h w-modal-drawer-resizer-w")}>
|
|
108
|
-
{props.sheet ? <div className="rounded-modal-sheet-pill-radius h-modal-sheet-pill-h w-modal-sheet-pill-w bg-floating-border"/> : null}
|
|
109
|
-
</motion.button>);
|
|
110
|
-
};
|
|
111
|
-
const positions = { drawer: "right", sheet: "none", dialog: "none" };
|
|
112
|
-
const fetchPosition = (isDesktop, forceType, propsType, propsPosition) => {
|
|
113
|
-
const type = propsType || "dialog";
|
|
114
|
-
if (isDesktop)
|
|
115
|
-
return propsType === "drawer" ? (propsPosition ?? positions.drawer) : positions[type];
|
|
116
|
-
return forceType ? positions[type] : positions.sheet;
|
|
117
|
-
};
|
|
118
|
-
const noop = [];
|
|
119
|
-
export const Modal = forwardRef(({ open, title, footer, asChild, trigger, children, onChange, ariaTitle, className, bodyClassName, resizer = true, animated = true, closable = true, forceType = false, layoutId = undefined, overlayClassName = "", type: _type = "dialog", position: propsPosition, overlayClickClose = false, closeOnFocusOut = false, interactions: outInteractions = noop, ...props }, externalRef) => {
|
|
120
|
-
const t = useTranslations();
|
|
121
|
-
const root = useFloatingRef();
|
|
122
|
-
const innerContent = useRef(null);
|
|
123
|
-
const removeScrollRef = useRef(null);
|
|
124
|
-
const headingId = useId();
|
|
125
|
-
const descriptionId = useId();
|
|
126
|
-
const isDesktop = useMediaQuery("(min-width: 64rem)");
|
|
127
|
-
const position = fetchPosition(isDesktop, forceType, _type, propsPosition);
|
|
128
|
-
const func = isDesktop ? animations[_type] : forceType ? animations[_type] : animations.sheet;
|
|
129
|
-
const animation = typeof func === "function" ? func(position) : func;
|
|
130
|
-
const type = isDesktop ? _type : forceType ? _type : "sheet";
|
|
131
|
-
const useResizer = type !== "dialog";
|
|
132
|
-
const floating = useFloating({
|
|
133
|
-
open,
|
|
134
|
-
onOpenChange: onChange,
|
|
135
|
-
strategy: "fixed",
|
|
136
|
-
});
|
|
137
|
-
const click = useClick(floating.context, {});
|
|
138
|
-
const role = useRole(floating.context, { role: "dialog" });
|
|
139
|
-
const dismiss = useDismiss(floating.context, {
|
|
140
|
-
bubbles: true,
|
|
141
|
-
escapeKey: true,
|
|
142
|
-
outsidePress: (event) => {
|
|
143
|
-
const target = event.target;
|
|
144
|
-
return overlayClickClose && !!target?.isConnected;
|
|
145
|
-
},
|
|
146
|
-
});
|
|
147
|
-
const interactions = useInteractions([click, dismiss, role].concat(outInteractions));
|
|
148
|
-
const floatingSize = useMotionValue(undefined);
|
|
149
|
-
const sheetY = useMotionValue(undefined);
|
|
150
|
-
const isDragging = useRef(false);
|
|
151
|
-
const dragStart = useRef(0);
|
|
152
|
-
useEffect(() => {
|
|
153
|
-
floatingSize.set(undefined);
|
|
154
|
-
sheetY.set(undefined);
|
|
155
|
-
}, [type, floatingSize, sheetY]);
|
|
156
|
-
const onClose = () => onChange(false);
|
|
157
|
-
useImperativeHandle(externalRef, () => ({ context: floating.context, floating: removeScrollRef.current }), [
|
|
158
|
-
floating.context,
|
|
159
|
-
removeScrollRef,
|
|
160
|
-
]);
|
|
161
|
-
const onDragHeader = (_, info) => {
|
|
162
|
-
const div = floating.refs.floating.current;
|
|
163
|
-
const rect = div.getBoundingClientRect();
|
|
164
|
-
const v = floatingSize.get() || rect.height;
|
|
165
|
-
const result = Math.abs(v - info.delta.y);
|
|
166
|
-
const max = window.outerHeight;
|
|
167
|
-
const screenHeightToClose = calculateClose(max);
|
|
168
|
-
if (result >= screenHeightToClose)
|
|
169
|
-
return floatingSize.set(result);
|
|
170
|
-
if (document.activeElement instanceof HTMLElement) {
|
|
171
|
-
document.activeElement?.blur();
|
|
172
|
-
}
|
|
173
|
-
onChange?.(false);
|
|
174
|
-
return setTimeout(() => floatingSize.set(undefined), 350);
|
|
175
|
-
};
|
|
176
|
-
const draggableMotionProps = type === "sheet"
|
|
177
|
-
? {
|
|
178
|
-
drag: "y",
|
|
179
|
-
animate: false,
|
|
180
|
-
dragElastic: 0,
|
|
181
|
-
initial: false,
|
|
182
|
-
dragConstraints,
|
|
183
|
-
draggable: true,
|
|
184
|
-
dragListener: true,
|
|
185
|
-
dragMomentum: true,
|
|
186
|
-
onDrag: onDragHeader,
|
|
187
|
-
dragPropagation: true,
|
|
188
|
-
dragSnapToOrigin: true,
|
|
189
|
-
dragDirectionLock: true,
|
|
190
|
-
whileDrag: { cursor: "grabbing" },
|
|
191
|
-
}
|
|
192
|
-
: { animate: animated, initial: false };
|
|
193
|
-
const scrollInitial = useMotionValue(undefined);
|
|
194
|
-
const scroll = useMotionValue(undefined);
|
|
195
|
-
const Component = asChild ? Slot : motion.button;
|
|
196
|
-
return (<Fragment>
|
|
197
|
-
{trigger ? (<Component ref={floating.refs.setReference} {...interactions.getReferenceProps()} layoutId={layoutId} type="button">
|
|
198
|
-
{trigger}
|
|
199
|
-
</Component>) : null}
|
|
200
|
-
<MotionConfig reducedMotion={animated ? "user" : "always"}>
|
|
201
|
-
<FloatingPortal preserveTabOrder root={root}>
|
|
202
|
-
<AnimatePresence mode="wait" propagate>
|
|
203
|
-
{open ? (<FloatingOverlay lockScroll className={css("inset-0 isolate z-overlay flex h-modal-overlay-h !overflow-clip bg-floating-overlay/80", type === "drawer" ? "" : "items-start justify-center pt-modal-overlay-pt lg:p-modal-overlay-p", overlayClassName)}>
|
|
204
|
-
<FloatingFocusManager guards modal closeOnFocusOut={closeOnFocusOut} context={floating.context}>
|
|
205
|
-
<AnimatePresence propagate>
|
|
206
|
-
<motion.div {...props} {...(title
|
|
207
|
-
? {
|
|
208
|
-
"aria-labelledby": headingId,
|
|
209
|
-
"aria-describedby": descriptionId,
|
|
210
|
-
}
|
|
211
|
-
: { "aria-label": ariaTitle })} {...interactions.getFloatingProps({
|
|
212
|
-
"aria-modal": open,
|
|
213
|
-
ref: mergeRefs(floating.refs.setFloating, removeScrollRef),
|
|
214
|
-
className: css(variants({ position, type }), className, "isolate overscroll-contain"),
|
|
215
|
-
})} exit="exit" layout={true} animate="enter" initial="initial" layoutId={layoutId} variants={animation} data-component="modal" style={type === "drawer" ? { width: floatingSize } : { height: floatingSize, y: sheetY }}>
|
|
216
|
-
{useResizer && resizer ? (<Draggable onChange={onChange} value={floatingSize} sheet={type === "sheet"} position={position} parent={floating.refs.floating}/>) : null}
|
|
217
|
-
{title ? (<motion.header {...draggableMotionProps} className="relative isolate w-full">
|
|
218
|
-
{title ? (<h2 id={headingId} className="block select-text border-b border-floating-border px-modal-padding-x pb-modal-title-pb text-modal-title-text font-medium leading-relaxed">
|
|
219
|
-
{title}
|
|
220
|
-
</h2>) : null}
|
|
221
|
-
</motion.header>) : null}
|
|
222
|
-
<motion.section ref={innerContent} id={title ? descriptionId : undefined} data-component="modal-body" className={css("flex-1 select-text overflow-y-auto px-modal-padding-x py-modal-body-py", bodyClassName)} onTouchEnd={async () => {
|
|
223
|
-
scroll.set(undefined);
|
|
224
|
-
scrollInitial.set(undefined);
|
|
225
|
-
if (isDragging.current) {
|
|
226
|
-
const currentY = sheetY.get() || 0;
|
|
227
|
-
const threshold = window.innerHeight * 0.2;
|
|
228
|
-
const sheetYNumeric = sheetY;
|
|
229
|
-
if (currentY > threshold) {
|
|
230
|
-
await animate(sheetYNumeric, window.innerHeight, { duration: 0.2, ease: "easeIn" })
|
|
231
|
-
.finished;
|
|
232
|
-
onChange(false);
|
|
233
|
-
}
|
|
234
|
-
else {
|
|
235
|
-
animate(sheetYNumeric, 0, {
|
|
236
|
-
type: "spring",
|
|
237
|
-
bounce: 0,
|
|
238
|
-
duration: 0.3,
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
isDragging.current = false;
|
|
242
|
-
}
|
|
243
|
-
}} onTouchStart={(e) => {
|
|
244
|
-
const touch = e.changedTouches[0];
|
|
245
|
-
scrollInitial.set(touch.pageY);
|
|
246
|
-
scroll.set(touch.pageY);
|
|
247
|
-
isDragging.current = false;
|
|
248
|
-
}} onTouchMove={(e) => {
|
|
249
|
-
const touch = e.changedTouches[0];
|
|
250
|
-
const y = touch.pageY;
|
|
251
|
-
const prevY = scroll.get() || y;
|
|
252
|
-
const scrollTop = innerContent.current?.scrollTop || 0;
|
|
253
|
-
if (!isDragging.current && scrollTop <= 0 && y > prevY && type === "sheet") {
|
|
254
|
-
isDragging.current = true;
|
|
255
|
-
dragStart.current = y;
|
|
256
|
-
}
|
|
257
|
-
if (isDragging.current) {
|
|
258
|
-
const delta = y - dragStart.current;
|
|
259
|
-
if (delta < 0) {
|
|
260
|
-
sheetY.set(delta * 0.2);
|
|
261
|
-
}
|
|
262
|
-
else {
|
|
263
|
-
sheetY.set(delta);
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
scroll.set(y);
|
|
267
|
-
}}>
|
|
268
|
-
{children}
|
|
269
|
-
</motion.section>
|
|
270
|
-
{footer ? (<footer className="w-full select-text border-t border-floating-border px-modal-padding-x pt-modal-footer-pt">
|
|
271
|
-
{footer}
|
|
272
|
-
</footer>) : null}
|
|
273
|
-
{closable ? (<div className="absolute right-modal-close-right top-modal-close-top z-floating">
|
|
274
|
-
<button type="button" onClick={onClose} aria-label={t.closeButton} className="p-modal-close-p opacity-70 transition-colors hover:text-danger hover:opacity-100 focus:text-danger">
|
|
275
|
-
<XIcon aria-hidden="true"/>
|
|
276
|
-
</button>
|
|
277
|
-
</div>) : null}
|
|
278
|
-
</motion.div>
|
|
279
|
-
</AnimatePresence>
|
|
280
|
-
</FloatingFocusManager>
|
|
281
|
-
</FloatingOverlay>) : null}
|
|
282
|
-
</AnimatePresence>
|
|
283
|
-
</FloatingPortal>
|
|
284
|
-
</MotionConfig>
|
|
285
|
-
</Fragment>);
|
|
286
|
-
});
|
|
287
|
-
let confirmGlobal = async (_) => {
|
|
288
|
-
if (typeof window !== "undefined") {
|
|
289
|
-
console.warn("ConfirmationProvider is not mounted");
|
|
290
|
-
}
|
|
291
|
-
return false;
|
|
292
|
-
};
|
|
293
|
-
Modal.confirm = (options) => confirmGlobal(options);
|
|
294
|
-
export const ModalConfirmProvider = ({ children }) => {
|
|
295
|
-
const [open, setOpen] = useState(false);
|
|
296
|
-
const [options, setOptions] = useState({});
|
|
297
|
-
const [resolve, setResolve] = useState(() => { });
|
|
298
|
-
const confirmRef = useRef(null);
|
|
299
|
-
useEffect(() => {
|
|
300
|
-
if (open)
|
|
301
|
-
confirmRef.current?.focus();
|
|
302
|
-
}, [open]);
|
|
303
|
-
const confirmAction = useCallback((opts) => {
|
|
304
|
-
setOptions(opts);
|
|
305
|
-
setOpen(true);
|
|
306
|
-
return new Promise((res) => {
|
|
307
|
-
setResolve(() => res);
|
|
308
|
-
});
|
|
309
|
-
}, []);
|
|
310
|
-
useEffect(() => {
|
|
311
|
-
confirmGlobal = confirmAction;
|
|
312
|
-
}, [confirmAction]);
|
|
313
|
-
const onConfirm = () => {
|
|
314
|
-
setOpen(false);
|
|
315
|
-
const value = options.confirm?.value ?? true;
|
|
316
|
-
resolve(value ?? true);
|
|
317
|
-
};
|
|
318
|
-
const onCancel = () => {
|
|
319
|
-
setOpen(false);
|
|
320
|
-
const value = options.cancel?.value ?? false;
|
|
321
|
-
resolve(value ?? false);
|
|
322
|
-
};
|
|
323
|
-
return (<ConfirmContext.Provider value={confirmAction}>
|
|
324
|
-
{children}
|
|
325
|
-
<Modal open={open} type="dialog" closable={false} onChange={setOpen} overlayClickClose={false} title={options.title || "Confirmation"} className="container max-w-dialog lg:max-w-96" footer={<div className="flex justify-end gap-modal-footer-gap">
|
|
326
|
-
<Button theme={options.cancel?.theme || "ghost-muted"} onClick={onCancel}>
|
|
327
|
-
{options.cancel?.text || "Cancel"}
|
|
328
|
-
</Button>
|
|
329
|
-
<Button ref={confirmRef} theme={options.confirm?.theme || "primary"} onClick={onConfirm}>
|
|
330
|
-
{options.confirm?.text || "Confirm"}
|
|
331
|
-
</Button>
|
|
332
|
-
</div>}>
|
|
333
|
-
<div className="py-modal-confirm-py text-foreground">{options.description}</div>
|
|
334
|
-
</Modal>
|
|
335
|
-
</ConfirmContext.Provider>);
|
|
336
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toolbar.d.ts","sourceRoot":"","sources":["../../../../src/components/floating/toolbar.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE1C,MAAM,MAAM,YAAY,GAAG;IACvB,IAAI,CAAC,EAAE,WAAW,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,OAAO,GAAI,OAAO,iBAAiB,CAAC,YAAY,CAAC,gCAI7D,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { motion } from "motion/react";
|
|
3
|
-
export const Toolbar = (props) => (<motion.div className="sticky bottom-toolbar-bottom flex items-center justify-center rounded-toolbar-radius border border-card-border bg-background p-toolbar-p">
|
|
4
|
-
{props.children}
|
|
5
|
-
</motion.div>);
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { type Placement } from "@floating-ui/react";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { PolymorphicProps } from "../../components/core/polymorph";
|
|
4
|
-
import { ComponentLike, Label } from "../../types";
|
|
5
|
-
export type TooltipProps<T extends React.ElementType = "span"> = PolymorphicProps<{
|
|
6
|
-
title: Label;
|
|
7
|
-
open?: boolean;
|
|
8
|
-
focus?: boolean;
|
|
9
|
-
hover?: boolean;
|
|
10
|
-
enabled?: boolean;
|
|
11
|
-
popover?: boolean;
|
|
12
|
-
placement?: Placement;
|
|
13
|
-
followCursor?: boolean;
|
|
14
|
-
onChange?: (b: boolean) => void;
|
|
15
|
-
}, T>;
|
|
16
|
-
export declare const Tooltip: <T extends ComponentLike = "span">(_: TooltipProps<T>) => React.ReactElement;
|
|
17
|
-
//# sourceMappingURL=tooltip.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../../src/components/floating/tooltip.tsx"],"names":[],"mappings":"AACA,OAAO,EAQH,KAAK,SAAS,EAWjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAA4D,MAAM,OAAO,CAAC;AACjF,OAAO,EAAa,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAI9E,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEnD,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,MAAM,IAAI,gBAAgB,CAC7E;IACI,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;CACnC,EACD,CAAC,CACJ,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,CAAC,CAAC,SAAS,aAAa,GAAG,MAAM,EAAE,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,YA4FM,CAAC"}
|