@common-origin/design-system 3.0.0 → 3.1.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 (97) hide show
  1. package/dist/client.js +2175 -687
  2. package/dist/client.js.map +1 -1
  3. package/dist/components/atoms/Tooltip/Tooltip.d.mts +41 -0
  4. package/dist/components/atoms/Tooltip/Tooltip.d.ts +41 -0
  5. package/dist/components/atoms/Tooltip/Tooltip.mjs +204 -0
  6. package/dist/components/atoms/Tooltip/Tooltip.mjs.map +1 -0
  7. package/dist/components/atoms/Tooltip/index.d.mts +2 -0
  8. package/dist/components/atoms/Tooltip/index.d.ts +2 -0
  9. package/dist/components/atoms/index.d.mts +1 -0
  10. package/dist/components/atoms/index.d.ts +1 -0
  11. package/dist/components/index.d.mts +1 -0
  12. package/dist/components/index.d.ts +1 -0
  13. package/dist/components/molecules/ActionSheet/ActionSheet.mjs +1 -0
  14. package/dist/components/molecules/Alert/Alert.mjs +1 -1
  15. package/dist/components/molecules/ChipGroup/ChipGroup.mjs +1 -0
  16. package/dist/components/molecules/List/List.d.mts +2 -0
  17. package/dist/components/molecules/List/List.d.ts +2 -0
  18. package/dist/components/molecules/List/ListItem.d.mts +2 -0
  19. package/dist/components/molecules/List/ListItem.d.ts +2 -0
  20. package/dist/components/molecules/List/ListItem.mjs +5 -5
  21. package/dist/components/molecules/Menu/Menu.d.mts +117 -0
  22. package/dist/components/molecules/Menu/Menu.d.ts +117 -0
  23. package/dist/components/molecules/Menu/Menu.mjs +473 -0
  24. package/dist/components/molecules/Menu/Menu.mjs.map +1 -0
  25. package/dist/components/molecules/Menu/index.d.mts +2 -0
  26. package/dist/components/molecules/Menu/index.d.ts +2 -0
  27. package/dist/components/molecules/SearchField/SearchField.mjs +2 -0
  28. package/dist/components/molecules/SidebarNavItem/SidebarNavContext.d.mts +13 -0
  29. package/dist/components/molecules/SidebarNavItem/SidebarNavContext.d.ts +13 -0
  30. package/dist/components/molecules/SidebarNavItem/SidebarNavContext.mjs +13 -0
  31. package/dist/components/molecules/SidebarNavItem/SidebarNavContext.mjs.map +1 -0
  32. package/dist/components/molecules/SidebarNavItem/SidebarNavItem.d.mts +43 -0
  33. package/dist/components/molecules/SidebarNavItem/SidebarNavItem.d.ts +43 -0
  34. package/dist/components/molecules/SidebarNavItem/SidebarNavItem.mjs +148 -0
  35. package/dist/components/molecules/SidebarNavItem/SidebarNavItem.mjs.map +1 -0
  36. package/dist/components/molecules/SidebarNavItem/index.d.mts +2 -0
  37. package/dist/components/molecules/SidebarNavItem/index.d.ts +2 -0
  38. package/dist/components/molecules/SidebarNavSection/SidebarNavSection.d.mts +36 -0
  39. package/dist/components/molecules/SidebarNavSection/SidebarNavSection.d.ts +36 -0
  40. package/dist/components/molecules/SidebarNavSection/SidebarNavSection.mjs +188 -0
  41. package/dist/components/molecules/SidebarNavSection/SidebarNavSection.mjs.map +1 -0
  42. package/dist/components/molecules/SidebarNavSection/index.d.mts +2 -0
  43. package/dist/components/molecules/SidebarNavSection/index.d.ts +2 -0
  44. package/dist/components/molecules/TransactionListItem/TransactionListItem.mjs +1 -1
  45. package/dist/components/molecules/WorkspaceSwitcher/WorkspaceSwitcher.d.mts +39 -0
  46. package/dist/components/molecules/WorkspaceSwitcher/WorkspaceSwitcher.d.ts +39 -0
  47. package/dist/components/molecules/WorkspaceSwitcher/WorkspaceSwitcher.mjs +131 -0
  48. package/dist/components/molecules/WorkspaceSwitcher/WorkspaceSwitcher.mjs.map +1 -0
  49. package/dist/components/molecules/WorkspaceSwitcher/index.d.mts +2 -0
  50. package/dist/components/molecules/WorkspaceSwitcher/index.d.ts +2 -0
  51. package/dist/components/molecules/index.d.mts +4 -0
  52. package/dist/components/molecules/index.d.ts +4 -0
  53. package/dist/components/organisms/SidebarNav/SidebarNav.d.mts +52 -0
  54. package/dist/components/organisms/SidebarNav/SidebarNav.d.ts +52 -0
  55. package/dist/components/organisms/SidebarNav/SidebarNav.mjs +235 -0
  56. package/dist/components/organisms/SidebarNav/SidebarNav.mjs.map +1 -0
  57. package/dist/components/organisms/SidebarNav/index.d.mts +2 -0
  58. package/dist/components/organisms/SidebarNav/index.d.ts +2 -0
  59. package/dist/components/organisms/index.d.mts +1 -0
  60. package/dist/components/organisms/index.d.ts +1 -0
  61. package/dist/data.js +59 -9
  62. package/dist/data.js.map +1 -1
  63. package/dist/index.js +11 -0
  64. package/dist/index.js.map +1 -1
  65. package/dist/index.mjs +6 -0
  66. package/dist/index.mjs.map +1 -1
  67. package/dist/lib/floatingPosition.d.mts +43 -0
  68. package/dist/lib/floatingPosition.d.ts +43 -0
  69. package/dist/lib/floatingPosition.mjs +86 -0
  70. package/dist/lib/floatingPosition.mjs.map +1 -0
  71. package/dist/lib/keyboardFocus.d.mts +6 -0
  72. package/dist/lib/keyboardFocus.d.ts +6 -0
  73. package/dist/lib/keyboardFocus.mjs +17 -0
  74. package/dist/lib/keyboardFocus.mjs.map +1 -0
  75. package/dist/lib/useFloatingLayer.d.mts +25 -0
  76. package/dist/lib/useFloatingLayer.d.ts +25 -0
  77. package/dist/lib/useFloatingLayer.mjs +86 -0
  78. package/dist/lib/useFloatingLayer.mjs.map +1 -0
  79. package/dist/styles/icons.json +30 -1
  80. package/dist/styles/icons.json.mjs +34 -3
  81. package/dist/styles/icons.json.mjs.map +1 -1
  82. package/dist/styles/tokens.d.mts +46 -8
  83. package/dist/styles/tokens.d.ts +46 -8
  84. package/dist/styles/tokens.json +26 -7
  85. package/dist/styles/tokens.json.mjs +26 -7
  86. package/dist/styles/tokens.json.mjs.map +1 -1
  87. package/dist/tokens/index.js +26 -7
  88. package/dist/tokens/index.js.map +1 -1
  89. package/dist/tokens/index.mjs +26 -7
  90. package/dist/tokens/index.mjs.map +1 -1
  91. package/dist/tokens/styles/tokens.d.mts +46 -8
  92. package/dist/tokens/styles/tokens.d.ts +46 -8
  93. package/dist/tokens.css +35 -15
  94. package/dist/types/icons.d.mts +1 -1
  95. package/dist/types/icons.d.ts +1 -1
  96. package/dist/types/icons.mjs.map +1 -1
  97. package/package.json +2 -2
