@charcoal-ui/react 6.0.0-rc.8 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (272) hide show
  1. package/dist/_lib/compat.d.ts.map +1 -1
  2. package/dist/_lib/createDivComponent.cjs +0 -1
  3. package/dist/_lib/createDivComponent.cjs.map +1 -1
  4. package/dist/_lib/createDivComponent.d.ts +1 -1
  5. package/dist/_lib/createDivComponent.js.map +1 -1
  6. package/dist/_lib/index.cjs.map +1 -1
  7. package/dist/_lib/index.js.map +1 -1
  8. package/dist/_lib/useClassNames.cjs +0 -1
  9. package/dist/_lib/useClassNames.cjs.map +1 -1
  10. package/dist/_lib/useClassNames.js.map +1 -1
  11. package/dist/_lib/useForwardedRef.cjs +1 -1
  12. package/dist/_lib/useForwardedRef.cjs.map +1 -1
  13. package/dist/_lib/useForwardedRef.js.map +1 -1
  14. package/dist/_lib/useIsomorphicLayoutEffect.cjs +0 -1
  15. package/dist/_lib/useIsomorphicLayoutEffect.cjs.map +1 -1
  16. package/dist/_lib/useIsomorphicLayoutEffect.d.ts +2 -2
  17. package/dist/_lib/useIsomorphicLayoutEffect.d.ts.map +1 -1
  18. package/dist/_lib/useIsomorphicLayoutEffect.js.map +1 -1
  19. package/dist/components/Button/index.d.ts +1 -1
  20. package/dist/components/Button/index.d.ts.map +1 -1
  21. package/dist/components/Button/index2.cjs +1 -1
  22. package/dist/components/Button/index2.cjs.map +1 -1
  23. package/dist/components/Button/index2.js.map +1 -1
  24. package/dist/components/Carousel/CarouselItem.cjs +0 -1
  25. package/dist/components/Carousel/CarouselItem.cjs.map +1 -1
  26. package/dist/components/Carousel/CarouselItem.d.ts.map +1 -1
  27. package/dist/components/Carousel/CarouselItem.js.map +1 -1
  28. package/dist/components/Carousel/carouselStore.cjs.map +1 -1
  29. package/dist/components/Carousel/carouselStore.js.map +1 -1
  30. package/dist/components/Carousel/index.d.ts +1 -1
  31. package/dist/components/Carousel/index.d.ts.map +1 -1
  32. package/dist/components/Carousel/index2.cjs +0 -1
  33. package/dist/components/Carousel/index2.cjs.map +1 -1
  34. package/dist/components/Carousel/index2.js.map +1 -1
  35. package/dist/components/Carousel/intersectionObserver.cjs.map +1 -1
  36. package/dist/components/Carousel/intersectionObserver.js.map +1 -1
  37. package/dist/components/Carousel/resizeObserver.cjs.map +1 -1
  38. package/dist/components/Carousel/resizeObserver.js.map +1 -1
  39. package/dist/components/Carousel/store.cjs.map +1 -1
  40. package/dist/components/Carousel/store.js.map +1 -1
  41. package/dist/components/Carousel/useCarouselScroller.cjs +0 -1
  42. package/dist/components/Carousel/useCarouselScroller.cjs.map +1 -1
  43. package/dist/components/Carousel/useCarouselScroller.js.map +1 -1
  44. package/dist/components/Checkbox/CheckboxInput/index.d.ts.map +1 -1
  45. package/dist/components/Checkbox/CheckboxInput/index2.cjs +0 -1
  46. package/dist/components/Checkbox/CheckboxInput/index2.cjs.map +1 -1
  47. package/dist/components/Checkbox/CheckboxInput/index2.js.map +1 -1
  48. package/dist/components/Checkbox/CheckboxWithLabel.cjs +1 -1
  49. package/dist/components/Checkbox/CheckboxWithLabel.cjs.map +1 -1
  50. package/dist/components/Checkbox/CheckboxWithLabel.d.ts +2 -2
  51. package/dist/components/Checkbox/CheckboxWithLabel.d.ts.map +1 -1
  52. package/dist/components/Checkbox/CheckboxWithLabel.js.map +1 -1
  53. package/dist/components/Checkbox/index.d.ts.map +1 -1
  54. package/dist/components/Checkbox/index2.cjs +0 -1
  55. package/dist/components/Checkbox/index2.cjs.map +1 -1
  56. package/dist/components/Checkbox/index2.js.map +1 -1
  57. package/dist/components/Clickable/index.d.ts +1 -1
  58. package/dist/components/Clickable/index.d.ts.map +1 -1
  59. package/dist/components/Clickable/index2.cjs +1 -1
  60. package/dist/components/Clickable/index2.cjs.map +1 -1
  61. package/dist/components/Clickable/index2.js.map +1 -1
  62. package/dist/components/DropdownSelector/DropdownMenuItem/index2.cjs +0 -1
  63. package/dist/components/DropdownSelector/DropdownMenuItem/index2.cjs.map +1 -1
  64. package/dist/components/DropdownSelector/DropdownMenuItem/index2.js.map +1 -1
  65. package/dist/components/DropdownSelector/DropdownPopover.cjs +0 -1
  66. package/dist/components/DropdownSelector/DropdownPopover.cjs.map +1 -1
  67. package/dist/components/DropdownSelector/DropdownPopover.js.map +1 -1
  68. package/dist/components/DropdownSelector/ListItem/index.d.ts +1 -1
  69. package/dist/components/DropdownSelector/ListItem/index.d.ts.map +1 -1
  70. package/dist/components/DropdownSelector/ListItem/index2.cjs +0 -1
  71. package/dist/components/DropdownSelector/ListItem/index2.cjs.map +1 -1
  72. package/dist/components/DropdownSelector/ListItem/index2.js.map +1 -1
  73. package/dist/components/DropdownSelector/MenuItem/index.cjs +29 -2
  74. package/dist/components/DropdownSelector/MenuItem/index.cjs.map +1 -1
  75. package/dist/components/DropdownSelector/MenuItem/index.d.ts.map +1 -1
  76. package/dist/components/DropdownSelector/MenuItem/index.js +30 -2
  77. package/dist/components/DropdownSelector/MenuItem/index.js.map +1 -1
  78. package/dist/components/DropdownSelector/MenuItem/internals/handleFocusByKeyBoard.cjs.map +1 -1
  79. package/dist/components/DropdownSelector/MenuItem/internals/handleFocusByKeyBoard.js.map +1 -1
  80. package/dist/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.cjs +0 -1
  81. package/dist/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.cjs.map +1 -1
  82. package/dist/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.js.map +1 -1
  83. package/dist/components/DropdownSelector/MenuItemGroup/index2.cjs +0 -1
  84. package/dist/components/DropdownSelector/MenuItemGroup/index2.cjs.map +1 -1
  85. package/dist/components/DropdownSelector/MenuItemGroup/index2.js.map +1 -1
  86. package/dist/components/DropdownSelector/MenuList/MenuListContext.cjs +0 -1
  87. package/dist/components/DropdownSelector/MenuList/MenuListContext.cjs.map +1 -1
  88. package/dist/components/DropdownSelector/MenuList/MenuListContext.js.map +1 -1
  89. package/dist/components/DropdownSelector/MenuList/index2.cjs +0 -1
  90. package/dist/components/DropdownSelector/MenuList/index2.cjs.map +1 -1
  91. package/dist/components/DropdownSelector/MenuList/index2.js.map +1 -1
  92. package/dist/components/DropdownSelector/MenuList/internals/getValuesRecursive.cjs +1 -1
  93. package/dist/components/DropdownSelector/MenuList/internals/getValuesRecursive.cjs.map +1 -1
  94. package/dist/components/DropdownSelector/MenuList/internals/getValuesRecursive.js.map +1 -1
  95. package/dist/components/DropdownSelector/Popover/index.d.ts.map +1 -1
  96. package/dist/components/DropdownSelector/Popover/index2.cjs +18 -1
  97. package/dist/components/DropdownSelector/Popover/index2.cjs.map +1 -1
  98. package/dist/components/DropdownSelector/Popover/index2.js +19 -1
  99. package/dist/components/DropdownSelector/Popover/index2.js.map +1 -1
  100. package/dist/components/DropdownSelector/Popover/usePreventScroll.cjs +0 -1
  101. package/dist/components/DropdownSelector/Popover/usePreventScroll.cjs.map +1 -1
  102. package/dist/components/DropdownSelector/Popover/usePreventScroll.js.map +1 -1
  103. package/dist/components/DropdownSelector/index.d.ts.map +1 -1
  104. package/dist/components/DropdownSelector/index2.cjs +27 -10
  105. package/dist/components/DropdownSelector/index2.cjs.map +1 -1
  106. package/dist/components/DropdownSelector/index2.js +26 -9
  107. package/dist/components/DropdownSelector/index2.js.map +1 -1
  108. package/dist/components/DropdownSelector/utils/findPreviewRecursive.cjs +1 -1
  109. package/dist/components/DropdownSelector/utils/findPreviewRecursive.cjs.map +1 -1
  110. package/dist/components/DropdownSelector/utils/findPreviewRecursive.js.map +1 -1
  111. package/dist/components/FieldLabel/index.d.ts.map +1 -1
  112. package/dist/components/FieldLabel/index2.cjs +1 -1
  113. package/dist/components/FieldLabel/index2.cjs.map +1 -1
  114. package/dist/components/FieldLabel/index2.js.map +1 -1
  115. package/dist/components/HintText/index2.cjs +0 -1
  116. package/dist/components/HintText/index2.cjs.map +1 -1
  117. package/dist/components/HintText/index2.js.map +1 -1
  118. package/dist/components/Icon/index.cjs +1 -1
  119. package/dist/components/Icon/index.cjs.map +1 -1
  120. package/dist/components/Icon/index.d.ts.map +1 -1
  121. package/dist/components/Icon/index.js.map +1 -1
  122. package/dist/components/IconButton/index.d.ts +1 -1
  123. package/dist/components/IconButton/index.d.ts.map +1 -1
  124. package/dist/components/IconButton/index2.cjs +1 -1
  125. package/dist/components/IconButton/index2.cjs.map +1 -1
  126. package/dist/components/IconButton/index2.js.map +1 -1
  127. package/dist/components/LoadingSpinner/index.d.ts.map +1 -1
  128. package/dist/components/LoadingSpinner/index2.cjs +0 -1
  129. package/dist/components/LoadingSpinner/index2.cjs.map +1 -1
  130. package/dist/components/LoadingSpinner/index2.js.map +1 -1
  131. package/dist/components/Modal/Dialog/index2.cjs +1 -1
  132. package/dist/components/Modal/Dialog/index2.cjs.map +1 -1
  133. package/dist/components/Modal/Dialog/index2.js.map +1 -1
  134. package/dist/components/Modal/ModalBackgroundContext.cjs +1 -1
  135. package/dist/components/Modal/ModalBackgroundContext.cjs.map +1 -1
  136. package/dist/components/Modal/ModalBackgroundContext.js.map +1 -1
  137. package/dist/components/Modal/ModalPlumbing.d.ts +3 -3
  138. package/dist/components/Modal/ModalPlumbing2.cjs +0 -1
  139. package/dist/components/Modal/ModalPlumbing2.cjs.map +1 -1
  140. package/dist/components/Modal/ModalPlumbing2.js.map +1 -1
  141. package/dist/components/Modal/index.d.ts.map +1 -1
  142. package/dist/components/Modal/index2.cjs +1 -1
  143. package/dist/components/Modal/index2.cjs.map +1 -1
  144. package/dist/components/Modal/index2.js.map +1 -1
  145. package/dist/components/Modal/useCustomModalOverlay.cjs +1 -1
  146. package/dist/components/Modal/useCustomModalOverlay.cjs.map +1 -1
  147. package/dist/components/Modal/useCustomModalOverlay.js.map +1 -1
  148. package/dist/components/Modal/useTransitionPresence.cjs +1 -3
  149. package/dist/components/Modal/useTransitionPresence.cjs.map +1 -1
  150. package/dist/components/Modal/useTransitionPresence.js +1 -2
  151. package/dist/components/Modal/useTransitionPresence.js.map +1 -1
  152. package/dist/components/MultiSelect/context.cjs +0 -1
  153. package/dist/components/MultiSelect/context.cjs.map +1 -1
  154. package/dist/components/MultiSelect/context.js.map +1 -1
  155. package/dist/components/MultiSelect/index.d.ts +1 -1
  156. package/dist/components/MultiSelect/index.d.ts.map +1 -1
  157. package/dist/components/MultiSelect/index2.cjs +2 -2
  158. package/dist/components/MultiSelect/index2.cjs.map +1 -1
  159. package/dist/components/MultiSelect/index2.js.map +1 -1
  160. package/dist/components/Pagination/PaginationContext.cjs +0 -1
  161. package/dist/components/Pagination/PaginationContext.cjs.map +1 -1
  162. package/dist/components/Pagination/PaginationContext.js.map +1 -1
  163. package/dist/components/Pagination/helper.cjs.map +1 -1
  164. package/dist/components/Pagination/helper.js.map +1 -1
  165. package/dist/components/Pagination/index2.cjs +26 -135
  166. package/dist/components/Pagination/index2.cjs.map +1 -1
  167. package/dist/components/Pagination/index2.js +86 -182
  168. package/dist/components/Pagination/index2.js.map +1 -1
  169. package/dist/components/Radio/RadioGroup/index2.cjs +1 -1
  170. package/dist/components/Radio/RadioGroup/index2.cjs.map +1 -1
  171. package/dist/components/Radio/RadioGroup/index2.js.map +1 -1
  172. package/dist/components/Radio/RadioGroupContext.cjs.map +1 -1
  173. package/dist/components/Radio/RadioGroupContext.js.map +1 -1
  174. package/dist/components/Radio/RadioInput/index.d.ts.map +1 -1
  175. package/dist/components/Radio/RadioInput/index2.cjs +0 -1
  176. package/dist/components/Radio/RadioInput/index2.cjs.map +1 -1
  177. package/dist/components/Radio/RadioInput/index2.js.map +1 -1
  178. package/dist/components/Radio/index.d.ts.map +1 -1
  179. package/dist/components/Radio/index2.cjs +2 -2
  180. package/dist/components/Radio/index2.cjs.map +1 -1
  181. package/dist/components/Radio/index2.js.map +1 -1
  182. package/dist/components/SegmentedControl/RadioGroupContext.cjs +1 -1
  183. package/dist/components/SegmentedControl/RadioGroupContext.cjs.map +1 -1
  184. package/dist/components/SegmentedControl/RadioGroupContext.js.map +1 -1
  185. package/dist/components/SegmentedControl/index.d.ts.map +1 -1
  186. package/dist/components/SegmentedControl/index2.cjs +1 -1
  187. package/dist/components/SegmentedControl/index2.cjs.map +1 -1
  188. package/dist/components/SegmentedControl/index2.js.map +1 -1
  189. package/dist/components/Switch/SwitchInput/index.d.ts.map +1 -1
  190. package/dist/components/Switch/SwitchInput/index2.cjs +0 -1
  191. package/dist/components/Switch/SwitchInput/index2.cjs.map +1 -1
  192. package/dist/components/Switch/SwitchInput/index2.js.map +1 -1
  193. package/dist/components/Switch/SwitchWithLabel.cjs +1 -1
  194. package/dist/components/Switch/SwitchWithLabel.cjs.map +1 -1
  195. package/dist/components/Switch/SwitchWithLabel.d.ts +2 -2
  196. package/dist/components/Switch/SwitchWithLabel.d.ts.map +1 -1
  197. package/dist/components/Switch/SwitchWithLabel.js.map +1 -1
  198. package/dist/components/Switch/index.d.ts +1 -1
  199. package/dist/components/Switch/index.d.ts.map +1 -1
  200. package/dist/components/Switch/index2.cjs +0 -1
  201. package/dist/components/Switch/index2.cjs.map +1 -1
  202. package/dist/components/Switch/index2.js.map +1 -1
  203. package/dist/components/TagItem/index.d.ts +1 -1
  204. package/dist/components/TagItem/index.d.ts.map +1 -1
  205. package/dist/components/TagItem/index2.cjs +1 -1
  206. package/dist/components/TagItem/index2.cjs.map +1 -1
  207. package/dist/components/TagItem/index2.js.map +1 -1
  208. package/dist/components/TextArea/index.d.ts.map +1 -1
  209. package/dist/components/TextArea/index2.cjs +0 -1
  210. package/dist/components/TextArea/index2.cjs.map +1 -1
  211. package/dist/components/TextArea/index2.js.map +1 -1
  212. package/dist/components/TextEllipsis/helper.cjs +2 -1
  213. package/dist/components/TextEllipsis/helper.cjs.map +1 -1
  214. package/dist/components/TextEllipsis/helper.d.ts.map +1 -1
  215. package/dist/components/TextEllipsis/helper.js +1 -1
  216. package/dist/components/TextEllipsis/helper.js.map +1 -1
  217. package/dist/components/TextEllipsis/index2.cjs +14 -98
  218. package/dist/components/TextEllipsis/index2.cjs.map +1 -1
  219. package/dist/components/TextEllipsis/index2.js +14 -93
  220. package/dist/components/TextEllipsis/index2.js.map +1 -1
  221. package/dist/components/TextField/AssistiveText/index.d.ts +1 -1
  222. package/dist/components/TextField/AssistiveText/index2.cjs.map +1 -1
  223. package/dist/components/TextField/AssistiveText/index2.js.map +1 -1
  224. package/dist/components/TextField/index.d.ts +1 -1
  225. package/dist/components/TextField/index.d.ts.map +1 -1
  226. package/dist/components/TextField/index2.cjs +1 -1
  227. package/dist/components/TextField/index2.cjs.map +1 -1
  228. package/dist/components/TextField/index2.js.map +1 -1
  229. package/dist/components/TextField/useFocusWithClick.cjs +0 -1
  230. package/dist/components/TextField/useFocusWithClick.cjs.map +1 -1
  231. package/dist/components/TextField/useFocusWithClick.js.map +1 -1
  232. package/dist/core/CharcoalProvider.cjs +1 -1
  233. package/dist/core/CharcoalProvider.cjs.map +1 -1
  234. package/dist/core/CharcoalProvider.js.map +1 -1
  235. package/dist/core/SSRProvider.cjs +1 -1
  236. package/dist/core/SSRProvider.cjs.map +1 -1
  237. package/dist/core/SSRProvider.js +1 -1
  238. package/dist/core/SSRProvider.js.map +1 -1
  239. package/dist/core/SetThemeScript.cjs +0 -1
  240. package/dist/core/SetThemeScript.cjs.map +1 -1
  241. package/dist/core/SetThemeScript.js.map +1 -1
  242. package/dist/core/themeHelper.cjs +0 -1
  243. package/dist/core/themeHelper.cjs.map +1 -1
  244. package/dist/core/themeHelper.d.ts +2 -2
  245. package/dist/core/themeHelper.d.ts.map +1 -1
  246. package/dist/core/themeHelper.js.map +1 -1
  247. package/dist/index.cjs +22 -23
  248. package/dist/index.css +907 -901
  249. package/dist/layered.css +907 -901
  250. package/dist/layered.css.map +1 -1
  251. package/package.json +10 -10
  252. package/src/__tests__/css-shorthand-safety.test.ts +150 -0
  253. package/src/_lib/compat.ts +1 -7
  254. package/src/components/Button/__snapshots__/index.css.snap +8 -3
  255. package/src/components/Button/index.css +8 -3
  256. package/src/components/Carousel/index.browser.test.tsx +1 -1
  257. package/src/components/Carousel/intersectionObserver.test.ts +12 -12
  258. package/src/components/Carousel/resizeObserver.test.ts +1 -1
  259. package/src/components/DropdownSelector/MenuItem/index.tsx +40 -2
  260. package/src/components/DropdownSelector/Popover/index.tsx +20 -1
  261. package/src/components/DropdownSelector/index.browser.test.tsx +94 -0
  262. package/src/components/DropdownSelector/index.test.tsx +57 -2
  263. package/src/components/DropdownSelector/index.tsx +37 -12
  264. package/src/components/FieldLabel/index.tsx +1 -2
  265. package/src/components/Icon/index.tsx +2 -1
  266. package/src/components/LoadingSpinner/__snapshots__/index.css.snap +1 -2
  267. package/src/components/LoadingSpinner/index.css +1 -2
  268. package/src/components/Modal/__snapshots__/index.css.snap +1 -0
  269. package/src/components/Pagination/__snapshots__/index.css.snap +3 -1
  270. package/src/components/Pagination/index.css +3 -1
  271. package/src/components/TextEllipsis/TextEllipsis.story.tsx +1 -1
  272. package/src/css.d.ts +1 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index2.cjs","names":["forwardRef","useCallback","useMemo","JSX","React","useClassNames","RadioGroupContext","RadioGroupProps","PropsWithChildren","className","value","Value","label","name","onChange","next","disabled","readonly","invalid","ref","Ref","HTMLDivElement","ComponentProps","RadioGroup","RadioGroupInner","children","ariaOrientation","props","classNames","handleChange","contextValue","selected","Element"],"sources":["../../../../src/components/Radio/RadioGroup/index.tsx"],"sourcesContent":["import './index.css'\n\nimport { forwardRef, useCallback, useMemo, type JSX } from 'react'\nimport * as React from 'react'\nimport { useClassNames } from '../../../_lib/useClassNames'\nimport { RadioGroupContext } from '../RadioGroupContext'\n\nexport type RadioGroupProps<Value extends string = string> =\n React.PropsWithChildren<{\n className?: string\n value?: Value\n /**\n * aria-label of RadioGroup\n */\n label?: string\n name: string\n onChange(next: Value): void\n disabled?: boolean\n readonly?: boolean\n invalid?: boolean\n ref?: React.Ref<HTMLDivElement>\n 'aria-labelledby'?: React.ComponentProps<'div'>['aria-labelledby']\n 'aria-orientation'?: React.ComponentProps<'div'>['aria-orientation']\n }>\n\nexport const RadioGroup = forwardRef<HTMLDivElement, RadioGroupProps<string>>(\n function RadioGroupInner(\n {\n value,\n label,\n name,\n onChange,\n disabled,\n readonly,\n invalid,\n children,\n 'aria-orientation': ariaOrientation = 'vertical',\n ...props\n },\n ref,\n ) {\n const classNames = useClassNames('charcoal-radio-group', props.className)\n\n const handleChange = useCallback(\n (next: string) => {\n onChange(next)\n },\n [onChange],\n )\n\n const contextValue = useMemo(\n () => ({\n name,\n selected: value,\n disabled: disabled ?? false,\n readonly: readonly ?? false,\n invalid: invalid ?? false,\n onChange: handleChange,\n }),\n [disabled, handleChange, invalid, name, readonly, value],\n )\n\n return (\n <RadioGroupContext.Provider value={contextValue}>\n <div\n role=\"radiogroup\"\n aria-disabled={disabled}\n aria-invalid={invalid}\n aria-label={label}\n aria-labelledby={props['aria-labelledby']}\n aria-orientation={ariaOrientation}\n className={classNames}\n ref={ref}\n >\n {children}\n </div>\n </RadioGroupContext.Provider>\n )\n },\n) as <Value extends string>(props: RadioGroupProps<Value>) => JSX.Element\n"],"mappings":";;;;;;;;;;AAyBA,MAAauB,mCACX,SAASC,gBACP,EACEd,OACAE,OACAC,MACAC,UACAE,UACAC,UACAC,SACAO,UACA,oBAAoBC,kBAAkB,YACtC,GAAGC,SAELR,KACA;CACA,MAAMS,aAAavB,oCAAc,wBAAwBsB,MAAMlB,UAAU;CAEzE,MAAMoB,uCACHd,SAAiB;EAChBD,SAASC,KAAK;IAEhB,CAACD,SACH,CAAC;CAED,MAAMgB,yCACG;EACLjB;EACAkB,UAAUrB;EACVM,UAAUA,YAAY;EACtBC,UAAUA,YAAY;EACtBC,SAASA,WAAW;EACpBJ,UAAUe;EACX,GACD;EAACb;EAAUa;EAAcX;EAASL;EAAMI;EAAUP;EACpD,CAAC;CAED,OACE,2CAAC,4CAAkB,UAAnB;EAA4B,OAAOoB;YACjC,2CAAC,OAAD;GACE,MAAK;GACL,iBAAed;GACf,gBAAcE;GACd,cAAYN;GACZ,mBAAiBe,MAAM;GACvB,oBAAkBD;GAClB,WAAWE;GACNT;GAEJM;GACE;EACsB;EAGlC"}
1
+ {"version":3,"file":"index2.cjs","names":[],"sources":["../../../../src/components/Radio/RadioGroup/index.tsx"],"sourcesContent":["import './index.css'\n\nimport { forwardRef, useCallback, useMemo, type JSX } from 'react'\nimport * as React from 'react'\nimport { useClassNames } from '../../../_lib/useClassNames'\nimport { RadioGroupContext } from '../RadioGroupContext'\n\nexport type RadioGroupProps<Value extends string = string> =\n React.PropsWithChildren<{\n className?: string\n value?: Value\n /**\n * aria-label of RadioGroup\n */\n label?: string\n name: string\n onChange(next: Value): void\n disabled?: boolean\n readonly?: boolean\n invalid?: boolean\n ref?: React.Ref<HTMLDivElement>\n 'aria-labelledby'?: React.ComponentProps<'div'>['aria-labelledby']\n 'aria-orientation'?: React.ComponentProps<'div'>['aria-orientation']\n }>\n\nexport const RadioGroup = forwardRef<HTMLDivElement, RadioGroupProps<string>>(\n function RadioGroupInner(\n {\n value,\n label,\n name,\n onChange,\n disabled,\n readonly,\n invalid,\n children,\n 'aria-orientation': ariaOrientation = 'vertical',\n ...props\n },\n ref,\n ) {\n const classNames = useClassNames('charcoal-radio-group', props.className)\n\n const handleChange = useCallback(\n (next: string) => {\n onChange(next)\n },\n [onChange],\n )\n\n const contextValue = useMemo(\n () => ({\n name,\n selected: value,\n disabled: disabled ?? false,\n readonly: readonly ?? false,\n invalid: invalid ?? false,\n onChange: handleChange,\n }),\n [disabled, handleChange, invalid, name, readonly, value],\n )\n\n return (\n <RadioGroupContext.Provider value={contextValue}>\n <div\n role=\"radiogroup\"\n aria-disabled={disabled}\n aria-invalid={invalid}\n aria-label={label}\n aria-labelledby={props['aria-labelledby']}\n aria-orientation={ariaOrientation}\n className={classNames}\n ref={ref}\n >\n {children}\n </div>\n </RadioGroupContext.Provider>\n )\n },\n) as <Value extends string>(props: RadioGroupProps<Value>) => JSX.Element\n"],"mappings":";;;;;;;;;;AAyBA,MAAa,mCACX,SAAS,gBACP,EACE,OACA,OACA,MACA,UACA,UACA,UACA,SACA,UACA,oBAAoB,kBAAkB,YACtC,GAAG,SAEL,KACA;CACA,MAAM,aAAa,oCAAc,wBAAwB,MAAM,SAAS;CAExE,MAAM,uCACH,SAAiB;EAChB,SAAS,IAAI;CACf,GACA,CAAC,QAAQ,CACX;CAEA,MAAM,yCACG;EACL;EACA,UAAU;EACV,UAAU,YAAY;EACtB,UAAU,YAAY;EACtB,SAAS,WAAW;EACpB,UAAU;CACZ,IACA;EAAC;EAAU;EAAc;EAAS;EAAM;EAAU;CAAK,CACzD;CAEA,OACE,2CAAC,4CAAkB,UAAnB;EAA4B,OAAO;YACjC,2CAAC,OAAD;GACE,MAAK;GACL,iBAAe;GACf,gBAAc;GACd,cAAY;GACZ,mBAAiB,MAAM;GACvB,oBAAkB;GAClB,WAAW;GACN;GAEJ;EACE;CACqB;AAEhC,CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"index2.js","names":["forwardRef","useCallback","useMemo","JSX","React","useClassNames","RadioGroupContext","RadioGroupProps","PropsWithChildren","className","value","Value","label","name","onChange","next","disabled","readonly","invalid","ref","Ref","HTMLDivElement","ComponentProps","RadioGroup","RadioGroupInner","children","ariaOrientation","props","classNames","handleChange","contextValue","selected","Element"],"sources":["../../../../src/components/Radio/RadioGroup/index.tsx"],"sourcesContent":["import './index.css'\n\nimport { forwardRef, useCallback, useMemo, type JSX } from 'react'\nimport * as React from 'react'\nimport { useClassNames } from '../../../_lib/useClassNames'\nimport { RadioGroupContext } from '../RadioGroupContext'\n\nexport type RadioGroupProps<Value extends string = string> =\n React.PropsWithChildren<{\n className?: string\n value?: Value\n /**\n * aria-label of RadioGroup\n */\n label?: string\n name: string\n onChange(next: Value): void\n disabled?: boolean\n readonly?: boolean\n invalid?: boolean\n ref?: React.Ref<HTMLDivElement>\n 'aria-labelledby'?: React.ComponentProps<'div'>['aria-labelledby']\n 'aria-orientation'?: React.ComponentProps<'div'>['aria-orientation']\n }>\n\nexport const RadioGroup = forwardRef<HTMLDivElement, RadioGroupProps<string>>(\n function RadioGroupInner(\n {\n value,\n label,\n name,\n onChange,\n disabled,\n readonly,\n invalid,\n children,\n 'aria-orientation': ariaOrientation = 'vertical',\n ...props\n },\n ref,\n ) {\n const classNames = useClassNames('charcoal-radio-group', props.className)\n\n const handleChange = useCallback(\n (next: string) => {\n onChange(next)\n },\n [onChange],\n )\n\n const contextValue = useMemo(\n () => ({\n name,\n selected: value,\n disabled: disabled ?? false,\n readonly: readonly ?? false,\n invalid: invalid ?? false,\n onChange: handleChange,\n }),\n [disabled, handleChange, invalid, name, readonly, value],\n )\n\n return (\n <RadioGroupContext.Provider value={contextValue}>\n <div\n role=\"radiogroup\"\n aria-disabled={disabled}\n aria-invalid={invalid}\n aria-label={label}\n aria-labelledby={props['aria-labelledby']}\n aria-orientation={ariaOrientation}\n className={classNames}\n ref={ref}\n >\n {children}\n </div>\n </RadioGroupContext.Provider>\n )\n },\n) as <Value extends string>(props: RadioGroupProps<Value>) => JSX.Element\n"],"mappings":";;;;;;;;AAyBA,MAAauB,aAAavB,WACxB,SAASwB,gBACP,EACEd,OACAE,OACAC,MACAC,UACAE,UACAC,UACAC,SACAO,UACA,oBAAoBC,kBAAkB,YACtC,GAAGC,SAELR,KACA;CACA,MAAMS,aAAavB,cAAc,wBAAwBsB,MAAMlB,UAAU;CAEzE,MAAMoB,eAAe5B,aAClBc,SAAiB;EAChBD,SAASC,KAAK;IAEhB,CAACD,SACH,CAAC;CAED,MAAMgB,eAAe5B,eACZ;EACLW;EACAkB,UAAUrB;EACVM,UAAUA,YAAY;EACtBC,UAAUA,YAAY;EACtBC,SAASA,WAAW;EACpBJ,UAAUe;EACX,GACD;EAACb;EAAUa;EAAcX;EAASL;EAAMI;EAAUP;EACpD,CAAC;CAED,OACE,oBAAC,kBAAkB,UAAnB;EAA4B,OAAOoB;YACjC,oBAAC,OAAD;GACE,MAAK;GACL,iBAAed;GACf,gBAAcE;GACd,cAAYN;GACZ,mBAAiBe,MAAM;GACvB,oBAAkBD;GAClB,WAAWE;GACNT;GAEJM;GACE;EACsB;EAGlC"}
1
+ {"version":3,"file":"index2.js","names":[],"sources":["../../../../src/components/Radio/RadioGroup/index.tsx"],"sourcesContent":["import './index.css'\n\nimport { forwardRef, useCallback, useMemo, type JSX } from 'react'\nimport * as React from 'react'\nimport { useClassNames } from '../../../_lib/useClassNames'\nimport { RadioGroupContext } from '../RadioGroupContext'\n\nexport type RadioGroupProps<Value extends string = string> =\n React.PropsWithChildren<{\n className?: string\n value?: Value\n /**\n * aria-label of RadioGroup\n */\n label?: string\n name: string\n onChange(next: Value): void\n disabled?: boolean\n readonly?: boolean\n invalid?: boolean\n ref?: React.Ref<HTMLDivElement>\n 'aria-labelledby'?: React.ComponentProps<'div'>['aria-labelledby']\n 'aria-orientation'?: React.ComponentProps<'div'>['aria-orientation']\n }>\n\nexport const RadioGroup = forwardRef<HTMLDivElement, RadioGroupProps<string>>(\n function RadioGroupInner(\n {\n value,\n label,\n name,\n onChange,\n disabled,\n readonly,\n invalid,\n children,\n 'aria-orientation': ariaOrientation = 'vertical',\n ...props\n },\n ref,\n ) {\n const classNames = useClassNames('charcoal-radio-group', props.className)\n\n const handleChange = useCallback(\n (next: string) => {\n onChange(next)\n },\n [onChange],\n )\n\n const contextValue = useMemo(\n () => ({\n name,\n selected: value,\n disabled: disabled ?? false,\n readonly: readonly ?? false,\n invalid: invalid ?? false,\n onChange: handleChange,\n }),\n [disabled, handleChange, invalid, name, readonly, value],\n )\n\n return (\n <RadioGroupContext.Provider value={contextValue}>\n <div\n role=\"radiogroup\"\n aria-disabled={disabled}\n aria-invalid={invalid}\n aria-label={label}\n aria-labelledby={props['aria-labelledby']}\n aria-orientation={ariaOrientation}\n className={classNames}\n ref={ref}\n >\n {children}\n </div>\n </RadioGroupContext.Provider>\n )\n },\n) as <Value extends string>(props: RadioGroupProps<Value>) => JSX.Element\n"],"mappings":";;;;;;;;AAyBA,MAAa,aAAa,WACxB,SAAS,gBACP,EACE,OACA,OACA,MACA,UACA,UACA,UACA,SACA,UACA,oBAAoB,kBAAkB,YACtC,GAAG,SAEL,KACA;CACA,MAAM,aAAa,cAAc,wBAAwB,MAAM,SAAS;CAExE,MAAM,eAAe,aAClB,SAAiB;EAChB,SAAS,IAAI;CACf,GACA,CAAC,QAAQ,CACX;CAEA,MAAM,eAAe,eACZ;EACL;EACA,UAAU;EACV,UAAU,YAAY;EACtB,UAAU,YAAY;EACtB,SAAS,WAAW;EACpB,UAAU;CACZ,IACA;EAAC;EAAU;EAAc;EAAS;EAAM;EAAU;CAAK,CACzD;CAEA,OACE,oBAAC,kBAAkB,UAAnB;EAA4B,OAAO;YACjC,oBAAC,OAAD;GACE,MAAK;GACL,iBAAe;GACf,gBAAc;GACd,cAAY;GACZ,mBAAiB,MAAM;GACvB,oBAAkB;GAClB,WAAW;GACN;GAEJ;EACE;CACqB;AAEhC,CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"RadioGroupContext.cjs","names":["React","RadioGroupContext","name","selected","disabled","readonly","invalid","onChange","next","createContext","undefined","Error"],"sources":["../../../src/components/Radio/RadioGroupContext.ts"],"sourcesContent":["import * as React from 'react'\n\nexport interface RadioGroupContext {\n name: string\n selected?: string\n disabled: boolean\n readonly: boolean\n invalid: boolean\n onChange: (next: string) => void\n}\n\nexport const RadioGroupContext = React.createContext<RadioGroupContext>({\n name: undefined as never,\n selected: undefined,\n disabled: false,\n readonly: false,\n invalid: false,\n onChange() {\n throw new Error(\n 'Cannot find onChange() handler. Perhaps you forgot to wrap with <RadioGroup> ?',\n )\n },\n})\n"],"mappings":";;;;;;AAWA,MAAaC,oBAAoBD,MAAMS,cAAiC;CACtEP,MAAMQ;CACNP,UAAUO;CACVN,UAAU;CACVC,UAAU;CACVC,SAAS;CACTC,WAAW;EACT,MAAM,IAAII,MACR,iFACD;;CAEJ,CAAC"}
1
+ {"version":3,"file":"RadioGroupContext.cjs","names":[],"sources":["../../../src/components/Radio/RadioGroupContext.ts"],"sourcesContent":["import * as React from 'react'\n\nexport interface RadioGroupContext {\n name: string\n selected?: string\n disabled: boolean\n readonly: boolean\n invalid: boolean\n onChange: (next: string) => void\n}\n\nexport const RadioGroupContext = React.createContext<RadioGroupContext>({\n name: undefined as never,\n selected: undefined,\n disabled: false,\n readonly: false,\n invalid: false,\n onChange() {\n throw new Error(\n 'Cannot find onChange() handler. Perhaps you forgot to wrap with <RadioGroup> ?',\n )\n },\n})\n"],"mappings":";;;;;;AAWA,MAAa,oBAAoB,MAAM,cAAiC;CACtE,MAAM;CACN,UAAU;CACV,UAAU;CACV,UAAU;CACV,SAAS;CACT,WAAW;EACT,MAAM,IAAI,MACR,gFACF;CACF;AACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"RadioGroupContext.js","names":["React","RadioGroupContext","name","selected","disabled","readonly","invalid","onChange","next","createContext","undefined","Error"],"sources":["../../../src/components/Radio/RadioGroupContext.ts"],"sourcesContent":["import * as React from 'react'\n\nexport interface RadioGroupContext {\n name: string\n selected?: string\n disabled: boolean\n readonly: boolean\n invalid: boolean\n onChange: (next: string) => void\n}\n\nexport const RadioGroupContext = React.createContext<RadioGroupContext>({\n name: undefined as never,\n selected: undefined,\n disabled: false,\n readonly: false,\n invalid: false,\n onChange() {\n throw new Error(\n 'Cannot find onChange() handler. Perhaps you forgot to wrap with <RadioGroup> ?',\n )\n },\n})\n"],"mappings":";;;;AAWA,MAAaC,oBAAoBD,QAAMS,cAAiC;CACtEP,MAAMQ;CACNP,UAAUO;CACVN,UAAU;CACVC,UAAU;CACVC,SAAS;CACTC,WAAW;EACT,MAAM,IAAII,MACR,iFACD;;CAEJ,CAAC"}
1
+ {"version":3,"file":"RadioGroupContext.js","names":[],"sources":["../../../src/components/Radio/RadioGroupContext.ts"],"sourcesContent":["import * as React from 'react'\n\nexport interface RadioGroupContext {\n name: string\n selected?: string\n disabled: boolean\n readonly: boolean\n invalid: boolean\n onChange: (next: string) => void\n}\n\nexport const RadioGroupContext = React.createContext<RadioGroupContext>({\n name: undefined as never,\n selected: undefined,\n disabled: false,\n readonly: false,\n invalid: false,\n onChange() {\n throw new Error(\n 'Cannot find onChange() handler. Perhaps you forgot to wrap with <RadioGroup> ?',\n )\n },\n})\n"],"mappings":";;;;AAWA,MAAa,oBAAoB,QAAM,cAAiC;CACtE,MAAM;CACN,UAAU;CACV,UAAU;CACV,UAAU;CACV,SAAS;CACT,WAAW;EACT,MAAM,IAAI,MACR,gFACF;CACF;AACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Radio/RadioInput/index.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAKpB,KAAK,uBAAuB,GAAG;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CACnC,CAAA;AAED,KAAK,UAAU,GAAG,KAAK,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAA;AAEnD,MAAM,MAAM,eAAe,GAAG,uBAAuB,GACnD,IAAI,CAAC,UAAU,EAAE,MAAM,uBAAuB,GAAG,KAAK,CAAC,CAAA;;AA4BzD,wBAA+B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Radio/RadioInput/index.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAKpB,KAAK,uBAAuB,GAAG;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CACnC,CAAA;AAED,KAAK,UAAU,GAAG,KAAK,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAA;AAEnD,MAAM,MAAM,eAAe,GAAG,uBAAuB,GACnD,IAAI,CAAC,UAAU,EAAE,MAAM,uBAAuB,GAAG,KAAK,CAAC,CAAA"}
@@ -1,5 +1,4 @@
1
1
  "use client";
2
- const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
3
2
  const require_useClassNames = require('../../../_lib/useClassNames.cjs');
4
3
  require('./index.cjs');
5
4
  let react = require("react");
@@ -1 +1 @@
1
- {"version":3,"file":"index2.cjs","names":["forwardRef","memo","useCallback","useClassNames","CharcoalRadioInputProps","invalid","onChange","value","InputProps","React","HTMLProps","HTMLInputElement","RadioInputProps","Omit","RadioInput","className","props","ref","handleChange","e","ChangeEvent","el","currentTarget","classNames"],"sources":["../../../../src/components/Radio/RadioInput/index.tsx"],"sourcesContent":["import './index.css'\n\nimport { forwardRef, memo, useCallback } from 'react'\nimport { useClassNames } from '../../../_lib/useClassNames'\n\ntype CharcoalRadioInputProps = {\n invalid?: boolean\n onChange?: (value: string) => void\n}\n\ntype InputProps = React.HTMLProps<HTMLInputElement>\n\nexport type RadioInputProps = CharcoalRadioInputProps &\n Omit<InputProps, keyof CharcoalRadioInputProps | 'ref'>\n\nconst RadioInput = forwardRef<HTMLInputElement, RadioInputProps>(\n function RadioInput({ onChange, invalid, className, ...props }, ref) {\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n const el = e.currentTarget\n onChange?.(el.value)\n },\n [onChange],\n )\n\n const classNames = useClassNames('charcoal-radio-input', className)\n\n return (\n // eslint-disable-next-line jsx-a11y/role-supports-aria-props\n <input\n className={classNames}\n ref={ref}\n type=\"radio\"\n onChange={handleChange}\n aria-invalid={invalid}\n {...props}\n />\n )\n },\n)\n\nexport default memo(RadioInput)\n"],"mappings":";;;;;;;;AAeA,MAAMc,mCACJ,SAASA,WAAW,EAAER,UAAUD,SAASU,WAAW,GAAGC,SAASC,KAAK;CACnE,MAAMC,uCACHC,MAA2C;EAC1C,MAAME,KAAKF,EAAEG;EACbhB,WAAWe,GAAGd,MAAM;IAEtB,CAACD,SACH,CAAC;CAID,OAEE,2CAAC,SAAD;EACE,WALeH,oCAAc,wBAAwBY,UAKhC;EAChBE;EACL,MAAK;EACL,UAAUC;EACV,gBAAcb;EACd,GAAIW;EAAM;EAIjB;AAED,yCAAoBF,WAAW"}
1
+ {"version":3,"file":"index2.cjs","names":[],"sources":["../../../../src/components/Radio/RadioInput/index.tsx"],"sourcesContent":["import './index.css'\n\nimport { forwardRef, memo, useCallback } from 'react'\nimport { useClassNames } from '../../../_lib/useClassNames'\n\ntype CharcoalRadioInputProps = {\n invalid?: boolean\n onChange?: (value: string) => void\n}\n\ntype InputProps = React.HTMLProps<HTMLInputElement>\n\nexport type RadioInputProps = CharcoalRadioInputProps &\n Omit<InputProps, keyof CharcoalRadioInputProps | 'ref'>\n\nconst RadioInput = forwardRef<HTMLInputElement, RadioInputProps>(\n function RadioInput({ onChange, invalid, className, ...props }, ref) {\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n const el = e.currentTarget\n onChange?.(el.value)\n },\n [onChange],\n )\n\n const classNames = useClassNames('charcoal-radio-input', className)\n\n return (\n // eslint-disable-next-line jsx-a11y/role-supports-aria-props\n <input\n className={classNames}\n ref={ref}\n type=\"radio\"\n onChange={handleChange}\n aria-invalid={invalid}\n {...props}\n />\n )\n },\n)\n\nexport default memo(RadioInput)\n"],"mappings":";;;;;;;AAeA,MAAM,mCACJ,SAAS,WAAW,EAAE,UAAU,SAAS,WAAW,GAAG,SAAS,KAAK;CACnE,MAAM,uCACH,MAA2C;EAC1C,MAAM,KAAK,EAAE;EACb,WAAW,GAAG,KAAK;CACrB,GACA,CAAC,QAAQ,CACX;CAIA,OAEE,2CAAC,SAAD;EACE,WALe,oCAAc,wBAAwB,SAK1C;EACN;EACL,MAAK;EACL,UAAU;EACV,gBAAc;EACd,GAAI;CAAM;AAGhB,CACF;AAEA,yCAAoB,UAAU"}
@@ -1 +1 @@
1
- {"version":3,"file":"index2.js","names":["forwardRef","memo","useCallback","useClassNames","CharcoalRadioInputProps","invalid","onChange","value","InputProps","React","HTMLProps","HTMLInputElement","RadioInputProps","Omit","RadioInput","className","props","ref","handleChange","e","ChangeEvent","el","currentTarget","classNames"],"sources":["../../../../src/components/Radio/RadioInput/index.tsx"],"sourcesContent":["import './index.css'\n\nimport { forwardRef, memo, useCallback } from 'react'\nimport { useClassNames } from '../../../_lib/useClassNames'\n\ntype CharcoalRadioInputProps = {\n invalid?: boolean\n onChange?: (value: string) => void\n}\n\ntype InputProps = React.HTMLProps<HTMLInputElement>\n\nexport type RadioInputProps = CharcoalRadioInputProps &\n Omit<InputProps, keyof CharcoalRadioInputProps | 'ref'>\n\nconst RadioInput = forwardRef<HTMLInputElement, RadioInputProps>(\n function RadioInput({ onChange, invalid, className, ...props }, ref) {\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n const el = e.currentTarget\n onChange?.(el.value)\n },\n [onChange],\n )\n\n const classNames = useClassNames('charcoal-radio-input', className)\n\n return (\n // eslint-disable-next-line jsx-a11y/role-supports-aria-props\n <input\n className={classNames}\n ref={ref}\n type=\"radio\"\n onChange={handleChange}\n aria-invalid={invalid}\n {...props}\n />\n )\n },\n)\n\nexport default memo(RadioInput)\n"],"mappings":";;;;;;;AAeA,MAAMc,aAAad,WACjB,SAASc,WAAW,EAAER,UAAUD,SAASU,WAAW,GAAGC,SAASC,KAAK;CACnE,MAAMC,eAAehB,aAClBiB,MAA2C;EAC1C,MAAME,KAAKF,EAAEG;EACbhB,WAAWe,GAAGd,MAAM;IAEtB,CAACD,SACH,CAAC;CAID,OAEE,oBAAC,SAAD;EACE,WALeH,cAAc,wBAAwBY,UAKhC;EAChBE;EACL,MAAK;EACL,UAAUC;EACV,gBAAcb;EACd,GAAIW;EAAM;EAIjB;AAED,yBAAef,KAAKa,WAAW"}
1
+ {"version":3,"file":"index2.js","names":[],"sources":["../../../../src/components/Radio/RadioInput/index.tsx"],"sourcesContent":["import './index.css'\n\nimport { forwardRef, memo, useCallback } from 'react'\nimport { useClassNames } from '../../../_lib/useClassNames'\n\ntype CharcoalRadioInputProps = {\n invalid?: boolean\n onChange?: (value: string) => void\n}\n\ntype InputProps = React.HTMLProps<HTMLInputElement>\n\nexport type RadioInputProps = CharcoalRadioInputProps &\n Omit<InputProps, keyof CharcoalRadioInputProps | 'ref'>\n\nconst RadioInput = forwardRef<HTMLInputElement, RadioInputProps>(\n function RadioInput({ onChange, invalid, className, ...props }, ref) {\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n const el = e.currentTarget\n onChange?.(el.value)\n },\n [onChange],\n )\n\n const classNames = useClassNames('charcoal-radio-input', className)\n\n return (\n // eslint-disable-next-line jsx-a11y/role-supports-aria-props\n <input\n className={classNames}\n ref={ref}\n type=\"radio\"\n onChange={handleChange}\n aria-invalid={invalid}\n {...props}\n />\n )\n },\n)\n\nexport default memo(RadioInput)\n"],"mappings":";;;;;;;AAeA,MAAM,aAAa,WACjB,SAAS,WAAW,EAAE,UAAU,SAAS,WAAW,GAAG,SAAS,KAAK;CACnE,MAAM,eAAe,aAClB,MAA2C;EAC1C,MAAM,KAAK,EAAE;EACb,WAAW,GAAG,KAAK;CACrB,GACA,CAAC,QAAQ,CACX;CAIA,OAEE,oBAAC,SAAD;EACE,WALe,cAAc,wBAAwB,SAK1C;EACN;EACL,MAAK;EACL,UAAU;EACV,gBAAc;EACd,GAAI;CAAM;AAGhB,CACF;AAEA,yBAAe,KAAK,UAAU"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Radio/index.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAGpB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAO9B,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,iBAAiB,CAAC;IAC/C,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAC,CAAA;;WAHO,MAAM;eACF,OAAO;gBACN,MAAM;;;;AA8CpB,wBAA0B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Radio/index.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAGpB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAO9B,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,iBAAiB,CAAC;IAC/C,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAC,CAAA;;WAHO,MAAM;eACF,OAAO;gBACN,MAAM"}
@@ -5,10 +5,10 @@ require('./index.cjs');
5
5
  const require_RadioGroupContext = require('./RadioGroupContext.cjs');
6
6
  const require_index$1 = require('./RadioInput/index2.cjs');
7
7
  let react = require("react");
8
- react = require_runtime.__toESM(react);
8
+ react = require_runtime.__toESM(react, 1);
9
9
  let react_jsx_runtime = require("react/jsx-runtime");
10
10
  let warning = require("warning");
11
- warning = require_runtime.__toESM(warning);
11
+ warning = require_runtime.__toESM(warning, 1);
12
12
 
13
13
  //#region src/components/Radio/index.tsx
14
14
  const Radio = (0, react.forwardRef)(function RadioInner({ value, disabled = false, children, ...props }, ref) {
@@ -1 +1 @@
1
- {"version":3,"file":"index2.cjs","names":["memo","forwardRef","useContext","React","warning","useClassNames","RadioGroupContext","RadioInput","RadioProps","PropsWithChildren","value","disabled","className","Radio","HTMLInputElement","RadioInner","children","props","ref","name","selected","isParentDisabled","readonly","invalid","onChange","classNames","undefined","isSelected","isDisabled","isReadonly"],"sources":["../../../src/components/Radio/index.tsx"],"sourcesContent":["import './index.css'\n\nimport { memo, forwardRef, useContext } from 'react'\nimport * as React from 'react'\nimport warning from 'warning'\nimport { useClassNames } from '../../_lib/useClassNames'\n\nimport { RadioGroupContext } from './RadioGroupContext'\nimport RadioInput from './RadioInput'\n\nexport type RadioProps = React.PropsWithChildren<{\n value: string\n disabled?: boolean\n className?: string\n}>\n\nconst Radio = forwardRef<HTMLInputElement, RadioProps>(function RadioInner(\n { value, disabled = false, children, ...props },\n ref,\n) {\n const {\n name,\n selected,\n disabled: isParentDisabled,\n readonly,\n invalid,\n onChange,\n } = useContext(RadioGroupContext)\n\n const classNames = useClassNames('charcoal-radio__label', props.className)\n\n warning(\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n name !== undefined,\n `\"name\" is not Provided for <Radio>. Perhaps you forgot to wrap with <RadioGroup> ?`,\n )\n\n const isSelected = value === selected\n const isDisabled = disabled || isParentDisabled\n const isReadonly = readonly && !isSelected\n\n return (\n <label aria-disabled={isDisabled || isReadonly} className={classNames}>\n <RadioInput\n name={name}\n value={value}\n checked={isSelected}\n aria-invalid={invalid}\n onChange={onChange}\n disabled={isDisabled || isReadonly}\n ref={ref}\n />\n {children != null && (\n <div className=\"charcoal-radio__label_div\">{children}</div>\n )}\n </label>\n )\n})\n\nexport default memo(Radio)\n"],"mappings":";;;;;;;;;;;;;AAgBA,MAAMa,8BAAiD,SAASE,WAC9D,EAAEL,OAAOC,WAAW,OAAOK,UAAU,GAAGC,SACxCC,KACA;CACA,MAAM,EACJC,MACAC,UACAT,UAAUU,kBACVC,UACAC,SACAC,mCACalB,4CAAkB;CAEjC,MAAMmB,aAAapB,oCAAc,yBAAyBY,MAAML,UAAU;CAE1ER,qBAEEe,SAASO,QACT,qFACD;CAED,MAAMC,aAAajB,UAAUU;CAC7B,MAAMQ,aAAajB,YAAYU;CAC/B,MAAMQ,aAAaP,YAAY,CAACK;CAEhC,OACE,4CAAC,SAAD;EAAO,iBAAeC,cAAcC;EAAY,WAAWJ;YAA3D,CACE,2CAAC,yBAAD;GACQN;GACCT;GACP,SAASiB;GACT,gBAAcJ;GACJC;GACV,UAAUI,cAAcC;GACnBX;GAAI,GAEVF,YAAY,QACX,2CAAC,OAAD;GAAK,WAAU;GAA6BA;GAC7C,EACK;;EAEV;AAEF,oCAAoBH,MAAM"}
1
+ {"version":3,"file":"index2.cjs","names":[],"sources":["../../../src/components/Radio/index.tsx"],"sourcesContent":["import './index.css'\n\nimport { memo, forwardRef, useContext } from 'react'\nimport * as React from 'react'\nimport warning from 'warning'\nimport { useClassNames } from '../../_lib/useClassNames'\n\nimport { RadioGroupContext } from './RadioGroupContext'\nimport RadioInput from './RadioInput'\n\nexport type RadioProps = React.PropsWithChildren<{\n value: string\n disabled?: boolean\n className?: string\n}>\n\nconst Radio = forwardRef<HTMLInputElement, RadioProps>(function RadioInner(\n { value, disabled = false, children, ...props },\n ref,\n) {\n const {\n name,\n selected,\n disabled: isParentDisabled,\n readonly,\n invalid,\n onChange,\n } = useContext(RadioGroupContext)\n\n const classNames = useClassNames('charcoal-radio__label', props.className)\n\n warning(\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n name !== undefined,\n `\"name\" is not Provided for <Radio>. Perhaps you forgot to wrap with <RadioGroup> ?`,\n )\n\n const isSelected = value === selected\n const isDisabled = disabled || isParentDisabled\n const isReadonly = readonly && !isSelected\n\n return (\n <label aria-disabled={isDisabled || isReadonly} className={classNames}>\n <RadioInput\n name={name}\n value={value}\n checked={isSelected}\n aria-invalid={invalid}\n onChange={onChange}\n disabled={isDisabled || isReadonly}\n ref={ref}\n />\n {children != null && (\n <div className=\"charcoal-radio__label_div\">{children}</div>\n )}\n </label>\n )\n})\n\nexport default memo(Radio)\n"],"mappings":";;;;;;;;;;;;;AAgBA,MAAM,8BAAiD,SAAS,WAC9D,EAAE,OAAO,WAAW,OAAO,UAAU,GAAG,SACxC,KACA;CACA,MAAM,EACJ,MACA,UACA,UAAU,kBACV,UACA,SACA,mCACa,2CAAiB;CAEhC,MAAM,aAAa,oCAAc,yBAAyB,MAAM,SAAS;CAEzE,qBAEE,SAAS,QACT,oFACF;CAEA,MAAM,aAAa,UAAU;CAC7B,MAAM,aAAa,YAAY;CAC/B,MAAM,aAAa,YAAY,CAAC;CAEhC,OACE,4CAAC,SAAD;EAAO,iBAAe,cAAc;EAAY,WAAW;YAA3D,CACE,2CAAC,yBAAD;GACQ;GACC;GACP,SAAS;GACT,gBAAc;GACJ;GACV,UAAU,cAAc;GACnB;EAAI,IAEV,YAAY,QACX,2CAAC,OAAD;GAAK,WAAU;GAA6B;EAAc,EAEvD;;AAEX,CAAC;AAED,oCAAoB,KAAK"}
@@ -1 +1 @@
1
- {"version":3,"file":"index2.js","names":["memo","forwardRef","useContext","React","warning","useClassNames","RadioGroupContext","RadioInput","RadioProps","PropsWithChildren","value","disabled","className","Radio","HTMLInputElement","RadioInner","children","props","ref","name","selected","isParentDisabled","readonly","invalid","onChange","classNames","undefined","isSelected","isDisabled","isReadonly"],"sources":["../../../src/components/Radio/index.tsx"],"sourcesContent":["import './index.css'\n\nimport { memo, forwardRef, useContext } from 'react'\nimport * as React from 'react'\nimport warning from 'warning'\nimport { useClassNames } from '../../_lib/useClassNames'\n\nimport { RadioGroupContext } from './RadioGroupContext'\nimport RadioInput from './RadioInput'\n\nexport type RadioProps = React.PropsWithChildren<{\n value: string\n disabled?: boolean\n className?: string\n}>\n\nconst Radio = forwardRef<HTMLInputElement, RadioProps>(function RadioInner(\n { value, disabled = false, children, ...props },\n ref,\n) {\n const {\n name,\n selected,\n disabled: isParentDisabled,\n readonly,\n invalid,\n onChange,\n } = useContext(RadioGroupContext)\n\n const classNames = useClassNames('charcoal-radio__label', props.className)\n\n warning(\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n name !== undefined,\n `\"name\" is not Provided for <Radio>. Perhaps you forgot to wrap with <RadioGroup> ?`,\n )\n\n const isSelected = value === selected\n const isDisabled = disabled || isParentDisabled\n const isReadonly = readonly && !isSelected\n\n return (\n <label aria-disabled={isDisabled || isReadonly} className={classNames}>\n <RadioInput\n name={name}\n value={value}\n checked={isSelected}\n aria-invalid={invalid}\n onChange={onChange}\n disabled={isDisabled || isReadonly}\n ref={ref}\n />\n {children != null && (\n <div className=\"charcoal-radio__label_div\">{children}</div>\n )}\n </label>\n )\n})\n\nexport default memo(Radio)\n"],"mappings":";;;;;;;;;;AAgBA,MAAMa,QAAQZ,WAAyC,SAASc,WAC9D,EAAEL,OAAOC,WAAW,OAAOK,UAAU,GAAGC,SACxCC,KACA;CACA,MAAM,EACJC,MACAC,UACAT,UAAUU,kBACVC,UACAC,SACAC,aACEtB,WAAWI,kBAAkB;CAEjC,MAAMmB,aAAapB,cAAc,yBAAyBY,MAAML,UAAU;CAE1ER,QAEEe,SAASO,QACT,qFACD;CAED,MAAMC,aAAajB,UAAUU;CAC7B,MAAMQ,aAAajB,YAAYU;CAC/B,MAAMQ,aAAaP,YAAY,CAACK;CAEhC,OACE,qBAAC,SAAD;EAAO,iBAAeC,cAAcC;EAAY,WAAWJ;YAA3D,CACE,oBAAC,oBAAD;GACQN;GACCT;GACP,SAASiB;GACT,gBAAcJ;GACJC;GACV,UAAUI,cAAcC;GACnBX;GAAI,GAEVF,YAAY,QACX,oBAAC,OAAD;GAAK,WAAU;GAA6BA;GAC7C,EACK;;EAEV;AAEF,oBAAehB,KAAKa,MAAM"}
1
+ {"version":3,"file":"index2.js","names":[],"sources":["../../../src/components/Radio/index.tsx"],"sourcesContent":["import './index.css'\n\nimport { memo, forwardRef, useContext } from 'react'\nimport * as React from 'react'\nimport warning from 'warning'\nimport { useClassNames } from '../../_lib/useClassNames'\n\nimport { RadioGroupContext } from './RadioGroupContext'\nimport RadioInput from './RadioInput'\n\nexport type RadioProps = React.PropsWithChildren<{\n value: string\n disabled?: boolean\n className?: string\n}>\n\nconst Radio = forwardRef<HTMLInputElement, RadioProps>(function RadioInner(\n { value, disabled = false, children, ...props },\n ref,\n) {\n const {\n name,\n selected,\n disabled: isParentDisabled,\n readonly,\n invalid,\n onChange,\n } = useContext(RadioGroupContext)\n\n const classNames = useClassNames('charcoal-radio__label', props.className)\n\n warning(\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n name !== undefined,\n `\"name\" is not Provided for <Radio>. Perhaps you forgot to wrap with <RadioGroup> ?`,\n )\n\n const isSelected = value === selected\n const isDisabled = disabled || isParentDisabled\n const isReadonly = readonly && !isSelected\n\n return (\n <label aria-disabled={isDisabled || isReadonly} className={classNames}>\n <RadioInput\n name={name}\n value={value}\n checked={isSelected}\n aria-invalid={invalid}\n onChange={onChange}\n disabled={isDisabled || isReadonly}\n ref={ref}\n />\n {children != null && (\n <div className=\"charcoal-radio__label_div\">{children}</div>\n )}\n </label>\n )\n})\n\nexport default memo(Radio)\n"],"mappings":";;;;;;;;;;AAgBA,MAAM,QAAQ,WAAyC,SAAS,WAC9D,EAAE,OAAO,WAAW,OAAO,UAAU,GAAG,SACxC,KACA;CACA,MAAM,EACJ,MACA,UACA,UAAU,kBACV,UACA,SACA,aACE,WAAW,iBAAiB;CAEhC,MAAM,aAAa,cAAc,yBAAyB,MAAM,SAAS;CAEzE,QAEE,SAAS,QACT,oFACF;CAEA,MAAM,aAAa,UAAU;CAC7B,MAAM,aAAa,YAAY;CAC/B,MAAM,aAAa,YAAY,CAAC;CAEhC,OACE,qBAAC,SAAD;EAAO,iBAAe,cAAc;EAAY,WAAW;YAA3D,CACE,oBAAC,oBAAD;GACQ;GACC;GACP,SAAS;GACT,gBAAc;GACJ;GACV,UAAU,cAAc;GACnB;EAAI,IAEV,YAAY,QACX,oBAAC,OAAD;GAAK,WAAU;GAA6B;EAAc,EAEvD;;AAEX,CAAC;AAED,oBAAe,KAAK,KAAK"}
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
3
  let react = require("react");
4
- react = require_runtime.__toESM(react);
4
+ react = require_runtime.__toESM(react, 1);
5
5
  let react_jsx_runtime = require("react/jsx-runtime");
6
6
 
7
7
  //#region src/components/SegmentedControl/RadioGroupContext.tsx
@@ -1 +1 @@
1
- {"version":3,"file":"RadioGroupContext.cjs","names":["createContext","useContext","React","RadioGroupState","RadioContext","RadioProviderProps","PropsWithChildren","value","RadioProvider","FC","children","useRadioContext","state","Error"],"sources":["../../../src/components/SegmentedControl/RadioGroupContext.tsx"],"sourcesContent":["import { createContext, useContext } from 'react'\nimport * as React from 'react'\nimport { RadioGroupState } from 'react-stately/useRadioGroupState'\n\nconst RadioContext = createContext<RadioGroupState | null>(null)\n\ntype RadioProviderProps = React.PropsWithChildren<{\n value: RadioGroupState\n}>\nexport const RadioProvider: React.FC<RadioProviderProps> = ({\n value,\n children,\n}) => {\n return <RadioContext.Provider value={value}>{children}</RadioContext.Provider>\n}\nexport const useRadioContext = () => {\n const state = useContext(RadioContext)\n\n if (state === null)\n throw new Error('`<RadioProvider>` is not likely mounted.')\n\n return state\n}\n"],"mappings":";;;;;;;AAIA,MAAMI,wCAAqD,KAAK;AAKhE,MAAaI,iBAA+C,EAC1DD,OACAG,eACI;CACJ,OAAO,2CAAC,aAAa,UAAd;EAA8BH;EAAQG;EAAiC;;AAEhF,MAAaC,wBAAwB;CACnC,MAAMC,8BAAmBR,aAAa;CAEtC,IAAIQ,UAAU,MACZ,MAAM,IAAIC,MAAM,2CAA2C;CAE7D,OAAOD"}
1
+ {"version":3,"file":"RadioGroupContext.cjs","names":[],"sources":["../../../src/components/SegmentedControl/RadioGroupContext.tsx"],"sourcesContent":["import { createContext, useContext } from 'react'\nimport * as React from 'react'\nimport { RadioGroupState } from 'react-stately/useRadioGroupState'\n\nconst RadioContext = createContext<RadioGroupState | null>(null)\n\ntype RadioProviderProps = React.PropsWithChildren<{\n value: RadioGroupState\n}>\nexport const RadioProvider: React.FC<RadioProviderProps> = ({\n value,\n children,\n}) => {\n return <RadioContext.Provider value={value}>{children}</RadioContext.Provider>\n}\nexport const useRadioContext = () => {\n const state = useContext(RadioContext)\n\n if (state === null)\n throw new Error('`<RadioProvider>` is not likely mounted.')\n\n return state\n}\n"],"mappings":";;;;;;;AAIA,MAAM,wCAAqD,IAAI;AAK/D,MAAa,iBAA+C,EAC1D,OACA,eACI;CACJ,OAAO,2CAAC,aAAa,UAAd;EAA8B;EAAQ;CAAgC;AAC/E;AACA,MAAa,wBAAwB;CACnC,MAAM,8BAAmB,YAAY;CAErC,IAAI,UAAU,MACZ,MAAM,IAAI,MAAM,0CAA0C;CAE5D,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"RadioGroupContext.js","names":["createContext","useContext","React","RadioGroupState","RadioContext","RadioProviderProps","PropsWithChildren","value","RadioProvider","FC","children","useRadioContext","state","Error"],"sources":["../../../src/components/SegmentedControl/RadioGroupContext.tsx"],"sourcesContent":["import { createContext, useContext } from 'react'\nimport * as React from 'react'\nimport { RadioGroupState } from 'react-stately/useRadioGroupState'\n\nconst RadioContext = createContext<RadioGroupState | null>(null)\n\ntype RadioProviderProps = React.PropsWithChildren<{\n value: RadioGroupState\n}>\nexport const RadioProvider: React.FC<RadioProviderProps> = ({\n value,\n children,\n}) => {\n return <RadioContext.Provider value={value}>{children}</RadioContext.Provider>\n}\nexport const useRadioContext = () => {\n const state = useContext(RadioContext)\n\n if (state === null)\n throw new Error('`<RadioProvider>` is not likely mounted.')\n\n return state\n}\n"],"mappings":";;;;;AAIA,MAAMI,eAAeJ,cAAsC,KAAK;AAKhE,MAAaQ,iBAA+C,EAC1DD,OACAG,eACI;CACJ,OAAO,oBAAC,aAAa,UAAd;EAA8BH;EAAQG;EAAiC;;AAEhF,MAAaC,wBAAwB;CACnC,MAAMC,QAAQX,WAAWG,aAAa;CAEtC,IAAIQ,UAAU,MACZ,MAAM,IAAIC,MAAM,2CAA2C;CAE7D,OAAOD"}
1
+ {"version":3,"file":"RadioGroupContext.js","names":[],"sources":["../../../src/components/SegmentedControl/RadioGroupContext.tsx"],"sourcesContent":["import { createContext, useContext } from 'react'\nimport * as React from 'react'\nimport { RadioGroupState } from 'react-stately/useRadioGroupState'\n\nconst RadioContext = createContext<RadioGroupState | null>(null)\n\ntype RadioProviderProps = React.PropsWithChildren<{\n value: RadioGroupState\n}>\nexport const RadioProvider: React.FC<RadioProviderProps> = ({\n value,\n children,\n}) => {\n return <RadioContext.Provider value={value}>{children}</RadioContext.Provider>\n}\nexport const useRadioContext = () => {\n const state = useContext(RadioContext)\n\n if (state === null)\n throw new Error('`<RadioProvider>` is not likely mounted.')\n\n return state\n}\n"],"mappings":";;;;;AAIA,MAAM,eAAe,cAAsC,IAAI;AAK/D,MAAa,iBAA+C,EAC1D,OACA,eACI;CACJ,OAAO,oBAAC,aAAa,UAAd;EAA8B;EAAQ;CAAgC;AAC/E;AACA,MAAa,wBAAwB;CACnC,MAAM,QAAQ,WAAW,YAAY;CAErC,IAAI,UAAU,MACZ,MAAM,IAAI,MAAM,0CAA0C;CAE5D,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/SegmentedControl/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,aAAa,CAAA;AAUpB,KAAK,oBAAoB,GAAG;IAC1B,KAAK,EAAE,KAAK,CAAC,SAAS,CAAA;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAC3B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAA;IACtC,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;IAE5B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAA;IAE9B,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,oBAAoB,EAAE,CAAA;IAEhD,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CAC5C,CAAA;;AAoDD,wBAAqC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/SegmentedControl/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,aAAa,CAAA;AAUpB,KAAK,oBAAoB,GAAG;IAC1B,KAAK,EAAE,KAAK,CAAC,SAAS,CAAA;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAC3B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAA;IACtC,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;IAE5B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAA;IAE9B,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,oBAAoB,EAAE,CAAA;IAEhD,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CAC5C,CAAA"}
@@ -4,7 +4,7 @@ const require_useClassNames = require('../../_lib/useClassNames.cjs');
4
4
  const require_RadioGroupContext = require('./RadioGroupContext.cjs');
5
5
  require('./index.cjs');
6
6
  let react = require("react");
7
- react = require_runtime.__toESM(react);
7
+ react = require_runtime.__toESM(react, 1);
8
8
  let react_jsx_runtime = require("react/jsx-runtime");
9
9
  let react_aria_useRadioGroup = require("react-aria/useRadioGroup");
10
10
  let react_stately_useRadioGroupState = require("react-stately/useRadioGroupState");
@@ -1 +1 @@
1
- {"version":3,"file":"index2.cjs","names":["ReactNode","forwardRef","memo","useMemo","useRef","React","RadioProvider","useRadioContext","useClassNames","AriaRadioGroupProps","AriaRadioProps","useRadio","useRadioGroup","useRadioGroupState","SegmentedControlItem","label","value","disabled","SegmentedControlProps","id","name","readonly","required","className","uniformSegmentWidth","fullWidth","defaultValue","data","onChange","SegmentedControl","HTMLDivElement","SegmentedControlInner","props","ref","ariaRadioGroupProps","isDisabled","isReadOnly","isRequired","state","radioGroupProps","segmentedControlItems","map","d","item","RadioProps","children","Segmented","HTMLInputElement","ariaRadioProps","inputProps","isSelected"],"sources":["../../../src/components/SegmentedControl/index.tsx"],"sourcesContent":["import { ReactNode, forwardRef, memo, useMemo, useRef } from 'react'\nimport * as React from 'react'\nimport { RadioProvider, useRadioContext } from './RadioGroupContext'\nimport { useClassNames } from '../../_lib/useClassNames'\nimport './index.css'\nimport {\n AriaRadioGroupProps,\n AriaRadioProps,\n useRadio,\n useRadioGroup,\n} from 'react-aria/useRadioGroup'\n\nimport { useRadioGroupState } from 'react-stately/useRadioGroupState'\n\ntype SegmentedControlItem = {\n label: React.ReactNode\n value: string\n disabled?: boolean\n}\n\nexport type SegmentedControlProps = {\n readonly id?: string\n readonly name?: string\n readonly disabled?: boolean\n readonly readonly?: boolean\n readonly required?: boolean\n readonly className?: string\n readonly uniformSegmentWidth?: boolean\n readonly fullWidth?: boolean\n\n readonly value?: string\n readonly defaultValue?: string\n\n readonly data: string[] | SegmentedControlItem[]\n\n readonly onChange?: (value: string) => void\n}\n\nconst SegmentedControl = forwardRef<HTMLDivElement, SegmentedControlProps>(\n function SegmentedControlInner(props, ref) {\n const className = useClassNames(\n 'charcoal-segmented-control',\n props.className,\n )\n\n const ariaRadioGroupProps = useMemo<AriaRadioGroupProps>(\n () => ({\n ...props,\n isDisabled: props.disabled,\n isReadOnly: props.readonly,\n isRequired: props.required,\n 'aria-label': props.name,\n }),\n [props],\n )\n const state = useRadioGroupState(ariaRadioGroupProps)\n const { radioGroupProps } = useRadioGroup(ariaRadioGroupProps, state)\n const segmentedControlItems = useMemo<SegmentedControlItem[]>(() => {\n return props.data.map((d) =>\n typeof d === 'string' ? { value: d, label: d } : d,\n )\n }, [props.data])\n\n return (\n <div\n ref={ref}\n {...radioGroupProps}\n className={className}\n data-uniform-segment-width={props.uniformSegmentWidth}\n data-full-width={props.fullWidth}\n >\n <RadioProvider value={state}>\n {segmentedControlItems.map((item) => (\n <Segmented\n key={item.value}\n value={item.value}\n disabled={item.disabled}\n uniformSegmentWidth={props.uniformSegmentWidth}\n >\n {item.label}\n </Segmented>\n ))}\n </RadioProvider>\n </div>\n )\n },\n)\n\nexport default memo(SegmentedControl)\n\ntype RadioProps = {\n value: string\n disabled?: boolean\n children?: ReactNode\n uniformSegmentWidth?: boolean\n fullWidth?: boolean\n}\n\nconst Segmented = (props: RadioProps) => {\n const state = useRadioContext()\n const ref = useRef<HTMLInputElement>(null)\n const ariaRadioProps = useMemo<AriaRadioProps>(\n () => ({\n value: props.value,\n isDisabled: props.disabled,\n children: props.children,\n }),\n [props],\n )\n\n const { inputProps, isDisabled, isSelected } = useRadio(\n ariaRadioProps,\n state,\n ref,\n )\n\n return (\n <label\n className=\"charcoal-segmented-control-radio__label\"\n aria-disabled={isDisabled || state.isReadOnly}\n data-checked={isSelected}\n data-uniform-segment-width={props.uniformSegmentWidth}\n data-full-width={props.fullWidth}\n >\n <input\n className=\"charcoal-segmented-control-radio__input\"\n {...inputProps}\n ref={ref}\n />\n {props.children}\n </label>\n )\n}\n"],"mappings":";;;;;;;;;;;;AAsCA,MAAM6B,yCACJ,SAASE,sBAAsBC,OAAOC,KAAK;CACzC,MAAMV,YAAYf,oCAChB,8BACAwB,MAAMT,UACP;CAED,MAAMW,gDACG;EACL,GAAGF;EACHG,YAAYH,MAAMf;EAClBmB,YAAYJ,MAAMX;EAClBgB,YAAYL,MAAMV;EAClB,cAAcU,MAAMZ;EACrB,GACD,CAACY,MACH,CAAC;CACD,MAAMM,iEAA2BJ,oBAAoB;CACrD,MAAM,EAAEK,gEAAkCL,qBAAqBI,MAAM;CACrE,MAAME,iDAA8D;EAClE,OAAOR,MAAML,KAAKc,KAAKC,MACrB,OAAOA,MAAM,WAAW;GAAE1B,OAAO0B;GAAG3B,OAAO2B;GAAG,GAAGA,EAClD;IACA,CAACV,MAAML,KAAK,CAAC;CAEhB,OACE,2CAAC,OAAD;EACOM;EACL,GAAIM;EACOhB;EACX,8BAA4BS,MAAMR;EAClC,mBAAiBQ,MAAMP;YAEvB,2CAAC,yCAAD;GAAe,OAAOa;aACnBE,sBAAsBC,KAAKE,SAC1B,2CAAC,WAAD;IAEE,OAAOA,KAAK3B;IACZ,UAAU2B,KAAK1B;IACf,qBAAqBe,MAAMR;cAE1BmB,KAAK5B;IAET,EAPQ4B,KAAK3B,MAOb,CAAC;GACW;EACX;EAGX;AAED,+CAAoBa,iBAAiB;AAUrC,MAAMiB,aAAad,UAAsB;CACvC,MAAMM,QAAQ/B,2CAAiB;CAC/B,MAAM0B,wBAA+B,KAAK;CAU1C,MAAM,EAAEgB,YAAYd,YAAYe,gFARvB;EACLlC,OAAOgB,MAAMhB;EACbmB,YAAYH,MAAMf;EAClB4B,UAAUb,MAAMa;EACjB,GACD,CAACb,MACH,CAGgB,EACdM,OACAL,IACD;CAED,OACE,4CAAC,SAAD;EACE,WAAU;EACV,iBAAeE,cAAcG,MAAMF;EACnC,gBAAcc;EACd,8BAA4BlB,MAAMR;EAClC,mBAAiBQ,MAAMP;YALzB,CAOE,2CAAC,SAAD;GACE,WAAU;GACV,GAAIwB;GACChB;GAAI,GAEVD,MAAMa,SACD"}
1
+ {"version":3,"file":"index2.cjs","names":[],"sources":["../../../src/components/SegmentedControl/index.tsx"],"sourcesContent":["import { ReactNode, forwardRef, memo, useMemo, useRef } from 'react'\nimport * as React from 'react'\nimport { RadioProvider, useRadioContext } from './RadioGroupContext'\nimport { useClassNames } from '../../_lib/useClassNames'\nimport './index.css'\nimport {\n AriaRadioGroupProps,\n AriaRadioProps,\n useRadio,\n useRadioGroup,\n} from 'react-aria/useRadioGroup'\n\nimport { useRadioGroupState } from 'react-stately/useRadioGroupState'\n\ntype SegmentedControlItem = {\n label: React.ReactNode\n value: string\n disabled?: boolean\n}\n\nexport type SegmentedControlProps = {\n readonly id?: string\n readonly name?: string\n readonly disabled?: boolean\n readonly readonly?: boolean\n readonly required?: boolean\n readonly className?: string\n readonly uniformSegmentWidth?: boolean\n readonly fullWidth?: boolean\n\n readonly value?: string\n readonly defaultValue?: string\n\n readonly data: string[] | SegmentedControlItem[]\n\n readonly onChange?: (value: string) => void\n}\n\nconst SegmentedControl = forwardRef<HTMLDivElement, SegmentedControlProps>(\n function SegmentedControlInner(props, ref) {\n const className = useClassNames(\n 'charcoal-segmented-control',\n props.className,\n )\n\n const ariaRadioGroupProps = useMemo<AriaRadioGroupProps>(\n () => ({\n ...props,\n isDisabled: props.disabled,\n isReadOnly: props.readonly,\n isRequired: props.required,\n 'aria-label': props.name,\n }),\n [props],\n )\n const state = useRadioGroupState(ariaRadioGroupProps)\n const { radioGroupProps } = useRadioGroup(ariaRadioGroupProps, state)\n const segmentedControlItems = useMemo<SegmentedControlItem[]>(() => {\n return props.data.map((d) =>\n typeof d === 'string' ? { value: d, label: d } : d,\n )\n }, [props.data])\n\n return (\n <div\n ref={ref}\n {...radioGroupProps}\n className={className}\n data-uniform-segment-width={props.uniformSegmentWidth}\n data-full-width={props.fullWidth}\n >\n <RadioProvider value={state}>\n {segmentedControlItems.map((item) => (\n <Segmented\n key={item.value}\n value={item.value}\n disabled={item.disabled}\n uniformSegmentWidth={props.uniformSegmentWidth}\n >\n {item.label}\n </Segmented>\n ))}\n </RadioProvider>\n </div>\n )\n },\n)\n\nexport default memo(SegmentedControl)\n\ntype RadioProps = {\n value: string\n disabled?: boolean\n children?: ReactNode\n uniformSegmentWidth?: boolean\n fullWidth?: boolean\n}\n\nconst Segmented = (props: RadioProps) => {\n const state = useRadioContext()\n const ref = useRef<HTMLInputElement>(null)\n const ariaRadioProps = useMemo<AriaRadioProps>(\n () => ({\n value: props.value,\n isDisabled: props.disabled,\n children: props.children,\n }),\n [props],\n )\n\n const { inputProps, isDisabled, isSelected } = useRadio(\n ariaRadioProps,\n state,\n ref,\n )\n\n return (\n <label\n className=\"charcoal-segmented-control-radio__label\"\n aria-disabled={isDisabled || state.isReadOnly}\n data-checked={isSelected}\n data-uniform-segment-width={props.uniformSegmentWidth}\n data-full-width={props.fullWidth}\n >\n <input\n className=\"charcoal-segmented-control-radio__input\"\n {...inputProps}\n ref={ref}\n />\n {props.children}\n </label>\n )\n}\n"],"mappings":";;;;;;;;;;;;AAsCA,MAAM,yCACJ,SAAS,sBAAsB,OAAO,KAAK;CACzC,MAAM,YAAY,oCAChB,8BACA,MAAM,SACR;CAEA,MAAM,gDACG;EACL,GAAG;EACH,YAAY,MAAM;EAClB,YAAY,MAAM;EAClB,YAAY,MAAM;EAClB,cAAc,MAAM;CACtB,IACA,CAAC,KAAK,CACR;CACA,MAAM,iEAA2B,mBAAmB;CACpD,MAAM,EAAE,gEAAkC,qBAAqB,KAAK;CACpE,MAAM,iDAA8D;EAClE,OAAO,MAAM,KAAK,KAAK,MACrB,OAAO,MAAM,WAAW;GAAE,OAAO;GAAG,OAAO;EAAE,IAAI,CACnD;CACF,GAAG,CAAC,MAAM,IAAI,CAAC;CAEf,OACE,2CAAC,OAAD;EACO;EACL,GAAI;EACO;EACX,8BAA4B,MAAM;EAClC,mBAAiB,MAAM;YAEvB,2CAAC,yCAAD;GAAe,OAAO;aACnB,sBAAsB,KAAK,SAC1B,2CAAC,WAAD;IAEE,OAAO,KAAK;IACZ,UAAU,KAAK;IACf,qBAAqB,MAAM;cAE1B,KAAK;GACG,GANJ,KAAK,KAMD,CACZ;EACY;CACZ;AAET,CACF;AAEA,+CAAoB,gBAAgB;AAUpC,MAAM,aAAa,UAAsB;CACvC,MAAM,QAAQ,0CAAgB;CAC9B,MAAM,wBAA+B,IAAI;CAUzC,MAAM,EAAE,YAAY,YAAY,gFARvB;EACL,OAAO,MAAM;EACb,YAAY,MAAM;EAClB,UAAU,MAAM;CAClB,IACA,CAAC,KAAK,CAIN,GACA,OACA,GACF;CAEA,OACE,4CAAC,SAAD;EACE,WAAU;EACV,iBAAe,cAAc,MAAM;EACnC,gBAAc;EACd,8BAA4B,MAAM;EAClC,mBAAiB,MAAM;YALzB,CAOE,2CAAC,SAAD;GACE,WAAU;GACV,GAAI;GACC;EAAI,IAEV,MAAM,QACF;;AAEX"}
@@ -1 +1 @@
1
- {"version":3,"file":"index2.js","names":["ReactNode","forwardRef","memo","useMemo","useRef","React","RadioProvider","useRadioContext","useClassNames","AriaRadioGroupProps","AriaRadioProps","useRadio","useRadioGroup","useRadioGroupState","SegmentedControlItem","label","value","disabled","SegmentedControlProps","id","name","readonly","required","className","uniformSegmentWidth","fullWidth","defaultValue","data","onChange","SegmentedControl","HTMLDivElement","SegmentedControlInner","props","ref","ariaRadioGroupProps","isDisabled","isReadOnly","isRequired","state","radioGroupProps","segmentedControlItems","map","d","item","RadioProps","children","Segmented","HTMLInputElement","ariaRadioProps","inputProps","isSelected"],"sources":["../../../src/components/SegmentedControl/index.tsx"],"sourcesContent":["import { ReactNode, forwardRef, memo, useMemo, useRef } from 'react'\nimport * as React from 'react'\nimport { RadioProvider, useRadioContext } from './RadioGroupContext'\nimport { useClassNames } from '../../_lib/useClassNames'\nimport './index.css'\nimport {\n AriaRadioGroupProps,\n AriaRadioProps,\n useRadio,\n useRadioGroup,\n} from 'react-aria/useRadioGroup'\n\nimport { useRadioGroupState } from 'react-stately/useRadioGroupState'\n\ntype SegmentedControlItem = {\n label: React.ReactNode\n value: string\n disabled?: boolean\n}\n\nexport type SegmentedControlProps = {\n readonly id?: string\n readonly name?: string\n readonly disabled?: boolean\n readonly readonly?: boolean\n readonly required?: boolean\n readonly className?: string\n readonly uniformSegmentWidth?: boolean\n readonly fullWidth?: boolean\n\n readonly value?: string\n readonly defaultValue?: string\n\n readonly data: string[] | SegmentedControlItem[]\n\n readonly onChange?: (value: string) => void\n}\n\nconst SegmentedControl = forwardRef<HTMLDivElement, SegmentedControlProps>(\n function SegmentedControlInner(props, ref) {\n const className = useClassNames(\n 'charcoal-segmented-control',\n props.className,\n )\n\n const ariaRadioGroupProps = useMemo<AriaRadioGroupProps>(\n () => ({\n ...props,\n isDisabled: props.disabled,\n isReadOnly: props.readonly,\n isRequired: props.required,\n 'aria-label': props.name,\n }),\n [props],\n )\n const state = useRadioGroupState(ariaRadioGroupProps)\n const { radioGroupProps } = useRadioGroup(ariaRadioGroupProps, state)\n const segmentedControlItems = useMemo<SegmentedControlItem[]>(() => {\n return props.data.map((d) =>\n typeof d === 'string' ? { value: d, label: d } : d,\n )\n }, [props.data])\n\n return (\n <div\n ref={ref}\n {...radioGroupProps}\n className={className}\n data-uniform-segment-width={props.uniformSegmentWidth}\n data-full-width={props.fullWidth}\n >\n <RadioProvider value={state}>\n {segmentedControlItems.map((item) => (\n <Segmented\n key={item.value}\n value={item.value}\n disabled={item.disabled}\n uniformSegmentWidth={props.uniformSegmentWidth}\n >\n {item.label}\n </Segmented>\n ))}\n </RadioProvider>\n </div>\n )\n },\n)\n\nexport default memo(SegmentedControl)\n\ntype RadioProps = {\n value: string\n disabled?: boolean\n children?: ReactNode\n uniformSegmentWidth?: boolean\n fullWidth?: boolean\n}\n\nconst Segmented = (props: RadioProps) => {\n const state = useRadioContext()\n const ref = useRef<HTMLInputElement>(null)\n const ariaRadioProps = useMemo<AriaRadioProps>(\n () => ({\n value: props.value,\n isDisabled: props.disabled,\n children: props.children,\n }),\n [props],\n )\n\n const { inputProps, isDisabled, isSelected } = useRadio(\n ariaRadioProps,\n state,\n ref,\n )\n\n return (\n <label\n className=\"charcoal-segmented-control-radio__label\"\n aria-disabled={isDisabled || state.isReadOnly}\n data-checked={isSelected}\n data-uniform-segment-width={props.uniformSegmentWidth}\n data-full-width={props.fullWidth}\n >\n <input\n className=\"charcoal-segmented-control-radio__input\"\n {...inputProps}\n ref={ref}\n />\n {props.children}\n </label>\n )\n}\n"],"mappings":";;;;;;;;;;AAsCA,MAAM6B,mBAAmB5B,WACvB,SAAS8B,sBAAsBC,OAAOC,KAAK;CACzC,MAAMV,YAAYf,cAChB,8BACAwB,MAAMT,UACP;CAED,MAAMW,sBAAsB/B,eACnB;EACL,GAAG6B;EACHG,YAAYH,MAAMf;EAClBmB,YAAYJ,MAAMX;EAClBgB,YAAYL,MAAMV;EAClB,cAAcU,MAAMZ;EACrB,GACD,CAACY,MACH,CAAC;CACD,MAAMM,QAAQzB,mBAAmBqB,oBAAoB;CACrD,MAAM,EAAEK,oBAAoB3B,cAAcsB,qBAAqBI,MAAM;CACrE,MAAME,wBAAwBrC,cAAsC;EAClE,OAAO6B,MAAML,KAAKc,KAAKC,MACrB,OAAOA,MAAM,WAAW;GAAE1B,OAAO0B;GAAG3B,OAAO2B;GAAG,GAAGA,EAClD;IACA,CAACV,MAAML,KAAK,CAAC;CAEhB,OACE,oBAAC,OAAD;EACOM;EACL,GAAIM;EACOhB;EACX,8BAA4BS,MAAMR;EAClC,mBAAiBQ,MAAMP;YAEvB,oBAAC,eAAD;GAAe,OAAOa;aACnBE,sBAAsBC,KAAKE,SAC1B,oBAAC,WAAD;IAEE,OAAOA,KAAK3B;IACZ,UAAU2B,KAAK1B;IACf,qBAAqBe,MAAMR;cAE1BmB,KAAK5B;IAET,EAPQ4B,KAAK3B,MAOb,CAAC;GACW;EACX;EAGX;AAED,+BAAed,KAAK2B,iBAAiB;AAUrC,MAAMiB,aAAad,UAAsB;CACvC,MAAMM,QAAQ/B,iBAAiB;CAC/B,MAAM0B,MAAM7B,OAAyB,KAAK;CAU1C,MAAM,EAAE6C,YAAYd,YAAYe,eAAevC,SATxBR,eACd;EACLa,OAAOgB,MAAMhB;EACbmB,YAAYH,MAAMf;EAClB4B,UAAUb,MAAMa;EACjB,GACD,CAACb,MACH,CAGgB,EACdM,OACAL,IACD;CAED,OACE,qBAAC,SAAD;EACE,WAAU;EACV,iBAAeE,cAAcG,MAAMF;EACnC,gBAAcc;EACd,8BAA4BlB,MAAMR;EAClC,mBAAiBQ,MAAMP;YALzB,CAOE,oBAAC,SAAD;GACE,WAAU;GACV,GAAIwB;GACChB;GAAI,GAEVD,MAAMa,SACD"}
1
+ {"version":3,"file":"index2.js","names":[],"sources":["../../../src/components/SegmentedControl/index.tsx"],"sourcesContent":["import { ReactNode, forwardRef, memo, useMemo, useRef } from 'react'\nimport * as React from 'react'\nimport { RadioProvider, useRadioContext } from './RadioGroupContext'\nimport { useClassNames } from '../../_lib/useClassNames'\nimport './index.css'\nimport {\n AriaRadioGroupProps,\n AriaRadioProps,\n useRadio,\n useRadioGroup,\n} from 'react-aria/useRadioGroup'\n\nimport { useRadioGroupState } from 'react-stately/useRadioGroupState'\n\ntype SegmentedControlItem = {\n label: React.ReactNode\n value: string\n disabled?: boolean\n}\n\nexport type SegmentedControlProps = {\n readonly id?: string\n readonly name?: string\n readonly disabled?: boolean\n readonly readonly?: boolean\n readonly required?: boolean\n readonly className?: string\n readonly uniformSegmentWidth?: boolean\n readonly fullWidth?: boolean\n\n readonly value?: string\n readonly defaultValue?: string\n\n readonly data: string[] | SegmentedControlItem[]\n\n readonly onChange?: (value: string) => void\n}\n\nconst SegmentedControl = forwardRef<HTMLDivElement, SegmentedControlProps>(\n function SegmentedControlInner(props, ref) {\n const className = useClassNames(\n 'charcoal-segmented-control',\n props.className,\n )\n\n const ariaRadioGroupProps = useMemo<AriaRadioGroupProps>(\n () => ({\n ...props,\n isDisabled: props.disabled,\n isReadOnly: props.readonly,\n isRequired: props.required,\n 'aria-label': props.name,\n }),\n [props],\n )\n const state = useRadioGroupState(ariaRadioGroupProps)\n const { radioGroupProps } = useRadioGroup(ariaRadioGroupProps, state)\n const segmentedControlItems = useMemo<SegmentedControlItem[]>(() => {\n return props.data.map((d) =>\n typeof d === 'string' ? { value: d, label: d } : d,\n )\n }, [props.data])\n\n return (\n <div\n ref={ref}\n {...radioGroupProps}\n className={className}\n data-uniform-segment-width={props.uniformSegmentWidth}\n data-full-width={props.fullWidth}\n >\n <RadioProvider value={state}>\n {segmentedControlItems.map((item) => (\n <Segmented\n key={item.value}\n value={item.value}\n disabled={item.disabled}\n uniformSegmentWidth={props.uniformSegmentWidth}\n >\n {item.label}\n </Segmented>\n ))}\n </RadioProvider>\n </div>\n )\n },\n)\n\nexport default memo(SegmentedControl)\n\ntype RadioProps = {\n value: string\n disabled?: boolean\n children?: ReactNode\n uniformSegmentWidth?: boolean\n fullWidth?: boolean\n}\n\nconst Segmented = (props: RadioProps) => {\n const state = useRadioContext()\n const ref = useRef<HTMLInputElement>(null)\n const ariaRadioProps = useMemo<AriaRadioProps>(\n () => ({\n value: props.value,\n isDisabled: props.disabled,\n children: props.children,\n }),\n [props],\n )\n\n const { inputProps, isDisabled, isSelected } = useRadio(\n ariaRadioProps,\n state,\n ref,\n )\n\n return (\n <label\n className=\"charcoal-segmented-control-radio__label\"\n aria-disabled={isDisabled || state.isReadOnly}\n data-checked={isSelected}\n data-uniform-segment-width={props.uniformSegmentWidth}\n data-full-width={props.fullWidth}\n >\n <input\n className=\"charcoal-segmented-control-radio__input\"\n {...inputProps}\n ref={ref}\n />\n {props.children}\n </label>\n )\n}\n"],"mappings":";;;;;;;;;;AAsCA,MAAM,mBAAmB,WACvB,SAAS,sBAAsB,OAAO,KAAK;CACzC,MAAM,YAAY,cAChB,8BACA,MAAM,SACR;CAEA,MAAM,sBAAsB,eACnB;EACL,GAAG;EACH,YAAY,MAAM;EAClB,YAAY,MAAM;EAClB,YAAY,MAAM;EAClB,cAAc,MAAM;CACtB,IACA,CAAC,KAAK,CACR;CACA,MAAM,QAAQ,mBAAmB,mBAAmB;CACpD,MAAM,EAAE,oBAAoB,cAAc,qBAAqB,KAAK;CACpE,MAAM,wBAAwB,cAAsC;EAClE,OAAO,MAAM,KAAK,KAAK,MACrB,OAAO,MAAM,WAAW;GAAE,OAAO;GAAG,OAAO;EAAE,IAAI,CACnD;CACF,GAAG,CAAC,MAAM,IAAI,CAAC;CAEf,OACE,oBAAC,OAAD;EACO;EACL,GAAI;EACO;EACX,8BAA4B,MAAM;EAClC,mBAAiB,MAAM;YAEvB,oBAAC,eAAD;GAAe,OAAO;aACnB,sBAAsB,KAAK,SAC1B,oBAAC,WAAD;IAEE,OAAO,KAAK;IACZ,UAAU,KAAK;IACf,qBAAqB,MAAM;cAE1B,KAAK;GACG,GANJ,KAAK,KAMD,CACZ;EACY;CACZ;AAET,CACF;AAEA,+BAAe,KAAK,gBAAgB;AAUpC,MAAM,aAAa,UAAsB;CACvC,MAAM,QAAQ,gBAAgB;CAC9B,MAAM,MAAM,OAAyB,IAAI;CAUzC,MAAM,EAAE,YAAY,YAAY,eAAe,SATxB,eACd;EACL,OAAO,MAAM;EACb,YAAY,MAAM;EAClB,UAAU,MAAM;CAClB,IACA,CAAC,KAAK,CAIN,GACA,OACA,GACF;CAEA,OACE,qBAAC,SAAD;EACE,WAAU;EACV,iBAAe,cAAc,MAAM;EACnC,gBAAc;EACd,8BAA4B,MAAM;EAClC,mBAAiB,MAAM;YALzB,CAOE,oBAAC,SAAD;GACE,WAAU;GACV,GAAI;GACC;EAAI,IAEV,MAAM,QACF;;AAEX"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Switch/SwitchInput/index.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAKpB,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;CACtC,CAAA;AAED,KAAK,UAAU,GAAG,KAAK,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAA;AAEnD,MAAM,MAAM,gBAAgB,GAAG,mBAAmB,GAChD,IAAI,CAAC,UAAU,EAAE,MAAM,mBAAmB,GAAG,KAAK,CAAC,CAAA;AAErD,QAAA,MAAM,WAAW,iIAsBf,CAAA;AAEF,eAAe,WAAW,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Switch/SwitchInput/index.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAKpB,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;CACtC,CAAA;AAED,KAAK,UAAU,GAAG,KAAK,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAA;AAEnD,MAAM,MAAM,gBAAgB,GAAG,mBAAmB,GAChD,IAAI,CAAC,UAAU,EAAE,MAAM,mBAAmB,GAAG,KAAK,CAAC,CAAA;AAErD,QAAA,MAAM,WAAW,iIAsBf,CAAA;eAEa,WAAW"}
@@ -1,5 +1,4 @@
1
1
  "use client";
2
- const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
3
2
  const require_useClassNames = require('../../../_lib/useClassNames.cjs');
4
3
  require('./index.cjs');
5
4
  let react = require("react");
@@ -1 +1 @@
1
- {"version":3,"file":"index2.cjs","names":["forwardRef","useCallback","useClassNames","CharcoalSwitchProps","onChange","checked","InputProps","React","HTMLProps","HTMLInputElement","SwitchInputProps","Omit","SwitchInput","className","props","ref","handleChange","e","ChangeEvent","el","currentTarget","classNames"],"sources":["../../../../src/components/Switch/SwitchInput/index.tsx"],"sourcesContent":["import './index.css'\n\nimport { forwardRef, useCallback } from 'react'\nimport { useClassNames } from '../../../_lib/useClassNames'\n\nexport type CharcoalSwitchProps = {\n onChange?: (checked: boolean) => void\n}\n\ntype InputProps = React.HTMLProps<HTMLInputElement>\n\nexport type SwitchInputProps = CharcoalSwitchProps &\n Omit<InputProps, keyof CharcoalSwitchProps | 'ref'>\n\nconst SwitchInput = forwardRef<\n HTMLInputElement,\n Omit<SwitchInputProps, 'children'>\n>(function SwitchInput({ onChange, className, ...props }, ref) {\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n const el = e.currentTarget\n onChange?.(el.checked)\n },\n [onChange],\n )\n\n const classNames = useClassNames('charcoal-switch-input', className)\n return (\n <input\n ref={ref}\n className={classNames}\n type=\"checkbox\"\n onChange={handleChange}\n {...props}\n />\n )\n})\n\nexport default SwitchInput\n"],"mappings":";;;;;;;;AAcA,MAAMY,oCAGJ,SAASA,YAAY,EAAER,UAAUS,WAAW,GAAGC,SAASC,KAAK;CAC7D,MAAMC,uCACHC,MAA2C;EAC1C,MAAME,KAAKF,EAAEG;EACbhB,WAAWe,GAAGd,QAAQ;IAExB,CAACD,SACH,CAAC;CAGD,OACE,2CAAC,SAAD;EACOW;EACL,WAJeb,oCAAc,yBAAyBW,UAIjC;EACrB,MAAK;EACL,UAAUG;EACV,GAAIF;EACJ;EAEJ"}
1
+ {"version":3,"file":"index2.cjs","names":[],"sources":["../../../../src/components/Switch/SwitchInput/index.tsx"],"sourcesContent":["import './index.css'\n\nimport { forwardRef, useCallback } from 'react'\nimport { useClassNames } from '../../../_lib/useClassNames'\n\nexport type CharcoalSwitchProps = {\n onChange?: (checked: boolean) => void\n}\n\ntype InputProps = React.HTMLProps<HTMLInputElement>\n\nexport type SwitchInputProps = CharcoalSwitchProps &\n Omit<InputProps, keyof CharcoalSwitchProps | 'ref'>\n\nconst SwitchInput = forwardRef<\n HTMLInputElement,\n Omit<SwitchInputProps, 'children'>\n>(function SwitchInput({ onChange, className, ...props }, ref) {\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n const el = e.currentTarget\n onChange?.(el.checked)\n },\n [onChange],\n )\n\n const classNames = useClassNames('charcoal-switch-input', className)\n return (\n <input\n ref={ref}\n className={classNames}\n type=\"checkbox\"\n onChange={handleChange}\n {...props}\n />\n )\n})\n\nexport default SwitchInput\n"],"mappings":";;;;;;;AAcA,MAAM,oCAGJ,SAAS,YAAY,EAAE,UAAU,WAAW,GAAG,SAAS,KAAK;CAC7D,MAAM,uCACH,MAA2C;EAC1C,MAAM,KAAK,EAAE;EACb,WAAW,GAAG,OAAO;CACvB,GACA,CAAC,QAAQ,CACX;CAGA,OACE,2CAAC,SAAD;EACO;EACL,WAJe,oCAAc,yBAAyB,SAI3C;EACX,MAAK;EACL,UAAU;EACV,GAAI;CAAM;AAGhB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index2.js","names":["forwardRef","useCallback","useClassNames","CharcoalSwitchProps","onChange","checked","InputProps","React","HTMLProps","HTMLInputElement","SwitchInputProps","Omit","SwitchInput","className","props","ref","handleChange","e","ChangeEvent","el","currentTarget","classNames"],"sources":["../../../../src/components/Switch/SwitchInput/index.tsx"],"sourcesContent":["import './index.css'\n\nimport { forwardRef, useCallback } from 'react'\nimport { useClassNames } from '../../../_lib/useClassNames'\n\nexport type CharcoalSwitchProps = {\n onChange?: (checked: boolean) => void\n}\n\ntype InputProps = React.HTMLProps<HTMLInputElement>\n\nexport type SwitchInputProps = CharcoalSwitchProps &\n Omit<InputProps, keyof CharcoalSwitchProps | 'ref'>\n\nconst SwitchInput = forwardRef<\n HTMLInputElement,\n Omit<SwitchInputProps, 'children'>\n>(function SwitchInput({ onChange, className, ...props }, ref) {\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n const el = e.currentTarget\n onChange?.(el.checked)\n },\n [onChange],\n )\n\n const classNames = useClassNames('charcoal-switch-input', className)\n return (\n <input\n ref={ref}\n className={classNames}\n type=\"checkbox\"\n onChange={handleChange}\n {...props}\n />\n )\n})\n\nexport default SwitchInput\n"],"mappings":";;;;;;;AAcA,MAAMY,cAAcZ,WAGlB,SAASY,YAAY,EAAER,UAAUS,WAAW,GAAGC,SAASC,KAAK;CAC7D,MAAMC,eAAef,aAClBgB,MAA2C;EAC1C,MAAME,KAAKF,EAAEG;EACbhB,WAAWe,GAAGd,QAAQ;IAExB,CAACD,SACH,CAAC;CAGD,OACE,oBAAC,SAAD;EACOW;EACL,WAJeb,cAAc,yBAAyBW,UAIjC;EACrB,MAAK;EACL,UAAUG;EACV,GAAIF;EACJ;EAEJ"}
1
+ {"version":3,"file":"index2.js","names":[],"sources":["../../../../src/components/Switch/SwitchInput/index.tsx"],"sourcesContent":["import './index.css'\n\nimport { forwardRef, useCallback } from 'react'\nimport { useClassNames } from '../../../_lib/useClassNames'\n\nexport type CharcoalSwitchProps = {\n onChange?: (checked: boolean) => void\n}\n\ntype InputProps = React.HTMLProps<HTMLInputElement>\n\nexport type SwitchInputProps = CharcoalSwitchProps &\n Omit<InputProps, keyof CharcoalSwitchProps | 'ref'>\n\nconst SwitchInput = forwardRef<\n HTMLInputElement,\n Omit<SwitchInputProps, 'children'>\n>(function SwitchInput({ onChange, className, ...props }, ref) {\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n const el = e.currentTarget\n onChange?.(el.checked)\n },\n [onChange],\n )\n\n const classNames = useClassNames('charcoal-switch-input', className)\n return (\n <input\n ref={ref}\n className={classNames}\n type=\"checkbox\"\n onChange={handleChange}\n {...props}\n />\n )\n})\n\nexport default SwitchInput\n"],"mappings":";;;;;;;AAcA,MAAM,cAAc,WAGlB,SAAS,YAAY,EAAE,UAAU,WAAW,GAAG,SAAS,KAAK;CAC7D,MAAM,eAAe,aAClB,MAA2C;EAC1C,MAAM,KAAK,EAAE;EACb,WAAW,GAAG,OAAO;CACvB,GACA,CAAC,QAAQ,CACX;CAGA,OACE,oBAAC,SAAD;EACO;EACL,WAJe,cAAc,yBAAyB,SAI3C;EACX,MAAK;EACL,UAAU;EACV,GAAI;CAAM;AAGhB,CAAC"}
@@ -2,7 +2,7 @@
2
2
  const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
3
  const require_useClassNames = require('../../_lib/useClassNames.cjs');
4
4
  let react = require("react");
5
- react = require_runtime.__toESM(react);
5
+ react = require_runtime.__toESM(react, 1);
6
6
  let react_jsx_runtime = require("react/jsx-runtime");
7
7
 
8
8
  //#region src/components/Switch/SwitchWithLabel.tsx
@@ -1 +1 @@
1
- {"version":3,"file":"SwitchWithLabel.cjs","names":["React","useClassNames","SwitchWithLabel","memo","children","className","disabled","id","input","ReactNode","classNames"],"sources":["../../../src/components/Switch/SwitchWithLabel.tsx"],"sourcesContent":["import * as React from 'react'\nimport { useClassNames } from '../../_lib/useClassNames'\n\nexport const SwitchWithLabel = React.memo(function SwitchWithLabel({\n children,\n className,\n disabled,\n id,\n input,\n}: {\n children: React.ReactNode\n className?: string\n disabled?: boolean\n id?: string\n input: React.ReactNode\n}) {\n const classNames = useClassNames('charcoal-switch__label', className)\n return (\n <label htmlFor={id} className={classNames} aria-disabled={disabled}>\n {input}\n <div className=\"charcoal-switch__label_div\">{children}</div>\n </label>\n )\n})\n"],"mappings":";;;;;;;;AAGA,MAAaE,kBAAkBF,MAAMG,KAAK,SAASD,gBAAgB,EACjEE,UACAC,WACAC,UACAC,IACAC,SAOC;CAED,OACE,4CAAC,SAAD;EAAO,SAASD;EAAI,WAFHN,oCAAc,0BAA0BI,UAEhB;EAAE,iBAAeC;YAA1D,CACGE,OACD,2CAAC,OAAD;GAAK,WAAU;GAA8BJ;GAAc,EACrD;;EAEV"}
1
+ {"version":3,"file":"SwitchWithLabel.cjs","names":[],"sources":["../../../src/components/Switch/SwitchWithLabel.tsx"],"sourcesContent":["import * as React from 'react'\nimport { useClassNames } from '../../_lib/useClassNames'\n\nexport const SwitchWithLabel = React.memo(function SwitchWithLabel({\n children,\n className,\n disabled,\n id,\n input,\n}: {\n children: React.ReactNode\n className?: string\n disabled?: boolean\n id?: string\n input: React.ReactNode\n}) {\n const classNames = useClassNames('charcoal-switch__label', className)\n return (\n <label htmlFor={id} className={classNames} aria-disabled={disabled}>\n {input}\n <div className=\"charcoal-switch__label_div\">{children}</div>\n </label>\n )\n})\n"],"mappings":";;;;;;;;AAGA,MAAa,kBAAkB,MAAM,KAAK,SAAS,gBAAgB,EACjE,UACA,WACA,UACA,IACA,SAOC;CAED,OACE,4CAAC,SAAD;EAAO,SAAS;EAAI,WAFH,oCAAc,0BAA0B,SAE1B;EAAY,iBAAe;YAA1D,CACG,OACD,2CAAC,OAAD;GAAK,WAAU;GAA8B;EAAc,EACtD;;AAEX,CAAC"}
@@ -1,9 +1,9 @@
1
1
  import * as React from 'react';
2
- export declare const SwitchWithLabel: React.NamedExoticComponent<{
2
+ export declare const SwitchWithLabel: React.MemoExoticComponent<({ children, className, disabled, id, input, }: {
3
3
  children: React.ReactNode;
4
4
  className?: string;
5
5
  disabled?: boolean;
6
6
  id?: string;
7
7
  input: React.ReactNode;
8
- }>;
8
+ }) => import("react/jsx-runtime").JSX.Element>;
9
9
  //# sourceMappingURL=SwitchWithLabel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SwitchWithLabel.d.ts","sourceRoot":"","sources":["../../../src/components/Switch/SwitchWithLabel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,eAAO,MAAM,eAAe;cAOhB,KAAK,CAAC,SAAS;gBACb,MAAM;eACP,OAAO;SACb,MAAM;WACJ,KAAK,CAAC,SAAS;EAStB,CAAA"}
1
+ {"version":3,"file":"SwitchWithLabel.d.ts","sourceRoot":"","sources":["../../../src/components/Switch/SwitchWithLabel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,eAAO,MAAM,eAAe,4EAMzB;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,KAAK,CAAC,SAAS,CAAA;CACvB,6CAQC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"SwitchWithLabel.js","names":["React","useClassNames","SwitchWithLabel","memo","children","className","disabled","id","input","ReactNode","classNames"],"sources":["../../../src/components/Switch/SwitchWithLabel.tsx"],"sourcesContent":["import * as React from 'react'\nimport { useClassNames } from '../../_lib/useClassNames'\n\nexport const SwitchWithLabel = React.memo(function SwitchWithLabel({\n children,\n className,\n disabled,\n id,\n input,\n}: {\n children: React.ReactNode\n className?: string\n disabled?: boolean\n id?: string\n input: React.ReactNode\n}) {\n const classNames = useClassNames('charcoal-switch__label', className)\n return (\n <label htmlFor={id} className={classNames} aria-disabled={disabled}>\n {input}\n <div className=\"charcoal-switch__label_div\">{children}</div>\n </label>\n )\n})\n"],"mappings":";;;;;;AAGA,MAAaE,kBAAkBF,QAAMG,KAAK,SAASD,gBAAgB,EACjEE,UACAC,WACAC,UACAC,IACAC,SAOC;CAED,OACE,qBAAC,SAAD;EAAO,SAASD;EAAI,WAFHN,cAAc,0BAA0BI,UAEhB;EAAE,iBAAeC;YAA1D,CACGE,OACD,oBAAC,OAAD;GAAK,WAAU;GAA8BJ;GAAc,EACrD;;EAEV"}
1
+ {"version":3,"file":"SwitchWithLabel.js","names":[],"sources":["../../../src/components/Switch/SwitchWithLabel.tsx"],"sourcesContent":["import * as React from 'react'\nimport { useClassNames } from '../../_lib/useClassNames'\n\nexport const SwitchWithLabel = React.memo(function SwitchWithLabel({\n children,\n className,\n disabled,\n id,\n input,\n}: {\n children: React.ReactNode\n className?: string\n disabled?: boolean\n id?: string\n input: React.ReactNode\n}) {\n const classNames = useClassNames('charcoal-switch__label', className)\n return (\n <label htmlFor={id} className={classNames} aria-disabled={disabled}>\n {input}\n <div className=\"charcoal-switch__label_div\">{children}</div>\n </label>\n )\n})\n"],"mappings":";;;;;;AAGA,MAAa,kBAAkB,QAAM,KAAK,SAAS,gBAAgB,EACjE,UACA,WACA,UACA,IACA,SAOC;CAED,OACE,qBAAC,SAAD;EAAO,SAAS;EAAI,WAFH,cAAc,0BAA0B,SAE1B;EAAY,iBAAe;YAA1D,CACG,OACD,oBAAC,OAAD;GAAK,WAAU;GAA8B;EAAc,EACtD;;AAEX,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import './index.css';
2
2
  import { type SwitchInputProps } from './SwitchInput';
3
3
  export type SwitchProps = SwitchInputProps;
4
- declare const _default: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<import("./SwitchInput").CharcoalSwitchProps & Omit<import("react").HTMLProps<HTMLInputElement>, "ref" | "onChange"> & import("react").RefAttributes<HTMLInputElement>>>;
4
+ declare const _default: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<import("./SwitchInput").CharcoalSwitchProps & Omit<import("react").HTMLProps<HTMLInputElement>, "onChange" | "ref"> & import("react").RefAttributes<HTMLInputElement>>>;
5
5
  export default _default;
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Switch/index.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAGpB,OAAoB,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAIlE,MAAM,MAAM,WAAW,GAAG,gBAAgB,CAAA;;AAqC1C,wBAA2B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Switch/index.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAGpB,OAAoB,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAIlE,MAAM,MAAM,WAAW,GAAG,gBAAgB,CAAA"}
@@ -1,5 +1,4 @@
1
1
  "use client";
2
- const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
2
  require('./index.cjs');
4
3
  const require_index$1 = require('./SwitchInput/index2.cjs');
5
4
  const require_SwitchWithLabel = require('./SwitchWithLabel.cjs');
@@ -1 +1 @@
1
- {"version":3,"file":"index2.cjs","names":["memo","forwardRef","SwitchInput","SwitchInputProps","SwitchWithLabel","useId","SwitchProps","Switch","HTMLInputElement","children","onChange","disabled","className","id","props","ref","htmlId","noChildren","undefined","input"],"sources":["../../../src/components/Switch/index.tsx"],"sourcesContent":["import './index.css'\n\nimport { memo, forwardRef } from 'react'\nimport SwitchInput, { type SwitchInputProps } from './SwitchInput'\nimport { SwitchWithLabel } from './SwitchWithLabel'\nimport { useId } from 'react-aria/useId'\n\nexport type SwitchProps = SwitchInputProps\n\nconst Switch = forwardRef<HTMLInputElement, SwitchProps>(function Switch(\n { children, onChange, disabled, className, id, ...props },\n ref,\n) {\n const htmlId = useId(id)\n const noChildren = children === undefined\n const input = (\n <SwitchInput\n {...props}\n disabled={disabled}\n className={noChildren ? className : undefined}\n id={htmlId}\n onChange={onChange}\n ref={ref}\n role=\"switch\"\n type=\"checkbox\"\n />\n )\n\n if (noChildren) {\n return input\n }\n\n return (\n <SwitchWithLabel\n className={className}\n disabled={disabled}\n id={htmlId}\n input={input}\n >\n {children}\n </SwitchWithLabel>\n )\n})\n\nexport default memo(Switch)\n"],"mappings":";;;;;;;;;;AASA,MAAMO,+BAAmD,SAASA,OAChE,EAAEE,UAAUC,UAAUC,UAAUC,WAAWC,IAAI,GAAGC,SAClDC,KACA;CACA,MAAMC,qCAAeH,GAAG;CACxB,MAAMI,aAAaR,aAAaS;CAChC,MAAMC,QACJ,2CAAC,yBAAD;EACE,GAAIL;EACMH;EACV,WAAWM,aAAaL,YAAYM;EACpC,IAAIF;EACMN;EACLK;EACL,MAAK;EACL,MAAK;EAER;CAED,IAAIE,YACF,OAAOE;CAGT,OACE,2CAAC,yCAAD;EACaP;EACDD;EACV,IAAIK;EACGG;EAENV;EACe;EAEpB;AAEF,qCAAoBF,OAAO"}
1
+ {"version":3,"file":"index2.cjs","names":[],"sources":["../../../src/components/Switch/index.tsx"],"sourcesContent":["import './index.css'\n\nimport { memo, forwardRef } from 'react'\nimport SwitchInput, { type SwitchInputProps } from './SwitchInput'\nimport { SwitchWithLabel } from './SwitchWithLabel'\nimport { useId } from 'react-aria/useId'\n\nexport type SwitchProps = SwitchInputProps\n\nconst Switch = forwardRef<HTMLInputElement, SwitchProps>(function Switch(\n { children, onChange, disabled, className, id, ...props },\n ref,\n) {\n const htmlId = useId(id)\n const noChildren = children === undefined\n const input = (\n <SwitchInput\n {...props}\n disabled={disabled}\n className={noChildren ? className : undefined}\n id={htmlId}\n onChange={onChange}\n ref={ref}\n role=\"switch\"\n type=\"checkbox\"\n />\n )\n\n if (noChildren) {\n return input\n }\n\n return (\n <SwitchWithLabel\n className={className}\n disabled={disabled}\n id={htmlId}\n input={input}\n >\n {children}\n </SwitchWithLabel>\n )\n})\n\nexport default memo(Switch)\n"],"mappings":";;;;;;;;;AASA,MAAM,+BAAmD,SAAS,OAChE,EAAE,UAAU,UAAU,UAAU,WAAW,IAAI,GAAG,SAClD,KACA;CACA,MAAM,qCAAe,EAAE;CACvB,MAAM,aAAa,aAAa;CAChC,MAAM,QACJ,2CAAC,yBAAD;EACE,GAAI;EACM;EACV,WAAW,aAAa,YAAY;EACpC,IAAI;EACM;EACL;EACL,MAAK;EACL,MAAK;CAAU;CAInB,IAAI,YACF,OAAO;CAGT,OACE,2CAAC,yCAAD;EACa;EACD;EACV,IAAI;EACG;EAEN;CACc;AAErB,CAAC;AAED,qCAAoB,MAAM"}
@@ -1 +1 @@
1
- {"version":3,"file":"index2.js","names":["memo","forwardRef","SwitchInput","SwitchInputProps","SwitchWithLabel","useId","SwitchProps","Switch","HTMLInputElement","children","onChange","disabled","className","id","props","ref","htmlId","noChildren","undefined","input"],"sources":["../../../src/components/Switch/index.tsx"],"sourcesContent":["import './index.css'\n\nimport { memo, forwardRef } from 'react'\nimport SwitchInput, { type SwitchInputProps } from './SwitchInput'\nimport { SwitchWithLabel } from './SwitchWithLabel'\nimport { useId } from 'react-aria/useId'\n\nexport type SwitchProps = SwitchInputProps\n\nconst Switch = forwardRef<HTMLInputElement, SwitchProps>(function Switch(\n { children, onChange, disabled, className, id, ...props },\n ref,\n) {\n const htmlId = useId(id)\n const noChildren = children === undefined\n const input = (\n <SwitchInput\n {...props}\n disabled={disabled}\n className={noChildren ? className : undefined}\n id={htmlId}\n onChange={onChange}\n ref={ref}\n role=\"switch\"\n type=\"checkbox\"\n />\n )\n\n if (noChildren) {\n return input\n }\n\n return (\n <SwitchWithLabel\n className={className}\n disabled={disabled}\n id={htmlId}\n input={input}\n >\n {children}\n </SwitchWithLabel>\n )\n})\n\nexport default memo(Switch)\n"],"mappings":";;;;;;;;;AASA,MAAMO,SAASN,WAA0C,SAASM,OAChE,EAAEE,UAAUC,UAAUC,UAAUC,WAAWC,IAAI,GAAGC,SAClDC,KACA;CACA,MAAMC,SAASX,MAAMQ,GAAG;CACxB,MAAMI,aAAaR,aAAaS;CAChC,MAAMC,QACJ,oBAAC,aAAD;EACE,GAAIL;EACMH;EACV,WAAWM,aAAaL,YAAYM;EACpC,IAAIF;EACMN;EACLK;EACL,MAAK;EACL,MAAK;EAER;CAED,IAAIE,YACF,OAAOE;CAGT,OACE,oBAAC,iBAAD;EACaP;EACDD;EACV,IAAIK;EACGG;EAENV;EACe;EAEpB;AAEF,qBAAeT,KAAKO,OAAO"}
1
+ {"version":3,"file":"index2.js","names":[],"sources":["../../../src/components/Switch/index.tsx"],"sourcesContent":["import './index.css'\n\nimport { memo, forwardRef } from 'react'\nimport SwitchInput, { type SwitchInputProps } from './SwitchInput'\nimport { SwitchWithLabel } from './SwitchWithLabel'\nimport { useId } from 'react-aria/useId'\n\nexport type SwitchProps = SwitchInputProps\n\nconst Switch = forwardRef<HTMLInputElement, SwitchProps>(function Switch(\n { children, onChange, disabled, className, id, ...props },\n ref,\n) {\n const htmlId = useId(id)\n const noChildren = children === undefined\n const input = (\n <SwitchInput\n {...props}\n disabled={disabled}\n className={noChildren ? className : undefined}\n id={htmlId}\n onChange={onChange}\n ref={ref}\n role=\"switch\"\n type=\"checkbox\"\n />\n )\n\n if (noChildren) {\n return input\n }\n\n return (\n <SwitchWithLabel\n className={className}\n disabled={disabled}\n id={htmlId}\n input={input}\n >\n {children}\n </SwitchWithLabel>\n )\n})\n\nexport default memo(Switch)\n"],"mappings":";;;;;;;;;AASA,MAAM,SAAS,WAA0C,SAAS,OAChE,EAAE,UAAU,UAAU,UAAU,WAAW,IAAI,GAAG,SAClD,KACA;CACA,MAAM,SAAS,MAAM,EAAE;CACvB,MAAM,aAAa,aAAa;CAChC,MAAM,QACJ,oBAAC,aAAD;EACE,GAAI;EACM;EACV,WAAW,aAAa,YAAY;EACpC,IAAI;EACM;EACL;EACL,MAAK;EACL,MAAK;CAAU;CAInB,IAAI,YACF,OAAO;CAGT,OACE,oBAAC,iBAAD;EACa;EACD;EACV,IAAI;EACG;EAEN;CACc;AAErB,CAAC;AAED,qBAAe,KAAK,MAAM"}
@@ -18,6 +18,6 @@ export type TagItemProps<T extends React.ElementType = 'a'> = {
18
18
  */
19
19
  component?: T;
20
20
  } & Omit<React.ComponentPropsWithRef<T>, 'children' | 'disabled'>;
21
- declare const _default: React.MemoExoticComponent<(<T extends React.ElementType = "a">(p: TagItemProps<T>) => JSX.Element)>;
21
+ declare const _default: React.MemoExoticComponent<<T extends React.ElementType = "a">(p: TagItemProps<T>) => JSX.Element>;
22
22
  export default _default;
23
23
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/TagItem/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAA2C,KAAK,GAAG,EAAE,MAAM,OAAO,CAAA;AAGhF,OAAO,aAAa,CAAA;AAKpB,KAAK,OAAO,GAAG;IACb,CAAC,EAAE,EAAE,CAAA;IACL,CAAC,EAAE,EAAE,CAAA;CACN,CAAA;AAED,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,GAAG,IAAI;IAC5D,KAAK,EAAE,MAAM,CAAA;IACb,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,UAAU,CAAA;IAC1C,IAAI,CAAC,EAAE,MAAM,OAAO,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;OAGG;IACH,SAAS,CAAC,EAAE,CAAC,CAAA;CACd,GAAG,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC,CAAA;oDA+E3D,CAAC,SAAS,KAAK,CAAC,WAAW,WAAW,YAAY,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,OAAO;AAE3E,wBAA4B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/TagItem/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAA2C,KAAK,GAAG,EAAE,MAAM,OAAO,CAAA;AAGhF,OAAO,aAAa,CAAA;AAKpB,KAAK,OAAO,GAAG;IACb,CAAC,EAAE,EAAE,CAAA;IACL,CAAC,EAAE,EAAE,CAAA;CACN,CAAA;AAED,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,GAAG,IAAI;IAC5D,KAAK,EAAE,MAAM,CAAA;IACb,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,UAAU,CAAA;IAC1C,IAAI,CAAC,EAAE,MAAM,OAAO,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;OAGG;IACH,SAAS,CAAC,EAAE,CAAC,CAAA;CACd,GAAG,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC,CAAA;mDA+E3D,CAAC,SAAS,KAAK,CAAC,WAAW,WAAW,YAAY,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,OAAO"}
@@ -4,7 +4,7 @@ const require_useClassNames = require('../../_lib/useClassNames.cjs');
4
4
  const require_index = require('../Icon/index.cjs');
5
5
  require('./index.cjs');
6
6
  let react = require("react");
7
- react = require_runtime.__toESM(react);
7
+ react = require_runtime.__toESM(react, 1);
8
8
  let react_jsx_runtime = require("react/jsx-runtime");
9
9
  let react_aria_useObjectRef = require("react-aria/useObjectRef");
10
10
  let react_aria = require("react-aria");
@@ -1 +1 @@
1
- {"version":3,"file":"index2.cjs","names":["React","forwardRef","memo","useMemo","ForwardedRef","JSX","Icon","useClassNames","useObjectRef","useLink","SizeMap","S","M","TagItemProps","ElementType","label","translatedLabel","bgColor","bgImage","status","size","disabled","component","T","Omit","ComponentPropsWithRef","TagItem","HTMLAnchorElement","TagItemInner","ariaDisabled","props","_ref","ref","hasTranslatedLabel","undefined","length","className","bgVariant","bg","Component","isButton","linkProps","isDisabled","elementType","disabledProps","p","Element"],"sources":["../../../src/components/TagItem/index.tsx"],"sourcesContent":["import React, { forwardRef, memo, useMemo, ForwardedRef, type JSX } from 'react'\nimport Icon from '../Icon'\nimport { useClassNames } from '../../_lib/useClassNames'\nimport './index.css'\n\nimport { useObjectRef } from 'react-aria/useObjectRef'\nimport { useLink } from 'react-aria'\n\ntype SizeMap = {\n S: 32\n M: 40\n}\n\nexport type TagItemProps<T extends React.ElementType = 'a'> = {\n label: string\n translatedLabel?: string\n bgColor?: string\n bgImage?: string\n status?: 'default' | 'active' | 'inactive'\n size?: keyof SizeMap\n disabled?: boolean\n /**\n * The component used for root element.\n * @type T extends React.ElementType = 'a'\n */\n component?: T\n} & Omit<React.ComponentPropsWithRef<T>, 'children' | 'disabled'>\n\nconst TagItem = forwardRef<HTMLAnchorElement, TagItemProps>(\n function TagItemInner<T extends React.ElementType>(\n {\n component,\n label,\n translatedLabel,\n bgColor = '#7ACCB1',\n bgImage,\n size = 'M',\n status = 'default',\n disabled,\n 'aria-disabled': ariaDisabled,\n ...props\n }: TagItemProps<T>,\n _ref: ForwardedRef<HTMLAnchorElement>,\n ) {\n const ref = useObjectRef(_ref)\n\n const hasTranslatedLabel =\n translatedLabel !== undefined && translatedLabel.length > 0\n const className = useClassNames(\n 'charcoal-tag-item',\n 'charcoal-tag-item__bg',\n props.className,\n )\n\n const bgVariant =\n bgImage !== undefined && bgImage.length > 0 ? 'image' : 'color'\n const bg = bgVariant === 'color' ? bgColor : `url(${bgImage ?? ''})`\n\n const Component = useMemo(() => component ?? 'a', [component])\n const isButton = Component === 'button'\n\n const { linkProps } = useLink(\n {\n ...props,\n isDisabled: disabled,\n elementType: typeof Component === 'string' ? Component : 'a',\n },\n ref,\n )\n\n const disabledProps = isButton\n ? { disabled, 'aria-disabled': ariaDisabled }\n : linkProps\n\n return (\n <Component\n {...props}\n {...disabledProps}\n ref={ref}\n className={className}\n data-state={status}\n data-bg-variant={bgVariant}\n data-size={hasTranslatedLabel ? 'M' : size}\n style={{ '--charcoal-tag-item-bg': bg }}\n >\n <div\n className=\"charcoal-tag-item__label\"\n data-has-translate={hasTranslatedLabel}\n >\n {hasTranslatedLabel && (\n <span className=\"charcoal-tag-item__label__translated\">\n {translatedLabel}\n </span>\n )}\n <span\n className=\"charcoal-tag-item__label__text\"\n data-has-translate={hasTranslatedLabel}\n >\n {label}\n </span>\n </div>\n {status === 'active' && <Icon name=\"16/Remove\" />}\n </Component>\n )\n },\n) as <T extends React.ElementType = 'a'>(p: TagItemProps<T>) => JSX.Element\n\nexport default memo(TagItem)\n"],"mappings":";;;;;;;;;;;;AA4BA,MAAM0B,gCACJ,SAASE,aACP,EACEN,WACAP,OACAC,iBACAC,UAAU,WACVC,SACAE,OAAO,KACPD,SAAS,WACTE,UACA,iBAAiBQ,cACjB,GAAGC,SAELC,MACA;CACA,MAAMC,gDAAmBD,KAAK;CAE9B,MAAME,qBACJjB,oBAAoBkB,UAAalB,gBAAgBmB,SAAS;CAC5D,MAAMC,YAAY7B,oCAChB,qBACA,yBACAuB,MAAMM,UACP;CAED,MAAMC,YACJnB,YAAYgB,UAAahB,QAAQiB,SAAS,IAAI,UAAU;CAC1D,MAAMG,KAAKD,cAAc,UAAUpB,UAAU,OAAOC,WAAW,GAAE;CAEjE,MAAMqB,qCAA0BjB,aAAa,KAAK,CAACA,UAAU,CAAC;CAC9D,MAAMkB,WAAWD,cAAc;CAE/B,MAAM,EAAEE,sCACN;EACE,GAAGX;EACHY,YAAYrB;EACZsB,aAAa,OAAOJ,cAAc,WAAWA,YAAY;EAC1D,EACDP,IACD;CAED,MAAMY,gBAAgBJ,WAClB;EAAEnB;EAAU,iBAAiBQ;EAAc,GAC3CY;CAEJ,OACE,4CAAC,WAAD;EACE,GAAIX;EACJ,GAAIc;EACCZ;EACMI;EACX,cAAYjB;EACZ,mBAAiBkB;EACjB,aAAWJ,qBAAqB,MAAMb;EACtC,OAAO,EAAE,0BAA0BkB,IAAI;YARzC,CAUE,4CAAC,OAAD;GACE,WAAU;GACV,sBAAoBL;aAFtB,CAIGA,sBACC,2CAAC,QAAD;IAAM,WAAU;cACbjB;IAEJ,GACD,2CAAC,QAAD;IACE,WAAU;IACV,sBAAoBiB;cAEnBlB;IACG,EACH;MACJI,WAAW,YAAY,2CAAC,uBAAD,EAAM,MAAK,aAAc,EACvC;;EAGjB;AAED,sCAAoBO,QAAQ"}
1
+ {"version":3,"file":"index2.cjs","names":[],"sources":["../../../src/components/TagItem/index.tsx"],"sourcesContent":["import React, { forwardRef, memo, useMemo, ForwardedRef, type JSX } from 'react'\nimport Icon from '../Icon'\nimport { useClassNames } from '../../_lib/useClassNames'\nimport './index.css'\n\nimport { useObjectRef } from 'react-aria/useObjectRef'\nimport { useLink } from 'react-aria'\n\ntype SizeMap = {\n S: 32\n M: 40\n}\n\nexport type TagItemProps<T extends React.ElementType = 'a'> = {\n label: string\n translatedLabel?: string\n bgColor?: string\n bgImage?: string\n status?: 'default' | 'active' | 'inactive'\n size?: keyof SizeMap\n disabled?: boolean\n /**\n * The component used for root element.\n * @type T extends React.ElementType = 'a'\n */\n component?: T\n} & Omit<React.ComponentPropsWithRef<T>, 'children' | 'disabled'>\n\nconst TagItem = forwardRef<HTMLAnchorElement, TagItemProps>(\n function TagItemInner<T extends React.ElementType>(\n {\n component,\n label,\n translatedLabel,\n bgColor = '#7ACCB1',\n bgImage,\n size = 'M',\n status = 'default',\n disabled,\n 'aria-disabled': ariaDisabled,\n ...props\n }: TagItemProps<T>,\n _ref: ForwardedRef<HTMLAnchorElement>,\n ) {\n const ref = useObjectRef(_ref)\n\n const hasTranslatedLabel =\n translatedLabel !== undefined && translatedLabel.length > 0\n const className = useClassNames(\n 'charcoal-tag-item',\n 'charcoal-tag-item__bg',\n props.className,\n )\n\n const bgVariant =\n bgImage !== undefined && bgImage.length > 0 ? 'image' : 'color'\n const bg = bgVariant === 'color' ? bgColor : `url(${bgImage ?? ''})`\n\n const Component = useMemo(() => component ?? 'a', [component])\n const isButton = Component === 'button'\n\n const { linkProps } = useLink(\n {\n ...props,\n isDisabled: disabled,\n elementType: typeof Component === 'string' ? Component : 'a',\n },\n ref,\n )\n\n const disabledProps = isButton\n ? { disabled, 'aria-disabled': ariaDisabled }\n : linkProps\n\n return (\n <Component\n {...props}\n {...disabledProps}\n ref={ref}\n className={className}\n data-state={status}\n data-bg-variant={bgVariant}\n data-size={hasTranslatedLabel ? 'M' : size}\n style={{ '--charcoal-tag-item-bg': bg }}\n >\n <div\n className=\"charcoal-tag-item__label\"\n data-has-translate={hasTranslatedLabel}\n >\n {hasTranslatedLabel && (\n <span className=\"charcoal-tag-item__label__translated\">\n {translatedLabel}\n </span>\n )}\n <span\n className=\"charcoal-tag-item__label__text\"\n data-has-translate={hasTranslatedLabel}\n >\n {label}\n </span>\n </div>\n {status === 'active' && <Icon name=\"16/Remove\" />}\n </Component>\n )\n },\n) as <T extends React.ElementType = 'a'>(p: TagItemProps<T>) => JSX.Element\n\nexport default memo(TagItem)\n"],"mappings":";;;;;;;;;;;;AA4BA,MAAM,gCACJ,SAAS,aACP,EACE,WACA,OACA,iBACA,UAAU,WACV,SACA,OAAO,KACP,SAAS,WACT,UACA,iBAAiB,cACjB,GAAG,SAEL,MACA;CACA,MAAM,gDAAmB,IAAI;CAE7B,MAAM,qBACJ,oBAAoB,UAAa,gBAAgB,SAAS;CAC5D,MAAM,YAAY,oCAChB,qBACA,yBACA,MAAM,SACR;CAEA,MAAM,YACJ,YAAY,UAAa,QAAQ,SAAS,IAAI,UAAU;CAC1D,MAAM,KAAK,cAAc,UAAU,UAAU,OAAO,WAAW,GAAE;CAEjE,MAAM,qCAA0B,aAAa,KAAK,CAAC,SAAS,CAAC;CAC7D,MAAM,WAAW,cAAc;CAE/B,MAAM,EAAE,sCACN;EACE,GAAG;EACH,YAAY;EACZ,aAAa,OAAO,cAAc,WAAW,YAAY;CAC3D,GACA,GACF;CAEA,MAAM,gBAAgB,WAClB;EAAE;EAAU,iBAAiB;CAAa,IAC1C;CAEJ,OACE,4CAAC,WAAD;EACE,GAAI;EACJ,GAAI;EACC;EACM;EACX,cAAY;EACZ,mBAAiB;EACjB,aAAW,qBAAqB,MAAM;EACtC,OAAO,EAAE,0BAA0B,GAAG;YARxC,CAUE,4CAAC,OAAD;GACE,WAAU;GACV,sBAAoB;aAFtB,CAIG,sBACC,2CAAC,QAAD;IAAM,WAAU;cACb;GACG,IAER,2CAAC,QAAD;IACE,WAAU;IACV,sBAAoB;cAEnB;GACG,EACH;MACJ,WAAW,YAAY,2CAAC,uBAAD,EAAM,MAAK,YAAW,EACrC;;AAEf,CACF;AAEA,sCAAoB,OAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"index2.js","names":["React","forwardRef","memo","useMemo","ForwardedRef","JSX","Icon","useClassNames","useObjectRef","useLink","SizeMap","S","M","TagItemProps","ElementType","label","translatedLabel","bgColor","bgImage","status","size","disabled","component","T","Omit","ComponentPropsWithRef","TagItem","HTMLAnchorElement","TagItemInner","ariaDisabled","props","_ref","ref","hasTranslatedLabel","undefined","length","className","bgVariant","bg","Component","isButton","linkProps","isDisabled","elementType","disabledProps","p","Element"],"sources":["../../../src/components/TagItem/index.tsx"],"sourcesContent":["import React, { forwardRef, memo, useMemo, ForwardedRef, type JSX } from 'react'\nimport Icon from '../Icon'\nimport { useClassNames } from '../../_lib/useClassNames'\nimport './index.css'\n\nimport { useObjectRef } from 'react-aria/useObjectRef'\nimport { useLink } from 'react-aria'\n\ntype SizeMap = {\n S: 32\n M: 40\n}\n\nexport type TagItemProps<T extends React.ElementType = 'a'> = {\n label: string\n translatedLabel?: string\n bgColor?: string\n bgImage?: string\n status?: 'default' | 'active' | 'inactive'\n size?: keyof SizeMap\n disabled?: boolean\n /**\n * The component used for root element.\n * @type T extends React.ElementType = 'a'\n */\n component?: T\n} & Omit<React.ComponentPropsWithRef<T>, 'children' | 'disabled'>\n\nconst TagItem = forwardRef<HTMLAnchorElement, TagItemProps>(\n function TagItemInner<T extends React.ElementType>(\n {\n component,\n label,\n translatedLabel,\n bgColor = '#7ACCB1',\n bgImage,\n size = 'M',\n status = 'default',\n disabled,\n 'aria-disabled': ariaDisabled,\n ...props\n }: TagItemProps<T>,\n _ref: ForwardedRef<HTMLAnchorElement>,\n ) {\n const ref = useObjectRef(_ref)\n\n const hasTranslatedLabel =\n translatedLabel !== undefined && translatedLabel.length > 0\n const className = useClassNames(\n 'charcoal-tag-item',\n 'charcoal-tag-item__bg',\n props.className,\n )\n\n const bgVariant =\n bgImage !== undefined && bgImage.length > 0 ? 'image' : 'color'\n const bg = bgVariant === 'color' ? bgColor : `url(${bgImage ?? ''})`\n\n const Component = useMemo(() => component ?? 'a', [component])\n const isButton = Component === 'button'\n\n const { linkProps } = useLink(\n {\n ...props,\n isDisabled: disabled,\n elementType: typeof Component === 'string' ? Component : 'a',\n },\n ref,\n )\n\n const disabledProps = isButton\n ? { disabled, 'aria-disabled': ariaDisabled }\n : linkProps\n\n return (\n <Component\n {...props}\n {...disabledProps}\n ref={ref}\n className={className}\n data-state={status}\n data-bg-variant={bgVariant}\n data-size={hasTranslatedLabel ? 'M' : size}\n style={{ '--charcoal-tag-item-bg': bg }}\n >\n <div\n className=\"charcoal-tag-item__label\"\n data-has-translate={hasTranslatedLabel}\n >\n {hasTranslatedLabel && (\n <span className=\"charcoal-tag-item__label__translated\">\n {translatedLabel}\n </span>\n )}\n <span\n className=\"charcoal-tag-item__label__text\"\n data-has-translate={hasTranslatedLabel}\n >\n {label}\n </span>\n </div>\n {status === 'active' && <Icon name=\"16/Remove\" />}\n </Component>\n )\n },\n) as <T extends React.ElementType = 'a'>(p: TagItemProps<T>) => JSX.Element\n\nexport default memo(TagItem)\n"],"mappings":";;;;;;;;;;AA4BA,MAAM0B,UAAUzB,WACd,SAAS2B,aACP,EACEN,WACAP,OACAC,iBACAC,UAAU,WACVC,SACAE,OAAO,KACPD,SAAS,WACTE,UACA,iBAAiBQ,cACjB,GAAGC,SAELC,MACA;CACA,MAAMC,MAAMxB,aAAauB,KAAK;CAE9B,MAAME,qBACJjB,oBAAoBkB,UAAalB,gBAAgBmB,SAAS;CAC5D,MAAMC,YAAY7B,cAChB,qBACA,yBACAuB,MAAMM,UACP;CAED,MAAMC,YACJnB,YAAYgB,UAAahB,QAAQiB,SAAS,IAAI,UAAU;CAC1D,MAAMG,KAAKD,cAAc,UAAUpB,UAAU,OAAOC,WAAW,GAAE;CAEjE,MAAMqB,YAAYpC,cAAcmB,aAAa,KAAK,CAACA,UAAU,CAAC;CAC9D,MAAMkB,WAAWD,cAAc;CAE/B,MAAM,EAAEE,cAAchC,QACpB;EACE,GAAGqB;EACHY,YAAYrB;EACZsB,aAAa,OAAOJ,cAAc,WAAWA,YAAY;EAC1D,EACDP,IACD;CAED,MAAMY,gBAAgBJ,WAClB;EAAEnB;EAAU,iBAAiBQ;EAAc,GAC3CY;CAEJ,OACE,qBAAC,WAAD;EACE,GAAIX;EACJ,GAAIc;EACCZ;EACMI;EACX,cAAYjB;EACZ,mBAAiBkB;EACjB,aAAWJ,qBAAqB,MAAMb;EACtC,OAAO,EAAE,0BAA0BkB,IAAI;YARzC,CAUE,qBAAC,OAAD;GACE,WAAU;GACV,sBAAoBL;aAFtB,CAIGA,sBACC,oBAAC,QAAD;IAAM,WAAU;cACbjB;IAEJ,GACD,oBAAC,QAAD;IACE,WAAU;IACV,sBAAoBiB;cAEnBlB;IACG,EACH;MACJI,WAAW,YAAY,oBAAC,MAAD,EAAM,MAAK,aAAc,EACvC;;EAGjB;AAED,sBAAejB,KAAKwB,QAAQ"}
1
+ {"version":3,"file":"index2.js","names":[],"sources":["../../../src/components/TagItem/index.tsx"],"sourcesContent":["import React, { forwardRef, memo, useMemo, ForwardedRef, type JSX } from 'react'\nimport Icon from '../Icon'\nimport { useClassNames } from '../../_lib/useClassNames'\nimport './index.css'\n\nimport { useObjectRef } from 'react-aria/useObjectRef'\nimport { useLink } from 'react-aria'\n\ntype SizeMap = {\n S: 32\n M: 40\n}\n\nexport type TagItemProps<T extends React.ElementType = 'a'> = {\n label: string\n translatedLabel?: string\n bgColor?: string\n bgImage?: string\n status?: 'default' | 'active' | 'inactive'\n size?: keyof SizeMap\n disabled?: boolean\n /**\n * The component used for root element.\n * @type T extends React.ElementType = 'a'\n */\n component?: T\n} & Omit<React.ComponentPropsWithRef<T>, 'children' | 'disabled'>\n\nconst TagItem = forwardRef<HTMLAnchorElement, TagItemProps>(\n function TagItemInner<T extends React.ElementType>(\n {\n component,\n label,\n translatedLabel,\n bgColor = '#7ACCB1',\n bgImage,\n size = 'M',\n status = 'default',\n disabled,\n 'aria-disabled': ariaDisabled,\n ...props\n }: TagItemProps<T>,\n _ref: ForwardedRef<HTMLAnchorElement>,\n ) {\n const ref = useObjectRef(_ref)\n\n const hasTranslatedLabel =\n translatedLabel !== undefined && translatedLabel.length > 0\n const className = useClassNames(\n 'charcoal-tag-item',\n 'charcoal-tag-item__bg',\n props.className,\n )\n\n const bgVariant =\n bgImage !== undefined && bgImage.length > 0 ? 'image' : 'color'\n const bg = bgVariant === 'color' ? bgColor : `url(${bgImage ?? ''})`\n\n const Component = useMemo(() => component ?? 'a', [component])\n const isButton = Component === 'button'\n\n const { linkProps } = useLink(\n {\n ...props,\n isDisabled: disabled,\n elementType: typeof Component === 'string' ? Component : 'a',\n },\n ref,\n )\n\n const disabledProps = isButton\n ? { disabled, 'aria-disabled': ariaDisabled }\n : linkProps\n\n return (\n <Component\n {...props}\n {...disabledProps}\n ref={ref}\n className={className}\n data-state={status}\n data-bg-variant={bgVariant}\n data-size={hasTranslatedLabel ? 'M' : size}\n style={{ '--charcoal-tag-item-bg': bg }}\n >\n <div\n className=\"charcoal-tag-item__label\"\n data-has-translate={hasTranslatedLabel}\n >\n {hasTranslatedLabel && (\n <span className=\"charcoal-tag-item__label__translated\">\n {translatedLabel}\n </span>\n )}\n <span\n className=\"charcoal-tag-item__label__text\"\n data-has-translate={hasTranslatedLabel}\n >\n {label}\n </span>\n </div>\n {status === 'active' && <Icon name=\"16/Remove\" />}\n </Component>\n )\n },\n) as <T extends React.ElementType = 'a'>(p: TagItemProps<T>) => JSX.Element\n\nexport default memo(TagItem)\n"],"mappings":";;;;;;;;;;AA4BA,MAAM,UAAU,WACd,SAAS,aACP,EACE,WACA,OACA,iBACA,UAAU,WACV,SACA,OAAO,KACP,SAAS,WACT,UACA,iBAAiB,cACjB,GAAG,SAEL,MACA;CACA,MAAM,MAAM,aAAa,IAAI;CAE7B,MAAM,qBACJ,oBAAoB,UAAa,gBAAgB,SAAS;CAC5D,MAAM,YAAY,cAChB,qBACA,yBACA,MAAM,SACR;CAEA,MAAM,YACJ,YAAY,UAAa,QAAQ,SAAS,IAAI,UAAU;CAC1D,MAAM,KAAK,cAAc,UAAU,UAAU,OAAO,WAAW,GAAE;CAEjE,MAAM,YAAY,cAAc,aAAa,KAAK,CAAC,SAAS,CAAC;CAC7D,MAAM,WAAW,cAAc;CAE/B,MAAM,EAAE,cAAc,QACpB;EACE,GAAG;EACH,YAAY;EACZ,aAAa,OAAO,cAAc,WAAW,YAAY;CAC3D,GACA,GACF;CAEA,MAAM,gBAAgB,WAClB;EAAE;EAAU,iBAAiB;CAAa,IAC1C;CAEJ,OACE,qBAAC,WAAD;EACE,GAAI;EACJ,GAAI;EACC;EACM;EACX,cAAY;EACZ,mBAAiB;EACjB,aAAW,qBAAqB,MAAM;EACtC,OAAO,EAAE,0BAA0B,GAAG;YARxC,CAUE,qBAAC,OAAD;GACE,WAAU;GACV,sBAAoB;aAFtB,CAIG,sBACC,oBAAC,QAAD;IAAM,WAAU;cACb;GACG,IAER,oBAAC,QAAD;IACE,WAAU;IACV,sBAAoB;cAEnB;GACG,EACH;MACJ,WAAW,YAAY,oBAAC,MAAD,EAAM,MAAK,YAAW,EACrC;;AAEf,CACF;AAEA,sBAAe,KAAK,OAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/TextArea/index.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAmBpB;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC;;OAEG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC;;OAEG;IACH,IAAI,EAAE,MAAM,IAAI,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAClC,aAAa,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAA;IAEnD,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,OAAO,CAAC,EAAE,OAAO,CAAA;IAEjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAA;IAEpB,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;CACrC,GAAG,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,UAAU,CAAC,EAAE,UAAU,CAAC,CAAA;AAEhE,QAAA,MAAM,QAAQ;YApBJ,MAAM;eACH,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI;oBAClB,KAAK,CAAC,GAAG,CAAC,wBAAwB,CAAC;gBAEvC,OAAO;gBACP,OAAO;oBACH,MAAM;cACZ,OAAO;YAET,MAAM;mBACC,MAAM;eACV,OAAO;eACP,KAAK,CAAC,SAAS;iBACb,OAAO;cAEV,MAAM;eAEL,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM;4MA8LrC,CAAA;AAED,eAAe,QAAQ,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/TextArea/index.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAmBpB;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC;;OAEG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC;;OAEG;IACH,IAAI,EAAE,MAAM,IAAI,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAClC,aAAa,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAA;IAEnD,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,OAAO,CAAC,EAAE,OAAO,CAAA;IAEjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAA;IAEpB,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;CACrC,GAAG,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,UAAU,CAAC,EAAE,UAAU,CAAC,CAAA;AAEhE,QAAA,MAAM,QAAQ;YApBJ,MAAM;eACH,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI;oBAClB,KAAK,CAAC,GAAG,CAAC,wBAAwB,CAAC;gBAEvC,OAAO;gBACP,OAAO;oBACH,MAAM;cACZ,OAAO;YAET,MAAM;mBACC,MAAM;eACV,OAAO;eACP,KAAK,CAAC,SAAS;iBACb,OAAO;cAEV,MAAM;eAEL,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM;4MA8LrC,CAAA;eAEc,QAAQ"}
@@ -1,5 +1,4 @@
1
1
  "use client";
2
- const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
2
  const require_useClassNames = require('../../_lib/useClassNames.cjs');
4
3
  const require_index = require('../FieldLabel/index2.cjs');
5
4
  const require_index$1 = require('../../_lib/index.cjs');