@jcsoftdev/ui 0.2.3 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +288 -7
- package/README.md +2 -1
- package/bin/ui-theme.mjs +1151 -25
- package/dist/ai/attachment/attachment.js +1 -1
- package/dist/ai/chat-list/group.js +3 -1
- package/dist/ai/conversation/conversation.js +1 -1
- package/dist/ai/internal/use-copy.d.ts +1 -5
- package/dist/ai/internal/use-copy.js +1 -32
- package/dist/ai/markdown/parse.js +59 -17
- package/dist/ai/source/source.js +1 -1
- package/dist/atoms/avatar/avatar.d.ts +13 -3
- package/dist/atoms/avatar/avatar.js +40 -2
- package/dist/atoms/avatar/index.d.ts +1 -1
- package/dist/atoms/avatar/index.js +3 -1
- package/dist/atoms/button/button.d.ts +4 -1
- package/dist/atoms/button/button.js +4 -2
- package/dist/atoms/checkbox/checkbox.d.ts +8 -3
- package/dist/atoms/checkbox/checkbox.js +23 -2
- package/dist/atoms/chip/chip.d.ts +9 -3
- package/dist/atoms/chip/chip.js +26 -4
- package/dist/atoms/chip/index.d.ts +1 -1
- package/dist/atoms/chip/index.js +4 -1
- package/dist/atoms/status-dot/index.d.ts +1 -1
- package/dist/atoms/status-dot/status-dot.d.ts +4 -2
- package/dist/atoms/status-dot/status-dot.js +5 -1
- package/dist/charts/bar-chart/bar-race-chart.js +1 -0
- package/dist/charts/beeswarm-chart/beeswarm-chart.js +1 -1
- package/dist/charts/chord-chart/chord-chart.js +13 -5
- package/dist/charts/core/cartesian/cartesian-chart.d.ts +1 -1
- package/dist/charts/core/cartesian/cartesian-chart.js +48 -11
- package/dist/charts/core/cartesian/layout.d.ts +6 -1
- package/dist/charts/core/cartesian/layout.js +14 -5
- package/dist/charts/core/cartesian/marks.d.ts +2 -2
- package/dist/charts/core/cartesian/marks.js +1 -1
- package/dist/charts/core/cartesian/types.d.ts +28 -2
- package/dist/charts/core/category-explorer.d.ts +2 -2
- package/dist/charts/core/category-explorer.js +8 -4
- package/dist/charts/core/chart-dock.d.ts +26 -0
- package/dist/charts/core/chart-dock.js +45 -0
- package/dist/charts/core/chart-frame.d.ts +9 -2
- package/dist/charts/core/chart-frame.js +105 -25
- package/dist/charts/core/distribution/explorer.d.ts +5 -2
- package/dist/charts/core/distribution/explorer.js +12 -5
- package/dist/charts/core/distribution/xy-points.js +1 -1
- package/dist/charts/core/index.d.ts +3 -0
- package/dist/charts/core/index.js +3 -0
- package/dist/charts/core/leave-grace.d.ts +11 -0
- package/dist/charts/core/leave-grace.js +26 -0
- package/dist/charts/core/nearest.d.ts +14 -0
- package/dist/charts/core/nearest.js +22 -0
- package/dist/charts/core/plot-overlay.js +9 -3
- package/dist/charts/core/pointer.test-utils.d.ts +38 -0
- package/dist/charts/core/pointer.test-utils.js +123 -0
- package/dist/charts/core/tooltip.d.ts +25 -2
- package/dist/charts/core/tooltip.js +115 -40
- package/dist/charts/core/touch-select.d.ts +20 -0
- package/dist/charts/core/touch-select.js +184 -0
- package/dist/charts/core/types.d.ts +8 -4
- package/dist/charts/core/types.js +5 -0
- package/dist/charts/core/use-index-navigation.d.ts +17 -6
- package/dist/charts/core/use-index-navigation.js +47 -10
- package/dist/charts/donut-chart/donut-chart.d.ts +5 -1
- package/dist/charts/donut-chart/donut-chart.js +40 -1
- package/dist/charts/donut-chart/slice-labels.d.ts +20 -0
- package/dist/charts/donut-chart/slice-labels.js +20 -0
- package/dist/charts/dumbbell-chart/dumbbell-chart.js +6 -3
- package/dist/charts/fill-gauge-chart/fill-gauge-chart.js +1 -0
- package/dist/charts/funnel-chart/funnel-chart.js +2 -1
- package/dist/charts/gauge-chart/gauge-chart.js +2 -1
- package/dist/charts/heatmap-chart/heatmap-chart.d.ts +4 -1
- package/dist/charts/heatmap-chart/heatmap-chart.js +3 -1
- package/dist/charts/heatmap-chart/heatmap-grid.d.ts +4 -1
- package/dist/charts/heatmap-chart/heatmap-grid.js +3 -1
- package/dist/charts/hex-tile-map/hex-tile-map.js +124 -115
- package/dist/charts/hierarchy-morph/hierarchy-morph.js +2 -1
- package/dist/charts/icicle-chart/icicle-chart.js +7 -9
- package/dist/charts/lollipop-chart/lollipop-chart.js +6 -3
- package/dist/charts/maps/geo/map-viewport.js +1 -1
- package/dist/charts/polar-area-chart/polar-area-chart.js +42 -12
- package/dist/charts/progress-units/progress-units.js +1 -0
- package/dist/charts/radar-chart/radar-chart.js +1 -1
- package/dist/charts/radial-bar-chart/radial-bar-chart.js +2 -1
- package/dist/charts/range-area-chart/range-area-chart.js +3 -2
- package/dist/charts/sankey-chart/sankey-chart.js +12 -4
- package/dist/charts/tree-chart/tree-chart.js +1 -0
- package/dist/charts/treemap-chart/treemap-chart.js +2 -7
- package/dist/charts/waterfall-chart/waterfall-chart.js +6 -3
- package/dist/containers/action-bar/action-bar.d.ts +11 -2
- package/dist/containers/action-bar/action-bar.js +4 -1
- package/dist/containers/card/card.d.ts +21 -3
- package/dist/containers/card/card.js +20 -5
- package/dist/containers/grid/grid.d.ts +15 -0
- package/dist/containers/grid/grid.js +24 -0
- package/dist/containers/grid/index.d.ts +1 -0
- package/dist/containers/grid/index.js +4 -0
- package/dist/containers/index.d.ts +3 -0
- package/dist/containers/index.js +3 -0
- package/dist/containers/kpi/kpi.d.ts +13 -2
- package/dist/containers/kpi/kpi.js +86 -24
- package/dist/containers/kpi-group/index.d.ts +1 -1
- package/dist/containers/kpi-group/index.js +3 -1
- package/dist/containers/kpi-group/kpi-group.d.ts +9 -1
- package/dist/containers/kpi-group/kpi-group.js +11 -1
- package/dist/containers/page/index.d.ts +1 -0
- package/dist/containers/page/index.js +4 -0
- package/dist/containers/page/page.d.ts +7 -0
- package/dist/containers/page/page.js +14 -0
- package/dist/containers/page-header/page-header.d.ts +8 -3
- package/dist/containers/page-header/page-header.js +35 -8
- package/dist/containers/responsive-list/responsive-list.d.ts +1 -1
- package/dist/containers/responsive-list/responsive-list.js +6 -3
- package/dist/containers/stack/index.d.ts +1 -0
- package/dist/containers/stack/index.js +6 -0
- package/dist/containers/stack/stack.d.ts +15 -0
- package/dist/containers/stack/stack.js +43 -0
- package/dist/forms/copy-field/copy-field.d.ts +17 -0
- package/dist/forms/copy-field/copy-field.js +72 -0
- package/dist/forms/copy-field/index.d.ts +1 -0
- package/dist/forms/copy-field/index.js +4 -0
- package/dist/forms/emoji-picker/emoji-picker.js +1 -1
- package/dist/forms/form/form.d.ts +15 -0
- package/dist/forms/form/form.js +29 -0
- package/dist/forms/form/index.d.ts +1 -0
- package/dist/forms/form/index.js +10 -0
- package/dist/forms/index.d.ts +2 -0
- package/dist/forms/index.js +2 -0
- package/dist/forms/input/index.d.ts +1 -1
- package/dist/forms/input/index.js +3 -2
- package/dist/forms/input/input.d.ts +6 -2
- package/dist/forms/input/input.js +9 -3
- package/dist/glass/crystal-map.d.ts +70 -0
- package/dist/glass/crystal-map.js +88 -0
- package/dist/glass/displacement-map.d.ts +117 -0
- package/dist/glass/displacement-map.js +201 -0
- package/dist/glass/index.d.ts +8 -0
- package/dist/glass/index.js +63 -0
- package/dist/glass/lens-crystal.d.ts +29 -0
- package/dist/glass/lens-crystal.js +161 -0
- package/dist/glass/lens-dispersion.d.ts +11 -0
- package/dist/glass/lens-dispersion.js +19 -0
- package/dist/glass/liquid-glass.d.ts +41 -0
- package/dist/glass/liquid-glass.js +256 -0
- package/dist/glass/liquid-motion.d.ts +53 -0
- package/dist/glass/liquid-motion.js +302 -0
- package/dist/glass/liquid-options.d.ts +162 -0
- package/dist/glass/liquid-options.js +179 -0
- package/dist/glass/refraction.d.ts +100 -0
- package/dist/glass/refraction.js +714 -0
- package/dist/glass/specular-map.d.ts +26 -0
- package/dist/glass/specular-map.js +75 -0
- package/dist/glass/spring.d.ts +79 -0
- package/dist/glass/spring.js +58 -0
- package/dist/glass/support.d.ts +13 -0
- package/dist/glass/support.js +14 -0
- package/dist/glass/use-glass-refraction.d.ts +8 -0
- package/dist/glass/use-glass-refraction.js +16 -0
- package/dist/i18n/strings.d.ts +24 -0
- package/dist/i18n/strings.js +18 -2
- package/dist/icons/index.d.ts +2 -0
- package/dist/icons/index.js +4 -0
- package/dist/icons/key.d.ts +2 -0
- package/dist/icons/key.js +12 -0
- package/dist/icons/webhook.d.ts +2 -0
- package/dist/icons/webhook.js +12 -0
- package/dist/liquid/index.d.ts +3 -0
- package/dist/liquid/index.js +29 -0
- package/dist/navigation/breadcrumbs/breadcrumbs.d.ts +29 -0
- package/dist/navigation/breadcrumbs/breadcrumbs.js +70 -0
- package/dist/navigation/breadcrumbs/index.d.ts +1 -0
- package/dist/navigation/breadcrumbs/index.js +6 -0
- package/dist/navigation/index.d.ts +1 -0
- package/dist/navigation/index.js +1 -0
- package/dist/navigation/segmented/index.d.ts +1 -1
- package/dist/navigation/segmented/model.d.ts +5 -0
- package/dist/navigation/segmented/model.js +6 -0
- package/dist/navigation/segmented/segmented.d.ts +17 -3
- package/dist/navigation/segmented/segmented.js +20 -4
- package/dist/overlays/context-menu/context-menu.d.ts +9 -1
- package/dist/overlays/context-menu/context-menu.js +4 -1
- package/dist/overlays/dialog/dialog.d.ts +9 -1
- package/dist/overlays/dialog/dialog.js +3 -0
- package/dist/overlays/drawer/drawer.d.ts +9 -1
- package/dist/overlays/drawer/drawer.js +3 -0
- package/dist/overlays/dropdown-menu/dropdown-menu.d.ts +9 -1
- package/dist/overlays/dropdown-menu/dropdown-menu.js +3 -1
- package/dist/overlays/hover-card/hover-card.d.ts +10 -1
- package/dist/overlays/hover-card/hover-card.js +4 -1
- package/dist/overlays/popover/popover.d.ts +9 -1
- package/dist/overlays/popover/popover.js +3 -0
- package/dist/palette/command-palette/command-palette.d.ts +12 -2
- package/dist/palette/command-palette/command-palette.js +5 -0
- package/dist/primitives/command/command.d.ts +3 -2
- package/dist/primitives/command/command.js +2 -0
- package/dist/primitives/menu/menu.js +1 -1
- package/dist/primitives/popper/popper.js +5 -0
- package/dist/rich-text/rich-text-editor.js +94 -8
- package/dist/rich-text/sanitize.js +70 -20
- package/dist/shell/app-shell/app-shell.d.ts +17 -0
- package/dist/shell/app-shell/app-shell.js +44 -4
- package/dist/shell/bottom-nav/bottom-nav.d.ts +34 -0
- package/dist/shell/bottom-nav/bottom-nav.js +124 -0
- package/dist/shell/bottom-nav/index.d.ts +2 -0
- package/dist/shell/bottom-nav/index.js +9 -0
- package/dist/shell/bottom-nav/split.d.ts +11 -0
- package/dist/shell/bottom-nav/split.js +10 -0
- package/dist/shell/sidebar/sidebar.d.ts +16 -2
- package/dist/shell/sidebar/sidebar.js +46 -4
- package/dist/shell/topbar/topbar.d.ts +20 -9
- package/dist/shell/topbar/topbar.js +16 -9
- package/dist/states/empty-state/empty-state.d.ts +3 -1
- package/dist/states/empty-state/empty-state.js +9 -1
- package/dist/states/error-state/error-state.d.ts +3 -1
- package/dist/states/error-state/error-state.js +2 -0
- package/dist/states/index.d.ts +1 -0
- package/dist/states/index.js +1 -0
- package/dist/states/live-status-bar/index.d.ts +1 -0
- package/dist/states/live-status-bar/index.js +6 -0
- package/dist/states/live-status-bar/live-status-bar.d.ts +17 -0
- package/dist/states/live-status-bar/live-status-bar.js +49 -0
- package/dist/states/offline-banner/offline-banner.d.ts +3 -1
- package/dist/states/offline-banner/offline-banner.js +8 -4
- package/dist/utils/class-groups.js +17 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/material.d.ts +13 -0
- package/dist/utils/material.js +6 -0
- package/dist/utils/tone.d.ts +8 -0
- package/dist/utils/tone.js +17 -0
- package/dist/utils/use-copy.d.ts +5 -0
- package/dist/utils/use-copy.js +35 -0
- package/icons/svg/key.svg +5 -0
- package/icons/svg/webhook.svg +5 -0
- package/package.json +31 -21
- package/scripts/build-theme.d.mts +22 -0
- package/scripts/build-theme.mjs +236 -4
- package/src/ai/attachment/attachment.tsx +1 -1
- package/src/ai/chat-list/group.ts +3 -1
- package/src/ai/conversation/conversation.tsx +1 -1
- package/src/ai/internal/use-copy.ts +1 -38
- package/src/ai/markdown/parse.ts +74 -17
- package/src/ai/source/source.tsx +1 -1
- package/src/atoms/avatar/avatar.tsx +57 -4
- package/src/atoms/avatar/index.ts +8 -1
- package/src/atoms/button/button.tsx +8 -3
- package/src/atoms/checkbox/checkbox.tsx +30 -3
- package/src/atoms/chip/chip.tsx +37 -5
- package/src/atoms/chip/index.ts +7 -1
- package/src/atoms/status-dot/index.ts +1 -0
- package/src/atoms/status-dot/status-dot.tsx +15 -3
- package/src/charts/README.md +21 -0
- package/src/charts/bar-chart/bar-race-chart.tsx +1 -0
- package/src/charts/beeswarm-chart/beeswarm-chart.tsx +1 -1
- package/src/charts/chord-chart/chord-chart.tsx +13 -5
- package/src/charts/core/cartesian/cartesian-chart.tsx +55 -10
- package/src/charts/core/cartesian/layout.ts +29 -10
- package/src/charts/core/cartesian/marks.tsx +3 -3
- package/src/charts/core/cartesian/types.ts +30 -2
- package/src/charts/core/category-explorer.tsx +12 -6
- package/src/charts/core/chart-dock.tsx +68 -0
- package/src/charts/core/chart-frame.tsx +116 -27
- package/src/charts/core/distribution/explorer.tsx +17 -7
- package/src/charts/core/distribution/xy-points.tsx +1 -1
- package/src/charts/core/index.ts +3 -0
- package/src/charts/core/leave-grace.ts +35 -0
- package/src/charts/core/nearest.ts +38 -0
- package/src/charts/core/plot-overlay.tsx +9 -3
- package/src/charts/core/pointer.test-utils.ts +146 -0
- package/src/charts/core/tooltip.tsx +129 -15
- package/src/charts/core/touch-select.ts +250 -0
- package/src/charts/core/types.ts +13 -4
- package/src/charts/core/use-index-navigation.ts +70 -11
- package/src/charts/donut-chart/donut-chart.tsx +53 -3
- package/src/charts/donut-chart/slice-labels.ts +39 -0
- package/src/charts/dumbbell-chart/dumbbell-chart.tsx +8 -3
- package/src/charts/fill-gauge-chart/fill-gauge-chart.tsx +1 -0
- package/src/charts/funnel-chart/funnel-chart.tsx +2 -1
- package/src/charts/gauge-chart/gauge-chart.tsx +2 -1
- package/src/charts/heatmap-chart/heatmap-chart.tsx +5 -0
- package/src/charts/heatmap-chart/heatmap-grid.tsx +5 -1
- package/src/charts/hex-tile-map/hex-tile-map.tsx +6 -1
- package/src/charts/hierarchy-morph/hierarchy-morph.tsx +2 -1
- package/src/charts/icicle-chart/icicle-chart.tsx +8 -9
- package/src/charts/lollipop-chart/lollipop-chart.tsx +8 -3
- package/src/charts/maps/geo/map-viewport.tsx +1 -1
- package/src/charts/polar-area-chart/polar-area-chart.tsx +37 -12
- package/src/charts/progress-units/progress-units.tsx +1 -0
- package/src/charts/radar-chart/radar-chart.tsx +1 -1
- package/src/charts/radial-bar-chart/radial-bar-chart.tsx +2 -1
- package/src/charts/range-area-chart/range-area-chart.tsx +3 -2
- package/src/charts/sankey-chart/sankey-chart.tsx +12 -4
- package/src/charts/tree-chart/tree-chart.tsx +1 -0
- package/src/charts/treemap-chart/treemap-chart.tsx +2 -7
- package/src/charts/waterfall-chart/waterfall-chart.tsx +8 -3
- package/src/containers/action-bar/action-bar.tsx +13 -2
- package/src/containers/card/card.tsx +43 -4
- package/src/containers/grid/grid.tsx +37 -0
- package/src/containers/grid/index.ts +1 -0
- package/src/containers/index.ts +3 -0
- package/src/containers/kpi/kpi.tsx +116 -22
- package/src/containers/kpi-group/index.ts +7 -1
- package/src/containers/kpi-group/kpi-group.tsx +26 -1
- package/src/containers/page/index.ts +1 -0
- package/src/containers/page/page.tsx +17 -0
- package/src/containers/page-header/page-header.tsx +38 -8
- package/src/containers/responsive-list/responsive-list.tsx +7 -4
- package/src/containers/stack/index.ts +7 -0
- package/src/containers/stack/stack.tsx +55 -0
- package/src/forms/copy-field/copy-field.tsx +88 -0
- package/src/forms/copy-field/index.ts +1 -0
- package/src/forms/emoji-picker/emoji-picker.tsx +1 -1
- package/src/forms/form/form.tsx +46 -0
- package/src/forms/form/index.ts +8 -0
- package/src/forms/index.ts +2 -0
- package/src/forms/input/index.ts +1 -1
- package/src/forms/input/input.tsx +14 -3
- package/src/glass/crystal-map.ts +150 -0
- package/src/glass/displacement-map.ts +317 -0
- package/src/glass/index.ts +43 -0
- package/src/glass/lens-crystal.ts +226 -0
- package/src/glass/lens-dispersion.ts +34 -0
- package/src/glass/liquid-glass.tsx +371 -0
- package/src/glass/liquid-motion.ts +395 -0
- package/src/glass/liquid-options.ts +306 -0
- package/src/glass/refraction.ts +1010 -0
- package/src/glass/specular-map.ts +95 -0
- package/src/glass/spring.ts +98 -0
- package/src/glass/support.ts +27 -0
- package/src/glass/use-glass-refraction.ts +21 -0
- package/src/i18n/strings.ts +24 -0
- package/src/icons/index.ts +2 -0
- package/src/icons/key.tsx +13 -0
- package/src/icons/webhook.tsx +13 -0
- package/src/liquid/index.ts +24 -0
- package/src/navigation/breadcrumbs/breadcrumbs.tsx +103 -0
- package/src/navigation/breadcrumbs/index.ts +8 -0
- package/src/navigation/index.ts +1 -0
- package/src/navigation/segmented/index.ts +1 -0
- package/src/navigation/segmented/model.ts +11 -0
- package/src/navigation/segmented/segmented.tsx +45 -6
- package/src/overlays/context-menu/context-menu.tsx +11 -1
- package/src/overlays/dialog/dialog.tsx +10 -0
- package/src/overlays/drawer/drawer.tsx +10 -0
- package/src/overlays/dropdown-menu/dropdown-menu.tsx +10 -1
- package/src/overlays/hover-card/hover-card.tsx +12 -1
- package/src/overlays/popover/popover.tsx +10 -0
- package/src/palette/command-palette/command-palette.tsx +15 -1
- package/src/primitives/command/command.tsx +4 -0
- package/src/primitives/menu/menu.tsx +1 -1
- package/src/primitives/popper/popper.tsx +10 -0
- package/src/rich-text/rich-text-editor.tsx +116 -13
- package/src/rich-text/sanitize.ts +94 -23
- package/src/shell/app-shell/app-shell.tsx +60 -4
- package/src/shell/bottom-nav/bottom-nav.tsx +187 -0
- package/src/shell/bottom-nav/index.ts +8 -0
- package/src/shell/bottom-nav/split.ts +20 -0
- package/src/shell/sidebar/sidebar.tsx +51 -5
- package/src/shell/topbar/topbar.tsx +81 -58
- package/src/states/empty-state/empty-state.tsx +11 -1
- package/src/states/error-state/error-state.tsx +4 -0
- package/src/states/index.ts +1 -0
- package/src/states/live-status-bar/index.ts +6 -0
- package/src/states/live-status-bar/live-status-bar.tsx +62 -0
- package/src/states/offline-banner/offline-banner.tsx +13 -5
- package/src/utils/class-groups.ts +17 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/material.ts +16 -0
- package/src/utils/tone.ts +29 -0
- package/src/utils/use-copy.ts +38 -0
- package/styles/Theme.kt +64 -3
- package/styles/base.css +51 -0
- package/styles/tailwind.css +833 -0
- package/styles/theme.css +546 -4
- package/styles/tokens.css +788 -15
- package/tokens/default.json +918 -29
- package/scripts/build-theme.d.ts +0 -18
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from "../core/color-scale.js";
|
|
13
13
|
import type { ValueFormatter } from "../core/format.js";
|
|
14
14
|
import { EASE_OUT, fadeKeyframes, useEntryAnimation } from "../core/motion.js";
|
|
15
|
-
import { ChartTooltip } from "../core/tooltip.js";
|
|
15
|
+
import { ChartTooltip, type TooltipRow } from "../core/tooltip.js";
|
|
16
16
|
import { type ChartLabels, DEFAULT_LABELS } from "../core/types.js";
|
|
17
17
|
import { useCanvasPaint } from "../core/use-canvas.js";
|
|
18
18
|
import type { HeatmapScale } from "./heatmap-scale.js";
|
|
@@ -66,6 +66,8 @@ export interface HeatmapGridProps {
|
|
|
66
66
|
tooltip: boolean;
|
|
67
67
|
animate: boolean;
|
|
68
68
|
onCellClick?: (cell: HeatmapCellInfo) => void;
|
|
69
|
+
/** Extra tooltip rows under the cell value, e.g. a second measure of the same cell. */
|
|
70
|
+
cellDetail?: (row: number, column: number, value: number | null) => readonly TooltipRow[];
|
|
69
71
|
/** Name of the value in the tooltip; the row label by default. */
|
|
70
72
|
valueName?: string;
|
|
71
73
|
/** "hex" lays the cells out as a honeycomb (odd rows shifted half a cell). */
|
|
@@ -113,6 +115,7 @@ export function HeatmapGrid({
|
|
|
113
115
|
tooltip,
|
|
114
116
|
animate,
|
|
115
117
|
onCellClick,
|
|
118
|
+
cellDetail,
|
|
116
119
|
valueName,
|
|
117
120
|
shape = "rect",
|
|
118
121
|
renderer = "svg",
|
|
@@ -519,6 +522,7 @@ export function HeatmapGrid({
|
|
|
519
522
|
value: shownValue == null ? labels.noData : format(shownValue),
|
|
520
523
|
color: shownColor,
|
|
521
524
|
},
|
|
525
|
+
...(cellDetail?.(shown.row, shown.column, shownValue ?? null) ?? []),
|
|
522
526
|
]}
|
|
523
527
|
/>
|
|
524
528
|
) : null}
|
|
@@ -250,7 +250,12 @@ function HexPlot({
|
|
|
250
250
|
const anchor = current && active != null ? (grid.centers[active] ?? null) : null;
|
|
251
251
|
|
|
252
252
|
return (
|
|
253
|
-
<div
|
|
253
|
+
<div
|
|
254
|
+
ref={nav.ref}
|
|
255
|
+
className="relative"
|
|
256
|
+
style={{ width, height }}
|
|
257
|
+
onPointerLeave={nav.pointerLeave}
|
|
258
|
+
>
|
|
254
259
|
<svg
|
|
255
260
|
ref={svgRef}
|
|
256
261
|
role="img"
|
|
@@ -355,9 +355,10 @@ function MorphPlot({
|
|
|
355
355
|
<path
|
|
356
356
|
key={shape.node.id}
|
|
357
357
|
d={path}
|
|
358
|
+
data-chart-hit=""
|
|
358
359
|
onPointerEnter={(event) => nav.hover(index, event)}
|
|
359
360
|
onPointerMove={(event) => nav.hover(index, event)}
|
|
360
|
-
onPointerLeave={nav.
|
|
361
|
+
onPointerLeave={nav.pointerLeave}
|
|
361
362
|
style={{
|
|
362
363
|
fill: tint(base, strength),
|
|
363
364
|
opacity: faded * (dimmed ? 0.45 : 1),
|
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
resolveHierarchyLabels,
|
|
30
30
|
} from "../core/hierarchy-chart.js";
|
|
31
31
|
import { EASE_OUT, useEntryAnimation } from "../core/motion.js";
|
|
32
|
+
import { boxAt } from "../core/nearest.js";
|
|
32
33
|
import { ChartTooltip } from "../core/tooltip.js";
|
|
33
34
|
import { type DrillState, useAnimatedView, useDrill } from "../core/use-drill.js";
|
|
34
35
|
|
|
@@ -236,15 +237,13 @@ function IciclePlot({
|
|
|
236
237
|
);
|
|
237
238
|
|
|
238
239
|
const children = focus.children;
|
|
239
|
-
const hit = (x: number, y: number): Cell | null =>
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
}
|
|
246
|
-
return null;
|
|
247
|
-
};
|
|
240
|
+
const hit = (x: number, y: number): Cell | null =>
|
|
241
|
+
boxAt(cells, x, y, (cell) => ({
|
|
242
|
+
x0: cell.x,
|
|
243
|
+
y0: cell.y,
|
|
244
|
+
x1: cell.x + cell.width,
|
|
245
|
+
y1: cell.y + cell.height,
|
|
246
|
+
}));
|
|
248
247
|
|
|
249
248
|
const local = (event: PointerEvent<HTMLDivElement>) => {
|
|
250
249
|
const box = event.currentTarget.getBoundingClientRect();
|
|
@@ -11,7 +11,12 @@ import { PlotOverlay } from "../core/plot-overlay.js";
|
|
|
11
11
|
import { bandScale } from "../core/scales/band.js";
|
|
12
12
|
import { linearScale } from "../core/scales/linear.js";
|
|
13
13
|
import { ChartTooltip } from "../core/tooltip.js";
|
|
14
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
type ChartLabels,
|
|
16
|
+
resolveAxisBound,
|
|
17
|
+
resolveLabels,
|
|
18
|
+
type ValueAxisOptions,
|
|
19
|
+
} from "../core/types.js";
|
|
15
20
|
|
|
16
21
|
export interface LollipopItem {
|
|
17
22
|
id?: string;
|
|
@@ -192,8 +197,8 @@ function LollipopPlot({
|
|
|
192
197
|
const model = useMemo(() => {
|
|
193
198
|
const values = rows.map((row) => row.value);
|
|
194
199
|
const domain: [number, number] = [
|
|
195
|
-
yAxis?.min
|
|
196
|
-
yAxis?.max
|
|
200
|
+
resolveAxisBound(yAxis?.min, Math.min(0, ...values)),
|
|
201
|
+
resolveAxisBound(yAxis?.max, Math.max(0, ...values)),
|
|
197
202
|
];
|
|
198
203
|
const format = resolveAxisFormat(yAxis?.format ?? valueFormat);
|
|
199
204
|
const top = PAD.top + (vertical && dataLabels ? 8 : 0);
|
|
@@ -205,7 +205,7 @@ function RegionLabels({
|
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
const BUTTON =
|
|
208
|
-
"inline-flex size-8 cursor-pointer items-center justify-center border-0
|
|
208
|
+
"inline-flex size-8 cursor-pointer items-center justify-center border-0 surface-overlay text-ink-2 outline-none transition-colors hover:bg-surface-2 hover:text-ink focus-visible:outline-2 focus-visible:outline-accent-ink focus-visible:-outline-offset-2 disabled:cursor-default disabled:opacity-40 disabled:hover:bg-float";
|
|
209
209
|
|
|
210
210
|
function Glyph({ d }: { d: string }) {
|
|
211
211
|
return (
|
|
@@ -297,6 +297,17 @@ function RosePlot({
|
|
|
297
297
|
endAngle: startAngle + slot * (position + 1) - pad / 2,
|
|
298
298
|
cornerRadius,
|
|
299
299
|
}),
|
|
300
|
+
// The hovered sector steps out by EXPLODE. Pointer events go to this resting wedge, which
|
|
301
|
+
// has no gap to its neighbours and also covers the stepped-out area, never to the moving
|
|
302
|
+
// sector: a sector that moved away from a still pointer fired pointerleave and looped.
|
|
303
|
+
hit: arcPath({
|
|
304
|
+
cx,
|
|
305
|
+
cy,
|
|
306
|
+
innerRadius: inner,
|
|
307
|
+
outerRadius: Math.max(outer, inner + 1) + EXPLODE,
|
|
308
|
+
startAngle: startAngle + slot * position,
|
|
309
|
+
endAngle: startAngle + slot * (position + 1),
|
|
310
|
+
}),
|
|
300
311
|
};
|
|
301
312
|
}),
|
|
302
313
|
[visible, items, startAngle, slot, cx, cy, inner, lengthAt, pad, cornerRadius],
|
|
@@ -380,7 +391,7 @@ function RosePlot({
|
|
|
380
391
|
))}
|
|
381
392
|
</g>
|
|
382
393
|
|
|
383
|
-
{sectors.map((sector
|
|
394
|
+
{sectors.map((sector) => {
|
|
384
395
|
const item = items[sector.index];
|
|
385
396
|
if (!item) return null;
|
|
386
397
|
const focused = focusIndex === sector.index;
|
|
@@ -395,8 +406,23 @@ function RosePlot({
|
|
|
395
406
|
dy={shift.y}
|
|
396
407
|
originX={cx}
|
|
397
408
|
originY={cy}
|
|
398
|
-
|
|
399
|
-
|
|
409
|
+
/>
|
|
410
|
+
);
|
|
411
|
+
})}
|
|
412
|
+
|
|
413
|
+
{sectors.map((sector, position) => {
|
|
414
|
+
const item = items[sector.index];
|
|
415
|
+
if (!item) return null;
|
|
416
|
+
return (
|
|
417
|
+
<path
|
|
418
|
+
key={item.datum.id}
|
|
419
|
+
data-sector-hit=""
|
|
420
|
+
data-chart-hit=""
|
|
421
|
+
d={sector.hit}
|
|
422
|
+
fill="transparent"
|
|
423
|
+
onPointerEnter={(event) => nav.hover(position, event)}
|
|
424
|
+
onPointerMove={(event) => nav.hover(position, event)}
|
|
425
|
+
onPointerLeave={nav.pointerLeave}
|
|
400
426
|
/>
|
|
401
427
|
);
|
|
402
428
|
})}
|
|
@@ -456,7 +482,13 @@ function RosePlot({
|
|
|
456
482
|
/>
|
|
457
483
|
|
|
458
484
|
{tooltip && anchor && rows.length ? (
|
|
459
|
-
<ChartTooltip
|
|
485
|
+
<ChartTooltip
|
|
486
|
+
x={anchor.x}
|
|
487
|
+
y={anchor.y}
|
|
488
|
+
containerWidth={width}
|
|
489
|
+
containerHeight={height}
|
|
490
|
+
rows={rows}
|
|
491
|
+
/>
|
|
460
492
|
) : null}
|
|
461
493
|
</div>
|
|
462
494
|
);
|
|
@@ -470,8 +502,6 @@ interface SectorMarkProps {
|
|
|
470
502
|
dy: number;
|
|
471
503
|
originX: number;
|
|
472
504
|
originY: number;
|
|
473
|
-
onEnter: (event: { clientX: number; clientY: number }) => void;
|
|
474
|
-
onLeave: () => void;
|
|
475
505
|
}
|
|
476
506
|
|
|
477
507
|
const SectorMark = memo(function SectorMark({
|
|
@@ -482,17 +512,12 @@ const SectorMark = memo(function SectorMark({
|
|
|
482
512
|
dy,
|
|
483
513
|
originX,
|
|
484
514
|
originY,
|
|
485
|
-
onEnter,
|
|
486
|
-
onLeave,
|
|
487
515
|
}: SectorMarkProps) {
|
|
488
516
|
return (
|
|
489
517
|
<path
|
|
490
518
|
data-sector=""
|
|
491
519
|
d={d}
|
|
492
|
-
|
|
493
|
-
onPointerMove={onEnter}
|
|
494
|
-
onPointerLeave={onLeave}
|
|
495
|
-
className="motion-safe:transition-[transform,opacity] motion-safe:duration-200 motion-safe:ease-out"
|
|
520
|
+
className="pointer-events-none motion-safe:transition-[transform,opacity] motion-safe:duration-200 motion-safe:ease-out"
|
|
496
521
|
style={{
|
|
497
522
|
fill: color,
|
|
498
523
|
fillOpacity: 0.9,
|
|
@@ -401,7 +401,7 @@ function RadialPlot({
|
|
|
401
401
|
stroke={gradient ? `url(#${uid}-g${ring.index})` : item.color}
|
|
402
402
|
dimmed={focusIndex != null && focusIndex !== ring.index}
|
|
403
403
|
onEnter={(event) => nav.hover(position, event)}
|
|
404
|
-
onLeave={nav.
|
|
404
|
+
onLeave={nav.pointerLeave}
|
|
405
405
|
/>
|
|
406
406
|
);
|
|
407
407
|
})}
|
|
@@ -538,6 +538,7 @@ const RingMark = memo(function RingMark({
|
|
|
538
538
|
) : null}
|
|
539
539
|
<path
|
|
540
540
|
d={hitPath}
|
|
541
|
+
data-chart-hit=""
|
|
541
542
|
fill="none"
|
|
542
543
|
strokeWidth={band + 4}
|
|
543
544
|
strokeLinecap="butt"
|
|
@@ -15,6 +15,7 @@ import { linearScale } from "../core/scales/linear.js";
|
|
|
15
15
|
import { ChartTooltip, type TooltipRow } from "../core/tooltip.js";
|
|
16
16
|
import {
|
|
17
17
|
type ChartLabels,
|
|
18
|
+
resolveAxisBound,
|
|
18
19
|
resolveLabels,
|
|
19
20
|
type ValueAxisOptions,
|
|
20
21
|
type XValue,
|
|
@@ -174,8 +175,8 @@ function Plot({
|
|
|
174
175
|
const lo = Math.min(...all);
|
|
175
176
|
const hi = Math.max(...all);
|
|
176
177
|
const zero = yAxis?.zero ?? (all.length > 0 && lo <= hi * 0.35);
|
|
177
|
-
const domainLo = yAxis?.min
|
|
178
|
-
const domainHi = yAxis?.max
|
|
178
|
+
const domainLo = resolveAxisBound(yAxis?.min, zero ? Math.min(0, lo) : lo);
|
|
179
|
+
const domainHi = resolveAxisBound(yAxis?.max, hi);
|
|
179
180
|
const innerHeight = height - MARGIN.top - MARGIN.bottom;
|
|
180
181
|
const probe = linearScale({
|
|
181
182
|
domain: all.length ? [domainLo, domainHi] : [0, 1],
|
|
@@ -18,6 +18,7 @@ import { ChartDataTable } from "../core/data-table.js";
|
|
|
18
18
|
import { DEFAULT_EXPORT_TEXTS, ExportMenu, type ExportTexts } from "../core/export-menu.js";
|
|
19
19
|
import { resolveFormat, type ValueFormat, type ValueFormatter } from "../core/format.js";
|
|
20
20
|
import { fitLabel } from "../core/hierarchy-chart.js";
|
|
21
|
+
import { useLeaveGrace } from "../core/leave-grace.js";
|
|
21
22
|
import { ChartLegend } from "../core/legend.js";
|
|
22
23
|
import { EASE_OUT, revealClip, useEntryAnimation, useReducedMotion } from "../core/motion.js";
|
|
23
24
|
import { seriesColor } from "../core/palette.js";
|
|
@@ -421,6 +422,11 @@ function SankeyPlot({
|
|
|
421
422
|
const labelRoom = inside ? nodeWidth - 12 : step - nodeWidth - LABEL_GAP * 2;
|
|
422
423
|
|
|
423
424
|
const [hover, setHover] = useState<{ focus: Focus; x: number; y: number } | null>(null);
|
|
425
|
+
const { leave: leaveSoon, hold } = useLeaveGrace(() => setHover(null));
|
|
426
|
+
const showHover = (next: { focus: Focus; x: number; y: number }) => {
|
|
427
|
+
hold();
|
|
428
|
+
setHover(next);
|
|
429
|
+
};
|
|
424
430
|
const [active, setActive] = useState<Focus | null>(null);
|
|
425
431
|
const [pinned, setPinned] = useState<Focus | null>(null);
|
|
426
432
|
const reducedMotion = useReducedMotion();
|
|
@@ -647,9 +653,9 @@ function SankeyPlot({
|
|
|
647
653
|
lit={lit?.links ?? null}
|
|
648
654
|
diffById={diffById}
|
|
649
655
|
onEnter={(link, event) =>
|
|
650
|
-
|
|
656
|
+
showHover({ focus: { kind: "link", id: link.id }, ...pointer(event) })
|
|
651
657
|
}
|
|
652
|
-
onLeave={
|
|
658
|
+
onLeave={leaveSoon}
|
|
653
659
|
onClick={(link) => {
|
|
654
660
|
if (pathTracing) pin({ kind: "link", id: link.id });
|
|
655
661
|
onLinkClick?.(link);
|
|
@@ -666,9 +672,9 @@ function SankeyPlot({
|
|
|
666
672
|
active={activeNode && !activeLink ? activeNode.id : null}
|
|
667
673
|
inside={inside}
|
|
668
674
|
onEnter={(node, event) =>
|
|
669
|
-
|
|
675
|
+
showHover({ focus: { kind: "node", id: node.id }, ...pointer(event) })
|
|
670
676
|
}
|
|
671
|
-
onLeave={
|
|
677
|
+
onLeave={leaveSoon}
|
|
672
678
|
onClick={(node) => {
|
|
673
679
|
if (pathTracing) pin({ kind: "node", id: node.id });
|
|
674
680
|
onNodeClick?.(node);
|
|
@@ -943,6 +949,7 @@ const SankeyLinks = memo(function SankeyLinks({
|
|
|
943
949
|
<path
|
|
944
950
|
key={link.id}
|
|
945
951
|
d={sankeyLinkPath(link)}
|
|
952
|
+
data-chart-hit=""
|
|
946
953
|
strokeWidth={Math.max(1, link.width)}
|
|
947
954
|
className="cursor-pointer motion-safe:transition-[stroke-opacity] motion-safe:duration-150"
|
|
948
955
|
style={{
|
|
@@ -996,6 +1003,7 @@ function SankeyNodes({
|
|
|
996
1003
|
<rect
|
|
997
1004
|
key={node.id}
|
|
998
1005
|
data-sankey-node=""
|
|
1006
|
+
data-chart-hit=""
|
|
999
1007
|
x={node.x0}
|
|
1000
1008
|
y={node.y0}
|
|
1001
1009
|
width={node.x1 - node.x0}
|
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
resolveHierarchyLabels,
|
|
24
24
|
} from "../core/hierarchy-chart.js";
|
|
25
25
|
import { EASE_OUT, useEntryAnimation } from "../core/motion.js";
|
|
26
|
+
import { boxAt } from "../core/nearest.js";
|
|
26
27
|
import { ChartTooltip } from "../core/tooltip.js";
|
|
27
28
|
import { type DrillState, useDrill } from "../core/use-drill.js";
|
|
28
29
|
|
|
@@ -207,13 +208,7 @@ function TreemapPlot({
|
|
|
207
208
|
{ disabled: !animate, replayKey: focus.id },
|
|
208
209
|
);
|
|
209
210
|
|
|
210
|
-
const hit = (x: number, y: number): TreemapCell | null =>
|
|
211
|
-
for (let i = cells.length - 1; i >= 0; i--) {
|
|
212
|
-
const cell = cells[i] as TreemapCell;
|
|
213
|
-
if (x >= cell.x0 && x <= cell.x1 && y >= cell.y0 && y <= cell.y1) return cell;
|
|
214
|
-
}
|
|
215
|
-
return null;
|
|
216
|
-
};
|
|
211
|
+
const hit = (x: number, y: number): TreemapCell | null => boxAt(cells, x, y, (cell) => cell);
|
|
217
212
|
|
|
218
213
|
const local = (event: PointerEvent<HTMLDivElement>) => {
|
|
219
214
|
const box = event.currentTarget.getBoundingClientRect();
|
|
@@ -13,7 +13,12 @@ import { PlotOverlay } from "../core/plot-overlay.js";
|
|
|
13
13
|
import { bandScale } from "../core/scales/band.js";
|
|
14
14
|
import { linearScale } from "../core/scales/linear.js";
|
|
15
15
|
import { ChartTooltip } from "../core/tooltip.js";
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
type ChartLabels,
|
|
18
|
+
resolveAxisBound,
|
|
19
|
+
resolveLabels,
|
|
20
|
+
type ValueAxisOptions,
|
|
21
|
+
} from "../core/types.js";
|
|
17
22
|
import {
|
|
18
23
|
pickLabels,
|
|
19
24
|
type WaterfallBar,
|
|
@@ -242,7 +247,7 @@ function WaterfallPlot({
|
|
|
242
247
|
|
|
243
248
|
const model = useMemo(() => {
|
|
244
249
|
const y = linearScale({
|
|
245
|
-
domain: [yAxis?.min
|
|
250
|
+
domain: [resolveAxisBound(yAxis?.min, min), resolveAxisBound(yAxis?.max, max)],
|
|
246
251
|
range: [innerHeight, 0],
|
|
247
252
|
tickCount: yAxis?.tickCount ?? Math.max(3, Math.round(innerHeight / 56)),
|
|
248
253
|
});
|
|
@@ -457,7 +462,7 @@ function HorizontalWaterfallPlot({
|
|
|
457
462
|
);
|
|
458
463
|
const innerWidth = Math.max(40, width - left - (dataLabels ? H_MARGIN.right : 12));
|
|
459
464
|
const x = linearScale({
|
|
460
|
-
domain: [yAxis?.min
|
|
465
|
+
domain: [resolveAxisBound(yAxis?.min, min), resolveAxisBound(yAxis?.max, max)],
|
|
461
466
|
range: [0, innerWidth],
|
|
462
467
|
tickCount: yAxis?.tickCount ?? Math.max(2, Math.round(innerWidth / 130)),
|
|
463
468
|
});
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import type { ComponentPropsWithoutRef, KeyboardEvent, ReactNode } from "react";
|
|
3
|
+
import type { ComponentPropsWithoutRef, KeyboardEvent, ReactNode, Ref } from "react";
|
|
4
4
|
import { X } from "../../icons/index.js";
|
|
5
5
|
import type { ClassNames } from "../../utils/class-names.js";
|
|
6
6
|
import { cn } from "../../utils/cn.js";
|
|
7
|
+
import { type Material, materialClass } from "../../utils/material.js";
|
|
7
8
|
|
|
8
9
|
export type ActionBarPart = "root" | "count" | "actions" | "clear";
|
|
9
10
|
|
|
10
11
|
export interface ActionBarProps extends Omit<ComponentPropsWithoutRef<"div">, "children"> {
|
|
12
|
+
ref?: Ref<HTMLDivElement>;
|
|
11
13
|
/** Number of selected items. The bar renders nothing while it is 0. */
|
|
12
14
|
selectedCount: number;
|
|
13
15
|
/** Singular and plural noun for the live count, e.g. ["cita", "citas"]. */
|
|
@@ -21,6 +23,13 @@ export interface ActionBarProps extends Omit<ComponentPropsWithoutRef<"div">, "c
|
|
|
21
23
|
* ancestor (a card, a table wrapper); `static` renders inline.
|
|
22
24
|
*/
|
|
23
25
|
position?: "fixed" | "absolute" | "static";
|
|
26
|
+
/**
|
|
27
|
+
* Surface material. Omitted keeps the default for this layer; `"glass"` and `"glass-clear"`
|
|
28
|
+
* are frosted glass, `"liquid"` and `"liquid-clear"` Liquid Glass (with its fallbacks), `"solid"`
|
|
29
|
+
* forces an opaque surface. Liquid options go in `style` (`liquidStyle()` from
|
|
30
|
+
* `@jcsoftdev/ui/liquid`); the lens needs `<LiquidGlass />` mounted once.
|
|
31
|
+
*/
|
|
32
|
+
material?: Material;
|
|
24
33
|
/** Per-part classes merged with `cn`; consumer classes win. `className` still targets the root and is merged last. */
|
|
25
34
|
classNames?: ClassNames<ActionBarPart>;
|
|
26
35
|
}
|
|
@@ -38,6 +47,7 @@ export function ActionBar({
|
|
|
38
47
|
onClear,
|
|
39
48
|
children,
|
|
40
49
|
position = "absolute",
|
|
50
|
+
material,
|
|
41
51
|
className,
|
|
42
52
|
classNames,
|
|
43
53
|
onKeyDown,
|
|
@@ -59,8 +69,9 @@ export function ActionBar({
|
|
|
59
69
|
aria-label="Acciones para la selección"
|
|
60
70
|
onKeyDown={handleKeyDown}
|
|
61
71
|
className={cn(
|
|
62
|
-
"@container/action-bar z-40 flex w-fit max-w-[calc(100%-1rem)] flex-wrap items-center gap-density rounded-popover border-card surface-overlay
|
|
72
|
+
"@container/action-bar z-40 flex w-fit max-w-[calc(100%-1rem)] flex-wrap items-center gap-density rounded-popover border-card surface-overlay px-control-x py-density-sm shadow-overlay",
|
|
63
73
|
positionClasses[position],
|
|
74
|
+
materialClass(material, "surface-solid"),
|
|
64
75
|
classNames?.root,
|
|
65
76
|
className,
|
|
66
77
|
)}
|
|
@@ -1,13 +1,26 @@
|
|
|
1
|
-
import type { ComponentPropsWithoutRef } from "react";
|
|
1
|
+
import type { ComponentPropsWithoutRef, ReactNode, Ref } from "react";
|
|
2
2
|
import { cn } from "../../utils/cn.js";
|
|
3
|
+
import { type Material, materialClass } from "../../utils/material.js";
|
|
3
4
|
|
|
4
5
|
export type CardProps = ComponentPropsWithoutRef<"div">;
|
|
5
6
|
|
|
6
|
-
export
|
|
7
|
+
export interface CardRootProps extends CardProps {
|
|
8
|
+
ref?: Ref<HTMLDivElement>;
|
|
9
|
+
/**
|
|
10
|
+
* Cards are content, so they are opaque by default. `"glass"` and `"glass-clear"` opt one into
|
|
11
|
+
* frosted glass, `"liquid"` and `"liquid-clear"` into Liquid Glass (use sparingly, over imagery,
|
|
12
|
+
* never inside another glass surface). Liquid options go in `style` (`liquidStyle()` from
|
|
13
|
+
* `@jcsoftdev/ui/liquid`); the lens needs `<LiquidGlass />` mounted once.
|
|
14
|
+
*/
|
|
15
|
+
material?: Material;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function Card({ className, material, ...props }: CardRootProps) {
|
|
7
19
|
return (
|
|
8
20
|
<div
|
|
9
21
|
className={cn(
|
|
10
22
|
"min-w-0 rounded-card border-card shadow-card surface-card @container/card",
|
|
23
|
+
materialClass(material, "surface-card"),
|
|
11
24
|
className,
|
|
12
25
|
)}
|
|
13
26
|
{...props}
|
|
@@ -15,7 +28,22 @@ export function Card({ className, ...props }: CardProps) {
|
|
|
15
28
|
);
|
|
16
29
|
}
|
|
17
30
|
|
|
18
|
-
export
|
|
31
|
+
export interface CardHeaderProps extends Omit<CardProps, "title"> {
|
|
32
|
+
/** Decorative icon before the title; hidden from screen readers. */
|
|
33
|
+
icon?: ReactNode;
|
|
34
|
+
title?: ReactNode;
|
|
35
|
+
/** End slot, e.g. a link or an icon button. */
|
|
36
|
+
action?: ReactNode;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function CardHeader({
|
|
40
|
+
className,
|
|
41
|
+
icon,
|
|
42
|
+
title,
|
|
43
|
+
action,
|
|
44
|
+
children,
|
|
45
|
+
...props
|
|
46
|
+
}: CardHeaderProps) {
|
|
19
47
|
return (
|
|
20
48
|
<div
|
|
21
49
|
className={cn(
|
|
@@ -23,7 +51,18 @@ export function CardHeader({ className, ...props }: CardProps) {
|
|
|
23
51
|
className,
|
|
24
52
|
)}
|
|
25
53
|
{...props}
|
|
26
|
-
|
|
54
|
+
>
|
|
55
|
+
{icon ? (
|
|
56
|
+
<span aria-hidden="true" className="inline-flex shrink-0 text-ink-3 [&_svg]:size-4.5">
|
|
57
|
+
{icon}
|
|
58
|
+
</span>
|
|
59
|
+
) : null}
|
|
60
|
+
{title ? (
|
|
61
|
+
<div className="min-w-0 break-words font-semibold text-ink text-body">{title}</div>
|
|
62
|
+
) : null}
|
|
63
|
+
{children}
|
|
64
|
+
{action ? <div className="ml-auto flex shrink-0 items-center gap-2">{action}</div> : null}
|
|
65
|
+
</div>
|
|
27
66
|
);
|
|
28
67
|
}
|
|
29
68
|
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef, CSSProperties } from "react";
|
|
2
|
+
import { cn } from "../../utils/cn.js";
|
|
3
|
+
import { type StackGap, stackGapClasses } from "../stack/stack.js";
|
|
4
|
+
|
|
5
|
+
export interface GridProps extends ComponentPropsWithoutRef<"div"> {
|
|
6
|
+
/** Fixed number of equal columns. Without it the grid fits as many columns as `minColumnWidth` allows. */
|
|
7
|
+
columns?: number;
|
|
8
|
+
/** Narrowest a column may get before the grid drops one (any CSS length). Defaults to `16rem`. */
|
|
9
|
+
minColumnWidth?: string;
|
|
10
|
+
/** Space between cells. Defaults to `md`. */
|
|
11
|
+
gap?: StackGap;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Equal-width grid. With `columns` the count is fixed; otherwise it is intrinsic (`auto-fill`
|
|
16
|
+
* from `minColumnWidth`), so it reflows by the space it gets without breakpoints.
|
|
17
|
+
*/
|
|
18
|
+
export function Grid({
|
|
19
|
+
columns,
|
|
20
|
+
minColumnWidth = "16rem",
|
|
21
|
+
gap = "md",
|
|
22
|
+
className,
|
|
23
|
+
style,
|
|
24
|
+
...props
|
|
25
|
+
}: GridProps) {
|
|
26
|
+
const template =
|
|
27
|
+
columns === undefined
|
|
28
|
+
? `repeat(auto-fill, minmax(min(100%, ${minColumnWidth}), 1fr))`
|
|
29
|
+
: `repeat(${columns}, minmax(0, 1fr))`;
|
|
30
|
+
return (
|
|
31
|
+
<div
|
|
32
|
+
className={cn("grid min-w-0", stackGapClasses[gap], className)}
|
|
33
|
+
style={{ gridTemplateColumns: template, ...style } as CSSProperties}
|
|
34
|
+
{...props}
|
|
35
|
+
/>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Grid, type GridProps } from "./grid.js";
|
package/src/containers/index.ts
CHANGED
|
@@ -11,18 +11,21 @@ export * from "./description-list/index.js";
|
|
|
11
11
|
export * from "./facts/index.js";
|
|
12
12
|
export * from "./file-tree/index.js";
|
|
13
13
|
export * from "./generic-row/index.js";
|
|
14
|
+
export * from "./grid/index.js";
|
|
14
15
|
export * from "./hbars/index.js";
|
|
15
16
|
export * from "./highlight-line/index.js";
|
|
16
17
|
export * from "./item-card-group/index.js";
|
|
17
18
|
export * from "./kanban/index.js";
|
|
18
19
|
export * from "./kpi/index.js";
|
|
19
20
|
export * from "./kpi-group/index.js";
|
|
21
|
+
export * from "./page/index.js";
|
|
20
22
|
export * from "./page-header/index.js";
|
|
21
23
|
export * from "./resizable/index.js";
|
|
22
24
|
export * from "./responsive-list/index.js";
|
|
23
25
|
export * from "./scrolly/index.js";
|
|
24
26
|
export * from "./settings-layout/index.js";
|
|
25
27
|
export * from "./settings-row/index.js";
|
|
28
|
+
export * from "./stack/index.js";
|
|
26
29
|
export * from "./table/index.js";
|
|
27
30
|
export * from "./timeline/index.js";
|
|
28
31
|
export * from "./toolbar/index.js";
|