@razorpay/blade 11.36.2 → 11.38.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 (560) hide show
  1. package/build/lib/native/components/Accordion/Accordion.js +2 -1
  2. package/build/lib/native/components/Accordion/Accordion.js.map +1 -1
  3. package/build/lib/native/components/Accordion/AccordionItem.js +3 -1
  4. package/build/lib/native/components/Accordion/AccordionItem.js.map +1 -1
  5. package/build/lib/native/components/Accordion/AccordionItemBody.js +3 -2
  6. package/build/lib/native/components/Accordion/AccordionItemBody.js.map +1 -1
  7. package/build/lib/native/components/Accordion/AccordionItemHeader.js +3 -2
  8. package/build/lib/native/components/Accordion/AccordionItemHeader.js.map +1 -1
  9. package/build/lib/native/components/ActionList/ActionList.js +3 -1
  10. package/build/lib/native/components/ActionList/ActionList.js.map +1 -1
  11. package/build/lib/native/components/ActionList/ActionListItem.js +3 -2
  12. package/build/lib/native/components/ActionList/ActionListItem.js.map +1 -1
  13. package/build/lib/native/components/Alert/Alert.js +2 -1
  14. package/build/lib/native/components/Alert/Alert.js.map +1 -1
  15. package/build/lib/native/components/Amount/Amount.js +2 -1
  16. package/build/lib/native/components/Amount/Amount.js.map +1 -1
  17. package/build/lib/native/components/Badge/Badge.js +2 -1
  18. package/build/lib/native/components/Badge/Badge.js.map +1 -1
  19. package/build/lib/native/components/BaseHeaderFooter/BaseFooter.js +3 -1
  20. package/build/lib/native/components/BaseHeaderFooter/BaseFooter.js.map +1 -1
  21. package/build/lib/native/components/BaseHeaderFooter/BaseHeader.js +3 -2
  22. package/build/lib/native/components/BaseHeaderFooter/BaseHeader.js.map +1 -1
  23. package/build/lib/native/components/Box/BaseBox/types/propsTypes.js.map +1 -1
  24. package/build/lib/native/components/Box/Box.js +2 -1
  25. package/build/lib/native/components/Box/Box.js.map +1 -1
  26. package/build/lib/native/components/Button/BaseButton/BaseButton.js +2 -1
  27. package/build/lib/native/components/Button/BaseButton/BaseButton.js.map +1 -1
  28. package/build/lib/native/components/Button/Button/Button.js +2 -1
  29. package/build/lib/native/components/Button/Button/Button.js.map +1 -1
  30. package/build/lib/native/components/Button/IconButton/IconButton.js +3 -1
  31. package/build/lib/native/components/Button/IconButton/IconButton.js.map +1 -1
  32. package/build/lib/native/components/Card/Card.js +2 -1
  33. package/build/lib/native/components/Card/Card.js.map +1 -1
  34. package/build/lib/native/components/Card/CardFooter.js +3 -2
  35. package/build/lib/native/components/Card/CardFooter.js.map +1 -1
  36. package/build/lib/native/components/Card/CardHeader.js +3 -2
  37. package/build/lib/native/components/Card/CardHeader.js.map +1 -1
  38. package/build/lib/native/components/Checkbox/Checkbox.js +3 -2
  39. package/build/lib/native/components/Checkbox/Checkbox.js.map +1 -1
  40. package/build/lib/native/components/Checkbox/CheckboxGroup/CheckboxGroup.js +2 -1
  41. package/build/lib/native/components/Checkbox/CheckboxGroup/CheckboxGroup.js.map +1 -1
  42. package/build/lib/native/components/Chip/Chip.js +2 -1
  43. package/build/lib/native/components/Chip/Chip.js.map +1 -1
  44. package/build/lib/native/components/Chip/ChipGroup.js +2 -1
  45. package/build/lib/native/components/Chip/ChipGroup.js.map +1 -1
  46. package/build/lib/native/components/Collapsible/Collapsible.js +2 -1
  47. package/build/lib/native/components/Collapsible/Collapsible.js.map +1 -1
  48. package/build/lib/native/components/Collapsible/CollapsibleBody.js +3 -1
  49. package/build/lib/native/components/Collapsible/CollapsibleBody.js.map +1 -1
  50. package/build/lib/native/components/Collapsible/CollapsibleButton.js +3 -1
  51. package/build/lib/native/components/Collapsible/CollapsibleButton.js.map +1 -1
  52. package/build/lib/native/components/Collapsible/CollapsibleLink.js +2 -1
  53. package/build/lib/native/components/Collapsible/CollapsibleLink.js.map +1 -1
  54. package/build/lib/native/components/Counter/Counter.js +2 -1
  55. package/build/lib/native/components/Counter/Counter.js.map +1 -1
  56. package/build/lib/native/components/Dropdown/Dropdown.js +2 -1
  57. package/build/lib/native/components/Dropdown/Dropdown.js.map +1 -1
  58. package/build/lib/native/components/Dropdown/DropdownButton.js +1 -1
  59. package/build/lib/native/components/Dropdown/DropdownButton.js.map +1 -1
  60. package/build/lib/native/components/Dropdown/DropdownHeaderFooter.js +3 -1
  61. package/build/lib/native/components/Dropdown/DropdownHeaderFooter.js.map +1 -1
  62. package/build/lib/native/components/Dropdown/DropdownLink.js +2 -1
  63. package/build/lib/native/components/Dropdown/DropdownLink.js.map +1 -1
  64. package/build/lib/native/components/Form/Selector/SelectorGroupField.js +3 -1
  65. package/build/lib/native/components/Form/Selector/SelectorGroupField.js.map +1 -1
  66. package/build/lib/native/components/Icons/IndiaFlagIcon/IndiaFlagIcon.js +12 -0
  67. package/build/lib/native/components/Icons/IndiaFlagIcon/IndiaFlagIcon.js.map +1 -0
  68. package/build/lib/native/components/Icons/MagicKonnectIcon/MagicKonnectIcon.js +12 -0
  69. package/build/lib/native/components/Icons/MagicKonnectIcon/MagicKonnectIcon.js.map +1 -0
  70. package/build/lib/native/components/Icons/WorldwideIcon/WorldwideIcon.js +12 -0
  71. package/build/lib/native/components/Icons/WorldwideIcon/WorldwideIcon.js.map +1 -0
  72. package/build/lib/native/components/Indicator/Indicator.js +2 -1
  73. package/build/lib/native/components/Indicator/Indicator.js.map +1 -1
  74. package/build/lib/native/components/Input/BaseInput/BaseInput.js +2 -1
  75. package/build/lib/native/components/Input/BaseInput/BaseInput.js.map +1 -1
  76. package/build/lib/native/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js +2 -1
  77. package/build/lib/native/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js.map +1 -1
  78. package/build/lib/native/components/Input/DropdownInputTriggers/SelectInput.js +2 -1
  79. package/build/lib/native/components/Input/DropdownInputTriggers/SelectInput.js.map +1 -1
  80. package/build/lib/native/components/Input/OTPInput/OTPInput.js +2 -1
  81. package/build/lib/native/components/Input/OTPInput/OTPInput.js.map +1 -1
  82. package/build/lib/native/components/Input/PasswordInput/PasswordInput.js +1 -1
  83. package/build/lib/native/components/Input/PasswordInput/PasswordInput.js.map +1 -1
  84. package/build/lib/native/components/Input/SearchInput/SearchInput.js +1 -1
  85. package/build/lib/native/components/Input/SearchInput/SearchInput.js.map +1 -1
  86. package/build/lib/native/components/Input/TextArea/TextArea.js +1 -1
  87. package/build/lib/native/components/Input/TextArea/TextArea.js.map +1 -1
  88. package/build/lib/native/components/Input/TextInput/TextInput.js +1 -1
  89. package/build/lib/native/components/Input/TextInput/TextInput.js.map +1 -1
  90. package/build/lib/native/components/Link/BaseLink/BaseLink.js +2 -1
  91. package/build/lib/native/components/Link/BaseLink/BaseLink.js.map +1 -1
  92. package/build/lib/native/components/Link/Link/Link.js +2 -1
  93. package/build/lib/native/components/Link/Link/Link.js.map +1 -1
  94. package/build/lib/native/components/ProgressBar/ProgressBar.js +2 -1
  95. package/build/lib/native/components/ProgressBar/ProgressBar.js.map +1 -1
  96. package/build/lib/native/components/Radio/Radio.js +2 -1
  97. package/build/lib/native/components/Radio/Radio.js.map +1 -1
  98. package/build/lib/native/components/Radio/RadioGroup/RadioGroup.js +2 -1
  99. package/build/lib/native/components/Radio/RadioGroup/RadioGroup.js.map +1 -1
  100. package/build/lib/native/components/StepGroup/tokens.js +1 -1
  101. package/build/lib/native/components/StepGroup/tokens.js.map +1 -1
  102. package/build/lib/native/components/Switch/Switch.js +2 -1
  103. package/build/lib/native/components/Switch/Switch.js.map +1 -1
  104. package/build/lib/native/components/Tag/Tag.js +2 -1
  105. package/build/lib/native/components/Tag/Tag.js.map +1 -1
  106. package/build/lib/native/components/index.js +3 -0
  107. package/build/lib/native/components/index.js.map +1 -1
  108. package/build/lib/native/tokens/global/size.js +1 -1
  109. package/build/lib/native/tokens/global/size.js.map +1 -1
  110. package/build/lib/native/utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js +7 -0
  111. package/build/lib/native/utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js.map +1 -0
  112. package/build/lib/web/development/components/Accordion/Accordion.js +5 -3
  113. package/build/lib/web/development/components/Accordion/Accordion.js.map +1 -1
  114. package/build/lib/web/development/components/Accordion/AccordionButton.web.js +8 -3
  115. package/build/lib/web/development/components/Accordion/AccordionButton.web.js.map +1 -1
  116. package/build/lib/web/development/components/Accordion/AccordionItem.js +8 -3
  117. package/build/lib/web/development/components/Accordion/AccordionItem.js.map +1 -1
  118. package/build/lib/web/development/components/Accordion/AccordionItemBody.js +8 -3
  119. package/build/lib/web/development/components/Accordion/AccordionItemBody.js.map +1 -1
  120. package/build/lib/web/development/components/Accordion/AccordionItemHeader.js +10 -4
  121. package/build/lib/web/development/components/Accordion/AccordionItemHeader.js.map +1 -1
  122. package/build/lib/web/development/components/ActionList/ActionList.js +9 -4
  123. package/build/lib/web/development/components/ActionList/ActionList.js.map +1 -1
  124. package/build/lib/web/development/components/ActionList/ActionListBox.web.js +8 -3
  125. package/build/lib/web/development/components/ActionList/ActionListBox.web.js.map +1 -1
  126. package/build/lib/web/development/components/ActionList/ActionListItem.js +10 -5
  127. package/build/lib/web/development/components/ActionList/ActionListItem.js.map +1 -1
  128. package/build/lib/web/development/components/Alert/Alert.js +5 -3
  129. package/build/lib/web/development/components/Alert/Alert.js.map +1 -1
  130. package/build/lib/web/development/components/Amount/Amount.js +5 -8
  131. package/build/lib/web/development/components/Amount/Amount.js.map +1 -1
  132. package/build/lib/web/development/components/Avatar/Avatar.web.js +5 -3
  133. package/build/lib/web/development/components/Avatar/Avatar.web.js.map +1 -1
  134. package/build/lib/web/development/components/Avatar/AvatarGroup.web.js +5 -3
  135. package/build/lib/web/development/components/Avatar/AvatarGroup.web.js.map +1 -1
  136. package/build/lib/web/development/components/Badge/Badge.js +5 -3
  137. package/build/lib/web/development/components/Badge/Badge.js.map +1 -1
  138. package/build/lib/web/development/components/BaseHeaderFooter/BaseFooter.js +8 -3
  139. package/build/lib/web/development/components/BaseHeaderFooter/BaseFooter.js.map +1 -1
  140. package/build/lib/web/development/components/BaseHeaderFooter/BaseHeader.js +8 -3
  141. package/build/lib/web/development/components/BaseHeaderFooter/BaseHeader.js.map +1 -1
  142. package/build/lib/web/development/components/BottomNav/BottomNav.web.js +12 -8
  143. package/build/lib/web/development/components/BottomNav/BottomNav.web.js.map +1 -1
  144. package/build/lib/web/development/components/BottomSheet/BottomSheet.web.js +9 -3
  145. package/build/lib/web/development/components/BottomSheet/BottomSheet.web.js.map +1 -1
  146. package/build/lib/web/development/components/BottomSheet/BottomSheetBody.web.js +8 -3
  147. package/build/lib/web/development/components/BottomSheet/BottomSheetBody.web.js.map +1 -1
  148. package/build/lib/web/development/components/BottomSheet/BottomSheetFooter.web.js +8 -3
  149. package/build/lib/web/development/components/BottomSheet/BottomSheetFooter.web.js.map +1 -1
  150. package/build/lib/web/development/components/BottomSheet/BottomSheetHeader.web.js +8 -3
  151. package/build/lib/web/development/components/BottomSheet/BottomSheetHeader.web.js.map +1 -1
  152. package/build/lib/web/development/components/Box/BaseBox/BaseBox.web.js +4 -2
  153. package/build/lib/web/development/components/Box/BaseBox/BaseBox.web.js.map +1 -1
  154. package/build/lib/web/development/components/Box/BaseBox/types/propsTypes.js.map +1 -1
  155. package/build/lib/web/development/components/Box/Box.js +4 -2
  156. package/build/lib/web/development/components/Box/Box.js.map +1 -1
  157. package/build/lib/web/development/components/Breadcrumb/Breadcrumb.web.js +6 -4
  158. package/build/lib/web/development/components/Breadcrumb/Breadcrumb.web.js.map +1 -1
  159. package/build/lib/web/development/components/Breadcrumb/BreadcrumbItem.web.js +13 -4
  160. package/build/lib/web/development/components/Breadcrumb/BreadcrumbItem.web.js.map +1 -1
  161. package/build/lib/web/development/components/Button/BaseButton/BaseButton.js +4 -2
  162. package/build/lib/web/development/components/Button/BaseButton/BaseButton.js.map +1 -1
  163. package/build/lib/web/development/components/Button/Button/Button.js +4 -2
  164. package/build/lib/web/development/components/Button/Button/Button.js.map +1 -1
  165. package/build/lib/web/development/components/Button/IconButton/IconButton.js +11 -5
  166. package/build/lib/web/development/components/Button/IconButton/IconButton.js.map +1 -1
  167. package/build/lib/web/development/components/Button/IconButton/StyledIconButton.web.js +8 -3
  168. package/build/lib/web/development/components/Button/IconButton/StyledIconButton.web.js.map +1 -1
  169. package/build/lib/web/development/components/ButtonGroup/ButtonGroup.web.js +5 -3
  170. package/build/lib/web/development/components/ButtonGroup/ButtonGroup.web.js.map +1 -1
  171. package/build/lib/web/development/components/Card/Card.js +11 -7
  172. package/build/lib/web/development/components/Card/Card.js.map +1 -1
  173. package/build/lib/web/development/components/Card/CardFooter.js +22 -11
  174. package/build/lib/web/development/components/Card/CardFooter.js.map +1 -1
  175. package/build/lib/web/development/components/Card/CardHeader.js +13 -6
  176. package/build/lib/web/development/components/Card/CardHeader.js.map +1 -1
  177. package/build/lib/web/development/components/Carousel/Carousel.web.js +5 -3
  178. package/build/lib/web/development/components/Carousel/Carousel.web.js.map +1 -1
  179. package/build/lib/web/development/components/Carousel/CarouselItem.web.js +9 -3
  180. package/build/lib/web/development/components/Carousel/CarouselItem.web.js.map +1 -1
  181. package/build/lib/web/development/components/Checkbox/Checkbox.js +6 -4
  182. package/build/lib/web/development/components/Checkbox/Checkbox.js.map +1 -1
  183. package/build/lib/web/development/components/Checkbox/CheckboxGroup/CheckboxGroup.js +8 -5
  184. package/build/lib/web/development/components/Checkbox/CheckboxGroup/CheckboxGroup.js.map +1 -1
  185. package/build/lib/web/development/components/Chip/Chip.js +5 -3
  186. package/build/lib/web/development/components/Chip/Chip.js.map +1 -1
  187. package/build/lib/web/development/components/Chip/ChipGroup.js +8 -5
  188. package/build/lib/web/development/components/Chip/ChipGroup.js.map +1 -1
  189. package/build/lib/web/development/components/Collapsible/Collapsible.js +5 -3
  190. package/build/lib/web/development/components/Collapsible/Collapsible.js.map +1 -1
  191. package/build/lib/web/development/components/Collapsible/CollapsibleBody.js +8 -3
  192. package/build/lib/web/development/components/Collapsible/CollapsibleBody.js.map +1 -1
  193. package/build/lib/web/development/components/Collapsible/CollapsibleButton.js +13 -4
  194. package/build/lib/web/development/components/Collapsible/CollapsibleButton.js.map +1 -1
  195. package/build/lib/web/development/components/Collapsible/CollapsibleLink.js +5 -3
  196. package/build/lib/web/development/components/Collapsible/CollapsibleLink.js.map +1 -1
  197. package/build/lib/web/development/components/Counter/Counter.js +5 -3
  198. package/build/lib/web/development/components/Counter/Counter.js.map +1 -1
  199. package/build/lib/web/development/components/DatePicker/DateInput.web.js +11 -7
  200. package/build/lib/web/development/components/DatePicker/DateInput.web.js.map +1 -1
  201. package/build/lib/web/development/components/DatePicker/DatePicker.web.js +4 -2
  202. package/build/lib/web/development/components/DatePicker/DatePicker.web.js.map +1 -1
  203. package/build/lib/web/development/components/Drawer/Drawer.web.js +8 -3
  204. package/build/lib/web/development/components/Drawer/Drawer.web.js.map +1 -1
  205. package/build/lib/web/development/components/Drawer/DrawerSubcomponents.web.js +11 -3
  206. package/build/lib/web/development/components/Drawer/DrawerSubcomponents.web.js.map +1 -1
  207. package/build/lib/web/development/components/Dropdown/Dropdown.js +5 -3
  208. package/build/lib/web/development/components/Dropdown/Dropdown.js.map +1 -1
  209. package/build/lib/web/development/components/Dropdown/DropdownButton.js +2 -2
  210. package/build/lib/web/development/components/Dropdown/DropdownButton.js.map +1 -1
  211. package/build/lib/web/development/components/Dropdown/DropdownHeaderFooter.js +8 -3
  212. package/build/lib/web/development/components/Dropdown/DropdownHeaderFooter.js.map +1 -1
  213. package/build/lib/web/development/components/Dropdown/DropdownLink.js +5 -3
  214. package/build/lib/web/development/components/Dropdown/DropdownLink.js.map +1 -1
  215. package/build/lib/web/development/components/FileUpload/FileUpload.web.js +6 -4
  216. package/build/lib/web/development/components/FileUpload/FileUpload.web.js.map +1 -1
  217. package/build/lib/web/development/components/Form/Selector/SelectorGroupField.js +8 -3
  218. package/build/lib/web/development/components/Form/Selector/SelectorGroupField.js.map +1 -1
  219. package/build/lib/web/development/components/Form/Selector/SelectorInput.web.js +8 -3
  220. package/build/lib/web/development/components/Form/Selector/SelectorInput.web.js.map +1 -1
  221. package/build/lib/web/development/components/Icons/IndiaFlagIcon/IndiaFlagIcon.js +39 -0
  222. package/build/lib/web/development/components/Icons/IndiaFlagIcon/IndiaFlagIcon.js.map +1 -0
  223. package/build/lib/web/development/components/Icons/IndiaFlagIcon/index.js +2 -0
  224. package/build/lib/web/development/components/Icons/IndiaFlagIcon/index.js.map +1 -0
  225. package/build/lib/web/development/components/Icons/MagicKonnectIcon/MagicKonnectIcon.js +49 -0
  226. package/build/lib/web/development/components/Icons/MagicKonnectIcon/MagicKonnectIcon.js.map +1 -0
  227. package/build/lib/web/development/components/Icons/MagicKonnectIcon/index.js +2 -0
  228. package/build/lib/web/development/components/Icons/MagicKonnectIcon/index.js.map +1 -0
  229. package/build/lib/web/development/components/Icons/WorldwideIcon/WorldwideIcon.js +39 -0
  230. package/build/lib/web/development/components/Icons/WorldwideIcon/WorldwideIcon.js.map +1 -0
  231. package/build/lib/web/development/components/Icons/WorldwideIcon/index.js +2 -0
  232. package/build/lib/web/development/components/Icons/WorldwideIcon/index.js.map +1 -0
  233. package/build/lib/web/development/components/Icons/index.js +3 -0
  234. package/build/lib/web/development/components/Icons/index.js.map +1 -1
  235. package/build/lib/web/development/components/Indicator/Indicator.js +5 -3
  236. package/build/lib/web/development/components/Indicator/Indicator.js.map +1 -1
  237. package/build/lib/web/development/components/Input/BaseInput/BaseInput.js +6 -4
  238. package/build/lib/web/development/components/Input/BaseInput/BaseInput.js.map +1 -1
  239. package/build/lib/web/development/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js +5 -2
  240. package/build/lib/web/development/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js.map +1 -1
  241. package/build/lib/web/development/components/Input/DropdownInputTriggers/SelectInput.js +5 -3
  242. package/build/lib/web/development/components/Input/DropdownInputTriggers/SelectInput.js.map +1 -1
  243. package/build/lib/web/development/components/Input/OTPInput/OTPInput.js +6 -4
  244. package/build/lib/web/development/components/Input/OTPInput/OTPInput.js.map +1 -1
  245. package/build/lib/web/development/components/Input/PasswordInput/PasswordInput.js +2 -2
  246. package/build/lib/web/development/components/Input/PasswordInput/PasswordInput.js.map +1 -1
  247. package/build/lib/web/development/components/Input/PhoneNumberInput/PhoneNumberInput.web.js +2 -2
  248. package/build/lib/web/development/components/Input/PhoneNumberInput/PhoneNumberInput.web.js.map +1 -1
  249. package/build/lib/web/development/components/Input/SearchInput/SearchInput.js +2 -2
  250. package/build/lib/web/development/components/Input/SearchInput/SearchInput.js.map +1 -1
  251. package/build/lib/web/development/components/Input/TextArea/TextArea.js +2 -2
  252. package/build/lib/web/development/components/Input/TextArea/TextArea.js.map +1 -1
  253. package/build/lib/web/development/components/Input/TextInput/TextInput.js +2 -2
  254. package/build/lib/web/development/components/Input/TextInput/TextInput.js.map +1 -1
  255. package/build/lib/web/development/components/Link/BaseLink/BaseLink.js +5 -3
  256. package/build/lib/web/development/components/Link/BaseLink/BaseLink.js.map +1 -1
  257. package/build/lib/web/development/components/Link/Link/Link.js +4 -2
  258. package/build/lib/web/development/components/Link/Link/Link.js.map +1 -1
  259. package/build/lib/web/development/components/Menu/VisualSubComponents/MenuHeaderFooter.web.js +18 -8
  260. package/build/lib/web/development/components/Menu/VisualSubComponents/MenuHeaderFooter.web.js.map +1 -1
  261. package/build/lib/web/development/components/Modal/Modal.web.js +10 -4
  262. package/build/lib/web/development/components/Modal/Modal.web.js.map +1 -1
  263. package/build/lib/web/development/components/Modal/ModalBody.web.js +9 -3
  264. package/build/lib/web/development/components/Modal/ModalBody.web.js.map +1 -1
  265. package/build/lib/web/development/components/Modal/ModalFooter.web.js +7 -2
  266. package/build/lib/web/development/components/Modal/ModalFooter.web.js.map +1 -1
  267. package/build/lib/web/development/components/Modal/ModalHeader.web.js +14 -6
  268. package/build/lib/web/development/components/Modal/ModalHeader.web.js.map +1 -1
  269. package/build/lib/web/development/components/Popover/Popover.web.js +8 -3
  270. package/build/lib/web/development/components/Popover/Popover.web.js.map +1 -1
  271. package/build/lib/web/development/components/Popover/PopoverInteractiveWrapper.web.js.map +1 -1
  272. package/build/lib/web/development/components/ProgressBar/ProgressBar.js +5 -3
  273. package/build/lib/web/development/components/ProgressBar/ProgressBar.js.map +1 -1
  274. package/build/lib/web/development/components/Radio/Radio.js +6 -4
  275. package/build/lib/web/development/components/Radio/Radio.js.map +1 -1
  276. package/build/lib/web/development/components/Radio/RadioGroup/RadioGroup.js +8 -5
  277. package/build/lib/web/development/components/Radio/RadioGroup/RadioGroup.js.map +1 -1
  278. package/build/lib/web/development/components/SideNav/SideNav.web.js +5 -3
  279. package/build/lib/web/development/components/SideNav/SideNav.web.js.map +1 -1
  280. package/build/lib/web/development/components/SideNav/SideNavItems/SideNavItem.web.js +13 -4
  281. package/build/lib/web/development/components/SideNav/SideNavItems/SideNavItem.web.js.map +1 -1
  282. package/build/lib/web/development/components/SideNav/SideNavItems/SideNavLink.web.js +10 -4
  283. package/build/lib/web/development/components/SideNav/SideNavItems/SideNavLink.web.js.map +1 -1
  284. package/build/lib/web/development/components/SideNav/SideNavSection.web.js +10 -4
  285. package/build/lib/web/development/components/SideNav/SideNavSection.web.js.map +1 -1
  286. package/build/lib/web/development/components/StepGroup/StepGroup.web.js +5 -3
  287. package/build/lib/web/development/components/StepGroup/StepGroup.web.js.map +1 -1
  288. package/build/lib/web/development/components/StepGroup/StepItem.web.js +13 -7
  289. package/build/lib/web/development/components/StepGroup/StepItem.web.js.map +1 -1
  290. package/build/lib/web/development/components/StepGroup/StepLine.web.js +79 -42
  291. package/build/lib/web/development/components/StepGroup/StepLine.web.js.map +1 -1
  292. package/build/lib/web/development/components/StepGroup/tokens.js +6 -6
  293. package/build/lib/web/development/components/StepGroup/tokens.js.map +1 -1
  294. package/build/lib/web/development/components/Switch/Switch.js +5 -3
  295. package/build/lib/web/development/components/Switch/Switch.js.map +1 -1
  296. package/build/lib/web/development/components/Table/Table.web.js +9 -7
  297. package/build/lib/web/development/components/Table/Table.web.js.map +1 -1
  298. package/build/lib/web/development/components/Table/TableBody.web.js +18 -9
  299. package/build/lib/web/development/components/Table/TableBody.web.js.map +1 -1
  300. package/build/lib/web/development/components/Table/TableFooter.web.js +18 -9
  301. package/build/lib/web/development/components/Table/TableFooter.web.js.map +1 -1
  302. package/build/lib/web/development/components/Table/TableHeader.web.js +18 -9
  303. package/build/lib/web/development/components/Table/TableHeader.web.js.map +1 -1
  304. package/build/lib/web/development/components/Table/TablePagination.web.js +10 -4
  305. package/build/lib/web/development/components/Table/TablePagination.web.js.map +1 -1
  306. package/build/lib/web/development/components/Table/TableToolbar.web.js +13 -8
  307. package/build/lib/web/development/components/Table/TableToolbar.web.js.map +1 -1
  308. package/build/lib/web/development/components/Tabs/TabItem.web.js +9 -5
  309. package/build/lib/web/development/components/Tabs/TabItem.web.js.map +1 -1
  310. package/build/lib/web/development/components/Tabs/TabList.web.js +5 -3
  311. package/build/lib/web/development/components/Tabs/TabList.web.js.map +1 -1
  312. package/build/lib/web/development/components/Tabs/TabPanel.web.js +10 -5
  313. package/build/lib/web/development/components/Tabs/TabPanel.web.js.map +1 -1
  314. package/build/lib/web/development/components/Tabs/Tabs.web.js +8 -3
  315. package/build/lib/web/development/components/Tabs/Tabs.web.js.map +1 -1
  316. package/build/lib/web/development/components/Tag/Tag.js +6 -4
  317. package/build/lib/web/development/components/Tag/Tag.js.map +1 -1
  318. package/build/lib/web/development/components/Toast/ToastContainer.web.js +8 -3
  319. package/build/lib/web/development/components/Toast/ToastContainer.web.js.map +1 -1
  320. package/build/lib/web/development/components/Tooltip/Tooltip.web.js +8 -3
  321. package/build/lib/web/development/components/Tooltip/Tooltip.web.js.map +1 -1
  322. package/build/lib/web/development/components/TopNav/TabNav/TabNav.web.js +6 -3
  323. package/build/lib/web/development/components/TopNav/TabNav/TabNav.web.js.map +1 -1
  324. package/build/lib/web/development/components/TopNav/TopNav.web.js +8 -5
  325. package/build/lib/web/development/components/TopNav/TopNav.web.js.map +1 -1
  326. package/build/lib/web/development/components/index.js +3 -0
  327. package/build/lib/web/development/components/index.js.map +1 -1
  328. package/build/lib/web/development/tokens/global/size.js +3 -1
  329. package/build/lib/web/development/tokens/global/size.js.map +1 -1
  330. package/build/lib/web/development/utils/makeAnalyticsAttribute/index.js +2 -0
  331. package/build/lib/web/development/utils/makeAnalyticsAttribute/index.js.map +1 -0
  332. package/build/lib/web/development/utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js +20 -0
  333. package/build/lib/web/development/utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js.map +1 -0
  334. package/build/lib/web/production/components/Accordion/Accordion.js +5 -3
  335. package/build/lib/web/production/components/Accordion/Accordion.js.map +1 -1
  336. package/build/lib/web/production/components/Accordion/AccordionButton.web.js +8 -3
  337. package/build/lib/web/production/components/Accordion/AccordionButton.web.js.map +1 -1
  338. package/build/lib/web/production/components/Accordion/AccordionItem.js +8 -3
  339. package/build/lib/web/production/components/Accordion/AccordionItem.js.map +1 -1
  340. package/build/lib/web/production/components/Accordion/AccordionItemBody.js +8 -3
  341. package/build/lib/web/production/components/Accordion/AccordionItemBody.js.map +1 -1
  342. package/build/lib/web/production/components/Accordion/AccordionItemHeader.js +10 -4
  343. package/build/lib/web/production/components/Accordion/AccordionItemHeader.js.map +1 -1
  344. package/build/lib/web/production/components/ActionList/ActionList.js +9 -4
  345. package/build/lib/web/production/components/ActionList/ActionList.js.map +1 -1
  346. package/build/lib/web/production/components/ActionList/ActionListBox.web.js +8 -3
  347. package/build/lib/web/production/components/ActionList/ActionListBox.web.js.map +1 -1
  348. package/build/lib/web/production/components/ActionList/ActionListItem.js +10 -5
  349. package/build/lib/web/production/components/ActionList/ActionListItem.js.map +1 -1
  350. package/build/lib/web/production/components/Alert/Alert.js +5 -3
  351. package/build/lib/web/production/components/Alert/Alert.js.map +1 -1
  352. package/build/lib/web/production/components/Amount/Amount.js +5 -8
  353. package/build/lib/web/production/components/Amount/Amount.js.map +1 -1
  354. package/build/lib/web/production/components/Avatar/Avatar.web.js +5 -3
  355. package/build/lib/web/production/components/Avatar/Avatar.web.js.map +1 -1
  356. package/build/lib/web/production/components/Avatar/AvatarGroup.web.js +5 -3
  357. package/build/lib/web/production/components/Avatar/AvatarGroup.web.js.map +1 -1
  358. package/build/lib/web/production/components/Badge/Badge.js +5 -3
  359. package/build/lib/web/production/components/Badge/Badge.js.map +1 -1
  360. package/build/lib/web/production/components/BaseHeaderFooter/BaseFooter.js +8 -3
  361. package/build/lib/web/production/components/BaseHeaderFooter/BaseFooter.js.map +1 -1
  362. package/build/lib/web/production/components/BaseHeaderFooter/BaseHeader.js +8 -3
  363. package/build/lib/web/production/components/BaseHeaderFooter/BaseHeader.js.map +1 -1
  364. package/build/lib/web/production/components/BottomNav/BottomNav.web.js +12 -8
  365. package/build/lib/web/production/components/BottomNav/BottomNav.web.js.map +1 -1
  366. package/build/lib/web/production/components/BottomSheet/BottomSheet.web.js +9 -3
  367. package/build/lib/web/production/components/BottomSheet/BottomSheet.web.js.map +1 -1
  368. package/build/lib/web/production/components/BottomSheet/BottomSheetBody.web.js +8 -3
  369. package/build/lib/web/production/components/BottomSheet/BottomSheetBody.web.js.map +1 -1
  370. package/build/lib/web/production/components/BottomSheet/BottomSheetFooter.web.js +8 -3
  371. package/build/lib/web/production/components/BottomSheet/BottomSheetFooter.web.js.map +1 -1
  372. package/build/lib/web/production/components/BottomSheet/BottomSheetHeader.web.js +8 -3
  373. package/build/lib/web/production/components/BottomSheet/BottomSheetHeader.web.js.map +1 -1
  374. package/build/lib/web/production/components/Box/BaseBox/BaseBox.web.js +4 -2
  375. package/build/lib/web/production/components/Box/BaseBox/BaseBox.web.js.map +1 -1
  376. package/build/lib/web/production/components/Box/BaseBox/types/propsTypes.js.map +1 -1
  377. package/build/lib/web/production/components/Box/Box.js +4 -2
  378. package/build/lib/web/production/components/Box/Box.js.map +1 -1
  379. package/build/lib/web/production/components/Breadcrumb/Breadcrumb.web.js +6 -4
  380. package/build/lib/web/production/components/Breadcrumb/Breadcrumb.web.js.map +1 -1
  381. package/build/lib/web/production/components/Breadcrumb/BreadcrumbItem.web.js +13 -4
  382. package/build/lib/web/production/components/Breadcrumb/BreadcrumbItem.web.js.map +1 -1
  383. package/build/lib/web/production/components/Button/BaseButton/BaseButton.js +4 -2
  384. package/build/lib/web/production/components/Button/BaseButton/BaseButton.js.map +1 -1
  385. package/build/lib/web/production/components/Button/Button/Button.js +4 -2
  386. package/build/lib/web/production/components/Button/Button/Button.js.map +1 -1
  387. package/build/lib/web/production/components/Button/IconButton/IconButton.js +11 -5
  388. package/build/lib/web/production/components/Button/IconButton/IconButton.js.map +1 -1
  389. package/build/lib/web/production/components/Button/IconButton/StyledIconButton.web.js +8 -3
  390. package/build/lib/web/production/components/Button/IconButton/StyledIconButton.web.js.map +1 -1
  391. package/build/lib/web/production/components/ButtonGroup/ButtonGroup.web.js +5 -3
  392. package/build/lib/web/production/components/ButtonGroup/ButtonGroup.web.js.map +1 -1
  393. package/build/lib/web/production/components/Card/Card.js +11 -7
  394. package/build/lib/web/production/components/Card/Card.js.map +1 -1
  395. package/build/lib/web/production/components/Card/CardFooter.js +22 -11
  396. package/build/lib/web/production/components/Card/CardFooter.js.map +1 -1
  397. package/build/lib/web/production/components/Card/CardHeader.js +13 -6
  398. package/build/lib/web/production/components/Card/CardHeader.js.map +1 -1
  399. package/build/lib/web/production/components/Carousel/Carousel.web.js +5 -3
  400. package/build/lib/web/production/components/Carousel/Carousel.web.js.map +1 -1
  401. package/build/lib/web/production/components/Carousel/CarouselItem.web.js +9 -3
  402. package/build/lib/web/production/components/Carousel/CarouselItem.web.js.map +1 -1
  403. package/build/lib/web/production/components/Checkbox/Checkbox.js +6 -4
  404. package/build/lib/web/production/components/Checkbox/Checkbox.js.map +1 -1
  405. package/build/lib/web/production/components/Checkbox/CheckboxGroup/CheckboxGroup.js +8 -5
  406. package/build/lib/web/production/components/Checkbox/CheckboxGroup/CheckboxGroup.js.map +1 -1
  407. package/build/lib/web/production/components/Chip/Chip.js +5 -3
  408. package/build/lib/web/production/components/Chip/Chip.js.map +1 -1
  409. package/build/lib/web/production/components/Chip/ChipGroup.js +8 -5
  410. package/build/lib/web/production/components/Chip/ChipGroup.js.map +1 -1
  411. package/build/lib/web/production/components/Collapsible/Collapsible.js +5 -3
  412. package/build/lib/web/production/components/Collapsible/Collapsible.js.map +1 -1
  413. package/build/lib/web/production/components/Collapsible/CollapsibleBody.js +8 -3
  414. package/build/lib/web/production/components/Collapsible/CollapsibleBody.js.map +1 -1
  415. package/build/lib/web/production/components/Collapsible/CollapsibleButton.js +13 -4
  416. package/build/lib/web/production/components/Collapsible/CollapsibleButton.js.map +1 -1
  417. package/build/lib/web/production/components/Collapsible/CollapsibleLink.js +5 -3
  418. package/build/lib/web/production/components/Collapsible/CollapsibleLink.js.map +1 -1
  419. package/build/lib/web/production/components/Counter/Counter.js +5 -3
  420. package/build/lib/web/production/components/Counter/Counter.js.map +1 -1
  421. package/build/lib/web/production/components/DatePicker/DateInput.web.js +11 -7
  422. package/build/lib/web/production/components/DatePicker/DateInput.web.js.map +1 -1
  423. package/build/lib/web/production/components/DatePicker/DatePicker.web.js +4 -2
  424. package/build/lib/web/production/components/DatePicker/DatePicker.web.js.map +1 -1
  425. package/build/lib/web/production/components/Drawer/Drawer.web.js +8 -3
  426. package/build/lib/web/production/components/Drawer/Drawer.web.js.map +1 -1
  427. package/build/lib/web/production/components/Drawer/DrawerSubcomponents.web.js +11 -3
  428. package/build/lib/web/production/components/Drawer/DrawerSubcomponents.web.js.map +1 -1
  429. package/build/lib/web/production/components/Dropdown/Dropdown.js +5 -3
  430. package/build/lib/web/production/components/Dropdown/Dropdown.js.map +1 -1
  431. package/build/lib/web/production/components/Dropdown/DropdownButton.js +2 -2
  432. package/build/lib/web/production/components/Dropdown/DropdownButton.js.map +1 -1
  433. package/build/lib/web/production/components/Dropdown/DropdownHeaderFooter.js +8 -3
  434. package/build/lib/web/production/components/Dropdown/DropdownHeaderFooter.js.map +1 -1
  435. package/build/lib/web/production/components/Dropdown/DropdownLink.js +5 -3
  436. package/build/lib/web/production/components/Dropdown/DropdownLink.js.map +1 -1
  437. package/build/lib/web/production/components/FileUpload/FileUpload.web.js +6 -4
  438. package/build/lib/web/production/components/FileUpload/FileUpload.web.js.map +1 -1
  439. package/build/lib/web/production/components/Form/Selector/SelectorGroupField.js +8 -3
  440. package/build/lib/web/production/components/Form/Selector/SelectorGroupField.js.map +1 -1
  441. package/build/lib/web/production/components/Form/Selector/SelectorInput.web.js +8 -3
  442. package/build/lib/web/production/components/Form/Selector/SelectorInput.web.js.map +1 -1
  443. package/build/lib/web/production/components/Icons/IndiaFlagIcon/IndiaFlagIcon.js +39 -0
  444. package/build/lib/web/production/components/Icons/IndiaFlagIcon/IndiaFlagIcon.js.map +1 -0
  445. package/build/lib/web/production/components/Icons/IndiaFlagIcon/index.js +2 -0
  446. package/build/lib/web/production/components/Icons/IndiaFlagIcon/index.js.map +1 -0
  447. package/build/lib/web/production/components/Icons/MagicKonnectIcon/MagicKonnectIcon.js +49 -0
  448. package/build/lib/web/production/components/Icons/MagicKonnectIcon/MagicKonnectIcon.js.map +1 -0
  449. package/build/lib/web/production/components/Icons/MagicKonnectIcon/index.js +2 -0
  450. package/build/lib/web/production/components/Icons/MagicKonnectIcon/index.js.map +1 -0
  451. package/build/lib/web/production/components/Icons/WorldwideIcon/WorldwideIcon.js +39 -0
  452. package/build/lib/web/production/components/Icons/WorldwideIcon/WorldwideIcon.js.map +1 -0
  453. package/build/lib/web/production/components/Icons/WorldwideIcon/index.js +2 -0
  454. package/build/lib/web/production/components/Icons/WorldwideIcon/index.js.map +1 -0
  455. package/build/lib/web/production/components/Icons/index.js +3 -0
  456. package/build/lib/web/production/components/Icons/index.js.map +1 -1
  457. package/build/lib/web/production/components/Indicator/Indicator.js +5 -3
  458. package/build/lib/web/production/components/Indicator/Indicator.js.map +1 -1
  459. package/build/lib/web/production/components/Input/BaseInput/BaseInput.js +6 -4
  460. package/build/lib/web/production/components/Input/BaseInput/BaseInput.js.map +1 -1
  461. package/build/lib/web/production/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js +5 -2
  462. package/build/lib/web/production/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js.map +1 -1
  463. package/build/lib/web/production/components/Input/DropdownInputTriggers/SelectInput.js +5 -3
  464. package/build/lib/web/production/components/Input/DropdownInputTriggers/SelectInput.js.map +1 -1
  465. package/build/lib/web/production/components/Input/OTPInput/OTPInput.js +6 -4
  466. package/build/lib/web/production/components/Input/OTPInput/OTPInput.js.map +1 -1
  467. package/build/lib/web/production/components/Input/PasswordInput/PasswordInput.js +2 -2
  468. package/build/lib/web/production/components/Input/PasswordInput/PasswordInput.js.map +1 -1
  469. package/build/lib/web/production/components/Input/PhoneNumberInput/PhoneNumberInput.web.js +2 -2
  470. package/build/lib/web/production/components/Input/PhoneNumberInput/PhoneNumberInput.web.js.map +1 -1
  471. package/build/lib/web/production/components/Input/SearchInput/SearchInput.js +2 -2
  472. package/build/lib/web/production/components/Input/SearchInput/SearchInput.js.map +1 -1
  473. package/build/lib/web/production/components/Input/TextArea/TextArea.js +2 -2
  474. package/build/lib/web/production/components/Input/TextArea/TextArea.js.map +1 -1
  475. package/build/lib/web/production/components/Input/TextInput/TextInput.js +2 -2
  476. package/build/lib/web/production/components/Input/TextInput/TextInput.js.map +1 -1
  477. package/build/lib/web/production/components/Link/BaseLink/BaseLink.js +5 -3
  478. package/build/lib/web/production/components/Link/BaseLink/BaseLink.js.map +1 -1
  479. package/build/lib/web/production/components/Link/Link/Link.js +4 -2
  480. package/build/lib/web/production/components/Link/Link/Link.js.map +1 -1
  481. package/build/lib/web/production/components/Menu/VisualSubComponents/MenuHeaderFooter.web.js +18 -8
  482. package/build/lib/web/production/components/Menu/VisualSubComponents/MenuHeaderFooter.web.js.map +1 -1
  483. package/build/lib/web/production/components/Modal/Modal.web.js +10 -4
  484. package/build/lib/web/production/components/Modal/Modal.web.js.map +1 -1
  485. package/build/lib/web/production/components/Modal/ModalBody.web.js +9 -3
  486. package/build/lib/web/production/components/Modal/ModalBody.web.js.map +1 -1
  487. package/build/lib/web/production/components/Modal/ModalFooter.web.js +7 -2
  488. package/build/lib/web/production/components/Modal/ModalFooter.web.js.map +1 -1
  489. package/build/lib/web/production/components/Modal/ModalHeader.web.js +14 -6
  490. package/build/lib/web/production/components/Modal/ModalHeader.web.js.map +1 -1
  491. package/build/lib/web/production/components/Popover/Popover.web.js +8 -3
  492. package/build/lib/web/production/components/Popover/Popover.web.js.map +1 -1
  493. package/build/lib/web/production/components/Popover/PopoverInteractiveWrapper.web.js.map +1 -1
  494. package/build/lib/web/production/components/ProgressBar/ProgressBar.js +5 -3
  495. package/build/lib/web/production/components/ProgressBar/ProgressBar.js.map +1 -1
  496. package/build/lib/web/production/components/Radio/Radio.js +6 -4
  497. package/build/lib/web/production/components/Radio/Radio.js.map +1 -1
  498. package/build/lib/web/production/components/Radio/RadioGroup/RadioGroup.js +8 -5
  499. package/build/lib/web/production/components/Radio/RadioGroup/RadioGroup.js.map +1 -1
  500. package/build/lib/web/production/components/SideNav/SideNav.web.js +5 -3
  501. package/build/lib/web/production/components/SideNav/SideNav.web.js.map +1 -1
  502. package/build/lib/web/production/components/SideNav/SideNavItems/SideNavItem.web.js +13 -4
  503. package/build/lib/web/production/components/SideNav/SideNavItems/SideNavItem.web.js.map +1 -1
  504. package/build/lib/web/production/components/SideNav/SideNavItems/SideNavLink.web.js +10 -4
  505. package/build/lib/web/production/components/SideNav/SideNavItems/SideNavLink.web.js.map +1 -1
  506. package/build/lib/web/production/components/SideNav/SideNavSection.web.js +10 -4
  507. package/build/lib/web/production/components/SideNav/SideNavSection.web.js.map +1 -1
  508. package/build/lib/web/production/components/StepGroup/StepGroup.web.js +5 -3
  509. package/build/lib/web/production/components/StepGroup/StepGroup.web.js.map +1 -1
  510. package/build/lib/web/production/components/StepGroup/StepItem.web.js +13 -7
  511. package/build/lib/web/production/components/StepGroup/StepItem.web.js.map +1 -1
  512. package/build/lib/web/production/components/StepGroup/StepLine.web.js +79 -42
  513. package/build/lib/web/production/components/StepGroup/StepLine.web.js.map +1 -1
  514. package/build/lib/web/production/components/StepGroup/tokens.js +6 -6
  515. package/build/lib/web/production/components/StepGroup/tokens.js.map +1 -1
  516. package/build/lib/web/production/components/Switch/Switch.js +5 -3
  517. package/build/lib/web/production/components/Switch/Switch.js.map +1 -1
  518. package/build/lib/web/production/components/Table/Table.web.js +9 -7
  519. package/build/lib/web/production/components/Table/Table.web.js.map +1 -1
  520. package/build/lib/web/production/components/Table/TableBody.web.js +18 -9
  521. package/build/lib/web/production/components/Table/TableBody.web.js.map +1 -1
  522. package/build/lib/web/production/components/Table/TableFooter.web.js +18 -9
  523. package/build/lib/web/production/components/Table/TableFooter.web.js.map +1 -1
  524. package/build/lib/web/production/components/Table/TableHeader.web.js +18 -9
  525. package/build/lib/web/production/components/Table/TableHeader.web.js.map +1 -1
  526. package/build/lib/web/production/components/Table/TablePagination.web.js +10 -4
  527. package/build/lib/web/production/components/Table/TablePagination.web.js.map +1 -1
  528. package/build/lib/web/production/components/Table/TableToolbar.web.js +13 -8
  529. package/build/lib/web/production/components/Table/TableToolbar.web.js.map +1 -1
  530. package/build/lib/web/production/components/Tabs/TabItem.web.js +9 -5
  531. package/build/lib/web/production/components/Tabs/TabItem.web.js.map +1 -1
  532. package/build/lib/web/production/components/Tabs/TabList.web.js +5 -3
  533. package/build/lib/web/production/components/Tabs/TabList.web.js.map +1 -1
  534. package/build/lib/web/production/components/Tabs/TabPanel.web.js +10 -5
  535. package/build/lib/web/production/components/Tabs/TabPanel.web.js.map +1 -1
  536. package/build/lib/web/production/components/Tabs/Tabs.web.js +8 -3
  537. package/build/lib/web/production/components/Tabs/Tabs.web.js.map +1 -1
  538. package/build/lib/web/production/components/Tag/Tag.js +6 -4
  539. package/build/lib/web/production/components/Tag/Tag.js.map +1 -1
  540. package/build/lib/web/production/components/Toast/ToastContainer.web.js +8 -3
  541. package/build/lib/web/production/components/Toast/ToastContainer.web.js.map +1 -1
  542. package/build/lib/web/production/components/Tooltip/Tooltip.web.js +8 -3
  543. package/build/lib/web/production/components/Tooltip/Tooltip.web.js.map +1 -1
  544. package/build/lib/web/production/components/TopNav/TabNav/TabNav.web.js +6 -3
  545. package/build/lib/web/production/components/TopNav/TabNav/TabNav.web.js.map +1 -1
  546. package/build/lib/web/production/components/TopNav/TopNav.web.js +8 -5
  547. package/build/lib/web/production/components/TopNav/TopNav.web.js.map +1 -1
  548. package/build/lib/web/production/components/index.js +3 -0
  549. package/build/lib/web/production/components/index.js.map +1 -1
  550. package/build/lib/web/production/tokens/global/size.js +3 -1
  551. package/build/lib/web/production/tokens/global/size.js.map +1 -1
  552. package/build/lib/web/production/utils/makeAnalyticsAttribute/index.js +2 -0
  553. package/build/lib/web/production/utils/makeAnalyticsAttribute/index.js.map +1 -0
  554. package/build/lib/web/production/utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js +20 -0
  555. package/build/lib/web/production/utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js.map +1 -0
  556. package/build/types/components/index.d.ts +228 -190
  557. package/build/types/components/index.native.d.ts +152 -132
  558. package/build/types/tokens/index.d.ts +3 -1
  559. package/build/types/tokens/index.native.d.ts +3 -1
  560. package/package.json +1 -1
