@k2b/ui 0.58.0 → 0.60.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 +1 -0
- package/dist/browser/actions/CommandList.js +67 -74
- package/dist/browser/actions/CommandList.js.map +1 -1
- package/dist/browser/actions/ContextMenu.js +16 -4
- package/dist/browser/actions/ContextMenu.js.map +1 -1
- package/dist/browser/actions/Dropdown.js +187 -169
- package/dist/browser/actions/Dropdown.js.map +1 -1
- package/dist/browser/actions/GestureMenu.js +18 -7
- package/dist/browser/actions/GestureMenu.js.map +1 -1
- package/dist/browser/actions/SelectionAction.js +232 -0
- package/dist/browser/actions/SelectionAction.js.map +1 -0
- package/dist/browser/actions/Tabs.js +58 -19
- package/dist/browser/actions/Tabs.js.map +1 -1
- package/dist/browser/actions/Toolbar.js +66 -60
- package/dist/browser/actions/Toolbar.js.map +1 -1
- package/dist/browser/actions/ViewTabs.js +89 -73
- package/dist/browser/actions/ViewTabs.js.map +1 -1
- package/dist/browser/actions/command-items.js.map +1 -1
- package/dist/browser/actions/drag-and-drop.js +2 -1
- package/dist/browser/actions/drag-and-drop.js.map +1 -1
- package/dist/browser/actions/index.js +1 -0
- package/dist/browser/actions/index.js.map +1 -1
- package/dist/browser/actions/menu-sheet-open.js +19 -0
- package/dist/browser/actions/menu-sheet-open.js.map +1 -0
- package/dist/browser/charts/core/line-details.js +2 -2
- package/dist/browser/charts/core/line-details.js.map +1 -1
- package/dist/browser/charts/core/render.js +2 -1
- package/dist/browser/charts/core/render.js.map +1 -1
- package/dist/browser/charts/core/snapshot.js +3 -1
- package/dist/browser/charts/core/snapshot.js.map +1 -1
- package/dist/browser/chat/ChatActivityWords.js +142 -0
- package/dist/browser/chat/ChatActivityWords.js.map +1 -0
- package/dist/browser/chat/ChatComposer.js +857 -679
- package/dist/browser/chat/ChatComposer.js.map +1 -1
- package/dist/browser/chat/ChatComposerQuotes.js +56 -0
- package/dist/browser/chat/ChatComposerQuotes.js.map +1 -0
- package/dist/browser/chat/ChatContextPopup.js +34 -4
- package/dist/browser/chat/ChatContextPopup.js.map +1 -1
- package/dist/browser/chat/ChatPrimitives.js +559 -336
- package/dist/browser/chat/ChatPrimitives.js.map +1 -1
- package/dist/browser/chat/ChatTasks.js +218 -80
- package/dist/browser/chat/ChatTasks.js.map +1 -1
- package/dist/browser/chat/ChatTimeline.js +5 -3
- package/dist/browser/chat/ChatTimeline.js.map +1 -1
- package/dist/browser/chat/chat-behavior.js +12 -0
- package/dist/browser/chat/chat-behavior.js.map +1 -1
- package/dist/browser/chat/chat-messages.js +50 -2
- package/dist/browser/chat/chat-messages.js.map +1 -1
- package/dist/browser/chat/index.js +6 -2
- package/dist/browser/chat/index.js.map +1 -1
- package/dist/browser/chat/types.js.map +1 -1
- package/dist/browser/content/ActivityList.js +789 -0
- package/dist/browser/content/ActivityList.js.map +1 -0
- package/dist/browser/content/Calendar.js +2 -2
- package/dist/browser/content/Calendar.js.map +1 -1
- package/dist/browser/content/CalendarWeekView.js +9 -2
- package/dist/browser/content/CalendarWeekView.js.map +1 -1
- package/dist/browser/content/ChartRoot.js +4 -1
- package/dist/browser/content/ChartRoot.js.map +1 -1
- package/dist/browser/content/DataTable.js +9 -0
- package/dist/browser/content/DataTable.js.map +1 -1
- package/dist/browser/content/DataTableTools.js +3 -0
- package/dist/browser/content/DataTableTools.js.map +1 -1
- package/dist/browser/content/Lightbox.js +4 -2
- package/dist/browser/content/Lightbox.js.map +1 -1
- package/dist/browser/content/MessageQuote.js +57 -0
- package/dist/browser/content/MessageQuote.js.map +1 -0
- package/dist/browser/content/MessageRow.js +413 -391
- package/dist/browser/content/MessageRow.js.map +1 -1
- package/dist/browser/content/PdfPages.js +1 -0
- package/dist/browser/content/PdfPages.js.map +1 -1
- package/dist/browser/content/ProgressPath.js +101 -0
- package/dist/browser/content/ProgressPath.js.map +1 -0
- package/dist/browser/content/Timeline.js +1 -1
- package/dist/browser/content/Timeline.js.map +1 -1
- package/dist/browser/content/VirtualFeed.js +29 -2
- package/dist/browser/content/VirtualFeed.js.map +1 -1
- package/dist/browser/content/activity-messages.js +47 -0
- package/dist/browser/content/activity-messages.js.map +1 -0
- package/dist/browser/content/activity-timeline.js +144 -0
- package/dist/browser/content/activity-timeline.js.map +1 -0
- package/dist/browser/content/chart-tick-room.js +59 -0
- package/dist/browser/content/chart-tick-room.js.map +1 -0
- package/dist/browser/content/chart-time-calendar.js +12 -18
- package/dist/browser/content/chart-time-calendar.js.map +1 -1
- package/dist/browser/content/find-text.js +47 -0
- package/dist/browser/content/find-text.js.map +1 -0
- package/dist/browser/content/index.js +2 -0
- package/dist/browser/content/index.js.map +1 -1
- package/dist/browser/content/quote-messages.js +25 -0
- package/dist/browser/content/quote-messages.js.map +1 -0
- package/dist/browser/feedback/HoverCard.js +535 -0
- package/dist/browser/feedback/HoverCard.js.map +1 -0
- package/dist/browser/feedback/Tooltip.js +5 -2
- package/dist/browser/feedback/Tooltip.js.map +1 -1
- package/dist/browser/feedback/dialog-core.js +129 -21
- package/dist/browser/feedback/dialog-core.js.map +1 -1
- package/dist/browser/feedback/dialog-frame-motion.js +274 -0
- package/dist/browser/feedback/dialog-frame-motion.js.map +1 -0
- package/dist/browser/feedback/index.js +1 -0
- package/dist/browser/feedback/index.js.map +1 -1
- package/dist/browser/feedback/prompt-confirm.js +3 -17
- package/dist/browser/feedback/prompt-confirm.js.map +1 -1
- package/dist/browser/feedback/prompt-sheet-view.js +96 -0
- package/dist/browser/feedback/prompt-sheet-view.js.map +1 -0
- package/dist/browser/feedback/prompt-sheet.js +36 -0
- package/dist/browser/feedback/prompt-sheet.js.map +1 -0
- package/dist/browser/feedback/prompts.js +63 -91
- package/dist/browser/feedback/prompts.js.map +1 -1
- package/dist/browser/feedback/toast.js +17 -12
- package/dist/browser/feedback/toast.js.map +1 -1
- package/dist/browser/hover-card.js +6 -0
- package/dist/browser/hover-card.js.map +1 -0
- package/dist/browser/inputs/AutocompleteEditor.js +2 -1
- package/dist/browser/inputs/AutocompleteEditor.js.map +1 -1
- package/dist/browser/inputs/AutocompleteSelect.js +3 -12
- package/dist/browser/inputs/AutocompleteSelect.js.map +1 -1
- package/dist/browser/inputs/ChoiceList.js +131 -127
- package/dist/browser/inputs/ChoiceList.js.map +1 -1
- package/dist/browser/inputs/Combobox.js +6 -15
- package/dist/browser/inputs/Combobox.js.map +1 -1
- package/dist/browser/inputs/MultiSelectInput.js +7 -16
- package/dist/browser/inputs/MultiSelectInput.js.map +1 -1
- package/dist/browser/inputs/PeriodPicker.js +475 -252
- package/dist/browser/inputs/PeriodPicker.js.map +1 -1
- package/dist/browser/inputs/RichSelect.js +431 -431
- package/dist/browser/inputs/RichSelect.js.map +1 -1
- package/dist/browser/inputs/Select.js +3 -12
- package/dist/browser/inputs/Select.js.map +1 -1
- package/dist/browser/inputs/SelectChip.js +1 -0
- package/dist/browser/inputs/SelectChip.js.map +1 -1
- package/dist/browser/inputs/TimeInput.js +181 -0
- package/dist/browser/inputs/TimeInput.js.map +1 -0
- package/dist/browser/inputs/choice.js.map +1 -1
- package/dist/browser/inputs/date-picker.js +2 -1
- package/dist/browser/inputs/date-picker.js.map +1 -1
- package/dist/browser/inputs/file-drop.js +2 -0
- package/dist/browser/inputs/file-drop.js.map +1 -1
- package/dist/browser/inputs/index.js +1 -0
- package/dist/browser/inputs/index.js.map +1 -1
- package/dist/browser/inputs/input-messages.js +20 -2
- package/dist/browser/inputs/input-messages.js.map +1 -1
- package/dist/browser/inputs/period-picker-messages.js +20 -2
- package/dist/browser/inputs/period-picker-messages.js.map +1 -1
- package/dist/browser/inputs/period.js +83 -0
- package/dist/browser/inputs/period.js.map +1 -1
- package/dist/browser/inputs/time-input.js +93 -0
- package/dist/browser/inputs/time-input.js.map +1 -0
- package/dist/browser/internal/anchor-placement.js +38 -0
- package/dist/browser/internal/anchor-placement.js.map +1 -0
- package/dist/browser/internal/exit-motion.js +23 -0
- package/dist/browser/internal/exit-motion.js.map +1 -0
- package/dist/browser/internal/option-description.js +47 -0
- package/dist/browser/internal/option-description.js.map +1 -0
- package/dist/browser/internal/portal-scope.js +36 -0
- package/dist/browser/internal/portal-scope.js.map +1 -0
- package/dist/browser/internal/portal.js +13 -10
- package/dist/browser/internal/portal.js.map +1 -1
- package/dist/browser/internal/scroll-places.js +15 -0
- package/dist/browser/internal/scroll-places.js.map +1 -0
- package/dist/browser/intl/messages.js +10 -0
- package/dist/browser/intl/messages.js.map +1 -1
- package/dist/browser/layout/AnchoredPopover.js +10 -25
- package/dist/browser/layout/AnchoredPopover.js.map +1 -1
- package/dist/browser/layout/AppWorkspace.js +572 -495
- package/dist/browser/layout/AppWorkspace.js.map +1 -1
- package/dist/browser/layout/BottomSheet.js +1 -24
- package/dist/browser/layout/BottomSheet.js.map +1 -1
- package/dist/browser/layout/Discussion.js +298 -3
- package/dist/browser/layout/Discussion.js.map +1 -1
- package/dist/browser/layout/FloatingWindow.js +2 -0
- package/dist/browser/layout/FloatingWindow.js.map +1 -1
- package/dist/browser/layout/Navigation.js +7 -2
- package/dist/browser/layout/Navigation.js.map +1 -1
- package/dist/browser/layout/Panes.js +3 -0
- package/dist/browser/layout/Panes.js.map +1 -1
- package/dist/browser/layout/SidebarSwitcher.js +28 -37
- package/dist/browser/layout/SidebarSwitcher.js.map +1 -1
- package/dist/browser/layout/app-workspace-controller.js +5 -1
- package/dist/browser/layout/app-workspace-controller.js.map +1 -1
- package/dist/browser/layout/bottom-sheet-load.js +17 -0
- package/dist/browser/layout/bottom-sheet-load.js.map +1 -0
- package/dist/browser/layout/bottom-sheet-options.js +27 -0
- package/dist/browser/layout/bottom-sheet-options.js.map +1 -0
- package/dist/browser/layout/index.js +2 -1
- package/dist/browser/layout/index.js.map +1 -1
- package/dist/browser/layout/panes-preview-scope.js +9 -0
- package/dist/browser/layout/panes-preview-scope.js.map +1 -0
- package/dist/browser/layout/sheet-handle.js +173 -37
- package/dist/browser/layout/sheet-handle.js.map +1 -1
- package/dist/browser/layout/sheet-motion.js +37 -5
- package/dist/browser/layout/sheet-motion.js.map +1 -1
- package/dist/browser/layout/sidebar-scroll-memory.js +30 -0
- package/dist/browser/layout/sidebar-scroll-memory.js.map +1 -1
- package/dist/browser/panes.js +3 -0
- package/dist/browser/panes.js.map +1 -0
- package/dist/browser/surfaces/AvatarStack.js +59 -43
- package/dist/browser/surfaces/AvatarStack.js.map +1 -1
- package/dist/browser/surfaces/ChangeList.js +78 -16
- package/dist/browser/surfaces/ChangeList.js.map +1 -1
- package/dist/browser/surfaces/DotStrip.js +126 -41
- package/dist/browser/surfaces/DotStrip.js.map +1 -1
- package/dist/browser/surfaces/LinkCard.js +69 -16
- package/dist/browser/surfaces/LinkCard.js.map +1 -1
- package/dist/browser/surfaces/Section.js +4 -2
- package/dist/browser/surfaces/Section.js.map +1 -1
- package/dist/browser/surfaces/StatCell.js +56 -28
- package/dist/browser/surfaces/StatCell.js.map +1 -1
- package/dist/browser/surfaces/StatGrid.js +17 -8
- package/dist/browser/surfaces/StatGrid.js.map +1 -1
- package/dist/browser/surfaces/index.js.map +1 -1
- package/dist/ssr/actions/CommandList.js +23 -26
- package/dist/ssr/actions/CommandList.js.map +1 -1
- package/dist/ssr/actions/ContextMenu.js +9 -2
- package/dist/ssr/actions/ContextMenu.js.map +1 -1
- package/dist/ssr/actions/Dropdown.js +79 -55
- package/dist/ssr/actions/Dropdown.js.map +1 -1
- package/dist/ssr/actions/GestureMenu.js +18 -7
- package/dist/ssr/actions/GestureMenu.js.map +1 -1
- package/dist/ssr/actions/SelectionAction.js +212 -0
- package/dist/ssr/actions/SelectionAction.js.map +1 -0
- package/dist/ssr/actions/Tabs.js +21 -6
- package/dist/ssr/actions/Tabs.js.map +1 -1
- package/dist/ssr/actions/Toolbar.js +24 -18
- package/dist/ssr/actions/Toolbar.js.map +1 -1
- package/dist/ssr/actions/ViewTabs.js +27 -20
- package/dist/ssr/actions/ViewTabs.js.map +1 -1
- package/dist/ssr/actions/command-items.js.map +1 -1
- package/dist/ssr/actions/drag-and-drop.js +2 -1
- package/dist/ssr/actions/drag-and-drop.js.map +1 -1
- package/dist/ssr/actions/index.js +1 -0
- package/dist/ssr/actions/index.js.map +1 -1
- package/dist/ssr/actions/menu-sheet-open.js +19 -0
- package/dist/ssr/actions/menu-sheet-open.js.map +1 -0
- package/dist/ssr/charts/core/line-details.js +2 -2
- package/dist/ssr/charts/core/line-details.js.map +1 -1
- package/dist/ssr/charts/core/render.js +2 -1
- package/dist/ssr/charts/core/render.js.map +1 -1
- package/dist/ssr/charts/core/snapshot.js +3 -1
- package/dist/ssr/charts/core/snapshot.js.map +1 -1
- package/dist/ssr/chat/ChatActivityWords.js +126 -0
- package/dist/ssr/chat/ChatActivityWords.js.map +1 -0
- package/dist/ssr/chat/ChatComposer.js +271 -142
- package/dist/ssr/chat/ChatComposer.js.map +1 -1
- package/dist/ssr/chat/ChatComposerQuotes.js +26 -0
- package/dist/ssr/chat/ChatComposerQuotes.js.map +1 -0
- package/dist/ssr/chat/ChatContextPopup.js +17 -1
- package/dist/ssr/chat/ChatContextPopup.js.map +1 -1
- package/dist/ssr/chat/ChatPrimitives.js +213 -79
- package/dist/ssr/chat/ChatPrimitives.js.map +1 -1
- package/dist/ssr/chat/ChatTasks.js +117 -27
- package/dist/ssr/chat/ChatTasks.js.map +1 -1
- package/dist/ssr/chat/ChatTimeline.js +5 -3
- package/dist/ssr/chat/ChatTimeline.js.map +1 -1
- package/dist/ssr/chat/chat-behavior.js +12 -0
- package/dist/ssr/chat/chat-behavior.js.map +1 -1
- package/dist/ssr/chat/chat-messages.js +50 -2
- package/dist/ssr/chat/chat-messages.js.map +1 -1
- package/dist/ssr/chat/index.js +6 -2
- package/dist/ssr/chat/index.js.map +1 -1
- package/dist/ssr/chat/types.js.map +1 -1
- package/dist/ssr/content/ActivityList.js +553 -0
- package/dist/ssr/content/ActivityList.js.map +1 -0
- package/dist/ssr/content/Calendar.js +2 -2
- package/dist/ssr/content/Calendar.js.map +1 -1
- package/dist/ssr/content/CalendarWeekView.js +9 -2
- package/dist/ssr/content/CalendarWeekView.js.map +1 -1
- package/dist/ssr/content/ChartRoot.js +4 -1
- package/dist/ssr/content/ChartRoot.js.map +1 -1
- package/dist/ssr/content/DataTable.js +9 -0
- package/dist/ssr/content/DataTable.js.map +1 -1
- package/dist/ssr/content/DataTableTools.js +3 -0
- package/dist/ssr/content/DataTableTools.js.map +1 -1
- package/dist/ssr/content/Lightbox.js +4 -2
- package/dist/ssr/content/Lightbox.js.map +1 -1
- package/dist/ssr/content/MessageQuote.js +36 -0
- package/dist/ssr/content/MessageQuote.js.map +1 -0
- package/dist/ssr/content/MessageRow.js +112 -95
- package/dist/ssr/content/MessageRow.js.map +1 -1
- package/dist/ssr/content/PdfPages.js +1 -0
- package/dist/ssr/content/PdfPages.js.map +1 -1
- package/dist/ssr/content/ProgressPath.js +51 -0
- package/dist/ssr/content/ProgressPath.js.map +1 -0
- package/dist/ssr/content/Timeline.js +1 -1
- package/dist/ssr/content/Timeline.js.map +1 -1
- package/dist/ssr/content/VirtualFeed.js +29 -2
- package/dist/ssr/content/VirtualFeed.js.map +1 -1
- package/dist/ssr/content/activity-messages.js +47 -0
- package/dist/ssr/content/activity-messages.js.map +1 -0
- package/dist/ssr/content/activity-timeline.js +144 -0
- package/dist/ssr/content/activity-timeline.js.map +1 -0
- package/dist/ssr/content/chart-tick-room.js +59 -0
- package/dist/ssr/content/chart-tick-room.js.map +1 -0
- package/dist/ssr/content/chart-time-calendar.js +12 -18
- package/dist/ssr/content/chart-time-calendar.js.map +1 -1
- package/dist/ssr/content/find-text.js +47 -0
- package/dist/ssr/content/find-text.js.map +1 -0
- package/dist/ssr/content/index.js +2 -0
- package/dist/ssr/content/index.js.map +1 -1
- package/dist/ssr/content/quote-messages.js +25 -0
- package/dist/ssr/content/quote-messages.js.map +1 -0
- package/dist/ssr/feedback/HoverCard.js +473 -0
- package/dist/ssr/feedback/HoverCard.js.map +1 -0
- package/dist/ssr/feedback/Tooltip.js +5 -2
- package/dist/ssr/feedback/Tooltip.js.map +1 -1
- package/dist/ssr/feedback/dialog-core.js +129 -21
- package/dist/ssr/feedback/dialog-core.js.map +1 -1
- package/dist/ssr/feedback/dialog-frame-motion.js +274 -0
- package/dist/ssr/feedback/dialog-frame-motion.js.map +1 -0
- package/dist/ssr/feedback/index.js +1 -0
- package/dist/ssr/feedback/index.js.map +1 -1
- package/dist/ssr/feedback/prompt-confirm.js +3 -17
- package/dist/ssr/feedback/prompt-confirm.js.map +1 -1
- package/dist/ssr/feedback/prompt-sheet-view.js +62 -0
- package/dist/ssr/feedback/prompt-sheet-view.js.map +1 -0
- package/dist/ssr/feedback/prompt-sheet.js +36 -0
- package/dist/ssr/feedback/prompt-sheet.js.map +1 -0
- package/dist/ssr/feedback/prompts.js +28 -52
- package/dist/ssr/feedback/prompts.js.map +1 -1
- package/dist/ssr/feedback/toast.js +17 -12
- package/dist/ssr/feedback/toast.js.map +1 -1
- package/dist/ssr/hover-card.js +6 -0
- package/dist/ssr/hover-card.js.map +1 -0
- package/dist/ssr/inputs/AutocompleteEditor.js +2 -1
- package/dist/ssr/inputs/AutocompleteEditor.js.map +1 -1
- package/dist/ssr/inputs/AutocompleteSelect.js +3 -8
- package/dist/ssr/inputs/AutocompleteSelect.js.map +1 -1
- package/dist/ssr/inputs/ChoiceList.js +25 -25
- package/dist/ssr/inputs/ChoiceList.js.map +1 -1
- package/dist/ssr/inputs/Combobox.js +4 -9
- package/dist/ssr/inputs/Combobox.js.map +1 -1
- package/dist/ssr/inputs/MultiSelectInput.js +4 -9
- package/dist/ssr/inputs/MultiSelectInput.js.map +1 -1
- package/dist/ssr/inputs/PeriodPicker.js +241 -46
- package/dist/ssr/inputs/PeriodPicker.js.map +1 -1
- package/dist/ssr/inputs/RichSelect.js +135 -121
- package/dist/ssr/inputs/RichSelect.js.map +1 -1
- package/dist/ssr/inputs/Select.js +3 -8
- package/dist/ssr/inputs/Select.js.map +1 -1
- package/dist/ssr/inputs/SelectChip.js +1 -0
- package/dist/ssr/inputs/SelectChip.js.map +1 -1
- package/dist/ssr/inputs/TimeInput.js +145 -0
- package/dist/ssr/inputs/TimeInput.js.map +1 -0
- package/dist/ssr/inputs/choice.js.map +1 -1
- package/dist/ssr/inputs/date-picker.js +2 -1
- package/dist/ssr/inputs/date-picker.js.map +1 -1
- package/dist/ssr/inputs/file-drop.js +2 -0
- package/dist/ssr/inputs/file-drop.js.map +1 -1
- package/dist/ssr/inputs/index.js +1 -0
- package/dist/ssr/inputs/index.js.map +1 -1
- package/dist/ssr/inputs/input-messages.js +20 -2
- package/dist/ssr/inputs/input-messages.js.map +1 -1
- package/dist/ssr/inputs/period-picker-messages.js +20 -2
- package/dist/ssr/inputs/period-picker-messages.js.map +1 -1
- package/dist/ssr/inputs/period.js +83 -0
- package/dist/ssr/inputs/period.js.map +1 -1
- package/dist/ssr/inputs/time-input.js +93 -0
- package/dist/ssr/inputs/time-input.js.map +1 -0
- package/dist/ssr/internal/anchor-placement.js +38 -0
- package/dist/ssr/internal/anchor-placement.js.map +1 -0
- package/dist/ssr/internal/exit-motion.js +23 -0
- package/dist/ssr/internal/exit-motion.js.map +1 -0
- package/dist/ssr/internal/option-description.js +27 -0
- package/dist/ssr/internal/option-description.js.map +1 -0
- package/dist/ssr/internal/portal-scope.js +36 -0
- package/dist/ssr/internal/portal-scope.js.map +1 -0
- package/dist/ssr/internal/portal.js +13 -10
- package/dist/ssr/internal/portal.js.map +1 -1
- package/dist/ssr/internal/scroll-places.js +15 -0
- package/dist/ssr/internal/scroll-places.js.map +1 -0
- package/dist/ssr/intl/messages.js +10 -0
- package/dist/ssr/intl/messages.js.map +1 -1
- package/dist/ssr/layout/AnchoredPopover.js +10 -25
- package/dist/ssr/layout/AnchoredPopover.js.map +1 -1
- package/dist/ssr/layout/AppWorkspace.js +191 -121
- package/dist/ssr/layout/AppWorkspace.js.map +1 -1
- package/dist/ssr/layout/BottomSheet.js +1 -24
- package/dist/ssr/layout/BottomSheet.js.map +1 -1
- package/dist/ssr/layout/Discussion.js +168 -2
- package/dist/ssr/layout/Discussion.js.map +1 -1
- package/dist/ssr/layout/FloatingWindow.js +2 -0
- package/dist/ssr/layout/FloatingWindow.js.map +1 -1
- package/dist/ssr/layout/Navigation.js +7 -2
- package/dist/ssr/layout/Navigation.js.map +1 -1
- package/dist/ssr/layout/Panes.js +3 -0
- package/dist/ssr/layout/Panes.js.map +1 -1
- package/dist/ssr/layout/SidebarSwitcher.js +8 -13
- package/dist/ssr/layout/SidebarSwitcher.js.map +1 -1
- package/dist/ssr/layout/app-workspace-controller.js +5 -1
- package/dist/ssr/layout/app-workspace-controller.js.map +1 -1
- package/dist/ssr/layout/bottom-sheet-load.js +17 -0
- package/dist/ssr/layout/bottom-sheet-load.js.map +1 -0
- package/dist/ssr/layout/bottom-sheet-options.js +27 -0
- package/dist/ssr/layout/bottom-sheet-options.js.map +1 -0
- package/dist/ssr/layout/index.js +2 -1
- package/dist/ssr/layout/index.js.map +1 -1
- package/dist/ssr/layout/panes-preview-scope.js +9 -0
- package/dist/ssr/layout/panes-preview-scope.js.map +1 -0
- package/dist/ssr/layout/sheet-handle.js +173 -37
- package/dist/ssr/layout/sheet-handle.js.map +1 -1
- package/dist/ssr/layout/sheet-motion.js +37 -5
- package/dist/ssr/layout/sheet-motion.js.map +1 -1
- package/dist/ssr/layout/sidebar-scroll-memory.js +30 -0
- package/dist/ssr/layout/sidebar-scroll-memory.js.map +1 -1
- package/dist/ssr/panes.js +3 -0
- package/dist/ssr/panes.js.map +1 -0
- package/dist/ssr/surfaces/AvatarStack.js +56 -40
- package/dist/ssr/surfaces/AvatarStack.js.map +1 -1
- package/dist/ssr/surfaces/ChangeList.js +37 -5
- package/dist/ssr/surfaces/ChangeList.js.map +1 -1
- package/dist/ssr/surfaces/DotStrip.js +75 -12
- package/dist/ssr/surfaces/DotStrip.js.map +1 -1
- package/dist/ssr/surfaces/LinkCard.js +46 -7
- package/dist/ssr/surfaces/LinkCard.js.map +1 -1
- package/dist/ssr/surfaces/Section.js +4 -2
- package/dist/ssr/surfaces/Section.js.map +1 -1
- package/dist/ssr/surfaces/StatCell.js +24 -12
- package/dist/ssr/surfaces/StatCell.js.map +1 -1
- package/dist/ssr/surfaces/StatGrid.js +12 -6
- package/dist/ssr/surfaces/StatGrid.js.map +1 -1
- package/dist/ssr/surfaces/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/actions/Dropdown.d.ts +10 -0
- package/dist/types/actions/SelectionAction.d.ts +34 -0
- package/dist/types/actions/Tabs.d.ts +9 -0
- package/dist/types/actions/ViewTabs.d.ts +2 -0
- package/dist/types/actions/command-items.d.ts +5 -0
- package/dist/types/actions/index.d.ts +2 -0
- package/dist/types/actions/menu-sheet-open.d.ts +13 -0
- package/dist/types/charts/core/line-details.d.ts +1 -1
- package/dist/types/chat/ChatActivityWords.d.ts +31 -0
- package/dist/types/chat/ChatComposer.d.ts +41 -3
- package/dist/types/chat/ChatComposerQuotes.d.ts +10 -0
- package/dist/types/chat/ChatPrimitives.d.ts +23 -2
- package/dist/types/chat/ChatTasks.d.ts +14 -1
- package/dist/types/chat/chat-behavior.d.ts +14 -0
- package/dist/types/chat/chat-messages.d.ts +24 -0
- package/dist/types/chat/index.d.ts +10 -5
- package/dist/types/chat/types.d.ts +27 -0
- package/dist/types/content/ActivityList.d.ts +166 -0
- package/dist/types/content/DataTableTools.d.ts +2 -0
- package/dist/types/content/MessageQuote.d.ts +9 -0
- package/dist/types/content/MessageRow.d.ts +5 -0
- package/dist/types/content/ProgressPath.d.ts +25 -0
- package/dist/types/content/VirtualFeed.d.ts +6 -0
- package/dist/types/content/activity-messages.d.ts +22 -0
- package/dist/types/content/activity-timeline.d.ts +52 -0
- package/dist/types/content/chart-tick-room.d.ts +15 -0
- package/dist/types/content/chart-time-calendar.d.ts +6 -0
- package/dist/types/content/find-text.d.ts +10 -0
- package/dist/types/content/index.d.ts +2 -0
- package/dist/types/content/quote-messages.d.ts +6 -0
- package/dist/types/feedback/HoverCard.d.ts +44 -0
- package/dist/types/feedback/Tooltip.d.ts +5 -0
- package/dist/types/feedback/dialog-core.d.ts +2 -0
- package/dist/types/feedback/dialog-frame-motion.d.ts +37 -0
- package/dist/types/feedback/index.d.ts +2 -0
- package/dist/types/feedback/prompt-confirm.d.ts +0 -2
- package/dist/types/feedback/prompt-sheet-view.d.ts +3 -0
- package/dist/types/feedback/prompt-sheet.d.ts +20 -0
- package/dist/types/feedback/prompts.d.ts +5 -0
- package/dist/types/feedback/toast.d.ts +5 -1
- package/dist/types/hover-card.d.ts +5 -0
- package/dist/types/inputs/ChoiceList.d.ts +12 -5
- package/dist/types/inputs/Combobox.d.ts +5 -0
- package/dist/types/inputs/MultiSelectInput.d.ts +1 -0
- package/dist/types/inputs/PeriodPicker.d.ts +10 -0
- package/dist/types/inputs/RichSelect.d.ts +5 -0
- package/dist/types/inputs/Select.d.ts +1 -0
- package/dist/types/inputs/SelectChip.d.ts +5 -0
- package/dist/types/inputs/TimeInput.d.ts +16 -0
- package/dist/types/inputs/choice.d.ts +6 -1
- package/dist/types/inputs/index.d.ts +2 -0
- package/dist/types/inputs/input-messages.d.ts +9 -0
- package/dist/types/inputs/period-picker-messages.d.ts +9 -0
- package/dist/types/inputs/period.d.ts +41 -0
- package/dist/types/inputs/time-input.d.ts +43 -0
- package/dist/types/internal/anchor-placement.d.ts +23 -0
- package/dist/types/internal/exit-motion.d.ts +10 -0
- package/dist/types/internal/option-description.d.ts +20 -0
- package/dist/types/internal/portal-scope.d.ts +11 -0
- package/dist/types/internal/portal.d.ts +1 -1
- package/dist/types/internal/scroll-places.d.ts +2 -0
- package/dist/types/intl/messages.d.ts +5 -0
- package/dist/types/layout/AppWorkspace.d.ts +10 -0
- package/dist/types/layout/BottomSheet.d.ts +1 -18
- package/dist/types/layout/Discussion.d.ts +25 -0
- package/dist/types/layout/Panes.d.ts +6 -0
- package/dist/types/layout/SidebarSwitcher.d.ts +5 -0
- package/dist/types/layout/bottom-sheet-load.d.ts +9 -0
- package/dist/types/layout/bottom-sheet-options.d.ts +18 -0
- package/dist/types/layout/index.d.ts +4 -3
- package/dist/types/layout/panes-preview-scope.d.ts +2 -0
- package/dist/types/layout/sheet-handle.d.ts +17 -8
- package/dist/types/layout/sidebar-scroll-memory.d.ts +6 -0
- package/dist/types/panes.d.ts +2 -0
- package/dist/types/surfaces/ChangeList.d.ts +23 -4
- package/dist/types/surfaces/DotStrip.d.ts +25 -5
- package/dist/types/surfaces/LinkCard.d.ts +14 -0
- package/dist/types/surfaces/StatCell.d.ts +7 -2
- package/dist/types/surfaces/StatGrid.d.ts +15 -3
- package/dist/types/surfaces/index.d.ts +1 -1
- package/package.json +18 -5
|
@@ -1,15 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ssrElement as _$ssrElement } from "solid-js/web";
|
|
2
|
+
import { mergeProps as _$mergeProps } from "solid-js/web";
|
|
2
3
|
import { createComponent as _$createComponent } from "solid-js/web";
|
|
3
|
-
import {
|
|
4
|
-
import { ssrAttribute as _$ssrAttribute } from "solid-js/web";
|
|
4
|
+
import { ssr as _$ssr } from "solid-js/web";
|
|
5
5
|
import { escape as _$escape } from "solid-js/web";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
import { ssrAttribute as _$ssrAttribute } from "solid-js/web";
|
|
7
|
+
var _tmpl$ = ["<i", "></i>"],
|
|
8
|
+
_tmpl$2 = ["<span class=\"k2b-dot-strip__place\" role=\"listitem\">", "</span>"],
|
|
9
|
+
_tmpl$3 = ["<span class=\"k2b-dot-strip__target\" role=\"img\"", ">", "</span>"],
|
|
10
|
+
_tmpl$4 = ["<a class=\"k2b-dot-strip__target\"", ">", "</a>"];
|
|
11
|
+
import { createSignal, For, Show } from "solid-js";
|
|
9
12
|
|
|
10
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* `accent` = the app colour (it worked), `success` = it worked, in the success colour, `ai` = came from AI,
|
|
15
|
+
* `warning` = skipped or needs a look, `danger` = failed, `muted` = nothing to do, `running` = runs now.
|
|
16
|
+
*/
|
|
11
17
|
|
|
12
|
-
/** A fixed-size row of outcome
|
|
18
|
+
/** A fixed-size row of outcome marks: the last runs, checks or mails at a glance, each optionally a link. */
|
|
13
19
|
export function DotStrip(props) {
|
|
14
20
|
const length = () => Math.max(props.length ?? props.dots.length, props.dots.length);
|
|
15
21
|
const slots = () => Array.from({
|
|
@@ -19,13 +25,70 @@ export function DotStrip(props) {
|
|
|
19
25
|
if (props.waiting) return "waiting";
|
|
20
26
|
return props.dots[index] ?? "pending";
|
|
21
27
|
};
|
|
22
|
-
|
|
28
|
+
const linked = () => Boolean(props.links?.length);
|
|
29
|
+
const linkIndexes = () => slots().filter(index => props.links?.[index]);
|
|
30
|
+
// One tab stop for the whole strip, on the newest run until the person moves it.
|
|
31
|
+
const [current, setCurrent] = createSignal();
|
|
32
|
+
const stop = () => {
|
|
33
|
+
const indexes = linkIndexes();
|
|
34
|
+
const chosen = current();
|
|
35
|
+
return chosen !== undefined && indexes.includes(chosen) ? chosen : indexes.at(-1);
|
|
36
|
+
};
|
|
37
|
+
let root;
|
|
38
|
+
const move = event => {
|
|
39
|
+
const indexes = linkIndexes();
|
|
40
|
+
const at = indexes.indexOf(stop() ?? -1);
|
|
41
|
+
const next = event.key === "ArrowRight" || event.key === "ArrowDown" ? indexes[Math.min(indexes.length - 1, at + 1)] : event.key === "ArrowLeft" || event.key === "ArrowUp" ? indexes[Math.max(0, at - 1)] : event.key === "Home" ? indexes[0] : event.key === "End" ? indexes.at(-1) : undefined;
|
|
42
|
+
if (next === undefined) return;
|
|
43
|
+
event.preventDefault();
|
|
44
|
+
setCurrent(next);
|
|
45
|
+
root?.querySelector(`[data-dot-index="${next}"]`)?.focus();
|
|
46
|
+
};
|
|
47
|
+
const mark = index => // The AI tones carry their own `-ai` class: the AI palette stays with AI surfaces (F3).
|
|
48
|
+
_$ssr(_tmpl$, _$ssrAttribute("class", state(index) === "ai" || state(index) === "running" ? "k2b-dot-strip__dot k2b-dot-strip__dot-ai" : "k2b-dot-strip__dot", false) + _$ssrAttribute("data-state", _$escape(state(index), true), false) + _$ssrAttribute("data-selected", props.selected === index ? "" : _$escape(undefined, true), false));
|
|
49
|
+
return _$ssrElement("div", _$mergeProps({
|
|
50
|
+
get ["class"]() {
|
|
51
|
+
return `k2b-dot-strip ${props.class ?? ""}`;
|
|
52
|
+
},
|
|
53
|
+
get ["data-size"]() {
|
|
54
|
+
return props.size ?? "md";
|
|
55
|
+
},
|
|
56
|
+
get ["data-variant"]() {
|
|
57
|
+
return props.variant ?? "dot";
|
|
58
|
+
}
|
|
59
|
+
}, () => ({
|
|
60
|
+
role: linked() ? "list" : "img",
|
|
61
|
+
"aria-label": props.label
|
|
62
|
+
}), {
|
|
63
|
+
get style() {
|
|
64
|
+
return {
|
|
65
|
+
"--k2b-dot-strip-columns": String(props.columns ?? length())
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
}), _$escape(_$createComponent(For, {
|
|
23
69
|
get each() {
|
|
24
70
|
return slots();
|
|
25
71
|
},
|
|
26
|
-
children: index =>
|
|
27
|
-
|
|
28
|
-
|
|
72
|
+
children: index => _$createComponent(Show, {
|
|
73
|
+
get when() {
|
|
74
|
+
return linked();
|
|
75
|
+
},
|
|
76
|
+
get fallback() {
|
|
77
|
+
return mark(index);
|
|
78
|
+
},
|
|
79
|
+
get children() {
|
|
80
|
+
return _$ssr(_tmpl$2, _$escape(_$createComponent(Show, {
|
|
81
|
+
get when() {
|
|
82
|
+
return props.links?.[index];
|
|
83
|
+
},
|
|
84
|
+
get fallback() {
|
|
85
|
+
return _$ssr(_tmpl$3, _$ssrAttribute("aria-label", _$escape(props.dotLabels?.[index], true), false), _$escape(mark(index)));
|
|
86
|
+
},
|
|
87
|
+
children: href => _$ssr(_tmpl$4, _$ssrAttribute("href", _$escape(href(), true), false) + _$ssrAttribute("aria-label", _$escape(props.dotLabels?.[index], true), false) + _$ssrAttribute("data-dot-index", _$escape(index, true), false) + _$ssrAttribute("tabindex", stop() === index ? 0 : -1, false), _$escape(mark(index)))
|
|
88
|
+
})));
|
|
89
|
+
}
|
|
90
|
+
})
|
|
91
|
+
})), false);
|
|
29
92
|
}
|
|
30
93
|
export default DotStrip;
|
|
31
94
|
//# sourceMappingURL=DotStrip.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["surfaces/DotStrip.tsx"],"sourcesContent":["import { For, type JSX } from \"solid-js\";\n\n
|
|
1
|
+
{"version":3,"names":[],"sources":["surfaces/DotStrip.tsx"],"sourcesContent":["import { createSignal, For, type JSX, Show } from \"solid-js\";\n\n/**\n * `accent` = the app colour (it worked), `success` = it worked, in the success colour, `ai` = came from AI,\n * `warning` = skipped or needs a look, `danger` = failed, `muted` = nothing to do, `running` = runs now.\n */\nexport type DotStripTone = \"accent\" | \"success\" | \"warning\" | \"danger\" | \"ai\" | \"muted\" | \"running\";\n\ntype DotStripBase = {\n /** Outcomes in order, left to right. */\n dots: readonly DotStripTone[];\n /** Total slots. Slots after `dots` show as empty places, so a growing strip keeps its size. Defaults to `dots.length`. */\n length?: number;\n /** Shows every slot as a quiet placeholder, for \"nothing checked yet\". */\n waiting?: boolean;\n /** Index of the dot that belongs to the item shown next to the strip. */\n selected?: number | null;\n size?: \"md\" | \"lg\";\n /**\n * `dot`, the default: round marks whose shape follows the state, so colour is never the only sign. `bar`: upright\n * bars, 5 × 22 px at `lg`, as for the last runs beside a time. `slot`: square places, as for the places of a runner.\n */\n variant?: \"dot\" | \"bar\" | \"slot\";\n /** Dots per row; more wrap into further rows of the same width. Defaults to one row. */\n columns?: number;\n /** Names the strip and its counts, for example \"Last 50 mails: 17 matched, 6 skipped, 27 not\". */\n label: string;\n class?: string;\n};\n\nexport type DotStripProps = DotStripBase &\n (\n | { links?: undefined; dotLabels?: undefined }\n | {\n /**\n * One link per dot, such as the run it stands for; a dot without a link stays a named mark. The strip is then a\n * list with one tab stop: arrow keys, Home, and End move between the links.\n */\n links: readonly (string | undefined)[];\n /** One accessible name per dot, such as \"Run at 14:01: failed\". */\n dotLabels: readonly string[];\n }\n );\n\ntype DotState = DotStripTone | \"pending\" | \"waiting\";\n\n/** A fixed-size row of outcome marks: the last runs, checks or mails at a glance, each optionally a link. */\nexport function DotStrip(props: DotStripProps): JSX.Element {\n const length = () => Math.max(props.length ?? props.dots.length, props.dots.length);\n const slots = () => Array.from({ length: length() }, (_, index) => index);\n const state = (index: number): DotState => {\n if (props.waiting) return \"waiting\";\n return props.dots[index] ?? \"pending\";\n };\n const linked = () => Boolean(props.links?.length);\n const linkIndexes = () => slots().filter((index) => props.links?.[index]);\n // One tab stop for the whole strip, on the newest run until the person moves it.\n const [current, setCurrent] = createSignal<number>();\n const stop = () => {\n const indexes = linkIndexes();\n const chosen = current();\n return chosen !== undefined && indexes.includes(chosen) ? chosen : indexes.at(-1);\n };\n let root: HTMLDivElement | undefined;\n const move = (event: KeyboardEvent) => {\n const indexes = linkIndexes();\n const at = indexes.indexOf(stop() ?? -1);\n const next =\n event.key === \"ArrowRight\" || event.key === \"ArrowDown\"\n ? indexes[Math.min(indexes.length - 1, at + 1)]\n : event.key === \"ArrowLeft\" || event.key === \"ArrowUp\"\n ? indexes[Math.max(0, at - 1)]\n : event.key === \"Home\"\n ? indexes[0]\n : event.key === \"End\"\n ? indexes.at(-1)\n : undefined;\n if (next === undefined) return;\n event.preventDefault();\n setCurrent(next);\n root?.querySelector<HTMLElement>(`[data-dot-index=\"${next}\"]`)?.focus();\n };\n const mark = (index: number) => (\n // The AI tones carry their own `-ai` class: the AI palette stays with AI surfaces (F3).\n <i\n class={state(index) === \"ai\" || state(index) === \"running\" ? \"k2b-dot-strip__dot k2b-dot-strip__dot-ai\" : \"k2b-dot-strip__dot\"}\n data-state={state(index)}\n data-selected={props.selected === index ? \"\" : undefined}\n />\n );\n return (\n <div\n ref={root}\n class={`k2b-dot-strip ${props.class ?? \"\"}`}\n data-size={props.size ?? \"md\"}\n data-variant={props.variant ?? \"dot\"}\n {...{ role: linked() ? \"list\" : \"img\", \"aria-label\": props.label }}\n style={{ \"--k2b-dot-strip-columns\": String(props.columns ?? length()) }}\n >\n <For each={slots()}>\n {(index) => (\n <Show when={linked()} fallback={mark(index)}>\n <span class=\"k2b-dot-strip__place\" role=\"listitem\">\n <Show\n when={props.links?.[index]}\n fallback={\n <span class=\"k2b-dot-strip__target\" role=\"img\" aria-label={props.dotLabels?.[index]}>\n {mark(index)}\n </span>\n }\n >\n {(href) => (\n <a\n class=\"k2b-dot-strip__target\"\n href={href()}\n aria-label={props.dotLabels?.[index]}\n data-dot-index={index}\n tabIndex={stop() === index ? 0 : -1}\n onFocus={() => setCurrent(index)}\n onKeyDown={move}\n >\n {mark(index)}\n </a>\n )}\n </Show>\n </span>\n </Show>\n )}\n </For>\n </div>\n );\n}\n\nexport default DotStrip;\n"],"mappings":";;;;;;;;;;AAAA,SAAS,YAAY,EAAE,GAAG,EAAY,IAAI,QAAQ,UAAU;;AAE5D;AACA;AACA;AACA;;AAyCA;AACA,OAAO,SAAS,QAAQ,CAAC,KAAoB,EAAe;EAC1D,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;EACnF,MAAM,KAAK,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,KAAK,KAAK,CAAC;EACzE,MAAM,KAAK,GAAI,KAAa,IAAe;IACzC,IAAI,KAAK,CAAC,OAAO,EAAE,OAAO,SAAS;IACnC,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,SAAS;EACvC,CAAC;EACD,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC;EACjD,MAAM,WAAW,GAAG,MAAM,KAAK,CAAC,CAAC,CAAC,MAAM,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AK,CAAC,4DACpB,KAAK,6CACX,IAAI,CAAC,CAAC,KAAK,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC,mBAIlC,IAAI,CAAC,KAAK,CAAC;QAEf;MAAA;IAAA;EAIR;AAIT;AAEA,eAAe,QAAQ","ignoreList":[]}
|
|
@@ -6,14 +6,18 @@ import { escape as _$escape } from "solid-js/web";
|
|
|
6
6
|
var _tmpl$ = ["<div class=\"k2b-link-card__media\">", "</div>"],
|
|
7
7
|
_tmpl$2 = ["<div class=\"k2b-link-card__copy\"><span class=\"k2b-link-card__title\">", "</span><p class=\"k2b-link-card__description\">", "</p></div>"],
|
|
8
8
|
_tmpl$3 = ["<span class=\"k2b-link-card__meta\">", "</span>"],
|
|
9
|
-
_tmpl$4 = "<
|
|
10
|
-
_tmpl$5 = ["<
|
|
11
|
-
_tmpl$6 = ["<
|
|
9
|
+
_tmpl$4 = ["<span class=\"k2b-link-card__aside\">", "</span>"],
|
|
10
|
+
_tmpl$5 = ["<span class=\"k2b-link-card__body\">", "</span>"],
|
|
11
|
+
_tmpl$6 = ["<div class=\"k2b-link-card__icon k2b-icon-tile\"><i class=\"", "\" aria-hidden=\"true\"></i></div>"],
|
|
12
|
+
_tmpl$7 = "<i class=\"ti ti-chevron-right k2b-link-card__chevron\" aria-hidden=\"true\"></i>",
|
|
13
|
+
_tmpl$8 = ["<span class=\"k2b-link-card__footer\"><span class=\"k2b-link-card__footer-start\">", "</span><span class=\"k2b-link-card__footer-end\">", "</span></span>"],
|
|
14
|
+
_tmpl$9 = ["<a", " class=\"k2b-link-card\"", " data-surface=\"plain\"", " data-interactive=\"true\">", "</a>"];
|
|
12
15
|
import { Link } from "@k2b/ssr/nav";
|
|
13
16
|
import { Show } from "solid-js";
|
|
14
17
|
import { Paper } from "./Paper";
|
|
15
18
|
export function LinkCard(props) {
|
|
16
19
|
const plain = () => props.surface === "plain";
|
|
20
|
+
const stacked = () => Boolean(props.aside || props.body || props.footer);
|
|
17
21
|
const content = [_$createComponent(Show, {
|
|
18
22
|
get when() {
|
|
19
23
|
return props.media;
|
|
@@ -23,7 +27,7 @@ export function LinkCard(props) {
|
|
|
23
27
|
get when() {
|
|
24
28
|
return props.icon;
|
|
25
29
|
},
|
|
26
|
-
children: icon => _$ssr(_tmpl$
|
|
30
|
+
children: icon => _$ssr(_tmpl$6, `${_$escape(icon(), true)} k2b-link-card__glyph`)
|
|
27
31
|
});
|
|
28
32
|
},
|
|
29
33
|
get children() {
|
|
@@ -38,10 +42,39 @@ export function LinkCard(props) {
|
|
|
38
42
|
}
|
|
39
43
|
}), _$createComponent(Show, {
|
|
40
44
|
get when() {
|
|
41
|
-
return
|
|
45
|
+
return stacked();
|
|
46
|
+
},
|
|
47
|
+
get fallback() {
|
|
48
|
+
return _$createComponent(Show, {
|
|
49
|
+
get when() {
|
|
50
|
+
return !plain();
|
|
51
|
+
},
|
|
52
|
+
get children() {
|
|
53
|
+
return _$ssr(_tmpl$7);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
42
56
|
},
|
|
43
57
|
get children() {
|
|
44
|
-
return _$
|
|
58
|
+
return [_$createComponent(Show, {
|
|
59
|
+
get when() {
|
|
60
|
+
return props.aside;
|
|
61
|
+
},
|
|
62
|
+
get children() {
|
|
63
|
+
return _$ssr(_tmpl$4, _$escape(props.aside));
|
|
64
|
+
}
|
|
65
|
+
}), _$createComponent(Show, {
|
|
66
|
+
get when() {
|
|
67
|
+
return props.body;
|
|
68
|
+
},
|
|
69
|
+
get children() {
|
|
70
|
+
return _$ssr(_tmpl$5, _$escape(props.body));
|
|
71
|
+
}
|
|
72
|
+
}), _$createComponent(Show, {
|
|
73
|
+
get when() {
|
|
74
|
+
return props.footer;
|
|
75
|
+
},
|
|
76
|
+
children: footer => _$ssr(_tmpl$8, _$escape(footer().start), _$escape(footer().end))
|
|
77
|
+
})];
|
|
45
78
|
}
|
|
46
79
|
})];
|
|
47
80
|
if (props.navigation === "enhanced" && props.onNavigate) {
|
|
@@ -61,11 +94,14 @@ export function LinkCard(props) {
|
|
|
61
94
|
get ["data-surface"]() {
|
|
62
95
|
return plain() ? "plain" : undefined;
|
|
63
96
|
},
|
|
97
|
+
get ["data-layout"]() {
|
|
98
|
+
return stacked() ? "stacked" : undefined;
|
|
99
|
+
},
|
|
64
100
|
"data-interactive": "true",
|
|
65
101
|
children: content
|
|
66
102
|
});
|
|
67
103
|
}
|
|
68
|
-
if (plain()) return _$ssr(_tmpl$
|
|
104
|
+
if (plain()) return _$ssr(_tmpl$9, _$ssrAttribute("href", _$escape(props.href, true), false), _$ssrAttribute("data-color", _$escape(props.color, true), false), _$ssrAttribute("data-layout", stacked() ? "stacked" : _$escape(undefined, true), false), _$escape(content));
|
|
69
105
|
return _$createComponent(Paper, {
|
|
70
106
|
as: "a",
|
|
71
107
|
get href() {
|
|
@@ -75,6 +111,9 @@ export function LinkCard(props) {
|
|
|
75
111
|
get ["data-color"]() {
|
|
76
112
|
return props.color;
|
|
77
113
|
},
|
|
114
|
+
get ["data-layout"]() {
|
|
115
|
+
return stacked() ? "stacked" : undefined;
|
|
116
|
+
},
|
|
78
117
|
interactive: true,
|
|
79
118
|
children: content
|
|
80
119
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["surfaces/LinkCard.tsx"],"sourcesContent":["import { Link, type LinkNavigateEvent } from \"@k2b/ssr/nav\";\nimport { type JSX, Show } from \"solid-js\";\nimport { Paper } from \"./Paper\";\n\nexport type LinkCardColor = \"blue\" | \"emerald\" | \"violet\" | \"orange\" | \"red\" | \"amber\" | \"zinc\" | \"cyan\" | \"rose\";\n\nexport type LinkCardProps = {\n href: string;\n navigation?: \"document\" | \"enhanced\";\n onNavigate?: (event: LinkNavigateEvent) => void | Promise<void>;\n title: string;\n description: string;\n /** Tabler icon class of the icon tile. Omit it only together with `media`. */\n icon?: string;\n /** Replaces the icon tile, for example with a `FileTypeIcon` for a file. */\n media?: JSX.Element;\n /** Glyph color. Omit it to use the host application's accent. */\n color?: LinkCardColor;\n /** One trailing fact, such as a count or a badge. */\n meta?: JSX.Element;\n /**\n * `paper` (default) is a framed card. `plain` is a flat entry for a quiet overview: no frame and no surface until\n * hover, no chevron. Put plain cards in `AppOverview.Cards surface=\"plain\"`.\n */\n surface?: \"paper\" | \"plain\";\n};\n\nexport function LinkCard(props: LinkCardProps): JSX.Element {\n const plain = () => props.surface === \"plain\";\n const content = (\n <>\n <Show\n when={props.media}\n fallback={\n <Show when={props.icon}>\n {(icon) => (\n <div class=\"k2b-link-card__icon k2b-icon-tile\">\n <i class={`${icon()} k2b-link-card__glyph`} aria-hidden=\"true\" />\n </div>\n )}\n </Show>\n }\n >\n <div class=\"k2b-link-card__media\">{props.media}</div>\n </Show>\n <div class=\"k2b-link-card__copy\">\n <span class=\"k2b-link-card__title\">{props.title}</span>\n <p class=\"k2b-link-card__description\">{props.description}</p>\n </div>\n <Show when={props.meta}>\n <span class=\"k2b-link-card__meta\">{props.meta}</span>\n </Show>\n <Show when={!plain()}>\n
|
|
1
|
+
{"version":3,"names":[],"sources":["surfaces/LinkCard.tsx"],"sourcesContent":["import { Link, type LinkNavigateEvent } from \"@k2b/ssr/nav\";\nimport { type JSX, Show } from \"solid-js\";\nimport { Paper } from \"./Paper\";\n\nexport type LinkCardColor = \"blue\" | \"emerald\" | \"violet\" | \"orange\" | \"red\" | \"amber\" | \"zinc\" | \"cyan\" | \"rose\";\n\nexport type LinkCardProps = {\n href: string;\n navigation?: \"document\" | \"enhanced\";\n onNavigate?: (event: LinkNavigateEvent) => void | Promise<void>;\n title: string;\n description: string;\n /** Tabler icon class of the icon tile. Omit it only together with `media`. */\n icon?: string;\n /** Replaces the icon tile, for example with a `FileTypeIcon` for a file. */\n media?: JSX.Element;\n /** Glyph color. Omit it to use the host application's accent. */\n color?: LinkCardColor;\n /** One trailing fact, such as a count or a badge. */\n meta?: JSX.Element;\n /**\n * `paper` (default) is a framed card. `plain` is a flat entry for a quiet overview: no frame and no surface until\n * hover, no chevron. Put plain cards in `AppOverview.Cards surface=\"plain\"`.\n */\n surface?: \"paper\" | \"plain\";\n /**\n * The card as a small overview of one thing, as on \"My apps & automations\": `aside` stands top right beside the\n * title, such as a strip of the last runs; `body` is a line under the head, such as what it did last; `footer` is\n * the last line, `start` (a state with its sign) and `end` (a quiet time). Any of them stacks the card: head, body,\n * and footer one below the other, the footer on the card's bottom edge, a 10 px radius, and no chevron. Its title and\n * description wrap instead of ending in \"…\". The whole\n * card stays one link, so these places hold text and marks, never links or buttons.\n */\n aside?: JSX.Element;\n body?: JSX.Element;\n footer?: { start?: JSX.Element; end?: JSX.Element };\n};\n\nexport function LinkCard(props: LinkCardProps): JSX.Element {\n const plain = () => props.surface === \"plain\";\n const stacked = () => Boolean(props.aside || props.body || props.footer);\n const content = (\n <>\n <Show\n when={props.media}\n fallback={\n <Show when={props.icon}>\n {(icon) => (\n <div class=\"k2b-link-card__icon k2b-icon-tile\">\n <i class={`${icon()} k2b-link-card__glyph`} aria-hidden=\"true\" />\n </div>\n )}\n </Show>\n }\n >\n <div class=\"k2b-link-card__media\">{props.media}</div>\n </Show>\n <div class=\"k2b-link-card__copy\">\n <span class=\"k2b-link-card__title\">{props.title}</span>\n <p class=\"k2b-link-card__description\">{props.description}</p>\n </div>\n <Show when={props.meta}>\n <span class=\"k2b-link-card__meta\">{props.meta}</span>\n </Show>\n {/* One insertion for the chevron or every stacked place, so a classic card renders exactly as before. */}\n <Show\n when={stacked()}\n fallback={\n <Show when={!plain()}>\n <i class=\"ti ti-chevron-right k2b-link-card__chevron\" aria-hidden=\"true\" />\n </Show>\n }\n >\n <Show when={props.aside}>\n <span class=\"k2b-link-card__aside\">{props.aside}</span>\n </Show>\n <Show when={props.body}>\n <span class=\"k2b-link-card__body\">{props.body}</span>\n </Show>\n <Show when={props.footer}>\n {(footer) => (\n <span class=\"k2b-link-card__footer\">\n <span class=\"k2b-link-card__footer-start\">{footer().start}</span>\n <span class=\"k2b-link-card__footer-end\">{footer().end}</span>\n </span>\n )}\n </Show>\n </Show>\n </>\n );\n if (props.navigation === \"enhanced\" && props.onNavigate) {\n return (\n <Link\n href={props.href}\n onNavigate={props.onNavigate}\n class={plain() ? \"k2b-link-card\" : \"k2b-paper k2b-link-card\"}\n data-color={props.color}\n data-surface={plain() ? \"plain\" : undefined}\n data-layout={stacked() ? \"stacked\" : undefined}\n data-interactive=\"true\"\n >\n {content}\n </Link>\n );\n }\n if (plain())\n return (\n <a\n href={props.href}\n class=\"k2b-link-card\"\n data-color={props.color}\n data-surface=\"plain\"\n data-layout={stacked() ? \"stacked\" : undefined}\n data-interactive=\"true\"\n >\n {content}\n </a>\n );\n return (\n <Paper\n as=\"a\"\n href={props.href}\n class=\"k2b-link-card\"\n data-color={props.color}\n data-layout={stacked() ? \"stacked\" : undefined}\n interactive\n >\n {content}\n </Paper>\n );\n}\n\nexport default LinkCard;\n"],"mappings":";;;;;;;;;;;;;;AAAA,SAAS,IAAI,QAAgC,cAAc;AAC3D,SAAmB,IAAI,QAAQ,UAAU;AACzC,SAAS,KAAK,QAAQ,SAAS;AAoC/B,OAAO,SAAS,QAAQ,CAAC,KAAoB,EAAe;EAC1D,MAAM,KAAK,GAAG,MAAM,KAAK,CAAC,OAAO,KAAK,OAAO;EAC7C,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,MAAM,CAAC;EACxE,MAAM,OAAO,sBAER,IAAI;IAAA,IACH,IAAI;MAAA,OAAE,KAAK,CAAC,KAAK;IAAA;IAAA,IACjB,QAAQ;MAAA,yBACL,IAAI;QAAA,IAAC,IAAI;UAAA,OAAE,KAAK,CAAC,IAAI;QAAA;QAAA,UAClB,IAAI,mBAEQ,YAAG,IAAI,CAAC,CAAC,8BAAuB;MAE7C;IAAA;IAAA;MAAA,8BAI8B,KAAK,CAAC,KAAK;IAAA;EAAA,4BAGV,KAAK,CAAC,KAAK,YACR,KAAK,CAAC,WAAW,sBAEzD,IAAI;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DAEU,KAAK,CAAC,IAAI,uDAEJ,KAAK,CAAC,KAAK,+CAEV,OAAO,CAAC,CAAC,GAAG,SAAS,YAAG,SAAS,0BAG7C,OAAO;EAGd,yBACG,KAAK;IACJ,EAAE;IAAA,IACF,IAAI;MAAA,OAAE,KAAK,CAAC,IAAI;IAAA;IAAA;IAAA;MAAA,OAEJ,KAAK,CAAC,KAAK;IAAA;IAAA;MAAA,OACV,OAAO,CAAC,CAAC,GAAG,SAAS,GAAG,SAAS;IAAA;IAC9C,WAAW;IAAA,UAEV;EAAO;AAGd;AAEA,eAAe,QAAQ","ignoreList":[]}
|
|
@@ -89,6 +89,8 @@ const SectionRoot = props => {
|
|
|
89
89
|
|
|
90
90
|
// Resolve once and only while ready: reading `children` twice would build the body twice.
|
|
91
91
|
const resolved = children(() => state() === "ready" ? local.children : undefined);
|
|
92
|
+
// A JSX action must also be built once: checking the slot and then reading it again creates different hydration keys.
|
|
93
|
+
const resolvedActions = children(() => local.actions);
|
|
92
94
|
const hasBody = () => local.collapsible || state() !== "ready" || Boolean(resolved.toArray().length) || Boolean(local.footer);
|
|
93
95
|
|
|
94
96
|
/** Icon, then the title with its count, state, and restricted marker in one row, then the description. */
|
|
@@ -183,10 +185,10 @@ const SectionRoot = props => {
|
|
|
183
185
|
}
|
|
184
186
|
}))), _$escape(_$createComponent(Show, {
|
|
185
187
|
get when() {
|
|
186
|
-
return
|
|
188
|
+
return resolvedActions();
|
|
187
189
|
},
|
|
188
190
|
get children() {
|
|
189
|
-
return _$ssr(_tmpl$11, _$escape(
|
|
191
|
+
return _$ssr(_tmpl$11, _$escape(resolvedActions()));
|
|
190
192
|
}
|
|
191
193
|
})));
|
|
192
194
|
},
|
|
@@ -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 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={local.actions}>\n <div class=\"k2b-section__actions\">{local.actions}</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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AAK,GAAG,CAAC,EAAE,CAAC,CAAC;IAAA;IAAE,EAAE,EAAE,EAAE;IAAA;IAAA;MAAA,OAC3C,KAAK,CAAC,KAAK;IAAA;EAAA,cAEb,KAAK,CAAC,QAAQ;AAGrB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,MAAM,gBAAgB,GAAI,KAAmB,IAC3C;AAAA,kBACC,YAAY,CAAC,QAAQ;EAAA,IAAC,KAAK;IAAA,OAAE,KAAK,CAAC,KAAK,KAAK,KAAK,CAAC,IAAI,KAAK,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;EAAA;EAAA;IAAA,yBACvE,WAAW,EAAK,KAAK;EAAA;AAAA,EAEzB;AAED,OAAO,MAAM,OAAO,GAAG,gBAAoC;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 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,M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ACvE,WAAW,EAAK,KAAK;EAAA;AAAA,EAEzB;AAED,OAAO,MAAM,OAAO,GAAG,gBAAoC;AAC3D,OAAO,CAAC,IAAI,GAAG,WAAW;AAE1B,eAAe,OAAO","ignoreList":[]}
|
|
@@ -38,6 +38,15 @@ import { useStatCellMessages } from "./stat-cell-messages";
|
|
|
38
38
|
|
|
39
39
|
function Body(props) {
|
|
40
40
|
const gridSize = useStatGridSize();
|
|
41
|
+
// A plain figure keeps its change off the figure's line: the third line holds it with the comparison.
|
|
42
|
+
const surface = useStatGridSurface();
|
|
43
|
+
const plain = () => surface() === "plain";
|
|
44
|
+
const badge = delta => _$createComponent(DeltaBadge, {
|
|
45
|
+
delta: delta,
|
|
46
|
+
get compare() {
|
|
47
|
+
return props.compare;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
41
50
|
const size = () => props.size ?? gridSize;
|
|
42
51
|
const accent = () => props.accent;
|
|
43
52
|
const locale = useLocale();
|
|
@@ -79,16 +88,9 @@ function Body(props) {
|
|
|
79
88
|
}
|
|
80
89
|
}))), _$createComponent(Show, {
|
|
81
90
|
get when() {
|
|
82
|
-
return _$memo(() =>
|
|
91
|
+
return _$memo(() => !!(!plain() && !empty()))() && props.delta;
|
|
83
92
|
},
|
|
84
|
-
children: delta =>
|
|
85
|
-
get delta() {
|
|
86
|
-
return delta();
|
|
87
|
-
},
|
|
88
|
-
get compare() {
|
|
89
|
-
return props.compare;
|
|
90
|
-
}
|
|
91
|
-
})
|
|
93
|
+
children: delta => badge(delta())
|
|
92
94
|
})];
|
|
93
95
|
},
|
|
94
96
|
get children() {
|
|
@@ -116,6 +118,11 @@ function Body(props) {
|
|
|
116
118
|
},
|
|
117
119
|
get fallback() {
|
|
118
120
|
return [_$createComponent(Show, {
|
|
121
|
+
get when() {
|
|
122
|
+
return _$memo(() => !!(plain() && !empty()))() && props.delta;
|
|
123
|
+
},
|
|
124
|
+
children: delta => badge(delta())
|
|
125
|
+
}), _$createComponent(Show, {
|
|
119
126
|
get when() {
|
|
120
127
|
return props.compare;
|
|
121
128
|
},
|
|
@@ -196,12 +203,17 @@ function Body(props) {
|
|
|
196
203
|
|
|
197
204
|
/**
|
|
198
205
|
* One key figure as a framed tile: icon and label, the figure with its change, and a support line with the comparison
|
|
199
|
-
* and the trend. Each state (loading, error, stale, empty)
|
|
206
|
+
* and the trend. In a `plain` grid the same three rows stand without a frame. Each state (loading, error, stale, empty)
|
|
207
|
+
* keeps the tile's place and size.
|
|
200
208
|
*/
|
|
201
209
|
export function StatCell(props) {
|
|
202
210
|
const gridSize = useStatGridSize();
|
|
203
211
|
const size = () => props.size ?? gridSize;
|
|
212
|
+
// A plain figure has no surface; its tone colours the figure instead of only the icon chip.
|
|
204
213
|
const surface = useStatGridSurface();
|
|
214
|
+
const plain = () => surface() === "plain";
|
|
215
|
+
const variant = () => plain() ? "plain" : undefined;
|
|
216
|
+
const tone = () => plain() ? props.tone : undefined;
|
|
205
217
|
return _$createComponent(Show
|
|
206
218
|
// A tile that offers a retry is no link: the button must not sit inside it.
|
|
207
219
|
, {
|
|
@@ -209,10 +221,10 @@ export function StatCell(props) {
|
|
|
209
221
|
return _$memo(() => !!(props.href && !props.status))() && !(props.stale && props.onRetry);
|
|
210
222
|
},
|
|
211
223
|
get fallback() {
|
|
212
|
-
return _$ssr(_tmpl$16, _$ssrAttribute("data-size", _$escape(size(), true), false) + _$ssrAttribute("data-surface", _$escape(surface, 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)));
|
|
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)));
|
|
213
225
|
},
|
|
214
226
|
get children() {
|
|
215
|
-
return _$ssr(_tmpl$15, _$ssrAttribute("href", _$escape(props.href, true), false), _$ssrAttribute("data-size", _$escape(size(), true), false) + _$ssrAttribute("data-surface", _$escape(surface, true), false) + _$ssrAttribute("data-wrap", _$escape(props.wrap || undefined, true), false) + _$ssrAttribute("data-delta-placement", _$escape(props.deltaPlacement, true), false), _$escape(_$createComponent(Body, props)));
|
|
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)));
|
|
216
228
|
}
|
|
217
229
|
});
|
|
218
230
|
}
|
|
@@ -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 /** The chip colour of `icon`. Defaults to zinc. */\n tone?: StatCellTone | \"in\" | \"out\";\n accent?: StatCellAccent;\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 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={!empty() && props.delta}>{(delta) => <DeltaBadge delta={delta()} compare={props.compare} />}</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={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. Each state (loading, error, stale, empty) 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 const surface = useStatGridSurface();\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={surface}\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={surface}\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":";;;;;;;;;;;;;;;;;;;;;;;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;;AA6CA,SAAS,IAAI,CAAC,KAAoB,EAAe;EAC/C,MAAM,QAAQ,GAAG,eAAe,CAAC,CAAC;EAClC,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,IAAI,IAAI,QAAQ;EACzC,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,MAAM;EACjC,MAAM,MAAM,GAAG,SAAS,CAAC,CAAC;EAC1B,MAAM,CAAC,GAAG,mBAAmB,CAAC,CAAC;EAC/B,MAAM,mBAA0C,GAAG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AE,KAAK,CAAC,OAAO;YAAA;YAAA,UACrB,KAAK,6BAEF,CAAC,CAAC,CAAC,CAAC,KAAK;UAEb;QAAA;MAAA;IAAA;EAAA;AAOf;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAAS,QAAQ,CAAC,KAAoB,EAAe;EAC1D,MAAM,QAAQ,GAAG,eAAe,CAAC,CAAC;EAClC,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,IAAI,IAAI,QAAQ;EACzC,MAAM,OAAO,GAAG,kBAAkB,CAAC,CAAC;EACpC,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,0DACH,OAAO,uDACV,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,0DACH,OAAO,uDACV,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 /** 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":";;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAmB,KAAK,EA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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
|
+
|
|
12
|
+
/** `tiles` frames each figure; `plain` sets the figures in equal columns with a thin line between, for a page head. */
|
|
13
|
+
|
|
11
14
|
const StatGridSizeContext = createContext("md");
|
|
12
|
-
|
|
15
|
+
// A plain grid has no surface, so the surface context carries "plain" to its cells; a cell outside a grid stays a tile.
|
|
16
|
+
const StatGridSurfaceContext = createContext(() => "white");
|
|
13
17
|
export const useStatGridSize = () => useContext(StatGridSizeContext);
|
|
14
18
|
export const useStatGridSurface = () => useContext(StatGridSurfaceContext);
|
|
15
19
|
const columnValue = columns => {
|
|
@@ -17,10 +21,14 @@ const columnValue = columns => {
|
|
|
17
21
|
return 4;
|
|
18
22
|
};
|
|
19
23
|
|
|
20
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* A row of key figures, each a framed tile of its own or, with `variant="plain"`, flat figures in equal columns; the
|
|
26
|
+
* optional title and action sit above the row.
|
|
27
|
+
*/
|
|
21
28
|
export function StatGrid(props) {
|
|
22
29
|
const surface = () => props.surface ?? "white";
|
|
23
|
-
|
|
30
|
+
const plain = () => props.variant === "plain";
|
|
31
|
+
return _$ssr(_tmpl$3, `k2b-stat-grid ${_$escape(props.class ?? "", true)}`, _$ssrAttribute("data-columns", _$escape(columnValue(props.columns), true), false) + _$ssrAttribute("data-size", _$escape(props.size ?? "md", true), false) + _$ssrAttribute("data-surface", _$escape(surface(), true), false) + _$ssrAttribute("data-variant", plain() ? "plain" : "tiles", false) + _$ssrAttribute("aria-label", _$escape(props.title, true), false), _$escape(_$createComponent(Show, {
|
|
24
32
|
get when() {
|
|
25
33
|
return props.title;
|
|
26
34
|
},
|
|
@@ -38,9 +46,7 @@ export function StatGrid(props) {
|
|
|
38
46
|
},
|
|
39
47
|
get children() {
|
|
40
48
|
return _$createComponent(StatGridSurfaceContext.Provider, {
|
|
41
|
-
|
|
42
|
-
return surface();
|
|
43
|
-
},
|
|
49
|
+
value: () => plain() ? "plain" : surface(),
|
|
44
50
|
get children() {
|
|
45
51
|
return _$ssr(_tmpl$2, _$escape(props.children));
|
|
46
52
|
}
|