@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,30 @@
|
|
|
1
|
+
import { type AppDateFormat, type AppLocale, type AppTimeFormat, type AppTimezone } from "./types";
|
|
2
|
+
import type { AppContextValue, AppProviderProp } from "../props/components/app.prop";
|
|
3
|
+
export type { AppProviderProp, AppContextValue } from "../props/components/app.prop";
|
|
4
|
+
export declare function AppProvider({ children, defaultLocale, fallbackLocale, defaultTimezone, systemTimezone, defaultTimeFormat, defaultDateFormat, timezoneOptions, storageKey, persist, onLocaleChange, onTimezoneChange, onTimeFormatChange, onDateFormatChange, }: AppProviderProp): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare function useAppContext(): AppContextValue;
|
|
6
|
+
/** Returns null outside AppProvider — used by pickers for optional context. */
|
|
7
|
+
export declare function useOptionalAppContext(): AppContextValue | null;
|
|
8
|
+
/** Shorthand for `{ locale, setLocale }`. */
|
|
9
|
+
export declare function useAppLocale(): {
|
|
10
|
+
locale: AppLocale;
|
|
11
|
+
fallbackLocale: AppLocale;
|
|
12
|
+
setLocale: (locale: AppLocale) => void;
|
|
13
|
+
dateFnsLocale: import("date-fns").Locale;
|
|
14
|
+
dayPickerLocale: Partial<import("react-day-picker").DayPickerLocale>;
|
|
15
|
+
};
|
|
16
|
+
/** Shorthand for `{ timezone, setTimezone }`. */
|
|
17
|
+
export declare function useAppTimezone(): {
|
|
18
|
+
timezone: string;
|
|
19
|
+
setTimezone: (timezone: AppTimezone) => void;
|
|
20
|
+
};
|
|
21
|
+
/** Shorthand for `{ timeFormat, setTimeFormat }`. */
|
|
22
|
+
export declare function useAppTimeFormat(): {
|
|
23
|
+
timeFormat: AppTimeFormat;
|
|
24
|
+
setTimeFormat: (timeFormat: AppTimeFormat) => void;
|
|
25
|
+
};
|
|
26
|
+
/** Shorthand for `{ dateFormat, setDateFormat }`. */
|
|
27
|
+
export declare function useAppDateFormat(): {
|
|
28
|
+
dateFormat: AppDateFormat;
|
|
29
|
+
setDateFormat: (dateFormat: AppDateFormat) => void;
|
|
30
|
+
};
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { resolveDefaultDateFormat } from "./date-format-labels";
|
|
4
|
+
import { getDateFnsLocale, getDayPickerLocale } from "./locales";
|
|
5
|
+
import { syncAppRequestHeaders } from "./request-headers";
|
|
6
|
+
import { syncI18nLocale } from "../i18n/translate";
|
|
7
|
+
const RTL_LANGUAGE_SUBTAGS = /* @__PURE__ */ new Set(["ar", "he", "fa", "ur", "ps", "sd", "yi", "dv", "ckb"]);
|
|
8
|
+
function localeDirection(locale) {
|
|
9
|
+
return RTL_LANGUAGE_SUBTAGS.has(locale.split("-")[0]?.toLowerCase() ?? "") ? "rtl" : "ltr";
|
|
10
|
+
}
|
|
11
|
+
import {
|
|
12
|
+
disableLiveRelativeFormatting,
|
|
13
|
+
enableLiveRelativeFormatting,
|
|
14
|
+
syncDatetimeContext
|
|
15
|
+
} from "../lib/datetime";
|
|
16
|
+
import { DEFAULT_STORAGE_KEY, readStoredPreferences, writeStoredPreferences } from "./storage";
|
|
17
|
+
import { resolveDefaultTimeFormat } from "./time-format-labels";
|
|
18
|
+
import { resolveDefaultTimezone } from "./timezones";
|
|
19
|
+
import {
|
|
20
|
+
APP_REQUEST_HEADER_DATE_FORMAT,
|
|
21
|
+
APP_REQUEST_HEADER_LOCALE,
|
|
22
|
+
APP_REQUEST_HEADER_TIME_FORMAT,
|
|
23
|
+
APP_REQUEST_HEADER_TIMEZONE
|
|
24
|
+
} from "./types";
|
|
25
|
+
const AppContext = React.createContext(null);
|
|
26
|
+
function resolveInitialTimeFormat(stored, defaultTimeFormat, locale) {
|
|
27
|
+
if (stored) return stored;
|
|
28
|
+
if (defaultTimeFormat === "locale") return resolveDefaultTimeFormat(locale);
|
|
29
|
+
return defaultTimeFormat;
|
|
30
|
+
}
|
|
31
|
+
function resolveInitialDateFormat(stored, defaultDateFormat, locale) {
|
|
32
|
+
if (stored) return stored;
|
|
33
|
+
if (defaultDateFormat === "locale") return resolveDefaultDateFormat(locale);
|
|
34
|
+
return defaultDateFormat;
|
|
35
|
+
}
|
|
36
|
+
function buildRequestHeaders(locale, timezone, timeFormat, dateFormat) {
|
|
37
|
+
return {
|
|
38
|
+
[APP_REQUEST_HEADER_LOCALE]: locale,
|
|
39
|
+
[APP_REQUEST_HEADER_TIMEZONE]: timezone,
|
|
40
|
+
[APP_REQUEST_HEADER_TIME_FORMAT]: timeFormat,
|
|
41
|
+
[APP_REQUEST_HEADER_DATE_FORMAT]: dateFormat
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function resolveHydrationSafeTimezone(defaultTimezone, systemTimezone) {
|
|
45
|
+
if (defaultTimezone === "browser") return systemTimezone ?? "UTC";
|
|
46
|
+
return resolveDefaultTimezone(defaultTimezone, systemTimezone);
|
|
47
|
+
}
|
|
48
|
+
function AppProvider({
|
|
49
|
+
children,
|
|
50
|
+
defaultLocale = "vi",
|
|
51
|
+
fallbackLocale = "en",
|
|
52
|
+
defaultTimezone = "browser",
|
|
53
|
+
systemTimezone,
|
|
54
|
+
defaultTimeFormat = "locale",
|
|
55
|
+
defaultDateFormat = "locale",
|
|
56
|
+
timezoneOptions,
|
|
57
|
+
storageKey = DEFAULT_STORAGE_KEY,
|
|
58
|
+
persist = true,
|
|
59
|
+
onLocaleChange,
|
|
60
|
+
onTimezoneChange,
|
|
61
|
+
onTimeFormatChange,
|
|
62
|
+
onDateFormatChange
|
|
63
|
+
}) {
|
|
64
|
+
const initialLocale = defaultLocale;
|
|
65
|
+
const [locale, setLocaleState] = React.useState(initialLocale);
|
|
66
|
+
const [timezone, setTimezoneState] = React.useState(
|
|
67
|
+
resolveHydrationSafeTimezone(defaultTimezone, systemTimezone)
|
|
68
|
+
);
|
|
69
|
+
const [timeFormat, setTimeFormatState] = React.useState(
|
|
70
|
+
() => resolveInitialTimeFormat(void 0, defaultTimeFormat, initialLocale)
|
|
71
|
+
);
|
|
72
|
+
const [dateFormat, setDateFormatState] = React.useState(
|
|
73
|
+
() => resolveInitialDateFormat(void 0, defaultDateFormat, initialLocale)
|
|
74
|
+
);
|
|
75
|
+
const hasMountedRef = React.useRef(false);
|
|
76
|
+
const prefsRef = React.useRef({ locale, timezone, timeFormat, dateFormat });
|
|
77
|
+
React.useEffect(() => {
|
|
78
|
+
const stored = persist ? readStoredPreferences(storageKey) : {};
|
|
79
|
+
const nextLocale = stored.locale ?? defaultLocale;
|
|
80
|
+
const nextTimezone = stored.timezone ?? resolveDefaultTimezone(defaultTimezone, systemTimezone);
|
|
81
|
+
const nextTimeFormat = resolveInitialTimeFormat(
|
|
82
|
+
stored.timeFormat,
|
|
83
|
+
defaultTimeFormat,
|
|
84
|
+
nextLocale
|
|
85
|
+
);
|
|
86
|
+
const nextDateFormat = resolveInitialDateFormat(
|
|
87
|
+
stored.dateFormat,
|
|
88
|
+
defaultDateFormat,
|
|
89
|
+
nextLocale
|
|
90
|
+
);
|
|
91
|
+
prefsRef.current = {
|
|
92
|
+
locale: nextLocale,
|
|
93
|
+
timezone: nextTimezone,
|
|
94
|
+
timeFormat: nextTimeFormat,
|
|
95
|
+
dateFormat: nextDateFormat
|
|
96
|
+
};
|
|
97
|
+
setLocaleState(nextLocale);
|
|
98
|
+
setTimezoneState(nextTimezone);
|
|
99
|
+
setTimeFormatState(nextTimeFormat);
|
|
100
|
+
setDateFormatState(nextDateFormat);
|
|
101
|
+
}, [
|
|
102
|
+
defaultDateFormat,
|
|
103
|
+
defaultLocale,
|
|
104
|
+
defaultTimeFormat,
|
|
105
|
+
defaultTimezone,
|
|
106
|
+
persist,
|
|
107
|
+
storageKey,
|
|
108
|
+
systemTimezone
|
|
109
|
+
]);
|
|
110
|
+
React.useEffect(() => {
|
|
111
|
+
prefsRef.current = { locale, timezone, timeFormat, dateFormat };
|
|
112
|
+
}, [locale, timezone, timeFormat, dateFormat]);
|
|
113
|
+
const setLocale = React.useCallback(
|
|
114
|
+
(next) => {
|
|
115
|
+
prefsRef.current = { ...prefsRef.current, locale: next };
|
|
116
|
+
setLocaleState(next);
|
|
117
|
+
onLocaleChange?.(next);
|
|
118
|
+
if (persist) writeStoredPreferences(storageKey, prefsRef.current);
|
|
119
|
+
},
|
|
120
|
+
[onLocaleChange, persist, storageKey]
|
|
121
|
+
);
|
|
122
|
+
const setTimezone = React.useCallback(
|
|
123
|
+
(next) => {
|
|
124
|
+
prefsRef.current = { ...prefsRef.current, timezone: next };
|
|
125
|
+
setTimezoneState(next);
|
|
126
|
+
onTimezoneChange?.(next);
|
|
127
|
+
if (persist) writeStoredPreferences(storageKey, prefsRef.current);
|
|
128
|
+
},
|
|
129
|
+
[onTimezoneChange, persist, storageKey]
|
|
130
|
+
);
|
|
131
|
+
const setTimeFormat = React.useCallback(
|
|
132
|
+
(next) => {
|
|
133
|
+
prefsRef.current = { ...prefsRef.current, timeFormat: next };
|
|
134
|
+
setTimeFormatState(next);
|
|
135
|
+
onTimeFormatChange?.(next);
|
|
136
|
+
if (persist) writeStoredPreferences(storageKey, prefsRef.current);
|
|
137
|
+
},
|
|
138
|
+
[onTimeFormatChange, persist, storageKey]
|
|
139
|
+
);
|
|
140
|
+
const setDateFormat = React.useCallback(
|
|
141
|
+
(next) => {
|
|
142
|
+
prefsRef.current = { ...prefsRef.current, dateFormat: next };
|
|
143
|
+
setDateFormatState(next);
|
|
144
|
+
onDateFormatChange?.(next);
|
|
145
|
+
if (persist) writeStoredPreferences(storageKey, prefsRef.current);
|
|
146
|
+
},
|
|
147
|
+
[onDateFormatChange, persist, storageKey]
|
|
148
|
+
);
|
|
149
|
+
const requestHeaders = React.useMemo(
|
|
150
|
+
() => buildRequestHeaders(locale, timezone, timeFormat, dateFormat),
|
|
151
|
+
[locale, timezone, timeFormat, dateFormat]
|
|
152
|
+
);
|
|
153
|
+
const dateFnsLocale = getDateFnsLocale(locale);
|
|
154
|
+
syncI18nLocale(locale, fallbackLocale);
|
|
155
|
+
syncDatetimeContext({
|
|
156
|
+
locale,
|
|
157
|
+
timezone,
|
|
158
|
+
timeFormat,
|
|
159
|
+
dateFormat,
|
|
160
|
+
dateFnsLocale
|
|
161
|
+
});
|
|
162
|
+
if (!hasMountedRef.current) {
|
|
163
|
+
disableLiveRelativeFormatting();
|
|
164
|
+
}
|
|
165
|
+
React.useEffect(() => {
|
|
166
|
+
syncAppRequestHeaders(requestHeaders);
|
|
167
|
+
}, [requestHeaders]);
|
|
168
|
+
React.useEffect(() => {
|
|
169
|
+
if (typeof document !== "undefined") {
|
|
170
|
+
document.documentElement.dir = localeDirection(locale);
|
|
171
|
+
}
|
|
172
|
+
}, [locale]);
|
|
173
|
+
React.useEffect(() => {
|
|
174
|
+
hasMountedRef.current = true;
|
|
175
|
+
enableLiveRelativeFormatting();
|
|
176
|
+
}, []);
|
|
177
|
+
const value = React.useMemo(
|
|
178
|
+
() => ({
|
|
179
|
+
locale,
|
|
180
|
+
fallbackLocale,
|
|
181
|
+
timezone,
|
|
182
|
+
timeFormat,
|
|
183
|
+
dateFormat,
|
|
184
|
+
dateFnsLocale,
|
|
185
|
+
dayPickerLocale: getDayPickerLocale(locale),
|
|
186
|
+
requestHeaders,
|
|
187
|
+
timezoneOptions,
|
|
188
|
+
setLocale,
|
|
189
|
+
setTimezone,
|
|
190
|
+
setTimeFormat,
|
|
191
|
+
setDateFormat
|
|
192
|
+
}),
|
|
193
|
+
[
|
|
194
|
+
locale,
|
|
195
|
+
fallbackLocale,
|
|
196
|
+
timezone,
|
|
197
|
+
timeFormat,
|
|
198
|
+
dateFormat,
|
|
199
|
+
dateFnsLocale,
|
|
200
|
+
requestHeaders,
|
|
201
|
+
timezoneOptions,
|
|
202
|
+
setLocale,
|
|
203
|
+
setTimezone,
|
|
204
|
+
setTimeFormat,
|
|
205
|
+
setDateFormat
|
|
206
|
+
]
|
|
207
|
+
);
|
|
208
|
+
return /* @__PURE__ */ jsx(AppContext.Provider, { value, children });
|
|
209
|
+
}
|
|
210
|
+
function useAppContext() {
|
|
211
|
+
const ctx = React.useContext(AppContext);
|
|
212
|
+
if (!ctx) {
|
|
213
|
+
throw new Error("useAppContext must be used within <AppProvider>");
|
|
214
|
+
}
|
|
215
|
+
return ctx;
|
|
216
|
+
}
|
|
217
|
+
function useOptionalAppContext() {
|
|
218
|
+
return React.useContext(AppContext);
|
|
219
|
+
}
|
|
220
|
+
function useAppLocale() {
|
|
221
|
+
const { locale, fallbackLocale, setLocale, dateFnsLocale, dayPickerLocale } = useAppContext();
|
|
222
|
+
return { locale, fallbackLocale, setLocale, dateFnsLocale, dayPickerLocale };
|
|
223
|
+
}
|
|
224
|
+
function useAppTimezone() {
|
|
225
|
+
const { timezone, setTimezone } = useAppContext();
|
|
226
|
+
return { timezone, setTimezone };
|
|
227
|
+
}
|
|
228
|
+
function useAppTimeFormat() {
|
|
229
|
+
const { timeFormat, setTimeFormat } = useAppContext();
|
|
230
|
+
return { timeFormat, setTimeFormat };
|
|
231
|
+
}
|
|
232
|
+
function useAppDateFormat() {
|
|
233
|
+
const { dateFormat, setDateFormat } = useAppContext();
|
|
234
|
+
return { dateFormat, setDateFormat };
|
|
235
|
+
}
|
|
236
|
+
export {
|
|
237
|
+
AppProvider,
|
|
238
|
+
useAppContext,
|
|
239
|
+
useAppDateFormat,
|
|
240
|
+
useAppLocale,
|
|
241
|
+
useAppTimeFormat,
|
|
242
|
+
useAppTimezone,
|
|
243
|
+
useOptionalAppContext
|
|
244
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AppLocale } from "./types";
|
|
2
|
+
import type { AppDateFormat } from "./date-formats";
|
|
3
|
+
export declare const APP_DATE_FORMAT_OPTIONS: {
|
|
4
|
+
value: "iso" | "dmy" | "mdy";
|
|
5
|
+
}[];
|
|
6
|
+
export declare function getDateFormatLabel(dateFormat: AppDateFormat, locale: AppLocale, fallbackLocale?: AppLocale): string;
|
|
7
|
+
/** Suggested default per locale — vi → dmy, ja → iso, en → mdy. */
|
|
8
|
+
export declare function resolveDefaultDateFormat(locale: AppLocale): AppDateFormat;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { APP_DATE_FORMATS } from "./date-formats";
|
|
2
|
+
import { translate } from "../i18n/translate";
|
|
3
|
+
const APP_DATE_FORMAT_OPTIONS = APP_DATE_FORMATS.map((value) => ({ value }));
|
|
4
|
+
function getDateFormatLabel(dateFormat, locale, fallbackLocale = "en") {
|
|
5
|
+
return translate(locale, fallbackLocale, `dateFormat.${dateFormat}`);
|
|
6
|
+
}
|
|
7
|
+
function resolveDefaultDateFormat(locale) {
|
|
8
|
+
if (locale === "en") return "mdy";
|
|
9
|
+
if (locale === "ja") return "iso";
|
|
10
|
+
return "dmy";
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
APP_DATE_FORMAT_OPTIONS,
|
|
14
|
+
getDateFormatLabel,
|
|
15
|
+
resolveDefaultDateFormat
|
|
16
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Date-only display preset — sent as `x-date-format` to backend. */
|
|
2
|
+
import { type AppTimeFormat } from "./time-formats";
|
|
3
|
+
export type AppDateFormat = "iso" | "dmy" | "mdy";
|
|
4
|
+
export declare const APP_DATE_FORMATS: readonly ["iso", "dmy", "mdy"];
|
|
5
|
+
export declare const APP_REQUEST_HEADER_DATE_FORMAT: "x-date-format";
|
|
6
|
+
/** date-fns pattern for date-only display. */
|
|
7
|
+
export declare function getDatePattern(dateFormat: AppDateFormat): string;
|
|
8
|
+
/** date-fns pattern for date + time (table cells). */
|
|
9
|
+
export declare function getDateTimePattern(timeFormat: AppTimeFormat, dateFormat: AppDateFormat): string;
|
|
10
|
+
export declare function isAppDateFormat(value: string | null | undefined): value is AppDateFormat;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { getTimePattern } from "./time-formats";
|
|
2
|
+
const APP_DATE_FORMATS = ["iso", "dmy", "mdy"];
|
|
3
|
+
const APP_REQUEST_HEADER_DATE_FORMAT = "x-date-format";
|
|
4
|
+
function getDatePattern(dateFormat) {
|
|
5
|
+
switch (dateFormat) {
|
|
6
|
+
case "dmy":
|
|
7
|
+
return "dd/MM/yyyy";
|
|
8
|
+
case "mdy":
|
|
9
|
+
return "MM/dd/yyyy";
|
|
10
|
+
case "iso":
|
|
11
|
+
default:
|
|
12
|
+
return "yyyy-MM-dd";
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function getDateTimePattern(timeFormat, dateFormat) {
|
|
16
|
+
return `${getDatePattern(dateFormat)} ${getTimePattern(timeFormat)}`;
|
|
17
|
+
}
|
|
18
|
+
function isAppDateFormat(value) {
|
|
19
|
+
return value === "iso" || value === "dmy" || value === "mdy";
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
APP_DATE_FORMATS,
|
|
23
|
+
APP_REQUEST_HEADER_DATE_FORMAT,
|
|
24
|
+
getDatePattern,
|
|
25
|
+
getDateTimePattern,
|
|
26
|
+
isAppDateFormat
|
|
27
|
+
};
|
package/dist/app/index.d.ts
CHANGED
|
@@ -1,136 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
|
|
14
|
-
import 'react';
|
|
15
|
-
import '@date-fns/tz';
|
|
16
|
-
|
|
17
|
-
type AppLocaleConfig = {
|
|
18
|
-
code: AppLocale;
|
|
19
|
-
dateFns: Locale;
|
|
20
|
-
dayPicker: typeof vi;
|
|
21
|
-
};
|
|
22
|
-
declare const APP_LOCALE_CONFIG: Record<AppLocale, AppLocaleConfig>;
|
|
23
|
-
declare function isAppLocale(value: string | null | undefined): value is AppLocale;
|
|
24
|
-
declare function getDateFnsLocale(locale: AppLocale): Locale;
|
|
25
|
-
declare function getDayPickerLocale(locale: AppLocale): react_day_picker.DayPickerLocale;
|
|
26
|
-
|
|
27
|
-
/** Curated preset — pass to `<AppProvider timezoneOptions={APP_TIMEZONE_PRESET} />`. */
|
|
28
|
-
declare const APP_TIMEZONE_PRESET: readonly ["UTC", "Asia/Ho_Chi_Minh", "Asia/Bangkok", "Asia/Singapore", "Asia/Jakarta", "Asia/Manila", "Asia/Kuala_Lumpur", "Asia/Yangon", "Asia/Phnom_Penh", "Asia/Vientiane", "Asia/Brunei", "Asia/Tokyo", "Asia/Seoul", "Asia/Shanghai", "Asia/Hong_Kong", "Asia/Taipei", "Asia/Ulaanbaatar", "Asia/Kolkata", "Asia/Karachi", "Asia/Dhaka", "Asia/Colombo", "Asia/Dubai", "Asia/Riyadh", "Asia/Qatar", "Asia/Tehran", "Asia/Jerusalem", "Europe/London", "Europe/Paris", "Europe/Berlin", "Europe/Amsterdam", "Europe/Rome", "Europe/Madrid", "Europe/Moscow", "Europe/Istanbul", "America/New_York", "America/Chicago", "America/Denver", "America/Los_Angeles", "America/Toronto", "America/Vancouver", "America/Mexico_City", "America/Sao_Paulo", "America/Buenos_Aires", "Australia/Sydney", "Australia/Melbourne", "Australia/Perth", "Pacific/Auckland"];
|
|
29
|
-
type AppTimezonePreset = (typeof APP_TIMEZONE_PRESET)[number];
|
|
30
|
-
/**
|
|
31
|
-
* Preferred IANA ids not returned by all runtimes (e.g. Node lists `Asia/Saigon` only).
|
|
32
|
-
* Keys are app-facing ids; values are Intl-canonical ids for offset lookup.
|
|
33
|
-
*/
|
|
34
|
-
declare const TIMEZONE_ALIASES: Record<string, string>;
|
|
35
|
-
/** Map app id → Intl id for `DateTimeFormat` / validation. */
|
|
36
|
-
declare function resolveTimezoneForIntl(timezone: string): string;
|
|
37
|
-
/** Full IANA list from runtime — sorted lexicographically. */
|
|
38
|
-
declare function getAllIanaTimezones(): readonly string[];
|
|
39
|
-
declare function isValidIanaTimezone(value: string): boolean;
|
|
40
|
-
/**
|
|
41
|
-
* Options for TimezonePicker.
|
|
42
|
-
* - `configured` omitted/empty → full IANA list
|
|
43
|
-
* - `configured` set → only those ids (+ `current` if missing)
|
|
44
|
-
*/
|
|
45
|
-
declare function resolveTimezonePickerOptions(configured?: readonly string[] | null, current?: string): readonly string[];
|
|
46
|
-
declare function getBrowserTimezone(): string;
|
|
47
|
-
/** City/region segment from IANA id — `Asia/Ho_Chi_Minh` → `Ho Chi Minh`. */
|
|
48
|
-
declare function getTimezoneCityName(timezone: string): string;
|
|
49
|
-
/** UTC/GMT offset via Intl — e.g. `GMT+7`, `UTC`. */
|
|
50
|
-
declare function getTimezoneOffsetLabel(timezone: string, locale?: AppLocale): string;
|
|
51
|
-
/** Intl fallback when no i18n override — `Ho Chi Minh (GMT+7)`. */
|
|
52
|
-
declare function formatTimezoneDisplayLabel(timezone: string, locale?: AppLocale): string;
|
|
53
|
-
declare function getTimezoneLabel(timezone: string, locale: AppLocale, fallbackLocale?: AppLocale): string;
|
|
54
|
-
declare function resolveDefaultTimezone(defaultTimezone: "browser" | "system" | (string & {}), systemTimezone?: string): string;
|
|
55
|
-
/** Vitest only — reset cached IANA list between cases. */
|
|
56
|
-
declare function resetIanaTimezoneCacheForTests(): void;
|
|
57
|
-
|
|
58
|
-
declare const APP_TIME_FORMAT_OPTIONS: {
|
|
59
|
-
value: "24h" | "12h";
|
|
60
|
-
}[];
|
|
61
|
-
declare function getTimeFormatLabel(timeFormat: AppTimeFormat, locale: AppLocale, fallbackLocale?: AppLocale): string;
|
|
62
|
-
/** Suggested default per locale — vi/ja → 24h, en → 12h. */
|
|
63
|
-
declare function resolveDefaultTimeFormat(locale: AppLocale): AppTimeFormat;
|
|
64
|
-
|
|
65
|
-
declare const APP_DATE_FORMAT_OPTIONS: {
|
|
66
|
-
value: "iso" | "dmy" | "mdy";
|
|
67
|
-
}[];
|
|
68
|
-
declare function getDateFormatLabel(dateFormat: AppDateFormat, locale: AppLocale, fallbackLocale?: AppLocale): string;
|
|
69
|
-
/** Suggested default per locale — vi → dmy, ja → iso, en → mdy. */
|
|
70
|
-
declare function resolveDefaultDateFormat(locale: AppLocale): AppDateFormat;
|
|
71
|
-
|
|
72
|
-
declare const DEFAULT_STORAGE_KEY = "godxjp.app";
|
|
73
|
-
type StoredAppPreferences = {
|
|
74
|
-
locale?: AppLocale;
|
|
75
|
-
timezone?: AppTimezone;
|
|
76
|
-
timeFormat?: AppTimeFormat;
|
|
77
|
-
dateFormat?: AppDateFormat;
|
|
78
|
-
};
|
|
79
|
-
declare function readStoredPreferences(storageKey: string): StoredAppPreferences;
|
|
80
|
-
declare function writeStoredPreferences(storageKey: string, preferences: StoredAppPreferences): void;
|
|
81
|
-
|
|
82
|
-
/** Sync locale/timezone into module state for HTTP clients (via `getAppRequestHeaders`). */
|
|
83
|
-
declare function syncAppRequestHeaders(headers: Partial<AppRequestHeaders>): void;
|
|
84
|
-
/** Read current app preference headers — wire to API client `setAppHeaderProvider`. */
|
|
85
|
-
declare function getAppRequestHeaders(): AppRequestHeaders;
|
|
86
|
-
/** Reset to defaults — for tests only. */
|
|
87
|
-
declare function resetAppRequestHeaders(): void;
|
|
88
|
-
|
|
89
|
-
declare function AppProvider({ children, defaultLocale, fallbackLocale, defaultTimezone, systemTimezone, defaultTimeFormat, defaultDateFormat, timezoneOptions, storageKey, persist, onLocaleChange, onTimezoneChange, onTimeFormatChange, onDateFormatChange, }: AppProviderProp): react_jsx_runtime.JSX.Element;
|
|
90
|
-
declare function useAppContext(): AppContextValue;
|
|
91
|
-
/** Returns null outside AppProvider — used by pickers for optional context. */
|
|
92
|
-
declare function useOptionalAppContext(): AppContextValue | null;
|
|
93
|
-
/** Shorthand for `{ locale, setLocale }`. */
|
|
94
|
-
declare function useAppLocale(): {
|
|
95
|
-
locale: AppLocale;
|
|
96
|
-
fallbackLocale: AppLocale;
|
|
97
|
-
setLocale: (locale: AppLocale) => void;
|
|
98
|
-
dateFnsLocale: date_fns.Locale;
|
|
99
|
-
dayPickerLocale: Partial<react_day_picker.DayPickerLocale>;
|
|
100
|
-
};
|
|
101
|
-
/** Shorthand for `{ timezone, setTimezone }`. */
|
|
102
|
-
declare function useAppTimezone(): {
|
|
103
|
-
timezone: string;
|
|
104
|
-
setTimezone: (timezone: AppTimezone) => void;
|
|
105
|
-
};
|
|
106
|
-
/** Shorthand for `{ timeFormat, setTimeFormat }`. */
|
|
107
|
-
declare function useAppTimeFormat(): {
|
|
108
|
-
timeFormat: AppTimeFormat;
|
|
109
|
-
setTimeFormat: (timeFormat: AppTimeFormat) => void;
|
|
110
|
-
};
|
|
111
|
-
/** Shorthand for `{ dateFormat, setDateFormat }`. */
|
|
112
|
-
declare function useAppDateFormat(): {
|
|
113
|
-
dateFormat: AppDateFormat;
|
|
114
|
-
setDateFormat: (dateFormat: AppDateFormat) => void;
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
/** Date/time formatters bound to the current AppProvider preferences. */
|
|
118
|
-
declare function useFormatting(): {
|
|
119
|
-
locale: AppLocale;
|
|
120
|
-
timezone: string;
|
|
121
|
-
timeFormat: AppTimeFormat;
|
|
122
|
-
dateFormat: AppDateFormat;
|
|
123
|
-
/** Primary formatter — auto-detect + AppProvider defaults. */
|
|
124
|
-
format: (value: Parameters<typeof formatDate>[0], options?: FormatDateOptions) => string;
|
|
125
|
-
formatDate: (value: Parameters<typeof formatDate>[0], options?: FormatDateOptions) => string;
|
|
126
|
-
formatCalendarDate: (value: Date | null | undefined, options?: FormatDateOptions) => string;
|
|
127
|
-
formatTime: (value: Parameters<typeof formatDate>[0], options?: FormatDateOptions) => string;
|
|
128
|
-
formatDateTime: (value: Parameters<typeof formatDate>[0], options?: FormatDateOptions) => string;
|
|
129
|
-
formatDateLong: (value: Parameters<typeof formatDate>[0], options?: FormatDateOptions) => string;
|
|
130
|
-
formatRelative: (value: Parameters<typeof formatDate>[0], options?: FormatDateOptions) => string;
|
|
131
|
-
formatTimeOfDay: (value: Parameters<typeof formatDate>[0], options?: FormatDateOptions) => string;
|
|
132
|
-
};
|
|
133
|
-
/** Alias for useFormatting — emphasises timezone-aware datetime helpers. */
|
|
134
|
-
declare const useDateTime: typeof useFormatting;
|
|
135
|
-
|
|
136
|
-
export { APP_DATE_FORMAT_OPTIONS, APP_LOCALE_CONFIG, APP_TIMEZONE_PRESET, APP_TIME_FORMAT_OPTIONS, AppDateFormat, AppLocale, type AppLocaleConfig, AppProvider, AppRequestHeaders, AppTimeFormat, AppTimezone, type AppTimezonePreset, DEFAULT_STORAGE_KEY, FormatDateOptions, type StoredAppPreferences, TIMEZONE_ALIASES, formatDate, formatTimezoneDisplayLabel, getAllIanaTimezones, getAppRequestHeaders, getBrowserTimezone, getDateFnsLocale, getDateFormatLabel, getDayPickerLocale, getTimeFormatLabel, getTimezoneCityName, getTimezoneLabel, getTimezoneOffsetLabel, isAppLocale, isValidIanaTimezone, readStoredPreferences, resetAppRequestHeaders, resetIanaTimezoneCacheForTests, resolveDefaultDateFormat, resolveDefaultTimeFormat, resolveDefaultTimezone, resolveTimezoneForIntl, resolveTimezonePickerOptions, syncAppRequestHeaders, useAppContext, useAppDateFormat, useAppLocale, useAppTimeFormat, useAppTimezone, useDateTime, useFormatting, useOptionalAppContext, writeStoredPreferences };
|
|
1
|
+
export * from "./types";
|
|
2
|
+
export * from "./locales";
|
|
3
|
+
export * from "./timezones";
|
|
4
|
+
export * from "./time-formats";
|
|
5
|
+
export * from "./date-formats";
|
|
6
|
+
export * from "./time-format-labels";
|
|
7
|
+
export * from "./date-format-labels";
|
|
8
|
+
export * from "./storage";
|
|
9
|
+
export * from "./request-headers";
|
|
10
|
+
export { AppProvider, useAppContext, useOptionalAppContext, useAppLocale, useAppTimezone, useAppTimeFormat, useAppDateFormat, } from "./app-provider";
|
|
11
|
+
export { useFormatting, useDateTime } from "./use-formatting";
|
|
12
|
+
export { syncDatetimeContext, getDatetimeContext, formatDate, isFormatDateValue, detectFormatDateKind, formatAppDate, formatAppDateTime, formatAppTime, formatAppDateLong, formatAppRelative, formatCalendarDate, formatTimeOfDay, parseDateInput, normalizeHhmm, isValidHhmm, type FormatDateOptions, type FormatDateKind, type FormatDatetimeOptions, } from "../lib/datetime";
|
|
13
|
+
export { useTranslation, usePickerLocales } from "../i18n/use-translation";
|
package/dist/app/index.js
CHANGED
|
@@ -1,38 +1,65 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
export {
|
|
1
|
+
export * from "./types";
|
|
2
|
+
export * from "./locales";
|
|
3
|
+
export * from "./timezones";
|
|
4
|
+
export * from "./time-formats";
|
|
5
|
+
export * from "./date-formats";
|
|
6
|
+
export * from "./time-format-labels";
|
|
7
|
+
export * from "./date-format-labels";
|
|
8
|
+
export * from "./storage";
|
|
9
|
+
export * from "./request-headers";
|
|
10
|
+
import {
|
|
11
|
+
AppProvider,
|
|
12
|
+
useAppContext,
|
|
13
|
+
useOptionalAppContext,
|
|
14
|
+
useAppLocale,
|
|
15
|
+
useAppTimezone,
|
|
16
|
+
useAppTimeFormat,
|
|
17
|
+
useAppDateFormat
|
|
18
|
+
} from "./app-provider";
|
|
19
|
+
import { useFormatting, useDateTime } from "./use-formatting";
|
|
20
|
+
import {
|
|
21
|
+
syncDatetimeContext,
|
|
22
|
+
getDatetimeContext,
|
|
23
|
+
formatDate,
|
|
24
|
+
isFormatDateValue,
|
|
25
|
+
detectFormatDateKind,
|
|
26
|
+
formatAppDate,
|
|
27
|
+
formatAppDateTime,
|
|
28
|
+
formatAppTime,
|
|
29
|
+
formatAppDateLong,
|
|
30
|
+
formatAppRelative,
|
|
31
|
+
formatCalendarDate,
|
|
32
|
+
formatTimeOfDay,
|
|
33
|
+
parseDateInput,
|
|
34
|
+
normalizeHhmm,
|
|
35
|
+
isValidHhmm
|
|
36
|
+
} from "../lib/datetime";
|
|
37
|
+
import { useTranslation, usePickerLocales } from "../i18n/use-translation";
|
|
38
|
+
export {
|
|
39
|
+
AppProvider,
|
|
40
|
+
detectFormatDateKind,
|
|
41
|
+
formatAppDate,
|
|
42
|
+
formatAppDateLong,
|
|
43
|
+
formatAppDateTime,
|
|
44
|
+
formatAppRelative,
|
|
45
|
+
formatAppTime,
|
|
46
|
+
formatCalendarDate,
|
|
47
|
+
formatDate,
|
|
48
|
+
formatTimeOfDay,
|
|
49
|
+
getDatetimeContext,
|
|
50
|
+
isFormatDateValue,
|
|
51
|
+
isValidHhmm,
|
|
52
|
+
normalizeHhmm,
|
|
53
|
+
parseDateInput,
|
|
54
|
+
syncDatetimeContext,
|
|
55
|
+
useAppContext,
|
|
56
|
+
useAppDateFormat,
|
|
57
|
+
useAppLocale,
|
|
58
|
+
useAppTimeFormat,
|
|
59
|
+
useAppTimezone,
|
|
60
|
+
useDateTime,
|
|
61
|
+
useFormatting,
|
|
62
|
+
useOptionalAppContext,
|
|
63
|
+
usePickerLocales,
|
|
64
|
+
useTranslation
|
|
65
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Locale } from "date-fns";
|
|
2
|
+
import { vi as viDayPicker } from "react-day-picker/locale";
|
|
3
|
+
import type { AppLocale } from "./types";
|
|
4
|
+
export type AppLocaleConfig = {
|
|
5
|
+
code: AppLocale;
|
|
6
|
+
dateFns: Locale;
|
|
7
|
+
dayPicker: typeof viDayPicker;
|
|
8
|
+
};
|
|
9
|
+
export declare const APP_LOCALE_CONFIG: Record<AppLocale, AppLocaleConfig>;
|
|
10
|
+
export declare function isAppLocale(value: string | null | undefined): value is AppLocale;
|
|
11
|
+
export declare function getDateFnsLocale(locale: AppLocale): Locale;
|
|
12
|
+
export declare function getDayPickerLocale(locale: AppLocale): import("react-day-picker").DayPickerLocale;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { enUS, ja, vi } from "date-fns/locale";
|
|
2
|
+
import {
|
|
3
|
+
enUS as enUSDayPicker,
|
|
4
|
+
ja as jaDayPicker,
|
|
5
|
+
vi as viDayPicker
|
|
6
|
+
} from "react-day-picker/locale";
|
|
7
|
+
const APP_LOCALE_CONFIG = {
|
|
8
|
+
vi: { code: "vi", dateFns: vi, dayPicker: viDayPicker },
|
|
9
|
+
en: { code: "en", dateFns: enUS, dayPicker: enUSDayPicker },
|
|
10
|
+
ja: { code: "ja", dateFns: ja, dayPicker: jaDayPicker }
|
|
11
|
+
};
|
|
12
|
+
function isAppLocale(value) {
|
|
13
|
+
return value === "vi" || value === "en" || value === "ja";
|
|
14
|
+
}
|
|
15
|
+
function getDateFnsLocale(locale) {
|
|
16
|
+
return APP_LOCALE_CONFIG[locale].dateFns;
|
|
17
|
+
}
|
|
18
|
+
function getDayPickerLocale(locale) {
|
|
19
|
+
return APP_LOCALE_CONFIG[locale].dayPicker;
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
APP_LOCALE_CONFIG,
|
|
23
|
+
getDateFnsLocale,
|
|
24
|
+
getDayPickerLocale,
|
|
25
|
+
isAppLocale
|
|
26
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AppRequestHeaders } from "./types";
|
|
2
|
+
/** Sync locale/timezone into module state for HTTP clients (via `getAppRequestHeaders`). */
|
|
3
|
+
export declare function syncAppRequestHeaders(headers: Partial<AppRequestHeaders>): void;
|
|
4
|
+
/** Read current app preference headers — wire to API client `setAppHeaderProvider`. */
|
|
5
|
+
export declare function getAppRequestHeaders(): AppRequestHeaders;
|
|
6
|
+
/** Reset to defaults — for tests only. */
|
|
7
|
+
export declare function resetAppRequestHeaders(): void;
|