@razorpay/blade 11.8.2 → 11.9.1

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 (230) hide show
  1. package/build/lib/native/components/Checkbox/Checkbox.js +4 -3
  2. package/build/lib/native/components/Checkbox/Checkbox.js.map +1 -1
  3. package/build/lib/native/components/Checkbox/CheckboxGroup/CheckboxGroup.js +1 -1
  4. package/build/lib/native/components/Checkbox/CheckboxGroup/CheckboxGroup.js.map +1 -1
  5. package/build/lib/native/components/Checkbox/CheckboxIcon/CheckboxIcon.js +1 -1
  6. package/build/lib/native/components/Checkbox/CheckboxIcon/CheckboxIcon.js.map +1 -1
  7. package/build/lib/native/components/Checkbox/checkboxTokens.js +1 -1
  8. package/build/lib/native/components/Checkbox/checkboxTokens.js.map +1 -1
  9. package/build/lib/native/components/Form/CharacterCounter/CharacterCounter.js +2 -1
  10. package/build/lib/native/components/Form/CharacterCounter/CharacterCounter.js.map +1 -1
  11. package/build/lib/native/components/Form/FormHint.js +2 -1
  12. package/build/lib/native/components/Form/FormHint.js.map +1 -1
  13. package/build/lib/native/components/Form/FormLabel.js +3 -1
  14. package/build/lib/native/components/Form/FormLabel.js.map +1 -1
  15. package/build/lib/native/components/Form/Selector/SelectorSupportText.js +1 -1
  16. package/build/lib/native/components/Form/Selector/SelectorSupportText.js.map +1 -1
  17. package/build/lib/native/components/Form/Selector/SelectorTitle.js.map +1 -1
  18. package/build/lib/native/components/Form/formTokens.js +8 -0
  19. package/build/lib/native/components/Form/formTokens.js.map +1 -0
  20. package/build/lib/native/components/Input/BaseInput/AnimatedBaseInputWrapper.native.js +5 -3
  21. package/build/lib/native/components/Input/BaseInput/AnimatedBaseInputWrapper.native.js.map +1 -1
  22. package/build/lib/native/components/Input/BaseInput/BaseInput.js +8 -2
  23. package/build/lib/native/components/Input/BaseInput/BaseInput.js.map +1 -1
  24. package/build/lib/native/components/Input/BaseInput/BaseInputTagSlot.native.js +2 -2
  25. package/build/lib/native/components/Input/BaseInput/BaseInputTagSlot.native.js.map +1 -1
  26. package/build/lib/native/components/Input/BaseInput/BaseInputVisuals.js +4 -2
  27. package/build/lib/native/components/Input/BaseInput/BaseInputVisuals.js.map +1 -1
  28. package/build/lib/native/components/Input/BaseInput/BaseInputWrapper.js +2 -3
  29. package/build/lib/native/components/Input/BaseInput/BaseInputWrapper.js.map +1 -1
  30. package/build/lib/native/components/Input/BaseInput/StyledBaseInput.native.js +2 -1
  31. package/build/lib/native/components/Input/BaseInput/StyledBaseInput.native.js.map +1 -1
  32. package/build/lib/native/components/Input/BaseInput/baseInputStyles.js +6 -3
  33. package/build/lib/native/components/Input/BaseInput/baseInputStyles.js.map +1 -1
  34. package/build/lib/native/components/Input/BaseInput/baseInputTokens.js +8 -0
  35. package/build/lib/native/components/Input/BaseInput/baseInputTokens.js.map +1 -0
  36. package/build/lib/native/components/Input/BaseInput/getBaseInputBorderStyles.native.js +4 -0
  37. package/build/lib/native/components/Input/BaseInput/getBaseInputBorderStyles.native.js.map +1 -0
  38. package/build/lib/native/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js +1 -1
  39. package/build/lib/native/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js.map +1 -1
  40. package/build/lib/native/components/Input/OTPInput/OTPInput.js +1 -1
  41. package/build/lib/native/components/Input/OTPInput/OTPInput.js.map +1 -1
  42. package/build/lib/native/components/Input/PasswordInput/PasswordInput.js +1 -1
  43. package/build/lib/native/components/Input/PasswordInput/PasswordInput.js.map +1 -1
  44. package/build/lib/native/components/Input/TextArea/TextArea.js +2 -1
  45. package/build/lib/native/components/Input/TextArea/TextArea.js.map +1 -1
  46. package/build/lib/native/components/Input/TextInput/TextInput.js +2 -1
  47. package/build/lib/native/components/Input/TextInput/TextInput.js.map +1 -1
  48. package/build/lib/native/components/Radio/Radio.js +4 -3
  49. package/build/lib/native/components/Radio/Radio.js.map +1 -1
  50. package/build/lib/native/components/Radio/RadioGroup/RadioGroup.js +1 -1
  51. package/build/lib/native/components/Radio/RadioGroup/RadioGroup.js.map +1 -1
  52. package/build/lib/native/components/Radio/radioTokens.js +1 -1
  53. package/build/lib/native/components/Radio/radioTokens.js.map +1 -1
  54. package/build/lib/native/components/Tag/Tag.js +1 -1
  55. package/build/lib/native/components/Tag/Tag.js.map +1 -1
  56. package/build/lib/native/components/Tag/getTagsGroup.js +1 -1
  57. package/build/lib/native/components/Tag/getTagsGroup.js.map +1 -1
  58. package/build/lib/native/components/Typography/Heading/Heading.js +2 -2
  59. package/build/lib/native/components/Typography/Heading/Heading.js.map +1 -1
  60. package/build/lib/native/components/Typography/Heading/getHeadingStyles.js +7 -0
  61. package/build/lib/native/components/Typography/Heading/getHeadingStyles.js.map +1 -0
  62. package/build/lib/native/components/Typography/Text/Text.js +1 -1
  63. package/build/lib/native/components/Typography/Text/Text.js.map +1 -1
  64. package/build/lib/native/components/index.js +1 -1
  65. package/build/lib/native/tokens/global/size.js +1 -1
  66. package/build/lib/native/tokens/global/size.js.map +1 -1
  67. package/build/lib/native/utils/getFocusRingStyles/getFocusRingStyles.native.js.map +1 -1
  68. package/build/lib/web/development/components/Checkbox/Checkbox.js +17 -3
  69. package/build/lib/web/development/components/Checkbox/Checkbox.js.map +1 -1
  70. package/build/lib/web/development/components/Checkbox/CheckboxGroup/CheckboxGroup.js +2 -0
  71. package/build/lib/web/development/components/Checkbox/CheckboxGroup/CheckboxGroup.js.map +1 -1
  72. package/build/lib/web/development/components/Checkbox/CheckboxIcon/CheckboxIcon.js +4 -0
  73. package/build/lib/web/development/components/Checkbox/CheckboxIcon/CheckboxIcon.js.map +1 -1
  74. package/build/lib/web/development/components/Checkbox/checkboxTokens.js +12 -4
  75. package/build/lib/web/development/components/Checkbox/checkboxTokens.js.map +1 -1
  76. package/build/lib/web/development/components/Form/CharacterCounter/CharacterCounter.js +5 -1
  77. package/build/lib/web/development/components/Form/CharacterCounter/CharacterCounter.js.map +1 -1
  78. package/build/lib/web/development/components/Form/FormHint.js +34 -17
  79. package/build/lib/web/development/components/Form/FormHint.js.map +1 -1
  80. package/build/lib/web/development/components/Form/FormLabel.js +10 -7
  81. package/build/lib/web/development/components/Form/FormLabel.js.map +1 -1
  82. package/build/lib/web/development/components/Form/Selector/SelectorSupportText.js +8 -2
  83. package/build/lib/web/development/components/Form/Selector/SelectorSupportText.js.map +1 -1
  84. package/build/lib/web/development/components/Form/Selector/SelectorTitle.js.map +1 -1
  85. package/build/lib/web/development/components/Form/formTokens.js +53 -0
  86. package/build/lib/web/development/components/Form/formTokens.js.map +1 -0
  87. package/build/lib/web/development/components/Input/BaseInput/AnimatedBaseInputWrapper.web.js +23 -37
  88. package/build/lib/web/development/components/Input/BaseInput/AnimatedBaseInputWrapper.web.js.map +1 -1
  89. package/build/lib/web/development/components/Input/BaseInput/BaseInput.js +200 -155
  90. package/build/lib/web/development/components/Input/BaseInput/BaseInput.js.map +1 -1
  91. package/build/lib/web/development/components/Input/BaseInput/BaseInputTagSlot.web.js +4 -3
  92. package/build/lib/web/development/components/Input/BaseInput/BaseInputTagSlot.web.js.map +1 -1
  93. package/build/lib/web/development/components/Input/BaseInput/BaseInputVisuals.js +101 -34
  94. package/build/lib/web/development/components/Input/BaseInput/BaseInputVisuals.js.map +1 -1
  95. package/build/lib/web/development/components/Input/BaseInput/BaseInputWrapper.js +3 -7
  96. package/build/lib/web/development/components/Input/BaseInput/BaseInputWrapper.js.map +1 -1
  97. package/build/lib/web/development/components/Input/BaseInput/StyledBaseInput.web.js +14 -5
  98. package/build/lib/web/development/components/Input/BaseInput/StyledBaseInput.web.js.map +1 -1
  99. package/build/lib/web/development/components/Input/BaseInput/baseInputStyles.js +119 -67
  100. package/build/lib/web/development/components/Input/BaseInput/baseInputStyles.js.map +1 -1
  101. package/build/lib/web/development/components/Input/BaseInput/baseInputTokens.js +88 -0
  102. package/build/lib/web/development/components/Input/BaseInput/baseInputTokens.js.map +1 -0
  103. package/build/lib/web/development/components/Input/BaseInput/getBaseInputBorderStyles.web.js +23 -0
  104. package/build/lib/web/development/components/Input/BaseInput/getBaseInputBorderStyles.web.js.map +1 -0
  105. package/build/lib/web/development/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js +11 -6
  106. package/build/lib/web/development/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js.map +1 -1
  107. package/build/lib/web/development/components/Input/OTPInput/OTPInput.js +9 -3
  108. package/build/lib/web/development/components/Input/OTPInput/OTPInput.js.map +1 -1
  109. package/build/lib/web/development/components/Input/PasswordInput/PasswordInput.js +5 -2
  110. package/build/lib/web/development/components/Input/PasswordInput/PasswordInput.js.map +1 -1
  111. package/build/lib/web/development/components/Input/TextArea/TextArea.js +7 -3
  112. package/build/lib/web/development/components/Input/TextArea/TextArea.js.map +1 -1
  113. package/build/lib/web/development/components/Input/TextInput/TextInput.js +17 -6
  114. package/build/lib/web/development/components/Input/TextInput/TextInput.js.map +1 -1
  115. package/build/lib/web/development/components/Radio/Radio.js +10 -3
  116. package/build/lib/web/development/components/Radio/Radio.js.map +1 -1
  117. package/build/lib/web/development/components/Radio/RadioGroup/RadioGroup.js +2 -0
  118. package/build/lib/web/development/components/Radio/RadioGroup/RadioGroup.js.map +1 -1
  119. package/build/lib/web/development/components/Radio/radioTokens.js +13 -4
  120. package/build/lib/web/development/components/Radio/radioTokens.js.map +1 -1
  121. package/build/lib/web/development/components/Table/TableBody.web.js +3 -0
  122. package/build/lib/web/development/components/Table/TableBody.web.js.map +1 -1
  123. package/build/lib/web/development/components/Tag/AnimatedTag.web.js +4 -1
  124. package/build/lib/web/development/components/Tag/AnimatedTag.web.js.map +1 -1
  125. package/build/lib/web/development/components/Tag/Tag.js +2 -2
  126. package/build/lib/web/development/components/Tag/Tag.js.map +1 -1
  127. package/build/lib/web/development/components/Tag/getTagsGroup.js +4 -1
  128. package/build/lib/web/development/components/Tag/getTagsGroup.js.map +1 -1
  129. package/build/lib/web/development/components/Typography/Heading/Heading.js +3 -3
  130. package/build/lib/web/development/components/Typography/Heading/Heading.js.map +1 -1
  131. package/build/lib/web/development/components/Typography/Heading/getHeadingStyles.js +22 -0
  132. package/build/lib/web/development/components/Typography/Heading/getHeadingStyles.js.map +1 -0
  133. package/build/lib/web/development/components/Typography/Heading/index.js +1 -1
  134. package/build/lib/web/development/components/Typography/Text/Text.js +8 -3
  135. package/build/lib/web/development/components/Typography/Text/Text.js.map +1 -1
  136. package/build/lib/web/development/components/index.js +1 -1
  137. package/build/lib/web/development/tokens/global/size.js +2 -0
  138. package/build/lib/web/development/tokens/global/size.js.map +1 -1
  139. package/build/lib/web/development/utils/getFocusRingStyles/getFocusRingStyles.web.js +1 -0
  140. package/build/lib/web/development/utils/getFocusRingStyles/getFocusRingStyles.web.js.map +1 -1
  141. package/build/lib/web/production/components/Checkbox/Checkbox.js +17 -3
  142. package/build/lib/web/production/components/Checkbox/Checkbox.js.map +1 -1
  143. package/build/lib/web/production/components/Checkbox/CheckboxGroup/CheckboxGroup.js +2 -0
  144. package/build/lib/web/production/components/Checkbox/CheckboxGroup/CheckboxGroup.js.map +1 -1
  145. package/build/lib/web/production/components/Checkbox/CheckboxIcon/CheckboxIcon.js +4 -0
  146. package/build/lib/web/production/components/Checkbox/CheckboxIcon/CheckboxIcon.js.map +1 -1
  147. package/build/lib/web/production/components/Checkbox/checkboxTokens.js +12 -4
  148. package/build/lib/web/production/components/Checkbox/checkboxTokens.js.map +1 -1
  149. package/build/lib/web/production/components/Form/CharacterCounter/CharacterCounter.js +5 -1
  150. package/build/lib/web/production/components/Form/CharacterCounter/CharacterCounter.js.map +1 -1
  151. package/build/lib/web/production/components/Form/FormHint.js +34 -17
  152. package/build/lib/web/production/components/Form/FormHint.js.map +1 -1
  153. package/build/lib/web/production/components/Form/FormLabel.js +10 -7
  154. package/build/lib/web/production/components/Form/FormLabel.js.map +1 -1
  155. package/build/lib/web/production/components/Form/Selector/SelectorSupportText.js +8 -2
  156. package/build/lib/web/production/components/Form/Selector/SelectorSupportText.js.map +1 -1
  157. package/build/lib/web/production/components/Form/Selector/SelectorTitle.js.map +1 -1
  158. package/build/lib/web/production/components/Form/formTokens.js +53 -0
  159. package/build/lib/web/production/components/Form/formTokens.js.map +1 -0
  160. package/build/lib/web/production/components/Input/BaseInput/AnimatedBaseInputWrapper.web.js +23 -37
  161. package/build/lib/web/production/components/Input/BaseInput/AnimatedBaseInputWrapper.web.js.map +1 -1
  162. package/build/lib/web/production/components/Input/BaseInput/BaseInput.js +200 -155
  163. package/build/lib/web/production/components/Input/BaseInput/BaseInput.js.map +1 -1
  164. package/build/lib/web/production/components/Input/BaseInput/BaseInputTagSlot.web.js +4 -3
  165. package/build/lib/web/production/components/Input/BaseInput/BaseInputTagSlot.web.js.map +1 -1
  166. package/build/lib/web/production/components/Input/BaseInput/BaseInputVisuals.js +101 -34
  167. package/build/lib/web/production/components/Input/BaseInput/BaseInputVisuals.js.map +1 -1
  168. package/build/lib/web/production/components/Input/BaseInput/BaseInputWrapper.js +3 -7
  169. package/build/lib/web/production/components/Input/BaseInput/BaseInputWrapper.js.map +1 -1
  170. package/build/lib/web/production/components/Input/BaseInput/StyledBaseInput.web.js +14 -5
  171. package/build/lib/web/production/components/Input/BaseInput/StyledBaseInput.web.js.map +1 -1
  172. package/build/lib/web/production/components/Input/BaseInput/baseInputStyles.js +119 -67
  173. package/build/lib/web/production/components/Input/BaseInput/baseInputStyles.js.map +1 -1
  174. package/build/lib/web/production/components/Input/BaseInput/baseInputTokens.js +88 -0
  175. package/build/lib/web/production/components/Input/BaseInput/baseInputTokens.js.map +1 -0
  176. package/build/lib/web/production/components/Input/BaseInput/getBaseInputBorderStyles.web.js +23 -0
  177. package/build/lib/web/production/components/Input/BaseInput/getBaseInputBorderStyles.web.js.map +1 -0
  178. package/build/lib/web/production/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js +11 -6
  179. package/build/lib/web/production/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js.map +1 -1
  180. package/build/lib/web/production/components/Input/OTPInput/OTPInput.js +9 -3
  181. package/build/lib/web/production/components/Input/OTPInput/OTPInput.js.map +1 -1
  182. package/build/lib/web/production/components/Input/PasswordInput/PasswordInput.js +5 -2
  183. package/build/lib/web/production/components/Input/PasswordInput/PasswordInput.js.map +1 -1
  184. package/build/lib/web/production/components/Input/TextArea/TextArea.js +7 -3
  185. package/build/lib/web/production/components/Input/TextArea/TextArea.js.map +1 -1
  186. package/build/lib/web/production/components/Input/TextInput/TextInput.js +17 -6
  187. package/build/lib/web/production/components/Input/TextInput/TextInput.js.map +1 -1
  188. package/build/lib/web/production/components/Radio/Radio.js +10 -3
  189. package/build/lib/web/production/components/Radio/Radio.js.map +1 -1
  190. package/build/lib/web/production/components/Radio/RadioGroup/RadioGroup.js +2 -0
  191. package/build/lib/web/production/components/Radio/RadioGroup/RadioGroup.js.map +1 -1
  192. package/build/lib/web/production/components/Radio/radioTokens.js +13 -4
  193. package/build/lib/web/production/components/Radio/radioTokens.js.map +1 -1
  194. package/build/lib/web/production/components/Table/TableBody.web.js +3 -0
  195. package/build/lib/web/production/components/Table/TableBody.web.js.map +1 -1
  196. package/build/lib/web/production/components/Tag/AnimatedTag.web.js +4 -1
  197. package/build/lib/web/production/components/Tag/AnimatedTag.web.js.map +1 -1
  198. package/build/lib/web/production/components/Tag/Tag.js +2 -2
  199. package/build/lib/web/production/components/Tag/Tag.js.map +1 -1
  200. package/build/lib/web/production/components/Tag/getTagsGroup.js +4 -1
  201. package/build/lib/web/production/components/Tag/getTagsGroup.js.map +1 -1
  202. package/build/lib/web/production/components/Typography/Heading/Heading.js +3 -3
  203. package/build/lib/web/production/components/Typography/Heading/Heading.js.map +1 -1
  204. package/build/lib/web/production/components/Typography/Heading/getHeadingStyles.js +22 -0
  205. package/build/lib/web/production/components/Typography/Heading/getHeadingStyles.js.map +1 -0
  206. package/build/lib/web/production/components/Typography/Heading/index.js +1 -1
  207. package/build/lib/web/production/components/Typography/Text/Text.js +8 -3
  208. package/build/lib/web/production/components/Typography/Text/Text.js.map +1 -1
  209. package/build/lib/web/production/components/index.js +1 -1
  210. package/build/lib/web/production/tokens/global/size.js +2 -0
  211. package/build/lib/web/production/tokens/global/size.js.map +1 -1
  212. package/build/lib/web/production/utils/getFocusRingStyles/getFocusRingStyles.web.js +1 -0
  213. package/build/lib/web/production/utils/getFocusRingStyles/getFocusRingStyles.web.js.map +1 -1
  214. package/build/types/components/index.d.ts +36 -15
  215. package/build/types/components/index.native.d.ts +36 -15
  216. package/build/types/tokens/index.d.ts +2 -0
  217. package/build/types/tokens/index.native.d.ts +2 -0
  218. package/package.json +1 -1
  219. package/build/lib/native/components/Input/BaseInput/BaseInputAnimatedBorder.native.js +0 -16
  220. package/build/lib/native/components/Input/BaseInput/BaseInputAnimatedBorder.native.js.map +0 -1
  221. package/build/lib/native/components/Input/BaseInput/baseInputConfig.js +0 -8
  222. package/build/lib/native/components/Input/BaseInput/baseInputConfig.js.map +0 -1
  223. package/build/lib/web/development/components/Input/BaseInput/BaseInputAnimatedBorder.web.js +0 -43
  224. package/build/lib/web/development/components/Input/BaseInput/BaseInputAnimatedBorder.web.js.map +0 -1
  225. package/build/lib/web/development/components/Input/BaseInput/baseInputConfig.js +0 -26
  226. package/build/lib/web/development/components/Input/BaseInput/baseInputConfig.js.map +0 -1
  227. package/build/lib/web/production/components/Input/BaseInput/BaseInputAnimatedBorder.web.js +0 -43
  228. package/build/lib/web/production/components/Input/BaseInput/BaseInputAnimatedBorder.web.js.map +0 -1
  229. package/build/lib/web/production/components/Input/BaseInput/baseInputConfig.js +0 -26
  230. package/build/lib/web/production/components/Input/BaseInput/baseInputConfig.js.map +0 -1
