rift-ds 1.29.0 → 1.31.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 (194) hide show
  1. package/README.md +6 -3
  2. package/behaviors/locale.d.ts +7 -0
  3. package/behaviors/locale.js +5 -0
  4. package/behaviors/shell.css +33 -0
  5. package/bin/rift-ds.mjs +36 -10
  6. package/bin/templates/app/components/rift/ColorModeScript.tsx +7 -3
  7. package/bin/templates/blocks/app/planner/PlannerGrid.tsx +58 -0
  8. package/bin/templates/blocks/app/planner/Requests.tsx +42 -0
  9. package/bin/templates/blocks/app/planner/page.module.css +17 -0
  10. package/bin/templates/blocks/app/planner/page.tsx +32 -0
  11. package/bin/templates/blocks/app/settings/ProfileForm.tsx +98 -0
  12. package/bin/templates/blocks/app/settings/page.module.css +11 -0
  13. package/bin/templates/blocks/app/settings/page.tsx +84 -0
  14. package/bin/templates/blocks/components/blocks/AppShell.module.css +8 -41
  15. package/bin/templates/blocks/components/blocks/AppShell.tsx +9 -11
  16. package/bin/templates/blocks/registry.json +27 -0
  17. package/bin/templates/chat/app/api/chat/feedback/route.ts +0 -3
  18. package/bin/templates/chat/app/api/chat/followups/route.ts +0 -3
  19. package/bin/templates/chat/app/api/chat/route.actions.ts +108 -0
  20. package/bin/templates/chat/app/api/chat/route.ts +0 -2
  21. package/bin/templates/chat/components/chat/ChatMount.actions.tsx +55 -0
  22. package/bin/templates/chat/components/chat/ChatMount.tsx +14 -1
  23. package/bin/templates/chat/components/chat/proposals/ProposalCard.tsx +81 -0
  24. package/bin/templates/chat/components/chat/proposals/actions.ts +60 -0
  25. package/bin/templates/chat/components/chat/proposals/confirmation.ts +9 -0
  26. package/bin/templates/chat/components/chat/proposals/renderers.tsx +9 -0
  27. package/chat/ChatLauncher.d.ts +13 -2
  28. package/chat/ChatLauncher.js +9 -2
  29. package/chat/ChatProvider.d.ts +19 -2
  30. package/chat/ChatProvider.js +26 -3
  31. package/chat/ChatWidget.css +10 -0
  32. package/chat/ChatWidget.d.ts +2 -1
  33. package/chat/ChatWidget.js +8 -6
  34. package/chat/actions.d.ts +52 -6
  35. package/chat/actions.js +53 -5
  36. package/chat/contextSchema.d.ts +76 -0
  37. package/chat/contextSchema.js +58 -0
  38. package/chat/index.d.ts +2 -2
  39. package/chat/index.js +5 -1
  40. package/chat/registry.json.d.ts +2 -2
  41. package/chat/registry.json.js +1 -1
  42. package/chat/server.d.ts +18 -2
  43. package/chat/server.js +10 -1
  44. package/chat/suggestions.d.ts +7 -0
  45. package/chat/suggestions.js +13 -1
  46. package/chat/types.d.ts +23 -0
  47. package/chat/useChat.d.ts +2 -2
  48. package/chat/useChat.js +15 -1
  49. package/components/Alert/Alert.css +12 -0
  50. package/components/Alert/Alert.d.ts +2 -0
  51. package/components/Alert/Alert.js +3 -1
  52. package/components/AppSidebar/AppSidebar.css +12 -0
  53. package/components/Attachment/Attachment.css +92 -0
  54. package/components/Attachment/FileRow.d.ts +47 -0
  55. package/components/Attachment/FileRow.js +38 -0
  56. package/components/Avatar/Avatar.css +14 -0
  57. package/components/Avatar/Avatar.d.ts +3 -1
  58. package/components/Avatar/Avatar.js +3 -2
  59. package/components/ButtonGroup/ButtonGroup.css +10 -1
  60. package/components/Chart/AreaChart.d.ts +2 -0
  61. package/components/Chart/AreaChart.js +2 -1
  62. package/components/Chart/BarChart.d.ts +2 -0
  63. package/components/Chart/BarChart.js +2 -1
  64. package/components/Chart/ComboChart.d.ts +4 -0
  65. package/components/Chart/ComboChart.js +4 -2
  66. package/components/Chart/LineChart.d.ts +2 -0
  67. package/components/Chart/LineChart.js +2 -1
  68. package/components/Chart/PieChart.d.ts +4 -4
  69. package/components/Chart/PieChart.js +1 -1
  70. package/components/Chart/RadarChart.js +24 -10
  71. package/components/Chart/ScatterChart.d.ts +2 -0
  72. package/components/Chart/ScatterChart.js +2 -1
  73. package/components/Checklist/Checklist.css +123 -0
  74. package/components/Checklist/Checklist.d.ts +66 -0
  75. package/components/Checklist/Checklist.js +115 -0
  76. package/components/CircularButton/CircularButton.css +39 -0
  77. package/components/CircularButton/CircularButton.d.ts +13 -0
  78. package/components/CircularButton/CircularButton.js +18 -4
  79. package/components/ColourSwatch/ColourSwatch.css +3 -1
  80. package/components/ColourSwatch/ColourSwatch.d.ts +5 -3
  81. package/components/ColourSwatch/ColourSwatch.js +5 -0
  82. package/components/Combobox/Combobox.d.ts +4 -2
  83. package/components/Combobox/Combobox.js +7 -3
  84. package/components/DataTable/DataTable.css +52 -2
  85. package/components/DataTable/DataTable.d.ts +47 -3
  86. package/components/DataTable/DataTable.js +71 -7
  87. package/components/DataTable/columnTypes.d.ts +1 -1
  88. package/components/DataTable/columnTypes.js +1 -1
  89. package/components/DataTable/periodColumns.d.ts +37 -0
  90. package/components/DataTable/periodColumns.js +48 -0
  91. package/components/DateInput/DateInput.d.ts +4 -2
  92. package/components/DateInput/DateInput.js +7 -3
  93. package/components/DatePicker/DatePicker.css +22 -6
  94. package/components/DatePicker/DatePicker.d.ts +2 -1
  95. package/components/DatePicker/DatePicker.js +2 -2
  96. package/components/DateRangePicker/DateRangePicker.js +2 -2
  97. package/components/DecisionRow/DecisionRow.css +46 -0
  98. package/components/DecisionRow/DecisionRow.d.ts +62 -0
  99. package/components/DecisionRow/DecisionRow.js +93 -0
  100. package/components/DescriptionList/DescriptionList.css +28 -0
  101. package/components/DescriptionList/DescriptionList.d.ts +3 -1
  102. package/components/DescriptionList/DescriptionList.js +4 -3
  103. package/components/DescriptionList/DescriptionListCopy.js +2 -0
  104. package/components/Dropdown/Dropdown.d.ts +4 -2
  105. package/components/Dropdown/Dropdown.js +7 -3
  106. package/components/EmptyState/EmptyState.css +12 -0
  107. package/components/EmptyState/EmptyState.d.ts +7 -0
  108. package/components/EmptyState/EmptyState.js +2 -0
  109. package/components/EventCalendar/EventCalendar.css +113 -0
  110. package/components/EventCalendar/EventCalendar.d.ts +48 -4
  111. package/components/EventCalendar/EventCalendar.js +145 -25
  112. package/components/FormSection/FormSection.css +70 -0
  113. package/components/FormSection/FormSection.d.ts +35 -0
  114. package/components/FormSection/FormSection.js +35 -0
  115. package/components/FunnelChart/FunnelChart.js +33 -22
  116. package/components/Globe/Globe.css +7 -0
  117. package/components/Globe/Globe.js +1 -1
  118. package/components/Grid/Grid.css +52 -0
  119. package/components/Grid/Grid.d.ts +30 -0
  120. package/components/Grid/Grid.js +36 -0
  121. package/components/Icon/Icon.css +55 -0
  122. package/components/Icon/Icon.d.ts +27 -0
  123. package/components/Icon/Icon.js +42 -0
  124. package/components/NumberInput/NumberInput.d.ts +4 -2
  125. package/components/NumberInput/NumberInput.js +7 -3
  126. package/components/OrgChart/OrgChart.css +143 -0
  127. package/components/OrgChart/OrgChart.d.ts +44 -0
  128. package/components/OrgChart/OrgChart.js +26 -0
  129. package/components/PageHeader/PageHeader.css +74 -0
  130. package/components/PageHeader/PageHeader.d.ts +39 -0
  131. package/components/PageHeader/PageHeader.js +33 -0
  132. package/components/Panel/Panel.css +7 -0
  133. package/components/Panel/Panel.d.ts +5 -2
  134. package/components/Panel/Panel.js +2 -1
  135. package/components/ResourceTimeline/ResourceTimeline.css +194 -0
  136. package/components/ResourceTimeline/ResourceTimeline.d.ts +57 -0
  137. package/components/ResourceTimeline/ResourceTimeline.js +129 -0
  138. package/components/ShaderField/useShaderField.js +13 -1
  139. package/components/ShaderScene/ShaderScene.d.ts +3 -2
  140. package/components/ShaderScene/ShaderScene.js +47 -4
  141. package/components/Stack/Stack.css +68 -0
  142. package/components/Stack/Stack.d.ts +37 -0
  143. package/components/Stack/Stack.js +39 -0
  144. package/components/Stat/Stat.css +65 -0
  145. package/components/Stat/Stat.d.ts +7 -1
  146. package/components/Stat/Stat.js +16 -1
  147. package/components/Table/Table.css +18 -0
  148. package/components/Table/Table.d.ts +2 -0
  149. package/components/Table/Table.js +6 -2
  150. package/components/Tabs/Tabs.css +44 -3
  151. package/components/Tabs/Tabs.d.ts +9 -8
  152. package/components/Tabs/Tabs.js +38 -5
  153. package/components/Textarea/Textarea.d.ts +4 -2
  154. package/components/Textarea/Textarea.js +7 -3
  155. package/components/ThemeToggle/colorMode.d.ts +17 -1
  156. package/components/ThemeToggle/colorMode.js +11 -2
  157. package/components/Timeline/Timeline.css +8 -0
  158. package/components/Widget/Widget.css +23 -0
  159. package/components/Widget/Widget.d.ts +4 -0
  160. package/components/Widget/Widget.js +13 -5
  161. package/components/Wizard/Wizard.css +67 -0
  162. package/components/Wizard/Wizard.d.ts +54 -0
  163. package/components/Wizard/Wizard.js +71 -0
  164. package/components/WorldMap/WorldMap.css +15 -0
  165. package/components/WorldMap/WorldMap.js +56 -1
  166. package/components/registry.d.ts +25 -0
  167. package/components/registry.js +8 -0
  168. package/components/registry.json +251 -33
  169. package/components/registry.json.d.ts +251 -33
  170. package/components/registry.json.js +1 -1
  171. package/index.d.ts +11 -0
  172. package/index.js +26 -0
  173. package/package.json +1 -1
  174. package/tokens/motion.d.ts +2 -0
  175. package/tokens/motion.js +2 -0
  176. package/tokens/presets/blueprint.css +9 -0
  177. package/tokens/presets/bubblegum.css +9 -0
  178. package/tokens/presets/contrast.css +3 -3
  179. package/tokens/presets/coral.css +3 -3
  180. package/tokens/presets/ember.css +9 -0
  181. package/tokens/presets/getaway.css +9 -0
  182. package/tokens/presets/gold.css +3 -3
  183. package/tokens/presets/mono.css +3 -3
  184. package/tokens/presets/pink.css +3 -3
  185. package/tokens/presets/plum.css +3 -3
  186. package/tokens/presets/signal.css +9 -0
  187. package/tokens/presets/smoke.css +9 -0
  188. package/tokens/presets/velvet.css +9 -0
  189. package/tokens/presets/violet.css +3 -3
  190. package/tokens/presets/volt.css +9 -0
  191. package/tokens/presets/warm.css +3 -3
  192. package/tokens/values.d.ts +31 -0
  193. package/tokens/values.js +16 -0
  194. package/tokens/values.json.js +1 -1
