rift-ds 1.28.0 → 1.30.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 (140) hide show
  1. package/README.md +5 -4
  2. package/bin/rift-ds.mjs +5 -4
  3. package/bin/templates/app/components/rift/ColorModeScript.tsx +7 -3
  4. package/bin/templates/blocks/app/settings/ProfileForm.tsx +98 -0
  5. package/bin/templates/blocks/app/settings/page.module.css +11 -0
  6. package/bin/templates/blocks/app/settings/page.tsx +84 -0
  7. package/bin/templates/blocks/app/shader/page.module.css +75 -0
  8. package/bin/templates/blocks/app/shader/page.tsx +81 -0
  9. package/bin/templates/blocks/components/blocks/AppShell.module.css +8 -41
  10. package/bin/templates/blocks/components/blocks/AppShell.tsx +9 -11
  11. package/bin/templates/blocks/components/blocks/emberScene.ts +53 -0
  12. package/bin/templates/blocks/registry.json +24 -0
  13. package/bin/templates/chat/app/api/chat/feedback/route.ts +0 -3
  14. package/bin/templates/chat/app/api/chat/followups/route.ts +0 -3
  15. package/bin/templates/chat/app/api/chat/route.ts +0 -2
  16. package/chat/ChatLauncher.d.ts +9 -1
  17. package/chat/ChatLauncher.js +3 -1
  18. package/chat/threads.js +7 -4
  19. package/components/Alert/Alert.css +12 -0
  20. package/components/Alert/Alert.d.ts +2 -0
  21. package/components/Alert/Alert.js +3 -1
  22. package/components/Attachment/Attachment.css +92 -0
  23. package/components/Attachment/FileRow.d.ts +47 -0
  24. package/components/Attachment/FileRow.js +38 -0
  25. package/components/Avatar/Avatar.css +14 -0
  26. package/components/Avatar/Avatar.d.ts +3 -1
  27. package/components/Avatar/Avatar.js +3 -2
  28. package/components/Button/Button.css +38 -0
  29. package/components/Button/Button.d.ts +8 -0
  30. package/components/Button/Button.js +2 -0
  31. package/components/Chart/AreaChart.d.ts +2 -0
  32. package/components/Chart/AreaChart.js +2 -1
  33. package/components/Chart/BarChart.d.ts +2 -0
  34. package/components/Chart/BarChart.js +2 -1
  35. package/components/Chart/ComboChart.d.ts +4 -0
  36. package/components/Chart/ComboChart.js +4 -2
  37. package/components/Chart/LineChart.d.ts +2 -0
  38. package/components/Chart/LineChart.js +2 -1
  39. package/components/Chart/PieChart.d.ts +4 -4
  40. package/components/Chart/PieChart.js +1 -1
  41. package/components/Chart/ScatterChart.d.ts +2 -0
  42. package/components/Chart/ScatterChart.js +2 -1
  43. package/components/Checklist/Checklist.css +123 -0
  44. package/components/Checklist/Checklist.d.ts +66 -0
  45. package/components/Checklist/Checklist.js +115 -0
  46. package/components/CircularButton/CircularButton.css +39 -0
  47. package/components/CircularButton/CircularButton.d.ts +13 -0
  48. package/components/CircularButton/CircularButton.js +18 -4
  49. package/components/ColourSwatch/ColourSwatch.css +3 -1
  50. package/components/ColourSwatch/ColourSwatch.d.ts +5 -3
  51. package/components/ColourSwatch/ColourSwatch.js +5 -0
  52. package/components/Combobox/Combobox.d.ts +4 -2
  53. package/components/Combobox/Combobox.js +7 -3
  54. package/components/DataTable/DataTable.css +35 -0
  55. package/components/DataTable/DataTable.d.ts +34 -2
  56. package/components/DataTable/DataTable.js +58 -5
  57. package/components/DataTable/columnTypes.d.ts +1 -1
  58. package/components/DataTable/columnTypes.js +1 -1
  59. package/components/DateInput/DateInput.d.ts +4 -2
  60. package/components/DateInput/DateInput.js +7 -3
  61. package/components/DescriptionList/DescriptionList.css +28 -0
  62. package/components/DescriptionList/DescriptionList.d.ts +3 -1
  63. package/components/DescriptionList/DescriptionList.js +4 -3
  64. package/components/DescriptionList/DescriptionListCopy.js +2 -0
  65. package/components/Dropdown/Dropdown.d.ts +4 -2
  66. package/components/Dropdown/Dropdown.js +7 -3
  67. package/components/EmptyState/EmptyState.css +12 -0
  68. package/components/EmptyState/EmptyState.d.ts +7 -0
  69. package/components/EmptyState/EmptyState.js +2 -0
  70. package/components/EventCalendar/EventCalendar.css +59 -0
  71. package/components/EventCalendar/EventCalendar.d.ts +24 -2
  72. package/components/EventCalendar/EventCalendar.js +104 -19
  73. package/components/FormSection/FormSection.css +70 -0
  74. package/components/FormSection/FormSection.d.ts +35 -0
  75. package/components/FormSection/FormSection.js +35 -0
  76. package/components/Grid/Grid.css +52 -0
  77. package/components/Grid/Grid.d.ts +30 -0
  78. package/components/Grid/Grid.js +36 -0
  79. package/components/Icon/Icon.css +55 -0
  80. package/components/Icon/Icon.d.ts +27 -0
  81. package/components/Icon/Icon.js +42 -0
  82. package/components/NumberInput/NumberInput.d.ts +4 -2
  83. package/components/NumberInput/NumberInput.js +7 -3
  84. package/components/OrgChart/OrgChart.css +143 -0
  85. package/components/OrgChart/OrgChart.d.ts +44 -0
  86. package/components/OrgChart/OrgChart.js +26 -0
  87. package/components/PageHeader/PageHeader.css +74 -0
  88. package/components/PageHeader/PageHeader.d.ts +39 -0
  89. package/components/PageHeader/PageHeader.js +33 -0
  90. package/components/Panel/Panel.css +7 -0
  91. package/components/Panel/Panel.d.ts +5 -2
  92. package/components/Panel/Panel.js +2 -1
  93. package/components/ResourceTimeline/ResourceTimeline.css +194 -0
  94. package/components/ResourceTimeline/ResourceTimeline.d.ts +57 -0
  95. package/components/ResourceTimeline/ResourceTimeline.js +129 -0
  96. package/components/ShaderField/useShaderField.js +13 -1
  97. package/components/ShaderScene/ShaderScene.d.ts +39 -15
  98. package/components/ShaderScene/ShaderScene.js +87 -6
  99. package/components/ShaderScene/assemble.d.ts +10 -3
  100. package/components/ShaderScene/assemble.js +29 -0
  101. package/components/ShaderScene/renderer.d.ts +12 -4
  102. package/components/ShaderScene/renderer.js +32 -20
  103. package/components/ShaderScene/scenes.d.ts +78 -0
  104. package/components/ShaderScene/scenes.js +933 -1
  105. package/components/ShaderScene/types.d.ts +52 -23
  106. package/components/Stack/Stack.css +68 -0
  107. package/components/Stack/Stack.d.ts +37 -0
  108. package/components/Stack/Stack.js +39 -0
  109. package/components/Stat/Stat.css +65 -0
  110. package/components/Stat/Stat.d.ts +7 -1
  111. package/components/Stat/Stat.js +16 -1
  112. package/components/Table/Table.css +11 -0
  113. package/components/Table/Table.d.ts +2 -0
  114. package/components/Table/Table.js +5 -1
  115. package/components/Tabs/Tabs.css +23 -0
  116. package/components/Tabs/Tabs.d.ts +9 -8
  117. package/components/Tabs/Tabs.js +38 -5
  118. package/components/Textarea/Textarea.d.ts +4 -2
  119. package/components/Textarea/Textarea.js +7 -3
  120. package/components/ThemeToggle/colorMode.d.ts +17 -1
  121. package/components/ThemeToggle/colorMode.js +11 -2
  122. package/components/Widget/Widget.css +21 -0
  123. package/components/Widget/Widget.d.ts +4 -0
  124. package/components/Widget/Widget.js +13 -5
  125. package/components/Wizard/Wizard.css +67 -0
  126. package/components/Wizard/Wizard.d.ts +54 -0
  127. package/components/Wizard/Wizard.js +71 -0
  128. package/components/registry.d.ts +25 -0
  129. package/components/registry.js +8 -0
  130. package/components/registry.json +234 -33
  131. package/components/registry.json.d.ts +234 -33
  132. package/components/registry.json.js +1 -1
  133. package/index.d.ts +10 -0
  134. package/index.js +20 -0
  135. package/package.json +1 -1
  136. package/tokens/motion.d.ts +2 -0
  137. package/tokens/motion.js +2 -0
  138. package/tokens/values.d.ts +31 -0
  139. package/tokens/values.js +16 -0
  140. package/tokens/values.json.js +1 -1
