@koide-labs/ui 0.0.15 → 0.1.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 (310) hide show
  1. package/dist/-utils.d.ts +2 -2
  2. package/dist/-utils.js +1 -1
  3. package/dist/{Button-DrPFFzo7.js → Button-BmcVHRRW.js} +2 -2
  4. package/dist/{CompositeRoot-CVk5a-pR.js → CompositeRoot-CCgh2M64.js} +6 -6
  5. package/dist/{FloatingPortal-tWyuKRSN.js → FloatingPortal-BQsQhvIr.js} +27 -27
  6. package/dist/{FloatingPortalLite-DVyq6YhV.js → FloatingPortalLite-_ECdFE7b.js} +1 -1
  7. package/dist/{InternalBackdrop-jYAiOJ8v.js → InternalBackdrop-BSMKU-hc.js} +13 -13
  8. package/dist/{LabelableContext-BMvjVwor.js → LabelableContext-Be1u-eFg.js} +2 -2
  9. package/dist/accordion.css +1 -0
  10. package/dist/alert-dialog.css +1 -0
  11. package/dist/anchor.css +1 -0
  12. package/dist/avatar.css +1 -0
  13. package/dist/badge.css +1 -0
  14. package/dist/button.css +1 -0
  15. package/dist/checkbox.css +1 -0
  16. package/dist/code.css +1 -0
  17. package/dist/collapse.css +1 -0
  18. package/dist/command.css +1 -0
  19. package/dist/components/accordion/accordion.d.ts +19 -0
  20. package/dist/components/accordion/accordion.js +701 -0
  21. package/dist/components/accordion/index.d.ts +1 -12
  22. package/dist/components/accordion/index.js +2 -697
  23. package/dist/components/alert-dialog/alert-dialog.d.ts +36 -0
  24. package/dist/components/alert-dialog/alert-dialog.js +138 -0
  25. package/dist/components/alert-dialog/index.d.ts +1 -26
  26. package/dist/components/alert-dialog/index.js +2 -134
  27. package/dist/components/anchor/anchor.d.ts +12 -0
  28. package/dist/components/anchor/anchor.js +21 -0
  29. package/dist/components/anchor/index.d.ts +1 -8
  30. package/dist/components/anchor/index.js +2 -19
  31. package/dist/components/avatar/avatar.d.ts +25 -0
  32. package/dist/components/avatar/avatar.js +161 -0
  33. package/dist/components/avatar/index.d.ts +1 -21
  34. package/dist/components/avatar/index.js +2 -159
  35. package/dist/components/badge/badge.d.ts +20 -0
  36. package/dist/components/badge/badge.js +42 -0
  37. package/dist/components/badge/index.d.ts +1 -16
  38. package/dist/components/badge/index.js +2 -40
  39. package/dist/components/button/button.d.ts +27 -0
  40. package/dist/components/button/button.js +47 -0
  41. package/dist/components/button/index.d.ts +1 -24
  42. package/dist/components/button/index.js +2 -45
  43. package/dist/components/checkbox/checkbox.d.ts +13 -0
  44. package/dist/components/checkbox/checkbox.js +269 -0
  45. package/dist/components/checkbox/index.d.ts +1 -9
  46. package/dist/components/checkbox/index.js +2 -267
  47. package/dist/components/code/code.d.ts +13 -0
  48. package/dist/components/code/code.js +1206 -0
  49. package/dist/components/code/index.d.ts +1 -9
  50. package/dist/components/code/index.js +2 -1204
  51. package/dist/components/collapse/collapse.d.ts +14 -0
  52. package/dist/components/collapse/collapse.js +35 -0
  53. package/dist/components/collapse/index.d.ts +1 -11
  54. package/dist/components/collapse/index.js +2 -33
  55. package/dist/components/command/command.d.ts +36 -0
  56. package/dist/components/command/command.js +1695 -0
  57. package/dist/components/command/index.d.ts +1 -15
  58. package/dist/components/command/index.js +2 -1693
  59. package/dist/components/context-menu/context-menu.d.ts +82 -0
  60. package/dist/components/context-menu/context-menu.js +1445 -0
  61. package/dist/components/context-menu/index.d.ts +1 -42
  62. package/dist/components/context-menu/index.js +2 -1442
  63. package/dist/components/dialog/dialog.d.ts +22 -0
  64. package/dist/components/dialog/dialog.js +140 -0
  65. package/dist/components/dialog/dialog.types.d.ts +38 -0
  66. package/dist/components/dialog/index.d.ts +1 -48
  67. package/dist/components/dialog/index.js +2 -136
  68. package/dist/components/heading/heading.d.ts +25 -0
  69. package/dist/components/heading/heading.js +36 -0
  70. package/dist/components/heading/index.d.ts +1 -44
  71. package/dist/components/heading/index.js +2 -49
  72. package/dist/components/icon/icon.d.ts +28 -0
  73. package/dist/components/icon/icon.js +43 -0
  74. package/dist/components/icon/{icon-names.d.ts → icon.types.d.ts} +4 -0
  75. package/dist/components/icon/icon.types.js +1 -0
  76. package/dist/components/icon/index.d.ts +2 -24
  77. package/dist/components/icon/index.js +2 -41
  78. package/dist/components/icon-button/icon-button.d.ts +16 -0
  79. package/dist/components/icon-button/icon-button.js +46 -0
  80. package/dist/components/icon-button/index.d.ts +1 -12
  81. package/dist/components/icon-button/index.js +2 -44
  82. package/dist/components/inline-code/index.d.ts +1 -6
  83. package/dist/components/inline-code/index.js +2 -20
  84. package/dist/components/inline-code/inline-code.d.ts +10 -0
  85. package/dist/components/inline-code/inline-code.js +25 -0
  86. package/dist/components/input/index.d.ts +1 -3
  87. package/dist/components/input/index.js +2 -117
  88. package/dist/components/input/input.d.ts +9 -0
  89. package/dist/components/input/input.js +126 -0
  90. package/dist/components/meter/index.d.ts +1 -18
  91. package/dist/components/meter/index.js +2 -163
  92. package/dist/components/meter/meter.d.ts +22 -0
  93. package/dist/components/meter/meter.js +165 -0
  94. package/dist/components/multiline-input/index.d.ts +1 -6
  95. package/dist/components/multiline-input/index.js +2 -98
  96. package/dist/components/multiline-input/multiline-input.d.ts +10 -0
  97. package/dist/components/multiline-input/multiline-input.js +100 -0
  98. package/dist/components/number-input/index.d.ts +1 -10
  99. package/dist/components/number-input/index.js +2 -1167
  100. package/dist/components/number-input/number-input.d.ts +14 -0
  101. package/dist/components/number-input/number-input.js +1169 -0
  102. package/dist/components/password-input/index.d.ts +1 -2
  103. package/dist/components/password-input/index.js +2 -27
  104. package/dist/components/password-input/password-input.d.ts +7 -0
  105. package/dist/components/password-input/password-input.js +29 -0
  106. package/dist/components/pill/index.d.ts +1 -13
  107. package/dist/components/pill/index.js +2 -36
  108. package/dist/components/pill/pill.d.ts +17 -0
  109. package/dist/components/pill/pill.js +38 -0
  110. package/dist/components/popover/index.d.ts +1 -21
  111. package/dist/components/popover/index.js +2 -634
  112. package/dist/components/popover/popover.d.ts +22 -0
  113. package/dist/components/popover/popover.js +634 -0
  114. package/dist/components/preview-card/index.d.ts +1 -17
  115. package/dist/components/preview-card/index.js +2 -400
  116. package/dist/components/preview-card/preview-card.d.ts +21 -0
  117. package/dist/components/preview-card/preview-card.js +402 -0
  118. package/dist/components/radio-group/index.d.ts +1 -0
  119. package/dist/components/radio-group/index.js +5 -0
  120. package/dist/components/radio-group/radio-group.d.ts +25 -0
  121. package/dist/components/{radio/index.js → radio-group/radio-group.js} +91 -90
  122. package/dist/components/search-bar/index.d.ts +1 -12
  123. package/dist/components/search-bar/index.js +2 -46
  124. package/dist/components/search-bar/search-bar.d.ts +16 -0
  125. package/dist/components/search-bar/search-bar.js +43 -0
  126. package/dist/components/select/index.d.ts +1 -16
  127. package/dist/components/select/index.js +2 -1261
  128. package/dist/components/select/select.d.ts +22 -0
  129. package/dist/components/select/select.js +1263 -0
  130. package/dist/components/separator/index.d.ts +1 -7
  131. package/dist/components/separator/index.js +2 -4
  132. package/dist/components/separator/separator.d.ts +10 -0
  133. package/dist/components/separator/separator.js +6 -0
  134. package/dist/components/slider/index.d.ts +1 -5
  135. package/dist/components/slider/index.js +2 -900
  136. package/dist/components/slider/slider.d.ts +10 -0
  137. package/dist/components/slider/slider.js +899 -0
  138. package/dist/components/spinner/index.d.ts +1 -2
  139. package/dist/components/spinner/index.js +2 -11
  140. package/dist/components/spinner/spinner.d.ts +7 -0
  141. package/dist/components/spinner/spinner.js +13 -0
  142. package/dist/components/stacked-avatars/index.d.ts +1 -14
  143. package/dist/components/stacked-avatars/index.js +2 -90
  144. package/dist/components/stacked-avatars/stacked-avatars.d.ts +18 -0
  145. package/dist/components/stacked-avatars/stacked-avatars.js +92 -0
  146. package/dist/components/status-banner/index.d.ts +1 -17
  147. package/dist/components/status-banner/index.js +2 -69
  148. package/dist/components/status-banner/status-banner.d.ts +22 -0
  149. package/dist/components/status-banner/status-banner.js +71 -0
  150. package/dist/components/surface/index.d.ts +2 -27
  151. package/dist/components/surface/index.js +2 -39
  152. package/dist/components/surface/surface.d.ts +26 -0
  153. package/dist/components/surface/surface.js +36 -0
  154. package/dist/components/surface/surface.types.d.ts +1 -0
  155. package/dist/components/surface/surface.types.js +1 -0
  156. package/dist/components/switch/index.d.ts +1 -5
  157. package/dist/components/switch/index.js +2 -194
  158. package/dist/components/switch/switch.d.ts +10 -0
  159. package/dist/components/switch/switch.js +193 -0
  160. package/dist/components/tabs/index.d.ts +1 -18
  161. package/dist/components/tabs/index.js +2 -507
  162. package/dist/components/tabs/tabs.d.ts +28 -0
  163. package/dist/components/tabs/tabs.js +511 -0
  164. package/dist/components/text/index.d.ts +1 -26
  165. package/dist/components/text/index.js +2 -46
  166. package/dist/components/text/text.d.ts +29 -0
  167. package/dist/components/text/text.js +48 -0
  168. package/dist/components/theme-provider/index.d.ts +1 -1
  169. package/dist/components/theme-provider/theme-provider.d.ts +8 -4
  170. package/dist/components/theme-provider/theme-provider.js +3 -3
  171. package/dist/components/timestamp/index.d.ts +1 -23
  172. package/dist/components/timestamp/index.js +2 -1390
  173. package/dist/components/timestamp/timestamp.d.ts +26 -0
  174. package/dist/components/timestamp/timestamp.js +1391 -0
  175. package/dist/components/toaster/index.d.ts +2 -0
  176. package/dist/components/toaster/index.js +7 -0
  177. package/dist/components/toaster/toaster.d.ts +7 -0
  178. package/dist/components/toaster/toaster.js +923 -0
  179. package/dist/components/{toast → toaster}/use-toast-manager.d.ts +3 -3
  180. package/dist/components/tooltip/index.d.ts +1 -14
  181. package/dist/components/tooltip/index.js +2 -710
  182. package/dist/components/tooltip/tooltip.d.ts +24 -0
  183. package/dist/components/tooltip/tooltip.js +9 -0
  184. package/dist/components/view/index.d.ts +2 -30
  185. package/dist/components/view/index.js +2 -79
  186. package/dist/components/view/view.d.ts +31 -0
  187. package/dist/components/view/view.js +83 -0
  188. package/dist/components/view/view.types.d.ts +5 -0
  189. package/dist/components/view/view.types.js +1 -0
  190. package/dist/components/visually-hidden/index.d.ts +5 -1
  191. package/dist/{composite-Bx7Szd_T.js → composite-BZzP-LlG.js} +3 -3
  192. package/dist/{composite-C9L5QmZL.js → composite-BwEK5cWH.js} +1 -1
  193. package/dist/context-menu.css +1 -0
  194. package/dist/{createBaseUIEventDetails-D8M2Yl-a.js → createBaseUIEventDetails-CCSfZ2vM.js} +7 -7
  195. package/dist/{detectBrowser-I-s3yzIE.js → detectBrowser-Bl8Ki_1I.js} +2 -2
  196. package/dist/dialog.css +1 -1
  197. package/dist/{dialog.module-BeF-6XAo.js → dialog.module-DsbQRp-d.js} +55 -55
  198. package/dist/{element-CZEOj04G.js → element-u5WgOZX1.js} +7 -7
  199. package/dist/{event-CKoGyQEJ.js → event-B89-Ng5h.js} +4 -4
  200. package/dist/{floating-ui.utils-C7pRWMZ_.js → floating-ui.utils-DUVaIF3G.js} +7 -7
  201. package/dist/{floating-ui.utils.dom-C7FS5id0.js → floating-ui.utils.dom-cbi420Pg.js} +4 -4
  202. package/dist/{getDisabledMountTransitionStyles-YfHPge6T.js → getDisabledMountTransitionStyles-E2x-_lte.js} +7 -7
  203. package/dist/heading.css +1 -0
  204. package/dist/icon-button.css +1 -0
  205. package/dist/icon.css +1 -0
  206. package/dist/index.d.ts +10 -10
  207. package/dist/index.js +86 -104
  208. package/dist/{inertValue-BCYGsdmf.js → inertValue-BTpPjX30.js} +1 -1
  209. package/dist/inline-code.css +1 -0
  210. package/dist/input.css +1 -1
  211. package/dist/input.module-CtE19OH8.js +8 -0
  212. package/dist/integrations/react-markdown/index.js +12 -12
  213. package/dist/meter.css +1 -0
  214. package/dist/number-input.css +1 -0
  215. package/dist/password-input.css +1 -0
  216. package/dist/pill.css +1 -0
  217. package/dist/popover.css +1 -0
  218. package/dist/preview-card.css +1 -0
  219. package/dist/radio-group.css +1 -0
  220. package/dist/safePolygon-DnkzOIur.js +558 -0
  221. package/dist/search-bar.css +1 -0
  222. package/dist/select.css +1 -0
  223. package/dist/{index-DVjyPAD4.js → separator-fh_wDZNf.js} +7 -11
  224. package/dist/separator.css +1 -0
  225. package/dist/slider.css +1 -0
  226. package/dist/spinner.css +1 -0
  227. package/dist/stacked-avatars.css +1 -0
  228. package/dist/status-banner.css +1 -0
  229. package/dist/styles/core.css +1 -1
  230. package/dist/surface.css +1 -0
  231. package/dist/switch.css +1 -0
  232. package/dist/tabs.css +1 -0
  233. package/dist/text.css +1 -0
  234. package/dist/timestamp.css +1 -0
  235. package/dist/toaster.css +1 -0
  236. package/dist/tooltip-oCp-elli.js +765 -0
  237. package/dist/tooltip.css +1 -0
  238. package/dist/transitions.css +1 -1
  239. package/dist/{transitions.module-CWX8e5cx.js → transitions.module-D9mMAtfI.js} +11 -11
  240. package/dist/{useAnimationFrame-451ugS_6.js → useAnimationFrame-DvK1s63A.js} +1 -1
  241. package/dist/{useButton-DfIwsdb8.js → useButton-d3_JgBNr.js} +3 -3
  242. package/dist/{useCompositeListItem-OkcAim_1.js → useCompositeListItem-CZp9WTnF.js} +2 -2
  243. package/dist/{useLabelableId-Ci_jDvmv.js → useLabelableId-CX4tcfzK.js} +3 -3
  244. package/dist/{useOpenChangeComplete-Dse9kY9E.js → useOpenChangeComplete-BHd-N7Ig.js} +5 -5
  245. package/dist/{useRender-CLx7dR_1.js → useRender-C3vlzS3t.js} +1 -1
  246. package/dist/{useRenderElement-DwToLA61.js → useRenderElement-DngNDu_P.js} +2 -2
  247. package/dist/{useRole-oDBdbuwQ.js → useRole-BD3OL1rr.js} +3 -3
  248. package/dist/{useStableCallback-CkTrVkNX.js → useStableCallback-DKZHlUAT.js} +1 -1
  249. package/dist/{useSyncedFloatingRootContext-Dorsv-jf.js → useSyncedFloatingRootContext-BB1vwkV-.js} +20 -20
  250. package/dist/{useTimeout-CflX-kz3.js → useTimeout-BNni6aw5.js} +1 -1
  251. package/dist/{useTransitionStatus-CUfcuGAV.js → useTransitionStatus-CmMyUh74.js} +1 -1
  252. package/dist/{useTypeahead-D85V2IUx.js → useTypeahead-BiL5IAVb.js} +11 -11
  253. package/dist/{useValueAsRef-HURLzret.js → useValueAsRef-B4EriRsI.js} +1 -1
  254. package/dist/{useValueChanged-DL757-yD.js → useValueChanged-MJRmEWz1.js} +1 -1
  255. package/dist/view.css +1 -1
  256. package/dist/view.module-Dj7wj0kk.js +6 -0
  257. package/dist/view2.css +1 -0
  258. package/package.json +1 -1
  259. package/dist/components/radio/index.d.ts +0 -13
  260. package/dist/components/toast/index.d.ts +0 -2
  261. package/dist/components/toast/index.js +0 -8
  262. package/dist/components/toast/toast.d.ts +0 -2
  263. package/dist/components/toast/toast.js +0 -921
  264. package/dist/components/tooltip/tooltip-arrow.d.ts +0 -3
  265. package/dist/components/tooltip/tooltip-arrow.js +0 -6
  266. package/dist/index10.css +0 -1
  267. package/dist/index11.css +0 -1
  268. package/dist/index12.css +0 -1
  269. package/dist/index13.css +0 -1
  270. package/dist/index14.css +0 -1
  271. package/dist/index15.css +0 -1
  272. package/dist/index16.css +0 -1
  273. package/dist/index17.css +0 -1
  274. package/dist/index18.css +0 -1
  275. package/dist/index19.css +0 -1
  276. package/dist/index20.css +0 -1
  277. package/dist/index21.css +0 -1
  278. package/dist/index22.css +0 -1
  279. package/dist/index23.css +0 -1
  280. package/dist/index24.css +0 -1
  281. package/dist/index25.css +0 -1
  282. package/dist/index26.css +0 -1
  283. package/dist/index27.css +0 -1
  284. package/dist/index28.css +0 -1
  285. package/dist/index29.css +0 -1
  286. package/dist/index3.css +0 -1
  287. package/dist/index30.css +0 -1
  288. package/dist/index31.css +0 -1
  289. package/dist/index32.css +0 -1
  290. package/dist/index33.css +0 -1
  291. package/dist/index34.css +0 -1
  292. package/dist/index35.css +0 -1
  293. package/dist/index36.css +0 -1
  294. package/dist/index37.css +0 -1
  295. package/dist/index4.css +0 -1
  296. package/dist/index5.css +0 -1
  297. package/dist/index6.css +0 -1
  298. package/dist/index7.css +0 -1
  299. package/dist/index8.css +0 -1
  300. package/dist/index9.css +0 -1
  301. package/dist/input.module-DDQY_Ij6.js +0 -7
  302. package/dist/safePolygon-DWy1dGKJ.js +0 -308
  303. package/dist/toast.css +0 -1
  304. package/dist/tooltip-arrow-cs6vjjqZ.js +0 -24
  305. package/dist/tooltip-arrow.css +0 -1
  306. package/dist/useHoverReferenceInteraction-SfOBPoXM.js +0 -264
  307. package/dist/usePopupAutoResize-CNR6Ekmx.js +0 -85
  308. package/dist/view.module-DfDLgJE0.js +0 -6
  309. /package/dist/components/{icon/icon-names.js → dialog/dialog.types.js} +0 -0
  310. /package/dist/components/{toast → toaster}/use-toast-manager.js +0 -0
