@rpcbase/ui 0.260.0 → 0.262.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 (261) hide show
  1. package/dist/assets/sha256.worker-BEf4_Y9w.js.map +1 -0
  2. package/dist/components/FilesUploadField/index.d.ts +19 -6
  3. package/dist/components/FilesUploadField/index.d.ts.map +1 -1
  4. package/dist/components/FilesUploadField/sha256.d.ts +5 -0
  5. package/dist/components/FilesUploadField/sha256.d.ts.map +1 -0
  6. package/dist/components/FilesUploadField/sha256.worker.d.ts +4 -0
  7. package/dist/components/FilesUploadField/sha256.worker.d.ts.map +1 -0
  8. package/dist/components/ImagesField/index.d.ts +4 -2
  9. package/dist/components/ImagesField/index.d.ts.map +1 -1
  10. package/dist/index.js +10 -10
  11. package/dist/index298.js +11 -803
  12. package/dist/index298.js.map +1 -1
  13. package/dist/index299.js +865 -28
  14. package/dist/index299.js.map +1 -1
  15. package/dist/index300.js +26 -510
  16. package/dist/index300.js.map +1 -1
  17. package/dist/index301.js +481 -755
  18. package/dist/index301.js.map +1 -1
  19. package/dist/index302.js +786 -7428
  20. package/dist/index302.js.map +1 -1
  21. package/dist/index303.js +7429 -7
  22. package/dist/index303.js.map +1 -1
  23. package/dist/index304.js +6 -12
  24. package/dist/index304.js.map +1 -1
  25. package/dist/index305.js +12 -5
  26. package/dist/index305.js.map +1 -1
  27. package/dist/index306.js +3 -3
  28. package/dist/index306.js.map +1 -1
  29. package/dist/index307.js +5 -469
  30. package/dist/index307.js.map +1 -1
  31. package/dist/index308.js +464 -32
  32. package/dist/index308.js.map +1 -1
  33. package/dist/index309.js +36 -18
  34. package/dist/index309.js.map +1 -1
  35. package/dist/index310.js +17 -28
  36. package/dist/index310.js.map +1 -1
  37. package/dist/index311.js +30 -4
  38. package/dist/index311.js.map +1 -1
  39. package/dist/index312.js +4 -59
  40. package/dist/index312.js.map +1 -1
  41. package/dist/index313.js +59 -9
  42. package/dist/index313.js.map +1 -1
  43. package/dist/index314.js +9 -5
  44. package/dist/index314.js.map +1 -1
  45. package/dist/index315.js +5 -9
  46. package/dist/index315.js.map +1 -1
  47. package/dist/index316.js +9 -12
  48. package/dist/index316.js.map +1 -1
  49. package/dist/index317.js +13 -3
  50. package/dist/index317.js.map +1 -1
  51. package/dist/index318.js +3 -17
  52. package/dist/index318.js.map +1 -1
  53. package/dist/index319.js +14 -23
  54. package/dist/index319.js.map +1 -1
  55. package/dist/index320.js +23 -39
  56. package/dist/index320.js.map +1 -1
  57. package/dist/index321.js +41 -5
  58. package/dist/index321.js.map +1 -1
  59. package/dist/index322.js +5 -25
  60. package/dist/index322.js.map +1 -1
  61. package/dist/index323.js +24 -18
  62. package/dist/index323.js.map +1 -1
  63. package/dist/index324.js +17 -32
  64. package/dist/index324.js.map +1 -1
  65. package/dist/index325.js +34 -5
  66. package/dist/index325.js.map +1 -1
  67. package/dist/index326.js +5 -9
  68. package/dist/index326.js.map +1 -1
  69. package/dist/index327.js +8 -7
  70. package/dist/index327.js.map +1 -1
  71. package/dist/index328.js +8 -9
  72. package/dist/index328.js.map +1 -1
  73. package/dist/index329.js +9 -10
  74. package/dist/index329.js.map +1 -1
  75. package/dist/index330.js +10 -7
  76. package/dist/index330.js.map +1 -1
  77. package/dist/index331.js +7 -75
  78. package/dist/index331.js.map +1 -1
  79. package/dist/index332.js +66 -153
  80. package/dist/index332.js.map +1 -1
  81. package/dist/index333.js +147 -99
  82. package/dist/index333.js.map +1 -1
  83. package/dist/index334.js +113 -13
  84. package/dist/index334.js.map +1 -1
  85. package/dist/index335.js +12 -78
  86. package/dist/index335.js.map +1 -1
  87. package/dist/index336.js +57 -23
  88. package/dist/index336.js.map +1 -1
  89. package/dist/index337.js +45 -12
  90. package/dist/index337.js.map +1 -1
  91. package/dist/index338.js +13 -16
  92. package/dist/index338.js.map +1 -1
  93. package/dist/index339.js +15 -100
  94. package/dist/index339.js.map +1 -1
  95. package/dist/index340.js +95 -50
  96. package/dist/index340.js.map +1 -1
  97. package/dist/index341.js +5 -57
  98. package/dist/index341.js.map +1 -1
  99. package/dist/index342.js +78 -41
  100. package/dist/index342.js.map +1 -1
  101. package/dist/index343.js +58 -100
  102. package/dist/index343.js.map +1 -1
  103. package/dist/index344.js +104 -46
  104. package/dist/index344.js.map +1 -1
  105. package/dist/index345.js +51 -39
  106. package/dist/index345.js.map +1 -1
  107. package/dist/index346.js +42 -142
  108. package/dist/index346.js.map +1 -1
  109. package/dist/index347.js +123 -120
  110. package/dist/index347.js.map +1 -1
  111. package/dist/index348.js +108 -224
  112. package/dist/index348.js.map +1 -1
  113. package/dist/index349.js +174 -158
  114. package/dist/index349.js.map +1 -1
  115. package/dist/index350.js +144 -213
  116. package/dist/index350.js.map +1 -1
  117. package/dist/index351.js +309 -5
  118. package/dist/index351.js.map +1 -1
  119. package/dist/index352.js +5 -6
  120. package/dist/index352.js.map +1 -1
  121. package/dist/index353.js +6 -7
  122. package/dist/index353.js.map +1 -1
  123. package/dist/index354.js +5 -4
  124. package/dist/index354.js.map +1 -1
  125. package/dist/index355.js +4 -4
  126. package/dist/index355.js.map +1 -1
  127. package/dist/index356.js +6 -21
  128. package/dist/index356.js.map +1 -1
  129. package/dist/index357.js +21 -10
  130. package/dist/index357.js.map +1 -1
  131. package/dist/index358.js +10 -128
  132. package/dist/index358.js.map +1 -1
  133. package/dist/index359.js +122 -36
  134. package/dist/index359.js.map +1 -1
  135. package/dist/index360.js +38 -64
  136. package/dist/index360.js.map +1 -1
  137. package/dist/index361.js +66 -115
  138. package/dist/index361.js.map +1 -1
  139. package/dist/index362.js +112 -485
  140. package/dist/index362.js.map +1 -1
  141. package/dist/index363.js +490 -13
  142. package/dist/index363.js.map +1 -1
  143. package/dist/index364.js +13 -4
  144. package/dist/index364.js.map +1 -1
  145. package/dist/index365.js +4 -47
  146. package/dist/index365.js.map +1 -1
  147. package/dist/index366.js +44 -15
  148. package/dist/index366.js.map +1 -1
  149. package/dist/index367.js +19 -5
  150. package/dist/index367.js.map +1 -1
  151. package/dist/index368.js +5 -27
  152. package/dist/index368.js.map +1 -1
  153. package/dist/index369.js +27 -48
  154. package/dist/index369.js.map +1 -1
  155. package/dist/index370.js +46 -27
  156. package/dist/index370.js.map +1 -1
  157. package/dist/index371.js +27 -16
  158. package/dist/index371.js.map +1 -1
  159. package/dist/index372.js +16 -41
  160. package/dist/index372.js.map +1 -1
  161. package/dist/index373.js +42 -14
  162. package/dist/index373.js.map +1 -1
  163. package/dist/index374.js +14 -10
  164. package/dist/index374.js.map +1 -1
  165. package/dist/index375.js +9 -51
  166. package/dist/index375.js.map +1 -1
  167. package/dist/index376.js +53 -43
  168. package/dist/index376.js.map +1 -1
  169. package/dist/index377.js +43 -16
  170. package/dist/index377.js.map +1 -1
  171. package/dist/index378.js +15 -4
  172. package/dist/index378.js.map +1 -1
  173. package/dist/index379.js +4 -4
  174. package/dist/index379.js.map +1 -1
  175. package/dist/index380.js +4 -9
  176. package/dist/index380.js.map +1 -1
  177. package/dist/index381.js +9 -340
  178. package/dist/index381.js.map +1 -1
  179. package/dist/index382.js +339 -4
  180. package/dist/index382.js.map +1 -1
  181. package/dist/index383.js +5 -16
  182. package/dist/index383.js.map +1 -1
  183. package/dist/index384.js +16 -111
  184. package/dist/index384.js.map +1 -1
  185. package/dist/index385.js +109 -19
  186. package/dist/index385.js.map +1 -1
  187. package/dist/index386.js +18 -18
  188. package/dist/index386.js.map +1 -1
  189. package/dist/index387.js +21 -5
  190. package/dist/index387.js.map +1 -1
  191. package/dist/index388.js +5 -20
  192. package/dist/index388.js.map +1 -1
  193. package/dist/index389.js +19 -13
  194. package/dist/index389.js.map +1 -1
  195. package/dist/index390.js +13 -84
  196. package/dist/index390.js.map +1 -1
  197. package/dist/index391.js +84 -7
  198. package/dist/index391.js.map +1 -1
  199. package/dist/index392.js +9 -29
  200. package/dist/index392.js.map +1 -1
  201. package/dist/index393.js +28 -9
  202. package/dist/index393.js.map +1 -1
  203. package/dist/index394.js +9 -5
  204. package/dist/index394.js.map +1 -1
  205. package/dist/index395.js +6 -252
  206. package/dist/index395.js.map +1 -1
  207. package/dist/index396.js +250 -10
  208. package/dist/index396.js.map +1 -1
  209. package/dist/index397.js +11 -10
  210. package/dist/index397.js.map +1 -1
  211. package/dist/index398.js +10 -6
  212. package/dist/index398.js.map +1 -1
  213. package/dist/index399.js +6 -22
  214. package/dist/index399.js.map +1 -1
  215. package/dist/index400.js +21 -21
  216. package/dist/index400.js.map +1 -1
  217. package/dist/index401.js +21 -107
  218. package/dist/index401.js.map +1 -1
  219. package/dist/index402.js +109 -15
  220. package/dist/index402.js.map +1 -1
  221. package/dist/index403.js +15 -12
  222. package/dist/index403.js.map +1 -1
  223. package/dist/index404.js +10 -8
  224. package/dist/index404.js.map +1 -1
  225. package/dist/index405.js +8 -242
  226. package/dist/index405.js.map +1 -1
  227. package/dist/index406.js +238 -25
  228. package/dist/index406.js.map +1 -1
  229. package/dist/index407.js +29 -51
  230. package/dist/index407.js.map +1 -1
  231. package/dist/index408.js +51 -10
  232. package/dist/index408.js.map +1 -1
  233. package/dist/index409.js +11 -128
  234. package/dist/index409.js.map +1 -1
  235. package/dist/index410.js +124 -35
  236. package/dist/index410.js.map +1 -1
  237. package/dist/index411.js +36 -23
  238. package/dist/index411.js.map +1 -1
  239. package/dist/index412.js +26 -11
  240. package/dist/index412.js.map +1 -1
  241. package/dist/index413.js +11 -23
  242. package/dist/index413.js.map +1 -1
  243. package/dist/index414.js +19 -13
  244. package/dist/index414.js.map +1 -1
  245. package/dist/index415.js +14 -13
  246. package/dist/index415.js.map +1 -1
  247. package/dist/index416.js +14 -322
  248. package/dist/index416.js.map +1 -1
  249. package/dist/index417.js +323 -61
  250. package/dist/index417.js.map +1 -1
  251. package/dist/index418.js +63 -4
  252. package/dist/index418.js.map +1 -1
  253. package/dist/index419.js +4 -28
  254. package/dist/index419.js.map +1 -1
  255. package/dist/index420.js +25 -468
  256. package/dist/index420.js.map +1 -1
  257. package/dist/index421.js +452 -250
  258. package/dist/index421.js.map +1 -1
  259. package/dist/index422.js +272 -0
  260. package/dist/index422.js.map +1 -0
  261. package/package.json +2 -1
