ui-ingredients 0.0.25 → 0.0.26

Sign up to get free protection for your applications and to get access to all the features.
Files changed (371) hide show
  1. package/README.md +1 -1
  2. package/dist/accordion/item-content.svelte +14 -7
  3. package/dist/accordion/item-indicator.svelte +14 -7
  4. package/dist/accordion/item-trigger.svelte +13 -6
  5. package/dist/accordion/item.svelte +11 -6
  6. package/dist/accordion/root.svelte +12 -4
  7. package/dist/avatar/fallback.svelte +14 -7
  8. package/dist/avatar/image.svelte +11 -4
  9. package/dist/avatar/root.svelte +11 -13
  10. package/dist/carousel/indicator-group.svelte +14 -7
  11. package/dist/carousel/indicator.svelte +13 -6
  12. package/dist/carousel/item-group.svelte +14 -7
  13. package/dist/carousel/item.svelte +12 -8
  14. package/dist/carousel/next-trigger.svelte +13 -6
  15. package/dist/carousel/prev-trigger.svelte +13 -6
  16. package/dist/carousel/root.svelte +11 -5
  17. package/dist/carousel/viewport.svelte +14 -7
  18. package/dist/checkbox/control.svelte +14 -7
  19. package/dist/checkbox/hidden-input.svelte +1 -1
  20. package/dist/checkbox/indicator.svelte +14 -7
  21. package/dist/checkbox/label.svelte +14 -7
  22. package/dist/checkbox/root.svelte +12 -4
  23. package/dist/clipboard/control.svelte +14 -7
  24. package/dist/clipboard/indicator.svelte +14 -7
  25. package/dist/clipboard/input.svelte +11 -4
  26. package/dist/clipboard/label.svelte +14 -6
  27. package/dist/clipboard/root.svelte +13 -5
  28. package/dist/clipboard/trigger.svelte +13 -6
  29. package/dist/collapsible/content.svelte +14 -7
  30. package/dist/collapsible/root.svelte +14 -6
  31. package/dist/collapsible/trigger.svelte +13 -6
  32. package/dist/color-picker/area-background.svelte +21 -0
  33. package/dist/color-picker/area-background.svelte.d.ts +18 -0
  34. package/dist/color-picker/area-thumb.svelte +21 -0
  35. package/dist/color-picker/area-thumb.svelte.d.ts +18 -0
  36. package/dist/color-picker/area.svelte +27 -0
  37. package/dist/color-picker/area.svelte.d.ts +18 -0
  38. package/dist/color-picker/channel-input.svelte +28 -0
  39. package/dist/color-picker/channel-input.svelte.d.ts +18 -0
  40. package/dist/color-picker/channel-slider-label.svelte +25 -0
  41. package/dist/color-picker/channel-slider-label.svelte.d.ts +18 -0
  42. package/dist/color-picker/channel-slider-thumb.svelte +23 -0
  43. package/dist/color-picker/channel-slider-thumb.svelte.d.ts +18 -0
  44. package/dist/color-picker/channel-slider-track.svelte +23 -0
  45. package/dist/color-picker/channel-slider-track.svelte.d.ts +18 -0
  46. package/dist/color-picker/channel-slider-value-text.svelte +29 -0
  47. package/dist/color-picker/channel-slider-value-text.svelte.d.ts +18 -0
  48. package/dist/color-picker/channel-slider.svelte +29 -0
  49. package/dist/color-picker/channel-slider.svelte.d.ts +18 -0
  50. package/dist/color-picker/color-picker.d.ts +26 -0
  51. package/dist/color-picker/color-picker.js +26 -0
  52. package/dist/color-picker/content.svelte +20 -0
  53. package/dist/color-picker/content.svelte.d.ts +18 -0
  54. package/dist/color-picker/context.svelte.d.ts +8 -0
  55. package/dist/color-picker/context.svelte.js +6 -0
  56. package/dist/color-picker/control.svelte +20 -0
  57. package/dist/color-picker/control.svelte.d.ts +18 -0
  58. package/dist/color-picker/create-color-picker.svelte.d.ts +9 -0
  59. package/dist/color-picker/create-color-picker.svelte.js +20 -0
  60. package/dist/color-picker/eye-dropper-trigger.svelte +20 -0
  61. package/dist/color-picker/eye-dropper-trigger.svelte.d.ts +18 -0
  62. package/dist/color-picker/format-select.svelte +28 -0
  63. package/dist/color-picker/format-select.svelte.d.ts +18 -0
  64. package/dist/color-picker/format-trigger.svelte +20 -0
  65. package/dist/color-picker/format-trigger.svelte.d.ts +18 -0
  66. package/dist/color-picker/hidden-input.svelte +18 -0
  67. package/dist/color-picker/hidden-input.svelte.d.ts +18 -0
  68. package/dist/color-picker/index.d.ts +26 -0
  69. package/dist/color-picker/index.js +1 -0
  70. package/dist/color-picker/label.svelte +20 -0
  71. package/dist/color-picker/label.svelte.d.ts +18 -0
  72. package/dist/color-picker/positioner.svelte +20 -0
  73. package/dist/color-picker/positioner.svelte.d.ts +18 -0
  74. package/dist/color-picker/root.svelte +75 -0
  75. package/dist/color-picker/root.svelte.d.ts +18 -0
  76. package/dist/color-picker/swatch-group.svelte +20 -0
  77. package/dist/color-picker/swatch-group.svelte.d.ts +18 -0
  78. package/dist/color-picker/swatch-indicator.svelte +21 -0
  79. package/dist/color-picker/swatch-indicator.svelte.d.ts +18 -0
  80. package/dist/color-picker/swatch-trigger.svelte +31 -0
  81. package/dist/color-picker/swatch-trigger.svelte.d.ts +18 -0
  82. package/dist/color-picker/swatch.svelte +27 -0
  83. package/dist/color-picker/swatch.svelte.d.ts +18 -0
  84. package/dist/color-picker/transparency-grid.svelte +29 -0
  85. package/dist/color-picker/transparency-grid.svelte.d.ts +18 -0
  86. package/dist/color-picker/trigger.svelte +20 -0
  87. package/dist/color-picker/trigger.svelte.d.ts +18 -0
  88. package/dist/color-picker/value-text.svelte +24 -0
  89. package/dist/color-picker/value-text.svelte.d.ts +18 -0
  90. package/dist/combobox/clear-trigger.svelte +13 -6
  91. package/dist/combobox/content.svelte +14 -7
  92. package/dist/combobox/control.svelte +14 -7
  93. package/dist/combobox/input.svelte +11 -4
  94. package/dist/combobox/item-group-label.svelte +14 -7
  95. package/dist/combobox/item-group.svelte +14 -8
  96. package/dist/combobox/item-indicator.svelte +14 -7
  97. package/dist/combobox/item-text.svelte +18 -11
  98. package/dist/combobox/item.svelte +11 -6
  99. package/dist/combobox/label.svelte +13 -6
  100. package/dist/combobox/list.svelte +14 -7
  101. package/dist/combobox/positioner.svelte +14 -7
  102. package/dist/combobox/root.svelte +11 -5
  103. package/dist/combobox/trigger.svelte +13 -6
  104. package/dist/date-picker/clear-trigger.svelte +13 -6
  105. package/dist/date-picker/content.svelte +14 -7
  106. package/dist/date-picker/control.svelte +14 -7
  107. package/dist/date-picker/create-date-picker.svelte.d.ts +2 -0
  108. package/dist/date-picker/create-date-picker.svelte.js +11 -1
  109. package/dist/date-picker/day-table-cell-trigger.svelte +13 -6
  110. package/dist/date-picker/day-table-cell.svelte +12 -13
  111. package/dist/date-picker/input.svelte +11 -4
  112. package/dist/date-picker/label.svelte +13 -6
  113. package/dist/date-picker/month-select.svelte +19 -12
  114. package/dist/date-picker/month-table-cell-trigger.svelte +13 -6
  115. package/dist/date-picker/month-table-cell.svelte +12 -13
  116. package/dist/date-picker/next-trigger.svelte +13 -6
  117. package/dist/date-picker/positioner.svelte +14 -7
  118. package/dist/date-picker/preset-trigger.svelte +14 -6
  119. package/dist/date-picker/prev-trigger.svelte +13 -6
  120. package/dist/date-picker/range-text.svelte +18 -11
  121. package/dist/date-picker/root.svelte +13 -5
  122. package/dist/date-picker/table-body.svelte +14 -7
  123. package/dist/date-picker/table-head.svelte +14 -7
  124. package/dist/date-picker/table-header.svelte +14 -7
  125. package/dist/date-picker/table-row.svelte +14 -7
  126. package/dist/date-picker/table.svelte +14 -8
  127. package/dist/date-picker/trigger.svelte +13 -6
  128. package/dist/date-picker/view-control.svelte +14 -7
  129. package/dist/date-picker/view-trigger.svelte +13 -6
  130. package/dist/date-picker/view.svelte +22 -9
  131. package/dist/date-picker/year-select.svelte +19 -12
  132. package/dist/date-picker/year-table-cell-trigger.svelte +13 -6
  133. package/dist/date-picker/year-table-cell.svelte +12 -13
  134. package/dist/dialog/backdrop.svelte +14 -7
  135. package/dist/dialog/close-trigger.svelte +13 -6
  136. package/dist/dialog/content.svelte +14 -7
  137. package/dist/dialog/description.svelte +14 -7
  138. package/dist/dialog/positioner.svelte +14 -7
  139. package/dist/dialog/title.svelte +14 -7
  140. package/dist/dialog/trigger.svelte +13 -6
  141. package/dist/editable/area.svelte +14 -7
  142. package/dist/editable/cancel-trigger.svelte +13 -6
  143. package/dist/editable/control.svelte +14 -7
  144. package/dist/editable/edit-trigger.svelte +13 -6
  145. package/dist/editable/input.svelte +11 -4
  146. package/dist/editable/label.svelte +13 -6
  147. package/dist/editable/preview.svelte +18 -11
  148. package/dist/editable/submit-trigger.svelte +13 -6
  149. package/dist/file-upload/dropzone.svelte +14 -7
  150. package/dist/file-upload/hidden-input.svelte +1 -1
  151. package/dist/file-upload/item-delete-trigger.svelte +13 -6
  152. package/dist/file-upload/item-group.svelte +14 -7
  153. package/dist/file-upload/item-name.svelte +18 -11
  154. package/dist/file-upload/item-preview-image.svelte +11 -4
  155. package/dist/file-upload/item-preview.svelte +14 -7
  156. package/dist/file-upload/item-size-text.svelte +18 -11
  157. package/dist/file-upload/item.svelte +14 -7
  158. package/dist/file-upload/label.svelte +13 -6
  159. package/dist/file-upload/root.svelte +1 -1
  160. package/dist/file-upload/trigger.svelte +13 -6
  161. package/dist/hover-card/arrow-tip.svelte +14 -7
  162. package/dist/hover-card/arrow.svelte +14 -7
  163. package/dist/hover-card/content.svelte +14 -7
  164. package/dist/hover-card/positioner.svelte +14 -7
  165. package/dist/hover-card/trigger.svelte +14 -7
  166. package/dist/index.d.ts +2 -0
  167. package/dist/index.js +2 -0
  168. package/dist/menu/arrow-tip.svelte +14 -7
  169. package/dist/menu/arrow.svelte +14 -7
  170. package/dist/menu/content.svelte +14 -7
  171. package/dist/menu/context-trigger.svelte +13 -6
  172. package/dist/menu/indicator.svelte +14 -7
  173. package/dist/menu/item-group-label.svelte +14 -7
  174. package/dist/menu/item-group.svelte +15 -9
  175. package/dist/menu/item.svelte +1 -1
  176. package/dist/menu/option-item-indicator.svelte +14 -7
  177. package/dist/menu/option-item-text.svelte +18 -11
  178. package/dist/menu/option-item.svelte +11 -5
  179. package/dist/menu/positioner.svelte +14 -7
  180. package/dist/menu/separator.svelte +14 -7
  181. package/dist/menu/trigger-item.svelte +14 -7
  182. package/dist/menu/trigger.svelte +14 -7
  183. package/dist/number-input/control.svelte +14 -7
  184. package/dist/number-input/decrement-trigger.svelte +13 -6
  185. package/dist/number-input/increment-trigger.svelte +14 -7
  186. package/dist/number-input/input.svelte +11 -4
  187. package/dist/number-input/label.svelte +13 -6
  188. package/dist/number-input/root.svelte +13 -5
  189. package/dist/number-input/scrubber.svelte +14 -7
  190. package/dist/pagination/ellipsis.svelte +14 -7
  191. package/dist/pagination/item.svelte +13 -6
  192. package/dist/pagination/next-trigger.svelte +13 -6
  193. package/dist/pagination/prev-trigger.svelte +13 -6
  194. package/dist/pagination/root.svelte +13 -5
  195. package/dist/pin-input/anatomy.js +3 -0
  196. package/dist/pin-input/clear-trigger.svelte +18 -12
  197. package/dist/pin-input/create-pin-input.svelte.d.ts +2 -0
  198. package/dist/pin-input/create-pin-input.svelte.js +13 -1
  199. package/dist/pin-input/hidden-input.svelte +1 -1
  200. package/dist/pin-input/input.svelte +11 -4
  201. package/dist/pin-input/label.svelte +13 -6
  202. package/dist/pin-input/pin-input.d.ts +1 -1
  203. package/dist/pin-input/pin-input.js +1 -1
  204. package/dist/pin-input/root.svelte +11 -5
  205. package/dist/popover/arrow-tip.svelte +14 -7
  206. package/dist/popover/arrow.svelte +14 -7
  207. package/dist/popover/close-trigger.svelte +13 -6
  208. package/dist/popover/content.svelte +14 -7
  209. package/dist/popover/description.svelte +14 -7
  210. package/dist/popover/positioner.svelte +14 -7
  211. package/dist/popover/title.svelte +14 -7
  212. package/dist/popover/trigger.svelte +13 -6
  213. package/dist/presence/context.svelte.d.ts +3 -0
  214. package/dist/presence/context.svelte.js +2 -0
  215. package/dist/presence/create-presence.svelte.d.ts +11 -4
  216. package/dist/presence/create-presence.svelte.js +19 -3
  217. package/dist/presence/root.svelte +9 -9
  218. package/dist/presence/root.svelte.d.ts +1 -1
  219. package/dist/progress/circle-range.svelte +13 -6
  220. package/dist/progress/circle-track.svelte +13 -6
  221. package/dist/progress/circle.svelte +13 -6
  222. package/dist/progress/label.svelte +14 -7
  223. package/dist/progress/range.svelte +14 -7
  224. package/dist/progress/root.svelte +11 -5
  225. package/dist/progress/track.svelte +14 -7
  226. package/dist/progress/value-text.svelte +18 -11
  227. package/dist/progress/view.svelte +14 -7
  228. package/dist/qr-code/frame.svelte +13 -6
  229. package/dist/qr-code/overlay.svelte +14 -7
  230. package/dist/qr-code/pattern.svelte +13 -6
  231. package/dist/qr-code/root.svelte +11 -5
  232. package/dist/radio-group/indicator.svelte +14 -7
  233. package/dist/radio-group/item-control.svelte +14 -7
  234. package/dist/radio-group/item-hidden-input.svelte +1 -1
  235. package/dist/radio-group/item-text.svelte +14 -7
  236. package/dist/radio-group/item.svelte +10 -12
  237. package/dist/radio-group/label.svelte +14 -7
  238. package/dist/radio-group/root.svelte +13 -5
  239. package/dist/rating-group/control.svelte +16 -9
  240. package/dist/rating-group/hidden-input.svelte +1 -1
  241. package/dist/rating-group/item.svelte +14 -9
  242. package/dist/rating-group/label.svelte +15 -8
  243. package/dist/rating-group/root.svelte +17 -9
  244. package/dist/segment-group/indicator.svelte +14 -8
  245. package/dist/segment-group/item-control.svelte +15 -8
  246. package/dist/segment-group/item-hidden-input.svelte +1 -1
  247. package/dist/segment-group/item-text.svelte +14 -8
  248. package/dist/segment-group/item.svelte +10 -5
  249. package/dist/segment-group/label.svelte +14 -8
  250. package/dist/segment-group/root.svelte +13 -6
  251. package/dist/select/clear-trigger.svelte +13 -6
  252. package/dist/select/content.svelte +14 -7
  253. package/dist/select/control.svelte +14 -7
  254. package/dist/select/hidden-select.svelte +1 -1
  255. package/dist/select/indicator.svelte +14 -7
  256. package/dist/select/item-group-label.svelte +14 -7
  257. package/dist/select/item-group.svelte +14 -8
  258. package/dist/select/item-indicator.svelte +14 -7
  259. package/dist/select/item-text.svelte +18 -11
  260. package/dist/select/item.svelte +11 -6
  261. package/dist/select/label.svelte +13 -6
  262. package/dist/select/list.svelte +14 -7
  263. package/dist/select/positioner.svelte +14 -7
  264. package/dist/select/root.svelte +12 -6
  265. package/dist/select/trigger.svelte +13 -6
  266. package/dist/select/value-text.svelte +20 -13
  267. package/dist/signature-pad/clear-trigger.svelte +14 -7
  268. package/dist/signature-pad/control.svelte +14 -7
  269. package/dist/signature-pad/current-segment-path.svelte +13 -6
  270. package/dist/signature-pad/guide.svelte +14 -7
  271. package/dist/signature-pad/hidden-input.svelte +1 -1
  272. package/dist/signature-pad/label.svelte +13 -6
  273. package/dist/signature-pad/root.svelte +13 -5
  274. package/dist/signature-pad/segment-path.svelte +13 -6
  275. package/dist/signature-pad/segment.svelte +13 -6
  276. package/dist/slider/control.svelte +14 -7
  277. package/dist/slider/hidden-input.svelte +1 -1
  278. package/dist/slider/label.svelte +13 -6
  279. package/dist/slider/marker-group.svelte +14 -7
  280. package/dist/slider/marker.svelte +14 -7
  281. package/dist/slider/range.svelte +14 -7
  282. package/dist/slider/root.svelte +11 -5
  283. package/dist/slider/thumb.svelte +14 -7
  284. package/dist/slider/track.svelte +14 -7
  285. package/dist/slider/value-text.svelte +18 -11
  286. package/dist/splitter/panel.svelte +14 -7
  287. package/dist/splitter/resize-trigger.svelte +11 -6
  288. package/dist/splitter/root.svelte +11 -5
  289. package/dist/steps/completed-content.svelte +14 -7
  290. package/dist/steps/content.svelte +14 -7
  291. package/dist/steps/indicator.svelte +14 -7
  292. package/dist/steps/item.svelte +11 -6
  293. package/dist/steps/list.svelte +15 -7
  294. package/dist/steps/next-trigger.svelte +13 -6
  295. package/dist/steps/prev-trigger.svelte +13 -6
  296. package/dist/steps/progress.svelte +14 -7
  297. package/dist/steps/root.svelte +12 -6
  298. package/dist/steps/separator.svelte +14 -7
  299. package/dist/steps/trigger.svelte +13 -6
  300. package/dist/switch/control.svelte +14 -7
  301. package/dist/switch/hidden-input.svelte +1 -1
  302. package/dist/switch/label.svelte +14 -7
  303. package/dist/switch/root.svelte +10 -4
  304. package/dist/switch/thumb.svelte +14 -7
  305. package/dist/tabs/content.svelte +14 -7
  306. package/dist/tabs/list.svelte +14 -7
  307. package/dist/tabs/root.svelte +12 -6
  308. package/dist/tabs/trigger.svelte +13 -6
  309. package/dist/tags-input/clear-trigger.svelte +13 -6
  310. package/dist/tags-input/control.svelte +14 -7
  311. package/dist/tags-input/hidden-input.svelte +1 -1
  312. package/dist/tags-input/input.svelte +11 -4
  313. package/dist/tags-input/item-delete-trigger.svelte +13 -6
  314. package/dist/tags-input/item-input.svelte +12 -4
  315. package/dist/tags-input/item-preview.svelte +14 -7
  316. package/dist/tags-input/item-text.svelte +14 -7
  317. package/dist/tags-input/item.svelte +11 -13
  318. package/dist/tags-input/label.svelte +13 -6
  319. package/dist/tags-input/root.svelte +14 -6
  320. package/dist/time-picker/clear-trigger.svelte +13 -6
  321. package/dist/time-picker/column.svelte +14 -7
  322. package/dist/time-picker/content.svelte +14 -7
  323. package/dist/time-picker/control.svelte +14 -7
  324. package/dist/time-picker/hour-cell.svelte +14 -7
  325. package/dist/time-picker/input.svelte +11 -4
  326. package/dist/time-picker/label.svelte +13 -6
  327. package/dist/time-picker/minute-cell.svelte +14 -7
  328. package/dist/time-picker/period-cell.svelte +15 -7
  329. package/dist/time-picker/positioner.svelte +14 -7
  330. package/dist/time-picker/root.svelte +13 -5
  331. package/dist/time-picker/second-cell.svelte +14 -7
  332. package/dist/time-picker/spacer.svelte +14 -7
  333. package/dist/time-picker/trigger.svelte +13 -6
  334. package/dist/timer/action-trigger.svelte +13 -7
  335. package/dist/timer/item-label.svelte +14 -7
  336. package/dist/timer/item-value.svelte +18 -11
  337. package/dist/timer/item.svelte +14 -7
  338. package/dist/timer/root.svelte +11 -5
  339. package/dist/timer/separator.svelte +14 -7
  340. package/dist/toast/action-trigger.svelte +13 -6
  341. package/dist/toast/actor.svelte +6 -6
  342. package/dist/toast/actor.svelte.d.ts +3 -3
  343. package/dist/toast/close-trigger.svelte +13 -6
  344. package/dist/toast/description.svelte +18 -11
  345. package/dist/toast/root.svelte +16 -14
  346. package/dist/toast/title.svelte +18 -11
  347. package/dist/toast/toaster.svelte +3 -2
  348. package/dist/toggle-group/item.svelte +10 -5
  349. package/dist/toggle-group/root.svelte +14 -6
  350. package/dist/tooltip/arrow-tip.svelte +14 -7
  351. package/dist/tooltip/arrow.svelte +14 -7
  352. package/dist/tooltip/content.svelte +14 -7
  353. package/dist/tooltip/positioner.svelte +14 -7
  354. package/dist/tooltip/trigger.svelte +13 -6
  355. package/dist/tree-view/branch-content.svelte +14 -7
  356. package/dist/tree-view/branch-control.svelte +14 -7
  357. package/dist/tree-view/branch-indicator.svelte +14 -7
  358. package/dist/tree-view/branch-text.svelte +14 -7
  359. package/dist/tree-view/branch-trigger.svelte +14 -7
  360. package/dist/tree-view/branch.svelte +11 -13
  361. package/dist/tree-view/item-indicator.svelte +14 -7
  362. package/dist/tree-view/item-text.svelte +14 -7
  363. package/dist/tree-view/item.svelte +11 -13
  364. package/dist/tree-view/label.svelte +14 -7
  365. package/dist/tree-view/root.svelte +12 -6
  366. package/dist/tree-view/tree.svelte +14 -7
  367. package/dist/types.d.ts +2 -1
  368. package/dist/utils.svelte.d.ts +2 -5
  369. package/dist/utils.svelte.js +9 -9
  370. package/package.json +4 -3
  371. package/dist/color-picker/.gitkeep +0 -0