@@ -1,700 +1,5 @@
1
1
  "use client";
2
- import { jsx as k, jsxs as ne } from "react/jsx-runtime";
3
- import { c as Ce } from "../../clsx-OuTLNxxd.js";
4
- import { textify as te } from "../../-utils.js";
5
- import { Icon as Ne } from "../icon/index.js";
6
- import { Surface as Oe } from "../surface/index.js";
7
- import { View as oe } from "../view/index.js";
8
- import * as r from "react";
9
- import { u as ae } from "../../useControlled-Du4sJyMj.js";
10
- import { u as L } from "../../useStableCallback-CkTrVkNX.js";
11
- import { u as T } from "../../useIsoLayoutEffect-CIDbvm3Q.js";
12
- import { w as K } from "../../warn-CKtX8MLJ.js";
13
- import { C as Ee, u as xe } from "../../useCompositeListItem-OkcAim_1.js";
14
- import { u as ve } from "../../DirectionContext-C2o_MF_i.js";
15
- import { f as z } from "../../formatErrorMessage-BqPuTBN-.js";
16
- import { u as B, c as ce } from "../../useRenderElement-DwToLA61.js";
17
- import { c as $, n as le, a as Ae } from "../../createBaseUIEventDetails-D8M2Yl-a.js";
18
- import { u as j } from "../../useBaseUiId-B7WyxtIE.js";
19
- import { u as Se, T as re, t as Me, a as Pe } from "../../useOpenChangeComplete-Dse9kY9E.js";
20
- import { u as we } from "../../useTransitionStatus-CUfcuGAV.js";
21
- import { i as ie } from "../../isElementDisabled-Cbd8W9kH.js";
22
- import { b as de, e as ue, c as fe, d as pe, H as Ie, E as De } from "../../composite-C9L5QmZL.js";
23
- import { u as Ve } from "../../useButton-DfIwsdb8.js";
24
- import { s as Fe } from "../../event-CKoGyQEJ.js";
25
- import { u as Te } from "../../useOnMount-VRW6CK2u.js";
26
- import { u as ke, A as F } from "../../useAnimationFrame-451ugS_6.js";
27
- import '../../index31.css';const G = /* @__PURE__ */ r.createContext(void 0);
28
- process.env.NODE_ENV !== "production" && (G.displayName = "AccordionRootContext");
29
- function Y() {
30
- const n = r.useContext(G);
31
- if (n === void 0)
32
- throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: AccordionRootContext is missing. Accordion parts must be placed within <Accordion.Root>." : z(10));
33
- return n;
34
- }
35
- const He = {
36
- value: () => null
37
- }, me = /* @__PURE__ */ r.forwardRef(function(o, i) {
38
- const {
39
- render: w,
40
- className: I,
41
- disabled: c = !1,
42
- hiddenUntilFound: m,
43
- keepMounted: v,
44
- loopFocus: C = !0,
45
- onValueChange: R,
46
- multiple: h = !1,
47
- orientation: d = "vertical",
48
- value: N,
49
- defaultValue: f,
50
- ...O
51
- } = o, E = ve();
52
- process.env.NODE_ENV !== "production" && T(() => {
53
- m && v === !1 && K("The `keepMounted={false}` prop on a Accordion.Root will be ignored when using `hiddenUntilFound` since it requires Panels to remain mounted when closed.");
54
- }, [m, v]);
55
- const S = r.useMemo(() => {
56
- if (N === void 0)
57
- return f ?? [];
58
- }, [N, f]), A = L(R), y = r.useRef([]), [b, _] = ae({
59
- controlled: N,
60
- default: S,
61
- name: "Accordion",
62
- state: "value"
63
- }), l = L((p, V) => {
64
- const g = $(le);
65
- if (h)
66
- if (V) {
67
- const e = b.slice();
68
- if (e.push(p), A(e, g), g.isCanceled)
69
- return;
70
- _(e);
71
- } else {
72
- const e = b.filter((a) => a !== p);
73
- if (A(e, g), g.isCanceled)
74
- return;
75
- _(e);
76
- }
77
- else {
78
- const e = b[0] === p ? [] : [p];
79
- if (A(e, g), g.isCanceled)
80
- return;
81
- _(e);
82
- }
83
- }), x = r.useMemo(() => ({
84
- value: b,
85
- disabled: c,
86
- orientation: d
87
- }), [b, c, d]), M = r.useMemo(() => ({
88
- accordionItemRefs: y,
89
- direction: E,
90
- disabled: c,
91
- handleValueChange: l,
92
- hiddenUntilFound: m ?? !1,
93
- keepMounted: v ?? !1,
94
- loopFocus: C,
95
- orientation: d,
96
- state: x,
97
- value: b
98
- }), [E, c, l, m, v, C, d, x, b]), P = B("div", o, {
99
- state: x,
100
- ref: i,
101
- props: [{
102
- dir: E,
103
- role: "region"
104
- }, O],
105
- stateAttributesMapping: He
106
- });
107
- return /* @__PURE__ */ k(G.Provider, {
108
- value: M,
109
- children: /* @__PURE__ */ k(Ee, {
110
- elementsRef: y,
111
- children: P
112
- })
113
- });
114
- });
115
- process.env.NODE_ENV !== "production" && (me.displayName = "AccordionRoot");
116
- function Ue(n) {
117
- const {
118
- open: o,
119
- defaultOpen: i,
120
- onOpenChange: w,
121
- disabled: I
122
- } = n, c = o !== void 0, [m, v] = ae({
123
- controlled: o,
124
- default: i,
125
- name: "Collapsible",
126
- state: "open"
127
- }), {
128
- mounted: C,
129
- setMounted: R,
130
- transitionStatus: h
131
- } = we(m, !0, !0), [d, N] = r.useState(m), [{
132
- height: f,
133
- width: O
134
- }, E] = r.useState({
135
- height: void 0,
136
- width: void 0
137
- }), S = j(), [A, y] = r.useState(), b = A ?? S, [_, l] = r.useState(!1), [x, M] = r.useState(!1), P = r.useRef(null), p = r.useRef(null), V = r.useRef(null), g = r.useRef(null), e = Se(g, !1), a = L((s) => {
138
- const t = !m, u = $(Ae, s.nativeEvent);
139
- if (w(t, u), u.isCanceled)
140
- return;
141
- const D = g.current;
142
- p.current === "css-animation" && D != null && D.style.removeProperty("animation-name"), !_ && !x && (p.current != null && p.current !== "css-animation" && !C && t && R(!0), p.current === "css-animation" && (!d && t && N(!0), !C && t && R(!0))), v(t), p.current === "none" && C && !t && R(!1);
143
- });
144
- return T(() => {
145
- c && p.current === "none" && !x && !m && R(!1);
146
- }, [c, x, m, o, R]), r.useMemo(() => ({
147
- abortControllerRef: P,
148
- animationTypeRef: p,
149
- disabled: I,
150
- handleTrigger: a,
151
- height: f,
152
- mounted: C,
153
- open: m,
154
- panelId: b,
155
- panelRef: g,
156
- runOnceAnimationsFinish: e,
157
- setDimensions: E,
158
- setHiddenUntilFound: l,
159
- setKeepMounted: M,
160
- setMounted: R,
161
- setOpen: v,
162
- setPanelIdState: y,
163
- setVisible: N,
164
- transitionDimensionRef: V,
165
- transitionStatus: h,
166
- visible: d,
167
- width: O
168
- }), [P, p, I, a, f, C, m, b, g, e, E, l, M, R, v, N, V, h, d, O]);
169
- }
170
- const J = /* @__PURE__ */ r.createContext(void 0);
171
- process.env.NODE_ENV !== "production" && (J.displayName = "CollapsibleRootContext");
172
- function he() {
173
- const n = r.useContext(J);
174
- if (n === void 0)
175
- throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: CollapsibleRootContext is missing. Collapsible parts must be placed within <Collapsible.Root>." : z(15));
176
- return n;
177
- }
178
- const Q = /* @__PURE__ */ r.createContext(void 0);
179
- process.env.NODE_ENV !== "production" && (Q.displayName = "AccordionItemContext");
180
- function X() {
181
- const n = r.useContext(Q);
182
- if (n === void 0)
183
- throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: AccordionItemContext is missing. Accordion parts must be placed within <Accordion.Item>." : z(9));
184
- return n;
185
- }
186
- let W = (function(n) {
187
- return n.open = "data-open", n.closed = "data-closed", n[n.startingStyle = re.startingStyle] = "startingStyle", n[n.endingStyle = re.endingStyle] = "endingStyle", n;
188
- })({}), We = /* @__PURE__ */ (function(n) {
189
- return n.panelOpen = "data-panel-open", n;
190
- })({});
191
- const Le = {
192
- [W.open]: ""
193
- }, Be = {
194
- [W.closed]: ""
195
- }, qe = {
196
- open(n) {
197
- return n ? {
198
- [We.panelOpen]: ""
199
- } : null;
200
- }
201
- }, je = {
202
- open(n) {
203
- return n ? Le : Be;
204
- }
205
- };
206
- let Ke = /* @__PURE__ */ (function(n) {
207
- return n.index = "data-index", n.disabled = "data-disabled", n.open = "data-open", n;
208
- })({});
209
- const Z = {
210
- ...je,
211
- index: (n) => Number.isInteger(n) ? {
212
- [Ke.index]: String(n)
213
- } : null,
214
- ...Me,
215
- value: () => null
216
- }, ge = /* @__PURE__ */ r.forwardRef(function(o, i) {
217
- const {
218
- className: w,
219
- disabled: I = !1,
220
- onOpenChange: c,
221
- render: m,
222
- value: v,
223
- ...C
224
- } = o, {
225
- ref: R,
226
- index: h
227
- } = xe(), d = ce(i, R), {
228
- disabled: N,
229
- handleValueChange: f,
230
- state: O,
231
- value: E
232
- } = Y(), S = j(), A = v ?? S, y = I || N, b = r.useMemo(() => {
233
- if (!E)
234
- return !1;
235
- for (let a = 0; a < E.length; a += 1)
236
- if (E[a] === A)
237
- return !0;
238
- return !1;
239
- }, [E, A]), _ = L((a, s) => {
240
- c?.(a, s), !s.isCanceled && f(A, a);
241
- }), l = Ue({
242
- open: b,
243
- onOpenChange: _,
244
- disabled: y
245
- }), x = r.useMemo(() => ({
246
- open: l.open,
247
- disabled: l.disabled,
248
- hidden: !l.mounted,
249
- transitionStatus: l.transitionStatus
250
- }), [l.open, l.disabled, l.mounted, l.transitionStatus]), M = r.useMemo(() => ({
251
- ...l,
252
- onOpenChange: _,
253
- state: x
254
- }), [l, x, _]), P = r.useMemo(() => ({
255
- ...O,
256
- index: h,
257
- disabled: y,
258
- open: b
259
- }), [y, h, b, O]), [p, V] = r.useState(j()), g = r.useMemo(() => ({
260
- open: b,
261
- state: P,
262
- setTriggerId: V,
263
- triggerId: p
264
- }), [b, P, V, p]), e = B("div", o, {
265
- state: P,
266
- ref: d,
267
- props: C,
268
- stateAttributesMapping: Z
269
- });
270
- return /* @__PURE__ */ k(J.Provider, {
271
- value: M,
272
- children: /* @__PURE__ */ k(Q.Provider, {
273
- value: g,
274
- children: e
275
- })
276
- });
277
- });
278
- process.env.NODE_ENV !== "production" && (ge.displayName = "AccordionItem");
279
- const be = /* @__PURE__ */ r.forwardRef(function(o, i) {
280
- const {
281
- render: w,
282
- className: I,
283
- ...c
284
- } = o, {
285
- state: m
286
- } = X();
287
- return B("h3", o, {
288
- state: m,
289
- ref: i,
290
- props: c,
291
- stateAttributesMapping: Z
292
- });
293
- });
294
- process.env.NODE_ENV !== "production" && (be.displayName = "AccordionHeader");
295
- const ze = /* @__PURE__ */ new Set([de, ue, fe, pe, Ie, De]);
296
- function $e(n) {
297
- const {
298
- current: o
299
- } = n, i = [];
300
- for (let w = 0; w < o.length; w += 1) {
301
- const I = o[w];
302
- if (!ie(I)) {
303
- const c = I?.querySelector('[type="button"]');
304
- ie(c) || i.push(c);
305
- }
306
- }
307
- return i;
308
- }
309
- const _e = /* @__PURE__ */ r.forwardRef(function(o, i) {
310
- const {
311
- disabled: w,
312
- className: I,
313
- id: c,
314
- render: m,
315
- nativeButton: v = !0,
316
- ...C
317
- } = o, {
318
- panelId: R,
319
- open: h,
320
- handleTrigger: d,
321
- disabled: N
322
- } = he(), f = w ?? N, {
323
- getButtonProps: O,
324
- buttonRef: E
325
- } = Ve({
326
- disabled: f,
327
- focusableWhenDisabled: !0,
328
- native: v
329
- }), {
330
- accordionItemRefs: S,
331
- direction: A,
332
- loopFocus: y,
333
- orientation: b
334
- } = Y(), _ = A === "rtl", l = b === "horizontal", {
335
- state: x,
336
- setTriggerId: M,
337
- triggerId: P
338
- } = X();
339
- T(() => (c && M(c), () => {
340
- M(void 0);
341
- }), [c, M]);
342
- const p = r.useMemo(() => ({
343
- "aria-controls": h ? R : void 0,
344
- "aria-expanded": h,
345
- disabled: f,
346
- id: P,
347
- onClick: d,
348
- onKeyDown(g) {
349
- if (!ze.has(g.key))
350
- return;
351
- Fe(g);
352
- const e = $e(S), s = e.length - 1;
353
- let t = -1;
354
- const u = e.indexOf(g.target);
355
- function D() {
356
- y ? t = u + 1 > s ? 0 : u + 1 : t = Math.min(u + 1, s);
357
- }
358
- function H() {
359
- y ? t = u === 0 ? s : u - 1 : t = u - 1;
360
- }
361
- switch (g.key) {
362
- case de:
363
- l || D();
364
- break;
365
- case ue:
366
- l || H();
367
- break;
368
- case fe:
369
- l && (_ ? H() : D());
370
- break;
371
- case pe:
372
- l && (_ ? D() : H());
373
- break;
374
- case "Home":
375
- t = 0;
376
- break;
377
- case "End":
378
- t = s;
379
- break;
380
- }
381
- t > -1 && e[t].focus();
382
- }
383
- }), [S, f, d, P, l, _, y, h, R]);
384
- return B("button", o, {
385
- state: x,
386
- ref: [i, E],
387
- props: [p, C, O],
388
- stateAttributesMapping: qe
389
- });
390
- });
391
- process.env.NODE_ENV !== "production" && (_e.displayName = "AccordionTrigger");
392
- let Ge = /* @__PURE__ */ (function(n) {
393
- return n.disabled = "data-disabled", n.orientation = "data-orientation", n;
394
- })({});
395
- function Ye(n) {
396
- const {
397
- abortControllerRef: o,
398
- animationTypeRef: i,
399
- externalRef: w,
400
- height: I,
401
- hiddenUntilFound: c,
402
- keepMounted: m,
403
- id: v,
404
- mounted: C,
405
- onOpenChange: R,
406
- open: h,
407
- panelRef: d,
408
- runOnceAnimationsFinish: N,
409
- setDimensions: f,
410
- setMounted: O,
411
- setOpen: E,
412
- setVisible: S,
413
- transitionDimensionRef: A,
414
- visible: y,
415
- width: b
416
- } = n, _ = r.useRef(!1), l = r.useRef(null), x = r.useRef(h), M = r.useRef(h), P = ke(), p = r.useMemo(() => i.current === "css-animation" ? !y : !h && !C, [h, C, y, i]), V = L((e) => {
417
- if (!e)
418
- return;
419
- if (i.current == null || A.current == null) {
420
- const t = getComputedStyle(e), u = t.animationName !== "none" && t.animationName !== "", D = t.transitionDuration !== "0s" && t.transitionDuration !== "";
421
- u && D ? process.env.NODE_ENV !== "production" && K("CSS transitions and CSS animations both detected on Collapsible or Accordion panel.", "Only one of either animation type should be used.") : t.animationName === "none" && t.transitionDuration !== "0s" ? i.current = "css-transition" : t.animationName !== "none" && t.transitionDuration === "0s" ? i.current = "css-animation" : i.current = "none", e.getAttribute(Ge.orientation) === "horizontal" || t.transitionProperty.indexOf("width") > -1 ? A.current = "width" : A.current = "height";
422
- }
423
- if (i.current !== "css-transition")
424
- return;
425
- (I === void 0 || b === void 0) && (f({
426
- height: e.scrollHeight,
427
- width: e.scrollWidth
428
- }), M.current && e.style.setProperty("transition-duration", "0s"));
429
- let a = -1, s = -1;
430
- return a = F.request(() => {
431
- M.current = !1, s = F.request(() => {
432
- setTimeout(() => {
433
- e.style.removeProperty("transition-duration");
434
- });
435
- });
436
- }), () => {
437
- F.cancel(a), F.cancel(s);
438
- };
439
- }), g = ce(w, d, V);
440
- return T(() => {
441
- if (i.current !== "css-transition")
442
- return;
443
- const e = d.current;
444
- if (!e)
445
- return;
446
- let a = -1;
447
- if (o.current != null && (o.current.abort(), o.current = null), h) {
448
- const s = {
449
- "justify-content": e.style.justifyContent,
450
- "align-items": e.style.alignItems,
451
- "align-content": e.style.alignContent,
452
- "justify-items": e.style.justifyItems
453
- };
454
- Object.keys(s).forEach((t) => {
455
- e.style.setProperty(t, "initial", "important");
456
- }), !M.current && !m && e.setAttribute(W.startingStyle, ""), f({
457
- height: e.scrollHeight,
458
- width: e.scrollWidth
459
- }), a = F.request(() => {
460
- Object.entries(s).forEach(([t, u]) => {
461
- u === "" ? e.style.removeProperty(t) : e.style.setProperty(t, u);
462
- });
463
- });
464
- } else {
465
- if (e.scrollHeight === 0 && e.scrollWidth === 0)
466
- return;
467
- f({
468
- height: e.scrollHeight,
469
- width: e.scrollWidth
470
- });
471
- const s = new AbortController();
472
- o.current = s;
473
- const t = s.signal;
474
- let u = null;
475
- const D = W.endingStyle;
476
- return u = new MutationObserver((H) => {
477
- H.some((q) => q.type === "attributes" && q.attributeName === D) && (u?.disconnect(), u = null, N(() => {
478
- f({
479
- height: 0,
480
- width: 0
481
- }), e.style.removeProperty("content-visibility"), O(!1), o.current === s && (o.current = null);
482
- }, t));
483
- }), u.observe(e, {
484
- attributes: !0,
485
- attributeFilter: [D]
486
- }), () => {
487
- u?.disconnect(), P.cancel(), o.current === s && (s.abort(), o.current = null);
488
- };
489
- }
490
- return () => {
491
- F.cancel(a);
492
- };
493
- }, [o, i, P, c, m, C, h, d, N, f, O]), T(() => {
494
- if (i.current !== "css-animation")
495
- return;
496
- const e = d.current;
497
- e && (l.current = e.style.animationName || l.current, e.style.setProperty("animation-name", "none"), f({
498
- height: e.scrollHeight,
499
- width: e.scrollWidth
500
- }), !x.current && !_.current && e.style.removeProperty("animation-name"), h ? (o.current != null && (o.current.abort(), o.current = null), O(!0), S(!0)) : (o.current = new AbortController(), N(() => {
501
- O(!1), S(!1), o.current = null;
502
- }, o.current.signal)));
503
- }, [o, i, h, d, N, f, O, S, y]), Te(() => {
504
- const e = F.request(() => {
505
- x.current = !1;
506
- });
507
- return () => F.cancel(e);
508
- }), T(() => {
509
- if (!c)
510
- return;
511
- const e = d.current;
512
- if (!e)
513
- return;
514
- let a = -1, s = -1;
515
- return h && _.current && (e.style.transitionDuration = "0s", f({
516
- height: e.scrollHeight,
517
- width: e.scrollWidth
518
- }), a = F.request(() => {
519
- _.current = !1, s = F.request(() => {
520
- setTimeout(() => {
521
- e.style.removeProperty("transition-duration");
522
- });
523
- });
524
- })), () => {
525
- F.cancel(a), F.cancel(s);
526
- };
527
- }, [c, h, d, f]), T(() => {
528
- const e = d.current;
529
- e && c && p && (e.setAttribute("hidden", "until-found"), i.current === "css-transition" && e.setAttribute(W.startingStyle, ""));
530
- }, [c, p, i, d]), r.useEffect(function() {
531
- const a = d.current;
532
- if (!a)
533
- return;
534
- function s(t) {
535
- _.current = !0, E(!0), R(!0, $(le, t));
536
- }
537
- return a.addEventListener("beforematch", s), () => {
538
- a.removeEventListener("beforematch", s);
539
- };
540
- }, [R, d, E]), r.useMemo(() => ({
541
- props: {
542
- hidden: p,
543
- id: v,
544
- ref: g
545
- }
546
- }), [p, v, g]);
547
- }
548
- let se = /* @__PURE__ */ (function(n) {
549
- return n.accordionPanelHeight = "--accordion-panel-height", n.accordionPanelWidth = "--accordion-panel-width", n;
550
- })({});
551
- const ye = /* @__PURE__ */ r.forwardRef(function(o, i) {
552
- const {
553
- className: w,
554
- hiddenUntilFound: I,
555
- keepMounted: c,
556
- id: m,
557
- render: v,
558
- ...C
559
- } = o, {
560
- hiddenUntilFound: R,
561
- keepMounted: h
562
- } = Y(), {
563
- abortControllerRef: d,
564
- animationTypeRef: N,
565
- height: f,
566
- mounted: O,
567
- onOpenChange: E,
568
- open: S,
569
- panelId: A,
570
- panelRef: y,
571
- runOnceAnimationsFinish: b,
572
- setDimensions: _,
573
- setHiddenUntilFound: l,
574
- setKeepMounted: x,
575
- setMounted: M,
576
- setOpen: P,
577
- setVisible: p,
578
- transitionDimensionRef: V,
579
- visible: g,
580
- width: e,
581
- setPanelIdState: a,
582
- transitionStatus: s
583
- } = he(), t = I ?? R, u = c ?? h;
584
- process.env.NODE_ENV !== "production" && T(() => {
585
- c === !1 && t && K("The `keepMounted={false}` prop on a Accordion.Panel will be ignored when using `contextHiddenUntilFound` on the Panel or the Root since it requires the panel to remain mounted when closed.");
586
- }, [t, c]), T(() => {
587
- if (m)
588
- return a(m), () => {
589
- a(void 0);
590
- };
591
- }, [m, a]), T(() => {
592
- l(t);
593
- }, [l, t]), T(() => {
594
- x(u);
595
- }, [x, u]), Pe({
596
- open: S && s === "idle",
597
- ref: y,
598
- onComplete() {
599
- S && _({
600
- width: void 0,
601
- height: void 0
602
- });
603
- }
604
- });
605
- const {
606
- props: D
607
- } = Ye({
608
- abortControllerRef: d,
609
- animationTypeRef: N,
610
- externalRef: i,
611
- height: f,
612
- hiddenUntilFound: t,
613
- id: m ?? A,
614
- keepMounted: u,
615
- mounted: O,
616
- onOpenChange: E,
617
- open: S,
618
- panelRef: y,
619
- runOnceAnimationsFinish: b,
620
- setDimensions: _,
621
- setMounted: M,
622
- setOpen: P,
623
- setVisible: p,
624
- transitionDimensionRef: V,
625
- visible: g,
626
- width: e
627
- }), {
628
- state: H,
629
- triggerId: ee
630
- } = X(), q = r.useMemo(() => ({
631
- ...H,
632
- transitionStatus: s
633
- }), [H, s]), Re = B("div", o, {
634
- state: q,
635
- ref: [i, y],
636
- props: [D, {
637
- "aria-labelledby": ee,
638
- role: "region",
639
- style: {
640
- [se.accordionPanelHeight]: f === void 0 ? "auto" : `${f}px`,
641
- [se.accordionPanelWidth]: e === void 0 ? "auto" : `${e}px`
642
- }
643
- }, C],
644
- stateAttributesMapping: Z
645
- });
646
- return u || t || !u && O ? Re : null;
647
- });
648
- process.env.NODE_ENV !== "production" && (ye.displayName = "AccordionPanel");
649
- const Je = "_accordion_6swdg_1", Qe = "_accordion__header_6swdg_5", Xe = "_accordion__trigger_6swdg_9", Ze = "_accordion__panel_6swdg_30", U = {
650
- accordion: Je,
651
- accordion__header: Qe,
652
- "accordion__trigger-icon": "_accordion__trigger-icon_6swdg_9",
653
- accordion__trigger: Xe,
654
- accordion__panel: Ze,
655
- "accordion__panel-content": "_accordion__panel-content_6swdg_42"
656
- }, vn = me;
657
- function An({
658
- header: n,
659
- content: o,
660
- className: i,
661
- ...w
662
- }) {
663
- return /* @__PURE__ */ ne(ge, { className: U.accordion, ...w, children: [
664
- /* @__PURE__ */ k(be, { className: U.accordion__header, children: /* @__PURE__ */ k(
665
- Oe,
666
- {
667
- elevated: !0,
668
- render: /* @__PURE__ */ ne(
669
- oe,
670
- {
671
- interactive: "list-item",
672
- render: /* @__PURE__ */ k(
673
- _e,
674
- {
675
- className: Ce(U.accordion__trigger, i)
676
- }
677
- ),
678
- children: [
679
- te(n),
680
- /* @__PURE__ */ k(
681
- Ne,
682
- {
683
- name: "close-line",
684
- className: U["accordion__trigger-icon"]
685
- }
686
- )
687
- ]
688
- }
689
- )
690
- }
691
- ) }),
692
- /* @__PURE__ */ k(ye, { className: U.accordion__panel, children: /* @__PURE__ */ k(oe, { className: U["accordion__panel-content"], children: te(o, {
693
- multiline: !0
694
- }) }) })
695
- ] });
696
- }
2
+ import { Accordion as e } from "./accordion.js";
697
3
  export {
698
- vn as Accordion,
699
- An as AccordionItem
4
+ e as Accordion
700
5
  };