rift-ds 1.30.0 → 1.32.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 (162) hide show
  1. package/README.md +6 -4
  2. package/behaviors/chat-card.css +4 -1
  3. package/behaviors/deferComponent.d.ts +43 -0
  4. package/behaviors/deferComponent.js +35 -0
  5. package/behaviors/locale.d.ts +7 -0
  6. package/behaviors/locale.js +5 -0
  7. package/behaviors/shell.css +33 -0
  8. package/bin/rift-ds.mjs +35 -9
  9. package/bin/templates/blocks/app/planner/PlannerGrid.tsx +58 -0
  10. package/bin/templates/blocks/app/planner/Requests.tsx +42 -0
  11. package/bin/templates/blocks/app/planner/page.module.css +17 -0
  12. package/bin/templates/blocks/app/planner/page.tsx +32 -0
  13. package/bin/templates/blocks/components/blocks/AppShell.module.css +10 -1
  14. package/bin/templates/blocks/registry.json +14 -0
  15. package/bin/templates/chat/app/api/chat/route.actions.ts +108 -0
  16. package/bin/templates/chat/components/chat/ChatMount.actions.tsx +55 -0
  17. package/bin/templates/chat/components/chat/ChatMount.tsx +14 -1
  18. package/bin/templates/chat/components/chat/proposals/ProposalCard.tsx +81 -0
  19. package/bin/templates/chat/components/chat/proposals/actions.ts +60 -0
  20. package/bin/templates/chat/components/chat/proposals/confirmation.ts +9 -0
  21. package/bin/templates/chat/components/chat/proposals/renderers.tsx +9 -0
  22. package/chat/ChatLauncher.d.ts +13 -2
  23. package/chat/ChatLauncher.js +52 -29
  24. package/chat/ChatProvider.d.ts +19 -2
  25. package/chat/ChatProvider.js +26 -3
  26. package/chat/ChatWidget.css +23 -4
  27. package/chat/ChatWidget.d.ts +2 -1
  28. package/chat/ChatWidget.js +23 -21
  29. package/chat/actions.d.ts +52 -6
  30. package/chat/actions.js +53 -5
  31. package/chat/contextSchema.d.ts +76 -0
  32. package/chat/contextSchema.js +58 -0
  33. package/chat/deferredChatWidget.d.ts +10 -0
  34. package/chat/deferredChatWidget.js +10 -0
  35. package/chat/index.d.ts +3 -2
  36. package/chat/index.js +7 -1
  37. package/chat/registry.json.d.ts +4 -3
  38. package/chat/registry.json.js +1 -1
  39. package/chat/server.d.ts +18 -2
  40. package/chat/server.js +10 -1
  41. package/chat/suggestions.d.ts +7 -0
  42. package/chat/suggestions.js +13 -1
  43. package/chat/types.d.ts +23 -0
  44. package/chat/useChat.d.ts +2 -2
  45. package/chat/useChat.js +15 -1
  46. package/components/Accordion/Accordion.css +8 -0
  47. package/components/AgentPlan/AgentPlan.css +8 -0
  48. package/components/AgentRail/AgentRail.css +3 -3
  49. package/components/AiButton/AiButton.css +19 -0
  50. package/components/AiButton/AiButton.d.ts +10 -1
  51. package/components/AiButton/AiButton.js +6 -1
  52. package/components/AppSidebar/AppSidebar.css +12 -0
  53. package/components/ArtifactPanel/ArtifactPanel.js +5 -5
  54. package/components/Attachment/AttachmentViewer.js +7 -7
  55. package/components/BentoTile/BentoTile.css +1 -1
  56. package/components/BentoTile/BentoTile.js +5 -5
  57. package/components/Button/Button.css +28 -1
  58. package/components/Button/Button.d.ts +7 -2
  59. package/components/Button/Button.js +7 -3
  60. package/components/ButtonGroup/ButtonGroup.css +10 -1
  61. package/components/Chart/RadarChart.js +24 -10
  62. package/components/ChatHeader/ChatHeader.d.ts +1 -1
  63. package/components/ChatThread/ChatThread.css +1 -1
  64. package/components/Chip/Chip.css +26 -0
  65. package/components/CircularButton/CircularButton.d.ts +16 -96
  66. package/components/CircularButton/CircularButton.js +11 -94
  67. package/components/Combobox/Combobox.css +12 -0
  68. package/components/CommandPalette/CommandPalette.css +1 -1
  69. package/components/CommandPalette/CommandPalette.js +3 -3
  70. package/components/CommandPaletteTrigger/CommandPaletteTrigger.css +9 -0
  71. package/components/CommandPaletteTrigger/CommandPaletteTrigger.d.ts +10 -2
  72. package/components/CommandPaletteTrigger/CommandPaletteTrigger.js +7 -2
  73. package/components/Composer/Composer.css +3 -3
  74. package/components/Composer/Composer.js +9 -9
  75. package/components/ContextMenu/ContextMenu.css +24 -0
  76. package/components/DataTable/DataTable.css +19 -4
  77. package/components/DataTable/DataTable.d.ts +14 -2
  78. package/components/DataTable/DataTable.js +28 -17
  79. package/components/DataTable/periodColumns.d.ts +37 -0
  80. package/components/DataTable/periodColumns.js +48 -0
  81. package/components/DateInput/DateInput.css +20 -0
  82. package/components/DatePicker/DatePicker.css +22 -6
  83. package/components/DatePicker/DatePicker.d.ts +2 -1
  84. package/components/DatePicker/DatePicker.js +2 -2
  85. package/components/DateRangePicker/DateRangePicker.js +2 -2
  86. package/components/DecisionRow/DecisionRow.css +46 -0
  87. package/components/DecisionRow/DecisionRow.d.ts +62 -0
  88. package/components/DecisionRow/DecisionRow.js +93 -0
  89. package/components/DescriptionList/DescriptionListCopy.d.ts +1 -1
  90. package/components/DescriptionList/DescriptionListCopy.js +3 -3
  91. package/components/Dialog/Dialog.css +1 -1
  92. package/components/Dialog/Dialog.js +3 -3
  93. package/components/DocumentChip/DocumentChip.css +12 -0
  94. package/components/DocumentViewer/DocumentViewer.js +10 -10
  95. package/components/Drawer/Drawer.css +1 -1
  96. package/components/Drawer/Drawer.js +3 -3
  97. package/components/Dropdown/Dropdown.css +30 -0
  98. package/components/DropdownMenu/DropdownMenu.css +24 -0
  99. package/components/EventCalendar/EventCalendar.css +54 -0
  100. package/components/EventCalendar/EventCalendar.d.ts +27 -5
  101. package/components/EventCalendar/EventCalendar.js +50 -15
  102. package/components/FileInput/FileInput.css +9 -0
  103. package/components/FilterBar/FilterBar.css +12 -0
  104. package/components/FunnelChart/FunnelChart.js +33 -22
  105. package/components/Globe/Globe.css +7 -0
  106. package/components/Globe/Globe.js +1 -1
  107. package/components/{CircularButton/CircularButton.css → IconButton/IconButton.css} +91 -81
  108. package/components/IconButton/IconButton.d.ts +108 -0
  109. package/components/IconButton/IconButton.js +101 -0
  110. package/components/Input/Input.css +53 -0
  111. package/components/Input/Input.js +3 -3
  112. package/components/MaskedInput/MaskedInput.js +3 -3
  113. package/components/ModelPicker/ModelPicker.css +12 -1
  114. package/components/NavList/NavList.css +1 -1
  115. package/components/Pagination/Pagination.css +1 -1
  116. package/components/QuestionCard/QuestionCard.js +3 -3
  117. package/components/RadioButton/RadioButton.css +14 -12
  118. package/components/RichDropdown/RichDropdown.css +7 -0
  119. package/components/SegmentedControl/SegmentedControl.css +16 -5
  120. package/components/SegmentedControl/SegmentedControl.js +7 -4
  121. package/components/SiteHeader/SiteHeader.css +12 -5
  122. package/components/SiteHeader/SiteHeader.js +3 -3
  123. package/components/SourceTrail/SourceTrail.css +8 -0
  124. package/components/SplitButton/SplitButton.css +14 -14
  125. package/components/SplitButton/SplitButton.js +3 -3
  126. package/components/Table/Table.css +7 -0
  127. package/components/Table/Table.js +1 -1
  128. package/components/TableToolbar/TableToolbar.css +2 -2
  129. package/components/TableToolbar/TableToolbar.js +36 -37
  130. package/components/Tabs/Tabs.css +21 -3
  131. package/components/ThreadPanel/ThreadPanel.css +8 -0
  132. package/components/ThreadTabs/ThreadTabs.css +7 -0
  133. package/components/TimePicker/TimePicker.css +12 -0
  134. package/components/Timeline/Timeline.css +8 -0
  135. package/components/ToolCall/ToolCall.css +8 -0
  136. package/components/Tooltip/Tooltip.js +3 -2
  137. package/components/Widget/Widget.css +2 -0
  138. package/components/WorldMap/WorldMap.css +15 -0
  139. package/components/WorldMap/WorldMap.js +61 -6
  140. package/components/registry.d.ts +3 -1
  141. package/components/registry.json +39 -13
  142. package/components/registry.json.d.ts +39 -13
  143. package/components/registry.json.js +1 -1
  144. package/index.d.ts +2 -0
  145. package/index.js +8 -0
  146. package/package.json +6 -2
  147. package/tokens/presets/blueprint.css +9 -0
  148. package/tokens/presets/bubblegum.css +9 -0
  149. package/tokens/presets/contrast.css +3 -3
  150. package/tokens/presets/coral.css +3 -3
  151. package/tokens/presets/ember.css +9 -0
  152. package/tokens/presets/getaway.css +9 -0
  153. package/tokens/presets/gold.css +3 -3
  154. package/tokens/presets/mono.css +3 -3
  155. package/tokens/presets/pink.css +3 -3
  156. package/tokens/presets/plum.css +3 -3
  157. package/tokens/presets/signal.css +9 -0
  158. package/tokens/presets/smoke.css +9 -0
  159. package/tokens/presets/velvet.css +9 -0
  160. package/tokens/presets/violet.css +3 -3
  161. package/tokens/presets/volt.css +9 -0
  162. package/tokens/presets/warm.css +3 -3
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  import { useState, useRef, useEffect } from "react";
4
- import { CircularButton } from "../CircularButton/CircularButton.js";
4
+ import { IconButton } from "../IconButton/IconButton.js";
5
5
  import { MOTION_FEEDBACK_RESET_MS } from "../../tokens/motion.js";
