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
@@ -1,11 +1,18 @@
1
1
  "use client";
2
2
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
3
3
  import React, { useMemo, useState } from "react";
4
+ import { Chip } from "../Chip/Chip.js";
4
5
  import "./EventCalendar.css";
6
+ import "../../behaviors/visually-hidden.css";
5
7
  import "../../fonts/material-symbols.css";
6
8
  import { useLocale } from "../../behaviors/LocaleProvider.js";
7
- import { weekStartOf, weekdayOffset, rotateWeek, weekdayNamesIn } from "../../behaviors/locale.js";
8
- const weekdaysOr = (labels, locale) => labels && labels.length === 7 ? labels : weekdayNamesIn(locale, "short");
9
+ import { weekStartOf, weekdayOffset, rotateWeek, weekdayHeadersIn } from "../../behaviors/locale.js";
10
+ function parseDay(str) {
11
+ const match = str ? /^(\d{4})-(\d{2})-(\d{2})$/.exec(str) : null;
12
+ return match ? new Date(Number(match[1]), Number(match[2]) - 1, Number(match[3])) : null;
13
+ }
14
+ const MAX_SPAN_DAYS = 366;
15
+ const weekdaysOr = (labels, locale) => labels && labels.length === 7 ? labels : weekdayHeadersIn(locale);
9
16
  function parseMonth(str) {
10
17
  const [y, m] = str.split("-").map(Number);
11
18
  return [y, m - 1];
@@ -44,9 +51,23 @@ const EventCalendar = React.forwardRef(
44
51
  onEventClick,
45
52
  onDateClick,
46
53
  selectedDate,
54
+ today: todayProp,
55
+ legend,
56
+ legendToggles = false,
57
+ hiddenColors: hiddenColorsProp,
58
+ defaultHiddenColors = [],
59
+ onHiddenColorsChange,
60
+ legendLabel = "Show events by kind",
61
+ renderSelectedDay,
47
62
  actions,
63
+ view = "month",
48
64
  previousLabel = "Previous month",
49
65
  nextLabel = "Next month",
66
+ previousWeekLabel = "Previous week",
67
+ nextWeekLabel = "Next week",
68
+ previousDayLabel = "Previous day",
69
+ nextDayLabel = "Next day",
70
+ showLessLabel = "Show less",
50
71
  monthLabel: monthLabelProp,
51
72
  overflowLabel: overflowLabelProp,
52
73
  moreLabel = defaultMoreLabel,
@@ -57,7 +78,7 @@ const EventCalendar = React.forwardRef(
57
78
  ...rest
58
79
  }, ref) => {
59
80
  const baseClass = "ds-event-calendar";
60
- const today = useMemo(() => /* @__PURE__ */ new Date(), []);
81
+ const today = useMemo(() => parseDay(todayProp) ?? /* @__PURE__ */ new Date(), [todayProp]);
61
82
  const locale = useLocale(localeProp);
62
83
  const weekStart = weekStartsOn ?? weekStartOf(locale);
63
84
  const dayNumber = useMemo(() => new Intl.NumberFormat(locale), [locale]);
@@ -79,15 +100,61 @@ const EventCalendar = React.forwardRef(
79
100
  if (!isControlled) setUncontrolledMonth(value);
80
101
  onMonthChange?.(value);
81
102
  };
103
+ const isDay = view === "day";
104
+ const isWeek = view === "week" || isDay;
105
+ const [weekAnchor, setWeekAnchor] = useState(() => parseDay(selectedDate) ?? today);
106
+ const weekStartDate = isDay ? weekAnchor : new Date(
107
+ weekAnchor.getFullYear(),
108
+ weekAnchor.getMonth(),
109
+ weekAnchor.getDate() - weekdayOffset(weekAnchor.getDay(), weekStart)
110
+ );
111
+ const stepWeek = (offset) => {
112
+ const next = new Date(weekAnchor.getFullYear(), weekAnchor.getMonth(), weekAnchor.getDate() + offset * (isDay ? 1 : 7));
113
+ setWeekAnchor(next);
114
+ const value = formatMonth(next.getFullYear(), next.getMonth());
115
+ if (value !== formatMonth(weekAnchor.getFullYear(), weekAnchor.getMonth())) {
116
+ if (!isControlled) setUncontrolledMonth(value);
117
+ onMonthChange?.(value);
118
+ }
119
+ };
120
+ const [expandedDays, setExpandedDays] = useState([]);
121
+ const toggleDay = (day) => setExpandedDays((current) => current.includes(day) ? current.filter((d) => d !== day) : [...current, day]);
122
+ const weekRangeLabel = useMemo(() => {
123
+ const format = new Intl.DateTimeFormat(locale, { month: "long", day: "numeric", year: "numeric" });
124
+ return (start) => format.formatRange(start, new Date(start.getFullYear(), start.getMonth(), start.getDate() + 6));
125
+ }, [locale]);
126
+ const [ownHidden, setOwnHidden] = useState(defaultHiddenColors);
127
+ const hiddenColors = hiddenColorsProp ?? ownHidden;
128
+ const toggleColor = (color) => {
129
+ const next = hiddenColors.includes(color) ? hiddenColors.filter((c) => c !== color) : [...hiddenColors, color];
130
+ if (hiddenColorsProp === void 0) setOwnHidden(next);
131
+ onHiddenColorsChange?.(next);
132
+ };
82
133
  const eventsByDate = useMemo(() => {
83
134
  const map = /* @__PURE__ */ new Map();
84
- for (const event of events) {
85
- const list = map.get(event.date) ?? [];
135
+ const add = (day, event) => {
136
+ const list = map.get(day) ?? [];
86
137
  list.push(event);
87
- map.set(event.date, list);
138
+ map.set(day, list);
139
+ };
140
+ for (const event of events) {
141
+ if (hiddenColors.includes(event.color ?? "neutral")) continue;
142
+ const start = parseDay(event.date);
143
+ const end = parseDay(event.endDate);
144
+ if (!start || !end || end <= start) {
145
+ add(event.date, event);
146
+ continue;
147
+ }
148
+ const day = new Date(start);
149
+ for (let i = 0; i < MAX_SPAN_DAYS && day <= end; i++) {
150
+ add(formatDate(day), event);
151
+ day.setDate(day.getDate() + 1);
152
+ }
88
153
  }
154
+ const spans = (event) => Boolean(event.endDate && event.endDate > event.date);
89
155
  for (const list of map.values()) {
90
156
  list.sort((a, b) => {
157
+ if (spans(a) !== spans(b)) return spans(a) ? -1 : 1;
91
158
  if (!a.time && !b.time) return 0;
92
159
  if (!a.time) return -1;
93
160
  if (!b.time) return 1;
@@ -95,17 +162,36 @@ const EventCalendar = React.forwardRef(
95
162
  });
96
163
  }
97
164
  return map;
98
- }, [events, locale]);
165
+ }, [events, locale, hiddenColors]);
166
+ const formatSpan = useMemo(() => {
167
+ const format = new Intl.DateTimeFormat(locale, { month: "long", day: "numeric", year: "numeric" });
168
+ return (event) => {
169
+ const start = parseDay(event.date);
170
+ const end = parseDay(event.endDate);
171
+ return start && end && end > start ? format.formatRange(start, end) : null;
172
+ };
173
+ }, [locale]);
99
174
  const firstDay = weekdayOffset(new Date(viewYear, viewMonth, 1).getDay(), weekStart);
100
175
  const daysInMonth = new Date(viewYear, viewMonth + 1, 0).getDate();
101
176
  const weekCount = Math.ceil((firstDay + daysInMonth) / 7);
102
177
  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 });
