@spark-ui/components 17.2.1-beta.1 → 17.2.2

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 (530) hide show
  1. package/dist/radio-group/index.js +1 -1
  2. package/dist/radio-group/index.js.map +1 -1
  3. package/dist/radio-group/index.mjs +129 -123
  4. package/dist/radio-group/index.mjs.map +1 -1
  5. package/dist/segmented-control/index.js +1 -1
  6. package/dist/segmented-control/index.js.map +1 -1
  7. package/dist/segmented-control/index.mjs +128 -116
  8. package/dist/segmented-control/index.mjs.map +1 -1
  9. package/package.json +4 -5
  10. package/dist/accordion/Accordion.d.ts +0 -27
  11. package/dist/accordion/AccordionItem.d.ts +0 -12
  12. package/dist/accordion/AccordionItemContent.d.ts +0 -12
  13. package/dist/accordion/AccordionItemHeader.d.ts +0 -9
  14. package/dist/accordion/AccordionItemTrigger.d.ts +0 -12
  15. package/dist/accordion/index.d.mts +0 -15
  16. package/dist/accordion/index.d.ts +0 -15
  17. package/dist/accordion/useRenderSlot.d.ts +0 -3
  18. package/dist/alert-dialog/AlertDialog.d.ts +0 -29
  19. package/dist/alert-dialog/AlertDialogAction.d.ts +0 -13
  20. package/dist/alert-dialog/AlertDialogBody.d.ts +0 -12
  21. package/dist/alert-dialog/AlertDialogCancel.d.ts +0 -13
  22. package/dist/alert-dialog/AlertDialogContent.d.ts +0 -9
  23. package/dist/alert-dialog/AlertDialogContext.d.ts +0 -12
  24. package/dist/alert-dialog/AlertDialogDescription.d.ts +0 -9
  25. package/dist/alert-dialog/AlertDialogFooter.d.ts +0 -10
  26. package/dist/alert-dialog/AlertDialogHeader.d.ts +0 -10
  27. package/dist/alert-dialog/AlertDialogOverlay.d.ts +0 -9
  28. package/dist/alert-dialog/AlertDialogPortal.d.ts +0 -7
  29. package/dist/alert-dialog/AlertDialogTitle.d.ts +0 -9
  30. package/dist/alert-dialog/AlertDialogTrigger.d.ts +0 -13
  31. package/dist/alert-dialog/index.d.mts +0 -38
  32. package/dist/alert-dialog/index.d.ts +0 -38
  33. package/dist/alert-dialog/useRenderSlot.d.ts +0 -3
  34. package/dist/avatar/Avatar.d.ts +0 -3
  35. package/dist/avatar/AvatarAction.d.ts +0 -9
  36. package/dist/avatar/AvatarImage.d.ts +0 -7
  37. package/dist/avatar/AvatarOnlineBadge.d.ts +0 -9
  38. package/dist/avatar/AvatarPlaceholder.d.ts +0 -8
  39. package/dist/avatar/AvatarUser.d.ts +0 -7
  40. package/dist/avatar/context.d.ts +0 -5
  41. package/dist/avatar/index.d.mts +0 -15
  42. package/dist/avatar/index.d.ts +0 -15
  43. package/dist/avatar/types.d.ts +0 -24
  44. package/dist/badge/Badge.d.ts +0 -9
  45. package/dist/badge/BadgeItem.d.ts +0 -31
  46. package/dist/badge/BadgeItem.styles.d.ts +0 -7
  47. package/dist/badge/index.d.mts +0 -1
  48. package/dist/badge/index.d.ts +0 -1
  49. package/dist/breadcrumb/Breadcrumb.d.ts +0 -10
  50. package/dist/breadcrumb/Breadcrumb.styles.d.ts +0 -0
  51. package/dist/breadcrumb/BreadcrumbCurrentPage.d.ts +0 -11
  52. package/dist/breadcrumb/BreadcrumbItem.d.ts +0 -9
  53. package/dist/breadcrumb/BreadcrumbLink.d.ts +0 -12
  54. package/dist/breadcrumb/BreadcrumbSeparator.d.ts +0 -10
  55. package/dist/breadcrumb/index.d.mts +0 -12
  56. package/dist/breadcrumb/index.d.ts +0 -12
  57. package/dist/button/Button.d.ts +0 -26
  58. package/dist/button/Button.styles.d.ts +0 -10
  59. package/dist/button/index.d.mts +0 -1
  60. package/dist/button/index.d.ts +0 -1
  61. package/dist/button/variants/contrast.d.ts +0 -41
  62. package/dist/button/variants/filled.d.ts +0 -41
  63. package/dist/button/variants/ghost.d.ts +0 -41
  64. package/dist/button/variants/index.d.mts +0 -5
  65. package/dist/button/variants/index.d.ts +0 -5
  66. package/dist/button/variants/outlined.d.ts +0 -41
  67. package/dist/button/variants/tinted.d.ts +0 -41
  68. package/dist/card/Backdrop.d.ts +0 -14
  69. package/dist/card/Card.d.ts +0 -16
  70. package/dist/card/Card.styles.d.ts +0 -7
  71. package/dist/card/Content.d.ts +0 -15
  72. package/dist/card/Content.styles.d.ts +0 -8
  73. package/dist/card/context.d.ts +0 -11
  74. package/dist/card/index.d.mts +0 -8
  75. package/dist/card/index.d.ts +0 -8
  76. package/dist/card/utils.d.ts +0 -3
  77. package/dist/carousel/Carousel.d.ts +0 -12
  78. package/dist/carousel/CarouselControls.d.ts +0 -9
  79. package/dist/carousel/CarouselNextButton.d.ts +0 -5
  80. package/dist/carousel/CarouselPageIndicator.d.ts +0 -14
  81. package/dist/carousel/CarouselPagePicker.d.ts +0 -14
  82. package/dist/carousel/CarouselPrevButton.d.ts +0 -5
  83. package/dist/carousel/CarouselSlide.d.ts +0 -12
  84. package/dist/carousel/CarouselSlides.d.ts +0 -10
  85. package/dist/carousel/CarouselViewport.d.ts +0 -9
  86. package/dist/carousel/index.d.mts +0 -19
  87. package/dist/carousel/index.d.ts +0 -19
  88. package/dist/carousel/types.d.ts +0 -165
  89. package/dist/carousel/useCarousel.d.ts +0 -2
  90. package/dist/carousel/useCarouselVisibility.d.ts +0 -13
  91. package/dist/carousel/useEvent.d.ts +0 -7
  92. package/dist/carousel/useIsMounted.d.ts +0 -1
  93. package/dist/carousel/useIsVisible.d.ts +0 -6
  94. package/dist/carousel/useResizeObserver.d.ts +0 -2
  95. package/dist/carousel/useScrollEnd.d.ts +0 -3
  96. package/dist/carousel/useSnapPoints.d.ts +0 -10
  97. package/dist/carousel/utils.d.ts +0 -24
  98. package/dist/checkbox/Checkbox.d.ts +0 -10
  99. package/dist/checkbox/CheckboxGroup.d.ts +0 -18
  100. package/dist/checkbox/CheckboxGroup.styles.d.ts +0 -5
  101. package/dist/checkbox/CheckboxGroupContext.d.ts +0 -41
  102. package/dist/checkbox/CheckboxIndicator.d.ts +0 -9
  103. package/dist/checkbox/CheckboxInput.d.ts +0 -47
  104. package/dist/checkbox/CheckboxInput.styles.d.ts +0 -5
  105. package/dist/checkbox/CheckboxLabel.d.ts +0 -12
  106. package/dist/checkbox/CheckboxLabel.styles.d.ts +0 -5
  107. package/dist/checkbox/index.d.mts +0 -2
  108. package/dist/checkbox/index.d.ts +0 -2
  109. package/dist/chip/Chip.d.ts +0 -34
  110. package/dist/chip/Chip.styles.d.ts +0 -8
  111. package/dist/chip/ChipClearButton.d.ts +0 -10
  112. package/dist/chip/ChipClearButton.styles.d.ts +0 -10
  113. package/dist/chip/ChipContent.d.ts +0 -8
  114. package/dist/chip/ChipIcon.d.ts +0 -8
  115. package/dist/chip/ChipLeadingIcon.d.ts +0 -9
  116. package/dist/chip/ChipTrailingIcon.d.ts +0 -9
  117. package/dist/chip/index.d.mts +0 -15
  118. package/dist/chip/index.d.ts +0 -15
  119. package/dist/chip/useChipContext.d.ts +0 -4
  120. package/dist/chip/useChipElement.d.ts +0 -41
  121. package/dist/chip/variants/dashed.d.ts +0 -45
  122. package/dist/chip/variants/index.d.mts +0 -3
  123. package/dist/chip/variants/index.d.ts +0 -3
  124. package/dist/chip/variants/outlined.d.ts +0 -45
  125. package/dist/chip/variants/tinted.d.ts +0 -45
  126. package/dist/circular-meter/CircularMeter.d.ts +0 -34
  127. package/dist/circular-meter/CircularMeter.styles.d.ts +0 -5
  128. package/dist/circular-meter/CircularMeterContent.d.ts +0 -6
  129. package/dist/circular-meter/CircularMeterContext.d.ts +0 -36
  130. package/dist/circular-meter/CircularMeterLabel.d.ts +0 -7
  131. package/dist/circular-meter/CircularMeterTrack.d.ts +0 -8
  132. package/dist/circular-meter/CircularMeterValue.d.ts +0 -7
  133. package/dist/circular-meter/index.d.mts +0 -16
  134. package/dist/circular-meter/index.d.ts +0 -16
  135. package/dist/circular-meter/useIntersectionAnimation.d.ts +0 -26
  136. package/dist/collapsible/Content.d.ts +0 -12
  137. package/dist/collapsible/Root.d.ts +0 -12
  138. package/dist/collapsible/Trigger.d.ts +0 -11
  139. package/dist/collapsible/index.d.mts +0 -7
  140. package/dist/collapsible/index.d.ts +0 -7
  141. package/dist/collapsible/useRenderSlot.d.ts +0 -3
  142. package/dist/combobox/Combobox.d.ts +0 -6
  143. package/dist/combobox/ComboboxClearButton.d.ts +0 -9
  144. package/dist/combobox/ComboboxContext.d.ts +0 -108
  145. package/dist/combobox/ComboboxDisclosure.d.ts +0 -13
  146. package/dist/combobox/ComboboxEmpty.d.ts +0 -11
  147. package/dist/combobox/ComboboxGroup.d.ts +0 -11
  148. package/dist/combobox/ComboboxInput.d.ts +0 -15
  149. package/dist/combobox/ComboboxItem.d.ts +0 -12
  150. package/dist/combobox/ComboboxItemContext.d.ts +0 -17
  151. package/dist/combobox/ComboboxItemIndicator.d.ts +0 -11
  152. package/dist/combobox/ComboboxItemText.d.ts +0 -10
  153. package/dist/combobox/ComboboxItems.d.ts +0 -11
  154. package/dist/combobox/ComboboxItemsGroupContext.d.ts +0 -8
  155. package/dist/combobox/ComboboxLabel.d.ts +0 -11
  156. package/dist/combobox/ComboboxLeadingIcon.d.ts +0 -7
  157. package/dist/combobox/ComboboxPopover.d.ts +0 -10
  158. package/dist/combobox/ComboboxPortal.d.ts +0 -2
  159. package/dist/combobox/ComboboxSelectedItems.d.ts +0 -4
  160. package/dist/combobox/ComboboxTrigger.d.ts +0 -11
  161. package/dist/combobox/ComboboxTrigger.styles.d.ts +0 -6
  162. package/dist/combobox/index.d.mts +0 -35
  163. package/dist/combobox/index.d.ts +0 -35
  164. package/dist/combobox/tests/test-utils.d.ts +0 -8
  165. package/dist/combobox/types.d.ts +0 -8
  166. package/dist/combobox/useCombobox/multipleSelectionReducer.d.ts +0 -13
  167. package/dist/combobox/useCombobox/singleSelectionReducer.d.ts +0 -8
  168. package/dist/combobox/utils/index.d.mts +0 -14
  169. package/dist/combobox/utils/index.d.ts +0 -14
  170. package/dist/combobox/utils/useWidthIncreaseCallback.d.ts +0 -2
  171. package/dist/dialog/Dialog.d.ts +0 -33
  172. package/dist/dialog/DialogBody.d.ts +0 -12
  173. package/dist/dialog/DialogClose.d.ts +0 -10
  174. package/dist/dialog/DialogCloseButton.d.ts +0 -9
  175. package/dist/dialog/DialogContent.d.ts +0 -14
  176. package/dist/dialog/DialogContent.styles.d.ts +0 -6
  177. package/dist/dialog/DialogContext.d.ts +0 -11
  178. package/dist/dialog/DialogDescription.d.ts +0 -9
  179. package/dist/dialog/DialogFooter.d.ts +0 -10
  180. package/dist/dialog/DialogHeader.d.ts +0 -10
  181. package/dist/dialog/DialogOverlay.d.ts +0 -9
  182. package/dist/dialog/DialogPortal.d.ts +0 -7
  183. package/dist/dialog/DialogTitle.d.ts +0 -9
  184. package/dist/dialog/DialogTrigger.d.ts +0 -13
  185. package/dist/dialog/index.d.mts +0 -37
  186. package/dist/dialog/index.d.ts +0 -37
  187. package/dist/divider/Divider.d.ts +0 -30
  188. package/dist/divider/Divider.styles.d.ts +0 -9
  189. package/dist/divider/DividerContent.d.ts +0 -13
  190. package/dist/divider/index.d.mts +0 -6
  191. package/dist/divider/index.d.ts +0 -6
  192. package/dist/divider/variants/intents.d.ts +0 -17
  193. package/dist/drawer/Drawer.d.ts +0 -32
  194. package/dist/drawer/DrawerBody.d.ts +0 -11
  195. package/dist/drawer/DrawerBody.styles.d.ts +0 -5
  196. package/dist/drawer/DrawerClose.d.ts +0 -13
  197. package/dist/drawer/DrawerCloseButton.d.ts +0 -7
  198. package/dist/drawer/DrawerContent.d.ts +0 -10
  199. package/dist/drawer/DrawerContent.styles.d.ts +0 -6
  200. package/dist/drawer/DrawerContext.d.ts +0 -9
  201. package/dist/drawer/DrawerDescription.d.ts +0 -9
  202. package/dist/drawer/DrawerFooter.d.ts +0 -8
  203. package/dist/drawer/DrawerHeader.d.ts +0 -10
  204. package/dist/drawer/DrawerOverlay.d.ts +0 -9
  205. package/dist/drawer/DrawerPortal.d.ts +0 -7
  206. package/dist/drawer/DrawerTitle.d.ts +0 -9
  207. package/dist/drawer/DrawerTrigger.d.ts +0 -13
  208. package/dist/drawer/index.d.mts +0 -37
  209. package/dist/drawer/index.d.ts +0 -37
  210. package/dist/drawer/useRenderSlot.d.ts +0 -3
  211. package/dist/dropdown/Dropdown.d.ts +0 -6
  212. package/dist/dropdown/DropdownContext.d.ts +0 -81
  213. package/dist/dropdown/DropdownDivider.d.ts +0 -10
  214. package/dist/dropdown/DropdownGroup.d.ts +0 -11
  215. package/dist/dropdown/DropdownItem.d.ts +0 -12
  216. package/dist/dropdown/DropdownItemContext.d.ts +0 -17
  217. package/dist/dropdown/DropdownItemIndicator.d.ts +0 -11
  218. package/dist/dropdown/DropdownItemText.d.ts +0 -9
  219. package/dist/dropdown/DropdownItems.d.ts +0 -21
  220. package/dist/dropdown/DropdownItemsGroupContext.d.ts +0 -8
  221. package/dist/dropdown/DropdownLabel.d.ts +0 -11
  222. package/dist/dropdown/DropdownLeadingIcon.d.ts +0 -7
  223. package/dist/dropdown/DropdownPopover.d.ts +0 -6
  224. package/dist/dropdown/DropdownPortal.d.ts +0 -2
  225. package/dist/dropdown/DropdownTrigger.d.ts +0 -12
  226. package/dist/dropdown/DropdownTrigger.styles.d.ts +0 -5
  227. package/dist/dropdown/DropdownValue.d.ts +0 -11
  228. package/dist/dropdown/index.d.mts +0 -29
  229. package/dist/dropdown/index.d.ts +0 -29
  230. package/dist/dropdown/types.d.ts +0 -8
  231. package/dist/dropdown/useDropdown.d.ts +0 -41
  232. package/dist/dropdown/utils.d.ts +0 -13
  233. package/dist/file-upload/FileUpload.d.ts +0 -130
  234. package/dist/file-upload/FileUploadAcceptedFile.d.ts +0 -25
  235. package/dist/file-upload/FileUploadContext.d.ts +0 -17
  236. package/dist/file-upload/FileUploadDropzone.d.ts +0 -10
  237. package/dist/file-upload/FileUploadItemDeleteTrigger.d.ts +0 -11
  238. package/dist/file-upload/FileUploadPreviewImage.d.ts +0 -17
  239. package/dist/file-upload/FileUploadRejectedFile.d.ts +0 -24
  240. package/dist/file-upload/FileUploadRejectedFileDeleteTrigger.d.ts +0 -12
  241. package/dist/file-upload/FileUploadTrigger.d.ts +0 -12
  242. package/dist/file-upload/constants.d.ts +0 -29
  243. package/dist/file-upload/index.d.mts +0 -22
  244. package/dist/file-upload/index.d.ts +0 -22
  245. package/dist/file-upload/test-utils.d.ts +0 -9
  246. package/dist/file-upload/useFileUploadState.d.ts +0 -88
  247. package/dist/file-upload/utils.d.ts +0 -40
  248. package/dist/form-field/FormField.d.ts +0 -21
  249. package/dist/form-field/FormFieldAlertMessage.d.ts +0 -9
  250. package/dist/form-field/FormFieldCharactersCount.d.ts +0 -26
  251. package/dist/form-field/FormFieldContext.d.ts +0 -49
  252. package/dist/form-field/FormFieldControl.d.ts +0 -12
  253. package/dist/form-field/FormFieldErrorMessage.d.ts +0 -9
  254. package/dist/form-field/FormFieldHelperMessage.d.ts +0 -9
  255. package/dist/form-field/FormFieldLabel.d.ts +0 -13
  256. package/dist/form-field/FormFieldMessage.d.ts +0 -8
  257. package/dist/form-field/FormFieldProvider.d.ts +0 -9
  258. package/dist/form-field/FormFieldRequiredIndicator.d.ts +0 -9
  259. package/dist/form-field/FormFieldStateMessage.d.ts +0 -10
  260. package/dist/form-field/FormFieldSuccessMessage.d.ts +0 -9
  261. package/dist/form-field/index.d.mts +0 -31
  262. package/dist/form-field/index.d.ts +0 -31
  263. package/dist/icon/Icon.d.ts +0 -17
  264. package/dist/icon/Icon.styles.d.ts +0 -6
  265. package/dist/icon/index.d.mts +0 -1
  266. package/dist/icon/index.d.ts +0 -1
  267. package/dist/icon-button/IconButton.d.ts +0 -10
  268. package/dist/icon-button/IconButton.styles.d.ts +0 -5
  269. package/dist/icon-button/index.d.mts +0 -1
  270. package/dist/icon-button/index.d.ts +0 -1
  271. package/dist/input/Input.d.ts +0 -14
  272. package/dist/input/Input.styles.d.ts +0 -11
  273. package/dist/input/InputAddon.d.ts +0 -9
  274. package/dist/input/InputAddon.styles.d.ts +0 -9
  275. package/dist/input/InputClearButton.d.ts +0 -12
  276. package/dist/input/InputGroup.d.ts +0 -17
  277. package/dist/input/InputGroup.styles.d.ts +0 -6
  278. package/dist/input/InputGroupContext.d.ts +0 -14
  279. package/dist/input/InputIcon.d.ts +0 -6
  280. package/dist/input/InputLeadingAddon.d.ts +0 -11
  281. package/dist/input/InputLeadingIcon.d.ts +0 -7
  282. package/dist/input/InputTrailingAddon.d.ts +0 -11
  283. package/dist/input/InputTrailingIcon.d.ts +0 -7
  284. package/dist/input/index.d.mts +0 -21
  285. package/dist/input/index.d.ts +0 -21
  286. package/dist/input-otp/InputOTP.d.ts +0 -90
  287. package/dist/input-otp/InputOTP.styles.d.ts +0 -10
  288. package/dist/input-otp/InputOTPContext.d.ts +0 -17
  289. package/dist/input-otp/InputOTPGroup.d.ts +0 -7
  290. package/dist/input-otp/InputOTPSeparator.d.ts +0 -7
  291. package/dist/input-otp/InputOTPSlot.d.ts +0 -12
  292. package/dist/input-otp/index.d.mts +0 -14
  293. package/dist/input-otp/index.d.ts +0 -14
  294. package/dist/input-otp/useInputOTP.d.ts +0 -48
  295. package/dist/kbd/Kbd.d.ts +0 -5
  296. package/dist/kbd/index.d.mts +0 -1
  297. package/dist/kbd/index.d.ts +0 -1
  298. package/dist/label/Label.d.ts +0 -9
  299. package/dist/label/LabelRequiredIndicator.d.ts +0 -6
  300. package/dist/label/index.d.mts +0 -7
  301. package/dist/label/index.d.ts +0 -7
  302. package/dist/link-box/LinkBox.d.ts +0 -8
  303. package/dist/link-box/LinkBoxLink.d.ts +0 -8
  304. package/dist/link-box/LinkBoxRaised.d.ts +0 -9
  305. package/dist/link-box/index.d.mts +0 -9
  306. package/dist/link-box/index.d.ts +0 -9
  307. package/dist/meter/Meter.d.ts +0 -18
  308. package/dist/meter/MeterContext.d.ts +0 -12
  309. package/dist/meter/MeterLabel.d.ts +0 -7
  310. package/dist/meter/MeterTrack.d.ts +0 -7
  311. package/dist/meter/MeterTrack.styles.d.ts +0 -8
  312. package/dist/meter/MeterValue.d.ts +0 -9
  313. package/dist/meter/index.d.mts +0 -13
  314. package/dist/meter/index.d.ts +0 -13
  315. package/dist/meter/useIntersectionAnimation.d.ts +0 -26
  316. package/dist/pagination/Pagination.d.ts +0 -8
  317. package/dist/pagination/PaginationContext.d.ts +0 -43
  318. package/dist/pagination/PaginationEllipsis.d.ts +0 -9
  319. package/dist/pagination/PaginationFirstPageTrigger.d.ts +0 -22
  320. package/dist/pagination/PaginationItem.d.ts +0 -31
  321. package/dist/pagination/PaginationLastPageTrigger.d.ts +0 -22
  322. package/dist/pagination/PaginationNextTrigger.d.ts +0 -22
  323. package/dist/pagination/PaginationPages.d.ts +0 -16
  324. package/dist/pagination/PaginationPrevTrigger.d.ts +0 -22
  325. package/dist/pagination/index.d.mts +0 -18
  326. package/dist/pagination/index.d.ts +0 -18
  327. package/dist/pagination/utils.d.ts +0 -1
  328. package/dist/popover/Popover.d.ts +0 -9
  329. package/dist/popover/PopoverAnchor.d.ts +0 -9
  330. package/dist/popover/PopoverArrow.d.ts +0 -9
  331. package/dist/popover/PopoverCloseButton.d.ts +0 -10
  332. package/dist/popover/PopoverContent.d.ts +0 -10
  333. package/dist/popover/PopoverContent.styles.d.ts +0 -9
  334. package/dist/popover/PopoverContext.d.ts +0 -15
  335. package/dist/popover/PopoverHeader.d.ts +0 -10
  336. package/dist/popover/PopoverPortal.d.ts +0 -7
  337. package/dist/popover/PopoverTrigger.d.ts +0 -9
  338. package/dist/popover/index.d.mts +0 -17
  339. package/dist/popover/index.d.ts +0 -17
  340. package/dist/portal/Portal.d.ts +0 -10
  341. package/dist/portal/index.d.mts +0 -1
  342. package/dist/portal/index.d.ts +0 -1
  343. package/dist/progress/Progress.d.ts +0 -24
  344. package/dist/progress/ProgressContext.d.ts +0 -13
  345. package/dist/progress/ProgressIndicator.d.ts +0 -13
  346. package/dist/progress/ProgressLabel.d.ts +0 -7
  347. package/dist/progress/ProgressTrack.d.ts +0 -7
  348. package/dist/progress/ProgressValue.d.ts +0 -7
  349. package/dist/progress/index.d.mts +0 -13
  350. package/dist/progress/index.d.ts +0 -13
  351. package/dist/progress-tracker/ProgressTracker.d.ts +0 -27
  352. package/dist/progress-tracker/ProgressTracker.styles.d.ts +0 -1
  353. package/dist/progress-tracker/ProgressTrackerContext.d.ts +0 -15
  354. package/dist/progress-tracker/ProgressTrackerStep.d.ts +0 -12
  355. package/dist/progress-tracker/ProgressTrackerStep.styles.d.ts +0 -10
  356. package/dist/progress-tracker/ProgressTrackerStepIndicator.d.ts +0 -15
  357. package/dist/progress-tracker/ProgressTrackerStepIndicator.styles.d.ts +0 -7
  358. package/dist/progress-tracker/ProgressTrackerStepLabel.d.ts +0 -9
  359. package/dist/progress-tracker/index.d.mts +0 -10
  360. package/dist/progress-tracker/index.d.ts +0 -10
  361. package/dist/radio-group/Radio.d.ts +0 -9
  362. package/dist/radio-group/RadioGroup.d.ts +0 -50
  363. package/dist/radio-group/RadioGroup.styles.d.ts +0 -5
  364. package/dist/radio-group/RadioGroupContext.d.ts +0 -5
  365. package/dist/radio-group/RadioGroupProvider.d.ts +0 -7
  366. package/dist/radio-group/RadioIndicator.d.ts +0 -15
  367. package/dist/radio-group/RadioIndicator.styles.d.ts +0 -5
  368. package/dist/radio-group/RadioInput.d.ts +0 -37
  369. package/dist/radio-group/RadioInput.styles.d.ts +0 -5
  370. package/dist/radio-group/index.d.mts +0 -7
  371. package/dist/radio-group/index.d.ts +0 -7
  372. package/dist/rating/Rating.d.ts +0 -57
  373. package/dist/rating/RatingStar.d.ts +0 -19
  374. package/dist/rating/RatingStar.styles.d.ts +0 -14
  375. package/dist/rating/index.d.mts +0 -1
  376. package/dist/rating/index.d.ts +0 -1
  377. package/dist/rating/types.d.ts +0 -2
  378. package/dist/rating/utils.d.ts +0 -7
  379. package/dist/rating-display/RatingDisplay.d.ts +0 -31
  380. package/dist/rating-display/RatingDisplayContext.d.ts +0 -12
  381. package/dist/rating-display/RatingDisplayCount.d.ts +0 -12
  382. package/dist/rating-display/RatingDisplayStar.d.ts +0 -16
  383. package/dist/rating-display/RatingDisplayStars.d.ts +0 -22
  384. package/dist/rating-display/RatingDisplayValue.d.ts +0 -13
  385. package/dist/rating-display/index.d.mts +0 -14
  386. package/dist/rating-display/index.d.ts +0 -14
  387. package/dist/rating-display/types.d.ts +0 -1
  388. package/dist/rating-display/utils.d.ts +0 -10
  389. package/dist/scrolling-list/ScrollingList.d.ts +0 -57
  390. package/dist/scrolling-list/ScrollingListControls.d.ts +0 -18
  391. package/dist/scrolling-list/ScrollingListItem.d.ts +0 -17
  392. package/dist/scrolling-list/ScrollingListItems.d.ts +0 -11
  393. package/dist/scrolling-list/ScrollingListNextButton.d.ts +0 -5
  394. package/dist/scrolling-list/ScrollingListPrevButton.d.ts +0 -5
  395. package/dist/scrolling-list/ScrollingListSkipButton.d.ts +0 -9
  396. package/dist/scrolling-list/index.d.mts +0 -15
  397. package/dist/scrolling-list/index.d.ts +0 -15
  398. package/dist/scrolling-list/useFocusWithinScroll.d.ts +0 -3
  399. package/dist/segmented-control/SegmentedControl.d.ts +0 -22
  400. package/dist/segmented-control/SegmentedControl.styles.d.ts +0 -5
  401. package/dist/segmented-control/SegmentedControlContext.d.ts +0 -7
  402. package/dist/segmented-control/SegmentedControlIndicator.d.ts +0 -8
  403. package/dist/segmented-control/SegmentedControlItem.d.ts +0 -18
  404. package/dist/segmented-control/index.d.mts +0 -10
  405. package/dist/segmented-control/index.d.ts +0 -10
  406. package/dist/segmented-gauge/SegmentedGauge.d.ts +0 -66
  407. package/dist/segmented-gauge/SegmentedGaugeContext.d.ts +0 -14
  408. package/dist/segmented-gauge/SegmentedGaugeLabel.d.ts +0 -9
  409. package/dist/segmented-gauge/SegmentedGaugeSegment.d.ts +0 -12
  410. package/dist/segmented-gauge/SegmentedGaugeTrack.d.ts +0 -8
  411. package/dist/segmented-gauge/index.d.mts +0 -13
  412. package/dist/segmented-gauge/index.d.ts +0 -13
  413. package/dist/select/Select.d.ts +0 -6
  414. package/dist/select/SelectContext.d.ts +0 -59
  415. package/dist/select/SelectGroup.d.ts +0 -11
  416. package/dist/select/SelectItem.d.ts +0 -11
  417. package/dist/select/SelectItems.d.ts +0 -10
  418. package/dist/select/SelectItemsGroupContext.d.ts +0 -9
  419. package/dist/select/SelectLabel.d.ts +0 -8
  420. package/dist/select/SelectLeadingIcon.d.ts +0 -7
  421. package/dist/select/SelectPlaceholder.d.ts +0 -10
  422. package/dist/select/SelectTrigger.d.ts +0 -16
  423. package/dist/select/SelectTrigger.styles.d.ts +0 -5
  424. package/dist/select/SelectValue.d.ts +0 -15
  425. package/dist/select/index.d.mts +0 -21
  426. package/dist/select/index.d.ts +0 -21
  427. package/dist/select/types.d.ts +0 -6
  428. package/dist/select/utils.d.ts +0 -4
  429. package/dist/skeleton/Skeleton.d.ts +0 -17
  430. package/dist/skeleton/Skeleton.styles.d.ts +0 -5
  431. package/dist/skeleton/SkeletonItem.d.ts +0 -31
  432. package/dist/skeleton/SkeletonItem.styles.d.ts +0 -8
  433. package/dist/skeleton/index.d.mts +0 -8
  434. package/dist/skeleton/index.d.ts +0 -8
  435. package/dist/slider/Slider.d.ts +0 -55
  436. package/dist/slider/Slider.styles.d.ts +0 -1
  437. package/dist/slider/SliderContext.d.ts +0 -13
  438. package/dist/slider/SliderControl.d.ts +0 -7
  439. package/dist/slider/SliderIndicator.d.ts +0 -7
  440. package/dist/slider/SliderLabel.d.ts +0 -13
  441. package/dist/slider/SliderMaxValue.d.ts +0 -6
  442. package/dist/slider/SliderMinValue.d.ts +0 -6
  443. package/dist/slider/SliderThumb.d.ts +0 -7
  444. package/dist/slider/SliderThumb.styles.d.ts +0 -5
  445. package/dist/slider/SliderThumbContext.d.ts +0 -5
  446. package/dist/slider/SliderTrack.d.ts +0 -7
  447. package/dist/slider/SliderTrack.styles.d.ts +0 -6
  448. package/dist/slider/SliderValue.d.ts +0 -12
  449. package/dist/slider/index.d.mts +0 -20
  450. package/dist/slider/index.d.ts +0 -20
  451. package/dist/slider/useSliderValueBoundaries.d.ts +0 -12
  452. package/dist/slot/Slot.d.ts +0 -12
  453. package/dist/slot/index.d.mts +0 -1
  454. package/dist/slot/index.d.ts +0 -1
  455. package/dist/snackbar/Snackbar.d.ts +0 -29
  456. package/dist/snackbar/SnackbarItem.d.ts +0 -49
  457. package/dist/snackbar/SnackbarItem.styles.d.ts +0 -10
  458. package/dist/snackbar/SnackbarItemAction.d.ts +0 -10
  459. package/dist/snackbar/SnackbarItemClose.d.ts +0 -9
  460. package/dist/snackbar/SnackbarItemContext.d.ts +0 -8
  461. package/dist/snackbar/SnackbarItemIcon.d.ts +0 -7
  462. package/dist/snackbar/SnackbarRegion.d.ts +0 -30
  463. package/dist/snackbar/SnackbarRegion.styles.d.ts +0 -5
  464. package/dist/snackbar/index.d.mts +0 -13
  465. package/dist/snackbar/index.d.ts +0 -13
  466. package/dist/snackbar/snackbarVariants.d.ts +0 -74
  467. package/dist/snackbar/useSnackbarGlobalStore.d.ts +0 -18
  468. package/dist/snackbar/useSwipe.d.ts +0 -15
  469. package/dist/spinner/Spinner.d.ts +0 -9
  470. package/dist/spinner/Spinner.styles.d.ts +0 -7
  471. package/dist/spinner/index.d.mts +0 -1
  472. package/dist/spinner/index.d.ts +0 -1
  473. package/dist/stepper/Stepper.d.ts +0 -9
  474. package/dist/stepper/StepperButton.d.ts +0 -14
  475. package/dist/stepper/StepperInput.d.ts +0 -7
  476. package/dist/stepper/index.d.mts +0 -9
  477. package/dist/stepper/index.d.ts +0 -9
  478. package/dist/stepper/types.d.ts +0 -46
  479. package/dist/stepper/useStepper.d.ts +0 -2
  480. package/dist/switch/Switch.d.ts +0 -6
  481. package/dist/switch/SwitchInput.d.ts +0 -53
  482. package/dist/switch/SwitchInput.styles.d.ts +0 -16
  483. package/dist/switch/SwitchLabel.d.ts +0 -17
  484. package/dist/switch/SwitchLabel.styles.d.ts +0 -5
  485. package/dist/switch/index.d.mts +0 -1
  486. package/dist/switch/index.d.ts +0 -1
  487. package/dist/tabs/Tabs.d.ts +0 -24
  488. package/dist/tabs/TabsContent.d.ts +0 -22
  489. package/dist/tabs/TabsContent.styles.d.ts +0 -3
  490. package/dist/tabs/TabsContext.d.ts +0 -7
  491. package/dist/tabs/TabsList.d.ts +0 -20
  492. package/dist/tabs/TabsList.styles.d.ts +0 -3
  493. package/dist/tabs/TabsPopover.d.ts +0 -29
  494. package/dist/tabs/TabsPopoverAbstraction.d.ts +0 -27
  495. package/dist/tabs/TabsRoot.styles.d.ts +0 -1
  496. package/dist/tabs/TabsTrigger.d.ts +0 -41
  497. package/dist/tabs/TabsTrigger.styles.d.ts +0 -8
  498. package/dist/tabs/index.d.mts +0 -13
  499. package/dist/tabs/index.d.ts +0 -13
  500. package/dist/tabs/useRenderSlot.d.ts +0 -1
  501. package/dist/tabs/useResizeObserver.d.ts +0 -8
  502. package/dist/tag/Tag.d.ts +0 -17
  503. package/dist/tag/Tag.styles.d.ts +0 -8
  504. package/dist/tag/index.d.mts +0 -1
  505. package/dist/tag/index.d.ts +0 -1
  506. package/dist/tag/variants/filled.d.ts +0 -37
  507. package/dist/tag/variants/index.d.mts +0 -3
  508. package/dist/tag/variants/index.d.ts +0 -3
  509. package/dist/tag/variants/outlined.d.ts +0 -33
  510. package/dist/tag/variants/tinted.d.ts +0 -33
  511. package/dist/text-link/TextLink.d.ts +0 -16
  512. package/dist/text-link/index.d.mts +0 -1
  513. package/dist/text-link/index.d.ts +0 -1
  514. package/dist/textarea/Textarea.d.ts +0 -14
  515. package/dist/textarea/TextareaClearButton.d.ts +0 -10
  516. package/dist/textarea/TextareaGroup.d.ts +0 -6
  517. package/dist/textarea/TextareaLeadingIcon.d.ts +0 -7
  518. package/dist/textarea/TextareaTrailingIcon.d.ts +0 -7
  519. package/dist/textarea/index.d.mts +0 -14
  520. package/dist/textarea/index.d.ts +0 -14
  521. package/dist/toast/Toast.d.ts +0 -4
  522. package/dist/toast/Toast.styles.d.ts +0 -10
  523. package/dist/toast/index.d.mts +0 -20
  524. package/dist/toast/index.d.ts +0 -20
  525. package/dist/toast/types.d.ts +0 -44
  526. package/dist/toast/useRenderSlot.d.ts +0 -3
  527. package/dist/toast/useToastManager.d.ts +0 -2
  528. package/dist/visually-hidden/VisuallyHidden.d.ts +0 -12
  529. package/dist/visually-hidden/index.d.mts +0 -1
  530. package/dist/visually-hidden/index.d.ts +0 -1
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),u=require("class-variance-authority"),f=require("react"),F=require("../label/index.js"),v=require("@base-ui/react/radio"),R=require("@spark-ui/components/form-field"),x=require("@spark-ui/internal-utils"),V=require("@base-ui/react/radio-group"),k=f.createContext(null),C=()=>{const e=f.useContext(k);if(!e)throw Error("useRadioGroup must be used within a RadioGroup provider");return e},z=u.cva(["relative block","size-3/5","after:absolute","after:left-1/2 after:top-1/2 after:-translate-x-1/2 after:-translate-y-1/2","after:h-0","after:w-0","after:block","after:rounded-[50%]","after:content-['']","after:transition-all","data-checked:after:size-full"],{variants:{intent:x.makeVariants({main:["after:bg-main"],support:["after:bg-support"],accent:["after:bg-accent"],neutral:["after:bg-neutral"],success:["after:bg-success"],alert:["after:bg-alert"],error:["after:bg-error"],info:["after:bg-info"]})},defaultVariants:{intent:"support"}}),y=({intent:e,className:t,keepMounted:r,ref:n,...o})=>a.jsx(v.Radio.Indicator,{ref:n,keepMounted:r,className:z({intent:e,className:t}),...o});y.displayName="RadioGroup.RadioIndicator";const S=u.cva(["flex shrink-0 items-center justify-center","rounded-full","border-md","outline-hidden","hover:ring-4","focus-visible:u-outline","data-disabled:cursor-not-allowed data-disabled:border-outline/dim-2 data-disabled:hover:ring-transparent","u-shadow-border-transition","size-sz-24"],{variants:{intent:x.makeVariants({main:["border-outline","data-checked:border-main","hover:ring-main-container"],support:["border-outline","data-checked:border-support","hover:ring-support-container"],accent:["border-outline","data-checked:border-accent","hover:ring-accent-container"],neutral:["border-outline","data-checked:border-neutral","hover:ring-neutral-container"],info:["border-info","data-checked:border-info","hover:ring-info-container"],success:["border-success","data-checked:border-success","hover:ring-success-container"],alert:["border-alert","data-checked:border-alert","hover:ring-alert-container"],error:["border-error","data-checked:border-error","hover:ring-error-container"]})},defaultVariants:{intent:"support"}}),G=({intent:e,className:t,asChild:r,children:n,inputRef:o,hideInput:i=!1,ref:s,...c})=>{const{state:l}=R.useFormFieldControl(),d=l??e;return a.jsx(v.Radio.Root,{"data-spark-component":"radio-input",ref:s,inputRef:o,render:r?n:void 0,className:i?"sr-only":S({intent:d,className:t}),...c,children:!r&&!i&&a.jsx(y,{intent:d,keepMounted:!0})})};G.displayName="RadioGroup.RadioInput";const L=":radio",g=({className:e,children:t,disabled:r,ref:n,...o})=>{const i=`${L}-label-${f.useId()}`,{intent:s,disabled:c,reverse:l}=C(),d=r||c,p=t&&a.jsx(F.Label,{"data-spark-component":"radio-label",id:i,className:u.cx("grow",d?"text-neutral/dim-2 cursor-not-allowed":"cursor-pointer"),children:t}),b=a.jsx(G,{ref:n,intent:s,"aria-labelledby":t?i:void 0,...o,disabled:r}),m=l?a.jsxs(a.Fragment,{children:[p,b]}):a.jsxs(a.Fragment,{children:[b,p]});return a.jsx("span",{className:u.cx("gap-md text-body-1 flex items-start",e),children:m})};g.displayName="RadioGroup.Radio";const M=u.cva(["flex"],{variants:{orientation:{vertical:["flex-col","gap-lg"],horizontal:["flex-row","gap-xl"]}}}),$=({intent:e,disabled:t,reverse:r,children:n})=>{const o=f.useMemo(()=>({intent:e,disabled:t,reverse:r}),[e,t,r]);return a.jsx(k.Provider,{value:o,children:n})},j=({orientation:e="vertical",intent:t="support",disabled:r,className:n,required:o,reverse:i=!1,onValueChange:s,ref:c,...l})=>{const{labelId:d,isInvalid:p,isRequired:b,description:m,name:q}=R.useFormFieldControl(),h=o!==void 0?o:b,N=s?w=>s(w):void 0;return a.jsx($,{reverse:i,intent:t,disabled:r,children:a.jsx(V.RadioGroup,{"data-spark-component":"radio-group",className:M({orientation:e,className:n}),name:q,ref:c,disabled:r,required:h,onValueChange:N,"aria-orientation":e,"aria-labelledby":d,"aria-invalid":p,"aria-required":h,"aria-describedby":m,...l})})};j.displayName="RadioGroup";const I=Object.assign(j,{Radio:g});I.displayName="RadioGroup";g.displayName="RadioGroup.Radio";exports.RadioGroup=I;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),d=require("class-variance-authority"),s=require("react"),G=require("@spark-ui/components/form-field"),b=require("radix-ui"),y=require("@spark-ui/internal-utils"),k=s.createContext(null),w=()=>{const e=s.useContext(k);if(!e)throw Error("useRadioGroup must be used within a RadioGroup provider");return e},V=d.cva(["relative block","size-3/5","after:absolute","after:left-1/2 after:top-1/2 after:-translate-x-1/2 after:-translate-y-1/2","after:h-0","after:w-0","after:block","after:rounded-[50%]","after:content-['']","after:transition-all","data-[state=checked]:after:size-full"],{variants:{intent:y.makeVariants({main:["after:bg-main"],support:["after:bg-support"],accent:["after:bg-accent"],neutral:["after:bg-neutral"],success:["after:bg-success"],alert:["after:bg-alert"],error:["after:bg-error"],info:["after:bg-info"]})},defaultVariants:{intent:"support"}}),I=({intent:e,className:r,ref:t,...o})=>a.jsx(b.RadioGroup.Indicator,{ref:t,className:V({intent:e,className:r}),...o});I.displayName="RadioGroup.RadioIndicator";const L=d.cva(["flex shrink-0 items-center justify-center","rounded-full","border-md","outline-hidden","hover:ring-4","focus-visible:u-outline","disabled:cursor-not-allowed disabled:border-outline/dim-2 disabled:hover:ring-transparent","u-shadow-border-transition","size-sz-24"],{variants:{intent:y.makeVariants({main:["border-outline","data-[state=checked]:border-main","hover:ring-main-container"],support:["border-outline","data-[state=checked]:border-support","hover:ring-support-container"],accent:["border-outline","data-[state=checked]:border-accent","hover:ring-accent-container"],neutral:["border-outline","data-[state=checked]:border-neutral","hover:ring-neutral-container"],info:["border-info","data-[state=checked]:border-info","hover:ring-info-container"],success:["border-success","data-[state=checked]:border-success","hover:ring-success-container"],alert:["border-alert","data-[state=checked]:border-alert","hover:ring-alert-container"],error:["border-error","data-[state=checked]:border-error","hover:ring-error-container"]})},defaultVariants:{intent:"support"}}),j=({intent:e,className:r,ref:t,...o})=>{const{state:n}=G.useFormFieldControl(),i=n??e;return a.jsx(b.RadioGroup.RadioGroupItem,{"data-spark-component":"radio-input",ref:t,className:L({intent:i,className:r}),...o,children:a.jsx(I,{intent:i,forceMount:!0})})};j.displayName="RadioGroup.RadioInput";const z=d.cva("grow",{variants:{disabled:{true:["text-neutral/dim-2","cursor-not-allowed"],false:["cursor-pointer"]}},defaultVariants:{disabled:!1}}),N=({disabled:e,...r})=>a.jsx(b.Label.Root,{"data-spark-component":"radio-label",className:z({disabled:e}),...r});N.displayName="RadioGroup.RadioLabel";const x=":radio",v=({className:e,children:r,id:t,disabled:o,ref:n,...i})=>{const c=`${x}-input-${s.useId()}`,l=`${x}-label-${s.useId()}`,{intent:f,disabled:m,reverse:R}=w(),u=r&&a.jsx(N,{disabled:o||m,htmlFor:t||c,id:l,children:r}),p=a.jsx(j,{ref:n,id:t||c,intent:f,"aria-labelledby":r?l:void 0,...i,disabled:o}),h=R?a.jsxs(a.Fragment,{children:[u,p]}):a.jsxs(a.Fragment,{children:[p,u]});return a.jsx("span",{className:d.cx("gap-md text-body-1 flex items-start",e),children:h})};v.displayName="RadioGroup.Radio";const C=d.cva(["flex"],{variants:{orientation:{vertical:["flex-col","gap-lg"],horizontal:["flex-row","gap-xl"]}}}),S=({intent:e,disabled:r,reverse:t,children:o})=>{const n=s.useMemo(()=>({intent:e,disabled:r,reverse:t}),[e,r,t]);return a.jsx(k.Provider,{value:n,children:o})},q=({orientation:e="vertical",loop:r=!0,intent:t="support",disabled:o,className:n,required:i,reverse:c=!1,ref:l,...f})=>{const{labelId:m,isInvalid:R,isRequired:u,description:p,name:h}=G.useFormFieldControl(),g=i!==void 0?i:u;return a.jsx(S,{reverse:c,intent:t,disabled:o,children:a.jsx(b.RadioGroup.RadioGroup,{"data-spark-component":"radio-group",className:C({orientation:e,className:n}),name:h,ref:l,disabled:o,orientation:e,loop:r,required:g,"aria-labelledby":m,"aria-invalid":R,"aria-required":g,"aria-describedby":p,...f})})};q.displayName="RadioGroup";const F=Object.assign(q,{Radio:v});F.displayName="RadioGroup";v.displayName="RadioGroup.Radio";exports.RadioGroup=F;
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/radio-group/RadioGroupContext.tsx","../../src/radio-group/RadioIndicator.styles.ts","../../src/radio-group/RadioIndicator.tsx","../../src/radio-group/RadioInput.styles.ts","../../src/radio-group/RadioInput.tsx","../../src/radio-group/Radio.tsx","../../src/radio-group/RadioGroup.styles.ts","../../src/radio-group/RadioGroupProvider.tsx","../../src/radio-group/RadioGroup.tsx","../../src/radio-group/index.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\n\nimport type { RadioGroupProps } from './RadioGroup'\nimport type { RadioInputProps } from './RadioInput'\n\nexport type RadioGroupContextState = Pick<RadioInputProps, 'intent' | 'disabled'> &\n Pick<RadioGroupProps, 'reverse'>\n\nexport const RadioGroupContext = createContext<RadioGroupContextState | null>(null)\n\nexport const useRadioGroup = () => {\n const context = useContext(RadioGroupContext)\n\n if (!context) {\n throw Error('useRadioGroup must be used within a RadioGroup provider')\n }\n\n return context\n}\n","import { makeVariants } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const radioIndicatorStyles = cva(\n [\n 'relative block',\n 'size-3/5',\n 'after:absolute',\n 'after:left-1/2 after:top-1/2 after:-translate-x-1/2 after:-translate-y-1/2',\n 'after:h-0',\n 'after:w-0',\n 'after:block',\n 'after:rounded-[50%]',\n \"after:content-['']\",\n 'after:transition-all',\n 'data-checked:after:size-full',\n ],\n {\n variants: {\n intent: makeVariants<\n 'intent',\n ['main', 'support', 'accent', 'success', 'alert', 'error', 'info', 'neutral']\n >({\n main: ['after:bg-main'],\n support: ['after:bg-support'],\n accent: ['after:bg-accent'],\n neutral: ['after:bg-neutral'],\n success: ['after:bg-success'],\n alert: ['after:bg-alert'],\n error: ['after:bg-error'],\n info: ['after:bg-info'],\n }),\n },\n defaultVariants: {\n intent: 'support',\n },\n }\n)\n\nexport type RadioIndicatorStylesProps = VariantProps<typeof radioIndicatorStyles>\n","import { Radio } from '@base-ui/react/radio'\nimport { Ref } from 'react'\n\nimport { radioIndicatorStyles, RadioIndicatorStylesProps } from './RadioIndicator.styles'\n\nexport interface RadioIndicatorProps extends RadioIndicatorStylesProps {\n className?: string\n /**\n * Whether to keep the indicator mounted in the DOM when the radio is unchecked.\n * Useful when controlling animation with React animation libraries.\n */\n keepMounted?: boolean\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const RadioIndicator = ({\n intent,\n className,\n keepMounted,\n ref,\n ...others\n}: RadioIndicatorProps) => {\n return (\n <Radio.Indicator\n ref={ref}\n keepMounted={keepMounted}\n className={radioIndicatorStyles({ intent, className })}\n {...others}\n />\n )\n}\n\nRadioIndicator.displayName = 'RadioGroup.RadioIndicator'\n","import { makeVariants } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const radioInputVariants = cva(\n [\n 'flex shrink-0 items-center justify-center',\n 'rounded-full',\n 'border-md',\n 'outline-hidden',\n 'hover:ring-4',\n 'focus-visible:u-outline',\n 'data-disabled:cursor-not-allowed data-disabled:border-outline/dim-2 data-disabled:hover:ring-transparent',\n 'u-shadow-border-transition',\n 'size-sz-24',\n ],\n {\n variants: {\n /**\n * Color scheme of the radio input.\n */\n intent: makeVariants<\n 'intent',\n ['main', 'support', 'accent', 'success', 'alert', 'error', 'info', 'neutral']\n >({\n main: ['border-outline', 'data-checked:border-main', 'hover:ring-main-container'],\n support: ['border-outline', 'data-checked:border-support', 'hover:ring-support-container'],\n accent: ['border-outline', 'data-checked:border-accent', 'hover:ring-accent-container'],\n neutral: ['border-outline', 'data-checked:border-neutral', 'hover:ring-neutral-container'],\n info: ['border-info', 'data-checked:border-info', 'hover:ring-info-container'],\n success: ['border-success', 'data-checked:border-success', 'hover:ring-success-container'],\n alert: ['border-alert', 'data-checked:border-alert', 'hover:ring-alert-container'],\n error: ['border-error', 'data-checked:border-error', 'hover:ring-error-container'],\n }),\n },\n defaultVariants: {\n intent: 'support',\n },\n }\n)\n\nexport type RadioInputVariantsProps = VariantProps<typeof radioInputVariants>\n","import { Radio } from '@base-ui/react/radio'\nimport { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { HTMLAttributes, ReactElement, Ref } from 'react'\n\nimport { RadioIndicator } from './RadioIndicator'\nimport { radioInputVariants, RadioInputVariantsProps } from './RadioInput.styles'\n\nexport interface RadioInputProps\n extends RadioInputVariantsProps,\n Omit<HTMLAttributes<HTMLElement>, 'value' | 'onChange'> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n * Uses Base UI's render prop internally to merge behaviour into the child element.\n */\n asChild?: boolean\n /**\n * The value given as data when submitted with a name.\n */\n value: string\n /**\n * When true, prevents the user from interacting with the radio item.\n */\n disabled?: boolean\n /**\n * When true, indicates that the user must check the radio item before the owning form can be submitted.\n */\n required?: boolean\n /**\n * Ref forwarded to the hidden `<input type=\"radio\">` rendered by Base UI.\n * Useful for programmatic activation (e.g. clicking from an associated label span).\n */\n inputRef?: Ref<HTMLInputElement>\n ref?: Ref<HTMLElement>\n /**\n * When true, the visual radio input (outer ring and inner dot) is visually hidden but remains\n * accessible in the DOM. Useful for custom radio appearances where only the label matters visually.\n * @default false\n */\n hideInput?: boolean\n}\n\nexport const RadioInput = ({\n intent: intentProp,\n className,\n asChild,\n children,\n inputRef,\n hideInput = false,\n ref,\n ...others\n}: RadioInputProps) => {\n const { state } = useFormFieldControl()\n\n const intent = state ?? intentProp\n\n return (\n <Radio.Root\n data-spark-component=\"radio-input\"\n ref={ref}\n inputRef={inputRef}\n render={asChild ? (children as ReactElement) : undefined}\n className={hideInput ? 'sr-only' : radioInputVariants({ intent, className })}\n {...others}\n >\n {!asChild && !hideInput && <RadioIndicator intent={intent} keepMounted />}\n </Radio.Root>\n )\n}\n\nRadioInput.displayName = 'RadioGroup.RadioInput'\n","import { cx } from 'class-variance-authority'\nimport { Ref, useId } from 'react'\n\nimport { Label } from '../label'\nimport { useRadioGroup } from './RadioGroupContext'\nimport { RadioInput, RadioInputProps } from './RadioInput'\n\nexport type RadioProps = RadioInputProps & {\n ref?: Ref<HTMLElement>\n}\n\nconst ID_PREFIX = ':radio'\n\nexport const Radio = ({\n className,\n children,\n disabled: disabledProp,\n ref,\n ...others\n}: RadioProps) => {\n const innerLabelId = `${ID_PREFIX}-label-${useId()}`\n\n const { intent, disabled, reverse } = useRadioGroup()\n\n const isDisabled = disabledProp || disabled\n\n const radioLabel = children && (\n <Label\n data-spark-component=\"radio-label\"\n id={innerLabelId}\n className={cx(\n 'grow',\n isDisabled ? 'text-neutral/dim-2 cursor-not-allowed' : 'cursor-pointer'\n )}\n >\n {children}\n </Label>\n )\n\n const radioInput = (\n <RadioInput\n ref={ref}\n intent={intent}\n aria-labelledby={children ? innerLabelId : undefined}\n {...others}\n disabled={disabledProp}\n />\n )\n\n const content = reverse ? (\n <>\n {radioLabel}\n {radioInput}\n </>\n ) : (\n <>\n {radioInput}\n {radioLabel}\n </>\n )\n\n return <span className={cx('gap-md text-body-1 flex items-start', className)}>{content}</span>\n}\n\nRadio.displayName = 'RadioGroup.Radio'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const radioGroupStyles = cva(['flex'], {\n variants: {\n orientation: {\n vertical: ['flex-col', 'gap-lg'],\n horizontal: ['flex-row', 'gap-xl'],\n },\n },\n})\n\nexport type RadioGroupVariantsProps = VariantProps<typeof radioGroupStyles>\n","import { ReactNode, useMemo } from 'react'\n\nimport type { RadioGroupProps } from './RadioGroup'\nimport { RadioGroupContext } from './RadioGroupContext'\nimport type { RadioInputProps } from './RadioInput'\n\nexport interface RadioGroupProviderProps\n extends Pick<RadioInputProps, 'intent' | 'disabled'>,\n Pick<RadioGroupProps, 'reverse'> {\n children: ReactNode\n}\n\nexport const RadioGroupProvider = ({\n intent,\n disabled,\n reverse,\n children,\n}: RadioGroupProviderProps) => {\n const value = useMemo(() => ({ intent, disabled, reverse }), [intent, disabled, reverse])\n\n return <RadioGroupContext.Provider value={value}>{children}</RadioGroupContext.Provider>\n}\n","import { RadioGroup as BaseUIRadioGroup } from '@base-ui/react/radio-group'\nimport { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { HTMLAttributes, Ref } from 'react'\n\nimport { radioGroupStyles, RadioGroupVariantsProps } from './RadioGroup.styles'\nimport { RadioGroupProvider } from './RadioGroupProvider'\nimport { RadioInputVariantsProps } from './RadioInput.styles'\n\nexport interface RadioGroupProps\n extends RadioGroupVariantsProps,\n Pick<RadioInputVariantsProps, 'intent'>,\n Omit<HTMLAttributes<HTMLDivElement>, 'value' | 'defaultValue' | 'dir' | 'onChange'> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n /**\n * The value of the radio item that should be checked when initially rendered. Use when you do not need to control the state of the radio items.\n */\n defaultValue?: string\n /**\n * The controlled value of the radio item to check. Should be used in conjunction with onValueChange.\n */\n value?: string\n /**\n * Event handler called when the value changes.\n */\n onValueChange?: (value: string) => void\n /**\n * When true, prevents the user from interacting with radio items.\n */\n disabled?: boolean\n /**\n * The name of the group. Submitted with its owning form as part of a name/value pair.\n */\n name?: string\n /**\n * When true, indicates that the user must check a radio item before the owning form can be submitted.\n */\n required?: boolean\n /**\n * The orientation of the component.\n */\n orientation?: 'horizontal' | 'vertical'\n /**\n * The reading direction of the radio group.\n */\n dir?: 'ltr' | 'rtl'\n /**\n * When true, the label will be placed on the left side of the Radio\n */\n reverse?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\nexport const RadioGroup = ({\n orientation = 'vertical',\n intent = 'support',\n disabled,\n className,\n required: requiredProp,\n reverse = false,\n onValueChange: onValueChangeProp,\n ref,\n ...others\n}: RadioGroupProps) => {\n const { labelId, isInvalid, isRequired, description, name } = useFormFieldControl()\n const required = requiredProp !== undefined ? requiredProp : isRequired\n\n const handleValueChange = onValueChangeProp\n ? (value: unknown) => onValueChangeProp(value as string)\n : undefined\n\n return (\n <RadioGroupProvider reverse={reverse} intent={intent} disabled={disabled}>\n <BaseUIRadioGroup\n data-spark-component=\"radio-group\"\n className={radioGroupStyles({ orientation, className })}\n name={name}\n ref={ref}\n disabled={disabled}\n required={required}\n onValueChange={handleValueChange}\n aria-orientation={orientation}\n aria-labelledby={labelId}\n aria-invalid={isInvalid}\n aria-required={required}\n aria-describedby={description}\n {...others}\n />\n </RadioGroupProvider>\n )\n}\n\nRadioGroup.displayName = 'RadioGroup'\n","import { Radio } from './Radio'\nimport { RadioGroup as Root } from './RadioGroup'\n\nexport const RadioGroup: typeof Root & {\n Radio: typeof Radio\n} = Object.assign(Root, {\n Radio,\n})\n\nRadioGroup.displayName = 'RadioGroup'\nRadio.displayName = 'RadioGroup.Radio'\n\nexport { type RadioGroupProps } from './RadioGroup'\nexport { type RadioProps } from './Radio'\n"],"names":["RadioGroupContext","createContext","useRadioGroup","context","useContext","radioIndicatorStyles","cva","makeVariants","RadioIndicator","intent","className","keepMounted","ref","others","jsx","Radio","radioInputVariants","RadioInput","intentProp","asChild","children","inputRef","hideInput","state","useFormFieldControl","ID_PREFIX","disabledProp","innerLabelId","useId","disabled","reverse","isDisabled","radioLabel","Label","cx","radioInput","content","jsxs","Fragment","radioGroupStyles","RadioGroupProvider","value","useMemo","RadioGroup","orientation","requiredProp","onValueChangeProp","labelId","isInvalid","isRequired","description","name","required","handleValueChange","BaseUIRadioGroup","Root"],"mappings":"0WAQaA,EAAoBC,EAAAA,cAA6C,IAAI,EAErEC,EAAgB,IAAM,CACjC,MAAMC,EAAUC,EAAAA,WAAWJ,CAAiB,EAE5C,GAAI,CAACG,EACH,MAAM,MAAM,yDAAyD,EAGvE,OAAOA,CACT,ECfaE,EAAuBC,EAAAA,IAClC,CACE,iBACA,WACA,iBACA,6EACA,YACA,YACA,cACA,sBACA,qBACA,uBACA,8BAAA,EAEF,CACE,SAAU,CACR,OAAQC,EAAAA,aAGN,CACA,KAAM,CAAC,eAAe,EACtB,QAAS,CAA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"version":3,"file":"index.js","sources":["../../src/radio-group/RadioGroupContext.tsx","../../src/radio-group/RadioIndicator.styles.ts","../../src/radio-group/RadioIndicator.tsx","../../src/radio-group/RadioInput.styles.ts","../../src/radio-group/RadioInput.tsx","../../src/radio-group/RadioLabel.styles.tsx","../../src/radio-group/RadioLabel.tsx","../../src/radio-group/Radio.tsx","../../src/radio-group/RadioGroup.styles.ts","../../src/radio-group/RadioGroupProvider.tsx","../../src/radio-group/RadioGroup.tsx","../../src/radio-group/index.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\n\nimport type { RadioGroupProps } from './RadioGroup'\nimport type { RadioInputProps } from './RadioInput'\n\nexport type RadioGroupContextState = Pick<RadioInputProps, 'intent' | 'disabled'> &\n Pick<RadioGroupProps, 'reverse'>\n\nexport const RadioGroupContext = createContext<RadioGroupContextState | null>(null)\n\nexport const useRadioGroup = () => {\n const context = useContext(RadioGroupContext)\n\n if (!context) {\n throw Error('useRadioGroup must be used within a RadioGroup provider')\n }\n\n return context\n}\n","import { makeVariants } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const radioIndicatorStyles = cva(\n [\n 'relative block',\n 'size-3/5',\n 'after:absolute',\n 'after:left-1/2 after:top-1/2 after:-translate-x-1/2 after:-translate-y-1/2',\n 'after:h-0',\n 'after:w-0',\n 'after:block',\n 'after:rounded-[50%]',\n \"after:content-['']\",\n 'after:transition-all',\n 'data-[state=checked]:after:size-full',\n ],\n {\n variants: {\n intent: makeVariants<\n 'intent',\n ['main', 'support', 'accent', 'success', 'alert', 'error', 'info', 'neutral']\n >({\n main: ['after:bg-main'],\n support: ['after:bg-support'],\n accent: ['after:bg-accent'],\n neutral: ['after:bg-neutral'],\n success: ['after:bg-success'],\n alert: ['after:bg-alert'],\n error: ['after:bg-error'],\n info: ['after:bg-info'],\n }),\n },\n defaultVariants: {\n intent: 'support',\n },\n }\n)\n\nexport type RadioIndicatorStylesProps = VariantProps<typeof radioIndicatorStyles>\n","import { RadioGroup as RadixRadioGroup } from 'radix-ui'\nimport { Ref } from 'react'\n\nimport { radioIndicatorStyles, RadioIndicatorStylesProps } from './RadioIndicator.styles'\n\nexport interface RadioIndicatorProps extends RadioIndicatorStylesProps {\n className?: string\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n /**\n * Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries.\n */\n forceMount?: true | undefined\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const RadioIndicator = ({ intent, className, ref, ...others }: RadioIndicatorProps) => {\n return (\n <RadixRadioGroup.Indicator\n ref={ref}\n className={radioIndicatorStyles({ intent, className })}\n {...others}\n />\n )\n}\n\nRadioIndicator.displayName = 'RadioGroup.RadioIndicator'\n","import { makeVariants } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const radioInputVariants = cva(\n [\n 'flex shrink-0 items-center justify-center',\n 'rounded-full',\n 'border-md',\n 'outline-hidden',\n 'hover:ring-4',\n 'focus-visible:u-outline',\n 'disabled:cursor-not-allowed disabled:border-outline/dim-2 disabled:hover:ring-transparent',\n 'u-shadow-border-transition',\n 'size-sz-24',\n ],\n {\n variants: {\n /**\n * Color scheme of the radio input.\n */\n intent: makeVariants<\n 'intent',\n ['main', 'support', 'accent', 'success', 'alert', 'error', 'info', 'neutral']\n >({\n main: ['border-outline', 'data-[state=checked]:border-main', 'hover:ring-main-container'],\n support: [\n 'border-outline',\n 'data-[state=checked]:border-support',\n 'hover:ring-support-container',\n ],\n accent: [\n 'border-outline',\n 'data-[state=checked]:border-accent',\n 'hover:ring-accent-container',\n ],\n neutral: [\n 'border-outline',\n 'data-[state=checked]:border-neutral',\n 'hover:ring-neutral-container',\n ],\n info: ['border-info', 'data-[state=checked]:border-info', 'hover:ring-info-container'],\n success: [\n 'border-success',\n 'data-[state=checked]:border-success',\n 'hover:ring-success-container',\n ],\n alert: ['border-alert', 'data-[state=checked]:border-alert', 'hover:ring-alert-container'],\n error: ['border-error', 'data-[state=checked]:border-error', 'hover:ring-error-container'],\n }),\n },\n defaultVariants: {\n intent: 'support',\n },\n }\n)\n\nexport type RadioInputVariantsProps = VariantProps<typeof radioInputVariants>\n","import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { RadioGroup as RadixRadioGroup } from 'radix-ui'\nimport { ButtonHTMLAttributes, Ref } from 'react'\n\nimport { RadioIndicator } from './RadioIndicator'\nimport { radioInputVariants, RadioInputVariantsProps } from './RadioInput.styles'\n\nexport interface RadioInputProps\n extends RadioInputVariantsProps,\n Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'value' | 'onChange'> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n /**\n * The value given as data when submitted with a name.\n */\n value: string\n /**\n * When true, prevents the user from interacting with the radio item.\n */\n disabled?: boolean\n /**\n * When true, indicates that the user must check the radio item before the owning form can be submitted.\n */\n required?: boolean\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const RadioInput = ({ intent: intentProp, className, ref, ...others }: RadioInputProps) => {\n const { state } = useFormFieldControl()\n\n const intent = state ?? intentProp\n\n return (\n <RadixRadioGroup.RadioGroupItem\n data-spark-component=\"radio-input\"\n ref={ref}\n className={radioInputVariants({ intent, className })}\n {...others}\n >\n <RadioIndicator intent={intent} forceMount />\n </RadixRadioGroup.RadioGroupItem>\n )\n}\n\nRadioInput.displayName = 'RadioGroup.RadioInput'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const radioLabelStyles = cva('grow', {\n variants: {\n disabled: {\n true: ['text-neutral/dim-2', 'cursor-not-allowed'],\n false: ['cursor-pointer'],\n },\n },\n defaultVariants: {\n disabled: false,\n },\n})\n\nexport type RadioLabelStylesProps = VariantProps<typeof radioLabelStyles>\n","import { Label } from 'radix-ui'\nimport type { HTMLAttributes, PropsWithChildren } from 'react'\n\nimport { radioLabelStyles, RadioLabelStylesProps } from './RadioLabel.styles'\n\nexport interface RadioLabelProps\n extends RadioLabelStylesProps,\n PropsWithChildren<HTMLAttributes<HTMLLabelElement>> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n /**\n * The id of the element the label is associated with.\n */\n htmlFor?: string\n /**\n * When true, prevents the user from interacting with the radio item.\n */\n disabled?: boolean\n}\n\nexport const RadioLabel = ({ disabled, ...others }: RadioLabelProps) => {\n return (\n <Label.Root\n data-spark-component=\"radio-label\"\n className={radioLabelStyles({ disabled })}\n {...others}\n />\n )\n}\n\nRadioLabel.displayName = 'RadioGroup.RadioLabel'\n","import { cx } from 'class-variance-authority'\nimport { Ref, useId } from 'react'\n\nimport { useRadioGroup } from './RadioGroupContext'\nimport { RadioInput, RadioInputProps } from './RadioInput'\nimport { RadioLabel } from './RadioLabel'\n\nexport type RadioProps = RadioInputProps & {\n ref?: Ref<HTMLButtonElement>\n}\n\nconst ID_PREFIX = ':radio'\n\nexport const Radio = ({\n className,\n children,\n id,\n disabled: disabledProp,\n ref,\n ...others\n}: RadioProps) => {\n const innerId = `${ID_PREFIX}-input-${useId()}`\n const innerLabelId = `${ID_PREFIX}-label-${useId()}`\n\n const { intent, disabled, reverse } = useRadioGroup()\n\n const radioLabel = children && (\n <RadioLabel disabled={disabledProp || disabled} htmlFor={id || innerId} id={innerLabelId}>\n {children}\n </RadioLabel>\n )\n\n const radioInput = (\n <RadioInput\n ref={ref}\n id={id || innerId}\n intent={intent}\n aria-labelledby={children ? innerLabelId : undefined}\n {...others}\n disabled={disabledProp}\n />\n )\n\n const content = reverse ? (\n <>\n {radioLabel}\n {radioInput}\n </>\n ) : (\n <>\n {radioInput}\n {radioLabel}\n </>\n )\n\n return <span className={cx('gap-md text-body-1 flex items-start', className)}>{content}</span>\n}\n\nRadio.displayName = 'RadioGroup.Radio'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const radioGroupStyles = cva(['flex'], {\n variants: {\n orientation: {\n vertical: ['flex-col', 'gap-lg'],\n horizontal: ['flex-row', 'gap-xl'],\n },\n },\n})\n\nexport type RadioGroupVariantsProps = VariantProps<typeof radioGroupStyles>\n","import { ReactNode, useMemo } from 'react'\n\nimport type { RadioGroupProps } from './RadioGroup'\nimport { RadioGroupContext } from './RadioGroupContext'\nimport type { RadioInputProps } from './RadioInput'\n\nexport interface RadioGroupProviderProps\n extends Pick<RadioInputProps, 'intent' | 'disabled'>,\n Pick<RadioGroupProps, 'reverse'> {\n children: ReactNode\n}\n\nexport const RadioGroupProvider = ({\n intent,\n disabled,\n reverse,\n children,\n}: RadioGroupProviderProps) => {\n const value = useMemo(() => ({ intent, disabled, reverse }), [intent, disabled, reverse])\n\n return <RadioGroupContext.Provider value={value}>{children}</RadioGroupContext.Provider>\n}\n","import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { RadioGroup as RadixRadioGroup } from 'radix-ui'\nimport { HTMLAttributes, Ref } from 'react'\n\nimport { radioGroupStyles, RadioGroupVariantsProps } from './RadioGroup.styles'\nimport { RadioGroupProvider } from './RadioGroupProvider'\nimport { RadioInputVariantsProps } from './RadioInput.styles'\n\nexport interface RadioGroupProps\n extends RadioGroupVariantsProps,\n Pick<RadioInputVariantsProps, 'intent'>,\n Omit<HTMLAttributes<HTMLDivElement>, 'value' | 'defaultValue' | 'dir' | 'onChange'> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n /**\n * The value of the radio item that should be checked when initially rendered. Use when you do not need to control the state of the radio items.\n */\n defaultValue?: string\n /**\n * The controlled value of the radio item to check. Should be used in conjunction with onValueChange.\n */\n value?: string\n /**\n * Event handler called when the value changes.\n */\n onValueChange?: (value: string) => void\n /**\n * When true, prevents the user from interacting with radio items.\n */\n disabled?: boolean\n /**\n * The name of the group. Submitted with its owning form as part of a name/value pair.\n */\n name?: string\n /**\n * When true, indicates that the user must check a radio item before the owning form can be submitted.\n */\n required?: boolean\n /**\n * The orientation of the component.\n */\n orientation?: 'horizontal' | 'vertical'\n /**\n * The reading direction of the radio group.\n */\n dir?: 'ltr' | 'rtl'\n /**\n * When true, keyboard navigation will loop from last item to first, and vice versa.\n */\n loop?: boolean\n /**\n * When true, the label will be placed on the left side of the Radio\n */\n reverse?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\nexport const RadioGroup = ({\n orientation = 'vertical',\n loop = true,\n intent = 'support',\n disabled,\n className,\n required: requiredProp,\n reverse = false,\n ref,\n ...others\n}: RadioGroupProps) => {\n const { labelId, isInvalid, isRequired, description, name } = useFormFieldControl()\n const required = requiredProp !== undefined ? requiredProp : isRequired\n\n return (\n <RadioGroupProvider reverse={reverse} intent={intent} disabled={disabled}>\n <RadixRadioGroup.RadioGroup\n data-spark-component=\"radio-group\"\n className={radioGroupStyles({ orientation, className })}\n name={name}\n ref={ref}\n disabled={disabled}\n orientation={orientation}\n loop={loop}\n required={required}\n aria-labelledby={labelId}\n aria-invalid={isInvalid}\n aria-required={required}\n aria-describedby={description}\n {...others}\n />\n </RadioGroupProvider>\n )\n}\n\nRadioGroup.displayName = 'RadioGroup'\n","import { Radio } from './Radio'\nimport { RadioGroup as Root } from './RadioGroup'\n\nexport const RadioGroup: typeof Root & {\n Radio: typeof Radio\n} = Object.assign(Root, {\n Radio,\n})\n\nRadioGroup.displayName = 'RadioGroup'\nRadio.displayName = 'RadioGroup.Radio'\n\nexport { type RadioGroupProps } from './RadioGroup'\nexport { type RadioProps } from './Radio'\n"],"names":["RadioGroupContext","createContext","useRadioGroup","context","useContext","radioIndicatorStyles","cva","makeVariants","RadioIndicator","intent","className","ref","others","jsx","RadixRadioGroup","radioInputVariants","RadioInput","intentProp","state","useFormFieldControl","radioLabelStyles","RadioLabel","disabled","Label","ID_PREFIX","Radio","children","id","disabledProp","innerId","useId","innerLabelId","reverse","radioLabel","radioInput","content","jsxs","Fragment","cx","radioGroupStyles","RadioGroupProvider","value","useMemo","RadioGroup","orientation","loop","requiredProp","labelId","isInvalid","isRequired","description","name","required","Root"],"mappings":"uRAQaA,EAAoBC,EAAAA,cAA6C,IAAI,EAErEC,EAAgB,IAA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AAAR,EAAkB,OAAAvB,EAAgB,SAAAa,EACpD,SAAAT,EAAAA,IAACC,EAAAA,WAAgB,WAAhB,CACC,uBAAqB,cACrB,UAAWyB,EAAiB,CAAE,YAAAK,EAAa,UAAAlC,EAAW,EACtD,KAAAyC,EACA,IAAAxC,EACA,SAAAW,EACA,YAAAsB,EACA,KAAAC,EACA,SAAAO,EACA,kBAAiBL,EACjB,eAAcC,EACd,gBAAeI,EACf,mBAAkBF,EACjB,GAAGtC,CAAA,CAAA,EAER,CAEJ,EAEA+B,EAAW,YAAc,aC3FlB,MAAMA,EAET,OAAO,OAAOU,EAAM,CACtB,MAAA5B,CACF,CAAC,EAEDkB,EAAW,YAAc,aACzBlB,EAAM,YAAc"}
@@ -1,17 +1,15 @@
1
- import { jsx as n, jsxs as g, Fragment as v } from "react/jsx-runtime";
2
- import { cva as f, cx as R } from "class-variance-authority";
3
- import { createContext as $, useContext as j, useId as F, useMemo as q } from "react";
4
- import { Label as D } from "../label/index.mjs";
5
- import { Radio as k } from "@base-ui/react/radio";
6
- import { useFormFieldControl as x } from "@spark-ui/components/form-field";
7
- import { makeVariants as G } from "@spark-ui/internal-utils";
8
- import { RadioGroup as L } from "@base-ui/react/radio-group";
9
- const y = $(null), E = () => {
10
- const r = j(y);
1
+ import { jsx as o, jsxs as g, Fragment as G } from "react/jsx-runtime";
2
+ import { cva as u, cx as F } from "class-variance-authority";
3
+ import { createContext as V, useContext as j, useId as x, useMemo as C } from "react";
4
+ import { useFormFieldControl as y } from "@spark-ui/components/form-field";
5
+ import { RadioGroup as h, Label as q } from "radix-ui";
6
+ import { makeVariants as I } from "@spark-ui/internal-utils";
7
+ const N = V(null), S = () => {
8
+ const r = j(N);
11
9
  if (!r)
12
10
  throw Error("useRadioGroup must be used within a RadioGroup provider");
13
11
  return r;
14
- }, M = f(
12
+ }, E = u(
15
13
  [
16
14
  "relative block",
17
15
  "size-3/5",
@@ -23,11 +21,11 @@ const y = $(null), E = () => {
23
21
  "after:rounded-[50%]",
24
22
  "after:content-['']",
25
23
  "after:transition-all",
26
- "data-checked:after:size-full"
24
+ "data-[state=checked]:after:size-full"
27
25
  ],
28
26
  {
29
27
  variants: {
30
- intent: G({
28
+ intent: I({
31
29
  main: ["after:bg-main"],
32
30
  support: ["after:bg-support"],
33
31
  accent: ["after:bg-accent"],
@@ -42,23 +40,16 @@ const y = $(null), E = () => {
42
40
  intent: "support"
43
41
  }
44
42
  }
45
- ), I = ({
46
- intent: r,
47
- className: a,
48
- keepMounted: e,
49
- ref: t,
50
- ...o
51
- }) => /* @__PURE__ */ n(
52
- k.Indicator,
43
+ ), w = ({ intent: r, className: e, ref: a, ...t }) => /* @__PURE__ */ o(
44
+ h.Indicator,
53
45
  {
54
- ref: t,
55
- keepMounted: e,
56
- className: M({ intent: r, className: a }),
57
- ...o
46
+ ref: a,
47
+ className: E({ intent: r, className: e }),
48
+ ...t
58
49
  }
59
50
  );
60
- I.displayName = "RadioGroup.RadioIndicator";
61
- const S = f(
51
+ w.displayName = "RadioGroup.RadioIndicator";
52
+ const M = u(
62
53
  [
63
54
  "flex shrink-0 items-center justify-center",
64
55
  "rounded-full",
@@ -66,7 +57,7 @@ const S = f(
66
57
  "outline-hidden",
67
58
  "hover:ring-4",
68
59
  "focus-visible:u-outline",
69
- "data-disabled:cursor-not-allowed data-disabled:border-outline/dim-2 data-disabled:hover:ring-transparent",
60
+ "disabled:cursor-not-allowed disabled:border-outline/dim-2 disabled:hover:ring-transparent",
70
61
  "u-shadow-border-transition",
71
62
  "size-sz-24"
72
63
  ],
@@ -75,136 +66,151 @@ const S = f(
75
66
  /**
76
67
  * Color scheme of the radio input.
77
68
  */
78
- intent: G({
79
- main: ["border-outline", "data-checked:border-main", "hover:ring-main-container"],
80
- support: ["border-outline", "data-checked:border-support", "hover:ring-support-container"],
81
- accent: ["border-outline", "data-checked:border-accent", "hover:ring-accent-container"],
82
- neutral: ["border-outline", "data-checked:border-neutral", "hover:ring-neutral-container"],
83
- info: ["border-info", "data-checked:border-info", "hover:ring-info-container"],
84
- success: ["border-success", "data-checked:border-success", "hover:ring-success-container"],
85
- alert: ["border-alert", "data-checked:border-alert", "hover:ring-alert-container"],
86
- error: ["border-error", "data-checked:border-error", "hover:ring-error-container"]
69
+ intent: I({
70
+ main: ["border-outline", "data-[state=checked]:border-main", "hover:ring-main-container"],
71
+ support: [
72
+ "border-outline",
73
+ "data-[state=checked]:border-support",
74
+ "hover:ring-support-container"
75
+ ],
76
+ accent: [
77
+ "border-outline",
78
+ "data-[state=checked]:border-accent",
79
+ "hover:ring-accent-container"
80
+ ],
81
+ neutral: [
82
+ "border-outline",
83
+ "data-[state=checked]:border-neutral",
84
+ "hover:ring-neutral-container"
85
+ ],
86
+ info: ["border-info", "data-[state=checked]:border-info", "hover:ring-info-container"],
87
+ success: [
88
+ "border-success",
89
+ "data-[state=checked]:border-success",
90
+ "hover:ring-success-container"
91
+ ],
92
+ alert: ["border-alert", "data-[state=checked]:border-alert", "hover:ring-alert-container"],
93
+ error: ["border-error", "data-[state=checked]:border-error", "hover:ring-error-container"]
87
94
  })
88
95
  },
89
96
  defaultVariants: {
90
97
  intent: "support"
91
98
  }
92
99
  }
93
- ), N = ({
94
- intent: r,
95
- className: a,
96
- asChild: e,
97
- children: t,
98
- inputRef: o,
99
- hideInput: i = !1,
100
- ref: d,
101
- ...s
102
- }) => {
103
- const { state: c } = x(), l = c ?? r;
104
- return /* @__PURE__ */ n(
105
- k.Root,
100
+ ), L = ({ intent: r, className: e, ref: a, ...t }) => {
101
+ const { state: n } = y(), i = n ?? r;
102
+ return /* @__PURE__ */ o(
103
+ h.RadioGroupItem,
106
104
  {
107
105
  "data-spark-component": "radio-input",
108
- ref: d,
109
- inputRef: o,
110
- render: e ? t : void 0,
111
- className: i ? "sr-only" : S({ intent: l, className: a }),
112
- ...s,
113
- children: !e && !i && /* @__PURE__ */ n(I, { intent: l, keepMounted: !0 })
106
+ ref: a,
107
+ className: M({ intent: i, className: e }),
108
+ ...t,
109
+ children: /* @__PURE__ */ o(w, { intent: i, forceMount: !0 })
114
110
  }
115
111
  );
116
112
  };
117
- N.displayName = "RadioGroup.RadioInput";
118
- const O = ":radio", m = ({
113
+ L.displayName = "RadioGroup.RadioInput";
114
+ const D = u("grow", {
115
+ variants: {
116
+ disabled: {
117
+ true: ["text-neutral/dim-2", "cursor-not-allowed"],
118
+ false: ["cursor-pointer"]
119
+ }
120
+ },
121
+ defaultVariants: {
122
+ disabled: !1
123
+ }
124
+ }), $ = ({ disabled: r, ...e }) => /* @__PURE__ */ o(
125
+ q.Root,
126
+ {
127
+ "data-spark-component": "radio-label",
128
+ className: D({ disabled: r }),
129
+ ...e
130
+ }
131
+ );
132
+ $.displayName = "RadioGroup.RadioLabel";
133
+ const k = ":radio", R = ({
119
134
  className: r,
120
- children: a,
121
- disabled: e,
122
- ref: t,
123
- ...o
135
+ children: e,
136
+ id: a,
137
+ disabled: t,
138
+ ref: n,
139
+ ...i
124
140
  }) => {
125
- const i = `${O}-label-${F()}`, { intent: d, disabled: s, reverse: c } = E(), u = a && /* @__PURE__ */ n(
126
- D,
127
- {
128
- "data-spark-component": "radio-label",
129
- id: i,
130
- className: R(
131
- "grow",
132
- e || s ? "text-neutral/dim-2 cursor-not-allowed" : "cursor-pointer"
133
- ),
134
- children: a
135
- }
136
- ), p = /* @__PURE__ */ n(
137
- N,
141
+ const s = `${k}-input-${x()}`, d = `${k}-label-${x()}`, { intent: p, disabled: b, reverse: f } = S(), c = e && /* @__PURE__ */ o($, { disabled: t || b, htmlFor: a || s, id: d, children: e }), l = /* @__PURE__ */ o(
142
+ L,
138
143
  {
139
- ref: t,
140
- intent: d,
141
- "aria-labelledby": a ? i : void 0,
142
- ...o,
143
- disabled: e
144
+ ref: n,
145
+ id: a || s,
146
+ intent: p,
147
+ "aria-labelledby": e ? d : void 0,
148
+ ...i,
149
+ disabled: t
144
150
  }
145
- ), b = c ? /* @__PURE__ */ g(v, { children: [
146
- u,
147
- p
148
- ] }) : /* @__PURE__ */ g(v, { children: [
149
- p,
150
- u
151
+ ), m = f ? /* @__PURE__ */ g(G, { children: [
152
+ c,
153
+ l
154
+ ] }) : /* @__PURE__ */ g(G, { children: [
155
+ l,
156
+ c
151
157
  ] });
152
- return /* @__PURE__ */ n("span", { className: R("gap-md text-body-1 flex items-start", r), children: b });
158
+ return /* @__PURE__ */ o("span", { className: F("gap-md text-body-1 flex items-start", r), children: m });
153
159
  };
154
- m.displayName = "RadioGroup.Radio";
155
- const X = f(["flex"], {
160
+ R.displayName = "RadioGroup.Radio";
161
+ const O = u(["flex"], {
156
162
  variants: {
157
163
  orientation: {
158
164
  vertical: ["flex-col", "gap-lg"],
159
165
  horizontal: ["flex-row", "gap-xl"]
160
166
  }
161
167
  }
162
- }), _ = ({
168
+ }), P = ({
163
169
  intent: r,
164
- disabled: a,
165
- reverse: e,
170
+ disabled: e,
171
+ reverse: a,
166
172
  children: t
167
173
  }) => {
168
- const o = q(() => ({ intent: r, disabled: a, reverse: e }), [r, a, e]);
169
- return /* @__PURE__ */ n(y.Provider, { value: o, children: t });
170
- }, w = ({
174
+ const n = C(() => ({ intent: r, disabled: e, reverse: a }), [r, e, a]);
175
+ return /* @__PURE__ */ o(N.Provider, { value: n, children: t });
176
+ }, z = ({
171
177
  orientation: r = "vertical",
178
+ loop: e = !0,
172
179
  intent: a = "support",
173
- disabled: e,
174
- className: t,
175
- required: o,
176
- reverse: i = !1,
177
- onValueChange: d,
178
- ref: s,
179
- ...c
180
+ disabled: t,
181
+ className: n,
182
+ required: i,
183
+ reverse: s = !1,
184
+ ref: d,
185
+ ...p
180
186
  }) => {
181
- const { labelId: l, isInvalid: u, isRequired: p, description: b, name: V } = x(), h = o !== void 0 ? o : p, z = d ? (C) => d(C) : void 0;
182
- return /* @__PURE__ */ n(_, { reverse: i, intent: a, disabled: e, children: /* @__PURE__ */ n(
183
- L,
187
+ const { labelId: b, isInvalid: f, isRequired: c, description: l, name: m } = y(), v = i !== void 0 ? i : c;
188
+ return /* @__PURE__ */ o(P, { reverse: s, intent: a, disabled: t, children: /* @__PURE__ */ o(
189
+ h.RadioGroup,
184
190
  {
185
191
  "data-spark-component": "radio-group",
186
- className: X({ orientation: r, className: t }),
187
- name: V,
188
- ref: s,
189
- disabled: e,
190
- required: h,
191
- onValueChange: z,
192
- "aria-orientation": r,
193
- "aria-labelledby": l,
194
- "aria-invalid": u,
195
- "aria-required": h,
196
- "aria-describedby": b,
197
- ...c
192
+ className: O({ orientation: r, className: n }),
193
+ name: m,
194
+ ref: d,
195
+ disabled: t,
196
+ orientation: r,
197
+ loop: e,
198
+ required: v,
199
+ "aria-labelledby": b,
200
+ "aria-invalid": f,
201
+ "aria-required": v,
202
+ "aria-describedby": l,
203
+ ...p
198
204
  }
199
205
  ) });
200
206
  };
201
- w.displayName = "RadioGroup";
202
- const A = Object.assign(w, {
203
- Radio: m
207
+ z.displayName = "RadioGroup";
208
+ const X = Object.assign(z, {
209
+ Radio: R
204
210
  });
205
- A.displayName = "RadioGroup";
206
- m.displayName = "RadioGroup.Radio";
211
+ X.displayName = "RadioGroup";
212
+ R.displayName = "RadioGroup.Radio";
207
213
  export {
208
- A as RadioGroup
214
+ X as RadioGroup
209
215
  };
210
216
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/radio-group/RadioGroupContext.tsx","../../src/radio-group/RadioIndicator.styles.ts","../../src/radio-group/RadioIndicator.tsx","../../src/radio-group/RadioInput.styles.ts","../../src/radio-group/RadioInput.tsx","../../src/radio-group/Radio.tsx","../../src/radio-group/RadioGroup.styles.ts","../../src/radio-group/RadioGroupProvider.tsx","../../src/radio-group/RadioGroup.tsx","../../src/radio-group/index.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\n\nimport type { RadioGroupProps } from './RadioGroup'\nimport type { RadioInputProps } from './RadioInput'\n\nexport type RadioGroupContextState = Pick<RadioInputProps, 'intent' | 'disabled'> &\n Pick<RadioGroupProps, 'reverse'>\n\nexport const RadioGroupContext = createContext<RadioGroupContextState | null>(null)\n\nexport const useRadioGroup = () => {\n const context = useContext(RadioGroupContext)\n\n if (!context) {\n throw Error('useRadioGroup must be used within a RadioGroup provider')\n }\n\n return context\n}\n","import { makeVariants } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const radioIndicatorStyles = cva(\n [\n 'relative block',\n 'size-3/5',\n 'after:absolute',\n 'after:left-1/2 after:top-1/2 after:-translate-x-1/2 after:-translate-y-1/2',\n 'after:h-0',\n 'after:w-0',\n 'after:block',\n 'after:rounded-[50%]',\n \"after:content-['']\",\n 'after:transition-all',\n 'data-checked:after:size-full',\n ],\n {\n variants: {\n intent: makeVariants<\n 'intent',\n ['main', 'support', 'accent', 'success', 'alert', 'error', 'info', 'neutral']\n >({\n main: ['after:bg-main'],\n support: ['after:bg-support'],\n accent: ['after:bg-accent'],\n neutral: ['after:bg-neutral'],\n success: ['after:bg-success'],\n alert: ['after:bg-alert'],\n error: ['after:bg-error'],\n info: ['after:bg-info'],\n }),\n },\n defaultVariants: {\n intent: 'support',\n },\n }\n)\n\nexport type RadioIndicatorStylesProps = VariantProps<typeof radioIndicatorStyles>\n","import { Radio } from '@base-ui/react/radio'\nimport { Ref } from 'react'\n\nimport { radioIndicatorStyles, RadioIndicatorStylesProps } from './RadioIndicator.styles'\n\nexport interface RadioIndicatorProps extends RadioIndicatorStylesProps {\n className?: string\n /**\n * Whether to keep the indicator mounted in the DOM when the radio is unchecked.\n * Useful when controlling animation with React animation libraries.\n */\n keepMounted?: boolean\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const RadioIndicator = ({\n intent,\n className,\n keepMounted,\n ref,\n ...others\n}: RadioIndicatorProps) => {\n return (\n <Radio.Indicator\n ref={ref}\n keepMounted={keepMounted}\n className={radioIndicatorStyles({ intent, className })}\n {...others}\n />\n )\n}\n\nRadioIndicator.displayName = 'RadioGroup.RadioIndicator'\n","import { makeVariants } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const radioInputVariants = cva(\n [\n 'flex shrink-0 items-center justify-center',\n 'rounded-full',\n 'border-md',\n 'outline-hidden',\n 'hover:ring-4',\n 'focus-visible:u-outline',\n 'data-disabled:cursor-not-allowed data-disabled:border-outline/dim-2 data-disabled:hover:ring-transparent',\n 'u-shadow-border-transition',\n 'size-sz-24',\n ],\n {\n variants: {\n /**\n * Color scheme of the radio input.\n */\n intent: makeVariants<\n 'intent',\n ['main', 'support', 'accent', 'success', 'alert', 'error', 'info', 'neutral']\n >({\n main: ['border-outline', 'data-checked:border-main', 'hover:ring-main-container'],\n support: ['border-outline', 'data-checked:border-support', 'hover:ring-support-container'],\n accent: ['border-outline', 'data-checked:border-accent', 'hover:ring-accent-container'],\n neutral: ['border-outline', 'data-checked:border-neutral', 'hover:ring-neutral-container'],\n info: ['border-info', 'data-checked:border-info', 'hover:ring-info-container'],\n success: ['border-success', 'data-checked:border-success', 'hover:ring-success-container'],\n alert: ['border-alert', 'data-checked:border-alert', 'hover:ring-alert-container'],\n error: ['border-error', 'data-checked:border-error', 'hover:ring-error-container'],\n }),\n },\n defaultVariants: {\n intent: 'support',\n },\n }\n)\n\nexport type RadioInputVariantsProps = VariantProps<typeof radioInputVariants>\n","import { Radio } from '@base-ui/react/radio'\nimport { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { HTMLAttributes, ReactElement, Ref } from 'react'\n\nimport { RadioIndicator } from './RadioIndicator'\nimport { radioInputVariants, RadioInputVariantsProps } from './RadioInput.styles'\n\nexport interface RadioInputProps\n extends RadioInputVariantsProps,\n Omit<HTMLAttributes<HTMLElement>, 'value' | 'onChange'> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n * Uses Base UI's render prop internally to merge behaviour into the child element.\n */\n asChild?: boolean\n /**\n * The value given as data when submitted with a name.\n */\n value: string\n /**\n * When true, prevents the user from interacting with the radio item.\n */\n disabled?: boolean\n /**\n * When true, indicates that the user must check the radio item before the owning form can be submitted.\n */\n required?: boolean\n /**\n * Ref forwarded to the hidden `<input type=\"radio\">` rendered by Base UI.\n * Useful for programmatic activation (e.g. clicking from an associated label span).\n */\n inputRef?: Ref<HTMLInputElement>\n ref?: Ref<HTMLElement>\n /**\n * When true, the visual radio input (outer ring and inner dot) is visually hidden but remains\n * accessible in the DOM. Useful for custom radio appearances where only the label matters visually.\n * @default false\n */\n hideInput?: boolean\n}\n\nexport const RadioInput = ({\n intent: intentProp,\n className,\n asChild,\n children,\n inputRef,\n hideInput = false,\n ref,\n ...others\n}: RadioInputProps) => {\n const { state } = useFormFieldControl()\n\n const intent = state ?? intentProp\n\n return (\n <Radio.Root\n data-spark-component=\"radio-input\"\n ref={ref}\n inputRef={inputRef}\n render={asChild ? (children as ReactElement) : undefined}\n className={hideInput ? 'sr-only' : radioInputVariants({ intent, className })}\n {...others}\n >\n {!asChild && !hideInput && <RadioIndicator intent={intent} keepMounted />}\n </Radio.Root>\n )\n}\n\nRadioInput.displayName = 'RadioGroup.RadioInput'\n","import { cx } from 'class-variance-authority'\nimport { Ref, useId } from 'react'\n\nimport { Label } from '../label'\nimport { useRadioGroup } from './RadioGroupContext'\nimport { RadioInput, RadioInputProps } from './RadioInput'\n\nexport type RadioProps = RadioInputProps & {\n ref?: Ref<HTMLElement>\n}\n\nconst ID_PREFIX = ':radio'\n\nexport const Radio = ({\n className,\n children,\n disabled: disabledProp,\n ref,\n ...others\n}: RadioProps) => {\n const innerLabelId = `${ID_PREFIX}-label-${useId()}`\n\n const { intent, disabled, reverse } = useRadioGroup()\n\n const isDisabled = disabledProp || disabled\n\n const radioLabel = children && (\n <Label\n data-spark-component=\"radio-label\"\n id={innerLabelId}\n className={cx(\n 'grow',\n isDisabled ? 'text-neutral/dim-2 cursor-not-allowed' : 'cursor-pointer'\n )}\n >\n {children}\n </Label>\n )\n\n const radioInput = (\n <RadioInput\n ref={ref}\n intent={intent}\n aria-labelledby={children ? innerLabelId : undefined}\n {...others}\n disabled={disabledProp}\n />\n )\n\n const content = reverse ? (\n <>\n {radioLabel}\n {radioInput}\n </>\n ) : (\n <>\n {radioInput}\n {radioLabel}\n </>\n )\n\n return <span className={cx('gap-md text-body-1 flex items-start', className)}>{content}</span>\n}\n\nRadio.displayName = 'RadioGroup.Radio'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const radioGroupStyles = cva(['flex'], {\n variants: {\n orientation: {\n vertical: ['flex-col', 'gap-lg'],\n horizontal: ['flex-row', 'gap-xl'],\n },\n },\n})\n\nexport type RadioGroupVariantsProps = VariantProps<typeof radioGroupStyles>\n","import { ReactNode, useMemo } from 'react'\n\nimport type { RadioGroupProps } from './RadioGroup'\nimport { RadioGroupContext } from './RadioGroupContext'\nimport type { RadioInputProps } from './RadioInput'\n\nexport interface RadioGroupProviderProps\n extends Pick<RadioInputProps, 'intent' | 'disabled'>,\n Pick<RadioGroupProps, 'reverse'> {\n children: ReactNode\n}\n\nexport const RadioGroupProvider = ({\n intent,\n disabled,\n reverse,\n children,\n}: RadioGroupProviderProps) => {\n const value = useMemo(() => ({ intent, disabled, reverse }), [intent, disabled, reverse])\n\n return <RadioGroupContext.Provider value={value}>{children}</RadioGroupContext.Provider>\n}\n","import { RadioGroup as BaseUIRadioGroup } from '@base-ui/react/radio-group'\nimport { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { HTMLAttributes, Ref } from 'react'\n\nimport { radioGroupStyles, RadioGroupVariantsProps } from './RadioGroup.styles'\nimport { RadioGroupProvider } from './RadioGroupProvider'\nimport { RadioInputVariantsProps } from './RadioInput.styles'\n\nexport interface RadioGroupProps\n extends RadioGroupVariantsProps,\n Pick<RadioInputVariantsProps, 'intent'>,\n Omit<HTMLAttributes<HTMLDivElement>, 'value' | 'defaultValue' | 'dir' | 'onChange'> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n /**\n * The value of the radio item that should be checked when initially rendered. Use when you do not need to control the state of the radio items.\n */\n defaultValue?: string\n /**\n * The controlled value of the radio item to check. Should be used in conjunction with onValueChange.\n */\n value?: string\n /**\n * Event handler called when the value changes.\n */\n onValueChange?: (value: string) => void\n /**\n * When true, prevents the user from interacting with radio items.\n */\n disabled?: boolean\n /**\n * The name of the group. Submitted with its owning form as part of a name/value pair.\n */\n name?: string\n /**\n * When true, indicates that the user must check a radio item before the owning form can be submitted.\n */\n required?: boolean\n /**\n * The orientation of the component.\n */\n orientation?: 'horizontal' | 'vertical'\n /**\n * The reading direction of the radio group.\n */\n dir?: 'ltr' | 'rtl'\n /**\n * When true, the label will be placed on the left side of the Radio\n */\n reverse?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\nexport const RadioGroup = ({\n orientation = 'vertical',\n intent = 'support',\n disabled,\n className,\n required: requiredProp,\n reverse = false,\n onValueChange: onValueChangeProp,\n ref,\n ...others\n}: RadioGroupProps) => {\n const { labelId, isInvalid, isRequired, description, name } = useFormFieldControl()\n const required = requiredProp !== undefined ? requiredProp : isRequired\n\n const handleValueChange = onValueChangeProp\n ? (value: unknown) => onValueChangeProp(value as string)\n : undefined\n\n return (\n <RadioGroupProvider reverse={reverse} intent={intent} disabled={disabled}>\n <BaseUIRadioGroup\n data-spark-component=\"radio-group\"\n className={radioGroupStyles({ orientation, className })}\n name={name}\n ref={ref}\n disabled={disabled}\n required={required}\n onValueChange={handleValueChange}\n aria-orientation={orientation}\n aria-labelledby={labelId}\n aria-invalid={isInvalid}\n aria-required={required}\n aria-describedby={description}\n {...others}\n />\n </RadioGroupProvider>\n )\n}\n\nRadioGroup.displayName = 'RadioGroup'\n","import { Radio } from './Radio'\nimport { RadioGroup as Root } from './RadioGroup'\n\nexport const RadioGroup: typeof Root & {\n Radio: typeof Radio\n} = Object.assign(Root, {\n Radio,\n})\n\nRadioGroup.displayName = 'RadioGroup'\nRadio.displayName = 'RadioGroup.Radio'\n\nexport { type RadioGroupProps } from './RadioGroup'\nexport { type RadioProps } from './Radio'\n"],"names":["RadioGroupContext","createContext","useRadioGroup","context","useContext","radioIndicatorStyles","cva","makeVariants","RadioIndicator","intent","className","keepMounted","ref","others","jsx","Radio","radioInputVariants","RadioInput","intentProp","asChild","children","inputRef","hideInput","state","useFormFieldControl","ID_PREFIX","disabledProp","innerLabelId","useId","disabled","reverse","radioLabel","Label","cx","radioInput","content","jsxs","Fragment","radioGroupStyles","RadioGroupProvider","value","useMemo","RadioGroup","orientation","requiredProp","onValueChangeProp","labelId","isInvalid","isRequired","description","name","required","handleValueChange","BaseUIRadioGroup","Root"],"mappings":";;;;;;;;AAQO,MAAMA,IAAoBC,EAA6C,IAAI,GAErEC,IAAgB,MAAM;AACjC,QAAMC,IAAUC,EAAWJ,CAAiB;AAE5C,MAAI,CAACG;AACH,UAAM,MAAM,yDAAyD;AAGvE,SAAOA;AACT,GCfaE,IAAuBC;AAAA,EAClC;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAAA,EAEF;AAAA,IACE,UAAU;AAAA,MACR,QAAQC,EAGN;AAAA,QACA,MAAM,CAAC,eAAe;AAAA,QACtB,SAAS,CAAC,kBAAkB;AAAA,QAC5B,QAAQ,CAAC,iBAAiB;AAAA,QAC1B,SAAS,CAAC,kBAAkB;AAAA,QAC5B,SAAS,CAAC,kBAAkB;AAAA,QAC5B,OAAO,CAAC,gBAAgB;AAAA,QACxB,OAAO,CAAC,gBAAgB;AAAA,QACxB,MAAM,CAAC,eAAe;AAAA,MAAA,CACvB;AAAA,IAAA;AAAA,IAEH,iBAAiB;AAAA,MACf,QAAQ;AAAA,IAAA;AAAA,EACV;AAEJ,GCtBaC,IAAiB,CAAC;AAAA,EAC7B,QAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,KAAAC;AAAA,EACA,GAAGC;AACL,MAEI,gBAAAC;AAAA,EAACC,EAAM;AAAA,EAAN;AAAA,IACC,KAAAH;AAAA,IACA,aAAAD;AAAA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MACd,iBAAeI;AAAA,MACf,oBAAkBF;AAAA,MACjB,GAAGpC;AAAA,IAAA;AAAA,EAAA,GAER;AAEJ;AAEA6B,EAAW,cAAc;AC3FlB,MAAMA,IAET,OAAO,OAAOY,GAAM;AAAA,EACtB,OAAAvC;AACF,CAAC;AAED2B,EAAW,cAAc;AACzB3B,EAAM,cAAc;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../src/radio-group/RadioGroupContext.tsx","../../src/radio-group/RadioIndicator.styles.ts","../../src/radio-group/RadioIndicator.tsx","../../src/radio-group/RadioInput.styles.ts","../../src/radio-group/RadioInput.tsx","../../src/radio-group/RadioLabel.styles.tsx","../../src/radio-group/RadioLabel.tsx","../../src/radio-group/Radio.tsx","../../src/radio-group/RadioGroup.styles.ts","../../src/radio-group/RadioGroupProvider.tsx","../../src/radio-group/RadioGroup.tsx","../../src/radio-group/index.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\n\nimport type { RadioGroupProps } from './RadioGroup'\nimport type { RadioInputProps } from './RadioInput'\n\nexport type RadioGroupContextState = Pick<RadioInputProps, 'intent' | 'disabled'> &\n Pick<RadioGroupProps, 'reverse'>\n\nexport const RadioGroupContext = createContext<RadioGroupContextState | null>(null)\n\nexport const useRadioGroup = () => {\n const context = useContext(RadioGroupContext)\n\n if (!context) {\n throw Error('useRadioGroup must be used within a RadioGroup provider')\n }\n\n return context\n}\n","import { makeVariants } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const radioIndicatorStyles = cva(\n [\n 'relative block',\n 'size-3/5',\n 'after:absolute',\n 'after:left-1/2 after:top-1/2 after:-translate-x-1/2 after:-translate-y-1/2',\n 'after:h-0',\n 'after:w-0',\n 'after:block',\n 'after:rounded-[50%]',\n \"after:content-['']\",\n 'after:transition-all',\n 'data-[state=checked]:after:size-full',\n ],\n {\n variants: {\n intent: makeVariants<\n 'intent',\n ['main', 'support', 'accent', 'success', 'alert', 'error', 'info', 'neutral']\n >({\n main: ['after:bg-main'],\n support: ['after:bg-support'],\n accent: ['after:bg-accent'],\n neutral: ['after:bg-neutral'],\n success: ['after:bg-success'],\n alert: ['after:bg-alert'],\n error: ['after:bg-error'],\n info: ['after:bg-info'],\n }),\n },\n defaultVariants: {\n intent: 'support',\n },\n }\n)\n\nexport type RadioIndicatorStylesProps = VariantProps<typeof radioIndicatorStyles>\n","import { RadioGroup as RadixRadioGroup } from 'radix-ui'\nimport { Ref } from 'react'\n\nimport { radioIndicatorStyles, RadioIndicatorStylesProps } from './RadioIndicator.styles'\n\nexport interface RadioIndicatorProps extends RadioIndicatorStylesProps {\n className?: string\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n /**\n * Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries.\n */\n forceMount?: true | undefined\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const RadioIndicator = ({ intent, className, ref, ...others }: RadioIndicatorProps) => {\n return (\n <RadixRadioGroup.Indicator\n ref={ref}\n className={radioIndicatorStyles({ intent, className })}\n {...others}\n />\n )\n}\n\nRadioIndicator.displayName = 'RadioGroup.RadioIndicator'\n","import { makeVariants } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const radioInputVariants = cva(\n [\n 'flex shrink-0 items-center justify-center',\n 'rounded-full',\n 'border-md',\n 'outline-hidden',\n 'hover:ring-4',\n 'focus-visible:u-outline',\n 'disabled:cursor-not-allowed disabled:border-outline/dim-2 disabled:hover:ring-transparent',\n 'u-shadow-border-transition',\n 'size-sz-24',\n ],\n {\n variants: {\n /**\n * Color scheme of the radio input.\n */\n intent: makeVariants<\n 'intent',\n ['main', 'support', 'accent', 'success', 'alert', 'error', 'info', 'neutral']\n >({\n main: ['border-outline', 'data-[state=checked]:border-main', 'hover:ring-main-container'],\n support: [\n 'border-outline',\n 'data-[state=checked]:border-support',\n 'hover:ring-support-container',\n ],\n accent: [\n 'border-outline',\n 'data-[state=checked]:border-accent',\n 'hover:ring-accent-container',\n ],\n neutral: [\n 'border-outline',\n 'data-[state=checked]:border-neutral',\n 'hover:ring-neutral-container',\n ],\n info: ['border-info', 'data-[state=checked]:border-info', 'hover:ring-info-container'],\n success: [\n 'border-success',\n 'data-[state=checked]:border-success',\n 'hover:ring-success-container',\n ],\n alert: ['border-alert', 'data-[state=checked]:border-alert', 'hover:ring-alert-container'],\n error: ['border-error', 'data-[state=checked]:border-error', 'hover:ring-error-container'],\n }),\n },\n defaultVariants: {\n intent: 'support',\n },\n }\n)\n\nexport type RadioInputVariantsProps = VariantProps<typeof radioInputVariants>\n","import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { RadioGroup as RadixRadioGroup } from 'radix-ui'\nimport { ButtonHTMLAttributes, Ref } from 'react'\n\nimport { RadioIndicator } from './RadioIndicator'\nimport { radioInputVariants, RadioInputVariantsProps } from './RadioInput.styles'\n\nexport interface RadioInputProps\n extends RadioInputVariantsProps,\n Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'value' | 'onChange'> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n /**\n * The value given as data when submitted with a name.\n */\n value: string\n /**\n * When true, prevents the user from interacting with the radio item.\n */\n disabled?: boolean\n /**\n * When true, indicates that the user must check the radio item before the owning form can be submitted.\n */\n required?: boolean\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const RadioInput = ({ intent: intentProp, className, ref, ...others }: RadioInputProps) => {\n const { state } = useFormFieldControl()\n\n const intent = state ?? intentProp\n\n return (\n <RadixRadioGroup.RadioGroupItem\n data-spark-component=\"radio-input\"\n ref={ref}\n className={radioInputVariants({ intent, className })}\n {...others}\n >\n <RadioIndicator intent={intent} forceMount />\n </RadixRadioGroup.RadioGroupItem>\n )\n}\n\nRadioInput.displayName = 'RadioGroup.RadioInput'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const radioLabelStyles = cva('grow', {\n variants: {\n disabled: {\n true: ['text-neutral/dim-2', 'cursor-not-allowed'],\n false: ['cursor-pointer'],\n },\n },\n defaultVariants: {\n disabled: false,\n },\n})\n\nexport type RadioLabelStylesProps = VariantProps<typeof radioLabelStyles>\n","import { Label } from 'radix-ui'\nimport type { HTMLAttributes, PropsWithChildren } from 'react'\n\nimport { radioLabelStyles, RadioLabelStylesProps } from './RadioLabel.styles'\n\nexport interface RadioLabelProps\n extends RadioLabelStylesProps,\n PropsWithChildren<HTMLAttributes<HTMLLabelElement>> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n /**\n * The id of the element the label is associated with.\n */\n htmlFor?: string\n /**\n * When true, prevents the user from interacting with the radio item.\n */\n disabled?: boolean\n}\n\nexport const RadioLabel = ({ disabled, ...others }: RadioLabelProps) => {\n return (\n <Label.Root\n data-spark-component=\"radio-label\"\n className={radioLabelStyles({ disabled })}\n {...others}\n />\n )\n}\n\nRadioLabel.displayName = 'RadioGroup.RadioLabel'\n","import { cx } from 'class-variance-authority'\nimport { Ref, useId } from 'react'\n\nimport { useRadioGroup } from './RadioGroupContext'\nimport { RadioInput, RadioInputProps } from './RadioInput'\nimport { RadioLabel } from './RadioLabel'\n\nexport type RadioProps = RadioInputProps & {\n ref?: Ref<HTMLButtonElement>\n}\n\nconst ID_PREFIX = ':radio'\n\nexport const Radio = ({\n className,\n children,\n id,\n disabled: disabledProp,\n ref,\n ...others\n}: RadioProps) => {\n const innerId = `${ID_PREFIX}-input-${useId()}`\n const innerLabelId = `${ID_PREFIX}-label-${useId()}`\n\n const { intent, disabled, reverse } = useRadioGroup()\n\n const radioLabel = children && (\n <RadioLabel disabled={disabledProp || disabled} htmlFor={id || innerId} id={innerLabelId}>\n {children}\n </RadioLabel>\n )\n\n const radioInput = (\n <RadioInput\n ref={ref}\n id={id || innerId}\n intent={intent}\n aria-labelledby={children ? innerLabelId : undefined}\n {...others}\n disabled={disabledProp}\n />\n )\n\n const content = reverse ? (\n <>\n {radioLabel}\n {radioInput}\n </>\n ) : (\n <>\n {radioInput}\n {radioLabel}\n </>\n )\n\n return <span className={cx('gap-md text-body-1 flex items-start', className)}>{content}</span>\n}\n\nRadio.displayName = 'RadioGroup.Radio'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const radioGroupStyles = cva(['flex'], {\n variants: {\n orientation: {\n vertical: ['flex-col', 'gap-lg'],\n horizontal: ['flex-row', 'gap-xl'],\n },\n },\n})\n\nexport type RadioGroupVariantsProps = VariantProps<typeof radioGroupStyles>\n","import { ReactNode, useMemo } from 'react'\n\nimport type { RadioGroupProps } from './RadioGroup'\nimport { RadioGroupContext } from './RadioGroupContext'\nimport type { RadioInputProps } from './RadioInput'\n\nexport interface RadioGroupProviderProps\n extends Pick<RadioInputProps, 'intent' | 'disabled'>,\n Pick<RadioGroupProps, 'reverse'> {\n children: ReactNode\n}\n\nexport const RadioGroupProvider = ({\n intent,\n disabled,\n reverse,\n children,\n}: RadioGroupProviderProps) => {\n const value = useMemo(() => ({ intent, disabled, reverse }), [intent, disabled, reverse])\n\n return <RadioGroupContext.Provider value={value}>{children}</RadioGroupContext.Provider>\n}\n","import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { RadioGroup as RadixRadioGroup } from 'radix-ui'\nimport { HTMLAttributes, Ref } from 'react'\n\nimport { radioGroupStyles, RadioGroupVariantsProps } from './RadioGroup.styles'\nimport { RadioGroupProvider } from './RadioGroupProvider'\nimport { RadioInputVariantsProps } from './RadioInput.styles'\n\nexport interface RadioGroupProps\n extends RadioGroupVariantsProps,\n Pick<RadioInputVariantsProps, 'intent'>,\n Omit<HTMLAttributes<HTMLDivElement>, 'value' | 'defaultValue' | 'dir' | 'onChange'> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n /**\n * The value of the radio item that should be checked when initially rendered. Use when you do not need to control the state of the radio items.\n */\n defaultValue?: string\n /**\n * The controlled value of the radio item to check. Should be used in conjunction with onValueChange.\n */\n value?: string\n /**\n * Event handler called when the value changes.\n */\n onValueChange?: (value: string) => void\n /**\n * When true, prevents the user from interacting with radio items.\n */\n disabled?: boolean\n /**\n * The name of the group. Submitted with its owning form as part of a name/value pair.\n */\n name?: string\n /**\n * When true, indicates that the user must check a radio item before the owning form can be submitted.\n */\n required?: boolean\n /**\n * The orientation of the component.\n */\n orientation?: 'horizontal' | 'vertical'\n /**\n * The reading direction of the radio group.\n */\n dir?: 'ltr' | 'rtl'\n /**\n * When true, keyboard navigation will loop from last item to first, and vice versa.\n */\n loop?: boolean\n /**\n * When true, the label will be placed on the left side of the Radio\n */\n reverse?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\nexport const RadioGroup = ({\n orientation = 'vertical',\n loop = true,\n intent = 'support',\n disabled,\n className,\n required: requiredProp,\n reverse = false,\n ref,\n ...others\n}: RadioGroupProps) => {\n const { labelId, isInvalid, isRequired, description, name } = useFormFieldControl()\n const required = requiredProp !== undefined ? requiredProp : isRequired\n\n return (\n <RadioGroupProvider reverse={reverse} intent={intent} disabled={disabled}>\n <RadixRadioGroup.RadioGroup\n data-spark-component=\"radio-group\"\n className={radioGroupStyles({ orientation, className })}\n name={name}\n ref={ref}\n disabled={disabled}\n orientation={orientation}\n loop={loop}\n required={required}\n aria-labelledby={labelId}\n aria-invalid={isInvalid}\n aria-required={required}\n aria-describedby={description}\n {...others}\n />\n </RadioGroupProvider>\n )\n}\n\nRadioGroup.displayName = 'RadioGroup'\n","import { Radio } from './Radio'\nimport { RadioGroup as Root } from './RadioGroup'\n\nexport const RadioGroup: typeof Root & {\n Radio: typeof Radio\n} = Object.assign(Root, {\n Radio,\n})\n\nRadioGroup.displayName = 'RadioGroup'\nRadio.displayName = 'RadioGroup.Radio'\n\nexport { type RadioGroupProps } from './RadioGroup'\nexport { type RadioProps } from './Radio'\n"],"names":["RadioGroupContext","createContext","useRadioGroup","context","useContext","radioIndicatorStyles","cva","makeVariants","RadioIndicator","intent","className","ref","others","jsx","RadixRadioGroup","radioInputVariants","RadioInput","intentProp","state","useFormFieldControl","radioLabelStyles","RadioLabel","disabled","Label","ID_PREFIX","Radio","children","id","disabledProp","innerId","useId","innerLabelId","reverse","radioLabel","radioInput","content","jsxs","Fragment","cx","radioGroupStyles","RadioGroupProvider","value","useMemo","RadioGroup","orientation","loop","requiredProp","labelId","isInvalid","isRequired","description","name","required","Root"],"mappings":";;;;;;AAQO,MAAMA,IAAoBC,EAA6C,IAAI,GAErEC,IAAgB,MAAM;AACjC,QAAMC,IAAUC,EAAWJ,CAAiB;AAE5C,MAAI,CAACG;AACH,UAAM,MAAM,yDAAyD;AAGvE,SAAOA;AACT,GCfaE,IAAuBC;AAAA,EAClC;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAAA,EAEF;AAAA,IACE,UAAU;AAAA,MACR,QAAQC,EAGN;AAAA,QACA,MAAM,CAAC,eAAe;AAAA,QACtB,SAAS,CAAC,kBAAkB;AAAA,QAC5B,QAAQ,CAAC,iBAAiB;AAAA,QAC1B,SAAS,CAAC,kBAAkB;AAAA,QAC5B,SAAS,CAAC,kBAAkB;AAAA,QAC5B,OAAO,CAAC,gBAAgB;AAAA,QACxB,OAAO,CAAC,gBAAgB;AAAA,QACxB,MAAM,CAAC,eAAe;AAAA,MAAA,CACvB;AAAA,IAAA;AAAA,IAEH,iBAAiB;AAAA,MACf,QAAQ;AAAA,IAAA;AAAA,EACV;AAEJ,GCnBaC,IAAiB,CAAC,EAAE,QAAAC,GAAQ,WAAAC,GAAW,KAAAC,GAAK,GAAGC,QAExD,gBAAAC;AAAA,EAACC,EAAgB;AAAA,EAAhB;AAAA,IACC,KAAAH;AAAA,IACA,WAAWN,EAAqB,EAAE,QAAAI,GAAQ,WAAAC,GAAW;AAAA,IACpD,GAAGE;AAAA,EAAA;AAAA;AAKVJ,EAAe,cAAc;ACzBtB,MAAMO,IAAqBT;AAAA,EAChC;AAAA,IACE;AAAA,IACA;AAAA,I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ACA,MAAAC;AAAA,MACA,UAAAO;AAAA,MACA,mBAAiBL;AAAA,MACjB,gBAAcC;AAAA,MACd,iBAAeI;AAAA,MACf,oBAAkBF;AAAA,MACjB,GAAGtC;AAAA,IAAA;AAAA,EAAA,GAER;AAEJ;AAEA+B,EAAW,cAAc;AC3FlB,MAAMA,IAET,OAAO,OAAOU,GAAM;AAAA,EACtB,OAAA5B;AACF,CAAC;AAEDkB,EAAW,cAAc;AACzBlB,EAAM,cAAc;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),k=require("@base-ui/react/radio-group"),E=require("@spark-ui/components/form-field"),F=require("@spark-ui/hooks/use-merge-refs"),r=require("react"),g=require("class-variance-authority"),z=require("@base-ui/react/radio"),B=g.cva(["default:self-start","group inline-grid grid-flow-col auto-cols-fr","relative items-stretch min-w-max","rounded-xl p-sm","bg-surface border-sm border-outline"]),M=g.cva(["relative z-raised min-h-sz-44 focus-visible:outline-none","flex flex-none items-center justify-center flex-col","default:px-lg default:py-md","rounded-[20px]","cursor-pointer select-none","font-medium","transition-colors duration-150","outline-none","focus-visible:u-outline","data-disabled:cursor-not-allowed data-disabled:opacity-dim-3","data-checked:text-on-support-container","data-checked:font-bold"]),P=g.cva(["absolute z-base","rounded-[20px]","bg-support-container border-md border-support","group-has-focus-visible:border-focus","transition-[left,top,width,height] duration-200 ease-in-out","pointer-events-none"]),v=r.createContext({}),G=()=>{const e=r.useContext(v);if(!e)throw Error("useSegmentedControlContext must be used within a SegmentedControlContext Provider");return e},O=e=>{let t=null;return r.Children.forEach(e,o=>{t===null&&r.isValidElement(o)&&typeof o.props.value=="string"&&(t=o.props.value)}),t},x=({value:e,defaultValue:t,onValueChange:o,className:s,children:i,ref:n,...m})=>{const f=r.useRef(null),d=F.useMergeRefs(f,n),c=O(i),a=e!==void 0,[l,p]=r.useState(()=>t??c),y=a?e??null:l,R=j=>{const b=j;a||p(b),o?.(b)},{labelId:I,description:w,isRequired:V,isInvalid:q,name:N}=E.useFormFieldControl();return u.jsx(v.Provider,{value:{checkedValue:y,containerRef:f},children:u.jsx(k.RadioGroup,{ref:d,value:a?e:void 0,defaultValue:a?void 0:t??c??void 0,onValueChange:R,"data-spark-component":"segmented-control",className:B({className:s}),"aria-labelledby":I,"aria-describedby":w,"aria-required":V||void 0,"aria-invalid":q||void 0,name:N,...m,children:i})})};x.displayName="SegmentedControl";const h=({className:e,ref:t,...o})=>{const{checkedValue:s,containerRef:i}=G(),[n,m]=r.useState(null);if(r.useEffect(()=>{const d=i.current;if(!d)return;const c=s?d.querySelector(`[data-value="${s}"]`):null;if(!c){m(null);return}const a=d.getBoundingClientRect(),l=c.getBoundingClientRect(),p=1;m({left:l.left-a.left-p,top:l.top-a.top-p,width:l.width,height:l.height})},[s,i]),!n)return null;const f={left:n.left,top:n.top,width:n.width,height:n.height};return u.jsx("span",{ref:t,"data-spark-component":"segmented-control-indicator","aria-hidden":!0,className:P({className:e}),style:f,...o})};h.displayName="SegmentedControl.Indicator";const C=({value:e,disabled:t=!1,children:o,className:s,ref:i,...n})=>u.jsxs(z.Radio.Root,{ref:i,"data-spark-component":"segmented-control-item","data-value":e,value:e,disabled:t,className:M({className:s}),...n,children:[o,u.jsx("span",{"aria-hidden":"true",className:"bg-success pointer-events-none h-0 overflow-hidden font-bold content-[attr(data-text)/'']",children:o})]});C.displayName="SegmentedControl.Item";const S=Object.assign(x,{Item:C,Indicator:h});S.displayName="SegmentedControl";C.displayName="SegmentedControl.Item";h.displayName="SegmentedControl.Indicator";exports.SegmentedControl=S;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("react/jsx-runtime"),z=require("@base-ui/react/radio-group"),N=require("@spark-ui/components/form-field"),E=require("@spark-ui/hooks/use-merge-refs"),o=require("react"),S=require("class-variance-authority"),L=require("@base-ui/react/radio"),F=S.cva(["default:self-start","group inline-grid grid-flow-col auto-cols-fr","relative items-stretch min-w-max","rounded-xl p-sm","bg-surface border-sm border-outline"]),M=S.cva(["relative z-raised min-h-sz-44 focus-visible:outline-none","flex flex-none items-center justify-center gap-md","default:px-lg default:py-md","rounded-[20px]","cursor-pointer select-none","font-medium","transition-colors duration-150","outline-none","focus-visible:u-outline","data-disabled:cursor-not-allowed data-disabled:opacity-dim-3","data-checked:text-on-support-container","data-checked:[&>[data-spark-segmented-control-text]]:[text-shadow:0.35px_0_currentColor,-0.35px_0_currentColor]"]),O=S.cva(["absolute z-base","rounded-[20px]","bg-support-container border-md border-support","group-has-focus-visible:border-focus","transition-[left,top,width,height] duration-200 ease-in-out","pointer-events-none"]),I=o.createContext({}),_=()=>{const e=o.useContext(I);if(!e)throw Error("useSegmentedControlContext must be used within a SegmentedControlContext Provider");return e},P=e=>{let n=null;return o.Children.forEach(e,r=>{n===null&&o.isValidElement(r)&&typeof r.props.value=="string"&&(n=r.props.value)}),n},V=({value:e,defaultValue:n,onValueChange:r,className:c,children:i,ref:s,...u})=>{const t=o.useRef(null),g=E.useMergeRefs(t,s),f=P(i),m=e!==void 0,[a,h]=o.useState(()=>n??f),p=m?e??null:a,l=k=>{const R=k;m||h(R),r?.(R)},{labelId:C,description:d,isRequired:b,isInvalid:x,name:j}=N.useFormFieldControl();return v.jsx(I.Provider,{value:{checkedValue:p,containerRef:t},children:v.jsx(z.RadioGroup,{ref:g,value:m?e:void 0,defaultValue:m?void 0:n??f??void 0,onValueChange:l,"data-spark-component":"segmented-control",className:F({className:c}),"aria-labelledby":C,"aria-describedby":d,"aria-required":b||void 0,"aria-invalid":x||void 0,name:j,...u,children:i})})};V.displayName="SegmentedControl";const y=({className:e,ref:n,...r})=>{const{checkedValue:c,containerRef:i}=_(),[s,u]=o.useState(null),t=o.useMemo(()=>c?`[data-value="${CSS.escape(c)}"]`:null,[c]);if(o.useEffect(()=>{const f=i.current;if(!f)return;const m=t?f.querySelector(t):null,a=()=>{const p=i.current;if(!p||!t){u(null);return}const l=p.querySelector(t);if(!l){u(null);return}const C=p.getBoundingClientRect(),d=l.getBoundingClientRect(),b=l.offsetWidth>0?d.width/l.offsetWidth:1,x=l.offsetHeight>0?d.height/l.offsetHeight:1;u({left:(d.left-C.left)/b-p.clientLeft,top:(d.top-C.top)/x-p.clientTop,width:d.width/b,height:d.height/x})};a();const h=typeof ResizeObserver<"u"?new ResizeObserver(()=>{a()}):null;return h?.observe(f),m&&h?.observe(m),window.addEventListener("resize",a,{passive:!0}),window.visualViewport?.addEventListener("resize",a,{passive:!0}),()=>{h?.disconnect(),window.removeEventListener("resize",a),window.visualViewport?.removeEventListener("resize",a)}},[i,t]),!s)return null;const g={left:s.left,top:s.top,width:s.width,height:s.height};return v.jsx("span",{ref:n,"data-spark-component":"segmented-control-indicator","aria-hidden":!0,className:O({className:e}),style:g,...r})};y.displayName="SegmentedControl.Indicator";const w=({value:e,disabled:n=!1,children:r,className:c,ref:i,...s})=>{const u=o.Children.toArray(r).map((t,g)=>typeof t=="string"||typeof t=="number"?v.jsx("span",{"data-spark-segmented-control-text":!0,children:t},`text-${g}`):t);return v.jsx(L.Radio.Root,{ref:i,"data-spark-component":"segmented-control-item","data-value":e,value:e,disabled:n,className:M({className:c}),...s,children:u})};w.displayName="SegmentedControl.Item";const q=Object.assign(V,{Item:w,Indicator:y});q.displayName="SegmentedControl";w.displayName="SegmentedControl.Item";y.displayName="SegmentedControl.Indicator";exports.SegmentedControl=q;
2
2
  //# sourceMappingURL=index.js.map