@@ -18,9 +18,10 @@ import '../BladeProvider/useTheme.js';
18
18
  import { assignWithoutSideEffects } from '../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
19
19
  import { makeAccessible } from '../../utils/makeAccessible/makeAccessible.native.js';
20
20
  import { useVerifyAllowedChildren } from '../../utils/useVerifyAllowedChildren/useVerifyAllowedChildren.js';
21
+ import { makeAnalyticsAttribute } from '../../utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js';
21
22
  import { jsx, jsxs } from 'react/jsx-runtime';
22
23
 
23
- var _excluded=["children","backgroundColor","borderRadius","elevation","testID","padding","width","height","minHeight","minWidth","onClick","isSelected","accessibilityLabel","shouldScaleOnHover","onHover","href","target","rel","as"];var ComponentIds={CardHeader:'CardHeader',CardHeaderTrailing:'CardHeaderTrailing',CardHeaderLeading:'CardHeaderLeading',CardFooter:'CardFooter',CardFooterTrailing:'CardFooterTrailing',CardFooterLeading:'CardFooterLeading',CardBody:'CardBody',CardHeaderIcon:'CardHeaderIcon',CardHeaderCounter:'CardHeaderCounter',CardHeaderBadge:'CardHeaderBadge',CardHeaderAmount:'CardHeaderAmount',CardHeaderText:'CardHeaderText',CardHeaderLink:'CardHeaderLink',CardHeaderIconButton:'CardHeaderIconButton'};var Card=function Card(_ref){var children=_ref.children,_ref$backgroundColor=_ref.backgroundColor,backgroundColor=_ref$backgroundColor===void 0?'surface.background.gray.intense':_ref$backgroundColor,_ref$borderRadius=_ref.borderRadius,borderRadius=_ref$borderRadius===void 0?'medium':_ref$borderRadius,_ref$elevation=_ref.elevation,elevation=_ref$elevation===void 0?'lowRaised':_ref$elevation,testID=_ref.testID,_ref$padding=_ref.padding,padding=_ref$padding===void 0?'spacing.7':_ref$padding,width=_ref.width,height=_ref.height,minHeight=_ref.minHeight,minWidth=_ref.minWidth,onClick=_ref.onClick,_ref$isSelected=_ref.isSelected,isSelected=_ref$isSelected===void 0?false:_ref$isSelected,accessibilityLabel=_ref.accessibilityLabel,_ref$shouldScaleOnHov=_ref.shouldScaleOnHover,shouldScaleOnHover=_ref$shouldScaleOnHov===void 0?false:_ref$shouldScaleOnHov,onHover=_ref.onHover,href=_ref.href,target=_ref.target,rel=_ref.rel,as=_ref.as,styledProps=_objectWithoutProperties(_ref,_excluded);var _React$useState=React__default.useState(false),_React$useState2=_slicedToArray(_React$useState,2),isFocused=_React$useState2[0],setIsFocused=_React$useState2[1];useVerifyAllowedChildren({children:children,componentName:'Card',allowedComponents:[ComponentIds.CardHeader,ComponentIds.CardBody,ComponentIds.CardFooter]});var linkOverlayProps=Object.assign({},metaAttribute({name:CARD_LINK_OVERLAY_ID}),makeAccessible({label:accessibilityLabel,pressed:isSelected}),{onFocus:function onFocus(){setIsFocused(true);},onBlur:function onBlur(){setIsFocused(false);}});var defaultRel=target&&target==='_blank'?'noreferrer noopener':undefined;return jsx(CardProvider,{children:jsx(CardRoot,Object.assign({as:as,display:'block',borderRadius:"medium",onMouseEnter:onHover,shouldScaleOnHover:shouldScaleOnHover,isSelected:isSelected,isFocused:isFocused,onClick:isReactNative()?onClick:undefined,width:width,height:height,minHeight:minHeight,minWidth:minWidth,href:href,accessibilityLabel:accessibilityLabel},metaAttribute({name:MetaConstants.Card,testID:testID}),getStyledProps(styledProps),{children:jsxs(CardSurface,{height:height,minHeight:minHeight,padding:padding,borderRadius:borderRadius,elevation:elevation,textAlign:'left',backgroundColor:backgroundColor,children:[href?jsx(LinkOverlay,Object.assign({onClick:onClick,href:href,target:target,rel:rel!=null?rel:defaultRel},linkOverlayProps)):null,!href&&onClick?jsx(LinkOverlay,Object.assign({as:"button",onClick:onClick},linkOverlayProps)):null,children]})}))});};var _CardBody=function _CardBody(_ref2){var height=_ref2.height,children=_ref2.children,testID=_ref2.testID;useVerifyInsideCard('CardBody');return jsx(BaseBox,Object.assign({},metaAttribute({name:MetaConstants.CardBody,testID:testID}),{height:height,children:children}));};var CardBody=assignWithoutSideEffects(_CardBody,{componentId:ComponentIds.CardBody});
24
+ var _excluded=["children","backgroundColor","borderRadius","elevation","testID","padding","width","height","minHeight","minWidth","onClick","isSelected","accessibilityLabel","shouldScaleOnHover","onHover","href","target","rel","as"],_excluded2=["height","children","testID"];var ComponentIds={CardHeader:'CardHeader',CardHeaderTrailing:'CardHeaderTrailing',CardHeaderLeading:'CardHeaderLeading',CardFooter:'CardFooter',CardFooterTrailing:'CardFooterTrailing',CardFooterLeading:'CardFooterLeading',CardBody:'CardBody',CardHeaderIcon:'CardHeaderIcon',CardHeaderCounter:'CardHeaderCounter',CardHeaderBadge:'CardHeaderBadge',CardHeaderAmount:'CardHeaderAmount',CardHeaderText:'CardHeaderText',CardHeaderLink:'CardHeaderLink',CardHeaderIconButton:'CardHeaderIconButton'};var Card=function Card(_ref){var children=_ref.children,_ref$backgroundColor=_ref.backgroundColor,backgroundColor=_ref$backgroundColor===void 0?'surface.background.gray.intense':_ref$backgroundColor,_ref$borderRadius=_ref.borderRadius,borderRadius=_ref$borderRadius===void 0?'medium':_ref$borderRadius,_ref$elevation=_ref.elevation,elevation=_ref$elevation===void 0?'lowRaised':_ref$elevation,testID=_ref.testID,_ref$padding=_ref.padding,padding=_ref$padding===void 0?'spacing.7':_ref$padding,width=_ref.width,height=_ref.height,minHeight=_ref.minHeight,minWidth=_ref.minWidth,onClick=_ref.onClick,_ref$isSelected=_ref.isSelected,isSelected=_ref$isSelected===void 0?false:_ref$isSelected,accessibilityLabel=_ref.accessibilityLabel,_ref$shouldScaleOnHov=_ref.shouldScaleOnHover,shouldScaleOnHover=_ref$shouldScaleOnHov===void 0?false:_ref$shouldScaleOnHov,onHover=_ref.onHover,href=_ref.href,target=_ref.target,rel=_ref.rel,as=_ref.as,rest=_objectWithoutProperties(_ref,_excluded);var _React$useState=React__default.useState(false),_React$useState2=_slicedToArray(_React$useState,2),isFocused=_React$useState2[0],setIsFocused=_React$useState2[1];useVerifyAllowedChildren({children:children,componentName:'Card',allowedComponents:[ComponentIds.CardHeader,ComponentIds.CardBody,ComponentIds.CardFooter]});var linkOverlayProps=Object.assign({},metaAttribute({name:CARD_LINK_OVERLAY_ID}),makeAccessible({label:accessibilityLabel,pressed:isSelected}),{onFocus:function onFocus(){setIsFocused(true);},onBlur:function onBlur(){setIsFocused(false);}});var defaultRel=target&&target==='_blank'?'noreferrer noopener':undefined;return jsx(CardProvider,{children:jsx(CardRoot,Object.assign({as:as,display:'block',borderRadius:"medium",onMouseEnter:onHover,shouldScaleOnHover:shouldScaleOnHover,isSelected:isSelected,isFocused:isFocused,onClick:isReactNative()?onClick:undefined,width:width,height:height,minHeight:minHeight,minWidth:minWidth,href:href,accessibilityLabel:accessibilityLabel},metaAttribute({name:MetaConstants.Card,testID:testID}),getStyledProps(rest),makeAnalyticsAttribute(rest),{children:jsxs(CardSurface,{height:height,minHeight:minHeight,padding:padding,borderRadius:borderRadius,elevation:elevation,textAlign:'left',backgroundColor:backgroundColor,children:[href?jsx(LinkOverlay,Object.assign({onClick:onClick,href:href,target:target,rel:rel!=null?rel:defaultRel},linkOverlayProps)):null,!href&&onClick?jsx(LinkOverlay,Object.assign({as:"button",onClick:onClick},linkOverlayProps)):null,children]})}))});};var _CardBody=function _CardBody(_ref2){var height=_ref2.height,children=_ref2.children,testID=_ref2.testID,rest=_objectWithoutProperties(_ref2,_excluded2);useVerifyInsideCard('CardBody');return jsx(BaseBox,Object.assign({},metaAttribute({name:MetaConstants.CardBody,testID:testID}),makeAnalyticsAttribute(rest),{height:height,children:children}));};var CardBody=assignWithoutSideEffects(_CardBody,{componentId:ComponentIds.CardBody});
24
25
 
