@spark-ui/components 17.2.3 → 17.2.4

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 (302) hide show
  1. package/dist/DialogContent.styles-BSxCCi-u.mjs +62 -0
  2. package/dist/DialogContent.styles-BSxCCi-u.mjs.map +1 -0
  3. package/dist/DialogContent.styles-CAhJtUud.js +2 -0
  4. package/dist/DialogContent.styles-CAhJtUud.js.map +1 -0
  5. package/dist/FormFieldRequiredIndicator-CtgkvPZo.js +2 -0
  6. package/dist/FormFieldRequiredIndicator-CtgkvPZo.js.map +1 -0
  7. package/dist/FormFieldRequiredIndicator-DOGQ_HxO.mjs +14 -0
  8. package/dist/FormFieldRequiredIndicator-DOGQ_HxO.mjs.map +1 -0
  9. package/dist/accordion/index.js +2 -2
  10. package/dist/accordion/index.js.map +1 -1
  11. package/dist/accordion/index.mjs +99 -161
  12. package/dist/accordion/index.mjs.map +1 -1
  13. package/dist/alert-dialog/index.js +2 -2
  14. package/dist/alert-dialog/index.js.map +1 -1
  15. package/dist/alert-dialog/index.mjs +169 -235
  16. package/dist/alert-dialog/index.mjs.map +1 -1
  17. package/dist/avatar/index.js +2 -2
  18. package/dist/avatar/index.js.map +1 -1
  19. package/dist/avatar/index.mjs +187 -224
  20. package/dist/avatar/index.mjs.map +1 -1
  21. package/dist/badge/index.js +2 -2
  22. package/dist/badge/index.js.map +1 -1
  23. package/dist/badge/index.mjs +115 -81
  24. package/dist/badge/index.mjs.map +1 -1
  25. package/dist/breadcrumb/index.js +2 -2
  26. package/dist/breadcrumb/index.js.map +1 -1
  27. package/dist/breadcrumb/index.mjs +73 -106
  28. package/dist/breadcrumb/index.mjs.map +1 -1
  29. package/dist/button/index.js +1 -2
  30. package/dist/button/index.mjs +2 -5
  31. package/dist/button-BTDRzvpB.js +2 -0
  32. package/dist/button-BTDRzvpB.js.map +1 -0
  33. package/dist/button-_YZ_4J42.mjs +643 -0
  34. package/dist/button-_YZ_4J42.mjs.map +1 -0
  35. package/dist/card/index.js +2 -2
  36. package/dist/card/index.js.map +1 -1
  37. package/dist/card/index.mjs +327 -394
  38. package/dist/card/index.mjs.map +1 -1
  39. package/dist/carousel/index.js +2 -2
  40. package/dist/carousel/index.js.map +1 -1
  41. package/dist/carousel/index.mjs +515 -618
  42. package/dist/carousel/index.mjs.map +1 -1
  43. package/dist/checkbox/index.js +2 -2
  44. package/dist/checkbox/index.js.map +1 -1
  45. package/dist/checkbox/index.mjs +213 -246
  46. package/dist/checkbox/index.mjs.map +1 -1
  47. package/dist/chip/index.js +2 -2
  48. package/dist/chip/index.js.map +1 -1
  49. package/dist/chip/index.mjs +601 -652
  50. package/dist/chip/index.mjs.map +1 -1
  51. package/dist/chunk-C91j1N6u.js +1 -0
  52. package/dist/circular-meter/index.js +2 -2
  53. package/dist/circular-meter/index.js.map +1 -1
  54. package/dist/circular-meter/index.mjs +354 -309
  55. package/dist/circular-meter/index.mjs.map +1 -1
  56. package/dist/collapsible/index.js +2 -2
  57. package/dist/collapsible/index.js.map +1 -1
  58. package/dist/collapsible/index.mjs +53 -53
  59. package/dist/collapsible/index.mjs.map +1 -1
  60. package/dist/combobox/index.js +2 -2
  61. package/dist/combobox/index.js.map +1 -1
  62. package/dist/combobox/index.mjs +721 -876
  63. package/dist/combobox/index.mjs.map +1 -1
  64. package/dist/dialog/index.js +2 -2
  65. package/dist/dialog/index.js.map +1 -1
  66. package/dist/dialog/index.mjs +181 -206
  67. package/dist/dialog/index.mjs.map +1 -1
  68. package/dist/divider/index.js +2 -2
  69. package/dist/divider/index.js.map +1 -1
  70. package/dist/divider/index.mjs +178 -183
  71. package/dist/divider/index.mjs.map +1 -1
  72. package/dist/drawer/index.js +2 -2
  73. package/dist/drawer/index.js.map +1 -1
  74. package/dist/drawer/index.mjs +277 -309
  75. package/dist/drawer/index.mjs.map +1 -1
  76. package/dist/dropdown/index.js +2 -2
  77. package/dist/dropdown/index.js.map +1 -1
  78. package/dist/dropdown/index.mjs +429 -492
  79. package/dist/dropdown/index.mjs.map +1 -1
  80. package/dist/file-upload/index.js +2 -2
  81. package/dist/file-upload/index.js.map +1 -1
  82. package/dist/file-upload/index.mjs +540 -677
  83. package/dist/file-upload/index.mjs.map +1 -1
  84. package/dist/form-field/index.js +1 -2
  85. package/dist/form-field/index.mjs +2 -284
  86. package/dist/form-field-B8QzM655.mjs +231 -0
  87. package/dist/form-field-B8QzM655.mjs.map +1 -0
  88. package/dist/form-field-Bu_0E9tb.js +2 -0
  89. package/dist/form-field-Bu_0E9tb.js.map +1 -0
  90. package/dist/icon/index.js +1 -2
  91. package/dist/icon/index.mjs +2 -5
  92. package/dist/icon-CRPcdgYp.js +2 -0
  93. package/dist/icon-CRPcdgYp.js.map +1 -0
  94. package/dist/icon-D05Uqh8_.mjs +41 -0
  95. package/dist/icon-D05Uqh8_.mjs.map +1 -0
  96. package/dist/icon-button/index.js +1 -2
  97. package/dist/icon-button/index.mjs +2 -5
  98. package/dist/icon-button-6p3O7NIm.mjs +28 -0
  99. package/dist/icon-button-6p3O7NIm.mjs.map +1 -0
  100. package/dist/icon-button-CykysbgJ.js +2 -0
  101. package/dist/icon-button-CykysbgJ.js.map +1 -0
  102. package/dist/input/index.js +1 -2
  103. package/dist/input/index.mjs +2 -455
  104. package/dist/input-CmYeHYWQ.mjs +355 -0
  105. package/dist/input-CmYeHYWQ.mjs.map +1 -0
  106. package/dist/input-DNr40G2Z.js +2 -0
  107. package/dist/input-DNr40G2Z.js.map +1 -0
  108. package/dist/input-otp/index.js +2 -2
  109. package/dist/input-otp/index.js.map +1 -1
  110. package/dist/input-otp/index.mjs +344 -407
  111. package/dist/input-otp/index.mjs.map +1 -1
  112. package/dist/kbd/index.js +2 -2
  113. package/dist/kbd/index.js.map +1 -1
  114. package/dist/kbd/index.mjs +12 -17
  115. package/dist/kbd/index.mjs.map +1 -1
  116. package/dist/label/index.js +1 -2
  117. package/dist/label/index.mjs +2 -40
  118. package/dist/label-BqRlrca0.mjs +31 -0
  119. package/dist/label-BqRlrca0.mjs.map +1 -0
  120. package/dist/label-DU0p0d-f.js +2 -0
  121. package/dist/label-DU0p0d-f.js.map +1 -0
  122. package/dist/link-box/index.js +2 -2
  123. package/dist/link-box/index.js.map +1 -1
  124. package/dist/link-box/index.mjs +36 -34
  125. package/dist/link-box/index.mjs.map +1 -1
  126. package/dist/meter/index.js +2 -2
  127. package/dist/meter/index.js.map +1 -1
  128. package/dist/meter/index.mjs +149 -171
  129. package/dist/meter/index.mjs.map +1 -1
  130. package/dist/pagination/index.js +2 -2
  131. package/dist/pagination/index.js.map +1 -1
  132. package/dist/pagination/index.mjs +253 -214
  133. package/dist/pagination/index.mjs.map +1 -1
  134. package/dist/popover/index.js +1 -2
  135. package/dist/popover/index.mjs +2 -239
  136. package/dist/popover-CxZAQmw6.mjs +211 -0
  137. package/dist/popover-CxZAQmw6.mjs.map +1 -0
  138. package/dist/popover-GOovJ27J.js +2 -0
  139. package/dist/popover-GOovJ27J.js.map +1 -0
  140. package/dist/portal/index.js +2 -2
  141. package/dist/portal/index.js.map +1 -1
  142. package/dist/portal/index.mjs +8 -7
  143. package/dist/portal/index.mjs.map +1 -1
  144. package/dist/progress/index.js +1 -2
  145. package/dist/progress/index.mjs +2 -178
  146. package/dist/progress-cEf3tFbn.mjs +132 -0
  147. package/dist/progress-cEf3tFbn.mjs.map +1 -0
  148. package/dist/progress-rJZcPJsZ.js +2 -0
  149. package/dist/progress-rJZcPJsZ.js.map +1 -0
  150. package/dist/progress-tracker/index.js +2 -2
  151. package/dist/progress-tracker/index.js.map +1 -1
  152. package/dist/progress-tracker/index.mjs +303 -380
  153. package/dist/progress-tracker/index.mjs.map +1 -1
  154. package/dist/radio-group/index.js +2 -2
  155. package/dist/radio-group/index.js.map +1 -1
  156. package/dist/radio-group/index.mjs +204 -213
  157. package/dist/radio-group/index.mjs.map +1 -1
  158. package/dist/rating/index.js +2 -2
  159. package/dist/rating/index.js.map +1 -1
  160. package/dist/rating/index.mjs +189 -244
  161. package/dist/rating/index.mjs.map +1 -1
  162. package/dist/rating-display/index.js +2 -2
  163. package/dist/rating-display/index.js.map +1 -1
  164. package/dist/rating-display/index.mjs +165 -166
  165. package/dist/rating-display/index.mjs.map +1 -1
  166. package/dist/scrolling-list/index.js +2 -2
  167. package/dist/scrolling-list/index.js.map +1 -1
  168. package/dist/scrolling-list/index.mjs +216 -273
  169. package/dist/scrolling-list/index.mjs.map +1 -1
  170. package/dist/segmented-control/index.js +2 -2
  171. package/dist/segmented-control/index.js.map +1 -1
  172. package/dist/segmented-control/index.mjs +146 -180
  173. package/dist/segmented-control/index.mjs.map +1 -1
  174. package/dist/segmented-gauge/index.js +2 -2
  175. package/dist/segmented-gauge/index.js.map +1 -1
  176. package/dist/segmented-gauge/index.mjs +146 -195
  177. package/dist/segmented-gauge/index.mjs.map +1 -1
  178. package/dist/select/index.js +2 -2
  179. package/dist/select/index.js.map +1 -1
  180. package/dist/select/index.mjs +279 -327
  181. package/dist/select/index.mjs.map +1 -1
  182. package/dist/skeleton/index.js +2 -2
  183. package/dist/skeleton/index.js.map +1 -1
  184. package/dist/skeleton/index.mjs +92 -114
  185. package/dist/skeleton/index.mjs.map +1 -1
  186. package/dist/slider/index.js +2 -2
  187. package/dist/slider/index.js.map +1 -1
  188. package/dist/slider/index.mjs +259 -326
  189. package/dist/slider/index.mjs.map +1 -1
  190. package/dist/slot/index.js +2 -2
  191. package/dist/slot/index.js.map +1 -1
  192. package/dist/slot/index.mjs +12 -7
  193. package/dist/slot/index.mjs.map +1 -1
  194. package/dist/snackbar/index.js +2 -2
  195. package/dist/snackbar/index.js.map +1 -1
  196. package/dist/snackbar/index.mjs +404 -529
  197. package/dist/snackbar/index.mjs.map +1 -1
  198. package/dist/spinner/index.js +1 -2
  199. package/dist/spinner/index.mjs +2 -5
  200. package/dist/spinner-DFUoYvmm.js +2 -0
  201. package/dist/spinner-DFUoYvmm.js.map +1 -0
  202. package/dist/spinner-DULLiM6a.mjs +56 -0
  203. package/dist/spinner-DULLiM6a.mjs.map +1 -0
  204. package/dist/src/avatar/index.d.mts +2 -2
  205. package/dist/src/avatar/index.d.ts +2 -2
  206. package/dist/src/file-upload/index.d.mts +1 -1
  207. package/dist/src/file-upload/index.d.ts +1 -1
  208. package/dist/stepper/index.js +2 -2
  209. package/dist/stepper/index.js.map +1 -1
  210. package/dist/stepper/index.mjs +139 -176
  211. package/dist/stepper/index.mjs.map +1 -1
  212. package/dist/switch/index.js +2 -2
  213. package/dist/switch/index.js.map +1 -1
  214. package/dist/switch/index.mjs +194 -197
  215. package/dist/switch/index.mjs.map +1 -1
  216. package/dist/tabs/index.js +2 -2
  217. package/dist/tabs/index.js.map +1 -1
  218. package/dist/tabs/index.mjs +337 -389
  219. package/dist/tabs/index.mjs.map +1 -1
  220. package/dist/tag/index.js +2 -2
  221. package/dist/tag/index.js.map +1 -1
  222. package/dist/tag/index.mjs +192 -211
  223. package/dist/tag/index.mjs.map +1 -1
  224. package/dist/text-link/index.js +2 -2
  225. package/dist/text-link/index.js.map +1 -1
  226. package/dist/text-link/index.mjs +44 -5
  227. package/dist/text-link/index.mjs.map +1 -1
  228. package/dist/textarea/index.js +2 -2
  229. package/dist/textarea/index.js.map +1 -1
  230. package/dist/textarea/index.mjs +51 -50
  231. package/dist/textarea/index.mjs.map +1 -1
  232. package/dist/toast/index.js +2 -2
  233. package/dist/toast/index.js.map +1 -1
  234. package/dist/toast/index.mjs +314 -367
  235. package/dist/toast/index.mjs.map +1 -1
  236. package/dist/useRenderSlot-DP4fYerF.mjs +11 -0
  237. package/dist/useRenderSlot-DP4fYerF.mjs.map +1 -0
  238. package/dist/useRenderSlot-Xxf_s88b.js +2 -0
  239. package/dist/useRenderSlot-Xxf_s88b.js.map +1 -0
  240. package/dist/visually-hidden/index.js +2 -2
  241. package/dist/visually-hidden/index.js.map +1 -1
  242. package/dist/visually-hidden/index.mjs +25 -5
  243. package/dist/visually-hidden/index.mjs.map +1 -1
  244. package/package.json +4 -4
  245. package/dist/Button-1M9DcZl0.mjs +0 -704
  246. package/dist/Button-1M9DcZl0.mjs.map +0 -1
  247. package/dist/Button-FZceRWG2.js +0 -2
  248. package/dist/Button-FZceRWG2.js.map +0 -1
  249. package/dist/DialogContent.styles-CziMQtYr.js +0 -2
  250. package/dist/DialogContent.styles-CziMQtYr.js.map +0 -1
  251. package/dist/DialogContent.styles-Du7_Dkde.mjs +0 -60
  252. package/dist/DialogContent.styles-Du7_Dkde.mjs.map +0 -1
  253. package/dist/FormFieldRequiredIndicator-CHfcoT2y.js +0 -2
  254. package/dist/FormFieldRequiredIndicator-CHfcoT2y.js.map +0 -1
  255. package/dist/FormFieldRequiredIndicator-DTnCGiX2.mjs +0 -13
  256. package/dist/FormFieldRequiredIndicator-DTnCGiX2.mjs.map +0 -1
  257. package/dist/Icon-BO327oHU.mjs +0 -57
  258. package/dist/Icon-BO327oHU.mjs.map +0 -1
  259. package/dist/Icon-C-cNTnzd.js +0 -2
  260. package/dist/Icon-C-cNTnzd.js.map +0 -1
  261. package/dist/IconButton-BR1bJSQA.js +0 -2
  262. package/dist/IconButton-BR1bJSQA.js.map +0 -1
  263. package/dist/IconButton-DdB3Pq13.mjs +0 -43
  264. package/dist/IconButton-DdB3Pq13.mjs.map +0 -1
  265. package/dist/Slot-DLY1rJrG.mjs +0 -14
  266. package/dist/Slot-DLY1rJrG.mjs.map +0 -1
  267. package/dist/Slot-DQ8z2zsy.js +0 -2
  268. package/dist/Slot-DQ8z2zsy.js.map +0 -1
  269. package/dist/Spinner-Br4Rp9V2.js +0 -2
  270. package/dist/Spinner-Br4Rp9V2.js.map +0 -1
  271. package/dist/Spinner-Co3AjkQV.mjs +0 -68
  272. package/dist/Spinner-Co3AjkQV.mjs.map +0 -1
  273. package/dist/TextLink-5MvP0P8D.js +0 -2
  274. package/dist/TextLink-5MvP0P8D.js.map +0 -1
  275. package/dist/TextLink-Cc_LeVcx.mjs +0 -57
  276. package/dist/TextLink-Cc_LeVcx.mjs.map +0 -1
  277. package/dist/VisuallyHidden-CB6Nx76j.js +0 -2
  278. package/dist/VisuallyHidden-CB6Nx76j.js.map +0 -1
  279. package/dist/VisuallyHidden-DjlV0-CW.mjs +0 -28
  280. package/dist/VisuallyHidden-DjlV0-CW.mjs.map +0 -1
  281. package/dist/button/index.js.map +0 -1
  282. package/dist/button/index.mjs.map +0 -1
  283. package/dist/form-field/index.js.map +0 -1
  284. package/dist/form-field/index.mjs.map +0 -1
  285. package/dist/icon/index.js.map +0 -1
  286. package/dist/icon/index.mjs.map +0 -1
  287. package/dist/icon-button/index.js.map +0 -1
  288. package/dist/icon-button/index.mjs.map +0 -1
  289. package/dist/input/index.js.map +0 -1
  290. package/dist/input/index.mjs.map +0 -1
  291. package/dist/label/index.js.map +0 -1
  292. package/dist/label/index.mjs.map +0 -1
  293. package/dist/popover/index.js.map +0 -1
  294. package/dist/popover/index.mjs.map +0 -1
  295. package/dist/progress/index.js.map +0 -1
  296. package/dist/progress/index.mjs.map +0 -1
  297. package/dist/spinner/index.js.map +0 -1
  298. package/dist/spinner/index.mjs.map +0 -1
  299. package/dist/useRenderSlot-Bta2kdp4.mjs +0 -10
  300. package/dist/useRenderSlot-Bta2kdp4.mjs.map +0 -1
  301. package/dist/useRenderSlot-DATwjgpo.js +0 -2
  302. package/dist/useRenderSlot-DATwjgpo.js.map +0 -1