178
+ if (isWeek) {
179
+ for (let i = 0; i < (isDay ? 1 : 7); i++) {
180
+ cells.push({
181
+ date: new Date(weekStartDate.getFullYear(), weekStartDate.getMonth(), weekStartDate.getDate() + i),
182
+ inMonth: true
183
+ });
184
+ }
185
+ } else {
186
+ for (let i = 0; i < weekCount * 7; i++) {
187
+ const date = new Date(viewYear, viewMonth, i - firstDay + 1);
188
+ cells.push({ date, inMonth: date.getMonth() === viewMonth });
189
+ }
106
190
  }
107
- const classes = [baseClass, className].filter(Boolean).join(" ");
108
- const monthTitle = monthLabel(new Date(viewYear, viewMonth, 1));
191
+ const classes = [baseClass, isWeek ? `${baseClass}--week` : "", isDay ? `${baseClass}--day` : "", className].filter(Boolean).join(" ");
192
+ const monthTitle = isDay ? formatDayLabel(weekStartDate) : isWeek ? weekRangeLabel(weekStartDate) : monthLabel(new Date(viewYear, viewMonth, 1));
193
+ const previousName = isDay ? previousDayLabel : isWeek ? previousWeekLabel : previousLabel;
194
+ const nextName = isDay ? nextDayLabel : isWeek ? nextWeekLabel : nextLabel;
109
195
  return /* @__PURE__ */ jsxs("div", { ...rest, ref, className: classes, children: [
110
196
  /* @__PURE__ */ jsxs("div", { className: `${baseClass}__header`, children: [
111
197
  /* @__PURE__ */ jsx("span", { className: `${baseClass}__month`, children: monthTitle }),
@@ -115,8 +201,8 @@ const EventCalendar = React.forwardRef(
115
201
  {
116
202
  type: "button",
117
203
  className: `${baseClass}__nav-btn material-symbols-rounded ds-mirror-rtl`,
118
- onClick: () => navigate(-1),
119
- "aria-label": previousLabel,
204
+ onClick: () => isWeek ? stepWeek(-1) : navigate(-1),
205
+ "aria-label": previousName,
120
206
  children: "chevron_left"
121
207
  }
122
208
  ),
@@ -125,15 +211,15 @@ const EventCalendar = React.forwardRef(
125
211
  {
126
212
  type: "button",
127
213
  className: `${baseClass}__nav-btn material-symbols-rounded ds-mirror-rtl`,
128
- onClick: () => navigate(1),
129
- "aria-label": nextLabel,
214
+ onClick: () => isWeek ? stepWeek(1) : navigate(1),
215
+ "aria-label": nextName,
130
216
  children: "chevron_right"
131
217
  }
132
218
  )
133
219
  ] }),
134
220
  actions && /* @__PURE__ */ jsx("div", { className: `${baseClass}__actions`, children: actions })
135
221
  ] }),
