@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,97 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it, beforeEach } from "vitest";
|
|
2
|
-
import { getDateFnsLocale } from "../../app/locales";
|
|
3
|
-
import {
|
|
4
|
-
detectFormatDateKind,
|
|
5
|
-
formatDate,
|
|
6
|
-
formatCalendarDate,
|
|
7
|
-
resetDatetimeContextForTests,
|
|
8
|
-
syncDatetimeContext,
|
|
9
|
-
} from "../datetime";
|
|
10
|
-
|
|
11
|
-
describe("formatDate (unified) — regression suite", () => {
|
|
12
|
-
beforeEach(() => {
|
|
13
|
-
resetDatetimeContextForTests();
|
|
14
|
-
syncDatetimeContext({
|
|
15
|
-
locale: "en",
|
|
16
|
-
timezone: "Asia/Ho_Chi_Minh",
|
|
17
|
-
timeFormat: "24h",
|
|
18
|
-
dateFormat: "iso",
|
|
19
|
-
dateFnsLocale: getDateFnsLocale("en"),
|
|
20
|
-
});
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it("auto-detects ISO date-only string", () => {
|
|
24
|
-
expect(formatDate("2026-05-01")).toBe("2026-05-01");
|
|
25
|
-
expect(detectFormatDateKind("2026-05-01")).toBe("date");
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it("auto-detects HH:mm time string", () => {
|
|
29
|
-
expect(formatDate("14:30", { kind: "auto" })).toBe("14:30");
|
|
30
|
-
expect(detectFormatDateKind("14:30")).toBe("time");
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it("auto-detects ISO datetime instant with timezone shift", () => {
|
|
34
|
-
expect(formatDate("2026-05-01T14:30:00Z")).toMatch(/2026-05-01 21:30/);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it("uses AppProvider defaults when options omitted", () => {
|
|
38
|
-
expect(formatDate("2026-05-01T14:30:00Z", { kind: "datetime" })).toMatch(/21:30/);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it("allows per-call timezone override", () => {
|
|
42
|
-
expect(formatDate("2026-05-01T14:30:00Z", { kind: "datetime", timezone: "UTC" })).toMatch(
|
|
43
|
-
/2026-05-01 14:30/,
|
|
44
|
-
);
|
|
45
|
-
expect(
|
|
46
|
-
formatDate("2026-05-01T14:30:00Z", { kind: "datetime", timezone: "Asia/Tokyo" }),
|
|
47
|
-
).toMatch(/2026-05-01 23:30/);
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it("formats calendar Date with kind calendar", () => {
|
|
51
|
-
expect(formatDate(new Date(2026, 4, 2), { kind: "calendar" })).toBe("2026-05-02");
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
it("uses dateFormat from context for date-only strings (dmy)", () => {
|
|
55
|
-
syncDatetimeContext({
|
|
56
|
-
locale: "vi",
|
|
57
|
-
timezone: "Asia/Ho_Chi_Minh",
|
|
58
|
-
timeFormat: "24h",
|
|
59
|
-
dateFormat: "dmy",
|
|
60
|
-
dateFnsLocale: getDateFnsLocale("vi"),
|
|
61
|
-
});
|
|
62
|
-
expect(formatDate("2026-05-01")).toBe("01/05/2026");
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it("uses dateFormat iso for ja default (yyyy-MM-dd)", () => {
|
|
66
|
-
syncDatetimeContext({
|
|
67
|
-
locale: "ja",
|
|
68
|
-
timezone: "Asia/Tokyo",
|
|
69
|
-
timeFormat: "24h",
|
|
70
|
-
dateFormat: "iso",
|
|
71
|
-
dateFnsLocale: getDateFnsLocale("ja"),
|
|
72
|
-
});
|
|
73
|
-
expect(formatDate("2026-05-01")).toBe("2026-05-01");
|
|
74
|
-
expect(formatDate("2026-05-01T14:30:00Z", { kind: "datetime" })).toMatch(/2026-05-01 23:30/);
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
it("uses dateFormat mdy for en (MM/dd/yyyy)", () => {
|
|
78
|
-
syncDatetimeContext({
|
|
79
|
-
locale: "en",
|
|
80
|
-
timezone: "UTC",
|
|
81
|
-
timeFormat: "12h",
|
|
82
|
-
dateFormat: "mdy",
|
|
83
|
-
dateFnsLocale: getDateFnsLocale("en"),
|
|
84
|
-
});
|
|
85
|
-
expect(formatDate("2026-05-01")).toBe("05/01/2026");
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
it("formatCalendarDate respects dateFormat override per call", () => {
|
|
89
|
-
expect(formatCalendarDate(new Date(2026, 4, 2), { dateFormat: "dmy" })).toBe("02/05/2026");
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it("returns em dash for empty values", () => {
|
|
93
|
-
expect(formatDate(null)).toBe("—");
|
|
94
|
-
expect(formatDate("")).toBe("—");
|
|
95
|
-
expect(formatDate(undefined)).toBe("—");
|
|
96
|
-
});
|
|
97
|
-
});
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { getDateFnsLocale } from "../../app/locales";
|
|
3
|
-
import { syncDatetimeContext } from "../datetime";
|
|
4
|
-
import {
|
|
5
|
-
formatBytes,
|
|
6
|
-
formatCurrency,
|
|
7
|
-
formatDateTime,
|
|
8
|
-
formatRelative,
|
|
9
|
-
formatTime,
|
|
10
|
-
humanError,
|
|
11
|
-
shortId,
|
|
12
|
-
} from "../format";
|
|
13
|
-
|
|
14
|
-
describe("format helpers", () => {
|
|
15
|
-
it("formatDateTime returns dash for null", () => {
|
|
16
|
-
expect(formatDateTime(null)).toBe("—");
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it("formatDateTime formats ISO string in synced timezone", () => {
|
|
20
|
-
syncDatetimeContext({
|
|
21
|
-
locale: "en",
|
|
22
|
-
timezone: "UTC",
|
|
23
|
-
timeFormat: "24h",
|
|
24
|
-
dateFormat: "iso",
|
|
25
|
-
dateFnsLocale: getDateFnsLocale("en"),
|
|
26
|
-
});
|
|
27
|
-
expect(formatDateTime("2026-05-01T14:30:00Z")).toMatch(/2026-05-01 14:30/);
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it("formatTime respects 12h vs 24h", () => {
|
|
31
|
-
const d = "2026-05-01T14:30:00Z";
|
|
32
|
-
expect(formatTime(d, { timeFormat: "24h" })).toMatch(/\d{2}:\d{2}/);
|
|
33
|
-
expect(formatTime(d, { timeFormat: "12h" })).toMatch(/PM|AM|am|pm/);
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it("formatRelative returns relative phrase", () => {
|
|
37
|
-
const recent = new Date(Date.now() - 60_000).toISOString();
|
|
38
|
-
expect(formatRelative(recent)).toMatch(/minute/i);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it("formatBytes scales units", () => {
|
|
42
|
-
expect(formatBytes(512)).toBe("512 B");
|
|
43
|
-
expect(formatBytes(2048)).toBe("2.0 KB");
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it("formatCurrency formats minor units", () => {
|
|
47
|
-
expect(formatCurrency(1995, "USD")).toMatch(/19\.95/);
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it("shortId truncates long ids", () => {
|
|
51
|
-
expect(shortId("0123456789abcdef")).toBe("01234567…");
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
it("humanError extracts message from Error", () => {
|
|
55
|
-
expect(humanError(new Error("fail"))).toBe("fail");
|
|
56
|
-
expect(humanError(new Error("500 Bad: body"))).toBe("body");
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
it("humanError returns generic for non-Error", () => {
|
|
60
|
-
expect(humanError("plain")).toMatch(/retry|thử lại|再試行/i);
|
|
61
|
-
});
|
|
62
|
-
});
|
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import { readFileSync, readdirSync } from "node:fs";
|
|
2
|
-
import { dirname, join, relative } from "node:path";
|
|
3
|
-
import { fileURLToPath } from "node:url";
|
|
4
|
-
import { describe, expect, it } from "vitest";
|
|
5
|
-
|
|
6
|
-
const componentsRoot = join(dirname(fileURLToPath(import.meta.url)), "../../components");
|
|
7
|
-
const srcRoot = join(dirname(fileURLToPath(import.meta.url)), "../..");
|
|
8
|
-
|
|
9
|
-
/** Raw Tailwind palette in components breaks theme axes — use semantic tokens instead. */
|
|
10
|
-
const FORBIDDEN_PALETTE = [
|
|
11
|
-
/\bbg-green-/,
|
|
12
|
-
/\bbg-blue-/,
|
|
13
|
-
/\bbg-amber-/,
|
|
14
|
-
/\bbg-red-\d/,
|
|
15
|
-
/\btext-green-/,
|
|
16
|
-
/\btext-blue-/,
|
|
17
|
-
/\btext-amber-/,
|
|
18
|
-
/\bborder-green-/,
|
|
19
|
-
/\bborder-blue-/,
|
|
20
|
-
/\bborder-amber-/,
|
|
21
|
-
];
|
|
22
|
-
|
|
23
|
-
/** Fixed control heights bypass --control-height density axis. */
|
|
24
|
-
const FORBIDDEN_CONTROL_HEIGHT = [
|
|
25
|
-
/\bh-8\b/,
|
|
26
|
-
/\bh-9\b/,
|
|
27
|
-
/\bh-10\b/,
|
|
28
|
-
/\bh-11\b/,
|
|
29
|
-
/\bh-12\b/,
|
|
30
|
-
/\bsize-7\b/,
|
|
31
|
-
/\bsize-8\b/,
|
|
32
|
-
/\bsize-9\b/,
|
|
33
|
-
];
|
|
34
|
-
|
|
35
|
-
/** Legacy date formatting — must use formatDate. */
|
|
36
|
-
const FORBIDDEN_DATE_FORMAT = [
|
|
37
|
-
/from ["']date-fns["']/,
|
|
38
|
-
/\.toLocaleString\s*\(/,
|
|
39
|
-
/\.toLocaleDateString\s*\(/,
|
|
40
|
-
];
|
|
41
|
-
|
|
42
|
-
const SKIP_CONTROL_HEIGHT_DIRS = new Set(["feedback/skeleton.tsx"]);
|
|
43
|
-
|
|
44
|
-
const INTERACTIVE_MUST_USE_CONTROL_STYLES = [
|
|
45
|
-
"data-entry/select.tsx",
|
|
46
|
-
"data-entry/textarea.tsx",
|
|
47
|
-
"data-entry/command.tsx",
|
|
48
|
-
"data-display/table.tsx",
|
|
49
|
-
"data-display/data-table.tsx",
|
|
50
|
-
];
|
|
51
|
-
|
|
52
|
-
const RTL_LOGICAL_PRIMITIVES = [
|
|
53
|
-
"data-entry/select.tsx",
|
|
54
|
-
"navigation/dropdown-menu.tsx",
|
|
55
|
-
"feedback/sheet.tsx",
|
|
56
|
-
];
|
|
57
|
-
|
|
58
|
-
const FORBIDDEN_RTL_PHYSICAL_SNIPPETS = [
|
|
59
|
-
"absolute left-",
|
|
60
|
-
"absolute right-",
|
|
61
|
-
" pl-",
|
|
62
|
-
" pr-",
|
|
63
|
-
" ml-auto",
|
|
64
|
-
" mr-auto",
|
|
65
|
-
"data-[inset=true]:pl-",
|
|
66
|
-
];
|
|
67
|
-
|
|
68
|
-
function listTsxFiles(dir: string): string[] {
|
|
69
|
-
const entries = readdirSync(dir, { withFileTypes: true });
|
|
70
|
-
const files: string[] = [];
|
|
71
|
-
for (const entry of entries) {
|
|
72
|
-
const full = join(dir, entry.name);
|
|
73
|
-
if (entry.isDirectory()) {
|
|
74
|
-
if (entry.name === "__tests__") continue;
|
|
75
|
-
files.push(...listTsxFiles(full));
|
|
76
|
-
} else if (entry.name.endsWith(".tsx")) {
|
|
77
|
-
files.push(full);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
return files;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function findAllViolations(patterns: RegExp[], content: string): string[] {
|
|
84
|
-
const hits: string[] = [];
|
|
85
|
-
for (const pattern of patterns) {
|
|
86
|
-
const matches = content.match(new RegExp(pattern.source, "g"));
|
|
87
|
-
if (matches) hits.push(...matches);
|
|
88
|
-
}
|
|
89
|
-
return [...new Set(hits)];
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
describe("theme token audit (components)", () => {
|
|
93
|
-
const files = listTsxFiles(componentsRoot);
|
|
94
|
-
|
|
95
|
-
it("does not use raw palette colors in any component file", () => {
|
|
96
|
-
const offenders: string[] = [];
|
|
97
|
-
for (const file of files) {
|
|
98
|
-
const rel = relative(componentsRoot, file);
|
|
99
|
-
const content = readFileSync(file, "utf8");
|
|
100
|
-
const hits = findAllViolations(FORBIDDEN_PALETTE, content);
|
|
101
|
-
if (hits.length > 0) offenders.push(`${rel}: ${hits.join(", ")}`);
|
|
102
|
-
}
|
|
103
|
-
expect(offenders, "Use semantic tokens (primary, success, warning, info, accent)").toEqual([]);
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
it("does not hardcode control heights in interactive components", () => {
|
|
107
|
-
const offenders: string[] = [];
|
|
108
|
-
for (const file of files) {
|
|
109
|
-
const rel = relative(componentsRoot, file);
|
|
110
|
-
if (SKIP_CONTROL_HEIGHT_DIRS.has(rel)) continue;
|
|
111
|
-
const content = readFileSync(file, "utf8");
|
|
112
|
-
const hits = findAllViolations(FORBIDDEN_CONTROL_HEIGHT, content);
|
|
113
|
-
if (hits.length > 0) offenders.push(`${rel}: ${hits.join(", ")}`);
|
|
114
|
-
}
|
|
115
|
-
expect(offenders, "Use var(--control-height) via control-styles.ts").toEqual([]);
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
it("interactive primitives import control-styles", () => {
|
|
119
|
-
const missing: string[] = [];
|
|
120
|
-
for (const rel of INTERACTIVE_MUST_USE_CONTROL_STYLES) {
|
|
121
|
-
const content = readFileSync(join(componentsRoot, rel), "utf8");
|
|
122
|
-
if (!content.includes("control-styles")) missing.push(rel);
|
|
123
|
-
}
|
|
124
|
-
expect(missing, "Must import shared control-styles").toEqual([]);
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
it("components do not call toLocaleString for display dates", () => {
|
|
128
|
-
const offenders: string[] = [];
|
|
129
|
-
for (const file of files) {
|
|
130
|
-
const rel = relative(componentsRoot, file);
|
|
131
|
-
const content = readFileSync(file, "utf8");
|
|
132
|
-
const hits = findAllViolations(FORBIDDEN_DATE_FORMAT, content);
|
|
133
|
-
if (hits.length > 0) offenders.push(`${rel}: ${hits.join(", ")}`);
|
|
134
|
-
}
|
|
135
|
-
expect(offenders, "Use formatDate from @/lib/datetime").toEqual([]);
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
it("shadcn primitive chrome uses logical direction utilities", () => {
|
|
139
|
-
const offenders: string[] = [];
|
|
140
|
-
for (const rel of RTL_LOGICAL_PRIMITIVES) {
|
|
141
|
-
const content = readFileSync(join(componentsRoot, rel), "utf8");
|
|
142
|
-
const hits = FORBIDDEN_RTL_PHYSICAL_SNIPPETS.filter((snippet) => content.includes(snippet));
|
|
143
|
-
if (hits.length > 0) offenders.push(`${rel}: ${hits.join(", ")}`);
|
|
144
|
-
}
|
|
145
|
-
expect(offenders, "Use start/end, ps/pe, ms/me for RTL-safe primitive chrome").toEqual([]);
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
it("dialog close offset uses logical CSS", () => {
|
|
149
|
-
const content = readFileSync(join(srcRoot, "styles/dialog-layout.css"), "utf8");
|
|
150
|
-
expect(content).toContain("inset-inline-end: var(--space-dialog-close-offset)");
|
|
151
|
-
expect(content).not.toContain("right: var(--space-dialog-close-offset)");
|
|
152
|
-
});
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
describe("theme token audit (lib/datetime)", () => {
|
|
156
|
-
it("format-date module exists and exports formatDate", () => {
|
|
157
|
-
const index = readFileSync(join(srcRoot, "lib/datetime/index.ts"), "utf8");
|
|
158
|
-
expect(index).toContain("formatDate");
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
describe("theme token audit (badge/status)", () => {
|
|
163
|
-
it("status-badge uses tone classes from control-styles", () => {
|
|
164
|
-
const content = readFileSync(join(componentsRoot, "data-display/status-badge.tsx"), "utf8");
|
|
165
|
-
expect(content).toContain("toneSuccessClass");
|
|
166
|
-
expect(content).toContain("toneWarningClass");
|
|
167
|
-
expect(content).toContain("toneInfoClass");
|
|
168
|
-
expect(content).not.toMatch(/green-500/);
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
it("badge success variant uses toneSuccessClass", () => {
|
|
172
|
-
const content = readFileSync(join(componentsRoot, "data-display/badge.tsx"), "utf8");
|
|
173
|
-
expect(content).toContain("toneSuccessClass");
|
|
174
|
-
expect(content).not.toMatch(/bg-green-/);
|
|
175
|
-
});
|
|
176
|
-
});
|
|
@@ -1,118 +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
|
-
|
|
6
|
-
const root = join(dirname(fileURLToPath(import.meta.url)), "../..");
|
|
7
|
-
|
|
8
|
-
function readSrc(relative: string): string {
|
|
9
|
-
return readFileSync(join(root, relative), "utf8");
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function readStyle(name: string): string {
|
|
13
|
-
return readSrc(`styles/${name}`);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
describe("theme CSS tokens (base.css + layout owners)", () => {
|
|
17
|
-
const base = readSrc("tokens/base.css");
|
|
18
|
-
const tokenCss = [
|
|
19
|
-
base,
|
|
20
|
-
readSrc("tokens/foundation.css"),
|
|
21
|
-
readSrc("tokens/primitives/layout.css"),
|
|
22
|
-
readSrc("tokens/primitives/control.css"),
|
|
23
|
-
readSrc("tokens/primitives/card.css"),
|
|
24
|
-
readSrc("tokens/primitives/table.css"),
|
|
25
|
-
readSrc("tokens/primitives/feedback.css"),
|
|
26
|
-
readSrc("tokens/primitives/badge.css"),
|
|
27
|
-
].join("\n");
|
|
28
|
-
const index = readSrc("styles/index.css");
|
|
29
|
-
const density = readStyle("density.css");
|
|
30
|
-
const control = readStyle("control.css");
|
|
31
|
-
|
|
32
|
-
it("defines semantic color tokens in :root", () => {
|
|
33
|
-
for (const token of [
|
|
34
|
-
"--primary:",
|
|
35
|
-
"--accent:",
|
|
36
|
-
"--ring:",
|
|
37
|
-
"--success:",
|
|
38
|
-
"--warning:",
|
|
39
|
-
"--info:",
|
|
40
|
-
"--attention:",
|
|
41
|
-
"--tracking-internal:",
|
|
42
|
-
"--tracking-seller:",
|
|
43
|
-
"--tracking-yamato:",
|
|
44
|
-
"--destructive:",
|
|
45
|
-
]) {
|
|
46
|
-
expect(tokenCss, `missing ${token} in token graph`).toContain(token);
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it("defines density primitives in :root", () => {
|
|
51
|
-
for (const token of [
|
|
52
|
-
"--control-height-compact",
|
|
53
|
-
"--control-height-default",
|
|
54
|
-
"--control-height-comfortable",
|
|
55
|
-
"--table-row-height-compact",
|
|
56
|
-
"--table-row-height-default",
|
|
57
|
-
"--table-row-height-comfortable",
|
|
58
|
-
"--table-cell-padding-y",
|
|
59
|
-
]) {
|
|
60
|
-
expect(tokenCss, `missing ${token}`).toContain(token);
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
it("uses base.css as the token manifest", () => {
|
|
65
|
-
for (const file of [
|
|
66
|
-
"foundation.css",
|
|
67
|
-
"primitives/layout.css",
|
|
68
|
-
"primitives/control.css",
|
|
69
|
-
"primitives/card.css",
|
|
70
|
-
"primitives/table.css",
|
|
71
|
-
"primitives/feedback.css",
|
|
72
|
-
"primitives/badge.css",
|
|
73
|
-
]) {
|
|
74
|
-
expect(base).toContain(`@import "./${file}"`);
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
it("maps semantic colors in @theme for Tailwind", () => {
|
|
79
|
-
for (const token of [
|
|
80
|
-
"--color-primary:",
|
|
81
|
-
"--color-accent:",
|
|
82
|
-
"--color-ring:",
|
|
83
|
-
"--color-success:",
|
|
84
|
-
"--color-warning:",
|
|
85
|
-
"--color-info:",
|
|
86
|
-
"--color-attention:",
|
|
87
|
-
"--color-tracking-internal:",
|
|
88
|
-
"--color-tracking-seller:",
|
|
89
|
-
"--color-tracking-yamato:",
|
|
90
|
-
]) {
|
|
91
|
-
expect(index, `missing ${token} in index.css @theme`).toContain(token);
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
it("defines ui-control utilities in control.css", () => {
|
|
96
|
-
expect(control).toContain(".ui-control {");
|
|
97
|
-
expect(control).toContain("height: var(--control-height)");
|
|
98
|
-
expect(control).toContain(".ui-control-multiline {");
|
|
99
|
-
expect(control).toContain("font-size: var(--font-size-sm)");
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
it("sets --table-cell-padding-y per density class", () => {
|
|
103
|
-
expect(density).toContain(".ui-density-compact {");
|
|
104
|
-
expect(density).toMatch(/ui-density-compact[\s\S]*--table-cell-padding-y/);
|
|
105
|
-
expect(density).toMatch(/ui-density-comfortable[\s\S]*--table-cell-padding-y/);
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
it("wires Tailwind text-* to typography tokens", () => {
|
|
109
|
-
expect(index).toContain("--text-sm: var(--font-size-sm)");
|
|
110
|
-
expect(index).toContain("--text-xs: var(--font-size-xs)");
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
it("imports split layout CSS owners", () => {
|
|
114
|
-
for (const file of ["density.css", "layout.css", "card-layout.css", "table-layout.css"]) {
|
|
115
|
-
expect(index).toContain(`@import "./${file}"`);
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
});
|
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
import { readFileSync, readdirSync, statSync } from "node:fs";
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
import { describe, expect, it } from "vitest";
|
|
4
|
-
|
|
5
|
-
const root = join(import.meta.dirname, "../..");
|
|
6
|
-
|
|
7
|
-
const LAYOUT_CSS_FILES = [
|
|
8
|
-
"density.css",
|
|
9
|
-
"layout.css",
|
|
10
|
-
"control.css",
|
|
11
|
-
"card-layout.css",
|
|
12
|
-
"table-layout.css",
|
|
13
|
-
"dialog-layout.css",
|
|
14
|
-
"alert-layout.css",
|
|
15
|
-
"badge-layout.css",
|
|
16
|
-
];
|
|
17
|
-
|
|
18
|
-
/** Components fully on data-slot + *-layout.css — must stay free of Tailwind spacing utilities. */
|
|
19
|
-
const MIGRATED_LAYOUT_COMPONENTS = [
|
|
20
|
-
"components/data-display/table.tsx",
|
|
21
|
-
"components/data-display/empty-state.tsx",
|
|
22
|
-
"components/data-display/status-badge.tsx",
|
|
23
|
-
"components/data-display/data-table.tsx",
|
|
24
|
-
"components/feedback/dialog.tsx",
|
|
25
|
-
"components/feedback/alert.tsx",
|
|
26
|
-
"components/data-display/card.tsx",
|
|
27
|
-
];
|
|
28
|
-
|
|
29
|
-
/** Pending migration — tracked separately; do not add new files without a layout owner. */
|
|
30
|
-
const SPACING_UTILITY_ALLOWLIST = new Set([
|
|
31
|
-
"calendar.tsx",
|
|
32
|
-
"command.tsx",
|
|
33
|
-
"upload.tsx",
|
|
34
|
-
"upload-crop-dialog.tsx",
|
|
35
|
-
"cascader.tsx",
|
|
36
|
-
"tree-select.tsx",
|
|
37
|
-
"transfer.tsx",
|
|
38
|
-
"time-picker.tsx",
|
|
39
|
-
"tabs.tsx",
|
|
40
|
-
"tabs-items.tsx",
|
|
41
|
-
"steps.tsx",
|
|
42
|
-
"sheet.tsx",
|
|
43
|
-
"dropdown-menu.tsx",
|
|
44
|
-
"pagination.tsx",
|
|
45
|
-
"skeleton.tsx",
|
|
46
|
-
"choice-field.tsx",
|
|
47
|
-
"radio.tsx",
|
|
48
|
-
"color-picker.tsx",
|
|
49
|
-
"autocomplete.tsx",
|
|
50
|
-
"date-range-picker.tsx",
|
|
51
|
-
"locale-picker.tsx",
|
|
52
|
-
"timezone-picker.tsx",
|
|
53
|
-
"date-format-picker.tsx",
|
|
54
|
-
"query-refetch-button.tsx",
|
|
55
|
-
"key-value-grid.tsx",
|
|
56
|
-
"card.tsx", // CardStat title uses text-2xl override (value typography)
|
|
57
|
-
"button.tsx", // size variants use token-backed arbitrary lengths
|
|
58
|
-
]);
|
|
59
|
-
|
|
60
|
-
const FORBIDDEN_IN_COMPONENTS =
|
|
61
|
-
/\b(p|px|py|pt|pb|pl|pr|m|mx|my|mt|mb|ml|mr|gap|space-[xy])-(0|0\.5|1|1\.5|2|2\.5|3|3\.5|4|5|6|7|8|9|10|11|12|14|16|20|24|28|32|36|40|44|48|52|56|60|64|72|80|96)\b/;
|
|
62
|
-
|
|
63
|
-
const FORBIDDEN_RAW_COLORS =
|
|
64
|
-
/\b(text|bg|border)-(emerald|red|green|blue|yellow|orange|pink|purple|gray|slate|zinc|neutral|stone|amber|lime|teal|cyan|indigo|violet|fuchsia|rose)-/;
|
|
65
|
-
|
|
66
|
-
function walkComponents(dir: string): string[] {
|
|
67
|
-
const out: string[] = [];
|
|
68
|
-
for (const entry of readdirSync(dir)) {
|
|
69
|
-
const full = join(dir, entry);
|
|
70
|
-
if (statSync(full).isDirectory()) {
|
|
71
|
-
out.push(...walkComponents(full));
|
|
72
|
-
} else if (entry.endsWith(".tsx") && !entry.endsWith(".test.tsx")) {
|
|
73
|
-
out.push(full);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return out;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
describe("token governance", () => {
|
|
80
|
-
const base = readFileSync(join(root, "tokens/base.css"), "utf8");
|
|
81
|
-
const tokenCss = [
|
|
82
|
-
base,
|
|
83
|
-
readFileSync(join(root, "tokens/foundation.css"), "utf8"),
|
|
84
|
-
readFileSync(join(root, "tokens/primitives/layout.css"), "utf8"),
|
|
85
|
-
readFileSync(join(root, "tokens/primitives/control.css"), "utf8"),
|
|
86
|
-
readFileSync(join(root, "tokens/primitives/card.css"), "utf8"),
|
|
87
|
-
readFileSync(join(root, "tokens/primitives/table.css"), "utf8"),
|
|
88
|
-
readFileSync(join(root, "tokens/primitives/feedback.css"), "utf8"),
|
|
89
|
-
readFileSync(join(root, "tokens/primitives/badge.css"), "utf8"),
|
|
90
|
-
].join("\n");
|
|
91
|
-
|
|
92
|
-
it("imports all layout CSS owners from index.css", () => {
|
|
93
|
-
const index = readFileSync(join(root, "styles/index.css"), "utf8");
|
|
94
|
-
for (const file of LAYOUT_CSS_FILES) {
|
|
95
|
-
expect(index, `missing @import ./${file}`).toContain(`@import "./${file}"`);
|
|
96
|
-
}
|
|
97
|
-
expect(index).not.toContain(".ui-stack-md {");
|
|
98
|
-
expect(index).not.toContain('[data-slot="card-header"]');
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
it("uses base.css as the token manifest", () => {
|
|
102
|
-
for (const file of [
|
|
103
|
-
"foundation.css",
|
|
104
|
-
"primitives/layout.css",
|
|
105
|
-
"primitives/control.css",
|
|
106
|
-
"primitives/card.css",
|
|
107
|
-
"primitives/table.css",
|
|
108
|
-
"primitives/feedback.css",
|
|
109
|
-
"primitives/badge.css",
|
|
110
|
-
]) {
|
|
111
|
-
expect(base).toContain(`@import "./${file}"`);
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
it("defines component slot tokens in the token graph", () => {
|
|
116
|
-
for (const token of [
|
|
117
|
-
"--space-dialog-inset",
|
|
118
|
-
"--space-alert-inset",
|
|
119
|
-
"--space-table-cell-x",
|
|
120
|
-
"--space-badge-x",
|
|
121
|
-
"--card-title-font-size",
|
|
122
|
-
"--control-height-default",
|
|
123
|
-
]) {
|
|
124
|
-
expect(tokenCss).toContain(token);
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
it("keeps migrated components free of Tailwind spacing utilities", () => {
|
|
129
|
-
const violations: string[] = [];
|
|
130
|
-
|
|
131
|
-
for (const relative of MIGRATED_LAYOUT_COMPONENTS) {
|
|
132
|
-
const src = readFileSync(join(root, relative), "utf8");
|
|
133
|
-
if (FORBIDDEN_IN_COMPONENTS.test(src)) {
|
|
134
|
-
violations.push(relative.split("/").pop()!);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
expect(violations, `move spacing to *-layout.css: ${violations.join(", ")}`).toEqual([]);
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
it("keeps non-allowlisted components on migration track (informational cap)", () => {
|
|
142
|
-
const componentsDir = join(root, "components");
|
|
143
|
-
const pending: string[] = [];
|
|
144
|
-
|
|
145
|
-
for (const file of walkComponents(componentsDir)) {
|
|
146
|
-
const name = file.split("/").pop()!;
|
|
147
|
-
const relative = file.slice(root.length + 1);
|
|
148
|
-
if (MIGRATED_LAYOUT_COMPONENTS.some((m) => relative.endsWith(m.replace(/^components\//, ""))))
|
|
149
|
-
continue;
|
|
150
|
-
if (SPACING_UTILITY_ALLOWLIST.has(name)) continue;
|
|
151
|
-
|
|
152
|
-
const src = readFileSync(file, "utf8");
|
|
153
|
-
if (FORBIDDEN_IN_COMPONENTS.test(src)) {
|
|
154
|
-
pending.push(name);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
expect(pending.length, `pending layout migration: ${pending.join(", ")}`).toBeLessThan(30);
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
it("keeps migrated components free of raw Tailwind palette colors", () => {
|
|
162
|
-
const violations: string[] = [];
|
|
163
|
-
|
|
164
|
-
for (const relative of MIGRATED_LAYOUT_COMPONENTS) {
|
|
165
|
-
if (relative.endsWith("card.tsx")) continue;
|
|
166
|
-
const src = readFileSync(join(root, relative), "utf8");
|
|
167
|
-
if (FORBIDDEN_RAW_COLORS.test(src)) {
|
|
168
|
-
violations.push(relative.split("/").pop()!);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
expect(violations, `use semantic tokens: ${violations.join(", ")}`).toEqual([]);
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
it("legacy scan — non-migrated must not grow unbounded", () => {
|
|
176
|
-
const componentsDir = join(root, "components");
|
|
177
|
-
const violations: string[] = [];
|
|
178
|
-
|
|
179
|
-
for (const file of walkComponents(componentsDir)) {
|
|
180
|
-
const name = file.split("/").pop()!;
|
|
181
|
-
if (SPACING_UTILITY_ALLOWLIST.has(name)) continue;
|
|
182
|
-
|
|
183
|
-
const src = readFileSync(file, "utf8");
|
|
184
|
-
if (FORBIDDEN_RAW_COLORS.test(src)) {
|
|
185
|
-
violations.push(name);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
expect(violations.length).toBeLessThan(15);
|
|
190
|
-
});
|
|
191
|
-
});
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { densityClass, inlineGapClass, stackGapClass } from "../variants";
|
|
3
|
-
|
|
4
|
-
describe("variants maps", () => {
|
|
5
|
-
it("maps page density to ui classes", () => {
|
|
6
|
-
expect(densityClass.compact).toBe("ui-density-compact");
|
|
7
|
-
expect(densityClass.default).toBe("ui-density-default");
|
|
8
|
-
expect(densityClass.comfortable).toBe("ui-density-comfortable");
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
it("maps stack gaps", () => {
|
|
12
|
-
expect(stackGapClass.md).toBe("ui-stack-md");
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it("maps inline gaps", () => {
|
|
16
|
-
expect(inlineGapClass.sm).toBe("ui-inline-sm");
|
|
17
|
-
});
|
|
18
|
-
});
|