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
package/chat/server.js CHANGED
@@ -1,8 +1,9 @@
1
1
  import Anthropic from "@anthropic-ai/sdk";
2
2
  import { ASK_USER_INPUT_SCHEMA, sanitizeQuestionSet } from "./questions.js";
3
3
  import { SUGGESTION_MAX_CHARS, fitsChip } from "./suggestions.js";
4
- import { confirmationLine, createConfirmationMark, defineAction, planAction, sanitiseConfirmation, skippedText } from "./actions.js";
4
+ import { confirmSequence, confirmationLine, createConfirmationMark, defineAction, planAction, planSequence, sanitiseConfirmation, skippedText } from "./actions.js";
5
5
  import { DEFAULT_SELECTION_LIMITS, sanitiseSelection, selectionLines } from "./selectionContext.js";
6
+ import { defineContext } from "./contextSchema.js";
6
7
  const ASK_USER_TOOL_NAME = "ask_user";
7
8
  const DEFAULT_ASK_USER_DESCRIPTION = [
8
9
  "Offer the person answers to pick for a question your reply has just asked in words.",
@@ -244,6 +245,8 @@ function createChatHandler(options) {
244
245
  send({ type: "status", label: copy.reading });
245
246
  send({ type: "model", label: serving.label });
246
247
  send({ type: "models", default: tierDefault, locked: lockedValues });
248
+ const leads = options.lead ? await Promise.resolve(options.lead(toolContext)).catch(() => []) : [];
249
+ for (const card of leads) send({ type: "card", card: { ...card, lead: true } });
247
250
  const reasoning = createReasoningBuffer(
248
251
  limits.maxTracePoints,
249
252
  (point) => send({ type: "status", label: copy.thinking, point })
@@ -332,6 +335,9 @@ function createChatHandler(options) {
332
335
  });
333
336
  const result = await runTool(block.name, block.input, toolContext);
334
337
  if (result.card) send({ type: "card", card: result.card });
338
+ for (const action of result.actions ?? []) {
339
+ send({ type: "action", action: { ...action, id: action.id ?? crypto.randomUUID() } });
340
+ }
335
341
  results.push({ type: "tool_result", tool_use_id: block.id, content: result.text });
336
342
  }
337
343
  working.push(
@@ -614,6 +620,7 @@ export {
614
620
  DEFAULT_CHAT_COPY,
615
621
  DEFAULT_CHAT_LIMITS,
616
622
  DEFAULT_SELECTION_LIMITS,
623
+ confirmSequence,
617
624
  confirmationLine,
618
625
  createChatHandler,
619
626
  createConfirmationMark,
@@ -621,9 +628,11 @@ export {
621
628
  createFollowupsHandler,
622
629
  createStartersHandler,
623
630
  defineAction,
631
+ defineContext,
624
632
  followupsSystemPrompt,
625
633
  parseFollowups,
626
634
  planAction,
635
+ planSequence,
627
636
  sanitiseConfirmation,
628
637
  sanitisePath,
629
638
  sanitiseSelection,
@@ -36,3 +36,10 @@
36
36
  export declare const SUGGESTION_MAX_CHARS = 30;
37
37
  /** Whether a suggestion label is one the chip row can actually show. */
38
38
  export declare function fitsChip(label: string): boolean;
39
+ /**
40
+ * Keeps the suggestions a host wrote that fit the chip row, and warns once in
41
+ * development about each one it drops, naming where it came from. A host's
42
+ * own copy running long is a mistake worth pointing at; a model's suggestion
43
+ * running long is not, so the producers of model output call `fitsChip` alone.
44
+ */
45
+ export declare function keepFittingSuggestions<T>(items: readonly T[], labelOf: (item: T) => string, where: string): T[];
@@ -1,9 +1,21 @@
1
+ import { warnOnce } from "../behaviors/devWarning.js";
1
2
  const SUGGESTION_MAX_CHARS = 30;
2
3
  function fitsChip(label) {
3
4
  const trimmed = label.trim();
4
5
  return trimmed !== "" && trimmed.length <= SUGGESTION_MAX_CHARS;
5
6
  }
7
+ function keepFittingSuggestions(items, labelOf, where) {
8
+ return items.filter((item) => {
9
+ const label = labelOf(item);
10
+ if (fitsChip(label)) return true;
11
+ warnOnce(
12
+ `${where}: "${label}" was dropped. A suggestion is one chip and a chip never wraps, so it must fit in ${SUGGESTION_MAX_CHARS} characters (SUGGESTION_MAX_CHARS).`
13
+ );
14
+ return false;
15
+ });
16
+ }
6
17
  export {
7
18
  SUGGESTION_MAX_CHARS,
8
- fitsChip
19
+ fitsChip,
20
+ keepFittingSuggestions
9
21
  };
package/chat/types.d.ts CHANGED
@@ -78,6 +78,22 @@ export interface ChatReply {
78
78
  answers: string[];
79
79
  }[];
80
80
  }
81
+ /**
82
+ * A change for the page itself, which lives in the browser where a server
83
+ * tool cannot reach: navigation, a table's view, the open tab, the theme. A
84
+ * tool returns it and the handler streams it; the provider runs the
85
+ * `pageActions` handler of the same `name` once, as the event arrives. The
86
+ * page owns what each name may do and checks `input` itself, since it came
87
+ * from the model.
88
+ */
89
+ export interface ChatPageAction {
90
+ /** Unique within the conversation: the provider runs each id once. */
91
+ id: string;
92
+ /** Which of the provider's `pageActions` runs it. An unknown name is ignored. */
93
+ name: string;
94
+ /** What the handler is handed. Must survive JSON. */
95
+ input?: unknown;
96
+ }
81
97
  export type ChatEvent =
82
98
  /** A live status step: the AgentStatus label, with an optional reasoning trace point. */
83
99
  {
@@ -143,6 +159,13 @@ export type ChatEvent =
143
159
  type: 'question';
144
160
  set: ChatQuestionSet;
145
161
  }
162
+ /** Something for the page to do in the browser (go to a page, set a
163
+ table's view, open a tab), run once by the provider's `pageActions` as
164
+ it arrives. Never re-run when the thread redraws or the panel reopens. */
165
+ | {
166
+ type: 'action';
167
+ action: ChatPageAction;
168
+ }
146
169
  /** Terminal: the response is complete. */
147
170
  | {
148
171
  type: 'done';
package/chat/useChat.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { AttachmentItem } from '../components/Attachment/fileTypes';
3
- import { ChatQuestionAnswer, ChatReply, ChatTransport, ChatTurn, LiveResponse } from './types';
3
+ import { ChatPageAction, ChatQuestionAnswer, ChatReply, ChatTransport, ChatTurn, LiveResponse } from './types';
4
4
  /** The copy the hook writes itself: the status line of a reply that has not started, and the reply it shows when a transport ends a turn with nothing to show. */
5
5
  export interface ChatPlaceholderCopy {
6
6
  /** A completion that produced no text. */
@@ -82,4 +82,4 @@ export interface ChatState {
82
82
  * streamed-text choreography. It knows nothing about rendering or about
83
83
  * where events come from; the transport decides that.
84
84
  */
85
- export declare function useChat(transport: ChatTransport, placeholders?: ChatPlaceholderCopy): ChatState;
85
+ export declare function useChat(transport: ChatTransport, placeholders?: ChatPlaceholderCopy, onAction?: (action: ChatPageAction) => void): ChatState;
package/chat/useChat.js CHANGED
@@ -11,13 +11,18 @@ const DEFAULT_PLACEHOLDER_COPY = {
11
11
  failed: "Something went wrong while replying. Try sending that again.",
12
12
  thinking: "Thinking"
13
13
  };
14
- function useChat(transport, placeholders = DEFAULT_PLACEHOLDER_COPY) {
14
+ function useChat(transport, placeholders = DEFAULT_PLACEHOLDER_COPY, onAction) {
15
15
  const [turns, setTurns] = useState([]);
16
16
  const [live, setLive] = useState(null);
17
17
  const [modelLabel, setModelLabel] = useState(null);
18
18
  const [modelPolicy, setModelPolicy] = useState(null);
19
19
  const abortRef = useRef(null);
20
20
  const busyRef = useRef(false);
21
+ const onActionRef = useRef(onAction);
22
+ useEffect(() => {
23
+ onActionRef.current = onAction;
24
+ }, [onAction]);
25
+ const ranActionsRef = useRef(/* @__PURE__ */ new Set());
21
26
  const historyRef = useRef([]);
22
27
  const generationRef = useRef(0);
23
28
  useEffect(() => () => abortRef.current?.abort(), []);
@@ -138,6 +143,15 @@ function useChat(transport, placeholders = DEFAULT_PLACEHOLDER_COPY) {
138
143
  if (set) current = { ...current, question: set };
139
144
  break;
140
145
  }
146
+ case "action":
147
+ if (typeof event.action?.id === "string" && typeof event.action.name === "string" && !ranActionsRef.current.has(event.action.id)) {
148
+ ranActionsRef.current.add(event.action.id);
149
+ try {
150
+ onActionRef.current?.(event.action);
151
+ } catch {
152
+ }
153
+ }
154
+ break;
141
155
  case "status":
142
156
  update({
143
157
  ...current,
@@ -94,6 +94,18 @@
94
94
  margin: 0;
95
95
  }
96
96
 
97
+ /* ============================================
98
+ ACTIONS
99
+ ============================================ */
100
+
101
+ .ds-alert__actions {
102
+ display: flex;
103
+ flex-wrap: wrap;
104
+ align-items: center;
105
+ gap: var(--gap-200); /* 8px */
106
+ margin-block-start: var(--gap-200); /* 8px */
107
+ }
108
+
97
109
  /* ============================================
98
110
  DISMISS BUTTON
99
111
  ============================================ */
@@ -12,6 +12,8 @@ type AlertOwnProps = {
12
12
  variant?: 'info' | 'positive' | 'warning' | 'error' | 'neutral';
13
13
  /** Component size */
14
14
  size?: 'default' | 'compact';
15
+ /** Actions under the description: one or two compact Buttons or a Link that act on what the alert says (retry, review, undo). */
16
+ action?: React.ReactNode;
15
17
  /** Whether the alert can be dismissed */
16
18
  dismissible?: boolean;
17
19
  /** Custom icon override — Material Symbol name (string) or custom element (ReactNode) */
@@ -13,6 +13,7 @@ const Alert = React.forwardRef(
13
13
  ({
14
14
  title,
15
15
  description,
16
+ action,
16
17
  variant = "info",
17
18
  size = "default",
18
19
  dismissible = false,
@@ -38,7 +39,8 @@ const Alert = React.forwardRef(
38
39
  ) : /* @__PURE__ */ jsx("span", { className: `${baseClass}__icon`, "aria-hidden": "true", children: iconValue }),
39
40
  /* @__PURE__ */ jsxs("div", { className: `${baseClass}__content`, children: [
40
41
  title && /* @__PURE__ */ jsx("p", { className: `${baseClass}__title`, children: title }),
41
- description && /* @__PURE__ */ jsx("p", { className: `${baseClass}__description`, children: description })
42
+ description && /* @__PURE__ */ jsx("p", { className: `${baseClass}__description`, children: description }),
43
+ action != null && action !== false && /* @__PURE__ */ jsx("div", { className: `${baseClass}__actions`, children: action })
42
44
  ] }),
43
45
  dismissible && /* @__PURE__ */ jsx(
44
46
  "button",
@@ -82,6 +82,18 @@
82
82
  border-inline-end-color: transparent;
83
83
  }
84
84
 
85
+ /* The inset rail and its side panel are the plane's own colour, so on a
86
+ wide screen they are drawn clear and the plane shows through. Filled,
87
+ they stack above the page and paint over the side of the raised
88
+ surface's shadow that falls on them, leaving a straight cut beside the
89
+ surface. The phone drawer keeps its fill (its own rule below). */
90
+ @media not (max-width: 768px) {
91
+ .ds-app-sidebar--inset:not(.ds-app-sidebar--mobile-open),
92
+ .ds-app-sidebar__panel--inset {
93
+ background-color: transparent;
94
+ }
95
+ }
96
+
85
97
  /* ============================================
86
98
  TOP SECTION — logo + nav
87
99
  ============================================ */
@@ -1042,3 +1042,95 @@ button.ds-attachment-group__single:focus-visible {
1042
1042
  letter-spacing: var(--font-paragraph-sm-letter-spacing);
1043
1043
  color: var(--color-text-secondary);
1044
1044
  }
1045
+
1046
+ /* ============================================
1047
+ FILE ROW — one file in a list
1048
+ The family's type mark, the name over a line
1049
+ of detail, controls at the end. Rows sit in a
1050
+ list on --color-divider, as a WidgetRow list.
1051
+ ============================================ */
1052
+
1053
+ .ds-file-row {
1054
+ --ds-attachment-mark-size: var(--icon-size-800);
1055
+
1056
+ display: flex;
1057
+ align-items: center;
1058
+ gap: var(--gap-300);
1059
+ min-width: 0;
1060
+ padding-block: var(--padding-300);
1061
+ }
1062
+
1063
+ .ds-file-row--compact {
1064
+ --ds-attachment-mark-size: var(--icon-size-600);
1065
+
1066
+ gap: var(--gap-200);
1067
+ padding-block: var(--padding-200);
1068
+ }
1069
+
1070
+ .ds-file-row + .ds-file-row {
1071
+ border-block-start: var(--border-025) solid var(--color-divider);
1072
+ }
1073
+
1074
+ .ds-file-row__main {
1075
+ display: flex;
1076
+ flex: 1 1 auto;
1077
+ flex-direction: column;
1078
+ gap: var(--gap-050);
1079
+ min-width: 0;
1080
+ }
1081
+
1082
+ .ds-file-row__name {
1083
+ overflow: hidden;
1084
+ text-overflow: ellipsis;
1085
+ white-space: nowrap;
1086
+ font-family: var(--font-paragraph-sm-emphasis-family);
1087
+ font-size: var(--font-paragraph-sm-emphasis-size);
1088
+ font-weight: var(--font-paragraph-sm-emphasis-weight);
1089
+ line-height: var(--font-paragraph-sm-emphasis-line-height);
1090
+ letter-spacing: var(--font-paragraph-sm-emphasis-letter-spacing);
1091
+ color: var(--color-text-primary);
1092
+ }
1093
+
1094
+ /* The name that opens the file reads as the row's own text, underlined on
1095
+ hover and focus the way a link answers. */
1096
+ .ds-file-row__name--action {
1097
+ display: block;
1098
+ max-width: 100%;
1099
+ margin: 0;
1100
+ padding: 0;
1101
+ border: none;
1102
+ background: none;
1103
+ text-align: start;
1104
+ text-decoration: none;
1105
+ cursor: pointer;
1106
+ border-radius: var(--radius-100);
1107
+ }
1108
+
1109
+ .ds-file-row__name--action:hover,
1110
+ .ds-file-row__name--action:focus-visible {
1111
+ text-decoration: underline;
1112
+ }
1113
+
1114
+ .ds-file-row__name--action:focus-visible {
1115
+ outline: 2px solid var(--color-action-primary-bg);
1116
+ outline-offset: 2px;
1117
+ }
1118
+
1119
+ .ds-file-row__meta {
1120
+ overflow: hidden;
1121
+ text-overflow: ellipsis;
1122
+ white-space: nowrap;
1123
+ font-family: var(--font-caption-family);
1124
+ font-size: var(--font-caption-size);
1125
+ font-weight: var(--font-caption-weight);
1126
+ line-height: var(--font-caption-line-height);
1127
+ letter-spacing: var(--font-caption-letter-spacing);
1128
+ color: var(--color-text-tertiary);
1129
+ }
1130
+
1131
+ .ds-file-row__actions {
1132
+ display: inline-flex;
1133
+ flex-shrink: 0;
1134
+ align-items: center;
1135
+ gap: var(--gap-100);
1136
+ }
@@ -0,0 +1,47 @@
1
+ import { default as React } from 'react';
2
+ import { LinkComponent } from '../../behaviors/LinkProvider';
3
+ import { FileKind } from './fileTypes';
4
+ /** Props owned by FileRow itself; everything else falls through to the root `<div>`. */
5
+ type FileRowOwnProps = {
6
+ /** The file's name with its extension (`Q3 report.pdf`), which also picks its type mark. */
7
+ name: string;
8
+ /** The file's MIME type, when its name has no telling extension. */
9
+ mimeType?: string;
10
+ /**
11
+ * The file's kind, when neither its name nor its MIME type says it.
12
+ * @default picked from the name and the MIME type
13
+ */
14
+ kind?: FileKind;
15
+ /** The type mark's lettering, in place of the one derived from the name. */
16
+ typeLabel?: string;
17
+ /** A quiet second line: the size, who added it, when. */
18
+ meta?: React.ReactNode;
19
+ /** Makes the name a link to the file or its preview page. */
20
+ href?: string;
21
+ /** Makes the name a button that opens the file in place, such as in a DocumentViewer dialog. `href` wins when both are set. */
22
+ onOpen?: () => void;
23
+ /** Controls at the row's end: a download, a share, a menu. */
24
+ actions?: React.ReactNode;
25
+ /** Row density: `compact` for a list in a side panel. */
26
+ size?: 'default' | 'compact';
27
+ /**
28
+ * The component the name's link renders with, such as Next.js's `Link`, so
29
+ * it navigates through the app's router; a plain `<a>` when unset. This
30
+ * component can render on the server, so it never reads a LinkProvider:
31
+ * pass the prop even under one.
32
+ */
33
+ linkComponent?: LinkComponent;
34
+ /** Additional CSS classes */
35
+ className?: string;
36
+ };
37
+ export interface FileRowProps extends FileRowOwnProps, Omit<React.ComponentPropsWithRef<'div'>, keyof FileRowOwnProps | 'children'> {
38
+ }
39
+ /**
40
+ * One file in a list: its type mark, its name and a line of detail, with
41
+ * controls at the end. The name opens the file, as a link or a button, so a
42
+ * document library, a record's attachments or a shared folder reads as rows
43
+ * a keyboard can walk. The mark is the attachment family's own, so a file
44
+ * looks the same as a row, a tile and in the viewer. Server-renderable.
45
+ */
46
+ export declare function FileRow({ name, mimeType, kind, typeLabel, meta, href, onOpen, actions, size, linkComponent, className, ref, ...rest }: FileRowProps): React.JSX.Element;
47
+ export {};
@@ -0,0 +1,38 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import "react";
3
+ import { getFileKind } from "./fileTypes.js";
4
+ import { renderTypeMark } from "./typeMark.js";
5
+ import "./Attachment.css";
6
+ function FileRow({
7
+ name,
8
+ mimeType,
9
+ kind,
10
+ typeLabel,
11
+ meta,
12
+ href,
13
+ onOpen,
14
+ actions,
15
+ size = "default",
16
+ linkComponent,
17
+ className = "",
18
+ ref,
19
+ ...rest
20
+ }) {
21
+ const Link = linkComponent ?? "a";
22
+ const resolvedKind = kind ?? getFileKind({ name, type: mimeType });
23
+ const hasMeta = meta != null && meta !== false && meta !== "";
24
+ const hasActions = actions != null && actions !== false;
25
+ const classes = ["ds-file-row", size === "compact" ? "ds-file-row--compact" : "", className].filter(Boolean).join(" ");
26
+ const nameClass = "ds-file-row__name";
27
+ return /* @__PURE__ */ jsxs("div", { ...rest, ref, className: classes, children: [
28
+ renderTypeMark(name, resolvedKind, { typeLabel }),
29
+ /* @__PURE__ */ jsxs("span", { className: "ds-file-row__main", children: [
30
+ href !== void 0 ? /* @__PURE__ */ jsx(Link, { href, className: `${nameClass} ds-file-row__name--action`, children: name }) : onOpen ? /* @__PURE__ */ jsx("button", { type: "button", className: `${nameClass} ds-file-row__name--action`, onClick: onOpen, children: name }) : /* @__PURE__ */ jsx("span", { className: nameClass, children: name }),
31
+ hasMeta && /* @__PURE__ */ jsx("span", { className: "ds-file-row__meta", children: meta })
32
+ ] }),
33
+ hasActions && /* @__PURE__ */ jsx("span", { className: "ds-file-row__actions", children: actions })
34
+ ] });
35
+ }
36
+ export {
37
+ FileRow
38
+ };
@@ -32,6 +32,20 @@
32
32
  height: 56px;
33
33
  }
34
34
 
35
+ /* ============================================
36
+ SQUARE (an organisation)
37
+ A logo is fitted whole, never cropped to the box.
38
+ ============================================ */
39
+
40
+ .ds-avatar--square,
41
+ .ds-avatar--square .ds-avatar__image {
42
+ border-radius: var(--radius-300);
43
+ }
44
+
45
+ .ds-avatar--square .ds-avatar__image {
46
+ object-fit: contain;
47
+ }
48
+
35
49
  /* ============================================
36
50
  IMAGE
37
51
  ============================================ */
@@ -4,12 +4,14 @@ import { AvatarFill } from './avatarFill';
4
4
  type AvatarOwnProps = {
5
5
  /** Image source URL */
6
6
  src?: string;
7
- /** Alt text for the image, also the avatar's accessible name. A passed `aria-label` takes precedence. */
7
+ /** Alt text for the image, also the avatar's accessible name. A passed `aria-label` takes precedence. An organisation's avatar (`shape="square"`) should pass it, or it is announced as a user's. */
8
8
  alt?: string;
9
9
  /** User's name — used for initials fallback */
10
10
  name?: string;
11
11
  /** Avatar size */
12
12
  size?: 'sm' | 'md' | 'lg';
13
+ /** `circle` for a person; `square` for an organisation (a company, a bank, a vendor, an integration): rounded corners on the radius scale, a logo fitted whole rather than cropped, and a building glyph when there is no image or name. */
14
+ shape?: 'circle' | 'square';
13
15
  /**
14
16
  * Which of the six fills the initials sit on. Picked from the name when
15
17
  * unset, so a person keeps one colour everywhere; `neutral` keeps the
@@ -10,6 +10,7 @@ const Avatar = React.forwardRef(
10
10
  alt,
11
11
  name,
12
12
  size = "md",
13
+ shape = "circle",
13
14
  fill,
14
15
  status,
15
16
  statusLabel,
@@ -21,7 +22,7 @@ const Avatar = React.forwardRef(
21
22
  const sizeClass = `${baseClass}--${size}`;
22
23
  const fillIndex = name?.trim() && fill !== "neutral" ? fill ?? avatarFill(name.trim()) : null;
23
24
  const fillClass = fillIndex ? `${baseClass}--fill-${fillIndex}` : "";
24
- const classes = [baseClass, sizeClass, fillClass, className].filter(Boolean).join(" ");
25
+ const classes = [baseClass, sizeClass, shape === "square" ? `${baseClass}--square` : "", fillClass, className].filter(Boolean).join(" ");
25
26
  const getInitials = (fullName) => {
26
27
  const parts = fullName.trim().split(/\s+/);
27
28
  if (parts.length === 1) return parts[0][0].toUpperCase();
@@ -47,7 +48,7 @@ const Avatar = React.forwardRef(
47
48
  {
48
49
  className: `${baseClass}__icon material-symbols-rounded`,
49
50
  "aria-hidden": "true",
50
- children: "person"
51
+ children: shape === "square" ? "domain" : "person"
51
52
  }
52
53
  ),
53
54
  status && /* @__PURE__ */ jsx(
@@ -7,7 +7,12 @@
7
7
  /* Layout */
8
8
  display: inline-flex; /* Hug content instead of stretch */
9
9
  width: auto; /* Don't stretch to full width */
10
- overflow: hidden;
10
+ max-width: 100%;
11
+ }
12
+
13
+ /* A button never shrinks to fit: a label cut mid-word is unreadable. */
14
+ .ds-button-group > * {
15
+ flex: none;
11
16
  }
12
17
 
13
18
  /* ============================================
@@ -19,6 +24,10 @@
19
24
  flex-direction: row;
20
25
  gap: var(--gap-500); /* Figma: --gap/lg (20px) */
21
26
  align-items: flex-start;
27
+ /* A row wider than its container wraps onto a second line at the tight
28
+ step, so it still reads as one group. */
29
+ flex-wrap: wrap;
30
+ row-gap: var(--gap-200);
22
31
  }
23
32
 
24
33
  /* ============================================
@@ -33,6 +33,8 @@ type AreaChartOwnProps = {
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
  /** Show the legend under a multi-series chart */
37
39
  showLegend?: boolean;
38
40
  /** Strip the card chrome (border, padding, fill) when the chart sits inside another panel that supplies the surface */
@@ -33,6 +33,7 @@ const AreaChart = React.forwardRef(({
33
33
  showLegend = true,
34
34
  bare = false,
35
35
  className = "",
36
+ yAxisFormatter,
36
37
  locale: localeProp,
37
38
  ...rest
38
39
  }, ref) => {
@@ -96,7 +97,7 @@ const AreaChart = React.forwardRef(({
96
97
  /* @__PURE__ */ jsx(
97
98
  YAxis,
98
99
  {
99
- tickFormatter: formatTick,
100
+ tickFormatter: yAxisFormatter ?? formatTick,
100
101
  tick: { fill: textSecondary, fontSize: textSize },
101
102
  tickLine: false,
102
103
  axisLine: false
@@ -30,6 +30,8 @@ type BarChartOwnProps = {
30
30
  barColor?: string;
31
31
  /** Chart area height in pixels */
32
32
  height?: number;
33
+ /** Y-axis tick formatter, such as a currency or a percent. Defaults to a short number in the chart's locale. */
34
+ yAxisFormatter?: (value: number) => string;
33
35
  /** Strip the card chrome (border, padding, fill) when the chart sits inside another panel that supplies the surface */
34
36
  bare?: boolean;
35
37
  /** Additional CSS classes on the wrapper */
@@ -40,6 +40,7 @@ const BarChart = React.forwardRef(({
40
40
  height = 350,
41
41
  bare = false,
42
42
  className = "",
43
+ yAxisFormatter,
43
44
  locale: localeProp,
44
45
  ...rest
45
46
  }, ref) => {
@@ -104,7 +105,7 @@ const BarChart = React.forwardRef(({
104
105
  /* @__PURE__ */ jsx(
105
106
  YAxis,
106
107
  {
107
- tickFormatter: formatTick,
108
+ tickFormatter: yAxisFormatter ?? formatTick,
108
109
  tick: { fill: textSecondary, fontSize: textSize },
109
110
  tickLine: false,
110
111
  axisLine: false
@@ -33,6 +33,10 @@ type ComboChartOwnProps = {
33
33
  summaryItems?: ChartSummaryItem[];
34
34
  /** Chart area height in pixels */
35
35
  height?: number;
36
+ /** Tick formatter for the bar series' axis, such as a currency. Defaults to a short number in the chart's locale. */
37
+ yAxisFormatter?: (value: number) => string;
38
+ /** Tick formatter for the line series' axis when `secondaryAxis` draws it, such as a percent. Defaults to a short number in the chart's locale. */
39
+ secondaryAxisFormatter?: (value: number) => string;
36
40
  /** Strip the card chrome (border, padding, fill) when the chart sits inside another panel that supplies the surface */
37
41
  bare?: boolean;
38
42
  /** Additional CSS classes on the wrapper */
@@ -43,6 +43,8 @@ const ComboChart = React.forwardRef(({
43
43
  height = 350,
44
44
  bare = false,
45
45
  className = "",
46
+ yAxisFormatter,
47
+ secondaryAxisFormatter,
46
48
  locale: localeProp,
47
49
  ...rest
48
50
  }, ref) => {
@@ -109,7 +111,7 @@ const ComboChart = React.forwardRef(({
109
111
  /* @__PURE__ */ jsx(
110
112
  YAxis,
111
113
  {
112
- tickFormatter: formatTick,
114
+ tickFormatter: yAxisFormatter ?? formatTick,
113
115
  yAxisId: "bar",
114
116
  tick: { fill: textSecondary, fontSize: textSize },
115
117
  tickLine: false,
@@ -119,7 +121,7 @@ const ComboChart = React.forwardRef(({
119
121
  secondaryAxis && /* @__PURE__ */ jsx(
120
122
  YAxis,
121
123
  {
122
- tickFormatter: formatTick,
124
+ tickFormatter: secondaryAxisFormatter ?? formatTick,
123
125
  yAxisId: "line",
124
126
  orientation: "right",
125
127
  tick: { fill: textSecondary, fontSize: textSize },
@@ -31,6 +31,8 @@ type LineChartOwnProps = {
31
31
  summaryItems?: ChartSummaryItem[];
32
32
  /** Chart area height in pixels */
33
33
  height?: number;
34
+ /** Y-axis tick formatter, such as a currency or a percent. Defaults to a short number in the chart's locale. */
35
+ yAxisFormatter?: (value: number) => string;
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
  /** Additional CSS classes on the wrapper */
@@ -31,6 +31,7 @@ const LineChart = React.forwardRef(({
31
31
  height = 350,
32
32
  bare = false,
33
33
  className = "",
34
+ yAxisFormatter,
34
35
  locale: localeProp,
35
36
  ...rest
36
37
  }, ref) => {
@@ -87,7 +88,7 @@ const LineChart = React.forwardRef(({
87
88
  /* @__PURE__ */ jsx(
88
89
  YAxis,
89
90
  {
90
- tickFormatter: formatTick,
91
+ tickFormatter: yAxisFormatter ?? formatTick,
91
92
  tick: { fill: textSecondary, fontSize: textSize },
92
93
  tickLine: false,
93
94
  axisLine: false
@@ -25,10 +25,10 @@ type PieChartOwnProps = {
25
25
  summaryItems?: ChartSummaryItem[];
26
26
  /** Chart area height in pixels */
27
27
  height?: number;
28
- /** Inner radius for donut style (0 = solid pie) */
29
- innerRadius?: number;
30
- /** Outer radius */
31
- outerRadius?: number;
28
+ /** Inner radius for a donut (0 for a solid pie): pixels, or a percentage of the room the plot has, such as `'60%'`, so the hole scales with the chart. */
29
+ innerRadius?: number | string;
30
+ /** Outer radius: pixels, or a percentage of the room the plot has once the header and legend take theirs. Defaults to `'90%'`, so the pie fits any `height` without running into its legend. */
31
+ outerRadius?: number | string;
32
32
  /** Show legend */
33
33
  showLegend?: boolean;
34
34
  /** Strip the card chrome (border, padding, fill) when the chart sits inside another panel that supplies the surface */