@razorpay/blade 11.37.0 → 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 (520) 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/Indicator/Indicator.js +2 -1
  67. package/build/lib/native/components/Indicator/Indicator.js.map +1 -1
  68. package/build/lib/native/components/Input/BaseInput/BaseInput.js +2 -1
  69. package/build/lib/native/components/Input/BaseInput/BaseInput.js.map +1 -1
  70. package/build/lib/native/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js +2 -1
  71. package/build/lib/native/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js.map +1 -1
  72. package/build/lib/native/components/Input/DropdownInputTriggers/SelectInput.js +2 -1
  73. package/build/lib/native/components/Input/DropdownInputTriggers/SelectInput.js.map +1 -1
  74. package/build/lib/native/components/Input/OTPInput/OTPInput.js +2 -1
  75. package/build/lib/native/components/Input/OTPInput/OTPInput.js.map +1 -1
  76. package/build/lib/native/components/Input/PasswordInput/PasswordInput.js +1 -1
  77. package/build/lib/native/components/Input/PasswordInput/PasswordInput.js.map +1 -1
  78. package/build/lib/native/components/Input/SearchInput/SearchInput.js +1 -1
  79. package/build/lib/native/components/Input/SearchInput/SearchInput.js.map +1 -1
  80. package/build/lib/native/components/Input/TextArea/TextArea.js +1 -1
  81. package/build/lib/native/components/Input/TextArea/TextArea.js.map +1 -1
  82. package/build/lib/native/components/Input/TextInput/TextInput.js +1 -1
  83. package/build/lib/native/components/Input/TextInput/TextInput.js.map +1 -1
  84. package/build/lib/native/components/Link/BaseLink/BaseLink.js +2 -1
  85. package/build/lib/native/components/Link/BaseLink/BaseLink.js.map +1 -1
  86. package/build/lib/native/components/Link/Link/Link.js +2 -1
  87. package/build/lib/native/components/Link/Link/Link.js.map +1 -1
  88. package/build/lib/native/components/ProgressBar/ProgressBar.js +2 -1
  89. package/build/lib/native/components/ProgressBar/ProgressBar.js.map +1 -1
  90. package/build/lib/native/components/Radio/Radio.js +2 -1
  91. package/build/lib/native/components/Radio/Radio.js.map +1 -1
  92. package/build/lib/native/components/Radio/RadioGroup/RadioGroup.js +2 -1
  93. package/build/lib/native/components/Radio/RadioGroup/RadioGroup.js.map +1 -1
  94. package/build/lib/native/components/StepGroup/tokens.js +1 -1
  95. package/build/lib/native/components/StepGroup/tokens.js.map +1 -1
  96. package/build/lib/native/components/Switch/Switch.js +2 -1
  97. package/build/lib/native/components/Switch/Switch.js.map +1 -1
  98. package/build/lib/native/components/Tag/Tag.js +2 -1
  99. package/build/lib/native/components/Tag/Tag.js.map +1 -1
  100. package/build/lib/native/tokens/global/size.js +1 -1
  101. package/build/lib/native/tokens/global/size.js.map +1 -1
  102. package/build/lib/native/utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js +7 -0
  103. package/build/lib/native/utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js.map +1 -0
  104. package/build/lib/web/development/components/Accordion/Accordion.js +5 -3
  105. package/build/lib/web/development/components/Accordion/Accordion.js.map +1 -1
  106. package/build/lib/web/development/components/Accordion/AccordionButton.web.js +8 -3
  107. package/build/lib/web/development/components/Accordion/AccordionButton.web.js.map +1 -1
  108. package/build/lib/web/development/components/Accordion/AccordionItem.js +8 -3
  109. package/build/lib/web/development/components/Accordion/AccordionItem.js.map +1 -1
  110. package/build/lib/web/development/components/Accordion/AccordionItemBody.js +8 -3
  111. package/build/lib/web/development/components/Accordion/AccordionItemBody.js.map +1 -1
  112. package/build/lib/web/development/components/Accordion/AccordionItemHeader.js +10 -4
  113. package/build/lib/web/development/components/Accordion/AccordionItemHeader.js.map +1 -1
  114. package/build/lib/web/development/components/ActionList/ActionList.js +9 -4
  115. package/build/lib/web/development/components/ActionList/ActionList.js.map +1 -1
  116. package/build/lib/web/development/components/ActionList/ActionListBox.web.js +8 -3
  117. package/build/lib/web/development/components/ActionList/ActionListBox.web.js.map +1 -1
  118. package/build/lib/web/development/components/ActionList/ActionListItem.js +10 -5
  119. package/build/lib/web/development/components/ActionList/ActionListItem.js.map +1 -1
  120. package/build/lib/web/development/components/Alert/Alert.js +5 -3
  121. package/build/lib/web/development/components/Alert/Alert.js.map +1 -1
  122. package/build/lib/web/development/components/Amount/Amount.js +5 -8
  123. package/build/lib/web/development/components/Amount/Amount.js.map +1 -1
  124. package/build/lib/web/development/components/Avatar/Avatar.web.js +5 -3
  125. package/build/lib/web/development/components/Avatar/Avatar.web.js.map +1 -1
  126. package/build/lib/web/development/components/Avatar/AvatarGroup.web.js +5 -3
  127. package/build/lib/web/development/components/Avatar/AvatarGroup.web.js.map +1 -1
  128. package/build/lib/web/development/components/Badge/Badge.js +5 -3
  129. package/build/lib/web/development/components/Badge/Badge.js.map +1 -1
  130. package/build/lib/web/development/components/BaseHeaderFooter/BaseFooter.js +8 -3
  131. package/build/lib/web/development/components/BaseHeaderFooter/BaseFooter.js.map +1 -1
  132. package/build/lib/web/development/components/BaseHeaderFooter/BaseHeader.js +8 -3
  133. package/build/lib/web/development/components/BaseHeaderFooter/BaseHeader.js.map +1 -1
  134. package/build/lib/web/development/components/BottomNav/BottomNav.web.js +12 -8
  135. package/build/lib/web/development/components/BottomNav/BottomNav.web.js.map +1 -1
  136. package/build/lib/web/development/components/BottomSheet/BottomSheet.web.js +9 -3
  137. package/build/lib/web/development/components/BottomSheet/BottomSheet.web.js.map +1 -1
  138. package/build/lib/web/development/components/BottomSheet/BottomSheetBody.web.js +8 -3
  139. package/build/lib/web/development/components/BottomSheet/BottomSheetBody.web.js.map +1 -1
  140. package/build/lib/web/development/components/BottomSheet/BottomSheetFooter.web.js +8 -3
  141. package/build/lib/web/development/components/BottomSheet/BottomSheetFooter.web.js.map +1 -1
  142. package/build/lib/web/development/components/BottomSheet/BottomSheetHeader.web.js +8 -3
  143. package/build/lib/web/development/components/BottomSheet/BottomSheetHeader.web.js.map +1 -1
  144. package/build/lib/web/development/components/Box/BaseBox/BaseBox.web.js +4 -2
  145. package/build/lib/web/development/components/Box/BaseBox/BaseBox.web.js.map +1 -1
  146. package/build/lib/web/development/components/Box/BaseBox/types/propsTypes.js.map +1 -1
  147. package/build/lib/web/development/components/Box/Box.js +4 -2
  148. package/build/lib/web/development/components/Box/Box.js.map +1 -1
  149. package/build/lib/web/development/components/Breadcrumb/Breadcrumb.web.js +6 -4
  150. package/build/lib/web/development/components/Breadcrumb/Breadcrumb.web.js.map +1 -1
  151. package/build/lib/web/development/components/Breadcrumb/BreadcrumbItem.web.js +13 -4
  152. package/build/lib/web/development/components/Breadcrumb/BreadcrumbItem.web.js.map +1 -1
  153. package/build/lib/web/development/components/Button/BaseButton/BaseButton.js +4 -2
  154. package/build/lib/web/development/components/Button/BaseButton/BaseButton.js.map +1 -1
  155. package/build/lib/web/development/components/Button/Button/Button.js +4 -2
  156. package/build/lib/web/development/components/Button/Button/Button.js.map +1 -1
  157. package/build/lib/web/development/components/Button/IconButton/IconButton.js +11 -5
  158. package/build/lib/web/development/components/Button/IconButton/IconButton.js.map +1 -1
  159. package/build/lib/web/development/components/Button/IconButton/StyledIconButton.web.js +8 -3
  160. package/build/lib/web/development/components/Button/IconButton/StyledIconButton.web.js.map +1 -1
  161. package/build/lib/web/development/components/ButtonGroup/ButtonGroup.web.js +5 -3
  162. package/build/lib/web/development/components/ButtonGroup/ButtonGroup.web.js.map +1 -1
  163. package/build/lib/web/development/components/Card/Card.js +11 -7
  164. package/build/lib/web/development/components/Card/Card.js.map +1 -1
  165. package/build/lib/web/development/components/Card/CardFooter.js +22 -11
  166. package/build/lib/web/development/components/Card/CardFooter.js.map +1 -1
  167. package/build/lib/web/development/components/Card/CardHeader.js +13 -6
  168. package/build/lib/web/development/components/Card/CardHeader.js.map +1 -1
  169. package/build/lib/web/development/components/Carousel/Carousel.web.js +5 -3
  170. package/build/lib/web/development/components/Carousel/Carousel.web.js.map +1 -1
  171. package/build/lib/web/development/components/Carousel/CarouselItem.web.js +9 -3
  172. package/build/lib/web/development/components/Carousel/CarouselItem.web.js.map +1 -1
  173. package/build/lib/web/development/components/Checkbox/Checkbox.js +6 -4
  174. package/build/lib/web/development/components/Checkbox/Checkbox.js.map +1 -1
  175. package/build/lib/web/development/components/Checkbox/CheckboxGroup/CheckboxGroup.js +8 -5
  176. package/build/lib/web/development/components/Checkbox/CheckboxGroup/CheckboxGroup.js.map +1 -1
  177. package/build/lib/web/development/components/Chip/Chip.js +5 -3
  178. package/build/lib/web/development/components/Chip/Chip.js.map +1 -1
  179. package/build/lib/web/development/components/Chip/ChipGroup.js +8 -5
  180. package/build/lib/web/development/components/Chip/ChipGroup.js.map +1 -1
  181. package/build/lib/web/development/components/Collapsible/Collapsible.js +5 -3
  182. package/build/lib/web/development/components/Collapsible/Collapsible.js.map +1 -1
  183. package/build/lib/web/development/components/Collapsible/CollapsibleBody.js +8 -3
  184. package/build/lib/web/development/components/Collapsible/CollapsibleBody.js.map +1 -1
  185. package/build/lib/web/development/components/Collapsible/CollapsibleButton.js +13 -4
  186. package/build/lib/web/development/components/Collapsible/CollapsibleButton.js.map +1 -1
  187. package/build/lib/web/development/components/Collapsible/CollapsibleLink.js +5 -3
  188. package/build/lib/web/development/components/Collapsible/CollapsibleLink.js.map +1 -1
  189. package/build/lib/web/development/components/Counter/Counter.js +5 -3
  190. package/build/lib/web/development/components/Counter/Counter.js.map +1 -1
  191. package/build/lib/web/development/components/DatePicker/DateInput.web.js +11 -7
  192. package/build/lib/web/development/components/DatePicker/DateInput.web.js.map +1 -1
  193. package/build/lib/web/development/components/DatePicker/DatePicker.web.js +4 -2
  194. package/build/lib/web/development/components/DatePicker/DatePicker.web.js.map +1 -1
  195. package/build/lib/web/development/components/Drawer/Drawer.web.js +8 -3
  196. package/build/lib/web/development/components/Drawer/Drawer.web.js.map +1 -1
  197. package/build/lib/web/development/components/Drawer/DrawerSubcomponents.web.js +11 -3
  198. package/build/lib/web/development/components/Drawer/DrawerSubcomponents.web.js.map +1 -1
  199. package/build/lib/web/development/components/Dropdown/Dropdown.js +5 -3
  200. package/build/lib/web/development/components/Dropdown/Dropdown.js.map +1 -1
  201. package/build/lib/web/development/components/Dropdown/DropdownButton.js +2 -2
  202. package/build/lib/web/development/components/Dropdown/DropdownButton.js.map +1 -1
  203. package/build/lib/web/development/components/Dropdown/DropdownHeaderFooter.js +8 -3
  204. package/build/lib/web/development/components/Dropdown/DropdownHeaderFooter.js.map +1 -1
  205. package/build/lib/web/development/components/Dropdown/DropdownLink.js +5 -3
  206. package/build/lib/web/development/components/Dropdown/DropdownLink.js.map +1 -1
  207. package/build/lib/web/development/components/FileUpload/FileUpload.web.js +6 -4
  208. package/build/lib/web/development/components/FileUpload/FileUpload.web.js.map +1 -1
  209. package/build/lib/web/development/components/Form/Selector/SelectorGroupField.js +8 -3
  210. package/build/lib/web/development/components/Form/Selector/SelectorGroupField.js.map +1 -1
  211. package/build/lib/web/development/components/Form/Selector/SelectorInput.web.js +8 -3
  212. package/build/lib/web/development/components/Form/Selector/SelectorInput.web.js.map +1 -1
  213. package/build/lib/web/development/components/Indicator/Indicator.js +5 -3
  214. package/build/lib/web/development/components/Indicator/Indicator.js.map +1 -1
  215. package/build/lib/web/development/components/Input/BaseInput/BaseInput.js +6 -4
  216. package/build/lib/web/development/components/Input/BaseInput/BaseInput.js.map +1 -1
  217. package/build/lib/web/development/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js +5 -2
  218. package/build/lib/web/development/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js.map +1 -1
  219. package/build/lib/web/development/components/Input/DropdownInputTriggers/SelectInput.js +5 -3
  220. package/build/lib/web/development/components/Input/DropdownInputTriggers/SelectInput.js.map +1 -1
  221. package/build/lib/web/development/components/Input/OTPInput/OTPInput.js +6 -4
  222. package/build/lib/web/development/components/Input/OTPInput/OTPInput.js.map +1 -1
  223. package/build/lib/web/development/components/Input/PasswordInput/PasswordInput.js +2 -2
  224. package/build/lib/web/development/components/Input/PasswordInput/PasswordInput.js.map +1 -1
  225. package/build/lib/web/development/components/Input/PhoneNumberInput/PhoneNumberInput.web.js +2 -2
  226. package/build/lib/web/development/components/Input/PhoneNumberInput/PhoneNumberInput.web.js.map +1 -1
  227. package/build/lib/web/development/components/Input/SearchInput/SearchInput.js +2 -2
  228. package/build/lib/web/development/components/Input/SearchInput/SearchInput.js.map +1 -1
  229. package/build/lib/web/development/components/Input/TextArea/TextArea.js +2 -2
  230. package/build/lib/web/development/components/Input/TextArea/TextArea.js.map +1 -1
  231. package/build/lib/web/development/components/Input/TextInput/TextInput.js +2 -2
  232. package/build/lib/web/development/components/Input/TextInput/TextInput.js.map +1 -1
  233. package/build/lib/web/development/components/Link/BaseLink/BaseLink.js +5 -3
  234. package/build/lib/web/development/components/Link/BaseLink/BaseLink.js.map +1 -1
  235. package/build/lib/web/development/components/Link/Link/Link.js +4 -2
  236. package/build/lib/web/development/components/Link/Link/Link.js.map +1 -1
  237. package/build/lib/web/development/components/Menu/VisualSubComponents/MenuHeaderFooter.web.js +18 -8
  238. package/build/lib/web/development/components/Menu/VisualSubComponents/MenuHeaderFooter.web.js.map +1 -1
  239. package/build/lib/web/development/components/Modal/Modal.web.js +10 -4
  240. package/build/lib/web/development/components/Modal/Modal.web.js.map +1 -1
  241. package/build/lib/web/development/components/Modal/ModalBody.web.js +9 -3
  242. package/build/lib/web/development/components/Modal/ModalBody.web.js.map +1 -1
  243. package/build/lib/web/development/components/Modal/ModalFooter.web.js +7 -2
  244. package/build/lib/web/development/components/Modal/ModalFooter.web.js.map +1 -1
  245. package/build/lib/web/development/components/Modal/ModalHeader.web.js +14 -6
  246. package/build/lib/web/development/components/Modal/ModalHeader.web.js.map +1 -1
  247. package/build/lib/web/development/components/Popover/Popover.web.js +8 -3
  248. package/build/lib/web/development/components/Popover/Popover.web.js.map +1 -1
  249. package/build/lib/web/development/components/Popover/PopoverInteractiveWrapper.web.js.map +1 -1
  250. package/build/lib/web/development/components/ProgressBar/ProgressBar.js +5 -3
  251. package/build/lib/web/development/components/ProgressBar/ProgressBar.js.map +1 -1
  252. package/build/lib/web/development/components/Radio/Radio.js +6 -4
  253. package/build/lib/web/development/components/Radio/Radio.js.map +1 -1
  254. package/build/lib/web/development/components/Radio/RadioGroup/RadioGroup.js +8 -5
  255. package/build/lib/web/development/components/Radio/RadioGroup/RadioGroup.js.map +1 -1
  256. package/build/lib/web/development/components/SideNav/SideNav.web.js +5 -3
  257. package/build/lib/web/development/components/SideNav/SideNav.web.js.map +1 -1
  258. package/build/lib/web/development/components/SideNav/SideNavItems/SideNavItem.web.js +13 -4
  259. package/build/lib/web/development/components/SideNav/SideNavItems/SideNavItem.web.js.map +1 -1
  260. package/build/lib/web/development/components/SideNav/SideNavItems/SideNavLink.web.js +10 -4
  261. package/build/lib/web/development/components/SideNav/SideNavItems/SideNavLink.web.js.map +1 -1
  262. package/build/lib/web/development/components/SideNav/SideNavSection.web.js +10 -4
  263. package/build/lib/web/development/components/SideNav/SideNavSection.web.js.map +1 -1
  264. package/build/lib/web/development/components/StepGroup/StepGroup.web.js +5 -3
  265. package/build/lib/web/development/components/StepGroup/StepGroup.web.js.map +1 -1
  266. package/build/lib/web/development/components/StepGroup/StepItem.web.js +13 -7
  267. package/build/lib/web/development/components/StepGroup/StepItem.web.js.map +1 -1
  268. package/build/lib/web/development/components/StepGroup/StepLine.web.js +79 -42
  269. package/build/lib/web/development/components/StepGroup/StepLine.web.js.map +1 -1
  270. package/build/lib/web/development/components/StepGroup/tokens.js +6 -6
  271. package/build/lib/web/development/components/StepGroup/tokens.js.map +1 -1
  272. package/build/lib/web/development/components/Switch/Switch.js +5 -3
  273. package/build/lib/web/development/components/Switch/Switch.js.map +1 -1
  274. package/build/lib/web/development/components/Table/Table.web.js +9 -7
  275. package/build/lib/web/development/components/Table/Table.web.js.map +1 -1
  276. package/build/lib/web/development/components/Table/TableBody.web.js +18 -9
  277. package/build/lib/web/development/components/Table/TableBody.web.js.map +1 -1
  278. package/build/lib/web/development/components/Table/TableFooter.web.js +18 -9
  279. package/build/lib/web/development/components/Table/TableFooter.web.js.map +1 -1
  280. package/build/lib/web/development/components/Table/TableHeader.web.js +18 -9
  281. package/build/lib/web/development/components/Table/TableHeader.web.js.map +1 -1
  282. package/build/lib/web/development/components/Table/TablePagination.web.js +10 -4
  283. package/build/lib/web/development/components/Table/TablePagination.web.js.map +1 -1
  284. package/build/lib/web/development/components/Table/TableToolbar.web.js +13 -8
  285. package/build/lib/web/development/components/Table/TableToolbar.web.js.map +1 -1
  286. package/build/lib/web/development/components/Tabs/TabItem.web.js +9 -5
  287. package/build/lib/web/development/components/Tabs/TabItem.web.js.map +1 -1
  288. package/build/lib/web/development/components/Tabs/TabList.web.js +5 -3
  289. package/build/lib/web/development/components/Tabs/TabList.web.js.map +1 -1
  290. package/build/lib/web/development/components/Tabs/TabPanel.web.js +10 -5
  291. package/build/lib/web/development/components/Tabs/TabPanel.web.js.map +1 -1
  292. package/build/lib/web/development/components/Tabs/Tabs.web.js +8 -3
  293. package/build/lib/web/development/components/Tabs/Tabs.web.js.map +1 -1
  294. package/build/lib/web/development/components/Tag/Tag.js +6 -4
  295. package/build/lib/web/development/components/Tag/Tag.js.map +1 -1
  296. package/build/lib/web/development/components/Toast/ToastContainer.web.js +8 -3
  297. package/build/lib/web/development/components/Toast/ToastContainer.web.js.map +1 -1
  298. package/build/lib/web/development/components/Tooltip/Tooltip.web.js +8 -3
  299. package/build/lib/web/development/components/Tooltip/Tooltip.web.js.map +1 -1
  300. package/build/lib/web/development/components/TopNav/TabNav/TabNav.web.js +6 -3
  301. package/build/lib/web/development/components/TopNav/TabNav/TabNav.web.js.map +1 -1
  302. package/build/lib/web/development/components/TopNav/TopNav.web.js +8 -5
  303. package/build/lib/web/development/components/TopNav/TopNav.web.js.map +1 -1
  304. package/build/lib/web/development/tokens/global/size.js +3 -1
  305. package/build/lib/web/development/tokens/global/size.js.map +1 -1
  306. package/build/lib/web/development/utils/makeAnalyticsAttribute/index.js +2 -0
  307. package/build/lib/web/development/utils/makeAnalyticsAttribute/index.js.map +1 -0
  308. package/build/lib/web/development/utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js +20 -0
  309. package/build/lib/web/development/utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js.map +1 -0
  310. package/build/lib/web/production/components/Accordion/Accordion.js +5 -3
  311. package/build/lib/web/production/components/Accordion/Accordion.js.map +1 -1
  312. package/build/lib/web/production/components/Accordion/AccordionButton.web.js +8 -3
  313. package/build/lib/web/production/components/Accordion/AccordionButton.web.js.map +1 -1
  314. package/build/lib/web/production/components/Accordion/AccordionItem.js +8 -3
  315. package/build/lib/web/production/components/Accordion/AccordionItem.js.map +1 -1
  316. package/build/lib/web/production/components/Accordion/AccordionItemBody.js +8 -3
  317. package/build/lib/web/production/components/Accordion/AccordionItemBody.js.map +1 -1
  318. package/build/lib/web/production/components/Accordion/AccordionItemHeader.js +10 -4
  319. package/build/lib/web/production/components/Accordion/AccordionItemHeader.js.map +1 -1
  320. package/build/lib/web/production/components/ActionList/ActionList.js +9 -4
  321. package/build/lib/web/production/components/ActionList/ActionList.js.map +1 -1
  322. package/build/lib/web/production/components/ActionList/ActionListBox.web.js +8 -3
  323. package/build/lib/web/production/components/ActionList/ActionListBox.web.js.map +1 -1
  324. package/build/lib/web/production/components/ActionList/ActionListItem.js +10 -5
  325. package/build/lib/web/production/components/ActionList/ActionListItem.js.map +1 -1
  326. package/build/lib/web/production/components/Alert/Alert.js +5 -3
  327. package/build/lib/web/production/components/Alert/Alert.js.map +1 -1
  328. package/build/lib/web/production/components/Amount/Amount.js +5 -8
  329. package/build/lib/web/production/components/Amount/Amount.js.map +1 -1
  330. package/build/lib/web/production/components/Avatar/Avatar.web.js +5 -3
  331. package/build/lib/web/production/components/Avatar/Avatar.web.js.map +1 -1
  332. package/build/lib/web/production/components/Avatar/AvatarGroup.web.js +5 -3
  333. package/build/lib/web/production/components/Avatar/AvatarGroup.web.js.map +1 -1
  334. package/build/lib/web/production/components/Badge/Badge.js +5 -3
  335. package/build/lib/web/production/components/Badge/Badge.js.map +1 -1
  336. package/build/lib/web/production/components/BaseHeaderFooter/BaseFooter.js +8 -3
  337. package/build/lib/web/production/components/BaseHeaderFooter/BaseFooter.js.map +1 -1
  338. package/build/lib/web/production/components/BaseHeaderFooter/BaseHeader.js +8 -3
  339. package/build/lib/web/production/components/BaseHeaderFooter/BaseHeader.js.map +1 -1
  340. package/build/lib/web/production/components/BottomNav/BottomNav.web.js +12 -8
  341. package/build/lib/web/production/components/BottomNav/BottomNav.web.js.map +1 -1
  342. package/build/lib/web/production/components/BottomSheet/BottomSheet.web.js +9 -3
  343. package/build/lib/web/production/components/BottomSheet/BottomSheet.web.js.map +1 -1
  344. package/build/lib/web/production/components/BottomSheet/BottomSheetBody.web.js +8 -3
  345. package/build/lib/web/production/components/BottomSheet/BottomSheetBody.web.js.map +1 -1
  346. package/build/lib/web/production/components/BottomSheet/BottomSheetFooter.web.js +8 -3
  347. package/build/lib/web/production/components/BottomSheet/BottomSheetFooter.web.js.map +1 -1
  348. package/build/lib/web/production/components/BottomSheet/BottomSheetHeader.web.js +8 -3
  349. package/build/lib/web/production/components/BottomSheet/BottomSheetHeader.web.js.map +1 -1
  350. package/build/lib/web/production/components/Box/BaseBox/BaseBox.web.js +4 -2
  351. package/build/lib/web/production/components/Box/BaseBox/BaseBox.web.js.map +1 -1
  352. package/build/lib/web/production/components/Box/BaseBox/types/propsTypes.js.map +1 -1
  353. package/build/lib/web/production/components/Box/Box.js +4 -2
  354. package/build/lib/web/production/components/Box/Box.js.map +1 -1
  355. package/build/lib/web/production/components/Breadcrumb/Breadcrumb.web.js +6 -4
  356. package/build/lib/web/production/components/Breadcrumb/Breadcrumb.web.js.map +1 -1
  357. package/build/lib/web/production/components/Breadcrumb/BreadcrumbItem.web.js +13 -4
  358. package/build/lib/web/production/components/Breadcrumb/BreadcrumbItem.web.js.map +1 -1
  359. package/build/lib/web/production/components/Button/BaseButton/BaseButton.js +4 -2
  360. package/build/lib/web/production/components/Button/BaseButton/BaseButton.js.map +1 -1
  361. package/build/lib/web/production/components/Button/Button/Button.js +4 -2
  362. package/build/lib/web/production/components/Button/Button/Button.js.map +1 -1
  363. package/build/lib/web/production/components/Button/IconButton/IconButton.js +11 -5
  364. package/build/lib/web/production/components/Button/IconButton/IconButton.js.map +1 -1
  365. package/build/lib/web/production/components/Button/IconButton/StyledIconButton.web.js +8 -3
  366. package/build/lib/web/production/components/Button/IconButton/StyledIconButton.web.js.map +1 -1
  367. package/build/lib/web/production/components/ButtonGroup/ButtonGroup.web.js +5 -3
  368. package/build/lib/web/production/components/ButtonGroup/ButtonGroup.web.js.map +1 -1
  369. package/build/lib/web/production/components/Card/Card.js +11 -7
  370. package/build/lib/web/production/components/Card/Card.js.map +1 -1
  371. package/build/lib/web/production/components/Card/CardFooter.js +22 -11
  372. package/build/lib/web/production/components/Card/CardFooter.js.map +1 -1
  373. package/build/lib/web/production/components/Card/CardHeader.js +13 -6
  374. package/build/lib/web/production/components/Card/CardHeader.js.map +1 -1
  375. package/build/lib/web/production/components/Carousel/Carousel.web.js +5 -3
  376. package/build/lib/web/production/components/Carousel/Carousel.web.js.map +1 -1
  377. package/build/lib/web/production/components/Carousel/CarouselItem.web.js +9 -3
  378. package/build/lib/web/production/components/Carousel/CarouselItem.web.js.map +1 -1
  379. package/build/lib/web/production/components/Checkbox/Checkbox.js +6 -4
  380. package/build/lib/web/production/components/Checkbox/Checkbox.js.map +1 -1
  381. package/build/lib/web/production/components/Checkbox/CheckboxGroup/CheckboxGroup.js +8 -5
  382. package/build/lib/web/production/components/Checkbox/CheckboxGroup/CheckboxGroup.js.map +1 -1
  383. package/build/lib/web/production/components/Chip/Chip.js +5 -3
  384. package/build/lib/web/production/components/Chip/Chip.js.map +1 -1
  385. package/build/lib/web/production/components/Chip/ChipGroup.js +8 -5
  386. package/build/lib/web/production/components/Chip/ChipGroup.js.map +1 -1
  387. package/build/lib/web/production/components/Collapsible/Collapsible.js +5 -3
  388. package/build/lib/web/production/components/Collapsible/Collapsible.js.map +1 -1
  389. package/build/lib/web/production/components/Collapsible/CollapsibleBody.js +8 -3
  390. package/build/lib/web/production/components/Collapsible/CollapsibleBody.js.map +1 -1
  391. package/build/lib/web/production/components/Collapsible/CollapsibleButton.js +13 -4
  392. package/build/lib/web/production/components/Collapsible/CollapsibleButton.js.map +1 -1
  393. package/build/lib/web/production/components/Collapsible/CollapsibleLink.js +5 -3
  394. package/build/lib/web/production/components/Collapsible/CollapsibleLink.js.map +1 -1
  395. package/build/lib/web/production/components/Counter/Counter.js +5 -3
  396. package/build/lib/web/production/components/Counter/Counter.js.map +1 -1
  397. package/build/lib/web/production/components/DatePicker/DateInput.web.js +11 -7
  398. package/build/lib/web/production/components/DatePicker/DateInput.web.js.map +1 -1
  399. package/build/lib/web/production/components/DatePicker/DatePicker.web.js +4 -2
  400. package/build/lib/web/production/components/DatePicker/DatePicker.web.js.map +1 -1
  401. package/build/lib/web/production/components/Drawer/Drawer.web.js +8 -3
  402. package/build/lib/web/production/components/Drawer/Drawer.web.js.map +1 -1
  403. package/build/lib/web/production/components/Drawer/DrawerSubcomponents.web.js +11 -3
  404. package/build/lib/web/production/components/Drawer/DrawerSubcomponents.web.js.map +1 -1
  405. package/build/lib/web/production/components/Dropdown/Dropdown.js +5 -3
  406. package/build/lib/web/production/components/Dropdown/Dropdown.js.map +1 -1
  407. package/build/lib/web/production/components/Dropdown/DropdownButton.js +2 -2
  408. package/build/lib/web/production/components/Dropdown/DropdownButton.js.map +1 -1
  409. package/build/lib/web/production/components/Dropdown/DropdownHeaderFooter.js +8 -3
  410. package/build/lib/web/production/components/Dropdown/DropdownHeaderFooter.js.map +1 -1
  411. package/build/lib/web/production/components/Dropdown/DropdownLink.js +5 -3
  412. package/build/lib/web/production/components/Dropdown/DropdownLink.js.map +1 -1
  413. package/build/lib/web/production/components/FileUpload/FileUpload.web.js +6 -4
  414. package/build/lib/web/production/components/FileUpload/FileUpload.web.js.map +1 -1
  415. package/build/lib/web/production/components/Form/Selector/SelectorGroupField.js +8 -3
  416. package/build/lib/web/production/components/Form/Selector/SelectorGroupField.js.map +1 -1
  417. package/build/lib/web/production/components/Form/Selector/SelectorInput.web.js +8 -3
  418. package/build/lib/web/production/components/Form/Selector/SelectorInput.web.js.map +1 -1
  419. package/build/lib/web/production/components/Indicator/Indicator.js +5 -3
  420. package/build/lib/web/production/components/Indicator/Indicator.js.map +1 -1
  421. package/build/lib/web/production/components/Input/BaseInput/BaseInput.js +6 -4
  422. package/build/lib/web/production/components/Input/BaseInput/BaseInput.js.map +1 -1
  423. package/build/lib/web/production/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js +5 -2
  424. package/build/lib/web/production/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js.map +1 -1
  425. package/build/lib/web/production/components/Input/DropdownInputTriggers/SelectInput.js +5 -3
  426. package/build/lib/web/production/components/Input/DropdownInputTriggers/SelectInput.js.map +1 -1
  427. package/build/lib/web/production/components/Input/OTPInput/OTPInput.js +6 -4
  428. package/build/lib/web/production/components/Input/OTPInput/OTPInput.js.map +1 -1
  429. package/build/lib/web/production/components/Input/PasswordInput/PasswordInput.js +2 -2
  430. package/build/lib/web/production/components/Input/PasswordInput/PasswordInput.js.map +1 -1
  431. package/build/lib/web/production/components/Input/PhoneNumberInput/PhoneNumberInput.web.js +2 -2
  432. package/build/lib/web/production/components/Input/PhoneNumberInput/PhoneNumberInput.web.js.map +1 -1
  433. package/build/lib/web/production/components/Input/SearchInput/SearchInput.js +2 -2
  434. package/build/lib/web/production/components/Input/SearchInput/SearchInput.js.map +1 -1
  435. package/build/lib/web/production/components/Input/TextArea/TextArea.js +2 -2
  436. package/build/lib/web/production/components/Input/TextArea/TextArea.js.map +1 -1
  437. package/build/lib/web/production/components/Input/TextInput/TextInput.js +2 -2
  438. package/build/lib/web/production/components/Input/TextInput/TextInput.js.map +1 -1
  439. package/build/lib/web/production/components/Link/BaseLink/BaseLink.js +5 -3
  440. package/build/lib/web/production/components/Link/BaseLink/BaseLink.js.map +1 -1
  441. package/build/lib/web/production/components/Link/Link/Link.js +4 -2
  442. package/build/lib/web/production/components/Link/Link/Link.js.map +1 -1
  443. package/build/lib/web/production/components/Menu/VisualSubComponents/MenuHeaderFooter.web.js +18 -8
  444. package/build/lib/web/production/components/Menu/VisualSubComponents/MenuHeaderFooter.web.js.map +1 -1
  445. package/build/lib/web/production/components/Modal/Modal.web.js +10 -4
  446. package/build/lib/web/production/components/Modal/Modal.web.js.map +1 -1
  447. package/build/lib/web/production/components/Modal/ModalBody.web.js +9 -3
  448. package/build/lib/web/production/components/Modal/ModalBody.web.js.map +1 -1
  449. package/build/lib/web/production/components/Modal/ModalFooter.web.js +7 -2
  450. package/build/lib/web/production/components/Modal/ModalFooter.web.js.map +1 -1
  451. package/build/lib/web/production/components/Modal/ModalHeader.web.js +14 -6
  452. package/build/lib/web/production/components/Modal/ModalHeader.web.js.map +1 -1
  453. package/build/lib/web/production/components/Popover/Popover.web.js +8 -3
  454. package/build/lib/web/production/components/Popover/Popover.web.js.map +1 -1
  455. package/build/lib/web/production/components/Popover/PopoverInteractiveWrapper.web.js.map +1 -1
  456. package/build/lib/web/production/components/ProgressBar/ProgressBar.js +5 -3
  457. package/build/lib/web/production/components/ProgressBar/ProgressBar.js.map +1 -1
  458. package/build/lib/web/production/components/Radio/Radio.js +6 -4
  459. package/build/lib/web/production/components/Radio/Radio.js.map +1 -1
  460. package/build/lib/web/production/components/Radio/RadioGroup/RadioGroup.js +8 -5
  461. package/build/lib/web/production/components/Radio/RadioGroup/RadioGroup.js.map +1 -1
  462. package/build/lib/web/production/components/SideNav/SideNav.web.js +5 -3
  463. package/build/lib/web/production/components/SideNav/SideNav.web.js.map +1 -1
  464. package/build/lib/web/production/components/SideNav/SideNavItems/SideNavItem.web.js +13 -4
  465. package/build/lib/web/production/components/SideNav/SideNavItems/SideNavItem.web.js.map +1 -1
  466. package/build/lib/web/production/components/SideNav/SideNavItems/SideNavLink.web.js +10 -4
  467. package/build/lib/web/production/components/SideNav/SideNavItems/SideNavLink.web.js.map +1 -1
  468. package/build/lib/web/production/components/SideNav/SideNavSection.web.js +10 -4
  469. package/build/lib/web/production/components/SideNav/SideNavSection.web.js.map +1 -1
  470. package/build/lib/web/production/components/StepGroup/StepGroup.web.js +5 -3
  471. package/build/lib/web/production/components/StepGroup/StepGroup.web.js.map +1 -1
  472. package/build/lib/web/production/components/StepGroup/StepItem.web.js +13 -7
  473. package/build/lib/web/production/components/StepGroup/StepItem.web.js.map +1 -1
  474. package/build/lib/web/production/components/StepGroup/StepLine.web.js +79 -42
  475. package/build/lib/web/production/components/StepGroup/StepLine.web.js.map +1 -1
  476. package/build/lib/web/production/components/StepGroup/tokens.js +6 -6
  477. package/build/lib/web/production/components/StepGroup/tokens.js.map +1 -1
  478. package/build/lib/web/production/components/Switch/Switch.js +5 -3
  479. package/build/lib/web/production/components/Switch/Switch.js.map +1 -1
  480. package/build/lib/web/production/components/Table/Table.web.js +9 -7
  481. package/build/lib/web/production/components/Table/Table.web.js.map +1 -1
  482. package/build/lib/web/production/components/Table/TableBody.web.js +18 -9
  483. package/build/lib/web/production/components/Table/TableBody.web.js.map +1 -1
  484. package/build/lib/web/production/components/Table/TableFooter.web.js +18 -9
  485. package/build/lib/web/production/components/Table/TableFooter.web.js.map +1 -1
  486. package/build/lib/web/production/components/Table/TableHeader.web.js +18 -9
  487. package/build/lib/web/production/components/Table/TableHeader.web.js.map +1 -1
  488. package/build/lib/web/production/components/Table/TablePagination.web.js +10 -4
  489. package/build/lib/web/production/components/Table/TablePagination.web.js.map +1 -1
  490. package/build/lib/web/production/components/Table/TableToolbar.web.js +13 -8
  491. package/build/lib/web/production/components/Table/TableToolbar.web.js.map +1 -1
  492. package/build/lib/web/production/components/Tabs/TabItem.web.js +9 -5
  493. package/build/lib/web/production/components/Tabs/TabItem.web.js.map +1 -1
  494. package/build/lib/web/production/components/Tabs/TabList.web.js +5 -3
  495. package/build/lib/web/production/components/Tabs/TabList.web.js.map +1 -1
  496. package/build/lib/web/production/components/Tabs/TabPanel.web.js +10 -5
  497. package/build/lib/web/production/components/Tabs/TabPanel.web.js.map +1 -1
  498. package/build/lib/web/production/components/Tabs/Tabs.web.js +8 -3
  499. package/build/lib/web/production/components/Tabs/Tabs.web.js.map +1 -1
  500. package/build/lib/web/production/components/Tag/Tag.js +6 -4
  501. package/build/lib/web/production/components/Tag/Tag.js.map +1 -1
  502. package/build/lib/web/production/components/Toast/ToastContainer.web.js +8 -3
  503. package/build/lib/web/production/components/Toast/ToastContainer.web.js.map +1 -1
  504. package/build/lib/web/production/components/Tooltip/Tooltip.web.js +8 -3
  505. package/build/lib/web/production/components/Tooltip/Tooltip.web.js.map +1 -1
  506. package/build/lib/web/production/components/TopNav/TabNav/TabNav.web.js +6 -3
  507. package/build/lib/web/production/components/TopNav/TabNav/TabNav.web.js.map +1 -1
  508. package/build/lib/web/production/components/TopNav/TopNav.web.js +8 -5
  509. package/build/lib/web/production/components/TopNav/TopNav.web.js.map +1 -1
  510. package/build/lib/web/production/tokens/global/size.js +3 -1
  511. package/build/lib/web/production/tokens/global/size.js.map +1 -1
  512. package/build/lib/web/production/utils/makeAnalyticsAttribute/index.js +2 -0
  513. package/build/lib/web/production/utils/makeAnalyticsAttribute/index.js.map +1 -0
  514. package/build/lib/web/production/utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js +20 -0
  515. package/build/lib/web/production/utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js.map +1 -0
  516. package/build/types/components/index.d.ts +221 -189
  517. package/build/types/components/index.native.d.ts +145 -131
  518. package/build/types/tokens/index.d.ts +3 -1
  519. package/build/types/tokens/index.native.d.ts +3 -1
  520. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"OTPInput.js","sources":["../../../../../../src/components/Input/OTPInput/OTPInput.tsx"],"sourcesContent":["import React, { useEffect, useImperativeHandle, useState } from 'react';\nimport type { BaseInputProps } from '../BaseInput';\nimport { BaseInput } from '../BaseInput';\nimport { getHintType } from '../BaseInput/BaseInput';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport type { FormInputOnEvent } from '~components/Form';\nimport { FormHint, FormLabel } from '~components/Form';\nimport { useFormId } from '~components/Form/useFormId';\nimport type { FormInputOnKeyDownEvent } from '~components/Form/FormTypes';\nimport BaseBox from '~components/Box/BaseBox';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { getPlatformType } from '~utils';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { makeSize } from '~utils/makeSize';\n\ntype FormInputOnEventWithIndex = ({\n name,\n value,\n inputIndex,\n}: {\n name?: string;\n value?: string;\n inputIndex: number;\n}) => void;\n\nexport type OTPInputCommonProps = Pick<\n BaseInputProps,\n | 'label'\n | 'accessibilityLabel'\n | 'labelPosition'\n | 'validationState'\n | 'helpText'\n | 'errorText'\n | 'successText'\n | 'name'\n | 'onChange'\n | 'value'\n | 'isDisabled'\n | 'autoFocus'\n | 'keyboardReturnKeyType'\n | 'keyboardType'\n | 'placeholder'\n | 'testID'\n | 'size'\n> & {\n /**\n * Determines the number of input fields to show for the OTP\n * @default 6\n */\n otpLength?: 4 | 6;\n /**\n * The callback function to be invoked when all the values of the OTPInput are filled\n */\n onOTPFilled?: FormInputOnEvent;\n /**\n * Masks input characters in all the fields\n */\n isMasked?: boolean;\n /**\n * Determines what autoComplete suggestion type to show. Defaults to `oneTimeCode`.\n *\n * It's not recommended to turn this off in favor of otp input practices.\n *\n *\n * Internally it'll render platform specific attributes:\n *\n * - web: `autocomplete`\n * - iOS: `textContentType`\n * - android: `autoComplete`\n *\n */\n autoCompleteSuggestionType?: Extract<\n BaseInputProps['autoCompleteSuggestionType'],\n 'none' | 'oneTimeCode'\n >;\n /**\n * The callback function to be invoked when one of the input fields gets focus\n */\n onFocus?: FormInputOnEventWithIndex;\n /**\n * The callback function to be invoked when one of the input fields is blurred\n */\n onBlur?: FormInputOnEventWithIndex;\n} & StyledPropsBlade;\n\n/*\n Mandatory accessibilityLabel prop when label is not provided\n*/\ntype OTPInputPropsWithA11yLabel = {\n /**\n * Label to be shown for the input field\n */\n label?: undefined;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel: string;\n};\n\n/*\n Optional accessibilityLabel prop when label is provided\n*/\ntype OTPInputPropsWithLabel = {\n /**\n * Label to be shown for the input field\n */\n label: string;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel?: string;\n};\n\ntype OTPInputProps = (OTPInputPropsWithA11yLabel | OTPInputPropsWithLabel) & OTPInputCommonProps;\n\nconst isReactNative = getPlatformType() === 'react-native';\n\n/**\n * Converts a string value of otp to array if passed otherwise returns an array of 6 empty strings\n */\nconst otpToArray = (code?: string): string[] => code?.split('') ?? Array(6).fill('');\n\n/**\n * OTPInput component can be used for accepting OTPs sent to users for authentication/verification purposes.\n *\n * ## Usage\n *\n * ```tsx\n * <OTPInput\n * label=\"Enter OTP\"\n * name=\"otpInput\"\n * onChange={({ name, value }): void => console.log({ name, value })}\n * onOTPFilled={({ name, value }): void => console.log({ name, value })}\n * />\n * ```\n */\nconst _OTPInput: React.ForwardRefRenderFunction<HTMLInputElement[], OTPInputProps> = (\n {\n autoFocus,\n errorText,\n helpText,\n isDisabled,\n keyboardReturnKeyType,\n keyboardType = 'decimal',\n label,\n accessibilityLabel,\n labelPosition,\n name,\n onChange,\n onFocus,\n onBlur,\n onOTPFilled,\n otpLength = 6,\n placeholder,\n successText,\n validationState,\n value: inputValue,\n isMasked,\n autoCompleteSuggestionType = 'oneTimeCode',\n testID,\n size = 'medium',\n ...styledProps\n },\n incomingRef,\n) => {\n const inputRefs: React.RefObject<HTMLInputElement>[] = [];\n const [otpValue, setOtpValue] = useState<string[]>(otpToArray(inputValue));\n const [inputType, setInputType] = useState<('password' | undefined)[]>([]);\n const isLabelLeftPositioned = labelPosition === 'left';\n const { inputId, helpTextId, errorTextId, successTextId } = useFormId('otp');\n\n useImperativeHandle(\n incomingRef,\n () => {\n return inputRefs.map((ref) => ref.current!);\n },\n [inputRefs],\n );\n\n useEffect(() => {\n // Effect for calling `onOTPFilled` callback\n if (inputValue && inputValue.length >= otpLength) {\n // callback for when the OTPInput is controlled and inputValue reaches the same or greater length as the otpLength\n onOTPFilled?.({ value: inputValue.slice(0, otpLength), name });\n } else if (!inputValue && otpValue.join('').length >= otpLength) {\n // callback for when the OTPInput is uncontrolled and otpValue stored in state reaches the same or greater length as the otpLength\n onOTPFilled?.({ value: otpValue.slice(0, otpLength).join(''), name });\n }\n }, [otpValue, otpLength, name, inputValue, onOTPFilled]);\n\n useEffect(() => {\n /* We want to disable the password managers for OTPInput when isMasked is set.\n The issue with only setting autocomplete='off' is that its not an enforcement but a suggestion to the browser to follow.\n This workaround unsets type on first render and sets it to `password` only once a value is entered by the user.\n */\n otpValue.forEach((otp, index) => {\n // Set inputType as 'password' only when a value is entered when isMasked is set\n if (!isEmpty(otp) && !inputType[index] && isMasked) {\n const newInputType = Array.from(inputType);\n newInputType[index] = 'password';\n setInputType(newInputType);\n }\n // Cleanup the inputType array whenever the value is empty but inputType[index] is set\n if (isEmpty(otp) && inputType[index]) {\n const newInputType = Array.from(inputType);\n newInputType[index] = undefined;\n setInputType(newInputType);\n }\n });\n }, [otpValue, inputType, isMasked]);\n\n /**\n * Changes the value of the otp at a given index and updates the otpValue stored in state\n *\n * @param {{ value: string; index: number }} { value, index }\n * @returns {string} updated otpValue\n */\n const setOtpValueByIndex = ({ value, index }: { value: string; index: number }): string => {\n const newOtpValue = Array.from(otpValue);\n newOtpValue[index] = value;\n setOtpValue(newOtpValue);\n return newOtpValue.join('');\n };\n\n /**\n * Sets focus to the desired otp input by index\n *\n * @param {number} index the index of the otp input to be focused\n */\n const focusOnOtpByIndex = (index: number): void => {\n inputRefs[index]?.current?.focus();\n if (!isReactNative) {\n // React Native doesn't support imperatively selecting the value of input\n inputRefs[index]?.current?.select();\n }\n };\n\n const handleOnChange = ({\n value,\n currentOtpIndex,\n }: {\n value?: string;\n currentOtpIndex: number;\n }): void => {\n if (value && value === ' ') {\n // React native doesn't support `event.preventDefault()` hence have to add this check to ensure that empty space is not allowed\n return;\n }\n if (inputValue && inputValue.length > 0) {\n // When OTPInput is controlled, set the otpValue as the consumer passed `inputValue` and append the value on current index based on user's input.\n // User's input will not reflect on the otp but will trigger `onChange` callback with the user's input appended so that the consumer can take appropriate action.\n const newOtpValue = Array.from(inputValue);\n newOtpValue[currentOtpIndex] = value ?? '';\n setOtpValue(newOtpValue);\n onChange?.({ name, value: newOtpValue.join('') });\n } else if (value && value.trim().length > 1) {\n // When the entered value is more that 1 character (when value is pasted), set the otpValue to the newly received value.\n // Could have used `onPaste` for web to achieve this but 1. React Native doesn't support onPaste and 2. Safari's autofill on web doesn't trigger onPaste\n setOtpValue(Array.from(value));\n onChange?.({ name, value: value.trim().slice(0, otpLength) });\n } else if (otpValue[currentOtpIndex] !== value?.trim()) {\n // Set the value at the current index to the entered value\n // only as long as its not the same as the already existing value (this prevents `onChange` being triggered unnecessarily)\n const newValue = setOtpValueByIndex({\n value: value?.trim() ?? '',\n index: currentOtpIndex,\n });\n onChange?.({ name, value: newValue });\n }\n };\n\n const handleOnInput = ({\n value,\n currentOtpIndex,\n }: {\n value?: string;\n currentOtpIndex: number;\n }): void => {\n // Moves focus to next input whenever a value is entered in the current input\n if (value && value.trim().length === 1) {\n focusOnOtpByIndex(++currentOtpIndex);\n }\n };\n\n const handleOnKeyDown = ({\n key,\n code,\n event,\n currentOtpIndex,\n }: FormInputOnKeyDownEvent & { currentOtpIndex: number }): void => {\n if (key === 'Backspace' || code === 'Backspace' || code === 'Delete' || key === 'Delete') {\n event.preventDefault?.();\n handleOnChange({ value: '', currentOtpIndex });\n focusOnOtpByIndex(--currentOtpIndex);\n } else if (key === 'ArrowLeft' || code === 'ArrowLeft') {\n event.preventDefault?.();\n focusOnOtpByIndex(--currentOtpIndex);\n } else if (key === 'ArrowRight' || code === 'ArrowRight') {\n event.preventDefault?.();\n focusOnOtpByIndex(++currentOtpIndex);\n } else if (key === ' ' || code === 'Space') {\n event.preventDefault?.();\n }\n };\n\n const getHiddenInput = (): React.ReactNode => {\n if (!isReactNative) {\n return (\n <input\n hidden={true}\n id={inputId}\n name={name}\n value={inputValue ?? otpValue.join('') ?? ''}\n readOnly\n />\n );\n }\n return null;\n };\n\n const getOTPInputFields = (): React.ReactNode => {\n const inputs = [];\n for (let index = 0; index < otpLength; index++) {\n const currentValue = inputValue ? otpToArray(inputValue)[index] || '' : otpValue[index] || '';\n const ref = React.createRef<HTMLInputElement>();\n // if an inputValue is passed (controlled) and isMasked is set, inputType will always be password\n let currentInputType: 'password' | undefined;\n if (isMasked) {\n // if inputValue is passed (controlled component) then the inputType will always be password\n currentInputType = inputValue ? 'password' : inputType[index];\n }\n inputRefs.push(ref);\n inputs.push(\n <BaseBox\n flex={1}\n marginLeft={index == 0 ? 'spacing.0' : 'spacing.3'}\n key={`${inputId}-${index}`}\n >\n <BaseInput\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus && index === 0}\n accessibilityLabel={`${index === 0 ? label || accessibilityLabel : ''} character ${\n index + 1\n }`}\n label={label}\n hideLabelText={true}\n id={`${inputId}-${index}`}\n textAlign=\"center\"\n ref={ref as never}\n name={name}\n value={currentValue}\n maxCharacters={otpValue[index]?.length > 0 ? 1 : undefined}\n onChange={(formEvent) => handleOnChange({ ...formEvent, currentOtpIndex: index })}\n onFocus={(formEvent) => onFocus?.({ ...formEvent, inputIndex: index })}\n onBlur={(formEvent) => onBlur?.({ ...formEvent, inputIndex: index })}\n onInput={(formEvent) => handleOnInput({ ...formEvent, currentOtpIndex: index })}\n onKeyDown={(keyboardEvent) =>\n handleOnKeyDown({ ...keyboardEvent, currentOtpIndex: index })\n }\n isDisabled={isDisabled}\n placeholder={Array.from(placeholder ?? '')[index] ?? ''}\n isRequired={true}\n autoCompleteSuggestionType={autoCompleteSuggestionType}\n keyboardType={keyboardType}\n keyboardReturnKeyType={keyboardReturnKeyType}\n validationState={validationState}\n successText={successText}\n errorText={errorText}\n helpText={helpText}\n hideFormHint={true}\n type={currentInputType}\n size={size}\n valueComponentType=\"heading\"\n />\n </BaseBox>,\n );\n }\n return inputs;\n };\n\n return (\n <BaseBox\n {...metaAttribute({ name: MetaConstants.OTPInput, testID })}\n {...getStyledProps(styledProps)}\n >\n <BaseBox\n display=\"flex\"\n flexDirection={isLabelLeftPositioned ? 'row' : 'column'}\n alignItems={isLabelLeftPositioned ? 'center' : undefined}\n position=\"relative\"\n >\n {Boolean(label) && (\n <FormLabel as=\"label\" position={labelPosition} htmlFor={inputId} size={size}>\n {label}\n </FormLabel>\n )}\n <BaseBox display=\"flex\" flexDirection=\"row\">\n {getHiddenInput()}\n {getOTPInputFields()}\n </BaseBox>\n </BaseBox>\n {/* the magic number 136 is basically max-width of label i.e 120 and then right margin i.e 16 which is the spacing between label and input field */}\n {/*Refer `BaseInput`'s implementation of FormHint which uses similar logic */}\n <BaseBox marginLeft={makeSize(isLabelLeftPositioned ? 136 : 0)}>\n <FormHint\n type={getHintType({ validationState, hasHelpText: Boolean(helpText) })}\n helpText={helpText}\n errorText={errorText}\n successText={successText}\n helpTextId={helpTextId}\n errorTextId={errorTextId}\n successTextId={successTextId}\n size={size}\n />\n </BaseBox>\n </BaseBox>\n );\n};\n\nconst OTPInput = React.forwardRef<HTMLInputElement[], OTPInputProps>(_OTPInput);\n\nexport type { OTPInputProps };\nexport { OTPInput };\n"],"names":["isReactNative","getPlatformType","otpToArray","code","_code$split","split","Array","fill","_OTPInput","_ref","incomingRef","autoFocus","errorText","helpText","isDisabled","keyboardReturnKeyType","_ref$keyboardType","keyboardType","label","accessibilityLabel","labelPosition","name","onChange","onFocus","onBlur","onOTPFilled","_ref$otpLength","otpLength","placeholder","successText","validationState","inputValue","value","isMasked","_ref$autoCompleteSugg","autoCompleteSuggestionType","testID","_ref$size","size","styledProps","_objectWithoutProperties","_excluded","inputRefs","_useState","useState","_useState2","_slicedToArray","otpValue","setOtpValue","_useState3","_useState4","inputType","setInputType","isLabelLeftPositioned","_useFormId","useFormId","inputId","helpTextId","errorTextId","successTextId","useImperativeHandle","map","ref","current","useEffect","length","slice","join","forEach","otp","index","isEmpty","newInputType","from","undefined","setOtpValueByIndex","_ref2","newOtpValue","focusOnOtpByIndex","_inputRefs$index","_inputRefs$index$curr","focus","_inputRefs$index2","_inputRefs$index2$cur","select","handleOnChange","_ref3","currentOtpIndex","trim","_value$trim","newValue","handleOnInput","_ref4","handleOnKeyDown","_ref5","key","event","preventDefault","getHiddenInput","_ref6","_jsx","hidden","id","readOnly","getOTPInputFields","inputs","_loop","_otpValue$index","_Array$from$index","currentValue","React","createRef","currentInputType","push","BaseBox","flex","marginLeft","children","BaseInput","hideLabelText","textAlign","maxCharacters","formEvent","Object","assign","inputIndex","onInput","onKeyDown","keyboardEvent","isRequired","hideFormHint","type","valueComponentType","_jsxs","metaAttribute","MetaConstants","OTPInput","getStyledProps","display","flexDirection","alignItems","position","Boolean","FormLabel","as","htmlFor","makeSize","FormHint","getHintType","hasHelpText","forwardRef"],"mappings":";;;;;;;;;;;;;;;;;;;;iUAoHA,IAAMA,aAAa,CAAGC,eAAe,EAAE,GAAK,cAAc,CAK1D,IAAMC,UAAU,CAAG,SAAbA,UAAUA,CAAIC,IAAa,CAAA,CAAA,IAAAC,WAAA,CAAA,OAAA,CAAAA,WAAA,CAAeD,IAAI,EAAA,IAAA,CAAA,KAAA,CAAA,CAAJA,IAAI,CAAEE,KAAK,CAAC,EAAE,CAAC,GAAA,IAAA,CAAAD,WAAA,CAAIE,KAAK,CAAC,CAAC,CAAC,CAACC,IAAI,CAAC,EAAE,CAAC,CAAA,CAAA,CAgBpF,IAAMC,SAA4E,CAAG,SAA/EA,SAA4EA,CAAAC,IAAA,CA2BhFC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CACvEA,QAAQ,CAAEA,QAAS,CACnBD,SAAS,CAAEA,SAAU,CACrBiB,WAAW,CAAEA,WAAY,CACzB4B,UAAU,CAAEA,UAAW,CACvBC,WAAW,CAAEA,WAAY,CACzBC,aAAa,CAAEA,aAAc,CAC7BrB,IAAI,CAAEA,IAAK,CACZ,CAAC,CACK,CAAC,CACH,CAAA,CAAA,CAAC,CAEd,CAAC,CAEK,IAAAkG,QAAQ,CAAG1B,cAAK,CAACwC,UAAU,CAAoC9I,SAAS;;;;"}