@@ -2,9 +2,6 @@ import { createFollowupsHandler } from 'rift-ds/chat/server';
2
2
  import { FOLLOWUP_MODEL } from '../../../../components/chat/models';
3
3
  import { guardrails } from '../guardrails';
4
4
 
5
- export const runtime = 'nodejs';
6
- export const dynamic = 'force-dynamic';
7
-
8
5
  /**
9
6
  * The three follow-up questions offered under a finished answer, written by
10
7
  * a small model from the question-and-answer pair. Say what the chat is
@@ -2,9 +2,7 @@ import { createChatHandler } from 'rift-ds/chat/server';
2
2
  import { CHAT_MODELS, DEFAULT_CHAT_MODEL } from '../../../components/chat/models';
3
3
  import { guardrails } from './guardrails';
4
4
 
5
- export const runtime = 'nodejs';
6
5
  export const maxDuration = 60;
7
- export const dynamic = 'force-dynamic';
8
6
 
9
7
  /**
10
8
  * What the assistant knows and how it behaves. Replace this with your own
@@ -28,6 +28,14 @@ export interface ChatLauncherProps {
28
28
  * Note: not the native `hidden` attribute, which keeps an element mounted and only hides it; the launcher unmounts its button and panel, and spreads no native attributes.
29
29
  */