package/dist/index409.js CHANGED
@@ -1,132 +1,15 @@
1
1
  "use client";
2
- import { useRenderElement as e } from "./index196.js";
3
- import { useIsoLayoutEffect as t } from "./index204.js";
4
- import { useButton as n } from "./index207.js";
5
- import { itemPress as r } from "./index208.js";
6
- import { createChangeEventDetails as i } from "./index209.js";
7
- import { isVirtualClick as a } from "./index221.js";
8
- import { useStore as o } from "./index260.js";
9
- import { useSelectRootContext as s } from "./index366.js";
10
- import { compareItemEquality as c, removeItem as l } from "./index373.js";
11
- import { selectors as u } from "./index376.js";
12
- import { IndexGuessBehavior as d, useCompositeListItem as f } from "./index407.js";
13
- import { SelectItemContext as p } from "./index408.js";
14
- import * as m from "react";
15
- import { jsx as h } from "react/jsx-runtime";
16
- //#region ../../node_modules/@base-ui/react/select/item/SelectItem.mjs
17
- var g = /*#__PURE__*/ m.memo(/*#__PURE__*/ m.forwardRef(function(g, _) {
18
- let { render: ee, className: te, style: ne, value: v = null, label: y, disabled: b = !1, nativeButton: x = !1, ...S } = g, C = m.useRef(null), w = f({
19
- label: y,
20
- textRef: C,
21
- indexGuessBehavior: d.GuessFromOrder
22
- }), { store: T, itemProps: E, setOpen: D, setValue: O, selectionRef: k, typingRef: A, valuesRef: j, multiple: M, selectedItemTextRef: N, disabled: P, readOnly: F } = s(), I = o(T, u.isActive, w.index), L = o(T, u.open), R = o(T, u.isSelected, v), z = o(T, u.isSelectedByFocus, w.index), B = o(T, u.isItemEqualToValue), V = w.index, H = V !== -1, U = m.useRef(null);
23
- t(() => {
24
- if (!H) return;
25
- let e = j.current;
26
- return e[V] = v, () => {
27
- delete e[V];
28
- };
29
- }, [
30
- H,
31
- V,
32
- v,
33
- j
34
- ]), t(() => {
35
- if (!H) return;
36
- let e = T.state.value, t = e;
37
- M && Array.isArray(e) && (t = e.length > 0 ? e[e.length - 1] : void 0), t !== void 0 && c(v, t, B) && (T.set("selectedIndex", V), C.current && (N.current = C.current));
38
- }, [
39
- H,
40
- V,
41
- M,
42
- B,
43
- T,
44
- v,
45
- N
46
- ]);
47
- let W = m.useRef(null), G = m.useRef("mouse"), K = m.useRef(!1), { getButtonProps: q, buttonRef: J } = n({
48
- disabled: b,
49
- focusableWhenDisabled: !0,
50
- native: x,
51
- composite: !0
52
- }), Y = {
53
- disabled: b,
54
- selected: R,
55
- highlighted: I
56
- };
57
- function X(e) {
58
- if (P || F) return;
59
- let t = T.state.value;
60
- if (M) {
61
- let n = Array.isArray(t) ? t : [], a = R ? l(n, v, B) : [...n, v];
62
- O(a, i(r, e));
63
- } else O(v, i(r, e)), D(!1, i(r, e));
64
- }
65
- function Z() {
66
- k.current.dragY = 0;
67
- }
68
- let Q = {
69
- role: "option",
70
- "aria-selected": R,
71
- tabIndex: L && I ? 0 : -1,
72
- onKeyDown(e) {
73
- W.current = e.key, T.set("activeIndex", V), e.key === " " && A.current && e.preventDefault();
74
- },
75
- onClick(e) {
76
- let t = e.type === "click" && G.current !== "touch", n = e.nativeEvent.pointerType, r = t && a(e.nativeEvent) && (n !== void 0 || I), i = t && !r && !K.current;
77
- K.current = !1, !(e.type === "keydown" && W.current === null) && (b || e.type === "keydown" && W.current === " " && A.current || i || (W.current = null, X(e.nativeEvent)));
78
- },
79
- onPointerEnter(e) {
80
- G.current = e.pointerType;
81
- },
82
- onPointerMove(e) {
83
- if (e.pointerType === "mouse" && e.buttons === 1) {
84
- let t = k.current;
85
- t.dragY += e.movementY, t.dragY ** 2 >= 64 && (t.allowUnselectedMouseUp = !0);
86
- }
87
- },
88
- onPointerDown(e) {
89
- G.current = e.pointerType, K.current = !0, Z();
90
- },
91
- onMouseUp() {
92
- if (Z(), b || G.current === "touch" || K.current) return;
93
- let e = !k.current.allowSelectedMouseUp && R, t = !k.current.allowUnselectedMouseUp && !R;
94
- e || t || (K.current = !0, U.current?.click(), K.current = !1);
95
- }
96
- }, $ = e("div", g, {
97
- ref: [
98
- J,
99
- _,
100
- w.ref,
101
- U
102
- ],
103
- state: Y,
104
- props: [
105
- E,
106
- Q,
107
- S,
108
- q
109
- ]
110
- }), re = m.useMemo(() => ({
111
- selected: R,
112
- index: V,
113
- textRef: C,
114
- selectedByFocus: z,
115
- hasRegistered: H
116
- }), [
117
- R,
118
- V,
119
- C,
120
- z,
121
- H
122
- ]);
123
- return /*#__PURE__*/ h(p.Provider, {
124
- value: re,
125
- children: $
126
- });
127
- }));
128
- process.env.NODE_ENV !== "production" && (g.displayName = "SelectItem");
2
+ import e from "./index183.js";
3
+ import * as t from "react";
4
+ //#region ../../node_modules/@base-ui/react/select/item/SelectItemContext.mjs
5
+ var n = /*#__PURE__*/ t.createContext(void 0);
6
+ process.env.NODE_ENV !== "production" && (n.displayName = "SelectItemContext");
7
+ function r() {
8
+ let r = t.useContext(n);
9
+ if (!r) throw Error(process.env.NODE_ENV === "production" ? e(57) : "Base UI: SelectItemContext is missing. SelectItem parts must be placed within <Select.Item>.");
10
+ return r;
11
+ }
129
12
  //#endregion