@@ -1,20 +1,27 @@
1
1
  <script lang="ts" module>
2
2
  import type {HtmlProps} from '../types.js';
3
+ import type {Snippet} from 'svelte';
3
4
 
4
- export interface QRCodePatternProps extends HtmlProps<'path'> {}
5
+ export interface QRCodePatternProps extends HtmlProps<'path'> {
6
+ asChild?: Snippet<[attrs: Omit<HtmlProps<'path'>, 'children'>]>;
7
+ }
5
8
  </script>
6
9
 
7
10
  <script lang="ts">
8
- import {mergeProps} from '@zag-js/svelte';
11
+ import {mergeProps} from '../utils.svelte.js';
9
12
  import {qrCodeContext} from './context.svelte.js';
10
13
 
11
- let {children, ...props}: QRCodePatternProps = $props();
14
+ let {asChild, children, ...props}: QRCodePatternProps = $props();
12
15
 
13
16
  let qrCode = qrCodeContext.get();
14
17
 
15
18
  let attrs = $derived(mergeProps(props, qrCode.getPatternProps()));
16
19
  </script>
17
20
 
18
- <path {...attrs}>
19
- {@render children?.()}
20
- </path>
21
+ {#if asChild}
22
+ {@render asChild(attrs)}
23
+ {:else}
24
+ <path {...attrs}>
25
+ {@render children?.()}
26
+ </path>
27
+ {/if}
@@ -1,16 +1,17 @@
1
1
  <script lang="ts" module>
2
- import type {Assign, HtmlProps} from '../types.js';
2
+ import type {Assign, GenericHtmlProps, HtmlProps} from '../types.js';
3
3
  import type {Snippet} from 'svelte';
4
4
  import type {CreateQRCodeProps, CreateQRCodeReturn} from './create-qr-code.svelte.js';
5
5
 
6
6
  export interface QRCodeProps
7
7
  extends Assign<Omit<HtmlProps<'div'>, 'children'>, CreateQRCodeProps> {
8
+ asChild?: Snippet<[attrs: Omit<GenericHtmlProps, 'children'>, qrCode: CreateQRCodeReturn]>;
8
9
  children?: Snippet<[qrCode: CreateQRCodeReturn]>;
9
10
  }
10
11
  </script>
11
12
 
12
13
  <script lang="ts">
13
- import {mergeProps} from '@zag-js/svelte';
14
+ import {mergeProps} from '../utils.svelte.js';
14
15
  import {qrCodeContext} from './context.svelte.js';
15
16
  import {createQRCode} from './create-qr-code.svelte.js';
16
17
 
@@ -20,6 +21,7 @@
20
21
  ids,
21
22
  value,
22
23
  encoding,
24
+ asChild,
23
25
  children,
24
26
  ...props
25
27
  }: QRCodeProps = $props();
