@godxjp/ui 6.0.0 → 6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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/dist/types-mvzYGrma.d.ts +37 -0
- package/dist/use-toast-Dol5bdY3.d.ts +34 -0
- package/package.json +233 -67
- 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/control.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,140 @@
|
|
|
1
|
+
import { h as AppLocale, j as AppTimeFormat, g as AppDateFormat, k as AppTimezone, i as AppRequestHeaders } from '../types-mvzYGrma.js';
|
|
2
|
+
export { A as APP_DATE_FORMATS, a as APP_LOCALES, b as APP_REQUEST_HEADER_DATE_FORMAT, c as APP_REQUEST_HEADER_LOCALE, d as APP_REQUEST_HEADER_TIMEZONE, e as APP_REQUEST_HEADER_TIME_FORMAT, f as APP_TIME_FORMATS, l as AppTimezoneDefault, m as getDatePattern, n as getDateTimePattern, o as getTimePattern, p as isAppDateFormat, q as isAppTimeFormat } from '../types-mvzYGrma.js';
|
|
3
|
+
import * as react_day_picker from 'react-day-picker';
|
|
4
|
+
import * as date_fns from 'date-fns';
|
|
5
|
+
import { Locale } from 'date-fns';
|
|
6
|
+
import { vi } from 'react-day-picker/locale';
|
|
7
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
8
|
+
import { a as AppProviderProp, A as AppContextValue } from '../app.prop-IobwLwaM.js';
|
|
9
|
+
import { j as formatDate, a as FormatDateOptions } from '../format-date-ByyZoqI5.js';
|
|
10
|
+
export { F as FormatDateKind, b as FormatDatetimeOptions, d as detectFormatDateKind, f as formatAppDate, c as formatAppDateLong, e as formatAppDateTime, g as formatAppRelative, h as formatAppTime, i as formatCalendarDate, k as formatTimeOfDay, m as isFormatDateValue } from '../format-date-ByyZoqI5.js';
|
|
11
|
+
export { getDatetimeContext, isValidHhmm, normalizeHhmm, parseDateInput, syncDatetimeContext } from '../lib/datetime/index.js';
|
|
12
|
+
export { usePickerLocales, useTranslation } from '../i18n/index.js';
|
|
13
|
+
import '../shared.prop-BNRJc9K0.js';
|
|
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
|
+
/** @deprecated Use `APP_TIMEZONE_PRESET` or `getAllIanaTimezones()`. */
|
|
30
|
+
declare const APP_TIMEZONE_OPTIONS: 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"];
|
|
31
|
+
type AppTimezonePreset = (typeof APP_TIMEZONE_PRESET)[number];
|
|
32
|
+
/**
|
|
33
|
+
* Preferred IANA ids not returned by all runtimes (e.g. Node lists `Asia/Saigon` only).
|
|
34
|
+
* Keys are app-facing ids; values are Intl-canonical ids for offset lookup.
|
|
35
|
+
*/
|
|
36
|
+
declare const TIMEZONE_ALIASES: Record<string, string>;
|
|
37
|
+
/** Map app id → Intl id for `DateTimeFormat` / validation. */
|
|
38
|
+
declare function resolveTimezoneForIntl(timezone: string): string;
|
|
39
|
+
/** Full IANA list from runtime — sorted lexicographically. */
|
|
40
|
+
declare function getAllIanaTimezones(): readonly string[];
|
|
41
|
+
declare function isValidIanaTimezone(value: string): boolean;
|
|
42
|
+
/** @deprecated Use `isValidIanaTimezone`. */
|
|
43
|
+
declare function isKnownAppTimezone(value: string): value is AppTimezonePreset;
|
|
44
|
+
/**
|
|
45
|
+
* Options for TimezonePicker.
|
|
46
|
+
* - `configured` omitted/empty → full IANA list
|
|
47
|
+
* - `configured` set → only those ids (+ `current` if missing)
|
|
48
|
+
*/
|
|
49
|
+
declare function resolveTimezonePickerOptions(configured?: readonly string[] | null, current?: string): readonly string[];
|
|
50
|
+
declare function getBrowserTimezone(): string;
|
|
51
|
+
/** City/region segment from IANA id — `Asia/Ho_Chi_Minh` → `Ho Chi Minh`. */
|
|
52
|
+
declare function getTimezoneCityName(timezone: string): string;
|
|
53
|
+
/** UTC/GMT offset via Intl — e.g. `GMT+7`, `UTC`. */
|
|
54
|
+
declare function getTimezoneOffsetLabel(timezone: string, locale?: AppLocale): string;
|
|
55
|
+
/** Intl fallback when no i18n override — `Ho Chi Minh (GMT+7)`. */
|
|
56
|
+
declare function formatTimezoneDisplayLabel(timezone: string, locale?: AppLocale): string;
|
|
57
|
+
declare function getTimezoneLabel(timezone: string, locale: AppLocale, fallbackLocale?: AppLocale): string;
|
|
58
|
+
declare function resolveDefaultTimezone(defaultTimezone: "browser" | "system" | (string & {}), systemTimezone?: string): string;
|
|
59
|
+
/** Vitest only — reset cached IANA list between cases. */
|
|
60
|
+
declare function resetIanaTimezoneCacheForTests(): void;
|
|
61
|
+
|
|
62
|
+
declare const APP_TIME_FORMAT_OPTIONS: {
|
|
63
|
+
value: "24h" | "12h";
|
|
64
|
+
}[];
|
|
65
|
+
declare function getTimeFormatLabel(timeFormat: AppTimeFormat, locale: AppLocale, fallbackLocale?: AppLocale): string;
|
|
66
|
+
/** Suggested default per locale — vi/ja → 24h, en → 12h. */
|
|
67
|
+
declare function resolveDefaultTimeFormat(locale: AppLocale): AppTimeFormat;
|
|
68
|
+
|
|
69
|
+
declare const APP_DATE_FORMAT_OPTIONS: {
|
|
70
|
+
value: "iso" | "dmy" | "mdy";
|
|
71
|
+
}[];
|
|
72
|
+
declare function getDateFormatLabel(dateFormat: AppDateFormat, locale: AppLocale, fallbackLocale?: AppLocale): string;
|
|
73
|
+
/** Suggested default per locale — vi → dmy, ja → iso, en → mdy. */
|
|
74
|
+
declare function resolveDefaultDateFormat(locale: AppLocale): AppDateFormat;
|
|
75
|
+
|
|
76
|
+
declare const DEFAULT_STORAGE_KEY = "godxjp.app";
|
|
77
|
+
type StoredAppPreferences = {
|
|
78
|
+
locale?: AppLocale;
|
|
79
|
+
timezone?: AppTimezone;
|
|
80
|
+
timeFormat?: AppTimeFormat;
|
|
81
|
+
dateFormat?: AppDateFormat;
|
|
82
|
+
};
|
|
83
|
+
declare function readStoredPreferences(storageKey: string): StoredAppPreferences;
|
|
84
|
+
declare function writeStoredPreferences(storageKey: string, preferences: StoredAppPreferences): void;
|
|
85
|
+
|
|
86
|
+
/** Sync locale/timezone into module state for HTTP clients (via `getAppRequestHeaders`). */
|
|
87
|
+
declare function syncAppRequestHeaders(headers: Partial<AppRequestHeaders>): void;
|
|
88
|
+
/** Read current app preference headers — wire to API client `setAppHeaderProvider`. */
|
|
89
|
+
declare function getAppRequestHeaders(): AppRequestHeaders;
|
|
90
|
+
/** Reset to defaults — for tests only. */
|
|
91
|
+
declare function resetAppRequestHeaders(): void;
|
|
92
|
+
|
|
93
|
+
declare function AppProvider({ children, defaultLocale, fallbackLocale, defaultTimezone, systemTimezone, defaultTimeFormat, defaultDateFormat, timezoneOptions, storageKey, persist, onLocaleChange, onTimezoneChange, onTimeFormatChange, onDateFormatChange, }: AppProviderProp): react_jsx_runtime.JSX.Element;
|
|
94
|
+
declare function useAppContext(): AppContextValue;
|
|
95
|
+
/** Returns null outside AppProvider — used by pickers for optional context. */
|
|
96
|
+
declare function useOptionalAppContext(): AppContextValue | null;
|
|
97
|
+
/** Shorthand for `{ locale, setLocale }`. */
|
|
98
|
+
declare function useAppLocale(): {
|
|
99
|
+
locale: AppLocale;
|
|
100
|
+
fallbackLocale: AppLocale;
|
|
101
|
+
setLocale: (locale: AppLocale) => void;
|
|
102
|
+
dateFnsLocale: date_fns.Locale;
|
|
103
|
+
dayPickerLocale: Partial<react_day_picker.DayPickerLocale>;
|
|
104
|
+
};
|
|
105
|
+
/** Shorthand for `{ timezone, setTimezone }`. */
|
|
106
|
+
declare function useAppTimezone(): {
|
|
107
|
+
timezone: string;
|
|
108
|
+
setTimezone: (timezone: AppTimezone) => void;
|
|
109
|
+
};
|
|
110
|
+
/** Shorthand for `{ timeFormat, setTimeFormat }`. */
|
|
111
|
+
declare function useAppTimeFormat(): {
|
|
112
|
+
timeFormat: AppTimeFormat;
|
|
113
|
+
setTimeFormat: (timeFormat: AppTimeFormat) => void;
|
|
114
|
+
};
|
|
115
|
+
/** Shorthand for `{ dateFormat, setDateFormat }`. */
|
|
116
|
+
declare function useAppDateFormat(): {
|
|
117
|
+
dateFormat: AppDateFormat;
|
|
118
|
+
setDateFormat: (dateFormat: AppDateFormat) => void;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
/** Date/time formatters bound to the current AppProvider preferences. */
|
|
122
|
+
declare function useFormatting(): {
|
|
123
|
+
locale: AppLocale;
|
|
124
|
+
timezone: string;
|
|
125
|
+
timeFormat: AppTimeFormat;
|
|
126
|
+
dateFormat: AppDateFormat;
|
|
127
|
+
/** Primary formatter — auto-detect + AppProvider defaults. */
|
|
128
|
+
format: (value: Parameters<typeof formatDate>[0], options?: FormatDateOptions) => string;
|
|
129
|
+
formatDate: (value: Parameters<typeof formatDate>[0], options?: FormatDateOptions) => string;
|
|
130
|
+
formatCalendarDate: (value: Date | null | undefined, options?: FormatDateOptions) => string;
|
|
131
|
+
formatTime: (value: Parameters<typeof formatDate>[0], options?: FormatDateOptions) => string;
|
|
132
|
+
formatDateTime: (value: Parameters<typeof formatDate>[0], options?: FormatDateOptions) => string;
|
|
133
|
+
formatDateLong: (value: Parameters<typeof formatDate>[0], options?: FormatDateOptions) => string;
|
|
134
|
+
formatRelative: (value: Parameters<typeof formatDate>[0], options?: FormatDateOptions) => string;
|
|
135
|
+
formatTimeOfDay: (value: Parameters<typeof formatDate>[0], options?: FormatDateOptions) => string;
|
|
136
|
+
};
|
|
137
|
+
/** Alias for useFormatting — emphasises timezone-aware datetime helpers. */
|
|
138
|
+
declare const useDateTime: typeof useFormatting;
|
|
139
|
+
|
|
140
|
+
export { APP_DATE_FORMAT_OPTIONS, APP_LOCALE_CONFIG, APP_TIMEZONE_OPTIONS, 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, isKnownAppTimezone, isValidIanaTimezone, readStoredPreferences, resetAppRequestHeaders, resetIanaTimezoneCacheForTests, resolveDefaultDateFormat, resolveDefaultTimeFormat, resolveDefaultTimezone, resolveTimezoneForIntl, resolveTimezonePickerOptions, syncAppRequestHeaders, useAppContext, useAppDateFormat, useAppLocale, useAppTimeFormat, useAppTimezone, useDateTime, useFormatting, useOptionalAppContext, writeStoredPreferences };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useAppContext } from '../chunk-3F2AKYRD.js';
|
|
2
|
+
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 } from '../chunk-3F2AKYRD.js';
|
|
3
|
+
import { formatDate } from '../chunk-YFCQKO3B.js';
|
|
4
|
+
export { APP_DATE_FORMATS, APP_DATE_FORMAT_OPTIONS, APP_LOCALE_CONFIG, APP_REQUEST_HEADER_DATE_FORMAT, APP_REQUEST_HEADER_TIME_FORMAT, APP_TIME_FORMATS, detectFormatDateKind, formatAppDate, formatAppDateLong, formatAppDateTime, formatAppRelative, formatAppTime, formatCalendarDate, formatDate, formatTimeOfDay, getDateFnsLocale, getDateFormatLabel, getDatePattern, getDateTimePattern, getDatetimeContext, getDayPickerLocale, getTimePattern, isAppDateFormat, isAppLocale, isAppTimeFormat, isFormatDateValue, isValidHhmm, normalizeHhmm, parseDateInput, resolveDefaultDateFormat, syncDatetimeContext } from '../chunk-YFCQKO3B.js';
|
|
5
|
+
import { useMemo } from 'react';
|
|
6
|
+
|
|
7
|
+
function useFormatting() {
|
|
8
|
+
const { locale, timezone, timeFormat, dateFormat, dateFnsLocale } = useAppContext();
|
|
9
|
+
const defaults = useMemo(
|
|
10
|
+
() => ({ locale: dateFnsLocale, timezone, timeFormat, dateFormat }),
|
|
11
|
+
[dateFnsLocale, timezone, timeFormat, dateFormat]
|
|
12
|
+
);
|
|
13
|
+
const bind = useMemo(
|
|
14
|
+
() => (value, options) => formatDate(value, { ...defaults, ...options }),
|
|
15
|
+
[defaults]
|
|
16
|
+
);
|
|
17
|
+
return useMemo(
|
|
18
|
+
() => ({
|
|
19
|
+
locale,
|
|
20
|
+
timezone,
|
|
21
|
+
timeFormat,
|
|
22
|
+
dateFormat,
|
|
23
|
+
/** Primary formatter — auto-detect + AppProvider defaults. */
|
|
24
|
+
format: bind,
|
|
25
|
+
formatDate: bind,
|
|
26
|
+
formatCalendarDate: (value, options) => formatDate(value, { ...defaults, ...options, kind: "calendar" }),
|
|
27
|
+
formatTime: (value, options) => formatDate(value, { ...defaults, ...options, kind: "time" }),
|
|
28
|
+
formatDateTime: (value, options) => formatDate(value, { ...defaults, ...options, kind: "datetime" }),
|
|
29
|
+
formatDateLong: (value, options) => formatDate(value, { ...defaults, ...options, kind: "long" }),
|
|
30
|
+
formatRelative: (value, options) => formatDate(value, { ...defaults, ...options, kind: "relative" }),
|
|
31
|
+
formatTimeOfDay: (value, options) => formatDate(value, { ...defaults, ...options, kind: "time" })
|
|
32
|
+
}),
|
|
33
|
+
[locale, timezone, timeFormat, dateFormat, defaults, bind]
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
var useDateTime = useFormatting;
|
|
37
|
+
|
|
38
|
+
export { useDateTime, useFormatting };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Locale } from 'date-fns';
|
|
2
|
+
import { DayPickerProps } from 'react-day-picker';
|
|
3
|
+
import { h as AppLocale, l as AppTimezoneDefault, k as AppTimezone, j as AppTimeFormat, g as AppDateFormat, i as AppRequestHeaders } from './types-mvzYGrma.js';
|
|
4
|
+
import { C as ChildrenProp, a as ClassNameProp, D as DisabledProp, I as IdProp } from './shared.prop-BNRJc9K0.js';
|
|
5
|
+
|
|
6
|
+
/** App shell prop types — @see docs/COMPONENTS.md#app */
|
|
7
|
+
|
|
8
|
+
/** @see AppProvider */
|
|
9
|
+
type AppProviderProp = {
|
|
10
|
+
children: ChildrenProp;
|
|
11
|
+
/** Initial locale when nothing in storage. Default: `vi`. */
|
|
12
|
+
defaultLocale?: AppLocale;
|
|
13
|
+
/** Fallback when a translation key is missing. Default: `en`. */
|
|
14
|
+
fallbackLocale?: AppLocale;
|
|
15
|
+
/** Initial timezone: IANA id, `browser`, or `system`. Default: `browser`. */
|
|
16
|
+
defaultTimezone?: AppTimezoneDefault;
|
|
17
|
+
/** Backend/system timezone when `defaultTimezone` is `system`. */
|
|
18
|
+
systemTimezone?: AppTimezone;
|
|
19
|
+
/** Initial clock format. `"locale"` derives from `defaultLocale`. Default: `"locale"`. */
|
|
20
|
+
defaultTimeFormat?: AppTimeFormat | "locale";
|
|
21
|
+
/** Initial date display format. `"locale"` derives from `defaultLocale`. Default: `"locale"`. */
|
|
22
|
+
defaultDateFormat?: AppDateFormat | "locale";
|
|
23
|
+
/**
|
|
24
|
+
* IANA ids shown in `TimezonePicker`.
|
|
25
|
+
* Omit for the full IANA list; set to restrict (e.g. `APP_TIMEZONE_PRESET`).
|
|
26
|
+
*/
|
|
27
|
+
timezoneOptions?: readonly AppTimezone[];
|
|
28
|
+
/** localStorage key. Default: `godxjp.app`. */
|
|
29
|
+
storageKey?: string;
|
|
30
|
+
/** Persist user choices. Default: true. */
|
|
31
|
+
persist?: boolean;
|
|
32
|
+
onLocaleChange?: (locale: AppLocale) => void;
|
|
33
|
+
onTimezoneChange?: (timezone: AppTimezone) => void;
|
|
34
|
+
onTimeFormatChange?: (timeFormat: AppTimeFormat) => void;
|
|
35
|
+
onDateFormatChange?: (dateFormat: AppDateFormat) => void;
|
|
36
|
+
};
|
|
37
|
+
/** @see LocalePicker */
|
|
38
|
+
type LocalePickerProp = {
|
|
39
|
+
className?: ClassNameProp;
|
|
40
|
+
disabled?: DisabledProp;
|
|
41
|
+
id?: IdProp;
|
|
42
|
+
/** Controlled value; default reads/writes AppProvider. */
|
|
43
|
+
value?: AppLocale;
|
|
44
|
+
onChange?: (locale: AppLocale) => void;
|
|
45
|
+
};
|
|
46
|
+
/** @see TimezonePicker */
|
|
47
|
+
type TimezonePickerProp = {
|
|
48
|
+
className?: ClassNameProp;
|
|
49
|
+
disabled?: DisabledProp;
|
|
50
|
+
id?: IdProp;
|
|
51
|
+
value?: AppTimezone;
|
|
52
|
+
onChange?: (timezone: AppTimezone) => void;
|
|
53
|
+
/** Override AppProvider list; omit to use context or full IANA. */
|
|
54
|
+
options?: readonly AppTimezone[];
|
|
55
|
+
};
|
|
56
|
+
/** @see TimeFormatPicker */
|
|
57
|
+
type TimeFormatPickerProp = {
|
|
58
|
+
className?: ClassNameProp;
|
|
59
|
+
disabled?: DisabledProp;
|
|
60
|
+
id?: IdProp;
|
|
61
|
+
value?: AppTimeFormat;
|
|
62
|
+
onChange?: (timeFormat: AppTimeFormat) => void;
|
|
63
|
+
};
|
|
64
|
+
/** @see DateFormatPicker */
|
|
65
|
+
type DateFormatPickerProp = {
|
|
66
|
+
className?: ClassNameProp;
|
|
67
|
+
disabled?: DisabledProp;
|
|
68
|
+
id?: IdProp;
|
|
69
|
+
value?: AppDateFormat;
|
|
70
|
+
onChange?: (dateFormat: AppDateFormat) => void;
|
|
71
|
+
};
|
|
72
|
+
/** Value exposed by `useAppContext`. */
|
|
73
|
+
type AppContextValue = {
|
|
74
|
+
locale: AppLocale;
|
|
75
|
+
fallbackLocale: AppLocale;
|
|
76
|
+
timezone: AppTimezone;
|
|
77
|
+
timeFormat: AppTimeFormat;
|
|
78
|
+
dateFormat: AppDateFormat;
|
|
79
|
+
dateFnsLocale: Locale;
|
|
80
|
+
dayPickerLocale: NonNullable<DayPickerProps["locale"]>;
|
|
81
|
+
requestHeaders: AppRequestHeaders;
|
|
82
|
+
/** Configured picker list; `undefined` → full IANA in TimezonePicker. */
|
|
83
|
+
timezoneOptions?: readonly AppTimezone[];
|
|
84
|
+
setLocale: (locale: AppLocale) => void;
|
|
85
|
+
setTimezone: (timezone: AppTimezone) => void;
|
|
86
|
+
setTimeFormat: (timeFormat: AppTimeFormat) => void;
|
|
87
|
+
setDateFormat: (dateFormat: AppDateFormat) => void;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export type { AppContextValue as A, DateFormatPickerProp as D, LocalePickerProp as L, TimeFormatPickerProp as T, AppProviderProp as a, TimezonePickerProp as b };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
import { c as CheckboxGroupProp } from './data-entry.prop-BEGA1lTq.js';
|
|
5
|
+
|
|
6
|
+
declare function CheckboxGroup({ value: controlledValue, defaultValue, onChange, options, orientation, disabled, name, className, children, }: CheckboxGroupProp): react_jsx_runtime.JSX.Element;
|
|
7
|
+
|
|
8
|
+
/** Checkbox — dùng standalone hoặc `Checkbox.Group` với `options` (Ant Design style). */
|
|
9
|
+
declare const Checkbox: React.ForwardRefExoticComponent<Omit<CheckboxPrimitive.CheckboxProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>> & {
|
|
10
|
+
Group: typeof CheckboxGroup;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export { Checkbox as C, CheckboxGroup as a };
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { normalizeTreeOptions, collectAllExpandableKeys, filterVisibleTree, flattenVisibleTree, findNodeByValue, reactNodeText, getDescendantValues } from './chunk-SMLKNECP.js';
|
|
2
|
+
import { Checkbox } from './chunk-E76QIYSY.js';
|
|
3
|
+
import { Command, CommandInput } from './chunk-V6UWJKZF.js';
|
|
4
|
+
import { Popover, PopoverTrigger, PopoverContent } from './chunk-DY5C44UP.js';
|
|
5
|
+
import { ScrollArea } from './chunk-3KPEZ5CF.js';
|
|
6
|
+
import { Button } from './chunk-HJEBRCXL.js';
|
|
7
|
+
import { useTranslation } from './chunk-3F2AKYRD.js';
|
|
8
|
+
import { cn } from './chunk-U7N2A7A3.js';
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
import { X, ChevronsUpDown, ChevronDown, ChevronRight } from 'lucide-react';
|
|
11
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
12
|
+
|
|
13
|
+
// src/components/data-entry/tree-select-strategy.ts
|
|
14
|
+
var SHOW_CHILD = "SHOW_CHILD";
|
|
15
|
+
var SHOW_PARENT = "SHOW_PARENT";
|
|
16
|
+
var SHOW_ALL = "SHOW_ALL";
|
|
17
|
+
function toArray(value) {
|
|
18
|
+
if (value == null) return [];
|
|
19
|
+
return Array.isArray(value) ? value : [value];
|
|
20
|
+
}
|
|
21
|
+
function displayValues(values, options, showCheckedStrategy, treeCheckStrictly) {
|
|
22
|
+
if (treeCheckStrictly || showCheckedStrategy === SHOW_ALL) return values;
|
|
23
|
+
if (showCheckedStrategy === SHOW_PARENT) {
|
|
24
|
+
const filtered = values.filter((v) => {
|
|
25
|
+
const node = findNodeByValue(options, v);
|
|
26
|
+
if (!node?.children?.length) return true;
|
|
27
|
+
const desc = getDescendantValues(node).slice(1);
|
|
28
|
+
return !desc.every((d) => values.includes(d));
|
|
29
|
+
});
|
|
30
|
+
return filtered.length ? filtered : values;
|
|
31
|
+
}
|
|
32
|
+
return values.filter((v) => {
|
|
33
|
+
const node = findNodeByValue(options, v);
|
|
34
|
+
return !node?.children?.length;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function TreeSelectRoot({
|
|
38
|
+
treeData: treeDataProp,
|
|
39
|
+
value,
|
|
40
|
+
defaultValue,
|
|
41
|
+
onChange,
|
|
42
|
+
multiple,
|
|
43
|
+
treeCheckable,
|
|
44
|
+
treeCheckStrictly,
|
|
45
|
+
showSearch,
|
|
46
|
+
showCheckedStrategy = SHOW_CHILD,
|
|
47
|
+
treeDefaultExpandAll,
|
|
48
|
+
placeholder,
|
|
49
|
+
disabled,
|
|
50
|
+
allowClear = true,
|
|
51
|
+
className,
|
|
52
|
+
id,
|
|
53
|
+
fieldNames
|
|
54
|
+
}) {
|
|
55
|
+
const { t } = useTranslation();
|
|
56
|
+
const options = React.useMemo(
|
|
57
|
+
() => normalizeTreeOptions(treeDataProp, fieldNames),
|
|
58
|
+
[treeDataProp, fieldNames]
|
|
59
|
+
);
|
|
60
|
+
const checkable = treeCheckable ?? multiple;
|
|
61
|
+
const [open, setOpen] = React.useState(false);
|
|
62
|
+
const [search, setSearch] = React.useState("");
|
|
63
|
+
const [expandedKeys, setExpandedKeys] = React.useState(
|
|
64
|
+
() => new Set(treeDefaultExpandAll ? collectAllExpandableKeys(options) : [])
|
|
65
|
+
);
|
|
66
|
+
const isControlled = value !== void 0;
|
|
67
|
+
const [internal, setInternal] = React.useState(() => toArray(defaultValue));
|
|
68
|
+
const selected = isControlled ? toArray(value) : internal;
|
|
69
|
+
const resolvedPlaceholder = placeholder ?? t("dataEntry.treeSelect.placeholder");
|
|
70
|
+
const visible = React.useMemo(() => {
|
|
71
|
+
if (showSearch && search.trim()) return filterVisibleTree(options, search);
|
|
72
|
+
return flattenVisibleTree(options, expandedKeys);
|
|
73
|
+
}, [options, expandedKeys, search, showSearch]);
|
|
74
|
+
const commit = (next) => {
|
|
75
|
+
if (!isControlled) setInternal(next);
|
|
76
|
+
onChange?.(checkable || multiple ? next : next[0] ?? void 0);
|
|
77
|
+
};
|
|
78
|
+
const toggleExpand = (key) => {
|
|
79
|
+
setExpandedKeys((prev) => {
|
|
80
|
+
const next = new Set(prev);
|
|
81
|
+
if (next.has(key)) next.delete(key);
|
|
82
|
+
else next.add(key);
|
|
83
|
+
return next;
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
const toggleSelect = (node) => {
|
|
87
|
+
if (node.disabled) return;
|
|
88
|
+
const key = node.value;
|
|
89
|
+
if (!checkable && !multiple) {
|
|
90
|
+
commit([key]);
|
|
91
|
+
setOpen(false);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const isOn = selected.includes(key);
|
|
95
|
+
let next;
|
|
96
|
+
if (treeCheckStrictly) {
|
|
97
|
+
next = isOn ? selected.filter((v) => v !== key) : [...selected, key];
|
|
98
|
+
} else {
|
|
99
|
+
const related = getDescendantValues(node);
|
|
100
|
+
next = isOn ? selected.filter((v) => !related.includes(v)) : [.../* @__PURE__ */ new Set([...selected, ...related])];
|
|
101
|
+
}
|
|
102
|
+
commit(next);
|
|
103
|
+
};
|
|
104
|
+
const displayKeys = displayValues(selected, options, showCheckedStrategy, treeCheckStrictly);
|
|
105
|
+
const displayLabel = displayKeys.map((v) => {
|
|
106
|
+
const label = findNodeByValue(options, v)?.label;
|
|
107
|
+
return label ? reactNodeText(label) : v;
|
|
108
|
+
}).join(", ");
|
|
109
|
+
const clearValue = (e) => {
|
|
110
|
+
e.stopPropagation();
|
|
111
|
+
commit([]);
|
|
112
|
+
};
|
|
113
|
+
return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
|
|
114
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
115
|
+
Button,
|
|
116
|
+
{
|
|
117
|
+
id,
|
|
118
|
+
type: "button",
|
|
119
|
+
variant: "outline",
|
|
120
|
+
role: "combobox",
|
|
121
|
+
"aria-expanded": open,
|
|
122
|
+
disabled,
|
|
123
|
+
className: cn(
|
|
124
|
+
"w-full justify-between font-normal",
|
|
125
|
+
!displayKeys.length && "text-muted-foreground",
|
|
126
|
+
className
|
|
127
|
+
),
|
|
128
|
+
children: [
|
|
129
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: displayKeys.length ? displayLabel : resolvedPlaceholder }),
|
|
130
|
+
/* @__PURE__ */ jsxs("span", { className: "ml-2 flex shrink-0 items-center gap-1", children: [
|
|
131
|
+
allowClear && displayKeys.length > 0 && !disabled && /* @__PURE__ */ jsx(
|
|
132
|
+
X,
|
|
133
|
+
{
|
|
134
|
+
className: "size-4 opacity-50 hover:opacity-100",
|
|
135
|
+
"aria-hidden": "true",
|
|
136
|
+
onClick: clearValue
|
|
137
|
+
}
|
|
138
|
+
),
|
|
139
|
+
/* @__PURE__ */ jsx(ChevronsUpDown, { className: "size-4 opacity-50", "aria-hidden": "true" })
|
|
140
|
+
] })
|
|
141
|
+
]
|
|
142
|
+
}
|
|
143
|
+
) }),
|
|
144
|
+
/* @__PURE__ */ jsxs(PopoverContent, { className: "w-[var(--radix-popover-trigger-width)] p-0", align: "start", children: [
|
|
145
|
+
showSearch && /* @__PURE__ */ jsx("div", { className: "border-b p-2", children: /* @__PURE__ */ jsx(Command, { shouldFilter: false, children: /* @__PURE__ */ jsx(
|
|
146
|
+
CommandInput,
|
|
147
|
+
{
|
|
148
|
+
placeholder: t("dataEntry.treeSelect.searchPlaceholder"),
|
|
149
|
+
value: search,
|
|
150
|
+
onValueChange: setSearch
|
|
151
|
+
}
|
|
152
|
+
) }) }),
|
|
153
|
+
/* @__PURE__ */ jsx(ScrollArea, { className: "max-h-[min(300px,50vh)]", children: /* @__PURE__ */ jsx(
|
|
154
|
+
"div",
|
|
155
|
+
{
|
|
156
|
+
role: "tree",
|
|
157
|
+
"aria-multiselectable": Boolean(checkable) || Boolean(multiple),
|
|
158
|
+
className: "p-1",
|
|
159
|
+
children: visible.length === 0 ? /* @__PURE__ */ jsx("p", { className: "text-muted-foreground py-6 text-center text-sm", children: t("dataEntry.treeSelect.empty") }) : visible.map(({ node, depth, hasChildren }) => {
|
|
160
|
+
const expanded = expandedKeys.has(node.value);
|
|
161
|
+
const isSelected = selected.includes(node.value);
|
|
162
|
+
return /* @__PURE__ */ jsxs(
|
|
163
|
+
"div",
|
|
164
|
+
{
|
|
165
|
+
role: "treeitem",
|
|
166
|
+
"aria-expanded": hasChildren ? expanded : void 0,
|
|
167
|
+
"aria-selected": isSelected,
|
|
168
|
+
className: cn(
|
|
169
|
+
"flex items-center rounded-sm py-1.5 pr-2 text-sm outline-none",
|
|
170
|
+
"hover:bg-accent hover:text-accent-foreground",
|
|
171
|
+
isSelected && "bg-accent/60",
|
|
172
|
+
node.disabled && "pointer-events-none opacity-50"
|
|
173
|
+
),
|
|
174
|
+
style: { paddingLeft: `${depth * 1.25 + 0.5}rem` },
|
|
175
|
+
children: [
|
|
176
|
+
/* @__PURE__ */ jsx(
|
|
177
|
+
"button",
|
|
178
|
+
{
|
|
179
|
+
type: "button",
|
|
180
|
+
tabIndex: -1,
|
|
181
|
+
"aria-label": expanded ? t("dataEntry.treeSelect.collapse") : t("dataEntry.treeSelect.expand"),
|
|
182
|
+
className: cn(
|
|
183
|
+
"mr-1 flex size-5 shrink-0 items-center justify-center rounded-sm",
|
|
184
|
+
!hasChildren && "invisible"
|
|
185
|
+
),
|
|
186
|
+
onClick: () => toggleExpand(node.value),
|
|
187
|
+
children: expanded ? /* @__PURE__ */ jsx(ChevronDown, { className: "size-4", "aria-hidden": "true" }) : /* @__PURE__ */ jsx(ChevronRight, { className: "size-4", "aria-hidden": "true" })
|
|
188
|
+
}
|
|
189
|
+
),
|
|
190
|
+
checkable ? /* @__PURE__ */ jsxs("label", { className: "flex flex-1 cursor-pointer items-center gap-2", children: [
|
|
191
|
+
/* @__PURE__ */ jsx(
|
|
192
|
+
Checkbox,
|
|
193
|
+
{
|
|
194
|
+
checked: isSelected,
|
|
195
|
+
disabled: Boolean(node.disabled) || Boolean(node.disableCheckbox),
|
|
196
|
+
onCheckedChange: () => toggleSelect(node)
|
|
197
|
+
}
|
|
198
|
+
),
|
|
199
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: node.label })
|
|
200
|
+
] }) : /* @__PURE__ */ jsx(
|
|
201
|
+
"button",
|
|
202
|
+
{
|
|
203
|
+
type: "button",
|
|
204
|
+
className: "flex-1 truncate text-left",
|
|
205
|
+
disabled: node.disabled,
|
|
206
|
+
onClick: () => toggleSelect(node),
|
|
207
|
+
children: node.label
|
|
208
|
+
}
|
|
209
|
+
)
|
|
210
|
+
]
|
|
211
|
+
},
|
|
212
|
+
node.value
|
|
213
|
+
);
|
|
214
|
+
})
|
|
215
|
+
}
|
|
216
|
+
) })
|
|
217
|
+
] })
|
|
218
|
+
] });
|
|
219
|
+
}
|
|
220
|
+
var TreeSelect = Object.assign(TreeSelectRoot, {
|
|
221
|
+
SHOW_CHILD,
|
|
222
|
+
SHOW_PARENT,
|
|
223
|
+
SHOW_ALL
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
export { SHOW_ALL, SHOW_CHILD, SHOW_PARENT, TreeSelect };
|