130
- export { g as SelectItem };
13
+ export { n as SelectItemContext, r as useSelectItemContext };
131
14
 
132
15
  //# sourceMappingURL=index409.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index409.js","names":["React","REASONS.itemPress"],"sources":["../../../node_modules/@base-ui/react/select/item/SelectItem.mjs"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useStore } from '@base-ui/utils/store';\nimport { useSelectRootContext } from \"../root/SelectRootContext.mjs\";\nimport { useCompositeListItem, IndexGuessBehavior } from \"../../internals/composite/list/useCompositeListItem.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { SelectItemContext } from \"./SelectItemContext.mjs\";\nimport { selectors } from \"../store.mjs\";\nimport { useButton } from \"../../internals/use-button/index.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { compareItemEquality, removeItem } from \"../../internals/itemEquality.mjs\";\nimport { isVirtualClick } from \"../../floating-ui-react/utils/event.mjs\";\n\n/**\n * An individual option in the select popup.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Select](https://base-ui.com/react/components/select)\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const SelectItem = /*#__PURE__*/React.memo(/*#__PURE__*/React.forwardRef(function SelectItem(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n value: itemValue = null,\n label,\n disabled = false,\n nativeButton = false,\n ...elementProps\n } = componentProps;\n const textRef = React.useRef(null);\n const listItem = useCompositeListItem({\n label,\n textRef,\n indexGuessBehavior: IndexGuessBehavior.GuessFromOrder\n });\n const {\n store,\n itemProps,\n setOpen,\n setValue,\n selectionRef,\n typingRef,\n valuesRef,\n multiple,\n selectedItemTextRef,\n disabled: selectDisabled,\n readOnly\n } = useSelectRootContext();\n const highlighted = useStore(store, selectors.isActive, listItem.index);\n const open = useStore(store, selectors.open);\n const selected = useStore(store, selectors.isSelected, itemValue);\n const selectedByFocus = useStore(store, selectors.isSelectedByFocus, listItem.index);\n const isItemEqualToValue = useStore(store, selectors.isItemEqualToValue);\n const index = listItem.index;\n const hasRegistered = index !== -1;\n const itemRef = React.useRef(null);\n useIsoLayoutEffect(() => {\n if (!hasRegistered) {\n return undefined;\n }\n const values = valuesRef.current;\n values[index] = itemValue;\n return () => {\n delete values[index];\n };\n }, [hasRegistered, index, itemValue, valuesRef]);\n useIsoLayoutEffect(() => {\n if (!hasRegistered) {\n return;\n }\n const selectedValue = store.state.value;\n let selectedCandidate = selectedValue;\n if (multiple && Array.isArray(selectedValue)) {\n // Compare against the last selected item, or `undefined` when nothing is selected — never\n // the raw array, which a custom `isItemEqualToValue` isn't expected to receive.\n selectedCandidate = selectedValue.length > 0 ? selectedValue[selectedValue.length - 1] : undefined;\n }\n if (selectedCandidate !== undefined && compareItemEquality(itemValue, selectedCandidate, isItemEqualToValue)) {\n store.set('selectedIndex', index);\n // Make sure SelectPopup can measure the selected item on first open.\n // SelectItemText can still update this ref later when focus moves.\n if (textRef.current) {\n selectedItemTextRef.current = textRef.current;\n }\n }\n }, [hasRegistered, index, multiple, isItemEqualToValue, store, itemValue, selectedItemTextRef]);\n const lastKeyRef = React.useRef(null);\n const pointerTypeRef = React.useRef('mouse');\n const allowMouseSelectionRef = React.useRef(false);\n const {\n getButtonProps,\n buttonRef\n } = useButton({\n disabled,\n focusableWhenDisabled: true,\n native: nativeButton,\n composite: true\n });\n const state = {\n disabled,\n selected,\n highlighted\n };\n function commitSelection(event) {\n // A forced-open select (`open`/`defaultOpen`) can still receive item activations even\n // when the root is disabled or read-only, so guard the commit here too.\n if (selectDisabled || readOnly) {\n return;\n }\n const selectedValue = store.state.value;\n if (multiple) {\n const currentValue = Array.isArray(selectedValue) ? selectedValue : [];\n const nextValue = selected ? removeItem(currentValue, itemValue, isItemEqualToValue) : [...currentValue, itemValue];\n setValue(nextValue, createChangeEventDetails(REASONS.itemPress, event));\n } else {\n setValue(itemValue, createChangeEventDetails(REASONS.itemPress, event));\n setOpen(false, createChangeEventDetails(REASONS.itemPress, event));\n }\n }\n function resetDragMovement() {\n selectionRef.current.dragY = 0;\n }\n const defaultProps = {\n role: 'option',\n 'aria-selected': selected,\n tabIndex: open && highlighted ? 0 : -1,\n onKeyDown(event) {\n lastKeyRef.current = event.key;\n store.set('activeIndex', index);\n if (event.key === ' ' && typingRef.current) {\n event.preventDefault();\n }\n },\n onClick(event) {\n const isMouseClick = event.type === 'click' && pointerTypeRef.current !== 'touch';\n const clickPointerType = event.nativeEvent.pointerType;\n const isVirtualMouseClick = isMouseClick && isVirtualClick(event.nativeEvent) && (\n // Generic no-pointer `detail === 0` clicks stay tied to highlight state. Virtual\n // clicks that carry browser pointer data, including an empty string from assistive\n // technology, can activate unhighlighted items.\n clickPointerType !== undefined || highlighted);\n // With alignItemWithTrigger, opening can place an item under the cursor. Real mouse\n // clicks must start on the item, while virtual clicks represent explicit keyboard or\n // assistive technology activation.\n const isInvalidMouseClick = isMouseClick && !isVirtualMouseClick && !allowMouseSelectionRef.current;\n allowMouseSelectionRef.current = false;\n\n // Prevent double commit on {Enter}\n if (event.type === 'keydown' && lastKeyRef.current === null) {\n return;\n }\n if (disabled || event.type === 'keydown' && lastKeyRef.current === ' ' && typingRef.current || isInvalidMouseClick) {\n return;\n }\n lastKeyRef.current = null;\n commitSelection(event.nativeEvent);\n },\n onPointerEnter(event) {\n pointerTypeRef.current = event.pointerType;\n },\n onPointerMove(event) {\n if (event.pointerType === 'mouse' && event.buttons === 1) {\n const selection = selectionRef.current;\n selection.dragY += event.movementY;\n if (selection.dragY ** 2 >= 64) {\n selection.allowUnselectedMouseUp = true;\n }\n }\n },\n onPointerDown(event) {\n pointerTypeRef.current = event.pointerType;\n allowMouseSelectionRef.current = true;\n resetDragMovement();\n },\n onMouseUp() {\n resetDragMovement();\n if (disabled || pointerTypeRef.current === 'touch') {\n return;\n }\n\n // Regular clicks are committed by the click event.\n if (allowMouseSelectionRef.current) {\n return;\n }\n const disallowSelectedMouseUp = !selectionRef.current.allowSelectedMouseUp && selected;\n const disallowUnselectedMouseUp = !selectionRef.current.allowUnselectedMouseUp && !selected;\n if (disallowSelectedMouseUp || disallowUnselectedMouseUp) {\n return;\n }\n allowMouseSelectionRef.current = true;\n itemRef.current?.click();\n allowMouseSelectionRef.current = false;\n }\n };\n const element = useRenderElement('div', componentProps, {\n ref: [buttonRef, forwardedRef, listItem.ref, itemRef],\n state,\n props: [itemProps, defaultProps, elementProps, getButtonProps]\n });\n const contextValue = React.useMemo(() => ({\n selected,\n index,\n textRef,\n selectedByFocus,\n hasRegistered\n }), [selected, index, textRef, selectedByFocus, hasRegistered]);\n return /*#__PURE__*/_jsx(SelectItemContext.Provider, {\n value: contextValue,\n children: element\n });\n}));\nif (process.env.NODE_ENV !== \"production\") SelectItem.displayName = \"SelectItem\";"],"x_google_ignoreList":[0],"mappings":";;;;;;;;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EACjC;EACA,cAAc,GAAO;GACnB,IAAI,EAAM,gBAAgB,WAAW,EAAM,YAAY,GAAG;IACxD,IAAM,IAAY,EAAa;IAE/B,AADA,EAAU,SAAS,EAAM,WACrB,EAAU,SAAS,KAAK,OAC1B,EAAU,yBAAyB;GAEvC;EACF;EACA,cAAc,GAAO;GAGnB,AAFA,EAAe,UAAU,EAAM,aAC/B,EAAuB,UAAU,IACjC,EAAkB;EACpB;EACA,YAAY;GAOV,IANA,EAAkB,GACd,KAAY,EAAe,YAAY,WAKvC,EAAuB,SACzB;GAEF,IAAM,IAA0B,CAAC,EAAa,QAAQ,wBAAwB,GACxE,IAA4B,CAAC,EAAa,QAAQ,0BAA0B,CAAC;GAC/E,KAA2B,MAG/B,EAAuB,UAAU,IACjC,EAAQ,SAAS,MAAM,GACvB,EAAuB,UAAU;EACnC;CACF,GACM,IAAU,EAAiB,OAAO,GAAgB;EACtD,KAAK;GAAC;GAAW;GAAc,EAAS;GAAK;EAAO;EACpD;EACA,OAAO;GAAC;GAAW;GAAc;GAAc;EAAc;CAC/D,CAAC,GACK,KAAeD,EAAM,eAAe;EACxC;EACA;EACA;EACA;EACA;CACF,IAAI;EAAC;EAAU;EAAO;EAAS;EAAiB;CAAa,CAAC;CAC9D,OAAoB,gBAAK,EAAkB,UAAU;EACnD,OAAO;EACP,UAAU;CACZ,CAAC;AACH,CAAC,CAAC;AACF,QAAA,IAAA,aAA6B,iBAAc,EAAW,cAAc"}
