@sereno-ds/ui 0.33.0 → 0.33.1
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/core/Menu.d.ts +5 -0
- package/dist/core/Menu.js +52 -23
- package/dist/core/Menu.js.map +1 -1
- package/package.json +1 -1
package/dist/core/Menu.d.ts
CHANGED
|
@@ -7,6 +7,11 @@ import * as React from 'react';
|
|
|
7
7
|
* / selection, and returns focus to the trigger. `role="menu"` with arrow-key
|
|
8
8
|
* roving. Needs the `sereno-pop` keyframe from `@sereno-ds/ui/styles.css`.
|
|
9
9
|
*
|
|
10
|
+
* Opened with a click or tap, no row is highlighted until the pointer enters one
|
|
11
|
+
* or the user arrows. Opened from the keyboard (Enter, Space or ArrowDown on the
|
|
12
|
+
* trigger; ArrowUp for the last row) the first enabled row is active, with a
|
|
13
|
+
* focus ring, so Enter acts straight away.
|
|
14
|
+
*
|
|
10
15
|
* ```tsx
|
|
11
16
|
* <Menu
|
|
12
17
|
* trigger={<IconButton label="Conta"><User /></IconButton>}
|
package/dist/core/Menu.js
CHANGED
|
@@ -26,11 +26,19 @@ function Menu({ trigger, adornment, items, children, header, label, align = "end
|
|
|
26
26
|
React.useEffect(() => setMounted(true), []);
|
|
27
27
|
const [place, setPlace] = React.useState(null);
|
|
28
28
|
const [activeIndex, setActiveIndex] = React.useState(-1);
|
|
29
|
+
const [inputMode, setInputMode] = React.useState("keyboard");
|
|
30
|
+
const [wasOpen, setWasOpen] = React.useState(open);
|
|
31
|
+
if (open !== wasOpen) {
|
|
32
|
+
setWasOpen(open);
|
|
33
|
+
if (!open) {
|
|
34
|
+
setActiveIndex(-1);
|
|
35
|
+
setInputMode("keyboard");
|
|
36
|
+
}
|
|
37
|
+
}
|
|
29
38
|
const itemIndexes = React.useMemo(() => (items ?? []).map((e, i) => isItem(e) && !e.disabled ? i : -1).filter((i) => i >= 0), [items]);
|
|
30
39
|
const close = React.useCallback(
|
|
31
40
|
(refocus = true) => {
|
|
32
41
|
setOpen(false);
|
|
33
|
-
setActiveIndex(-1);
|
|
34
42
|
if (refocus) {
|
|
35
43
|
const btn = anchorRef.current?.querySelector('button, [role="button"], a, [tabindex]');
|
|
36
44
|
btn?.focus({ preventScroll: true });
|
|
@@ -85,10 +93,12 @@ function Menu({ trigger, adornment, items, children, header, label, align = "end
|
|
|
85
93
|
document.addEventListener("pointerdown", onDown, true);
|
|
86
94
|
return () => document.removeEventListener("pointerdown", onDown, true);
|
|
87
95
|
}, [open, close]);
|
|
96
|
+
const placed = place !== null;
|
|
88
97
|
React.useEffect(() => {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
98
|
+
const panel = panelRef.current;
|
|
99
|
+
if (open && mounted && placed && panel && !panel.contains(document.activeElement)) panel.focus({ preventScroll: true });
|
|
100
|
+
}, [open, mounted, placed]);
|
|
101
|
+
const effectiveActive = activeIndex >= 0 ? activeIndex : inputMode === "pointer" ? -1 : itemIndexes[0] ?? -1;
|
|
92
102
|
const activate = (i) => {
|
|
93
103
|
const e = (items ?? [])[i];
|
|
94
104
|
if (!e || !isItem(e) || e.disabled) return;
|
|
@@ -107,31 +117,40 @@ function Menu({ trigger, adornment, items, children, header, label, align = "end
|
|
|
107
117
|
}
|
|
108
118
|
if (!items) return;
|
|
109
119
|
const pos = itemIndexes.indexOf(effectiveActive);
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
ev.preventDefault();
|
|
118
|
-
setActiveIndex(itemIndexes[0]);
|
|
119
|
-
} else if (ev.key === "End") {
|
|
120
|
-
ev.preventDefault();
|
|
121
|
-
setActiveIndex(itemIndexes[itemIndexes.length - 1]);
|
|
122
|
-
} else if (ev.key === "Enter" || ev.key === " ") {
|
|
120
|
+
const last = itemIndexes[itemIndexes.length - 1];
|
|
121
|
+
let next;
|
|
122
|
+
if (ev.key === "ArrowDown") next = itemIndexes[Math.min(pos + 1, itemIndexes.length - 1)];
|
|
123
|
+
else if (ev.key === "ArrowUp") next = pos < 0 ? last : itemIndexes[Math.max(pos - 1, 0)];
|
|
124
|
+
else if (ev.key === "Home") next = itemIndexes[0];
|
|
125
|
+
else if (ev.key === "End") next = last;
|
|
126
|
+
else if (ev.key === "Enter" || ev.key === " ") {
|
|
123
127
|
ev.preventDefault();
|
|
124
128
|
activate(effectiveActive);
|
|
125
|
-
|
|
129
|
+
return;
|
|
130
|
+
} else return;
|
|
131
|
+
ev.preventDefault();
|
|
132
|
+
setInputMode("keyboard");
|
|
133
|
+
if (next !== void 0) setActiveIndex(next);
|
|
126
134
|
};
|
|
127
|
-
const toggle = () => {
|
|
135
|
+
const toggle = (viaPointer) => {
|
|
128
136
|
if (disabled) return;
|
|
137
|
+
if (!open) setInputMode(viaPointer ? "pointer" : "keyboard");
|
|
129
138
|
setOpen(!open);
|
|
130
139
|
};
|
|
131
140
|
const triggerEl = React.cloneElement(trigger, {
|
|
132
141
|
onClick: (e) => {
|
|
133
142
|
trigger.props.onClick?.(e);
|
|
134
|
-
toggle();
|
|
143
|
+
toggle((e?.detail ?? 0) > 0);
|
|
144
|
+
},
|
|
145
|
+
// Menu button pattern: ArrowDown opens on the first row, ArrowUp on the last.
|
|
146
|
+
onKeyDown: (e) => {
|
|
147
|
+
trigger.props.onKeyDown?.(e);
|
|
148
|
+
if (e.defaultPrevented || disabled || open || !items) return;
|
|
149
|
+
if (e.key !== "ArrowDown" && e.key !== "ArrowUp") return;
|
|
150
|
+
e.preventDefault();
|
|
151
|
+
setInputMode("keyboard");
|
|
152
|
+
setActiveIndex(e.key === "ArrowUp" ? itemIndexes[itemIndexes.length - 1] ?? -1 : -1);
|
|
153
|
+
setOpen(true);
|
|
135
154
|
},
|
|
136
155
|
"aria-haspopup": "menu",
|
|
137
156
|
"aria-expanded": open,
|
|
@@ -232,14 +251,22 @@ function Menu({ trigger, adornment, items, children, header, label, align = "end
|
|
|
232
251
|
);
|
|
233
252
|
}
|
|
234
253
|
const danger = entry.tone === "danger";
|
|
235
|
-
const active = i === effectiveActive;
|
|
254
|
+
const active = i === effectiveActive && !entry.disabled;
|
|
236
255
|
return /* @__PURE__ */ jsxs(
|
|
237
256
|
"button",
|
|
238
257
|
{
|
|
239
258
|
type: "button",
|
|
240
259
|
role: "menuitem",
|
|
241
260
|
disabled: entry.disabled,
|
|
242
|
-
|
|
261
|
+
"data-active": active || void 0,
|
|
262
|
+
onMouseEnter: () => {
|
|
263
|
+
if (entry.disabled) return;
|
|
264
|
+
setActiveIndex(i);
|
|
265
|
+
setInputMode("pointer");
|
|
266
|
+
},
|
|
267
|
+
onMouseLeave: () => {
|
|
268
|
+
if (inputMode === "pointer") setActiveIndex((a) => a === i ? -1 : a);
|
|
269
|
+
},
|
|
243
270
|
onClick: () => activate(i),
|
|
244
271
|
style: sx({
|
|
245
272
|
display: "flex",
|
|
@@ -249,7 +276,9 @@ function Menu({ trigger, adornment, items, children, header, label, align = "end
|
|
|
249
276
|
padding: "var(--space-2) var(--space-3)",
|
|
250
277
|
border: "none",
|
|
251
278
|
borderRadius: "var(--radius-sm)",
|
|
252
|
-
background: active
|
|
279
|
+
background: active ? "var(--bg-subtle)" : "transparent",
|
|
280
|
+
// The active row is not the DOM-focused element (the panel is), so mark it for keyboard users.
|
|
281
|
+
boxShadow: active && inputMode === "keyboard" ? "var(--focus-ring)" : "none",
|
|
253
282
|
color: entry.disabled ? "var(--text-disabled)" : danger ? "var(--status-error-fg)" : "var(--text-secondary)",
|
|
254
283
|
fontFamily: "var(--font-body)",
|
|
255
284
|
fontSize: "var(--text-sm)",
|
package/dist/core/Menu.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/Menu.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { createPortal } from 'react-dom';\nimport { sx } from '../_internal/style';\n\n/**\n * Action menu / dropdown — a `trigger` you supply plus a portalled panel of\n * items. Same mechanics as `Select`: `position: fixed` panel measured off the\n * trigger, flips up when there's no room, closes on outside pointerdown / `Escape`\n * / selection, and returns focus to the trigger. `role=\"menu\"` with arrow-key\n * roving. Needs the `sereno-pop` keyframe from `@sereno-ds/ui/styles.css`.\n *\n * ```tsx\n * <Menu\n * trigger={<IconButton label=\"Conta\"><User /></IconButton>}\n * items={[\n * { label: 'Configurações', icon: <Settings />, onClick: openSettings },\n * { separator: true },\n * { label: 'Sair', icon: <LogOut />, tone: 'danger', onClick: signOut },\n * ]}\n * />\n * ```\n *\n * For a rich popover (a notifications list, say) pass a render function instead\n * of `items` — it receives `close`:\n * `<Menu trigger={…}>{(close) => <NotificationList onDone={close} />}</Menu>`\n */\n\nexport interface MenuItem {\n label: string;\n icon?: React.ReactNode;\n onClick?: () => void;\n disabled?: boolean;\n /** `danger` paints the row in the error colour (destructive action). */\n tone?: 'default' | 'danger';\n /** Keep the menu open after activating (e.g. a toggle row). Default `false`. */\n keepOpen?: boolean;\n}\n/** A hairline rule between groups. */\nexport interface MenuSeparator {\n separator: true;\n}\n/** A non-interactive group caption. */\nexport interface MenuHeading {\n heading: string;\n}\nexport type MenuEntry = MenuItem | MenuSeparator | MenuHeading;\n\nconst isItem = (e: MenuEntry): e is MenuItem => !('separator' in e) && !('heading' in e);\n\nexport interface MenuProps {\n /** The clickable element that opens the menu (an `IconButton`, `Button`, avatar button…). */\n trigger: React.ReactElement;\n /** Overlaid on the trigger — a notification count, a status dot. Sits in a\n * `pointer-events: none` layer so a click still opens the menu. */\n adornment?: React.ReactNode;\n /** Structured rows. Omit when using the `children` render function. */\n items?: MenuEntry[];\n /** Rich panel content — receives `close`. Mutually exclusive with `items`. */\n children?: (close: () => void) => React.ReactNode;\n /** A block above the `items` — a name + email, a title. Not part of the keyboard roving. */\n header?: React.ReactNode;\n /** Accessible name for the panel, and a heading row when `items` is used. */\n label?: string;\n /** Which trigger edge the panel lines up with. Default `end` (right). */\n align?: 'start' | 'end';\n /** Panel width. Number → px; string → any CSS length. Default: fits the content (min 180). */\n width?: number | string;\n disabled?: boolean;\n /** Controlled open state. Omit for uncontrolled. */\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n}\n\nconst GAP = 6;\nconst GUTTER = 12;\n\n/** `left` is clamped so the panel is always fully on screen; `above` picks the\n * vertical edge. On a narrow (phone) viewport `right` is set too — the panel\n * spans the gutters (centred, full-width) instead of hanging off the trigger. */\ntype Place = { top?: number; bottom?: number; left: number; right?: number; above: boolean; maxH: number };\n\n/** Phone-width viewport (`--bp-sm`). Width only — not `pointer: coarse`, which a\n * trackpad / touch laptop reports on a full-size screen. */\nconst PHONE_W = 560;\n\nexport function Menu({ trigger, adornment, items, children, header, label, align = 'end', width, disabled, open: openProp, onOpenChange }: MenuProps) {\n const rid = React.useId();\n const menuId = `${rid}-menu`;\n const anchorRef = React.useRef<HTMLSpanElement>(null);\n const panelRef = React.useRef<HTMLDivElement>(null);\n\n const isControlled = openProp !== undefined;\n const [openState, setOpenState] = React.useState(false);\n const open = isControlled ? openProp! : openState;\n const setOpen = React.useCallback(\n (next: boolean) => {\n if (!isControlled) setOpenState(next);\n onOpenChange?.(next);\n },\n [isControlled, onOpenChange],\n );\n\n const [mounted, setMounted] = React.useState(false);\n // eslint-disable-next-line react-hooks/set-state-in-effect -- portal target is client-only\n React.useEffect(() => setMounted(true), []);\n\n const [place, setPlace] = React.useState<Place | null>(null);\n const [activeIndex, setActiveIndex] = React.useState(-1);\n\n const itemIndexes = React.useMemo(() => (items ?? []).map((e, i) => (isItem(e) && !e.disabled ? i : -1)).filter((i) => i >= 0), [items]);\n\n const close = React.useCallback(\n (refocus = true) => {\n setOpen(false);\n setActiveIndex(-1);\n if (refocus) {\n const btn = anchorRef.current?.querySelector<HTMLElement>('button, [role=\"button\"], a, [tabindex]');\n btn?.focus({ preventScroll: true });\n }\n },\n [setOpen],\n );\n\n // Measure + place the panel while open. `left` is clamped to keep the whole\n // panel on screen (it can't just right-anchor — on a phone a 360px panel off a\n // trigger 300px from the left would run off the edge). Re-runs on scroll/resize;\n // closes if the trigger scrolls away (mirrors Select's fixed strategy). A\n // microtask re-measure picks up the real panel box once it's in the DOM.\n React.useLayoutEffect(() => {\n if (!open || !mounted) return;\n const anchor = anchorRef.current;\n if (!anchor) return;\n\n const measure = (): Place => {\n const r = anchor.getBoundingClientRect();\n // Fall back to a *desktop* width when unmeasurable — never full-width a\n // menu just because a reading came back 0 (a real phone always reports).\n const vw = window.innerWidth || document.documentElement.clientWidth || 1024;\n const vh = window.innerHeight || document.documentElement.clientHeight || 768;\n const roomBelow = vh - r.bottom - GUTTER;\n const roomAbove = r.top - GUTTER;\n const panelH = panelRef.current?.scrollHeight ?? 240;\n const above = roomBelow < Math.min(panelH, 200) && roomAbove > roomBelow;\n const maxH = Math.max(120, Math.round((above ? roomAbove : roomBelow) - GAP));\n const vert: Pick<Place, 'top' | 'bottom'> = above ? { bottom: Math.max(GUTTER, vh - r.top + GAP) } : { top: r.bottom + GAP };\n\n // Phone-width: span the gutters — centred, full-width — rather than hang off the trigger.\n if (vw <= PHONE_W) return { left: GUTTER, right: GUTTER, ...vert, above, maxH };\n\n const panelW = Math.min(panelRef.current?.offsetWidth || (typeof width === 'number' ? width : 240), vw - GUTTER * 2);\n const wanted = align === 'end' ? r.right - panelW : r.left;\n const left = Math.min(Math.max(GUTTER, wanted), vw - GUTTER - panelW);\n return { left, ...vert, above, maxH };\n };\n\n setPlace(measure());\n const raf = window.setTimeout(() => setPlace(measure()), 0); // real height now that the panel is in the DOM\n const anchorTop = anchor.getBoundingClientRect().top;\n const onScroll = (e: Event) => {\n if (e.target instanceof Node && panelRef.current?.contains(e.target)) return;\n if (Math.abs(anchor.getBoundingClientRect().top - anchorTop) > 1) close(false);\n else setPlace(measure());\n };\n const onResize = () => setPlace(measure());\n window.addEventListener('scroll', onScroll, true);\n window.addEventListener('resize', onResize);\n return () => {\n window.clearTimeout(raf);\n window.removeEventListener('scroll', onScroll, true);\n window.removeEventListener('resize', onResize);\n };\n }, [open, mounted, align, width, close]);\n\n // Outside pointerdown closes.\n React.useEffect(() => {\n if (!open) return;\n const onDown = (e: PointerEvent) => {\n const t = e.target as Node;\n if (anchorRef.current?.contains(t) || panelRef.current?.contains(t)) return;\n close(false);\n };\n document.addEventListener('pointerdown', onDown, true);\n return () => document.removeEventListener('pointerdown', onDown, true);\n }, [open, close]);\n\n // Move focus into the panel on open. The active row starts at the first item\n // (see `effectiveActive`) and only becomes explicit state once the user arrows.\n React.useEffect(() => {\n if (open && mounted) panelRef.current?.focus({ preventScroll: true });\n }, [open, mounted]);\n\n const effectiveActive = activeIndex >= 0 ? activeIndex : itemIndexes[0] ?? -1;\n\n const activate = (i: number) => {\n const e = (items ?? [])[i];\n if (!e || !isItem(e) || e.disabled) return;\n e.onClick?.();\n if (!e.keepOpen) close();\n };\n\n const roverKeyDown = (ev: React.KeyboardEvent) => {\n if (ev.key === 'Escape') {\n ev.preventDefault();\n close();\n return;\n }\n if (ev.key === 'Tab') {\n close(false);\n return;\n }\n if (!items) return;\n const pos = itemIndexes.indexOf(effectiveActive);\n if (ev.key === 'ArrowDown') {\n ev.preventDefault();\n setActiveIndex(itemIndexes[Math.min(pos + 1, itemIndexes.length - 1)] ?? itemIndexes[0]);\n } else if (ev.key === 'ArrowUp') {\n ev.preventDefault();\n setActiveIndex(itemIndexes[Math.max(pos - 1, 0)] ?? itemIndexes[itemIndexes.length - 1]);\n } else if (ev.key === 'Home') {\n ev.preventDefault();\n setActiveIndex(itemIndexes[0]);\n } else if (ev.key === 'End') {\n ev.preventDefault();\n setActiveIndex(itemIndexes[itemIndexes.length - 1]);\n } else if (ev.key === 'Enter' || ev.key === ' ') {\n ev.preventDefault();\n activate(effectiveActive);\n }\n };\n\n const toggle = () => {\n if (disabled) return;\n setOpen(!open);\n };\n\n const triggerEl = React.cloneElement(trigger as React.ReactElement<Record<string, unknown>>, {\n onClick: (e: React.MouseEvent) => {\n (trigger.props as { onClick?: (e: React.MouseEvent) => void }).onClick?.(e);\n toggle();\n },\n 'aria-haspopup': 'menu',\n 'aria-expanded': open,\n 'aria-controls': open ? menuId : undefined,\n 'data-menu-open': open || undefined,\n });\n\n const panelStyle = (p: Place): React.CSSProperties => {\n const full = p.right != null; // phone: left+right span the gutters, width is implied\n return sx({\n position: 'fixed',\n top: p.top,\n bottom: p.bottom,\n left: p.left,\n right: p.right,\n width: full ? undefined : width ?? 'max-content',\n minWidth: full ? undefined : width ?? 180,\n maxWidth: full ? undefined : `calc(100vw - ${GUTTER * 2}px)`,\n maxHeight: p.maxH,\n zIndex: 1200,\n display: 'flex',\n flexDirection: 'column',\n overflowY: 'auto',\n background: 'var(--bg-surface)',\n border: 'var(--border-width-hairline) solid var(--border-default)',\n borderRadius: 'var(--radius-md)',\n boxShadow: 'var(--shadow-lg)',\n padding: items ? 'var(--space-1)' : 0,\n outline: 'none',\n transformOrigin: p.above ? 'bottom' : 'top',\n animation: 'sereno-pop var(--duration-fast) var(--ease-out)',\n });\n };\n\n /* eslint-disable react-hooks/refs -- the `children` render function receives `close`, a stable\n useCallback that reads the anchor ref only when a consumer invokes it from an event handler —\n never during this render. */\n return (\n <span ref={anchorRef} style={sx({ display: 'inline-flex', position: 'relative' })}>\n {triggerEl}\n {adornment != null && <span style={sx({ position: 'absolute', inset: 0, pointerEvents: 'none' })}>{adornment}</span>}\n {open &&\n mounted &&\n place &&\n createPortal(\n <div\n ref={panelRef}\n id={menuId}\n role={items ? 'menu' : 'dialog'}\n aria-label={label}\n aria-modal={items ? undefined : true}\n tabIndex={-1}\n onKeyDown={roverKeyDown}\n style={panelStyle(place)}\n >\n {header && (\n <div\n style={sx({\n flex: '0 0 auto',\n padding: 'var(--space-3) var(--space-4)',\n margin: items ? 'calc(var(--space-1) * -1) calc(var(--space-1) * -1) var(--space-1)' : 0,\n borderBottom: 'var(--border-width-hairline) solid var(--border-subtle)',\n fontFamily: 'var(--font-body)',\n })}\n >\n {header}\n </div>\n )}\n {items ? (\n <>\n {label && (\n <div\n style={sx({\n padding: 'var(--space-2) var(--space-3) var(--space-1)',\n fontFamily: 'var(--font-body)',\n fontSize: 'var(--text-2xs)',\n fontWeight: 'var(--weight-bold)',\n letterSpacing: 'var(--tracking-caps)',\n textTransform: 'uppercase',\n color: 'var(--text-muted)',\n })}\n >\n {label}\n </div>\n )}\n {items.map((entry, i) => {\n if ('separator' in entry) {\n return <div key={i} role=\"separator\" style={sx({ height: 1, margin: 'var(--space-1) 0', background: 'var(--border-subtle)' })} />;\n }\n if ('heading' in entry) {\n return (\n <div\n key={i}\n style={sx({\n padding: 'var(--space-2) var(--space-3) var(--space-1)',\n fontFamily: 'var(--font-body)',\n fontSize: 'var(--text-2xs)',\n fontWeight: 'var(--weight-bold)',\n letterSpacing: 'var(--tracking-caps)',\n textTransform: 'uppercase',\n color: 'var(--text-muted)',\n })}\n >\n {entry.heading}\n </div>\n );\n }\n const danger = entry.tone === 'danger';\n const active = i === effectiveActive;\n return (\n <button\n key={i}\n type=\"button\"\n role=\"menuitem\"\n disabled={entry.disabled}\n onMouseEnter={() => !entry.disabled && setActiveIndex(i)}\n onClick={() => activate(i)}\n style={sx({\n display: 'flex',\n alignItems: 'center',\n gap: 'var(--space-3)',\n width: '100%',\n padding: 'var(--space-2) var(--space-3)',\n border: 'none',\n borderRadius: 'var(--radius-sm)',\n background: active && !entry.disabled ? 'var(--bg-subtle)' : 'transparent',\n color: entry.disabled\n ? 'var(--text-disabled)'\n : danger\n ? 'var(--status-error-fg)'\n : 'var(--text-secondary)',\n fontFamily: 'var(--font-body)',\n fontSize: 'var(--text-sm)',\n textAlign: 'left',\n cursor: entry.disabled ? 'not-allowed' : 'pointer',\n })}\n >\n {entry.icon && <span style={sx({ display: 'flex', flex: '0 0 auto' })}>{entry.icon}</span>}\n <span style={sx({ flex: 1, minWidth: 0, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' })}>{entry.label}</span>\n </button>\n );\n })}\n </>\n ) : (\n children?.(close)\n )}\n </div>,\n document.body,\n )}\n </span>\n );\n /* eslint-enable react-h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BACT,QAAQ;AAAA,sBACR,cAAc;AAAA,sBACd,YAAY,UAAU,CAAC,MAAM,WAAW,qBAAqB;AAAA,sBAC7D,OAAO,MAAM,WACT,yBACA,SACE,2BACA;AAAA,sBACN,YAAY;AAAA,sBACZ,UAAU;AAAA,sBACV,WAAW;AAAA,sBACX,QAAQ,MAAM,WAAW,gBAAgB;AAAA,oBAC3C,CAAC;AAAA,oBAEA;AAAA,4BAAM,QAAQ,oBAAC,UAAK,OAAO,GAAG,EAAE,SAAS,QAAQ,MAAM,WAAW,CAAC,GAAI,gBAAM,MAAK;AAAA,sBACnF,oBAAC,UAAK,OAAO,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,UAAU,UAAU,cAAc,YAAY,YAAY,SAAS,CAAC,GAAI,gBAAM,OAAM;AAAA;AAAA;AAAA,kBA3BvH;AAAA,gBA4BP;AAAA,cAEJ,CAAC;AAAA,eACH,IAEA,WAAW,KAAK;AAAA;AAAA;AAAA,MAEpB;AAAA,MACA,SAAS;AAAA,IACX;AAAA,KACJ;AAGJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/core/Menu.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { createPortal } from 'react-dom';\nimport { sx } from '../_internal/style';\n\n/**\n * Action menu / dropdown — a `trigger` you supply plus a portalled panel of\n * items. Same mechanics as `Select`: `position: fixed` panel measured off the\n * trigger, flips up when there's no room, closes on outside pointerdown / `Escape`\n * / selection, and returns focus to the trigger. `role=\"menu\"` with arrow-key\n * roving. Needs the `sereno-pop` keyframe from `@sereno-ds/ui/styles.css`.\n *\n * Opened with a click or tap, no row is highlighted until the pointer enters one\n * or the user arrows. Opened from the keyboard (Enter, Space or ArrowDown on the\n * trigger; ArrowUp for the last row) the first enabled row is active, with a\n * focus ring, so Enter acts straight away.\n *\n * ```tsx\n * <Menu\n * trigger={<IconButton label=\"Conta\"><User /></IconButton>}\n * items={[\n * { label: 'Configurações', icon: <Settings />, onClick: openSettings },\n * { separator: true },\n * { label: 'Sair', icon: <LogOut />, tone: 'danger', onClick: signOut },\n * ]}\n * />\n * ```\n *\n * For a rich popover (a notifications list, say) pass a render function instead\n * of `items` — it receives `close`:\n * `<Menu trigger={…}>{(close) => <NotificationList onDone={close} />}</Menu>`\n */\n\nexport interface MenuItem {\n label: string;\n icon?: React.ReactNode;\n onClick?: () => void;\n disabled?: boolean;\n /** `danger` paints the row in the error colour (destructive action). */\n tone?: 'default' | 'danger';\n /** Keep the menu open after activating (e.g. a toggle row). Default `false`. */\n keepOpen?: boolean;\n}\n/** A hairline rule between groups. */\nexport interface MenuSeparator {\n separator: true;\n}\n/** A non-interactive group caption. */\nexport interface MenuHeading {\n heading: string;\n}\nexport type MenuEntry = MenuItem | MenuSeparator | MenuHeading;\n\nconst isItem = (e: MenuEntry): e is MenuItem => !('separator' in e) && !('heading' in e);\n\nexport interface MenuProps {\n /** The clickable element that opens the menu (an `IconButton`, `Button`, avatar button…). */\n trigger: React.ReactElement;\n /** Overlaid on the trigger — a notification count, a status dot. Sits in a\n * `pointer-events: none` layer so a click still opens the menu. */\n adornment?: React.ReactNode;\n /** Structured rows. Omit when using the `children` render function. */\n items?: MenuEntry[];\n /** Rich panel content — receives `close`. Mutually exclusive with `items`. */\n children?: (close: () => void) => React.ReactNode;\n /** A block above the `items` — a name + email, a title. Not part of the keyboard roving. */\n header?: React.ReactNode;\n /** Accessible name for the panel, and a heading row when `items` is used. */\n label?: string;\n /** Which trigger edge the panel lines up with. Default `end` (right). */\n align?: 'start' | 'end';\n /** Panel width. Number → px; string → any CSS length. Default: fits the content (min 180). */\n width?: number | string;\n disabled?: boolean;\n /** Controlled open state. Omit for uncontrolled. */\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n}\n\nconst GAP = 6;\nconst GUTTER = 12;\n\n/** `left` is clamped so the panel is always fully on screen; `above` picks the\n * vertical edge. On a narrow (phone) viewport `right` is set too — the panel\n * spans the gutters (centred, full-width) instead of hanging off the trigger. */\ntype Place = { top?: number; bottom?: number; left: number; right?: number; above: boolean; maxH: number };\n\n/** Phone-width viewport (`--bp-sm`). Width only — not `pointer: coarse`, which a\n * trackpad / touch laptop reports on a full-size screen. */\nconst PHONE_W = 560;\n\nexport function Menu({ trigger, adornment, items, children, header, label, align = 'end', width, disabled, open: openProp, onOpenChange }: MenuProps) {\n const rid = React.useId();\n const menuId = `${rid}-menu`;\n const anchorRef = React.useRef<HTMLSpanElement>(null);\n const panelRef = React.useRef<HTMLDivElement>(null);\n\n const isControlled = openProp !== undefined;\n const [openState, setOpenState] = React.useState(false);\n const open = isControlled ? openProp! : openState;\n const setOpen = React.useCallback(\n (next: boolean) => {\n if (!isControlled) setOpenState(next);\n onOpenChange?.(next);\n },\n [isControlled, onOpenChange],\n );\n\n const [mounted, setMounted] = React.useState(false);\n // eslint-disable-next-line react-hooks/set-state-in-effect -- portal target is client-only\n React.useEffect(() => setMounted(true), []);\n\n const [place, setPlace] = React.useState<Place | null>(null);\n const [activeIndex, setActiveIndex] = React.useState(-1);\n // How the user is driving the menu. `pointer` (opened by a click or tap, or the mouse\n // entered a row): nothing is highlighted until a row is hovered or arrowed to. `keyboard`\n // (anything else): the first row is active so Enter works straight away, and the active\n // row gets a focus ring. Unknown opens (a screen reader, the parent forcing `open`) take\n // the keyboard side, the one that stays operable without a pointer.\n const [inputMode, setInputMode] = React.useState<'pointer' | 'keyboard'>('keyboard');\n\n // A fresh open never inherits the last session's row or mode, whichever way it closed\n // (Escape, outside click, the trigger, the parent). Adjusted during render, not in an effect.\n const [wasOpen, setWasOpen] = React.useState(open);\n if (open !== wasOpen) {\n setWasOpen(open);\n if (!open) {\n setActiveIndex(-1);\n setInputMode('keyboard');\n }\n }\n\n const itemIndexes = React.useMemo(() => (items ?? []).map((e, i) => (isItem(e) && !e.disabled ? i : -1)).filter((i) => i >= 0), [items]);\n\n const close = React.useCallback(\n (refocus = true) => {\n setOpen(false);\n if (refocus) {\n const btn = anchorRef.current?.querySelector<HTMLElement>('button, [role=\"button\"], a, [tabindex]');\n btn?.focus({ preventScroll: true });\n }\n },\n [setOpen],\n );\n\n // Measure + place the panel while open. `left` is clamped to keep the whole\n // panel on screen (it can't just right-anchor — on a phone a 360px panel off a\n // trigger 300px from the left would run off the edge). Re-runs on scroll/resize;\n // closes if the trigger scrolls away (mirrors Select's fixed strategy). A\n // microtask re-measure picks up the real panel box once it's in the DOM.\n React.useLayoutEffect(() => {\n if (!open || !mounted) return;\n const anchor = anchorRef.current;\n if (!anchor) return;\n\n const measure = (): Place => {\n const r = anchor.getBoundingClientRect();\n // Fall back to a *desktop* width when unmeasurable — never full-width a\n // menu just because a reading came back 0 (a real phone always reports).\n const vw = window.innerWidth || document.documentElement.clientWidth || 1024;\n const vh = window.innerHeight || document.documentElement.clientHeight || 768;\n const roomBelow = vh - r.bottom - GUTTER;\n const roomAbove = r.top - GUTTER;\n const panelH = panelRef.current?.scrollHeight ?? 240;\n const above = roomBelow < Math.min(panelH, 200) && roomAbove > roomBelow;\n const maxH = Math.max(120, Math.round((above ? roomAbove : roomBelow) - GAP));\n const vert: Pick<Place, 'top' | 'bottom'> = above ? { bottom: Math.max(GUTTER, vh - r.top + GAP) } : { top: r.bottom + GAP };\n\n // Phone-width: span the gutters — centred, full-width — rather than hang off the trigger.\n if (vw <= PHONE_W) return { left: GUTTER, right: GUTTER, ...vert, above, maxH };\n\n const panelW = Math.min(panelRef.current?.offsetWidth || (typeof width === 'number' ? width : 240), vw - GUTTER * 2);\n const wanted = align === 'end' ? r.right - panelW : r.left;\n const left = Math.min(Math.max(GUTTER, wanted), vw - GUTTER - panelW);\n return { left, ...vert, above, maxH };\n };\n\n setPlace(measure());\n const raf = window.setTimeout(() => setPlace(measure()), 0); // real height now that the panel is in the DOM\n const anchorTop = anchor.getBoundingClientRect().top;\n const onScroll = (e: Event) => {\n if (e.target instanceof Node && panelRef.current?.contains(e.target)) return;\n if (Math.abs(anchor.getBoundingClientRect().top - anchorTop) > 1) close(false);\n else setPlace(measure());\n };\n const onResize = () => setPlace(measure());\n window.addEventListener('scroll', onScroll, true);\n window.addEventListener('resize', onResize);\n return () => {\n window.clearTimeout(raf);\n window.removeEventListener('scroll', onScroll, true);\n window.removeEventListener('resize', onResize);\n };\n }, [open, mounted, align, width, close]);\n\n // Outside pointerdown closes.\n React.useEffect(() => {\n if (!open) return;\n const onDown = (e: PointerEvent) => {\n const t = e.target as Node;\n if (anchorRef.current?.contains(t) || panelRef.current?.contains(t)) return;\n close(false);\n };\n document.addEventListener('pointerdown', onDown, true);\n return () => document.removeEventListener('pointerdown', onDown, true);\n }, [open, close]);\n\n // Move focus into the panel on open. Which row starts active depends on how it\n // was opened (see `effectiveActive`). The panel only mounts once `place` is measured,\n // so on the first open of an instance this has to wait for it (`placed`), or the\n // focus stays on the trigger and the arrow keys / Enter never reach the panel.\n // Leave it be if something inside already took focus (an `autoFocus` field in a rich panel).\n const placed = place !== null;\n React.useEffect(() => {\n const panel = panelRef.current;\n if (open && mounted && placed && panel && !panel.contains(document.activeElement)) panel.focus({ preventScroll: true });\n }, [open, mounted, placed]);\n\n // Opened by a pointer, no row is active until one is hovered or arrowed to, so the\n // panel never looks hovered under a cursor that is still on the trigger.\n const effectiveActive = activeIndex >= 0 ? activeIndex : inputMode === 'pointer' ? -1 : itemIndexes[0] ?? -1;\n\n const activate = (i: number) => {\n const e = (items ?? [])[i];\n if (!e || !isItem(e) || e.disabled) return;\n e.onClick?.();\n if (!e.keepOpen) close();\n };\n\n const roverKeyDown = (ev: React.KeyboardEvent) => {\n if (ev.key === 'Escape') {\n ev.preventDefault();\n close();\n return;\n }\n if (ev.key === 'Tab') {\n close(false);\n return;\n }\n if (!items) return;\n const pos = itemIndexes.indexOf(effectiveActive);\n const last = itemIndexes[itemIndexes.length - 1];\n let next: number | undefined;\n if (ev.key === 'ArrowDown') next = itemIndexes[Math.min(pos + 1, itemIndexes.length - 1)];\n // From \"nothing active\" (pointer open) ArrowUp goes to the last row, like on the trigger.\n else if (ev.key === 'ArrowUp') next = pos < 0 ? last : itemIndexes[Math.max(pos - 1, 0)];\n else if (ev.key === 'Home') next = itemIndexes[0];\n else if (ev.key === 'End') next = last;\n else if (ev.key === 'Enter' || ev.key === ' ') {\n ev.preventDefault();\n activate(effectiveActive);\n return;\n } else return;\n ev.preventDefault();\n setInputMode('keyboard');\n if (next !== undefined) setActiveIndex(next);\n };\n\n // `viaPointer` picks the starting state (see `inputMode`).\n const toggle = (viaPointer: boolean) => {\n if (disabled) return;\n if (!open) setInputMode(viaPointer ? 'pointer' : 'keyboard');\n setOpen(!open);\n };\n\n const triggerEl = React.cloneElement(trigger as React.ReactElement<Record<string, unknown>>, {\n onClick: (e: React.MouseEvent) => {\n (trigger.props as { onClick?: (e: React.MouseEvent) => void }).onClick?.(e);\n // A real click or tap carries a click count (`detail` >= 1). Enter / Space on the\n // trigger, a screen reader and `element.click()` all report 0.\n toggle((e?.detail ?? 0) > 0);\n },\n // Menu button pattern: ArrowDown opens on the first row, ArrowUp on the last.\n onKeyDown: (e: React.KeyboardEvent) => {\n (trigger.props as { onKeyDown?: (e: React.KeyboardEvent) => void }).onKeyDown?.(e);\n if (e.defaultPrevented || disabled || open || !items) return;\n if (e.key !== 'ArrowDown' && e.key !== 'ArrowUp') return;\n e.preventDefault();\n setInputMode('keyboard');\n setActiveIndex(e.key === 'ArrowUp' ? itemIndexes[itemIndexes.length - 1] ?? -1 : -1);\n setOpen(true);\n },\n 'aria-haspopup': 'menu',\n 'aria-expanded': open,\n 'aria-controls': open ? menuId : undefined,\n 'data-menu-open': open || undefined,\n });\n\n const panelStyle = (p: Place): React.CSSProperties => {\n const full = p.right != null; // phone: left+right span the gutters, width is implied\n return sx({\n position: 'fixed',\n top: p.top,\n bottom: p.bottom,\n left: p.left,\n right: p.right,\n width: full ? undefined : width ?? 'max-content',\n minWidth: full ? undefined : width ?? 180,\n maxWidth: full ? undefined : `calc(100vw - ${GUTTER * 2}px)`,\n maxHeight: p.maxH,\n zIndex: 1200,\n display: 'flex',\n flexDirection: 'column',\n overflowY: 'auto',\n background: 'var(--bg-surface)',\n border: 'var(--border-width-hairline) solid var(--border-default)',\n borderRadius: 'var(--radius-md)',\n boxShadow: 'var(--shadow-lg)',\n padding: items ? 'var(--space-1)' : 0,\n outline: 'none',\n transformOrigin: p.above ? 'bottom' : 'top',\n animation: 'sereno-pop var(--duration-fast) var(--ease-out)',\n });\n };\n\n /* eslint-disable react-hooks/refs -- the `children` render function receives `close`, a stable\n useCallback that reads the anchor ref only when a consumer invokes it from an event handler —\n never during this render. */\n return (\n <span ref={anchorRef} style={sx({ display: 'inline-flex', position: 'relative' })}>\n {triggerEl}\n {adornment != null && <span style={sx({ position: 'absolute', inset: 0, pointerEvents: 'none' })}>{adornment}</span>}\n {open &&\n mounted &&\n place &&\n createPortal(\n <div\n ref={panelRef}\n id={menuId}\n role={items ? 'menu' : 'dialog'}\n aria-label={label}\n aria-modal={items ? undefined : true}\n tabIndex={-1}\n onKeyDown={roverKeyDown}\n style={panelStyle(place)}\n >\n {header && (\n <div\n style={sx({\n flex: '0 0 auto',\n padding: 'var(--space-3) var(--space-4)',\n margin: items ? 'calc(var(--space-1) * -1) calc(var(--space-1) * -1) var(--space-1)' : 0,\n borderBottom: 'var(--border-width-hairline) solid var(--border-subtle)',\n fontFamily: 'var(--font-body)',\n })}\n >\n {header}\n </div>\n )}\n {items ? (\n <>\n {label && (\n <div\n style={sx({\n padding: 'var(--space-2) var(--space-3) var(--space-1)',\n fontFamily: 'var(--font-body)',\n fontSize: 'var(--text-2xs)',\n fontWeight: 'var(--weight-bold)',\n letterSpacing: 'var(--tracking-caps)',\n textTransform: 'uppercase',\n color: 'var(--text-muted)',\n })}\n >\n {label}\n </div>\n )}\n {items.map((entry, i) => {\n if ('separator' in entry) {\n return <div key={i} role=\"separator\" style={sx({ height: 1, margin: 'var(--space-1) 0', background: 'var(--border-subtle)' })} />;\n }\n if ('heading' in entry) {\n return (\n <div\n key={i}\n style={sx({\n padding: 'var(--space-2) var(--space-3) var(--space-1)',\n fontFamily: 'var(--font-body)',\n fontSize: 'var(--text-2xs)',\n fontWeight: 'var(--weight-bold)',\n letterSpacing: 'var(--tracking-caps)',\n textTransform: 'uppercase',\n color: 'var(--text-muted)',\n })}\n >\n {entry.heading}\n </div>\n );\n }\n const danger = entry.tone === 'danger';\n const active = i === effectiveActive && !entry.disabled;\n return (\n <button\n key={i}\n type=\"button\"\n role=\"menuitem\"\n disabled={entry.disabled}\n data-active={active || undefined}\n onMouseEnter={() => {\n if (entry.disabled) return;\n setActiveIndex(i);\n setInputMode('pointer');\n }}\n // Hover ends with the pointer, so the fill must not stay behind on the last\n // row it crossed. A row the keyboard moved to is left alone.\n onMouseLeave={() => {\n if (inputMode === 'pointer') setActiveIndex((a) => (a === i ? -1 : a));\n }}\n onClick={() => activate(i)}\n style={sx({\n display: 'flex',\n alignItems: 'center',\n gap: 'var(--space-3)',\n width: '100%',\n padding: 'var(--space-2) var(--space-3)',\n border: 'none',\n borderRadius: 'var(--radius-sm)',\n background: active ? 'var(--bg-subtle)' : 'transparent',\n // The active row is not the DOM-focused element (the panel is), so mark it for keyboard users.\n boxShadow: active && inputMode === 'keyboard' ? 'var(--focus-ring)' : 'none',\n color: entry.disabled\n ? 'var(--text-disabled)'\n : danger\n ? 'var(--status-error-fg)'\n : 'var(--text-secondary)',\n fontFamily: 'var(--font-body)',\n fontSize: 'var(--text-sm)',\n textAlign: 'left',\n cursor: entry.disabled ? 'not-allowed' : 'pointer',\n })}\n >\n {entry.icon && <span style={sx({ display: 'flex', flex: '0 0 auto' })}>{entry.icon}</span>}\n <span style={sx({ flex: 1, minWidth: 0, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' })}>{entry.label}</span>\n </button>\n );\n })}\n </>\n ) : (\n children?.(close)\n )}\n </div>,\n document.body,\n )}\n </span>\n );\n /* eslint-enable react-hooks/refs */\n}\n"],"mappings":";AAkU4B,SA6Bd,UA7Bc,KAsER,YAtEQ;AAhU5B,YAAY,WAAW;AACvB,S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