@common-origin/design-system 3.0.0 → 3.2.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.
- package/dist/client.js +2622 -830
- package/dist/client.js.map +1 -1
- package/dist/components/atoms/Badge/Badge.d.mts +2 -2
- package/dist/components/atoms/Badge/Badge.d.ts +2 -2
- package/dist/components/atoms/Badge/Badge.mjs +15 -9
- package/dist/components/atoms/Box/Box.d.mts +3 -2
- package/dist/components/atoms/Box/Box.d.ts +3 -2
- package/dist/components/atoms/Button/Button.mjs +1 -1
- package/dist/components/atoms/Chip/shared/ChipBase.mjs +1 -1
- package/dist/components/atoms/IconButton/IconButton.mjs +1 -1
- package/dist/components/atoms/ProgressBar/ProgressBar.d.mts +1 -1
- package/dist/components/atoms/ProgressBar/ProgressBar.d.ts +1 -1
- package/dist/components/atoms/Tag/Tag.d.mts +1 -1
- package/dist/components/atoms/Tag/Tag.d.ts +1 -1
- package/dist/components/atoms/Tooltip/Tooltip.d.mts +47 -0
- package/dist/components/atoms/Tooltip/Tooltip.d.ts +47 -0
- package/dist/components/atoms/Tooltip/Tooltip.mjs +214 -0
- package/dist/components/atoms/Tooltip/Tooltip.mjs.map +1 -0
- package/dist/components/atoms/Tooltip/index.d.mts +2 -0
- package/dist/components/atoms/Tooltip/index.d.ts +2 -0
- package/dist/components/atoms/index.d.mts +1 -0
- package/dist/components/atoms/index.d.ts +1 -0
- package/dist/components/index.d.mts +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/molecules/ActionSheet/ActionSheet.mjs +3 -2
- package/dist/components/molecules/Alert/Alert.mjs +2 -2
- package/dist/components/molecules/Checkbox/SelectableInputBase.mjs +1 -1
- package/dist/components/molecules/ChipGroup/ChipGroup.mjs +1 -0
- package/dist/components/molecules/Dropdown/Dropdown.mjs +1 -1
- package/dist/components/molecules/List/List.d.mts +2 -0
- package/dist/components/molecules/List/List.d.ts +2 -0
- package/dist/components/molecules/List/ListItem.d.mts +2 -0
- package/dist/components/molecules/List/ListItem.d.ts +2 -0
- package/dist/components/molecules/List/ListItem.mjs +7 -7
- package/dist/components/molecules/Menu/Menu.d.mts +124 -0
- package/dist/components/molecules/Menu/Menu.d.ts +124 -0
- package/dist/components/molecules/Menu/Menu.mjs +476 -0
- package/dist/components/molecules/Menu/Menu.mjs.map +1 -0
- package/dist/components/molecules/Menu/index.d.mts +2 -0
- package/dist/components/molecules/Menu/index.d.ts +2 -0
- package/dist/components/molecules/Modal/Modal.mjs +1 -1
- package/dist/components/molecules/NumberInput/NumberInput.mjs +2 -1
- package/dist/components/molecules/PasswordField/PasswordField.mjs +3 -2
- package/dist/components/molecules/SearchField/SearchField.mjs +5 -3
- package/dist/components/molecules/Sheet/Sheet.mjs +3 -3
- package/dist/components/molecules/SidebarNavItem/SidebarNavContext.d.mts +13 -0
- package/dist/components/molecules/SidebarNavItem/SidebarNavContext.d.ts +13 -0
- package/dist/components/molecules/SidebarNavItem/SidebarNavContext.mjs +13 -0
- package/dist/components/molecules/SidebarNavItem/SidebarNavContext.mjs.map +1 -0
- package/dist/components/molecules/SidebarNavItem/SidebarNavItem.d.mts +44 -0
- package/dist/components/molecules/SidebarNavItem/SidebarNavItem.d.ts +44 -0
- package/dist/components/molecules/SidebarNavItem/SidebarNavItem.mjs +235 -0
- package/dist/components/molecules/SidebarNavItem/SidebarNavItem.mjs.map +1 -0
- package/dist/components/molecules/SidebarNavItem/index.d.mts +2 -0
- package/dist/components/molecules/SidebarNavItem/index.d.ts +2 -0
- package/dist/components/molecules/SidebarNavItem/sidebarNavMotion.d.mts +30 -0
- package/dist/components/molecules/SidebarNavItem/sidebarNavMotion.d.ts +30 -0
- package/dist/components/molecules/SidebarNavItem/sidebarNavMotion.mjs +69 -0
- package/dist/components/molecules/SidebarNavItem/sidebarNavMotion.mjs.map +1 -0
- package/dist/components/molecules/SidebarNavSection/SidebarNavSection.d.mts +36 -0
- package/dist/components/molecules/SidebarNavSection/SidebarNavSection.d.ts +36 -0
- package/dist/components/molecules/SidebarNavSection/SidebarNavSection.mjs +202 -0
- package/dist/components/molecules/SidebarNavSection/SidebarNavSection.mjs.map +1 -0
- package/dist/components/molecules/SidebarNavSection/index.d.mts +2 -0
- package/dist/components/molecules/SidebarNavSection/index.d.ts +2 -0
- package/dist/components/molecules/TabBar/TabBar.mjs +3 -3
- package/dist/components/molecules/TransactionListItem/TransactionListItem.mjs +1 -1
- package/dist/components/molecules/WorkspaceSwitcher/WorkspaceSwitcher.d.mts +39 -0
- package/dist/components/molecules/WorkspaceSwitcher/WorkspaceSwitcher.d.ts +39 -0
- package/dist/components/molecules/WorkspaceSwitcher/WorkspaceSwitcher.mjs +133 -0
- package/dist/components/molecules/WorkspaceSwitcher/WorkspaceSwitcher.mjs.map +1 -0
- package/dist/components/molecules/WorkspaceSwitcher/index.d.mts +2 -0
- package/dist/components/molecules/WorkspaceSwitcher/index.d.ts +2 -0
- package/dist/components/molecules/index.d.mts +4 -0
- package/dist/components/molecules/index.d.ts +4 -0
- package/dist/components/organisms/SidebarNav/SidebarNav.d.mts +52 -0
- package/dist/components/organisms/SidebarNav/SidebarNav.d.ts +52 -0
- package/dist/components/organisms/SidebarNav/SidebarNav.mjs +346 -0
- package/dist/components/organisms/SidebarNav/SidebarNav.mjs.map +1 -0
- package/dist/components/organisms/SidebarNav/index.d.mts +2 -0
- package/dist/components/organisms/SidebarNav/index.d.ts +2 -0
- package/dist/components/organisms/index.d.mts +1 -0
- package/dist/components/organisms/index.d.ts +1 -0
- package/dist/data.js +155 -68
- package/dist/data.js.map +1 -1
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -0
- package/dist/index.mjs.map +1 -1
- package/dist/lib/floatingPosition.d.mts +43 -0
- package/dist/lib/floatingPosition.d.ts +43 -0
- package/dist/lib/floatingPosition.mjs +86 -0
- package/dist/lib/floatingPosition.mjs.map +1 -0
- package/dist/lib/keyboardFocus.d.mts +6 -0
- package/dist/lib/keyboardFocus.d.ts +6 -0
- package/dist/lib/keyboardFocus.mjs +17 -0
- package/dist/lib/keyboardFocus.mjs.map +1 -0
- package/dist/lib/styleUtils.d.mts +4 -0
- package/dist/lib/styleUtils.d.ts +4 -0
- package/dist/lib/styleUtils.mjs +5 -1
- package/dist/lib/styleUtils.mjs.map +1 -1
- package/dist/lib/tokenAliases.mjs +1 -0
- package/dist/lib/tokenAliases.mjs.map +1 -1
- package/dist/lib/useFloatingLayer.d.mts +32 -0
- package/dist/lib/useFloatingLayer.d.ts +32 -0
- package/dist/lib/useFloatingLayer.mjs +95 -0
- package/dist/lib/useFloatingLayer.mjs.map +1 -0
- package/dist/styles/icons.json +30 -1
- package/dist/styles/icons.json.mjs +34 -3
- package/dist/styles/icons.json.mjs.map +1 -1
- package/dist/styles/tokens.d.mts +139 -32
- package/dist/styles/tokens.d.ts +139 -32
- package/dist/styles/tokens.json +122 -66
- package/dist/styles/tokens.json.mjs +122 -66
- package/dist/styles/tokens.json.mjs.map +1 -1
- package/dist/tokens/index.js +122 -66
- package/dist/tokens/index.js.map +1 -1
- package/dist/tokens/index.mjs +122 -66
- package/dist/tokens/index.mjs.map +1 -1
- package/dist/tokens/styles/tokens.d.mts +139 -32
- package/dist/tokens/styles/tokens.d.ts +139 -32
- package/dist/tokens.css +1137 -86
- package/dist/types/icons.d.mts +1 -1
- package/dist/types/icons.d.ts +1 -1
- package/dist/types/icons.mjs.map +1 -1
- package/package.json +4 -2
|
@@ -0,0 +1,476 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { __makeTemplateObject, __rest, __assign, __spreadArray } from '../../../vendor/tslib/tslib.es6.mjs';
|
|
3
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
|
+
import { useId, useRef, useState, useCallback, useEffect, createContext, useContext } 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 { exitAnimation, reducedMotion, forcedColorsEdge, interactiveRow } from '../../../lib/styleUtils.mjs';
|
|
9
|
+
import { usePresence } from '../../../lib/usePresence.mjs';
|
|
10
|
+
import { laidOutElement } from '../../../lib/floatingPosition.mjs';
|
|
11
|
+
import { ANCHOR_WIDTH_VAR, useIsomorphicLayoutEffect, useFloatingLayer } from '../../../lib/useFloatingLayer.mjs';
|
|
12
|
+
import { Icon } from '../../atoms/Icon/Icon.mjs';
|
|
13
|
+
|
|
14
|
+
var semantic = tokens.semantic;
|
|
15
|
+
var space = semantic.space,
|
|
16
|
+
color = semantic.color,
|
|
17
|
+
motion = semantic.motion,
|
|
18
|
+
radius = semantic.radius,
|
|
19
|
+
size = semantic.size,
|
|
20
|
+
elevation = semantic.elevation,
|
|
21
|
+
border = semantic.border,
|
|
22
|
+
typography = semantic.typography;
|
|
23
|
+
// Typeahead keeps typed characters together for this long. An input timing, not a motion value.
|
|
24
|
+
var TYPEAHEAD_RESET_MS = 500;
|
|
25
|
+
var ITEM_SELECTOR = '[role="menuitem"], [role="menuitemradio"], [role="menuitemcheckbox"]';
|
|
26
|
+
var MenuContext = /*#__PURE__*/createContext(null);
|
|
27
|
+
var useMenu = function useMenu(component) {
|
|
28
|
+
var context = useContext(MenuContext);
|
|
29
|
+
if (!context) throw new Error("".concat(component, " must be used inside a Menu"));
|
|
30
|
+
return context;
|
|
31
|
+
};
|
|
32
|
+
var enter = keyframes(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n from {\n opacity: 0;\n transform: translateY(calc(-1 * ", "));\n }\n"], ["\n from {\n opacity: 0;\n transform: translateY(calc(-1 * ", "));\n }\n"])), motion.distance.sm);
|
|
33
|
+
var fade = keyframes(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n from { opacity: 0; }\n"], ["\n from { opacity: 0; }\n"
|
|
34
|
+
// Dropdown's panel (P5): the raised surface with a decorative outline and floating elevation,
|
|
35
|
+
// dropping in over duration.fast (0037); under reduced motion it only fades (0015)
|
|
36
|
+
])));
|
|
37
|
+
// Dropdown's panel (P5): the raised surface with a decorative outline and floating elevation,
|
|
38
|
+
// dropping in over duration.fast (0037); under reduced motion it only fades (0015)
|
|
39
|
+
var Panel = /*#__PURE__*/styled.div.withConfig({
|
|
40
|
+
shouldForwardProp: function shouldForwardProp(prop) {
|
|
41
|
+
return !prop.startsWith('$');
|
|
42
|
+
},
|
|
43
|
+
displayName: "Menu__Panel",
|
|
44
|
+
componentId: "sc-13mple2-0"
|
|
45
|
+
})(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n position: fixed;\n inset: auto;\n top: 0;\n left: 0;\n margin: 0;\n box-sizing: border-box;\n /* At least the trigger's width when matchTriggerWidth sets the variable, within the usual range */\n min-width: min(max(", ", var(", ", 0px)), ", ");\n max-width: ", ";\n max-height: ", ";\n overflow-y: auto;\n padding: ", " 0;\n background-color: ", ";\n color: ", ";\n border: ", ";\n border-radius: ", ";\n box-shadow: ", ";\n animation: ", " ", " ", "\n ", ";\n\n ", " {\n animation: ", " ", " ", "\n ", ";\n }\n\n ", "\n\n &:focus {\n outline: none;\n }\n"], ["\n position: fixed;\n inset: auto;\n top: 0;\n left: 0;\n margin: 0;\n box-sizing: border-box;\n /* At least the trigger's width when matchTriggerWidth sets the variable, within the usual range */\n min-width: min(max(", ", var(", ", 0px)), ", ");\n max-width: ", ";\n max-height: ", ";\n overflow-y: auto;\n padding: ", " 0;\n background-color: ", ";\n color: ", ";\n border: ", ";\n border-radius: ", ";\n box-shadow: ", ";\n animation: ", " ", " ", "\n ", ";\n\n ", " {\n animation: ", " ", " ", "\n ", ";\n }\n\n ", "\n\n &:focus {\n outline: none;\n }\n"
|
|
46
|
+
// The trigger's wrapper takes no box of its own
|
|
47
|
+
])), size[4500], ANCHOR_WIDTH_VAR, size[7500], size[7500], size.menu.maxHeight, space[100], semantic.surface.overlay, color.text["default"], border["default"], radius.md, elevation.floating, enter, motion.duration.fast, motion.easing.decelerate, function (_a) {
|
|
48
|
+
var $exiting = _a.$exiting;
|
|
49
|
+
return $exiting ? exitAnimation : css(templateObject_3 || (templateObject_3 = __makeTemplateObject([""], [""])));
|
|
50
|
+
}, reducedMotion, fade, motion.duration.fast, motion.easing.decelerate, function (_a) {
|
|
51
|
+
var $exiting = _a.$exiting;
|
|
52
|
+
return $exiting ? exitAnimation : css(templateObject_4 || (templateObject_4 = __makeTemplateObject([""], [""])));
|
|
53
|
+
}, forcedColorsEdge);
|
|
54
|
+
// The trigger's wrapper takes no box of its own
|
|
55
|
+
var Anchor = /*#__PURE__*/styled.span.withConfig({
|
|
56
|
+
displayName: "Menu__Anchor",
|
|
57
|
+
componentId: "sc-13mple2-1"
|
|
58
|
+
})(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n display: contents;\n"], ["\n display: contents;\n"])));
|
|
59
|
+
var focusItem = function focusItem(menu, which) {
|
|
60
|
+
var _a;
|
|
61
|
+
var items = menu ? Array.from(menu.querySelectorAll(ITEM_SELECTOR)) : [];
|
|
62
|
+
(_a = which === 'first' ? items[0] : items[items.length - 1]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* A menu of actions and choices that opens from a trigger (#329), following the WAI-ARIA menu
|
|
66
|
+
* button pattern. Not a select: for choosing a form value, use Dropdown.
|
|
67
|
+
*/
|
|
68
|
+
var Menu = function Menu(_a) {
|
|
69
|
+
var trigger = _a.trigger,
|
|
70
|
+
children = _a.children,
|
|
71
|
+
openProp = _a.open,
|
|
72
|
+
_b = _a.defaultOpen,
|
|
73
|
+
defaultOpen = _b === void 0 ? false : _b,
|
|
74
|
+
onOpenChange = _a.onOpenChange,
|
|
75
|
+
_c = _a.side,
|
|
76
|
+
side = _c === void 0 ? 'bottom' : _c,
|
|
77
|
+
_d = _a.align,
|
|
78
|
+
align = _d === void 0 ? 'start' : _d,
|
|
79
|
+
_e = _a.matchTriggerWidth,
|
|
80
|
+
matchTriggerWidth = _e === void 0 ? false : _e,
|
|
81
|
+
dataTestId = _a["data-testid"];
|
|
82
|
+
var menuId = useId();
|
|
83
|
+
var triggerId = useId();
|
|
84
|
+
var anchorRef = useRef(null);
|
|
85
|
+
var panelRef = useRef(null);
|
|
86
|
+
// Which item to focus once the menu has opened
|
|
87
|
+
var initialFocus = useRef('first');
|
|
88
|
+
var openedFromTrigger = useRef(false);
|
|
89
|
+
var typeahead = useRef({
|
|
90
|
+
text: '',
|
|
91
|
+
timer: undefined
|
|
92
|
+
});
|
|
93
|
+
var _f = useState(defaultOpen),
|
|
94
|
+
uncontrolledOpen = _f[0],
|
|
95
|
+
setUncontrolledOpen = _f[1];
|
|
96
|
+
var isControlled = openProp !== undefined;
|
|
97
|
+
var isOpen = isControlled ? openProp : uncontrolledOpen;
|
|
98
|
+
var _g = usePresence(isOpen),
|
|
99
|
+
isPresent = _g.isPresent,
|
|
100
|
+
isExiting = _g.isExiting;
|
|
101
|
+
var triggerElement = function triggerElement() {
|
|
102
|
+
return laidOutElement(anchorRef.current);
|
|
103
|
+
};
|
|
104
|
+
var setOpen = useCallback(function (next) {
|
|
105
|
+
if (!isControlled) setUncontrolledOpen(next);
|
|
106
|
+
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(next);
|
|
107
|
+
}, [isControlled, onOpenChange]);
|
|
108
|
+
var close = useCallback(function (_a) {
|
|
109
|
+
var _b;
|
|
110
|
+
var _c = _a === void 0 ? {} : _a,
|
|
111
|
+
_d = _c.returnFocus,
|
|
112
|
+
returnFocus = _d === void 0 ? true : _d;
|
|
113
|
+
setOpen(false);
|
|
114
|
+
if (returnFocus) (_b = triggerElement()) === null || _b === void 0 ? void 0 : _b.focus();
|
|
115
|
+
}, [setOpen]);
|
|
116
|
+
var openWith = function openWith(focus) {
|
|
117
|
+
initialFocus.current = focus;
|
|
118
|
+
openedFromTrigger.current = true;
|
|
119
|
+
setOpen(true);
|
|
120
|
+
};
|
|
121
|
+
// The trigger's ARIA is set on the element itself, so it reaches the real control even when the
|
|
122
|
+
// trigger is wrapped (a Tooltip inside the trigger, for example)
|
|
123
|
+
useEffect(function () {
|
|
124
|
+
var element = triggerElement();
|
|
125
|
+
if (!element) return;
|
|
126
|
+
if (!element.id) element.id = triggerId;
|
|
127
|
+
element.setAttribute('aria-haspopup', 'menu');
|
|
128
|
+
element.setAttribute('aria-expanded', String(isOpen));
|
|
129
|
+
if (isOpen) element.setAttribute('aria-controls', menuId);else element.removeAttribute('aria-controls');
|
|
130
|
+
});
|
|
131
|
+
// The menu is named by its trigger, whose own id is kept if it has one
|
|
132
|
+
useIsomorphicLayoutEffect(function () {
|
|
133
|
+
var panel = panelRef.current;
|
|
134
|
+
var element = triggerElement();
|
|
135
|
+
if (!isPresent || !panel || !element) return;
|
|
136
|
+
if (!element.id) element.id = triggerId;
|
|
137
|
+
panel.setAttribute('aria-labelledby', element.id);
|
|
138
|
+
}, [isPresent]);
|
|
139
|
+
// In the top layer beside the trigger; scrolling or resizing closes it, since the trigger moves
|
|
140
|
+
var detach = useCallback(function () {
|
|
141
|
+
return close({
|
|
142
|
+
returnFocus: false
|
|
143
|
+
});
|
|
144
|
+
}, [close]);
|
|
145
|
+
useFloatingLayer({
|
|
146
|
+
isPresent: isPresent,
|
|
147
|
+
floatingRef: panelRef,
|
|
148
|
+
anchorRef: anchorRef,
|
|
149
|
+
side: side,
|
|
150
|
+
align: align,
|
|
151
|
+
matchAnchorWidth: matchTriggerWidth,
|
|
152
|
+
onDetach: detach
|
|
153
|
+
});
|
|
154
|
+
// Opening from the trigger focuses the first or last item. An open that didn't come from the
|
|
155
|
+
// trigger (defaultOpen, or a controlled open) leaves focus where it is
|
|
156
|
+
useEffect(function () {
|
|
157
|
+
if (!isOpen || !openedFromTrigger.current) return;
|
|
158
|
+
openedFromTrigger.current = false;
|
|
159
|
+
focusItem(panelRef.current, initialFocus.current);
|
|
160
|
+
}, [isOpen]);
|
|
161
|
+
// A press outside the trigger and the menu closes it, leaving focus where the press put it
|
|
162
|
+
useEffect(function () {
|
|
163
|
+
if (!isOpen) return;
|
|
164
|
+
var onPointerDown = function onPointerDown(event) {
|
|
165
|
+
var _a, _b;
|
|
166
|
+
var target = event.target;
|
|
167
|
+
if (((_a = panelRef.current) === null || _a === void 0 ? void 0 : _a.contains(target)) || ((_b = anchorRef.current) === null || _b === void 0 ? void 0 : _b.contains(target))) return;
|
|
168
|
+
close({
|
|
169
|
+
returnFocus: false
|
|
170
|
+
});
|
|
171
|
+
};
|
|
172
|
+
document.addEventListener('pointerdown', onPointerDown, true);
|
|
173
|
+
return function () {
|
|
174
|
+
return document.removeEventListener('pointerdown', onPointerDown, true);
|
|
175
|
+
};
|
|
176
|
+
}, [isOpen, close]);
|
|
177
|
+
useEffect(function () {
|
|
178
|
+
return function () {
|
|
179
|
+
return clearTimeout(typeahead.current.timer);
|
|
180
|
+
};
|
|
181
|
+
}, []);
|
|
182
|
+
var onTriggerKeyDown = function onTriggerKeyDown(event) {
|
|
183
|
+
var _a;
|
|
184
|
+
if ((_a = panelRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.target)) return;
|
|
185
|
+
if (event.key === 'ArrowDown' || event.key === 'Enter' || event.key === ' ') {
|
|
186
|
+
event.preventDefault();
|
|
187
|
+
openWith('first');
|
|
188
|
+
} else if (event.key === 'ArrowUp') {
|
|
189
|
+
event.preventDefault();
|
|
190
|
+
openWith('last');
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
var onTriggerClick = function onTriggerClick(event) {
|
|
194
|
+
var _a;
|
|
195
|
+
if ((_a = panelRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.target)) return;
|
|
196
|
+
// A keyboard click (Enter, Space) is handled on keydown
|
|
197
|
+
if (event.detail === 0) return;
|
|
198
|
+
if (isOpen) close({
|
|
199
|
+
returnFocus: false
|
|
200
|
+
});else openWith('first');
|
|
201
|
+
};
|
|
202
|
+
var onMenuKeyDown = function onMenuKeyDown(event) {
|
|
203
|
+
var _a;
|
|
204
|
+
var items = Array.from(event.currentTarget.querySelectorAll(ITEM_SELECTOR));
|
|
205
|
+
var current = items.indexOf(document.activeElement);
|
|
206
|
+
var move = function move(index) {
|
|
207
|
+
var _a;
|
|
208
|
+
event.preventDefault();
|
|
209
|
+
(_a = items[(index + items.length) % items.length]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
210
|
+
};
|
|
211
|
+
switch (event.key) {
|
|
212
|
+
case 'ArrowDown':
|
|
213
|
+
return move(current + 1);
|
|
214
|
+
case 'ArrowUp':
|
|
215
|
+
return move(current - 1);
|
|
216
|
+
case 'Home':
|
|
217
|
+
return move(0);
|
|
218
|
+
case 'End':
|
|
219
|
+
return move(items.length - 1);
|
|
220
|
+
case 'Escape':
|
|
221
|
+
event.preventDefault();
|
|
222
|
+
event.stopPropagation();
|
|
223
|
+
return close();
|
|
224
|
+
case 'Tab':
|
|
225
|
+
// Focus moves on to the next element after the trigger, and the menu closes
|
|
226
|
+
return close({
|
|
227
|
+
returnFocus: false
|
|
228
|
+
});
|
|
229
|
+
default:
|
|
230
|
+
if (event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey && event.key !== ' ') {
|
|
231
|
+
var state_1 = typeahead.current;
|
|
232
|
+
clearTimeout(state_1.timer);
|
|
233
|
+
state_1.text += event.key.toLowerCase();
|
|
234
|
+
state_1.timer = setTimeout(function () {
|
|
235
|
+
state_1.text = '';
|
|
236
|
+
}, TYPEAHEAD_RESET_MS);
|
|
237
|
+
// The label alone: not a leading Avatar's initials, the description or the shortcut
|
|
238
|
+
var label_1 = function label_1(item) {
|
|
239
|
+
var _a, _b, _c;
|
|
240
|
+
return ((_c = (_a = item.dataset.label) !== null && _a !== void 0 ? _a : (_b = item.querySelector('[data-menu-label]')) === null || _b === void 0 ? void 0 : _b.textContent) !== null && _c !== void 0 ? _c : '').trim().toLowerCase();
|
|
241
|
+
};
|
|
242
|
+
var ordered = __spreadArray(__spreadArray([], items.slice(current + 1), true), items.slice(0, current + 1), true);
|
|
243
|
+
var search = state_1.text.length > 1 ? __spreadArray([items[current]], ordered, true) : ordered;
|
|
244
|
+
(_a = search.find(function (item) {
|
|
245
|
+
return item && label_1(item).startsWith(state_1.text);
|
|
246
|
+
})) === null || _a === void 0 ? void 0 : _a.focus();
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
return jsx(MenuContext.Provider, {
|
|
251
|
+
value: {
|
|
252
|
+
close: close
|
|
253
|
+
},
|
|
254
|
+
children: jsxs(Anchor, {
|
|
255
|
+
ref: anchorRef,
|
|
256
|
+
onKeyDown: onTriggerKeyDown,
|
|
257
|
+
onClick: onTriggerClick,
|
|
258
|
+
children: [trigger, isPresent && jsx(Panel, {
|
|
259
|
+
ref: panelRef,
|
|
260
|
+
id: menuId,
|
|
261
|
+
role: "menu",
|
|
262
|
+
tabIndex: -1,
|
|
263
|
+
"$exiting": isExiting,
|
|
264
|
+
onKeyDown: onMenuKeyDown,
|
|
265
|
+
"data-testid": dataTestId,
|
|
266
|
+
children: children
|
|
267
|
+
})]
|
|
268
|
+
})
|
|
269
|
+
});
|
|
270
|
+
};
|
|
271
|
+
Menu.displayName = 'Menu';
|
|
272
|
+
var Row = /*#__PURE__*/styled.div.withConfig({
|
|
273
|
+
shouldForwardProp: function shouldForwardProp(prop) {
|
|
274
|
+
return !prop.startsWith('$');
|
|
275
|
+
},
|
|
276
|
+
displayName: "Menu__Row",
|
|
277
|
+
componentId: "sc-13mple2-2"
|
|
278
|
+
})(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n gap: ", ";\n box-sizing: border-box;\n min-height: ", ";\n padding: ", " ", ";\n font: ", ";\n color: ", ";\n cursor: ", ";\n user-select: none;\n transition: background-color ", " ", ",\n color ", " ", ";\n\n /* The shared row states (0030): focus shows the hover state (0029); only checked items are\n light blue, with the checkmark so the state isn't colour alone */\n ", "\n\n ", "\n\n &:focus {\n outline: none;\n }\n\n &:focus-visible {\n outline: ", ";\n outline-offset: calc(-1 * ", ");\n }\n"], ["\n display: flex;\n align-items: center;\n gap: ", ";\n box-sizing: border-box;\n min-height: ", ";\n padding: ", " ", ";\n font: ", ";\n color: ", ";\n cursor: ", ";\n user-select: none;\n transition: background-color ", " ", ",\n color ", " ", ";\n\n /* The shared row states (0030): focus shows the hover state (0029); only checked items are\n light blue, with the checkmark so the state isn't colour alone */\n ", "\n\n ", "\n\n &:focus {\n outline: none;\n }\n\n &:focus-visible {\n outline: ", ";\n outline-offset: calc(-1 * ", ");\n }\n"])), space[200], size.row.sm, space.inset.xs, space.inset.md, typography.small, function (_a) {
|
|
279
|
+
var $destructive = _a.$destructive;
|
|
280
|
+
return $destructive ? color.text.danger : color.text["default"];
|
|
281
|
+
}, function (_a) {
|
|
282
|
+
var $disabled = _a.$disabled;
|
|
283
|
+
return $disabled ? 'not-allowed' : 'pointer';
|
|
284
|
+
}, motion.duration.fast, motion.easing.decelerate, motion.duration.fast, motion.easing.decelerate, function (_a) {
|
|
285
|
+
var $checked = _a.$checked,
|
|
286
|
+
$focused = _a.$focused,
|
|
287
|
+
$disabled = _a.$disabled;
|
|
288
|
+
return interactiveRow({
|
|
289
|
+
selected: $checked,
|
|
290
|
+
focused: $focused,
|
|
291
|
+
disabled: $disabled
|
|
292
|
+
});
|
|
293
|
+
}, function (_a) {
|
|
294
|
+
var $disabled = _a.$disabled;
|
|
295
|
+
return $disabled && css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["color: ", ";"], ["color: ", ";"])), color.text.disabled);
|
|
296
|
+
}, border.focus, border.focusOffset);
|
|
297
|
+
var Leading = /*#__PURE__*/styled.span.withConfig({
|
|
298
|
+
displayName: "Menu__Leading",
|
|
299
|
+
componentId: "sc-13mple2-3"
|
|
300
|
+
})(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n display: inline-flex;\n flex-shrink: 0;\n"], ["\n display: inline-flex;\n flex-shrink: 0;\n"])));
|
|
301
|
+
var Text = /*#__PURE__*/styled.span.withConfig({
|
|
302
|
+
displayName: "Menu__Text",
|
|
303
|
+
componentId: "sc-13mple2-4"
|
|
304
|
+
})(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n flex: 1;\n min-width: 0;\n"], ["\n display: flex;\n flex-direction: column;\n flex: 1;\n min-width: 0;\n"])));
|
|
305
|
+
var Description = /*#__PURE__*/styled.span.withConfig({
|
|
306
|
+
displayName: "Menu__Description",
|
|
307
|
+
componentId: "sc-13mple2-5"
|
|
308
|
+
})(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n font: ", ";\n color: ", ";\n"], ["\n font: ", ";\n color: ", ";\n"])), typography.caption, color.text.muted);
|
|
309
|
+
var Shortcut = /*#__PURE__*/styled.span.withConfig({
|
|
310
|
+
displayName: "Menu__Shortcut",
|
|
311
|
+
componentId: "sc-13mple2-6"
|
|
312
|
+
})(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n flex-shrink: 0;\n font: ", ";\n color: ", ";\n"], ["\n flex-shrink: 0;\n font: ", ";\n color: ", ";\n"])), typography.caption, color.text.muted);
|
|
313
|
+
var Check = /*#__PURE__*/styled.span.withConfig({
|
|
314
|
+
displayName: "Menu__Check",
|
|
315
|
+
componentId: "sc-13mple2-7"
|
|
316
|
+
})(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n display: inline-flex;\n flex-shrink: 0;\n color: inherit;\n"], ["\n display: inline-flex;\n flex-shrink: 0;\n color: inherit;\n"])));
|
|
317
|
+
var RowItem = function RowItem(_a) {
|
|
318
|
+
var role = _a.role,
|
|
319
|
+
children = _a.children,
|
|
320
|
+
icon = _a.icon,
|
|
321
|
+
description = _a.description,
|
|
322
|
+
shortcut = _a.shortcut,
|
|
323
|
+
_b = _a.disabled,
|
|
324
|
+
disabled = _b === void 0 ? false : _b,
|
|
325
|
+
_c = _a.destructive,
|
|
326
|
+
destructive = _c === void 0 ? false : _c,
|
|
327
|
+
checked = _a.checked,
|
|
328
|
+
textValue = _a.textValue,
|
|
329
|
+
onActivate = _a.onActivate,
|
|
330
|
+
dataTestId = _a["data-testid"];
|
|
331
|
+
var _d = useState(false),
|
|
332
|
+
focused = _d[0],
|
|
333
|
+
setFocused = _d[1];
|
|
334
|
+
var checkable = role !== 'menuitem';
|
|
335
|
+
var activate = function activate() {
|
|
336
|
+
if (!disabled) onActivate();
|
|
337
|
+
};
|
|
338
|
+
return jsxs(Row, {
|
|
339
|
+
role: role,
|
|
340
|
+
tabIndex: -1,
|
|
341
|
+
"aria-disabled": disabled || undefined,
|
|
342
|
+
"aria-checked": checkable ? Boolean(checked) : undefined,
|
|
343
|
+
"aria-keyshortcuts": shortcut === null || shortcut === void 0 ? void 0 : shortcut.keys,
|
|
344
|
+
"data-label": textValue,
|
|
345
|
+
"data-testid": dataTestId,
|
|
346
|
+
"$checked": Boolean(checked),
|
|
347
|
+
"$focused": focused,
|
|
348
|
+
"$disabled": disabled,
|
|
349
|
+
"$destructive": destructive,
|
|
350
|
+
onFocus: function onFocus() {
|
|
351
|
+
return setFocused(true);
|
|
352
|
+
},
|
|
353
|
+
onBlur: function onBlur() {
|
|
354
|
+
return setFocused(false);
|
|
355
|
+
},
|
|
356
|
+
onPointerMove: function onPointerMove(event) {
|
|
357
|
+
// The pointer moves focus, so hover and keyboard share one highlighted item
|
|
358
|
+
if (document.activeElement !== event.currentTarget) event.currentTarget.focus();
|
|
359
|
+
},
|
|
360
|
+
onClick: activate,
|
|
361
|
+
onKeyDown: function onKeyDown(event) {
|
|
362
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
363
|
+
event.preventDefault();
|
|
364
|
+
activate();
|
|
365
|
+
}
|
|
366
|
+
},
|
|
367
|
+
children: [icon && jsx(Leading, {
|
|
368
|
+
"aria-hidden": "true",
|
|
369
|
+
children: icon
|
|
370
|
+
}), jsxs(Text, {
|
|
371
|
+
children: [jsx("span", {
|
|
372
|
+
"data-menu-label": "",
|
|
373
|
+
children: children
|
|
374
|
+
}), description && jsx(Description, {
|
|
375
|
+
children: description
|
|
376
|
+
})]
|
|
377
|
+
}), shortcut && jsx(Shortcut, {
|
|
378
|
+
"aria-hidden": "true",
|
|
379
|
+
children: shortcut.label
|
|
380
|
+
}), checkable && checked && jsx(Check, {
|
|
381
|
+
children: jsx(Icon, {
|
|
382
|
+
name: "check",
|
|
383
|
+
size: "sm",
|
|
384
|
+
iconColor: "inherit"
|
|
385
|
+
})
|
|
386
|
+
})]
|
|
387
|
+
});
|
|
388
|
+
};
|
|
389
|
+
/** An action. Activating it closes the menu. */
|
|
390
|
+
var MenuItem = function MenuItem(_a) {
|
|
391
|
+
var onSelect = _a.onSelect,
|
|
392
|
+
props = __rest(_a, ["onSelect"]);
|
|
393
|
+
var close = useMenu('MenuItem').close;
|
|
394
|
+
return jsx(RowItem, __assign({
|
|
395
|
+
role: "menuitem"
|
|
396
|
+
}, props, {
|
|
397
|
+
onActivate: function onActivate() {
|
|
398
|
+
close();
|
|
399
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect();
|
|
400
|
+
}
|
|
401
|
+
}));
|
|
402
|
+
};
|
|
403
|
+
/** One choice of a set, inside a MenuGroup. Choosing it closes the menu. */
|
|
404
|
+
var MenuItemRadio = function MenuItemRadio(_a) {
|
|
405
|
+
var onSelect = _a.onSelect,
|
|
406
|
+
checked = _a.checked,
|
|
407
|
+
props = __rest(_a, ["onSelect", "checked"]);
|
|
408
|
+
var close = useMenu('MenuItemRadio').close;
|
|
409
|
+
return jsx(RowItem, __assign({
|
|
410
|
+
role: "menuitemradio",
|
|
411
|
+
checked: checked
|
|
412
|
+
}, props, {
|
|
413
|
+
onActivate: function onActivate() {
|
|
414
|
+
close();
|
|
415
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect();
|
|
416
|
+
}
|
|
417
|
+
}));
|
|
418
|
+
};
|
|
419
|
+
/** An on/off option, inside a MenuGroup. Toggling it keeps the menu open. */
|
|
420
|
+
var MenuItemCheckbox = function MenuItemCheckbox(_a) {
|
|
421
|
+
var onCheckedChange = _a.onCheckedChange,
|
|
422
|
+
checked = _a.checked,
|
|
423
|
+
props = __rest(_a, ["onCheckedChange", "checked"]);
|
|
424
|
+
useMenu('MenuItemCheckbox');
|
|
425
|
+
return jsx(RowItem, __assign({
|
|
426
|
+
role: "menuitemcheckbox",
|
|
427
|
+
checked: checked
|
|
428
|
+
}, props, {
|
|
429
|
+
onActivate: function onActivate() {
|
|
430
|
+
return onCheckedChange === null || onCheckedChange === void 0 ? void 0 : onCheckedChange(!checked);
|
|
431
|
+
}
|
|
432
|
+
}));
|
|
433
|
+
};
|
|
434
|
+
var GroupLabel = /*#__PURE__*/styled.div.withConfig({
|
|
435
|
+
displayName: "Menu__GroupLabel",
|
|
436
|
+
componentId: "sc-13mple2-8"
|
|
437
|
+
})(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n padding: ", " ", ";\n font: ", ";\n color: ", ";\n"], ["\n padding: ", " ", ";\n font: ", ";\n color: ", ";\n"
|
|
438
|
+
/** Groups related items. Radio and checkbox items always sit in a group. */])), space.inset.xs, space.inset.md, typography.caption, color.text.muted);
|
|
439
|
+
/** Groups related items. Radio and checkbox items always sit in a group. */
|
|
440
|
+
var MenuGroup = function MenuGroup(_a) {
|
|
441
|
+
var label = _a.label,
|
|
442
|
+
children = _a.children;
|
|
443
|
+
var labelId = useId();
|
|
444
|
+
return jsxs("div", {
|
|
445
|
+
role: "group",
|
|
446
|
+
"aria-labelledby": label ? labelId : undefined,
|
|
447
|
+
children: [label && jsx(GroupLabel, {
|
|
448
|
+
id: labelId,
|
|
449
|
+
"aria-hidden": "true",
|
|
450
|
+
children: label
|
|
451
|
+
}), children]
|
|
452
|
+
});
|
|
453
|
+
};
|
|
454
|
+
// Divider's smallest spacing (16px each side) is too loose between dense rows, so the menu draws
|
|
455
|
+
// its own 1px rule with the decorative border
|
|
456
|
+
var Separator = /*#__PURE__*/styled.div.withConfig({
|
|
457
|
+
displayName: "Menu__Separator",
|
|
458
|
+
componentId: "sc-13mple2-9"
|
|
459
|
+
})(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n margin: ", " 0;\n border-top: ", ";\n"], ["\n margin: ", " 0;\n border-top: ", ";\n"
|
|
460
|
+
/** Separates groups */])), space[100], border["default"]);
|
|
461
|
+
/** Separates groups */
|
|
462
|
+
var MenuDivider = function MenuDivider() {
|
|
463
|
+
return jsx(Separator, {
|
|
464
|
+
role: "separator",
|
|
465
|
+
"aria-orientation": "horizontal"
|
|
466
|
+
});
|
|
467
|
+
};
|
|
468
|
+
MenuItem.displayName = 'MenuItem';
|
|
469
|
+
MenuItemRadio.displayName = 'MenuItemRadio';
|
|
470
|
+
MenuItemCheckbox.displayName = 'MenuItemCheckbox';
|
|
471
|
+
MenuGroup.displayName = 'MenuGroup';
|
|
472
|
+
MenuDivider.displayName = 'MenuDivider';
|
|
473
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15;
|
|
474
|
+
|
|
475
|
+
export { Menu, MenuDivider, MenuGroup, MenuItem, MenuItemCheckbox, MenuItemRadio };
|
|
476
|
+
//# sourceMappingURL=Menu.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Menu.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -54,7 +54,7 @@ var StyledDialog = /*#__PURE__*/styled.div.withConfig({
|
|
|
54
54
|
})(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%) scale(1);\n z-index: ", ";\n\n width: ", ";\n max-width: calc(100vw - ", " * 2);\n max-height: calc(100vh - ", " * 2);\n\n display: flex;\n flex-direction: column;\n\n background-color: ", ";\n border-radius: ", ";\n box-shadow: ", ";\n overflow: hidden;\n\n ", "\n\n ", " {\n animation: ", " ", " ", "", ";\n }\n\n /* Auto-fullscreen below md breakpoint (768px) */\n @media (max-width: ", ") {\n width: 100vw;\n height: 100vh;\n max-width: 100vw;\n max-height: 100vh;\n border-radius: 0;\n top: 0;\n left: 0;\n transform: none;\n animation: ", " ", " ", "", ";\n }\n\n &:focus {\n outline: none;\n }\n\n"], ["\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%) scale(1);\n z-index: ", ";\n\n width: ", ";\n max-width: calc(100vw - ", " * 2);\n max-height: calc(100vh - ", " * 2);\n\n display: flex;\n flex-direction: column;\n\n background-color: ", ";\n border-radius: ", ";\n box-shadow: ", ";\n overflow: hidden;\n\n ", "\n\n ", " {\n animation: ", " ", " ", "", ";\n }\n\n /* Auto-fullscreen below md breakpoint (768px) */\n @media (max-width: ", ") {\n width: 100vw;\n height: 100vh;\n max-width: 100vw;\n max-height: 100vh;\n border-radius: 0;\n top: 0;\n left: 0;\n transform: none;\n animation: ", " ", " ", "", ";\n }\n\n &:focus {\n outline: none;\n }\n\n"])), semantic.layer.modal, function (_a) {
|
|
55
55
|
var $width = _a.$width;
|
|
56
56
|
return $width;
|
|
57
|
-
}, space[400], space[400], semantic.surface.
|
|
57
|
+
}, space[400], space[400], semantic.surface.overlay, tokens.component.overlay.borderRadius, elevation.overlay, css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["animation: ", " ", " ", "", ";"], ["animation: ", " ", " ", "", ";"])), scaleIn, motion.duration.moderate, motion.easing.decelerate, function (_a) {
|
|
58
58
|
var $isExiting = _a.$isExiting;
|
|
59
59
|
return $isExiting && exitAnimation;
|
|
60
60
|
}), reducedMotion, fadeIn, motion.duration.moderate, motion.easing.decelerate, function (_a) {
|
|
@@ -7,6 +7,7 @@ const styled = styled$module.default || styled$module;
|
|
|
7
7
|
import { StyledInputBase } from '../TextField/InputBase.mjs';
|
|
8
8
|
import { IconButton } from '../../atoms/IconButton/IconButton.mjs';
|
|
9
9
|
import tokens from '../../../lib/cssTokens.mjs';
|
|
10
|
+
import { fieldButtonRadius } from '../../../lib/styleUtils.mjs';
|
|
10
11
|
|
|
11
12
|
var field = tokens.component.field;
|
|
12
13
|
// Gaps come from the semantic spacing scale: no component spacing tokens (decision 0022)
|
|
@@ -34,7 +35,7 @@ var StyledNumberInput = /*#__PURE__*/styled(StyledInputBase).withConfig({
|
|
|
34
35
|
var StyledStepperContainer = /*#__PURE__*/styled.div.withConfig({
|
|
35
36
|
displayName: "NumberInput__StyledStepperContainer",
|
|
36
37
|
componentId: "sc-qotc3w-5"
|
|
37
|
-
})(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n position: absolute;\n right: ", ";\n display: flex;\n flex-direction: row;\n gap: ", ";\n"], ["\n position: absolute;\n right: ", ";\n display: flex;\n flex-direction: row;\n gap: ", ";\n"])), tokens.semantic.space[200], tokens.semantic.space[200]);
|
|
38
|
+
})(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n position: absolute;\n right: ", ";\n display: flex;\n flex-direction: row;\n gap: ", ";\n\n /* Buttons inside the field nest within its corner: a step tighter than the control radius (decision 0055) */\n & > button {\n border-radius: ", ";\n }\n"], ["\n position: absolute;\n right: ", ";\n display: flex;\n flex-direction: row;\n gap: ", ";\n\n /* Buttons inside the field nest within its corner: a step tighter than the control radius (decision 0055) */\n & > button {\n border-radius: ", ";\n }\n"])), tokens.semantic.space[200], tokens.semantic.space[200], fieldButtonRadius);
|
|
38
39
|
var StyledHelperText = /*#__PURE__*/styled.div.withConfig({
|
|
39
40
|
displayName: "NumberInput__StyledHelperText",
|
|
40
41
|
componentId: "sc-qotc3w-6"
|
|
@@ -7,6 +7,7 @@ const styled = styled$module.default || styled$module;
|
|
|
7
7
|
import { StyledInputBase } from '../TextField/InputBase.mjs';
|
|
8
8
|
import { IconButton } from '../../atoms/IconButton/IconButton.mjs';
|
|
9
9
|
import tokens from '../../../lib/cssTokens.mjs';
|
|
10
|
+
import { fieldButtonRadius } from '../../../lib/styleUtils.mjs';
|
|
10
11
|
|
|
11
12
|
var field = tokens.component.field;
|
|
12
13
|
// Gaps come from the semantic spacing scale: no component spacing tokens (decision 0022)
|
|
@@ -37,7 +38,7 @@ var StyledInputWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
|
37
38
|
var StyledToggleButton = /*#__PURE__*/styled.div.withConfig({
|
|
38
39
|
displayName: "PasswordField__StyledToggleButton",
|
|
39
40
|
componentId: "sc-1p15zk0-5"
|
|
40
|
-
})(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n position: absolute;\n right: ", ";\n top: 50%;\n transform: translateY(-50%);\n"], ["\n position: absolute;\n right: ", ";\n top: 50%;\n transform: translateY(-50%);\n"
|
|
41
|
+
})(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n position: absolute;\n right: ", ";\n top: 50%;\n transform: translateY(-50%);\n\n /* Buttons inside the field nest within its corner: a step tighter than the control radius (decision 0055) */\n & > button {\n border-radius: ", ";\n }\n"], ["\n position: absolute;\n right: ", ";\n top: 50%;\n transform: translateY(-50%);\n\n /* Buttons inside the field nest within its corner: a step tighter than the control radius (decision 0055) */\n & > button {\n border-radius: ", ";\n }\n"
|
|
41
42
|
/**
|
|
42
43
|
* PasswordField component for secure password input with visibility toggle
|
|
43
44
|
*
|
|
@@ -49,7 +50,7 @@ var StyledToggleButton = /*#__PURE__*/styled.div.withConfig({
|
|
|
49
50
|
* required
|
|
50
51
|
* />
|
|
51
52
|
* ```
|
|
52
|
-
*/])), tokens.semantic.space[200]);
|
|
53
|
+
*/])), tokens.semantic.space[200], fieldButtonRadius);
|
|
53
54
|
/**
|
|
54
55
|
* PasswordField component for secure password input with visibility toggle
|
|
55
56
|
*
|
|
@@ -8,7 +8,7 @@ import { Icon } from '../../atoms/Icon/Icon.mjs';
|
|
|
8
8
|
import { IconButton } from '../../atoms/IconButton/IconButton.mjs';
|
|
9
9
|
import { ListItem } from '../List/ListItem.mjs';
|
|
10
10
|
import tokens from '../../../lib/cssTokens.mjs';
|
|
11
|
-
import { rowStates } from '../../../lib/styleUtils.mjs';
|
|
11
|
+
import { fieldButtonRadius, rowStates } from '../../../lib/styleUtils.mjs';
|
|
12
12
|
|
|
13
13
|
var semantic = tokens.semantic,
|
|
14
14
|
component = tokens.component;
|
|
@@ -19,7 +19,7 @@ var StyledSearchContainer = /*#__PURE__*/styled.div.withConfig({
|
|
|
19
19
|
var StyledInputWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
20
20
|
displayName: "SearchField__StyledInputWrapper",
|
|
21
21
|
componentId: "sc-qhz9i8-1"
|
|
22
|
-
})(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n gap: ", ";\n /* The field's height comes from size.control.lg as a minimum, matching the other fields\n (decision 0034); the padding only matters if the content grows past it */\n box-sizing: border-box;\n min-height: ", ";\n padding: ", " ", ";\n background-color: ", ";\n border: ", " solid ", ";\n border-radius: ", ";\n transition: border-color ", " ", ", outline ", " ", ";\n \n ", "\n \n ", "\n \n &:hover:not([data-disabled='true']) {\n border-color: ", ";\n }\n"], ["\n display: flex;\n align-items: center;\n gap: ", ";\n /* The field's height comes from size.control.lg as a minimum, matching the other fields\n (decision 0034); the padding only matters if the content grows past it */\n box-sizing: border-box;\n min-height: ", ";\n padding: ", " ", ";\n background-color: ", ";\n border: ", " solid ", ";\n border-radius: ", ";\n transition: border-color ", " ", ", outline ", " ", ";\n \n ", "\n \n ", "\n \n &:hover:not([data-disabled='true']) {\n border-color: ", ";\n }\n"])), semantic.space[200], semantic.size.control.lg, semantic.space[200], semantic.space[300], component.input["default"].backgroundColor, component.input["default"].borderWidth, component.input["default"].borderColor, component.input["default"].borderRadius, semantic.motion.duration.moderate, semantic.motion.easing.standard, semantic.motion.duration.moderate, semantic.motion.easing.standard, function (props) {
|
|
22
|
+
})(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n gap: ", ";\n /* The field's height comes from size.control.lg as a minimum, matching the other fields\n (decision 0034); the padding only matters if the content grows past it */\n box-sizing: border-box;\n min-height: ", ";\n padding: ", " ", ";\n background-color: ", ";\n border: ", " solid ", ";\n border-radius: ", ";\n\n /* Buttons inside the field nest within its corner: a step tighter than the control radius (decision 0055) */\n & > button {\n border-radius: ", ";\n }\n\n transition: border-color ", " ", ", outline ", " ", ";\n \n ", "\n \n ", "\n \n &:hover:not([data-disabled='true']) {\n border-color: ", ";\n }\n"], ["\n display: flex;\n align-items: center;\n gap: ", ";\n /* The field's height comes from size.control.lg as a minimum, matching the other fields\n (decision 0034); the padding only matters if the content grows past it */\n box-sizing: border-box;\n min-height: ", ";\n padding: ", " ", ";\n background-color: ", ";\n border: ", " solid ", ";\n border-radius: ", ";\n\n /* Buttons inside the field nest within its corner: a step tighter than the control radius (decision 0055) */\n & > button {\n border-radius: ", ";\n }\n\n transition: border-color ", " ", ", outline ", " ", ";\n \n ", "\n \n ", "\n \n &:hover:not([data-disabled='true']) {\n border-color: ", ";\n }\n"])), semantic.space[200], semantic.size.control.lg, semantic.space[200], semantic.space[300], component.input["default"].backgroundColor, component.input["default"].borderWidth, component.input["default"].borderColor, component.input["default"].borderRadius, fieldButtonRadius, semantic.motion.duration.moderate, semantic.motion.easing.standard, semantic.motion.duration.moderate, semantic.motion.easing.standard, function (props) {
|
|
23
23
|
return props.$isFocused && "\n border-color: ".concat(component.input.focus.borderColor, ";\n outline: ").concat(component.input.focus.outline, ";\n outline-offset: ").concat(semantic.border.focusOffset, ";\n ");
|
|
24
24
|
}, function (props) {
|
|
25
25
|
return props.$disabled && "\n background-color: ".concat(component.input.disabled.backgroundColor, ";\n border-color: ").concat(component.input.disabled.borderColor, ";\n cursor: not-allowed;\n ");
|
|
@@ -31,7 +31,7 @@ var StyledInput = /*#__PURE__*/styled.input.withConfig({
|
|
|
31
31
|
var StyledSuggestionsList = /*#__PURE__*/styled.ul.withConfig({
|
|
32
32
|
displayName: "SearchField__StyledSuggestionsList",
|
|
33
33
|
componentId: "sc-qhz9i8-3"
|
|
34
|
-
})(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n position: absolute;\n top: calc(100% + ", ");\n left: 0;\n right: 0;\n max-height: ", ";\n overflow-y: auto;\n background-color: ", ";\n border: ", " solid ", ";\n border-radius: ", ";\n box-shadow: ", ";\n list-style: none;\n padding: ", " 0;\n margin: 0;\n z-index: ", ";\n\n /* The highlighted suggestion has keyboard focus, which is grey, not the light-blue selected\n treatment (decision 0029). Its row is the option's first child. While pressed, the row's own\n pressed state shows (decision 0030) */\n & > [data-highlighted] > :first-child:not(:active) {\n background-color: ", ";\n }\n"], ["\n position: absolute;\n top: calc(100% + ", ");\n left: 0;\n right: 0;\n max-height: ", ";\n overflow-y: auto;\n background-color: ", ";\n border: ", " solid ", ";\n border-radius: ", ";\n box-shadow: ", ";\n list-style: none;\n padding: ", " 0;\n margin: 0;\n z-index: ", ";\n\n /* The highlighted suggestion has keyboard focus, which is grey, not the light-blue selected\n treatment (decision 0029). Its row is the option's first child. While pressed, the row's own\n pressed state shows (decision 0030) */\n & > [data-highlighted] > :first-child:not(:active) {\n background-color: ", ";\n }\n"])), semantic.space[100], tokens.semantic.size.menu.maxHeight, semantic.surface.
|
|
34
|
+
})(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n position: absolute;\n top: calc(100% + ", ");\n left: 0;\n right: 0;\n max-height: ", ";\n overflow-y: auto;\n background-color: ", ";\n border: ", " solid ", ";\n border-radius: ", ";\n box-shadow: ", ";\n list-style: none;\n padding: ", " 0;\n margin: 0;\n z-index: ", ";\n\n /* The highlighted suggestion has keyboard focus, which is grey, not the light-blue selected\n treatment (decision 0029). Its row is the option's first child. While pressed, the row's own\n pressed state shows (decision 0030) */\n & > [data-highlighted] > :first-child:not(:active) {\n background-color: ", ";\n }\n"], ["\n position: absolute;\n top: calc(100% + ", ");\n left: 0;\n right: 0;\n max-height: ", ";\n overflow-y: auto;\n background-color: ", ";\n border: ", " solid ", ";\n border-radius: ", ";\n box-shadow: ", ";\n list-style: none;\n padding: ", " 0;\n margin: 0;\n z-index: ", ";\n\n /* The highlighted suggestion has keyboard focus, which is grey, not the light-blue selected\n treatment (decision 0029). Its row is the option's first child. While pressed, the row's own\n pressed state shows (decision 0030) */\n & > [data-highlighted] > :first-child:not(:active) {\n background-color: ", ";\n }\n"])), semantic.space[100], tokens.semantic.size.menu.maxHeight, semantic.surface.overlay, semantic.border.width.thin, semantic.color.border["default"], semantic.radius.md, semantic.elevation.floating, semantic.space[100], semantic.layer.dropdown, rowStates.unselected.hover.background);
|
|
35
35
|
var StyledSectionHeader = /*#__PURE__*/styled.div.withConfig({
|
|
36
36
|
displayName: "SearchField__StyledSectionHeader",
|
|
37
37
|
componentId: "sc-qhz9i8-4"
|
|
@@ -296,6 +296,7 @@ var SearchField = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
296
296
|
role: "option",
|
|
297
297
|
primary: "Clear recent searches",
|
|
298
298
|
interactive: true,
|
|
299
|
+
// Deprecated prop (0051), kept for this padding until 4.0 removes it
|
|
299
300
|
spacing: "compact",
|
|
300
301
|
onClick: function onClick() {
|
|
301
302
|
return handleSuggestionClick(item);
|
|
@@ -324,6 +325,7 @@ var SearchField = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
324
325
|
}) : undefined,
|
|
325
326
|
interactive: true,
|
|
326
327
|
"data-highlighted": index === highlightedIndex || undefined,
|
|
328
|
+
// Deprecated prop (0051), kept for this padding until 4.0 removes it
|
|
327
329
|
spacing: "compact",
|
|
328
330
|
onClick: function onClick() {
|
|
329
331
|
return handleSuggestionClick(item);
|
|
@@ -34,14 +34,14 @@ var StyledSheet = /*#__PURE__*/styled.div.withConfig({
|
|
|
34
34
|
},
|
|
35
35
|
displayName: "Sheet__StyledSheet",
|
|
36
36
|
componentId: "sc-8abisx-1"
|
|
37
|
-
})(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n position: fixed;\n background-color: ", ";\n box-shadow: ", ";\n z-index: ", ";\n overflow-y: auto;\n \n /* Position-specific styles */\n ", "\n\n ", " {\n animation: ", " ", " ", "", ";\n }\n \n /* Focus trap styling */\n &:focus {\n outline: none;\n }\n\n \n /* Scrollbar styling */\n &::-webkit-scrollbar {\n width: ", ";\n }\n \n &::-webkit-scrollbar-track {\n background: ", "
|
|
37
|
+
})(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n position: fixed;\n /* A floating layer: one step above raised content in the dark theme (issue 356) */\n background-color: ", ";\n box-shadow: ", ";\n z-index: ", ";\n overflow-y: auto;\n \n /* Position-specific styles */\n ", "\n\n ", " {\n animation: ", " ", " ", "", ";\n }\n \n /* Focus trap styling */\n &:focus {\n outline: none;\n }\n\n \n /* Scrollbar styling */\n &::-webkit-scrollbar {\n width: ", ";\n }\n \n &::-webkit-scrollbar-track {\n background: ", "; /* matches the panel */\n }\n \n &::-webkit-scrollbar-thumb {\n background: ", ";\n border-radius: ", ";\n }\n \n &::-webkit-scrollbar-thumb:hover {\n background: ", ";\n }\n"], ["\n position: fixed;\n /* A floating layer: one step above raised content in the dark theme (issue 356) */\n background-color: ", ";\n box-shadow: ", ";\n z-index: ", ";\n overflow-y: auto;\n \n /* Position-specific styles */\n ", "\n\n ", " {\n animation: ", " ", " ", "", ";\n }\n \n /* Focus trap styling */\n &:focus {\n outline: none;\n }\n\n \n /* Scrollbar styling */\n &::-webkit-scrollbar {\n width: ", ";\n }\n \n &::-webkit-scrollbar-track {\n background: ", "; /* matches the panel */\n }\n \n &::-webkit-scrollbar-thumb {\n background: ", ";\n border-radius: ", ";\n }\n \n &::-webkit-scrollbar-thumb:hover {\n background: ", ";\n }\n"])), semantic.surface.overlay, semantic.elevation.overlay, semantic.layer.overlay, function (_a) {
|
|
38
38
|
var $position = _a.$position,
|
|
39
39
|
$variant = _a.$variant,
|
|
40
40
|
$width = _a.$width,
|
|
41
41
|
$height = _a.$height;
|
|
42
42
|
var isDrawer = $variant === 'drawer';
|
|
43
43
|
var margin = isDrawer ? semantic.space[400] : '0';
|
|
44
|
-
var borderRadius = isDrawer ?
|
|
44
|
+
var borderRadius = isDrawer ? tokens.component.overlay.borderRadius : '0';
|
|
45
45
|
switch ($position) {
|
|
46
46
|
case 'right':
|
|
47
47
|
return css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n top: ", ";\n right: ", ";\n bottom: ", ";\n width: ", ";\n max-width: calc(100vw - ", ");\n border-radius: ", " 0 0 ", ";\n animation: ", " ", " ", "", ";\n "], ["\n top: ", ";\n right: ", ";\n bottom: ", ";\n width: ", ";\n max-width: calc(100vw - ", ");\n border-radius: ", " 0 0 ", ";\n animation: ", " ", " ", "", ";\n "])), margin, margin, margin, $width, isDrawer ? "".concat(semantic.space[400], " * 2") : '0px', borderRadius, borderRadius, slideInRight, semantic.motion.duration.moderate, semantic.motion.easing.standard, function (_a) {
|
|
@@ -67,7 +67,7 @@ var StyledSheet = /*#__PURE__*/styled.div.withConfig({
|
|
|
67
67
|
}, reducedMotion, fadeIn, semantic.motion.duration.moderate, semantic.motion.easing.standard, function (_a) {
|
|
68
68
|
var $isExiting = _a.$isExiting;
|
|
69
69
|
return $isExiting && exitAnimation;
|
|
70
|
-
}, semantic.space[200], semantic.surface.
|
|
70
|
+
}, semantic.space[200], semantic.surface.overlay, semantic.color.border["default"], semantic.radius.full, semantic.color.fill.inverse);
|
|
71
71
|
var StyledSheetContent = /*#__PURE__*/styled.div.withConfig({
|
|
72
72
|
displayName: "Sheet__StyledSheetContent",
|
|
73
73
|
componentId: "sc-8abisx-2"
|