@godxjp/ui 6.0.0 → 6.0.2
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/index.d.ts +140 -0
- package/dist/app/index.js +38 -0
- package/dist/app.prop-IobwLwaM.d.ts +90 -0
- package/dist/checkbox-NkFkqsQ8.d.ts +13 -0
- package/dist/chunk-2XW7J3EI.js +226 -0
- package/dist/chunk-3F2AKYRD.js +416 -0
- package/dist/chunk-3KPEZ5CF.js +37 -0
- package/dist/chunk-3UGU5TYP.js +89 -0
- package/{src/props/registry.ts → dist/chunk-6RA3KSVK.js} +118 -133
- package/dist/chunk-7NZFVD24.js +122 -0
- package/dist/chunk-7PWBC4BY.js +25 -0
- package/dist/chunk-7S7MYFXE.js +61 -0
- package/dist/chunk-7WRZG2IG.js +71 -0
- package/dist/chunk-B775Y6BE.js +1 -0
- package/dist/chunk-BHV2FUOA.js +111 -0
- package/dist/chunk-BI3HERR7.js +70 -0
- package/dist/chunk-BPSKQUL2.js +68 -0
- package/dist/chunk-CDWPQ5RP.js +187 -0
- package/dist/chunk-CP2LET6N.js +244 -0
- package/dist/chunk-CQBADMFG.js +20 -0
- package/dist/chunk-CRERCLIZ.js +33 -0
- package/dist/chunk-DU6ZYZRP.js +238 -0
- package/dist/chunk-DY5C44UP.js +55 -0
- package/dist/chunk-E4HJNQ62.js +117 -0
- package/dist/chunk-E76QIYSY.js +93 -0
- package/dist/chunk-F7PG4OEV.js +37 -0
- package/dist/chunk-GDSVW62T.js +171 -0
- package/dist/chunk-H2FHJOLU.js +178 -0
- package/dist/chunk-HJEBRCXL.js +55 -0
- package/dist/chunk-ICM6XBST.js +16 -0
- package/{src/components/data-entry/calendar.tsx → dist/chunk-IK7I3ABN.js} +33 -35
- package/dist/chunk-L6J44O74.js +144 -0
- package/dist/chunk-LDSLS6HE.js +1 -0
- package/dist/chunk-LVNUHUEZ.js +191 -0
- package/dist/chunk-M64MVRLS.js +92 -0
- package/dist/chunk-NGQW3KEM.js +402 -0
- package/dist/chunk-NZ4FOC5N.js +559 -0
- package/dist/chunk-PIIRNAXA.js +26 -0
- package/dist/chunk-S66TJXJU.js +33 -0
- package/dist/chunk-SMLKNECP.js +133 -0
- package/dist/chunk-TAHBM3F2.js +66 -0
- package/dist/chunk-TO33OY4L.js +150 -0
- package/dist/chunk-TO7URV7U.js +51 -0
- package/dist/chunk-TOO5AEKL.js +81 -0
- package/dist/chunk-U3GHAOIJ.js +299 -0
- package/dist/chunk-U7N2A7A3.js +9 -0
- package/dist/chunk-UX634MYF.js +123 -0
- package/dist/chunk-V6UWJKZF.js +28 -0
- package/{src/components/data-entry/input.tsx → dist/chunk-VOHTRR5X.js} +18 -16
- package/dist/chunk-WRFKVUPW.js +332 -0
- package/dist/chunk-WXW43RK5.js +24 -0
- package/{src/components/navigation/tabs.tsx → dist/chunk-XG7XDYIM.js} +46 -53
- package/dist/chunk-YFCQKO3B.js +842 -0
- package/dist/chunk-ZDWXGWLY.js +73 -0
- package/dist/chunk-ZLK5SPT6.js +11 -0
- package/dist/chunk-ZS6DTAM2.js +31 -0
- package/dist/chunk-ZT5UEUBO.js +1 -0
- package/dist/components/admin/index.d.ts +80 -0
- package/dist/components/admin/index.js +38 -0
- package/dist/components/data-display/badge.d.ts +12 -0
- package/dist/components/data-display/badge.js +3 -0
- package/dist/components/data-display/card.d.ts +87 -0
- package/dist/components/data-display/card.js +2 -0
- package/dist/components/data-display/index.d.ts +72 -0
- package/dist/components/data-display/index.js +89 -0
- package/dist/components/data-display/popover.d.ts +13 -0
- package/dist/components/data-display/popover.js +2 -0
- package/dist/components/data-display/scroll-area.d.ts +7 -0
- package/dist/components/data-display/scroll-area.js +2 -0
- package/dist/components/data-display/table.d.ts +10 -0
- package/dist/components/data-display/table.js +3 -0
- package/dist/components/data-entry/autocomplete.d.ts +16 -0
- package/dist/components/data-entry/autocomplete.js +8 -0
- package/dist/components/data-entry/calendar.d.ts +16 -0
- package/dist/components/data-entry/calendar.js +4 -0
- package/dist/components/data-entry/cascader.d.ts +32 -0
- package/dist/components/data-entry/cascader.js +13 -0
- package/dist/components/data-entry/checkbox.d.ts +13 -0
- package/dist/components/data-entry/checkbox.js +4 -0
- package/dist/components/data-entry/color-picker.d.ts +16 -0
- package/dist/components/data-entry/color-picker.js +6 -0
- package/dist/components/data-entry/command.d.ts +69 -0
- package/dist/components/data-entry/command.js +3 -0
- package/dist/components/data-entry/date-picker.d.ts +16 -0
- package/dist/components/data-entry/date-picker.js +8 -0
- package/dist/components/data-entry/date-range-picker.d.ts +16 -0
- package/dist/components/data-entry/date-range-picker.js +8 -0
- package/dist/components/data-entry/index.d.ts +53 -0
- package/dist/components/data-entry/index.js +152 -0
- package/dist/components/data-entry/input.d.ts +6 -0
- package/dist/components/data-entry/input.js +2 -0
- package/dist/components/data-entry/label.d.ts +8 -0
- package/dist/components/data-entry/label.js +2 -0
- package/dist/components/data-entry/radio.d.ts +24 -0
- package/dist/components/data-entry/radio.js +4 -0
- package/dist/components/data-entry/select.d.ts +18 -0
- package/dist/components/data-entry/select.js +3 -0
- package/dist/components/data-entry/slider.d.ts +16 -0
- package/dist/components/data-entry/slider.js +2 -0
- package/dist/components/data-entry/switch.d.ts +17 -0
- package/dist/components/data-entry/switch.js +2 -0
- package/dist/components/data-entry/textarea.d.ts +6 -0
- package/dist/components/data-entry/textarea.js +3 -0
- package/dist/components/data-entry/time-picker.d.ts +16 -0
- package/dist/components/data-entry/time-picker.js +7 -0
- package/dist/components/data-entry/transfer.d.ts +17 -0
- package/dist/components/data-entry/transfer.js +11 -0
- package/dist/components/data-entry/tree-select.d.ts +26 -0
- package/dist/components/data-entry/tree-select.js +13 -0
- package/dist/components/data-entry/upload.d.ts +42 -0
- package/dist/components/data-entry/upload.js +11 -0
- package/dist/components/feedback/alert.d.ts +60 -0
- package/dist/components/feedback/alert.js +7 -0
- package/dist/components/feedback/dialog.d.ts +64 -0
- package/dist/components/feedback/dialog.js +7 -0
- package/dist/components/feedback/index.d.ts +16 -0
- package/dist/components/feedback/index.js +14 -0
- package/dist/components/feedback/sheet.d.ts +24 -0
- package/dist/components/feedback/sheet.js +2 -0
- package/dist/components/feedback/sonner.d.ts +6 -0
- package/dist/components/feedback/sonner.js +1 -0
- package/dist/components/general/button.d.ts +20 -0
- package/dist/components/general/button.js +2 -0
- package/dist/components/general/index.d.ts +6 -0
- package/dist/components/general/index.js +2 -0
- package/dist/components/layout/index.d.ts +71 -0
- package/dist/components/layout/index.js +5 -0
- package/dist/components/navigation/dropdown-menu.d.ts +28 -0
- package/dist/components/navigation/dropdown-menu.js +2 -0
- package/dist/components/navigation/index.d.ts +32 -0
- package/dist/components/navigation/index.js +12 -0
- package/dist/components/navigation/pagination.d.ts +11 -0
- package/dist/components/navigation/pagination.js +7 -0
- package/dist/components/navigation/steps.d.ts +12 -0
- package/dist/components/navigation/steps.js +3 -0
- package/dist/components/navigation/tabs-items.d.ts +12 -0
- package/dist/components/navigation/tabs-items.js +3 -0
- package/dist/components/navigation/tabs.d.ts +12 -0
- package/dist/components/navigation/tabs.js +2 -0
- package/dist/components/query/index.d.ts +43 -0
- package/dist/components/query/index.js +8 -0
- package/dist/components/ui/index.d.ts +57 -0
- package/dist/components/ui/index.js +37 -0
- package/{src/props/vocabulary/content.prop.ts → dist/content.prop-D1Dd3TAc.d.ts} +16 -20
- package/dist/data-display.prop-DNTAzmDy.d.ts +58 -0
- package/dist/data-entry.prop-BEGA1lTq.d.ts +323 -0
- package/dist/data-table-D1u_rKLK.d.ts +83 -0
- package/dist/data.prop-BVvfKC_g.d.ts +41 -0
- package/dist/feedback.prop-BmxUlpAW.d.ts +64 -0
- package/dist/filter-bar-B7OGFO9S.d.ts +10 -0
- package/dist/form/index.d.ts +21 -0
- package/dist/form/index.js +4 -0
- package/dist/form.prop-BHgpuFFm.d.ts +41 -0
- package/dist/format-date-ByyZoqI5.d.ts +51 -0
- package/dist/general.prop-D7brMPNL.d.ts +16 -0
- package/dist/i18n/index.d.ts +217 -0
- package/dist/i18n/index.js +2 -0
- package/dist/index.d.ts +53 -0
- package/dist/index.js +39 -0
- package/dist/inline-C5u6ptJV.d.ts +10 -0
- package/dist/interaction.prop-Cdn7wOtq.d.ts +25 -0
- package/{src/props/vocabulary/layout.prop.ts → dist/layout.prop-4TCNvyQZ.d.ts} +9 -14
- package/dist/layout.prop-C795F0qg.d.ts +112 -0
- package/dist/lib/datetime/index.d.ts +31 -0
- package/dist/lib/datetime/index.js +1 -0
- package/dist/lib/utils.d.ts +5 -0
- package/dist/lib/utils.js +1 -0
- package/dist/navigation.prop-DpZqcXey.d.ts +78 -0
- package/dist/navigation.prop-DxBiClEH.d.ts +20 -0
- package/dist/props/components/index.d.ts +27 -0
- package/dist/props/components/index.js +1 -0
- package/dist/props/index.d.ts +28 -0
- package/dist/props/index.js +3 -0
- package/dist/props/registry.d.ts +649 -0
- package/dist/props/registry.js +1 -0
- package/dist/props/vocabulary/index.d.ts +7 -0
- package/dist/props/vocabulary/index.js +1 -0
- package/dist/query.prop-hIPrk2zI.d.ts +71 -0
- package/dist/search-input-uP01rY1L.d.ts +22 -0
- package/dist/shared.prop-BNRJc9K0.d.ts +45 -0
- package/{src → dist}/styles/control.css +1 -1
- package/dist/types-mvzYGrma.d.ts +37 -0
- package/dist/use-toast-Dol5bdY3.d.ts +34 -0
- package/package.json +234 -68
- package/src/app/__tests__/app-provider.test.tsx +0 -232
- package/src/app/__tests__/date-format-labels.test.ts +0 -36
- package/src/app/__tests__/date-formats.test.ts +0 -44
- package/src/app/__tests__/timezones.test.ts +0 -65
- package/src/app/app-provider.tsx +0 -227
- package/src/app/date-format-labels.ts +0 -21
- package/src/app/date-formats.ts +0 -30
- package/src/app/index.ts +0 -40
- package/src/app/locales.ts +0 -32
- package/src/app/request-headers.ts +0 -31
- package/src/app/storage.ts +0 -44
- package/src/app/time-format-labels.ts +0 -19
- package/src/app/time-formats.ts +0 -15
- package/src/app/timezones.ts +0 -208
- package/src/app/types.ts +0 -39
- package/src/app/use-formatting.ts +0 -47
- package/src/components/__tests__/accessibility-primitives.test.tsx +0 -65
- package/src/components/__tests__/docs-parity.test.ts +0 -41
- package/src/components/__tests__/shadcn-release-guardrails.test.ts +0 -71
- package/src/components/__tests__/theme-axes-integration.test.tsx +0 -242
- package/src/components/admin/index.ts +0 -76
- package/src/components/data-display/__tests__/card-table.test.tsx +0 -328
- package/src/components/data-display/__tests__/data-display.test.tsx +0 -73
- package/src/components/data-display/__tests__/data-table.test.tsx +0 -84
- package/src/components/data-display/__tests__/popover.test.tsx +0 -92
- package/src/components/data-display/__tests__/scroll-area-collapsible.test.tsx +0 -66
- package/src/components/data-display/badge.tsx +0 -27
- package/src/components/data-display/card.tsx +0 -194
- package/src/components/data-display/code-badge.tsx +0 -28
- package/src/components/data-display/collapsible.tsx +0 -5
- package/src/components/data-display/data-table.tsx +0 -476
- package/src/components/data-display/empty-state.tsx +0 -22
- package/src/components/data-display/index.ts +0 -41
- package/src/components/data-display/key-value-grid.tsx +0 -46
- package/src/components/data-display/popover.tsx +0 -62
- package/src/components/data-display/progress-meter.tsx +0 -20
- package/src/components/data-display/scan-panel.tsx +0 -16
- package/src/components/data-display/scroll-area.tsx +0 -42
- package/src/components/data-display/status-badge.tsx +0 -83
- package/src/components/data-display/table.tsx +0 -59
- package/src/components/data-display/timeline.tsx +0 -42
- package/src/components/data-display/tree-list.tsx +0 -42
- package/src/components/data-entry/__fixtures__/tree-options.ts +0 -80
- package/src/components/data-entry/__tests__/cascader-tree-transfer.test.tsx +0 -417
- package/src/components/data-entry/__tests__/checkbox-group.test.tsx +0 -40
- package/src/components/data-entry/__tests__/checkbox.test.tsx +0 -20
- package/src/components/data-entry/__tests__/date-autocomplete.test.tsx +0 -94
- package/src/components/data-entry/__tests__/form-field.test.tsx +0 -49
- package/src/components/data-entry/__tests__/input-textarea.test.tsx +0 -38
- package/src/components/data-entry/__tests__/label-select.test.tsx +0 -62
- package/src/components/data-entry/__tests__/pickers.test.tsx +0 -74
- package/src/components/data-entry/__tests__/radio.test.tsx +0 -46
- package/src/components/data-entry/__tests__/search-input.test.tsx +0 -32
- package/src/components/data-entry/__tests__/switch-field.test.tsx +0 -52
- package/src/components/data-entry/__tests__/upload.test.tsx +0 -125
- package/src/components/data-entry/autocomplete.tsx +0 -91
- package/src/components/data-entry/cascader.tsx +0 -305
- package/src/components/data-entry/checkbox-group.tsx +0 -90
- package/src/components/data-entry/checkbox.tsx +0 -30
- package/src/components/data-entry/choice-field.tsx +0 -27
- package/src/components/data-entry/choice-option.ts +0 -20
- package/src/components/data-entry/color-picker.tsx +0 -75
- package/src/components/data-entry/command.tsx +0 -56
- package/src/components/data-entry/country-select.tsx +0 -88
- package/src/components/data-entry/date-picker.tsx +0 -69
- package/src/components/data-entry/date-range-picker.tsx +0 -75
- package/src/components/data-entry/form-field.tsx +0 -59
- package/src/components/data-entry/index.ts +0 -62
- package/src/components/data-entry/label.tsx +0 -25
- package/src/components/data-entry/radio.tsx +0 -109
- package/src/components/data-entry/search-input.tsx +0 -103
- package/src/components/data-entry/select.tsx +0 -149
- package/src/components/data-entry/slider.tsx +0 -38
- package/src/components/data-entry/switch-field.tsx +0 -91
- package/src/components/data-entry/switch.tsx +0 -24
- package/src/components/data-entry/textarea.tsx +0 -12
- package/src/components/data-entry/time-picker.tsx +0 -214
- package/src/components/data-entry/transfer.tsx +0 -231
- package/src/components/data-entry/tree-select-strategy.ts +0 -6
- package/src/components/data-entry/tree-select.tsx +0 -279
- package/src/components/data-entry/tree-utils.ts +0 -221
- package/src/components/data-entry/upload-crop-dialog.tsx +0 -109
- package/src/components/data-entry/upload-types.ts +0 -86
- package/src/components/data-entry/upload.tsx +0 -498
- package/src/components/data-entry/use-upload-draft.ts +0 -93
- package/src/components/feedback/__tests__/alert.test.tsx +0 -127
- package/src/components/feedback/__tests__/dialog.test.tsx +0 -290
- package/src/components/feedback/__tests__/sheet.test.tsx +0 -94
- package/src/components/feedback/__tests__/skeleton.test.tsx +0 -25
- package/src/components/feedback/__tests__/toast.test.tsx +0 -52
- package/src/components/feedback/alert.tsx +0 -167
- package/src/components/feedback/dialog.tsx +0 -325
- package/src/components/feedback/index.ts +0 -53
- package/src/components/feedback/sheet.tsx +0 -130
- package/src/components/feedback/skeleton.tsx +0 -95
- package/src/components/feedback/sonner.tsx +0 -54
- package/src/components/feedback/toaster.tsx +0 -1
- package/src/components/feedback/use-toast.ts +0 -62
- package/src/components/general/__tests__/button.test.tsx +0 -71
- package/src/components/general/button.tsx +0 -61
- package/src/components/general/index.ts +0 -2
- package/src/components/layout/__tests__/page-container.test.tsx +0 -69
- package/src/components/layout/__tests__/page-inset.test.tsx +0 -14
- package/src/components/layout/__tests__/stack-inline.test.tsx +0 -39
- package/src/components/layout/app-shell.tsx +0 -42
- package/src/components/layout/breadcrumb.tsx +0 -35
- package/src/components/layout/index.ts +0 -31
- package/src/components/layout/inline.tsx +0 -13
- package/src/components/layout/menu.tsx +0 -34
- package/src/components/layout/mobile-frame.tsx +0 -57
- package/src/components/layout/page-container.tsx +0 -81
- package/src/components/layout/page-inset.tsx +0 -16
- package/src/components/layout/responsive-grid.tsx +0 -14
- package/src/components/layout/shell-app.tsx +0 -30
- package/src/components/layout/sidebar.tsx +0 -98
- package/src/components/layout/split-pane.tsx +0 -16
- package/src/components/layout/stack.tsx +0 -13
- package/src/components/layout/topbar.tsx +0 -108
- package/src/components/navigation/__tests__/app-pickers.test.tsx +0 -118
- package/src/components/navigation/__tests__/dropdown-menu.test.tsx +0 -104
- package/src/components/navigation/__tests__/navigation.test.tsx +0 -61
- package/src/components/navigation/__tests__/pagination-steps-tabs.test.tsx +0 -76
- package/src/components/navigation/date-format-picker.tsx +0 -55
- package/src/components/navigation/dropdown-menu.tsx +0 -190
- package/src/components/navigation/filter-bar.tsx +0 -38
- package/src/components/navigation/index.ts +0 -28
- package/src/components/navigation/locale-picker.tsx +0 -49
- package/src/components/navigation/page-header.tsx +0 -50
- package/src/components/navigation/pagination-utils.ts +0 -35
- package/src/components/navigation/pagination.tsx +0 -168
- package/src/components/navigation/steps.tsx +0 -163
- package/src/components/navigation/tabs-items.tsx +0 -69
- package/src/components/navigation/time-format-picker.tsx +0 -55
- package/src/components/navigation/timezone-picker.tsx +0 -63
- package/src/components/query/__tests__/data-state.test.tsx +0 -214
- package/src/components/query/__tests__/infinite-prefetch.test.tsx +0 -105
- package/src/components/query/__tests__/query-helpers.test.tsx +0 -61
- package/src/components/query/data-state.tsx +0 -58
- package/src/components/query/index.ts +0 -10
- package/src/components/query/infinite-query-state.tsx +0 -99
- package/src/components/query/mutation-feedback.tsx +0 -31
- package/src/components/query/prefetch-link.tsx +0 -45
- package/src/components/query/query-refetch-button.tsx +0 -41
- package/src/components/ui/alert-dialog.tsx +0 -1
- package/src/components/ui/alert.tsx +0 -1
- package/src/components/ui/autocomplete.tsx +0 -1
- package/src/components/ui/badge.tsx +0 -1
- package/src/components/ui/button.tsx +0 -1
- package/src/components/ui/calendar.tsx +0 -1
- package/src/components/ui/card.tsx +0 -1
- package/src/components/ui/checkbox.tsx +0 -1
- package/src/components/ui/color-picker.tsx +0 -1
- package/src/components/ui/command.tsx +0 -1
- package/src/components/ui/date-picker.tsx +0 -1
- package/src/components/ui/date-range-picker.tsx +0 -1
- package/src/components/ui/dialog.tsx +0 -1
- package/src/components/ui/dropdown-menu.tsx +0 -1
- package/src/components/ui/index.tsx +0 -31
- package/src/components/ui/input.tsx +0 -1
- package/src/components/ui/label.tsx +0 -1
- package/src/components/ui/pagination.tsx +0 -1
- package/src/components/ui/popover.tsx +0 -1
- package/src/components/ui/radio.tsx +0 -1
- package/src/components/ui/scroll-area.tsx +0 -1
- package/src/components/ui/select.tsx +0 -1
- package/src/components/ui/sheet.tsx +0 -1
- package/src/components/ui/slider.tsx +0 -1
- package/src/components/ui/sonner.tsx +0 -1
- package/src/components/ui/switch.tsx +0 -1
- package/src/components/ui/table.tsx +0 -1
- package/src/components/ui/tabs-items.tsx +0 -1
- package/src/components/ui/tabs.tsx +0 -1
- package/src/components/ui/textarea.tsx +0 -1
- package/src/components/ui/time-picker.tsx +0 -1
- package/src/components/ui/upload.tsx +0 -1
- package/src/form/__tests__/use-zod-form.test.tsx +0 -97
- package/src/form/form-field-control.tsx +0 -44
- package/src/form/form-root.tsx +0 -29
- package/src/form/index.ts +0 -7
- package/src/form/use-zod-form.ts +0 -29
- package/src/i18n/__tests__/translate.test.ts +0 -23
- package/src/i18n/index.ts +0 -9
- package/src/i18n/messages/en.json +0 -171
- package/src/i18n/messages/ja.json +0 -171
- package/src/i18n/messages/vi.json +0 -171
- package/src/i18n/translate.ts +0 -74
- package/src/i18n/use-translation.ts +0 -53
- package/src/index.ts +0 -3
- package/src/lib/__tests__/control-styles.test.ts +0 -78
- package/src/lib/__tests__/datetime.test.ts +0 -77
- package/src/lib/__tests__/format-date.test.ts +0 -97
- package/src/lib/__tests__/format.test.ts +0 -62
- package/src/lib/__tests__/theme-tokens-audit.test.ts +0 -176
- package/src/lib/__tests__/theme-tokens-css.test.ts +0 -118
- package/src/lib/__tests__/token-governance.test.ts +0 -191
- package/src/lib/__tests__/variants.test.ts +0 -18
- package/src/lib/control-styles.ts +0 -33
- package/src/lib/datetime/detect.ts +0 -25
- package/src/lib/datetime/format-date.ts +0 -100
- package/src/lib/datetime/format.ts +0 -140
- package/src/lib/datetime/index.ts +0 -25
- package/src/lib/datetime/parse.ts +0 -51
- package/src/lib/datetime/sync.ts +0 -48
- package/src/lib/format.ts +0 -114
- package/src/lib/hooks.ts +0 -54
- package/src/lib/utils.ts +0 -6
- package/src/lib/variants.ts +0 -40
- package/src/props/components/app.prop.ts +0 -99
- package/src/props/components/data-display.prop.ts +0 -73
- package/src/props/components/data-entry.prop.ts +0 -334
- package/src/props/components/feedback.prop.ts +0 -80
- package/src/props/components/form.prop.ts +0 -46
- package/src/props/components/general.prop.ts +0 -18
- package/src/props/components/index.ts +0 -99
- package/src/props/components/layout.prop.ts +0 -130
- package/src/props/components/navigation.prop.ts +0 -88
- package/src/props/components/query.prop.ts +0 -94
- package/src/props/index.ts +0 -17
- package/src/props/vocabulary/data.prop.ts +0 -46
- package/src/props/vocabulary/index.ts +0 -73
- package/src/props/vocabulary/interaction.prop.ts +0 -42
- package/src/props/vocabulary/navigation.prop.ts +0 -19
- package/src/props/vocabulary/shared.prop.ts +0 -59
- package/src/test/__tests__/render-loop-guard.test.tsx +0 -38
- package/src/test/jest-dom.d.ts +0 -4
- package/src/test/render-loop-guard.tsx +0 -50
- package/src/test/render.tsx +0 -29
- package/src/test/theme-globals.test.ts +0 -77
- package/src/test/theme-globals.ts +0 -134
- package/src/test/theme-test-utils.tsx +0 -67
- /package/{src → dist}/styles/alert-layout.css +0 -0
- /package/{src → dist}/styles/badge-layout.css +0 -0
- /package/{src → dist}/styles/card-layout.css +0 -0
- /package/{src → dist}/styles/data-display-layout.css +0 -0
- /package/{src → dist}/styles/density.css +0 -0
- /package/{src → dist}/styles/dialog-layout.css +0 -0
- /package/{src → dist}/styles/index.css +0 -0
- /package/{src → dist}/styles/layout.css +0 -0
- /package/{src → dist}/styles/shell-layout.css +0 -0
- /package/{src → dist}/styles/table-layout.css +0 -0
- /package/{src → dist}/theme/example.service.css +0 -0
- /package/{src → dist}/tokens/base.css +0 -0
- /package/{src → dist}/tokens/foundation.css +0 -0
- /package/{src → dist}/tokens/primitives/badge.css +0 -0
- /package/{src → dist}/tokens/primitives/card.css +0 -0
- /package/{src → dist}/tokens/primitives/control.css +0 -0
- /package/{src → dist}/tokens/primitives/feedback.css +0 -0
- /package/{src → dist}/tokens/primitives/layout.css +0 -0
- /package/{src → dist}/tokens/primitives/navigation.css +0 -0
- /package/{src → dist}/tokens/primitives/table.css +0 -0
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
import { APP_TIME_FORMATS, isAppDateFormat, isAppTimeFormat, isAppLocale, translate, syncI18nLocale, syncDatetimeContext, getDateFnsLocale, getDayPickerLocale, APP_REQUEST_HEADER_DATE_FORMAT, APP_REQUEST_HEADER_TIME_FORMAT, resolveDefaultDateFormat } from './chunk-YFCQKO3B.js';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
// src/app/types.ts
|
|
7
|
+
var APP_LOCALES = ["vi", "en", "ja"];
|
|
8
|
+
var APP_REQUEST_HEADER_LOCALE = "x-locale";
|
|
9
|
+
var APP_REQUEST_HEADER_TIMEZONE = "x-timezone";
|
|
10
|
+
|
|
11
|
+
// src/app/request-headers.ts
|
|
12
|
+
var DEFAULT_HEADERS = {
|
|
13
|
+
[APP_REQUEST_HEADER_LOCALE]: "vi",
|
|
14
|
+
[APP_REQUEST_HEADER_TIMEZONE]: "Asia/Ho_Chi_Minh",
|
|
15
|
+
[APP_REQUEST_HEADER_TIME_FORMAT]: "24h",
|
|
16
|
+
[APP_REQUEST_HEADER_DATE_FORMAT]: "dmy"
|
|
17
|
+
};
|
|
18
|
+
var currentHeaders = { ...DEFAULT_HEADERS };
|
|
19
|
+
function syncAppRequestHeaders(headers) {
|
|
20
|
+
currentHeaders = { ...currentHeaders, ...headers };
|
|
21
|
+
}
|
|
22
|
+
function getAppRequestHeaders() {
|
|
23
|
+
return { ...currentHeaders };
|
|
24
|
+
}
|
|
25
|
+
function resetAppRequestHeaders() {
|
|
26
|
+
currentHeaders = { ...DEFAULT_HEADERS };
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// src/app/storage.ts
|
|
30
|
+
var DEFAULT_STORAGE_KEY = "godxjp.app";
|
|
31
|
+
function readStoredPreferences(storageKey) {
|
|
32
|
+
if (typeof window === "undefined") return {};
|
|
33
|
+
try {
|
|
34
|
+
const raw = window.localStorage.getItem(storageKey);
|
|
35
|
+
if (!raw) return {};
|
|
36
|
+
const parsed = JSON.parse(raw);
|
|
37
|
+
return {
|
|
38
|
+
locale: isAppLocale(parsed.locale) ? parsed.locale : void 0,
|
|
39
|
+
timezone: typeof parsed.timezone === "string" ? parsed.timezone : void 0,
|
|
40
|
+
timeFormat: isAppTimeFormat(parsed.timeFormat) ? parsed.timeFormat : void 0,
|
|
41
|
+
dateFormat: isAppDateFormat(parsed.dateFormat) ? parsed.dateFormat : void 0
|
|
42
|
+
};
|
|
43
|
+
} catch {
|
|
44
|
+
return {};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function writeStoredPreferences(storageKey, preferences) {
|
|
48
|
+
if (typeof window === "undefined") return;
|
|
49
|
+
try {
|
|
50
|
+
window.localStorage.setItem(storageKey, JSON.stringify(preferences));
|
|
51
|
+
} catch {
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// src/app/time-format-labels.ts
|
|
56
|
+
var APP_TIME_FORMAT_OPTIONS = APP_TIME_FORMATS.map((value) => ({ value }));
|
|
57
|
+
function getTimeFormatLabel(timeFormat, locale, fallbackLocale = "en") {
|
|
58
|
+
return translate(locale, fallbackLocale, `timeFormat.${timeFormat}`);
|
|
59
|
+
}
|
|
60
|
+
function resolveDefaultTimeFormat(locale) {
|
|
61
|
+
return locale === "en" ? "12h" : "24h";
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// src/app/timezones.ts
|
|
65
|
+
var APP_TIMEZONE_PRESET = [
|
|
66
|
+
"UTC",
|
|
67
|
+
"Asia/Ho_Chi_Minh",
|
|
68
|
+
"Asia/Bangkok",
|
|
69
|
+
"Asia/Singapore",
|
|
70
|
+
"Asia/Jakarta",
|
|
71
|
+
"Asia/Manila",
|
|
72
|
+
"Asia/Kuala_Lumpur",
|
|
73
|
+
"Asia/Yangon",
|
|
74
|
+
"Asia/Phnom_Penh",
|
|
75
|
+
"Asia/Vientiane",
|
|
76
|
+
"Asia/Brunei",
|
|
77
|
+
"Asia/Tokyo",
|
|
78
|
+
"Asia/Seoul",
|
|
79
|
+
"Asia/Shanghai",
|
|
80
|
+
"Asia/Hong_Kong",
|
|
81
|
+
"Asia/Taipei",
|
|
82
|
+
"Asia/Ulaanbaatar",
|
|
83
|
+
"Asia/Kolkata",
|
|
84
|
+
"Asia/Karachi",
|
|
85
|
+
"Asia/Dhaka",
|
|
86
|
+
"Asia/Colombo",
|
|
87
|
+
"Asia/Dubai",
|
|
88
|
+
"Asia/Riyadh",
|
|
89
|
+
"Asia/Qatar",
|
|
90
|
+
"Asia/Tehran",
|
|
91
|
+
"Asia/Jerusalem",
|
|
92
|
+
"Europe/London",
|
|
93
|
+
"Europe/Paris",
|
|
94
|
+
"Europe/Berlin",
|
|
95
|
+
"Europe/Amsterdam",
|
|
96
|
+
"Europe/Rome",
|
|
97
|
+
"Europe/Madrid",
|
|
98
|
+
"Europe/Moscow",
|
|
99
|
+
"Europe/Istanbul",
|
|
100
|
+
"America/New_York",
|
|
101
|
+
"America/Chicago",
|
|
102
|
+
"America/Denver",
|
|
103
|
+
"America/Los_Angeles",
|
|
104
|
+
"America/Toronto",
|
|
105
|
+
"America/Vancouver",
|
|
106
|
+
"America/Mexico_City",
|
|
107
|
+
"America/Sao_Paulo",
|
|
108
|
+
"America/Buenos_Aires",
|
|
109
|
+
"Australia/Sydney",
|
|
110
|
+
"Australia/Melbourne",
|
|
111
|
+
"Australia/Perth",
|
|
112
|
+
"Pacific/Auckland"
|
|
113
|
+
];
|
|
114
|
+
var APP_TIMEZONE_OPTIONS = APP_TIMEZONE_PRESET;
|
|
115
|
+
var TIMEZONE_ALIASES = {
|
|
116
|
+
"Asia/Ho_Chi_Minh": "Asia/Saigon"
|
|
117
|
+
};
|
|
118
|
+
var PREFERRED_TIMEZONE_IDS = Object.keys(TIMEZONE_ALIASES);
|
|
119
|
+
function resolveTimezoneForIntl(timezone) {
|
|
120
|
+
return TIMEZONE_ALIASES[timezone] ?? timezone;
|
|
121
|
+
}
|
|
122
|
+
var FALLBACK_IANA_TIMEZONES = [...APP_TIMEZONE_PRESET];
|
|
123
|
+
var cachedAllTimezones = null;
|
|
124
|
+
var cachedTimezoneSet = null;
|
|
125
|
+
function enrichTimezoneList(base) {
|
|
126
|
+
const set = new Set(base);
|
|
127
|
+
for (const preferred of PREFERRED_TIMEZONE_IDS) {
|
|
128
|
+
if (!set.has(preferred)) {
|
|
129
|
+
const canonical = TIMEZONE_ALIASES[preferred];
|
|
130
|
+
if (!canonical || set.has(canonical)) set.add(preferred);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return [...set].sort();
|
|
134
|
+
}
|
|
135
|
+
function getAllIanaTimezones() {
|
|
136
|
+
if (cachedAllTimezones) return cachedAllTimezones;
|
|
137
|
+
try {
|
|
138
|
+
const intl = Intl;
|
|
139
|
+
if (typeof intl.supportedValuesOf === "function") {
|
|
140
|
+
cachedAllTimezones = enrichTimezoneList(intl.supportedValuesOf("timeZone").slice().sort());
|
|
141
|
+
return cachedAllTimezones;
|
|
142
|
+
}
|
|
143
|
+
} catch {
|
|
144
|
+
}
|
|
145
|
+
cachedAllTimezones = FALLBACK_IANA_TIMEZONES;
|
|
146
|
+
return cachedAllTimezones;
|
|
147
|
+
}
|
|
148
|
+
function getIanaTimezoneSet() {
|
|
149
|
+
cachedTimezoneSet ??= new Set(getAllIanaTimezones());
|
|
150
|
+
return cachedTimezoneSet;
|
|
151
|
+
}
|
|
152
|
+
function isValidIanaTimezone(value) {
|
|
153
|
+
const set = getIanaTimezoneSet();
|
|
154
|
+
if (set.has(value)) return true;
|
|
155
|
+
const canonical = TIMEZONE_ALIASES[value];
|
|
156
|
+
return canonical ? set.has(canonical) : false;
|
|
157
|
+
}
|
|
158
|
+
function isKnownAppTimezone(value) {
|
|
159
|
+
return APP_TIMEZONE_PRESET.includes(value);
|
|
160
|
+
}
|
|
161
|
+
function resolveTimezonePickerOptions(configured, current) {
|
|
162
|
+
const base = configured && configured.length > 0 ? [...configured] : [...getAllIanaTimezones()];
|
|
163
|
+
if (current && !base.includes(current)) {
|
|
164
|
+
return [current, ...base];
|
|
165
|
+
}
|
|
166
|
+
return base;
|
|
167
|
+
}
|
|
168
|
+
function getBrowserTimezone() {
|
|
169
|
+
try {
|
|
170
|
+
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
171
|
+
} catch {
|
|
172
|
+
return "UTC";
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
function getTimezoneCityName(timezone) {
|
|
176
|
+
const segment = timezone.split("/").pop();
|
|
177
|
+
if (!segment) return timezone;
|
|
178
|
+
return segment.replace(/_/g, " ");
|
|
179
|
+
}
|
|
180
|
+
function getTimezoneOffsetLabel(timezone, locale = "en") {
|
|
181
|
+
if (timezone === "UTC") return "UTC";
|
|
182
|
+
try {
|
|
183
|
+
const parts = new Intl.DateTimeFormat(locale, {
|
|
184
|
+
timeZone: resolveTimezoneForIntl(timezone),
|
|
185
|
+
timeZoneName: "shortOffset"
|
|
186
|
+
}).formatToParts(/* @__PURE__ */ new Date());
|
|
187
|
+
return parts.find((part) => part.type === "timeZoneName")?.value ?? "";
|
|
188
|
+
} catch {
|
|
189
|
+
return "";
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
function formatTimezoneDisplayLabel(timezone, locale = "en") {
|
|
193
|
+
const city = getTimezoneCityName(timezone);
|
|
194
|
+
const offset = getTimezoneOffsetLabel(timezone, locale);
|
|
195
|
+
return offset ? `${city} (${offset})` : city;
|
|
196
|
+
}
|
|
197
|
+
function getTimezoneLabel(timezone, locale, fallbackLocale = "en") {
|
|
198
|
+
const key = `timezone.${timezone}`;
|
|
199
|
+
const translated = translate(locale, fallbackLocale, key);
|
|
200
|
+
if (translated !== key) return translated;
|
|
201
|
+
const offset = getTimezoneOffsetLabel(timezone, locale);
|
|
202
|
+
const city = getTimezoneCityName(timezone);
|
|
203
|
+
return offset ? `${city} (${offset})` : city;
|
|
204
|
+
}
|
|
205
|
+
function resolveDefaultTimezone(defaultTimezone, systemTimezone) {
|
|
206
|
+
if (defaultTimezone === "browser") return getBrowserTimezone();
|
|
207
|
+
if (defaultTimezone === "system") return systemTimezone ?? "UTC";
|
|
208
|
+
return defaultTimezone;
|
|
209
|
+
}
|
|
210
|
+
function resetIanaTimezoneCacheForTests() {
|
|
211
|
+
cachedAllTimezones = null;
|
|
212
|
+
cachedTimezoneSet = null;
|
|
213
|
+
}
|
|
214
|
+
var AppContext = React.createContext(null);
|
|
215
|
+
function resolveInitialTimeFormat(stored, defaultTimeFormat, locale) {
|
|
216
|
+
if (stored) return stored;
|
|
217
|
+
if (defaultTimeFormat === "locale") return resolveDefaultTimeFormat(locale);
|
|
218
|
+
return defaultTimeFormat;
|
|
219
|
+
}
|
|
220
|
+
function resolveInitialDateFormat(stored, defaultDateFormat, locale) {
|
|
221
|
+
if (stored) return stored;
|
|
222
|
+
if (defaultDateFormat === "locale") return resolveDefaultDateFormat(locale);
|
|
223
|
+
return defaultDateFormat;
|
|
224
|
+
}
|
|
225
|
+
function buildRequestHeaders(locale, timezone, timeFormat, dateFormat) {
|
|
226
|
+
return {
|
|
227
|
+
[APP_REQUEST_HEADER_LOCALE]: locale,
|
|
228
|
+
[APP_REQUEST_HEADER_TIMEZONE]: timezone,
|
|
229
|
+
[APP_REQUEST_HEADER_TIME_FORMAT]: timeFormat,
|
|
230
|
+
[APP_REQUEST_HEADER_DATE_FORMAT]: dateFormat
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
function AppProvider({
|
|
234
|
+
children,
|
|
235
|
+
defaultLocale = "vi",
|
|
236
|
+
fallbackLocale = "en",
|
|
237
|
+
defaultTimezone = "browser",
|
|
238
|
+
systemTimezone,
|
|
239
|
+
defaultTimeFormat = "locale",
|
|
240
|
+
defaultDateFormat = "locale",
|
|
241
|
+
timezoneOptions,
|
|
242
|
+
storageKey = DEFAULT_STORAGE_KEY,
|
|
243
|
+
persist = true,
|
|
244
|
+
onLocaleChange,
|
|
245
|
+
onTimezoneChange,
|
|
246
|
+
onTimeFormatChange,
|
|
247
|
+
onDateFormatChange
|
|
248
|
+
}) {
|
|
249
|
+
const stored = React.useMemo(
|
|
250
|
+
() => persist ? readStoredPreferences(storageKey) : {},
|
|
251
|
+
[persist, storageKey]
|
|
252
|
+
);
|
|
253
|
+
const initialLocale = stored.locale ?? defaultLocale;
|
|
254
|
+
const [locale, setLocaleState] = React.useState(initialLocale);
|
|
255
|
+
const [timezone, setTimezoneState] = React.useState(
|
|
256
|
+
stored.timezone ?? resolveDefaultTimezone(defaultTimezone, systemTimezone)
|
|
257
|
+
);
|
|
258
|
+
const [timeFormat, setTimeFormatState] = React.useState(
|
|
259
|
+
() => resolveInitialTimeFormat(stored.timeFormat, defaultTimeFormat, initialLocale)
|
|
260
|
+
);
|
|
261
|
+
const [dateFormat, setDateFormatState] = React.useState(
|
|
262
|
+
() => resolveInitialDateFormat(stored.dateFormat, defaultDateFormat, initialLocale)
|
|
263
|
+
);
|
|
264
|
+
const prefsRef = React.useRef({ locale, timezone, timeFormat, dateFormat });
|
|
265
|
+
React.useEffect(() => {
|
|
266
|
+
prefsRef.current = { locale, timezone, timeFormat, dateFormat };
|
|
267
|
+
}, [locale, timezone, timeFormat, dateFormat]);
|
|
268
|
+
const setLocale = React.useCallback(
|
|
269
|
+
(next) => {
|
|
270
|
+
prefsRef.current = { ...prefsRef.current, locale: next };
|
|
271
|
+
setLocaleState(next);
|
|
272
|
+
onLocaleChange?.(next);
|
|
273
|
+
if (persist) writeStoredPreferences(storageKey, prefsRef.current);
|
|
274
|
+
},
|
|
275
|
+
[onLocaleChange, persist, storageKey]
|
|
276
|
+
);
|
|
277
|
+
const setTimezone = React.useCallback(
|
|
278
|
+
(next) => {
|
|
279
|
+
prefsRef.current = { ...prefsRef.current, timezone: next };
|
|
280
|
+
setTimezoneState(next);
|
|
281
|
+
onTimezoneChange?.(next);
|
|
282
|
+
if (persist) writeStoredPreferences(storageKey, prefsRef.current);
|
|
283
|
+
},
|
|
284
|
+
[onTimezoneChange, persist, storageKey]
|
|
285
|
+
);
|
|
286
|
+
const setTimeFormat = React.useCallback(
|
|
287
|
+
(next) => {
|
|
288
|
+
prefsRef.current = { ...prefsRef.current, timeFormat: next };
|
|
289
|
+
setTimeFormatState(next);
|
|
290
|
+
onTimeFormatChange?.(next);
|
|
291
|
+
if (persist) writeStoredPreferences(storageKey, prefsRef.current);
|
|
292
|
+
},
|
|
293
|
+
[onTimeFormatChange, persist, storageKey]
|
|
294
|
+
);
|
|
295
|
+
const setDateFormat = React.useCallback(
|
|
296
|
+
(next) => {
|
|
297
|
+
prefsRef.current = { ...prefsRef.current, dateFormat: next };
|
|
298
|
+
setDateFormatState(next);
|
|
299
|
+
onDateFormatChange?.(next);
|
|
300
|
+
if (persist) writeStoredPreferences(storageKey, prefsRef.current);
|
|
301
|
+
},
|
|
302
|
+
[onDateFormatChange, persist, storageKey]
|
|
303
|
+
);
|
|
304
|
+
const requestHeaders = React.useMemo(
|
|
305
|
+
() => buildRequestHeaders(locale, timezone, timeFormat, dateFormat),
|
|
306
|
+
[locale, timezone, timeFormat, dateFormat]
|
|
307
|
+
);
|
|
308
|
+
React.useEffect(() => {
|
|
309
|
+
syncAppRequestHeaders(requestHeaders);
|
|
310
|
+
syncI18nLocale(locale, fallbackLocale);
|
|
311
|
+
syncDatetimeContext({
|
|
312
|
+
locale,
|
|
313
|
+
timezone,
|
|
314
|
+
timeFormat,
|
|
315
|
+
dateFormat,
|
|
316
|
+
dateFnsLocale: getDateFnsLocale(locale)
|
|
317
|
+
});
|
|
318
|
+
}, [requestHeaders, locale, fallbackLocale, timezone, timeFormat, dateFormat]);
|
|
319
|
+
const value = React.useMemo(
|
|
320
|
+
() => ({
|
|
321
|
+
locale,
|
|
322
|
+
fallbackLocale,
|
|
323
|
+
timezone,
|
|
324
|
+
timeFormat,
|
|
325
|
+
dateFormat,
|
|
326
|
+
dateFnsLocale: getDateFnsLocale(locale),
|
|
327
|
+
dayPickerLocale: getDayPickerLocale(locale),
|
|
328
|
+
requestHeaders,
|
|
329
|
+
timezoneOptions,
|
|
330
|
+
setLocale,
|
|
331
|
+
setTimezone,
|
|
332
|
+
setTimeFormat,
|
|
333
|
+
setDateFormat
|
|
334
|
+
}),
|
|
335
|
+
[
|
|
336
|
+
locale,
|
|
337
|
+
fallbackLocale,
|
|
338
|
+
timezone,
|
|
339
|
+
timeFormat,
|
|
340
|
+
dateFormat,
|
|
341
|
+
requestHeaders,
|
|
342
|
+
timezoneOptions,
|
|
343
|
+
setLocale,
|
|
344
|
+
setTimezone,
|
|
345
|
+
setTimeFormat,
|
|
346
|
+
setDateFormat
|
|
347
|
+
]
|
|
348
|
+
);
|
|
349
|
+
return /* @__PURE__ */ jsx(AppContext.Provider, { value, children });
|
|
350
|
+
}
|
|
351
|
+
function useAppContext() {
|
|
352
|
+
const ctx = React.useContext(AppContext);
|
|
353
|
+
if (!ctx) {
|
|
354
|
+
throw new Error("useAppContext must be used within <AppProvider>");
|
|
355
|
+
}
|
|
356
|
+
return ctx;
|
|
357
|
+
}
|
|
358
|
+
function useOptionalAppContext() {
|
|
359
|
+
return React.useContext(AppContext);
|
|
360
|
+
}
|
|
361
|
+
function useAppLocale() {
|
|
362
|
+
const { locale, fallbackLocale, setLocale, dateFnsLocale, dayPickerLocale } = useAppContext();
|
|
363
|
+
return { locale, fallbackLocale, setLocale, dateFnsLocale, dayPickerLocale };
|
|
364
|
+
}
|
|
365
|
+
function useAppTimezone() {
|
|
366
|
+
const { timezone, setTimezone } = useAppContext();
|
|
367
|
+
return { timezone, setTimezone };
|
|
368
|
+
}
|
|
369
|
+
function useAppTimeFormat() {
|
|
370
|
+
const { timeFormat, setTimeFormat } = useAppContext();
|
|
371
|
+
return { timeFormat, setTimeFormat };
|
|
372
|
+
}
|
|
373
|
+
function useAppDateFormat() {
|
|
374
|
+
const { dateFormat, setDateFormat } = useAppContext();
|
|
375
|
+
return { dateFormat, setDateFormat };
|
|
376
|
+
}
|
|
377
|
+
var DEFAULT_LOCALE = "vi";
|
|
378
|
+
var DEFAULT_FALLBACK = "en";
|
|
379
|
+
function useTranslation() {
|
|
380
|
+
const ctx = useOptionalAppContext();
|
|
381
|
+
const locale = ctx?.locale ?? DEFAULT_LOCALE;
|
|
382
|
+
const fallbackLocale = ctx?.fallbackLocale ?? DEFAULT_FALLBACK;
|
|
383
|
+
return useMemo(
|
|
384
|
+
() => ({
|
|
385
|
+
locale,
|
|
386
|
+
fallbackLocale,
|
|
387
|
+
t: (key, params) => translate(locale, fallbackLocale, key, params)
|
|
388
|
+
}),
|
|
389
|
+
[locale, fallbackLocale]
|
|
390
|
+
);
|
|
391
|
+
}
|
|
392
|
+
function usePickerLocales(dayPickerOverride) {
|
|
393
|
+
const ctx = useOptionalAppContext();
|
|
394
|
+
const locale = ctx?.locale ?? DEFAULT_LOCALE;
|
|
395
|
+
return useMemo(
|
|
396
|
+
() => ({
|
|
397
|
+
locale,
|
|
398
|
+
timezone: ctx?.timezone ?? "Asia/Ho_Chi_Minh",
|
|
399
|
+
timeFormat: ctx?.timeFormat ?? "24h",
|
|
400
|
+
dateFormat: ctx?.dateFormat ?? "dmy",
|
|
401
|
+
dateFnsLocale: ctx?.dateFnsLocale ?? getDateFnsLocale(locale),
|
|
402
|
+
dayPickerLocale: dayPickerOverride ?? ctx?.dayPickerLocale ?? getDayPickerLocale(locale)
|
|
403
|
+
}),
|
|
404
|
+
[
|
|
405
|
+
ctx?.dateFnsLocale,
|
|
406
|
+
ctx?.dayPickerLocale,
|
|
407
|
+
ctx?.timeFormat,
|
|
408
|
+
ctx?.dateFormat,
|
|
409
|
+
ctx?.timezone,
|
|
410
|
+
dayPickerOverride,
|
|
411
|
+
locale
|
|
412
|
+
]
|
|
413
|
+
);
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
export { APP_LOCALES, APP_REQUEST_HEADER_LOCALE, APP_REQUEST_HEADER_TIMEZONE, APP_TIMEZONE_OPTIONS, APP_TIMEZONE_PRESET, APP_TIME_FORMAT_OPTIONS, AppProvider, DEFAULT_STORAGE_KEY, TIMEZONE_ALIASES, formatTimezoneDisplayLabel, getAllIanaTimezones, getAppRequestHeaders, getBrowserTimezone, getTimeFormatLabel, getTimezoneCityName, getTimezoneLabel, getTimezoneOffsetLabel, isKnownAppTimezone, isValidIanaTimezone, readStoredPreferences, resetAppRequestHeaders, resetIanaTimezoneCacheForTests, resolveDefaultTimeFormat, resolveDefaultTimezone, resolveTimezoneForIntl, resolveTimezonePickerOptions, syncAppRequestHeaders, useAppContext, useAppDateFormat, useAppLocale, useAppTimeFormat, useAppTimezone, useOptionalAppContext, usePickerLocales, useTranslation, writeStoredPreferences };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { cn } from './chunk-U7N2A7A3.js';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
|
4
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
var ScrollArea = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
7
|
+
ScrollAreaPrimitive.Root,
|
|
8
|
+
{
|
|
9
|
+
ref,
|
|
10
|
+
className: cn("relative overflow-hidden", className),
|
|
11
|
+
...props,
|
|
12
|
+
children: [
|
|
13
|
+
/* @__PURE__ */ jsx(ScrollAreaPrimitive.Viewport, { className: "size-full rounded-[inherit]", children }),
|
|
14
|
+
/* @__PURE__ */ jsx(ScrollBar, {}),
|
|
15
|
+
/* @__PURE__ */ jsx(ScrollAreaPrimitive.Corner, {})
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
));
|
|
19
|
+
ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
|
|
20
|
+
var ScrollBar = React.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ jsx(
|
|
21
|
+
ScrollAreaPrimitive.ScrollAreaScrollbar,
|
|
22
|
+
{
|
|
23
|
+
ref,
|
|
24
|
+
orientation,
|
|
25
|
+
className: cn(
|
|
26
|
+
"flex touch-none transition-colors select-none",
|
|
27
|
+
orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent p-px",
|
|
28
|
+
orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-px",
|
|
29
|
+
className
|
|
30
|
+
),
|
|
31
|
+
...props,
|
|
32
|
+
children: /* @__PURE__ */ jsx(ScrollAreaPrimitive.ScrollAreaThumb, { className: "bg-border relative flex-1 rounded-full" })
|
|
33
|
+
}
|
|
34
|
+
));
|
|
35
|
+
ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
|
|
36
|
+
|
|
37
|
+
export { ScrollArea, ScrollBar };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { ChoiceField, choiceGroupClassName } from './chunk-CQBADMFG.js';
|
|
2
|
+
import { cn } from './chunk-U7N2A7A3.js';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
5
|
+
import { Circle } from 'lucide-react';
|
|
6
|
+
import { jsx } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
var RadioGroupRoot = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
9
|
+
RadioGroupPrimitive.Root,
|
|
10
|
+
{
|
|
11
|
+
ref,
|
|
12
|
+
"data-slot": "radio-group",
|
|
13
|
+
className: cn("ui-choice-group", className),
|
|
14
|
+
...props
|
|
15
|
+
}
|
|
16
|
+
));
|
|
17
|
+
RadioGroupRoot.displayName = RadioGroupPrimitive.Root.displayName;
|
|
18
|
+
var RadioItem = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
19
|
+
RadioGroupPrimitive.Item,
|
|
20
|
+
{
|
|
21
|
+
ref,
|
|
22
|
+
"data-slot": "radio-group-item",
|
|
23
|
+
className: cn(
|
|
24
|
+
"ui-radio focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 shrink-0 shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
|
|
25
|
+
className
|
|
26
|
+
),
|
|
27
|
+
...props,
|
|
28
|
+
children: /* @__PURE__ */ jsx(
|
|
29
|
+
RadioGroupPrimitive.Indicator,
|
|
30
|
+
{
|
|
31
|
+
"data-slot": "radio-group-indicator",
|
|
32
|
+
className: "ui-choice-indicator",
|
|
33
|
+
children: /* @__PURE__ */ jsx(Circle, { className: "ui-radio-icon", "aria-hidden": "true" })
|
|
34
|
+
}
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
));
|
|
38
|
+
RadioItem.displayName = RadioGroupPrimitive.Item.displayName;
|
|
39
|
+
function RadioGroupOptions({
|
|
40
|
+
value,
|
|
41
|
+
defaultValue,
|
|
42
|
+
onValueChange,
|
|
43
|
+
options,
|
|
44
|
+
orientation = "vertical",
|
|
45
|
+
disabled,
|
|
46
|
+
name,
|
|
47
|
+
className,
|
|
48
|
+
children
|
|
49
|
+
}) {
|
|
50
|
+
const reactId = React.useId();
|
|
51
|
+
if (options && options.length > 0) {
|
|
52
|
+
return /* @__PURE__ */ jsx(
|
|
53
|
+
RadioGroupRoot,
|
|
54
|
+
{
|
|
55
|
+
value,
|
|
56
|
+
defaultValue,
|
|
57
|
+
onValueChange,
|
|
58
|
+
disabled,
|
|
59
|
+
name,
|
|
60
|
+
"data-orientation": orientation,
|
|
61
|
+
className: choiceGroupClassName(orientation, className),
|
|
62
|
+
children: options.map((opt, index) => {
|
|
63
|
+
const id = `${reactId}-${opt.value}-${index}`;
|
|
64
|
+
return /* @__PURE__ */ jsx(ChoiceField, { id, label: opt.label, description: opt.description, children: /* @__PURE__ */ jsx(RadioItem, { id, value: opt.value, disabled: opt.disabled }) }, opt.value);
|
|
65
|
+
})
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
return /* @__PURE__ */ jsx(
|
|
70
|
+
RadioGroupRoot,
|
|
71
|
+
{
|
|
72
|
+
value,
|
|
73
|
+
defaultValue,
|
|
74
|
+
onValueChange,
|
|
75
|
+
disabled,
|
|
76
|
+
name,
|
|
77
|
+
"data-orientation": orientation,
|
|
78
|
+
className: choiceGroupClassName(orientation, className),
|
|
79
|
+
children
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
var Radio = Object.assign(RadioItem, {
|
|
84
|
+
Root: RadioGroupRoot,
|
|
85
|
+
Group: RadioGroupOptions,
|
|
86
|
+
Item: RadioItem
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
export { Radio, RadioGroupOptions, RadioGroupRoot, RadioItem };
|