@42-central/ui-react 0.17.1 → 0.18.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 (311) hide show
  1. package/dist/{chunk-FD6P6PLQ.js → chunk-5JHDSVEZ.js} +3 -3
  2. package/dist/{chunk-FD6P6PLQ.js.map → chunk-5JHDSVEZ.js.map} +1 -1
  3. package/dist/{chunk-QMW7D5GU.js → chunk-5OQLFX47.js} +4 -3
  4. package/dist/chunk-5OQLFX47.js.map +1 -0
  5. package/dist/{chunk-VZ2TPU4B.js → chunk-6GDMSENK.js} +3 -2
  6. package/dist/chunk-6GDMSENK.js.map +1 -0
  7. package/dist/{chunk-TNNH3FVQ.js → chunk-6OLTJYSX.js} +24 -8
  8. package/dist/chunk-6OLTJYSX.js.map +1 -0
  9. package/dist/{chunk-POKDSVQT.js → chunk-AE7QTLJ5.js} +5 -4
  10. package/dist/chunk-AE7QTLJ5.js.map +1 -0
  11. package/dist/{chunk-44OV3PNH.js → chunk-B2YJKRNQ.js} +3 -3
  12. package/dist/{chunk-44OV3PNH.js.map → chunk-B2YJKRNQ.js.map} +1 -1
  13. package/dist/{chunk-YIQI2CF3.js → chunk-CTSO6V72.js} +3 -2
  14. package/dist/chunk-CTSO6V72.js.map +1 -0
  15. package/dist/{chunk-EVVMHTCL.js → chunk-EBREIC3L.js} +4 -3
  16. package/dist/chunk-EBREIC3L.js.map +1 -0
  17. package/dist/{chunk-UNSAA7YG.js → chunk-FHG54IT5.js} +3 -2
  18. package/dist/chunk-FHG54IT5.js.map +1 -0
  19. package/dist/{chunk-3GYOIQW7.js → chunk-FZIHZT5R.js} +5 -5
  20. package/dist/{chunk-3GYOIQW7.js.map → chunk-FZIHZT5R.js.map} +1 -1
  21. package/dist/{chunk-2H46IXW4.js → chunk-HAQJQFE6.js} +28 -8
  22. package/dist/chunk-HAQJQFE6.js.map +1 -0
  23. package/dist/{chunk-IHYFYMHJ.js → chunk-HT5JAHR3.js} +6 -6
  24. package/dist/{chunk-IHYFYMHJ.js.map → chunk-HT5JAHR3.js.map} +1 -1
  25. package/dist/chunk-I4SQQIP5.js +12 -0
  26. package/dist/chunk-I4SQQIP5.js.map +1 -0
  27. package/dist/{chunk-J3PELDH3.js → chunk-JITF6I7N.js} +22 -6
  28. package/dist/chunk-JITF6I7N.js.map +1 -0
  29. package/dist/{chunk-IFWCCAQV.js → chunk-KHMFNH3X.js} +3 -2
  30. package/dist/chunk-KHMFNH3X.js.map +1 -0
  31. package/dist/{chunk-SIG4DMNZ.js → chunk-MI2WZRK3.js} +4 -4
  32. package/dist/{chunk-SIG4DMNZ.js.map → chunk-MI2WZRK3.js.map} +1 -1
  33. package/dist/{chunk-YON5Y336.js → chunk-O23Y5ML4.js} +8 -8
  34. package/dist/{chunk-YON5Y336.js.map → chunk-O23Y5ML4.js.map} +1 -1
  35. package/dist/{chunk-P7A3BCAC.js → chunk-OWG4BCQR.js} +3 -3
  36. package/dist/{chunk-P7A3BCAC.js.map → chunk-OWG4BCQR.js.map} +1 -1
  37. package/dist/{chunk-FUWSTUDM.js → chunk-PH354ECN.js} +4 -4
  38. package/dist/{chunk-FUWSTUDM.js.map → chunk-PH354ECN.js.map} +1 -1
  39. package/dist/{chunk-U5GW5EBR.js → chunk-RAUOFTUH.js} +12 -20
  40. package/dist/chunk-RAUOFTUH.js.map +1 -0
  41. package/dist/{chunk-2762HZYX.js → chunk-S2HWWR2H.js} +47 -25
  42. package/dist/chunk-S2HWWR2H.js.map +1 -0
  43. package/dist/{chunk-VLUKI3HL.js → chunk-S7N4LGLZ.js} +6 -13
  44. package/dist/chunk-S7N4LGLZ.js.map +1 -0
  45. package/dist/{chunk-NSOA3GMZ.js → chunk-UHNRAI6V.js} +3 -3
  46. package/dist/{chunk-NSOA3GMZ.js.map → chunk-UHNRAI6V.js.map} +1 -1
  47. package/dist/{chunk-3NZXWCGF.js → chunk-WHKKN3ZK.js} +6 -6
  48. package/dist/{chunk-3NZXWCGF.js.map → chunk-WHKKN3ZK.js.map} +1 -1
  49. package/dist/{chunk-MOI7B3KH.js → chunk-WQN64ZHG.js} +5 -5
  50. package/dist/{chunk-MOI7B3KH.js.map → chunk-WQN64ZHG.js.map} +1 -1
  51. package/dist/chunk-WSIVRDRB.js +34 -0
  52. package/dist/chunk-WSIVRDRB.js.map +1 -0
  53. package/dist/{chunk-6SWK4XG5.js → chunk-YXE4B6X3.js} +2 -2
  54. package/dist/chunk-YXE4B6X3.js.map +1 -0
  55. package/dist/{chunk-NGAQITWP.js → chunk-Z2Z5EXVT.js} +10 -7
  56. package/dist/chunk-Z2Z5EXVT.js.map +1 -0
  57. package/dist/{chunk-IXKELBJA.js → chunk-ZDXQ64A7.js} +63 -44
  58. package/dist/chunk-ZDXQ64A7.js.map +1 -0
  59. package/dist/components/accordion/accordion-data.d.ts +3 -2
  60. package/dist/components/accordion/accordion-data.d.ts.map +1 -1
  61. package/dist/components/accordion/accordion.d.ts +2 -2
  62. package/dist/components/accordion/accordion.d.ts.map +1 -1
  63. package/dist/components/accordion/index.js +20 -8
  64. package/dist/components/accordion/index.js.map +1 -1
  65. package/dist/components/action-icon/action-icon.d.ts +3 -4
  66. package/dist/components/action-icon/action-icon.d.ts.map +1 -1
  67. package/dist/components/action-icon/index.js +2 -1
  68. package/dist/components/alert/alert.d.ts +1 -1
  69. package/dist/components/alert/alert.d.ts.map +1 -1
  70. package/dist/components/alert/index.js +16 -4
  71. package/dist/components/alert/index.js.map +1 -1
  72. package/dist/components/app-shell/app-shell.d.ts +3 -2
  73. package/dist/components/app-shell/app-shell.d.ts.map +1 -1
  74. package/dist/components/app-shell/index.js +4 -2
  75. package/dist/components/app-shell/index.js.map +1 -1
  76. package/dist/components/autocomplete/index.js +5 -4
  77. package/dist/components/autocomplete/index.js.map +1 -1
  78. package/dist/components/breadcrumb/breadcrumb.d.ts +3 -2
  79. package/dist/components/breadcrumb/breadcrumb.d.ts.map +1 -1
  80. package/dist/components/breadcrumb/index.js +11 -5
  81. package/dist/components/breadcrumb/index.js.map +1 -1
  82. package/dist/components/button/button.d.ts +4 -4
  83. package/dist/components/button/button.d.ts.map +1 -1
  84. package/dist/components/button/index.js +2 -1
  85. package/dist/components/button-multi-select/index.js +4 -3
  86. package/dist/components/button-multi-select/index.js.map +1 -1
  87. package/dist/components/button-select/index.js +4 -3
  88. package/dist/components/button-select/index.js.map +1 -1
  89. package/dist/components/calendar/index.js +3 -2
  90. package/dist/components/checkbox/index.js +2 -2
  91. package/dist/components/choice-card-group/index.js +1 -1
  92. package/dist/components/circular-progress/circular-progress.d.ts +3 -2
  93. package/dist/components/circular-progress/circular-progress.d.ts.map +1 -1
  94. package/dist/components/circular-progress/index.js +1 -0
  95. package/dist/components/circular-progress/index.js.map +1 -1
  96. package/dist/components/clipboard/clipboard.d.ts +1 -1
  97. package/dist/components/clipboard/clipboard.d.ts.map +1 -1
  98. package/dist/components/clipboard/index.js +9 -5
  99. package/dist/components/clipboard/index.js.map +1 -1
  100. package/dist/components/code-block/chrome.d.ts +4 -1
  101. package/dist/components/code-block/chrome.d.ts.map +1 -1
  102. package/dist/components/code-block/chrome.js +5 -4
  103. package/dist/components/code-block/code-block.d.ts +7 -1
  104. package/dist/components/code-block/code-block.d.ts.map +1 -1
  105. package/dist/components/code-block/index.d.ts +1 -1
  106. package/dist/components/code-block/index.js +12 -10
  107. package/dist/components/code-block/index.js.map +1 -1
  108. package/dist/components/code-block/notation.d.ts +5 -2
  109. package/dist/components/code-block/notation.d.ts.map +1 -1
  110. package/dist/components/code-block/static.d.ts +4 -1
  111. package/dist/components/code-block/static.d.ts.map +1 -1
  112. package/dist/components/code-block/static.js +5 -4
  113. package/dist/components/code-block/static.js.map +1 -1
  114. package/dist/components/collapse/collapse.d.ts +7 -3
  115. package/dist/components/collapse/collapse.d.ts.map +1 -1
  116. package/dist/components/collapse/index.js +2 -1
  117. package/dist/components/combobox/combobox.d.ts +11 -10
  118. package/dist/components/combobox/combobox.d.ts.map +1 -1
  119. package/dist/components/combobox/index.js +5 -4
  120. package/dist/components/combobox-list/index.js +6 -5
  121. package/dist/components/data-table/index.js +20 -19
  122. package/dist/components/data-table/index.js.map +1 -1
  123. package/dist/components/date-picker/index.js +12 -11
  124. package/dist/components/date-picker/index.js.map +1 -1
  125. package/dist/components/divider/divider.d.ts +3 -2
  126. package/dist/components/divider/divider.d.ts.map +1 -1
  127. package/dist/components/divider/index.js +1 -1
  128. package/dist/components/drawer/drawer.d.ts +6 -5
  129. package/dist/components/drawer/drawer.d.ts.map +1 -1
  130. package/dist/components/drawer/index.js +3 -2
  131. package/dist/components/field/field.d.ts +7 -4
  132. package/dist/components/field/field.d.ts.map +1 -1
  133. package/dist/components/field/index.js +1 -1
  134. package/dist/components/file-upload/index.js +3 -2
  135. package/dist/components/file-upload/index.js.map +1 -1
  136. package/dist/components/hover-card/index.js +1 -1
  137. package/dist/components/input/index.js +2 -2
  138. package/dist/components/input/input.d.ts +3 -2
  139. package/dist/components/input/input.d.ts.map +1 -1
  140. package/dist/components/menu/index.js +3 -2
  141. package/dist/components/menu/index.js.map +1 -1
  142. package/dist/components/menu/menu-data.d.ts +6 -1
  143. package/dist/components/menu/menu-data.d.ts.map +1 -1
  144. package/dist/components/menu/menu.d.ts +5 -5
  145. package/dist/components/menu/menu.d.ts.map +1 -1
  146. package/dist/components/modal/index.js +3 -2
  147. package/dist/components/modal/modal.d.ts +4 -3
  148. package/dist/components/modal/modal.d.ts.map +1 -1
  149. package/dist/components/multi-combobox-list/index.js +6 -5
  150. package/dist/components/multi-select/index.js +7 -6
  151. package/dist/components/multi-select/index.js.map +1 -1
  152. package/dist/components/nav-link/index.js +3 -2
  153. package/dist/components/nav-link/tanstack.js +3 -2
  154. package/dist/components/nav-link/tanstack.js.map +1 -1
  155. package/dist/components/notification/index.js +4 -3
  156. package/dist/components/notification/index.js.map +1 -1
  157. package/dist/components/notification/notification.d.ts +3 -2
  158. package/dist/components/notification/notification.d.ts.map +1 -1
  159. package/dist/components/number-input/index.js +4 -4
  160. package/dist/components/overlays/index.js +5 -4
  161. package/dist/components/overlays/index.js.map +1 -1
  162. package/dist/components/password-input/index.js +2 -2
  163. package/dist/components/pill/index.js +2 -1
  164. package/dist/components/pill/pill.d.ts +4 -2
  165. package/dist/components/pill/pill.d.ts.map +1 -1
  166. package/dist/components/pills-input/index.js +5 -4
  167. package/dist/components/pills-input/pills-input.d.ts +3 -2
  168. package/dist/components/pills-input/pills-input.d.ts.map +1 -1
  169. package/dist/components/pin-input/index.js +2 -2
  170. package/dist/components/popover/index.js +1 -1
  171. package/dist/components/popover/popover.d.ts +3 -2
  172. package/dist/components/popover/popover.d.ts.map +1 -1
  173. package/dist/components/progress/index.js +1 -0
  174. package/dist/components/progress/index.js.map +1 -1
  175. package/dist/components/progress/progress.d.ts +3 -2
  176. package/dist/components/progress/progress.d.ts.map +1 -1
  177. package/dist/components/radio-group/index.js +1 -1
  178. package/dist/components/rating/index.js +2 -1
  179. package/dist/components/rating/index.js.map +1 -1
  180. package/dist/components/rating/rating.d.ts +3 -2
  181. package/dist/components/rating/rating.d.ts.map +1 -1
  182. package/dist/components/schedule/index.d.ts +2 -2
  183. package/dist/components/schedule/index.js +50 -23
  184. package/dist/components/schedule/index.js.map +1 -1
  185. package/dist/components/schedule/schedule-agenda-list.d.ts +6 -7
  186. package/dist/components/schedule/schedule-agenda-list.d.ts.map +1 -1
  187. package/dist/components/schedule/schedule-agenda-view.d.ts +19 -16
  188. package/dist/components/schedule/schedule-agenda-view.d.ts.map +1 -1
  189. package/dist/components/schedule/schedule-dates.d.ts.map +1 -1
  190. package/dist/components/schedule/schedule-days-view.d.ts +3 -2
  191. package/dist/components/schedule/schedule-days-view.d.ts.map +1 -1
  192. package/dist/components/schedule/schedule-month-view.d.ts +3 -2
  193. package/dist/components/schedule/schedule-month-view.d.ts.map +1 -1
  194. package/dist/components/schedule/schedule-next-up.d.ts +4 -3
  195. package/dist/components/schedule/schedule-next-up.d.ts.map +1 -1
  196. package/dist/components/schedule/schedule-toolbar.d.ts +1 -1
  197. package/dist/components/schedule/schedule-toolbar.d.ts.map +1 -1
  198. package/dist/components/schedule/schedule-types.d.ts +5 -3
  199. package/dist/components/schedule/schedule-types.d.ts.map +1 -1
  200. package/dist/components/schedule/schedule-views.d.ts +2 -2
  201. package/dist/components/schedule/schedule-views.d.ts.map +1 -1
  202. package/dist/components/schedule/schedule-year-view.d.ts +3 -2
  203. package/dist/components/schedule/schedule-year-view.d.ts.map +1 -1
  204. package/dist/components/schedule/schedule.d.ts +9 -6
  205. package/dist/components/schedule/schedule.d.ts.map +1 -1
  206. package/dist/components/segment-group/index.js +2 -2
  207. package/dist/components/select/index.js +4 -4
  208. package/dist/components/slider/index.js +2 -1
  209. package/dist/components/slider/index.js.map +1 -1
  210. package/dist/components/slider/slider.d.ts +3 -2
  211. package/dist/components/slider/slider.d.ts.map +1 -1
  212. package/dist/components/switch/index.js +1 -1
  213. package/dist/components/tabs/index.js +1 -1
  214. package/dist/components/tabs/tabs-data.d.ts +3 -2
  215. package/dist/components/tabs/tabs-data.d.ts.map +1 -1
  216. package/dist/components/tags-input/index.js +6 -5
  217. package/dist/components/tags-input/index.js.map +1 -1
  218. package/dist/components/text-input/index.js +2 -2
  219. package/dist/components/textarea/index.js +2 -2
  220. package/dist/components/time-input/index.js +6 -6
  221. package/dist/components/timeline/index.js +8 -5
  222. package/dist/components/timeline/index.js.map +1 -1
  223. package/dist/components/timeline/timeline.d.ts +1 -1
  224. package/dist/components/timeline/timeline.d.ts.map +1 -1
  225. package/dist/components/tooltip/index.js +1 -1
  226. package/dist/components/tooltip/tooltip.d.ts +2 -1
  227. package/dist/components/tooltip/tooltip.d.ts.map +1 -1
  228. package/dist/components/tree-multi-select/index.js +6 -5
  229. package/dist/components/tree-multi-select/index.js.map +1 -1
  230. package/dist/components/tree-select/index.js +3 -3
  231. package/dist/lib/as-child.d.ts +104 -0
  232. package/dist/lib/as-child.d.ts.map +1 -0
  233. package/package.json +1 -1
  234. package/src/as-child.contract.test.tsx +809 -0
  235. package/src/components/accordion/accordion-data.tsx +8 -5
  236. package/src/components/accordion/accordion.test.tsx +40 -0
  237. package/src/components/accordion/accordion.tsx +23 -6
  238. package/src/components/action-icon/action-icon.tsx +9 -24
  239. package/src/components/alert/alert.test.tsx +17 -0
  240. package/src/components/alert/alert.tsx +21 -2
  241. package/src/components/app-shell/app-shell.tsx +3 -1
  242. package/src/components/breadcrumb/breadcrumb.test.tsx +30 -0
  243. package/src/components/breadcrumb/breadcrumb.tsx +21 -12
  244. package/src/components/button/button.tsx +21 -50
  245. package/src/components/circular-progress/circular-progress.tsx +4 -1
  246. package/src/components/clipboard/clipboard.test.tsx +18 -0
  247. package/src/components/clipboard/clipboard.tsx +8 -2
  248. package/src/components/code-block/chrome.tsx +60 -36
  249. package/src/components/code-block/code-block.test.tsx +27 -0
  250. package/src/components/code-block/code-block.tsx +13 -3
  251. package/src/components/code-block/notation.test.ts +8 -0
  252. package/src/components/code-block/notation.ts +6 -3
  253. package/src/components/code-block/static.tsx +8 -2
  254. package/src/components/collapse/collapse.tsx +33 -15
  255. package/src/components/combobox/combobox.test.tsx +38 -0
  256. package/src/components/combobox/combobox.tsx +24 -10
  257. package/src/components/divider/divider.tsx +3 -1
  258. package/src/components/drawer/drawer.tsx +37 -16
  259. package/src/components/field/field.tsx +7 -3
  260. package/src/components/input/input.tsx +3 -1
  261. package/src/components/menu/menu-data.tsx +8 -1
  262. package/src/components/menu/menu.test.tsx +52 -0
  263. package/src/components/menu/menu.tsx +83 -35
  264. package/src/components/modal/close-trigger.test.tsx +38 -0
  265. package/src/components/modal/modal.tsx +29 -13
  266. package/src/components/notification/notification.tsx +4 -1
  267. package/src/components/pill/pill.tsx +29 -20
  268. package/src/components/pills-input/pills-input.tsx +3 -1
  269. package/src/components/popover/popover.tsx +3 -1
  270. package/src/components/progress/progress.tsx +4 -1
  271. package/src/components/rating/rating.tsx +27 -23
  272. package/src/components/schedule/index.ts +1 -1
  273. package/src/components/schedule/schedule-agenda-list.tsx +6 -7
  274. package/src/components/schedule/schedule-agenda-view.test.tsx +105 -28
  275. package/src/components/schedule/schedule-agenda-view.tsx +41 -28
  276. package/src/components/schedule/schedule-dates.test.ts +37 -52
  277. package/src/components/schedule/schedule-dates.ts +22 -25
  278. package/src/components/schedule/schedule-days-view.tsx +3 -1
  279. package/src/components/schedule/schedule-month-view.tsx +3 -1
  280. package/src/components/schedule/schedule-next-up.tsx +6 -2
  281. package/src/components/schedule/schedule-toolbar.test.tsx +26 -0
  282. package/src/components/schedule/schedule-toolbar.tsx +13 -1
  283. package/src/components/schedule/schedule-types.ts +5 -3
  284. package/src/components/schedule/schedule-views.ts +4 -5
  285. package/src/components/schedule/schedule-year-view.tsx +3 -1
  286. package/src/components/schedule/schedule.test.tsx +66 -22
  287. package/src/components/schedule/schedule.tsx +22 -13
  288. package/src/components/slider/slider.tsx +4 -0
  289. package/src/components/tabs/tabs-data.tsx +17 -14
  290. package/src/components/timeline/timeline.tsx +102 -95
  291. package/src/components/tooltip/tooltip.tsx +2 -1
  292. package/src/lib/as-child.test.tsx +70 -0
  293. package/src/lib/as-child.ts +119 -0
  294. package/dist/chunk-2762HZYX.js.map +0 -1
  295. package/dist/chunk-2H46IXW4.js.map +0 -1
  296. package/dist/chunk-6SWK4XG5.js.map +0 -1
  297. package/dist/chunk-EVVMHTCL.js.map +0 -1
  298. package/dist/chunk-HWNPXAEN.js +0 -31
  299. package/dist/chunk-HWNPXAEN.js.map +0 -1
  300. package/dist/chunk-IFWCCAQV.js.map +0 -1
  301. package/dist/chunk-IXKELBJA.js.map +0 -1
  302. package/dist/chunk-J3PELDH3.js.map +0 -1
  303. package/dist/chunk-NGAQITWP.js.map +0 -1
  304. package/dist/chunk-POKDSVQT.js.map +0 -1
  305. package/dist/chunk-QMW7D5GU.js.map +0 -1
  306. package/dist/chunk-TNNH3FVQ.js.map +0 -1
  307. package/dist/chunk-U5GW5EBR.js.map +0 -1
  308. package/dist/chunk-UNSAA7YG.js.map +0 -1
  309. package/dist/chunk-VLUKI3HL.js.map +0 -1
  310. package/dist/chunk-VZ2TPU4B.js.map +0 -1
  311. package/dist/chunk-YIQI2CF3.js.map +0 -1
