@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,242 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from "node:fs";
|
|
2
|
-
import { dirname, join } from "node:path";
|
|
3
|
-
import { fileURLToPath } from "node:url";
|
|
4
|
-
import { describe, expect, it } from "vitest";
|
|
5
|
-
import { screen } from "@testing-library/react";
|
|
6
|
-
import { Button } from "../general/button";
|
|
7
|
-
import { Input } from "../data-entry/input";
|
|
8
|
-
import { Textarea } from "../data-entry/textarea";
|
|
9
|
-
import {
|
|
10
|
-
Select,
|
|
11
|
-
SelectContent,
|
|
12
|
-
SelectItem,
|
|
13
|
-
SelectTrigger,
|
|
14
|
-
SelectValue,
|
|
15
|
-
} from "../data-entry/select";
|
|
16
|
-
import { Checkbox } from "../data-entry/checkbox";
|
|
17
|
-
import { Switch } from "../data-entry/switch";
|
|
18
|
-
import { Badge } from "../data-display/badge";
|
|
19
|
-
import { StatusBadge } from "../data-display/status-badge";
|
|
20
|
-
import {
|
|
21
|
-
Table,
|
|
22
|
-
TableBody,
|
|
23
|
-
TableCell,
|
|
24
|
-
TableHead,
|
|
25
|
-
TableHeader,
|
|
26
|
-
TableRow,
|
|
27
|
-
} from "../data-display/table";
|
|
28
|
-
import { Pagination } from "../navigation/pagination";
|
|
29
|
-
import { Calendar } from "../data-entry/calendar";
|
|
30
|
-
import { renderWithTheme } from "@/test/theme-test-utils";
|
|
31
|
-
import {
|
|
32
|
-
controlMultilineClass,
|
|
33
|
-
tableRowHeightClass,
|
|
34
|
-
toneInfoClass,
|
|
35
|
-
toneSuccessClass,
|
|
36
|
-
toneWarningClass,
|
|
37
|
-
} from "@/lib/control-styles";
|
|
38
|
-
|
|
39
|
-
const componentsDir = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
40
|
-
|
|
41
|
-
function readComponent(relative: string): string {
|
|
42
|
-
return readFileSync(join(componentsDir, relative), "utf8");
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function statusBadgeRoot(label: string): HTMLElement {
|
|
46
|
-
const text = screen.getByText(label);
|
|
47
|
-
const root = text.parentElement;
|
|
48
|
-
expect(root).toBeTruthy();
|
|
49
|
-
return root!;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
describe("theme axes integration (render + class contracts)", () => {
|
|
53
|
-
describe("density — ui-control on interactive primitives", () => {
|
|
54
|
-
it("Button default size uses semantic button size class", () => {
|
|
55
|
-
renderWithTheme(<Button>Save</Button>);
|
|
56
|
-
expect(screen.getByRole("button", { name: "Save" })).toHaveClass("ui-button--default-size");
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
it("Input uses ui-control", () => {
|
|
60
|
-
renderWithTheme(<Input aria-label="HAWB" />);
|
|
61
|
-
expect(screen.getByRole("textbox", { name: "HAWB" })).toHaveClass("ui-control");
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
it("Textarea uses ui-control-multiline", () => {
|
|
65
|
-
renderWithTheme(<Textarea aria-label="Notes" />);
|
|
66
|
-
expect(screen.getByRole("textbox", { name: "Notes" })).toHaveClass("ui-control-multiline");
|
|
67
|
-
expect(controlMultilineClass.split(" ")[0]).toBe("ui-control-multiline");
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
it("SelectTrigger uses ui-control flex layout", () => {
|
|
71
|
-
renderWithTheme(
|
|
72
|
-
<Select defaultValue="a">
|
|
73
|
-
<SelectTrigger aria-label="Hub">
|
|
74
|
-
<SelectValue />
|
|
75
|
-
</SelectTrigger>
|
|
76
|
-
<SelectContent>
|
|
77
|
-
<SelectItem value="a">A</SelectItem>
|
|
78
|
-
</SelectContent>
|
|
79
|
-
</Select>,
|
|
80
|
-
);
|
|
81
|
-
const trigger = screen.getByRole("combobox", { name: "Hub" });
|
|
82
|
-
expect(trigger).toHaveClass("ui-control");
|
|
83
|
-
expect(trigger.className).toContain("flex");
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
it.each(["compact", "default", "comfortable"] as const)(
|
|
87
|
-
"renders Input under ui-density-%s",
|
|
88
|
-
(density) => {
|
|
89
|
-
renderWithTheme(<Input aria-label={`field-${density}`} />, { density });
|
|
90
|
-
expect(screen.getByRole("textbox", { name: `field-${density}` })).toHaveClass("ui-control");
|
|
91
|
-
},
|
|
92
|
-
);
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
describe("semantic badges — token tone classes (no raw palette)", () => {
|
|
96
|
-
it("Badge success variant uses success token", () => {
|
|
97
|
-
renderWithTheme(<Badge variant="success">Cleared</Badge>);
|
|
98
|
-
const el = screen.getByText("Cleared");
|
|
99
|
-
expect(el.className).toContain("success");
|
|
100
|
-
expect(el.className).not.toMatch(/green-/);
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
it("StatusBadge pending uses warning token", () => {
|
|
104
|
-
renderWithTheme(<StatusBadge status="pending" />);
|
|
105
|
-
const el = statusBadgeRoot("Chờ xử lý");
|
|
106
|
-
expect(el.className).toContain("warning");
|
|
107
|
-
expect(el.className).not.toMatch(/amber-/);
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
it("StatusBadge scheduled uses info token", () => {
|
|
111
|
-
renderWithTheme(<StatusBadge status="scheduled" />);
|
|
112
|
-
const el = statusBadgeRoot("Đã lên lịch");
|
|
113
|
-
expect(el.className).toContain("info");
|
|
114
|
-
expect(el.className).not.toMatch(/blue-/);
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
it("StatusBadge active uses success token", () => {
|
|
118
|
-
renderWithTheme(<StatusBadge status="active" />);
|
|
119
|
-
const el = statusBadgeRoot("Đang hoạt động");
|
|
120
|
-
expect(el.className).toContain("success");
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
it("tone class constants match expected token names", () => {
|
|
124
|
-
expect(toneSuccessClass).toContain("success");
|
|
125
|
-
expect(toneWarningClass).toContain("warning");
|
|
126
|
-
expect(toneInfoClass).toContain("info");
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
describe("table density tokens", () => {
|
|
131
|
-
it("TableHead references --table-row-height", () => {
|
|
132
|
-
renderWithTheme(
|
|
133
|
-
<Table>
|
|
134
|
-
<TableHeader>
|
|
135
|
-
<TableRow>
|
|
136
|
-
<TableHead>HAWB</TableHead>
|
|
137
|
-
</TableRow>
|
|
138
|
-
</TableHeader>
|
|
139
|
-
<TableBody>
|
|
140
|
-
<TableRow className={tableRowHeightClass}>
|
|
141
|
-
<TableCell>GX-1</TableCell>
|
|
142
|
-
</TableRow>
|
|
143
|
-
</TableBody>
|
|
144
|
-
</Table>,
|
|
145
|
-
);
|
|
146
|
-
expect(screen.getByRole("columnheader", { name: "HAWB" }).className).toContain(
|
|
147
|
-
"var(--table-row-height)",
|
|
148
|
-
);
|
|
149
|
-
});
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
describe("primary brand — checkbox/switch", () => {
|
|
153
|
-
it("Checkbox uses centralized semantic class", () => {
|
|
154
|
-
renderWithTheme(<Checkbox defaultChecked aria-label="ok" />);
|
|
155
|
-
expect(screen.getByRole("checkbox", { name: "ok" })).toHaveClass("ui-checkbox");
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
it("Switch uses centralized semantic class", () => {
|
|
159
|
-
renderWithTheme(<Switch defaultChecked aria-label="notify" />);
|
|
160
|
-
expect(screen.getByRole("switch", { name: "notify" })).toHaveClass("ui-switch");
|
|
161
|
-
});
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
describe("Preview-equivalent theme globals on wrapper", () => {
|
|
165
|
-
it("fontSize sm sets --font-size-sm on root", () => {
|
|
166
|
-
const { container } = renderWithTheme(<span>x</span>, { fontSize: "sm" });
|
|
167
|
-
const root = container.firstElementChild as HTMLElement;
|
|
168
|
-
expect(root.style.getPropertyValue("--font-size-sm")).toBe("0.8125rem");
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
it("fontSize lg sets --font-size-sm on root", () => {
|
|
172
|
-
const { container } = renderWithTheme(<span>x</span>, { fontSize: "lg" });
|
|
173
|
-
const root = container.firstElementChild as HTMLElement;
|
|
174
|
-
expect(root.style.getPropertyValue("--font-size-sm")).toBe("0.9375rem");
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
it("primaryColor logistics sets primary + accent + ring", () => {
|
|
178
|
-
const { container } = renderWithTheme(<span>x</span>, { primaryColor: "logistics" });
|
|
179
|
-
const root = container.firstElementChild as HTMLElement;
|
|
180
|
-
expect(root.style.getPropertyValue("--primary")).toBe("173 80% 36%");
|
|
181
|
-
expect(root.style.getPropertyValue("--accent")).toBe("173 80% 94%");
|
|
182
|
-
expect(root.style.getPropertyValue("--ring")).toBe("173 80% 36%");
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
it.each(["brand", "crm", "partner", "slate"] as const)(
|
|
186
|
-
"primaryColor %s sets matching accent foreground pair",
|
|
187
|
-
(primaryColor) => {
|
|
188
|
-
const { container } = renderWithTheme(<span>x</span>, { primaryColor });
|
|
189
|
-
const root = container.firstElementChild as HTMLElement;
|
|
190
|
-
const primary = root.style.getPropertyValue("--primary");
|
|
191
|
-
const accent = root.style.getPropertyValue("--accent");
|
|
192
|
-
expect(primary.length).toBeGreaterThan(0);
|
|
193
|
-
expect(accent.length).toBeGreaterThan(0);
|
|
194
|
-
expect(primary).not.toBe(accent);
|
|
195
|
-
},
|
|
196
|
-
);
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
describe("pagination + calendar avoid legacy hardcoded sizes", () => {
|
|
200
|
-
it("pagination prev button uses semantic compact icon class", () => {
|
|
201
|
-
renderWithTheme(
|
|
202
|
-
<Pagination current={2} total={100} pageSize={20} onChange={() => undefined} />,
|
|
203
|
-
);
|
|
204
|
-
const prev = screen.getByRole("button", { name: /trang trước/i });
|
|
205
|
-
expect(prev.className).not.toMatch(/\bsize-8\b/);
|
|
206
|
-
expect(prev).toHaveClass("ui-button--compact-icon");
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
it("calendar day button uses var(--control-height)", () => {
|
|
210
|
-
renderWithTheme(<Calendar mode="single" />);
|
|
211
|
-
const dayButton = screen.getByRole("grid").querySelector("button");
|
|
212
|
-
expect(dayButton?.className ?? "").toContain("var(--control-height)");
|
|
213
|
-
expect(dayButton?.className ?? "").not.toMatch(/\bsize-9\b/);
|
|
214
|
-
});
|
|
215
|
-
});
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
describe("theme axes — control-styles import contracts", () => {
|
|
219
|
-
const requiredImports: { file: string; exportName: string }[] = [
|
|
220
|
-
{ file: "data-entry/select.tsx", exportName: "controlTriggerClass" },
|
|
221
|
-
{ file: "data-entry/textarea.tsx", exportName: "controlMultilineClass" },
|
|
222
|
-
{ file: "data-entry/command.tsx", exportName: "controlIconLeadingClass" },
|
|
223
|
-
{ file: "data-entry/calendar.tsx", exportName: "controlIconSmClass" },
|
|
224
|
-
{ file: "data-entry/color-picker.tsx", exportName: "controlIconClass" },
|
|
225
|
-
{ file: "data-entry/upload.tsx", exportName: "controlIconClass" },
|
|
226
|
-
{ file: "data-display/badge.tsx", exportName: "toneSuccessClass" },
|
|
227
|
-
{ file: "data-display/table.tsx", exportName: "tableHeadHeightClass" },
|
|
228
|
-
{ file: "data-display/data-table.tsx", exportName: "tableRowHeightClass" },
|
|
229
|
-
{ file: "data-display/status-badge.tsx", exportName: "toneSuccessClass" },
|
|
230
|
-
{ file: "navigation/steps.tsx", exportName: "controlIconClass" },
|
|
231
|
-
{ file: "feedback/skeleton.tsx", exportName: "tableRowHeightClass" },
|
|
232
|
-
];
|
|
233
|
-
|
|
234
|
-
it.each(requiredImports)(
|
|
235
|
-
"$file imports $exportName from control-styles",
|
|
236
|
-
({ file, exportName }) => {
|
|
237
|
-
const content = readComponent(file);
|
|
238
|
-
expect(content, `${file} must import from control-styles`).toContain("control-styles");
|
|
239
|
-
expect(content, `${file} must use ${exportName}`).toContain(exportName);
|
|
240
|
-
},
|
|
241
|
-
);
|
|
242
|
-
});
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
// Backward-compatible admin barrel.
|
|
2
|
-
export type { BreadcrumbItemProp as BreadcrumbItem } from "../../props/vocabulary/navigation.prop";
|
|
3
|
-
export type {
|
|
4
|
-
PageContainerProp,
|
|
5
|
-
PageContainerProp as PageContainerProps,
|
|
6
|
-
} from "../../props/components/layout.prop";
|
|
7
|
-
|
|
8
|
-
export { PageHeader } from "../navigation/page-header";
|
|
9
|
-
/* eslint-disable-next-line @typescript-eslint/no-deprecated -- backward-compat export */
|
|
10
|
-
export type { PageHeaderProp } from "../../props/components/layout.prop";
|
|
11
|
-
|
|
12
|
-
export { PageContainer } from "../layout/page-container";
|
|
13
|
-
export { Stack, Inline } from "../layout";
|
|
14
|
-
export type { StackProp, InlineProp } from "../../props/components/layout.prop";
|
|
15
|
-
|
|
16
|
-
export { EmptyState } from "../data-display/empty-state";
|
|
17
|
-
export { StatusBadge } from "../data-display/status-badge";
|
|
18
|
-
export { FormField } from "../data-entry/form-field";
|
|
19
|
-
export { KeyValueGrid } from "../data-display/key-value-grid";
|
|
20
|
-
export { SkeletonRows, SkeletonTable, SkeletonDetail, SkeletonCard } from "../feedback/skeleton";
|
|
21
|
-
export {
|
|
22
|
-
DataState,
|
|
23
|
-
MutationFeedback,
|
|
24
|
-
QueryRefetchButton,
|
|
25
|
-
InfiniteQueryState,
|
|
26
|
-
flattenItemPages,
|
|
27
|
-
PrefetchLink,
|
|
28
|
-
} from "../query";
|
|
29
|
-
export {
|
|
30
|
-
Alert,
|
|
31
|
-
AlertTitle,
|
|
32
|
-
AlertContent,
|
|
33
|
-
AlertDescription,
|
|
34
|
-
AlertActions,
|
|
35
|
-
AlertQueryError,
|
|
36
|
-
} from "../feedback/alert";
|
|
37
|
-
export { SearchInput } from "../data-entry/search-input";
|
|
38
|
-
export {
|
|
39
|
-
Upload,
|
|
40
|
-
collectUploadCommitActions,
|
|
41
|
-
createUploadItem,
|
|
42
|
-
useUploadDraft,
|
|
43
|
-
} from "../data-entry/upload";
|
|
44
|
-
export { Cascader } from "../data-entry/cascader";
|
|
45
|
-
export { TreeSelect } from "../data-entry/tree-select";
|
|
46
|
-
export { Transfer } from "../data-entry/transfer";
|
|
47
|
-
export {
|
|
48
|
-
Pagination,
|
|
49
|
-
Steps,
|
|
50
|
-
TabsItems,
|
|
51
|
-
Tabs,
|
|
52
|
-
TabsContent,
|
|
53
|
-
TabsList,
|
|
54
|
-
TabsTrigger,
|
|
55
|
-
} from "../navigation";
|
|
56
|
-
export { FilterBar, FilterGroup } from "../navigation/filter-bar";
|
|
57
|
-
export {
|
|
58
|
-
Dialog,
|
|
59
|
-
DialogTrigger,
|
|
60
|
-
DialogContent,
|
|
61
|
-
DialogHeader,
|
|
62
|
-
DialogFooter,
|
|
63
|
-
DialogTitle,
|
|
64
|
-
DialogDescription,
|
|
65
|
-
DialogConfirm,
|
|
66
|
-
} from "../feedback/dialog";
|
|
67
|
-
export { DataTable } from "../data-display/data-table";
|
|
68
|
-
export type { ColumnDef, Density } from "../data-display/data-table";
|
|
69
|
-
export { Toaster } from "../feedback/sonner";
|
|
70
|
-
export { toast, useToast } from "../feedback/use-toast";
|
|
71
|
-
export type { LegacyToastOptions } from "../feedback/use-toast";
|
|
72
|
-
export { useDebouncedValue, useTimeoutFlag } from "../../lib/hooks";
|
|
73
|
-
export { formatDate, formatBytes, formatCurrency, shortId, humanError } from "../../lib/format";
|
|
74
|
-
/* eslint-disable @typescript-eslint/no-deprecated -- backward-compatible admin barrel re-exports legacy helpers. */
|
|
75
|
-
export { formatDateTime, formatDateLong, formatRelative } from "../../lib/format";
|
|
76
|
-
/* eslint-enable @typescript-eslint/no-deprecated */
|
|
@@ -1,328 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { readFileSync } from "node:fs";
|
|
3
|
-
import { join } from "node:path";
|
|
4
|
-
import { renderWithUi, screen } from "@/test/render";
|
|
5
|
-
import {
|
|
6
|
-
Card,
|
|
7
|
-
CardAction,
|
|
8
|
-
CardContent,
|
|
9
|
-
CardCover,
|
|
10
|
-
CardDescription,
|
|
11
|
-
CardFooter,
|
|
12
|
-
CardHeader,
|
|
13
|
-
CardStat,
|
|
14
|
-
CardTitle,
|
|
15
|
-
} from "../card";
|
|
16
|
-
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "../table";
|
|
17
|
-
|
|
18
|
-
describe("Card layout governance", () => {
|
|
19
|
-
it("keeps all slot padding in card-layout.css (not card.tsx)", () => {
|
|
20
|
-
const cardTs = readFileSync(join(__dirname, "../card.tsx"), "utf8");
|
|
21
|
-
expect(cardTs).not.toMatch(/ui-card-shell/);
|
|
22
|
-
expect(cardTs).not.toMatch(/ui-card-section-gap/);
|
|
23
|
-
expect(cardTs).not.toMatch(/padding-(top|bottom|inline)/);
|
|
24
|
-
|
|
25
|
-
const layoutCss = readFileSync(join(__dirname, "../../../styles/card-layout.css"), "utf8");
|
|
26
|
-
expect(layoutCss).toMatch(/\[data-slot="card-header"\]/);
|
|
27
|
-
expect(layoutCss).toMatch(/\[data-slot="card-content"\]/);
|
|
28
|
-
expect(layoutCss).toMatch(/\[data-slot="card-footer"\]/);
|
|
29
|
-
expect(layoutCss).toMatch(/--card-space-inset/);
|
|
30
|
-
expect(layoutCss).toMatch(/--card-space-header-y/);
|
|
31
|
-
expect(layoutCss).toMatch(/--card-space-body-y/);
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
describe("Card", () => {
|
|
36
|
-
it("renders header, content, and footer", () => {
|
|
37
|
-
renderWithUi(
|
|
38
|
-
<Card>
|
|
39
|
-
<CardHeader>
|
|
40
|
-
<CardTitle>HAWB detail</CardTitle>
|
|
41
|
-
<CardDescription>Osaka → HCM</CardDescription>
|
|
42
|
-
</CardHeader>
|
|
43
|
-
<CardContent>2.4 kg</CardContent>
|
|
44
|
-
<CardFooter>Footer</CardFooter>
|
|
45
|
-
</Card>,
|
|
46
|
-
);
|
|
47
|
-
expect(screen.getByRole("heading", { name: "HAWB detail" })).toBeInTheDocument();
|
|
48
|
-
expect(screen.getByText("Osaka → HCM")).toBeInTheDocument();
|
|
49
|
-
expect(screen.getByText("2.4 kg")).toBeInTheDocument();
|
|
50
|
-
expect(screen.getByText("Footer")).toBeInTheDocument();
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it("renders CardAction in header row", () => {
|
|
54
|
-
renderWithUi(
|
|
55
|
-
<Card>
|
|
56
|
-
<CardHeader className="flex flex-row justify-between">
|
|
57
|
-
<CardTitle>Section</CardTitle>
|
|
58
|
-
<CardAction>
|
|
59
|
-
<button type="button">Edit</button>
|
|
60
|
-
</CardAction>
|
|
61
|
-
</CardHeader>
|
|
62
|
-
</Card>,
|
|
63
|
-
);
|
|
64
|
-
expect(screen.getByRole("button", { name: "Edit" })).toBeInTheDocument();
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
it("renders separated footer with data-separated flag", () => {
|
|
68
|
-
renderWithUi(
|
|
69
|
-
<Card>
|
|
70
|
-
<CardHeader>
|
|
71
|
-
<CardTitle>Form</CardTitle>
|
|
72
|
-
</CardHeader>
|
|
73
|
-
<CardContent data-testid="content">Body</CardContent>
|
|
74
|
-
<CardFooter separated data-testid="footer">
|
|
75
|
-
<button type="button">Save</button>
|
|
76
|
-
</CardFooter>
|
|
77
|
-
</Card>,
|
|
78
|
-
);
|
|
79
|
-
const footer = screen.getByTestId("footer");
|
|
80
|
-
expect(footer).toHaveAttribute("data-separated", "");
|
|
81
|
-
expect(footer).toHaveAttribute("data-slot", "card-footer");
|
|
82
|
-
expect(screen.getByTestId("content")).toHaveAttribute("data-slot", "card-content");
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
it("renders banded header with data attribute", () => {
|
|
86
|
-
renderWithUi(
|
|
87
|
-
<Card>
|
|
88
|
-
<CardHeader banded data-testid="header">
|
|
89
|
-
<CardTitle>Section</CardTitle>
|
|
90
|
-
</CardHeader>
|
|
91
|
-
<CardContent>Body</CardContent>
|
|
92
|
-
</Card>,
|
|
93
|
-
);
|
|
94
|
-
const header = screen.getByTestId("header");
|
|
95
|
-
expect(header).toHaveAttribute("data-banded", "");
|
|
96
|
-
expect(header.className).toMatch(/ui-card-header--banded/);
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it("banded header exposes chrome band flags only (padding in CSS)", () => {
|
|
100
|
-
renderWithUi(
|
|
101
|
-
<Card data-testid="card">
|
|
102
|
-
<CardHeader banded data-testid="header">
|
|
103
|
-
<CardTitle>Audit events</CardTitle>
|
|
104
|
-
<CardDescription>Realm internal · last 24h</CardDescription>
|
|
105
|
-
</CardHeader>
|
|
106
|
-
<CardContent data-testid="content">Body copy</CardContent>
|
|
107
|
-
</Card>,
|
|
108
|
-
);
|
|
109
|
-
const header = screen.getByTestId("header");
|
|
110
|
-
expect(header).toHaveAttribute("data-banded", "");
|
|
111
|
-
expect(header.className).toMatch(/ui-card-header--banded/);
|
|
112
|
-
expect(header.className).not.toMatch(/ui-card-shell/);
|
|
113
|
-
expect(screen.getByRole("heading", { name: "Audit events" })).toHaveAttribute(
|
|
114
|
-
"data-slot",
|
|
115
|
-
"card-title",
|
|
116
|
-
);
|
|
117
|
-
expect(screen.getByTestId("content")).not.toHaveAttribute("data-tight");
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
it("renders banded header with title and description slots", () => {
|
|
121
|
-
renderWithUi(
|
|
122
|
-
<Card>
|
|
123
|
-
<CardHeader banded>
|
|
124
|
-
<CardTitle>Audit events</CardTitle>
|
|
125
|
-
<CardDescription>Realm internal · last 24h</CardDescription>
|
|
126
|
-
</CardHeader>
|
|
127
|
-
<CardContent>Prop banded trên CardHeader.</CardContent>
|
|
128
|
-
</Card>,
|
|
129
|
-
);
|
|
130
|
-
expect(screen.getByRole("heading", { name: "Audit events" })).toBeInTheDocument();
|
|
131
|
-
expect(screen.getByText("Realm internal · last 24h")).toHaveAttribute(
|
|
132
|
-
"data-slot",
|
|
133
|
-
"card-description",
|
|
134
|
-
);
|
|
135
|
-
expect(screen.getByText("Prop banded trên CardHeader.")).toBeInTheDocument();
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
it("renders banded header with CardAction for toolbar layout", () => {
|
|
139
|
-
renderWithUi(
|
|
140
|
-
<Card>
|
|
141
|
-
<CardHeader banded data-testid="header">
|
|
142
|
-
<div>
|
|
143
|
-
<CardTitle>Lô gom hôm nay</CardTitle>
|
|
144
|
-
<CardDescription>Osaka Hub · cut-off 17:00 JST</CardDescription>
|
|
145
|
-
</div>
|
|
146
|
-
<CardAction>
|
|
147
|
-
<button type="button">Export CSV</button>
|
|
148
|
-
</CardAction>
|
|
149
|
-
</CardHeader>
|
|
150
|
-
<CardContent flush tight>
|
|
151
|
-
<Table>
|
|
152
|
-
<TableBody>
|
|
153
|
-
<TableRow>
|
|
154
|
-
<TableCell>GX-001</TableCell>
|
|
155
|
-
</TableRow>
|
|
156
|
-
</TableBody>
|
|
157
|
-
</Table>
|
|
158
|
-
</CardContent>
|
|
159
|
-
</Card>,
|
|
160
|
-
);
|
|
161
|
-
const header = screen.getByTestId("header");
|
|
162
|
-
expect(header.querySelector('[data-slot="card-action"]')).toBeTruthy();
|
|
163
|
-
expect(screen.getByRole("button", { name: "Export CSV" })).toBeInTheDocument();
|
|
164
|
-
expect(screen.getByRole("cell", { name: "GX-001" })).toBeInTheDocument();
|
|
165
|
-
expect(screen.getByRole("cell", { name: "GX-001" }).closest("[data-flush]")).toBeTruthy();
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
it("plain header has no banded flag; banded header does", () => {
|
|
169
|
-
renderWithUi(
|
|
170
|
-
<div>
|
|
171
|
-
<Card>
|
|
172
|
-
<CardHeader data-testid="plain">
|
|
173
|
-
<CardTitle>Plain header</CardTitle>
|
|
174
|
-
</CardHeader>
|
|
175
|
-
</Card>
|
|
176
|
-
<Card>
|
|
177
|
-
<CardHeader banded data-testid="banded">
|
|
178
|
-
<CardTitle>Banded header</CardTitle>
|
|
179
|
-
</CardHeader>
|
|
180
|
-
</Card>
|
|
181
|
-
</div>,
|
|
182
|
-
);
|
|
183
|
-
expect(screen.getByTestId("plain")).not.toHaveAttribute("data-banded");
|
|
184
|
-
expect(screen.getByTestId("banded")).toHaveAttribute("data-banded", "");
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
it("flush tight content sets layout modifier flags", () => {
|
|
188
|
-
renderWithUi(
|
|
189
|
-
<Card>
|
|
190
|
-
<CardHeader banded>
|
|
191
|
-
<CardTitle>Table section</CardTitle>
|
|
192
|
-
</CardHeader>
|
|
193
|
-
<CardContent flush tight data-testid="content">
|
|
194
|
-
<Table>
|
|
195
|
-
<TableBody>
|
|
196
|
-
<TableRow>
|
|
197
|
-
<TableCell>HAWB</TableCell>
|
|
198
|
-
</TableRow>
|
|
199
|
-
</TableBody>
|
|
200
|
-
</Table>
|
|
201
|
-
</CardContent>
|
|
202
|
-
</Card>,
|
|
203
|
-
);
|
|
204
|
-
const content = screen.getByTestId("content");
|
|
205
|
-
expect(content).toHaveAttribute("data-tight", "");
|
|
206
|
-
expect(content).toHaveAttribute("data-flush", "");
|
|
207
|
-
expect(content.className).not.toMatch(/ui-card-/);
|
|
208
|
-
});
|
|
209
|
-
|
|
210
|
-
it("banded card pairs with separated footer band", () => {
|
|
211
|
-
renderWithUi(
|
|
212
|
-
<Card>
|
|
213
|
-
<CardHeader banded>
|
|
214
|
-
<CardTitle>Lô gom hôm nay</CardTitle>
|
|
215
|
-
</CardHeader>
|
|
216
|
-
<CardContent flush tight>
|
|
217
|
-
Table body
|
|
218
|
-
</CardContent>
|
|
219
|
-
<CardFooter separated data-testid="footer">
|
|
220
|
-
3 / 12 kiện
|
|
221
|
-
</CardFooter>
|
|
222
|
-
</Card>,
|
|
223
|
-
);
|
|
224
|
-
expect(screen.getByTestId("footer")).toHaveAttribute("data-separated", "");
|
|
225
|
-
expect(screen.getByText("3 / 12 kiện")).toBeInTheDocument();
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
it("uses section top for toolbar header with CardAction", () => {
|
|
229
|
-
renderWithUi(
|
|
230
|
-
<Card>
|
|
231
|
-
<CardHeader data-testid="header" className="flex flex-row justify-between">
|
|
232
|
-
<CardTitle>Providers</CardTitle>
|
|
233
|
-
<CardAction>
|
|
234
|
-
<button type="button">Cancel</button>
|
|
235
|
-
</CardAction>
|
|
236
|
-
</CardHeader>
|
|
237
|
-
<CardContent>Body</CardContent>
|
|
238
|
-
</Card>,
|
|
239
|
-
);
|
|
240
|
-
expect(screen.getByTestId("header")).toHaveAttribute("data-slot", "card-header");
|
|
241
|
-
expect(
|
|
242
|
-
screen.getByRole("button", { name: "Cancel" }).closest("[data-slot=card-action]"),
|
|
243
|
-
).toBeTruthy();
|
|
244
|
-
});
|
|
245
|
-
|
|
246
|
-
it("renders cover + meta with card-cover slot", () => {
|
|
247
|
-
renderWithUi(
|
|
248
|
-
<Card>
|
|
249
|
-
<CardCover data-testid="cover">Cover</CardCover>
|
|
250
|
-
<CardHeader data-testid="header">
|
|
251
|
-
<CardTitle>Meta</CardTitle>
|
|
252
|
-
</CardHeader>
|
|
253
|
-
</Card>,
|
|
254
|
-
);
|
|
255
|
-
expect(screen.getByTestId("cover")).toHaveAttribute("data-slot", "card-cover");
|
|
256
|
-
expect(screen.getByTestId("header")).toHaveAttribute("data-slot", "card-header");
|
|
257
|
-
});
|
|
258
|
-
|
|
259
|
-
it("marks tight content for symmetric header band spacing", () => {
|
|
260
|
-
renderWithUi(
|
|
261
|
-
<Card>
|
|
262
|
-
<CardHeader data-testid="header">
|
|
263
|
-
<CardTitle>Table</CardTitle>
|
|
264
|
-
</CardHeader>
|
|
265
|
-
<CardContent tight flush data-testid="content">
|
|
266
|
-
Body
|
|
267
|
-
</CardContent>
|
|
268
|
-
</Card>,
|
|
269
|
-
);
|
|
270
|
-
expect(screen.getByTestId("content")).toHaveAttribute("data-tight", "");
|
|
271
|
-
expect(screen.getByTestId("header")).toHaveAttribute("data-slot", "card-header");
|
|
272
|
-
});
|
|
273
|
-
|
|
274
|
-
it("renders solo content with data-solo flag", () => {
|
|
275
|
-
renderWithUi(
|
|
276
|
-
<Card>
|
|
277
|
-
<CardContent solo data-testid="content">
|
|
278
|
-
Only body
|
|
279
|
-
</CardContent>
|
|
280
|
-
</Card>,
|
|
281
|
-
);
|
|
282
|
-
expect(screen.getByTestId("content")).toHaveAttribute("data-solo", "");
|
|
283
|
-
});
|
|
284
|
-
|
|
285
|
-
it("CardStat uses compact stat slot token path", () => {
|
|
286
|
-
renderWithUi(
|
|
287
|
-
<CardStat
|
|
288
|
-
label="Đơn hôm nay"
|
|
289
|
-
value={128}
|
|
290
|
-
delta={<span data-testid="delta">+12%</span>}
|
|
291
|
-
data-testid="stat"
|
|
292
|
-
/>,
|
|
293
|
-
);
|
|
294
|
-
const card = screen.getByTestId("stat");
|
|
295
|
-
expect(card).toHaveAttribute("data-size", "compact");
|
|
296
|
-
expect(card).toHaveAttribute("data-stat-card", "");
|
|
297
|
-
expect(card).toHaveAttribute("data-stat-layout", "stacked");
|
|
298
|
-
expect(screen.getByText("Đơn hôm nay")).toHaveAttribute("data-slot", "card-stat-label");
|
|
299
|
-
expect(screen.getByText("128")).toHaveAttribute("data-slot", "card-stat-value");
|
|
300
|
-
expect(screen.getByText("128")).toBeInTheDocument();
|
|
301
|
-
expect(screen.getByTestId("delta")).toBeInTheDocument();
|
|
302
|
-
expect(card.querySelector("[data-slot='card-stat-value-row']")).toBeTruthy();
|
|
303
|
-
});
|
|
304
|
-
});
|
|
305
|
-
|
|
306
|
-
describe("Table", () => {
|
|
307
|
-
it("renders semantic table structure", () => {
|
|
308
|
-
renderWithUi(
|
|
309
|
-
<Table>
|
|
310
|
-
<TableHeader>
|
|
311
|
-
<TableRow>
|
|
312
|
-
<TableHead>HAWB</TableHead>
|
|
313
|
-
<TableHead>Status</TableHead>
|
|
314
|
-
</TableRow>
|
|
315
|
-
</TableHeader>
|
|
316
|
-
<TableBody>
|
|
317
|
-
<TableRow>
|
|
318
|
-
<TableCell>GX-001</TableCell>
|
|
319
|
-
<TableCell>In transit</TableCell>
|
|
320
|
-
</TableRow>
|
|
321
|
-
</TableBody>
|
|
322
|
-
</Table>,
|
|
323
|
-
);
|
|
324
|
-
expect(screen.getByRole("table")).toBeInTheDocument();
|
|
325
|
-
expect(screen.getByRole("columnheader", { name: "HAWB" })).toBeInTheDocument();
|
|
326
|
-
expect(screen.getByRole("cell", { name: "GX-001" })).toBeInTheDocument();
|
|
327
|
-
});
|
|
328
|
-
});
|