@exxatdesignux/ui 0.2.19 → 0.3.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/CHANGELOG.md +60 -7
- package/bin/sync-extras.mjs +116 -29
- package/consumer-extras/README.md +42 -7
- package/consumer-extras/cursor-rules/exxat-accessibility.mdc +39 -0
- package/consumer-extras/cursor-rules/exxat-board-cards.mdc +26 -0
- package/consumer-extras/cursor-rules/exxat-breadcrumbs-no-back.mdc +21 -0
- package/consumer-extras/cursor-rules/exxat-card-vs-list-rows.mdc +21 -0
- package/consumer-extras/cursor-rules/exxat-centralized-list-dataset.mdc +44 -0
- package/consumer-extras/cursor-rules/exxat-collaboration-access.mdc +32 -0
- package/consumer-extras/cursor-rules/exxat-command-menu.mdc +22 -0
- package/consumer-extras/cursor-rules/exxat-dashboard-view-charts.mdc +53 -0
- package/consumer-extras/cursor-rules/exxat-data-tables.mdc +41 -0
- package/consumer-extras/cursor-rules/exxat-dedicated-search-surfaces.mdc +25 -0
- package/consumer-extras/cursor-rules/exxat-drawer-vs-dialog.mdc +22 -0
- package/consumer-extras/cursor-rules/exxat-ds-agents.mdc +56 -0
- package/consumer-extras/cursor-rules/exxat-fontawesome-icons.mdc +31 -0
- package/consumer-extras/cursor-rules/exxat-kbd-shortcuts.mdc +100 -0
- package/consumer-extras/cursor-rules/exxat-kpi-flat-band.mdc +28 -0
- package/consumer-extras/cursor-rules/exxat-kpi-max-four.mdc +21 -0
- package/consumer-extras/cursor-rules/exxat-kpi-trends.mdc +31 -0
- package/consumer-extras/cursor-rules/exxat-list-page-connected-views.mdc +24 -0
- package/consumer-extras/cursor-rules/exxat-list-page-view-shells.mdc +31 -0
- package/consumer-extras/cursor-rules/exxat-mono-ids.mdc +30 -0
- package/consumer-extras/cursor-rules/exxat-no-slds-leakage.mdc +78 -0
- package/consumer-extras/cursor-rules/exxat-no-toast.mdc +25 -0
- package/consumer-extras/cursor-rules/exxat-page-vs-drawer.mdc +23 -0
- package/consumer-extras/cursor-rules/exxat-person-identity-display.mdc +47 -0
- package/consumer-extras/cursor-rules/exxat-primary-nav-secondary-panel.mdc +52 -0
- package/consumer-extras/cursor-rules/exxat-question-bank-hub-header.mdc +28 -0
- package/consumer-extras/cursor-rules/exxat-reuse-before-custom.mdc +34 -0
- package/consumer-extras/cursor-rules/exxat-table-properties-drawer.mdc +77 -0
- package/consumer-extras/cursor-rules/exxat-token-discipline.mdc +103 -0
- package/consumer-extras/cursor-skills/exxat-accessibility/SKILL.md +1 -1
- package/consumer-extras/cursor-skills/exxat-board-cards/SKILL.md +2 -2
- package/consumer-extras/cursor-skills/exxat-centralized-list-dataset/SKILL.md +4 -15
- package/consumer-extras/cursor-skills/exxat-ds-skill/SKILL.md +13 -28
- package/consumer-extras/cursor-skills/exxat-ds-skill/references/data-table-pattern.md +1 -1
- package/consumer-extras/cursor-skills/exxat-primary-nav-secondary-panel/SKILL.md +2 -4
- package/consumer-extras/handbook/HANDBOOK.md +185 -0
- package/consumer-extras/handbook/glossary.md +57 -0
- package/consumer-extras/handbook/reference-implementations.md +126 -0
- package/consumer-extras/handbook/voice-and-tone.md +262 -0
- package/consumer-extras/patterns/command-menu-pattern.md +1 -1
- package/consumer-extras/patterns/consumer-upgrade-checklist.md +0 -20
- package/consumer-extras/patterns/data-views-pattern.md +17 -54
- package/consumer-extras/patterns/shell-surface-elevation-pattern.md +3 -5
- package/dist/components/data-table/filter-date-calendar.d.ts +10 -0
- package/dist/components/data-table/filter-date-calendar.js +280 -0
- package/dist/components/data-table/filter-date-calendar.js.map +1 -0
- package/dist/components/data-table/filter-text-value-input.d.ts +15 -0
- package/dist/components/data-table/filter-text-value-input.js +561 -0
- package/dist/components/data-table/filter-text-value-input.js.map +1 -0
- package/dist/components/data-table/index.d.ts +45 -0
- package/dist/components/data-table/index.js +3085 -0
- package/dist/components/data-table/index.js.map +1 -0
- package/dist/components/data-table/pagination.d.ts +28 -0
- package/dist/components/data-table/pagination.js +3264 -0
- package/dist/components/data-table/pagination.js.map +1 -0
- package/dist/components/data-table/types.d.ts +84 -0
- package/dist/components/data-table/types.js +3 -0
- package/dist/components/data-table/types.js.map +1 -0
- package/dist/components/data-table/use-table-state.d.ts +116 -0
- package/dist/components/data-table/use-table-state.js +670 -0
- package/dist/components/data-table/use-table-state.js.map +1 -0
- package/dist/components/data-views/board-card-primitives.d.ts +22 -0
- package/dist/components/data-views/board-card-primitives.js +84 -0
- package/dist/components/data-views/board-card-primitives.js.map +1 -0
- package/dist/components/data-views/data-row-list.d.ts +33 -0
- package/dist/components/data-views/data-row-list.js +106 -0
- package/dist/components/data-views/data-row-list.js.map +1 -0
- package/dist/components/data-views/finder-panel-view.d.ts +54 -0
- package/dist/components/data-views/finder-panel-view.js +388 -0
- package/dist/components/data-views/finder-panel-view.js.map +1 -0
- package/dist/components/data-views/folder-grid-view.d.ts +22 -0
- package/dist/components/data-views/folder-grid-view.js +58 -0
- package/dist/components/data-views/folder-grid-view.js.map +1 -0
- package/dist/components/data-views/hub-table.d.ts +167 -0
- package/dist/components/data-views/hub-table.js +5561 -0
- package/dist/components/data-views/hub-table.js.map +1 -0
- package/dist/components/data-views/index.d.ts +27 -0
- package/dist/components/data-views/index.js +6575 -0
- package/dist/components/data-views/index.js.map +1 -0
- package/dist/components/data-views/list-page-board-card.d.ts +72 -0
- package/dist/components/data-views/list-page-board-card.js +264 -0
- package/dist/components/data-views/list-page-board-card.js.map +1 -0
- package/dist/components/data-views/list-page-board-template.d.ts +24 -0
- package/dist/components/data-views/list-page-board-template.js +137 -0
- package/dist/components/data-views/list-page-board-template.js.map +1 -0
- package/dist/components/data-views/list-page-connected-view-body.d.ts +19 -0
- package/dist/components/data-views/list-page-connected-view-body.js +116 -0
- package/dist/components/data-views/list-page-connected-view-body.js.map +1 -0
- package/dist/components/data-views/list-page-split-details-placeholder.d.ts +14 -0
- package/dist/components/data-views/list-page-split-details-placeholder.js +38 -0
- package/dist/components/data-views/list-page-split-details-placeholder.js.map +1 -0
- package/dist/components/data-views/list-page-split-hub-chrome.d.ts +17 -0
- package/dist/components/data-views/list-page-split-hub-chrome.js +54 -0
- package/dist/components/data-views/list-page-split-hub-chrome.js.map +1 -0
- package/dist/components/data-views/list-page-split-hub-tokens.d.ts +12 -0
- package/dist/components/data-views/list-page-split-hub-tokens.js +8 -0
- package/dist/components/data-views/list-page-split-hub-tokens.js.map +1 -0
- package/dist/components/data-views/list-page-tree-column-header.d.ts +15 -0
- package/dist/components/data-views/list-page-tree-column-header.js +22 -0
- package/dist/components/data-views/list-page-tree-column-header.js.map +1 -0
- package/dist/components/data-views/list-page-tree-panel-shell.d.ts +25 -0
- package/dist/components/data-views/list-page-tree-panel-shell.js +146 -0
- package/dist/components/data-views/list-page-tree-panel-shell.js.map +1 -0
- package/dist/components/data-views/os-folder-glyph.d.ts +35 -0
- package/dist/components/data-views/os-folder-glyph.js +104 -0
- package/dist/components/data-views/os-folder-glyph.js.map +1 -0
- package/dist/components/data-views/outline-tree-menu.d.ts +36 -0
- package/dist/components/data-views/outline-tree-menu.js +131 -0
- package/dist/components/data-views/outline-tree-menu.js.map +1 -0
- package/dist/components/table-properties/column-row.d.ts +22 -0
- package/dist/components/table-properties/column-row.js +153 -0
- package/dist/components/table-properties/column-row.js.map +1 -0
- package/dist/components/table-properties/draggable-list.d.ts +24 -0
- package/dist/components/table-properties/draggable-list.js +53 -0
- package/dist/components/table-properties/draggable-list.js.map +1 -0
- package/dist/components/table-properties/drawer-button.d.ts +110 -0
- package/dist/components/table-properties/drawer-button.js +2748 -0
- package/dist/components/table-properties/drawer-button.js.map +1 -0
- package/dist/components/table-properties/drawer.d.ts +100 -0
- package/dist/components/table-properties/drawer.js +2595 -0
- package/dist/components/table-properties/drawer.js.map +1 -0
- package/dist/components/table-properties/filter-card.d.ts +24 -0
- package/dist/components/table-properties/filter-card.js +854 -0
- package/dist/components/table-properties/filter-card.js.map +1 -0
- package/dist/components/table-properties/index.d.ts +14 -0
- package/dist/components/table-properties/index.js +2768 -0
- package/dist/components/table-properties/index.js.map +1 -0
- package/dist/components/table-properties/sort-card.d.ts +20 -0
- package/dist/components/table-properties/sort-card.js +102 -0
- package/dist/components/table-properties/sort-card.js.map +1 -0
- package/dist/components/templates/dedicated-search-landing-template.d.ts +21 -0
- package/dist/components/templates/dedicated-search-landing-template.js +254 -0
- package/dist/components/templates/dedicated-search-landing-template.js.map +1 -0
- package/dist/components/templates/dedicated-search-results-template.d.ts +15 -0
- package/dist/components/templates/dedicated-search-results-template.js +16 -0
- package/dist/components/templates/dedicated-search-results-template.js.map +1 -0
- package/dist/components/templates/index.d.ts +9 -0
- package/dist/components/templates/index.js +2720 -0
- package/dist/components/templates/index.js.map +1 -0
- package/dist/components/templates/list-page.d.ts +83 -0
- package/dist/components/templates/list-page.js +2433 -0
- package/dist/components/templates/list-page.js.map +1 -0
- package/dist/components/templates/nested-secondary-panel-shell.d.ts +20 -0
- package/dist/components/templates/nested-secondary-panel-shell.js +54 -0
- package/dist/components/templates/nested-secondary-panel-shell.js.map +1 -0
- package/dist/components/ui/accordion.d.ts +10 -0
- package/dist/components/ui/accordion.js +74 -0
- package/dist/components/ui/accordion.js.map +1 -0
- package/dist/components/ui/alert-dialog.d.ts +37 -0
- package/dist/components/ui/alert-dialog.js +201 -0
- package/dist/components/ui/alert-dialog.js.map +1 -0
- package/dist/components/ui/avatar.d.ts +84 -0
- package/dist/components/ui/avatar.js +328 -0
- package/dist/components/ui/avatar.js.map +1 -0
- package/dist/components/ui/badge.d.ts +13 -0
- package/dist/components/ui/badge.js +49 -0
- package/dist/components/ui/badge.js.map +1 -0
- package/dist/components/ui/banner.d.ts +62 -0
- package/dist/components/ui/banner.js +364 -0
- package/dist/components/ui/banner.js.map +1 -0
- package/dist/components/ui/breadcrumb.d.ts +14 -0
- package/dist/components/ui/breadcrumb.js +114 -0
- package/dist/components/ui/breadcrumb.js.map +1 -0
- package/dist/components/ui/button.d.ts +16 -0
- package/dist/components/ui/button.js +59 -0
- package/dist/components/ui/button.js.map +1 -0
- package/dist/components/ui/calendar.d.ts +13 -0
- package/dist/components/ui/calendar.js +238 -0
- package/dist/components/ui/calendar.js.map +1 -0
- package/dist/components/ui/card.d.ts +14 -0
- package/dist/components/ui/card.js +102 -0
- package/dist/components/ui/card.js.map +1 -0
- package/dist/components/ui/chart.d.ts +58 -0
- package/dist/components/ui/chart.js +292 -0
- package/dist/components/ui/chart.js.map +1 -0
- package/dist/components/ui/checkbox.d.ts +23 -0
- package/dist/components/ui/checkbox.js +155 -0
- package/dist/components/ui/checkbox.js.map +1 -0
- package/dist/components/ui/coach-mark.d.ts +27 -0
- package/dist/components/ui/coach-mark.js +306 -0
- package/dist/components/ui/coach-mark.js.map +1 -0
- package/dist/components/ui/collapsible.d.ts +8 -0
- package/dist/components/ui/collapsible.js +35 -0
- package/dist/components/ui/collapsible.js.map +1 -0
- package/dist/components/ui/command.d.ts +36 -0
- package/dist/components/ui/command.js +274 -0
- package/dist/components/ui/command.js.map +1 -0
- package/dist/components/ui/context-menu.d.ts +32 -0
- package/dist/components/ui/context-menu.js +245 -0
- package/dist/components/ui/context-menu.js.map +1 -0
- package/dist/components/ui/date-picker-field.d.ts +38 -0
- package/dist/components/ui/date-picker-field.js +550 -0
- package/dist/components/ui/date-picker-field.js.map +1 -0
- package/dist/components/ui/dialog.d.ts +22 -0
- package/dist/components/ui/dialog.js +200 -0
- package/dist/components/ui/dialog.js.map +1 -0
- package/dist/components/ui/dot-pattern.d.ts +21 -0
- package/dist/components/ui/dot-pattern.js +139 -0
- package/dist/components/ui/dot-pattern.js.map +1 -0
- package/dist/components/ui/drag-handle-grip.d.ts +10 -0
- package/dist/components/ui/drag-handle-grip.js +15 -0
- package/dist/components/ui/drag-handle-grip.js.map +1 -0
- package/dist/components/ui/drawer.d.ts +16 -0
- package/dist/components/ui/drawer.js +125 -0
- package/dist/components/ui/drawer.js.map +1 -0
- package/dist/components/ui/dropdown-menu.d.ts +45 -0
- package/dist/components/ui/dropdown-menu.js +353 -0
- package/dist/components/ui/dropdown-menu.js.map +1 -0
- package/dist/components/ui/export-drawer.d.ts +11 -0
- package/dist/components/ui/export-drawer.js +1658 -0
- package/dist/components/ui/export-drawer.js.map +1 -0
- package/dist/components/ui/field.d.ts +30 -0
- package/dist/components/ui/field.js +249 -0
- package/dist/components/ui/field.js.map +1 -0
- package/dist/components/ui/form.d.ts +28 -0
- package/dist/components/ui/form.js +110 -0
- package/dist/components/ui/form.js.map +1 -0
- package/dist/components/ui/hover-card.d.ts +9 -0
- package/dist/components/ui/hover-card.js +43 -0
- package/dist/components/ui/hover-card.js.map +1 -0
- package/dist/components/ui/input-group.d.ts +20 -0
- package/dist/components/ui/input-group.js +219 -0
- package/dist/components/ui/input-group.js.map +1 -0
- package/dist/components/ui/input-mask.d.ts +39 -0
- package/dist/components/ui/input-mask.js +118 -0
- package/dist/components/ui/input-mask.js.map +1 -0
- package/dist/components/ui/input.d.ts +5 -0
- package/dist/components/ui/input.js +30 -0
- package/dist/components/ui/input.js.map +1 -0
- package/dist/components/ui/kbd.d.ts +20 -0
- package/dist/components/ui/kbd.js +45 -0
- package/dist/components/ui/kbd.js.map +1 -0
- package/dist/components/ui/key-metrics-context.d.ts +19 -0
- package/dist/components/ui/key-metrics-context.js +26 -0
- package/dist/components/ui/key-metrics-context.js.map +1 -0
- package/dist/components/ui/key-metrics.d.ts +131 -0
- package/dist/components/ui/key-metrics.js +1015 -0
- package/dist/components/ui/key-metrics.js.map +1 -0
- package/dist/components/ui/label.d.ts +6 -0
- package/dist/components/ui/label.js +28 -0
- package/dist/components/ui/label.js.map +1 -0
- package/dist/components/ui/list-page-view-frame.d.ts +22 -0
- package/dist/components/ui/list-page-view-frame.js +24 -0
- package/dist/components/ui/list-page-view-frame.js.map +1 -0
- package/dist/components/ui/page-header.d.ts +51 -0
- package/dist/components/ui/page-header.js +372 -0
- package/dist/components/ui/page-header.js.map +1 -0
- package/dist/components/ui/payment-card-fields.d.ts +10 -0
- package/dist/components/ui/payment-card-fields.js +80 -0
- package/dist/components/ui/payment-card-fields.js.map +1 -0
- package/dist/components/ui/popover.d.ts +10 -0
- package/dist/components/ui/popover.js +47 -0
- package/dist/components/ui/popover.js.map +1 -0
- package/dist/components/ui/radio-group.d.ts +29 -0
- package/dist/components/ui/radio-group.js +190 -0
- package/dist/components/ui/radio-group.js.map +1 -0
- package/dist/components/ui/resizable.d.ts +16 -0
- package/dist/components/ui/resizable.js +51 -0
- package/dist/components/ui/resizable.js.map +1 -0
- package/dist/components/ui/scroll-area.d.ts +8 -0
- package/dist/components/ui/scroll-area.js +66 -0
- package/dist/components/ui/scroll-area.js.map +1 -0
- package/dist/components/ui/select.d.ts +18 -0
- package/dist/components/ui/select.js +186 -0
- package/dist/components/ui/select.js.map +1 -0
- package/dist/components/ui/selection-tile-grid.d.ts +52 -0
- package/dist/components/ui/selection-tile-grid.js +347 -0
- package/dist/components/ui/selection-tile-grid.js.map +1 -0
- package/dist/components/ui/separator.d.ts +7 -0
- package/dist/components/ui/separator.js +33 -0
- package/dist/components/ui/separator.js.map +1 -0
- package/dist/components/ui/sheet.d.ts +18 -0
- package/dist/components/ui/sheet.js +181 -0
- package/dist/components/ui/sheet.js.map +1 -0
- package/dist/components/ui/sidebar.d.ts +94 -0
- package/dist/components/ui/sidebar.js +805 -0
- package/dist/components/ui/sidebar.js.map +1 -0
- package/dist/components/ui/skeleton.d.ts +5 -0
- package/dist/components/ui/skeleton.js +22 -0
- package/dist/components/ui/skeleton.js.map +1 -0
- package/dist/components/ui/slider.d.ts +7 -0
- package/dist/components/ui/slider.js +66 -0
- package/dist/components/ui/slider.js.map +1 -0
- package/dist/components/ui/sonner.d.ts +6 -0
- package/dist/components/ui/sonner.js +38 -0
- package/dist/components/ui/sonner.js.map +1 -0
- package/dist/components/ui/status-badge.d.ts +38 -0
- package/dist/components/ui/status-badge.js +77 -0
- package/dist/components/ui/status-badge.js.map +1 -0
- package/dist/components/ui/table.d.ts +13 -0
- package/dist/components/ui/table.js +115 -0
- package/dist/components/ui/table.js.map +1 -0
- package/dist/components/ui/tabs.d.ts +15 -0
- package/dist/components/ui/tabs.js +93 -0
- package/dist/components/ui/tabs.js.map +1 -0
- package/dist/components/ui/textarea.d.ts +6 -0
- package/dist/components/ui/textarea.js +25 -0
- package/dist/components/ui/textarea.js.map +1 -0
- package/dist/components/ui/tip.d.ts +12 -0
- package/dist/components/ui/tip.js +61 -0
- package/dist/components/ui/tip.js.map +1 -0
- package/dist/components/ui/toggle-group.d.ts +14 -0
- package/dist/components/ui/toggle-group.js +104 -0
- package/dist/components/ui/toggle-group.js.map +1 -0
- package/dist/components/ui/toggle-switch.d.ts +10 -0
- package/dist/components/ui/toggle-switch.js +33 -0
- package/dist/components/ui/toggle-switch.js.map +1 -0
- package/dist/components/ui/toggle.d.ts +13 -0
- package/dist/components/ui/toggle.js +51 -0
- package/dist/components/ui/toggle.js.map +1 -0
- package/dist/components/ui/tooltip.d.ts +10 -0
- package/dist/components/ui/tooltip.js +68 -0
- package/dist/components/ui/tooltip.js.map +1 -0
- package/dist/components/ui/view-segmented-control.d.ts +31 -0
- package/dist/components/ui/view-segmented-control.js +167 -0
- package/dist/components/ui/view-segmented-control.js.map +1 -0
- package/dist/data-list-view-registry-CyBoBML4.d.ts +73 -0
- package/dist/hooks/use-app-theme.d.ts +24 -0
- package/dist/hooks/use-app-theme.js +286 -0
- package/dist/hooks/use-app-theme.js.map +1 -0
- package/dist/hooks/use-coach-mark.d.ts +86 -0
- package/dist/hooks/use-coach-mark.js +218 -0
- package/dist/hooks/use-coach-mark.js.map +1 -0
- package/dist/hooks/use-mobile.d.ts +3 -0
- package/dist/hooks/use-mobile.js +29 -0
- package/dist/hooks/use-mobile.js.map +1 -0
- package/dist/hooks/use-mod-key-label.d.ts +6 -0
- package/dist/hooks/use-mod-key-label.js +25 -0
- package/dist/hooks/use-mod-key-label.js.map +1 -0
- package/dist/index.d.ts +120 -0
- package/dist/index.js +13324 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/compose-refs.d.ts +6 -0
- package/dist/lib/compose-refs.js +17 -0
- package/dist/lib/compose-refs.js.map +1 -0
- package/dist/lib/conditional-rule-match.d.ts +30 -0
- package/dist/lib/conditional-rule-match.js +66 -0
- package/dist/lib/conditional-rule-match.js.map +1 -0
- package/dist/lib/data-list-display-options.d.ts +26 -0
- package/dist/lib/data-list-display-options.js +14 -0
- package/dist/lib/data-list-display-options.js.map +1 -0
- package/dist/lib/data-list-view-registry.d.ts +2 -0
- package/dist/lib/data-list-view-registry.js +102 -0
- package/dist/lib/data-list-view-registry.js.map +1 -0
- package/dist/lib/data-list-view-surface.d.ts +2 -0
- package/dist/lib/data-list-view-surface.js +80 -0
- package/dist/lib/data-list-view-surface.js.map +1 -0
- package/dist/lib/data-list-view.d.ts +21 -0
- package/dist/lib/data-list-view.js +25 -0
- package/dist/lib/data-list-view.js.map +1 -0
- package/dist/lib/date-filter.d.ts +22 -0
- package/dist/lib/date-filter.js +61 -0
- package/dist/lib/date-filter.js.map +1 -0
- package/dist/lib/dev-log.d.ts +8 -0
- package/dist/lib/dev-log.js +10 -0
- package/dist/lib/dev-log.js.map +1 -0
- package/dist/lib/dropdown-menu-surface.d.ts +14 -0
- package/dist/lib/dropdown-menu-surface.js +6 -0
- package/dist/lib/dropdown-menu-surface.js.map +1 -0
- package/dist/lib/editable-target.d.ts +12 -0
- package/dist/lib/editable-target.js +12 -0
- package/dist/lib/editable-target.js.map +1 -0
- package/dist/lib/list-page-table-properties.d.ts +35 -0
- package/dist/lib/list-page-table-properties.js +81 -0
- package/dist/lib/list-page-table-properties.js.map +1 -0
- package/dist/lib/raf-throttle.d.ts +23 -0
- package/dist/lib/raf-throttle.js +27 -0
- package/dist/lib/raf-throttle.js.map +1 -0
- package/dist/lib/row-height.d.ts +16 -0
- package/dist/lib/row-height.js +10 -0
- package/dist/lib/row-height.js.map +1 -0
- package/dist/lib/table-properties-types.d.ts +83 -0
- package/dist/lib/table-properties-types.js +19 -0
- package/dist/lib/table-properties-types.js.map +1 -0
- package/dist/lib/utils.d.ts +5 -0
- package/dist/lib/utils.js +11 -0
- package/dist/lib/utils.js.map +1 -0
- package/package.json +83 -19
- package/src/components/data-table/filter-date-calendar.tsx +38 -0
- package/src/components/data-table/filter-text-value-input.tsx +77 -0
- package/src/components/data-table/index.tsx +1678 -0
- package/src/components/data-table/pagination.tsx +255 -0
- package/src/components/data-table/types.ts +96 -0
- package/src/components/data-table/use-table-state.ts +767 -0
- package/src/components/data-views/board-card-primitives.tsx +93 -0
- package/src/components/data-views/data-row-list.tsx +183 -0
- package/src/components/data-views/finder-panel-view.tsx +405 -0
- package/src/components/data-views/folder-grid-view.tsx +86 -0
- package/src/components/data-views/hub-table.tsx +498 -0
- package/src/components/data-views/index.ts +28 -0
- package/src/components/data-views/list-page-board-card.tsx +192 -0
- package/src/components/data-views/list-page-board-template.tsx +122 -0
- package/src/components/data-views/list-page-connected-view-body.tsx +66 -0
- package/src/components/data-views/list-page-split-details-placeholder.tsx +39 -0
- package/src/components/data-views/list-page-split-hub-chrome.tsx +60 -0
- package/src/components/data-views/list-page-split-hub-tokens.ts +16 -0
- package/src/components/data-views/list-page-tree-column-header.tsx +31 -0
- package/src/components/data-views/list-page-tree-panel-shell.tsx +91 -0
- package/src/components/data-views/os-folder-glyph.tsx +141 -0
- package/src/components/data-views/outline-tree-menu.tsx +157 -0
- package/src/components/table-properties/column-row.tsx +90 -0
- package/src/components/table-properties/draggable-list.ts +54 -0
- package/src/components/table-properties/drawer-button.tsx +300 -0
- package/src/components/table-properties/drawer.tsx +1148 -0
- package/src/components/table-properties/filter-card.tsx +251 -0
- package/src/components/table-properties/index.ts +36 -0
- package/src/components/table-properties/sort-card.tsx +63 -0
- package/src/components/templates/dedicated-search-landing-template.tsx +124 -0
- package/src/components/templates/dedicated-search-results-template.tsx +19 -0
- package/src/components/templates/index.ts +33 -0
- package/src/components/templates/list-page.tsx +602 -0
- package/src/components/templates/nested-secondary-panel-shell.tsx +70 -0
- package/src/components/ui/accordion.tsx +92 -0
- package/src/components/ui/alert-dialog.tsx +221 -0
- package/src/components/ui/avatar.tsx +13 -2
- package/src/components/ui/banner.tsx +2 -2
- package/src/components/ui/button.tsx +4 -4
- package/src/components/ui/calendar.tsx +1 -1
- package/src/components/ui/coach-mark.tsx +1 -1
- package/src/components/ui/context-menu.tsx +291 -0
- package/src/components/ui/date-picker-field.tsx +2 -2
- package/src/components/ui/dot-pattern.tsx +183 -0
- package/src/components/ui/export-drawer.tsx +375 -0
- package/src/components/ui/hover-card.tsx +66 -0
- package/src/components/ui/key-metrics-context.tsx +78 -0
- package/src/components/ui/key-metrics.tsx +1133 -0
- package/src/components/ui/list-page-view-frame.tsx +64 -0
- package/src/components/ui/page-header.tsx +244 -0
- package/src/components/ui/payment-card-fields.tsx +2 -2
- package/src/components/ui/resizable.tsx +68 -0
- package/src/components/ui/scroll-area.tsx +72 -0
- package/src/components/ui/selection-tile-grid.tsx +9 -2
- package/src/components/ui/sidebar.tsx +84 -12
- package/src/components/ui/slider.tsx +83 -0
- package/src/globals.css +2201 -7
- package/src/globals.d.ts +20 -0
- package/src/index.ts +68 -1
- package/src/lib/conditional-rule-match.ts +119 -0
- package/src/lib/data-list-display-options.ts +35 -0
- package/src/lib/data-list-view-registry.ts +104 -0
- package/src/lib/data-list-view-surface.ts +83 -0
- package/src/lib/data-list-view.ts +47 -0
- package/src/lib/dev-log.ts +10 -0
- package/src/lib/editable-target.ts +20 -0
- package/src/lib/list-page-table-properties.ts +48 -0
- package/src/lib/raf-throttle.ts +45 -0
- package/src/lib/row-height.ts +19 -0
- package/src/lib/table-properties-types.ts +98 -0
- package/template/.cursor/rules/exxat-command-menu.mdc +1 -1
- package/template/.cursor/rules/exxat-dashboard-view-charts.mdc +3 -3
- package/template/.cursor/rules/exxat-data-tables.mdc +1 -1
- package/template/.cursor/rules/exxat-ds-agents.mdc +2 -2
- package/template/.cursor/rules/exxat-kbd-shortcuts.mdc +2 -2
- package/template/.cursor/rules/exxat-table-properties-drawer.mdc +1 -1
- package/template/AGENTS.md +104 -78
- package/template/app/(app)/dashboard/loading.tsx +15 -3
- package/template/app/(app)/dashboard/page.tsx +14 -2
- package/template/app/(app)/examples/page.tsx +0 -2
- package/template/app/(app)/layout.tsx +17 -4
- package/template/app/(app)/loading.tsx +18 -1
- package/template/app/(app)/question-bank/find/page.tsx +1 -2
- package/template/app/(app)/question-bank/layout.tsx +1 -1
- package/template/app/(app)/question-bank/library/page.tsx +1 -2
- package/template/app/(app)/question-bank/list/page.tsx +1 -2
- package/template/app/(app)/question-bank/new/page.tsx +15 -20
- package/template/app/(app)/question-bank/page.tsx +1 -2
- package/template/app/(app)/settings/page.tsx +5 -4
- package/template/app/globals.css +14 -16
- package/template/components/ask-leo-sidebar.tsx +5 -1
- package/template/components/brand-color-picker.tsx +2 -2
- package/template/components/charts-overview.tsx +1 -1
- package/template/components/compliance-board-view.tsx +142 -0
- package/template/components/compliance-client.tsx +92 -0
- package/template/components/compliance-page-header.tsx +89 -0
- package/template/components/compliance-table.tsx +468 -0
- package/template/components/dashboard-report-charts.tsx +1 -1
- package/template/components/dashboard-tabs.tsx +1 -1
- package/template/components/data-table/filter-date-calendar.tsx +1 -38
- package/template/components/data-table/filter-text-value-input.tsx +1 -77
- package/template/components/data-table/index.tsx +1 -1634
- package/template/components/data-table/pagination.tsx +1 -255
- package/template/components/data-table/types.ts +1 -94
- package/template/components/data-table/use-table-state.test.ts +420 -0
- package/template/components/data-table/use-table-state.ts +1 -758
- package/template/components/data-view-dashboard-charts-compliance.tsx +963 -0
- package/template/components/data-view-dashboard-charts-team.tsx +971 -0
- package/template/components/data-view-dashboard-charts.tsx +1503 -0
- package/template/components/data-views/board-card-primitives.tsx +1 -93
- package/template/components/data-views/data-row-list.tsx +1 -183
- package/template/components/data-views/finder-panel-view.tsx +1 -405
- package/template/components/data-views/folder-grid-view.tsx +1 -86
- package/template/components/data-views/hub-table.tsx +1 -0
- package/template/components/data-views/index.ts +50 -37
- package/template/components/data-views/list-page-board-card.tsx +1 -192
- package/template/components/data-views/list-page-board-template.tsx +1 -122
- package/template/components/data-views/list-page-connected-view-body.tsx +1 -66
- package/template/components/data-views/list-page-split-details-placeholder.tsx +1 -39
- package/template/components/data-views/list-page-split-hub-chrome.tsx +1 -68
- package/template/components/data-views/list-page-split-hub-tokens.ts +1 -16
- package/template/components/data-views/list-page-tree-column-header.tsx +1 -31
- package/template/components/data-views/list-page-tree-panel-shell.tsx +1 -91
- package/template/components/data-views/list-page-view-frame.tsx +5 -53
- package/template/components/data-views/os-folder-glyph.tsx +1 -129
- package/template/components/data-views/outline-tree-menu.tsx +1 -157
- package/template/components/export-drawer.test.tsx +71 -0
- package/template/components/export-drawer.tsx +1 -375
- package/template/components/exxat-product-logo.tsx +5 -5
- package/template/components/hub-tree-panel-view.tsx +2 -2
- package/template/components/invite-collaborators-drawer.tsx +3 -3
- package/template/components/key-metrics-ask-leo-bridge.tsx +40 -0
- package/template/components/key-metrics.tsx +1 -1063
- package/template/components/leo-insight-indicator.tsx +2 -2
- package/template/components/new-placement-back-btn.tsx +28 -0
- package/template/components/new-placement-form.tsx +942 -0
- package/template/components/new-question-composer.tsx +456 -408
- package/template/components/onboarding/index.ts +9 -0
- package/template/components/onboarding/onboarding-01.tsx +1 -1
- package/template/components/onboarding/onboarding-02.tsx +1 -1
- package/template/components/onboarding/onboarding-03.tsx +1 -1
- package/template/components/onboarding/onboarding-04.tsx +1 -1
- package/template/components/page-header.tsx +8 -226
- package/template/components/placement-board-card.tsx +250 -0
- package/template/components/placement-detail.tsx +438 -0
- package/template/components/placements-board-view.tsx +397 -0
- package/template/components/placements-client.tsx +220 -0
- package/template/components/placements-list-view.tsx +124 -0
- package/template/components/placements-page-header.tsx +166 -0
- package/template/components/placements-table-cells.test.tsx +22 -0
- package/template/components/placements-table-cells.tsx +173 -0
- package/template/components/placements-table-columns.tsx +210 -0
- package/template/components/placements-table.tsx +934 -0
- package/template/components/product-switcher.tsx +3 -4
- package/template/components/product-wordmark.tsx +2 -1
- package/template/components/question-bank-client.tsx +5 -5
- package/template/components/question-bank-hub-client.tsx +1 -1
- package/template/components/question-bank-new-folder-sheet.tsx +2 -2
- package/template/components/question-bank-secondary-nav.tsx +3 -3
- package/template/components/question-bank-table.tsx +541 -431
- package/template/components/rotations-empty-state.tsx +50 -0
- package/template/components/rotations-panel-activator.tsx +8 -0
- package/template/components/settings-appearance-card.tsx +3 -4
- package/template/components/settings-client.tsx +15 -59
- package/template/components/settings-form-row.tsx +4 -9
- package/template/components/{app-sidebar-dynamic.tsx → sidebar/app-sidebar-dynamic.tsx} +1 -1
- package/template/components/{app-sidebar.tsx → sidebar/app-sidebar.tsx} +59 -74
- package/template/components/sidebar/index.ts +16 -0
- package/template/components/{secondary-nav.tsx → sidebar/secondary-nav.tsx} +2 -2
- package/template/components/{secondary-panel.tsx → sidebar/secondary-panel.tsx} +50 -7
- package/template/components/{sidebar-auto-collapse.tsx → sidebar/sidebar-auto-collapse.tsx} +6 -2
- package/template/components/{sidebar-shell.tsx → sidebar/sidebar-shell.tsx} +1 -1
- package/template/components/site-header.tsx +1 -1
- package/template/components/sites-board-view.tsx +67 -0
- package/template/components/sites-client.tsx +154 -0
- package/template/components/sites-table.tsx +249 -0
- package/template/components/table-properties/column-row.tsx +1 -90
- package/template/components/table-properties/draggable-list.ts +1 -49
- package/template/components/table-properties/drawer-button.tsx +1 -262
- package/template/components/table-properties/drawer.tsx +1 -1166
- package/template/components/table-properties/filter-card.tsx +1 -251
- package/template/components/table-properties/sort-card.tsx +1 -59
- package/template/components/table-properties/types.ts +28 -71
- package/template/components/team-board-view.tsx +122 -0
- package/template/components/team-client.tsx +100 -0
- package/template/components/team-page-header.tsx +92 -0
- package/template/components/team-table.tsx +553 -0
- package/template/components/templates/dedicated-search-landing-template.tsx +1 -124
- package/template/components/templates/dedicated-search-results-template.tsx +1 -19
- package/template/components/templates/list-page.tsx +1 -608
- package/template/components/templates/nested-secondary-panel-shell.tsx +1 -63
- package/template/components/templates/new-focus-template.tsx +659 -0
- package/template/components/templates/secondary-panel-hub-template.tsx +1 -1
- package/template/components/ui/accordion.tsx +1 -0
- package/template/components/ui/alert-dialog.tsx +1 -0
- package/template/components/ui/context-menu.tsx +1 -0
- package/template/components/ui/dot-pattern.tsx +1 -183
- package/template/components/ui/hover-card.tsx +1 -0
- package/template/components/ui/resizable.tsx +1 -68
- package/template/components/ui/scroll-area.tsx +1 -0
- package/template/components/ui/slider.tsx +1 -0
- package/template/docs/blueprints/README.md +86 -0
- package/template/docs/blueprints/_template.md +91 -0
- package/template/docs/blueprints/board-card.md +123 -0
- package/template/docs/blueprints/data-table.md +139 -0
- package/template/docs/blueprints/key-metrics.md +128 -0
- package/template/docs/blueprints/list-page-template.md +123 -0
- package/template/docs/blueprints/page-header.md +130 -0
- package/template/docs/command-menu-pattern.md +1 -1
- package/template/docs/component-selection-guide.md +224 -0
- package/template/docs/components-audit-2026-05.md +158 -0
- package/template/docs/data-views-pattern.md +17 -54
- package/template/docs/drawer-vs-dialog-pattern.md +1 -3
- package/template/docs/migrations/0001-brand-deep-alias-stabilization.md +95 -0
- package/template/docs/migrations/0002-exxat-token-namespace.md +154 -0
- package/template/docs/migrations/0003-globals-css-canonical.md +110 -0
- package/template/docs/migrations/README.md +100 -0
- package/template/docs/migrations/_template.md +64 -0
- package/template/docs/shell-surface-elevation-pattern.md +3 -5
- package/template/docs/token-taxonomy.md +416 -0
- package/template/eslint.config.mjs +27 -0
- package/template/hooks/use-secondary-panel-hub-nav.ts +1 -1
- package/template/lib/command-menu-config.ts +0 -1
- package/template/lib/command-menu-search-data.ts +27 -11
- package/template/lib/compliance-supported-views.ts +10 -0
- package/template/lib/conditional-rule-match.ts +6 -97
- package/template/lib/data-list-display-options.ts +1 -49
- package/template/lib/data-list-view-registry.ts +1 -104
- package/template/lib/data-list-view-surface.ts +1 -83
- package/template/lib/data-list-view.ts +1 -47
- package/template/lib/data-view-dashboard-placements-layout.ts +215 -0
- package/template/lib/data-view-dashboard-storage.ts +35 -38
- package/template/lib/dev-log.ts +1 -8
- package/template/lib/editable-target.ts +1 -10
- package/template/lib/list-page-table-properties.ts +1 -48
- package/template/lib/list-status-badges.ts +97 -4
- package/template/lib/mock/compliance-kpi.ts +61 -0
- package/template/lib/mock/compliance.ts +146 -0
- package/template/lib/mock/navigation.tsx +0 -9
- package/template/lib/mock/placements-kpi.ts +134 -0
- package/template/lib/mock/placements.ts +176 -0
- package/template/lib/mock/sites-directory.ts +16 -0
- package/template/lib/mock/sites-kpi.ts +25 -0
- package/template/lib/mock/team-kpi.ts +60 -0
- package/template/lib/mock/team.ts +118 -0
- package/template/lib/placement-board-card-layout.ts +79 -0
- package/template/lib/placements-supported-views.ts +12 -0
- package/template/lib/question-bank-supported-views.ts +0 -1
- package/template/lib/raf-throttle.ts +1 -45
- package/template/lib/row-height.ts +4 -10
- package/template/lib/sidebar-state-cookie.ts +11 -2
- package/template/lib/sites-supported-views.ts +10 -0
- package/template/lib/table-state-lifecycle.ts +2 -2
- package/template/lib/team-supported-views.ts +10 -0
- package/template/package.json +1 -0
- package/template/tests/setup.ts +25 -0
- package/consumer-extras/AGENTS.md +0 -76
- package/consumer-extras/cursor-skills/exxat-consumer-app/SKILL.md +0 -37
- package/consumer-extras/cursor-skills/exxat-focused-workflow-page/SKILL.md +0 -57
- package/consumer-extras/patterns/consumer-app-pattern.md +0 -39
- package/consumer-extras/patterns/focused-workflow-page-pattern.md +0 -84
- package/src/components/ui/button-group.tsx +0 -81
- package/src/theme.css +0 -16
- package/src/tokens/README.md +0 -15
- package/src/tokens/base.css +0 -337
- package/src/tokens/high-contrast.css +0 -1195
- package/src/tokens/layers.css +0 -224
- package/src/tokens/tailwind-bridge.css +0 -118
- package/src/tokens/themes.css +0 -201
- package/template/app/(app)/data-list/layout.tsx +0 -43
- package/template/app/(app)/data-list/page.tsx +0 -10
- package/template/app/(app)/examples/focused-workflow/page.tsx +0 -5
- package/template/components/app-route-loading.tsx +0 -14
- package/template/components/dashboard-onboarding-gallery.tsx +0 -13
- package/template/components/dashboard-onboarding.tsx +0 -21
- package/template/components/data-views/list-page-calendar-view.tsx +0 -593
- package/template/components/data-views/list-page-folder-columns-panel.tsx +0 -345
- package/template/components/examples/focused-workflow-showcase.tsx +0 -183
- package/template/components/list-hub-board-view.tsx +0 -68
- package/template/components/list-hub-client.tsx +0 -186
- package/template/components/list-hub-list-view.tsx +0 -36
- package/template/components/list-hub-panel-activator.tsx +0 -8
- package/template/components/list-hub-secondary-nav.tsx +0 -121
- package/template/components/list-hub-table.tsx +0 -336
- package/template/components/question-bank-folder-columns-panel.tsx +0 -104
- package/template/components/question-bank-list-view.tsx +0 -53
- package/template/components/secondary-panel/nav-link-rows.tsx +0 -83
- package/template/components/secondary-panels/list-hub-panel.tsx +0 -39
- package/template/components/secondary-panels/question-bank-panel.tsx +0 -39
- package/template/components/secondary-panels/registry.tsx +0 -15
- package/template/components/section-cards.tsx +0 -106
- package/template/components/templates/focused-workflow-layouts.tsx +0 -448
- package/template/components/templates/focused-workflow-page-template.tsx +0 -69
- package/template/components/templates/page-loading-shell.tsx +0 -262
- package/template/components/ui/button-group.tsx +0 -1
- package/template/docs/consumer-app-pattern.md +0 -39
- package/template/docs/focused-workflow-page-pattern.md +0 -84
- package/template/lib/list-hub-nav.ts +0 -121
- package/template/lib/mock/list-hub-directory.ts +0 -27
- package/template/lib/mock/list-hub-kpi.ts +0 -27
- package/template/lib/page-loading-variant.ts +0 -40
- /package/template/components/{getting-started.tsx → onboarding/getting-started.tsx} +0 -0
- /package/template/components/{nav-documents.tsx → sidebar/nav-documents.tsx} +0 -0
- /package/template/components/{nav-main.tsx → sidebar/nav-main.tsx} +0 -0
- /package/template/components/{nav-secondary.tsx → sidebar/nav-secondary.tsx} +0 -0
- /package/template/components/{nav-user.tsx → sidebar/nav-user.tsx} +0 -0
- /package/template/components/{sidebar-auto-open.tsx → sidebar/sidebar-auto-open.tsx} +0 -0
|
@@ -0,0 +1,963 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Compliance **Data** view dashboard — filtered compliance rows with the same canvas as Placements/Team.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import * as React from "react"
|
|
8
|
+
import {
|
|
9
|
+
closestCorners,
|
|
10
|
+
DndContext,
|
|
11
|
+
type DragEndEvent,
|
|
12
|
+
KeyboardSensor,
|
|
13
|
+
PointerSensor,
|
|
14
|
+
useSensor,
|
|
15
|
+
useSensors,
|
|
16
|
+
} from "@dnd-kit/core"
|
|
17
|
+
import {
|
|
18
|
+
arrayMove,
|
|
19
|
+
rectSortingStrategy,
|
|
20
|
+
SortableContext,
|
|
21
|
+
sortableKeyboardCoordinates,
|
|
22
|
+
useSortable,
|
|
23
|
+
} from "@dnd-kit/sortable"
|
|
24
|
+
import { CSS } from "@dnd-kit/utilities"
|
|
25
|
+
import { Bar, BarChart, CartesianGrid, Cell, Pie, PieChart, XAxis, YAxis } from "recharts"
|
|
26
|
+
import { ChartCard, ChartDataTable, ChartFigure, type ChartLeoInsight } from "@/components/charts-overview"
|
|
27
|
+
import { useChartVariant } from "@/contexts/chart-variant-context"
|
|
28
|
+
import { KeyMetrics, type MetricInsight, type MetricItem } from "@/components/key-metrics"
|
|
29
|
+
import { Button } from "@/components/ui/button"
|
|
30
|
+
import {
|
|
31
|
+
DropdownMenu,
|
|
32
|
+
DropdownMenuContent,
|
|
33
|
+
DropdownMenuItem,
|
|
34
|
+
DropdownMenuTrigger,
|
|
35
|
+
} from "@/components/ui/dropdown-menu"
|
|
36
|
+
import { ViewSegmentedControl } from "@/components/ui/view-segmented-control"
|
|
37
|
+
import { Tip } from "@/components/ui/tip"
|
|
38
|
+
import { DragHandleGripIcon } from "@/components/ui/drag-handle-grip"
|
|
39
|
+
import {
|
|
40
|
+
ChartContainer,
|
|
41
|
+
ChartTooltip,
|
|
42
|
+
chartTooltipKeyboardSyncProps,
|
|
43
|
+
ChartTooltipContent,
|
|
44
|
+
type ChartConfig,
|
|
45
|
+
} from "@/components/ui/chart"
|
|
46
|
+
import {
|
|
47
|
+
KEY_METRICS_KPI_COUNT_DEFAULT,
|
|
48
|
+
KEY_METRICS_KPI_COUNT_MAX,
|
|
49
|
+
KEY_METRICS_KPI_COUNT_MIN,
|
|
50
|
+
mergeDashboardLayoutGeneric,
|
|
51
|
+
} from "@/lib/dashboard-layout-merge"
|
|
52
|
+
import { cn } from "@/lib/utils"
|
|
53
|
+
import type { ComplianceItem } from "@/lib/mock/compliance"
|
|
54
|
+
import {
|
|
55
|
+
KEY_METRICS_CARD_ID,
|
|
56
|
+
applyVisibleReorder,
|
|
57
|
+
type ChartType,
|
|
58
|
+
type DashboardLayout,
|
|
59
|
+
} from "@/lib/data-view-dashboard-placements-layout"
|
|
60
|
+
import {
|
|
61
|
+
CHART_KBD_ACTIVE_BAR,
|
|
62
|
+
CHART_KBD_ACTIVE_PIE_SHAPE,
|
|
63
|
+
} from "@/lib/chart-keyboard-selection"
|
|
64
|
+
import {
|
|
65
|
+
loadDataViewLayout,
|
|
66
|
+
saveDataViewLayout,
|
|
67
|
+
} from "@/lib/data-view-dashboard-storage"
|
|
68
|
+
|
|
69
|
+
const STATUS_CFG: ChartConfig = {
|
|
70
|
+
value: { label: "Items", color: "var(--primary)" },
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const CAT_CFG: ChartConfig = {
|
|
74
|
+
value: { label: "Items", color: "var(--primary)" },
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const CHART_MARGIN = { top: 8, right: 8, left: 0, bottom: 0 } as const
|
|
78
|
+
const CHART_MARGIN_HORIZONTAL = { top: 8, right: 8, left: 4, bottom: 0 } as const
|
|
79
|
+
|
|
80
|
+
interface ComplianceDashboardCardDef {
|
|
81
|
+
id: string
|
|
82
|
+
title: string
|
|
83
|
+
description: string
|
|
84
|
+
defaultSpan: 1 | 2
|
|
85
|
+
defaultChartType: ChartType
|
|
86
|
+
chartTypes: { type: ChartType; label: string; icon: string }[]
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export const ALL_COMPLIANCE_DASHBOARD_CARDS: ComplianceDashboardCardDef[] = [
|
|
90
|
+
{
|
|
91
|
+
id: KEY_METRICS_CARD_ID,
|
|
92
|
+
title: "Key metrics",
|
|
93
|
+
description: "Summary KPIs for filtered obligations",
|
|
94
|
+
defaultSpan: 2,
|
|
95
|
+
defaultChartType: "bar",
|
|
96
|
+
chartTypes: [],
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
id: "compliance-by-status",
|
|
100
|
+
title: "Items by status",
|
|
101
|
+
description: "Filtered compliance obligations",
|
|
102
|
+
defaultSpan: 1,
|
|
103
|
+
defaultChartType: "bar",
|
|
104
|
+
chartTypes: [
|
|
105
|
+
{ type: "bar", label: "Bar", icon: "fa-light fa-chart-bar" },
|
|
106
|
+
{ type: "horizontal-bar", label: "Horizontal Bar", icon: "fa-light fa-chart-bar fa-rotate-90" },
|
|
107
|
+
{ type: "pie", label: "Donut", icon: "fa-light fa-chart-pie" },
|
|
108
|
+
],
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
id: "compliance-by-category",
|
|
112
|
+
title: "Items by category",
|
|
113
|
+
description: "Top categories in this view",
|
|
114
|
+
defaultSpan: 1,
|
|
115
|
+
defaultChartType: "horizontal-bar",
|
|
116
|
+
chartTypes: [
|
|
117
|
+
{ type: "horizontal-bar", label: "Horizontal Bar", icon: "fa-light fa-chart-bar fa-rotate-90" },
|
|
118
|
+
{ type: "bar", label: "Bar", icon: "fa-light fa-chart-bar" },
|
|
119
|
+
{ type: "pie", label: "Donut", icon: "fa-light fa-chart-pie" },
|
|
120
|
+
],
|
|
121
|
+
},
|
|
122
|
+
]
|
|
123
|
+
|
|
124
|
+
export const DEFAULT_COMPLIANCE_VISIBLE_CARDS = ALL_COMPLIANCE_DASHBOARD_CARDS.map(c => c.id)
|
|
125
|
+
export const DEFAULT_COMPLIANCE_SPANS: Record<string, 1 | 2> = Object.fromEntries(
|
|
126
|
+
ALL_COMPLIANCE_DASHBOARD_CARDS.map(c => [c.id, c.defaultSpan]),
|
|
127
|
+
)
|
|
128
|
+
export const DEFAULT_COMPLIANCE_CHART_TYPES: Record<string, ChartType> = Object.fromEntries(
|
|
129
|
+
ALL_COMPLIANCE_DASHBOARD_CARDS.map(c => [c.id, c.defaultChartType]),
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
const COMPLIANCE_CHART_LEO_INSIGHTS: Partial<Record<string, ChartLeoInsight>> = {
|
|
133
|
+
"compliance-by-status": {
|
|
134
|
+
headline: "Overdue and at-risk items stand out in this mix",
|
|
135
|
+
explanation:
|
|
136
|
+
"When overdue or expiring-soon slices are visible, renewal timing may be out of sync with the cohort. Tightening reminders or batch renewals often reduces last-minute spikes.",
|
|
137
|
+
},
|
|
138
|
+
"compliance-by-category": {
|
|
139
|
+
headline: "Workload clusters in a few categories",
|
|
140
|
+
explanation:
|
|
141
|
+
"Heavy bars in one or two categories usually signal template or training gaps—not random noise. Leo can help outline how to spread load or simplify the noisiest obligation types.",
|
|
142
|
+
},
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export function loadComplianceDashboardLayout(): DashboardLayout | null {
|
|
146
|
+
const v = loadDataViewLayout("compliance")
|
|
147
|
+
if (!v) return null
|
|
148
|
+
return {
|
|
149
|
+
visible: v.visible,
|
|
150
|
+
order: v.order,
|
|
151
|
+
spans: v.spans,
|
|
152
|
+
chartTypes: v.chartTypes as Record<string, ChartType> | undefined,
|
|
153
|
+
keyMetricsKpiCount: v.keyMetricsKpiCount,
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export function mergeComplianceDashboardLayout(saved: DashboardLayout | null): DashboardLayout {
|
|
158
|
+
const defaults = {
|
|
159
|
+
visible: [...DEFAULT_COMPLIANCE_VISIBLE_CARDS],
|
|
160
|
+
order: ALL_COMPLIANCE_DASHBOARD_CARDS.map(c => c.id),
|
|
161
|
+
spans: { ...DEFAULT_COMPLIANCE_SPANS },
|
|
162
|
+
chartTypes: { ...DEFAULT_COMPLIANCE_CHART_TYPES } as Record<string, string>,
|
|
163
|
+
keyMetricsKpiCount: KEY_METRICS_KPI_COUNT_DEFAULT,
|
|
164
|
+
}
|
|
165
|
+
const ids = ALL_COMPLIANCE_DASHBOARD_CARDS.map(c => c.id)
|
|
166
|
+
const m = mergeDashboardLayoutGeneric(saved, defaults, ids)
|
|
167
|
+
return {
|
|
168
|
+
visible: m.visible,
|
|
169
|
+
order: m.order,
|
|
170
|
+
spans: m.spans as Record<string, 1 | 2>,
|
|
171
|
+
chartTypes: m.chartTypes as Record<string, ChartType>,
|
|
172
|
+
keyMetricsKpiCount: m.keyMetricsKpiCount,
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export function saveComplianceDashboardLayout(layout: DashboardLayout) {
|
|
177
|
+
saveDataViewLayout("compliance", {
|
|
178
|
+
visible: layout.visible,
|
|
179
|
+
order: layout.order,
|
|
180
|
+
spans: layout.spans,
|
|
181
|
+
chartTypes: layout.chartTypes as Record<string, string> | undefined,
|
|
182
|
+
keyMetricsKpiCount: layout.keyMetricsKpiCount,
|
|
183
|
+
})
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function EmptyChart({ message = "No items in this view." }: { message?: string }) {
|
|
187
|
+
return (
|
|
188
|
+
<div className="flex h-[200px] items-center justify-center text-sm text-muted-foreground" role="status">
|
|
189
|
+
{message}
|
|
190
|
+
</div>
|
|
191
|
+
)
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
const PIE_FILLS = [
|
|
195
|
+
"var(--color-chart-1)",
|
|
196
|
+
"var(--color-chart-2)",
|
|
197
|
+
"var(--color-chart-3)",
|
|
198
|
+
"var(--color-chart-4)",
|
|
199
|
+
"var(--color-chart-5)",
|
|
200
|
+
]
|
|
201
|
+
|
|
202
|
+
function ComplianceByStatusChart({ rows, chartType }: { rows: ComplianceItem[]; chartType: ChartType }) {
|
|
203
|
+
const byStatus = React.useMemo(() => {
|
|
204
|
+
const c = { compliant: 0, due_soon: 0, overdue: 0, pending: 0 }
|
|
205
|
+
for (const r of rows) c[r.status]++
|
|
206
|
+
return [
|
|
207
|
+
{ name: "Compliant", value: c.compliant },
|
|
208
|
+
{ name: "Due soon", value: c.due_soon },
|
|
209
|
+
{ name: "Overdue", value: c.overdue },
|
|
210
|
+
{ name: "Pending", value: c.pending },
|
|
211
|
+
]
|
|
212
|
+
}, [rows])
|
|
213
|
+
|
|
214
|
+
if (rows.length === 0) return <EmptyChart />
|
|
215
|
+
|
|
216
|
+
const statusSummary = `Compliance status: ${byStatus.map(d => `${d.name} ${d.value}`).join(", ")}. Total ${rows.length} items.`
|
|
217
|
+
|
|
218
|
+
if (chartType === "pie") {
|
|
219
|
+
return (
|
|
220
|
+
<ChartFigure label="Items by status" summary={statusSummary} dataLength={byStatus.length}>
|
|
221
|
+
{(activeIndex) => (
|
|
222
|
+
<>
|
|
223
|
+
<ChartContainer config={STATUS_CFG} className="mx-auto aspect-square max-h-[220px] w-full">
|
|
224
|
+
<PieChart>
|
|
225
|
+
<ChartTooltip key={chartTooltipKeyboardSyncProps(activeIndex).key} {...chartTooltipKeyboardSyncProps(activeIndex).props} content={<ChartTooltipContent />} />
|
|
226
|
+
<Pie
|
|
227
|
+
data={byStatus}
|
|
228
|
+
dataKey="value"
|
|
229
|
+
nameKey="name"
|
|
230
|
+
innerRadius={48}
|
|
231
|
+
outerRadius={80}
|
|
232
|
+
strokeWidth={2}
|
|
233
|
+
stroke="var(--card)"
|
|
234
|
+
activeIndex={activeIndex ?? undefined}
|
|
235
|
+
activeShape={CHART_KBD_ACTIVE_PIE_SHAPE}
|
|
236
|
+
>
|
|
237
|
+
{byStatus.map((_, i) => (
|
|
238
|
+
<Cell key={i} fill={PIE_FILLS[i % PIE_FILLS.length]} />
|
|
239
|
+
))}
|
|
240
|
+
</Pie>
|
|
241
|
+
</PieChart>
|
|
242
|
+
</ChartContainer>
|
|
243
|
+
<ChartDataTable
|
|
244
|
+
caption="Items by status"
|
|
245
|
+
headers={["Status", "Count"]}
|
|
246
|
+
rows={byStatus.map(d => [d.name, d.value])}
|
|
247
|
+
/>
|
|
248
|
+
</>
|
|
249
|
+
)}
|
|
250
|
+
</ChartFigure>
|
|
251
|
+
)
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
if (chartType === "horizontal-bar") {
|
|
255
|
+
return (
|
|
256
|
+
<ChartFigure label="Items by status" summary={statusSummary} dataLength={byStatus.length}>
|
|
257
|
+
{(activeIndex) => (
|
|
258
|
+
<>
|
|
259
|
+
<ChartContainer config={STATUS_CFG} className="h-[220px] w-full">
|
|
260
|
+
<BarChart data={byStatus} layout="vertical" margin={CHART_MARGIN}>
|
|
261
|
+
<CartesianGrid horizontal={false} strokeDasharray="3 3" className="stroke-border" />
|
|
262
|
+
<XAxis type="number" allowDecimals={false} tick={{ fontSize: 11 }} tickLine={false} axisLine={false} />
|
|
263
|
+
<YAxis type="category" dataKey="name" width={88} tick={{ fontSize: 11 }} tickLine={false} axisLine={false} />
|
|
264
|
+
<ChartTooltip key={chartTooltipKeyboardSyncProps(activeIndex).key} {...chartTooltipKeyboardSyncProps(activeIndex).props} content={<ChartTooltipContent />} />
|
|
265
|
+
<Bar
|
|
266
|
+
dataKey="value"
|
|
267
|
+
fill="var(--color-chart-2)"
|
|
268
|
+
radius={[0, 4, 4, 0]}
|
|
269
|
+
maxBarSize={22}
|
|
270
|
+
activeBar={CHART_KBD_ACTIVE_BAR}
|
|
271
|
+
activeIndex={activeIndex ?? undefined}
|
|
272
|
+
>
|
|
273
|
+
{byStatus.map((_, i) => (
|
|
274
|
+
<Cell key={i} fill="var(--color-chart-2)" />
|
|
275
|
+
))}
|
|
276
|
+
</Bar>
|
|
277
|
+
</BarChart>
|
|
278
|
+
</ChartContainer>
|
|
279
|
+
<ChartDataTable
|
|
280
|
+
caption="Items by status"
|
|
281
|
+
headers={["Status", "Count"]}
|
|
282
|
+
rows={byStatus.map(d => [d.name, d.value])}
|
|
283
|
+
/>
|
|
284
|
+
</>
|
|
285
|
+
)}
|
|
286
|
+
</ChartFigure>
|
|
287
|
+
)
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
return (
|
|
291
|
+
<ChartFigure label="Items by status" summary={statusSummary} dataLength={byStatus.length}>
|
|
292
|
+
{(activeIndex) => (
|
|
293
|
+
<>
|
|
294
|
+
<ChartContainer config={STATUS_CFG} className="h-[220px] w-full">
|
|
295
|
+
<BarChart data={byStatus} margin={CHART_MARGIN}>
|
|
296
|
+
<CartesianGrid vertical={false} strokeDasharray="3 3" className="stroke-border" />
|
|
297
|
+
<XAxis dataKey="name" tick={{ fontSize: 11 }} tickLine={false} axisLine={false} />
|
|
298
|
+
<YAxis allowDecimals={false} width={32} tick={{ fontSize: 12 }} tickLine={false} axisLine={false} />
|
|
299
|
+
<ChartTooltip key={chartTooltipKeyboardSyncProps(activeIndex).key} {...chartTooltipKeyboardSyncProps(activeIndex).props} content={<ChartTooltipContent />} />
|
|
300
|
+
<Bar
|
|
301
|
+
dataKey="value"
|
|
302
|
+
fill="var(--color-chart-2)"
|
|
303
|
+
radius={[4, 4, 0, 0]}
|
|
304
|
+
maxBarSize={40}
|
|
305
|
+
activeBar={CHART_KBD_ACTIVE_BAR}
|
|
306
|
+
activeIndex={activeIndex ?? undefined}
|
|
307
|
+
>
|
|
308
|
+
{byStatus.map((_, i) => (
|
|
309
|
+
<Cell key={i} fill="var(--color-chart-2)" />
|
|
310
|
+
))}
|
|
311
|
+
</Bar>
|
|
312
|
+
</BarChart>
|
|
313
|
+
</ChartContainer>
|
|
314
|
+
<ChartDataTable
|
|
315
|
+
caption="Items by status"
|
|
316
|
+
headers={["Status", "Count"]}
|
|
317
|
+
rows={byStatus.map(d => [d.name, d.value])}
|
|
318
|
+
/>
|
|
319
|
+
</>
|
|
320
|
+
)}
|
|
321
|
+
</ChartFigure>
|
|
322
|
+
)
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
function ComplianceByCategoryChart({ rows, chartType }: { rows: ComplianceItem[]; chartType: ChartType }) {
|
|
326
|
+
const byCategory = React.useMemo(() => {
|
|
327
|
+
const map = new Map<string, number>()
|
|
328
|
+
for (const r of rows) map.set(r.category, (map.get(r.category) ?? 0) + 1)
|
|
329
|
+
return [...map.entries()]
|
|
330
|
+
.map(([name, value]) => ({ name: name.length > 24 ? `${name.slice(0, 22)}…` : name, value }))
|
|
331
|
+
.sort((a, b) => b.value - a.value)
|
|
332
|
+
}, [rows])
|
|
333
|
+
|
|
334
|
+
if (rows.length === 0) return <EmptyChart />
|
|
335
|
+
|
|
336
|
+
const categorySummary = `${byCategory.length} categories. Total ${rows.length} items.`
|
|
337
|
+
|
|
338
|
+
if (chartType === "pie") {
|
|
339
|
+
return (
|
|
340
|
+
<ChartFigure label="Items by category" summary={categorySummary} dataLength={byCategory.length}>
|
|
341
|
+
{(activeIndex) => (
|
|
342
|
+
<>
|
|
343
|
+
<ChartContainer config={CAT_CFG} className="mx-auto aspect-square max-h-[220px] w-full">
|
|
344
|
+
<PieChart>
|
|
345
|
+
<ChartTooltip key={chartTooltipKeyboardSyncProps(activeIndex).key} {...chartTooltipKeyboardSyncProps(activeIndex).props} content={<ChartTooltipContent />} />
|
|
346
|
+
<Pie
|
|
347
|
+
data={byCategory}
|
|
348
|
+
dataKey="value"
|
|
349
|
+
nameKey="name"
|
|
350
|
+
innerRadius={48}
|
|
351
|
+
outerRadius={80}
|
|
352
|
+
strokeWidth={2}
|
|
353
|
+
stroke="var(--card)"
|
|
354
|
+
activeIndex={activeIndex ?? undefined}
|
|
355
|
+
activeShape={CHART_KBD_ACTIVE_PIE_SHAPE}
|
|
356
|
+
>
|
|
357
|
+
{byCategory.map((_, i) => (
|
|
358
|
+
<Cell key={i} fill={PIE_FILLS[i % PIE_FILLS.length]} />
|
|
359
|
+
))}
|
|
360
|
+
</Pie>
|
|
361
|
+
</PieChart>
|
|
362
|
+
</ChartContainer>
|
|
363
|
+
<ChartDataTable
|
|
364
|
+
caption="Items by category"
|
|
365
|
+
headers={["Category", "Count"]}
|
|
366
|
+
rows={byCategory.map(d => [d.name, d.value])}
|
|
367
|
+
/>
|
|
368
|
+
</>
|
|
369
|
+
)}
|
|
370
|
+
</ChartFigure>
|
|
371
|
+
)
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
if (chartType === "bar") {
|
|
375
|
+
return (
|
|
376
|
+
<ChartFigure label="Items by category" summary={categorySummary} dataLength={byCategory.length}>
|
|
377
|
+
{(activeIndex) => (
|
|
378
|
+
<>
|
|
379
|
+
<ChartContainer config={CAT_CFG} className="h-[220px] w-full">
|
|
380
|
+
<BarChart data={byCategory} margin={CHART_MARGIN}>
|
|
381
|
+
<CartesianGrid vertical={false} strokeDasharray="3 3" className="stroke-border" />
|
|
382
|
+
<XAxis dataKey="name" tick={{ fontSize: 11 }} tickLine={false} axisLine={false} />
|
|
383
|
+
<YAxis allowDecimals={false} width={32} tick={{ fontSize: 12 }} tickLine={false} axisLine={false} />
|
|
384
|
+
<ChartTooltip key={chartTooltipKeyboardSyncProps(activeIndex).key} {...chartTooltipKeyboardSyncProps(activeIndex).props} content={<ChartTooltipContent />} />
|
|
385
|
+
<Bar
|
|
386
|
+
dataKey="value"
|
|
387
|
+
fill="var(--color-chart-4)"
|
|
388
|
+
radius={[4, 4, 0, 0]}
|
|
389
|
+
maxBarSize={40}
|
|
390
|
+
activeBar={CHART_KBD_ACTIVE_BAR}
|
|
391
|
+
activeIndex={activeIndex ?? undefined}
|
|
392
|
+
>
|
|
393
|
+
{byCategory.map((_, i) => (
|
|
394
|
+
<Cell key={i} fill="var(--color-chart-4)" />
|
|
395
|
+
))}
|
|
396
|
+
</Bar>
|
|
397
|
+
</BarChart>
|
|
398
|
+
</ChartContainer>
|
|
399
|
+
<ChartDataTable
|
|
400
|
+
caption="Items by category"
|
|
401
|
+
headers={["Category", "Count"]}
|
|
402
|
+
rows={byCategory.map(d => [d.name, d.value])}
|
|
403
|
+
/>
|
|
404
|
+
</>
|
|
405
|
+
)}
|
|
406
|
+
</ChartFigure>
|
|
407
|
+
)
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
return (
|
|
411
|
+
<ChartFigure label="Items by category" summary={categorySummary} dataLength={byCategory.length}>
|
|
412
|
+
{(activeIndex) => (
|
|
413
|
+
<>
|
|
414
|
+
<ChartContainer config={CAT_CFG} className="h-[220px] w-full">
|
|
415
|
+
<BarChart data={byCategory} layout="vertical" margin={CHART_MARGIN_HORIZONTAL}>
|
|
416
|
+
<CartesianGrid horizontal={false} strokeDasharray="3 3" className="stroke-border" />
|
|
417
|
+
<XAxis type="number" allowDecimals={false} tick={{ fontSize: 12 }} tickLine={false} axisLine={false} />
|
|
418
|
+
<YAxis type="category" dataKey="name" width={100} tick={{ fontSize: 11 }} tickLine={false} axisLine={false} />
|
|
419
|
+
<ChartTooltip key={chartTooltipKeyboardSyncProps(activeIndex).key} {...chartTooltipKeyboardSyncProps(activeIndex).props} content={<ChartTooltipContent />} />
|
|
420
|
+
<Bar
|
|
421
|
+
dataKey="value"
|
|
422
|
+
fill="var(--color-chart-4)"
|
|
423
|
+
radius={[0, 4, 4, 0]}
|
|
424
|
+
maxBarSize={22}
|
|
425
|
+
activeBar={CHART_KBD_ACTIVE_BAR}
|
|
426
|
+
activeIndex={activeIndex ?? undefined}
|
|
427
|
+
>
|
|
428
|
+
{byCategory.map((_, i) => (
|
|
429
|
+
<Cell key={i} fill="var(--color-chart-4)" />
|
|
430
|
+
))}
|
|
431
|
+
</Bar>
|
|
432
|
+
</BarChart>
|
|
433
|
+
</ChartContainer>
|
|
434
|
+
<ChartDataTable
|
|
435
|
+
caption="Items by category"
|
|
436
|
+
headers={["Category", "Count"]}
|
|
437
|
+
rows={byCategory.map(d => [d.name, d.value])}
|
|
438
|
+
/>
|
|
439
|
+
</>
|
|
440
|
+
)}
|
|
441
|
+
</ChartFigure>
|
|
442
|
+
)
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
const COMPLIANCE_CHART_RENDERERS: Record<string, React.FC<{ rows: ComplianceItem[]; chartType: ChartType }>> = {
|
|
446
|
+
"compliance-by-status": ComplianceByStatusChart,
|
|
447
|
+
"compliance-by-category": ComplianceByCategoryChart,
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
function SortableComplianceDashboardCard({
|
|
451
|
+
card,
|
|
452
|
+
rows,
|
|
453
|
+
span,
|
|
454
|
+
chartType,
|
|
455
|
+
cardIndex,
|
|
456
|
+
totalCards,
|
|
457
|
+
onSpanChange,
|
|
458
|
+
onChartTypeChange,
|
|
459
|
+
onRemove,
|
|
460
|
+
onMoveStep,
|
|
461
|
+
keyMetrics,
|
|
462
|
+
keyMetricsKpiCount,
|
|
463
|
+
onKeyMetricsKpiCountChange,
|
|
464
|
+
}: {
|
|
465
|
+
card: ComplianceDashboardCardDef
|
|
466
|
+
rows: ComplianceItem[]
|
|
467
|
+
span: 1 | 2
|
|
468
|
+
chartType: ChartType
|
|
469
|
+
cardIndex: number
|
|
470
|
+
totalCards: number
|
|
471
|
+
onSpanChange: (id: string, span: 1 | 2) => void
|
|
472
|
+
onChartTypeChange: (id: string, t: ChartType) => void
|
|
473
|
+
onRemove: (id: string) => void
|
|
474
|
+
onMoveStep: (direction: -1 | 1) => void
|
|
475
|
+
keyMetrics?: { metrics: MetricItem[]; insight: MetricInsight } | null
|
|
476
|
+
keyMetricsKpiCount: number
|
|
477
|
+
onKeyMetricsKpiCountChange?: (n: number) => void
|
|
478
|
+
}) {
|
|
479
|
+
const {
|
|
480
|
+
attributes,
|
|
481
|
+
listeners,
|
|
482
|
+
setNodeRef,
|
|
483
|
+
setActivatorNodeRef,
|
|
484
|
+
transform,
|
|
485
|
+
transition,
|
|
486
|
+
isDragging,
|
|
487
|
+
} = useSortable({ id: card.id })
|
|
488
|
+
const { chartVariant } = useChartVariant()
|
|
489
|
+
|
|
490
|
+
const style: React.CSSProperties = {
|
|
491
|
+
...(transform ? { transform: CSS.Transform.toString(transform) } : {}),
|
|
492
|
+
transition,
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
const isKeyMetrics = card.id === KEY_METRICS_CARD_ID
|
|
496
|
+
const Renderer = isKeyMetrics ? null : COMPLIANCE_CHART_RENDERERS[card.id]
|
|
497
|
+
if (!isKeyMetrics && !Renderer) return null
|
|
498
|
+
if (isKeyMetrics && !keyMetrics) return null
|
|
499
|
+
|
|
500
|
+
const canMoveEarlier = cardIndex > 0
|
|
501
|
+
const canMoveLater = cardIndex < totalCards - 1
|
|
502
|
+
const chartLeoInsight = COMPLIANCE_CHART_LEO_INSIGHTS[card.id]
|
|
503
|
+
|
|
504
|
+
return (
|
|
505
|
+
<div
|
|
506
|
+
ref={setNodeRef}
|
|
507
|
+
style={style}
|
|
508
|
+
className={cn(
|
|
509
|
+
"group flex min-h-0 w-full min-w-0 flex-col self-start rounded-xl border-2 border-dashed border-border bg-transparent p-2",
|
|
510
|
+
span === 2 ? "lg:col-span-2" : undefined,
|
|
511
|
+
isDragging && "z-20 opacity-95 ring-2 ring-ring",
|
|
512
|
+
)}
|
|
513
|
+
>
|
|
514
|
+
<div className="mb-2 flex w-full min-w-0 flex-wrap items-center gap-2" role="toolbar" aria-label={`${card.title} layout controls`}>
|
|
515
|
+
<div className="flex min-w-0 flex-1 flex-wrap items-center gap-2">
|
|
516
|
+
<Tip label="Drag to reorder" side="top">
|
|
517
|
+
<button
|
|
518
|
+
type="button"
|
|
519
|
+
ref={setActivatorNodeRef}
|
|
520
|
+
className="inline-flex size-8 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
|
521
|
+
aria-label={`Drag to reorder ${card.title}`}
|
|
522
|
+
{...attributes}
|
|
523
|
+
{...listeners}
|
|
524
|
+
>
|
|
525
|
+
<DragHandleGripIcon className="text-[15px]" />
|
|
526
|
+
</button>
|
|
527
|
+
</Tip>
|
|
528
|
+
{card.chartTypes.length > 0 ? (
|
|
529
|
+
<ViewSegmentedControl
|
|
530
|
+
aria-label={`Chart type for ${card.title}`}
|
|
531
|
+
iconOnly
|
|
532
|
+
value={chartType}
|
|
533
|
+
onValueChange={v => onChartTypeChange(card.id, v as ChartType)}
|
|
534
|
+
options={card.chartTypes.map(opt => ({
|
|
535
|
+
value: opt.type,
|
|
536
|
+
label: opt.label,
|
|
537
|
+
icon: opt.icon,
|
|
538
|
+
}))}
|
|
539
|
+
/>
|
|
540
|
+
) : null}
|
|
541
|
+
{isKeyMetrics && onKeyMetricsKpiCountChange ? (
|
|
542
|
+
<ViewSegmentedControl
|
|
543
|
+
aria-label="Number of KPIs to show"
|
|
544
|
+
iconOnly={false}
|
|
545
|
+
value={String(keyMetricsKpiCount)}
|
|
546
|
+
onValueChange={v => onKeyMetricsKpiCountChange(Number(v))}
|
|
547
|
+
options={Array.from(
|
|
548
|
+
{ length: KEY_METRICS_KPI_COUNT_MAX - KEY_METRICS_KPI_COUNT_MIN + 1 },
|
|
549
|
+
(_, i) => {
|
|
550
|
+
const n = KEY_METRICS_KPI_COUNT_MIN + i
|
|
551
|
+
return { value: String(n), label: String(n) }
|
|
552
|
+
},
|
|
553
|
+
)}
|
|
554
|
+
/>
|
|
555
|
+
) : null}
|
|
556
|
+
<ViewSegmentedControl
|
|
557
|
+
aria-label={`Width for ${card.title}`}
|
|
558
|
+
iconOnly
|
|
559
|
+
value={String(span) as "1" | "2"}
|
|
560
|
+
onValueChange={v => onSpanChange(card.id, Number(v) as 1 | 2)}
|
|
561
|
+
options={[
|
|
562
|
+
{ value: "1", label: "Half width", icon: "fa-light fa-table-columns" },
|
|
563
|
+
{ value: "2", label: "Full width (all columns)", icon: "fa-light fa-maximize" },
|
|
564
|
+
]}
|
|
565
|
+
/>
|
|
566
|
+
</div>
|
|
567
|
+
<div className="ms-auto flex shrink-0 items-center gap-1">
|
|
568
|
+
<div
|
|
569
|
+
className="pointer-events-none flex items-center gap-0.5 opacity-0 transition-opacity duration-150 group-hover:pointer-events-auto group-hover:opacity-100 group-focus-within:pointer-events-auto group-focus-within:opacity-100"
|
|
570
|
+
role="group"
|
|
571
|
+
aria-label={`Reorder ${card.title}`}
|
|
572
|
+
>
|
|
573
|
+
<div className="flex items-center gap-0.5 lg:hidden">
|
|
574
|
+
<Tip label="Move up" side="top">
|
|
575
|
+
<Button
|
|
576
|
+
type="button"
|
|
577
|
+
variant="ghost"
|
|
578
|
+
size="icon-sm"
|
|
579
|
+
className="size-7 shrink-0"
|
|
580
|
+
disabled={!canMoveEarlier}
|
|
581
|
+
aria-label={`Move ${card.title} up`}
|
|
582
|
+
onClick={() => onMoveStep(-1)}
|
|
583
|
+
>
|
|
584
|
+
<i className="fa-light fa-chevron-up text-xs" aria-hidden="true" />
|
|
585
|
+
</Button>
|
|
586
|
+
</Tip>
|
|
587
|
+
<Tip label="Move down" side="top">
|
|
588
|
+
<Button
|
|
589
|
+
type="button"
|
|
590
|
+
variant="ghost"
|
|
591
|
+
size="icon-sm"
|
|
592
|
+
className="size-7 shrink-0"
|
|
593
|
+
disabled={!canMoveLater}
|
|
594
|
+
aria-label={`Move ${card.title} down`}
|
|
595
|
+
onClick={() => onMoveStep(1)}
|
|
596
|
+
>
|
|
597
|
+
<i className="fa-light fa-chevron-down text-xs" aria-hidden="true" />
|
|
598
|
+
</Button>
|
|
599
|
+
</Tip>
|
|
600
|
+
</div>
|
|
601
|
+
<div className="hidden items-center gap-0.5 lg:flex">
|
|
602
|
+
<Tip label="Move left" side="top">
|
|
603
|
+
<Button
|
|
604
|
+
type="button"
|
|
605
|
+
variant="ghost"
|
|
606
|
+
size="icon-sm"
|
|
607
|
+
className="size-7 shrink-0"
|
|
608
|
+
disabled={!canMoveEarlier}
|
|
609
|
+
aria-label={`Move ${card.title} left`}
|
|
610
|
+
onClick={() => onMoveStep(-1)}
|
|
611
|
+
>
|
|
612
|
+
<i className="fa-light fa-chevron-left text-xs" aria-hidden="true" />
|
|
613
|
+
</Button>
|
|
614
|
+
</Tip>
|
|
615
|
+
<Tip label="Move right" side="top">
|
|
616
|
+
<Button
|
|
617
|
+
type="button"
|
|
618
|
+
variant="ghost"
|
|
619
|
+
size="icon-sm"
|
|
620
|
+
className="size-7 shrink-0"
|
|
621
|
+
disabled={!canMoveLater}
|
|
622
|
+
aria-label={`Move ${card.title} right`}
|
|
623
|
+
onClick={() => onMoveStep(1)}
|
|
624
|
+
>
|
|
625
|
+
<i className="fa-light fa-chevron-right text-xs" aria-hidden="true" />
|
|
626
|
+
</Button>
|
|
627
|
+
</Tip>
|
|
628
|
+
</div>
|
|
629
|
+
</div>
|
|
630
|
+
<Tip label={`Remove ${card.title}`} side="top">
|
|
631
|
+
<Button
|
|
632
|
+
type="button"
|
|
633
|
+
variant="ghost"
|
|
634
|
+
size="icon-sm"
|
|
635
|
+
className="size-8 shrink-0 text-muted-foreground hover:text-destructive"
|
|
636
|
+
aria-label={`Remove ${card.title} from dashboard`}
|
|
637
|
+
onClick={() => onRemove(card.id)}
|
|
638
|
+
>
|
|
639
|
+
<i className="fa-light fa-trash text-[13px]" aria-hidden="true" />
|
|
640
|
+
</Button>
|
|
641
|
+
</Tip>
|
|
642
|
+
</div>
|
|
643
|
+
</div>
|
|
644
|
+
{isKeyMetrics && keyMetrics ? (
|
|
645
|
+
<KeyMetrics
|
|
646
|
+
variant="card"
|
|
647
|
+
title={card.title}
|
|
648
|
+
description={card.description}
|
|
649
|
+
metrics={keyMetrics.metrics.slice(0, keyMetricsKpiCount)}
|
|
650
|
+
insight={keyMetrics.insight}
|
|
651
|
+
metricsSingleRow
|
|
652
|
+
metricsHalfWidthLayout={span === 1}
|
|
653
|
+
className="w-full min-w-0"
|
|
654
|
+
/>
|
|
655
|
+
) : (
|
|
656
|
+
<ChartCard
|
|
657
|
+
variant={chartVariant}
|
|
658
|
+
title={card.title}
|
|
659
|
+
description={card.description}
|
|
660
|
+
className="!h-auto min-h-0 shrink-0"
|
|
661
|
+
leoInsight={chartLeoInsight}
|
|
662
|
+
>
|
|
663
|
+
{Renderer ? <Renderer rows={rows} chartType={chartType} /> : null}
|
|
664
|
+
</ChartCard>
|
|
665
|
+
)}
|
|
666
|
+
</div>
|
|
667
|
+
)
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
export interface ComplianceDashboardChartsSectionProps {
|
|
671
|
+
rows: ComplianceItem[]
|
|
672
|
+
keyMetrics: { metrics: MetricItem[]; insight: MetricInsight }
|
|
673
|
+
visibleCards: string[]
|
|
674
|
+
cardOrder: string[]
|
|
675
|
+
cardSpans?: Record<string, 1 | 2>
|
|
676
|
+
cardChartTypes?: Record<string, ChartType>
|
|
677
|
+
keyMetricsKpiCount?: number
|
|
678
|
+
layoutEditMode?: boolean
|
|
679
|
+
onVisibleChange?: (visible: string[]) => void
|
|
680
|
+
onOrderChange?: (order: string[]) => void
|
|
681
|
+
onSpanChange?: (id: string, span: 1 | 2) => void
|
|
682
|
+
onChartTypeChange?: (id: string, chartType: ChartType) => void
|
|
683
|
+
onKeyMetricsKpiCountChange?: (count: number) => void
|
|
684
|
+
onResetLayout?: () => void
|
|
685
|
+
onLayoutEditDone?: () => void
|
|
686
|
+
onLayoutEditCancel?: () => void
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
export function ComplianceDashboardChartsSection({
|
|
690
|
+
rows,
|
|
691
|
+
keyMetrics,
|
|
692
|
+
visibleCards,
|
|
693
|
+
cardOrder,
|
|
694
|
+
cardSpans = DEFAULT_COMPLIANCE_SPANS,
|
|
695
|
+
cardChartTypes = DEFAULT_COMPLIANCE_CHART_TYPES,
|
|
696
|
+
keyMetricsKpiCount = KEY_METRICS_KPI_COUNT_DEFAULT,
|
|
697
|
+
layoutEditMode = false,
|
|
698
|
+
onVisibleChange,
|
|
699
|
+
onOrderChange,
|
|
700
|
+
onSpanChange,
|
|
701
|
+
onChartTypeChange,
|
|
702
|
+
onKeyMetricsKpiCountChange,
|
|
703
|
+
onResetLayout,
|
|
704
|
+
onLayoutEditDone,
|
|
705
|
+
onLayoutEditCancel,
|
|
706
|
+
}: ComplianceDashboardChartsSectionProps) {
|
|
707
|
+
const { chartVariant } = useChartVariant()
|
|
708
|
+
const defs = React.useMemo(() => new Map(ALL_COMPLIANCE_DASHBOARD_CARDS.map(c => [c.id, c])), [])
|
|
709
|
+
|
|
710
|
+
const orderedCards = React.useMemo(() => {
|
|
711
|
+
return cardOrder
|
|
712
|
+
.filter(id => visibleCards.includes(id) && defs.has(id))
|
|
713
|
+
.map(id => defs.get(id)!)
|
|
714
|
+
}, [visibleCards, cardOrder, defs])
|
|
715
|
+
|
|
716
|
+
const hiddenCardDefs = React.useMemo(
|
|
717
|
+
() => ALL_COMPLIANCE_DASHBOARD_CARDS.filter(c => !visibleCards.includes(c.id)),
|
|
718
|
+
[visibleCards],
|
|
719
|
+
)
|
|
720
|
+
|
|
721
|
+
const sortableIds = React.useMemo(() => orderedCards.map(c => c.id), [orderedCards])
|
|
722
|
+
|
|
723
|
+
const sensors = useSensors(
|
|
724
|
+
useSensor(PointerSensor, { activationConstraint: { distance: 8 } }),
|
|
725
|
+
useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates }),
|
|
726
|
+
)
|
|
727
|
+
|
|
728
|
+
const handleDragEnd = React.useCallback(
|
|
729
|
+
(event: DragEndEvent) => {
|
|
730
|
+
if (!onOrderChange) return
|
|
731
|
+
const { active, over } = event
|
|
732
|
+
if (!over || active.id === over.id) return
|
|
733
|
+
const oldIndex = sortableIds.indexOf(String(active.id))
|
|
734
|
+
const newIndex = sortableIds.indexOf(String(over.id))
|
|
735
|
+
if (oldIndex < 0 || newIndex < 0) return
|
|
736
|
+
const nextVisibleOrder = arrayMove(sortableIds, oldIndex, newIndex)
|
|
737
|
+
const visibleSet = new Set(visibleCards)
|
|
738
|
+
onOrderChange(applyVisibleReorder(cardOrder, visibleSet, nextVisibleOrder))
|
|
739
|
+
},
|
|
740
|
+
[cardOrder, onOrderChange, sortableIds, visibleCards],
|
|
741
|
+
)
|
|
742
|
+
|
|
743
|
+
const moveStep = React.useCallback(
|
|
744
|
+
(id: string, direction: -1 | 1) => {
|
|
745
|
+
if (!onOrderChange) return
|
|
746
|
+
const idx = sortableIds.indexOf(id)
|
|
747
|
+
if (idx < 0) return
|
|
748
|
+
const newIdx = idx + direction
|
|
749
|
+
if (newIdx < 0 || newIdx >= sortableIds.length) return
|
|
750
|
+
const nextVisibleOrder = arrayMove(sortableIds, idx, newIdx)
|
|
751
|
+
const visibleSet = new Set(visibleCards)
|
|
752
|
+
onOrderChange(applyVisibleReorder(cardOrder, visibleSet, nextVisibleOrder))
|
|
753
|
+
},
|
|
754
|
+
[cardOrder, onOrderChange, sortableIds, visibleCards],
|
|
755
|
+
)
|
|
756
|
+
|
|
757
|
+
const addCard = React.useCallback(
|
|
758
|
+
(id: string) => {
|
|
759
|
+
if (!onVisibleChange) return
|
|
760
|
+
if (visibleCards.includes(id)) return
|
|
761
|
+
onVisibleChange([...visibleCards, id])
|
|
762
|
+
},
|
|
763
|
+
[onVisibleChange, visibleCards],
|
|
764
|
+
)
|
|
765
|
+
|
|
766
|
+
const removeCard = React.useCallback(
|
|
767
|
+
(id: string) => {
|
|
768
|
+
if (!onVisibleChange) return
|
|
769
|
+
onVisibleChange(visibleCards.filter(v => v !== id))
|
|
770
|
+
},
|
|
771
|
+
[onVisibleChange, visibleCards],
|
|
772
|
+
)
|
|
773
|
+
|
|
774
|
+
if (orderedCards.length === 0) {
|
|
775
|
+
return (
|
|
776
|
+
<div className="flex flex-col items-center justify-center gap-3 px-4 py-12 text-center lg:px-6">
|
|
777
|
+
<i className="fa-light fa-chart-column text-2xl text-muted-foreground/40" aria-hidden="true" />
|
|
778
|
+
<p className="text-sm text-muted-foreground">
|
|
779
|
+
No widgets on the dashboard.
|
|
780
|
+
{layoutEditMode && hiddenCardDefs.length > 0 ? " Add a widget below." : " Turn on Edit layout and add widgets back."}
|
|
781
|
+
</p>
|
|
782
|
+
{layoutEditMode && hiddenCardDefs.length > 0 && onVisibleChange ? (
|
|
783
|
+
<DropdownMenu>
|
|
784
|
+
<DropdownMenuTrigger asChild>
|
|
785
|
+
<Button type="button" variant="outline" size="sm" className="size-9 p-0" aria-label="Add widget">
|
|
786
|
+
<i className="fa-light fa-plus text-sm" aria-hidden="true" />
|
|
787
|
+
</Button>
|
|
788
|
+
</DropdownMenuTrigger>
|
|
789
|
+
<DropdownMenuContent align="center">
|
|
790
|
+
{hiddenCardDefs.map(c => (
|
|
791
|
+
<DropdownMenuItem key={c.id} onSelect={() => addCard(c.id)}>
|
|
792
|
+
{c.title}
|
|
793
|
+
</DropdownMenuItem>
|
|
794
|
+
))}
|
|
795
|
+
</DropdownMenuContent>
|
|
796
|
+
</DropdownMenu>
|
|
797
|
+
) : null}
|
|
798
|
+
</div>
|
|
799
|
+
)
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
const grid = (
|
|
803
|
+
<div
|
|
804
|
+
className={cn(
|
|
805
|
+
"grid grid-cols-1 gap-4 lg:grid-cols-2",
|
|
806
|
+
layoutEditMode && "lg:items-start lg:content-start lg:auto-rows-min",
|
|
807
|
+
)}
|
|
808
|
+
>
|
|
809
|
+
{orderedCards.map((card, cardIndex) => {
|
|
810
|
+
const isKeyMetricsCard = card.id === KEY_METRICS_CARD_ID
|
|
811
|
+
const Renderer = isKeyMetricsCard ? null : COMPLIANCE_CHART_RENDERERS[card.id]
|
|
812
|
+
if (!isKeyMetricsCard && !Renderer) return null
|
|
813
|
+
const span = cardSpans[card.id] ?? card.defaultSpan
|
|
814
|
+
const requestedType = cardChartTypes[card.id] ?? card.defaultChartType
|
|
815
|
+
const allowedTypes = card.chartTypes.map(o => o.type)
|
|
816
|
+
const chartType =
|
|
817
|
+
allowedTypes.length === 0
|
|
818
|
+
? card.defaultChartType
|
|
819
|
+
: allowedTypes.includes(requestedType)
|
|
820
|
+
? requestedType
|
|
821
|
+
: card.defaultChartType
|
|
822
|
+
|
|
823
|
+
if (
|
|
824
|
+
layoutEditMode &&
|
|
825
|
+
onOrderChange &&
|
|
826
|
+
onSpanChange &&
|
|
827
|
+
onChartTypeChange &&
|
|
828
|
+
onVisibleChange
|
|
829
|
+
) {
|
|
830
|
+
return (
|
|
831
|
+
<SortableComplianceDashboardCard
|
|
832
|
+
key={card.id}
|
|
833
|
+
card={card}
|
|
834
|
+
rows={rows}
|
|
835
|
+
span={span}
|
|
836
|
+
chartType={chartType}
|
|
837
|
+
cardIndex={cardIndex}
|
|
838
|
+
totalCards={orderedCards.length}
|
|
839
|
+
onSpanChange={onSpanChange}
|
|
840
|
+
onChartTypeChange={onChartTypeChange}
|
|
841
|
+
onRemove={removeCard}
|
|
842
|
+
onMoveStep={dir => moveStep(card.id, dir)}
|
|
843
|
+
keyMetrics={isKeyMetricsCard ? keyMetrics : null}
|
|
844
|
+
keyMetricsKpiCount={keyMetricsKpiCount}
|
|
845
|
+
onKeyMetricsKpiCountChange={
|
|
846
|
+
isKeyMetricsCard ? onKeyMetricsKpiCountChange : undefined
|
|
847
|
+
}
|
|
848
|
+
/>
|
|
849
|
+
)
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
return (
|
|
853
|
+
<div
|
|
854
|
+
key={card.id}
|
|
855
|
+
className={cn(span === 2 ? "lg:col-span-2" : undefined)}
|
|
856
|
+
>
|
|
857
|
+
{isKeyMetricsCard ? (
|
|
858
|
+
<KeyMetrics
|
|
859
|
+
variant="card"
|
|
860
|
+
title={card.title}
|
|
861
|
+
description={card.description}
|
|
862
|
+
metrics={keyMetrics.metrics.slice(0, keyMetricsKpiCount)}
|
|
863
|
+
insight={keyMetrics.insight}
|
|
864
|
+
metricsSingleRow
|
|
865
|
+
metricsHalfWidthLayout={span === 1}
|
|
866
|
+
className="w-full min-w-0"
|
|
867
|
+
/>
|
|
868
|
+
) : (
|
|
869
|
+
<ChartCard
|
|
870
|
+
variant={chartVariant}
|
|
871
|
+
title={card.title}
|
|
872
|
+
description={card.description}
|
|
873
|
+
leoInsight={COMPLIANCE_CHART_LEO_INSIGHTS[card.id]}
|
|
874
|
+
>
|
|
875
|
+
{Renderer ? <Renderer rows={rows} chartType={chartType} /> : null}
|
|
876
|
+
</ChartCard>
|
|
877
|
+
)}
|
|
878
|
+
</div>
|
|
879
|
+
)
|
|
880
|
+
})}
|
|
881
|
+
</div>
|
|
882
|
+
)
|
|
883
|
+
|
|
884
|
+
const editToolbar =
|
|
885
|
+
layoutEditMode && onVisibleChange && onResetLayout ? (
|
|
886
|
+
<div
|
|
887
|
+
className="mb-3 flex flex-wrap items-center justify-between gap-3 rounded-lg border border-border bg-transparent px-3 py-2"
|
|
888
|
+
role="region"
|
|
889
|
+
aria-label="Dashboard layout options"
|
|
890
|
+
>
|
|
891
|
+
<p className="text-xs text-muted-foreground">Drag cards to reorder. Changes save automatically.</p>
|
|
892
|
+
<div className="flex flex-wrap items-center justify-end gap-2">
|
|
893
|
+
<Button
|
|
894
|
+
type="button"
|
|
895
|
+
size="sm"
|
|
896
|
+
variant="ghost"
|
|
897
|
+
className="h-8 text-xs"
|
|
898
|
+
onClick={() => onVisibleChange(ALL_COMPLIANCE_DASHBOARD_CARDS.map(c => c.id))}
|
|
899
|
+
>
|
|
900
|
+
Show all
|
|
901
|
+
</Button>
|
|
902
|
+
<Button type="button" size="sm" variant="ghost" className="h-8 text-xs" onClick={() => onVisibleChange([])}>
|
|
903
|
+
Hide all
|
|
904
|
+
</Button>
|
|
905
|
+
<Tip side="bottom" label="Reset visibility, order, widths, and chart types">
|
|
906
|
+
<Button type="button" size="sm" variant="ghost" className="h-8 px-2 text-xs" onClick={onResetLayout}>
|
|
907
|
+
<i className="fa-light fa-rotate-left me-1 text-xs" aria-hidden="true" />
|
|
908
|
+
Reset
|
|
909
|
+
</Button>
|
|
910
|
+
</Tip>
|
|
911
|
+
{hiddenCardDefs.length > 0 ? (
|
|
912
|
+
<DropdownMenu>
|
|
913
|
+
<DropdownMenuTrigger asChild>
|
|
914
|
+
<Button type="button" variant="outline" size="sm" className="size-8 p-0" aria-label="Add widget">
|
|
915
|
+
<i className="fa-light fa-plus text-[13px]" aria-hidden="true" />
|
|
916
|
+
</Button>
|
|
917
|
+
</DropdownMenuTrigger>
|
|
918
|
+
<DropdownMenuContent align="end">
|
|
919
|
+
{hiddenCardDefs.map(c => (
|
|
920
|
+
<DropdownMenuItem key={c.id} onSelect={() => addCard(c.id)}>
|
|
921
|
+
{c.title}
|
|
922
|
+
</DropdownMenuItem>
|
|
923
|
+
))}
|
|
924
|
+
</DropdownMenuContent>
|
|
925
|
+
</DropdownMenu>
|
|
926
|
+
) : null}
|
|
927
|
+
{onLayoutEditCancel ? (
|
|
928
|
+
<Button type="button" size="sm" variant="outline" className="h-8 text-xs" onClick={onLayoutEditCancel}>
|
|
929
|
+
Cancel
|
|
930
|
+
</Button>
|
|
931
|
+
) : null}
|
|
932
|
+
{onLayoutEditDone ? (
|
|
933
|
+
<Button type="button" size="sm" className="h-8 text-xs" onClick={onLayoutEditDone}>
|
|
934
|
+
Done
|
|
935
|
+
</Button>
|
|
936
|
+
) : null}
|
|
937
|
+
</div>
|
|
938
|
+
</div>
|
|
939
|
+
) : null
|
|
940
|
+
|
|
941
|
+
const gridBody =
|
|
942
|
+
layoutEditMode && onOrderChange ? (
|
|
943
|
+
<DndContext sensors={sensors} collisionDetection={closestCorners} onDragEnd={handleDragEnd}>
|
|
944
|
+
<SortableContext items={sortableIds} strategy={rectSortingStrategy}>
|
|
945
|
+
{grid}
|
|
946
|
+
</SortableContext>
|
|
947
|
+
</DndContext>
|
|
948
|
+
) : (
|
|
949
|
+
grid
|
|
950
|
+
)
|
|
951
|
+
|
|
952
|
+
return (
|
|
953
|
+
<div
|
|
954
|
+
className={cn(
|
|
955
|
+
"flex flex-col gap-4 px-4 pb-2 lg:px-6",
|
|
956
|
+
layoutEditMode && "rounded-xl border border-dashed border-border/80 bg-transparent py-3",
|
|
957
|
+
)}
|
|
958
|
+
>
|
|
959
|
+
{editToolbar}
|
|
960
|
+
{gridBody}
|
|
961
|
+
</div>
|
|
962
|
+
)
|
|
963
|
+
}
|