@ntbjs/react-components 2.0.14 → 3.0.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (344) hide show
  1. package/README.md +34 -0
  2. package/build/data/Alert/Alert.js +18 -33
  3. package/build/data/Alert/Alert.js.map +1 -1
  4. package/build/data/Alert/Alert.styled.js +9 -47
  5. package/build/data/Alert/Alert.styled.js.map +1 -1
  6. package/build/data/Badge/Badge.js +36 -61
  7. package/build/data/Badge/Badge.js.map +1 -1
  8. package/build/data/Badge/Badge.styled.js +21 -70
  9. package/build/data/Badge/Badge.styled.js.map +1 -1
  10. package/build/data/Popover/Popover.js +125 -71
  11. package/build/data/Popover/Popover.js.map +1 -1
  12. package/build/data/Popover/Popover.styled.js +10 -140
  13. package/build/data/Popover/Popover.styled.js.map +1 -1
  14. package/build/data/SeverityBadge/SeverityBadge.js +13 -22
  15. package/build/data/SeverityBadge/SeverityBadge.js.map +1 -1
  16. package/build/data/SeverityBadge/index.js +2 -0
  17. package/build/data/SeverityBadge/index.js.map +1 -0
  18. package/build/data/Tab/Tab.js +7 -13
  19. package/build/data/Tab/Tab.js.map +1 -1
  20. package/build/data/Tab/Tab.styled.js +4 -7
  21. package/build/data/Tab/Tab.styled.js.map +1 -1
  22. package/build/data/Tabs/Tabs.js +30 -32
  23. package/build/data/Tabs/Tabs.js.map +1 -1
  24. package/build/data/Tabs/Tabs.styled.js +21 -57
  25. package/build/data/Tabs/Tabs.styled.js.map +1 -1
  26. package/build/data/Tooltip/Tooltip.js +102 -33
  27. package/build/data/Tooltip/Tooltip.js.map +1 -1
  28. package/build/data/Tooltip/Tooltip.styled.js +9 -22
  29. package/build/data/Tooltip/Tooltip.styled.js.map +1 -1
  30. package/build/data/VerificationStatusIcon/VerificationStatusIcon.js +16 -23
  31. package/build/data/VerificationStatusIcon/VerificationStatusIcon.js.map +1 -1
  32. package/build/data/VerificationStatusIcon/VerificationStatusIcon.styled.js +13 -31
  33. package/build/data/VerificationStatusIcon/VerificationStatusIcon.styled.js.map +1 -1
  34. package/build/data/VerificationStatusIcon/index.js +2 -0
  35. package/build/data/VerificationStatusIcon/index.js.map +1 -0
  36. package/build/data/_shared/FloatingArrow.styled.js +30 -0
  37. package/build/data/_shared/FloatingArrow.styled.js.map +1 -0
  38. package/build/hooks/useEventListner.js.map +1 -1
  39. package/build/hooks/useFloatingPopover.js +187 -0
  40. package/build/hooks/useFloatingPopover.js.map +1 -0
  41. package/build/hooks/useIsomorphicLayoutEffect.js.map +1 -1
  42. package/build/hooks/useOnClickOutside.js.map +1 -1
  43. package/build/hooks/useTooltipAutoShow.js.map +1 -1
  44. package/build/icons/arrow-back.svg.js +3 -3
  45. package/build/icons/arrow-back.svg.js.map +1 -1
  46. package/build/icons/arrow-forward.svg.js +4 -4
  47. package/build/icons/arrow-forward.svg.js.map +1 -1
  48. package/build/icons/check-rectangle-filled.svg.js +3 -3
  49. package/build/icons/check-rectangle-filled.svg.js.map +1 -1
  50. package/build/icons/close.svg.js +3 -3
  51. package/build/icons/close.svg.js.map +1 -1
  52. package/build/icons/edit-note.svg.js +3 -3
  53. package/build/icons/edit-note.svg.js.map +1 -1
  54. package/build/icons/expand-more.svg.js +3 -3
  55. package/build/icons/expand-more.svg.js.map +1 -1
  56. package/build/icons/headset.svg.js +3 -3
  57. package/build/icons/headset.svg.js.map +1 -1
  58. package/build/icons/layers.svg.js +3 -3
  59. package/build/icons/layers.svg.js.map +1 -1
  60. package/build/icons/link.svg.js +3 -3
  61. package/build/icons/link.svg.js.map +1 -1
  62. package/build/icons/play.svg.js +3 -3
  63. package/build/icons/play.svg.js.map +1 -1
  64. package/build/icons/search.svg.js +3 -3
  65. package/build/icons/search.svg.js.map +1 -1
  66. package/build/icons/star-filled.svg.js +3 -3
  67. package/build/icons/star-filled.svg.js.map +1 -1
  68. package/build/icons/star.svg.js +3 -3
  69. package/build/icons/star.svg.js.map +1 -1
  70. package/build/icons/triangle-right.svg.js +3 -3
  71. package/build/icons/triangle-right.svg.js.map +1 -1
  72. package/build/icons/verification.svg.js +3 -3
  73. package/build/icons/verification.svg.js.map +1 -1
  74. package/build/icons/warning-circle.svg.js +3 -3
  75. package/build/icons/warning-circle.svg.js.map +1 -1
  76. package/build/inputs/ActionButton/ActionButton.js +11 -22
  77. package/build/inputs/ActionButton/ActionButton.js.map +1 -1
  78. package/build/inputs/ActionButton/ActionButton.styled.js +5 -54
  79. package/build/inputs/ActionButton/ActionButton.styled.js.map +1 -1
  80. package/build/inputs/Button/Button.js +125 -121
  81. package/build/inputs/Button/Button.js.map +1 -1
  82. package/build/inputs/Button/Button.styled.js +42 -260
  83. package/build/inputs/Button/Button.styled.js.map +1 -1
  84. package/build/inputs/Checkbox/Checkbox.js +45 -61
  85. package/build/inputs/Checkbox/Checkbox.js.map +1 -1
  86. package/build/inputs/Checkbox/Checkbox.styled.js +24 -153
  87. package/build/inputs/Checkbox/Checkbox.styled.js.map +1 -1
  88. package/build/inputs/CompactAutocompleteSelect/CompactAutocompleteSelect.js +106 -111
  89. package/build/inputs/CompactAutocompleteSelect/CompactAutocompleteSelect.js.map +1 -1
  90. package/build/inputs/CompactAutocompleteSelect/CompactAutocompleteSelect.styled.js +88 -273
  91. package/build/inputs/CompactAutocompleteSelect/CompactAutocompleteSelect.styled.js.map +1 -1
  92. package/build/inputs/CompactStarRating/CompactStarRating.js +56 -77
  93. package/build/inputs/CompactStarRating/CompactStarRating.js.map +1 -1
  94. package/build/inputs/CompactStarRating/CompactStarRating.styled.js +32 -211
  95. package/build/inputs/CompactStarRating/CompactStarRating.styled.js.map +1 -1
  96. package/build/inputs/CompactTextInput/CompactTextInput.js +86 -105
  97. package/build/inputs/CompactTextInput/CompactTextInput.js.map +1 -1
  98. package/build/inputs/CompactTextInput/CompactTextInput.styled.js +55 -258
  99. package/build/inputs/CompactTextInput/CompactTextInput.styled.js.map +1 -1
  100. package/build/inputs/MultiLevelCheckbox/MultiLevelCheckbox.js +70 -77
  101. package/build/inputs/MultiLevelCheckbox/MultiLevelCheckbox.js.map +1 -1
  102. package/build/inputs/MultiLevelCheckbox/MultiLevelCheckbox.styled.js +28 -60
  103. package/build/inputs/MultiLevelCheckbox/MultiLevelCheckbox.styled.js.map +1 -1
  104. package/build/inputs/MultiLevelCheckbox/types.js +12 -12
  105. package/build/inputs/MultiLevelCheckbox/types.js.map +1 -1
  106. package/build/inputs/MultiLevelCheckboxSelect/MultiLevelCheckboxSelect.js +69 -73
  107. package/build/inputs/MultiLevelCheckboxSelect/MultiLevelCheckboxSelect.js.map +1 -1
  108. package/build/inputs/MultiLevelCheckboxSelect/MultiLevelCheckboxSelect.styled.js +44 -87
  109. package/build/inputs/MultiLevelCheckboxSelect/MultiLevelCheckboxSelect.styled.js.map +1 -1
  110. package/build/inputs/MultiSelect/MultiSelect.js +69 -79
  111. package/build/inputs/MultiSelect/MultiSelect.js.map +1 -1
  112. package/build/inputs/MultiSelect/MultiSelect.styled.js +70 -76
  113. package/build/inputs/MultiSelect/MultiSelect.styled.js.map +1 -1
  114. package/build/inputs/Radio/Radio.js +20 -33
  115. package/build/inputs/Radio/Radio.js.map +1 -1
  116. package/build/inputs/Radio/Radio.styled.js +15 -96
  117. package/build/inputs/Radio/Radio.styled.js.map +1 -1
  118. package/build/inputs/Switch/Switch.js +28 -40
  119. package/build/inputs/Switch/Switch.js.map +1 -1
  120. package/build/inputs/Switch/Switch.styled.js +24 -94
  121. package/build/inputs/Switch/Switch.styled.js.map +1 -1
  122. package/build/inputs/TextArea/TextArea.js +98 -123
  123. package/build/inputs/TextArea/TextArea.js.map +1 -1
  124. package/build/inputs/TextArea/TextArea.styled.js +64 -379
  125. package/build/inputs/TextArea/TextArea.styled.js.map +1 -1
  126. package/build/inputs/TextInput/TextInput.js +59 -79
  127. package/build/inputs/TextInput/TextInput.js.map +1 -1
  128. package/build/inputs/TextInput/TextInput.styled.js +33 -224
  129. package/build/inputs/TextInput/TextInput.styled.js.map +1 -1
  130. package/build/layout/InputGroup/InputGroup.js +6 -9
  131. package/build/layout/InputGroup/InputGroup.js.map +1 -1
  132. package/build/layout/InputGroup/InputGroup.styled.js +4 -3
  133. package/build/layout/InputGroup/InputGroup.styled.js.map +1 -1
  134. package/build/layout/InputGroup/index.js +2 -0
  135. package/build/layout/InputGroup/index.js.map +1 -0
  136. package/build/layout/SectionSeparator/SectionSeparator.js +5 -9
  137. package/build/layout/SectionSeparator/SectionSeparator.js.map +1 -1
  138. package/build/layout/SectionSeparator/SectionSeparator.styled.js +4 -8
  139. package/build/layout/SectionSeparator/SectionSeparator.styled.js.map +1 -1
  140. package/build/styles/utils/colors-export.d.ts +54 -0
  141. package/build/styles/utils/colors-export.js.map +1 -1
  142. package/build/utils/dateTime.js.map +1 -1
  143. package/build/utils/defaultTheme.js +14 -28
  144. package/build/utils/defaultTheme.js.map +1 -1
  145. package/build/utils/getElementRef.js +14 -0
  146. package/build/utils/getElementRef.js.map +1 -0
  147. package/build/utils/parseTrigger.js +16 -0
  148. package/build/utils/parseTrigger.js.map +1 -0
  149. package/build/widgets/AssetAction/AssetAction.js +26 -33
  150. package/build/widgets/AssetAction/AssetAction.js.map +1 -1
  151. package/build/widgets/AssetAction/AssetAction.styled.js +20 -34
  152. package/build/widgets/AssetAction/AssetAction.styled.js.map +1 -1
  153. package/build/widgets/AssetActionsBase/AssetActionsBase.js +8 -13
  154. package/build/widgets/AssetActionsBase/AssetActionsBase.js.map +1 -1
  155. package/build/widgets/AssetActionsBase/AssetActionsBase.styled.js +4 -9
  156. package/build/widgets/AssetActionsBase/AssetActionsBase.styled.js.map +1 -1
  157. package/build/widgets/AssetGallery/AssetGallery.js +15 -40
  158. package/build/widgets/AssetGallery/AssetGallery.js.map +1 -1
  159. package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryBase.js +55 -70
  160. package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryBase.js.map +1 -1
  161. package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryBase.styled.js +12 -24
  162. package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryBase.styled.js.map +1 -1
  163. package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.js +146 -122
  164. package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.js.map +1 -1
  165. package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.styled.js +99 -286
  166. package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.styled.js.map +1 -1
  167. package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryGridCard/AssetGalleryGridCard.js +170 -125
  168. package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryGridCard/AssetGalleryGridCard.js.map +1 -1
  169. package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryGridCard/AssetGalleryGridCard.styled.js +135 -364
  170. package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryGridCard/AssetGalleryGridCard.styled.js.map +1 -1
  171. package/build/widgets/AssetPreview/AssetPreviewTopBar/AssetPreviewTopBar.js +20 -21
  172. package/build/widgets/AssetPreview/AssetPreviewTopBar/AssetPreviewTopBar.js.map +1 -1
  173. package/build/widgets/AssetPreview/AssetPreviewTopBar/AssetPreviewTopBar.styled.js +20 -71
  174. package/build/widgets/AssetPreview/AssetPreviewTopBar/AssetPreviewTopBar.styled.js.map +1 -1
  175. package/build/widgets/ContextMenu/ContextMenu.js +12 -11
  176. package/build/widgets/ContextMenu/ContextMenu.js.map +1 -1
  177. package/build/widgets/ContextMenu/ContextMenu.styled.js +4 -4
  178. package/build/widgets/ContextMenu/ContextMenu.styled.js.map +1 -1
  179. package/build/widgets/ContextMenu/ContextMenuItem/ContextMenuItem.js +17 -25
  180. package/build/widgets/ContextMenu/ContextMenuItem/ContextMenuItem.js.map +1 -1
  181. package/build/widgets/ContextMenu/ContextMenuItem/ContextMenuItem.styled.js +16 -71
  182. package/build/widgets/ContextMenu/ContextMenuItem/ContextMenuItem.styled.js.map +1 -1
  183. package/build/widgets/ContextMenu/ContextMenuItemsGroup/ContextMenuItemsGroup.js +7 -11
  184. package/build/widgets/ContextMenu/ContextMenuItemsGroup/ContextMenuItemsGroup.js.map +1 -1
  185. package/build/widgets/ContextMenu/ContextMenuItemsGroup/ContextMenuItemsGroup.styled.js +4 -11
  186. package/build/widgets/ContextMenu/ContextMenuItemsGroup/ContextMenuItemsGroup.styled.js.map +1 -1
  187. package/build/widgets/InfoCard/InfoCard.js +26 -21
  188. package/build/widgets/InfoCard/InfoCard.js.map +1 -1
  189. package/build/widgets/InfoCard/InfoCard.styled.js +36 -84
  190. package/build/widgets/InfoCard/InfoCard.styled.js.map +1 -1
  191. package/build/widgets/InstructionSeverityDisplay/InstructionSeverityDisplay.js +28 -34
  192. package/build/widgets/InstructionSeverityDisplay/InstructionSeverityDisplay.js.map +1 -1
  193. package/build/widgets/InstructionSeverityDisplay/InstructionSeverityDisplay.styled.js +21 -57
  194. package/build/widgets/InstructionSeverityDisplay/InstructionSeverityDisplay.styled.js.map +1 -1
  195. package/build/widgets/InstructionSeverityDisplay/index.js +2 -0
  196. package/build/widgets/InstructionSeverityDisplay/index.js.map +1 -0
  197. package/build/widgets/Instructions/Instructions.js +53 -95
  198. package/build/widgets/Instructions/Instructions.js.map +1 -1
  199. package/build/widgets/Instructions/Instructions.styled.js +27 -26
  200. package/build/widgets/Instructions/Instructions.styled.js.map +1 -1
  201. package/build/widgets/ProgressBar/ProgressBar.js +39 -37
  202. package/build/widgets/ProgressBar/ProgressBar.js.map +1 -1
  203. package/build/widgets/ProgressBar/ProgressBar.styled.js +56 -125
  204. package/build/widgets/ProgressBar/ProgressBar.styled.js.map +1 -1
  205. package/build/widgets/SummaryCard/SummaryCard.js +55 -64
  206. package/build/widgets/SummaryCard/SummaryCard.js.map +1 -1
  207. package/build/widgets/SummaryCard/SummaryCard.styled.js +51 -106
  208. package/build/widgets/SummaryCard/SummaryCard.styled.js.map +1 -1
  209. package/package.json +84 -36
  210. package/styles/utils/colors-export.d.ts +54 -0
  211. package/types/components/data/Alert/Alert.d.ts +76 -0
  212. package/types/components/data/Alert/Alert.styled.d.ts +52 -0
  213. package/types/components/data/Alert/index.d.ts +1 -0
  214. package/types/components/data/Badge/Badge.d.ts +120 -0
  215. package/types/components/data/Badge/Badge.styled.d.ts +33 -0
  216. package/types/components/data/Badge/index.d.ts +1 -0
  217. package/types/components/data/Popover/Popover.d.ts +116 -0
  218. package/types/components/data/Popover/Popover.styled.d.ts +15 -0
  219. package/types/components/data/Popover/index.d.ts +1 -0
  220. package/types/components/data/SeverityBadge/SeverityBadge.d.ts +72 -0
  221. package/types/components/data/SeverityBadge/index.d.ts +1 -0
  222. package/types/components/data/Tab/Tab.d.ts +14 -0
  223. package/types/components/data/Tab/Tab.styled.d.ts +1 -0
  224. package/types/components/data/Tab/index.d.ts +1 -0
  225. package/types/components/data/Tabs/Tabs.d.ts +111 -0
  226. package/types/components/data/Tabs/Tabs.styled.d.ts +26 -0
  227. package/types/components/data/Tabs/index.d.ts +1 -0
  228. package/types/components/data/Tooltip/Tooltip.d.ts +88 -0
  229. package/types/components/data/Tooltip/Tooltip.styled.d.ts +8 -0
  230. package/types/components/data/Tooltip/index.d.ts +1 -0
  231. package/types/components/data/VerificationStatusIcon/VerificationStatusIcon.d.ts +35 -0
  232. package/types/components/data/VerificationStatusIcon/VerificationStatusIcon.styled.d.ts +27 -0
  233. package/types/components/data/VerificationStatusIcon/index.d.ts +1 -0
  234. package/types/components/data/_shared/FloatingArrow.styled.d.ts +29 -0
  235. package/types/components/data/index.d.ts +8 -0
  236. package/types/components/index.d.ts +3 -0
  237. package/types/components/inputs/ActionButton/ActionButton.d.ts +55 -0
  238. package/types/components/inputs/ActionButton/ActionButton.styled.d.ts +16 -0
  239. package/types/components/inputs/ActionButton/index.d.ts +1 -0
  240. package/types/components/inputs/Button/Button.d.ts +82 -0
  241. package/types/components/inputs/Button/Button.styled.d.ts +60 -0
  242. package/types/components/inputs/Button/index.d.ts +1 -0
  243. package/types/components/inputs/Checkbox/Checkbox.d.ts +83 -0
  244. package/types/components/inputs/Checkbox/Checkbox.styled.d.ts +29 -0
  245. package/types/components/inputs/Checkbox/index.d.ts +1 -0
  246. package/types/components/inputs/CompactAutocompleteSelect/CompactAutocompleteSelect.d.ts +242 -0
  247. package/types/components/inputs/CompactAutocompleteSelect/CompactAutocompleteSelect.styled.d.ts +104 -0
  248. package/types/components/inputs/CompactAutocompleteSelect/index.d.ts +1 -0
  249. package/types/components/inputs/CompactStarRating/CompactStarRating.d.ts +96 -0
  250. package/types/components/inputs/CompactStarRating/CompactStarRating.styled.d.ts +34 -0
  251. package/types/components/inputs/CompactStarRating/index.d.ts +1 -0
  252. package/types/components/inputs/CompactTextInput/CompactTextInput.d.ts +116 -0
  253. package/types/components/inputs/CompactTextInput/CompactTextInput.styled.d.ts +42 -0
  254. package/types/components/inputs/CompactTextInput/index.d.ts +1 -0
  255. package/types/components/inputs/MultiLevelCheckbox/MultiLevelCheckbox.d.ts +41 -0
  256. package/types/components/inputs/MultiLevelCheckbox/MultiLevelCheckbox.styled.d.ts +13 -0
  257. package/types/components/inputs/MultiLevelCheckbox/index.d.ts +2 -0
  258. package/types/components/inputs/MultiLevelCheckbox/types.d.ts +29 -0
  259. package/types/components/inputs/MultiLevelCheckboxSelect/MultiLevelCheckboxSelect.d.ts +44 -0
  260. package/types/components/inputs/MultiLevelCheckboxSelect/MultiLevelCheckboxSelect.styled.d.ts +11 -0
  261. package/types/components/inputs/MultiLevelCheckboxSelect/index.d.ts +1 -0
  262. package/types/components/inputs/MultiSelect/MultiSelect.d.ts +115 -0
  263. package/types/components/inputs/MultiSelect/MultiSelect.styled.d.ts +34 -0
  264. package/types/components/inputs/MultiSelect/index.d.ts +1 -0
  265. package/types/components/inputs/Radio/Radio.d.ts +65 -0
  266. package/types/components/inputs/Radio/Radio.styled.d.ts +11 -0
  267. package/types/components/inputs/Radio/index.d.ts +1 -0
  268. package/types/components/inputs/Switch/Switch.d.ts +62 -0
  269. package/types/components/inputs/Switch/Switch.styled.d.ts +16 -0
  270. package/types/components/inputs/Switch/index.d.ts +1 -0
  271. package/types/components/inputs/TextArea/TextArea.d.ts +120 -0
  272. package/types/components/inputs/TextArea/TextArea.styled.d.ts +93 -0
  273. package/types/components/inputs/TextArea/index.d.ts +1 -0
  274. package/types/components/inputs/TextInput/TextInput.d.ts +109 -0
  275. package/types/components/inputs/TextInput/TextInput.styled.d.ts +43 -0
  276. package/types/components/inputs/TextInput/index.d.ts +1 -0
  277. package/types/components/inputs/index.d.ts +13 -0
  278. package/types/components/layout/InputGroup/InputGroup.d.ts +31 -0
  279. package/types/components/layout/InputGroup/InputGroup.styled.d.ts +1 -0
  280. package/types/components/layout/InputGroup/index.d.ts +1 -0
  281. package/types/components/layout/SectionSeparator/SectionSeparator.d.ts +28 -0
  282. package/types/components/layout/SectionSeparator/SectionSeparator.styled.d.ts +7 -0
  283. package/types/components/layout/SectionSeparator/index.d.ts +1 -0
  284. package/types/components/layout/index.d.ts +2 -0
  285. package/types/components/widgets/AssetAction/AssetAction.d.ts +16 -0
  286. package/types/components/widgets/AssetAction/AssetAction.styled.d.ts +15 -0
  287. package/types/components/widgets/AssetAction/index.d.ts +1 -0
  288. package/types/components/widgets/AssetActionsBase/AssetActionsBase.d.ts +25 -0
  289. package/types/components/widgets/AssetActionsBase/AssetActionsBase.styled.d.ts +1 -0
  290. package/types/components/widgets/AssetActionsBase/index.d.ts +1 -0
  291. package/types/components/widgets/AssetGallery/AssetGallery.d.ts +170 -0
  292. package/types/components/widgets/AssetGallery/AssetGalleryBase/AssetGalleryBase.d.ts +76 -0
  293. package/types/components/widgets/AssetGallery/AssetGalleryBase/AssetGalleryBase.styled.d.ts +3 -0
  294. package/types/components/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.d.ts +3 -0
  295. package/types/components/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.styled.d.ts +52 -0
  296. package/types/components/widgets/AssetGallery/AssetGalleryBase/AssetGalleryGridCard/AssetGalleryGridCard.d.ts +2 -0
  297. package/types/components/widgets/AssetGallery/AssetGalleryBase/AssetGalleryGridCard/AssetGalleryGridCard.styled.d.ts +49 -0
  298. package/types/components/widgets/AssetGallery/asset.types.d.ts +329 -0
  299. package/types/components/widgets/AssetGallery/index.d.ts +1 -0
  300. package/types/components/widgets/AssetPreview/AssetPreviewTopBar/AssetPreviewTopBar.d.ts +60 -0
  301. package/types/components/widgets/AssetPreview/AssetPreviewTopBar/AssetPreviewTopBar.styled.d.ts +21 -0
  302. package/types/components/widgets/AssetPreview/AssetPreviewTopBar/index.d.ts +1 -0
  303. package/types/components/widgets/ContextMenu/ContextMenu.d.ts +118 -0
  304. package/types/components/widgets/ContextMenu/ContextMenu.styled.d.ts +1 -0
  305. package/types/components/widgets/ContextMenu/ContextMenuItem/ContextMenuItem.d.ts +45 -0
  306. package/types/components/widgets/ContextMenu/ContextMenuItem/ContextMenuItem.styled.d.ts +18 -0
  307. package/types/components/widgets/ContextMenu/ContextMenuItem/index.d.ts +1 -0
  308. package/types/components/widgets/ContextMenu/ContextMenuItemsGroup/ContextMenuItemsGroup.d.ts +23 -0
  309. package/types/components/widgets/ContextMenu/ContextMenuItemsGroup/ContextMenuItemsGroup.styled.d.ts +1 -0
  310. package/types/components/widgets/ContextMenu/ContextMenuItemsGroup/index.d.ts +1 -0
  311. package/types/components/widgets/ContextMenu/index.d.ts +1 -0
  312. package/types/components/widgets/InfoCard/InfoCard.d.ts +33 -0
  313. package/types/components/widgets/InfoCard/InfoCard.styled.d.ts +28 -0
  314. package/types/components/widgets/InfoCard/index.d.ts +1 -0
  315. package/types/components/widgets/InstructionSeverityDisplay/InstructionSeverityDisplay.d.ts +46 -0
  316. package/types/components/widgets/InstructionSeverityDisplay/InstructionSeverityDisplay.styled.d.ts +30 -0
  317. package/types/components/widgets/InstructionSeverityDisplay/index.d.ts +1 -0
  318. package/types/components/widgets/Instructions/Instructions.d.ts +156 -0
  319. package/types/components/widgets/Instructions/Instructions.styled.d.ts +14 -0
  320. package/types/components/widgets/Instructions/index.d.ts +1 -0
  321. package/types/components/widgets/ProgressBar/ProgressBar.d.ts +30 -0
  322. package/types/components/widgets/ProgressBar/ProgressBar.styled.d.ts +41 -0
  323. package/types/components/widgets/ProgressBar/index.d.ts +1 -0
  324. package/types/components/widgets/SummaryCard/SummaryCard.d.ts +83 -0
  325. package/types/components/widgets/SummaryCard/SummaryCard.styled.d.ts +29 -0
  326. package/types/components/widgets/SummaryCard/index.d.ts +1 -0
  327. package/types/components/widgets/index.d.ts +11 -0
  328. package/types/hooks/useElementSize.d.ts +14 -0
  329. package/types/hooks/useEventListner.d.ts +14 -0
  330. package/types/hooks/useFloatingPopover.d.ts +161 -0
  331. package/types/hooks/useIsomorphicLayoutEffect.d.ts +3 -0
  332. package/types/hooks/useOnClickOutside.d.ts +13 -0
  333. package/types/hooks/useTooltipAutoShow.d.ts +31 -0
  334. package/types/icons/index.d.ts +41 -0
  335. package/types/ssr/index.d.ts +1 -0
  336. package/types/styles/utils/colors-export.d.ts +54 -0
  337. package/types/utils/dateTime.d.ts +8 -0
  338. package/types/utils/defaultTheme.d.ts +95 -0
  339. package/types/utils/getElementRef.d.ts +2 -0
  340. package/types/utils/parseTrigger.d.ts +22 -0
  341. package/build/_virtual/_rollupPluginBabelHelpers.js +0 -12
  342. package/build/_virtual/_rollupPluginBabelHelpers.js.map +0 -1
  343. package/build/widgets/AssetGallery/asset.propType.js +0 -56
  344. package/build/widgets/AssetGallery/asset.propType.js.map +0 -1
