rift-ds 1.40.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.
Files changed (218) hide show
  1. package/README.md +6 -2
  2. package/behaviors/LoadingImage.d.ts +2 -0
  3. package/behaviors/LoadingImage.js +34 -0
  4. package/behaviors/ScrollRegion.js +15 -2
  5. package/behaviors/VisuallyHidden.d.ts +30 -0
  6. package/behaviors/VisuallyHidden.js +17 -0
  7. package/behaviors/loading-image.css +30 -0
  8. package/behaviors/quietFocus.d.ts +4 -0
  9. package/behaviors/quietFocus.js +14 -0
  10. package/behaviors/shell.css +9 -11
  11. package/behaviors/useFocusScope.d.ts +3 -1
  12. package/behaviors/useFocusScope.js +4 -6
  13. package/bin/rift-ds.mjs +1 -0
  14. package/bin/templates/app/components/rift/ColorModeScript.tsx +3 -1
  15. package/bin/templates/app/components/rift/RiftRoot.tsx +40 -1
  16. package/bin/templates/blocks/app/dashboard/page.tsx +7 -5
  17. package/bin/templates/blocks/app/landing/page.tsx +1 -1
  18. package/bin/templates/blocks/app/pricing/page.module.css +15 -1
  19. package/bin/templates/blocks/app/pricing/page.tsx +8 -1
  20. package/bin/templates/blocks/app/sign-in/page.tsx +10 -2
  21. package/bin/templates/blocks/app/sign-up/page.module.css +83 -0
  22. package/bin/templates/blocks/app/sign-up/page.tsx +126 -0
  23. package/bin/templates/blocks/app/starter/page.tsx +1 -1
  24. package/bin/templates/blocks/components/blocks/AppShell.module.css +0 -10
  25. package/bin/templates/blocks/components/blocks/AppShell.tsx +41 -116
  26. package/bin/templates/blocks/components/blocks/DocsShell.tsx +5 -1
  27. package/bin/templates/blocks/registry.json +44 -6
  28. package/chat/ChatLauncher.d.ts +2 -2
  29. package/chat/ChatWidget.css +7 -7
  30. package/chat/ChatWidget.d.ts +1 -1
  31. package/components/AgentPlan/AgentPlan.css +1 -1
  32. package/components/AlertDialog/AlertDialog.css +14 -0
  33. package/components/AlertDialog/AlertDialog.d.ts +35 -3
  34. package/components/AlertDialog/AlertDialog.js +16 -5
  35. package/components/AppLayout/AppLayout.css +1 -1
  36. package/components/AppLayout/AppLayout.d.ts +2 -2
  37. package/components/AppSidebar/AppSidebar.css +25 -17
  38. package/components/AppSidebar/AppSidebar.d.ts +4 -4
  39. package/components/AppSidebar/AppSidebar.js +14 -5
  40. package/components/Attachment/AttachmentGroup.js +2 -1
  41. package/components/Attachment/AttachmentTile.js +2 -1
  42. package/components/Avatar/Avatar.css +18 -5
  43. package/components/Avatar/Avatar.d.ts +2 -0
  44. package/components/Avatar/Avatar.js +2 -1
  45. package/components/AvatarGroup/AvatarGroup.css +8 -1
  46. package/components/AvatarGroup/AvatarGroup.d.ts +6 -0
  47. package/components/AvatarGroup/AvatarGroup.js +2 -2
  48. package/components/Badge/Badge.css +6 -0
  49. package/components/Breadcrumb/Breadcrumb.css +4 -1
  50. package/components/Button/Button.css +20 -1
  51. package/components/Button/Button.js +6 -1
  52. package/components/Card/Card.css +11 -0
  53. package/components/Card/Card.d.ts +9 -3
  54. package/components/Card/Card.js +21 -2
  55. package/components/Chart/AreaChart.d.ts +7 -0
  56. package/components/Chart/AreaChart.js +51 -45
  57. package/components/Chart/BarChart.d.ts +7 -0
  58. package/components/Chart/BarChart.js +52 -46
  59. package/components/Chart/Chart.css +122 -1
  60. package/components/Chart/ChartSkeleton.d.ts +32 -0
  61. package/components/Chart/ChartSkeleton.js +149 -0
  62. package/components/Chart/ComboChart.d.ts +7 -0
  63. package/components/Chart/ComboChart.js +80 -74
  64. package/components/Chart/LineChart.d.ts +17 -3
  65. package/components/Chart/LineChart.js +61 -39
  66. package/components/Chart/PieChart.d.ts +7 -0
  67. package/components/Chart/PieChart.js +41 -34
  68. package/components/Chart/RadarChart.d.ts +7 -0
  69. package/components/Chart/RadarChart.js +38 -32
  70. package/components/Chart/RadialChart.d.ts +7 -0
  71. package/components/Chart/RadialChart.js +5 -1
  72. package/components/Chart/ScatterChart.d.ts +7 -0
  73. package/components/Chart/ScatterChart.js +46 -40
  74. package/components/Chart/StackedBarChart.d.ts +10 -1
  75. package/components/Chart/StackedBarChart.js +51 -43
  76. package/components/Chart/Treemap.d.ts +7 -0
  77. package/components/Chart/Treemap.js +17 -11
  78. package/components/Checkbox/Checkbox.css +25 -1
  79. package/components/Checkbox/Checkbox.d.ts +8 -4
  80. package/components/Checkbox/Checkbox.js +17 -8
  81. package/components/Chip/Chip.css +5 -3
  82. package/components/ContactCard/ContactCard.css +4 -3
  83. package/components/ContributionGraph/ContributionGraph.css +20 -0
  84. package/components/ContributionGraph/ContributionGraph.d.ts +4 -0
  85. package/components/ContributionGraph/ContributionGraph.js +11 -6
  86. package/components/DataTable/DataTable.css +91 -4
  87. package/components/DataTable/DataTable.d.ts +42 -4
  88. package/components/DataTable/DataTable.js +121 -90
  89. package/components/DateInput/DateInput.css +3 -1
  90. package/components/DatePicker/DatePicker.css +16 -0
  91. package/components/DatePicker/DatePicker.d.ts +13 -0
  92. package/components/DatePicker/DatePicker.js +21 -27
  93. package/components/DatePicker/MonthGrid.d.ts +2 -2
  94. package/components/DatePicker/MonthGrid.js +1 -1
  95. package/components/DatePicker/today.d.ts +15 -0
  96. package/components/DatePicker/today.js +17 -0
  97. package/components/DateRangePicker/DateRangePicker.d.ts +14 -1
  98. package/components/DateRangePicker/DateRangePicker.js +18 -7
  99. package/components/DescriptionList/DescriptionList.css +11 -0
  100. package/components/DescriptionList/DescriptionList.d.ts +5 -1
  101. package/components/DescriptionList/DescriptionList.js +21 -6
  102. package/components/Dialog/Dialog.css +9 -0
  103. package/components/Dialog/Dialog.d.ts +9 -0
  104. package/components/Dialog/Dialog.js +32 -19
  105. package/components/DocumentChip/DocumentChip.css +1 -1
  106. package/components/Drawer/Drawer.d.ts +9 -0
  107. package/components/Drawer/Drawer.js +8 -0
  108. package/components/DrillMenu/DrillMenu.d.ts +2 -1
  109. package/components/DrillMenu/DrillMenu.js +14 -3
  110. package/components/Dropdown/Dropdown.css +3 -1
  111. package/components/EmptyState/EmptyState.css +8 -1
  112. package/components/EntitySwitcher/EntitySwitcher.css +2 -1
  113. package/components/Field/Field.css +2 -2
  114. package/components/FileInput/FileInput.css +1 -1
  115. package/components/FilterBar/FilterBar.d.ts +6 -1
  116. package/components/FunnelChart/FunnelChart.d.ts +7 -0
  117. package/components/FunnelChart/FunnelChart.js +44 -30
  118. package/components/GanttChart/GanttChart.css +10 -0
  119. package/components/GanttChart/GanttChart.d.ts +4 -0
  120. package/components/GanttChart/GanttChart.js +66 -33
  121. package/components/Gauge/Gauge.css +23 -0
  122. package/components/Gauge/Gauge.d.ts +4 -0
  123. package/components/Gauge/Gauge.js +14 -8
  124. package/components/Icon/Icon.css +6 -1
  125. package/components/Icon/Icon.d.ts +3 -1
  126. package/components/Icon/Icon.js +2 -0
  127. package/components/ImageCompare/ImageCompare.js +2 -1
  128. package/components/Input/Input.css +3 -1
  129. package/components/List/List.css +1 -1
  130. package/components/NotificationCenter/NotificationCenter.css +16 -0
  131. package/components/NotificationCenter/NotificationCenter.d.ts +4 -0
  132. package/components/NotificationCenter/NotificationCenter.js +23 -1
  133. package/components/NumberInput/NumberInput.css +2 -0
  134. package/components/PageHeader/PageHeader.css +12 -4
  135. package/components/Panel/Panel.d.ts +1 -1
  136. package/components/PixelAvatar/PixelAvatar.css +7 -1
  137. package/components/PixelAvatar/PixelAvatar.d.ts +2 -0
  138. package/components/PixelAvatar/PixelAvatar.js +2 -1
  139. package/components/Prose/Prose.css +1 -1
  140. package/components/RadioButton/RadioButton.css +1 -1
  141. package/components/RadioButton/RadioButton.d.ts +4 -2
  142. package/components/RadioButton/RadioButton.js +5 -2
  143. package/components/ResourceTimeline/ResourceTimeline.css +12 -0
  144. package/components/ResourceTimeline/ResourceTimeline.d.ts +5 -1
  145. package/components/ResourceTimeline/ResourceTimeline.js +94 -52
  146. package/components/RichDropdown/RichDropdown.css +3 -1
  147. package/components/SelectionCard/SelectionCard.css +29 -0
  148. package/components/SelectionCard/SelectionCard.d.ts +7 -0
  149. package/components/SelectionCard/SelectionCard.js +25 -2
  150. package/components/ShaderField/useShaderField.js +2 -2
  151. package/components/ShaderScene/ShaderScene.js +2 -2
  152. package/components/SiteHeader/SiteHeader.css +0 -9
  153. package/components/SourceChip/SourceChip.css +2 -1
  154. package/components/Sparkline/Sparkline.css +20 -0
  155. package/components/Sparkline/Sparkline.d.ts +4 -0
  156. package/components/Sparkline/Sparkline.js +14 -8
  157. package/components/Stat/Stat.css +31 -0
  158. package/components/Stat/Stat.d.ts +23 -2
  159. package/components/Stat/Stat.js +21 -6
  160. package/components/SubNavPanel/SubNavPanel.css +10 -9
  161. package/components/Table/Table.css +409 -14
  162. package/components/Table/Table.d.ts +32 -2
  163. package/components/Table/Table.js +66 -34
  164. package/components/Textarea/Textarea.css +4 -2
  165. package/components/ThemeToggle/colorMode.d.ts +10 -2
  166. package/components/ThemeToggle/colorMode.js +4 -2
  167. package/components/ThreadHistory/ThreadHistory.css +11 -0
  168. package/components/ThreadHistory/ThreadHistory.d.ts +5 -1
  169. package/components/ThreadHistory/ThreadHistory.js +6 -1
  170. package/components/ThreadPanel/ThreadPanel.d.ts +4 -0
  171. package/components/ThreadPanel/ThreadPanel.js +5 -1
  172. package/components/TimePicker/TimePicker.css +3 -1
  173. package/components/TimePicker/TimePicker.d.ts +4 -2
  174. package/components/TimePicker/TimePicker.js +11 -3
  175. package/components/Timeline/Timeline.css +15 -0
  176. package/components/Timeline/Timeline.d.ts +8 -0
  177. package/components/Timeline/Timeline.js +21 -0
  178. package/components/Toast/Toast.css +16 -0
  179. package/components/Toast/Toast.d.ts +7 -2
  180. package/components/ToggleGroup/ToggleGroup.css +28 -2
  181. package/components/ToggleSwitch/ToggleSwitch.css +1 -1
  182. package/components/Tooltip/Tooltip.d.ts +9 -0
  183. package/components/Tooltip/Tooltip.js +34 -8
  184. package/components/TreeView/TreeView.css +12 -0
  185. package/components/TreeView/TreeView.d.ts +4 -0
  186. package/components/TreeView/TreeView.js +20 -0
  187. package/components/UsageCard/UsageCard.css +11 -0
  188. package/components/UsageCard/UsageCard.d.ts +4 -0
  189. package/components/UsageCard/UsageCard.js +25 -16
  190. package/components/Widget/Widget.css +7 -0
  191. package/components/Widget/Widget.d.ts +4 -0
  192. package/components/Widget/Widget.js +14 -2
  193. package/components/registry.json +5 -2
  194. package/components/registry.json.d.ts +5 -2
  195. package/components/registry.json.js +1 -1
  196. package/package.json +9 -3
  197. package/tokens/motion.d.ts +2 -0
  198. package/tokens/motion.js +2 -0
  199. package/tokens/presets/contrast.css +36 -3
  200. package/tokens/presets/coral.css +39 -3
  201. package/tokens/presets/forest.css +55 -3
  202. package/tokens/presets/gold.css +39 -4
  203. package/tokens/presets/marquee.css +42 -4
  204. package/tokens/presets/mono.css +107 -29
  205. package/tokens/presets/pink.css +41 -3
  206. package/tokens/presets/plum.css +41 -1
  207. package/tokens/presets/terminal.css +40 -4
  208. package/tokens/presets/violet.css +42 -3
  209. package/tokens/presets/warm.css +49 -5
  210. package/tokens/presets/zest.css +47 -3
  211. package/tokens/registry.json +2 -0
  212. package/tokens/registry.json.d.ts +2 -0
  213. package/tokens/registry.json.js +1 -1
  214. package/tokens/tokens-dark.css +5 -0
  215. package/tokens/tokens-light.css +9 -0
  216. package/tokens/values.d.ts +14 -1
  217. package/tokens/values.js +14 -1
  218. package/tokens/values.json.js +1 -1