1
+ {"version":3,"file":"index409.js","names":["React","_formatErrorMessage"],"sources":["../../../node_modules/@base-ui/react/select/item/SelectItemContext.mjs"],"sourcesContent":["'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const SelectItemContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") SelectItemContext.displayName = \"SelectItemContext\";\nexport function useSelectItemContext() {\n const context = React.useContext(SelectItemContext);\n if (!context) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: SelectItemContext is missing. SelectItem parts must be placed within <Select.Item>.' : _formatErrorMessage(57));\n }\n return context;\n}"],"x_google_ignoreList":[0],"mappings":";;;;AAIA,IAAa,IAAiC,gBAAM,cAAc,KAAA,CAAS;AAC3E,QAAA,IAAA,aAA6B,iBAAc,EAAkB,cAAc;AAC3E,SAAgB,IAAuB;CACrC,IAAM,IAAUA,EAAM,WAAW,CAAiB;CAClD,IAAI,CAAC,GACH,MAAU,MAAA,QAAA,IAAA,aAA+B,eAAgHC,EAAoB,EAAE,IAAvH,8FAAwH;CAElL,OAAO;AACT"}
package/dist/index410.js CHANGED
@@ -1,43 +1,132 @@
1
1
  "use client";
2
2
  import { useRenderElement as e } from "./index196.js";