@@ -1,15 +1,14 @@
1
- import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
2
1
  import React__default, { useMemo } from 'react';
3
2
  import { nanoid } from 'nanoid';
4
- import PropTypes from 'prop-types';
5
3
  import { Radio as Radio$1, RadioLabel } from './Radio.styled.js';
4
+ import { jsxs, jsx } from 'react/jsx-runtime';
6
5
 
7
6
  const Radio = React__default.forwardRef(function Radio({
8
7
  name,
9
8
  value,
10
9
  checked,
11
10
  defaultChecked,
12
- disabled,
11
+ disabled = false,
13
12
  readOnly,
14
13
  label,
15
14
  className,
@@ -28,42 +27,30 @@ const Radio = React__default.forwardRef(function Radio({
28
27
  onChange(e);
29
28
  }
30
29
  };
31
- return React__default.createElement(Radio$1, {
30
+ return jsxs(Radio$1, {
32
31
  htmlFor: uniqueId,
33
32
  disabled: disabled,
34
33
  readOnly: readOnly,
35
34
  $isChecked: checked,
36
35
  className: className,
37
- style: style
38
- }, React__default.createElement("input", _extends({
39
- ref: forwardedRef,
40
- type: "radio",
41
- name: name,
42
- value: value,
43
- checked: checked,
44
- defaultChecked: defaultChecked,
45
- disabled: disabled,
46
- id: uniqueId,
47
- onChange: handleChange,
48
- onBlur: onBlur
49
- }, rest)), React__default.createElement(RadioLabel, null, label));
36
+ style: style,
37
+ children: [jsx("input", {
38
+ ref: forwardedRef,
39
+ type: "radio",
40
+ name: name,
41
+ value: value,
42
+ checked: checked,
43
+ defaultChecked: defaultChecked,
44
+ disabled: disabled,
45
+ id: uniqueId,
46
+ onChange: handleChange,
47
+ onBlur: onBlur,
48
+ ...rest
49
+ }), jsx(RadioLabel, {
50
+ children: label
51
+ })]
52
+ });
50
53
  });
51
- Radio.propTypes = process.env.NODE_ENV !== "production" ? {
52
- label: PropTypes.any,
53
- name: PropTypes.string.isRequired,
54
- value: PropTypes.any.isRequired,
55
- checked: PropTypes.bool,
56
- defaultChecked: PropTypes.bool,
57
- disabled: PropTypes.bool,
58
- readOnly: PropTypes.bool,
59
- className: PropTypes.string,
60
- style: PropTypes.object,
61
- onChange: PropTypes.func,
62
- onBlur: PropTypes.func
63
- } : {};
64
- Radio.defaultProps = {
65
- disabled: false
66
- };
67
54
 
68
55
  export { Radio as default };
69
56
  //# sourceMappingURL=Radio.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Radio.js","sources":["../../../src/components/inputs/Radio/Radio.js"],"sourcesContent":["import React, { useMemo } from 'react';\n\nimport { nanoid } from 'nanoid';\nimport PropTypes from 'prop-types';\n\nimport * as S from './Radio.styled';\n\n/**\n * Radio buttons allow the user to select one option from a set.\n *\n * Use radio buttons when the user needs to see all available options. If available options can be\n * collapsed, consider using a dropdown menu because it uses less space.\n *\n * Radio buttons should have the most commonly used option selected by default.\n *\n * ### Import\n *\n * ``` js\n * import { Radio } from '@ntbjs/react-components/inputs'\n * // or\n * import Radio from '@ntbjs/react-components/inputs/Radio'\n * ```\n */\nconst Radio = React.forwardRef(function Radio(\n {\n name,\n value,\n checked,\n defaultChecked,\n disabled,\n readOnly,\n label,\n className,\n style,\n onChange,\n onBlur,\n ...rest\n },\n forwardedRef\n) {\n const uniqueId = useMemo(() => nanoid(), []);\n\n const handleChange = e => {\n // Prevent onChange when readOnly\n if (readOnly) {\n e.preventDefault();\n return;\n }\n if (onChange) {\n onChange(e);\n }\n };\n\n return (\n <S.Radio\n htmlFor={uniqueId}\n disabled={disabled}\n readOnly={readOnly}\n $isChecked={checked}\n className={className}\n style={style}\n >\n <input\n ref={forwardedRef}\n type=\"radio\"\n name={name}\n value={value}\n checked={checked}\n defaultChecked={defaultChecked}\n disabled={disabled}\n id={uniqueId}\n onChange={handleChange}\n onBlur={onBlur}\n {...rest}\n />\n <S.RadioLabel>{label}</S.RadioLabel>\n </S.Radio>\n );\n});\n\nRadio.propTypes = {\n /**\n * Text displayed by the radio button\n */\n label: PropTypes.any,\n\n /**\n * Name of the radio button (used when sending form data)\n */\n name: PropTypes.string.isRequired,\n\n /**\n * Value to be sent when the given radio button is selected\n */\n value: PropTypes.any.isRequired,\n\n /**\n * Whether the radio button is checked\n */\n checked: PropTypes.bool,\n\n /**\n * Whether the radio button is checked by default. The most commonly used option should have this set to `true`.\n */\n defaultChecked: PropTypes.bool,\n\n /**\n * Whether the radio button is disabled\n */\n disabled: PropTypes.bool,\n\n /**\n * Display the radio button as read-only\n */\n readOnly: PropTypes.bool,\n\n /**\n * Custom class names for the HTML element\n */\n className: PropTypes.string,\n\n /**\n * Custom inline CSS styling\n */\n style: PropTypes.object,\n\n /**\n * Optional callback function for the `onChange` event\n */\n onChange: PropTypes.func,\n\n /**\n * Optional callback function for the `onBlur` event\n */\n onBlur: PropTypes.func\n};\n\nRadio.defaultProps = {\n disabled: false\n};\n\nexport default Radio;\n"],"names":["Radio","React","forwardRef","name","value","checked","defaultChecked","disabled","readOnly","label","className","style","onChange","onBlur","rest","forwardedRef","uniqueId","useMemo","nanoid","handleChange","e","preventDefault","createElement","S","htmlFor","$isChecked","_extends","ref","type","id","propTypes","process","env","NODE_ENV","PropTypes","any","string","isRequired","bool","object","func","defaultProps"],"mappings":";;;;;;AAuBMA,MAAAA,KAAK,GAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,KAAKA,CAC3C;EACEG,IAAI;EACJC,KAAK;EACLC,OAAO;EACPC,cAAc;EACdC,QAAQ;EACRC,QAAQ;EACRC,KAAK;EACLC,SAAS;EACTC,KAAK;EACLC,QAAQ;EACRC,MAAM;EACN,GAAGC,IAAAA;AACL,CAAC,EACDC,YAAY,EACZ;EACA,MAAMC,QAAQ,GAAGC,OAAO,CAAC,MAAMC,MAAM,EAAE,EAAE,EAAE,CAAC,CAAA;EAE5C,MAAMC,YAAY,GAAGC,CAAC,IAAI;AAExB,IAAA,IAAIZ,QAAQ,EAAE;MACZY,CAAC,CAACC,cAAc,EAAE,CAAA;AAClB,MAAA,OAAA;AACF,KAAA;AACA,IAAA,IAAIT,QAAQ,EAAE;MACZA,QAAQ,CAACQ,CAAC,CAAC,CAAA;AACb,KAAA;GACD,CAAA;AAED,EAAA,OACEnB,cAAA,CAAAqB,aAAA,CAACC,OAAO,EAAA;AACNC,IAAAA,OAAO,EAAER,QAAS;AAClBT,IAAAA,QAAQ,EAAEA,QAAS;AACnBC,IAAAA,QAAQ,EAAEA,QAAS;AACnBiB,IAAAA,UAAU,EAAEpB,OAAQ;AACpBK,IAAAA,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xC,KAAK,CAACyC,YAAY,GAAG;AACnBlC,EAAAA,QAAQ,EAAE,KAAA;AACZ,CAAC;;;;"}
1
+ {"version":3,"file":"Radio.js","sources":["../../../src/components/inputs/Radio/Radio.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\n\nimport { nanoid } from 'nanoid';\n\nimport * as S from './Radio.styled';\n\ntype RadioOwnProps = {\n /**\n * Text displayed by the radio button\n */\n label?: any;\n /**\n * Name of the radio button (used when sending form data)\n */\n name: string;\n /**\n * Value to be sent when the given radio button is selected\n */\n value: any;\n /**\n * Whether the radio button is checked\n */\n checked?: boolean;\n /**\n * Whether the radio button is checked by default. The most commonly used option should have this set to `true`.\n */\n defaultChecked?: boolean;\n /**\n * Whether the radio button is disabled\n */\n disabled?: boolean;\n /**\n * Display the radio button as read-only\n */\n readOnly?: boolean;\n /**\n * Custom class names for the HTML element\n */\n className?: string;\n /**\n * Custom inline CSS styling\n */\n style?: any;\n /**\n * Optional callback function for the `onChange` event\n */\n onChange?: (...args: any[]) => any;\n /**\n * Optional callback function for the `onBlur` event\n */\n onBlur?: (...args: any[]) => any;\n};\n\n// Rest spreads onto input; use Omit+intersection to widen, not narrow, colliding props.\ntype Props = Omit<React.ComponentPropsWithoutRef<'input'>, keyof RadioOwnProps> & RadioOwnProps;\n\n/**\n * Radio buttons allow the user to select one option from a set.\n *\n * Use radio buttons when the user needs to see all available options. If available options can be\n * collapsed, consider using a dropdown menu because it uses less space.\n *\n * Radio buttons should have the most commonly used option selected by default.\n *\n * ### Import\n *\n * ``` js\n * import { Radio } from '@ntbjs/react-components/inputs'\n * // or\n * import Radio from '@ntbjs/react-components/inputs/Radio'\n * ```\n */\nconst Radio = React.forwardRef<any, Props>(function Radio(\n {\n name,\n value,\n checked,\n defaultChecked,\n disabled = false,\n readOnly,\n label,\n className,\n style,\n onChange,\n onBlur,\n ...rest\n },\n forwardedRef\n) {\n const uniqueId = useMemo(() => nanoid(), []);\n\n const handleChange = e => {\n // Prevent onChange when readOnly\n if (readOnly) {\n e.preventDefault();\n return;\n }\n if (onChange) {\n onChange(e);\n }\n };\n\n return (\n <S.Radio\n htmlFor={uniqueId}\n disabled={disabled}\n readOnly={readOnly}\n $isChecked={checked}\n className={className}\n style={style}\n >\n <input\n ref={forwardedRef}\n type=\"radio\"\n name={name}\n value={value}\n checked={checked}\n defaultChecked={defaultChecked}\n disabled={disabled}\n id={uniqueId}\n onChange={handleChange}\n onBlur={onBlur}\n {...rest}\n />\n <S.RadioLabel>{label}</S.RadioLabel>\n </S.Radio>\n );\n});\n\nexport default Radio;\n"],"names":["Radio","React","forwardRef","name","value","checked","defaultChecked","disabled","readOnly","label","className","style","onChange","onBlur","rest","forwardedRef","uniqueId","useMemo","nanoid","handleChange","e","preventDefault","_jsxs","S","htmlFor","$isChecked","children","_jsx","ref","type","id"],"mappings":";;;;;AAwEA,MAAMA,KAAK,GAAGC,cAAK,CAACC,UAAU,CAAa,SAASF,KAAKA,CACvD;EACEG,IAAI;EACJC,KAAK;EACLC,OAAO;EACPC,cAAc;AACdC,EAAAA,QAAQ,GAAG,KAAK;EAChBC,QAAQ;EACRC,KAAK;EACLC,SAAS;EACTC,KAAK;EACLC,QAAQ;EACRC,MAAM;EACN,GAAGC;AACL,CAAC,EACDC,YAAY,EACZ;EACA,MAAMC,QAAQ,GAAGC,OAAO,CAAC,MAAMC,MAAM,EAAE,EAAE,EAAE,CAAC;EAE5C,MAAMC,YAAY,GAAGC,CAAC,IAAI;AAExB,IAAA,IAAIZ,QAAQ,EAAE;MACZY,CAAC,CAACC,cAAc,EAAE;AAClB,MAAA;AACF,IAAA;AACA,IAAA,IAAIT,QAAQ,EAAE;MACZA,QAAQ,CAACQ,CAAC,CAAC;AACb,IAAA;EACF,CAAC;AAED,EAAA,OACEE,IAAA,CAACC,OAAO,EAAA;AACNC,IAAAA,OAAO,EAAER,QAAS;AAClBT,IAAAA,QAAQ,EAAEA,QAAS;AACnBC,IAAAA,QAAQ,EAAEA,QAAS;AACnBiB,IAAAA,UAAU,EAAEpB,OAAQ;AACpBK,IAAAA,SAAS,EAAEA,SAAU;AACrBC,IAAAA,KAAK,EAAEA,KAAM;AAAAe,IAAAA,QAAA,GAEbC,GAAA,CAAA,OAAA,EAAA;AACEC,MAAAA,GAAG,EAAEb,YAAa;AAClBc,MAAAA,IAAI,EAAC,OAAO;AACZ1B,MAAAA,IAAI,EAAEA,IAAK;AACXC,MAAAA,KAAK,EAAEA,KAAM;AACbC,MAAAA,OAAO,EAAEA,OAAQ;AACjBC,MAAAA,cAAc,EAAEA,cAAe;AAC/BC,MAAAA,QAAQ,EAAEA,QAAS;AACnBuB,MAAAA,EAAE,EAAEd,QAAS;AACbJ,MAAAA,QAAQ,EAAEO,YAAa;AACvBN,MAAAA,MAAM,EAAEA,MAAO;MAAA,GACXC;AAAI,KACT,CAAC,EACFa,GAAA,CAACJ,UAAY,EAAA;AAAAG,MAAAA,QAAA,EAAEjB;AAAK,KAAe,CAAC;AAAA,GAC7B,CAAC;AAEd,CAAC;;;;"}
@@ -2,103 +2,22 @@ import { math } from 'polished';
2
2
  import styled, { css } from 'styled-components';
3
3
  import { applyDefaultTheme } from '../../utils/defaultTheme.js';
4
4
 
5
+ const shouldForwardProp = prop => {
6
+ return prop !== 'theme' && !prop.startsWith('$');
7
+ };
5
8
  const radioSize = '18px';
6
- const RadioLabel = styled.div.attrs(applyDefaultTheme)`
7
- padding-left: ${math(`${radioSize} + 10px`)};
8
- font-weight: 400;
9
- font-size: 0.875rem;
10
- pointer-events: none;
11
-
12
- ${props => props.theme.themeProp('color', props.theme.getColor('gray-300'), props.theme.getColor('gray-600'))};
13
- `;
14
- const Radio = styled.label.attrs(applyDefaultTheme)`
15
- display: block;
16
- position: relative;
17
- cursor: ${props => props.disabled ? 'not-allowed' : 'pointer'};
18
- line-height: ${radioSize};
19
- user-select: none;
20
-
21
- input[type='radio'] {
22
- position: absolute;
23
- opacity: 0;
24
- width: ${radioSize};
25
- height: ${radioSize};
26
- margin: 0;
27
- cursor: ${props => props.disabled ? 'not-allowed' : 'pointer'};
28
- z-index: 1;
29
- }
30
-
31
- &::before {
32
- content: '';
33
- position: absolute;
34
- border: 2px solid ${props => props.theme.getColor('gray-300')};
35
- width: ${radioSize};
36
- height: ${radioSize};
37
- top: 0;
38
- left: 0;
39
- border-radius: 50%;
40
- transition: all 200ms;
41
- box-sizing: border-box;
42
- pointer-events: none;
43
-
44
- /* Apply checked styling based on $isChecked prop */
45
- ${props => props.$isChecked && css`
46
- border-color: ${props.theme.getColor('emerald-500')};
47
- `}
48
- }
49
-
50
- &::after {
51
- content: '';
52
- position: absolute;
53
- width: 8px;
54
- height: 8px;
55
- top: 5px;
56
- left: 5px;
57
- border-radius: 50%;
58
- background: transparent;
59
- transform: scale(0);
60
- transition: all 200ms;
61
- pointer-events: none;
62
-
63
- /* Apply checked styling based on $isChecked prop */
64
- ${props => props.$isChecked && css`
65
- background: ${props.theme.getColor('emerald-500')};
66
- transform: scale(1);
67
- `}
68
- }
69
-
70
- /* Fallback: :has() selector for browsers that support it */
71
- &:has(input[type='radio']:checked) {
72
- &::before {
73
- border-color: ${props => props.theme.getColor('emerald-500')};
74
- }
75
-
76
- &::after {
77
- background: ${props => props.theme.getColor('emerald-500')};
78
- transform: scale(1);
79
- }
80
- }
81
-
82
- input[type='radio']:checked + ${RadioLabel} {
83
- opacity: 1;
84
- }
85
-
86
- ${props => props.readOnly && css`
87
- opacity: 0.5;
88
- pointer-events: none;
89
- user-select: text;
90
- `}
91
-
92
- ${props => props.disabled && css`
93
- opacity: 0.5;
94
- cursor: not-allowed;
95
- user-select: text;
96
-
97
- input[type='radio'] {
98
- cursor: not-allowed;
99
- }
100
- `}
101
- `;
9
+ const RadioLabel = styled.div.withConfig({
10
+ shouldForwardProp
11
+ }).attrs(applyDefaultTheme).withConfig({
12
+ displayName: "Radiostyled__RadioLabel",
13
+ componentId: "sc-1ikso9o-0"
14
+ })(["padding-left:", ";font-weight:400;font-size:0.875rem;pointer-events:none;", ";"], math(`${radioSize} + 10px`), props => props.theme.themeProp('color', props.theme.getColor('gray-300'), props.theme.getColor('gray-600')));
15
+ const Radio = styled.label.withConfig({
16
+ shouldForwardProp
17
+ }).attrs(applyDefaultTheme).withConfig({
18
+ displayName: "Radiostyled__Radio",
19
+ componentId: "sc-1ikso9o-1"
20
+ })(["display:block;position:relative;cursor:", ";line-height:", ";user-select:none;input[type='radio']{position:absolute;opacity:0;width:", ";height:", ";margin:0;cursor:", ";z-index:1;}&::before{content:'';position:absolute;border:2px solid ", ";width:", ";height:", ";top:0;left:0;border-radius:50%;transition:all 200ms;box-sizing:border-box;pointer-events:none;", "}&::after{content:'';position:absolute;width:8px;height:8px;top:5px;left:5px;border-radius:50%;background:transparent;transform:scale(0);transition:all 200ms;pointer-events:none;", "}&:has(input[type='radio']:checked){&::before{border-color:", ";}&::after{background:", ";transform:scale(1);}}input[type='radio']:checked + ", "{opacity:1;}", " ", ""], props => props.disabled ? 'not-allowed' : 'pointer', radioSize, radioSize, radioSize, props => props.disabled ? 'not-allowed' : 'pointer', props => props.theme.getColor('gray-300'), radioSize, radioSize, props => props.$isChecked && css(["border-color:", ";"], props.theme.getColor('emerald-500')), props => props.$isChecked && css(["background:", ";transform:scale(1);"], props.theme.getColor('emerald-500')), props => props.theme.getColor('emerald-500'), props => props.theme.getColor('emerald-500'), RadioLabel, props => props.readOnly && css(["opacity:0.5;pointer-events:none;user-select:text;"]), props => props.disabled && css(["opacity:0.5;cursor:not-allowed;user-select:text;input[type='radio']{cursor:not-allowed;}"]));
102
21
 
103
22
  export { Radio, RadioLabel };
104
23
  //# sourceMappingURL=Radio.styled.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Radio.styled.js","sources":["../../../src/components/inputs/Radio/Radio.styled.js"],"sourcesContent":["import { math } from 'polished';\nimport styled, { css } from 'styled-components';\nimport { applyDefaultTheme } from '../../../utils/defaultTheme';\n\nconst radioSize = '18px';\n\nexport const RadioLabel = styled.div.attrs(applyDefaultTheme)`\n padding-left: ${math(`${radioSize} + 10px`)};\n font-weight: 400;\n font-size: 0.875rem;\n pointer-events: none;\n\n ${props =>\n props.theme.themeProp(\n 'color',\n props.theme.getColor('gray-300'),\n props.theme.getColor('gray-600')\n )};\n`;\n\nexport const Radio = styled.label.attrs(applyDefaultTheme)`\n display: block;\n position: relative;\n cursor: ${props => (props.disabled ? 'not-allowed' : 'pointer')};\n line-height: ${radioSize};\n user-select: none;\n\n input[type='radio'] {\n position: absolute;\n opacity: 0;\n width: ${radioSize};\n height: ${radioSize};\n margin: 0;\n cursor: ${props => (props.disabled ? 'not-allowed' : 'pointer')};\n z-index: 1;\n }\n\n &::before {\n content: '';\n position: absolute;\n border: 2px solid ${props => props.theme.getColor('gray-300')};\n width: ${radioSize};\n height: ${radioSize};\n top: 0;\n left: 0;\n border-radius: 50%;\n transition: all 200ms;\n box-sizing: border-box;\n pointer-events: none;\n\n /* Apply checked styling based on $isChecked prop */\n ${props =>\n props.$isChecked &&\n css`\n border-color: ${props.theme.getColor('emerald-500')};\n `}\n }\n\n &::after {\n content: '';\n position: absolute;\n width: 8px;\n height: 8px;\n top: 5px;\n left: 5px;\n border-radius: 50%;\n background: transparent;\n transform: scale(0);\n transition: all 200ms;\n pointer-events: none;\n\n /* Apply checked styling based on $isChecked prop */\n ${props =>\n props.$isChecked &&\n css`\n background: ${props.theme.getColor('emerald-500')};\n transform: scale(1);\n `}\n }\n\n /* Fallback: :has() selector for browsers that support it */\n &:has(input[type='radio']:checked) {\n &::before {\n border-color: ${props => props.theme.getColor('emerald-500')};\n }\n\n &::after {\n background: ${props => props.theme.getColor('emerald-500')};\n transform: scale(1);\n }\n }\n\n input[type='radio']:checked + ${RadioLabel} {\n opacity: 1;\n }\n\n ${props =>\n props.readOnly &&\n css`\n opacity: 0.5;\n pointer-events: none;\n user-select: text;\n `}\n\n ${props =>\n props.disabled &&\n css`\n opacity: 0.5;\n cursor: not-allowed;\n user-select: text;\n\n input[type='radio'] {\n cursor: not-allowed;\n }\n `}\n`;\n"],"names":["radioSize","RadioLabel","styled","div","attrs","applyDefaultTheme","math","props","theme","themeProp","getColor","Radio","label","disabled","$isChecked","css","readOnly"],"mappings":";;;;AAIA,MAAMA,SAAS,GAAG,MAAM,CAAA;AAEjB,MAAMC,UAAU,GAAGC,MAAM,CAACC,GAAG,CAACC,KAAK,CAACC,iBAAiB,CAAC,CAAA;AAC7D,gBAAA,EAAkBC,IAAI,CAAC,CAAGN,EAAAA,SAAS,SAAS,CAAC,CAAA;AAC7C;AACA;AACA;AACA;AACA,EAAIO,EAAAA,KAAK,IACLA,KAAK,CAACC,KAAK,CAACC,SAAS,CACnB,OAAO,EACPF,KAAK,CAACC,KAAK,CAACE,QAAQ,CAAC,UAAU,CAAC,EAChCH,KAAK,CAACC,KAAK,CAACE,QAAQ,CAAC,UAAU,CACjC,CAAC,CAAA;AACL,EAAC;AAEM,MAAMC,KAAK,GAAGT,MAAM,CAACU,KAAK,CAACR,KAAK,CAACC,iBAAiB,CAAC,CAAA;AAC1D;AACA;AACA,UAAYE,EAAAA,KAAK,IAAKA,KAAK,CAACM,QAAQ,GAAG,aAAa,GAAG,SAAU,CAAA;AACjE,eAAA,EAAiBb,SAAS,CAAA;AAC1B;AACA;AACA;AACA;AACA;AACA,WAAA,EAAaA,SAAS,CAAA;AACtB,YAAA,EAAcA,SAAS,CAAA;AACvB;AACA,YAAcO,EAAAA,KAAK,IAAKA,KAAK,CAACM,QAAQ,GAAG,aAAa,GAAG,SAAU,CAAA;AACnE;AACA;AACA;AACA;AACA;AACA;AACA,sBAAwBN,EAAAA,KAAK,IAAIA,KAAK,CAACC,KAAK,CAACE,QAAQ,CAAC,UAAU,CAAC,CAAA;AACjE,WAAA,EAAaV,SAAS,CAAA;AACtB,YAAA,EAAcA,SAAS,CAAA;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAA,EAAMO,KAAK,IACLA,KAAK,CAACO,UAAU,IAChBC,GAAG,CAAA;AACT,sBAAA,EAAwBR,KAAK,CAACC,KAAK,CAACE,QAAQ,CAAC,aAAa,CAAC,CAAA;AAC3D,MAAO,CAAA,CAAA;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAA,EAAMH,KAAK,IACLA,KAAK,CAACO,UAAU,IAChBC,GAAG,CAAA;AACT,oBAAA,EAAsBR,KAAK,CAACC,KAAK,CAACE,QAAQ,CAAC,aAAa,CAAC,CAAA;AACzD;AACA,MAAO,CAAA,CAAA;AACP;AACA;AACA;AACA;AACA;AACA,oBAAsBH,EAAAA,KAAK,IAAIA,KAAK,CAACC,KAAK,CAACE,QAAQ,CAAC,aAAa,CAAC,CAAA;AAClE;AACA;AACA;AACA,kBAAoBH,EAAAA,KAAK,IAAIA,KAAK,CAACC,KAAK,CAACE,QAAQ,CAAC,aAAa,CAAC,CAAA;AAChE;AACA;AACA;AACA;AACA,gCAAA,EAAkCT,UAAU,CAAA;AAC5C;AACA;AACA;AACA,EAAA,EAAIM,KAAK,IACLA,KAAK,CAACS,QAAQ,IACdD,GAAG,CAAA;AACP;AACA;AACA;AACA,IAAK,CAAA,CAAA;AACL;AACA,EAAA,EAAIR,KAAK,IACLA,KAAK,CAACM,QAAQ,IACdE,GAAG,CAAA;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAK,CAAA,CAAA;AACL;;;;"}
1
+ {"version":3,"file":"Radio.styled.js","sources":["../../../src/components/inputs/Radio/Radio.styled.ts"],"sourcesContent":["import { math } from 'polished';\nimport styled, { css } from 'styled-components';\nimport { applyDefaultTheme } from '../../../utils/defaultTheme';\n\n// Single-argument only — styled-components v5.1+ and v6 disagree on the second parameter.\nconst shouldForwardProp = (prop: string): boolean => {\n return prop !== 'theme' && !prop.startsWith('$');\n};\n\nconst radioSize = '18px';\n\nexport const RadioLabel = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n padding-left: ${math(`${radioSize} + 10px`)};\n font-weight: 400;\n font-size: 0.875rem;\n pointer-events: none;\n\n ${props =>\n props.theme.themeProp(\n 'color',\n props.theme.getColor('gray-300'),\n props.theme.getColor('gray-600')\n )};\n`;\n\n/*\n * Defect: disabled/readOnly leak to <label> DOM and are TS2339 errors; $isChecked is live in pseudo blocks.\n */\ninterface RadioStyleProps {\n /** `checked` — passed through as the checked-state affordance. */\n $isChecked?: boolean;\n /** `disabled` — leaks to DOM. */\n disabled?: boolean;\n /** `readOnly` — leaks to DOM. */\n readOnly?: boolean;\n}\n\nexport const Radio = styled.label\n .withConfig({\n shouldForwardProp\n })\n .attrs<RadioStyleProps>(applyDefaultTheme)`\n display: block;\n position: relative;\n cursor: ${props => (props.disabled ? 'not-allowed' : 'pointer')};\n line-height: ${radioSize};\n user-select: none;\n\n input[type='radio'] {\n position: absolute;\n opacity: 0;\n width: ${radioSize};\n height: ${radioSize};\n margin: 0;\n cursor: ${props => (props.disabled ? 'not-allowed' : 'pointer')};\n z-index: 1;\n }\n\n &::before {\n content: '';\n position: absolute;\n border: 2px solid ${props => props.theme.getColor('gray-300')};\n width: ${radioSize};\n height: ${radioSize};\n top: 0;\n left: 0;\n border-radius: 50%;\n transition: all 200ms;\n box-sizing: border-box;\n pointer-events: none;\n\n /* Apply checked styling based on $isChecked prop */\n ${props =>\n props.$isChecked &&\n css`\n border-color: ${props.theme.getColor('emerald-500')};\n `}\n }\n\n &::after {\n content: '';\n position: absolute;\n width: 8px;\n height: 8px;\n top: 5px;\n left: 5px;\n border-radius: 50%;\n background: transparent;\n transform: scale(0);\n transition: all 200ms;\n pointer-events: none;\n\n /* Apply checked styling based on $isChecked prop */\n ${props =>\n props.$isChecked &&\n css`\n background: ${props.theme.getColor('emerald-500')};\n transform: scale(1);\n `}\n }\n\n /* Fallback: :has() selector for browsers that support it */\n &:has(input[type='radio']:checked) {\n &::before {\n border-color: ${props => props.theme.getColor('emerald-500')};\n }\n\n &::after {\n background: ${props => props.theme.getColor('emerald-500')};\n transform: scale(1);\n }\n }\n\n input[type='radio']:checked + ${RadioLabel} {\n opacity: 1;\n }\n\n ${props =>\n props.readOnly &&\n css`\n opacity: 0.5;\n pointer-events: none;\n user-select: text;\n `}\n\n ${props =>\n props.disabled &&\n css`\n opacity: 0.5;\n cursor: not-allowed;\n user-select: text;\n\n input[type='radio'] {\n cursor: not-allowed;\n }\n `}\n`;\n"],"names":["shouldForwardProp","prop","startsWith","radioSize","RadioLabel","styled","div","withConfig","attrs","applyDefaultTheme","displayName","componentId","math","props","theme","themeProp","getColor","Radio","label","disabled","$isChecked","css","readOnly"],"mappings":";;;;AAKA,MAAMA,iBAAiB,GAAIC,IAAY,IAAc;EACnD,OAAOA,IAAI,KAAK,OAAO,IAAI,CAACA,IAAI,CAACC,UAAU,CAAC,GAAG,CAAC;AAClD,CAAC;AAED,MAAMC,SAAS,GAAG,MAAM;AAEjB,MAAMC,UAAU,GAAGC,MAAM,CAACC,GAAG,CACjCC,UAAU,CAAC;AACVP,EAAAA;AACF,CAAC,CAAC,CACDQ,KAAK,CAACC,iBAAiB,CAAC,CAAAF,UAAA,CAAA;EAAAG,WAAA,EAAA,yBAAA;EAAAC,WAAA,EAAA;AAAA,CAAA,CAAA,CAAA,CAAA,eAAA,EAAA,0DAAA,EAAA,GAAA,CAAA,EACTC,IAAI,CAAC,CAAA,EAAGT,SAAS,SAAS,CAAC,EAKzCU,KAAK,IACLA,KAAK,CAACC,KAAK,CAACC,SAAS,CACnB,OAAO,EACPF,KAAK,CAACC,KAAK,CAACE,QAAQ,CAAC,UAAU,CAAC,EAChCH,KAAK,CAACC,KAAK,CAACE,QAAQ,CAAC,UAAU,CACjC,CAAC;AAeE,MAAMC,KAAK,GAAGZ,MAAM,CAACa,KAAK,CAC9BX,UAAU,CAAC;AACVP,EAAAA;AACF,CAAC,CAAC,CACDQ,KAAK,CAAkBC,iBAAiB,CAAC,CAAAF,UAAA,CAAA;EAAAG,WAAA,EAAA,oBAAA;EAAAC,WAAA,EAAA;AAAA,CAAA,CAAA,CAAA,CAAA,yCAAA,EAAA,eAAA,EAAA,0EAAA,EAAA,UAAA,EAAA,mBAAA,EAAA,sEAAA,EAAA,SAAA,EAAA,UAAA,EAAA,iGAAA,EAAA,oLAAA,EAAA,6DAAA,EAAA,wBAAA,EAAA,sDAAA,EAAA,cAAA,EAAA,GAAA,EAAA,EAAA,CAAA,EAGhCE,KAAK,IAAKA,KAAK,CAACM,QAAQ,GAAG,aAAa,GAAG,SAAU,EAChDhB,SAAS,EAMbA,SAAS,EACRA,SAAS,EAETU,KAAK,IAAKA,KAAK,CAACM,QAAQ,GAAG,aAAa,GAAG,SAAU,EAO3CN,KAAK,IAAIA,KAAK,CAACC,KAAK,CAACE,QAAQ,CAAC,UAAU,CAAC,EACpDb,SAAS,EACRA,SAAS,EASjBU,KAAK,IACLA,KAAK,CAACO,UAAU,IAChBC,GAAG,CAAA,CAAA,eAAA,EAAA,GAAA,CAAA,EACeR,KAAK,CAACC,KAAK,CAACE,QAAQ,CAAC,aAAa,CAAC,CACpD,EAiBDH,KAAK,IACLA,KAAK,CAACO,UAAU,IAChBC,GAAG,CAAA,CAAA,aAAA,EAAA,sBAAA,CAAA,EACaR,KAAK,CAACC,KAAK,CAACE,QAAQ,CAAC,aAAa,CAAC,CAElD,EAMeH,KAAK,IAAIA,KAAK,CAACC,KAAK,CAACE,QAAQ,CAAC,aAAa,CAAC,EAI9CH,KAAK,IAAIA,KAAK,CAACC,KAAK,CAACE,QAAQ,CAAC,aAAa,CAAC,EAK9BZ,UAAU,EAIxCS,KAAK,IACLA,KAAK,CAACS,QAAQ,IACdD,GAAG,CAAA,CAAA,mDAAA,CAAA,CAIF,EAEDR,KAAK,IACLA,KAAK,CAACM,QAAQ,IACdE,GAAG,CAAA,CAAA,0FAAA,CAAA,CAQF;;;;"}
@@ -1,15 +1,15 @@
1
1
  import React__default, { useState } from 'react';
2
2
  import { nanoid } from 'nanoid';
3
- import PropTypes from 'prop-types';
4
3
  import { Switch as Switch$1, SwitchLabel, SwitchIndicator, SwitchIndicatorButton, SwitchIndicatorLabelText, Description } from './Switch.styled.js';
4
+ import { jsxs, jsx } from 'react/jsx-runtime';
5
5
 
6
6
  const Switch = React__default.forwardRef(function Switch({
7
7
  name,
8
8
  checked,
9
9
  defaultChecked,
10
10
  label,
11
- disabled,
12
- readOnly,
11
+ disabled = false,
12
+ readOnly = false,
13
13
  description,
14
14
  spaciousDescription,
15
15
  className,
@@ -18,47 +18,35 @@ const Switch = React__default.forwardRef(function Switch({
18
18
  onBlur
19
19
  }, forwardedRef) {
20
20
  const [uniqueId] = useState(nanoid());
21
- return React__default.createElement(Switch$1, {
21
+ return jsxs(Switch$1, {
22
22
  disabled: disabled,
23
23
  readOnly: readOnly,
24
24
  className: className,
25
- style: style
26
- }, React__default.createElement(SwitchLabel, {
27
- htmlFor: uniqueId
28
- }, React__default.createElement("input", {
29
- ref: forwardedRef,
30
- checked: checked,
31
- defaultChecked: defaultChecked,
32
- disabled: disabled,
33
- readOnly: readOnly,
34
- id: uniqueId,
35
- name: name,
36
- type: "checkbox",
37
- onBlur: onBlur,
38
- onChange: onChange
39
- }), React__default.createElement(SwitchIndicator, null, React__default.createElement(SwitchIndicatorButton, null)), typeof label === 'string' && label.length > 0 && React__default.createElement(SwitchIndicatorLabelText, null, label)), typeof description === 'string' && description.length > 0 && React__default.createElement(Description, {
40
- $spaciousdescription: spaciousDescription
41
- }, description));
25
+ style: style,
26
+ children: [jsxs(SwitchLabel, {
27
+ htmlFor: uniqueId,
28
+ children: [jsx("input", {
29
+ ref: forwardedRef,
30
+ checked: checked,
31
+ defaultChecked: defaultChecked,
32
+ disabled: disabled,
33
+ readOnly: readOnly,
34
+ id: uniqueId,
35
+ name: name,
36
+ type: "checkbox",
37
+ onBlur: onBlur,
38
+ onChange: onChange
39
+ }), jsx(SwitchIndicator, {
40
+ children: jsx(SwitchIndicatorButton, {})
41
+ }), typeof label === 'string' && label.length > 0 && jsx(SwitchIndicatorLabelText, {
42
+ children: label
43
+ })]
44
+ }), typeof description === 'string' && description.length > 0 && jsx(Description, {
45
+ $spaciousdescription: spaciousDescription,
46
+ children: description
47
+ })]
48
+ });
42
49
  });
43
- Switch.propTypes = process.env.NODE_ENV !== "production" ? {
44
- children: PropTypes.any,
45
- name: PropTypes.string.isRequired,
46
- checked: PropTypes.bool,
47
- defaultChecked: PropTypes.bool,
48
- label: PropTypes.string,
49
- disabled: PropTypes.bool,
50
- readOnly: PropTypes.bool,
51
- description: PropTypes.string,
52
- spaciousDescription: PropTypes.bool,
53
- className: PropTypes.string,
54
- style: PropTypes.object,
55
- onChange: PropTypes.func,
56
- onBlur: PropTypes.func
57
- } : {};
58
- Switch.defaultProps = {
59
- disabled: false,
60
- readOnly: false
61
- };
62
50
 
63
51
  export { Switch as default };
64
52
  //# sourceMappingURL=Switch.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Switch.js","sources":["../../../src/components/inputs/Switch/Switch.js"],"sourcesContent":["import React, { useState } from 'react';\n\nimport { nanoid } from 'nanoid';\nimport PropTypes from 'prop-types';\n\nimport * as S from './Switch.styled';\n\n/**\n * The Switch allows the user to toggle an option.\n *\n * ### Import\n *\n * ``` js\n * import { Switch } from '@ntbjs/react-components/inputs'\n * // or\n * import Switch from '@ntbjs/react-components/inputs/Switch'\n * ```\n */\nconst Switch = React.forwardRef(function Switch(\n {\n name,\n checked,\n defaultChecked,\n label,\n disabled,\n readOnly,\n description,\n spaciousDescription,\n className,\n style,\n onChange,\n onBlur\n },\n forwardedRef\n) {\n const [uniqueId] = useState(nanoid());\n\n return (\n <S.Switch disabled={disabled} readOnly={readOnly} className={className} style={style}>\n <S.SwitchLabel htmlFor={uniqueId}>\n <input\n ref={forwardedRef}\n checked={checked}\n defaultChecked={defaultChecked}\n disabled={disabled}\n readOnly={readOnly}\n id={uniqueId}\n name={name}\n type=\"checkbox\"\n onBlur={onBlur}\n onChange={onChange}\n />\n <S.SwitchIndicator>\n <S.SwitchIndicatorButton />\n </S.SwitchIndicator>\n {typeof label === 'string' && label.length > 0 && (\n <S.SwitchIndicatorLabelText>{label}</S.SwitchIndicatorLabelText>\n )}\n </S.SwitchLabel>\n {typeof description === 'string' && description.length > 0 && (\n <S.Description $spaciousdescription={spaciousDescription}>{description}</S.Description>\n )}\n </S.Switch>\n );\n});\n\nSwitch.propTypes = {\n children: PropTypes.any,\n name: PropTypes.string.isRequired,\n\n /**\n * Whether the switch is toggled on or off\n */\n checked: PropTypes.bool,\n\n /**\n * Whether the switch is toggled on by default\n */\n defaultChecked: PropTypes.bool,\n\n /**\n * Text displayed next to the switch\n */\n label: PropTypes.string,\n\n /**\n * Whether the switch is toggled on\n */\n disabled: PropTypes.bool,\n\n /**\n * Whether the switch is displayed as read-only\n */\n readOnly: PropTypes.bool,\n\n /**\n * Text displayed underneath the switch\n */\n description: PropTypes.string,\n\n /**\n * Whether there should be extra `margin` added between the switch and the description\n */\n spaciousDescription: PropTypes.bool,\n\n /**\n * Add extra classes to the HTML element\n */\n className: PropTypes.string,\n\n /**\n * Custom CSS styling\n */\n style: PropTypes.object,\n\n /**\n * Optional callback function for the `onChange` event\n */\n onChange: PropTypes.func,\n\n /**\n * Optional callback function for the `onBlur` event\n */\n onBlur: PropTypes.func\n};\n\nSwitch.defaultProps = {\n disabled: false,\n readOnly: false\n};\n\nexport default Switch;\n"],"names":["Switch","React","forwardRef","name","checked","defaultChecked","label","disabled","readOnly","description","spaciousDescription","className","style","onChange","onBlur","forwardedRef","uniqueId","useState","nanoid","createElement","S","htmlFor","ref","id","type","length","$spaciousdescription","propTypes","process","env","NODE_ENV","children","PropTypes","any","string","isRequired","bool","object","func","defaultProps"],"mappings":";;;;;AAkBMA,MAAAA,MAAM,GAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,MAAMA,CAC7C;EACEG,IAAI;EACJC,OAAO;EACPC,cAAc;EACdC,KAAK;EACLC,QAAQ;EACRC,QAAQ;EACRC,WAAW;EACXC,mBAAmB;EACnBC,SAAS;EACTC,KAAK;EACLC,QAAQ;AACRC,EAAA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AA;GAAsBD,EAAAA,WAA2B,CAEhF,CAAC,CAAA;AAEf,CAAC,EAAC;AAEFT,MAAM,CAAC2B,SAAS,GAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA,KAAG,YAAA,GAAA;EACjBC,QAAQ,EAAEC,SAAS,CAACC,GAAG;AACvB9B,EAAAA,IAAI,EAAE6B,SAAS,CAACE,MAAM,CAACC,UAAU;EAKjC/B,OAAO,EAAE4B,SAAS,CAACI,IAAI;EAKvB/B,cAAc,EAAE2B,SAAS,CAACI,IAAI;EAK9B9B,KAAK,EAAE0B,SAAS,CAACE,MAAM;EAKvB3B,QAAQ,EAAEyB,SAAS,CAACI,IAAI;EAKxB5B,QAAQ,EAAEwB,SAAS,CAACI,IAAI;EAKxB3B,WAAW,EAAEuB,SAAS,CAACE,MAAM;EAK7BxB,mBAAmB,EAAEsB,SAAS,CAACI,IAAI;EAKnCzB,SAAS,EAAEqB,SAAS,CAACE,MAAM;EAK3BtB,KAAK,EAAEoB,SAAS,CAACK,MAAM;EAKvBxB,QAAQ,EAAEmB,SAAS,CAACM,IAAI;EAKxBxB,MAAM,EAAEkB,SAAS,CAACM,IAAAA;AACpB,CAAC,GAAA,EAAA,CAAA;AAEDtC,MAAM,CAACuC,YAAY,GAAG;AACpBhC,EAAAA,QAAQ,EAAE,KAAK;AACfC,EAAAA,QAAQ,EAAE,KAAA;AACZ,CAAC;;;;"}
1
+ {"version":3,"file":"Switch.js","sources":["../../../src/components/inputs/Switch/Switch.tsx"],"sourcesContent":["import React, { useState } from 'react';\n\nimport { nanoid } from 'nanoid';\n\nimport * as S from './Switch.styled';\n\ntype Props = {\n children?: any;\n name: string;\n /**\n * Whether the switch is toggled on or off\n */\n checked?: boolean;\n /**\n * Whether the switch is toggled on by default\n */\n defaultChecked?: boolean;\n /**\n * Text displayed next to the switch\n */\n label?: string;\n /**\n * Whether the switch is toggled on\n */\n disabled?: boolean;\n /**\n * Whether the switch is displayed as read-only\n */\n readOnly?: boolean;\n /**\n * Text displayed underneath the switch\n */\n description?: string;\n /**\n * Whether there should be extra `margin` added between the switch and the description\n */\n spaciousDescription?: boolean;\n /**\n * Add extra classes to the HTML element\n */\n className?: string;\n /**\n * Custom CSS styling\n */\n style?: any;\n /**\n * Optional callback function for the `onChange` event\n */\n onChange?: (...args: any[]) => any;\n /**\n * Optional callback function for the `onBlur` event\n */\n onBlur?: (...args: any[]) => any;\n};\n\n/**\n * The Switch allows the user to toggle an option.\n *\n * ### Import\n *\n * ``` js\n * import { Switch } from '@ntbjs/react-components/inputs'\n * // or\n * import Switch from '@ntbjs/react-components/inputs/Switch'\n * ```\n */\nconst Switch = React.forwardRef<any, Props>(function Switch(\n {\n name,\n checked,\n defaultChecked,\n label,\n disabled = false,\n readOnly = false,\n description,\n spaciousDescription,\n className,\n style,\n onChange,\n onBlur\n },\n forwardedRef\n) {\n const [uniqueId] = useState(nanoid());\n\n return (\n <S.Switch disabled={disabled} readOnly={readOnly} className={className} style={style}>\n <S.SwitchLabel htmlFor={uniqueId}>\n <input\n ref={forwardedRef}\n checked={checked}\n defaultChecked={defaultChecked}\n disabled={disabled}\n readOnly={readOnly}\n id={uniqueId}\n name={name}\n type=\"checkbox\"\n onBlur={onBlur}\n onChange={onChange}\n />\n <S.SwitchIndicator>\n <S.SwitchIndicatorButton />\n </S.SwitchIndicator>\n {typeof label === 'string' && label.length > 0 && (\n <S.SwitchIndicatorLabelText>{label}</S.SwitchIndicatorLabelText>\n )}\n </S.SwitchLabel>\n {typeof description === 'string' && description.length > 0 && (\n <S.Description $spaciousdescription={spaciousDescription}>{description}</S.Description>\n )}\n </S.Switch>\n );\n});\n\nexport default Switch;\n"],"names":["Switch","React","forwardRef","name","checked","defaultChecked","label","disabled","readOnly","description","spaciousDescription","className","style","onChange","onBlur","forwardedRef","uniqueId","useState","nanoid","_jsxs","S","children","htmlFor","_jsx","ref","id","type","length","$spaciousdescription"],"mappings":";;;;;AAkEA,MAAMA,MAAM,GAAGC,cAAK,CAACC,UAAU,C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OAA6B,CAChE;AAAA,KACY,CAAC,EACf,OAAOG,WAAW,KAAK,QAAQ,IAAIA,WAAW,CAACkB,MAAM,GAAG,CAAC,IACxDJ,GAAA,CAACH,WAAa,EAAA;AAACQ,MAAAA,oBAAoB,EAAElB,mBAAoB;AAAAW,MAAAA,QAAA,EAAEZ;AAAW,KAAgB,CACvF;AAAA,GACO,CAAC;AAEf,CAAC;;;;"}
@@ -8,110 +8,40 @@ const shouldForwardProp = prop => {
8
8
  };
9
9
  const Switch = styled.div.withConfig({
10
10
  shouldForwardProp
11
- }).attrs(applyDefaultTheme)`
12
- * {
13
- box-sizing: border-box;
14
- }
15
-
16
- display: flex;
17
- flex-direction: column;
18
-
19
- ${props => props.readOnly && css`
20
- opacity: 0.5;
21
- > * {
22
- pointer-events: none;
23
- user-select: text;
24
- }
25
- `}
26
-
27
- ${props => props.disabled && css`
28
- opacity: 0.5;
29
- cursor: not-allowed;
30
- * {
31
- pointer-events: none;
32
- user-select: text;
33
- }
34
- `}
35
- `;
11
+ }).attrs(applyDefaultTheme).withConfig({
12
+ displayName: "Switchstyled__Switch",
13
+ componentId: "sc-1aq2wh1-0"
14
+ })(["*{box-sizing:border-box;}display:flex;flex-direction:column;", " ", ""], props => props.readOnly && css(["opacity:0.5;> *{pointer-events:none;user-select:text;}"]), props => props.disabled && css(["opacity:0.5;cursor:not-allowed;*{pointer-events:none;user-select:text;}"]));
36
15
  const SwitchIndicator = styled.div.withConfig({
37
16
  shouldForwardProp
38
- }).attrs(applyDefaultTheme)`
39
- display: inline-block;
40
- position: relative;
41
- ${props => props.theme.themeProp('background', props.theme.getColor('gray-900'), props.theme.getColor('gray-200'))}
42
- height: ${math(`${switchButtonSize} + 2px`)};
43
- width: 32px;
44
- border-radius: 20px;
45
- border: 1px solid;
46
- ${props => props.theme.themeProp('border-color', props.theme.getColor('gray-500'), props.theme.getColor('gray-300'))}
47
- transition: background 200ms;
48
- `;
17
+ }).attrs(applyDefaultTheme).withConfig({
18
+ displayName: "Switchstyled__SwitchIndicator",
19
+ componentId: "sc-1aq2wh1-1"
20
+ })(["display:inline-block;position:relative;", " height:", ";width:32px;border-radius:20px;border:1px solid;", " transition:background 200ms;"], props => props.theme.themeProp('background', props.theme.getColor('gray-900'), props.theme.getColor('gray-200')), math(`${switchButtonSize} + 2px`), props => props.theme.themeProp('border-color', props.theme.getColor('gray-500'), props.theme.getColor('gray-300')));
49
21
  const SwitchIndicatorButton = styled.div.withConfig({
50
22
  shouldForwardProp
51
- }).attrs(applyDefaultTheme)`
52
- position: absolute;
53
- ${props => props.theme.themeProp('background', props.theme.getColor('gray-200'), props.theme.getColor('white'))}
54
- height: ${switchButtonSize};
55
- width: ${switchButtonSize};
56
- border-radius: 50%;
57
- box-shadow: ${props => props.theme.getColor('gray-500')} 0 0px 2px 0px;
58
- transition: left 200ms;
59
- `;
23
+ }).attrs(applyDefaultTheme).withConfig({
24
+ displayName: "Switchstyled__SwitchIndicatorButton",
25
+ componentId: "sc-1aq2wh1-2"
26
+ })(["position:absolute;", " height:", ";width:", ";border-radius:50%;box-shadow:", " 0 0px 2px 0px;transition:left 200ms;"], props => props.theme.themeProp('background', props.theme.getColor('gray-200'), props.theme.getColor('white')), switchButtonSize, switchButtonSize, props => props.theme.getColor('gray-500'));
60
27
  const SwitchIndicatorLabelText = styled.div.withConfig({
61
28
  shouldForwardProp
62
- }).attrs(applyDefaultTheme)`
63
- padding-left: 10px;
64
- font-weight: 400;
65
- font-size: 0.875rem;
66
- line-height: 18px;
67
-
68
- ${props => props.theme.themeProp('color', props.theme.getColor('gray-300'), props.theme.getColor('gray-600'))};
69
- `;
29
+ }).attrs(applyDefaultTheme).withConfig({
30
+ displayName: "Switchstyled__SwitchIndicatorLabelText",
31
+ componentId: "sc-1aq2wh1-3"
32
+ })(["padding-left:10px;font-weight:400;font-size:0.875rem;line-height:18px;", ";"], props => props.theme.themeProp('color', props.theme.getColor('gray-300'), props.theme.getColor('gray-600')));
70
33
  const SwitchLabel = styled.label.withConfig({
71
34
  shouldForwardProp
72
- }).attrs(applyDefaultTheme)`
73
- display: inline-flex;
74
- margin-right: auto;
75
- cursor: pointer;
76
-
77
- input[type='checkbox'] {
78
- position: absolute;
79
- opacity: 0;
80
- }
81
-
82
- &:has(input[type='checkbox']:not(:checked)) {
83
- ${SwitchIndicatorButton} {
84
- left: 0;
85
- }
86
- }
87
-
88
- &:has(input[type='checkbox']:checked) {
89
- ${SwitchIndicatorButton} {
90
- left: calc(100% - ${switchButtonSize});
91
- }
92
-
93
- ${SwitchIndicator} {
94
- background: ${props => props.theme.getColor('emerald-500')};
95
-
96
- ${props => props.theme.themeProp('border-color', props.theme.getColor('gray-400'), props.theme.getColor('gray-300'), 1)}
97
- }
98
- }
99
-
100
- &:has(input[type='checkbox']:focus-visible) {
101
- ${SwitchIndicatorButton} {
102
- ${props => props.theme.themeProp('outline', `8px solid ${rgba(props.theme.getColor('emerald-500'), 0.5)}`, `8px solid ${rgba(props.theme.getColor('emerald-500'), 0.3)}`, 1)}
103
- }
104
- }
105
- `;
35
+ }).attrs(applyDefaultTheme).withConfig({
36
+ displayName: "Switchstyled__SwitchLabel",
37
+ componentId: "sc-1aq2wh1-4"
38
+ })(["display:inline-flex;margin-right:auto;cursor:pointer;input[type='checkbox']{position:absolute;opacity:0;}&:has(input[type='checkbox']:not(:checked)){", "{left:0;}}&:has(input[type='checkbox']:checked){", "{left:calc(100% - ", ");}", "{background:", ";", "}}&:has(input[type='checkbox']:focus-visible){", "{", "}}"], SwitchIndicatorButton, SwitchIndicatorButton, switchButtonSize, SwitchIndicator, props => props.theme.getColor('emerald-500'), props => props.theme.themeProp('border-color', props.theme.getColor('gray-400'), props.theme.getColor('gray-300'), 1), SwitchIndicatorButton, props => props.theme.themeProp('outline', `8px solid ${rgba(props.theme.getColor('emerald-500'), 0.5)}`, `8px solid ${rgba(props.theme.getColor('emerald-500'), 0.3)}`, 1));
106
39
  const Description = styled.div.withConfig({
107
40
  shouldForwardProp
108
- }).attrs(applyDefaultTheme)`
109
- margin: ${props => props.$spaciousdescription ? '16px' : '6px'} 0 0 0;
110
- font-size: 0.75rem;
111
- line-height: 1.333;
112
-
113
- ${props => props.theme.themeProp('color', props.theme.getColor('gray-400'), props.theme.getColor('gray-500'))};
114
- `;
41
+ }).attrs(applyDefaultTheme).withConfig({
42
+ displayName: "Switchstyled__Description",
43
+ componentId: "sc-1aq2wh1-5"
44
+ })(["margin:", " 0 0 0;font-size:0.75rem;line-height:1.333;", ";"], props => props.$spaciousdescription ? '16px' : '6px', props => props.theme.themeProp('color', props.theme.getColor('gray-400'), props.theme.getColor('gray-500')));
115
45
 