136
- /* @__PURE__ */ jsx("div", { className: `${baseClass}__weekdays`, "aria-hidden": "true", children: rotateWeek(weekdaysOr(weekdayLabels, locale), weekStart).map((day, index) => /* @__PURE__ */ jsx("div", { className: `${baseClass}__weekday`, children: day }, index)) }),
222
+ !isDay && /* @__PURE__ */ jsx("div", { className: `${baseClass}__weekdays`, "aria-hidden": "true", children: rotateWeek(weekdaysOr(weekdayLabels, locale), weekStart).map((day, index) => /* @__PURE__ */ jsx("div", { className: `${baseClass}__weekday`, children: day }, index)) }),
137
223
  /* @__PURE__ */ jsx(
138
224
  "div",
139
225
  {
@@ -143,7 +229,8 @@ const EventCalendar = React.forwardRef(
143
229
  children: cells.map(({ date, inMonth }) => {
144
230
  const dateStr = formatDate(date);
145
231
  const dayEvents = eventsByDate.get(dateStr) ?? [];
146
- const visible = dayEvents.slice(0, maxEventsPerDay);
232
+ const expanded = isWeek || expandedDays.includes(dateStr);
233
+ const visible = expanded ? dayEvents : dayEvents.slice(0, maxEventsPerDay);
147
234
  const overflow = dayEvents.length - visible.length;
148
235
  const isToday = date.getFullYear() === today.getFullYear() && date.getMonth() === today.getMonth() && date.getDate() === today.getDate();
149
236
  const dayLabel = formatDayLabel(date);
@@ -186,14 +273,19 @@ const EventCalendar = React.forwardRef(
186
273
  ),
187
274
  /* @__PURE__ */ jsxs("div", { className: `${baseClass}__events`, children: [
188
275
  visible.map((event) => {
276
+ const span = formatSpan(event);
189
277
  const pillClasses = [
190
278
  `${baseClass}__event`,
191
- `${baseClass}__event--${event.color ?? "neutral"}`
192
- ].join(" ");
279
+ `${baseClass}__event--${event.color ?? "neutral"}`,
280
+ span ? `${baseClass}__event--span` : "",
281
+ span && dateStr !== event.date ? `${baseClass}__event--continued` : "",
282
+ span && dateStr !== event.endDate ? `${baseClass}__event--continues` : ""
283
+ ].filter(Boolean).join(" ");
193
284
  const pillContent = /* @__PURE__ */ jsxs(Fragment, { children: [
194
285
  /* @__PURE__ */ jsx("span", { className: `${baseClass}__event-dot`, "aria-hidden": "true" }),
195
- /* @__PURE__ */ jsx("span", { className: `${baseClass}__event-title`, children: event.title }),
196
- event.time && /* @__PURE__ */ jsx("span", { className: `${baseClass}__event-time`, children: event.time })
286
+ /* @__PURE__ */ jsx("span", { className: `${baseClass}__event-title`, "aria-hidden": "true", children: event.title }),
287
+ event.time && /* @__PURE__ */ jsx("span", { className: `${baseClass}__event-time`, "aria-hidden": "true", children: event.time }),
288
+ !onEventClick && /* @__PURE__ */ jsx("span", { className: "ds-visually-hidden", children: event.time ? `${event.title}, ${event.time}` : event.title })
197
289
  ] });
198
290
  return onEventClick ? /* @__PURE__ */ jsx(
199
291
  "button",
@@ -201,12 +293,13 @@ const EventCalendar = React.forwardRef(
201
293
  type: "button",
202
294
  className: pillClasses,
203
295
  onClick: () => onEventClick(event),
204
- "aria-label": `${event.title}${event.time ? `, ${event.time}` : ""}, ${dayLabel}`,
296
+ "aria-label": span ? `${event.title}, ${span}` : `${event.title}${event.time ? `, ${event.time}` : ""}, ${dayLabel}`,
205
297
  children: pillContent
206
298
  },
207
299
  event.id
208
300
  ) : /* @__PURE__ */ jsx("span", { className: pillClasses, children: pillContent }, event.id);
209
301
  }),
302
+ !isWeek && expandedDays.includes(dateStr) && dayEvents.length > maxEventsPerDay && /* @__PURE__ */ jsx("button", { type: "button", className: `${baseClass}__more`, onClick: () => toggleDay(dateStr), "aria-expanded": "true", children: showLessLabel }),
210
303
  overflow > 0 && (onDateClick ? /* @__PURE__ */ jsx(
211
304
  "button",
212
305
  {
@@ -216,7 +309,17 @@ const EventCalendar = React.forwardRef(
216
309
  "aria-label": overflowLabel(overflow, date),
217
310
  children: moreLabel(overflow)
218
311
  }
219
- ) : /* @__PURE__ */ jsx("span", { className: `${baseClass}__more`, children: moreLabel(overflow) }))
312
+ ) : /* @__PURE__ */ jsx(
313
+ "button",
314
+ {
315
+ type: "button",
316
+ className: `${baseClass}__more`,
317
+ onClick: () => toggleDay(dateStr),
318
+ "aria-expanded": "false",
319
+ "aria-label": overflowLabel(overflow, date),
320
+ children: moreLabel(overflow)
321
+ }
322
+ ))
220
323
  ] })
221
324
  ]
222
325
  },
@@ -224,7 +327,24 @@ const EventCalendar = React.forwardRef(
224
327
  );
225
328
  })
