@mortenbrudvik/waveui 0.8.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (206) hide show
  1. package/README.md +634 -167
  2. package/dist/components/data-display/InfoButton.cjs +2 -0
  3. package/dist/components/data-display/InfoButton.cjs.map +1 -0
  4. package/dist/components/data-display/InfoButton.mjs +173 -0
  5. package/dist/components/data-display/InfoButton.mjs.map +1 -0
  6. package/dist/components/data-display/InfoLabel.cjs +1 -1
  7. package/dist/components/data-display/InfoLabel.cjs.map +1 -1
  8. package/dist/components/data-display/InfoLabel.mjs +39 -96
  9. package/dist/components/data-display/InfoLabel.mjs.map +1 -1
  10. package/dist/components/input/Calendar.cjs +2 -0
  11. package/dist/components/input/Calendar.cjs.map +1 -0
  12. package/dist/components/input/Calendar.mjs +352 -0
  13. package/dist/components/input/Calendar.mjs.map +1 -0
  14. package/dist/components/input/Calendar.views.cjs +2 -0
  15. package/dist/components/input/Calendar.views.cjs.map +1 -0
  16. package/dist/components/input/Calendar.views.mjs +194 -0
  17. package/dist/components/input/Calendar.views.mjs.map +1 -0
  18. package/dist/components/input/Checkbox.cjs +1 -1
  19. package/dist/components/input/Checkbox.cjs.map +1 -1
  20. package/dist/components/input/Checkbox.mjs +91 -75
  21. package/dist/components/input/Checkbox.mjs.map +1 -1
  22. package/dist/components/input/ColorArea.cjs +1 -1
  23. package/dist/components/input/ColorArea.cjs.map +1 -1
  24. package/dist/components/input/ColorArea.mjs +18 -18
  25. package/dist/components/input/ColorArea.mjs.map +1 -1
  26. package/dist/components/input/ColorPicker.parts.cjs +1 -1
  27. package/dist/components/input/ColorPicker.parts.cjs.map +1 -1
  28. package/dist/components/input/ColorPicker.parts.mjs +1 -1
  29. package/dist/components/input/ColorPicker.parts.mjs.map +1 -1
  30. package/dist/components/input/Combobox.cjs +1 -1
  31. package/dist/components/input/Combobox.cjs.map +1 -1
  32. package/dist/components/input/Combobox.expand.cjs +1 -1
  33. package/dist/components/input/Combobox.expand.cjs.map +1 -1
  34. package/dist/components/input/Combobox.expand.mjs +20 -20
  35. package/dist/components/input/Combobox.expand.mjs.map +1 -1
  36. package/dist/components/input/Combobox.mjs +219 -138
  37. package/dist/components/input/Combobox.mjs.map +1 -1
  38. package/dist/components/input/Combobox.text.cjs +2 -0
  39. package/dist/components/input/Combobox.text.cjs.map +1 -0
  40. package/dist/components/input/Combobox.text.mjs +24 -0
  41. package/dist/components/input/Combobox.text.mjs.map +1 -0
  42. package/dist/components/input/DatePicker.cjs +1 -1
  43. package/dist/components/input/DatePicker.cjs.map +1 -1
  44. package/dist/components/input/DatePicker.mjs +205 -286
  45. package/dist/components/input/DatePicker.mjs.map +1 -1
  46. package/dist/components/input/Dropdown.cjs +1 -1
  47. package/dist/components/input/Dropdown.cjs.map +1 -1
  48. package/dist/components/input/Dropdown.mjs +137 -105
  49. package/dist/components/input/Dropdown.mjs.map +1 -1
  50. package/dist/components/input/Field.cjs +1 -1
  51. package/dist/components/input/Field.cjs.map +1 -1
  52. package/dist/components/input/Field.mjs +99 -66
  53. package/dist/components/input/Field.mjs.map +1 -1
  54. package/dist/components/input/Input.cjs +1 -1
  55. package/dist/components/input/Input.cjs.map +1 -1
  56. package/dist/components/input/Input.mjs +79 -55
  57. package/dist/components/input/Input.mjs.map +1 -1
  58. package/dist/components/input/Label.cjs +1 -1
  59. package/dist/components/input/Label.cjs.map +1 -1
  60. package/dist/components/input/Label.mjs +19 -13
  61. package/dist/components/input/Label.mjs.map +1 -1
  62. package/dist/components/input/Listbox.cjs +2 -0
  63. package/dist/components/input/Listbox.cjs.map +1 -0
  64. package/dist/components/input/Listbox.mjs +134 -0
  65. package/dist/components/input/Listbox.mjs.map +1 -0
  66. package/dist/components/input/Option.cjs +1 -1
  67. package/dist/components/input/Option.cjs.map +1 -1
  68. package/dist/components/input/Option.mjs +158 -97
  69. package/dist/components/input/Option.mjs.map +1 -1
  70. package/dist/components/input/Rating.cjs +1 -1
  71. package/dist/components/input/Rating.cjs.map +1 -1
  72. package/dist/components/input/Rating.item.cjs +2 -0
  73. package/dist/components/input/Rating.item.cjs.map +1 -0
  74. package/dist/components/input/Rating.item.mjs +255 -0
  75. package/dist/components/input/Rating.item.mjs.map +1 -0
  76. package/dist/components/input/Rating.mjs +150 -151
  77. package/dist/components/input/Rating.mjs.map +1 -1
  78. package/dist/components/input/SearchBox.cjs +1 -1
  79. package/dist/components/input/SearchBox.cjs.map +1 -1
  80. package/dist/components/input/SearchBox.mjs +146 -115
  81. package/dist/components/input/SearchBox.mjs.map +1 -1
  82. package/dist/components/input/Select.cjs +1 -1
  83. package/dist/components/input/Select.cjs.map +1 -1
  84. package/dist/components/input/Select.mjs +34 -25
  85. package/dist/components/input/Select.mjs.map +1 -1
  86. package/dist/components/input/Slider.cjs +1 -1
  87. package/dist/components/input/Slider.cjs.map +1 -1
  88. package/dist/components/input/Slider.mjs +77 -54
  89. package/dist/components/input/Slider.mjs.map +1 -1
  90. package/dist/components/input/SpinButton.cjs +1 -1
  91. package/dist/components/input/SpinButton.cjs.map +1 -1
  92. package/dist/components/input/SpinButton.mjs +198 -96
  93. package/dist/components/input/SpinButton.mjs.map +1 -1
  94. package/dist/components/input/SwatchPicker.cjs +1 -1
  95. package/dist/components/input/SwatchPicker.cjs.map +1 -1
  96. package/dist/components/input/SwatchPicker.context.cjs +2 -0
  97. package/dist/components/input/SwatchPicker.context.cjs.map +1 -0
  98. package/dist/components/input/SwatchPicker.context.mjs +35 -0
  99. package/dist/components/input/SwatchPicker.context.mjs.map +1 -0
  100. package/dist/components/input/SwatchPicker.mjs +131 -103
  101. package/dist/components/input/SwatchPicker.mjs.map +1 -1
  102. package/dist/components/input/SwatchPicker.swatches.cjs +2 -0
  103. package/dist/components/input/SwatchPicker.swatches.cjs.map +1 -0
  104. package/dist/components/input/SwatchPicker.swatches.mjs +207 -0
  105. package/dist/components/input/SwatchPicker.swatches.mjs.map +1 -0
  106. package/dist/components/input/Switch.cjs +1 -1
  107. package/dist/components/input/Switch.cjs.map +1 -1
  108. package/dist/components/input/Switch.mjs +71 -55
  109. package/dist/components/input/Switch.mjs.map +1 -1
  110. package/dist/components/input/TagPicker.cjs +1 -1
  111. package/dist/components/input/TagPicker.cjs.map +1 -1
  112. package/dist/components/input/TagPicker.mjs +154 -123
  113. package/dist/components/input/TagPicker.mjs.map +1 -1
  114. package/dist/components/input/Textarea.cjs +1 -1
  115. package/dist/components/input/Textarea.cjs.map +1 -1
  116. package/dist/components/input/Textarea.mjs +28 -21
  117. package/dist/components/input/Textarea.mjs.map +1 -1
  118. package/dist/components/input/TimePicker.cjs +1 -1
  119. package/dist/components/input/TimePicker.cjs.map +1 -1
  120. package/dist/components/input/TimePicker.mjs +204 -199
  121. package/dist/components/input/TimePicker.mjs.map +1 -1
  122. package/dist/components/input/dateUtils.cjs +1 -1
  123. package/dist/components/input/dateUtils.cjs.map +1 -1
  124. package/dist/components/input/dateUtils.mjs +114 -96
  125. package/dist/components/input/dateUtils.mjs.map +1 -1
  126. package/dist/components/input/fieldLabel.cjs +2 -0
  127. package/dist/components/input/fieldLabel.cjs.map +1 -0
  128. package/dist/components/input/fieldLabel.mjs +17 -0
  129. package/dist/components/input/fieldLabel.mjs.map +1 -0
  130. package/dist/components/input/inputLook.cjs +2 -0
  131. package/dist/components/input/inputLook.cjs.map +1 -0
  132. package/dist/components/input/inputLook.mjs +28 -0
  133. package/dist/components/input/inputLook.mjs.map +1 -0
  134. package/dist/components/input/pickerLabels.cjs +2 -0
  135. package/dist/components/input/pickerLabels.cjs.map +1 -0
  136. package/dist/components/input/pickerLabels.mjs +16 -0
  137. package/dist/components/input/pickerLabels.mjs.map +1 -0
  138. package/dist/components/input/pickerStyles.cjs +1 -1
  139. package/dist/components/input/pickerStyles.cjs.map +1 -1
  140. package/dist/components/input/pickerStyles.mjs +42 -4
  141. package/dist/components/input/pickerStyles.mjs.map +1 -1
  142. package/dist/components/input/pickerValues.cjs +2 -0
  143. package/dist/components/input/pickerValues.cjs.map +1 -0
  144. package/dist/components/input/pickerValues.mjs +24 -0
  145. package/dist/components/input/pickerValues.mjs.map +1 -0
  146. package/dist/components/navigation/Menu.popover.cjs +1 -1
  147. package/dist/components/navigation/Menu.popover.cjs.map +1 -1
  148. package/dist/components/navigation/Menu.popover.mjs +10 -10
  149. package/dist/components/navigation/Menu.root.cjs +1 -1
  150. package/dist/components/navigation/Menu.root.cjs.map +1 -1
  151. package/dist/components/navigation/Menu.root.mjs +10 -10
  152. package/dist/components/overlays/Popover.cjs +1 -1
  153. package/dist/components/overlays/Popover.cjs.map +1 -1
  154. package/dist/components/overlays/Popover.mjs +203 -208
  155. package/dist/components/overlays/Popover.mjs.map +1 -1
  156. package/dist/components/overlays/Popover.shared.cjs +1 -1
  157. package/dist/components/overlays/Popover.shared.cjs.map +1 -1
  158. package/dist/components/overlays/Popover.shared.mjs +82 -77
  159. package/dist/components/overlays/Popover.shared.mjs.map +1 -1
  160. package/dist/components/provider/WaveProvider.cjs +1 -1
  161. package/dist/components/provider/WaveProvider.cjs.map +1 -1
  162. package/dist/components/provider/WaveProvider.mjs +25 -19
  163. package/dist/components/provider/WaveProvider.mjs.map +1 -1
  164. package/dist/components/table/useGridNavigation.cjs +1 -1
  165. package/dist/components/table/useGridNavigation.cjs.map +1 -1
  166. package/dist/components/table/useGridNavigation.mjs +67 -70
  167. package/dist/components/table/useGridNavigation.mjs.map +1 -1
  168. package/dist/hooks/useActiveDescendant.cjs +2 -0
  169. package/dist/hooks/useActiveDescendant.cjs.map +1 -0
  170. package/dist/hooks/useActiveDescendant.mjs +56 -0
  171. package/dist/hooks/useActiveDescendant.mjs.map +1 -0
  172. package/dist/hooks/useFieldControl.cjs.map +1 -1
  173. package/dist/hooks/useFieldControl.mjs.map +1 -1
  174. package/dist/hooks/useListbox.cjs +1 -1
  175. package/dist/hooks/useListbox.cjs.map +1 -1
  176. package/dist/hooks/useListbox.mjs +250 -210
  177. package/dist/hooks/useListbox.mjs.map +1 -1
  178. package/dist/hooks/useRovingGrid.cjs +2 -0
  179. package/dist/hooks/useRovingGrid.cjs.map +1 -0
  180. package/dist/hooks/useRovingGrid.mjs +69 -0
  181. package/dist/hooks/useRovingGrid.mjs.map +1 -0
  182. package/dist/index.cjs +1 -1
  183. package/dist/index.d.cts +2901 -203
  184. package/dist/index.d.ts +2901 -203
  185. package/dist/index.mjs +107 -99
  186. package/dist/lib/classNames.cjs +1 -1
  187. package/dist/lib/classNames.cjs.map +1 -1
  188. package/dist/lib/classNames.mjs +111 -67
  189. package/dist/lib/classNames.mjs.map +1 -1
  190. package/dist/lib/date.cjs +2 -0
  191. package/dist/lib/date.cjs.map +1 -0
  192. package/dist/lib/date.mjs +44 -0
  193. package/dist/lib/date.mjs.map +1 -0
  194. package/dist/lib/focus.cjs +1 -1
  195. package/dist/lib/focus.cjs.map +1 -1
  196. package/dist/lib/focus.mjs +5 -2
  197. package/dist/lib/focus.mjs.map +1 -1
  198. package/dist/lib/layers.cjs.map +1 -1
  199. package/dist/lib/layers.mjs.map +1 -1
  200. package/dist/lib/styles.cjs +1 -1
  201. package/dist/lib/styles.cjs.map +1 -1
  202. package/dist/lib/styles.mjs +21 -4
  203. package/dist/lib/styles.mjs.map +1 -1
  204. package/dist/styles.css +1 -1
  205. package/package.json +1 -1
  206. package/src/styles/tokens.css +13 -0