116
46
  export { Description, Switch, SwitchIndicator, SwitchIndicatorButton, SwitchIndicatorLabelText, SwitchLabel };
117
47
  //# sourceMappingURL=Switch.styled.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Switch.styled.js","sources":["../../../src/components/inputs/Switch/Switch.styled.js"],"sourcesContent":["import { math, rgba } from 'polished';\nimport styled, { css } from 'styled-components';\nimport { applyDefaultTheme } from '../../../utils/defaultTheme';\n\nconst switchButtonSize = '16px';\n\nconst shouldForwardProp = prop => {\n return prop !== 'theme' && !prop.startsWith('$');\n};\n\nexport const Switch = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n * {\n box-sizing: border-box;\n }\n\n display: flex;\n flex-direction: column;\n\n ${props =>\n props.readOnly &&\n css`\n opacity: 0.5;\n > * {\n pointer-events: none;\n user-select: text;\n }\n `}\n\n ${props =>\n props.disabled &&\n css`\n opacity: 0.5;\n cursor: not-allowed;\n * {\n pointer-events: none;\n user-select: text;\n }\n `}\n`;\n\nexport const SwitchIndicator = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n display: inline-block;\n position: relative;\n ${props =>\n props.theme.themeProp(\n 'background',\n props.theme.getColor('gray-900'),\n props.theme.getColor('gray-200')\n )}\n height: ${math(`${switchButtonSize} + 2px`)};\n width: 32px;\n border-radius: 20px;\n border: 1px solid;\n ${props =>\n props.theme.themeProp(\n 'border-color',\n props.theme.getColor('gray-500'),\n props.theme.getColor('gray-300')\n )}\n transition: background 200ms;\n`;\n\nexport const SwitchIndicatorButton = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n position: absolute;\n ${props =>\n props.theme.themeProp(\n 'background',\n props.theme.getColor('gray-200'),\n props.theme.getColor('white')\n )}\n height: ${switchButtonSize};\n width: ${switchButtonSize};\n border-radius: 50%;\n box-shadow: ${props => props.theme.getColor('gray-500')} 0 0px 2px 0px;\n transition: left 200ms;\n`;\n\nexport const SwitchIndicatorLabelText = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n padding-left: 10px;\n font-weight: 400;\n font-size: 0.875rem;\n line-height: 18px;\n\n ${props =>\n props.theme.themeProp(\n 'color',\n props.theme.getColor('gray-300'),\n props.theme.getColor('gray-600')\n )};\n`;\n\nexport const SwitchLabel = styled.label\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n display: inline-flex;\n margin-right: auto;\n cursor: pointer;\n\n input[type='checkbox'] {\n position: absolute;\n opacity: 0;\n }\n\n &:has(input[type='checkbox']:not(:checked)) {\n ${SwitchIndicatorButton} {\n left: 0;\n }\n }\n\n &:has(input[type='checkbox']:checked) {\n ${SwitchIndicatorButton} {\n left: calc(100% - ${switchButtonSize});\n }\n\n ${SwitchIndicator} {\n background: ${props => props.theme.getColor('emerald-500')};\n\n ${props =>\n props.theme.themeProp(\n 'border-color',\n props.theme.getColor('gray-400'),\n props.theme.getColor('gray-300'),\n 1\n )}\n }\n }\n\n &:has(input[type='checkbox']:focus-visible) {\n ${SwitchIndicatorButton} {\n ${props =>\n props.theme.themeProp(\n 'outline',\n `8px solid ${rgba(props.theme.getColor('emerald-500'), 0.5)}`,\n `8px solid ${rgba(props.theme.getColor('emerald-500'), 0.3)}`,\n 1\n )}\n }\n }\n`;\n\nexport const Description = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n margin: ${props => (props.$spaciousdescription ? '16px' : '6px')} 0 0 0;\n font-size: 0.75rem;\n line-height: 1.333;\n\n ${props =>\n props.theme.themeProp(\n 'color',\n props.theme.getColor('gray-400'),\n props.theme.getColor('gray-500')\n )};\n`;\n"],"names":["switchButtonSize","shouldForwardProp","prop","startsWith","Switch","styled","div","withConfig","attrs","applyDefaultTheme","props","readOnly","css","disabled","SwitchIndicator","theme","themeProp","getColor","math","SwitchIndicatorButton","SwitchIndicatorLabelText","SwitchLabel","label","rgba","Description","$spaciousdescription"],"mappings":";;;;AAIA,MAAMA,gBAAgB,GAAG,MAAM,CAAA;AAE/B,MAAMC,iBAAiB,GAAGC,IAAI,IAAI;EAChC,OAAOA,IAAI,KAAK,OAAO,IAAI,CAACA,IAAI,CAACC,UAAU,CAAC,GAAG,CAAC,CAAA;AAClD,CAAC,CAAA;AAEM,MAAMC,MAAM,GAAGC,MAAM,CAACC,GAAG,CAC7BC,UAAU,CAAC;AACVN,EAAAA,iBAAAA;AACF,CAAC,CAAC,CACDO,KAAK,CAACC,iBAAiB,CAAC,CAAA;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAA,EAAIC,KAAK,IACLA,KAAK,CAACC,QAAQ,IACdC,GAAG,CAAA;AACP;AACA;AACA;AACA;AACA;AACA,IAAK,CAAA,CAAA;AACL;AACA,EAAA,EAAIF,KAAK,IACLA,KAAK,CAACG,QAAQ,IACdD,GAAG,CAAA;AACP;AACA;AACA;AACA;AACA;AACA;AACA,IAAK,CAAA,CAAA;AACL,EAAC;AAEM,MAAME,eAAe,GAAGT,MAAM,CAACC,GAAG,CACtCC,UAAU,CAAC;AACVN,EAAAA,iBAAAA;AACF,CAAC,CAAC,CACDO,KAAK,CAACC,iBAAiB,CAAC,CAAA;AAC3B;AACA;AACA,EAAIC,EAAAA,KAAK,IACLA,KAAK,CAACK,KAAK,CAACC,SAAS,CACnB,YAAY,EACZN,KAAK,CA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EAAAA,iBAAAA;AACF,CAAC,CAAC,CACDO,KAAK,CAACC,iBAAiB,CAAC,CAAA;AAC3B,UAAYC,EAAAA,KAAK,IAAKA,KAAK,CAACe,oBAAoB,GAAG,MAAM,GAAG,KAAM,CAAA;AAClE;AACA;AACA;AACA,EAAIf,EAAAA,KAAK,IACLA,KAAK,CAACK,KAAK,CAACC,SAAS,CACnB,OAAO,EACPN,KAAK,CAACK,KAAK,CAACE,QAAQ,CAAC,UAAU,CAAC,EAChCP,KAAK,CAACK,KAAK,CAACE,QAAQ,CAAC,UAAU,CACjC,CAAC,CAAA;AACL;;;;"}