@@ -0,0 +1,41 @@
1
+ import React from 'react';
2
+ import { type FloatingAlign, type FloatingSide } from '../../../lib/floatingPosition.mjs';
3
+ export type TooltipSide = FloatingSide;
4
+ export type TooltipAlign = FloatingAlign;
5
+ export interface TooltipProps {
6
+ /** The tooltip's text. In `label` mode it repeats the trigger's existing accessible name. */
7
+ text: string;
8
+ /**
9
+ * `label` (default) shows the name the trigger already has, such as an IconButton's
10
+ * `aria-label`, and is hidden from assistive technology so the name isn't announced twice.
11
+ * `description` adds non-essential help, linked to the trigger with `aria-describedby`. Hover
12
+ * text can't be reached on touch screens, so anything a user needs must be visible text.
13
+ * @default 'label'
14
+ */
15
+ kind?: 'label' | 'description';
16
+ /**
17
+ * The side of the trigger it opens on. It flips to the opposite side when there's no room.
18
+ * @default 'top'
19
+ */
20
+ side?: TooltipSide;
21
+ /**
22
+ * Where it lines up along the trigger's edge.
23
+ * @default 'center'
24
+ */
25
+ align?: TooltipAlign;
26
+ /** One focusable element: the trigger */
27
+ children: React.ReactElement;
28
+ /** Test identifier for the tooltip bubble */
29
+ 'data-testid'?: string;
30
+ }
31
+ /**
32
+ * A short label or hint that appears beside a control on hover or keyboard focus (#326).
33
+ *
34
+ * Opens after `motion.delay.hint` of hover, at once on keyboard focus, and at once when the pointer
35
+ * moves on from another tooltip. Stays open while the pointer is over it; closes on pointer leave,
36
+ * blur, scroll and Escape. Doesn't open on touch.
37
+ */
38
+ export declare const Tooltip: {
39
+ ({ text, kind, side, align, children, "data-testid": dataTestId, }: TooltipProps): import("react/jsx-runtime").JSX.Element;
40
+ displayName: string;
41
+ };
@@ -0,0 +1,41 @@
1
+ import React from 'react';
2
+ import { type FloatingAlign, type FloatingSide } from '../../../lib/floatingPosition';
3
+ export type TooltipSide = FloatingSide;
4
+ export type TooltipAlign = FloatingAlign;
5
+ export interface TooltipProps {
6
+ /** The tooltip's text. In `label` mode it repeats the trigger's existing accessible name. */
7
+ text: string;
8
+ /**
9
+ * `label` (default) shows the name the trigger already has, such as an IconButton's
10
+ * `aria-label`, and is hidden from assistive technology so the name isn't announced twice.
11
+ * `description` adds non-essential help, linked to the trigger with `aria-describedby`. Hover
12
+ * text can't be reached on touch screens, so anything a user needs must be visible text.
13
+ * @default 'label'
14
+ */
15
+ kind?: 'label' | 'description';
16
+ /**
17
+ * The side of the trigger it opens on. It flips to the opposite side when there's no room.
18
+ * @default 'top'
19
+ */
20
+ side?: TooltipSide;
21
+ /**
22
+ * Where it lines up along the trigger's edge.
23
+ * @default 'center'
24
+ */
25
+ align?: TooltipAlign;
26
+ /** One focusable element: the trigger */
27
+ children: React.ReactElement;
28
+ /** Test identifier for the tooltip bubble */
29
+ 'data-testid'?: string;
30
+ }
31
+ /**
32
+ * A short label or hint that appears beside a control on hover or keyboard focus (#326).
33
+ *
34
+ * Opens after `motion.delay.hint` of hover, at once on keyboard focus, and at once when the pointer
35
+ * moves on from another tooltip. Stays open while the pointer is over it; closes on pointer leave,
36
+ * blur, scroll and Escape. Doesn't open on touch.
37
+ */
38
+ export declare const Tooltip: {
39
+ ({ text, kind, side, align, children, "data-testid": dataTestId, }: TooltipProps): import("react/jsx-runtime").JSX.Element;
40
+ displayName: string;
41
+ };
@@ -0,0 +1,204 @@
1
+ 'use client';
2
+ import { __makeTemplateObject } from '../../../vendor/tslib/tslib.es6.mjs';
3
+ import { jsxs, jsx } from 'react/jsx-runtime';
4
+ import React, { useId, useRef, useState, useCallback, useEffect } from 'react';
5
+ import styled$module, { keyframes, css } from 'styled-components';
6
+ const styled = styled$module.default || styled$module;
7
+ import tokens from '../../../lib/cssTokens.mjs';
8
+ import tokensJson from '../../../styles/tokens.json.mjs';
9
+ import { exitAnimation, forcedColorsEdge, visuallyHidden } from '../../../lib/styleUtils.mjs';
10
+ import { usePresence } from '../../../lib/usePresence.mjs';
11
+ import { useFloatingLayer } from '../../../lib/useFloatingLayer.mjs';
12
+ import { isKeyboardFocus } from '../../../lib/keyboardFocus.mjs';
13
+
14
+ var semantic = tokens.semantic;
15
+ var motion = tokensJson.semantic.motion;
16
+ // How long the pointer rests before the tooltip opens (#326)
17
+ var HINT_DELAY_MS = parseInt(motion.delay.hint, 10);
18
+ // Moving to another trigger within this window opens its tooltip at once, so a rail feels immediate
19
+ var SKIP_DELAY_MS = parseInt(motion.duration.slow, 10);
20
+ // The grace period for the pointer to cross from the trigger onto the tooltip (WCAG 1.4.13)
21
+ var CLOSE_GRACE_MS = parseInt(motion.duration.fast, 10);
22
+ // Shared by every Tooltip: only one is open at a time, and the next one opens at once while one
23
+ // is open or within the skip-delay window after it closed
24
+ var lastClosedAt = 0;
25
+ var active = null;
26
+ var fadeIn = keyframes(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n from { opacity: 0; }\n"], ["\n from { opacity: 0; }\n"
27
+ // A fade, so it needs no reduced-motion fallback (0015). Entrances decelerate (0037).
28
+ ])));
29
+ // A fade, so it needs no reduced-motion fallback (0015). Entrances decelerate (0037).
30
+ var Bubble = /*#__PURE__*/styled.div.withConfig({
31
+ shouldForwardProp: function shouldForwardProp(prop) {
32
+ return !prop.startsWith('$');
33
+ },
34
+ displayName: "Tooltip__Bubble",
35
+ componentId: "sc-ajez94-0"
36
+ })(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n /* Reset the popover defaults: it's placed with top and left */\n position: fixed;\n inset: auto;\n top: 0;\n left: 0;\n margin: 0;\n overflow: visible;\n box-sizing: border-box;\n max-width: ", ";\n padding: ", " ", ";\n border: none;\n border-radius: ", ";\n background-color: ", ";\n color: ", ";\n font: ", ";\n overflow-wrap: break-word;\n pointer-events: auto;\n animation: ", " ", " ", "\n ", ";\n\n ", "\n"], ["\n /* Reset the popover defaults: it's placed with top and left */\n position: fixed;\n inset: auto;\n top: 0;\n left: 0;\n margin: 0;\n overflow: visible;\n box-sizing: border-box;\n max-width: ", ";\n padding: ", " ", ";\n border: none;\n border-radius: ", ";\n background-color: ", ";\n color: ", ";\n font: ", ";\n overflow-wrap: break-word;\n pointer-events: auto;\n animation: ", " ", " ", "\n ", ";\n\n ", "\n"])), semantic.size[7500], semantic.space.inset.xs, semantic.space.inset.sm, semantic.radius.sm, semantic.color.fill.inverse, semantic.color.text.inverse, semantic.typography.small, fadeIn, semantic.motion.duration.fast, semantic.motion.easing.decelerate, function (_a) {
37
+ var $exiting = _a.$exiting;
38
+ return $exiting ? exitAnimation : css(templateObject_2 || (templateObject_2 = __makeTemplateObject([""], [""])));
39
+ }, forcedColorsEdge);
40
+ var Description = /*#__PURE__*/styled.span.withConfig({
41
+ displayName: "Tooltip__Description",
42
+ componentId: "sc-ajez94-1"
43
+ })(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"
44
+ // The trigger's wrapper takes no box of its own, so the trigger lays out as if unwrapped
45
+ ])), visuallyHidden);
46
+ // The trigger's wrapper takes no box of its own, so the trigger lays out as if unwrapped
47
+ var Anchor = /*#__PURE__*/styled.span.withConfig({
48
+ displayName: "Tooltip__Anchor",
49
+ componentId: "sc-ajez94-2"
50
+ })(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: contents;\n"], ["\n display: contents;\n"
51
+ /**
52
+ * A short label or hint that appears beside a control on hover or keyboard focus (#326).
53
+ *
54
+ * Opens after `motion.delay.hint` of hover, at once on keyboard focus, and at once when the pointer
55
+ * moves on from another tooltip. Stays open while the pointer is over it; closes on pointer leave,
56
+ * blur, scroll and Escape. Doesn't open on touch.
57
+ */])));
58
+ /**
59
+ * A short label or hint that appears beside a control on hover or keyboard focus (#326).
60
+ *
61
+ * Opens after `motion.delay.hint` of hover, at once on keyboard focus, and at once when the pointer
62
+ * moves on from another tooltip. Stays open while the pointer is over it; closes on pointer leave,
63
+ * blur, scroll and Escape. Doesn't open on touch.
64
+ */
65
+ var Tooltip = function Tooltip(_a) {
66
+ var text = _a.text,
67
+ _b = _a.kind,
68
+ kind = _b === void 0 ? 'label' : _b,
69
+ _c = _a.side,
70
+ side = _c === void 0 ? 'top' : _c,
71
+ _d = _a.align,
72
+ align = _d === void 0 ? 'center' : _d,
73
+ children = _a.children,
74
+ dataTestId = _a["data-testid"];
75
+ var descriptionId = useId();
76
+ var anchorRef = useRef(null);
77
+ var bubbleRef = useRef(null);
78
+ var openTimer = useRef(undefined);
79
+ var closeTimer = useRef(undefined);
80
+ var owner = useState(function () {
81
+ return {};
82
+ })[0];
83
+ // Set by a press, so the focus that follows a click or tap doesn't reopen the tooltip
84
+ var pressed = useRef(false);
85
+ var _e = useState(false),
86
+ isOpen = _e[0],
87
+ setIsOpen = _e[1];
88
+ var _f = usePresence(isOpen),
89
+ isPresent = _f.isPresent,
90
+ isExiting = _f.isExiting;
91
+ var clearTimers = function clearTimers() {
92
+ clearTimeout(openTimer.current);
93
+ clearTimeout(closeTimer.current);
94
+ };
95
+ var close = useCallback(function () {
96
+ clearTimers();
97
+ if ((active === null || active === void 0 ? void 0 : active.owner) === owner) {
98
+ active = null;
99
+ lastClosedAt = Date.now();
100
+ }
101
+ setIsOpen(false);
102
+ }, [owner]);
103
+ var open = useCallback(function () {
104
+ clearTimers();
105
+ if (active && active.owner !== owner) active.close();
106
+ active = {
107
+ owner: owner,
108
+ close: close
109
+ };
110
+ setIsOpen(true);
111
+ }, [owner, close]);
112
+ var scheduleOpen = function scheduleOpen() {
113
+ clearTimeout(closeTimer.current);
114
+ if (isOpen) return;
115
+ // Moving straight from one trigger to the next (another tooltip still open) or just after one
116
+ // closed skips the delay, so a rail feels immediate
117
+ if (active || Date.now() - lastClosedAt < SKIP_DELAY_MS) return open();
118
+ clearTimeout(openTimer.current);
119
+ openTimer.current = setTimeout(open, HINT_DELAY_MS);
120
+ };
121
+ var scheduleClose = function scheduleClose() {
122
+ clearTimeout(openTimer.current);
123
+ clearTimeout(closeTimer.current);
124
+ closeTimer.current = setTimeout(close, CLOSE_GRACE_MS);
125
+ };
126
+ useEffect(function () {
127
+ return function () {
128
+ clearTimers();
129
+ if ((active === null || active === void 0 ? void 0 : active.owner) === owner) active = null;
130
+ };
131
+ }, [owner]);
132
+ // While open: Escape closes it without moving focus, and before anything else hears the key
133
+ // (an Escape meant for the tooltip mustn't also close a Modal)
134
+ useEffect(function () {
135
+ if (!isOpen) return;
136
+ var onKeyDown = function onKeyDown(event) {
137
+ if (event.key !== 'Escape') return;
138
+ event.stopPropagation();
139
+ close();
140
+ };
141
+ window.addEventListener('keydown', onKeyDown, true);
142
+ return function () {
143
+ return window.removeEventListener('keydown', onKeyDown, true);
144
+ };
145
+ }, [isOpen, close]);
146
+ // In the top layer beside the trigger; scrolling or resizing closes it, since the trigger moves
147
+ useFloatingLayer({
148
+ isPresent: isPresent,
149
+ floatingRef: bubbleRef,
150
+ anchorRef: anchorRef,
151
+ side: side,
152
+ align: align,
153
+ onDetach: close
154
+ });
155
+ var child = React.Children.only(children);
156
+ var describedBy = [child.props['aria-describedby'], kind === 'description' ? descriptionId : undefined].filter(Boolean).join(' ') || undefined;
157
+ return jsxs(Anchor, {
158
+ ref: anchorRef,
159
+ onPointerEnter: function onPointerEnter(event) {
160
+ return event.pointerType !== 'touch' && scheduleOpen();
161
+ },
162
+ onPointerLeave: function onPointerLeave(event) {
163
+ return event.pointerType !== 'touch' && scheduleClose();
164
+ },
165
+ onFocus: function onFocus(event) {
166
+ // Keyboard focus opens it at once; a click's or tap's focus doesn't
167
+ if (pressed.current) {
168
+ pressed.current = false;
169
+ return;
170
+ }
171
+ if (isKeyboardFocus(event.target)) open();
172
+ },
173
+ onBlur: function onBlur() {
174
+ // A press on an already focused trigger has no focus to skip; don't carry it over
175
+ pressed.current = false;
176
+ close();
177
+ },
178
+ // Pressing the trigger acts on it, so the hint has done its job
179
+ onPointerDown: function onPointerDown() {
180
+ pressed.current = true;
181
+ close();
182
+ },
183
+ children: [/*#__PURE__*/React.cloneElement(child, {
184
+ 'aria-describedby': describedBy
185
+ }), kind === 'description' && jsx(Description, {
186
+ id: descriptionId,
187
+ children: text
188
+ }), isPresent &&
189
+ // Hidden from assistive technology: a label repeats the trigger's name, and a
190
+ // description reaches it through aria-describedby on the always-present text above
191
+ jsx(Bubble, {
192
+ ref: bubbleRef,
193
+ "aria-hidden": "true",
194
+ "$exiting": isExiting,
195
+ "data-testid": dataTestId,
196
+ children: text
197
+ })]
198
+ });
199
+ };
200
+ Tooltip.displayName = 'Tooltip';
201
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
202
+
203
+ export { Tooltip };
204
+ //# sourceMappingURL=Tooltip.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tooltip.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export { Tooltip } from './Tooltip.mjs';
2
+ export type { TooltipProps, TooltipSide, TooltipAlign } from './Tooltip.mjs';
@@ -0,0 +1,2 @@
1
+ export { Tooltip } from './Tooltip';
2
+ export type { TooltipProps, TooltipSide, TooltipAlign } from './Tooltip';
@@ -15,5 +15,6 @@ export * from './Divider/index.mjs';
15
15
  export * from './Stack/index.mjs';