@@ -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,54 @@ 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__ */ jsx("div", { className: `${baseClass}__body`, children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxs(AreaChart$1, { data, margin: { top: 8, right: 4, bottom: 0, left: -12 }, children: [
85
- /* @__PURE__ */ jsx("defs", { children: series.map((s, i) => {
86
- const color = s.color || seriesColors[i % seriesColors.length];
87
- return /* @__PURE__ */ jsxs("linearGradient", { id: `area-gradient-${s.dataKey}`, x1: "0", y1: "0", x2: "0", y2: "1", children: [
88
- /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: color, stopOpacity: 0.4 }),
89
- /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: color, stopOpacity: 0.05 })
90
- ] }, `grad-${s.dataKey}`);
91
- }) }),
92
- /* @__PURE__ */ jsx(CartesianGrid, { vertical: false, stroke: gridColor }),
93
- /* @__PURE__ */ jsx(
94
- XAxis,
95
- {
96
- dataKey: xKey,
97
- tick: { fill: textSecondary, fontSize: textSize },
98
- tickLine: false,
99
- axisLine: { stroke: gridColor }
100
- }
101
- ),
102
- /* @__PURE__ */ jsx(
103
- YAxis,
104
- {
105
- tickFormatter: yAxisFormatter ?? formatTick,
106
- tick: { fill: textSecondary, fontSize: textSize },
107
- tickLine: false,
108
- axisLine: false
109
- }
110
- ),
111
- /* @__PURE__ */ jsx(Tooltip, { content: renderTooltip }),
112
- series.map((s, i) => /* @__PURE__ */ jsx(
113
- Area,
114
- {
115
- ...animation,
116
- type: "monotone",
117
- dataKey: s.dataKey,
118
- name: s.label,
119
- stroke: s.color || seriesColors[i % seriesColors.length],
120
- strokeWidth: 2,
121
- fill: `url(#area-gradient-${s.dataKey})`,
122
- fillOpacity: s.fillOpacity ?? 1,
123
- stackId: stacked ? "stack" : void 0
124
- },
125
- s.dataKey
126
- )),
127
- showLegend && series.length > 1 && /* @__PURE__ */ jsx(Legend, { wrapperStyle: { color: textSecondary, fontSize: textSize } })
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(Legend, { wrapperStyle: { color: textSecondary, fontSize: textSize } })
133
+ ] }) })
134
+ ] })
129
135
  ]
