rift-ds 1.29.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 (126) hide show
  1. package/README.md +4 -3
  2. package/bin/rift-ds.mjs +1 -1
  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/components/blocks/AppShell.module.css +8 -41
  8. package/bin/templates/blocks/components/blocks/AppShell.tsx +9 -11
  9. package/bin/templates/blocks/registry.json +13 -0
  10. package/bin/templates/chat/app/api/chat/feedback/route.ts +0 -3
  11. package/bin/templates/chat/app/api/chat/followups/route.ts +0 -3
  12. package/bin/templates/chat/app/api/chat/route.ts +0 -2
  13. package/chat/ChatLauncher.d.ts +9 -1
  14. package/chat/ChatLauncher.js +3 -1
  15. package/components/Alert/Alert.css +12 -0
  16. package/components/Alert/Alert.d.ts +2 -0
  17. package/components/Alert/Alert.js +3 -1
  18. package/components/Attachment/Attachment.css +92 -0
  19. package/components/Attachment/FileRow.d.ts +47 -0
  20. package/components/Attachment/FileRow.js +38 -0
  21. package/components/Avatar/Avatar.css +14 -0
  22. package/components/Avatar/Avatar.d.ts +3 -1
  23. package/components/Avatar/Avatar.js +3 -2
  24. package/components/Chart/AreaChart.d.ts +2 -0
  25. package/components/Chart/AreaChart.js +2 -1
  26. package/components/Chart/BarChart.d.ts +2 -0
  27. package/components/Chart/BarChart.js +2 -1
  28. package/components/Chart/ComboChart.d.ts +4 -0
  29. package/components/Chart/ComboChart.js +4 -2
  30. package/components/Chart/LineChart.d.ts +2 -0
  31. package/components/Chart/LineChart.js +2 -1
  32. package/components/Chart/PieChart.d.ts +4 -4
  33. package/components/Chart/PieChart.js +1 -1
  34. package/components/Chart/ScatterChart.d.ts +2 -0
  35. package/components/Chart/ScatterChart.js +2 -1
  36. package/components/Checklist/Checklist.css +123 -0
  37. package/components/Checklist/Checklist.d.ts +66 -0
  38. package/components/Checklist/Checklist.js +115 -0
  39. package/components/CircularButton/CircularButton.css +39 -0
  40. package/components/CircularButton/CircularButton.d.ts +13 -0
  41. package/components/CircularButton/CircularButton.js +18 -4
  42. package/components/ColourSwatch/ColourSwatch.css +3 -1
  43. package/components/ColourSwatch/ColourSwatch.d.ts +5 -3
  44. package/components/ColourSwatch/ColourSwatch.js +5 -0
  45. package/components/Combobox/Combobox.d.ts +4 -2
  46. package/components/Combobox/Combobox.js +7 -3
  47. package/components/DataTable/DataTable.css +35 -0
  48. package/components/DataTable/DataTable.d.ts +34 -2
  49. package/components/DataTable/DataTable.js +58 -5
  50. package/components/DataTable/columnTypes.d.ts +1 -1
  51. package/components/DataTable/columnTypes.js +1 -1
  52. package/components/DateInput/DateInput.d.ts +4 -2
  53. package/components/DateInput/DateInput.js +7 -3
  54. package/components/DescriptionList/DescriptionList.css +28 -0
  55. package/components/DescriptionList/DescriptionList.d.ts +3 -1
  56. package/components/DescriptionList/DescriptionList.js +4 -3
  57. package/components/DescriptionList/DescriptionListCopy.js +2 -0
  58. package/components/Dropdown/Dropdown.d.ts +4 -2
  59. package/components/Dropdown/Dropdown.js +7 -3
  60. package/components/EmptyState/EmptyState.css +12 -0
  61. package/components/EmptyState/EmptyState.d.ts +7 -0
  62. package/components/EmptyState/EmptyState.js +2 -0
  63. package/components/EventCalendar/EventCalendar.css +59 -0
  64. package/components/EventCalendar/EventCalendar.d.ts +24 -2
  65. package/components/EventCalendar/EventCalendar.js +104 -19
  66. package/components/FormSection/FormSection.css +70 -0
  67. package/components/FormSection/FormSection.d.ts +35 -0
  68. package/components/FormSection/FormSection.js +35 -0
  69. package/components/Grid/Grid.css +52 -0
  70. package/components/Grid/Grid.d.ts +30 -0
  71. package/components/Grid/Grid.js +36 -0
  72. package/components/Icon/Icon.css +55 -0
  73. package/components/Icon/Icon.d.ts +27 -0
  74. package/components/Icon/Icon.js +42 -0
  75. package/components/NumberInput/NumberInput.d.ts +4 -2
  76. package/components/NumberInput/NumberInput.js +7 -3
  77. package/components/OrgChart/OrgChart.css +143 -0
  78. package/components/OrgChart/OrgChart.d.ts +44 -0
  79. package/components/OrgChart/OrgChart.js +26 -0
  80. package/components/PageHeader/PageHeader.css +74 -0
  81. package/components/PageHeader/PageHeader.d.ts +39 -0
  82. package/components/PageHeader/PageHeader.js +33 -0
  83. package/components/Panel/Panel.css +7 -0
  84. package/components/Panel/Panel.d.ts +5 -2
  85. package/components/Panel/Panel.js +2 -1
  86. package/components/ResourceTimeline/ResourceTimeline.css +194 -0
  87. package/components/ResourceTimeline/ResourceTimeline.d.ts +57 -0
  88. package/components/ResourceTimeline/ResourceTimeline.js +129 -0
  89. package/components/ShaderField/useShaderField.js +13 -1
  90. package/components/ShaderScene/ShaderScene.d.ts +3 -2
  91. package/components/ShaderScene/ShaderScene.js +47 -4
  92. package/components/Stack/Stack.css +68 -0
  93. package/components/Stack/Stack.d.ts +37 -0
  94. package/components/Stack/Stack.js +39 -0
  95. package/components/Stat/Stat.css +65 -0
  96. package/components/Stat/Stat.d.ts +7 -1
  97. package/components/Stat/Stat.js +16 -1
  98. package/components/Table/Table.css +11 -0
  99. package/components/Table/Table.d.ts +2 -0
  100. package/components/Table/Table.js +5 -1
  101. package/components/Tabs/Tabs.css +23 -0
  102. package/components/Tabs/Tabs.d.ts +9 -8
  103. package/components/Tabs/Tabs.js +38 -5
  104. package/components/Textarea/Textarea.d.ts +4 -2
  105. package/components/Textarea/Textarea.js +7 -3
  106. package/components/ThemeToggle/colorMode.d.ts +17 -1
  107. package/components/ThemeToggle/colorMode.js +11 -2
  108. package/components/Widget/Widget.css +21 -0
  109. package/components/Widget/Widget.d.ts +4 -0
  110. package/components/Widget/Widget.js +13 -5
  111. package/components/Wizard/Wizard.css +67 -0
  112. package/components/Wizard/Wizard.d.ts +54 -0
  113. package/components/Wizard/Wizard.js +71 -0
  114. package/components/registry.d.ts +25 -0
  115. package/components/registry.js +8 -0
  116. package/components/registry.json +233 -32
  117. package/components/registry.json.d.ts +233 -32
  118. package/components/registry.json.js +1 -1
  119. package/index.d.ts +10 -0
  120. package/index.js +20 -0
  121. package/package.json +1 -1
  122. package/tokens/motion.d.ts +2 -0
  123. package/tokens/motion.js +2 -0
  124. package/tokens/values.d.ts +31 -0
  125. package/tokens/values.js +16 -0
  126. package/tokens/values.json.js +1 -1