6
6
  function writeClipboard(text) {
7
7
  const fallback = () => {
@@ -31,13 +31,13 @@ function DescriptionListCopy({ value, label, copiedLabel, onCopied }) {
31
31
  timer.current = window.setTimeout(() => setCopied(false), MOTION_FEEDBACK_RESET_MS);
32
32
  };
33
33
  return /* @__PURE__ */ jsx(
34
- CircularButton,
34
+ IconButton,
35
35
  {
36
36
  className: "ds-description-list__copy",
37
37
  icon: copied ? "check" : "content_copy",
38
38
  variant: "tertiary",
39
39
  size: "compact",
40
- ariaLabel: copied ? copiedLabel : label,
40
+ label: copied ? copiedLabel : label,
41
41
  onClick: copy
42
42
  }
43
43
  );
@@ -110,7 +110,7 @@
110
110
  }
111
111
 
112
112
  /* Close button — ghost icon button */
113
- /* The close is the library's CircularButton (tertiary, compact); the
113
+ /* The close is the library's IconButton (tertiary, compact); the
114
114
  header only seats it. */
115
115
  .ds-dialog__close {
116
116
  flex-shrink: 0;
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsxs, jsx } from "react/jsx-runtime";
3
3
  import React, { useRef, useId } from "react";
4
- import { CircularButton } from "../CircularButton/CircularButton.js";
4
+ import { IconButton } from "../IconButton/IconButton.js";
5
5
  import ReactDOM from "react-dom";
6
6
  import "./Dialog.css";
7
7
  import "../../fonts/material-symbols.css";
@@ -65,14 +65,14 @@ const Dialog = React.forwardRef(
65
65
  description && /* @__PURE__ */ jsx("p", { className: `${baseClass}__description`, id: descId, children: description })
66
66
  ] }),
