@sereno-ds/ui 0.40.1 → 0.41.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/_internal/MenuOption.d.ts +23 -0
- package/dist/_internal/MenuOption.js +61 -0
- package/dist/_internal/MenuOption.js.map +1 -0
- package/dist/_internal/useCoarsePointer.d.ts +4 -0
- package/dist/_internal/useCoarsePointer.js +16 -0
- package/dist/_internal/useCoarsePointer.js.map +1 -0
- package/dist/_internal/useLatest.d.ts +9 -0
- package/dist/_internal/useLatest.js +13 -0
- package/dist/_internal/useLatest.js.map +1 -0
- package/dist/_internal/useMenuPlacement.d.ts +43 -0
- package/dist/_internal/useMenuPlacement.js +80 -0
- package/dist/_internal/useMenuPlacement.js.map +1 -0
- package/dist/_internal/useRevealActive.d.ts +27 -0
- package/dist/_internal/useRevealActive.js +36 -0
- package/dist/_internal/useRevealActive.js.map +1 -0
- package/dist/forms/Autocomplete.d.ts +111 -0
- package/dist/forms/Autocomplete.js +492 -0
- package/dist/forms/Autocomplete.js.map +1 -0
- package/dist/forms/Select.js +31 -132
- package/dist/forms/Select.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/forms/Select.js
CHANGED
|
@@ -2,25 +2,16 @@
|
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { createPortal } from "react-dom";
|
|
5
|
-
import {
|
|
5
|
+
import { ChevronDown } from "lucide-react";
|
|
6
6
|
import { sx } from "../_internal/style.js";
|
|
7
7
|
import { acquireScrollLock } from "../_internal/scrollLock.js";
|
|
8
|
-
import {
|
|
8
|
+
import { useCoarsePointer } from "../_internal/useCoarsePointer.js";
|
|
9
|
+
import { useMenuPlacement } from "../_internal/useMenuPlacement.js";
|
|
10
|
+
import { useRevealActive } from "../_internal/useRevealActive.js";
|
|
11
|
+
import { MenuOption, menuListStyle, menuRowPadY, menuSurfaceStyle } from "../_internal/MenuOption.js";
|
|
9
12
|
import { Field } from "../_internal/Field.js";
|
|
10
13
|
import { fieldA11y } from "../_internal/fieldA11y.js";
|
|
11
14
|
import { fieldBoxStyle } from "./_internal/fieldBoxStyle.js";
|
|
12
|
-
const OPTION_PAD_Y = { sm: 6, md: 8, lg: 10 };
|
|
13
|
-
function useCoarsePointer() {
|
|
14
|
-
return React.useSyncExternalStore(
|
|
15
|
-
(onChange) => {
|
|
16
|
-
const mq = window.matchMedia("(pointer: coarse)");
|
|
17
|
-
mq.addEventListener("change", onChange);
|
|
18
|
-
return () => mq.removeEventListener("change", onChange);
|
|
19
|
-
},
|
|
20
|
-
() => window.matchMedia("(pointer: coarse)").matches,
|
|
21
|
-
() => false
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
15
|
function CustomSelect({
|
|
25
16
|
rid,
|
|
26
17
|
label,
|
|
@@ -44,7 +35,14 @@ function CustomSelect({
|
|
|
44
35
|
const [activeIndex, setActiveIndex] = React.useState(-1);
|
|
45
36
|
const [mounted, setMounted] = React.useState(false);
|
|
46
37
|
React.useEffect(() => setMounted(true), []);
|
|
47
|
-
const
|
|
38
|
+
const place = useMenuPlacement({
|
|
39
|
+
open,
|
|
40
|
+
disabled: coarse,
|
|
41
|
+
anchorRef: triggerRef,
|
|
42
|
+
panelRef,
|
|
43
|
+
itemCount: options.length,
|
|
44
|
+
onDismiss: () => setOpen(false)
|
|
45
|
+
});
|
|
48
46
|
const selectedIndex = options.findIndex((o) => o.value === value);
|
|
49
47
|
const selected = selectedIndex >= 0 ? options[selectedIndex] : void 0;
|
|
50
48
|
const firstEnabled = () => options.findIndex((o) => !o.disabled);
|
|
@@ -61,63 +59,6 @@ function CustomSelect({
|
|
|
61
59
|
}
|
|
62
60
|
return from;
|
|
63
61
|
};
|
|
64
|
-
useIsoLayoutEffect(() => {
|
|
65
|
-
if (!open || coarse) return;
|
|
66
|
-
const t = triggerRef.current;
|
|
67
|
-
if (!t) return;
|
|
68
|
-
const GAP = 6;
|
|
69
|
-
const vh = window.innerHeight || document.documentElement.clientHeight || 900;
|
|
70
|
-
const estH = Math.min(288, options.length * 36 + 8);
|
|
71
|
-
const evalRoom = () => {
|
|
72
|
-
const r = t.getBoundingClientRect();
|
|
73
|
-
const roomBelow = vh - r.bottom - 8;
|
|
74
|
-
const roomAbove = r.top - 8;
|
|
75
|
-
const above = roomBelow < Math.min(estH, 200) && roomAbove > roomBelow;
|
|
76
|
-
const maxH = Math.max(120, Math.min(288, Math.round((above ? roomAbove : roomBelow) - GAP)));
|
|
77
|
-
return { r, above, maxH };
|
|
78
|
-
};
|
|
79
|
-
let fixed = false;
|
|
80
|
-
for (let el = t.parentElement; el && el !== document.body; el = el.parentElement) {
|
|
81
|
-
if (getComputedStyle(el).position === "fixed") {
|
|
82
|
-
fixed = true;
|
|
83
|
-
break;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
if (fixed) {
|
|
87
|
-
const { r, above, maxH } = evalRoom();
|
|
88
|
-
setPlace({ strategy: "fixed", above, maxH, left: r.left, width: r.width, top: above ? r.top - GAP : r.bottom + GAP });
|
|
89
|
-
const anchorTop = r.top;
|
|
90
|
-
const onScroll2 = (e) => {
|
|
91
|
-
if (e.target instanceof Node && panelRef.current?.contains(e.target)) return;
|
|
92
|
-
if (Math.abs(t.getBoundingClientRect().top - anchorTop) > 1) setOpen(false);
|
|
93
|
-
};
|
|
94
|
-
const onResize = () => setOpen(false);
|
|
95
|
-
window.addEventListener("scroll", onScroll2, true);
|
|
96
|
-
window.addEventListener("resize", onResize);
|
|
97
|
-
return () => {
|
|
98
|
-
window.removeEventListener("scroll", onScroll2, true);
|
|
99
|
-
window.removeEventListener("resize", onResize);
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
const applyFull = () => {
|
|
103
|
-
const { above, maxH } = evalRoom();
|
|
104
|
-
setPlace(
|
|
105
|
-
(prev) => prev?.strategy === "inline" && prev.above === above && prev.maxH === maxH ? prev : { strategy: "inline", above, maxH }
|
|
106
|
-
);
|
|
107
|
-
};
|
|
108
|
-
applyFull();
|
|
109
|
-
const onScroll = (e) => {
|
|
110
|
-
if (e.target instanceof Node && panelRef.current?.contains(e.target)) return;
|
|
111
|
-
const { above } = evalRoom();
|
|
112
|
-
setPlace((prev) => prev?.strategy === "inline" && prev.above !== above ? { ...prev, above } : prev);
|
|
113
|
-
};
|
|
114
|
-
window.addEventListener("scroll", onScroll, true);
|
|
115
|
-
window.addEventListener("resize", applyFull);
|
|
116
|
-
return () => {
|
|
117
|
-
window.removeEventListener("scroll", onScroll, true);
|
|
118
|
-
window.removeEventListener("resize", applyFull);
|
|
119
|
-
};
|
|
120
|
-
}, [open, coarse, options.length]);
|
|
121
62
|
React.useEffect(() => {
|
|
122
63
|
if (!open || coarse) return;
|
|
123
64
|
const onDown = (e) => {
|
|
@@ -132,18 +73,7 @@ function CustomSelect({
|
|
|
132
73
|
if (!open || !coarse) return;
|
|
133
74
|
return acquireScrollLock();
|
|
134
75
|
}, [open, coarse]);
|
|
135
|
-
|
|
136
|
-
useIsoLayoutEffect(() => {
|
|
137
|
-
if (!open) {
|
|
138
|
-
revealedIndex.current = null;
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
if (activeIndex < 0 || activeIndex === revealedIndex.current) return;
|
|
142
|
-
const el = document.getElementById(`${rid}-opt-${activeIndex}`);
|
|
143
|
-
if (!el) return;
|
|
144
|
-
revealedIndex.current = activeIndex;
|
|
145
|
-
el.scrollIntoView({ block: "nearest" });
|
|
146
|
-
}, [open, activeIndex, rid, place]);
|
|
76
|
+
useRevealActive(open, activeIndex >= 0 ? `${rid}-opt-${activeIndex}` : null, place);
|
|
147
77
|
const openMenu = () => {
|
|
148
78
|
if (disabled) return;
|
|
149
79
|
setActiveIndex(selectedIndex >= 0 ? selectedIndex : firstEnabled());
|
|
@@ -214,54 +144,23 @@ function CustomSelect({
|
|
|
214
144
|
}
|
|
215
145
|
};
|
|
216
146
|
const hasValue = !!selected;
|
|
217
|
-
const rowPadY = coarse
|
|
218
|
-
const listStyleBase = {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
return /* @__PURE__ */ jsxs(
|
|
235
|
-
"li",
|
|
236
|
-
{
|
|
237
|
-
id: `${rid}-opt-${i}`,
|
|
238
|
-
role: "option",
|
|
239
|
-
"aria-selected": isSelected,
|
|
240
|
-
"aria-disabled": o.disabled || void 0,
|
|
241
|
-
onPointerEnter: () => !o.disabled && setActiveIndex(i),
|
|
242
|
-
onClick: () => choose(i),
|
|
243
|
-
style: sx({
|
|
244
|
-
display: "flex",
|
|
245
|
-
alignItems: "center",
|
|
246
|
-
justifyContent: "space-between",
|
|
247
|
-
gap: "var(--space-2)",
|
|
248
|
-
minHeight: coarse ? 44 : void 0,
|
|
249
|
-
padding: `${rowPadY}px var(--space-3)`,
|
|
250
|
-
borderRadius: "var(--radius-sm)",
|
|
251
|
-
cursor: o.disabled ? "not-allowed" : "pointer",
|
|
252
|
-
color: o.disabled ? "var(--text-disabled)" : "var(--text-primary)",
|
|
253
|
-
background: isActive && !o.disabled ? "var(--bg-subtle)" : "transparent",
|
|
254
|
-
fontWeight: isSelected ? "var(--weight-semibold)" : "var(--weight-regular)",
|
|
255
|
-
fontSize: coarse ? "var(--text-base)" : void 0
|
|
256
|
-
}),
|
|
257
|
-
children: [
|
|
258
|
-
/* @__PURE__ */ jsx("span", { style: sx({ overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }), children: o.label }),
|
|
259
|
-
isSelected && /* @__PURE__ */ jsx("span", { style: sx({ display: "flex", flex: "0 0 auto", color: "var(--text-brand)" }), children: /* @__PURE__ */ jsx(Check, { size: coarse ? 18 : 16, strokeWidth: 2 }) })
|
|
260
|
-
]
|
|
261
|
-
},
|
|
262
|
-
o.value
|
|
263
|
-
);
|
|
264
|
-
});
|
|
147
|
+
const rowPadY = menuRowPadY(coarse, size);
|
|
148
|
+
const listStyleBase = { ...menuSurfaceStyle(size), ...menuListStyle };
|
|
149
|
+
const optionRows = options.map((o, i) => /* @__PURE__ */ jsx(
|
|
150
|
+
MenuOption,
|
|
151
|
+
{
|
|
152
|
+
id: `${rid}-opt-${i}`,
|
|
153
|
+
label: o.label,
|
|
154
|
+
selected: o.value === value,
|
|
155
|
+
active: i === activeIndex,
|
|
156
|
+
disabled: o.disabled,
|
|
157
|
+
coarse,
|
|
158
|
+
padY: rowPadY,
|
|
159
|
+
onPointerEnter: () => !o.disabled && setActiveIndex(i),
|
|
160
|
+
onClick: () => choose(i)
|
|
161
|
+
},
|
|
162
|
+
o.value
|
|
163
|
+
));
|
|
265
164
|
return /* @__PURE__ */ jsxs("div", { style: sx({ position: "relative", width: "100%" }), children: [
|
|
266
165
|
/* @__PURE__ */ jsxs(
|
|
267
166
|
"button",
|
package/dist/forms/Select.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/forms/Select.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { createPortal } from 'react-dom';\nimport { Check, ChevronDown } from 'lucide-react';\nimport { sx } from '../_internal/style';\nimport { acquireScrollLock } from '../_internal/scrollLock';\nimport { useIsoLayoutEffect } from '../_internal/useIsoLayoutEffect';\nimport { Field } from '../_internal/Field';\nimport { fieldA11y } from '../_internal/fieldA11y';\nimport { fieldBoxStyle } from './_internal/fieldBoxStyle';\n\nexport interface SelectOption {\n value: string;\n label: string;\n disabled?: boolean;\n}\n\n/**\n * Single-choice select - a hand-rolled listbox (token-styled, full keyboard\n * support) so it looks and behaves the same in every browser. On a mouse it's\n * an anchored dropdown; on touch it opens as a bottom sheet with finger-sized\n * rows.\n *\n * Value contract: `value` / `defaultValue` + `onValueChange(value)` - a plain\n * string, not a DOM event.\n */\nexport interface SelectProps {\n label?: string;\n hint?: string;\n /** Error message; also turns the control red. */\n error?: string;\n required?: boolean;\n options?: SelectOption[];\n /** Shown in muted text on the trigger when nothing is selected. */\n placeholder?: string;\n size?: 'sm' | 'md' | 'lg';\n disabled?: boolean;\n /** Controlled value. */\n value?: string;\n /** Uncontrolled initial value. */\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n /** Form field name - mirrored to a hidden input so the value can be submitted. */\n name?: string;\n id?: string;\n containerStyle?: React.CSSProperties;\n /**\n * Accessible name for the trigger. Only needed when there's no visible\n * `label` (e.g. a compact row where the context is already clear visually,\n * a day name next to a \"start time\" / \"end time\" pair): `Field` only\n * renders a `<label>` when `label` is set, so without either the trigger\n * has no accessible name at all. Takes precedence over `label` if both are\n * set - don't pass both.\n */\n 'aria-label'?: string;\n /** Reserve the hint/error row's height even with neither set - stops the\n * field from growing the moment a validation message appears. */\n preserveHelperSpace?: boolean;\n}\n\nconst OPTION_PAD_Y = { sm: 6, md: 8, lg: 10 } as const;\n\n/** True on touch / pen devices, where the native picker wins. SSR-safe. */\nfunction useCoarsePointer(): boolean {\n return React.useSyncExternalStore(\n (onChange) => {\n const mq = window.matchMedia('(pointer: coarse)');\n mq.addEventListener('change', onChange);\n return () => mq.removeEventListener('change', onChange);\n },\n () => window.matchMedia('(pointer: coarse)').matches,\n () => false,\n );\n}\n\n// ── Custom listbox ──────────────────────────────────────────────────────────\nfunction CustomSelect({\n rid,\n label,\n ariaLabel,\n options,\n value,\n placeholder,\n size,\n error,\n disabled,\n coarse,\n fieldAria,\n onCommit,\n}: {\n rid: string;\n /** The field label - shown as the sheet header on touch so the picker has context. */\n label?: string;\n /** Falls back to `label` when there's no visible one at all. */\n ariaLabel?: string;\n options: SelectOption[];\n value: string;\n placeholder?: string;\n size: NonNullable<SelectProps['size']>;\n error: boolean;\n disabled?: boolean;\n /** Touch: open as a bottom sheet with finger-sized rows instead of a dropdown. */\n coarse: boolean;\n /** `aria-invalid` / `aria-describedby` tying the trigger to the field's hint / error line. */\n fieldAria: ReturnType<typeof fieldA11y>;\n onCommit: (v: string) => void;\n}) {\n const listboxId = `${rid}-listbox`;\n const triggerRef = React.useRef<HTMLButtonElement>(null);\n const panelRef = React.useRef<HTMLUListElement>(null);\n const typeahead = React.useRef<{ str: string; timer: number }>({ str: '', timer: 0 });\n // A <label htmlFor> forwards a fully-trusted click to this button (detail:1),\n // indistinguishable from a direct one - but its *pointerdown* landed on the\n // label, not here. So only toggle when the press actually started on the box.\n const pressedAt = React.useRef(0);\n\n const [open, setOpen] = React.useState(false);\n const [activeIndex, setActiveIndex] = React.useState(-1);\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 // Two placement strategies, picked once per open:\n // • 'inline' - the common case. A plain `position: absolute` child of the\n // field wrapper. The browser glues it to the field through *any* scroll\n // (page or an inner overflow container) for free - zero JS, zero jitter,\n // never closes on scroll. Only re-flips the side if room runs out.\n // • 'fixed' - used when the field is inside a `position: fixed` container\n // (a Dialog), where an inline child would be clipped by the dialog's\n // overflow. Portalled to <body>, `position: fixed` at the trigger's\n // viewport rect. The dialog itself doesn't scroll, so it stays glued;\n // scrolling the dialog *body* detaches it, and we dismiss then.\n const [place, setPlace] = React.useState<\n | { strategy: 'inline'; above: boolean; maxH: number }\n | { strategy: 'fixed'; above: boolean; maxH: number; top: number; left: number; width: number }\n | null\n >(null);\n\n const selectedIndex = options.findIndex((o) => o.value === value);\n const selected = selectedIndex >= 0 ? options[selectedIndex] : undefined;\n\n const firstEnabled = () => options.findIndex((o) => !o.disabled);\n const lastEnabled = () => {\n for (let i = options.length - 1; i >= 0; i--) if (!options[i].disabled) return i;\n return -1;\n };\n const nextEnabled = (from: number, dir: 1 | -1) => {\n let i = from;\n for (let step = 0; step < options.length; step++) {\n i += dir;\n if (i < 0 || i >= options.length) return from;\n if (!options[i].disabled) return i;\n }\n return from;\n };\n\n useIsoLayoutEffect(() => {\n if (!open || coarse) return; // the touch sheet needs no anchoring\n const t = triggerRef.current;\n if (!t) return;\n\n const GAP = 6;\n // Non-zero fallback: if the viewport height is unreadable, assume room below\n // rather than flipping the menu up on a bad reading.\n const vh = window.innerHeight || document.documentElement.clientHeight || 900;\n const estH = Math.min(288, options.length * 36 + 8); // rough list height, no DOM\n const evalRoom = () => {\n const r = t.getBoundingClientRect();\n const roomBelow = vh - r.bottom - 8;\n const roomAbove = r.top - 8;\n const above = roomBelow < Math.min(estH, 200) && roomAbove > roomBelow;\n const maxH = Math.max(120, Math.min(288, Math.round((above ? roomAbove : roomBelow) - GAP)));\n return { r, above, maxH };\n };\n\n let fixed = false;\n for (let el: HTMLElement | null = t.parentElement; el && el !== document.body; el = el.parentElement) {\n if (getComputedStyle(el).position === 'fixed') {\n fixed = true;\n break;\n }\n }\n\n if (fixed) {\n const { r, above, maxH } = evalRoom();\n setPlace({ strategy: 'fixed', above, maxH, left: r.left, width: r.width, top: above ? r.top - GAP : r.bottom + GAP });\n const anchorTop = r.top;\n const onScroll = (e: Event) => {\n if (e.target instanceof Node && panelRef.current?.contains(e.target)) return;\n if (Math.abs(t.getBoundingClientRect().top - anchorTop) > 1) setOpen(false);\n };\n const onResize = () => setOpen(false);\n window.addEventListener('scroll', onScroll, true);\n window.addEventListener('resize', onResize);\n return () => {\n window.removeEventListener('scroll', onScroll, true);\n window.removeEventListener('resize', onResize);\n };\n }\n\n // Inline: the menu is a plain absolute child, glued for free. Never reposition\n // or close on scroll - only re-flip the side (rare) and re-cap height on\n // resize.\n const applyFull = () => {\n const { above, maxH } = evalRoom();\n setPlace((prev) =>\n prev?.strategy === 'inline' && prev.above === above && prev.maxH === maxH ? prev : { strategy: 'inline', above, maxH },\n );\n };\n applyFull();\n const onScroll = (e: Event) => {\n if (e.target instanceof Node && panelRef.current?.contains(e.target)) return;\n const { above } = evalRoom();\n setPlace((prev) => (prev?.strategy === 'inline' && prev.above !== above ? { ...prev, above } : prev));\n };\n window.addEventListener('scroll', onScroll, true);\n window.addEventListener('resize', applyFull);\n return () => {\n window.removeEventListener('scroll', onScroll, true);\n window.removeEventListener('resize', applyFull);\n };\n }, [open, coarse, options.length]);\n\n // Close on outside pointerdown (the touch sheet uses its own scrim instead).\n React.useEffect(() => {\n if (!open || coarse) return;\n const onDown = (e: PointerEvent) => {\n const target = e.target as Node;\n if (triggerRef.current?.contains(target) || panelRef.current?.contains(target)) return;\n setOpen(false);\n };\n document.addEventListener('pointerdown', onDown, true);\n return () => document.removeEventListener('pointerdown', onDown, true);\n }, [open, coarse]);\n\n // The touch sheet is a modal surface - lock the page scroll behind it. Through the shared lock,\n // so a Select inside a Dialog (two held at once) frees the page whichever lets go first.\n React.useEffect(() => {\n if (!open || !coarse) return;\n return acquireScrollLock();\n }, [open, coarse]);\n\n // Keep the active option in view: once the list exists, and again whenever the active option itself\n // changes (the keyboard, the pointer). On the desktop the list is only rendered after `place` is known\n // (one render after the open), so on the first open there is nothing to scroll in the commit where\n // `open` turns true; `place` is in the deps so this runs again the moment the list is there (SS-568).\n // It is a layout effect so the list is already on the option when it is first painted, not at the top\n // for a frame. `revealedIndex` makes it once per option: a list the app pages from the server grows\n // while it is open (`options.length`, and so `place` in the portalled case, change with every page),\n // and a user who scrolled down to ask for the next page must not be pulled back to the active option.\n const revealedIndex = React.useRef<number | null>(null);\n useIsoLayoutEffect(() => {\n if (!open) {\n revealedIndex.current = null;\n return;\n }\n if (activeIndex < 0 || activeIndex === revealedIndex.current) return;\n const el = document.getElementById(`${rid}-opt-${activeIndex}`);\n if (!el) return; // the list is not rendered yet; `place` arriving runs this again\n revealedIndex.current = activeIndex;\n el.scrollIntoView({ block: 'nearest' });\n }, [open, activeIndex, rid, place]);\n\n const openMenu = () => {\n if (disabled) return;\n setActiveIndex(selectedIndex >= 0 ? selectedIndex : firstEnabled());\n setOpen(true);\n };\n const closeMenu = (refocus = true) => {\n setOpen(false);\n if (refocus) triggerRef.current?.focus({ preventScroll: true });\n };\n const choose = (i: number) => {\n const o = options[i];\n if (!o || o.disabled) return;\n onCommit(o.value);\n closeMenu();\n };\n\n const onKeyDown = (e: React.KeyboardEvent) => {\n if (disabled) return;\n switch (e.key) {\n case 'ArrowDown':\n e.preventDefault();\n if (!open) return openMenu();\n setActiveIndex((i) => nextEnabled(i < 0 ? -1 : i, 1));\n return;\n case 'ArrowUp':\n e.preventDefault();\n if (!open) return openMenu();\n setActiveIndex((i) => nextEnabled(i < 0 ? options.length : i, -1));\n return;\n case 'Home':\n if (open) {\n e.preventDefault();\n setActiveIndex(firstEnabled());\n }\n return;\n case 'End':\n if (open) {\n e.preventDefault();\n setActiveIndex(lastEnabled());\n }\n return;\n case 'Enter':\n case ' ':\n e.preventDefault();\n if (!open) return openMenu();\n choose(activeIndex);\n return;\n case 'Escape':\n if (open) {\n e.preventDefault();\n closeMenu();\n }\n return;\n case 'Tab':\n if (open) setOpen(false);\n return;\n default:\n if (e.key.length === 1 && !e.metaKey && !e.ctrlKey && !e.altKey) {\n const ta = typeahead.current;\n ta.str += e.key.toLowerCase();\n window.clearTimeout(ta.timer);\n ta.timer = window.setTimeout(() => (ta.str = ''), 500);\n const match = options.findIndex((o) => !o.disabled && o.label.toLowerCase().startsWith(ta.str));\n if (match >= 0) {\n if (!open) openMenu();\n setActiveIndex(match);\n }\n }\n }\n };\n\n const hasValue = !!selected;\n const rowPadY = coarse ? 12 : OPTION_PAD_Y[size];\n\n const listStyleBase: React.CSSProperties = {\n minWidth: 160,\n overflowY: 'auto',\n margin: 0,\n padding: 'var(--space-1)',\n listStyle: 'none',\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 fontFamily: 'var(--font-body)',\n fontSize: size === 'sm' ? 'var(--text-sm)' : 'var(--text-base)',\n };\n const optionRows = options.map((o, i) => {\n const isSelected = o.value === value;\n const isActive = i === activeIndex;\n return (\n <li\n key={o.value}\n id={`${rid}-opt-${i}`}\n role=\"option\"\n aria-selected={isSelected}\n aria-disabled={o.disabled || undefined}\n onPointerEnter={() => !o.disabled && setActiveIndex(i)}\n onClick={() => choose(i)}\n style={sx({\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n gap: 'var(--space-2)',\n minHeight: coarse ? 44 : undefined,\n padding: `${rowPadY}px var(--space-3)`,\n borderRadius: 'var(--radius-sm)',\n cursor: o.disabled ? 'not-allowed' : 'pointer',\n color: o.disabled ? 'var(--text-disabled)' : 'var(--text-primary)',\n background: isActive && !o.disabled ? 'var(--bg-subtle)' : 'transparent',\n fontWeight: isSelected ? 'var(--weight-semibold)' : 'var(--weight-regular)',\n fontSize: coarse ? 'var(--text-base)' : undefined,\n })}\n >\n <span style={sx({ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' })}>{o.label}</span>\n {isSelected && (\n <span style={sx({ display: 'flex', flex: '0 0 auto', color: 'var(--text-brand)' })}>\n <Check size={coarse ? 18 : 16} strokeWidth={2} />\n </span>\n )}\n </li>\n );\n });\n\n return (\n <div style={sx({ position: 'relative', width: '100%' })}>\n <button\n ref={triggerRef}\n type=\"button\"\n id={rid}\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n aria-expanded={open}\n aria-controls={open ? listboxId : undefined}\n aria-activedescendant={open && activeIndex >= 0 ? `${rid}-opt-${activeIndex}` : undefined}\n aria-label={ariaLabel}\n {...fieldAria}\n aria-disabled={disabled || undefined}\n disabled={disabled}\n onPointerDown={() => {\n pressedAt.current = Date.now();\n }}\n onMouseDown={(e) => {\n // Take focus without the browser scrolling us into view.\n e.preventDefault();\n triggerRef.current?.focus({ preventScroll: true });\n }}\n onClick={() => {\n // Only toggle when the press started on this button - a click forwarded\n // from the field <label>, or synthesised by the keyboard, never set\n // pressedAt (keyboard is handled in onKeyDown).\n if (Date.now() - pressedAt.current > 500) return;\n pressedAt.current = 0;\n if (open) closeMenu(false);\n else openMenu();\n }}\n onKeyDown={onKeyDown}\n style={fieldBoxStyle(size, error, open, !!disabled)}\n >\n <span\n style={sx({\n flex: 1,\n minWidth: 0,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n color: hasValue ? 'inherit' : 'var(--text-muted)',\n })}\n >\n {hasValue ? selected!.label : placeholder ?? 'Select…'}\n </span>\n <span\n aria-hidden=\"true\"\n style={sx({\n display: 'flex',\n flex: '0 0 auto',\n color: 'var(--text-muted)',\n transition: 'transform var(--duration-fast) var(--ease-standard)',\n transform: open ? 'rotate(180deg)' : 'none',\n })}\n >\n <ChevronDown size={16} strokeWidth={1.75} />\n </span>\n </button>\n\n {open && mounted && coarse &&\n createPortal(\n <div\n role=\"presentation\"\n onClick={() => closeMenu()}\n style={sx({\n position: 'fixed',\n inset: 0,\n zIndex: 1100,\n display: 'flex',\n alignItems: 'flex-end',\n background: 'var(--bg-overlay)',\n backdropFilter: 'blur(2px)',\n animation: 'sereno-fade-in var(--duration-fast) var(--ease-standard)',\n })}\n >\n <div\n onClick={(e) => e.stopPropagation()}\n style={sx({\n width: '100%',\n maxHeight: '70dvh',\n display: 'flex',\n flexDirection: 'column',\n background: 'var(--bg-surface)',\n borderRadius: 'var(--radius-sheet) var(--radius-sheet) 0 0',\n boxShadow: 'var(--shadow-sheet)',\n paddingBottom: 'env(safe-area-inset-bottom)',\n animation: 'sereno-slide-up var(--duration-sheet) var(--ease-gentle)',\n })}\n >\n {label && (\n <div\n style={sx({\n flex: '0 0 auto',\n padding: 'var(--space-3) var(--space-4)',\n borderBottom: 'var(--border-width-hairline) solid var(--border-subtle)',\n fontFamily: 'var(--font-body)',\n fontSize: 'var(--text-base)',\n fontWeight: 'var(--weight-semibold)',\n letterSpacing: 'var(--tracking-snug)',\n color: 'var(--text-primary)',\n })}\n >\n {label}\n </div>\n )}\n <ul\n ref={panelRef}\n id={listboxId}\n role=\"listbox\"\n aria-label={label}\n tabIndex={-1}\n style={sx({\n ...listStyleBase,\n flex: '1 1 auto',\n minHeight: 0,\n border: 'none',\n borderRadius: 0,\n boxShadow: 'none',\n background: 'transparent',\n padding: 'var(--space-2)',\n overscrollBehavior: 'contain', // don't chain the list's scroll to the page\n })}\n >\n {optionRows}\n </ul>\n </div>\n </div>,\n document.body,\n )}\n {open && !coarse && place && place.strategy === 'inline' && (\n <ul\n ref={panelRef}\n id={listboxId}\n role=\"listbox\"\n tabIndex={-1}\n style={sx({\n ...listStyleBase,\n position: 'absolute',\n left: 0,\n right: 0,\n ...(place.above ? { bottom: 'calc(100% + 6px)' } : { top: 'calc(100% + 6px)' }),\n maxHeight: place.maxH,\n zIndex: 100,\n })}\n >\n {optionRows}\n </ul>\n )}\n {open && !coarse && mounted && place && place.strategy === 'fixed' &&\n createPortal(\n <ul\n ref={panelRef}\n id={listboxId}\n role=\"listbox\"\n tabIndex={-1}\n style={sx({\n ...listStyleBase,\n position: 'fixed',\n top: place.top,\n left: place.left,\n width: place.width,\n ...(place.above ? { transform: 'translateY(-100%)' } : null),\n maxHeight: place.maxH,\n zIndex: 1100,\n })}\n >\n {optionRows}\n </ul>,\n document.body,\n )}\n </div>\n );\n}\n\n/**\n * `ref` reaches the hidden `<input type=\"hidden\">` that mirrors the selected\n * value (rendered only when `name` is set - pass it, as `register()` does).\n * Enough for `getValues()` / `trigger()` / `setFocus()`, but a plain\n * `{...register(name)}` spread still won't validate on change: this hidden\n * input never dispatches a native `input`/`change` event, and `onValueChange`\n * hands back a plain string, not a `ChangeEvent` - wire it through\n * `Controller`, or call the registered `onChange` yourself from\n * `onValueChange`.\n */\nexport const Select = React.forwardRef<HTMLInputElement, SelectProps>(function Select({\n label,\n hint,\n error,\n required,\n options = [],\n placeholder,\n size = 'md',\n disabled,\n value: valueProp,\n defaultValue,\n onValueChange,\n name,\n id,\n containerStyle,\n 'aria-label': ariaLabel,\n preserveHelperSpace,\n}: SelectProps, ref) {\n const reactId = React.useId();\n const rid = id || reactId;\n const isControlled = valueProp !== undefined;\n const [internalValue, setInternalValue] = React.useState(defaultValue ?? '');\n const value = isControlled ? valueProp! : internalValue;\n const coarse = useCoarsePointer();\n\n const commit = React.useCallback(\n (v: string) => {\n if (!isControlled) setInternalValue(v);\n onValueChange?.(v);\n },\n [isControlled, onValueChange],\n );\n\n return (\n <Field label={label} hint={hint} error={error} required={required} requiredExposed htmlFor={rid} style={containerStyle} preserveHelperSpace={preserveHelperSpace}>\n <CustomSelect\n rid={rid}\n label={label}\n ariaLabel={ariaLabel}\n options={options}\n value={value}\n placeholder={placeholder}\n size={size}\n error={!!error}\n disabled={disabled}\n coarse={coarse}\n fieldAria={fieldA11y(rid, { hint, error, required })}\n onCommit={commit}\n />\n {name && <input ref={ref} type=\"hidden\" name={name} value={value} />}\n </Field>\n );\n});\n\nSelect.displayName = 'Select';\n"],"mappings":";AAkWM,SAuBE,KAvBF;AAhWN,YAAY,WAAW;AACvB,SAAS,oBAAoB;AAC7B,SAAS,OAAO,mBAAmB;AACnC,SAAS,UAAU;AACnB,SAAS,yBAAyB;AAClC,SAAS,0BAA0B;AACnC,SAAS,aAAa;AACtB,SAAS,iBAAiB;AAC1B,SAAS,qBAAqB;AAmD9B,MAAM,eAAe,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG;AAG5C,SAAS,mBAA4B;AACnC,SAAO,MAAM;AAAA,IACX,CAAC,aAAa;AACZ,YAAM,KAAK,OAAO,WAAW,mBAAmB;AAChD,SAAG,iBAAiB,UAAU,QAAQ;AACtC,aAAO,MAAM,GAAG,oBAAoB,UAAU,QAAQ;AAAA,IACxD;AAAA,IACA,MAAM,OAAO,WAAW,mBAAmB,EAAE;AAAA,IAC7C,MAAM;AAAA,EACR;AACF;AAGA,SAAS,aAAa;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAiBG;AACD,QAAM,YAAY,GAAG,GAAG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ACA,CAAC,cAAc,aAAa;AAAA,EAC9B;AAEA,SACE,qBAAC,SAAM,OAAc,MAAY,OAAc,UAAoB,iBAAe,MAAC,SAAS,KAAK,OAAO,gBAAgB,qBACtH;AAAA;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,OAAO,CAAC,CAAC;AAAA,QACT;AAAA,QACA;AAAA,QACA,WAAW,UAAU,KAAK,EAAE,MAAM,OAAO,SAAS,CAAC;AAAA,QACnD,UAAU;AAAA;AAAA,IACZ;AAAA,IACC,QAAQ,oBAAC,WAAM,KAAU,MAAK,UAAS,MAAY,OAAc;AAAA,KACpE;AAEJ,CAAC;AAED,OAAO,cAAc;","names":["onScroll","Select"]}
|
|
1
|
+
{"version":3,"sources":["../../src/forms/Select.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { createPortal } from 'react-dom';\nimport { ChevronDown } from 'lucide-react';\nimport { sx } from '../_internal/style';\nimport { acquireScrollLock } from '../_internal/scrollLock';\nimport { useCoarsePointer } from '../_internal/useCoarsePointer';\nimport { useMenuPlacement } from '../_internal/useMenuPlacement';\nimport { useRevealActive } from '../_internal/useRevealActive';\nimport { MenuOption, menuListStyle, menuRowPadY, menuSurfaceStyle } from '../_internal/MenuOption';\nimport { Field } from '../_internal/Field';\nimport { fieldA11y } from '../_internal/fieldA11y';\nimport { fieldBoxStyle } from './_internal/fieldBoxStyle';\n\nexport interface SelectOption {\n value: string;\n label: string;\n disabled?: boolean;\n}\n\n/**\n * Single-choice select - a hand-rolled listbox (token-styled, full keyboard\n * support) so it looks and behaves the same in every browser. On a mouse it's\n * an anchored dropdown; on touch it opens as a bottom sheet with finger-sized\n * rows.\n *\n * Value contract: `value` / `defaultValue` + `onValueChange(value)` - a plain\n * string, not a DOM event.\n */\nexport interface SelectProps {\n label?: string;\n hint?: string;\n /** Error message; also turns the control red. */\n error?: string;\n required?: boolean;\n options?: SelectOption[];\n /** Shown in muted text on the trigger when nothing is selected. */\n placeholder?: string;\n size?: 'sm' | 'md' | 'lg';\n disabled?: boolean;\n /** Controlled value. */\n value?: string;\n /** Uncontrolled initial value. */\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n /** Form field name - mirrored to a hidden input so the value can be submitted. */\n name?: string;\n id?: string;\n containerStyle?: React.CSSProperties;\n /**\n * Accessible name for the trigger. Only needed when there's no visible\n * `label` (e.g. a compact row where the context is already clear visually,\n * a day name next to a \"start time\" / \"end time\" pair): `Field` only\n * renders a `<label>` when `label` is set, so without either the trigger\n * has no accessible name at all. Takes precedence over `label` if both are\n * set - don't pass both.\n */\n 'aria-label'?: string;\n /** Reserve the hint/error row's height even with neither set - stops the\n * field from growing the moment a validation message appears. */\n preserveHelperSpace?: boolean;\n}\n\n// ── Custom listbox ──────────────────────────────────────────────────────────\nfunction CustomSelect({\n rid,\n label,\n ariaLabel,\n options,\n value,\n placeholder,\n size,\n error,\n disabled,\n coarse,\n fieldAria,\n onCommit,\n}: {\n rid: string;\n /** The field label - shown as the sheet header on touch so the picker has context. */\n label?: string;\n /** Falls back to `label` when there's no visible one at all. */\n ariaLabel?: string;\n options: SelectOption[];\n value: string;\n placeholder?: string;\n size: NonNullable<SelectProps['size']>;\n error: boolean;\n disabled?: boolean;\n /** Touch: open as a bottom sheet with finger-sized rows instead of a dropdown. */\n coarse: boolean;\n /** `aria-invalid` / `aria-describedby` tying the trigger to the field's hint / error line. */\n fieldAria: ReturnType<typeof fieldA11y>;\n onCommit: (v: string) => void;\n}) {\n const listboxId = `${rid}-listbox`;\n const triggerRef = React.useRef<HTMLButtonElement>(null);\n const panelRef = React.useRef<HTMLUListElement>(null);\n const typeahead = React.useRef<{ str: string; timer: number }>({ str: '', timer: 0 });\n // A <label htmlFor> forwards a fully-trusted click to this button (detail:1),\n // indistinguishable from a direct one - but its *pointerdown* landed on the\n // label, not here. So only toggle when the press actually started on the box.\n const pressedAt = React.useRef(0);\n\n const [open, setOpen] = React.useState(false);\n const [activeIndex, setActiveIndex] = React.useState(-1);\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 // Where the dropdown sits (inline under the field, or portalled to the body inside a Dialog): see\n // `useMenuPlacement`. The touch sheet needs no anchoring.\n const place = useMenuPlacement({\n open,\n disabled: coarse,\n anchorRef: triggerRef,\n panelRef,\n itemCount: options.length,\n onDismiss: () => setOpen(false),\n });\n\n const selectedIndex = options.findIndex((o) => o.value === value);\n const selected = selectedIndex >= 0 ? options[selectedIndex] : undefined;\n\n const firstEnabled = () => options.findIndex((o) => !o.disabled);\n const lastEnabled = () => {\n for (let i = options.length - 1; i >= 0; i--) if (!options[i].disabled) return i;\n return -1;\n };\n const nextEnabled = (from: number, dir: 1 | -1) => {\n let i = from;\n for (let step = 0; step < options.length; step++) {\n i += dir;\n if (i < 0 || i >= options.length) return from;\n if (!options[i].disabled) return i;\n }\n return from;\n };\n\n // Close on outside pointerdown (the touch sheet uses its own scrim instead).\n React.useEffect(() => {\n if (!open || coarse) return;\n const onDown = (e: PointerEvent) => {\n const target = e.target as Node;\n if (triggerRef.current?.contains(target) || panelRef.current?.contains(target)) return;\n setOpen(false);\n };\n document.addEventListener('pointerdown', onDown, true);\n return () => document.removeEventListener('pointerdown', onDown, true);\n }, [open, coarse]);\n\n // The touch sheet is a modal surface - lock the page scroll behind it. Through the shared lock,\n // so a Select inside a Dialog (two held at once) frees the page whichever lets go first.\n React.useEffect(() => {\n if (!open || !coarse) return;\n return acquireScrollLock();\n }, [open, coarse]);\n\n // Keep the active option in view, the first time the list opens too (SS-568): see `useRevealActive`.\n useRevealActive(open, activeIndex >= 0 ? `${rid}-opt-${activeIndex}` : null, place);\n\n const openMenu = () => {\n if (disabled) return;\n setActiveIndex(selectedIndex >= 0 ? selectedIndex : firstEnabled());\n setOpen(true);\n };\n const closeMenu = (refocus = true) => {\n setOpen(false);\n if (refocus) triggerRef.current?.focus({ preventScroll: true });\n };\n const choose = (i: number) => {\n const o = options[i];\n if (!o || o.disabled) return;\n onCommit(o.value);\n closeMenu();\n };\n\n const onKeyDown = (e: React.KeyboardEvent) => {\n if (disabled) return;\n switch (e.key) {\n case 'ArrowDown':\n e.preventDefault();\n if (!open) return openMenu();\n setActiveIndex((i) => nextEnabled(i < 0 ? -1 : i, 1));\n return;\n case 'ArrowUp':\n e.preventDefault();\n if (!open) return openMenu();\n setActiveIndex((i) => nextEnabled(i < 0 ? options.length : i, -1));\n return;\n case 'Home':\n if (open) {\n e.preventDefault();\n setActiveIndex(firstEnabled());\n }\n return;\n case 'End':\n if (open) {\n e.preventDefault();\n setActiveIndex(lastEnabled());\n }\n return;\n case 'Enter':\n case ' ':\n e.preventDefault();\n if (!open) return openMenu();\n choose(activeIndex);\n return;\n case 'Escape':\n if (open) {\n e.preventDefault();\n closeMenu();\n }\n return;\n case 'Tab':\n if (open) setOpen(false);\n return;\n default:\n if (e.key.length === 1 && !e.metaKey && !e.ctrlKey && !e.altKey) {\n const ta = typeahead.current;\n ta.str += e.key.toLowerCase();\n window.clearTimeout(ta.timer);\n ta.timer = window.setTimeout(() => (ta.str = ''), 500);\n const match = options.findIndex((o) => !o.disabled && o.label.toLowerCase().startsWith(ta.str));\n if (match >= 0) {\n if (!open) openMenu();\n setActiveIndex(match);\n }\n }\n }\n };\n\n const hasValue = !!selected;\n const rowPadY = menuRowPadY(coarse, size);\n\n const listStyleBase: React.CSSProperties = { ...menuSurfaceStyle(size), ...menuListStyle };\n const optionRows = options.map((o, i) => (\n <MenuOption\n key={o.value}\n id={`${rid}-opt-${i}`}\n label={o.label}\n selected={o.value === value}\n active={i === activeIndex}\n disabled={o.disabled}\n coarse={coarse}\n padY={rowPadY}\n onPointerEnter={() => !o.disabled && setActiveIndex(i)}\n onClick={() => choose(i)}\n />\n ));\n\n return (\n <div style={sx({ position: 'relative', width: '100%' })}>\n <button\n ref={triggerRef}\n type=\"button\"\n id={rid}\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n aria-expanded={open}\n aria-controls={open ? listboxId : undefined}\n aria-activedescendant={open && activeIndex >= 0 ? `${rid}-opt-${activeIndex}` : undefined}\n aria-label={ariaLabel}\n {...fieldAria}\n aria-disabled={disabled || undefined}\n disabled={disabled}\n onPointerDown={() => {\n pressedAt.current = Date.now();\n }}\n onMouseDown={(e) => {\n // Take focus without the browser scrolling us into view.\n e.preventDefault();\n triggerRef.current?.focus({ preventScroll: true });\n }}\n onClick={() => {\n // Only toggle when the press started on this button - a click forwarded\n // from the field <label>, or synthesised by the keyboard, never set\n // pressedAt (keyboard is handled in onKeyDown).\n if (Date.now() - pressedAt.current > 500) return;\n pressedAt.current = 0;\n if (open) closeMenu(false);\n else openMenu();\n }}\n onKeyDown={onKeyDown}\n style={fieldBoxStyle(size, error, open, !!disabled)}\n >\n <span\n style={sx({\n flex: 1,\n minWidth: 0,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n color: hasValue ? 'inherit' : 'var(--text-muted)',\n })}\n >\n {hasValue ? selected!.label : placeholder ?? 'Select…'}\n </span>\n <span\n aria-hidden=\"true\"\n style={sx({\n display: 'flex',\n flex: '0 0 auto',\n color: 'var(--text-muted)',\n transition: 'transform var(--duration-fast) var(--ease-standard)',\n transform: open ? 'rotate(180deg)' : 'none',\n })}\n >\n <ChevronDown size={16} strokeWidth={1.75} />\n </span>\n </button>\n\n {open && mounted && coarse &&\n createPortal(\n <div\n role=\"presentation\"\n onClick={() => closeMenu()}\n style={sx({\n position: 'fixed',\n inset: 0,\n zIndex: 1100,\n display: 'flex',\n alignItems: 'flex-end',\n background: 'var(--bg-overlay)',\n backdropFilter: 'blur(2px)',\n animation: 'sereno-fade-in var(--duration-fast) var(--ease-standard)',\n })}\n >\n <div\n onClick={(e) => e.stopPropagation()}\n style={sx({\n width: '100%',\n maxHeight: '70dvh',\n display: 'flex',\n flexDirection: 'column',\n background: 'var(--bg-surface)',\n borderRadius: 'var(--radius-sheet) var(--radius-sheet) 0 0',\n boxShadow: 'var(--shadow-sheet)',\n paddingBottom: 'env(safe-area-inset-bottom)',\n animation: 'sereno-slide-up var(--duration-sheet) var(--ease-gentle)',\n })}\n >\n {label && (\n <div\n style={sx({\n flex: '0 0 auto',\n padding: 'var(--space-3) var(--space-4)',\n borderBottom: 'var(--border-width-hairline) solid var(--border-subtle)',\n fontFamily: 'var(--font-body)',\n fontSize: 'var(--text-base)',\n fontWeight: 'var(--weight-semibold)',\n letterSpacing: 'var(--tracking-snug)',\n color: 'var(--text-primary)',\n })}\n >\n {label}\n </div>\n )}\n <ul\n ref={panelRef}\n id={listboxId}\n role=\"listbox\"\n aria-label={label}\n tabIndex={-1}\n style={sx({\n ...listStyleBase,\n flex: '1 1 auto',\n minHeight: 0,\n border: 'none',\n borderRadius: 0,\n boxShadow: 'none',\n background: 'transparent',\n padding: 'var(--space-2)',\n overscrollBehavior: 'contain', // don't chain the list's scroll to the page\n })}\n >\n {optionRows}\n </ul>\n </div>\n </div>,\n document.body,\n )}\n {open && !coarse && place && place.strategy === 'inline' && (\n <ul\n ref={panelRef}\n id={listboxId}\n role=\"listbox\"\n tabIndex={-1}\n style={sx({\n ...listStyleBase,\n position: 'absolute',\n left: 0,\n right: 0,\n ...(place.above ? { bottom: 'calc(100% + 6px)' } : { top: 'calc(100% + 6px)' }),\n maxHeight: place.maxH,\n zIndex: 100,\n })}\n >\n {optionRows}\n </ul>\n )}\n {open && !coarse && mounted && place && place.strategy === 'fixed' &&\n createPortal(\n <ul\n ref={panelRef}\n id={listboxId}\n role=\"listbox\"\n tabIndex={-1}\n style={sx({\n ...listStyleBase,\n position: 'fixed',\n top: place.top,\n left: place.left,\n width: place.width,\n ...(place.above ? { transform: 'translateY(-100%)' } : null),\n maxHeight: place.maxH,\n zIndex: 1100,\n })}\n >\n {optionRows}\n </ul>,\n document.body,\n )}\n </div>\n );\n}\n\n/**\n * `ref` reaches the hidden `<input type=\"hidden\">` that mirrors the selected\n * value (rendered only when `name` is set - pass it, as `register()` does).\n * Enough for `getValues()` / `trigger()` / `setFocus()`, but a plain\n * `{...register(name)}` spread still won't validate on change: this hidden\n * input never dispatches a native `input`/`change` event, and `onValueChange`\n * hands back a plain string, not a `ChangeEvent` - wire it through\n * `Controller`, or call the registered `onChange` yourself from\n * `onValueChange`.\n */\nexport const Select = React.forwardRef<HTMLInputElement, SelectProps>(function Select({\n label,\n hint,\n error,\n required,\n options = [],\n placeholder,\n size = 'md',\n disabled,\n value: valueProp,\n defaultValue,\n onValueChange,\n name,\n id,\n containerStyle,\n 'aria-label': ariaLabel,\n preserveHelperSpace,\n}: SelectProps, ref) {\n const reactId = React.useId();\n const rid = id || reactId;\n const isControlled = valueProp !== undefined;\n const [internalValue, setInternalValue] = React.useState(defaultValue ?? '');\n const value = isControlled ? valueProp! : internalValue;\n const coarse = useCoarsePointer();\n\n const commit = React.useCallback(\n (v: string) => {\n if (!isControlled) setInternalValue(v);\n onValueChange?.(v);\n },\n [isControlled, onValueChange],\n );\n\n return (\n <Field label={label} hint={hint} error={error} required={required} requiredExposed htmlFor={rid} style={containerStyle} preserveHelperSpace={preserveHelperSpace}>\n <CustomSelect\n rid={rid}\n label={label}\n ariaLabel={ariaLabel}\n options={options}\n value={value}\n placeholder={placeholder}\n size={size}\n error={!!error}\n disabled={disabled}\n coarse={coarse}\n fieldAria={fieldA11y(rid, { hint, error, required })}\n onCommit={commit}\n />\n {name && <input ref={ref} type=\"hidden\" name={name} value={value} />}\n </Field>\n );\n});\n\nSelect.displayName = 'Select';\n"],"mappings":";AA6OI,cAgBE,YAhBF;AA3OJ,YAAY,WAAW;AACvB,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAC5B,SAAS,UAAU;AACnB,SAAS,yBAAyB;AAClC,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAChC,SAAS,YAAY,eAAe,aAAa,wBAAwB;AACzE,SAAS,aAAa;AACtB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pE;AAEJ,CAAC;AAED,OAAO,cAAc;","names":["Select"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export { CellProps, HeaderCellProps, SortDirection, Table, TableProps, TableRowP
|
|
|
14
14
|
export { Input, InputProps } from './forms/Input.js';
|
|
15
15
|
export { Textarea, TextareaProps } from './forms/Textarea.js';
|
|
16
16
|
export { Select, SelectOption, SelectProps } from './forms/Select.js';
|
|
17
|
+
export { Autocomplete, AutocompleteLabels, AutocompleteOption, AutocompleteProps } from './forms/Autocomplete.js';
|
|
17
18
|
export { Checkbox, CheckboxProps } from './forms/Checkbox.js';
|
|
18
19
|
export { Radio, RadioProps } from './forms/Radio.js';
|
|
19
20
|
export { Switch, SwitchProps } from './forms/Switch.js';
|
package/dist/index.js
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
import { Input } from "./forms/Input.js";
|
|
17
17
|
import { Textarea } from "./forms/Textarea.js";
|
|
18
18
|
import { Select } from "./forms/Select.js";
|
|
19
|
+
import { Autocomplete } from "./forms/Autocomplete.js";
|
|
19
20
|
import { Checkbox } from "./forms/Checkbox.js";
|
|
20
21
|
import { Radio } from "./forms/Radio.js";
|
|
21
22
|
import { Switch } from "./forms/Switch.js";
|
|
@@ -49,6 +50,7 @@ import { ThemeToggle } from "./theme/ThemeToggle.js";
|
|
|
49
50
|
export {
|
|
50
51
|
ActionCard,
|
|
51
52
|
Alert,
|
|
53
|
+
Autocomplete,
|
|
52
54
|
Avatar,
|
|
53
55
|
AvatarUpload,
|
|
54
56
|
Badge,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Sereno Design System - public component surface. See the /design-system\n// showcase for the live catalog, or the barrel smoke test for the full list.\n// Icons are passed in as props (lucide-react), never imported here; theming is\n// 100% CSS custom properties.\n\n// core\nexport { Typography, type TypographyProps, type TypographyVariant, type TypographyColor } from './core/Typography';\nexport { Button, type ButtonProps } from './core/Button';\nexport { IconButton, type IconButtonProps } from './core/IconButton';\nexport { Badge, type BadgeProps } from './core/Badge';\nexport { StatusDot, type StatusDotProps, type StatusDotTone, type StatusDotSize } from './core/StatusDot';\nexport { Divider, type DividerProps } from './core/Divider';\nexport { Card, type CardProps } from './core/Card';\nexport { ActionCard, type ActionCardProps, type ActionCardVariant } from './core/ActionCard';\nexport { StatCard, type StatCardProps, type StatCardTone } from './core/StatCard';\nexport { Avatar, type AvatarProps } from './core/Avatar';\nexport { Brand, type BrandProps } from './core/Brand';\nexport { Menu, type MenuProps, type MenuItem, type MenuEntry, type MenuSeparator, type MenuHeading } from './core/Menu';\nexport {\n Table,\n type TableProps,\n type TableRowProps,\n type HeaderCellProps,\n type CellProps,\n type TableSort,\n type SortDirection,\n} from './core/Table';\n\n// forms\nexport { Input, type InputProps } from './forms/Input';\nexport { Textarea, type TextareaProps } from './forms/Textarea';\nexport { Select, type SelectProps, type SelectOption } from './forms/Select';\nexport { Checkbox, type CheckboxProps } from './forms/Checkbox';\nexport { Radio, type RadioProps } from './forms/Radio';\nexport { Switch, type SwitchProps } from './forms/Switch';\nexport {\n DateTimePicker,\n type DateTimePickerProps,\n type TimeSlot,\n type CalendarDayContext,\n type CalendarDayDot,\n type CalendarDayDots,\n type CalendarDotTone,\n} from './forms/DateTimePicker';\nexport { CalendarLegend, type CalendarLegendProps, type CalendarLegendItem } from './forms/CalendarLegend';\nexport { DatePicker, type DatePickerProps, type DatePickerHandle } from './forms/DatePicker';\nexport { FileUpload, type FileUploadProps } from './forms/FileUpload';\nexport { AvatarUpload, type AvatarUploadProps } from './forms/AvatarUpload';\nexport { SearchInput, type SearchInputProps } from './forms/SearchInput';\n\n// navigation\nexport { TopBar, type TopBarProps, type TopBarLeadingProps, type TopBarTitleProps, type TopBarActionsProps } from './navigation/TopBar';\nexport { Tabs, type TabsProps, type TabsListProps, type TabsTabProps, type TabsPanelProps } from './navigation/Tabs';\nexport { BottomNav, type BottomNavProps, type BottomNavItemProps } from './navigation/BottomNav';\nexport {\n SidebarNav,\n type SidebarNavProps,\n type SidebarNavSectionProps,\n type SidebarNavItemProps,\n type SidebarNavSubItemProps,\n} from './navigation/SidebarNav';\nexport { Stepper, type StepperProps, type StepperStepProps } from './navigation/Stepper';\nexport { Pagination, type PaginationProps, type PaginationLabels } from './navigation/Pagination';\n\n// feedback\nexport { Alert, type AlertProps } from './feedback/Alert';\nexport { Toast, type ToastProps } from './feedback/Toast';\nexport {\n ToastProvider,\n useToast,\n type ToastProviderProps,\n type ToastOptions,\n type ToastApi,\n type ToastContextValue,\n type ToastPosition,\n} from './feedback/ToastProvider';\nexport { Dialog, type DialogProps, type DialogHeaderProps, type DialogBodyProps, type DialogFooterProps } from './feedback/Dialog';\nexport { Skeleton, type SkeletonProps } from './feedback/Skeleton';\nexport { EmptyState, type EmptyStateProps } from './feedback/EmptyState';\n\n// theme - the `data-theme` provider (next-themes) + the light/dark toggle\nexport { ThemeProvider } from './theme/ThemeProvider';\nexport { ThemeToggle } from './theme/ThemeToggle';\n"],"mappings":"AAMA,SAAS,kBAAsF;AAC/F,SAAS,cAAgC;AACzC,SAAS,kBAAwC;AACjD,SAAS,aAA8B;AACvC,SAAS,iBAA8E;AACvF,SAAS,eAAkC;AAC3C,SAAS,YAA4B;AACrC,SAAS,kBAAgE;AACzE,SAAS,gBAAuD;AAChE,SAAS,cAAgC;AACzC,SAAS,aAA8B;AACvC,SAAS,YAAiG;AAC1G;AAAA,EACE;AAAA,OAOK;AAGP,SAAS,aAA8B;AACvC,SAAS,gBAAoC;AAC7C,SAAS,cAAmD;AAC5D,SAAS,gBAAoC;AAC7C,SAAS,aAA8B;AACvC,SAAS,cAAgC;AACzC;AAAA,EACE;AAAA,OAOK;AACP,SAAS,sBAAyE;AAClF,SAAS,kBAA+D;AACxE,SAAS,kBAAwC;AACjD,SAAS,oBAA4C;AACrD,SAAS,mBAA0C;AAGnD,SAAS,cAAyG;AAClH,SAAS,YAAwF;AACjG,SAAS,iBAA+D;AACxE;AAAA,EACE;AAAA,OAKK;AACP,SAAS,eAAyD;AAClE,SAAS,kBAA+D;AAGxE,SAAS,aAA8B;AACvC,SAAS,aAA8B;AACvC;AAAA,EACE;AAAA,EACA;AAAA,OAMK;AACP,SAAS,cAAsG;AAC/G,SAAS,gBAAoC;AAC7C,SAAS,kBAAwC;AAGjD,SAAS,qBAAqB;AAC9B,SAAS,mBAAmB;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Sereno Design System - public component surface. See the /design-system\n// showcase for the live catalog, or the barrel smoke test for the full list.\n// Icons are passed in as props (lucide-react), never imported here; theming is\n// 100% CSS custom properties.\n\n// core\nexport { Typography, type TypographyProps, type TypographyVariant, type TypographyColor } from './core/Typography';\nexport { Button, type ButtonProps } from './core/Button';\nexport { IconButton, type IconButtonProps } from './core/IconButton';\nexport { Badge, type BadgeProps } from './core/Badge';\nexport { StatusDot, type StatusDotProps, type StatusDotTone, type StatusDotSize } from './core/StatusDot';\nexport { Divider, type DividerProps } from './core/Divider';\nexport { Card, type CardProps } from './core/Card';\nexport { ActionCard, type ActionCardProps, type ActionCardVariant } from './core/ActionCard';\nexport { StatCard, type StatCardProps, type StatCardTone } from './core/StatCard';\nexport { Avatar, type AvatarProps } from './core/Avatar';\nexport { Brand, type BrandProps } from './core/Brand';\nexport { Menu, type MenuProps, type MenuItem, type MenuEntry, type MenuSeparator, type MenuHeading } from './core/Menu';\nexport {\n Table,\n type TableProps,\n type TableRowProps,\n type HeaderCellProps,\n type CellProps,\n type TableSort,\n type SortDirection,\n} from './core/Table';\n\n// forms\nexport { Input, type InputProps } from './forms/Input';\nexport { Textarea, type TextareaProps } from './forms/Textarea';\nexport { Select, type SelectProps, type SelectOption } from './forms/Select';\nexport { Autocomplete, type AutocompleteProps, type AutocompleteOption, type AutocompleteLabels } from './forms/Autocomplete';\nexport { Checkbox, type CheckboxProps } from './forms/Checkbox';\nexport { Radio, type RadioProps } from './forms/Radio';\nexport { Switch, type SwitchProps } from './forms/Switch';\nexport {\n DateTimePicker,\n type DateTimePickerProps,\n type TimeSlot,\n type CalendarDayContext,\n type CalendarDayDot,\n type CalendarDayDots,\n type CalendarDotTone,\n} from './forms/DateTimePicker';\nexport { CalendarLegend, type CalendarLegendProps, type CalendarLegendItem } from './forms/CalendarLegend';\nexport { DatePicker, type DatePickerProps, type DatePickerHandle } from './forms/DatePicker';\nexport { FileUpload, type FileUploadProps } from './forms/FileUpload';\nexport { AvatarUpload, type AvatarUploadProps } from './forms/AvatarUpload';\nexport { SearchInput, type SearchInputProps } from './forms/SearchInput';\n\n// navigation\nexport { TopBar, type TopBarProps, type TopBarLeadingProps, type TopBarTitleProps, type TopBarActionsProps } from './navigation/TopBar';\nexport { Tabs, type TabsProps, type TabsListProps, type TabsTabProps, type TabsPanelProps } from './navigation/Tabs';\nexport { BottomNav, type BottomNavProps, type BottomNavItemProps } from './navigation/BottomNav';\nexport {\n SidebarNav,\n type SidebarNavProps,\n type SidebarNavSectionProps,\n type SidebarNavItemProps,\n type SidebarNavSubItemProps,\n} from './navigation/SidebarNav';\nexport { Stepper, type StepperProps, type StepperStepProps } from './navigation/Stepper';\nexport { Pagination, type PaginationProps, type PaginationLabels } from './navigation/Pagination';\n\n// feedback\nexport { Alert, type AlertProps } from './feedback/Alert';\nexport { Toast, type ToastProps } from './feedback/Toast';\nexport {\n ToastProvider,\n useToast,\n type ToastProviderProps,\n type ToastOptions,\n type ToastApi,\n type ToastContextValue,\n type ToastPosition,\n} from './feedback/ToastProvider';\nexport { Dialog, type DialogProps, type DialogHeaderProps, type DialogBodyProps, type DialogFooterProps } from './feedback/Dialog';\nexport { Skeleton, type SkeletonProps } from './feedback/Skeleton';\nexport { EmptyState, type EmptyStateProps } from './feedback/EmptyState';\n\n// theme - the `data-theme` provider (next-themes) + the light/dark toggle\nexport { ThemeProvider } from './theme/ThemeProvider';\nexport { ThemeToggle } from './theme/ThemeToggle';\n"],"mappings":"AAMA,SAAS,kBAAsF;AAC/F,SAAS,cAAgC;AACzC,SAAS,kBAAwC;AACjD,SAAS,aAA8B;AACvC,SAAS,iBAA8E;AACvF,SAAS,eAAkC;AAC3C,SAAS,YAA4B;AACrC,SAAS,kBAAgE;AACzE,SAAS,gBAAuD;AAChE,SAAS,cAAgC;AACzC,SAAS,aAA8B;AACvC,SAAS,YAAiG;AAC1G;AAAA,EACE;AAAA,OAOK;AAGP,SAAS,aAA8B;AACvC,SAAS,gBAAoC;AAC7C,SAAS,cAAmD;AAC5D,SAAS,oBAA8F;AACvG,SAAS,gBAAoC;AAC7C,SAAS,aAA8B;AACvC,SAAS,cAAgC;AACzC;AAAA,EACE;AAAA,OAOK;AACP,SAAS,sBAAyE;AAClF,SAAS,kBAA+D;AACxE,SAAS,kBAAwC;AACjD,SAAS,oBAA4C;AACrD,SAAS,mBAA0C;AAGnD,SAAS,cAAyG;AAClH,SAAS,YAAwF;AACjG,SAAS,iBAA+D;AACxE;AAAA,EACE;AAAA,OAKK;AACP,SAAS,eAAyD;AAClE,SAAS,kBAA+D;AAGxE,SAAS,aAA8B;AACvC,SAAS,aAA8B;AACvC;AAAA,EACE;AAAA,EACA;AAAA,OAMK;AACP,SAAS,cAAsG;AAC/G,SAAS,gBAAoC;AAC7C,SAAS,kBAAwC;AAGjD,SAAS,qBAAqB;AAC9B,SAAS,mBAAmB;","names":[]}
|