16
16
  export * from './StatusLabel/index.mjs';
17
17
  export * from './Tag/index.mjs';
18
+ export * from './Tooltip/index.mjs';
18
19
  export * from './Typography/index.mjs';
19
20
  export * from './AILabel/index.mjs';
@@ -15,5 +15,6 @@ export * from './Divider';
15
15
  export * from './Stack';
16
16
  export * from './StatusLabel';
17
17
  export * from './Tag';
18
+ export * from './Tooltip';
18
19
  export * from './Typography';
19
20
  export * from './AILabel';
@@ -1,4 +1,5 @@
1
1
  export * from './atoms//index.mjs';
2
2
  export * from './molecules//index.mjs';
3
+ export * from './organisms//index.mjs';
3
4
  export * from './layout//index.mjs';
4
5
  export { ResponsiveGrid, GridCol, Grid } from './layout/GridSystem/index.mjs';
@@ -1,4 +1,5 @@
1
1
  export * from './atoms/';
2
2
  export * from './molecules/';
3
+ export * from './organisms/';
3
4
  export * from './layout/';
4
5
  export { ResponsiveGrid, GridCol, Grid } from './layout/GridSystem';
@@ -269,6 +269,7 @@ var ActionSheet = function ActionSheet(_a) {
269
269
  },