25
26
  export { Card, CardBody, ComponentIds };
26
27
  //# sourceMappingURL=Card.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Card.js","sources":["../../../../../src/components/Card/Card.tsx"],"sourcesContent":["import React from 'react';\nimport type { GestureResponderEvent } from 'react-native';\nimport { CardSurface } from './CardSurface';\nimport { CardProvider, useVerifyInsideCard } from './CardContext';\nimport { LinkOverlay } from './LinkOverlay';\nimport { CardRoot } from './CardRoot';\nimport type { CardSpacingValueType, LinkOverlayProps } from './types';\nimport { CARD_LINK_OVERLAY_ID } from './constants';\nimport BaseBox from '~components/Box/BaseBox';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport type { TestID } from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport type { Elevation } from '~tokens/global';\nimport type { BoxProps } from '~components/Box';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { useVerifyAllowedChildren } from '~utils/useVerifyAllowedChildren/useVerifyAllowedChildren';\nimport type { Platform } from '~utils';\nimport { isReactNative } from '~utils';\nimport type { Theme } from '~components/BladeProvider';\nimport type { DotNotationToken } from '~utils/lodashButBetter/get';\n\nexport const ComponentIds = {\n CardHeader: 'CardHeader',\n CardHeaderTrailing: 'CardHeaderTrailing',\n CardHeaderLeading: 'CardHeaderLeading',\n CardFooter: 'CardFooter',\n CardFooterTrailing: 'CardFooterTrailing',\n CardFooterLeading: 'CardFooterLeading',\n CardBody: 'CardBody',\n CardHeaderIcon: 'CardHeaderIcon',\n CardHeaderCounter: 'CardHeaderCounter',\n CardHeaderBadge: 'CardHeaderBadge',\n CardHeaderAmount: 'CardHeaderAmount',\n CardHeaderText: 'CardHeaderText',\n CardHeaderLink: 'CardHeaderLink',\n CardHeaderIconButton: 'CardHeaderIconButton',\n};\n\ntype CardSurfaceBackgroundColors = `surface.background.gray.${DotNotationToken<\n Theme['colors']['surface']['background']['gray']\n>}`;\n\nexport type CardProps = {\n /**\n * Card contents\n */\n children: React.ReactNode;\n /**\n * Sets the background color of the Card\n *\n * @default `surface.background.gray.intense`\n */\n backgroundColor?: CardSurfaceBackgroundColors;\n /**\n * Sets the border radius of the Card\n *\n * @default `medium`\n */\n borderRadius?: Extract<BoxProps['borderRadius'], 'medium' | 'large' | 'xlarge'>;\n /**\n * Sets the elevation for Cards\n *\n * eg: `theme.elevation.midRaised`\n *\n * @default `theme.elevation.lowRaised`\n *\n * **Links:**\n * - Docs: https://blade.razorpay.com/?path=/docs/tokens-elevation--docs\n */\n elevation?: keyof Elevation;\n /**\n * Sets the padding equally on all sides. Only few `spacing` tokens are allowed deliberately\n * @default `spacing.7`\n *\n * **Links:**\n * - Docs: https://blade.razorpay.com/?path=/docs/tokens-spacing--docs\n */\n padding?: CardSpacingValueType;\n /**\n * Sets the width of the card\n */\n width?: BoxProps['width'];\n /**\n * Sets the height of the card\n */\n height?: BoxProps['height'];\n /**\n * Sets minimum height of the card\n */\n minHeight?: BoxProps['minHeight'];\n /**\n * Sets minimum width of the card\n */\n minWidth?: BoxProps['minWidth'];\n /**\n * If `true`, the card will be in selected state\n * Card will have a primary color border around it.\n *\n * @default false\n */\n\n isSelected?: boolean;\n /**\n * Makes the Card linkable by setting the `href` prop\n *\n * @default undefined\n */\n href?: string;\n /**\n * Sets the `target` attribute for the linkable card\n */\n target?: string;\n /**\n * Sets the `rel` attribute for the linkable card\n */\n rel?: string;\n /**\n * Sets the accessibility label for the card\n * This is useful when the card has an `href` or `onClick` prop\n * Setting this will announce the label when the card is focused\n */\n accessibilityLabel?: string;\n /**\n * If `true`, the card will scale up on hover\n *\n * On mobile devices it will scale down on press\n *\n * @default false\n */\n shouldScaleOnHover?: boolean;\n /**\n * Callback triggered when the card is hovered\n */\n onHover?: () => void;\n /**\n * Callback triggered when the card is clicked\n */\n onClick?: (\n event: Platform.Select<{\n web: React.MouseEvent;\n native: GestureResponderEvent;\n }>,\n ) => void;\n /**\n * Sets the HTML element for the Card\n *\n * When `as` is set to `label`, the card will be rendered as a label element\n * This can be used to create a custom checkbox or radio button using the card\n *\n * @default undefined\n */\n as?: 'label';\n} & TestID &\n StyledPropsBlade;\n\nconst Card = ({\n children,\n backgroundColor = 'surface.background.gray.intense',\n borderRadius = 'medium',\n elevation = 'lowRaised',\n testID,\n padding = 'spacing.7',\n width,\n height,\n minHeight,\n minWidth,\n onClick,\n isSelected = false,\n accessibilityLabel,\n shouldScaleOnHover = false,\n onHover,\n href,\n target,\n rel,\n as,\n ...styledProps\n}: CardProps): React.ReactElement => {\n const [isFocused, setIsFocused] = React.useState(false);\n\n useVerifyAllowedChildren({\n children,\n componentName: 'Card',\n allowedComponents: [ComponentIds.CardHeader, ComponentIds.CardBody, ComponentIds.CardFooter],\n });\n\n const linkOverlayProps: LinkOverlayProps = {\n ...metaAttribute({ name: CARD_LINK_OVERLAY_ID }),\n ...makeAccessible({ label: accessibilityLabel, pressed: isSelected }),\n onFocus: () => {\n setIsFocused(true);\n },\n onBlur: () => {\n setIsFocused(false);\n },\n };\n const defaultRel = target && target === '_blank' ? 'noreferrer noopener' : undefined;\n\n return (\n <CardProvider>\n <CardRoot\n as={as}\n display={'block' as never}\n borderRadius=\"medium\"\n onMouseEnter={onHover as never}\n shouldScaleOnHover={shouldScaleOnHover}\n isSelected={isSelected}\n isFocused={isFocused}\n // on react native we need to pass onClick to root, because we don't need the LinkOverlay in RN\n onClick={isReactNative() ? onClick : undefined}\n width={width}\n height={height}\n minHeight={minHeight}\n minWidth={minWidth}\n href={href}\n accessibilityLabel={accessibilityLabel}\n {...metaAttribute({ name: MetaConstants.Card, testID })}\n {...getStyledProps(styledProps)}\n >\n <CardSurface\n height={height}\n minHeight={minHeight}\n padding={padding}\n borderRadius={borderRadius}\n elevation={elevation}\n textAlign={'left' as never}\n backgroundColor={backgroundColor}\n >\n {href ? (\n <LinkOverlay\n onClick={onClick}\n href={href}\n target={target}\n rel={rel ?? defaultRel}\n {...linkOverlayProps}\n />\n ) : null}\n {!href && onClick ? (\n <LinkOverlay as=\"button\" onClick={onClick} {...linkOverlayProps} />\n ) : null}\n {children}\n </CardSurface>\n </CardRoot>\n </CardProvider>\n );\n};\n\ntype CardBodyProps = {\n children: React.ReactNode;\n height?: BoxProps['height'];\n} & TestID;\n\nconst _CardBody = ({ height, children, testID }: CardBodyProps): React.ReactElement => {\n useVerifyInsideCard('CardBody');\n\n return (\n <BaseBox {...metaAttribute({ name: MetaConstants.CardBody, testID })} height={height}>\n {children}\n </BaseBox>\n );\n};\n\nconst CardBody = assignWithoutSideEffects(_CardBody, { componentId: ComponentIds.CardBody });\n\nexport { Card, CardBody };\n"],"names":["ComponentIds","CardHeader","CardHeaderTrailing","CardHeaderLeading","CardFooter","CardFooterTrailing","CardFooterLeading","CardBody","CardHeaderIcon","CardHeaderCounter","CardHeaderBadge","CardHeaderAmount","CardHeaderText","CardHeaderLink","CardHeaderIconButton","Card","_ref","children","_ref$backgroundColor","backgroundColor","_ref$borderRadius","borderRadius","_ref$elevation","elevation","testID","_ref$padding","padding","width","height","minHeight","minWidth","onClick","_ref$isSelected","isSelected","accessibilityLabel","_ref$shouldScaleOnHov","shouldScaleOnHover","onHover","href","target","rel","as","styledProps","_objectWithoutProperties","_excluded","_React$useState","React","useState","_React$useState2","_slicedToArray","isFocused","setIsFocused","useVerifyAllowedChildren","componentName","allowedComponents","linkOverlayProps","Object","assign","metaAttribute","name","CARD_LINK_OVERLAY_ID","makeAccessible","label","pressed","onFocus","onBlur","defaultRel","undefined","_jsx","CardProvider","CardRoot","display","onMouseEnter","isReactNative","MetaConstants","getStyledProps","_jsxs","CardSurface","textAlign","LinkOverlay","_CardBody","_ref2","useVerifyInsideCard","BaseBox","assignWithoutSideEffects","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,SAAA,CAAA,CAAA,UAAA,CAAA,iBAAA,CAAA,cAAA,CAAA,WAAA,CAAA,QAAA,CAAA,SAAA,CAAA,OAAA,CAAA,QAAA,CAAA,WAAA,CAAA,UAAA,CAAA,SAAA,CAAA,YAAA,CAAA,oBAAA,CAAA,oBAAA,CAAA,SAAA,CAAA,MAAA,CAAA,QAAA,CAAA,KAAA,CAAA,IAAA,CAAA,CAuBa,IAAAA,YAAY,CAAG,CAC1BC,UAAU,CAAE,YAAY,CACxBC,kBAAkB,CAAE,oBAAoB,CACxCC,iBAAiB,CAAE,mBAAmB,CACtCC,UAAU,CAAE,YAAY,CACxBC,kBAAkB,CAAE,oBAAoB,CACxCC,iBAAiB,CAAE,mBAAmB,CACtCC,QAAQ,CAAE,UAAU,CACpBC,cAAc,CAAE,gBAAgB,CAChCC,iBAAiB,CAAE,mBAAmB,CACtCC,eAAe,CAAE,iBAAiB,CAClCC,gBAAgB,CAAE,kBAAkB,CACpCC,cAAc,CAAE,gBAAgB,CAChCC,cAAc,CAAE,gBAAgB,CAChCC,oBAAoB,CAAE,sBACxB,EAuHM,IAAAC,IAAI,CAAG,SAAPA,IAAIA,CAAAC,IAAA,CAqB2B,CApBnC,IAAAC,QAAQ,CAAAD,IAAA,CAARC,QAAQ,CAAAC,oBAAA,CAAAF,IAAA,CACRG,eAAe,CAAfA,eAAe,CAAAD,oBAAA,GAAG,KAAA,CAAA,CAAA,iCAAiC,CAAAA,oBAAA,CAAAE,iBAAA,CAAAJ,IAAA,CACnDK,YAAY,CAAZA,YAAY,CA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Ee,aAAa,CAACnE,QAAQ,CAAEiB,MAAM,CAANA,MAAO,CAAC,CAAC,EAAEI,MAAM,CAAEA,MAAO,CAAAX,QAAA,CAClFA,QAAQ,CAAA,CACF,CAAC,CAEd,CAAC,CAEK,IAAAV,QAAQ,CAAG6E,wBAAwB,CAACJ,SAAS,CAAE,CAAEK,WAAW,CAAErF,YAAY,CAACO,QAAS,CAAC;;;;"}
