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
@@ -5,6 +5,11 @@ import "./EventCalendar.css";
5
5
  import "../../fonts/material-symbols.css";
6
6
  import { useLocale } from "../../behaviors/LocaleProvider.js";
7
7
  import { weekStartOf, weekdayOffset, rotateWeek, weekdayNamesIn } from "../../behaviors/locale.js";
8
+ function parseDay(str) {
9
+ const match = str ? /^(\d{4})-(\d{2})-(\d{2})$/.exec(str) : null;
10
+ return match ? new Date(Number(match[1]), Number(match[2]) - 1, Number(match[3])) : null;
11
+ }
12
+ const MAX_SPAN_DAYS = 366;
8
13
  const weekdaysOr = (labels, locale) => labels && labels.length === 7 ? labels : weekdayNamesIn(locale, "short");
9
14
  function parseMonth(str) {
10
15
  const [y, m] = str.split("-").map(Number);
@@ -44,9 +49,15 @@ const EventCalendar = React.forwardRef(
44
49
  onEventClick,
45
50
  onDateClick,
46
51
  selectedDate,
52
+ today: todayProp,
53
+ legend,
47
54
  actions,
55
+ view = "month",
48
56
  previousLabel = "Previous month",
49
57
  nextLabel = "Next month",
58
+ previousWeekLabel = "Previous week",
59
+ nextWeekLabel = "Next week",
60
+ showLessLabel = "Show less",
50
61
  monthLabel: monthLabelProp,
51
62
  overflowLabel: overflowLabelProp,
52
63
  moreLabel = defaultMoreLabel,
@@ -57,7 +68,7 @@ const EventCalendar = React.forwardRef(
57
68
  ...rest
58
69
  }, ref) => {
59
70
  const baseClass = "ds-event-calendar";
60
- const today = useMemo(() => /* @__PURE__ */ new Date(), []);
71
+ const today = useMemo(() => parseDay(todayProp) ?? /* @__PURE__ */ new Date(), [todayProp]);
61
72
  const locale = useLocale(localeProp);
62
73
  const weekStart = weekStartsOn ?? weekStartOf(locale);
63
74
  const dayNumber = useMemo(() => new Intl.NumberFormat(locale), [locale]);
@@ -79,15 +90,52 @@ const EventCalendar = React.forwardRef(
79
90
  if (!isControlled) setUncontrolledMonth(value);
80
91
  onMonthChange?.(value);
81
92
  };
93
+ const isWeek = view === "week";
94
+ const [weekAnchor, setWeekAnchor] = useState(() => parseDay(selectedDate) ?? today);
95
+ const weekStartDate = new Date(
96
+ weekAnchor.getFullYear(),
97
+ weekAnchor.getMonth(),
98
+ weekAnchor.getDate() - weekdayOffset(weekAnchor.getDay(), weekStart)
99
+ );
100
+ const stepWeek = (offset) => {
101
+ const next = new Date(weekAnchor.getFullYear(), weekAnchor.getMonth(), weekAnchor.getDate() + offset * 7);
102
+ setWeekAnchor(next);
103
+ const value = formatMonth(next.getFullYear(), next.getMonth());
104
+ if (value !== formatMonth(weekAnchor.getFullYear(), weekAnchor.getMonth())) {
105
+ if (!isControlled) setUncontrolledMonth(value);
106
+ onMonthChange?.(value);
107
+ }
108
+ };
109
+ const [expandedDays, setExpandedDays] = useState([]);
110
+ const toggleDay = (day) => setExpandedDays((current) => current.includes(day) ? current.filter((d) => d !== day) : [...current, day]);
111
+ const weekRangeLabel = useMemo(() => {
112
+ const format = new Intl.DateTimeFormat(locale, { month: "long", day: "numeric", year: "numeric" });
113
+ return (start) => format.formatRange(start, new Date(start.getFullYear(), start.getMonth(), start.getDate() + 6));
114
+ }, [locale]);
82
115
  const eventsByDate = useMemo(() => {
83
116
  const map = /* @__PURE__ */ new Map();
84
- for (const event of events) {
85
- const list = map.get(event.date) ?? [];
117
+ const add = (day, event) => {
118
+ const list = map.get(day) ?? [];
86
119
  list.push(event);
87
- map.set(event.date, list);
120
+ map.set(day, list);
121
+ };
122
+ for (const event of events) {
123
+ const start = parseDay(event.date);
124
+ const end = parseDay(event.endDate);
125
+ if (!start || !end || end <= start) {
126
+ add(event.date, event);
127
+ continue;
128
+ }
129
+ const day = new Date(start);
130
+ for (let i = 0; i < MAX_SPAN_DAYS && day <= end; i++) {
131
+ add(formatDate(day), event);
132
+ day.setDate(day.getDate() + 1);
133
+ }
88
134
  }
135
+ const spans = (event) => Boolean(event.endDate && event.endDate > event.date);
89
136
  for (const list of map.values()) {
90
137
  list.sort((a, b) => {
138
+ if (spans(a) !== spans(b)) return spans(a) ? -1 : 1;
91
139
  if (!a.time && !b.time) return 0;
92
140
  if (!a.time) return -1;
93
141
  if (!b.time) return 1;
@@ -96,16 +144,33 @@ const EventCalendar = React.forwardRef(
96
144
  }
97
145
  return map;
98
146
  }, [events, locale]);
147
+ const formatSpan = useMemo(() => {
148
+ const format = new Intl.DateTimeFormat(locale, { month: "long", day: "numeric", year: "numeric" });
149
+ return (event) => {
150
+ const start = parseDay(event.date);
151
+ const end = parseDay(event.endDate);
152
+ return start && end && end > start ? format.formatRange(start, end) : null;
153
+ };
154
+ }, [locale]);
99
155
  const firstDay = weekdayOffset(new Date(viewYear, viewMonth, 1).getDay(), weekStart);
100
156
  const daysInMonth = new Date(viewYear, viewMonth + 1, 0).getDate();
101
157
  const weekCount = Math.ceil((firstDay + daysInMonth) / 7);
102
158
  const cells = [];
103
- for (let i = 0; i < weekCount * 7; i++) {
104
- const date = new Date(viewYear, viewMonth, i - firstDay + 1);
105
- cells.push({ date, inMonth: date.getMonth() === viewMonth });
159
+ if (isWeek) {
160
+ for (let i = 0; i < 7; i++) {
161
+ cells.push({
162
+ date: new Date(weekStartDate.getFullYear(), weekStartDate.getMonth(), weekStartDate.getDate() + i),
163
+ inMonth: true
164
+ });
165
+ }
166
+ } else {
167
+ for (let i = 0; i < weekCount * 7; i++) {
168
+ const date = new Date(viewYear, viewMonth, i - firstDay + 1);
169
+ cells.push({ date, inMonth: date.getMonth() === viewMonth });
170
+ }
106
171
  }
107
- const classes = [baseClass, className].filter(Boolean).join(" ");
108
- const monthTitle = monthLabel(new Date(viewYear, viewMonth, 1));
172
+ const classes = [baseClass, isWeek ? `${baseClass}--week` : "", className].filter(Boolean).join(" ");
173
+ const monthTitle = isWeek ? weekRangeLabel(weekStartDate) : monthLabel(new Date(viewYear, viewMonth, 1));
109
174
  return /* @__PURE__ */ jsxs("div", { ...rest, ref, className: classes, children: [
110
175
  /* @__PURE__ */ jsxs("div", { className: `${baseClass}__header`, children: [
111
176
  /* @__PURE__ */ jsx("span", { className: `${baseClass}__month`, children: monthTitle }),
@@ -115,8 +180,8 @@ const EventCalendar = React.forwardRef(
115
180
  {
116
181
  type: "button",
117
182
  className: `${baseClass}__nav-btn material-symbols-rounded ds-mirror-rtl`,
118
- onClick: () => navigate(-1),
119
- "aria-label": previousLabel,
183
+ onClick: () => isWeek ? stepWeek(-1) : navigate(-1),
184
+ "aria-label": isWeek ? previousWeekLabel : previousLabel,
120
185
  children: "chevron_left"
121
186
  }
122
187
  ),
@@ -125,8 +190,8 @@ const EventCalendar = React.forwardRef(
125
190
  {
126
191
  type: "button",
127
192
  className: `${baseClass}__nav-btn material-symbols-rounded ds-mirror-rtl`,
128
- onClick: () => navigate(1),
129
- "aria-label": nextLabel,
193
+ onClick: () => isWeek ? stepWeek(1) : navigate(1),
194
+ "aria-label": isWeek ? nextWeekLabel : nextLabel,
130
195
  children: "chevron_right"
131
196
  }
132
197
  )
@@ -143,7 +208,8 @@ const EventCalendar = React.forwardRef(
143
208
  children: cells.map(({ date, inMonth }) => {
144
209
  const dateStr = formatDate(date);
145
210
  const dayEvents = eventsByDate.get(dateStr) ?? [];
146
- const visible = dayEvents.slice(0, maxEventsPerDay);
211
+ const expanded = isWeek || expandedDays.includes(dateStr);
212
+ const visible = expanded ? dayEvents : dayEvents.slice(0, maxEventsPerDay);
147
213
  const overflow = dayEvents.length - visible.length;
148
214
  const isToday = date.getFullYear() === today.getFullYear() && date.getMonth() === today.getMonth() && date.getDate() === today.getDate();
149
215
  const dayLabel = formatDayLabel(date);
@@ -186,10 +252,14 @@ const EventCalendar = React.forwardRef(
186
252
  ),
187
253
  /* @__PURE__ */ jsxs("div", { className: `${baseClass}__events`, children: [
188
254
  visible.map((event) => {
255
+ const span = formatSpan(event);
189
256
  const pillClasses = [
190
257
  `${baseClass}__event`,
191
- `${baseClass}__event--${event.color ?? "neutral"}`
192
- ].join(" ");
258
+ `${baseClass}__event--${event.color ?? "neutral"}`,
259
+ span ? `${baseClass}__event--span` : "",
260
+ span && dateStr !== event.date ? `${baseClass}__event--continued` : "",
261
+ span && dateStr !== event.endDate ? `${baseClass}__event--continues` : ""
262
+ ].filter(Boolean).join(" ");
193
263
  const pillContent = /* @__PURE__ */ jsxs(Fragment, { children: [
194
264
  /* @__PURE__ */ jsx("span", { className: `${baseClass}__event-dot`, "aria-hidden": "true" }),
195
265
  /* @__PURE__ */ jsx("span", { className: `${baseClass}__event-title`, children: event.title }),
@@ -201,12 +271,13 @@ const EventCalendar = React.forwardRef(
201
271
  type: "button",
202
272
  className: pillClasses,
203
273
  onClick: () => onEventClick(event),
204
- "aria-label": `${event.title}${event.time ? `, ${event.time}` : ""}, ${dayLabel}`,
274
+ "aria-label": span ? `${event.title}, ${span}` : `${event.title}${event.time ? `, ${event.time}` : ""}, ${dayLabel}`,
205
275
  children: pillContent
206
276
  },
207
277
  event.id
208
278
  ) : /* @__PURE__ */ jsx("span", { className: pillClasses, children: pillContent }, event.id);
209
279
  }),
280
+ !isWeek && expandedDays.includes(dateStr) && dayEvents.length > maxEventsPerDay && /* @__PURE__ */ jsx("button", { type: "button", className: `${baseClass}__more`, onClick: () => toggleDay(dateStr), "aria-expanded": "true", children: showLessLabel }),
210
281
  overflow > 0 && (onDateClick ? /* @__PURE__ */ jsx(
211
282
  "button",
212
283
  {
@@ -216,7 +287,17 @@ const EventCalendar = React.forwardRef(
216
287
  "aria-label": overflowLabel(overflow, date),
217
288
  children: moreLabel(overflow)
218
289
  }
219
- ) : /* @__PURE__ */ jsx("span", { className: `${baseClass}__more`, children: moreLabel(overflow) }))
290
+ ) : /* @__PURE__ */ jsx(
291
+ "button",
292
+ {
293
+ type: "button",
294
+ className: `${baseClass}__more`,
295
+ onClick: () => toggleDay(dateStr),
296
+ "aria-expanded": "false",
297
+ "aria-label": overflowLabel(overflow, date),
298
+ children: moreLabel(overflow)
299
+ }
300
+ ))
220
301
  ] })
221
302
  ]
222
303
  },
@@ -224,7 +305,11 @@ const EventCalendar = React.forwardRef(
224
305
  );
225
306
  })
226
307
  }
227
- )
308
+ ),
309
+ legend && legend.length > 0 && /* @__PURE__ */ jsx("ul", { className: `${baseClass}__legend`, children: legend.map((item) => /* @__PURE__ */ jsxs("li", { className: `${baseClass}__legend-item ${baseClass}__event--${item.color}`, children: [
310
+ /* @__PURE__ */ jsx("span", { className: `${baseClass}__event-dot`, "aria-hidden": "true" }),
311
+ item.label
312
+ ] }, `${item.color}-${item.label}`)) })
228
313
  ] });
229
314
  }
230
315
  );
@@ -0,0 +1,70 @@
1
+ /* ============================================
2
+ FORM SECTION
3
+ A heading and its sentence, then the fields
4
+ in a Grid and the section's actions. The
5
+ section is its own size container, so the
6
+ aside layout stacks by the room it has.
7
+ ============================================ */
8
+
9
+ /* Base */
10
+ .ds-form-section {
11
+ container-type: inline-size;
12
+ min-width: 0;
13
+ }
14
+
15
+ .ds-form-section--divider {
16
+ padding-block-start: var(--padding-500);
17
+ border-block-start: var(--border-025) solid var(--color-divider);
18
+ }
19
+
20
+ .ds-form-section__layout {
21
+ display: flex;
22
+ flex-direction: column;
23
+ gap: var(--gap-400);
24
+ }
25
+
26
+ .ds-form-section__intro {
27
+ display: flex;
28
+ flex-direction: column;
29
+ gap: var(--gap-100);
30
+ min-width: 0;
31
+ }
32
+
33
+ .ds-form-section__title {
34
+ margin: 0;
35
+ }
36
+
37
+ .ds-form-section__description {
38
+ margin: 0;
39
+ font-family: var(--font-paragraph-sm-family);
40
+ font-size: var(--font-paragraph-sm-size);
41
+ font-weight: var(--font-paragraph-sm-weight);
42
+ line-height: var(--font-paragraph-sm-line-height);
43
+ letter-spacing: var(--font-paragraph-sm-letter-spacing);
44
+ color: var(--color-text-secondary);
45
+ }
46
+
47
+ .ds-form-section__body {
48
+ display: flex;
49
+ flex-direction: column;
50
+ gap: var(--gap-500);
51
+ min-width: 0;
52
+ }
53
+
54
+ /* The section's own actions, at the end of the line under the fields. */
55
+ .ds-form-section__actions {
56
+ display: flex;
57
+ flex-wrap: wrap;
58
+ justify-content: flex-end;
59
+ gap: var(--gap-200);
60
+ }
61
+
62
+ /* Aside: the heading in a third of the row, the fields beside it, once the
63
+ section has the room. */
64
+ @container (min-width: 721px) {
65
+ .ds-form-section--aside .ds-form-section__layout {
66
+ display: grid;
67
+ grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
68
+ gap: var(--gap-1000);
69
+ }
70
+ }
@@ -0,0 +1,35 @@
1
+ import { default as React } from 'react';
2
+ /** Props owned by FormSection itself; everything else falls through to the root `<section>`. */
3
+ type FormSectionOwnProps = {
4
+ /**
5
+ * The section's heading.
6
+ * Note: this shadows the native `title` tooltip attribute, which FormSection does not expose.
7
+ */
8
+ title: string;
9
+ /** A sentence on what the fields are for or what changing them does. */
10
+ description?: React.ReactNode;
11
+ /** The fields, laid out in `columns`. */
12
+ children?: React.ReactNode;
13
+ /** How many columns the fields run to; they fold to one as the section narrows. */
14
+ columns?: 1 | 2 | 3;
15
+ /** `stacked` puts the heading above the fields; `aside` sets it in a column beside them, the settings page's layout, stacking when the section is narrow. */
16
+ layout?: 'stacked' | 'aside';
17
+ /** The section's own controls, at the foot of the fields: a Save, a Cancel. */
18
+ actions?: React.ReactNode;
19
+ /** The heading's place in the outline. Defaults to 2, a section of a page. */
20
+ headingLevel?: 2 | 3 | 4;
21
+ /** Draws a rule above the section, for a column of sections. */
22
+ divider?: boolean;
23
+ /** Additional CSS classes */
24
+ className?: string;
25
+ };
26
+ export interface FormSectionProps extends FormSectionOwnProps, Omit<React.ComponentPropsWithRef<'section'>, keyof FormSectionOwnProps> {
27
+ }
28
+ /**
29
+ * One part of a form or a settings page: a heading and a sentence on what it
30
+ * is for, its fields in a grid that folds by the room it has, and its own
31
+ * actions at the foot. A column of them is a long form or a settings page.
32
+ * Server-renderable.
33
+ */
34
+ export declare function FormSection({ title, description, children, columns, layout, actions, headingLevel, divider, className, ref, ...rest }: FormSectionProps): React.JSX.Element;
35
+ export {};
@@ -0,0 +1,35 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import "react";
3
+ import { Grid } from "../Grid/Grid.js";
4
+ import { Heading } from "../Heading/Heading.js";
5
+ import "./FormSection.css";
6
+ function FormSection({
7
+ title,
8
+ description,
9
+ children,
10
+ columns = 1,
11
+ layout = "stacked",
12
+ actions,
13
+ headingLevel = 2,
14
+ divider = false,
15
+ className = "",
16
+ ref,
17
+ ...rest
18
+ }) {
19
+ const hasDescription = description != null && description !== false && description !== "";
20
+ const hasActions = actions != null && actions !== false;
21
+ const classes = ["ds-form-section", `ds-form-section--${layout}`, divider ? "ds-form-section--divider" : "", className].filter(Boolean).join(" ");
22
+ return /* @__PURE__ */ jsx("section", { ...rest, ref, className: classes, children: /* @__PURE__ */ jsxs("div", { className: "ds-form-section__layout", children: [
23
+ /* @__PURE__ */ jsxs("div", { className: "ds-form-section__intro", children: [
24
+ /* @__PURE__ */ jsx(Heading, { level: headingLevel, tier: "title-body", className: "ds-form-section__title", children: title }),
25
+ hasDescription && /* @__PURE__ */ jsx("p", { className: "ds-form-section__description", children: description })
26
+ ] }),
27
+ /* @__PURE__ */ jsxs("div", { className: "ds-form-section__body", children: [
28
+ /* @__PURE__ */ jsx(Grid, { columns, minColumnWidth: "14rem", gap: "400", align: "start", children }),
29
+ hasActions && /* @__PURE__ */ jsx("div", { className: "ds-form-section__actions", children: actions })
30
+ ] })
31
+ ] }) });
32
+ }
33
+ export {
34
+ FormSection
35
+ };
@@ -0,0 +1,52 @@
1
+ /* ============================================
2
+ GRID
3
+ Equal columns that fold by the grid's own
4
+ width. Each column is at least --ds-grid-min
5
+ wide and the grid never runs to more than
6
+ --ds-grid-columns: the track minimum is the
7
+ larger of the floor and the share of the row
8
+ that many columns would take, so auto-fill
9
+ cannot add an extra column on a wide row.
10
+ ============================================ */
11
+
12
+ /* Base */
13
+ .ds-grid {
14
+ --ds-grid-gap-resolved: var(--ds-grid-gap, var(--gap-500));
15
+
16
+ display: grid;
17
+ grid-template-columns: repeat(
18
+ auto-fill,
19
+ minmax(
20
+ max(
21
+ min(var(--ds-grid-min, 12rem), 100%),
22
+ calc((100% - (var(--ds-grid-columns, 3) - 1) * var(--ds-grid-gap-resolved)) / var(--ds-grid-columns, 3))
23
+ ),
24
+ 1fr
25
+ )
26
+ );
27
+ gap: var(--ds-grid-gap-resolved);
28
+ align-items: stretch;
29
+ min-width: 0;
30
+ margin: 0;
31
+ padding: 0;
32
+ list-style: none;
33
+ }
34
+
35
+ /* A cell's content may be wider than its track (a long word, a table): it
36
+ shrinks to the track rather than pushing the grid wider. */
37
+ .ds-grid > * {
38
+ min-width: 0;
39
+ }
40
+
41
+ /* Alignment in the row */
42
+ .ds-grid--align-start {
43
+ align-items: start;
44
+ }
45
+
46
+ .ds-grid--align-center {
47
+ align-items: center;
48
+ }
49
+
50
+ .ds-grid--align-end {
51
+ align-items: end;
52
+ }
@@ -0,0 +1,30 @@
1
+ import { default as React } from 'react';
2
+ import { StackGap } from '../Stack/Stack';
3
+ /** Props owned by Grid itself; everything else falls through to the root element. */
4
+ type GridOwnProps = {
5
+ /** How many equal columns the grid runs to at full width. It folds to fewer as its own width narrows, never below `minColumnWidth`. */
6
+ columns?: 1 | 2 | 3 | 4 | 5 | 6;
7
+ /** The narrowest a column may get before the grid drops one, as a CSS length (`16rem`). Defaults to `12rem`. */
8
+ minColumnWidth?: string;
9
+ /** The space between cells, both ways, as a step on the gap scale (`--gap-500` by default). */
10
+ gap?: StackGap;
11
+ /** How cells sit in their row: `stretch`, the default, makes every card in a row the same height. */
12
+ align?: 'stretch' | 'start' | 'center' | 'end';
13
+ /** The element the grid renders as, so a grid of cards can be a list. */
14
+ as?: 'div' | 'section' | 'ul' | 'ol';
15
+ /** The cells, in reading order. */
16
+ children?: React.ReactNode;
17
+ /** Additional CSS classes */
18
+ className?: string;
19
+ };
20
+ export interface GridProps extends GridOwnProps, Omit<React.ComponentPropsWithRef<'div'>, keyof GridOwnProps> {
21
+ }
22
+ /**
23
+ * Equal columns that fold by the room the grid has: a row of stat cards, a
24
+ * board of panels, a field grid in a form. Cells in a row share its height by
25
+ * default. It measures its own width, never the viewport, so it folds the same
26
+ * beside an open sidebar or inside a dialog. Presentational and
27
+ * server-renderable.
28
+ */
29
+ export declare function Grid({ columns, minColumnWidth, gap, align, as, className, style, children, ref, ...rest }: GridProps): React.JSX.Element;
30
+ export {};
@@ -0,0 +1,36 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import "react";
3
+ import "./Grid.css";
4
+ function Grid({
5
+ columns = 3,
6
+ minColumnWidth = "12rem",
7
+ gap = "500",
8
+ align = "stretch",
9
+ as = "div",
10
+ className = "",
11
+ style,
12
+ children,
13
+ ref,
14
+ ...rest
15
+ }) {
16
+ const Element = as;
17
+ const classes = ["ds-grid", align !== "stretch" ? `ds-grid--align-${align}` : "", className].filter(Boolean).join(" ");
18
+ return /* @__PURE__ */ jsx(
19
+ Element,
20
+ {
21
+ ...rest,
22
+ ref,
23
+ className: classes,
24
+ style: {
25
+ ...style,
26
+ "--ds-grid-columns": columns,
27
+ "--ds-grid-min": minColumnWidth,
28
+ "--ds-grid-gap": `var(--gap-${gap})`
29
+ },
30
+ children
31
+ }
32
+ );
33
+ }
34
+ export {
35
+ Grid
36
+ };
@@ -0,0 +1,55 @@
1
+ /* ============================================
2
+ ICON
3
+ One Material Symbol on the icon scale. The
4
+ size arrives as --ds-icon-size from the
5
+ `size` prop and is set on the glyph through
6
+ --icon-size, never as a font size.
7
+ ============================================ */
8
+
9
+ /* Base */
10
+ .ds-icon {
11
+ display: inline-flex;
12
+ align-items: center;
13
+ justify-content: center;
14
+ flex-shrink: 0;
15
+ line-height: 1;
16
+ vertical-align: middle;
17
+ }
18
+
19
+ .ds-icon__glyph {
20
+ --icon-size: var(--ds-icon-size, var(--icon-size-600));
21
+ color: inherit;
22
+ }
23
+
24
+ /* Tones */
25
+ .ds-icon--default {
26
+ color: var(--color-icon-primary);
27
+ }
28
+
29
+ .ds-icon--neutral {
30
+ color: var(--color-icon-secondary);
31
+ }
32
+
33
+ .ds-icon--inherit {
34
+ color: inherit;
35
+ }
36
+
37
+ /* Filled */
38
+ .ds-icon--filled .ds-icon__glyph {
39
+ --material-symbols-fill: 1;
40
+ }
41
+
42
+ /* Tile: the round mark at the head of a stat card or a list row, the
43
+ control height across on the icon fill. */
44
+ .ds-icon--tile {
45
+ width: var(--control-height-default);
46
+ height: var(--control-height-default);
47
+ border-radius: var(--radius-pill);
48
+ background-color: var(--color-icon-bg);
49
+ }
50
+
51
+ /* On the tile's fill the default glyph takes the primary text colour, the
52
+ mark's established ink, so it holds its weight against the disc. */
53
+ .ds-icon--tile.ds-icon--default {
54
+ color: var(--color-text-primary);
55
+ }
@@ -0,0 +1,27 @@
1
+ import { default as React } from 'react';
2
+ /** Props owned by Icon itself; everything else falls through to the root span. */
3
+ type IconOwnProps = {
4
+ /** The Material Symbol's name (`settings`, `arrow_forward`). A glyph that points along the reading direction mirrors in a right-to-left context. */
5
+ name: string;
6
+ /** The size, as a step on the icon scale (`--icon-size-600`, the size beside body text, by default). */
7
+ size?: '500' | '600' | '800' | '1200';
8
+ /** The glyph's colour role. `inherit` takes the colour of the text around it. */
9
+ tone?: 'default' | 'neutral' | 'inherit';
10
+ /** Draws the filled form of the glyph, as a selected nav item does. */
11
+ filled?: boolean;
12
+ /** What the icon means, when it carries meaning no text beside it says. With a label the icon is an image with that name; without one it is decorative and hidden from assistive tech. */
13
+ label?: string;
14
+ /** Sets the glyph on a round tile of the icon fill, the mark at the head of a stat card or a list row. */
15
+ tile?: boolean;
16
+ /** Additional CSS classes */
17
+ className?: string;
18
+ };
19
+ export interface IconProps extends IconOwnProps, Omit<React.ComponentPropsWithRef<'span'>, keyof IconOwnProps | 'children'> {
20
+ }
21
+ /**
22
+ * One Material Symbol on the icon scale, for the places no other component
23
+ * draws one: beside a heading, at the head of a stat card, in a row of text.
24
+ * Decorative unless it has a `label`. Presentational and server-renderable.
25
+ */
26
+ export declare function Icon({ name, size, tone, filled, label, tile, className, style, ref, ...rest }: IconProps): React.JSX.Element;
27
+ export {};
@@ -0,0 +1,42 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import "react";
3
+ import { mirrorClass } from "../../behaviors/direction.js";
4
+ import "../../fonts/material-symbols.css";
5
+ import "./Icon.css";
6
+ function Icon({
7
+ name,
8
+ size = "600",
9
+ tone = "default",
10
+ filled = false,
11
+ label,
12
+ tile = false,
13
+ className = "",
14
+ style,
15
+ ref,
16
+ ...rest
17
+ }) {
18
+ const named = Boolean(label);
19
+ const classes = [
20
+ "ds-icon",
21
+ `ds-icon--${tone}`,
22
+ filled ? "ds-icon--filled" : "",
23
+ tile ? "ds-icon--tile" : "",
24
+ className
25
+ ].filter(Boolean).join(" ");
26
+ return /* @__PURE__ */ jsx(
27
+ "span",
28
+ {
29
+ role: named ? "img" : void 0,
30
+ "aria-label": named ? label : void 0,
31
+ "aria-hidden": named ? void 0 : true,
32
+ ...rest,
33
+ ref,
34
+ className: classes,
35
+ style: { ...style, "--ds-icon-size": `var(--icon-size-${size})` },
36
+ children: /* @__PURE__ */ jsx("span", { className: `ds-icon__glyph material-symbols-rounded ${mirrorClass(name)}`, "aria-hidden": "true", children: name })
37
+ }
38
+ );
39
+ }
40
+ export {
41
+ Icon
42
+ };
@@ -15,10 +15,12 @@ type NumberInputOwnProps = {
15
15
  step?: number;
16
16
  /** Component size (not the native character-width `size` attribute) */
17
17
  size?: 'default' | 'compact';
18
- /** Error state — shows error styling and message */
18
+ /** Error state: marks the control invalid and, in the older form without `errorText`, recolours the helper text as the error message. */
19
19
  error?: boolean;
20
- /** Helper or error message displayed below the input */
20
+ /** Helper text displayed below the control. With the older `error` flag and no `errorText`, it doubles as the error message. */
21
21
  helperText?: string;
22
+ /** 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. */
23
+ errorText?: React.ReactNode;
22
24
  /**
23
25
  * Convenience callback receiving the numeric value directly — `null` when
24
26
  * the field is empty or unparseable. Fires on typing alongside `onChange`