@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
|
@@ -22,6 +22,7 @@ import { resolveLabels } from "../core/types.js";
|
|
|
22
22
|
import { useIndexNavigation } from "../core/use-index-navigation.js";
|
|
23
23
|
import { useSeriesState } from "../core/use-series-state.js";
|
|
24
24
|
import { fitCenterText } from "./center-fit.js";
|
|
25
|
+
import { fitSliceLabel } from "./slice-labels.js";
|
|
25
26
|
function labelMode(value) {
|
|
26
27
|
if (!value) return null;
|
|
27
28
|
return value === true ? "both" : value;
|
|
@@ -52,6 +53,7 @@ function DonutChart({
|
|
|
52
53
|
centerLabel,
|
|
53
54
|
centerValue,
|
|
54
55
|
outsideLabels = false,
|
|
56
|
+
sliceLabels = false,
|
|
55
57
|
legend,
|
|
56
58
|
tooltip = true,
|
|
57
59
|
loading = false,
|
|
@@ -175,6 +177,7 @@ function DonutChart({
|
|
|
175
177
|
centerLabel: centerLabel ?? labels.total,
|
|
176
178
|
centerValue,
|
|
177
179
|
outside: labelMode(outsideLabels),
|
|
180
|
+
sliceLabels,
|
|
178
181
|
tooltip,
|
|
179
182
|
animate,
|
|
180
183
|
labels,
|
|
@@ -210,6 +213,7 @@ function DonutPlot({
|
|
|
210
213
|
centerLabel,
|
|
211
214
|
centerValue,
|
|
212
215
|
outside: outsideProp,
|
|
216
|
+
sliceLabels,
|
|
213
217
|
tooltip,
|
|
214
218
|
animate,
|
|
215
219
|
labels,
|
|
@@ -335,6 +339,27 @@ function DonutPlot({
|
|
|
335
339
|
}
|
|
336
340
|
return out;
|
|
337
341
|
}, [outside, visible, slices, items, cx, cy, radius, height]);
|
|
342
|
+
const insideLabels = useMemo(() => {
|
|
343
|
+
if (!sliceLabels) return [];
|
|
344
|
+
const fontSize = 11;
|
|
345
|
+
const out = [];
|
|
346
|
+
for (const index of visible) {
|
|
347
|
+
const slice = slices[index];
|
|
348
|
+
const item = items[index];
|
|
349
|
+
if (!slice || !item) continue;
|
|
350
|
+
const text = sliceLabels === "value" ? item.format(item.datum.value) : formatPercent(slice.fraction, { decimals: 0 });
|
|
351
|
+
const fit2 = fitSliceLabel({
|
|
352
|
+
inner,
|
|
353
|
+
radius,
|
|
354
|
+
start: slice.start,
|
|
355
|
+
end: slice.end,
|
|
356
|
+
chars: text.length,
|
|
357
|
+
fontSize
|
|
358
|
+
});
|
|
359
|
+
if (fit2) out.push({ id: item.datum.id, x: cx + fit2.x, y: cy + fit2.y, text });
|
|
360
|
+
}
|
|
361
|
+
return out;
|
|
362
|
+
}, [sliceLabels, visible, slices, items, inner, radius, cx, cy]);
|
|
338
363
|
useEntryAnimation(
|
|
339
364
|
svgRef,
|
|
340
365
|
(root) => {
|
|
@@ -443,6 +468,19 @@ function DonutPlot({
|
|
|
443
468
|
item.datum.id
|
|
444
469
|
);
|
|
445
470
|
}),
|
|
471
|
+
insideLabels.map((label) => /* @__PURE__ */ jsx(
|
|
472
|
+
"text",
|
|
473
|
+
{
|
|
474
|
+
x: label.x,
|
|
475
|
+
y: label.y,
|
|
476
|
+
textAnchor: "middle",
|
|
477
|
+
dominantBaseline: "central",
|
|
478
|
+
pointerEvents: "none",
|
|
479
|
+
className: "fill-surface font-bold text-fs-110 tabular-nums",
|
|
480
|
+
children: label.text
|
|
481
|
+
},
|
|
482
|
+
label.id
|
|
483
|
+
)),
|
|
446
484
|
outsideLabels.map((label) => {
|
|
447
485
|
const dimmed = focusIndex != null && items[focusIndex]?.datum.id !== label.id;
|
|
448
486
|
const avail = Math.max(24, (label.side > 0 ? width - label.x : label.x) - 6);
|
|
@@ -504,7 +542,7 @@ function DonutPlot({
|
|
|
504
542
|
d,
|
|
505
543
|
clickable: onSliceClick != null,
|
|
506
544
|
onEnter: (event) => nav.hover(position, event),
|
|
507
|
-
onLeave: nav.
|
|
545
|
+
onLeave: nav.pointerLeave,
|
|
508
546
|
onClick: onSliceClick ? () => onSliceClick(item.datum) : void 0
|
|
509
547
|
},
|
|
510
548
|
item.datum.id
|
|
@@ -604,6 +642,7 @@ function SliceHitArea({ d, clickable, onEnter, onLeave, onClick }) {
|
|
|
604
642
|
"path",
|
|
605
643
|
{
|
|
606
644
|
"data-slice-hit": "",
|
|
645
|
+
"data-chart-hit": "",
|
|
607
646
|
d,
|
|
608
647
|
fill: "transparent",
|
|
609
648
|
onPointerEnter: onEnter,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface SliceLabelInput {
|
|
2
|
+
/** Radius of the hole (0 for a pie). */
|
|
3
|
+
inner: number;
|
|
4
|
+
radius: number;
|
|
5
|
+
/** Angles in radians from 12 o'clock, clockwise. */
|
|
6
|
+
start: number;
|
|
7
|
+
end: number;
|
|
8
|
+
chars: number;
|
|
9
|
+
fontSize: number;
|
|
10
|
+
}
|
|
11
|
+
export interface SliceLabelFit {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Where a horizontal label sits inside a ring slice, relative to the centre, or null when the text
|
|
17
|
+
* does not fit: the box is projected on the radial and the tangential direction of the slice and
|
|
18
|
+
* must stay within the ring thickness and the arc length at its middle radius.
|
|
19
|
+
*/
|
|
20
|
+
export declare function fitSliceLabel(input: SliceLabelInput): SliceLabelFit | null;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const CHAR_WIDTH_EM = 0.6;
|
|
2
|
+
const FILL_RATIO = 0.92;
|
|
3
|
+
function fitSliceLabel(input) {
|
|
4
|
+
const { inner, radius, start, end, chars, fontSize } = input;
|
|
5
|
+
const mid = (start + end) / 2;
|
|
6
|
+
const at = inner <= 0 ? radius * 0.62 : (inner + radius) / 2;
|
|
7
|
+
const thickness = inner <= 0 ? radius * 0.7 : radius - inner;
|
|
8
|
+
const arc = (end - start) * at;
|
|
9
|
+
const width = chars * fontSize * CHAR_WIDTH_EM;
|
|
10
|
+
const height = fontSize * 1.1;
|
|
11
|
+
const rx = Math.sin(mid);
|
|
12
|
+
const ry = -Math.cos(mid);
|
|
13
|
+
const radial = width * Math.abs(rx) + height * Math.abs(ry);
|
|
14
|
+
const tangent = width * Math.abs(ry) + height * Math.abs(rx);
|
|
15
|
+
if (radial > thickness * FILL_RATIO || tangent > arc * FILL_RATIO) return null;
|
|
16
|
+
return { x: at * rx, y: at * ry };
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
fitSliceLabel
|
|
20
|
+
};
|
|
@@ -15,7 +15,10 @@ import { DIRECTION_COLORS, directionOf, seriesColor } from "../core/palette.js";
|
|
|
15
15
|
import { PlotOverlay } from "../core/plot-overlay.js";
|
|
16
16
|
import { linearScale } from "../core/scales/linear.js";
|
|
17
17
|
import { ChartTooltip } from "../core/tooltip.js";
|
|
18
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
resolveAxisBound,
|
|
20
|
+
resolveLabels
|
|
21
|
+
} from "../core/types.js";
|
|
19
22
|
const MARGIN = { top: 8, bottom: 30 };
|
|
20
23
|
const DELTA_COLUMN = 64;
|
|
21
24
|
const DOT_PAD = 40;
|
|
@@ -278,8 +281,8 @@ function DumbbellPlot({
|
|
|
278
281
|
const lo = all.length ? Math.min(...all) : 0;
|
|
279
282
|
const hi = all.length ? Math.max(...all) : 1;
|
|
280
283
|
const domain = [
|
|
281
|
-
xAxis?.min
|
|
282
|
-
xAxis?.max
|
|
284
|
+
resolveAxisBound(xAxis?.min, lo > 0 && lo < hi * 0.4 ? 0 : lo),
|
|
285
|
+
resolveAxisBound(xAxis?.max, hi)
|
|
283
286
|
];
|
|
284
287
|
const format = resolveAxisFormat(xAxis?.format ?? valueFormat);
|
|
285
288
|
if (vertical) {
|
|
@@ -243,7 +243,7 @@ function FunnelPlot({
|
|
|
243
243
|
opacity: shape.opacity,
|
|
244
244
|
dimmed: active != null && active !== i,
|
|
245
245
|
onEnter: (event) => nav.hover(i, event),
|
|
246
|
-
onLeave: nav.
|
|
246
|
+
onLeave: nav.pointerLeave
|
|
247
247
|
},
|
|
248
248
|
stages[i]?.id ?? i
|
|
249
249
|
)),
|
|
@@ -401,6 +401,7 @@ const StageMark = memo(function StageMark2({
|
|
|
401
401
|
"polygon",
|
|
402
402
|
{
|
|
403
403
|
"data-stage": "",
|
|
404
|
+
"data-chart-hit": "",
|
|
404
405
|
points,
|
|
405
406
|
strokeWidth: 2,
|
|
406
407
|
strokeLinejoin: "round",
|
|
@@ -304,7 +304,7 @@ function GaugePlot({
|
|
|
304
304
|
opacity: needle ? 0.92 : focused === index ? 0.32 : 0,
|
|
305
305
|
dimmed: needle && focused != null && focused !== index,
|
|
306
306
|
onEnter: (event) => nav.hover(index, event),
|
|
307
|
-
onLeave: nav.
|
|
307
|
+
onLeave: nav.pointerLeave
|
|
308
308
|
},
|
|
309
309
|
index
|
|
310
310
|
);
|
|
@@ -474,6 +474,7 @@ const BandMark = memo(function BandMark2({
|
|
|
474
474
|
"path",
|
|
475
475
|
{
|
|
476
476
|
"data-band": "",
|
|
477
|
+
"data-chart-hit": "",
|
|
477
478
|
d,
|
|
478
479
|
fill: "none",
|
|
479
480
|
strokeWidth: width,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ColorRange, ScaleColors } from "../core/color-scale.js";
|
|
2
2
|
import { type ValueFormat } from "../core/format.js";
|
|
3
|
+
import type { TooltipRow } from "../core/tooltip.js";
|
|
3
4
|
import { type HeatmapCellInfo, type HeatmapLabels } from "./heatmap-grid.js";
|
|
4
5
|
export interface HeatmapChartProps {
|
|
5
6
|
/** Accessible name of the drawing and caption of the data table. */
|
|
@@ -48,6 +49,8 @@ export interface HeatmapChartProps {
|
|
|
48
49
|
loading?: boolean;
|
|
49
50
|
labels?: Partial<HeatmapLabels>;
|
|
50
51
|
onCellClick?: (cell: HeatmapCellInfo) => void;
|
|
52
|
+
/** Extra tooltip rows for a cell, shown under its value, e.g. an amount next to a count. */
|
|
53
|
+
cellDetail?: (row: number, column: number, value: number | null) => readonly TooltipRow[];
|
|
51
54
|
className?: string;
|
|
52
55
|
}
|
|
53
56
|
/**
|
|
@@ -56,4 +59,4 @@ export interface HeatmapChartProps {
|
|
|
56
59
|
* `ranges` switches to stepped colors. Hover and keyboard focus light the
|
|
57
60
|
* row and column of the cell.
|
|
58
61
|
*/
|
|
59
|
-
export declare function HeatmapChart({ title, rows, columns, values, scale, domain, center, colors, ranges, valueFormat, cellLabels, gap, radius, shape, renderer, height, aspectRatio, legend, tooltip, animate, loading, labels: labelsProp, onCellClick, className, }: HeatmapChartProps): import("react").JSX.Element;
|
|
62
|
+
export declare function HeatmapChart({ title, rows, columns, values, scale, domain, center, colors, ranges, valueFormat, cellLabels, gap, radius, shape, renderer, height, aspectRatio, legend, tooltip, animate, loading, labels: labelsProp, onCellClick, cellDetail, className, }: HeatmapChartProps): import("react").JSX.Element;
|
|
@@ -36,6 +36,7 @@ function HeatmapChart({
|
|
|
36
36
|
loading,
|
|
37
37
|
labels: labelsProp,
|
|
38
38
|
onCellClick,
|
|
39
|
+
cellDetail,
|
|
39
40
|
className
|
|
40
41
|
}) {
|
|
41
42
|
const labels = resolveHeatmapLabels(labelsProp);
|
|
@@ -116,7 +117,8 @@ function HeatmapChart({
|
|
|
116
117
|
renderer,
|
|
117
118
|
tooltip,
|
|
118
119
|
animate,
|
|
119
|
-
onCellClick
|
|
120
|
+
onCellClick,
|
|
121
|
+
cellDetail
|
|
120
122
|
}
|
|
121
123
|
)
|
|
122
124
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ColorRange, type ScaleColors } from "../core/color-scale.js";
|
|
2
2
|
import type { ValueFormatter } from "../core/format.js";
|
|
3
|
+
import { type TooltipRow } from "../core/tooltip.js";
|
|
3
4
|
import { type ChartLabels } from "../core/types.js";
|
|
4
5
|
import type { HeatmapScale } from "./heatmap-scale.js";
|
|
5
6
|
/** Visible strings of the heatmaps. */
|
|
@@ -38,6 +39,8 @@ export interface HeatmapGridProps {
|
|
|
38
39
|
tooltip: boolean;
|
|
39
40
|
animate: boolean;
|
|
40
41
|
onCellClick?: (cell: HeatmapCellInfo) => void;
|
|
42
|
+
/** Extra tooltip rows under the cell value, e.g. a second measure of the same cell. */
|
|
43
|
+
cellDetail?: (row: number, column: number, value: number | null) => readonly TooltipRow[];
|
|
41
44
|
/** Name of the value in the tooltip; the row label by default. */
|
|
42
45
|
valueName?: string;
|
|
43
46
|
/** "hex" lays the cells out as a honeycomb (odd rows shifted half a cell). */
|
|
@@ -58,7 +61,7 @@ export declare function rowGutter(width: number, rowLabels: readonly string[]):
|
|
|
58
61
|
* column like a crosshair and dims the rest. Column labels thin out when they
|
|
59
62
|
* would collide; cell values only show where they fit.
|
|
60
63
|
*/
|
|
61
|
-
export declare function HeatmapGrid({ width, height, title, rowLabels, columnLabels, values, colorScale, format, cellTitle, labels, cellLabels, gap, radius, square, tooltip, animate, onCellClick, valueName, shape, renderer, }: HeatmapGridProps): import("react").JSX.Element;
|
|
64
|
+
export declare function HeatmapGrid({ width, height, title, rowLabels, columnLabels, values, colorScale, format, cellTitle, labels, cellLabels, gap, radius, square, tooltip, animate, onCellClick, cellDetail, valueName, shape, renderer, }: HeatmapGridProps): import("react").JSX.Element;
|
|
62
65
|
export interface HeatmapLegendProps {
|
|
63
66
|
kind: "sequential" | "diverging";
|
|
64
67
|
domain: readonly [number, number];
|
|
@@ -48,6 +48,7 @@ function HeatmapGrid({
|
|
|
48
48
|
tooltip,
|
|
49
49
|
animate,
|
|
50
50
|
onCellClick,
|
|
51
|
+
cellDetail,
|
|
51
52
|
valueName,
|
|
52
53
|
shape = "rect",
|
|
53
54
|
renderer = "svg"
|
|
@@ -426,7 +427,8 @@ function HeatmapGrid({
|
|
|
426
427
|
name: valueName ?? rowLabels[shown.row] ?? "",
|
|
427
428
|
value: shownValue == null ? labels.noData : format(shownValue),
|
|
428
429
|
color: shownColor
|
|
429
|
-
}
|
|
430
|
+
},
|
|
431
|
+
...cellDetail?.(shown.row, shown.column, shownValue ?? null) ?? []
|
|
430
432
|
]
|
|
431
433
|
}
|
|
432
434
|
) : null
|
|
@@ -181,126 +181,135 @@ function HexPlot({
|
|
|
181
181
|
}
|
|
182
182
|
};
|
|
183
183
|
const anchor = current && active != null ? grid.centers[active] ?? null : null;
|
|
184
|
-
return /* @__PURE__ */ jsxs(
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
x: cx,
|
|
234
|
-
y: cy,
|
|
235
|
-
textAnchor: "middle",
|
|
236
|
-
className: "pointer-events-none font-bold tabular-nums",
|
|
237
|
-
style: { fill: cell.ink },
|
|
238
|
-
children: [
|
|
239
|
-
/* @__PURE__ */ jsx(
|
|
240
|
-
"tspan",
|
|
241
|
-
{
|
|
242
|
-
x: cx,
|
|
243
|
-
dy: text.length > 1 ? "-0.15em" : "0.35em",
|
|
244
|
-
fontSize: showCode ? codeSize : valueSize,
|
|
245
|
-
children: text[0]
|
|
184
|
+
return /* @__PURE__ */ jsxs(
|
|
185
|
+
"div",
|
|
186
|
+
{
|
|
187
|
+
ref: nav.ref,
|
|
188
|
+
className: "relative",
|
|
189
|
+
style: { width, height },
|
|
190
|
+
onPointerLeave: nav.pointerLeave,
|
|
191
|
+
children: [
|
|
192
|
+
/* @__PURE__ */ jsx(
|
|
193
|
+
"svg",
|
|
194
|
+
{
|
|
195
|
+
ref: svgRef,
|
|
196
|
+
role: "img",
|
|
197
|
+
"aria-label": title,
|
|
198
|
+
width,
|
|
199
|
+
height,
|
|
200
|
+
className: "block overflow-visible",
|
|
201
|
+
children: cells.map((cell, index) => {
|
|
202
|
+
const [cx, cy] = grid.centers[index];
|
|
203
|
+
const isActive = index === active;
|
|
204
|
+
const text = [
|
|
205
|
+
showCode ? cell.tile.code : null,
|
|
206
|
+
showValue && cell.value != null ? format(cell.value) : null
|
|
207
|
+
].filter(Boolean);
|
|
208
|
+
return (
|
|
209
|
+
// biome-ignore lint/a11y/noStaticElementInteractions: pointer mirror of the keyboard model on the slider below.
|
|
210
|
+
/* @__PURE__ */ jsxs(
|
|
211
|
+
"g",
|
|
212
|
+
{
|
|
213
|
+
"data-tile": "",
|
|
214
|
+
style: {
|
|
215
|
+
cursor: onTileClick ? "pointer" : "default",
|
|
216
|
+
transformBox: "fill-box",
|
|
217
|
+
transformOrigin: "center"
|
|
218
|
+
},
|
|
219
|
+
onPointerEnter: (event) => nav.hover(index, event),
|
|
220
|
+
onPointerMove: (event) => nav.hover(index, event),
|
|
221
|
+
onClick: () => click(index),
|
|
222
|
+
children: [
|
|
223
|
+
/* @__PURE__ */ jsx(
|
|
224
|
+
"polygon",
|
|
225
|
+
{
|
|
226
|
+
points: hexPoints(cx, cy, grid.size, gap / 2),
|
|
227
|
+
strokeLinejoin: "round",
|
|
228
|
+
className: "motion-safe:transition-[fill] motion-safe:duration-150",
|
|
229
|
+
style: {
|
|
230
|
+
fill: cell.color,
|
|
231
|
+
stroke: isActive ? "var(--ink)" : "var(--surface)",
|
|
232
|
+
strokeWidth: isActive ? 2.5 : 1
|
|
246
233
|
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
234
|
+
}
|
|
235
|
+
),
|
|
236
|
+
text.length > 0 ? /* @__PURE__ */ jsxs(
|
|
237
|
+
"text",
|
|
238
|
+
{
|
|
239
|
+
...DECORATIVE,
|
|
240
|
+
x: cx,
|
|
241
|
+
y: cy,
|
|
242
|
+
textAnchor: "middle",
|
|
243
|
+
className: "pointer-events-none font-bold tabular-nums",
|
|
244
|
+
style: { fill: cell.ink },
|
|
245
|
+
children: [
|
|
246
|
+
/* @__PURE__ */ jsx(
|
|
247
|
+
"tspan",
|
|
248
|
+
{
|
|
249
|
+
x: cx,
|
|
250
|
+
dy: text.length > 1 ? "-0.15em" : "0.35em",
|
|
251
|
+
fontSize: showCode ? codeSize : valueSize,
|
|
252
|
+
children: text[0]
|
|
253
|
+
}
|
|
254
|
+
),
|
|
255
|
+
text.length > 1 ? /* @__PURE__ */ jsx("tspan", { x: cx, dy: "1.2em", fontSize: valueSize, className: "font-semibold", children: text[1] }) : null
|
|
256
|
+
]
|
|
257
|
+
}
|
|
258
|
+
) : null
|
|
259
|
+
]
|
|
260
|
+
},
|
|
261
|
+
cell.tile.id
|
|
262
|
+
)
|
|
263
|
+
);
|
|
264
|
+
})
|
|
265
|
+
}
|
|
266
|
+
),
|
|
267
|
+
/* @__PURE__ */ jsx(
|
|
268
|
+
"div",
|
|
269
|
+
{
|
|
270
|
+
role: "slider",
|
|
271
|
+
tabIndex: 0,
|
|
272
|
+
"aria-label": labels.explore,
|
|
273
|
+
"aria-valuemin": 1,
|
|
274
|
+
"aria-valuemax": Math.max(1, cells.length),
|
|
275
|
+
"aria-valuenow": (active ?? 0) + 1,
|
|
276
|
+
"aria-valuetext": valueText,
|
|
277
|
+
onKeyDown: (event) => {
|
|
278
|
+
if ((event.key === "Enter" || event.key === " ") && active != null) {
|
|
279
|
+
event.preventDefault();
|
|
280
|
+
click(active);
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
nav.sliderProps.onKeyDown(event);
|
|
284
|
+
},
|
|
285
|
+
onFocus: nav.sliderProps.onFocus,
|
|
286
|
+
onBlur: nav.sliderProps.onBlur,
|
|
287
|
+
className: cn(
|
|
288
|
+
"pointer-events-none absolute inset-0 rounded-xs outline-none",
|
|
289
|
+
"focus-visible:outline-2 focus-visible:outline-accent-ink focus-visible:outline-offset-4"
|
|
255
290
|
)
|
|
256
|
-
);
|
|
257
|
-
})
|
|
258
|
-
}
|
|
259
|
-
),
|
|
260
|
-
/* @__PURE__ */ jsx(
|
|
261
|
-
"div",
|
|
262
|
-
{
|
|
263
|
-
role: "slider",
|
|
264
|
-
tabIndex: 0,
|
|
265
|
-
"aria-label": labels.explore,
|
|
266
|
-
"aria-valuemin": 1,
|
|
267
|
-
"aria-valuemax": Math.max(1, cells.length),
|
|
268
|
-
"aria-valuenow": (active ?? 0) + 1,
|
|
269
|
-
"aria-valuetext": valueText,
|
|
270
|
-
onKeyDown: (event) => {
|
|
271
|
-
if ((event.key === "Enter" || event.key === " ") && active != null) {
|
|
272
|
-
event.preventDefault();
|
|
273
|
-
click(active);
|
|
274
|
-
return;
|
|
275
291
|
}
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
onBlur: nav.sliderProps.onBlur,
|
|
280
|
-
className: cn(
|
|
281
|
-
"pointer-events-none absolute inset-0 rounded-xs outline-none",
|
|
282
|
-
"focus-visible:outline-2 focus-visible:outline-accent-ink focus-visible:outline-offset-4"
|
|
283
|
-
)
|
|
284
|
-
}
|
|
285
|
-
),
|
|
286
|
-
tooltip && current ? /* @__PURE__ */ jsx(
|
|
287
|
-
ChartTooltip,
|
|
288
|
-
{
|
|
289
|
-
x: nav.pointer?.x ?? anchor?.[0] ?? 0,
|
|
290
|
-
y: nav.pointer?.y ?? anchor?.[1] ?? 0,
|
|
291
|
-
containerWidth: width,
|
|
292
|
-
title: current.tile.name,
|
|
293
|
-
rows: [
|
|
292
|
+
),
|
|
293
|
+
tooltip && current ? /* @__PURE__ */ jsx(
|
|
294
|
+
ChartTooltip,
|
|
294
295
|
{
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
296
|
+
x: nav.pointer?.x ?? anchor?.[0] ?? 0,
|
|
297
|
+
y: nav.pointer?.y ?? anchor?.[1] ?? 0,
|
|
298
|
+
containerWidth: width,
|
|
299
|
+
title: current.tile.name,
|
|
300
|
+
rows: [
|
|
301
|
+
{
|
|
302
|
+
id: "value",
|
|
303
|
+
name: valueName,
|
|
304
|
+
value: current.value == null ? labels.noData : format(current.value),
|
|
305
|
+
color: current.color
|
|
306
|
+
}
|
|
307
|
+
]
|
|
299
308
|
}
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
309
|
+
) : null
|
|
310
|
+
]
|
|
311
|
+
}
|
|
312
|
+
);
|
|
304
313
|
}
|
|
305
314
|
export {
|
|
306
315
|
HexTileMap
|
|
@@ -254,9 +254,10 @@ function MorphPlot({
|
|
|
254
254
|
"path",
|
|
255
255
|
{
|
|
256
256
|
d: path,
|
|
257
|
+
"data-chart-hit": "",
|
|
257
258
|
onPointerEnter: (event) => nav.hover(index, event),
|
|
258
259
|
onPointerMove: (event) => nav.hover(index, event),
|
|
259
|
-
onPointerLeave: nav.
|
|
260
|
+
onPointerLeave: nav.pointerLeave,
|
|
260
261
|
style: {
|
|
261
262
|
fill: tint(base, strength),
|
|
262
263
|
opacity: faded * (dimmed ? 0.45 : 1),
|
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
resolveHierarchyLabels
|
|
27
27
|
} from "../core/hierarchy-chart.js";
|
|
28
28
|
import { EASE_OUT, useEntryAnimation } from "../core/motion.js";
|
|
29
|
+
import { boxAt } from "../core/nearest.js";
|
|
29
30
|
import { ChartTooltip } from "../core/tooltip.js";
|
|
30
31
|
import { useAnimatedView, useDrill } from "../core/use-drill.js";
|
|
31
32
|
function IcicleChart({
|
|
@@ -156,15 +157,12 @@ function IciclePlot({
|
|
|
156
157
|
{ disabled: !animate }
|
|
157
158
|
);
|
|
158
159
|
const children = focus.children;
|
|
159
|
-
const hit = (x, y) => {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
}
|
|
166
|
-
return null;
|
|
167
|
-
};
|
|
160
|
+
const hit = (x, y) => boxAt(cells, x, y, (cell) => ({
|
|
161
|
+
x0: cell.x,
|
|
162
|
+
y0: cell.y,
|
|
163
|
+
x1: cell.x + cell.width,
|
|
164
|
+
y1: cell.y + cell.height
|
|
165
|
+
}));
|
|
168
166
|
const local = (event) => {
|
|
169
167
|
const box = event.currentTarget.getBoundingClientRect();
|
|
170
168
|
return { x: event.clientX - box.left, y: event.clientY - box.top };
|
|
@@ -11,7 +11,10 @@ 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
|
+
resolveAxisBound,
|
|
16
|
+
resolveLabels
|
|
17
|
+
} from "../core/types.js";
|
|
15
18
|
const PAD = { top: 12, bottom: 28 };
|
|
16
19
|
function fitLabel(text, room) {
|
|
17
20
|
const max = Math.max(3, Math.floor(room / 6.6));
|
|
@@ -116,8 +119,8 @@ function LollipopPlot({
|
|
|
116
119
|
const model = useMemo(() => {
|
|
117
120
|
const values = rows.map((row) => row.value);
|
|
118
121
|
const domain = [
|
|
119
|
-
yAxis?.min
|
|
120
|
-
yAxis?.max
|
|
122
|
+
resolveAxisBound(yAxis?.min, Math.min(0, ...values)),
|
|
123
|
+
resolveAxisBound(yAxis?.max, Math.max(0, ...values))
|
|
121
124
|
];
|
|
122
125
|
const format = resolveAxisFormat(yAxis?.format ?? valueFormat);
|
|
123
126
|
const top2 = PAD.top + (vertical && dataLabels ? 8 : 0);
|
|
@@ -116,7 +116,7 @@ function RegionLabels({
|
|
|
116
116
|
index
|
|
117
117
|
)) });
|
|
118
118
|
}
|
|
119
|
-
const BUTTON = "inline-flex size-8 cursor-pointer items-center justify-center border-0
|
|
119
|
+
const BUTTON = "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";
|
|
120
120
|
function Glyph({ d }) {
|
|
121
121
|
return /* @__PURE__ */ jsx("svg", { "aria-hidden": "true", viewBox: "0 0 16 16", width: "16", height: "16", fill: "none", children: /* @__PURE__ */ jsx(
|
|
122
122
|
"path",
|