@@ -0,0 +1,809 @@
1
+ import { readdirSync } from "node:fs"
2
+ import { join } from "node:path"
3
+ import { render } from "@testing-library/react"
4
+ import type { JSX, ReactElement } from "react"
5
+ import { describe, expect, it } from "vitest"
6
+ import * as accordion from "./components/accordion"
7
+ import * as actionIcon from "./components/action-icon"
8
+ import * as alert from "./components/alert"
9
+ import * as ambientBackground from "./components/ambient-background"
10
+ import * as appShell from "./components/app-shell"
11
+ import * as autocomplete from "./components/autocomplete"
12
+ import * as avatar from "./components/avatar"
13
+ import * as badge from "./components/badge"
14
+ import * as breadcrumb from "./components/breadcrumb"
15
+ import * as button from "./components/button"
16
+ import * as buttonGroup from "./components/button-group"
17
+ import * as buttonMultiSelect from "./components/button-multi-select"
18
+ import * as buttonSelect from "./components/button-select"
19
+ import * as calendar from "./components/calendar"
20
+ import * as card from "./components/card"
21
+ import * as chart from "./components/chart"
22
+ import * as checkbox from "./components/checkbox"
23
+ import * as choiceCardGroup from "./components/choice-card-group"
24
+ import * as circularProgress from "./components/circular-progress"
25
+ import * as clipboard from "./components/clipboard"
26
+ import * as code from "./components/code"
27
+ import * as codeBlock from "./components/code-block"
28
+ import * as collapse from "./components/collapse"
29
+ import * as combobox from "./components/combobox"
30
+ import * as comboboxList from "./components/combobox-list"
31
+ import * as container from "./components/container"
32
+ import * as dataTable from "./components/data-table"
33
+ import * as datePicker from "./components/date-picker"
34
+ import * as divider from "./components/divider"
35
+ import * as drawer from "./components/drawer"
36
+ import * as field from "./components/field"
37
+ import * as fileUpload from "./components/file-upload"
38
+ import * as flex from "./components/flex"
39
+ import * as grid from "./components/grid"
40
+ import * as hoverCard from "./components/hover-card"
41
+ import * as indicator from "./components/indicator"
42
+ import * as input from "./components/input"
43
+ import * as kbd from "./components/kbd"
44
+ import * as mark from "./components/mark"
45
+ import * as menu from "./components/menu"
46
+ import * as modal from "./components/modal"
47
+ import * as multiComboboxList from "./components/multi-combobox-list"
48
+ import * as multiSelect from "./components/multi-select"
49
+ import * as navLink from "./components/nav-link"
50
+ import * as navLinkTanstack from "./components/nav-link/tanstack"
51
+ import * as notification from "./components/notification"
52
+ import * as numberInput from "./components/number-input"
53
+ import * as overlays from "./components/overlays"
54
+ import * as passwordInput from "./components/password-input"
55
+ import * as pill from "./components/pill"
56
+ import * as pillsInput from "./components/pills-input"
57
+ import * as pinInput from "./components/pin-input"
58
+ import * as popover from "./components/popover"
59
+ import * as progress from "./components/progress"
60
+ import * as radioGroup from "./components/radio-group"
61
+ import * as rating from "./components/rating"
62
+ import * as schedule from "./components/schedule"
63
+ import * as segmentGroup from "./components/segment-group"
64
+ import * as select from "./components/select"
65
+ import * as skeleton from "./components/skeleton"
66
+ import * as slider from "./components/slider"
67
+ import * as spinner from "./components/spinner"
68
+ import * as switchToggle from "./components/switch"
69
+ import * as table from "./components/table"
70
+ import * as tabs from "./components/tabs"
71
+ import * as tagsInput from "./components/tags-input"
72
+ import * as text from "./components/text"
73
+ import * as textInput from "./components/text-input"
74
+ import * as textarea from "./components/textarea"
75
+ import * as themeIcon from "./components/theme-icon"
76
+ import * as themeScript from "./components/theme-script"
77
+ import * as timeInput from "./components/time-input"
78
+ import * as timeline from "./components/timeline"
79
+ import * as title from "./components/title"
80
+ import * as tooltip from "./components/tooltip"
81
+ import * as treeMultiSelect from "./components/tree-multi-select"
82
+ import * as treeSelect from "./components/tree-select"
83
+
84
+ /**
85
+ * The `asChild` contract (see `lib/as-child.ts`): every public part that
86
+ * accepts `asChild` must render as the consumer's single child, with the
87
+ * part's props merged onto it and the child's own content intact. Ark's
88
+ * factory clones exactly one element and renders `null` otherwise, so a part
89
+ * that adds its own content beside `children` silently renders nothing.
90
+ */
91
+
92
+ const { Accordion } = accordion
93
+ const { AppShell } = appShell
94
+ const { ButtonMultiSelect } = buttonMultiSelect
95
+ const { Collapse } = collapse
96
+ const { ButtonSelect } = buttonSelect
97
+ const { Clipboard } = clipboard
98
+ const { Combobox, createListCollection } = combobox
99
+ const { DatePicker } = datePicker
100
+ const { Drawer } = drawer
101
+ const { HoverCard } = hoverCard
102
+ const { Menu } = menu
103
+ const { Modal } = modal
104
+ const { Popover } = popover
105
+ const { Tabs } = tabs
106
+ const { Tooltip } = tooltip
107
+ const { Alert } = alert
108
+ const { Breadcrumb } = breadcrumb
109
+ const { Pill } = pill
110
+ const { ScheduleToolbar } = schedule
111
+ const { Timeline } = timeline
112
+
113
+ /**
114
+ * Every public component entry, so the parts below can be derived from what
115
+ * the package actually ships. A test at the bottom checks this list against
116
+ * `src/components/` on disk, so a new entry can't be left out of it.
117
+ */
118
+ const modules = {
119
+ accordion,
120
+ actionIcon,
121
+ alert,
122
+ ambientBackground,
123
+ appShell,
124
+ autocomplete,
125
+ avatar,
126
+ badge,
127
+ breadcrumb,
128
+ button,
129
+ buttonGroup,
130
+ buttonMultiSelect,
131
+ buttonSelect,
132
+ calendar,
133
+ card,
134
+ chart,
135
+ checkbox,
136
+ choiceCardGroup,
137
+ circularProgress,
138
+ clipboard,
139
+ code,
140
+ codeBlock,
141
+ collapse,
142
+ combobox,
143
+ comboboxList,
144
+ container,
145
+ dataTable,
146
+ datePicker,
147
+ divider,
148
+ drawer,
149
+ field,
150
+ fileUpload,
151
+ flex,
152
+ grid,
153
+ hoverCard,
154
+ indicator,
155
+ input,
156
+ kbd,
157
+ mark,
158
+ menu,
159
+ modal,
160
+ multiComboboxList,
161
+ multiSelect,
162
+ navLink,
163
+ notification,
164
+ numberInput,
165
+ overlays,
166
+ passwordInput,
167
+ pill,
168
+ pillsInput,
169
+ pinInput,
170
+ popover,
171
+ progress,
172
+ radioGroup,
173
+ rating,
174
+ schedule,
175
+ segmentGroup,
176
+ select,
177
+ skeleton,
178
+ slider,
179
+ spinner,
180
+ switch: switchToggle,
181
+ table,
182
+ tabs,
183
+ tagsInput,
184
+ text,
185
+ textInput,
186
+ textarea,
187
+ themeIcon,
188
+ themeScript,
189
+ timeInput,
190
+ timeline,
191
+ title,
192
+ tooltip,
193
+ treeMultiSelect,
194
+ treeSelect,
195
+ navLinkTanstack,
196
+ }
197
+
198
+ /**
199
+ * Every public part that accepts `asChild: true`, derived from `modules`:
200
+ * each export, plus each capitalised member of a namespace export
201
+ * (`Menu.Item`). Props are read off the call signature; a part typed
202
+ * `NoAsChild` (`lib/as-child.ts`) drops out because its `asChild` no longer
203
+ * accepts `true`.
204
+ *
205
+ * Distributed over the module union (`PartsOf`) rather than mapped over
206
+ * `typeof modules`: the mapped form evaluates all 77 entries in one
207
+ * instantiation and trips tsc's depth limit.
208
+ */
209
+ type AcceptsAsChild<V> = V extends (props: infer P) => unknown
210
+ ? P extends unknown
211
+ ? "asChild" extends keyof P
212
+ ? true extends P["asChild"]
213
+ ? true
214
+ : false
215
+ : false
216
+ : never
217
+ : false
218
+ type Members<V> = { [K in keyof V & string]: K extends Capitalize<K> ? K : never }[keyof V & string]
219
+ type ExportParts<M> = {
220
+ [E in keyof M & string]:
221
+ | (true extends AcceptsAsChild<M[E]> ? E : never)
222
+ | { [K in Members<M[E]>]: true extends AcceptsAsChild<M[E][K]> ? `${E}.${K}` : never }[Members<
223
+ M[E]
224
+ >]
225
+ }[keyof M & string]
226
+ type PartsOf<M> = M extends unknown ? ExportParts<M> : never
227
+ type AsChildPart = PartsOf<(typeof modules)[keyof typeof modules]>
228
+
229
+ /**
230
+ * How one part meets `asChild`:
231
+ *
232
+ * - `"bare"`: needs no parent context, so it renders as `<Part asChild>`.
233
+ * - a function: wraps `<Part asChild>{child}</Part>` in whatever the part
234
+ * needs (its root, an open state, required props).
235
+ * - `{ alias }`: the same component under a second export name
236
+ * (`DrawerTitle` is `Drawer.Title`). Checked by identity, not re-rendered.
237
+ *
238
+ * There is no "known broken" case: a part either composes here or is typed
239
+ * `NoAsChild` / `ForbidAsChild`, which removes it from `AsChildPart`.
240
+ */
241
+ type Render = (child: JSX.Element) => ReactElement
242
+ type Case = "bare" | Render | { alias: AsChildPart }
243
+
244
+ const bare = "bare"
245
+ const alias = (of: AsChildPart) => ({ alias: of })
246
+
247
+ const collection = createListCollection({ items: ["probe"] })
248
+ const emptyCollection = createListCollection<string>({ items: [] })
249
+
250
+ /**
251
+ * The contract. Typed `Record<AsChildPart, Case>`, so a new part that
252
+ * accepts `asChild` fails the typecheck until it has a case here (or is
253
+ * typed `NoAsChild`), and an entry for a part that no longer accepts it
254
+ * fails as an excess key.
255
+ */
256
+ const contract: Record<AsChildPart, Case> = {
257
+ "Accordion.Root": bare,
258
+ "Accordion.Item": (c) => (
259
+ <Accordion.Root>
260
+ <Accordion.Item asChild value="a">
261
+ {c}
262
+ </Accordion.Item>
263
+ </Accordion.Root>
264
+ ),
265
+ "Accordion.ItemTrigger": (c) => (
266
+ <Accordion.Root>
267
+ <Accordion.Item value="a">
268
+ <Accordion.ItemTrigger asChild>{c}</Accordion.ItemTrigger>
269
+ </Accordion.Item>
270
+ </Accordion.Root>
271
+ ),
272
+ "Accordion.ItemContent": (c) => (
273
+ <Accordion.Root defaultValue={["a"]}>
274
+ <Accordion.Item value="a">
275
+ <Accordion.ItemContent asChild>{c}</Accordion.ItemContent>
276
+ </Accordion.Item>
277
+ </Accordion.Root>
278
+ ),
279
+ "Accordion.ItemIndicator": (c) => (
280
+ <Accordion.Root>
281
+ <Accordion.Item value="a">
282
+ <Accordion.ItemIndicator asChild>{c}</Accordion.ItemIndicator>
283
+ </Accordion.Item>
284
+ </Accordion.Root>
285
+ ),
286
+ ActionIcon: bare,
287
+ Alert: (c) => (
288
+ <Alert asChild title="t">
289
+ {c}
290
+ </Alert>
291
+ ),
292
+ "Alert.Root": bare,
293
+ AppShell: bare,
294
+ "AppShell.Aside": (c) => (
295
+ <AppShell>
296
+ <AppShell.Aside asChild>{c}</AppShell.Aside>
297
+ </AppShell>
298
+ ),
299
+ "AppShell.Content": bare,
300
+ "AppShell.Full": bare,
301
+ "AppShell.Header": (c) => (
302
+ <AppShell>
303
+ <AppShell.Header asChild>{c}</AppShell.Header>
304
+ </AppShell>
305
+ ),
306
+ "AppShell.Main": bare,
307
+ "AppShell.SidebarTrigger": (c) => (
308
+ <AppShell>
309
+ <AppShell.SidebarTrigger asChild>{c}</AppShell.SidebarTrigger>
310
+ </AppShell>
311
+ ),
312
+ "Avatar.Group": bare,
313
+ Badge: bare,
314
+ "Breadcrumb.Root": bare,
315
+ "Breadcrumb.Home": (c) => (
316
+ <Breadcrumb.Root>
317
+ <Breadcrumb.Home asChild>{c}</Breadcrumb.Home>
318
+ </Breadcrumb.Root>
319
+ ),
320
+ "Breadcrumb.Item": bare,
321
+ Button: bare,
322
+ ButtonGroup: bare,
323
+ "ButtonMultiSelect.Root": bare,
324
+ "ButtonMultiSelect.Item": (c) => (
325
+ <ButtonMultiSelect.Root>
326
+ <ButtonMultiSelect.Item asChild value="a">
327
+ {c}
328
+ </ButtonMultiSelect.Item>
329
+ </ButtonMultiSelect.Root>
330
+ ),
331
+ "ButtonSelect.Root": bare,
332
+ "ButtonSelect.Item": (c) => (
333
+ <ButtonSelect.Root>
334
+ <ButtonSelect.Item asChild value="a">
335
+ {c}
336
+ </ButtonSelect.Item>
337
+ </ButtonSelect.Root>
338
+ ),
339
+ Card: bare,
340
+ "Card.Content": bare,
341
+ "Card.Description": bare,
342
+ "Card.Footer": bare,
343
+ "Card.Header": bare,
344
+ "Card.Title": bare,
345
+ "Clipboard.Root": bare,
346
+ "Clipboard.Control": (c) => (
347
+ <Clipboard.Root defaultValue="x">
348
+ <Clipboard.Control asChild>{c}</Clipboard.Control>
349
+ </Clipboard.Root>
350
+ ),
351
+ "Clipboard.Indicator": (c) => (
352
+ <Clipboard.Root defaultValue="x">
353
+ <Clipboard.Indicator asChild>{c}</Clipboard.Indicator>
354
+ </Clipboard.Root>
355
+ ),
356
+ "Clipboard.Input": (c) => (
357
+ <Clipboard.Root defaultValue="x">
358
+ <Clipboard.Input asChild>{c}</Clipboard.Input>
359
+ </Clipboard.Root>
360
+ ),
361
+ "Clipboard.Label": (c) => (
362
+ <Clipboard.Root defaultValue="x">
363
+ <Clipboard.Label asChild>{c}</Clipboard.Label>
364
+ </Clipboard.Root>
365
+ ),
366
+ "Clipboard.Trigger": (c) => (
367
+ <Clipboard.Root defaultValue="x">
368
+ <Clipboard.Trigger asChild>{c}</Clipboard.Trigger>
369
+ </Clipboard.Root>
370
+ ),
371
+ "Clipboard.ValueText": (c) => (
372
+ <Clipboard.Root defaultValue="x">
373
+ {/* Ark's raw part adds no attributes of its own, so give it one to merge. */}
374
+ <Clipboard.ValueText asChild title="from the part">
375
+ {c}
376
+ </Clipboard.ValueText>
377
+ </Clipboard.Root>
378
+ ),
379
+ Code: bare,
380
+ "CodeBlock.Button": bare,
381
+ CodeBlockButton: alias("CodeBlock.Button"),
382
+ "Combobox.Root": (c) => (
383
+ <Combobox.Root asChild collection={collection}>
384
+ {c}
385
+ </Combobox.Root>
386
+ ),
387
+ "Combobox.Input": (c) => (
388
+ <Combobox.Root collection={collection}>
389
+ <Combobox.Input asChild>{c}</Combobox.Input>
390
+ </Combobox.Root>
391
+ ),
392
+ "Combobox.Empty": (c) => (
393
+ <Combobox.Root collection={emptyCollection}>
394
+ <Combobox.Empty asChild>{c}</Combobox.Empty>
395
+ </Combobox.Root>
396
+ ),
397
+ "Combobox.Trigger": (c) => (
398
+ <Combobox.Root collection={collection}>
399
+ <Combobox.Trigger asChild>{c}</Combobox.Trigger>
400
+ </Combobox.Root>
401
+ ),
402
+ "Combobox.ClearTrigger": (c) => (
403
+ <Combobox.Root collection={collection}>
404
+ <Combobox.ClearTrigger asChild>{c}</Combobox.ClearTrigger>
405
+ </Combobox.Root>
406
+ ),
407
+ Collapse: (c) => (
408
+ <Collapse asChild open>
409
+ {c}
410
+ </Collapse>
411
+ ),
412
+ Container: bare,
413
+ "DatePicker.Root": bare,
414
+ "DatePicker.Control": (c) => (
415
+ <DatePicker.Root>
416
+ <DatePicker.Control asChild>{c}</DatePicker.Control>
417
+ </DatePicker.Root>
418
+ ),
419
+ "DatePicker.Input": (c) => (
420
+ <DatePicker.Root>
421
+ <DatePicker.Input asChild>{c}</DatePicker.Input>
422
+ </DatePicker.Root>
423
+ ),
424
+ "DatePicker.Trigger": (c) => (
425
+ <DatePicker.Root>
426
+ <DatePicker.Trigger asChild>{c}</DatePicker.Trigger>
427
+ </DatePicker.Root>
428
+ ),
429
+ "DatePicker.ClearTrigger": (c) => (
430
+ <DatePicker.Root>
431
+ <DatePicker.ClearTrigger asChild>{c}</DatePicker.ClearTrigger>
432
+ </DatePicker.Root>
433
+ ),
434
+ "DatePicker.Content": (c) => (
435
+ <DatePicker.Root open>
436
+ <DatePicker.Content asChild>{c}</DatePicker.Content>
437
+ </DatePicker.Root>
438
+ ),
439
+ "Drawer.Trigger": (c) => (
440
+ <Drawer.Root>
441
+ <Drawer.Trigger asChild>{c}</Drawer.Trigger>
442
+ </Drawer.Root>
443
+ ),
444
+ "Drawer.Backdrop": (c) => (
445
+ <Drawer.Root open>
446
+ <Drawer.Backdrop asChild>{c}</Drawer.Backdrop>
447
+ </Drawer.Root>
448
+ ),
449
+ "Drawer.Title": (c) => (
450
+ <Drawer.Root open>
451
+ <Drawer.Title asChild>{c}</Drawer.Title>
452
+ </Drawer.Root>
453
+ ),
454
+ "Drawer.Description": (c) => (
455
+ <Drawer.Root open>
456
+ <Drawer.Description asChild>{c}</Drawer.Description>
457
+ </Drawer.Root>
458
+ ),
459
+ "Drawer.CloseTrigger": (c) => (
460
+ <Drawer.Root open>
461
+ <Drawer.CloseTrigger asChild>{c}</Drawer.CloseTrigger>
462
+ </Drawer.Root>
463
+ ),
464
+ DrawerBackdrop: alias("Drawer.Backdrop"),
465
+ DrawerCloseTrigger: alias("Drawer.CloseTrigger"),
466
+ DrawerDescription: alias("Drawer.Description"),
467
+ DrawerTitle: alias("Drawer.Title"),
468
+ DrawerTrigger: alias("Drawer.Trigger"),
469
+ Flex: bare,
470
+ Grid: bare,
471
+ "HoverCard.Trigger": (c) => (
472
+ <HoverCard.Root>
473
+ <HoverCard.Trigger asChild>{c}</HoverCard.Trigger>
474
+ </HoverCard.Root>
475
+ ),
476
+ "HoverCard.Content": (c) => (
477
+ <HoverCard.Root open>
478
+ <HoverCard.Content asChild>{c}</HoverCard.Content>
479
+ </HoverCard.Root>
480
+ ),
481
+ Input: bare,
482
+ Kbd: bare,
483
+ "Menu.Trigger": (c) => (
484
+ <Menu.Root>
485
+ <Menu.Trigger asChild>{c}</Menu.Trigger>
486
+ </Menu.Root>
487
+ ),
488
+ "Menu.ContextTrigger": (c) => (
489
+ <Menu.Root>
490
+ <Menu.ContextTrigger asChild>{c}</Menu.ContextTrigger>
491
+ </Menu.Root>
492
+ ),
493
+ "Menu.Content": (c) => (
494
+ <Menu.Root open>
495
+ <Menu.Content asChild>{c}</Menu.Content>
496
+ </Menu.Root>
497
+ ),
498
+ "Menu.Item": (c) => (
499
+ <Menu.Root open>
500
+ <Menu.Content>
501
+ <Menu.Item asChild>{c}</Menu.Item>
502
+ </Menu.Content>
503
+ </Menu.Root>
504
+ ),
505
+ "Menu.CheckboxItem": (c) => (
506
+ <Menu.Root open>
507
+ <Menu.Content>
508
+ <Menu.CheckboxItem asChild value="a" checked={false}>
509
+ {c}
510
+ </Menu.CheckboxItem>
511
+ </Menu.Content>
512
+ </Menu.Root>
513
+ ),
514
+ "Menu.RadioItem": (c) => (
515
+ <Menu.Root open>
516
+ <Menu.Content>
517
+ <Menu.RadioGroup>
518
+ <Menu.RadioItem asChild value="a">
519
+ {c}
520
+ </Menu.RadioItem>
521
+ </Menu.RadioGroup>
522
+ </Menu.Content>
523
+ </Menu.Root>
524
+ ),
525
+ "Menu.SubTrigger": (c) => (
526
+ <Menu.Root open>
527
+ <Menu.Content>
528
+ <Menu.Sub>
529
+ <Menu.SubTrigger asChild>{c}</Menu.SubTrigger>
530
+ </Menu.Sub>
531
+ </Menu.Content>
532
+ </Menu.Root>
533
+ ),
534
+ "Menu.ItemGroupLabel": (c) => (
535
+ <Menu.Root open>
536
+ <Menu.Content>
537
+ <Menu.ItemGroup>
538
+ <Menu.ItemGroupLabel asChild>{c}</Menu.ItemGroupLabel>
539
+ </Menu.ItemGroup>
540
+ </Menu.Content>
541
+ </Menu.Root>
542
+ ),
543
+ "Menu.ItemGroup": (c) => (
544
+ <Menu.Root open>
545
+ <Menu.Content>
546
+ <Menu.ItemGroup asChild>{c}</Menu.ItemGroup>
547
+ </Menu.Content>
548
+ </Menu.Root>
549
+ ),
550
+ "Menu.RadioGroup": (c) => (
551
+ <Menu.Root open>
552
+ <Menu.Content>
553
+ <Menu.RadioGroup asChild>{c}</Menu.RadioGroup>
554
+ </Menu.Content>
555
+ </Menu.Root>
556
+ ),
557
+ "Menu.Divider": (c) => (
558
+ <Menu.Root open>
559
+ <Menu.Content>
560
+ <Menu.Divider asChild>{c}</Menu.Divider>
561
+ </Menu.Content>
562
+ </Menu.Root>
563
+ ),
564
+ "Menu.Separator": (c) => (
565
+ <Menu.Root open>
566
+ <Menu.Content>
567
+ <Menu.Separator asChild>{c}</Menu.Separator>
568
+ </Menu.Content>
569
+ </Menu.Root>
570
+ ),
571
+ "Menu.SubContent": (c) => (
572
+ <Menu.Root open>
573
+ <Menu.Content>
574
+ <Menu.Sub open>
575
+ <Menu.SubContent asChild>{c}</Menu.SubContent>
576
+ </Menu.Sub>
577
+ </Menu.Content>
578
+ </Menu.Root>
579
+ ),
580
+ "Modal.Trigger": (c) => (
581
+ <Modal.Root>
582
+ <Modal.Trigger asChild>{c}</Modal.Trigger>
583
+ </Modal.Root>
584
+ ),
585
+ "Modal.Backdrop": (c) => (
586
+ <Modal.Root open>
587
+ <Modal.Backdrop asChild>{c}</Modal.Backdrop>
588
+ </Modal.Root>
589
+ ),
590
+ "Modal.Content": (c) => (
591
+ <Modal.Root open>
592
+ <Modal.Content asChild>{c}</Modal.Content>
593
+ </Modal.Root>
594
+ ),
595
+ "Modal.Title": (c) => (
596
+ <Modal.Root open>
597
+ <Modal.Title asChild>{c}</Modal.Title>
598
+ </Modal.Root>
599
+ ),
600
+ "Modal.Description": (c) => (
601
+ <Modal.Root open>
602
+ <Modal.Description asChild>{c}</Modal.Description>
603
+ </Modal.Root>
604
+ ),
605
+ "Modal.CloseTrigger": (c) => (
606
+ <Modal.Root open>
607
+ <Modal.CloseTrigger asChild>{c}</Modal.CloseTrigger>
608
+ </Modal.Root>
609
+ ),
610
+ "Notification.Root": bare,
611
+ Pill: (c) => <Pill asChild>{c}</Pill>,
612
+ PillGroup: bare,
613
+ "Popover.Trigger": (c) => (
614
+ <Popover.Root>
615
+ <Popover.Trigger asChild>{c}</Popover.Trigger>
616
+ </Popover.Root>
617
+ ),
618
+ "Popover.Anchor": (c) => (
619
+ <Popover.Root>
620
+ <Popover.Anchor asChild>{c}</Popover.Anchor>
621
+ </Popover.Root>
622
+ ),
623
+ "Schedule.Toolbar": bare,
624
+ ScheduleToolbar: alias("Schedule.Toolbar"),
625
+ "ScheduleToolbar.Title": (c) => (
626
+ <ScheduleToolbar.Title asChild view="month" date={new Date(0)} timeZone="UTC">
627
+ {c}
628
+ </ScheduleToolbar.Title>
629
+ ),
630
+ Table: bare,
631
+ "Table.Toolbar": bare,
632
+ "Table.Title": bare,
633
+ "Table.Content": bare,
634
+ "Table.Head": bare,
635
+ "Table.Body": bare,
636
+ "Table.Foot": bare,
637
+ "Table.Row": bare,
638
+ "Table.HeaderCell": bare,
639
+ "Table.Cell": bare,
640
+ "Tabs.Root": bare,
641
+ "Tabs.List": (c) => (
642
+ <Tabs.Root>
643
+ <Tabs.List asChild>{c}</Tabs.List>
644
+ </Tabs.Root>
645
+ ),
646
+ "Tabs.Trigger": (c) => (
647
+ <Tabs.Root>
648
+ <Tabs.List>
649
+ <Tabs.Trigger asChild value="a">
650
+ {c}
651
+ </Tabs.Trigger>
652
+ </Tabs.List>
653
+ </Tabs.Root>
654
+ ),
655
+ "Tabs.Content": (c) => (
656
+ <Tabs.Root value="a">
657
+ <Tabs.Content asChild value="a">
658
+ {c}
659
+ </Tabs.Content>
660
+ </Tabs.Root>
661
+ ),
662
+ "Tabs.Indicator": (c) => (
663
+ <Tabs.Root>
664
+ <Tabs.List>
665
+ <Tabs.Indicator asChild>{c}</Tabs.Indicator>
666
+ </Tabs.List>
667
+ </Tabs.Root>
668
+ ),
669
+ Text: bare,
670
+ TextInput: bare,
671
+ Textarea: bare,
672
+ ThemeIcon: bare,
673
+ Timeline: bare,
674
+ "Timeline.Item": (c) => (
675
+ <Timeline>
676
+ <Timeline.Item asChild>{c}</Timeline.Item>
677
+ </Timeline>
678
+ ),
679
+ "Timeline.Label": bare,
680
+ "Timeline.Content": bare,
681
+ "Timeline.Title": bare,
682
+ Title: bare,
683
+ Tooltip: (c) => (
684
+ <Tooltip asChild label="tip">
685
+ {c}
686
+ </Tooltip>
687
+ ),
688
+ "Tooltip.Trigger": (c) => (
689
+ <Tooltip.Root>
690
+ <Tooltip.Trigger asChild>{c}</Tooltip.Trigger>
691
+ </Tooltip.Root>
692
+ ),
693
+ "Tooltip.Content": (c) => (
694
+ <Tooltip.Root open>
695
+ <Tooltip.Content asChild>{c}</Tooltip.Content>
696
+ </Tooltip.Root>
697
+ ),
698
+ }
699
+
700
+ const PROBE_LABEL = "probe label"
701
+
702
+ /** Looks a part up by its contract name (`"Menu.Item"`) across every entry. */
703
+ const resolve = (name: string): unknown => {
704
+ const [head = "", member] = name.split(".")
705
+ const mod = Object.values(modules).find((m) => head in m) as Record<string, unknown> | undefined
706
+ if (!mod) throw new Error(`${name} is in the contract but no component entry exports it`)
707
+ const top = mod[head] as Record<string, unknown>
708
+ return member ? top[member] : top
709
+ }
710
+
711
+ const entries = Object.entries(contract) as [AsChildPart, Case][]
712
+
713
+ /** Renders one case with a fresh `<a>` probe and checks the contract. */
714
+ const expectComposes = (name: AsChildPart, how: "bare" | Render) => {
715
+ const child = (
716
+ <a data-probe="" href="/probe">
717
+ {PROBE_LABEL}
718
+ </a>
719
+ )
720
+ if (how === bare) {
721
+ const Part = resolve(name) as (props: { asChild: true; children: ReactElement }) => ReactElement
722
+ render(<Part asChild>{child}</Part>)
723
+ } else {
724
+ render(how(child))
725
+ }
726
+ const el = document.querySelector("[data-probe]")
727
+ expect(el, "the part rendered nothing").not.toBeNull()
728
+ expect(el?.textContent, "the child's own content was replaced").toContain(PROBE_LABEL)
729
+ const merged = [...(el?.attributes ?? [])].filter(
730
+ (a) => a.name !== "data-probe" && a.name !== "href",
731
+ )
732
+ expect(merged, "none of the part's props reached the child").not.toHaveLength(0)
733
+ }
734
+
735
+ describe("asChild contract", () => {
736
+ it("lists every component entry on disk", () => {
737
+ const onDisk = readdirSync(join(__dirname, "components"), { withFileTypes: true })
738
+ .filter((d) => d.isDirectory())
739
+ .map((d) => d.name.replace(/-(\w)/g, (_, c: string) => c.toUpperCase()))
740
+ const listed = Object.keys(modules).filter((k) => k !== "navLinkTanstack")
741
+ expect(listed.sort()).toEqual(onDisk.sort())
742
+ })
743
+
744
+ it.each(
745
+ entries.flatMap(([name, how]) =>
746
+ how === bare || typeof how === "function" ? [[name, how] as const] : [],
747
+ ),
748
+ )("%s composes onto a single <a> child", expectComposes)
749
+
750
+ it.each(
751
+ entries.filter(
752
+ (e): e is [AsChildPart, { alias: AsChildPart }] =>
753
+ typeof e[1] === "object" && "alias" in e[1],
754
+ ),
755
+ )("%s is the same component as its alias", (name, { alias: of }) => {
756
+ expect(resolve(name)).toBe(resolve(of))
757
+ })
758
+ })
759
+
760
+ /**
761
+ * The forbidden side, type-level. `NoAsChild` / `ForbidAsChild` sit on each
762
+ * part's HTML/Ark slice only, so the unions and generics elsewhere in its
763
+ * props must come through untouched. Each `@ts-expect-error` has a positive
764
+ * twin, as in `lib/as-child.test.tsx`.
765
+ */
766
+ describe("forbidden parts", () => {
767
+ const { Notification } = notification
768
+ const { Schedule } = schedule
769
+ const { Slider } = slider
770
+
771
+ it("reject asChild, and keep their props' unions and generics", () => {
772
+ const rejected = [
773
+ // @ts-expect-error a structural part: asChild is unavailable.
774
+ <Slider key="slider" asChild />,
775
+ // @ts-expect-error the data form builds its own items.
776
+ <Tabs key="tabs" asChild data={[]} />,
777
+ // @ts-expect-error the Schedule root renders a toolbar and a grid.
778
+ <Schedule key="schedule" asChild data={[]} />,
779
+ ]
780
+ const typed = [
781
+ // Tabs' `const Data` still narrows `onChange` to the data's values.
782
+ <Tabs
783
+ key="tabs"
784
+ data={[
785
+ { value: "a", label: "A", content: "a" },
786
+ { value: "b", label: "B", content: "b" },
787
+ ]}
788
+ onChange={(value) => {
789
+ const narrowed: "a" | "b" = value
790
+ return narrowed
791
+ }}
792
+ />,
793
+ // Slider's `V` still infers a range from its value.
794
+ <Slider
795
+ key="slider"
796
+ defaultValue={[2, 8]}
797
+ onChange={(value) => {
798
+ const range: number[] = value
799
+ return range
800
+ }}
801
+ />,
802
+ // DayView's slot union still pairs `slotDuration` with its own options.
803
+ <Schedule.DayView key="day" data={[]} slotDuration={30} />,
804
+ ]
805
+ // @ts-expect-error Notification's `type` and `color` stay exclusive.
806
+ const exclusive = <Notification type="info" color="red" title="t" />
807
+ expect([...rejected, ...typed, exclusive]).toHaveLength(7)
808
+ })
809
+ })