30
30
  hidden?: boolean;
31
+ /**
32
+ * Whether the closed launcher shows its floating button. Defaults to true.
33
+ * `false` keeps the panel and drops only the button, for a host that opens
34
+ * the chat from a control of its own, such as an AiButton in its top bar:
35
+ * that control calls `setOpen(true)` from `useChatWidget()` and sets
36
+ * `returnFocusRef.current` to itself, so closing the panel hands focus back.
37
+ */
38
+ fab?: boolean;
31
39
  /** The panel's DOM id, for a host control's `aria-controls`. */
32
40
  panelId?: string;
33
41
  /**
@@ -78,4 +86,4 @@ export interface ChatLauncherProps {
78
86
  * touch the host's body). The panel's geometry reads `--ds-chat-width`,
79
87
  * `--ds-chat-inset` and `--ds-chat-float-height`, defaulted on `:root`.
80
88
  */
81
- export declare function ChatLauncher({ label, icon, summary, hidden, panelId, hostAttribute, panelLabel, aiButtonLabels, widget, children, surface, }: ChatLauncherProps): import("react").JSX.Element | null;
89
+ export declare function ChatLauncher({ label, icon, summary, hidden, panelId, hostAttribute, panelLabel, aiButtonLabels, widget, children, surface, fab, }: ChatLauncherProps): import("react").JSX.Element | null;
@@ -44,7 +44,8 @@ function ChatLauncher({
44
44
  aiButtonLabels,
45
45
  widget,
46
46
  children,
47
- surface = "raised"
47
+ surface = "raised",
48
+ fab = true
48
49
  }) {
49
50
  const { open, setOpen, panelPhase, view, side, floating, returnFocusRef, send } = useChatWidget();
50
51
  const agentState = useChatAgentState();
@@ -245,6 +246,7 @@ function ChatLauncher({
245
246
  }, [isFloating, floatPos]);
246
247
  if (hidden) return null;
247
248
  if (!renderPanel) {
249
+ if (!fab) return null;
248
250
  return /* @__PURE__ */ jsx("div", { className: "ds-chat-launcher__fab", children: /* @__PURE__ */ jsx(
249
251
  AiButton,
250
252
  {
package/chat/threads.js CHANGED
@@ -35,10 +35,13 @@ function useThreads(chat, options = {}) {
35
35
  const [groups, setGroups] = useState(initialGroups);
36
36
  const [activeThreadId, setActiveThreadId] = useState("");
37
37
  const [renamingId, setRenamingId] = useState(null);
38
- const [projects, setProjects] = useState(options.projects ?? []);
39
- const [activeProjectId, setActiveProjectId] = useState(
40
- options.projects?.[0]?.id
38
+ const [addedProjects, setAddedProjects] = useState([]);
39
+ const projects = useMemo(
40
+ () => [...options.projects ?? [], ...addedProjects],
41
+ [options.projects, addedProjects]
41
42
  );
43
+ const [pickedProjectId, setActiveProjectId] = useState(void 0);
44
+ const activeProjectId = projects.some((project) => project.id === pickedProjectId) ? pickedProjectId : projects[0]?.id;
42
45
  const [openTabs, setOpenTabs] = useState([]);
43
46
  const threadSeq = useRef(0);
44
47
  const nameCursor = useRef(0);
@@ -199,7 +202,7 @@ function useThreads(chat, options = {}) {
199
202
  projectSeq.current += 1;
200
203
  const id = `project-${projectSeq.current}`;
201
204
  const index = projectSeq.current;
202
- setProjects((list) => [...list, { id, label: labels.newProject(index), meta: labels.newProjectMeta }]);
205
+ setAddedProjects((list) => [...list, { id, label: labels.newProject(index), meta: labels.newProjectMeta }]);
203
206
  setActiveProjectId(id);
204
207
  }, [labels]);
205
208
  const actionsFor = useCallback(
@@ -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",
@@ -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(
@@ -573,6 +573,44 @@
573
573
  height: 100%;
574
574
  }
575
575
 
576
+ /* ============================================
577
+ GLASS
578
+ glass: the button frosts what is behind it, for a busy ground. The blur
579
+ is the floating surfaces' own. An outlined or ghost cell takes the glass
580
+ fill at rest; a filled cell keeps its colour and lets a little of the
581
+ ground through it. These sit after the cells' rest rules and match
582
+ their weight, so they win at rest (and on a disabled button, which
583
+ keeps its glass under the usual dimming), while every pointer hover and
584
+ press rule above carries one more class and still fills the button
585
+ solid. The documentation-only hover and active classes are left out
586
+ through :where(), which adds no weight, so a forced state shows the
587
+ cell's own fill too.
588
+ ============================================ */
589
+
590
+ .ds-button--glass {
591
+ -webkit-backdrop-filter: blur(24px);
592
+ backdrop-filter: blur(24px);
593
+ }
594
+
595
+ .ds-button--glass.ds-button--secondary:where(:not(.ds-button--hover, .ds-button--active)),
596
+ .ds-button--glass.ds-button--secondary-neutral:where(:not(.ds-button--hover, .ds-button--active)),
597
+ .ds-button--glass.ds-button--tertiary:where(:not(.ds-button--hover, .ds-button--active)),
598
+ .ds-button--glass.ds-button--destructive:where(:not(.ds-button--hover, .ds-button--active)) {
599
+ background-color: var(--color-bg-glass);
600
+ }
601
+
602
+ .ds-button--glass.ds-button--primary:where(:not(.ds-button--hover, .ds-button--active)) {
603
+ background-color: color-mix(in srgb, var(--color-action-primary-bg) 72%, transparent);
604
+ }
605
+
606
+ .ds-button--glass.ds-button--neutral:where(:not(.ds-button--hover, .ds-button--active)) {
607
+ background-color: color-mix(in srgb, var(--color-action-neutral-bg) 72%, transparent);
608
+ }
609
+
610
+ .ds-button--glass.ds-button--primary-destructive:where(:not(.ds-button--hover, .ds-button--active)) {
611
+ background-color: color-mix(in srgb, var(--color-action-destructive-bg) 72%, transparent);
612
+ }
613
+
576
614
  /* ============================================
577
615
  FOCUS
578
616
  ============================================ */
@@ -44,6 +44,14 @@ type ButtonOwnProps = {
44
44
  * `disabled`) and sets `aria-busy` on the rendered element.
45
45
  */
46
46
  loading?: boolean;
47
+ /**
48
+ * Frosts the button for a busy ground (a shader, a photo, a chart): the
49
+ * page behind it is blurred, an outlined or ghost button takes the glass
50
+ * fill at rest and a filled one lets a little of the ground through its
51
+ * colour. Hover and press are the variant's own. Works on every `variant`
52
+ * and `tone`.
53
+ */
54
+ glass?: boolean;
47
55
  /** Optional href — renders as <a> instead of <button> */
48
56
  href?: string;
49
57
  /** Optional target attribute for links */
@@ -35,6 +35,7 @@ const Button = React.forwardRef(
35
35
  size = "default",
36
36
  disabled,
37
37
  loading,
38
+ glass,
38
39
  href,
39
40
  target,
40
41
  rel,
@@ -66,6 +67,7 @@ const Button = React.forwardRef(
66
67
  `${baseClass}--${resolvedState}`,
67
68
  `${baseClass}--${size}`,
68
69
  isLoading && `${baseClass}--loading`,
70
+ glass && `${baseClass}--glass`,
69
71
  className
70
72
  ].filter(Boolean).join(" ");
71
73
  const iconClass = "material-symbols-rounded";
@@ -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 */
@@ -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 = "",
@@ -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,