@ngrok/mantle 0.93.7 → 0.94.1

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 (311) hide show
  1. package/README.md +11 -2
  2. package/dist/accordion.d.ts +73 -21
  3. package/dist/accordion.js +1 -1
  4. package/dist/agent.json +1234 -84
  5. package/dist/alert-BkJHDx9X.js +1 -0
  6. package/dist/{alert-BcSBNR3S.d.ts → alert-D0zRRUHV.d.ts} +35 -25
  7. package/dist/alert-center.d.ts +67 -55
  8. package/dist/alert-center.js +1 -1
  9. package/dist/alert-dialog.d.ts +35 -10
  10. package/dist/alert-dialog.js +1 -1
  11. package/dist/alert.d.ts +6 -1
  12. package/dist/alert.js +1 -1
  13. package/dist/anchor-Dc6IgvXV.js +1 -0
  14. package/dist/anchor.d.ts +17 -5
  15. package/dist/anchor.js +1 -1
  16. package/dist/app-layout.d.ts +33 -18
  17. package/dist/app-layout.js +1 -1
  18. package/dist/area-chart.d.ts +153 -97
  19. package/dist/area-chart.js +1 -1
  20. package/dist/avatar.d.ts +36 -24
  21. package/dist/avatar.js +1 -1
  22. package/dist/badge.d.ts +19 -7
  23. package/dist/badge.js +1 -1
  24. package/dist/bar-chart.d.ts +155 -100
  25. package/dist/bar-chart.js +1 -1
  26. package/dist/breadcrumb.d.ts +47 -36
  27. package/dist/breadcrumb.js +1 -1
  28. package/dist/browser-only-CZfkNw5A.js +1 -0
  29. package/dist/browser-only-ymFoM3Ya.js +1 -0
  30. package/dist/browser-only.d.ts +8 -0
  31. package/dist/browser-only.js +1 -1
  32. package/dist/{button-BX-4lYUn.d.ts → button-5Pc7Mby_.d.ts} +4 -4
  33. package/dist/button-B9bChDgl.js +1 -0
  34. package/dist/button-D8jixIbH.js +1 -0
  35. package/dist/button-DNLTJ32M.js +1 -0
  36. package/dist/{button-CPsKGDK0.d.ts → button-Ddj6yr10.d.ts} +34 -27
  37. package/dist/{button-Yxyu1XMd.d.ts → button-DnYv7IOT.d.ts} +29 -22
  38. package/dist/button.d.ts +9 -3
  39. package/dist/button.js +1 -1
  40. package/dist/calendar.d.ts +8 -1
  41. package/dist/calendar.js +1 -1
  42. package/dist/card.d.ts +7 -2
  43. package/dist/card.js +1 -1
  44. package/dist/centered-layout.d.ts +34 -23
  45. package/dist/centered-layout.js +1 -1
  46. package/dist/chart-BLCqzt56.js +1 -0
  47. package/dist/chart-CChZiCrt.js +1 -0
  48. package/dist/chart-CUmSu9d7.js +1 -0
  49. package/dist/{chart-BpfbtOUN.d.ts → chart-Dl8gFo_D.d.ts} +117 -121
  50. package/dist/chart-DtgZBAas.js +2 -0
  51. package/dist/checkbox-Cu5cgZmk.js +1 -0
  52. package/dist/checkbox.d.ts +15 -2
  53. package/dist/checkbox.js +1 -1
  54. package/dist/choice-CCVG2hb9.js +1 -0
  55. package/dist/{choice-BLR0_MeB.d.ts → choice-CNiOSzqV.d.ts} +26 -20
  56. package/dist/choice.d.ts +6 -1
  57. package/dist/choice.js +1 -1
  58. package/dist/code-BPKNY1_w.js +1 -0
  59. package/dist/{code-block-BGdV4Yty.d.ts → code-block-BDw6MEwH.d.ts} +9 -9
  60. package/dist/{code-block-W3kWPxCJ.js → code-block-CKzsAMzj.js} +3 -3
  61. package/dist/code-block.d.ts +28 -19
  62. package/dist/code-block.js +1 -1
  63. package/dist/code-block_highlight-utils.d.ts +6 -1
  64. package/dist/code-block_highlight-utils.js +1 -1
  65. package/dist/code.d.ts +16 -3
  66. package/dist/code.js +1 -1
  67. package/dist/color-CHZbU1Ww.js +1 -0
  68. package/dist/color.js +1 -1
  69. package/dist/combobox.d.ts +42 -28
  70. package/dist/combobox.js +1 -1
  71. package/dist/command.d.ts +59 -47
  72. package/dist/command.js +1 -1
  73. package/dist/compose-refs-BdRUneoc.js +1 -0
  74. package/dist/{copy-to-clipboard-DInu78k_.js → copy-to-clipboard-Dd83caRw.js} +1 -1
  75. package/dist/cx.d.ts +4 -4
  76. package/dist/cx.js +1 -1
  77. package/dist/{data-slot-B-LqAcBB.d.ts → data-slot-BW8KQ9Xo.d.ts} +2 -2
  78. package/dist/data-table.d.ts +83 -52
  79. package/dist/data-table.js +1 -1
  80. package/dist/description-list.d.ts +13 -2
  81. package/dist/description-list.js +1 -1
  82. package/dist/{dialog-2fRO4ca4.d.ts → dialog-CIEuwNys.d.ts} +32 -8
  83. package/dist/dialog-CbEEA0fl.d.ts +32 -0
  84. package/dist/dialog-DmzoDfY3.js +1 -0
  85. package/dist/dialog.d.ts +7 -2
  86. package/dist/dialog.js +1 -1
  87. package/dist/{dropdown-menu-CpjRwMWe.d.ts → dropdown-menu-CeY498yk.d.ts} +41 -33
  88. package/dist/dropdown-menu-uheL0prz.js +1 -0
  89. package/dist/dropdown-menu.d.ts +6 -1
  90. package/dist/dropdown-menu.js +1 -1
  91. package/dist/empty.d.ts +7 -2
  92. package/dist/empty.js +1 -1
  93. package/dist/field-Bpvn4tQp.js +1 -0
  94. package/dist/{field-V_gnkcmN.d.ts → field-BshcNVe_.d.ts} +1 -1
  95. package/dist/field-Cai_4c1l.js +1 -0
  96. package/dist/field.d.ts +53 -42
  97. package/dist/field.js +1 -1
  98. package/dist/flag.d.ts +11 -3
  99. package/dist/flag.js +1 -1
  100. package/dist/hooks.d.ts +35 -10
  101. package/dist/hooks.js +1 -1
  102. package/dist/hover-card.d.ts +25 -14
  103. package/dist/hover-card.js +1 -1
  104. package/dist/{icon-CgNqu-fl.d.ts → icon--purqHRo.d.ts} +1 -1
  105. package/dist/{icon-ByLVhdYq.d.ts → icon-DuIYoyft.d.ts} +8 -2
  106. package/dist/{icon-DXDyhy2N.d.ts → icon-QCm1ui29.d.ts} +2 -2
  107. package/dist/icon-xb7d9M7X.js +1 -0
  108. package/dist/icon.d.ts +8 -3
  109. package/dist/icon.js +1 -1
  110. package/dist/icons-DEDCLZ8B.js +1 -0
  111. package/dist/icons-DXadFwpo.js +1 -0
  112. package/dist/icons-DcesO4Ng.js +1 -0
  113. package/dist/icons.d.ts +13 -1
  114. package/dist/icons.js +1 -1
  115. package/dist/{in-view-B3nMAzfE.d.ts → in-view-C_daNafg.d.ts} +4 -23
  116. package/dist/{index-BhfgyurF.d.ts → index-KJ06KK6t.d.ts} +3 -3
  117. package/dist/input-BjCDSOPA.js +1 -0
  118. package/dist/{input-Dx5owTCc.d.ts → input-DC4nW0Sr.d.ts} +12 -2
  119. package/dist/input-fW8QSZEO.js +1 -0
  120. package/dist/input.d.ts +37 -5
  121. package/dist/input.js +1 -1
  122. package/dist/kbd-P1nQshWo.js +1 -0
  123. package/dist/kbd.d.ts +17 -5
  124. package/dist/kbd.js +1 -1
  125. package/dist/label-DO1RlMKl.js +1 -0
  126. package/dist/{label-Dn5CPJUj.d.ts → label-epgtywRz.d.ts} +14 -8
  127. package/dist/label.d.ts +6 -1
  128. package/dist/label.js +1 -1
  129. package/dist/layer-container-DL4yclOu.js +1 -0
  130. package/dist/layer-container.d.ts +2 -2
  131. package/dist/layer-container.js +1 -1
  132. package/dist/line-chart.d.ts +147 -90
  133. package/dist/line-chart.js +1 -1
  134. package/dist/list-cQZPSjfz.js +1 -0
  135. package/dist/list.d.ts +34 -16
  136. package/dist/list.js +1 -1
  137. package/dist/live-region-Dhapu8a5.js +1 -0
  138. package/dist/live-region.d.ts +15 -2
  139. package/dist/live-region.js +1 -1
  140. package/dist/llms.txt +82 -79
  141. package/dist/main-CHyWYDak.js +1 -0
  142. package/dist/main.d.ts +13 -1
  143. package/dist/main.js +1 -1
  144. package/dist/mantle.css +133 -88
  145. package/dist/media-object.d.ts +16 -4
  146. package/dist/media-object.js +1 -1
  147. package/dist/migrations/0014-chart-named-colors.yml +1389 -0
  148. package/dist/migrations/0015-segmented-control.yml +788 -0
  149. package/dist/multi-select.d.ts +42 -29
  150. package/dist/multi-select.js +1 -1
  151. package/dist/otp-input.d.ts +20 -8
  152. package/dist/otp-input.js +1 -1
  153. package/dist/pagination.d.ts +93 -4
  154. package/dist/pagination.js +1 -1
  155. package/dist/{popover-BfB2I9G0.d.ts → popover-Bei0jyfH.d.ts} +87 -12
  156. package/dist/popover-DhgunktK.js +1 -0
  157. package/dist/popover-T2EyaqGK.d.ts +1 -0
  158. package/dist/popover.d.ts +7 -2
  159. package/dist/popover.js +1 -1
  160. package/dist/primitive-D8CzV_Ft.js +1 -0
  161. package/dist/progress.d.ts +28 -11
  162. package/dist/progress.js +1 -1
  163. package/dist/qr-code.d.ts +11 -3
  164. package/dist/qr-code.js +1 -1
  165. package/dist/query-filter.d.ts +6 -6
  166. package/dist/query.d.ts +9 -4
  167. package/dist/query.js +1 -1
  168. package/dist/radio-group-BJQ6EOqh.d.ts +27 -0
  169. package/dist/radio-group-BliblUqe.js +1 -0
  170. package/dist/radio-group-ggEkCi0V.js +1 -0
  171. package/dist/radio-group.d.ts +21 -100
  172. package/dist/radio-group.js +1 -1
  173. package/dist/sandbar.d.ts +43 -30
  174. package/dist/sandbar.js +1 -1
  175. package/dist/sandboxed-on-click-D4PL5_GR.js +1 -0
  176. package/dist/sandboxed-on-click.d.ts +8 -0
  177. package/dist/sandboxed-on-click.js +1 -1
  178. package/dist/scatter-plot.d.ts +137 -76
  179. package/dist/scatter-plot.js +1 -1
  180. package/dist/segmented-control.d.ts +136 -0
  181. package/dist/segmented-control.js +1 -0
  182. package/dist/select-1xuUx_os.js +1 -0
  183. package/dist/{select-BkhBxtOT.d.ts → select-BpaXHxJm.d.ts} +33 -25
  184. package/dist/select.d.ts +6 -1
  185. package/dist/select.js +1 -1
  186. package/dist/selectable-list.d.ts +29 -18
  187. package/dist/selectable-list.js +1 -1
  188. package/dist/{separator-D9AWEkcJ.d.ts → separator-Ck4sPrdN.d.ts} +4 -2
  189. package/dist/separator-DnvhwY2J.js +1 -0
  190. package/dist/separator.d.ts +6 -1
  191. package/dist/separator.js +1 -1
  192. package/dist/{shake-DL6WhMXM.js → shake-CAUpKBHe.js} +1 -1
  193. package/dist/sheet-DHy_vlme.js +1 -0
  194. package/dist/sheet.d.ts +36 -7
  195. package/dist/sheet.js +1 -1
  196. package/dist/sidebar.d.ts +53 -37
  197. package/dist/sidebar.js +1 -1
  198. package/dist/skeleton-DHfyjuQi.js +1 -0
  199. package/dist/skeleton.d.ts +15 -4
  200. package/dist/skeleton.js +1 -1
  201. package/dist/skip-to-main-link.d.ts +12 -1
  202. package/dist/skip-to-main-link.js +1 -1
  203. package/dist/slider.d.ts +11 -1
  204. package/dist/slider.js +1 -1
  205. package/dist/slot-B7rwscwd.js +1 -0
  206. package/dist/{slot-C0OCJjdJ.d.ts → slot-BEMQMbk3.d.ts} +6 -4
  207. package/dist/slot.d.ts +6 -1
  208. package/dist/slot.js +1 -1
  209. package/dist/source-all.css +5 -1
  210. package/dist/split-button.d.ts +20 -9
  211. package/dist/split-button.js +1 -1
  212. package/dist/strata.d.ts +35 -22
  213. package/dist/strata.js +1 -1
  214. package/dist/{suggestions-NkqYTT49.d.ts → suggestions-BJeGvwDa.d.ts} +7 -7
  215. package/dist/switch.d.ts +14 -2
  216. package/dist/switch.js +1 -1
  217. package/dist/table-BnLdXUai.js +1 -0
  218. package/dist/{table-vT6Okwfa.d.ts → table-Ii9hHUWN.d.ts} +84 -5
  219. package/dist/table.d.ts +6 -1
  220. package/dist/table.js +1 -1
  221. package/dist/tabs.d.ts +24 -12
  222. package/dist/tabs.js +1 -1
  223. package/dist/text-area.d.ts +12 -2
  224. package/dist/text-area.js +1 -1
  225. package/dist/theme-BNdZl352.js +1 -0
  226. package/dist/theme-switcher.d.ts +18 -4
  227. package/dist/theme-switcher.js +1 -1
  228. package/dist/theme.d.ts +25 -11
  229. package/dist/theme.js +1 -1
  230. package/dist/toast.d.ts +15 -2
  231. package/dist/toast.js +1 -1
  232. package/dist/tokens.dark.json +3261 -0
  233. package/dist/tokens.json +4933 -0
  234. package/dist/tokens.resolver.json +37 -0
  235. package/dist/{tooltip-NcLIeBy5.d.ts → tooltip-CstGDKwy.d.ts} +18 -11
  236. package/dist/tooltip-DQO40Mrq.js +1 -0
  237. package/dist/tooltip.d.ts +6 -1
  238. package/dist/tooltip.js +1 -1
  239. package/dist/truncated-text.d.ts +28 -14
  240. package/dist/truncated-text.js +1 -1
  241. package/dist/types.d.ts +1 -1
  242. package/dist/types.js +1 -1
  243. package/dist/use-breakpoint-B4Kh0xE6.js +1 -0
  244. package/dist/use-callback-ref-DiOXFQzM.js +1 -0
  245. package/dist/use-composed-refs-DPYmLDSe.js +1 -0
  246. package/dist/use-copy-to-clipboard-hBL6_65i.js +1 -0
  247. package/dist/use-inert-siblings-C4RHXrZc.js +1 -0
  248. package/dist/use-is-apple-platform-Bq6_KbVX.js +1 -0
  249. package/dist/use-is-hydrated-BeLOGKwE.js +1 -0
  250. package/dist/use-is-hydrated-after-paint-CrHt3OHw.js +1 -0
  251. package/dist/use-isomorphic-layout-effect-CL6iq0Bj.js +1 -0
  252. package/dist/use-matches-media-query-FfvtNKQe.js +1 -0
  253. package/dist/use-prefers-reduced-motion-Ck6dnOM9.js +1 -0
  254. package/dist/use-swipe-to-dismiss-BYdlca8r.js +1 -0
  255. package/dist/utils.d.ts +1 -1
  256. package/dist/utils.js +1 -1
  257. package/dist/visually-hidden.d.ts +14 -1
  258. package/dist/visually-hidden.js +1 -1
  259. package/dist/well.d.ts +7 -2
  260. package/dist/well.js +1 -1
  261. package/package.json +21 -7
  262. package/src/components/chart/d3-license.md +25 -0
  263. package/dist/alert-P9lwn25X.js +0 -1
  264. package/dist/anchor-CgcbWEUs.js +0 -1
  265. package/dist/browser-only-BTSrYWLj.js +0 -1
  266. package/dist/button-69InNC_m.js +0 -1
  267. package/dist/button-B8k98Pby.js +0 -1
  268. package/dist/button-Dge0D5bl.js +0 -1
  269. package/dist/chart-BpWfQAwf.js +0 -2
  270. package/dist/checkbox-DmSQXs26.js +0 -1
  271. package/dist/choice-2Lrv8_nl.js +0 -1
  272. package/dist/code-DUJzSl4K.js +0 -1
  273. package/dist/compose-refs-sFdxsL7k.js +0 -1
  274. package/dist/dialog-7TUgiSzX.js +0 -1
  275. package/dist/dialog-Dp0QGWwo.d.ts +0 -28
  276. package/dist/dropdown-menu-BHBzCDSZ.js +0 -1
  277. package/dist/field-Bihblt8U.js +0 -1
  278. package/dist/field-CPvjazWN.js +0 -1
  279. package/dist/icon-kK0c-POG.js +0 -1
  280. package/dist/icons-CDLz5lpI.js +0 -1
  281. package/dist/icons-CSwTVV2m.js +0 -1
  282. package/dist/icons-DP3lQw5O.js +0 -1
  283. package/dist/input-CpQ6jlpI.js +0 -1
  284. package/dist/kbd-CLHsJ99p.js +0 -1
  285. package/dist/label-nHqqYS7e.js +0 -1
  286. package/dist/layer-container-kEQiE4zV.js +0 -1
  287. package/dist/list-RFRIQxU2.js +0 -1
  288. package/dist/live-region-DQ1QLv3L.js +0 -1
  289. package/dist/main-CC1L9IsH.js +0 -1
  290. package/dist/popover-C96V8SXi.d.ts +0 -1
  291. package/dist/popover-DxOqLKxy.js +0 -1
  292. package/dist/primitive-Dz9Al-us.js +0 -1
  293. package/dist/radio-group-HDVxTNPi.js +0 -1
  294. package/dist/sandboxed-on-click-C7pPu-2M.js +0 -1
  295. package/dist/select-CAAYk4Yj.js +0 -1
  296. package/dist/separator-DfzxVutO.js +0 -1
  297. package/dist/sheet-CSJc_sB4.js +0 -1
  298. package/dist/skeleton-DBpI-ko5.js +0 -1
  299. package/dist/slot-DdYN1L1C.js +0 -1
  300. package/dist/table-CFHiDBW8.js +0 -1
  301. package/dist/theme-C-glc5Q-.js +0 -1
  302. package/dist/tooltip-b6oiTaWq.js +0 -1
  303. package/dist/use-breakpoint--mo7kr9d.js +0 -1
  304. package/dist/use-callback-ref-BvVyI5K1.js +0 -1
  305. package/dist/use-copy-to-clipboard-Dy_0Qzb7.js +0 -1
  306. package/dist/use-is-apple-platform-D4nifHMx.js +0 -1
  307. package/dist/use-is-hydrated-after-paint-r9Cl2mGp.js +0 -1
  308. package/dist/use-isomorphic-layout-effect-CLSmHzo4.js +0 -1
  309. package/dist/use-matches-media-query-m860lols.js +0 -1
  310. package/dist/use-prefers-reduced-motion-CU6mWmOe.js +0 -1
  311. package/dist/use-swipe-to-dismiss-DceYk1Id.js +0 -1