67
67
  dismissible && /* @__PURE__ */ jsx(
68
- CircularButton,
68
+ IconButton,
69
69
  {
70
70
  className: `${baseClass}__close`,
71
71
  icon: "close",
72
72
  variant: "tertiary",
73
73
  size: "compact",
74
74
  tooltip: false,
75
- ariaLabel: closeLabel,
75
+ label: closeLabel,
76
76
  onClick: () => onOpenChange(false)
77
77
  }
78
78
  )
@@ -212,3 +212,15 @@
212
212
  .ds-document-chip .material-symbols-rounded {
213
213
  color: inherit;
214
214
  }
215
+
216
+ /* Icon side padding, Button's rule (design.md): a glyph's box carries its
217
+ own side bearing, so a side that holds one takes the step below the text
218
+ side. The chip always leads with its type glyph and may end on the
219
+ remove glyph (12 → 8). Compact is already at 8, the floor. */
220
+ .ds-document-chip {
221
+ padding-inline-start: var(--padding-200);
222
+ }
223
+
224
+ .ds-document-chip:has(> .ds-document-chip__remove) {
225
+ padding-inline-end: var(--padding-200);
226
+ }
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
3
3
  import { useState, useEffect } from "react";
4
- import { CircularButton } from "../CircularButton/CircularButton.js";
4
+ import { IconButton } from "../IconButton/IconButton.js";
5
5
  import { Button } from "../Button/Button.js";
6
6
  import { Spinner } from "../Spinner/Spinner.js";
7
7
  import { useLocale } from "../../behaviors/LocaleProvider.js";
@@ -56,13 +56,13 @@ function DocumentViewer({
56
56
  };
57
57
  }, [resolved, src]);