226
329
  }
227
- )
330
+ ),
331
+ selectedDate && renderSelectedDay && /* @__PURE__ */ jsx("div", { className: `${baseClass}__selected-day`, children: renderSelectedDay(selectedDate, eventsByDate.get(selectedDate) ?? []) }),
332
+ legend && legend.length > 0 && legendToggles && /* @__PURE__ */ jsx("div", { className: `${baseClass}__legend`, role: "group", "aria-label": legendLabel, children: legend.map((item) => /* @__PURE__ */ jsx(
333
+ Chip,
334
+ {
335
+ size: "compact",
336
+ className: `${baseClass}__event--${item.color}`,
337
+ icon: /* @__PURE__ */ jsx("span", { className: `${baseClass}__event-dot`, "aria-hidden": "true" }),
338
+ label: item.label,
339
+ selected: !hiddenColors.includes(item.color),
340
+ onClick: () => toggleColor(item.color)
341
+ },
342
+ `${item.color}-${item.label}`
343
+ )) }),
344
+ legend && legend.length > 0 && !legendToggles && /* @__PURE__ */ jsx("ul", { className: `${baseClass}__legend`, children: legend.map((item) => /* @__PURE__ */ jsxs("li", { className: `${baseClass}__legend-item ${baseClass}__event--${item.color}`, children: [
345
+ /* @__PURE__ */ jsx("span", { className: `${baseClass}__event-dot`, "aria-hidden": "true" }),
346
+ item.label
347
+ ] }, `${item.color}-${item.label}`)) })
228
348
  ] });