@@ -36,6 +38,10 @@
36
38
  qrCodeContext.set(qrCode);
37
39
  </script>
38
40
 
39
- <div {...attrs}>
40
- {@render children?.(qrCode)}
41
- </div>
41
+ {#if asChild}
42
+ {@render asChild(attrs, qrCode)}
43
+ {:else}
44
+ <div {...attrs}>
45
+ {@render children?.(qrCode)}
46
+ </div>
47
+ {/if}
@@ -1,20 +1,27 @@
1
1
  <script lang="ts" module>
2
- import type {HtmlProps} from '../types.js';
2
+ import type {GenericHtmlProps, HtmlProps} from '../types.js';
3
+ import type {Snippet} from 'svelte';
3
4
 
4
- export interface RadioGroupIndicatorProps extends HtmlProps<'span'> {}
5
+ export interface RadioGroupIndicatorProps extends HtmlProps<'div'> {
6
+ asChild?: Snippet<[attrs: Omit<GenericHtmlProps, 'children'>]>;
7
+ }
5
8
  </script>
6
9
 
7
10
  <script lang="ts">
8
- import {mergeProps} from '@zag-js/svelte';
11
+ import {mergeProps} from '../utils.svelte.js';
9
12
  import {radioGroupContext} from './context.svelte.js';
10
13
 
11
- let {children, ...props}: RadioGroupIndicatorProps = $props();
14
+ let {asChild, children, ...props}: RadioGroupIndicatorProps = $props();
12
15
 
13
16
  let radioGroup = radioGroupContext.get();
14
17
 
15
18
  let attrs = $derived(mergeProps(props, radioGroup.getIndicatorProps()));
16
19
  </script>
17
20
 
18
- <span {...attrs}>
19
- {@render children?.()}
20
- </span>
21
+ {#if asChild}
22
+ {@render asChild(attrs)}
23
+ {:else}
24
+ <div {...attrs}>
25
+ {@render children?.()}
26
+ </div>
27
+ {/if}
@@ -1,14 +1,17 @@
1
1
  <script lang="ts" module>
2
- import type {HtmlProps} from '../types.js';
2
+ import type {GenericHtmlProps, HtmlProps} from '../types.js';
3
+ import type {Snippet} from 'svelte';
3
4
 
4
- export interface RadioGroupItemControlProps extends HtmlProps<'div'> {}
5
+ export interface RadioGroupItemControlProps extends HtmlProps<'div'> {
6
+ asChild?: Snippet<[attrs: Omit<GenericHtmlProps, 'children'>]>;
7
+ }
5
8
  </script>
6
9
 
7
10
  <script lang="ts">
8
- import {mergeProps} from '@zag-js/svelte';
11
+ import {mergeProps} from '../utils.svelte.js';
9
12
  import {radioGroupContext, radioGroupItemPropsContext} from './context.svelte.js';
10
13
 
11
- let {children, ...props}: RadioGroupItemControlProps = $props();
14
+ let {asChild, children, ...props}: RadioGroupItemControlProps = $props();
12
15
 
13
16
  let radioGroup = radioGroupContext.get();
14
17
  let itemProps = radioGroupItemPropsContext.get();
@@ -16,6 +19,10 @@
16
19
  let attrs = $derived(mergeProps(props, radioGroup.getItemControlProps(itemProps)));
17
20
  </script>
18
21
 
19
- <div {...attrs}>
20
- {@render children?.()}
21
- </div>
22
+ {#if asChild}
23
+ {@render asChild(attrs)}
24
+ {:else}
25
+ <div {...attrs}>
26
+ {@render children?.()}
27
+ </div>
28
+ {/if}
@@ -5,7 +5,7 @@
5
5
  </script>
6
6
 
7
7
  <script lang="ts">
8
- import {mergeProps} from '@zag-js/svelte';
8
+ import {mergeProps} from '../utils.svelte.js';
9
9
  import {radioGroupContext, radioGroupItemPropsContext} from './context.svelte.js';
10
10
 
11
11
  let {...props}: RadioGroupItemHiddenInputProps = $props();
@@ -1,14 +1,17 @@
1
1
  <script lang="ts" module>
2
- import type {HtmlProps} from '../types.js';
2
+ import type {GenericHtmlProps, HtmlProps} from '../types.js';
3
+ import type {Snippet} from 'svelte';
3
4
 
4
- export interface RadioGroupItemTextProps extends HtmlProps<'span'> {}
5
+ export interface RadioGroupItemTextProps extends HtmlProps<'div'> {
6
+ asChild?: Snippet<[attrs: Omit<GenericHtmlProps, 'children'>]>;
7
+ }
5
8
  </script>
6
9
 
7
10
  <script lang="ts">
8
- import {mergeProps} from '@zag-js/svelte';
11
+ import {mergeProps} from '../utils.svelte.js';
9
12
  import {radioGroupContext, radioGroupItemPropsContext} from './context.svelte.js';
10
13
 
11
- let {children, ...props}: RadioGroupItemTextProps = $props();
14
+ let {asChild, children, ...props}: RadioGroupItemTextProps = $props();
12
15
 
13
16
  let radioGroup = radioGroupContext.get();
14
17
  let itemProps = radioGroupItemPropsContext.get();
@@ -16,6 +19,10 @@
16
19
  let attrs = $derived(mergeProps(props, radioGroup.getItemTextProps(itemProps)));
17
20
  </script>
18
21
 
19
- <span {...attrs}>
20
- {@render children?.()}
21
- </span>
22
+ {#if asChild}
23
+ {@render asChild(attrs)}
24
+ {:else}
25
+ <div {...attrs}>
26
+ {@render children?.()}
27
+ </div>
28
+ {/if}
@@ -5,22 +5,16 @@
5
5
 
6
6
  export interface RadioGroupItemProps
7
7
  extends Assign<Omit<HtmlProps<'label'>, 'children'>, ItemProps> {
8
+ asChild?: Snippet<[attrs: Omit<HtmlProps<'label'>, 'children'>, state: ItemState]>;
8
9
  children?: Snippet<[state: ItemState]>;
9
10
  }
10
11
  </script>
11
12
 
12
13
  <script lang="ts">
13
- import {mergeProps} from '@zag-js/svelte';
14
+ import {mergeProps} from '../utils.svelte.js';
14
15
  import {radioGroupContext, radioGroupItemPropsContext} from './context.svelte.js';
15
16
 
16
- let {
17
- /**/
18
- value,
19
- invalid,
20
- disabled,
21
- children,
22
- ...props
23
- }: RadioGroupItemProps = $props();
17
+ let {value, invalid, disabled, children, asChild, ...props}: RadioGroupItemProps = $props();
24
18
 
25
19
  let radioGroup = radioGroupContext.get();
26
20
  let itemProps = $derived({
@@ -35,6 +29,10 @@
35
29
  radioGroupItemPropsContext.set(() => itemProps);
36
30
  </script>
37
31
 
38
- <label {...attrs}>
39
- {@render children?.(state)}
40
- </label>
32
+ {#if asChild}
33
+ {@render asChild(attrs, state)}
34
+ {:else}
35
+ <label {...attrs}>
36
+ {@render children?.(state)}
37
+ </label>
38
+ {/if}
@@ -1,20 +1,27 @@
1
1
  <script lang="ts" module>
2
- import type {HtmlProps} from '../types.js';
2
+ import type {GenericHtmlProps, HtmlProps} from '../types.js';
3
+ import type {Snippet} from 'svelte';
3
4
 
4
- export interface RadioGroupLabelProps extends HtmlProps<'span'> {}
5
+ export interface RadioGroupLabelProps extends HtmlProps<'div'> {
6
+ asChild?: Snippet<[attrs: Omit<GenericHtmlProps, 'children'>]>;
7
+ }
5
8
  </script>
6
9
 
7
10
  <script lang="ts">
8
- import {mergeProps} from '@zag-js/svelte';
11
+ import {mergeProps} from '../utils.svelte.js';
9
12
  import {radioGroupContext} from './context.svelte.js';
10
13
 
11
- let {children, ...props}: RadioGroupLabelProps = $props();
14
+ let {asChild, children, ...props}: RadioGroupLabelProps = $props();
12
15
 
13
16
  let radioGroup = radioGroupContext.get();
14
17
 
15
18
  let attrs = $derived(mergeProps(props, radioGroup.getLabelProps()));
16
19
  </script>
17
20
 
18
- <span {...attrs}>
19
- {@render children?.()}
20
- </span>
21
+ {#if asChild}
22
+ {@render asChild(attrs)}
23
+ {:else}
24
+ <div {...attrs}>
25
+ {@render children?.()}
26
+ </div>
27
+ {/if}
@@ -1,16 +1,19 @@
1
1
  <script lang="ts" module>
2
- import type {Assign, HtmlProps} from '../types.js';
2
+ import type {Assign, GenericHtmlProps, HtmlProps} from '../types.js';
3
3
  import type {Snippet} from 'svelte';
4
4
  import type {CreateRadioGroupProps, CreateRadioGroupReturn} from './create-radio-group.svelte.js';
5
5
 
6
6
  export interface RadioGroupProps
7
7
  extends Assign<Omit<HtmlProps<'div'>, 'children'>, CreateRadioGroupProps> {
8
+ asChild?: Snippet<
9
+ [attrs: Omit<GenericHtmlProps, 'children'>, radioGroup: CreateRadioGroupReturn]
10
+ >;
8
11
  children?: Snippet<[radioGroup: CreateRadioGroupReturn]>;
9
12
  }
10
13
  </script>
11
14
 
12
15
  <script lang="ts">
13
- import {mergeProps} from '@zag-js/svelte';
16
+ import {mergeProps} from '../utils.svelte.js';
14
17
  import {radioGroupContext} from './context.svelte.js';
15
18
  import {createRadioGroup} from './create-radio-group.svelte.js';
16
19
 
@@ -24,6 +27,7 @@
24
27
  readOnly,
25
28
  orientation,
26
29
  onValueChange,
30
+ asChild,
27
31
  children,
28
32
  ...props
29
33
  }: RadioGroupProps = $props();
@@ -45,6 +49,10 @@
45
49
  radioGroupContext.set(radioGroup);
46
50
  </script>
47
51
 
48
- <div {...attrs}>
49
- {@render children?.(radioGroup)}
50
- </div>
52
+ {#if asChild}
53
+ {@render asChild(attrs, radioGroup)}
54
+ {:else}
55
+ <div {...attrs}>
56
+ {@render children?.(radioGroup)}
57
+ </div>
58
+ {/if}
@@ -1,20 +1,27 @@
1
1
  <script lang="ts" module>
2
- import type {HtmlProps} from '../types.js';
2
+ import type {GenericHtmlProps, HtmlProps} from '../types.js';
3
+ import type {Snippet} from 'svelte';
3
4
 
4
- export interface RatingGroupControlProps extends HtmlProps<'div'> {}
5
+ export interface RatingGroupControlProps extends HtmlProps<'div'> {
6
+ asChild?: Snippet<[attrs: Omit<GenericHtmlProps, 'children'>]>;
7
+ }
5
8
  </script>
6
9
 
7
10
  <script lang="ts">
8
- import {mergeProps} from '@zag-js/svelte';
11
+ import {mergeProps} from '../utils.svelte.js';
9
12
  import {ratingGroupContext} from './context.svelte.js';
10
13
 
11
- let {children, ...props}: RatingGroupControlProps = $props();
14
+ let {asChild, children, ...props}: RatingGroupControlProps = $props();
12
15
 
13
- let radioGroup = ratingGroupContext.get();
16
+ let ratingGroup = ratingGroupContext.get();
14
17
 
15
- let attrs = $derived(mergeProps(props, radioGroup.getControlProps()));
18
+ let attrs = $derived(mergeProps(props, ratingGroup.getControlProps()));
16
19
  </script>
17
20
 
18
- <div {...attrs}>
19
- {@render children?.()}
20
- </div>
21
+ {#if asChild}
22
+ {@render asChild(attrs)}
23
+ {:else}
24
+ <div {...attrs}>
25
+ {@render children?.()}
26
+ </div>
27
+ {/if}
@@ -5,7 +5,7 @@
5
5
  </script>
6
6
 
7
7
  <script lang="ts">
8
- import {mergeProps} from '@zag-js/svelte';
8
+ import {mergeProps} from '../utils.svelte.js';
9
9
  import {ratingGroupContext} from './context.svelte.js';
10
10
 
11
11
  let {...props}: RatingGroupHiddenInputProps = $props();
@@ -1,26 +1,31 @@
1
1
  <script lang="ts" module>
2
- import type {Assign, HtmlProps} from '../types.js';
2
+ import type {Assign, GenericHtmlProps, HtmlProps} from '../types.js';
3
3
  import type {ItemProps, ItemState} from '@zag-js/rating-group';
4
4
  import type {Snippet} from 'svelte';
5
5
 
6
6
  export interface RatingGroupItemProps
7
7
  extends Assign<Omit<HtmlProps<'div'>, 'children'>, ItemProps> {
8
+ asChild?: Snippet<[attrs: Omit<GenericHtmlProps, 'children'>, state: ItemState]>;
8
9
  children: Snippet<[state: ItemState]>;
9
10
  }
10
11
  </script>
11
12
 
12
13
  <script lang="ts">
13
- import {mergeProps} from '@zag-js/svelte';
14
+ import {mergeProps} from '../utils.svelte.js';
14
15
  import {ratingGroupContext} from './context.svelte.js';
15
16
 
16
- let {index, children, ...props}: RatingGroupItemProps = $props();
17
+ let {index, asChild, children, ...props}: RatingGroupItemProps = $props();
17
18
 
18
- let radioGroup = ratingGroupContext.get();
19
+ let ratingGroup = ratingGroupContext.get();
19
20
 
20
- let state = $derived(radioGroup.getItemState({index}));
21
- let attrs = $derived(mergeProps(props, radioGroup.getItemProps({index})));
21
+ let state = $derived(ratingGroup.getItemState({index}));
22
+ let attrs = $derived(mergeProps(props, ratingGroup.getItemProps({index})));
22
23
  </script>
23
24
 
24
- <div {...attrs}>
25
- {@render children?.(state)}
26
- </div>
25
+ {#if asChild}
26
+ {@render asChild(attrs, state)}
27
+ {:else}
28
+ <div {...attrs}>
29
+ {@render children(state)}
30
+ </div>
31
+ {/if}
@@ -1,20 +1,27 @@
1
1
  <script lang="ts" module>
2
2
  import type {HtmlProps} from '../types.js';
3
+ import type {Snippet} from 'svelte';
3
4
 
4
- export interface RatingGroupLabelProps extends HtmlProps<'label'> {}
5
+ export interface RatingGroupLabelProps extends HtmlProps<'label'> {
6
+ asChild?: Snippet<[attrs: Omit<HtmlProps<'label'>, 'children'>]>;
7
+ }
5
8
  </script>
6
9
 
7
10
  <script lang="ts">
8
- import {mergeProps} from '@zag-js/svelte';
11
+ import {mergeProps} from '../utils.svelte.js';
9
12
  import {ratingGroupContext} from './context.svelte.js';
10
13
 
11
- let {children, ...props}: RatingGroupLabelProps = $props();
14
+ let {asChild, children, ...props}: RatingGroupLabelProps = $props();
12
15
 
13
- let radioGroup = ratingGroupContext.get();
16
+ let ratingGroup = ratingGroupContext.get();
14
17
 
15
- let attrs = $derived(mergeProps(props, radioGroup.getLabelProps()));
18
+ let attrs = $derived(mergeProps(props, ratingGroup.getLabelProps()));
16
19
  </script>
17
20
 
18
- <label {...attrs}>
19
- {@render children?.()}
20
- </label>
21
+ {#if asChild}
22
+ {@render asChild(attrs)}
23
+ {:else}
24
+ <label {...attrs}>
25
+ {@render children?.()}
26
+ </label>
27
+ {/if}
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" module>
2
- import type {Assign, HtmlProps} from '../types.js';
2
+ import type {Assign, GenericHtmlProps, HtmlProps} from '../types.js';
3
3
  import type {Snippet} from 'svelte';
4
4
  import type {
5
5
  CreateRatingGroupProps,
@@ -8,12 +8,15 @@
8
8
 
9
9
  export interface RatingGroupProps
10
10
  extends Assign<Omit<HtmlProps<'div'>, 'children'>, CreateRatingGroupProps> {
11
- children?: Snippet<[radioGroup: CreateRatingGroupReturn]>;
11
+ asChild?: Snippet<
12
+ [attrs: Omit<GenericHtmlProps, 'children'>, ratingGroup: CreateRatingGroupReturn]
13
+ >;
14
+ children?: Snippet<[ratingGroup: CreateRatingGroupReturn]>;
12
15
  }
13
16
  </script>
14
17
 
15
18
  <script lang="ts">
16
- import {mergeProps} from '@zag-js/svelte';
19
+ import {mergeProps} from '../utils.svelte.js';
17
20
  import {ratingGroupContext} from './context.svelte.js';
18
21
  import {createRatingGroup} from './create-rating-group.svelte.js';
19
22
 
@@ -32,11 +35,12 @@
32
35
  translations,
33
36
  onHoverChange,
34
37
  onValueChange,
38
+ asChild,
35
39
  children,
36
40
  ...props
37
41
  }: RatingGroupProps = $props();
38
42
 
39
- let radioGroup = createRatingGroup({
43
+ let ratingGroup = createRatingGroup({
40
44
  id,
41
45
  ids,
42
46
  form,
@@ -53,11 +57,15 @@
53
57
  onValueChange,
54
58
  });
55
59
 
56
- let attrs = $derived(mergeProps(props, radioGroup.getRootProps()));
60
+ let attrs = $derived(mergeProps(props, ratingGroup.getRootProps()));
57
61
 
58
- ratingGroupContext.set(radioGroup);
62
+ ratingGroupContext.set(ratingGroup);
59
63
  </script>
60
64
 
61
- <div {...attrs}>
62
- {@render children?.(radioGroup)}
63
- </div>
65
+ {#if asChild}
66
+ {@render asChild(attrs, ratingGroup)}
67
+ {:else}
68
+ <div {...attrs}>
69
+ {@render children?.(ratingGroup)}
70
+ </div>
71
+ {/if}
@@ -1,22 +1,28 @@
1
1
  <script lang="ts" module>
2
- import type {HtmlProps} from '../types.js';
2
+ import type {GenericHtmlProps, HtmlProps} from '../types.js';
3
+ import type {Snippet} from 'svelte';
3
4
 
4
- export interface SegmentGroupIndicatorProps extends HtmlProps<'span'> {}
5
+ export interface SegmentGroupIndicatorProps extends HtmlProps<'div'> {
6
+ asChild?: Snippet<[attrs: Omit<GenericHtmlProps, 'children'>]>;
7
+ }
5
8
  </script>
6
9
 
7
10
  <script lang="ts">
8
- import {ensureStyleIsString} from '../utils.svelte.js';
9
- import {mergeProps} from '@zag-js/svelte';
11
+ import {mergeProps} from '../utils.svelte.js';
10
12
  import {parts} from './anatomy.js';
11
13
  import {segmentGroupContext} from './context.svelte.js';
12
14
 
13
- let {children, ...props}: SegmentGroupIndicatorProps = $props();
15
+ let {asChild, children, ...props}: SegmentGroupIndicatorProps = $props();
14
16
 
15
17
  let segmentGroup = segmentGroupContext.get();
16
18
 
17
19
  let attrs = $derived(mergeProps(props, segmentGroup.getIndicatorProps(), parts.indicator.attrs));
18
20
  </script>
19
21
 
20
- <span {...ensureStyleIsString(attrs)}>
21
- {@render children?.()}
22
- </span>
22
+ {#if asChild}
23
+ {@render asChild(attrs)}
24
+ {:else}
25
+ <div {...attrs}>
26
+ {@render children?.()}
27
+ </div>
28
+ {/if}
@@ -1,16 +1,19 @@
1
1
  <script lang="ts" module>
2
- import type {HtmlProps} from '../types.js';
2
+ import type {Snippet} from 'svelte';
3
3
 
4
- export interface SegmentGroupItemControlProps extends HtmlProps<'div'> {}
4
+ import type {GenericHtmlProps, HtmlProps} from '../types.js';
5
+
6
+ export interface SegmentGroupItemControlProps extends HtmlProps<'div'> {
7
+ asChild?: Snippet<[attrs: Omit<GenericHtmlProps, 'children'>]>;
8
+ }
5
9
  </script>
6
10
 
7
11
  <script lang="ts">
8
- import {ensureStyleIsString} from '../utils.svelte.js';
9
- import {mergeProps} from '@zag-js/svelte';
12
+ import {mergeProps} from '../utils.svelte.js';
10
13
  import {parts} from './anatomy.js';
11
14
  import {segmentGroupContext, segmentGroupItemPropsContext} from './context.svelte.js';
12
15
 
13
- let {children, ...props}: SegmentGroupItemControlProps = $props();
16
+ let {asChild, children, ...props}: SegmentGroupItemControlProps = $props();
14
17
 
15
18
  let segmentGroup = segmentGroupContext.get();
16
19
  let itemProps = segmentGroupItemPropsContext.get();
@@ -20,6 +23,10 @@
20
23
  );
21
24
  </script>
22
25
 
23
- <div {...ensureStyleIsString(attrs)}>
24
- {@render children?.()}
25
- </div>
26
+ {#if asChild}
27
+ {@render asChild(attrs)}
28
+ {:else}
29
+ <div {...attrs}>
30
+ {@render children?.()}
31
+ </div>
32
+ {/if}
@@ -5,7 +5,7 @@
5
5
  </script>
6
6
 
7
7
  <script lang="ts">
8
- import {mergeProps} from '@zag-js/svelte';
8
+ import {mergeProps} from '../utils.svelte.js';
9
9
  import {segmentGroupContext, segmentGroupItemPropsContext} from './context.svelte.js';
10
10
 
11
11
  let {...props}: SegmentGroupItemHiddenInputProps = $props();
@@ -1,16 +1,18 @@
1
1
  <script lang="ts" module>
2
- import type {HtmlProps} from '../types.js';
2
+ import type {GenericHtmlProps, HtmlProps} from '../types.js';
3
+ import type {Snippet} from 'svelte';
3
4
 
4
- export interface SegmentGroupItemTextProps extends HtmlProps<'span'> {}
5
+ export interface SegmentGroupItemTextProps extends HtmlProps<'div'> {
6
+ asChild?: Snippet<[attrs: Omit<GenericHtmlProps, 'children'>]>;
7
+ }
5
8
  </script>
6
9
 
7
10
  <script lang="ts">
8
- import {ensureStyleIsString} from '../utils.svelte.js';
9
- import {mergeProps} from '@zag-js/svelte';
11
+ import {mergeProps} from '../utils.svelte.js';
10
12
  import {parts} from './anatomy.js';
11
13
  import {segmentGroupContext, segmentGroupItemPropsContext} from './context.svelte.js';
12
14
 
13
- let {children, ...props}: SegmentGroupItemTextProps = $props();
15
+ let {asChild, children, ...props}: SegmentGroupItemTextProps = $props();
14
16
 
15
17
  let segmentGroup = segmentGroupContext.get();
16
18
  let itemProps = segmentGroupItemPropsContext.get();
@@ -20,6 +22,10 @@
20
22
  );
21
23
  </script>
22
24
 
23
- <span {...ensureStyleIsString(attrs)}>
24
- {@render children?.()}
25
- </span>
25
+ {#if asChild}
26
+ {@render asChild(attrs)}
27
+ {:else}
28
+ <div {...attrs}>
29
+ {@render children?.()}
30
+ </div>
31
+ {/if}
@@ -5,13 +5,13 @@
5
5
 
6
6
  export interface SegmentGroupItemProps
7
7
  extends Assign<Omit<HtmlProps<'label'>, 'children'>, ItemProps> {
8
+ asChild?: Snippet<[attrs: Omit<HtmlProps<'label'>, 'children'>, state: ItemState]>;
8
9
  children?: Snippet<[state: ItemState]>;
9
10
  }
10
11
  </script>
11
12
 
12
13
  <script lang="ts">
13
- import {ensureStyleIsString} from '../utils.svelte.js';
14
- import {mergeProps} from '@zag-js/svelte';
14
+ import {mergeProps} from '../utils.svelte.js';
15
15
  import {parts} from './anatomy.js';
16
16
  import {segmentGroupContext, segmentGroupItemPropsContext} from './context.svelte.js';
17
17
 
@@ -21,6 +21,7 @@
21
21
  invalid,
22
22
  disabled,
23
23
  children,
24
+ asChild,
24
25
  ...props
25
26
  }: SegmentGroupItemProps = $props();
26
27
 
@@ -37,6 +38,10 @@
37
38
  segmentGroupItemPropsContext.set(() => itemProps);
38
39
  </script>
39
40
 
40
- <label {...ensureStyleIsString(attrs)}>
41
- {@render children?.(state)}
42
- </label>
41
+ {#if asChild}
42
+ {@render asChild(attrs, state)}
43
+ {:else}
44
+ <label {...attrs}>
45
+ {@render children?.(state)}
46
+ </label>
47
+ {/if}