@@ -1,21 +1,23 @@
1
1
  "use client";
2
2
  import { cn as e } from "../../lib/cn.mjs";
3
- import { composeEventHandlers as t } from "../../lib/composeEventHandlers.mjs";
4
- import { optionClassNames as n, optionGroupClassNames as r } from "../../lib/classNames.mjs";
5
- import { useId as i } from "../../hooks/useId.mjs";
6
- import { useMergedRefs as a } from "../../hooks/useMergedRefs.mjs";
7
- import { useDismiss as o } from "../../hooks/useDismiss.mjs";
8
- import { Portal as s } from "../portal/Portal.mjs";
9
- import { forcedColors as c } from "../../lib/styles.mjs";
10
- import { CheckIcon as l } from "../../lib/icons.mjs";
11
- import { ListboxContext as u, markListboxElement as d, useListboxOption as f } from "../../hooks/useListbox.mjs";
12
- import { usePopupPosition as p } from "../../hooks/usePopupPosition.mjs";
13
- import * as m from "react";
14
- import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
3
+ import { hasWarned as t, isDev as n, warnOnce as r } from "../../lib/dev.mjs";
4
+ import { materialiseSlotContent as i, renderSlot as a, slotRendersContent as o } from "../../lib/slot.mjs";
5
+ import { composeEventHandlers as s } from "../../lib/composeEventHandlers.mjs";
6
+ import { listboxSurfaceClassNames as c, optionClassNames as l, optionGroupClassNames as u } from "../../lib/classNames.mjs";
7
+ import { useId as d } from "../../hooks/useId.mjs";
8
+ import { useMergedRefs as f } from "../../hooks/useMergedRefs.mjs";
9
+ import { ListboxContext as p, markListboxElement as m, useListboxOption as h } from "../../hooks/useListbox.mjs";
10
+ import { useDismiss as g } from "../../hooks/useDismiss.mjs";
11
+ import { Portal as _ } from "../portal/Portal.mjs";
12
+ import { forcedColors as v } from "../../lib/styles.mjs";
13
+ import { CheckIcon as y } from "../../lib/icons.mjs";
14
+ import { usePopupPosition as b } from "../../hooks/usePopupPosition.mjs";
15
+ import * as x from "react";
16
+ import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
15
17
  //#region src/components/input/Option.tsx