package/README.md CHANGED
@@ -14,7 +14,6 @@
14
14
  ## Documentation
15
15
 
16
16
  - [mantle.ngrok.com](https://mantle.ngrok.com) - our official component documentation site (reflects latest releases)
17
- - [develop.mantle.ngrok.com](https://develop.mantle.ngrok.com) - staging site for all merges to `main`
18
17
 
19
18
  ## Installation
20
19
 
@@ -40,7 +39,17 @@ Next, check out the [Overview & Setup](https://mantle.ngrok.com/) docs and start
40
39
 
41
40
  ## Using with AI Agents
42
41
 
43
- Mantle ships machine-readable entry points for coding agents — see [For AI Agents](https://mantle.ngrok.com/for-ai-agents) for the system-prompt snippet, conventions, and the full list of `/api/*.json` and `llms.txt` endpoints. An offline pointer file (`@ngrok/mantle/agent.json`) is included in the published package as a fallback when network access isn't available.
42
+ Mantle runs a hosted, read-only [MCP](https://modelcontextprotocol.io) server at `https://mantle.ngrok.com/mcp`. It reads the API of the version you installed. [For AI Agents](https://mantle.ngrok.com/for-ai-agents) has the setup for each client, the system-prompt snippet, and the full list of `/api/*.json` and `llms.txt` endpoints.
43
+
44
+ The package also works offline:
45
+
46
+ - `@ngrok/mantle/agent.json`: the full component, hook, and utility records for the installed version.
47
+ - `@ngrok/mantle/llms.txt`: one line for each module, with its import path and summary.
48
+ - `dist/migrations/`: the codemods that the migration guides name.
49
+
50
+ ## Design tokens
51
+
52
+ `@ngrok/mantle/tokens.json` holds mantle's design tokens in the [Design Tokens Community Group (DTCG)](https://www.designtokens.org/tr/2025.10/format/) format, with their light theme values. `@ngrok/mantle/tokens.dark.json` holds the tokens that change in the dark theme, and `@ngrok/mantle/tokens.resolver.json` is a DTCG resolver document that applies them. A token path joined with `-` names its Tailwind theme variable: `color.sky.500` is `--color-sky-500`.
44
53
 
45
54
  ## Code Block Tooling
46
55
 
@@ -1,9 +1,14 @@
1
+ /**
2
+ * Re-exports for the Accordion component.
3
+ *
4
+ * @see https://mantle.ngrok.com/components/data-display/accordion
5
+ */
1
6
  import { n as WithAsChild } from "./as-child-DFxX3U2i.js";
2
- import { t as WithDataSlot } from "./data-slot-B-LqAcBB.js";
3
- import { n as IconProps } from "./icon-ByLVhdYq.js";
7
+ import { t as WithDataSlot } from "./data-slot-BW8KQ9Xo.js";
8
+ import { n as IconProps } from "./icon-DuIYoyft.js";
4
9
  import { ComponentProps } from "react";
5
10
  /**
6
- * `"single"` mode props: at most one item open at a time — opening a section
11
+ * `"single"` mode props: at most one item open at a time. Opening a section
7
12
  * auto-closes the previously open one. This is the **opt-in** behavior; `type`
8
13
  * defaults to `"multiple"`, so you must set `type="single"` explicitly to get
9
14
  * the auto-close accordion. `value`/`defaultValue` are the open item's value
@@ -12,7 +17,7 @@ import { ComponentProps } from "react";
12
17
  type AccordionSingleProps = {
13
18
  /**
14
19
  * Keep at most one section open at a time: opening a section auto-closes the
15
- * previously open one. Must be set explicitly — the default is `"multiple"`,
20
+ * previously open one. Must be set explicitly: the default is `"multiple"`,
16
21
  * where sections open independently.
17
22
  */
18
23
  type: "single";
@@ -24,15 +29,15 @@ type AccordionSingleProps = {
24
29
  onValueChange?: (value: string) => void;
25
30
  };
26
31
  /**
27
- * `"multiple"` mode props — the **default** when `type` is omitted: any number
32
+ * `"multiple"` mode props, the **default** when `type` is omitted. Any number
28
33
  * of items may be open at once, and opening one never closes another.
29
34
  * `value`/`defaultValue` are the list of open item values. Use `type="single"`
30
35
  * instead if you want opening a section to auto-close the others.
31
36
  */
32
37
  type AccordionMultipleProps = {
33
38
  /**
34
- * Allow any number of sections open at once — the **default** when `type` is
35
- * omitted. Opening one section never collapses the others. Switch to
39
+ * Allow any number of sections open at once. This is the **default** when
40
+ * `type` is omitted. Opening one section never collapses the others. Switch to
36
41
  * `type="single"` for the accordion that auto-closes the previously open
37
42
  * section.
38
43
  *
@@ -50,7 +55,7 @@ type AccordionMultipleProps = {
50
55
  * Props for {@link Root}. A discriminated union on `type` so `value`,
51
56
  * `defaultValue`, and `onValueChange` are typed as a single string in
52
57
  * `"single"` mode and a string array in `"multiple"` mode. `type` is optional
53
- * and **defaults to `"multiple"`** — omitting it is the same as
58
+ * and **defaults to `"multiple"`**. Omitting it is the same as
54
59
  * `type="multiple"` (sections open independently), so `value` / `defaultValue` /
55
60
  * `onValueChange` are typed as string arrays. Set `type="single"` for the
56
61
  * accordion that keeps at most one section open at a time. Also accepts all
@@ -68,8 +73,8 @@ type AccordionRootProps = (AccordionSingleProps | AccordionMultipleProps) & Omit
68
73
  * with controlled (`value` + `onValueChange`) and uncontrolled (`defaultValue`)
69
74
  * usage in both `"single"` and `"multiple"` modes.
70
75
  *
71
- * `type` is optional and **defaults to `"multiple"`** — sections open
72
- * independently and opening one never closes another. Pass `type="single"` for
76
+ * `type` is optional and **defaults to `"multiple"`**: sections open
77
+ * independently, and opening one never closes another. Pass `type="single"` for
73
78
  * the classic accordion where opening a section auto-closes the previously open
74
79
  * one.
75
80
  *
@@ -81,6 +86,7 @@ type AccordionRootProps = (AccordionSingleProps | AccordionMultipleProps) & Omit
81
86
  * @see https://mantle.ngrok.com/components/data-display/accordion#accordionroot
82
87
  *
83
88
  * @example
89
+ * ```tsx
84
90
  * <Accordion.Root type="single" defaultValue="shipping">
85
91
  * <Accordion.Item value="shipping">
86
92
  * <Accordion.Trigger>
@@ -92,19 +98,21 @@ type AccordionRootProps = (AccordionSingleProps | AccordionMultipleProps) & Omit
92
98
  * </Accordion.Content>
93
99
  * </Accordion.Item>
94
100
  * </Accordion.Root>
101
+ * ```
95
102
  */
96
103
  declare const Root: (props: AccordionRootProps) => import("react").JSX.Element;
97
104
  /**
98
- * A single collapsible section, rendered as a plain `<div role="group">` — the
99
- * same accessibility role the browser gives a native `<details>`. Derives its
105
+ * A single collapsible section, rendered as a plain `<div role="group">` (the
106
+ * same accessibility role the browser gives a native `<details>`). Derives its
100
107
  * open state from {@link Root}.
101
108
  *
102
- * Because the item is a plain `<div>`, its header can be any layout — e.g. a flex
103
- * row with the {@link Trigger} alongside a separate, non-toggling action button.
109
+ * Because the item is a plain `<div>`, its header can be any layout, including a
110
+ * flex row with the {@link Trigger} beside a separate, non-toggling action button.
104
111
  *
105
112
  * @see https://mantle.ngrok.com/components/data-display/accordion#accordionitem
106
113
  *
107
114
  * @example
115
+ * ```tsx
108
116
  * <Accordion.Root type="single" defaultValue="item-1">
109
117
  * <Accordion.Item value="item-1">
110
118
  * <Accordion.Trigger>
@@ -116,6 +124,7 @@ declare const Root: (props: AccordionRootProps) => import("react").JSX.Element;
116
124
  * </Accordion.Content>
117
125
  * </Accordion.Item>
118
126
  * </Accordion.Root>
127
+ * ```
119
128
  */
120
129
  declare const Item: ({ "data-slot": dataSlot, children, value, ref, ...props }: ComponentProps<"div"> & {
121
130
  /** The unique value identifying this item within its accordion. */
@@ -123,7 +132,7 @@ declare const Item: ({ "data-slot": dataSlot, children, value, ref, ...props }:
123
132
  } & WithDataSlot) => import("react").JSX.Element;
124
133
  /**
125
134
  * The interactive header that toggles its section, rendered as a `<button>` with
126
- * `aria-expanded` — the disclosure semantics a native `<summary>` carries, but
135
+ * `aria-expanded`: the disclosure semantics a native `<summary>` carries, but
127
136
  * via a real button so the role is consistent across browsers (native summary's
128
137
  * role varies). Its `aria-controls` points at the item's {@link Content}, as the
129
138
  * WAI-ARIA disclosure pattern requires. Place the {@link TriggerIcon} as the last
@@ -132,6 +141,7 @@ declare const Item: ({ "data-slot": dataSlot, children, value, ref, ...props }:
132
141
  * @see https://mantle.ngrok.com/components/data-display/accordion#accordiontrigger
133
142
  *
134
143
  * @example
144
+ * ```tsx
135
145
  * <Accordion.Root type="single" defaultValue="item-1">
136
146
  * <Accordion.Item value="item-1">
137
147
  * <Accordion.Trigger>
@@ -143,6 +153,7 @@ declare const Item: ({ "data-slot": dataSlot, children, value, ref, ...props }:
143
153
  * </Accordion.Content>
144
154
  * </Accordion.Item>
145
155
  * </Accordion.Root>
156
+ * ```
146
157
  */
147
158
  declare const Trigger: ({ "data-slot": dataSlot, className, children, onClick, ref, ...props }: Omit<ComponentProps<"button">, "type"> & WithDataSlot) => import("react").JSX.Element;
148
159
  /**
@@ -154,6 +165,7 @@ declare const Trigger: ({ "data-slot": dataSlot, className, children, onClick, r
154
165
  * @see https://mantle.ngrok.com/components/data-display/accordion#accordiontriggericon
155
166
  *
156
167
  * @example
168
+ * ```tsx
157
169
  * // Default caret
158
170
  * <Accordion.Root type="single" defaultValue="item-1">
159
171
  * <Accordion.Item value="item-1">
@@ -166,8 +178,10 @@ declare const Trigger: ({ "data-slot": dataSlot, className, children, onClick, r
166
178
  * </Accordion.Content>
167
179
  * </Accordion.Item>
168
180
  * </Accordion.Root>
181
+ * ```
169
182
  *
170
183
  * @example
184
+ * ```tsx
171
185
  * // Custom icon
172
186
  * import { PlusIcon } from "@phosphor-icons/react/Plus";
173
187
  *
@@ -182,14 +196,15 @@ declare const Trigger: ({ "data-slot": dataSlot, className, children, onClick, r
182
196
  * </Accordion.Content>
183
197
  * </Accordion.Item>
184
198
  * </Accordion.Root>
199
+ * ```
185
200
  */
186
201
  declare const TriggerIcon: ({ "data-slot": dataSlot, className, svg, ...props }: Omit<IconProps, "svg"> & {
187
202
  /** The icon to render. Defaults to a downward caret that rotates open. */
188
203
  svg?: IconProps["svg"];
189
204
  } & WithDataSlot) => import("react").JSX.Element;
190
205
  /**
191
- * The collapsible region of an {@link Item} — the zero-padding viewport that
192
- * slides open and closed. Wrap its children in {@link Body} for the standard
206
+ * The collapsible region of an {@link Item} (the zero-padding viewport that
207
+ * slides open and closed). Wrap its children in {@link Body} for the standard
193
208
  * padding (text inherits the ambient size); `Content` itself stays unpadded so
194
209
  * its `h-0` collapse can reach zero height. Always rendered into the DOM. When
195
210
  * collapsed, it leaves the accessibility tree and the tab order, like a closed
@@ -204,6 +219,7 @@ declare const TriggerIcon: ({ "data-slot": dataSlot, className, svg, ...props }:
204
219
  * @see https://mantle.ngrok.com/components/data-display/accordion#accordioncontent
205
220
  *
206
221
  * @example
222
+ * ```tsx
207
223
  * <Accordion.Root type="single" defaultValue="item-1">
208
224
  * <Accordion.Item value="item-1">
209
225
  * <Accordion.Trigger>
@@ -215,23 +231,25 @@ declare const TriggerIcon: ({ "data-slot": dataSlot, className, svg, ...props }:
215
231
  * </Accordion.Content>
216
232
  * </Accordion.Item>
217
233
  * </Accordion.Root>
234
+ * ```
218
235
  */
219
236
  declare const Content: ({ "data-slot": dataSlot, className, children, ref, ...props }: Omit<ComponentProps<"div">, "id"> & WithDataSlot) => import("react").JSX.Element;
220
237
  /**
221
- * The padded inner region of an {@link Item}'s {@link Content} — where the
238
+ * The padded inner region of an {@link Item}'s {@link Content}, where the
222
239
  * section's body content lives. Owns the body's padding so {@link Content} can
223
240
  * stay a zero-padding animation viewport: a padded `h-0` border-box can't
224
241
  * collapse below its padding, so keeping the padding here lets the closed slide
225
242
  * reach zero height. The `pt-1` is the focus ring's vertical clearance: the
226
243
  * trigger keeps its `py-4` when open, and its `ring-4` paints 4px below the
227
244
  * button, so the ring stays off the body's first line (see {@link Trigger}). Text inherits the ambient
228
- * size — it isn't forced — so set a size on the content where you need one.
245
+ * size rather than being forced to a fixed size. Set a text class where you need one.
229
246
  * Override `className` to retune the padding (e.g. `pb-0`, `px-6`); `cx` resolves
230
247
  * last-wins.
231
248
  *
232
249
  * @see https://mantle.ngrok.com/components/data-display/accordion#accordionbody
233
250
  *
234
251
  * @example
252
+ * ```tsx
235
253
  * <Accordion.Root type="single" defaultValue="item-1">
236
254
  * <Accordion.Item value="item-1">
237
255
  * <Accordion.Trigger>
@@ -245,14 +263,15 @@ declare const Content: ({ "data-slot": dataSlot, className, children, ref, ...pr
245
263
  * </Accordion.Content>
246
264
  * </Accordion.Item>
247
265
  * </Accordion.Root>
266
+ * ```
248
267
  */
249
268
  declare const Body: ({ "data-slot": dataSlot, className, ref, ...props }: ComponentProps<"div"> & WithDataSlot) => import("react").JSX.Element;
250
269
  /**
251
270
  * A vertically stacked set of disclosure sections styled after the shadcn /
252
271
  * ngrok.com accordion.
253
272
  *
254
- * Its defining feature: collapsed content is never removed from the DOM — it
255
- * stays put with `hidden="until-found"` — so the browser's find-in-page (⌘F /
273
+ * Its defining feature: collapsed content is never removed from the DOM (it
274
+ * stays put with `hidden="until-found"`), so the browser's find-in-page (⌘F /
256
275
  * Ctrl-F) can find text inside closed sections and auto-expand them (synced via
257
276
  * the `beforematch` event). Built on plain `<div>`/`<button>` elements, so a
258
277
  * section header can be any layout, including a non-toggling action button
@@ -261,6 +280,13 @@ declare const Body: ({ "data-slot": dataSlot, className, ref, ...props }: Compon
261
280
  * `Accordion.Root` defaults to `type="multiple"` (sections open independently);
262
281
  * pass `type="single"` when opening one section should auto-close the others.
263
282
  *
283
+ * @useWhen Stack titled sections that each expand and collapse in place, such as questions and
284
+ * answers or a group of advanced settings.
285
+ *
286
+ * @siblings
287
+ * - `Tabs`: one section shows at a time, and a row of tabs switches between them.
288
+ * - `Strata`: every section stays open, with its title and explanation beside its content.
289
+ *
264
290
  * @see https://mantle.ngrok.com/components/data-display/accordion
265
291
  *
266
292
  * @example
@@ -275,6 +301,7 @@ declare const Body: ({ "data-slot": dataSlot, className, ref, ...props }: Compon
275
301
  * ```
276
302
  *
277
303
  * @example
304
+ * ```tsx
278
305
  * <Accordion.Root type="single" defaultValue="item-1">
279
306
  * <Accordion.Item value="item-1">
280
307
  * <Accordion.Trigger>
@@ -286,12 +313,16 @@ declare const Body: ({ "data-slot": dataSlot, className, ref, ...props }: Compon
286
313
  * </Accordion.Content>
287
314
  * </Accordion.Item>
288
315
  * </Accordion.Root>
316
+ * ```
289
317
  */
290
318
  declare const Accordion: {
291
319
  /**
292
320
  * The root that owns open/closed state. See {@link Root}.
293
321
  *
322
+ * @see https://mantle.ngrok.com/components/data-display/accordion#accordionroot
323
+ *
294
324
  * @example
325
+ * ```tsx
295
326
  * <Accordion.Root type="single" defaultValue="item-1">
296
327
  * <Accordion.Item value="item-1">
297
328
  * <Accordion.Trigger>
@@ -303,12 +334,16 @@ declare const Accordion: {
303
334
  * </Accordion.Content>
304
335
  * </Accordion.Item>
305
336
  * </Accordion.Root>
337
+ * ```
306
338
  */
307
339
  readonly Root: typeof Root;
308
340
  /**
309
341
  * A single collapsible section. See {@link Item}.
310
342
  *
343
+ * @see https://mantle.ngrok.com/components/data-display/accordion#accordionitem
344
+ *
311
345
  * @example
346
+ * ```tsx
312
347
  * <Accordion.Root type="single" defaultValue="item-1">
313
348
  * <Accordion.Item value="item-1">
314
349
  * <Accordion.Trigger>
@@ -320,12 +355,16 @@ declare const Accordion: {
320
355
  * </Accordion.Content>
321
356
  * </Accordion.Item>
322
357
  * </Accordion.Root>
358
+ * ```
323
359
  */
324
360
  readonly Item: typeof Item;
325
361
  /**
326
362
  * The `<button>` header that toggles a section. See {@link Trigger}.
327
363
  *
364
+ * @see https://mantle.ngrok.com/components/data-display/accordion#accordiontrigger
365
+ *
328
366
  * @example
367
+ * ```tsx
329
368
  * <Accordion.Root type="single" defaultValue="item-1">
330
369
  * <Accordion.Item value="item-1">
331
370
  * <Accordion.Trigger>
@@ -337,12 +376,16 @@ declare const Accordion: {
337
376
  * </Accordion.Content>
338
377
  * </Accordion.Item>
339
378
  * </Accordion.Root>
379
+ * ```
340
380
  */
341
381
  readonly Trigger: typeof Trigger;
342
382
  /**
343
383
  * The caret indicating open/closed state. See {@link TriggerIcon}.
344
384
  *
385
+ * @see https://mantle.ngrok.com/components/data-display/accordion#accordiontriggericon
386
+ *
345
387
  * @example
388
+ * ```tsx
346
389
  * <Accordion.Root type="single" defaultValue="item-1">
347
390
  * <Accordion.Item value="item-1">
348
391
  * <Accordion.Trigger>
@@ -354,12 +397,16 @@ declare const Accordion: {
354
397
  * </Accordion.Content>
355
398
  * </Accordion.Item>
356
399
  * </Accordion.Root>
400
+ * ```
357
401
  */
358
402
  readonly TriggerIcon: typeof TriggerIcon;
359
403
  /**
360
404
  * The collapsible, find-in-page-discoverable body. See {@link Content}.
361
405
  *
406
+ * @see https://mantle.ngrok.com/components/data-display/accordion#accordioncontent
407
+ *
362
408
  * @example
409
+ * ```tsx
363
410
  * <Accordion.Root type="single" defaultValue="item-1">
364
411
  * <Accordion.Item value="item-1">
365
412
  * <Accordion.Trigger>
@@ -371,12 +418,16 @@ declare const Accordion: {
371
418
  * </Accordion.Content>
372
419
  * </Accordion.Item>
373
420
  * </Accordion.Root>
421
+ * ```
374
422
  */
375
423
  readonly Content: typeof Content;
376
424
  /**
377
425
  * The padded inner region of a {@link Content}. See {@link Body}.
378
426
  *
427
+ * @see https://mantle.ngrok.com/components/data-display/accordion#accordionbody
428
+ *
379
429
  * @example
430
+ * ```tsx
380
431
  * <Accordion.Root type="single" defaultValue="item-1">
381
432
  * <Accordion.Item value="item-1">
382
433
  * <Accordion.Trigger>
@@ -390,6 +441,7 @@ declare const Accordion: {
390
441
  * </Accordion.Content>
391
442
  * </Accordion.Item>
392
443
  * </Accordion.Root>
444
+ * ```
393
445
  */
394
446
  readonly Body: typeof Body;
395
447
  };
package/dist/accordion.js CHANGED
@@ -1 +1 @@
1
- import{n as e}from"./browser-only-BTSrYWLj.js";import{t}from"./use-isomorphic-layout-effect-CLSmHzo4.js";import{n}from"./compose-refs-sFdxsL7k.js";import{t as r}from"./cx-CK7o_rVv.js";import{t as i}from"./data-slot-EM6s2WEU.js";import{t as a}from"./icon-kK0c-POG.js";import{t as o}from"./slot-DdYN1L1C.js";import{c as s}from"react/compiler-runtime";import{CaretDownIcon as c}from"@phosphor-icons/react/CaretDown";import{createContext as l,useContext as u,useEffect as d,useId as f,useRef as p,useState as m}from"react";import h from"tiny-invariant";import{jsx as g}from"react/jsx-runtime";function _(e,t){return e.includes(t)}function v({openValues:e,value:t,open:n,type:r}){let i=e.includes(t);return n?r===`single`?i&&e.length===1?e:[t]:i?e:[...e,t]:i?e.filter(e=>e!==t):e}function y(e){return e==null?[]:typeof e==`string`?e===``?[]:[e]:e}function b(e,t){e.type===`single`?e.onValueChange?.(t[0]??``):e.onValueChange?.([...t])}function x(){return e()&&document.body!=null&&`onbeforematch`in document.body}const S=l(null);function C(e){let t=u(S);return h(t,`\`${e}\` must be rendered within \`Accordion.Root\`.`),t}const w=l(null);function T(e){let t=u(w);return h(t,`\`${e}\` must be rendered within \`Accordion.Item\`.`),t}const E=e=>{let n=s(42),a,c,l,u,d,f,h,_,x;if(n[0]!==e){let{type:t,value:r,defaultValue:i,onValueChange:o,"data-slot":s,asChild:p,children:m,className:g,ref:v,...y}=e;_=t,x=r,d=i,u=s,a=p,c=m,l=g,h=v,f=y,n[0]=e,n[1]=a,n[2]=c,n[3]=l,n[4]=u,n[5]=d,n[6]=f,n[7]=h,n[8]=_,n[9]=x}else a=n[1],c=n[2],l=n[3],u=n[4],d=n[5],f=n[6],h=n[7],_=n[8],x=n[9];let C=_===void 0?`multiple`:_,w=x!=null,T;n[10]===d?T=n[11]:(T=()=>y(d),n[10]=d,n[11]=T);let[E,D]=m(T),O;n[12]!==E||n[13]!==w||n[14]!==x?(O=w?y(x):E,n[12]=E,n[13]=w,n[14]=x,n[15]=O):O=n[15];let k=O,A=p(e),j;n[16]===e?j=n[17]:(j=()=>{A.current=e},n[16]=e,n[17]=j),t(j);let M;n[18]!==w||n[19]!==k||n[20]!==C?(M=e=>{let{itemValue:t,open:n}=e,r=v({openValues:k,value:t,open:n,type:C});r!==k&&(w||D(r),b(A.current,r))},n[18]=w,n[19]=k,n[20]=C,n[21]=M):M=n[21];let N=M,P;n[22]!==k||n[23]!==N||n[24]!==C?(P={type:C,openValues:k,setItemOpen:N},n[22]=k,n[23]=N,n[24]=C,n[25]=P):P=n[25];let F=P,I;n[26]===u?I=n[27]:(I=i(u,`accordion`),n[26]=u,n[27]=I);let L;n[28]===l?L=n[29]:(L=r(`w-full divide-y divide-separator`,l),n[28]=l,n[29]=L);let R;n[30]!==f||n[31]!==I||n[32]!==L?(R={...f,"data-slot":I,className:L},n[30]=f,n[31]=I,n[32]=L,n[33]=R):R=n[33];let z=R,B;n[34]!==a||n[35]!==c||n[36]!==z||n[37]!==h?(B=g(a?o:`div`,{ref:h,...z,children:c}),n[34]=a,n[35]=c,n[36]=z,n[37]=h,n[38]=B):B=n[38];let V;return n[39]!==F||n[40]!==B?(V=/* @__PURE__ */ g(S.Provider,{value:F,children:B}),n[39]=F,n[40]=B,n[41]=V):V=n[41],V},D=e=>{let t=s(27),n,r,a,o,c;t[0]===e?(n=t[1],r=t[2],a=t[3],o=t[4],c=t[5]):({"data-slot":r,children:n,value:c,ref:o,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=o,t[5]=c);let{openValues:l,setItemOpen:u}=C(`Accordion.Item`),d;t[6]!==l||t[7]!==c?(d=_(l,c),t[6]=l,t[7]=c,t[8]=d):d=t[8];let p=d,m=f(),h;t[9]!==u||t[10]!==c?(h=e=>{u({itemValue:c,open:e})},t[9]=u,t[10]=c,t[11]=h):h=t[11];let v=h,y;t[12]!==m||t[13]!==p||t[14]!==v?(y={open:p,setOpen:v,contentId:m},t[12]=m,t[13]=p,t[14]=v,t[15]=y):y=t[15];let b=y,x;t[16]===r?x=t[17]:(x=i(r,`accordion-item`),t[16]=r,t[17]=x);let S=p?`open`:`closed`,T;t[18]!==n||t[19]!==a||t[20]!==o||t[21]!==x||t[22]!==S?(T=/* @__PURE__ */ g(`div`,{ref:o,...a,role:`group`,"data-slot":x,"data-state":S,children:n}),t[18]=n,t[19]=a,t[20]=o,t[21]=x,t[22]=S,t[23]=T):T=t[23];let E;return t[24]!==b||t[25]!==T?(E=/* @__PURE__ */ g(w.Provider,{value:b,children:T}),t[24]=b,t[25]=T,t[26]=E):E=t[26],E},O=e=>{let t=s(25),n,a,o,c,l,u;t[0]===e?(n=t[1],a=t[2],o=t[3],c=t[4],l=t[5],u=t[6]):({"data-slot":o,className:a,children:n,onClick:c,ref:u,...l}=e,t[0]=e,t[1]=n,t[2]=a,t[3]=o,t[4]=c,t[5]=l,t[6]=u);let{open:d,setOpen:f,contentId:p}=T(`Accordion.Trigger`),m;t[7]===o?m=t[8]:(m=i(o,`accordion-trigger`),t[7]=o,t[8]=m);let h=d?`open`:`closed`,_;t[9]===a?_=t[10]:(_=r(`group flex w-full cursor-pointer items-center justify-between gap-4 py-4 text-left font-medium outline-none`,`-mx-2 rounded-md px-2`,`focus:outline-hidden focus-visible:ring-4 focus-visible:ring-focus-accent`,a),t[9]=a,t[10]=_);let v;t[11]!==c||t[12]!==d||t[13]!==f?(v=e=>{c?.(e),f(!d)},t[11]=c,t[12]=d,t[13]=f,t[14]=v):v=t[14];let y;return t[15]!==n||t[16]!==p||t[17]!==d||t[18]!==l||t[19]!==u||t[20]!==m||t[21]!==h||t[22]!==_||t[23]!==v?(y=/* @__PURE__ */ g(`button`,{ref:u,type:`button`,...l,"data-slot":m,"data-state":h,"aria-expanded":d,"aria-controls":p,className:_,onClick:v,children:n}),t[15]=n,t[16]=p,t[17]=d,t[18]=l,t[19]=u,t[20]=m,t[21]=h,t[22]=_,t[23]=v,t[24]=y):y=t[24],y},k=/* @__PURE__ */ g(c,{weight:`bold`}),A={Root:E,Item:D,Trigger:O,TriggerIcon:e=>{let t=s(14),n,o,c,l;t[0]===e?(n=t[1],o=t[2],c=t[3],l=t[4]):({"data-slot":o,className:n,svg:l,...c}=e,t[0]=e,t[1]=n,t[2]=o,t[3]=c,t[4]=l);let u=l===void 0?k:l,d;t[5]===o?d=t[6]:(d=i(o,`accordion-trigger-icon`),t[5]=o,t[6]=d);let f;t[7]===n?f=t[8]:(f=r(`h-lh w-4 shrink-0 self-start text-muted transition-transform duration-200 ease-out-strong group-data-state-open:rotate-180 motion-reduce:transition-none`,n),t[7]=n,t[8]=f);let p;return t[9]!==c||t[10]!==u||t[11]!==d||t[12]!==f?(p=/* @__PURE__ */ g(a,{...c,"data-slot":d,svg:u,className:f}),t[9]=c,t[10]=u,t[11]=d,t[12]=f,t[13]=p):p=t[13],p},Content:e=>{let a=s(25),o,c,l,u,f;a[0]===e?(o=a[1],c=a[2],l=a[3],u=a[4],f=a[5]):({"data-slot":l,className:c,children:o,ref:f,...u}=e,a[0]=e,a[1]=o,a[2]=c,a[3]=l,a[4]=u,a[5]=f);let{open:m,setOpen:h,contentId:_}=T(`Accordion.Content`),v=p(null),y=n(v,f),b,S;a[6]===h?(b=a[7],S=a[8]):(b=()=>{let e=v.current;if(!e||!x())return;let t=()=>{let{transitionProperty:t}=e.style;e.removeAttribute(`hidden`),e.style.transitionProperty=`none`,e.style.height=`auto`,e.style.opacity=`1`,e.getBoundingClientRect(),e.style.transitionProperty=t,h(!0)};return e.addEventListener(`beforematch`,t),()=>{e.removeEventListener(`beforematch`,t)}},S=[h],a[6]=h,a[7]=b,a[8]=S),d(b,S);let C,w;a[9]===m?(C=a[10],w=a[11]):(C=()=>{let e=v.current;e&&x()&&(e.removeAttribute(`inert`),m?e.removeAttribute(`hidden`):(e.setAttribute(`hidden`,`until-found`),e.style.height=``,e.style.opacity=``))},w=[m],a[9]=m,a[10]=C,a[11]=w),t(C,w);let E=!m,D;a[12]===l?D=a[13]:(D=i(l,`accordion-content`),a[12]=l,a[13]=D);let O=m?`open`:`closed`,k;a[14]===c?k=a[15]:(k=r(`h-0 overflow-hidden opacity-0 transition-[height,opacity,content-visibility] duration-200 ease-out-strong [interpolate-size:allow-keywords] transition-discrete data-state-open:h-auto data-state-open:opacity-100 motion-reduce:transition-none`,c),a[14]=c,a[15]=k);let A;return a[16]!==o||a[17]!==y||a[18]!==_||a[19]!==u||a[20]!==E||a[21]!==D||a[22]!==O||a[23]!==k?(A=/* @__PURE__ */ g(`div`,{ref:y,...u,id:_,inert:E,"data-slot":D,"data-state":O,className:k,children:o}),a[16]=o,a[17]=y,a[18]=_,a[19]=u,a[20]=E,a[21]=D,a[22]=O,a[23]=k,a[24]=A):A=a[24],A},Body:e=>{let t=s(14),n,a,o,c;t[0]===e?(n=t[1],a=t[2],o=t[3],c=t[4]):({"data-slot":a,className:n,ref:c,...o}=e,t[0]=e,t[1]=n,t[2]=a,t[3]=o,t[4]=c);let l;t[5]===a?l=t[6]:(l=i(a,`accordion-body`),t[5]=a,t[6]=l);let u;t[7]===n?u=t[8]:(u=r(`pt-1 pb-4`,n),t[7]=n,t[8]=u);let d;return t[9]!==o||t[10]!==c||t[11]!==l||t[12]!==u?(d=/* @__PURE__ */ g(`div`,{ref:c,...o,"data-slot":l,className:u}),t[9]=o,t[10]=c,t[11]=l,t[12]=u,t[13]=d):d=t[13],d}};export{A as Accordion};
1
+ "use client";import{t as e}from"./use-isomorphic-layout-effect-CL6iq0Bj.js";import{t}from"./use-composed-refs-DPYmLDSe.js";import{t as n}from"./cx-CK7o_rVv.js";import{t as r}from"./data-slot-EM6s2WEU.js";import{t as i}from"./icon-xb7d9M7X.js";import{t as a}from"./slot-B7rwscwd.js";import{t as o}from"./browser-only-ymFoM3Ya.js";import{c as s}from"react/compiler-runtime";import{CaretDownIcon as c}from"@phosphor-icons/react/CaretDown";import{createContext as l,useContext as u,useEffect as d,useId as f,useRef as p,useState as m}from"react";import h from"tiny-invariant";import{jsx as g}from"react/jsx-runtime";function _(e,t){return e.includes(t)}function v({openValues:e,value:t,open:n,type:r}){let i=e.includes(t);return n?r===`single`?i&&e.length===1?e:[t]:i?e:[...e,t]:i?e.filter(e=>e!==t):e}function y(e){return e==null?[]:typeof e==`string`?e===``?[]:[e]:e}function b(e,t){e.type===`single`?e.onValueChange?.(t[0]??``):e.onValueChange?.([...t])}function x(){return o()&&document.body!=null&&`onbeforematch`in document.body}const S=l(null);function C(e){let t=u(S);return h(t,`\`${e}\` must be rendered within \`Accordion.Root\`.`),t}const w=l(null);function T(e){let t=u(w);return h(t,`\`${e}\` must be rendered within \`Accordion.Item\`.`),t}const E=t=>{let i=s(42),o,c,l,u,d,f,h,_,x;if(i[0]!==t){let{type:e,value:n,defaultValue:r,onValueChange:a,"data-slot":s,asChild:p,children:m,className:g,ref:v,...y}=t;_=e,x=n,d=r,u=s,o=p,c=m,l=g,h=v,f=y,i[0]=t,i[1]=o,i[2]=c,i[3]=l,i[4]=u,i[5]=d,i[6]=f,i[7]=h,i[8]=_,i[9]=x}else o=i[1],c=i[2],l=i[3],u=i[4],d=i[5],f=i[6],h=i[7],_=i[8],x=i[9];let C=_===void 0?`multiple`:_,w=x!=null,T;i[10]===d?T=i[11]:(T=()=>y(d),i[10]=d,i[11]=T);let[E,D]=m(T),O;i[12]!==E||i[13]!==w||i[14]!==x?(O=w?y(x):E,i[12]=E,i[13]=w,i[14]=x,i[15]=O):O=i[15];let k=O,A=p(t),j;i[16]===t?j=i[17]:(j=()=>{A.current=t},i[16]=t,i[17]=j),e(j);let M;i[18]!==w||i[19]!==k||i[20]!==C?(M=e=>{let{itemValue:t,open:n}=e,r=v({openValues:k,value:t,open:n,type:C});r!==k&&(w||D(r),b(A.current,r))},i[18]=w,i[19]=k,i[20]=C,i[21]=M):M=i[21];let N=M,P;i[22]!==k||i[23]!==N||i[24]!==C?(P={type:C,openValues:k,setItemOpen:N},i[22]=k,i[23]=N,i[24]=C,i[25]=P):P=i[25];let F=P,I;i[26]===u?I=i[27]:(I=r(u,`accordion`),i[26]=u,i[27]=I);let L;i[28]===l?L=i[29]:(L=n(`w-full divide-y divide-separator`,l),i[28]=l,i[29]=L);let R;i[30]!==f||i[31]!==I||i[32]!==L?(R={...f,"data-slot":I,className:L},i[30]=f,i[31]=I,i[32]=L,i[33]=R):R=i[33];let z=R,B;i[34]!==o||i[35]!==c||i[36]!==z||i[37]!==h?(B=g(o?a:`div`,{ref:h,...z,children:c}),i[34]=o,i[35]=c,i[36]=z,i[37]=h,i[38]=B):B=i[38];let V;return i[39]!==F||i[40]!==B?(V=/* @__PURE__ */ g(S.Provider,{value:F,children:B}),i[39]=F,i[40]=B,i[41]=V):V=i[41],V},D=e=>{let t=s(27),n,i,a,o,c;t[0]===e?(n=t[1],i=t[2],a=t[3],o=t[4],c=t[5]):({"data-slot":i,children:n,value:c,ref:o,...a}=e,t[0]=e,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=c);let{openValues:l,setItemOpen:u}=C(`Accordion.Item`),d;t[6]!==l||t[7]!==c?(d=_(l,c),t[6]=l,t[7]=c,t[8]=d):d=t[8];let p=d,m=f(),h;t[9]!==u||t[10]!==c?(h=e=>{u({itemValue:c,open:e})},t[9]=u,t[10]=c,t[11]=h):h=t[11];let v=h,y;t[12]!==m||t[13]!==p||t[14]!==v?(y={open:p,setOpen:v,contentId:m},t[12]=m,t[13]=p,t[14]=v,t[15]=y):y=t[15];let b=y,x;t[16]===i?x=t[17]:(x=r(i,`accordion-item`),t[16]=i,t[17]=x);let S=p?`open`:`closed`,T;t[18]!==n||t[19]!==a||t[20]!==o||t[21]!==x||t[22]!==S?(T=/* @__PURE__ */ g(`div`,{ref:o,...a,role:`group`,"data-slot":x,"data-state":S,children:n}),t[18]=n,t[19]=a,t[20]=o,t[21]=x,t[22]=S,t[23]=T):T=t[23];let E;return t[24]!==b||t[25]!==T?(E=/* @__PURE__ */ g(w.Provider,{value:b,children:T}),t[24]=b,t[25]=T,t[26]=E):E=t[26],E},O=e=>{let t=s(25),i,a,o,c,l,u;t[0]===e?(i=t[1],a=t[2],o=t[3],c=t[4],l=t[5],u=t[6]):({"data-slot":o,className:a,children:i,onClick:c,ref:u,...l}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=o,t[4]=c,t[5]=l,t[6]=u);let{open:d,setOpen:f,contentId:p}=T(`Accordion.Trigger`),m;t[7]===o?m=t[8]:(m=r(o,`accordion-trigger`),t[7]=o,t[8]=m);let h=d?`open`:`closed`,_;t[9]===a?_=t[10]:(_=n(`group flex w-full cursor-pointer items-center justify-between gap-4 py-4 text-left font-medium outline-none`,`-mx-2 rounded-md px-2`,`focus:outline-hidden focus-visible:ring-4 focus-visible:ring-focus-accent`,a),t[9]=a,t[10]=_);let v;t[11]!==c||t[12]!==d||t[13]!==f?(v=e=>{c?.(e),f(!d)},t[11]=c,t[12]=d,t[13]=f,t[14]=v):v=t[14];let y;return t[15]!==i||t[16]!==p||t[17]!==d||t[18]!==l||t[19]!==u||t[20]!==m||t[21]!==h||t[22]!==_||t[23]!==v?(y=/* @__PURE__ */ g(`button`,{ref:u,type:`button`,...l,"data-slot":m,"data-state":h,"aria-expanded":d,"aria-controls":p,className:_,onClick:v,children:i}),t[15]=i,t[16]=p,t[17]=d,t[18]=l,t[19]=u,t[20]=m,t[21]=h,t[22]=_,t[23]=v,t[24]=y):y=t[24],y},k=/* @__PURE__ */ g(c,{weight:`bold`}),A={Root:E,Item:D,Trigger:O,TriggerIcon:e=>{let t=s(14),a,o,c,l;t[0]===e?(a=t[1],o=t[2],c=t[3],l=t[4]):({"data-slot":o,className:a,svg:l,...c}=e,t[0]=e,t[1]=a,t[2]=o,t[3]=c,t[4]=l);let u=l===void 0?k:l,d;t[5]===o?d=t[6]:(d=r(o,`accordion-trigger-icon`),t[5]=o,t[6]=d);let f;t[7]===a?f=t[8]:(f=n(`h-lh w-4 shrink-0 self-start text-muted transition-transform duration-200 ease-out-strong group-data-state-open:rotate-180 motion-reduce:transition-none`,a),t[7]=a,t[8]=f);let p;return t[9]!==c||t[10]!==u||t[11]!==d||t[12]!==f?(p=/* @__PURE__ */ g(i,{...c,"data-slot":d,svg:u,className:f}),t[9]=c,t[10]=u,t[11]=d,t[12]=f,t[13]=p):p=t[13],p},Content:i=>{let a=s(25),o,c,l,u,f;a[0]===i?(o=a[1],c=a[2],l=a[3],u=a[4],f=a[5]):({"data-slot":l,className:c,children:o,ref:f,...u}=i,a[0]=i,a[1]=o,a[2]=c,a[3]=l,a[4]=u,a[5]=f);let{open:m,setOpen:h,contentId:_}=T(`Accordion.Content`),v=p(null),y=t(v,f),b,S;a[6]===h?(b=a[7],S=a[8]):(b=()=>{let e=v.current;if(!e||!x())return;let t=()=>{let{transitionProperty:t}=e.style;e.removeAttribute(`hidden`),e.style.transitionProperty=`none`,e.style.height=`auto`,e.style.opacity=`1`,e.getBoundingClientRect(),e.style.transitionProperty=t,h(!0)};return e.addEventListener(`beforematch`,t),()=>{e.removeEventListener(`beforematch`,t)}},S=[h],a[6]=h,a[7]=b,a[8]=S),d(b,S);let C,w;a[9]===m?(C=a[10],w=a[11]):(C=()=>{let e=v.current;e&&x()&&(e.removeAttribute(`inert`),m?e.removeAttribute(`hidden`):(e.setAttribute(`hidden`,`until-found`),e.style.height=``,e.style.opacity=``))},w=[m],a[9]=m,a[10]=C,a[11]=w),e(C,w);let E=!m,D;a[12]===l?D=a[13]:(D=r(l,`accordion-content`),a[12]=l,a[13]=D);let O=m?`open`:`closed`,k;a[14]===c?k=a[15]:(k=n(`h-0 overflow-hidden opacity-0 transition-[height,opacity,content-visibility] duration-200 ease-out-strong [interpolate-size:allow-keywords] transition-discrete data-state-open:h-auto data-state-open:opacity-100 motion-reduce:transition-none`,c),a[14]=c,a[15]=k);let A;return a[16]!==o||a[17]!==y||a[18]!==_||a[19]!==u||a[20]!==E||a[21]!==D||a[22]!==O||a[23]!==k?(A=/* @__PURE__ */ g(`div`,{ref:y,...u,id:_,inert:E,"data-slot":D,"data-state":O,className:k,children:o}),a[16]=o,a[17]=y,a[18]=_,a[19]=u,a[20]=E,a[21]=D,a[22]=O,a[23]=k,a[24]=A):A=a[24],A},Body:e=>{let t=s(14),i,a,o,c;t[0]===e?(i=t[1],a=t[2],o=t[3],c=t[4]):({"data-slot":a,className:i,ref:c,...o}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=o,t[4]=c);let l;t[5]===a?l=t[6]:(l=r(a,`accordion-body`),t[5]=a,t[6]=l);let u;t[7]===i?u=t[8]:(u=n(`pt-1 pb-4`,i),t[7]=i,t[8]=u);let d;return t[9]!==o||t[10]!==c||t[11]!==l||t[12]!==u?(d=/* @__PURE__ */ g(`div`,{ref:c,...o,"data-slot":l,className:u}),t[9]=o,t[10]=c,t[11]=l,t[12]=u,t[13]=d):d=t[13],d}};export{A as Accordion};