1
+ {"version":3,"file":"Switch.styled.js","sources":["../../../src/components/inputs/Switch/Switch.styled.ts"],"sourcesContent":["import { math, rgba } from 'polished';\nimport styled, { css } from 'styled-components';\nimport { applyDefaultTheme } from '../../../utils/defaultTheme';\n\nconst switchButtonSize = '16px';\n\n// Single-argument only — styled-components v5.1+ and v6 disagree on the second parameter.\nconst shouldForwardProp = (prop: string): boolean => {\n return prop !== 'theme' && !prop.startsWith('$');\n};\n\n// Defect: disabled/readOnly leak to <div> DOM as non-standard attributes and are TS2339 errors.\ninterface SwitchStyleProps {\n /** `disabled` — dims and blocks pointer events. Leaks to DOM. */\n disabled?: boolean;\n /** `readOnly` — dims and blocks pointer events. Leaks to DOM. */\n readOnly?: boolean;\n}\n\nexport const Switch = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs<SwitchStyleProps>(applyDefaultTheme)`\n * {\n box-sizing: border-box;\n }\n\n display: flex;\n flex-direction: column;\n\n ${props =>\n props.readOnly &&\n css`\n opacity: 0.5;\n > * {\n pointer-events: none;\n user-select: text;\n }\n `}\n\n ${props =>\n props.disabled &&\n css`\n opacity: 0.5;\n cursor: not-allowed;\n * {\n pointer-events: none;\n user-select: text;\n }\n `}\n`;\n\nexport const SwitchIndicator = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n display: inline-block;\n position: relative;\n ${props =>\n props.theme.themeProp(\n 'background',\n props.theme.getColor('gray-900'),\n props.theme.getColor('gray-200')\n )}\n height: ${math(`${switchButtonSize} + 2px`)};\n width: 32px;\n border-radius: 20px;\n border: 1px solid;\n ${props =>\n props.theme.themeProp(\n 'border-color',\n props.theme.getColor('gray-500'),\n props.theme.getColor('gray-300')\n )}\n transition: background 200ms;\n`;\n\nexport const SwitchIndicatorButton = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n position: absolute;\n ${props =>\n props.theme.themeProp(\n 'background',\n props.theme.getColor('gray-200'),\n props.theme.getColor('white')\n )}\n height: ${switchButtonSize};\n width: ${switchButtonSize};\n border-radius: 50%;\n box-shadow: ${props => props.theme.getColor('gray-500')} 0 0px 2px 0px;\n transition: left 200ms;\n`;\n\nexport const SwitchIndicatorLabelText = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n padding-left: 10px;\n font-weight: 400;\n font-size: 0.875rem;\n line-height: 18px;\n\n ${props =>\n props.theme.themeProp(\n 'color',\n props.theme.getColor('gray-300'),\n props.theme.getColor('gray-600')\n )};\n`;\n\nexport const SwitchLabel = styled.label\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n display: inline-flex;\n margin-right: auto;\n cursor: pointer;\n\n input[type='checkbox'] {\n position: absolute;\n opacity: 0;\n }\n\n &:has(input[type='checkbox']:not(:checked)) {\n ${SwitchIndicatorButton} {\n left: 0;\n }\n }\n\n &:has(input[type='checkbox']:checked) {\n ${SwitchIndicatorButton} {\n left: calc(100% - ${switchButtonSize});\n }\n\n ${SwitchIndicator} {\n background: ${props => props.theme.getColor('emerald-500')};\n\n ${props =>\n props.theme.themeProp(\n 'border-color',\n props.theme.getColor('gray-400'),\n props.theme.getColor('gray-300'),\n 1\n )}\n }\n }\n\n &:has(input[type='checkbox']:focus-visible) {\n ${SwitchIndicatorButton} {\n ${props =>\n props.theme.themeProp(\n 'outline',\n `8px solid ${rgba(props.theme.getColor('emerald-500'), 0.5)}`,\n `8px solid ${rgba(props.theme.getColor('emerald-500'), 0.3)}`,\n 1\n )}\n }\n }\n`;\n\nexport const Description = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs<{\n /** `spaciousDescription` — lower-case by convention; renaming would require two-file change. */\n $spaciousdescription?: boolean;\n }>(applyDefaultTheme)`\n margin: ${props => (props.$spaciousdescription ? '16px' : '6px')} 0 0 0;\n font-size: 0.75rem;\n line-height: 1.333;\n\n ${props =>\n props.theme.themeProp(\n 'color',\n props.theme.getColor('gray-400'),\n props.theme.getColor('gray-500')\n )};\n`;\n"],"names":["switchButtonSize","shouldForwardProp","prop","startsWith","Switch","styled","div","withConfig","attrs","applyDefaultTheme","displayName","componentId","props","readOnly","css","disabled","SwitchIndicator","theme","themeProp","getColor","math","SwitchIndicatorButton","SwitchIndicatorLabelText","SwitchLabel","label","rgba","Description","$spaciousdescription"],"mappings":";;;;AAIA,MAAMA,gBAAgB,GAAG,MAAM;AAG/B,MAAMC,iBAAiB,GAAIC,IAAY,IAAc;EACnD,OAAOA,IAAI,KAAK,OAAO,IAAI,CAACA,IAAI,CAACC,UAAU,CAAC,GAAG,CAAC;AAClD,CAAC;AAUM,MAAMC,MAAM,GAAGC,MAAM,CAACC,GAAG,CAC7BC,UAAU,CAAC;AACVN,EAAAA;AACF,CAAC,CAAC,CACDO,KAAK,CAAmBC,iBAAiB,CAAC,CAAAF,UAAA,CAAA;EAAAG,WAAA,EAAA,sBAAA;EAAAC,WAAA,EAAA;AAAA,CAAA,CAAA,CAAA,CAAA,8DAAA,EAAA,GAAA,EAAA,EAAA,CAAA,EAQzCC,KAAK,IACLA,KAAK,CAACC,QAAQ,IACdC,GAAG,CAAA,CAAA,wDAAA,CAAA,CAMF,EAEDF,KAAK,IACLA,KAAK,CAACG,QAAQ,IACdD,GAAG,6EAOF;AAGE,MAAME,eAAe,GAAGX,MAAM,CAACC,GAAG,CACtCC,UAAU,CAAC;AACVN,EAAAA;AACF,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