@@ -32,7 +32,7 @@ const PieChart = React.forwardRef(({
32
32
  summaryItems,
33
33
  height = 350,
34
34
  innerRadius = 0,
35
- outerRadius = 140,
35
+ outerRadius = "90%",
36
36
  showLegend = true,
37
37
  bare = false,
38
38
  className = "",
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { jsx, jsxs } from "react/jsx-runtime";
3
- import React, { useCallback, useId } from "react";
2
+ import { jsxs, jsx } from "react/jsx-runtime";
3
+ 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";
@@ -48,6 +48,26 @@ const RadarChart = React.forwardRef(({
48
48
  const textSize = readTokenPx("--font-caption-size", "12px");
49
49
  const gridColor = getCSSVar("--color-divider", "rgba(214, 214, 214, 0.8)");
50
50
  const seriesColors = getChartSeriesColors();
51
+ const [bodyWidth, setBodyWidth] = useState(0);
52
+ const charWidth = textSize * 0.6;
53
+ const labelRoom = Math.ceil(Math.max(0, ...data.map((d) => String(d[categoryKey] ?? "").length)) * charWidth) + 12;
54
+ const half = Math.min(bodyWidth, height) / 2;
55
+ const outerRadius = bodyWidth > 0 ? Math.min(half * 0.7, Math.max(half * 0.45, bodyWidth / 2 - labelRoom)) : "70%";
56
+ const renderAngleTick = useCallback(
57
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
58
+ (props) => {
59
+ const { x, y, payload, textAnchor } = props;
60
+ const full = String(payload?.value ?? "");
61
+ const room = bodyWidth <= 0 ? Infinity : textAnchor === "end" ? x - 2 : textAnchor === "start" ? bodyWidth - x - 2 : 2 * Math.min(x, bodyWidth - x) - 4;
62
+ const fits = Math.max(1, Math.floor(room / charWidth));
63
+ const text = full.length > fits ? `${full.slice(0, Math.max(1, fits - 1))}…` : full;
64
+ return /* @__PURE__ */ jsxs("text", { x, y, textAnchor, dominantBaseline: "central", fill: textSecondary, fontSize: textSize, children: [
65
+ text !== full && /* @__PURE__ */ jsx("title", { children: full }),
66
+ text
67
+ ] });
68
+ },
69
+ [bodyWidth, charWidth, textSecondary, textSize]
70
+ );
51
71
  const renderTooltip = useCallback(
52
72
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
53
73
  (props) => /* @__PURE__ */ jsx(RadarTooltip, { ...props, locale }),
@@ -73,15 +93,9 @@ const RadarChart = React.forwardRef(({
73
93
  /* @__PURE__ */ jsx("span", { className: `${baseClass}__summary-value`, children: typeof item.value === "number" ? formatNumber(item.value, locale) : item.value })
74
94
  ] }, i)) })
75
95
  ] }),
76
- /* @__PURE__ */ jsx("div", { className: `${baseClass}__body`, children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxs(RadarChart$1, { data, cx: "50%", cy: "50%", outerRadius: "70%", children: [
96
+ /* @__PURE__ */ jsx("div", { className: `${baseClass}__body`, children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height, onResize: (width) => setBodyWidth(width), children: /* @__PURE__ */ jsxs(RadarChart$1, { data, cx: "50%", cy: "50%", outerRadius, children: [
77
97
  /* @__PURE__ */ jsx(PolarGrid, { stroke: gridColor }),
78
- /* @__PURE__ */ jsx(
79
- PolarAngleAxis,
80
- {
81
- dataKey: categoryKey,
82
- tick: { fill: textSecondary, fontSize: textSize }
83
- }
84
- ),
98
+ /* @__PURE__ */ jsx(PolarAngleAxis, { dataKey: categoryKey, tick: renderAngleTick }),
85
99
  /* @__PURE__ */ jsx(
86
100
  PolarRadiusAxis,
87
101
  {
@@ -33,6 +33,8 @@ type ScatterChartOwnProps = {
33
33
  summaryItems?: ChartSummaryItem[];
34
34
  /** Chart area height in pixels */
35
35
  height?: number;
36
+ /** Y-axis tick formatter, such as a currency or a percent. Defaults to a short number in the chart's locale. */
37
+ yAxisFormatter?: (value: number) => string;
36
38
  /** Strip the card chrome (border, padding, fill) when the chart sits inside another panel that supplies the surface */
37
39
  bare?: boolean;
38
40
  /** Additional CSS classes on the wrapper */
@@ -38,6 +38,7 @@ const ScatterChart = React.forwardRef(({
38
38
  height = 350,
39
39
  bare = false,
40
40
  className = "",
41
+ yAxisFormatter,
41
42
  locale: localeProp,
42
43
  ...rest
43
44
  }, ref) => {
@@ -99,7 +100,7 @@ const ScatterChart = React.forwardRef(({
99
100
  /* @__PURE__ */ jsx(
100
101
  YAxis,
101
102
  {
102
- tickFormatter: formatTick,
103
+ tickFormatter: yAxisFormatter ?? formatTick,
103
104
  type: "number",
104
105
  dataKey: yKey,
105
106
  name: yLabel,
@@ -0,0 +1,123 @@
1
+ /* ============================================
2
+ CHECKLIST
3
+ A heading with the count done and a bar, then
4
+ one row per task: the Checkbox with its label
5
+ and description, and at the row's end the
6
+ owner's avatar and an action. Rows divide like
7
+ a WidgetRow list, on --color-divider.
8
+ ============================================ */
9
+
10
+ /* Base */
11
+ .ds-checklist {
12
+ display: flex;
13
+ flex-direction: column;
14
+ gap: var(--gap-400);
15
+ min-width: 0;
16
+ }
17
+
18
+ /* Header */
19
+ .ds-checklist__header {
20
+ display: flex;
21
+ flex-direction: column;
22
+ gap: var(--gap-200);
23
+ }
24
+
25
+ .ds-checklist__title {
26
+ margin: 0;
27
+ }
28
+
29
+ .ds-checklist__progress {
30
+ display: flex;
31
+ align-items: center;
32
+ gap: var(--gap-300);
33
+ }
34
+
35
+ .ds-checklist__count {
36
+ flex-shrink: 0;
37
+ font-family: var(--font-paragraph-sm-family);
38
+ font-size: var(--font-paragraph-sm-size);
39
+ font-weight: var(--font-paragraph-sm-weight);
40
+ line-height: var(--font-paragraph-sm-line-height);
41
+ letter-spacing: var(--font-paragraph-sm-letter-spacing);
42
+ color: var(--color-text-secondary);
43
+ font-variant-numeric: tabular-nums;
44
+ }
45
+
46
+ .ds-checklist__bar {
47
+ flex: 1 1 auto;
48
+ min-width: 0;
49
+ }
50
+
51
+ /* List */
52
+ .ds-checklist__list {
53
+ display: flex;
54
+ flex-direction: column;
55
+ margin: 0;
56
+ padding: 0;
57
+ list-style: none;
58
+ }
59
+
60
+ .ds-checklist__item {
61
+ display: flex;
62
+ align-items: center;
63
+ justify-content: space-between;
64
+ gap: var(--gap-300);
65
+ padding-block: var(--padding-300);
66
+ border-block-end: var(--border-025) solid var(--color-divider);
67
+ }
68
+
69
+ .ds-checklist__item:last-child {
70
+ border-block-end: none;
71
+ }
72
+
73
+ .ds-checklist--compact .ds-checklist__item {
74
+ padding-block: var(--padding-200);
75
+ }
76
+
77
+ .ds-checklist__task {
78
+ min-width: 0;
79
+ }
80
+
81
+ /* Owner and action at the row's end */
82
+ .ds-checklist__meta {
83
+ display: flex;
84
+ align-items: center;
85
+ gap: var(--gap-200);
86
+ flex-shrink: 0;
87
+ }
88
+
89
+ /* Read-only rows: the shared box beside the label, in Checkbox's own type. */
90
+ .ds-checklist__static {
91
+ display: flex;
92
+ align-items: flex-start;
93
+ gap: var(--gap-200);
94
+ }
95
+
96
+ .ds-checklist__text {
97
+ display: flex;
98
+ flex-direction: column;
99
+ gap: var(--gap-050);
100
+ min-width: 0;
101
+ }
102
+
103
+ .ds-checklist__label {
104
+ font-family: var(--font-paragraph-family);
105
+ font-size: var(--font-paragraph-size);
106
+ font-weight: var(--font-paragraph-weight);
107
+ line-height: var(--font-paragraph-line-height);
108
+ letter-spacing: var(--font-paragraph-letter-spacing);
109
+ color: var(--color-text-primary);
110
+ }
111
+
112
+ .ds-checklist--compact .ds-checklist__label,
113
+ .ds-checklist__description {
114
+ font-family: var(--font-paragraph-sm-family);
115
+ font-size: var(--font-paragraph-sm-size);
116
+ font-weight: var(--font-paragraph-sm-weight);
117
+ line-height: var(--font-paragraph-sm-line-height);
118
+ letter-spacing: var(--font-paragraph-sm-letter-spacing);
119
+ }
120
+
121
+ .ds-checklist__description {
122
+ color: var(--color-text-tertiary);
123
+ }
@@ -0,0 +1,66 @@
1
+ import { default as React } from 'react';
2
+ /** One task on a checklist. */
3
+ export interface ChecklistItem {
4
+ /** A stable id, which `values` holds while the task is done. */
5
+ id: string;
6
+ /** What the task is ("Invite your team"). */
7
+ label: string;
8
+ /** A line under the label on what doing it involves. */
9
+ description?: string;
10
+ /** Who the task is with: a name, and an image for their avatar. */
11
+ owner?: {
12
+ name: string;
13
+ src?: string;
14
+ };
15
+ /** A control at the end of the row that does the task or opens it, such as a compact Button or a Link. */
16
+ action?: React.ReactNode;
17
+ /** Holds the task as it is: it cannot be ticked or unticked. */
18
+ disabled?: boolean;
19
+ }
20
+ /** Props owned by Checklist itself; everything else falls through to the root `<section>`. */
21
+ type ChecklistOwnProps = {
22
+ /** The tasks, in the order they are best done. */
23
+ items: ChecklistItem[];
24
+ /**
25
+ * The checklist's heading, which names its section.
26
+ * Note: this shadows the native `title` tooltip attribute, which Checklist does not expose.
27
+ */
28
+ title?: string;
29
+ /** The ids of the done tasks, for a controlled list. Leave undefined to let the list keep its own, seeded from `defaultValues`. */
30
+ values?: string[];
31
+ /** The ids done on first render when the list is uncontrolled. */
32
+ defaultValues?: string[];
33
+ /** Fires with every done id after a task is ticked or unticked. */
34
+ onValuesChange?: (values: string[]) => void;
35
+ /** Shows the done marks without letting them change, for a list that reports what the host already knows (a setup's steps, a review's checks). */
36
+ readOnly?: boolean;
37
+ /** Shows how many tasks are done, as a count and a bar, under the heading. Defaults to true. */
38
+ showProgress?: boolean;
39
+ /** The progress count, given the done and total tasks already written in the resolved locale. Defaults to "3 of 5 done". */
40
+ progressLabel?: (done: string, total: string) => string;
41
+ /** The owner avatar's accessible name, given the owner's name. Defaults to "Owner: <name>". */
42
+ ownerLabel?: (name: string) => string;
43
+ /** A read-only row's state, read after its label. Defaults to "Done". */
44
+ doneLabel?: string;
45
+ /** A read-only row's state when it is not done. Defaults to "Not done". */
46
+ notDoneLabel?: string;
47
+ /** The BCP 47 locale the counts are written in, such as `ar-EG`. Defaults to the nearest LocaleProvider's, else `en-US`. */
48
+ locale?: string;
49
+ /** Row density: `compact` for a checklist in a side panel. */
50
+ size?: 'default' | 'compact';
51
+ /** The title's place in the outline. Defaults to 3, a part of a section. */
52
+ headingLevel?: 2 | 3 | 4;
53
+ /** Additional CSS classes */
54
+ className?: string;
55
+ };
56
+ export interface ChecklistProps extends ChecklistOwnProps, Omit<React.ComponentPropsWithRef<'section'>, keyof ChecklistOwnProps | 'children'> {
57
+ }
58
+ /**
59
+ * Tasks with a done state each: a setup to finish, an onboarding to work
60
+ * through, the checks before a release. Each row is a Checkbox with the
61
+ * task's label and description, its owner's avatar and an optional action,
62
+ * under a heading with the count done and a bar. Read-only, it reports done
63
+ * marks the host owns.
64
+ */
65
+ export declare function Checklist({ items, title, values, defaultValues, onValuesChange, readOnly, showProgress, progressLabel, ownerLabel, doneLabel, notDoneLabel, locale: localeProp, size, headingLevel, className, ref, ...rest }: ChecklistProps): React.JSX.Element;
66
+ export {};
@@ -0,0 +1,115 @@
1
+ "use client";
2
+ import { jsxs, jsx } from "react/jsx-runtime";
3
+ import { useId, useState } from "react";
4
+ import { Avatar } from "../Avatar/Avatar.js";
5
+ import { CheckboxIndicator, Checkbox } from "../Checkbox/Checkbox.js";
6
+ import { Heading } from "../Heading/Heading.js";
7
+ import { ProgressBar } from "../ProgressBar/ProgressBar.js";
8
+ import { formatNumber } from "../../behaviors/locale.js";
9
+ import { useLocale } from "../../behaviors/LocaleProvider.js";
10
+ import "../../behaviors/visually-hidden.css";
11
+ import "./Checklist.css";
12
+ const defaultProgressLabel = (done, total) => `${done} of ${total} done`;
13
+ const defaultOwnerLabel = (name) => `Owner: ${name}`;
14
+ function Checklist({
15
+ items,
16
+ title,
17
+ values,
18
+ defaultValues,
19
+ onValuesChange,
20
+ readOnly = false,
21
+ showProgress = true,
22
+ progressLabel = defaultProgressLabel,
23
+ ownerLabel = defaultOwnerLabel,
24
+ doneLabel = "Done",
25
+ notDoneLabel = "Not done",
26
+ locale: localeProp,
27
+ size = "default",
28
+ headingLevel = 3,
29
+ className = "",
30
+ ref,
31
+ ...rest
32
+ }) {
33
+ const locale = useLocale(localeProp);
34
+ const headingId = useId();
35
+ const [internal, setInternal] = useState(() => defaultValues ?? []);
36
+ const done = values ?? internal;
37
+ const doneSet = new Set(done);
38
+ const doneCount = items.filter((item) => doneSet.has(item.id)).length;
39
+ const total = items.length;
40
+ const toggle = (id, checked) => {
41
+ const next = checked ? [...done.filter((v) => v !== id), id] : done.filter((v) => v !== id);
42
+ if (values === void 0) setInternal(next);
43
+ onValuesChange?.(next);
44
+ };
45
+ const countText = progressLabel(formatNumber(doneCount, locale), formatNumber(total, locale));
46
+ const classes = ["ds-checklist", size === "compact" ? "ds-checklist--compact" : "", className].filter(Boolean).join(" ");
47
+ return /* @__PURE__ */ jsxs("section", { "aria-labelledby": title ? headingId : void 0, ...rest, ref, className: classes, children: [
48
+ (title || showProgress) && /* @__PURE__ */ jsxs("div", { className: "ds-checklist__header", children: [
49
+ title && /* @__PURE__ */ jsx(Heading, { id: headingId, level: headingLevel, tier: "title-body", className: "ds-checklist__title", children: title }),
50
+ showProgress && total > 0 && /* @__PURE__ */ jsxs("div", { className: "ds-checklist__progress", children: [
51
+ /* @__PURE__ */ jsx("span", { className: "ds-checklist__count", children: countText }),
52
+ /* @__PURE__ */ jsx(
53
+ ProgressBar,
54
+ {
55
+ value: doneCount / total * 100,
56
+ size: "compact",
57
+ "aria-label": countText,
58
+ locale,
59
+ className: "ds-checklist__bar"
60
+ }
61
+ )
62
+ ] })
63
+ ] }),
64
+ /* @__PURE__ */ jsx("ul", { className: "ds-checklist__list", children: items.map((item) => {
65
+ const isDone = doneSet.has(item.id);
66
+ return /* @__PURE__ */ jsxs(
67
+ "li",
68
+ {
69
+ className: ["ds-checklist__item", isDone ? "ds-checklist__item--done" : ""].filter(Boolean).join(" "),
70
+ children: [
71
+ /* @__PURE__ */ jsx("div", { className: "ds-checklist__task", children: readOnly ? /* @__PURE__ */ jsxs("div", { className: "ds-checklist__static", children: [
72
+ /* @__PURE__ */ jsx(CheckboxIndicator, { checked: isDone, size }),
73
+ /* @__PURE__ */ jsxs("span", { className: "ds-checklist__text", children: [
74
+ /* @__PURE__ */ jsxs("span", { className: "ds-checklist__label", children: [
75
+ item.label,
76
+ /* @__PURE__ */ jsxs("span", { className: "ds-visually-hidden", children: [
77
+ ", ",
78
+ isDone ? doneLabel : notDoneLabel
79
+ ] })
80
+ ] }),
81
+ item.description && /* @__PURE__ */ jsx("span", { className: "ds-checklist__description", children: item.description })
82
+ ] })
83
+ ] }) : /* @__PURE__ */ jsx(
84
+ Checkbox,
85
+ {
86
+ label: item.label,
87
+ helperText: item.description,
88
+ checked: isDone,
89
+ disabled: item.disabled,
90
+ size,
91
+ onCheckedChange: (checked) => toggle(item.id, checked)
92
+ }
93
+ ) }),
94
+ (item.owner || item.action) && /* @__PURE__ */ jsxs("div", { className: "ds-checklist__meta", children: [
95
+ item.owner && /* @__PURE__ */ jsx(
96
+ Avatar,
97
+ {
98
+ name: item.owner.name,
99
+ src: item.owner.src,
100
+ size: "sm",
101
+ "aria-label": ownerLabel(item.owner.name)
102
+ }
103
+ ),
104
+ item.action
105
+ ] })
106
+ ]
107
+ },
108
+ item.id
109
+ );
110
+ }) })
111
+ ] });
112
+ }
113
+ export {
114
+ Checklist
115
+ };
@@ -388,3 +388,42 @@
388
388
  outline: 2px solid var(--color-action-primary-bg);
389
389
  outline-offset: 2px;
390
390
  }
391
+
392
+ /* ============================================
393
+ BADGE
394
+ A count or a dot on the top-end corner, in
395
+ BottomNav's count-badge treatment.
396
+ ============================================ */
397
+
398
+ .ds-circular-button--badged {
399
+ position: relative;
400
+ }
401
+
402
+ .ds-circular-button__badge {
403
+ position: absolute;
404
+ inset-block-start: calc(var(--padding-100) * -1);
405
+ inset-inline-end: calc(var(--padding-100) * -1);
406
+ box-sizing: border-box;
407
+ min-width: 16px;
408
+ height: 16px;
409
+ padding: 0 var(--padding-100);
410
+ border-radius: var(--radius-pill);
411
+ background-color: var(--color-count-badge-bg);
412
+ color: var(--color-count-badge-text);
413
+ font-family: var(--font-caption-family);
414
+ font-size: var(--font-caption-size);
415
+ font-weight: var(--font-paragraph-sm-emphasis-weight);
416
+ line-height: var(--font-caption-line-height);
417
+ text-align: center;
418
+ white-space: nowrap;
419
+ pointer-events: none;
420
+ }
421
+
422
+ .ds-circular-button__badge--dot {
423
+ inset-block-start: var(--padding-050);
424
+ inset-inline-end: var(--padding-050);
425
+ min-width: 0;
426
+ width: 8px;
427
+ height: 8px;
428
+ padding: 0;
429
+ }
@@ -64,6 +64,19 @@ type CircularButtonOwnProps = {
64
64
  target?: string;
65
65
  /** Optional rel attribute for links */
66
66
  rel?: string;
67
+ /** A mark on the button's top-end corner, as BottomNav draws one: a count (a notification bell's unread), or `true` for a dot with no number. */
68
+ badge?: number | string | true;
69
+ /** The highest count the badge spells out; a larger one reads "99+". Defaults to 99. */
70
+ badgeMax?: number;
71
+ /**
72
+ * Text read after `ariaLabel` while the button carries a badge, given the
73
+ * badge. Defaults to ", new" for a dot and ", 3 new" for a count; the
74
+ * leading comma and space are part of the text. The tooltip keeps
75
+ * `ariaLabel` alone.
76
+ */
77
+ badgeLabel?: (badge: number | string | true) => string;
78
+ /** The BCP 47 locale a numeric badge is written in, such as `ar-EG`. Defaults to `en-US`. This component can render from a Server Component, so it takes the prop alone and reads no LocaleProvider. */
79
+ locale?: string;
67
80
  /** Additional CSS classes */
68
81
  className?: string;
69
82
  /**
@@ -1,10 +1,11 @@
1
- import { jsx } from "react/jsx-runtime";
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import React from "react";
3
3
  import { Spinner } from "../Spinner/Spinner.js";
4
4
  import { Tooltip } from "../Tooltip/Tooltip.js";
5
5
  import "./CircularButton.css";
6
6
  import "../../fonts/material-symbols.css";
7
7
  import { mirrorClass } from "../../behaviors/direction.js";
8
+ import { formatNumber, DEFAULT_LOCALE } from "../../behaviors/locale.js";
8
9
  function resolveCircularButtonCell(variant, tone) {
9
10
  const emphasis = variant === "neutral" ? "primary" : variant;
10
11
  const resolvedTone = tone ?? (variant === "neutral" ? "neutral" : "default");
@@ -32,6 +33,10 @@ const CircularButton = React.forwardRef(
32
33
  href,
33
34
  target,
34
35
  rel,
36
+ badge,
37
+ badgeMax = 99,
38
+ badgeLabel = defaultBadgeLabel,
39
+ locale = DEFAULT_LOCALE,
35
40
  className = "",
36
41
  linkComponent,
37
42
  ...rest
@@ -48,9 +53,17 @@ const CircularButton = React.forwardRef(
48
53
  `${baseClass}--${resolvedState}`,
49
54
  `${baseClass}--${size}`,
50
55
  isLoading && `${baseClass}--loading`,
56
+ badge !== void 0 && `${baseClass}--badged`,
51
57
  className
52
58
  ].filter(Boolean).join(" ");
53
- const children = isLoading ? /* @__PURE__ */ jsx("span", { className: `${baseClass}__icon`, "aria-hidden": "true", children: /* @__PURE__ */ jsx(Spinner, { size: size === "compact" ? "sm" : "md", tone: "inherit" }) }) : /* @__PURE__ */ jsx("span", { className: `${baseClass}__icon${typeof icon === "string" ? ` material-symbols-rounded ${mirrorClass(icon)}` : ""}`, "aria-hidden": "true", children: icon });
59
+ const glyph = isLoading ? /* @__PURE__ */ jsx("span", { className: `${baseClass}__icon`, "aria-hidden": "true", children: /* @__PURE__ */ jsx(Spinner, { size: size === "compact" ? "sm" : "md", tone: "inherit" }) }) : /* @__PURE__ */ jsx("span", { className: `${baseClass}__icon${typeof icon === "string" ? ` material-symbols-rounded ${mirrorClass(icon)}` : ""}`, "aria-hidden": "true", children: icon });
60
+ const badgeText = badge === void 0 || badge === true ? null : typeof badge === "number" ? badge > badgeMax ? `${formatNumber(badgeMax, locale)}+` : formatNumber(badge, locale) : badge;
61
+ const children = /* @__PURE__ */ jsxs(Fragment, { children: [
62
+ glyph,
63
+ badge === true && /* @__PURE__ */ jsx("span", { className: `${baseClass}__badge ${baseClass}__badge--dot`, "aria-hidden": "true" }),
64
+ badgeText !== null && /* @__PURE__ */ jsx("span", { className: `${baseClass}__badge`, "aria-hidden": "true", children: badgeText })
65
+ ] });
66
+ const accessibleName = badge === void 0 ? ariaLabel : `${ariaLabel}${badgeLabel(badge)}`;
54
67
  const control = href && !isDisabled && !isLoading ? /* @__PURE__ */ jsx(
55
68
  Link,
56
69
  {
@@ -60,7 +73,7 @@ const CircularButton = React.forwardRef(
60
73
  href,
61
74
  target,
62
75
  rel,
63
- "aria-label": ariaLabel,
76
+ "aria-label": accessibleName,
64
77
  children
65
78
  }
66
79
  ) : /* @__PURE__ */ jsx(
@@ -72,7 +85,7 @@ const CircularButton = React.forwardRef(
72
85
  className: classes,
73
86
  disabled: isDisabled || isLoading,
74
87
  "aria-busy": isLoading || void 0,
75
- "aria-label": ariaLabel,
88
+ "aria-label": accessibleName,
76
89
  children
77
90
  }
78
91
  );
@@ -82,6 +95,7 @@ const CircularButton = React.forwardRef(
82
95
  }
83
96
  );
84
97
  CircularButton.displayName = "CircularButton";
98
+ const defaultBadgeLabel = (badge) => badge === true ? ", new" : `, ${badge} new`;
85
99
  export {
86
100
  CircularButton
87
101
  };
@@ -13,7 +13,9 @@
13
13
  /* Sizing */
14
14
  flex: 1 1 0;
15
15
  min-width: 250px;
16
- height: 360px;
16
+ /* A floor, not a fixed height: a long token name wraps onto more lines in
17
+ a narrow column, and the card grows rather than cutting its last row. */
18
+ min-height: 360px;
17
19
 
18
20
  /* Appearance */
19
21
  border: var(--border-025) solid var(--color-bg-container-border);
@@ -22,13 +22,15 @@ export interface ColourSwatchProps {
22
22
  status?: boolean;
23
23
  /** CSS custom property for the status left border colour */
24
24
  borderVar?: string;
25
+ /** The label of the row that prints the token's name, the value of `cssVar`, as text */
26
+ tokenLabel?: string;
25
27
  /** Additional CSS classes */
26
28
  className?: string;
27
29
  }
28
30
  /**
29
31
  * ColourSwatch component from Figma design system
30
- * Displays a colour swatch card with a values box showing
31
- * Primitive, Hex, and RGB. Values switch when theme changes.
32
+ * Displays a colour swatch card with a values box showing the
33
+ * token's name, then Primitive, Hex, and RGB. Values switch when theme changes.
32
34
  * Used on Semantic colours and Primitive colours pages.
33
35
  */
34
- export declare const ColourSwatch: ({ label, cssVar, dark, light, theme, status, borderVar, className, }: ColourSwatchProps) => React.JSX.Element;
36
+ export declare const ColourSwatch: ({ label, cssVar, dark, light, theme, status, borderVar, tokenLabel, className, }: ColourSwatchProps) => React.JSX.Element;
@@ -9,6 +9,7 @@ const ColourSwatch = ({
9
9
  theme = "dark",
10
10
  status = false,
11
11
  borderVar,
12
+ tokenLabel = "Token",
12
13
  className = ""
13
14
  }) => {
14
15
  const baseClass = "ds-colour-swatch";
@@ -22,6 +23,10 @@ const ColourSwatch = ({
22
23
  return /* @__PURE__ */ jsxs("div", { className: classes, style, children: [
23
24
  /* @__PURE__ */ jsx("div", { className: `${baseClass}__title-box`, children: /* @__PURE__ */ jsx("h3", { className: `${baseClass}__title`, children: label }) }),
24
25
  /* @__PURE__ */ jsxs("div", { className: `${baseClass}__values`, children: [
26
+ /* @__PURE__ */ jsxs("div", { className: `${baseClass}__row`, children: [
27
+ /* @__PURE__ */ jsx("span", { className: `${baseClass}__label`, children: tokenLabel }),
28
+ /* @__PURE__ */ jsx("span", { className: `${baseClass}__data`, children: cssVar })
29
+ ] }),
25
30
  values.primitive && /* @__PURE__ */ jsxs("div", { className: `${baseClass}__row`, children: [
26
31
  /* @__PURE__ */ jsx("span", { className: `${baseClass}__label`, children: "Primitive" }),
27
32
  /* @__PURE__ */ jsx("span", { className: `${baseClass}__data`, children: values.primitive })
@@ -45,10 +45,12 @@ type ComboboxOwnProps = {
45
45
  disabled?: boolean;
46
46
  /** Whether the combobox is required */
47
47
  required?: boolean;
48
- /** Error state — shows error styling and message */
48
+ /** Error state: marks the control invalid and, in the older form without `errorText`, recolours the helper text as the error message. */
49
49
  error?: boolean;
50
- /** Helper or error message displayed below the field */
50
+ /** Helper text displayed below the control. With the older `error` flag and no `errorText`, it doubles as the error message. */
51
51
  helperText?: string;
52
+ /** The error message, shown under the control while the helper text keeps its place. Setting it marks the control invalid, so `error` is not needed alongside it; Field's spec owns the wiring. */
53
+ errorText?: React.ReactNode;
52
54
  /** Show a loading affordance in the menu — for async option fetching */
53
55
  loading?: boolean;
54
56
  /** Message shown when the filter matches no options */
@@ -20,6 +20,7 @@ const Combobox = React.forwardRef(({
20
20
  required = false,
21
21
  error = false,
22
22
  helperText,
23
+ errorText,
23
24
  loading = false,
24
25
  emptyMessage = "No results found",
25
26
  loadingMessage = "Loading…",
@@ -212,11 +213,13 @@ const Combobox = React.forwardRef(({
212
213
  }, [focusedIndex, isOpen]);
213
214
  const listboxId = `${inputId}-listbox`;
214
215
  const activeOptionId = focusedIndex >= 0 && filteredOptions[focusedIndex] ? `${inputId}-option-${filteredOptions[focusedIndex].value}` : void 0;
216
+ const hasErrorText = errorText != null && errorText !== false && errorText !== "";
217
+ const invalid = error || hasErrorText;
215
218
  const classes = [
216
219
  baseClass,
217
220
  size === "compact" ? `${baseClass}--compact` : "",
218
221
  isOpen ? `${baseClass}--open` : "",
219
- error ? `${baseClass}--error` : "",
222
+ invalid ? `${baseClass}--error` : "",
220
223
  disabled ? `${baseClass}--disabled` : "",
221
224
  multiple ? `${baseClass}--multiple` : "",
222
225
  className
@@ -259,6 +262,7 @@ const Combobox = React.forwardRef(({
259
262
  ref: setRootRef,
260
263
  label,
261
264
  helperText,
265
+ errorText,
262
266
  error,
263
267
  required,
264
268
  disabled,
@@ -306,8 +310,8 @@ const Combobox = React.forwardRef(({
306
310
  "aria-activedescendant": activeOptionId,
307
311
  "aria-label": ariaLabelAttr ?? ariaLabel ?? (!label ? placeholder : void 0),
308
312
  "aria-labelledby": ariaLabelledBy,
309
- "aria-describedby": [ariaDescribedBy, helperText ? `${inputId}-helper` : void 0].filter(Boolean).join(" ") || void 0,
310
- "aria-invalid": error || void 0,
313
+ "aria-describedby": [ariaDescribedBy, hasErrorText ? `${inputId}-error` : void 0, helperText ? `${inputId}-helper` : void 0].filter(Boolean).join(" ") || void 0,
314
+ "aria-invalid": invalid || void 0,
311
315
  "aria-required": required || void 0,
312
316
  placeholder: multiple && hasSelection ? "" : placeholder,
313
317
  value: inputValue,