130
136
  }
131
137
  );
@@ -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__ */ jsx("div", { className: `${baseClass}__body`, children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxs(BarChart$1, { data, margin: { top: 8, right: 4, bottom: 0, left: -12 }, children: [
93
- /* @__PURE__ */ jsx(
94
- CartesianGrid,
95
- {
96
- vertical: false,
97
- stroke: gridColor,
98
- strokeDasharray: ""
99
- }
100
- ),
101
- /* @__PURE__ */ jsx(
102
- XAxis,
103
- {
104
- dataKey: xKey,
105
- tick: { fill: textSecondary, fontSize: textSize },
106
- tickLine: false,
107
- axisLine: { stroke: gridColor }
108
- }
109
- ),
110
- /* @__PURE__ */ jsx(
111
- YAxis,
112
- {
113
- tickFormatter: yAxisFormatter ?? formatTick,
114
- tick: { fill: textSecondary, fontSize: textSize },
115
- tickLine: false,
116
- axisLine: false
117
- }
118
- ),
119
- /* @__PURE__ */ jsx(
120
- Tooltip,
121
- {
122
- content: renderTooltip,
123
- cursor: { fill: cursorColor, opacity: 0.4 }
124
- }
125
- ),
126
- /* @__PURE__ */ jsx(
127
- Bar,
128
- {
129
- ...animation,
130
- className: `${baseClass}__bar`,
131
- dataKey: yKey,
132
- fill: resolvedBarColor,
133
- radius: [3, 3, 0, 0],
134
- maxBarSize: 32
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
- border-radius: var(--radius-400); /* 16px */
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
@@ -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
+ };
@@ -45,6 +45,13 @@ type ComboChartOwnProps = {
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
  };