@@ -22,7 +22,7 @@ import { FormLabel } from '../../Form/FormLabel.js';
22
22
  import { makeSize } from '../../../utils/makeSize/makeSize.js';
23
23
  import { FormHint } from '../../Form/FormHint.js';
24
24
 
25
- var _excluded = ["autoFocus", "errorText", "helpText", "isDisabled", "keyboardReturnKeyType", "keyboardType", "label", "accessibilityLabel", "labelPosition", "name", "onChange", "onFocus", "onBlur", "onOTPFilled", "otpLength", "placeholder", "successText", "validationState", "value", "isMasked", "autoCompleteSuggestionType", "testID"];
25
+ var _excluded = ["autoFocus", "errorText", "helpText", "isDisabled", "keyboardReturnKeyType", "keyboardType", "label", "accessibilityLabel", "labelPosition", "name", "onChange", "onFocus", "onBlur", "onOTPFilled", "otpLength", "placeholder", "successText", "validationState", "value", "isMasked", "autoCompleteSuggestionType", "testID", "size"];
26
26
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
27
27
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
28
28
  var isReactNative = getPlatformType() === 'react-native';
@@ -75,6 +75,8 @@ var _OTPInput = function _OTPInput(_ref, incomingRef) {
75
75
  _ref$autoCompleteSugg = _ref.autoCompleteSuggestionType,
76
76
  autoCompleteSuggestionType = _ref$autoCompleteSugg === void 0 ? 'oneTimeCode' : _ref$autoCompleteSugg,
77
77
  testID = _ref.testID,
78
+ _ref$size = _ref.size,
79
+ size = _ref$size === void 0 ? 'medium' : _ref$size,
78
80
  styledProps = _objectWithoutProperties(_ref, _excluded);
79
81
  var inputRefs = [];
80
82
  var _useState = useState(otpToArray(inputValue)),
@@ -313,7 +315,9 @@ var _OTPInput = function _OTPInput(_ref, incomingRef) {
313
315
  errorText: errorText,
314
316
  helpText: helpText,
315
317
  hideFormHint: true,
316
- type: currentInputType
318
+ type: currentInputType,
319
+ size: size,
320
+ valueComponentType: "heading"
317
321
  })
