rift-ds 1.41.0 → 1.43.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/README.md +2 -2
- package/behaviors/LoadingImage.d.ts +2 -0
- package/behaviors/LoadingImage.js +34 -0
- package/behaviors/ScrollRegion.js +15 -2
- package/behaviors/VisuallyHidden.d.ts +30 -0
- package/behaviors/VisuallyHidden.js +17 -0
- package/behaviors/loading-image.css +30 -0
- package/behaviors/quietFocus.d.ts +4 -0
- package/behaviors/quietFocus.js +14 -0
- package/behaviors/useFocusScope.d.ts +3 -1
- package/behaviors/useFocusScope.js +4 -6
- package/bin/rift-ds.mjs +2 -0
- package/bin/templates/app/components/rift/ColorModeScript.tsx +3 -1
- package/bin/templates/app/components/rift/RiftRoot.tsx +40 -1
- package/bin/templates/blocks/app/dashboard/page.module.css +2 -2
- package/bin/templates/blocks/app/dashboard/page.tsx +7 -5
- package/bin/templates/blocks/app/landing/page.tsx +1 -1
- package/bin/templates/blocks/app/notifications/Inbox.tsx +13 -45
- package/bin/templates/blocks/app/notifications/page.module.css +5 -0
- package/bin/templates/blocks/app/planner/page.tsx +2 -2
- package/bin/templates/blocks/app/pricing/page.module.css +15 -1
- package/bin/templates/blocks/app/pricing/page.tsx +8 -1
- package/bin/templates/blocks/app/settings/Settings.tsx +4 -4
- package/bin/templates/blocks/app/sign-in/page.tsx +10 -2
- package/bin/templates/blocks/app/sign-up/page.module.css +83 -0
- package/bin/templates/blocks/app/sign-up/page.tsx +126 -0
- package/bin/templates/blocks/app/starter/page.tsx +1 -1
- package/bin/templates/blocks/components/blocks/AppShell.module.css +0 -10
- package/bin/templates/blocks/components/blocks/AppShell.tsx +51 -132
- package/bin/templates/blocks/components/blocks/DocsShell.tsx +5 -1
- package/bin/templates/blocks/components/blocks/notifications.ts +77 -0
- package/bin/templates/blocks/registry.json +49 -6
- package/chat/ChatWidget.js +2 -1
- package/components/AgentPlan/AgentPlan.css +1 -1
- package/components/AlertDialog/AlertDialog.css +14 -0
- package/components/AlertDialog/AlertDialog.d.ts +35 -3
- package/components/AlertDialog/AlertDialog.js +16 -5
- package/components/AppLayout/AppLayout.css +6 -0
- package/components/AppLayout/AppLayout.d.ts +4 -0
- package/components/AppLayout/AppLayout.js +5 -1
- package/components/AppSidebar/AppSidebar.css +17 -2
- package/components/AppSidebar/AppSidebar.js +9 -2
- package/components/AppToolbar/AppToolbar.d.ts +5 -2
- package/components/AppToolbar/AppToolbar.js +3 -1
- package/components/Attachment/AttachmentGroup.js +2 -1
- package/components/Attachment/AttachmentTile.js +2 -1
- package/components/Badge/Badge.css +6 -0
- package/components/Breadcrumb/Breadcrumb.css +4 -1
- package/components/Button/Button.css +20 -1
- package/components/Button/Button.js +6 -1
- package/components/Card/Card.css +11 -0
- package/components/Card/Card.d.ts +9 -3
- package/components/Card/Card.js +21 -2
- package/components/Chart/AreaChart.d.ts +7 -0
- package/components/Chart/AreaChart.js +57 -45
- package/components/Chart/BarChart.d.ts +7 -0
- package/components/Chart/BarChart.js +52 -46
- package/components/Chart/Chart.css +134 -1
- package/components/Chart/ChartSkeleton.d.ts +32 -0
- package/components/Chart/ChartSkeleton.js +149 -0
- package/components/Chart/ComboChart.d.ts +7 -0
- package/components/Chart/ComboChart.js +80 -74
- package/components/Chart/LineChart.d.ts +17 -3
- package/components/Chart/LineChart.js +67 -39
- package/components/Chart/PieChart.d.ts +7 -0
- package/components/Chart/PieChart.js +41 -34
- package/components/Chart/RadarChart.d.ts +7 -0
- package/components/Chart/RadarChart.js +39 -32
- package/components/Chart/RadialChart.d.ts +7 -0
- package/components/Chart/RadialChart.js +5 -1
- package/components/Chart/ScatterChart.d.ts +7 -0
- package/components/Chart/ScatterChart.js +52 -40
- package/components/Chart/StackedBarChart.d.ts +10 -1
- package/components/Chart/StackedBarChart.js +57 -43
- package/components/Chart/Treemap.d.ts +7 -0
- package/components/Chart/Treemap.js +17 -11
- package/components/ChatMessage/ChatMessage.css +6 -0
- package/components/Checkbox/Checkbox.css +25 -1
- package/components/Checkbox/Checkbox.d.ts +8 -4
- package/components/Checkbox/Checkbox.js +17 -8
- package/components/Chip/Chip.css +5 -3
- package/components/ContactCard/ContactCard.css +4 -3
- package/components/ContributionGraph/ContributionGraph.css +20 -0
- package/components/ContributionGraph/ContributionGraph.d.ts +4 -0
- package/components/ContributionGraph/ContributionGraph.js +11 -6
- package/components/DataTable/DataTable.css +34 -4
- package/components/DataTable/DataTable.d.ts +16 -2
- package/components/DataTable/DataTable.js +8 -2
- package/components/DateInput/DateInput.css +3 -1
- package/components/DatePicker/DatePicker.css +16 -0
- package/components/DatePicker/DatePicker.d.ts +13 -0
- package/components/DatePicker/DatePicker.js +21 -27
- package/components/DatePicker/MonthGrid.d.ts +2 -2
- package/components/DatePicker/MonthGrid.js +1 -1
- package/components/DatePicker/today.d.ts +15 -0
- package/components/DatePicker/today.js +17 -0
- package/components/DateRangePicker/DateRangePicker.d.ts +14 -1
- package/components/DateRangePicker/DateRangePicker.js +18 -7
- package/components/DescriptionList/DescriptionList.css +11 -0
- package/components/DescriptionList/DescriptionList.d.ts +5 -1
- package/components/DescriptionList/DescriptionList.js +21 -6
- package/components/Dialog/Dialog.css +9 -0
- package/components/Dialog/Dialog.d.ts +9 -0
- package/components/Dialog/Dialog.js +32 -19
- package/components/DocumentChip/DocumentChip.css +1 -1
- package/components/Drawer/Drawer.d.ts +9 -0
- package/components/Drawer/Drawer.js +8 -0
- package/components/Dropdown/Dropdown.css +3 -1
- package/components/Dropdown/Dropdown.js +8 -0
- package/components/EmptyState/EmptyState.css +8 -1
- package/components/EventCalendar/EventCalendar.css +12 -0
- package/components/Field/Field.css +2 -2
- package/components/FileInput/FileInput.css +1 -1
- package/components/FilterBar/FilterBar.d.ts +6 -1
- package/components/FunnelChart/FunnelChart.d.ts +7 -0
- package/components/FunnelChart/FunnelChart.js +44 -30
- package/components/GanttChart/GanttChart.css +10 -0
- package/components/GanttChart/GanttChart.d.ts +4 -0
- package/components/GanttChart/GanttChart.js +66 -33
- package/components/Gauge/Gauge.css +23 -0
- package/components/Gauge/Gauge.d.ts +4 -0
- package/components/Gauge/Gauge.js +14 -8
- package/components/ImageCompare/ImageCompare.js +2 -1
- package/components/Input/Input.css +15 -1
- package/components/Inspector/Inspector.css +4 -1
- package/components/List/List.css +1 -1
- package/components/NotificationCenter/NotificationCenter.css +152 -27
- package/components/NotificationCenter/NotificationCenter.d.ts +71 -8
- package/components/NotificationCenter/NotificationCenter.js +120 -13
- package/components/NumberInput/NumberInput.css +2 -0
- package/components/PageHeader/PageHeader.css +12 -4
- package/components/Panel/Panel.d.ts +1 -1
- package/components/Popover/Popover.css +3 -0
- package/components/Popover/Popover.d.ts +1 -1
- package/components/Popover/Popover.js +9 -1
- package/components/Prose/Prose.css +1 -1
- package/components/QuestionCard/QuestionCard.css +7 -4
- package/components/RadioButton/RadioButton.css +1 -1
- package/components/RadioButton/RadioButton.d.ts +4 -2
- package/components/RadioButton/RadioButton.js +5 -2
- package/components/ResourceTimeline/ResourceTimeline.css +12 -0
- package/components/ResourceTimeline/ResourceTimeline.d.ts +5 -1
- package/components/ResourceTimeline/ResourceTimeline.js +94 -52
- package/components/RichDropdown/RichDropdown.css +3 -1
- package/components/SegmentedControl/SegmentedControl.css +5 -0
- package/components/SelectionCard/SelectionCard.css +29 -0
- package/components/SelectionCard/SelectionCard.d.ts +7 -0
- package/components/SelectionCard/SelectionCard.js +25 -2
- package/components/Sparkline/Sparkline.css +20 -0
- package/components/Sparkline/Sparkline.d.ts +4 -0
- package/components/Sparkline/Sparkline.js +14 -8
- package/components/Stat/Stat.css +39 -0
- package/components/Stat/Stat.d.ts +23 -2
- package/components/Stat/Stat.js +21 -6
- package/components/Table/Table.css +106 -16
- package/components/Table/Table.d.ts +4 -0
- package/components/Table/Table.js +43 -28
- package/components/Textarea/Textarea.css +4 -2
- package/components/ThemeToggle/colorMode.d.ts +13 -5
- package/components/ThemeToggle/colorMode.js +4 -2
- package/components/ThreadHistory/ThreadHistory.css +11 -0
- package/components/ThreadHistory/ThreadHistory.d.ts +5 -1
- package/components/ThreadHistory/ThreadHistory.js +6 -1
- package/components/ThreadPanel/ThreadPanel.d.ts +4 -0
- package/components/ThreadPanel/ThreadPanel.js +5 -1
- package/components/TimePicker/TimePicker.css +3 -1
- package/components/TimePicker/TimePicker.d.ts +4 -2
- package/components/TimePicker/TimePicker.js +11 -3
- package/components/Timeline/Timeline.css +15 -0
- package/components/Timeline/Timeline.d.ts +8 -0
- package/components/Timeline/Timeline.js +21 -0
- package/components/Toast/Toast.css +16 -0
- package/components/Toast/Toast.d.ts +7 -2
- package/components/ToggleGroup/ToggleGroup.css +28 -2
- package/components/ToggleSwitch/ToggleSwitch.css +1 -1
- package/components/Toolbar/Toolbar.d.ts +6 -1
- package/components/Tooltip/Tooltip.d.ts +9 -0
- package/components/Tooltip/Tooltip.js +34 -8
- package/components/TreeView/TreeView.css +12 -0
- package/components/TreeView/TreeView.d.ts +4 -0
- package/components/TreeView/TreeView.js +20 -0
- package/components/UsageCard/UsageCard.css +11 -0
- package/components/UsageCard/UsageCard.d.ts +4 -0
- package/components/UsageCard/UsageCard.js +25 -16
- package/components/Widget/Widget.css +7 -0
- package/components/Widget/Widget.d.ts +4 -0
- package/components/Widget/Widget.js +14 -2
- package/components/Wizard/Wizard.d.ts +8 -3
- package/components/Wizard/Wizard.js +4 -1
- package/components/registry.json +15 -6
- package/components/registry.json.d.ts +15 -6
- package/components/registry.json.js +1 -1
- package/package.json +7 -2
- package/tokens/presets/contrast.css +4 -4
- package/tokens/presets/coral.css +3 -4
- package/tokens/presets/forest.css +16 -4
- package/tokens/presets/gold.css +4 -3
- package/tokens/presets/marquee.css +2 -3
- package/tokens/presets/mono.css +28 -28
- package/tokens/presets/pink.css +5 -4
- package/tokens/presets/terminal.css +4 -3
- package/tokens/presets/violet.css +3 -4
- package/tokens/presets/warm.css +16 -4
- package/tokens/presets/zest.css +11 -13
- package/tokens/registry.json +1 -0
- package/tokens/registry.json.d.ts +1 -0
- package/tokens/registry.json.js +1 -1
- package/tokens/tokens-dark.css +4 -0
- package/tokens/tokens-light.css +4 -0
- package/tokens/values.d.ts +24 -4
- package/tokens/values.js +25 -6
- package/tokens/values.json.js +1 -1
package/components/Card/Card.js
CHANGED
|
@@ -4,6 +4,7 @@ import React from "react";
|
|
|
4
4
|
import { useLinkComponent } from "../../behaviors/LinkProvider.js";
|
|
5
5
|
import "./Card.css";
|
|
6
6
|
import "../../fonts/material-symbols.css";
|
|
7
|
+
import { LoadingImage } from "../../behaviors/LoadingImage.js";
|
|
7
8
|
const Card = React.forwardRef(
|
|
8
9
|
({
|
|
9
10
|
variant = "default",
|
|
@@ -28,7 +29,7 @@ const Card = React.forwardRef(
|
|
|
28
29
|
if (variant === "case-study") {
|
|
29
30
|
const inner = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
30
31
|
/* @__PURE__ */ jsx("div", { className: "ds-card--case-study__cover-wrap", children: cover ? /* @__PURE__ */ jsx("div", { className: "ds-card--case-study__cover-slot", children: cover }) : coverSrc ? /* @__PURE__ */ jsx(
|
|
31
|
-
|
|
32
|
+
LoadingImage,
|
|
32
33
|
{
|
|
33
34
|
src: coverSrc,
|
|
34
35
|
alt: coverAlt ?? `${title} cover`,
|
|
@@ -55,6 +56,8 @@ const Card = React.forwardRef(
|
|
|
55
56
|
"ds-card",
|
|
56
57
|
"ds-card--case-study",
|
|
57
58
|
placeholder ? "ds-card--case-study--placeholder" : "",
|
|
59
|
+
// A card that goes nowhere stays still under the pointer.
|
|
60
|
+
!placeholder && !href ? "ds-card--case-study--static" : "",
|
|
58
61
|
className
|
|
59
62
|
].filter(Boolean).join(" ");
|
|
60
63
|
if (placeholder || !href) {
|
|
@@ -82,7 +85,23 @@ const Card = React.forwardRef(
|
|
|
82
85
|
);
|
|
83
86
|
}
|
|
84
87
|
const baseClass = "ds-card";
|
|
85
|
-
const classes = [baseClass, interactive ? `${baseClass}--interactive` : "", className].filter(Boolean).join(" ");
|
|
88
|
+
const classes = [baseClass, interactive || href ? `${baseClass}--interactive` : "", className].filter(Boolean).join(" ");
|
|
89
|
+
if (href) {
|
|
90
|
+
return /* @__PURE__ */ jsxs(
|
|
91
|
+
Link,
|
|
92
|
+
{
|
|
93
|
+
...rest,
|
|
94
|
+
ref,
|
|
95
|
+
href,
|
|
96
|
+
className: classes,
|
|
97
|
+
onClick,
|
|
98
|
+
children: [
|
|
99
|
+
/* @__PURE__ */ jsx("div", { className: `${baseClass}__preview`, children }),
|
|
100
|
+
/* @__PURE__ */ jsx("h3", { className: `${baseClass}__title`, children: title })
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
);
|
|
104
|
+
}
|
|
86
105
|
const handleKeyDown = (e) => {
|
|
87
106
|
onKeyDown?.(e);
|
|
88
107
|
if (!interactive) return;
|
|
@@ -45,6 +45,13 @@ type AreaChartOwnProps = {
|
|
|
45
45
|
* neither is on the plot. For a headline figure that follows the cursor.
|
|
46
46
|
*/
|
|
47
47
|
onActiveChange?: ChartActiveHandler;
|
|
48
|
+
/**
|
|
49
|
+
* Holds the chart's placeholder, the outline of this chart type, in place of the chart while its data is still being fetched.
|
|
50
|
+
* Before its first draw the chart shows the same placeholder by itself, so this is only for a wait the host knows about.
|
|
51
|
+
*/
|
|
52
|
+
loading?: boolean;
|
|
53
|
+
/** Accessible name announced while `loading`. */
|
|
54
|
+
loadingLabel?: string;
|
|
48
55
|
/** Additional CSS classes on the wrapper */
|
|
49
56
|
className?: string;
|
|
50
57
|
};
|
|
@@ -5,6 +5,7 @@ import { ResponsiveContainer, AreaChart as AreaChart$1, CartesianGrid, XAxis, YA
|
|
|
5
5
|
import { ActiveReporter } from "./ActiveReporter.js";
|
|
6
6
|
import { readTokenPx, getChartSeriesColors } from "./palette.js";
|
|
7
7
|
import { useChartAnimation } from "./useChartAnimation.js";
|
|
8
|
+
import { ChartSkeleton } from "./ChartSkeleton.js";
|
|
8
9
|
import "./Chart.css";
|
|
9
10
|
import { useLocale } from "../../behaviors/LocaleProvider.js";
|
|
10
11
|
import { formatAxisNumber, formatNumber } from "../../behaviors/locale.js";
|
|
@@ -33,6 +34,8 @@ const AreaChart = React.forwardRef(({
|
|
|
33
34
|
height = 350,
|
|
34
35
|
showLegend = true,
|
|
35
36
|
bare = false,
|
|
37
|
+
loading = false,
|
|
38
|
+
loadingLabel = "Loading chart",
|
|
36
39
|
className = "",
|
|
37
40
|
onActiveChange,
|
|
38
41
|
yAxisFormatter,
|
|
@@ -81,51 +84,60 @@ const AreaChart = React.forwardRef(({
|
|
|
81
84
|
/* @__PURE__ */ jsx("span", { className: `${baseClass}__summary-value`, children: typeof item.value === "number" ? formatNumber(item.value, locale) : item.value })
|
|
82
85
|
] }, i)) })
|
|
83
86
|
] }),
|
|
84
|
-
/* @__PURE__ */
|
|
85
|
-
/* @__PURE__ */ jsx(
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
/* @__PURE__ */
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
87
|
+
/* @__PURE__ */ jsxs("div", { className: `${baseClass}__body`, children: [
|
|
88
|
+
/* @__PURE__ */ jsx(ChartSkeleton, { shape: "area", height, loading, loadingLabel }),
|
|
89
|
+
!loading && /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxs(AreaChart$1, { data, margin: { top: 8, right: 4, bottom: 0, left: -12 }, children: [
|
|
90
|
+
/* @__PURE__ */ jsx("defs", { children: series.map((s, i) => {
|
|
91
|
+
const color = s.color || seriesColors[i % seriesColors.length];
|
|
92
|
+
return /* @__PURE__ */ jsxs("linearGradient", { id: `area-gradient-${s.dataKey}`, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
93
|
+
/* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: color, stopOpacity: 0.4 }),
|
|
94
|
+
/* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: color, stopOpacity: 0.05 })
|
|
95
|
+
] }, `grad-${s.dataKey}`);
|
|
96
|
+
}) }),
|
|
97
|
+
/* @__PURE__ */ jsx(CartesianGrid, { vertical: false, stroke: gridColor }),
|
|
98
|
+
/* @__PURE__ */ jsx(
|
|
99
|
+
XAxis,
|
|
100
|
+
{
|
|
101
|
+
dataKey: xKey,
|
|
102
|
+
tick: { fill: textSecondary, fontSize: textSize },
|
|
103
|
+
tickLine: false,
|
|
104
|
+
axisLine: { stroke: gridColor }
|
|
105
|
+
}
|
|
106
|
+
),
|
|
107
|
+
/* @__PURE__ */ jsx(
|
|
108
|
+
YAxis,
|
|
109
|
+
{
|
|
110
|
+
tickFormatter: yAxisFormatter ?? formatTick,
|
|
111
|
+
tick: { fill: textSecondary, fontSize: textSize },
|
|
112
|
+
tickLine: false,
|
|
113
|
+
axisLine: false
|
|
114
|
+
}
|
|
115
|
+
),
|
|
116
|
+
/* @__PURE__ */ jsx(Tooltip, { content: renderTooltip }),
|
|
117
|
+
series.map((s, i) => /* @__PURE__ */ jsx(
|
|
118
|
+
Area,
|
|
119
|
+
{
|
|
120
|
+
...animation,
|
|
121
|
+
type: "monotone",
|
|
122
|
+
dataKey: s.dataKey,
|
|
123
|
+
name: s.label,
|
|
124
|
+
stroke: s.color || seriesColors[i % seriesColors.length],
|
|
125
|
+
strokeWidth: 2,
|
|
126
|
+
fill: `url(#area-gradient-${s.dataKey})`,
|
|
127
|
+
fillOpacity: s.fillOpacity ?? 1,
|
|
128
|
+
stackId: stacked ? "stack" : void 0
|
|
129
|
+
},
|
|
130
|
+
s.dataKey
|
|
131
|
+
)),
|
|
132
|
+
showLegend && series.length > 1 && /* @__PURE__ */ jsx(
|
|
133
|
+
Legend,
|
|
134
|
+
{
|
|
135
|
+
wrapperStyle: { color: textSecondary, fontSize: textSize },
|
|
136
|
+
formatter: (value) => /* @__PURE__ */ jsx("span", { style: { color: textSecondary }, children: value })
|
|
137
|
+
}
|
|
138
|
+
)
|
|
139
|
+
] }) })
|
|
140
|
+
] })
|
|
129
141
|
]
|
|
130
142
|
}
|
|
131
143
|
);
|
|
@@ -46,6 +46,13 @@ type BarChartOwnProps = {
|
|
|
46
46
|
* neither is on the plot. For a headline figure that follows the cursor.
|
|
47
47
|
*/
|
|
48
48
|
onActiveChange?: ChartActiveHandler;
|
|
49
|
+
/**
|
|
50
|
+
* Holds the chart's placeholder, the outline of this chart type, in place of the chart while its data is still being fetched.
|
|
51
|
+
* Before its first draw the chart shows the same placeholder by itself, so this is only for a wait the host knows about.
|
|
52
|
+
*/
|
|
53
|
+
loading?: boolean;
|
|
54
|
+
/** Accessible name announced while `loading`. */
|
|
55
|
+
loadingLabel?: string;
|
|
49
56
|
/** Additional CSS classes on the wrapper */
|
|
50
57
|
className?: string;
|
|
51
58
|
};
|
|
@@ -3,6 +3,7 @@ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import React, { useCallback, useId } from "react";
|
|
4
4
|
import { ResponsiveContainer, BarChart as BarChart$1, CartesianGrid, XAxis, YAxis, Tooltip, Bar } from "recharts";
|
|
5
5
|
import { useChartAnimation } from "./useChartAnimation.js";
|
|
6
|
+
import { ChartSkeleton } from "./ChartSkeleton.js";
|
|
6
7
|
import "./Chart.css";
|
|
7
8
|
import { ActiveReporter } from "./ActiveReporter.js";
|
|
8
9
|
import { readTokenPx } from "./palette.js";
|
|
@@ -40,6 +41,8 @@ const BarChart = React.forwardRef(({
|
|
|
40
41
|
barColor,
|
|
41
42
|
height = 350,
|
|
42
43
|
bare = false,
|
|
44
|
+
loading = false,
|
|
45
|
+
loadingLabel = "Loading chart",
|
|
43
46
|
className = "",
|
|
44
47
|
onActiveChange,
|
|
45
48
|
yAxisFormatter,
|
|
@@ -89,52 +92,55 @@ const BarChart = React.forwardRef(({
|
|
|
89
92
|
/* @__PURE__ */ jsx("span", { className: `${baseClass}__summary-value`, children: typeof item.value === "number" ? formatNumber(item.value, locale) : item.value })
|
|
90
93
|
] }, i)) })
|
|
91
94
|
] }),
|
|
92
|
-
/* @__PURE__ */
|
|
93
|
-
/* @__PURE__ */ jsx(
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
95
|
+
/* @__PURE__ */ jsxs("div", { className: `${baseClass}__body`, children: [
|
|
96
|
+
/* @__PURE__ */ jsx(ChartSkeleton, { shape: "bar", height, loading, loadingLabel }),
|
|
97
|
+
!loading && /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxs(BarChart$1, { data, margin: { top: 8, right: 4, bottom: 0, left: -12 }, children: [
|
|
98
|
+
/* @__PURE__ */ jsx(
|
|
99
|
+
CartesianGrid,
|
|
100
|
+
{
|
|
101
|
+
vertical: false,
|
|
102
|
+
stroke: gridColor,
|
|
103
|
+
strokeDasharray: ""
|
|
104
|
+
}
|
|
105
|
+
),
|
|
106
|
+
/* @__PURE__ */ jsx(
|
|
107
|
+
XAxis,
|
|
108
|
+
{
|
|
109
|
+
dataKey: xKey,
|
|
110
|
+
tick: { fill: textSecondary, fontSize: textSize },
|
|
111
|
+
tickLine: false,
|
|
112
|
+
axisLine: { stroke: gridColor }
|
|
113
|
+
}
|
|
114
|
+
),
|
|
115
|
+
/* @__PURE__ */ jsx(
|
|
116
|
+
YAxis,
|
|
117
|
+
{
|
|
118
|
+
tickFormatter: yAxisFormatter ?? formatTick,
|
|
119
|
+
tick: { fill: textSecondary, fontSize: textSize },
|
|
120
|
+
tickLine: false,
|
|
121
|
+
axisLine: false
|
|
122
|
+
}
|
|
123
|
+
),
|
|
124
|
+
/* @__PURE__ */ jsx(
|
|
125
|
+
Tooltip,
|
|
126
|
+
{
|
|
127
|
+
content: renderTooltip,
|
|
128
|
+
cursor: { fill: cursorColor, opacity: 0.4 }
|
|
129
|
+
}
|
|
130
|
+
),
|
|
131
|
+
/* @__PURE__ */ jsx(
|
|
132
|
+
Bar,
|
|
133
|
+
{
|
|
134
|
+
...animation,
|
|
135
|
+
className: `${baseClass}__bar`,
|
|
136
|
+
dataKey: yKey,
|
|
137
|
+
fill: resolvedBarColor,
|
|
138
|
+
radius: [3, 3, 0, 0],
|
|
139
|
+
maxBarSize: 32
|
|
140
|
+
}
|
|
141
|
+
)
|
|
142
|
+
] }) })
|
|
143
|
+
] })
|
|
138
144
|
]
|
|
139
145
|
}
|
|
140
146
|
);
|
|
@@ -19,7 +19,9 @@
|
|
|
19
19
|
width: 100%;
|
|
20
20
|
padding: var(--padding-500); /* 24px */
|
|
21
21
|
border: var(--border-025) solid var(--color-bg-container-border);
|
|
22
|
-
|
|
22
|
+
/* The content-card corner, Panel's and Widget's, so a chart beside a
|
|
23
|
+
panel or a table reads as one family of surfaces. */
|
|
24
|
+
border-radius: var(--radius-600); /* 24px */
|
|
23
25
|
background-color: var(--color-bg-container-primary);
|
|
24
26
|
}
|
|
25
27
|
|
|
@@ -85,6 +87,21 @@
|
|
|
85
87
|
color: var(--color-text-secondary);
|
|
86
88
|
}
|
|
87
89
|
|
|
90
|
+
/* A summary figure keyed to a series: the tooltip's dot, in that series'
|
|
91
|
+
colour, ahead of the label. */
|
|
92
|
+
.ds-chart__summary-label:has(.ds-chart__summary-swatch) {
|
|
93
|
+
display: inline-flex;
|
|
94
|
+
align-items: center;
|
|
95
|
+
gap: var(--gap-100);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.ds-chart__summary-swatch {
|
|
99
|
+
width: 8px;
|
|
100
|
+
height: 8px;
|
|
101
|
+
border-radius: var(--radius-pill);
|
|
102
|
+
flex-shrink: 0;
|
|
103
|
+
}
|
|
104
|
+
|
|
88
105
|
.ds-chart__summary-value {
|
|
89
106
|
font-family: var(--font-heading-1-family);
|
|
90
107
|
font-size: var(--font-heading-1-size);
|
|
@@ -110,6 +127,110 @@
|
|
|
110
127
|
fill-opacity: 0.45;
|
|
111
128
|
}
|
|
112
129
|
|
|
130
|
+
/* ============================================
|
|
131
|
+
SKELETON — the outline of the chart type,
|
|
132
|
+
drawn in the body until the marks exist.
|
|
133
|
+
recharts draws nothing before it has measured
|
|
134
|
+
its container in the browser, so the server
|
|
135
|
+
markup carries this instead of an empty box;
|
|
136
|
+
it leaves the moment recharts mounts its
|
|
137
|
+
wrapper. With `loading` it holds the body
|
|
138
|
+
(ChartSkeleton.tsx).
|
|
139
|
+
============================================ */
|
|
140
|
+
|
|
141
|
+
.ds-chart__skeleton {
|
|
142
|
+
position: absolute;
|
|
143
|
+
inset: 0;
|
|
144
|
+
pointer-events: none;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.ds-chart__body:has(.recharts-wrapper) > .ds-chart__skeleton {
|
|
148
|
+
display: none;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/* While the host is loading there is no chart under it, so the placeholder
|
|
152
|
+
is in flow and its own height holds the body. */
|
|
153
|
+
.ds-chart__skeleton--held {
|
|
154
|
+
position: relative;
|
|
155
|
+
inset: auto;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/* A cartesian drawing sits where the plot will: clear of the value axis on
|
|
159
|
+
the left and the category axis underneath. */
|
|
160
|
+
.ds-chart__skeleton--plotted {
|
|
161
|
+
/* ds-allow(spacing): recharts' own axis metrics (a 60px value axis less the charts' -12px margin, a 30px category axis), which no token carries */
|
|
162
|
+
padding: var(--padding-200) var(--padding-100) 30px 48px; /* ds-allow(physical): recharts draws the value axis on the screen's left in either reading direction */
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.ds-chart__skeleton-drawing {
|
|
166
|
+
display: block;
|
|
167
|
+
width: 100%;
|
|
168
|
+
height: 100%;
|
|
169
|
+
overflow: visible;
|
|
170
|
+
/* ds-allow(motion): the pulse needs a symmetric in-out curve and no
|
|
171
|
+
--motion-ease-* token provides one; the duration is tokenized. */
|
|
172
|
+
animation: ds-chart-skeleton-pulse var(--motion-duration-loop-shimmer) ease-in-out infinite alternate;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.ds-chart__skeleton-mark {
|
|
176
|
+
fill: var(--color-bg-container-secondary);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.ds-chart__skeleton-mark--soft {
|
|
180
|
+
opacity: 0.6;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/* Tiles and funnel bands are parted by a surface-coloured stroke, as the
|
|
184
|
+
real ones are. */
|
|
185
|
+
.ds-chart__skeleton-mark--tile {
|
|
186
|
+
stroke: var(--color-bg-container-primary);
|
|
187
|
+
stroke-width: 2px;
|
|
188
|
+
vector-effect: non-scaling-stroke;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.ds-chart__skeleton-grid {
|
|
192
|
+
fill: none;
|
|
193
|
+
stroke: var(--color-divider);
|
|
194
|
+
stroke-width: 1px;
|
|
195
|
+
vector-effect: non-scaling-stroke;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.ds-chart__skeleton-line,
|
|
199
|
+
.ds-chart__skeleton-dots,
|
|
200
|
+
.ds-chart__skeleton-ring {
|
|
201
|
+
fill: none;
|
|
202
|
+
stroke: var(--color-bg-container-secondary);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/* A thin mark is too little ink to read in the Skeleton fill, so lines and
|
|
206
|
+
dots take the next container step. */
|
|
207
|
+
.ds-chart__skeleton-line,
|
|
208
|
+
.ds-chart__skeleton-dots {
|
|
209
|
+
stroke: var(--color-bg-container-tertiary);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.ds-chart__skeleton-line {
|
|
213
|
+
stroke-width: 3px;
|
|
214
|
+
stroke-linecap: round;
|
|
215
|
+
stroke-linejoin: round;
|
|
216
|
+
vector-effect: non-scaling-stroke;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.ds-chart__skeleton-dots {
|
|
220
|
+
stroke-width: 10px;
|
|
221
|
+
stroke-linecap: round;
|
|
222
|
+
vector-effect: non-scaling-stroke;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
@keyframes ds-chart-skeleton-pulse {
|
|
226
|
+
from {
|
|
227
|
+
opacity: 1;
|
|
228
|
+
}
|
|
229
|
+
to {
|
|
230
|
+
opacity: 0.5;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
113
234
|
/* ============================================
|
|
114
235
|
BARE MODE — the chart sits inside another
|
|
115
236
|
panel that supplies the surface, so its own
|
|
@@ -236,4 +357,16 @@
|
|
|
236
357
|
}
|
|
237
358
|
}
|
|
238
359
|
|
|
360
|
+
/* ============================================
|
|
361
|
+
FOCUS — the drawing is a tab stop (the arrow
|
|
362
|
+
keys move the tooltip), so it takes the
|
|
363
|
+
system ring, not the browser's.
|
|
364
|
+
============================================ */
|
|
365
|
+
|
|
366
|
+
.ds-chart .recharts-surface:focus-visible {
|
|
367
|
+
outline: 2px solid var(--color-action-primary-bg);
|
|
368
|
+
outline-offset: 2px;
|
|
369
|
+
border-radius: var(--radius-100);
|
|
370
|
+
}
|
|
371
|
+
|
|
239
372
|
} /* @layer rift.components */
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
/** The drawing a chart's placeholder takes: one per chart type. */
|
|
3
|
+
export type ChartSkeletonShape = 'area' | 'bar' | 'combo' | 'funnel' | 'line' | 'pie' | 'radar' | 'radial' | 'scatter' | 'stacked-bar' | 'treemap';
|
|
4
|
+
interface ChartSkeletonProps {
|
|
5
|
+
/** Which chart's outline to draw. */
|
|
6
|
+
shape: ChartSkeletonShape;
|
|
7
|
+
/** The chart area's height in pixels, the box the placeholder holds while the chart is loading. */
|
|
8
|
+
height: number;
|
|
9
|
+
/** True while the host is still fetching: the placeholder holds the body and is announced. */
|
|
10
|
+
loading: boolean;
|
|
11
|
+
/** The accessible name announced while `loading`. */
|
|
12
|
+
loadingLabel: string;
|
|
13
|
+
/** The inner radius of a pie's hole, in viewBox units out of 50; 0 draws a full disc. */
|
|
14
|
+
hole?: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The placeholder a chart draws in its body until its marks exist: the
|
|
18
|
+
* outline of that chart type, in the Skeleton fill, pulsing.
|
|
19
|
+
*
|
|
20
|
+
* It covers two waits. recharts draws nothing until its container has been
|
|
21
|
+
* measured in the browser, so server markup, and every frame before
|
|
22
|
+
* hydration, would otherwise be an empty box: the placeholder is in that
|
|
23
|
+
* markup, and Chart.css hides it the moment recharts mounts its wrapper,
|
|
24
|
+
* with no state and no re-render. And while a host is still fetching, the
|
|
25
|
+
* chart's `loading` prop holds the placeholder in place of the chart and
|
|
26
|
+
* announces it.
|
|
27
|
+
*
|
|
28
|
+
* Internal to the chart family (a row of INTERNAL_PARTS): the charts are the
|
|
29
|
+
* public surface, through `loading` and `loadingLabel`.
|
|
30
|
+
*/
|
|
31
|
+
export declare function ChartSkeleton({ shape, height, loading, loadingLabel, hole }: ChartSkeletonProps): React.JSX.Element;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
const GRID_ROWS = "M0 0H100M0 25H100M0 50H100M0 75H100M0 100H100";
|
|
4
|
+
const GRID_COLUMNS = "M0 0V100M25 0V100M50 0V100M75 0V100M100 0V100";
|
|
5
|
+
const BAR_HEIGHTS = [46, 72, 58, 88, 64, 78, 42];
|
|
6
|
+
const BAND = 100 / BAR_HEIGHTS.length;
|
|
7
|
+
const BAR_WIDTH = BAND * 0.6;
|
|
8
|
+
const BAR_INSET = BAND * 0.2;
|
|
9
|
+
const TREND = "M0 70C8 62 12 42 20 46S34 72 42 60S58 22 66 32S84 54 100 26";
|
|
10
|
+
const DOTS = "M8 72h0M15 50h0M22 80h0M28 58h0M34 36h0M41 64h0M47 44h0M54 70h0M60 28h0M66 52h0M73 38h0M79 60h0M86 22h0M93 42h0";
|
|
11
|
+
const TILES = [
|
|
12
|
+
[0, 0, 46, 100],
|
|
13
|
+
[46, 0, 54, 56],
|
|
14
|
+
[46, 56, 30, 44],
|
|
15
|
+
[76, 56, 24, 24],
|
|
16
|
+
[76, 80, 24, 20]
|
|
17
|
+
];
|
|
18
|
+
const FUNNEL_WIDTHS = [100, 74, 50, 32, 32];
|
|
19
|
+
function ring(radius, radii) {
|
|
20
|
+
const count = 6;
|
|
21
|
+
return Array.from({ length: count }, (_, i) => {
|
|
22
|
+
const angle = Math.PI / 180 * (-90 + 360 / count * i);
|
|
23
|
+
const r = radii ? radii[i] : radius;
|
|
24
|
+
return `${(50 + r * Math.cos(angle)).toFixed(2)},${(50 + r * Math.sin(angle)).toFixed(2)}`;
|
|
25
|
+
}).join(" ");
|
|
26
|
+
}
|
|
27
|
+
function bars(stacked) {
|
|
28
|
+
return BAR_HEIGHTS.map((h, i) => {
|
|
29
|
+
const x = i * BAND + BAR_INSET;
|
|
30
|
+
if (!stacked) {
|
|
31
|
+
return /* @__PURE__ */ jsx("rect", { className: "ds-chart__skeleton-mark", x, y: 100 - h, width: BAR_WIDTH, height: h }, i);
|
|
32
|
+
}
|
|
33
|
+
const lower = h * 0.58;
|
|
34
|
+
return /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
35
|
+
/* @__PURE__ */ jsx("rect", { className: "ds-chart__skeleton-mark", x, y: 100 - lower, width: BAR_WIDTH, height: lower }),
|
|
36
|
+
/* @__PURE__ */ jsx(
|
|
37
|
+
"rect",
|
|
38
|
+
{
|
|
39
|
+
className: "ds-chart__skeleton-mark ds-chart__skeleton-mark--soft",
|
|
40
|
+
x,
|
|
41
|
+
y: 100 - h,
|
|
42
|
+
width: BAR_WIDTH,
|
|
43
|
+
height: h - lower
|
|
44
|
+
}
|
|
45
|
+
)
|
|
46
|
+
] }, i);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function drawing(shape, hole) {
|
|
50
|
+
switch (shape) {
|
|
51
|
+
case "bar":
|
|
52
|
+
case "stacked-bar":
|
|
53
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
54
|
+
/* @__PURE__ */ jsx("path", { className: "ds-chart__skeleton-grid", d: GRID_ROWS }),
|
|
55
|
+
bars(shape === "stacked-bar")
|
|
56
|
+
] });
|
|
57
|
+
case "combo":
|
|
58
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
59
|
+
/* @__PURE__ */ jsx("path", { className: "ds-chart__skeleton-grid", d: GRID_ROWS }),
|
|
60
|
+
/* @__PURE__ */ jsx("g", { className: "ds-chart__skeleton-mark--soft", children: bars(false) }),
|
|
61
|
+
/* @__PURE__ */ jsx("path", { className: "ds-chart__skeleton-line", d: TREND })
|
|
62
|
+
] });
|
|
63
|
+
case "line":
|
|
64
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
65
|
+
/* @__PURE__ */ jsx("path", { className: "ds-chart__skeleton-grid", d: GRID_ROWS }),
|
|
66
|
+
/* @__PURE__ */ jsx("path", { className: "ds-chart__skeleton-line", d: TREND })
|
|
67
|
+
] });
|
|
68
|
+
case "area":
|
|
69
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
70
|
+
/* @__PURE__ */ jsx("path", { className: "ds-chart__skeleton-grid", d: GRID_ROWS }),
|
|
71
|
+
/* @__PURE__ */ jsx("path", { className: "ds-chart__skeleton-mark ds-chart__skeleton-mark--soft", d: `${TREND}V100H0Z` }),
|
|
72
|
+
/* @__PURE__ */ jsx("path", { className: "ds-chart__skeleton-line", d: TREND })
|
|
73
|
+
] });
|
|
74
|
+
case "scatter":
|
|
75
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
76
|
+
/* @__PURE__ */ jsx("path", { className: "ds-chart__skeleton-grid", d: GRID_ROWS + GRID_COLUMNS }),
|
|
77
|
+
/* @__PURE__ */ jsx("path", { className: "ds-chart__skeleton-dots", d: DOTS })
|
|
78
|
+
] });
|
|
79
|
+
case "pie": {
|
|
80
|
+
const inner = Math.min(Math.max(hole, 0), 40);
|
|
81
|
+
return inner > 0 ? /* @__PURE__ */ jsx(
|
|
82
|
+
"circle",
|
|
83
|
+
{
|
|
84
|
+
className: "ds-chart__skeleton-ring",
|
|
85
|
+
cx: "50",
|
|
86
|
+
cy: "50",
|
|
87
|
+
r: (45 + inner) / 2,
|
|
88
|
+
strokeWidth: 45 - inner
|
|
89
|
+
}
|
|
90
|
+
) : /* @__PURE__ */ jsx("circle", { className: "ds-chart__skeleton-mark", cx: "50", cy: "50", r: "45" });
|
|
91
|
+
}
|
|
92
|
+
case "radial":
|
|
93
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
94
|
+
/* @__PURE__ */ jsx("circle", { className: "ds-chart__skeleton-ring", cx: "50", cy: "50", r: "37", strokeWidth: "5" }),
|
|
95
|
+
/* @__PURE__ */ jsx("circle", { className: "ds-chart__skeleton-ring", cx: "50", cy: "50", r: "28", strokeWidth: "5" }),
|
|
96
|
+
/* @__PURE__ */ jsx("circle", { className: "ds-chart__skeleton-ring", cx: "50", cy: "50", r: "19", strokeWidth: "5" })
|
|
97
|
+
] });
|
|
98
|
+
case "radar":
|
|
99
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
100
|
+
/* @__PURE__ */ jsx("polygon", { className: "ds-chart__skeleton-grid", points: ring(36) }),
|
|
101
|
+
/* @__PURE__ */ jsx("polygon", { className: "ds-chart__skeleton-grid", points: ring(24) }),
|
|
102
|
+
/* @__PURE__ */ jsx("polygon", { className: "ds-chart__skeleton-grid", points: ring(12) }),
|
|
103
|
+
/* @__PURE__ */ jsx("polygon", { className: "ds-chart__skeleton-mark", points: ring(0, [30, 20, 27, 16, 29, 22]) })
|
|
104
|
+
] });
|
|
105
|
+
case "treemap":
|
|
106
|
+
return TILES.map(([x, y, width, height], i) => /* @__PURE__ */ jsx("rect", { className: "ds-chart__skeleton-mark ds-chart__skeleton-mark--tile", x, y, width, height }, i));
|
|
107
|
+
case "funnel":
|
|
108
|
+
return FUNNEL_WIDTHS.slice(0, -1).map((top, i) => {
|
|
109
|
+
const bottom = FUNNEL_WIDTHS[i + 1];
|
|
110
|
+
const y0 = i * 25;
|
|
111
|
+
const y1 = y0 + 25;
|
|
112
|
+
return /* @__PURE__ */ jsx(
|
|
113
|
+
"polygon",
|
|
114
|
+
{
|
|
115
|
+
className: "ds-chart__skeleton-mark ds-chart__skeleton-mark--tile",
|
|
116
|
+
points: `${50 - top / 2},${y0} ${50 + top / 2},${y0} ${50 + bottom / 2},${y1} ${50 - bottom / 2},${y1}`
|
|
117
|
+
},
|
|
118
|
+
i
|
|
119
|
+
);
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
const POLAR = /* @__PURE__ */ new Set(["pie", "radar", "radial"]);
|
|
124
|
+
const PLOTTED = /* @__PURE__ */ new Set(["area", "bar", "combo", "line", "scatter", "stacked-bar"]);
|
|
125
|
+
function ChartSkeleton({ shape, height, loading, loadingLabel, hole = 0 }) {
|
|
126
|
+
const classes = [
|
|
127
|
+
"ds-chart__skeleton",
|
|
128
|
+
PLOTTED.has(shape) ? "ds-chart__skeleton--plotted" : "",
|
|
129
|
+
loading ? "ds-chart__skeleton--held" : ""
|
|
130
|
+
].filter(Boolean).join(" ");
|
|
131
|
+
const svg = /* @__PURE__ */ jsx(
|
|
132
|
+
"svg",
|
|
133
|
+
{
|
|
134
|
+
className: "ds-chart__skeleton-drawing",
|
|
135
|
+
viewBox: "0 0 100 100",
|
|
136
|
+
preserveAspectRatio: POLAR.has(shape) ? "xMidYMid meet" : "none",
|
|
137
|
+
"aria-hidden": "true",
|
|
138
|
+
focusable: "false",
|
|
139
|
+
children: drawing(shape, hole)
|
|
140
|
+
}
|
|
141
|
+
);
|
|
142
|
+
if (loading) {
|
|
143
|
+
return /* @__PURE__ */ jsx("div", { className: classes, role: "status", "aria-label": loadingLabel, "aria-busy": "true", style: { height }, children: svg });
|
|
144
|
+
}
|
|
145
|
+
return /* @__PURE__ */ jsx("div", { className: classes, "aria-hidden": "true", children: svg });
|
|
146
|
+
}
|
|
147
|
+
export {
|
|
148
|
+
ChartSkeleton
|
|
149
|
+
};
|