58
58
  const downloadName = typeof download === "string" ? download : name || void 0;
59
- const downloadButton = download ? onDownload ? /* @__PURE__ */ jsx(CircularButton, { icon: "download", variant: "tertiary", size: "compact", ariaLabel: downloadLabel, onClick: onDownload }) : /* @__PURE__ */ jsx(
60
- CircularButton,
59
+ const downloadButton = download ? onDownload ? /* @__PURE__ */ jsx(IconButton, { icon: "download", variant: "tertiary", size: "compact", label: downloadLabel, onClick: onDownload }) : /* @__PURE__ */ jsx(
60
+ IconButton,
61
61
  {
62
62
  icon: "download",
63
63
  variant: "tertiary",
64
64
  size: "compact",
65
- ariaLabel: downloadLabel,
65
+ label: downloadLabel,
66
66
  href: src,
67
67
  ...{ download: downloadName }
68
68
  }
@@ -126,12 +126,12 @@ function DocumentViewer({
126
126
  /* @__PURE__ */ jsxs("div", { className: "ds-document-viewer__actions", children: [
127
127
  resolved === "image" && /* @__PURE__ */ jsxs(Fragment, { children: [
128
128
  /* @__PURE__ */ jsx(
129
- CircularButton,
129
+ IconButton,
130
130
  {
131
131
  icon: "zoom_out",
132
132
  variant: "tertiary",
133
133
  size: "compact",
134
- ariaLabel: zoomOutLabel,
134
+ label: zoomOutLabel,
135
135
  disabled: zoom === 0,
136
136
  onClick: () => setZoom((z) => Math.max(0, z - 1))
137
137
  }
@@ -147,12 +147,12 @@ function DocumentViewer({
147
147
  }
148
148
  ),
149
149
  /* @__PURE__ */ jsx(
150
- CircularButton,
150
+ IconButton,
151
151
  {
152
152
  icon: "zoom_in",
153
153
  variant: "tertiary",
154
154
  size: "compact",
155
- ariaLabel: zoomInLabel,
155
+ label: zoomInLabel,
156
156
  disabled: zoom === ZOOMS.length - 1,
157
157
  onClick: () => setZoom((z) => Math.min(ZOOMS.length - 1, z + 1))
158
158
  }
@@ -160,12 +160,12 @@ function DocumentViewer({
160
160
  ] }),
161
161
  toolbar,
162
162
  openInNewTab && /* @__PURE__ */ jsx(
163
- CircularButton,
163
+ IconButton,
164
164
  {
165
165
  icon: "open_in_new",
166
166
  variant: "tertiary",
167
167
  size: "compact",
168
- ariaLabel: openLabel,
168
+ label: openLabel,
169
169
  href: src,
170
170
  target: "_blank",
171
171
  rel: "noopener noreferrer"
@@ -213,7 +213,7 @@
213
213
  }
214
214
 
215
215
  /* Close button — ghost icon button */
216
- /* The close is the library's CircularButton (tertiary, compact); the
216
+ /* The close is the library's IconButton (tertiary, compact); the
217
217
  header only seats it. */
218
218
  .ds-drawer__close {
219
219
  flex-shrink: 0;
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsxs, jsx } from "react/jsx-runtime";
3
3
  import React, { useRef, useId } from "react";
4
- import { CircularButton } from "../CircularButton/CircularButton.js";
4
+ import { IconButton } from "../IconButton/IconButton.js";
5
5
  import ReactDOM from "react-dom";
6
6
  import "./Drawer.css";
7
7
  import "../../behaviors/direction.css";
@@ -79,14 +79,14 @@ const Drawer = React.forwardRef(
79
79
  description && /* @__PURE__ */ jsx("p", { className: `${baseClass}__description`, id: descId, children: description })
80
80
  ] }),
81
81
  dismissible && /* @__PURE__ */ jsx(
82
- CircularButton,
82
+ IconButton,
83
83
  {
84
84
  className: `${baseClass}__close`,
85
85
  icon: "close",
86
86
  variant: "tertiary",
87
87
  size: "compact",
88
88
  tooltip: false,
89
- ariaLabel: closeLabel,
89
+ label: closeLabel,
90
90
  onClick: () => onOpenChange(false)
91
91
  }
92
92
  )
@@ -290,3 +290,33 @@
290
290
  /* Compact group labels keep the base --font-paragraph-sm-* type — the
291
291
  scale has no smaller step. */
292
292
 
293
+
294
+ /* Icon side padding, Button's rule (design.md): a glyph's box carries its
295
+ own side bearing, so a side that holds one takes the step below the text
296
+ side. The trigger always ends on its chevron and may lead with the
297
+ value's icon (16 → 12, compact 12 → 8); an option may lead with an icon
298
+ and a chosen option ends on the chosen mark (12 → 8; compact is
299
+ already at 8, the floor). */
300
+ .ds-dropdown__trigger {
301
+ padding-inline-end: var(--padding-300);
302
+ }
303
+
304
+ .ds-dropdown__trigger:has(.ds-dropdown__value-icon) {
305
+ padding-inline-start: var(--padding-300);
306
+ }
307
+
308
+ .ds-dropdown--compact .ds-dropdown__trigger {
309
+ padding-inline-end: var(--padding-200);
310
+ }
311
+
312
+ .ds-dropdown--compact .ds-dropdown__trigger:has(.ds-dropdown__value-icon) {
313
+ padding-inline-start: var(--padding-200);
314
+ }
315
+
316
+ .ds-dropdown__option:has(.ds-dropdown__option-icon) {
317
+ padding-inline-start: var(--padding-200);
318
+ }
319
+
320
+ .ds-dropdown__option:has(.ds-chosen-mark) {
321
+ padding-inline-end: var(--padding-200);
322
+ }
@@ -381,3 +381,27 @@
381
381
  transform: scale(1);
382
382
  }
383
383
  }
384
+
385
+ /* Icon side padding, Button's rule (design.md): a glyph's box carries its
386
+ own side bearing, so a side that holds one takes the step below the text
387
+ side. A row that leads with an icon, or ends on a trailing icon or the
388
+ submenu chevron, steps that side down (16 → 12, compact 12 → 8). The
389
+ compact rules carry the panel class, so the compact chevron side keeps
390
+ its trim instead of losing it to the compact row's padding. */
391
+ .ds-dropdown-menu__item:has(.ds-dropdown-menu__item-label > .ds-dropdown-menu__item-icon:first-child) {
392
+ padding-inline-start: var(--padding-300);
393
+ }
394
+
395
+ .ds-dropdown-menu__item:has(.ds-dropdown-menu__item-icon-right),
396
+ .ds-dropdown-menu__item--has-submenu {
397
+ padding-inline-end: var(--padding-300);
398
+ }
399
+
400
+ .ds-dropdown-menu__panel--compact .ds-dropdown-menu__item:has(.ds-dropdown-menu__item-label > .ds-dropdown-menu__item-icon:first-child) {
401
+ padding-inline-start: var(--padding-200);
402
+ }
403
+
404
+ .ds-dropdown-menu__panel--compact .ds-dropdown-menu__item:has(.ds-dropdown-menu__item-icon-right),
405
+ .ds-dropdown-menu__panel--compact .ds-dropdown-menu__item--has-submenu {
406
+ padding-inline-end: var(--padding-200);
407
+ }
@@ -412,6 +412,28 @@ button.ds-event-calendar__more:focus-visible {
412
412
  }
413
413
  }
414
414
 
415
+ /* On a phone a month cell is too narrow for any title: a pill cut to one
416
+ letter says nothing. The month grid draws each event as its dot, the
417
+ dots of a day wrapping in a row under the date, and a day's events read
418
+ in full from the selected-day panel or the pill's own name. The week
419
+ and day views have the room, and keep their pills. */
420
+ @media (max-width: 480px) {
421
+ .ds-event-calendar:not(.ds-event-calendar--week):not(.ds-event-calendar--day) .ds-event-calendar__events {
422
+ flex-direction: row;
423
+ flex-wrap: wrap;
424
+ justify-content: center;
425
+ }
426
+
427
+ .ds-event-calendar:not(.ds-event-calendar--week):not(.ds-event-calendar--day) .ds-event-calendar__event {
428
+ padding: var(--padding-050);
429
+ background-color: transparent;
430
+ }
431
+
432
+ .ds-event-calendar:not(.ds-event-calendar--week):not(.ds-event-calendar--day) .ds-event-calendar__event-title {
433
+ display: none;
434
+ }
435
+ }
436
+
415
437
  /* ============================================
416
438
  WEEK VIEW — one week, every event shown
417
439
  The cells take the room a week has to give,
@@ -422,3 +444,35 @@ button.ds-event-calendar__more:focus-visible {
422
444
  .ds-event-calendar--week .ds-event-calendar__cell {
423
445
  min-height: calc(var(--control-height-default) * 5);
424
446
  }
447
+
448
+ /* ============================================
449
+ DAY VIEW — one day, the week view's cell alone
450
+ ============================================ */
451
+
452
+ .ds-event-calendar--day .ds-event-calendar__grid {
453
+ grid-template-columns: 1fr;
454
+ }
455
+
456
+ /* ============================================
457
+ SELECTED DAY — the host's panel for the chosen day
458
+ ============================================ */
459
+
460
+ .ds-event-calendar__selected-day {
461
+ margin-block-start: var(--gap-300);
462
+ padding-block-start: var(--padding-300);
463
+ border-block-start: var(--border-025) solid var(--color-divider);
464
+ }
465
+
466
+ /* A legend entry that switches its colour: the shared Chip, its dot in the
467
+ entry's accent (an uncoloured entry takes the neutral one, at no weight,
468
+ so the accent class on the chip always wins). */
469
+ :where(.ds-event-calendar__legend .ds-chip) {
470
+ --ds-event-accent: var(--color-status-neutral-border);
471
+ }
472
+
473
+ /* In a chip the dot is the entry's whole mark, so it takes the larger step. */
474
+ .ds-event-calendar__legend .ds-chip .ds-event-calendar__event-dot {
475
+ display: block;
476
+ width: var(--gap-200);
477
+ height: var(--gap-200);
478
+ }
@@ -51,12 +51,29 @@ type EventCalendarOwnProps = {
51
51
  selectedDate?: string;
52
52
  /** The date the calendar treats as today (`YYYY-MM-DD`): it carries the today chip and picks the month shown first. Defaults to the device's date; pin it for a demo, a test or a time zone the device is not in. */
53
53
  today?: string;
54
- /** What each event colour means, shown as a row of dots and labels under the grid. Filtering by kind stays with the host, which passes the events it wants shown. */
54
+ /** What each event colour means, shown as a row of dots and labels under the grid. With `legendToggles`, each entry also shows and hides its colour's events. */
55
55
  legend?: EventCalendarLegendItem[];
56
+ /** Makes each legend entry a selectable Chip that shows or hides the events of its colour, so a reader can narrow a busy calendar by kind. */
57
+ legendToggles?: boolean;
58
+ /** The colours whose events are hidden, for controlled use. Pair with `onHiddenColorsChange`. */
59
+ hiddenColors?: EventCalendarColor[];
60
+ /** The colours hidden to begin with, for uncontrolled use. */
61
+ defaultHiddenColors?: EventCalendarColor[];
62
+ /** Fires with the hidden colours after a legend entry is switched. */
63
+ onHiddenColorsChange?: (colors: EventCalendarColor[]) => void;
64
+ /** The name of the legend's set of toggles, when `legendToggles` is on. */
65
+ legendLabel?: string;
66
+ /**
67
+ * Draws a panel for the selected day under the grid, in every view: handed
68
+ * the day (YYYY-MM-DD) and its events as shown, it returns what the panel
69
+ * holds (a list of the day's events, a form to add one). Shown only while
70
+ * `selectedDate` is set.
71
+ */
72
+ renderSelectedDay?: (date: string, events: EventCalendarEvent[]) => React.ReactNode;
56
73
  /** Trailing header slot, e.g. a "New event" Button. */
57
74
  actions?: React.ReactNode;
58
- /** `month` shows the whole month, a day's overflow folded behind "+N more"; `week` shows one week in tall cells with every event, stepping a week at a time from the selected day's week (else today's), which it keeps as its own state after mount. */
59
- view?: 'month' | 'week';
75
+ /** `month` shows the whole month, a day's overflow folded behind "+N more"; `week` shows one week in tall cells with every event, stepping a week at a time from the selected day's week (else today's), which it keeps as its own state after mount; `day` shows that one day the same way, stepping a day at a time. */
76
+ view?: 'month' | 'week' | 'day';
60
77
  /** Accessible name of the previous-month button. */
61
78
  previousLabel?: string;
62
79
  /** Accessible name of the next-month button. */
@@ -65,6 +82,10 @@ type EventCalendarOwnProps = {
65
82
  previousWeekLabel?: string;
66
83
  /** Accessible name of the next-week button, in the week view. */
67
84
  nextWeekLabel?: string;
85
+ /** Accessible name of the previous-day button, in the day view. */
86
+ previousDayLabel?: string;
87
+ /** Accessible name of the next-day button, in the day view. */
88
+ nextDayLabel?: string;
68
89
  /** The visible text of the control that folds an expanded day back, when a day's "+N more" opens it in place (with no `onDateClick`). */
69
90
  showLessLabel?: string;
70
91
  /**
@@ -89,8 +110,9 @@ type EventCalendarOwnProps = {
89
110
  /**
90
111
  * The weekday headers above the grid: seven entries, Sunday first, laid
91
112
  * out from `weekStartsOn`. Defaults to the short weekday names in `locale`
92
- * ("Sun" to "Sat" in `en-US`); a list of any other length falls back to
93
- * the default.
113
+ * ("Sun" to "Sat" in `en-US`), or its narrow names where the short ones
114
+ * are whole words (Arabic); a list of any other length falls back to the
115
+ * default.
94
116
  */
95
117
  weekdayLabels?: string[];
96
118
  /**
@@ -1,16 +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";
9
+ import { weekStartOf, weekdayOffset, rotateWeek, weekdayHeadersIn } from "../../behaviors/locale.js";
8
10
  function parseDay(str) {
9
11
  const match = str ? /^(\d{4})-(\d{2})-(\d{2})$/.exec(str) : null;
10
12
  return match ? new Date(Number(match[1]), Number(match[2]) - 1, Number(match[3])) : null;
11
13
  }
12
14
  const MAX_SPAN_DAYS = 366;
13
- const weekdaysOr = (labels, locale) => labels && labels.length === 7 ? labels : weekdayNamesIn(locale, "short");
15
+ const weekdaysOr = (labels, locale) => labels && labels.length === 7 ? labels : weekdayHeadersIn(locale);
14
16
  function parseMonth(str) {
15
17
  const [y, m] = str.split("-").map(Number);
16
18
  return [y, m - 1];
@@ -51,12 +53,20 @@ const EventCalendar = React.forwardRef(
51
53
  selectedDate,
52
54
  today: todayProp,
53
55
  legend,
56
+ legendToggles = false,
57
+ hiddenColors: hiddenColorsProp,
58
+ defaultHiddenColors = [],
59
+ onHiddenColorsChange,
60
+ legendLabel = "Show events by kind",
61
+ renderSelectedDay,
54
62
  actions,
55
63
  view = "month",
56
64
  previousLabel = "Previous month",
57
65
  nextLabel = "Next month",
58
66
  previousWeekLabel = "Previous week",
59
67
  nextWeekLabel = "Next week",
68
+ previousDayLabel = "Previous day",
69
+ nextDayLabel = "Next day",
60
70
  showLessLabel = "Show less",
61
71
  monthLabel: monthLabelProp,
62
72
  overflowLabel: overflowLabelProp,
@@ -90,15 +100,16 @@ const EventCalendar = React.forwardRef(
90
100
  if (!isControlled) setUncontrolledMonth(value);
91
101
  onMonthChange?.(value);
92
102
  };
93
- const isWeek = view === "week";
103
+ const isDay = view === "day";
104
+ const isWeek = view === "week" || isDay;
94
105
  const [weekAnchor, setWeekAnchor] = useState(() => parseDay(selectedDate) ?? today);
95
- const weekStartDate = new Date(
106
+ const weekStartDate = isDay ? weekAnchor : new Date(
96
107
  weekAnchor.getFullYear(),
97
108
  weekAnchor.getMonth(),
98
109
  weekAnchor.getDate() - weekdayOffset(weekAnchor.getDay(), weekStart)
99
110
  );
100
111
  const stepWeek = (offset) => {
101
- const next = new Date(weekAnchor.getFullYear(), weekAnchor.getMonth(), weekAnchor.getDate() + offset * 7);
112
+ const next = new Date(weekAnchor.getFullYear(), weekAnchor.getMonth(), weekAnchor.getDate() + offset * (isDay ? 1 : 7));
102
113
  setWeekAnchor(next);
103
114
  const value = formatMonth(next.getFullYear(), next.getMonth());
104
115
  if (value !== formatMonth(weekAnchor.getFullYear(), weekAnchor.getMonth())) {
@@ -112,6 +123,13 @@ const EventCalendar = React.forwardRef(
112
123
  const format = new Intl.DateTimeFormat(locale, { month: "long", day: "numeric", year: "numeric" });
113
124
  return (start) => format.formatRange(start, new Date(start.getFullYear(), start.getMonth(), start.getDate() + 6));
114
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
+ };
115
133
  const eventsByDate = useMemo(() => {
116
134
  const map = /* @__PURE__ */ new Map();
117
135
  const add = (day, event) => {
@@ -120,6 +138,7 @@ const EventCalendar = React.forwardRef(
120
138
  map.set(day, list);
121
139
  };
122
140
  for (const event of events) {
141
+ if (hiddenColors.includes(event.color ?? "neutral")) continue;
123
142
  const start = parseDay(event.date);
124
143
  const end = parseDay(event.endDate);
125
144
  if (!start || !end || end <= start) {
@@ -143,7 +162,7 @@ const EventCalendar = React.forwardRef(
143
162
  });
144
163
  }
145
164
  return map;
146
- }, [events, locale]);
165
+ }, [events, locale, hiddenColors]);
147
166
  const formatSpan = useMemo(() => {
148
167
  const format = new Intl.DateTimeFormat(locale, { month: "long", day: "numeric", year: "numeric" });
149
168
  return (event) => {
@@ -157,7 +176,7 @@ const EventCalendar = React.forwardRef(
157
176
  const weekCount = Math.ceil((firstDay + daysInMonth) / 7);
158
177
  const cells = [];
159
178
  if (isWeek) {
160
- for (let i = 0; i < 7; i++) {
179
+ for (let i = 0; i < (isDay ? 1 : 7); i++) {
161
180
  cells.push({
162
181
  date: new Date(weekStartDate.getFullYear(), weekStartDate.getMonth(), weekStartDate.getDate() + i),
163
182
  inMonth: true
@@ -169,8 +188,10 @@ const EventCalendar = React.forwardRef(
169
188
  cells.push({ date, inMonth: date.getMonth() === viewMonth });
170
189
  }
171
190
  }
172
- const classes = [baseClass, isWeek ? `${baseClass}--week` : "", className].filter(Boolean).join(" ");
173
- const monthTitle = isWeek ? weekRangeLabel(weekStartDate) : 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;
174
195
  return /* @__PURE__ */ jsxs("div", { ...rest, ref, className: classes, children: [
175
196
  /* @__PURE__ */ jsxs("div", { className: `${baseClass}__header`, children: [
176
197
  /* @__PURE__ */ jsx("span", { className: `${baseClass}__month`, children: monthTitle }),
@@ -181,7 +202,7 @@ const EventCalendar = React.forwardRef(
181
202
  type: "button",
182
203
  className: `${baseClass}__nav-btn material-symbols-rounded ds-mirror-rtl`,
183
204
  onClick: () => isWeek ? stepWeek(-1) : navigate(-1),
184
- "aria-label": isWeek ? previousWeekLabel : previousLabel,
205
+ "aria-label": previousName,
185
206
  children: "chevron_left"
186
207
  }
187
208
  ),
@@ -191,14 +212,14 @@ const EventCalendar = React.forwardRef(
191
212
  type: "button",
192
213
  className: `${baseClass}__nav-btn material-symbols-rounded ds-mirror-rtl`,
193
214
  onClick: () => isWeek ? stepWeek(1) : navigate(1),
194
- "aria-label": isWeek ? nextWeekLabel : nextLabel,
215
+ "aria-label": nextName,
195
216
  children: "chevron_right"
196
217
  }
197
218
  )
198
219
  ] }),
199
220
  actions && /* @__PURE__ */ jsx("div", { className: `${baseClass}__actions`, children: actions })
200
221
  ] }),
201
- /* @__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)) }),
202
223
  /* @__PURE__ */ jsx(
203
224
  "div",
204
225
  {
@@ -262,8 +283,9 @@ const EventCalendar = React.forwardRef(
262
283
  ].filter(Boolean).join(" ");
263
284
  const pillContent = /* @__PURE__ */ jsxs(Fragment, { children: [
264
285
  /* @__PURE__ */ jsx("span", { className: `${baseClass}__event-dot`, "aria-hidden": "true" }),
265
- /* @__PURE__ */ jsx("span", { className: `${baseClass}__event-title`, children: event.title }),
266
- 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 })
267
289
  ] });
268
290
  return onEventClick ? /* @__PURE__ */ jsx(
269
291
  "button",
@@ -306,7 +328,20 @@ const EventCalendar = React.forwardRef(
306
328
  })
307
329
  }
308
330
  ),
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: [
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: [
310
345
  /* @__PURE__ */ jsx("span", { className: `${baseClass}__event-dot`, "aria-hidden": "true" }),
311
346
  item.label
312
347
  ] }, `${item.color}-${item.label}`)) })
@@ -279,3 +279,12 @@
279
279
  .ds-file-input .material-symbols-rounded {
280
280
  color: inherit;
281
281
  }
282
+
283
+ /* Icon side padding, Button's rule (design.md): a glyph's box carries its
284
+ own side bearing, so a side that holds one takes the step below the text
285
+ side. A file row always leads with its type glyph (12 → 8,
286
+ compact is already at 8, the floor); its remove circle pads its own
287
+ glyph. */
288
+ .ds-file-input__file {
289
+ padding-inline-start: var(--padding-200);
290
+ }
@@ -196,3 +196,15 @@
196
196
  .ds-filter-bar .material-symbols-rounded {
197
197
  color: inherit;
198
198
  }
199
+
200
+ /* Icon side padding, Button's rule: a side that holds a glyph takes the
201
+ step below the text side, since the glyph's box carries its own side
202
+ bearing. The caret always trails; the leading icon is optional
203
+ (12 → 8; compact is already at 8, the floor). */
204
+ .ds-filter-bar__chip {
205
+ padding-inline-end: var(--padding-200);
206
+ }
207
+
208
+ .ds-filter-bar__chip:has(.ds-filter-bar__icon) {
209
+ padding-inline-start: var(--padding-200);
210
+ }
@@ -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;