318
322
  }, "".concat(inputId, "-").concat(index)));
319
323
  };
@@ -335,6 +339,7 @@ var _OTPInput = function _OTPInput(_ref, incomingRef) {
335
339
  as: "label",
336
340
  position: labelPosition,
337
341
  htmlFor: inputId,
342
+ size: size,
338
343
  children: label
339
344
  }), /*#__PURE__*/jsxs(BaseBox, {
340
345
  display: "flex",
@@ -353,7 +358,8 @@ var _OTPInput = function _OTPInput(_ref, incomingRef) {
353
358
  successText: successText,
354
359
  helpTextId: helpTextId,
355
360
  errorTextId: errorTextId,
356
- successTextId: successTextId
361
+ successTextId: successTextId,
362
+ size: size
357
363
  })
358
364
  })]
359
365
  }));
@@ -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> & {\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 ...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 />\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}>\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 />\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","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","_event$preventDefault","preventDefault","call","_event$preventDefault2","_event$preventDefault3","_event$preventDefault4","getHiddenInput","_ref6","_jsx","hidden","id","readOnly","getOTPInputFields","inputs","_loop","_otpValue$index","_Array$from$index","currentValue","React","createRef","currentInputType","push","BaseBox","flex","marginLeft","children","BaseInput","concat","hideLabelText","textAlign","maxCharacters","formEvent","_objectSpread","inputIndex","onInput","onKeyDown","keyboardEvent","isRequired","hideFormHint","type","_jsxs","metaAttribute","MetaConstants","OTPInput","getStyledProps","display","flexDirection","alignItems","position","Boolean","FormLabel","as","htmlFor","makeSize","FormHint","getHintType","hasHelpText","forwardRef"],"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AAE3H,aAAc;AAAC+H,QAAAA,OAAO,EAAE7F,OAAQ;AAAAkE,QAAAA,QAAA,EAC7DtG,KAAAA;AAAK,OACG,CACZ,eACDqH,IAAA,CAAClB,OAAO,EAAA;AAACuB,QAAAA,OAAO,EAAC,MAAM;AAACC,QAAAA,aAAa,EAAC,KAAK;AAAArB,QAAAA,QAAA,GACxCnB,cAAc,EAAE,EAChBM,iBAAiB,EAAE,CAAA;AAAA,OACb,CAAC,CAAA;AAAA,KACH,CAAC,eAGVJ,GAAA,CAACc,OAAO,EAAA;MAACE,UAAU,EAAE6B,QAAQ,CAACjG,qBAAqB,GAAG,GAAG,GAAG,CAAC,CAAE;MAAAqE,QAAA,eAC7DjB,GAAA,CAAC8C,QAAQ,EAAA;QACPf,IAAI,EAAEgB,WAAW,CAAC;AAAExH,UAAAA,eAAe,EAAfA,eAAe;UAAEyH,WAAW,EAAEP,OAAO,CAACnI,QAAQ,CAAA;AAAE,SAAC,CAAE;AACvEA,QAAAA,QAAQ,EAAEA,QAAS;AACnBD,QAAAA,SAAS,EAAEA,SAAU;AACrBiB,QAAAA,WAAW,EAAEA,WAAY;AACzB0B,QAAAA,UAAU,EAAEA,UAAW;AACvBC,QAAAA,WAAW,EAAEA,WAAY;AACzBC,QAAAA,aAAa,EAAEA,aAAAA;OAChB,CAAA;AAAC,KACK,CAAC,CAAA;AAAA,GAAA,CACH,CAAC,CAAA;AAEd,CAAC,CAAA;AAED,IAAMiF,QAAQ,gBAAGzB,cAAK,CAACuC,UAAU,CAAoChJ,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';\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","_event$preventDefault","preventDefault","call","_event$preventDefault2","_event$preventDefault3","_event$preventDefault4","getHiddenInput","_ref6","_jsx","hidden","id","readOnly","getOTPInputFields","inputs","_loop","_otpValue$index","_Array$from$index","currentValue","React","createRef","currentInputType","push","BaseBox","flex","marginLeft","children","BaseInput","concat","hideLabelText","textAlign","maxCharacters","formEvent","_objectSpread","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":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAoHA,IAAMA,aAAa,GAAGC,eAAe,EAAE,KAAK,cAAc,CAAA;;AAE1D;AACA;AACA;AACA,IAAMC,UAAU,GAAG,SAAbA,UAAUA,CAAIC,IAAa,EAAA;AAAA,EAAA,IAAAC,WAAA,CAAA;EAAA,OAAAA,CAAAA,WAAA,GAAeD,IAAI,KAAJA,IAAAA,IAAAA,IAAI,uBAAJA,IAAI,CAAEE,KAAK,CAAC,EAAE,CAAC,cAAAD,WAAA,KAAA,KAAA,CAAA,GAAAA,WAAA,GAAIE,KAAK,CAAC,CAAC,CAAC,CAACC,IAAI,CAAC,EAAE,CAAC,CAAA;AAAA,CAAA,CAAA;;AAEpF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMC,SAA4E,GAAG,SAA/EA,SAA4EA,CAAAC,IAAA,EA2BhFC,WAAW,EACR;AAAA,EAAA,IA1BDC,SAAS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AG,GAAG,GAAG,CAAC,CAAE;MAAAqE,QAAA,eAC7DjB,GAAA,CAAC+C,QAAQ,EAAA;QACPhB,IAAI,EAAEiB,WAAW,CAAC;AAAE3H,UAAAA,eAAe,EAAfA,eAAe;UAAE4H,WAAW,EAAEP,OAAO,CAACtI,QAAQ,CAAA;AAAE,SAAC,CAAE;AACvEA,QAAAA,QAAQ,EAAEA,QAAS;AACnBD,QAAAA,SAAS,EAAEA,SAAU;AACrBiB,QAAAA,WAAW,EAAEA,WAAY;AACzB4B,QAAAA,UAAU,EAAEA,UAAW;AACvBC,QAAAA,WAAW,EAAEA,WAAY;AACzBC,QAAAA,aAAa,EAAEA,aAAc;AAC7BrB,QAAAA,IAAI,EAAEA,IAAAA;OACP,CAAA;AAAC,KACK,CAAC,CAAA;AAAA,GAAA,CACH,CAAC,CAAA;AAEd,CAAC,CAAA;AAED,IAAMuG,QAAQ,gBAAG1B,cAAK,CAACwC,UAAU,CAAoCnJ,SAAS;;;;"}
@@ -19,7 +19,7 @@ import { BaseInput } from '../BaseInput/BaseInput.js';
19
19
  import { MetaConstants } from '../../../utils/metaAttribute/metaConstants.js';
