cursedbelt 5.40.0 → 5.45.1
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/react/Toast.d.ts +12 -2
- package/dist/react/Toast.d.ts.map +1 -1
- package/dist/react/Toast.js +32 -3
- package/dist/react/Toast.js.map +1 -1
- package/dist/react/analytics/MetricDrilldown.js +1 -1
- package/dist/react/canvas-hud/CanvasMinimap.d.ts +32 -0
- package/dist/react/canvas-hud/CanvasMinimap.d.ts.map +1 -0
- package/dist/react/canvas-hud/CanvasMinimap.js +32 -0
- package/dist/react/canvas-hud/CanvasMinimap.js.map +1 -0
- package/dist/react/canvas-hud/CanvasNodeMenu.d.ts +34 -0
- package/dist/react/canvas-hud/CanvasNodeMenu.d.ts.map +1 -0
- package/dist/react/canvas-hud/CanvasNodeMenu.js +21 -0
- package/dist/react/canvas-hud/CanvasNodeMenu.js.map +1 -0
- package/dist/react/canvas-hud/CanvasSearchField.d.ts +27 -0
- package/dist/react/canvas-hud/CanvasSearchField.d.ts.map +1 -0
- package/dist/react/canvas-hud/CanvasSearchField.js +35 -0
- package/dist/react/canvas-hud/CanvasSearchField.js.map +1 -0
- package/dist/react/canvas-hud/HudControls.d.ts +43 -0
- package/dist/react/canvas-hud/HudControls.d.ts.map +1 -0
- package/dist/react/canvas-hud/HudControls.js +22 -0
- package/dist/react/canvas-hud/HudControls.js.map +1 -0
- package/dist/react/canvas-hud/index.d.ts +13 -0
- package/dist/react/canvas-hud/index.d.ts.map +1 -0
- package/dist/react/canvas-hud/index.js +7 -0
- package/dist/react/canvas-hud/index.js.map +1 -0
- package/dist/react/canvas-hud/useCanvasWheel.d.ts +41 -0
- package/dist/react/canvas-hud/useCanvasWheel.d.ts.map +1 -0
- package/dist/react/canvas-hud/useCanvasWheel.js +65 -0
- package/dist/react/canvas-hud/useCanvasWheel.js.map +1 -0
- package/dist/react/canvas-hud/viewport.d.ts +68 -0
- package/dist/react/canvas-hud/viewport.d.ts.map +1 -0
- package/dist/react/canvas-hud/viewport.js +77 -0
- package/dist/react/canvas-hud/viewport.js.map +1 -0
- package/dist/react/charts/AreaChart.d.ts.map +1 -1
- package/dist/react/charts/AreaChart.js +5 -5
- package/dist/react/charts/AreaChart.js.map +1 -1
- package/dist/react/charts/BarChart.d.ts.map +1 -1
- package/dist/react/charts/BarChart.js +3 -3
- package/dist/react/charts/BarChart.js.map +1 -1
- package/dist/react/charts/ChartCard.d.ts +53 -0
- package/dist/react/charts/ChartCard.d.ts.map +1 -0
- package/dist/react/charts/ChartCard.js +46 -0
- package/dist/react/charts/ChartCard.js.map +1 -0
- package/dist/react/charts/ChartFrame.d.ts +12 -5
- package/dist/react/charts/ChartFrame.d.ts.map +1 -1
- package/dist/react/charts/ChartFrame.js +12 -5
- package/dist/react/charts/ChartFrame.js.map +1 -1
- package/dist/react/charts/ChartLegend.js +1 -1
- package/dist/react/charts/ChartLegend.js.map +1 -1
- package/dist/react/charts/HeatmapChart.js +3 -3
- package/dist/react/charts/HeatmapChart.js.map +1 -1
- package/dist/react/charts/IntervalTimeline.js +1 -1
- package/dist/react/charts/IntervalTimeline.js.map +1 -1
- package/dist/react/charts/LineChart.d.ts.map +1 -1
- package/dist/react/charts/LineChart.js +3 -3
- package/dist/react/charts/LineChart.js.map +1 -1
- package/dist/react/charts/TimeSeriesChart.d.ts.map +1 -1
- package/dist/react/charts/TimeSeriesChart.js +6 -6
- package/dist/react/charts/TimeSeriesChart.js.map +1 -1
- package/dist/react/charts/chartBox.d.ts +46 -0
- package/dist/react/charts/chartBox.d.ts.map +1 -0
- package/dist/react/charts/chartBox.js +45 -0
- package/dist/react/charts/chartBox.js.map +1 -0
- package/dist/react/charts/index.d.ts +2 -0
- package/dist/react/charts/index.d.ts.map +1 -1
- package/dist/react/charts/index.js +2 -0
- package/dist/react/charts/index.js.map +1 -1
- package/dist/react/charts/shared.d.ts +13 -2
- package/dist/react/charts/shared.d.ts.map +1 -1
- package/dist/react/charts/shared.js +14 -3
- package/dist/react/charts/shared.js.map +1 -1
- package/dist/react/chat/Bubble.js +4 -4
- package/dist/react/chat/Bubble.js.map +1 -1
- package/dist/react/chat/MessageScroller.js +1 -1
- package/dist/react/chat/MessageScroller.js.map +1 -1
- package/dist/react/components/ActionBar.d.ts.map +1 -1
- package/dist/react/components/ActionBar.js +63 -1
- package/dist/react/components/ActionBar.js.map +1 -1
- package/dist/react/components/AddItemsMenu.js +1 -1
- package/dist/react/components/AddItemsMenu.js.map +1 -1
- package/dist/react/components/Alert.d.ts +16 -2
- package/dist/react/components/Alert.d.ts.map +1 -1
- package/dist/react/components/Alert.js +35 -2
- package/dist/react/components/Alert.js.map +1 -1
- package/dist/react/components/AppShell.d.ts +55 -33
- package/dist/react/components/AppShell.d.ts.map +1 -1
- package/dist/react/components/AppShell.js +141 -31
- package/dist/react/components/AppShell.js.map +1 -1
- package/dist/react/components/AsyncPanel.d.ts +21 -3
- package/dist/react/components/AsyncPanel.d.ts.map +1 -1
- package/dist/react/components/AsyncPanel.js +50 -6
- package/dist/react/components/AsyncPanel.js.map +1 -1
- package/dist/react/components/BannerLane.d.ts +32 -0
- package/dist/react/components/BannerLane.d.ts.map +1 -0
- package/dist/react/components/BannerLane.js +41 -0
- package/dist/react/components/BannerLane.js.map +1 -0
- package/dist/react/components/Button.d.ts.map +1 -1
- package/dist/react/components/Button.js +2 -1
- package/dist/react/components/Button.js.map +1 -1
- package/dist/react/components/Checkbox.d.ts.map +1 -1
- package/dist/react/components/Checkbox.js +7 -2
- package/dist/react/components/Checkbox.js.map +1 -1
- package/dist/react/components/ChipFilterStrip.js +1 -1
- package/dist/react/components/ChipFilterStrip.js.map +1 -1
- package/dist/react/components/ComboboxField.d.ts.map +1 -1
- package/dist/react/components/ComboboxField.js +14 -4
- package/dist/react/components/ComboboxField.js.map +1 -1
- package/dist/react/components/CommentThread.js +2 -2
- package/dist/react/components/CommentThread.js.map +1 -1
- package/dist/react/components/ConfirmDialog.js +1 -1
- package/dist/react/components/ConfirmDialog.js.map +1 -1
- package/dist/react/components/DataTable/DataTable.d.ts +18 -2
- package/dist/react/components/DataTable/DataTable.d.ts.map +1 -1
- package/dist/react/components/DataTable/DataTable.js +51 -12
- package/dist/react/components/DataTable/DataTable.js.map +1 -1
- package/dist/react/components/DataTable/Pagination.js +1 -1
- package/dist/react/components/DataTable/Pagination.js.map +1 -1
- package/dist/react/components/DataTable/RowActions.d.ts +7 -1
- package/dist/react/components/DataTable/RowActions.d.ts.map +1 -1
- package/dist/react/components/DataTable/RowActions.js +10 -3
- package/dist/react/components/DataTable/RowActions.js.map +1 -1
- package/dist/react/components/DataTable/TableFilterBuilder.js +1 -1
- package/dist/react/components/DataTable/TableFilterBuilder.js.map +1 -1
- package/dist/react/components/DataTable/cells/CodeCell.js +1 -1
- package/dist/react/components/DataTable/cells/CodeCell.js.map +1 -1
- package/dist/react/components/DataTable/cells/LinkCell.js +1 -1
- package/dist/react/components/DataTable/cells/LinkCell.js.map +1 -1
- package/dist/react/components/DataTable/index.d.ts +1 -1
- package/dist/react/components/DataTable/index.d.ts.map +1 -1
- package/dist/react/components/DataTable/index.js.map +1 -1
- package/dist/react/components/DataTable/types.d.ts +20 -0
- package/dist/react/components/DataTable/types.d.ts.map +1 -1
- package/dist/react/components/DataTable/types.js +22 -0
- package/dist/react/components/DataTable/types.js.map +1 -1
- package/dist/react/components/DateTimeField.d.ts.map +1 -1
- package/dist/react/components/DateTimeField.js +4 -1
- package/dist/react/components/DateTimeField.js.map +1 -1
- package/dist/react/components/DeleteButton.js +2 -0
- package/dist/react/components/DeleteButton.js.map +1 -1
- package/dist/react/components/Drawer.js +3 -3
- package/dist/react/components/Drawer.js.map +1 -1
- package/dist/react/components/DropdownMenu.d.ts +16 -0
- package/dist/react/components/DropdownMenu.d.ts.map +1 -1
- package/dist/react/components/DropdownMenu.js +22 -6
- package/dist/react/components/DropdownMenu.js.map +1 -1
- package/dist/react/components/EmptyState.d.ts +10 -2
- package/dist/react/components/EmptyState.d.ts.map +1 -1
- package/dist/react/components/EmptyState.js +10 -5
- package/dist/react/components/EmptyState.js.map +1 -1
- package/dist/react/components/EventTimeline.js +1 -1
- package/dist/react/components/EventTimeline.js.map +1 -1
- package/dist/react/components/Field.d.ts.map +1 -1
- package/dist/react/components/Field.js +4 -1
- package/dist/react/components/Field.js.map +1 -1
- package/dist/react/components/FileDropZone.js +1 -1
- package/dist/react/components/FileDropZone.js.map +1 -1
- package/dist/react/components/Grid.d.ts +9 -1
- package/dist/react/components/Grid.d.ts.map +1 -1
- package/dist/react/components/Grid.js +20 -2
- package/dist/react/components/Grid.js.map +1 -1
- package/dist/react/components/Guide.d.ts +31 -0
- package/dist/react/components/Guide.d.ts.map +1 -0
- package/dist/react/components/Guide.js +18 -0
- package/dist/react/components/Guide.js.map +1 -0
- package/dist/react/components/InfoHintImpl.d.ts +0 -13
- package/dist/react/components/InfoHintImpl.d.ts.map +1 -1
- package/dist/react/components/InfoHintImpl.js +17 -1
- package/dist/react/components/InfoHintImpl.js.map +1 -1
- package/dist/react/components/InlineEditableText.js +1 -1
- package/dist/react/components/InlineEditableText.js.map +1 -1
- package/dist/react/components/IsolatedFrame.js +1 -1
- package/dist/react/components/IsolatedFrame.js.map +1 -1
- package/dist/react/components/ListToolbar.d.ts.map +1 -1
- package/dist/react/components/ListToolbar.js +2 -2
- package/dist/react/components/ListToolbar.js.map +1 -1
- package/dist/react/components/LogViewer.d.ts +26 -2
- package/dist/react/components/LogViewer.d.ts.map +1 -1
- package/dist/react/components/LogViewer.js +41 -26
- package/dist/react/components/LogViewer.js.map +1 -1
- package/dist/react/components/Modal.d.ts +5 -1
- package/dist/react/components/Modal.d.ts.map +1 -1
- package/dist/react/components/Modal.js +18 -8
- package/dist/react/components/Modal.js.map +1 -1
- package/dist/react/components/Page.d.ts +51 -7
- package/dist/react/components/Page.d.ts.map +1 -1
- package/dist/react/components/Page.js +53 -8
- package/dist/react/components/Page.js.map +1 -1
- package/dist/react/components/PageGuideButton.d.ts +11 -0
- package/dist/react/components/PageGuideButton.d.ts.map +1 -0
- package/dist/react/components/PageGuideButton.js +52 -0
- package/dist/react/components/PageGuideButton.js.map +1 -0
- package/dist/react/components/PageGuidePopover.d.ts +14 -0
- package/dist/react/components/PageGuidePopover.d.ts.map +1 -0
- package/dist/react/components/PageGuidePopover.js +25 -0
- package/dist/react/components/PageGuidePopover.js.map +1 -0
- package/dist/react/components/PanelSeparator.js +1 -1
- package/dist/react/components/PanelSeparator.js.map +1 -1
- package/dist/react/components/Popover.d.ts.map +1 -1
- package/dist/react/components/Popover.js +2 -1
- package/dist/react/components/Popover.js.map +1 -1
- package/dist/react/components/PromptDialog.js +1 -1
- package/dist/react/components/PromptDialog.js.map +1 -1
- package/dist/react/components/ScrollArea.d.ts +9 -1
- package/dist/react/components/ScrollArea.d.ts.map +1 -1
- package/dist/react/components/ScrollArea.js +9 -3
- package/dist/react/components/ScrollArea.js.map +1 -1
- package/dist/react/components/Section.d.ts +5 -2
- package/dist/react/components/Section.d.ts.map +1 -1
- package/dist/react/components/Section.js +5 -2
- package/dist/react/components/Section.js.map +1 -1
- package/dist/react/components/Skeleton.d.ts +19 -1
- package/dist/react/components/Skeleton.d.ts.map +1 -1
- package/dist/react/components/Skeleton.js +24 -2
- package/dist/react/components/Skeleton.js.map +1 -1
- package/dist/react/components/StatStrip.js +1 -1
- package/dist/react/components/StatStrip.js.map +1 -1
- package/dist/react/components/StatTile.d.ts +30 -3
- package/dist/react/components/StatTile.d.ts.map +1 -1
- package/dist/react/components/StatTile.js +35 -9
- package/dist/react/components/StatTile.js.map +1 -1
- package/dist/react/components/StatTileGrid.d.ts +10 -1
- package/dist/react/components/StatTileGrid.d.ts.map +1 -1
- package/dist/react/components/StatTileGrid.js +50 -33
- package/dist/react/components/StatTileGrid.js.map +1 -1
- package/dist/react/components/StatusPill.d.ts.map +1 -1
- package/dist/react/components/StatusPill.js +26 -1
- package/dist/react/components/StatusPill.js.map +1 -1
- package/dist/react/components/Surface.d.ts +1 -1
- package/dist/react/components/Surface.d.ts.map +1 -1
- package/dist/react/components/Surface.js +20 -11
- package/dist/react/components/Surface.js.map +1 -1
- package/dist/react/components/SwatchPicker.d.ts.map +1 -1
- package/dist/react/components/SwatchPicker.js +5 -1
- package/dist/react/components/SwatchPicker.js.map +1 -1
- package/dist/react/components/Switch.js +1 -1
- package/dist/react/components/Switch.js.map +1 -1
- package/dist/react/components/TagsInput.d.ts.map +1 -1
- package/dist/react/components/TagsInput.js +3 -1
- package/dist/react/components/TagsInput.js.map +1 -1
- package/dist/react/components/WidgetHeader.js +1 -1
- package/dist/react/components/WidgetHeader.js.map +1 -1
- package/dist/react/components/calendar/CalendarLegend.js +1 -1
- package/dist/react/components/calendar/CalendarLegend.js.map +1 -1
- package/dist/react/components/calendar/DayAgenda.js +1 -1
- package/dist/react/components/calendar/DayAgenda.js.map +1 -1
- package/dist/react/components/calendar/EventChip.js +1 -1
- package/dist/react/components/calendar/EventChip.js.map +1 -1
- package/dist/react/components/calendar/MonthGrid.js +1 -1
- package/dist/react/components/calendar/MonthGrid.js.map +1 -1
- package/dist/react/components/calendar/WeekView.js +2 -2
- package/dist/react/components/calendar/WeekView.js.map +1 -1
- package/dist/react/components/cardFrame.d.ts +16 -0
- package/dist/react/components/cardFrame.d.ts.map +1 -0
- package/dist/react/components/cardFrame.js +24 -0
- package/dist/react/components/cardFrame.js.map +1 -0
- package/dist/react/components/dialog.d.ts.map +1 -1
- package/dist/react/components/dialog.js +2 -1
- package/dist/react/components/dialog.js.map +1 -1
- package/dist/react/dashboard-grid/WidgetFrame.js +2 -2
- package/dist/react/dashboard-grid/WidgetFrame.js.map +1 -1
- package/dist/react/emoji/EmojiPicker.js +1 -1
- package/dist/react/emoji/EmojiPicker.js.map +1 -1
- package/dist/react/file-tree/FileTree.d.ts +8 -1
- package/dist/react/file-tree/FileTree.d.ts.map +1 -1
- package/dist/react/file-tree/FileTree.js +29 -4
- package/dist/react/file-tree/FileTree.js.map +1 -1
- package/dist/react/filter-rail/FilterRail.js +1 -1
- package/dist/react/filter-rail/FilterRail.js.map +1 -1
- package/dist/react/folder-tree/FolderPicker.d.ts.map +1 -1
- package/dist/react/folder-tree/FolderPicker.js +5 -1
- package/dist/react/folder-tree/FolderPicker.js.map +1 -1
- package/dist/react/icons.d.ts +28 -0
- package/dist/react/icons.d.ts.map +1 -1
- package/dist/react/icons.js +29 -1
- package/dist/react/icons.js.map +1 -1
- package/dist/react/index.d.ts +9 -6
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +6 -3
- package/dist/react/index.js.map +1 -1
- package/dist/react/lib/menuSections.d.ts +8 -0
- package/dist/react/lib/menuSections.d.ts.map +1 -0
- package/dist/react/lib/menuSections.js +37 -0
- package/dist/react/lib/menuSections.js.map +1 -0
- package/dist/react/lib/whenIdle.d.ts +7 -0
- package/dist/react/lib/whenIdle.d.ts.map +1 -0
- package/dist/react/lib/whenIdle.js +14 -0
- package/dist/react/lib/whenIdle.js.map +1 -0
- package/dist/react/markdown/Markdown.js +2 -2
- package/dist/react/markdown/Markdown.js.map +1 -1
- package/dist/react/media/DenseGalleryShell.d.ts +7 -1
- package/dist/react/media/DenseGalleryShell.d.ts.map +1 -1
- package/dist/react/media/DenseGalleryShell.js +3 -3
- package/dist/react/media/DenseGalleryShell.js.map +1 -1
- package/dist/react/media/HoverScrubVideoThumb.js +1 -1
- package/dist/react/media/HoverScrubVideoThumb.js.map +1 -1
- package/dist/react/media/MaskPainter.js +1 -1
- package/dist/react/media/MediaUploadControl.js +1 -1
- package/dist/react/media/MediaUploadControl.js.map +1 -1
- package/dist/react/media/VideoTrimmer.js +1 -1
- package/dist/react/media/VideoTrimmer.js.map +1 -1
- package/dist/react/media/denseGallery.css +96 -1
- package/dist/react/media-gallery/MediaGallery.d.ts +5 -2
- package/dist/react/media-gallery/MediaGallery.d.ts.map +1 -1
- package/dist/react/media-gallery/MediaGallery.js +1 -1
- package/dist/react/media-gallery/MediaGallery.js.map +1 -1
- package/dist/react/namespace/NamespaceTargetCapsule.js +1 -1
- package/dist/react/namespace/NamespaceTargetCapsule.js.map +1 -1
- package/dist/react/nav/BreadcrumbTrail.js +1 -1
- package/dist/react/nav/BreadcrumbTrail.js.map +1 -1
- package/dist/react/nav/CommandBar.d.ts +7 -1
- package/dist/react/nav/CommandBar.d.ts.map +1 -1
- package/dist/react/nav/CommandBar.js +5 -3
- package/dist/react/nav/CommandBar.js.map +1 -1
- package/dist/react/nav/PlaceBar.d.ts.map +1 -1
- package/dist/react/nav/PlaceBar.js +7 -9
- package/dist/react/nav/PlaceBar.js.map +1 -1
- package/dist/react/nav/SideNav.d.ts +12 -2
- package/dist/react/nav/SideNav.d.ts.map +1 -1
- package/dist/react/nav/SideNav.js +42 -22
- package/dist/react/nav/SideNav.js.map +1 -1
- package/dist/react/nav/TopBar.d.ts +65 -31
- package/dist/react/nav/TopBar.d.ts.map +1 -1
- package/dist/react/nav/TopBar.js +59 -24
- package/dist/react/nav/TopBar.js.map +1 -1
- package/dist/react/nav/index.d.ts +1 -1
- package/dist/react/nav/index.d.ts.map +1 -1
- package/dist/react/nav/index.js +1 -1
- package/dist/react/nav/index.js.map +1 -1
- package/dist/react/nav/navShared.d.ts +10 -1
- package/dist/react/nav/navShared.d.ts.map +1 -1
- package/dist/react/nav/navShared.js +23 -0
- package/dist/react/nav/navShared.js.map +1 -1
- package/dist/react/notifications/NotificationFeed.js +2 -2
- package/dist/react/notifications/NotificationFeed.js.map +1 -1
- package/dist/react/palette/Command.d.ts.map +1 -1
- package/dist/react/palette/Command.js +1 -1
- package/dist/react/palette/Command.js.map +1 -1
- package/dist/react/palette/CommandPalette.d.ts +13 -1
- package/dist/react/palette/CommandPalette.d.ts.map +1 -1
- package/dist/react/palette/CommandPalette.js +44 -8
- package/dist/react/palette/CommandPalette.js.map +1 -1
- package/dist/react/palette/commandSources.d.ts +57 -0
- package/dist/react/palette/commandSources.d.ts.map +1 -0
- package/dist/react/palette/commandSources.js +129 -0
- package/dist/react/palette/commandSources.js.map +1 -0
- package/dist/react/palette/index.d.ts +1 -0
- package/dist/react/palette/index.d.ts.map +1 -1
- package/dist/react/palette/index.js +1 -0
- package/dist/react/palette/index.js.map +1 -1
- package/dist/react/rich-text/RichTextEditor.js +1 -1
- package/dist/react/rich-text/RichTextEditor.js.map +1 -1
- package/dist/react/rich-text/RichTextToolbar.js +1 -1
- package/dist/react/rich-text/RichTextToolbar.js.map +1 -1
- package/dist/scripts/guardrailsEnforce.d.ts.map +1 -1
- package/dist/styles-areas/analytics.css +16 -16
- package/dist/styles-areas/auth.css +2 -2
- package/dist/styles-areas/calendar.css +5 -6
- package/dist/styles-areas/canvas-hud.css +30 -0
- package/dist/styles-areas/chart-table.css +1 -1
- package/dist/styles-areas/charts.css +3 -3
- package/dist/styles-areas/chat.css +7 -6
- package/dist/styles-areas/companion-link.css +2 -2
- package/dist/styles-areas/core.css +99 -90
- package/dist/styles-areas/dashboard-grid.css +4 -4
- package/dist/styles-areas/data-table.css +16 -16
- package/dist/styles-areas/disk-usage.css +5 -5
- package/dist/styles-areas/emoji.css +2 -2
- package/dist/styles-areas/fields.css +13 -14
- package/dist/styles-areas/filter-rail.css +4 -4
- package/dist/styles-areas/folder-tree.css +6 -6
- package/dist/styles-areas/layout-engine.css +4 -4
- package/dist/styles-areas/markdown.css +2 -1
- package/dist/styles-areas/master-detail.css +3 -3
- package/dist/styles-areas/media-gallery.css +7 -6
- package/dist/styles-areas/media.css +12 -13
- package/dist/styles-areas/nav.css +28 -14
- package/dist/styles-areas/notifications.css +4 -4
- package/dist/styles-areas/overlays.css +4 -4
- package/dist/styles-areas/palette.css +5 -4
- package/dist/styles-areas/rich-text.css +3 -3
- package/dist/styles-areas/sharing.css +4 -3
- package/dist/styles-areas/stats.css +9 -8
- package/dist/styles-areas/test-report.css +4 -4
- package/dist/styles-areas/wizard.css +6 -5
- package/dist/styles-areas/workbench.css +10 -9
- package/dist/styles-areas/workbook-viewer.css +2 -2
- package/dist/styles-utilities.css +296 -190
- package/dist/testing/designAudit.d.ts.map +1 -1
- package/dist/testing/designAudit.js +4 -0
- package/dist/testing/designAudit.js.map +1 -1
- package/dist/testing/designBaseline.d.ts.map +1 -1
- package/dist/testing/designBaseline.js +4 -0
- package/dist/testing/designBaseline.js.map +1 -1
- package/dist/theme.css +103 -2
- package/package.json +10 -2
- package/scripts/generateAreaStyles.ts +3 -1
- package/scripts/guardrails-baseline.json +2 -1
- package/scripts/guardrailsEnforce.spec.ts +64 -0
- package/scripts/guardrailsEnforce.ts +65 -8
- package/scripts/styleAreas.ts +89 -6
- package/src/bundlerOnlyEntries.spec.ts +25 -8
- package/src/nodeTypesDeclared.spec.ts +47 -0
- package/src/react/Toast.spec.tsx +43 -0
- package/src/react/Toast.tsx +45 -2
- package/src/react/analytics/MetricDrilldown.tsx +1 -1
- package/src/react/canvas-hud/CanvasMinimap.tsx +88 -0
- package/src/react/canvas-hud/CanvasNodeMenu.tsx +91 -0
- package/src/react/canvas-hud/CanvasSearchField.tsx +91 -0
- package/src/react/canvas-hud/HudControls.spec.tsx +160 -0
- package/src/react/canvas-hud/HudControls.tsx +128 -0
- package/src/react/canvas-hud/index.ts +33 -0
- package/src/react/canvas-hud/useCanvasWheel.ts +99 -0
- package/src/react/canvas-hud/viewport.spec.ts +105 -0
- package/src/react/canvas-hud/viewport.ts +124 -0
- package/src/react/charts/AreaChart.tsx +9 -8
- package/src/react/charts/BarChart.tsx +11 -10
- package/src/react/charts/ChartCard.tsx +146 -0
- package/src/react/charts/ChartFrame.tsx +28 -10
- package/src/react/charts/ChartLegend.tsx +1 -1
- package/src/react/charts/HeatmapChart.tsx +5 -5
- package/src/react/charts/IntervalTimeline.tsx +2 -2
- package/src/react/charts/LineChart.tsx +9 -8
- package/src/react/charts/TimeSeriesChart.tsx +11 -10
- package/src/react/charts/chartBox.spec.ts +40 -0
- package/src/react/charts/chartBox.ts +75 -0
- package/src/react/charts/index.ts +2 -0
- package/src/react/charts/shared.ts +16 -3
- package/src/react/chat/Bubble.tsx +5 -5
- package/src/react/chat/MessageScroller.tsx +1 -1
- package/src/react/components/ActionBar.spec.tsx +90 -0
- package/src/react/components/ActionBar.tsx +82 -2
- package/src/react/components/AddItemsMenu.tsx +1 -1
- package/src/react/components/Alert.spec.tsx +32 -2
- package/src/react/components/Alert.tsx +47 -3
- package/src/react/components/AppShell.spec.tsx +199 -13
- package/src/react/components/AppShell.tsx +254 -92
- package/src/react/components/AsyncPanel.spec.tsx +17 -1
- package/src/react/components/AsyncPanel.tsx +88 -6
- package/src/react/components/BannerLane.tsx +128 -0
- package/src/react/components/Button.tsx +2 -0
- package/src/react/components/Checkbox.spec.tsx +18 -0
- package/src/react/components/Checkbox.tsx +8 -5
- package/src/react/components/ChipFilterStrip.tsx +1 -1
- package/src/react/components/ComboboxField.tsx +20 -3
- package/src/react/components/CommentThread.tsx +2 -2
- package/src/react/components/ConfirmDialog.tsx +1 -1
- package/src/react/components/DataTable/DataTable.tsx +80 -8
- package/src/react/components/DataTable/Pagination.tsx +1 -1
- package/src/react/components/DataTable/RowActions.tsx +55 -2
- package/src/react/components/DataTable/TableFilterBuilder.tsx +1 -1
- package/src/react/components/DataTable/cells/CodeCell.tsx +1 -1
- package/src/react/components/DataTable/cells/LinkCell.tsx +1 -1
- package/src/react/components/DataTable/index.ts +1 -0
- package/src/react/components/DataTable/numericColumn.spec.ts +19 -0
- package/src/react/components/DataTable/types.ts +36 -0
- package/src/react/components/DateTimeField.tsx +3 -1
- package/src/react/components/DeleteButton.tsx +3 -0
- package/src/react/components/Drawer.tsx +3 -3
- package/src/react/components/DropdownMenu.spec.tsx +55 -0
- package/src/react/components/DropdownMenu.tsx +73 -20
- package/src/react/components/EmptyState.tsx +26 -7
- package/src/react/components/EventTimeline.tsx +1 -1
- package/src/react/components/Field.spec.tsx +3 -2
- package/src/react/components/Field.tsx +7 -4
- package/src/react/components/Field.width.spec.tsx +14 -3
- package/src/react/components/FileDropZone.tsx +1 -1
- package/src/react/components/Grid.spec.tsx +44 -0
- package/src/react/components/Grid.tsx +41 -11
- package/src/react/components/Guide.tsx +77 -0
- package/src/react/components/InfoHint.spec.tsx +21 -0
- package/src/react/components/InfoHintImpl.tsx +22 -1
- package/src/react/components/InlineEditableText.tsx +1 -1
- package/src/react/components/IsolatedFrame.tsx +1 -1
- package/src/react/components/ListToolbar.spec.tsx +12 -0
- package/src/react/components/ListToolbar.tsx +8 -5
- package/src/react/components/LogViewer.tsx +118 -18
- package/src/react/components/Modal.spec.tsx +17 -2
- package/src/react/components/Modal.tsx +25 -10
- package/src/react/components/MultiSelectField.spec.tsx +6 -0
- package/src/react/components/Page.spec.tsx +89 -5
- package/src/react/components/Page.tsx +100 -16
- package/src/react/components/PageGuideButton.spec.tsx +39 -0
- package/src/react/components/PageGuideButton.tsx +110 -0
- package/src/react/components/PageGuidePopover.tsx +52 -0
- package/src/react/components/PanelSeparator.tsx +1 -1
- package/src/react/components/Popover.tsx +3 -1
- package/src/react/components/PromptDialog.tsx +1 -1
- package/src/react/components/ScrollArea.spec.tsx +20 -0
- package/src/react/components/ScrollArea.tsx +19 -0
- package/src/react/components/Section.spec.tsx +82 -1
- package/src/react/components/Section.tsx +10 -4
- package/src/react/components/Skeleton.tsx +50 -2
- package/src/react/components/StatStrip.tsx +1 -1
- package/src/react/components/StatTile.tsx +84 -11
- package/src/react/components/StatTileGrid.spec.tsx +6 -1
- package/src/react/components/StatTileGrid.tsx +25 -0
- package/src/react/components/StatusPill.tsx +26 -1
- package/src/react/components/Surface.tsx +22 -14
- package/src/react/components/SwatchPicker.tsx +4 -0
- package/src/react/components/Switch.tsx +1 -1
- package/src/react/components/TagsInput.spec.tsx +8 -0
- package/src/react/components/TagsInput.tsx +3 -1
- package/src/react/components/WidgetHeader.tsx +1 -1
- package/src/react/components/calendar/CalendarLegend.tsx +1 -1
- package/src/react/components/calendar/DayAgenda.tsx +1 -1
- package/src/react/components/calendar/EventChip.tsx +1 -1
- package/src/react/components/calendar/MonthGrid.tsx +1 -1
- package/src/react/components/calendar/WeekView.tsx +2 -2
- package/src/react/components/cardFrame.ts +28 -0
- package/src/react/components/dataDisplay.spec.tsx +176 -0
- package/src/react/components/dialog.tsx +4 -1
- package/src/react/components/entryChunks.graph.spec.ts +89 -0
- package/src/react/dashboard-grid/WidgetFrame.tsx +2 -2
- package/src/react/emoji/EmojiPicker.tsx +1 -1
- package/src/react/file-tree/FileTree.spec.tsx +49 -0
- package/src/react/file-tree/FileTree.tsx +37 -4
- package/src/react/filter-rail/FilterRail.tsx +1 -1
- package/src/react/folder-tree/FolderPicker.spec.tsx +8 -0
- package/src/react/folder-tree/FolderPicker.tsx +4 -1
- package/src/react/icons.spec.ts +21 -1
- package/src/react/icons.tsx +136 -2
- package/src/react/index.ts +38 -3
- package/src/react/lib/menuSections.ts +33 -0
- package/src/react/lib/whenIdle.ts +13 -0
- package/src/react/markdown/Markdown.tsx +2 -2
- package/src/react/media/DenseGalleryShell.tsx +20 -4
- package/src/react/media/HoverScrubVideoThumb.tsx +2 -2
- package/src/react/media/MaskPainter.tsx +1 -1
- package/src/react/media/MediaUploadControl.tsx +1 -1
- package/src/react/media/VideoTrimmer.tsx +1 -1
- package/src/react/media/denseGallery.css +96 -1
- package/src/react/media-gallery/MediaGallery.spec.tsx +26 -0
- package/src/react/media-gallery/MediaGallery.tsx +10 -3
- package/src/react/namespace/NamespaceTargetCapsule.tsx +1 -1
- package/src/react/nav/BreadcrumbTrail.tsx +2 -2
- package/src/react/nav/CommandBar.tsx +14 -3
- package/src/react/nav/PlaceBar.tsx +18 -8
- package/src/react/nav/SideNav.tsx +99 -17
- package/src/react/nav/TopBar.spec.tsx +78 -21
- package/src/react/nav/TopBar.tsx +270 -98
- package/src/react/nav/index.ts +8 -1
- package/src/react/nav/nav.spec.tsx +46 -2
- package/src/react/nav/navShared.tsx +23 -2
- package/src/react/notifications/NotificationFeed.tsx +2 -2
- package/src/react/palette/Command.tsx +1 -1
- package/src/react/palette/CommandPalette.spec.tsx +31 -0
- package/src/react/palette/CommandPalette.tsx +108 -11
- package/src/react/palette/commandSources.tsx +186 -0
- package/src/react/palette/index.ts +7 -0
- package/src/react/rich-text/RichTextEditor.tsx +1 -1
- package/src/react/rich-text/RichTextToolbar.tsx +1 -1
- package/src/styles-areas/analytics.css +16 -16
- package/src/styles-areas/auth.css +2 -2
- package/src/styles-areas/calendar.css +5 -6
- package/src/styles-areas/canvas-hud.css +30 -0
- package/src/styles-areas/chart-table.css +1 -1
- package/src/styles-areas/charts.css +3 -3
- package/src/styles-areas/chat.css +7 -6
- package/src/styles-areas/companion-link.css +2 -2
- package/src/styles-areas/core.css +99 -90
- package/src/styles-areas/dashboard-grid.css +4 -4
- package/src/styles-areas/data-table.css +16 -16
- package/src/styles-areas/disk-usage.css +5 -5
- package/src/styles-areas/emoji.css +2 -2
- package/src/styles-areas/fields.css +13 -14
- package/src/styles-areas/filter-rail.css +4 -4
- package/src/styles-areas/folder-tree.css +6 -6
- package/src/styles-areas/layout-engine.css +4 -4
- package/src/styles-areas/markdown.css +2 -1
- package/src/styles-areas/master-detail.css +3 -3
- package/src/styles-areas/media-gallery.css +7 -6
- package/src/styles-areas/media.css +12 -13
- package/src/styles-areas/nav.css +28 -14
- package/src/styles-areas/notifications.css +4 -4
- package/src/styles-areas/overlays.css +4 -4
- package/src/styles-areas/palette.css +5 -4
- package/src/styles-areas/rich-text.css +3 -3
- package/src/styles-areas/sharing.css +4 -3
- package/src/styles-areas/stats.css +9 -8
- package/src/styles-areas/test-report.css +4 -4
- package/src/styles-areas/wizard.css +6 -5
- package/src/styles-areas/workbench.css +10 -9
- package/src/styles-areas/workbook-viewer.css +2 -2
- package/src/styles-utilities.css +296 -190
- package/src/stylesAreas.spec.ts +17 -0
- package/src/testing/designAudit.ts +3 -0
- package/src/testing/designBaseline.ts +4 -0
- package/src/theme.css +103 -2
- package/src/themeDarkScopeAliases.spec.ts +65 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { describe, expect, test } from 'bun:test';
|
|
2
|
+
import { isNumericColumn, untypedNumericColumn } from './types.js';
|
|
3
|
+
|
|
4
|
+
describe('DAT-1 · what counts as a numeric column', () => {
|
|
5
|
+
test('money counts as numeric, text does not', () => {
|
|
6
|
+
expect(isNumericColumn({ key: 'a', label: 'A', type: 'money' })).toBe(true);
|
|
7
|
+
expect(isNumericColumn({ key: 'a', label: 'A', type: 'text' })).toBe(false);
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
test('a text column holding only numbers is named; a rendered or aligned one is left alone', () => {
|
|
11
|
+
const col = { key: 'code', label: 'Code', type: 'text' } as const;
|
|
12
|
+
expect(untypedNumericColumn(col, ['41', '7', '1,204'])).toContain("type 'number'");
|
|
13
|
+
expect(untypedNumericColumn(col, ['41', 'x'])).toBeNull();
|
|
14
|
+
expect(untypedNumericColumn(col, ['41'])).toBeNull();
|
|
15
|
+
expect(untypedNumericColumn({ ...col, align: 'left' }, ['41', '7'])).toBeNull();
|
|
16
|
+
expect(untypedNumericColumn({ ...col, render: () => null }, ['41', '7'])).toBeNull();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
});
|
|
@@ -143,6 +143,18 @@ export interface DataTableSelectAll {
|
|
|
143
143
|
disabled?: boolean;
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
+
/** `DataTable`'s `rowAction` — the row's one inline action (DAT-5). */
|
|
147
|
+
export interface DataTableRowAction {
|
|
148
|
+
/** A verb: "Play", "Retry". Also the button's accessible name. */
|
|
149
|
+
label: string;
|
|
150
|
+
/** Shown instead of the label when set — the label stays the tooltip and accessible name. */
|
|
151
|
+
icon?: ReactNode;
|
|
152
|
+
onClick: () => void;
|
|
153
|
+
disabled?: boolean;
|
|
154
|
+
/** Why it is disabled, on hover and tap (STA-6). */
|
|
155
|
+
disabledReason?: string;
|
|
156
|
+
}
|
|
157
|
+
|
|
146
158
|
/** The view modes a page can switch a dataset between (table rows vs. card grid). */
|
|
147
159
|
export type TableViewMode = 'table' | 'card';
|
|
148
160
|
|
|
@@ -169,10 +181,34 @@ const NUMERIC_CELL_TYPES = new Set([
|
|
|
169
181
|
'ms',
|
|
170
182
|
'percent',
|
|
171
183
|
'currency',
|
|
184
|
+
'money',
|
|
172
185
|
'count',
|
|
173
186
|
'integer',
|
|
174
187
|
]);
|
|
175
188
|
|
|
189
|
+
/** True when the column's TYPE says its values are numbers (or `meta.numeric` does) — what puts
|
|
190
|
+
* a column in `tabular-nums`, so digits and decimal points stack down it (DAT-1). */
|
|
191
|
+
export function isNumericColumn<TRow>(col: ColDef<TRow>): boolean {
|
|
192
|
+
return col.meta?.numeric === true || NUMERIC_CELL_TYPES.has(col.type);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* A plain-text column whose every value reads as a number — the untyped numeric column DAT-1
|
|
197
|
+
* warns about. `null` when it is fine: a typed column, a custom `render`, an explicit `align`,
|
|
198
|
+
* or too few values to say. Exported so the warning is testable without a DOM.
|
|
199
|
+
*/
|
|
200
|
+
export function untypedNumericColumn<TRow>(col: ColDef<TRow>, values: readonly unknown[]): string | null {
|
|
201
|
+
if (col.type !== 'text' || col.render || col.align || col.meta?.numeric !== undefined) return null;
|
|
202
|
+
const present = values.filter((v) => v != null && v !== '');
|
|
203
|
+
if (present.length < 2) return null;
|
|
204
|
+
const numeric = present.every(
|
|
205
|
+
(v) => typeof v === 'number' || (typeof v === 'string' && /^[-+]?[\d,]*\.?\d+(?:e[-+]?\d+)?$/i.test(v.trim())),
|
|
206
|
+
);
|
|
207
|
+
return numeric
|
|
208
|
+
? `cursedbelt DataTable: column "${col.key}" is type 'text' but every value is a number — give it type 'number' (or 'bytes', 'duration', 'money', …) so it right-aligns in tabular-nums (DAT-1).`
|
|
209
|
+
: null;
|
|
210
|
+
}
|
|
211
|
+
|
|
176
212
|
/** The alignment a column ACTUALLY gets: explicit `align` wins, else the type decides. */
|
|
177
213
|
export function resolveColumnAlign<TRow>(col: ColDef<TRow>): 'left' | 'right' {
|
|
178
214
|
if (col.align) return col.align;
|
|
@@ -81,7 +81,9 @@ export function DateTimeField({
|
|
|
81
81
|
aria-describedby={ariaDescribedBy}
|
|
82
82
|
className={cn(
|
|
83
83
|
fieldControlClass(size),
|
|
84
|
-
|
|
84
|
+
// 9rem holds "12:59 PM" and the native clock icon at the 16px field text (FRM-11); 7rem
|
|
85
|
+
// clipped it to "09:30 A" (forge task 2514).
|
|
86
|
+
'w-36 shrink-0',
|
|
85
87
|
(!date || disabled) && 'cursor-not-allowed opacity-50',
|
|
86
88
|
)}
|
|
87
89
|
/>
|
|
@@ -18,9 +18,9 @@ const DRAWER_WIDTH: Record<DrawerSize, string> = {
|
|
|
18
18
|
lg: 'max-w-2xl',
|
|
19
19
|
};
|
|
20
20
|
const DRAWER_HEIGHT: Record<DrawerSize, string> = {
|
|
21
|
-
sm: 'max-h-[
|
|
22
|
-
md: 'max-h-[
|
|
23
|
-
lg: 'max-h-[
|
|
21
|
+
sm: 'max-h-[var(--sheet-h-sm)]',
|
|
22
|
+
md: 'max-h-[var(--sheet-h-md)]',
|
|
23
|
+
lg: 'max-h-[var(--sheet-h-lg)]',
|
|
24
24
|
};
|
|
25
25
|
const SWIPE_DIRECTION: Record<DrawerSide, SwipeDismissDirection> = {
|
|
26
26
|
left: 'left',
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { afterEach, describe, expect, test } from 'bun:test';
|
|
2
2
|
import { act, cleanup, fireEvent, render, screen } from '@testing-library/react';
|
|
3
3
|
import type { ButtonHTMLAttributes } from 'react';
|
|
4
|
+
import { arrangeMenuItems } from '../lib/menuSections.js';
|
|
4
5
|
import { DropdownMenu } from './DropdownMenu.js';
|
|
5
6
|
|
|
6
7
|
afterEach(cleanup);
|
|
@@ -37,3 +38,57 @@ describe('DropdownMenu closes on a press anywhere else', () => {
|
|
|
37
38
|
expect(menu()).toBeNull();
|
|
38
39
|
});
|
|
39
40
|
});
|
|
41
|
+
|
|
42
|
+
describe('DropdownMenu — a list of verbs in groups, destructive last (OVL-7)', () => {
|
|
43
|
+
const keys = (sections: { key: string }[][]) => sections.map((s) => s.map((i) => i.key));
|
|
44
|
+
|
|
45
|
+
test('destructive items are pulled into one last section wherever they were written', () => {
|
|
46
|
+
expect(
|
|
47
|
+
keys(
|
|
48
|
+
arrangeMenuItems([
|
|
49
|
+
{ key: 'delete', label: 'Delete', destructive: true },
|
|
50
|
+
{ key: 'rename', label: 'Rename' },
|
|
51
|
+
{ key: 'sep', divider: true },
|
|
52
|
+
{ key: 'export', label: 'Export CSV' },
|
|
53
|
+
{ key: 'purge', label: 'Purge', destructive: true },
|
|
54
|
+
]),
|
|
55
|
+
),
|
|
56
|
+
).toEqual([['rename'], ['export'], ['delete', 'purge']]);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
test('items group by `group` in the order each group first appears', () => {
|
|
60
|
+
expect(
|
|
61
|
+
keys(
|
|
62
|
+
arrangeMenuItems([
|
|
63
|
+
{ key: 'csv', label: 'Export CSV', group: 'export' },
|
|
64
|
+
{ key: 'rename', label: 'Rename', group: 'edit' },
|
|
65
|
+
{ key: 'json', label: 'Export JSON', group: 'export' },
|
|
66
|
+
{ key: 'dup', label: 'Duplicate', group: 'edit' },
|
|
67
|
+
]),
|
|
68
|
+
),
|
|
69
|
+
).toEqual([['csv', 'json'], ['rename', 'dup']]);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
test('a shortcut is drawn on the row, and a disabled reason is a visible line, not only a title', async () => {
|
|
73
|
+
let ran = 0;
|
|
74
|
+
render(
|
|
75
|
+
<DropdownMenu
|
|
76
|
+
items={[
|
|
77
|
+
{ key: 'dup', label: 'Duplicate', shortcut: '$mod+d', onClick: () => ran++ },
|
|
78
|
+
{ key: 'move', label: 'Move', disabledReason: 'Read-only on this host', onClick: () => ran++ },
|
|
79
|
+
{ key: 'del', label: 'Delete', destructive: true },
|
|
80
|
+
]}
|
|
81
|
+
trigger={<B>actions</B>}
|
|
82
|
+
/>,
|
|
83
|
+
);
|
|
84
|
+
fireEvent.pointerDown(screen.getByText('actions'), { button: 0, ctrlKey: false });
|
|
85
|
+
const open = menu() as HTMLElement;
|
|
86
|
+
expect(open.querySelector('[data-cb-menu-shortcut]')?.textContent).toMatch(/D/);
|
|
87
|
+
expect(open.querySelector('[data-cb-menu-reason]')?.textContent).toBe('Read-only on this host');
|
|
88
|
+
const move = screen.getByText('Move').closest('[role="menuitem"]') as HTMLElement;
|
|
89
|
+
expect(move.getAttribute('aria-disabled')).toBe('true');
|
|
90
|
+
expect(open.querySelectorAll('[role="separator"]').length).toBe(1);
|
|
91
|
+
const items = Array.from(open.querySelectorAll('[role="menuitem"]')).map((el) => el.textContent);
|
|
92
|
+
expect(items.at(-1)).toBe('Delete');
|
|
93
|
+
});
|
|
94
|
+
});
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import * as RDrop from '@radix-ui/react-dropdown-menu';
|
|
2
|
+
import { formatHotkey } from 'cursedbelt-core/palette/hotkeys';
|
|
2
3
|
import { Check, ChevronRight } from 'lucide-react';
|
|
3
|
-
import { type ReactNode, useCallback, useRef, useState } from 'react';
|
|
4
|
+
import { Fragment, type ReactNode, useCallback, useMemo, useRef, useState } from 'react';
|
|
4
5
|
import { useOutsidePress } from '../hooks/useOutsidePress.js';
|
|
5
6
|
import { cn } from '../lib/cn.js';
|
|
6
7
|
import { useFloatingContainer } from '../lib/floatingContainer.js';
|
|
8
|
+
import { arrangeMenuItems } from '../lib/menuSections.js';
|
|
7
9
|
import {
|
|
8
10
|
FLOATING_ANIMATION,
|
|
9
11
|
FLOATING_COLLISION_PADDING,
|
|
@@ -26,6 +28,22 @@ export interface DropdownMenuAction {
|
|
|
26
28
|
* whenever `disabled` is conditional.
|
|
27
29
|
*/
|
|
28
30
|
title?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Why this item cannot run here. Disables it AND shows the reason as a line under the label,
|
|
33
|
+
* so a finger reads it too (CPY-4, STA-6) — a `title` only reaches a mouse.
|
|
34
|
+
*/
|
|
35
|
+
disabledReason?: string;
|
|
36
|
+
/**
|
|
37
|
+
* The item's keyboard shortcut, drawn on the right (`'$mod+d'`, `'shift+delete'`) in the
|
|
38
|
+
* platform's notation. The binding itself stays the page's: this is the hint (OVL-7).
|
|
39
|
+
*/
|
|
40
|
+
shortcut?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Items sharing a `group` render together, separated from the other groups by a line, in
|
|
43
|
+
* the order each group first appears. Destructive items are always pulled into their own
|
|
44
|
+
* group at the bottom (OVL-7), wherever they were written.
|
|
45
|
+
*/
|
|
46
|
+
group?: string;
|
|
29
47
|
destructive?: boolean;
|
|
30
48
|
icon?: ReactNode;
|
|
31
49
|
onClick?: () => void;
|
|
@@ -125,11 +143,9 @@ export function DropdownMenu({
|
|
|
125
143
|
collisionPadding={FLOATING_COLLISION_PADDING}
|
|
126
144
|
onClickCapture={pressInside.onClickCapture}
|
|
127
145
|
onPointerDownCapture={pressInside.onPointerDownCapture}
|
|
128
|
-
className={cn(FLOATING_CONTENT_BASE, FLOATING_ANIMATION, 'min-w-
|
|
146
|
+
className={cn(FLOATING_CONTENT_BASE, FLOATING_ANIMATION, 'min-w-32 p-1', className)}
|
|
129
147
|
>
|
|
130
|
-
{items
|
|
131
|
-
<DropdownItem key={item.key} item={item} />
|
|
132
|
-
))}
|
|
148
|
+
<MenuSections items={items} />
|
|
133
149
|
<RDrop.Arrow className='fill-border' />
|
|
134
150
|
</RDrop.Content>
|
|
135
151
|
</RDrop.Portal>
|
|
@@ -137,6 +153,48 @@ export function DropdownMenu({
|
|
|
137
153
|
);
|
|
138
154
|
}
|
|
139
155
|
|
|
156
|
+
function MenuSections({ items }: { items: readonly DropdownMenuItem[] }) {
|
|
157
|
+
const sections = useMemo(() => arrangeMenuItems(items), [items]);
|
|
158
|
+
return sections.map((section, index) => (
|
|
159
|
+
<Fragment key={section[0]?.key ?? index}>
|
|
160
|
+
{index > 0 && <RDrop.Separator className='my-1 h-px bg-border' />}
|
|
161
|
+
{section.map((item) => (
|
|
162
|
+
<DropdownItem key={item.key} item={item} />
|
|
163
|
+
))}
|
|
164
|
+
</Fragment>
|
|
165
|
+
));
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/** The label, with the disabled reason under it when there is one. */
|
|
169
|
+
function ItemLabel({ item }: { item: DropdownMenuAction }) {
|
|
170
|
+
if (!item.disabledReason) return <span>{item.label}</span>;
|
|
171
|
+
return (
|
|
172
|
+
<span className='flex min-w-0 flex-col'>
|
|
173
|
+
<span>{item.label}</span>
|
|
174
|
+
<span data-cb-menu-reason='' className='text-caption text-muted-foreground'>
|
|
175
|
+
{item.disabledReason}
|
|
176
|
+
</span>
|
|
177
|
+
</span>
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/** The trailing column: a description, or the shortcut in the platform's notation. */
|
|
182
|
+
function ItemTrailing({ item }: { item: DropdownMenuAction }) {
|
|
183
|
+
return (
|
|
184
|
+
<>
|
|
185
|
+
{item.description && <span className='ml-auto text-xs text-muted-foreground'>{item.description}</span>}
|
|
186
|
+
{item.shortcut && (
|
|
187
|
+
<kbd
|
|
188
|
+
data-cb-menu-shortcut=''
|
|
189
|
+
className={cn('font-sans text-caption tracking-wide text-muted-foreground', !item.description && 'ml-auto', 'pl-4')}
|
|
190
|
+
>
|
|
191
|
+
{formatHotkey(item.shortcut)}
|
|
192
|
+
</kbd>
|
|
193
|
+
)}
|
|
194
|
+
</>
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
|
|
140
198
|
function DropdownItem({ item }: { item: DropdownMenuItem }) {
|
|
141
199
|
const container = useFloatingContainer();
|
|
142
200
|
if (item.divider) {
|
|
@@ -159,13 +217,11 @@ function DropdownItem({ item }: { item: DropdownMenuItem }) {
|
|
|
159
217
|
</RDrop.SubTrigger>
|
|
160
218
|
<RDrop.Portal container={container}>
|
|
161
219
|
<RDrop.SubContent
|
|
162
|
-
className={cn(FLOATING_CONTENT_BASE, FLOATING_ANIMATION, 'min-w-
|
|
220
|
+
className={cn(FLOATING_CONTENT_BASE, FLOATING_ANIMATION, 'min-w-32 p-1')}
|
|
163
221
|
sideOffset={2}
|
|
164
222
|
collisionPadding={FLOATING_COLLISION_PADDING}
|
|
165
223
|
>
|
|
166
|
-
{item.children
|
|
167
|
-
<DropdownItem key={child.key} item={child} />
|
|
168
|
-
))}
|
|
224
|
+
<MenuSections items={item.children} />
|
|
169
225
|
</RDrop.SubContent>
|
|
170
226
|
</RDrop.Portal>
|
|
171
227
|
</RDrop.Sub>
|
|
@@ -177,7 +233,8 @@ function DropdownItem({ item }: { item: DropdownMenuItem }) {
|
|
|
177
233
|
<RDrop.CheckboxItem
|
|
178
234
|
checked={item.checked}
|
|
179
235
|
onCheckedChange={() => item.onClick?.()}
|
|
180
|
-
disabled={item.disabled}
|
|
236
|
+
disabled={item.disabled || !!item.disabledReason}
|
|
237
|
+
title={item.title ?? item.disabledReason}
|
|
181
238
|
className={cn(
|
|
182
239
|
FLOATING_ITEM_BASE,
|
|
183
240
|
'pl-8',
|
|
@@ -192,10 +249,8 @@ function DropdownItem({ item }: { item: DropdownMenuItem }) {
|
|
|
192
249
|
{item.icon}
|
|
193
250
|
</span>
|
|
194
251
|
)}
|
|
195
|
-
<
|
|
196
|
-
{item
|
|
197
|
-
<span className='ml-auto text-xs text-muted-foreground'>{item.description}</span>
|
|
198
|
-
)}
|
|
252
|
+
<ItemLabel item={item} />
|
|
253
|
+
<ItemTrailing item={item} />
|
|
199
254
|
</RDrop.CheckboxItem>
|
|
200
255
|
);
|
|
201
256
|
}
|
|
@@ -203,8 +258,8 @@ function DropdownItem({ item }: { item: DropdownMenuItem }) {
|
|
|
203
258
|
return (
|
|
204
259
|
<RDrop.Item
|
|
205
260
|
onSelect={() => item.onClick?.()}
|
|
206
|
-
disabled={item.disabled}
|
|
207
|
-
title={item.title}
|
|
261
|
+
disabled={item.disabled || !!item.disabledReason}
|
|
262
|
+
title={item.title ?? item.disabledReason}
|
|
208
263
|
className={cn(
|
|
209
264
|
FLOATING_ITEM_BASE,
|
|
210
265
|
item.destructive && 'text-destructive focus:bg-destructive/10 focus:text-destructive',
|
|
@@ -215,10 +270,8 @@ function DropdownItem({ item }: { item: DropdownMenuItem }) {
|
|
|
215
270
|
{item.icon}
|
|
216
271
|
</span>
|
|
217
272
|
)}
|
|
218
|
-
<
|
|
219
|
-
{item
|
|
220
|
-
<span className='ml-auto text-xs text-muted-foreground'>{item.description}</span>
|
|
221
|
-
)}
|
|
273
|
+
<ItemLabel item={item} />
|
|
274
|
+
<ItemTrailing item={item} />
|
|
222
275
|
</RDrop.Item>
|
|
223
276
|
);
|
|
224
277
|
}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
+
import { SearchX } from 'lucide-react';
|
|
1
2
|
import type { ReactNode } from 'react';
|
|
2
3
|
import { cn } from '../lib/cn.js';
|
|
4
|
+
import { Button } from './Button.js';
|
|
3
5
|
|
|
4
6
|
export interface EmptyStateProps {
|
|
5
7
|
/** Large illustrative icon (rendered at size-12 in a soft `muted` circle, or a
|
|
6
8
|
* bare size-6 in `compact`). */
|
|
7
9
|
icon?: ReactNode;
|
|
8
|
-
|
|
10
|
+
/** Says WHAT is empty, in sentence case (STA-3). Optional only for the filtered variant,
|
|
11
|
+
* which defaults it to "No matches". */
|
|
12
|
+
title?: ReactNode;
|
|
9
13
|
/** Supporting copy under the title. The design system standardizes on `description`
|
|
10
14
|
* (Section / Card / Field all use it); `message` is a back-compat alias. Prefer
|
|
11
15
|
* `description`. `description` wins when both are set. */
|
|
@@ -25,6 +29,12 @@ export interface EmptyStateProps {
|
|
|
25
29
|
* queue page) where the default content-sized block gets lost at the top of a
|
|
26
30
|
* tall viewport. The parent must be a sized flex column. Default `false`. */
|
|
27
31
|
fill?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* The FILTERED-to-nothing variant (STA-3): the data exists and the reader's filters hid all
|
|
34
|
+
* of it. Saying "No results" there reads as "there is nothing", so this says the filters did
|
|
35
|
+
* it and offers the one action that undoes it — a "Clear filters" button calling this.
|
|
36
|
+
*/
|
|
37
|
+
onClearFilters?: () => void;
|
|
28
38
|
}
|
|
29
39
|
|
|
30
40
|
/**
|
|
@@ -44,22 +54,26 @@ export function EmptyState({
|
|
|
44
54
|
className,
|
|
45
55
|
compact = false,
|
|
46
56
|
fill = false,
|
|
57
|
+
onClearFilters,
|
|
47
58
|
}: EmptyStateProps) {
|
|
48
|
-
const
|
|
59
|
+
const filtered = onClearFilters != null;
|
|
60
|
+
const body = description ?? message ?? (filtered ? 'Nothing matches the current filters.' : undefined);
|
|
61
|
+
const glyph = icon ?? (filtered ? <SearchX aria-hidden /> : undefined);
|
|
62
|
+
const heading = title ?? (filtered ? 'No matches' : 'Nothing here yet');
|
|
49
63
|
return (
|
|
50
64
|
<div
|
|
51
65
|
// A stable hook for an app's tests — the classes are the look and may change.
|
|
52
|
-
data-cb-empty-state=''
|
|
66
|
+
data-cb-empty-state={filtered ? 'filtered' : ''}
|
|
53
67
|
className={cn(
|
|
54
68
|
'flex flex-col items-center justify-center text-center',
|
|
55
69
|
compact ? 'gap-1.5 px-3 py-[var(--panel-pad)]' : 'gap-3 px-4 py-12',
|
|
56
70
|
// Optical center: claim the free height, then lift the block a touch above
|
|
57
71
|
// the true middle (bottom padding) so it doesn't read as sinking.
|
|
58
|
-
fill && 'min-h-0 flex-1 pb-[
|
|
72
|
+
fill && 'min-h-0 flex-1 pb-[var(--empty-lift)]',
|
|
59
73
|
className,
|
|
60
74
|
)}
|
|
61
75
|
>
|
|
62
|
-
{
|
|
76
|
+
{glyph && (
|
|
63
77
|
<span
|
|
64
78
|
className={cn(
|
|
65
79
|
'text-muted-foreground',
|
|
@@ -68,7 +82,7 @@ export function EmptyState({
|
|
|
68
82
|
: 'flex size-20 items-center justify-center rounded-full bg-muted [&_svg]:size-12',
|
|
69
83
|
)}
|
|
70
84
|
>
|
|
71
|
-
{
|
|
85
|
+
{glyph}
|
|
72
86
|
</span>
|
|
73
87
|
)}
|
|
74
88
|
<p
|
|
@@ -78,7 +92,7 @@ export function EmptyState({
|
|
|
78
92
|
compact ? 'text-sm font-medium' : 'mb-0.5 text-base font-semibold',
|
|
79
93
|
)}
|
|
80
94
|
>
|
|
81
|
-
{
|
|
95
|
+
{heading}
|
|
82
96
|
</p>
|
|
83
97
|
{body && (
|
|
84
98
|
<p className={cn('max-w-xs text-muted-foreground', compact ? 'text-xs' : 'text-sm')}>
|
|
@@ -86,6 +100,11 @@ export function EmptyState({
|
|
|
86
100
|
</p>
|
|
87
101
|
)}
|
|
88
102
|
{action}
|
|
103
|
+
{filtered && !action ? (
|
|
104
|
+
<Button variant='secondary' size='sm' tooltip='Show every row again' tooltipMobile='off' onClick={onClearFilters}>
|
|
105
|
+
Clear filters
|
|
106
|
+
</Button>
|
|
107
|
+
) : null}
|
|
89
108
|
</div>
|
|
90
109
|
);
|
|
91
110
|
}
|
|
@@ -59,7 +59,7 @@ export function EventTimeline({ items, className }: EventTimelineProps) {
|
|
|
59
59
|
{!isLast && (
|
|
60
60
|
<span
|
|
61
61
|
aria-hidden
|
|
62
|
-
className='absolute bottom-0 left-[
|
|
62
|
+
className='absolute bottom-0 left-[var(--timeline-rail-x)] top-7 w-px bg-border'
|
|
63
63
|
/>
|
|
64
64
|
)}
|
|
65
65
|
<span
|
|
@@ -136,8 +136,9 @@ describe('Field', () => {
|
|
|
136
136
|
</Field>
|
|
137
137
|
</Harness>,
|
|
138
138
|
);
|
|
139
|
-
// InfoHint's
|
|
140
|
-
|
|
139
|
+
// The trigger is named for its field (not InfoHint's generic "More info") and must NOT be
|
|
140
|
+
// nested in the label.
|
|
141
|
+
const info = getByLabelText('About email');
|
|
141
142
|
expect(info.tagName).toBe('BUTTON');
|
|
142
143
|
expect(container.querySelector('label')?.contains(info)).toBe(false);
|
|
143
144
|
});
|
|
@@ -205,6 +205,9 @@ export function Field({
|
|
|
205
205
|
) : null;
|
|
206
206
|
|
|
207
207
|
const labelTitle = typeof label === 'string' ? label : undefined;
|
|
208
|
+
// The ⓘ trigger is named for its field: three hints in a row are three "More info" buttons to
|
|
209
|
+
// a screen reader otherwise, and a browser test cannot find one by name (forge task 2532).
|
|
210
|
+
const hintLabel = labelTitle ? `About ${labelTitle.toLowerCase()}` : undefined;
|
|
208
211
|
|
|
209
212
|
return (
|
|
210
213
|
<div
|
|
@@ -236,23 +239,23 @@ export function Field({
|
|
|
236
239
|
)
|
|
237
240
|
) : null}
|
|
238
241
|
{foldsAlways ? (
|
|
239
|
-
<InfoHint title={labelTitle}>
|
|
242
|
+
<InfoHint title={labelTitle} label={hintLabel}>
|
|
240
243
|
{hint != null ? <p className='mb-1'>{hint}</p> : null}
|
|
241
244
|
{description}
|
|
242
245
|
</InfoHint>
|
|
243
246
|
) : null}
|
|
244
|
-
{hint != null && !folds && !foldsAlways ? <InfoHint title={labelTitle}>{hint}</InfoHint> : null}
|
|
247
|
+
{hint != null && !folds && !foldsAlways ? <InfoHint title={labelTitle} label={hintLabel}>{hint}</InfoHint> : null}
|
|
245
248
|
{folds ? (
|
|
246
249
|
// Two triggers, one shown per breakpoint: wide screens keep `hint` alone in the ⓘ
|
|
247
250
|
// (the description is on screen below), a phone gets the description folded in.
|
|
248
251
|
<>
|
|
249
252
|
{hint != null ? (
|
|
250
253
|
<span className='inline-flex max-sm:hidden'>
|
|
251
|
-
<InfoHint title={labelTitle}>{hint}</InfoHint>
|
|
254
|
+
<InfoHint title={labelTitle} label={hintLabel}>{hint}</InfoHint>
|
|
252
255
|
</span>
|
|
253
256
|
) : null}
|
|
254
257
|
<span className='inline-flex sm:hidden'>
|
|
255
|
-
<InfoHint title={labelTitle}>
|
|
258
|
+
<InfoHint title={labelTitle} label={hintLabel}>
|
|
256
259
|
{hint != null ? <p className='mb-1'>{hint}</p> : null}
|
|
257
260
|
{description}
|
|
258
261
|
</InfoHint>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { afterEach, describe, expect, test } from 'bun:test';
|
|
2
2
|
import { cleanup, render } from '@testing-library/react';
|
|
3
3
|
import { declareFieldWidth, inputTypeWidth, naturalFieldWidth } from '../lib/field.js';
|
|
4
|
+
import { ComboboxField } from './ComboboxField.js';
|
|
4
5
|
import { DESCRIPTION_FOLD_CHARS, Field } from './Field.js';
|
|
5
6
|
import { fieldSpecWidth } from './FieldInput.js';
|
|
6
7
|
import { Input } from './Input.js';
|
|
@@ -84,6 +85,16 @@ describe('Field width', () => {
|
|
|
84
85
|
expect(widthOf(prop.container)).toBe('full');
|
|
85
86
|
});
|
|
86
87
|
|
|
88
|
+
test('a closed combobox is sized like a select; an open-ended or multiple one is not', () => {
|
|
89
|
+
// Forge task 2514: ComboboxField declared a flat `md` whatever it held.
|
|
90
|
+
const opts = (labels: string[]) => labels.map((label) => ({ value: label, label }));
|
|
91
|
+
expect(naturalFieldWidth(ComboboxField, { options: opts(['Electric', 'Ocean']) })).toBe('xs');
|
|
92
|
+
expect(naturalFieldWidth(ComboboxField, { options: opts(['Off', 'A palette with a long name']) })).toBe('sm');
|
|
93
|
+
expect(naturalFieldWidth(ComboboxField, { options: opts(['Electric']), creatable: true })).toBe('md');
|
|
94
|
+
expect(naturalFieldWidth(ComboboxField, { loadOptions: async () => [] })).toBe('md');
|
|
95
|
+
expect(naturalFieldWidth(ComboboxField, { options: opts(['Electric']), multiple: true })).toBe('full');
|
|
96
|
+
});
|
|
97
|
+
|
|
87
98
|
test('an explicit width wins over the control', () => {
|
|
88
99
|
const { container } = render(
|
|
89
100
|
<Field name='n' label='N' width='full'>
|
|
@@ -130,7 +141,7 @@ describe('Field description', () => {
|
|
|
130
141
|
expect(p?.className).toContain('text-muted-foreground');
|
|
131
142
|
// Short: never folded, so no phone-only ⓘ.
|
|
132
143
|
expect(p?.className).not.toContain('max-sm:hidden');
|
|
133
|
-
expect(container.querySelectorAll('button[aria-label="
|
|
144
|
+
expect(container.querySelectorAll('button[aria-label="About d"]').length).toBe(0);
|
|
134
145
|
});
|
|
135
146
|
|
|
136
147
|
test('a long one folds into an ⓘ on a phone, and stays described', () => {
|
|
@@ -141,7 +152,7 @@ describe('Field description', () => {
|
|
|
141
152
|
);
|
|
142
153
|
const p = container.querySelector('#cb-f-d-desc');
|
|
143
154
|
expect(p?.className).toContain('max-sm:hidden');
|
|
144
|
-
expect(container.querySelectorAll('button[aria-label="
|
|
155
|
+
expect(container.querySelectorAll('button[aria-label="About d"]').length).toBe(1);
|
|
145
156
|
expect(container.querySelector('input')?.getAttribute('aria-describedby')).toBe('cb-f-d-desc');
|
|
146
157
|
});
|
|
147
158
|
|
|
@@ -160,7 +171,7 @@ describe('Field description', () => {
|
|
|
160
171
|
<Input />
|
|
161
172
|
</Field>,
|
|
162
173
|
);
|
|
163
|
-
const hosts = [...container.querySelectorAll('button[aria-label="
|
|
174
|
+
const hosts = [...container.querySelectorAll('button[aria-label="About d"]')].map(
|
|
164
175
|
(b) => b.parentElement?.className ?? '',
|
|
165
176
|
);
|
|
166
177
|
expect(hosts.length).toBe(2);
|
|
@@ -353,7 +353,7 @@ export function FileDropZone({
|
|
|
353
353
|
<label
|
|
354
354
|
htmlFor={inputId}
|
|
355
355
|
className={cn(
|
|
356
|
-
'flex min-h-
|
|
356
|
+
'flex min-h-11 w-full cursor-pointer flex-col items-center justify-center gap-1 p-4 text-center',
|
|
357
357
|
// `peer-focus`, not `peer-focus-visible`: the input is focused
|
|
358
358
|
// PROGRAMMATICALLY by roms' pad navigation, and the `:focus-visible`
|
|
359
359
|
// heuristic does not reliably fire for a gamepad — which is the exact
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { afterEach, describe, expect, test } from 'bun:test';
|
|
2
|
+
import { cleanup, render } from '@testing-library/react';
|
|
3
|
+
import { Grid } from './Grid.js';
|
|
4
|
+
|
|
5
|
+
afterEach(cleanup);
|
|
6
|
+
|
|
7
|
+
// Classes only: happy-dom computes no layout. The geometry (equal heights, the clipped
|
|
8
|
+
// first rule, the wrap) is measured in a browser by `e2e/page-layout.spec.ts`.
|
|
9
|
+
describe('Grid', () => {
|
|
10
|
+
test('the plain grid is one element with the auto-fit columns and its gap', () => {
|
|
11
|
+
const { container } = render(
|
|
12
|
+
<Grid gap={6} data-testid='g'>
|
|
13
|
+
<div>a</div>
|
|
14
|
+
</Grid>,
|
|
15
|
+
);
|
|
16
|
+
const grid = container.firstElementChild as HTMLElement;
|
|
17
|
+
expect(grid.className).toContain('grid-cols-[repeat(auto-fit,minmax(min(var(--cb-grid-min),100%),1fr))]');
|
|
18
|
+
expect(grid.className).toContain('gap-6');
|
|
19
|
+
expect(grid.style.getPropertyValue('--cb-grid-min')).toBe('16rem');
|
|
20
|
+
expect(grid.textContent).toBe('a');
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
test('divided: a clipping wrapper, columns one --col-gap apart with a 1px rule each (LAY-5)', () => {
|
|
24
|
+
const { container, getByTestId } = render(
|
|
25
|
+
<Grid divided gap={6} min='12rem' data-testid='g' className='mt-4'>
|
|
26
|
+
<div>a</div>
|
|
27
|
+
<div>b</div>
|
|
28
|
+
</Grid>,
|
|
29
|
+
);
|
|
30
|
+
const wrapper = getByTestId('g');
|
|
31
|
+
expect(wrapper).toBe(container.firstElementChild as HTMLElement);
|
|
32
|
+
expect(wrapper.hasAttribute('data-cb-grid-divided')).toBe(true);
|
|
33
|
+
expect(wrapper.className).toContain('overflow-x-clip');
|
|
34
|
+
expect(wrapper.className).toContain('mt-4');
|
|
35
|
+
const grid = wrapper.firstElementChild as HTMLElement;
|
|
36
|
+
expect(grid.style.getPropertyValue('--cb-grid-min')).toBe('12rem');
|
|
37
|
+
expect(grid.className).toContain('*:border-l');
|
|
38
|
+
expect(grid.className).toContain('-ml-[calc(var(--col-gap)/2+1px)]');
|
|
39
|
+
expect(grid.className).toContain('-mr-[calc(var(--col-gap)/2)]');
|
|
40
|
+
// `gap` is the plain grid's; a divided grid's gutter is the one token.
|
|
41
|
+
expect(grid.className).not.toContain('gap-6');
|
|
42
|
+
expect(grid.children).toHaveLength(2);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
@@ -9,8 +9,28 @@ export interface GridProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
9
9
|
*/
|
|
10
10
|
min?: string;
|
|
11
11
|
gap?: Gap;
|
|
12
|
+
/**
|
|
13
|
+
* A 1px vertical rule between columns, for cardless groups (LAY-5, FRM-15, task
|
|
14
|
+
* 2461): settings and control panels separated by a hairline and whitespace, not by
|
|
15
|
+
* a box each. The columns then sit one `--col-gap` (24px) apart with the rule in the
|
|
16
|
+
* middle of the gutter, rows sit the same distance apart, and `gap` is not used. A
|
|
17
|
+
* column that wraps to a new row starts at the left edge with no rule before it.
|
|
18
|
+
*/
|
|
19
|
+
divided?: boolean;
|
|
12
20
|
}
|
|
13
21
|
|
|
22
|
+
// The rule is each column's LEFT border, half a gutter out from its content. The inner
|
|
23
|
+
// grid is pulled out by half a gutter on both sides, so content still aligns with the
|
|
24
|
+
// edges, and the wrapper clips what hangs over — which is exactly the first column of
|
|
25
|
+
// every row's border, wherever the row wraps. The clip margin keeps a focus ring at the
|
|
26
|
+
// edge visible (it is far less than the half gutter the border sits out at).
|
|
27
|
+
const DIVIDED_WRAPPER = 'overflow-x-clip [overflow-clip-margin:calc(var(--spacing)*1)]';
|
|
28
|
+
// The extra 1px on the left is the clipped rule's own width: without it the first
|
|
29
|
+
// column's content would sit a pixel in from the edge every other block lines up on.
|
|
30
|
+
const DIVIDED_GRID =
|
|
31
|
+
'-ml-[calc(var(--col-gap)/2+1px)] -mr-[calc(var(--col-gap)/2)] gap-x-0 gap-y-[var(--col-gap)] ' +
|
|
32
|
+
'*:border-l *:border-rule *:px-[calc(var(--col-gap)/2)]';
|
|
33
|
+
|
|
14
34
|
/**
|
|
15
35
|
* Responsive grid that reflows to its OWN width, not the viewport — so the same
|
|
16
36
|
* markup is 3-up in a wide page, 2-up in a 640px modal, 1-up on a phone, with no
|
|
@@ -19,17 +39,27 @@ export interface GridProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
19
39
|
* than `min`. Sets `@container` on itself so its children can use `@`-container
|
|
20
40
|
* queries keyed to the grid's width (e.g. `<Grid className="@xl:grid-cols-2">`).
|
|
21
41
|
*/
|
|
22
|
-
export function Grid({ min = '16rem', gap = 4, className, style, ...p }: GridProps) {
|
|
42
|
+
export function Grid({ min = '16rem', gap = 4, divided = false, className, style, children, ...p }: GridProps) {
|
|
43
|
+
const gridStyle = { '--cb-grid-min': min } as CSSProperties;
|
|
44
|
+
const gridClass = cn(
|
|
45
|
+
'@container',
|
|
46
|
+
// Columns in a row stretch to one height (grid's default `stretch`) and a shorter
|
|
47
|
+
// column's spare space sits at its bottom — never padded to fill (LAY-3).
|
|
48
|
+
'grid grid-cols-[repeat(auto-fit,minmax(min(var(--cb-grid-min),100%),1fr))]',
|
|
49
|
+
divided ? DIVIDED_GRID : GAP[gap],
|
|
50
|
+
);
|
|
51
|
+
if (divided) {
|
|
52
|
+
return (
|
|
53
|
+
<div data-cb-grid-divided='' style={style} className={cn(DIVIDED_WRAPPER, className)} {...p}>
|
|
54
|
+
<div style={gridStyle} className={gridClass}>
|
|
55
|
+
{children}
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
23
60
|
return (
|
|
24
|
-
<div
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
'@container',
|
|
28
|
-
'grid grid-cols-[repeat(auto-fit,minmax(min(var(--cb-grid-min),100%),1fr))]',
|
|
29
|
-
GAP[gap],
|
|
30
|
-
className,
|
|
31
|
-
)}
|
|
32
|
-
{...p}
|
|
33
|
-
/>
|
|
61
|
+
<div style={{ ...style, ...gridStyle }} className={cn(gridClass, className)} {...p}>
|
|
62
|
+
{children}
|
|
63
|
+
</div>
|
|
34
64
|
);
|
|
35
65
|
}
|