@contui/ui 0.0.0-stage → 0.1.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/LICENSE +30 -0
- package/README.md +150 -2
- package/cli/contui.mjs +250 -0
- package/dist/charts/area-chart.d.ts +8 -0
- package/dist/charts/area-chart.js +9 -0
- package/dist/charts/bar-chart.d.ts +9 -0
- package/dist/charts/bar-chart.js +10 -0
- package/dist/charts/bubble-chart.d.ts +60 -0
- package/dist/charts/bubble-chart.js +392 -0
- package/dist/charts/bullet-chart.d.ts +53 -0
- package/dist/charts/bullet-chart.js +123 -0
- package/dist/charts/candlestick-chart.d.ts +77 -0
- package/dist/charts/candlestick-chart.js +558 -0
- package/dist/charts/cartesian.d.ts +121 -0
- package/dist/charts/cartesian.js +625 -0
- package/dist/charts/chart-card.d.ts +80 -0
- package/dist/charts/chart-card.js +114 -0
- package/dist/charts/donut-chart.d.ts +40 -0
- package/dist/charts/donut-chart.js +88 -0
- package/dist/charts/funnel-chart.d.ts +16 -0
- package/dist/charts/funnel-chart.js +164 -0
- package/dist/charts/horizontal-bar-chart.d.ts +67 -0
- package/dist/charts/horizontal-bar-chart.js +481 -0
- package/dist/charts/index.d.ts +21 -0
- package/dist/charts/index.js +32 -0
- package/dist/charts/legend.d.ts +23 -0
- package/dist/charts/legend.js +22 -0
- package/dist/charts/lib/candlestick-window.d.ts +15 -0
- package/dist/charts/lib/candlestick-window.js +23 -0
- package/dist/charts/lib/color.d.ts +39 -0
- package/dist/charts/lib/color.js +83 -0
- package/dist/charts/lib/format.d.ts +11 -0
- package/dist/charts/lib/format.js +33 -0
- package/dist/charts/lib/frame.d.ts +6 -0
- package/dist/charts/lib/frame.js +6 -0
- package/dist/charts/lib/layout.d.ts +11 -0
- package/dist/charts/lib/layout.js +71 -0
- package/dist/charts/lib/path.d.ts +35 -0
- package/dist/charts/lib/path.js +203 -0
- package/dist/charts/lib/scale.d.ts +41 -0
- package/dist/charts/lib/scale.js +80 -0
- package/dist/charts/lib/use-active.d.ts +18 -0
- package/dist/charts/lib/use-active.js +71 -0
- package/dist/charts/lib/use-size.d.ts +9 -0
- package/dist/charts/lib/use-size.js +40 -0
- package/dist/charts/line-chart.d.ts +7 -0
- package/dist/charts/line-chart.js +8 -0
- package/dist/charts/radar-chart.d.ts +27 -0
- package/dist/charts/radar-chart.js +165 -0
- package/dist/charts/rose-chart.d.ts +35 -0
- package/dist/charts/rose-chart.js +242 -0
- package/dist/charts/sparkline.d.ts +35 -0
- package/dist/charts/sparkline.js +110 -0
- package/dist/charts/tooltip.d.ts +35 -0
- package/dist/charts/tooltip.js +22 -0
- package/dist/charts/treemap.d.ts +28 -0
- package/dist/charts/treemap.js +103 -0
- package/dist/charts/uptime-strip.d.ts +40 -0
- package/dist/charts/uptime-strip.js +178 -0
- package/dist/components/accordion.d.ts +31 -0
- package/dist/components/accordion.js +34 -0
- package/dist/components/activity-item.d.ts +12 -0
- package/dist/components/activity-item.js +6 -0
- package/dist/components/alert.d.ts +21 -0
- package/dist/components/alert.js +58 -0
- package/dist/components/assistant-answer.d.ts +52 -0
- package/dist/components/assistant-answer.js +40 -0
- package/dist/components/assistant-prompt.d.ts +63 -0
- package/dist/components/assistant-prompt.js +122 -0
- package/dist/components/avatar.d.ts +28 -0
- package/dist/components/avatar.js +75 -0
- package/dist/components/badge.d.ts +16 -0
- package/dist/components/badge.js +33 -0
- package/dist/components/bar-list.d.ts +65 -0
- package/dist/components/bar-list.js +119 -0
- package/dist/components/block-slider.d.ts +43 -0
- package/dist/components/block-slider.js +63 -0
- package/dist/components/branch-graph.d.ts +87 -0
- package/dist/components/branch-graph.js +231 -0
- package/dist/components/breadcrumb.d.ts +41 -0
- package/dist/components/breadcrumb.js +53 -0
- package/dist/components/button.d.ts +23 -0
- package/dist/components/button.js +108 -0
- package/dist/components/calendar.d.ts +5 -0
- package/dist/components/calendar.js +90 -0
- package/dist/components/card.d.ts +65 -0
- package/dist/components/card.js +104 -0
- package/dist/components/chat-attachment.d.ts +47 -0
- package/dist/components/chat-attachment.js +63 -0
- package/dist/components/chat-event.d.ts +7 -0
- package/dist/components/chat-event.js +7 -0
- package/dist/components/chat-message.d.ts +59 -0
- package/dist/components/chat-message.js +91 -0
- package/dist/components/chat-reference.d.ts +20 -0
- package/dist/components/chat-reference.js +41 -0
- package/dist/components/chat-shared.d.ts +21 -0
- package/dist/components/chat-shared.js +23 -0
- package/dist/components/chat-suggestions.d.ts +59 -0
- package/dist/components/chat-suggestions.js +88 -0
- package/dist/components/chat-thread.d.ts +39 -0
- package/dist/components/chat-thread.js +172 -0
- package/dist/components/chat-typing.d.ts +35 -0
- package/dist/components/chat-typing.js +66 -0
- package/dist/components/checkbox.d.ts +18 -0
- package/dist/components/checkbox.js +33 -0
- package/dist/components/checklist.d.ts +26 -0
- package/dist/components/checklist.js +18 -0
- package/dist/components/chip.d.ts +29 -0
- package/dist/components/chip.js +61 -0
- package/dist/components/code-input.d.ts +40 -0
- package/dist/components/code-input.js +285 -0
- package/dist/components/color-picker.d.ts +38 -0
- package/dist/components/color-picker.js +855 -0
- package/dist/components/combobox.d.ts +75 -0
- package/dist/components/combobox.js +112 -0
- package/dist/components/command-menu.d.ts +58 -0
- package/dist/components/command-menu.js +166 -0
- package/dist/components/copy-button.d.ts +16 -0
- package/dist/components/copy-button.js +31 -0
- package/dist/components/data-grid.d.ts +50 -0
- package/dist/components/data-grid.js +599 -0
- package/dist/components/date-picker.d.ts +109 -0
- package/dist/components/date-picker.js +268 -0
- package/dist/components/description-list.d.ts +12 -0
- package/dist/components/description-list.js +10 -0
- package/dist/components/dialog.d.ts +57 -0
- package/dist/components/dialog.js +140 -0
- package/dist/components/dock.d.ts +45 -0
- package/dist/components/dock.js +79 -0
- package/dist/components/drop-zone.d.ts +46 -0
- package/dist/components/drop-zone.js +101 -0
- package/dist/components/dropdown-menu.d.ts +50 -0
- package/dist/components/dropdown-menu.js +78 -0
- package/dist/components/editable-cell.d.ts +34 -0
- package/dist/components/editable-cell.js +89 -0
- package/dist/components/empty-state.d.ts +17 -0
- package/dist/components/empty-state.js +9 -0
- package/dist/components/field.d.ts +43 -0
- package/dist/components/field.js +75 -0
- package/dist/components/filter-condition.d.ts +188 -0
- package/dist/components/filter-condition.js +113 -0
- package/dist/components/filter-menu.d.ts +57 -0
- package/dist/components/filter-menu.js +46 -0
- package/dist/components/header-bar.d.ts +84 -0
- package/dist/components/header-bar.js +94 -0
- package/dist/components/hold-button.d.ts +15 -0
- package/dist/components/hold-button.js +88 -0
- package/dist/components/icon-tile.d.ts +12 -0
- package/dist/components/icon-tile.js +29 -0
- package/dist/components/info-tip.d.ts +13 -0
- package/dist/components/info-tip.js +26 -0
- package/dist/components/input.d.ts +17 -0
- package/dist/components/input.js +83 -0
- package/dist/components/kbd.d.ts +6 -0
- package/dist/components/kbd.js +7 -0
- package/dist/components/menu-item.d.ts +56 -0
- package/dist/components/menu-item.js +94 -0
- package/dist/components/message-composer.d.ts +75 -0
- package/dist/components/message-composer.js +199 -0
- package/dist/components/nav-rail.d.ts +31 -0
- package/dist/components/nav-rail.js +85 -0
- package/dist/components/notice.d.ts +45 -0
- package/dist/components/notice.js +66 -0
- package/dist/components/optimistic-undo.d.ts +28 -0
- package/dist/components/optimistic-undo.js +43 -0
- package/dist/components/option-row.d.ts +15 -0
- package/dist/components/option-row.js +14 -0
- package/dist/components/page-content.d.ts +11 -0
- package/dist/components/page-content.js +31 -0
- package/dist/components/pagination.d.ts +34 -0
- package/dist/components/pagination.js +41 -0
- package/dist/components/popover.d.ts +27 -0
- package/dist/components/popover.js +25 -0
- package/dist/components/progress.d.ts +33 -0
- package/dist/components/progress.js +75 -0
- package/dist/components/radio-group.d.ts +7 -0
- package/dist/components/radio-group.js +33 -0
- package/dist/components/readonly-field.d.ts +33 -0
- package/dist/components/readonly-field.js +80 -0
- package/dist/components/segmented-control.d.ts +21 -0
- package/dist/components/segmented-control.js +108 -0
- package/dist/components/select.d.ts +42 -0
- package/dist/components/select.js +86 -0
- package/dist/components/separator.d.ts +10 -0
- package/dist/components/separator.js +7 -0
- package/dist/components/setting-row.d.ts +53 -0
- package/dist/components/setting-row.js +93 -0
- package/dist/components/sidebar-switcher.d.ts +47 -0
- package/dist/components/sidebar-switcher.js +20 -0
- package/dist/components/sidebar.d.ts +220 -0
- package/dist/components/sidebar.js +327 -0
- package/dist/components/skeleton.d.ts +18 -0
- package/dist/components/skeleton.js +23 -0
- package/dist/components/slider.d.ts +15 -0
- package/dist/components/slider.js +28 -0
- package/dist/components/spinner.d.ts +14 -0
- package/dist/components/spinner.js +19 -0
- package/dist/components/status-dot.d.ts +24 -0
- package/dist/components/status-dot.js +35 -0
- package/dist/components/stepper.d.ts +60 -0
- package/dist/components/stepper.js +197 -0
- package/dist/components/switch.d.ts +9 -0
- package/dist/components/switch.js +26 -0
- package/dist/components/table-cell.d.ts +38 -0
- package/dist/components/table-cell.js +107 -0
- package/dist/components/table-context.d.ts +48 -0
- package/dist/components/table-context.js +69 -0
- package/dist/components/table-head.d.ts +42 -0
- package/dist/components/table-head.js +188 -0
- package/dist/components/table-tree.d.ts +96 -0
- package/dist/components/table-tree.js +137 -0
- package/dist/components/table.d.ts +78 -0
- package/dist/components/table.js +119 -0
- package/dist/components/tabs.d.ts +27 -0
- package/dist/components/tabs.js +79 -0
- package/dist/components/textarea.d.ts +3 -0
- package/dist/components/textarea.js +20 -0
- package/dist/components/theme.d.ts +41 -0
- package/dist/components/theme.js +60 -0
- package/dist/components/thinking.d.ts +68 -0
- package/dist/components/thinking.js +94 -0
- package/dist/components/toast.d.ts +39 -0
- package/dist/components/toast.js +110 -0
- package/dist/components/toolbar.d.ts +25 -0
- package/dist/components/toolbar.js +92 -0
- package/dist/components/tooltip.d.ts +23 -0
- package/dist/components/tooltip.js +27 -0
- package/dist/components/top-nav.d.ts +129 -0
- package/dist/components/top-nav.js +211 -0
- package/dist/components/truncate.d.ts +29 -0
- package/dist/components/truncate.js +138 -0
- package/dist/deprecated.d.ts +43 -0
- package/dist/deprecated.js +47 -0
- package/dist/index.d.ts +93 -0
- package/dist/index.js +93 -0
- package/dist/lib/cn.d.ts +5 -0
- package/dist/lib/cn.js +14 -0
- package/dist/lib/color.d.ts +136 -0
- package/dist/lib/color.js +307 -0
- package/dist/lib/contrast.d.ts +53 -0
- package/dist/lib/contrast.js +169 -0
- package/dist/lib/create-theme.d.ts +240 -0
- package/dist/lib/create-theme.js +461 -0
- package/dist/lib/harmony.d.ts +102 -0
- package/dist/lib/harmony.js +426 -0
- package/dist/lib/import-theme.d.ts +22 -0
- package/dist/lib/import-theme.js +221 -0
- package/dist/lib/overflow-scroll.d.ts +25 -0
- package/dist/lib/overflow-scroll.js +66 -0
- package/dist/lib/radio-toggle-render.d.ts +3 -0
- package/dist/lib/radio-toggle-render.js +9 -0
- package/dist/lib/reorder.d.ts +38 -0
- package/dist/lib/reorder.js +193 -0
- package/dist/lib/spacing.d.ts +101 -0
- package/dist/lib/spacing.js +118 -0
- package/dist/lib/tailwind-palette.d.ts +5 -0
- package/dist/lib/tailwind-palette.js +351 -0
- package/dist/lib/truncate.d.ts +18 -0
- package/dist/lib/truncate.js +69 -0
- package/dist/lib/use-single-value.d.ts +5 -0
- package/dist/lib/use-single-value.js +17 -0
- package/dist/styles.css +7988 -0
- package/mcp/server.mjs +87590 -0
- package/package.json +58 -5
- package/skills/continuum-fix-padding/SKILL.md +69 -0
- package/skills/continuum-fix-padding/scripts/compute.ts +155 -0
- package/skills/continuum-fix-padding/scripts/spacing.ts +189 -0
- package/skills/continuum-taste/SKILL.md +186 -0
- package/skills/continuum-taste/assets/tokens.css +647 -0
- package/skills/continuum-taste/references/charts.md +375 -0
- package/skills/continuum-taste/references/components.md +1369 -0
- package/skills/continuum-taste/references/foundations.md +539 -0
- package/skills/continuum-taste/references/media/canvas.md +75 -0
- package/skills/continuum-taste/references/media/css.md +61 -0
- package/skills/continuum-taste/references/media/react.md +161 -0
- package/skills/continuum-taste/references/method.md +87 -0
- package/skills/continuum-taste/references/pages.md +391 -0
- package/skills/continuum-taste/references/patterns.md +77 -0
- package/skills/continuum-taste/references/screens/agent.tsx +450 -0
- package/skills/continuum-taste/references/screens/analytics-overview.tsx +377 -0
- package/skills/continuum-taste/references/screens/checkout-funnel.tsx +193 -0
- package/skills/continuum-taste/references/screens/customer.tsx +475 -0
- package/skills/continuum-taste/references/screens/customers.tsx +608 -0
- package/skills/continuum-taste/references/screens/index.tsx +72 -0
- package/skills/continuum-taste/references/screens/invoice-editor.tsx +558 -0
- package/skills/continuum-taste/references/screens/new-customer.tsx +205 -0
- package/skills/continuum-taste/references/screens/overview.tsx +196 -0
- package/skills/continuum-taste/references/screens/report-generator.tsx +329 -0
- package/skills/continuum-taste/references/screens/risk-report.tsx +577 -0
- package/skills/continuum-taste/references/screens/sequence-editor.tsx +455 -0
- package/skills/continuum-taste/references/screens/settings.tsx +288 -0
- package/skills/continuum-taste/references/screens/shared.tsx +204 -0
- package/skills/continuum-taste/references/screens/sign-in.tsx +104 -0
- package/skills/continuum-taste/references/screens/workspace.tsx +596 -0
- package/skills/continuum-taste/references/theming.md +95 -0
- package/src/charts/area-chart.tsx +17 -0
- package/src/charts/bar-chart.tsx +15 -0
- package/src/charts/bubble-chart.tsx +913 -0
- package/src/charts/bullet-chart.tsx +419 -0
- package/src/charts/candlestick-chart.tsx +1242 -0
- package/src/charts/cartesian.tsx +1437 -0
- package/src/charts/chart-card.tsx +394 -0
- package/src/charts/donut-chart.tsx +299 -0
- package/src/charts/funnel-chart.tsx +373 -0
- package/src/charts/horizontal-bar-chart.tsx +991 -0
- package/src/charts/index.ts +76 -0
- package/src/charts/legend.tsx +59 -0
- package/src/charts/lib/candlestick-window.ts +42 -0
- package/src/charts/lib/color.ts +110 -0
- package/src/charts/lib/format.ts +42 -0
- package/src/charts/lib/frame.ts +6 -0
- package/src/charts/lib/layout.ts +78 -0
- package/src/charts/lib/path.ts +225 -0
- package/src/charts/lib/scale.ts +91 -0
- package/src/charts/lib/use-active.ts +87 -0
- package/src/charts/lib/use-size.ts +45 -0
- package/src/charts/line-chart.tsx +16 -0
- package/src/charts/radar-chart.tsx +485 -0
- package/src/charts/rose-chart.tsx +553 -0
- package/src/charts/sparkline.tsx +293 -0
- package/src/charts/tooltip.tsx +105 -0
- package/src/charts/treemap.tsx +271 -0
- package/src/charts/uptime-strip.tsx +469 -0
- package/src/components/accordion.tsx +136 -0
- package/src/components/activity-item.tsx +43 -0
- package/src/components/alert.tsx +135 -0
- package/src/components/assistant-answer.tsx +185 -0
- package/src/components/assistant-prompt.tsx +352 -0
- package/src/components/avatar.tsx +157 -0
- package/src/components/badge.tsx +55 -0
- package/src/components/bar-list.tsx +350 -0
- package/src/components/block-slider.tsx +189 -0
- package/src/components/branch-graph.tsx +580 -0
- package/src/components/breadcrumb.tsx +173 -0
- package/src/components/button.tsx +157 -0
- package/src/components/calendar.tsx +154 -0
- package/src/components/card.tsx +296 -0
- package/src/components/chat-attachment.tsx +255 -0
- package/src/components/chat-event.tsx +34 -0
- package/src/components/chat-message.tsx +332 -0
- package/src/components/chat-reference.tsx +100 -0
- package/src/components/chat-shared.ts +41 -0
- package/src/components/chat-suggestions.tsx +188 -0
- package/src/components/chat-thread.tsx +348 -0
- package/src/components/chat-typing.tsx +155 -0
- package/src/components/checkbox.tsx +83 -0
- package/src/components/checklist.tsx +146 -0
- package/src/components/chip.tsx +152 -0
- package/src/components/code-input.tsx +406 -0
- package/src/components/color-picker.tsx +1385 -0
- package/src/components/combobox.tsx +420 -0
- package/src/components/command-menu.tsx +405 -0
- package/src/components/copy-button.tsx +87 -0
- package/src/components/data-grid.tsx +965 -0
- package/src/components/date-picker.tsx +652 -0
- package/src/components/description-list.tsx +39 -0
- package/src/components/dialog.tsx +367 -0
- package/src/components/dock.tsx +192 -0
- package/src/components/drop-zone.tsx +283 -0
- package/src/components/dropdown-menu.tsx +323 -0
- package/src/components/editable-cell.tsx +219 -0
- package/src/components/empty-state.tsx +50 -0
- package/src/components/field.tsx +148 -0
- package/src/components/filter-condition.tsx +463 -0
- package/src/components/filter-menu.tsx +196 -0
- package/src/components/header-bar.tsx +220 -0
- package/src/components/hold-button.tsx +146 -0
- package/src/components/icon-tile.tsx +43 -0
- package/src/components/info-tip.tsx +87 -0
- package/src/components/input.tsx +136 -0
- package/src/components/kbd.tsx +17 -0
- package/src/components/menu-item.tsx +216 -0
- package/src/components/message-composer.tsx +458 -0
- package/src/components/nav-rail.tsx +235 -0
- package/src/components/notice.tsx +133 -0
- package/src/components/optimistic-undo.ts +68 -0
- package/src/components/option-row.tsx +54 -0
- package/src/components/page-content.tsx +44 -0
- package/src/components/pagination.tsx +182 -0
- package/src/components/popover.tsx +113 -0
- package/src/components/progress.tsx +222 -0
- package/src/components/radio-group.tsx +80 -0
- package/src/components/readonly-field.tsx +251 -0
- package/src/components/segmented-control.tsx +205 -0
- package/src/components/select.tsx +259 -0
- package/src/components/separator.tsx +30 -0
- package/src/components/setting-row.tsx +277 -0
- package/src/components/sidebar-switcher.tsx +134 -0
- package/src/components/sidebar.tsx +804 -0
- package/src/components/skeleton.tsx +57 -0
- package/src/components/slider.tsx +106 -0
- package/src/components/spinner.tsx +43 -0
- package/src/components/status-dot.tsx +100 -0
- package/src/components/stepper.tsx +459 -0
- package/src/components/switch.tsx +54 -0
- package/src/components/table-cell.tsx +239 -0
- package/src/components/table-context.ts +135 -0
- package/src/components/table-head.tsx +393 -0
- package/src/components/table-tree.tsx +357 -0
- package/src/components/table.tsx +295 -0
- package/src/components/tabs.tsx +191 -0
- package/src/components/textarea.tsx +44 -0
- package/src/components/theme.tsx +120 -0
- package/src/components/thinking.tsx +295 -0
- package/src/components/toast.tsx +308 -0
- package/src/components/toolbar.tsx +166 -0
- package/src/components/tooltip.tsx +84 -0
- package/src/components/top-nav.tsx +660 -0
- package/src/components/truncate.tsx +234 -0
- package/src/deprecated.ts +61 -0
- package/src/index.ts +184 -0
- package/src/lib/cn.ts +22 -0
- package/src/lib/color.ts +469 -0
- package/src/lib/contrast.ts +220 -0
- package/src/lib/create-theme.ts +659 -0
- package/src/lib/harmony.ts +609 -0
- package/src/lib/import-theme.ts +272 -0
- package/src/lib/overflow-scroll.tsx +108 -0
- package/src/lib/radio-toggle-render.tsx +15 -0
- package/src/lib/reorder.ts +222 -0
- package/src/lib/spacing.ts +189 -0
- package/src/lib/tailwind-palette.ts +355 -0
- package/src/lib/truncate.ts +79 -0
- package/src/lib/use-single-value.ts +23 -0
- package/src/styles/continuum.css +3 -0
- package/src/styles/theme.css +524 -0
- package/src/styles/tokens.css +647 -0
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Fragment, useId, useState } from 'react';
|
|
4
|
+
import { cn } from '../lib/cn.js';
|
|
5
|
+
import { chartColor, seriesColor } from './lib/color.js';
|
|
6
|
+
import { formatCompact, formatNumber } from './lib/format.js';
|
|
7
|
+
import { PLOT_FRAME } from './lib/frame.js';
|
|
8
|
+
import { niceTicks } from './lib/scale.js';
|
|
9
|
+
import { useWidth } from './lib/use-size.js';
|
|
10
|
+
import { ChartTooltip } from './tooltip.js';
|
|
11
|
+
/** The room under the plot for the x axis's values, and over it for the y axis's name. */
|
|
12
|
+
const BOTTOM = 20;
|
|
13
|
+
/** Nothing stands over the plot: the y axis is named in the plot's own corner. */
|
|
14
|
+
const TOP = 0;
|
|
15
|
+
/** The room between the plot's frame and its rules: none, the frame holds the data tight. */
|
|
16
|
+
const PAD = 0;
|
|
17
|
+
const EDGE = 1.5;
|
|
18
|
+
/** The smallest a bubble is drawn, however small its value, so it can still be pointed at. */
|
|
19
|
+
const LEAST = 3;
|
|
20
|
+
const LABEL_HEIGHT = 14;
|
|
21
|
+
/** The width of one character of an 11px label, near enough to keep two names apart. */
|
|
22
|
+
const CHAR = 6.2;
|
|
23
|
+
/** The round numbers of a measure read in powers of ten: 1, 2 and 5 of each. */
|
|
24
|
+
const ROUND = [1, 2, 5];
|
|
25
|
+
/**
|
|
26
|
+
* The domain of a measure read in powers of ten, from the round number under its least to the
|
|
27
|
+
* one over its most, and the rules across it: 1, 2 and 5 of each power while there is room
|
|
28
|
+
* for them, the powers alone when there is not.
|
|
29
|
+
*/
|
|
30
|
+
const logTicks = (low, high, most) => {
|
|
31
|
+
const rounds = (from, to) => {
|
|
32
|
+
const out = [];
|
|
33
|
+
for (let power = Math.floor(Math.log10(from)) - 1; power <= Math.ceil(Math.log10(to)) + 1; power++) {
|
|
34
|
+
for (const step of ROUND)
|
|
35
|
+
out.push(step * 10 ** power);
|
|
36
|
+
}
|
|
37
|
+
return out;
|
|
38
|
+
};
|
|
39
|
+
const all = rounds(low, high);
|
|
40
|
+
const min = [...all].reverse().find(value => value <= low * 1.0001) ?? low;
|
|
41
|
+
const max = all.find(value => value >= high / 1.0001) ?? high;
|
|
42
|
+
const inside = all.filter(value => value >= min / 1.0001 && value <= max * 1.0001);
|
|
43
|
+
const powers = inside.filter(value => Math.abs(Math.log10(value) - Math.round(Math.log10(value))) < 1e-9);
|
|
44
|
+
return {
|
|
45
|
+
values: inside.length <= most ? inside : powers,
|
|
46
|
+
min,
|
|
47
|
+
max: max > min ? max : min * 10,
|
|
48
|
+
log: true,
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
const scaleOf = (values, log, most) => {
|
|
52
|
+
const positive = values.filter(value => value > 0);
|
|
53
|
+
if (log && positive.length)
|
|
54
|
+
return logTicks(Math.min(...positive), Math.max(...positive), most);
|
|
55
|
+
return { ...niceTicks(0, Math.max(0, ...values), 4), log: false };
|
|
56
|
+
};
|
|
57
|
+
/** Where a value sits along `length`, the scale's floor at 0. */
|
|
58
|
+
const place = (value, scale, length) => {
|
|
59
|
+
if (scale.log) {
|
|
60
|
+
const span = Math.log10(scale.max / scale.min) || 1;
|
|
61
|
+
return (Math.log10(Math.max(value, scale.min) / scale.min) / span) * length;
|
|
62
|
+
}
|
|
63
|
+
return scale.max > scale.min ? ((value - scale.min) / (scale.max - scale.min)) * length : 0;
|
|
64
|
+
};
|
|
65
|
+
const overlaps = (a, b) => a.left < b.right && b.left < a.right && a.top < b.bottom && b.top < a.bottom;
|
|
66
|
+
/**
|
|
67
|
+
* Things that have three measures, as bubbles: one measure across, one up, and the third in
|
|
68
|
+
* each bubble's area, which grows as the value so a bubble twice the value is twice the ink.
|
|
69
|
+
* A fourth, a group, may colour them.
|
|
70
|
+
*
|
|
71
|
+
* The largest bubbles are drawn first, so a small one is never hidden under a large one, and
|
|
72
|
+
* the few largest have their names written beside them wherever a name fits clear of the
|
|
73
|
+
* others. The largest bubble's radius is taken from the room the plot has, so a phone draws
|
|
74
|
+
* smaller bubbles rather than a heap. Pointing at a bubble reads all of it out while the rest
|
|
75
|
+
* step back.
|
|
76
|
+
*/
|
|
77
|
+
export const BubbleChart = ({ 'aria-label': label, data: given, name: nameKey, x: xKey, y: yKey, size: sizeKey, group: groupKey, groups: givenGroups, xLabel = xKey, yLabel = yKey, sizeLabel = sizeKey, formatX = formatNumber, formatY = formatNumber, formatSize = formatNumber, xScale = 'linear', yScale = 'linear', labels = 3, sizeKey: showSizeKey = true, height = 340, fill = 'tint', loading = false, emptyLabel = 'Nothing to show yet', className, }) => {
|
|
78
|
+
const id = useId().replace(/[^a-zA-Z0-9_-]/g, '');
|
|
79
|
+
const [ref, width] = useWidth();
|
|
80
|
+
const [active, setActive] = useState(null);
|
|
81
|
+
// While it loads the chart draws its stand-in, and nothing of the old answer.
|
|
82
|
+
const data = loading ? [] : given;
|
|
83
|
+
const points = data
|
|
84
|
+
.map((row, index) => ({
|
|
85
|
+
index,
|
|
86
|
+
name: String(row[nameKey] ?? ''),
|
|
87
|
+
x: Number(row[xKey]) || 0,
|
|
88
|
+
y: Number(row[yKey]) || 0,
|
|
89
|
+
size: Math.max(0, Number(row[sizeKey]) || 0),
|
|
90
|
+
group: groupKey ? String(row[groupKey] ?? '') : '',
|
|
91
|
+
}))
|
|
92
|
+
.filter(point => Number.isFinite(point.x) && Number.isFinite(point.y));
|
|
93
|
+
const groups = givenGroups
|
|
94
|
+
? [...givenGroups]
|
|
95
|
+
: [...new Set(points.map(point => point.group))].map(key => ({ key }));
|
|
96
|
+
const colorOf = (group) => {
|
|
97
|
+
const index = groups.findIndex(item => item.key === group);
|
|
98
|
+
const item = groups[index];
|
|
99
|
+
return item?.color ?? (groupKey && index >= 0 ? seriesColor(index) : seriesColor(0));
|
|
100
|
+
};
|
|
101
|
+
const groupName = (group) => groups.find(item => item.key === group)?.name ?? group;
|
|
102
|
+
const xTick = formatX === formatNumber ? formatCompact : formatX;
|
|
103
|
+
const yTick = formatY === formatNumber ? formatCompact : formatY;
|
|
104
|
+
const plotHeight = Math.max(0, height - BOTTOM - TOP - PAD * 2);
|
|
105
|
+
// Where the plot starts, inside its frame.
|
|
106
|
+
const plotTop = TOP + PAD;
|
|
107
|
+
// A rule every 36px up at the closest, and every 72px across, where the values are wider.
|
|
108
|
+
const ys = scaleOf(points.map(point => point.y), yScale === 'log', Math.max(2, Math.floor(plotHeight / 36)));
|
|
109
|
+
// The y values' gutter, as wide as the widest of them; while loading, as wide as a short figure.
|
|
110
|
+
const gutter = loading
|
|
111
|
+
? SKELETON_GUTTER
|
|
112
|
+
: Math.ceil(Math.max(1, ...ys.values.map(tick => yTick(tick).length)) * CHAR) + 8 + PAD;
|
|
113
|
+
const plotWidth = Math.max(0, width - gutter - PAD);
|
|
114
|
+
const xs = scaleOf(points.map(point => point.x), xScale === 'log', Math.max(2, Math.floor(plotWidth / 72)));
|
|
115
|
+
const biggest = Math.max(0, ...points.map(point => point.size));
|
|
116
|
+
const empty = points.length === 0;
|
|
117
|
+
// The largest bubble takes a share of the plot's shorter side, within reason.
|
|
118
|
+
const most = Math.max(8, Math.min(36, Math.min(plotWidth, plotHeight) * 0.1));
|
|
119
|
+
const radiusOf = (value) => biggest > 0 ? Math.max(LEAST, Math.sqrt(value / biggest) * most) : LEAST;
|
|
120
|
+
// The plot keeps the largest bubble's radius clear at its top and right, and a small one's at
|
|
121
|
+
// its foot and left, and the frame's hairline clear of both, so a bubble at either end of a
|
|
122
|
+
// measure stays whole inside the frame rather than being cut by it.
|
|
123
|
+
const low = LEAST + 8;
|
|
124
|
+
const high = most + 8;
|
|
125
|
+
const xOf = (value) => gutter + low + place(value, xs, Math.max(0, plotWidth - low - high));
|
|
126
|
+
const yOf = (value) => plotTop + plotHeight - low - place(value, ys, Math.max(0, plotHeight - low - high));
|
|
127
|
+
const drawn = points
|
|
128
|
+
.map(point => ({ ...point, cx: xOf(point.x), cy: yOf(point.y), r: radiusOf(point.size) }))
|
|
129
|
+
// The largest first, so the small ones lie on top and stay in reach.
|
|
130
|
+
.sort((a, b) => b.r - a.r);
|
|
131
|
+
// Names beside the few largest, on whichever side has room clear of the names already placed.
|
|
132
|
+
const named = [];
|
|
133
|
+
const taken = [];
|
|
134
|
+
for (const point of drawn.slice(0, Math.max(0, labels))) {
|
|
135
|
+
const w = point.name.length * CHAR;
|
|
136
|
+
const h = LABEL_HEIGHT;
|
|
137
|
+
// Beside it first, then over and under it, then off its four shoulders.
|
|
138
|
+
const side = point.r + 4;
|
|
139
|
+
const shoulder = point.r * 0.72 + 3;
|
|
140
|
+
const tries = [
|
|
141
|
+
{ x: point.cx + side, y: point.cy, anchor: 'start', left: point.cx + side },
|
|
142
|
+
{ x: point.cx - side, y: point.cy, anchor: 'end', left: point.cx - side - w },
|
|
143
|
+
{
|
|
144
|
+
x: point.cx,
|
|
145
|
+
y: point.cy - point.r - 9,
|
|
146
|
+
anchor: 'middle',
|
|
147
|
+
left: point.cx - w / 2,
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
x: point.cx,
|
|
151
|
+
y: point.cy + point.r + 9,
|
|
152
|
+
anchor: 'middle',
|
|
153
|
+
left: point.cx - w / 2,
|
|
154
|
+
},
|
|
155
|
+
...[-1, 1].flatMap(up => [
|
|
156
|
+
{
|
|
157
|
+
x: point.cx + shoulder,
|
|
158
|
+
y: point.cy + up * (shoulder + 5),
|
|
159
|
+
anchor: 'start',
|
|
160
|
+
left: point.cx + shoulder,
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
x: point.cx - shoulder,
|
|
164
|
+
y: point.cy + up * (shoulder + 5),
|
|
165
|
+
anchor: 'end',
|
|
166
|
+
left: point.cx - shoulder - w,
|
|
167
|
+
},
|
|
168
|
+
]),
|
|
169
|
+
];
|
|
170
|
+
for (const attempt of tries) {
|
|
171
|
+
const box = {
|
|
172
|
+
left: attempt.left,
|
|
173
|
+
top: attempt.y - h / 2,
|
|
174
|
+
right: attempt.left + w,
|
|
175
|
+
bottom: attempt.y + h / 2,
|
|
176
|
+
};
|
|
177
|
+
const inside =
|
|
178
|
+
// A name stays inside the frame, clear of its line.
|
|
179
|
+
box.left >= gutter - PAD + 4 &&
|
|
180
|
+
box.right <= gutter + plotWidth + PAD - 4 &&
|
|
181
|
+
box.top >= TOP + 4 &&
|
|
182
|
+
box.bottom <= plotTop + plotHeight + PAD - 4;
|
|
183
|
+
// Clear of the other bubbles too, but for a sliver of their edge.
|
|
184
|
+
const onBubble = drawn.some(other => other !== point &&
|
|
185
|
+
Math.hypot(other.cx - Math.max(box.left, Math.min(other.cx, box.right)), other.cy - Math.max(box.top, Math.min(other.cy, box.bottom))) <
|
|
186
|
+
other.r - 1);
|
|
187
|
+
if (inside && !onBubble && !taken.some(other => overlaps(box, other))) {
|
|
188
|
+
taken.push(box);
|
|
189
|
+
named.push({
|
|
190
|
+
index: point.index,
|
|
191
|
+
x: attempt.x,
|
|
192
|
+
y: attempt.y,
|
|
193
|
+
anchor: attempt.anchor,
|
|
194
|
+
});
|
|
195
|
+
break;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
// The bubble under the pointer: the smallest one it is inside, else the nearest within reach.
|
|
200
|
+
const onPointerMove = (event) => {
|
|
201
|
+
const box = event.currentTarget.getBoundingClientRect();
|
|
202
|
+
const px = event.clientX - box.left;
|
|
203
|
+
const py = event.clientY - box.top;
|
|
204
|
+
let found = null;
|
|
205
|
+
let best = Number.POSITIVE_INFINITY;
|
|
206
|
+
for (const point of drawn) {
|
|
207
|
+
const distance = Math.hypot(point.cx - px, point.cy - py);
|
|
208
|
+
const reach = point.r + 6;
|
|
209
|
+
// Inside a bubble, a smaller one wins; outside every bubble, the nearest edge does.
|
|
210
|
+
const score = distance <= point.r ? point.r - 1000 : distance - point.r;
|
|
211
|
+
if (distance <= reach && score < best) {
|
|
212
|
+
best = score;
|
|
213
|
+
found = point.index;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
setActive(found);
|
|
217
|
+
};
|
|
218
|
+
const shown = active !== null ? drawn.find(point => point.index === active) : undefined;
|
|
219
|
+
const right = shown ? shown.cx < gutter + plotWidth / 2 : true;
|
|
220
|
+
// The key's circles: the round number under the largest value, then a tenth and a hundredth
|
|
221
|
+
// of it, for as long as the circle is still larger than the least a bubble is drawn.
|
|
222
|
+
const top = biggest > 0 ? 10 ** Math.floor(Math.log10(biggest)) : 0;
|
|
223
|
+
const keyTop = top > 0 ? ([5, 2, 1].map(step => step * top).find(value => value <= biggest) ?? top) : 0;
|
|
224
|
+
const keyValues = [keyTop / 100, keyTop / 10, keyTop].filter(value => value > 0 && radiusOf(value) > LEAST + 1);
|
|
225
|
+
// The size key stands inside the plot, in the first corner no bubble reaches; a plot with
|
|
226
|
+
// none free has it underneath instead.
|
|
227
|
+
const keyRadii = keyValues
|
|
228
|
+
.slice(-2)
|
|
229
|
+
.map(value => ({ r: radiusOf(value), text: formatSize(value) }));
|
|
230
|
+
const keyBox = sizeKeyBox(keyRadii);
|
|
231
|
+
const withKey = showSizeKey && !empty && keyRadii.length > 0 && width > 0;
|
|
232
|
+
const keyRight = gutter + plotWidth - 12 - keyBox.width;
|
|
233
|
+
const keyFoot = plotTop + plotHeight - 12 - keyBox.height;
|
|
234
|
+
const keyAt = [
|
|
235
|
+
{ x: keyRight, y: keyFoot },
|
|
236
|
+
{ x: gutter + 12, y: plotTop + 12 },
|
|
237
|
+
{ x: gutter + 12, y: keyFoot },
|
|
238
|
+
{ x: keyRight, y: plotTop + 12 },
|
|
239
|
+
].find(corner => keyBox.width < plotWidth / 2 &&
|
|
240
|
+
keyBox.height < plotHeight / 2 &&
|
|
241
|
+
drawn.every(point => {
|
|
242
|
+
const dx = point.cx - Math.max(corner.x, Math.min(point.cx, corner.x + keyBox.width));
|
|
243
|
+
const dy = point.cy - Math.max(corner.y, Math.min(point.cy, corner.y + keyBox.height));
|
|
244
|
+
return Math.hypot(dx, dy) > point.r + 8;
|
|
245
|
+
}));
|
|
246
|
+
const rows = (point) => [
|
|
247
|
+
...(groupKey
|
|
248
|
+
? [{ name: groupName(point.group), value: '', color: colorOf(point.group) }]
|
|
249
|
+
: []),
|
|
250
|
+
{ name: xLabel, value: formatX(point.x) },
|
|
251
|
+
{ name: yLabel, value: formatY(point.y) },
|
|
252
|
+
{ name: sizeLabel, value: formatSize(point.size) },
|
|
253
|
+
];
|
|
254
|
+
return (_jsxs("figure", { "aria-busy": loading || undefined, "aria-label": label, className: cn('relative m-0 min-w-0', className), "data-slot": "bubble-chart", children: [_jsxs("div", { className: "relative", ref: ref, style: { height }, children: [width > 0 && empty && !loading && (_jsx("p", { className: "absolute inset-0 flex items-center justify-center rounded-item border border-neutral-200 border-dashed text-neutral-600 text-xs", children: emptyLabel })), width > 0 && (!empty || loading) && (
|
|
255
|
+
// The plot's own place in the card: the bubbles and rules inside, the labels out.
|
|
256
|
+
_jsx("div", { "aria-hidden": true, className: PLOT_FRAME, "data-slot": "bubble-chart-plot", style: {
|
|
257
|
+
height: plotHeight + PAD * 2,
|
|
258
|
+
left: gutter - PAD,
|
|
259
|
+
top: TOP,
|
|
260
|
+
width: plotWidth + PAD * 2,
|
|
261
|
+
} })), width > 0 && loading && (_jsx(BubbleSkeleton, { gutter: gutter, height: plotHeight, most: most, names: Math.min(3, Math.max(0, labels)), top: plotTop, width: plotWidth, yLabel: yLabel })), width > 0 && !empty && (_jsxs("svg", { "aria-hidden": "true", className: "block overflow-visible", height: height, onPointerLeave: () => setActive(null), onPointerMove: onPointerMove, width: width, children: [_jsx("text", { className: "text-xxs", dominantBaseline: "middle", fill: "var(--color-chart-label)", x: gutter + 10, y: plotTop + 14, children: yLabel }), ys.values.map(tick => (_jsx("text", { className: "text-xxs tabular-nums", dominantBaseline: "middle", fill: "var(--color-chart-label)", textAnchor: "end", x: gutter - PAD - 8, y: yOf(tick), children: yTick(tick) }, `y-${tick}`))), xs.values.map((tick, i) => {
|
|
262
|
+
const last = i === xs.values.length - 1;
|
|
263
|
+
return (_jsx("text", { className: "text-xxs tabular-nums", fill: "var(--color-chart-label)", textAnchor: last ? 'end' : i === 0 ? 'start' : 'middle', x: xOf(tick), y: plotTop + plotHeight + PAD + 16, children: last ? `${xTick(tick)} ${xLabel.toLowerCase()}` : xTick(tick) }, `x-${tick}`));
|
|
264
|
+
}), _jsx("defs", { children: _jsx("clipPath", { id: `${id}-plot`, children: _jsx("rect", { height: plotHeight + PAD * 2, style: { rx: 'var(--radius-item)', ry: 'var(--radius-item)' }, width: plotWidth + PAD * 2, x: gutter - PAD, y: TOP }) }) }), _jsxs("g", { clipPath: `url(#${id}-plot)`, children: [ys.values
|
|
265
|
+
// A rule on the frame's own edge would only thicken it.
|
|
266
|
+
.filter(tick => Math.abs(yOf(tick) - plotTop) > 4 &&
|
|
267
|
+
Math.abs(yOf(tick) - plotTop - plotHeight) > 4)
|
|
268
|
+
.map(tick => (_jsx("line", { stroke: "var(--color-chart-grid)", x1: gutter, x2: gutter + plotWidth, y1: yOf(tick), y2: yOf(tick) }, `y-${tick}`))), xs.values
|
|
269
|
+
.filter(tick => Math.abs(xOf(tick) - gutter) > 4 &&
|
|
270
|
+
Math.abs(xOf(tick) - gutter - plotWidth) > 4)
|
|
271
|
+
.map(tick => (_jsx("line", { stroke: "var(--color-chart-grid)", x1: xOf(tick), x2: xOf(tick), y1: plotTop, y2: plotTop + plotHeight }, `x-${tick}`))), shown && (
|
|
272
|
+
// Two quiet rules from the bubble back to its axes, to read it off them.
|
|
273
|
+
_jsxs("g", { stroke: "var(--color-neutral-400)", strokeDasharray: "2 3", children: [_jsx("line", { x1: gutter, x2: shown.cx - shown.r, y1: shown.cy, y2: shown.cy }), _jsx("line", { x1: shown.cx, x2: shown.cx, y1: shown.cy + shown.r, y2: plotTop + plotHeight })] })), drawn.map(point => {
|
|
274
|
+
const color = chartColor(colorOf(point.group));
|
|
275
|
+
return (_jsx("circle", { className: "transition-opacity duration-150 motion-reduce:transition-none", cx: point.cx, cy: point.cy, fill: fill === 'solid'
|
|
276
|
+
? color
|
|
277
|
+
: `color-mix(in oklab, ${color} 20%, var(--color-chart-background))`, opacity: active === null || active === point.index ? 1 : 0.35, r: Math.max(0.5, point.r - EDGE / 2), stroke: fill === 'solid'
|
|
278
|
+
? 'var(--color-chart-background)'
|
|
279
|
+
: color, strokeWidth: fill === 'solid' ? 1 : EDGE }, point.index));
|
|
280
|
+
}), shown && (
|
|
281
|
+
// The one pointed at, again on top, so a bubble over it cannot hide it.
|
|
282
|
+
_jsx("circle", { cx: shown.cx, cy: shown.cy, fill: fill === 'solid'
|
|
283
|
+
? chartColor(colorOf(shown.group))
|
|
284
|
+
: `color-mix(in oklab, ${chartColor(colorOf(shown.group))} 20%, var(--color-chart-background))`, r: Math.max(0.5, shown.r - EDGE / 2), stroke: chartColor(colorOf(shown.group)), strokeWidth: 2 })), named.map(item => (_jsx("text", { className: "text-xxs transition-opacity duration-150 motion-reduce:transition-none", dominantBaseline: "middle", fill: "var(--color-neutral-600)", opacity: active === null || active === item.index ? 1 : 0.35, textAnchor: item.anchor, x: item.x, y: item.y, children: drawn.find(point => point.index === item.index)?.name }, item.index)))] })] })), withKey && keyAt && (_jsx(SizeKey, { label: sizeLabel, radii: keyRadii, style: { left: keyAt.x, position: 'absolute', top: keyAt.y } })), shown && (_jsx("div", { className: "pointer-events-none absolute z-10", style: {
|
|
285
|
+
left: right ? shown.cx + shown.r + 10 : undefined,
|
|
286
|
+
right: right ? undefined : width - shown.cx + shown.r + 10,
|
|
287
|
+
top: Math.max(0, Math.min(height - 132, shown.cy - 40)),
|
|
288
|
+
}, children: _jsx(ChartTooltip, { rows: rows(shown), title: shown.name }) }))] }), withKey && !keyAt && _jsx(SizeKey, { label: sizeLabel, radii: keyRadii }), _jsx("div", { className: "sr-only", children: _jsxs("table", { children: [_jsx("caption", { children: label }), _jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { scope: "col", children: nameKey }), groupKey && _jsx("th", { scope: "col", children: groupKey }), _jsx("th", { scope: "col", children: xLabel }), _jsx("th", { scope: "col", children: yLabel }), _jsx("th", { scope: "col", children: sizeLabel })] }) }), _jsx("tbody", { children: points.map(point => (_jsxs("tr", { children: [_jsx("th", { scope: "row", children: point.name }), groupKey && _jsx("td", { children: groupName(point.group) }), _jsx("td", { children: formatX(point.x) }), _jsx("td", { children: formatY(point.y) }), _jsx("td", { children: formatSize(point.size) })] }, point.index))) })] }) })] }));
|
|
289
|
+
};
|
|
290
|
+
/** The stand-in's y gutter: room for a figure of six characters, "10,000", as most axes need. */
|
|
291
|
+
const SKELETON_GUTTER = Math.ceil(6 * CHAR) + 8 + PAD;
|
|
292
|
+
/** Where the stand-in's rules sit up the plot, as shares of its height: three, as a loaded one has. */
|
|
293
|
+
const SKELETON_RULES = [0.25, 0.5, 0.75];
|
|
294
|
+
/** The room between the stand-in's rules across, near what the loaded axis keeps between its values. */
|
|
295
|
+
const SKELETON_STEP = 96;
|
|
296
|
+
/** The stand-in's values, as widths: figures up the side, and shorter counts along the foot. */
|
|
297
|
+
const SKELETON_FIGURES = [24, 32, 36];
|
|
298
|
+
const SKELETON_COUNTS = [12, 16, 20, 16];
|
|
299
|
+
/**
|
|
300
|
+
* The stand-in's bubbles, largest first, as shares of the plot (`x` across, `y` up) and of the
|
|
301
|
+
* largest radius: a loose climb from small at the foot to large at the top, as three measures of
|
|
302
|
+
* one thing tend to run together. The largest carry a name's width and the side it stands on.
|
|
303
|
+
*/
|
|
304
|
+
const SKELETON_BUBBLES = [
|
|
305
|
+
{ x: 0.9, y: 0.86, size: 1, name: { width: 52, side: 'end' } },
|
|
306
|
+
{ x: 0.66, y: 0.6, size: 0.8, name: { width: 40, side: 'start' } },
|
|
307
|
+
{ x: 0.44, y: 0.5, size: 0.6, name: { width: 44, side: 'end' } },
|
|
308
|
+
{ x: 0.58, y: 0.26, size: 0.44 },
|
|
309
|
+
{ x: 0.26, y: 0.36, size: 0.38 },
|
|
310
|
+
{ x: 0.14, y: 0.12, size: 0.28 },
|
|
311
|
+
{ x: 0.34, y: 0.1, size: 0.22 },
|
|
312
|
+
];
|
|
313
|
+
/** The stand-in's edges, a step stronger than its wash, as a bubble's edge is over its tint. */
|
|
314
|
+
const SKELETON_EDGE = 'color-mix(in oklab, var(--color-neutral-950) 14%, transparent)';
|
|
315
|
+
/** A circle's 1.5px edge alone, as a mask: the bubble's own edge over its tint. */
|
|
316
|
+
const SKELETON_RING = 'radial-gradient(closest-side, transparent calc(100% - 2px), black calc(100% - 1.25px))';
|
|
317
|
+
/**
|
|
318
|
+
* A bubble chart that is loading, with the depth of a loaded one: its frame and grid stay, its
|
|
319
|
+
* axis keeps its name, and bubbles of several sizes stand in the skeleton wash, each with its
|
|
320
|
+
* edge, spread as data spreads. Short bars stand where the axes' values and the largest names
|
|
321
|
+
* will. It takes the plot's room, so nothing moves when the data lands.
|
|
322
|
+
*/
|
|
323
|
+
const BubbleSkeleton = ({ gutter, top, width, height, most, names, yLabel, }) => {
|
|
324
|
+
if (width <= 0 || height <= 0)
|
|
325
|
+
return null;
|
|
326
|
+
// The same room at the plot's ends as the loaded chart keeps, so the bubbles stay whole.
|
|
327
|
+
const low = LEAST + 8;
|
|
328
|
+
const high = most + 8;
|
|
329
|
+
const bubbles = SKELETON_BUBBLES.map(item => ({
|
|
330
|
+
...item,
|
|
331
|
+
cx: gutter + low + item.x * Math.max(0, width - low - high),
|
|
332
|
+
cy: top + height - low - item.y * Math.max(0, height - low - high),
|
|
333
|
+
r: Math.max(LEAST, item.size * most),
|
|
334
|
+
}));
|
|
335
|
+
const across = Math.max(3, Math.round(width / SKELETON_STEP));
|
|
336
|
+
const columns = Array.from({ length: across }, (_, i) => (i + 1) / (across + 1));
|
|
337
|
+
return (_jsxs("div", { "aria-hidden": true, className: "absolute inset-0", "data-slot": "chart-skeleton", children: [_jsxs("svg", { "aria-hidden": "true", className: "absolute top-0 left-0 overflow-visible", height: top + height, width: gutter + width, children: [_jsx("text", { className: "text-xxs", dominantBaseline: "middle", fill: "var(--color-chart-label)", x: gutter + 10, y: top + 14, children: yLabel }), _jsxs("g", { stroke: "var(--color-chart-grid)", children: [SKELETON_RULES.map(share => (_jsx("line", { x1: gutter, x2: gutter + width, y1: Math.round(top + height * (1 - share)) + 0.5, y2: Math.round(top + height * (1 - share)) + 0.5 }, `y-${share}`))), columns.map(share => (_jsx("line", { x1: Math.round(gutter + width * share) + 0.5, x2: Math.round(gutter + width * share) + 0.5, y1: top, y2: top + height }, `x-${share}`)))] })] }), SKELETON_RULES.map((share, i) => {
|
|
338
|
+
const wide = SKELETON_FIGURES[i] ?? 24;
|
|
339
|
+
return (_jsx("div", { className: "skeleton absolute h-2 rounded-chip", style: {
|
|
340
|
+
left: gutter - 8 - wide,
|
|
341
|
+
top: top + height * (1 - share) - 4,
|
|
342
|
+
width: wide,
|
|
343
|
+
} }, share));
|
|
344
|
+
}), columns.map((share, i) => {
|
|
345
|
+
const wide = SKELETON_COUNTS[i % SKELETON_COUNTS.length] ?? 12;
|
|
346
|
+
return (_jsx("div", { className: "skeleton absolute h-2 rounded-chip", style: {
|
|
347
|
+
left: gutter + width * share - wide / 2,
|
|
348
|
+
top: top + height + 8,
|
|
349
|
+
width: wide,
|
|
350
|
+
} }, share));
|
|
351
|
+
}), bubbles.map(bubble => {
|
|
352
|
+
const place = {
|
|
353
|
+
height: bubble.r * 2,
|
|
354
|
+
left: bubble.cx - bubble.r,
|
|
355
|
+
top: bubble.cy - bubble.r,
|
|
356
|
+
width: bubble.r * 2,
|
|
357
|
+
};
|
|
358
|
+
return (_jsxs(Fragment, { children: [_jsx("div", { className: "absolute rounded-full", style: { ...place, backgroundColor: 'var(--color-chart-background)' } }), _jsx("div", { className: "skeleton absolute rounded-full", style: place }), _jsx("div", { className: "skeleton absolute rounded-full", style: {
|
|
359
|
+
...place,
|
|
360
|
+
backgroundColor: SKELETON_EDGE,
|
|
361
|
+
maskImage: SKELETON_RING,
|
|
362
|
+
} })] }, `${bubble.x}-${bubble.y}`));
|
|
363
|
+
}), bubbles.slice(0, names).map(bubble => bubble.name ? (_jsx("div", { className: "skeleton absolute h-2 rounded-chip", style: {
|
|
364
|
+
left: bubble.name.side === 'start'
|
|
365
|
+
? bubble.cx + bubble.r + 4
|
|
366
|
+
: bubble.cx - bubble.r - 4 - bubble.name.width,
|
|
367
|
+
top: bubble.cy - 4,
|
|
368
|
+
width: bubble.name.width,
|
|
369
|
+
} }, `${bubble.x}-${bubble.y}`)) : null)] }));
|
|
370
|
+
};
|
|
371
|
+
const KEY_LABEL = 16;
|
|
372
|
+
const KEY_TEXT = 56;
|
|
373
|
+
/** The room the size key takes: its title, the circles on one foot, and their values beside. */
|
|
374
|
+
const sizeKeyBox = (radii) => {
|
|
375
|
+
const largest = Math.max(0, ...radii.map(item => item.r));
|
|
376
|
+
return { width: largest * 2 + 12 + KEY_TEXT, height: KEY_LABEL + largest * 2 + 2 };
|
|
377
|
+
};
|
|
378
|
+
/**
|
|
379
|
+
* What a bubble's size reads as: the reference circles nested on one foot, as bubbles of
|
|
380
|
+
* those sizes would sit, each with a short leader from its top to its value, under the name
|
|
381
|
+
* of what the size measures. A note on the plot, so it stands in it.
|
|
382
|
+
*/
|
|
383
|
+
const SizeKey = ({ label, radii, style, }) => {
|
|
384
|
+
const largest = Math.max(...radii.map(item => item.r));
|
|
385
|
+
const box = sizeKeyBox(radii);
|
|
386
|
+
const foot = box.height - KEY_LABEL - 1;
|
|
387
|
+
const labelAt = largest * 2 + 12;
|
|
388
|
+
return (_jsxs("div", { className: cn('pointer-events-none flex flex-col text-neutral-600 text-xxs', !style && 'mt-3 items-end'), "data-slot": "bubble-chart-size-key", style: style, children: [_jsx("span", { className: "h-4 leading-4", children: label }), _jsx("svg", { "aria-hidden": "true", className: "overflow-visible", height: box.height - KEY_LABEL, width: box.width, children: radii.map(item => {
|
|
389
|
+
const top = foot - item.r * 2;
|
|
390
|
+
return (_jsxs("g", { children: [_jsx("circle", { cx: largest + 0.5, cy: foot - item.r, fill: "none", r: Math.max(0.5, item.r - 0.5), stroke: "var(--color-neutral-400)" }), _jsx("line", { stroke: "var(--color-neutral-400)", strokeDasharray: "2 2", x1: largest + 0.5, x2: labelAt - 4, y1: top + 0.5, y2: top + 0.5 }), _jsx("text", { className: "text-xxs tabular-nums", dominantBaseline: "middle", fill: "var(--color-chart-label)", x: labelAt, y: top + 1, children: item.text })] }, item.text));
|
|
391
|
+
}) })] }));
|
|
392
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type CSSProperties } from 'react';
|
|
2
|
+
import { type ChartColor } from './lib/color.js';
|
|
3
|
+
export type BulletRow = {
|
|
4
|
+
/** Keys the row; its name unless given. */
|
|
5
|
+
key?: string;
|
|
6
|
+
/** What is measured: "Revenue". */
|
|
7
|
+
name: string;
|
|
8
|
+
/** Where it stands. */
|
|
9
|
+
value: number;
|
|
10
|
+
/** What it is meant to reach, or for a lower-is-better measure stay under. */
|
|
11
|
+
target?: number;
|
|
12
|
+
/**
|
|
13
|
+
* Where each qualitative range ends, lowest first: `[300, 400, 500]` is poor to 300,
|
|
14
|
+
* fair to 400 and good to 500. The last one ends the scale unless `max` is given.
|
|
15
|
+
*/
|
|
16
|
+
ranges?: readonly number[];
|
|
17
|
+
/** Where the scale starts; zero unless given. */
|
|
18
|
+
min?: number;
|
|
19
|
+
/** Where the scale ends; the furthest of the ranges, the value and the target unless given. */
|
|
20
|
+
max?: number;
|
|
21
|
+
/**
|
|
22
|
+
* The measure is better the lower it is, as churn or a response time is: the ranges deepen
|
|
23
|
+
* towards the high end, and the target is met by staying at or under it.
|
|
24
|
+
*/
|
|
25
|
+
lowerIsBetter?: boolean;
|
|
26
|
+
/** Writes this row's figures; the chart's `formatValue` unless given. */
|
|
27
|
+
format?: (value: number) => string;
|
|
28
|
+
};
|
|
29
|
+
export type BulletChartProps = {
|
|
30
|
+
/** Says what the chart shows; it names the chart for a screen reader. */
|
|
31
|
+
'aria-label': string;
|
|
32
|
+
data: readonly BulletRow[];
|
|
33
|
+
/** Writes the figures of every row that has no `format` of its own. */
|
|
34
|
+
formatValue?: (value: number) => string;
|
|
35
|
+
/**
|
|
36
|
+
* `above` writes each row's name and figure over its line, for a narrow card; `beside`
|
|
37
|
+
* keeps the name to the left and the figure to the right, one line a row, for a wide one.
|
|
38
|
+
*/
|
|
39
|
+
layout?: 'above' | 'beside';
|
|
40
|
+
/** The measure's colour; the first series unless given. */
|
|
41
|
+
color?: ChartColor;
|
|
42
|
+
/**
|
|
43
|
+
* `solid` fills the measure; `tint` draws it as the kit's other tinted marks, a tint of its
|
|
44
|
+
* colour with a solid edge at its head.
|
|
45
|
+
*/
|
|
46
|
+
fill?: 'solid' | 'tint';
|
|
47
|
+
/** With no data, the rows are skeletons. */
|
|
48
|
+
loading?: boolean;
|
|
49
|
+
emptyLabel?: string;
|
|
50
|
+
className?: string;
|
|
51
|
+
style?: CSSProperties;
|
|
52
|
+
};
|
|
53
|
+
export declare const BulletChart: ({ "aria-label": label, data, formatValue, layout, color, fill, loading, emptyLabel, className, style, }: BulletChartProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { cn } from '../lib/cn.js';
|
|
5
|
+
import { chartColor } from './lib/color.js';
|
|
6
|
+
import { formatNumber } from './lib/format.js';
|
|
7
|
+
import { PLOT_FRAME } from './lib/frame.js';
|
|
8
|
+
/** The track the ranges are drawn in, and the measure inside it. */
|
|
9
|
+
const TRACK = 16;
|
|
10
|
+
const MEASURE = 6;
|
|
11
|
+
/** The stand-in rows while loading: names of a few lengths, and measures at varied reach. */
|
|
12
|
+
const SKELETON_NAMES = ['6rem', '8rem', '5rem', '7rem'];
|
|
13
|
+
const SKELETON_MEASURES = [0.72, 0.48, 0.86, 0.6];
|
|
14
|
+
/** The stand-in measure, a step firmer than the track's wash, as the measure is over its ranges. */
|
|
15
|
+
const SKELETON_EDGE = 'color-mix(in oklab, var(--color-neutral-950) 14%, transparent)';
|
|
16
|
+
/** The washes, lightest to deepest, as shares of the strongest ink over the surface. */
|
|
17
|
+
const WASHES = [6, 11, 17, 23];
|
|
18
|
+
const wash = (depth) => `color-mix(in oklab, var(--color-neutral-950) ${WASHES[Math.min(depth, WASHES.length - 1)]}%, transparent)`;
|
|
19
|
+
const scaleOf = (row) => {
|
|
20
|
+
const min = row.min ?? 0;
|
|
21
|
+
const max = row.max ??
|
|
22
|
+
Math.max(row.value, row.target ?? Number.NEGATIVE_INFINITY, ...(row.ranges ?? [min]));
|
|
23
|
+
return { min, max: max > min ? max : min + 1 };
|
|
24
|
+
};
|
|
25
|
+
/** Whether the row is at its target, on the side its direction calls good. */
|
|
26
|
+
const metOf = (row) => row.target === undefined
|
|
27
|
+
? undefined
|
|
28
|
+
: row.lowerIsBetter
|
|
29
|
+
? row.value <= row.target
|
|
30
|
+
: row.value >= row.target;
|
|
31
|
+
export const BulletChart = ({ 'aria-label': label, data, formatValue, layout = 'above', color = 'series-1', fill = 'solid', loading = false, emptyLabel = 'No data yet', className, style, }) => {
|
|
32
|
+
const [active, setActive] = useState(null);
|
|
33
|
+
const writeOf = (row) => row.format ?? formatValue ?? formatNumber;
|
|
34
|
+
const ink = chartColor(color);
|
|
35
|
+
const tinted = fill === 'tint';
|
|
36
|
+
const rows = loading ? [] : data;
|
|
37
|
+
if (loading) {
|
|
38
|
+
// The rows it was given, or three, laid out as the loaded rows are: the same lines, gaps
|
|
39
|
+
// and framed tracks, so nothing moves when the figures land.
|
|
40
|
+
const count = data.length || 3;
|
|
41
|
+
const name = (i) => (_jsx("span", { className: "flex h-(--text-xs--line-height) items-center", children: _jsx("span", { className: "skeleton h-2.5 rounded-chip", style: { width: SKELETON_NAMES[i % SKELETON_NAMES.length] } }) }));
|
|
42
|
+
const figures = (_jsx("span", { className: cn('flex items-center', layout === 'above' ? 'h-6' : 'h-(--text-xs--line-height) justify-end'), children: _jsx("span", { className: cn('skeleton rounded-chip', layout === 'above' ? 'h-3.5 w-20' : 'h-2.5 w-12') }) }));
|
|
43
|
+
const line = (i) => (_jsxs("div", { className: "relative min-w-0 shrink-0", style: { height: TRACK }, children: [_jsxs("div", { className: "absolute inset-0 overflow-hidden rounded-item", children: [_jsx("div", { className: "skeleton absolute inset-0" }), _jsx("div", { className: "skeleton absolute left-0", style: {
|
|
44
|
+
backgroundColor: SKELETON_EDGE,
|
|
45
|
+
borderRadius: `0 ${MEASURE / 2}px ${MEASURE / 2}px 0`,
|
|
46
|
+
height: MEASURE,
|
|
47
|
+
top: (TRACK - MEASURE) / 2,
|
|
48
|
+
width: `${(SKELETON_MEASURES[i % SKELETON_MEASURES.length] ?? 0.6) * 100}%`,
|
|
49
|
+
} })] }), _jsx("div", { "aria-hidden": true, className: cn(PLOT_FRAME, 'inset-0') })] }));
|
|
50
|
+
return (_jsx("figure", { "aria-busy": true, "aria-label": label, className: cn('m-0 w-full', layout === 'above'
|
|
51
|
+
? 'flex flex-col gap-7'
|
|
52
|
+
: 'grid grid-cols-[minmax(0,max-content)_minmax(0,1fr)_auto] gap-x-2 gap-y-3', className), "data-slot": "bullet-chart", style: style, children: Array.from({ length: count }, (_, i) => (_jsx("div", { "aria-hidden": true, className: layout === 'above'
|
|
53
|
+
? 'flex min-w-0 flex-col gap-2'
|
|
54
|
+
: 'col-span-3 grid grid-cols-subgrid items-center', "data-slot": "chart-skeleton", children: layout === 'above' ? (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flex min-w-0 items-baseline justify-between gap-3", children: [name(i), figures] }), line(i)] })) : (_jsxs(_Fragment, { children: [_jsx("div", { className: "flex min-w-0 max-w-40", children: name(i) }), line(i), figures] })) }, i))) }));
|
|
55
|
+
}
|
|
56
|
+
if (rows.length === 0) {
|
|
57
|
+
return (_jsx("figure", { "aria-label": label, className: cn('m-0 w-full', className), "data-slot": "bullet-chart", style: style, children: _jsx("p", { className: "flex h-32 items-center justify-center rounded-item border border-neutral-200 border-dashed text-neutral-600 text-xs", children: emptyLabel }) }));
|
|
58
|
+
}
|
|
59
|
+
return (_jsxs("figure", { "aria-label": label, className: cn('m-0 w-full',
|
|
60
|
+
// Beside, the rows share their columns, so every line starts and ends together.
|
|
61
|
+
layout === 'above'
|
|
62
|
+
? 'flex flex-col gap-7'
|
|
63
|
+
: // The names and figures keep 8px clear of each track's frame.
|
|
64
|
+
'grid grid-cols-[minmax(0,max-content)_minmax(0,1fr)_auto] gap-x-2 gap-y-3', className), "data-slot": "bullet-chart", onPointerLeave: () => setActive(null), style: style, children: [rows.map((row, index) => {
|
|
65
|
+
const write = writeOf(row);
|
|
66
|
+
const { min, max } = scaleOf(row);
|
|
67
|
+
const at = (value) => `${(Math.max(0, Math.min(1, (value - min) / (max - min))) * 100).toFixed(3)}%`;
|
|
68
|
+
const ranges = (row.ranges ?? []).filter(end => end > min);
|
|
69
|
+
const met = metOf(row);
|
|
70
|
+
const figure = write(row.value);
|
|
71
|
+
const goal = row.target === undefined
|
|
72
|
+
? undefined
|
|
73
|
+
: row.lowerIsBetter
|
|
74
|
+
? `target ≤ ${write(row.target)}`
|
|
75
|
+
: `of ${write(row.target)}`;
|
|
76
|
+
const valueText = [
|
|
77
|
+
figure,
|
|
78
|
+
goal,
|
|
79
|
+
met === undefined ? undefined : met ? 'on target' : 'short of target',
|
|
80
|
+
]
|
|
81
|
+
.filter(Boolean)
|
|
82
|
+
.join(', ');
|
|
83
|
+
const head = `min(var(--radius-item), ${MEASURE / 2}px)`;
|
|
84
|
+
const name = (_jsx("span", { className: "min-w-0 truncate text-neutral-600 text-xs", children: row.name }));
|
|
85
|
+
const figures = (_jsxs("span", { className: "flex shrink-0 items-baseline gap-1.5 whitespace-nowrap", children: [_jsx("span", { className: cn('font-medium text-neutral-950 tabular-nums',
|
|
86
|
+
// Above, the figure's own leading is kept tight, so the name and
|
|
87
|
+
// figure sit on their line rather than between two.
|
|
88
|
+
layout === 'above' ? 'text-lg leading-6' : 'text-xs'), children: figure }), goal && (_jsx("span", { className: "text-neutral-600 text-xxs tabular-nums", children: goal }))] }));
|
|
89
|
+
const line = (_jsxs("div", { className: "relative min-w-0 shrink-0", style: { height: TRACK }, children: [_jsxs("div", { className: "absolute inset-0 overflow-hidden rounded-item", children: [ranges.length === 0 ? (_jsx("div", { className: "absolute inset-0", style: { background: wash(0) } })) : (ranges.map((end, i) => {
|
|
90
|
+
const from = i === 0 ? min : (ranges[i - 1] ?? min);
|
|
91
|
+
const last = i === ranges.length - 1;
|
|
92
|
+
const depth = row.lowerIsBetter ? i : ranges.length - 1 - i;
|
|
93
|
+
return (_jsx("div", { className: "absolute inset-y-0", style: {
|
|
94
|
+
background: wash(depth),
|
|
95
|
+
left: at(from),
|
|
96
|
+
// The last range runs to the scale's end.
|
|
97
|
+
right: last ? 0 : undefined,
|
|
98
|
+
width: last
|
|
99
|
+
? undefined
|
|
100
|
+
: `calc(${at(end)} - ${at(from)})`,
|
|
101
|
+
} }, end));
|
|
102
|
+
})), _jsx("div", { className: "absolute left-0 motion-safe:animate-reveal", style: {
|
|
103
|
+
background: tinted
|
|
104
|
+
? `color-mix(in oklab, ${ink} 20%, transparent)`
|
|
105
|
+
: ink,
|
|
106
|
+
borderRadius: `0 ${head} ${head} 0`,
|
|
107
|
+
boxShadow: tinted ? `inset -2px 0 0 ${ink}` : undefined,
|
|
108
|
+
height: MEASURE,
|
|
109
|
+
top: (TRACK - MEASURE) / 2,
|
|
110
|
+
width: at(row.value),
|
|
111
|
+
} }), row.target !== undefined && (_jsx("div", { className: "absolute inset-y-0 w-0.5 -translate-x-1/2 bg-neutral-950", style: { left: at(row.target) } }))] }), _jsx("div", { "aria-hidden": true, className: cn(PLOT_FRAME, 'inset-0'), "data-slot": "chart-frame" })] }));
|
|
112
|
+
return (
|
|
113
|
+
// biome-ignore lint/a11y/useSemanticElements: a <meter> cannot hold the row's name, figures and ranges, so the row takes its role
|
|
114
|
+
_jsx("div", { "aria-label": row.name, "aria-valuemax": max, "aria-valuemin": min, "aria-valuenow": row.value, "aria-valuetext": valueText, className: cn('min-w-0 transition-opacity duration-150 motion-reduce:transition-none', layout === 'above'
|
|
115
|
+
? 'flex flex-col gap-2'
|
|
116
|
+
: 'col-span-3 grid grid-cols-subgrid items-center', active !== null && active !== index && 'opacity-35'), "data-slot": "bullet-row", onPointerEnter: () => setActive(index), role: "meter", children: layout === 'above' ? (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flex min-w-0 items-baseline justify-between gap-3", children: [name, figures] }), line] })) : (_jsxs(_Fragment, { children: [_jsx("div", { className: "flex min-w-0 max-w-40", children: name }), line, _jsx("div", { className: "flex justify-end", children: figures })] })) }, row.key ?? row.name));
|
|
117
|
+
}), _jsx("div", { className: "sr-only", children: _jsxs("table", { children: [_jsx("caption", { children: label }), _jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { scope: "col", children: "Measure" }), _jsx("th", { scope: "col", children: "Value" }), _jsx("th", { scope: "col", children: "Target" }), _jsx("th", { scope: "col", children: "Ranges" })] }) }), _jsx("tbody", { children: rows.map(row => {
|
|
118
|
+
const write = writeOf(row);
|
|
119
|
+
return (_jsxs("tr", { children: [_jsx("th", { scope: "row", children: row.name }), _jsx("td", { children: write(row.value) }), _jsx("td", { children: row.target === undefined
|
|
120
|
+
? '—'
|
|
121
|
+
: `${row.lowerIsBetter ? '≤ ' : ''}${write(row.target)}` }), _jsx("td", { children: (row.ranges ?? []).map(write).join(', ') })] }, row.key ?? row.name));
|
|
122
|
+
}) })] }) })] }));
|
|
123
|
+
};
|