20
20
  import { assignWithoutSideEffects } from '../../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
21
21
 
22
- 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"];
22
+ 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"];
23
23
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
24
24
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
25
25
  var _PasswordInput = function _PasswordInput(_ref, ref) {
@@ -54,6 +54,8 @@ var _PasswordInput = function _PasswordInput(_ref, ref) {
54
54
  keyboardReturnKeyType = _ref$keyboardReturnKe === void 0 ? 'done' : _ref$keyboardReturnKe,
55
55
  autoCompleteSuggestionType = _ref.autoCompleteSuggestionType,
56
56
  testID = _ref.testID,
57
+ _ref$size = _ref.size,
58
+ size = _ref$size === void 0 ? 'medium' : _ref$size,
57
59
  styledProps = _objectWithoutProperties(_ref, _excluded);
58
60
  var _React$useState = React__default.useState(false),
59
61
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -121,7 +123,8 @@ var _PasswordInput = function _PasswordInput(_ref, ref) {
121
123
  autoCompleteSuggestionType: autoCompleteSuggestionType,
122
124
  keyboardReturnKeyType: keyboardReturnKeyType,
123
125
  autoCapitalize: "none",
124
- testID: testID
126
+ testID: testID,
127
+ size: size
125
128
  }, styledProps));
126
129
  };
