@k2b/ui 0.62.0 → 0.64.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/dist/base.css +6 -3
- package/dist/browser/actions/ContextMenu.js +3 -1
- package/dist/browser/actions/ContextMenu.js.map +1 -1
- package/dist/browser/actions/DragAndDrop.js +26 -5
- package/dist/browser/actions/DragAndDrop.js.map +1 -1
- package/dist/browser/actions/DropOverlay.js +76 -0
- package/dist/browser/actions/DropOverlay.js.map +1 -0
- package/dist/browser/actions/Dropdown.js +69 -15
- package/dist/browser/actions/Dropdown.js.map +1 -1
- package/dist/browser/actions/FilterChip.js +10 -5
- package/dist/browser/actions/FilterChip.js.map +1 -1
- package/dist/browser/actions/SortableList.js +338 -85
- package/dist/browser/actions/SortableList.js.map +1 -1
- package/dist/browser/actions/ViewTabs.js +9 -5
- package/dist/browser/actions/ViewTabs.js.map +1 -1
- package/dist/browser/actions/drag-and-drop-keyboard.js +211 -0
- package/dist/browser/actions/drag-and-drop-keyboard.js.map +1 -0
- package/dist/browser/actions/drag-and-drop-messages.js +21 -25
- package/dist/browser/actions/drag-and-drop-messages.js.map +1 -1
- package/dist/browser/actions/drag-and-drop.js +206 -184
- package/dist/browser/actions/drag-and-drop.js.map +1 -1
- package/dist/browser/actions/drop-overlay-pages.js +54 -0
- package/dist/browser/actions/drop-overlay-pages.js.map +1 -0
- package/dist/browser/actions/drop-overlay-view.js +318 -0
- package/dist/browser/actions/drop-overlay-view.js.map +1 -0
- package/dist/browser/actions/index.js +4 -2
- package/dist/browser/actions/index.js.map +1 -1
- package/dist/browser/actions/menu-sheet-messages.js +26 -0
- package/dist/browser/actions/menu-sheet-messages.js.map +1 -0
- package/dist/browser/actions/menu-sheet.js +80 -18
- package/dist/browser/actions/menu-sheet.js.map +1 -1
- package/dist/browser/actions/menu-submenu-panel.js +392 -0
- package/dist/browser/actions/menu-submenu-panel.js.map +1 -0
- package/dist/browser/actions/preload-when-idle.js +15 -0
- package/dist/browser/actions/preload-when-idle.js.map +1 -0
- package/dist/browser/actions/sortable-board.js +107 -0
- package/dist/browser/actions/sortable-board.js.map +1 -0
- package/dist/browser/actions/sortable-keyboard.js +202 -0
- package/dist/browser/actions/sortable-keyboard.js.map +1 -0
- package/dist/browser/actions/sortable-list-messages.js +23 -11
- package/dist/browser/actions/sortable-list-messages.js.map +1 -1
- package/dist/browser/actions/sortable-place.js +26 -0
- package/dist/browser/actions/sortable-place.js.map +1 -0
- package/dist/browser/charts/core/line-base.js +2 -1
- package/dist/browser/charts/core/line-base.js.map +1 -1
- package/dist/browser/charts/core/line-details.js +2 -1
- package/dist/browser/charts/core/line-details.js.map +1 -1
- package/dist/browser/charts/core/svg-common.js +7 -0
- package/dist/browser/charts/core/svg-common.js.map +1 -1
- package/dist/browser/charts/description.js.map +1 -1
- package/dist/browser/chat/ChatComposer.js +15 -5
- package/dist/browser/chat/ChatComposer.js.map +1 -1
- package/dist/browser/chat/ChatDecision.js +607 -582
- package/dist/browser/chat/ChatDecision.js.map +1 -1
- package/dist/browser/chat/ChatDecisionField.js +311 -0
- package/dist/browser/chat/ChatDecisionField.js.map +1 -0
- package/dist/browser/chat/chat-messages.js +0 -4
- package/dist/browser/chat/chat-messages.js.map +1 -1
- package/dist/browser/chat/index.js +4 -4
- package/dist/browser/chat/index.js.map +1 -1
- package/dist/browser/chat/types.js.map +1 -1
- package/dist/browser/chat-decision-field.js +6 -0
- package/dist/browser/chat-decision-field.js.map +1 -0
- package/dist/browser/code-diff.js +7 -0
- package/dist/browser/code-diff.js.map +1 -0
- package/dist/browser/content/ChartExplorer.js +170 -161
- package/dist/browser/content/ChartExplorer.js.map +1 -1
- package/dist/browser/content/CodeDiff.js +785 -0
- package/dist/browser/content/CodeDiff.js.map +1 -0
- package/dist/browser/content/CodeDisplay.js +13 -4
- package/dist/browser/content/CodeDisplay.js.map +1 -1
- package/dist/browser/content/DataTable.js +494 -366
- package/dist/browser/content/DataTable.js.map +1 -1
- package/dist/browser/content/FileName.js +68 -0
- package/dist/browser/content/FileName.js.map +1 -0
- package/dist/browser/content/Lightbox.js +140 -123
- package/dist/browser/content/Lightbox.js.map +1 -1
- package/dist/browser/content/ProgressPath.js +30 -25
- package/dist/browser/content/ProgressPath.js.map +1 -1
- package/dist/browser/content/RunLog.js +2 -1
- package/dist/browser/content/RunLog.js.map +1 -1
- package/dist/browser/content/TaskRow.js +129 -0
- package/dist/browser/content/TaskRow.js.map +1 -0
- package/dist/browser/content/code-diff-messages.js +74 -0
- package/dist/browser/content/code-diff-messages.js.map +1 -0
- package/dist/browser/content/code-highlight.js +36 -91
- package/dist/browser/content/code-highlight.js.map +1 -1
- package/dist/browser/content/data-table-columns.js +13 -1
- package/dist/browser/content/data-table-columns.js.map +1 -1
- package/dist/browser/content/index.js +3 -0
- package/dist/browser/content/index.js.map +1 -1
- package/dist/browser/content/progress-path-messages.js +22 -0
- package/dist/browser/content/progress-path-messages.js.map +1 -0
- package/dist/browser/feedback/dialog-call.js +26 -0
- package/dist/browser/feedback/dialog-call.js.map +1 -0
- package/dist/browser/feedback/dialog-core.js +126 -27
- package/dist/browser/feedback/dialog-core.js.map +1 -1
- package/dist/browser/feedback/dialog-foot.js +45 -0
- package/dist/browser/feedback/dialog-foot.js.map +1 -0
- package/dist/browser/feedback/prompt-confirm.js +115 -133
- package/dist/browser/feedback/prompt-confirm.js.map +1 -1
- package/dist/browser/feedback/prompt-form-loader.js +18 -0
- package/dist/browser/feedback/prompt-form-loader.js.map +1 -0
- package/dist/browser/feedback/prompt-form-state.js +77 -0
- package/dist/browser/feedback/prompt-form-state.js.map +1 -0
- package/dist/browser/feedback/prompt-form.js +333 -0
- package/dist/browser/feedback/prompt-form.js.map +1 -0
- package/dist/browser/feedback/prompt-header.js +100 -0
- package/dist/browser/feedback/prompt-header.js.map +1 -0
- package/dist/browser/feedback/prompt-messages.js +2 -0
- package/dist/browser/feedback/prompt-messages.js.map +1 -1
- package/dist/browser/feedback/prompt-sheet-view.js +5 -4
- package/dist/browser/feedback/prompt-sheet-view.js.map +1 -1
- package/dist/browser/feedback/prompt-sheet.js +5 -3
- package/dist/browser/feedback/prompt-sheet.js.map +1 -1
- package/dist/browser/feedback/prompts.js +180 -550
- package/dist/browser/feedback/prompts.js.map +1 -1
- package/dist/browser/inputs/Combobox.js +26 -9
- package/dist/browser/inputs/Combobox.js.map +1 -1
- package/dist/browser/inputs/DatePicker.js +376 -718
- package/dist/browser/inputs/DatePicker.js.map +1 -1
- package/dist/browser/inputs/FileInputs.js +1 -1
- package/dist/browser/inputs/FileInputs.js.map +1 -1
- package/dist/browser/inputs/NumberInput.js +125 -46
- package/dist/browser/inputs/NumberInput.js.map +1 -1
- package/dist/browser/inputs/PeriodPicker.js +13 -5
- package/dist/browser/inputs/PeriodPicker.js.map +1 -1
- package/dist/browser/inputs/QrScanner.js +30 -3
- package/dist/browser/inputs/QrScanner.js.map +1 -1
- package/dist/browser/inputs/TextInput.js +3 -3
- package/dist/browser/inputs/TextInput.js.map +1 -1
- package/dist/browser/inputs/choice.js +2 -0
- package/dist/browser/inputs/choice.js.map +1 -1
- package/dist/browser/inputs/date-picker-panel.js +420 -0
- package/dist/browser/inputs/date-picker-panel.js.map +1 -0
- package/dist/browser/inputs/date-sheet.js +4 -3
- package/dist/browser/inputs/date-sheet.js.map +1 -1
- package/dist/browser/inputs/field-suggestion.js +18 -11
- package/dist/browser/inputs/field-suggestion.js.map +1 -1
- package/dist/browser/inputs/image-crop.js +1 -1
- package/dist/browser/inputs/image-crop.js.map +1 -1
- package/dist/browser/inputs/image-tools.js +4 -0
- package/dist/browser/inputs/image-tools.js.map +1 -0
- package/dist/browser/inputs/input-messages.js +8 -2
- package/dist/browser/inputs/input-messages.js.map +1 -1
- package/dist/browser/internal/field.js +2 -2
- package/dist/browser/internal/field.js.map +1 -1
- package/dist/browser/internal/renders-something.js +3 -0
- package/dist/browser/internal/renders-something.js.map +1 -0
- package/dist/browser/intl/messages.js +1 -1
- package/dist/browser/intl/messages.js.map +1 -1
- package/dist/browser/layout/AppWorkspace.js +17 -9
- package/dist/browser/layout/AppWorkspace.js.map +1 -1
- package/dist/browser/layout/AppWorkspaceSidebarItemStatus.js +62 -46
- package/dist/browser/layout/AppWorkspaceSidebarItemStatus.js.map +1 -1
- package/dist/browser/layout/Breadcrumbs.js +188 -42
- package/dist/browser/layout/Breadcrumbs.js.map +1 -1
- package/dist/browser/layout/DetailPanel.js +209 -205
- package/dist/browser/layout/DetailPanel.js.map +1 -1
- package/dist/browser/layout/FloatingPill.js +33 -0
- package/dist/browser/layout/FloatingPill.js.map +1 -0
- package/dist/browser/layout/Navigation.js +10 -7
- package/dist/browser/layout/Navigation.js.map +1 -1
- package/dist/browser/layout/PanelDialog.js +176 -88
- package/dist/browser/layout/PanelDialog.js.map +1 -1
- package/dist/browser/layout/StatusRow.js +174 -0
- package/dist/browser/layout/StatusRow.js.map +1 -0
- package/dist/browser/layout/app-workspace-controller.js +12 -5
- package/dist/browser/layout/app-workspace-controller.js.map +1 -1
- package/dist/browser/layout/app-workspace-state.js +2 -2
- package/dist/browser/layout/app-workspace-state.js.map +1 -1
- package/dist/browser/layout/index.js +2 -0
- package/dist/browser/layout/index.js.map +1 -1
- package/dist/browser/layout/navigation-model.js.map +1 -1
- package/dist/browser/layout/panel-dialog-error.js +44 -0
- package/dist/browser/layout/panel-dialog-error.js.map +1 -0
- package/dist/browser/layout/panel-sheet-handle.js +86 -0
- package/dist/browser/layout/panel-sheet-handle.js.map +1 -0
- package/dist/browser/layout/workspace-messages.js +12 -2
- package/dist/browser/layout/workspace-messages.js.map +1 -1
- package/dist/browser/layout-check.js +232 -0
- package/dist/browser/layout-check.js.map +1 -0
- package/dist/browser/run-log.js +3 -0
- package/dist/browser/run-log.js.map +1 -0
- package/dist/browser/surfaces/Area.js +205 -0
- package/dist/browser/surfaces/Area.js.map +1 -0
- package/dist/browser/surfaces/FactGroup.js +148 -0
- package/dist/browser/surfaces/FactGroup.js.map +1 -0
- package/dist/browser/surfaces/FieldGrid.js +34 -0
- package/dist/browser/surfaces/FieldGrid.js.map +1 -0
- package/dist/browser/surfaces/NoticeCard.js +69 -57
- package/dist/browser/surfaces/NoticeCard.js.map +1 -1
- package/dist/browser/surfaces/NoticeRow.js +91 -5
- package/dist/browser/surfaces/NoticeRow.js.map +1 -1
- package/dist/browser/surfaces/Placeholder.js +17 -5
- package/dist/browser/surfaces/Placeholder.js.map +1 -1
- package/dist/browser/surfaces/RowGroup.js +82 -0
- package/dist/browser/surfaces/RowGroup.js.map +1 -0
- package/dist/browser/surfaces/Section.js +22 -7
- package/dist/browser/surfaces/Section.js.map +1 -1
- package/dist/browser/surfaces/StatCell.js +62 -49
- package/dist/browser/surfaces/StatCell.js.map +1 -1
- package/dist/browser/surfaces/StatGrid.js +2 -0
- package/dist/browser/surfaces/StatGrid.js.map +1 -1
- package/dist/browser/surfaces/StatusBadge.js +5 -1
- package/dist/browser/surfaces/StatusBadge.js.map +1 -1
- package/dist/browser/surfaces/flat-block-messages.js +37 -0
- package/dist/browser/surfaces/flat-block-messages.js.map +1 -0
- package/dist/browser/surfaces/index.js +4 -0
- package/dist/browser/surfaces/index.js.map +1 -1
- package/dist/browser/widgets/DashboardFrame.js +62 -52
- package/dist/browser/widgets/DashboardFrame.js.map +1 -1
- package/dist/ssr/actions/ContextMenu.js +3 -1
- package/dist/ssr/actions/ContextMenu.js.map +1 -1
- package/dist/ssr/actions/DragAndDrop.js +26 -5
- package/dist/ssr/actions/DragAndDrop.js.map +1 -1
- package/dist/ssr/actions/DropOverlay.js +69 -0
- package/dist/ssr/actions/DropOverlay.js.map +1 -0
- package/dist/ssr/actions/Dropdown.js +69 -15
- package/dist/ssr/actions/Dropdown.js.map +1 -1
- package/dist/ssr/actions/FilterChip.js +8 -1
- package/dist/ssr/actions/FilterChip.js.map +1 -1
- package/dist/ssr/actions/SortableList.js +293 -71
- package/dist/ssr/actions/SortableList.js.map +1 -1
- package/dist/ssr/actions/ViewTabs.js +9 -5
- package/dist/ssr/actions/ViewTabs.js.map +1 -1
- package/dist/ssr/actions/drag-and-drop-keyboard.js +211 -0
- package/dist/ssr/actions/drag-and-drop-keyboard.js.map +1 -0
- package/dist/ssr/actions/drag-and-drop-messages.js +21 -25
- package/dist/ssr/actions/drag-and-drop-messages.js.map +1 -1
- package/dist/ssr/actions/drag-and-drop.js +206 -184
- package/dist/ssr/actions/drag-and-drop.js.map +1 -1
- package/dist/ssr/actions/drop-overlay-pages.js +54 -0
- package/dist/ssr/actions/drop-overlay-pages.js.map +1 -0
- package/dist/ssr/actions/drop-overlay-view.js +225 -0
- package/dist/ssr/actions/drop-overlay-view.js.map +1 -0
- package/dist/ssr/actions/index.js +4 -2
- package/dist/ssr/actions/index.js.map +1 -1
- package/dist/ssr/actions/menu-sheet-messages.js +26 -0
- package/dist/ssr/actions/menu-sheet-messages.js.map +1 -0
- package/dist/ssr/actions/menu-sheet.js +62 -10
- package/dist/ssr/actions/menu-sheet.js.map +1 -1
- package/dist/ssr/actions/menu-submenu-panel.js +295 -0
- package/dist/ssr/actions/menu-submenu-panel.js.map +1 -0
- package/dist/ssr/actions/preload-when-idle.js +15 -0
- package/dist/ssr/actions/preload-when-idle.js.map +1 -0
- package/dist/ssr/actions/sortable-board.js +107 -0
- package/dist/ssr/actions/sortable-board.js.map +1 -0
- package/dist/ssr/actions/sortable-keyboard.js +202 -0
- package/dist/ssr/actions/sortable-keyboard.js.map +1 -0
- package/dist/ssr/actions/sortable-list-messages.js +23 -11
- package/dist/ssr/actions/sortable-list-messages.js.map +1 -1
- package/dist/ssr/actions/sortable-place.js +26 -0
- package/dist/ssr/actions/sortable-place.js.map +1 -0
- package/dist/ssr/charts/core/line-base.js +2 -1
- package/dist/ssr/charts/core/line-base.js.map +1 -1
- package/dist/ssr/charts/core/line-details.js +2 -1
- package/dist/ssr/charts/core/line-details.js.map +1 -1
- package/dist/ssr/charts/core/svg-common.js +7 -0
- package/dist/ssr/charts/core/svg-common.js.map +1 -1
- package/dist/ssr/charts/description.js.map +1 -1
- package/dist/ssr/chat/ChatComposer.js +12 -4
- package/dist/ssr/chat/ChatComposer.js.map +1 -1
- package/dist/ssr/chat/ChatDecision.js +321 -275
- package/dist/ssr/chat/ChatDecision.js.map +1 -1
- package/dist/ssr/chat/ChatDecisionField.js +206 -0
- package/dist/ssr/chat/ChatDecisionField.js.map +1 -0
- package/dist/ssr/chat/chat-messages.js +0 -4
- package/dist/ssr/chat/chat-messages.js.map +1 -1
- package/dist/ssr/chat/index.js +4 -4
- package/dist/ssr/chat/index.js.map +1 -1
- package/dist/ssr/chat/types.js.map +1 -1
- package/dist/ssr/chat-decision-field.js +6 -0
- package/dist/ssr/chat-decision-field.js.map +1 -0
- package/dist/ssr/code-diff.js +7 -0
- package/dist/ssr/code-diff.js.map +1 -0
- package/dist/ssr/content/ChartExplorer.js +67 -59
- package/dist/ssr/content/ChartExplorer.js.map +1 -1
- package/dist/ssr/content/CodeDiff.js +610 -0
- package/dist/ssr/content/CodeDiff.js.map +1 -0
- package/dist/ssr/content/CodeDisplay.js +8 -2
- package/dist/ssr/content/CodeDisplay.js.map +1 -1
- package/dist/ssr/content/DataTable.js +128 -82
- package/dist/ssr/content/DataTable.js.map +1 -1
- package/dist/ssr/content/FileName.js +46 -0
- package/dist/ssr/content/FileName.js.map +1 -0
- package/dist/ssr/content/Lightbox.js +53 -40
- package/dist/ssr/content/Lightbox.js.map +1 -1
- package/dist/ssr/content/ProgressPath.js +14 -8
- package/dist/ssr/content/ProgressPath.js.map +1 -1
- package/dist/ssr/content/RunLog.js +2 -1
- package/dist/ssr/content/RunLog.js.map +1 -1
- package/dist/ssr/content/TaskRow.js +95 -0
- package/dist/ssr/content/TaskRow.js.map +1 -0
- package/dist/ssr/content/code-diff-messages.js +74 -0
- package/dist/ssr/content/code-diff-messages.js.map +1 -0
- package/dist/ssr/content/code-highlight.js +36 -91
- package/dist/ssr/content/code-highlight.js.map +1 -1
- package/dist/ssr/content/data-table-columns.js +13 -1
- package/dist/ssr/content/data-table-columns.js.map +1 -1
- package/dist/ssr/content/index.js +3 -0
- package/dist/ssr/content/index.js.map +1 -1
- package/dist/ssr/content/progress-path-messages.js +22 -0
- package/dist/ssr/content/progress-path-messages.js.map +1 -0
- package/dist/ssr/feedback/dialog-call.js +26 -0
- package/dist/ssr/feedback/dialog-call.js.map +1 -0
- package/dist/ssr/feedback/dialog-core.js +126 -27
- package/dist/ssr/feedback/dialog-core.js.map +1 -1
- package/dist/ssr/feedback/dialog-foot.js +45 -0
- package/dist/ssr/feedback/dialog-foot.js.map +1 -0
- package/dist/ssr/feedback/prompt-confirm.js +67 -58
- package/dist/ssr/feedback/prompt-confirm.js.map +1 -1
- package/dist/ssr/feedback/prompt-form-loader.js +18 -0
- package/dist/ssr/feedback/prompt-form-loader.js.map +1 -0
- package/dist/ssr/feedback/prompt-form-state.js +77 -0
- package/dist/ssr/feedback/prompt-form-state.js.map +1 -0
- package/dist/ssr/feedback/prompt-form.js +299 -0
- package/dist/ssr/feedback/prompt-form.js.map +1 -0
- package/dist/ssr/feedback/prompt-header.js +54 -0
- package/dist/ssr/feedback/prompt-header.js.map +1 -0
- package/dist/ssr/feedback/prompt-messages.js +2 -0
- package/dist/ssr/feedback/prompt-messages.js.map +1 -1
- package/dist/ssr/feedback/prompt-sheet-view.js +5 -4
- package/dist/ssr/feedback/prompt-sheet-view.js.map +1 -1
- package/dist/ssr/feedback/prompt-sheet.js +5 -3
- package/dist/ssr/feedback/prompt-sheet.js.map +1 -1
- package/dist/ssr/feedback/prompts.js +79 -409
- package/dist/ssr/feedback/prompts.js.map +1 -1
- package/dist/ssr/inputs/Combobox.js +17 -3
- package/dist/ssr/inputs/Combobox.js.map +1 -1
- package/dist/ssr/inputs/DatePicker.js +101 -265
- package/dist/ssr/inputs/DatePicker.js.map +1 -1
- package/dist/ssr/inputs/FileInputs.js +1 -1
- package/dist/ssr/inputs/FileInputs.js.map +1 -1
- package/dist/ssr/inputs/NumberInput.js +114 -44
- package/dist/ssr/inputs/NumberInput.js.map +1 -1
- package/dist/ssr/inputs/PeriodPicker.js +13 -5
- package/dist/ssr/inputs/PeriodPicker.js.map +1 -1
- package/dist/ssr/inputs/QrScanner.js +30 -3
- package/dist/ssr/inputs/QrScanner.js.map +1 -1
- package/dist/ssr/inputs/TextInput.js +3 -3
- package/dist/ssr/inputs/TextInput.js.map +1 -1
- package/dist/ssr/inputs/choice.js +2 -0
- package/dist/ssr/inputs/choice.js.map +1 -1
- package/dist/ssr/inputs/date-picker-panel.js +233 -0
- package/dist/ssr/inputs/date-picker-panel.js.map +1 -0
- package/dist/ssr/inputs/date-sheet.js +4 -3
- package/dist/ssr/inputs/date-sheet.js.map +1 -1
- package/dist/ssr/inputs/field-suggestion.js +18 -11
- package/dist/ssr/inputs/field-suggestion.js.map +1 -1
- package/dist/ssr/inputs/image-crop.js +1 -1
- package/dist/ssr/inputs/image-crop.js.map +1 -1
- package/dist/ssr/inputs/image-tools.js +4 -0
- package/dist/ssr/inputs/image-tools.js.map +1 -0
- package/dist/ssr/inputs/input-messages.js +8 -2
- package/dist/ssr/inputs/input-messages.js.map +1 -1
- package/dist/ssr/internal/field.js +2 -2
- package/dist/ssr/internal/field.js.map +1 -1
- package/dist/ssr/internal/renders-something.js +3 -0
- package/dist/ssr/internal/renders-something.js.map +1 -0
- package/dist/ssr/intl/messages.js +1 -1
- package/dist/ssr/intl/messages.js.map +1 -1
- package/dist/ssr/layout/AppWorkspace.js +17 -9
- package/dist/ssr/layout/AppWorkspace.js.map +1 -1
- package/dist/ssr/layout/AppWorkspaceSidebarItemStatus.js +37 -22
- package/dist/ssr/layout/AppWorkspaceSidebarItemStatus.js.map +1 -1
- package/dist/ssr/layout/Breadcrumbs.js +140 -26
- package/dist/ssr/layout/Breadcrumbs.js.map +1 -1
- package/dist/ssr/layout/DetailPanel.js +70 -68
- package/dist/ssr/layout/DetailPanel.js.map +1 -1
- package/dist/ssr/layout/FloatingPill.js +16 -0
- package/dist/ssr/layout/FloatingPill.js.map +1 -0
- package/dist/ssr/layout/Navigation.js +1 -1
- package/dist/ssr/layout/Navigation.js.map +1 -1
- package/dist/ssr/layout/PanelDialog.js +82 -8
- package/dist/ssr/layout/PanelDialog.js.map +1 -1
- package/dist/ssr/layout/StatusRow.js +93 -0
- package/dist/ssr/layout/StatusRow.js.map +1 -0
- package/dist/ssr/layout/app-workspace-controller.js +12 -5
- package/dist/ssr/layout/app-workspace-controller.js.map +1 -1
- package/dist/ssr/layout/app-workspace-state.js +2 -2
- package/dist/ssr/layout/app-workspace-state.js.map +1 -1
- package/dist/ssr/layout/index.js +2 -0
- package/dist/ssr/layout/index.js.map +1 -1
- package/dist/ssr/layout/navigation-model.js.map +1 -1
- package/dist/ssr/layout/panel-dialog-error.js +28 -0
- package/dist/ssr/layout/panel-dialog-error.js.map +1 -0
- package/dist/ssr/layout/panel-sheet-handle.js +66 -0
- package/dist/ssr/layout/panel-sheet-handle.js.map +1 -0
- package/dist/ssr/layout/workspace-messages.js +12 -2
- package/dist/ssr/layout/workspace-messages.js.map +1 -1
- package/dist/ssr/layout-check.js +232 -0
- package/dist/ssr/layout-check.js.map +1 -0
- package/dist/ssr/run-log.js +3 -0
- package/dist/ssr/run-log.js.map +1 -0
- package/dist/ssr/surfaces/Area.js +147 -0
- package/dist/ssr/surfaces/Area.js.map +1 -0
- package/dist/ssr/surfaces/FactGroup.js +106 -0
- package/dist/ssr/surfaces/FactGroup.js.map +1 -0
- package/dist/ssr/surfaces/FieldGrid.js +22 -0
- package/dist/ssr/surfaces/FieldGrid.js.map +1 -0
- package/dist/ssr/surfaces/NoticeCard.js +7 -5
- package/dist/ssr/surfaces/NoticeCard.js.map +1 -1
- package/dist/ssr/surfaces/NoticeRow.js +74 -5
- package/dist/ssr/surfaces/NoticeRow.js.map +1 -1
- package/dist/ssr/surfaces/Placeholder.js +15 -4
- package/dist/ssr/surfaces/Placeholder.js.map +1 -1
- package/dist/ssr/surfaces/RowGroup.js +60 -0
- package/dist/ssr/surfaces/RowGroup.js.map +1 -0
- package/dist/ssr/surfaces/Section.js +7 -4
- package/dist/ssr/surfaces/Section.js.map +1 -1
- package/dist/ssr/surfaces/StatCell.js +8 -4
- package/dist/ssr/surfaces/StatCell.js.map +1 -1
- package/dist/ssr/surfaces/StatGrid.js +2 -0
- package/dist/ssr/surfaces/StatGrid.js.map +1 -1
- package/dist/ssr/surfaces/StatusBadge.js +5 -1
- package/dist/ssr/surfaces/StatusBadge.js.map +1 -1
- package/dist/ssr/surfaces/flat-block-messages.js +37 -0
- package/dist/ssr/surfaces/flat-block-messages.js.map +1 -0
- package/dist/ssr/surfaces/index.js +4 -0
- package/dist/ssr/surfaces/index.js.map +1 -1
- package/dist/ssr/widgets/DashboardFrame.js +20 -12
- package/dist/ssr/widgets/DashboardFrame.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/actions/DragAndDrop.d.ts +17 -2
- package/dist/types/actions/DropOverlay.d.ts +46 -0
- package/dist/types/actions/Dropdown.d.ts +35 -1
- package/dist/types/actions/FilterChip.d.ts +2 -1
- package/dist/types/actions/SortableList.d.ts +36 -6
- package/dist/types/actions/ViewTabs.d.ts +3 -2
- package/dist/types/actions/drag-and-drop-keyboard.d.ts +4 -0
- package/dist/types/actions/drag-and-drop-messages.d.ts +8 -10
- package/dist/types/actions/drag-and-drop.d.ts +62 -4
- package/dist/types/actions/drop-overlay-pages.d.ts +22 -0
- package/dist/types/actions/drop-overlay-view.d.ts +12 -0
- package/dist/types/actions/index.d.ts +9 -5
- package/dist/types/actions/menu-sheet-messages.d.ts +11 -0
- package/dist/types/actions/menu-sheet.d.ts +3 -1
- package/dist/types/actions/menu-submenu-panel.d.ts +27 -0
- package/dist/types/actions/preload-when-idle.d.ts +5 -0
- package/dist/types/actions/sortable-board.d.ts +69 -0
- package/dist/types/actions/sortable-keyboard.d.ts +7 -0
- package/dist/types/actions/sortable-list-messages.d.ts +10 -3
- package/dist/types/actions/sortable-place.d.ts +16 -0
- package/dist/types/charts/core/svg-common.d.ts +7 -0
- package/dist/types/charts/description.d.ts +2 -0
- package/dist/types/chat/ChatDecision.d.ts +98 -111
- package/dist/types/chat/ChatDecisionField.d.ts +45 -0
- package/dist/types/chat/chat-messages.d.ts +0 -2
- package/dist/types/chat/index.d.ts +4 -20
- package/dist/types/chat/types.d.ts +24 -14
- package/dist/types/chat-decision-field.d.ts +5 -0
- package/dist/types/code-diff.d.ts +6 -0
- package/dist/types/content/ChartExplorer.d.ts +5 -0
- package/dist/types/content/CodeDiff.d.ts +68 -0
- package/dist/types/content/CodeDisplay.d.ts +2 -0
- package/dist/types/content/DataTable.d.ts +19 -0
- package/dist/types/content/FileName.d.ts +23 -0
- package/dist/types/content/Lightbox.d.ts +5 -0
- package/dist/types/content/ProgressPath.d.ts +12 -6
- package/dist/types/content/RunLog.d.ts +2 -0
- package/dist/types/content/TaskRow.d.ts +33 -0
- package/dist/types/content/code-diff-messages.d.ts +35 -0
- package/dist/types/content/code-highlight.d.ts +0 -12
- package/dist/types/content/index.d.ts +3 -0
- package/dist/types/content/progress-path-messages.d.ts +8 -0
- package/dist/types/feedback/dialog-call.d.ts +19 -0
- package/dist/types/feedback/dialog-core.d.ts +14 -0
- package/dist/types/feedback/dialog-foot.d.ts +9 -0
- package/dist/types/feedback/prompt-confirm.d.ts +20 -13
- package/dist/types/feedback/prompt-form-loader.d.ts +10 -0
- package/dist/types/feedback/prompt-form-state.d.ts +8 -0
- package/dist/types/feedback/prompt-form.d.ts +13 -0
- package/dist/types/feedback/prompt-header.d.ts +15 -0
- package/dist/types/feedback/prompt-messages.d.ts +1 -0
- package/dist/types/feedback/prompt-sheet-view.d.ts +6 -3
- package/dist/types/feedback/prompt-sheet.d.ts +4 -2
- package/dist/types/feedback/prompts.d.ts +5 -11
- package/dist/types/inputs/Combobox.d.ts +2 -0
- package/dist/types/inputs/DatePicker.d.ts +3 -21
- package/dist/types/inputs/TextInput.d.ts +2 -0
- package/dist/types/inputs/choice.d.ts +3 -2
- package/dist/types/inputs/date-picker-panel.d.ts +29 -0
- package/dist/types/inputs/date-sheet.d.ts +4 -2
- package/dist/types/inputs/field-suggestion.d.ts +4 -1
- package/dist/types/inputs/image-tools.d.ts +1 -0
- package/dist/types/inputs/input-messages.d.ts +4 -1
- package/dist/types/internal/renders-something.d.ts +2 -0
- package/dist/types/layout/AppWorkspace.d.ts +10 -2
- package/dist/types/layout/AppWorkspaceSidebarItemStatus.d.ts +5 -0
- package/dist/types/layout/Breadcrumbs.d.ts +10 -5
- package/dist/types/layout/FloatingPill.d.ts +20 -0
- package/dist/types/layout/PanelDialog.d.ts +19 -0
- package/dist/types/layout/StatusRow.d.ts +54 -0
- package/dist/types/layout/app-workspace-state.d.ts +2 -2
- package/dist/types/layout/index.d.ts +5 -1
- package/dist/types/layout/navigation-model.d.ts +2 -0
- package/dist/types/layout/panel-dialog-error.d.ts +9 -0
- package/dist/types/layout/panel-sheet-handle.d.ts +8 -0
- package/dist/types/layout/workspace-messages.d.ts +5 -0
- package/dist/types/layout-check.d.ts +52 -0
- package/dist/types/run-log.d.ts +2 -0
- package/dist/types/surfaces/Area.d.ts +38 -0
- package/dist/types/surfaces/FactGroup.d.ts +33 -0
- package/dist/types/surfaces/FieldGrid.d.ts +14 -0
- package/dist/types/surfaces/NoticeCard.d.ts +6 -4
- package/dist/types/surfaces/NoticeRow.d.ts +19 -3
- package/dist/types/surfaces/Placeholder.d.ts +7 -0
- package/dist/types/surfaces/RowGroup.d.ts +20 -0
- package/dist/types/surfaces/Section.d.ts +8 -2
- package/dist/types/surfaces/StatCell.d.ts +2 -0
- package/dist/types/surfaces/StatGrid.d.ts +2 -1
- package/dist/types/surfaces/StatusBadge.d.ts +2 -1
- package/dist/types/surfaces/flat-block-messages.d.ts +16 -0
- package/dist/types/surfaces/index.d.ts +9 -1
- package/dist/types/widgets/DashboardFrame.d.ts +5 -0
- package/package.json +27 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["surfaces/NoticeRow.tsx"],"sourcesContent":["import { type JSX, Show, splitProps } from \"solid-js\";\nimport type
|
|
1
|
+
{"version":3,"names":[],"sources":["surfaces/NoticeRow.tsx"],"sourcesContent":["import { createSignal, type JSX, onCleanup, onMount, Show, splitProps } from \"solid-js\";\nimport { NoticeCard, type NoticeTone } from \"./NoticeCard\";\n\nexport type NoticeRowProps = Omit<JSX.HTMLAttributes<HTMLElement>, \"children\" | \"class\"> & {\n tone?: NoticeTone;\n /**\n * A Tabler icon class on a soft square tile at the start of the row, for the subject the notice is about, such as\n * images. The tile is decorative; the text names the state.\n */\n tile?: string;\n /** The tile's colour as a CSS colour, such as a subject token; defaults to the tone's ink. */\n tileColor?: string;\n /** A decorative icon; true resolves the tone's icon and its screen-reader word. */\n icon?: string | true;\n /** A quiet second line opts into the responsive summary: desktop action column, phone actions below. */\n detail?: JSX.Element;\n detailTitle?: string;\n /** A quiet text action that remains visible when the detail is truncated. */\n detailAction?: JSX.Element;\n /** Keep room for two title lines, two quiet lines and phone controls through transitions. */\n reserve?: boolean;\n detailLines?: 1 | 2;\n /** One or two public controls. The renderer selects their variants and sizes for the container width. */\n actions?: JSX.Element | ((layout: { narrow: boolean }) => JSX.Element);\n /** One short sentence; truncate it rather than letting the row grow. */\n children: JSX.Element;\n /** The one next step at the end of the row, such as a `Button` or a `SplitButton`. It never wraps below the text. */\n action?: JSX.Element;\n class?: string;\n};\n\nconst ROW_PROPS = [\n \"tone\",\n \"tile\",\n \"tileColor\",\n \"children\",\n \"action\",\n \"class\",\n \"icon\",\n \"detail\",\n \"detailTitle\",\n \"detailAction\",\n \"reserve\",\n \"detailLines\",\n \"actions\",\n] as const;\n\n/**\n * A notice with an optional quiet line. Without it, one row of at least 48px: the tile, one line of text, then the action, all centred. It has the tint and\n * tones of `NoticeCard`, so a notice that changes state in place, such as blocked, loading, and failed, keeps its row and\n * the content below never moves.\n * The one- or two-line form is chosen once at mount. Keep that form stable across state changes.\n * In the two-line form use `actions`; `action` belongs to the original single-line form.\n */\nexport function NoticeRow(props: NoticeRowProps): JSX.Element {\n const [local, articleProps] = splitProps(props, ROW_PROPS);\n if (\n !(\n props.detail !== undefined ||\n props.icon ||\n props.reserve !== undefined ||\n props.actions !== undefined ||\n props.detailAction !== undefined\n )\n )\n return (\n <article {...articleProps} class={`k2b-notice-card ${local.class ?? \"\"}`} data-tone={local.tone ?? \"neutral\"} data-row=\"\">\n <Show when={local.tile}>\n {(tile) => (\n <span class=\"k2b-notice-card__tile k2b-icon-tile\" style={{ color: local.tileColor }} aria-hidden=\"true\">\n <i class={tile()} />\n </span>\n )}\n </Show>\n <div class=\"k2b-notice-card__content\">{local.children}</div>\n <Show when={local.action}>{(action) => <div class=\"k2b-notice-card__action\">{action()}</div>}</Show>\n </article>\n );\n let host: HTMLDivElement | undefined;\n const [narrow, setNarrow] = createSignal(false);\n onMount(() => {\n if (!host) return;\n const isNarrow = (width: number) => width <= 35 * Number.parseFloat(getComputedStyle(document.documentElement).fontSize);\n // Receipts size to their content: choose the controls before the first paint. Later changes must not resize the\n // observed box inside the observer's callback, which would create a resize loop.\n const width = host.getBoundingClientRect().width;\n if (host.isConnected && width > 0) setNarrow(isNarrow(width));\n let frame = 0;\n const observer = new ResizeObserver(([entry]) => {\n const next = isNarrow(entry?.contentRect.width ?? 0);\n cancelAnimationFrame(frame);\n if (next !== narrow()) frame = requestAnimationFrame(() => setNarrow(next));\n });\n observer.observe(host);\n onCleanup(() => {\n cancelAnimationFrame(frame);\n observer.disconnect();\n });\n });\n return (\n <div class=\"k2b-notice-card-container\" ref={host} style={{ \"--k2b-notice-tile-color\": local.tileColor }}>\n <NoticeCard\n {...articleProps}\n class={local.class}\n tone={local.tone}\n layout=\"card\"\n icon={local.tile ?? local.icon}\n data-row=\"\"\n data-detail=\"\"\n data-detail-lines={local.detailLines === 2 ? \"2\" : undefined}\n data-row-tile={local.tile ? \"\" : undefined}\n data-reserve={local.reserve !== false ? \"\" : undefined}\n title={local.children}\n detail={\n <>\n <span class=\"k2b-notice-card__detail-text\" title={local.detailTitle}>\n {local.detail}\n </span>\n <Show when={local.detailAction}>{(action) => <span class=\"k2b-notice-card__detail-action\">{action()}</span>}</Show>\n </>\n }\n actions={typeof local.actions === \"function\" ? local.actions({ narrow: narrow() }) : local.actions}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA,SAAS,YAAY,EAAY,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,QAAQ,UAAU;AACvF,SAAS,UAAU,QAAyB,cAAc;AA8B1D,MAAM,SAAS,GAAG,CAChB,MAAM,EACN,MAAM,EACN,WAAW,EACX,UAAU,EACV,QAAQ,EACR,OAAO,EACP,MAAM,EACN,QAAQ,EACR,aAAa,EACb,cAAc,EACd,SAAS,EACT,aAAa,EACb,SAAS,CACD;;AAEV;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAAS,SAAS,CAAC,KAAqB,EAAe;EAC5D,MAAM,CAAC,KAAK,EAAE,YAAY,CAAC,GAAG,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC;EAC1D,IACE,EACE,KAAK,CAAC,MAAM,KAAK,SAAS,IAC1B,KAAK,CAAC,IAAI,IACV,KAAK,CAAC,OAAO,KAAK,SAAS,IAC3B,KAAK,CAAC,OAAO,KAAK,SAAS,IAC3B,KAAK,CAAC,YAAY,KAAK,SAAS,CACjC,EAED,4CACe,YAAY;IAAA;MAAA,OAAS,mBAAmB,KAAK,CAAC,KAAK,IAAI,EAAE,EAAE;IAAA;IAAA;MAAA,OAAa,KAAK,CAAC,IAAI,IAAI,SAAS;IAAA;IAAA,YAAW;EAAE,gCACtH,IAAI;IAAA,IAAC,IAAI;MAAA,OAAE,KAAK,CAAC,IAAI;IAAA;IAAA,UAClB,IAAI,yDAC8D,KAAK,CAAC,SAAS,2CACrE,IAAI,CAAC,CAAC;EAEnB,4BAEoC,KAAK,CAAC,QAAQ,+BACpD,IAAI;IAAA,IAAC,IAAI;MAAA,OAAE,KAAK,CAAC,MAAM;IAAA;IAAA,UAAI,MAAM,4BAA2C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IAAI,KAAK,CAAC,IAAI;IAAA;IAAA;IAAA;IAAA;MAAA,OAGX,KAAK,CAAC,WAAW,KAAK,CAAC,GAAG,GAAG,GAAG,SAAS;IAAA;IAAA;MAAA,OAC7C,KAAK,CAAC,IAAI,GAAG,EAAE,GAAG,SAAS;IAAA;IAAA;MAAA,OAC5B,KAAK,CAAC,OAAO,KAAK,KAAK,GAAG,EAAE,GAAG,SAAS;IAAA;IAAA,IACtD,KAAK;MAAA,OAAE,KAAK,CAAC,QAAQ;IAAA;IAAA,IACrB,MAAM;MAAA,wDAEgD,KAAK,CAAC,WAAW,0BAChE,KAAK,CAAC,MAAM,sBAEd,IAAI;QAAA,IAAC,IAAI;UAAA,OAAE,KAAK,CAAC,YAAY;QAAA;QAAA,UAAI,MAAM,4BAAmD,MAAM,CAAC,CAAC;MAAQ;IAAA;IAAA,IAG/G,OAAO;MAAA,OAAE,oBAAO,KAAK,CAAC,OAAO,KAAK,UAAU,MAAG,KAAK,CAAC,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;MAAE,CAAC,CAAC,GAAG,KAAK,CAAC,OAAO;IAAA;EAAA;AAI1G","ignoreList":[]}
|
|
@@ -6,7 +6,7 @@ import { memo as _$memo } from "solid-js/web";
|
|
|
6
6
|
var _tmpl$ = ["<p class=\"k2b-placeholder__title\">", "</p>"],
|
|
7
7
|
_tmpl$2 = ["<div class=\"k2b-placeholder__description\">", "</div>"],
|
|
8
8
|
_tmpl$3 = ["<div class=\"k2b-placeholder__action\">", "", "</div>"],
|
|
9
|
-
_tmpl$4 = ["<span", "><i", " aria-hidden=\"true\"></i></span>"];
|
|
9
|
+
_tmpl$4 = ["<span class=\"k2b-placeholder__icon\"", "><i", " aria-hidden=\"true\"></i></span>"];
|
|
10
10
|
import { Show } from "solid-js";
|
|
11
11
|
import { Dynamic } from "solid-js/web";
|
|
12
12
|
import { Button } from "../actions/Button";
|
|
@@ -15,12 +15,20 @@ import { Paper } from "./Paper";
|
|
|
15
15
|
|
|
16
16
|
/** `compact` stacks inside a section, `inline` is one row in a list or sidebar, `panel` fills a work area. */
|
|
17
17
|
|
|
18
|
+
/** The tone of the round sign; the sentence still says what it means (K8, K10). */
|
|
19
|
+
|
|
20
|
+
const TONE_ICONS = {
|
|
21
|
+
success: "ti ti-check",
|
|
22
|
+
info: "ti ti-info-circle",
|
|
23
|
+
warning: "ti ti-alert-triangle",
|
|
24
|
+
danger: "ti ti-alert-circle"
|
|
25
|
+
};
|
|
18
26
|
export default function Placeholder(props) {
|
|
19
27
|
const messages = useUiMessages();
|
|
20
28
|
const align = () => props.align ?? "center";
|
|
21
29
|
const state = () => props.state ?? "empty";
|
|
22
30
|
const variant = () => props.variant ?? "compact";
|
|
23
|
-
const icon = () => props.icon ?? (state() === "loading" ? "ti ti-loader-2" : state() === "error" ? "ti ti-alert-circle" : state() === "no-results" ? "ti ti-search-off" : state() === "no-access" ? "ti ti-lock" : undefined);
|
|
31
|
+
const icon = () => props.icon ?? (props.tone && state() !== "loading" && state() !== "error" ? TONE_ICONS[props.tone] : undefined) ?? (state() === "loading" ? "ti ti-loader-2" : state() === "error" ? "ti ti-alert-circle" : state() === "no-results" ? "ti ti-search-off" : state() === "no-access" ? "ti ti-lock" : undefined);
|
|
24
32
|
return _$createComponent(Dynamic, {
|
|
25
33
|
get component() {
|
|
26
34
|
return props.surface === "paper" ? Paper : "div";
|
|
@@ -40,6 +48,9 @@ export default function Placeholder(props) {
|
|
|
40
48
|
get ["data-variant"]() {
|
|
41
49
|
return variant();
|
|
42
50
|
},
|
|
51
|
+
get ["data-tone"]() {
|
|
52
|
+
return props.tone;
|
|
53
|
+
},
|
|
43
54
|
get role() {
|
|
44
55
|
return _$memo(() => state() === "error")() ? "alert" : state() === "loading" ? "status" : undefined;
|
|
45
56
|
},
|
|
@@ -54,8 +65,8 @@ export default function Placeholder(props) {
|
|
|
54
65
|
get when() {
|
|
55
66
|
return icon();
|
|
56
67
|
},
|
|
57
|
-
children: iconClass => //
|
|
58
|
-
_$ssr(_tmpl$4, _$ssrAttribute("
|
|
68
|
+
children: iconClass => // One round sign (K10): a quiet disc for the calm states and an error; loading keeps the same box bare.
|
|
69
|
+
_$ssr(_tmpl$4, _$ssrAttribute("data-sign", state() === "loading" ? _$escape(undefined, true) : "", false), _$ssrAttribute("class", _$escape(iconClass(), true), false))
|
|
59
70
|
}), _$createComponent(Show, {
|
|
60
71
|
get when() {
|
|
61
72
|
return props.title;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["surfaces/Placeholder.tsx"],"sourcesContent":["import { type JSX, Show } from \"solid-js\";\nimport { Dynamic } from \"solid-js/web\";\nimport { Button } from \"../actions/Button\";\nimport { useUiMessages } from \"../intl/messages\";\nimport { Paper } from \"./Paper\";\n\nexport type PlaceholderAlign = \"center\" | \"left\";\nexport type PlaceholderSurface = \"none\" | \"paper\";\nexport type PlaceholderState = \"empty\" | \"no-results\" | \"no-access\" | \"loading\" | \"error\";\n/** `compact` stacks inside a section, `inline` is one row in a list or sidebar, `panel` fills a work area. */\nexport type PlaceholderVariant = \"compact\" | \"inline\" | \"panel\";\n\nexport type PlaceholderProps = {\n title?: JSX.Element;\n description?: JSX.Element;\n icon?: string;\n action?: JSX.Element;\n onRetry?: () => void;\n align?: PlaceholderAlign;\n surface?: PlaceholderSurface;\n state?: PlaceholderState;\n variant?: PlaceholderVariant;\n class?: string;\n};\n\nexport default function Placeholder(props: PlaceholderProps): JSX.Element {\n const messages = useUiMessages();\n const align = () => props.align ?? \"center\";\n const state = () => props.state ?? \"empty\";\n const variant = () => props.variant ?? \"compact\";\n const icon = () =>\n props.icon ??\n (state() === \"loading\"\n ? \"ti ti-loader-2\"\n : state() === \"error\"\n ? \"ti ti-alert-circle\"\n : state() === \"no-results\"\n ? \"ti ti-search-off\"\n : state() === \"no-access\"\n ? \"ti ti-lock\"\n : undefined);\n\n return (\n <Dynamic\n component={props.surface === \"paper\" ? Paper : \"div\"}\n class={`k2b-placeholder ${props.class ?? \"\"}`}\n data-align={align()}\n data-state={state()}\n data-surface={props.surface ?? \"none\"}\n data-variant={variant()}\n role={state() === \"error\" ? \"alert\" : state() === \"loading\" ? \"status\" : undefined}\n aria-live={state() === \"loading\" ? \"polite\" : undefined}\n aria-busy={state() === \"loading\" ? \"true\" : undefined}\n >\n <Show when={icon()}>\n {(iconClass) => (\n //
|
|
1
|
+
{"version":3,"names":[],"sources":["surfaces/Placeholder.tsx"],"sourcesContent":["import { type JSX, Show } from \"solid-js\";\nimport { Dynamic } from \"solid-js/web\";\nimport { Button } from \"../actions/Button\";\nimport { useUiMessages } from \"../intl/messages\";\nimport { Paper } from \"./Paper\";\n\nexport type PlaceholderAlign = \"center\" | \"left\";\nexport type PlaceholderSurface = \"none\" | \"paper\";\nexport type PlaceholderState = \"empty\" | \"no-results\" | \"no-access\" | \"loading\" | \"error\";\n/** `compact` stacks inside a section, `inline` is one row in a list or sidebar, `panel` fills a work area. */\nexport type PlaceholderVariant = \"compact\" | \"inline\" | \"panel\";\n/** The tone of the round sign; the sentence still says what it means (K8, K10). */\nexport type PlaceholderTone = \"success\" | \"info\" | \"warning\" | \"danger\";\n\nexport type PlaceholderProps = {\n title?: JSX.Element;\n description?: JSX.Element;\n icon?: string;\n action?: JSX.Element;\n onRetry?: () => void;\n align?: PlaceholderAlign;\n surface?: PlaceholderSurface;\n state?: PlaceholderState;\n variant?: PlaceholderVariant;\n /**\n * Colours the round sign in a state tone, such as `success` with a check for \"All done\". The title still says it\n * in words. Without an `icon` the tone brings its own: check, info, alert triangle, or alert circle.\n */\n tone?: PlaceholderTone;\n class?: string;\n};\n\nconst TONE_ICONS: Record<PlaceholderTone, string> = {\n success: \"ti ti-check\",\n info: \"ti ti-info-circle\",\n warning: \"ti ti-alert-triangle\",\n danger: \"ti ti-alert-circle\",\n};\n\nexport default function Placeholder(props: PlaceholderProps): JSX.Element {\n const messages = useUiMessages();\n const align = () => props.align ?? \"center\";\n const state = () => props.state ?? \"empty\";\n const variant = () => props.variant ?? \"compact\";\n const icon = () =>\n props.icon ??\n (props.tone && state() !== \"loading\" && state() !== \"error\" ? TONE_ICONS[props.tone] : undefined) ??\n (state() === \"loading\"\n ? \"ti ti-loader-2\"\n : state() === \"error\"\n ? \"ti ti-alert-circle\"\n : state() === \"no-results\"\n ? \"ti ti-search-off\"\n : state() === \"no-access\"\n ? \"ti ti-lock\"\n : undefined);\n\n return (\n <Dynamic\n component={props.surface === \"paper\" ? Paper : \"div\"}\n class={`k2b-placeholder ${props.class ?? \"\"}`}\n data-align={align()}\n data-state={state()}\n data-surface={props.surface ?? \"none\"}\n data-variant={variant()}\n data-tone={props.tone}\n role={state() === \"error\" ? \"alert\" : state() === \"loading\" ? \"status\" : undefined}\n aria-live={state() === \"loading\" ? \"polite\" : undefined}\n aria-busy={state() === \"loading\" ? \"true\" : undefined}\n >\n <Show when={icon()}>\n {(iconClass) => (\n // One round sign (K10): a quiet disc for the calm states and an error; loading keeps the same box bare.\n <span class=\"k2b-placeholder__icon\" data-sign={state() === \"loading\" ? undefined : \"\"}>\n <i class={iconClass()} aria-hidden=\"true\" />\n </span>\n )}\n </Show>\n <Show when={props.title}>\n <p class=\"k2b-placeholder__title\">{props.title}</p>\n </Show>\n <Show when={props.description}>\n <div class=\"k2b-placeholder__description\">{props.description}</div>\n </Show>\n <Show when={props.action || (state() === \"error\" && props.onRetry)}>\n <div class=\"k2b-placeholder__action\">\n {props.action}\n <Show when={state() === \"error\" && props.onRetry}>\n <Button type=\"button\" size=\"sm\" variant=\"secondary\" onClick={() => props.onRetry?.()}>\n {messages().tryAgain}\n </Button>\n </Show>\n </div>\n </Show>\n </Dynamic>\n );\n}\n"],"mappings":";;;;;;;;;AAAA,SAAmB,IAAI,QAAQ,UAAU;AACzC,SAAS,OAAO,QAAQ,cAAc;AACtC,SAAS,MAAM,QAAQ,mBAAmB;AAC1C,SAAS,aAAa,QAAQ,kBAAkB;AAChD,SAAS,KAAK,QAAQ,SAAS;;AAK/B;;AAEA;;AAqBA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}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { ssrElement as _$ssrElement } from "solid-js/web";
|
|
2
|
+
import { mergeProps as _$mergeProps } from "solid-js/web";
|
|
3
|
+
import { ssr as _$ssr } from "solid-js/web";
|
|
4
|
+
import { escape as _$escape } from "solid-js/web";
|
|
5
|
+
import { createComponent as _$createComponent } from "solid-js/web";
|
|
6
|
+
var _tmpl$ = ["<span class=\"k2b-row-group__count\">", "</span>"],
|
|
7
|
+
_tmpl$2 = ["<span class=\"k2b-row-group__action\">", "</span>"],
|
|
8
|
+
_tmpl$3 = ["<div class=\"k2b-row-group__head\">", "", "", "</div>"],
|
|
9
|
+
_tmpl$4 = ["<div class=\"k2b-row-group__rows k2b-divided\">", "</div>"];
|
|
10
|
+
import { children, createUniqueId, Show, splitProps } from "solid-js";
|
|
11
|
+
import { Dynamic } from "solid-js/web";
|
|
12
|
+
import { rendersSomething } from "../internal/renders-something";
|
|
13
|
+
/**
|
|
14
|
+
* A group (K17 "Gruppe"): a sort word for the rows of one list, such as tasks by status. A 36 px head on the page's
|
|
15
|
+
* quiet ground with the name in 13 px bold, its count, and at most one action; the rows follow as they are. It
|
|
16
|
+
* disappears when it is empty. A group never stands inside an `Area`.
|
|
17
|
+
*/
|
|
18
|
+
export function RowGroup(props) {
|
|
19
|
+
const [local, rest] = splitProps(props, ["title", "count", "action", "children", "level", "class"]);
|
|
20
|
+
const rows = children(() => local.children);
|
|
21
|
+
const titleId = `k2b-row-group-${createUniqueId()}`;
|
|
22
|
+
return _$createComponent(Show, {
|
|
23
|
+
get when() {
|
|
24
|
+
return rendersSomething(rows.toArray());
|
|
25
|
+
},
|
|
26
|
+
get children() {
|
|
27
|
+
return _$ssrElement("section", _$mergeProps(rest, {
|
|
28
|
+
get ["class"]() {
|
|
29
|
+
return local.class ? `k2b-row-group ${local.class}` : "k2b-row-group";
|
|
30
|
+
},
|
|
31
|
+
"aria-labelledby": titleId
|
|
32
|
+
}), [_$ssr(_tmpl$3, _$escape(_$createComponent(Dynamic, {
|
|
33
|
+
get component() {
|
|
34
|
+
return `h${local.level ?? 4}`;
|
|
35
|
+
},
|
|
36
|
+
id: titleId,
|
|
37
|
+
"class": "k2b-row-group__title",
|
|
38
|
+
get children() {
|
|
39
|
+
return local.title;
|
|
40
|
+
}
|
|
41
|
+
})), _$escape(_$createComponent(Show, {
|
|
42
|
+
get when() {
|
|
43
|
+
return local.count !== undefined;
|
|
44
|
+
},
|
|
45
|
+
get children() {
|
|
46
|
+
return _$ssr(_tmpl$, _$escape(local.count));
|
|
47
|
+
}
|
|
48
|
+
})), _$escape(_$createComponent(Show, {
|
|
49
|
+
get when() {
|
|
50
|
+
return local.action;
|
|
51
|
+
},
|
|
52
|
+
get children() {
|
|
53
|
+
return _$ssr(_tmpl$2, _$escape(local.action));
|
|
54
|
+
}
|
|
55
|
+
}))), _$ssr(_tmpl$4, _$escape(rows()))], false);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
export default RowGroup;
|
|
60
|
+
//# sourceMappingURL=RowGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["surfaces/RowGroup.tsx"],"sourcesContent":["import { children, createUniqueId, type JSX, Show, splitProps } from \"solid-js\";\nimport { Dynamic } from \"solid-js/web\";\nimport { rendersSomething } from \"../internal/renders-something\";\n\nexport type RowGroupProps = Omit<JSX.HTMLAttributes<HTMLElement>, \"children\" | \"title\"> & {\n /** The value the rows share, such as a status, a tag, or a person. */\n title: JSX.Element;\n /** How many rows the group holds, after the title. */\n count?: number;\n /** At most one quiet control at the end of the head, such as \"+\". */\n action?: JSX.Element;\n /** The group's rows. A group without rows renders nothing. */\n children?: JSX.Element;\n /** Heading level of the title; defaults to 4. */\n level?: 3 | 4 | 5;\n};\n\n/**\n * A group (K17 \"Gruppe\"): a sort word for the rows of one list, such as tasks by status. A 36 px head on the page's\n * quiet ground with the name in 13 px bold, its count, and at most one action; the rows follow as they are. It\n * disappears when it is empty. A group never stands inside an `Area`.\n */\nexport function RowGroup(props: RowGroupProps): JSX.Element {\n const [local, rest] = splitProps(props, [\"title\", \"count\", \"action\", \"children\", \"level\", \"class\"]);\n const rows = children(() => local.children);\n const titleId = `k2b-row-group-${createUniqueId()}`;\n return (\n <Show when={rendersSomething(rows.toArray())}>\n <section {...rest} class={local.class ? `k2b-row-group ${local.class}` : \"k2b-row-group\"} aria-labelledby={titleId}>\n <div class=\"k2b-row-group__head\">\n <Dynamic component={`h${local.level ?? 4}`} id={titleId} class=\"k2b-row-group__title\">\n {local.title}\n </Dynamic>\n <Show when={local.count !== undefined}>\n <span class=\"k2b-row-group__count\">{local.count}</span>\n </Show>\n <Show when={local.action}>\n <span class=\"k2b-row-group__action\">{local.action}</span>\n </Show>\n </div>\n <div class=\"k2b-row-group__rows k2b-divided\">{rows()}</div>\n </section>\n </Show>\n );\n}\n\nexport default RowGroup;\n"],"mappings":";;;;;;;;;AAAA,SAAS,QAAQ,EAAE,cAAc,EAAY,IAAI,EAAE,UAAU,QAAQ,UAAU;AAC/E,SAAS,OAAO,QAAQ,cAAc;AACtC,SAAS,gBAAgB,QAAQ,+BAA+B;AAehE;AACA;AACA;AACA;AACA;AACA,OAAO,SAAS,QAAQ,CAAC,KAAoB,EAAe;EAC1D,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,UAAU,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;EACnG,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,KAAK,CAAC,QAAQ,CAAC;EAC3C,MAAM,OAAO,GAAG,iBAAiB,cAAc,CAAC,CAAC,EAAE;EACnD,yBACG,IAAI;IAAA,IAAC,IAAI;MAAA,OAAE,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAAA;IAAA;MAAA,4CAC7B,IAAI;QAAA;UAAA,OAAS,KAAK,CAAC,KAAK,GAAG,iBAAiB,KAAK,CAAC,KAAK,EAAE,GAAG,eAAe;QAAA;QAAA,mBAAmB;MAAO,+CAE7G,OAAO;QAAA,IAAC,SAAS;UAAA,OAAE,IAAI,KAAK,CAAC,KAAK,IAAI,CAAC,EAAE;QAAA;QAAE,EAAE,EAAE,OAAO;QAAA;QAAA;UAAA,OACpD,KAAK,CAAC,KAAK;QAAA;MAAA,gCAEb,IAAI;QAAA,IAAC,IAAI;UAAA,OAAE,KAAK,CAAC,KAAK,KAAK,SAAS;QAAA;QAAA;UAAA,8BACC,KAAK,CAAC,KAAK;QAAA;MAAA,gCAEhD,IAAI;QAAA,IAAC,IAAI;UAAA,OAAE,KAAK,CAAC,MAAM;QAAA;QAAA;UAAA,+BACe,KAAK,CAAC,MAAM;QAAA;MAAA,8BAGP,IAAI,CAAC,CAAC;IAAA;EAAA;AAI5D;AAEA,eAAe,QAAQ","ignoreList":[]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ssrElement as _$ssrElement } from "solid-js/web";
|
|
2
2
|
import { mergeProps as _$mergeProps } from "solid-js/web";
|
|
3
3
|
import { memo as _$memo } from "solid-js/web";
|
|
4
|
+
import { ssrStyle as _$ssrStyle } from "solid-js/web";
|
|
4
5
|
import { ssrAttribute as _$ssrAttribute } from "solid-js/web";
|
|
5
6
|
import { ssr as _$ssr } from "solid-js/web";
|
|
6
7
|
import { escape as _$escape } from "solid-js/web";
|
|
@@ -10,7 +11,7 @@ var _tmpl$ = ["<span class=\"k2b-count-chip\">", "</span>"],
|
|
|
10
11
|
_tmpl$3 = ["<span class=\"k2b-section__restricted\"", "><i class=\"ti ti-lock\" aria-hidden=\"true\"></i>", "</span>"],
|
|
11
12
|
_tmpl$4 = ["<span class=\"k2b-section__description\">", "</span>"],
|
|
12
13
|
_tmpl$5 = ["<span class=\"k2b-section__copy\"><span class=\"k2b-section__heading\">", "", "", "", "", "</span>", "</span>"],
|
|
13
|
-
_tmpl$6 = ["<span class=\"k2b-section__icon\" aria-hidden=\"true\"><i", "></i></span>"],
|
|
14
|
+
_tmpl$6 = ["<span class=\"k2b-section__icon\" aria-hidden=\"true\"", " style=\"", "\"><i", "></i></span>"],
|
|
14
15
|
_tmpl$7 = ["<span class=\"k2b-section__none\">", "</span>"],
|
|
15
16
|
_tmpl$8 = ["<button type=\"button\" class=\"k2b-section__toggle\"", "", ">", "<span class=\"k2b-section__chevron\" aria-hidden=\"true\"><i class=\"ti ti-chevron-down\"></i></span></button>"],
|
|
16
17
|
_tmpl$9 = ["<div role=\"status\"><span class=\"k2b-sr-only\">", "</span>", "</div>"],
|
|
@@ -30,7 +31,7 @@ import { Button } from "../actions/Button";
|
|
|
30
31
|
import { useUiMessages } from "../intl/messages";
|
|
31
32
|
import { useDetailPanelMessages } from "../layout/detail-panel-messages";
|
|
32
33
|
|
|
33
|
-
/** Named after the status tokens; a tone colours the
|
|
34
|
+
/** Named after the status tokens; a tone colours the symbol tile only, never the fill or the title (K8, K17). */
|
|
34
35
|
|
|
35
36
|
/** `sm` for detail panels and other narrow columns, `md` for topics on a full page. */
|
|
36
37
|
|
|
@@ -58,7 +59,7 @@ const Heading = props => _$createComponent(Dynamic, {
|
|
|
58
59
|
}
|
|
59
60
|
});
|
|
60
61
|
const SectionRoot = props => {
|
|
61
|
-
const [local, rest] = splitProps(props, ["title", "icon", "size", "frame", "tone", "restricted", "description", "count", "meta", "footer", "state", "errorMessage", "onRetry", "loadingRows", "level", "class", "children", "actions", "collapsible", "summary", "defaultOpen", "open", "onOpenChange", "disabled"]);
|
|
62
|
+
const [local, rest] = splitProps(props, ["title", "icon", "iconColor", "size", "frame", "tone", "restricted", "description", "count", "meta", "footer", "state", "errorMessage", "onRetry", "loadingRows", "level", "class", "children", "actions", "collapsible", "summary", "defaultOpen", "open", "onOpenChange", "disabled"]);
|
|
62
63
|
const ui = useUiMessages();
|
|
63
64
|
const counts = useDetailPanelMessages();
|
|
64
65
|
const frameDefault = useContext(SectionFrameDefault);
|
|
@@ -98,7 +99,9 @@ const SectionRoot = props => {
|
|
|
98
99
|
get when() {
|
|
99
100
|
return local.icon;
|
|
100
101
|
},
|
|
101
|
-
children: name => _$ssr(_tmpl$6, _$ssrAttribute("
|
|
102
|
+
children: name => _$ssr(_tmpl$6, _$ssrAttribute("data-color", local.iconColor ? "" : _$escape(undefined, true), false), _$ssrStyle(local.iconColor ? {
|
|
103
|
+
"--k2b-section-icon-color": local.iconColor
|
|
104
|
+
} : undefined), _$ssrAttribute("class", _$escape(name(), true), false))
|
|
102
105
|
}), _$ssr(_tmpl$5, _$escape(title), _$escape(_$createComponent(Show, {
|
|
103
106
|
get when() {
|
|
104
107
|
return local.count !== undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["surfaces/Section.tsx"],"sourcesContent":["import { children, createContext, createEffect, createSignal, createUniqueId, For, type JSX, Show, splitProps, useContext } from \"solid-js\";\nimport { Dynamic } from \"solid-js/web\";\nimport { Button } from \"../actions/Button\";\nimport { useUiMessages } from \"../intl/messages\";\nimport { useDetailPanelMessages } from \"../layout/detail-panel-messages\";\n\n/** Named after the status tokens; a tone colours the frame, the title, and the icon, never the fill. */\nexport type SectionTone = \"neutral\" | \"success\" | \"warning\" | \"danger\" | \"info\" | \"ai\";\n/** `sm` for detail panels and other narrow columns, `md` for topics on a full page. */\nexport type SectionSize = \"sm\" | \"md\";\n/** `line` draws the light 1 px frame; inside another frame a section always stands flat. */\nexport type SectionFrame = \"line\" | \"none\";\nexport type SectionState = \"ready\" | \"loading\" | \"error\";\n\ntype SectionBaseProps = Omit<JSX.HTMLAttributes<HTMLElement>, \"title\" | \"children\" | \"class\"> & {\n title: JSX.Element;\n icon?: string;\n size?: SectionSize;\n frame?: SectionFrame;\n tone?: SectionTone;\n /**\n * Marks a section that only some people see, such as \"Only with permission\": a lock and these words after the\n * title. It is part of the section's accessible name and combines with any tone.\n */\n restricted?: string;\n description?: JSX.Element;\n /** How many things the section lists, as a chip after the title; `0` reads \"None yet\". */\n count?: number;\n /** Short state after the title, such as \"2 of 4 done\". */\n meta?: JSX.Element;\n /** Commands for the whole topic, as a row of buttons at the end of the body. */\n footer?: JSX.Element;\n /** `loading` and `error` take the body's place; the heading stays where it is. */\n state?: SectionState;\n /** Says what did not load; defaults to a generic sentence. */\n errorMessage?: JSX.Element;\n /** Shows \"Try again\" in the error state. */\n onRetry?: () => void;\n /** Placeholder rows while loading, the number the loaded body usually shows. Defaults to 3. */\n loadingRows?: number;\n /** Heading level; defaults to 3, or 2 for `size=\"md\"`. */\n level?: 2 | 3;\n class?: string;\n};\n\nexport type SectionProps = SectionBaseProps &\n (\n | {\n children?: JSX.Element;\n /** Exactly one control at the end of the heading, such as \"+\" or one text button. */\n actions?: JSX.Element;\n collapsible?: false;\n summary?: never;\n defaultOpen?: never;\n open?: never;\n onOpenChange?: never;\n disabled?: never;\n }\n | {\n children: JSX.Element;\n actions?: never;\n collapsible: true;\n /** One line that says what the closed section holds, such as its newest entry; hidden while open. */\n summary?: JSX.Element;\n defaultOpen?: boolean;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n disabled?: boolean;\n }\n );\n\nexport type SectionPartProps = {\n title: JSX.Element;\n children: JSX.Element;\n class?: string;\n};\n\ntype SectionComponent = ((props: SectionProps) => JSX.Element) & {\n Part: (props: SectionPartProps) => JSX.Element;\n};\n\nconst SectionLevel = createContext<number>(2);\n\n/**\n * The frame a section draws when it passes none. A host that frames its topics itself, such as a detail panel, sets\n * `none`; everywhere else a section is a card.\n */\nexport const SectionFrameDefault = createContext<SectionFrame>(\"line\");\n\nconst Heading = (props: { level: number; id?: string; class: string; children: JSX.Element }): JSX.Element => (\n <Dynamic component={`h${props.level}`} id={props.id} class={props.class}>\n {props.children}\n </Dynamic>\n);\n\nconst SectionRoot = (props: SectionProps): JSX.Element => {\n const [local, rest] = splitProps(props, [\n \"title\",\n \"icon\",\n \"size\",\n \"frame\",\n \"tone\",\n \"restricted\",\n \"description\",\n \"count\",\n \"meta\",\n \"footer\",\n \"state\",\n \"errorMessage\",\n \"onRetry\",\n \"loadingRows\",\n \"level\",\n \"class\",\n \"children\",\n \"actions\",\n \"collapsible\",\n \"summary\",\n \"defaultOpen\",\n \"open\",\n \"onOpenChange\",\n \"disabled\",\n ]);\n const ui = useUiMessages();\n const counts = useDetailPanelMessages();\n const frameDefault = useContext(SectionFrameDefault);\n const id = `k2b-section-${createUniqueId()}`;\n const titleId = `${id}-title`;\n const restrictedId = `${id}-restricted`;\n const bodyId = `${id}-body`;\n const level = () => local.level ?? (local.size === \"md\" ? 2 : 3);\n const state = () => local.state ?? \"ready\";\n const [internalOpen, setInternalOpen] = createSignal(local.defaultOpen ?? false);\n const open = () => !local.collapsible || (local.open ?? internalOpen());\n let toggleButton: HTMLButtonElement | undefined;\n let body: HTMLDivElement | undefined;\n\n const toggle = () => {\n if (local.disabled) return;\n const next = !open();\n if (local.open === undefined) setInternalOpen(next);\n local.onOpenChange?.(next);\n };\n // A parent may close the section while focus is inside it; focus then returns to the toggle instead of the page.\n createEffect(() => {\n if (open()) return;\n queueMicrotask(() => {\n const active = body?.ownerDocument.activeElement;\n if (!open() && active && body?.contains(active)) toggleButton?.focus();\n });\n });\n\n // Resolve once and only while ready: reading `children` twice would build the body twice.\n const resolved = children(() => (state() === \"ready\" ? local.children : undefined));\n // A JSX action must also be built once: checking the slot and then reading it again creates different hydration keys.\n const resolvedActions = children(() => local.actions);\n const hasBody = () => local.collapsible || state() !== \"ready\" || Boolean(resolved.toArray().length) || Boolean(local.footer);\n\n /** Icon, then the title with its count, state, and restricted marker in one row, then the description. */\n const headingRow = (title: JSX.Element, summary?: JSX.Element) => (\n <>\n <Show when={local.icon}>\n {(name) => (\n <span class=\"k2b-section__icon\" aria-hidden=\"true\">\n <i class={name()} />\n </span>\n )}\n </Show>\n <span class=\"k2b-section__copy\">\n <span class=\"k2b-section__heading\">\n {title}\n <Show when={local.count !== undefined}>\n <Show when={local.count! > 0} fallback={<span class=\"k2b-section__none\">{counts().noneYet}</span>}>\n <span class=\"k2b-count-chip\">{local.count}</span>\n </Show>\n </Show>\n <Show when={local.meta}>\n <span class=\"k2b-section__meta\">{local.meta}</span>\n </Show>\n <Show when={local.restricted}>\n <span class=\"k2b-section__restricted\" id={restrictedId}>\n <i class=\"ti ti-lock\" aria-hidden=\"true\" />\n {local.restricted}\n </span>\n </Show>\n {summary}\n </span>\n <Show when={local.description}>\n <span class=\"k2b-section__description\">{local.description}</span>\n </Show>\n </span>\n </>\n );\n\n return (\n <section\n {...rest}\n class={local.class ? `k2b-section ${local.class}` : \"k2b-section\"}\n data-size={local.size ?? \"sm\"}\n data-frame={local.frame ?? frameDefault}\n data-tone={local.tone && local.tone !== \"neutral\" ? local.tone : undefined}\n data-icon={local.icon ? \"true\" : undefined}\n data-collapsible={local.collapsible ? \"true\" : undefined}\n data-open={local.collapsible ? String(open()) : undefined}\n data-summary={local.collapsible && local.summary ? \"true\" : undefined}\n aria-labelledby={local.restricted ? `${titleId} ${restrictedId}` : titleId}\n aria-busy={state() === \"loading\" ? \"true\" : undefined}\n >\n <Show\n when={local.collapsible}\n fallback={\n <header class=\"k2b-section__header\">\n {headingRow(\n <Heading level={level()} id={titleId} class=\"k2b-section__title\">\n {local.title}\n </Heading>,\n )}\n <Show when={resolvedActions()}>\n <div class=\"k2b-section__actions\">{resolvedActions()}</div>\n </Show>\n </header>\n }\n >\n {/* The whole heading row is one disclosure button inside the heading, so the region keeps its name. */}\n <Heading level={level()} class=\"k2b-section__header\">\n <button\n ref={toggleButton}\n type=\"button\"\n class=\"k2b-section__toggle\"\n aria-expanded={open()}\n aria-controls={bodyId}\n disabled={local.disabled}\n // A native listener, not Solid's delegated `onClick`: delegation is registered once per document when\n // this module loads, so a section rendered into a later document (a test harness, an iframe) would\n // never toggle. The shared Button registers its delegation at render time and has no such gap.\n on:click={toggle}\n >\n {headingRow(\n <span id={titleId} class=\"k2b-section__title\">\n {local.title}\n </span>,\n <Show when={local.summary}>\n <span class=\"k2b-section__summary k2b-truncate-fade\">{local.summary}</span>\n </Show>,\n )}\n <span class=\"k2b-section__chevron\" aria-hidden=\"true\">\n <i class=\"ti ti-chevron-down\" />\n </span>\n </button>\n </Heading>\n </Show>\n <Show when={hasBody()}>\n <div ref={body} id={bodyId} class=\"k2b-section__body\" hidden={!open()}>\n <Show when={state() === \"loading\"}>\n {/* Placeholder rows at the height of loaded rows; their widths vary in CSS. */}\n <div role=\"status\">\n <span class=\"k2b-sr-only\">{ui().loading}</span>\n <For each={Array.from({ length: Math.max(1, local.loadingRows ?? 3) })}>\n {() => (\n <div class=\"k2b-section__skeleton-row\" aria-hidden=\"true\">\n <span />\n <span />\n </div>\n )}\n </For>\n </div>\n </Show>\n <Show when={state() === \"error\"}>\n <div class=\"k2b-section__error\" role=\"alert\">\n <i class=\"ti ti-alert-circle\" aria-hidden=\"true\" />\n <span>{local.errorMessage ?? ui().couldNotLoadData}</span>\n </div>\n <Show when={local.onRetry}>\n {(retry) => (\n <div class=\"k2b-section__footer\">\n <Button type=\"button\" size=\"sm\" variant=\"secondary\" onClick={() => retry()()}>\n <i class=\"ti ti-refresh\" aria-hidden=\"true\" />\n {ui().retry}\n </Button>\n </div>\n )}\n </Show>\n </Show>\n {resolved()}\n <Show when={state() === \"ready\" && local.footer}>\n <div class=\"k2b-section__footer\">{local.footer}</div>\n </Show>\n </div>\n </Show>\n </section>\n );\n};\n\n/** A sub-topic inside a section, such as \"Contact\" or \"Address\": a small heading, no frame of its own. */\nconst SectionPart = (props: SectionPartProps): JSX.Element => {\n const level = useContext(SectionLevel);\n const id = `k2b-section-part-${createUniqueId()}`;\n return (\n <div class={props.class ? `k2b-section__part ${props.class}` : \"k2b-section__part\"} role=\"group\" aria-labelledby={id}>\n <Heading level={Math.min(level + 1, 6)} id={id} class=\"k2b-section__part-title\">\n {props.title}\n </Heading>\n {props.children}\n </div>\n );\n};\n\n/**\n * One topic, in a detail panel or on a page: an icon, a title with its count, at most one control, and its\n * content. On a page a section is a card with the light 1 px frame; inside another frame, and in a detail panel, it\n * stands flat, so cards never nest.\n */\nconst SectionWithLevel = (props: SectionProps): JSX.Element => (\n // The level is provided before the body is built, so a part's heading sits one level below this section's.\n <SectionLevel.Provider value={props.level ?? (props.size === \"md\" ? 2 : 3)}>\n <SectionRoot {...props} />\n </SectionLevel.Provider>\n);\n\nexport const Section = SectionWithLevel as SectionComponent;\nSection.Part = SectionPart;\n\nexport default Section;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,GAAG,EAAY,IAAI,EAAE,UAAU,EAAE,UAAU,QAAQ,UAAU;AAC3I,SAAS,OAAO,QAAQ,cAAc;AACtC,SAAS,MAAM,QAAQ,mBAAmB;AAC1C,SAAS,aAAa,QAAQ,kBAAkB;AAChD,SAAS,sBAAsB,QAAQ,iCAAiC;;AAExE;;AAEA;;AAEA;;AAuEA,MAAM,YAAY,GAAG,aAAa,CAAS,CAAC,CAAC;;AAE7C;AACA;AACA;AACA;AACA,OAAO,MAAM,mBAAmB,GAAG,aAAa,CAAe,MAAM,CAAC;AAEtE,MAAM,OAAO,GAAI,KAA2E,sBACzF,OAAO;EAAA,IAAC,SAAS;IAAA,OAAE,IAAI,KAAK,CAAC,KAAK,EAAE;EAAA;EAAA,IAAE,EAAE;IAAA,OAAE,KAAK,CAAC,EAAE;EAAA;EAAA;IAAA,OAAS,KAAK,CAAC,KAAK;EAAA;EAAA;IAAA,OACpE,KAAK,CAAC,QAAQ;EAAA;AAAA,EAElB;AAED,MAAM,WAAW,GAAI,KAAmB,IAAkB;EACxD,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,UAAU,CAAC,KAAK,EAAE,CACtC,OAAO,EACP,MAAM,EACN,MAAM,EACN,OAAO,EACP,MAAM,EACN,YAAY,EACZ,aAAa,EACb,OAAO,EACP,MAAM,EACN,QAAQ,EACR,OAAO,EACP,cA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AAC3D,OAAO,CAAC,IAAI,GAAG,WAAW;AAE1B,eAAe,OAAO","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["surfaces/Section.tsx"],"sourcesContent":["import { children, createContext, createEffect, createSignal, createUniqueId, For, type JSX, Show, splitProps, useContext } from \"solid-js\";\nimport { Dynamic } from \"solid-js/web\";\nimport { Button } from \"../actions/Button\";\nimport { useUiMessages } from \"../intl/messages\";\nimport { useDetailPanelMessages } from \"../layout/detail-panel-messages\";\n\n/** Named after the status tokens; a tone colours the symbol tile only, never the fill or the title (K8, K17). */\nexport type SectionTone = \"neutral\" | \"success\" | \"warning\" | \"danger\" | \"info\" | \"ai\";\n/** `sm` for detail panels and other narrow columns, `md` for topics on a full page. */\nexport type SectionSize = \"sm\" | \"md\";\n/** `line` draws the light 1 px frame; inside another frame a section always stands flat. */\nexport type SectionFrame = \"line\" | \"none\";\nexport type SectionState = \"ready\" | \"loading\" | \"error\";\n\ntype SectionBaseProps = Omit<JSX.HTMLAttributes<HTMLElement>, \"title\" | \"children\" | \"class\"> & {\n title: JSX.Element;\n icon?: string;\n /**\n * The colour of the section's area as a CSS colour, such as money or goods on a dense record page (K17). It sets the\n * icon in a 20 px tile of that colour, the one place the area colour shows. Never a status hue, never near the AI\n * plum; a `tone` wins.\n */\n iconColor?: string;\n size?: SectionSize;\n frame?: SectionFrame;\n tone?: SectionTone;\n /**\n * Marks a section that only some people see, such as \"Only with permission\": a lock and these words after the\n * title. It is part of the section's accessible name and combines with any tone.\n */\n restricted?: string;\n description?: JSX.Element;\n /** How many things the section lists, as a chip after the title; `0` reads \"None yet\". */\n count?: number;\n /** Short state after the title, such as \"2 of 4 done\". */\n meta?: JSX.Element;\n /** Commands for the whole topic, as a row of buttons at the end of the body. */\n footer?: JSX.Element;\n /** `loading` and `error` take the body's place; the heading stays where it is. */\n state?: SectionState;\n /** Says what did not load; defaults to a generic sentence. */\n errorMessage?: JSX.Element;\n /** Shows \"Try again\" in the error state. */\n onRetry?: () => void;\n /** Placeholder rows while loading, the number the loaded body usually shows. Defaults to 3. */\n loadingRows?: number;\n /** Heading level; defaults to 3, or 2 for `size=\"md\"`. */\n level?: 2 | 3;\n class?: string;\n};\n\nexport type SectionProps = SectionBaseProps &\n (\n | {\n children?: JSX.Element;\n /** At most two quiet controls at the end of the heading, such as \"+\" or text buttons; they read grey. */\n actions?: JSX.Element;\n collapsible?: false;\n summary?: never;\n defaultOpen?: never;\n open?: never;\n onOpenChange?: never;\n disabled?: never;\n }\n | {\n children: JSX.Element;\n actions?: never;\n collapsible: true;\n /** One line that says what the closed section holds, such as its newest entry; hidden while open. */\n summary?: JSX.Element;\n defaultOpen?: boolean;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n disabled?: boolean;\n }\n );\n\nexport type SectionPartProps = {\n title: JSX.Element;\n children: JSX.Element;\n class?: string;\n};\n\ntype SectionComponent = ((props: SectionProps) => JSX.Element) & {\n Part: (props: SectionPartProps) => JSX.Element;\n};\n\nconst SectionLevel = createContext<number>(2);\n\n/**\n * The frame a section draws when it passes none. A host that frames its topics itself, such as a detail panel, sets\n * `none`; everywhere else a section is a card.\n */\nexport const SectionFrameDefault = createContext<SectionFrame>(\"line\");\n\nconst Heading = (props: { level: number; id?: string; class: string; children: JSX.Element }): JSX.Element => (\n <Dynamic component={`h${props.level}`} id={props.id} class={props.class}>\n {props.children}\n </Dynamic>\n);\n\nconst SectionRoot = (props: SectionProps): JSX.Element => {\n const [local, rest] = splitProps(props, [\n \"title\",\n \"icon\",\n \"iconColor\",\n \"size\",\n \"frame\",\n \"tone\",\n \"restricted\",\n \"description\",\n \"count\",\n \"meta\",\n \"footer\",\n \"state\",\n \"errorMessage\",\n \"onRetry\",\n \"loadingRows\",\n \"level\",\n \"class\",\n \"children\",\n \"actions\",\n \"collapsible\",\n \"summary\",\n \"defaultOpen\",\n \"open\",\n \"onOpenChange\",\n \"disabled\",\n ]);\n const ui = useUiMessages();\n const counts = useDetailPanelMessages();\n const frameDefault = useContext(SectionFrameDefault);\n const id = `k2b-section-${createUniqueId()}`;\n const titleId = `${id}-title`;\n const restrictedId = `${id}-restricted`;\n const bodyId = `${id}-body`;\n const level = () => local.level ?? (local.size === \"md\" ? 2 : 3);\n const state = () => local.state ?? \"ready\";\n const [internalOpen, setInternalOpen] = createSignal(local.defaultOpen ?? false);\n const open = () => !local.collapsible || (local.open ?? internalOpen());\n let toggleButton: HTMLButtonElement | undefined;\n let body: HTMLDivElement | undefined;\n\n const toggle = () => {\n if (local.disabled) return;\n const next = !open();\n if (local.open === undefined) setInternalOpen(next);\n local.onOpenChange?.(next);\n };\n // A parent may close the section while focus is inside it; focus then returns to the toggle instead of the page.\n createEffect(() => {\n if (open()) return;\n queueMicrotask(() => {\n const active = body?.ownerDocument.activeElement;\n if (!open() && active && body?.contains(active)) toggleButton?.focus();\n });\n });\n\n // Resolve once and only while ready: reading `children` twice would build the body twice.\n const resolved = children(() => (state() === \"ready\" ? local.children : undefined));\n // A JSX action must also be built once: checking the slot and then reading it again creates different hydration keys.\n const resolvedActions = children(() => local.actions);\n const hasBody = () => local.collapsible || state() !== \"ready\" || Boolean(resolved.toArray().length) || Boolean(local.footer);\n\n /** Icon, then the title with its count, state, and restricted marker in one row, then the description. */\n const headingRow = (title: JSX.Element, summary?: JSX.Element) => (\n <>\n <Show when={local.icon}>\n {(name) => (\n <span\n class=\"k2b-section__icon\"\n aria-hidden=\"true\"\n data-color={local.iconColor ? \"\" : undefined}\n style={local.iconColor ? { \"--k2b-section-icon-color\": local.iconColor } : undefined}\n >\n <i class={name()} />\n </span>\n )}\n </Show>\n <span class=\"k2b-section__copy\">\n <span class=\"k2b-section__heading\">\n {title}\n <Show when={local.count !== undefined}>\n <Show when={local.count! > 0} fallback={<span class=\"k2b-section__none\">{counts().noneYet}</span>}>\n <span class=\"k2b-count-chip\">{local.count}</span>\n </Show>\n </Show>\n <Show when={local.meta}>\n <span class=\"k2b-section__meta\">{local.meta}</span>\n </Show>\n <Show when={local.restricted}>\n <span class=\"k2b-section__restricted\" id={restrictedId}>\n <i class=\"ti ti-lock\" aria-hidden=\"true\" />\n {local.restricted}\n </span>\n </Show>\n {summary}\n </span>\n <Show when={local.description}>\n <span class=\"k2b-section__description\">{local.description}</span>\n </Show>\n </span>\n </>\n );\n\n return (\n <section\n {...rest}\n class={local.class ? `k2b-section ${local.class}` : \"k2b-section\"}\n data-size={local.size ?? \"sm\"}\n data-frame={local.frame ?? frameDefault}\n data-tone={local.tone && local.tone !== \"neutral\" ? local.tone : undefined}\n data-icon={local.icon ? \"true\" : undefined}\n data-collapsible={local.collapsible ? \"true\" : undefined}\n data-open={local.collapsible ? String(open()) : undefined}\n data-summary={local.collapsible && local.summary ? \"true\" : undefined}\n aria-labelledby={local.restricted ? `${titleId} ${restrictedId}` : titleId}\n aria-busy={state() === \"loading\" ? \"true\" : undefined}\n >\n <Show\n when={local.collapsible}\n fallback={\n <header class=\"k2b-section__header\">\n {headingRow(\n <Heading level={level()} id={titleId} class=\"k2b-section__title\">\n {local.title}\n </Heading>,\n )}\n <Show when={resolvedActions()}>\n <div class=\"k2b-section__actions\">{resolvedActions()}</div>\n </Show>\n </header>\n }\n >\n {/* The whole heading row is one disclosure button inside the heading, so the region keeps its name. */}\n <Heading level={level()} class=\"k2b-section__header\">\n <button\n ref={toggleButton}\n type=\"button\"\n class=\"k2b-section__toggle\"\n aria-expanded={open()}\n aria-controls={bodyId}\n disabled={local.disabled}\n // A native listener, not Solid's delegated `onClick`: delegation is registered once per document when\n // this module loads, so a section rendered into a later document (a test harness, an iframe) would\n // never toggle. The shared Button registers its delegation at render time and has no such gap.\n on:click={toggle}\n >\n {headingRow(\n <span id={titleId} class=\"k2b-section__title\">\n {local.title}\n </span>,\n <Show when={local.summary}>\n <span class=\"k2b-section__summary k2b-truncate-fade\">{local.summary}</span>\n </Show>,\n )}\n <span class=\"k2b-section__chevron\" aria-hidden=\"true\">\n <i class=\"ti ti-chevron-down\" />\n </span>\n </button>\n </Heading>\n </Show>\n <Show when={hasBody()}>\n <div ref={body} id={bodyId} class=\"k2b-section__body\" hidden={!open()}>\n <Show when={state() === \"loading\"}>\n {/* Placeholder rows at the height of loaded rows; their widths vary in CSS. */}\n <div role=\"status\">\n <span class=\"k2b-sr-only\">{ui().loading}</span>\n <For each={Array.from({ length: Math.max(1, local.loadingRows ?? 3) })}>\n {() => (\n <div class=\"k2b-section__skeleton-row\" aria-hidden=\"true\">\n <span />\n <span />\n </div>\n )}\n </For>\n </div>\n </Show>\n <Show when={state() === \"error\"}>\n <div class=\"k2b-section__error\" role=\"alert\">\n <i class=\"ti ti-alert-circle\" aria-hidden=\"true\" />\n <span>{local.errorMessage ?? ui().couldNotLoadData}</span>\n </div>\n <Show when={local.onRetry}>\n {(retry) => (\n <div class=\"k2b-section__footer\">\n <Button type=\"button\" size=\"sm\" variant=\"secondary\" onClick={() => retry()()}>\n <i class=\"ti ti-refresh\" aria-hidden=\"true\" />\n {ui().retry}\n </Button>\n </div>\n )}\n </Show>\n </Show>\n {resolved()}\n <Show when={state() === \"ready\" && local.footer}>\n <div class=\"k2b-section__footer\">{local.footer}</div>\n </Show>\n </div>\n </Show>\n </section>\n );\n};\n\n/** A sub-topic inside a section, such as \"Contact\" or \"Address\": a small heading, no frame of its own. */\nconst SectionPart = (props: SectionPartProps): JSX.Element => {\n const level = useContext(SectionLevel);\n const id = `k2b-section-part-${createUniqueId()}`;\n return (\n <div class={props.class ? `k2b-section__part ${props.class}` : \"k2b-section__part\"} role=\"group\" aria-labelledby={id}>\n <Heading level={Math.min(level + 1, 6)} id={id} class=\"k2b-section__part-title\">\n {props.title}\n </Heading>\n {props.children}\n </div>\n );\n};\n\n/**\n * One topic, in a detail panel or on a page: an icon, a title with its count, at most one control, and its\n * content. On a page a section is a card with the light 1 px frame; inside another frame, and in a detail panel, it\n * stands flat, so cards never nest.\n */\nconst SectionWithLevel = (props: SectionProps): JSX.Element => (\n // The level is provided before the body is built, so a part's heading sits one level below this section's.\n <SectionLevel.Provider value={props.level ?? (props.size === \"md\" ? 2 : 3)}>\n <SectionRoot {...props} />\n </SectionLevel.Provider>\n);\n\nexport const Section = SectionWithLevel as SectionComponent;\nSection.Part = SectionPart;\n\nexport default Section;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,GAAG,EAAY,IAAI,EAAE,UAAU,EAAE,UAAU,QAAQ,UAAU;AAC3I,SAAS,OAAO,QAAQ,cAAc;AACtC,SAAS,MAAM,QAAQ,mBAAmB;AAC1C,SAAS,aAAa,QAAQ,kBAAkB;AAChD,SAAS,sBAAsB,QAAQ,iCAAiC;;AAExE;;AAEA;;AAEA;;AA6EA,MAAM,YAAY,GAAG,aAAa,CAAS,CAAC,CAAC;;AAE7C;AACA;AACA;AACA;AACA,OAAO,MAAM,mBAAmB,GAAG,aAAa,CAAe,MAAM,CAAC;AAEtE,MAAM,OAAO,GAAI,KAA2E,sBACzF,OAAO;EAAA,IAAC,SAAS;IAAA,OAAE,IAAI,KAAK,CAAC,KAAK,EAAE;EAAA;EAAA,IAAE,EAAE;IAAA,OAAE,KAAK,CAAC,EAAE;EAAA;EAAA;IAAA,OAAS,KAAK,CAAC,KAAK;EAAA;EAAA;IAAA,OACpE,KAAK,CAAC,QAAQ;EAAA;AAAA,EAElB;AAED,MAAM,WAAW,GAAI,KAAmB,IAAkB;EACxD,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,UAAU,CAAC,KAAK,EAAE,CACtC,OAAO,EACP,MAAM,EACN,WAAW,EACX,MAAM,EACN,OAAO,EACP,MAAM,EACN,YAAY,EACZ,aAAa,EACb,OAAO,EACP,MAAM,EACN,QAAQ,EACR,OAAO,EACP,cAAc,EACd,SAAS,EACT,aAAa,EACb,OAAO,EACP,OAAO,EACP,UAAU,EACV,SAAS,EACT,aAAa,EACb,SAAS,EACT,aAAa,EACb,MAAM,EACN,cAAc,EACd,UAAU,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oC;AAC3D,OAAO,CAAC,IAAI,GAAG,WAAW;AAE1B,eAAe,OAAO","ignoreList":[]}
|
|
@@ -41,6 +41,8 @@ function Body(props) {
|
|
|
41
41
|
// A plain figure keeps its change off the figure's line: the third line holds it with the comparison.
|
|
42
42
|
const surface = useStatGridSurface();
|
|
43
43
|
const plain = () => surface() === "plain";
|
|
44
|
+
// Flat chat figures reserve a support placeholder only when that line has content.
|
|
45
|
+
const supportWaits = () => surface() !== "flat" || Boolean(props.compare || props.sub || props.accent || props.stale || props.trend && props.trend.length > 1);
|
|
44
46
|
const badge = delta => _$createComponent(DeltaBadge, {
|
|
45
47
|
delta: delta,
|
|
46
48
|
get compare() {
|
|
@@ -76,7 +78,7 @@ function Body(props) {
|
|
|
76
78
|
children: icon => _$ssr(_tmpl$8, _$ssrAttribute("data-tone", _$escape(props.tone ?? "zinc", true), false), _$ssrAttribute("class", _$escape(icon(), true), false))
|
|
77
79
|
})), _$ssrAttribute("data-size", _$escape(size(), true), false), _$escape(props.label)), _$ssr(_tmpl$5, _$escape(_$createComponent(Switch, {
|
|
78
80
|
get fallback() {
|
|
79
|
-
return [_$ssr(_tmpl$9, `k2b-stat-cell__value ${_$escape(props.valueClass ?? "", true)}`, _$ssrAttribute("data-size", _$escape(size(), true), false) + _$ssrAttribute("data-empty", _$escape(empty() || undefined, true), false) + _$ssrAttribute("title", _$escape(props.title, true), false), _$escape(_$createComponent(Show, {
|
|
81
|
+
return [_$ssr(_tmpl$9, `k2b-stat-cell__value ${_$escape(props.valueClass ?? "", true)}`, _$ssrAttribute("data-tone", _$escape(props.valueTone, true), false) + _$ssrAttribute("data-size", _$escape(size(), true), false) + _$ssrAttribute("data-empty", _$escape(empty() || undefined, true), false) + _$ssrAttribute("title", _$escape(props.title, true), false), _$escape(_$createComponent(Show, {
|
|
80
82
|
get when() {
|
|
81
83
|
return !empty();
|
|
82
84
|
},
|
|
@@ -179,7 +181,7 @@ function Body(props) {
|
|
|
179
181
|
get children() {
|
|
180
182
|
return [_$createComponent(Match, {
|
|
181
183
|
get when() {
|
|
182
|
-
return props.status === "loading";
|
|
184
|
+
return _$memo(() => props.status === "loading")() && supportWaits();
|
|
183
185
|
},
|
|
184
186
|
get children() {
|
|
185
187
|
return _$ssr(_tmpl$6);
|
|
@@ -212,6 +214,8 @@ export function StatCell(props) {
|
|
|
212
214
|
// A plain figure has no surface; its tone colours the figure instead of only the icon chip.
|
|
213
215
|
const surface = useStatGridSurface();
|
|
214
216
|
const plain = () => surface() === "plain";
|
|
217
|
+
// Compact flat figures keep their support line directly below the value.
|
|
218
|
+
const compact = () => !props.delta && !props.compare && !(props.trend?.length ?? 0);
|
|
215
219
|
const variant = () => plain() ? "plain" : undefined;
|
|
216
220
|
const tone = () => plain() ? props.tone : undefined;
|
|
217
221
|
return _$createComponent(Show
|
|
@@ -221,10 +225,10 @@ export function StatCell(props) {
|
|
|
221
225
|
return _$memo(() => !!(props.href && !props.status))() && !(props.stale && props.onRetry);
|
|
222
226
|
},
|
|
223
227
|
get fallback() {
|
|
224
|
-
return _$ssr(_tmpl$16, _$ssrAttribute("data-size", _$escape(size(), true), false) + _$ssrAttribute("data-surface", plain() ? _$escape(undefined, true) : _$escape(surface(), true), false) + _$ssrAttribute("data-variant", _$escape(variant(), true), false) + _$ssrAttribute("data-tone", _$escape(tone(), true), false) + _$ssrAttribute("data-wrap", _$escape(props.wrap || undefined, true), false) + _$ssrAttribute("data-delta-placement", _$escape(props.deltaPlacement, true), false) + _$ssrAttribute("data-status", _$escape(props.status, true), false) + _$ssrAttribute("aria-busy", _$escape(props.status === "loading" || undefined, true), false), _$escape(_$createComponent(Body, props)));
|
|
228
|
+
return _$ssr(_tmpl$16, _$ssrAttribute("data-size", _$escape(size(), true), false) + _$ssrAttribute("data-surface", plain() ? _$escape(undefined, true) : _$escape(surface(), true), false) + _$ssrAttribute("data-variant", _$escape(variant(), true), false) + _$ssrAttribute("data-tone", _$escape(tone(), true), false) + _$ssrAttribute("data-wrap", _$escape(props.wrap || undefined, true), false) + _$ssrAttribute("data-plain", _$escape(compact() || undefined, true), false) + _$ssrAttribute("data-delta-placement", _$escape(props.deltaPlacement, true), false) + _$ssrAttribute("data-status", _$escape(props.status, true), false) + _$ssrAttribute("aria-busy", _$escape(props.status === "loading" || undefined, true), false), _$escape(_$createComponent(Body, props)));
|
|
225
229
|
},
|
|
226
230
|
get children() {
|
|
227
|
-
return _$ssr(_tmpl$15, _$ssrAttribute("href", _$escape(props.href, true), false), _$ssrAttribute("data-size", _$escape(size(), true), false) + _$ssrAttribute("data-surface", plain() ? _$escape(undefined, true) : _$escape(surface(), true), false) + _$ssrAttribute("data-variant", _$escape(variant(), true), false) + _$ssrAttribute("data-tone", _$escape(tone(), true), false) + _$ssrAttribute("data-wrap", _$escape(props.wrap || undefined, true), false) + _$ssrAttribute("data-delta-placement", _$escape(props.deltaPlacement, true), false), _$escape(_$createComponent(Body, props)));
|
|
231
|
+
return _$ssr(_tmpl$15, _$ssrAttribute("href", _$escape(props.href, true), false), _$ssrAttribute("data-size", _$escape(size(), true), false) + _$ssrAttribute("data-surface", plain() ? _$escape(undefined, true) : _$escape(surface(), true), false) + _$ssrAttribute("data-variant", _$escape(variant(), true), false) + _$ssrAttribute("data-tone", _$escape(tone(), true), false) + _$ssrAttribute("data-wrap", _$escape(props.wrap || undefined, true), false) + _$ssrAttribute("data-plain", _$escape(compact() || undefined, true), false) + _$ssrAttribute("data-delta-placement", _$escape(props.deltaPlacement, true), false), _$escape(_$createComponent(Body, props)));
|
|
228
232
|
}
|
|
229
233
|
});
|
|
230
234
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["surfaces/StatCell.tsx"],"sourcesContent":["import { type JSX, Match, Show, Switch } from \"solid-js\";\nimport type { ChartNumberFormat } from \"../charts/description\";\nimport { ChartSparkline } from \"../content/ChartSparkline\";\nimport type { ChartTooltipFormatter } from \"../content/chart-inspection-core\";\nimport { useLocale } from \"../intl/locale\";\nimport type { AccentColor } from \"../semantics\";\nimport { DeltaBadge } from \"./delta-badge\";\nimport { type StatGridSize, useStatGridSize, useStatGridSurface } from \"./StatGrid\";\nimport { useStatCellMessages } from \"./stat-cell-messages\";\n\nexport type StatCellTone = AccentColor;\n\nexport type StatCellAccent = {\n tone: StatCellTone;\n icon: string;\n text?: string;\n};\n\n/**\n * The change against a comparison period. `unit: \"ratio\"` (default) reads `0.082` as `+8.2 %`; `\"points\"` is the\n * difference of two shares in ratio units, so `0.031` reads `+3.1 pts`. Only with `better` does the badge carry a tone\n * and say \"better\" or \"worse\"; without it the change stays unrated.\n */\nexport type StatCellDelta = {\n value: number;\n unit?: \"ratio\" | \"points\" | \"absolute\";\n /** Existing measures can express a change in their own unit instead of a ratio. */\n format?: ChartNumberFormat;\n better?: \"up\" | \"down\";\n};\n\n/** The value the change compares against, shown under the figure, such as \"Last month 44,560\". */\nexport type StatCellCompare = {\n label: string;\n value: string | number;\n};\n\nexport type StatCellSize = StatGridSize;\n\nexport type StatCellProps = {\n label: string;\n /** The figure. `null` shows the empty dash; `sub` then says why. */\n value: string | number | JSX.Element | null;\n sub?: string;\n valueClass?: string;\n /** An icon in a chip before the label, in `tone`. `\"in\"` and `\"out\"` are the money colours of `FlowAmount`. */\n icon?: string;\n /**\n * The chip colour of `icon`. Defaults to zinc. In a `plain` grid, `amber` (a warning) and `red` (a problem) also\n * colour the figure and its third line; say what is wrong there with `accent` (icon and word).\n */\n tone?: StatCellTone | \"in\" | \"out\";\n accent?: StatCellAccent;\n /** The change against `compare`; beside the figure, and always on the third line in a `plain` grid. */\n delta?: StatCellDelta;\n /** Keep the figure and change on separate rows, including while loading. Defaults to beside the figure. */\n deltaPlacement?: \"below\";\n compare?: StatCellCompare;\n href?: string;\n title?: string;\n trend?: readonly number[];\n /**\n * Replaces the default trend tooltip in browser code, for example with a period title or a unit.\n * `selection.datum.index` is the source index into `trend`.\n */\n trendTooltip?: ChartTooltipFormatter;\n size?: StatCellSize;\n /**\n * Wraps the label, value and support line instead of truncating them. Use it for a cell whose height nothing\n * reserves, such as one figure on its own; cells compared in a row keep one line each.\n */\n wrap?: boolean;\n /** `\"loading\"` keeps the tile's size with placeholders; `\"error\"` says the figure did not load. */\n status?: \"loading\" | \"error\";\n /** Offers \"Try again\" after an error and \"Reload\" beside `stale`. */\n onRetry?: () => void;\n /** The figure is not current: a short note such as \"As of 09:12 · not current\" replaces the support line. */\n stale?: string;\n};\n\nfunction Body(props: StatCellProps): JSX.Element {\n const gridSize = useStatGridSize();\n // A plain figure keeps its change off the figure's line: the third line holds it with the comparison.\n const surface = useStatGridSurface();\n const plain = () => surface() === \"plain\";\n const badge = (delta: StatCellDelta) => <DeltaBadge delta={delta} compare={props.compare} />;\n const size = () => props.size ?? gridSize;\n const accent = () => props.accent;\n const locale = useLocale();\n const t = useStatCellMessages();\n const defaultTrendTooltip: ChartTooltipFormatter = ({ datum }) => {\n const y = datum.values.find((field) => field.key === \"y\")?.value ?? \"\";\n return {\n rows: [\n { label: props.label, value: typeof y === \"number\" ? new Intl.NumberFormat(locale(), { maximumFractionDigits: 6 }).format(y) : y },\n ],\n };\n };\n const compareValue = () => {\n const value = props.compare?.value;\n return typeof value === \"number\" ? new Intl.NumberFormat(locale()).format(value) : value;\n };\n const empty = () => props.value === null || props.value === undefined || props.value === \"\";\n return (\n <>\n <div class=\"k2b-stat-cell__head\">\n <Show when={props.icon}>\n {(icon) => (\n <span class=\"k2b-stat-cell__icon k2b-icon-tile\" data-tone={props.tone ?? \"zinc\"} aria-hidden=\"true\">\n <i class={icon()} />\n </span>\n )}\n </Show>\n <span class=\"k2b-stat-cell__label\" data-size={size()}>\n {props.label}\n </span>\n </div>\n <div class=\"k2b-stat-cell__main\">\n <Switch\n fallback={\n <>\n <span\n class={`k2b-stat-cell__value ${props.valueClass ?? \"\"}`}\n data-size={size()}\n data-empty={empty() || undefined}\n title={props.title}\n >\n {/* A missing figure is the shared empty dash, named for screen readers instead of read as a dash. */}\n <Show\n when={!empty()}\n fallback={\n <span role=\"img\" aria-label={t().noValue}>\n —\n </span>\n }\n >\n {props.value}\n </Show>\n </span>\n <Show when={!plain() && !empty() && props.delta}>{(delta) => badge(delta())}</Show>\n </>\n }\n >\n <Match when={props.status === \"loading\"}>\n <span class=\"k2b-stat-cell__skeleton k2b-skeleton\" data-part=\"value\" aria-hidden=\"true\" />\n <span class=\"k2b-sr-only\">{t().loading}</span>\n </Match>\n <Match when={props.status === \"error\"}>\n <span class=\"k2b-stat-cell__error\">\n <i class=\"ti ti-alert-circle\" aria-hidden=\"true\" />\n {t().notLoaded}\n </span>\n </Match>\n </Switch>\n </div>\n <div class=\"k2b-stat-cell__support\">\n <Switch\n fallback={\n <Show\n when={props.stale}\n fallback={\n <>\n <Show when={plain() && !empty() && props.delta}>{(delta) => badge(delta())}</Show>\n <Show when={props.compare}>\n {(compare) => (\n <span class=\"k2b-stat-cell__sub\">\n {compare().label} {compareValue()}\n </span>\n )}\n </Show>\n <Show when={props.sub}>{(sub) => <span class=\"k2b-stat-cell__sub\">{sub()}</span>}</Show>\n <Show when={accent()}>\n {(value) => (\n <Show\n when={value().text}\n fallback={<i class={`${value().icon} k2b-stat-cell__accent-icon`} data-tone={value().tone} aria-hidden=\"true\" />}\n >\n {(text) => (\n <span class=\"k2b-stat-cell__accent\" data-tone={value().tone}>\n <i class={value().icon} aria-hidden=\"true\" />\n {text()}\n </span>\n )}\n </Show>\n )}\n </Show>\n {/* No figure, no trend: an empty tile says why in `sub` and keeps the size of its other states. */}\n <Show when={!empty() && props.trend && props.trend.length > 1}>\n <ChartSparkline\n labels={{ interactiveChart: props.label }}\n tooltip={props.trendTooltip ?? defaultTrendTooltip}\n class=\"k2b-stat-cell__trend\"\n data={Array.from(props.trend ?? [])}\n showLast\n />\n </Show>\n </>\n }\n >\n {(stale) => (\n <>\n <span class=\"k2b-stat-cell__stale\">\n <i class=\"ti ti-clock-exclamation\" aria-hidden=\"true\" />\n {stale()}\n </span>\n <Show when={props.onRetry}>\n {(retry) => (\n <button type=\"button\" class=\"k2b-stat-cell__retry\" onClick={() => retry()()}>\n {t().reload}\n </button>\n )}\n </Show>\n </>\n )}\n </Show>\n }\n >\n <Match when={props.status === \"loading\"}>\n <span class=\"k2b-stat-cell__skeleton k2b-skeleton\" data-part=\"support\" aria-hidden=\"true\" />\n </Match>\n <Match when={props.status === \"error\"}>\n <Show when={props.onRetry}>\n {(retry) => (\n <button type=\"button\" class=\"k2b-stat-cell__retry\" onClick={() => retry()()}>\n {t().retry}\n </button>\n )}\n </Show>\n </Match>\n </Switch>\n </div>\n </>\n );\n}\n\n/**\n * One key figure as a framed tile: icon and label, the figure with its change, and a support line with the comparison\n * and the trend. In a `plain` grid the same three rows stand without a frame. Each state (loading, error, stale, empty)\n * keeps the tile's place and size.\n */\nexport function StatCell(props: StatCellProps): JSX.Element {\n const gridSize = useStatGridSize();\n const size = () => props.size ?? gridSize;\n // A plain figure has no surface; its tone colours the figure instead of only the icon chip.\n const surface = useStatGridSurface();\n const plain = () => surface() === \"plain\";\n const variant = () => (plain() ? \"plain\" : undefined);\n const tone = () => (plain() ? props.tone : undefined);\n return (\n <Show\n // A tile that offers a retry is no link: the button must not sit inside it.\n when={props.href && !props.status && !(props.stale && props.onRetry)}\n fallback={\n <div\n class=\"k2b-stat-cell\"\n data-size={size()}\n data-surface={plain() ? undefined : surface()}\n data-variant={variant()}\n data-tone={tone()}\n data-wrap={props.wrap || undefined}\n data-delta-placement={props.deltaPlacement}\n data-status={props.status}\n aria-busy={props.status === \"loading\" || undefined}\n >\n <Body {...props} />\n </div>\n }\n >\n <a\n href={props.href}\n class=\"k2b-stat-cell k2b-stat-cell--link\"\n data-size={size()}\n data-surface={plain() ? undefined : surface()}\n data-variant={variant()}\n data-tone={tone()}\n data-wrap={props.wrap || undefined}\n data-delta-placement={props.deltaPlacement}\n >\n <i class=\"ti ti-external-link k2b-stat-cell__link-icon\" aria-hidden=\"true\" />\n <Body {...props} />\n </a>\n </Show>\n );\n}\n\nexport default StatCell;\n"],"mappings":";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G,MAAM,KAAK,CAAC,IAAI,IAAI,QAAQ;EACzC;EACA,MAAM,OAAO,GAAG,kBAAkB,CAAC,CAAC;EACpC,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,CAAC,KAAK,OAAO;EACzC,MAAM,OAAO,GAAG,MAAO,KAAK,CAAC,CAAC,GAAG,OAAO,GAAG,SAAU;EACrD,MAAM,IAAI,GAAG,MAAO,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,GAAG,SAAU;EACrD,yBACG;EACC;EAAA;IAAA,IACA,IAAI;MAAA,OAAE,qBAAK,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,QAAI,EAAE,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC;IAAA;IAAA,IACpE,QAAQ;MAAA,4DAGO,IAAI,CAAC,CAAC,iDACH,KAAK,CAAC,CAAC,YAAG,SAAS,mBAAG,OAAO,CAAC,CAAC,0DAC/B,OAAO,CAAC,CAAC,uDACZ,IAAI,CAAC,CAAC,uDACN,KAAK,CAAC,IAAI,IAAI,SAAS,kEACZ,KAAK,CAAC,cAAc,yDAC7B,KAAK,CAAC,MAAM,uDACd,KAAK,CAAC,MAAM,KAAK,SAAS,IAAI,SAAS,4CAEjD,IAAI,EAAK,KAAK;IAAA;IAAA;MAAA,uDAKX,KAAK,CAAC,IAAI,sDAEL,IAAI,CAAC,CAAC,iDACH,KAAK,CAAC,CAAC,YAAG,SAAS,mBAAG,OAAO,CAAC,CAAC,0DAC/B,OAAO,CAAC,CAAC,uDACZ,IAAI,CAAC,CAAC,uDACN,KAAK,CAAC,IAAI,IAAI,SAAS,kEACZ,KAAK,CAAC,cAAc,4CAGzC,IAAI,EAAK,KAAK;IAAA;EAAA;AAIvB;AAEA,eAAe,QAAQ","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["surfaces/StatCell.tsx"],"sourcesContent":["import { type JSX, Match, Show, Switch } from \"solid-js\";\nimport type { ChartNumberFormat } from \"../charts/description\";\nimport { ChartSparkline } from \"../content/ChartSparkline\";\nimport type { ChartTooltipFormatter } from \"../content/chart-inspection-core\";\nimport { useLocale } from \"../intl/locale\";\nimport type { AccentColor } from \"../semantics\";\nimport { DeltaBadge } from \"./delta-badge\";\nimport { type StatGridSize, useStatGridSize, useStatGridSurface } from \"./StatGrid\";\nimport { useStatCellMessages } from \"./stat-cell-messages\";\n\nexport type StatCellTone = AccentColor;\n\nexport type StatCellAccent = {\n tone: StatCellTone;\n icon: string;\n text?: string;\n};\n\n/**\n * The change against a comparison period. `unit: \"ratio\"` (default) reads `0.082` as `+8.2 %`; `\"points\"` is the\n * difference of two shares in ratio units, so `0.031` reads `+3.1 pts`. Only with `better` does the badge carry a tone\n * and say \"better\" or \"worse\"; without it the change stays unrated.\n */\nexport type StatCellDelta = {\n value: number;\n unit?: \"ratio\" | \"points\" | \"absolute\";\n /** Existing measures can express a change in their own unit instead of a ratio. */\n format?: ChartNumberFormat;\n better?: \"up\" | \"down\";\n};\n\n/** The value the change compares against, shown under the figure, such as \"Last month 44,560\". */\nexport type StatCellCompare = {\n label: string;\n value: string | number;\n};\n\nexport type StatCellSize = StatGridSize;\n\nexport type StatCellProps = {\n label: string;\n /** The figure. `null` shows the empty dash; `sub` then says why. */\n value: string | number | JSX.Element | null;\n sub?: string;\n valueClass?: string;\n /** Colours the figure as a result, such as a negative balance in `danger`. */\n valueTone?: \"danger\" | \"success\";\n /** An icon in a chip before the label, in `tone`. `\"in\"` and `\"out\"` are the money colours of `FlowAmount`. */\n icon?: string;\n /**\n * The chip colour of `icon`. Defaults to zinc. In a `plain` grid, `amber` (a warning) and `red` (a problem) also\n * colour the figure and its third line; say what is wrong there with `accent` (icon and word).\n */\n tone?: StatCellTone | \"in\" | \"out\";\n accent?: StatCellAccent;\n /** The change against `compare`; beside the figure, and always on the third line in a `plain` grid. */\n delta?: StatCellDelta;\n /** Keep the figure and change on separate rows, including while loading. Defaults to beside the figure. */\n deltaPlacement?: \"below\";\n compare?: StatCellCompare;\n href?: string;\n title?: string;\n trend?: readonly number[];\n /**\n * Replaces the default trend tooltip in browser code, for example with a period title or a unit.\n * `selection.datum.index` is the source index into `trend`.\n */\n trendTooltip?: ChartTooltipFormatter;\n size?: StatCellSize;\n /**\n * Wraps the label, value and support line instead of truncating them. Use it for a cell whose height nothing\n * reserves, such as one figure on its own; cells compared in a row keep one line each.\n */\n wrap?: boolean;\n /** `\"loading\"` keeps the tile's size with placeholders; `\"error\"` says the figure did not load. */\n status?: \"loading\" | \"error\";\n /** Offers \"Try again\" after an error and \"Reload\" beside `stale`. */\n onRetry?: () => void;\n /** The figure is not current: a short note such as \"As of 09:12 · not current\" replaces the support line. */\n stale?: string;\n};\n\nfunction Body(props: StatCellProps): JSX.Element {\n const gridSize = useStatGridSize();\n // A plain figure keeps its change off the figure's line: the third line holds it with the comparison.\n const surface = useStatGridSurface();\n const plain = () => surface() === \"plain\";\n // Flat chat figures reserve a support placeholder only when that line has content.\n const supportWaits = () =>\n surface() !== \"flat\" || Boolean(props.compare || props.sub || props.accent || props.stale || (props.trend && props.trend.length > 1));\n const badge = (delta: StatCellDelta) => <DeltaBadge delta={delta} compare={props.compare} />;\n const size = () => props.size ?? gridSize;\n const accent = () => props.accent;\n const locale = useLocale();\n const t = useStatCellMessages();\n const defaultTrendTooltip: ChartTooltipFormatter = ({ datum }) => {\n const y = datum.values.find((field) => field.key === \"y\")?.value ?? \"\";\n return {\n rows: [\n { label: props.label, value: typeof y === \"number\" ? new Intl.NumberFormat(locale(), { maximumFractionDigits: 6 }).format(y) : y },\n ],\n };\n };\n const compareValue = () => {\n const value = props.compare?.value;\n return typeof value === \"number\" ? new Intl.NumberFormat(locale()).format(value) : value;\n };\n const empty = () => props.value === null || props.value === undefined || props.value === \"\";\n return (\n <>\n <div class=\"k2b-stat-cell__head\">\n <Show when={props.icon}>\n {(icon) => (\n <span class=\"k2b-stat-cell__icon k2b-icon-tile\" data-tone={props.tone ?? \"zinc\"} aria-hidden=\"true\">\n <i class={icon()} />\n </span>\n )}\n </Show>\n <span class=\"k2b-stat-cell__label\" data-size={size()}>\n {props.label}\n </span>\n </div>\n <div class=\"k2b-stat-cell__main\">\n <Switch\n fallback={\n <>\n <span\n class={`k2b-stat-cell__value ${props.valueClass ?? \"\"}`}\n data-tone={props.valueTone}\n data-size={size()}\n data-empty={empty() || undefined}\n title={props.title}\n >\n {/* A missing figure is the shared empty dash, named for screen readers instead of read as a dash. */}\n <Show\n when={!empty()}\n fallback={\n <span role=\"img\" aria-label={t().noValue}>\n —\n </span>\n }\n >\n {props.value}\n </Show>\n </span>\n <Show when={!plain() && !empty() && props.delta}>{(delta) => badge(delta())}</Show>\n </>\n }\n >\n <Match when={props.status === \"loading\"}>\n <span class=\"k2b-stat-cell__skeleton k2b-skeleton\" data-part=\"value\" aria-hidden=\"true\" />\n <span class=\"k2b-sr-only\">{t().loading}</span>\n </Match>\n <Match when={props.status === \"error\"}>\n <span class=\"k2b-stat-cell__error\">\n <i class=\"ti ti-alert-circle\" aria-hidden=\"true\" />\n {t().notLoaded}\n </span>\n </Match>\n </Switch>\n </div>\n <div class=\"k2b-stat-cell__support\">\n <Switch\n fallback={\n <Show\n when={props.stale}\n fallback={\n <>\n <Show when={plain() && !empty() && props.delta}>{(delta) => badge(delta())}</Show>\n <Show when={props.compare}>\n {(compare) => (\n <span class=\"k2b-stat-cell__sub\">\n {compare().label} {compareValue()}\n </span>\n )}\n </Show>\n <Show when={props.sub}>{(sub) => <span class=\"k2b-stat-cell__sub\">{sub()}</span>}</Show>\n <Show when={accent()}>\n {(value) => (\n <Show\n when={value().text}\n fallback={<i class={`${value().icon} k2b-stat-cell__accent-icon`} data-tone={value().tone} aria-hidden=\"true\" />}\n >\n {(text) => (\n <span class=\"k2b-stat-cell__accent\" data-tone={value().tone}>\n <i class={value().icon} aria-hidden=\"true\" />\n {text()}\n </span>\n )}\n </Show>\n )}\n </Show>\n {/* No figure, no trend: an empty tile says why in `sub` and keeps the size of its other states. */}\n <Show when={!empty() && props.trend && props.trend.length > 1}>\n <ChartSparkline\n labels={{ interactiveChart: props.label }}\n tooltip={props.trendTooltip ?? defaultTrendTooltip}\n class=\"k2b-stat-cell__trend\"\n data={Array.from(props.trend ?? [])}\n showLast\n />\n </Show>\n </>\n }\n >\n {(stale) => (\n <>\n <span class=\"k2b-stat-cell__stale\">\n <i class=\"ti ti-clock-exclamation\" aria-hidden=\"true\" />\n {stale()}\n </span>\n <Show when={props.onRetry}>\n {(retry) => (\n <button type=\"button\" class=\"k2b-stat-cell__retry\" onClick={() => retry()()}>\n {t().reload}\n </button>\n )}\n </Show>\n </>\n )}\n </Show>\n }\n >\n <Match when={props.status === \"loading\" && supportWaits()}>\n <span class=\"k2b-stat-cell__skeleton k2b-skeleton\" data-part=\"support\" aria-hidden=\"true\" />\n </Match>\n <Match when={props.status === \"error\"}>\n <Show when={props.onRetry}>\n {(retry) => (\n <button type=\"button\" class=\"k2b-stat-cell__retry\" onClick={() => retry()()}>\n {t().retry}\n </button>\n )}\n </Show>\n </Match>\n </Switch>\n </div>\n </>\n );\n}\n\n/**\n * One key figure as a framed tile: icon and label, the figure with its change, and a support line with the comparison\n * and the trend. In a `plain` grid the same three rows stand without a frame. Each state (loading, error, stale, empty)\n * keeps the tile's place and size.\n */\nexport function StatCell(props: StatCellProps): JSX.Element {\n const gridSize = useStatGridSize();\n const size = () => props.size ?? gridSize;\n // A plain figure has no surface; its tone colours the figure instead of only the icon chip.\n const surface = useStatGridSurface();\n const plain = () => surface() === \"plain\";\n // Compact flat figures keep their support line directly below the value.\n const compact = () => !props.delta && !props.compare && !(props.trend?.length ?? 0);\n const variant = () => (plain() ? \"plain\" : undefined);\n const tone = () => (plain() ? props.tone : undefined);\n return (\n <Show\n // A tile that offers a retry is no link: the button must not sit inside it.\n when={props.href && !props.status && !(props.stale && props.onRetry)}\n fallback={\n <div\n class=\"k2b-stat-cell\"\n data-size={size()}\n data-surface={plain() ? undefined : surface()}\n data-variant={variant()}\n data-tone={tone()}\n data-wrap={props.wrap || undefined}\n data-plain={compact() || undefined}\n data-delta-placement={props.deltaPlacement}\n data-status={props.status}\n aria-busy={props.status === \"loading\" || undefined}\n >\n <Body {...props} />\n </div>\n }\n >\n <a\n href={props.href}\n class=\"k2b-stat-cell k2b-stat-cell--link\"\n data-size={size()}\n data-surface={plain() ? undefined : surface()}\n data-variant={variant()}\n data-tone={tone()}\n data-wrap={props.wrap || undefined}\n data-plain={compact() || undefined}\n data-delta-placement={props.deltaPlacement}\n >\n <i class=\"ti ti-external-link k2b-stat-cell__link-icon\" aria-hidden=\"true\" />\n <Body {...props} />\n </a>\n </Show>\n );\n}\n\nexport default StatCell;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAmB,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,UAAU;AAExD,SAAS,cAAc,QAAQ,2BAA2B;AAE1D,SAAS,SAAS,QAAQ,gBAAgB;AAE1C,SAAS,UAAU,QAAQ,eAAe;AAC1C,SAA4B,eAAe,EAAE,kBAAkB,QAAQ,YAAY;AACnF,SAAS,mBAAmB,QAAQ,sBAAsB;;AAU1D;AACA;AACA;AACA;AACA;;AASA;;AAmDA,SAAS,IAAI,CAAC,KAAoB,EAAe;EAC/C,MAAM,QAAQ,GAAG,eAAe,CAAC,CAAC;EAClC;EACA,MAAM,OAAO,GAAG,kBAAkB,CAAC,CAAC;EACpC,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,CAAC,KAAK,OAAO;EACzC;EACA,MAAM,YAAY,GAAG,MACnB,OAAO,CAAC,CAAC,KAAK,MAAM,IAAI,OAAO,CAAC,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,GAAG,IAAI,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,KAAK,IAAK,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAE,CAAC;EACvI,MAAM,KAAK,GAAI,KAAoB,sBAAM,UAAU;IAAC,KAAK,EAAE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BAAK,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,QAAI,EAAE,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC;IAAA;IAAA,IACpE,QAAQ;MAAA,4DAGO,IAAI,CAAC,CAAC,iDACH,KAAK,CAAC,CAAC,YAAG,SAAS,mBAAG,OAAO,CAAC,CAAC,0DAC/B,OAAO,CAAC,CAAC,uDACZ,IAAI,CAAC,CAAC,uDACN,KAAK,CAAC,IAAI,IAAI,SAAS,wDACtB,OAAO,CAAC,CAAC,IAAI,SAAS,kEACZ,KAAK,CAAC,cAAc,yDAC7B,KAAK,CAAC,MAAM,uDACd,KAAK,CAAC,MAAM,KAAK,SAAS,IAAI,SAAS,4CAEjD,IAAI,EAAK,KAAK;IAAA;IAAA;MAAA,uDAKX,KAAK,CAAC,IAAI,sDAEL,IAAI,CAAC,CAAC,iDACH,KAAK,CAAC,CAAC,YAAG,SAAS,mBAAG,OAAO,CAAC,CAAC,0DAC/B,OAAO,CAAC,CAAC,uDACZ,IAAI,CAAC,CAAC,uDACN,KAAK,CAAC,IAAI,IAAI,SAAS,wDACtB,OAAO,CAAC,CAAC,IAAI,SAAS,kEACZ,KAAK,CAAC,cAAc,4CAGzC,IAAI,EAAK,KAAK;IAAA;EAAA;AAIvB;AAEA,eAAe,QAAQ","ignoreList":[]}
|
|
@@ -9,6 +9,8 @@ var _tmpl$ = ["<header class=\"k2b-stat-grid__header\"><span class=\"k2b-stat-gr
|
|
|
9
9
|
_tmpl$4 = ["<a", " class=\"k2b-stat-grid__action\"><span>", "</span><i class=\"ti ti-arrow-up-right\" aria-hidden=\"true\"></i></a>"];
|
|
10
10
|
import { createContext, Show, useContext } from "solid-js";
|
|
11
11
|
|
|
12
|
+
/** `flat` drops the tiles: figures stand side by side in the flow, such as key figures in a chat answer. */
|
|
13
|
+
|
|
12
14
|
/** `tiles` frames each figure; `plain` sets the figures in equal columns with a thin line between, for a page head. */
|
|
13
15
|
|
|
14
16
|
const StatGridSizeContext = createContext("md");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["surfaces/StatGrid.tsx"],"sourcesContent":["import { type Accessor, createContext, type JSX, Show, useContext } from \"solid-js\";\n\nexport type StatGridSize = \"lg\" | \"md\" | \"sm\";\nexport type StatGridSurface = \"white\" | \"muted\";\nexport type StatGridColumns = 1 | 2 | 3 | 4 | 5 | 6;\nexport type StatGridAction = { label: string; href: string };\n/** `tiles` frames each figure; `plain` sets the figures in equal columns with a thin line between, for a page head. */\nexport type StatGridVariant = \"tiles\" | \"plain\";\n\nexport type StatGridProps = {\n children: JSX.Element;\n title?: string;\n action?: StatGridAction;\n /** Tiles per row on a wide container. Defaults to 4; at 600 px or less two share a row, and five or six take three up to 900 px. */\n columns?: StatGridColumns;\n size?: StatGridSize;\n /** Applies to `tiles` only: a `plain` row has no surface. */\n surface?: StatGridSurface;\n /**\n * `tiles` (default) frames each figure. `plain` drops frame, surface and shadow: equal columns with a 1 px line\n * between them, two columns below a 34rem container. Every figure keeps three rows (label, figure, a reserved third\n * line for `sub`, the change or the comparison), so all figures stand on one line.\n */\n variant?: StatGridVariant;\n class?: string;\n};\n\nconst StatGridSizeContext = createContext<StatGridSize>(\"md\");\n// A plain grid has no surface, so the surface context carries \"plain\" to its cells; a cell outside a grid stays a tile.\nconst StatGridSurfaceContext = createContext<Accessor<StatGridSurface | \"plain\">>((): StatGridSurface | \"plain\" => \"white\");\n\nexport const useStatGridSize = (): StatGridSize => useContext(StatGridSizeContext);\nexport const useStatGridSurface = (): Accessor<StatGridSurface | \"plain\"> => useContext(StatGridSurfaceContext);\n\nconst columnValue = (columns?: StatGridColumns): StatGridColumns => {\n if (columns && Number.isInteger(columns) && columns >= 1 && columns <= 6) return columns;\n return 4;\n};\n\n/**\n * A row of key figures, each a framed tile of its own or, with `variant=\"plain\"`, flat figures in equal columns; the\n * optional title and action sit above the row.\n */\nexport function StatGrid(props: StatGridProps): JSX.Element {\n const surface = () => props.surface ?? \"white\";\n const plain = () => props.variant === \"plain\";\n return (\n <section\n class={`k2b-stat-grid ${props.class ?? \"\"}`}\n data-columns={columnValue(props.columns)}\n data-size={props.size ?? \"md\"}\n data-surface={surface()}\n data-variant={plain() ? \"plain\" : \"tiles\"}\n aria-label={props.title}\n >\n <Show when={props.title}>\n <header class=\"k2b-stat-grid__header\">\n <span class=\"k2b-stat-grid__title\">{props.title}</span>\n <Show when={props.action}>\n {(action) => (\n <a href={action().href} class=\"k2b-stat-grid__action\">\n <span>{action().label}</span>\n <i class=\"ti ti-arrow-up-right\" aria-hidden=\"true\" />\n </a>\n )}\n </Show>\n </header>\n </Show>\n <StatGridSizeContext.Provider value={props.size ?? \"md\"}>\n <StatGridSurfaceContext.Provider value={() => (plain() ? \"plain\" : surface())}>\n <div class=\"k2b-stat-grid__body\">{props.children}</div>\n </StatGridSurfaceContext.Provider>\n </StatGridSizeContext.Provider>\n </section>\n );\n}\n\nexport default StatGrid;\n"],"mappings":";;;;;;;;;AAAA,SAAwB,aAAa,EAAY,IAAI,EAAE,UAAU,QAAQ,UAAU;;
|
|
1
|
+
{"version":3,"names":[],"sources":["surfaces/StatGrid.tsx"],"sourcesContent":["import { type Accessor, createContext, type JSX, Show, useContext } from \"solid-js\";\n\nexport type StatGridSize = \"lg\" | \"md\" | \"sm\";\n/** `flat` drops the tiles: figures stand side by side in the flow, such as key figures in a chat answer. */\nexport type StatGridSurface = \"white\" | \"muted\" | \"flat\";\nexport type StatGridColumns = 1 | 2 | 3 | 4 | 5 | 6;\nexport type StatGridAction = { label: string; href: string };\n/** `tiles` frames each figure; `plain` sets the figures in equal columns with a thin line between, for a page head. */\nexport type StatGridVariant = \"tiles\" | \"plain\";\n\nexport type StatGridProps = {\n children: JSX.Element;\n title?: string;\n action?: StatGridAction;\n /** Tiles per row on a wide container. Defaults to 4; at 600 px or less two share a row, and five or six take three up to 900 px. */\n columns?: StatGridColumns;\n size?: StatGridSize;\n /** Applies to `tiles` only: a `plain` row has no surface. */\n surface?: StatGridSurface;\n /**\n * `tiles` (default) frames each figure. `plain` drops frame, surface and shadow: equal columns with a 1 px line\n * between them, two columns below a 34rem container. Every figure keeps three rows (label, figure, a reserved third\n * line for `sub`, the change or the comparison), so all figures stand on one line.\n */\n variant?: StatGridVariant;\n class?: string;\n};\n\nconst StatGridSizeContext = createContext<StatGridSize>(\"md\");\n// A plain grid has no surface, so the surface context carries \"plain\" to its cells; a cell outside a grid stays a tile.\nconst StatGridSurfaceContext = createContext<Accessor<StatGridSurface | \"plain\">>((): StatGridSurface | \"plain\" => \"white\");\n\nexport const useStatGridSize = (): StatGridSize => useContext(StatGridSizeContext);\nexport const useStatGridSurface = (): Accessor<StatGridSurface | \"plain\"> => useContext(StatGridSurfaceContext);\n\nconst columnValue = (columns?: StatGridColumns): StatGridColumns => {\n if (columns && Number.isInteger(columns) && columns >= 1 && columns <= 6) return columns;\n return 4;\n};\n\n/**\n * A row of key figures, each a framed tile of its own or, with `variant=\"plain\"`, flat figures in equal columns; the\n * optional title and action sit above the row.\n */\nexport function StatGrid(props: StatGridProps): JSX.Element {\n const surface = () => props.surface ?? \"white\";\n const plain = () => props.variant === \"plain\";\n return (\n <section\n class={`k2b-stat-grid ${props.class ?? \"\"}`}\n data-columns={columnValue(props.columns)}\n data-size={props.size ?? \"md\"}\n data-surface={surface()}\n data-variant={plain() ? \"plain\" : \"tiles\"}\n aria-label={props.title}\n >\n <Show when={props.title}>\n <header class=\"k2b-stat-grid__header\">\n <span class=\"k2b-stat-grid__title\">{props.title}</span>\n <Show when={props.action}>\n {(action) => (\n <a href={action().href} class=\"k2b-stat-grid__action\">\n <span>{action().label}</span>\n <i class=\"ti ti-arrow-up-right\" aria-hidden=\"true\" />\n </a>\n )}\n </Show>\n </header>\n </Show>\n <StatGridSizeContext.Provider value={props.size ?? \"md\"}>\n <StatGridSurfaceContext.Provider value={() => (plain() ? \"plain\" : surface())}>\n <div class=\"k2b-stat-grid__body\">{props.children}</div>\n </StatGridSurfaceContext.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AC,CAAC,IAAI,0BACb,MAAM,CAAC,CAAC,CAAC,KAAK;MAGxB;IAAA;EAAA,gCAIN,mBAAmB,CAAC,QAAQ;IAAA,IAAC,KAAK;MAAA,OAAE,KAAK,CAAC,IAAI,IAAI,IAAI;IAAA;IAAA;MAAA,yBACpD,sBAAsB,CAAC,QAAQ;QAAC,KAAK,EAAE,MAAO,KAAK,CAAC,CAAC,GAAG,OAAO,GAAG,OAAO,CAAC,CAAE;QAAA;UAAA,+BACzC,KAAK,CAAC,QAAQ;QAAA;MAAA;IAAA;EAAA;AAK1D;AAEA,eAAe,QAAQ","ignoreList":[]}
|
|
@@ -9,6 +9,9 @@ var _tmpl$ = ["<span class=\"k2b-status-badge__label\" data-reserve><span>", "</
|
|
|
9
9
|
_tmpl$5 = ["<span class=\"k2b-status-badge__label\">", "</span>"],
|
|
10
10
|
_tmpl$6 = ["<span aria-hidden=\"true\">", "</span>"];
|
|
11
11
|
import { For, Show } from "solid-js";
|
|
12
|
+
|
|
13
|
+
/** `yours` is "your turn": the blue tint of an action that waits for the reader; amber `warning` is "to clarify". */
|
|
14
|
+
|
|
12
15
|
const DEFAULT_ICONS = {
|
|
13
16
|
info: "ti ti-info-circle",
|
|
14
17
|
ok: "ti ti-check",
|
|
@@ -16,7 +19,8 @@ const DEFAULT_ICONS = {
|
|
|
16
19
|
error: "ti ti-alert-circle",
|
|
17
20
|
degraded: "ti ti-plug-connected-x",
|
|
18
21
|
running: "ti ti-loader-2",
|
|
19
|
-
neutral: "ti ti-alert-square-rounded"
|
|
22
|
+
neutral: "ti ti-alert-square-rounded",
|
|
23
|
+
yours: "ti ti-arrow-right"
|
|
20
24
|
};
|
|
21
25
|
export function StatusBadge(props) {
|
|
22
26
|
const variant = () => props.variant ?? "chip";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["surfaces/StatusBadge.tsx"],"sourcesContent":["import { For, type JSX, Show } from \"solid-js\";\n\nexport type StatusTone = \"info\" | \"ok\" | \"warning\" | \"error\" | \"degraded\" | \"running\" | \"neutral\";\n\nexport type StatusBadgeProps = {\n tone: StatusTone;\n label: JSX.Element;\n icon?: string | null;\n variant?: \"chip\" | \"dot\" | \"text\";\n /**\n * Every label this place can show, such as all states of a list's status. The badge keeps the width of the longest,\n * so in a right-aligned slot its dot starts at one x in every row and stays put when the state changes.\n */\n labels?: readonly string[];\n title?: string;\n class?: string;\n};\n\nconst DEFAULT_ICONS: Record<StatusTone, string> = {\n info: \"ti ti-info-circle\",\n ok: \"ti ti-check\",\n warning: \"ti ti-alert-triangle\",\n error: \"ti ti-alert-circle\",\n degraded: \"ti ti-plug-connected-x\",\n running: \"ti ti-loader-2\",\n neutral: \"ti ti-alert-square-rounded\",\n};\n\nexport function StatusBadge(props: StatusBadgeProps): JSX.Element {\n const variant = () => props.variant ?? \"chip\";\n const icon = () => (props.icon === null ? undefined : (props.icon ?? DEFAULT_ICONS[props.tone]));\n return (\n <span class={`k2b-status-badge ${props.class ?? \"\"}`} data-tone={props.tone} data-variant={variant()} title={props.title}>\n <Show when={variant() !== \"dot\"} fallback={<span class=\"k2b-status-badge__dot\" aria-hidden=\"true\" />}>\n <Show when={icon()}>{(glyph) => <i class={glyph()} aria-hidden=\"true\" />}</Show>\n </Show>\n <Show when={props.labels?.length} fallback={<span class=\"k2b-status-badge__label\">{props.label}</span>}>\n <span class=\"k2b-status-badge__label\" data-reserve=\"\">\n <span>{props.label}</span>\n <For each={props.labels}>{(label) => <span aria-hidden=\"true\">{label}</span>}</For>\n </span>\n </Show>\n </span>\n );\n}\n\nexport default StatusBadge;\n"],"mappings":";;;;;;;;;;AAAA,SAAS,GAAG,EAAY,IAAI,QAAQ,UAAU
|
|
1
|
+
{"version":3,"names":[],"sources":["surfaces/StatusBadge.tsx"],"sourcesContent":["import { For, type JSX, Show } from \"solid-js\";\n\n/** `yours` is \"your turn\": the blue tint of an action that waits for the reader; amber `warning` is \"to clarify\". */\nexport type StatusTone = \"info\" | \"ok\" | \"warning\" | \"error\" | \"degraded\" | \"running\" | \"neutral\" | \"yours\";\n\nexport type StatusBadgeProps = {\n tone: StatusTone;\n label: JSX.Element;\n icon?: string | null;\n variant?: \"chip\" | \"dot\" | \"text\";\n /**\n * Every label this place can show, such as all states of a list's status. The badge keeps the width of the longest,\n * so in a right-aligned slot its dot starts at one x in every row and stays put when the state changes.\n */\n labels?: readonly string[];\n title?: string;\n class?: string;\n};\n\nconst DEFAULT_ICONS: Record<StatusTone, string> = {\n info: \"ti ti-info-circle\",\n ok: \"ti ti-check\",\n warning: \"ti ti-alert-triangle\",\n error: \"ti ti-alert-circle\",\n degraded: \"ti ti-plug-connected-x\",\n running: \"ti ti-loader-2\",\n neutral: \"ti ti-alert-square-rounded\",\n yours: \"ti ti-arrow-right\",\n};\n\nexport function StatusBadge(props: StatusBadgeProps): JSX.Element {\n const variant = () => props.variant ?? \"chip\";\n const icon = () => (props.icon === null ? undefined : (props.icon ?? DEFAULT_ICONS[props.tone]));\n return (\n <span class={`k2b-status-badge ${props.class ?? \"\"}`} data-tone={props.tone} data-variant={variant()} title={props.title}>\n <Show when={variant() !== \"dot\"} fallback={<span class=\"k2b-status-badge__dot\" aria-hidden=\"true\" />}>\n <Show when={icon()}>{(glyph) => <i class={glyph()} aria-hidden=\"true\" />}</Show>\n </Show>\n <Show when={props.labels?.length} fallback={<span class=\"k2b-status-badge__label\">{props.label}</span>}>\n <span class=\"k2b-status-badge__label\" data-reserve=\"\">\n <span>{props.label}</span>\n <For each={props.labels}>{(label) => <span aria-hidden=\"true\">{label}</span>}</For>\n </span>\n </Show>\n </span>\n );\n}\n\nexport default StatusBadge;\n"],"mappings":";;;;;;;;;;AAAA,SAAS,GAAG,EAAY,IAAI,QAAQ,UAAU;;AAE9C;;AAiBA,MAAM,aAAyC,GAAG;EAChD,IAAI,EAAE,mBAAmB;EACzB,EAAE,EAAE,aAAa;EACjB,OAAO,EAAE,sBAAsB;EAC/B,KAAK,EAAE,oBAAoB;EAC3B,QAAQ,EAAE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