@godxjp/ui 13.9.3 → 13.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/app-provider.d.ts +30 -0
- package/dist/app/app-provider.js +244 -0
- package/dist/app/date-format-labels.d.ts +8 -0
- package/dist/app/date-format-labels.js +16 -0
- package/dist/app/date-formats.d.ts +10 -0
- package/dist/app/date-formats.js +27 -0
- package/dist/app/index.d.ts +13 -136
- package/dist/app/index.js +65 -38
- package/dist/app/locales.d.ts +12 -0
- package/dist/app/locales.js +26 -0
- package/dist/app/request-headers.d.ts +7 -0
- package/dist/app/request-headers.js +27 -0
- package/dist/app/storage.d.ts +11 -0
- package/dist/app/storage.js +32 -0
- package/dist/app/time-format-labels.d.ts +8 -0
- package/dist/app/time-format-labels.js +14 -0
- package/dist/app/time-formats.d.ts +7 -0
- package/dist/app/time-formats.js +14 -0
- package/dist/app/timezones.d.ts +31 -0
- package/dist/app/timezones.js +161 -0
- package/dist/app/types.d.ts +21 -0
- package/dist/app/types.js +30 -0
- package/dist/app/use-formatting.d.ts +19 -0
- package/dist/app/use-formatting.js +37 -0
- package/dist/components/admin/index.d.ts +26 -66
- package/dist/components/admin/index.js +96 -49
- package/dist/components/data-display/accordion.d.ts +1 -0
- package/dist/components/data-display/accordion.js +7 -0
- package/dist/components/data-display/avatar.d.ts +1 -0
- package/dist/components/data-display/avatar.js +6 -0
- package/dist/components/data-display/badge.d.ts +9 -13
- package/dist/components/data-display/badge.js +111 -5
- package/dist/components/data-display/card.d.ts +22 -26
- package/dist/components/data-display/card.js +153 -2
- package/dist/components/data-display/carousel.d.ts +11 -13
- package/dist/components/data-display/carousel.js +220 -4
- package/dist/components/data-display/collapsible.d.ts +4 -0
- package/dist/components/data-display/collapsible.js +9 -0
- package/dist/components/data-display/data-table.d.ts +53 -0
- package/dist/components/data-display/data-table.js +424 -0
- package/dist/components/data-display/descriptions.d.ts +19 -0
- package/dist/components/data-display/descriptions.js +25 -0
- package/dist/components/data-display/empty-state.d.ts +3 -0
- package/dist/{chunk-YD7V2HGZ.js → components/data-display/empty-state.js} +5 -5
- package/dist/components/data-display/hover-card.d.ts +1 -0
- package/dist/components/data-display/hover-card.js +6 -0
- package/dist/components/data-display/index.d.ts +24 -79
- package/dist/components/data-display/index.js +95 -176
- package/dist/components/data-display/popover.d.ts +9 -13
- package/dist/components/data-display/popover.js +61 -2
- package/dist/components/data-display/progress.d.ts +7 -0
- package/dist/components/data-display/progress.js +27 -0
- package/dist/components/data-display/scroll-area.d.ts +4 -7
- package/dist/components/data-display/scroll-area.js +38 -2
- package/dist/components/data-display/table.d.ts +7 -10
- package/dist/components/data-display/table.js +36 -3
- package/dist/components/data-display/timeline.d.ts +12 -0
- package/dist/components/data-display/timeline.js +35 -0
- package/dist/components/data-display/tree-list.d.ts +13 -0
- package/dist/components/data-display/tree-list.js +30 -0
- package/dist/components/data-entry/calendar.d.ts +3 -19
- package/dist/components/data-entry/calendar.js +96 -6
- package/dist/components/data-entry/cascader.d.ts +4 -35
- package/dist/components/data-entry/cascader.js +327 -10
- package/dist/components/data-entry/checkbox-group.d.ts +3 -0
- package/dist/{chunk-BE6GJGKJ.js → components/data-entry/checkbox-group.js} +9 -26
- package/dist/components/data-entry/checkbox.d.ts +7 -16
- package/dist/components/data-entry/checkbox.js +26 -4
- package/dist/components/data-entry/choice-option.d.ts +10 -0
- package/dist/components/data-entry/choice-option.js +7 -0
- package/dist/components/data-entry/color-picker.d.ts +3 -19
- package/dist/components/data-entry/color-picker.js +75 -6
- package/dist/components/data-entry/command.d.ts +7 -10
- package/dist/components/data-entry/command.js +51 -3
- package/dist/components/data-entry/date-picker.d.ts +3 -19
- package/dist/components/data-entry/date-picker.js +153 -9
- package/dist/components/data-entry/date-range-picker.d.ts +3 -19
- package/dist/components/data-entry/date-range-picker.js +191 -8
- package/dist/components/data-entry/field.d.ts +4 -0
- package/dist/{chunk-44YRPSZ7.js → components/data-entry/field.js} +6 -11
- package/dist/components/data-entry/form-field.d.ts +3 -0
- package/dist/{chunk-LBYSX3VM.js → components/data-entry/form-field.js} +14 -47
- package/dist/components/data-entry/form.d.ts +29 -0
- package/dist/components/data-entry/form.js +41 -0
- package/dist/components/data-entry/index.d.ts +61 -164
- package/dist/components/data-entry/index.js +117 -37
- package/dist/components/data-entry/input-otp.d.ts +1 -0
- package/dist/components/data-entry/input-otp.js +7 -0
- package/dist/components/data-entry/input.d.ts +3 -6
- package/dist/components/data-entry/input.js +98 -4
- package/dist/components/data-entry/label.d.ts +4 -8
- package/dist/components/data-entry/label.js +25 -2
- package/dist/components/data-entry/month-picker.d.ts +9 -0
- package/dist/components/data-entry/month-picker.js +188 -0
- package/dist/components/data-entry/month-range-picker.d.ts +11 -0
- package/dist/components/data-entry/month-range-picker.js +245 -0
- package/dist/components/data-entry/number-input.d.ts +12 -0
- package/dist/components/data-entry/number-input.js +219 -0
- package/dist/components/data-entry/password-input.d.ts +2 -0
- package/dist/components/data-entry/password-input.js +4 -0
- package/dist/components/data-entry/password-strength.d.ts +20 -0
- package/dist/{chunk-VSUYVT2Q.js → components/data-entry/password-strength.js} +8 -62
- package/dist/components/data-entry/radio.d.ts +7 -20
- package/dist/components/data-entry/radio.js +93 -4
- package/dist/components/data-entry/rating.d.ts +2 -0
- package/dist/components/data-entry/rating.js +4 -0
- package/dist/components/data-entry/search-input.d.ts +18 -0
- package/dist/{chunk-LVLPNKJP.js → components/data-entry/search-input.js} +11 -11
- package/dist/components/data-entry/search-select.d.ts +11 -0
- package/dist/{chunk-6S2ZU26B.js → components/data-entry/search-select.js} +14 -239
- package/dist/components/data-entry/select.d.ts +14 -30
- package/dist/components/data-entry/select.js +243 -9
- package/dist/components/data-entry/slider.d.ts +4 -18
- package/dist/components/data-entry/slider.js +52 -2
- package/dist/components/data-entry/switch.d.ts +4 -18
- package/dist/components/data-entry/switch.js +40 -2
- package/dist/components/data-entry/tag-input.d.ts +2 -0
- package/dist/components/data-entry/tag-input.js +4 -0
- package/dist/components/data-entry/textarea.d.ts +3 -6
- package/dist/components/data-entry/textarea.js +86 -5
- package/dist/components/data-entry/time-input.d.ts +3 -6
- package/dist/components/data-entry/time-input.js +137 -3
- package/dist/components/data-entry/time-picker.d.ts +3 -19
- package/dist/components/data-entry/time-picker.js +329 -7
- package/dist/components/data-entry/toggle-group.d.ts +1 -0
- package/dist/components/data-entry/toggle-group.js +5 -0
- package/dist/components/data-entry/toggle.d.ts +2 -0
- package/dist/components/data-entry/toggle.js +4 -0
- package/dist/components/data-entry/transfer.d.ts +3 -20
- package/dist/components/data-entry/transfer.js +193 -13
- package/dist/components/data-entry/tree-select-strategy.d.ts +5 -0
- package/dist/components/data-entry/tree-select-strategy.js +8 -0
- package/dist/components/data-entry/tree-select.d.ts +5 -25
- package/dist/components/data-entry/tree-select.js +299 -13
- package/dist/components/data-entry/tree-utils.d.ts +48 -0
- package/dist/{chunk-SMLKNECP.js → components/data-entry/tree-utils.js} +33 -5
- package/dist/components/data-entry/upload-crop-dialog.d.ts +9 -0
- package/dist/components/data-entry/upload-crop-dialog.js +102 -0
- package/dist/components/data-entry/upload-types.d.ts +39 -0
- package/dist/components/data-entry/upload-types.js +41 -0
- package/dist/components/data-entry/upload.d.ts +6 -45
- package/dist/components/data-entry/upload.js +417 -12
- package/dist/components/data-entry/use-upload-draft.d.ts +25 -0
- package/dist/components/data-entry/use-upload-draft.js +64 -0
- package/dist/components/data-grid/data-grid.d.ts +67 -0
- package/dist/components/data-grid/data-grid.js +402 -0
- package/dist/components/data-grid/index.d.ts +2 -71
- package/dist/components/data-grid/index.js +3 -371
- package/dist/components/feedback/alert.d.ts +37 -42
- package/dist/components/feedback/alert.js +127 -7
- package/dist/components/feedback/dialog.d.ts +21 -25
- package/dist/components/feedback/dialog.js +356 -8
- package/dist/components/feedback/index.d.ts +10 -28
- package/dist/components/feedback/index.js +105 -18
- package/dist/components/feedback/overlay-header-tone.d.ts +7 -0
- package/dist/{chunk-VU4GFGDG.js → components/feedback/overlay-header-tone.js} +4 -4
- package/dist/components/feedback/sheet.d.ts +18 -23
- package/dist/components/feedback/sheet.js +192 -3
- package/dist/components/feedback/skeleton.d.ts +17 -0
- package/dist/{chunk-2BR7KFCP.js → components/feedback/skeleton.js} +10 -6
- package/dist/components/feedback/sonner.d.ts +2 -5
- package/dist/components/feedback/sonner.js +50 -1
- package/dist/components/feedback/tooltip.d.ts +10 -0
- package/dist/{chunk-32WO3YLB.js → components/feedback/tooltip.js} +12 -9
- package/dist/components/feedback/use-toast.d.ts +3 -0
- package/dist/components/feedback/use-toast.js +5 -0
- package/dist/components/general/button.d.ts +12 -18
- package/dist/components/general/button.js +118 -4
- package/dist/components/general/index.d.ts +4 -37
- package/dist/components/general/index.js +8 -48
- package/dist/components/general/typography.d.ts +30 -0
- package/dist/components/general/typography.js +46 -0
- package/dist/components/layout/app-shell.d.ts +3 -0
- package/dist/components/layout/app-shell.js +33 -0
- package/dist/components/layout/aspect-ratio.d.ts +1 -0
- package/dist/components/layout/aspect-ratio.js +4 -0
- package/dist/components/layout/breadcrumb.d.ts +7 -0
- package/dist/components/layout/breadcrumb.js +16 -0
- package/dist/components/layout/flex.d.ts +3 -0
- package/dist/components/layout/flex.js +29 -0
- package/dist/components/layout/index.d.ts +19 -60
- package/dist/components/layout/index.js +29 -12
- package/dist/components/layout/page-container.d.ts +8 -0
- package/dist/components/layout/page-container.js +77 -0
- package/dist/components/layout/resizable.d.ts +8 -12
- package/dist/components/layout/resizable.js +44 -2
- package/dist/components/layout/responsive-grid.d.ts +7 -0
- package/dist/{chunk-C3PKEV6S.js → components/layout/responsive-grid.js} +4 -5
- package/dist/components/layout/separator.d.ts +1 -0
- package/dist/components/layout/separator.js +4 -0
- package/dist/components/layout/sidebar.d.ts +21 -0
- package/dist/components/layout/sidebar.js +254 -0
- package/dist/components/layout/split-pane.d.ts +7 -0
- package/dist/components/layout/split-pane.js +10 -0
- package/dist/components/layout/topbar.d.ts +3 -0
- package/dist/components/layout/topbar.js +133 -0
- package/dist/components/navigation/app-setting-picker.d.ts +9 -0
- package/dist/{chunk-RHPFCKB2.js → components/navigation/app-setting-picker.js} +24 -49
- package/dist/components/navigation/context-menu.d.ts +16 -20
- package/dist/components/navigation/context-menu.js +144 -2
- package/dist/components/navigation/dropdown-menu.d.ts +17 -21
- package/dist/components/navigation/dropdown-menu.js +164 -2
- package/dist/components/navigation/filter-bar.d.ts +4 -0
- package/dist/components/navigation/filter-bar.js +43 -0
- package/dist/components/navigation/index.d.ts +12 -36
- package/dist/components/navigation/index.js +140 -17
- package/dist/components/navigation/menubar.d.ts +18 -23
- package/dist/components/navigation/menubar.js +135 -2
- package/dist/components/navigation/navigation-menu.d.ts +10 -13
- package/dist/components/navigation/navigation-menu.js +90 -2
- package/dist/components/navigation/pagination-utils.d.ts +2 -0
- package/dist/components/navigation/pagination-utils.js +25 -0
- package/dist/components/navigation/pagination.d.ts +6 -12
- package/dist/components/navigation/pagination.js +222 -10
- package/dist/components/navigation/steps.d.ts +3 -12
- package/dist/components/navigation/steps.js +150 -5
- package/dist/components/navigation/tabs.d.ts +8 -12
- package/dist/components/navigation/tabs.js +109 -2
- package/dist/components/query/data-state.d.ts +7 -0
- package/dist/components/query/data-state.js +44 -0
- package/dist/components/query/index.d.ts +10 -43
- package/dist/components/query/index.js +13 -195
- package/dist/components/query/infinite-query-state.d.ts +13 -0
- package/dist/components/query/infinite-query-state.js +70 -0
- package/dist/components/query/mutation-feedback.d.ts +7 -0
- package/dist/components/query/mutation-feedback.js +23 -0
- package/dist/components/query/prefetch-link.d.ts +7 -0
- package/dist/components/query/prefetch-link.js +36 -0
- package/dist/components/query/query-refetch-button.d.ts +4 -0
- package/dist/components/query/query-refetch-button.js +40 -0
- package/dist/components/ui/accordion.d.ts +6 -0
- package/dist/components/ui/accordion.js +47 -0
- package/dist/components/ui/alert-dialog.d.ts +1 -0
- package/dist/components/ui/alert-dialog.js +1 -0
- package/dist/components/ui/alert.d.ts +1 -0
- package/dist/components/ui/alert.js +1 -0
- package/dist/components/ui/aspect-ratio.d.ts +3 -0
- package/dist/components/ui/aspect-ratio.js +18 -0
- package/dist/components/ui/avatar.d.ts +5 -0
- package/dist/{chunk-QTUJSRDH.js → components/ui/avatar.js} +12 -10
- package/dist/components/ui/badge.d.ts +1 -0
- package/dist/components/ui/badge.js +1 -0
- package/dist/components/ui/button.d.ts +1 -0
- package/dist/components/ui/button.js +1 -0
- package/dist/components/ui/calendar.d.ts +1 -0
- package/dist/components/ui/calendar.js +1 -0
- package/dist/components/ui/card.d.ts +1 -0
- package/dist/components/ui/card.js +1 -0
- package/dist/components/ui/carousel.d.ts +1 -0
- package/dist/components/ui/carousel.js +1 -0
- package/dist/components/ui/checkbox.d.ts +1 -0
- package/dist/components/ui/checkbox.js +1 -0
- package/dist/components/ui/color-picker.d.ts +1 -0
- package/dist/components/ui/color-picker.js +1 -0
- package/dist/components/ui/command.d.ts +1 -0
- package/dist/components/ui/command.js +1 -0
- package/dist/components/ui/context-menu.d.ts +1 -0
- package/dist/components/ui/context-menu.js +1 -0
- package/dist/components/ui/date-picker.d.ts +1 -0
- package/dist/components/ui/date-picker.js +1 -0
- package/dist/components/ui/date-range-picker.d.ts +1 -0
- package/dist/components/ui/date-range-picker.js +1 -0
- package/dist/components/ui/dialog.d.ts +1 -0
- package/dist/components/ui/dialog.js +1 -0
- package/dist/components/ui/dropdown-menu.d.ts +1 -0
- package/dist/components/ui/dropdown-menu.js +1 -0
- package/dist/components/ui/hover-card.d.ts +10 -0
- package/dist/components/ui/hover-card.js +45 -0
- package/dist/components/ui/index.d.ts +43 -80
- package/dist/components/ui/index.js +50 -47
- package/dist/components/ui/input-otp.d.ts +33 -0
- package/dist/components/ui/input-otp.js +55 -0
- package/dist/components/ui/input.d.ts +1 -0
- package/dist/components/ui/input.js +1 -0
- package/dist/components/ui/label.d.ts +1 -0
- package/dist/components/ui/label.js +1 -0
- package/dist/components/ui/menubar.d.ts +1 -0
- package/dist/components/ui/menubar.js +1 -0
- package/dist/components/ui/navigation-menu.d.ts +1 -0
- package/dist/components/ui/navigation-menu.js +1 -0
- package/dist/components/ui/pagination.d.ts +1 -0
- package/dist/components/ui/pagination.js +1 -0
- package/dist/components/ui/password-input.d.ts +4 -0
- package/dist/components/ui/password-input.js +38 -0
- package/dist/components/ui/password-strength.d.ts +1 -0
- package/dist/components/ui/password-strength.js +1 -0
- package/dist/components/ui/popover.d.ts +1 -0
- package/dist/components/ui/popover.js +1 -0
- package/dist/components/ui/radio.d.ts +1 -0
- package/dist/components/ui/radio.js +1 -0
- package/dist/components/ui/rating.d.ts +13 -0
- package/dist/components/ui/rating.js +90 -0
- package/dist/components/ui/resizable.d.ts +1 -0
- package/dist/components/ui/resizable.js +1 -0
- package/dist/components/ui/scroll-area.d.ts +1 -0
- package/dist/components/ui/scroll-area.js +1 -0
- package/dist/components/ui/select.d.ts +1 -0
- package/dist/components/ui/select.js +1 -0
- package/dist/components/ui/separator.d.ts +3 -0
- package/dist/components/ui/separator.js +20 -0
- package/dist/components/ui/sheet.d.ts +1 -0
- package/dist/components/ui/sheet.js +1 -0
- package/dist/components/ui/skeleton.d.ts +1 -0
- package/dist/components/ui/skeleton.js +4 -0
- package/dist/components/ui/slider.d.ts +1 -0
- package/dist/components/ui/slider.js +1 -0
- package/dist/components/ui/sonner.d.ts +1 -0
- package/dist/components/ui/sonner.js +1 -0
- package/dist/components/ui/switch.d.ts +1 -0
- package/dist/components/ui/switch.js +1 -0
- package/dist/components/ui/table.d.ts +1 -0
- package/dist/components/ui/table.js +1 -0
- package/dist/components/ui/tabs.d.ts +1 -0
- package/dist/components/ui/tabs.js +1 -0
- package/dist/components/ui/tag-input.d.ts +13 -0
- package/dist/components/ui/tag-input.js +100 -0
- package/dist/components/ui/textarea.d.ts +1 -0
- package/dist/components/ui/textarea.js +1 -0
- package/dist/components/ui/time-input.d.ts +1 -0
- package/dist/components/ui/time-input.js +1 -0
- package/dist/components/ui/time-picker.d.ts +1 -0
- package/dist/components/ui/time-picker.js +1 -0
- package/dist/components/ui/toggle-group.d.ts +11 -0
- package/dist/components/ui/toggle-group.js +32 -0
- package/dist/components/ui/toggle.d.ts +13 -0
- package/dist/components/ui/toggle.js +36 -0
- package/dist/components/ui/upload.d.ts +1 -0
- package/dist/components/ui/upload.js +1 -0
- package/dist/form/form-field-control.d.ts +4 -0
- package/dist/form/form-field-control.js +42 -0
- package/dist/form/form-root.d.ts +4 -0
- package/dist/form/form-root.js +26 -0
- package/dist/form/index.d.ts +7 -21
- package/dist/form/index.js +8 -73
- package/dist/form/use-zod-form.d.ts +10 -0
- package/dist/form/use-zod-form.js +14 -0
- package/dist/i18n/index.d.ts +3 -326
- package/dist/i18n/index.js +17 -2
- package/dist/i18n/messages/en.json +279 -0
- package/dist/i18n/messages/ja.json +276 -0
- package/dist/i18n/messages/vi.json +276 -0
- package/dist/i18n/translate.d.ts +15 -0
- package/dist/i18n/translate.js +82 -0
- package/dist/i18n/use-translation.d.ts +19 -0
- package/dist/i18n/use-translation.js +46 -0
- package/dist/index.d.ts +11 -47
- package/dist/index.js +16 -62
- package/dist/lib/control-styles.d.ts +26 -0
- package/dist/lib/control-styles.js +34 -0
- package/dist/lib/datetime/detect.d.ts +4 -0
- package/dist/lib/datetime/detect.js +16 -0
- package/dist/lib/datetime/format-date.d.ts +22 -0
- package/dist/lib/datetime/format-date.js +73 -0
- package/dist/lib/datetime/format.d.ts +23 -0
- package/dist/lib/datetime/format.js +94 -0
- package/dist/lib/datetime/index.d.ts +5 -35
- package/dist/lib/datetime/index.js +50 -1
- package/dist/lib/datetime/parse.d.ts +12 -0
- package/dist/lib/datetime/parse.js +56 -0
- package/dist/lib/datetime/sync.d.ts +19 -0
- package/dist/lib/datetime/sync.js +45 -0
- package/dist/lib/format.d.ts +21 -0
- package/dist/{chunk-X6AJ5HEI.js → lib/format.js} +35 -5
- package/dist/lib/hooks.d.ts +4 -6
- package/dist/lib/hooks.js +70 -1
- package/dist/lib/utils.d.ts +2 -5
- package/dist/lib/utils.js +8 -1
- package/dist/lib/variants.d.ts +12 -0
- package/dist/lib/variants.js +38 -0
- package/dist/{app.prop-CVY8V4ss.d.ts → props/components/app.prop.d.ts} +8 -12
- package/dist/props/components/app.prop.js +0 -0
- package/dist/{data-display.prop-CT0nVMdp.d.ts → props/components/data-display.prop.d.ts} +7 -15
- package/dist/props/components/data-display.prop.js +0 -0
- package/dist/{data-entry.prop-BSUaseKh.d.ts → props/components/data-entry.prop.d.ts} +46 -91
- package/dist/props/components/data-entry.prop.js +0 -0
- package/dist/{feedback.prop-CHlHDYZK.d.ts → props/components/feedback.prop.d.ts} +10 -16
- package/dist/props/components/feedback.prop.js +0 -0
- package/dist/{form.prop-5cyL3bvT.d.ts → props/components/form.prop.d.ts} +10 -14
- package/dist/props/components/form.prop.js +0 -0
- package/dist/{general.prop-CzlQin6v.d.ts → props/components/general.prop.d.ts} +5 -10
- package/dist/props/components/general.prop.js +0 -0
- package/dist/props/components/index.d.ts +9 -27
- package/dist/props/components/index.js +0 -1
- package/dist/{layout.prop-fCz-Vlie.d.ts → props/components/layout.prop.d.ts} +19 -26
- package/dist/props/components/layout.prop.js +0 -0
- package/dist/{navigation.prop-FCsOVGrP.d.ts → props/components/navigation.prop.d.ts} +10 -15
- package/dist/props/components/navigation.prop.js +0 -0
- package/dist/{query.prop-CT2gFtr4.d.ts → props/components/query.prop.d.ts} +12 -15
- package/dist/props/components/query.prop.js +0 -0
- package/dist/props/index.d.ts +7 -28
- package/dist/props/index.js +12 -3
- package/dist/props/registry.d.ts +5 -7
- package/dist/props/registry.js +998 -1
- package/dist/{content.prop-DrV_zDy-.d.ts → props/vocabulary/content.prop.d.ts} +12 -16
- package/dist/props/vocabulary/content.prop.js +0 -0
- package/dist/props/vocabulary/data.prop.d.ts +45 -0
- package/dist/props/vocabulary/data.prop.js +0 -0
- package/dist/props/vocabulary/index.d.ts +7 -7
- package/dist/props/vocabulary/index.js +0 -1
- package/dist/props/vocabulary/interaction.prop.d.ts +45 -0
- package/dist/props/vocabulary/interaction.prop.js +0 -0
- package/dist/props/vocabulary/layout.prop.d.ts +14 -0
- package/dist/props/vocabulary/layout.prop.js +0 -0
- package/dist/{navigation.prop-CXDaVNaR.d.ts → props/vocabulary/navigation.prop.d.ts} +3 -7
- package/dist/props/vocabulary/navigation.prop.js +0 -0
- package/dist/{shared.prop-BvMSLFJ6.d.ts → props/vocabulary/shared.prop.d.ts} +23 -27
- package/dist/props/vocabulary/shared.prop.js +0 -0
- package/dist/styles/table-layout.css +38 -0
- package/dist/tokens/components/table.css +2 -0
- package/package.json +2 -2
- package/dist/aspect-ratio-CZZJd9Km.d.ts +0 -9
- package/dist/avatar-D9MdXzfF.d.ts +0 -8
- package/dist/checkbox-bBfLARyF.d.ts +0 -13
- package/dist/chunk-2H65B4JA.js +0 -1
- package/dist/chunk-2RGPEFAW.js +0 -46
- package/dist/chunk-3JORZPS7.js +0 -232
- package/dist/chunk-3VFNWVR7.js +0 -153
- package/dist/chunk-4FGE5XVC.js +0 -996
- package/dist/chunk-5732TWQF.js +0 -1206
- package/dist/chunk-57VDEN64.js +0 -881
- package/dist/chunk-5LTW2LWF.js +0 -182
- package/dist/chunk-65RWSIZF.js +0 -327
- package/dist/chunk-7PWBC4BY.js +0 -25
- package/dist/chunk-B4K4BXEF.js +0 -18
- package/dist/chunk-B6S6LTWT.js +0 -464
- package/dist/chunk-B73NA66T.js +0 -122
- package/dist/chunk-B775Y6BE.js +0 -1
- package/dist/chunk-D4JX6O2W.js +0 -114
- package/dist/chunk-DV52WNXO.js +0 -8
- package/dist/chunk-DY5C44UP.js +0 -55
- package/dist/chunk-EG3RDM6F.js +0 -288
- package/dist/chunk-ES4Q3KGL.js +0 -1
- package/dist/chunk-FQGGF7GQ.js +0 -320
- package/dist/chunk-GJXOBDER.js +0 -1
- package/dist/chunk-HIEGUYPP.js +0 -95
- package/dist/chunk-HL3G4SVG.js +0 -131
- package/dist/chunk-I6G4IO7V.js +0 -485
- package/dist/chunk-I7NQ2LIL.js +0 -40
- package/dist/chunk-IJ5ALJGA.js +0 -31
- package/dist/chunk-INIIF7F7.js +0 -47
- package/dist/chunk-ION2KFXK.js +0 -75
- package/dist/chunk-J2DEWIYY.js +0 -37
- package/dist/chunk-K24AQV4R.js +0 -98
- package/dist/chunk-LFW37FGG.js +0 -68
- package/dist/chunk-LMKUKCTN.js +0 -150
- package/dist/chunk-NU2SOVTU.js +0 -96
- package/dist/chunk-NVTZ2EDW.js +0 -389
- package/dist/chunk-NZBAFFWP.js +0 -214
- package/dist/chunk-OO5DZH45.js +0 -587
- package/dist/chunk-Q3KUZG4P.js +0 -86
- package/dist/chunk-QROC2RMH.js +0 -150
- package/dist/chunk-QVBOICFU.js +0 -145
- package/dist/chunk-R2TXLS7S.js +0 -137
- package/dist/chunk-RZ32HY5E.js +0 -331
- package/dist/chunk-S2IJKT3D.js +0 -89
- package/dist/chunk-TBJBVEIP.js +0 -52
- package/dist/chunk-TO7URV7U.js +0 -51
- package/dist/chunk-U7N2A7A3.js +0 -9
- package/dist/chunk-V3N266PT.js +0 -106
- package/dist/chunk-W4REF4TD.js +0 -42
- package/dist/chunk-WGWI7EGL.js +0 -83
- package/dist/chunk-WY3VYUMX.js +0 -193
- package/dist/chunk-XBFUROAY.js +0 -117
- package/dist/chunk-XK3M3VRR.js +0 -32
- package/dist/chunk-YXVJFYQE.js +0 -191
- package/dist/chunk-ZT5UEUBO.js +0 -1
- package/dist/data-table-DRr70ULe.d.ts +0 -80
- package/dist/data.prop-D0UEEczj.d.ts +0 -42
- package/dist/filter-bar-DoDtwYrr.d.ts +0 -7
- package/dist/flex-1Cy46L0M.d.ts +0 -12
- package/dist/format-date-ByyZoqI5.d.ts +0 -51
- package/dist/interaction.prop-DD46aTro.d.ts +0 -47
- package/dist/layout.prop-CXvl2rVR.d.ts +0 -16
- package/dist/password-strength-DVRvXEOK.d.ts +0 -47
- package/dist/search-input-D4v1JGOA.d.ts +0 -27
- package/dist/skeleton-cj9kh5wo.d.ts +0 -20
- package/dist/types-mvzYGrma.d.ts +0 -37
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ToggleGroup, ToggleGroupItem } from "../ui/toggle-group";
|
|
@@ -1,20 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export {
|
|
4
|
-
import '@radix-ui/react-checkbox';
|
|
5
|
-
import '@radix-ui/react-radio-group';
|
|
6
|
-
import '@radix-ui/react-slider';
|
|
7
|
-
import '@radix-ui/react-switch';
|
|
8
|
-
import 'react-day-picker';
|
|
9
|
-
import 'react';
|
|
10
|
-
import '../../shared.prop-BvMSLFJ6.js';
|
|
11
|
-
import '../../content.prop-DrV_zDy-.js';
|
|
12
|
-
import '../../layout.prop-CXvl2rVR.js';
|
|
13
|
-
import '../../interaction.prop-DD46aTro.js';
|
|
14
|
-
import '../../data.prop-D0UEEczj.js';
|
|
15
|
-
import '../../layout.prop-fCz-Vlie.js';
|
|
16
|
-
import '../../navigation.prop-CXDaVNaR.js';
|
|
17
|
-
|
|
18
|
-
declare function Transfer({ dataSource, targetKeys, onValueChange, titles, showSearch, oneWay, disabled, className, selectedKeys: selectedKeysProp, onSelectChange, }: TransferProp): react_jsx_runtime.JSX.Element;
|
|
19
|
-
|
|
20
|
-
export { Transfer, TransferProp, TransferProp as TransferProps };
|
|
1
|
+
import type { TransferProp } from "../../props/components/data-entry.prop";
|
|
2
|
+
export type { TransferProp, TransferProp as TransferProps, TransferItemProp, } from "../../props/components/data-entry.prop";
|
|
3
|
+
export declare function Transfer({ dataSource, targetKeys, onValueChange, titles, showSearch, oneWay, disabled, className, selectedKeys: selectedKeysProp, onSelectChange, }: TransferProp): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,13 +1,193 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
4
|
+
import { useTranslation } from "../../i18n/use-translation";
|
|
5
|
+
import { cn } from "../../lib/utils";
|
|
6
|
+
import { Button } from "../general/button";
|
|
7
|
+
import { ScrollArea } from "../data-display/scroll-area";
|
|
8
|
+
import { Checkbox } from "./checkbox";
|
|
9
|
+
import { SearchInput } from "./search-input";
|
|
10
|
+
import { reactNodeText } from "./tree-utils";
|
|
11
|
+
function TransferPanel({
|
|
12
|
+
title,
|
|
13
|
+
items,
|
|
14
|
+
selectedKeys,
|
|
15
|
+
onSelectChange,
|
|
16
|
+
onSelectAll,
|
|
17
|
+
showSearch,
|
|
18
|
+
disabled,
|
|
19
|
+
searchPlaceholder,
|
|
20
|
+
emptyText,
|
|
21
|
+
direction
|
|
22
|
+
}) {
|
|
23
|
+
const { t } = useTranslation();
|
|
24
|
+
const titleId = React.useId();
|
|
25
|
+
const [query, setQuery] = React.useState("");
|
|
26
|
+
const filtered = React.useMemo(() => {
|
|
27
|
+
const q = query.trim().toLowerCase();
|
|
28
|
+
if (!q) return items;
|
|
29
|
+
return items.filter((item) => {
|
|
30
|
+
const titleMatch = reactNodeText(item.title).toLowerCase().includes(q);
|
|
31
|
+
const descMatch = item.description ? reactNodeText(item.description).toLowerCase().includes(q) : false;
|
|
32
|
+
return titleMatch || descMatch;
|
|
33
|
+
});
|
|
34
|
+
}, [items, query]);
|
|
35
|
+
const enabledItems = filtered.filter((i) => !i.disabled);
|
|
36
|
+
const allChecked = enabledItems.length > 0 && enabledItems.every((i) => selectedKeys.includes(i.key));
|
|
37
|
+
const indeterminate = !allChecked && enabledItems.some((i) => selectedKeys.includes(i.key));
|
|
38
|
+
const toggleKey = (key, checked) => {
|
|
39
|
+
onSelectChange(checked ? [...selectedKeys, key] : selectedKeys.filter((k) => k !== key));
|
|
40
|
+
};
|
|
41
|
+
return /* @__PURE__ */ jsxs("div", { className: "bg-background flex min-h-[14rem] flex-1 flex-col rounded-md border", children: [
|
|
42
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between border-b px-3 py-2 text-sm", children: [
|
|
43
|
+
/* @__PURE__ */ jsxs("label", { className: "flex cursor-pointer items-center gap-2 font-medium", children: [
|
|
44
|
+
/* @__PURE__ */ jsx(
|
|
45
|
+
Checkbox,
|
|
46
|
+
{
|
|
47
|
+
checked: allChecked ? true : indeterminate ? "indeterminate" : false,
|
|
48
|
+
disabled: Boolean(disabled) || enabledItems.length === 0,
|
|
49
|
+
onCheckedChange: (v) => onSelectAll(v === true),
|
|
50
|
+
"aria-label": direction === "left" ? t("dataEntry.transfer.selectAllSource") : t("dataEntry.transfer.selectAllTarget")
|
|
51
|
+
}
|
|
52
|
+
),
|
|
53
|
+
/* @__PURE__ */ jsx("span", { id: titleId, children: title })
|
|
54
|
+
] }),
|
|
55
|
+
/* @__PURE__ */ jsxs("span", { className: "text-muted-foreground text-xs", children: [
|
|
56
|
+
selectedKeys.length,
|
|
57
|
+
"/",
|
|
58
|
+
filtered.length
|
|
59
|
+
] })
|
|
60
|
+
] }),
|
|
61
|
+
showSearch && /* @__PURE__ */ jsx("div", { className: "border-b p-2", children: /* @__PURE__ */ jsx(
|
|
62
|
+
SearchInput,
|
|
63
|
+
{
|
|
64
|
+
onSearch: setQuery,
|
|
65
|
+
placeholder: searchPlaceholder,
|
|
66
|
+
ariaLabel: searchPlaceholder,
|
|
67
|
+
debounce: 0,
|
|
68
|
+
className: disabled ? "pointer-events-none opacity-50" : void 0
|
|
69
|
+
}
|
|
70
|
+
) }),
|
|
71
|
+
/* @__PURE__ */ jsx(ScrollArea, { className: "flex-1", children: /* @__PURE__ */ jsx("ul", { className: "p-1", role: "group", "aria-labelledby": titleId, children: filtered.length === 0 ? /* @__PURE__ */ jsx("li", { className: "text-muted-foreground py-8 text-center text-sm", children: emptyText }) : filtered.map((item) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
|
|
72
|
+
"label",
|
|
73
|
+
{
|
|
74
|
+
className: cn(
|
|
75
|
+
"flex cursor-pointer items-start gap-2 rounded-sm px-2 py-2 text-sm",
|
|
76
|
+
"hover:bg-accent hover:text-accent-foreground",
|
|
77
|
+
item.disabled && "pointer-events-none opacity-50"
|
|
78
|
+
),
|
|
79
|
+
children: [
|
|
80
|
+
/* @__PURE__ */ jsx(
|
|
81
|
+
Checkbox,
|
|
82
|
+
{
|
|
83
|
+
checked: selectedKeys.includes(item.key),
|
|
84
|
+
disabled: Boolean(disabled) || Boolean(item.disabled),
|
|
85
|
+
onCheckedChange: (v) => toggleKey(item.key, v === true),
|
|
86
|
+
className: "mt-0.5"
|
|
87
|
+
}
|
|
88
|
+
),
|
|
89
|
+
/* @__PURE__ */ jsxs("span", { className: "min-w-0 flex-1", children: [
|
|
90
|
+
/* @__PURE__ */ jsx("span", { className: "block truncate font-medium", children: item.title }),
|
|
91
|
+
item.description && /* @__PURE__ */ jsx("span", { className: "text-muted-foreground block truncate text-xs", children: item.description })
|
|
92
|
+
] })
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
) }, item.key)) }) })
|
|
96
|
+
] });
|
|
97
|
+
}
|
|
98
|
+
function Transfer({
|
|
99
|
+
dataSource,
|
|
100
|
+
targetKeys,
|
|
101
|
+
onValueChange,
|
|
102
|
+
titles,
|
|
103
|
+
showSearch,
|
|
104
|
+
oneWay,
|
|
105
|
+
disabled,
|
|
106
|
+
className,
|
|
107
|
+
selectedKeys: selectedKeysProp,
|
|
108
|
+
onSelectChange
|
|
109
|
+
}) {
|
|
110
|
+
const { t } = useTranslation();
|
|
111
|
+
const [internalSelected, setInternalSelected] = React.useState([[], []]);
|
|
112
|
+
const selected = selectedKeysProp ?? internalSelected;
|
|
113
|
+
const sourceItems = dataSource.filter((item) => !targetKeys.includes(item.key));
|
|
114
|
+
const targetItems = dataSource.filter((item) => targetKeys.includes(item.key));
|
|
115
|
+
const setSelected = (side, keys) => {
|
|
116
|
+
const next = side === 0 ? [keys, selected[1]] : [selected[0], keys];
|
|
117
|
+
if (selectedKeysProp) onSelectChange?.(next[0], next[1]);
|
|
118
|
+
else setInternalSelected(next);
|
|
119
|
+
};
|
|
120
|
+
const move = (direction) => {
|
|
121
|
+
const fromSide = direction === "right" ? 0 : 1;
|
|
122
|
+
const keys = selected[fromSide];
|
|
123
|
+
if (!keys.length) return;
|
|
124
|
+
const nextTarget = direction === "right" ? [...targetKeys, ...keys.filter((k) => !targetKeys.includes(k))] : targetKeys.filter((k) => !keys.includes(k));
|
|
125
|
+
onValueChange?.(nextTarget, direction, keys);
|
|
126
|
+
const cleared = fromSide === 0 ? [[], selected[1]] : [selected[0], []];
|
|
127
|
+
if (selectedKeysProp) onSelectChange?.(cleared[0], cleared[1]);
|
|
128
|
+
else setInternalSelected(cleared);
|
|
129
|
+
};
|
|
130
|
+
const leftTitle = titles?.[0] ?? t("dataEntry.transfer.source");
|
|
131
|
+
const rightTitle = titles?.[1] ?? t("dataEntry.transfer.target");
|
|
132
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-wrap items-stretch gap-3", className), children: [
|
|
133
|
+
/* @__PURE__ */ jsx(
|
|
134
|
+
TransferPanel,
|
|
135
|
+
{
|
|
136
|
+
direction: "left",
|
|
137
|
+
title: leftTitle,
|
|
138
|
+
items: sourceItems,
|
|
139
|
+
selectedKeys: selected[0],
|
|
140
|
+
onSelectChange: (keys) => setSelected(0, keys),
|
|
141
|
+
onSelectAll: (checked) => setSelected(0, checked ? sourceItems.filter((i) => !i.disabled).map((i) => i.key) : []),
|
|
142
|
+
showSearch,
|
|
143
|
+
disabled,
|
|
144
|
+
searchPlaceholder: t("dataEntry.transfer.searchPlaceholder"),
|
|
145
|
+
emptyText: t("dataEntry.transfer.empty")
|
|
146
|
+
}
|
|
147
|
+
),
|
|
148
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col justify-center gap-2", children: [
|
|
149
|
+
/* @__PURE__ */ jsx(
|
|
150
|
+
Button,
|
|
151
|
+
{
|
|
152
|
+
type: "button",
|
|
153
|
+
size: "icon",
|
|
154
|
+
variant: "outline",
|
|
155
|
+
disabled: Boolean(disabled) || selected[0].length === 0,
|
|
156
|
+
"aria-label": t("dataEntry.transfer.moveRight"),
|
|
157
|
+
onClick: () => move("right"),
|
|
158
|
+
children: /* @__PURE__ */ jsx(ChevronRight, { className: "size-4", "aria-hidden": "true" })
|
|
159
|
+
}
|
|
160
|
+
),
|
|
161
|
+
!oneWay && /* @__PURE__ */ jsx(
|
|
162
|
+
Button,
|
|
163
|
+
{
|
|
164
|
+
type: "button",
|
|
165
|
+
size: "icon",
|
|
166
|
+
variant: "outline",
|
|
167
|
+
disabled: Boolean(disabled) || selected[1].length === 0,
|
|
168
|
+
"aria-label": t("dataEntry.transfer.moveLeft"),
|
|
169
|
+
onClick: () => move("left"),
|
|
170
|
+
children: /* @__PURE__ */ jsx(ChevronLeft, { className: "size-4", "aria-hidden": "true" })
|
|
171
|
+
}
|
|
172
|
+
)
|
|
173
|
+
] }),
|
|
174
|
+
/* @__PURE__ */ jsx(
|
|
175
|
+
TransferPanel,
|
|
176
|
+
{
|
|
177
|
+
direction: "right",
|
|
178
|
+
title: rightTitle,
|
|
179
|
+
items: targetItems,
|
|
180
|
+
selectedKeys: selected[1],
|
|
181
|
+
onSelectChange: (keys) => setSelected(1, keys),
|
|
182
|
+
onSelectAll: (checked) => setSelected(1, checked ? targetItems.filter((i) => !i.disabled).map((i) => i.key) : []),
|
|
183
|
+
showSearch,
|
|
184
|
+
disabled,
|
|
185
|
+
searchPlaceholder: t("dataEntry.transfer.searchPlaceholder"),
|
|
186
|
+
emptyText: t("dataEntry.transfer.empty")
|
|
187
|
+
}
|
|
188
|
+
)
|
|
189
|
+
] });
|
|
190
|
+
}
|
|
191
|
+
export {
|
|
192
|
+
Transfer
|
|
193
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Ant Design `showCheckedStrategy` equivalents for TreeSelect. */
|
|
2
|
+
export declare const SHOW_CHILD: "SHOW_CHILD";
|
|
3
|
+
export declare const SHOW_PARENT: "SHOW_PARENT";
|
|
4
|
+
export declare const SHOW_ALL: "SHOW_ALL";
|
|
5
|
+
export type ShowCheckedStrategy = typeof SHOW_CHILD | typeof SHOW_PARENT | typeof SHOW_ALL;
|
|
@@ -1,29 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
import '@radix-ui/react-switch';
|
|
7
|
-
import 'react-day-picker';
|
|
8
|
-
import 'react';
|
|
9
|
-
import '../../shared.prop-BvMSLFJ6.js';
|
|
10
|
-
import '../../content.prop-DrV_zDy-.js';
|
|
11
|
-
import '../../layout.prop-CXvl2rVR.js';
|
|
12
|
-
import '../../interaction.prop-DD46aTro.js';
|
|
13
|
-
import '../../data.prop-D0UEEczj.js';
|
|
14
|
-
import '../../layout.prop-fCz-Vlie.js';
|
|
15
|
-
import '../../navigation.prop-CXDaVNaR.js';
|
|
16
|
-
|
|
17
|
-
/** Ant Design `showCheckedStrategy` equivalents for TreeSelect. */
|
|
18
|
-
declare const SHOW_CHILD: "SHOW_CHILD";
|
|
19
|
-
declare const SHOW_PARENT: "SHOW_PARENT";
|
|
20
|
-
declare const SHOW_ALL: "SHOW_ALL";
|
|
21
|
-
|
|
22
|
-
declare function TreeSelectRoot({ treeData: treeDataProp, value, defaultValue, onValueChange, multiple, treeCheckable, treeCheckStrictly, showSearch, showCheckedStrategy, treeDefaultExpandAll, placeholder, disabled, allowClear, className, id, fieldNames, }: TreeSelectProp): react_jsx_runtime.JSX.Element;
|
|
23
|
-
declare const TreeSelect: typeof TreeSelectRoot & {
|
|
1
|
+
import type { TreeSelectProp } from "../../props/components/data-entry.prop";
|
|
2
|
+
export type { TreeSelectProp, TreeSelectProp as TreeSelectProps, } from "../../props/components/data-entry.prop";
|
|
3
|
+
export { SHOW_CHILD, SHOW_PARENT, SHOW_ALL } from "./tree-select-strategy";
|
|
4
|
+
declare function TreeSelectRoot({ treeData: treeDataProp, value, defaultValue, onValueChange, multiple, treeCheckable, treeCheckStrictly, showSearch, showCheckedStrategy, treeDefaultExpandAll, placeholder, disabled, allowClear, className, id, fieldNames, }: TreeSelectProp): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare const TreeSelect: typeof TreeSelectRoot & {
|
|
24
6
|
SHOW_CHILD: "SHOW_CHILD";
|
|
25
7
|
SHOW_PARENT: "SHOW_PARENT";
|
|
26
8
|
SHOW_ALL: "SHOW_ALL";
|
|
27
9
|
};
|
|
28
|
-
|
|
29
|
-
export { SHOW_ALL, SHOW_CHILD, SHOW_PARENT, TreeSelect, TreeSelectProp, TreeSelectProp as TreeSelectProps };
|
|
@@ -1,13 +1,299 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { ChevronDown, ChevronRight, ChevronsUpDown, X } from "lucide-react";
|
|
4
|
+
import { useTranslation } from "../../i18n/use-translation";
|
|
5
|
+
import { cn } from "../../lib/utils";
|
|
6
|
+
import { controlOpenRingClass } from "../../lib/control-styles";
|
|
7
|
+
import { Button } from "../general/button";
|
|
8
|
+
import { Popover, PopoverContent, PopoverTrigger } from "../data-display/popover";
|
|
9
|
+
import { ScrollArea } from "../data-display/scroll-area";
|
|
10
|
+
import { Checkbox } from "./checkbox";
|
|
11
|
+
import { Command, CommandInput } from "./command";
|
|
12
|
+
import {
|
|
13
|
+
collectAllExpandableKeys,
|
|
14
|
+
filterVisibleTree,
|
|
15
|
+
findNodeByValue,
|
|
16
|
+
flattenVisibleTree,
|
|
17
|
+
getDescendantValues,
|
|
18
|
+
normalizeTreeOptions,
|
|
19
|
+
reactNodeText
|
|
20
|
+
} from "./tree-utils";
|
|
21
|
+
import { SHOW_CHILD, SHOW_PARENT, SHOW_ALL } from "./tree-select-strategy";
|
|
22
|
+
import { SHOW_CHILD as SHOW_CHILD2, SHOW_PARENT as SHOW_PARENT2, SHOW_ALL as SHOW_ALL2 } from "./tree-select-strategy";
|
|
23
|
+
function toArray(value) {
|
|
24
|
+
if (value == null) return [];
|
|
25
|
+
return Array.isArray(value) ? value : [value];
|
|
26
|
+
}
|
|
27
|
+
function displayValues(values, options, showCheckedStrategy, treeCheckStrictly) {
|
|
28
|
+
if (treeCheckStrictly || showCheckedStrategy === SHOW_ALL2) return values;
|
|
29
|
+
if (showCheckedStrategy === SHOW_PARENT2) {
|
|
30
|
+
const filtered = values.filter((v) => {
|
|
31
|
+
const node = findNodeByValue(options, v);
|
|
32
|
+
if (!node?.children?.length) return true;
|
|
33
|
+
const desc = getDescendantValues(node).slice(1);
|
|
34
|
+
return !desc.every((d) => values.includes(d));
|
|
35
|
+
});
|
|
36
|
+
return filtered.length ? filtered : values;
|
|
37
|
+
}
|
|
38
|
+
return values.filter((v) => {
|
|
39
|
+
const node = findNodeByValue(options, v);
|
|
40
|
+
return !node?.children?.length;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function TreeSelectRoot({
|
|
44
|
+
treeData: treeDataProp,
|
|
45
|
+
value,
|
|
46
|
+
defaultValue,
|
|
47
|
+
onValueChange,
|
|
48
|
+
multiple,
|
|
49
|
+
treeCheckable,
|
|
50
|
+
treeCheckStrictly,
|
|
51
|
+
showSearch,
|
|
52
|
+
showCheckedStrategy = SHOW_CHILD2,
|
|
53
|
+
treeDefaultExpandAll,
|
|
54
|
+
placeholder,
|
|
55
|
+
disabled,
|
|
56
|
+
allowClear = true,
|
|
57
|
+
className,
|
|
58
|
+
id,
|
|
59
|
+
fieldNames
|
|
60
|
+
}) {
|
|
61
|
+
const { t } = useTranslation();
|
|
62
|
+
const options = React.useMemo(
|
|
63
|
+
() => normalizeTreeOptions(treeDataProp, fieldNames),
|
|
64
|
+
[treeDataProp, fieldNames]
|
|
65
|
+
);
|
|
66
|
+
const checkable = treeCheckable ?? multiple;
|
|
67
|
+
const [open, setOpen] = React.useState(false);
|
|
68
|
+
const [search, setSearch] = React.useState("");
|
|
69
|
+
const [expandedKeys, setExpandedKeys] = React.useState(
|
|
70
|
+
() => new Set(treeDefaultExpandAll ? collectAllExpandableKeys(options) : [])
|
|
71
|
+
);
|
|
72
|
+
const isControlled = value !== void 0;
|
|
73
|
+
const [internal, setInternal] = React.useState(() => toArray(defaultValue));
|
|
74
|
+
const [activeKey, setActiveKey] = React.useState(null);
|
|
75
|
+
const treeItemRefs = React.useRef(/* @__PURE__ */ new Map());
|
|
76
|
+
const selected = isControlled ? toArray(value) : internal;
|
|
77
|
+
const resolvedPlaceholder = placeholder ?? t("dataEntry.treeSelect.placeholder");
|
|
78
|
+
const visible = React.useMemo(() => {
|
|
79
|
+
if (showSearch && search.trim()) return filterVisibleTree(options, search);
|
|
80
|
+
return flattenVisibleTree(options, expandedKeys);
|
|
81
|
+
}, [options, expandedKeys, search, showSearch]);
|
|
82
|
+
const commit = (next) => {
|
|
83
|
+
if (!isControlled) setInternal(next);
|
|
84
|
+
onValueChange?.(checkable || multiple ? next : next[0] ?? void 0);
|
|
85
|
+
};
|
|
86
|
+
const toggleExpand = (key) => {
|
|
87
|
+
setExpandedKeys((prev) => {
|
|
88
|
+
const next = new Set(prev);
|
|
89
|
+
if (next.has(key)) next.delete(key);
|
|
90
|
+
else next.add(key);
|
|
91
|
+
return next;
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
const toggleSelect = (node) => {
|
|
95
|
+
if (node.disabled) return;
|
|
96
|
+
const key = node.value;
|
|
97
|
+
if (!checkable && !multiple) {
|
|
98
|
+
commit([key]);
|
|
99
|
+
setOpen(false);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
const isOn = selected.includes(key);
|
|
103
|
+
let next;
|
|
104
|
+
if (treeCheckStrictly) {
|
|
105
|
+
next = isOn ? selected.filter((v) => v !== key) : [...selected, key];
|
|
106
|
+
} else {
|
|
107
|
+
const related = getDescendantValues(node);
|
|
108
|
+
next = isOn ? selected.filter((v) => !related.includes(v)) : [.../* @__PURE__ */ new Set([...selected, ...related])];
|
|
109
|
+
}
|
|
110
|
+
commit(next);
|
|
111
|
+
};
|
|
112
|
+
const displayKeys = displayValues(selected, options, showCheckedStrategy, treeCheckStrictly);
|
|
113
|
+
const displayLabel = displayKeys.map((v) => {
|
|
114
|
+
const label = findNodeByValue(options, v)?.label;
|
|
115
|
+
return label ? reactNodeText(label) : v;
|
|
116
|
+
}).join(", ");
|
|
117
|
+
const clearValue = (e) => {
|
|
118
|
+
e.stopPropagation();
|
|
119
|
+
commit([]);
|
|
120
|
+
};
|
|
121
|
+
const rovingKey = (activeKey && visible.some(({ node }) => node.value === activeKey) ? activeKey : null) ?? visible[0]?.node.value ?? null;
|
|
122
|
+
React.useEffect(() => {
|
|
123
|
+
if (!open || !activeKey) return;
|
|
124
|
+
treeItemRefs.current.get(activeKey)?.focus();
|
|
125
|
+
}, [activeKey, open, visible]);
|
|
126
|
+
const focusByOffset = (currentValue, delta) => {
|
|
127
|
+
const index = visible.findIndex(({ node }) => node.value === currentValue);
|
|
128
|
+
if (index === -1) return;
|
|
129
|
+
const next = visible[index + delta];
|
|
130
|
+
if (next) setActiveKey(next.node.value);
|
|
131
|
+
};
|
|
132
|
+
const onTreeItemKeyDown = (event, node, hasChildren, expanded) => {
|
|
133
|
+
switch (event.key) {
|
|
134
|
+
case "ArrowDown": {
|
|
135
|
+
event.preventDefault();
|
|
136
|
+
focusByOffset(node.value, 1);
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
case "ArrowUp": {
|
|
140
|
+
event.preventDefault();
|
|
141
|
+
focusByOffset(node.value, -1);
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
case "ArrowRight": {
|
|
145
|
+
event.preventDefault();
|
|
146
|
+
if (hasChildren && !expanded) {
|
|
147
|
+
toggleExpand(node.value);
|
|
148
|
+
} else if (hasChildren && expanded) {
|
|
149
|
+
focusByOffset(node.value, 1);
|
|
150
|
+
}
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
case "ArrowLeft": {
|
|
154
|
+
event.preventDefault();
|
|
155
|
+
if (hasChildren && expanded) {
|
|
156
|
+
toggleExpand(node.value);
|
|
157
|
+
}
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
case "Enter":
|
|
161
|
+
case " ": {
|
|
162
|
+
event.preventDefault();
|
|
163
|
+
toggleSelect(node);
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
default:
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
|
|
171
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
172
|
+
Button,
|
|
173
|
+
{
|
|
174
|
+
id,
|
|
175
|
+
type: "button",
|
|
176
|
+
variant: "outline",
|
|
177
|
+
role: "combobox",
|
|
178
|
+
"aria-expanded": open,
|
|
179
|
+
disabled,
|
|
180
|
+
className: cn(
|
|
181
|
+
"w-full justify-between font-normal",
|
|
182
|
+
controlOpenRingClass,
|
|
183
|
+
!displayKeys.length && "text-muted-foreground",
|
|
184
|
+
className
|
|
185
|
+
),
|
|
186
|
+
children: [
|
|
187
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: displayKeys.length ? displayLabel : resolvedPlaceholder }),
|
|
188
|
+
/* @__PURE__ */ jsxs("span", { className: "ms-2 flex shrink-0 items-center gap-1", children: [
|
|
189
|
+
allowClear && displayKeys.length > 0 && !disabled && /* @__PURE__ */ jsx(
|
|
190
|
+
"button",
|
|
191
|
+
{
|
|
192
|
+
type: "button",
|
|
193
|
+
"aria-label": t("dataEntry.treeSelect.clear"),
|
|
194
|
+
className: "flex size-4 items-center justify-center rounded-sm opacity-50 hover:opacity-100 focus-visible:opacity-100",
|
|
195
|
+
onClick: clearValue,
|
|
196
|
+
children: /* @__PURE__ */ jsx(X, { className: "size-4", "aria-hidden": "true" })
|
|
197
|
+
}
|
|
198
|
+
),
|
|
199
|
+
/* @__PURE__ */ jsx(ChevronsUpDown, { className: "size-4 opacity-50", "aria-hidden": "true" })
|
|
200
|
+
] })
|
|
201
|
+
]
|
|
202
|
+
}
|
|
203
|
+
) }),
|
|
204
|
+
/* @__PURE__ */ jsxs(PopoverContent, { className: "w-[var(--radix-popover-trigger-width)] p-0", align: "start", children: [
|
|
205
|
+
showSearch && /* @__PURE__ */ jsx("div", { className: "border-b p-2", children: /* @__PURE__ */ jsx(Command, { shouldFilter: false, children: /* @__PURE__ */ jsx(
|
|
206
|
+
CommandInput,
|
|
207
|
+
{
|
|
208
|
+
placeholder: t("dataEntry.treeSelect.searchPlaceholder"),
|
|
209
|
+
value: search,
|
|
210
|
+
onValueChange: setSearch
|
|
211
|
+
}
|
|
212
|
+
) }) }),
|
|
213
|
+
/* @__PURE__ */ jsx(ScrollArea, { className: "max-h-[min(300px,50vh)]", children: /* @__PURE__ */ jsx(
|
|
214
|
+
"div",
|
|
215
|
+
{
|
|
216
|
+
role: "tree",
|
|
217
|
+
"aria-multiselectable": Boolean(checkable) || Boolean(multiple),
|
|
218
|
+
className: "p-1",
|
|
219
|
+
children: visible.length === 0 ? /* @__PURE__ */ jsx("p", { className: "text-muted-foreground py-6 text-center text-sm", children: t("dataEntry.treeSelect.empty") }) : visible.map(({ node, depth, hasChildren }) => {
|
|
220
|
+
const expanded = expandedKeys.has(node.value);
|
|
221
|
+
const isSelected = selected.includes(node.value);
|
|
222
|
+
return /* @__PURE__ */ jsxs(
|
|
223
|
+
"div",
|
|
224
|
+
{
|
|
225
|
+
ref: (el) => {
|
|
226
|
+
treeItemRefs.current.set(node.value, el);
|
|
227
|
+
},
|
|
228
|
+
role: "treeitem",
|
|
229
|
+
tabIndex: node.disabled ? -1 : rovingKey === node.value ? 0 : -1,
|
|
230
|
+
"aria-expanded": hasChildren ? expanded : void 0,
|
|
231
|
+
"aria-selected": isSelected,
|
|
232
|
+
onFocus: () => setActiveKey(node.value),
|
|
233
|
+
onKeyDown: (event) => onTreeItemKeyDown(event, node, hasChildren, expanded),
|
|
234
|
+
className: cn(
|
|
235
|
+
"flex items-center rounded-sm py-1.5 pe-2 text-sm outline-none",
|
|
236
|
+
"hover:bg-accent hover:text-accent-foreground",
|
|
237
|
+
"focus-visible:ring-ring focus-visible:ring-2 focus-visible:ring-offset-1",
|
|
238
|
+
isSelected && "bg-accent/60",
|
|
239
|
+
node.disabled && "pointer-events-none opacity-50"
|
|
240
|
+
),
|
|
241
|
+
style: { paddingInlineStart: `${depth * 1.25 + 0.5}rem` },
|
|
242
|
+
children: [
|
|
243
|
+
/* @__PURE__ */ jsx(
|
|
244
|
+
"button",
|
|
245
|
+
{
|
|
246
|
+
type: "button",
|
|
247
|
+
tabIndex: -1,
|
|
248
|
+
"aria-label": expanded ? t("dataEntry.treeSelect.collapse") : t("dataEntry.treeSelect.expand"),
|
|
249
|
+
className: cn(
|
|
250
|
+
"me-1 flex size-5 shrink-0 items-center justify-center rounded-sm",
|
|
251
|
+
!hasChildren && "invisible"
|
|
252
|
+
),
|
|
253
|
+
onClick: () => toggleExpand(node.value),
|
|
254
|
+
children: expanded ? /* @__PURE__ */ jsx(ChevronDown, { className: "size-4", "aria-hidden": "true" }) : /* @__PURE__ */ jsx(ChevronRight, { className: "size-4", "aria-hidden": "true" })
|
|
255
|
+
}
|
|
256
|
+
),
|
|
257
|
+
checkable ? /* @__PURE__ */ jsxs("label", { className: "flex flex-1 cursor-pointer items-center gap-2", children: [
|
|
258
|
+
/* @__PURE__ */ jsx(
|
|
259
|
+
Checkbox,
|
|
260
|
+
{
|
|
261
|
+
checked: isSelected,
|
|
262
|
+
tabIndex: -1,
|
|
263
|
+
disabled: Boolean(node.disabled) || Boolean(node.disableCheckbox),
|
|
264
|
+
onCheckedChange: () => toggleSelect(node)
|
|
265
|
+
}
|
|
266
|
+
),
|
|
267
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: node.label })
|
|
268
|
+
] }) : /* @__PURE__ */ jsx(
|
|
269
|
+
"button",
|
|
270
|
+
{
|
|
271
|
+
type: "button",
|
|
272
|
+
tabIndex: -1,
|
|
273
|
+
className: "flex-1 truncate text-start",
|
|
274
|
+
disabled: node.disabled,
|
|
275
|
+
onClick: () => toggleSelect(node),
|
|
276
|
+
children: node.label
|
|
277
|
+
}
|
|
278
|
+
)
|
|
279
|
+
]
|
|
280
|
+
},
|
|
281
|
+
node.value
|
|
282
|
+
);
|
|
283
|
+
})
|
|
284
|
+
}
|
|
285
|
+
) })
|
|
286
|
+
] })
|
|
287
|
+
] });
|
|
288
|
+
}
|
|
289
|
+
const TreeSelect = Object.assign(TreeSelectRoot, {
|
|
290
|
+
SHOW_CHILD: SHOW_CHILD2,
|
|
291
|
+
SHOW_PARENT: SHOW_PARENT2,
|
|
292
|
+
SHOW_ALL: SHOW_ALL2
|
|
293
|
+
});
|
|
294
|
+
export {
|
|
295
|
+
SHOW_ALL,
|
|
296
|
+
SHOW_CHILD,
|
|
297
|
+
SHOW_PARENT,
|
|
298
|
+
TreeSelect
|
|
299
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
/** Normalized tree node — Ant Design `treeData` / Cascader `options`. */
|
|
3
|
+
export type TreeOption = {
|
|
4
|
+
value: string;
|
|
5
|
+
label: React.ReactNode;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
disableCheckbox?: boolean;
|
|
8
|
+
/** When false with `loadData`, shows expand affordance */
|
|
9
|
+
isLeaf?: boolean;
|
|
10
|
+
children?: TreeOption[];
|
|
11
|
+
};
|
|
12
|
+
export type TreeFieldNames = {
|
|
13
|
+
label?: string;
|
|
14
|
+
value?: string;
|
|
15
|
+
children?: string;
|
|
16
|
+
};
|
|
17
|
+
export type NormalizedTreeOption = TreeOption & {
|
|
18
|
+
children?: NormalizedTreeOption[];
|
|
19
|
+
};
|
|
20
|
+
type RawTreeNode = Record<string, unknown>;
|
|
21
|
+
export declare function reactNodeText(value: React.ReactNode): string;
|
|
22
|
+
export declare function normalizeTreeOptions(nodes: RawTreeNode[] | undefined, fieldNames?: TreeFieldNames): NormalizedTreeOption[];
|
|
23
|
+
export declare function getNodeByPath(options: NormalizedTreeOption[], path: string[]): NormalizedTreeOption[];
|
|
24
|
+
export declare function getOptionsAtPath(options: NormalizedTreeOption[], path: string[]): NormalizedTreeOption[];
|
|
25
|
+
export declare function formatPathLabels(chain: NormalizedTreeOption[], separator?: string): string;
|
|
26
|
+
export type TreePath = {
|
|
27
|
+
path: string[];
|
|
28
|
+
labels: string[];
|
|
29
|
+
};
|
|
30
|
+
export declare function collectLeafPaths(options: NormalizedTreeOption[], prefix?: string[], root?: NormalizedTreeOption[]): TreePath[];
|
|
31
|
+
export declare function collectAllPaths(options: NormalizedTreeOption[], prefix?: string[], root?: NormalizedTreeOption[]): TreePath[];
|
|
32
|
+
export declare function pathKey(path: string[]): string;
|
|
33
|
+
export declare function pathsEqual(a: string[], b: string[]): boolean;
|
|
34
|
+
export declare function filterTreeOptions(options: NormalizedTreeOption[], query: string, filter?: (query: string, path: NormalizedTreeOption[]) => boolean): TreePath[];
|
|
35
|
+
export declare function getDescendantValues(node: NormalizedTreeOption): string[];
|
|
36
|
+
export declare function flattenVisibleTree(options: NormalizedTreeOption[], expandedKeys: Set<string>, depth?: number): {
|
|
37
|
+
node: NormalizedTreeOption;
|
|
38
|
+
depth: number;
|
|
39
|
+
hasChildren: boolean;
|
|
40
|
+
}[];
|
|
41
|
+
export declare function filterVisibleTree(options: NormalizedTreeOption[], query: string): {
|
|
42
|
+
node: NormalizedTreeOption;
|
|
43
|
+
depth: number;
|
|
44
|
+
hasChildren: boolean;
|
|
45
|
+
}[];
|
|
46
|
+
export declare function collectAllExpandableKeys(options: NormalizedTreeOption[]): string[];
|
|
47
|
+
export declare function findNodeByValue(options: NormalizedTreeOption[], value: string): NormalizedTreeOption | undefined;
|
|
48
|
+
export {};
|