127
130
 
@@ -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> &\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 ...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 interactionElement={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 {...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","styledProps","_objectWithoutProperties","_excluded","_React$useState","React","useState","_React$useState2","_slicedToArray","isRevealed","setIsRevealed","isEnabled","isRevealedAndEnabled","toggleIsRevealed","revealed","iconAccessibilityLabel","type","revealButtonIcon","EyeOffIcon","EyeIcon","revealButton","_jsx","IconButton","size","icon","onClick","trailingFooterSlot","_value$length","BaseBox","marginTop","marginRight","children","CharacterCounter","currentCount","length","maxCount","BaseInput","_objectSpread","componentName","MetaConstants","PasswordInput","id","hideLabelText","Boolean","interactionElement","autoCapitalize","assignWithoutSideEffects","forwardRef","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;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,IAAAA,kBAAkB,EAAExB,YAAa;AACjCM,IAAAA,kBAAkB,EAAEA,kBAAmB;AACvClD,IAAAA,aAAa,EAAEA,aAAc;AAC7BC,IAAAA,eAAe,EAAEA,eAAgB;AACjCC,IAAAA,SAAS,EAAEA,SAAU;AACrBC,IAAAA,WAAW,EAAEA,WAAY;AACzBC,IAAAA,QAAQ,EAAEA,QAAS;AACnBE,IAAAA,UAAU,EAAEA,UAAW;AACvBC,IAAAA,YAAY,EAAEA,YAAa;AAC3BC,IAAAA,WAAW,EAAEA,WAAY;AACzBE,IAAAA,UAAU,EAAEA,UAAW;AACvBE,IAAAA,kBAAkB,EAAEA,kBAAmB;AACvCC,IAAAA,KAAK,EAAEA,KAAM;AACbC,IAAAA,QAAQ,EAAEA,QAAS;AACnBE,IAAAA,MAAM,EAAEA,MAAO;AACfC,IAAAA,QAAQ,EAAEA,QAAS;AACnBF,IAAAA,OAAO,EAAEA,OAAQ;AACjBG,IAAAA,IAAI,EAAEA,IAAAA;AACN;AAAA;AACAE,IAAAA,SAAS,EAAEA,SAAU;AACrBG,IAAAA,0BAA0B,EAAEA,0BAA2B;AACvDD,IAAAA,qBAAqB,EAAEA,qBAAsB;AAC7C+C,IAAAA,cAAc,EAAC,MAAM;AACrB7C,IAAAA,MAAM,EAAEA,MAAAA;GACJC,EAAAA,WAAW,CAChB,CAAC,CAAA;AAEN,CAAC,CAAA;;AAED;AACMuC,IAAAA,aAAa,gBAAGM,wBAAwB,eAACzC,cAAK,CAAC0C,UAAU,CAAChF,cAAc,CAAC,EAAE;AAC/EiF,EAAAA,WAAW,EAAE,eAAA;AACf,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 { 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 interactionElement={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","_objectSpread","componentName","MetaConstants","PasswordInput","id","hideLabelText","Boolean","interactionElement","autoCapitalize","assignWithoutSideEffects","forwardRef","displayName"],"m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ounter/index.js';
12
12
  import '../../../utils/assignWithoutSideEffects/index.js';
13
13
  import '../../../utils/index.js';
14
14
  import { useMergeRefs } from '../../../utils/useMergeRefs.js';
15
+ import { hintMarginTop } from '../../Form/formTokens.js';
15
16
  import { jsx } from 'react/jsx-runtime';
16
17
  import { getPlatformType } from '../../../utils/getPlatformType/getPlatformType.js';
17
18
  import { BaseBox } from '../../Box/BaseBox/BaseBox.web.js';
@@ -22,7 +23,7 @@ import { MetaConstants } from '../../../utils/metaAttribute/metaConstants.js';
22
23
  import { CharacterCounter } from '../../Form/CharacterCounter/CharacterCounter.js';
23
24
  import { assignWithoutSideEffects } from '../../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
24
25
 
25
- 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"];
26
+ 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"];
26
27
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
27
28
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
28
29
  // need to do this to tell TS to infer type as TextInput of React Native and make it believe that `ref.current.clear()` exists
@@ -56,6 +57,8 @@ var _TextArea = function _TextArea(_ref, ref) {
56
57
  _ref$numberOfLines = _ref.numberOfLines,
57
58
  numberOfLines = _ref$numberOfLines === void 0 ? 2 : _ref$numberOfLines,
58
59
  testID = _ref.testID,
60
+ _ref$size = _ref.size,
61
+ size = _ref$size === void 0 ? 'medium' : _ref$size,
59
62
  styledProps = _objectWithoutProperties(_ref, _excluded);
60
63
  var inputRef = React__default.useRef(null);
61
64
  var mergedRef = useMergeRefs(ref, inputRef);
@@ -142,7 +145,7 @@ var _TextArea = function _TextArea(_ref, ref) {
142
145
  trailingFooterSlot: function trailingFooterSlot(value) {
143
146
  var _value$length;
144
147
  return maxCharacters ? /*#__PURE__*/jsx(BaseBox, {
145
- marginTop: "spacing.2",
148
+ marginTop: hintMarginTop[size],
146
149
  marginRight: "spacing.1",
147
150
  children: /*#__PURE__*/jsx(CharacterCounter, {
148
151
  currentCount: (_value$length = value === null || value === void 0 ? void 0 : value.length) !== null && _value$length !== void 0 ? _value$length : 0,
@@ -150,7 +153,8 @@ var _TextArea = function _TextArea(_ref, ref) {
150
153
  })
151
154
  }) : null;
152
155
  },
153
- testID: testID
156
+ testID: testID,
157
+ size: size
154
158
  }, styledProps));
155
159
  };
156
160
  var TextArea = /*#__PURE__*/assignWithoutSideEffects( /*#__PURE__*/React__default.forwardRef(_TextArea), {
@@ -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 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 } from '~utils/types';\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> & {\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} & 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 ...styledProps\n },\n ref,\n) => {\n const inputRef = React.useRef<BladeElementRef>(null);\n const mergedRef = useMergeRefs(ref, inputRef);\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 // 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 componentName={MetaConstants.TextArea}\n autoFocus={autoFocus}\n ref={mergedRef}\n label={label as string}\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 interactionElement={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 onChange?.({ name, value });\n }}\n onFocus={onFocus}\n onBlur={onBlur}\n onSubmit={onSubmit}\n trailingFooterSlot={(value) => {\n return maxCharacters ? (\n <BaseBox marginTop=\"spacing.2\" marginRight=\"spacing.1\">\n <CharacterCounter currentCount={value?.length ?? 0} maxCount={maxCharacters} />\n </BaseBox>\n ) : null;\n }}\n testID={testID}\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","styledProps","_objectWithoutProperties","_excluded","inputRef","React","useRef","mergedRef","useMergeRefs","_React$useState","useState","_React$useState2","_slicedToArray","shouldShowClearButton","setShouldShowClearButton","useEffect","Boolean","length","renderInteractionElement","_jsx","BaseBox","paddingTop","marginTop","children","IconButton","icon","CloseIcon","onClick","_inputRef$current","isEmpty","current","clear","focus","HTMLTextAreaElement","BaseInput","_objectSpread","as","id","componentName","MetaConstants","TextArea","hideLabelText","interactionElement","_ref2","trailingFooterSlot","_value$length","marginRight","CharacterCounter","currentCount","maxCount","assignWithoutSideEffects","forwardRef","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAkFA;AACA;AACA,IAAMA,aAAa,GAAG,SAAhBA,aAAaA,CA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,MAAAA,SAAQ,KAARA,IAAAA,IAAAA,SAAQ,KAARA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,SAAQ,CAAG;AAAED,QAAAA,IAAI,EAAJA,IAAI;AAAEM,QAAAA,KAAK,EAALA,KAAAA;AAAM,OAAC,CAAC,CAAA;KAC3B;AACFJ,IAAAA,OAAO,EAAEA,OAAQ;AACjBC,IAAAA,MAAM,EAAEA,MAAO;AACfC,IAAAA,QAAQ,EAAEA,QAAS;AACnBqD,IAAAA,kBAAkB,EAAE,SAAAA,kBAACnD,CAAAA,KAAK,EAAK;AAAA,MAAA,IAAAoD,aAAA,CAAA;AAC7B,MAAA,OAAOnD,aAAa,gBAClByB,GAAA,CAACC,OAAO,EAAA;AAACE,QAAAA,SAAS,EAAC,WAAW;AAACwB,QAAAA,WAAW,EAAC,WAAW;QAAAvB,QAAA,eACpDJ,GAAA,CAAC4B,gBAAgB,EAAA;AAACC,UAAAA,YAAY,EAAAH,CAAAA,aAAA,GAAEpD,KAAK,aAALA,KAAK,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAALA,KAAK,CAAEwB,MAAM,MAAA4B,IAAAA,IAAAA,aAAA,KAAAA,KAAAA,CAAAA,GAAAA,aAAA,GAAI,CAAE;AAACI,UAAAA,QAAQ,EAAEvD,aAAAA;SAAgB,CAAA;OACvE,CAAC,GACR,IAAI,CAAA;KACR;AACFM,IAAAA,MAAM,EAAEA,MAAAA;GACJC,EAAAA,WAAW,CAChB,CAAC,CAAA;AAEN,CAAC,CAAA;AAEKuC,IAAAA,QAAQ,gBAAGU,wBAAwB,eAAC7C,cAAK,CAAC8C,UAAU,CAAC9E,SAAS,CAAC,EAAE;AACrE+E,EAAAA,WAAW,EAAE,UAAA;AACf,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 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 } 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} & 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 ...styledProps\n },\n ref,\n) => {\n const inputRef = React.useRef<BladeElementRef>(null);\n const mergedRef = useMergeRefs(ref, inputRef);\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 // 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 componentName={MetaConstants.TextArea}\n autoFocus={autoFocus}\n ref={mergedRef}\n label={label as string}\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 interactionElement={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 onChange?.({ name, value });\n }}\n onFocus={onFocus}\n onBlur={onBlur}\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","styledProps","_objectWithoutProperties","_excluded","inputRef","React","useRef","mergedRef","useMergeRefs","_React$useState","useState","_React$useState2","_slicedToArray","shouldShowClearButton","setShouldShowClearButton","useEffect","Boolean","length","renderInteractionElement","_jsx","BaseBox","paddingTop","marginTop","children","IconButton","icon","CloseIcon","onClick","_inputRef$current","isEmpty","current","clear","focus","HTMLTextAreaElement","BaseInput","_objectSpread","as","id","componentName","MetaConstants","TextArea","hideLabelText","interactionElement","_ref2","trailingFooterSlot","_value$length","hintMarginTop","marginRight","CharacterCounter","currentCount","maxCount","assignWithoutSideEffects","forwardRef","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoFA;AACA;AACA,IAAMA,aAAa,GAAG,SAAhBA,aAAaA,CAAIC,aAAkB,EAA4C;AACnF,EAAA,OAAOC,eAAe,EAAE,KAAK,cAAc,CAAA;AAC7C,CAAC,CAAA;AAED,IAAMC,SAAyE,GAAG,SAA5EA,SAAyEA,CAAAC,IAAA,EA6B7EC,GAAG,EACA;AAAA,EAAA,IA5BDC,KAAK,GAAAF,IAAA,CAALE,KAAK;IACLC,kBAAkB,GAAAH,IAAA,CAAlBG,kBAAkB;IAClBC,aAAa,GAAAJ,IAAA,CAAbI,aAAa;IACbC,kBAAkB,GAAAL,IAAA,CAAlBK,kBAAkB;IAClBC,SAAS,GAAAN,IAAA,CAATM,SAAS;IACTC,QAAQ,GAAAP,IAAA,CAARO,QAAQ;IACRC,WAAW,GAAAR,IAAA,CAAXQ,WAAW;IACXC,eAAe,GAAAT,IAAA,CAAfS,eAAe;IACfC,YAAY,GAAAV,IAAA,CAAZU,YAAY;IACZC,UAAU,GAAAX,IAAA,CAAVW,UAAU;IACVC,UAAU,GAAAZ,IAAA,CAAVY,UAAU;IACVC,IAAI,GAAAb,IAAA,CAAJa,IAAI;IACJC,SAAQ,GAAAd,IAAA,CAARc,QAAQ;IACRC,OAAO,GAAAf,IAAA,CAAPe,OAAO;IACPC,MAAM,GAAAhB,IAAA,CAANgB,MAAM;IACNC,QAAQ,GAAAjB,IAAA,CAARiB,QAAQ;IACRC,WAAW,GAAAlB,IAAA,CAAXkB,WAAW;IACXC,KAAK,GAAAnB,IAAA,CAALmB,KAAK;IACLC,aAAa,GAAApB,IAAA,CAAboB,aAAa;IACbC,eAAe,GAAArB,IAAA,CAAfqB,eAAe;IACfC,kBAAkB,GAAAtB,IAAA,CAAl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;KACR;AACFM,IAAAA,MAAM,EAAEA,MAAO;AACfE,IAAAA,IAAI,EAAEA,IAAAA;GACFC,EAAAA,WAAW,CAChB,CAAC,CAAA;AAEN,CAAC,CAAA;AAEKuC,IAAAA,QAAQ,gBAAGW,wBAAwB,eAAC9C,cAAK,CAAC+C,UAAU,CAACjF,SAAS,CAAC,EAAE;AACrEkF,EAAAA,WAAW,EAAE,UAAA;AACf,CAAC;;;;"}
@@ -13,6 +13,7 @@ import '../../Spinner/index.js';
13
13
  import '../../../utils/assignWithoutSideEffects/index.js';
14
14
  import '../../../utils/index.js';
15
15
  import { useMergeRefs } from '../../../utils/useMergeRefs.js';
16
+ import { hintMarginTop } from '../../Form/formTokens.js';
16
17
  import { jsx } from 'react/jsx-runtime';
17
18
  import { getPlatformType } from '../../../utils/getPlatformType/getPlatformType.js';
18
19
  import { Spinner } from '../../Spinner/Spinner/Spinner.js';
@@ -24,7 +25,7 @@ import { BaseBox } from '../../Box/BaseBox/BaseBox.web.js';
24
25
  import { CharacterCounter } from '../../Form/CharacterCounter/CharacterCounter.js';
25
26
  import { assignWithoutSideEffects } from '../../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
26
27
 
27
- 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"];
28
+ 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"];
28
29
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
29
30
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
30
31
  var getKeyboardAndAutocompleteProps = function getKeyboardAndAutocompleteProps(_ref) {
@@ -138,6 +139,10 @@ var _TextInput = function _TextInput(_ref2, ref) {
138
139
  autoCompleteSuggestionType = _ref2.autoCompleteSuggestionType,
139
140
  autoCapitalize = _ref2.autoCapitalize,
140
141
  testID = _ref2.testID,
142
+ _ref2$size = _ref2.size,
143
+ size = _ref2$size === void 0 ? 'medium' : _ref2$size,
144
+ leadingIcon = _ref2.leadingIcon,
145
+ trailingIcon = _ref2.trailingIcon,
141
146
  styledProps = _objectWithoutProperties(_ref2, _excluded);
142
147
  var textInputRef = React__default.useRef(null);
143
148
  var mergedRef = useMergeRefs(ref, textInputRef);
@@ -151,7 +156,8 @@ var _TextInput = function _TextInput(_ref2, ref) {
151
156
  var renderInteractionElement = function renderInteractionElement() {
152
157
  if (isLoading) {
153
158
  return /*#__PURE__*/jsx(Spinner, {
154
- accessibilityLabel: "Loading Content"
159
+ accessibilityLabel: "Loading Content",
160
+ color: "primary"
155
161
  });
156
162
  }
157
163
  if (shouldShowClearButton) {
@@ -175,6 +181,7 @@ var _TextInput = function _TextInput(_ref2, ref) {
175
181
  textInputRef === null || textInputRef === void 0 ? void 0 : (_textInputRef$current = textInputRef.current) === null || _textInputRef$current === void 0 ? void 0 : _textInputRef$current.focus();
176
182
  setShouldShowClearButton(false);
177
183
  },
184
+ isDisabled: isDisabled,
178
185
  accessibilityLabel: "Clear Input Content"
179
186
  });
180
187
  }
@@ -216,9 +223,10 @@ var _TextInput = function _TextInput(_ref2, ref) {
216
223
  isDisabled: isDisabled,
217
224
  necessityIndicator: necessityIndicator,
218
225
  isRequired: isRequired,
219
- leadingIcon: icon,
226
+ leadingIcon: leadingIcon !== null && leadingIcon !== void 0 ? leadingIcon : icon,
220
227
  prefix: prefix,
221
228
  interactionElement: renderInteractionElement(),
229
+ trailingIcon: trailingIcon,
222
230
  suffix: suffix,
223
231
  validationState: validationState,
224
232
  errorText: errorText,
@@ -227,11 +235,12 @@ var _TextInput = function _TextInput(_ref2, ref) {
227
235
  trailingFooterSlot: function trailingFooterSlot(value) {
228
236
  var _value$length;
229
237
  return maxCharacters ? /*#__PURE__*/jsx(BaseBox, {
230
- marginTop: "spacing.2",
238
+ marginTop: hintMarginTop[size],
231
239
  marginRight: "spacing.1",
232
240
  children: /*#__PURE__*/jsx(CharacterCounter, {
233
241
  currentCount: (_value$length = value === null || value === void 0 ? void 0 : value.length) !== null && _value$length !== void 0 ? _value$length : 0,
234
- maxCount: maxCharacters
242
+ maxCount: maxCharacters,
243
+ size: size
235
244
  })
236
245
  }) : null;
237
246
  }
@@ -244,7 +253,9 @@ var _TextInput = function _TextInput(_ref2, ref) {
244
253
  keyboardReturnKeyType: keyboardReturnKeyType,
245
254
  autoCompleteSuggestionType: autoCompleteSuggestionType,
246
255
  autoCapitalize: autoCapitalize
247
- })), styledProps));
256
+ })), {}, {
257
+ size: size
258
+ }, styledProps));
248
259
  };
249
260
  var TextInput = /*#__PURE__*/assignWithoutSideEffects( /*#__PURE__*/React__default.forwardRef(_TextInput), {
250
261
  displayName: 'TextInput'