16
- var v = m.createContext(!0);
17
- v.displayName = "OptionCheckContext";
18
- var y = e("flex cursor-pointer select-none items-center gap-2 px-3 py-1.5 text-body-1 text-foreground", "bg-(--option-bg) [--option-bg:transparent]", "not-disabled:not-aria-disabled:hover:[--option-bg:var(--wave-subtle-hover)]", "data-[selected]:[--option-bg:var(--wave-subtle-selected)]", "data-[active]:[--option-bg:var(--wave-subtle-hover)]", "data-[active]:outline-2 data-[active]:-outline-offset-2 data-[active]:outline-ring", "aria-disabled:cursor-not-allowed aria-disabled:text-muted-foreground"), b = class {
18
+ var T = x.createContext(!0);
19
+ T.displayName = "OptionCheckContext";
20
+ var E = e("flex cursor-pointer select-none items-center gap-2 px-3 py-1.5 text-body-1 text-foreground", "bg-(--option-bg) [--option-bg:transparent]", "not-disabled:not-aria-disabled:hover:[--option-bg:var(--wave-subtle-hover)]", "data-[selected]:[--option-bg:var(--wave-subtle-selected)]", "data-[active]:[--option-bg:var(--wave-subtle-hover)]", "data-[active]:outline-2 data-[active]:-outline-offset-2 data-[active]:outline-ring", "aria-disabled:cursor-not-allowed aria-disabled:text-muted-foreground"), D = class {
19
21
  counts = /* @__PURE__ */ new Map();
20
22
  listeners = /* @__PURE__ */ new Set();
21
23
  subscribe = (e) => (this.listeners.add(e), () => {
@@ -35,13 +37,13 @@ var y = e("flex cursor-pointer select-none items-center gap-2 px-3 py-1.5 text-b
35
37
  notify() {
36
38
  for (let e of [...this.listeners]) e();
37
39
  }
38
- }, x = m.createContext([]);
39
- x.displayName = "OptionGroupContext";
40
- var S = m.createContext(!1);
41
- S.displayName = "OptionGroupHiddenContext";
42
- function C(e) {
43
- let t = m.useContext(x);
44
- m.useLayoutEffect(() => {
40
+ }, O = x.createContext([]);
41
+ O.displayName = "OptionGroupContext";
42
+ var k = x.createContext(!1);
43
+ k.displayName = "OptionGroupHiddenContext";
44
+ function A(e) {
45
+ let t = x.useContext(O);
46
+ x.useLayoutEffect(() => {
45
47
  if (t.length === 0) return;
46
48
  let n = t.map((t) => t.add(e));
47
49
  return () => {
@@ -49,123 +51,182 @@ function C(e) {
49
51
  };
50
52
  }, [t, e]);
51
53
  }
52
- function w(r) {
53
- let { value: i, label: a, textValue: o, disabled: s = !1, hidden: u = !1, className: d, children: p, onClick: h, onPointerMove: b, ref: x, ...w } = r, T = m.useContext(v), E = m.useContext(S), { selected: D, optionProps: O } = f({
54
- value: i,
55
- label: a,
56
- textValue: o,
57
- disabled: s,
58
- hidden: u || E
59
- }, x);
60
- C(i);
61
- let { ref: k, onClick: A, onPointerMove: j, ...M } = O;
62
- return /* @__PURE__ */ _("li", {
63
- "data-value": i,
64
- ...w,
65
- ...M,
66
- ref: k,
67
- onClick: t(h, A),
68
- onPointerMove: t(b, j),
69
- className: e(n.root, y, D && c.selectedContainer, d),
70
- children: [T && /* @__PURE__ */ g(l, { className: e(n.checkIcon, "shrink-0", !D && "invisible") }), /* @__PURE__ */ g("span", {
71
- className: e(n.content, "min-w-0 flex-1"),
72
- children: p ?? i
54
+ var j = "forced-colors:border-[GrayText] forced-colors:bg-[Canvas]", M = "forced-colors:text-[GrayText] forced-colors:forced-color-adjust-none";
55
+ function N(t, { selected: n, multiselect: r, disabled: i }) {
56
+ if (!r) {
57
+ let r = e(l.checkIcon, "shrink-0", !n && "invisible");
58
+ return t === void 0 ? /* @__PURE__ */ C(y, { className: r }) : a(t, "span", e("inline-flex", r), { "aria-hidden": !0 });
59
+ }
60
+ let o;
61
+ o = i ? e("border-current bg-transparent", j) : n ? e("border-primary bg-primary text-primary-foreground", v.selectedLeaf) : e("border-stroke-accessible bg-transparent", v.control);
62
+ let s = i ? M : void 0;
63
+ return /* @__PURE__ */ C("span", {
64
+ "aria-hidden": "true",
65
+ "data-wave-option-box": "",
66
+ className: e(l.indicator, "flex h-4 w-4 shrink-0 items-center justify-center rounded-xs border", o),
67
+ children: n && (t === void 0 ? /* @__PURE__ */ C(y, {
68
+ size: 12,
69
+ className: e(l.checkIcon, s)
70
+ }) : a(t, "span", e(l.checkIcon, "inline-flex shrink-0", s), { "aria-hidden": !0 }))
71
+ });
72
+ }
73
+ function P(t) {
74
+ let { value: n, label: i, textValue: a, disabled: c = !1, hidden: u = !1, checkIcon: d, className: f, children: p, onClick: m, onMouseDown: g, onPointerMove: _, ref: y, ...b } = t, S = x.useContext(T), D = x.useContext(k), { selected: O, multiselect: j, optionProps: M } = h({
75
+ value: n,
76
+ label: i,
77
+ textValue: a,
78
+ disabled: c,
79
+ hidden: u || D
80
+ }, y);
81
+ A(n);
82
+ let { ref: P, onClick: F, onMouseDown: I, onPointerMove: L, ...R } = M, z = d != null && o(d), B = d != null && !z;
83
+ return x.useEffect(() => {
84
+ B && r("Option:checkIcon-empty", "Option: `checkIcon` renders nothing, so the default check shows: a selected option must show its state. Pass a glyph, or leave it unset.");
85
+ }, [B]), /* @__PURE__ */ w("li", {
86
+ "data-value": n,
87
+ ...b,
88
+ ...R,
89
+ ref: P,
90
+ onClick: s(m, F),
91
+ onMouseDown: s(g, I),
92
+ onPointerMove: s(_, L),
93
+ className: e(l.root, E, O && !(j && S) && v.selectedContainer, f),
94
+ children: [S && N(z ? d : void 0, {
95
+ selected: O,
96
+ multiselect: j,
97
+ disabled: c
98
+ }), /* @__PURE__ */ C("span", {
99
+ className: e(l.content, "min-w-0 flex-1"),
100
+ children: p ?? n
73
101
  })]
74
102
  });
75
103
  }
76
- w.displayName = "Option";
77
- var T = /* @__PURE__ */ m.memo(w);
78
- T.displayName = "Option";
79
- var E = /* @__PURE__ */ d(T, "option");
80
- function D({ label: t, className: n, children: a, hidden: o, ref: s, ...c }) {
81
- let l = i("option-group"), d = m.useContext(u)?.store, f = m.useContext(x), p = m.useContext(S) || !!o, [h] = m.useState(() => new b()), v = m.useMemo(() => [...f, h], [f, h]), y = m.useCallback((e) => {
82
- let t = h.subscribe(e), n = d?.subscribe(e);
104
+ P.displayName = "Option";
105
+ var F = /* @__PURE__ */ x.memo(P);
106
+ F.displayName = "Option";
107
+ var I = /* @__PURE__ */ m(F, "option"), L = 1, R = 3;
108
+ function z(e) {
109
+ if (e === null) return "";
110
+ if (e.nodeType === R) return e.textContent ?? "";
111
+ if (e.nodeType !== L) return "";
112
+ let t = e;
113
+ if (t.getAttribute("aria-hidden") === "true" || t.hasAttribute("hidden")) return "";
114
+ let n = t.getAttribute("aria-label")?.trim();
115
+ if (n) return n;
116
+ if (t.localName === "img") return t.getAttribute("alt") ?? "";
117
+ let r = "";
118
+ for (let e of Array.from(t.childNodes)) r += z(e);
119
+ return r;
120
+ }
121
+ function B(e, t, n, r, i) {
122
+ return n !== void 0 && n !== r && n.trim() !== "" || t !== void 0 && t.trim() !== "" ? !0 : n === r ? typeof e == "string" || typeof e == "number" ? String(e).trim() !== "" : z(i).trim() !== "" : !1;
123
+ }
124
+ var V = "OptionGroup:unnamed";
125
+ function H({ label: a, className: s, children: c, hidden: l, "aria-label": f, "aria-labelledby": m, ref: h, ...g }) {
126
+ let _ = d("option-group"), v = x.useContext(p)?.store, y = x.useContext(O), b = x.useContext(k) || !!l, [S] = x.useState(() => new D()), T = x.useMemo(() => [...y, S], [y, S]), E = x.useCallback((e) => {
127
+ let t = S.subscribe(e), n = v?.subscribe(e);
83
128
  return () => {
84
129
  t(), n?.();
85
130
  };
86
- }, [h, d]), C = m.useSyncExternalStore(y, () => h.allHidden(d), () => !1);
87
- return /* @__PURE__ */ _("li", {
88
- ...c,
89
- ref: s,
131
+ }, [S, v]), A = x.useSyncExternalStore(E, () => S.allHidden(v), () => !1), j = o(a), M = m ?? (f === void 0 && j ? _ : void 0), N = x.useRef(null);
132
+ return x.useEffect(() => {
133
+ n && !t(V) && (B(a, f, M, _, N.current) || r(V, "OptionGroup: the group has no name. Give it a text `label`, `aria-label` or `aria-labelledby`."));
134
+ }, [
135
+ a,
136
+ f,
137
+ M,
138
+ _
139
+ ]), /* @__PURE__ */ w("li", {
140
+ ...g,
141
+ ref: h,
90
142
  role: "presentation",
91
- hidden: o || C || void 0,
92
- className: e(r.root, n),
93
- children: [/* @__PURE__ */ g("div", {
94
- id: l,
143
+ hidden: l || A || void 0,
144
+ className: e(u.root, s),
145
+ children: [j && /* @__PURE__ */ C("div", {
146
+ ref: N,
147
+ id: _,
95
148
  role: "presentation",
96
- className: e(r.label, "px-3 py-1 text-caption-1 font-semibold text-muted-foreground"),
97
- children: t
98
- }), /* @__PURE__ */ g("ul", {
149
+ className: e(u.label, "px-3 py-1 text-caption-1 font-semibold text-muted-foreground"),
150
+ children: i(a)
151
+ }), /* @__PURE__ */ C("ul", {
99
152
  role: "group",
100
- "aria-labelledby": l,
101
- className: r.list,
102
- children: /* @__PURE__ */ g(S.Provider, {
103
- value: p,
104
- children: /* @__PURE__ */ g(x.Provider, {
105
- value: v,
106
- children: a
153
+ "aria-label": f,
154
+ "aria-labelledby": M,
155
+ className: u.list,
156
+ children: /* @__PURE__ */ C(k.Provider, {
157
+ value: b,
158
+ children: /* @__PURE__ */ C(O.Provider, {
159
+ value: T,
160
+ children: c
107
161
  })
108
162
  })
109
163
  })]
110
164
  });
111
165
  }
112
- D.displayName = "OptionGroup";
113
- var O = /* @__PURE__ */ d(D, "group");
114
- function k(e) {
115
- let { open: t, surfaceOpen: n, onDismiss: r, rootRef: i, anchorRef: s } = e, c = m.useRef(null), { setReference: l, setFloating: u, floatingProps: d } = p({
166
+ H.displayName = "OptionGroup";
167
+ var U = /* @__PURE__ */ m(H, "group");
168
+ function W({ value: e, children: t }) {
169
+ return /* @__PURE__ */ C(p.Provider, {
170
+ value: e,
171
+ children: t
172
+ });
173
+ }
174
+ W.displayName = "ListboxProvider";
175
+ function G(e) {
176
+ let { open: t, surfaceOpen: n, onDismiss: r, rootRef: i, anchorRef: a } = e, o = x.useRef(null), { setReference: s, setFloating: c, floatingProps: l } = b({
116
177
  open: n,
117
178
  side: "bottom",
118
179
  align: "start",
119
180
  matchReferenceWidth: !0,
120
181
  fitViewport: !0
121
- }), { layerId: f } = o({
182
+ }), { layerId: u } = g({
122
183
  open: t,
123
184
  onDismiss: (e) => r(e),
124
- refs: [i, c],
125
- anchorRef: s,
185
+ refs: [i, o],
186
+ anchorRef: a,
126
187
  kind: "listbox",
127
188
  escape: n,
128
189
  focusOutside: !0
129
190
  });
130
191
  return {
131
- layerId: f,
132
- setReference: l,
133
- surfaceRef: a(c, u),
134
- floatingProps: d
192
+ layerId: u,
193
+ setReference: s,
194
+ surfaceRef: f(o, c),
195
+ floatingProps: l
135
196
  };
136
197
  }
137
- function A(e) {
198
+ function K(e) {
138
199
  e.preventDefault();
139
200
  }
140
- function j(t) {
141
- let { listbox: n, layerId: r, surfaceRef: i, floatingProps: a, open: o, expanded: c, emptyContent: l, "aria-label": d, "aria-labelledby": f, showCheck: p = !0, listboxClassName: m, surfaceClassName: y, children: b } = t, x = /* @__PURE__ */ g(v.Provider, {
142
- value: p,
143
- children: /* @__PURE__ */ g(u.Provider, {
201
+ function q(t) {
202
+ let { listbox: n, layerId: r, surfaceRef: i, floatingProps: a, open: o, expanded: s, emptyContent: l, "aria-label": u, "aria-labelledby": d, showCheck: f = !0, listClassName: p, surfaceClassName: m, children: h } = t, g = /* @__PURE__ */ C(T.Provider, {
203
+ value: f,
204
+ children: /* @__PURE__ */ C(W, {
144
205
  value: n.context,
145
- children: /* @__PURE__ */ g("ul", {
206
+ children: /* @__PURE__ */ C("ul", {
146
207
  ...n.getListboxProps(),
147
- "aria-label": d,
148
- "aria-labelledby": f,
149
- hidden: !c || void 0,
150
- className: e(m, "min-h-0 max-h-60 overflow-auto"),
151
- children: b
208
+ "aria-label": u,
209
+ "aria-labelledby": d,
210
+ hidden: !s || void 0,
211
+ className: e(c.list, "min-h-0 max-h-60 overflow-auto", p),
212
+ children: h
152
213
  })
153
214
  })
154
215
  });
155
- return !c && (!o || c || l == null) ? x : /* @__PURE__ */ _(h, { children: [!c && x, /* @__PURE__ */ g(s, {
216
+ return !s && (!o || s || l == null) ? g : /* @__PURE__ */ w(S, { children: [!s && g, /* @__PURE__ */ C(_, {
156
217
  layerId: r,
157
- children: /* @__PURE__ */ g("div", {
218
+ children: /* @__PURE__ */ C("div", {
158
219
  ref: i,
159
220
  ...a,
160
221
  "data-wave-listbox-surface": "",
161
- onMouseDown: A,
162
- className: e(y, "flex flex-col overflow-hidden rounded border border-border bg-background py-1 text-foreground shadow-4"),
163
- children: c ? x : l
222
+ onMouseDown: K,
223
+ className: e(c.root, "flex flex-col overflow-hidden rounded border border-border bg-background py-1 text-foreground shadow-4", m),
224
+ children: s ? g : l
164
225
  })
165
226
  })] });
166
227
  }
167
- j.displayName = "ListboxSurface";
228
+ q.displayName = "ListboxSurface";
168
229
  //#endregion
169
- export { j as ListboxSurface, E as Option, O as OptionGroup, k as useListboxPopup };
230
+ export { W as ListboxProvider, q as ListboxSurface, I as Option, U as OptionGroup, G as useListboxPopup };
170
231
 
171
232
  //# sourceMappingURL=Option.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Option.mjs","names":["useId","_Fragment","useId$1","React","OptionCheckContext","OPTION_CLASSES","cn","OptionGroupMembers","listener","value","count","store","OptionGroupContext","OptionGroupHiddenContext","useOptionGroupMembership","groups","removes","group","remove","OptionImpl","rest","props","showCheck","groupHidden","useListboxOption","hidden","ref","optionRef","selectOption","highlightOption","optionAttributes","optionProps","composeEventHandlers","onClick","onPointerMove","optionClassNames","selected","forcedColors","className","CheckIcon","children","MemoOption","Option","OptionGroupImpl","labelId","ListboxContext","parentGroups","hiddenByConsumer","members","subscribe","unsubscribeMembers","unsubscribeStore","empty","optionGroupClassNames","label","OptionGroup","useListboxPopup","options","surfaceElementRef","usePopupPosition","surfaceOpen","useDismiss","onDismiss","reason","rootRef","useMergedRefs","setFloating","preventMouseDown","ListboxSurface","ariaLabel","ariaLabelledBy","list","listbox","expanded","listboxClassName","emptyContent","Fragment","Portal","surfaceRef","floatingProps","surfaceClassName"],"sources":["../../../src/components/input/Option.tsx"],"sourcesContent":["import * as React from 'react';\nimport { optionClassNames, optionGroupClassNames } from '../../lib/classNames';\nimport { cn } from '../../lib/cn';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport { CheckIcon } from '../../lib/icons';\nimport { forcedColors } from '../../lib/styles';\nimport { useId } from '../../hooks/useId';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { useDismiss } from '../../hooks/useDismiss';\nimport type { DismissReason } from '../../hooks/useDismiss';\nimport { usePopupPosition } from '../../hooks/usePopupPosition';\nimport {\n ListboxContext,\n markListboxElement,\n useListboxOption,\n type ListboxStore,\n type UseListboxResult,\n} from '../../hooks/useListbox';\nimport { Portal } from '../portal/Portal';\n\n/* ------------------------------------------------------------------ */\n/* Option */\n/* ------------------------------------------------------------------ */\n\n/** Properties for the Option component used within Combobox and Dropdown. */\nexport interface OptionProps extends Omit<React.LiHTMLAttributes<HTMLLIElement>, 'value'> {\n /** Value associated with this option. Unique within its listbox. */\n value: string;\n /**\n * Text shown in the combobox (Combobox input, Dropdown trigger) when this option is selected.\n * Defaults to `textValue`, then the option's text content, then `value`. Pass it when the\n * children are not plain text (icons, custom components).\n */\n label?: string;\n /** Text matched by typeahead and filtering instead of the label. */\n textValue?: string;\n /**\n * Whether the option is disabled: it stays visible but is skipped by keyboard navigation and\n * cannot be selected.\n * @default false\n */\n disabled?: boolean;\n /**\n * Hides the option, like a native `<option hidden>`: it is not shown, keyboard navigation and\n * typeahead skip it, and it never becomes the active option. Its label stays known, so a\n * selected hidden option (a placeholder) still shows in the combobox. The options of a hidden\n * `OptionGroup` are hidden the same way.\n * @default false\n */\n hidden?: boolean;\n /** Ref to the option `<li>` element. */\n ref?: React.Ref<HTMLLIElement>;\n}\n\n/** Whether options draw the selected check mark (P05-internal; TagPicker lists no selected options). */\nconst OptionCheckContext = React.createContext(true);\nOptionCheckContext.displayName = 'OptionCheckContext';\n\n/*\n * State is exposed as data attributes (C-CLASS): `data-active` (keyboard/pointer highlight),\n * `data-selected`, `data-disabled`. State classes come before the consumer's `className` in `cn()`.\n *\n * Backgrounds (input-pickers#20): one unconditional `bg-(--option-bg)` paints the option, and the\n * hover/selected/active variants only set `--option-bg`. A variant that set `background-color`\n * itself (class + attribute or pseudo-class) would out-specify a consumer's plain `bg-*` class in\n * the cascade even though `cn()` keeps it; instead tailwind-merge replaces `bg-(--option-bg)` with\n * the consumer's class, which is then the only background declaration on the option. A consumer\n * `data-[active]:bg-…` / `data-[selected]:bg-…` restyles a single state (it out-specifies the\n * unconditional reader). The active outline is the focus indicator and stays a state variant.\n *\n * A filtered-out option carries the `hidden` attribute; base.css's scoped `[hidden]` rule hides\n * it over `flex` and over a consumer's display class.\n */\nconst OPTION_CLASSES = cn(\n 'flex cursor-pointer select-none items-center gap-2 px-3 py-1.5 text-body-1 text-foreground',\n 'bg-(--option-bg) [--option-bg:transparent]',\n 'not-disabled:not-aria-disabled:hover:[--option-bg:var(--wave-subtle-hover)]',\n 'data-[selected]:[--option-bg:var(--wave-subtle-selected)]',\n 'data-[active]:[--option-bg:var(--wave-subtle-hover)]',\n 'data-[active]:outline-2 data-[active]:-outline-offset-2 data-[active]:outline-ring',\n 'aria-disabled:cursor-not-allowed aria-disabled:text-muted-foreground',\n);\n\n/**\n * The values of the options rendered inside an `OptionGroup`, whatever wraps them (custom\n * components, Fragments, nested groups): each option adds its value from a layout effect.\n */\nclass OptionGroupMembers {\n private readonly counts = new Map<string, number>();\n private readonly listeners = new Set<() => void>();\n\n subscribe = (listener: () => void): (() => void) => {\n this.listeners.add(listener);\n return () => {\n this.listeners.delete(listener);\n };\n };\n\n add(value: string): () => void {\n this.counts.set(value, (this.counts.get(value) ?? 0) + 1);\n this.notify();\n return () => {\n const count = (this.counts.get(value) ?? 1) - 1;\n if (count > 0) this.counts.set(value, count);\n else this.counts.delete(value);\n this.notify();\n };\n }\n\n /** At least one option, and every one of them is hidden (filtered out, or by the consumer). */\n allHidden(store: ListboxStore | undefined): boolean {\n if (store === undefined || this.counts.size === 0) return false;\n for (const value of this.counts.keys()) if (!store.isHidden(value)) return false;\n return true;\n }\n\n private notify(): void {\n for (const listener of [...this.listeners]) listener();\n }\n}\n\n/** The groups around an option, outermost first (P05-internal). */\nconst OptionGroupContext = React.createContext<readonly OptionGroupMembers[]>([]);\nOptionGroupContext.displayName = 'OptionGroupContext';\n\n/** A group around the option has the consumer's `hidden` attribute (P05-internal). */\nconst OptionGroupHiddenContext = React.createContext(false);\nOptionGroupHiddenContext.displayName = 'OptionGroupHiddenContext';\n\n/** Adds an option's value to every group around it while the option is mounted. */\nfunction useOptionGroupMembership(value: string): void {\n const groups = React.useContext(OptionGroupContext);\n React.useLayoutEffect(() => {\n if (groups.length === 0) return;\n const removes = groups.map((group) => group.add(value));\n return () => {\n for (const remove of removes) remove();\n };\n }, [groups, value]);\n}\n\nfunction OptionImpl(props: OptionProps) {\n const {\n value,\n label,\n textValue,\n disabled = false,\n hidden = false,\n className,\n children,\n onClick,\n onPointerMove,\n ref,\n ...rest\n } = props;\n const showCheck = React.useContext(OptionCheckContext);\n const groupHidden = React.useContext(OptionGroupHiddenContext);\n // A consumer-hidden option is not navigable; optionProps renders `hidden`.\n const { selected, optionProps } = useListboxOption<HTMLLIElement>(\n { value, label, textValue, disabled, hidden: hidden || groupHidden },\n ref,\n );\n useOptionGroupMembership(value);\n const {\n ref: optionRef,\n onClick: selectOption,\n onPointerMove: highlightOption,\n ...optionAttributes\n } = optionProps;\n\n return (\n <li\n data-value={value}\n {...rest}\n {...optionAttributes}\n ref={optionRef}\n onClick={composeEventHandlers(onClick, selectOption)}\n onPointerMove={composeEventHandlers(onPointerMove, highlightOption)}\n className={cn(\n optionClassNames.root,\n OPTION_CLASSES,\n selected && forcedColors.selectedContainer,\n className,\n )}\n >\n {showCheck && (\n <CheckIcon\n className={cn(optionClassNames.checkIcon, 'shrink-0', !selected && 'invisible')}\n />\n )}\n <span className={cn(optionClassNames.content, 'min-w-0 flex-1')}>{children ?? value}</span>\n </li>\n );\n}\nOptionImpl.displayName = 'Option';\n\nconst MemoOption = /* @__PURE__ */ React.memo(OptionImpl);\nMemoOption.displayName = 'Option';\n\n/**\n * An option of a `Combobox`, `Dropdown` (and `TagPicker`'s generated list). Renders\n * `<li role=\"option\">` with a stable id (`aria-activedescendant` target), `aria-selected`, a check\n * mark while selected and `data-active`/`data-selected`/`data-disabled` attributes for styling.\n *\n * Options register with the surrounding listbox (in DOM order, groups included), so they can be\n * wrapped, grouped or rendered conditionally. The option is memoized: moving the highlight\n * re-renders only the previously and the newly active option.\n *\n * Styling: `className` comes last. A plain background class (`className=\"bg-primary\"`) replaces\n * the built-in hover, selected and active backgrounds in every state. To restyle one state only,\n * use its data variant (`data-[active]:bg-…`, `data-[selected]:bg-…`). The active option keeps\n * its focus outline.\n *\n * Use it inside a `Combobox` or `Dropdown` only; it throws in development elsewhere.\n */\nexport const Option: React.NamedExoticComponent<OptionProps> = /* @__PURE__ */ markListboxElement(\n MemoOption,\n 'option',\n);\n\n/* ------------------------------------------------------------------ */\n/* OptionGroup */\n/* ------------------------------------------------------------------ */\n\n/** Properties for the OptionGroup component used to group options. */\nexport interface OptionGroupProps extends React.LiHTMLAttributes<HTMLLIElement> {\n /** Heading label for the option group (names the group). */\n label: string;\n /**\n * Hides the group and every option in it (see `Option`'s `hidden`): keyboard navigation and\n * typeahead skip its options.\n * @default false\n */\n hidden?: boolean;\n /** Ref to the group's `<li role=\"presentation\">` element. */\n ref?: React.Ref<HTMLLIElement>;\n}\n\nfunction OptionGroupImpl({ label, className, children, hidden, ref, ...rest }: OptionGroupProps) {\n const labelId = useId('option-group');\n const store = React.useContext(ListboxContext)?.store;\n const parentGroups = React.useContext(OptionGroupContext);\n const hiddenByConsumer = React.useContext(OptionGroupHiddenContext) || !!hidden;\n const [members] = React.useState(() => new OptionGroupMembers());\n const groups = React.useMemo(() => [...parentGroups, members], [parentGroups, members]);\n const subscribe = React.useCallback(\n (listener: () => void) => {\n const unsubscribeMembers = members.subscribe(listener);\n const unsubscribeStore = store?.subscribe(listener);\n return () => {\n unsubscribeMembers();\n unsubscribeStore?.();\n };\n },\n [members, store],\n );\n // Hidden while every option inside it is filtered out or hidden, also options wrapped in a\n // component (the options register with the group; re-read when they do and when the listbox\n // state changes).\n // The server render and the first client render show the group: no option has registered yet.\n const empty = React.useSyncExternalStore(\n subscribe,\n () => members.allHidden(store),\n () => false,\n );\n\n return (\n <li\n {...rest}\n ref={ref}\n role=\"presentation\"\n hidden={hidden || empty || undefined}\n className={cn(optionGroupClassNames.root, className)}\n >\n <div\n id={labelId}\n role=\"presentation\"\n className={cn(\n optionGroupClassNames.label,\n 'px-3 py-1 text-caption-1 font-semibold text-muted-foreground',\n )}\n >\n {label}\n </div>\n <ul role=\"group\" aria-labelledby={labelId} className={optionGroupClassNames.list}>\n <OptionGroupHiddenContext.Provider value={hiddenByConsumer}>\n <OptionGroupContext.Provider value={groups}>{children}</OptionGroupContext.Provider>\n </OptionGroupHiddenContext.Provider>\n </ul>\n </li>\n );\n}\nOptionGroupImpl.displayName = 'OptionGroup';\n\n/**\n * Groups options under a heading: `<li role=\"presentation\">` with the heading and a\n * `<ul role=\"group\" aria-labelledby>` of the options. Hidden while a filter (or their own `hidden`)\n * hides all its options, also options wrapped in a component or in nested groups.\n */\nexport const OptionGroup: React.FC<OptionGroupProps> = /* @__PURE__ */ markListboxElement(\n OptionGroupImpl,\n 'group',\n);\n\n/* ------------------------------------------------------------------ */\n/* Listbox popup (P05-internal, shared by Combobox, Dropdown, TagPicker) */\n/* ------------------------------------------------------------------ */\n\n/** Options of {@link useListboxPopup}. */\nexport interface UseListboxPopupOptions {\n /** The listbox is open (dismiss layer registered: outside press, focus outside). */\n open: boolean;\n /**\n * The portaled surface is shown: positioning runs and the layer takes Escape. While the listbox\n * is open with nothing shown (no options), Escape is left to an enclosing layer (overlays#1).\n */\n surfaceOpen: boolean;\n /** Close the listbox. */\n onDismiss: (reason: DismissReason) => void;\n /** The component root: presses and focus inside it are not \"outside\". */\n rootRef: React.RefObject<HTMLElement | null>;\n /** The combobox element (the layer's anchor). */\n anchorRef: React.RefObject<HTMLElement | null>;\n}\n\n/** Result of {@link useListboxPopup}. Destructure it (react-hooks/refs). */\nexport interface ListboxPopup {\n /** The dismiss layer id (pass to {@link ListboxSurface}). */\n layerId: string;\n /** Ref callback for the element the surface is positioned against. */\n setReference: (el: HTMLElement | null) => void;\n /** Ref callback for the surface. */\n surfaceRef: React.RefCallback<HTMLElement>;\n /** `data-side`, `data-align` and the position style for the surface. */\n floatingProps: { 'data-side': string; 'data-align': string; style: React.CSSProperties };\n}\n\n/**\n * Dismissal and positioning of a listbox surface (C-POPUPS, spec §5.4): `useDismiss` (Escape,\n * outside press, focus outside; `kind: 'listbox'`) and `usePopupPosition` (bottom-start, flip,\n * shift, the anchor's width, limited to the available space).\n */\nexport function useListboxPopup(options: UseListboxPopupOptions): ListboxPopup {\n const { open, surfaceOpen, onDismiss, rootRef, anchorRef } = options;\n const surfaceElementRef = React.useRef<HTMLElement | null>(null);\n const { setReference, setFloating, floatingProps } = usePopupPosition({\n open: surfaceOpen,\n side: 'bottom',\n align: 'start',\n matchReferenceWidth: true,\n fitViewport: true,\n });\n const { layerId } = useDismiss({\n open,\n onDismiss: (reason) => onDismiss(reason),\n refs: [rootRef, surfaceElementRef],\n anchorRef,\n kind: 'listbox',\n escape: surfaceOpen,\n focusOutside: true,\n });\n const surfaceRef = useMergedRefs<HTMLElement>(surfaceElementRef, setFloating);\n return { layerId, setReference, surfaceRef, floatingProps };\n}\n\n/** Props of {@link ListboxSurface}. */\nexport interface ListboxSurfaceProps {\n /** The listbox (from `useListbox`). */\n listbox: UseListboxResult;\n /** From {@link useListboxPopup}. */\n layerId: string;\n surfaceRef: React.RefCallback<HTMLElement>;\n floatingProps: ListboxPopup['floatingProps'];\n /** The listbox is open: `emptyContent` is shown only while it is (input-pickers#21). */\n open: boolean;\n /** The listbox is displayed: the list renders in the portaled surface. */\n expanded: boolean;\n /** While open but not expanded, show the surface with this content (e.g. \"No matches\"). */\n emptyContent?: React.ReactNode;\n /** Accessible name of the listbox. */\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n /** Options draw a check mark while selected. @default true */\n showCheck?: boolean;\n /** The host's stable class for the listbox element (its `listbox` part). */\n listboxClassName?: string;\n /** The host's stable class for the portaled surface (its `surface` part). */\n surfaceClassName?: string;\n children?: React.ReactNode;\n}\n\nfunction preventMouseDown(event: React.MouseEvent) {\n event.preventDefault();\n}\n\n/**\n * Renders the option list in a single container at a time (spec §2.5, §5.5): inline and `hidden`\n * inside the component root while closed (registration and ids exist from the first client\n * commit), and in a `Portal` surface while expanded — never both.\n */\nexport function ListboxSurface(props: ListboxSurfaceProps) {\n const {\n listbox,\n layerId,\n surfaceRef,\n floatingProps,\n open,\n expanded,\n emptyContent,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n showCheck = true,\n listboxClassName,\n surfaceClassName,\n children,\n } = props;\n\n const list = (\n <OptionCheckContext.Provider value={showCheck}>\n <ListboxContext.Provider value={listbox.context}>\n <ul\n {...listbox.getListboxProps()}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n hidden={!expanded || undefined}\n className={cn(listboxClassName, 'min-h-0 max-h-60 overflow-auto')}\n >\n {children}\n </ul>\n </ListboxContext.Provider>\n </OptionCheckContext.Provider>\n );\n\n // A closed listbox never leaves a surface behind: the text typed before closing survives it.\n const showEmpty = open && !expanded && emptyContent !== undefined && emptyContent !== null;\n if (!expanded && !showEmpty) return list;\n\n return (\n <>\n {!expanded && list}\n <Portal layerId={layerId}>\n <div\n ref={surfaceRef}\n {...floatingProps}\n data-wave-listbox-surface=\"\"\n onMouseDown={preventMouseDown}\n className={cn(\n surfaceClassName,\n 'flex flex-col overflow-hidden rounded border border-border bg-background py-1 text-foreground shadow-4',\n )}\n >\n {expanded ? list : emptyContent}\n </div>\n </Portal>\n </>\n );\n}\nListboxSurface.displayName = 'ListboxSurface';\n"],"mappings":";;;;;;;;;;;;;;;AAuDA,IAAMI,IAAqBD,EAAM,cAAc,EAAI;AACnD,EAAmB,cAAc;AAiBjC,IAAME,IAAiBC,EACrB,8FACA,8CACA,+EACA,6DACA,wDACA,sFACA,sEACF,GAMMC,IAAN,MAAyB;CACvB,yBAA0B,IAAI,IAAoB;CAClD,4BAA6B,IAAI,IAAgB;CAEjD,aAAa,OACX,KAAK,UAAU,IAAIC,CAAQ,SACd;EACX,KAAK,UAAU,OAAOA,CAAQ;CAChC;CAGF,IAAI,GAA2B;EAG7B,OAFA,KAAK,OAAO,IAAIC,IAAQ,KAAK,OAAO,IAAIA,CAAK,KAAK,KAAK,CAAC,GACxD,KAAK,OAAO,SACC;GACX,IAAMC,KAAS,KAAK,OAAO,IAAID,CAAK,KAAK,KAAK;GAG9C,AAFIC,IAAQ,IAAG,KAAK,OAAO,IAAID,GAAOC,CAAK,IACtC,KAAK,OAAO,OAAOD,CAAK,GAC7B,KAAK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KAAY,KAAA;IACrB,WAAWnE,EAAGoE,GAAkB,gCAAgC;IAE/D;GACC,CAAA;EACmB,CAAA;CACE,CAAA;CAO/B,OAFI,CAACD,MADa,MAASA,KAAYE,KAA+C,QAClDJ,IAGlC,kBAAAtE,GAAA,EAAA,UAAA,CACG,CAACwE,KAAYF,GACd,kBAACM,GAAD;EAAiB;EACf,UAAA,kBAAC,OAAD;GACE,KAAKC;GACL,GAAIC;GACJ,6BAA0B;GAC1B,aAAaZ;GACb,WAAW7D,EACT0E,GACA,wGACF;GAEC,UAAAP,IAAWF,IAAOI;EAChB,CAAA;CACC,CAAA,CACR,EAAA,CAAA;AAEN;AACA,EAAe,cAAc"}
1
+ {"version":3,"file":"Option.mjs","names":["useId","_Fragment","useId$1","React","OptionCheckContext","OPTION_CLASSES","cn","OptionGroupMembers","listener","value","count","store","OptionGroupContext","OptionGroupHiddenContext","useOptionGroupMembership","groups","removes","group","remove","DISABLED_BOX_FORCED_COLORS","DISABLED_GLYPH_FORCED_COLORS","renderCheck","multiselect","classes","optionClassNames","selected","glyph","CheckIcon","renderSlot","boxClasses","disabled","forcedColors","glyphClasses","OptionImpl","rest","props","showCheck","groupHidden","useListboxOption","hidden","ref","optionRef","selectOption","pressOption","highlightOption","optionAttributes","optionProps","checkIconRenders","checkIcon","slotRendersContent","checkIconEmpty","warnOnce","composeEventHandlers","onClick","onMouseDown","onPointerMove","className","children","MemoOption","Option","ELEMENT_NODE","TEXT_NODE","nameText","node","element","ownLabel","text","child","groupHasName","labelledBy","labelId","ariaLabel","label","heading","UNNAMED_GROUP_WARNING","OptionGroupImpl","ariaLabelledBy","ListboxContext","parentGroups","hiddenByConsumer","members","subscribe","unsubscribeMembers","unsubscribeStore","empty","hasLabel","headingRef","isDev","optionGroupClassNames","materialiseSlotContent","OptionGroup","ListboxProvider","useListboxPopup","options","surfaceElementRef","usePopupPosition","surfaceOpen","useDismiss","onDismiss","reason","rootRef","useMergedRefs","setFloating","preventMouseDown","ListboxSurface","list","listbox","expanded","listboxSurfaceClassNames","listClassName","emptyContent","Fragment","Portal","surfaceRef","floatingProps","surfaceClassName"],"sources":["../../../src/components/input/Option.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n listboxSurfaceClassNames,\n optionClassNames,\n optionGroupClassNames,\n} from '../../lib/classNames';\nimport { cn } from '../../lib/cn';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport { hasWarned, isDev, warnOnce } from '../../lib/dev';\nimport { CheckIcon } from '../../lib/icons';\nimport { materialiseSlotContent, renderSlot, slotRendersContent, type Slot } from '../../lib/slot';\nimport { forcedColors } from '../../lib/styles';\nimport { useId } from '../../hooks/useId';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { useDismiss } from '../../hooks/useDismiss';\nimport type { DismissReason } from '../../hooks/useDismiss';\nimport { usePopupPosition } from '../../hooks/usePopupPosition';\nimport {\n ListboxContext,\n markListboxElement,\n useListboxOption,\n type ListboxContextValue,\n type ListboxStore,\n type UseListboxResult,\n} from '../../hooks/useListbox';\nimport { Portal } from '../portal/Portal';\n\n/* ------------------------------------------------------------------ */\n/* Option */\n/* ------------------------------------------------------------------ */\n\n/**\n * Props of {@link Option}, an option of a listbox (Listbox, Combobox, Dropdown or a custom\n * picker's list).\n */\nexport interface OptionProps extends Omit<React.LiHTMLAttributes<HTMLLIElement>, 'value'> {\n /** Value associated with this option. Unique within its listbox. */\n value: string;\n /**\n * Text shown in the combobox (Combobox input, Dropdown trigger) when this option is selected.\n * Defaults to `textValue`, then the option's text content, then `value`. Pass it when the\n * children are not plain text (icons, custom components).\n */\n label?: string;\n /** Text matched by typeahead and filtering instead of the label. */\n textValue?: string;\n /**\n * Whether the option is disabled: it stays in the list but can never be selected (a click, Enter\n * and Space do nothing). Keyboard navigation and typeahead skip it, unless the listbox keeps\n * disabled options focusable (`disabledOptionsFocusable`), where they reach it. It is drawn in\n * the muted text colour, its check included: in a multi-select list the checkbox square takes\n * that colour instead of the brand colour, checked or not.\n * @default false\n */\n disabled?: boolean;\n /**\n * Replaces the check glyph that marks the option while it is selected (decorative,\n * `aria-hidden`); in a multi-select list the glyph is drawn inside the option's 16px checkbox\n * square. The check is a required indicator, the sign of the selection that does not rely on\n * colour: `null` and `undefined` keep the default glyph, and so does a value that renders\n * nothing (`false`, `''`, an empty array), which also logs a development warning. Unlike\n * `Combobox.expandIcon`, a value that renders nothing does not hide the indicator (Fluent's\n * `checkIcon={null}` removes it).\n * @default a check mark\n */\n checkIcon?: Slot<'span'>;\n /**\n * Hides the option, like a native `<option hidden>`: it is not shown, keyboard navigation and\n * typeahead skip it, and it never becomes the active option. Its label stays known, so a\n * selected hidden option (a placeholder) still shows in the combobox. The options of a hidden\n * `OptionGroup` are hidden the same way.\n * @default false\n */\n hidden?: boolean;\n /** Ref to the option `<li>` element. */\n ref?: React.Ref<HTMLLIElement>;\n}\n\n/** Whether options draw the selected check mark (P05-internal; TagPicker lists no selected options). */\nconst OptionCheckContext = React.createContext(true);\nOptionCheckContext.displayName = 'OptionCheckContext';\n\n/*\n * State is exposed as data attributes (C-CLASS): `data-active` (keyboard/pointer highlight),\n * `data-selected`, `data-disabled`. State classes come before the consumer's `className` in `cn()`.\n *\n * Backgrounds (input-pickers#20): one unconditional `bg-(--option-bg)` paints the option, and the\n * hover/selected/active variants only set `--option-bg`. A variant that set `background-color`\n * itself (class + attribute or pseudo-class) would out-specify a consumer's plain `bg-*` class in\n * the cascade even though `cn()` keeps it; instead tailwind-merge replaces `bg-(--option-bg)` with\n * the consumer's class, which is then the only background declaration on the option. A consumer\n * `data-[active]:bg-…` / `data-[selected]:bg-…` restyles a single state (it out-specifies the\n * unconditional reader). The active outline is the focus indicator and stays a state variant.\n *\n * A filtered-out option carries the `hidden` attribute; base.css's scoped `[hidden]` rule hides\n * it over `flex` and over a consumer's display class.\n */\nconst OPTION_CLASSES = cn(\n 'flex cursor-pointer select-none items-center gap-2 px-3 py-1.5 text-body-1 text-foreground',\n 'bg-(--option-bg) [--option-bg:transparent]',\n 'not-disabled:not-aria-disabled:hover:[--option-bg:var(--wave-subtle-hover)]',\n 'data-[selected]:[--option-bg:var(--wave-subtle-selected)]',\n 'data-[active]:[--option-bg:var(--wave-subtle-hover)]',\n 'data-[active]:outline-2 data-[active]:-outline-offset-2 data-[active]:outline-ring',\n 'aria-disabled:cursor-not-allowed aria-disabled:text-muted-foreground',\n);\n\n/**\n * The values of the options rendered inside an `OptionGroup`, whatever wraps them (custom\n * components, Fragments, nested groups): each option adds its value from a layout effect.\n */\nclass OptionGroupMembers {\n private readonly counts = new Map<string, number>();\n private readonly listeners = new Set<() => void>();\n\n subscribe = (listener: () => void): (() => void) => {\n this.listeners.add(listener);\n return () => {\n this.listeners.delete(listener);\n };\n };\n\n add(value: string): () => void {\n this.counts.set(value, (this.counts.get(value) ?? 0) + 1);\n this.notify();\n return () => {\n const count = (this.counts.get(value) ?? 1) - 1;\n if (count > 0) this.counts.set(value, count);\n else this.counts.delete(value);\n this.notify();\n };\n }\n\n /** At least one option, and every one of them is hidden (filtered out, or by the consumer). */\n allHidden(store: ListboxStore | undefined): boolean {\n if (store === undefined || this.counts.size === 0) return false;\n for (const value of this.counts.keys()) if (!store.isHidden(value)) return false;\n return true;\n }\n\n private notify(): void {\n for (const listener of [...this.listeners]) listener();\n }\n}\n\n/** The groups around an option, outermost first (P05-internal). */\nconst OptionGroupContext = React.createContext<readonly OptionGroupMembers[]>([]);\nOptionGroupContext.displayName = 'OptionGroupContext';\n\n/** A group around the option has the consumer's `hidden` attribute (P05-internal). */\nconst OptionGroupHiddenContext = React.createContext(false);\nOptionGroupHiddenContext.displayName = 'OptionGroupHiddenContext';\n\n/** Adds an option's value to every group around it while the option is mounted. */\nfunction useOptionGroupMembership(value: string): void {\n const groups = React.useContext(OptionGroupContext);\n React.useLayoutEffect(() => {\n if (groups.length === 0) return;\n const removes = groups.map((group) => group.add(value));\n return () => {\n for (const remove of removes) remove();\n };\n }, [groups, value]);\n}\n\n/*\n * Forced colours of a disabled option's box, as Checkbox draws a disabled box: GrayText on Canvas\n * for the square and its glyph, without the Highlight background of `forcedColors.selectedLeaf`.\n */\nconst DISABLED_BOX_FORCED_COLORS = 'forced-colors:border-[GrayText] forced-colors:bg-[Canvas]';\nconst DISABLED_GLYPH_FORCED_COLORS =\n 'forced-colors:text-[GrayText] forced-colors:forced-color-adjust-none';\n\n/** What the check column of an option draws (see {@link renderCheck}). */\ninterface CheckState {\n selected: boolean;\n multiselect: boolean;\n disabled: boolean;\n}\n\n/**\n * The check column of an option. Single-select: the check glyph, kept in its place but not drawn\n * while the option is not selected, so the option texts line up. Multi-select: a 16px checkbox\n * square in Checkbox's colours, with the glyph inside only while selected; as a leaf indicator it\n * takes `forcedColors.selectedLeaf` while checked. A disabled option's square follows the row, as\n * the single-select glyph does: its muted text colour draws the square and the glyph, in place of\n * the brand colour. `glyph` is the consumer's `checkIcon` when it renders content, else\n * `undefined` for the default glyph.\n */\nfunction renderCheck(\n glyph: Slot<'span'> | undefined,\n { selected, multiselect, disabled }: CheckState,\n): React.ReactNode {\n if (!multiselect) {\n const classes = cn(optionClassNames.checkIcon, 'shrink-0', !selected && 'invisible');\n return glyph === undefined ? (\n <CheckIcon className={classes} />\n ) : (\n renderSlot(glyph, 'span', cn('inline-flex', classes), { 'aria-hidden': true })\n );\n }\n // One class set per state, so a disabled box never carries the brand classes it replaces.\n let boxClasses: string;\n if (disabled) {\n boxClasses = cn('border-current bg-transparent', DISABLED_BOX_FORCED_COLORS);\n } else if (selected) {\n boxClasses = cn('border-primary bg-primary text-primary-foreground', forcedColors.selectedLeaf);\n } else {\n boxClasses = cn('border-stroke-accessible bg-transparent', forcedColors.control);\n }\n const glyphClasses = disabled ? DISABLED_GLYPH_FORCED_COLORS : undefined;\n return (\n <span\n aria-hidden=\"true\"\n data-wave-option-box=\"\"\n className={cn(\n optionClassNames.indicator,\n 'flex h-4 w-4 shrink-0 items-center justify-center rounded-xs border',\n boxClasses,\n )}\n >\n {selected &&\n (glyph === undefined ? (\n <CheckIcon size={12} className={cn(optionClassNames.checkIcon, glyphClasses)} />\n ) : (\n renderSlot(\n glyph,\n 'span',\n cn(optionClassNames.checkIcon, 'inline-flex shrink-0', glyphClasses),\n {\n 'aria-hidden': true,\n },\n )\n ))}\n </span>\n );\n}\n\nfunction OptionImpl(props: OptionProps) {\n const {\n value,\n label,\n textValue,\n disabled = false,\n hidden = false,\n checkIcon,\n className,\n children,\n onClick,\n onMouseDown,\n onPointerMove,\n ref,\n ...rest\n } = props;\n const showCheck = React.useContext(OptionCheckContext);\n const groupHidden = React.useContext(OptionGroupHiddenContext);\n // A consumer-hidden option is not navigable; optionProps renders `hidden`.\n const { selected, multiselect, optionProps } = useListboxOption<HTMLLIElement>(\n { value, label, textValue, disabled, hidden: hidden || groupHidden },\n ref,\n );\n useOptionGroupMembership(value);\n const {\n ref: optionRef,\n onClick: selectOption,\n // Standalone mode only: the pointer press that focuses the list.\n onMouseDown: pressOption,\n onPointerMove: highlightOption,\n ...optionAttributes\n } = optionProps;\n\n // The check is a required indicator (C-SLOTS): a `checkIcon` that renders nothing keeps the\n // default glyph and warns once.\n const checkIconRenders = checkIcon != null && slotRendersContent(checkIcon);\n const checkIconEmpty = checkIcon != null && !checkIconRenders;\n React.useEffect(() => {\n if (checkIconEmpty) {\n warnOnce(\n 'Option:checkIcon-empty',\n 'Option: `checkIcon` renders nothing, so the default check shows: a selected option must show its state. Pass a glyph, or leave it unset.',\n );\n }\n }, [checkIconEmpty]);\n\n return (\n <li\n data-value={value}\n {...rest}\n {...optionAttributes}\n ref={optionRef}\n onClick={composeEventHandlers(onClick, selectOption)}\n onMouseDown={composeEventHandlers(onMouseDown, pressOption)}\n onPointerMove={composeEventHandlers(onPointerMove, highlightOption)}\n className={cn(\n optionClassNames.root,\n OPTION_CLASSES,\n // While a multi-select option draws its box, the box carries the state, and\n // `forcedColors.selectedContainer` would draw every selected option like the active one.\n selected && !(multiselect && showCheck) && forcedColors.selectedContainer,\n className,\n )}\n >\n {showCheck &&\n renderCheck(checkIconRenders ? checkIcon : undefined, { selected, multiselect, disabled })}\n <span className={cn(optionClassNames.content, 'min-w-0 flex-1')}>{children ?? value}</span>\n </li>\n );\n}\nOptionImpl.displayName = 'Option';\n\nconst MemoOption = /* @__PURE__ */ React.memo(OptionImpl);\nMemoOption.displayName = 'Option';\n\n/**\n * An option of a listbox: a `Listbox`, `Combobox` or `Dropdown` (and `TagPicker`'s generated\n * list), or a custom picker's list, rendered through `ListboxSurface` or under a\n * `ListboxProvider`. Renders `<li role=\"option\">` with a stable id (`aria-activedescendant`\n * target), `aria-selected`, a check mark while selected (`checkIcon` replaces it; in a\n * multi-select list it sits in a checkbox square) and `data-active`/`data-selected`/\n * `data-disabled` attributes for styling.\n *\n * Options register with the surrounding listbox (in DOM order, groups included), so they can be\n * wrapped, grouped or rendered conditionally. The option is memoized: moving the highlight\n * re-renders only the previously and the newly active option.\n *\n * Styling: `className` comes last. A plain background class (`className=\"bg-primary\"`) replaces\n * the built-in hover, selected and active backgrounds in every state. To restyle one state only,\n * use its data variant (`data-[active]:bg-…`, `data-[selected]:bg-…`). The active option keeps\n * its focus outline.\n *\n * Use it inside a listbox only; it throws in development elsewhere.\n */\nexport const Option: React.NamedExoticComponent<OptionProps> = /* @__PURE__ */ markListboxElement(\n MemoOption,\n 'option',\n);\n\n/* ------------------------------------------------------------------ */\n/* OptionGroup */\n/* ------------------------------------------------------------------ */\n\n/**\n * Props of {@link OptionGroup}. `aria-label` and `aria-labelledby` go to the group's\n * `role=\"group\"` list; the other props go to its `<li role=\"presentation\">` item.\n */\nexport interface OptionGroupProps extends React.LiHTMLAttributes<HTMLLIElement> {\n /**\n * The group's heading, which names the group. Keep it text (an icon next to the text is fine): a\n * label cannot be interactive, since nothing in it is reachable inside a listbox. Without a\n * label no heading renders; name the group with `aria-label` or `aria-labelledby` then. A group\n * without a name logs a development warning.\n */\n label?: React.ReactNode;\n /**\n * Names the group's list in place of the label (the heading still shows). A prop that holds\n * `undefined`, as from a wrapper that forwards it, leaves the label in charge.\n */\n 'aria-label'?: string;\n /**\n * Ids of the elements that name the group's list, in place of the label (the heading still\n * shows). A prop that holds `undefined` leaves the label in charge.\n */\n 'aria-labelledby'?: string;\n /**\n * Hides the group and every option in it (see `Option`'s `hidden`): keyboard navigation and\n * typeahead skip its options.\n * @default false\n */\n hidden?: boolean;\n /** Ref to the group's `<li role=\"presentation\">` element. */\n ref?: React.Ref<HTMLLIElement>;\n}\n\nconst ELEMENT_NODE = 1;\nconst TEXT_NODE = 3;\n\n/**\n * The text a heading gives the name of its group, for the development check of `OptionGroup`: its\n * text without `aria-hidden` or `hidden` parts, where an element's `aria-label` or an image's `alt`\n * stands for its content.\n */\nfunction nameText(node: Node | null): string {\n if (node === null) return '';\n if (node.nodeType === TEXT_NODE) return node.textContent ?? '';\n if (node.nodeType !== ELEMENT_NODE) return '';\n const element = node as Element;\n if (element.getAttribute('aria-hidden') === 'true' || element.hasAttribute('hidden')) return '';\n const ownLabel = element.getAttribute('aria-label')?.trim();\n if (ownLabel) return ownLabel;\n if (element.localName === 'img') return element.getAttribute('alt') ?? '';\n let text = '';\n for (const child of Array.from(element.childNodes)) text += nameText(child);\n return text;\n}\n\n/**\n * Whether a group's list has a name, for the development check of `OptionGroup`, in the order the\n * name is computed: a consumer `aria-labelledby` that is not blank (its presence counts; the\n * elements it names are not read), else a non-blank `aria-label`, else the heading that labels the\n * list. A string or number label is its own text; only an element label is read from the rendered\n * heading ({@link nameText}).\n */\nfunction groupHasName(\n label: React.ReactNode,\n ariaLabel: string | undefined,\n labelledBy: string | undefined,\n labelId: string,\n heading: HTMLElement | null,\n): boolean {\n if (labelledBy !== undefined && labelledBy !== labelId && labelledBy.trim() !== '') return true;\n if (ariaLabel !== undefined && ariaLabel.trim() !== '') return true;\n if (labelledBy !== labelId) return false;\n if (typeof label === 'string' || typeof label === 'number') return String(label).trim() !== '';\n return nameText(heading).trim() !== '';\n}\n\nconst UNNAMED_GROUP_WARNING = 'OptionGroup:unnamed';\n\nfunction OptionGroupImpl({\n label,\n className,\n children,\n hidden,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n ref,\n ...rest\n}: OptionGroupProps) {\n const labelId = useId('option-group');\n const store = React.useContext(ListboxContext)?.store;\n const parentGroups = React.useContext(OptionGroupContext);\n const hiddenByConsumer = React.useContext(OptionGroupHiddenContext) || !!hidden;\n const [members] = React.useState(() => new OptionGroupMembers());\n const groups = React.useMemo(() => [...parentGroups, members], [parentGroups, members]);\n const subscribe = React.useCallback(\n (listener: () => void) => {\n const unsubscribeMembers = members.subscribe(listener);\n const unsubscribeStore = store?.subscribe(listener);\n return () => {\n unsubscribeMembers();\n unsubscribeStore?.();\n };\n },\n [members, store],\n );\n // Hidden while every option inside it is filtered out or hidden, also options wrapped in a\n // component (the options register with the group; re-read when they do and when the listbox\n // state changes).\n // The server render and the first client render show the group: no option has registered yet.\n const empty = React.useSyncExternalStore(\n subscribe,\n () => members.allHidden(store),\n () => false,\n );\n\n // The heading renders only for a label that renders content, so the list never points at an\n // empty heading. A consumer name wins over the heading; a prop that holds `undefined` (a wrapper\n // forwarding it) is no name of the consumer's.\n const hasLabel = slotRendersContent(label);\n const labelledBy = ariaLabelledBy ?? (ariaLabel === undefined && hasLabel ? labelId : undefined);\n\n // C-DEV: warn once when nothing names the group, checked again whenever the label, the\n // consumer `aria-label` or the resolved `aria-labelledby` changes.\n const headingRef = React.useRef<HTMLDivElement | null>(null);\n React.useEffect(() => {\n if (!isDev || hasWarned(UNNAMED_GROUP_WARNING)) return;\n if (groupHasName(label, ariaLabel, labelledBy, labelId, headingRef.current)) return;\n warnOnce(\n UNNAMED_GROUP_WARNING,\n 'OptionGroup: the group has no name. Give it a text `label`, `aria-label` or `aria-labelledby`.',\n );\n }, [label, ariaLabel, labelledBy, labelId]);\n\n return (\n <li\n {...rest}\n ref={ref}\n role=\"presentation\"\n hidden={hidden || empty || undefined}\n className={cn(optionGroupClassNames.root, className)}\n >\n {hasLabel && (\n <div\n ref={headingRef}\n id={labelId}\n role=\"presentation\"\n className={cn(\n optionGroupClassNames.label,\n 'px-3 py-1 text-caption-1 font-semibold text-muted-foreground',\n )}\n >\n {materialiseSlotContent(label)}\n </div>\n )}\n <ul\n role=\"group\"\n aria-label={ariaLabel}\n aria-labelledby={labelledBy}\n className={optionGroupClassNames.list}\n >\n <OptionGroupHiddenContext.Provider value={hiddenByConsumer}>\n <OptionGroupContext.Provider value={groups}>{children}</OptionGroupContext.Provider>\n </OptionGroupHiddenContext.Provider>\n </ul>\n </li>\n );\n}\nOptionGroupImpl.displayName = 'OptionGroup';\n\n/**\n * Groups options under an optional heading: `<li role=\"presentation\">` with the heading and a\n * `<ul role=\"group\">` of the options, named by the heading (`label`) or by your `aria-label` or\n * `aria-labelledby`, which win over it. Hidden while a filter (or their own `hidden`) hides all\n * its options, also options wrapped in a component or in nested groups. Use it inside a listbox,\n * as `Option`.\n */\nexport const OptionGroup: React.FC<OptionGroupProps> = /* @__PURE__ */ markListboxElement(\n OptionGroupImpl,\n 'group',\n);\n\n/* ------------------------------------------------------------------ */\n/* ListboxProvider */\n/* ------------------------------------------------------------------ */\n\n/** Props of {@link ListboxProvider}. */\nexport interface ListboxProviderProps {\n /** The context of a listbox: `useListbox(...).context`. */\n value: ListboxContextValue;\n /** The options (`Option`, `OptionGroup` or options of your own on `useListboxOption`). */\n children?: React.ReactNode;\n}\n\n/**\n * Provides a listbox's context to its options, for a custom picker that renders its list without\n * `ListboxSurface`: `<ListboxProvider value={listbox.context}><ul {...listbox.getListboxProps()}>…</ul></ListboxProvider>`.\n */\nexport function ListboxProvider({ value, children }: ListboxProviderProps) {\n return <ListboxContext.Provider value={value}>{children}</ListboxContext.Provider>;\n}\nListboxProvider.displayName = 'ListboxProvider';\n\n/* ------------------------------------------------------------------ */\n/* Listbox popup: useListboxPopup and ListboxSurface */\n/* ------------------------------------------------------------------ */\n\n/** Options of {@link useListboxPopup}. */\nexport interface UseListboxPopupOptions {\n /**\n * The listbox is open (your open state). While it is, a press outside your picker and its\n * surface, and focus leaving them, dismiss it.\n */\n open: boolean;\n /**\n * The surface is shown (the list, or the empty content of {@link ListboxSurface}): it is\n * positioned, and Escape dismisses it. While the listbox is open with nothing shown (no options\n * to show), Escape is left to an enclosing layer, such as a Dialog around the picker.\n */\n surfaceOpen: boolean;\n /**\n * Called when the popup should close: set your open state to `false`. `reason` is `'escape'`,\n * `'outside-press'` or `'focus-outside'`.\n */\n onDismiss: (reason: DismissReason) => void;\n /** Your picker's root element: presses and focus inside it are not outside the popup. */\n rootRef: React.RefObject<HTMLElement | null>;\n /**\n * The combobox element, which anchors the popup's dismiss layer. Pass the element to\n * `setReference` too (merged into its ref), which places the surface against it.\n */\n anchorRef: React.RefObject<HTMLElement | null>;\n}\n\n/**\n * Result of {@link useListboxPopup}. Destructure it: `eslint-plugin-react-hooks` treats an object\n * with a member passed to a `ref` prop as a ref, and rejects reading its other members during\n * render (`react-hooks/refs`).\n */\nexport interface UseListboxPopupResult {\n /** The popup's dismiss layer: pass it to {@link ListboxSurface}. */\n layerId: string;\n /**\n * Ref callback for the element the surface is placed against: merge it into your combobox's ref.\n */\n setReference: (el: HTMLElement | null) => void;\n /** Ref callback for the surface: pass it to {@link ListboxSurface}. */\n surfaceRef: React.RefCallback<HTMLElement>;\n /** The surface's `data-side`, `data-align` and position style: pass them to {@link ListboxSurface}. */\n floatingProps: { 'data-side': string; 'data-align': string; style: React.CSSProperties };\n}\n\n/**\n * Dismissal and positioning of a custom picker's listbox popup, for {@link ListboxSurface}. The\n * popup is dismissed by Escape, by a press outside your picker and its surface, and by focus\n * leaving them (`onDismiss` says which). The surface opens below the anchor and as wide as it,\n * flips above it when there is no room below, and is limited to the space available; its\n * `data-side` and `data-align` attributes give the final placement.\n *\n * While the listbox is open with nothing to show (`surfaceOpen` is `false`), Escape is left to an\n * enclosing layer, such as a Dialog around the picker. Let your combobox's key handler leave it\n * too: on such an Escape, set your open state to `false` without calling `listbox.onKeyDown`,\n * which handles Escape (and prevents its default) whenever the listbox is open. Do so only when\n * `!event.nativeEvent.isComposing`, as Dropdown, Combobox and TagPicker do: an Escape that only\n * cancels an IME composition must not close the listbox, and `listbox.onKeyDown` ignores such\n * keys too.\n *\n * @example\n * const expanded = open && listbox.items.length > 0;\n * const { layerId, setReference, surfaceRef, floatingProps } = useListboxPopup({\n * open,\n * surfaceOpen: expanded,\n * onDismiss: () => setOpen(false),\n * rootRef,\n * anchorRef: buttonRef,\n * });\n * const buttonMergedRef = useMergedRefs(buttonRef, setReference);\n */\nexport function useListboxPopup(options: UseListboxPopupOptions): UseListboxPopupResult {\n const { open, surfaceOpen, onDismiss, rootRef, anchorRef } = options;\n const surfaceElementRef = React.useRef<HTMLElement | null>(null);\n const { setReference, setFloating, floatingProps } = usePopupPosition({\n open: surfaceOpen,\n side: 'bottom',\n align: 'start',\n matchReferenceWidth: true,\n fitViewport: true,\n });\n const { layerId } = useDismiss({\n open,\n onDismiss: (reason) => onDismiss(reason),\n refs: [rootRef, surfaceElementRef],\n anchorRef,\n kind: 'listbox',\n escape: surfaceOpen,\n focusOutside: true,\n });\n const surfaceRef = useMergedRefs<HTMLElement>(surfaceElementRef, setFloating);\n return { layerId, setReference, surfaceRef, floatingProps };\n}\n\n/**\n * Props of {@link ListboxSurface}. The options of one listbox live in one list at a time, and this\n * surface renders that list: render every option of the listbox inside it, never in a second list\n * of your own, not even for an exit animation.\n */\nexport interface ListboxSurfaceProps {\n /** The listbox: the result of `useListbox` in select-only or editable mode. */\n listbox: UseListboxResult;\n /** `layerId` from {@link useListboxPopup}: the surface joins the popup's dismiss layer. */\n layerId: string;\n /** `surfaceRef` from {@link useListboxPopup}. */\n surfaceRef: React.RefCallback<HTMLElement>;\n /** `floatingProps` from {@link useListboxPopup}: the surface's placement. */\n floatingProps: UseListboxPopupResult['floatingProps'];\n /** The listbox is open (your open state). `emptyContent` shows only while it is. */\n open: boolean;\n /**\n * The list is shown: the listbox is open and has options to show (`open &&\n * listbox.items.length > 0`). The list then renders in the surface, and otherwise `hidden`, in\n * place inside your picker. Set your combobox's `aria-expanded` to this value after spreading\n * `getComboboxProps()`, which reports `open`, so the combobox is not announced as expanded while\n * nothing is shown.\n */\n expanded: boolean;\n /**\n * Shown in the surface while the listbox is open but not expanded, such as a \"No matches\"\n * message. `undefined` and `null` show no surface; any other value shows one, so `false` and\n * `''` show an empty surface.\n */\n emptyContent?: React.ReactNode;\n /** Names the list. Name it with this or `aria-labelledby`, usually your picker's label. */\n 'aria-label'?: string;\n /** Ids of the elements that name the list, usually your picker's label. */\n 'aria-labelledby'?: string;\n /**\n * Options draw a check while selected (in a multi-select list, a checkbox square). Turn it off\n * for a list that never shows selected options, such as the suggestions of a tag picker.\n * @default true\n */\n showCheck?: boolean;\n /**\n * Classes merged last onto the list: they replace the list's own classes they conflict with,\n * its maximum height included.\n */\n listClassName?: string;\n /**\n * Classes merged last onto the surface, the popup around the list: they replace its own\n * classes they conflict with.\n */\n surfaceClassName?: string;\n /** The options (`Option`, `OptionGroup` or options of your own on `useListboxOption`). */\n children?: React.ReactNode;\n}\n\nfunction preventMouseDown(event: React.MouseEvent) {\n event.preventDefault();\n}\n\n/**\n * The option list of a custom picker and the popup it opens in: a `<ul role=\"listbox\">` with the\n * options (spread from `listbox.getListboxProps()`), rendered `hidden` in place inside your\n * picker while the list is not shown, so the options register and their ids exist from the first\n * render, and in a portaled surface placed by {@link useListboxPopup} while it is, never in both.\n * While the listbox is open with nothing to show, the surface shows `emptyContent` instead, if\n * any. A press on the surface keeps focus on your combobox. It provides the listbox's context to\n * the options, so it needs no {@link ListboxProvider}.\n *\n * @example\n * <ListboxSurface\n * listbox={listbox}\n * layerId={layerId}\n * surfaceRef={surfaceRef}\n * floatingProps={floatingProps}\n * open={open}\n * expanded={expanded}\n * aria-labelledby={labelId}\n * >\n * <Option value=\"georgia\">Georgia</Option>\n * </ListboxSurface>\n */\nexport function ListboxSurface(props: ListboxSurfaceProps) {\n const {\n listbox,\n layerId,\n surfaceRef,\n floatingProps,\n open,\n expanded,\n emptyContent,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n showCheck = true,\n listClassName,\n surfaceClassName,\n children,\n } = props;\n\n const list = (\n <OptionCheckContext.Provider value={showCheck}>\n <ListboxProvider value={listbox.context}>\n <ul\n {...listbox.getListboxProps()}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n hidden={!expanded || undefined}\n className={cn(\n listboxSurfaceClassNames.list,\n 'min-h-0 max-h-60 overflow-auto',\n listClassName,\n )}\n >\n {children}\n </ul>\n </ListboxProvider>\n </OptionCheckContext.Provider>\n );\n\n // A closed listbox never leaves a surface behind: the text typed before closing survives it.\n const showEmpty = open && !expanded && emptyContent !== undefined && emptyContent !== null;\n if (!expanded && !showEmpty) return list;\n\n return (\n <>\n {!expanded && list}\n <Portal layerId={layerId}>\n <div\n ref={surfaceRef}\n {...floatingProps}\n data-wave-listbox-surface=\"\"\n onMouseDown={preventMouseDown}\n className={cn(\n listboxSurfaceClassNames.root,\n 'flex flex-col overflow-hidden rounded border border-border bg-background py-1 text-foreground shadow-4',\n surfaceClassName,\n )}\n >\n {expanded ? list : emptyContent}\n </div>\n </Portal>\n </>\n );\n}\nListboxSurface.displayName = 'ListboxSurface';\n"],"mappings":";;;;;;;;;;;;;;;;;AA+EA,IAAMI,IAAqBD,EAAM,cAAc,EAAI;AACnD,EAAmB,cAAc;AAiBjC,IAAME,IAAiBC,EACrB,8FACA,8CACA,+EACA,6DACA,wDACA,sFACA,sEACF,GAMMC,IAAN,MAAyB;CACvB,yBAA0B,IAAI,IAAoB;CAClD,4BAA6B,IAAI,IAAgB;CAEjD,aAAa,OACX,KAAK,UAAU,IAAIC,CAAQ,SACd;EACX,KAAK,UAAU,OAAOA,CAAQ;CAChC;CAGF,IAAI,GAA2B;EAG7B,OAFA,KAAK,OAAO,IAAIC,IAAQ,KAAK,OAAO,IAAIA,CAAK,KAAK,KAAK,CAAC,GACxD,KAAK,OAAO,SACC;GACX,IAAMC,KA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AAOgC;EAClC,UAAA,kBAACuD,GAAD;GAAiB,OAAOe,EAAQ;GAC9B,UAAA,kBAAC,MAAD;IACE,GAAIA,EAAQ,gBAAgB;IAC5B,cAAYnC;IACZ,mBAAiBK;IACjB,QAAQ,CAAC+B,KAAY,KAAA;IACrB,WAAWrG,EACTsG,EAAyB,MACzB,kCACAC,CACF;IAEC;GACC,CAAA;EACW,CAAA;CACU,CAAA;CAO/B,OAFI,CAACF,MADa,MAASA,KAAYG,KAA+C,QAClDL,IAGlC,kBAAAxG,GAAA,EAAA,UAAA,CACG,CAAC0G,KAAYF,GACd,kBAACO,GAAD;EAAiB;EACf,UAAA,kBAAC,OAAD;GACE,KAAKC;GACL,GAAIC;GACJ,6BAA0B;GAC1B,aAAaX;GACb,WAAWjG,EACTsG,EAAyB,MACzB,0GACAO,CACF;GAEC,UAAAR,IAAWF,IAAOK;EAChB,CAAA;CACC,CAAA,CACR,EAAA,CAAA;AAEN;AACA,EAAe,cAAc"}
@@ -1,2 +1,2 @@
1
- "use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/cn.cjs"),n=require("../../lib/dev.cjs"),r=require("../../lib/composeEventHandlers.cjs"),i=require("../../lib/classNames.cjs"),a=require("../../hooks/useControllable.cjs"),o=require("../../lib/direction.cjs"),s=require("../../hooks/useRovingTabIndex.cjs"),c=require("../../hooks/useMergedRefs.cjs"),l=require("../../hooks/useFieldControl.cjs"),u=require("../../lib/styles.cjs"),d=require("../../lib/icons.cjs"),f=require("../../hooks/useFormReset.cjs"),p=require("../internal/HiddenInput.cjs");let m=require("react");m=e.__toESM(m,1);let h=require("react/jsx-runtime");var g=e=>`${e} star${e===1?``:`s`}`,_={"extra-small":`h-3 w-3`,small:`h-4 w-4`,medium:`h-5 w-5`,large:`h-6 w-6`,"extra-large":`h-8 w-8`},v={"extra-small":`p-1.5`,small:`p-1`,medium:`p-0.5`,large:`p-0.5`,"extra-large":`p-0.5`};function y({filled:e,className:t}){return e?(0,h.jsx)(d.StarIcon,{className:t}):(0,h.jsx)(d.StarIcon,{className:t,fill:`none`,stroke:`currentColor`,strokeWidth:1.5})}var b=({value:e,defaultValue:d,onValueChange:b,onChange:x,max:S=5,size:C=`medium`,disabled:w=!1,name:T,required:E,form:D,labels:O,className:k,id:A,"aria-label":ee,"aria-labelledby":j,"aria-describedby":M,"aria-invalid":N,"aria-required":P,onKeyDown:F,onFocus:I,onMouseLeave:L,ref:R,...z})=>{x!==void 0&&n.warnDeprecated(`Rating`,`onChange`,`onValueChange`);let B=d??0,[V,H]=a.useControllable(e,B,e=>{b?.(e),x?.(e)}),[U,W]=m.useState(0),[G,K]=m.useState(w);G!==w&&(K(w),w&&W(0));let q=w?V:U||V,{containerProps:J,getTabIndex:Y,focusValue:X}=s.useRovingTabIndex({activeValue:V>0?String(V):null}),Z=e=>{if(e.defaultPrevented||e.altKey||e.ctrlKey||e.metaKey)return;let t;if(e.key===`Home`)t=1;else if(e.key===`End`)t=S;else if(e.key===`ArrowUp`)t=V+1;else if(e.key===`ArrowDown`)t=V-1;else{let n=o.getArrowIntent(e.key,{orientation:`horizontal`,dir:o.getDirection(e.currentTarget)});if(!n)return;t=n===`next`?V+1:V-1}e.preventDefault(),t=Math.min(t,S),!(w||t<1||t===V)&&(X(String(t)),H(t))},Q=m.useRef(null),te=c.useMergedRefs(R,J.ref,Q),ne=l.useFieldContext(),$=l.useFieldControl({id:A,"aria-label":ee,"aria-labelledby":j,"aria-describedby":M,"aria-invalid":N,"aria-required":P??E},{labelable:!1}),re=E??ne?.required??!1,ie=$[`aria-label`]===void 0&&$[`aria-labelledby`]===void 0?`Rating`:void 0;f.useFormReset(Q,()=>H(B),D);let ae=()=>{Q.current?.querySelector(`[data-roving-value][tabindex="0"]`)?.focus()},oe=_[C],se=O?.star??g;return(0,h.jsxs)(`div`,{role:`radiogroup`,"aria-label":ie,...$,"aria-disabled":w||void 0,className:t.cn(i.ratingClassNames.root,`relative inline-flex items-center gap-0.5`,w&&`pointer-events-none opacity-50`,k),...z,ref:te,"data-roving-container":``,onKeyDown:r.composeEventHandlers(F,Z),onFocus:r.composeEventHandlers(I,J.onFocus,{checkDefaultPrevented:!1}),onMouseLeave:r.composeEventHandlers(L,()=>W(0),{checkDefaultPrevented:!1}),children:[Array.from({length:S},(e,n)=>{let r=n+1,a=String(r),o=q>=r;return(0,h.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":V===r,"aria-label":se(r,S),"data-roving-value":a,tabIndex:w?-1:Y(a),disabled:w,className:t.cn(i.ratingClassNames.star,`inline-flex cursor-pointer rounded border-0 bg-transparent transition-colors motion-reduce:transition-none disabled:cursor-not-allowed`,v[C],u.focusRing,o?`text-rating`:`text-stroke-accessible`),onClick:()=>{w||H(r)},onMouseEnter:()=>{w||W(r)},children:(0,h.jsx)(y,{filled:o,className:t.cn(i.ratingClassNames.icon,oe)})},a)}),(0,h.jsx)(p.HiddenInput,{type:`radio`,name:T,form:D,disabled:w,value:V>0?String(V):``,required:re,onInvalid:ae})]})};b.displayName=`Rating`;var x={"extra-small":`text-caption-1`,small:`text-caption-1`,medium:`text-body-1`,large:`text-body-2`,"extra-large":`text-body-2`},S=(e,t,n)=>`Rating: ${n} out of ${t}`,C=(e,t)=>e===1?`1 rating`:`${t} ratings`;function w(e){if(e!==void 0)try{return Intl.getCanonicalLocales(e),e}catch{return}}var T=({value:e,max:r=5,size:a=`medium`,showValue:o=!1,count:s,compact:c=!1,locale:l,labels:u,className:d,ref:f,...p})=>{let g=_[a],v=w(l),b=l!==void 0&&v===void 0;m.useEffect(()=>{b&&n.warnOnce(`RatingDisplay:invalid-locale:${l}`,`RatingDisplay: \`locale\` "${l}" is not a valid BCP 47 language tag (use hyphens, as in "en-US"). The runtime default locale formats the value instead, so the server and the browser may render different text.`)},[b,l]);let T=new Intl.NumberFormat(v,{maximumFractionDigits:1}).format(e),E=s===void 0?void 0:new Intl.NumberFormat(v).format(s),D=(u?.rating??S)(e,r,T),O=s===void 0||E===void 0?D:`${D}, ${(u?.count??C)(s,E)}`,k=o||c||s!==void 0,A=x[a];return(0,h.jsxs)(`div`,{ref:f,role:`img`,"aria-label":O,"data-compact":c?``:void 0,className:t.cn(i.ratingDisplayClassNames.root,`inline-flex items-center gap-0.5`,d),...p,children:[c?(0,h.jsx)(`span`,{className:t.cn(i.ratingDisplayClassNames.star,`inline-flex text-rating`),children:(0,h.jsx)(y,{filled:!0,className:t.cn(i.ratingDisplayClassNames.icon,g)})}):Array.from({length:r},(n,r)=>{let a=Math.round(Math.min(1,Math.max(0,e-r))*100);if(a>0&&a<100)return(0,h.jsxs)(`span`,{className:t.cn(i.ratingDisplayClassNames.star,`relative inline-flex text-stroke-accessible`),children:[(0,h.jsx)(y,{filled:!1,className:t.cn(i.ratingDisplayClassNames.icon,g)}),(0,h.jsx)(`span`,{className:`absolute inset-y-0 start-0 flex overflow-hidden text-rating`,style:{width:`${a}%`},children:(0,h.jsx)(y,{filled:!0,className:t.cn(i.ratingDisplayClassNames.icon,g,`shrink-0`)})})]},r);let o=a===100;return(0,h.jsx)(`span`,{className:t.cn(i.ratingDisplayClassNames.star,`inline-flex`,o?`text-rating`:`text-stroke-accessible`),children:(0,h.jsx)(y,{filled:o,className:t.cn(i.ratingDisplayClassNames.icon,g)})},r)}),k&&(0,h.jsx)(`span`,{className:t.cn(i.ratingDisplayClassNames.value,`ms-1 font-semibold text-foreground`,A),children:T}),E!==void 0&&(0,h.jsxs)(`span`,{className:t.cn(i.ratingDisplayClassNames.count,`ms-1 text-muted-foreground`,A),children:[`(`,E,`)`]})]})};T.displayName=`RatingDisplay`,exports.Rating=b,exports.RatingDisplay=T;
1
+ "use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/cn.cjs"),n=require("../../lib/dev.cjs"),r=require("../../lib/slot.cjs"),i=require("../../lib/composeEventHandlers.cjs"),a=require("../../lib/classNames.cjs"),o=require("../../hooks/useEventCallback.cjs"),s=require("../../hooks/useControllable.cjs"),c=require("../../lib/direction.cjs"),l=require("../../hooks/useRovingTabIndex.cjs"),u=require("../../hooks/useMergedRefs.cjs"),d=require("../../hooks/useFieldControl.cjs"),f=require("../../hooks/useFormReset.cjs"),p=require("../internal/HiddenInput.cjs"),m=require("../../lib/events.cjs"),h=require("./Rating.item.cjs");let g=require("react");g=e.__toESM(g,1);let _=require("react/jsx-runtime");var v=e=>`${e} star${e===1?``:`s`}`,y=({value:e,defaultValue:y,onValueChange:b,onChange:x,max:S=5,step:C,size:w=`medium`,color:T,iconFilled:E,iconOutline:D,disabled:O=!1,name:k,required:A,form:j,labels:M,className:N,children:P,id:F,"aria-label":I,"aria-labelledby":L,"aria-describedby":R,"aria-invalid":z,"aria-required":ee,onKeyDown:te,onFocus:ne,onMouseLeave:re,ref:ie,...ae})=>{x!==void 0&&n.warnDeprecated(`Rating`,`onChange`,`onValueChange`);let B=y??0,[V,H]=s.useControllable(e,B,e=>{b?.(e),x?.(e)}),U=C===.5?.5:1,[oe,W]=g.useState(0),[se,ce]=g.useState(O);se!==O&&(ce(O),O&&W(0));let G=O?V:oe||V,{containerProps:K,getTabIndex:q,focusValue:le}=l.useRovingTabIndex({activeValue:V>=U?String(Math.floor(V/U)*U):null}),J=e=>Math.floor(e/U)*U+U,Y=e=>Math.ceil(e/U)*U-U,ue=e=>{if(e.defaultPrevented||e.altKey||e.ctrlKey||e.metaKey||!m.isOwnEvent(e))return;let t;if(e.key===`Home`)t=U;else if(e.key===`End`)t=S;else if(e.key===`ArrowUp`)t=J(V);else if(e.key===`ArrowDown`)t=Y(V);else{let n=c.getArrowIntent(e.key,{orientation:`horizontal`,dir:c.getDirection(e.currentTarget)});if(!n)return;t=n===`next`?J(V):Y(V)}e.preventDefault(),t=Math.min(t,S),!(O||t<U||t===V)&&(le(String(t)),H(t))},X=g.useRef(null),de=u.useMergedRefs(ie,K.ref,X),fe=d.useFieldContext(),Z=d.useFieldControl({id:F,"aria-label":I,"aria-labelledby":L,"aria-describedby":R,"aria-invalid":z,"aria-required":ee??A},{labelable:!1}),pe=A??fe?.required??!1,me=Z[`aria-label`]===void 0&&Z[`aria-labelledby`]===void 0?`Rating`:void 0;f.useFormReset(X,()=>H(B),j);let he=()=>{X.current?.querySelector(`[data-roving-value][tabindex="0"]`)?.focus()},Q=o.useEventCallback(e=>{X.current?.querySelector(`[data-roving-value="${e}"]`)?.focus({preventScroll:!0})}),$=h.resolveRatingColor(T),ge=h.useStarGlyphs(`Rating`,E,D),_e=M?.star??v,{registerItem:ve,counts:ye}=h.useRatingItemRegistry(),be=r.slotRendersContent(P);h.useRatingItemChecks(ye,S,be);let xe=g.useMemo(()=>({kind:`input`,value:V,drawnValue:G,step:U,max:S,size:w,color:$,glyphs:ge,disabled:O,starLabel:_e,getTabIndex:q,choose:(e,t)=>{H(e),t&&Q(String(e))},preview:W,registerItem:ve}),[V,G,U,S,w,$,ge,O,_e,q,H,Q,ve]);return(0,_.jsxs)(`div`,{role:`radiogroup`,"aria-label":me,...Z,"aria-disabled":O||void 0,"data-color":$,className:t.cn(a.ratingClassNames.root,`relative inline-flex items-center gap-0.5`,O&&`pointer-events-none opacity-50`,N),...ae,ref:de,"data-roving-container":``,onKeyDown:i.composeEventHandlers(te,ue),onFocus:i.composeEventHandlers(ne,K.onFocus,{checkDefaultPrevented:!1}),onMouseLeave:i.composeEventHandlers(re,()=>W(0),{checkDefaultPrevented:!1}),children:[(0,_.jsx)(h.RatingContext.Provider,{value:xe,children:h.ratingItems(P,S)}),(0,_.jsx)(p.HiddenInput,{type:`radio`,name:k,form:j,disabled:O,value:V>0?String(V):``,required:pe,onInvalid:he})]})};y.displayName=`Rating`;var b={"extra-small":`text-caption-1`,small:`text-caption-1`,medium:`text-body-1`,large:`text-body-2`,"extra-large":`text-body-2`},x=(e,t,n)=>`Rating: ${n} out of ${t}`,S=(e,t)=>e===1?`1 rating`:`${t} ratings`;function C(e){if(e!==void 0)try{return Intl.getCanonicalLocales(e),e}catch{return}}var w=({value:e,max:i=5,size:o=`medium`,color:s,iconFilled:c,iconOutline:l,showValue:u=!1,count:d,compact:f=!1,locale:p,labels:m,className:v,children:y,ref:w,...T})=>{let E=C(p),D=p!==void 0&&E===void 0;g.useEffect(()=>{D&&n.warnOnce(`RatingDisplay:invalid-locale:${p}`,`RatingDisplay: \`locale\` "${p}" is not a valid BCP 47 language tag (use hyphens, as in "en-US"). The runtime default locale formats the value instead, so the server and the browser may render different text.`)},[D,p]);let O=new Intl.NumberFormat(E,{maximumFractionDigits:1}).format(e),k=d===void 0?void 0:new Intl.NumberFormat(E).format(d),A=(m?.rating??x)(e,i,O),j=d===void 0||k===void 0?A:`${A}, ${(m?.count??S)(d,k)}`,M=u||f||d!==void 0,N=b[o],P=h.resolveRatingColor(s),F=h.useStarGlyphs(`RatingDisplay`,c,l),{registerItem:I,counts:L}=h.useRatingItemRegistry(),R=!f&&r.slotRendersContent(y);h.useRatingItemChecks(L,i,R);let z=g.useMemo(()=>({...h.INERT_RATING_CONTEXT,kind:`display`,value:e,drawnValue:e,max:i,size:o,color:P,glyphs:F,registerItem:I}),[e,i,o,P,F,I]);return(0,_.jsxs)(`div`,{ref:w,role:`img`,"aria-label":j,"data-compact":f?``:void 0,"data-color":P,className:t.cn(a.ratingDisplayClassNames.root,`inline-flex items-center gap-0.5`,v),...T,children:[f?(0,_.jsx)(h.StarGlyph,{starClassName:a.ratingDisplayClassNames.star,iconClassName:a.ratingDisplayClassNames.icon,fraction:1,size:o,color:P,glyphs:F}):(0,_.jsx)(h.RatingContext.Provider,{value:z,children:h.ratingItems(y,i)}),M&&(0,_.jsx)(`span`,{className:t.cn(a.ratingDisplayClassNames.value,`ms-1 font-semibold text-foreground`,N),children:O}),k!==void 0&&(0,_.jsxs)(`span`,{className:t.cn(a.ratingDisplayClassNames.count,`ms-1 text-muted-foreground`,N),children:[`(`,k,`)`]})]})};w.displayName=`RatingDisplay`;var T=Object.assign(y,{Item:h.RatingItem}),E=Object.assign(w,{Item:h.RatingItem}),D=h.RatingItem;exports.Rating=T,exports.RatingDisplay=E,exports.RatingDisplayItem=D,exports.RatingItem=h.RatingItem;
2
2
  //# sourceMappingURL=Rating.cjs.map