@@ -1,506 +1,443 @@
1
- import { jsx as s, jsxs as k, Fragment as De } from "react/jsx-runtime";
2
- import { useFormFieldControl as be } from "@spark-ui/components/form-field";
3
- import { Children as $, isValidElement as O, createContext as L, useState as D, useId as b, useEffect as M, Fragment as ae, useContext as F, useRef as Ne, useLayoutEffect as Pe } from "react";
4
- import { Popover as P } from "../popover/index.mjs";
5
- import { useMultipleSelection as Ce, useSelect as x } from "downshift";
6
- import { cx as w, cva as ie } from "class-variance-authority";
7
- import { useMergeRefs as G } from "@spark-ui/hooks/use-merge-refs";
8
- import { Check as Te } from "@spark-ui/icons/Check";
9
- import { I as R } from "../Icon-BO327oHU.mjs";
10
- import { ArrowHorizontalDown as Se } from "@spark-ui/icons/ArrowHorizontalDown";
11
- import { V as Ee } from "../VisuallyHidden-DjlV0-CW.mjs";
12
- const ke = ({
13
- itemsMap: e,
14
- defaultValue: o,
15
- value: t,
16
- onValueChange: n,
17
- open: i,
18
- onOpenChange: l,
19
- defaultOpen: d,
20
- multiple: a,
21
- id: u,
22
- labelId: f
23
- }) => {
24
- const c = [...e.values()], p = Ce({
25
- selectedItems: t != null && a ? c.filter(
26
- (r) => a ? t.includes(r.value) : t === r.value
27
- ) : void 0,
28
- initialSelectedItems: o != null && a ? c.filter(
29
- (r) => a ? o.includes(r.value) : o === r.value
30
- ) : void 0,
31
- onSelectedItemsChange: ({ selectedItems: r }) => {
32
- r != null && a && n?.(r.map((m) => m.value));
33
- }
34
- });
35
- return {
36
- ...x({
37
- items: c,
38
- isItemDisabled: (r) => r.disabled,
39
- itemToString: (r) => r ? r.text : "",
40
- // a11y attributes
41
- id: u,
42
- labelId: f,
43
- // Controlled open state
44
- isOpen: i,
45
- // undefined must be passed for stateful behaviour (uncontrolled)
46
- onIsOpenChange: ({ isOpen: r }) => {
47
- r != null && l?.(r);
48
- },
49
- initialIsOpen: d ?? !1,
50
- stateReducer: (r, { changes: m, type: v }) => {
51
- if (!a) return m;
52
- const { selectedItems: g, removeSelectedItem: C, addSelectedItem: T } = p;
53
- switch (v) {
54
- case x.stateChangeTypes.ToggleButtonKeyDownEnter:
55
- case x.stateChangeTypes.ToggleButtonKeyDownSpaceButton:
56
- case x.stateChangeTypes.ItemClick:
57
- return m.selectedItem != null && (g.some(
58
- (S) => S.value === m.selectedItem?.value
59
- ) ? C(m.selectedItem) : T(m.selectedItem)), {
60
- ...m,
61
- isOpen: !0,
62
- // keep the menu open after selection.
63
- highlightedIndex: r.highlightedIndex
64
- // preserve highlighted index position
65
- };
66
- default:
67
- return m;
68
- }
69
- },
70
- // Controlled mode (single selection)
71
- selectedItem: t != null && !a ? e.get(t) || null : void 0,
72
- initialSelectedItem: (o != null || t != null) && !a ? e.get(o) || null : void 0,
73
- onSelectedItemChange: ({ selectedItem: r }) => {
74
- r?.value != null && !a && n?.(r?.value);
75
- },
76
- /**
77
- * 1. Downshift default behaviour is to scroll into view the highlighted item when the dropdown opens. This behaviour is not stable and scrolls the dropdown to the bottom of the screen.
78
- */
79
- scrollIntoView: (r) => {
80
- r && r.scrollIntoView({ block: "nearest" });
81
- }
82
- }),
83
- ...p,
84
- /** There is a Downshift bug in React 19, it duplicates some selectedItems */
85
- selectedItems: [...new Set(p.selectedItems)]
86
- };
1
+ import { VisuallyHidden as e } from "../visually-hidden/index.mjs";
2
+ import { t } from "../icon-D05Uqh8_.mjs";
3
+ import { t as n } from "../popover-CxZAQmw6.mjs";
4
+ import { cva as r, cx as i } from "class-variance-authority";
5
+ import { Children as a, Fragment as o, createContext as s, isValidElement as c, useContext as l, useEffect as u, useId as d, useLayoutEffect as f, useRef as p, useState as m } from "react";
6
+ import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
7
+ import { ArrowHorizontalDown as v } from "@spark-ui/icons/ArrowHorizontalDown";
8
+ import { useMergeRefs as y } from "@spark-ui/hooks/use-merge-refs";
9
+ import { useFormFieldControl as b } from "@spark-ui/components/form-field";
10
+ import { Check as x } from "@spark-ui/icons/Check";
11
+ import { useMultipleSelection as S, useSelect as C } from "downshift";
12
+ //#region src/dropdown/useDropdown.ts
13
+ var w = ({ itemsMap: e, defaultValue: t, value: n, onValueChange: r, open: i, onOpenChange: a, defaultOpen: o, multiple: s, id: c, labelId: l }) => {
14
+ let u = [...e.values()], d = S({
15
+ selectedItems: n != null && s ? u.filter((e) => s ? n.includes(e.value) : n === e.value) : void 0,
16
+ initialSelectedItems: t != null && s ? u.filter((e) => s ? t.includes(e.value) : t === e.value) : void 0,
17
+ onSelectedItemsChange: ({ selectedItems: e }) => {
18
+ e != null && s && r?.(e.map((e) => e.value));
19
+ }
20
+ });
21
+ return {
22
+ ...C({
23
+ items: u,
24
+ isItemDisabled: (e) => e.disabled,
25
+ itemToString: (e) => e ? e.text : "",
26
+ id: c,
27
+ labelId: l,
28
+ isOpen: i,
29
+ onIsOpenChange: ({ isOpen: e }) => {
30
+ e != null && a?.(e);
31
+ },
32
+ initialIsOpen: o ?? !1,
33
+ stateReducer: (e, { changes: t, type: n }) => {
34
+ if (!s) return t;
35
+ let { selectedItems: r, removeSelectedItem: i, addSelectedItem: a } = d;
36
+ switch (n) {
37
+ case C.stateChangeTypes.ToggleButtonKeyDownEnter:
38
+ case C.stateChangeTypes.ToggleButtonKeyDownSpaceButton:
39
+ case C.stateChangeTypes.ItemClick: return t.selectedItem != null && (r.some((e) => e.value === t.selectedItem?.value) ? i(t.selectedItem) : a(t.selectedItem)), {
40
+ ...t,
41
+ isOpen: !0,
42
+ highlightedIndex: e.highlightedIndex
43
+ };
44
+ default: return t;
45
+ }
46
+ },
47
+ selectedItem: n != null && !s ? e.get(n) || null : void 0,
48
+ initialSelectedItem: (t != null || n != null) && !s ? e.get(t) || null : void 0,
49
+ onSelectedItemChange: ({ selectedItem: e }) => {
50
+ e?.value != null && !s && r?.(e?.value);
51
+ },
52
+ scrollIntoView: (e) => {
53
+ e && e.scrollIntoView({ block: "nearest" });
54
+ }
55
+ }),
56
+ ...d,
57
+ selectedItems: [...new Set(d.selectedItems)]
58
+ };
87
59
  };
88
- function $e(e, o) {
89
- let t = 0;
90
- for (const [n] of e.entries()) {
91
- if (n === o)
92
- return t;
93
- t++;
94
- }
95
- return -1;
60
+ //#endregion
61
+ //#region src/dropdown/utils.ts
62
+ function T(e, t) {
63
+ let n = 0;
64
+ for (let [r] of e.entries()) {
65
+ if (r === t) return n;
66
+ n++;
67
+ }
68
+ return -1;
96
69
  }
97
- const Oe = (e, o) => {
98
- let t = 0;
99
- for (const n of e.keys()) {
100
- if (t === o) return n;
101
- t++;
102
- }
103
- }, Le = (e, o) => {
104
- const t = Oe(e, o);
105
- return t !== void 0 ? e.get(t) : void 0;
106
- }, z = (e) => e ? e.type.displayName : "", de = (e, o = []) => ($.forEach(e, (t) => {
107
- if (O(t)) {
108
- if (z(t) === "Dropdown.Item") {
109
- const n = t.props;
110
- o.push({
111
- value: n.value,
112
- disabled: !!n.disabled,
113
- text: A(n.children)
114
- });
115
- }
116
- t.props.children && de(t.props.children, o);
117
- }
118
- }), o), A = (e, o = "") => typeof e == "string" ? e : ($.forEach(e, (t) => {
119
- O(t) && (z(t) === "Dropdown.ItemText" && (o = t.props.children), t.props.children && A(t.props.children, o));
120
- }), o), se = (e) => {
121
- const o = /* @__PURE__ */ new Map();
122
- return de(e).forEach((t) => {
123
- o.set(t.value, t);
124
- }), o;
125
- }, le = (e, o) => $.toArray(e).some((t) => O(t) ? z(t) === o ? !0 : t.props.children ? le(t.props.children, o) : !1 : !1), ce = L(null), N = ":dropdown", Me = ({
126
- children: e,
127
- defaultValue: o,
128
- value: t,
129
- onValueChange: n,
130
- open: i,
131
- onOpenChange: l,
132
- defaultOpen: d,
133
- multiple: a = !1,
134
- disabled: u = !1,
135
- readOnly: f = !1,
136
- state: c
137
- }) => {
138
- const [p, I] = D(se(e)), [h, r] = D(
139
- le(e, "Dropdown.Popover")
140
- ), [m, v] = D("mouse"), g = be(), C = g.state || c, T = `${N}-label-${b()}`, Z = `${N}-input-${b()}`, S = g.id || Z, we = g.labelId || T, ge = g.disabled ?? u, Ie = g.readOnly ?? f, ee = ke({
141
- itemsMap: p,
142
- defaultValue: o,
143
- value: t,
144
- onValueChange: n,
145
- open: i,
146
- onOpenChange: l,
147
- defaultOpen: d,
148
- multiple: a,
149
- id: S,
150
- labelId: we
151
- });
152
- M(() => {
153
- const te = se(e), oe = [...p.values()], E = [...te.values()];
154
- (oe.length !== E.length || oe.some((ne, re) => {
155
- const ve = ne.value !== E[re]?.value, xe = ne.text !== E[re]?.text;
156
- return ve || xe;
157
- })) && I(te);
158
- }, [e]);
159
- const [he, ye] = h ? [P, { open: !0 }] : [ae, {}];
160
- return /* @__PURE__ */ s(
161
- ce.Provider,
162
- {
163
- value: {
164
- multiple: a,
165
- disabled: ge,
166
- readOnly: Ie,
167
- ...ee,
168
- itemsMap: p,
169
- highlightedItem: Le(p, ee.highlightedIndex),
170
- hasPopover: h,
171
- setHasPopover: r,
172
- state: C,
173
- lastInteractionType: m,
174
- setLastInteractionType: v
175
- },
176
- children: /* @__PURE__ */ s(he, { ...ye, children: e })
177
- }
178
- );
179
- }, y = () => {
180
- const e = F(ce);
181
- if (!e)
182
- throw Error("useDropdownContext must be used within a Dropdown provider");
183
- return e;
184
- }, pe = ({ children: e, ...o }) => /* @__PURE__ */ s(Me, { ...o, children: e });
185
- pe.displayName = "Dropdown";
186
- const B = ({ className: e, ref: o }) => /* @__PURE__ */ s("div", { ref: o, className: w("my-md border-b-sm border-outline", e) });
187
- B.displayName = "Dropdown.Divider";
188
- const ue = L(null), Fe = ({ children: e }) => {
189
- const o = `${N}-group-label-${b()}`;
190
- return /* @__PURE__ */ s(ue.Provider, { value: { labelId: o }, children: e });
191
- }, me = () => {
192
- const e = F(ue);
193
- if (!e)
194
- throw Error("useDropdownGroupContext must be used within a DropdownGroup provider");
195
- return e;
196
- }, H = ({ children: e, ref: o, ...t }) => /* @__PURE__ */ s(Fe, { children: /* @__PURE__ */ s(Ge, { ref: o, ...t, children: e }) }), Ge = ({ children: e, className: o, ref: t }) => {
197
- const { labelId: n } = me();
198
- return /* @__PURE__ */ s("div", { ref: t, role: "group", "aria-labelledby": n, className: w(o), children: e });
70
+ var E = (e, t) => {
71
+ let n = 0;
72
+ for (let r of e.keys()) {
73
+ if (n === t) return r;
74
+ n++;
75
+ }
76
+ }, D = (e, t) => {
77
+ let n = E(e, t);
78
+ return n === void 0 ? void 0 : e.get(n);
79
+ }, O = (e) => e ? e.type.displayName : "", k = (e, t = []) => (a.forEach(e, (e) => {
80
+ if (c(e)) {
81
+ if (O(e) === "Dropdown.Item") {
82
+ let n = e.props;
83
+ t.push({
84
+ value: n.value,
85
+ disabled: !!n.disabled,
86
+ text: A(n.children)
87
+ });
88
+ }
89
+ e.props.children && k(e.props.children, t);
90
+ }
91
+ }), t), A = (e, t = "") => typeof e == "string" ? e : (a.forEach(e, (e) => {
92
+ c(e) && (O(e) === "Dropdown.ItemText" && (t = e.props.children), e.props.children && A(e.props.children, t));
93
+ }), t), j = (e) => {
94
+ let t = /* @__PURE__ */ new Map();
95
+ return k(e).forEach((e) => {
96
+ t.set(e.value, e);
97
+ }), t;
98
+ }, M = (e, t) => a.toArray(e).some((e) => c(e) ? O(e) === t ? !0 : e.props.children ? M(e.props.children, t) : !1 : !1), N = s(null), P = ":dropdown", F = ({ children: e, defaultValue: t, value: r, onValueChange: i, open: a, onOpenChange: s, defaultOpen: c, multiple: l = !1, disabled: f = !1, readOnly: p = !1, state: h }) => {
99
+ let [_, v] = m(j(e)), [y, x] = m(M(e, "Dropdown.Popover")), [S, C] = m("mouse"), T = b(), E = T.state || h, O = `${P}-label-${d()}`, k = `${P}-input-${d()}`, A = T.id || k, F = T.labelId || O, I = T.disabled ?? f, L = T.readOnly ?? p, R = w({
100
+ itemsMap: _,
101
+ defaultValue: t,
102
+ value: r,
103
+ onValueChange: i,
104
+ open: a,
105
+ onOpenChange: s,
106
+ defaultOpen: c,
107
+ multiple: l,
108
+ id: A,
109
+ labelId: F
110
+ });
111
+ u(() => {
112
+ let t = j(e), n = [..._.values()], r = [...t.values()];
113
+ (n.length !== r.length || n.some((e, t) => {
114
+ let n = e.value !== r[t]?.value, i = e.text !== r[t]?.text;
115
+ return n || i;
116
+ })) && v(t);
117
+ }, [e]);
118
+ let [z, B] = y ? [n, { open: !0 }] : [o, {}];
119
+ return /* @__PURE__ */ g(N.Provider, {
120
+ value: {
121
+ multiple: l,
122
+ disabled: I,
123
+ readOnly: L,
124
+ ...R,
125
+ itemsMap: _,
126
+ highlightedItem: D(_, R.highlightedIndex),
127
+ hasPopover: y,
128
+ setHasPopover: x,
129
+ state: E,
130
+ lastInteractionType: S,
131
+ setLastInteractionType: C
132
+ },
133
+ children: /* @__PURE__ */ g(z, {
134
+ ...B,
135
+ children: e
136
+ })
137
+ });
138
+ }, I = () => {
139
+ let e = l(N);
140
+ if (!e) throw Error("useDropdownContext must be used within a Dropdown provider");
141
+ return e;
142
+ }, L = ({ children: e, ...t }) => /* @__PURE__ */ g(F, {
143
+ ...t,
144
+ children: e
145
+ });
146
+ L.displayName = "Dropdown";
147
+ //#endregion
148
+ //#region src/dropdown/DropdownDivider.tsx
149
+ var R = ({ className: e, ref: t }) => /* @__PURE__ */ g("div", {
150
+ ref: t,
151
+ className: i("my-md border-b-sm border-outline", e)
152
+ });
153
+ R.displayName = "Dropdown.Divider";
154
+ //#endregion
155
+ //#region src/dropdown/DropdownItemsGroupContext.tsx
156
+ var z = s(null), B = ({ children: e }) => {
157
+ let t = `${P}-group-label-${d()}`;
158
+ return /* @__PURE__ */ g(z.Provider, {
159
+ value: { labelId: t },
160
+ children: e
161
+ });
162
+ }, V = () => {
163
+ let e = l(z);
164
+ if (!e) throw Error("useDropdownGroupContext must be used within a DropdownGroup provider");
165
+ return e;
166
+ }, H = ({ children: e, ref: t, ...n }) => /* @__PURE__ */ g(B, { children: /* @__PURE__ */ g(ee, {
167
+ ref: t,
168
+ ...n,
169
+ children: e
170
+ }) }), ee = ({ children: e, className: t, ref: n }) => {
171
+ let { labelId: r } = V();
172
+ return /* @__PURE__ */ g("div", {
173
+ ref: n,
174
+ role: "group",
175
+ "aria-labelledby": r,
176
+ className: i(t),
177
+ children: e
178
+ });
199
179
  };
200
180
  H.displayName = "Dropdown.Group";
201
- const fe = L(null), Re = ({
202
- value: e,
203
- disabled: o = !1,
204
- children: t
205
- }) => {
206
- const { multiple: n, itemsMap: i, selectedItem: l, selectedItems: d } = y(), [a, u] = D(void 0), f = $e(i, e), c = { disabled: o, value: e, text: A(t) }, p = n ? d.some((I) => I.value === e) : l?.value === e;
207
- return /* @__PURE__ */ s(
208
- fe.Provider,
209
- {
210
- value: { textId: a, setTextId: u, isSelected: p, itemData: c, index: f, disabled: o },
211
- children: t
212
- }
213
- );
214
- }, V = () => {
215
- const e = F(fe);
216
- if (!e)
217
- throw Error("useDropdownItemContext must be used within a DropdownItem provider");
218
- return e;
219
- }, j = ({ children: e, ref: o, ...t }) => {
220
- const { value: n, disabled: i } = t;
221
- return /* @__PURE__ */ s(Re, { value: n, disabled: i, children: /* @__PURE__ */ s(Ae, { ref: o, ...t, children: e }) });
222
- }, ze = ie("px-lg py-md text-body-1", {
223
- variants: {
224
- selected: {
225
- true: "font-bold"
226
- },
227
- disabled: {
228
- true: "opacity-dim-3 cursor-not-allowed",
229
- false: "cursor-pointer"
230
- },
231
- highlighted: {
232
- true: ""
233
- },
234
- interactionType: {
235
- mouse: "",
236
- keyboard: ""
237
- }
238
- },
239
- compoundVariants: [
240
- {
241
- highlighted: !0,
242
- interactionType: "mouse",
243
- class: "bg-surface-hovered"
244
- },
245
- {
246
- highlighted: !0,
247
- interactionType: "keyboard",
248
- class: "u-outline"
249
- }
250
- ]
251
- }), Ae = ({
252
- className: e,
253
- disabled: o = !1,
254
- value: t,
255
- children: n,
256
- ref: i
257
- }) => {
258
- const { getItemProps: l, highlightedItem: d, lastInteractionType: a } = y(), { textId: u, index: f, itemData: c, isSelected: p } = V(), I = d?.value === t, { ref: h, ...r } = l({ item: c, index: f }), m = G(i, h);
259
- return /* @__PURE__ */ s(
260
- "li",
261
- {
262
- ref: m,
263
- className: w(
264
- ze({
265
- selected: p,
266
- disabled: o,
267
- highlighted: I,
268
- interactionType: a,
269
- className: e
270
- })
271
- ),
272
- ...r,
273
- "aria-selected": p,
274
- "aria-labelledby": u,
275
- children: n
276
- },
277
- t
278
- );
181
+ //#endregion
182
+ //#region src/dropdown/DropdownItemContext.tsx
183
+ var te = s(null), ne = ({ value: e, disabled: t = !1, children: n }) => {
184
+ let { multiple: r, itemsMap: i, selectedItem: a, selectedItems: o } = I(), [s, c] = m(void 0), l = T(i, e), u = {
185
+ disabled: t,
186
+ value: e,
187
+ text: A(n)
188
+ }, d = r ? o.some((t) => t.value === e) : a?.value === e;
189
+ return /* @__PURE__ */ g(te.Provider, {
190
+ value: {
191
+ textId: s,
192
+ setTextId: c,
193
+ isSelected: d,
194
+ itemData: u,
195
+ index: l,
196
+ disabled: t
197
+ },
198
+ children: n
199
+ });
200
+ }, U = () => {
201
+ let e = l(te);
202
+ if (!e) throw Error("useDropdownItemContext must be used within a DropdownItem provider");
203
+ return e;
204
+ }, W = ({ children: e, ref: t, ...n }) => {
205
+ let { value: r, disabled: i } = n;
206
+ return /* @__PURE__ */ g(ne, {
207
+ value: r,
208
+ disabled: i,
209
+ children: /* @__PURE__ */ g(ie, {
210
+ ref: t,
211
+ ...n,
212
+ children: e
213
+ })
214
+ });
215
+ }, re = r("px-lg py-md text-body-1", {
216
+ variants: {
217
+ selected: { true: "font-bold" },
218
+ disabled: {
219
+ true: "opacity-dim-3 cursor-not-allowed",
220
+ false: "cursor-pointer"
221
+ },
222
+ highlighted: { true: "" },
223
+ interactionType: {
224
+ mouse: "",
225
+ keyboard: ""
226
+ }
227
+ },
228
+ compoundVariants: [{
229
+ highlighted: !0,
230
+ interactionType: "mouse",
231
+ class: "bg-surface-hovered"
232
+ }, {
233
+ highlighted: !0,
234
+ interactionType: "keyboard",
235
+ class: "u-outline"
236
+ }]
237
+ }), ie = ({ className: e, disabled: t = !1, value: n, children: r, ref: a }) => {
238
+ let { getItemProps: o, highlightedItem: s, lastInteractionType: c } = I(), { textId: l, index: u, itemData: d, isSelected: f } = U(), p = s?.value === n, { ref: m, ...h } = o({
239
+ item: d,
240
+ index: u
241
+ });
242
+ return /* @__PURE__ */ g("li", {
243
+ ref: y(a, m),
244
+ className: i(re({
245
+ selected: f,
246
+ disabled: t,
247
+ highlighted: p,
248
+ interactionType: c,
249
+ className: e
250
+ })),
251
+ ...h,
252
+ "aria-selected": f,
253
+ "aria-labelledby": l,
254
+ children: r
255
+ }, n);
279
256
  };
280
- j.displayName = "Dropdown.Item";
281
- const K = ({
282
- className: e,
283
- children: o,
284
- label: t,
285
- ref: n
286
- }) => {
287
- const { disabled: i, isSelected: l } = V(), d = o || /* @__PURE__ */ s(R, { size: "sm", children: /* @__PURE__ */ s(Te, { "aria-label": t }) });
288
- return /* @__PURE__ */ s(
289
- "span",
290
- {
291
- ref: n,
292
- className: w("min-h-sz-16 min-w-sz-16 flex", i && "opacity-dim-3", e),
293
- children: l && d
294
- }
295
- );
257
+ W.displayName = "Dropdown.Item";
258
+ //#endregion
259
+ //#region src/dropdown/DropdownItemIndicator.tsx
260
+ var G = ({ className: e, children: n, label: r, ref: a }) => {
261
+ let { disabled: o, isSelected: s } = U(), c = n || /* @__PURE__ */ g(t, {
262
+ size: "sm",
263
+ children: /* @__PURE__ */ g(x, { "aria-label": r })
264
+ });
265
+ return /* @__PURE__ */ g("span", {
266
+ ref: a,
267
+ className: i("min-h-sz-16 min-w-sz-16 flex", o && "opacity-dim-3", e),
268
+ children: s && c
269
+ });
296
270
  };
297
- K.displayName = "Dropdown.ItemIndicator";
298
- const U = ({ children: e, className: o, ref: t, ...n }) => {
299
- const { isOpen: i, getMenuProps: l, hasPopover: d, setLastInteractionType: a } = y(), { ref: u, ...f } = l({
300
- onMouseMove: () => {
301
- a("mouse");
302
- }
303
- }), c = Ne(null), p = G(t, u, c);
304
- return Pe(() => {
305
- d && c.current && c.current.parentElement && (c.current.parentElement.style.pointerEvents = i ? "" : "none", c.current.style.pointerEvents = i ? "" : "none");
306
- }, [i, d]), /* @__PURE__ */ s(
307
- "ul",
308
- {
309
- ref: p,
310
- className: w(
311
- o,
312
- "flex flex-col",
313
- i ? "pointer-events-auto! block" : "pointer-events-none invisible absolute opacity-0",
314
- d && "p-lg"
315
- ),
316
- ...n,
317
- ...f,
318
- "data-spark-component": "dropdown-items",
319
- children: e
320
- }
321
- );
271
+ G.displayName = "Dropdown.ItemIndicator";
272
+ //#endregion
273
+ //#region src/dropdown/DropdownItems.tsx
274
+ var K = ({ children: e, className: t, ref: n, ...r }) => {
275
+ let { isOpen: a, getMenuProps: o, hasPopover: s, setLastInteractionType: c } = I(), { ref: l, ...u } = o({ onMouseMove: () => {
276
+ c("mouse");
277
+ } }), d = p(null), m = y(n, l, d);
278
+ return f(() => {
279
+ s && d.current && d.current.parentElement && (d.current.parentElement.style.pointerEvents = a ? "" : "none", d.current.style.pointerEvents = a ? "" : "none");
280
+ }, [a, s]), /* @__PURE__ */ g("ul", {
281
+ ref: m,
282
+ className: i(t, "flex flex-col", a ? "pointer-events-auto! block" : "pointer-events-none invisible absolute opacity-0", s && "p-lg"),
283
+ ...r,
284
+ ...u,
285
+ "data-spark-component": "dropdown-items",
286
+ children: e
287
+ });
322
288
  };
323
- U.displayName = "Dropdown.Items";
324
- const W = ({ children: e, ref: o }) => {
325
- const t = `${N}-item-text-${b()}`, { setTextId: n } = V();
326
- return M(() => (n(t), () => n(void 0))), /* @__PURE__ */ s("span", { id: t, className: w("inline"), ref: o, children: e });
289
+ K.displayName = "Dropdown.Items";
290
+ //#endregion
291
+ //#region src/dropdown/DropdownItemText.tsx
292
+ var q = ({ children: e, ref: t }) => {
293
+ let n = `${P}-item-text-${d()}`, { setTextId: r } = U();
294
+ return u(() => (r(n), () => r(void 0))), /* @__PURE__ */ g("span", {
295
+ id: n,
296
+ className: i("inline"),
297
+ ref: t,
298
+ children: e
299
+ });
327
300
  };
328
- W.displayName = "Dropdown.ItemText";
329
- const X = ({ children: e, className: o, ref: t }) => {
330
- const { labelId: n } = me();
331
- return /* @__PURE__ */ s(
332
- "div",
333
- {
334
- ref: t,
335
- id: n,
336
- className: w("px-md py-sm text-body-2 text-neutral italic", o),
337
- children: e
338
- }
339
- );
301
+ q.displayName = "Dropdown.ItemText";
302
+ //#endregion
303
+ //#region src/dropdown/DropdownLabel.tsx
304
+ var J = ({ children: e, className: t, ref: n }) => {
305
+ let { labelId: r } = V();
306
+ return /* @__PURE__ */ g("div", {
307
+ ref: n,
308
+ id: r,
309
+ className: i("px-md py-sm text-body-2 text-neutral italic", t),
310
+ children: e
311
+ });
340
312
  };
341
- X.displayName = "Dropdown.Label";
342
- const _ = ({ children: e }) => /* @__PURE__ */ s(R, { size: "sm", className: "shrink-0", children: e });
343
- _.displayName = "Dropdown.LeadingIcon";
344
- const q = ({
345
- children: e,
346
- matchTriggerWidth: o = !0,
347
- sideOffset: t = 4,
348
- className: n,
349
- elevation: i = "dropdown",
350
- ref: l,
351
- ...d
352
- }) => {
353
- const a = y();
354
- return M(() => (a.setHasPopover(!0), () => a.setHasPopover(!1)), []), /* @__PURE__ */ s(
355
- P.Content,
356
- {
357
- ref: l,
358
- inset: !0,
359
- asChild: !0,
360
- matchTriggerWidth: o,
361
- elevation: i,
362
- className: w("relative", n),
363
- sideOffset: t,
364
- onOpenAutoFocus: (u) => {
365
- u.preventDefault();
366
- },
367
- ...d,
368
- "data-spark-component": "dropdown-popover",
369
- children: e
370
- }
371
- );
313
+ J.displayName = "Dropdown.Label";
314
+ //#endregion
315
+ //#region src/dropdown/DropdownLeadingIcon.tsx
316
+ var Y = ({ children: e }) => /* @__PURE__ */ g(t, {
317
+ size: "sm",
318
+ className: "shrink-0",
319
+ children: e
320
+ });
321
+ Y.displayName = "Dropdown.LeadingIcon";
322
+ //#endregion
323
+ //#region src/dropdown/DropdownPopover.tsx
324
+ var X = ({ children: e, matchTriggerWidth: t = !0, sideOffset: r = 4, className: a, elevation: o = "dropdown", ref: s, ...c }) => {
325
+ let l = I();
326
+ return u(() => (l.setHasPopover(!0), () => l.setHasPopover(!1)), []), /* @__PURE__ */ g(n.Content, {
327
+ ref: s,
328
+ inset: !0,
329
+ asChild: !0,
330
+ matchTriggerWidth: t,
331
+ elevation: o,
332
+ className: i("relative", a),
333
+ sideOffset: r,
334
+ onOpenAutoFocus: (e) => {
335
+ e.preventDefault();
336
+ },
337
+ ...c,
338
+ "data-spark-component": "dropdown-popover",
339
+ children: e
340
+ });
372
341
  };
373
- q.displayName = "Dropdown.Popover";
374
- const J = ({ children: e, ...o }) => /* @__PURE__ */ s(P.Portal, { ...o, children: e });
375
- J.displayName = "Dropdown.Portal";
376
- const Be = ie(
377
- [
378
- "flex w-full items-center justify-between",
379
- "min-h-sz-44 rounded-lg bg-surface text-on-surface px-lg",
380
- "text-body-1",
381
- // outline styles
382
- "ring-1 outline-hidden ring-inset focus:ring-2 focus:ring-focus"
383
- ],
384
- {
385
- variants: {
386
- state: {
387
- undefined: "ring-outline",
388
- error: "ring-error",
389
- alert: "ring-alert",
390
- success: "ring-success"
391
- },
392
- disabled: {
393
- true: "disabled:bg-on-surface/dim-5 cursor-not-allowed text-on-surface/dim-3"
394
- },
395
- readOnly: {
396
- true: "disabled:bg-on-surface/dim-5 cursor-not-allowed text-on-surface/dim-3"
397
- }
398
- },
399
- compoundVariants: [
400
- {
401
- disabled: !1,
402
- state: void 0,
403
- class: "default:hover:ring-outline-high"
404
- }
405
- ]
406
- }
407
- ), Q = ({
408
- "aria-label": e,
409
- children: o,
410
- className: t,
411
- ref: n
412
- }) => {
413
- const {
414
- getToggleButtonProps: i,
415
- getDropdownProps: l,
416
- getLabelProps: d,
417
- hasPopover: a,
418
- disabled: u,
419
- readOnly: f,
420
- state: c,
421
- setLastInteractionType: p
422
- } = y(), [I, h] = a ? [P.Trigger, { asChild: !0 }] : [ae, {}], { ref: r, ...m } = i({
423
- ...l(),
424
- onKeyDown: () => {
425
- p("keyboard");
426
- }
427
- }), v = m["aria-expanded"], g = G(n, r);
428
- return /* @__PURE__ */ k(De, { children: [
429
- e && /* @__PURE__ */ s(Ee, { children: /* @__PURE__ */ s("label", { ...d(), children: e }) }),
430
- /* @__PURE__ */ s(I, { ...h, children: /* @__PURE__ */ k(
431
- "button",
432
- {
433
- type: "button",
434
- ref: g,
435
- disabled: u || f,
436
- className: Be({ className: t, state: c, disabled: u, readOnly: f }),
437
- ...m,
438
- "data-spark-component": "dropdown-trigger",
439
- children: [
440
- /* @__PURE__ */ s("span", { className: "gap-md flex items-center justify-start", children: o }),
441
- /* @__PURE__ */ s(
442
- R,
443
- {
444
- className: w("ml-md shrink-0 rotate-0 transition duration-100 ease-in", {
445
- "rotate-180": v
446
- }),
447
- size: "sm",
448
- children: /* @__PURE__ */ s(Se, {})
449
- }
450
- )
451
- ]
452
- }
453
- ) })
454
- ] });
342
+ X.displayName = "Dropdown.Popover";
343
+ //#endregion
344
+ //#region src/dropdown/DropdownPortal.tsx
345
+ var Z = ({ children: e, ...t }) => /* @__PURE__ */ g(n.Portal, {
346
+ ...t,
347
+ children: e
348
+ });
349
+ Z.displayName = "Dropdown.Portal";
350
+ //#endregion
351
+ //#region src/dropdown/DropdownTrigger.styles.tsx
352
+ var ae = r([
353
+ "flex w-full items-center justify-between",
354
+ "min-h-sz-44 rounded-lg bg-surface text-on-surface px-lg",
355
+ "text-body-1",
356
+ "ring-1 outline-hidden ring-inset focus:ring-2 focus:ring-focus"
357
+ ], {
358
+ variants: {
359
+ state: {
360
+ undefined: "ring-outline",
361
+ error: "ring-error",
362
+ alert: "ring-alert",
363
+ success: "ring-success"
364
+ },
365
+ disabled: { true: "disabled:bg-on-surface/dim-5 cursor-not-allowed text-on-surface/dim-3" },
366
+ readOnly: { true: "disabled:bg-on-surface/dim-5 cursor-not-allowed text-on-surface/dim-3" }
367
+ },
368
+ compoundVariants: [{
369
+ disabled: !1,
370
+ state: void 0,
371
+ class: "default:hover:ring-outline-high"
372
+ }]
373
+ }), Q = ({ "aria-label": r, children: a, className: s, ref: c }) => {
374
+ let { getToggleButtonProps: l, getDropdownProps: u, getLabelProps: d, hasPopover: f, disabled: p, readOnly: m, state: b, setLastInteractionType: x } = I(), [S, C] = f ? [n.Trigger, { asChild: !0 }] : [o, {}], { ref: w, ...T } = l({
375
+ ...u(),
376
+ onKeyDown: () => {
377
+ x("keyboard");
378
+ }
379
+ }), E = T["aria-expanded"], D = y(c, w);
380
+ return /* @__PURE__ */ _(h, { children: [r && /* @__PURE__ */ g(e, { children: /* @__PURE__ */ g("label", {
381
+ ...d(),
382
+ children: r
383
+ }) }), /* @__PURE__ */ g(S, {
384
+ ...C,
385
+ children: /* @__PURE__ */ _("button", {
386
+ type: "button",
387
+ ref: D,
388
+ disabled: p || m,
389
+ className: ae({
390
+ className: s,
391
+ state: b,
392
+ disabled: p,
393
+ readOnly: m
394
+ }),
395
+ ...T,
396
+ "data-spark-component": "dropdown-trigger",
397
+ children: [/* @__PURE__ */ g("span", {
398
+ className: "gap-md flex items-center justify-start",
399
+ children: a
400
+ }), /* @__PURE__ */ g(t, {
401
+ className: i("ml-md shrink-0 rotate-0 transition duration-100 ease-in", { "rotate-180": E }),
402
+ size: "sm",
403
+ children: /* @__PURE__ */ g(v, {})
404
+ })]
405
+ })
406
+ })] });
455
407
  };
456
408
  Q.displayName = "Dropdown.Trigger";
457
- const Y = ({ children: e, className: o, placeholder: t, ref: n }) => {
458
- const { selectedItem: i, multiple: l, selectedItems: d } = y(), a = !!(l ? d.length : i), u = l ? d[0]?.text : i?.text, f = d.length > 1 ? `, +${d.length - 1}` : "";
459
- return /* @__PURE__ */ k("span", { ref: n, className: w("flex shrink items-center text-left", o), children: [
460
- /* @__PURE__ */ s(
461
- "span",
462
- {
463
- className: w(
464
- "line-clamp-1 flex-1 overflow-hidden break-all text-ellipsis",
465
- !a && "text-on-surface/dim-1"
466
- ),
467
- children: a ? e || u : t
468
- }
469
- ),
470
- f && /* @__PURE__ */ s("span", { children: f })
471
- ] });
409
+ //#endregion
410
+ //#region src/dropdown/DropdownValue.tsx
411
+ var $ = ({ children: e, className: t, placeholder: n, ref: r }) => {
412
+ let { selectedItem: a, multiple: o, selectedItems: s } = I(), c = !!(o ? s.length : a), l = o ? s[0]?.text : a?.text, u = s.length > 1 ? `, +${s.length - 1}` : "";
413
+ return /* @__PURE__ */ _("span", {
414
+ ref: r,
415
+ className: i("flex shrink items-center text-left", t),
416
+ children: [/* @__PURE__ */ g("span", {
417
+ className: i("line-clamp-1 flex-1 overflow-hidden break-all text-ellipsis", !c && "text-on-surface/dim-1"),
418
+ children: c ? e || l : n
419
+ }), u && /* @__PURE__ */ g("span", { children: u })]
420
+ });
472
421
  };
473
- Y.displayName = "Dropdown.Value";
474
- const He = Object.assign(pe, {
475
- Group: H,
476
- Item: j,
477
- Items: U,
478
- ItemText: W,
479
- ItemIndicator: K,
480
- Label: X,
481
- Popover: q,
482
- Divider: B,
483
- Trigger: Q,
484
- Value: Y,
485
- LeadingIcon: _,
486
- Portal: J
422
+ $.displayName = "Dropdown.Value";
423
+ //#endregion
424
+ //#region src/dropdown/index.ts
425
+ var oe = Object.assign(L, {
426
+ Group: H,
427
+ Item: W,
428
+ Items: K,
429
+ ItemText: q,
430
+ ItemIndicator: G,
431
+ Label: J,
432
+ Popover: X,
433
+ Divider: R,
434
+ Trigger: Q,
435
+ Value: $,
436
+ LeadingIcon: Y,
437
+ Portal: Z
487
438
  });
488
- He.displayName = "Dropdown";
489
- H.displayName = "Dropdown.Group";
490
- U.displayName = "Dropdown.Items";
491
- j.displayName = "Dropdown.Item";
492
- W.displayName = "Dropdown.ItemText";
493
- K.displayName = "Dropdown.ItemIndicator";
494
- X.displayName = "Dropdown.Label";
495
- q.displayName = "Dropdown.Popover";
496
- B.displayName = "Dropdown.Divider";
497
- Q.displayName = "Dropdown.Trigger";
498
- Y.displayName = "Dropdown.Value";
499
- _.displayName = "Dropdown.LeadingIcon";
500
- J.displayName = "Dropdown.Portal";
501
- export {
502
- He as Dropdown,
503
- Me as DropdownProvider,
504
- y as useDropdownContext
505
- };
506
- //# sourceMappingURL=index.mjs.map
439
+ oe.displayName = "Dropdown", H.displayName = "Dropdown.Group", K.displayName = "Dropdown.Items", W.displayName = "Dropdown.Item", q.displayName = "Dropdown.ItemText", G.displayName = "Dropdown.ItemIndicator", J.displayName = "Dropdown.Label", X.displayName = "Dropdown.Popover", R.displayName = "Dropdown.Divider", Q.displayName = "Dropdown.Trigger", $.displayName = "Dropdown.Value", Y.displayName = "Dropdown.LeadingIcon", Z.displayName = "Dropdown.Portal";
440
+ //#endregion
441
+ export { oe as Dropdown, F as DropdownProvider, I as useDropdownContext };
442
+
443
+ //# sourceMappingURL=index.mjs.map