@godxjp/ui 19.1.0 → 19.2.0
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/README.md +25 -128
- package/dist/app/theme-axes.d.ts +4 -15
- package/dist/app/timezones.d.ts +1 -4
- package/dist/components/charts/area-chart.d.ts +2 -3
- package/dist/components/charts/bar-chart.d.ts +2 -3
- package/dist/components/charts/chart-frame.d.ts +7 -16
- package/dist/components/charts/chart-summary.d.ts +2 -2
- package/dist/components/charts/compact-bar-trend.d.ts +9 -24
- package/dist/components/charts/index.d.ts +1 -6
- package/dist/components/data-display/badge.d.ts +2 -12
- package/dist/components/data-display/card.d.ts +21 -41
- package/dist/components/data-display/carousel.d.ts +1 -2
- package/dist/components/data-display/code-block.d.ts +4 -0
- package/dist/components/data-display/code-block.js +24 -0
- package/dist/components/data-display/data-table.d.ts +15 -37
- package/dist/components/data-display/data-table.js +1 -3
- package/dist/components/data-display/descriptions.d.ts +2 -6
- package/dist/components/data-display/descriptions.js +0 -2
- package/dist/components/data-display/index.d.ts +4 -0
- package/dist/components/data-display/index.js +4 -0
- package/dist/components/data-display/list-row.d.ts +3 -22
- package/dist/components/data-display/permission-matrix.d.ts +7 -20
- package/dist/components/data-display/progress.d.ts +1 -1
- package/dist/components/data-display/prose.d.ts +4 -0
- package/dist/components/data-display/prose.js +20 -0
- package/dist/components/data-display/service-launcher-card.d.ts +3 -10
- package/dist/components/data-display/table.d.ts +20 -80
- package/dist/components/data-display/table.js +0 -3
- package/dist/components/data-display/timeline.d.ts +3 -5
- package/dist/components/data-entry/branch-scope-picker.d.ts +2 -19
- package/dist/components/data-entry/branch-scope-picker.js +0 -1
- package/dist/components/data-entry/calendar.d.ts +3 -2
- package/dist/components/data-entry/calendar.js +58 -3
- package/dist/components/data-entry/command-palette.d.ts +8 -22
- package/dist/components/data-entry/date-picker.d.ts +4 -5
- package/dist/components/data-entry/date-picker.js +6 -1
- package/dist/components/data-entry/date-range-picker.d.ts +1 -1
- package/dist/components/data-entry/date-range-picker.js +8 -3
- package/dist/components/data-entry/form-errors.d.ts +7 -18
- package/dist/components/data-entry/form-field.js +1 -5
- package/dist/components/data-entry/form.d.ts +1 -9
- package/dist/components/data-entry/input.d.ts +16 -14
- package/dist/components/data-entry/input.js +3 -0
- package/dist/components/data-entry/month-picker.js +2 -2
- package/dist/components/data-entry/month-range-picker.d.ts +4 -6
- package/dist/components/data-entry/month-range-picker.js +2 -2
- package/dist/components/data-entry/number-input.d.ts +1 -5
- package/dist/components/data-entry/number-input.js +1 -0
- package/dist/components/data-entry/radio.js +0 -1
- package/dist/components/data-entry/search-select.d.ts +2 -4
- package/dist/components/data-entry/select.d.ts +11 -6
- package/dist/components/data-entry/select.js +4 -2
- package/dist/components/data-entry/switch.js +0 -1
- package/dist/components/data-entry/textarea.d.ts +10 -16
- package/dist/components/data-entry/time-picker.d.ts +3 -5
- package/dist/components/data-entry/upload-types.d.ts +1 -5
- package/dist/components/data-entry/use-upload-draft.d.ts +0 -4
- package/dist/components/feedback/dialog.d.ts +6 -15
- package/dist/components/feedback/overlay-header-tone.d.ts +1 -1
- package/dist/components/feedback/sheet.d.ts +3 -10
- package/dist/components/feedback/sheet.js +1 -1
- package/dist/components/feedback/sonner.js +2 -3
- package/dist/components/general/activity.d.ts +4 -30
- package/dist/components/general/button.js +1 -10
- package/dist/components/general/logo.d.ts +6 -28
- package/dist/components/general/reveal.d.ts +3 -9
- package/dist/components/general/typography.d.ts +1 -3
- package/dist/components/layout/account-chip.d.ts +8 -0
- package/dist/components/layout/account-chip.js +45 -0
- package/dist/components/layout/auth-divider.d.ts +2 -9
- package/dist/components/layout/auth-shell.d.ts +1 -14
- package/dist/components/layout/breadcrumb.d.ts +1 -5
- package/dist/components/layout/centered-shell.d.ts +4 -18
- package/dist/components/layout/error-surface.d.ts +11 -28
- package/dist/components/layout/error-surface.js +4 -1
- package/dist/components/layout/index.d.ts +2 -0
- package/dist/components/layout/index.js +2 -0
- package/dist/components/layout/legal-document-shell.d.ts +5 -28
- package/dist/components/layout/master-detail.d.ts +2 -18
- package/dist/components/layout/page-container.js +0 -1
- package/dist/components/layout/responsive-grid.d.ts +6 -1
- package/dist/components/layout/responsive-grid.js +9 -2
- package/dist/components/layout/service-role-panel.d.ts +7 -19
- package/dist/components/layout/sidebar.d.ts +5 -27
- package/dist/components/layout/sidebar.js +0 -1
- package/dist/components/layout/split-pane.d.ts +0 -7
- package/dist/components/layout/topbar.d.ts +1 -14
- package/dist/components/navigation/app-setting-picker.js +1 -3
- package/dist/components/navigation/filter-bar.d.ts +1 -6
- package/dist/components/navigation/pagination-utils.d.ts +2 -12
- package/dist/components/navigation/tabs-scroll.d.ts +2 -36
- package/dist/components/navigation/tabs.js +4 -8
- package/dist/components/query/data-state.d.ts +2 -2
- package/dist/components/ui/credential-reveal.d.ts +1 -4
- package/dist/components/ui/hover-card.d.ts +1 -2
- package/dist/components/ui/separator.d.ts +2 -15
- package/dist/components/ui/toggle-group.d.ts +1 -5
- package/dist/components/ui/toggle.d.ts +6 -31
- package/dist/email/brand-mark.d.ts +6 -34
- package/dist/email/color.d.ts +7 -17
- package/dist/email/geometry.d.ts +4 -8
- package/dist/email/index.d.ts +4 -48
- package/dist/email/inline-style.d.ts +3 -9
- package/dist/email/urgency.d.ts +2 -7
- package/dist/form/form-context.d.ts +2 -5
- package/dist/form/form-root.d.ts +1 -2
- package/dist/i18n/messages/en.json +4 -0
- package/dist/i18n/messages/ja.json +4 -0
- package/dist/i18n/messages/vi.json +4 -0
- package/dist/inertia/index.d.ts +2 -10
- package/dist/lib/control-styles.d.ts +10 -21
- package/dist/lib/control-styles.js +4 -6
- package/dist/lib/datetime/format-date.d.ts +1 -4
- package/dist/lib/field-a11y.d.ts +11 -68
- package/dist/lib/field-a11y.js +0 -1
- package/dist/lib/format.d.ts +4 -8
- package/dist/lib/hooks.d.ts +6 -12
- package/dist/lib/permission-grid.d.ts +3 -18
- package/dist/lib/query-error.d.ts +3 -3
- package/dist/props/components/app.prop.d.ts +15 -38
- package/dist/props/components/charts.prop.d.ts +2 -3
- package/dist/props/components/data-display.prop.d.ts +48 -72
- package/dist/props/components/data-entry.prop.d.ts +35 -40
- package/dist/props/components/form.prop.d.ts +2 -6
- package/dist/props/components/general.prop.d.ts +11 -27
- package/dist/props/components/layout.prop.d.ts +89 -260
- package/dist/props/components/navigation.prop.d.ts +27 -42
- package/dist/props/registry.d.ts +31 -0
- package/dist/props/registry.js +33 -0
- package/dist/props/vocabulary/data.prop.d.ts +18 -49
- package/dist/props/vocabulary/index.d.ts +1 -1
- package/dist/props/vocabulary/interaction.prop.d.ts +10 -12
- package/dist/props/vocabulary/layout.prop.d.ts +8 -30
- package/dist/props/vocabulary/shared.prop.d.ts +3 -2
- package/dist/styles/alert-layout.css +1 -32
- package/dist/styles/badge-layout.css +4 -18
- package/dist/styles/base.css +14 -113
- package/dist/styles/card-layout.css +6 -128
- package/dist/styles/chart-layout.css +2 -17
- package/dist/styles/control.css +380 -458
- package/dist/styles/core.css +21 -0
- package/dist/styles/data-display-layout.css +175 -94
- package/dist/styles/data-entry-layout.css +0 -45
- package/dist/styles/density.css +1 -30
- package/dist/styles/dialog-layout.css +5 -69
- package/dist/styles/focus-ring.css +13 -87
- package/dist/styles/fonts.css +1 -31
- package/dist/styles/form-layout.css +7 -91
- package/dist/styles/index.css +2 -20
- package/dist/styles/layout.css +38 -456
- package/dist/styles/logo-layout.css +1 -35
- package/dist/styles/motion.css +3 -42
- package/dist/styles/navigation-layout.css +3 -50
- package/dist/styles/shell-layout.css +37 -403
- package/dist/styles/table-layout.css +16 -274
- package/dist/styles/text-layout.css +7 -21
- package/dist/styles/toggle.css +1 -23
- package/dist/theme/dxs.canonical.css +1 -55
- package/dist/theme/example.service.css +1 -26
- package/dist/theme/famgia.service.css +5 -15
- package/dist/tokens/axes.css +3 -40
- package/dist/tokens/base.css +1 -4
- package/dist/tokens/components/activity.css +6 -42
- package/dist/tokens/components/badge.css +4 -13
- package/dist/tokens/components/banner.css +4 -9
- package/dist/tokens/components/card.css +32 -88
- package/dist/tokens/components/chart.css +9 -26
- package/dist/tokens/components/control.css +37 -222
- package/dist/tokens/components/data-display.css +28 -79
- package/dist/tokens/components/data-entry.css +5 -19
- package/dist/tokens/components/descriptions.css +7 -27
- package/dist/tokens/components/email.css +38 -84
- package/dist/tokens/components/error-surface.css +2 -18
- package/dist/tokens/components/feedback.css +27 -124
- package/dist/tokens/components/form.css +13 -45
- package/dist/tokens/components/legal-document.css +16 -41
- package/dist/tokens/components/list-row.css +11 -36
- package/dist/tokens/components/logo.css +2 -57
- package/dist/tokens/components/navigation.css +16 -94
- package/dist/tokens/components/scroll-area.css +2 -18
- package/dist/tokens/components/separator.css +8 -30
- package/dist/tokens/components/sheet.css +3 -14
- package/dist/tokens/components/shell.css +53 -307
- package/dist/tokens/components/sidebar.css +5 -22
- package/dist/tokens/components/table.css +19 -140
- package/dist/tokens/components/toggle.css +3 -65
- package/dist/tokens/components/upload.css +7 -43
- package/dist/tokens/foundation.css +108 -383
- package/dist/tokens/semantic/layout.css +33 -207
- package/docs/CANONICAL-CONTRACTS.md +206 -0
- package/docs/COMPONENTS.md +157 -0
- package/docs/COMPOSITION-VS-COMPONENT.md +105 -0
- package/docs/CONSUMER-RULES.md +14 -0
- package/docs/CUSTOMER-THEMING.md +162 -0
- package/docs/DATETIME.md +69 -0
- package/docs/DEVELOPMENT.md +173 -0
- package/docs/FORMS.md +143 -0
- package/docs/FRAME-A11Y-CI.md +267 -0
- package/docs/FRAME-COVERAGE-LEDGER.md +123 -0
- package/docs/FRAME-COVERAGE-REPORT.md +140 -0
- package/docs/FRAME-COVERAGE-STANDARD.md +65 -0
- package/docs/FRAME-COVERAGE.md +29 -0
- package/docs/PROPS-REGISTRY.md +61 -0
- package/docs/PROPS-VOCABULARY.md +100 -0
- package/docs/README.md +60 -0
- package/docs/REGISTRY.md +70 -0
- package/docs/SPACING.md +56 -0
- package/docs/STANDARDS-vocabulary-tokens.md +48 -0
- package/docs/TESTING.md +98 -0
- package/docs/TOKENS.md +347 -0
- package/docs/asset-modules.d.ts +46 -0
- package/docs/assets/cover-terrain.svg +6 -0
- package/docs/assets/portrait-amber.svg +5 -0
- package/docs/assets/portrait-clay.svg +5 -0
- package/docs/assets/portrait-indigo.svg +5 -0
- package/docs/assets/portrait-iris.svg +5 -0
- package/docs/assets/portrait-moss.svg +5 -0
- package/docs/assets/portrait-plum.svg +5 -0
- package/docs/assets/portrait-slate.svg +5 -0
- package/docs/charts/compact-bar-trend.tsx +328 -0
- package/docs/charts/size-tiers.tsx +192 -0
- package/docs/data-display/accordion.tsx +99 -0
- package/docs/data-display/avatar.tsx +355 -0
- package/docs/data-display/badge.tsx +247 -0
- package/docs/data-display/card/examples/detail-panel.tsx +106 -0
- package/docs/data-display/card/index.md +3 -0
- package/docs/data-display/card/index.tsx +285 -0
- package/docs/data-display/carousel.tsx +156 -0
- package/docs/data-display/charts.tsx +198 -0
- package/docs/data-display/code-block.tsx +90 -0
- package/docs/data-display/collapsible.tsx +162 -0
- package/docs/data-display/credential-reveal.tsx +145 -0
- package/docs/data-display/data-table/examples/approval-queue.tsx +212 -0
- package/docs/data-display/data-table/examples/grid-features.tsx +158 -0
- package/docs/data-display/data-table/examples/list-page.tsx +175 -0
- package/docs/data-display/data-table/index.md +5 -0
- package/docs/data-display/data-table/index.tsx +295 -0
- package/docs/data-display/descriptions.tsx +143 -0
- package/docs/data-display/empty-state.tsx +164 -0
- package/docs/data-display/hover-card.tsx +181 -0
- package/docs/data-display/list-row.tsx +420 -0
- package/docs/data-display/permission-matrix.tsx +184 -0
- package/docs/data-display/popover-touch.tsx +27 -0
- package/docs/data-display/popover.tsx +245 -0
- package/docs/data-display/progress.tsx +84 -0
- package/docs/data-display/prose.tsx +105 -0
- package/docs/data-display/qr-code.tsx +68 -0
- package/docs/data-display/scroll-area.tsx +271 -0
- package/docs/data-display/service-launcher-card.tsx +145 -0
- package/docs/data-display/stat-card.tsx +99 -0
- package/docs/data-display/table.tsx +251 -0
- package/docs/data-display/timeline.tsx +112 -0
- package/docs/data-display/touch-actions.tsx +36 -0
- package/docs/data-display/tree-list.tsx +107 -0
- package/docs/data-entry/branch-scope-picker.tsx +123 -0
- package/docs/data-entry/calendar.tsx +180 -0
- package/docs/data-entry/cascader.tsx +378 -0
- package/docs/data-entry/checkbox.tsx +256 -0
- package/docs/data-entry/color-picker.tsx +117 -0
- package/docs/data-entry/command-palette.tsx +179 -0
- package/docs/data-entry/command.tsx +262 -0
- package/docs/data-entry/country-picker-recipe.tsx +170 -0
- package/docs/data-entry/date-picker.tsx +191 -0
- package/docs/data-entry/date-range-picker.tsx +149 -0
- package/docs/data-entry/form/examples/employee-settings.tsx +267 -0
- package/docs/data-entry/form/examples/invoice-form.tsx +387 -0
- package/docs/data-entry/form-field/examples/a11y-contract.tsx +240 -0
- package/docs/data-entry/form-field/examples/create-form.tsx +105 -0
- package/docs/data-entry/form-field/index.md +8 -0
- package/docs/data-entry/form-field/index.tsx +326 -0
- package/docs/data-entry/form-inertia.tsx +80 -0
- package/docs/data-entry/form-root.tsx +102 -0
- package/docs/data-entry/form.tsx +724 -0
- package/docs/data-entry/input-otp.tsx +231 -0
- package/docs/data-entry/input.tsx +114 -0
- package/docs/data-entry/label.tsx +100 -0
- package/docs/data-entry/month-picker.tsx +101 -0
- package/docs/data-entry/month-range-picker.tsx +115 -0
- package/docs/data-entry/number-input.tsx +240 -0
- package/docs/data-entry/password-input.tsx +106 -0
- package/docs/data-entry/password-strength.tsx +97 -0
- package/docs/data-entry/radio-group.tsx +95 -0
- package/docs/data-entry/rating.tsx +87 -0
- package/docs/data-entry/search-input.tsx +120 -0
- package/docs/data-entry/select-async-contracts.tsx +108 -0
- package/docs/data-entry/select-matrix.tsx +204 -0
- package/docs/data-entry/select.tsx +369 -0
- package/docs/data-entry/slider.tsx +130 -0
- package/docs/data-entry/switch.tsx +67 -0
- package/docs/data-entry/tag-input.tsx +108 -0
- package/docs/data-entry/textarea.tsx +209 -0
- package/docs/data-entry/time-picker.tsx +99 -0
- package/docs/data-entry/toggle-count.tsx +293 -0
- package/docs/data-entry/toggle-group.tsx +225 -0
- package/docs/data-entry/toggle.tsx +127 -0
- package/docs/data-entry/transfer.tsx +97 -0
- package/docs/data-entry/tree-select.tsx +204 -0
- package/docs/data-entry/upload.tsx +184 -0
- package/docs/feedback/alert-dialog.tsx +270 -0
- package/docs/feedback/alert.tsx +248 -0
- package/docs/feedback/banner.tsx +183 -0
- package/docs/feedback/danger-confirm.tsx +88 -0
- package/docs/feedback/dialog-touch.tsx +24 -0
- package/docs/feedback/dialog.tsx +193 -0
- package/docs/feedback/sheet.tsx +410 -0
- package/docs/feedback/skeleton.tsx +111 -0
- package/docs/feedback/toast.tsx +135 -0
- package/docs/feedback/tooltip.tsx +171 -0
- package/docs/feedback/two-factor-setup.tsx +68 -0
- package/docs/foundation/_email-specimen.ts +274 -0
- package/docs/foundation/colors.tsx +202 -0
- package/docs/foundation/density.tsx +232 -0
- package/docs/foundation/email-tokens.tsx +306 -0
- package/docs/foundation/radius-shadow.tsx +152 -0
- package/docs/foundation/spacing.tsx +211 -0
- package/docs/foundation/typography.tsx +147 -0
- package/docs/general/activity.tsx +224 -0
- package/docs/general/button/examples/destructive-confirm.tsx +90 -0
- package/docs/general/button/examples/form-actions.tsx +85 -0
- package/docs/general/button/examples/toolbar.tsx +160 -0
- package/docs/general/button/index.md +12 -0
- package/docs/general/button/index.tsx +211 -0
- package/docs/general/logo.tsx +131 -0
- package/docs/general/reveal.tsx +41 -0
- package/docs/general/typography.tsx +152 -0
- package/docs/layout/account-chip.tsx +72 -0
- package/docs/layout/admin-collection.tsx +122 -0
- package/docs/layout/app-shell.tsx +374 -0
- package/docs/layout/aspect-ratio.tsx +119 -0
- package/docs/layout/auth-account-summary.tsx +103 -0
- package/docs/layout/auth-divider.tsx +28 -0
- package/docs/layout/auth-footer.tsx +37 -0
- package/docs/layout/auth-identity.tsx +36 -0
- package/docs/layout/auth-recovery/examples/mfa-challenge.md +41 -0
- package/docs/layout/auth-recovery/examples/mfa-challenge.tsx +254 -0
- package/docs/layout/auth-recovery/examples/mobile-390.md +25 -0
- package/docs/layout/auth-recovery/examples/mobile-390.tsx +82 -0
- package/docs/layout/auth-recovery/examples/password-recovery.md +24 -0
- package/docs/layout/auth-recovery/examples/password-recovery.tsx +197 -0
- package/docs/layout/auth-recovery/examples/wrapping-ja-en-vi.md +27 -0
- package/docs/layout/auth-recovery/examples/wrapping-ja-en-vi.tsx +156 -0
- package/docs/layout/auth-recovery/index.md +140 -0
- package/docs/layout/auth-recovery/index.tsx +96 -0
- package/docs/layout/auth-shell-context.tsx +103 -0
- package/docs/layout/auth-shell-device.tsx +112 -0
- package/docs/layout/auth-shell-registration.tsx +335 -0
- package/docs/layout/auth-shell-variants.tsx +139 -0
- package/docs/layout/auth-shell.tsx +59 -0
- package/docs/layout/auth-stack.tsx +40 -0
- package/docs/layout/centered-shell.tsx +102 -0
- package/docs/layout/error-surface/examples/application-403.tsx +84 -0
- package/docs/layout/error-surface/examples/application-404.tsx +77 -0
- package/docs/layout/error-surface/examples/system-500.tsx +47 -0
- package/docs/layout/error-surface/examples/system-503.tsx +48 -0
- package/docs/layout/error-surface/index.md +153 -0
- package/docs/layout/error-surface/index.tsx +239 -0
- package/docs/layout/flex.tsx +262 -0
- package/docs/layout/legal-document-shell/_data.ts +110 -0
- package/docs/layout/legal-document-shell/examples/desktop-1440.md +12 -0
- package/docs/layout/legal-document-shell/examples/desktop-1440.tsx +83 -0
- package/docs/layout/legal-document-shell/examples/mobile-390.md +22 -0
- package/docs/layout/legal-document-shell/examples/mobile-390.tsx +70 -0
- package/docs/layout/legal-document-shell/examples/tablet-1024.md +3 -0
- package/docs/layout/legal-document-shell/examples/tablet-1024.tsx +84 -0
- package/docs/layout/legal-document-shell/examples/wrapping-ja-en-vi.md +18 -0
- package/docs/layout/legal-document-shell/examples/wrapping-ja-en-vi.tsx +61 -0
- package/docs/layout/legal-document-shell/index.md +51 -0
- package/docs/layout/legal-document-shell/index.tsx +101 -0
- package/docs/layout/master-detail.tsx +387 -0
- package/docs/layout/org-switcher.tsx +131 -0
- package/docs/layout/page-container.tsx +946 -0
- package/docs/layout/resizable-panel.tsx +419 -0
- package/docs/layout/responsive-grid.tsx +235 -0
- package/docs/layout/separator.tsx +327 -0
- package/docs/layout/service-role-panel.tsx +144 -0
- package/docs/layout/sidebar.tsx +586 -0
- package/docs/layout/split-pane.tsx +451 -0
- package/docs/layout/topbar.tsx +347 -0
- package/docs/navigation/app-setting-picker.tsx +141 -0
- package/docs/navigation/breadcrumb.tsx +128 -0
- package/docs/navigation/context-menu.tsx +117 -0
- package/docs/navigation/dropdown-menu.tsx +213 -0
- package/docs/navigation/filter-bar.tsx +227 -0
- package/docs/navigation/menubar.tsx +141 -0
- package/docs/navigation/navigation-menu.tsx +165 -0
- package/docs/navigation/pagination.tsx +241 -0
- package/docs/navigation/steps.tsx +263 -0
- package/docs/navigation/tabs-rtl.tsx +28 -0
- package/docs/navigation/tabs.tsx +308 -0
- package/docs/navigation/toolbar.tsx +339 -0
- package/docs/providers/app-provider.tsx +191 -0
- package/docs/providers/format-date.tsx +230 -0
- package/docs/query/button-refetch.tsx +160 -0
- package/docs/query/data-state.tsx +192 -0
- package/docs/query/infinite-query-state.tsx +93 -0
- package/docs/query/mutation-feedback.tsx +70 -0
- package/docs/query/prefetch-link.tsx +262 -0
- package/docs/query/touch-actions.tsx +68 -0
- package/docs/showcase/acme-portal.tsx +441 -0
- package/docs/showcase/acme-website.tsx +455 -0
- package/docs/showcase/case1-warehouse-dashboard.tsx +343 -0
- package/docs/showcase/case2-employee-me.tsx +441 -0
- package/docs/showcase/case3-approval-workflow.tsx +527 -0
- package/docs/showcase/case4-login.tsx +307 -0
- package/docs/showcase/case5-shift-calendar.tsx +795 -0
- package/docs/showcase/case6-agency-handy.tsx +1072 -0
- package/docs/showcase/futurelastic-web.tsx +390 -0
- package/docs/showcase/org-switcher.tsx +313 -0
- package/docs/showcase/permission-matrix.tsx +343 -0
- package/docs/showcase/public-landing.tsx +210 -0
- package/docs/showcase/settings-account-sections.tsx +559 -0
- package/docs/showcase/settings-security-mfa.tsx +145 -0
- package/docs/showcase/table-approval-queue.tsx +199 -0
- package/docs/showcase/table-bulk-actions.tsx +460 -0
- package/docs/showcase/table-compact-kintone.tsx +438 -0
- package/docs/showcase/table-conditional-format.tsx +367 -0
- package/docs/showcase/table-crud-list.tsx +544 -0
- package/docs/showcase/table-density.tsx +340 -0
- package/docs/showcase/table-expandable-rows.tsx +471 -0
- package/docs/showcase/table-filter-chips.tsx +461 -0
- package/docs/showcase/table-footer-totals.tsx +311 -0
- package/docs/showcase/table-grouped-subtotals.tsx +388 -0
- package/docs/showcase/table-master-detail.tsx +479 -0
- package/docs/showcase/table-pagination.tsx +320 -0
- package/docs/showcase/table-states.tsx +363 -0
- package/docs/showcase/table-sticky-columns.tsx +373 -0
- package/docs/showcase/table-tree-rows.tsx +444 -0
- package/docs/showcase/table-view-tabs.tsx +488 -0
- package/package.json +9 -11
- package/scripts/_agent-setup.mjs +16 -2
- package/scripts/audit-hook.mjs +3 -13
- package/scripts/init-agent-kit.mjs +1 -14
- package/scripts/postinstall.mjs +12 -12
- package/scripts/ui-audit.mjs +93 -31
- package/scripts/visual-audit-rules.mjs +51 -7
- package/scripts/visual-audit.mjs +118 -47
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Showcase · OrgSwitcher — sidebar organization/tenant switcher (Slack/Linear pattern)
|
|
3
|
+
*
|
|
4
|
+
* Requested by dxs-platform (godxjp-ui#196) as a "first-class OrgSwitcher component".
|
|
5
|
+
* GATE 0 — Framework-Component Test verdict: **COMPOSITION PATTERN**, not a framework
|
|
6
|
+
* component. It owns NO new behaviour — search/keyboard/filtering come from `Command`
|
|
7
|
+
* (cmdk), open/focus-trap/dismiss from `Popover`, the trigger from `Button` + `Avatar`.
|
|
8
|
+
* It is fully expressible today from existing primitives + tokens (the issue itself asks
|
|
9
|
+
* to "compose an interim from existing primitives"), its `current`/`organizations`/
|
|
10
|
+
* `onSelect`/`footerActions` shape is screen-shaped, and `Sidebar` already ships the
|
|
11
|
+
* `brand`/`product` + `onProductClick` slot designed to host exactly this. So it lives
|
|
12
|
+
* here as a real, copy-pasteable recipe — NOT in `src/components/`.
|
|
13
|
+
*
|
|
14
|
+
* Composition map (OrgSwitcher block → @godxjp/ui primitive):
|
|
15
|
+
* sidebar-top card ........... Sidebar `brand` slot (renders above the nav scroll area)
|
|
16
|
+
* current-org trigger ........ Button(ghost) + Avatar(fallback initial) + Text(name/role)
|
|
17
|
+
* floating panel ............. Popover (open/close/focus-trap/Esc/outside-click)
|
|
18
|
+
* searchable org list ........ Command + CommandInput + CommandList + CommandItem
|
|
19
|
+
* current marker ............. Check icon + sr-only "(đang chọn)" (never colour-only)
|
|
20
|
+
* footer actions ............. Button(ghost) rows — "Tạo tổ chức" / "Tham gia bằng mã mời"
|
|
21
|
+
* app chrome ................. AppShell + Sidebar + Topbar + PageContainer
|
|
22
|
+
*
|
|
23
|
+
* a11y: trigger has an accessible name announcing the current org; the list is cmdk's
|
|
24
|
+
* combobox→listbox with `role=option`; the active org carries a visible Check AND an
|
|
25
|
+
* sr-only status word; every icon is `aria-hidden`; footer actions are siblings of the
|
|
26
|
+
* list (no nested interactive controls). RTL-safe: logical spacing only (`ps-/pe-/ms-/
|
|
27
|
+
* text-start`); `border-t`/`p-*` are direction-neutral.
|
|
28
|
+
*/
|
|
29
|
+
import * as React from "react";
|
|
30
|
+
import {
|
|
31
|
+
Boxes,
|
|
32
|
+
Check,
|
|
33
|
+
ChevronsUpDown,
|
|
34
|
+
LayoutDashboard,
|
|
35
|
+
Plus,
|
|
36
|
+
Settings,
|
|
37
|
+
Shield,
|
|
38
|
+
TicketPlus,
|
|
39
|
+
Users,
|
|
40
|
+
} from "lucide-react";
|
|
41
|
+
|
|
42
|
+
import { Button, Heading, Text } from "@godxjp/ui/general";
|
|
43
|
+
import {
|
|
44
|
+
AppShell,
|
|
45
|
+
Flex,
|
|
46
|
+
PageContainer,
|
|
47
|
+
Sidebar,
|
|
48
|
+
type SidebarSectionProp,
|
|
49
|
+
Topbar,
|
|
50
|
+
} from "@godxjp/ui/layout";
|
|
51
|
+
import {
|
|
52
|
+
Avatar,
|
|
53
|
+
AvatarFallback,
|
|
54
|
+
Badge,
|
|
55
|
+
Card,
|
|
56
|
+
CardContent,
|
|
57
|
+
CardDescription,
|
|
58
|
+
CardHeader,
|
|
59
|
+
CardTitle,
|
|
60
|
+
Popover,
|
|
61
|
+
PopoverContent,
|
|
62
|
+
PopoverTrigger,
|
|
63
|
+
} from "@godxjp/ui/data-display";
|
|
64
|
+
import {
|
|
65
|
+
Command,
|
|
66
|
+
CommandEmpty,
|
|
67
|
+
CommandGroup,
|
|
68
|
+
CommandInput,
|
|
69
|
+
CommandItem,
|
|
70
|
+
CommandList,
|
|
71
|
+
} from "@godxjp/ui/data-entry";
|
|
72
|
+
|
|
73
|
+
type Org = { id: string; name: string; role: string };
|
|
74
|
+
|
|
75
|
+
const ORGS: Org[] = [
|
|
76
|
+
{ id: "acme-hq", name: "Acme Holdings", role: "Quản trị viên" },
|
|
77
|
+
{ id: "acme-jp", name: "Acme Japan K.K.", role: "Quản lý chi nhánh" },
|
|
78
|
+
{ id: "acme-logi", name: "Acme Logistics", role: "Điều phối" },
|
|
79
|
+
{ id: "bluewave", name: "BlueWave Retail", role: "Thành viên" },
|
|
80
|
+
{ id: "northwind", name: "Northwind Trading", role: "Kế toán" },
|
|
81
|
+
];
|
|
82
|
+
|
|
83
|
+
/** First grapheme of the org name, upper-cased — a stable, emoji-free monogram. */
|
|
84
|
+
function monogram(name: string): string {
|
|
85
|
+
return Array.from(name.trim())[0]?.toUpperCase() ?? "?";
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
type OrgSwitcherProps = {
|
|
89
|
+
organizations: Org[];
|
|
90
|
+
currentId: string;
|
|
91
|
+
onSelect: (id: string) => void;
|
|
92
|
+
onCreate: () => void;
|
|
93
|
+
onJoin: () => void;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* OrgSwitcher — the reusable recipe. A `Popover` whose trigger is the current-org card
|
|
98
|
+
* and whose panel is a searchable `Command` list of orgs plus create/join footer actions.
|
|
99
|
+
* Copy this function into a consumer app; every import is a real `@godxjp/ui` primitive.
|
|
100
|
+
*/
|
|
101
|
+
function OrgSwitcher({ organizations, currentId, onSelect, onCreate, onJoin }: OrgSwitcherProps) {
|
|
102
|
+
const [open, setOpen] = React.useState(false);
|
|
103
|
+
const [query, setQuery] = React.useState("");
|
|
104
|
+
const current = organizations.find((org) => org.id === currentId) ?? organizations[0];
|
|
105
|
+
|
|
106
|
+
function choose(id: string) {
|
|
107
|
+
onSelect(id);
|
|
108
|
+
setOpen(false);
|
|
109
|
+
setQuery("");
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return (
|
|
113
|
+
<Popover open={open} onOpenChange={setOpen}>
|
|
114
|
+
<PopoverTrigger asChild>
|
|
115
|
+
<Button
|
|
116
|
+
type="button"
|
|
117
|
+
variant="ghost"
|
|
118
|
+
aria-label={`Tổ chức hiện tại: ${current.name}. Nhấn để đổi tổ chức`}
|
|
119
|
+
className="w-full justify-between gap-2 px-2"
|
|
120
|
+
>
|
|
121
|
+
<Flex align="center" gap="sm" className="min-w-0">
|
|
122
|
+
<Avatar className="size-7 rounded-md">
|
|
123
|
+
<AvatarFallback>{monogram(current.name)}</AvatarFallback>
|
|
124
|
+
</Avatar>
|
|
125
|
+
<span className="flex min-w-0 flex-col text-start">
|
|
126
|
+
<Text as="span" size="sm" weight="medium" truncate>
|
|
127
|
+
{current.name}
|
|
128
|
+
</Text>
|
|
129
|
+
<Text as="span" size="xs" tone="muted" truncate>
|
|
130
|
+
{current.role}
|
|
131
|
+
</Text>
|
|
132
|
+
</span>
|
|
133
|
+
</Flex>
|
|
134
|
+
<ChevronsUpDown aria-hidden className="size-4 shrink-0 opacity-60" />
|
|
135
|
+
</Button>
|
|
136
|
+
</PopoverTrigger>
|
|
137
|
+
<PopoverContent align="start" sideOffset={6} className="w-64 p-0">
|
|
138
|
+
<Command label="Chọn tổ chức">
|
|
139
|
+
<CommandInput
|
|
140
|
+
placeholder="Tìm tổ chức…"
|
|
141
|
+
aria-label="Tìm tổ chức"
|
|
142
|
+
value={query}
|
|
143
|
+
onValueChange={setQuery}
|
|
144
|
+
/>
|
|
145
|
+
<CommandList>
|
|
146
|
+
<CommandEmpty>Không tìm thấy tổ chức.</CommandEmpty>
|
|
147
|
+
<CommandGroup heading="Tổ chức của bạn">
|
|
148
|
+
{organizations.map((org) => {
|
|
149
|
+
const active = org.id === currentId;
|
|
150
|
+
return (
|
|
151
|
+
<CommandItem
|
|
152
|
+
key={org.id}
|
|
153
|
+
value={`${org.name} ${org.role}`}
|
|
154
|
+
keywords={[org.id]}
|
|
155
|
+
onSelect={() => choose(org.id)}
|
|
156
|
+
>
|
|
157
|
+
<Flex align="center" gap="sm" className="w-full min-w-0">
|
|
158
|
+
<Avatar className="size-6 rounded">
|
|
159
|
+
<AvatarFallback>{monogram(org.name)}</AvatarFallback>
|
|
160
|
+
</Avatar>
|
|
161
|
+
<span className="flex min-w-0 flex-col text-start">
|
|
162
|
+
<Text as="span" size="sm" truncate>
|
|
163
|
+
{org.name}
|
|
164
|
+
</Text>
|
|
165
|
+
<Text as="span" size="xs" tone="muted" truncate>
|
|
166
|
+
{org.role}
|
|
167
|
+
</Text>
|
|
168
|
+
</span>
|
|
169
|
+
{active ? (
|
|
170
|
+
<Check aria-hidden className="text-primary ms-auto size-4 shrink-0" />
|
|
171
|
+
) : null}
|
|
172
|
+
</Flex>
|
|
173
|
+
{active ? <span className="sr-only">(đang chọn)</span> : null}
|
|
174
|
+
</CommandItem>
|
|
175
|
+
);
|
|
176
|
+
})}
|
|
177
|
+
</CommandGroup>
|
|
178
|
+
</CommandList>
|
|
179
|
+
<div className="border-t p-1">
|
|
180
|
+
<Button
|
|
181
|
+
type="button"
|
|
182
|
+
variant="ghost"
|
|
183
|
+
size="sm"
|
|
184
|
+
className="w-full justify-start gap-2"
|
|
185
|
+
onClick={() => {
|
|
186
|
+
onCreate();
|
|
187
|
+
setOpen(false);
|
|
188
|
+
}}
|
|
189
|
+
>
|
|
190
|
+
<Plus aria-hidden className="size-4" />
|
|
191
|
+
Tạo tổ chức mới
|
|
192
|
+
</Button>
|
|
193
|
+
<Button
|
|
194
|
+
type="button"
|
|
195
|
+
variant="ghost"
|
|
196
|
+
size="sm"
|
|
197
|
+
className="w-full justify-start gap-2"
|
|
198
|
+
onClick={() => {
|
|
199
|
+
onJoin();
|
|
200
|
+
setOpen(false);
|
|
201
|
+
}}
|
|
202
|
+
>
|
|
203
|
+
<TicketPlus aria-hidden className="size-4" />
|
|
204
|
+
Tham gia bằng mã mời
|
|
205
|
+
</Button>
|
|
206
|
+
</div>
|
|
207
|
+
</Command>
|
|
208
|
+
</PopoverContent>
|
|
209
|
+
</Popover>
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
const SECTIONS: SidebarSectionProp[] = [
|
|
214
|
+
{
|
|
215
|
+
label: "Điều hành",
|
|
216
|
+
items: [
|
|
217
|
+
{ id: "overview", label: "Tổng quan", icon: LayoutDashboard },
|
|
218
|
+
{ id: "workspaces", label: "Không gian làm việc", icon: Boxes },
|
|
219
|
+
{ id: "members", label: "Thành viên", icon: Users },
|
|
220
|
+
],
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
label: "Quản trị",
|
|
224
|
+
items: [
|
|
225
|
+
{ id: "roles", label: "Vai trò", icon: Shield },
|
|
226
|
+
{ id: "settings", label: "Cài đặt", icon: Settings },
|
|
227
|
+
],
|
|
228
|
+
},
|
|
229
|
+
];
|
|
230
|
+
|
|
231
|
+
export default function OrgSwitcherShowcase() {
|
|
232
|
+
const [activeId, setActiveId] = React.useState("overview");
|
|
233
|
+
const [currentOrg, setCurrentOrg] = React.useState("acme-hq");
|
|
234
|
+
const [lastAction, setLastAction] = React.useState<string | null>(null);
|
|
235
|
+
|
|
236
|
+
const current = ORGS.find((org) => org.id === currentOrg) ?? ORGS[0];
|
|
237
|
+
|
|
238
|
+
return (
|
|
239
|
+
<AppShell
|
|
240
|
+
sidebar={
|
|
241
|
+
<Sidebar
|
|
242
|
+
activeId={activeId}
|
|
243
|
+
onSelect={setActiveId}
|
|
244
|
+
sections={SECTIONS}
|
|
245
|
+
brand={
|
|
246
|
+
<OrgSwitcher
|
|
247
|
+
organizations={ORGS}
|
|
248
|
+
currentId={currentOrg}
|
|
249
|
+
onSelect={(id) => {
|
|
250
|
+
setCurrentOrg(id);
|
|
251
|
+
setLastAction(null);
|
|
252
|
+
}}
|
|
253
|
+
onCreate={() => setLastAction("Mở luồng tạo tổ chức mới")}
|
|
254
|
+
onJoin={() => setLastAction("Mở luồng nhập mã mời")}
|
|
255
|
+
/>
|
|
256
|
+
}
|
|
257
|
+
footer={
|
|
258
|
+
<Flex direction="col" gap="xs">
|
|
259
|
+
<Text size="xs" weight="medium">
|
|
260
|
+
Satoshi Yamamoto
|
|
261
|
+
</Text>
|
|
262
|
+
<Text size="xs" tone="muted">
|
|
263
|
+
Trực tuyến · Tokyo
|
|
264
|
+
</Text>
|
|
265
|
+
</Flex>
|
|
266
|
+
}
|
|
267
|
+
/>
|
|
268
|
+
}
|
|
269
|
+
topbar={
|
|
270
|
+
<Topbar
|
|
271
|
+
start={
|
|
272
|
+
<Text size="sm" weight="medium">
|
|
273
|
+
Acme Console
|
|
274
|
+
</Text>
|
|
275
|
+
}
|
|
276
|
+
end={
|
|
277
|
+
<Avatar className="size-7 rounded-md">
|
|
278
|
+
<AvatarFallback>SY</AvatarFallback>
|
|
279
|
+
</Avatar>
|
|
280
|
+
}
|
|
281
|
+
/>
|
|
282
|
+
}
|
|
283
|
+
>
|
|
284
|
+
<PageContainer
|
|
285
|
+
title="Bảng điều khiển"
|
|
286
|
+
subtitle={`Tổ chức: ${current.name} · ${current.role}`}
|
|
287
|
+
>
|
|
288
|
+
<Card>
|
|
289
|
+
<CardHeader>
|
|
290
|
+
<CardTitle>OrgSwitcher (mẫu tổ hợp)</CardTitle>
|
|
291
|
+
<CardDescription>
|
|
292
|
+
Thẻ tổ chức ở đầu Sidebar mở một danh sách tìm kiếm bằng Command, kèm hành động tạo tổ
|
|
293
|
+
chức và tham gia bằng mã mời. Toàn bộ dựng từ primitive @godxjp/ui · không thêm
|
|
294
|
+
component framework.
|
|
295
|
+
</CardDescription>
|
|
296
|
+
</CardHeader>
|
|
297
|
+
<CardContent>
|
|
298
|
+
<Flex direction="col" gap="sm" align="start">
|
|
299
|
+
<Flex align="center" gap="sm">
|
|
300
|
+
<Heading level={4}>Tổ chức đang chọn</Heading>
|
|
301
|
+
<Badge tone="info">{current.name}</Badge>
|
|
302
|
+
</Flex>
|
|
303
|
+
<Text size="sm" tone="muted">
|
|
304
|
+
Đổi tổ chức từ thẻ ở góc trên Sidebar để cập nhật giá trị này.
|
|
305
|
+
</Text>
|
|
306
|
+
{lastAction ? <Badge tone="warning">{lastAction}</Badge> : null}
|
|
307
|
+
</Flex>
|
|
308
|
+
</CardContent>
|
|
309
|
+
</Card>
|
|
310
|
+
</PageContainer>
|
|
311
|
+
</AppShell>
|
|
312
|
+
);
|
|
313
|
+
}
|
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Showcase · permission-matrix — 権限マトリクス (RBAC role × permission grid)
|
|
3
|
+
*
|
|
4
|
+
* A role × permission matrix with a STICKY first column (権限), ✓/— cells, a
|
|
5
|
+
* two-role COMPARE mode, and a 差分のみ (differences-only) filter — the pattern
|
|
6
|
+
* DXS role tabs (SCR-203) and the org role editor (SCR-111b) each hand-rolled
|
|
7
|
+
* (godxjp-ui#194). Read-only by default.
|
|
8
|
+
*
|
|
9
|
+
* SINCE gh#257 the grid itself IS a package export — `PermissionMatrix` from
|
|
10
|
+
* `@godxjp/ui/data-display` (see docs/data-display/permission-matrix.tsx). The
|
|
11
|
+
* original Gate-0 "composition pattern" verdict was OUTCOME-corrected the same
|
|
12
|
+
* way ErrorSurface was (gh#251): a consumer cannot import a docs page, so the
|
|
13
|
+
* canonical grid needed an importable home. Prefer the export in app code.
|
|
14
|
+
*
|
|
15
|
+
* This showcase remains as the COMPOSED form of the same screen — the full
|
|
16
|
+
* hand-built Table-family version with its own compare controls — for consumers
|
|
17
|
+
* who need a variant the export does not model. The shared grant/diff DATA
|
|
18
|
+
* logic stays in the pure, tested `@godxjp/ui/lib/permission-grid` util (no
|
|
19
|
+
* strings, no React), used identically by the export and by this composition.
|
|
20
|
+
*
|
|
21
|
+
* GAP: DataTable/ColumnDef cannot pin the FIRST column (only the header row and a
|
|
22
|
+
* single trailing `pin:'end'` column). So the sticky-権限 column is composed from
|
|
23
|
+
* the real Table family primitives with `sticky start-0` + a token edge — exactly
|
|
24
|
+
* as docs/showcase/table-sticky-columns.tsx does. No hand-rolled <table>, no raw
|
|
25
|
+
* HTML controls: role pickers = Select, the diff toggle = Switch, cells = Badge.
|
|
26
|
+
*
|
|
27
|
+
* DNA: compact density, semantic tokens only (success ✓, muted —, warning 差分),
|
|
28
|
+
* shape-encoded state (Check vs Minus icon, never colour-only) + sr-only text for
|
|
29
|
+
* screen readers, quiet JP copy, no emoji.
|
|
30
|
+
*/
|
|
31
|
+
import * as React from "react";
|
|
32
|
+
import { Check, Minus } from "lucide-react";
|
|
33
|
+
|
|
34
|
+
import {
|
|
35
|
+
Badge,
|
|
36
|
+
Card,
|
|
37
|
+
CardContent,
|
|
38
|
+
CardHeader,
|
|
39
|
+
CardTitle,
|
|
40
|
+
Table,
|
|
41
|
+
TableBody,
|
|
42
|
+
TableCell,
|
|
43
|
+
TableHead,
|
|
44
|
+
TableHeader,
|
|
45
|
+
TableRow,
|
|
46
|
+
} from "@godxjp/ui/data-display";
|
|
47
|
+
import { FormField, Label, Select, Switch } from "@godxjp/ui/data-entry";
|
|
48
|
+
import { Text } from "@godxjp/ui/general";
|
|
49
|
+
import { Flex, PageContainer } from "@godxjp/ui/layout";
|
|
50
|
+
import { cn } from "@godxjp/ui/lib/utils";
|
|
51
|
+
import {
|
|
52
|
+
type ComparePair,
|
|
53
|
+
countDifferences,
|
|
54
|
+
countGrants,
|
|
55
|
+
grantKey,
|
|
56
|
+
hasGrant,
|
|
57
|
+
rolesDifferOnPermission,
|
|
58
|
+
visibleRows,
|
|
59
|
+
} from "@godxjp/ui/lib/permission-grid";
|
|
60
|
+
|
|
61
|
+
// ── ドメイン: ロール(列)と権限(行) ───────────────────────────────────────
|
|
62
|
+
type Role = { id: string; name: string; hint: string };
|
|
63
|
+
type Permission = { id: string; name: string; description: string; category: string };
|
|
64
|
+
|
|
65
|
+
const ROLES: Role[] = [
|
|
66
|
+
{ id: "admin", name: "管理者", hint: "全操作" },
|
|
67
|
+
{ id: "editor", name: "編集者", hint: "作成・編集" },
|
|
68
|
+
{ id: "viewer", name: "閲覧者", hint: "閲覧のみ" },
|
|
69
|
+
{ id: "guest", name: "ゲスト", hint: "限定共有" },
|
|
70
|
+
];
|
|
71
|
+
|
|
72
|
+
const PERMISSIONS: Permission[] = [
|
|
73
|
+
{
|
|
74
|
+
id: "user.manage",
|
|
75
|
+
name: "ユーザー管理",
|
|
76
|
+
description: "メンバーの追加・停止・権限変更",
|
|
77
|
+
category: "管理",
|
|
78
|
+
},
|
|
79
|
+
{ id: "member.invite", name: "メンバー招待", description: "招待リンクの発行", category: "管理" },
|
|
80
|
+
{
|
|
81
|
+
id: "billing.view",
|
|
82
|
+
name: "請求書の閲覧",
|
|
83
|
+
description: "請求・支払い履歴の参照",
|
|
84
|
+
category: "請求",
|
|
85
|
+
},
|
|
86
|
+
{ id: "billing.edit", name: "請求書の編集", description: "請求先・明細の変更", category: "請求" },
|
|
87
|
+
{
|
|
88
|
+
id: "report.export",
|
|
89
|
+
name: "レポート出力",
|
|
90
|
+
description: "CSV / PDF のエクスポート",
|
|
91
|
+
category: "レポート",
|
|
92
|
+
},
|
|
93
|
+
{ id: "audit.view", name: "監査ログ閲覧", description: "操作履歴の参照", category: "レポート" },
|
|
94
|
+
{
|
|
95
|
+
id: "apikey.issue",
|
|
96
|
+
name: "APIキー発行",
|
|
97
|
+
description: "連携用トークンの発行",
|
|
98
|
+
category: "連携",
|
|
99
|
+
},
|
|
100
|
+
{ id: "settings.edit", name: "設定変更", description: "組織設定・SSO の変更", category: "設定" },
|
|
101
|
+
];
|
|
102
|
+
|
|
103
|
+
/** 付与マトリクス(authz キャッシュと同じ `role permission` タプルの Set)。 */
|
|
104
|
+
const GRANTS: ReadonlySet<string> = new Set<string>([
|
|
105
|
+
// 管理者: 全権限
|
|
106
|
+
...PERMISSIONS.map((p) => grantKey("admin", p.id)),
|
|
107
|
+
// 編集者
|
|
108
|
+
grantKey("editor", "member.invite"),
|
|
109
|
+
grantKey("editor", "billing.view"),
|
|
110
|
+
grantKey("editor", "report.export"),
|
|
111
|
+
grantKey("editor", "apikey.issue"),
|
|
112
|
+
// 閲覧者
|
|
113
|
+
grantKey("viewer", "billing.view"),
|
|
114
|
+
grantKey("viewer", "report.export"),
|
|
115
|
+
grantKey("viewer", "audit.view"),
|
|
116
|
+
// ゲスト
|
|
117
|
+
grantKey("guest", "billing.view"),
|
|
118
|
+
]);
|
|
119
|
+
|
|
120
|
+
const roleOptions = ROLES.map((r) => ({ value: r.id, label: r.name }));
|
|
121
|
+
const roleName = (id: string) => ROLES.find((r) => r.id === id)?.name ?? id;
|
|
122
|
+
|
|
123
|
+
// ── セル: ✓ 許可 / — 不許可(shape + sr-only、色のみで状態を示さない) ────────
|
|
124
|
+
function GrantCell({ granted }: { granted: boolean }) {
|
|
125
|
+
return granted ? (
|
|
126
|
+
<Badge tone="success" variant="outline" className="justify-center">
|
|
127
|
+
<Check aria-hidden="true" />
|
|
128
|
+
<span className="sr-only">許可</span>
|
|
129
|
+
</Badge>
|
|
130
|
+
) : (
|
|
131
|
+
<span className="text-muted-foreground inline-flex items-center justify-center">
|
|
132
|
+
<Minus aria-hidden="true" className="size-4" />
|
|
133
|
+
<span className="sr-only">不許可</span>
|
|
134
|
+
</span>
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// 固定列(先頭 = 権限)— スクロールする本体が下を通るので不透明背景 + トークン端。
|
|
139
|
+
const PIN_START = "sticky start-0 z-20 bg-inherit border-e border-border";
|
|
140
|
+
|
|
141
|
+
export default function Demo() {
|
|
142
|
+
const [compareA, setCompareA] = React.useState("editor");
|
|
143
|
+
const [compareB, setCompareB] = React.useState("viewer");
|
|
144
|
+
const [diffOnly, setDiffOnly] = React.useState(false);
|
|
145
|
+
|
|
146
|
+
const compare = React.useMemo<ComparePair>(() => [compareA, compareB], [compareA, compareB]);
|
|
147
|
+
const compared = new Set(compare);
|
|
148
|
+
const sameRole = compareA === compareB;
|
|
149
|
+
|
|
150
|
+
const rows = visibleRows(PERMISSIONS, GRANTS, { compare, diffOnly: diffOnly && !sameRole });
|
|
151
|
+
const diffN = sameRole ? 0 : countDifferences(PERMISSIONS, GRANTS, compare);
|
|
152
|
+
|
|
153
|
+
return (
|
|
154
|
+
<PageContainer
|
|
155
|
+
title="権限マトリクス"
|
|
156
|
+
subtitle="ロール × 権限の付与状況。先頭列を固定し、2 ロールを比較して差分のみ抽出できる(既定は読み取り専用)。"
|
|
157
|
+
density="compact"
|
|
158
|
+
>
|
|
159
|
+
<Flex direction="col" gap="lg">
|
|
160
|
+
{/* ── 比較コントロール ── */}
|
|
161
|
+
<Card>
|
|
162
|
+
<CardHeader>
|
|
163
|
+
<CardTitle level={2}>比較</CardTitle>
|
|
164
|
+
<Text size="xs" tone="muted">
|
|
165
|
+
2 つのロールを選ぶと差分を強調表示。「差分のみ」で一致行を隠す。
|
|
166
|
+
</Text>
|
|
167
|
+
</CardHeader>
|
|
168
|
+
<CardContent>
|
|
169
|
+
<Flex direction="row" wrap align="end" gap="md">
|
|
170
|
+
<FormField label="比較 A">
|
|
171
|
+
<Select
|
|
172
|
+
value={compareA}
|
|
173
|
+
onValueChange={setCompareA}
|
|
174
|
+
options={roleOptions}
|
|
175
|
+
clearable={false}
|
|
176
|
+
className="w-40"
|
|
177
|
+
/>
|
|
178
|
+
</FormField>
|
|
179
|
+
<FormField label="比較 B">
|
|
180
|
+
<Select
|
|
181
|
+
value={compareB}
|
|
182
|
+
onValueChange={setCompareB}
|
|
183
|
+
options={roleOptions}
|
|
184
|
+
clearable={false}
|
|
185
|
+
className="w-40"
|
|
186
|
+
/>
|
|
187
|
+
</FormField>
|
|
188
|
+
<Flex direction="row" align="center" gap="sm">
|
|
189
|
+
<Switch
|
|
190
|
+
id="pm-diff-only"
|
|
191
|
+
size="sm"
|
|
192
|
+
checked={diffOnly}
|
|
193
|
+
onCheckedChange={setDiffOnly}
|
|
194
|
+
disabled={sameRole}
|
|
195
|
+
/>
|
|
196
|
+
<Label htmlFor="pm-diff-only">差分のみ</Label>
|
|
197
|
+
</Flex>
|
|
198
|
+
<Flex direction="row" align="center" gap="xs" aria-live="polite">
|
|
199
|
+
{sameRole ? (
|
|
200
|
+
<Text size="xs" tone="muted">
|
|
201
|
+
同一ロールを比較中
|
|
202
|
+
</Text>
|
|
203
|
+
) : (
|
|
204
|
+
<>
|
|
205
|
+
<Badge tone={diffN > 0 ? "warning" : "success"} variant="outline">
|
|
206
|
+
差分 {diffN} 件
|
|
207
|
+
</Badge>
|
|
208
|
+
<Text size="xs" tone="muted">
|
|
209
|
+
{roleName(compareA)} vs {roleName(compareB)}
|
|
210
|
+
</Text>
|
|
211
|
+
</>
|
|
212
|
+
)}
|
|
213
|
+
</Flex>
|
|
214
|
+
</Flex>
|
|
215
|
+
</CardContent>
|
|
216
|
+
</Card>
|
|
217
|
+
|
|
218
|
+
{/* ── マトリクス本体 ── */}
|
|
219
|
+
<Card>
|
|
220
|
+
<CardHeader className="flex flex-row items-center justify-between">
|
|
221
|
+
<CardTitle level={2}>ロール × 権限</CardTitle>
|
|
222
|
+
<Text size="xs" tone="muted" tabular>
|
|
223
|
+
権限 {rows.length} / {PERMISSIONS.length} 件 · ロール {ROLES.length}
|
|
224
|
+
</Text>
|
|
225
|
+
</CardHeader>
|
|
226
|
+
<CardContent flush>
|
|
227
|
+
<div className="overflow-x-auto">
|
|
228
|
+
<Table className="min-w-[760px]">
|
|
229
|
+
<TableHeader className="bg-secondary [&_tr]:bg-secondary">
|
|
230
|
+
<TableRow className="bg-secondary hover:bg-secondary">
|
|
231
|
+
<TableHead className={cn(PIN_START, "w-64 min-w-64")}>権限</TableHead>
|
|
232
|
+
{ROLES.map((role) => {
|
|
233
|
+
const isCompared = !sameRole && compared.has(role.id);
|
|
234
|
+
return (
|
|
235
|
+
<TableHead
|
|
236
|
+
key={role.id}
|
|
237
|
+
className={cn("text-center", isCompared && "bg-primary/[0.06]")}
|
|
238
|
+
aria-label={isCompared ? `${role.name}(比較対象)` : role.name}
|
|
239
|
+
>
|
|
240
|
+
<span className="inline-flex flex-col items-center leading-tight">
|
|
241
|
+
<span className="inline-flex items-center gap-1">
|
|
242
|
+
<Text weight="medium">{role.name}</Text>
|
|
243
|
+
{isCompared && (
|
|
244
|
+
<Badge tone="primary" variant="outline">
|
|
245
|
+
{role.id === compareA ? "A" : "B"}
|
|
246
|
+
</Badge>
|
|
247
|
+
)}
|
|
248
|
+
</span>
|
|
249
|
+
<Text size="2xs" tone="muted">
|
|
250
|
+
{role.hint} · {countGrants(PERMISSIONS, GRANTS, role.id)}件
|
|
251
|
+
</Text>
|
|
252
|
+
</span>
|
|
253
|
+
</TableHead>
|
|
254
|
+
);
|
|
255
|
+
})}
|
|
256
|
+
</TableRow>
|
|
257
|
+
</TableHeader>
|
|
258
|
+
<TableBody>
|
|
259
|
+
{rows.map((perm) => {
|
|
260
|
+
const isDiffRow =
|
|
261
|
+
!sameRole && rolesDifferOnPermission(GRANTS, compare, perm.id);
|
|
262
|
+
return (
|
|
263
|
+
<TableRow
|
|
264
|
+
key={perm.id}
|
|
265
|
+
className={cn(isDiffRow && "bg-warning/[0.07] hover:bg-warning/10")}
|
|
266
|
+
aria-label={isDiffRow ? `${perm.name} · 比較ロール間で差分あり` : undefined}
|
|
267
|
+
>
|
|
268
|
+
<TableCell className={cn(PIN_START, "w-64 min-w-64 align-middle")}>
|
|
269
|
+
<Flex direction="col" className="leading-tight">
|
|
270
|
+
<span className="inline-flex items-center gap-1.5">
|
|
271
|
+
<Text weight="medium">{perm.name}</Text>
|
|
272
|
+
{isDiffRow && (
|
|
273
|
+
<Badge tone="warning" variant="outline">
|
|
274
|
+
差分
|
|
275
|
+
</Badge>
|
|
276
|
+
)}
|
|
277
|
+
</span>
|
|
278
|
+
<Text size="2xs" tone="muted">
|
|
279
|
+
{perm.category} · {perm.description}
|
|
280
|
+
</Text>
|
|
281
|
+
</Flex>
|
|
282
|
+
</TableCell>
|
|
283
|
+
{ROLES.map((role) => {
|
|
284
|
+
const isCompared = !sameRole && compared.has(role.id);
|
|
285
|
+
return (
|
|
286
|
+
<TableCell
|
|
287
|
+
key={role.id}
|
|
288
|
+
className={cn(
|
|
289
|
+
"text-center align-middle",
|
|
290
|
+
isCompared && "bg-primary/[0.04]",
|
|
291
|
+
)}
|
|
292
|
+
>
|
|
293
|
+
<GrantCell granted={hasGrant(GRANTS, role.id, perm.id)} />
|
|
294
|
+
</TableCell>
|
|
295
|
+
);
|
|
296
|
+
})}
|
|
297
|
+
</TableRow>
|
|
298
|
+
);
|
|
299
|
+
})}
|
|
300
|
+
</TableBody>
|
|
301
|
+
</Table>
|
|
302
|
+
</div>
|
|
303
|
+
</CardContent>
|
|
304
|
+
</Card>
|
|
305
|
+
|
|
306
|
+
{/* ── 凡例 ── */}
|
|
307
|
+
<Card>
|
|
308
|
+
<CardHeader>
|
|
309
|
+
<CardTitle level={2}>凡例</CardTitle>
|
|
310
|
+
</CardHeader>
|
|
311
|
+
<CardContent>
|
|
312
|
+
<Flex direction="row" wrap gap="md" align="center">
|
|
313
|
+
<Flex direction="row" align="center" gap="xs">
|
|
314
|
+
<Badge tone="success" variant="outline" className="justify-center">
|
|
315
|
+
<Check aria-hidden="true" />
|
|
316
|
+
</Badge>
|
|
317
|
+
<Text size="xs" tone="muted">
|
|
318
|
+
許可
|
|
319
|
+
</Text>
|
|
320
|
+
</Flex>
|
|
321
|
+
<Flex direction="row" align="center" gap="xs">
|
|
322
|
+
<span className="text-muted-foreground inline-flex">
|
|
323
|
+
<Minus aria-hidden="true" className="size-4" />
|
|
324
|
+
</span>
|
|
325
|
+
<Text size="xs" tone="muted">
|
|
326
|
+
不許可
|
|
327
|
+
</Text>
|
|
328
|
+
</Flex>
|
|
329
|
+
<Flex direction="row" align="center" gap="xs">
|
|
330
|
+
<Badge tone="warning" variant="outline">
|
|
331
|
+
差分
|
|
332
|
+
</Badge>
|
|
333
|
+
<Text size="xs" tone="muted">
|
|
334
|
+
比較 A / B で付与が異なる行
|
|
335
|
+
</Text>
|
|
336
|
+
</Flex>
|
|
337
|
+
</Flex>
|
|
338
|
+
</CardContent>
|
|
339
|
+
</Card>
|
|
340
|
+
</Flex>
|
|
341
|
+
</PageContainer>
|
|
342
|
+
);
|
|
343
|
+
}
|