270
270
  disabled: action.disabled,
271
271
  destructive: action.destructive,
272
+ // Deprecated prop (0051), kept for this padding until 4.0 removes it
272
273
  spacing: "compact"
273
274
  })]
274
275
  }, action.id);
@@ -91,7 +91,7 @@ var StyledContent = /*#__PURE__*/styled.div.withConfig({
91
91
  var StyledTitle = /*#__PURE__*/styled.span.withConfig({
92
92
  displayName: "Alert__StyledTitle",
93
93
  componentId: "sc-18tq5d-3"
94
- })(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n font: ", ";\n font-weight: ", ";\n line-height: ", ";\n margin: 0;\n"], ["\n font: ", ";\n font-weight: ", ";\n line-height: ", ";\n margin: 0;\n"])), alert.title.typography, alert.title.fontWeight, alert.title.lineHeight);
94
+ })(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n font: ", ";\n line-height: ", ";\n margin: 0;\n"], ["\n font: ", ";\n line-height: ", ";\n margin: 0;\n"])), alert.title.typography, alert.title.lineHeight);
95
95
  var StyledMessage = /*#__PURE__*/styled.span.withConfig({
96
96
  displayName: "Alert__StyledMessage",
97
97
  componentId: "sc-18tq5d-4"
@@ -22,6 +22,7 @@ import '../../atoms/Divider/Divider.mjs';
22
22
  import { Stack } from '../../atoms/Stack/Stack.mjs';
23
23
  import '../../atoms/StatusLabel/StatusLabel.mjs';
24
24
  import '../../atoms/Tag/Tag.mjs';
25
+ import '../../atoms/Tooltip/Tooltip.mjs';
25
26
  import '../../atoms/Typography/Typography.mjs';
26
27
  import '../../atoms/AILabel/AILabel.mjs';
27
28
 
@@ -13,6 +13,8 @@ export interface ListProps {
13
13
  /**
14
14
  * Density of the list's items: their padding. A ListItem's own `spacing` overrides it (#77).
15
15
  * @default 'comfortable'
16
+ * @deprecated Set density on a region with `data-co-density` instead: rows follow it (P9,
17
+ * decision 0051). `spacing` still sets the padding, but not the height, until it's removed in 4.0.
16
18
  */
17
19
  spacing?: ListSpacing;
18
20
  /**
@@ -13,6 +13,8 @@ export interface ListProps {
13
13
  /**
14
14
  * Density of the list's items: their padding. A ListItem's own `spacing` overrides it (#77).
15
15
  * @default 'comfortable'
16
+ * @deprecated Set density on a region with `data-co-density` instead: rows follow it (P9,
17
+ * decision 0051). `spacing` still sets the padding, but not the height, until it's removed in 4.0.
16
18
  */
17
19
  spacing?: ListSpacing;
18
20
  /**
@@ -59,6 +59,8 @@ export interface ListItemProps {
59
59
  /**
60
60
  * Density of this item. Defaults to the parent List's `spacing`, or `comfortable` outside a
61
61
  * List; set it to override the List for this item (#77).
62
+ * @deprecated Set density on a region with `data-co-density` instead: rows follow it (P9,
63
+ * decision 0051). `spacing` still sets the padding, but not the height, until it's removed in 4.0.
62
64
  */
63
65
  spacing?: ListSpacing;
64
66
  /**
@@ -59,6 +59,8 @@ export interface ListItemProps {
59
59
  /**
60
60
  * Density of this item. Defaults to the parent List's `spacing`, or `comfortable` outside a
61
61
  * List; set it to override the List for this item (#77).
62
+ * @deprecated Set density on a region with `data-co-density` instead: rows follow it (P9,
63
+ * decision 0051). `spacing` still sets the padding, but not the height, until it's removed in 4.0.
62
64
  */
63
65
  spacing?: ListSpacing;
64
66
  /**
@@ -20,7 +20,7 @@ var StyledListItem = /*#__PURE__*/styled.li.withConfig({
20
20
  },
21
21
  displayName: "ListItem__StyledListItem",
22
22
  componentId: "sc-1wzzt21-0"
23
- })(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n min-height: ", ";\n position: relative;\n \n /* Disable user selection for interactive items */\n ", "\n \n /* Disabled state */\n ", "\n \n /* Destructive state - apply error color to text */\n ", "\n"], ["\n display: flex;\n flex-direction: column;\n min-height: ", ";\n position: relative;\n \n /* Disable user selection for interactive items */\n ", "\n \n /* Disabled state */\n ", "\n \n /* Destructive state - apply error color to text */\n ", "\n"])), semantic.size.touchTarget, function (_a) {
23
+ })(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n min-height: ", ";\n position: relative;\n \n /* Disable user selection for interactive items */\n ", "\n \n /* Disabled state */\n ", "\n \n /* Destructive state - apply error color to text */\n ", "\n"], ["\n display: flex;\n flex-direction: column;\n min-height: ", ";\n position: relative;\n \n /* Disable user selection for interactive items */\n ", "\n \n /* Disabled state */\n ", "\n \n /* Destructive state - apply error color to text */\n ", "\n"])), semantic.size.row.md, function (_a) {
24
24
  var $interactive = _a.$interactive;
25
25
  return $interactive && 'user-select: none;';
26
26
  }, function (_a) {
@@ -37,9 +37,9 @@ var StyledItemContent = /*#__PURE__*/styled.div.withConfig({
37
37
  },
38
38
  displayName: "ListItem__StyledItemContent",
39
39
  componentId: "sc-1wzzt21-1"
40
- })(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n align-items: flex-start;\n gap: ", ";\n padding: ", ";\n border-radius: ", ";\n transition: background-color ", " ", ", color ", " ", ";\n cursor: ", ";\n \n /* The shared row states (decision 0030). Only interactive, enabled rows respond to hover and\n press; the primary text is Typography, so the row colours it through a selector */\n ", "\n \n /* Focus visible */\n &:focus-visible {\n outline: ", ";\n outline-offset: ", ";\n }\n"], ["\n display: flex;\n align-items: flex-start;\n gap: ", ";\n padding: ", ";\n border-radius: ", ";\n transition: background-color ", " ", ", color ", " ", ";\n cursor: ", ";\n \n /* The shared row states (decision 0030). Only interactive, enabled rows respond to hover and\n press; the primary text is Typography, so the row colours it through a selector */\n ", "\n \n /* Focus visible */\n &:focus-visible {\n outline: ", ";\n outline-offset: ", ";\n }\n"])), semantic.space[300], function (_a) {
40
+ })(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n align-items: flex-start;\n gap: ", ";\n /* Insets, so the row's padding follows density with its height (decision 0051) */\n padding: ", ";\n border-radius: ", ";\n transition: background-color ", " ", ", color ", " ", ";\n cursor: ", ";\n \n /* The shared row states (decision 0030). Only interactive, enabled rows respond to hover and\n press; the primary text is Typography, so the row colours it through a selector */\n ", "\n \n /* Focus visible */\n &:focus-visible {\n outline: ", ";\n outline-offset: ", ";\n }\n"], ["\n display: flex;\n align-items: flex-start;\n gap: ", ";\n /* Insets, so the row's padding follows density with its height (decision 0051) */\n padding: ", ";\n border-radius: ", ";\n transition: background-color ", " ", ", color ", " ", ";\n cursor: ", ";\n \n /* The shared row states (decision 0030). Only interactive, enabled rows respond to hover and\n press; the primary text is Typography, so the row colours it through a selector */\n ", "\n \n /* Focus visible */\n &:focus-visible {\n outline: ", ";\n outline-offset: ", ";\n }\n"])), semantic.space[300], function (_a) {
41
41
  var $spacing = _a.$spacing;
42
- return $spacing === 'compact' ? "".concat(semantic.space[200], " ").concat(semantic.space[300]) : "".concat(semantic.space[300], " ").concat(semantic.space[400]);
42
+ return $spacing === 'compact' ? "".concat(semantic.space.inset.sm, " ").concat(semantic.space.inset.md) : "".concat(semantic.space.inset.md, " ").concat(semantic.space.inset.lg);
43
43
  }, semantic.radius.sm, duration.fast, easing.decelerate, duration.fast, easing.decelerate, function (_a) {
44
44
  var $interactive = _a.$interactive,
45
45
  $disabled = _a.$disabled;
@@ -84,7 +84,7 @@ var StyledExpandedContent = /*#__PURE__*/styled.div.withConfig({
84
84
  },
85
85
  displayName: "ListItem__StyledExpandedContent",
86
86
  componentId: "sc-1wzzt21-6"
87
- })(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n overflow: hidden;\n /* Padding collapses with the height, and visibility hides the content from\n keyboard and screen readers once the collapse finishes. */\n transition: max-height ", " ", ",\n padding ", " ", ",\n opacity ", " ", ",\n visibility ", " ", ";\n max-height: ", ";\n opacity: ", ";\n visibility: ", ";\n\n ", " {\n transition: opacity ", " ", ",\n visibility ", " ", ";\n }\n \n ", "\n"], ["\n overflow: hidden;\n /* Padding collapses with the height, and visibility hides the content from\n keyboard and screen readers once the collapse finishes. */\n transition: max-height ", " ", ",\n padding ", " ", ",\n opacity ", " ", ",\n visibility ", " ", ";\n max-height: ", ";\n opacity: ", ";\n visibility: ", ";\n\n ", " {\n transition: opacity ", " ", ",\n visibility ", " ", ";\n }\n \n ", "\n"])), duration.moderate, easing.decelerate, duration.moderate, easing.decelerate, duration.moderate, easing.decelerate, duration.moderate, easing.decelerate, function (_a) {
87
+ })(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n overflow: hidden;\n /* Padding collapses with the height, and visibility hides the content from\n keyboard and screen readers once the collapse finishes. */\n transition: max-height ", " ", ",\n padding ", " ", ",\n margin ", " ", ",\n opacity ", " ", ",\n visibility ", " ", ";\n max-height: ", ";\n opacity: ", ";\n visibility: ", ";\n\n ", " {\n transition: opacity ", " ", ",\n visibility ", " ", ";\n }\n \n ", "\n"], ["\n overflow: hidden;\n /* Padding collapses with the height, and visibility hides the content from\n keyboard and screen readers once the collapse finishes. */\n transition: max-height ", " ", ",\n padding ", " ", ",\n margin ", " ", ",\n opacity ", " ", ",\n visibility ", " ", ";\n max-height: ", ";\n opacity: ", ";\n visibility: ", ";\n\n ", " {\n transition: opacity ", " ", ",\n visibility ", " ", ";\n }\n \n ", "\n"])), duration.moderate, easing.decelerate, duration.moderate, easing.decelerate, duration.moderate, easing.decelerate, duration.moderate, easing.decelerate, duration.moderate, easing.decelerate, function (_a) {
88
88
  var $expanded = _a.$expanded;
89
89
  return $expanded ? '1000px' : '0';
90
90
  }, function (_a) {
@@ -96,7 +96,7 @@ var StyledExpandedContent = /*#__PURE__*/styled.div.withConfig({
96
96
  }, reducedMotion, duration.moderate, easing.decelerate, duration.moderate, easing.decelerate, function (_a) {
97
97
  var $expanded = _a.$expanded,
98
98
  $spacing = _a.$spacing;
99
- return $expanded && "\n padding: ".concat($spacing === 'compact' ? "".concat(semantic.space[200], " ").concat(semantic.space[300], " ").concat(semantic.space[200], " ").concat(tokens.component.listItem.expandedIndent.compact) : "".concat(semantic.space[200], " ").concat(semantic.space[400], " ").concat(semantic.space[300], " ").concat(tokens.component.listItem.expandedIndent.comfortable), ";\n background-color: ").concat(semantic.surface.raised, ";\n border-radius: ").concat(semantic.radius.sm, ";\n margin: 0 ").concat($spacing === 'compact' ? semantic.space[300] : semantic.space[400], " ").concat($spacing === 'compact' ? semantic.space[200] : semantic.space[300], ";\n ");
99
+ return $expanded && "\n padding: ".concat($spacing === 'compact' ? "".concat(semantic.space[200], " ").concat(semantic.space[300], " ").concat(semantic.space[200], " ").concat(tokens.component.listItem.expandedIndent.compact) : "".concat(semantic.space[200], " ").concat(semantic.space[400], " ").concat(semantic.space[300], " ").concat(tokens.component.listItem.expandedIndent.comfortable), ";\n background-color: ").concat(semantic.surface.raised, ";\n border-radius: ").concat(semantic.radius.sm, ";\n /* The row's own insets, so the panel lines up with the row in every density (0051) */\n margin: 0 ").concat($spacing === 'compact' ? semantic.space.inset.md : semantic.space.inset.lg, " ").concat($spacing === 'compact' ? semantic.space.inset.sm : semantic.space.inset.md, ";\n ");
100
100
  });
101
101
  var ListItem = function ListItem(_a) {
102
102
  var primary = _a.primary,
@@ -0,0 +1,117 @@
1
+ import React from 'react';
2
+ import { type FloatingAlign, type FloatingSide } from '../../../lib/floatingPosition.mjs';
3
+ export type MenuSide = FloatingSide;
4
+ export type MenuAlign = FloatingAlign;
5
+ export interface MenuProps {
6
+ /**
7
+ * The element that opens the menu, such as a Button or IconButton. Menu gives it
8
+ * `aria-haspopup`, `aria-expanded` and `aria-controls`, and the menu takes its name from it.
9
+ */
10
+ trigger: React.ReactElement;
11
+ /** `MenuItem`, `MenuItemRadio`, `MenuItemCheckbox`, `MenuGroup` and `MenuDivider` */
12
+ children: React.ReactNode;
13
+ /** Whether the menu is open (controlled). Use with `onOpenChange`. */
14
+ open?: boolean;
15
+ /**
16
+ * Whether the menu starts open (uncontrolled).
17
+ * @default false
18
+ */
19
+ defaultOpen?: boolean;
20
+ /** Called when the menu opens or closes */
21
+ onOpenChange?: (open: boolean) => void;
22
+ /**
23
+ * The side of the trigger it opens on. It flips when there's no room.
24
+ * @default 'bottom'
25
+ */
26
+ side?: MenuSide;
27
+ /**
28
+ * Where it lines up along the trigger's edge.
29
+ * @default 'start'
30
+ */
31
+ align?: MenuAlign;
32
+ /** Test identifier for the menu */
33
+ 'data-testid'?: string;
34
+ }
35
+ /**
36
+ * A menu of actions and choices that opens from a trigger (#329), following the WAI-ARIA menu
37
+ * button pattern. Not a select: for choosing a form value, use Dropdown.
38
+ */
39
+ export declare const Menu: {
40
+ ({ trigger, children, open: openProp, defaultOpen, onOpenChange, side, align, "data-testid": dataTestId, }: MenuProps): import("react/jsx-runtime").JSX.Element;
41
+ displayName: string;
42
+ };
43
+ interface ItemBaseProps {
44
+ /** The item's label */
45
+ children: React.ReactNode;
46
+ /** A leading Icon or Avatar. Decorative: the label names the item (decision 0028). */
47
+ icon?: React.ReactNode;
48
+ /** Secondary text under the label, such as a workspace's plan */
49
+ description?: React.ReactNode;
50
+ /**
51
+ * A keyboard shortcut shown at the end of the item: `label` is shown (such as "⌘K") and `keys` is
52
+ * exposed as `aria-keyshortcuts` (such as "Meta+K"). Display only: Menu doesn't bind the keys.
53
+ */
54
+ shortcut?: {
55
+ label: string;
56
+ keys: string;
57
+ };
58
+ /** Whether the item can be activated. A disabled item can still be focused (WAI-ARIA). */
59
+ disabled?: boolean;
60
+ /** Text for typeahead, when the label isn't plain text */
61
+ textValue?: string;
62
+ /** Test identifier for the item */
63
+ 'data-testid'?: string;
64
+ }
65
+ export interface MenuItemProps extends ItemBaseProps {
66
+ /** Called when the item is activated. The menu then closes. */
67
+ onSelect?: () => void;
68
+ /**
69
+ * A destructive action, shown in the danger colour as ActionSheet's are.
70
+ * @default false
71
+ */
72
+ destructive?: boolean;
73
+ }
74
+ export interface MenuItemRadioProps extends ItemBaseProps {
75
+ /** Whether this is the chosen item of its group */
76
+ checked: boolean;
77
+ /** Called when the item is chosen. The menu then closes. */
78
+ onSelect?: () => void;
79
+ }
80
+ export interface MenuItemCheckboxProps extends ItemBaseProps {
81
+ /** Whether the item is on */
82
+ checked: boolean;
83
+ /** Called with the new state when the item is toggled. The menu stays open. */
84
+ onCheckedChange?: (checked: boolean) => void;
85
+ }
86
+ /** An action. Activating it closes the menu. */
87
+ export declare const MenuItem: {
88
+ ({ onSelect, ...props }: MenuItemProps): import("react/jsx-runtime").JSX.Element;
89
+ displayName: string;
90
+ };
91
+ /** One choice of a set, inside a MenuGroup. Choosing it closes the menu. */
92
+ export declare const MenuItemRadio: {
93
+ ({ onSelect, checked, ...props }: MenuItemRadioProps): import("react/jsx-runtime").JSX.Element;
94
+ displayName: string;
95
+ };
96
+ /** An on/off option, inside a MenuGroup. Toggling it keeps the menu open. */
97
+ export declare const MenuItemCheckbox: {
98
+ ({ onCheckedChange, checked, ...props }: MenuItemCheckboxProps): import("react/jsx-runtime").JSX.Element;
99
+ displayName: string;
100
+ };
101
+ export interface MenuGroupProps {
102
+ /** A visible label for the group, which also names it for assistive technology */
103
+ label?: string;
104
+ /** The group's items */
105
+ children: React.ReactNode;
106
+ }
107
+ /** Groups related items. Radio and checkbox items always sit in a group. */
108
+ export declare const MenuGroup: {
109
+ ({ label, children }: MenuGroupProps): import("react/jsx-runtime").JSX.Element;
110
+ displayName: string;
111
+ };
112
+ /** Separates groups */
113
+ export declare const MenuDivider: {
114
+ (): import("react/jsx-runtime").JSX.Element;
115
+ displayName: string;
116
+ };
117
+ export {};