1
+ {"version":3,"file":"Card.js","sources":["../../../../../src/components/Card/Card.tsx"],"sourcesContent":["import React from 'react';\nimport type { GestureResponderEvent } from 'react-native';\nimport { CardSurface } from './CardSurface';\nimport { CardProvider, useVerifyInsideCard } from './CardContext';\nimport { LinkOverlay } from './LinkOverlay';\nimport { CardRoot } from './CardRoot';\nimport type { CardSpacingValueType, LinkOverlayProps } from './types';\nimport { CARD_LINK_OVERLAY_ID } from './constants';\nimport BaseBox from '~components/Box/BaseBox';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport type { DataAnalyticsAttribute, TestID } from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport type { Elevation } from '~tokens/global';\nimport type { BoxProps } from '~components/Box';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { useVerifyAllowedChildren } from '~utils/useVerifyAllowedChildren/useVerifyAllowedChildren';\nimport type { Platform } from '~utils';\nimport { isReactNative } from '~utils';\nimport type { Theme } from '~components/BladeProvider';\nimport type { DotNotationToken } from '~utils/lodashButBetter/get';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\nexport const ComponentIds = {\n CardHeader: 'CardHeader',\n CardHeaderTrailing: 'CardHeaderTrailing',\n CardHeaderLeading: 'CardHeaderLeading',\n CardFooter: 'CardFooter',\n CardFooterTrailing: 'CardFooterTrailing',\n CardFooterLeading: 'CardFooterLeading',\n CardBody: 'CardBody',\n CardHeaderIcon: 'CardHeaderIcon',\n CardHeaderCounter: 'CardHeaderCounter',\n CardHeaderBadge: 'CardHeaderBadge',\n CardHeaderAmount: 'CardHeaderAmount',\n CardHeaderText: 'CardHeaderText',\n CardHeaderLink: 'CardHeaderLink',\n CardHeaderIconButton: 'CardHeaderIconButton',\n};\n\ntype CardSurfaceBackgroundColors = `surface.background.gray.${DotNotationToken<\n Theme['colors']['surface']['background']['gray']\n>}`;\n\nexport type CardProps = {\n /**\n * Card contents\n */\n children: React.ReactNode;\n /**\n * Sets the background color of the Card\n *\n * @default `surface.background.gray.intense`\n */\n backgroundColor?: CardSurfaceBackgroundColors;\n /**\n * Sets the border radius of the Card\n *\n * @default `medium`\n */\n borderRadius?: Extract<BoxProps['borderRadius'], 'medium' | 'large' | 'xlarge'>;\n /**\n * Sets the elevation for Cards\n *\n * eg: `theme.elevation.midRaised`\n *\n * @default `theme.elevation.lowRaised`\n *\n * **Links:**\n * - Docs: https://blade.razorpay.com/?path=/docs/tokens-elevation--docs\n */\n elevation?: keyof Elevation;\n /**\n * Sets the padding equally on all sides. Only few `spacing` tokens are allowed deliberately\n * @default `spacing.7`\n *\n * **Links:**\n * - Docs: https://blade.razorpay.com/?path=/docs/tokens-spacing--docs\n */\n padding?: CardSpacingValueType;\n /**\n * Sets the width of the card\n */\n width?: BoxProps['width'];\n /**\n * Sets the height of the card\n */\n height?: BoxProps['height'];\n /**\n * Sets minimum height of the card\n */\n minHeight?: BoxProps['minHeight'];\n /**\n * Sets minimum width of the card\n */\n minWidth?: BoxProps['minWidth'];\n /**\n * If `true`, the card will be in selected state\n * Card will have a primary color border around it.\n *\n * @default false\n */\n\n isSelected?: boolean;\n /**\n * Makes the Card linkable by setting the `href` prop\n *\n * @default undefined\n */\n href?: string;\n /**\n * Sets the `target` attribute for the linkable card\n */\n target?: string;\n /**\n * Sets the `rel` attribute for the linkable card\n */\n rel?: string;\n /**\n * Sets the accessibility label for the card\n * This is useful when the card has an `href` or `onClick` prop\n * Setting this will announce the label when the card is focused\n */\n accessibilityLabel?: string;\n /**\n * If `true`, the card will scale up on hover\n *\n * On mobile devices it will scale down on press\n *\n * @default false\n */\n shouldScaleOnHover?: boolean;\n /**\n * Callback triggered when the card is hovered\n */\n onHover?: () => void;\n /**\n * Callback triggered when the card is clicked\n */\n onClick?: (\n event: Platform.Select<{\n web: React.MouseEvent;\n native: GestureResponderEvent;\n }>,\n ) => void;\n /**\n * Sets the HTML element for the Card\n *\n * When `as` is set to `label`, the card will be rendered as a label element\n * This can be used to create a custom checkbox or radio button using the card\n *\n * @default undefined\n */\n as?: 'label';\n} & TestID &\n DataAnalyticsAttribute &\n StyledPropsBlade;\n\nconst Card = ({\n children,\n backgroundColor = 'surface.background.gray.intense',\n borderRadius = 'medium',\n elevation = 'lowRaised',\n testID,\n padding = 'spacing.7',\n width,\n height,\n minHeight,\n minWidth,\n onClick,\n isSelected = false,\n accessibilityLabel,\n shouldScaleOnHover = false,\n onHover,\n href,\n target,\n rel,\n as,\n ...rest\n}: CardProps): React.ReactElement => {\n const [isFocused, setIsFocused] = React.useState(false);\n\n useVerifyAllowedChildren({\n children,\n componentName: 'Card',\n allowedComponents: [ComponentIds.CardHeader, ComponentIds.CardBody, ComponentIds.CardFooter],\n });\n\n const linkOverlayProps: LinkOverlayProps = {\n ...metaAttribute({ name: CARD_LINK_OVERLAY_ID }),\n ...makeAccessible({ label: accessibilityLabel, pressed: isSelected }),\n onFocus: () => {\n setIsFocused(true);\n },\n onBlur: () => {\n setIsFocused(false);\n },\n };\n const defaultRel = target && target === '_blank' ? 'noreferrer noopener' : undefined;\n\n return (\n <CardProvider>\n <CardRoot\n as={as}\n display={'block' as never}\n borderRadius=\"medium\"\n onMouseEnter={onHover as never}\n shouldScaleOnHover={shouldScaleOnHover}\n isSelected={isSelected}\n isFocused={isFocused}\n // on react native we need to pass onClick to root, because we don't need the LinkOverlay in RN\n onClick={isReactNative() ? onClick : undefined}\n width={width}\n height={height}\n minHeight={minHeight}\n minWidth={minWidth}\n href={href}\n accessibilityLabel={accessibilityLabel}\n {...metaAttribute({ name: MetaConstants.Card, testID })}\n {...getStyledProps(rest)}\n {...makeAnalyticsAttribute(rest)}\n >\n <CardSurface\n height={height}\n minHeight={minHeight}\n padding={padding}\n borderRadius={borderRadius}\n elevation={elevation}\n textAlign={'left' as never}\n backgroundColor={backgroundColor}\n >\n {href ? (\n <LinkOverlay\n onClick={onClick}\n href={href}\n target={target}\n rel={rel ?? defaultRel}\n {...linkOverlayProps}\n />\n ) : null}\n {!href && onClick ? (\n <LinkOverlay as=\"button\" onClick={onClick} {...linkOverlayProps} />\n ) : null}\n {children}\n </CardSurface>\n </CardRoot>\n </CardProvider>\n );\n};\n\ntype CardBodyProps = {\n children: React.ReactNode;\n height?: BoxProps['height'];\n} & TestID &\n DataAnalyticsAttribute;\n\nconst _CardBody = ({ height, children, testID, ...rest }: CardBodyProps): React.ReactElement => {\n useVerifyInsideCard('CardBody');\n\n return (\n <BaseBox\n {...metaAttribute({ name: MetaConstants.CardBody, testID })}\n {...makeAnalyticsAttribute(rest)}\n height={height}\n >\n {children}\n </BaseBox>\n );\n};\n\nconst CardBody = assignWithoutSideEffects(_CardBody, { componentId: ComponentIds.CardBody });\n\nexport { Card, CardBody };\n"],"names":["ComponentIds","CardHeader","CardHeaderTrailing","CardHeaderLeading","CardFooter","CardFooterTrailing","CardFooterLeading","CardBody","CardHeaderIcon","CardHeaderCounter","CardHeaderBadge","CardHeaderAmount","CardHeaderText","CardHeaderLink","CardHeaderIconButton","Card","_ref","children","_ref$backgroundColor","backgroundColor","_ref$borderRadius","borderRadius","_ref$elevation","elevation","testID","_ref$padding","padding","width","height","minHeight","minWidth","onClick","_ref$isSelected","isSelected","accessibilityLabel","_ref$shouldScaleOnHov","shouldScaleOnHover","onHover","href","target","rel","as","rest","_objectWithoutProperties","_excluded","_React$useState","React","useState","_React$useState2","_slicedToArray","isFocused","setIsFocused","useVerifyAllowedChildren","componentName","allowedComponents","linkOverlayProps","Object","assign","metaAttribute","name","CARD_LINK_OVERLAY_ID","makeAccessible","label","pressed","onFocus","onBlur","defaultRel","undefined","_jsx","CardProvider","CardRoot","display","onMouseEnter","isReactNative","MetaConstants","getStyledProps","makeAnalyticsAttribute","_jsxs","CardSurface","textAlign","LinkOverlay","_CardBody","_ref2","_excluded2","useVerifyInsideCard","BaseBox","assignWithoutSideEffects","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,SAAA,CAAA,CAAA,UAAA,CAAA,iBAAA,CAAA,cAAA,CAAA,WAAA,CAAA,QAAA,CAAA,SAAA,CAAA,OAAA,CAAA,QAAA,CAAA,WAAA,CAAA,UAAA,CAAA,SAAA,CAAA,YAAA,CAAA,oBAAA,CAAA,oBAAA,CAAA,SAAA,CAAA,MAAA,CAAA,QAAA,CAAA,KAAA,CAAA,IAAA,CAAA,CAAA,UAAA,CAAA,CAAA,QAAA,CAAA,UAAA,CAAA,QAAA,CAAA,CAwBa,IAAAA,YAAY,CAAG,CAC1BC,UAAU,CAAE,YAAY,CACxBC,kBAAkB,CAAE,oBAAoB,CACxCC,iBAAiB,CAAE,mBAAmB,CACtCC,UAAU,CAAE,YAAY,CACxBC,kBAAkB,CAAE,oBAAoB,CACxCC,iBAAiB,CAAE,mBAAmB,CACtCC,QAAQ,CAAE,UAAU,CACpBC,cAAc,CAAE,gBAAgB,CAChCC,iBAAiB,CAAE,mBAAmB,CACtCC,eAAe,CAAE,iBAAiB,CAClCC,gBAAgB,CAAE,kBAAkB,CACpCC,cAAc,CAAE,gBAAgB,CAChCC,cAAc,CAAE,gBAAgB,CAChCC,oBAAoB,CAAE,sBACxB,EAwHM,IAAAC,IAAI,CAAG,SAAPA,IAAIA,CAAAC,IAAA,CAqB2B,CAAA,IApBnCC,QAAQ,CAAAD,IAAA,CAARC,QAAQ,CAAAC,oBAAA,CAAAF,IAAA,CACRG,eAAe,CAAfA,eAAe,CAAAD,oBAAA,GAAA,KAAA,CAAA,CAAG,iCAAiC,CAAAA,oBAAA,C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CAACiB,OAAO,CAAA7B,MAAA,CAAAC,MAAA,CACFC,EAAAA,CAAAA,aAAa,CAAC,CAAEC,IAAI,CAAEe,aAAa,CAACnE,QAAQ,CAAEiB,MAAM,CAANA,MAAO,CAAC,CAAC,CACvDoD,sBAAsB,CAAClC,IAAI,CAAC,CAChCd,CAAAA,MAAM,CAAEA,MAAO,CAAAX,QAAA,CAEdA,QAAQ,EACF,CAAC,CAEd,CAAC,CAEK,IAAAV,QAAQ,CAAG+E,wBAAwB,CAACL,SAAS,CAAE,CAAEM,WAAW,CAAEvF,YAAY,CAACO,QAAS,CAAC;;;;"}
@@ -1,10 +1,10 @@
1
+ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
1
2
  import React__default from 'react';
2
3
  import { useVerifyInsideCard } from './CardContext.js';
3
4
  import { ComponentIds } from './Card.js';
4
5
  import Button from '../Button/Button/Button.js';
5
6
  import { Divider } from '../Divider/Divider.js';
6
7
  import { BaseBox } from '../Box/BaseBox/BaseBox.native.js';
7
- import '@babel/runtime/helpers/objectWithoutProperties';
8
8
  import '../Typography/BaseText/BaseText.native.js';
9
9
  import { throwBladeError } from '../../utils/logger/logger.js';
10
10
  import '@babel/runtime/helpers/slicedToArray';
@@ -20,8 +20,9 @@ import { MetaConstants } from '../../utils/metaAttribute/metaConstants.js';
20
20
  import { assignWithoutSideEffects } from '../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
21
21
  import { useIsMobile } from '../../utils/useIsMobile.js';
22
22
  import { useVerifyAllowedChildren } from '../../utils/useVerifyAllowedChildren/useVerifyAllowedChildren.js';
23
+ import { makeAnalyticsAttribute } from '../../utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js';
23
24
 
24
- var _CardFooter=function _CardFooter(_ref){var _footerChildrensArray,_footerChildrensArray2;var children=_ref.children,testID=_ref.testID,_ref$marginTop=_ref.marginTop,marginTop=_ref$marginTop===void 0?'spacing.4':_ref$marginTop,_ref$paddingTop=_ref.paddingTop,paddingTop=_ref$paddingTop===void 0?'spacing.4':_ref$paddingTop,_ref$showDivider=_ref.showDivider,showDivider=_ref$showDivider===void 0?true:_ref$showDivider;var isMobile=useIsMobile();useVerifyInsideCard('CardFooter');useVerifyAllowedChildren({children:children,componentName:'CardFooter',allowedComponents:[ComponentIds.CardFooterLeading,ComponentIds.CardFooterTrailing]});var footerChildrensArray=React__default.Children.toArray(children);if(__DEV__){if(!React__default.isValidElement(footerChildrensArray[0])){throwBladeError({message:`Invalid React Element ${footerChildrensArray}`,moduleName:'CardFooter'});}}var baseBoxJustifyContent=footerChildrensArray.length===2||!((_footerChildrensArray=footerChildrensArray[0])!=null&&(_footerChildrensArray2=_footerChildrensArray.props)!=null&&_footerChildrensArray2.actions)?'space-between':'flex-end';return jsxs(BaseBox,Object.assign({marginTop:marginTop},metaAttribute({name:MetaConstants.CardFooter,testID:testID}),{children:[showDivider?jsx(Divider,{}):null,jsx(BaseBox,{paddingTop:paddingTop,display:"flex",flexDirection:isMobile?'column':'row',justifyContent:baseBoxJustifyContent,alignItems:isMobile?'stretch':'center',children:children})]}));};var CardFooter=assignWithoutSideEffects(_CardFooter,{componentId:ComponentIds.CardFooter});var _CardFooterLeading=function _CardFooterLeading(_ref2){var title=_ref2.title,subtitle=_ref2.subtitle;useVerifyInsideCard('CardFooterLeading');return jsxs(BaseBox,{textAlign:'left',children:[title&&jsx(Text,{color:"surface.text.gray.normal",size:"medium",weight:"semibold",children:title}),subtitle&&jsx(Text,{color:"surface.text.gray.subtle",size:"small",weight:"regular",children:subtitle})]});};var CardFooterLeading=assignWithoutSideEffects(_CardFooterLeading,{componentId:ComponentIds.CardFooterLeading});var _CardFooterTrailing=function _CardFooterTrailing(_ref3){var actions=_ref3.actions;var isMobile=useIsMobile();useVerifyInsideCard('CardFooterTrailing');return jsxs(BaseBox,{display:"flex",flexDirection:"row",alignSelf:isMobile?'auto':'center',marginTop:isMobile?'spacing.5':'spacing.0',marginLeft:isMobile?'spacing.0':'spacing.5',children:[jsx(BaseBox,{flexGrow:1,children:actions!=null&&actions.secondary?jsx(Button,Object.assign({isFullWidth:true,size:"medium",variant:"secondary"},actions.secondary,{children:actions.secondary.text})):null}),jsx(BaseBox,{marginLeft:"spacing.5"}),jsx(BaseBox,{flexGrow:1,children:actions!=null&&actions.primary?jsx(Button,Object.assign({isFullWidth:true,size:"medium"},actions.primary,{children:actions.primary.text})):null})]});};var CardFooterTrailing=assignWithoutSideEffects(_CardFooterTrailing,{componentId:ComponentIds.CardFooterTrailing});
25
+ var _excluded=["children","testID","marginTop","paddingTop","showDivider"],_excluded2=["title","subtitle"],_excluded3=["actions"];var _CardFooter=function _CardFooter(_ref){var _footerChildrensArray,_footerChildrensArray2;var children=_ref.children,testID=_ref.testID,_ref$marginTop=_ref.marginTop,marginTop=_ref$marginTop===void 0?'spacing.4':_ref$marginTop,_ref$paddingTop=_ref.paddingTop,paddingTop=_ref$paddingTop===void 0?'spacing.4':_ref$paddingTop,_ref$showDivider=_ref.showDivider,showDivider=_ref$showDivider===void 0?true:_ref$showDivider,props=_objectWithoutProperties(_ref,_excluded);var isMobile=useIsMobile();useVerifyInsideCard('CardFooter');useVerifyAllowedChildren({children:children,componentName:'CardFooter',allowedComponents:[ComponentIds.CardFooterLeading,ComponentIds.CardFooterTrailing]});var footerChildrensArray=React__default.Children.toArray(children);if(__DEV__){if(!React__default.isValidElement(footerChildrensArray[0])){throwBladeError({message:`Invalid React Element ${footerChildrensArray}`,moduleName:'CardFooter'});}}var baseBoxJustifyContent=footerChildrensArray.length===2||!((_footerChildrensArray=footerChildrensArray[0])!=null&&(_footerChildrensArray2=_footerChildrensArray.props)!=null&&_footerChildrensArray2.actions)?'space-between':'flex-end';return jsxs(BaseBox,Object.assign({marginTop:marginTop},metaAttribute({name:MetaConstants.CardFooter,testID:testID}),makeAnalyticsAttribute(props),{children:[showDivider?jsx(Divider,{}):null,jsx(BaseBox,{paddingTop:paddingTop,display:"flex",flexDirection:isMobile?'column':'row',justifyContent:baseBoxJustifyContent,alignItems:isMobile?'stretch':'center',children:children})]}));};var CardFooter=assignWithoutSideEffects(_CardFooter,{componentId:ComponentIds.CardFooter});var _CardFooterLeading=function _CardFooterLeading(_ref2){var title=_ref2.title,subtitle=_ref2.subtitle,rest=_objectWithoutProperties(_ref2,_excluded2);useVerifyInsideCard('CardFooterLeading');return jsxs(BaseBox,Object.assign({textAlign:'left'},makeAnalyticsAttribute(rest),{children:[title&&jsx(Text,{color:"surface.text.gray.normal",size:"medium",weight:"semibold",children:title}),subtitle&&jsx(Text,{color:"surface.text.gray.subtle",size:"small",weight:"regular",children:subtitle})]}));};var CardFooterLeading=assignWithoutSideEffects(_CardFooterLeading,{componentId:ComponentIds.CardFooterLeading});var _CardFooterTrailing=function _CardFooterTrailing(_ref3){var actions=_ref3.actions,rest=_objectWithoutProperties(_ref3,_excluded3);var isMobile=useIsMobile();useVerifyInsideCard('CardFooterTrailing');return jsxs(BaseBox,Object.assign({display:"flex",flexDirection:"row",alignSelf:isMobile?'auto':'center',marginTop:isMobile?'spacing.5':'spacing.0',marginLeft:isMobile?'spacing.0':'spacing.5'},makeAnalyticsAttribute(rest),{children:[jsx(BaseBox,{flexGrow:1,children:actions!=null&&actions.secondary?jsx(Button,Object.assign({isFullWidth:true,size:"medium",variant:"secondary"},actions.secondary,{children:actions.secondary.text})):null}),jsx(BaseBox,{marginLeft:"spacing.5"}),jsx(BaseBox,{flexGrow:1,children:actions!=null&&actions.primary?jsx(Button,Object.assign({isFullWidth:true,size:"medium"},actions.primary,{children:actions.primary.text})):null})]}));};var CardFooterTrailing=assignWithoutSideEffects(_CardFooterTrailing,{componentId:ComponentIds.CardFooterTrailing});
25
26
 
26
27
  export { CardFooter, CardFooterLeading, CardFooterTrailing };
27
28
  //# sourceMappingURL=CardFooter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CardFooter.js","sources":["../../../../../src/components/Card/CardFooter.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */\nimport type { ReactElement } from 'react';\nimport React from 'react';\nimport { useVerifyInsideCard } from './CardContext';\nimport { ComponentIds } from './Card';\nimport type { CardSpacingValueType } from './types';\nimport type { ButtonProps } from '~components/Button';\nimport { Button } from '~components/Button';\nimport { Divider } from '~components/Divider';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Text } from '~components/Typography';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { TestID } from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { useIsMobile } from '~utils/useIsMobile';\nimport { throwBladeError } from '~utils/logger';\nimport { useVerifyAllowedChildren } from '~utils/useVerifyAllowedChildren/useVerifyAllowedChildren';\n\nexport type CardFooterAction = Pick<\n ButtonProps,\n 'type' | 'accessibilityLabel' | 'isLoading' | 'isDisabled' | 'icon' | 'iconPosition' | 'onClick'\n> & {\n text: ButtonProps['children'];\n};\n\ntype CardFooterProps = {\n children?: React.ReactNode;\n /**\n * For spacing between divider and footer title\n */\n paddingTop?: CardSpacingValueType;\n /**\n * For spacing between body content and divider\n */\n marginTop?: CardSpacingValueType;\n /**\n * @default true\n */\n showDivider?: boolean;\n} & TestID;\n\nconst _CardFooter = ({\n children,\n testID,\n marginTop = 'spacing.4',\n paddingTop = 'spacing.4',\n showDivider = true,\n}: CardFooterProps): React.ReactElement => {\n const isMobile = useIsMobile();\n useVerifyInsideCard('CardFooter');\n useVerifyAllowedChildren({\n children,\n componentName: 'CardFooter',\n allowedComponents: [ComponentIds.CardFooterLeading, ComponentIds.CardFooterTrailing],\n });\n\n const footerChildrensArray = React.Children.toArray(children);\n if (__DEV__) {\n if (!React.isValidElement(footerChildrensArray[0])) {\n throwBladeError({\n message: `Invalid React Element ${footerChildrensArray}`,\n moduleName: 'CardFooter',\n });\n }\n }\n\n // the reason why we are checking for actions here is, because we want the footerTrailing\n // to always be aligned to the right\n // if we don't check for action here, and if we do not have footerTrailing and only footerLeading\n // then the content of footerLeading will be justified to the end.\n const baseBoxJustifyContent =\n footerChildrensArray.length === 2 || !(footerChildrensArray[0] as ReactElement)?.props?.actions\n ? 'space-between'\n : 'flex-end';\n\n return (\n <BaseBox marginTop={marginTop} {...metaAttribute({ name: MetaConstants.CardFooter, testID })}>\n {showDivider ? <Divider /> : null}\n <BaseBox\n paddingTop={paddingTop}\n display=\"flex\"\n flexDirection={isMobile ? 'column' : 'row'}\n justifyContent={baseBoxJustifyContent}\n alignItems={isMobile ? 'stretch' : 'center'}\n >\n {children}\n </BaseBox>\n </BaseBox>\n );\n};\nconst CardFooter = assignWithoutSideEffects(_CardFooter, { componentId: ComponentIds.CardFooter });\n\ntype CardFooterLeadingProps = {\n title?: string;\n subtitle?: string;\n};\nconst _CardFooterLeading = ({ title, subtitle }: CardFooterLeadingProps): React.ReactElement => {\n useVerifyInsideCard('CardFooterLeading');\n\n return (\n <BaseBox textAlign={'left' as never}>\n {title && (\n <Text color=\"surface.text.gray.normal\" size=\"medium\" weight=\"semibold\">\n {title}\n </Text>\n )}\n {subtitle && (\n <Text color=\"surface.text.gray.subtle\" size=\"small\" weight=\"regular\">\n {subtitle}\n </Text>\n )}\n </BaseBox>\n );\n};\nconst CardFooterLeading = assignWithoutSideEffects(_CardFooterLeading, {\n componentId: ComponentIds.CardFooterLeading,\n});\n\ntype CardFooterTrailingProps = {\n actions?: {\n primary?: CardFooterAction;\n secondary?: CardFooterAction;\n };\n};\nconst _CardFooterTrailing = ({ actions }: CardFooterTrailingProps): React.ReactElement => {\n const isMobile = useIsMobile();\n useVerifyInsideCard('CardFooterTrailing');\n\n return (\n <BaseBox\n display=\"flex\"\n flexDirection=\"row\"\n alignSelf={isMobile ? 'auto' : 'center'}\n marginTop={isMobile ? 'spacing.5' : 'spacing.0'}\n marginLeft={isMobile ? 'spacing.0' : 'spacing.5'}\n >\n <BaseBox flexGrow={1}>\n {actions?.secondary ? (\n <Button isFullWidth size=\"medium\" variant=\"secondary\" {...actions.secondary}>\n {actions.secondary.text!}\n </Button>\n ) : null}\n </BaseBox>\n <BaseBox marginLeft=\"spacing.5\" />\n <BaseBox flexGrow={1}>\n {actions?.primary ? (\n <Button isFullWidth size=\"medium\" {...actions.primary}>\n {actions.primary.text!}\n </Button>\n ) : null}\n </BaseBox>\n </BaseBox>\n );\n};\nconst CardFooterTrailing = assignWithoutSideEffects(_CardFooterTrailing, {\n componentId: ComponentIds.CardFooterTrailing,\n});\n\nexport { CardFooter, CardFooterLeading, CardFooterTrailing };\n"],"names":["_CardFooter","_ref","_footerChildrensArray","_footerChildrensArray2","children","testID","_ref$marginTop","marginTop","_ref$paddingTop","paddingTop","_ref$showDivider","showDivider","isMobile","useIsMobile","useVerifyInsideCard","useVerifyAllowedChildren","componentName","allowedComponents","ComponentIds","CardFooterLeading","CardFooterTrailing","footerChildrensArray","React","Children","toArray","__DEV__","isValidElement","throwBladeError","message","moduleName","baseBoxJustifyContent","length","props","actions","_jsxs","BaseBox","Object","assign","metaAttribute","name","MetaConstants","CardFooter","_jsx","Divider","display","flexDirection","justifyContent","alignItems","assignWithoutSideEffects","componentId","_CardFooterLeading","_ref2","title","subtitle","textAlign","Text","color","size","weight","_CardFooterTrailing","_ref3","alignSelf","marginLeft","flexGrow","secondary","Button","isFullWidth","variant","text","primary"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAyCA,IAAMA,WAAW,CAAG,SAAdA,WAAWA,CAAAC,IAAA,CAM0B,CAAA,IAAAC,qBAAA,CAAAC,sBAAA,CALzC,IAAAC,QAAQ,CAAAH,IAAA,CAARG,QAAQ,CACRC,MAAM,CAAAJ,IAAA,CAANI,MAAM,CAAAC,cAAA,CAAAL,IAAA,CACNM,SAAS,CAATA,SAAS,CAAAD,cAAA,UAAG,WAAW,CAAAA,cAAA,CAAAE,eAAA,CAAAP,IAAA,CACvBQ,UAAU,CAAVA,UAAU,CAAAD,eAAA,GAAA,KAAA,CAAA,CAAG,WAAW,CAAAA,eAAA,CAAAE,gBAAA,CAAAT,IAAA,CACxBU,WAAW,CAAXA,WAAW,CAAA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 {"version":3,"file":"CardFooter.js","sources":["../../../../../src/components/Card/CardFooter.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */\nimport type { ReactElement } from 'react';\nimport React from 'react';\nimport { useVerifyInsideCard } from './CardContext';\nimport { ComponentIds } from './Card';\nimport type { CardSpacingValueType } from './types';\nimport type { ButtonProps } from '~components/Button';\nimport { Button } from '~components/Button';\nimport { Divider } from '~components/Divider';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Text } from '~components/Typography';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { DataAnalyticsAttribute, TestID } from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { useIsMobile } from '~utils/useIsMobile';\nimport { throwBladeError } from '~utils/logger';\nimport { useVerifyAllowedChildren } from '~utils/useVerifyAllowedChildren/useVerifyAllowedChildren';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\nexport type CardFooterAction = Pick<\n ButtonProps,\n 'type' | 'accessibilityLabel' | 'isLoading' | 'isDisabled' | 'icon' | 'iconPosition' | 'onClick'\n> & {\n text: ButtonProps['children'];\n};\n\ntype CardFooterProps = {\n children?: React.ReactNode;\n /**\n * For spacing between divider and footer title\n */\n paddingTop?: CardSpacingValueType;\n /**\n * For spacing between body content and divider\n */\n marginTop?: CardSpacingValueType;\n /**\n * @default true\n */\n showDivider?: boolean;\n} & TestID &\n DataAnalyticsAttribute;\n\nconst _CardFooter = ({\n children,\n testID,\n marginTop = 'spacing.4',\n paddingTop = 'spacing.4',\n showDivider = true,\n ...props\n}: CardFooterProps): React.ReactElement => {\n const isMobile = useIsMobile();\n useVerifyInsideCard('CardFooter');\n useVerifyAllowedChildren({\n children,\n componentName: 'CardFooter',\n allowedComponents: [ComponentIds.CardFooterLeading, ComponentIds.CardFooterTrailing],\n });\n\n const footerChildrensArray = React.Children.toArray(children);\n if (__DEV__) {\n if (!React.isValidElement(footerChildrensArray[0])) {\n throwBladeError({\n message: `Invalid React Element ${footerChildrensArray}`,\n moduleName: 'CardFooter',\n });\n }\n }\n\n // the reason why we are checking for actions here is, because we want the footerTrailing\n // to always be aligned to the right\n // if we don't check for action here, and if we do not have footerTrailing and only footerLeading\n // then the content of footerLeading will be justified to the end.\n const baseBoxJustifyContent =\n footerChildrensArray.length === 2 || !(footerChildrensArray[0] as ReactElement)?.props?.actions\n ? 'space-between'\n : 'flex-end';\n\n return (\n <BaseBox\n marginTop={marginTop}\n {...metaAttribute({ name: MetaConstants.CardFooter, testID })}\n {...makeAnalyticsAttribute(props)}\n >\n {showDivider ? <Divider /> : null}\n <BaseBox\n paddingTop={paddingTop}\n display=\"flex\"\n flexDirection={isMobile ? 'column' : 'row'}\n justifyContent={baseBoxJustifyContent}\n alignItems={isMobile ? 'stretch' : 'center'}\n >\n {children}\n </BaseBox>\n </BaseBox>\n );\n};\nconst CardFooter = assignWithoutSideEffects(_CardFooter, { componentId: ComponentIds.CardFooter });\n\ntype CardFooterLeadingProps = {\n title?: string;\n subtitle?: string;\n} & DataAnalyticsAttribute;\nconst _CardFooterLeading = ({\n title,\n subtitle,\n ...rest\n}: CardFooterLeadingProps): React.ReactElement => {\n useVerifyInsideCard('CardFooterLeading');\n\n return (\n <BaseBox textAlign={'left' as never} {...makeAnalyticsAttribute(rest)}>\n {title && (\n <Text color=\"surface.text.gray.normal\" size=\"medium\" weight=\"semibold\">\n {title}\n </Text>\n )}\n {subtitle && (\n <Text color=\"surface.text.gray.subtle\" size=\"small\" weight=\"regular\">\n {subtitle}\n </Text>\n )}\n </BaseBox>\n );\n};\nconst CardFooterLeading = assignWithoutSideEffects(_CardFooterLeading, {\n componentId: ComponentIds.CardFooterLeading,\n});\n\ntype CardFooterTrailingProps = {\n actions?: {\n primary?: CardFooterAction;\n secondary?: CardFooterAction;\n };\n} & DataAnalyticsAttribute;\nconst _CardFooterTrailing = ({ actions, ...rest }: CardFooterTrailingProps): React.ReactElement => {\n const isMobile = useIsMobile();\n useVerifyInsideCard('CardFooterTrailing');\n\n return (\n <BaseBox\n display=\"flex\"\n flexDirection=\"row\"\n alignSelf={isMobile ? 'auto' : 'center'}\n marginTop={isMobile ? 'spacing.5' : 'spacing.0'}\n marginLeft={isMobile ? 'spacing.0' : 'spacing.5'}\n {...makeAnalyticsAttribute(rest)}\n >\n <BaseBox flexGrow={1}>\n {actions?.secondary ? (\n <Button isFullWidth size=\"medium\" variant=\"secondary\" {...actions.secondary}>\n {actions.secondary.text!}\n </Button>\n ) : null}\n </BaseBox>\n <BaseBox marginLeft=\"spacing.5\" />\n <BaseBox flexGrow={1}>\n {actions?.primary ? (\n <Button isFullWidth size=\"medium\" {...actions.primary}>\n {actions.primary.text!}\n </Button>\n ) : null}\n </BaseBox>\n </BaseBox>\n );\n};\nconst CardFooterTrailing = assignWithoutSideEffects(_CardFooterTrailing, {\n componentId: ComponentIds.CardFooterTrailing,\n});\n\nexport { CardFooter, CardFooterLeading, CardFooterTrailing };\n"],"names":["_CardFooter","_ref","_footerChildrensArray","_footerChildrensArray2","children","testID","_ref$marginTop","marginTop","_ref$paddingTop","paddingTop","_ref$showDivider","showDivider","props","_objectWithoutProperties","_excluded","isMobile","useIsMobile","useVerifyInsideCard","useVerifyAllowedChildren","componentName","allowedComponents","ComponentIds","CardFooterLeading","CardFooterTrailing","footerChildrensArray","React","Children","toArray","__DEV__","isValidElement","throwBladeError","message","moduleName","baseBoxJustifyContent","length","actions","_jsxs","BaseBox","Object","assign","metaAttribute","name","MetaConstants","CardFooter","makeAnalyticsAttribute","_jsx","Divider","display","flexDirection","justifyContent","alignItems","assignWithoutSideEffects","componentId","_CardFooterLeading","_ref2","title","subtitle","rest","_excluded2","textAlign","Text","color","size","weight","_CardFooterTrailing","_ref3","_excluded3","alignSelf","marginLeft","flexGrow","secondary","Button","isFullWidth","variant","text","primary"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAA,SAAA,CAAA,CAAA,UAAA,CAAA,QAAA,CAAA,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GAAA,CAACR,OAAO,CAACgC,CAAAA,QAAQ,CAAE,CAAE,CAAAjE,QAAA,CAClB+B,OAAO,EAAPA,IAAAA,EAAAA,OAAO,CAAEmC,SAAS,CACjBzB,GAAA,CAAC0B,MAAM,CAAAjC,MAAA,CAAAC,MAAA,CAAA,CAACiC,WAAW,CAACV,IAAAA,CAAAA,IAAI,CAAC,QAAQ,CAACW,OAAO,CAAC,WAAW,CAAKtC,CAAAA,OAAO,CAACmC,SAAS,CAAA,CAAAlE,QAAA,CACxE+B,OAAO,CAACmC,SAAS,CAACI,IAAI,CAAA,CACjB,CAAC,CACP,IAAI,CACD,CAAC,CACV7B,GAAA,CAACR,OAAO,CAAC+B,CAAAA,UAAU,CAAC,WAAW,CAAE,CAAC,CAClCvB,GAAA,CAACR,OAAO,EAACgC,QAAQ,CAAE,CAAE,CAAAjE,QAAA,CAClB+B,OAAO,QAAPA,OAAO,CAAEwC,OAAO,CACf9B,GAAA,CAAC0B,MAAM,CAAAjC,MAAA,CAAAC,MAAA,CAACiC,CAAAA,WAAW,MAACV,IAAI,CAAC,QAAQ,CAAK3B,CAAAA,OAAO,CAACwC,OAAO,EAAAvE,QAAA,CAClD+B,OAAO,CAACwC,OAAO,CAACD,IAAI,CAAA,CACf,CAAC,CACP,IAAI,CACD,CAAC,GACH,CAAC,CAEd,CAAC,CACK,IAAAnD,kBAAkB,CAAG4B,wBAAwB,CAACa,mBAAmB,CAAE,CACvEZ,WAAW,CAAE/B,YAAY,CAACE,kBAC5B,CAAC;;;;"}
@@ -1,3 +1,4 @@
1
+ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
1
2
  import 'react';
2
3
  import { useVerifyInsideCard } from './CardContext.js';
3
4
  import { ComponentIds } from './Card.js';
@@ -7,7 +8,6 @@ import Button from '../Button/Button/Button.js';
7
8
  import { Counter } from '../Counter/Counter.js';
8
9
  import { Divider } from '../Divider/Divider.js';
9
10
  import { BaseBox } from '../Box/BaseBox/BaseBox.native.js';
10
- import '@babel/runtime/helpers/objectWithoutProperties';
11
11
  import '../Typography/BaseText/BaseText.native.js';
12
12
  import { throwBladeError } from '../../utils/logger/logger.js';
13
13
  import '@babel/runtime/helpers/slicedToArray';
@@ -26,8 +26,9 @@ import { assignWithoutSideEffects } from '../../utils/assignWithoutSideEffects/a
26
26
  import { isValidAllowedChildren, getComponentId } from '../../utils/isValidAllowedChildren/isValidAllowedChildren.js';
27
27
  import { useVerifyAllowedChildren } from '../../utils/useVerifyAllowedChildren/useVerifyAllowedChildren.js';
28
28
  import { Amount } from '../Amount/Amount.js';
29
+ import { makeAnalyticsAttribute } from '../../utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js';
29
30
 
30
- var _CardHeaderIcon=function _CardHeaderIcon(_ref){var Icon=_ref.icon;useVerifyInsideCard('CardHeaderIcon');return jsx(Icon,{color:"surface.icon.gray.normal",size:"large"});};var CardHeaderIcon=assignWithoutSideEffects(_CardHeaderIcon,{componentId:ComponentIds.CardHeaderIcon});var _CardHeaderCounter=function _CardHeaderCounter(props){useVerifyInsideCard('CardHeaderCounter');return jsx(Counter,Object.assign({},props));};var CardHeaderCounter=assignWithoutSideEffects(_CardHeaderCounter,{componentId:ComponentIds.CardHeaderCounter});var _CardHeaderBadge=function _CardHeaderBadge(props){useVerifyInsideCard('CardHeaderBadge');return jsx(Badge,Object.assign({},props));};var CardHeaderBadge=assignWithoutSideEffects(_CardHeaderBadge,{componentId:ComponentIds.CardHeaderBadge});var _CardHeaderAmount=function _CardHeaderAmount(props){useVerifyInsideCard('CardHeaderAmount');return jsx(Amount,Object.assign({},props));};var CardHeaderAmount=assignWithoutSideEffects(_CardHeaderAmount,{componentId:ComponentIds.CardHeaderAmount});var _CardHeaderText=function _CardHeaderText(props){useVerifyInsideCard('CardHeaderText');return jsx(Text,Object.assign({textAlign:"left"},props));};var CardHeaderText=assignWithoutSideEffects(_CardHeaderText,{componentId:ComponentIds.CardHeaderText});var _CardHeaderLink=function _CardHeaderLink(props){useVerifyInsideCard('CardHeaderLink');return jsx(Link,Object.assign({},props));};var CardHeaderLink=assignWithoutSideEffects(_CardHeaderLink,{componentId:ComponentIds.CardHeaderLink});var _CardHeaderIconButton=function _CardHeaderIconButton(props){useVerifyInsideCard('CardHeaderIconButton');return jsx(BaseBox,{width:makeSpace(minHeight.xsmall),children:jsx(Button,Object.assign({},props,{variant:"tertiary",size:"xsmall",iconPosition:"left",isFullWidth:true}))});};var CardHeaderIconButton=assignWithoutSideEffects(_CardHeaderIconButton,{componentId:ComponentIds.CardHeaderIconButton});var _CardHeader=function _CardHeader(_ref2){var children=_ref2.children,testID=_ref2.testID,_ref2$marginBottom=_ref2.marginBottom,marginBottom=_ref2$marginBottom===void 0?'spacing.4':_ref2$marginBottom,_ref2$paddingBottom=_ref2.paddingBottom,paddingBottom=_ref2$paddingBottom===void 0?'spacing.4':_ref2$paddingBottom,_ref2$showDivider=_ref2.showDivider,showDivider=_ref2$showDivider===void 0?true:_ref2$showDivider;useVerifyInsideCard('CardHeader');useVerifyAllowedChildren({children:children,componentName:'CardHeader',allowedComponents:[ComponentIds.CardHeaderLeading,ComponentIds.CardHeaderTrailing]});return jsxs(BaseBox,Object.assign({marginBottom:marginBottom},metaAttribute({name:MetaConstants.CardHeader,testID:testID}),{children:[jsx(BaseBox,{paddingBottom:paddingBottom,display:"flex",flexDirection:"row",justifyContent:"space-between",children:children}),showDivider?jsx(Divider,{}):null]}));};var CardHeader=assignWithoutSideEffects(_CardHeader,{componentId:ComponentIds.CardHeader});var _CardHeaderLeading=function _CardHeaderLeading(_ref3){var title=_ref3.title,subtitle=_ref3.subtitle,prefix=_ref3.prefix,suffix=_ref3.suffix;useVerifyInsideCard('CardHeaderLeading');if(__DEV__){if(prefix&&!isValidAllowedChildren(prefix,ComponentIds.CardHeaderIcon)){throwBladeError({message:`Only \`${ComponentIds.CardHeaderIcon}\` component is accepted in prefix`,moduleName:'CardHeaderLeading'});}if(suffix&&!isValidAllowedChildren(suffix,ComponentIds.CardHeaderCounter)){throwBladeError({message:`Only \`${ComponentIds.CardHeaderCounter}\` component is accepted in prefix`,moduleName:'CardHeaderLeading'});}}return jsxs(BaseBox,{flex:1,display:"flex",flexDirection:"row",children:[jsx(BaseBox,{marginRight:"spacing.3",alignSelf:"center",display:"flex",children:prefix}),jsxs(BaseBox,{marginRight:"spacing.5",children:[jsxs(BaseBox,{display:"flex",flexDirection:"row",alignItems:"center",flexWrap:"wrap",children:[jsx(Text,{color:"surface.text.gray.normal",size:"large",weight:"semibold",children:title}),jsx(BaseBox,{marginLeft:"spacing.3",children:suffix})]}),subtitle&&jsx(Text,{color:"surface.text.gray.subtle",textAlign:"left",size:"small",children:subtitle})]})]});};var CardHeaderLeading=assignWithoutSideEffects(_CardHeaderLeading,{componentId:ComponentIds.CardHeaderLeading});var headerTrailingAllowedComponents=[ComponentIds.CardHeaderLink,ComponentIds.CardHeaderText,ComponentIds.CardHeaderIconButton,ComponentIds.CardHeaderBadge,ComponentIds.CardHeaderAmount];var _CardHeaderTrailing=function _CardHeaderTrailing(_ref4){var visual=_ref4.visual;useVerifyInsideCard('CardHeaderTrailing');if(__DEV__){if(visual&&!headerTrailingAllowedComponents.includes(getComponentId(visual))){throwBladeError({message:`Only one of \`${headerTrailingAllowedComponents.join(', ')}\` component is accepted in visual`,moduleName:'CardHeaderTrailing'});}}return jsx(BaseBox,{alignSelf:"center",children:visual});};var CardHeaderTrailing=assignWithoutSideEffects(_CardHeaderTrailing,{componentId:ComponentIds.CardHeaderTrailing});
31
+ var _excluded=["children","testID","marginBottom","paddingBottom","showDivider"],_excluded2=["title","subtitle","prefix","suffix"];var _CardHeaderIcon=function _CardHeaderIcon(_ref){var Icon=_ref.icon;useVerifyInsideCard('CardHeaderIcon');return jsx(Icon,{color:"surface.icon.gray.normal",size:"large"});};var CardHeaderIcon=assignWithoutSideEffects(_CardHeaderIcon,{componentId:ComponentIds.CardHeaderIcon});var _CardHeaderCounter=function _CardHeaderCounter(props){useVerifyInsideCard('CardHeaderCounter');return jsx(Counter,Object.assign({},props));};var CardHeaderCounter=assignWithoutSideEffects(_CardHeaderCounter,{componentId:ComponentIds.CardHeaderCounter});var _CardHeaderBadge=function _CardHeaderBadge(props){useVerifyInsideCard('CardHeaderBadge');return jsx(Badge,Object.assign({},props));};var CardHeaderBadge=assignWithoutSideEffects(_CardHeaderBadge,{componentId:ComponentIds.CardHeaderBadge});var _CardHeaderAmount=function _CardHeaderAmount(props){useVerifyInsideCard('CardHeaderAmount');return jsx(Amount,Object.assign({},props));};var CardHeaderAmount=assignWithoutSideEffects(_CardHeaderAmount,{componentId:ComponentIds.CardHeaderAmount});var _CardHeaderText=function _CardHeaderText(props){useVerifyInsideCard('CardHeaderText');return jsx(Text,Object.assign({textAlign:"left"},props));};var CardHeaderText=assignWithoutSideEffects(_CardHeaderText,{componentId:ComponentIds.CardHeaderText});var _CardHeaderLink=function _CardHeaderLink(props){useVerifyInsideCard('CardHeaderLink');return jsx(Link,Object.assign({},props));};var CardHeaderLink=assignWithoutSideEffects(_CardHeaderLink,{componentId:ComponentIds.CardHeaderLink});var _CardHeaderIconButton=function _CardHeaderIconButton(props){useVerifyInsideCard('CardHeaderIconButton');return jsx(BaseBox,{width:makeSpace(minHeight.xsmall),children:jsx(Button,Object.assign({},props,{variant:"tertiary",size:"xsmall",iconPosition:"left",isFullWidth:true}))});};var CardHeaderIconButton=assignWithoutSideEffects(_CardHeaderIconButton,{componentId:ComponentIds.CardHeaderIconButton});var _CardHeader=function _CardHeader(_ref2){var children=_ref2.children,testID=_ref2.testID,_ref2$marginBottom=_ref2.marginBottom,marginBottom=_ref2$marginBottom===void 0?'spacing.4':_ref2$marginBottom,_ref2$paddingBottom=_ref2.paddingBottom,paddingBottom=_ref2$paddingBottom===void 0?'spacing.4':_ref2$paddingBottom,_ref2$showDivider=_ref2.showDivider,showDivider=_ref2$showDivider===void 0?true:_ref2$showDivider,rest=_objectWithoutProperties(_ref2,_excluded);useVerifyInsideCard('CardHeader');useVerifyAllowedChildren({children:children,componentName:'CardHeader',allowedComponents:[ComponentIds.CardHeaderLeading,ComponentIds.CardHeaderTrailing]});return jsxs(BaseBox,Object.assign({marginBottom:marginBottom},metaAttribute({name:MetaConstants.CardHeader,testID:testID}),makeAnalyticsAttribute(rest),{children:[jsx(BaseBox,{paddingBottom:paddingBottom,display:"flex",flexDirection:"row",justifyContent:"space-between",children:children}),showDivider?jsx(Divider,{}):null]}));};var CardHeader=assignWithoutSideEffects(_CardHeader,{componentId:ComponentIds.CardHeader});var _CardHeaderLeading=function _CardHeaderLeading(_ref3){var title=_ref3.title,subtitle=_ref3.subtitle,prefix=_ref3.prefix,suffix=_ref3.suffix,rest=_objectWithoutProperties(_ref3,_excluded2);useVerifyInsideCard('CardHeaderLeading');if(__DEV__){if(prefix&&!isValidAllowedChildren(prefix,ComponentIds.CardHeaderIcon)){throwBladeError({message:`Only \`${ComponentIds.CardHeaderIcon}\` component is accepted in prefix`,moduleName:'CardHeaderLeading'});}if(suffix&&!isValidAllowedChildren(suffix,ComponentIds.CardHeaderCounter)){throwBladeError({message:`Only \`${ComponentIds.CardHeaderCounter}\` component is accepted in prefix`,moduleName:'CardHeaderLeading'});}}return jsxs(BaseBox,Object.assign({},makeAnalyticsAttribute(rest),{flex:1,display:"flex",flexDirection:"row",children:[jsx(BaseBox,{marginRight:"spacing.3",alignSelf:"center",display:"flex",children:prefix}),jsxs(BaseBox,{marginRight:"spacing.5",children:[jsxs(BaseBox,{display:"flex",flexDirection:"row",alignItems:"center",flexWrap:"wrap",children:[jsx(Text,{color:"surface.text.gray.normal",size:"large",weight:"semibold",children:title}),jsx(BaseBox,{marginLeft:"spacing.3",children:suffix})]}),subtitle&&jsx(Text,{color:"surface.text.gray.subtle",textAlign:"left",size:"small",children:subtitle})]})]}));};var CardHeaderLeading=assignWithoutSideEffects(_CardHeaderLeading,{componentId:ComponentIds.CardHeaderLeading});var headerTrailingAllowedComponents=[ComponentIds.CardHeaderLink,ComponentIds.CardHeaderText,ComponentIds.CardHeaderIconButton,ComponentIds.CardHeaderBadge,ComponentIds.CardHeaderAmount];var _CardHeaderTrailing=function _CardHeaderTrailing(_ref4){var visual=_ref4.visual;useVerifyInsideCard('CardHeaderTrailing');if(__DEV__){if(visual&&!headerTrailingAllowedComponents.includes(getComponentId(visual))){throwBladeError({message:`Only one of \`${headerTrailingAllowedComponents.join(', ')}\` component is accepted in visual`,moduleName:'CardHeaderTrailing'});}}return jsx(BaseBox,{alignSelf:"center",children:visual});};var CardHeaderTrailing=assignWithoutSideEffects(_CardHeaderTrailing,{componentId:ComponentIds.CardHeaderTrailing});
31
32
 
32
33
  export { CardHeader, CardHeaderAmount, CardHeaderBadge, CardHeaderCounter, CardHeaderIcon, CardHeaderIconButton, CardHeaderLeading, CardHeaderLink, CardHeaderText, CardHeaderTrailing };
33
34
  //# sourceMappingURL=CardHeader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CardHeader.js","sources":["../../../../../src/components/Card/CardHeader.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React from 'react';\nimport { useVerifyInsideCard } from './CardContext';\nimport { ComponentIds } from './Card';\nimport type { CardSpacingValueType } from './types';\nimport type { BadgeProps } from '~components/Badge';\nimport { Badge } from '~components/Badge';\nimport type { LinkProps } from '~components/Link';\nimport { Link } from '~components/Link';\nimport type { ButtonProps } from '~components/Button';\nimport { Button } from '~components/Button';\nimport { Counter } from '~components/Counter';\nimport type { CounterProps } from '~components/Counter';\nimport { Divider } from '~components/Divider';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { TextProps, TextVariant } from '~components/Typography';\nimport { Text } from '~components/Typography';\nimport type { IconComponent } from '~components/Icons';\nimport { minHeight } from '~components/Button/BaseButton/buttonTokens';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { TestID } from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { makeSpace } from '~utils/makeSpace';\nimport { getComponentId, isValidAllowedChildren } from '~utils/isValidAllowedChildren';\nimport { throwBladeError } from '~utils/logger';\nimport { useVerifyAllowedChildren } from '~utils/useVerifyAllowedChildren/useVerifyAllowedChildren';\nimport type { AmountProps } from '~components/Amount';\nimport { Amount } from '~components/Amount';\n\nconst _CardHeaderIcon = ({ icon: Icon }: { icon: IconComponent }): React.ReactElement => {\n useVerifyInsideCard('CardHeaderIcon');\n\n return <Icon color=\"surface.icon.gray.normal\" size=\"large\" />;\n};\nconst CardHeaderIcon = assignWithoutSideEffects(_CardHeaderIcon, {\n componentId: ComponentIds.CardHeaderIcon,\n});\n\nconst _CardHeaderCounter = (props: CounterProps): React.ReactElement => {\n useVerifyInsideCard('CardHeaderCounter');\n\n return <Counter {...props} />;\n};\nconst CardHeaderCounter = assignWithoutSideEffects(_CardHeaderCounter, {\n componentId: ComponentIds.CardHeaderCounter,\n});\n\nconst _CardHeaderBadge = (props: BadgeProps): React.ReactElement => {\n useVerifyInsideCard('CardHeaderBadge');\n\n return <Badge {...props} />;\n};\nconst CardHeaderBadge = assignWithoutSideEffects(_CardHeaderBadge, {\n componentId: ComponentIds.CardHeaderBadge,\n});\n\nconst _CardHeaderAmount = (props: AmountProps): React.ReactElement => {\n useVerifyInsideCard('CardHeaderAmount');\n\n return <Amount {...props} />;\n};\n\nconst CardHeaderAmount = assignWithoutSideEffects(_CardHeaderAmount, {\n componentId: ComponentIds.CardHeaderAmount,\n});\n\nconst _CardHeaderText = (props: TextProps<{ variant: TextVariant }>): React.ReactElement => {\n useVerifyInsideCard('CardHeaderText');\n\n return <Text textAlign=\"left\" {...props} />;\n};\nconst CardHeaderText = assignWithoutSideEffects(_CardHeaderText, {\n componentId: ComponentIds.CardHeaderText,\n});\n\nconst _CardHeaderLink = (props: LinkProps): React.ReactElement => {\n useVerifyInsideCard('CardHeaderLink');\n\n return <Link {...props} />;\n};\nconst CardHeaderLink = assignWithoutSideEffects(_CardHeaderLink, {\n componentId: ComponentIds.CardHeaderLink,\n});\n\ntype CardHeaderIconButtonProps = Omit<\n ButtonProps,\n 'variant' | 'size' | 'iconPosition' | 'isFullWidth' | 'children'\n> & {\n icon: IconComponent;\n};\n\nconst _CardHeaderIconButton = (props: CardHeaderIconButtonProps): React.ReactElement => {\n useVerifyInsideCard('CardHeaderIconButton');\n\n return (\n <BaseBox width={makeSpace(minHeight.xsmall)}>\n <Button {...props} variant=\"tertiary\" size=\"xsmall\" iconPosition=\"left\" isFullWidth />\n </BaseBox>\n );\n};\nconst CardHeaderIconButton = assignWithoutSideEffects(_CardHeaderIconButton, {\n componentId: ComponentIds.CardHeaderIconButton,\n});\n\ntype CardHeaderProps = {\n children?: React.ReactNode;\n /**\n * For spacing between divider and header title\n */\n paddingBottom?: CardSpacingValueType;\n /**\n * For spacing between body content and divider\n */\n marginBottom?: CardSpacingValueType;\n /**\n * @default true\n */\n showDivider?: boolean;\n} & TestID;\n\nconst _CardHeader = ({\n children,\n testID,\n marginBottom = 'spacing.4',\n paddingBottom = 'spacing.4',\n showDivider = true,\n}: CardHeaderProps): React.ReactElement => {\n useVerifyInsideCard('CardHeader');\n useVerifyAllowedChildren({\n children,\n componentName: 'CardHeader',\n allowedComponents: [ComponentIds.CardHeaderLeading, ComponentIds.CardHeaderTrailing],\n });\n\n return (\n <BaseBox\n marginBottom={marginBottom}\n {...metaAttribute({ name: MetaConstants.CardHeader, testID })}\n >\n <BaseBox\n paddingBottom={paddingBottom}\n display=\"flex\"\n flexDirection=\"row\"\n justifyContent=\"space-between\"\n >\n {children}\n </BaseBox>\n {showDivider ? <Divider /> : null}\n </BaseBox>\n );\n};\nconst CardHeader = assignWithoutSideEffects(_CardHeader, { componentId: ComponentIds.CardHeader });\n\ntype CardHeaderLeadingProps = {\n title: string;\n subtitle?: string;\n /**\n * prefix element of Card\n *\n * Accepts: `CardHeaderIcon` component\n */\n prefix?: React.ReactNode;\n /**\n * suffix element of Card\n *\n * Accepts: `CardHeaderCounter` component\n */\n suffix?: React.ReactNode;\n};\nconst _CardHeaderLeading = ({\n title,\n subtitle,\n prefix,\n suffix,\n}: CardHeaderLeadingProps): React.ReactElement => {\n useVerifyInsideCard('CardHeaderLeading');\n\n if (__DEV__) {\n if (prefix && !isValidAllowedChildren(prefix, ComponentIds.CardHeaderIcon)) {\n throwBladeError({\n message: `Only \\`${ComponentIds.CardHeaderIcon}\\` component is accepted in prefix`,\n moduleName: 'CardHeaderLeading',\n });\n }\n\n if (suffix && !isValidAllowedChildren(suffix, ComponentIds.CardHeaderCounter)) {\n throwBladeError({\n message: `Only \\`${ComponentIds.CardHeaderCounter}\\` component is accepted in prefix`,\n moduleName: 'CardHeaderLeading',\n });\n }\n }\n\n return (\n <BaseBox flex={1} display=\"flex\" flexDirection=\"row\">\n <BaseBox marginRight=\"spacing.3\" alignSelf=\"center\" display=\"flex\">\n {prefix}\n </BaseBox>\n <BaseBox marginRight=\"spacing.5\">\n <BaseBox display=\"flex\" flexDirection=\"row\" alignItems=\"center\" flexWrap=\"wrap\">\n <Text color=\"surface.text.gray.normal\" size=\"large\" weight=\"semibold\">\n {title}\n </Text>\n <BaseBox marginLeft=\"spacing.3\">{suffix}</BaseBox>\n </BaseBox>\n {subtitle && (\n <Text color=\"surface.text.gray.subtle\" textAlign=\"left\" size=\"small\">\n {subtitle}\n </Text>\n )}\n </BaseBox>\n </BaseBox>\n );\n};\nconst CardHeaderLeading = assignWithoutSideEffects(_CardHeaderLeading, {\n componentId: ComponentIds.CardHeaderLeading,\n});\n\ntype CardHeaderTrailingProps = {\n /**\n * Renders a visual ornament in card header trailing section\n *\n * Accepts: `CardHeaderLink`, `CardHeaderText`, `CardHeaderIconButton`, `CardHeaderBadge`\n */\n visual?: React.ReactNode;\n};\n\nconst headerTrailingAllowedComponents = [\n ComponentIds.CardHeaderLink,\n ComponentIds.CardHeaderText,\n ComponentIds.CardHeaderIconButton,\n ComponentIds.CardHeaderBadge,\n ComponentIds.CardHeaderAmount,\n];\n\nconst _CardHeaderTrailing = ({ visual }: CardHeaderTrailingProps): React.ReactElement => {\n useVerifyInsideCard('CardHeaderTrailing');\n\n if (__DEV__) {\n if (visual && !headerTrailingAllowedComponents.includes(getComponentId(visual)!)) {\n throwBladeError({\n message: `Only one of \\`${headerTrailingAllowedComponents.join(\n ', ',\n )}\\` component is accepted in visual`,\n moduleName: 'CardHeaderTrailing',\n });\n }\n }\n\n return <BaseBox alignSelf=\"center\">{visual}</BaseBox>;\n};\nconst CardHeaderTrailing = assignWithoutSideEffects(_CardHeaderTrailing, {\n componentId: ComponentIds.CardHeaderTrailing,\n});\n\nexport {\n CardHeader,\n CardHeaderLeading,\n CardHeaderTrailing,\n CardHeaderBadge,\n CardHeaderIcon,\n CardHeaderCounter,\n CardHeaderText,\n CardHeaderLink,\n CardHeaderAmount,\n CardHeaderIconButton,\n};\n"],"names":["_CardHeaderIcon","_ref","Icon","icon","useVerifyInsideCard","_jsx","color","size","CardHeaderIcon","assignWithoutSideEffects","componentId","ComponentIds","_CardHeaderCounter","props","Counter","Object","assign","CardHeaderCounter","_CardHeaderBadge","Badge","CardHeaderBadge","_CardHeaderAmount","Amount","CardHeaderAmount","_CardHeaderText","Text","textAlign","CardHeaderText","_CardHeaderLink","Link","CardHeaderLink","_CardHeaderIconButton","BaseBox","width","makeSpace","minHeight","xsmall","children","Button","variant","iconPosition","isFullWidth","CardHeaderIconButton","_CardHeader","_ref2","testID","_ref2$marginBottom","marginBottom","_ref2$paddingBottom","paddingBottom","_ref2$showDivider","showDivider","useVerifyAllowedChildren","componentName","allowedComponents","CardHeaderLeading","CardHeaderTrailing","_jsxs","metaAttribute","name","MetaConstants","CardHeader","display","flexDirection","justifyContent","Divider","_CardHeaderLeading","_ref3","title","subtitle","prefix","suffix","__DEV__","isValidAllowedChildren","throwBladeError","message","moduleName","flex","marginRight","alignSelf","alignItems","flexWrap","weight","marginLeft","headerTrailingAllowedComponents","_CardHeaderTrailing","_ref4","visual","includes","getComponentId","join"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,IAAMA,eAAe,CAAG,SAA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BS,+BAA+B,CAACM,IAAI,CAC5D,IACF,CAAE,CAAA,kCAAA,CAAmC,CACrCd,UAAU,CAAE,oBACd,CAAC,CAAC,CACJ,CACF,CAEA,OAAOvE,GAAA,CAAC2B,OAAO,CAAC+C,CAAAA,SAAS,CAAC,QAAQ,CAAA1C,QAAA,CAAEkD,MAAM,CAAU,CAAC,CACvD,CAAC,CACK,IAAA/B,kBAAkB,CAAG/C,wBAAwB,CAAC4E,mBAAmB,CAAE,CACvE3E,WAAW,CAAEC,YAAY,CAAC6C,kBAC5B,CAAC;;;;"}
1
+ {"version":3,"file":"CardHeader.js","sources":["../../../../../src/components/Card/CardHeader.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React from 'react';\nimport { useVerifyInsideCard } from './CardContext';\nimport { ComponentIds } from './Card';\nimport type { CardSpacingValueType } from './types';\nimport type { BadgeProps } from '~components/Badge';\nimport { Badge } from '~components/Badge';\nimport type { LinkProps } from '~components/Link';\nimport { Link } from '~components/Link';\nimport type { ButtonProps } from '~components/Button';\nimport { Button } from '~components/Button';\nimport { Counter } from '~components/Counter';\nimport type { CounterProps } from '~components/Counter';\nimport { Divider } from '~components/Divider';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { TextProps, TextVariant } from '~components/Typography';\nimport { Text } from '~components/Typography';\nimport type { IconComponent } from '~components/Icons';\nimport { minHeight } from '~components/Button/BaseButton/buttonTokens';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { DataAnalyticsAttribute, TestID } from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { makeSpace } from '~utils/makeSpace';\nimport { getComponentId, isValidAllowedChildren } from '~utils/isValidAllowedChildren';\nimport { throwBladeError } from '~utils/logger';\nimport { useVerifyAllowedChildren } from '~utils/useVerifyAllowedChildren/useVerifyAllowedChildren';\nimport type { AmountProps } from '~components/Amount';\nimport { Amount } from '~components/Amount';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\nconst _CardHeaderIcon = ({ icon: Icon }: { icon: IconComponent }): React.ReactElement => {\n useVerifyInsideCard('CardHeaderIcon');\n\n return <Icon color=\"surface.icon.gray.normal\" size=\"large\" />;\n};\nconst CardHeaderIcon = assignWithoutSideEffects(_CardHeaderIcon, {\n componentId: ComponentIds.CardHeaderIcon,\n});\n\nconst _CardHeaderCounter = (props: CounterProps): React.ReactElement => {\n useVerifyInsideCard('CardHeaderCounter');\n\n return <Counter {...props} />;\n};\nconst CardHeaderCounter = assignWithoutSideEffects(_CardHeaderCounter, {\n componentId: ComponentIds.CardHeaderCounter,\n});\n\nconst _CardHeaderBadge = (props: BadgeProps): React.ReactElement => {\n useVerifyInsideCard('CardHeaderBadge');\n\n return <Badge {...props} />;\n};\nconst CardHeaderBadge = assignWithoutSideEffects(_CardHeaderBadge, {\n componentId: ComponentIds.CardHeaderBadge,\n});\n\nconst _CardHeaderAmount = (props: AmountProps): React.ReactElement => {\n useVerifyInsideCard('CardHeaderAmount');\n\n return <Amount {...props} />;\n};\n\nconst CardHeaderAmount = assignWithoutSideEffects(_CardHeaderAmount, {\n componentId: ComponentIds.CardHeaderAmount,\n});\n\nconst _CardHeaderText = (props: TextProps<{ variant: TextVariant }>): React.ReactElement => {\n useVerifyInsideCard('CardHeaderText');\n\n return <Text textAlign=\"left\" {...props} />;\n};\nconst CardHeaderText = assignWithoutSideEffects(_CardHeaderText, {\n componentId: ComponentIds.CardHeaderText,\n});\n\nconst _CardHeaderLink = (props: LinkProps): React.ReactElement => {\n useVerifyInsideCard('CardHeaderLink');\n\n return <Link {...props} />;\n};\nconst CardHeaderLink = assignWithoutSideEffects(_CardHeaderLink, {\n componentId: ComponentIds.CardHeaderLink,\n});\n\ntype CardHeaderIconButtonProps = Omit<\n ButtonProps,\n 'variant' | 'size' | 'iconPosition' | 'isFullWidth' | 'children'\n> & {\n icon: IconComponent;\n};\n\nconst _CardHeaderIconButton = (props: CardHeaderIconButtonProps): React.ReactElement => {\n useVerifyInsideCard('CardHeaderIconButton');\n\n return (\n <BaseBox width={makeSpace(minHeight.xsmall)}>\n <Button {...props} variant=\"tertiary\" size=\"xsmall\" iconPosition=\"left\" isFullWidth />\n </BaseBox>\n );\n};\nconst CardHeaderIconButton = assignWithoutSideEffects(_CardHeaderIconButton, {\n componentId: ComponentIds.CardHeaderIconButton,\n});\n\ntype CardHeaderProps = {\n children?: React.ReactNode;\n /**\n * For spacing between divider and header title\n */\n paddingBottom?: CardSpacingValueType;\n /**\n * For spacing between body content and divider\n */\n marginBottom?: CardSpacingValueType;\n /**\n * @default true\n */\n showDivider?: boolean;\n} & TestID &\n DataAnalyticsAttribute;\n\nconst _CardHeader = ({\n children,\n testID,\n marginBottom = 'spacing.4',\n paddingBottom = 'spacing.4',\n showDivider = true,\n ...rest\n}: CardHeaderProps): React.ReactElement => {\n useVerifyInsideCard('CardHeader');\n useVerifyAllowedChildren({\n children,\n componentName: 'CardHeader',\n allowedComponents: [ComponentIds.CardHeaderLeading, ComponentIds.CardHeaderTrailing],\n });\n\n return (\n <BaseBox\n marginBottom={marginBottom}\n {...metaAttribute({ name: MetaConstants.CardHeader, testID })}\n {...makeAnalyticsAttribute(rest)}\n >\n <BaseBox\n paddingBottom={paddingBottom}\n display=\"flex\"\n flexDirection=\"row\"\n justifyContent=\"space-between\"\n >\n {children}\n </BaseBox>\n {showDivider ? <Divider /> : null}\n </BaseBox>\n );\n};\nconst CardHeader = assignWithoutSideEffects(_CardHeader, { componentId: ComponentIds.CardHeader });\n\ntype CardHeaderLeadingProps = {\n title: string;\n subtitle?: string;\n /**\n * prefix element of Card\n *\n * Accepts: `CardHeaderIcon` component\n */\n prefix?: React.ReactNode;\n /**\n * suffix element of Card\n *\n * Accepts: `CardHeaderCounter` component\n */\n suffix?: React.ReactNode;\n} & DataAnalyticsAttribute;\nconst _CardHeaderLeading = ({\n title,\n subtitle,\n prefix,\n suffix,\n ...rest\n}: CardHeaderLeadingProps): React.ReactElement => {\n useVerifyInsideCard('CardHeaderLeading');\n\n if (__DEV__) {\n if (prefix && !isValidAllowedChildren(prefix, ComponentIds.CardHeaderIcon)) {\n throwBladeError({\n message: `Only \\`${ComponentIds.CardHeaderIcon}\\` component is accepted in prefix`,\n moduleName: 'CardHeaderLeading',\n });\n }\n\n if (suffix && !isValidAllowedChildren(suffix, ComponentIds.CardHeaderCounter)) {\n throwBladeError({\n message: `Only \\`${ComponentIds.CardHeaderCounter}\\` component is accepted in prefix`,\n moduleName: 'CardHeaderLeading',\n });\n }\n }\n\n return (\n <BaseBox {...makeAnalyticsAttribute(rest)} flex={1} display=\"flex\" flexDirection=\"row\">\n <BaseBox marginRight=\"spacing.3\" alignSelf=\"center\" display=\"flex\">\n {prefix}\n </BaseBox>\n <BaseBox marginRight=\"spacing.5\">\n <BaseBox display=\"flex\" flexDirection=\"row\" alignItems=\"center\" flexWrap=\"wrap\">\n <Text color=\"surface.text.gray.normal\" size=\"large\" weight=\"semibold\">\n {title}\n </Text>\n <BaseBox marginLeft=\"spacing.3\">{suffix}</BaseBox>\n </BaseBox>\n {subtitle && (\n <Text color=\"surface.text.gray.subtle\" textAlign=\"left\" size=\"small\">\n {subtitle}\n </Text>\n )}\n </BaseBox>\n </BaseBox>\n );\n};\nconst CardHeaderLeading = assignWithoutSideEffects(_CardHeaderLeading, {\n componentId: ComponentIds.CardHeaderLeading,\n});\n\ntype CardHeaderTrailingProps = {\n /**\n * Renders a visual ornament in card header trailing section\n *\n * Accepts: `CardHeaderLink`, `CardHeaderText`, `CardHeaderIconButton`, `CardHeaderBadge`\n */\n visual?: React.ReactNode;\n};\n\nconst headerTrailingAllowedComponents = [\n ComponentIds.CardHeaderLink,\n ComponentIds.CardHeaderText,\n ComponentIds.CardHeaderIconButton,\n ComponentIds.CardHeaderBadge,\n ComponentIds.CardHeaderAmount,\n];\n\nconst _CardHeaderTrailing = ({ visual }: CardHeaderTrailingProps): React.ReactElement => {\n useVerifyInsideCard('CardHeaderTrailing');\n\n if (__DEV__) {\n if (visual && !headerTrailingAllowedComponents.includes(getComponentId(visual)!)) {\n throwBladeError({\n message: `Only one of \\`${headerTrailingAllowedComponents.join(\n ', ',\n )}\\` component is accepted in visual`,\n moduleName: 'CardHeaderTrailing',\n });\n }\n }\n\n return <BaseBox alignSelf=\"center\">{visual}</BaseBox>;\n};\nconst CardHeaderTrailing = assignWithoutSideEffects(_CardHeaderTrailing, {\n componentId: ComponentIds.CardHeaderTrailing,\n});\n\nexport {\n CardHeader,\n CardHeaderLeading,\n CardHeaderTrailing,\n CardHeaderBadge,\n CardHeaderIcon,\n CardHeaderCounter,\n CardHeaderText,\n CardHeaderLink,\n CardHeaderAmount,\n CardHeaderIconButton,\n};\n"],"names":["_CardHeaderIcon","_ref","Icon","icon","useVerifyInsideCard","_jsx","color","size","CardHeaderIcon","assignWithoutSideEffects","componentId","ComponentIds","_CardHeaderCounter","props","Counter","Object","assign","CardHeaderCounter","_CardHeaderBadge","Badge","CardHeaderBadge","_CardHeaderAmount","Amount","CardHeaderAmount","_CardHeaderText","Text","textAlign","CardHeaderText","_CardHeaderLink","Link","CardHeaderLink","_CardHeaderIconButton","BaseBox","width","makeSpace","minHeight","xsmall","children","Button","variant","iconPosition","isFullWidth","CardHeaderIconButton","_CardHeader","_ref2","testID","_ref2$marginBottom","marginBottom","_ref2$paddingBottom","paddingBottom","_ref2$showDivider","showDivider","rest","_objectWithoutProperties","_excluded","useVerifyAllowedChildren","componentName","allowedComponents","CardHeaderLeading","CardHeaderTrailing","_jsxs","metaAttribute","name","MetaConstants","CardHeader","makeAnalyticsAttribute","display","flexDirection","justifyContent","Divider","_CardHeaderLeading","_ref3","title","subtitle","prefix","suffix","_excluded2","__DEV__","isValidAllowedChildren","throwBladeError","message","moduleName","flex","marginRight","alignSelf","alignItems","flexWrap","weight","marginLeft","headerTrailingAllowedComponents","_CardHeaderTrailing","_ref4","visual","includes","getComponentId","join"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAA,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AC+B,oBAAoB,CACjC/B,YAAY,CAACS,eAAe,CAC5BT,YAAY,CAACY,gBAAgB,CAC9B,CAED,IAAMmE,mBAAmB,CAAG,SAAtBA,mBAAmBA,CAAAC,KAAA,CAAgE,CAA1D,IAAAC,MAAM,CAAAD,KAAA,CAANC,MAAM,CACnCxF,mBAAmB,CAAC,oBAAoB,CAAC,CAEzC,GAAIyE,OAAO,CAAE,CACX,GAAIe,MAAM,EAAI,CAACH,+BAA+B,CAACI,QAAQ,CAACC,cAAc,CAACF,MAAM,CAAE,CAAC,CAAE,CAChFb,eAAe,CAAC,CACdC,OAAO,CAAG,CAAA,cAAA,EAAgBS,+BAA+B,CAACM,IAAI,CAC5D,IACF,CAAE,CAAA,kCAAA,CAAmC,CACrCd,UAAU,CAAE,oBACd,CAAC,CAAC,CACJ,CACF,CAEA,OAAO5E,GAAA,CAAC2B,OAAO,CAAA,CAACoD,SAAS,CAAC,QAAQ,CAAA/C,QAAA,CAAEuD,MAAM,CAAU,CAAC,CACvD,CAAC,CACK,IAAAjC,kBAAkB,CAAGlD,wBAAwB,CAACiF,mBAAmB,CAAE,CACvEhF,WAAW,CAAEC,YAAY,CAACgD,kBAC5B,CAAC;;;;"}
@@ -32,13 +32,14 @@ import { SelectorTitle } from '../Form/Selector/SelectorTitle.js';
32
32
  import { SelectorSupportText } from '../Form/Selector/SelectorSupportText.js';
33
33
  import { SelectorInput } from '../Form/Selector/SelectorInput.native.js';
34
34
  import { assignWithoutSideEffects } from '../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
35
+ import { makeAnalyticsAttribute } from '../../utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js';
35
36
 
36
- var _excluded=["defaultChecked","validationState","isChecked","isDisabled","isIndeterminate","isRequired","name","onChange","value","children","helpText","errorText","size","tabIndex","testID"];var _Checkbox=function _Checkbox(_ref,ref){var _groupProps$state,_groupProps$size;var defaultChecked=_ref.defaultChecked,validationState=_ref.validationState,isChecked=_ref.isChecked,isDisabled=_ref.isDisabled,isIndeterminate=_ref.isIndeterminate,isRequired=_ref.isRequired,name=_ref.name,onChange=_ref.onChange,value=_ref.value,children=_ref.children,helpText=_ref.helpText,errorText=_ref.errorText,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,tabIndex=_ref.tabIndex,testID=_ref.testID,styledProps=_objectWithoutProperties(_ref,_excluded);var groupProps=useCheckboxGroupContext();var hasValidationState=!isUndefined(validationState);var hasName=!isUndefined(name);var hasDefaultChecked=!isUndefined(defaultChecked);var hasIsChecked=!isUndefined(isChecked);var hasOnChange=!isUndefined(onChange);if(__DEV__){if((hasValidationState||hasName||hasDefaultChecked||hasIsChecked||hasOnChange)&&!isEmpty(groupProps)){var props=[hasValidationState?'validationState':undefined,hasName?'name':undefined,hasDefaultChecked?'defaultChecked':undefined,hasIsChecked?'isChecked':undefined,hasOnChange?'onChange':undefined].filter(Boolean).join(',');throwBladeError({message:`Cannot set \`${props}\` on <Checkbox /> when it's inside <CheckboxGroup />, Please set it on the <CheckboxGroup /> itself`,moduleName:'Checkbox'});}if(!value&&!isEmpty(groupProps)){throw new Error(`[Blade Checkbox]: <CheckboxGroup /> requires that you pass unique "value" prop to each <Checkbox />
37
+ var _excluded=["defaultChecked","validationState","isChecked","isDisabled","isIndeterminate","isRequired","name","onChange","value","children","helpText","errorText","size","tabIndex","testID"];var _Checkbox=function _Checkbox(_ref,ref){var _groupProps$state,_groupProps$size;var defaultChecked=_ref.defaultChecked,validationState=_ref.validationState,isChecked=_ref.isChecked,isDisabled=_ref.isDisabled,isIndeterminate=_ref.isIndeterminate,isRequired=_ref.isRequired,name=_ref.name,onChange=_ref.onChange,value=_ref.value,children=_ref.children,helpText=_ref.helpText,errorText=_ref.errorText,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,tabIndex=_ref.tabIndex,testID=_ref.testID,rest=_objectWithoutProperties(_ref,_excluded);var groupProps=useCheckboxGroupContext();var hasValidationState=!isUndefined(validationState);var hasName=!isUndefined(name);var hasDefaultChecked=!isUndefined(defaultChecked);var hasIsChecked=!isUndefined(isChecked);var hasOnChange=!isUndefined(onChange);if(__DEV__){if((hasValidationState||hasName||hasDefaultChecked||hasIsChecked||hasOnChange)&&!isEmpty(groupProps)){var props=[hasValidationState?'validationState':undefined,hasName?'name':undefined,hasDefaultChecked?'defaultChecked':undefined,hasIsChecked?'isChecked':undefined,hasOnChange?'onChange':undefined].filter(Boolean).join(',');throwBladeError({message:`Cannot set \`${props}\` on <Checkbox /> when it's inside <CheckboxGroup />, Please set it on the <CheckboxGroup /> itself`,moduleName:'Checkbox'});}if(!value&&!isEmpty(groupProps)){throw new Error(`[Blade Checkbox]: <CheckboxGroup /> requires that you pass unique "value" prop to each <Checkbox />
37
38
  <CheckboxGroup>
38
39
  <Checkbox value="apple">Apple</Checkbox>
39
40
  <Checkbox value="mango">Mango</Checkbox>
40
41
  </CheckboxGroup>
41
- `);}}var _validationState=validationState!=null?validationState:groupProps==null?void 0:groupProps.validationState;var _hasError=_validationState==='error';var _isDisabled=isDisabled!=null?isDisabled:groupProps==null?void 0:groupProps.isDisabled;var _isRequired=Boolean(isRequired||(groupProps==null?void 0:groupProps.isRequired)||(groupProps==null?void 0:groupProps.necessityIndicator)==='required');var _name=name!=null?name:groupProps==null?void 0:groupProps.name;var _isChecked=isChecked!=null?isChecked:groupProps==null?void 0:(_groupProps$state=groupProps.state)==null?void 0:_groupProps$state.isChecked(value);var _size=(_groupProps$size=groupProps.size)!=null?_groupProps$size:size;var _useTheme=useTheme(),theme=_useTheme.theme;var formHintSize={small:'medium',medium:'medium',large:'large'};var showSupportingText=helpText;var handleChange=function handleChange(_ref2){var isChecked=_ref2.isChecked,event=_ref2.event,value=_ref2.value;if(isChecked){var _groupProps$state2;groupProps==null?void 0:(_groupProps$state2=groupProps.state)==null?void 0:_groupProps$state2.addValue(value);}else {var _groupProps$state3;groupProps==null?void 0:(_groupProps$state3=groupProps.state)==null?void 0:_groupProps$state3.removeValue(value);}onChange==null?void 0:onChange({isChecked:isChecked,event:event,value:value});};var _useCheckbox=useCheckbox({defaultChecked:defaultChecked,isChecked:_isChecked,isIndeterminate:isIndeterminate,hasError:_hasError,hasHelperText:Boolean(showSupportingText),isDisabled:_isDisabled,isRequired:_isRequired,name:_name,value:value,onChange:handleChange}),state=_useCheckbox.state,ids=_useCheckbox.ids,inputProps=_useCheckbox.inputProps;var helpTextLeftSpacing=makeSize(checkboxSizes.icon[size].width+theme.spacing[3]);return jsxs(BaseBox,Object.assign({},metaAttribute({name:MetaConstants.Checkbox,testID:testID}),getStyledProps(styledProps),{children:[jsx(SelectorLabel,{componentName:MetaConstants.CheckboxLabel,inputProps:state.isReactNative?inputProps:{},style:{cursor:isDisabled?'not-allowed':'pointer'},children:jsxs(BaseBox,{display:"flex",flexDirection:"column",children:[jsxs(BaseBox,{display:"flex",flexDirection:"row",children:[jsx(SelectorInput,{hoverTokens:checkboxHoverTokens,isChecked:state.isChecked||Boolean(isIndeterminate),isDisabled:_isDisabled,hasError:_hasError,inputProps:inputProps,tabIndex:tabIndex,ref:ref}),jsx(CheckboxIcon,{size:_size,isChecked:state.isChecked,isIndeterminate:isIndeterminate,isDisabled:_isDisabled,isNegative:_hasError}),children?jsx(SelectorTitle,{size:_size,isDisabled:_isDisabled,children:children}):null]}),showSupportingText?jsx(BaseBox,{marginLeft:helpTextLeftSpacing,children:jsx(SelectorSupportText,{size:_size,id:ids==null?void 0:ids.helpTextId,children:helpText})}):null]})}),jsx(FormHint,{size:formHintSize[_size],errorText:errorText,errorTextId:ids==null?void 0:ids.errorTextId,type:validationState==='error'?'error':'help'})]}));};var Checkbox=assignWithoutSideEffects(React__default.forwardRef(_Checkbox),{displayName:'Checkbox'});
42
+ `);}}var _validationState=validationState!=null?validationState:groupProps==null?void 0:groupProps.validationState;var _hasError=_validationState==='error';var _isDisabled=isDisabled!=null?isDisabled:groupProps==null?void 0:groupProps.isDisabled;var _isRequired=Boolean(isRequired||(groupProps==null?void 0:groupProps.isRequired)||(groupProps==null?void 0:groupProps.necessityIndicator)==='required');var _name=name!=null?name:groupProps==null?void 0:groupProps.name;var _isChecked=isChecked!=null?isChecked:groupProps==null?void 0:(_groupProps$state=groupProps.state)==null?void 0:_groupProps$state.isChecked(value);var _size=(_groupProps$size=groupProps.size)!=null?_groupProps$size:size;var _useTheme=useTheme(),theme=_useTheme.theme;var formHintSize={small:'medium',medium:'medium',large:'large'};var showSupportingText=helpText;var handleChange=function handleChange(_ref2){var isChecked=_ref2.isChecked,event=_ref2.event,value=_ref2.value;if(isChecked){var _groupProps$state2;groupProps==null?void 0:(_groupProps$state2=groupProps.state)==null?void 0:_groupProps$state2.addValue(value);}else {var _groupProps$state3;groupProps==null?void 0:(_groupProps$state3=groupProps.state)==null?void 0:_groupProps$state3.removeValue(value);}onChange==null?void 0:onChange({isChecked:isChecked,event:event,value:value});};var _useCheckbox=useCheckbox({defaultChecked:defaultChecked,isChecked:_isChecked,isIndeterminate:isIndeterminate,hasError:_hasError,hasHelperText:Boolean(showSupportingText),isDisabled:_isDisabled,isRequired:_isRequired,name:_name,value:value,onChange:handleChange}),state=_useCheckbox.state,ids=_useCheckbox.ids,inputProps=_useCheckbox.inputProps;var helpTextLeftSpacing=makeSize(checkboxSizes.icon[size].width+theme.spacing[3]);return jsxs(BaseBox,Object.assign({},metaAttribute({name:MetaConstants.Checkbox,testID:testID}),getStyledProps(rest),{children:[jsx(SelectorLabel,{componentName:MetaConstants.CheckboxLabel,inputProps:state.isReactNative?inputProps:{},style:{cursor:isDisabled?'not-allowed':'pointer'},children:jsxs(BaseBox,{display:"flex",flexDirection:"column",children:[jsxs(BaseBox,{display:"flex",flexDirection:"row",children:[jsx(SelectorInput,Object.assign({hoverTokens:checkboxHoverTokens,isChecked:state.isChecked||Boolean(isIndeterminate),isDisabled:_isDisabled,hasError:_hasError,inputProps:inputProps,tabIndex:tabIndex,ref:ref},makeAnalyticsAttribute(rest))),jsx(CheckboxIcon,{size:_size,isChecked:state.isChecked,isIndeterminate:isIndeterminate,isDisabled:_isDisabled,isNegative:_hasError}),children?jsx(SelectorTitle,{size:_size,isDisabled:_isDisabled,children:children}):null]}),showSupportingText?jsx(BaseBox,{marginLeft:helpTextLeftSpacing,children:jsx(SelectorSupportText,{size:_size,id:ids==null?void 0:ids.helpTextId,children:helpText})}):null]})}),jsx(FormHint,{size:formHintSize[_size],errorText:errorText,errorTextId:ids==null?void 0:ids.errorTextId,type:validationState==='error'?'error':'help'})]}));};var Checkbox=assignWithoutSideEffects(React__default.forwardRef(_Checkbox),{displayName:'Checkbox'});
42
43
 
43
44
  export { Checkbox };
44
45
  //# sourceMappingURL=Checkbox.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.js","sources":["../../../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/restrict-plus-operands */\n/* eslint-disable @typescript-eslint/no-shadow */\nimport React from 'react';\nimport { useCheckboxGroupContext } from './CheckboxGroup/CheckboxGroupContext';\nimport { CheckboxIcon } from './CheckboxIcon';\nimport { useCheckbox } from './useCheckbox';\nimport { checkboxHoverTokens, checkboxSizes } from './checkboxTokens';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport isUndefined from '~utils/lodashButBetter/isUndefined';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport BaseBox from '~components/Box/BaseBox';\nimport { FormHint } from '~components/Form';\nimport { SelectorLabel } from '~components/Form/Selector/SelectorLabel';\nimport { SelectorTitle } from '~components/Form/Selector/SelectorTitle';\nimport { SelectorSupportText } from '~components/Form/Selector/SelectorSupportText';\nimport { SelectorInput } from '~components/Form/Selector/SelectorInput';\nimport type { BladeElementRef, TestID } from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { throwBladeError } from '~utils/logger';\nimport { makeSize, useTheme } from '~utils';\n\ntype OnChange = ({\n isChecked,\n event,\n value,\n}: {\n isChecked: boolean;\n event?: React.ChangeEvent;\n value?: string;\n}) => void;\n\ntype CheckboxProps = {\n /**\n * If `true`, The checkbox will be checked. This also makes the checkbox controlled\n * Use `onChange` to update its value\n *\n * @default false\n */\n isChecked?: boolean;\n /**\n * If `true`, the checkbox will be initially checked. This also makes the checkbox uncontrolled\n *\n * @default false\n */\n defaultChecked?: boolean;\n /**\n * The callback invoked when the checked state of the `Checkbox` changes.\n */\n onChange?: OnChange;\n /**\n * Sets the label of the checkbox\n */\n children?: React.ReactNode;\n /**\n * Help text for the checkbox\n */\n helpText?: string;\n /**\n * Error text for the checkbox\n *\n * Renders when `validationState` is set to 'error'\n */\n errorText?: string;\n /**\n * If `true`, the checkbox will be indeterminate.\n * This does not modify the isChecked property.\n *\n * @default false\n */\n isIndeterminate?: boolean;\n /**\n * The name of the input field in a checkbox\n * (Useful for form submission).\n */\n name?: string;\n /**\n * The value to be used in the checkbox input.\n * This is the value that will be returned on form submission.\n */\n value?: string;\n /**\n * If `true`, the checkbox will be disabled\n *\n * @default false\n */\n isDisabled?: boolean;\n /**\n * If `true`, the checkbox input is marked as required,\n * and `required` attribute will be added\n *\n * @default false\n */\n isRequired?: boolean;\n /**\n * If `error`, the checkbox input is marked as invalid,\n * and `invalid` attribute will be added\n */\n validationState?: 'error' | 'none';\n /**\n * Size of the checkbox\n *\n * @default \"medium\"\n */\n size?: 'small' | 'medium' | 'large';\n /**\n * Sets the tab-index property on checkbox element\n *\n */\n tabIndex?: number;\n} & TestID &\n StyledPropsBlade;\n\nconst _Checkbox: React.ForwardRefRenderFunction<BladeElementRef, CheckboxProps> = (\n {\n defaultChecked,\n validationState,\n isChecked,\n isDisabled,\n isIndeterminate,\n isRequired,\n name,\n onChange,\n value,\n children,\n helpText,\n errorText,\n size = 'medium',\n tabIndex,\n testID,\n ...styledProps\n },\n ref,\n) => {\n const groupProps = useCheckboxGroupContext();\n\n // ban certain props in checkbox while inside group\n const hasValidationState = !isUndefined(validationState);\n const hasName = !isUndefined(name);\n const hasDefaultChecked = !isUndefined(defaultChecked);\n const hasIsChecked = !isUndefined(isChecked);\n const hasOnChange = !isUndefined(onChange);\n\n if (__DEV__) {\n if (\n (hasValidationState || hasName || hasDefaultChecked || hasIsChecked || hasOnChange) &&\n !isEmpty(groupProps)\n ) {\n const props = [\n hasValidationState ? 'validationState' : undefined,\n hasName ? 'name' : undefined,\n hasDefaultChecked ? 'defaultChecked' : undefined,\n hasIsChecked ? 'isChecked' : undefined,\n hasOnChange ? 'onChange' : undefined,\n ]\n .filter(Boolean)\n .join(',');\n\n throwBladeError({\n message: `Cannot set \\`${props}\\` on <Checkbox /> when it's inside <CheckboxGroup />, Please set it on the <CheckboxGroup /> itself`,\n moduleName: 'Checkbox',\n });\n }\n\n // mandate value prop when using inside group\n if (!value && !isEmpty(groupProps)) {\n throw new Error(\n `[Blade Checkbox]: <CheckboxGroup /> requires that you pass unique \"value\" prop to each <Checkbox />\n <CheckboxGroup>\n <Checkbox value=\"apple\">Apple</Checkbox>\n <Checkbox value=\"mango\">Mango</Checkbox>\n </CheckboxGroup>\n `,\n );\n }\n }\n\n const _validationState = validationState ?? groupProps?.validationState;\n const _hasError = _validationState === 'error';\n const _isDisabled = isDisabled ?? groupProps?.isDisabled;\n const _isRequired = Boolean(\n isRequired || groupProps?.isRequired || groupProps?.necessityIndicator === 'required',\n );\n const _name = name ?? groupProps?.name;\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n const _isChecked = isChecked ?? groupProps?.state?.isChecked(value!);\n const _size = groupProps.size ?? size;\n const { theme } = useTheme();\n const formHintSize = {\n small: 'medium',\n medium: 'medium',\n large: 'large',\n } as const;\n\n const showSupportingText = helpText;\n\n const handleChange: OnChange = ({ isChecked, event, value }) => {\n if (isChecked) {\n groupProps?.state?.addValue(value!);\n } else {\n groupProps?.state?.removeValue(value!);\n }\n\n onChange?.({ isChecked, event, value });\n };\n\n const { state, ids, inputProps } = useCheckbox({\n defaultChecked,\n isChecked: _isChecked,\n isIndeterminate,\n hasError: _hasError,\n hasHelperText: Boolean(showSupportingText),\n isDisabled: _isDisabled,\n isRequired: _isRequired,\n name: _name,\n value,\n onChange: handleChange,\n });\n\n // Checkbox icon's size & margin + margin-left of SelectorTitle which is 2\n const helpTextLeftSpacing = makeSize(checkboxSizes.icon[size].width + theme.spacing[3]);\n\n return (\n <BaseBox\n {...metaAttribute({ name: MetaConstants.Checkbox, testID })}\n {...getStyledProps(styledProps)}\n >\n <SelectorLabel\n componentName={MetaConstants.CheckboxLabel}\n inputProps={state.isReactNative ? inputProps : {}}\n style={{ cursor: isDisabled ? 'not-allowed' : 'pointer' }}\n >\n <BaseBox display=\"flex\" flexDirection=\"column\">\n <BaseBox display=\"flex\" flexDirection=\"row\">\n <SelectorInput\n hoverTokens={checkboxHoverTokens}\n isChecked={state.isChecked || Boolean(isIndeterminate)}\n isDisabled={_isDisabled}\n hasError={_hasError}\n inputProps={inputProps}\n tabIndex={tabIndex}\n ref={ref}\n />\n <CheckboxIcon\n size={_size}\n isChecked={state.isChecked}\n isIndeterminate={isIndeterminate}\n isDisabled={_isDisabled}\n isNegative={_hasError}\n />\n {children ? (\n <SelectorTitle size={_size} isDisabled={_isDisabled}>\n {children}\n </SelectorTitle>\n ) : null}\n </BaseBox>\n {showSupportingText ? (\n <BaseBox marginLeft={helpTextLeftSpacing}>\n <SelectorSupportText size={_size} id={ids?.helpTextId}>\n {helpText}\n </SelectorSupportText>\n </BaseBox>\n ) : null}\n </BaseBox>\n </SelectorLabel>\n <FormHint\n size={formHintSize[_size]}\n errorText={errorText}\n errorTextId={ids?.errorTextId}\n type={validationState === 'error' ? 'error' : 'help'}\n />\n </BaseBox>\n );\n};\n\nconst Checkbox = assignWithoutSideEffects(React.forwardRef(_Checkbox), {\n displayName: 'Checkbox',\n});\n\nexport type { CheckboxProps };\nexport { Checkbox };\n"],"names":["_Checkbox","_ref","ref","_groupProps$state","_groupProps$size","defaultChecked","validationState","isChecked","isDisabled","isIndeterminate","isRequired","name","onChange","value","children","helpText","errorText","_ref$size","size","tabIndex","testID","styledProps","_objectWithoutProperties","_excluded","groupProps","useCheckboxGroupContext","hasValidationState","isUndefined","hasName","hasDefaultChecked","hasIsChecked","hasOnChange","__DEV__","isEmpty","props","undefined","filter","Boolean","join","throwBladeError","message","moduleName","Error","_validationState","_hasError","_isDisabled","_isRequired","necessityIndicator","_name","_isChecked","state","_size","_useTheme","useTheme","theme","formHintSize","small","medium","large","showSupportingText","handleChange","_ref2","event","_groupProps$state2","addValue","_groupProps$state3","removeValue","_useCheckbox","useCheckbox","hasError","hasHelperText","ids","inputProps","helpTextLeftSpacing","makeSize","checkboxSizes","icon","width","spacing","_jsxs","BaseBox","Object","assign","metaAttribute","MetaConstants","Checkbox","getStyledProps","_jsx","SelectorLabel","componentName","CheckboxLabel","isReactNative","style","cursor","display","flexDirection","SelectorInput","hoverTokens","checkboxHoverTokens","CheckboxIcon","isNegative","SelectorTitle","marginLeft","SelectorSupportText","id","helpTextId","FormHint","errorTextId","type","assignWithoutSideEffects","React","forwardRef","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAA,SAAA,CAAA,CAAA,gBAAA,CAAA,iBAAA,CAAA,WAAA,CAAA,YAAA,CAAA,iBAAA,CAAA,YAAA,CAAA,MAAA,CAAA,UAAA,CAAA,OAAA,CAAA,UAAA,CAAA,UAAA,CAAA,WAAA,CAAA,MAAA,CAAA,UAAA,CAAA,QAAA,CAAA,CAgHA,IAAMA,SAAyE,CAAG,SAA5EA,SAAyEA,CAAAC,IAAA,CAmB7EC,GAAG,CACA,CAAAC,IAAAA,iBAAA,CAAAC,gBAAA,KAlBDC,cAAc,CAAAJ,IAAA,CAAdI,cAAc,CACdC,eAAe,CAAAL,IAAA,CAAfK,eAAe,CACfC,SAAS,CAAAN,IAAA,CAATM,SAAS,CACTC,UAAU,CAAAP,IAAA,CAAVO,UAAU,CACVC,eAAe,CAAAR,IAAA,CAAf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AEK,IAAA+E,QAAQ,CAAGwB,wBAAwB,CAACC,cAAK,CAACC,UAAU,CAAC/G,SAAS,CAAC,CAAE,CACrEgH,WAAW,CAAE,UACf,CAAC;;;;"}
1
+ {"version":3,"file":"Checkbox.js","sources":["../../../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/restrict-plus-operands */\n/* eslint-disable @typescript-eslint/no-shadow */\nimport React from 'react';\nimport { useCheckboxGroupContext } from './CheckboxGroup/CheckboxGroupContext';\nimport { CheckboxIcon } from './CheckboxIcon';\nimport { useCheckbox } from './useCheckbox';\nimport { checkboxHoverTokens, checkboxSizes } from './checkboxTokens';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport isUndefined from '~utils/lodashButBetter/isUndefined';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport BaseBox from '~components/Box/BaseBox';\nimport { FormHint } from '~components/Form';\nimport { SelectorLabel } from '~components/Form/Selector/SelectorLabel';\nimport { SelectorTitle } from '~components/Form/Selector/SelectorTitle';\nimport { SelectorSupportText } from '~components/Form/Selector/SelectorSupportText';\nimport { SelectorInput } from '~components/Form/Selector/SelectorInput';\nimport type { BladeElementRef, DataAnalyticsAttribute, TestID } from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { throwBladeError } from '~utils/logger';\nimport { makeSize, useTheme } from '~utils';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\ntype OnChange = ({\n isChecked,\n event,\n value,\n}: {\n isChecked: boolean;\n event?: React.ChangeEvent;\n value?: string;\n}) => void;\n\ntype CheckboxProps = {\n /**\n * If `true`, The checkbox will be checked. This also makes the checkbox controlled\n * Use `onChange` to update its value\n *\n * @default false\n */\n isChecked?: boolean;\n /**\n * If `true`, the checkbox will be initially checked. This also makes the checkbox uncontrolled\n *\n * @default false\n */\n defaultChecked?: boolean;\n /**\n * The callback invoked when the checked state of the `Checkbox` changes.\n */\n onChange?: OnChange;\n /**\n * Sets the label of the checkbox\n */\n children?: React.ReactNode;\n /**\n * Help text for the checkbox\n */\n helpText?: string;\n /**\n * Error text for the checkbox\n *\n * Renders when `validationState` is set to 'error'\n */\n errorText?: string;\n /**\n * If `true`, the checkbox will be indeterminate.\n * This does not modify the isChecked property.\n *\n * @default false\n */\n isIndeterminate?: boolean;\n /**\n * The name of the input field in a checkbox\n * (Useful for form submission).\n */\n name?: string;\n /**\n * The value to be used in the checkbox input.\n * This is the value that will be returned on form submission.\n */\n value?: string;\n /**\n * If `true`, the checkbox will be disabled\n *\n * @default false\n */\n isDisabled?: boolean;\n /**\n * If `true`, the checkbox input is marked as required,\n * and `required` attribute will be added\n *\n * @default false\n */\n isRequired?: boolean;\n /**\n * If `error`, the checkbox input is marked as invalid,\n * and `invalid` attribute will be added\n */\n validationState?: 'error' | 'none';\n /**\n * Size of the checkbox\n *\n * @default \"medium\"\n */\n size?: 'small' | 'medium' | 'large';\n /**\n * Sets the tab-index property on checkbox element\n *\n */\n tabIndex?: number;\n} & TestID &\n DataAnalyticsAttribute &\n StyledPropsBlade;\n\nconst _Checkbox: React.ForwardRefRenderFunction<BladeElementRef, CheckboxProps> = (\n {\n defaultChecked,\n validationState,\n isChecked,\n isDisabled,\n isIndeterminate,\n isRequired,\n name,\n onChange,\n value,\n children,\n helpText,\n errorText,\n size = 'medium',\n tabIndex,\n testID,\n ...rest\n },\n ref,\n) => {\n const groupProps = useCheckboxGroupContext();\n\n // ban certain props in checkbox while inside group\n const hasValidationState = !isUndefined(validationState);\n const hasName = !isUndefined(name);\n const hasDefaultChecked = !isUndefined(defaultChecked);\n const hasIsChecked = !isUndefined(isChecked);\n const hasOnChange = !isUndefined(onChange);\n\n if (__DEV__) {\n if (\n (hasValidationState || hasName || hasDefaultChecked || hasIsChecked || hasOnChange) &&\n !isEmpty(groupProps)\n ) {\n const props = [\n hasValidationState ? 'validationState' : undefined,\n hasName ? 'name' : undefined,\n hasDefaultChecked ? 'defaultChecked' : undefined,\n hasIsChecked ? 'isChecked' : undefined,\n hasOnChange ? 'onChange' : undefined,\n ]\n .filter(Boolean)\n .join(',');\n\n throwBladeError({\n message: `Cannot set \\`${props}\\` on <Checkbox /> when it's inside <CheckboxGroup />, Please set it on the <CheckboxGroup /> itself`,\n moduleName: 'Checkbox',\n });\n }\n\n // mandate value prop when using inside group\n if (!value && !isEmpty(groupProps)) {\n throw new Error(\n `[Blade Checkbox]: <CheckboxGroup /> requires that you pass unique \"value\" prop to each <Checkbox />\n <CheckboxGroup>\n <Checkbox value=\"apple\">Apple</Checkbox>\n <Checkbox value=\"mango\">Mango</Checkbox>\n </CheckboxGroup>\n `,\n );\n }\n }\n\n const _validationState = validationState ?? groupProps?.validationState;\n const _hasError = _validationState === 'error';\n const _isDisabled = isDisabled ?? groupProps?.isDisabled;\n const _isRequired = Boolean(\n isRequired || groupProps?.isRequired || groupProps?.necessityIndicator === 'required',\n );\n const _name = name ?? groupProps?.name;\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n const _isChecked = isChecked ?? groupProps?.state?.isChecked(value!);\n const _size = groupProps.size ?? size;\n const { theme } = useTheme();\n const formHintSize = {\n small: 'medium',\n medium: 'medium',\n large: 'large',\n } as const;\n\n const showSupportingText = helpText;\n\n const handleChange: OnChange = ({ isChecked, event, value }) => {\n if (isChecked) {\n groupProps?.state?.addValue(value!);\n } else {\n groupProps?.state?.removeValue(value!);\n }\n\n onChange?.({ isChecked, event, value });\n };\n\n const { state, ids, inputProps } = useCheckbox({\n defaultChecked,\n isChecked: _isChecked,\n isIndeterminate,\n hasError: _hasError,\n hasHelperText: Boolean(showSupportingText),\n isDisabled: _isDisabled,\n isRequired: _isRequired,\n name: _name,\n value,\n onChange: handleChange,\n });\n\n // Checkbox icon's size & margin + margin-left of SelectorTitle which is 2\n const helpTextLeftSpacing = makeSize(checkboxSizes.icon[size].width + theme.spacing[3]);\n\n return (\n <BaseBox {...metaAttribute({ name: MetaConstants.Checkbox, testID })} {...getStyledProps(rest)}>\n <SelectorLabel\n componentName={MetaConstants.CheckboxLabel}\n inputProps={state.isReactNative ? inputProps : {}}\n style={{ cursor: isDisabled ? 'not-allowed' : 'pointer' }}\n >\n <BaseBox display=\"flex\" flexDirection=\"column\">\n <BaseBox display=\"flex\" flexDirection=\"row\">\n <SelectorInput\n hoverTokens={checkboxHoverTokens}\n isChecked={state.isChecked || Boolean(isIndeterminate)}\n isDisabled={_isDisabled}\n hasError={_hasError}\n inputProps={inputProps}\n tabIndex={tabIndex}\n ref={ref}\n {...makeAnalyticsAttribute(rest)}\n />\n <CheckboxIcon\n size={_size}\n isChecked={state.isChecked}\n isIndeterminate={isIndeterminate}\n isDisabled={_isDisabled}\n isNegative={_hasError}\n />\n {children ? (\n <SelectorTitle size={_size} isDisabled={_isDisabled}>\n {children}\n </SelectorTitle>\n ) : null}\n </BaseBox>\n {showSupportingText ? (\n <BaseBox marginLeft={helpTextLeftSpacing}>\n <SelectorSupportText size={_size} id={ids?.helpTextId}>\n {helpText}\n </SelectorSupportText>\n </BaseBox>\n ) : null}\n </BaseBox>\n </SelectorLabel>\n <FormHint\n size={formHintSize[_size]}\n errorText={errorText}\n errorTextId={ids?.errorTextId}\n type={validationState === 'error' ? 'error' : 'help'}\n />\n </BaseBox>\n );\n};\n\nconst Checkbox = assignWithoutSideEffects(React.forwardRef(_Checkbox), {\n displayName: 'Checkbox',\n});\n\nexport type { CheckboxProps };\nexport { Checkbox };\n"],"names":["_Checkbox","_ref","ref","_groupProps$state","_groupProps$size","defaultChecked","validationState","isChecked","isDisabled","isIndeterminate","isRequired","name","onChange","value","children","helpText","errorText","_ref$size","size","tabIndex","testID","rest","_objectWithoutProperties","_excluded","groupProps","useCheckboxGroupContext","hasValidationState","isUndefined","hasName","hasDefaultChecked","hasIsChecked","hasOnChange","__DEV__","isEmpty","props","undefined","filter","Boolean","join","throwBladeError","message","moduleName","Error","_validationState","_hasError","_isDisabled","_isRequired","necessityIndicator","_name","_isChecked","state","_size","_useTheme","useTheme","theme","formHintSize","small","medium","large","showSupportingText","handleChange","_ref2","event","_groupProps$state2","addValue","_groupProps$state3","removeValue","_useCheckbox","useCheckbox","hasError","hasHelperText","ids","inputProps","helpTextLeftSpacing","makeSize","checkboxSizes","icon","width","spacing","_jsxs","BaseBox","Object","assign","metaAttribute","MetaConstants","Checkbox","getStyledProps","_jsx","SelectorLabel","componentName","CheckboxLabel","isReactNative","style","cursor","display","flexDirection","SelectorInput","hoverTokens","checkboxHoverTokens","makeAnalyticsAttribute","CheckboxIcon","isNegative","SelectorTitle","marginLeft","SelectorSupportText","id","helpTextId","FormHint","errorTextId","type","assignWithoutSideEffects","React","forwardRef","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAA,SAAA,CAAA,CAAA,gBAAA,CAAA,iBAAA,CAAA,WAAA,CAAA,YAAA,CAAA,iBAAA,CAAA,YAAA,CAAA,MAAA,CAAA,UAAA,CAAA,OAAA,CAAA,UAAA,CAAA,UAAA,CAAA,WAAA,CAAA,MAAA,CAAA,UAAA,CAAA,QAAA,CAAA,CAkHA,IAAMA,SAAyE,CAAG,SAA5EA,SAAyEA,CAAAC,IAAA,CAmB7EC,GAAG,CACA,CAAA,IAAAC,iBAAA,CAAAC,gBAAA,KAlBDC,cAAc,CAAAJ,IAAA,CAAdI,cAAc,CACdC,eAAe,CAAAL,IAAA,CAAfK,eAAe,CACfC,SAAS,CAAAN,IAAA,CAATM,SAAS,CACTC,UAAU,CAAAP,IAAA,CAAVO,UAAU,CACVC,eAAe,CAAAR,IAAA,CAAfQ,eAAe,CACfC,UAAU,CAAAT,IAAA,CAAVS,UAAU,CACVC,IAAI,CAAAV,IAAA,CAAJU,IAAI,CACJC,QAAQ,CAAAX,IAAA,CAARW,QAAQ,CACRC,KAAK,CAAAZ,IAAA,CAALY,KAAK,CACLC,QAAQ,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Stack.js';
22
22
  import { jsx, jsxs } from 'react/jsx-runtime';
23
+ import { makeAnalyticsAttribute } from '../../../utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js';
23
24
 
24
- var _excluded=["children","label","helpText","isDisabled","isRequired","necessityIndicator","labelPosition","validationState","errorText","name","defaultValue","onChange","value","size","testID"];var CheckboxGroup=function CheckboxGroup(_ref){var children=_ref.children,label=_ref.label,helpText=_ref.helpText,_ref$isDisabled=_ref.isDisabled,isDisabled=_ref$isDisabled===void 0?false:_ref$isDisabled,_ref$isRequired=_ref.isRequired,isRequired=_ref$isRequired===void 0?false:_ref$isRequired,_ref$necessityIndicat=_ref.necessityIndicator,necessityIndicator=_ref$necessityIndicat===void 0?'none':_ref$necessityIndicat,_ref$labelPosition=_ref.labelPosition,labelPosition=_ref$labelPosition===void 0?'top':_ref$labelPosition,validationState=_ref.validationState,errorText=_ref.errorText,name=_ref.name,defaultValue=_ref.defaultValue,onChange=_ref.onChange,value=_ref.value,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,testID=_ref.testID,styledProps=_objectWithoutProperties(_ref,_excluded);var _useCheckboxGroup=useCheckboxGroup({defaultValue:defaultValue,onChange:onChange,value:value,isDisabled:isDisabled,necessityIndicator:necessityIndicator,isRequired:isRequired,name:name,labelPosition:labelPosition,validationState:validationState,size:size}),contextValue=_useCheckboxGroup.contextValue,ids=_useCheckboxGroup.ids;var _useTheme=useTheme(),theme=_useTheme.theme;var showError=validationState==='error'&&errorText;var showHelpText=!showError&&helpText;var accessibilityText=`,${showError?errorText:''} ${showHelpText?helpText:''}`;var _useBreakpoint=useBreakpoint({breakpoints:theme.breakpoints}),matchedDeviceType=_useBreakpoint.matchedDeviceType;var gap=checkboxSizes.group.gap[size][matchedDeviceType];var childCount=React__default.Children.count(children);return jsx(CheckboxGroupProvider,{value:contextValue,children:jsx(BaseBox,Object.assign({},getStyledProps(styledProps),{children:jsxs(SelectorGroupField,{position:labelPosition,labelledBy:ids.labelId,componentName:"checkbox-group",testID:testID,children:[label?jsx(FormLabel,{as:"span",necessityIndicator:necessityIndicator,position:labelPosition,id:ids.labelId,accessibilityText:accessibilityText,size:size,children:label}):null,jsxs(BaseBox,{children:[jsx(BaseBox,{display:"flex",flexDirection:"column",children:React__default.Children.map(children,function(child,index){return jsx(BaseBox,{marginBottom:index===childCount-1?makeSize(0):gap,children:child},index);})}),jsx(FormHint,{size:size,errorText:errorText,helpText:helpText,type:validationState==='error'?'error':'help'})]})]})}))});};
25
+ var _excluded=["children","label","helpText","isDisabled","isRequired","necessityIndicator","labelPosition","validationState","errorText","name","defaultValue","onChange","value","size","testID"];var CheckboxGroup=function CheckboxGroup(_ref){var children=_ref.children,label=_ref.label,helpText=_ref.helpText,_ref$isDisabled=_ref.isDisabled,isDisabled=_ref$isDisabled===void 0?false:_ref$isDisabled,_ref$isRequired=_ref.isRequired,isRequired=_ref$isRequired===void 0?false:_ref$isRequired,_ref$necessityIndicat=_ref.necessityIndicator,necessityIndicator=_ref$necessityIndicat===void 0?'none':_ref$necessityIndicat,_ref$labelPosition=_ref.labelPosition,labelPosition=_ref$labelPosition===void 0?'top':_ref$labelPosition,validationState=_ref.validationState,errorText=_ref.errorText,name=_ref.name,defaultValue=_ref.defaultValue,onChange=_ref.onChange,value=_ref.value,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,testID=_ref.testID,rest=_objectWithoutProperties(_ref,_excluded);var _useCheckboxGroup=useCheckboxGroup({defaultValue:defaultValue,onChange:onChange,value:value,isDisabled:isDisabled,necessityIndicator:necessityIndicator,isRequired:isRequired,name:name,labelPosition:labelPosition,validationState:validationState,size:size}),contextValue=_useCheckboxGroup.contextValue,ids=_useCheckboxGroup.ids;var _useTheme=useTheme(),theme=_useTheme.theme;var showError=validationState==='error'&&errorText;var showHelpText=!showError&&helpText;var accessibilityText=`,${showError?errorText:''} ${showHelpText?helpText:''}`;var _useBreakpoint=useBreakpoint({breakpoints:theme.breakpoints}),matchedDeviceType=_useBreakpoint.matchedDeviceType;var gap=checkboxSizes.group.gap[size][matchedDeviceType];var childCount=React__default.Children.count(children);return jsx(CheckboxGroupProvider,{value:contextValue,children:jsx(BaseBox,Object.assign({},getStyledProps(rest),{children:jsxs(SelectorGroupField,Object.assign({position:labelPosition,labelledBy:ids.labelId,componentName:"checkbox-group",testID:testID},makeAnalyticsAttribute(rest),{children:[label?jsx(FormLabel,{as:"span",necessityIndicator:necessityIndicator,position:labelPosition,id:ids.labelId,accessibilityText:accessibilityText,size:size,children:label}):null,jsxs(BaseBox,{children:[jsx(BaseBox,{display:"flex",flexDirection:"column",children:React__default.Children.map(children,function(child,index){return jsx(BaseBox,{marginBottom:index===childCount-1?makeSize(0):gap,children:child},index);})}),jsx(FormHint,{size:size,errorText:errorText,helpText:helpText,type:validationState==='error'?'error':'help'})]})]}))}))});};
25
26
 
26
27
  export { CheckboxGroup };
27
28
  //# sourceMappingURL=CheckboxGroup.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CheckboxGroup.js","sources":["../../../../../../src/components/Checkbox/CheckboxGroup/CheckboxGroup.tsx"],"sourcesContent":["import React from 'react';\nimport { checkboxSizes } from '../checkboxTokens';\nimport { CheckboxGroupProvider } from './CheckboxGroupContext';\nimport { useCheckboxGroup } from './useCheckboxGroup';\nimport { FormLabel, FormHint } from '~components/Form';\nimport BaseBox from '~components/Box/BaseBox';\nimport { SelectorGroupField } from '~components/Form/Selector/SelectorGroupField';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { useBreakpoint } from '~utils';\n\nimport { useTheme } from '~components/BladeProvider';\nimport type { TestID } from '~utils/types';\nimport { makeSize } from '~utils/makeSize';\n\ntype CheckboxGroupProps = {\n /**\n * Accepts multiple checkboxes as children\n */\n children: React.ReactNode;\n /**\n * Help text of the checkbox group\n */\n helpText?: string;\n /**\n * Error text of the checkbox group\n * Renders when `validationState` is set to 'error'\n *\n * Overrides helpText\n */\n errorText?: string;\n /**\n * Sets the error state of the CheckboxGroup\n * If set to `error` it will render the `errorText` of the group,\n * and propagate `invalid` prop to every checkbox\n */\n validationState?: 'error' | 'none';\n /**\n * Renders a necessity indicator after CheckboxGroup label\n *\n * If set to `undefined` it renders nothing.\n */\n necessityIndicator?: 'required' | 'optional' | 'none';\n /**\n * Sets the disabled state of the CheckboxGroup\n * If set to `true` it propagate down to all the checkboxes\n *\n * @default false\n */\n isDisabled?: boolean;\n /**\n * Sets the required state of the CheckboxGroup\n * @default false\n */\n isRequired?: boolean;\n /**\n * Renders the label of the checkbox group\n */\n label?: string;\n /**\n * Sets the position of the label\n *\n * @default 'top'\n */\n labelPosition?: 'top' | 'left';\n /**\n * Initial value of the checkbox group\n */\n defaultValue?: string[];\n /**\n * value of the checkbox group\n *\n * Use `onChange` to update its value\n */\n value?: string[];\n /**\n * The callback invoked when any of the checkbox's state changes\n */\n onChange?: ({ name, values }: { name: string; values: string[] }) => void;\n /**\n * The name of the input field in a checkbox\n * (Useful for form submission).\n */\n name?: string;\n /**\n * Size of the checkbox\n *\n * @default \"medium\"\n */\n size?: 'small' | 'medium' | 'large';\n} & TestID &\n StyledPropsBlade;\n\nconst CheckboxGroup = ({\n children,\n label,\n helpText,\n isDisabled = false,\n isRequired = false,\n necessityIndicator = 'none',\n labelPosition = 'top',\n validationState,\n errorText,\n name,\n defaultValue,\n onChange,\n value,\n size = 'medium',\n testID,\n ...styledProps\n}: CheckboxGroupProps): React.ReactElement => {\n const { contextValue, ids } = useCheckboxGroup({\n defaultValue,\n onChange,\n value,\n isDisabled,\n necessityIndicator,\n isRequired,\n name,\n labelPosition,\n validationState,\n size,\n });\n\n const { theme } = useTheme();\n const showError = validationState === 'error' && errorText;\n const showHelpText = !showError && helpText;\n const accessibilityText = `,${showError ? errorText : ''} ${showHelpText ? helpText : ''}`;\n const { matchedDeviceType } = useBreakpoint({ breakpoints: theme.breakpoints });\n const gap = checkboxSizes.group.gap[size][matchedDeviceType];\n const childCount = React.Children.count(children);\n\n return (\n <CheckboxGroupProvider value={contextValue}>\n <BaseBox {...getStyledProps(styledProps)}>\n <SelectorGroupField\n position={labelPosition}\n labelledBy={ids.labelId}\n componentName=\"checkbox-group\"\n testID={testID}\n >\n {label ? (\n <FormLabel\n as=\"span\"\n necessityIndicator={necessityIndicator}\n position={labelPosition}\n id={ids.labelId}\n accessibilityText={accessibilityText}\n size={size}\n >\n {label}\n </FormLabel>\n ) : null}\n <BaseBox>\n <BaseBox display=\"flex\" flexDirection=\"column\">\n {React.Children.map(children, (child, index) => {\n return (\n <BaseBox\n key={index}\n {...{ marginBottom: index === childCount - 1 ? makeSize(0) : gap }}\n >\n {child}\n </BaseBox>\n );\n })}\n </BaseBox>\n <FormHint\n size={size}\n errorText={errorText}\n helpText={helpText}\n type={validationState === 'error' ? 'error' : 'help'}\n />\n </BaseBox>\n </SelectorGroupField>\n </BaseBox>\n </CheckboxGroupProvider>\n );\n};\n\nexport type { CheckboxGroupProps };\nexport { CheckboxGroup };\n"],"names":["CheckboxGroup","_ref","children","label","helpText","_ref$isDisabled","isDisabled","_ref$isRequired","isRequired","_ref$necessityIndicat","necessityIndicator","_ref$labelPosition","labelPosition","validationState","errorText","name","defaultValue","onChange","value","_ref$size","size","testID","styledProps","_objectWithoutProperties","_excluded","_useCheckboxGroup","useCheckboxGroup","contextValue","ids","_useTheme","useTheme","theme","showError","showHelpText","accessibilityText","_useBreakpoint","useBreakpoint","breakpoints","matchedDeviceType","gap","checkboxSizes","group","childCount","React","Children","count","_jsx","CheckboxGroupProvider","BaseBox","Object","assign","getStyledProps","_jsxs","SelectorGroupField","position","labelledBy","labelId","componentName","FormLabel","as","id","display","flexDirection","map","child","index","marginBottom","makeSize","FormHint","type"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,SAAA,CAAA,CAAA,UAAA,CAAA,OAAA,CAAA,UAAA,CAAA,YAAA,CAAA,YAAA,CAAA,oBAAA,CAAA,eAAA,CAAA,iBAAA,CAAA,WAAA,CAAA,M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sx"],"sourcesContent":["import React from 'react';\nimport { checkboxSizes } from '../checkboxTokens';\nimport { CheckboxGroupProvider } from './CheckboxGroupContext';\nimport { useCheckboxGroup } from './useCheckboxGroup';\nimport { FormLabel, FormHint } from '~components/Form';\nimport BaseBox from '~components/Box/BaseBox';\nimport { SelectorGroupField } from '~components/Form/Selector/SelectorGroupField';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { useBreakpoint } from '~utils';\n\nimport { useTheme } from '~components/BladeProvider';\nimport type { DataAnalyticsAttribute, TestID } from '~utils/types';\nimport { makeSize } from '~utils/makeSize';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\ntype CheckboxGroupProps = {\n /**\n * Accepts multiple checkboxes as children\n */\n children: React.ReactNode;\n /**\n * Help text of the checkbox group\n */\n helpText?: string;\n /**\n * Error text of the checkbox group\n * Renders when `validationState` is set to 'error'\n *\n * Overrides helpText\n */\n errorText?: string;\n /**\n * Sets the error state of the CheckboxGroup\n * If set to `error` it will render the `errorText` of the group,\n * and propagate `invalid` prop to every checkbox\n */\n validationState?: 'error' | 'none';\n /**\n * Renders a necessity indicator after CheckboxGroup label\n *\n * If set to `undefined` it renders nothing.\n */\n necessityIndicator?: 'required' | 'optional' | 'none';\n /**\n * Sets the disabled state of the CheckboxGroup\n * If set to `true` it propagate down to all the checkboxes\n *\n * @default false\n */\n isDisabled?: boolean;\n /**\n * Sets the required state of the CheckboxGroup\n * @default false\n */\n isRequired?: boolean;\n /**\n * Renders the label of the checkbox group\n */\n label?: string;\n /**\n * Sets the position of the label\n *\n * @default 'top'\n */\n labelPosition?: 'top' | 'left';\n /**\n * Initial value of the checkbox group\n */\n defaultValue?: string[];\n /**\n * value of the checkbox group\n *\n * Use `onChange` to update its value\n */\n value?: string[];\n /**\n * The callback invoked when any of the checkbox's state changes\n */\n onChange?: ({ name, values }: { name: string; values: string[] }) => void;\n /**\n * The name of the input field in a checkbox\n * (Useful for form submission).\n */\n name?: string;\n /**\n * Size of the checkbox\n *\n * @default \"medium\"\n */\n size?: 'small' | 'medium' | 'large';\n} & TestID &\n DataAnalyticsAttribute &\n StyledPropsBlade;\n\nconst CheckboxGroup = ({\n children,\n label,\n helpText,\n isDisabled = false,\n isRequired = false,\n necessityIndicator = 'none',\n labelPosition = 'top',\n validationState,\n errorText,\n name,\n defaultValue,\n onChange,\n value,\n size = 'medium',\n testID,\n ...rest\n}: CheckboxGroupProps): React.ReactElement => {\n const { contextValue, ids } = useCheckboxGroup({\n defaultValue,\n onChange,\n value,\n isDisabled,\n necessityIndicator,\n isRequired,\n name,\n labelPosition,\n validationState,\n size,\n });\n\n const { theme } = useTheme();\n const showError = validationState === 'error' && errorText;\n const showHelpText = !showError && helpText;\n const accessibilityText = `,${showError ? errorText : ''} ${showHelpText ? helpText : ''}`;\n const { matchedDeviceType } = useBreakpoint({ breakpoints: theme.breakpoints });\n const gap = checkboxSizes.group.gap[size][matchedDeviceType];\n const childCount = React.Children.count(children);\n\n return (\n <CheckboxGroupProvider value={contextValue}>\n <BaseBox {...getStyledProps(rest)}>\n <SelectorGroupField\n position={labelPosition}\n labelledBy={ids.labelId}\n componentName=\"checkbox-group\"\n testID={testID}\n {...makeAnalyticsAttribute(rest)}\n >\n {label ? (\n <FormLabel\n as=\"span\"\n necessityIndicator={necessityIndicator}\n position={labelPosition}\n id={ids.labelId}\n accessibilityText={accessibilityText}\n size={size}\n >\n {label}\n </FormLabel>\n ) : null}\n <BaseBox>\n <BaseBox display=\"flex\" flexDirection=\"column\">\n {React.Children.map(children, (child, index) => {\n return (\n <BaseBox\n key={index}\n {...{ marginBottom: index === childCount - 1 ? makeSize(0) : gap }}\n >\n {child}\n </BaseBox>\n );\n })}\n </BaseBox>\n <FormHint\n size={size}\n errorText={errorText}\n helpText={helpText}\n type={validationState === 'error' ? 'error' : 'help'}\n />\n </BaseBox>\n </SelectorGroupField>\n </BaseBox>\n </CheckboxGroupProvider>\n );\n};\n\nexport type { CheckboxGroupProps };\nexport { CheckboxGroup };\n"],"names":["CheckboxGroup","_ref","children","label","helpText","_ref$isDisabled","isDisabled","_ref$isRequired","isRequired","_ref$necessityIndicat","necessityIndicator","_ref$labelPosition","labelPosition","validationState","errorText","name","defaultValue","onChange","value","_ref$size","size","testID","rest","_objectWithoutProperties","_excluded","_useCheckboxGroup","useCheckboxGroup","contextValue","ids","_useTheme","useTheme","theme","showError","showHelpText","accessibilityText","_useBreakpoint","useBreakpoint","breakpoints","matchedDeviceType","gap","checkboxSizes","group","childCount","React","Children","count","_jsx","CheckboxGroupProvider","BaseBox","Object","assign","getStyledProps","_jsxs","SelectorGroupField","position","labelledBy","labelId","componentName","makeAnalyticsAttribute","FormLabel","as","id","display","flexDirection","map","child","index","marginBottom","makeSize","FormHint","type"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,SAAA,CAAA,CAAA,UAAA,CAAA,OAAA,CAAA,UAAA,CAAA,YAAA,CAAA,YAAA,CAAA,oBAAA,CAAA,eAAA,CAAA,iBAAA,CAAA,WAAA,CAAA,MAAA,CAAA,cAAA,CAAA,UAAA,CAAA,OAAA,CAAA,MAAA,CAAA,QAAA,CAAA,CA+FM,IAAAA,aAAa,CAAG,SAAhBA,aAAaA,CAAAC,IAAA,CAiB2B,CAhB5C,IAAAC,QAAQ,CAAAD,IAAA,CAARC,QAAQ,CACRC,KAAK,CAAAF,IAAA,CAALE,KAAK,CACLC,QAAQ,CAAAH,IAAA,CAARG,QAAQ,CAAAC,eAAA,CAAAJ,IAAA,CACRK,UAAU,CAAVA,UAAU,CAAAD,eAAA,GAAA,KAAA,CAAA,CAAG,KAAK,CAAAA,eAAA,CAAAE,eAAA,CAAAN,IAAA,CAClBO,UAAU,CAAVA,UAAU,CAAAD,eAAA,GAAA,KAAA,CAAA,CAAG,KAAK,CAAAA,eAAA,CAAAE,qBAAA,CAAAR,IAAA,CAClBS,kBAAkB,CAAlBA,kBAAkB,CAAAD,qBAAA,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AA,OAAO,CAAC,MAAM,CAACC,aAAa,CAAC,QAAQ,CAAA7D,QAAA,CAC3CyC,cAAK,CAACC,QAAQ,CAACoB,GAAG,CAAC9D,QAAQ,CAAE,SAAC+D,KAAK,CAAEC,KAAK,CAAK,CAC9C,OACEpB,GAAA,CAACE,OAAO,CAAA,CAEAmB,YAAY,CAAED,KAAK,GAAKxB,UAAU,CAAG,CAAC,CAAG0B,QAAQ,CAAC,CAAC,CAAC,CAAG7B,GAAG,CAAArC,QAAA,CAE/D+D,KAAK,CAHDC,CAAAA,KAIE,CAAC,CAEd,CAAC,CAAC,CACK,CAAC,CACVpB,GAAA,CAACuB,QAAQ,CACPjD,CAAAA,IAAI,CAAEA,IAAK,CACXN,SAAS,CAAEA,SAAU,CACrBV,QAAQ,CAAEA,QAAS,CACnBkE,IAAI,CAAEzD,eAAe,GAAK,OAAO,CAAG,OAAO,CAAG,MAAO,CACtD,CAAC,CACK,CAAA,CAAC,GACQ,CAAC,CAAA,CACd,CAAC,CACW,CAAC,CAE5B;;;;"}
@@ -31,8 +31,9 @@ import 'styled-components/native';
31
31
  import '@gorhom/portal';
32
32
  import 'react-native-gesture-handler';
33
33
  import '../BottomSheet/BottomSheetStack.js';
34
+ import { makeAnalyticsAttribute } from '../../utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js';
34
35
 
35
- var _excluded=["isDisabled","value","children","icon","color","testID"];var _Chip=function _Chip(_ref,ref){var _groupProps$state,_groupProps$defaultVa,_ref2;var isDisabled=_ref.isDisabled,value=_ref.value,children=_ref.children,Icon=_ref.icon,color=_ref.color,testID=_ref.testID,styledProps=_objectWithoutProperties(_ref,_excluded);var _useTheme=useTheme(),theme=_useTheme.theme;var _useBreakpoint=useBreakpoint({breakpoints:theme.breakpoints}),matchedDeviceType=_useBreakpoint.matchedDeviceType;var groupProps=useChipGroupContext();var isInsideGroup=!isEmpty(groupProps);var _React$useState=React__default.useState(false),_React$useState2=_slicedToArray(_React$useState,2),isPressed=_React$useState2[0],setIsPressed=_React$useState2[1];if(__DEV__){if(!isInsideGroup){throwBladeError({moduleName:'Chip',message:'<Chip /> component should only be used within the context of a <ChipGroup /> component'});}}var hasError=(groupProps==null?void 0:groupProps.validationState)==='error';var _isDisabled=isDisabled!=null?isDisabled:groupProps==null?void 0:groupProps.isDisabled;var _isRequired=(groupProps==null?void 0:groupProps.isRequired)||(groupProps==null?void 0:groupProps.necessityIndicator)==='required';var _name=groupProps==null?void 0:groupProps.name;var _isChecked=groupProps==null?void 0:(_groupProps$state=groupProps.state)==null?void 0:_groupProps$state.isChecked(value);var defaultChecked=typeof(groupProps==null?void 0:groupProps.defaultValue)==='undefined'?undefined:groupProps==null?void 0:(_groupProps$defaultVa=groupProps.defaultValue)==null?void 0:_groupProps$defaultVa.includes(value);var useChip=(groupProps==null?void 0:groupProps.selectionType)==='single'?useRadio:useCheckbox;var _size=(groupProps==null?void 0:groupProps.size)||'small';var chipColor=(_ref2=color!=null?color:groupProps==null?void 0:groupProps.color)!=null?_ref2:'primary';var handleChange=function handleChange(_ref3){var isChecked=_ref3.isChecked,value=_ref3.value;if(isChecked){var _groupProps$state2;groupProps==null?void 0:(_groupProps$state2=groupProps.state)==null?void 0:_groupProps$state2.addValue(value);}else {var _groupProps$state3;groupProps==null?void 0:(_groupProps$state3=groupProps.state)==null?void 0:_groupProps$state3.removeValue(value);}};var _useChip=useChip({defaultChecked:defaultChecked,isChecked:_isChecked,isDisabled:_isDisabled,isRequired:_isRequired,hasError:hasError,name:_name,value:value,onChange:handleChange}),state=_useChip.state,inputProps=_useChip.inputProps;var handlePointerPressedIn=React__default.useCallback(function(){if(_isDisabled)return;setIsPressed(true);},[_isDisabled]);var handlePointerPressedOut=React__default.useCallback(function(){if(_isDisabled)return;setIsPressed(false);},[_isDisabled]);var handleKeyboardPressedIn=React__default.useCallback(function(e){if(_isDisabled)return;if(e.key===' '){setIsPressed(true);}},[_isDisabled]);var handleKeyboardPressedOut=React__default.useCallback(function(e){if(_isDisabled)return;if(e.key===' '){setIsPressed(false);}},[_isDisabled]);var textVariant='unchecked';if(_isChecked&&chipColor){textVariant=chipColor;}if(_isDisabled){textVariant='disabled';}var chipTextColor=chipColorTokens.text[textVariant];var chipIconColor=chipColorTokens.icon[textVariant];var colorVariant='unchecked';var stateVariant=_isDisabled?'disabled':'default';if(_isChecked&&chipColor){colorVariant=chipColor;}var chipBackgroundColor=chipColorTokens.background[colorVariant][stateVariant];var chipBorderColor=chipColorTokens.border[colorVariant][stateVariant];return jsx(BaseBox,Object.assign({},metaAttribute({name:MetaConstants.Chip,testID:testID}),getStyledProps(styledProps),{display:isReactNative()?'flex':'inline-flex',children:jsx(SelectorLabel,{componentName:MetaConstants.ChipLabel,onTouchStart:handlePointerPressedIn,onTouchEnd:handlePointerPressedOut,onMouseDown:handlePointerPressedIn,onMouseUp:handlePointerPressedOut,onMouseOut:handlePointerPressedOut,onKeyDown:handleKeyboardPressedIn,onKeyUp:handleKeyboardPressedOut,inputProps:isReactNative()?inputProps:{},style:{cursor:_isDisabled?'not-allowed':'pointer'},children:jsx(BaseBox,{display:"flex",flexDirection:"column",children:jsxs(BaseBox,{display:"flex",alignItems:"center",flexDirection:"row",children:[jsx(SelectorInput,{hoverTokens:getChipInputHoverTokens(chipColor),isChecked:state.isChecked,isDisabled:_isDisabled,inputProps:inputProps,hasError:hasError,ref:ref}),jsx(AnimatedChip,{borderColor:chipBorderColor,isDisabled:_isDisabled,isPressed:isPressed,isDesktop:matchedDeviceType==='desktop',children:jsxs(StyledChipWrapper,{borderColor:chipBorderColor,isChecked:_isChecked,isDisabled:_isDisabled,color:chipColor,display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",overflow:"hidden",backgroundColor:chipBackgroundColor,borderRadius:"max",borderWidth:['xsmall','small'].includes(_size)?'thinner':'thin',paddingLeft:chipHorizontalPaddingTokens[Boolean(Icon)?'withIcon':'withoutIcon'].left[_size],paddingRight:chipHorizontalPaddingTokens[Boolean(Icon)?'withIcon':'withoutIcon'].right[_size],height:makeSize(chipHeightTokens[_size]),children:[Icon?jsx(BaseBox,{paddingRight:"spacing.3",display:"flex",children:jsx(Icon,{color:chipIconColor,size:chipIconSizes[_size]})}):null,jsx(Text,Object.assign({},chipTextSizes[_size],{truncateAfterLines:1,color:chipTextColor,children:children}))]})})]})})})}));};var Chip=assignWithoutSideEffects(React__default.forwardRef(_Chip),{displayName:'Chip'});
36
+ var _excluded=["isDisabled","value","children","icon","color","testID"];var _Chip=function _Chip(_ref,ref){var _groupProps$state,_groupProps$defaultVa,_ref2;var isDisabled=_ref.isDisabled,value=_ref.value,children=_ref.children,Icon=_ref.icon,color=_ref.color,testID=_ref.testID,rest=_objectWithoutProperties(_ref,_excluded);var _useTheme=useTheme(),theme=_useTheme.theme;var _useBreakpoint=useBreakpoint({breakpoints:theme.breakpoints}),matchedDeviceType=_useBreakpoint.matchedDeviceType;var groupProps=useChipGroupContext();var isInsideGroup=!isEmpty(groupProps);var _React$useState=React__default.useState(false),_React$useState2=_slicedToArray(_React$useState,2),isPressed=_React$useState2[0],setIsPressed=_React$useState2[1];if(__DEV__){if(!isInsideGroup){throwBladeError({moduleName:'Chip',message:'<Chip /> component should only be used within the context of a <ChipGroup /> component'});}}var hasError=(groupProps==null?void 0:groupProps.validationState)==='error';var _isDisabled=isDisabled!=null?isDisabled:groupProps==null?void 0:groupProps.isDisabled;var _isRequired=(groupProps==null?void 0:groupProps.isRequired)||(groupProps==null?void 0:groupProps.necessityIndicator)==='required';var _name=groupProps==null?void 0:groupProps.name;var _isChecked=groupProps==null?void 0:(_groupProps$state=groupProps.state)==null?void 0:_groupProps$state.isChecked(value);var defaultChecked=typeof(groupProps==null?void 0:groupProps.defaultValue)==='undefined'?undefined:groupProps==null?void 0:(_groupProps$defaultVa=groupProps.defaultValue)==null?void 0:_groupProps$defaultVa.includes(value);var useChip=(groupProps==null?void 0:groupProps.selectionType)==='single'?useRadio:useCheckbox;var _size=(groupProps==null?void 0:groupProps.size)||'small';var chipColor=(_ref2=color!=null?color:groupProps==null?void 0:groupProps.color)!=null?_ref2:'primary';var handleChange=function handleChange(_ref3){var isChecked=_ref3.isChecked,value=_ref3.value;if(isChecked){var _groupProps$state2;groupProps==null?void 0:(_groupProps$state2=groupProps.state)==null?void 0:_groupProps$state2.addValue(value);}else {var _groupProps$state3;groupProps==null?void 0:(_groupProps$state3=groupProps.state)==null?void 0:_groupProps$state3.removeValue(value);}};var _useChip=useChip({defaultChecked:defaultChecked,isChecked:_isChecked,isDisabled:_isDisabled,isRequired:_isRequired,hasError:hasError,name:_name,value:value,onChange:handleChange}),state=_useChip.state,inputProps=_useChip.inputProps;var handlePointerPressedIn=React__default.useCallback(function(){if(_isDisabled)return;setIsPressed(true);},[_isDisabled]);var handlePointerPressedOut=React__default.useCallback(function(){if(_isDisabled)return;setIsPressed(false);},[_isDisabled]);var handleKeyboardPressedIn=React__default.useCallback(function(e){if(_isDisabled)return;if(e.key===' '){setIsPressed(true);}},[_isDisabled]);var handleKeyboardPressedOut=React__default.useCallback(function(e){if(_isDisabled)return;if(e.key===' '){setIsPressed(false);}},[_isDisabled]);var textVariant='unchecked';if(_isChecked&&chipColor){textVariant=chipColor;}if(_isDisabled){textVariant='disabled';}var chipTextColor=chipColorTokens.text[textVariant];var chipIconColor=chipColorTokens.icon[textVariant];var colorVariant='unchecked';var stateVariant=_isDisabled?'disabled':'default';if(_isChecked&&chipColor){colorVariant=chipColor;}var chipBackgroundColor=chipColorTokens.background[colorVariant][stateVariant];var chipBorderColor=chipColorTokens.border[colorVariant][stateVariant];return jsx(BaseBox,Object.assign({},metaAttribute({name:MetaConstants.Chip,testID:testID}),getStyledProps(rest),makeAnalyticsAttribute(rest),{display:isReactNative()?'flex':'inline-flex',children:jsx(SelectorLabel,{componentName:MetaConstants.ChipLabel,onTouchStart:handlePointerPressedIn,onTouchEnd:handlePointerPressedOut,onMouseDown:handlePointerPressedIn,onMouseUp:handlePointerPressedOut,onMouseOut:handlePointerPressedOut,onKeyDown:handleKeyboardPressedIn,onKeyUp:handleKeyboardPressedOut,inputProps:isReactNative()?inputProps:{},style:{cursor:_isDisabled?'not-allowed':'pointer'},children:jsx(BaseBox,{display:"flex",flexDirection:"column",children:jsxs(BaseBox,{display:"flex",alignItems:"center",flexDirection:"row",children:[jsx(SelectorInput,{hoverTokens:getChipInputHoverTokens(chipColor),isChecked:state.isChecked,isDisabled:_isDisabled,inputProps:inputProps,hasError:hasError,ref:ref}),jsx(AnimatedChip,{borderColor:chipBorderColor,isDisabled:_isDisabled,isPressed:isPressed,isDesktop:matchedDeviceType==='desktop',children:jsxs(StyledChipWrapper,{borderColor:chipBorderColor,isChecked:_isChecked,isDisabled:_isDisabled,color:chipColor,display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",overflow:"hidden",backgroundColor:chipBackgroundColor,borderRadius:"max",borderWidth:['xsmall','small'].includes(_size)?'thinner':'thin',paddingLeft:chipHorizontalPaddingTokens[Boolean(Icon)?'withIcon':'withoutIcon'].left[_size],paddingRight:chipHorizontalPaddingTokens[Boolean(Icon)?'withIcon':'withoutIcon'].right[_size],height:makeSize(chipHeightTokens[_size]),children:[Icon?jsx(BaseBox,{paddingRight:"spacing.3",display:"flex",children:jsx(Icon,{color:chipIconColor,size:chipIconSizes[_size]})}):null,jsx(Text,Object.assign({},chipTextSizes[_size],{truncateAfterLines:1,color:chipTextColor,children:children}))]})})]})})})}));};var Chip=assignWithoutSideEffects(React__default.forwardRef(_Chip),{displayName:'Chip'});
36
37
 
37
38
  export { Chip };
38
39
  //# sourceMappingURL=Chip.js.map