229
349
  }
230
350
  );
@@ -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
+ };
@@ -73,31 +73,42 @@ const FunnelChart = React.forwardRef(
73
73
  title && /* @__PURE__ */ jsx("h3", { className: `${chartClass}__title`, children: title }),
74
74
  subtitle && /* @__PURE__ */ jsx("p", { className: `${chartClass}__subtitle`, children: subtitle })
75
75
  ] }) }),
76
- /* @__PURE__ */ jsx("div", { className: `${chartClass}__body`, role: "img", "aria-label": ariaLabel, children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxs(FunnelChart$1, { margin: { top: 4, right: 4, bottom: 4, left: 4 }, children: [
77
- /* @__PURE__ */ jsx(Tooltip, { content: renderTooltip }),
78
- /* @__PURE__ */ jsx(
79
- Funnel,
80
- {
81
- ...animation,
82
- dataKey: "value",
83
- nameKey: "name",
84
- data: stages,
85
- lastShapeType: "rectangle",
86
- stroke: surfaceColor,
87
- strokeWidth: 2,
88
- children: showLabels && /* @__PURE__ */ jsx(
89
- LabelList,
76
+ /* @__PURE__ */ jsx("div", { className: `${chartClass}__body`, role: "img", "aria-label": ariaLabel, children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxs(
77
+ FunnelChart$1,
78
+ {
79
+ margin: {
80
+ top: 4,
81
+ right: showLabels ? Math.ceil(Math.max(0, ...stages.map((s) => s.name.length)) * 12 * 0.6) + 12 : 4,
82
+ bottom: 4,
83
+ left: 4
84
+ },
85
+ children: [
86
+ /* @__PURE__ */ jsx(Tooltip, { content: renderTooltip }),
87
+ /* @__PURE__ */ jsx(
88
+ Funnel,
90
89
  {
91
- position: "right",
92
- dataKey: "name",
93
- fill: textSecondary,
94
- stroke: "none",
95
- fontSize: 12
90
+ ...animation,
91
+ dataKey: "value",
92
+ nameKey: "name",
93
+ data: stages,
94
+ lastShapeType: "rectangle",
95
+ stroke: surfaceColor,
96
+ strokeWidth: 2,
97
+ children: showLabels && /* @__PURE__ */ jsx(
98
+ LabelList,
99
+ {
100
+ position: "right",
101
+ dataKey: "name",
102
+ fill: textSecondary,
103
+ stroke: "none",
104
+ fontSize: 12
105
+ }
106
+ )
96
107
  }
97
108
  )
98
- }
99
- )
100
- ] }) }) })
109
+ ]
110
+ }
111
+ ) }) })
101
112
  ] });
102
113
  }
103
114
  );
@@ -124,6 +124,13 @@
124
124
  /* The ring sits on the hit circle itself, with no offset: the callout opens
125
125
  beside the marker with its text one padding step from the centre, and an
126
126
  offset ring reached into that text. */
127
+ /* A marker on the far hemisphere is drawn faint behind the sphere, so its
128
+ button never takes the pointer from a front marker it shares a spot
129
+ with. It stays in the tab order: the keyboard reaches every point. */
130
+ .ds-globe__marker--back {
131
+ pointer-events: none;
132
+ }
133
+
127
134
  .ds-globe__marker:focus-visible {
128
135
  outline: var(--border-050) solid var(--color-action-primary-bg);
129
136
  outline-offset: 0;
@@ -437,7 +437,7 @@ const Globe = React.forwardRef(
437
437
  "button",
438
438
  {
439
439
  type: "button",
440
- className: `${baseClass}__marker`,
440
+ className: `${baseClass}__marker${at.visible ? "" : ` ${baseClass}__marker--back`}`,
441
441
  style: {
442
442
  left: pct(at.x / VIEW * 100),
443
443
  top: pct(at.y / VIEW * 100),
@@ -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
+ };