1
+ {"version":3,"file":"OTPInput.js","sources":["../../../../../../src/components/Input/OTPInput/OTPInput.tsx"],"sourcesContent":["import React, { useEffect, useImperativeHandle, useState } from 'react';\nimport type { BaseInputProps } from '../BaseInput';\nimport { BaseInput } from '../BaseInput';\nimport { getHintType } from '../BaseInput/BaseInput';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport type { FormInputOnEvent } from '~components/Form';\nimport { FormHint, FormLabel } from '~components/Form';\nimport { useFormId } from '~components/Form/useFormId';\nimport type { FormInputOnKeyDownEvent } from '~components/Form/FormTypes';\nimport BaseBox from '~components/Box/BaseBox';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { getPlatformType } from '~utils';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { makeSize } from '~utils/makeSize';\nimport type { DataAnalyticsAttribute } from '~utils/types';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\ntype FormInputOnEventWithIndex = ({\n name,\n value,\n inputIndex,\n}: {\n name?: string;\n value?: string;\n inputIndex: number;\n}) => void;\n\nexport type OTPInputCommonProps = Pick<\n BaseInputProps,\n | 'label'\n | 'accessibilityLabel'\n | 'labelPosition'\n | 'validationState'\n | 'helpText'\n | 'errorText'\n | 'successText'\n | 'name'\n | 'onChange'\n | 'value'\n | 'isDisabled'\n | 'autoFocus'\n | 'keyboardReturnKeyType'\n | 'keyboardType'\n | 'placeholder'\n | 'testID'\n | 'size'\n | keyof DataAnalyticsAttribute\n> & {\n /**\n * Determines the number of input fields to show for the OTP\n * @default 6\n */\n otpLength?: 4 | 6;\n /**\n * The callback function to be invoked when all the values of the OTPInput are filled\n */\n onOTPFilled?: FormInputOnEvent;\n /**\n * Masks input characters in all the fields\n */\n isMasked?: boolean;\n /**\n * Determines what autoComplete suggestion type to show. Defaults to `oneTimeCode`.\n *\n * It's not recommended to turn this off in favor of otp input practices.\n *\n *\n * Internally it'll render platform specific attributes:\n *\n * - web: `autocomplete`\n * - iOS: `textContentType`\n * - android: `autoComplete`\n *\n */\n autoCompleteSuggestionType?: Extract<\n BaseInputProps['autoCompleteSuggestionType'],\n 'none' | 'oneTimeCode'\n >;\n /**\n * The callback function to be invoked when one of the input fields gets focus\n */\n onFocus?: FormInputOnEventWithIndex;\n /**\n * The callback function to be invoked when one of the input fields is blurred\n */\n onBlur?: FormInputOnEventWithIndex;\n} & StyledPropsBlade;\n\n/*\n Mandatory accessibilityLabel prop when label is not provided\n*/\ntype OTPInputPropsWithA11yLabel = {\n /**\n * Label to be shown for the input field\n */\n label?: undefined;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel: string;\n};\n\n/*\n Optional accessibilityLabel prop when label is provided\n*/\ntype OTPInputPropsWithLabel = {\n /**\n * Label to be shown for the input field\n */\n label: string;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel?: string;\n};\n\ntype OTPInputProps = (OTPInputPropsWithA11yLabel | OTPInputPropsWithLabel) & OTPInputCommonProps;\n\nconst isReactNative = getPlatformType() === 'react-native';\n\n/**\n * Converts a string value of otp to array if passed otherwise returns an array of 6 empty strings\n */\nconst otpToArray = (code?: string): string[] => code?.split('') ?? Array(6).fill('');\n\n/**\n * OTPInput component can be used for accepting OTPs sent to users for authentication/verification purposes.\n *\n * ## Usage\n *\n * ```tsx\n * <OTPInput\n * label=\"Enter OTP\"\n * name=\"otpInput\"\n * onChange={({ name, value }): void => console.log({ name, value })}\n * onOTPFilled={({ name, value }): void => console.log({ name, value })}\n * />\n * ```\n */\nconst _OTPInput: React.ForwardRefRenderFunction<HTMLInputElement[], OTPInputProps> = (\n {\n autoFocus,\n errorText,\n helpText,\n isDisabled,\n keyboardReturnKeyType,\n keyboardType = 'decimal',\n label,\n accessibilityLabel,\n labelPosition,\n name,\n onChange,\n onFocus,\n onBlur,\n onOTPFilled,\n otpLength = 6,\n placeholder,\n successText,\n validationState,\n value: inputValue,\n isMasked,\n autoCompleteSuggestionType = 'oneTimeCode',\n testID,\n size = 'medium',\n ...rest\n },\n incomingRef,\n) => {\n const inputRefs: React.RefObject<HTMLInputElement>[] = [];\n const [otpValue, setOtpValue] = useState<string[]>(otpToArray(inputValue));\n const [inputType, setInputType] = useState<('password' | undefined)[]>([]);\n const isLabelLeftPositioned = labelPosition === 'left';\n const { inputId, helpTextId, errorTextId, successTextId } = useFormId('otp');\n\n useImperativeHandle(\n incomingRef,\n () => {\n return inputRefs.map((ref) => ref.current!);\n },\n [inputRefs],\n );\n\n useEffect(() => {\n // Effect for calling `onOTPFilled` callback\n if (inputValue && inputValue.length >= otpLength) {\n // callback for when the OTPInput is controlled and inputValue reaches the same or greater length as the otpLength\n onOTPFilled?.({ value: inputValue.slice(0, otpLength), name });\n } else if (!inputValue && otpValue.join('').length >= otpLength) {\n // callback for when the OTPInput is uncontrolled and otpValue stored in state reaches the same or greater length as the otpLength\n onOTPFilled?.({ value: otpValue.slice(0, otpLength).join(''), name });\n }\n }, [otpValue, otpLength, name, inputValue, onOTPFilled]);\n\n useEffect(() => {\n /* We want to disable the password managers for OTPInput when isMasked is set.\n The issue with only setting autocomplete='off' is that its not an enforcement but a suggestion to the browser to follow.\n This workaround unsets type on first render and sets it to `password` only once a value is entered by the user.\n */\n otpValue.forEach((otp, index) => {\n // Set inputType as 'password' only when a value is entered when isMasked is set\n if (!isEmpty(otp) && !inputType[index] && isMasked) {\n const newInputType = Array.from(inputType);\n newInputType[index] = 'password';\n setInputType(newInputType);\n }\n // Cleanup the inputType array whenever the value is empty but inputType[index] is set\n if (isEmpty(otp) && inputType[index]) {\n const newInputType = Array.from(inputType);\n newInputType[index] = undefined;\n setInputType(newInputType);\n }\n });\n }, [otpValue, inputType, isMasked]);\n\n /**\n * Changes the value of the otp at a given index and updates the otpValue stored in state\n *\n * @param {{ value: string; index: number }} { value, index }\n * @returns {string} updated otpValue\n */\n const setOtpValueByIndex = ({ value, index }: { value: string; index: number }): string => {\n const newOtpValue = Array.from(otpValue);\n newOtpValue[index] = value;\n setOtpValue(newOtpValue);\n return newOtpValue.join('');\n };\n\n /**\n * Sets focus to the desired otp input by index\n *\n * @param {number} index the index of the otp input to be focused\n */\n const focusOnOtpByIndex = (index: number): void => {\n inputRefs[index]?.current?.focus();\n if (!isReactNative) {\n // React Native doesn't support imperatively selecting the value of input\n inputRefs[index]?.current?.select();\n }\n };\n\n const handleOnChange = ({\n value,\n currentOtpIndex,\n }: {\n value?: string;\n currentOtpIndex: number;\n }): void => {\n if (value && value === ' ') {\n // React native doesn't support `event.preventDefault()` hence have to add this check to ensure that empty space is not allowed\n return;\n }\n if (inputValue && inputValue.length > 0) {\n // When OTPInput is controlled, set the otpValue as the consumer passed `inputValue` and append the value on current index based on user's input.\n // User's input will not reflect on the otp but will trigger `onChange` callback with the user's input appended so that the consumer can take appropriate action.\n const newOtpValue = Array.from(inputValue);\n newOtpValue[currentOtpIndex] = value ?? '';\n setOtpValue(newOtpValue);\n onChange?.({ name, value: newOtpValue.join('') });\n } else if (value && value.trim().length > 1) {\n // When the entered value is more that 1 character (when value is pasted), set the otpValue to the newly received value.\n // Could have used `onPaste` for web to achieve this but 1. React Native doesn't support onPaste and 2. Safari's autofill on web doesn't trigger onPaste\n setOtpValue(Array.from(value));\n onChange?.({ name, value: value.trim().slice(0, otpLength) });\n } else if (otpValue[currentOtpIndex] !== value?.trim()) {\n // Set the value at the current index to the entered value\n // only as long as its not the same as the already existing value (this prevents `onChange` being triggered unnecessarily)\n const newValue = setOtpValueByIndex({\n value: value?.trim() ?? '',\n index: currentOtpIndex,\n });\n onChange?.({ name, value: newValue });\n }\n };\n\n const handleOnInput = ({\n value,\n currentOtpIndex,\n }: {\n value?: string;\n currentOtpIndex: number;\n }): void => {\n // Moves focus to next input whenever a value is entered in the current input\n if (value && value.trim().length === 1) {\n focusOnOtpByIndex(++currentOtpIndex);\n }\n };\n\n const handleOnKeyDown = ({\n key,\n code,\n event,\n currentOtpIndex,\n }: FormInputOnKeyDownEvent & { currentOtpIndex: number }): void => {\n if (key === 'Backspace' || code === 'Backspace' || code === 'Delete' || key === 'Delete') {\n event.preventDefault?.();\n handleOnChange({ value: '', currentOtpIndex });\n focusOnOtpByIndex(--currentOtpIndex);\n } else if (key === 'ArrowLeft' || code === 'ArrowLeft') {\n event.preventDefault?.();\n focusOnOtpByIndex(--currentOtpIndex);\n } else if (key === 'ArrowRight' || code === 'ArrowRight') {\n event.preventDefault?.();\n focusOnOtpByIndex(++currentOtpIndex);\n } else if (key === ' ' || code === 'Space') {\n event.preventDefault?.();\n }\n };\n\n const getHiddenInput = (): React.ReactNode => {\n if (!isReactNative) {\n return (\n <input\n hidden={true}\n id={inputId}\n name={name}\n value={inputValue ?? otpValue.join('') ?? ''}\n readOnly\n />\n );\n }\n return null;\n };\n\n const getOTPInputFields = (): React.ReactNode => {\n const inputs = [];\n for (let index = 0; index < otpLength; index++) {\n const currentValue = inputValue ? otpToArray(inputValue)[index] || '' : otpValue[index] || '';\n const ref = React.createRef<HTMLInputElement>();\n // if an inputValue is passed (controlled) and isMasked is set, inputType will always be password\n let currentInputType: 'password' | undefined;\n if (isMasked) {\n // if inputValue is passed (controlled component) then the inputType will always be password\n currentInputType = inputValue ? 'password' : inputType[index];\n }\n inputRefs.push(ref);\n inputs.push(\n <BaseBox\n flex={1}\n marginLeft={index == 0 ? 'spacing.0' : 'spacing.3'}\n key={`${inputId}-${index}`}\n >\n <BaseInput\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus && index === 0}\n accessibilityLabel={`${index === 0 ? label || accessibilityLabel : ''} character ${\n index + 1\n }`}\n label={label}\n hideLabelText={true}\n id={`${inputId}-${index}`}\n textAlign=\"center\"\n ref={ref as never}\n name={name}\n value={currentValue}\n maxCharacters={otpValue[index]?.length > 0 ? 1 : undefined}\n onChange={(formEvent) => handleOnChange({ ...formEvent, currentOtpIndex: index })}\n onFocus={(formEvent) => onFocus?.({ ...formEvent, inputIndex: index })}\n onBlur={(formEvent) => onBlur?.({ ...formEvent, inputIndex: index })}\n onInput={(formEvent) => handleOnInput({ ...formEvent, currentOtpIndex: index })}\n onKeyDown={(keyboardEvent) =>\n handleOnKeyDown({ ...keyboardEvent, currentOtpIndex: index })\n }\n isDisabled={isDisabled}\n placeholder={Array.from(placeholder ?? '')[index] ?? ''}\n isRequired={true}\n autoCompleteSuggestionType={autoCompleteSuggestionType}\n keyboardType={keyboardType}\n keyboardReturnKeyType={keyboardReturnKeyType}\n validationState={validationState}\n successText={successText}\n errorText={errorText}\n helpText={helpText}\n hideFormHint={true}\n type={currentInputType}\n size={size}\n valueComponentType=\"heading\"\n {...makeAnalyticsAttribute(rest)}\n />\n </BaseBox>,\n );\n }\n return inputs;\n };\n\n return (\n <BaseBox {...metaAttribute({ name: MetaConstants.OTPInput, testID })} {...getStyledProps(rest)}>\n <BaseBox\n display=\"flex\"\n flexDirection={isLabelLeftPositioned ? 'row' : 'column'}\n alignItems={isLabelLeftPositioned ? 'center' : undefined}\n position=\"relative\"\n >\n {Boolean(label) && (\n <FormLabel as=\"label\" position={labelPosition} htmlFor={inputId} size={size}>\n {label}\n </FormLabel>\n )}\n <BaseBox display=\"flex\" flexDirection=\"row\">\n {getHiddenInput()}\n {getOTPInputFields()}\n </BaseBox>\n </BaseBox>\n {/* the magic number 136 is basically max-width of label i.e 120 and then right margin i.e 16 which is the spacing between label and input field */}\n {/*Refer `BaseInput`'s implementation of FormHint which uses similar logic */}\n <BaseBox marginLeft={makeSize(isLabelLeftPositioned ? 136 : 0)}>\n <FormHint\n type={getHintType({ validationState, hasHelpText: Boolean(helpText) })}\n helpText={helpText}\n errorText={errorText}\n successText={successText}\n helpTextId={helpTextId}\n errorTextId={errorTextId}\n successTextId={successTextId}\n size={size}\n />\n </BaseBox>\n </BaseBox>\n );\n};\n\nconst OTPInput = React.forwardRef<HTMLInputElement[], OTPInputProps>(_OTPInput);\n\nexport type { OTPInputProps };\nexport { OTPInput };\n"],"names":["isReactNative","getPlatformType","otpToArray","code","_code$split","split","Array","fill","_OTPInput","_ref","incomingRef","autoFocus","errorText","helpText","isDisabled","keyboardReturnKeyType","_ref$keyboardType","keyboardType","label","accessibilityLabel","labelPosition","name","onChange","onFocus","onBlur","onOTPFilled","_ref$otpLength","otpLength","placeholder","successText","validationState","inputValue","value","isMasked","_ref$autoCompleteSugg","autoCompleteSuggestionType","testID","_ref$size","size","rest","_objectWithoutProperties","_excluded","inputRefs","_useState","useState","_useState2","_slicedToArray","otpValue","setOtpValue","_useState3","_useState4","inputType","setInputType","isLabelLeftPositioned","_useFormId","useFormId","inputId","helpTextId","errorTextId","successTextId","useImperativeHandle","map","ref","current","useEffect","length","slice","join","forEach","otp","index","isEmpty","newInputType","from","undefined","setOtpValueByIndex","_ref2","newOtpValue","focusOnOtpByIndex","_inputRefs$index","_inputRefs$index$curr","focus","_inputRefs$index2","_inputRefs$index2$cur","select","handleOnChange","_ref3","currentOtpIndex","trim","_value$trim","newValue","handleOnInput","_ref4","handleOnKeyDown","_ref5","key","event","preventDefault","getHiddenInput","_ref6","_jsx","hidden","id","readOnly","getOTPInputFields","inputs","_loop","_otpValue$index","_Array$from$index","currentValue","React","createRef","currentInputType","push","BaseBox","flex","marginLeft","children","BaseInput","Object","assign","hideLabelText","textAlign","maxCharacters","formEvent","inputIndex","onInput","onKeyDown","keyboardEvent","isRequired","hideFormHint","type","valueComponentType","makeAnalyticsAttribute","_jsxs","metaAttribute","MetaConstants","OTPInput","getStyledProps","display","flexDirection","alignItems","position","Boolean","FormLabel","as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CAAEA,IAAK,CAAA+E,QAAA,CACzEnG,KAAK,CACG,CACZ,CACDoH,IAAA,CAACpB,OAAO,CAACyB,CAAAA,OAAO,CAAC,MAAM,CAACC,aAAa,CAAC,KAAK,CAAAvB,QAAA,CACxCnB,CAAAA,cAAc,EAAE,CAChBM,iBAAiB,EAAE,CACb,CAAA,CAAC,CACH,CAAA,CAAC,CAGVJ,GAAA,CAACc,OAAO,CAAA,CAACE,UAAU,CAAE+B,QAAQ,CAAC9F,qBAAqB,CAAG,GAAG,CAAG,CAAC,CAAE,CAAAgE,QAAA,CAC7DjB,GAAA,CAACgD,QAAQ,CACPjB,CAAAA,IAAI,CAAEkB,WAAW,CAAC,CAAEvH,eAAe,CAAfA,eAAe,CAAEwH,WAAW,CAAEP,OAAO,CAAClI,QAAQ,CAAE,CAAC,CAAE,CACvEA,QAAQ,CAAEA,QAAS,CACnBD,SAAS,CAAEA,SAAU,CACrBiB,WAAW,CAAEA,WAAY,CACzB4B,UAAU,CAAEA,UAAW,CACvBC,WAAW,CAAEA,WAAY,CACzBC,aAAa,CAAEA,aAAc,CAC7BrB,IAAI,CAAEA,IAAK,CACZ,CAAC,CACK,CAAC,CACH,CAAA,CAAA,CAAC,CAEd,CAAC,CAEK,IAAAmG,QAAQ,CAAG3B,cAAK,CAACyC,UAAU,CAAoC/I,SAAS;;;;"}
@@ -22,7 +22,7 @@ import { CharacterCounter } from '../../Form/CharacterCounter/CharacterCounter.j
22
22
  import { IconButton } from '../../Button/IconButton/IconButton.js';
23
23
  import { assignWithoutSideEffects } from '../../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
24
24
 
25
- var _excluded=["label","accessibilityLabel","labelPosition","showRevealButton","maxCharacters","validationState","errorText","successText","helpText","isDisabled","defaultValue","placeholder","isRequired","necessityIndicator","value","onChange","onFocus","onBlur","onSubmit","name","autoFocus","keyboardReturnKeyType","autoCompleteSuggestionType","testID","size"];var _PasswordInput=function _PasswordInput(_ref,ref){var label=_ref.label,accessibilityLabel=_ref.accessibilityLabel,_ref$labelPosition=_ref.labelPosition,labelPosition=_ref$labelPosition===void 0?'top':_ref$labelPosition,_ref$showRevealButton=_ref.showRevealButton,showRevealButton=_ref$showRevealButton===void 0?true:_ref$showRevealButton,maxCharacters=_ref.maxCharacters,validationState=_ref.validationState,errorText=_ref.errorText,successText=_ref.successText,helpText=_ref.helpText,_ref$isDisabled=_ref.isDisabled,isDisabled=_ref$isDisabled===void 0?false:_ref$isDisabled,defaultValue=_ref.defaultValue,placeholder=_ref.placeholder,_ref$isRequired=_ref.isRequired,isRequired=_ref$isRequired===void 0?false:_ref$isRequired,_ref$necessityIndicat=_ref.necessityIndicator,necessityIndicator=_ref$necessityIndicat===void 0?'none':_ref$necessityIndicat,value=_ref.value,onChange=_ref.onChange,onFocus=_ref.onFocus,onBlur=_ref.onBlur,onSubmit=_ref.onSubmit,name=_ref.name,_ref$autoFocus=_ref.autoFocus,autoFocus=_ref$autoFocus===void 0?false:_ref$autoFocus,_ref$keyboardReturnKe=_ref.keyboardReturnKeyType,keyboardReturnKeyType=_ref$keyboardReturnKe===void 0?'done':_ref$keyboardReturnKe,autoCompleteSuggestionType=_ref.autoCompleteSuggestionType,testID=_ref.testID,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,styledProps=_objectWithoutProperties(_ref,_excluded);var _React$useState=React__default.useState(false),_React$useState2=_slicedToArray(_React$useState,2),isRevealed=_React$useState2[0],setIsRevealed=_React$useState2[1];var isEnabled=!isDisabled;var isRevealedAndEnabled=isRevealed&&isEnabled;var toggleIsRevealed=function toggleIsRevealed(){return setIsRevealed(function(revealed){return !revealed;});};var iconAccessibilityLabel=isRevealedAndEnabled?'Hide password':'Show password';var type=isRevealedAndEnabled?'text':'password';var revealButtonIcon=isRevealedAndEnabled?EyeOffIcon:EyeIcon;var revealButton=showRevealButton&&!isDisabled?jsx(IconButton,{size:"medium",icon:revealButtonIcon,onClick:toggleIsRevealed,accessibilityLabel:iconAccessibilityLabel}):null;var trailingFooterSlot=function trailingFooterSlot(value){var _value$length;return maxCharacters?jsx(BaseBox,{marginTop:"spacing.2",marginRight:"spacing.1",children:jsx(CharacterCounter,{currentCount:(_value$length=value==null?void 0:value.length)!=null?_value$length:0,maxCount:maxCharacters})}):null;};return jsx(BaseInput,Object.assign({ref:ref,componentName:MetaConstants.PasswordInput,id:"password-field",label:label,accessibilityLabel:accessibilityLabel,hideLabelText:!Boolean(label),labelPosition:labelPosition,type:type,trailingInteractionElement:revealButton,trailingFooterSlot:trailingFooterSlot,maxCharacters:maxCharacters,validationState:validationState,errorText:errorText,successText:successText,helpText:helpText,isDisabled:isDisabled,defaultValue:defaultValue,placeholder:placeholder,isRequired:isRequired,necessityIndicator:necessityIndicator,value:value,onChange:onChange,onBlur:onBlur,onSubmit:onSubmit,onFocus:onFocus,name:name,autoFocus:autoFocus,autoCompleteSuggestionType:autoCompleteSuggestionType,keyboardReturnKeyType:keyboardReturnKeyType,autoCapitalize:"none",testID:testID,size:size},styledProps));};var PasswordInput=assignWithoutSideEffects(React__default.forwardRef(_PasswordInput),{displayName:'PasswordInput'});
25
+ var _excluded=["label","accessibilityLabel","labelPosition","showRevealButton","maxCharacters","validationState","errorText","successText","helpText","isDisabled","defaultValue","placeholder","isRequired","necessityIndicator","value","onChange","onFocus","onBlur","onSubmit","name","autoFocus","keyboardReturnKeyType","autoCompleteSuggestionType","testID","size"];var _PasswordInput=function _PasswordInput(_ref,ref){var label=_ref.label,accessibilityLabel=_ref.accessibilityLabel,_ref$labelPosition=_ref.labelPosition,labelPosition=_ref$labelPosition===void 0?'top':_ref$labelPosition,_ref$showRevealButton=_ref.showRevealButton,showRevealButton=_ref$showRevealButton===void 0?true:_ref$showRevealButton,maxCharacters=_ref.maxCharacters,validationState=_ref.validationState,errorText=_ref.errorText,successText=_ref.successText,helpText=_ref.helpText,_ref$isDisabled=_ref.isDisabled,isDisabled=_ref$isDisabled===void 0?false:_ref$isDisabled,defaultValue=_ref.defaultValue,placeholder=_ref.placeholder,_ref$isRequired=_ref.isRequired,isRequired=_ref$isRequired===void 0?false:_ref$isRequired,_ref$necessityIndicat=_ref.necessityIndicator,necessityIndicator=_ref$necessityIndicat===void 0?'none':_ref$necessityIndicat,value=_ref.value,onChange=_ref.onChange,onFocus=_ref.onFocus,onBlur=_ref.onBlur,onSubmit=_ref.onSubmit,name=_ref.name,_ref$autoFocus=_ref.autoFocus,autoFocus=_ref$autoFocus===void 0?false:_ref$autoFocus,_ref$keyboardReturnKe=_ref.keyboardReturnKeyType,keyboardReturnKeyType=_ref$keyboardReturnKe===void 0?'done':_ref$keyboardReturnKe,autoCompleteSuggestionType=_ref.autoCompleteSuggestionType,testID=_ref.testID,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,rest=_objectWithoutProperties(_ref,_excluded);var _React$useState=React__default.useState(false),_React$useState2=_slicedToArray(_React$useState,2),isRevealed=_React$useState2[0],setIsRevealed=_React$useState2[1];var isEnabled=!isDisabled;var isRevealedAndEnabled=isRevealed&&isEnabled;var toggleIsRevealed=function toggleIsRevealed(){return setIsRevealed(function(revealed){return !revealed;});};var iconAccessibilityLabel=isRevealedAndEnabled?'Hide password':'Show password';var type=isRevealedAndEnabled?'text':'password';var revealButtonIcon=isRevealedAndEnabled?EyeOffIcon:EyeIcon;var revealButton=showRevealButton&&!isDisabled?jsx(IconButton,{size:"medium",icon:revealButtonIcon,onClick:toggleIsRevealed,accessibilityLabel:iconAccessibilityLabel}):null;var trailingFooterSlot=function trailingFooterSlot(value){var _value$length;return maxCharacters?jsx(BaseBox,{marginTop:"spacing.2",marginRight:"spacing.1",children:jsx(CharacterCounter,{currentCount:(_value$length=value==null?void 0:value.length)!=null?_value$length:0,maxCount:maxCharacters})}):null;};return jsx(BaseInput,Object.assign({ref:ref,componentName:MetaConstants.PasswordInput,id:"password-field",label:label,accessibilityLabel:accessibilityLabel,hideLabelText:!Boolean(label),labelPosition:labelPosition,type:type,trailingInteractionElement:revealButton,trailingFooterSlot:trailingFooterSlot,maxCharacters:maxCharacters,validationState:validationState,errorText:errorText,successText:successText,helpText:helpText,isDisabled:isDisabled,defaultValue:defaultValue,placeholder:placeholder,isRequired:isRequired,necessityIndicator:necessityIndicator,value:value,onChange:onChange,onBlur:onBlur,onSubmit:onSubmit,onFocus:onFocus,name:name,autoFocus:autoFocus,autoCompleteSuggestionType:autoCompleteSuggestionType,keyboardReturnKeyType:keyboardReturnKeyType,autoCapitalize:"none",testID:testID,size:size},rest));};var PasswordInput=assignWithoutSideEffects(React__default.forwardRef(_PasswordInput),{displayName:'PasswordInput'});
26
26
 
27
27
  export { PasswordInput };
28
28
  //# sourceMappingURL=PasswordInput.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PasswordInput.js","sources":["../../../../../../src/components/Input/PasswordInput/PasswordInput.tsx"],"sourcesContent":["import React from 'react';\nimport type { BaseInputProps } from '../BaseInput';\nimport { BaseInput } from '../BaseInput';\nimport { EyeIcon, EyeOffIcon } from '~components/Icons';\nimport BaseBox from '~components/Box/BaseBox';\nimport { CharacterCounter } from '~components/Form/CharacterCounter';\nimport { IconButton } from '~components/Button/IconButton';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { MetaConstants } from '~utils/metaAttribute';\nimport type { BladeElementRef } from '~utils/types';\n\ntype PasswordInputExtraProps = {\n /**\n * Shows a reveal button to toggle password visibility\n *\n * @default true\n */\n showRevealButton?: boolean;\n\n /**\n * Displays asterisk (`*`) when `isRequired` is enabled\n *\n * @default none\n */\n necessityIndicator?: Exclude<BaseInputProps['necessityIndicator'], 'optional'>;\n\n /**\n * Determines what autoComplete suggestion type to show. Defaults to using platform heuristics.\n *\n * It's not recommended to turn this off in favor of safe password practices.\n * Providing `password` or `newPassword` is more informative to the platform for browser autofill or password managers.\n *\n * **Note**: Using `newPassword` on iOS has some [known issue](https://github.com/facebook/react-native/issues/21911) on React Native\n *\n * Internally it'll render platform specific attributes:\n *\n * - web: `autocomplete`\n * - iOS: `textContentType`\n * - android: `autoComplete`\n *\n */\n autoCompleteSuggestionType?: Extract<\n BaseInputProps['autoCompleteSuggestionType'],\n 'none' | 'password' | 'newPassword'\n >;\n};\n\ntype PasswordInputCommonProps = Pick<\n BaseInputProps,\n | 'label'\n | 'accessibilityLabel'\n | 'labelPosition'\n | 'maxCharacters'\n | 'validationState'\n | 'errorText'\n | 'successText'\n | 'helpText'\n | 'isDisabled'\n | 'defaultValue'\n | 'placeholder'\n | 'isRequired'\n | 'value'\n | 'onChange'\n | 'onBlur'\n | 'onSubmit'\n | 'onFocus'\n | 'name'\n | 'autoFocus'\n | 'keyboardReturnKeyType'\n | 'autoCompleteSuggestionType'\n | 'testID'\n | 'size'\n> &\n PasswordInputExtraProps &\n StyledPropsBlade;\n\n/*\n Mandatory accessibilityLabel prop when label is not provided\n*/\ntype PasswordInputPropsWithA11yLabel = {\n /**\n * Label to be shown for the input field\n */\n label?: undefined;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel: string;\n};\n\n/*\n Optional accessibilityLabel prop when label is provided\n*/\ntype PasswordInputPropsWithLabel = {\n /**\n * Label to be shown for the input field\n */\n label: string;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel?: string;\n};\n\ntype PasswordInputProps = (PasswordInputPropsWithA11yLabel | PasswordInputPropsWithLabel) &\n PasswordInputCommonProps;\n\nconst _PasswordInput: React.ForwardRefRenderFunction<BladeElementRef, PasswordInputProps> = (\n {\n label,\n accessibilityLabel,\n labelPosition = 'top',\n showRevealButton = true,\n maxCharacters,\n validationState,\n errorText,\n successText,\n helpText,\n isDisabled = false,\n defaultValue,\n placeholder,\n isRequired = false,\n necessityIndicator = 'none',\n value,\n onChange,\n onFocus,\n onBlur,\n onSubmit,\n name,\n autoFocus = false,\n keyboardReturnKeyType = 'done',\n autoCompleteSuggestionType,\n testID,\n size = 'medium',\n ...styledProps\n },\n ref,\n) => {\n const [isRevealed, setIsRevealed] = React.useState(false);\n const isEnabled = !isDisabled;\n\n // If input is disabled reveal button shouldn't be present and input should be masked\n const isRevealedAndEnabled = isRevealed && isEnabled;\n\n const toggleIsRevealed = (): void => setIsRevealed((revealed) => !revealed);\n const iconAccessibilityLabel = isRevealedAndEnabled ? 'Hide password' : 'Show password';\n const type = isRevealedAndEnabled ? 'text' : 'password';\n\n const revealButtonIcon = isRevealedAndEnabled ? EyeOffIcon : EyeIcon;\n const revealButton =\n showRevealButton && !isDisabled ? (\n <IconButton\n size=\"medium\"\n icon={revealButtonIcon}\n onClick={toggleIsRevealed}\n accessibilityLabel={iconAccessibilityLabel}\n />\n ) : null;\n\n const trailingFooterSlot = (value?: string): React.ReactNode =>\n maxCharacters ? (\n <BaseBox marginTop=\"spacing.2\" marginRight=\"spacing.1\">\n <CharacterCounter currentCount={value?.length ?? 0} maxCount={maxCharacters} />\n </BaseBox>\n ) : null;\n\n return (\n <BaseInput\n ref={ref}\n componentName={MetaConstants.PasswordInput}\n id=\"password-field\"\n label={label as string}\n accessibilityLabel={accessibilityLabel}\n hideLabelText={!Boolean(label)}\n labelPosition={labelPosition}\n type={type}\n trailingInteractionElement={revealButton}\n trailingFooterSlot={trailingFooterSlot}\n maxCharacters={maxCharacters}\n validationState={validationState}\n errorText={errorText}\n successText={successText}\n helpText={helpText}\n isDisabled={isDisabled}\n defaultValue={defaultValue}\n placeholder={placeholder}\n isRequired={isRequired}\n necessityIndicator={necessityIndicator}\n value={value}\n onChange={onChange}\n onBlur={onBlur}\n onSubmit={onSubmit}\n onFocus={onFocus}\n name={name}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n autoCompleteSuggestionType={autoCompleteSuggestionType}\n keyboardReturnKeyType={keyboardReturnKeyType}\n autoCapitalize=\"none\"\n testID={testID}\n size={size}\n {...styledProps}\n />\n );\n};\n\n// nosemgrep\nconst PasswordInput = assignWithoutSideEffects(React.forwardRef(_PasswordInput), {\n displayName: 'PasswordInput',\n});\n\nexport type { PasswordInputProps };\nexport { PasswordInput };\n"],"names":["_PasswordInput","_ref","ref","label","accessibilityLabel","_ref$labelPosition","labelPosition","_ref$showRevealButton","showRevealButton","maxCharacters","validationState","errorText","successText","helpText","_ref$isDisabled","isDisabled","defaultValue","placeholder","_ref$isRequired","isRequired","_ref$necessityIndicat","necessityIndicator","value","onChange","onFocus","onBlur","onSubmit","name","_ref$autoFocus","autoFocus","_ref$keyboardReturnKe","keyboardReturnKeyType","autoCompleteSuggestionType","testID","_ref$size","size","styledProps","_objectWithoutProperties","_excluded","_React$useState","React","useState","_React$useState2","_slicedToArray","isRevealed","setIsRevealed","isEnabled","isRevealedAndEnabled","toggleIsRevealed","revealed","iconAccessibilityLabel","type","revealButtonIcon","EyeOffIcon","EyeIcon","revealButton","_jsx","IconButton","icon","onClick","trailingFooterSlot","_value$length","BaseBox","marginTop","marginRight","children","CharacterCounter","currentCount","length","maxCount","BaseInput","Object","assign","componentName","MetaConstants","PasswordInput","id","hideLabelText","Boolean","trailingInteractionElement","autoCapitalize","assignWithoutSideEffects","forwardRef","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,SAAA,CAAA,CAAA,OAAA,CAAA,oBAAA,CAAA,eAAA,CAAA,kBAAA,CAAA,eAAA,CAAA,iBAAA,CAAA,WAAA,CAAA,aAAA,CAAA,UAAA,CAAA,YAAA,CAAA,cAAA,CAAA,aAAA,CAAA,YAAA,CAAA,oBAAA,CAAA,OAAA,CAAA,UAAA,CAAA,SAAA,CAAA,QAAA,CAAA,UAAA,CAAA,MAAA,CAAA,WAAA,CAAA,uBAAA,CAAA,4BAAA,CAAA,QAAA,CAAA,MAAA,CAAA,CA4GA,IAAMA,cAAmF,CAAG,SAAtFA,cAAmFA,CAAAC,IAAA,CA6BvFC,GAAG,CACA,CAAA,IA5BDC,KAAK,CAAAF,IAAA,CAALE,KAAK,CACLC,kBAAkB,CAAAH,IAAA,CAAlBG,kBAAkB,CAAAC,kBAAA,CAAAJ,IAAA,CAClBK,aAAa,CAAb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BAA0B,CAAEA,0BAA2B,CACvDD,qBAAqB,CAAEA,qBAAsB,CAC7CiD,cAAc,CAAC,MAAM,CACrB/C,MAAM,CAAEA,MAAO,CACfE,IAAI,CAAEA,IAAK,CACPC,CAAAA,WAAW,CAChB,CAAC,CAEN,CAAC,CAGK,IAAAuC,aAAa,CAAGM,wBAAwB,CAACzC,cAAK,CAAC0C,UAAU,CAAClF,cAAc,CAAC,CAAE,CAC/EmF,WAAW,CAAE,eACf,CAAC;;;;"}
1
+ {"version":3,"file":"PasswordInput.js","sources":["../../../../../../src/components/Input/PasswordInput/PasswordInput.tsx"],"sourcesContent":["import React from 'react';\nimport type { BaseInputProps } from '../BaseInput';\nimport { BaseInput } from '../BaseInput';\nimport { EyeIcon, EyeOffIcon } from '~components/Icons';\nimport BaseBox from '~components/Box/BaseBox';\nimport { CharacterCounter } from '~components/Form/CharacterCounter';\nimport { IconButton } from '~components/Button/IconButton';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { MetaConstants } from '~utils/metaAttribute';\nimport type { DataAnalyticsAttribute, BladeElementRef } from '~utils/types';\n\ntype PasswordInputExtraProps = {\n /**\n * Shows a reveal button to toggle password visibility\n *\n * @default true\n */\n showRevealButton?: boolean;\n\n /**\n * Displays asterisk (`*`) when `isRequired` is enabled\n *\n * @default none\n */\n necessityIndicator?: Exclude<BaseInputProps['necessityIndicator'], 'optional'>;\n\n /**\n * Determines what autoComplete suggestion type to show. Defaults to using platform heuristics.\n *\n * It's not recommended to turn this off in favor of safe password practices.\n * Providing `password` or `newPassword` is more informative to the platform for browser autofill or password managers.\n *\n * **Note**: Using `newPassword` on iOS has some [known issue](https://github.com/facebook/react-native/issues/21911) on React Native\n *\n * Internally it'll render platform specific attributes:\n *\n * - web: `autocomplete`\n * - iOS: `textContentType`\n * - android: `autoComplete`\n *\n */\n autoCompleteSuggestionType?: Extract<\n BaseInputProps['autoCompleteSuggestionType'],\n 'none' | 'password' | 'newPassword'\n >;\n};\n\ntype PasswordInputCommonProps = Pick<\n BaseInputProps,\n | 'label'\n | 'accessibilityLabel'\n | 'labelPosition'\n | 'maxCharacters'\n | 'validationState'\n | 'errorText'\n | 'successText'\n | 'helpText'\n | 'isDisabled'\n | 'defaultValue'\n | 'placeholder'\n | 'isRequired'\n | 'value'\n | 'onChange'\n | 'onBlur'\n | 'onSubmit'\n | 'onFocus'\n | 'name'\n | 'autoFocus'\n | 'keyboardReturnKeyType'\n | 'autoCompleteSuggestionType'\n | 'testID'\n | 'size'\n | keyof DataAnalyticsAttribute\n> &\n PasswordInputExtraProps &\n StyledPropsBlade;\n\n/*\n Mandatory accessibilityLabel prop when label is not provided\n*/\ntype PasswordInputPropsWithA11yLabel = {\n /**\n * Label to be shown for the input field\n */\n label?: undefined;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel: string;\n};\n\n/*\n Optional accessibilityLabel prop when label is provided\n*/\ntype PasswordInputPropsWithLabel = {\n /**\n * Label to be shown for the input field\n */\n label: string;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel?: string;\n};\n\ntype PasswordInputProps = (PasswordInputPropsWithA11yLabel | PasswordInputPropsWithLabel) &\n PasswordInputCommonProps;\n\nconst _PasswordInput: React.ForwardRefRenderFunction<BladeElementRef, PasswordInputProps> = (\n {\n label,\n accessibilityLabel,\n labelPosition = 'top',\n showRevealButton = true,\n maxCharacters,\n validationState,\n errorText,\n successText,\n helpText,\n isDisabled = false,\n defaultValue,\n placeholder,\n isRequired = false,\n necessityIndicator = 'none',\n value,\n onChange,\n onFocus,\n onBlur,\n onSubmit,\n name,\n autoFocus = false,\n keyboardReturnKeyType = 'done',\n autoCompleteSuggestionType,\n testID,\n size = 'medium',\n ...rest\n },\n ref,\n) => {\n const [isRevealed, setIsRevealed] = React.useState(false);\n const isEnabled = !isDisabled;\n\n // If input is disabled reveal button shouldn't be present and input should be masked\n const isRevealedAndEnabled = isRevealed && isEnabled;\n\n const toggleIsRevealed = (): void => setIsRevealed((revealed) => !revealed);\n const iconAccessibilityLabel = isRevealedAndEnabled ? 'Hide password' : 'Show password';\n const type = isRevealedAndEnabled ? 'text' : 'password';\n\n const revealButtonIcon = isRevealedAndEnabled ? EyeOffIcon : EyeIcon;\n const revealButton =\n showRevealButton && !isDisabled ? (\n <IconButton\n size=\"medium\"\n icon={revealButtonIcon}\n onClick={toggleIsRevealed}\n accessibilityLabel={iconAccessibilityLabel}\n />\n ) : null;\n\n const trailingFooterSlot = (value?: string): React.ReactNode =>\n maxCharacters ? (\n <BaseBox marginTop=\"spacing.2\" marginRight=\"spacing.1\">\n <CharacterCounter currentCount={value?.length ?? 0} maxCount={maxCharacters} />\n </BaseBox>\n ) : null;\n\n return (\n <BaseInput\n ref={ref}\n componentName={MetaConstants.PasswordInput}\n id=\"password-field\"\n label={label as string}\n accessibilityLabel={accessibilityLabel}\n hideLabelText={!Boolean(label)}\n labelPosition={labelPosition}\n type={type}\n trailingInteractionElement={revealButton}\n trailingFooterSlot={trailingFooterSlot}\n maxCharacters={maxCharacters}\n validationState={validationState}\n errorText={errorText}\n successText={successText}\n helpText={helpText}\n isDisabled={isDisabled}\n defaultValue={defaultValue}\n placeholder={placeholder}\n isRequired={isRequired}\n necessityIndicator={necessityIndicator}\n value={value}\n onChange={onChange}\n onBlur={onBlur}\n onSubmit={onSubmit}\n onFocus={onFocus}\n name={name}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n autoCompleteSuggestionType={autoCompleteSuggestionType}\n keyboardReturnKeyType={keyboardReturnKeyType}\n autoCapitalize=\"none\"\n testID={testID}\n size={size}\n {...rest}\n />\n );\n};\n\n// nosemgrep\nconst PasswordInput = assignWithoutSideEffects(React.forwardRef(_PasswordInput), {\n displayName: 'PasswordInput',\n});\n\nexport type { PasswordInputProps };\nexport { PasswordInput };\n"],"names":["_PasswordInput","_ref","ref","label","accessibilityLabel","_ref$labelPosition","labelPosition","_ref$showRevealButton","showRevealButton","maxCharacters","validationState","errorText","successText","helpText","_ref$isDisabled","isDisabled","defaultValue","placeholder","_ref$isRequired","isRequired","_ref$necessityIndicat","necessityIndicator","value","onChange","onFocus","onBlur","onSubmit","name","_ref$autoFocus","autoFocus","_ref$keyboardReturnKe","keyboardReturnKeyType","autoCompleteSuggestionType","testID","_ref$size","size","rest","_objectWithoutProperties","_excluded","_React$useState","React","useState","_React$useState2","_slicedToArray","isRevealed","setIsRevealed","isEnabled","isRevealedAndEnabled","toggleIsRevealed","revealed","iconAccessibilityLabel","type","revealButtonIcon","EyeOffIcon","EyeIcon","revealButton","_jsx","IconButton","icon","onClick","trailingFooterSlot","_value$length","BaseBox","marginTop","marginRight","children","CharacterCounter","currentCount","length","maxCount","BaseInput","Object","assign","componentName","MetaConstants","PasswordInput","id","hideLabelText","Boolean","trailingInteractionElement","autoCapitalize","assignWithoutSideEffects","forwardRef","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,SAAA,CAAA,CAAA,OAAA,CAAA,oBAAA,CAAA,eAAA,CAAA,kBAAA,CAAA,eAAA,CAAA,iBAAA,CAAA,WAAA,CAAA,aAAA,CAAA,UAAA,CAAA,YAAA,CAAA,cAAA,CAAA,aAAA,CAAA,YAAA,CAAA,oBAAA,CAAA,OAAA,CAAA,UAAA,CAAA,SAAA,CAAA,QAAA,CAAA,UAAA,CAAA,MAAA,CAAA,WAAA,CAAA,uBAAA,CAAA,4BAAA,CAAA,QAAA,CAAA,MAAA,CAAA,CA6GA,IAAMA,cAAmF,CAAG,SAAtFA,cAAmFA,CAAAC,IAAA,CA6BvFC,GAAG,CACA,CAAA,IA5BDC,KAAK,CAAAF,IAAA,CAALE,KAAK,CACLC,kBAAkB,CAAAH,IAAA,CAAlBG,kBAAkB,CAAAC,kBAAA,CAAAJ,IAAA,CAClBK,aAAa,CAAbA,aAAa,CAAAD,kBAAA,GAAA,KAAA,CAAA,CAAG,KAAK,CAAAA,kBAAA,CAAAE,qBAAA,CAA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/C,MAAM,CAAEA,MAAO,CACfE,IAAI,CAAEA,IAAK,CACPC,CAAAA,IAAI,CACT,CAAC,CAEN,CAAC,CAGK,IAAAuC,aAAa,CAAGM,wBAAwB,CAACzC,cAAK,CAAC0C,UAAU,CAAClF,cAAc,CAAC,CAAE,CAC/EmF,WAAW,CAAE,eACf,CAAC;;;;"}
@@ -28,7 +28,7 @@ import { useMergeRefs } from '../../../utils/useMergeRefs.js';
28
28
  import { dropdownComponentIds } from '../../Dropdown/dropdownComponentIds.js';
29
29
  import { useDropdown } from '../../Dropdown/useDropdown.js';
30
30
 
31
- var _excluded=["label","accessibilityLabel","labelPosition","placeholder","defaultValue","name","value","onChange","onClick","onFocus","onBlur","onSubmit","isDisabled","helpText","onClearButtonClick","isLoading","autoCapitalize","autoFocus","testID","size","showSearchIcon"];var isReactNative=function isReactNative(_textInputRef){return getPlatformType()==='react-native';};var _SearchInput=function _SearchInput(_ref,ref){var label=_ref.label,accessibilityLabel=_ref.accessibilityLabel,_ref$labelPosition=_ref.labelPosition,labelPosition=_ref$labelPosition===void 0?'top':_ref$labelPosition,placeholder=_ref.placeholder,defaultValue=_ref.defaultValue,name=_ref.name,value=_ref.value,_onChange=_ref.onChange,_onClick=_ref.onClick,onFocus=_ref.onFocus,onBlur=_ref.onBlur,onSubmit=_ref.onSubmit,isDisabled=_ref.isDisabled,helpText=_ref.helpText,onClearButtonClick=_ref.onClearButtonClick,isLoading=_ref.isLoading,autoCapitalize=_ref.autoCapitalize,autoFocus=_ref.autoFocus,testID=_ref.testID,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,_ref$showSearchIcon=_ref.showSearchIcon,showSearchIcon=_ref$showSearchIcon===void 0?true:_ref$showSearchIcon,styledProps=_objectWithoutProperties(_ref,_excluded);var textInputRef=React__default.useRef(null);var mergedRef=useMergeRefs(ref,textInputRef);var _useState=useState(false),_useState2=_slicedToArray(_useState,2),shouldShowClearButton=_useState2[0],setShouldShowClearButton=_useState2[1];var _useDropdown=useDropdown(),triggererWrapperRef=_useDropdown.triggererWrapperRef,onTriggerKeydown=_useDropdown.onTriggerKeydown,onTriggerClick=_useDropdown.onTriggerClick,dropdownTriggerer=_useDropdown.dropdownTriggerer;var isInsideDropdown=dropdownTriggerer==='SearchInput';React__default.useEffect(function(){setShouldShowClearButton(Boolean(defaultValue!=null?defaultValue:value));},[defaultValue,value]);var renderInteractionElement=function renderInteractionElement(){if(isLoading){return jsx(Spinner,{accessibilityLabel:"Loading Content",color:"primary"});}if(shouldShowClearButton){return jsx(IconButton,{size:"medium",icon:CloseIcon,onClick:function onClick(){var _textInputRef$current;if(isEmpty(value)&&textInputRef.current){if(isReactNative(textInputRef.current)){textInputRef.current.clear();textInputRef.current.focus();}else if(textInputRef.current instanceof HTMLInputElement){textInputRef.current.value='';textInputRef.current.focus();}}onClearButtonClick==null?void 0:onClearButtonClick();textInputRef==null?void 0:(_textInputRef$current=textInputRef.current)==null?void 0:_textInputRef$current.focus();setShouldShowClearButton(false);},isDisabled:isDisabled,accessibilityLabel:"Clear Input Content"});}return null;};return jsx(BaseBox,{position:"relative",children:jsx(BaseInput,Object.assign({id:"searchinput",componentName:MetaConstants.SearchInput,ref:mergedRef,isDropdownTrigger:true,setInputWrapperRef:isInsideDropdown?function(wrapperNode){triggererWrapperRef.current=wrapperNode;}:undefined,label:label,accessibilityLabel:accessibilityLabel,hideLabelText:!Boolean(label),labelPosition:labelPosition,placeholder:placeholder,defaultValue:defaultValue,value:value,name:name,onKeyDown:isInsideDropdown?onTriggerKeydown:undefined,onChange:function onChange(_ref2){var name=_ref2.name,value=_ref2.value;if(value!=null&&value.length){setShouldShowClearButton(true);}if(shouldShowClearButton&&!(value!=null&&value.length)){setShouldShowClearButton(false);}_onChange==null?void 0:_onChange({name:name,value:value});},onClick:function onClick(e){if(isDisabled)return;if(isInsideDropdown){onTriggerClick();}_onClick==null?void 0:_onClick(e);},onFocus:onFocus,onBlur:onBlur,onSubmit:onSubmit,isDisabled:isDisabled,leadingIcon:showSearchIcon?SearchIcon:undefined,trailingInteractionElement:renderInteractionElement(),helpText:helpText,autoFocus:autoFocus,testID:testID},getKeyboardAndAutocompleteProps({type:'search',autoCapitalize:autoCapitalize}),{size:size},styledProps))});};var SearchInput=assignWithoutSideEffects(React__default.forwardRef(_SearchInput),{displayName:'SearchInput',componentId:dropdownComponentIds.triggers.SearchInput});
31
+ var _excluded=["label","accessibilityLabel","labelPosition","placeholder","defaultValue","name","value","onChange","onClick","onFocus","onBlur","onSubmit","isDisabled","helpText","onClearButtonClick","isLoading","autoCapitalize","autoFocus","testID","size","showSearchIcon"];var isReactNative=function isReactNative(_textInputRef){return getPlatformType()==='react-native';};var _SearchInput=function _SearchInput(_ref,ref){var label=_ref.label,accessibilityLabel=_ref.accessibilityLabel,_ref$labelPosition=_ref.labelPosition,labelPosition=_ref$labelPosition===void 0?'top':_ref$labelPosition,placeholder=_ref.placeholder,defaultValue=_ref.defaultValue,name=_ref.name,value=_ref.value,_onChange=_ref.onChange,_onClick=_ref.onClick,onFocus=_ref.onFocus,onBlur=_ref.onBlur,onSubmit=_ref.onSubmit,isDisabled=_ref.isDisabled,helpText=_ref.helpText,onClearButtonClick=_ref.onClearButtonClick,isLoading=_ref.isLoading,autoCapitalize=_ref.autoCapitalize,autoFocus=_ref.autoFocus,testID=_ref.testID,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,_ref$showSearchIcon=_ref.showSearchIcon,showSearchIcon=_ref$showSearchIcon===void 0?true:_ref$showSearchIcon,rest=_objectWithoutProperties(_ref,_excluded);var textInputRef=React__default.useRef(null);var mergedRef=useMergeRefs(ref,textInputRef);var _useState=useState(false),_useState2=_slicedToArray(_useState,2),shouldShowClearButton=_useState2[0],setShouldShowClearButton=_useState2[1];var _useDropdown=useDropdown(),triggererWrapperRef=_useDropdown.triggererWrapperRef,onTriggerKeydown=_useDropdown.onTriggerKeydown,onTriggerClick=_useDropdown.onTriggerClick,dropdownTriggerer=_useDropdown.dropdownTriggerer;var isInsideDropdown=dropdownTriggerer==='SearchInput';React__default.useEffect(function(){setShouldShowClearButton(Boolean(defaultValue!=null?defaultValue:value));},[defaultValue,value]);var renderInteractionElement=function renderInteractionElement(){if(isLoading){return jsx(Spinner,{accessibilityLabel:"Loading Content",color:"primary"});}if(shouldShowClearButton){return jsx(IconButton,{size:"medium",icon:CloseIcon,onClick:function onClick(){var _textInputRef$current;if(isEmpty(value)&&textInputRef.current){if(isReactNative(textInputRef.current)){textInputRef.current.clear();textInputRef.current.focus();}else if(textInputRef.current instanceof HTMLInputElement){textInputRef.current.value='';textInputRef.current.focus();}}onClearButtonClick==null?void 0:onClearButtonClick();textInputRef==null?void 0:(_textInputRef$current=textInputRef.current)==null?void 0:_textInputRef$current.focus();setShouldShowClearButton(false);},isDisabled:isDisabled,accessibilityLabel:"Clear Input Content"});}return null;};return jsx(BaseBox,{position:"relative",children:jsx(BaseInput,Object.assign({id:"searchinput",componentName:MetaConstants.SearchInput,ref:mergedRef,isDropdownTrigger:true,setInputWrapperRef:isInsideDropdown?function(wrapperNode){triggererWrapperRef.current=wrapperNode;}:undefined,label:label,accessibilityLabel:accessibilityLabel,hideLabelText:!Boolean(label),labelPosition:labelPosition,placeholder:placeholder,defaultValue:defaultValue,value:value,name:name,onKeyDown:isInsideDropdown?onTriggerKeydown:undefined,onChange:function onChange(_ref2){var name=_ref2.name,value=_ref2.value;if(value!=null&&value.length){setShouldShowClearButton(true);}if(shouldShowClearButton&&!(value!=null&&value.length)){setShouldShowClearButton(false);}_onChange==null?void 0:_onChange({name:name,value:value});},onClick:function onClick(e){if(isDisabled)return;if(isInsideDropdown){onTriggerClick();}_onClick==null?void 0:_onClick(e);},onFocus:onFocus,onBlur:onBlur,onSubmit:onSubmit,isDisabled:isDisabled,leadingIcon:showSearchIcon?SearchIcon:undefined,trailingInteractionElement:renderInteractionElement(),helpText:helpText,autoFocus:autoFocus,testID:testID},getKeyboardAndAutocompleteProps({type:'search',autoCapitalize:autoCapitalize}),{size:size},rest))});};var SearchInput=assignWithoutSideEffects(React__default.forwardRef(_SearchInput),{displayName:'SearchInput',componentId:dropdownComponentIds.triggers.SearchInput});
32
32
 
33
33
  export { SearchInput };
34
34
  //# sourceMappingURL=SearchInput.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SearchInput.js","sources":["../../../../../../src/components/Input/SearchInput/SearchInput.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport type { ReactElement, ReactNode } from 'react';\nimport type { TextInput as TextInputReactNative } from 'react-native';\nimport type { BaseInputProps } from '../BaseInput';\nimport { BaseInput } from '../BaseInput';\nimport { getKeyboardAndAutocompleteProps } from '../BaseInput/utils';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport { CloseIcon, SearchIcon } from '~components/Icons';\nimport { IconButton } from '~components/Button/IconButton';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { MetaConstants } from '~utils/metaAttribute';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Spinner } from '~components/Spinner';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getPlatformType } from '~utils';\nimport { useMergeRefs } from '~utils/useMergeRefs';\nimport type { BladeElementRef, BladeElementRefWithValue } from '~utils/types';\nimport { dropdownComponentIds } from '~components/Dropdown/dropdownComponentIds';\nimport { useDropdown } from '~components/Dropdown/useDropdown';\n\ntype SearchInputCommonProps = Pick<\n BaseInputProps,\n | 'label'\n | 'accessibilityLabel'\n | 'labelPosition'\n | 'helpText'\n | 'placeholder'\n | 'defaultValue'\n | 'name'\n | 'onChange'\n | 'onFocus'\n | 'onBlur'\n | 'value'\n | 'isDisabled'\n | 'autoFocus'\n | 'onSubmit'\n | 'autoCapitalize'\n | 'testID'\n | 'onClick'\n | 'size'\n> & {\n /**\n * Event handler to handle the onClick event for clear button.\n */\n onClearButtonClick?: () => void;\n\n /**\n * Decides whether to show a loading spinner for the input field.\n */\n isLoading?: boolean;\n /**\n * Toggle the visibility of the search icon.\n *\n * @default true\n */\n showSearchIcon?: boolean;\n} & StyledPropsBlade;\n\n/*\n Mandatory accessibilityLabel prop when label is not provided\n*/\ntype SearchInputPropsWithA11yLabel = {\n /**\n * Label to be shown for the input field\n */\n label?: undefined;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel: string;\n};\n\n/*\n Optional accessibilityLabel prop when label is provided\n*/\ntype SearchInputPropsWithLabel = {\n /**\n * Label to be shown for the input field\n */\n label: string;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel?: string;\n};\n\ntype SearchInputProps = (SearchInputPropsWithA11yLabel | SearchInputPropsWithLabel) &\n SearchInputCommonProps;\n\n// need to do this to tell TS to infer type as SearchInput of React Native and make it believe that `ref.current.clear()` exists\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst isReactNative = (_textInputRef?: any): _textInputRef is TextInputReactNative => {\n return getPlatformType() === 'react-native';\n};\n\nconst _SearchInput: React.ForwardRefRenderFunction<BladeElementRef, SearchInputProps> = (\n {\n label,\n accessibilityLabel,\n labelPosition = 'top',\n placeholder,\n defaultValue,\n name,\n value,\n onChange,\n onClick,\n onFocus,\n onBlur,\n onSubmit,\n isDisabled,\n helpText,\n onClearButtonClick,\n isLoading,\n autoCapitalize,\n autoFocus,\n testID,\n size = 'medium',\n showSearchIcon = true,\n ...styledProps\n },\n ref,\n): ReactElement => {\n const textInputRef = React.useRef<BladeElementRefWithValue>(null);\n const mergedRef = useMergeRefs(ref, textInputRef);\n const [shouldShowClearButton, setShouldShowClearButton] = useState(false);\n const {\n triggererWrapperRef,\n onTriggerKeydown,\n onTriggerClick,\n dropdownTriggerer,\n } = useDropdown();\n const isInsideDropdown = dropdownTriggerer === 'SearchInput';\n\n React.useEffect(() => {\n setShouldShowClearButton(Boolean(defaultValue ?? value));\n }, [defaultValue, value]);\n\n const renderInteractionElement = (): ReactNode => {\n if (isLoading) {\n return <Spinner accessibilityLabel=\"Loading Content\" color=\"primary\" />;\n }\n\n if (shouldShowClearButton) {\n return (\n <IconButton\n size=\"medium\"\n icon={CloseIcon}\n onClick={() => {\n if (isEmpty(value) && textInputRef.current) {\n // when the input field is uncontrolled take the ref and clear the input and then call the onClearButtonClick function\n if (isReactNative(textInputRef.current)) {\n textInputRef.current.clear();\n textInputRef.current.focus();\n } else if (textInputRef.current instanceof HTMLInputElement) {\n textInputRef.current.value = '';\n textInputRef.current.focus();\n }\n }\n\n // if the input field is controlled just call the click handler and the value change shall be left upto the consumer\n onClearButtonClick?.();\n textInputRef?.current?.focus();\n setShouldShowClearButton(false);\n }}\n isDisabled={isDisabled}\n accessibilityLabel=\"Clear Input Content\"\n />\n );\n }\n\n return null;\n };\n\n return (\n <BaseBox position=\"relative\">\n <BaseInput\n id=\"searchinput\"\n componentName={MetaConstants.SearchInput}\n ref={mergedRef}\n isDropdownTrigger={true}\n setInputWrapperRef={\n isInsideDropdown\n ? (wrapperNode) => {\n triggererWrapperRef.current = wrapperNode;\n }\n : undefined\n }\n label={label as string}\n accessibilityLabel={accessibilityLabel}\n hideLabelText={!Boolean(label)}\n labelPosition={labelPosition}\n placeholder={placeholder}\n defaultValue={defaultValue}\n value={value}\n name={name}\n onKeyDown={isInsideDropdown ? onTriggerKeydown : undefined}\n onChange={({ name, value }) => {\n if (value?.length) {\n // show the clear button when the user starts typing in\n setShouldShowClearButton(true);\n }\n\n if (shouldShowClearButton && !value?.length) {\n // hide the clear button when the input field is empty\n setShouldShowClearButton(false);\n }\n\n onChange?.({ name, value });\n }}\n onClick={(e) => {\n if (isDisabled) return;\n if (isInsideDropdown) {\n onTriggerClick();\n }\n onClick?.(e);\n }}\n onFocus={onFocus}\n onBlur={onBlur}\n onSubmit={onSubmit}\n isDisabled={isDisabled}\n leadingIcon={showSearchIcon ? SearchIcon : undefined}\n trailingInteractionElement={renderInteractionElement()}\n helpText={helpText}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n testID={testID}\n {...getKeyboardAndAutocompleteProps({\n type: 'search',\n autoCapitalize,\n })}\n size={size}\n {...styledProps}\n />\n </BaseBox>\n );\n};\n\nconst SearchInput = assignWithoutSideEffects(React.forwardRef(_SearchInput), {\n displayName: 'SearchInput',\n componentId: dropdownComponentIds.triggers.SearchInput,\n});\n\nexport type { SearchInputProps };\nexport { SearchInput };\n"],"names":["isReactNative","_textInputRef","getPlatformType","_SearchInput","_ref","ref","label","accessibilityLabel","_ref$labelPosition","labelPosition","placeholder","defaultValue","name","value","onChange","onClick","onFocus","onBlur","onSubmit","isDisabled","helpText","onClearButtonClick","isLoading","autoCapitalize","autoFocus","testID","_ref$size","size","_ref$showSearchIcon","showSearchIcon","styledProps","_objectWithoutProperties","_excluded","textInputRef","React","useRef","mergedRef","useMergeRefs","_useState","useState","_useState2","_slicedToArray","shouldShowClearButton","setShouldShowClearButton","_useDropdown","useDropdown","triggererWrapperRef","onTriggerKeydown","onTriggerClick","dropdownTriggerer","isInsideDropdown","useEffect","Boolean","renderInteractionElement","_jsx","Spinner","color","IconButton","icon","CloseIcon","_textInputRef$current","isEmpty","current","clear","focus","HTMLInputElement","BaseBox","position","children","BaseInput","Object","assign","id","componentName","MetaConstants","SearchInput","isDropdownTrigger","setInputWrapperRef","wrapperNode","undefined","hideLabelText","onKeyDown","_ref2","length","e","leadingIcon","SearchIcon","trailingInteractionElement","getKeyboardAndAutocompleteProps","type","assignWithoutSideEffects","forwardRef","displayName","componentId","dropdownComponentIds","triggers"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mRA2FA,IAAMA,aAAa,CAAG,SAAhBA,aAAaA,CAAIC,aAAmB,CAA4C,CACpF,OAAOC,eAAe,EAAE,GAAK,cAAc,CAC7C,CAAC,CAED,IAAMC,YAA+E,CAAG,SAAlFA,YAA+EA,CAAAC,IAAA,CAyBnFC,GAAG,CACc,CAxBf,IAAAC,KAAK,CAAAF,IAAA,CAALE,KAAK,CACLC,kBAAkB,CAAAH,IAAA,CAAlBG,kBAAkB,CAAAC,kBAAA,CAAAJ,IAAA,CAClBK,aAAa,CAAbA,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AoB,CAACC,QAAQ,CAACpB,WAC7C,CAAC;;;;"}
1
+ {"version":3,"file":"SearchInput.js","sources":["../../../../../../src/components/Input/SearchInput/SearchInput.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport type { ReactElement, ReactNode } from 'react';\nimport type { TextInput as TextInputReactNative } from 'react-native';\nimport type { BaseInputProps } from '../BaseInput';\nimport { BaseInput } from '../BaseInput';\nimport { getKeyboardAndAutocompleteProps } from '../BaseInput/utils';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport { CloseIcon, SearchIcon } from '~components/Icons';\nimport { IconButton } from '~components/Button/IconButton';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { MetaConstants } from '~utils/metaAttribute';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Spinner } from '~components/Spinner';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getPlatformType } from '~utils';\nimport { useMergeRefs } from '~utils/useMergeRefs';\nimport type {\n BladeElementRef,\n BladeElementRefWithValue,\n DataAnalyticsAttribute,\n} from '~utils/types';\nimport { dropdownComponentIds } from '~components/Dropdown/dropdownComponentIds';\nimport { useDropdown } from '~components/Dropdown/useDropdown';\n\ntype SearchInputCommonProps = Pick<\n BaseInputProps,\n | 'label'\n | 'accessibilityLabel'\n | 'labelPosition'\n | 'helpText'\n | 'placeholder'\n | 'defaultValue'\n | 'name'\n | 'onChange'\n | 'onFocus'\n | 'onBlur'\n | 'value'\n | 'isDisabled'\n | 'autoFocus'\n | 'onSubmit'\n | 'autoCapitalize'\n | 'testID'\n | 'onClick'\n | 'size'\n | keyof DataAnalyticsAttribute\n> & {\n /**\n * Event handler to handle the onClick event for clear button.\n */\n onClearButtonClick?: () => void;\n\n /**\n * Decides whether to show a loading spinner for the input field.\n */\n isLoading?: boolean;\n /**\n * Toggle the visibility of the search icon.\n *\n * @default true\n */\n showSearchIcon?: boolean;\n} & StyledPropsBlade;\n\n/*\n Mandatory accessibilityLabel prop when label is not provided\n*/\ntype SearchInputPropsWithA11yLabel = {\n /**\n * Label to be shown for the input field\n */\n label?: undefined;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel: string;\n};\n\n/*\n Optional accessibilityLabel prop when label is provided\n*/\ntype SearchInputPropsWithLabel = {\n /**\n * Label to be shown for the input field\n */\n label: string;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel?: string;\n};\n\ntype SearchInputProps = (SearchInputPropsWithA11yLabel | SearchInputPropsWithLabel) &\n SearchInputCommonProps;\n\n// need to do this to tell TS to infer type as SearchInput of React Native and make it believe that `ref.current.clear()` exists\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst isReactNative = (_textInputRef?: any): _textInputRef is TextInputReactNative => {\n return getPlatformType() === 'react-native';\n};\n\nconst _SearchInput: React.ForwardRefRenderFunction<BladeElementRef, SearchInputProps> = (\n {\n label,\n accessibilityLabel,\n labelPosition = 'top',\n placeholder,\n defaultValue,\n name,\n value,\n onChange,\n onClick,\n onFocus,\n onBlur,\n onSubmit,\n isDisabled,\n helpText,\n onClearButtonClick,\n isLoading,\n autoCapitalize,\n autoFocus,\n testID,\n size = 'medium',\n showSearchIcon = true,\n ...rest\n },\n ref,\n): ReactElement => {\n const textInputRef = React.useRef<BladeElementRefWithValue>(null);\n const mergedRef = useMergeRefs(ref, textInputRef);\n const [shouldShowClearButton, setShouldShowClearButton] = useState(false);\n const {\n triggererWrapperRef,\n onTriggerKeydown,\n onTriggerClick,\n dropdownTriggerer,\n } = useDropdown();\n const isInsideDropdown = dropdownTriggerer === 'SearchInput';\n\n React.useEffect(() => {\n setShouldShowClearButton(Boolean(defaultValue ?? value));\n }, [defaultValue, value]);\n\n const renderInteractionElement = (): ReactNode => {\n if (isLoading) {\n return <Spinner accessibilityLabel=\"Loading Content\" color=\"primary\" />;\n }\n\n if (shouldShowClearButton) {\n return (\n <IconButton\n size=\"medium\"\n icon={CloseIcon}\n onClick={() => {\n if (isEmpty(value) && textInputRef.current) {\n // when the input field is uncontrolled take the ref and clear the input and then call the onClearButtonClick function\n if (isReactNative(textInputRef.current)) {\n textInputRef.current.clear();\n textInputRef.current.focus();\n } else if (textInputRef.current instanceof HTMLInputElement) {\n textInputRef.current.value = '';\n textInputRef.current.focus();\n }\n }\n\n // if the input field is controlled just call the click handler and the value change shall be left upto the consumer\n onClearButtonClick?.();\n textInputRef?.current?.focus();\n setShouldShowClearButton(false);\n }}\n isDisabled={isDisabled}\n accessibilityLabel=\"Clear Input Content\"\n />\n );\n }\n\n return null;\n };\n\n return (\n <BaseBox position=\"relative\">\n <BaseInput\n id=\"searchinput\"\n componentName={MetaConstants.SearchInput}\n ref={mergedRef}\n isDropdownTrigger={true}\n setInputWrapperRef={\n isInsideDropdown\n ? (wrapperNode) => {\n triggererWrapperRef.current = wrapperNode;\n }\n : undefined\n }\n label={label as string}\n accessibilityLabel={accessibilityLabel}\n hideLabelText={!Boolean(label)}\n labelPosition={labelPosition}\n placeholder={placeholder}\n defaultValue={defaultValue}\n value={value}\n name={name}\n onKeyDown={isInsideDropdown ? onTriggerKeydown : undefined}\n onChange={({ name, value }) => {\n if (value?.length) {\n // show the clear button when the user starts typing in\n setShouldShowClearButton(true);\n }\n\n if (shouldShowClearButton && !value?.length) {\n // hide the clear button when the input field is empty\n setShouldShowClearButton(false);\n }\n\n onChange?.({ name, value });\n }}\n onClick={(e) => {\n if (isDisabled) return;\n if (isInsideDropdown) {\n onTriggerClick();\n }\n onClick?.(e);\n }}\n onFocus={onFocus}\n onBlur={onBlur}\n onSubmit={onSubmit}\n isDisabled={isDisabled}\n leadingIcon={showSearchIcon ? SearchIcon : undefined}\n trailingInteractionElement={renderInteractionElement()}\n helpText={helpText}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n testID={testID}\n {...getKeyboardAndAutocompleteProps({\n type: 'search',\n autoCapitalize,\n })}\n size={size}\n {...rest}\n />\n </BaseBox>\n );\n};\n\nconst SearchInput = assignWithoutSideEffects(React.forwardRef(_SearchInput), {\n displayName: 'SearchInput',\n componentId: dropdownComponentIds.triggers.SearchInput,\n});\n\nexport type { SearchInputProps };\nexport { SearchInput };\n"],"names":["isReactNative","_textInputRef","getPlatformType","_SearchInput","_ref","ref","label","accessibilityLabel","_ref$labelPosition","labelPosition","placeholder","defaultValue","name","value","onChange","onClick","onFocus","onBlur","onSubmit","isDisabled","helpText","onClearButtonClick","isLoading","autoCapitalize","autoFocus","testID","_ref$size","size","_ref$showSearchIcon","showSearchIcon","rest","_objectWithoutProperties","_excluded","textInputRef","React","useRef","mergedRef","useMergeRefs","_useState","useState","_useState2","_slicedToArray","shouldShowClearButton","setShouldShowClearButton","_useDropdown","useDropdown","triggererWrapperRef","onTriggerKeydown","onTriggerClick","dropdownTriggerer","isInsideDropdown","useEffect","Boolean","renderInteractionElement","_jsx","Spinner","color","IconButton","icon","CloseIcon","_textInputRef$current","isEmpty","current","clear","focus","HTMLInputElement","BaseBox","position","children","BaseInput","Object","assign","id","componentName","MetaConstants","SearchInput","isDropdownTrigger","setInputWrapperRef","wrapperNode","undefined","hideLabelText","onKeyDown","_ref2","length","e","leadingIcon","SearchIcon","trailingInteractionElement","getKeyboardAndAutocompleteProps","type","assignWithoutSideEffects","forwardRef","displayName","componentId","dropdownComponentIds","triggers"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mRAgGA,IAAMA,aAAa,CAAG,SAAhBA,aAAaA,CAAIC,aAAmB,CAA4C,CACpF,OAAOC,eAAe,EAAE,GAAK,cAAc,CAC7C,CAAC,CAED,IAAMC,YAA+E,CAAG,SAAlFA,YAA+EA,CAAAC,IAAA,CAyBnFC,GAAG,CACc,CAxBf,IAAAC,KAAK,CAAAF,IAAA,CAALE,KAAK,CACLC,kBAAkB,CAAAH,IAAA,CAAlBG,kBAAkB,CAAAC,kBAAA,CAAAJ,IAAA,CAClBK,aAAa,CAAbA,aAAa,CAAAD,kBAAA,GAAA,KAAA,CAAA,CAAG,KAAK,CAAAA,kBAAA,CACrBE,W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ideEffects } from '../../../utils/assignWithoutSideEffect
26
26
  import { useMergeRefs } from '../../../utils/useMergeRefs.js';
27
27
  import { hintMarginTop } from '../../Form/formTokens.js';
28
28
 
29
- var _excluded=["label","accessibilityLabel","labelPosition","necessityIndicator","errorText","helpText","successText","validationState","defaultValue","isDisabled","isRequired","name","onChange","onFocus","onBlur","onSubmit","placeholder","value","maxCharacters","showClearButton","onClearButtonClick","autoFocus","numberOfLines","testID","size","isTaggedInput","tags","onTagChange"];var isReactNative=function isReactNative(_textInputRef){return getPlatformType()==='react-native';};var _TextArea=function _TextArea(_ref,ref){var label=_ref.label,accessibilityLabel=_ref.accessibilityLabel,labelPosition=_ref.labelPosition,necessityIndicator=_ref.necessityIndicator,errorText=_ref.errorText,helpText=_ref.helpText,successText=_ref.successText,validationState=_ref.validationState,defaultValue=_ref.defaultValue,isDisabled=_ref.isDisabled,isRequired=_ref.isRequired,name=_ref.name,_onChange=_ref.onChange,_onFocus=_ref.onFocus,_onBlur=_ref.onBlur,onSubmit=_ref.onSubmit,placeholder=_ref.placeholder,value=_ref.value,maxCharacters=_ref.maxCharacters,showClearButton=_ref.showClearButton,onClearButtonClick=_ref.onClearButtonClick,autoFocus=_ref.autoFocus,_ref$numberOfLines=_ref.numberOfLines,numberOfLines=_ref$numberOfLines===void 0?2:_ref$numberOfLines,testID=_ref.testID,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,isTaggedInput=_ref.isTaggedInput,tags=_ref.tags,onTagChange=_ref.onTagChange,styledProps=_objectWithoutProperties(_ref,_excluded);var inputRef=React__default.useRef(null);var mergedRef=useMergeRefs(ref,inputRef);var _React$useState=React__default.useState(autoFocus!=null?autoFocus:false),_React$useState2=_slicedToArray(_React$useState,2),isInputFocussed=_React$useState2[0],setIsInputFocussed=_React$useState2[1];var _useTaggedInput=useTaggedInput({tags:tags,onTagChange:onTagChange,isDisabled:isDisabled,inputRef:inputRef,isTaggedInput:isTaggedInput,name:name,value:value,onChange:_onChange}),activeTagIndex=_useTaggedInput.activeTagIndex,setActiveTagIndex=_useTaggedInput.setActiveTagIndex,getTags=_useTaggedInput.getTags,handleTaggedInputKeydown=_useTaggedInput.handleTaggedInputKeydown,handleTaggedInputChange=_useTaggedInput.handleTaggedInputChange,handleTagsClear=_useTaggedInput.handleTagsClear;var _React$useState3=React__default.useState(false),_React$useState4=_slicedToArray(_React$useState3,2),shouldShowClearButton=_React$useState4[0],setShouldShowClearButton=_React$useState4[1];React__default.useEffect(function(){setShouldShowClearButton(Boolean(showClearButton&&((value==null?void 0:value.length)||(defaultValue==null?void 0:defaultValue.length))));},[showClearButton,defaultValue,value]);var renderInteractionElement=function renderInteractionElement(){if(shouldShowClearButton){return jsx(BaseBox,{paddingTop:"spacing.3",marginTop:"spacing.1",children:jsx(IconButton,{icon:CloseIcon,accessibilityLabel:"Clear textarea content",onClick:function onClick(){var _inputRef$current;if(isEmpty(value)&&inputRef.current){if(isReactNative(inputRef.current)){inputRef.current.clear();inputRef.current.focus();}else if(inputRef.current instanceof HTMLTextAreaElement){inputRef.current.value='';inputRef.current.focus();}}handleTagsClear();onClearButtonClick==null?void 0:onClearButtonClick();inputRef==null?void 0:(_inputRef$current=inputRef.current)==null?void 0:_inputRef$current.focus();setShouldShowClearButton(false);}})});}return null;};return jsx(BaseInput,Object.assign({as:"textarea",id:"textarea",maxTagRows:"multiple",componentName:MetaConstants.TextArea,autoFocus:autoFocus,ref:mergedRef,label:label,tags:isTaggedInput?getTags({size:size}):undefined,activeTagIndex:activeTagIndex,setActiveTagIndex:setActiveTagIndex,isDropdownTrigger:isTaggedInput,showAllTags:isInputFocussed,accessibilityLabel:accessibilityLabel,hideLabelText:!Boolean(label),labelPosition:labelPosition,necessityIndicator:necessityIndicator,errorText:errorText,helpText:helpText,successText:successText,validationState:validationState,isDisabled:isDisabled,isRequired:isRequired,name:name,maxCharacters:maxCharacters,placeholder:placeholder,trailingInteractionElement:renderInteractionElement(),defaultValue:defaultValue,value:value,numberOfLines:numberOfLines,onChange:function onChange(_ref2){var name=_ref2.name,value=_ref2.value;if(showClearButton&&value!=null&&value.length){setShouldShowClearButton(true);}if(shouldShowClearButton&&!(value!=null&&value.length)){setShouldShowClearButton(false);}handleTaggedInputChange({name:name,value:value});_onChange==null?void 0:_onChange({name:name,value:value});},onFocus:function onFocus(e){setIsInputFocussed(true);_onFocus==null?void 0:_onFocus(e);},onBlur:function onBlur(e){setIsInputFocussed(false);_onBlur==null?void 0:_onBlur(e);},onKeyDown:function onKeyDown(e){handleTaggedInputKeydown(e);},onSubmit:onSubmit,trailingFooterSlot:function trailingFooterSlot(value){var _value$length;return maxCharacters?jsx(BaseBox,{marginTop:hintMarginTop[size],marginRight:"spacing.1",children:jsx(CharacterCounter,{currentCount:(_value$length=value==null?void 0:value.length)!=null?_value$length:0,maxCount:maxCharacters})}):null;},testID:testID,size:size},styledProps));};var TextArea=assignWithoutSideEffects(React__default.forwardRef(_TextArea),{displayName:'TextArea'});
29
+ var _excluded=["label","accessibilityLabel","labelPosition","necessityIndicator","errorText","helpText","successText","validationState","defaultValue","isDisabled","isRequired","name","onChange","onFocus","onBlur","onSubmit","placeholder","value","maxCharacters","showClearButton","onClearButtonClick","autoFocus","numberOfLines","testID","size","isTaggedInput","tags","onTagChange"];var isReactNative=function isReactNative(_textInputRef){return getPlatformType()==='react-native';};var _TextArea=function _TextArea(_ref,ref){var label=_ref.label,accessibilityLabel=_ref.accessibilityLabel,labelPosition=_ref.labelPosition,necessityIndicator=_ref.necessityIndicator,errorText=_ref.errorText,helpText=_ref.helpText,successText=_ref.successText,validationState=_ref.validationState,defaultValue=_ref.defaultValue,isDisabled=_ref.isDisabled,isRequired=_ref.isRequired,name=_ref.name,_onChange=_ref.onChange,_onFocus=_ref.onFocus,_onBlur=_ref.onBlur,onSubmit=_ref.onSubmit,placeholder=_ref.placeholder,value=_ref.value,maxCharacters=_ref.maxCharacters,showClearButton=_ref.showClearButton,onClearButtonClick=_ref.onClearButtonClick,autoFocus=_ref.autoFocus,_ref$numberOfLines=_ref.numberOfLines,numberOfLines=_ref$numberOfLines===void 0?2:_ref$numberOfLines,testID=_ref.testID,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,isTaggedInput=_ref.isTaggedInput,tags=_ref.tags,onTagChange=_ref.onTagChange,rest=_objectWithoutProperties(_ref,_excluded);var inputRef=React__default.useRef(null);var mergedRef=useMergeRefs(ref,inputRef);var _React$useState=React__default.useState(autoFocus!=null?autoFocus:false),_React$useState2=_slicedToArray(_React$useState,2),isInputFocussed=_React$useState2[0],setIsInputFocussed=_React$useState2[1];var _useTaggedInput=useTaggedInput({tags:tags,onTagChange:onTagChange,isDisabled:isDisabled,inputRef:inputRef,isTaggedInput:isTaggedInput,name:name,value:value,onChange:_onChange}),activeTagIndex=_useTaggedInput.activeTagIndex,setActiveTagIndex=_useTaggedInput.setActiveTagIndex,getTags=_useTaggedInput.getTags,handleTaggedInputKeydown=_useTaggedInput.handleTaggedInputKeydown,handleTaggedInputChange=_useTaggedInput.handleTaggedInputChange,handleTagsClear=_useTaggedInput.handleTagsClear;var _React$useState3=React__default.useState(false),_React$useState4=_slicedToArray(_React$useState3,2),shouldShowClearButton=_React$useState4[0],setShouldShowClearButton=_React$useState4[1];React__default.useEffect(function(){setShouldShowClearButton(Boolean(showClearButton&&((value==null?void 0:value.length)||(defaultValue==null?void 0:defaultValue.length))));},[showClearButton,defaultValue,value]);var renderInteractionElement=function renderInteractionElement(){if(shouldShowClearButton){return jsx(BaseBox,{paddingTop:"spacing.3",marginTop:"spacing.1",children:jsx(IconButton,{icon:CloseIcon,accessibilityLabel:"Clear textarea content",onClick:function onClick(){var _inputRef$current;if(isEmpty(value)&&inputRef.current){if(isReactNative(inputRef.current)){inputRef.current.clear();inputRef.current.focus();}else if(inputRef.current instanceof HTMLTextAreaElement){inputRef.current.value='';inputRef.current.focus();}}handleTagsClear();onClearButtonClick==null?void 0:onClearButtonClick();inputRef==null?void 0:(_inputRef$current=inputRef.current)==null?void 0:_inputRef$current.focus();setShouldShowClearButton(false);}})});}return null;};return jsx(BaseInput,Object.assign({as:"textarea",id:"textarea",maxTagRows:"multiple",componentName:MetaConstants.TextArea,autoFocus:autoFocus,ref:mergedRef,label:label,tags:isTaggedInput?getTags({size:size}):undefined,activeTagIndex:activeTagIndex,setActiveTagIndex:setActiveTagIndex,isDropdownTrigger:isTaggedInput,showAllTags:isInputFocussed,accessibilityLabel:accessibilityLabel,hideLabelText:!Boolean(label),labelPosition:labelPosition,necessityIndicator:necessityIndicator,errorText:errorText,helpText:helpText,successText:successText,validationState:validationState,isDisabled:isDisabled,isRequired:isRequired,name:name,maxCharacters:maxCharacters,placeholder:placeholder,trailingInteractionElement:renderInteractionElement(),defaultValue:defaultValue,value:value,numberOfLines:numberOfLines,onChange:function onChange(_ref2){var name=_ref2.name,value=_ref2.value;if(showClearButton&&value!=null&&value.length){setShouldShowClearButton(true);}if(shouldShowClearButton&&!(value!=null&&value.length)){setShouldShowClearButton(false);}handleTaggedInputChange({name:name,value:value});_onChange==null?void 0:_onChange({name:name,value:value});},onFocus:function onFocus(e){setIsInputFocussed(true);_onFocus==null?void 0:_onFocus(e);},onBlur:function onBlur(e){setIsInputFocussed(false);_onBlur==null?void 0:_onBlur(e);},onKeyDown:function onKeyDown(e){handleTaggedInputKeydown(e);},onSubmit:onSubmit,trailingFooterSlot:function trailingFooterSlot(value){var _value$length;return maxCharacters?jsx(BaseBox,{marginTop:hintMarginTop[size],marginRight:"spacing.1",children:jsx(CharacterCounter,{currentCount:(_value$length=value==null?void 0:value.length)!=null?_value$length:0,maxCount:maxCharacters})}):null;},testID:testID,size:size},rest));};var TextArea=assignWithoutSideEffects(React__default.forwardRef(_TextArea),{displayName:'TextArea'});
30
30
 
31
31
  export { TextArea };
32
32
  //# sourceMappingURL=TextArea.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TextArea.js","sources":["../../../../../../src/components/Input/TextArea/TextArea.tsx"],"sourcesContent":["/* eslint-disable jsx-a11y/no-autofocus */\nimport React from 'react';\nimport type { TextInput as TextInputReactNative } from 'react-native';\nimport type { BaseInputProps } from '../BaseInput';\nimport { BaseInput } from '../BaseInput';\nimport type { TaggedInputProps } from '../BaseInput/useTaggedInput';\nimport { useTaggedInput } from '../BaseInput/useTaggedInput';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport { CloseIcon } from '~components/Icons';\nimport { IconButton } from '~components/Button/IconButton';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { MetaConstants } from '~utils/metaAttribute';\nimport { CharacterCounter } from '~components/Form/CharacterCounter';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getPlatformType } from '~utils';\nimport { useMergeRefs } from '~utils/useMergeRefs';\nimport type { BladeElementRef, BladeElementRefWithValue } from '~utils/types';\nimport { hintMarginTop } from '~components/Form/formTokens';\n\ntype TextAreaCommonProps = Pick<\n BaseInputProps,\n | 'label'\n | 'accessibilityLabel'\n | 'labelPosition'\n | 'necessityIndicator'\n | 'validationState'\n | 'helpText'\n | 'errorText'\n | 'successText'\n | 'placeholder'\n | 'defaultValue'\n | 'name'\n | 'onChange'\n | 'onFocus'\n | 'onBlur'\n | 'onSubmit'\n | 'value'\n | 'isDisabled'\n | 'isRequired'\n | 'maxCharacters'\n | 'autoFocus'\n | 'numberOfLines'\n | 'testID'\n | 'size'\n> & {\n /**\n * Decides whether to render a clear icon button\n */\n showClearButton?: boolean;\n /**\n * Event handler to handle the onClick event for clear button. Used when `showClearButton` is `true`\n */\n onClearButtonClick?: () => void;\n} & TaggedInputProps &\n StyledPropsBlade;\n\n/*\n Mandatory accessibilityLabel prop when label is not provided\n*/\ntype TextAreaPropsWithA11yLabel = {\n /**\n * Label to be shown for the input field\n */\n label?: undefined;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel: string;\n};\n\n/*\n Optional accessibilityLabel prop when label is provided\n*/\ntype TextAreaPropsWithLabel = {\n /**\n * Label to be shown for the input field\n */\n label: string;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel?: string;\n};\n\ntype TextAreaProps = (TextAreaPropsWithA11yLabel | TextAreaPropsWithLabel) & TextAreaCommonProps;\n\n// need to do this to tell TS to infer type as TextInput of React Native and make it believe that `ref.current.clear()` exists\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst isReactNative = (_textInputRef: any): _textInputRef is TextInputReactNative => {\n return getPlatformType() === 'react-native';\n};\n\nconst _TextArea: React.ForwardRefRenderFunction<BladeElementRef, TextAreaProps> = (\n {\n label,\n accessibilityLabel,\n labelPosition,\n necessityIndicator,\n errorText,\n helpText,\n successText,\n validationState,\n defaultValue,\n isDisabled,\n isRequired,\n name,\n onChange,\n onFocus,\n onBlur,\n onSubmit,\n placeholder,\n value,\n maxCharacters,\n showClearButton,\n onClearButtonClick,\n autoFocus,\n numberOfLines = 2,\n testID,\n size = 'medium',\n isTaggedInput,\n tags,\n onTagChange,\n ...styledProps\n },\n ref,\n) => {\n const inputRef = React.useRef<BladeElementRefWithValue>(null);\n const mergedRef = useMergeRefs(ref, inputRef);\n const [isInputFocussed, setIsInputFocussed] = React.useState(autoFocus ?? false);\n const {\n activeTagIndex,\n setActiveTagIndex,\n getTags,\n handleTaggedInputKeydown,\n handleTaggedInputChange,\n handleTagsClear,\n } = useTaggedInput({\n tags,\n onTagChange,\n isDisabled,\n inputRef,\n isTaggedInput,\n name,\n value,\n onChange,\n });\n\n const [shouldShowClearButton, setShouldShowClearButton] = React.useState(false);\n\n React.useEffect(() => {\n setShouldShowClearButton(Boolean(showClearButton && (value?.length || defaultValue?.length)));\n }, [showClearButton, defaultValue, value]);\n\n const renderInteractionElement = (): React.ReactNode => {\n if (shouldShowClearButton) {\n return (\n <BaseBox paddingTop=\"spacing.3\" marginTop=\"spacing.1\">\n <IconButton\n icon={CloseIcon}\n accessibilityLabel=\"Clear textarea content\"\n onClick={() => {\n if (isEmpty(value) && inputRef.current) {\n // when the input field is uncontrolled take the ref and clear the input and then call the onClearButtonClick function\n if (isReactNative(inputRef.current)) {\n inputRef.current.clear();\n inputRef.current.focus();\n } else if (inputRef.current instanceof HTMLTextAreaElement) {\n inputRef.current.value = '';\n inputRef.current.focus();\n }\n }\n handleTagsClear();\n // if the input field is controlled just call the click handler and the value change shall be left upto the consumer\n onClearButtonClick?.();\n inputRef?.current?.focus();\n setShouldShowClearButton(false);\n }}\n />\n </BaseBox>\n );\n }\n\n return null;\n };\n\n return (\n <BaseInput\n as=\"textarea\"\n id=\"textarea\"\n maxTagRows=\"multiple\"\n componentName={MetaConstants.TextArea}\n autoFocus={autoFocus}\n ref={mergedRef}\n label={label as string}\n tags={isTaggedInput ? getTags({ size }) : undefined}\n activeTagIndex={activeTagIndex}\n setActiveTagIndex={setActiveTagIndex}\n isDropdownTrigger={isTaggedInput}\n showAllTags={isInputFocussed}\n accessibilityLabel={accessibilityLabel}\n hideLabelText={!Boolean(label)}\n labelPosition={labelPosition}\n necessityIndicator={necessityIndicator}\n errorText={errorText}\n helpText={helpText}\n successText={successText}\n validationState={validationState}\n isDisabled={isDisabled}\n isRequired={isRequired}\n name={name}\n maxCharacters={maxCharacters}\n placeholder={placeholder}\n trailingInteractionElement={renderInteractionElement()}\n defaultValue={defaultValue}\n value={value}\n numberOfLines={numberOfLines}\n onChange={({ name, value }) => {\n if (showClearButton && value?.length) {\n // show the clear button when the user starts typing in\n setShouldShowClearButton(true);\n }\n\n if (shouldShowClearButton && !value?.length) {\n // hide the clear button when the input field is empty\n setShouldShowClearButton(false);\n }\n\n handleTaggedInputChange({ name, value });\n onChange?.({ name, value });\n }}\n onFocus={(e) => {\n setIsInputFocussed(true);\n onFocus?.(e);\n }}\n onBlur={(e) => {\n setIsInputFocussed(false);\n onBlur?.(e);\n }}\n onKeyDown={(e) => {\n handleTaggedInputKeydown(e);\n }}\n onSubmit={onSubmit}\n trailingFooterSlot={(value) => {\n return maxCharacters ? (\n <BaseBox marginTop={hintMarginTop[size]} marginRight=\"spacing.1\">\n <CharacterCounter currentCount={value?.length ?? 0} maxCount={maxCharacters} />\n </BaseBox>\n ) : null;\n }}\n testID={testID}\n size={size}\n {...styledProps}\n />\n );\n};\n\nconst TextArea = assignWithoutSideEffects(React.forwardRef(_TextArea), {\n displayName: 'TextArea',\n});\n\nexport type { TextAreaProps };\nexport { TextArea };\n"],"names":["isReactNative","_textInputRef","getPlatformType","_TextArea","_ref","ref","label","accessibilityLabel","labelPosition","necessityIndicator","errorText","helpText","successText","validationState","defaultValue","isDisabled","isRequired","name","onChange","onFocus","onBlur","onSubmit","placeholder","value","maxCharacters","showClearButton","onClearButtonClick","autoFocus","_ref$numberOfLines","numberOfLines","testID","_ref$size","size","isTaggedInput","tags","onTagChange","styledProps","_objectWithoutProperties","_excluded","inputRef","React","useRef","mergedRef","useMergeRefs","_React$useState","useState","_React$useState2","_slicedToArray","isInputFocussed","setIsInputFocussed","_useTaggedInput","useTaggedInput","activeTagIndex","setActiveTagIndex","getTags","handleTaggedInputKeydown","handleTaggedInputChange","handleTagsClear","_React$useState3","_React$useState4","shouldShowClearButton","setShouldShowClearButton","useEffect","Boolean","length","renderInteractionElement","_jsx","BaseBox","paddingTop","marginTop","children","IconButton","icon","CloseIcon","onClick","_inputRef$current","isEmpty","current","clear","focus","HTMLTextAreaElement","BaseInput","Object","assign","as","id","maxTagRows","componentName","MetaConstants","TextArea","undefined","isDropdownTrigger","showAllTags","hideLabelText","trailingInteractionElement","_ref2","e","onKeyDown","trailingFooterSlot","_value$length","hintMarginTop","marginRight","CharacterCounter","currentCount","maxCount","assignWithoutSideEffects","forwardRef","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;gYAyFA,IAAMA,aAAa,CAAG,SAAhBA,aAAaA,CAAIC,aAAkB,CAA4C,CACnF,OAAOC,eAAe,EAAE,GAAK,cAAc,CAC7C,CAAC,CAED,IAAMC,SAAyE,CAAG,SAA5EA,SAAyEA,CAAAC,IAAA,CAgC7EC,GAAG,CACA,CA/BD,IAAAC,KAAK,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AAA,SAAS,CAAE+B,aAAa,CAACpE,IAAI,CAAE,CAACqE,WAAW,CAAC,WAAW,CAAA/B,QAAA,CAC9DJ,GAAA,CAACoC,gBAAgB,CAAA,CAACC,YAAY,CAAAJ,CAAAA,aAAA,CAAE5E,KAAK,EAALA,IAAAA,CAAAA,KAAAA,CAAAA,CAAAA,KAAK,CAAEyC,MAAM,GAAAmC,IAAAA,CAAAA,aAAA,CAAI,CAAE,CAACK,QAAQ,CAAEhF,aAAc,CAAE,CAAC,CACxE,CAAC,CACR,IAAI,CACV,CAAE,CACFM,MAAM,CAAEA,MAAO,CACfE,IAAI,CAAEA,IAAK,CACPI,CAAAA,WAAW,CAChB,CAAC,CAEN,CAAC,CAEK,IAAAqD,QAAQ,CAAGgB,wBAAwB,CAACjE,cAAK,CAACkE,UAAU,CAACvG,SAAS,CAAC,CAAE,CACrEwG,WAAW,CAAE,UACf,CAAC;;;;"}
1
+ {"version":3,"file":"TextArea.js","sources":["../../../../../../src/components/Input/TextArea/TextArea.tsx"],"sourcesContent":["/* eslint-disable jsx-a11y/no-autofocus */\nimport React from 'react';\nimport type { TextInput as TextInputReactNative } from 'react-native';\nimport type { BaseInputProps } from '../BaseInput';\nimport { BaseInput } from '../BaseInput';\nimport type { TaggedInputProps } from '../BaseInput/useTaggedInput';\nimport { useTaggedInput } from '../BaseInput/useTaggedInput';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport { CloseIcon } from '~components/Icons';\nimport { IconButton } from '~components/Button/IconButton';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { MetaConstants } from '~utils/metaAttribute';\nimport { CharacterCounter } from '~components/Form/CharacterCounter';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getPlatformType } from '~utils';\nimport { useMergeRefs } from '~utils/useMergeRefs';\nimport type {\n BladeElementRef,\n BladeElementRefWithValue,\n DataAnalyticsAttribute,\n} from '~utils/types';\nimport { hintMarginTop } from '~components/Form/formTokens';\n\ntype TextAreaCommonProps = Pick<\n BaseInputProps,\n | 'label'\n | 'accessibilityLabel'\n | 'labelPosition'\n | 'necessityIndicator'\n | 'validationState'\n | 'helpText'\n | 'errorText'\n | 'successText'\n | 'placeholder'\n | 'defaultValue'\n | 'name'\n | 'onChange'\n | 'onFocus'\n | 'onBlur'\n | 'onSubmit'\n | 'value'\n | 'isDisabled'\n | 'isRequired'\n | 'maxCharacters'\n | 'autoFocus'\n | 'numberOfLines'\n | 'testID'\n | 'size'\n | keyof DataAnalyticsAttribute\n> & {\n /**\n * Decides whether to render a clear icon button\n */\n showClearButton?: boolean;\n /**\n * Event handler to handle the onClick event for clear button. Used when `showClearButton` is `true`\n */\n onClearButtonClick?: () => void;\n} & TaggedInputProps &\n StyledPropsBlade;\n\n/*\n Mandatory accessibilityLabel prop when label is not provided\n*/\ntype TextAreaPropsWithA11yLabel = {\n /**\n * Label to be shown for the input field\n */\n label?: undefined;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel: string;\n};\n\n/*\n Optional accessibilityLabel prop when label is provided\n*/\ntype TextAreaPropsWithLabel = {\n /**\n * Label to be shown for the input field\n */\n label: string;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel?: string;\n};\n\ntype TextAreaProps = (TextAreaPropsWithA11yLabel | TextAreaPropsWithLabel) & TextAreaCommonProps;\n\n// need to do this to tell TS to infer type as TextInput of React Native and make it believe that `ref.current.clear()` exists\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst isReactNative = (_textInputRef: any): _textInputRef is TextInputReactNative => {\n return getPlatformType() === 'react-native';\n};\n\nconst _TextArea: React.ForwardRefRenderFunction<BladeElementRef, TextAreaProps> = (\n {\n label,\n accessibilityLabel,\n labelPosition,\n necessityIndicator,\n errorText,\n helpText,\n successText,\n validationState,\n defaultValue,\n isDisabled,\n isRequired,\n name,\n onChange,\n onFocus,\n onBlur,\n onSubmit,\n placeholder,\n value,\n maxCharacters,\n showClearButton,\n onClearButtonClick,\n autoFocus,\n numberOfLines = 2,\n testID,\n size = 'medium',\n isTaggedInput,\n tags,\n onTagChange,\n ...rest\n },\n ref,\n) => {\n const inputRef = React.useRef<BladeElementRefWithValue>(null);\n const mergedRef = useMergeRefs(ref, inputRef);\n const [isInputFocussed, setIsInputFocussed] = React.useState(autoFocus ?? false);\n const {\n activeTagIndex,\n setActiveTagIndex,\n getTags,\n handleTaggedInputKeydown,\n handleTaggedInputChange,\n handleTagsClear,\n } = useTaggedInput({\n tags,\n onTagChange,\n isDisabled,\n inputRef,\n isTaggedInput,\n name,\n value,\n onChange,\n });\n\n const [shouldShowClearButton, setShouldShowClearButton] = React.useState(false);\n\n React.useEffect(() => {\n setShouldShowClearButton(Boolean(showClearButton && (value?.length || defaultValue?.length)));\n }, [showClearButton, defaultValue, value]);\n\n const renderInteractionElement = (): React.ReactNode => {\n if (shouldShowClearButton) {\n return (\n <BaseBox paddingTop=\"spacing.3\" marginTop=\"spacing.1\">\n <IconButton\n icon={CloseIcon}\n accessibilityLabel=\"Clear textarea content\"\n onClick={() => {\n if (isEmpty(value) && inputRef.current) {\n // when the input field is uncontrolled take the ref and clear the input and then call the onClearButtonClick function\n if (isReactNative(inputRef.current)) {\n inputRef.current.clear();\n inputRef.current.focus();\n } else if (inputRef.current instanceof HTMLTextAreaElement) {\n inputRef.current.value = '';\n inputRef.current.focus();\n }\n }\n handleTagsClear();\n // if the input field is controlled just call the click handler and the value change shall be left upto the consumer\n onClearButtonClick?.();\n inputRef?.current?.focus();\n setShouldShowClearButton(false);\n }}\n />\n </BaseBox>\n );\n }\n\n return null;\n };\n\n return (\n <BaseInput\n as=\"textarea\"\n id=\"textarea\"\n maxTagRows=\"multiple\"\n componentName={MetaConstants.TextArea}\n autoFocus={autoFocus}\n ref={mergedRef}\n label={label as string}\n tags={isTaggedInput ? getTags({ size }) : undefined}\n activeTagIndex={activeTagIndex}\n setActiveTagIndex={setActiveTagIndex}\n isDropdownTrigger={isTaggedInput}\n showAllTags={isInputFocussed}\n accessibilityLabel={accessibilityLabel}\n hideLabelText={!Boolean(label)}\n labelPosition={labelPosition}\n necessityIndicator={necessityIndicator}\n errorText={errorText}\n helpText={helpText}\n successText={successText}\n validationState={validationState}\n isDisabled={isDisabled}\n isRequired={isRequired}\n name={name}\n maxCharacters={maxCharacters}\n placeholder={placeholder}\n trailingInteractionElement={renderInteractionElement()}\n defaultValue={defaultValue}\n value={value}\n numberOfLines={numberOfLines}\n onChange={({ name, value }) => {\n if (showClearButton && value?.length) {\n // show the clear button when the user starts typing in\n setShouldShowClearButton(true);\n }\n\n if (shouldShowClearButton && !value?.length) {\n // hide the clear button when the input field is empty\n setShouldShowClearButton(false);\n }\n\n handleTaggedInputChange({ name, value });\n onChange?.({ name, value });\n }}\n onFocus={(e) => {\n setIsInputFocussed(true);\n onFocus?.(e);\n }}\n onBlur={(e) => {\n setIsInputFocussed(false);\n onBlur?.(e);\n }}\n onKeyDown={(e) => {\n handleTaggedInputKeydown(e);\n }}\n onSubmit={onSubmit}\n trailingFooterSlot={(value) => {\n return maxCharacters ? (\n <BaseBox marginTop={hintMarginTop[size]} marginRight=\"spacing.1\">\n <CharacterCounter currentCount={value?.length ?? 0} maxCount={maxCharacters} />\n </BaseBox>\n ) : null;\n }}\n testID={testID}\n size={size}\n {...rest}\n />\n );\n};\n\nconst TextArea = assignWithoutSideEffects(React.forwardRef(_TextArea), {\n displayName: 'TextArea',\n});\n\nexport type { TextAreaProps };\nexport { TextArea };\n"],"names":["isReactNative","_textInputRef","getPlatformType","_TextArea","_ref","ref","label","accessibilityLabel","labelPosition","necessityIndicator","errorText","helpText","successText","validationState","defaultValue","isDisabled","isRequired","name","onChange","onFocus","onBlur","onSubmit","placeholder","value","maxCharacters","showClearButton","onClearButtonClick","autoFocus","_ref$numberOfLines","numberOfLines","testID","_ref$size","size","isTaggedInput","tags","onTagChange","rest","_objectWithoutProperties","_excluded","inputRef","React","useRef","mergedRef","useMergeRefs","_React$useState","useState","_React$useState2","_slicedToArray","isInputFocussed","setIsInputFocussed","_useTaggedInput","useTaggedInput","activeTagIndex","setActiveTagIndex","getTags","handleTaggedInputKeydown","handleTaggedInputChange","handleTagsClear","_React$useState3","_React$useState4","shouldShowClearButton","setShouldShowClearButton","useEffect","Boolean","length","renderInteractionElement","_jsx","BaseBox","paddingTop","marginTop","children","IconButton","icon","CloseIcon","onClick","_inputRef$current","isEmpty","current","clear","focus","HTMLTextAreaElement","BaseInput","Object","assign","as","id","maxTagRows","componentName","MetaConstants","TextArea","undefined","isDropdownTrigger","showAllTags","hideLabelText","trailingInteractionElement","_ref2","e","onKeyDown","trailingFooterSlot","_value$length","hintMarginTop","marginRight","CharacterCounter","currentCount","maxCount","assignWithoutSideEffects","forwardRef","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;gYA8FA,IAAMA,aAAa,CAAG,SAAhBA,aAAaA,CAAIC,aAAkB,CAA4C,CACnF,OAAOC,eAAe,EAAE,GAAK,cAAc,CAC7C,CAAC,CAED,IAAMC,SAAyE,CAAG,SAA5EA,SAAyEA,CAAAC,IAAA,CAgC7EC,GAAG,CACA,CA/BD,IAAAC,KAAK,CAAAF,IAAA,CAALE,KAAK,CACLC,kBAAkB,CAAAH,IAAA,CAAlBG,kBAAkB,CAClBC,aAAa,CAAAJ,IAAA,CAAbI,aAAa,CACbC,kBAAkB,CAAAL,IAAA,CAAlBK,kBAAkB,CAClBC,SAAS,CAAAN,IAAA,CAATM,SAAS,CACTC,QAAQ,CAAAP,IAAA,CAARO,QAAQ,CACRC,WAAW,CAAAR,IAAA,CAAXQ,WAAW,CACXC,eAAe,CAAAT,IAAA,CAAfS,eAAe,CACfC,YAAY,CAAAV,IAAA,CAAZU,YAAY,CACZC,UAAU,CAAAX,IAAA,CAAVW,UAAU,CACVC,UAAU,CAAAZ,IAAA,CAAVY,UAAU,CACVC,IAAI,CAAAb,IAAA,CAAJa,IAAI,CACJC,SAAQ,CAAAd,IAAA,CAARc,QAAQ,CACRC,QA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,CAAC,CAAE,CACrEwG,WAAW,CAAE,UACf,CAAC;;;;"}
@@ -28,7 +28,7 @@ import { assignWithoutSideEffects } from '../../../utils/assignWithoutSideEffect
28
28
  import { useMergeRefs } from '../../../utils/useMergeRefs.js';
29
29
  import { hintMarginTop } from '../../Form/formTokens.js';
30
30
 
31
- var _excluded=["label","accessibilityLabel","labelPosition","placeholder","type","defaultValue","name","value","maxCharacters","onChange","onClick","onFocus","onBlur","onSubmit","isDisabled","necessityIndicator","validationState","errorText","helpText","successText","isRequired","icon","prefix","showClearButton","onClearButtonClick","isLoading","suffix","autoFocus","keyboardReturnKeyType","autoCompleteSuggestionType","autoCapitalize","testID","size","leadingIcon","trailingIcon","isTaggedInput","tags","onTagChange"];var isReactNative=function isReactNative(_textInputRef){return getPlatformType()==='react-native';};var _TextInput=function _TextInput(_ref,ref){var label=_ref.label,accessibilityLabel=_ref.accessibilityLabel,_ref$labelPosition=_ref.labelPosition,labelPosition=_ref$labelPosition===void 0?'top':_ref$labelPosition,placeholder=_ref.placeholder,_ref$type=_ref.type,type=_ref$type===void 0?'text':_ref$type,defaultValue=_ref.defaultValue,name=_ref.name,value=_ref.value,maxCharacters=_ref.maxCharacters,_onChange=_ref.onChange,onClick=_ref.onClick,_onFocus=_ref.onFocus,_onBlur=_ref.onBlur,onSubmit=_ref.onSubmit,isDisabled=_ref.isDisabled,necessityIndicator=_ref.necessityIndicator,validationState=_ref.validationState,errorText=_ref.errorText,helpText=_ref.helpText,successText=_ref.successText,isRequired=_ref.isRequired,icon=_ref.icon,prefix=_ref.prefix,showClearButton=_ref.showClearButton,onClearButtonClick=_ref.onClearButtonClick,isLoading=_ref.isLoading,suffix=_ref.suffix,autoFocus=_ref.autoFocus,keyboardReturnKeyType=_ref.keyboardReturnKeyType,autoCompleteSuggestionType=_ref.autoCompleteSuggestionType,autoCapitalize=_ref.autoCapitalize,testID=_ref.testID,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,leadingIcon=_ref.leadingIcon,trailingIcon=_ref.trailingIcon,isTaggedInput=_ref.isTaggedInput,tags=_ref.tags,onTagChange=_ref.onTagChange,styledProps=_objectWithoutProperties(_ref,_excluded);var textInputRef=React__default.useRef(null);var mergedRef=useMergeRefs(ref,textInputRef);var _useState=useState(false),_useState2=_slicedToArray(_useState,2),shouldShowClearButton=_useState2[0],setShouldShowClearButton=_useState2[1];var _useState3=useState(autoFocus!=null?autoFocus:false),_useState4=_slicedToArray(_useState3,2),isInputFocussed=_useState4[0],setIsInputFocussed=_useState4[1];var _useTaggedInput=useTaggedInput({isTaggedInput:isTaggedInput,tags:tags,onTagChange:onTagChange,isDisabled:isDisabled,onChange:_onChange,name:name,value:value,inputRef:textInputRef}),activeTagIndex=_useTaggedInput.activeTagIndex,setActiveTagIndex=_useTaggedInput.setActiveTagIndex,getTags=_useTaggedInput.getTags,handleTaggedInputKeydown=_useTaggedInput.handleTaggedInputKeydown,handleTaggedInputChange=_useTaggedInput.handleTaggedInputChange,handleTagsClear=_useTaggedInput.handleTagsClear;React__default.useEffect(function(){setShouldShowClearButton(Boolean(showClearButton&&(defaultValue!=null?defaultValue:value)));},[showClearButton,defaultValue,value]);var renderInteractionElement=function renderInteractionElement(){if(isLoading){return jsx(Spinner,{accessibilityLabel:"Loading Content",color:"primary"});}if(shouldShowClearButton){return jsx(IconButton,{size:"medium",icon:CloseIcon,onClick:function onClick(){var _textInputRef$current;if(isEmpty(value)&&textInputRef.current){if(isReactNative(textInputRef.current)){textInputRef.current.clear();textInputRef.current.focus();}else if(textInputRef.current instanceof HTMLInputElement){textInputRef.current.value='';textInputRef.current.focus();}}handleTagsClear();onClearButtonClick==null?void 0:onClearButtonClick();textInputRef==null?void 0:(_textInputRef$current=textInputRef.current)==null?void 0:_textInputRef$current.focus();setShouldShowClearButton(false);},isDisabled:isDisabled,accessibilityLabel:"Clear Input Content"});}return null;};return jsx(BaseInput,Object.assign({id:"textinput",componentName:MetaConstants.TextInput,ref:mergedRef,label:label,accessibilityLabel:accessibilityLabel,hideLabelText:!Boolean(label),labelPosition:labelPosition,placeholder:placeholder,defaultValue:defaultValue,value:value,name:name,maxCharacters:maxCharacters,isDropdownTrigger:isTaggedInput,tags:isTaggedInput?getTags({size:size}):undefined,showAllTags:isInputFocussed,maxTagRows:"single",activeTagIndex:activeTagIndex,setActiveTagIndex:setActiveTagIndex,onChange:function onChange(_ref2){var name=_ref2.name,value=_ref2.value;if(showClearButton&&value!=null&&value.length){setShouldShowClearButton(true);}if(shouldShowClearButton&&!(value!=null&&value.length)){setShouldShowClearButton(false);}handleTaggedInputChange({name:name,value:value});_onChange==null?void 0:_onChange({name:name,value:value});},onClick:onClick,onFocus:function onFocus(e){setIsInputFocussed(true);_onFocus==null?void 0:_onFocus(e);},onBlur:function onBlur(e){setIsInputFocussed(false);_onBlur==null?void 0:_onBlur(e);},onKeyDown:function onKeyDown(e){handleTaggedInputKeydown(e);},onSubmit:onSubmit,isDisabled:isDisabled,necessityIndicator:necessityIndicator,isRequired:isRequired,leadingIcon:leadingIcon!=null?leadingIcon:icon,prefix:prefix,trailingInteractionElement:renderInteractionElement(),trailingIcon:trailingIcon,suffix:suffix,validationState:validationState,errorText:errorText,helpText:helpText,successText:successText,trailingFooterSlot:function trailingFooterSlot(value){var _value$length;return maxCharacters?jsx(BaseBox,{marginTop:hintMarginTop[size],marginRight:"spacing.1",children:jsx(CharacterCounter,{currentCount:(_value$length=value==null?void 0:value.length)!=null?_value$length:0,maxCount:maxCharacters,size:size})}):null;},autoFocus:autoFocus,testID:testID},getKeyboardAndAutocompleteProps({type:type,keyboardReturnKeyType:keyboardReturnKeyType,autoCompleteSuggestionType:autoCompleteSuggestionType,autoCapitalize:autoCapitalize}),{size:size},styledProps));};var TextInput=assignWithoutSideEffects(React__default.forwardRef(_TextInput),{displayName:'TextInput'});
31
+ var _excluded=["label","accessibilityLabel","labelPosition","placeholder","type","defaultValue","name","value","maxCharacters","onChange","onClick","onFocus","onBlur","onSubmit","isDisabled","necessityIndicator","validationState","errorText","helpText","successText","isRequired","icon","prefix","showClearButton","onClearButtonClick","isLoading","suffix","autoFocus","keyboardReturnKeyType","autoCompleteSuggestionType","autoCapitalize","testID","size","leadingIcon","trailingIcon","isTaggedInput","tags","onTagChange"];var isReactNative=function isReactNative(_textInputRef){return getPlatformType()==='react-native';};var _TextInput=function _TextInput(_ref,ref){var label=_ref.label,accessibilityLabel=_ref.accessibilityLabel,_ref$labelPosition=_ref.labelPosition,labelPosition=_ref$labelPosition===void 0?'top':_ref$labelPosition,placeholder=_ref.placeholder,_ref$type=_ref.type,type=_ref$type===void 0?'text':_ref$type,defaultValue=_ref.defaultValue,name=_ref.name,value=_ref.value,maxCharacters=_ref.maxCharacters,_onChange=_ref.onChange,onClick=_ref.onClick,_onFocus=_ref.onFocus,_onBlur=_ref.onBlur,onSubmit=_ref.onSubmit,isDisabled=_ref.isDisabled,necessityIndicator=_ref.necessityIndicator,validationState=_ref.validationState,errorText=_ref.errorText,helpText=_ref.helpText,successText=_ref.successText,isRequired=_ref.isRequired,icon=_ref.icon,prefix=_ref.prefix,showClearButton=_ref.showClearButton,onClearButtonClick=_ref.onClearButtonClick,isLoading=_ref.isLoading,suffix=_ref.suffix,autoFocus=_ref.autoFocus,keyboardReturnKeyType=_ref.keyboardReturnKeyType,autoCompleteSuggestionType=_ref.autoCompleteSuggestionType,autoCapitalize=_ref.autoCapitalize,testID=_ref.testID,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,leadingIcon=_ref.leadingIcon,trailingIcon=_ref.trailingIcon,isTaggedInput=_ref.isTaggedInput,tags=_ref.tags,onTagChange=_ref.onTagChange,rest=_objectWithoutProperties(_ref,_excluded);var textInputRef=React__default.useRef(null);var mergedRef=useMergeRefs(ref,textInputRef);var _useState=useState(false),_useState2=_slicedToArray(_useState,2),shouldShowClearButton=_useState2[0],setShouldShowClearButton=_useState2[1];var _useState3=useState(autoFocus!=null?autoFocus:false),_useState4=_slicedToArray(_useState3,2),isInputFocussed=_useState4[0],setIsInputFocussed=_useState4[1];var _useTaggedInput=useTaggedInput({isTaggedInput:isTaggedInput,tags:tags,onTagChange:onTagChange,isDisabled:isDisabled,onChange:_onChange,name:name,value:value,inputRef:textInputRef}),activeTagIndex=_useTaggedInput.activeTagIndex,setActiveTagIndex=_useTaggedInput.setActiveTagIndex,getTags=_useTaggedInput.getTags,handleTaggedInputKeydown=_useTaggedInput.handleTaggedInputKeydown,handleTaggedInputChange=_useTaggedInput.handleTaggedInputChange,handleTagsClear=_useTaggedInput.handleTagsClear;React__default.useEffect(function(){setShouldShowClearButton(Boolean(showClearButton&&(defaultValue!=null?defaultValue:value)));},[showClearButton,defaultValue,value]);var renderInteractionElement=function renderInteractionElement(){if(isLoading){return jsx(Spinner,{accessibilityLabel:"Loading Content",color:"primary"});}if(shouldShowClearButton){return jsx(IconButton,{size:"medium",icon:CloseIcon,onClick:function onClick(){var _textInputRef$current;if(isEmpty(value)&&textInputRef.current){if(isReactNative(textInputRef.current)){textInputRef.current.clear();textInputRef.current.focus();}else if(textInputRef.current instanceof HTMLInputElement){textInputRef.current.value='';textInputRef.current.focus();}}handleTagsClear();onClearButtonClick==null?void 0:onClearButtonClick();textInputRef==null?void 0:(_textInputRef$current=textInputRef.current)==null?void 0:_textInputRef$current.focus();setShouldShowClearButton(false);},isDisabled:isDisabled,accessibilityLabel:"Clear Input Content"});}return null;};return jsx(BaseInput,Object.assign({id:"textinput",componentName:MetaConstants.TextInput,ref:mergedRef,label:label,accessibilityLabel:accessibilityLabel,hideLabelText:!Boolean(label),labelPosition:labelPosition,placeholder:placeholder,defaultValue:defaultValue,value:value,name:name,maxCharacters:maxCharacters,isDropdownTrigger:isTaggedInput,tags:isTaggedInput?getTags({size:size}):undefined,showAllTags:isInputFocussed,maxTagRows:"single",activeTagIndex:activeTagIndex,setActiveTagIndex:setActiveTagIndex,onChange:function onChange(_ref2){var name=_ref2.name,value=_ref2.value;if(showClearButton&&value!=null&&value.length){setShouldShowClearButton(true);}if(shouldShowClearButton&&!(value!=null&&value.length)){setShouldShowClearButton(false);}handleTaggedInputChange({name:name,value:value});_onChange==null?void 0:_onChange({name:name,value:value});},onClick:onClick,onFocus:function onFocus(e){setIsInputFocussed(true);_onFocus==null?void 0:_onFocus(e);},onBlur:function onBlur(e){setIsInputFocussed(false);_onBlur==null?void 0:_onBlur(e);},onKeyDown:function onKeyDown(e){handleTaggedInputKeydown(e);},onSubmit:onSubmit,isDisabled:isDisabled,necessityIndicator:necessityIndicator,isRequired:isRequired,leadingIcon:leadingIcon!=null?leadingIcon:icon,prefix:prefix,trailingInteractionElement:renderInteractionElement(),trailingIcon:trailingIcon,suffix:suffix,validationState:validationState,errorText:errorText,helpText:helpText,successText:successText,trailingFooterSlot:function trailingFooterSlot(value){var _value$length;return maxCharacters?jsx(BaseBox,{marginTop:hintMarginTop[size],marginRight:"spacing.1",children:jsx(CharacterCounter,{currentCount:(_value$length=value==null?void 0:value.length)!=null?_value$length:0,maxCount:maxCharacters,size:size})}):null;},autoFocus:autoFocus,testID:testID},getKeyboardAndAutocompleteProps({type:type,keyboardReturnKeyType:keyboardReturnKeyType,autoCompleteSuggestionType:autoCompleteSuggestionType,autoCapitalize:autoCapitalize}),{size:size},rest));};var TextInput=assignWithoutSideEffects(React__default.forwardRef(_TextInput),{displayName:'TextInput'});
32
32
 
33
33
  export { TextInput };
34
34
  //# sourceMappingURL=TextInput.js.map