@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,344 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { autoPlacement, autoUpdate, FloatingFocusManager, FloatingOverlay, FloatingPortal, offset, size, useDismiss, useFloating, useInteractions, useListNavigation, useRole, useTransitionStyles, } from "@floating-ui/react";
|
|
3
|
-
import { CaretDownIcon, XIcon } from "@phosphor-icons/react";
|
|
4
|
-
import { AnimatePresence, motion } from "motion/react";
|
|
5
|
-
import React, { forwardRef, Fragment, useEffect, useMemo, useRef, useState } from "react";
|
|
6
|
-
import { flushSync } from "react-dom";
|
|
7
|
-
import { Virtuoso } from "react-virtuoso";
|
|
8
|
-
import { useRemoveScroll } from "../../hooks/use-remove-scroll";
|
|
9
|
-
import { useTranslations } from "../../hooks/use-translations";
|
|
10
|
-
import { Dict } from "../../lib/dict";
|
|
11
|
-
import { css, getRemainingSize, initializeInputDataset } from "../../lib/dom";
|
|
12
|
-
import { noop } from "../../lib/fns";
|
|
13
|
-
import { fzf } from "../../lib/fzf";
|
|
14
|
-
import { Tag } from "../core/tag";
|
|
15
|
-
import { Checkbox } from "./checkbox";
|
|
16
|
-
import { InputField } from "./input-field";
|
|
17
|
-
const MIN_SIZE = 40;
|
|
18
|
-
const Frag = (props) => <Fragment>{props.children}</Fragment>;
|
|
19
|
-
const transitionStyles = {
|
|
20
|
-
duration: 200,
|
|
21
|
-
initial: { transform: "scaleY(0)", opacity: 0.2 },
|
|
22
|
-
open: { transform: "scaleY(1)", opacity: 1 },
|
|
23
|
-
close: { transform: "scaleY(0)", opacity: 0 },
|
|
24
|
-
};
|
|
25
|
-
const EMPTY_NODES = [];
|
|
26
|
-
const EMPTY_VALUES = [];
|
|
27
|
-
const List = forwardRef(function VirtualItem({ item: _item, context: _context, ...props }, ref) {
|
|
28
|
-
return <motion.li {...props} ref={ref} className="last:rounded-t-dropdown-radius"/>;
|
|
29
|
-
});
|
|
30
|
-
const Item = forwardRef(function VirtualList({ context: _context, ...props }, ref) {
|
|
31
|
-
return (<motion.div {...props} ref={ref} className="w-full rounded-b-dropdown-radius border-b border-tooltip-border last:border-transparent">
|
|
32
|
-
<AnimatePresence>{props.children}</AnimatePresence>
|
|
33
|
-
</motion.div>);
|
|
34
|
-
});
|
|
35
|
-
const components = { List, Item };
|
|
36
|
-
const OverflowControl = (props) => {
|
|
37
|
-
const translate = useTranslations();
|
|
38
|
-
const ref = useRef(null);
|
|
39
|
-
const countable = React.Children.count(props.children);
|
|
40
|
-
const [normalView, setNormalView] = useState(false);
|
|
41
|
-
useEffect(() => {
|
|
42
|
-
if (ref.current === null)
|
|
43
|
-
return;
|
|
44
|
-
const parent = ref.current.parentElement.getBoundingClientRect();
|
|
45
|
-
const items = Array.from(ref.current.querySelectorAll("[data-component='tag']"));
|
|
46
|
-
const child = items.reduce((acc, el) => acc + el.getBoundingClientRect().width, 0);
|
|
47
|
-
const hasOnlyCounter = ref.current.querySelectorAll("[data-multicounter]").length;
|
|
48
|
-
if (hasOnlyCounter && countable <= 3)
|
|
49
|
-
return setNormalView(false);
|
|
50
|
-
if (child > parent.width)
|
|
51
|
-
return setNormalView(true);
|
|
52
|
-
}, [countable]);
|
|
53
|
-
return (<span ref={ref} className="flex flex-nowrap gap-x-2">
|
|
54
|
-
{!normalView ? (props.children) : (<Tag size="small" data-multicounter="true">
|
|
55
|
-
{countable} {translate.multiSelectSelectedLabel}
|
|
56
|
-
</Tag>)}
|
|
57
|
-
</span>);
|
|
58
|
-
};
|
|
59
|
-
export const MultiSelect = forwardRef(({ left, error, right, options, container, rightLabel, interactive, emptyMessage, optionalText, selectedLabel, labelClassName, feedback = null, hideLeft = false, required = false, dynamicOption = false, onChangeOptions, ...props }, externalRef) => {
|
|
60
|
-
const scroller = useRef(null);
|
|
61
|
-
const map = useMemo(() => new Dict(options.map((x) => [x.value, x])), [options]);
|
|
62
|
-
const fieldset = useRef(null);
|
|
63
|
-
const virtuoso = useRef(null);
|
|
64
|
-
const searchInputRef = useRef(null);
|
|
65
|
-
const defaults = props.value ?? props.defaultValue ?? EMPTY_VALUES;
|
|
66
|
-
const translation = useTranslations();
|
|
67
|
-
const [open, setOpen] = useState(false);
|
|
68
|
-
const [shadow, setShadow] = useState("");
|
|
69
|
-
const [value, setValue] = useState(() => {
|
|
70
|
-
const d = new Dict();
|
|
71
|
-
defaults.forEach((x) => {
|
|
72
|
-
const result = map.get(x);
|
|
73
|
-
return result ? d.set(x, result) : undefined;
|
|
74
|
-
});
|
|
75
|
-
return d;
|
|
76
|
-
});
|
|
77
|
-
const [_label, setLabel] = useState(() => {
|
|
78
|
-
const d = new Set(defaults);
|
|
79
|
-
return options.reduce((acc, x) => (d.has(x.value) ? [...acc, x.label ?? x.value] : acc), []) ?? defaults;
|
|
80
|
-
});
|
|
81
|
-
const [index, setIndex] = useState(null);
|
|
82
|
-
const listRef = useRef(EMPTY_NODES);
|
|
83
|
-
const [, tick] = useState(0);
|
|
84
|
-
const [h, setH] = useState(() => Math.min(320, MIN_SIZE * options.length));
|
|
85
|
-
const removeScrollRef = useRemoveScroll(open, "block-only");
|
|
86
|
-
const innerOptions = useMemo(() => (dynamicOption && shadow !== "" ? [{ value: shadow, label: shadow, "data-dynamic": "true" }, ...options] : options), [dynamicOption, shadow, options]);
|
|
87
|
-
const list = useMemo(() => shadow.length === 0
|
|
88
|
-
? innerOptions
|
|
89
|
-
: fzf(innerOptions, "value", [
|
|
90
|
-
{ key: "value", value: shadow },
|
|
91
|
-
{ key: "label", value: shadow },
|
|
92
|
-
]), [innerOptions, shadow]);
|
|
93
|
-
const displayList = useMemo(() => list.filter((x) => x.hidden !== true), [list]);
|
|
94
|
-
const values = useMemo(() => Array.from(value.keys()), [value]);
|
|
95
|
-
const isEmpty = displayList.length === 0;
|
|
96
|
-
const openDropdown = () => flushSync(() => setOpen(true));
|
|
97
|
-
const setClosed = () => {
|
|
98
|
-
setOpen(false);
|
|
99
|
-
setH(0);
|
|
100
|
-
};
|
|
101
|
-
const { x, y, strategy, refs, context, placement } = useFloating({
|
|
102
|
-
open,
|
|
103
|
-
transform: true,
|
|
104
|
-
placement: "bottom-start",
|
|
105
|
-
strategy: "absolute",
|
|
106
|
-
onOpenChange: setOpen,
|
|
107
|
-
whileElementsMounted: autoUpdate,
|
|
108
|
-
middleware: [
|
|
109
|
-
offset(4),
|
|
110
|
-
autoPlacement({
|
|
111
|
-
allowedPlacements: ["top-start", "bottom-start"],
|
|
112
|
-
alignment: "start",
|
|
113
|
-
}),
|
|
114
|
-
size({
|
|
115
|
-
padding: 10,
|
|
116
|
-
elementContext: "reference",
|
|
117
|
-
apply(args) {
|
|
118
|
-
const DEFAULT_SIZE = getRemainingSize(refs.reference.current, window.innerHeight);
|
|
119
|
-
const mw = `${fieldset.current?.getBoundingClientRect().width || DEFAULT_SIZE}px`;
|
|
120
|
-
Object.assign(args.elements.floating.style, {
|
|
121
|
-
width: mw,
|
|
122
|
-
maxWidth: mw,
|
|
123
|
-
});
|
|
124
|
-
},
|
|
125
|
-
}),
|
|
126
|
-
],
|
|
127
|
-
});
|
|
128
|
-
const isTopPlacement = placement === "top" || placement === "top-start";
|
|
129
|
-
const transitions = useTransitionStyles(context, transitionStyles);
|
|
130
|
-
const { getReferenceProps, getFloatingProps, getItemProps } = useInteractions([
|
|
131
|
-
useRole(context, { role: "listbox" }),
|
|
132
|
-
useDismiss(context),
|
|
133
|
-
useListNavigation(context, {
|
|
134
|
-
cols: 0,
|
|
135
|
-
listRef,
|
|
136
|
-
loop: true,
|
|
137
|
-
virtual: true,
|
|
138
|
-
allowEscape: true,
|
|
139
|
-
activeIndex: index,
|
|
140
|
-
selectedIndex: index,
|
|
141
|
-
focusItemOnOpen: "auto",
|
|
142
|
-
openOnArrowKeyDown: true,
|
|
143
|
-
scrollItemIntoView: true,
|
|
144
|
-
onNavigate: (n) => setIndex((prev) => n ?? prev),
|
|
145
|
-
}),
|
|
146
|
-
]);
|
|
147
|
-
useEffect(() => {
|
|
148
|
-
if (props.value) {
|
|
149
|
-
setValue(new Dict(props.value.map((x) => [x, map.get(x)])));
|
|
150
|
-
}
|
|
151
|
-
}, [props.value, map]);
|
|
152
|
-
useEffect(() => {
|
|
153
|
-
const input = refs.reference.current;
|
|
154
|
-
if (!input)
|
|
155
|
-
return;
|
|
156
|
-
return initializeInputDataset(input);
|
|
157
|
-
}, [refs.reference]);
|
|
158
|
-
useEffect(() => {
|
|
159
|
-
if (!open)
|
|
160
|
-
return;
|
|
161
|
-
const id = requestAnimationFrame(() => tick((n) => n + 1));
|
|
162
|
-
return () => cancelAnimationFrame(id);
|
|
163
|
-
}, [open]);
|
|
164
|
-
useEffect(() => {
|
|
165
|
-
if (!open) {
|
|
166
|
-
setH(0);
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
const id = setTimeout(() => setH(Math.min(320, displayList.length * MIN_SIZE)), 100);
|
|
170
|
-
return () => clearTimeout(id);
|
|
171
|
-
}, [open, displayList.length]);
|
|
172
|
-
const onSelect = (opt, i) => {
|
|
173
|
-
const clone = value.clone((c) => {
|
|
174
|
-
if (c.has(opt.value))
|
|
175
|
-
return c.remove(opt.value);
|
|
176
|
-
return c.set(opt.value, opt);
|
|
177
|
-
});
|
|
178
|
-
setValue(clone);
|
|
179
|
-
const input = refs.reference.current;
|
|
180
|
-
if (!input)
|
|
181
|
-
return;
|
|
182
|
-
const opts = clone.map((x) => x.value);
|
|
183
|
-
input?.setAttribute("data-value", JSON.stringify(opts));
|
|
184
|
-
if (onChangeOptions)
|
|
185
|
-
onChangeOptions(opts);
|
|
186
|
-
setLabel((prev) => prev.concat(opt.label ?? ""));
|
|
187
|
-
setShadow("");
|
|
188
|
-
setIndex(i);
|
|
189
|
-
};
|
|
190
|
-
const onChange = (event) => {
|
|
191
|
-
const v = event.target.value;
|
|
192
|
-
setShadow(v);
|
|
193
|
-
if (!open && v === "")
|
|
194
|
-
return setOpen(true);
|
|
195
|
-
event.target.name = props.name || "";
|
|
196
|
-
return v ? setOpen(true) : undefined;
|
|
197
|
-
};
|
|
198
|
-
const onCaretDownClick = () => {
|
|
199
|
-
openDropdown();
|
|
200
|
-
setShadow("");
|
|
201
|
-
refs.reference.current?.focus();
|
|
202
|
-
};
|
|
203
|
-
const onFocus = () => {
|
|
204
|
-
openDropdown();
|
|
205
|
-
setShadow("");
|
|
206
|
-
};
|
|
207
|
-
const onClose = () => {
|
|
208
|
-
refs.reference.current?.setAttribute("data-value", "[]");
|
|
209
|
-
setShadow("");
|
|
210
|
-
setValue(new Dict());
|
|
211
|
-
onChangeOptions?.([]);
|
|
212
|
-
setClosed();
|
|
213
|
-
};
|
|
214
|
-
const id = props.id || props.name;
|
|
215
|
-
const tags = value.map((x, i) => (<Tag size="small" key={`MultiSelect-${x.value}-x`} icon={<button type="button" aria-label={`Remove ${x.label ?? x.value}`} className="text-current hover:text-danger focus:text-danger" onClick={(e) => {
|
|
216
|
-
e.preventDefault();
|
|
217
|
-
e.stopPropagation();
|
|
218
|
-
onSelect(x, i);
|
|
219
|
-
}}>
|
|
220
|
-
<XIcon size={14} aria-hidden="true"/>
|
|
221
|
-
</button>}>
|
|
222
|
-
{x.label ?? x.value}
|
|
223
|
-
</Tag>));
|
|
224
|
-
return (<InputField {...props} left={left} error={error} ref={fieldset} form={props.form} name={props.name} feedback={feedback} hideLeft={hideLeft} required={required} title={props.title} container={container} rightLabel={rightLabel} interactive={interactive} id={props.name || props.id} optionalText={optionalText} componentName="autocomplete" labelClassName={labelClassName} placeholder={props.placeholder} right={<span className="flex items-center gap-0.5">
|
|
225
|
-
{right}
|
|
226
|
-
<button type="button" className="transition-colors link:text-primary" onClick={onCaretDownClick}>
|
|
227
|
-
<CaretDownIcon size={20}/>
|
|
228
|
-
<span className="sr-only">{translation.inputCaretDown}</span>
|
|
229
|
-
</button>
|
|
230
|
-
{value ? (<button type="button" onClick={onClose} aria-label={translation.inputCloseValue} className="transition-colors link:text-danger">
|
|
231
|
-
<svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
232
|
-
<path d="M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z" fill="currentColor" fillRule="evenodd" clipRule="evenodd"/>
|
|
233
|
-
</svg>
|
|
234
|
-
</button>) : null}
|
|
235
|
-
</span>}>
|
|
236
|
-
<ul {...getReferenceProps({
|
|
237
|
-
...props,
|
|
238
|
-
tabIndex: 0,
|
|
239
|
-
onFocus,
|
|
240
|
-
id: `${id}-shadow`,
|
|
241
|
-
name: `${id}-shadow`,
|
|
242
|
-
ref: refs.setReference,
|
|
243
|
-
})} data-name={id} data-target={id} data-shadow="true" data-error={!!error} data-value={values.join(",")} className={css("input placeholder-input-mask group h-input-height w-full text-input-text", "rounded-input-radius bg-transparent px-input-padding-x py-input-padding-y text-foreground", "outline-none transition-colors focus:ring-2 focus:ring-inset focus:ring-primary", "group-error:text-danger group-error:placeholder-input-mask-error", "group-focus-within:border-primary group-hover:border-primary", "flex flex-row items-center gap-input-gap whitespace-nowrap text-left", "max-w-full overflow-x-auto truncate overflow-ellipsis", props.className)}>
|
|
244
|
-
{values.length > 0 ? null : <li className="text-input-placeholder">{props.placeholder}</li>}
|
|
245
|
-
<OverflowControl label={selectedLabel}>{tags}</OverflowControl>
|
|
246
|
-
</ul>
|
|
247
|
-
<input id={id} name={id} type="hidden" data-origin={id} ref={externalRef} required={required} defaultValue={props.value || values || undefined}/>
|
|
248
|
-
<FloatingPortal preserveTabOrder>
|
|
249
|
-
{open ? (<FloatingOverlay lockScroll className="z-floating">
|
|
250
|
-
<FloatingFocusManager modal guards returnFocus={false} context={context} initialFocus={searchInputRef} visuallyHiddenDismiss>
|
|
251
|
-
<div {...getFloatingProps({
|
|
252
|
-
ref: refs.setFloating,
|
|
253
|
-
style: {
|
|
254
|
-
...transitions.styles,
|
|
255
|
-
left: x,
|
|
256
|
-
top: y ?? 0,
|
|
257
|
-
position: strategy,
|
|
258
|
-
},
|
|
259
|
-
})} data-floating="true" className={css("relative shadow-floating overflow-clip isolate z-floating m-0 max-h-dropdown-max-h list-none overscroll-contain rounded-dropdown-radius border border-floating-border bg-floating-background p-0 text-foreground ease-in-out", isTopPlacement ? "origin-[bottom_center]" : "origin-[top_center]")}>
|
|
260
|
-
<input ref={searchInputRef} value={shadow} onChange={onChange} title={props.title} placeholder={translation.multiSelectInnerPlaceholder} className="input placeholder-input-mask group mb-1 h-input-height w-full flex-1 rounded-none border-b border-input-border bg-transparent px-input-padding-x py-input-padding-y outline-none transition-colors focus:border-primary" onKeyDown={(event) => {
|
|
261
|
-
if (event.key === "ArrowDown") {
|
|
262
|
-
let next = index + 1;
|
|
263
|
-
if (next > displayList.length - 1)
|
|
264
|
-
next = 0;
|
|
265
|
-
virtuoso.current?.scrollIntoView({ index: next });
|
|
266
|
-
return setIndex(next);
|
|
267
|
-
}
|
|
268
|
-
if (event.key === "ArrowUp") {
|
|
269
|
-
let next = index - 1;
|
|
270
|
-
if (next < 0)
|
|
271
|
-
next = displayList.length - 1;
|
|
272
|
-
virtuoso.current?.scrollIntoView({ index: next });
|
|
273
|
-
return setIndex(next);
|
|
274
|
-
}
|
|
275
|
-
if (event.key === "Escape") {
|
|
276
|
-
event.currentTarget.blur();
|
|
277
|
-
return setClosed();
|
|
278
|
-
}
|
|
279
|
-
if (event.key === "Enter") {
|
|
280
|
-
if (index !== null && displayList[index]) {
|
|
281
|
-
event.preventDefault();
|
|
282
|
-
return onSelect(displayList[index], index);
|
|
283
|
-
}
|
|
284
|
-
if (displayList.length === 1) {
|
|
285
|
-
event.preventDefault();
|
|
286
|
-
return onSelect(displayList[0], 0);
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
}}/>
|
|
290
|
-
{isEmpty ? (<li className="w-full border-b border-tooltip-border last:border-transparent">
|
|
291
|
-
<span className="flex w-full justify-between p-menu-item-p text-left text-disabled">
|
|
292
|
-
{emptyMessage || translation.autocompleteEmpty}
|
|
293
|
-
</span>
|
|
294
|
-
</li>) : null}
|
|
295
|
-
{isEmpty ? null : (<motion.div initial={false} animate={{ height: isEmpty ? "auto" : h }} className="max-h-72 w-full overscroll-contain" onAnimationComplete={() => {
|
|
296
|
-
if (!open) {
|
|
297
|
-
setH(0);
|
|
298
|
-
return;
|
|
299
|
-
}
|
|
300
|
-
const li = refs.floating.current?.querySelector("li");
|
|
301
|
-
const sum = (li?.getBoundingClientRect().height ?? MIN_SIZE) * displayList.length;
|
|
302
|
-
flushSync(() => setH(Math.min(320, sum + 2)));
|
|
303
|
-
}}>
|
|
304
|
-
<Virtuoso overscan={40} ref={virtuoso} hidden={isEmpty} data={displayList} style={{ height: h }} defaultItemHeight={MIN_SIZE} components={components} totalListHeightChanged={(totalHeight) => setH(Math.min(320, totalHeight))} scrollerRef={(e) => {
|
|
305
|
-
scroller.current = e;
|
|
306
|
-
removeScrollRef.current = e;
|
|
307
|
-
}} className="max-h-72 border-floating-border bg-floating-background p-0 text-foreground" itemContent={(i, option) => {
|
|
308
|
-
const Label = option.Render ?? Frag;
|
|
309
|
-
const active = value.has(option.value) || value.has(option.label ?? "");
|
|
310
|
-
const selected = index === i;
|
|
311
|
-
const children = option.label ?? option.value;
|
|
312
|
-
return (<button data-value={option.value} {...getItemProps({
|
|
313
|
-
ref: (node) => {
|
|
314
|
-
listRef.current[i] = node;
|
|
315
|
-
},
|
|
316
|
-
role: "option",
|
|
317
|
-
type: "button",
|
|
318
|
-
"aria-checked": active,
|
|
319
|
-
"aria-current": active,
|
|
320
|
-
"aria-selected": active,
|
|
321
|
-
"aria-disabled": option.disabled,
|
|
322
|
-
onClick: () => onSelect(option, i),
|
|
323
|
-
})} className={`flex w-full max-w-full cursor-pointer items-center justify-start p-menu-item-p text-left hover:bg-floating-hover focus:bg-floating-hover ${active || selected ? "bg-floating-hover text-floating-foreground" : ""}`}>
|
|
324
|
-
<Checkbox onChange={noop} checked={active} aria-checked={active} onClick={(e) => {
|
|
325
|
-
e.stopPropagation();
|
|
326
|
-
onSelect(option, i);
|
|
327
|
-
}}/>
|
|
328
|
-
<Label {...option} label={option.label} value={option.value}>
|
|
329
|
-
{children}
|
|
330
|
-
</Label>
|
|
331
|
-
</button>);
|
|
332
|
-
}}/>
|
|
333
|
-
</motion.div>)}
|
|
334
|
-
<div className="gap-menu-item-gap sticky bottom-0 flex w-full flex-nowrap items-center overflow-x-auto rounded-b-dropdown-radius bg-floating-background p-menu-item-p">
|
|
335
|
-
{value.size === 0 ? (<Tag theme="muted" size="small">
|
|
336
|
-
{translation.autocompleteEmpty}
|
|
337
|
-
</Tag>) : (tags)}
|
|
338
|
-
</div>
|
|
339
|
-
</div>
|
|
340
|
-
</FloatingFocusManager>
|
|
341
|
-
</FloatingOverlay>) : null}
|
|
342
|
-
</FloatingPortal>
|
|
343
|
-
</InputField>);
|
|
344
|
-
});
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Override } from "../../types";
|
|
3
|
-
export type RadioboxProps = Override<React.PropsWithChildren<React.ComponentProps<"input">>, {
|
|
4
|
-
size?: "medium" | "large";
|
|
5
|
-
}>;
|
|
6
|
-
export declare const Radiobox: ({ children, className, size: _size, ...props }: RadioboxProps) => React.JSX.Element;
|
|
7
|
-
//# sourceMappingURL=radiobox.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"radiobox.d.ts","sourceRoot":"","sources":["../../../../src/components/form/radiobox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,MAAM,MAAM,aAAa,GAAG,QAAQ,CAChC,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,EACtD;IACI,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;CAC7B,CACJ,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,gDAAqD,aAAa,sBAiB1F,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { css } from "../../lib/dom";
|
|
3
|
-
export const Radiobox = ({ children, className = "", size: _size, ...props }) => (<label data-component="radiobox" data-disabled={props.disabled} aria-disabled={props.disabled} className={css("group flex items-center gap-radiobox-gap font-normal data-[disabled=true]:cursor-not-allowed")}>
|
|
4
|
-
<input {...props} type="radio" className={css("app form-radio inline-block size-radiobox-size appearance-none rounded-full border-card-border bg-origin-border text-primary focus:ring-primary disabled:opacity-70 group-aria-disabled:cursor-not-allowed", className)}/>
|
|
5
|
-
{children}
|
|
6
|
-
</label>);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Override } from "../../types";
|
|
3
|
-
import { InputFieldProps } from "./input-field";
|
|
4
|
-
export type OptionProps = Override<React.ComponentProps<"option">, {
|
|
5
|
-
value: string;
|
|
6
|
-
"data-dynamic"?: string;
|
|
7
|
-
} & Partial<Record<`data-${string}`, string>>>;
|
|
8
|
-
export type SelectProps = Override<InputFieldProps<"select">, {
|
|
9
|
-
options: OptionProps[];
|
|
10
|
-
selectContainer?: string;
|
|
11
|
-
}>;
|
|
12
|
-
export declare const Select: React.ForwardRefExoticComponent<Omit<SelectProps, "ref"> & React.RefAttributes<HTMLSelectElement>>;
|
|
13
|
-
//# sourceMappingURL=select.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../../src/components/form/select.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA6D,MAAM,OAAO,CAAC;AAGlF,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAc,eAAe,EAAE,MAAM,eAAe,CAAC;AAE5D,MAAM,MAAM,WAAW,GAAG,QAAQ,CAC9B,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,EAC9B;IACI,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,MAAM,EAAE,EAAE,MAAM,CAAC,CAAC,CAChD,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,QAAQ,CAC9B,eAAe,CAAC,QAAQ,CAAC,EACzB;IACI,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B,CACJ,CAAC;AAEF,eAAO,MAAM,MAAM,oGA4GlB,CAAC"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { CaretDownIcon } from "@phosphor-icons/react";
|
|
3
|
-
import React, { forwardRef, useEffect, useImperativeHandle, useRef } from "react";
|
|
4
|
-
import { useTranslations } from "../../hooks/use-translations";
|
|
5
|
-
import { css, initializeInputDataset, mergeRefs } from "../../lib/dom";
|
|
6
|
-
import { InputField } from "./input-field";
|
|
7
|
-
export const Select = forwardRef(({ required = true, options, info, selectContainer: _selectContainer = "", feedback = null, labelClassName, interactive, rightLabel, hiddenLabel, loading, optionalText, container, hideLeft = false, right, left, error, ...props }, ref) => {
|
|
8
|
-
const translation = useTranslations();
|
|
9
|
-
const inputRef = useRef(null);
|
|
10
|
-
const id = props.id ?? props.name;
|
|
11
|
-
useImperativeHandle(ref, () => inputRef.current);
|
|
12
|
-
useEffect(() => {
|
|
13
|
-
if (inputRef.current === null)
|
|
14
|
-
return;
|
|
15
|
-
const controller = new AbortController();
|
|
16
|
-
const input = inputRef.current;
|
|
17
|
-
const focus = initializeInputDataset(inputRef.current);
|
|
18
|
-
input.addEventListener("change", () => input.setAttribute("data-selected", "true"), {
|
|
19
|
-
once: true,
|
|
20
|
-
signal: controller.signal,
|
|
21
|
-
});
|
|
22
|
-
return () => {
|
|
23
|
-
focus();
|
|
24
|
-
controller.abort();
|
|
25
|
-
};
|
|
26
|
-
}, []);
|
|
27
|
-
const onClickLabel = () => inputRef.current?.focus();
|
|
28
|
-
return (<InputField info={info} left={left} error={error} form={props.form} loading={loading} name={props.name} feedback={feedback} hideLeft={hideLeft} required={required} title={props.title} container={container} componentName="select" rightLabel={rightLabel} hiddenLabel={hiddenLabel} interactive={interactive} id={props.name || props.id} optionalText={optionalText} labelClassName={labelClassName} placeholder={props.placeholder} right={<label htmlFor={id}>
|
|
29
|
-
{right}
|
|
30
|
-
<button onClick={onClickLabel} type="button" className="mt-2 transition-colors hover:text-primary">
|
|
31
|
-
<CaretDownIcon size={20}/>
|
|
32
|
-
<span className="sr-only">{translation.inputCaretDown}</span>
|
|
33
|
-
</button>
|
|
34
|
-
</label>}>
|
|
35
|
-
<select {...props} id={id} name={id} required={required} ref={mergeRefs(ref, inputRef)} data-selected={!!props.value || false} title={typeof props.title === "string" ? props.title : undefined} className={css("input select group h-input-height w-full flex-1 appearance-none rounded-input-radius text-input-text", "bg-transparent px-input-padding-x py-input-padding-y text-foreground placeholder-input-placeholder", "outline-none transition-colors group-error:text-danger group-error:placeholder-input-mask-error", "data-[selected=false]:text-input-placeholder", props.className)}>
|
|
36
|
-
<option value="" disabled hidden>
|
|
37
|
-
{props.placeholder}
|
|
38
|
-
</option>
|
|
39
|
-
{options.map((option) => (<option {...option} value={option.value} key={`${id}-select-option-${option.value}`}>
|
|
40
|
-
{option.label ?? option.value}
|
|
41
|
-
</option>))}
|
|
42
|
-
</select>
|
|
43
|
-
</InputField>);
|
|
44
|
-
});
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Slider as Base } from "@base-ui/react/slider";
|
|
2
|
-
type SliderProps = Parameters<typeof Base.Root>[0] & {
|
|
3
|
-
tooltip?: boolean;
|
|
4
|
-
};
|
|
5
|
-
export declare const Slider: (props: SliderProps) => import("react").JSX.Element;
|
|
6
|
-
export {};
|
|
7
|
-
//# sourceMappingURL=slider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slider.d.ts","sourceRoot":"","sources":["../../../../src/components/form/slider.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,IAAI,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAQvD,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG;IACjD,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAmCF,eAAO,MAAM,MAAM,GAAI,OAAO,WAAW,gCAgBxC,CAAC"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { Slider as Base } from "@base-ui/react/slider";
|
|
3
|
-
import { Is } from "sidekicker";
|
|
4
|
-
import { css } from "../../lib/dom";
|
|
5
|
-
import { Tooltip } from "../floating/tooltip";
|
|
6
|
-
import { useEffect, useRef, useState } from "react";
|
|
7
|
-
import { uuid } from "../../lib/fns";
|
|
8
|
-
import { useLocale } from "../../hooks/use-locale";
|
|
9
|
-
const Thumb = (props) => {
|
|
10
|
-
const [float, setFloat] = useState(null);
|
|
11
|
-
const ref = useRef(null);
|
|
12
|
-
useEffect(() => {
|
|
13
|
-
const html = ref.current;
|
|
14
|
-
if (html === null)
|
|
15
|
-
return;
|
|
16
|
-
const initialValue = Number(html.getAttribute("aria-valuenow"));
|
|
17
|
-
if (Is.number(initialValue)) {
|
|
18
|
-
setFloat(initialValue);
|
|
19
|
-
}
|
|
20
|
-
const observer = new MutationObserver((changes) => {
|
|
21
|
-
const span = changes[0].target;
|
|
22
|
-
const value = Number(span.getAttribute("aria-valuenow"));
|
|
23
|
-
setFloat(Is.number(value) ? value : null);
|
|
24
|
-
});
|
|
25
|
-
observer.observe(html, { attributeFilter: ["aria-valuenow"] });
|
|
26
|
-
return () => observer.disconnect();
|
|
27
|
-
}, []);
|
|
28
|
-
return (<Tooltip title="" ref={ref} as={Base.Thumb} enabled={props.tooltip} className="focus-within::scale-105 block size-slider-thumb-size cursor-grab rounded-full border-2 border-input-border bg-input-switch shadow-shadow-floating focus-within:border-primary focus-within:outline active:cursor-grabbing">
|
|
29
|
-
{float}
|
|
30
|
-
</Tooltip>);
|
|
31
|
-
};
|
|
32
|
-
export const Slider = (props) => {
|
|
33
|
-
const { tooltip, className, defaultValue, value, ...restProps } = props;
|
|
34
|
-
const id = useRef(uuid());
|
|
35
|
-
const array = defaultValue || value || [];
|
|
36
|
-
const locale = useLocale();
|
|
37
|
-
return (<Base.Root {...restProps} value={value} locale={locale} defaultValue={defaultValue}>
|
|
38
|
-
<Base.Control className={css("relative flex h-slider-control-h w-full touch-none select-none items-center", className)}>
|
|
39
|
-
<Base.Track className="relative h-slider-track-h grow rounded-full bg-background">
|
|
40
|
-
<Base.Indicator className="absolute h-full rounded-full bg-primary"/>
|
|
41
|
-
</Base.Track>
|
|
42
|
-
{Array.isArray(array) ? array.map((_, i) => <Thumb tooltip={tooltip ?? false} key={`${id.current}-${i}`}/>) : null}
|
|
43
|
-
</Base.Control>
|
|
44
|
-
</Base.Root>);
|
|
45
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
export type SwitchProps = React.ComponentProps<"input"> & {
|
|
3
|
-
error?: string;
|
|
4
|
-
loading?: boolean;
|
|
5
|
-
container?: string;
|
|
6
|
-
onCheck?: (nextValue: boolean) => void;
|
|
7
|
-
};
|
|
8
|
-
export declare const Switch: React.ForwardRefExoticComponent<Omit<SwitchProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
9
|
-
//# sourceMappingURL=switch.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../../../src/components/form/switch.tsx"],"names":[],"mappings":"AACA,OAAO,KAA8E,MAAM,OAAO,CAAC;AAInG,MAAM,MAAM,WAAW,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG;IACtD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C,CAAC;AAEF,eAAO,MAAM,MAAM,mGAqEjB,CAAC"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import React, { forwardRef, useEffect, useId, useImperativeHandle, useRef, useState } from "react";
|
|
3
|
-
import { useStableRef } from "../../hooks/use-stable-ref";
|
|
4
|
-
import { css } from "../../lib/dom";
|
|
5
|
-
export const Switch = forwardRef(({ children, loading, container, error, ...props }, ref) => {
|
|
6
|
-
const id = useId();
|
|
7
|
-
const [innerChecked, setInnerChecked] = useState(props.checked ?? false);
|
|
8
|
-
const checked = innerChecked;
|
|
9
|
-
const innerRef = useRef(null);
|
|
10
|
-
const stableOnChange = useStableRef(props.onChange);
|
|
11
|
-
useImperativeHandle(ref, () => innerRef.current);
|
|
12
|
-
useEffect(() => {
|
|
13
|
-
if (innerRef.current !== null) {
|
|
14
|
-
if (stableOnChange.current) {
|
|
15
|
-
const onChange = (e) => {
|
|
16
|
-
if (stableOnChange.current)
|
|
17
|
-
stableOnChange.current(e);
|
|
18
|
-
};
|
|
19
|
-
const ref = innerRef.current;
|
|
20
|
-
ref.addEventListener("change", onChange);
|
|
21
|
-
return () => ref?.removeEventListener("change", onChange);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}, [stableOnChange]);
|
|
25
|
-
const onCheck = () => {
|
|
26
|
-
const checked = !innerRef.current?.checked;
|
|
27
|
-
setInnerChecked(checked);
|
|
28
|
-
props?.onCheck?.(checked);
|
|
29
|
-
if (innerRef.current !== null) {
|
|
30
|
-
innerRef.current.checked = checked;
|
|
31
|
-
innerRef.current.dispatchEvent(new Event("change", { bubbles: true }));
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
return (<fieldset className={css("flex flex-col flex-wrap justify-center", container)} data-component="switch" disabled={props.disabled || loading}>
|
|
35
|
-
<span className="flex flex-row flex-wrap items-center">
|
|
36
|
-
<input {...props} hidden ref={innerRef} type="checkbox" checked={checked} id={props.id || id} data-trigger="change" data-checked={checked} disabled={props.disabled || loading} onChange={(e) => setInnerChecked(e.target.checked)}/>
|
|
37
|
-
<button role="switch" type="button" onClick={onCheck} aria-checked={checked} data-checked={checked} aria-labelledby={`${id}-label`} disabled={props.disabled || loading} className="relative inline-flex h-switch-track-h w-switch-track-w flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-300 ease-in-out focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 data-[checked=false]:bg-input-switch-bg data-[checked=true]:bg-primary">
|
|
38
|
-
<span aria-hidden="true" data-checked={checked} className="inline-block aspect-square size-switch-thumb-size transform rounded-full shadow ring-0 transition duration-300 ease-in-out data-[checked=false]:translate-x-0 data-[checked=true]:translate-x-5 data-[checked=false]:bg-disabled data-[checked=true]:bg-input-switch"/>
|
|
39
|
-
</button>
|
|
40
|
-
<label htmlFor={props.id || id} className="ml-switch-gap inline-block text-switch-label-text" id={`${id}-label`}>
|
|
41
|
-
<span className="font-medium text-foreground">{children}</span>
|
|
42
|
-
</label>
|
|
43
|
-
</span>
|
|
44
|
-
<span className="mt-switch-hint-mt flex-1 whitespace-nowrap text-switch-hint-text text-danger empty:mt-0 empty:hidden">{error}</span>
|
|
45
|
-
</fieldset>);
|
|
46
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"task-list.d.ts","sourceRoot":"","sources":["../../../../src/components/form/task-list.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAa,MAAM,OAAO,CAAC;AAErE,eAAO,MAAM,QAAQ,GAAI,OAAO,iBAAiB,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,gCA2B5E,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { stagger, useAnimate } from "motion/react";
|
|
3
|
-
import { useEffect } from "react";
|
|
4
|
-
export const TaskList = (props) => {
|
|
5
|
-
const [ref, animate] = useAnimate();
|
|
6
|
-
useEffect(() => {
|
|
7
|
-
const container = ref.current;
|
|
8
|
-
if (!container)
|
|
9
|
-
return;
|
|
10
|
-
const handler = (e) => {
|
|
11
|
-
const input = e.target;
|
|
12
|
-
const items = Array.from(container.querySelectorAll("input[data-task=true]"));
|
|
13
|
-
const allTaskChecked = items.every((el) => el.checked);
|
|
14
|
-
const index = items.indexOf(input);
|
|
15
|
-
if (allTaskChecked && index !== -1) {
|
|
16
|
-
animate("input", { scale: [1, 1.35, 1], rotate: [0, 20, -20, 0] }, {
|
|
17
|
-
duration: 0.5,
|
|
18
|
-
delay: stagger(0.075, { from: index }),
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
container.addEventListener("change", handler);
|
|
23
|
-
return () => container.removeEventListener("change", handler);
|
|
24
|
-
}, [ref, animate]);
|
|
25
|
-
return <fieldset {...props} data-component="task-list" ref={ref}/>;
|
|
26
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"textarea.d.ts","sourceRoot":"","sources":["../../../../src/components/form/textarea.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAkB,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5D,MAAM,MAAM,aAAa,GAAG,aAAa,CAAC,UAAU,EAAE,KAAK,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;AAExF,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CA6B5C,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { createFreeText } from "./free-text";
|
|
3
|
-
export const Textarea = createFreeText("textarea", "textarea", { container: "w-full" }, (textarea) => {
|
|
4
|
-
const hasRows = textarea.hasAttribute("rows");
|
|
5
|
-
const computeMinHeight = () => {
|
|
6
|
-
if (!hasRows)
|
|
7
|
-
return textarea.offsetHeight;
|
|
8
|
-
const s = window.getComputedStyle(textarea);
|
|
9
|
-
return (textarea.rows * parseFloat(s.lineHeight) +
|
|
10
|
-
parseFloat(s.paddingTop) +
|
|
11
|
-
parseFloat(s.paddingBottom) +
|
|
12
|
-
parseFloat(s.borderTopWidth) +
|
|
13
|
-
parseFloat(s.borderBottomWidth));
|
|
14
|
-
};
|
|
15
|
-
const minHeight = computeMinHeight();
|
|
16
|
-
const adjustHeight = () => {
|
|
17
|
-
textarea.style.height = "0px";
|
|
18
|
-
textarea.style.height = `${Math.max(textarea.scrollHeight, minHeight)}px`;
|
|
19
|
-
};
|
|
20
|
-
adjustHeight();
|
|
21
|
-
textarea.addEventListener("input", adjustHeight);
|
|
22
|
-
return () => {
|
|
23
|
-
textarea.removeEventListener("input", adjustHeight);
|
|
24
|
-
textarea.style.height = "";
|
|
25
|
-
};
|
|
26
|
-
});
|