rift-ds 1.41.0 → 1.42.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/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 +1 -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.tsx +7 -5
- package/bin/templates/blocks/app/landing/page.tsx +1 -1
- 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/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 +39 -115
- package/bin/templates/blocks/components/blocks/DocsShell.tsx +5 -1
- package/bin/templates/blocks/registry.json +44 -6
- 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/AppSidebar/AppSidebar.css +13 -2
- package/components/AppSidebar/AppSidebar.js +7 -2
- 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 +51 -45
- package/components/Chart/BarChart.d.ts +7 -0
- package/components/Chart/BarChart.js +52 -46
- package/components/Chart/Chart.css +122 -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 +61 -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 +38 -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 +46 -40
- package/components/Chart/StackedBarChart.d.ts +10 -1
- package/components/Chart/StackedBarChart.js +51 -43
- package/components/Chart/Treemap.d.ts +7 -0
- package/components/Chart/Treemap.js +17 -11
- 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 +28 -4
- package/components/DataTable/DataTable.d.ts +16 -2
- package/components/DataTable/DataTable.js +5 -0
- 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/EmptyState/EmptyState.css +8 -1
- 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 +3 -1
- package/components/List/List.css +1 -1
- package/components/NotificationCenter/NotificationCenter.css +16 -0
- package/components/NotificationCenter/NotificationCenter.d.ts +4 -0
- package/components/NotificationCenter/NotificationCenter.js +23 -1
- package/components/NumberInput/NumberInput.css +2 -0
- package/components/PageHeader/PageHeader.css +12 -4
- package/components/Panel/Panel.d.ts +1 -1
- package/components/Prose/Prose.css +1 -1
- 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/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 +31 -0
- package/components/Stat/Stat.d.ts +23 -2
- package/components/Stat/Stat.js +21 -6
- package/components/Table/Table.css +101 -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 +10 -2
- 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/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/registry.json +4 -1
- package/components/registry.json.d.ts +4 -1
- 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 +2 -2
- 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 +14 -1
- package/tokens/values.js +14 -1
- package/tokens/values.json.js +1 -1
|
@@ -33,6 +33,13 @@ type RadarChartOwnProps = {
|
|
|
33
33
|
height?: number;
|
|
34
34
|
/** Strip the card chrome (border, padding, fill) when the chart sits inside another panel that supplies the surface */
|
|
35
35
|
bare?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Holds the chart's placeholder, the outline of this chart type, in place of the chart while its data is still being fetched.
|
|
38
|
+
* Before its first draw the chart shows the same placeholder by itself, so this is only for a wait the host knows about.
|
|
39
|
+
*/
|
|
40
|
+
loading?: boolean;
|
|
41
|
+
/** Accessible name announced while `loading`. */
|
|
42
|
+
loadingLabel?: string;
|
|
36
43
|
/** Additional CSS classes on the wrapper */
|
|
37
44
|
className?: string;
|
|
38
45
|
};
|
|
@@ -4,6 +4,7 @@ import React, { useCallback, useId, useState } from "react";
|
|
|
4
4
|
import { ResponsiveContainer, RadarChart as RadarChart$1, PolarGrid, PolarAngleAxis, PolarRadiusAxis, Tooltip, Radar, Legend } from "recharts";
|
|
5
5
|
import { readTokenPx, getChartSeriesColors } from "./palette.js";
|
|
6
6
|
import { useChartAnimation } from "./useChartAnimation.js";
|
|
7
|
+
import { ChartSkeleton } from "./ChartSkeleton.js";
|
|
7
8
|
import "./Chart.css";
|
|
8
9
|
import { useLocale } from "../../behaviors/LocaleProvider.js";
|
|
9
10
|
import { formatAxisNumber, formatNumber } from "../../behaviors/locale.js";
|
|
@@ -30,6 +31,8 @@ const RadarChart = React.forwardRef(({
|
|
|
30
31
|
summaryItems,
|
|
31
32
|
height = 350,
|
|
32
33
|
bare = false,
|
|
34
|
+
loading = false,
|
|
35
|
+
loadingLabel = "Loading chart",
|
|
33
36
|
className = "",
|
|
34
37
|
locale: localeProp,
|
|
35
38
|
...rest
|
|
@@ -93,38 +96,41 @@ const RadarChart = React.forwardRef(({
|
|
|
93
96
|
/* @__PURE__ */ jsx("span", { className: `${baseClass}__summary-value`, children: typeof item.value === "number" ? formatNumber(item.value, locale) : item.value })
|
|
94
97
|
] }, i)) })
|
|
95
98
|
] }),
|
|
96
|
-
/* @__PURE__ */
|
|
97
|
-
/* @__PURE__ */ jsx(
|
|
98
|
-
/* @__PURE__ */ jsx(
|
|
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
|
-
|
|
99
|
+
/* @__PURE__ */ jsxs("div", { className: `${baseClass}__body`, children: [
|
|
100
|
+
/* @__PURE__ */ jsx(ChartSkeleton, { shape: "radar", height, loading, loadingLabel }),
|
|
101
|
+
!loading && /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height, onResize: (width) => setBodyWidth(width), children: /* @__PURE__ */ jsxs(RadarChart$1, { data, cx: "50%", cy: "50%", outerRadius, children: [
|
|
102
|
+
/* @__PURE__ */ jsx(PolarGrid, { stroke: gridColor }),
|
|
103
|
+
/* @__PURE__ */ jsx(PolarAngleAxis, { dataKey: categoryKey, tick: renderAngleTick }),
|
|
104
|
+
/* @__PURE__ */ jsx(
|
|
105
|
+
PolarRadiusAxis,
|
|
106
|
+
{
|
|
107
|
+
tickFormatter: formatTick,
|
|
108
|
+
tick: { fill: textSecondary, fontSize: textSize },
|
|
109
|
+
axisLine: false,
|
|
110
|
+
tickCount: 5
|
|
111
|
+
}
|
|
112
|
+
),
|
|
113
|
+
/* @__PURE__ */ jsx(Tooltip, { content: renderTooltip }),
|
|
114
|
+
series.map((s, i) => /* @__PURE__ */ jsx(
|
|
115
|
+
Radar,
|
|
116
|
+
{
|
|
117
|
+
...animation,
|
|
118
|
+
name: s.label,
|
|
119
|
+
dataKey: s.dataKey,
|
|
120
|
+
stroke: s.color || seriesColors[i % seriesColors.length],
|
|
121
|
+
fill: s.color || seriesColors[i % seriesColors.length],
|
|
122
|
+
fillOpacity: s.fillOpacity ?? 0.3
|
|
123
|
+
},
|
|
124
|
+
s.dataKey
|
|
125
|
+
)),
|
|
126
|
+
series.length > 1 && /* @__PURE__ */ jsx(
|
|
127
|
+
Legend,
|
|
128
|
+
{
|
|
129
|
+
wrapperStyle: { color: textSecondary, fontSize: textSize }
|
|
130
|
+
}
|
|
131
|
+
)
|
|
132
|
+
] }) })
|
|
133
|
+
] })
|
|
128
134
|
]
|
|
129
135
|
}
|
|
130
136
|
);
|
|
@@ -39,6 +39,13 @@ type RadialChartOwnProps = {
|
|
|
39
39
|
centerSublabel?: string;
|
|
40
40
|
/** Strip the card chrome (border, padding, fill) when the chart sits inside another panel that supplies the surface */
|
|
41
41
|
bare?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Holds the chart's placeholder, the outline of this chart type, in place of the chart while its data is still being fetched.
|
|
44
|
+
* Before its first draw the chart shows the same placeholder by itself, so this is only for a wait the host knows about.
|
|
45
|
+
*/
|
|
46
|
+
loading?: boolean;
|
|
47
|
+
/** Accessible name announced while `loading`. */
|
|
48
|
+
loadingLabel?: string;
|
|
42
49
|
/** Additional CSS classes on the wrapper */
|
|
43
50
|
className?: string;
|
|
44
51
|
};
|
|
@@ -4,6 +4,7 @@ import React, { useId, useCallback } from "react";
|
|
|
4
4
|
import { ResponsiveContainer, RadialBarChart, PolarAngleAxis, RadialBar, Tooltip, Legend } from "recharts";
|
|
5
5
|
import { readTokenPx, getChartSeriesColors } from "./palette.js";
|
|
6
6
|
import { useChartAnimation } from "./useChartAnimation.js";
|
|
7
|
+
import { ChartSkeleton } from "./ChartSkeleton.js";
|
|
7
8
|
import "./Chart.css";
|
|
8
9
|
import { useLocale } from "../../behaviors/LocaleProvider.js";
|
|
9
10
|
import { formatNumber } from "../../behaviors/locale.js";
|
|
@@ -38,6 +39,8 @@ const RadialChart = React.forwardRef(({
|
|
|
38
39
|
centerLabel,
|
|
39
40
|
centerSublabel,
|
|
40
41
|
bare = false,
|
|
42
|
+
loading = false,
|
|
43
|
+
loadingLabel = "Loading chart",
|
|
41
44
|
className = "",
|
|
42
45
|
locale: localeProp,
|
|
43
46
|
...rest
|
|
@@ -82,7 +85,8 @@ const RadialChart = React.forwardRef(({
|
|
|
82
85
|
] }, i)) })
|
|
83
86
|
] }),
|
|
84
87
|
/* @__PURE__ */ jsxs("div", { className: `${baseClass}__body`, children: [
|
|
85
|
-
/* @__PURE__ */ jsx(
|
|
88
|
+
/* @__PURE__ */ jsx(ChartSkeleton, { shape: "radial", height, loading, loadingLabel }),
|
|
89
|
+
!loading && /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxs(
|
|
86
90
|
RadialBarChart,
|
|
87
91
|
{
|
|
88
92
|
cx: "50%",
|
|
@@ -37,6 +37,13 @@ type ScatterChartOwnProps = {
|
|
|
37
37
|
yAxisFormatter?: (value: number) => string;
|
|
38
38
|
/** Strip the card chrome (border, padding, fill) when the chart sits inside another panel that supplies the surface */
|
|
39
39
|
bare?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Holds the chart's placeholder, the outline of this chart type, in place of the chart while its data is still being fetched.
|
|
42
|
+
* Before its first draw the chart shows the same placeholder by itself, so this is only for a wait the host knows about.
|
|
43
|
+
*/
|
|
44
|
+
loading?: boolean;
|
|
45
|
+
/** Accessible name announced while `loading`. */
|
|
46
|
+
loadingLabel?: string;
|
|
40
47
|
/** Additional CSS classes on the wrapper */
|
|
41
48
|
className?: string;
|
|
42
49
|
};
|
|
@@ -5,6 +5,7 @@ import { ResponsiveContainer, ScatterChart as ScatterChart$1, CartesianGrid, XAx
|
|
|
5
5
|
import { readTokenPx, getChartSeriesColors } from "./palette.js";
|
|
6
6
|
import { useChartAnimation } from "./useChartAnimation.js";
|
|
7
7
|
import { MOTION_CHART_ENTRANCE_MS } from "../../tokens/motion.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";
|
|
@@ -37,6 +38,8 @@ const ScatterChart = React.forwardRef(({
|
|
|
37
38
|
summaryItems,
|
|
38
39
|
height = 350,
|
|
39
40
|
bare = false,
|
|
41
|
+
loading = false,
|
|
42
|
+
loadingLabel = "Loading chart",
|
|
40
43
|
className = "",
|
|
41
44
|
yAxisFormatter,
|
|
42
45
|
locale: localeProp,
|
|
@@ -83,46 +86,49 @@ const ScatterChart = React.forwardRef(({
|
|
|
83
86
|
/* @__PURE__ */ jsx("span", { className: `${baseClass}__summary-value`, children: typeof item.value === "number" ? formatNumber(item.value, locale) : item.value })
|
|
84
87
|
] }, i)) })
|
|
85
88
|
] }),
|
|
86
|
-
/* @__PURE__ */
|
|
87
|
-
/* @__PURE__ */ jsx(
|
|
88
|
-
/* @__PURE__ */ jsx(
|
|
89
|
-
|
|
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
|
-
|
|
89
|
+
/* @__PURE__ */ jsxs("div", { className: `${baseClass}__body`, children: [
|
|
90
|
+
/* @__PURE__ */ jsx(ChartSkeleton, { shape: "scatter", height, loading, loadingLabel }),
|
|
91
|
+
!loading && /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxs(ScatterChart$1, { margin: { top: 8, right: 4, bottom: 0, left: -12 }, children: [
|
|
92
|
+
/* @__PURE__ */ jsx(CartesianGrid, { stroke: gridColor }),
|
|
93
|
+
/* @__PURE__ */ jsx(
|
|
94
|
+
XAxis,
|
|
95
|
+
{
|
|
96
|
+
tickFormatter: formatTick,
|
|
97
|
+
type: "number",
|
|
98
|
+
dataKey: xKey,
|
|
99
|
+
name: xLabel,
|
|
100
|
+
tick: { fill: textSecondary, fontSize: textSize },
|
|
101
|
+
tickLine: false,
|
|
102
|
+
axisLine: { stroke: gridColor }
|
|
103
|
+
}
|
|
104
|
+
),
|
|
105
|
+
/* @__PURE__ */ jsx(
|
|
106
|
+
YAxis,
|
|
107
|
+
{
|
|
108
|
+
tickFormatter: yAxisFormatter ?? formatTick,
|
|
109
|
+
type: "number",
|
|
110
|
+
dataKey: yKey,
|
|
111
|
+
name: yLabel,
|
|
112
|
+
tick: { fill: textSecondary, fontSize: textSize },
|
|
113
|
+
tickLine: false,
|
|
114
|
+
axisLine: false
|
|
115
|
+
}
|
|
116
|
+
),
|
|
117
|
+
/* @__PURE__ */ jsx(ZAxis, { range: [48, 48] }),
|
|
118
|
+
/* @__PURE__ */ jsx(Tooltip, { content: renderTooltip }),
|
|
119
|
+
datasets.map((ds, i) => /* @__PURE__ */ jsx(
|
|
120
|
+
Scatter,
|
|
121
|
+
{
|
|
122
|
+
...animation,
|
|
123
|
+
name: ds.name,
|
|
124
|
+
data: ds.data,
|
|
125
|
+
fill: ds.color || seriesColors[i % seriesColors.length]
|
|
126
|
+
},
|
|
127
|
+
ds.name
|
|
128
|
+
)),
|
|
129
|
+
datasets.length > 1 && /* @__PURE__ */ jsx(Legend, { wrapperStyle: { color: textSecondary, fontSize: textSize } })
|
|
130
|
+
] }) })
|
|
131
|
+
] })
|
|
126
132
|
]
|
|
127
133
|
}
|
|
128
134
|
);
|
|
@@ -3,7 +3,7 @@ import { ChartActiveHandler, ChartSummaryItem } from './BarChart';
|
|
|
3
3
|
export interface BarSeriesConfig {
|
|
4
4
|
/** Key in data for this series */
|
|
5
5
|
dataKey: string;
|
|
6
|
-
/** Display name (shown in tooltip
|
|
6
|
+
/** Display name (shown in the tooltip and the legend) */
|
|
7
7
|
label: string;
|
|
8
8
|
/** Bar fill colour */
|
|
9
9
|
color?: string;
|
|
@@ -31,6 +31,8 @@ type StackedBarChartOwnProps = {
|
|
|
31
31
|
height?: number;
|
|
32
32
|
/** Y-axis tick formatter */
|
|
33
33
|
yAxisFormatter?: (value: number) => string;
|
|
34
|
+
/** Show the legend under a multi-series chart. On by default; a chart with one series never draws it. */
|
|
35
|
+
showLegend?: boolean;
|
|
34
36
|
/** Strip the card chrome (border, padding, fill) when the chart sits inside another panel that supplies the surface */
|
|
35
37
|
bare?: boolean;
|
|
36
38
|
/**
|
|
@@ -39,6 +41,13 @@ type StackedBarChartOwnProps = {
|
|
|
39
41
|
* neither is on the plot. For a headline figure that follows the cursor.
|
|
40
42
|
*/
|
|
41
43
|
onActiveChange?: ChartActiveHandler;
|
|
44
|
+
/**
|
|
45
|
+
* Holds the chart's placeholder, the outline of this chart type, in place of the chart while its data is still being fetched.
|
|
46
|
+
* Before its first draw the chart shows the same placeholder by itself, so this is only for a wait the host knows about.
|
|
47
|
+
*/
|
|
48
|
+
loading?: boolean;
|
|
49
|
+
/** Accessible name announced while `loading`. */
|
|
50
|
+
loadingLabel?: string;
|
|
42
51
|
/** Additional CSS classes on the wrapper */
|
|
43
52
|
className?: string;
|
|
44
53
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
3
3
|
import React, { useCallback, useId } from "react";
|
|
4
|
-
import { ResponsiveContainer, BarChart, CartesianGrid, XAxis, YAxis, Tooltip, Bar } from "recharts";
|
|
4
|
+
import { ResponsiveContainer, BarChart, CartesianGrid, XAxis, YAxis, Tooltip, Bar, Legend } from "recharts";
|
|
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";
|
|
@@ -31,7 +32,10 @@ const StackedBarChart = React.forwardRef(({
|
|
|
31
32
|
summaryItems,
|
|
32
33
|
height = 350,
|
|
33
34
|
yAxisFormatter,
|
|
35
|
+
showLegend = true,
|
|
34
36
|
bare = false,
|
|
37
|
+
loading = false,
|
|
38
|
+
loadingLabel = "Loading chart",
|
|
35
39
|
className = "",
|
|
36
40
|
onActiveChange,
|
|
37
41
|
locale: localeProp,
|
|
@@ -80,48 +84,52 @@ const StackedBarChart = React.forwardRef(({
|
|
|
80
84
|
/* @__PURE__ */ jsx("span", { className: `${baseClass}__summary-value`, children: typeof item.value === "number" ? formatNumber(item.value, locale) : item.value })
|
|
81
85
|
] }, i)) })
|
|
82
86
|
] }),
|
|
83
|
-
/* @__PURE__ */
|
|
84
|
-
/* @__PURE__ */ jsx(
|
|
85
|
-
/* @__PURE__ */ jsx(
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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
|
-
|
|
87
|
+
/* @__PURE__ */ jsxs("div", { className: `${baseClass}__body`, children: [
|
|
88
|
+
/* @__PURE__ */ jsx(ChartSkeleton, { shape: "stacked-bar", height, loading, loadingLabel }),
|
|
89
|
+
!loading && /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxs(BarChart, { data, margin: { top: 8, right: 4, bottom: 0, left: -12 }, children: [
|
|
90
|
+
/* @__PURE__ */ jsx(CartesianGrid, { vertical: false, stroke: gridColor }),
|
|
91
|
+
/* @__PURE__ */ jsx(
|
|
92
|
+
XAxis,
|
|
93
|
+
{
|
|
94
|
+
dataKey: xKey,
|
|
95
|
+
tick: { fill: textSecondary, fontSize: textSize },
|
|
96
|
+
tickLine: false,
|
|
97
|
+
axisLine: { stroke: gridColor }
|
|
98
|
+
}
|
|
99
|
+
),
|
|
100
|
+
/* @__PURE__ */ jsx(
|
|
101
|
+
YAxis,
|
|
102
|
+
{
|
|
103
|
+
tick: { fill: textSecondary, fontSize: textSize },
|
|
104
|
+
tickLine: false,
|
|
105
|
+
axisLine: false,
|
|
106
|
+
tickFormatter: yAxisFormatter ?? formatTick
|
|
107
|
+
}
|
|
108
|
+
),
|
|
109
|
+
/* @__PURE__ */ jsx(
|
|
110
|
+
Tooltip,
|
|
111
|
+
{
|
|
112
|
+
content: renderTooltip,
|
|
113
|
+
cursor: { fill: cursorColor, opacity: 0.4 }
|
|
114
|
+
}
|
|
115
|
+
),
|
|
116
|
+
series.map((s, i) => /* @__PURE__ */ jsx(
|
|
117
|
+
Bar,
|
|
118
|
+
{
|
|
119
|
+
...animation,
|
|
120
|
+
className: `${baseClass}__bar`,
|
|
121
|
+
dataKey: s.dataKey,
|
|
122
|
+
name: s.label,
|
|
123
|
+
fill: s.color || defaultColors[i % defaultColors.length],
|
|
124
|
+
stackId: "stack",
|
|
125
|
+
radius: i === series.length - 1 ? [3, 3, 0, 0] : [0, 0, 0, 0],
|
|
126
|
+
maxBarSize: 32
|
|
127
|
+
},
|
|
128
|
+
s.dataKey
|
|
129
|
+
)),
|
|
130
|
+
showLegend && series.length > 1 && /* @__PURE__ */ jsx(Legend, { wrapperStyle: { color: textSecondary, fontSize: textSize } })
|
|
131
|
+
] }) })
|
|
132
|
+
] })
|
|
125
133
|
]
|
|
126
134
|
}
|
|
127
135
|
);
|
|
@@ -34,6 +34,13 @@ type TreemapOwnProps = {
|
|
|
34
34
|
bare?: boolean;
|
|
35
35
|
/** The tooltip's name for a tile's value. Defaults to "Size". */
|
|
36
36
|
sizeLabel?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Holds the chart's placeholder, the outline of this chart type, in place of the chart while its data is still being fetched.
|
|
39
|
+
* Before its first draw the chart shows the same placeholder by itself, so this is only for a wait the host knows about.
|
|
40
|
+
*/
|
|
41
|
+
loading?: boolean;
|
|
42
|
+
/** Accessible name announced while `loading`. */
|
|
43
|
+
loadingLabel?: string;
|
|
37
44
|
/** Additional CSS classes on the wrapper */
|
|
38
45
|
className?: string;
|
|
39
46
|
};
|
|
@@ -4,6 +4,7 @@ import React, { useId, useCallback, useState, useEffect, useRef } from "react";
|
|
|
4
4
|
import { ResponsiveContainer, Treemap as Treemap$1, Tooltip } from "recharts";
|
|
5
5
|
import { getChartSeriesColors } from "./palette.js";
|
|
6
6
|
import { useChartAnimation } from "./useChartAnimation.js";
|
|
7
|
+
import { ChartSkeleton } from "./ChartSkeleton.js";
|
|
7
8
|
import "./Chart.css";
|
|
8
9
|
import { useLocale } from "../../behaviors/LocaleProvider.js";
|
|
9
10
|
import { formatNumber } from "../../behaviors/locale.js";
|
|
@@ -140,6 +141,8 @@ const Treemap = React.forwardRef(({
|
|
|
140
141
|
height = 350,
|
|
141
142
|
bare = false,
|
|
142
143
|
sizeLabel = "Size",
|
|
144
|
+
loading = false,
|
|
145
|
+
loadingLabel = "Loading chart",
|
|
143
146
|
className = "",
|
|
144
147
|
locale: localeProp,
|
|
145
148
|
...rest
|
|
@@ -176,17 +179,20 @@ const Treemap = React.forwardRef(({
|
|
|
176
179
|
/* @__PURE__ */ jsx("span", { className: `${baseClass}__summary-value`, children: typeof item.value === "number" ? formatNumber(item.value, locale) : item.value })
|
|
177
180
|
] }, i)) })
|
|
178
181
|
] }),
|
|
179
|
-
/* @__PURE__ */
|
|
180
|
-
|
|
181
|
-
{
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
182
|
+
/* @__PURE__ */ jsxs("div", { className: `${baseClass}__body`, children: [
|
|
183
|
+
/* @__PURE__ */ jsx(ChartSkeleton, { shape: "treemap", height, loading, loadingLabel }),
|
|
184
|
+
!loading && /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsx(
|
|
185
|
+
Treemap$1,
|
|
186
|
+
{
|
|
187
|
+
...animation,
|
|
188
|
+
data,
|
|
189
|
+
dataKey,
|
|
190
|
+
aspectRatio: 4 / 3,
|
|
191
|
+
content: /* @__PURE__ */ jsx(TreemapContent, { themeVersion }),
|
|
192
|
+
children: /* @__PURE__ */ jsx(Tooltip, { content: renderTooltip })
|
|
193
|
+
}
|
|
194
|
+
) })
|
|
195
|
+
] })
|
|
190
196
|
]
|
|
191
197
|
}
|
|
192
198
|
);
|
|
@@ -92,7 +92,18 @@
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
.ds-checkbox--error .ds-checkbox__helper {
|
|
95
|
-
color: var(--color-
|
|
95
|
+
color: var(--color-text-error);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/* The newer form: the error is a line of its own under the label, and the
|
|
99
|
+
helper keeps its colour beside it. */
|
|
100
|
+
.ds-checkbox__error {
|
|
101
|
+
font-family: var(--font-paragraph-sm-family);
|
|
102
|
+
font-size: var(--font-paragraph-sm-size);
|
|
103
|
+
font-weight: var(--font-paragraph-sm-weight);
|
|
104
|
+
line-height: var(--font-paragraph-sm-line-height);
|
|
105
|
+
letter-spacing: var(--font-paragraph-sm-letter-spacing);
|
|
106
|
+
color: var(--color-text-error);
|
|
96
107
|
}
|
|
97
108
|
|
|
98
109
|
/* ============================================
|
|
@@ -128,6 +139,19 @@
|
|
|
128
139
|
border-color: var(--color-action-primary-bg-hover);
|
|
129
140
|
}
|
|
130
141
|
|
|
142
|
+
/* ============================================
|
|
143
|
+
INVALID STATE
|
|
144
|
+
An empty box in error wears the error border,
|
|
145
|
+
as an invalid field does, at rest and on hover
|
|
146
|
+
(the hover rule above is more specific, so it
|
|
147
|
+
is named here). A ticked box keeps its fill.
|
|
148
|
+
============================================ */
|
|
149
|
+
|
|
150
|
+
.ds-checkbox--invalid .ds-checkbox__box:not(.ds-checkbox__box--checked):not(.ds-checkbox__box--indeterminate),
|
|
151
|
+
.ds-checkbox--invalid.ds-control-host:not(:disabled):not([aria-disabled='true']):hover .ds-checkbox__box:not(.ds-checkbox__box--checked):not(.ds-checkbox__box--indeterminate) {
|
|
152
|
+
border-color: var(--color-status-error-border);
|
|
153
|
+
}
|
|
154
|
+
|
|
131
155
|
/* ============================================
|
|
132
156
|
FOCUS STATE
|
|
133
157
|
The standalone control rings its own box; a
|
|
@@ -3,10 +3,12 @@ import { default as React } from 'react';
|
|
|
3
3
|
type CheckboxOwnProps = {
|
|
4
4
|
/** Label text */
|
|
5
5
|
label?: string;
|
|
6
|
-
/** Helper
|
|
6
|
+
/** Helper text rendered under the label text. With the older `error` flag and no `errorText`, it doubles as the error message. */
|
|
7
7
|
helperText?: string;
|
|
8
|
-
/** Error state
|
|
8
|
+
/** Error state: marks the checkbox invalid, draws its box in the error colour and, in the older form without `errorText`, recolours the helper text as the error message. */
|
|
9
9
|
error?: boolean;
|
|
10
|
+
/** The error message, shown under the label while the helper text keeps its place. Setting it marks the checkbox invalid. */
|
|
11
|
+
errorText?: React.ReactNode;
|
|
10
12
|
/**
|
|
11
13
|
* Whether the checkbox is checked, controlled. Leave undefined to let the
|
|
12
14
|
* checkbox keep its own state, seeded from `defaultChecked`.
|
|
@@ -51,10 +53,12 @@ export declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & R
|
|
|
51
53
|
type CheckboxGroupOwnProps = {
|
|
52
54
|
/** Group label */
|
|
53
55
|
label?: string;
|
|
54
|
-
/** Helper
|
|
56
|
+
/** Helper text rendered below the group. With the older `error` flag and no `errorText`, it doubles as the error message. */
|
|
55
57
|
helperText?: string;
|
|
56
|
-
/** Error state
|
|
58
|
+
/** Error state: marks the group invalid and, in the older form without `errorText`, recolours the helper text as the error message. */
|
|
57
59
|
error?: boolean;
|
|
60
|
+
/** The error message, shown under the group while the helper text keeps its place. Setting it marks the group invalid; Field's spec owns the wiring. */
|
|
61
|
+
errorText?: React.ReactNode;
|
|
58
62
|
/** Marks the group required and renders the required marker on its label */
|
|
59
63
|
required?: boolean;
|
|
60
64
|
/**
|
|
@@ -8,6 +8,7 @@ const Checkbox = React.forwardRef(
|
|
|
8
8
|
label,
|
|
9
9
|
helperText,
|
|
10
10
|
error = false,
|
|
11
|
+
errorText,
|
|
11
12
|
checked: checkedProp,
|
|
12
13
|
defaultChecked = false,
|
|
13
14
|
indeterminate = false,
|
|
@@ -28,8 +29,11 @@ const Checkbox = React.forwardRef(
|
|
|
28
29
|
const isControlled = checkedProp !== void 0;
|
|
29
30
|
const checked = isControlled ? checkedProp : internalChecked;
|
|
30
31
|
const generatedId = useId();
|
|
32
|
+
const hasErrorText = errorText != null && errorText !== false && errorText !== "";
|
|
33
|
+
const invalid = error || hasErrorText;
|
|
31
34
|
const helperId = helperText ? `${generatedId}-helper` : void 0;
|
|
32
|
-
const
|
|
35
|
+
const errorId = hasErrorText ? `${generatedId}-error` : void 0;
|
|
36
|
+
const describedBy = [errorId, helperId].filter(Boolean).join(" ") || rest["aria-describedby"];
|
|
33
37
|
const classes = [
|
|
34
38
|
baseClass,
|
|
35
39
|
"ds-control-host",
|
|
@@ -37,8 +41,9 @@ const Checkbox = React.forwardRef(
|
|
|
37
41
|
checked ? `${baseClass}--checked` : "",
|
|
38
42
|
indeterminate && !checked ? `${baseClass}--indeterminate` : "",
|
|
39
43
|
disabled ? `${baseClass}--disabled` : "",
|
|
40
|
-
helperText ? `${baseClass}--has-helper` : "",
|
|
41
|
-
error ? `${baseClass}--error` : "",
|
|
44
|
+
helperText || hasErrorText ? `${baseClass}--has-helper` : "",
|
|
45
|
+
error && !hasErrorText ? `${baseClass}--error` : "",
|
|
46
|
+
invalid ? `${baseClass}--invalid` : "",
|
|
42
47
|
className
|
|
43
48
|
].filter(Boolean).join(" ");
|
|
44
49
|
const toggle = () => {
|
|
@@ -71,13 +76,14 @@ const Checkbox = React.forwardRef(
|
|
|
71
76
|
"aria-disabled": disabled,
|
|
72
77
|
"aria-label": rest["aria-label"] || ariaLabel || label,
|
|
73
78
|
"aria-describedby": describedBy,
|
|
74
|
-
"aria-invalid":
|
|
79
|
+
"aria-invalid": invalid || void 0,
|
|
75
80
|
tabIndex: disabled ? -1 : rest.tabIndex ?? 0,
|
|
76
81
|
children: [
|
|
77
82
|
/* @__PURE__ */ jsx(CheckboxIndicator, { checked, indeterminate, size }),
|
|
78
|
-
helperText ? /* @__PURE__ */ jsxs("span", { className: `${baseClass}__text`, children: [
|
|
83
|
+
helperText || hasErrorText ? /* @__PURE__ */ jsxs("span", { className: `${baseClass}__text`, children: [
|
|
79
84
|
label && /* @__PURE__ */ jsx("span", { className: `${baseClass}__label`, children: label }),
|
|
80
|
-
/* @__PURE__ */ jsx("span", { className: `${baseClass}
|
|
85
|
+
hasErrorText && /* @__PURE__ */ jsx("span", { className: `${baseClass}__error`, id: errorId, "aria-live": "polite", children: errorText }),
|
|
86
|
+
helperText && /* @__PURE__ */ jsx("span", { className: `${baseClass}__helper`, id: helperId, children: helperText })
|
|
81
87
|
] }) : label && /* @__PURE__ */ jsx("span", { className: `${baseClass}__label`, children: label }),
|
|
82
88
|
name && checked && /* @__PURE__ */ jsx("input", { type: "hidden", name, value, disabled })
|
|
83
89
|
]
|
|
@@ -91,6 +97,7 @@ const CheckboxGroup = React.forwardRef(
|
|
|
91
97
|
label,
|
|
92
98
|
helperText,
|
|
93
99
|
error = false,
|
|
100
|
+
errorText,
|
|
94
101
|
required = false,
|
|
95
102
|
name,
|
|
96
103
|
items,
|
|
@@ -112,7 +119,8 @@ const CheckboxGroup = React.forwardRef(
|
|
|
112
119
|
const generatedId = useId();
|
|
113
120
|
const groupId = id || generatedId;
|
|
114
121
|
const labelId = label ? `${groupId}-label` : void 0;
|
|
115
|
-
const
|
|
122
|
+
const hasErrorText = errorText != null && errorText !== false && errorText !== "";
|
|
123
|
+
const describedBy = [hasErrorText ? `${groupId}-error` : void 0, helperText ? `${groupId}-helper` : void 0].filter(Boolean).join(" ") || rest["aria-describedby"];
|
|
116
124
|
const handleToggle = (itemValue) => {
|
|
117
125
|
const next = values.includes(itemValue) ? values.filter((v) => v !== itemValue) : [...values, itemValue];
|
|
118
126
|
if (!isControlled) setInternalValues(next);
|
|
@@ -128,13 +136,14 @@ const CheckboxGroup = React.forwardRef(
|
|
|
128
136
|
group: true,
|
|
129
137
|
label,
|
|
130
138
|
helperText,
|
|
139
|
+
errorText,
|
|
131
140
|
error,
|
|
132
141
|
required,
|
|
133
142
|
id: groupId,
|
|
134
143
|
role: "group",
|
|
135
144
|
"aria-labelledby": labelId,
|
|
136
145
|
"aria-describedby": describedBy,
|
|
137
|
-
"aria-invalid": error || void 0,
|
|
146
|
+
"aria-invalid": error || hasErrorText || void 0,
|
|
138
147
|
children: /* @__PURE__ */ jsx("div", { className: `${baseClass}__items`, children: items.map((item) => /* @__PURE__ */ jsx(
|
|
139
148
|
Checkbox,
|
|
140
149
|
{
|