3
- import { transitionStatusMapping as t } from "./index197.js";
4
- import { useTransitionStatus as n } from "./index265.js";
5
- import { useOpenChangeComplete as r } from "./index267.js";
6
- import { useSelectItemContext as i } from "./index408.js";
7
- import * as a from "react";
8
- import { jsx as o } from "react/jsx-runtime";
9
- //#region ../../node_modules/@base-ui/react/select/item-indicator/SelectItemIndicator.mjs
10
- var s = /*#__PURE__*/ a.forwardRef(function(e, t) {
11
- let n = e.keepMounted ?? !1, { selected: r } = i();
12
- return n || r ? /*#__PURE__*/ o(c, {
13
- ...e,
14
- ref: t
15
- }) : null;
16
- });
17
- process.env.NODE_ENV !== "production" && (s.displayName = "SelectItemIndicator");
18
- var c = /*#__PURE__*/ a.memo(/*#__PURE__*/ a.forwardRef((o, s) => {
19
- let { render: c, className: l, style: u, keepMounted: d, ...f } = o, { selected: p } = i(), m = a.useRef(null), { transitionStatus: h, setMounted: g } = n(p), _ = e("span", o, {
20
- ref: [s, m],
21
- state: {
22
- selected: p,
23
- transitionStatus: h
3
+ import { useIsoLayoutEffect as t } from "./index204.js";
4
+ import { useButton as n } from "./index207.js";
5
+ import { itemPress as r } from "./index208.js";
6
+ import { createChangeEventDetails as i } from "./index209.js";
7
+ import { isVirtualClick as a } from "./index221.js";
8
+ import { useStore as o } from "./index260.js";
9
+ import { useSelectRootContext as s } from "./index367.js";
10
+ import { compareItemEquality as c, removeItem as l } from "./index374.js";
11
+ import { selectors as u } from "./index377.js";
12
+ import { IndexGuessBehavior as d, useCompositeListItem as f } from "./index408.js";
13
+ import { SelectItemContext as p } from "./index409.js";
14
+ import * as m from "react";
15
+ import { jsx as h } from "react/jsx-runtime";
16
+ //#region ../../node_modules/@base-ui/react/select/item/SelectItem.mjs
17
+ var g = /*#__PURE__*/ m.memo(/*#__PURE__*/ m.forwardRef(function(g, _) {
18
+ let { render: ee, className: te, style: ne, value: v = null, label: y, disabled: b = !1, nativeButton: x = !1, ...S } = g, C = m.useRef(null), w = f({
19
+ label: y,
20
+ textRef: C,
21
+ indexGuessBehavior: d.GuessFromOrder
22
+ }), { store: T, itemProps: E, setOpen: D, setValue: O, selectionRef: k, typingRef: A, valuesRef: j, multiple: M, selectedItemTextRef: N, disabled: P, readOnly: F } = s(), I = o(T, u.isActive, w.index), L = o(T, u.open), R = o(T, u.isSelected, v), z = o(T, u.isSelectedByFocus, w.index), B = o(T, u.isItemEqualToValue), V = w.index, H = V !== -1, U = m.useRef(null);
23
+ t(() => {
24
+ if (!H) return;
25
+ let e = j.current;
26
+ return e[V] = v, () => {
27
+ delete e[V];
28
+ };
29
+ }, [
30
+ H,
31
+ V,
32
+ v,
33
+ j
34
+ ]), t(() => {
35
+ if (!H) return;
36
+ let e = T.state.value, t = e;
37
+ M && Array.isArray(e) && (t = e.length > 0 ? e[e.length - 1] : void 0), t !== void 0 && c(v, t, B) && (T.set("selectedIndex", V), C.current && (N.current = C.current));
38
+ }, [
39
+ H,
40
+ V,
41
+ M,
42
+ B,
43
+ T,
44
+ v,
45
+ N
46
+ ]);
47
+ let W = m.useRef(null), G = m.useRef("mouse"), K = m.useRef(!1), { getButtonProps: q, buttonRef: J } = n({
48
+ disabled: b,
49
+ focusableWhenDisabled: !0,
50
+ native: x,
51
+ composite: !0
52
+ }), Y = {
53
+ disabled: b,
54
+ selected: R,
55
+ highlighted: I
56
+ };
57
+ function X(e) {
58
+ if (P || F) return;
59
+ let t = T.state.value;
60
+ if (M) {
61
+ let n = Array.isArray(t) ? t : [], a = R ? l(n, v, B) : [...n, v];
62
+ O(a, i(r, e));
63
+ } else O(v, i(r, e)), D(!1, i(r, e));
64
+ }
65
+ function Z() {
66
+ k.current.dragY = 0;
67
+ }
68
+ let Q = {
69
+ role: "option",
70
+ "aria-selected": R,
71
+ tabIndex: L && I ? 0 : -1,
72
+ onKeyDown(e) {
73
+ W.current = e.key, T.set("activeIndex", V), e.key === " " && A.current && e.preventDefault();
24
74
  },
25
- props: [{
26
- "aria-hidden": !0,
27
- children: "✔️"
28
- }, f],
29
- stateAttributesMapping: t
30
- });
31
- return r({
32
- open: p,
33
- ref: m,
34
- onComplete() {
35
- p || g(!1);
75
+ onClick(e) {
76
+ let t = e.type === "click" && G.current !== "touch", n = e.nativeEvent.pointerType, r = t && a(e.nativeEvent) && (n !== void 0 || I), i = t && !r && !K.current;
77
+ K.current = !1, !(e.type === "keydown" && W.current === null) && (b || e.type === "keydown" && W.current === " " && A.current || i || (W.current = null, X(e.nativeEvent)));
78
+ },
79
+ onPointerEnter(e) {
80
+ G.current = e.pointerType;
81
+ },
82
+ onPointerMove(e) {
83
+ if (e.pointerType === "mouse" && e.buttons === 1) {
84
+ let t = k.current;
85
+ t.dragY += e.movementY, t.dragY ** 2 >= 64 && (t.allowUnselectedMouseUp = !0);
86
+ }
87
+ },
88
+ onPointerDown(e) {
89
+ G.current = e.pointerType, K.current = !0, Z();
90
+ },
91
+ onMouseUp() {
92
+ if (Z(), b || G.current === "touch" || K.current) return;
93
+ let e = !k.current.allowSelectedMouseUp && R, t = !k.current.allowUnselectedMouseUp && !R;
94
+ e || t || (K.current = !0, U.current?.click(), K.current = !1);
36
95
  }
37
- }), _;
96
+ }, $ = e("div", g, {
97
+ ref: [
98
+ J,
99
+ _,
100
+ w.ref,
101
+ U
102
+ ],
103
+ state: Y,
104
+ props: [
105
+ E,
106
+ Q,
107
+ S,
108
+ q
109
+ ]
110
+ }), re = m.useMemo(() => ({
111
+ selected: R,
112
+ index: V,
113
+ textRef: C,
114
+ selectedByFocus: z,
115
+ hasRegistered: H
116
+ }), [
117
+ R,
118
+ V,
119
+ C,
120
+ z,
121
+ H
122
+ ]);
123
+ return /*#__PURE__*/ h(p.Provider, {
124
+ value: re,
125
+ children: $
126
+ });
38
127
  }));
39
- process.env.NODE_ENV !== "production" && (c.displayName = "Inner");
128
+ process.env.NODE_ENV !== "production" && (g.displayName = "SelectItem");
40
129
  //#endregion
41
- export { s as SelectItemIndicator };
130
+ export { g as SelectItem };
42
131
 
43
132
  //# sourceMappingURL=index410.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index410.js","names":["React"],"sources":["../../../node_modules/@base-ui/react/select/item-indicator/SelectItemIndicator.mjs"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useSelectItemContext } from \"../item/SelectItemContext.mjs\";\nimport { useTransitionStatus } from \"../../internals/useTransitionStatus.mjs\";\nimport { useOpenChangeComplete } from \"../../internals/useOpenChangeComplete.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { transitionStatusMapping } from \"../../internals/stateAttributesMapping.mjs\";\n\n/**\n * Indicates whether the select item is selected.\n * Renders a `<span>` element.\n *\n * Documentation: [Base UI Select](https://base-ui.com/react/components/select)\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const SelectItemIndicator = /*#__PURE__*/React.forwardRef(function SelectItemIndicator(componentProps, forwardedRef) {\n const keepMounted = componentProps.keepMounted ?? false;\n const {\n selected\n } = useSelectItemContext();\n const shouldRender = keepMounted || selected;\n if (!shouldRender) {\n return null;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n return /*#__PURE__*/_jsx(Inner, {\n ...componentProps,\n ref: forwardedRef\n });\n});\n\n// Split the core implementation to avoid paying the hook costs unless the element needs to mount.\nif (process.env.NODE_ENV !== \"production\") SelectItemIndicator.displayName = \"SelectItemIndicator\";\nconst Inner = /*#__PURE__*/React.memo(/*#__PURE__*/React.forwardRef((componentProps, forwardedRef) => {\n const {\n render,\n className,\n style,\n keepMounted,\n ...elementProps\n } = componentProps;\n const {\n selected\n } = useSelectItemContext();\n const indicatorRef = React.useRef(null);\n const {\n transitionStatus,\n setMounted\n } = useTransitionStatus(selected);\n const state = {\n selected,\n transitionStatus\n };\n const element = useRenderElement('span', componentProps, {\n ref: [forwardedRef, indicatorRef],\n state,\n props: [{\n 'aria-hidden': true,\n children: '✔️'\n }, elementProps],\n stateAttributesMapping: transitionStatusMapping\n });\n useOpenChangeComplete({\n open: selected,\n ref: indicatorRef,\n onComplete() {\n if (!selected) {\n setMounted(false);\n }\n }\n });\n return element;\n}));\nif (process.env.NODE_ENV !== \"production\") Inner.displayName = \"Inner\";"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;AAgBA,IAAa,IAAmC,gBAAM,WAAW,SAA6B,GAAgB,GAAc;CAC1H,IAAM,IAAc,EAAe,eAAe,IAC5C,EACJ,gBACE,EAAqB;CAOzB,OANqB,KAAe,IAMhB,gBAAK,GAAO;EAC9B,GAAG;EACH,KAAK;CACP,CAAC,IAPQ;AAQX,CAAC;AAGD,QAAA,IAAA,aAA6B,iBAAc,EAAoB,cAAc;AAC7E,IAAM,IAAqB,gBAAM,KAAkB,gBAAM,YAAY,GAAgB,MAAiB;CACpG,IAAM,EACJ,WACA,cACA,UACA,gBACA,GAAG,MACD,GACE,EACJ,gBACE,EAAqB,GACnB,IAAeA,EAAM,OAAO,IAAI,GAChC,EACJ,qBACA,kBACE,EAAoB,CAAQ,GAK1B,IAAU,EAAiB,QAAQ,GAAgB;EACvD,KAAK,CAAC,GAAc,CAAY;EAChC,OAAA;GALA;GACA;EAII;EACJ,OAAO,CAAC;GACN,eAAe;GACf,UAAU;EACZ,GAAG,CAAY;EACf,wBAAwB;CAC1B,CAAC;CAUD,OATA,EAAsB;EACpB,MAAM;EACN,KAAK;EACL,aAAa;GACX,AAAK,KACH,EAAW,EAAK;EAEpB;CACF,CAAC,GACM;AACT,CAAC,CAAC;AACF,QAAA,IAAA,aAA6B,iBAAc,EAAM,cAAc"}
1
+ {"version":3,"file":"index410.js","names":["React","REASONS.itemPress"],"sources":["../../../node_modules/@base-ui/react/select/item/SelectItem.mjs"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useStore } from '@base-ui/utils/store';\nimport { useSelectRootContext } from \"../root/SelectRootContext.mjs\";\nimport { useCompositeListItem, IndexGuessBehavior } from \"../../internals/composite/list/useCompositeListItem.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { SelectItemContext } from \"./SelectItemContext.mjs\";\nimport { selectors } from \"../store.mjs\";\nimport { useButton } from \"../../internals/use-button/index.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { compareItemEquality, removeItem } from \"../../internals/itemEquality.mjs\";\nimport { isVirtualClick } from \"../../floating-ui-react/utils/event.mjs\";\n\n/**\n * An individual option in the select popup.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Select](https://base-ui.com/react/components/select)\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const SelectItem = /*#__PURE__*/React.memo(/*#__PURE__*/React.forwardRef(function SelectItem(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n value: itemValue = null,\n label,\n disabled = false,\n nativeButton = false,\n ...elementProps\n } = componentProps;\n const textRef = React.useRef(null);\n const listItem = useCompositeListItem({\n label,\n textRef,\n indexGuessBehavior: IndexGuessBehavior.GuessFromOrder\n });\n const {\n store,\n itemProps,\n setOpen,\n setValue,\n selectionRef,\n typingRef,\n valuesRef,\n multiple,\n selectedItemTextRef,\n disabled: selectDisabled,\n readOnly\n } = useSelectRootContext();\n const highlighted = useStore(store, selectors.isActive, listItem.index);\n const open = useStore(store, selectors.open);\n const selected = useStore(store, selectors.isSelected, itemValue);\n const selectedByFocus = useStore(store, selectors.isSelectedByFocus, listItem.index);\n const isItemEqualToValue = useStore(store, selectors.isItemEqualToValue);\n const index = listItem.index;\n const hasRegistered = index !== -1;\n const itemRef = React.useRef(null);\n useIsoLayoutEffect(() => {\n if (!hasRegistered) {\n return undefined;\n }\n const values = valuesRef.current;\n values[index] = itemValue;\n return () => {\n delete values[index];\n };\n }, [hasRegistered, index, itemValue, valuesRef]);\n useIsoLayoutEffect(() => {\n if (!hasRegistered) {\n return;\n }\n const selectedValue = store.state.value;\n let selectedCandidate = selectedValue;\n if (multiple && Array.isArray(selectedValue)) {\n // Compare against the last selected item, or `undefined` when nothing is selected — never\n // the raw array, which a custom `isItemEqualToValue` isn't expected to receive.\n selectedCandidate = selectedValue.length > 0 ? selectedValue[selectedValue.length - 1] : undefined;\n }\n if (selectedCandidate !== undefined && compareItemEquality(itemValue, selectedCandidate, isItemEqualToValue)) {\n store.set('selectedIndex', index);\n // Make sure SelectPopup can measure the selected item on first open.\n // SelectItemText can still update this ref later when focus moves.\n if (textRef.current) {\n selectedItemTextRef.current = textRef.current;\n }\n }\n }, [hasRegistered, index, multiple, isItemEqualToValue, store, itemValue, selectedItemTextRef]);\n const lastKeyRef = React.useRef(null);\n const pointerTypeRef = React.useRef('mouse');\n const allowMouseSelectionRef = React.useRef(false);\n const {\n getButtonProps,\n buttonRef\n } = useButton({\n disabled,\n focusableWhenDisabled: true,\n native: nativeButton,\n composite: true\n });\n const state = {\n disabled,\n selected,\n highlighted\n };\n function commitSelection(event) {\n // A forced-open select (`open`/`defaultOpen`) can still receive item activations even\n // when the root is disabled or read-only, so guard the commit here too.\n if (selectDisabled || readOnly) {\n return;\n }\n const selectedValue = store.state.value;\n if (multiple) {\n const currentValue = Array.isArray(selectedValue) ? selectedValue : [];\n const nextValue = selected ? removeItem(currentValue, itemValue, isItemEqualToValue) : [...currentValue, itemValue];\n setValue(nextValue, createChangeEventDetails(REASONS.itemPress, event));\n } else {\n setValue(itemValue, createChangeEventDetails(REASONS.itemPress, event));\n setOpen(false, createChangeEventDetails(REASONS.itemPress, event));\n }\n }\n function resetDragMovement() {\n selectionRef.current.dragY = 0;\n }\n const defaultProps = {\n role: 'option',\n 'aria-selected': selected,\n tabIndex: open && highlighted ? 0 : -1,\n onKeyDown(event) {\n lastKeyRef.current = event.key;\n store.set('activeIndex', index);\n if (event.key === ' ' && typingRef.current) {\n event.preventDefault();\n }\n },\n onClick(event) {\n const isMouseClick = event.type === 'click' && pointerTypeRef.current !== 'touch';\n const clickPointerType = event.nativeEvent.pointerType;\n const isVirtualMouseClick = isMouseClick && isVirtualClick(event.nativeEvent) && (\n // Generic no-pointer `detail === 0` clicks stay tied to highlight state. Virtual\n // clicks that carry browser pointer data, including an empty string from assistive\n // technology, can activate unhighlighted items.\n clickPointerType !== undefined || highlighted);\n // With alignItemWithTrigger, opening can place an item under the cursor. Real mouse\n // clicks must start on the item, while virtual clicks represent explicit keyboard or\n // assistive technology activation.\n const isInvalidMouseClick = isMouseClick && !isVirtualMouseClick && !allowMouseSelectionRef.current;\n allowMouseSelectionRef.current = false;\n\n // Prevent double commit on {Enter}\n if (event.type === 'keydown' && lastKeyRef.current === null) {\n return;\n }\n if (disabled || event.type === 'keydown' && lastKeyRef.current === ' ' && typingRef.current || isInvalidMouseClick) {\n return;\n }\n lastKeyRef.current = null;\n commitSelection(event.nativeEvent);\n },\n onPointerEnter(event) {\n pointerTypeRef.current = event.pointerType;\n },\n onPointerMove(event) {\n if (event.pointerType === 'mouse' && event.buttons === 1) {\n const selection = selectionRef.current;\n selection.dragY += event.movementY;\n if (selection.dragY ** 2 >= 64) {\n selection.allowUnselectedMouseUp = true;\n }\n }\n },\n onPointerDown(event) {\n pointerTypeRef.current = event.pointerType;\n allowMouseSelectionRef.current = true;\n resetDragMovement();\n },\n onMouseUp() {\n resetDragMovement();\n if (disabled || pointerTypeRef.current === 'touch') {\n return;\n }\n\n // Regular clicks are committed by the click event.\n if (allowMouseSelectionRef.current) {\n return;\n }\n const disallowSelectedMouseUp = !selectionRef.current.allowSelectedMouseUp && selected;\n const disallowUnselectedMouseUp = !selectionRef.current.allowUnselectedMouseUp && !selected;\n if (disallowSelectedMouseUp || disallowUnselectedMouseUp) {\n return;\n }\n allowMouseSelectionRef.current = true;\n itemRef.current?.click();\n allowMouseSelectionRef.current = false;\n }\n };\n const element = useRenderElement('div', componentProps, {\n ref: [buttonRef, forwardedRef, listItem.ref, itemRef],\n state,\n props: [itemProps, defaultProps, elementProps, getButtonProps]\n });\n const contextValue = React.useMemo(() => ({\n selected,\n index,\n textRef,\n selectedByFocus,\n hasRegistered\n }), [selected, index, textRef, selectedByFocus, hasRegistered]);\n return /*#__PURE__*/_jsx(SelectItemContext.Provider, {\n value: contextValue,\n children: element\n });\n}));\nif (process.env.NODE_ENV !== \"production\") SelectItem.displayName = \"SelectItem\";"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;AAuBA,IAAa,IAA0B,gBAAM,KAAkB,gBAAM,WAAW,SAAoB,GAAgB,GAAc;CAChI,IAAM,EACJ,YACA,eACA,WACA,OAAO,IAAY,MACnB,UACA,cAAW,IACX,kBAAe,IACf,GAAG,MACD,GACE,IAAUA,EAAM,OAAO,IAAI,GAC3B,IAAW,EAAqB;EACpC;EACA;EACA,oBAAoB,EAAmB;CACzC,CAAC,GACK,EACJ,UACA,cACA,YACA,aACA,iBACA,cACA,cACA,aACA,wBACA,UAAU,GACV,gBACE,EAAqB,GACnB,IAAc,EAAS,GAAO,EAAU,UAAU,EAAS,KAAK,GAChE,IAAO,EAAS,GAAO,EAAU,IAAI,GACrC,IAAW,EAAS,GAAO,EAAU,YAAY,CAAS,GAC1D,IAAkB,EAAS,GAAO,EAAU,mBAAmB,EAAS,KAAK,GAC7E,IAAqB,EAAS,GAAO,EAAU,kBAAkB,GACjE,IAAQ,EAAS,OACjB,IAAgB,MAAU,IA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EAAO;EACpD;EACA,OAAO;GAAC;GAAW;GAAc;GAAc;EAAc;CAC/D,CAAC,GACK,KAAeD,EAAM,eAAe;EACxC;EACA;EACA;EACA;EACA;CACF,IAAI;EAAC;EAAU;EAAO;EAAS;EAAiB;CAAa,CAAC;CAC9D,OAAoB,gBAAK,EAAkB,UAAU;EACnD,OAAO;EACP,UAAU;CACZ,CAAC;AACH,CAAC,CAAC;AACF,QAAA,IAAA,aAA6B,iBAAc,EAAW,cAAc"}
package/dist/index411.js CHANGED
@@ -1,30 +1,43 @@
1
1
  "use client";
2
2
  import { useRenderElement as e } from "./index196.js";
3
- import { useSelectRootContext as t } from "./index366.js";
4
- import { useSelectItemContext as n } from "./index408.js";
5
- import * as r from "react";
6
- //#region ../../node_modules/@base-ui/react/select/item-text/SelectItemText.mjs
7
- var i = /*#__PURE__*/ r.memo(/*#__PURE__*/ r.forwardRef(function(i, a) {
8
- let { index: o, textRef: s, selectedByFocus: c, hasRegistered: l } = n(), { firstItemTextRef: u, selectedItemTextRef: d } = t(), { render: f, className: p, style: m, ...h } = i;
9
- return e("div", i, {
10
- ref: [
11
- r.useCallback((e) => {
12
- e && (l && o === 0 && (u.current = e), l && c && (d.current = e));
13
- }, [
14
- u,
15
- d,
16
- o,
17
- c,
18
- l
19
- ]),
20
- a,
21
- s
22
- ],
23
- props: h
3
+ import { transitionStatusMapping as t } from "./index197.js";
4
+ import { useTransitionStatus as n } from "./index265.js";
5
+ import { useOpenChangeComplete as r } from "./index267.js";
6
+ import { useSelectItemContext as i } from "./index409.js";
7
+ import * as a from "react";
8
+ import { jsx as o } from "react/jsx-runtime";
9
+ //#region ../../node_modules/@base-ui/react/select/item-indicator/SelectItemIndicator.mjs
10
+ var s = /*#__PURE__*/ a.forwardRef(function(e, t) {
11
+ let n = e.keepMounted ?? !1, { selected: r } = i();
12
+ return n || r ? /*#__PURE__*/ o(c, {
13
+ ...e,
14
+ ref: t
15
+ }) : null;
16
+ });
17
+ process.env.NODE_ENV !== "production" && (s.displayName = "SelectItemIndicator");
18
+ var c = /*#__PURE__*/ a.memo(/*#__PURE__*/ a.forwardRef((o, s) => {
19
+ let { render: c, className: l, style: u, keepMounted: d, ...f } = o, { selected: p } = i(), m = a.useRef(null), { transitionStatus: h, setMounted: g } = n(p), _ = e("span", o, {
20
+ ref: [s, m],
21
+ state: {
22
+ selected: p,
23
+ transitionStatus: h
24
+ },
25
+ props: [{
26
+ "aria-hidden": !0,
27
+ children: "✔️"
28
+ }, f],
29
+ stateAttributesMapping: t
24
30
  });
31
+ return r({
32
+ open: p,
33
+ ref: m,
34
+ onComplete() {
35
+ p || g(!1);
36
+ }
37
+ }), _;
25
38
  }));
26
- process.env.NODE_ENV !== "production" && (i.displayName = "SelectItemText");
39
+ process.env.NODE_ENV !== "production" && (c.displayName = "Inner");
27
40
  //#endregion
28
- export { i as SelectItemText };
41
+ export { s as SelectItemIndicator };
29
42
 
30
43
  //# sourceMappingURL=index411.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index411.js","names":["React"],"sources":["../../../node_modules/@base-ui/react/select/item-text/SelectItemText.mjs"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useSelectRootContext } from \"../root/SelectRootContext.mjs\";\nimport { useSelectItemContext } from \"../item/SelectItemContext.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\n\n/**\n * A text label of the select item.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Select](https://base-ui.com/react/components/select)\n */\nexport const SelectItemText = /*#__PURE__*/React.memo(/*#__PURE__*/React.forwardRef(function SelectItemText(componentProps, forwardedRef) {\n const {\n index,\n textRef,\n selectedByFocus,\n hasRegistered\n } = useSelectItemContext();\n const {\n firstItemTextRef,\n selectedItemTextRef\n } = useSelectRootContext();\n const {\n render,\n className,\n style,\n ...elementProps\n } = componentProps;\n const localRef = React.useCallback(node => {\n if (!node) {\n return;\n }\n if (hasRegistered && index === 0) {\n firstItemTextRef.current = node;\n }\n if (hasRegistered && selectedByFocus) {\n selectedItemTextRef.current = node;\n }\n }, [firstItemTextRef, selectedItemTextRef, index, selectedByFocus, hasRegistered]);\n const element = useRenderElement('div', componentProps, {\n ref: [localRef, forwardedRef, textRef],\n props: elementProps\n });\n return element;\n}));\nif (process.env.NODE_ENV !== \"production\") SelectItemText.displayName = \"SelectItemText\";"],"x_google_ignoreList":[0],"mappings":";;;;;;AAaA,IAAa,IAA8B,gBAAM,KAAkB,gBAAM,WAAW,SAAwB,GAAgB,GAAc;CACxI,IAAM,EACJ,UACA,YACA,oBACA,qBACE,EAAqB,GACnB,EACJ,qBACA,2BACE,EAAqB,GACnB,EACJ,WACA,cACA,UACA,GAAG,MACD;CAgBJ,OAJgB,EAAiB,OAAO,GAAgB;EACtD,KAAK;GAZUA,EAAM,aAAY,MAAQ;IACpC,MAGD,KAAiB,MAAU,MAC7B,EAAiB,UAAU,IAEzB,KAAiB,MACnB,EAAoB,UAAU;GAElC,GAAG;IAAC;IAAkB;IAAqB;IAAO;IAAiB;GAAa,CAEjE;GAAG;GAAc;EAAO;EACrC,OAAO;CACT,CACa;AACf,CAAC,CAAC;AACF,QAAA,IAAA,aAA6B,iBAAc,EAAe,cAAc"}
1
+ {"version":3,"file":"index411.js","names":["React"],"sources":["../../../node_modules/@base-ui/react/select/item-indicator/SelectItemIndicator.mjs"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useSelectItemContext } from \"../item/SelectItemContext.mjs\";\nimport { useTransitionStatus } from \"../../internals/useTransitionStatus.mjs\";\nimport { useOpenChangeComplete } from \"../../internals/useOpenChangeComplete.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { transitionStatusMapping } from \"../../internals/stateAttributesMapping.mjs\";\n\n/**\n * Indicates whether the select item is selected.\n * Renders a `<span>` element.\n *\n * Documentation: [Base UI Select](https://base-ui.com/react/components/select)\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const SelectItemIndicator = /*#__PURE__*/React.forwardRef(function SelectItemIndicator(componentProps, forwardedRef) {\n const keepMounted = componentProps.keepMounted ?? false;\n const {\n selected\n } = useSelectItemContext();\n const shouldRender = keepMounted || selected;\n if (!shouldRender) {\n return null;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n return /*#__PURE__*/_jsx(Inner, {\n ...componentProps,\n ref: forwardedRef\n });\n});\n\n// Split the core implementation to avoid paying the hook costs unless the element needs to mount.\nif (process.env.NODE_ENV !== \"production\") SelectItemIndicator.displayName = \"SelectItemIndicator\";\nconst Inner = /*#__PURE__*/React.memo(/*#__PURE__*/React.forwardRef((componentProps, forwardedRef) => {\n const {\n render,\n className,\n style,\n keepMounted,\n ...elementProps\n } = componentProps;\n const {\n selected\n } = useSelectItemContext();\n const indicatorRef = React.useRef(null);\n const {\n transitionStatus,\n setMounted\n } = useTransitionStatus(selected);\n const state = {\n selected,\n transitionStatus\n };\n const element = useRenderElement('span', componentProps, {\n ref: [forwardedRef, indicatorRef],\n state,\n props: [{\n 'aria-hidden': true,\n children: '✔️'\n }, elementProps],\n stateAttributesMapping: transitionStatusMapping\n });\n useOpenChangeComplete({\n open: selected,\n ref: indicatorRef,\n onComplete() {\n if (!selected) {\n setMounted(false);\n }\n }\n });\n return element;\n}));\nif (process.env.NODE_ENV !== \"production\") Inner.displayName = \"Inner\";"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;AAgBA,IAAa,IAAmC,gBAAM,WAAW,SAA6B,GAAgB,GAAc;CAC1H,IAAM,IAAc,EAAe,eAAe,IAC5C,EACJ,gBACE,EAAqB;CAOzB,OANqB,KAAe,IAMhB,gBAAK,GAAO;EAC9B,GAAG;EACH,KAAK;CACP,CAAC,IAPQ;AAQX,CAAC;AAGD,QAAA,IAAA,aAA6B,iBAAc,EAAoB,cAAc;AAC7E,IAAM,IAAqB,gBAAM,KAAkB,gBAAM,YAAY,GAAgB,MAAiB;CACpG,IAAM,EACJ,WACA,cACA,UACA,gBACA,GAAG,MACD,GACE,EACJ,gBACE,EAAqB,GACnB,IAAeA,EAAM,OAAO,IAAI,GAChC,EACJ,qBACA,kBACE,EAAoB,CAAQ,GAK1B,IAAU,EAAiB,QAAQ,GAAgB;EACvD,KAAK,CAAC,GAAc,CAAY;EAChC,OAAA;GALA;GACA;EAII;EACJ,OAAO,CAAC;GACN,eAAe;GACf,UAAU;EACZ,GAAG,CAAY;EACf,wBAAwB;CAC1B,CAAC;CAUD,OATA,EAAsB;EACpB,MAAM;EACN,KAAK;EACL,aAAa;GACX,AAAK,KACH,EAAW,EAAK;EAEpB;CACF,CAAC,GACM;AACT,CAAC,CAAC;AACF,QAAA,IAAA,aAA6B,iBAAc,EAAM,cAAc"}
package/dist/index412.js CHANGED
@@ -1,15 +1,30 @@
1
1
  "use client";
2
- import e from "./index183.js";
3
- import * as t from "react";
4
- //#region ../../node_modules/@base-ui/react/select/group/SelectGroupContext.mjs
5
- var n = /*#__PURE__*/ t.createContext(void 0);
6
- process.env.NODE_ENV !== "production" && (n.displayName = "SelectGroupContext");
7
- function r() {
8
- let r = t.useContext(n);
9
- if (r === void 0) throw Error(process.env.NODE_ENV === "production" ? e(56) : "Base UI: SelectGroupContext is missing. SelectGroup parts must be placed within <Select.Group>.");
10
- return r;
11
- }
2
+ import { useRenderElement as e } from "./index196.js";
3
+ import { useSelectRootContext as t } from "./index367.js";
4
+ import { useSelectItemContext as n } from "./index409.js";
5
+ import * as r from "react";
6
+ //#region ../../node_modules/@base-ui/react/select/item-text/SelectItemText.mjs
7
+ var i = /*#__PURE__*/ r.memo(/*#__PURE__*/ r.forwardRef(function(i, a) {
8
+ let { index: o, textRef: s, selectedByFocus: c, hasRegistered: l } = n(), { firstItemTextRef: u, selectedItemTextRef: d } = t(), { render: f, className: p, style: m, ...h } = i;
9
+ return e("div", i, {
10
+ ref: [
11
+ r.useCallback((e) => {
12
+ e && (l && o === 0 && (u.current = e), l && c && (d.current = e));
13
+ }, [
14
+ u,
15
+ d,
16
+ o,
17
+ c,
18
+ l
19
+ ]),
20
+ a,
21
+ s
22
+ ],
23
+ props: h
24
+ });
25
+ }));
26
+ process.env.NODE_ENV !== "production" && (i.displayName = "SelectItemText");
12
27
  //#endregion
13
- export { n as SelectGroupContext, r as useSelectGroupContext };
28
+ export { i as SelectItemText };
14
29
 
15
30
  //# sourceMappingURL=index412.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index412.js","names":["React","_formatErrorMessage"],"sources":["../../../node_modules/@base-ui/react/select/group/SelectGroupContext.mjs"],"sourcesContent":["'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const SelectGroupContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") SelectGroupContext.displayName = \"SelectGroupContext\";\nexport function useSelectGroupContext() {\n const context = React.useContext(SelectGroupContext);\n if (context === undefined) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: SelectGroupContext is missing. SelectGroup parts must be placed within <Select.Group>.' : _formatErrorMessage(56));\n }\n return context;\n}"],"x_google_ignoreList":[0],"mappings":";;;;AAIA,IAAa,IAAkC,gBAAM,cAAc,KAAA,CAAS;AAC5E,QAAA,IAAA,aAA6B,iBAAc,EAAmB,cAAc;AAC5E,SAAgB,IAAwB;CACtC,IAAM,IAAUA,EAAM,WAAW,CAAkB;CACnD,IAAI,MAAY,KAAA,GACd,MAAU,MAAA,QAAA,IAAA,aAA+B,eAAmHC,EAAoB,EAAE,IAA1H,iGAA2H;CAErL,OAAO;AACT"}
1
+ {"version":3,"file":"index412.js","names":["React"],"sources":["../../../node_modules/@base-ui/react/select/item-text/SelectItemText.mjs"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useSelectRootContext } from \"../root/SelectRootContext.mjs\";\nimport { useSelectItemContext } from \"../item/SelectItemContext.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\n\n/**\n * A text label of the select item.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Select](https://base-ui.com/react/components/select)\n */\nexport const SelectItemText = /*#__PURE__*/React.memo(/*#__PURE__*/React.forwardRef(function SelectItemText(componentProps, forwardedRef) {\n const {\n index,\n textRef,\n selectedByFocus,\n hasRegistered\n } = useSelectItemContext();\n const {\n firstItemTextRef,\n selectedItemTextRef\n } = useSelectRootContext();\n const {\n render,\n className,\n style,\n ...elementProps\n } = componentProps;\n const localRef = React.useCallback(node => {\n if (!node) {\n return;\n }\n if (hasRegistered && index === 0) {\n firstItemTextRef.current = node;\n }\n if (hasRegistered && selectedByFocus) {\n selectedItemTextRef.current = node;\n }\n }, [firstItemTextRef, selectedItemTextRef, index, selectedByFocus, hasRegistered]);\n const element = useRenderElement('div', componentProps, {\n ref: [localRef, forwardedRef, textRef],\n props: elementProps\n });\n return element;\n}));\nif (process.env.NODE_ENV !== \"production\") SelectItemText.displayName = \"SelectItemText\";"],"x_google_ignoreList":[0],"mappings":";;;;;;AAaA,IAAa,IAA8B,gBAAM,KAAkB,gBAAM,WAAW,SAAwB,GAAgB,GAAc;CACxI,IAAM,EACJ,UACA,YACA,oBACA,qBACE,EAAqB,GACnB,EACJ,qBACA,2BACE,EAAqB,GACnB,EACJ,WACA,cACA,UACA,GAAG,MACD;CAgBJ,OAJgB,EAAiB,OAAO,GAAgB;EACtD,KAAK;GAZUA,EAAM,aAAY,MAAQ;IACpC,MAGD,KAAiB,MAAU,MAC7B,EAAiB,UAAU,IAEzB,KAAiB,MACnB,EAAoB,UAAU;GAElC,GAAG;IAAC;IAAkB;IAAqB;IAAO;IAAiB;GAAa,CAEjE;GAAG;GAAc;EAAO;EACrC,OAAO;CACT,CACa;AACf,CAAC,CAAC;AACF,QAAA,IAAA,aAA6B,iBAAc,EAAe,cAAc"}
package/dist/index413.js CHANGED
@@ -1,27 +1,15 @@
1
1
  "use client";
2
- import { useRenderElement as e } from "./index196.js";
3
- import { SelectGroupContext as t } from "./index412.js";
4
- import * as n from "react";
5
- import { jsx as r } from "react/jsx-runtime";
6
- //#region ../../node_modules/@base-ui/react/select/group/SelectGroup.mjs
7
- var i = /*#__PURE__*/ n.forwardRef(function(i, a) {
8
- let { render: o, className: s, style: c, ...l } = i, [u, d] = n.useState(), f = n.useMemo(() => ({
9
- labelId: u,
10
- setLabelId: d
11
- }), [u, d]), p = e("div", i, {
12
- ref: a,
13
- props: [{
14
- role: "group",
15
- "aria-labelledby": u
16
- }, l]
17
- });
18
- return /*#__PURE__*/ r(t.Provider, {
19
- value: f,
20
- children: p
21
- });
22
- });
23
- process.env.NODE_ENV !== "production" && (i.displayName = "SelectGroup");
2
+ import e from "./index183.js";
3
+ import * as t from "react";
4
+ //#region ../../node_modules/@base-ui/react/select/group/SelectGroupContext.mjs
5
+ var n = /*#__PURE__*/ t.createContext(void 0);
6
+ process.env.NODE_ENV !== "production" && (n.displayName = "SelectGroupContext");
7
+ function r() {
8
+ let r = t.useContext(n);
9
+ if (r === void 0) throw Error(process.env.NODE_ENV === "production" ? e(56) : "Base UI: SelectGroupContext is missing. SelectGroup parts must be placed within <Select.Group>.");
10
+ return r;
11
+ }
24
12
  //#endregion
25
- export { i as SelectGroup };
13
+ export { n as SelectGroupContext, r as useSelectGroupContext };
26
14
 
27
15
  //# sourceMappingURL=index413.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index413.js","names":["React"],"sources":["../../../node_modules/@base-ui/react/select/group/SelectGroup.mjs"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { SelectGroupContext } from \"./SelectGroupContext.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\n\n/**\n * Groups related select items with the corresponding label.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Select](https://base-ui.com/react/components/select)\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const SelectGroup = /*#__PURE__*/React.forwardRef(function SelectGroup(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n ...elementProps\n } = componentProps;\n const [labelId, setLabelId] = React.useState();\n const contextValue = React.useMemo(() => ({\n labelId,\n setLabelId\n }), [labelId, setLabelId]);\n const element = useRenderElement('div', componentProps, {\n ref: forwardedRef,\n props: [{\n role: 'group',\n 'aria-labelledby': labelId\n }, elementProps]\n });\n return /*#__PURE__*/_jsx(SelectGroupContext.Provider, {\n value: contextValue,\n children: element\n });\n});\nif (process.env.NODE_ENV !== \"production\") SelectGroup.displayName = \"SelectGroup\";"],"x_google_ignoreList":[0],"mappings":";;;;;;AAaA,IAAa,IAA2B,gBAAM,WAAW,SAAqB,GAAgB,GAAc;CAC1G,IAAM,EACJ,WACA,cACA,UACA,GAAG,MACD,GACE,CAAC,GAAS,KAAcA,EAAM,SAAS,GACvC,IAAeA,EAAM,eAAe;EACxC;EACA;CACF,IAAI,CAAC,GAAS,CAAU,CAAC,GACnB,IAAU,EAAiB,OAAO,GAAgB;EACtD,KAAK;EACL,OAAO,CAAC;GACN,MAAM;GACN,mBAAmB;EACrB,GAAG,CAAY;CACjB,CAAC;CACD,OAAoB,gBAAK,EAAmB,UAAU;EACpD,OAAO;EACP,UAAU;CACZ,CAAC;AACH,CAAC;AACD,QAAA,IAAA,aAA6B,iBAAc,EAAY,cAAc"}
1
+ {"version":3,"file":"index413.js","names":["React","_formatErrorMessage"],"sources":["../../../node_modules/@base-ui/react/select/group/SelectGroupContext.mjs"],"sourcesContent":["'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const SelectGroupContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") SelectGroupContext.displayName = \"SelectGroupContext\";\nexport function useSelectGroupContext() {\n const context = React.useContext(SelectGroupContext);\n if (context === undefined) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: SelectGroupContext is missing. SelectGroup parts must be placed within <Select.Group>.' : _formatErrorMessage(56));\n }\n return context;\n}"],"x_google_ignoreList":[0],"mappings":";;;;AAIA,IAAa,IAAkC,gBAAM,cAAc,KAAA,CAAS;AAC5E,QAAA,IAAA,aAA6B,iBAAc,EAAmB,cAAc;AAC5E,SAAgB,IAAwB;CACtC,IAAM,IAAUA,EAAM,WAAW,CAAkB;CACnD,IAAI,MAAY,KAAA,GACd,MAAU,MAAA,QAAA,IAAA,aAA+B,eAAmHC,EAAoB,EAAE,IAA1H,iGAA2H;CAErL,OAAO;AACT"}
package/dist/index414.js CHANGED
@@ -1,21 +1,27 @@
1
1
  "use client";
2
2
  import { useRenderElement as e } from "./index196.js";
3
- import { useIsoLayoutEffect as t } from "./index204.js";
4
- import { useBaseUiId as n } from "./index212.js";
5
- import { useSelectGroupContext as r } from "./index412.js";
6
- import * as i from "react";
7
- //#region ../../node_modules/@base-ui/react/select/group-label/SelectGroupLabel.mjs
8
- var a = /*#__PURE__*/ i.forwardRef(function(i, a) {
9
- let { render: o, className: s, style: c, id: l, ...u } = i, { setLabelId: d } = r(), f = n(l);
10
- return t(() => {
11
- d(f);
12
- }, [f, d]), e("div", i, {
3
+ import { SelectGroupContext as t } from "./index413.js";
4
+ import * as n from "react";
5
+ import { jsx as r } from "react/jsx-runtime";
6
+ //#region ../../node_modules/@base-ui/react/select/group/SelectGroup.mjs
7
+ var i = /*#__PURE__*/ n.forwardRef(function(i, a) {
8
+ let { render: o, className: s, style: c, ...l } = i, [u, d] = n.useState(), f = n.useMemo(() => ({
9
+ labelId: u,
10
+ setLabelId: d
11
+ }), [u, d]), p = e("div", i, {
13
12
  ref: a,
14
- props: [{ id: f }, u]
13
+ props: [{
14
+ role: "group",
15
+ "aria-labelledby": u
16
+ }, l]
17
+ });
18
+ return /*#__PURE__*/ r(t.Provider, {
19
+ value: f,
20
+ children: p
15
21
  });
16
22
  });
17
- process.env.NODE_ENV !== "production" && (a.displayName = "SelectGroupLabel");
23
+ process.env.NODE_ENV !== "production" && (i.displayName = "SelectGroup");
18
24
  //#endregion
19
- export { a as SelectGroupLabel };
25
+ export { i as SelectGroup };
20
26
 
21
27
  //# sourceMappingURL=index414.js.map