@godxjp/ui 13.9.3 → 13.10.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/{chunk-NVTZ2EDW.js → components/data-display/data-table.js} +28 -36
- 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 +38 -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/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-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
|
@@ -1,4 +1,98 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { X } from "lucide-react";
|
|
4
|
+
import { useTranslation } from "../../i18n/use-translation";
|
|
5
|
+
import { cn } from "../../lib/utils";
|
|
6
|
+
const inputBaseClass = [
|
|
7
|
+
"ui-control border-input bg-background w-full min-w-0 rounded-md border px-3 py-1 text-sm shadow-xs transition-[color,box-shadow] outline-none",
|
|
8
|
+
"selection:bg-primary selection:text-primary-foreground",
|
|
9
|
+
"file:text-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium",
|
|
10
|
+
"placeholder:text-muted-foreground",
|
|
11
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
12
|
+
"disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
13
|
+
"aria-invalid:border-destructive aria-invalid:ring-destructive/20"
|
|
14
|
+
];
|
|
15
|
+
const Input = React.forwardRef(
|
|
16
|
+
({ className, type, allowClear = false, onClear, value, defaultValue, onChange, ...props }, ref) => {
|
|
17
|
+
const { t } = useTranslation();
|
|
18
|
+
const innerRef = React.useRef(null);
|
|
19
|
+
const setRefs = React.useCallback(
|
|
20
|
+
(node) => {
|
|
21
|
+
innerRef.current = node;
|
|
22
|
+
if (typeof ref === "function") ref(node);
|
|
23
|
+
else if (ref) ref.current = node;
|
|
24
|
+
},
|
|
25
|
+
[ref]
|
|
26
|
+
);
|
|
27
|
+
const [hasText, setHasText] = React.useState(
|
|
28
|
+
() => String(value ?? defaultValue ?? "").length > 0
|
|
29
|
+
);
|
|
30
|
+
React.useEffect(() => {
|
|
31
|
+
if (value !== void 0) setHasText(String(value).length > 0);
|
|
32
|
+
}, [value]);
|
|
33
|
+
const handleChange = (event) => {
|
|
34
|
+
if (value === void 0) setHasText(event.target.value.length > 0);
|
|
35
|
+
onChange?.(event);
|
|
36
|
+
};
|
|
37
|
+
const clear = () => {
|
|
38
|
+
const el = innerRef.current;
|
|
39
|
+
if (el) {
|
|
40
|
+
const setter = Object.getOwnPropertyDescriptor(
|
|
41
|
+
window.HTMLInputElement.prototype,
|
|
42
|
+
"value"
|
|
43
|
+
)?.set;
|
|
44
|
+
setter?.call(el, "");
|
|
45
|
+
el.dispatchEvent(new Event("input", { bubbles: true }));
|
|
46
|
+
el.focus();
|
|
47
|
+
}
|
|
48
|
+
setHasText(false);
|
|
49
|
+
onClear?.();
|
|
50
|
+
};
|
|
51
|
+
if (!allowClear) {
|
|
52
|
+
return /* @__PURE__ */ jsx(
|
|
53
|
+
"input",
|
|
54
|
+
{
|
|
55
|
+
type,
|
|
56
|
+
"data-slot": "input",
|
|
57
|
+
ref: setRefs,
|
|
58
|
+
value,
|
|
59
|
+
defaultValue,
|
|
60
|
+
onChange,
|
|
61
|
+
className: cn(inputBaseClass, className),
|
|
62
|
+
...props
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
const showClear = hasText && !props.disabled && !props.readOnly;
|
|
67
|
+
return /* @__PURE__ */ jsxs("span", { "data-slot": "input-affix-wrapper", className: "relative inline-flex w-full items-center", children: [
|
|
68
|
+
/* @__PURE__ */ jsx(
|
|
69
|
+
"input",
|
|
70
|
+
{
|
|
71
|
+
type,
|
|
72
|
+
"data-slot": "input",
|
|
73
|
+
ref: setRefs,
|
|
74
|
+
value,
|
|
75
|
+
defaultValue,
|
|
76
|
+
onChange: handleChange,
|
|
77
|
+
className: cn(inputBaseClass, showClear && "pe-9", className),
|
|
78
|
+
...props
|
|
79
|
+
}
|
|
80
|
+
),
|
|
81
|
+
showClear ? /* @__PURE__ */ jsx(
|
|
82
|
+
"button",
|
|
83
|
+
{
|
|
84
|
+
type: "button",
|
|
85
|
+
tabIndex: -1,
|
|
86
|
+
"aria-label": t("common.clear") ?? "Clear",
|
|
87
|
+
onClick: clear,
|
|
88
|
+
className: "text-muted-foreground hover:text-foreground absolute end-2 inline-flex size-5 items-center justify-center rounded-sm opacity-70 transition-opacity hover:opacity-100 focus-visible:opacity-100",
|
|
89
|
+
children: /* @__PURE__ */ jsx(X, { className: "size-4", "aria-hidden": "true" })
|
|
90
|
+
}
|
|
91
|
+
) : null
|
|
92
|
+
] });
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
Input.displayName = "Input";
|
|
96
|
+
export {
|
|
97
|
+
Input
|
|
98
|
+
};
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
declare const Label: React.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & VariantProps<(props?: class_variance_authority_types.ClassProp | undefined) => string> & React.RefAttributes<HTMLLabelElement>>;
|
|
7
|
-
|
|
8
|
-
export { Label };
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
3
|
+
import { type VariantProps } from "class-variance-authority";
|
|
4
|
+
export declare const Label: React.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & VariantProps<(props?: import("class-variance-authority/types").ClassProp | undefined) => string> & React.RefAttributes<HTMLLabelElement>>;
|
|
@@ -1,2 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { cn } from "../../lib/utils";
|
|
6
|
+
const labelVariants = cva(
|
|
7
|
+
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
8
|
+
);
|
|
9
|
+
const Label = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
10
|
+
LabelPrimitive.Root,
|
|
11
|
+
{
|
|
12
|
+
ref,
|
|
13
|
+
"data-slot": "label",
|
|
14
|
+
className: cn(
|
|
15
|
+
"flex items-center gap-2 select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50",
|
|
16
|
+
labelVariants(),
|
|
17
|
+
className
|
|
18
|
+
),
|
|
19
|
+
...props
|
|
20
|
+
}
|
|
21
|
+
));
|
|
22
|
+
Label.displayName = LabelPrimitive.Root.displayName;
|
|
23
|
+
export {
|
|
24
|
+
Label
|
|
25
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { MonthPickerProp } from "../../props/components/data-entry.prop";
|
|
2
|
+
export type { MonthPickerProp, MonthPickerProp as MonthPickerProps, } from "../../props/components/data-entry.prop";
|
|
3
|
+
/**
|
|
4
|
+
* MonthPicker — year/month (`yyyy/MM`) input with an Ant-Design-style month grid
|
|
5
|
+
* popover: a year header with chevrons over a 3×4 grid of the twelve months.
|
|
6
|
+
* The field stays a real, typeable input (form-submittable via `name` as
|
|
7
|
+
* `yyyy-MM`); the grid is the visual affordance.
|
|
8
|
+
*/
|
|
9
|
+
export declare function MonthPicker({ value: valueProp, defaultValue, onValueChange, placeholder, disabled, className, id, name, fromYear, toYear, allowClear, }: MonthPickerProp): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { CalendarIcon, ChevronLeft, ChevronRight, X } from "lucide-react";
|
|
4
|
+
import { usePickerLocales, useTranslation } from "../../i18n/use-translation";
|
|
5
|
+
import { cn } from "../../lib/utils";
|
|
6
|
+
import { Button } from "../general/button";
|
|
7
|
+
import { Popover, PopoverAnchor, PopoverContent, PopoverTrigger } from "../data-display/popover";
|
|
8
|
+
const YM_HINT = "yyyy/mm";
|
|
9
|
+
const toYmText = (d) => d ? `${d.getFullYear()}/${String(d.getMonth() + 1).padStart(2, "0")}` : "";
|
|
10
|
+
const parseYm = (raw) => {
|
|
11
|
+
const m = /^(\d{4})[/-](\d{1,2})$/.exec(raw.trim());
|
|
12
|
+
if (!m) return void 0;
|
|
13
|
+
const month = Number(m[2]);
|
|
14
|
+
if (month < 1 || month > 12) return void 0;
|
|
15
|
+
return new Date(Number(m[1]), month - 1, 1);
|
|
16
|
+
};
|
|
17
|
+
function MonthPicker({
|
|
18
|
+
value: valueProp,
|
|
19
|
+
defaultValue,
|
|
20
|
+
onValueChange,
|
|
21
|
+
placeholder,
|
|
22
|
+
disabled,
|
|
23
|
+
className,
|
|
24
|
+
id,
|
|
25
|
+
name,
|
|
26
|
+
fromYear,
|
|
27
|
+
toYear,
|
|
28
|
+
allowClear = true
|
|
29
|
+
}) {
|
|
30
|
+
const { t } = useTranslation();
|
|
31
|
+
const { locale } = usePickerLocales();
|
|
32
|
+
const [open, setOpen] = React.useState(false);
|
|
33
|
+
const autoId = React.useId();
|
|
34
|
+
const inputId = id ?? autoId;
|
|
35
|
+
const isControlled = React.useRef(valueProp !== void 0).current;
|
|
36
|
+
const [internalValue, setInternalValue] = React.useState(defaultValue);
|
|
37
|
+
const value = isControlled ? valueProp : internalValue;
|
|
38
|
+
const [text, setText] = React.useState(() => toYmText(value));
|
|
39
|
+
const [viewYear, setViewYear] = React.useState(() => (value ?? /* @__PURE__ */ new Date()).getFullYear());
|
|
40
|
+
React.useEffect(() => {
|
|
41
|
+
setText(toYmText(value));
|
|
42
|
+
if (value) setViewYear(value.getFullYear());
|
|
43
|
+
}, [value]);
|
|
44
|
+
const monthLabels = React.useMemo(() => {
|
|
45
|
+
const fmt = new Intl.DateTimeFormat(locale, { month: "short" });
|
|
46
|
+
return Array.from({ length: 12 }, (_, i) => fmt.format(new Date(2026, i, 1)));
|
|
47
|
+
}, [locale]);
|
|
48
|
+
const emit = (next) => {
|
|
49
|
+
if (!isControlled) setInternalValue(next);
|
|
50
|
+
onValueChange?.(next);
|
|
51
|
+
};
|
|
52
|
+
const showClear = allowClear && Boolean(value) && !disabled;
|
|
53
|
+
const prevDisabled = fromYear !== void 0 && viewYear <= fromYear;
|
|
54
|
+
const nextDisabled = toYear !== void 0 && viewYear >= toYear;
|
|
55
|
+
return /* @__PURE__ */ jsx(Popover, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsx(PopoverAnchor, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
56
|
+
"div",
|
|
57
|
+
{
|
|
58
|
+
className: cn(
|
|
59
|
+
"ui-control border-input bg-background flex w-full min-w-0 items-center gap-2 rounded-md border px-3 shadow-xs transition-[color,box-shadow] outline-none",
|
|
60
|
+
"focus-within:border-ring focus-within:ring-ring/50 focus-within:ring-[3px]",
|
|
61
|
+
open && "border-ring ring-ring/50 ring-[3px]",
|
|
62
|
+
disabled && "pointer-events-none cursor-not-allowed opacity-50",
|
|
63
|
+
className
|
|
64
|
+
),
|
|
65
|
+
onClick: () => {
|
|
66
|
+
if (!disabled) setOpen(true);
|
|
67
|
+
},
|
|
68
|
+
children: [
|
|
69
|
+
/* @__PURE__ */ jsx(
|
|
70
|
+
"input",
|
|
71
|
+
{
|
|
72
|
+
id: inputId,
|
|
73
|
+
name,
|
|
74
|
+
value: text,
|
|
75
|
+
disabled,
|
|
76
|
+
placeholder: placeholder ?? t("dataEntry.monthPicker.placeholder") ?? YM_HINT,
|
|
77
|
+
inputMode: "numeric",
|
|
78
|
+
autoComplete: "off",
|
|
79
|
+
className: "placeholder:text-muted-foreground min-w-0 flex-1 bg-transparent tabular-nums outline-none disabled:cursor-not-allowed",
|
|
80
|
+
onKeyDown: (event) => {
|
|
81
|
+
if (event.key === "ArrowDown") {
|
|
82
|
+
event.preventDefault();
|
|
83
|
+
setOpen(true);
|
|
84
|
+
} else if (event.key === "Escape" && open) {
|
|
85
|
+
setOpen(false);
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
onChange: (event) => {
|
|
89
|
+
setText(event.target.value);
|
|
90
|
+
const parsed = parseYm(event.target.value);
|
|
91
|
+
if (parsed) emit(parsed);
|
|
92
|
+
else if (event.target.value.trim() === "") emit(void 0);
|
|
93
|
+
},
|
|
94
|
+
onBlur: () => setText(toYmText(value))
|
|
95
|
+
}
|
|
96
|
+
),
|
|
97
|
+
showClear ? /* @__PURE__ */ jsx(
|
|
98
|
+
"button",
|
|
99
|
+
{
|
|
100
|
+
type: "button",
|
|
101
|
+
tabIndex: -1,
|
|
102
|
+
"aria-label": t("common.clear") ?? "Clear",
|
|
103
|
+
className: "text-muted-foreground hover:text-foreground shrink-0",
|
|
104
|
+
onClick: (event) => {
|
|
105
|
+
event.stopPropagation();
|
|
106
|
+
emit(void 0);
|
|
107
|
+
setText("");
|
|
108
|
+
},
|
|
109
|
+
children: /* @__PURE__ */ jsx(X, { className: "size-4 shrink-0", "aria-hidden": "true" })
|
|
110
|
+
}
|
|
111
|
+
) : null,
|
|
112
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
113
|
+
"button",
|
|
114
|
+
{
|
|
115
|
+
type: "button",
|
|
116
|
+
disabled,
|
|
117
|
+
tabIndex: -1,
|
|
118
|
+
"aria-label": t("dataEntry.monthPicker.openGrid") ?? "Open month grid",
|
|
119
|
+
className: "text-muted-foreground hover:text-foreground shrink-0",
|
|
120
|
+
children: /* @__PURE__ */ jsx(CalendarIcon, { className: "size-4 shrink-0", "aria-hidden": "true" })
|
|
121
|
+
}
|
|
122
|
+
) }),
|
|
123
|
+
/* @__PURE__ */ jsxs(
|
|
124
|
+
PopoverContent,
|
|
125
|
+
{
|
|
126
|
+
className: "w-auto p-3",
|
|
127
|
+
align: "start",
|
|
128
|
+
onOpenAutoFocus: (event) => event.preventDefault(),
|
|
129
|
+
onClick: (event) => event.stopPropagation(),
|
|
130
|
+
children: [
|
|
131
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
132
|
+
/* @__PURE__ */ jsx(
|
|
133
|
+
Button,
|
|
134
|
+
{
|
|
135
|
+
type: "button",
|
|
136
|
+
variant: "outline",
|
|
137
|
+
size: "icon-sm",
|
|
138
|
+
disabled: prevDisabled,
|
|
139
|
+
"aria-label": t("dataEntry.monthPicker.previousYear") ?? "Previous year",
|
|
140
|
+
className: "bg-transparent opacity-70 hover:opacity-100",
|
|
141
|
+
onClick: () => setViewYear((y) => y - 1),
|
|
142
|
+
children: /* @__PURE__ */ jsx(ChevronLeft, { className: "size-4", "aria-hidden": "true" })
|
|
143
|
+
}
|
|
144
|
+
),
|
|
145
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium", "aria-live": "polite", children: viewYear }),
|
|
146
|
+
/* @__PURE__ */ jsx(
|
|
147
|
+
Button,
|
|
148
|
+
{
|
|
149
|
+
type: "button",
|
|
150
|
+
variant: "outline",
|
|
151
|
+
size: "icon-sm",
|
|
152
|
+
disabled: nextDisabled,
|
|
153
|
+
"aria-label": t("dataEntry.monthPicker.nextYear") ?? "Next year",
|
|
154
|
+
className: "bg-transparent opacity-70 hover:opacity-100",
|
|
155
|
+
onClick: () => setViewYear((y) => y + 1),
|
|
156
|
+
children: /* @__PURE__ */ jsx(ChevronRight, { className: "size-4", "aria-hidden": "true" })
|
|
157
|
+
}
|
|
158
|
+
)
|
|
159
|
+
] }),
|
|
160
|
+
/* @__PURE__ */ jsx("div", { role: "grid", "aria-label": String(viewYear), className: "mt-3 grid grid-cols-3 gap-1", children: monthLabels.map((label, i) => {
|
|
161
|
+
const selected = value?.getFullYear() === viewYear && value?.getMonth() === i;
|
|
162
|
+
return /* @__PURE__ */ jsx(
|
|
163
|
+
Button,
|
|
164
|
+
{
|
|
165
|
+
type: "button",
|
|
166
|
+
variant: selected ? "default" : "ghost",
|
|
167
|
+
size: "sm",
|
|
168
|
+
"aria-pressed": selected,
|
|
169
|
+
className: "px-4 font-normal",
|
|
170
|
+
onClick: () => {
|
|
171
|
+
emit(new Date(viewYear, i, 1));
|
|
172
|
+
setOpen(false);
|
|
173
|
+
},
|
|
174
|
+
children: label
|
|
175
|
+
},
|
|
176
|
+
label
|
|
177
|
+
);
|
|
178
|
+
}) })
|
|
179
|
+
]
|
|
180
|
+
}
|
|
181
|
+
)
|
|
182
|
+
]
|
|
183
|
+
}
|
|
184
|
+
) }) });
|
|
185
|
+
}
|
|
186
|
+
export {
|
|
187
|
+
MonthPicker
|
|
188
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { MonthRangePickerProp } from "../../props/components/data-entry.prop";
|
|
2
|
+
export type { MonthRangePickerProp, MonthRangePickerProp as MonthRangePickerProps, } from "../../props/components/data-entry.prop";
|
|
3
|
+
/**
|
|
4
|
+
* MonthRangePicker — year/month (`yyyy/MM`) RANGE rendered as ONE input-styled
|
|
5
|
+
* control (Ant Design RangePicker convention): `[ from → to ✕ 📅 ]`. The two
|
|
6
|
+
* inner fields stay real, typeable `yyyy/MM` inputs (form-submittable via
|
|
7
|
+
* `${name}_from` / `${name}_to`); the Ant-style month grid is the visual
|
|
8
|
+
* affordance. Grid picks are two-step (from, then to — swapped when picked
|
|
9
|
+
* backwards) and a pick on a COMPLETE range starts a new one (reset-on-complete).
|
|
10
|
+
*/
|
|
11
|
+
export declare function MonthRangePicker({ value: valueProp, defaultValue, onValueChange, placeholder, disabled, className, id, name, fromYear, toYear, allowClear, }: MonthRangePickerProp): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { ArrowRight, CalendarIcon, ChevronLeft, ChevronRight, X } from "lucide-react";
|
|
4
|
+
import { usePickerLocales, useTranslation } from "../../i18n/use-translation";
|
|
5
|
+
import { cn } from "../../lib/utils";
|
|
6
|
+
import { Button } from "../general/button";
|
|
7
|
+
import { Popover, PopoverAnchor, PopoverContent, PopoverTrigger } from "../data-display/popover";
|
|
8
|
+
const YM_HINT = "yyyy/mm";
|
|
9
|
+
const toYmText = (d) => d ? `${d.getFullYear()}/${String(d.getMonth() + 1).padStart(2, "0")}` : "";
|
|
10
|
+
const parseYm = (raw) => {
|
|
11
|
+
const m = /^(\d{4})[/-](\d{1,2})$/.exec(raw.trim());
|
|
12
|
+
if (!m) return void 0;
|
|
13
|
+
const month = Number(m[2]);
|
|
14
|
+
if (month < 1 || month > 12) return void 0;
|
|
15
|
+
return new Date(Number(m[1]), month - 1, 1);
|
|
16
|
+
};
|
|
17
|
+
const ymIndex = (d) => d.getFullYear() * 12 + d.getMonth();
|
|
18
|
+
function MonthRangePicker({
|
|
19
|
+
value: valueProp,
|
|
20
|
+
defaultValue,
|
|
21
|
+
onValueChange,
|
|
22
|
+
placeholder,
|
|
23
|
+
disabled,
|
|
24
|
+
className,
|
|
25
|
+
id,
|
|
26
|
+
name,
|
|
27
|
+
fromYear,
|
|
28
|
+
toYear,
|
|
29
|
+
allowClear = true
|
|
30
|
+
}) {
|
|
31
|
+
const { t } = useTranslation();
|
|
32
|
+
const { locale } = usePickerLocales();
|
|
33
|
+
const [open, setOpen] = React.useState(false);
|
|
34
|
+
const autoId = React.useId();
|
|
35
|
+
const fromId = id ?? autoId;
|
|
36
|
+
const toId = `${fromId}-to`;
|
|
37
|
+
const isControlled = React.useRef(valueProp !== void 0).current;
|
|
38
|
+
const [internalValue, setInternalValue] = React.useState(defaultValue);
|
|
39
|
+
const value = isControlled ? valueProp : internalValue;
|
|
40
|
+
const [fromText, setFromText] = React.useState(() => toYmText(value?.from));
|
|
41
|
+
const [toText, setToText] = React.useState(() => toYmText(value?.to));
|
|
42
|
+
const [viewYear, setViewYear] = React.useState(() => (value?.from ?? /* @__PURE__ */ new Date()).getFullYear());
|
|
43
|
+
React.useEffect(() => {
|
|
44
|
+
setFromText(toYmText(value?.from));
|
|
45
|
+
setToText(toYmText(value?.to));
|
|
46
|
+
if (value?.from) setViewYear(value.from.getFullYear());
|
|
47
|
+
}, [value?.from, value?.to]);
|
|
48
|
+
const monthLabels = React.useMemo(() => {
|
|
49
|
+
const fmt = new Intl.DateTimeFormat(locale, { month: "short" });
|
|
50
|
+
return Array.from({ length: 12 }, (_, i) => fmt.format(new Date(2026, i, 1)));
|
|
51
|
+
}, [locale]);
|
|
52
|
+
const emit = (next) => {
|
|
53
|
+
if (!isControlled) setInternalValue(next);
|
|
54
|
+
onValueChange?.(next);
|
|
55
|
+
};
|
|
56
|
+
const showClear = allowClear && Boolean(value?.from || value?.to) && !disabled;
|
|
57
|
+
const prevDisabled = fromYear !== void 0 && viewYear <= fromYear;
|
|
58
|
+
const nextDisabled = toYear !== void 0 && viewYear >= toYear;
|
|
59
|
+
const clear = () => {
|
|
60
|
+
emit(void 0);
|
|
61
|
+
setFromText("");
|
|
62
|
+
setToText("");
|
|
63
|
+
};
|
|
64
|
+
const commitEdge = (edge, raw) => {
|
|
65
|
+
const trimmed = raw.trim();
|
|
66
|
+
const parsed = trimmed === "" ? void 0 : parseYm(trimmed);
|
|
67
|
+
if (trimmed !== "" && !parsed) return;
|
|
68
|
+
const next = { from: value?.from, to: value?.to, [edge]: parsed };
|
|
69
|
+
if (next.from && next.to && ymIndex(next.from) > ymIndex(next.to)) {
|
|
70
|
+
const swapped = { from: next.to, to: next.from };
|
|
71
|
+
emit(swapped);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
emit(next.from || next.to ? next : void 0);
|
|
75
|
+
};
|
|
76
|
+
const pickMonth = (picked) => {
|
|
77
|
+
const pendingFrom = value?.from && !value?.to ? value.from : void 0;
|
|
78
|
+
if (!pendingFrom) {
|
|
79
|
+
emit({ from: picked, to: void 0 });
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const [from, to] = ymIndex(picked) < ymIndex(pendingFrom) ? [picked, pendingFrom] : [pendingFrom, picked];
|
|
83
|
+
emit({ from, to });
|
|
84
|
+
setOpen(false);
|
|
85
|
+
};
|
|
86
|
+
const sharedKeyHandlers = {
|
|
87
|
+
onKeyDown: (event) => {
|
|
88
|
+
if (event.key === "ArrowDown") {
|
|
89
|
+
event.preventDefault();
|
|
90
|
+
setOpen(true);
|
|
91
|
+
} else if (event.key === "Escape" && open) {
|
|
92
|
+
setOpen(false);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
const innerInputClass = "min-w-0 flex-1 bg-transparent tabular-nums outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed";
|
|
97
|
+
const resolvedPlaceholder = placeholder ?? t("dataEntry.monthPicker.placeholder") ?? YM_HINT;
|
|
98
|
+
return /* @__PURE__ */ jsx(Popover, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsx(PopoverAnchor, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
99
|
+
"div",
|
|
100
|
+
{
|
|
101
|
+
className: cn(
|
|
102
|
+
"ui-control border-input bg-background flex w-full min-w-0 items-center gap-2 rounded-md border px-3 shadow-xs transition-[color,box-shadow] outline-none",
|
|
103
|
+
"focus-within:border-ring focus-within:ring-ring/50 focus-within:ring-[3px]",
|
|
104
|
+
open && "border-ring ring-ring/50 ring-[3px]",
|
|
105
|
+
disabled && "pointer-events-none cursor-not-allowed opacity-50",
|
|
106
|
+
className
|
|
107
|
+
),
|
|
108
|
+
onClick: () => {
|
|
109
|
+
if (!disabled) setOpen(true);
|
|
110
|
+
},
|
|
111
|
+
children: [
|
|
112
|
+
/* @__PURE__ */ jsx(
|
|
113
|
+
"input",
|
|
114
|
+
{
|
|
115
|
+
id: fromId,
|
|
116
|
+
name: name ? `${name}_from` : void 0,
|
|
117
|
+
value: fromText,
|
|
118
|
+
disabled,
|
|
119
|
+
placeholder: resolvedPlaceholder,
|
|
120
|
+
inputMode: "numeric",
|
|
121
|
+
autoComplete: "off",
|
|
122
|
+
"aria-label": t("dataEntry.dateRangePicker.from") ?? "From",
|
|
123
|
+
className: innerInputClass,
|
|
124
|
+
...sharedKeyHandlers,
|
|
125
|
+
onChange: (event) => {
|
|
126
|
+
setFromText(event.target.value);
|
|
127
|
+
commitEdge("from", event.target.value);
|
|
128
|
+
},
|
|
129
|
+
onBlur: () => setFromText(toYmText(value?.from))
|
|
130
|
+
}
|
|
131
|
+
),
|
|
132
|
+
/* @__PURE__ */ jsx(ArrowRight, { className: "text-muted-foreground size-3.5 shrink-0", "aria-hidden": "true" }),
|
|
133
|
+
/* @__PURE__ */ jsx(
|
|
134
|
+
"input",
|
|
135
|
+
{
|
|
136
|
+
id: toId,
|
|
137
|
+
name: name ? `${name}_to` : void 0,
|
|
138
|
+
value: toText,
|
|
139
|
+
disabled,
|
|
140
|
+
placeholder: resolvedPlaceholder,
|
|
141
|
+
inputMode: "numeric",
|
|
142
|
+
autoComplete: "off",
|
|
143
|
+
"aria-label": t("dataEntry.dateRangePicker.to") ?? "To",
|
|
144
|
+
className: innerInputClass,
|
|
145
|
+
...sharedKeyHandlers,
|
|
146
|
+
onChange: (event) => {
|
|
147
|
+
setToText(event.target.value);
|
|
148
|
+
commitEdge("to", event.target.value);
|
|
149
|
+
},
|
|
150
|
+
onBlur: () => setToText(toYmText(value?.to))
|
|
151
|
+
}
|
|
152
|
+
),
|
|
153
|
+
showClear ? /* @__PURE__ */ jsx(
|
|
154
|
+
"button",
|
|
155
|
+
{
|
|
156
|
+
type: "button",
|
|
157
|
+
tabIndex: -1,
|
|
158
|
+
"aria-label": t("common.clear") ?? "Clear",
|
|
159
|
+
className: "text-muted-foreground hover:text-foreground shrink-0",
|
|
160
|
+
onClick: (event) => {
|
|
161
|
+
event.stopPropagation();
|
|
162
|
+
clear();
|
|
163
|
+
},
|
|
164
|
+
children: /* @__PURE__ */ jsx(X, { className: "size-4 shrink-0", "aria-hidden": "true" })
|
|
165
|
+
}
|
|
166
|
+
) : null,
|
|
167
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
168
|
+
"button",
|
|
169
|
+
{
|
|
170
|
+
type: "button",
|
|
171
|
+
disabled,
|
|
172
|
+
tabIndex: -1,
|
|
173
|
+
"aria-label": t("dataEntry.monthPicker.openGrid") ?? "Open month grid",
|
|
174
|
+
className: "text-muted-foreground hover:text-foreground shrink-0",
|
|
175
|
+
children: /* @__PURE__ */ jsx(CalendarIcon, { className: "size-4 shrink-0", "aria-hidden": "true" })
|
|
176
|
+
}
|
|
177
|
+
) }),
|
|
178
|
+
/* @__PURE__ */ jsxs(
|
|
179
|
+
PopoverContent,
|
|
180
|
+
{
|
|
181
|
+
className: "w-auto p-3",
|
|
182
|
+
align: "start",
|
|
183
|
+
onOpenAutoFocus: (event) => event.preventDefault(),
|
|
184
|
+
onClick: (event) => event.stopPropagation(),
|
|
185
|
+
children: [
|
|
186
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
187
|
+
/* @__PURE__ */ jsx(
|
|
188
|
+
Button,
|
|
189
|
+
{
|
|
190
|
+
type: "button",
|
|
191
|
+
variant: "outline",
|
|
192
|
+
size: "icon-sm",
|
|
193
|
+
disabled: prevDisabled,
|
|
194
|
+
"aria-label": t("dataEntry.monthPicker.previousYear") ?? "Previous year",
|
|
195
|
+
className: "bg-transparent opacity-70 hover:opacity-100",
|
|
196
|
+
onClick: () => setViewYear((y) => y - 1),
|
|
197
|
+
children: /* @__PURE__ */ jsx(ChevronLeft, { className: "size-4", "aria-hidden": "true" })
|
|
198
|
+
}
|
|
199
|
+
),
|
|
200
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium", "aria-live": "polite", children: viewYear }),
|
|
201
|
+
/* @__PURE__ */ jsx(
|
|
202
|
+
Button,
|
|
203
|
+
{
|
|
204
|
+
type: "button",
|
|
205
|
+
variant: "outline",
|
|
206
|
+
size: "icon-sm",
|
|
207
|
+
disabled: nextDisabled,
|
|
208
|
+
"aria-label": t("dataEntry.monthPicker.nextYear") ?? "Next year",
|
|
209
|
+
className: "bg-transparent opacity-70 hover:opacity-100",
|
|
210
|
+
onClick: () => setViewYear((y) => y + 1),
|
|
211
|
+
children: /* @__PURE__ */ jsx(ChevronRight, { className: "size-4", "aria-hidden": "true" })
|
|
212
|
+
}
|
|
213
|
+
)
|
|
214
|
+
] }),
|
|
215
|
+
/* @__PURE__ */ jsx("div", { role: "grid", "aria-label": String(viewYear), className: "mt-3 grid grid-cols-3 gap-1", children: monthLabels.map((label, i) => {
|
|
216
|
+
const cell = new Date(viewYear, i, 1);
|
|
217
|
+
const cellIdx = ymIndex(cell);
|
|
218
|
+
const fromIdx = value?.from ? ymIndex(value.from) : void 0;
|
|
219
|
+
const toIdx = value?.to ? ymIndex(value.to) : void 0;
|
|
220
|
+
const isEdge = cellIdx === fromIdx || cellIdx === toIdx;
|
|
221
|
+
const inRange = fromIdx !== void 0 && toIdx !== void 0 && cellIdx > fromIdx && cellIdx < toIdx;
|
|
222
|
+
return /* @__PURE__ */ jsx(
|
|
223
|
+
Button,
|
|
224
|
+
{
|
|
225
|
+
type: "button",
|
|
226
|
+
variant: isEdge ? "default" : inRange ? "secondary" : "ghost",
|
|
227
|
+
size: "sm",
|
|
228
|
+
"aria-pressed": isEdge,
|
|
229
|
+
className: "px-4 font-normal",
|
|
230
|
+
onClick: () => pickMonth(cell),
|
|
231
|
+
children: label
|
|
232
|
+
},
|
|
233
|
+
label
|
|
234
|
+
);
|
|
235
|
+
}) })
|
|
236
|
+
]
|
|
237
|
+
}
|
|
238
|
+
)
|
|
239
|
+
]
|
|
240
|
+
}
|
|
241
|
+
) }) });
|
|
242
|
+
}
|
|
243
|
+
export {
|
|
244
|
+
MonthRangePicker
|
|
245
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { NumberInputProp } from "../../props/components/data-entry.prop";
|
|
3
|
+
export type { NumberInputProp, NumberInputProp as NumberInputProps, } from "../../props/components/data-entry.prop";
|
|
4
|
+
/**
|
|
5
|
+
* NumberInput — WAI-ARIA spinbutton: a localized numeric `<Input>` with increment/decrement steps.
|
|
6
|
+
*
|
|
7
|
+
* Composes the real `Input` primitive (no raw `<input>`) plus two icon `Button`s. The text input is
|
|
8
|
+
* the `role="spinbutton"` element carrying `aria-valuenow/min/max/text`; type freely, ArrowUp/Down
|
|
9
|
+
* (Shift = ×10) step, and the value commits clamped + rounded to `precision` on blur/Enter/step.
|
|
10
|
+
* Display formats via `Intl.NumberFormat` at rest, but stays raw and typeable while focused.
|
|
11
|
+
*/
|
|
12
|
+
export declare const NumberInput: React.ForwardRefExoticComponent<NumberInputProp & React.RefAttributes<HTMLInputElement>>;
|