@mortenbrudvik/waveui 0.8.0 → 0.9.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/README.md +231 -85
- package/dist/components/data-display/InfoButton.cjs +2 -0
- package/dist/components/data-display/InfoButton.cjs.map +1 -0
- package/dist/components/data-display/InfoButton.mjs +173 -0
- package/dist/components/data-display/InfoButton.mjs.map +1 -0
- package/dist/components/data-display/InfoLabel.cjs +1 -1
- package/dist/components/data-display/InfoLabel.cjs.map +1 -1
- package/dist/components/data-display/InfoLabel.mjs +39 -96
- package/dist/components/data-display/InfoLabel.mjs.map +1 -1
- package/dist/components/input/Checkbox.cjs +1 -1
- package/dist/components/input/Checkbox.cjs.map +1 -1
- package/dist/components/input/Checkbox.mjs +91 -75
- package/dist/components/input/Checkbox.mjs.map +1 -1
- package/dist/components/input/ColorPicker.parts.cjs +1 -1
- package/dist/components/input/ColorPicker.parts.cjs.map +1 -1
- package/dist/components/input/ColorPicker.parts.mjs +1 -1
- package/dist/components/input/ColorPicker.parts.mjs.map +1 -1
- package/dist/components/input/Combobox.cjs +1 -1
- package/dist/components/input/Combobox.cjs.map +1 -1
- package/dist/components/input/Combobox.expand.cjs +1 -1
- package/dist/components/input/Combobox.expand.cjs.map +1 -1
- package/dist/components/input/Combobox.expand.mjs +20 -20
- package/dist/components/input/Combobox.expand.mjs.map +1 -1
- package/dist/components/input/Combobox.mjs +143 -138
- package/dist/components/input/Combobox.mjs.map +1 -1
- package/dist/components/input/DatePicker.cjs +1 -1
- package/dist/components/input/DatePicker.cjs.map +1 -1
- package/dist/components/input/DatePicker.mjs +213 -209
- package/dist/components/input/DatePicker.mjs.map +1 -1
- package/dist/components/input/Dropdown.cjs +1 -1
- package/dist/components/input/Dropdown.cjs.map +1 -1
- package/dist/components/input/Dropdown.mjs +80 -74
- package/dist/components/input/Dropdown.mjs.map +1 -1
- package/dist/components/input/Field.cjs +1 -1
- package/dist/components/input/Field.cjs.map +1 -1
- package/dist/components/input/Field.mjs +99 -66
- package/dist/components/input/Field.mjs.map +1 -1
- package/dist/components/input/Input.cjs +1 -1
- package/dist/components/input/Input.cjs.map +1 -1
- package/dist/components/input/Input.mjs +79 -55
- package/dist/components/input/Input.mjs.map +1 -1
- package/dist/components/input/Label.cjs +1 -1
- package/dist/components/input/Label.cjs.map +1 -1
- package/dist/components/input/Label.mjs +19 -13
- package/dist/components/input/Label.mjs.map +1 -1
- package/dist/components/input/Rating.cjs +1 -1
- package/dist/components/input/Rating.cjs.map +1 -1
- package/dist/components/input/Rating.item.cjs +2 -0
- package/dist/components/input/Rating.item.cjs.map +1 -0
- package/dist/components/input/Rating.item.mjs +255 -0
- package/dist/components/input/Rating.item.mjs.map +1 -0
- package/dist/components/input/Rating.mjs +150 -151
- package/dist/components/input/Rating.mjs.map +1 -1
- package/dist/components/input/SearchBox.cjs +1 -1
- package/dist/components/input/SearchBox.cjs.map +1 -1
- package/dist/components/input/SearchBox.mjs +146 -115
- package/dist/components/input/SearchBox.mjs.map +1 -1
- package/dist/components/input/Select.cjs +1 -1
- package/dist/components/input/Select.cjs.map +1 -1
- package/dist/components/input/Select.mjs +34 -25
- package/dist/components/input/Select.mjs.map +1 -1
- package/dist/components/input/Slider.cjs +1 -1
- package/dist/components/input/Slider.cjs.map +1 -1
- package/dist/components/input/Slider.mjs +77 -54
- package/dist/components/input/Slider.mjs.map +1 -1
- package/dist/components/input/SpinButton.cjs +1 -1
- package/dist/components/input/SpinButton.cjs.map +1 -1
- package/dist/components/input/SpinButton.mjs +198 -96
- package/dist/components/input/SpinButton.mjs.map +1 -1
- package/dist/components/input/Switch.cjs +1 -1
- package/dist/components/input/Switch.cjs.map +1 -1
- package/dist/components/input/Switch.mjs +71 -55
- package/dist/components/input/Switch.mjs.map +1 -1
- package/dist/components/input/TagPicker.cjs +1 -1
- package/dist/components/input/TagPicker.cjs.map +1 -1
- package/dist/components/input/TagPicker.mjs +142 -116
- package/dist/components/input/TagPicker.mjs.map +1 -1
- package/dist/components/input/Textarea.cjs +1 -1
- package/dist/components/input/Textarea.cjs.map +1 -1
- package/dist/components/input/Textarea.mjs +28 -21
- package/dist/components/input/Textarea.mjs.map +1 -1
- package/dist/components/input/TimePicker.cjs +1 -1
- package/dist/components/input/TimePicker.cjs.map +1 -1
- package/dist/components/input/TimePicker.mjs +189 -184
- package/dist/components/input/TimePicker.mjs.map +1 -1
- package/dist/components/input/fieldLabel.cjs +2 -0
- package/dist/components/input/fieldLabel.cjs.map +1 -0
- package/dist/components/input/fieldLabel.mjs +17 -0
- package/dist/components/input/fieldLabel.mjs.map +1 -0
- package/dist/components/input/inputLook.cjs +2 -0
- package/dist/components/input/inputLook.cjs.map +1 -0
- package/dist/components/input/inputLook.mjs +28 -0
- package/dist/components/input/inputLook.mjs.map +1 -0
- package/dist/components/input/pickerStyles.cjs +1 -1
- package/dist/components/input/pickerStyles.cjs.map +1 -1
- package/dist/components/input/pickerStyles.mjs +42 -4
- package/dist/components/input/pickerStyles.mjs.map +1 -1
- package/dist/components/navigation/Menu.popover.cjs +1 -1
- package/dist/components/navigation/Menu.popover.cjs.map +1 -1
- package/dist/components/navigation/Menu.popover.mjs +10 -10
- package/dist/components/navigation/Menu.root.cjs +1 -1
- package/dist/components/navigation/Menu.root.cjs.map +1 -1
- package/dist/components/navigation/Menu.root.mjs +10 -10
- package/dist/components/overlays/Popover.cjs +1 -1
- package/dist/components/overlays/Popover.cjs.map +1 -1
- package/dist/components/overlays/Popover.mjs +203 -208
- package/dist/components/overlays/Popover.mjs.map +1 -1
- package/dist/components/overlays/Popover.shared.cjs +1 -1
- package/dist/components/overlays/Popover.shared.cjs.map +1 -1
- package/dist/components/overlays/Popover.shared.mjs +82 -77
- package/dist/components/overlays/Popover.shared.mjs.map +1 -1
- package/dist/components/provider/WaveProvider.cjs +1 -1
- package/dist/components/provider/WaveProvider.cjs.map +1 -1
- package/dist/components/provider/WaveProvider.mjs +25 -19
- package/dist/components/provider/WaveProvider.mjs.map +1 -1
- package/dist/hooks/useFieldControl.cjs.map +1 -1
- package/dist/hooks/useFieldControl.mjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +805 -99
- package/dist/index.d.ts +805 -99
- package/dist/index.mjs +101 -99
- package/dist/lib/classNames.cjs +1 -1
- package/dist/lib/classNames.cjs.map +1 -1
- package/dist/lib/classNames.mjs +74 -66
- package/dist/lib/classNames.mjs.map +1 -1
- package/dist/lib/styles.cjs +1 -1
- package/dist/lib/styles.cjs.map +1 -1
- package/dist/lib/styles.mjs +21 -4
- package/dist/lib/styles.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/styles/tokens.css +13 -0
|
@@ -5,34 +5,34 @@ import { renderSlot as n, slotRendersContent as r } from "../../lib/slot.mjs";
|
|
|
5
5
|
import { disabledStyles as i, focusRing as a } from "../../lib/styles.mjs";
|
|
6
6
|
import { unwrapButtonGlyph as o } from "../button/Button.slots.mjs";
|
|
7
7
|
import { ChevronDownIcon as s } from "../../lib/icons.mjs";
|
|
8
|
-
import {
|
|
9
|
-
import * as
|
|
10
|
-
import { jsx as
|
|
8
|
+
import { pickerButtonOffset as c, pickerGlyphSize as l, pickerIconButtonClasses as u } from "./pickerStyles.mjs";
|
|
9
|
+
import * as d from "react";
|
|
10
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
11
11
|
//#region src/components/input/Combobox.expand.tsx
|
|
12
|
-
function
|
|
12
|
+
function p(e) {
|
|
13
13
|
return e == null || r(e);
|
|
14
14
|
}
|
|
15
|
-
var
|
|
16
|
-
let { glyph:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}, [
|
|
20
|
-
let
|
|
21
|
-
return /* @__PURE__ */
|
|
15
|
+
var m = ({ component: p, expandIcon: m, label: h, expanded: g, listboxId: _, disabled: v, onToggle: y, size: b = "medium", appearance: x = "outline", className: S, iconClassName: C }) => {
|
|
16
|
+
let { glyph: w, button: T } = o(m);
|
|
17
|
+
d.useEffect(() => {
|
|
18
|
+
T && t(`${p}:expandIcon-button`, `${p}: \`expandIcon\` received ${T}; its children render as the glyph of the built-in expand button and its props were dropped (buttons cannot be nested). Pass icon content instead, e.g. \`expandIcon={<MyIcon />}\`.`);
|
|
19
|
+
}, [T, p]);
|
|
20
|
+
let E = w != null && r(w) ? w : /* @__PURE__ */ f(s, { size: l(b, "chevron") });
|
|
21
|
+
return /* @__PURE__ */ f("button", {
|
|
22
22
|
type: "button",
|
|
23
23
|
tabIndex: -1,
|
|
24
|
-
"aria-label":
|
|
25
|
-
"aria-expanded":
|
|
26
|
-
"aria-controls":
|
|
27
|
-
disabled:
|
|
24
|
+
"aria-label": h,
|
|
25
|
+
"aria-expanded": g,
|
|
26
|
+
"aria-controls": g ? _ : void 0,
|
|
27
|
+
disabled: v,
|
|
28
28
|
onMouseDown: (e) => e.preventDefault(),
|
|
29
|
-
onClick:
|
|
30
|
-
className: e(
|
|
31
|
-
children: n(
|
|
29
|
+
onClick: y,
|
|
30
|
+
className: e(S, u(b, x), c(b, 1), a, i),
|
|
31
|
+
children: n(E, "span", e(C, "inline-flex transition-transform motion-reduce:transition-none", g && "rotate-180"), { "aria-hidden": !0 })
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
|
-
|
|
34
|
+
m.displayName = "PickerExpandButton";
|
|
35
35
|
//#endregion
|
|
36
|
-
export {
|
|
36
|
+
export { m as PickerExpandButton, p as showsExpandButton };
|
|
37
37
|
|
|
38
38
|
//# sourceMappingURL=Combobox.expand.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Combobox.expand.mjs","names":["React","showsExpandButton","expandIcon","slotRendersContent","PickerExpandButton","content","unwrapButtonGlyph","button","warnOnce","component","glyph","ChevronDownIcon","label","expanded","listboxId","event","onToggle","cn","className","
|
|
1
|
+
{"version":3,"file":"Combobox.expand.mjs","names":["React","showsExpandButton","expandIcon","slotRendersContent","PickerExpandButton","content","unwrapButtonGlyph","button","warnOnce","component","glyph","ChevronDownIcon","pickerGlyphSize","size","label","expanded","listboxId","event","onToggle","cn","className","pickerIconButtonClasses","appearance","pickerButtonOffset","focusRing","disabledStyles","renderSlot","iconClassName"],"sources":["../../../src/components/input/Combobox.expand.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/cn';\nimport { warnOnce } from '../../lib/dev';\nimport { ChevronDownIcon } from '../../lib/icons';\nimport { renderSlot, slotRendersContent } from '../../lib/slot';\nimport type { Slot } from '../../lib/slot';\nimport { disabledStyles, focusRing } from '../../lib/styles';\nimport type { CoreSize, InputAppearance } from '../../lib/types';\nimport { unwrapButtonGlyph } from '../button/Button.slots';\nimport { pickerButtonOffset, pickerGlyphSize, pickerIconButtonClasses } from './pickerStyles';\n\n/**\n * Whether an `expandIcon` value shows the expand button (the rule of optional indicator glyphs):\n * `null` and `undefined` keep the chevron; `false` and any other value that renders nothing\n * (`true`, `''`, an empty array or Fragment) hide the button.\n */\nexport function showsExpandButton(expandIcon: Slot<'span'> | undefined): boolean {\n return expandIcon == null || slotRendersContent(expandIcon);\n}\n\n/** Properties of {@link PickerExpandButton}. */\nexport interface PickerExpandButtonProps {\n /** The picker's public name, used in the development warning. */\n component: string;\n /** The picker's `expandIcon`; render the button only when {@link showsExpandButton} allows. */\n expandIcon: Slot<'span'> | undefined;\n /** The accessible name of the button. */\n label: string;\n /** Whether the list is shown with options (`aria-expanded`). */\n expanded: boolean;\n /** Id of the listbox, referenced by `aria-controls` while the list is expanded. */\n listboxId: string;\n /** Natively disables the button (a disabled or read-only picker). */\n disabled: boolean;\n /** Opens or closes the list and returns focus to the input. */\n onToggle: () => void;\n /**\n * Size of the button box and its glyph (Phase 4 D11): the picker's resolved `size`.\n * @default 'medium'\n */\n size?: CoreSize;\n /**\n * Appearance of the field the button sits in (Phase 4 D11): `filled-darker` gets a hover fill\n * one step darker than the field.\n * @default 'outline'\n */\n appearance?: InputAppearance;\n /** The host's stable class for the button (its `expandButton` part). */\n className?: string;\n /** The host's stable class for the glyph `<span>` (its `expandIcon` part). */\n iconClassName?: string;\n}\n\n/**\n * The expand button of an editable combobox (Combobox, TimePicker): the APG \"open\" button at the\n * end of the input. It is not a tab stop (Alt+ArrowDown opens the list from the keyboard) and a\n * press keeps focus in the input. Its glyph is decorative (`aria-hidden`) and turns while the list\n * is expanded. A `<button>` or `Button` element passed as `expandIcon`, or a slot object whose\n * `as` is one, is not nested: its children become the glyph (the chevron when they render\n * nothing), its props are dropped and a one-time development warning names the slot. `size` and\n * `appearance` (Phase 4 D11) default to `'medium'`/`'outline'` for a caller that has not resolved\n * them yet.\n */\nexport const PickerExpandButton = ({\n component,\n expandIcon,\n label,\n expanded,\n listboxId,\n disabled,\n onToggle,\n size = 'medium',\n appearance = 'outline',\n className,\n iconClassName,\n}: PickerExpandButtonProps) => {\n // The glyph slot rule shared with SplitButton and MenuButton `menuIcon` (C-SLOTS).\n const { glyph: content, button } = unwrapButtonGlyph(expandIcon);\n React.useEffect(() => {\n if (button) {\n warnOnce(\n `${component}:expandIcon-button`,\n `${component}: \\`expandIcon\\` received ${button}; its children render as the glyph of ` +\n 'the built-in expand button and its props were dropped (buttons cannot be nested). ' +\n 'Pass icon content instead, e.g. `expandIcon={<MyIcon />}`.',\n );\n }\n }, [button, component]);\n\n const glyph =\n content != null && slotRendersContent(content) ? (\n content\n ) : (\n <ChevronDownIcon size={pickerGlyphSize(size, 'chevron')} />\n );\n\n return (\n <button\n type=\"button\"\n tabIndex={-1}\n aria-label={label}\n aria-expanded={expanded}\n aria-controls={expanded ? listboxId : undefined}\n disabled={disabled}\n // Keeps focus in the input: a press must not blur it (a blur commits typed text).\n onMouseDown={(event) => event.preventDefault()}\n onClick={onToggle}\n className={cn(\n className,\n pickerIconButtonClasses(size, appearance),\n pickerButtonOffset(size, 1),\n focusRing,\n disabledStyles,\n )}\n >\n {renderSlot(\n glyph,\n 'span',\n cn(\n iconClassName,\n 'inline-flex transition-transform motion-reduce:transition-none',\n expanded && 'rotate-180',\n ),\n { 'aria-hidden': true },\n )}\n </button>\n );\n};\nPickerExpandButton.displayName = 'PickerExpandButton';\n"],"mappings":";;;;;;;;;;;AAgBA,SAAgBC,EAAkB,GAA+C;CAC/E,OAAOC,KAAc,QAAQC,EAAmBD,CAAU;AAC5D;AA6CA,IAAaE,KAAsB,EACjC,cACA,eACA,UACA,aACA,cACA,aACA,aACA,UAAO,UACP,gBAAa,WACb,cACA,uBAC6B;CAE7B,IAAM,EAAE,OAAOC,GAAS,cAAWC,EAAkBJ,CAAU;CAC/D,EAAM,gBAAgB;EACpB,AAAIK,KACFC,EACE,GAAGC,EAAU,qBACb,GAAGA,EAAU,4BAA4BF,EAAO,qLAGlD;CAEJ,GAAG,CAACA,GAAQE,CAAS,CAAC;CAEtB,IAAMC,IACJL,KAAW,QAAQF,EAAmBE,CAAO,IAC3CA,IAEA,kBAACM,GAAD,EAAiB,MAAMC,EAAgBC,GAAM,SAAS,EAAI,CAAA;CAG9D,OACE,kBAAC,UAAD;EACE,MAAK;EACL,UAAU;EACV,cAAYC;EACZ,iBAAeC;EACf,iBAAeA,IAAWC,IAAY,KAAA;EAC5B;EAEV,cAAc,MAAUC,EAAM,eAAe;EAC7C,SAASC;EACT,WAAWC,EACTC,GACAC,EAAwBR,GAAMS,CAAU,GACxCC,EAAmBV,GAAM,CAAC,GAC1BW,GACAC,CACF;EAEC,UAAAC,EACChB,GACA,QACAS,EACEQ,GACA,kEACAZ,KAAY,YACd,GACA,EAAE,eAAe,GAAK,CACxB;CACM,CAAA;AAEZ;AACA,EAAmB,cAAc"}
|
|
@@ -6,187 +6,192 @@ import { comboboxClassNames as r } from "../../lib/classNames.mjs";
|
|
|
6
6
|
import { useControllable as i } from "../../hooks/useControllable.mjs";
|
|
7
7
|
import { useMergedRefs as a } from "../../hooks/useMergedRefs.mjs";
|
|
8
8
|
import { useFieldContext as ee, useFieldControl as te } from "../../hooks/useFieldControl.mjs";
|
|
9
|
-
import { disabledStyles as ne,
|
|
10
|
-
import { DismissIcon as
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import
|
|
19
|
-
import
|
|
9
|
+
import { disabledStyles as ne, inputAppearanceClasses as re, inputFocus as ie, inputHeightClasses as ae, inputPaddingClasses as oe, inputTextClasses as o } from "../../lib/styles.mjs";
|
|
10
|
+
import { DismissIcon as se } from "../../lib/icons.mjs";
|
|
11
|
+
import { useInputLook as ce } from "./inputLook.mjs";
|
|
12
|
+
import { isInvalidLook as le } from "./Input.mjs";
|
|
13
|
+
import { useFormReset as ue } from "../../hooks/useFormReset.mjs";
|
|
14
|
+
import { HiddenInput as de } from "../internal/HiddenInput.mjs";
|
|
15
|
+
import { collectOptionLabels as fe, useListbox as s } from "../../hooks/useListbox.mjs";
|
|
16
|
+
import { pickerButtonOffset as pe, pickerEndPadding as me, pickerGlyphSize as he, pickerIconButtonClasses as ge } from "./pickerStyles.mjs";
|
|
17
|
+
import { PickerExpandButton as _e, showsExpandButton as ve } from "./Combobox.expand.mjs";
|
|
18
|
+
import { ListboxSurface as ye, Option as c, OptionGroup as l, useListboxPopup as be } from "./Option.mjs";
|
|
19
|
+
import * as u from "react";
|
|
20
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
20
21
|
//#region src/components/input/Combobox.tsx
|
|
21
|
-
function
|
|
22
|
+
function xe(e, t) {
|
|
22
23
|
return (e.textValue ?? e.label).toLowerCase().includes(t.toLowerCase());
|
|
23
24
|
}
|
|
24
|
-
var
|
|
25
|
-
let { value:
|
|
26
|
-
|
|
27
|
-
let
|
|
28
|
-
id:
|
|
29
|
-
"aria-label":
|
|
30
|
-
"aria-labelledby":
|
|
31
|
-
"aria-describedby":
|
|
32
|
-
"aria-invalid":
|
|
33
|
-
"aria-required":
|
|
34
|
-
}),
|
|
35
|
-
|
|
36
|
-
let
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}, [
|
|
40
|
-
let [
|
|
41
|
-
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
} :
|
|
48
|
-
let
|
|
49
|
-
open:
|
|
25
|
+
var p = (c) => {
|
|
26
|
+
let { value: l, defaultValue: p, onValueChange: m, onOptionSelect: h, open: g, defaultOpen: Se, onOpenChange: Ce, placeholder: we, disabled: _ = !1, size: Te, appearance: Ee, freeform: v = !1, name: De, form: y, required: b, autoComplete: Oe = "off", autoCapitalize: ke, autoCorrect: Ae, maxLength: x, readOnly: S, clearable: C = !1, expandIcon: w, labels: T, inputMode: je, spellCheck: Me, enterKeyHint: Ne, autoFocus: Pe, tabIndex: Fe, id: Ie, "aria-label": Le, "aria-labelledby": Re, "aria-describedby": ze, "aria-invalid": Be, "aria-required": Ve, "aria-errormessage": He, "aria-details": Ue, onFocus: We, onBlur: Ge, onKeyDown: Ke, onKeyUp: qe, controlRef: Je, className: Ye, children: E, ref: Xe, ...Ze } = c;
|
|
27
|
+
h !== void 0 && t("Combobox", "onOptionSelect", "onValueChange");
|
|
28
|
+
let D = ee(), Qe = (b ?? D?.required ?? !1) && !S, O = te({
|
|
29
|
+
id: Ie,
|
|
30
|
+
"aria-label": Le,
|
|
31
|
+
"aria-labelledby": Re,
|
|
32
|
+
"aria-describedby": ze,
|
|
33
|
+
"aria-invalid": Be,
|
|
34
|
+
"aria-required": Ve ?? b
|
|
35
|
+
}), $e = le(!1, O["aria-invalid"]), { size: k, appearance: A } = ce(Te, Ee), [j, M] = i(l, p ?? "", m), N = !_ && !S, [P, F] = i(g, (Se ?? !1) && N, Ce), I = P && N, [L, R] = u.useState(null), [et, tt] = u.useState(N);
|
|
36
|
+
et !== N && (tt(N), N || R(null));
|
|
37
|
+
let z = !N && P;
|
|
38
|
+
u.useEffect(() => {
|
|
39
|
+
z && F(!1);
|
|
40
|
+
}, [z, F]);
|
|
41
|
+
let [nt, B] = u.useState(null), V = u.useRef(null), H = u.useRef(null), rt = u.useMemo(() => fe(E), [E]), it = u.useMemo(() => L ? (e) => xe(e, L) : void 0, [L]), U = (e) => {
|
|
42
|
+
B(e), M(e), h?.(e);
|
|
43
|
+
}, W = () => {
|
|
44
|
+
F(!1), R(null);
|
|
45
|
+
}, G;
|
|
46
|
+
v ? G = () => {
|
|
47
|
+
R(null), U("");
|
|
48
|
+
} : L && (G = () => R(null));
|
|
49
|
+
let K = s({
|
|
50
|
+
open: I,
|
|
50
51
|
onOpenChange: (e) => {
|
|
51
|
-
e ?
|
|
52
|
+
e ? F(!0) : W();
|
|
52
53
|
},
|
|
53
54
|
mode: "editable",
|
|
54
|
-
selectedValues:
|
|
55
|
+
selectedValues: j ? [j] : [],
|
|
55
56
|
onSelect: (e) => {
|
|
56
|
-
|
|
57
|
+
M(e), h?.(e), R(null), B(null);
|
|
57
58
|
},
|
|
58
|
-
filter:
|
|
59
|
-
autoHighlight: !
|
|
59
|
+
filter: it,
|
|
60
|
+
autoHighlight: !v && L ? "first" : !1,
|
|
60
61
|
idPrefix: "combobox-listbox",
|
|
61
|
-
onClearDraft:
|
|
62
|
-
}),
|
|
63
|
-
|
|
64
|
-
let
|
|
65
|
-
open:
|
|
66
|
-
surfaceOpen:
|
|
67
|
-
onDismiss:
|
|
68
|
-
rootRef:
|
|
69
|
-
anchorRef:
|
|
70
|
-
}),
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
},
|
|
74
|
-
let
|
|
75
|
-
if (e.key === "Escape" &&
|
|
76
|
-
|
|
62
|
+
onClearDraft: G
|
|
63
|
+
}), q = j ? K.getItem(j)?.label ?? rt.get(j) : void 0, J;
|
|
64
|
+
J = v ? j === nt ? j : q ?? j : L ?? q ?? "", v && L !== null && L !== J && R(J);
|
|
65
|
+
let Y = I && K.items.length > 0, X = T?.noMatches ?? "No matches", Z = I && (Y || !!L), at = Z && !Y, { layerId: ot, setReference: st, surfaceRef: ct, floatingProps: lt } = be({
|
|
66
|
+
open: I,
|
|
67
|
+
surfaceOpen: Z,
|
|
68
|
+
onDismiss: W,
|
|
69
|
+
rootRef: V,
|
|
70
|
+
anchorRef: H
|
|
71
|
+
}), ut = a(V, Xe), dt = a(H, Je, st);
|
|
72
|
+
ue(H, () => {
|
|
73
|
+
M(p ?? ""), R(null), B(null);
|
|
74
|
+
}, y);
|
|
75
|
+
let ft = (e) => {
|
|
76
|
+
if (e.key === "Escape" && I && !Z && !e.nativeEvent.isComposing) {
|
|
77
|
+
W(), G && e.currentTarget.value !== "" && (e.preventDefault(), G());
|
|
77
78
|
return;
|
|
78
79
|
}
|
|
79
|
-
|
|
80
|
-
},
|
|
80
|
+
K.onKeyDown(e);
|
|
81
|
+
}, pt = (e) => {
|
|
81
82
|
let t = e.target.value;
|
|
82
|
-
|
|
83
|
-
},
|
|
84
|
-
|
|
85
|
-
},
|
|
86
|
-
|
|
87
|
-
}, Q =
|
|
88
|
-
return /* @__PURE__ */
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
83
|
+
R(t), I || F(!0), v && U(t);
|
|
84
|
+
}, mt = () => {
|
|
85
|
+
N && (I ? W() : F(!0), H.current?.focus());
|
|
86
|
+
}, ht = () => {
|
|
87
|
+
M(""), B(null), R(null), F(!1), H.current?.focus();
|
|
88
|
+
}, Q = ve(w), $ = C && j !== "" && !S, gt = O["aria-label"] === void 0 ? O["aria-labelledby"] ?? D?.labelId : O["aria-labelledby"];
|
|
89
|
+
return /* @__PURE__ */ f("div", {
|
|
90
|
+
"data-size": k,
|
|
91
|
+
"data-appearance": A,
|
|
92
|
+
...Ze,
|
|
93
|
+
ref: ut,
|
|
94
|
+
className: e(r.root, "relative inline-flex flex-col", Ye),
|
|
92
95
|
children: [
|
|
93
|
-
/* @__PURE__ */
|
|
96
|
+
/* @__PURE__ */ f("div", {
|
|
94
97
|
className: "relative flex items-center",
|
|
95
98
|
children: [
|
|
96
|
-
/* @__PURE__ */
|
|
99
|
+
/* @__PURE__ */ d("input", {
|
|
97
100
|
type: "text",
|
|
98
|
-
autoComplete:
|
|
99
|
-
...
|
|
100
|
-
...
|
|
101
|
-
"aria-expanded":
|
|
102
|
-
"aria-errormessage":
|
|
103
|
-
"aria-details":
|
|
104
|
-
ref:
|
|
105
|
-
disabled:
|
|
106
|
-
readOnly:
|
|
107
|
-
placeholder:
|
|
108
|
-
autoCapitalize:
|
|
109
|
-
autoCorrect:
|
|
110
|
-
maxLength:
|
|
111
|
-
inputMode:
|
|
112
|
-
spellCheck:
|
|
113
|
-
enterKeyHint:
|
|
114
|
-
autoFocus:
|
|
115
|
-
tabIndex:
|
|
116
|
-
value:
|
|
117
|
-
onChange:
|
|
101
|
+
autoComplete: Oe,
|
|
102
|
+
...O,
|
|
103
|
+
...K.getComboboxProps(),
|
|
104
|
+
"aria-expanded": Y,
|
|
105
|
+
"aria-errormessage": He,
|
|
106
|
+
"aria-details": Ue,
|
|
107
|
+
ref: dt,
|
|
108
|
+
disabled: _,
|
|
109
|
+
readOnly: S,
|
|
110
|
+
placeholder: we,
|
|
111
|
+
autoCapitalize: ke,
|
|
112
|
+
autoCorrect: Ae,
|
|
113
|
+
maxLength: x,
|
|
114
|
+
inputMode: je,
|
|
115
|
+
spellCheck: Me,
|
|
116
|
+
enterKeyHint: Ne,
|
|
117
|
+
autoFocus: Pe,
|
|
118
|
+
tabIndex: Fe,
|
|
119
|
+
value: J,
|
|
120
|
+
onChange: pt,
|
|
118
121
|
onClick: () => {
|
|
119
|
-
!
|
|
122
|
+
!I && N && F(!0);
|
|
120
123
|
},
|
|
121
|
-
onKeyDown: n(
|
|
122
|
-
onKeyUp: n(
|
|
123
|
-
onFocus:
|
|
124
|
-
onBlur: n(
|
|
125
|
-
className: e(r.input, re, "
|
|
124
|
+
onKeyDown: n(Ke, S ? void 0 : ft),
|
|
125
|
+
onKeyUp: n(qe, K.onKeyUp),
|
|
126
|
+
onFocus: We,
|
|
127
|
+
onBlur: n(Ge, () => R(null), { checkDefaultPrevented: !1 }),
|
|
128
|
+
className: e(r.input, ae[k], "w-full", oe[k], o[k], re[A], "text-foreground placeholder:text-muted-foreground", ie, ne, $e && "border-destructive", me(Number($) + Number(Q), k))
|
|
126
129
|
}),
|
|
127
|
-
$ && /* @__PURE__ */
|
|
130
|
+
$ && /* @__PURE__ */ d("button", {
|
|
128
131
|
type: "button",
|
|
129
|
-
"aria-label":
|
|
130
|
-
disabled:
|
|
132
|
+
"aria-label": T?.clear ?? "Clear selection",
|
|
133
|
+
disabled: _,
|
|
131
134
|
onMouseDown: (e) => e.preventDefault(),
|
|
132
|
-
onClick:
|
|
133
|
-
className: e(r.clearButton,
|
|
134
|
-
children: /* @__PURE__ */
|
|
135
|
+
onClick: ht,
|
|
136
|
+
className: e(r.clearButton, ge(k, A), pe(k, Q ? 2 : 1), "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring", "disabled:cursor-not-allowed disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:focus-visible:opacity-100"),
|
|
137
|
+
children: /* @__PURE__ */ d(se, { size: he(k, "icon") })
|
|
135
138
|
}),
|
|
136
|
-
Q && /* @__PURE__ */
|
|
139
|
+
Q && /* @__PURE__ */ d(_e, {
|
|
137
140
|
component: "Combobox",
|
|
138
|
-
expandIcon:
|
|
139
|
-
label:
|
|
140
|
-
expanded:
|
|
141
|
-
listboxId:
|
|
142
|
-
disabled:
|
|
143
|
-
onToggle:
|
|
141
|
+
expandIcon: w,
|
|
142
|
+
label: T?.expand ?? "Show options",
|
|
143
|
+
expanded: Y,
|
|
144
|
+
listboxId: K.listboxId,
|
|
145
|
+
disabled: _ || !!S,
|
|
146
|
+
onToggle: mt,
|
|
147
|
+
size: k,
|
|
148
|
+
appearance: A,
|
|
144
149
|
className: r.expandButton,
|
|
145
150
|
iconClassName: r.expandIcon
|
|
146
151
|
})
|
|
147
152
|
]
|
|
148
153
|
}),
|
|
149
|
-
/* @__PURE__ */
|
|
154
|
+
/* @__PURE__ */ d("span", {
|
|
150
155
|
role: "status",
|
|
151
156
|
className: "sr-only",
|
|
152
|
-
children:
|
|
157
|
+
children: at && X
|
|
153
158
|
}),
|
|
154
|
-
/* @__PURE__ */
|
|
155
|
-
listbox:
|
|
156
|
-
layerId:
|
|
157
|
-
surfaceRef:
|
|
158
|
-
floatingProps:
|
|
159
|
-
open:
|
|
160
|
-
expanded:
|
|
159
|
+
/* @__PURE__ */ d(ye, {
|
|
160
|
+
listbox: K,
|
|
161
|
+
layerId: ot,
|
|
162
|
+
surfaceRef: ct,
|
|
163
|
+
floatingProps: lt,
|
|
164
|
+
open: I,
|
|
165
|
+
expanded: Y,
|
|
161
166
|
listboxClassName: r.listbox,
|
|
162
167
|
surfaceClassName: r.surface,
|
|
163
|
-
emptyContent:
|
|
168
|
+
emptyContent: L ? /* @__PURE__ */ d("div", {
|
|
164
169
|
"aria-hidden": "true",
|
|
165
170
|
className: e(r.emptyMessage, "px-3 py-1.5 text-body-1 text-muted-foreground"),
|
|
166
|
-
children:
|
|
171
|
+
children: X
|
|
167
172
|
}) : void 0,
|
|
168
|
-
"aria-label":
|
|
169
|
-
"aria-labelledby":
|
|
170
|
-
children:
|
|
173
|
+
"aria-label": O["aria-label"],
|
|
174
|
+
"aria-labelledby": gt,
|
|
175
|
+
children: E
|
|
171
176
|
}),
|
|
172
|
-
/* @__PURE__ */
|
|
173
|
-
name:
|
|
174
|
-
form:
|
|
175
|
-
disabled:
|
|
176
|
-
value:
|
|
177
|
+
/* @__PURE__ */ d(de, {
|
|
178
|
+
name: De,
|
|
179
|
+
form: y,
|
|
180
|
+
disabled: _,
|
|
181
|
+
value: j,
|
|
177
182
|
type: "text",
|
|
178
|
-
required:
|
|
179
|
-
onInvalid: () =>
|
|
183
|
+
required: Qe,
|
|
184
|
+
onInvalid: () => H.current?.focus()
|
|
180
185
|
})
|
|
181
186
|
]
|
|
182
187
|
});
|
|
183
188
|
};
|
|
184
|
-
|
|
185
|
-
var
|
|
186
|
-
Option:
|
|
187
|
-
OptionGroup:
|
|
189
|
+
p.displayName = "Combobox";
|
|
190
|
+
var m = c, h = l, g = /* @__PURE__ */ Object.assign(p, {
|
|
191
|
+
Option: c,
|
|
192
|
+
OptionGroup: l
|
|
188
193
|
});
|
|
189
194
|
//#endregion
|
|
190
|
-
export {
|
|
195
|
+
export { g as Combobox, m as ComboboxOption, h as ComboboxOptionGroup, c as Option, l as OptionGroup };
|
|
191
196
|
|
|
192
197
|
//# sourceMappingURL=Combobox.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Combobox.mjs","names":["React","matchesText","item","text","ComboboxRoot","valueProp","openProp","ariaLabel","ariaLabelledBy","ariaDescribedBy","ariaInvalid","ariaRequired","ariaErrorMessage","ariaDetails","rest","props","onOptionSelect","warnDeprecated","field","useFieldContext","validates","required","readOnly","fieldProps","useFieldControl","invalidLook","isInvalidLook","value","setValue","useControllable","defaultValue","onValueChange","interactive","disabled","openState","setOpen","defaultOpen","onOpenChange","open","draft","setDraft","wasInteractive","setWasInteractive","lockedOpen","typedValue","setTypedValue","rootRef","inputRef","optionLabels","collectOptionLabels","children","filter","commitText","close","clearDraft","freeform","listbox","useListbox","next","optionLabel","inputText","expanded","noMatchesText","labels","surfaceOpen","noMatches","useListboxPopup","rootMergedRef","useMergedRefs","ref","inputMergedRef","controlRef","setReference","form","handleKeyDown","event","handleChange","handleExpandClick","handleClear","showExpand","showsExpandButton","expandIcon","showClear","clearable","listLabelledBy","cn","comboboxClassNames","className","composeEventHandlers","onKeyDown","onKeyUp","onBlur","inputBase","inputFocus","disabledStyles","pickerEndPadding","DismissIcon","PickerExpandButton","ListboxSurface","HiddenInput","ComboboxOption","Option","ComboboxOptionGroup","OptionGroup","Combobox"],"sources":["../../../src/components/input/Combobox.tsx"],"sourcesContent":["import * as React from 'react';\nimport { comboboxClassNames } from '../../lib/classNames';\nimport { cn } from '../../lib/cn';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport { warnDeprecated } from '../../lib/dev';\nimport { DismissIcon } from '../../lib/icons';\nimport type { Slot } from '../../lib/slot';\nimport { disabledStyles, focusRing, inputBase, inputFocus, inputInvalid } from '../../lib/styles';\nimport { useControllable } from '../../hooks/useControllable';\nimport { useFieldContext, useFieldControl } from '../../hooks/useFieldControl';\nimport { useFormReset } from '../../hooks/useFormReset';\nimport { collectOptionLabels, useListbox, type ListboxItem } from '../../hooks/useListbox';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { HiddenInput } from '../internal/HiddenInput';\nimport { PickerExpandButton, showsExpandButton } from './Combobox.expand';\nimport { isInvalidLook } from './Input';\nimport { ListboxSurface, Option, OptionGroup, useListboxPopup } from './Option';\nimport { PICKER_ICON_BUTTON_CLASSES, pickerEndPadding } from './pickerStyles';\nimport type { RoutedHandlers } from './routedHandlers';\n\nexport { Option, OptionGroup } from './Option';\nexport type { OptionProps, OptionGroupProps } from './Option';\n\n/* ------------------------------------------------------------------ */\n/* Combobox */\n/* ------------------------------------------------------------------ */\n\n/**\n * The Combobox's built-in texts, for localization. Each member is optional and falls back to its\n * English default.\n */\nexport interface ComboboxLabels {\n /** Status text (announced, and shown in the popup) when the typed text matches no option.\n * @default 'No matches'\n */\n noMatches?: string;\n /** Name of the clear button (`clearable`).\n * @default 'Clear selection'\n */\n clear?: string;\n /** Name of the expand button at the end of the input.\n * @default 'Show options'\n */\n expand?: string;\n}\n\n/** Properties for the Combobox component. */\nexport interface ComboboxProps extends Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'onChange' | 'defaultValue' | RoutedHandlers\n> {\n /** Controlled selected value (`''` for none). */\n value?: string;\n /**\n * Initial selected value for uncontrolled usage.\n * @default ''\n */\n defaultValue?: string;\n /**\n * Called with the new value when it changes: an option is selected, or (with `freeform`) the\n * text changes. Not called when the current option is selected again.\n */\n onValueChange?: (value: string) => void;\n /**\n * Called on every option activation, also when the current option is selected again (and, with\n * `freeform`, on every text change).\n * @deprecated Use `onValueChange`.\n */\n onOptionSelect?: (value: string) => void;\n /**\n * Controlled open state of the listbox. The list renders only in the browser: an open combobox\n * is closed in the server HTML and opens once it has hydrated.\n */\n open?: boolean;\n /**\n * Initial open state for uncontrolled usage. A combobox that starts disabled or read-only\n * starts closed. The list renders only in the browser: it is closed in the server HTML and opens\n * once the combobox has hydrated.\n * @default false\n */\n defaultOpen?: boolean;\n /** Called when the listbox opens or closes. */\n onOpenChange?: (open: boolean) => void;\n /** Placeholder text shown when no value is selected. */\n placeholder?: string;\n /**\n * Whether the combobox is disabled and non-interactive.\n * @default false\n */\n disabled?: boolean;\n /**\n * Whether the typed text is itself the value. Without it, typing only filters the options (the\n * first match becomes active, so Enter selects it) and the input shows the selected option's\n * label again when the listbox closes or loses focus. With it, the input shows typed text as\n * typed (also when it equals an option's value), a selected option's label, and a controlled\n * `value` as soon as the parent sets it (a parent that normalizes or rejects the text).\n * @default false\n */\n freeform?: boolean;\n /** Name of the value in form submissions (renders a hidden input). */\n name?: string;\n /** Id of the form the value belongs to, when the Combobox is outside it. */\n form?: string;\n /**\n * A value is required to submit the form (native constraint validation). Like a native readonly\n * input, a `readOnly` Combobox does not block submission.\n */\n required?: boolean;\n /**\n * The `autocomplete` attribute of the `<input role=\"combobox\">`. Browser autofill is off unless\n * you set it (for example `'on'`).\n * @default 'off'\n */\n autoComplete?: string;\n /** The maximum length of the typed text (`maxlength` of the `<input role=\"combobox\">`). */\n maxLength?: number;\n /**\n * The value cannot be changed: the input is read-only and the listbox neither opens (click,\n * keyboard, a controlled `open`) nor commits; Escape is left to the page. Turning it (or\n * `disabled`) on while the listbox is open closes it (`onOpenChange(false)`).\n */\n readOnly?: boolean;\n /**\n * Shows a clear button while a value is selected (not while `readOnly`; while `disabled` it is\n * shown disabled, as in DatePicker and TimePicker). It clears the value\n * (`onValueChange('')`), drops typed text, closes the list and moves focus to the input. It is\n * a tab stop after the input.\n * @default false\n */\n clearable?: boolean;\n /**\n * The glyph of the expand button at the end of the input (default: a chevron). The button\n * opens and closes the list without moving focus out of the input and is not a tab stop\n * (Alt+ArrowDown opens the list from the keyboard). `null` or `undefined` keep the chevron;\n * `false`, or a value that renders nothing, hides the button. Decorative content rendered\n * inside the built-in button: a `<button>` or `Button` passed here is not nested (its children\n * become the glyph, with a development warning).\n */\n expandIcon?: Slot<'span'>;\n /**\n * The built-in texts (the \"No matches\" status and the names of the clear and expand buttons),\n * for localization. Unset members keep their English defaults.\n */\n labels?: ComboboxLabels;\n /** Called when the `<input role=\"combobox\">` receives focus (the root keeps other handlers). */\n onFocus?: React.FocusEventHandler<HTMLInputElement>;\n /** Called when the `<input role=\"combobox\">` loses focus. */\n onBlur?: React.FocusEventHandler<HTMLInputElement>;\n /**\n * Called on a key press in the `<input role=\"combobox\">`, before the built-in listbox keys;\n * `event.preventDefault()` skips them.\n */\n onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;\n /** Called when a key is released in the `<input role=\"combobox\">`. */\n onKeyUp?: React.KeyboardEventHandler<HTMLInputElement>;\n /** Ref to the `<input role=\"combobox\">` (the focusable element). */\n controlRef?: React.Ref<HTMLInputElement>;\n /** Ref to the root `<div>`. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\nfunction matchesText(item: ListboxItem, text: string): boolean {\n return (item.textValue ?? item.label).toLowerCase().includes(text.toLowerCase());\n}\n\nconst ComboboxRoot = (props: ComboboxProps) => {\n const {\n value: valueProp,\n defaultValue,\n onValueChange,\n onOptionSelect,\n open: openProp,\n defaultOpen,\n onOpenChange,\n placeholder,\n disabled = false,\n freeform = false,\n name,\n form,\n required,\n autoComplete = 'off',\n autoCapitalize,\n autoCorrect,\n maxLength,\n readOnly,\n clearable = false,\n expandIcon,\n labels,\n inputMode,\n spellCheck,\n enterKeyHint,\n autoFocus,\n tabIndex,\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n 'aria-required': ariaRequired,\n 'aria-errormessage': ariaErrorMessage,\n 'aria-details': ariaDetails,\n onFocus,\n onBlur,\n onKeyDown,\n onKeyUp,\n controlRef,\n className,\n children,\n ref,\n ...rest\n } = props;\n\n if (onOptionSelect !== undefined) warnDeprecated('Combobox', 'onOptionSelect', 'onValueChange');\n\n const field = useFieldContext();\n const isRequired = required ?? field?.required ?? false;\n const validates = isRequired && !readOnly;\n const fieldProps = useFieldControl({\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n // An explicit `required={false}` wins over a required Field, so aria-required matches\n // `isRequired`.\n 'aria-required': ariaRequired ?? required,\n });\n // The error look follows the resolved state: the consumer's `aria-invalid` or the Field's.\n const invalidLook = isInvalidLook(false, fieldProps['aria-invalid']);\n\n const [value, setValue] = useControllable(valueProp, defaultValue ?? '', onValueChange);\n const interactive = !disabled && !readOnly;\n // A combobox that starts disabled or read-only never shows its list, so it starts closed (no\n // close to report later).\n const [openState, setOpen] = useControllable(\n openProp,\n (defaultOpen ?? false) && interactive,\n onOpenChange,\n );\n const open = openState && interactive;\n // Text typed since the last commit, the filter; `null` shows the committed value's label\n // (input-pickers#7). Freeform: the input shows the value, and the draft follows that text.\n const [draft, setDraft] = React.useState<string | null>(null);\n // Locking the control (readOnly/disabled) while typing drops the draft, so the input shows the\n // committed value again (adjust-during-render pattern, C-HOOKS).\n const [wasInteractive, setWasInteractive] = React.useState(interactive);\n if (wasInteractive !== interactive) {\n setWasInteractive(interactive);\n if (!interactive) setDraft(null);\n }\n // Locking also closes the list itself, not only the derived `open`, so unlocking does not reopen\n // it without a user action. The close is reported through onOpenChange (a consumer callback from\n // an effect, C-HOOKS); a controlled `open` that stays true is still not shown while locked.\n const lockedOpen = !interactive && openState;\n React.useEffect(() => {\n if (lockedOpen) setOpen(false);\n }, [lockedOpen, setOpen]);\n\n // Freeform: the value the user typed last. While the value still equals it, the input shows it\n // as typed, even when it equals an option's value (not that option's label).\n const [typedValue, setTypedValue] = React.useState<string | null>(null);\n\n const rootRef = React.useRef<HTMLDivElement | null>(null);\n const inputRef = React.useRef<HTMLInputElement | null>(null);\n\n const optionLabels = React.useMemo(() => collectOptionLabels(children), [children]);\n const filter = React.useMemo(\n () => (draft ? (item: ListboxItem) => matchesText(item, draft) : undefined),\n [draft],\n );\n\n const commitText = (text: string) => {\n setTypedValue(text);\n setValue(text);\n onOptionSelect?.(text);\n };\n\n const close = () => {\n setOpen(false);\n setDraft(null);\n };\n\n // APG: Escape on a closed listbox clears the textbox. Freeform: the text is the value, so it is\n // cleared. Otherwise only a typed filter is dropped (the input shows the selected label again);\n // without one there is nothing to clear and Escape is left to the page.\n let clearDraft: (() => void) | undefined;\n if (freeform) {\n clearDraft = () => {\n setDraft(null);\n commitText('');\n };\n } else if (draft) {\n clearDraft = () => setDraft(null);\n }\n\n const listbox = useListbox({\n open,\n onOpenChange: (next) => {\n if (next) setOpen(true);\n else close();\n },\n mode: 'editable',\n selectedValues: value ? [value] : [],\n onSelect: (next) => {\n setValue(next);\n onOptionSelect?.(next);\n setDraft(null);\n setTypedValue(null);\n },\n filter,\n // Typing a filter makes its first match active (like Fluent's Combobox), so Enter selects what\n // the list shows instead of submitting the form. Nothing is active on open or with the text\n // cleared. Freeform: the text is the value, so Enter keeps it unless the user moved to an\n // option.\n autoHighlight: !freeform && draft ? 'first' : false,\n idPrefix: 'combobox-listbox',\n onClearDraft: clearDraft,\n });\n\n // The input text. Freeform: the value as typed while it is the value the user typed last, else\n // the label of the option with that value, else the value itself — so the text follows a\n // controlled parent that normalizes or rejects what was typed while the input still has focus.\n // Otherwise: the typed filter, else the selected option's label.\n const optionLabel = value\n ? (listbox.getItem(value)?.label ?? optionLabels.get(value))\n : undefined;\n let inputText: string;\n if (freeform) inputText = value === typedValue ? value : (optionLabel ?? value);\n else inputText = draft ?? optionLabel ?? '';\n // Freeform: the filter follows the text (adjust-during-render pattern, C-HOOKS; the text does not\n // depend on the filter, so this settles in one pass).\n if (freeform && draft !== null && draft !== inputText) setDraft(inputText);\n\n const expanded = open && listbox.items.length > 0;\n const noMatchesText = labels?.noMatches ?? 'No matches';\n // The popup shows the list, or \"No matches\" for a draft.\n const surfaceOpen = open && (expanded || !!draft);\n const noMatches = surfaceOpen && !expanded;\n const { layerId, setReference, surfaceRef, floatingProps } = useListboxPopup({\n open,\n surfaceOpen,\n onDismiss: close,\n rootRef,\n anchorRef: inputRef,\n });\n\n const rootMergedRef = useMergedRefs<HTMLDivElement>(rootRef, ref);\n const inputMergedRef = useMergedRefs<HTMLInputElement>(inputRef, controlRef, setReference);\n\n useFormReset(\n inputRef,\n () => {\n setValue(defaultValue ?? '');\n setDraft(null);\n setTypedValue(null);\n },\n form,\n );\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Escape' && open && !surfaceOpen && !event.nativeEvent.isComposing) {\n // Open with nothing shown (no options): close as a closed list would handle Escape — clear\n // the text if there is any, otherwise leave the key to an enclosing layer (overlays#1).\n close();\n if (clearDraft && event.currentTarget.value !== '') {\n event.preventDefault();\n clearDraft();\n }\n return;\n }\n listbox.onKeyDown(event);\n };\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const text = event.target.value;\n setDraft(text);\n if (!open) setOpen(true);\n if (freeform) commitText(text);\n };\n\n // The expand button opens and closes the list like the input's own keys; focus stays in (or\n // returns to) the input.\n const handleExpandClick = () => {\n if (!interactive) return;\n if (open) close();\n else setOpen(true);\n inputRef.current?.focus();\n };\n\n // Clearing is not an option activation: the state is set directly, not through `commitText`\n // (which calls the deprecated `onOptionSelect` in freeform mode). The button disappears with the\n // value, so focus moves to the input explicitly (C-DISABLED).\n const handleClear = () => {\n setValue('');\n setTypedValue(null);\n setDraft(null);\n setOpen(false);\n inputRef.current?.focus();\n };\n\n const showExpand = showsExpandButton(expandIcon);\n // Read-only comboboxes offer no clear action (the value cannot change).\n const showClear = clearable && value !== '' && !readOnly;\n\n const listLabelledBy =\n fieldProps['aria-label'] === undefined\n ? (fieldProps['aria-labelledby'] ?? field?.labelId)\n : fieldProps['aria-labelledby'];\n\n return (\n <div\n {...rest}\n ref={rootMergedRef}\n className={cn(comboboxClassNames.root, 'relative inline-flex flex-col', className)}\n >\n <div className=\"relative flex items-center\">\n <input\n type=\"text\"\n autoComplete={autoComplete}\n {...fieldProps}\n {...listbox.getComboboxProps()}\n aria-expanded={expanded}\n aria-errormessage={ariaErrorMessage}\n aria-details={ariaDetails}\n ref={inputMergedRef}\n disabled={disabled}\n readOnly={readOnly}\n placeholder={placeholder}\n autoCapitalize={autoCapitalize}\n autoCorrect={autoCorrect}\n maxLength={maxLength}\n inputMode={inputMode}\n spellCheck={spellCheck}\n enterKeyHint={enterKeyHint}\n autoFocus={autoFocus}\n tabIndex={tabIndex}\n value={inputText}\n onChange={handleChange}\n onClick={() => {\n if (!open && interactive) setOpen(true);\n }}\n // Read-only: no listbox keys at all (they would open, commit or clear the value).\n onKeyDown={composeEventHandlers(onKeyDown, readOnly ? undefined : handleKeyDown)}\n onKeyUp={composeEventHandlers(onKeyUp, listbox.onKeyUp)}\n onFocus={onFocus}\n onBlur={composeEventHandlers(onBlur, () => setDraft(null), {\n checkDefaultPrevented: false,\n })}\n className={cn(\n comboboxClassNames.input,\n inputBase,\n 'border-b-stroke-accessible',\n inputFocus,\n disabledStyles,\n invalidLook && inputInvalid,\n pickerEndPadding(Number(showClear) + Number(showExpand)),\n )}\n />\n {showClear && (\n <button\n type=\"button\"\n aria-label={labels?.clear ?? 'Clear selection'}\n disabled={disabled}\n // Keeps focus in the input, so its blur does not act on a draft before the clear.\n onMouseDown={(event) => event.preventDefault()}\n onClick={handleClear}\n className={cn(\n comboboxClassNames.clearButton,\n PICKER_ICON_BUTTON_CLASSES,\n showExpand ? 'end-7' : 'end-1',\n focusRing,\n disabledStyles,\n )}\n >\n <DismissIcon />\n </button>\n )}\n {showExpand && (\n <PickerExpandButton\n component=\"Combobox\"\n expandIcon={expandIcon}\n label={labels?.expand ?? 'Show options'}\n expanded={expanded}\n listboxId={listbox.listboxId}\n disabled={disabled || !!readOnly}\n onToggle={handleExpandClick}\n className={comboboxClassNames.expandButton}\n iconClassName={comboboxClassNames.expandIcon}\n />\n )}\n </div>\n {/* Mounted before its text: a live region added together with its text is not announced by\n every screen reader. The row in the popup is the visible copy. */}\n <span role=\"status\" className=\"sr-only\">\n {noMatches && noMatchesText}\n </span>\n <ListboxSurface\n listbox={listbox}\n layerId={layerId}\n surfaceRef={surfaceRef}\n floatingProps={floatingProps}\n open={open}\n expanded={expanded}\n listboxClassName={comboboxClassNames.listbox}\n surfaceClassName={comboboxClassNames.surface}\n emptyContent={\n draft ? (\n <div\n aria-hidden=\"true\"\n className={cn(\n comboboxClassNames.emptyMessage,\n 'px-3 py-1.5 text-body-1 text-muted-foreground',\n )}\n >\n {noMatchesText}\n </div>\n ) : undefined\n }\n aria-label={fieldProps['aria-label']}\n aria-labelledby={listLabelledBy}\n >\n {children}\n </ListboxSurface>\n <HiddenInput\n name={name}\n form={form}\n disabled={disabled}\n value={value}\n type=\"text\"\n // Like a native readonly input, a read-only Combobox is barred from constraint validation\n // (the user could not fix it); its value is still submitted.\n required={validates}\n onInvalid={() => inputRef.current?.focus()}\n />\n </div>\n );\n};\nComboboxRoot.displayName = 'Combobox';\n\n/** Flat name of `Combobox.Option` for React Server Components. */\nexport const ComboboxOption = Option;\n/** Flat name of `Combobox.OptionGroup` for React Server Components. */\nexport const ComboboxOptionGroup = OptionGroup;\n\n/**\n * An editable combobox: a text input with a filterable listbox of `Option`s (APG combobox with\n * list autocomplete). Typing filters the options; ArrowDown/ArrowUp move the highlight\n * (`aria-activedescendant`), Enter selects, Escape closes. Without `freeform` the text is only a\n * filter: its first match becomes active while typing, and the input shows the selected option's\n * label again when the listbox closes. With `freeform` the text itself is the value. Text that\n * matches no option shows \"No matches\" (`labels.noMatches`), announced through a status region.\n * The expand button at the end of the input (a chevron, see `expandIcon`) opens and closes the\n * list without taking focus from the input and is not a tab stop; `clearable` adds a clear button,\n * a tab stop after the input. Both sit with the input in a wrapper `<div>` inside the root.\n *\n * The `<input>` receives `id`, `aria-label`, `aria-labelledby`, `aria-describedby`,\n * `aria-invalid`, `aria-required`, `aria-errormessage`, `aria-details`, `tabIndex`, `autoFocus`,\n * `onFocus`/`onBlur`/`onKeyDown`/`onKeyUp` and the text input attributes `autoComplete`,\n * `autoCapitalize`, `autoCorrect`, `maxLength`, `inputMode`, `spellCheck` and `enterKeyHint`.\n * `ref`, `className`, `style`, other `aria-*` attributes and the remaining props stay on the root\n * `<div>`. Inside a `Field` the input is labelled and described by it. It shows the error look\n * whenever it ends up `aria-invalid` (its own `aria-invalid` or a `Field` error). With\n * `name`/`required` the value takes part in form submission, validation and reset. The open\n * listbox renders in a portal; while closed it stays in the DOM, hidden.\n *\n * Sub-components: `Combobox.Option`, `Combobox.OptionGroup`. React Server Components import the\n * flat names `ComboboxOption` / `ComboboxOptionGroup` (dotted access needs a client file).\n */\nexport const Combobox = /* @__PURE__ */ Object.assign(ComboboxRoot, {\n Option,\n OptionGroup,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAiKA,SAASC,GAAY,GAAmB,GAAuB;CAC7D,QAAQC,EAAK,aAAaA,EAAK,MAAA,CAAO,YAAY,CAAC,CAAC,SAASC,EAAK,YAAY,CAAC;AACjF;AAEA,IAAMC,KAAgB,MAAyB;CAC7C,IAAM,EACJ,OAAOC,GACP,iBACA,kBACA,mBACA,MAAMC,GACN,iBACA,kBACA,iBACA,cAAW,IACX,cAAW,IACX,UACA,SACA,aACA,mBAAe,OACf,oBACA,iBACA,eACA,aACA,gBAAY,IACZ,eACA,WACA,eACA,gBACA,iBACA,cACA,aACA,OACA,cAAcC,GACd,mBAAmBC,IACnB,oBAAoBC,IACpB,gBAAgBC,IAChB,iBAAiBC,IACjB,qBAAqBC,IACrB,gBAAgBC,IAChB,aACA,YACA,eACA,aACA,gBACA,eACA,aACA,SACA,GAAGC,OACDC;CAEJ,AAAIC,MAAmB,KAAA,KAAWC,EAAe,YAAY,kBAAkB,eAAe;CAE9F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Combobox.mjs","names":["React","matchesText","item","text","ComboboxRoot","valueProp","openProp","sizeProp","appearanceProp","ariaLabel","ariaLabelledBy","ariaDescribedBy","ariaInvalid","ariaRequired","ariaErrorMessage","ariaDetails","rest","props","onOptionSelect","warnDeprecated","field","useFieldContext","validates","required","readOnly","fieldProps","useFieldControl","invalidLook","isInvalidLook","useInputLook","value","setValue","useControllable","defaultValue","onValueChange","interactive","disabled","openState","setOpen","defaultOpen","onOpenChange","open","draft","setDraft","wasInteractive","setWasInteractive","lockedOpen","typedValue","setTypedValue","rootRef","inputRef","optionLabels","collectOptionLabels","children","filter","commitText","close","clearDraft","freeform","listbox","useListbox","next","optionLabel","inputText","expanded","noMatchesText","labels","surfaceOpen","noMatches","useListboxPopup","rootMergedRef","useMergedRefs","ref","inputMergedRef","controlRef","setReference","form","handleKeyDown","event","handleChange","handleExpandClick","handleClear","showExpand","showsExpandButton","expandIcon","showClear","clearable","listLabelledBy","size","appearance","cn","comboboxClassNames","className","composeEventHandlers","onKeyDown","onKeyUp","onBlur","inputHeightClasses","inputPaddingClasses","inputTextClasses","inputAppearanceClasses","inputFocus","disabledStyles","pickerEndPadding","pickerIconButtonClasses","pickerButtonOffset","DismissIcon","pickerGlyphSize","PickerExpandButton","ListboxSurface","HiddenInput","ComboboxOption","Option","ComboboxOptionGroup","OptionGroup","Combobox"],"sources":["../../../src/components/input/Combobox.tsx"],"sourcesContent":["import * as React from 'react';\nimport { comboboxClassNames } from '../../lib/classNames';\nimport { cn } from '../../lib/cn';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport { warnDeprecated } from '../../lib/dev';\nimport { DismissIcon } from '../../lib/icons';\nimport type { Slot } from '../../lib/slot';\nimport {\n disabledStyles,\n focusRing,\n inputAppearanceClasses,\n inputFocus,\n inputHeightClasses,\n inputInvalid,\n inputPaddingClasses,\n inputTextClasses,\n} from '../../lib/styles';\nimport type { CoreSize, InputAppearance } from '../../lib/types';\nimport { useControllable } from '../../hooks/useControllable';\nimport { useFieldContext, useFieldControl } from '../../hooks/useFieldControl';\nimport { useFormReset } from '../../hooks/useFormReset';\nimport { collectOptionLabels, useListbox, type ListboxItem } from '../../hooks/useListbox';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { HiddenInput } from '../internal/HiddenInput';\nimport { PickerExpandButton, showsExpandButton } from './Combobox.expand';\nimport { useInputLook } from './inputLook';\nimport { isInvalidLook } from './Input';\nimport { ListboxSurface, Option, OptionGroup, useListboxPopup } from './Option';\nimport {\n pickerButtonOffset,\n pickerEndPadding,\n pickerGlyphSize,\n pickerIconButtonClasses,\n} from './pickerStyles';\nimport type { RoutedHandlers } from './routedHandlers';\n\nexport { Option, OptionGroup } from './Option';\nexport type { OptionProps, OptionGroupProps } from './Option';\n\n/* ------------------------------------------------------------------ */\n/* Combobox */\n/* ------------------------------------------------------------------ */\n\n/**\n * The Combobox's built-in texts, for localization. Each member is optional and falls back to its\n * English default.\n */\nexport interface ComboboxLabels {\n /** Status text (announced, and shown in the popup) when the typed text matches no option.\n * @default 'No matches'\n */\n noMatches?: string;\n /** Name of the clear button (`clearable`).\n * @default 'Clear selection'\n */\n clear?: string;\n /** Name of the expand button at the end of the input.\n * @default 'Show options'\n */\n expand?: string;\n}\n\n/** Properties for the Combobox component. */\nexport interface ComboboxProps extends Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'onChange' | 'defaultValue' | RoutedHandlers\n> {\n /** Controlled selected value (`''` for none). */\n value?: string;\n /**\n * Initial selected value for uncontrolled usage.\n * @default ''\n */\n defaultValue?: string;\n /**\n * Called with the new value when it changes: an option is selected, or (with `freeform`) the\n * text changes. Not called when the current option is selected again.\n */\n onValueChange?: (value: string) => void;\n /**\n * Called on every option activation, also when the current option is selected again (and, with\n * `freeform`, on every text change).\n * @deprecated Use `onValueChange`.\n */\n onOptionSelect?: (value: string) => void;\n /**\n * Controlled open state of the listbox. The list renders only in the browser: an open combobox\n * is closed in the server HTML and opens once it has hydrated.\n */\n open?: boolean;\n /**\n * Initial open state for uncontrolled usage. A combobox that starts disabled or read-only\n * starts closed. The list renders only in the browser: it is closed in the server HTML and opens\n * once the combobox has hydrated.\n * @default false\n */\n defaultOpen?: boolean;\n /** Called when the listbox opens or closes. */\n onOpenChange?: (open: boolean) => void;\n /** Placeholder text shown when no value is selected. */\n placeholder?: string;\n /**\n * Whether the combobox is disabled and non-interactive.\n * @default false\n */\n disabled?: boolean;\n /**\n * Size of the field: `small` (24px tall), `medium` (32px) or `large` (40px). Default: the\n * surrounding Field's `size`, else `WaveProvider inputDefaults.size`, else `'medium'`. The\n * listbox keeps its size.\n */\n size?: CoreSize;\n /**\n * Look of the field: `outline` (a full border), `underline` (a bottom stroke only),\n * `filled-darker` or `filled-lighter` (a fill without a visible stroke: give the field a visible\n * label). Default: `WaveProvider inputDefaults.appearance`, else `'outline'`.\n */\n appearance?: InputAppearance;\n /**\n * Whether the typed text is itself the value. Without it, typing only filters the options (the\n * first match becomes active, so Enter selects it) and the input shows the selected option's\n * label again when the listbox closes or loses focus. With it, the input shows typed text as\n * typed (also when it equals an option's value), a selected option's label, and a controlled\n * `value` as soon as the parent sets it (a parent that normalizes or rejects the text).\n * @default false\n */\n freeform?: boolean;\n /** Name of the value in form submissions (renders a hidden input). */\n name?: string;\n /** Id of the form the value belongs to, when the Combobox is outside it. */\n form?: string;\n /**\n * A value is required to submit the form (native constraint validation). Like a native readonly\n * input, a `readOnly` Combobox does not block submission.\n */\n required?: boolean;\n /**\n * The `autocomplete` attribute of the `<input role=\"combobox\">`. Browser autofill is off unless\n * you set it (for example `'on'`).\n * @default 'off'\n */\n autoComplete?: string;\n /** The maximum length of the typed text (`maxlength` of the `<input role=\"combobox\">`). */\n maxLength?: number;\n /**\n * The value cannot be changed: the input is read-only and the listbox neither opens (click,\n * keyboard, a controlled `open`) nor commits; Escape is left to the page. Turning it (or\n * `disabled`) on while the listbox is open closes it (`onOpenChange(false)`).\n */\n readOnly?: boolean;\n /**\n * Shows a clear button while a value is selected (not while `readOnly`; while `disabled` it is\n * shown disabled, as in DatePicker and TimePicker). It clears the value\n * (`onValueChange('')`), drops typed text, closes the list and moves focus to the input. It is\n * a tab stop after the input.\n * @default false\n */\n clearable?: boolean;\n /**\n * The glyph of the expand button at the end of the input (default: a chevron). The button\n * opens and closes the list without moving focus out of the input and is not a tab stop\n * (Alt+ArrowDown opens the list from the keyboard). `null` or `undefined` keep the chevron;\n * `false`, or a value that renders nothing, hides the button. Decorative content rendered\n * inside the built-in button: a `<button>` or `Button` passed here is not nested (its children\n * become the glyph, with a development warning).\n */\n expandIcon?: Slot<'span'>;\n /**\n * The built-in texts (the \"No matches\" status and the names of the clear and expand buttons),\n * for localization. Unset members keep their English defaults.\n */\n labels?: ComboboxLabels;\n /** Called when the `<input role=\"combobox\">` receives focus (the root keeps other handlers). */\n onFocus?: React.FocusEventHandler<HTMLInputElement>;\n /** Called when the `<input role=\"combobox\">` loses focus. */\n onBlur?: React.FocusEventHandler<HTMLInputElement>;\n /**\n * Called on a key press in the `<input role=\"combobox\">`, before the built-in listbox keys;\n * `event.preventDefault()` skips them.\n */\n onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;\n /** Called when a key is released in the `<input role=\"combobox\">`. */\n onKeyUp?: React.KeyboardEventHandler<HTMLInputElement>;\n /** Ref to the `<input role=\"combobox\">` (the focusable element). */\n controlRef?: React.Ref<HTMLInputElement>;\n /** Ref to the root `<div>`. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\nfunction matchesText(item: ListboxItem, text: string): boolean {\n return (item.textValue ?? item.label).toLowerCase().includes(text.toLowerCase());\n}\n\nconst ComboboxRoot = (props: ComboboxProps) => {\n const {\n value: valueProp,\n defaultValue,\n onValueChange,\n onOptionSelect,\n open: openProp,\n defaultOpen,\n onOpenChange,\n placeholder,\n disabled = false,\n size: sizeProp,\n appearance: appearanceProp,\n freeform = false,\n name,\n form,\n required,\n autoComplete = 'off',\n autoCapitalize,\n autoCorrect,\n maxLength,\n readOnly,\n clearable = false,\n expandIcon,\n labels,\n inputMode,\n spellCheck,\n enterKeyHint,\n autoFocus,\n tabIndex,\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n 'aria-required': ariaRequired,\n 'aria-errormessage': ariaErrorMessage,\n 'aria-details': ariaDetails,\n onFocus,\n onBlur,\n onKeyDown,\n onKeyUp,\n controlRef,\n className,\n children,\n ref,\n ...rest\n } = props;\n\n if (onOptionSelect !== undefined) warnDeprecated('Combobox', 'onOptionSelect', 'onValueChange');\n\n const field = useFieldContext();\n const isRequired = required ?? field?.required ?? false;\n const validates = isRequired && !readOnly;\n const fieldProps = useFieldControl({\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n // An explicit `required={false}` wins over a required Field, so aria-required matches\n // `isRequired`.\n 'aria-required': ariaRequired ?? required,\n });\n // The error look follows the resolved state: the consumer's `aria-invalid` or the Field's.\n const invalidLook = isInvalidLook(false, fieldProps['aria-invalid']);\n const { size, appearance } = useInputLook(sizeProp, appearanceProp);\n\n const [value, setValue] = useControllable(valueProp, defaultValue ?? '', onValueChange);\n const interactive = !disabled && !readOnly;\n // A combobox that starts disabled or read-only never shows its list, so it starts closed (no\n // close to report later).\n const [openState, setOpen] = useControllable(\n openProp,\n (defaultOpen ?? false) && interactive,\n onOpenChange,\n );\n const open = openState && interactive;\n // Text typed since the last commit, the filter; `null` shows the committed value's label\n // (input-pickers#7). Freeform: the input shows the value, and the draft follows that text.\n const [draft, setDraft] = React.useState<string | null>(null);\n // Locking the control (readOnly/disabled) while typing drops the draft, so the input shows the\n // committed value again (adjust-during-render pattern, C-HOOKS).\n const [wasInteractive, setWasInteractive] = React.useState(interactive);\n if (wasInteractive !== interactive) {\n setWasInteractive(interactive);\n if (!interactive) setDraft(null);\n }\n // Locking also closes the list itself, not only the derived `open`, so unlocking does not reopen\n // it without a user action. The close is reported through onOpenChange (a consumer callback from\n // an effect, C-HOOKS); a controlled `open` that stays true is still not shown while locked.\n const lockedOpen = !interactive && openState;\n React.useEffect(() => {\n if (lockedOpen) setOpen(false);\n }, [lockedOpen, setOpen]);\n\n // Freeform: the value the user typed last. While the value still equals it, the input shows it\n // as typed, even when it equals an option's value (not that option's label).\n const [typedValue, setTypedValue] = React.useState<string | null>(null);\n\n const rootRef = React.useRef<HTMLDivElement | null>(null);\n const inputRef = React.useRef<HTMLInputElement | null>(null);\n\n const optionLabels = React.useMemo(() => collectOptionLabels(children), [children]);\n const filter = React.useMemo(\n () => (draft ? (item: ListboxItem) => matchesText(item, draft) : undefined),\n [draft],\n );\n\n const commitText = (text: string) => {\n setTypedValue(text);\n setValue(text);\n onOptionSelect?.(text);\n };\n\n const close = () => {\n setOpen(false);\n setDraft(null);\n };\n\n // APG: Escape on a closed listbox clears the textbox. Freeform: the text is the value, so it is\n // cleared. Otherwise only a typed filter is dropped (the input shows the selected label again);\n // without one there is nothing to clear and Escape is left to the page.\n let clearDraft: (() => void) | undefined;\n if (freeform) {\n clearDraft = () => {\n setDraft(null);\n commitText('');\n };\n } else if (draft) {\n clearDraft = () => setDraft(null);\n }\n\n const listbox = useListbox({\n open,\n onOpenChange: (next) => {\n if (next) setOpen(true);\n else close();\n },\n mode: 'editable',\n selectedValues: value ? [value] : [],\n onSelect: (next) => {\n setValue(next);\n onOptionSelect?.(next);\n setDraft(null);\n setTypedValue(null);\n },\n filter,\n // Typing a filter makes its first match active (like Fluent's Combobox), so Enter selects what\n // the list shows instead of submitting the form. Nothing is active on open or with the text\n // cleared. Freeform: the text is the value, so Enter keeps it unless the user moved to an\n // option.\n autoHighlight: !freeform && draft ? 'first' : false,\n idPrefix: 'combobox-listbox',\n onClearDraft: clearDraft,\n });\n\n // The input text. Freeform: the value as typed while it is the value the user typed last, else\n // the label of the option with that value, else the value itself — so the text follows a\n // controlled parent that normalizes or rejects what was typed while the input still has focus.\n // Otherwise: the typed filter, else the selected option's label.\n const optionLabel = value\n ? (listbox.getItem(value)?.label ?? optionLabels.get(value))\n : undefined;\n let inputText: string;\n if (freeform) inputText = value === typedValue ? value : (optionLabel ?? value);\n else inputText = draft ?? optionLabel ?? '';\n // Freeform: the filter follows the text (adjust-during-render pattern, C-HOOKS; the text does not\n // depend on the filter, so this settles in one pass).\n if (freeform && draft !== null && draft !== inputText) setDraft(inputText);\n\n const expanded = open && listbox.items.length > 0;\n const noMatchesText = labels?.noMatches ?? 'No matches';\n // The popup shows the list, or \"No matches\" for a draft.\n const surfaceOpen = open && (expanded || !!draft);\n const noMatches = surfaceOpen && !expanded;\n const { layerId, setReference, surfaceRef, floatingProps } = useListboxPopup({\n open,\n surfaceOpen,\n onDismiss: close,\n rootRef,\n anchorRef: inputRef,\n });\n\n const rootMergedRef = useMergedRefs<HTMLDivElement>(rootRef, ref);\n const inputMergedRef = useMergedRefs<HTMLInputElement>(inputRef, controlRef, setReference);\n\n useFormReset(\n inputRef,\n () => {\n setValue(defaultValue ?? '');\n setDraft(null);\n setTypedValue(null);\n },\n form,\n );\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Escape' && open && !surfaceOpen && !event.nativeEvent.isComposing) {\n // Open with nothing shown (no options): close as a closed list would handle Escape — clear\n // the text if there is any, otherwise leave the key to an enclosing layer (overlays#1).\n close();\n if (clearDraft && event.currentTarget.value !== '') {\n event.preventDefault();\n clearDraft();\n }\n return;\n }\n listbox.onKeyDown(event);\n };\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const text = event.target.value;\n setDraft(text);\n if (!open) setOpen(true);\n if (freeform) commitText(text);\n };\n\n // The expand button opens and closes the list like the input's own keys; focus stays in (or\n // returns to) the input.\n const handleExpandClick = () => {\n if (!interactive) return;\n if (open) close();\n else setOpen(true);\n inputRef.current?.focus();\n };\n\n // Clearing is not an option activation: the state is set directly, not through `commitText`\n // (which calls the deprecated `onOptionSelect` in freeform mode). The button disappears with the\n // value, so focus moves to the input explicitly (C-DISABLED).\n const handleClear = () => {\n setValue('');\n setTypedValue(null);\n setDraft(null);\n setOpen(false);\n inputRef.current?.focus();\n };\n\n const showExpand = showsExpandButton(expandIcon);\n // Read-only comboboxes offer no clear action (the value cannot change).\n const showClear = clearable && value !== '' && !readOnly;\n\n const listLabelledBy =\n fieldProps['aria-label'] === undefined\n ? (fieldProps['aria-labelledby'] ?? field?.labelId)\n : fieldProps['aria-labelledby'];\n\n return (\n <div\n data-size={size}\n data-appearance={appearance}\n {...rest}\n ref={rootMergedRef}\n className={cn(comboboxClassNames.root, 'relative inline-flex flex-col', className)}\n >\n <div className=\"relative flex items-center\">\n <input\n type=\"text\"\n autoComplete={autoComplete}\n {...fieldProps}\n {...listbox.getComboboxProps()}\n aria-expanded={expanded}\n aria-errormessage={ariaErrorMessage}\n aria-details={ariaDetails}\n ref={inputMergedRef}\n disabled={disabled}\n readOnly={readOnly}\n placeholder={placeholder}\n autoCapitalize={autoCapitalize}\n autoCorrect={autoCorrect}\n maxLength={maxLength}\n inputMode={inputMode}\n spellCheck={spellCheck}\n enterKeyHint={enterKeyHint}\n autoFocus={autoFocus}\n tabIndex={tabIndex}\n value={inputText}\n onChange={handleChange}\n onClick={() => {\n if (!open && interactive) setOpen(true);\n }}\n // Read-only: no listbox keys at all (they would open, commit or clear the value).\n onKeyDown={composeEventHandlers(onKeyDown, readOnly ? undefined : handleKeyDown)}\n onKeyUp={composeEventHandlers(onKeyUp, listbox.onKeyUp)}\n onFocus={onFocus}\n onBlur={composeEventHandlers(onBlur, () => setDraft(null), {\n checkDefaultPrevented: false,\n })}\n className={cn(\n comboboxClassNames.input,\n inputHeightClasses[size],\n 'w-full',\n inputPaddingClasses[size],\n inputTextClasses[size],\n inputAppearanceClasses[appearance],\n 'text-foreground placeholder:text-muted-foreground',\n inputFocus,\n disabledStyles,\n invalidLook && inputInvalid,\n pickerEndPadding(Number(showClear) + Number(showExpand), size),\n )}\n />\n {showClear && (\n <button\n type=\"button\"\n aria-label={labels?.clear ?? 'Clear selection'}\n disabled={disabled}\n // Keeps focus in the input, so its blur does not act on a draft before the clear.\n onMouseDown={(event) => event.preventDefault()}\n onClick={handleClear}\n className={cn(\n comboboxClassNames.clearButton,\n pickerIconButtonClasses(size, appearance),\n pickerButtonOffset(size, showExpand ? 2 : 1),\n focusRing,\n disabledStyles,\n )}\n >\n <DismissIcon size={pickerGlyphSize(size, 'icon')} />\n </button>\n )}\n {showExpand && (\n <PickerExpandButton\n component=\"Combobox\"\n expandIcon={expandIcon}\n label={labels?.expand ?? 'Show options'}\n expanded={expanded}\n listboxId={listbox.listboxId}\n disabled={disabled || !!readOnly}\n onToggle={handleExpandClick}\n size={size}\n appearance={appearance}\n className={comboboxClassNames.expandButton}\n iconClassName={comboboxClassNames.expandIcon}\n />\n )}\n </div>\n {/* Mounted before its text: a live region added together with its text is not announced by\n every screen reader. The row in the popup is the visible copy. */}\n <span role=\"status\" className=\"sr-only\">\n {noMatches && noMatchesText}\n </span>\n <ListboxSurface\n listbox={listbox}\n layerId={layerId}\n surfaceRef={surfaceRef}\n floatingProps={floatingProps}\n open={open}\n expanded={expanded}\n listboxClassName={comboboxClassNames.listbox}\n surfaceClassName={comboboxClassNames.surface}\n emptyContent={\n draft ? (\n <div\n aria-hidden=\"true\"\n className={cn(\n comboboxClassNames.emptyMessage,\n 'px-3 py-1.5 text-body-1 text-muted-foreground',\n )}\n >\n {noMatchesText}\n </div>\n ) : undefined\n }\n aria-label={fieldProps['aria-label']}\n aria-labelledby={listLabelledBy}\n >\n {children}\n </ListboxSurface>\n <HiddenInput\n name={name}\n form={form}\n disabled={disabled}\n value={value}\n type=\"text\"\n // Like a native readonly input, a read-only Combobox is barred from constraint validation\n // (the user could not fix it); its value is still submitted.\n required={validates}\n onInvalid={() => inputRef.current?.focus()}\n />\n </div>\n );\n};\nComboboxRoot.displayName = 'Combobox';\n\n/** Flat name of `Combobox.Option` for React Server Components. */\nexport const ComboboxOption = Option;\n/** Flat name of `Combobox.OptionGroup` for React Server Components. */\nexport const ComboboxOptionGroup = OptionGroup;\n\n/**\n * An editable combobox: a text input with a filterable listbox of `Option`s (APG combobox with\n * list autocomplete). Typing filters the options; ArrowDown/ArrowUp move the highlight\n * (`aria-activedescendant`), Enter selects, Escape closes. Without `freeform` the text is only a\n * filter: its first match becomes active while typing, and the input shows the selected option's\n * label again when the listbox closes. With `freeform` the text itself is the value. Text that\n * matches no option shows \"No matches\" (`labels.noMatches`), announced through a status region.\n * The expand button at the end of the input (a chevron, see `expandIcon`) opens and closes the\n * list without taking focus from the input and is not a tab stop; `clearable` adds a clear button,\n * a tab stop after the input. Both sit with the input in a wrapper `<div>` inside the root.\n *\n * The `<input>` receives `id`, `aria-label`, `aria-labelledby`, `aria-describedby`,\n * `aria-invalid`, `aria-required`, `aria-errormessage`, `aria-details`, `tabIndex`, `autoFocus`,\n * `onFocus`/`onBlur`/`onKeyDown`/`onKeyUp` and the text input attributes `autoComplete`,\n * `autoCapitalize`, `autoCorrect`, `maxLength`, `inputMode`, `spellCheck` and `enterKeyHint`.\n * `ref`, `className`, `style`, other `aria-*` attributes and the remaining props stay on the root\n * `<div>`. Inside a `Field` the input is labelled and described by it. It shows the error look\n * whenever it ends up `aria-invalid` (its own `aria-invalid` or a `Field` error). With\n * `name`/`required` the value takes part in form submission, validation and reset. The open\n * listbox renders in a portal; while closed it stays in the DOM, hidden.\n *\n * **Size and appearance**: `size` resolves from its own prop, then the surrounding `Field`'s\n * `size`, then `WaveProvider inputDefaults.size`, else `'medium'`; `appearance` from its own prop,\n * then `WaveProvider inputDefaults.appearance`, else `'outline'`; both render as `data-size` and\n * `data-appearance` on the root `<div>`. The listbox keeps its size.\n *\n * Sub-components: `Combobox.Option`, `Combobox.OptionGroup`. React Server Components import the\n * flat names `ComboboxOption` / `ComboboxOptionGroup` (dotted access needs a client file).\n */\nexport const Combobox = /* @__PURE__ */ Object.assign(ComboboxRoot, {\n Option,\n OptionGroup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