@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
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import type { ComponentType, ReactNode, SVGProps } from "react";
|
|
2
|
-
|
|
3
|
-
import { Badge } from "../data-display/badge";
|
|
4
|
-
|
|
5
|
-
export type MobileFrameNavItem = {
|
|
6
|
-
label: string;
|
|
7
|
-
icon: ComponentType<SVGProps<SVGSVGElement>>;
|
|
8
|
-
active?: boolean;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export type MobileFrameProps = {
|
|
12
|
-
title: string;
|
|
13
|
-
subtitle?: string;
|
|
14
|
-
status?: string;
|
|
15
|
-
children: ReactNode;
|
|
16
|
-
navItems?: MobileFrameNavItem[];
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export function MobileFrame({
|
|
20
|
-
title,
|
|
21
|
-
subtitle,
|
|
22
|
-
status,
|
|
23
|
-
children,
|
|
24
|
-
navItems = [],
|
|
25
|
-
}: MobileFrameProps) {
|
|
26
|
-
return (
|
|
27
|
-
<div className="ui-mobile-stage">
|
|
28
|
-
<div className="ui-mobile-frame">
|
|
29
|
-
<header className="ui-mobile-header">
|
|
30
|
-
<div>
|
|
31
|
-
<div className="ui-mobile-title">{title}</div>
|
|
32
|
-
{subtitle ? <div className="ui-mobile-subtitle">{subtitle}</div> : null}
|
|
33
|
-
</div>
|
|
34
|
-
{status ? <Badge variant="secondary">{status}</Badge> : null}
|
|
35
|
-
</header>
|
|
36
|
-
<main className="ui-mobile-main">{children}</main>
|
|
37
|
-
{navItems.length > 0 ? (
|
|
38
|
-
<footer className="ui-mobile-nav">
|
|
39
|
-
{navItems.map((item) => {
|
|
40
|
-
const Icon = item.icon;
|
|
41
|
-
return (
|
|
42
|
-
<div
|
|
43
|
-
className="ui-mobile-nav-item"
|
|
44
|
-
data-active={item.active ? "true" : undefined}
|
|
45
|
-
key={item.label}
|
|
46
|
-
>
|
|
47
|
-
<Icon aria-hidden="true" />
|
|
48
|
-
<span>{item.label}</span>
|
|
49
|
-
</div>
|
|
50
|
-
);
|
|
51
|
-
})}
|
|
52
|
-
</footer>
|
|
53
|
-
) : null}
|
|
54
|
-
</div>
|
|
55
|
-
</div>
|
|
56
|
-
);
|
|
57
|
-
}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
/** PageContainer — mandatory shell for every admin page (Ant Design PageHeader equivalent). */
|
|
2
|
-
import { Link } from "react-router-dom";
|
|
3
|
-
import { ChevronRight } from "lucide-react";
|
|
4
|
-
|
|
5
|
-
import { cn } from "../../lib/utils";
|
|
6
|
-
import { densityClass, pageContainerVariantClass } from "../../lib/variants";
|
|
7
|
-
import type { PageContainerProp } from "../../props/components/layout.prop";
|
|
8
|
-
|
|
9
|
-
export type {
|
|
10
|
-
PageContainerProp,
|
|
11
|
-
PageContainerProp as PageContainerProps,
|
|
12
|
-
} from "../../props/components/layout.prop";
|
|
13
|
-
export type {
|
|
14
|
-
BreadcrumbItemProp,
|
|
15
|
-
BreadcrumbItemProp as BreadcrumbItem,
|
|
16
|
-
} from "../../props/vocabulary/navigation.prop";
|
|
17
|
-
|
|
18
|
-
export function PageContainer({
|
|
19
|
-
title,
|
|
20
|
-
subtitle,
|
|
21
|
-
extra,
|
|
22
|
-
footer,
|
|
23
|
-
breadcrumb,
|
|
24
|
-
density = "default",
|
|
25
|
-
variant = "default",
|
|
26
|
-
stickyFooter = false,
|
|
27
|
-
children,
|
|
28
|
-
className,
|
|
29
|
-
}: PageContainerProp) {
|
|
30
|
-
return (
|
|
31
|
-
<div
|
|
32
|
-
className={cn(
|
|
33
|
-
"ui-page-container",
|
|
34
|
-
densityClass[density],
|
|
35
|
-
pageContainerVariantClass[variant],
|
|
36
|
-
stickyFooter && "ui-page-container--sticky-footer",
|
|
37
|
-
className,
|
|
38
|
-
)}
|
|
39
|
-
>
|
|
40
|
-
<header className="ui-page-header">
|
|
41
|
-
{breadcrumb && breadcrumb.length > 0 && (
|
|
42
|
-
<nav aria-label="Breadcrumb" className="ui-breadcrumb">
|
|
43
|
-
<ol className="ui-breadcrumb-list">
|
|
44
|
-
{breadcrumb.map((item, i) => {
|
|
45
|
-
const isLast = i === breadcrumb.length - 1;
|
|
46
|
-
return (
|
|
47
|
-
<li key={i} className="ui-inline-xs">
|
|
48
|
-
{item.to && !isLast ? (
|
|
49
|
-
<Link to={item.to} className="hover:text-foreground hover:underline">
|
|
50
|
-
{item.label}
|
|
51
|
-
</Link>
|
|
52
|
-
) : (
|
|
53
|
-
<span
|
|
54
|
-
className={isLast ? "text-foreground" : ""}
|
|
55
|
-
aria-current={isLast ? "page" : undefined}
|
|
56
|
-
>
|
|
57
|
-
{item.label}
|
|
58
|
-
</span>
|
|
59
|
-
)}
|
|
60
|
-
{!isLast && <ChevronRight className="size-3" aria-hidden="true" />}
|
|
61
|
-
</li>
|
|
62
|
-
);
|
|
63
|
-
})}
|
|
64
|
-
</ol>
|
|
65
|
-
</nav>
|
|
66
|
-
)}
|
|
67
|
-
<div className="ui-page-header-row">
|
|
68
|
-
<div className="min-w-0">
|
|
69
|
-
<h1 className="ui-page-title">{title}</h1>
|
|
70
|
-
{subtitle && <p className="ui-page-subtitle">{subtitle}</p>}
|
|
71
|
-
</div>
|
|
72
|
-
{extra && <div className="ui-page-header-extra">{extra}</div>}
|
|
73
|
-
</div>
|
|
74
|
-
</header>
|
|
75
|
-
|
|
76
|
-
{children != null && <div className="ui-page-body">{children}</div>}
|
|
77
|
-
|
|
78
|
-
{footer && <footer className="ui-page-footer">{footer}</footer>}
|
|
79
|
-
</div>
|
|
80
|
-
);
|
|
81
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/** Horizontal padding aligned with PageContainer header — use inside `variant="flush"`. */
|
|
2
|
-
import { cn } from "../../lib/utils";
|
|
3
|
-
import type { PageInsetProp } from "../../props/components/layout.prop";
|
|
4
|
-
|
|
5
|
-
export type {
|
|
6
|
-
PageInsetProp,
|
|
7
|
-
PageInsetProp as PageInsetProps,
|
|
8
|
-
} from "../../props/components/layout.prop";
|
|
9
|
-
|
|
10
|
-
export function PageInset({ className, children, ...props }: PageInsetProp) {
|
|
11
|
-
return (
|
|
12
|
-
<div className={cn("ui-page-inset", className)} {...props}>
|
|
13
|
-
{children}
|
|
14
|
-
</div>
|
|
15
|
-
);
|
|
16
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
2
|
-
|
|
3
|
-
export type ResponsiveGridProps = {
|
|
4
|
-
columns?: 2 | 3 | 4;
|
|
5
|
-
children: ReactNode;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export function ResponsiveGrid({ columns = 3, children }: ResponsiveGridProps) {
|
|
9
|
-
return (
|
|
10
|
-
<div className="ui-responsive-grid" data-columns={columns}>
|
|
11
|
-
{children}
|
|
12
|
-
</div>
|
|
13
|
-
);
|
|
14
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
2
|
-
|
|
3
|
-
import { AppShell } from "./app-shell";
|
|
4
|
-
import { Topbar } from "./topbar";
|
|
5
|
-
|
|
6
|
-
export type ShellAppProps = {
|
|
7
|
-
menu: ReactNode;
|
|
8
|
-
breadcrumb?: ReactNode;
|
|
9
|
-
children: ReactNode;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export function ShellApp({ menu, breadcrumb, children }: ShellAppProps) {
|
|
13
|
-
return (
|
|
14
|
-
<AppShell
|
|
15
|
-
sidebar={menu}
|
|
16
|
-
breadcrumb={breadcrumb}
|
|
17
|
-
topbar={
|
|
18
|
-
<Topbar
|
|
19
|
-
product={{ name: "GodX", color: "hsl(var(--attention))" }}
|
|
20
|
-
project={{ name: "Japan to SEA lanes" }}
|
|
21
|
-
onSearchOpen={() => undefined}
|
|
22
|
-
onNotificationsOpen={() => undefined}
|
|
23
|
-
unread
|
|
24
|
-
/>
|
|
25
|
-
}
|
|
26
|
-
>
|
|
27
|
-
{children}
|
|
28
|
-
</AppShell>
|
|
29
|
-
);
|
|
30
|
-
}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { ChevronDown } from "lucide-react";
|
|
2
|
-
|
|
3
|
-
import { cn } from "../../lib/utils";
|
|
4
|
-
import type { SidebarProp } from "../../props/components/layout.prop";
|
|
5
|
-
|
|
6
|
-
export type {
|
|
7
|
-
SidebarItemProp as SidebarItem,
|
|
8
|
-
SidebarProductProp as SidebarProduct,
|
|
9
|
-
SidebarProp,
|
|
10
|
-
SidebarProp as SidebarProps,
|
|
11
|
-
SidebarSectionProp as SidebarSection,
|
|
12
|
-
} from "../../props/components/layout.prop";
|
|
13
|
-
|
|
14
|
-
export function Sidebar({
|
|
15
|
-
activeId,
|
|
16
|
-
onSelect,
|
|
17
|
-
sections,
|
|
18
|
-
product,
|
|
19
|
-
onProductClick,
|
|
20
|
-
brand,
|
|
21
|
-
collapsed = false,
|
|
22
|
-
footer,
|
|
23
|
-
}: SidebarProp) {
|
|
24
|
-
return (
|
|
25
|
-
<div className="sb-root" data-collapsed={collapsed ? "true" : undefined}>
|
|
26
|
-
{brand !== undefined ? (
|
|
27
|
-
<div className="sb-brand">{brand}</div>
|
|
28
|
-
) : product ? (
|
|
29
|
-
<button
|
|
30
|
-
type="button"
|
|
31
|
-
className="sb-product"
|
|
32
|
-
onClick={onProductClick}
|
|
33
|
-
aria-label={product.name}
|
|
34
|
-
>
|
|
35
|
-
<span
|
|
36
|
-
className="sb-logo-mark"
|
|
37
|
-
style={{ background: product.color ?? "hsl(var(--attention))" }}
|
|
38
|
-
>
|
|
39
|
-
{product.name[0]?.toUpperCase() ?? "?"}
|
|
40
|
-
</span>
|
|
41
|
-
{!collapsed && (
|
|
42
|
-
<span className="sb-product-meta">
|
|
43
|
-
<span className="sb-product-name">{product.name}</span>
|
|
44
|
-
{product.role ? <span className="sb-product-tenant">{product.role}</span> : null}
|
|
45
|
-
</span>
|
|
46
|
-
)}
|
|
47
|
-
{!collapsed && (
|
|
48
|
-
<span className="sb-product-caret">
|
|
49
|
-
<ChevronDown aria-hidden="true" />
|
|
50
|
-
</span>
|
|
51
|
-
)}
|
|
52
|
-
</button>
|
|
53
|
-
) : null}
|
|
54
|
-
|
|
55
|
-
<div className="sb-nav-scroll">
|
|
56
|
-
{sections.map((section, sectionIndex) => (
|
|
57
|
-
<div className="sb-section" key={section.label ?? sectionIndex}>
|
|
58
|
-
{section.label && !collapsed ? (
|
|
59
|
-
<div className="sb-section-label">{section.label}</div>
|
|
60
|
-
) : null}
|
|
61
|
-
<div className="sb-nav" role="navigation">
|
|
62
|
-
{section.items.map((item) => {
|
|
63
|
-
const Icon = item.icon;
|
|
64
|
-
const isActive = item.id === activeId;
|
|
65
|
-
|
|
66
|
-
return (
|
|
67
|
-
<button
|
|
68
|
-
type="button"
|
|
69
|
-
className={cn("sb-nav-item")}
|
|
70
|
-
data-active={isActive ? "true" : undefined}
|
|
71
|
-
aria-current={isActive ? "page" : undefined}
|
|
72
|
-
aria-disabled={item.disabled}
|
|
73
|
-
aria-label={collapsed ? item.label : undefined}
|
|
74
|
-
title={collapsed ? item.label : undefined}
|
|
75
|
-
key={item.id}
|
|
76
|
-
onClick={() => {
|
|
77
|
-
if (!item.disabled) onSelect?.(item.id);
|
|
78
|
-
}}
|
|
79
|
-
>
|
|
80
|
-
<span className="sb-icon">
|
|
81
|
-
<Icon aria-hidden="true" />
|
|
82
|
-
</span>
|
|
83
|
-
{!collapsed && <span className="sb-label">{item.label}</span>}
|
|
84
|
-
{!collapsed && item.badge !== undefined && item.badge !== "" ? (
|
|
85
|
-
<span className="sb-badge">{item.badge}</span>
|
|
86
|
-
) : null}
|
|
87
|
-
</button>
|
|
88
|
-
);
|
|
89
|
-
})}
|
|
90
|
-
</div>
|
|
91
|
-
</div>
|
|
92
|
-
))}
|
|
93
|
-
</div>
|
|
94
|
-
|
|
95
|
-
{footer ? <div className="sb-footer">{footer}</div> : null}
|
|
96
|
-
</div>
|
|
97
|
-
);
|
|
98
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
2
|
-
|
|
3
|
-
export type SplitPaneProps = {
|
|
4
|
-
children: ReactNode;
|
|
5
|
-
aside: ReactNode;
|
|
6
|
-
asideWidth?: "sm" | "md";
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export function SplitPane({ children, aside, asideWidth = "md" }: SplitPaneProps) {
|
|
10
|
-
return (
|
|
11
|
-
<div className="ui-split-pane" data-aside-width={asideWidth}>
|
|
12
|
-
<div className="ui-split-pane-main">{children}</div>
|
|
13
|
-
<aside className="ui-split-pane-aside">{aside}</aside>
|
|
14
|
-
</div>
|
|
15
|
-
);
|
|
16
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { cn } from "../../lib/utils";
|
|
2
|
-
import { stackGapClass } from "../../lib/variants";
|
|
3
|
-
import type { StackProp } from "../../props/components/layout.prop";
|
|
4
|
-
|
|
5
|
-
export type { StackProp, StackProp as StackProps } from "../../props/components/layout.prop";
|
|
6
|
-
|
|
7
|
-
export function Stack({ gap = "md", className, children, ...props }: StackProp) {
|
|
8
|
-
return (
|
|
9
|
-
<div className={cn(stackGapClass[gap], className)} {...props}>
|
|
10
|
-
{children}
|
|
11
|
-
</div>
|
|
12
|
-
);
|
|
13
|
-
}
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Bell,
|
|
3
|
-
ChevronDown,
|
|
4
|
-
PanelLeftClose,
|
|
5
|
-
PanelLeftOpen,
|
|
6
|
-
Search,
|
|
7
|
-
SlidersHorizontal,
|
|
8
|
-
} from "lucide-react";
|
|
9
|
-
|
|
10
|
-
import type { TopbarProp } from "../../props/components/layout.prop";
|
|
11
|
-
|
|
12
|
-
export type {
|
|
13
|
-
TopbarProductProp as TopbarProduct,
|
|
14
|
-
TopbarProjectProp as TopbarProject,
|
|
15
|
-
TopbarProp,
|
|
16
|
-
TopbarProp as TopbarProps,
|
|
17
|
-
} from "../../props/components/layout.prop";
|
|
18
|
-
|
|
19
|
-
export function Topbar({
|
|
20
|
-
product,
|
|
21
|
-
project,
|
|
22
|
-
onProductOpen,
|
|
23
|
-
onProjectOpen,
|
|
24
|
-
onSearchOpen,
|
|
25
|
-
onTweaksOpen,
|
|
26
|
-
collapsed = false,
|
|
27
|
-
onToggleCollapsed,
|
|
28
|
-
rightSlot,
|
|
29
|
-
unread = false,
|
|
30
|
-
onNotificationsOpen,
|
|
31
|
-
user,
|
|
32
|
-
}: TopbarProp) {
|
|
33
|
-
return (
|
|
34
|
-
<>
|
|
35
|
-
{onToggleCollapsed ? (
|
|
36
|
-
<button
|
|
37
|
-
type="button"
|
|
38
|
-
className="tb-icon-btn"
|
|
39
|
-
aria-label="Toggle sidebar"
|
|
40
|
-
aria-pressed={collapsed}
|
|
41
|
-
onClick={onToggleCollapsed}
|
|
42
|
-
>
|
|
43
|
-
{collapsed ? <PanelLeftOpen aria-hidden="true" /> : <PanelLeftClose aria-hidden="true" />}
|
|
44
|
-
</button>
|
|
45
|
-
) : null}
|
|
46
|
-
|
|
47
|
-
<div className="tb-switcher">
|
|
48
|
-
<button type="button" className="tb-chip" aria-label={product.name} onClick={onProductOpen}>
|
|
49
|
-
<span
|
|
50
|
-
className="tb-chip-icon"
|
|
51
|
-
style={{ background: product.color ?? "hsl(var(--attention))" }}
|
|
52
|
-
>
|
|
53
|
-
{product.name[0]?.toUpperCase() ?? "?"}
|
|
54
|
-
</span>
|
|
55
|
-
<span className="tb-chip-label">{product.name}</span>
|
|
56
|
-
<span className="tb-chip-caret">
|
|
57
|
-
<ChevronDown aria-hidden="true" />
|
|
58
|
-
</span>
|
|
59
|
-
</button>
|
|
60
|
-
<span className="tb-chip-sep">/</span>
|
|
61
|
-
<button
|
|
62
|
-
type="button"
|
|
63
|
-
className={`tb-chip ${project ? "" : "tb-chip-empty"}`}
|
|
64
|
-
aria-label={project ? project.name : "Pick project"}
|
|
65
|
-
onClick={onProjectOpen}
|
|
66
|
-
>
|
|
67
|
-
<span className="tb-chip-label">{project ? project.name : "Pick project"}</span>
|
|
68
|
-
<span className="tb-chip-caret">
|
|
69
|
-
<ChevronDown aria-hidden="true" />
|
|
70
|
-
</span>
|
|
71
|
-
</button>
|
|
72
|
-
</div>
|
|
73
|
-
|
|
74
|
-
<button type="button" className="tb-search" onClick={onSearchOpen}>
|
|
75
|
-
<Search aria-hidden="true" />
|
|
76
|
-
<span>Search...</span>
|
|
77
|
-
<kbd className="kbd">⌘K</kbd>
|
|
78
|
-
</button>
|
|
79
|
-
|
|
80
|
-
{rightSlot}
|
|
81
|
-
|
|
82
|
-
{onNotificationsOpen ? (
|
|
83
|
-
<button
|
|
84
|
-
type="button"
|
|
85
|
-
className="tb-icon-btn tb-bell"
|
|
86
|
-
aria-label="Notifications"
|
|
87
|
-
onClick={onNotificationsOpen}
|
|
88
|
-
>
|
|
89
|
-
<Bell aria-hidden="true" />
|
|
90
|
-
{unread ? <span className="tb-bell-dot" aria-hidden="true" /> : null}
|
|
91
|
-
</button>
|
|
92
|
-
) : null}
|
|
93
|
-
|
|
94
|
-
{user}
|
|
95
|
-
|
|
96
|
-
{onTweaksOpen ? (
|
|
97
|
-
<button
|
|
98
|
-
type="button"
|
|
99
|
-
className="tb-icon-btn"
|
|
100
|
-
aria-label="Open tweaks"
|
|
101
|
-
onClick={onTweaksOpen}
|
|
102
|
-
>
|
|
103
|
-
<SlidersHorizontal aria-hidden="true" />
|
|
104
|
-
</button>
|
|
105
|
-
) : null}
|
|
106
|
-
</>
|
|
107
|
-
);
|
|
108
|
-
}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it, vi } from "vitest";
|
|
2
|
-
import { render, screen } from "@testing-library/react";
|
|
3
|
-
import userEvent from "@testing-library/user-event";
|
|
4
|
-
import { AppProvider } from "../../../app/app-provider";
|
|
5
|
-
import { LocalePicker } from "../locale-picker";
|
|
6
|
-
import { DateFormatPicker } from "../date-format-picker";
|
|
7
|
-
import { TimeFormatPicker } from "../time-format-picker";
|
|
8
|
-
import { TimezonePicker } from "../timezone-picker";
|
|
9
|
-
|
|
10
|
-
describe("LocalePicker", () => {
|
|
11
|
-
it("renders current locale from AppProvider", () => {
|
|
12
|
-
render(
|
|
13
|
-
<AppProvider persist={false} defaultLocale="vi">
|
|
14
|
-
<LocalePicker />
|
|
15
|
-
</AppProvider>,
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
expect(screen.getByRole("combobox", { name: "Ngôn ngữ" })).toBeInTheDocument();
|
|
19
|
-
expect(screen.getByText("Tiếng Việt")).toBeInTheDocument();
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it("works in controlled mode without AppProvider", async () => {
|
|
23
|
-
const user = userEvent.setup();
|
|
24
|
-
const onChange = vi.fn();
|
|
25
|
-
|
|
26
|
-
render(<LocalePicker value="en" onChange={onChange} />);
|
|
27
|
-
await user.click(screen.getByRole("combobox", { name: "Ngôn ngữ" }));
|
|
28
|
-
await user.click(screen.getByRole("option", { name: "日本語" }));
|
|
29
|
-
|
|
30
|
-
expect(onChange).toHaveBeenCalledWith("ja");
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
describe("TimezonePicker", () => {
|
|
35
|
-
it("lists configured timezones from AppProvider", async () => {
|
|
36
|
-
const user = userEvent.setup();
|
|
37
|
-
|
|
38
|
-
render(
|
|
39
|
-
<AppProvider
|
|
40
|
-
persist={false}
|
|
41
|
-
defaultLocale="en"
|
|
42
|
-
defaultTimezone="Asia/Tokyo"
|
|
43
|
-
timezoneOptions={["Asia/Tokyo", "Asia/Ho_Chi_Minh"]}
|
|
44
|
-
>
|
|
45
|
-
<TimezonePicker />
|
|
46
|
-
</AppProvider>,
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
await user.click(screen.getByRole("combobox", { name: "Timezone" }));
|
|
50
|
-
expect(screen.getByRole("option", { name: "Japan (Tokyo)" })).toBeInTheDocument();
|
|
51
|
-
expect(screen.getByRole("option", { name: "Vietnam (Ho Chi Minh)" })).toBeInTheDocument();
|
|
52
|
-
expect(screen.queryByRole("option", { name: /Paris/ })).not.toBeInTheDocument();
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
describe("DateFormatPicker", () => {
|
|
57
|
-
it("renders dmy for vi locale by default", () => {
|
|
58
|
-
render(
|
|
59
|
-
<AppProvider persist={false} defaultLocale="vi">
|
|
60
|
-
<DateFormatPicker />
|
|
61
|
-
</AppProvider>,
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
expect(screen.getByText("Ngày / Tháng / Năm")).toBeInTheDocument();
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
it("renders iso for ja locale by default", () => {
|
|
68
|
-
render(
|
|
69
|
-
<AppProvider persist={false} defaultLocale="ja">
|
|
70
|
-
<DateFormatPicker />
|
|
71
|
-
</AppProvider>,
|
|
72
|
-
);
|
|
73
|
-
|
|
74
|
-
expect(screen.getByText("YYYY-MM-DD(年-月-日)")).toBeInTheDocument();
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
it("works in controlled mode", async () => {
|
|
78
|
-
const user = userEvent.setup();
|
|
79
|
-
const onChange = vi.fn();
|
|
80
|
-
|
|
81
|
-
render(
|
|
82
|
-
<AppProvider persist={false} defaultLocale="en">
|
|
83
|
-
<DateFormatPicker value="mdy" onChange={onChange} />
|
|
84
|
-
</AppProvider>,
|
|
85
|
-
);
|
|
86
|
-
await user.click(screen.getByRole("combobox", { name: "Date format" }));
|
|
87
|
-
await user.click(screen.getByRole("option", { name: "ISO (yyyy-MM-dd)" }));
|
|
88
|
-
|
|
89
|
-
expect(onChange).toHaveBeenCalledWith("iso");
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
describe("TimeFormatPicker", () => {
|
|
94
|
-
it("renders 24h for vi locale by default", () => {
|
|
95
|
-
render(
|
|
96
|
-
<AppProvider persist={false} defaultLocale="vi">
|
|
97
|
-
<TimeFormatPicker />
|
|
98
|
-
</AppProvider>,
|
|
99
|
-
);
|
|
100
|
-
|
|
101
|
-
expect(screen.getByText("24 giờ")).toBeInTheDocument();
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
it("works in controlled mode", async () => {
|
|
105
|
-
const user = userEvent.setup();
|
|
106
|
-
const onChange = vi.fn();
|
|
107
|
-
|
|
108
|
-
render(
|
|
109
|
-
<AppProvider persist={false} defaultLocale="en">
|
|
110
|
-
<TimeFormatPicker value="24h" onChange={onChange} />
|
|
111
|
-
</AppProvider>,
|
|
112
|
-
);
|
|
113
|
-
await user.click(screen.getByRole("combobox", { name: "Time format" }));
|
|
114
|
-
await user.click(screen.getByRole("option", { name: "12-hour (AM/PM)" }));
|
|
115
|
-
|
|
116
|
-
expect(onChange).toHaveBeenCalledWith("12h");
|
|
117
|
-
});
|
|
118
|
-
});
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it, vi } from "vitest";
|
|
2
|
-
import { renderWithUi, screen, userEvent } from "@/test/render";
|
|
3
|
-
import { Button } from "../../general/button";
|
|
4
|
-
import {
|
|
5
|
-
DropdownMenu,
|
|
6
|
-
DropdownMenuCheckboxItem,
|
|
7
|
-
DropdownMenuContent,
|
|
8
|
-
DropdownMenuItem,
|
|
9
|
-
DropdownMenuLabel,
|
|
10
|
-
DropdownMenuRadioGroup,
|
|
11
|
-
DropdownMenuRadioItem,
|
|
12
|
-
DropdownMenuSeparator,
|
|
13
|
-
DropdownMenuShortcut,
|
|
14
|
-
DropdownMenuTrigger,
|
|
15
|
-
} from "../dropdown-menu";
|
|
16
|
-
|
|
17
|
-
describe("DropdownMenu", () => {
|
|
18
|
-
it("invokes menu item onSelect", async () => {
|
|
19
|
-
const user = userEvent.setup();
|
|
20
|
-
const onSelect = vi.fn();
|
|
21
|
-
renderWithUi(
|
|
22
|
-
<DropdownMenu>
|
|
23
|
-
<DropdownMenuTrigger asChild>
|
|
24
|
-
<Button type="button">Actions</Button>
|
|
25
|
-
</DropdownMenuTrigger>
|
|
26
|
-
<DropdownMenuContent>
|
|
27
|
-
<DropdownMenuItem onSelect={onSelect}>Xuất CSV</DropdownMenuItem>
|
|
28
|
-
</DropdownMenuContent>
|
|
29
|
-
</DropdownMenu>,
|
|
30
|
-
);
|
|
31
|
-
await user.click(screen.getByRole("button", { name: "Actions" }));
|
|
32
|
-
const item = screen.getByRole("menuitem", { name: "Xuất CSV" });
|
|
33
|
-
expect(item).toHaveAttribute("data-slot", "dropdown-menu-item");
|
|
34
|
-
await user.click(item);
|
|
35
|
-
expect(onSelect).toHaveBeenCalled();
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it("renders label and separator", async () => {
|
|
39
|
-
const user = userEvent.setup();
|
|
40
|
-
renderWithUi(
|
|
41
|
-
<DropdownMenu>
|
|
42
|
-
<DropdownMenuTrigger asChild>
|
|
43
|
-
<Button type="button">Menu</Button>
|
|
44
|
-
</DropdownMenuTrigger>
|
|
45
|
-
<DropdownMenuContent>
|
|
46
|
-
<DropdownMenuLabel>Hành động</DropdownMenuLabel>
|
|
47
|
-
<DropdownMenuSeparator />
|
|
48
|
-
<DropdownMenuItem>Sửa</DropdownMenuItem>
|
|
49
|
-
</DropdownMenuContent>
|
|
50
|
-
</DropdownMenu>,
|
|
51
|
-
);
|
|
52
|
-
await user.click(screen.getByRole("button", { name: "Menu" }));
|
|
53
|
-
expect(screen.getByText("Hành động")).toHaveAttribute("data-slot", "dropdown-menu-label");
|
|
54
|
-
expect(screen.getByRole("menuitem", { name: "Sửa" })).toBeInTheDocument();
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
it("closes after selecting an item", async () => {
|
|
58
|
-
const user = userEvent.setup();
|
|
59
|
-
renderWithUi(
|
|
60
|
-
<DropdownMenu>
|
|
61
|
-
<DropdownMenuTrigger asChild>
|
|
62
|
-
<Button type="button">Actions</Button>
|
|
63
|
-
</DropdownMenuTrigger>
|
|
64
|
-
<DropdownMenuContent>
|
|
65
|
-
<DropdownMenuItem>Xóa</DropdownMenuItem>
|
|
66
|
-
</DropdownMenuContent>
|
|
67
|
-
</DropdownMenu>,
|
|
68
|
-
);
|
|
69
|
-
await user.click(screen.getByRole("button", { name: "Actions" }));
|
|
70
|
-
await user.click(screen.getByRole("menuitem", { name: "Xóa" }));
|
|
71
|
-
expect(screen.queryByRole("menuitem", { name: "Xóa" })).not.toBeInTheDocument();
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
it("renders checkbox, radio, and shortcut slots", async () => {
|
|
75
|
-
const user = userEvent.setup();
|
|
76
|
-
renderWithUi(
|
|
77
|
-
<DropdownMenu>
|
|
78
|
-
<DropdownMenuTrigger asChild>
|
|
79
|
-
<Button type="button">Advanced</Button>
|
|
80
|
-
</DropdownMenuTrigger>
|
|
81
|
-
<DropdownMenuContent>
|
|
82
|
-
<DropdownMenuCheckboxItem checked>Notify</DropdownMenuCheckboxItem>
|
|
83
|
-
<DropdownMenuRadioGroup value="air">
|
|
84
|
-
<DropdownMenuRadioItem value="air">Air</DropdownMenuRadioItem>
|
|
85
|
-
</DropdownMenuRadioGroup>
|
|
86
|
-
<DropdownMenuItem>
|
|
87
|
-
Export
|
|
88
|
-
<DropdownMenuShortcut>Ctrl+E</DropdownMenuShortcut>
|
|
89
|
-
</DropdownMenuItem>
|
|
90
|
-
</DropdownMenuContent>
|
|
91
|
-
</DropdownMenu>,
|
|
92
|
-
);
|
|
93
|
-
await user.click(screen.getByRole("button", { name: "Advanced" }));
|
|
94
|
-
expect(screen.getByRole("menuitemcheckbox", { name: "Notify" })).toHaveAttribute(
|
|
95
|
-
"data-slot",
|
|
96
|
-
"dropdown-menu-checkbox-item",
|
|
97
|
-
);
|
|
98
|
-
expect(screen.getByRole("menuitemradio", { name: "Air" })).toHaveAttribute(
|
|
99
|
-
"data-slot",
|
|
100
|
-
"dropdown-menu-radio-item",
|
|
101
|
-
);
|
|
102
|
-
expect(screen.getByText("Ctrl+E")).toHaveAttribute("data-slot", "dropdown-menu-shortcut");
|
|
103
|
-
});
|
|
104
|
-
});
|