@@ -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`
@@ -27,6 +27,7 @@ const NumberInput = React.forwardRef(
27
27
  required = false,
28
28
  error = false,
29
29
  helperText,
30
+ errorText,
30
31
  onChange,
31
32
  onValueChange,
32
33
  decreaseLabel = "Decrease value",
@@ -44,10 +45,12 @@ const NumberInput = React.forwardRef(
44
45
  );
45
46
  const currentValue = isControlled ? value : internalValue;
46
47
  const currentNumber = parseValue(currentValue);
48
+ const hasErrorText = errorText != null && errorText !== false && errorText !== "";
49
+ const invalid = error || hasErrorText;
47
50
  const classes = [
48
51
  baseClass,
49
52
  size === "compact" ? `${baseClass}--compact` : "",
50
- error ? `${baseClass}--error` : "",
53
+ invalid ? `${baseClass}--error` : "",
51
54
  disabled ? `${baseClass}--disabled` : "",
52
55
  className
53
56
  ].filter(Boolean).join(" ");
@@ -81,13 +84,14 @@ const NumberInput = React.forwardRef(
81
84
  const atMin = min !== void 0 && currentNumber !== null && currentNumber <= min;
82
85
  const atMax = max !== void 0 && currentNumber !== null && currentNumber >= max;
83
86
  const inputId = id || name || label?.toLowerCase().replace(/\s+/g, "-");
84
- const describedBy = helperText ? `${inputId}-helper` : rest["aria-describedby"];
87
+ const describedBy = [rest["aria-describedby"], hasErrorText ? `${inputId}-error` : void 0, helperText ? `${inputId}-helper` : void 0].filter(Boolean).join(" ") || void 0;
85
88
  return /* @__PURE__ */ jsx(
86
89
  Field,
87
90
  {
88
91
  className: classes,
89
92
  label,
90
93
  helperText,
94
+ errorText,
91
95
  error,
92
96
  required,
93
97
  disabled,
@@ -121,7 +125,7 @@ const NumberInput = React.forwardRef(
121
125
  disabled,
122
126
  required,
123
127
  "aria-label": rest["aria-label"] || label,
124
- "aria-invalid": error,
128
+ "aria-invalid": invalid,
125
129
  "aria-describedby": describedBy,
126
130
  onChange: handleChange,
127
131
  onBlur: handleBlur
@@ -0,0 +1,143 @@
1
+ /* ============================================
2
+ ORG CHART
3
+ Nested lists drawn top down: each item is a
4
+ card with its reports in a row beneath it.
5
+ The lines are borders on pseudo-elements on
6
+ --color-divider: a stem down from a card, a
7
+ rail across its reports and a stem up into
8
+ each, so the chart needs no measuring. The
9
+ rail stops at the first and last report's
10
+ centres, on logical sides, so it mirrors in a
11
+ right-to-left context.
12
+ ============================================ */
13
+
14
+ /* Base */
15
+ .ds-org-chart {
16
+ min-width: 0;
17
+ }
18
+
19
+ .ds-org-chart__scroll {
20
+ overflow-x: auto;
21
+ padding-block: var(--padding-200);
22
+ }
23
+
24
+ .ds-org-chart__tree,
25
+ .ds-org-chart__reports {
26
+ display: flex;
27
+ justify-content: center;
28
+ margin: 0;
29
+ padding: 0;
30
+ list-style: none;
31
+ }
32
+
33
+ .ds-org-chart__tree {
34
+ min-width: max-content;
35
+ }
36
+
37
+ /* The reports sit a gap below their manager, with a stem down from it. */
38
+ .ds-org-chart__reports {
39
+ position: relative;
40
+ padding-block-start: var(--gap-500);
41
+ }
42
+
43
+ .ds-org-chart__reports::before {
44
+ content: '';
45
+ position: absolute;
46
+ inset-block-start: 0;
47
+ inset-inline-start: 50%;
48
+ block-size: calc(var(--gap-500) / 2);
49
+ border-inline-start: var(--border-025) solid var(--color-divider);
50
+ }
51
+
52
+ /* Items */
53
+ .ds-org-chart__item {
54
+ position: relative;
55
+ display: flex;
56
+ flex-direction: column;
57
+ align-items: center;
58
+ padding-inline: var(--padding-200);
59
+ }
60
+
61
+ /* Inside a list of reports: a stem up from each card to the rail, and the
62
+ rail across the item, cut back to the centre at either end of the row. */
63
+ .ds-org-chart__reports > .ds-org-chart__item::before,
64
+ .ds-org-chart__reports > .ds-org-chart__item::after {
65
+ content: '';
66
+ position: absolute;
67
+ inset-block-start: calc(var(--gap-500) / -2);
68
+ }
69
+
70
+ .ds-org-chart__reports > .ds-org-chart__item::before {
71
+ inset-inline-start: 50%;
72
+ block-size: calc(var(--gap-500) / 2);
73
+ border-inline-start: var(--border-025) solid var(--color-divider);
74
+ }
75
+
76
+ .ds-org-chart__reports > .ds-org-chart__item::after {
77
+ inset-inline: 0;
78
+ border-block-start: var(--border-025) solid var(--color-divider);
79
+ }
80
+
81
+ .ds-org-chart__reports > .ds-org-chart__item:first-child::after {
82
+ inset-inline-start: 50%;
83
+ }
84
+
85
+ .ds-org-chart__reports > .ds-org-chart__item:last-child::after {
86
+ inset-inline-end: 50%;
87
+ }
88
+
89
+ .ds-org-chart__reports > .ds-org-chart__item:only-child::after {
90
+ display: none;
91
+ }
92
+
93
+ /* The card: the Widget tile's edge on the primary container. */
94
+ .ds-org-chart__card {
95
+ display: flex;
96
+ align-items: center;
97
+ gap: var(--gap-200);
98
+ min-width: 0;
99
+ padding: var(--padding-200) var(--padding-300);
100
+ background-color: var(--color-bg-container-primary);
101
+ border: var(--border-025) solid var(--color-bg-container-border);
102
+ border-radius: var(--radius-300);
103
+ white-space: nowrap;
104
+ }
105
+
106
+ .ds-org-chart__text {
107
+ display: flex;
108
+ flex-direction: column;
109
+ min-width: 0;
110
+ }
111
+
112
+ .ds-org-chart__name {
113
+ font-family: var(--font-paragraph-sm-emphasis-family);
114
+ font-size: var(--font-paragraph-sm-emphasis-size);
115
+ font-weight: var(--font-paragraph-sm-emphasis-weight);
116
+ line-height: var(--font-paragraph-sm-emphasis-line-height);
117
+ letter-spacing: var(--font-paragraph-sm-emphasis-letter-spacing);
118
+ color: var(--color-text-primary);
119
+ }
120
+
121
+ .ds-org-chart__name--link {
122
+ text-decoration: none;
123
+ border-radius: var(--radius-100);
124
+ }
125
+
126
+ .ds-org-chart__name--link:hover,
127
+ .ds-org-chart__name--link:focus-visible {
128
+ text-decoration: underline;
129
+ }
130
+
131
+ .ds-org-chart__name--link:focus-visible {
132
+ outline: 2px solid var(--color-action-primary-bg);
133
+ outline-offset: 2px;
134
+ }
135
+
136
+ .ds-org-chart__role {
137
+ font-family: var(--font-caption-family);
138
+ font-size: var(--font-caption-size);
139
+ font-weight: var(--font-caption-weight);
140
+ line-height: var(--font-caption-line-height);
141
+ letter-spacing: var(--font-caption-letter-spacing);
142
+ color: var(--color-text-tertiary);
143
+ }
@@ -0,0 +1,44 @@
1
+ import { default as React } from 'react';
2
+ import { LinkComponent } from '../../behaviors/LinkProvider';
3
+ /** One person in the chart, and the people who report to them. */
4
+ export interface OrgChartNode {
5
+ /** A stable id for the person. */
6
+ id: string;
7
+ /** Their name. */
8
+ name: string;
9
+ /** Their role ("Head of design"). */
10
+ role?: string;
11
+ /** An image for their avatar; their initials show without one. */
12
+ avatarSrc?: string;
13
+ /** Makes the person's name a link to their profile. */
14
+ href?: string;
15
+ /** The people who report to them, in order. */
16
+ reports?: OrgChartNode[];
17
+ }
18
+ /** Props owned by OrgChart itself; everything else falls through to the root `<div>`. */
19
+ type OrgChartOwnProps = {
20
+ /** The person at the top, with everyone under them. */
21
+ root: OrgChartNode;
22
+ /** The chart's name, read before the people in it ("Design team"). */
23
+ label: string;
24
+ /**
25
+ * The component the people's links render with, such as Next.js's `Link`,
26
+ * so they navigate through the app's router; a plain `<a>` when unset.
27
+ * This component can render on the server, so it never reads a
28
+ * LinkProvider: pass the prop even under one.
29
+ */
30
+ linkComponent?: LinkComponent;
31
+ /** Additional CSS classes */
32
+ className?: string;
33
+ };
34
+ export interface OrgChartProps extends OrgChartOwnProps, Omit<React.ComponentPropsWithRef<'div'>, keyof OrgChartOwnProps | 'children'> {
35
+ }
36
+ /**
37
+ * Who reports to whom: each person a card with their avatar, name and role,
38
+ * their reports in a row beneath them, joined by lines. The hierarchy is
39
+ * nested lists, so a screen reader hears each person's reports as a list
40
+ * inside their item, at its level. A chart wider than its column scrolls
41
+ * sideways. Server-renderable.
42
+ */
43
+ export declare function OrgChart({ root, label, linkComponent, className, ref, ...rest }: OrgChartProps): React.JSX.Element;
44
+ export {};
@@ -0,0 +1,26 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import "react";
3
+ import { ScrollRegion } from "../../behaviors/ScrollRegion.js";
4
+ import { Avatar } from "../Avatar/Avatar.js";
5
+ import "./OrgChart.css";
6
+ function OrgChart({ root, label, linkComponent, className = "", ref, ...rest }) {
7
+ const Link = linkComponent ?? "a";
8
+ const node = (person) => {
9
+ const reports = person.reports ?? [];
10
+ return /* @__PURE__ */ jsxs("li", { className: "ds-org-chart__item", children: [
11
+ /* @__PURE__ */ jsxs("div", { className: "ds-org-chart__card", children: [
12
+ /* @__PURE__ */ jsx(Avatar, { name: person.name, src: person.avatarSrc, size: "sm", "aria-hidden": "true" }),
13
+ /* @__PURE__ */ jsxs("span", { className: "ds-org-chart__text", children: [
14
+ person.href !== void 0 ? /* @__PURE__ */ jsx(Link, { href: person.href, className: "ds-org-chart__name ds-org-chart__name--link", children: person.name }) : /* @__PURE__ */ jsx("span", { className: "ds-org-chart__name", children: person.name }),
15
+ person.role && /* @__PURE__ */ jsx("span", { className: "ds-org-chart__role", children: person.role })
16
+ ] })
17
+ ] }),
18
+ reports.length > 0 && /* @__PURE__ */ jsx("ul", { className: "ds-org-chart__reports", children: reports.map(node) })
19
+ ] }, person.id);
20
+ };
21
+ const classes = ["ds-org-chart", className].filter(Boolean).join(" ");
22
+ return /* @__PURE__ */ jsx("div", { role: "group", "aria-label": label, ...rest, ref, className: classes, children: /* @__PURE__ */ jsx(ScrollRegion, { className: "ds-org-chart__scroll", children: /* @__PURE__ */ jsx("ul", { className: "ds-org-chart__tree", children: node(root) }) }) });
23
+ }
24
+ export {
25
+ OrgChart
26
+ };
@@ -0,0 +1,74 @@
1
+ /* ============================================
2
+ PAGE HEADER
3
+ Breadcrumb, then the title row: the heading
4
+ and its description at the start, the page's
5
+ actions at the end. The header is its own
6
+ size container, so the actions fold under the
7
+ text by the room it has, never the viewport.
8
+ ============================================ */
9
+
10
+ /* Base */
11
+ .ds-page-header {
12
+ container-type: inline-size;
13
+ display: flex;
14
+ flex-direction: column;
15
+ gap: var(--gap-100);
16
+ min-width: 0;
17
+ }
18
+
19
+ /* Title row */
20
+ .ds-page-header__row {
21
+ display: flex;
22
+ align-items: flex-end;
23
+ justify-content: space-between;
24
+ gap: var(--gap-400);
25
+ }
26
+
27
+ .ds-page-header__text {
28
+ display: flex;
29
+ flex-direction: column;
30
+ gap: var(--gap-100);
31
+ min-width: 0;
32
+ }
33
+
34
+ .ds-page-header__title {
35
+ margin: 0;
36
+ }
37
+
38
+ .ds-page-header__description {
39
+ margin: 0;
40
+ font-family: var(--font-paragraph-family);
41
+ font-size: var(--font-paragraph-size);
42
+ font-weight: var(--font-paragraph-weight);
43
+ line-height: var(--font-paragraph-line-height);
44
+ letter-spacing: var(--font-paragraph-letter-spacing);
45
+ color: var(--color-text-secondary);
46
+ }
47
+
48
+ /* Actions */
49
+ .ds-page-header__actions {
50
+ display: flex;
51
+ flex-wrap: wrap;
52
+ align-items: center;
53
+ justify-content: flex-end;
54
+ gap: var(--gap-200);
55
+ flex-shrink: 0;
56
+ }
57
+
58
+ /* Narrow: the actions take the row under the text and share it evenly. */
59
+ @container (max-width: 560px) {
60
+ .ds-page-header__row {
61
+ flex-direction: column;
62
+ align-items: stretch;
63
+ }
64
+
65
+ .ds-page-header__actions {
66
+ justify-content: stretch;
67
+ }
68
+
69
+ /* Each action starts at its own width and grows to share the row, so a
70
+ label never squeezes: actions that cannot fit side by side wrap. */
71
+ .ds-page-header__actions > * {
72
+ flex: 1 1 auto;
73
+ }
74
+ }
@@ -0,0 +1,39 @@
1
+ import { default as React } from 'react';
2
+ import { LinkComponent } from '../../behaviors/LinkProvider';
3
+ import { BreadcrumbItem } from '../Breadcrumb/Breadcrumb';
4
+ /** Props owned by PageHeader itself; everything else falls through to the root `<header>`. */
5
+ type PageHeaderOwnProps = {
6
+ /**
7
+ * The page's title, its heading.
8
+ * Note: this shadows the native `title` tooltip attribute, which PageHeader does not expose.
9
+ */
10
+ title: React.ReactNode;
11
+ /** A sentence under the title on what the page is for or what it holds. */
12
+ description?: React.ReactNode;
13
+ /** The trail above the title, from the top of the app to this page; the last item is this page and takes no `href`. */
14
+ breadcrumb?: BreadcrumbItem[];
15
+ /** The page's own actions at the end of the title row: one primary Button, a secondary or two. On a narrow page they take the row under the text. */
16
+ actions?: React.ReactNode;
17
+ /** The heading's place in the outline. The page's title is its `h1`; a header inside a tab or a pane can be an `h2`. */
18
+ headingLevel?: 1 | 2;
19
+ /**
20
+ * The component the breadcrumb's links render with, such as Next.js's
21
+ * `Link`, so they navigate through the app's router; a plain `<a>` when
22
+ * unset. This component can render on the server, so it never reads a
23
+ * LinkProvider: pass the prop even under one.
24
+ */
25
+ linkComponent?: LinkComponent;
26
+ /** Additional CSS classes */
27
+ className?: string;
28
+ };
29
+ export interface PageHeaderProps extends PageHeaderOwnProps, Omit<React.ComponentPropsWithRef<'header'>, keyof PageHeaderOwnProps | 'children'> {
30
+ }
31
+ /**
32
+ * The top of a page: where it sits, what it is called, what it is for, and
33
+ * what can be done from it. Breadcrumb, Heading and the page's own actions in
34
+ * one layout that folds the actions under the text when the header is narrow.
35
+ * Inside `<main>` the `<header>` is no landmark, so it takes no name of its
36
+ * own; the heading names the page. Server-renderable.
37
+ */
38
+ export declare function PageHeader({ title, description, breadcrumb, actions, headingLevel, linkComponent, className, ref, ...rest }: PageHeaderProps): React.JSX.Element;
39
+ export {};
@@ -0,0 +1,33 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import "react";
3
+ import { Breadcrumb } from "../Breadcrumb/Breadcrumb.js";
4
+ import { Heading } from "../Heading/Heading.js";
5
+ import "./PageHeader.css";
6
+ function PageHeader({
7
+ title,
8
+ description,
9
+ breadcrumb,
10
+ actions,
11
+ headingLevel = 1,
12
+ linkComponent,
13
+ className = "",
14
+ ref,
15
+ ...rest
16
+ }) {
17
+ const hasDescription = description != null && description !== false && description !== "";
18
+ const hasActions = actions != null && actions !== false;
19
+ const classes = ["ds-page-header", className].filter(Boolean).join(" ");
20
+ return /* @__PURE__ */ jsxs("header", { ...rest, ref, className: classes, children: [
21
+ breadcrumb && breadcrumb.length > 0 && /* @__PURE__ */ jsx(Breadcrumb, { items: breadcrumb, linkComponent, className: "ds-page-header__breadcrumb" }),
22
+ /* @__PURE__ */ jsxs("div", { className: "ds-page-header__row", children: [
23
+ /* @__PURE__ */ jsxs("div", { className: "ds-page-header__text", children: [
24
+ /* @__PURE__ */ jsx(Heading, { level: headingLevel, className: "ds-page-header__title", children: title }),
25
+ hasDescription && /* @__PURE__ */ jsx("p", { className: "ds-page-header__description", children: description })
26
+ ] }),
27
+ hasActions && /* @__PURE__ */ jsx("div", { className: "ds-page-header__actions", children: actions })
28
+ ] })
29
+ ] });
30
+ }
31
+ export {
32
+ PageHeader
33
+ };