@razorpay/blade 12.37.0 → 12.39.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. package/build/lib/native/components/Accordion/AccordionItem.js +1 -1
  2. package/build/lib/native/components/Accordion/AccordionItem.js.map +1 -1
  3. package/build/lib/native/components/Alert/Alert.js +2 -1
  4. package/build/lib/native/components/Alert/Alert.js.map +1 -1
  5. package/build/lib/native/components/Card/Card.js +1 -1
  6. package/build/lib/native/components/Card/Card.js.map +1 -1
  7. package/build/lib/native/components/Card/CardContext.js +2 -2
  8. package/build/lib/native/components/Card/CardContext.js.map +1 -1
  9. package/build/lib/native/components/Card/CardFooter.js +2 -1
  10. package/build/lib/native/components/Card/CardFooter.js.map +1 -1
  11. package/build/lib/native/components/Card/CardHeader.js +3 -3
  12. package/build/lib/native/components/Card/CardHeader.js.map +1 -1
  13. package/build/lib/native/components/Chip/Chip.js +1 -1
  14. package/build/lib/native/components/Chip/Chip.js.map +1 -1
  15. package/build/lib/native/components/Form/FormLabel.js +1 -1
  16. package/build/lib/native/components/Form/FormLabel.js.map +1 -1
  17. package/build/lib/native/components/Input/BaseInput/BaseInput.js +1 -1
  18. package/build/lib/native/components/Input/BaseInput/BaseInput.js.map +1 -1
  19. package/build/lib/native/components/Input/BaseInput/BaseInputVisuals.js +1 -1
  20. package/build/lib/native/components/Input/BaseInput/BaseInputVisuals.js.map +1 -1
  21. package/build/lib/native/components/Input/OTPInput/OTPInput.js +1 -1
  22. package/build/lib/native/components/Input/OTPInput/OTPInput.js.map +1 -1
  23. package/build/lib/native/components/Input/PasswordInput/PasswordInput.js +1 -1
  24. package/build/lib/native/components/Input/PasswordInput/PasswordInput.js.map +1 -1
  25. package/build/lib/native/components/Input/SearchInput/SearchInput.js +1 -1
  26. package/build/lib/native/components/Input/SearchInput/SearchInput.js.map +1 -1
  27. package/build/lib/native/components/Input/TextArea/TextArea.js +1 -1
  28. package/build/lib/native/components/Input/TextArea/TextArea.js.map +1 -1
  29. package/build/lib/native/components/Input/TextInput/TextInput.js +1 -1
  30. package/build/lib/native/components/Input/TextInput/TextInput.js.map +1 -1
  31. package/build/lib/native/components/List/ListItem.js +1 -1
  32. package/build/lib/native/components/List/ListItem.js.map +1 -1
  33. package/build/lib/native/components/QuickFilters/QuickFilter.js +1 -1
  34. package/build/lib/native/components/QuickFilters/QuickFilter.js.map +1 -1
  35. package/build/lib/native/utils/makeAnalyticsAttribute/makeAnalyticsConstants.js +4 -0
  36. package/build/lib/native/utils/makeAnalyticsAttribute/makeAnalyticsConstants.js.map +1 -0
  37. package/build/lib/web/development/components/Accordion/AccordionButton.web.js +5 -7
  38. package/build/lib/web/development/components/Accordion/AccordionButton.web.js.map +1 -1
  39. package/build/lib/web/development/components/Accordion/AccordionItem.js +7 -5
  40. package/build/lib/web/development/components/Accordion/AccordionItem.js.map +1 -1
  41. package/build/lib/web/development/components/Alert/Alert.js +2 -0
  42. package/build/lib/web/development/components/Alert/Alert.js.map +1 -1
  43. package/build/lib/web/development/components/Avatar/AvatarButton.js +3 -0
  44. package/build/lib/web/development/components/Avatar/AvatarButton.js.map +1 -1
  45. package/build/lib/web/development/components/Card/Card.js +4 -1
  46. package/build/lib/web/development/components/Card/Card.js.map +1 -1
  47. package/build/lib/web/development/components/Card/CardContext.js +11 -6
  48. package/build/lib/web/development/components/Card/CardContext.js.map +1 -1
  49. package/build/lib/web/development/components/Card/CardFooter.js +3 -0
  50. package/build/lib/web/development/components/Card/CardFooter.js.map +1 -1
  51. package/build/lib/web/development/components/Card/CardHeader.js +38 -44
  52. package/build/lib/web/development/components/Card/CardHeader.js.map +1 -1
  53. package/build/lib/web/development/components/Chip/Chip.js +5 -5
  54. package/build/lib/web/development/components/Chip/Chip.js.map +1 -1
  55. package/build/lib/web/development/components/DatePicker/BaseDatePicker.web.js +6 -2
  56. package/build/lib/web/development/components/DatePicker/BaseDatePicker.web.js.map +1 -1
  57. package/build/lib/web/development/components/DatePicker/Calendar.web.js +4 -2
  58. package/build/lib/web/development/components/DatePicker/Calendar.web.js.map +1 -1
  59. package/build/lib/web/development/components/DatePicker/CalendarFooter.web.js +4 -0
  60. package/build/lib/web/development/components/DatePicker/CalendarFooter.web.js.map +1 -1
  61. package/build/lib/web/development/components/DatePicker/DateInput.web.js +10 -4
  62. package/build/lib/web/development/components/DatePicker/DateInput.web.js.map +1 -1
  63. package/build/lib/web/development/components/DatePicker/QuickSelection/PresetSideBar.web.js +1 -0
  64. package/build/lib/web/development/components/DatePicker/QuickSelection/PresetSideBar.web.js.map +1 -1
  65. package/build/lib/web/development/components/DatePicker/QuickSelection/QuickSelectionItem.web.js +2 -1
  66. package/build/lib/web/development/components/DatePicker/QuickSelection/QuickSelectionItem.web.js.map +1 -1
  67. package/build/lib/web/development/components/FileUpload/FileUploadItem.js +3 -0
  68. package/build/lib/web/development/components/FileUpload/FileUploadItem.js.map +1 -1
  69. package/build/lib/web/development/components/Form/FormLabel.js +24 -4
  70. package/build/lib/web/development/components/Form/FormLabel.js.map +1 -1
  71. package/build/lib/web/development/components/Input/BaseInput/BaseInput.js +6 -2
  72. package/build/lib/web/development/components/Input/BaseInput/BaseInput.js.map +1 -1
  73. package/build/lib/web/development/components/Input/BaseInput/BaseInputVisuals.js +1 -1
  74. package/build/lib/web/development/components/Input/BaseInput/BaseInputVisuals.js.map +1 -1
  75. package/build/lib/web/development/components/Input/OTPInput/OTPInput.js +5 -1
  76. package/build/lib/web/development/components/Input/OTPInput/OTPInput.js.map +1 -1
  77. package/build/lib/web/development/components/Input/PasswordInput/PasswordInput.js +5 -1
  78. package/build/lib/web/development/components/Input/PasswordInput/PasswordInput.js.map +1 -1
  79. package/build/lib/web/development/components/Input/PhoneNumberInput/PhoneNumberInput.web.js +5 -1
  80. package/build/lib/web/development/components/Input/PhoneNumberInput/PhoneNumberInput.web.js.map +1 -1
  81. package/build/lib/web/development/components/Input/SearchInput/SearchInput.js +5 -1
  82. package/build/lib/web/development/components/Input/SearchInput/SearchInput.js.map +1 -1
  83. package/build/lib/web/development/components/Input/TextArea/TextArea.js +5 -1
  84. package/build/lib/web/development/components/Input/TextArea/TextArea.js.map +1 -1
  85. package/build/lib/web/development/components/Input/TextInput/TextInput.js +5 -1
  86. package/build/lib/web/development/components/Input/TextInput/TextInput.js.map +1 -1
  87. package/build/lib/web/development/components/List/ListItem.js +1 -1
  88. package/build/lib/web/development/components/List/ListItem.js.map +1 -1
  89. package/build/lib/web/development/components/Modal/Modal.web.js +6 -7
  90. package/build/lib/web/development/components/Modal/Modal.web.js.map +1 -1
  91. package/build/lib/web/development/components/Preview/Preview.web.js +8 -7
  92. package/build/lib/web/development/components/Preview/Preview.web.js.map +1 -1
  93. package/build/lib/web/development/components/QuickFilters/QuickFilter.js +9 -7
  94. package/build/lib/web/development/components/QuickFilters/QuickFilter.js.map +1 -1
  95. package/build/lib/web/development/components/SpotlightPopoverTour/TourFooter.web.js +12 -2
  96. package/build/lib/web/development/components/SpotlightPopoverTour/TourFooter.web.js.map +1 -1
  97. package/build/lib/web/development/components/Table/Table.web.js +6 -3
  98. package/build/lib/web/development/components/Table/Table.web.js.map +1 -1
  99. package/build/lib/web/development/components/Table/TableBody.web.js +5 -3
  100. package/build/lib/web/development/components/Table/TableBody.web.js.map +1 -1
  101. package/build/lib/web/development/components/Table/TableEditableCell.web.js +11 -8
  102. package/build/lib/web/development/components/Table/TableEditableCell.web.js.map +1 -1
  103. package/build/lib/web/development/components/Table/TableHeader.web.js +4 -2
  104. package/build/lib/web/development/components/Table/TableHeader.web.js.map +1 -1
  105. package/build/lib/web/development/components/Table/TablePagination.web.js +12 -6
  106. package/build/lib/web/development/components/Table/TablePagination.web.js.map +1 -1
  107. package/build/lib/web/development/components/Table/TableToolbar.web.js +5 -8
  108. package/build/lib/web/development/components/Table/TableToolbar.web.js.map +1 -1
  109. package/build/lib/web/development/components/Toast/Toast.web.js +2 -0
  110. package/build/lib/web/development/components/Toast/Toast.web.js.map +1 -1
  111. package/build/lib/web/development/utils/makeAnalyticsAttribute/index.js +1 -0
  112. package/build/lib/web/development/utils/makeAnalyticsAttribute/index.js.map +1 -1
  113. package/build/lib/web/development/utils/makeAnalyticsAttribute/makeAnalyticsConstants.js +32 -0
  114. package/build/lib/web/development/utils/makeAnalyticsAttribute/makeAnalyticsConstants.js.map +1 -0
  115. package/build/lib/web/production/components/Accordion/AccordionButton.web.js +5 -7
  116. package/build/lib/web/production/components/Accordion/AccordionButton.web.js.map +1 -1
  117. package/build/lib/web/production/components/Accordion/AccordionItem.js +7 -5
  118. package/build/lib/web/production/components/Accordion/AccordionItem.js.map +1 -1
  119. package/build/lib/web/production/components/Alert/Alert.js +2 -0
  120. package/build/lib/web/production/components/Alert/Alert.js.map +1 -1
  121. package/build/lib/web/production/components/Avatar/AvatarButton.js +3 -0
  122. package/build/lib/web/production/components/Avatar/AvatarButton.js.map +1 -1
  123. package/build/lib/web/production/components/Card/Card.js +4 -1
  124. package/build/lib/web/production/components/Card/Card.js.map +1 -1
  125. package/build/lib/web/production/components/Card/CardContext.js +11 -6
  126. package/build/lib/web/production/components/Card/CardContext.js.map +1 -1
  127. package/build/lib/web/production/components/Card/CardFooter.js +3 -0
  128. package/build/lib/web/production/components/Card/CardFooter.js.map +1 -1
  129. package/build/lib/web/production/components/Card/CardHeader.js +38 -44
  130. package/build/lib/web/production/components/Card/CardHeader.js.map +1 -1
  131. package/build/lib/web/production/components/Chip/Chip.js +5 -5
  132. package/build/lib/web/production/components/Chip/Chip.js.map +1 -1
  133. package/build/lib/web/production/components/DatePicker/BaseDatePicker.web.js +6 -2
  134. package/build/lib/web/production/components/DatePicker/BaseDatePicker.web.js.map +1 -1
  135. package/build/lib/web/production/components/DatePicker/Calendar.web.js +4 -2
  136. package/build/lib/web/production/components/DatePicker/Calendar.web.js.map +1 -1
  137. package/build/lib/web/production/components/DatePicker/CalendarFooter.web.js +4 -0
  138. package/build/lib/web/production/components/DatePicker/CalendarFooter.web.js.map +1 -1
  139. package/build/lib/web/production/components/DatePicker/DateInput.web.js +10 -4
  140. package/build/lib/web/production/components/DatePicker/DateInput.web.js.map +1 -1
  141. package/build/lib/web/production/components/DatePicker/QuickSelection/PresetSideBar.web.js +1 -0
  142. package/build/lib/web/production/components/DatePicker/QuickSelection/PresetSideBar.web.js.map +1 -1
  143. package/build/lib/web/production/components/DatePicker/QuickSelection/QuickSelectionItem.web.js +2 -1
  144. package/build/lib/web/production/components/DatePicker/QuickSelection/QuickSelectionItem.web.js.map +1 -1
  145. package/build/lib/web/production/components/FileUpload/FileUploadItem.js +3 -0
  146. package/build/lib/web/production/components/FileUpload/FileUploadItem.js.map +1 -1
  147. package/build/lib/web/production/components/Form/FormLabel.js +24 -4
  148. package/build/lib/web/production/components/Form/FormLabel.js.map +1 -1
  149. package/build/lib/web/production/components/Input/BaseInput/BaseInput.js +6 -2
  150. package/build/lib/web/production/components/Input/BaseInput/BaseInput.js.map +1 -1
  151. package/build/lib/web/production/components/Input/BaseInput/BaseInputVisuals.js +1 -1
  152. package/build/lib/web/production/components/Input/BaseInput/BaseInputVisuals.js.map +1 -1
  153. package/build/lib/web/production/components/Input/OTPInput/OTPInput.js +5 -1
  154. package/build/lib/web/production/components/Input/OTPInput/OTPInput.js.map +1 -1
  155. package/build/lib/web/production/components/Input/PasswordInput/PasswordInput.js +5 -1
  156. package/build/lib/web/production/components/Input/PasswordInput/PasswordInput.js.map +1 -1
  157. package/build/lib/web/production/components/Input/PhoneNumberInput/PhoneNumberInput.web.js +5 -1
  158. package/build/lib/web/production/components/Input/PhoneNumberInput/PhoneNumberInput.web.js.map +1 -1
  159. package/build/lib/web/production/components/Input/SearchInput/SearchInput.js +5 -1
  160. package/build/lib/web/production/components/Input/SearchInput/SearchInput.js.map +1 -1
  161. package/build/lib/web/production/components/Input/TextArea/TextArea.js +5 -1
  162. package/build/lib/web/production/components/Input/TextArea/TextArea.js.map +1 -1
  163. package/build/lib/web/production/components/Input/TextInput/TextInput.js +5 -1
  164. package/build/lib/web/production/components/Input/TextInput/TextInput.js.map +1 -1
  165. package/build/lib/web/production/components/List/ListItem.js +1 -1
  166. package/build/lib/web/production/components/List/ListItem.js.map +1 -1
  167. package/build/lib/web/production/components/Modal/Modal.web.js +6 -7
  168. package/build/lib/web/production/components/Modal/Modal.web.js.map +1 -1
  169. package/build/lib/web/production/components/Preview/Preview.web.js +8 -7
  170. package/build/lib/web/production/components/Preview/Preview.web.js.map +1 -1
  171. package/build/lib/web/production/components/QuickFilters/QuickFilter.js +9 -7
  172. package/build/lib/web/production/components/QuickFilters/QuickFilter.js.map +1 -1
  173. package/build/lib/web/production/components/SpotlightPopoverTour/TourFooter.web.js +12 -2
  174. package/build/lib/web/production/components/SpotlightPopoverTour/TourFooter.web.js.map +1 -1
  175. package/build/lib/web/production/components/Table/Table.web.js +6 -3
  176. package/build/lib/web/production/components/Table/Table.web.js.map +1 -1
  177. package/build/lib/web/production/components/Table/TableBody.web.js +5 -3
  178. package/build/lib/web/production/components/Table/TableBody.web.js.map +1 -1
  179. package/build/lib/web/production/components/Table/TableEditableCell.web.js +11 -8
  180. package/build/lib/web/production/components/Table/TableEditableCell.web.js.map +1 -1
  181. package/build/lib/web/production/components/Table/TableHeader.web.js +4 -2
  182. package/build/lib/web/production/components/Table/TableHeader.web.js.map +1 -1
  183. package/build/lib/web/production/components/Table/TablePagination.web.js +12 -6
  184. package/build/lib/web/production/components/Table/TablePagination.web.js.map +1 -1
  185. package/build/lib/web/production/components/Table/TableToolbar.web.js +5 -8
  186. package/build/lib/web/production/components/Table/TableToolbar.web.js.map +1 -1
  187. package/build/lib/web/production/components/Toast/Toast.web.js +2 -0
  188. package/build/lib/web/production/components/Toast/Toast.web.js.map +1 -1
  189. package/build/lib/web/production/utils/makeAnalyticsAttribute/index.js +1 -0
  190. package/build/lib/web/production/utils/makeAnalyticsAttribute/index.js.map +1 -1
  191. package/build/lib/web/production/utils/makeAnalyticsAttribute/makeAnalyticsConstants.js +32 -0
  192. package/build/lib/web/production/utils/makeAnalyticsAttribute/makeAnalyticsConstants.js.map +1 -0
  193. package/build/types/components/index.d.ts +44 -11
  194. package/build/types/components/index.native.d.ts +40 -9
  195. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"SearchInput.js","sources":["../../../../../../../src/components/Input/SearchInput/SearchInput.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport type { ReactElement, ReactNode } from 'react';\nimport type { TextInput as TextInputReactNative } from 'react-native';\nimport type { BaseInputProps } from '../BaseInput';\nimport { BaseInput } from '../BaseInput';\nimport { getKeyboardAndAutocompleteProps } from '../BaseInput/utils';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport { CloseIcon, SearchIcon } from '~components/Icons';\nimport { IconButton } from '~components/Button/IconButton';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { MetaConstants } from '~utils/metaAttribute';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Spinner } from '~components/Spinner';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getPlatformType } from '~utils';\nimport { useMergeRefs } from '~utils/useMergeRefs';\nimport type {\n BladeElementRef,\n BladeElementRefWithValue,\n DataAnalyticsAttribute,\n} from '~utils/types';\nimport { dropdownComponentIds } from '~components/Dropdown/dropdownComponentIds';\nimport { useDropdown } from '~components/Dropdown/useDropdown';\nimport { DropdownOverlay, InputDropdownButton } from '~components/Dropdown';\nimport { Divider } from '~components/Divider';\nimport { getComponentId } from '~utils/isValidAllowedChildren';\n\ntype SearchInputCommonProps = Pick<\n BaseInputProps,\n | 'label'\n | 'accessibilityLabel'\n | 'labelPosition'\n | 'helpText'\n | 'placeholder'\n | 'defaultValue'\n | 'name'\n | 'onChange'\n | 'onFocus'\n | 'onBlur'\n | 'value'\n | 'isDisabled'\n | 'autoFocus'\n | 'onSubmit'\n | 'autoCapitalize'\n | 'testID'\n | 'onClick'\n | 'size'\n | keyof DataAnalyticsAttribute\n> & {\n /**\n * Event handler to handle the onClick event for clear button.\n */\n onClearButtonClick?: () => void;\n\n /**\n * Decides whether to show a loading spinner for the input field.\n */\n isLoading?: boolean;\n /**\n * Toggle the visibility of the search icon.\n *\n * @default true\n */\n showSearchIcon?: boolean;\n /**\n * Optional trailing to be shown at the end of the input.\n */\n trailing?: React.ReactNode;\n} & StyledPropsBlade;\n\n/*\n Mandatory accessibilityLabel prop when label is not provided\n*/\ntype SearchInputPropsWithA11yLabel = {\n /**\n * Label to be shown for the input field\n */\n label?: undefined;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel: string;\n};\n\n/*\n Optional accessibilityLabel prop when label is provided\n*/\ntype SearchInputPropsWithLabel = {\n /**\n * Label to be shown for the input field\n */\n label: string;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel?: string;\n};\n\ntype SearchInputProps = (SearchInputPropsWithA11yLabel | SearchInputPropsWithLabel) &\n SearchInputCommonProps;\n\n// need to do this to tell TS to infer type as SearchInput of React Native and make it believe that `ref.current.clear()` exists\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst isReactNative = (_textInputRef?: any): _textInputRef is TextInputReactNative => {\n return getPlatformType() === 'react-native';\n};\n\nconst _SearchInput: React.ForwardRefRenderFunction<BladeElementRef, SearchInputProps> = (\n {\n label,\n accessibilityLabel,\n labelPosition = 'top',\n placeholder,\n defaultValue,\n name,\n value,\n onChange,\n onClick,\n onFocus,\n onBlur,\n onSubmit,\n isDisabled,\n helpText,\n onClearButtonClick,\n isLoading,\n autoCapitalize,\n autoFocus,\n testID,\n size = 'medium',\n showSearchIcon = true,\n trailing,\n ...rest\n },\n ref,\n): ReactElement => {\n const textInputRef = React.useRef<BladeElementRefWithValue>(null);\n const mergedRef = useMergeRefs(ref, textInputRef);\n const [shouldShowClearButton, setShouldShowClearButton] = useState(false);\n const [isTrailingDropDownOpen, setIsTrailingDropDownOpen] = useState(false);\n const {\n triggererWrapperRef,\n onTriggerKeydown,\n onTriggerClick,\n dropdownTriggerer,\n close: closeParentDropDown,\n isOpen: isParentDropDownOpen,\n } = useDropdown();\n const isInsideDropdown = dropdownTriggerer === 'SearchInput';\n\n React.useEffect(() => {\n setShouldShowClearButton(Boolean(defaultValue ?? value));\n }, [defaultValue, value]);\n\n useEffect(() => {\n if (isParentDropDownOpen && isTrailingDropDownOpen) {\n setIsTrailingDropDownOpen(false);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [closeParentDropDown, isParentDropDownOpen]);\n\n useEffect(() => {\n if (isTrailingDropDownOpen && isParentDropDownOpen) {\n closeParentDropDown();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [setIsTrailingDropDownOpen, isTrailingDropDownOpen]);\n\n const trailingDropdown =\n trailing && getComponentId(trailing as React.ReactElement) === 'Dropdown' ? trailing : null;\n\n const renderTrailingDropDown = (): React.ReactElement | null => {\n if (!trailingDropdown) {\n return null;\n }\n return React.cloneElement(trailingDropdown as React.ReactElement, {\n selectionType: 'single',\n isOpen: isTrailingDropDownOpen,\n onOpenChange: (isOpen: boolean) => {\n setIsTrailingDropDownOpen(isOpen);\n },\n children: React.Children.map(\n (trailingDropdown as React.ReactElement).props.children,\n (child) => {\n if (child.type === InputDropdownButton) {\n return React.cloneElement(child, {\n _isInsideSearchInput: true,\n });\n }\n if (child.type === DropdownOverlay) {\n return React.cloneElement(child, {\n referenceRef: triggererWrapperRef,\n _isNestedDropdown: true,\n defaultPlacement: 'bottom-end',\n });\n }\n return child;\n },\n ),\n });\n };\n\n const renderClearButton = (): React.ReactElement => {\n return (\n <IconButton\n size=\"medium\"\n icon={CloseIcon}\n onClick={() => {\n if (isEmpty(value) && textInputRef.current) {\n // when the input field is uncontrolled take the ref and clear the input and then call the onClearButtonClick function\n if (isReactNative(textInputRef.current)) {\n textInputRef.current.clear();\n textInputRef.current.focus();\n } else if (textInputRef.current instanceof HTMLInputElement) {\n textInputRef.current.value = '';\n textInputRef.current.focus();\n }\n }\n\n // if the input field is controlled just call the click handler and the value change shall be left upto the consumer\n onClearButtonClick?.();\n textInputRef?.current?.focus();\n setShouldShowClearButton(false);\n }}\n isDisabled={isDisabled}\n accessibilityLabel=\"Clear Input Content\"\n />\n );\n };\n\n const renderInteractionElement = (): ReactNode => {\n if (isLoading) {\n return <Spinner accessibilityLabel=\"Loading Content\" color=\"primary\" />;\n }\n\n if (shouldShowClearButton && trailingDropdown) {\n return (\n <BaseBox display=\"flex\" gap=\"spacing.3\">\n {renderClearButton()} <Divider orientation=\"vertical\" />\n </BaseBox>\n );\n }\n if (shouldShowClearButton) {\n return renderClearButton();\n }\n\n return null;\n };\n\n return (\n <BaseBox position=\"relative\">\n <BaseInput\n id=\"searchinput\"\n componentName={MetaConstants.SearchInput}\n ref={mergedRef}\n isDropdownTrigger={true}\n setInputWrapperRef={\n isInsideDropdown || isTrailingDropDownOpen\n ? (wrapperNode) => {\n triggererWrapperRef.current = wrapperNode;\n }\n : undefined\n }\n label={label as string}\n accessibilityLabel={accessibilityLabel}\n hideLabelText={!Boolean(label)}\n labelPosition={labelPosition}\n placeholder={placeholder}\n defaultValue={defaultValue}\n value={value}\n name={name}\n onKeyDown={isInsideDropdown ? onTriggerKeydown : undefined}\n onChange={({ name, value }) => {\n if (value?.length) {\n // show the clear button when the user starts typing in\n setShouldShowClearButton(true);\n }\n\n if (shouldShowClearButton && !value?.length) {\n // hide the clear button when the input field is empty\n setShouldShowClearButton(false);\n }\n\n onChange?.({ name, value });\n }}\n onClick={(e) => {\n if (isDisabled) return;\n if (isInsideDropdown) {\n onTriggerClick();\n }\n onClick?.(e);\n }}\n onFocus={onFocus}\n onBlur={onBlur}\n onSubmit={onSubmit}\n isDisabled={isDisabled}\n leadingIcon={showSearchIcon ? SearchIcon : undefined}\n trailingInteractionElement={renderInteractionElement()}\n trailingDropDown={renderTrailingDropDown()}\n helpText={helpText}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n testID={testID}\n {...getKeyboardAndAutocompleteProps({\n type: 'search',\n autoCapitalize,\n })}\n size={size}\n {...rest}\n />\n </BaseBox>\n );\n};\n\nconst SearchInput = assignWithoutSideEffects(React.forwardRef(_SearchInput), {\n displayName: 'SearchInput',\n componentId: dropdownComponentIds.triggers.SearchInput,\n});\n\nexport type { SearchInputProps };\nexport { SearchInput };\n"],"names":["isReactNative","_textInputRef","getPlatformType","_SearchInput","_ref","ref","label","accessibilityLabel","_ref$labelPosition","labelPosition","placeholder","defaultValue","name","value","onChange","onClick","onFocus","onBlur","onSubmit","isDisabled","helpText","onClearButtonClick","isLoading","autoCapitalize","autoFocus","testID","_ref$size","size","_ref$showSearchIcon","showSearchIcon","trailing","rest","_objectWithoutProperties","_excluded","textInputRef","React","useRef","mergedRef","useMergeRefs","_useState","useState","_useState2","_slicedToArray","shouldShowClearButton","setShouldShowClearButton","_useState3","_useState4","isTrailingDropDownOpen","setIsTrailingDropDownOpen","_useDropdown","useDropdown","triggererWrapperRef","onTriggerKeydown","onTriggerClick","dropdownTriggerer","closeParentDropDown","close","isParentDropDownOpen","isOpen","isInsideDropdown","useEffect","Boolean","trailingDropdown","getComponentId","renderTrailingDropDown","cloneElement","selectionType","onOpenChange","children","Children","map","props","child","type","InputDropdownButton","_isInsideSearchInput","DropdownOverlay","referenceRef","_isNestedDropdown","defaultPlacement","renderClearButton","_jsx","IconButton","icon","CloseIcon","_textInputRef$current","isEmpty","current","clear","focus","HTMLInputElement","renderInteractionElement","Spinner","color","_jsxs","BaseBox","display","gap","Divider","orientation","position","BaseInput","_objectSpread","id","componentName","MetaConstants","SearchInput","isDropdownTrigger","setInputWrapperRef","wrapperNode","undefined","hideLabelText","onKeyDown","_ref2","length","e","leadingIcon","SearchIcon","trailingInteractionElement","trailingDropDown","getKeyboardAndAutocompleteProps","assignWithoutSideEffects","forwardRef","displayName","componentId","dropdownComponentIds","triggers"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqGA;AACA;AACA,IAAMA,aAAa,GAAG,SAAhBA,aAAaA,CAAIC,aAAmB,EAA4C;AACpF,EAAA,OAA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wH,EAAAA,WAAW,EAAE,aAAa;AAC1BC,EAAAA,WAAW,EAAEC,oBAAoB,CAACC,QAAQ,CAACpB,WAAAA;AAC7C,CAAC;;;;"}
1
+ {"version":3,"file":"SearchInput.js","sources":["../../../../../../../src/components/Input/SearchInput/SearchInput.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport type { ReactElement, ReactNode } from 'react';\nimport type { TextInput as TextInputReactNative } from 'react-native';\nimport type { BaseInputProps } from '../BaseInput';\nimport { BaseInput } from '../BaseInput';\nimport { getKeyboardAndAutocompleteProps } from '../BaseInput/utils';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport { CloseIcon, SearchIcon } from '~components/Icons';\nimport { IconButton } from '~components/Button/IconButton';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { MetaConstants } from '~utils/metaAttribute';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Spinner } from '~components/Spinner';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getPlatformType } from '~utils';\nimport { useMergeRefs } from '~utils/useMergeRefs';\nimport type {\n BladeElementRef,\n BladeElementRefWithValue,\n DataAnalyticsAttribute,\n} from '~utils/types';\nimport { dropdownComponentIds } from '~components/Dropdown/dropdownComponentIds';\nimport { useDropdown } from '~components/Dropdown/useDropdown';\nimport { DropdownOverlay, InputDropdownButton } from '~components/Dropdown';\nimport { Divider } from '~components/Divider';\nimport { getComponentId } from '~utils/isValidAllowedChildren';\n\ntype SearchInputCommonProps = Pick<\n BaseInputProps,\n | 'label'\n | 'accessibilityLabel'\n | 'labelPosition'\n | 'labelSuffix'\n | 'labelTrailing'\n | 'helpText'\n | 'placeholder'\n | 'defaultValue'\n | 'name'\n | 'onChange'\n | 'onFocus'\n | 'onBlur'\n | 'value'\n | 'isDisabled'\n | 'autoFocus'\n | 'onSubmit'\n | 'autoCapitalize'\n | 'testID'\n | 'onClick'\n | 'size'\n | keyof DataAnalyticsAttribute\n> & {\n /**\n * Event handler to handle the onClick event for clear button.\n */\n onClearButtonClick?: () => void;\n\n /**\n * Decides whether to show a loading spinner for the input field.\n */\n isLoading?: boolean;\n /**\n * Toggle the visibility of the search icon.\n *\n * @default true\n */\n showSearchIcon?: boolean;\n /**\n * Optional trailing to be shown at the end of the input.\n */\n trailing?: React.ReactNode;\n} & StyledPropsBlade;\n\n/*\n Mandatory accessibilityLabel prop when label is not provided\n*/\ntype SearchInputPropsWithA11yLabel = {\n /**\n * Label to be shown for the input field\n */\n label?: undefined;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel: string;\n};\n\n/*\n Optional accessibilityLabel prop when label is provided\n*/\ntype SearchInputPropsWithLabel = {\n /**\n * Label to be shown for the input field\n */\n label: string;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel?: string;\n};\n\ntype SearchInputProps = (SearchInputPropsWithA11yLabel | SearchInputPropsWithLabel) &\n SearchInputCommonProps;\n\n// need to do this to tell TS to infer type as SearchInput of React Native and make it believe that `ref.current.clear()` exists\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst isReactNative = (_textInputRef?: any): _textInputRef is TextInputReactNative => {\n return getPlatformType() === 'react-native';\n};\n\nconst _SearchInput: React.ForwardRefRenderFunction<BladeElementRef, SearchInputProps> = (\n {\n label,\n accessibilityLabel,\n labelPosition = 'top',\n placeholder,\n defaultValue,\n name,\n value,\n onChange,\n onClick,\n onFocus,\n onBlur,\n onSubmit,\n isDisabled,\n labelSuffix,\n labelTrailing,\n helpText,\n onClearButtonClick,\n isLoading,\n autoCapitalize,\n autoFocus,\n testID,\n size = 'medium',\n showSearchIcon = true,\n trailing,\n ...rest\n },\n ref,\n): ReactElement => {\n const textInputRef = React.useRef<BladeElementRefWithValue>(null);\n const mergedRef = useMergeRefs(ref, textInputRef);\n const [shouldShowClearButton, setShouldShowClearButton] = useState(false);\n const [isTrailingDropDownOpen, setIsTrailingDropDownOpen] = useState(false);\n const {\n triggererWrapperRef,\n onTriggerKeydown,\n onTriggerClick,\n dropdownTriggerer,\n close: closeParentDropDown,\n isOpen: isParentDropDownOpen,\n } = useDropdown();\n const isInsideDropdown = dropdownTriggerer === 'SearchInput';\n\n React.useEffect(() => {\n setShouldShowClearButton(Boolean(defaultValue ?? value));\n }, [defaultValue, value]);\n\n useEffect(() => {\n if (isParentDropDownOpen && isTrailingDropDownOpen) {\n setIsTrailingDropDownOpen(false);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [closeParentDropDown, isParentDropDownOpen]);\n\n useEffect(() => {\n if (isTrailingDropDownOpen && isParentDropDownOpen) {\n closeParentDropDown();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [setIsTrailingDropDownOpen, isTrailingDropDownOpen]);\n\n const trailingDropdown =\n trailing && getComponentId(trailing as React.ReactElement) === 'Dropdown' ? trailing : null;\n\n const renderTrailingDropDown = (): React.ReactElement | null => {\n if (!trailingDropdown) {\n return null;\n }\n return React.cloneElement(trailingDropdown as React.ReactElement, {\n selectionType: 'single',\n isOpen: isTrailingDropDownOpen,\n onOpenChange: (isOpen: boolean) => {\n setIsTrailingDropDownOpen(isOpen);\n },\n children: React.Children.map(\n (trailingDropdown as React.ReactElement).props.children,\n (child) => {\n if (child.type === InputDropdownButton) {\n return React.cloneElement(child, {\n _isInsideSearchInput: true,\n });\n }\n if (child.type === DropdownOverlay) {\n return React.cloneElement(child, {\n referenceRef: triggererWrapperRef,\n _isNestedDropdown: true,\n defaultPlacement: 'bottom-end',\n });\n }\n return child;\n },\n ),\n });\n };\n\n const renderClearButton = (): React.ReactElement => {\n return (\n <IconButton\n size=\"medium\"\n icon={CloseIcon}\n onClick={() => {\n if (isEmpty(value) && textInputRef.current) {\n // when the input field is uncontrolled take the ref and clear the input and then call the onClearButtonClick function\n if (isReactNative(textInputRef.current)) {\n textInputRef.current.clear();\n textInputRef.current.focus();\n } else if (textInputRef.current instanceof HTMLInputElement) {\n textInputRef.current.value = '';\n textInputRef.current.focus();\n }\n }\n\n // if the input field is controlled just call the click handler and the value change shall be left upto the consumer\n onClearButtonClick?.();\n textInputRef?.current?.focus();\n setShouldShowClearButton(false);\n }}\n isDisabled={isDisabled}\n accessibilityLabel=\"Clear Input Content\"\n />\n );\n };\n\n const renderInteractionElement = (): ReactNode => {\n if (isLoading) {\n return <Spinner accessibilityLabel=\"Loading Content\" color=\"primary\" />;\n }\n\n if (shouldShowClearButton && trailingDropdown) {\n return (\n <BaseBox display=\"flex\" gap=\"spacing.3\">\n {renderClearButton()} <Divider orientation=\"vertical\" />\n </BaseBox>\n );\n }\n if (shouldShowClearButton) {\n return renderClearButton();\n }\n\n return null;\n };\n\n return (\n <BaseBox position=\"relative\">\n <BaseInput\n id=\"searchinput\"\n componentName={MetaConstants.SearchInput}\n ref={mergedRef}\n isDropdownTrigger={true}\n setInputWrapperRef={\n isInsideDropdown || isTrailingDropDownOpen\n ? (wrapperNode) => {\n triggererWrapperRef.current = wrapperNode;\n }\n : undefined\n }\n label={label as string}\n accessibilityLabel={accessibilityLabel}\n hideLabelText={!Boolean(label)}\n labelPosition={labelPosition}\n labelSuffix={labelSuffix}\n labelTrailing={labelTrailing}\n placeholder={placeholder}\n defaultValue={defaultValue}\n value={value}\n name={name}\n onKeyDown={isInsideDropdown ? onTriggerKeydown : undefined}\n onChange={({ name, value }) => {\n if (value?.length) {\n // show the clear button when the user starts typing in\n setShouldShowClearButton(true);\n }\n\n if (shouldShowClearButton && !value?.length) {\n // hide the clear button when the input field is empty\n setShouldShowClearButton(false);\n }\n\n onChange?.({ name, value });\n }}\n onClick={(e) => {\n if (isDisabled) return;\n if (isInsideDropdown) {\n onTriggerClick();\n }\n onClick?.(e);\n }}\n onFocus={onFocus}\n onBlur={onBlur}\n onSubmit={onSubmit}\n isDisabled={isDisabled}\n leadingIcon={showSearchIcon ? SearchIcon : undefined}\n trailingInteractionElement={renderInteractionElement()}\n trailingDropDown={renderTrailingDropDown()}\n helpText={helpText}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n testID={testID}\n {...getKeyboardAndAutocompleteProps({\n type: 'search',\n autoCapitalize,\n })}\n size={size}\n {...rest}\n />\n </BaseBox>\n );\n};\n\nconst SearchInput = assignWithoutSideEffects(React.forwardRef(_SearchInput), {\n displayName: 'SearchInput',\n componentId: dropdownComponentIds.triggers.SearchInput,\n});\n\nexport type { SearchInputProps };\nexport { SearchInput };\n"],"names":["isReactNative","_textInputRef","getPlatformType","_SearchInput","_ref","ref","label","accessibilityLabel","_ref$labelPosition","labelPosition","placeholder","defaultValue","name","value","onChange","onClick","onFocus","onBlur","onSubmit","isDisabled","labelSuffix","labelTrailing","helpText","onClearButtonClick","isLoading","autoCapitalize","autoFocus","testID","_ref$size","size","_ref$showSearchIcon","showSearchIcon","trailing","rest","_objectWithoutProperties","_excluded","textInputRef","React","useRef","mergedRef","useMergeRefs","_useState","useState","_useState2","_slicedToArray","shouldShowClearButton","setShouldShowClearButton","_useState3","_useState4","isTrailingDropDownOpen","setIsTrailingDropDownOpen","_useDropdown","useDropdown","triggererWrapperRef","onTriggerKeydown","onTriggerClick","dropdownTriggerer","closeParentDropDown","close","isParentDropDownOpen","isOpen","isInsideDropdown","useEffect","Boolean","trailingDropdown","getComponentId","renderTrailingDropDown","cloneElement","selectionType","onOpenChange","children","Children","map","props","child","type","InputDropdownButton","_isInsideSearchInput","DropdownOverlay","referenceRef","_isNestedDropdown","defaultPlacement","renderClearButton","_jsx","IconButton","icon","CloseIcon","_textInputRef$current","isEmpty","current","clear","focus","HTMLInputElement","renderInteractionElement","Spinner","color","_jsxs","BaseBox","display","gap","Divider","orientation","position","BaseInput","_objectSpread","id","componentName","MetaConstants","SearchInput","isDropdownTrigger","setInputWrapperRef","wrapperNode","undefined","hideLabelText","onKeyDown","_ref2","length","e","leadingIcon","SearchIcon","trailingInteractionElement","trailingDropDown","getKeyboardAndAutocompleteProps","assignWithoutSideEffects","forwardRef","displayName","componentId","dropdownComponentIds","triggers"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;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dA,cAAAA;AACF,KAAC,CAAC,CAAA,EAAA,EAAA,EAAA;AACFI,MAAAA,IAAI,EAAEA,IAAAA;AAAK,KAAA,EACPI,IAAI,CACT,CAAA;AAAC,GACK,CAAC,CAAA;AAEd,CAAC,CAAA;AAEK2E,IAAAA,WAAW,gBAAGe,wBAAwB,eAACtF,cAAK,CAACuF,UAAU,CAACzH,YAAY,CAAC,EAAE;AAC3E0H,EAAAA,WAAW,EAAE,aAAa;AAC1BC,EAAAA,WAAW,EAAEC,oBAAoB,CAACC,QAAQ,CAACpB,WAAAA;AAC7C,CAAC;;;;"}
@@ -24,7 +24,7 @@ import { MetaConstants } from '../../../utils/metaAttribute/metaConstants.js';
24
24
  import { CharacterCounter } from '../../Form/CharacterCounter/CharacterCounter.js';
25
25
  import { assignWithoutSideEffects } from '../../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
26
26
 
27
- var _excluded = ["label", "accessibilityLabel", "labelPosition", "necessityIndicator", "errorText", "helpText", "successText", "validationState", "defaultValue", "isDisabled", "isRequired", "name", "onChange", "onFocus", "onBlur", "onSubmit", "onKeyDown", "placeholder", "value", "maxCharacters", "showClearButton", "onClearButtonClick", "autoFocus", "numberOfLines", "testID", "size", "isTaggedInput", "tags", "onTagChange"];
27
+ var _excluded = ["label", "accessibilityLabel", "labelPosition", "labelSuffix", "labelTrailing", "necessityIndicator", "errorText", "helpText", "successText", "validationState", "defaultValue", "isDisabled", "isRequired", "name", "onChange", "onFocus", "onBlur", "onSubmit", "onKeyDown", "placeholder", "value", "maxCharacters", "showClearButton", "onClearButtonClick", "autoFocus", "numberOfLines", "testID", "size", "isTaggedInput", "tags", "onTagChange"];
28
28
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
29
29
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
30
30
  // need to do this to tell TS to infer type as TextInput of React Native and make it believe that `ref.current.clear()` exists
@@ -36,6 +36,8 @@ var _TextArea = function _TextArea(_ref, ref) {
36
36
  var label = _ref.label,
37
37
  accessibilityLabel = _ref.accessibilityLabel,
38
38
  labelPosition = _ref.labelPosition,
39
+ labelSuffix = _ref.labelSuffix,
40
+ labelTrailing = _ref.labelTrailing,
39
41
  necessityIndicator = _ref.necessityIndicator,
40
42
  errorText = _ref.errorText,
41
43
  helpText = _ref.helpText,
@@ -143,6 +145,8 @@ var _TextArea = function _TextArea(_ref, ref) {
143
145
  accessibilityLabel: accessibilityLabel,
144
146
  hideLabelText: !Boolean(label),
145
147
  labelPosition: labelPosition,
148
+ labelSuffix: labelSuffix,
149
+ labelTrailing: labelTrailing,
146
150
  necessityIndicator: necessityIndicator,
147
151
  errorText: errorText,
148
152
  helpText: helpText,
@@ -1 +1 @@
1
- {"version":3,"file":"TextArea.js","sources":["../../../../../../../src/components/Input/TextArea/TextArea.tsx"],"sourcesContent":["/* eslint-disable jsx-a11y/no-autofocus */\nimport React from 'react';\nimport type { TextInput as TextInputReactNative } from 'react-native';\nimport type { BaseInputProps } from '../BaseInput';\nimport { BaseInput } from '../BaseInput';\nimport type { TaggedInputProps } from '../BaseInput/useTaggedInput';\nimport { useTaggedInput } from '../BaseInput/useTaggedInput';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport { CloseIcon } from '~components/Icons';\nimport { IconButton } from '~components/Button/IconButton';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { MetaConstants } from '~utils/metaAttribute';\nimport { CharacterCounter } from '~components/Form/CharacterCounter';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getPlatformType } from '~utils';\nimport { useMergeRefs } from '~utils/useMergeRefs';\nimport type {\n BladeElementRef,\n BladeElementRefWithValue,\n DataAnalyticsAttribute,\n} from '~utils/types';\nimport { hintMarginTop } from '~components/Form/formTokens';\nimport type { FormInputOnKeyDownEvent } from '~components/Form/FormTypes';\n\ntype TextAreaCommonProps = Pick<\n BaseInputProps,\n | 'label'\n | 'accessibilityLabel'\n | 'labelPosition'\n | 'necessityIndicator'\n | 'validationState'\n | 'helpText'\n | 'errorText'\n | 'successText'\n | 'placeholder'\n | 'defaultValue'\n | 'name'\n | 'onChange'\n | 'onFocus'\n | 'onBlur'\n | 'onSubmit'\n | 'value'\n | 'isDisabled'\n | 'isRequired'\n | 'maxCharacters'\n | 'autoFocus'\n | 'numberOfLines'\n | 'testID'\n | 'size'\n | keyof DataAnalyticsAttribute\n> & {\n /**\n * Decides whether to render a clear icon button\n */\n showClearButton?: boolean;\n /**\n * Event handler to handle the onClick event for clear button. Used when `showClearButton` is `true`\n */\n onClearButtonClick?: () => void;\n\n onKeyDown?: ({\n name,\n value,\n event,\n }: {\n name?: FormInputOnKeyDownEvent['name'];\n value: string;\n event: FormInputOnKeyDownEvent['event'];\n }) => void;\n} & TaggedInputProps &\n StyledPropsBlade;\n\n/*\n Mandatory accessibilityLabel prop when label is not provided\n*/\ntype TextAreaPropsWithA11yLabel = {\n /**\n * Label to be shown for the input field\n */\n label?: undefined;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel: string;\n};\n\n/*\n Optional accessibilityLabel prop when label is provided\n*/\ntype TextAreaPropsWithLabel = {\n /**\n * Label to be shown for the input field\n */\n label: string;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel?: string;\n};\n\ntype TextAreaProps = (TextAreaPropsWithA11yLabel | TextAreaPropsWithLabel) & TextAreaCommonProps;\n\n// need to do this to tell TS to infer type as TextInput of React Native and make it believe that `ref.current.clear()` exists\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst isReactNative = (_textInputRef: any): _textInputRef is TextInputReactNative => {\n return getPlatformType() === 'react-native';\n};\n\nconst _TextArea: React.ForwardRefRenderFunction<BladeElementRef, TextAreaProps> = (\n {\n label,\n accessibilityLabel,\n labelPosition,\n necessityIndicator,\n errorText,\n helpText,\n successText,\n validationState,\n defaultValue,\n isDisabled,\n isRequired,\n name,\n onChange,\n onFocus,\n onBlur,\n onSubmit,\n onKeyDown,\n placeholder,\n value,\n maxCharacters,\n showClearButton,\n onClearButtonClick,\n autoFocus,\n numberOfLines = 2,\n testID,\n size = 'medium',\n isTaggedInput,\n tags,\n onTagChange,\n ...rest\n },\n ref,\n) => {\n const inputRef = React.useRef<BladeElementRefWithValue>(null);\n const mergedRef = useMergeRefs(ref, inputRef);\n const [isInputFocussed, setIsInputFocussed] = React.useState(autoFocus ?? false);\n const {\n activeTagIndex,\n setActiveTagIndex,\n getTags,\n handleTaggedInputKeydown,\n handleTaggedInputChange,\n handleTagsClear,\n } = useTaggedInput({\n tags,\n onTagChange,\n isDisabled,\n inputRef,\n isTaggedInput,\n name,\n value,\n onChange,\n });\n\n const [shouldShowClearButton, setShouldShowClearButton] = React.useState(false);\n\n React.useEffect(() => {\n setShouldShowClearButton(Boolean(showClearButton && (value?.length || defaultValue?.length)));\n }, [showClearButton, defaultValue, value]);\n\n const renderInteractionElement = (): React.ReactNode => {\n if (shouldShowClearButton) {\n return (\n <BaseBox paddingTop=\"spacing.3\" marginTop=\"spacing.1\">\n <IconButton\n icon={CloseIcon}\n accessibilityLabel=\"Clear textarea content\"\n onClick={() => {\n if (isEmpty(value) && inputRef.current) {\n // when the input field is uncontrolled take the ref and clear the input and then call the onClearButtonClick function\n if (isReactNative(inputRef.current)) {\n inputRef.current.clear();\n inputRef.current.focus();\n } else if (inputRef.current instanceof HTMLTextAreaElement) {\n inputRef.current.value = '';\n inputRef.current.focus();\n }\n }\n handleTagsClear();\n // if the input field is controlled just call the click handler and the value change shall be left upto the consumer\n onClearButtonClick?.();\n inputRef?.current?.focus();\n setShouldShowClearButton(false);\n }}\n />\n </BaseBox>\n );\n }\n\n return null;\n };\n\n return (\n <BaseInput\n as=\"textarea\"\n id=\"textarea\"\n maxTagRows=\"multiple\"\n componentName={MetaConstants.TextArea}\n autoFocus={autoFocus}\n ref={mergedRef}\n label={label as string}\n tags={isTaggedInput ? getTags({ size }) : undefined}\n activeTagIndex={activeTagIndex}\n setActiveTagIndex={setActiveTagIndex}\n isDropdownTrigger={isTaggedInput}\n showAllTags={isInputFocussed}\n accessibilityLabel={accessibilityLabel}\n hideLabelText={!Boolean(label)}\n labelPosition={labelPosition}\n necessityIndicator={necessityIndicator}\n errorText={errorText}\n helpText={helpText}\n successText={successText}\n validationState={validationState}\n isDisabled={isDisabled}\n isRequired={isRequired}\n name={name}\n maxCharacters={maxCharacters}\n placeholder={placeholder}\n trailingInteractionElement={renderInteractionElement()}\n defaultValue={defaultValue}\n value={value}\n numberOfLines={numberOfLines}\n onChange={({ name, value }) => {\n if (showClearButton && value?.length) {\n // show the clear button when the user starts typing in\n setShouldShowClearButton(true);\n }\n\n if (shouldShowClearButton && !value?.length) {\n // hide the clear button when the input field is empty\n setShouldShowClearButton(false);\n }\n\n handleTaggedInputChange({ name, value });\n onChange?.({ name, value });\n }}\n onFocus={(e) => {\n setIsInputFocussed(true);\n onFocus?.(e);\n }}\n onBlur={(e) => {\n setIsInputFocussed(false);\n onBlur?.(e);\n }}\n onKeyDown={(e) => {\n handleTaggedInputKeydown(e);\n onKeyDown?.({\n name: e.name,\n value: e.event.currentTarget.value,\n event: e.event,\n });\n }}\n onSubmit={onSubmit}\n trailingFooterSlot={(value) => {\n return maxCharacters ? (\n <BaseBox marginTop={hintMarginTop[size]} marginRight=\"spacing.1\">\n <CharacterCounter currentCount={value?.length ?? 0} maxCount={maxCharacters} />\n </BaseBox>\n ) : null;\n }}\n testID={testID}\n size={size}\n {...rest}\n />\n );\n};\n\nconst TextArea = assignWithoutSideEffects(React.forwardRef(_TextArea), {\n displayName: 'TextArea',\n});\n\nexport type { TextAreaProps };\nexport { TextArea };\n"],"names":["isReactNative","_textInputRef","getPlatformType","_TextArea","_ref","ref","label","accessibilityLabel","labelPosition","necessityIndicator","errorText","helpText","successText","validationState","defaultValue","isDisabled","isRequired","name","onChange","onFocus","onBlur","onSubmit","onKeyDown","placeholder","value","maxCharacters","showClearButton","onClearButtonClick","autoFocus","_ref$numberOfLines","numberOfLines","testID","_ref$size","size","isTaggedInput","tags","onTagChange","rest","_objectWithoutProperties","_excluded","inputRef","React","useRef","mergedRef","useMergeRefs","_React$useState","useState","_React$useState2","_slicedToArray","isInputFocussed","setIsInputFocussed","_useTaggedInput","useTaggedInput","activeTagIndex","setActiveTagIndex","getTags","handleTaggedInputKeydown","handleTaggedInputChange","handleTagsClear","_React$useState3","_React$useState4","shouldShowClearButton","setShouldShowClearButton","useEffect","Boolean","length","renderInteractionElement","_jsx","BaseBox","paddingTop","marginTop","children","IconButton","icon","CloseIcon","onClick","_inputRef$current","isEmpty","current","clear","focus","HTMLTextAreaElement","BaseInput","_objectSpread","as","id","maxTagRows","componentName","MetaConstants","TextArea","undefined","isDropdownTrigger","showAllTags","hideLabelText","trailingInteractionElement","_ref2","e","event","currentTarget","trailingFooterSlot","_value$length","hintMarginTop","marginRight","CharacterCounter","currentCount","maxCount","assignWithoutSideEffects","forwardRef","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuGA;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,EAiC7EC,GAAG,EACA;AAAA,EAAA,IAhCDC,KAAK,GAAAF,IAAA,CAALE,KAAK;IACLC,kBAAkB,GAAAH,IA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A,QAAS;AACnB8E,IAAAA,kBAAkB,EAAE,SAAAA,kBAAC3E,CAAAA,KAAK,EAAK;AAAA,MAAA,IAAA4E,aAAA,CAAA;AAC7B,MAAA,OAAO3E,aAAa,gBAClB0C,GAAA,CAACC,OAAO,EAAA;AAACE,QAAAA,SAAS,EAAE+B,aAAa,CAACpE,IAAI,CAAE;AAACqE,QAAAA,WAAW,EAAC,WAAW;QAAA/B,QAAA,eAC9DJ,GAAA,CAACoC,gBAAgB,EAAA;AAACC,UAAAA,YAAY,EAAAJ,CAAAA,aAAA,GAAE5E,KAAK,aAALA,KAAK,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAALA,KAAK,CAAEyC,MAAM,MAAAmC,IAAAA,IAAAA,aAAA,KAAAA,KAAAA,CAAAA,GAAAA,aAAA,GAAI,CAAE;AAACK,UAAAA,QAAQ,EAAEhF,aAAAA;SAAgB,CAAA;OACvE,CAAC,GACR,IAAI,CAAA;KACR;AACFM,IAAAA,MAAM,EAAEA,MAAO;AACfE,IAAAA,IAAI,EAAEA,IAAAA;GACFI,EAAAA,IAAI,CACT,CAAC,CAAA;AAEN,CAAC,CAAA;AAEKoD,IAAAA,QAAQ,gBAAGiB,wBAAwB,eAACjE,cAAK,CAACkE,UAAU,CAACxG,SAAS,CAAC,EAAE;AACrEyG,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 type { TaggedInputProps } from '../BaseInput/useTaggedInput';\nimport { useTaggedInput } from '../BaseInput/useTaggedInput';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport { CloseIcon } from '~components/Icons';\nimport { IconButton } from '~components/Button/IconButton';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { MetaConstants } from '~utils/metaAttribute';\nimport { CharacterCounter } from '~components/Form/CharacterCounter';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getPlatformType } from '~utils';\nimport { useMergeRefs } from '~utils/useMergeRefs';\nimport type {\n BladeElementRef,\n BladeElementRefWithValue,\n DataAnalyticsAttribute,\n} from '~utils/types';\nimport { hintMarginTop } from '~components/Form/formTokens';\nimport type { FormInputOnKeyDownEvent } from '~components/Form/FormTypes';\n\ntype TextAreaCommonProps = Pick<\n BaseInputProps,\n | 'label'\n | 'accessibilityLabel'\n | 'labelPosition'\n | 'labelSuffix'\n | 'labelTrailing'\n | 'necessityIndicator'\n | 'validationState'\n | 'helpText'\n | 'errorText'\n | 'successText'\n | 'placeholder'\n | 'defaultValue'\n | 'name'\n | 'onChange'\n | 'onFocus'\n | 'onBlur'\n | 'onSubmit'\n | 'value'\n | 'isDisabled'\n | 'isRequired'\n | 'maxCharacters'\n | 'autoFocus'\n | 'numberOfLines'\n | 'testID'\n | 'size'\n | keyof DataAnalyticsAttribute\n> & {\n /**\n * Decides whether to render a clear icon button\n */\n showClearButton?: boolean;\n /**\n * Event handler to handle the onClick event for clear button. Used when `showClearButton` is `true`\n */\n onClearButtonClick?: () => void;\n\n onKeyDown?: ({\n name,\n value,\n event,\n }: {\n name?: FormInputOnKeyDownEvent['name'];\n value: string;\n event: FormInputOnKeyDownEvent['event'];\n }) => void;\n} & TaggedInputProps &\n StyledPropsBlade;\n\n/*\n Mandatory accessibilityLabel prop when label is not provided\n*/\ntype TextAreaPropsWithA11yLabel = {\n /**\n * Label to be shown for the input field\n */\n label?: undefined;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel: string;\n};\n\n/*\n Optional accessibilityLabel prop when label is provided\n*/\ntype TextAreaPropsWithLabel = {\n /**\n * Label to be shown for the input field\n */\n label: string;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel?: string;\n};\n\ntype TextAreaProps = (TextAreaPropsWithA11yLabel | TextAreaPropsWithLabel) & TextAreaCommonProps;\n\n// need to do this to tell TS to infer type as TextInput of React Native and make it believe that `ref.current.clear()` exists\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst isReactNative = (_textInputRef: any): _textInputRef is TextInputReactNative => {\n return getPlatformType() === 'react-native';\n};\n\nconst _TextArea: React.ForwardRefRenderFunction<BladeElementRef, TextAreaProps> = (\n {\n label,\n accessibilityLabel,\n labelPosition,\n labelSuffix,\n labelTrailing,\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 onKeyDown,\n placeholder,\n value,\n maxCharacters,\n showClearButton,\n onClearButtonClick,\n autoFocus,\n numberOfLines = 2,\n testID,\n size = 'medium',\n isTaggedInput,\n tags,\n onTagChange,\n ...rest\n },\n ref,\n) => {\n const inputRef = React.useRef<BladeElementRefWithValue>(null);\n const mergedRef = useMergeRefs(ref, inputRef);\n const [isInputFocussed, setIsInputFocussed] = React.useState(autoFocus ?? false);\n const {\n activeTagIndex,\n setActiveTagIndex,\n getTags,\n handleTaggedInputKeydown,\n handleTaggedInputChange,\n handleTagsClear,\n } = useTaggedInput({\n tags,\n onTagChange,\n isDisabled,\n inputRef,\n isTaggedInput,\n name,\n value,\n onChange,\n });\n\n const [shouldShowClearButton, setShouldShowClearButton] = React.useState(false);\n\n React.useEffect(() => {\n setShouldShowClearButton(Boolean(showClearButton && (value?.length || defaultValue?.length)));\n }, [showClearButton, defaultValue, value]);\n\n const renderInteractionElement = (): React.ReactNode => {\n if (shouldShowClearButton) {\n return (\n <BaseBox paddingTop=\"spacing.3\" marginTop=\"spacing.1\">\n <IconButton\n icon={CloseIcon}\n accessibilityLabel=\"Clear textarea content\"\n onClick={() => {\n if (isEmpty(value) && inputRef.current) {\n // when the input field is uncontrolled take the ref and clear the input and then call the onClearButtonClick function\n if (isReactNative(inputRef.current)) {\n inputRef.current.clear();\n inputRef.current.focus();\n } else if (inputRef.current instanceof HTMLTextAreaElement) {\n inputRef.current.value = '';\n inputRef.current.focus();\n }\n }\n handleTagsClear();\n // if the input field is controlled just call the click handler and the value change shall be left upto the consumer\n onClearButtonClick?.();\n inputRef?.current?.focus();\n setShouldShowClearButton(false);\n }}\n />\n </BaseBox>\n );\n }\n\n return null;\n };\n\n return (\n <BaseInput\n as=\"textarea\"\n id=\"textarea\"\n maxTagRows=\"multiple\"\n componentName={MetaConstants.TextArea}\n autoFocus={autoFocus}\n ref={mergedRef}\n label={label as string}\n tags={isTaggedInput ? getTags({ size }) : undefined}\n activeTagIndex={activeTagIndex}\n setActiveTagIndex={setActiveTagIndex}\n isDropdownTrigger={isTaggedInput}\n showAllTags={isInputFocussed}\n accessibilityLabel={accessibilityLabel}\n hideLabelText={!Boolean(label)}\n labelPosition={labelPosition}\n labelSuffix={labelSuffix}\n labelTrailing={labelTrailing}\n necessityIndicator={necessityIndicator}\n errorText={errorText}\n helpText={helpText}\n successText={successText}\n validationState={validationState}\n isDisabled={isDisabled}\n isRequired={isRequired}\n name={name}\n maxCharacters={maxCharacters}\n placeholder={placeholder}\n trailingInteractionElement={renderInteractionElement()}\n defaultValue={defaultValue}\n value={value}\n numberOfLines={numberOfLines}\n onChange={({ name, value }) => {\n if (showClearButton && value?.length) {\n // show the clear button when the user starts typing in\n setShouldShowClearButton(true);\n }\n\n if (shouldShowClearButton && !value?.length) {\n // hide the clear button when the input field is empty\n setShouldShowClearButton(false);\n }\n\n handleTaggedInputChange({ name, value });\n onChange?.({ name, value });\n }}\n onFocus={(e) => {\n setIsInputFocussed(true);\n onFocus?.(e);\n }}\n onBlur={(e) => {\n setIsInputFocussed(false);\n onBlur?.(e);\n }}\n onKeyDown={(e) => {\n handleTaggedInputKeydown(e);\n onKeyDown?.({\n name: e.name,\n value: e.event.currentTarget.value,\n event: e.event,\n });\n }}\n onSubmit={onSubmit}\n trailingFooterSlot={(value) => {\n return maxCharacters ? (\n <BaseBox marginTop={hintMarginTop[size]} marginRight=\"spacing.1\">\n <CharacterCounter currentCount={value?.length ?? 0} maxCount={maxCharacters} />\n </BaseBox>\n ) : null;\n }}\n testID={testID}\n size={size}\n {...rest}\n />\n );\n};\n\nconst TextArea = assignWithoutSideEffects(React.forwardRef(_TextArea), {\n displayName: 'TextArea',\n});\n\nexport type { TextAreaProps };\nexport { TextArea };\n"],"names":["isReactNative","_textInputRef","getPlatformType","_TextArea","_ref","ref","label","accessibilityLabel","labelPosition","labelSuffix","labelTrailing","necessityIndicator","errorText","helpText","successText","validationState","defaultValue","isDisabled","isRequired","name","onChange","onFocus","onBlur","onSubmit","onKeyDown","placeholder","value","maxCharacters","showClearButton","onClearButtonClick","autoFocus","_ref$numberOfLines","numberOfLines","testID","_ref$size","size","isTaggedInput","tags","onTagChange","rest","_objectWithoutProperties","_excluded","inputRef","React","useRef","mergedRef","useMergeRefs","_React$useState","useState","_React$useState2","_slicedToArray","isInputFocussed","setIsInputFocussed","_useTaggedInput","useTaggedInput","activeTagIndex","setActiveTagIndex","getTags","handleTaggedInputKeydown","handleTaggedInputChange","handleTagsClear","_React$useState3","_React$useState4","shouldShowClearButton","setShouldShowClearButton","useEffect","Boolean","length","renderInteractionElement","_jsx","BaseBox","paddingTop","marginTop","children","IconButton","icon","CloseIcon","onClick","_inputRef$current","isEmpty","current","clear","focus","HTMLTextAreaElement","BaseInput","_objectSpread","as","id","maxTagRows","componentName","MetaConstants","TextArea","undefined","isDropdownTrigger","showAllTags","hideLabelText","trailingInteractionElement","_ref2","e","event","currentTarget","trailingFooterSlot","_value$length","hintMarginTop","marginRight","CharacterCounter","currentCount","maxCount","assignWithoutSideEffects","forwardRef","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyGA;AACA;AACA,IAAMA,aAAa,GAAG,SAAhBA,aAAaA,CAAIC,aAAkB,EAA4C;AACnF,EAAA,OAAOC,eAAe,EAA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'../../../utils/metaAttribute/metaConstants.js';
34
34
  import { CharacterCounter } from '../../Form/CharacterCounter/CharacterCounter.js';
35
35
  import { assignWithoutSideEffects } from '../../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
36
36
 
37
- var _excluded = ["label", "accessibilityLabel", "labelPosition", "placeholder", "type", "defaultValue", "name", "value", "maxCharacters", "format", "onChange", "onClick", "onFocus", "onBlur", "onSubmit", "isDisabled", "necessityIndicator", "validationState", "errorText", "helpText", "successText", "isRequired", "icon", "prefix", "showClearButton", "onClearButtonClick", "isLoading", "suffix", "autoFocus", "keyboardReturnKeyType", "autoCompleteSuggestionType", "autoCapitalize", "testID", "size", "leadingIcon", "trailingIcon", "isTaggedInput", "tags", "onTagChange", "trailing", "leading"];
37
+ var _excluded = ["label", "accessibilityLabel", "labelPosition", "placeholder", "type", "defaultValue", "name", "value", "maxCharacters", "format", "onChange", "onClick", "onFocus", "onBlur", "onSubmit", "isDisabled", "necessityIndicator", "validationState", "errorText", "helpText", "successText", "isRequired", "icon", "prefix", "showClearButton", "onClearButtonClick", "isLoading", "suffix", "autoFocus", "keyboardReturnKeyType", "autoCompleteSuggestionType", "autoCapitalize", "testID", "size", "leadingIcon", "trailingIcon", "isTaggedInput", "tags", "onTagChange", "trailing", "leading", "labelSuffix", "labelTrailing"];
38
38
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
39
39
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
40
40
  // need to do this to tell TS to infer type as TextInput of React Native and make it believe that `ref.current.clear()` exists
@@ -88,6 +88,8 @@ var _TextInput = function _TextInput(_ref, ref) {
88
88
  onTagChange = _ref.onTagChange,
89
89
  trailing = _ref.trailing,
90
90
  leading = _ref.leading,
91
+ labelSuffix = _ref.labelSuffix,
92
+ labelTrailing = _ref.labelTrailing,
91
93
  rest = _objectWithoutProperties(_ref, _excluded);
92
94
  var textInputRef = React__default.useRef(null);
93
95
  var mergedRef = useMergeRefs(ref, textInputRef);
@@ -269,6 +271,8 @@ var _TextInput = function _TextInput(_ref, ref) {
269
271
  textInputWrapperRef.current = wrapperNode;
270
272
  },
271
273
  label: label,
274
+ labelSuffix: labelSuffix,
275
+ labelTrailing: labelTrailing,
272
276
  accessibilityLabel: accessibilityLabel,
273
277
  hideLabelText: !Boolean(label),
274
278
  labelPosition: labelPosition,
@@ -1 +1 @@
1
- {"version":3,"file":"TextInput.js","sources":["../../../../../../../src/components/Input/TextInput/TextInput.tsx"],"sourcesContent":["import React, { useEffect, useState, useRef } from 'react';\nimport type { ReactElement, ReactNode } from 'react';\nimport type { TextInput as TextInputReactNative } from 'react-native';\nimport type { BaseInputProps } from '../BaseInput';\nimport { BaseInput } from '../BaseInput';\nimport { getKeyboardAndAutocompleteProps } from '../BaseInput/utils';\nimport type { TaggedInputProps } from '../BaseInput/useTaggedInput';\nimport { useTaggedInput } from '../BaseInput/useTaggedInput';\nimport { useFormattedInput } from './useFormattedInput';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport type { IconComponent } from '~components/Icons';\nimport { CloseIcon } from '~components/Icons';\nimport { IconButton } from '~components/Button/IconButton';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { MetaConstants } from '~utils/metaAttribute';\nimport { CharacterCounter } from '~components/Form/CharacterCounter';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Spinner } from '~components/Spinner';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getPlatformType } from '~utils';\nimport { useMergeRefs } from '~utils/useMergeRefs';\nimport type {\n BladeElementRef,\n BladeElementRefWithValue,\n ContainerElementType,\n DataAnalyticsAttribute,\n} from '~utils/types';\nimport { hintMarginTop } from '~components/Form/formTokens';\nimport { Divider } from '~components/Divider';\nimport { getComponentId } from '~utils/isValidAllowedChildren';\nimport { DropdownOverlay } from '~components/Dropdown';\nimport type { FormInputOnEvent } from '~components/Form/FormTypes';\n\n// Users should use PasswordInput for input type password\ntype Type = Exclude<BaseInputProps['type'], 'password'>;\n\ntype TextInputCommonProps = 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 | 'value'\n | 'isDisabled'\n | 'isRequired'\n | 'prefix'\n | 'suffix'\n | 'maxCharacters'\n | 'autoFocus'\n | 'keyboardReturnKeyType'\n | 'autoCompleteSuggestionType'\n | 'onSubmit'\n | 'autoCapitalize'\n | 'testID'\n | 'onClick'\n | 'size'\n | 'leadingIcon'\n | 'trailingButton'\n | 'trailingIcon'\n | 'textAlign'\n | keyof DataAnalyticsAttribute\n> & {\n /**\n * Decides whether to render a clear icon button\n */\n showClearButton?: boolean;\n\n /**\n * Event handler to handle the onClick event for clear button. Used when `showClearButton` is `true`\n */\n onClearButtonClick?: () => void;\n\n /**\n * Decides whether to show a loading spinner for the input field.\n */\n isLoading?: boolean;\n\n /**\n * Icon that will be rendered at the beginning of the input field\n * @deprecated Use `leading` instead. This prop will be removed in the next major version.\n */\n icon?: IconComponent;\n /**\n * Type of Input Field to be rendered. Use `PasswordInput` for type `password`\n *\n *\n * **Note on number type**\n *\n * `type=\"number\"` internally uses `inputMode=\"numeric\"` instead of HTML's `type=\"number\"` which also allows text characters.\n * If you have a usecase where you only want to support number input, you can handle it on validations end.\n *\n * Check out [Why the GOV.UK Design System team changed the input type for numbers](https://technology.blog.gov.uk/2020/02/24/why-the-gov-uk-design-system-team-changed-the-input-type-for-numbers/) for reasoning\n *\n * @default text\n */\n type?: Type;\n /**\n *\n * Icon or React Element to be rendered at the end of the input field\n */\n trailing?: React.ReactElement | IconComponent;\n /**\n * Icon or React Element to be rendered at the beginning of the input field\n */\n leading?: React.ReactElement | IconComponent;\n /**\n * Format pattern where # represents input characters and other symbols act as delimiters\n * When provided, input will be automatically formatted and onChange will include rawValue\n *\n * **Note:**\n * 1. Format pattern should only contain # symbols and special characters as delimiters.\n * Alphanumeric characters (letters and numbers) are not allowed in the format pattern.\n * 2. When format is provided, user input is restricted to alphanumeric characters only.\n * Special characters and symbols will be filtered out automatically from user input.\n *\n * @example \"#### #### #### ####\" for card numbers\n * @example \"##/##\" for expiry dates\n * @example \"(###) ###-####\" for phone numbers\n */\n format?:\n | '#### #### #### ####'\n | '##/##'\n | '##/##/####'\n | '(###) ###-####'\n | '###-##-####'\n | '##:##'\n | '##:##:##'\n | '#### #### ####'\n | '###.###.###.###'\n | '## ## ####'\n | '##-###-##'\n // eslint-disable-next-line @typescript-eslint/ban-types\n | (string & {});\n} & TaggedInputProps &\n StyledPropsBlade;\n\n/*\n Mandatory accessibilityLabel prop when label is not provided\n*/\ntype TextInputPropsWithA11yLabel = {\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 TextInputPropsWithLabel = {\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 TextInputProps = (TextInputPropsWithA11yLabel | TextInputPropsWithLabel) &\n TextInputCommonProps;\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 _TextInput: React.ForwardRefRenderFunction<BladeElementRef, TextInputProps> = (\n {\n label,\n accessibilityLabel,\n labelPosition = 'top',\n placeholder,\n type = 'text',\n defaultValue,\n name,\n value,\n maxCharacters,\n format,\n onChange,\n onClick,\n onFocus,\n onBlur,\n onSubmit,\n isDisabled,\n necessityIndicator,\n validationState,\n errorText,\n helpText,\n successText,\n isRequired,\n icon,\n prefix,\n showClearButton,\n onClearButtonClick,\n isLoading,\n suffix,\n autoFocus,\n keyboardReturnKeyType,\n autoCompleteSuggestionType,\n autoCapitalize,\n testID,\n size = 'medium',\n leadingIcon,\n trailingIcon,\n isTaggedInput,\n tags,\n onTagChange,\n trailing,\n leading,\n ...rest\n },\n ref,\n): ReactElement => {\n const textInputRef = React.useRef<BladeElementRefWithValue>(null);\n const mergedRef = useMergeRefs(ref, textInputRef);\n const [shouldShowClearButton, setShouldShowClearButton] = useState(false);\n const [isInputFocussed, setIsInputFocussed] = useState(autoFocus ?? false);\n\n if (__DEV__) {\n if (format) {\n const hasAlphanumeric = /[a-zA-Z0-9]/.test(format);\n if (hasAlphanumeric) {\n throw new Error(\n `[Blade: TextInput] Invalid format \"${format}\". Only # and special characters allowed, no letters/numbers.`,\n );\n }\n }\n }\n\n const formattingResult = useFormattedInput({\n format,\n onChange,\n value,\n defaultValue,\n });\n\n const inputValue = format ? formattingResult.formattedValue : value;\n const effectiveMaxCharacters = format ? formattingResult.maxLength : maxCharacters;\n\n const handleOnChange: FormInputOnEvent = React.useCallback(\n ({ name, value: inputValue }) => {\n if (format) {\n formattingResult.handleChange({ name, value: inputValue });\n } else {\n onChange?.({ name, value: inputValue });\n }\n },\n [format, formattingResult.handleChange, onChange],\n );\n\n const {\n activeTagIndex,\n setActiveTagIndex,\n getTags,\n handleTaggedInputKeydown,\n handleTaggedInputChange,\n handleTagsClear,\n } = useTaggedInput({\n isTaggedInput,\n tags,\n onTagChange,\n isDisabled,\n onChange: handleOnChange,\n name,\n value: inputValue,\n inputRef: textInputRef,\n });\n const [isTrailingDropDownOpen, setIsTrailingDropDownOpen] = React.useState(false);\n const [isLeadingDropDownOpen, setIsLeadingDropDownOpen] = React.useState(false);\n const textInputWrapperRef = useRef<ContainerElementType | null>(null);\n\n useEffect(() => {\n if (isTrailingDropDownOpen && isLeadingDropDownOpen) {\n setIsLeadingDropDownOpen(false);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isTrailingDropDownOpen]);\n\n useEffect(() => {\n if (isLeadingDropDownOpen && isTrailingDropDownOpen) {\n setIsTrailingDropDownOpen(false);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isLeadingDropDownOpen]);\n\n const leadingDropDown =\n leading && getComponentId(leading as React.ReactElement) === 'Dropdown' ? leading : null;\n\n const trailingDropdown =\n trailing && getComponentId(trailing as React.ReactElement) === 'Dropdown' ? trailing : null;\n // we need to look into name of component and check if it 's and icon or a dropdown\n const _leadingIcon: IconComponent | undefined =\n leading && typeof leading === 'function' && leading.name?.endsWith('Icon')\n ? (leading as IconComponent)\n : undefined;\n\n const _trailingIcon: IconComponent | undefined =\n trailing && typeof trailing === 'function' && trailing.name?.endsWith('Icon')\n ? (trailing as IconComponent)\n : undefined;\n const hasLeadingInteractionElement = !_leadingIcon && !leadingDropDown && leading;\n\n const hasTrailingInteractionElement = !_trailingIcon && !trailingDropdown && trailing;\n\n const renderDropdown = (\n dropdown: React.ReactElement,\n isOpen: boolean,\n setIsOpen: (isOpen: boolean) => void,\n defaultPlacement: 'bottom-start' | 'bottom-end',\n ): React.ReactElement | null => {\n if (!dropdown) {\n return null;\n }\n return React.cloneElement(dropdown, {\n selectionType: 'single',\n isOpen,\n onOpenChange: (isOpen: boolean) => {\n setIsOpen(isOpen);\n },\n children: React.Children.map(dropdown.props.children, (child) => {\n if (child.type === DropdownOverlay) {\n return React.cloneElement(child, {\n referenceRef: textInputWrapperRef,\n _isNestedDropdown: true,\n defaultPlacement,\n });\n }\n return child;\n }),\n });\n };\n\n const renderLeadingDropDown = renderDropdown(\n leadingDropDown as React.ReactElement,\n isLeadingDropDownOpen,\n setIsLeadingDropDownOpen,\n 'bottom-start',\n );\n const renderTrailingDropDown = renderDropdown(\n trailingDropdown as React.ReactElement,\n isTrailingDropDownOpen,\n setIsTrailingDropDownOpen,\n 'bottom-end',\n );\n\n React.useEffect(() => {\n setShouldShowClearButton(Boolean(showClearButton && (defaultValue ?? inputValue)));\n }, [showClearButton, defaultValue, inputValue]);\n\n const renderClearButton = (): React.ReactElement => {\n return (\n <IconButton\n size=\"medium\"\n icon={CloseIcon}\n onClick={() => {\n if (isEmpty(inputValue) && textInputRef.current) {\n // when the input field is uncontrolled take the ref and clear the input and then call the onClearButtonClick function\n if (isReactNative(textInputRef.current)) {\n textInputRef.current.clear();\n textInputRef.current.focus();\n } else if (textInputRef.current instanceof HTMLInputElement) {\n textInputRef.current.value = '';\n textInputRef.current.focus();\n }\n }\n handleTagsClear();\n // if the input field is controlled just call the click handler and the value change shall be left upto the consumer\n onClearButtonClick?.();\n textInputRef?.current?.focus();\n setShouldShowClearButton(false);\n }}\n isDisabled={isDisabled}\n accessibilityLabel=\"Clear Input Content\"\n />\n );\n };\n const hasTrailingDropDown = Boolean(trailingDropdown);\n\n const renderInteractionElement = (): ReactNode => {\n if (isLoading) {\n return <Spinner accessibilityLabel=\"Loading Content\" color=\"primary\" />;\n }\n\n if (shouldShowClearButton && hasTrailingDropDown) {\n return (\n <BaseBox display=\"flex\" gap=\"spacing.3\">\n {renderClearButton()} <Divider orientation=\"vertical\" />\n </BaseBox>\n );\n }\n\n if (showClearButton && hasTrailingInteractionElement) {\n return (\n <BaseBox display=\"flex\" gap=\"spacing.3\">\n {renderClearButton()} <Divider orientation=\"vertical\" /> {trailing as React.ReactElement}\n </BaseBox>\n );\n }\n\n if (shouldShowClearButton) {\n return renderClearButton();\n }\n\n if (hasTrailingInteractionElement) {\n return trailing as React.ReactElement;\n }\n return null;\n };\n return (\n <BaseInput\n id=\"textinput\"\n componentName={MetaConstants.TextInput}\n ref={mergedRef}\n setInputWrapperRef={(wrapperNode) => {\n textInputWrapperRef.current = wrapperNode;\n }}\n label={label as string}\n accessibilityLabel={accessibilityLabel}\n hideLabelText={!Boolean(label)}\n labelPosition={labelPosition}\n placeholder={placeholder}\n // CONTROLLED/UNCONTROLLED INPUT LOGIC:\n // For inputs WITHOUT format:\n // - Use standard React controlled/uncontrolled logic\n // - Controlled: user provides `value` prop → use `value` prop\n // - Uncontrolled: user provides `defaultValue` prop → use `defaultValue` prop\n //\n // For inputs WITH format:\n // - Formatting requires controlled mode to re-render and show formatted values\n // - Case 1: Only `value` provided → defaultValue: undefined, value: formattedValue (normal controlled)\n // - Case 2: Only `defaultValue` provided → defaultValue: undefined, value: formattedValue (convert to controlled)\n // - Case 3: Both `value` and `defaultValue` provided → defaultValue: defaultValue, value: formattedValue (let BaseInput detect conflict and throw error)\n //\n defaultValue={\n format\n ? value !== undefined && defaultValue !== undefined\n ? defaultValue\n : undefined\n : defaultValue\n }\n value={format ? inputValue : value}\n name={name}\n maxCharacters={effectiveMaxCharacters}\n isDropdownTrigger={isTaggedInput}\n tags={isTaggedInput ? getTags({ size }) : undefined}\n showAllTags={isInputFocussed}\n maxTagRows=\"single\"\n activeTagIndex={activeTagIndex}\n setActiveTagIndex={setActiveTagIndex}\n leadingDropDown={renderLeadingDropDown}\n trailingDropDown={renderTrailingDropDown}\n leadingInteractionElement={\n hasLeadingInteractionElement ? (leading as React.ReactElement) : null\n }\n onChange={({ name, value }: { name?: string; value?: string }) => {\n if (showClearButton && value?.length) {\n // show the clear button when the user starts typing in\n setShouldShowClearButton(true);\n }\n\n if (shouldShowClearButton && !value?.length) {\n // hide the clear button when the input field is empty\n setShouldShowClearButton(false);\n }\n\n handleTaggedInputChange({ name, value });\n handleOnChange({ name, value });\n }}\n onClick={onClick}\n onFocus={(e) => {\n setIsInputFocussed(true);\n onFocus?.(e);\n }}\n onBlur={(e) => {\n setIsInputFocussed(false);\n onBlur?.(e);\n }}\n onKeyDown={(e) => {\n handleTaggedInputKeydown(e);\n if (format) {\n formattingResult.handleKeyDown(e.event);\n }\n }}\n onSubmit={onSubmit}\n isDisabled={isDisabled}\n necessityIndicator={necessityIndicator}\n isRequired={isRequired}\n leadingIcon={_leadingIcon ?? leadingIcon ?? icon}\n prefix={prefix}\n trailingInteractionElement={renderInteractionElement()}\n trailingIcon={_trailingIcon ?? trailingIcon}\n suffix={suffix}\n validationState={validationState}\n errorText={errorText}\n helpText={helpText}\n successText={successText}\n trailingFooterSlot={(value) => {\n return format ? null : effectiveMaxCharacters ? (\n <BaseBox marginTop={hintMarginTop[size]} marginRight=\"spacing.1\">\n <CharacterCounter\n currentCount={value?.length ?? 0}\n maxCount={effectiveMaxCharacters}\n size={size}\n />\n </BaseBox>\n ) : null;\n }}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n testID={testID}\n {...getKeyboardAndAutocompleteProps({\n type,\n keyboardReturnKeyType,\n autoCompleteSuggestionType,\n autoCapitalize,\n })}\n size={size}\n {...rest}\n />\n );\n};\n\nconst TextInput = assignWithoutSideEffects(React.forwardRef(_TextInput), {\n displayName: 'TextInput',\n});\n\nexport type { TextInputProps };\nexport { TextInput };\n"],"names":["isReactNative","_textInputRef","getPlatformType","_TextInput","_ref","ref","_leading$name","_trailing$name","_ref4","label","accessibilityLabel","_ref$labelPosition","labelPosition","placeholder","_ref$type","type","defaultValue","name","value","maxCharacters","format","onChange","onClick","onFocus","onBlur","onSubmit","isDisabled","necessityIndicator","validationState","errorText","helpText","successText","isRequired","icon","prefix","showClearButton","onClearButtonClick","isLoading","suffix","autoFocus","keyboardReturnKeyType","autoCompleteSuggestionType","autoCapitalize","testID","_ref$size","size","leadingIcon","trailingIcon","isTaggedInput","tags","onTagChange","trailing","leading","rest","_objectWithoutProperties","_excluded","textInputRef","React","useRef","mergedRef","useMergeRefs","_useState","useState","_useState2","_slicedToArray","shouldShowClearButton","setShouldShowClearButton","_useState3","_useState4","isInputFocussed","setIsInputFocussed","hasAlphanumeric","test","Error","concat","formattingResult","useFormattedInput","inputValue","formattedValue","effectiveMaxCharacters","maxLength","handleOnChange","useCallback","_ref2","handleChange","_useTaggedInput","useTaggedInput","inputRef","activeTagIndex","setActiveTagIndex","getTags","handleTaggedInputKeydown","handleTaggedInputChange","handleTagsClear","_React$useState","_React$useState2","isTrailingDropDownOpen","setIsTrailingDropDownOpen","_React$useState3","_React$useState4","isLeadingDropDownOpen","setIsLeadingDropDownOpen","textInputWrapperRef","useEffect","leadingDropDown","getComponentId","trailingDropdown","_leadingIcon","endsWith","undefined","_trailingIcon","hasLeadingInteractionElement","hasTrailingInteractionElement","renderDropdown","dropdown","isOpen","setIsOpen","defaultPlacement","cloneElement","selectionType","onOpenChange","children","Children","map","props","child","DropdownOverlay","referenceRef","_isNestedDropdown","renderLeadingDropDown","renderTrailingDropDown","Boolean","renderClearButton","_jsx","IconButton","CloseIcon","_textInputRef$current","isEmpty","current","clear","focus","HTMLInputElement","hasTrailingDropDown","renderInteractionElement","Spinner","color","_jsxs","BaseBox","display","gap","Divider","orientation","BaseInput","_objectSpread","id","componentName","MetaConstants","TextInput","setInputWrapperRef","wrapperNode","hideLabelText","isDropdownTrigger","showAllTags","maxTagRows","trailingDropDown","leadingInteractionElement","_ref3","length","e","onKeyDown","handleKeyDown","event","trailingInteractionElement","trailingFooterSlot","_value$length","marginTop","hintMarginTop","marginRight","CharacterCounter","currentCount","maxCount","getKeyboardAndAutocompleteProps","assignWithoutSideEffects","forwardRef","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiLA;AACA;AACA,IAAMA,aAAa,GAAG,SAAhBA,aAAaA,CAAIC,aAAkB,EAA4C;AACnF,EAAA,OAAOC,eAAe,EAAE,KAAK,cAAc,CAAA;AAC7C,CAAC,CAAA;AAED,IAAMC,UAA2E,GAAG,SAA9EA,UAA2EA,CAAAC,IAAA,EA6C/EC,GAAG,EAC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I,EAAEA,IAAAA;GACFQ,EAAAA,IAAI,CACT,CAAC,CAAA;AAEN,CAAC,CAAA;AAEKwG,IAAAA,SAAS,gBAAGyB,wBAAwB,eAAC7H,cAAK,CAAC8H,UAAU,CAACpL,UAAU,CAAC,EAAE;AACvEqL,EAAAA,WAAW,EAAE,WAAA;AACf,CAAC;;;;"}
1
+ {"version":3,"file":"TextInput.js","sources":["../../../../../../../src/components/Input/TextInput/TextInput.tsx"],"sourcesContent":["import React, { useEffect, useState, useRef } from 'react';\nimport type { ReactElement, ReactNode } from 'react';\nimport type { TextInput as TextInputReactNative } from 'react-native';\nimport type { BaseInputProps } from '../BaseInput';\nimport { BaseInput } from '../BaseInput';\nimport { getKeyboardAndAutocompleteProps } from '../BaseInput/utils';\nimport type { TaggedInputProps } from '../BaseInput/useTaggedInput';\nimport { useTaggedInput } from '../BaseInput/useTaggedInput';\nimport { useFormattedInput } from './useFormattedInput';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport type { IconComponent } from '~components/Icons';\nimport { CloseIcon } from '~components/Icons';\nimport { IconButton } from '~components/Button/IconButton';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { MetaConstants } from '~utils/metaAttribute';\nimport { CharacterCounter } from '~components/Form/CharacterCounter';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Spinner } from '~components/Spinner';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getPlatformType } from '~utils';\nimport { useMergeRefs } from '~utils/useMergeRefs';\nimport type {\n BladeElementRef,\n BladeElementRefWithValue,\n ContainerElementType,\n DataAnalyticsAttribute,\n} from '~utils/types';\nimport { hintMarginTop } from '~components/Form/formTokens';\nimport { Divider } from '~components/Divider';\nimport { getComponentId } from '~utils/isValidAllowedChildren';\nimport { DropdownOverlay } from '~components/Dropdown';\nimport type { FormInputOnEvent } from '~components/Form/FormTypes';\n\n// Users should use PasswordInput for input type password\ntype Type = Exclude<BaseInputProps['type'], 'password'>;\n\ntype TextInputCommonProps = Pick<\n BaseInputProps,\n | 'label'\n | 'accessibilityLabel'\n | 'labelPosition'\n | 'labelSuffix'\n | 'labelTrailing'\n | 'necessityIndicator'\n | 'validationState'\n | 'helpText'\n | 'errorText'\n | 'successText'\n | 'placeholder'\n | 'defaultValue'\n | 'name'\n | 'onChange'\n | 'onFocus'\n | 'onBlur'\n | 'value'\n | 'isDisabled'\n | 'isRequired'\n | 'prefix'\n | 'suffix'\n | 'maxCharacters'\n | 'autoFocus'\n | 'keyboardReturnKeyType'\n | 'autoCompleteSuggestionType'\n | 'onSubmit'\n | 'autoCapitalize'\n | 'testID'\n | 'onClick'\n | 'size'\n | 'leadingIcon'\n | 'trailingButton'\n | 'trailingIcon'\n | 'textAlign'\n | keyof DataAnalyticsAttribute\n> & {\n /**\n * Decides whether to render a clear icon button\n */\n showClearButton?: boolean;\n\n /**\n * Event handler to handle the onClick event for clear button. Used when `showClearButton` is `true`\n */\n onClearButtonClick?: () => void;\n\n /**\n * Decides whether to show a loading spinner for the input field.\n */\n isLoading?: boolean;\n\n /**\n * Icon that will be rendered at the beginning of the input field\n * @deprecated Use `leading` instead. This prop will be removed in the next major version.\n */\n icon?: IconComponent;\n /**\n * Type of Input Field to be rendered. Use `PasswordInput` for type `password`\n *\n *\n * **Note on number type**\n *\n * `type=\"number\"` internally uses `inputMode=\"numeric\"` instead of HTML's `type=\"number\"` which also allows text characters.\n * If you have a usecase where you only want to support number input, you can handle it on validations end.\n *\n * Check out [Why the GOV.UK Design System team changed the input type for numbers](https://technology.blog.gov.uk/2020/02/24/why-the-gov-uk-design-system-team-changed-the-input-type-for-numbers/) for reasoning\n *\n * @default text\n */\n type?: Type;\n /**\n *\n * Icon or React Element to be rendered at the end of the input field\n */\n trailing?: React.ReactElement | IconComponent;\n /**\n * Icon or React Element to be rendered at the beginning of the input field\n */\n leading?: React.ReactElement | IconComponent;\n /**\n * Format pattern where # represents input characters and other symbols act as delimiters\n * When provided, input will be automatically formatted and onChange will include rawValue\n *\n * **Note:**\n * 1. Format pattern should only contain # symbols and special characters as delimiters.\n * Alphanumeric characters (letters and numbers) are not allowed in the format pattern.\n * 2. When format is provided, user input is restricted to alphanumeric characters only.\n * Special characters and symbols will be filtered out automatically from user input.\n *\n * @example \"#### #### #### ####\" for card numbers\n * @example \"##/##\" for expiry dates\n * @example \"(###) ###-####\" for phone numbers\n */\n format?:\n | '#### #### #### ####'\n | '##/##'\n | '##/##/####'\n | '(###) ###-####'\n | '###-##-####'\n | '##:##'\n | '##:##:##'\n | '#### #### ####'\n | '###.###.###.###'\n | '## ## ####'\n | '##-###-##'\n // eslint-disable-next-line @typescript-eslint/ban-types\n | (string & {});\n} & TaggedInputProps &\n StyledPropsBlade;\n\n/*\n Mandatory accessibilityLabel prop when label is not provided\n*/\ntype TextInputPropsWithA11yLabel = {\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 TextInputPropsWithLabel = {\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 TextInputProps = (TextInputPropsWithA11yLabel | TextInputPropsWithLabel) &\n TextInputCommonProps;\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 _TextInput: React.ForwardRefRenderFunction<BladeElementRef, TextInputProps> = (\n {\n label,\n accessibilityLabel,\n labelPosition = 'top',\n placeholder,\n type = 'text',\n defaultValue,\n name,\n value,\n maxCharacters,\n format,\n onChange,\n onClick,\n onFocus,\n onBlur,\n onSubmit,\n isDisabled,\n necessityIndicator,\n validationState,\n errorText,\n helpText,\n successText,\n isRequired,\n icon,\n prefix,\n showClearButton,\n onClearButtonClick,\n isLoading,\n suffix,\n autoFocus,\n keyboardReturnKeyType,\n autoCompleteSuggestionType,\n autoCapitalize,\n testID,\n size = 'medium',\n leadingIcon,\n trailingIcon,\n isTaggedInput,\n tags,\n onTagChange,\n trailing,\n leading,\n labelSuffix,\n labelTrailing,\n ...rest\n },\n ref,\n): ReactElement => {\n const textInputRef = React.useRef<BladeElementRefWithValue>(null);\n const mergedRef = useMergeRefs(ref, textInputRef);\n const [shouldShowClearButton, setShouldShowClearButton] = useState(false);\n const [isInputFocussed, setIsInputFocussed] = useState(autoFocus ?? false);\n\n if (__DEV__) {\n if (format) {\n const hasAlphanumeric = /[a-zA-Z0-9]/.test(format);\n if (hasAlphanumeric) {\n throw new Error(\n `[Blade: TextInput] Invalid format \"${format}\". Only # and special characters allowed, no letters/numbers.`,\n );\n }\n }\n }\n\n const formattingResult = useFormattedInput({\n format,\n onChange,\n value,\n defaultValue,\n });\n\n const inputValue = format ? formattingResult.formattedValue : value;\n const effectiveMaxCharacters = format ? formattingResult.maxLength : maxCharacters;\n\n const handleOnChange: FormInputOnEvent = React.useCallback(\n ({ name, value: inputValue }) => {\n if (format) {\n formattingResult.handleChange({ name, value: inputValue });\n } else {\n onChange?.({ name, value: inputValue });\n }\n },\n [format, formattingResult.handleChange, onChange],\n );\n\n const {\n activeTagIndex,\n setActiveTagIndex,\n getTags,\n handleTaggedInputKeydown,\n handleTaggedInputChange,\n handleTagsClear,\n } = useTaggedInput({\n isTaggedInput,\n tags,\n onTagChange,\n isDisabled,\n onChange: handleOnChange,\n name,\n value: inputValue,\n inputRef: textInputRef,\n });\n const [isTrailingDropDownOpen, setIsTrailingDropDownOpen] = React.useState(false);\n const [isLeadingDropDownOpen, setIsLeadingDropDownOpen] = React.useState(false);\n const textInputWrapperRef = useRef<ContainerElementType | null>(null);\n\n useEffect(() => {\n if (isTrailingDropDownOpen && isLeadingDropDownOpen) {\n setIsLeadingDropDownOpen(false);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isTrailingDropDownOpen]);\n\n useEffect(() => {\n if (isLeadingDropDownOpen && isTrailingDropDownOpen) {\n setIsTrailingDropDownOpen(false);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isLeadingDropDownOpen]);\n\n const leadingDropDown =\n leading && getComponentId(leading as React.ReactElement) === 'Dropdown' ? leading : null;\n\n const trailingDropdown =\n trailing && getComponentId(trailing as React.ReactElement) === 'Dropdown' ? trailing : null;\n // we need to look into name of component and check if it 's and icon or a dropdown\n const _leadingIcon: IconComponent | undefined =\n leading && typeof leading === 'function' && leading.name?.endsWith('Icon')\n ? (leading as IconComponent)\n : undefined;\n\n const _trailingIcon: IconComponent | undefined =\n trailing && typeof trailing === 'function' && trailing.name?.endsWith('Icon')\n ? (trailing as IconComponent)\n : undefined;\n const hasLeadingInteractionElement = !_leadingIcon && !leadingDropDown && leading;\n\n const hasTrailingInteractionElement = !_trailingIcon && !trailingDropdown && trailing;\n\n const renderDropdown = (\n dropdown: React.ReactElement,\n isOpen: boolean,\n setIsOpen: (isOpen: boolean) => void,\n defaultPlacement: 'bottom-start' | 'bottom-end',\n ): React.ReactElement | null => {\n if (!dropdown) {\n return null;\n }\n return React.cloneElement(dropdown, {\n selectionType: 'single',\n isOpen,\n onOpenChange: (isOpen: boolean) => {\n setIsOpen(isOpen);\n },\n children: React.Children.map(dropdown.props.children, (child) => {\n if (child.type === DropdownOverlay) {\n return React.cloneElement(child, {\n referenceRef: textInputWrapperRef,\n _isNestedDropdown: true,\n defaultPlacement,\n });\n }\n return child;\n }),\n });\n };\n\n const renderLeadingDropDown = renderDropdown(\n leadingDropDown as React.ReactElement,\n isLeadingDropDownOpen,\n setIsLeadingDropDownOpen,\n 'bottom-start',\n );\n const renderTrailingDropDown = renderDropdown(\n trailingDropdown as React.ReactElement,\n isTrailingDropDownOpen,\n setIsTrailingDropDownOpen,\n 'bottom-end',\n );\n\n React.useEffect(() => {\n setShouldShowClearButton(Boolean(showClearButton && (defaultValue ?? inputValue)));\n }, [showClearButton, defaultValue, inputValue]);\n\n const renderClearButton = (): React.ReactElement => {\n return (\n <IconButton\n size=\"medium\"\n icon={CloseIcon}\n onClick={() => {\n if (isEmpty(inputValue) && textInputRef.current) {\n // when the input field is uncontrolled take the ref and clear the input and then call the onClearButtonClick function\n if (isReactNative(textInputRef.current)) {\n textInputRef.current.clear();\n textInputRef.current.focus();\n } else if (textInputRef.current instanceof HTMLInputElement) {\n textInputRef.current.value = '';\n textInputRef.current.focus();\n }\n }\n handleTagsClear();\n // if the input field is controlled just call the click handler and the value change shall be left upto the consumer\n onClearButtonClick?.();\n textInputRef?.current?.focus();\n setShouldShowClearButton(false);\n }}\n isDisabled={isDisabled}\n accessibilityLabel=\"Clear Input Content\"\n />\n );\n };\n const hasTrailingDropDown = Boolean(trailingDropdown);\n\n const renderInteractionElement = (): ReactNode => {\n if (isLoading) {\n return <Spinner accessibilityLabel=\"Loading Content\" color=\"primary\" />;\n }\n\n if (shouldShowClearButton && hasTrailingDropDown) {\n return (\n <BaseBox display=\"flex\" gap=\"spacing.3\">\n {renderClearButton()} <Divider orientation=\"vertical\" />\n </BaseBox>\n );\n }\n\n if (showClearButton && hasTrailingInteractionElement) {\n return (\n <BaseBox display=\"flex\" gap=\"spacing.3\">\n {renderClearButton()} <Divider orientation=\"vertical\" /> {trailing as React.ReactElement}\n </BaseBox>\n );\n }\n\n if (shouldShowClearButton) {\n return renderClearButton();\n }\n\n if (hasTrailingInteractionElement) {\n return trailing as React.ReactElement;\n }\n return null;\n };\n return (\n <BaseInput\n id=\"textinput\"\n componentName={MetaConstants.TextInput}\n ref={mergedRef}\n setInputWrapperRef={(wrapperNode) => {\n textInputWrapperRef.current = wrapperNode;\n }}\n label={label as string}\n labelSuffix={labelSuffix}\n labelTrailing={labelTrailing}\n accessibilityLabel={accessibilityLabel}\n hideLabelText={!Boolean(label)}\n labelPosition={labelPosition}\n placeholder={placeholder}\n // CONTROLLED/UNCONTROLLED INPUT LOGIC:\n // For inputs WITHOUT format:\n // - Use standard React controlled/uncontrolled logic\n // - Controlled: user provides `value` prop → use `value` prop\n // - Uncontrolled: user provides `defaultValue` prop → use `defaultValue` prop\n //\n // For inputs WITH format:\n // - Formatting requires controlled mode to re-render and show formatted values\n // - Case 1: Only `value` provided → defaultValue: undefined, value: formattedValue (normal controlled)\n // - Case 2: Only `defaultValue` provided → defaultValue: undefined, value: formattedValue (convert to controlled)\n // - Case 3: Both `value` and `defaultValue` provided → defaultValue: defaultValue, value: formattedValue (let BaseInput detect conflict and throw error)\n //\n defaultValue={\n format\n ? value !== undefined && defaultValue !== undefined\n ? defaultValue\n : undefined\n : defaultValue\n }\n value={format ? inputValue : value}\n name={name}\n maxCharacters={effectiveMaxCharacters}\n isDropdownTrigger={isTaggedInput}\n tags={isTaggedInput ? getTags({ size }) : undefined}\n showAllTags={isInputFocussed}\n maxTagRows=\"single\"\n activeTagIndex={activeTagIndex}\n setActiveTagIndex={setActiveTagIndex}\n leadingDropDown={renderLeadingDropDown}\n trailingDropDown={renderTrailingDropDown}\n leadingInteractionElement={\n hasLeadingInteractionElement ? (leading as React.ReactElement) : null\n }\n onChange={({ name, value }: { name?: string; value?: string }) => {\n if (showClearButton && value?.length) {\n // show the clear button when the user starts typing in\n setShouldShowClearButton(true);\n }\n\n if (shouldShowClearButton && !value?.length) {\n // hide the clear button when the input field is empty\n setShouldShowClearButton(false);\n }\n\n handleTaggedInputChange({ name, value });\n handleOnChange({ name, value });\n }}\n onClick={onClick}\n onFocus={(e) => {\n setIsInputFocussed(true);\n onFocus?.(e);\n }}\n onBlur={(e) => {\n setIsInputFocussed(false);\n onBlur?.(e);\n }}\n onKeyDown={(e) => {\n handleTaggedInputKeydown(e);\n if (format) {\n formattingResult.handleKeyDown(e.event);\n }\n }}\n onSubmit={onSubmit}\n isDisabled={isDisabled}\n necessityIndicator={necessityIndicator}\n isRequired={isRequired}\n leadingIcon={_leadingIcon ?? leadingIcon ?? icon}\n prefix={prefix}\n trailingInteractionElement={renderInteractionElement()}\n trailingIcon={_trailingIcon ?? trailingIcon}\n suffix={suffix}\n validationState={validationState}\n errorText={errorText}\n helpText={helpText}\n successText={successText}\n trailingFooterSlot={(value) => {\n return format ? null : effectiveMaxCharacters ? (\n <BaseBox marginTop={hintMarginTop[size]} marginRight=\"spacing.1\">\n <CharacterCounter\n currentCount={value?.length ?? 0}\n maxCount={effectiveMaxCharacters}\n size={size}\n />\n </BaseBox>\n ) : null;\n }}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n testID={testID}\n {...getKeyboardAndAutocompleteProps({\n type,\n keyboardReturnKeyType,\n autoCompleteSuggestionType,\n autoCapitalize,\n })}\n size={size}\n {...rest}\n />\n );\n};\n\nconst TextInput = assignWithoutSideEffects(React.forwardRef(_TextInput), {\n displayName: 'TextInput',\n});\n\nexport type { TextInputProps };\nexport { TextInput };\n"],"names":["isReactNative","_textInputRef","getPlatformType","_TextInput","_ref","ref","_leading$name","_trailing$name","_ref4","label","accessibilityLabel","_ref$labelPosition","labelPosition","placeholder","_ref$type","type","defaultValue","name","value","maxCharacters","format","onChange","onClick","onFocus","onBlur","onSubmit","isDisabled","necessityIndicator","validationState","errorText","helpText","successText","isRequired","icon","prefix","showClearButton","onClearButtonClick","isLoading","suffix","autoFocus","keyboardReturnKeyType","autoCompleteSuggestionType","autoCapitalize","testID","_ref$size","size","leadingIcon","trailingIcon","isTaggedInput","tags","onTagChange","trailing","leading","labelSuffix","labelTrailing","rest","_objectWithoutProperties","_excluded","textInputRef","React","useRef","mergedRef","useMergeRefs","_useState","useState","_useState2","_slicedToArray","shouldShowClearButton","setShouldShowClearButton","_useState3","_useState4","isInputFocussed","setIsInputFocussed","hasAlphanumeric","test","Error","concat","formattingResult","useFormattedInput","inputValue","formattedValue","effectiveMaxCharacters","maxLength","handleOnChange","useCallback","_ref2","handleChange","_useTaggedInput","useTaggedInput","inputRef","activeTagIndex","setActiveTagIndex","getTags","handleTaggedInputKeydown","handleTaggedInputChange","handleTagsClear","_React$useState","_React$useState2","isTrailingDropDownOpen","setIsTrailingDropDownOpen","_React$useState3","_React$useState4","isLeadingDropDownOpen","setIsLeadingDropDownOpen","textInputWrapperRef","useEffect","leadingDropDown","getComponentId","trailingDropdown","_leadingIcon","endsWith","undefined","_trailingIcon","hasLeadingInteractionElement","hasTrailingInteractionElement","renderDropdown","dropdown","isOpen","setIsOpen","defaultPlacement","cloneElement","selectionType","onOpenChange","children","Children","map","props","child","DropdownOverlay","referenceRef","_isNestedDropdown","renderLeadingDropDown","renderTrailingDropDown","Boolean","renderClearButton","_jsx","IconButton","CloseIcon","_textInputRef$current","isEmpty","current","clear","focus","HTMLInputElement","hasTrailingDropDown","renderInteractionElement","Spinner","color","_jsxs","BaseBox","display","gap","Divider","orientation","BaseInput","_objectSpread","id","componentName","MetaConstants","TextInput","setInputWrapperRef","wrapperNode","hideLabelText","isDropdownTrigger","showAllTags","maxTagRows","trailingDropDown","leadingInteractionElement","_ref3","length","e","onKeyDown","handleKeyDown","event","trailingInteractionElement","trailingFooterSlot","_value$length","marginTop","hintMarginTop","marginRight","CharacterCounter","currentCount","maxCount","getKeyboardAndAutocompleteProps","assignWithoutSideEffects","forwardRef","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmLA;AACA;AACA,IAAMA,aAAa,GAAG,SAAhBA,aAAaA,CAAIC,aAAkB,EAA4C;AACnF,EAAA,OAAOC,eAAe,EAAE,KAAK,cAAc,CAAA;AAC7C,CAAC,CAAA;AAED,IAAMC,UAA2E,GAAG,SAA9EA,UAA2EA,CAAAC,IAAA,EA+C/EC,GAAG,EACc;AAAA,EAAA,IAAAC,aAAA,EAAAC,cAAA,EAAAC,KAAA,CAAA;AAAA,EAAA,IA9CfC,KAAK,GAAAL,IAAA,CAALK,KAAK;IACLC,kBAAkB,GAAAN,IAAA,CAAlBM,kBAAkB;IAAAC,kBAAA,GAAAP,IAAA,CAClBQ,aAAa;AAAbA,IAAAA,aAAa,GAAAD,kBAAA,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AAA,SAAS,gBAAGyB,wBAAwB,eAAC7H,cAAK,CAAC8H,UAAU,CAACtL,UAAU,CAAC,EAAE;AACvEuL,EAAAA,WAAW,EAAE,WAAA;AACf,CAAC;;;;"}
@@ -97,7 +97,7 @@ var _ListItem = function _ListItem(_ref3) {
97
97
  // Get children that are not a List component and are valid allowed children
98
98
  var validChildItem = childrenArray.filter(function (child) {
99
99
  if (getComponentId(child) === MetaConstants.List) return null;
100
- if (typeof child === 'string' || isValidAllowedChildren(child, MetaConstants.ListItemLink) || isValidAllowedChildren(child, MetaConstants.ListItemText) || isValidAllowedChildren(child, MetaConstants.ListItemCode)) {
100
+ if (typeof child === 'string' || typeof child === 'number' || isValidAllowedChildren(child, MetaConstants.ListItemLink) || isValidAllowedChildren(child, MetaConstants.ListItemText) || isValidAllowedChildren(child, MetaConstants.ListItemCode)) {
101
101
  return child;
102
102
  } else if (false) {
103
103
  throwBladeError({
@@ -1 +1 @@
1
- {"version":3,"file":"ListItem.js","sources":["../../../../../../src/components/List/ListItem.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport React from 'react';\nimport { useListContext } from './ListContext';\nimport { UnorderedItemIcon } from './ListItemIcons';\nimport { ListItemElement } from './ListItemElement';\nimport {\n listItemBulletMarginRight,\n listItemBulletMarginTop,\n listItemOrderedBulletBoxSize,\n listItemMarginBottom,\n listItemMarginLeft,\n} from './listTokens';\nimport type { ListProps } from './List';\nimport { getOrderedListItemBullet } from './getOrderedListItemBullet';\nimport getIn from '~utils/lodashButBetter/get';\nimport { Text } from '~components/Typography';\nimport type { IconComponent } from '~components/Icons';\nimport { useTheme } from '~components/BladeProvider';\nimport BaseBox from '~components/Box/BaseBox';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { TestID } from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getComponentId, isValidAllowedChildren } from '~utils/isValidAllowedChildren';\nimport { getPlatformType } from '~utils/getPlatformType';\nimport { throwBladeError } from '~utils/logger';\n\ntype ListItemProps = {\n /**\n * Children to be rendered for ListItem. This can be a text, ListItemLink or another List.\n *\n */\n children: React.ReactNode;\n /**\n * Icon to be rendered for a ListItem's bullet.\n *\n */\n icon?: IconComponent;\n /**\n * Icon color of the ListItem's bullet.\n *\n */\n iconColor?: ListProps['iconColor'];\n /**\n * This is a private prop to be used only for internal logic purposes.\n *\n */\n _itemNumber?: undefined;\n} & TestID;\n\nconst StyledListItem = styled(ListItemElement)<{\n level?: number;\n variant: NonNullable<ListProps['variant']>;\n hasIcon: boolean;\n}>(({ level, theme, variant, hasIcon }) => ({\n marginLeft: level\n ? getIn(\n theme,\n listItemMarginLeft[\n `${variant}${variant === 'unordered' && hasIcon ? 'WithIcon' : ''}` as NonNullable<\n ListProps['variant'] | 'unorderedWithIcon'\n >\n ][level],\n )\n : 0,\n}));\n\nconst ListItemContentChildren = ({\n children,\n size,\n}: {\n children: React.ReactNode[];\n size: NonNullable<ListProps['size']>;\n}): React.ReactElement => {\n /* Having a <View><Text>...</Text><View/> inside <Text /> breaks vertical alignment. Issue: https://github.com/facebook/react-native/issues/31955\n As a workaround, we wrap individual strings in their own <Text /> and handle alignment with a parent <View> (BaseBox).\n */\n return getPlatformType() === 'react-native' ? (\n <BaseBox display=\"flex\" flexDirection=\"row\" flexWrap=\"wrap\">\n {children.map((child, index) => {\n if (typeof child === 'string') {\n return (\n <Text key={index} variant=\"body\" size={size}>\n {child}\n </Text>\n );\n }\n return child;\n })}\n </BaseBox>\n ) : (\n <Text variant=\"body\" size={size}>\n {children}\n </Text>\n );\n};\n\nconst _ListItem = ({\n children,\n icon: Icon,\n iconColor: listItemIconColor,\n _itemNumber,\n testID,\n}: ListItemProps): React.ReactElement => {\n const { level, size, icon: ListContextIcon, variant, iconColor } = useListContext();\n const { theme, platform } = useTheme();\n const ItemIcon = Icon ?? ListContextIcon;\n const iconColorToken = listItemIconColor ?? iconColor ?? 'surface.icon.gray.muted';\n\n if (__DEV__) {\n if (level && level > 3) {\n throwBladeError({\n message: 'List Nesting is allowed only upto 3 levels.',\n moduleName: 'List',\n });\n }\n }\n\n const childrenArray = React.Children.toArray(children);\n\n // Get children that are not a List component and are valid allowed children\n const validChildItem = childrenArray.filter((child) => {\n if (getComponentId(child) === MetaConstants.List) return null;\n\n if (\n typeof child === 'string' ||\n isValidAllowedChildren(child, MetaConstants.ListItemLink) ||\n isValidAllowedChildren(child, MetaConstants.ListItemText) ||\n isValidAllowedChildren(child, MetaConstants.ListItemCode)\n ) {\n return child;\n } else if (__DEV__) {\n throwBladeError({\n message: `You can only pass a List, ListItemLink, ListItemCode, ListItemText or a string as a child to ListItem.`,\n moduleName: 'ListItem',\n });\n }\n return null;\n });\n // Get child that is a List component\n const childList = childrenArray.filter((child) =>\n getComponentId(child) === MetaConstants.List ? child : null,\n );\n const hasIcon = Boolean(ItemIcon);\n\n return (\n <StyledListItem\n level={level}\n variant={variant}\n hasIcon={hasIcon}\n {...metaAttribute({ name: MetaConstants.ListItem, testID })}\n >\n <BaseBox\n display=\"flex\"\n flexDirection=\"row\"\n alignItems=\"center\"\n marginBottom={listItemMarginBottom}\n >\n {variant === 'unordered' ? (\n <BaseBox\n marginRight={listItemBulletMarginRight[variant]}\n marginTop={\n listItemBulletMarginTop[`${variant}${hasIcon ? 'WithIcon' : ''}`][platform][size]\n }\n display=\"flex\"\n alignSelf=\"flex-start\"\n >\n {ItemIcon ? (\n <ItemIcon size={size} color={iconColorToken} />\n ) : (\n <UnorderedItemIcon level={level} />\n )}\n </BaseBox>\n ) : (\n <BaseBox\n width={listItemOrderedBulletBoxSize[variant][platform][size]}\n height={listItemOrderedBulletBoxSize[variant][platform][size]}\n marginRight={listItemBulletMarginRight[variant]}\n marginTop={listItemBulletMarginTop[variant][platform][size]}\n display=\"flex\"\n flexShrink={0}\n justifyContent=\"center\"\n alignSelf=\"flex-start\"\n alignItems=\"center\"\n borderRadius={variant === 'ordered-filled' ? 'max' : undefined}\n backgroundColor={\n variant === 'ordered-filled'\n ? getIn(theme.colors, 'feedback.background.neutral.subtle')\n : undefined\n }\n >\n <Text\n variant=\"body\"\n color=\"surface.text.gray.muted\"\n size={variant === 'ordered' ? size : 'xsmall'}\n >\n {`${getOrderedListItemBullet({\n itemNumber: _itemNumber ?? 1,\n level: level ?? 1,\n })}${variant === 'ordered' ? '.' : ''}`}\n </Text>\n </BaseBox>\n )}\n <ListItemContentChildren size={size}>{validChildItem}</ListItemContentChildren>\n </BaseBox>\n {childList}\n </StyledListItem>\n );\n};\n\nconst ListItem = assignWithoutSideEffects(_ListItem, { componentId: MetaConstants.ListItem });\n\nexport { ListItem };\nexport type { ListItemProps };\n"],"names":["StyledListItem","styled","ListItemElement","withConfig","displayName","componentId","_ref","level","theme","variant","hasIcon","marginLeft","getIn","listItemMarginLeft","concat","ListItemContentChildren","_ref2","children","size","getPlatformType","_jsx","BaseBox","display","flexDirection","flexWrap","map","child","index","Text","_ListItem","_ref3","_ref4","Icon","icon","listItemIconColor","iconColor","_itemNumber","testID","_useListContext","useListContext","ListContextIcon","_useTheme","useTheme","platform","ItemIcon","iconColorToken","throwBladeError","message","moduleName","childrenArray","React","Children","toArray","validChildItem","filter","getComponentId","MetaConstants","List","isValidAllowedChildren","ListItemLink","ListItemText","ListItemCode","childList","Boolean","_jsxs","_objectSpread","metaAttribute","name","ListItem","alignItems","marginBottom","listItemMarginBottom","marginRight","listItemBulletMarginRight","marginTop","listItemBulletMarginTop","alignSelf","color","UnorderedItemIcon","width","listItemOrderedBulletBoxSize","height","flexShrink","justifyContent","borderRadius","undefined","backgroundColor","colors","getOrderedListItemBullet","itemNumber","assignWithoutSideEffects"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDA,IAAMA,cAAc,gBAAGC,MAAM,CAACC,eAAe,CAAC,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,0BAAA;EAAAC,WAAA,EAAA,aAAA;AAAA,CAAA,CAAA,CAI3C,UAAAC,IAAA,EAAA;AAAA,EAAA,I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QAAA,EAAEoC,cAAAA;AAAc,OAA0B,CAAC,CAAA;KACxE,CAAC,EACTS,SAAS,CAAA;AAAA,GAAA,CACI,CAAC,CAAA;AAErB,CAAC,CAAA;AAED,IAAMM,QAAQ,gBAAGsB,wBAAwB,CAAC7D,SAAS,EAAE;EAAExB,WAAW,EAAEmD,aAAa,CAACY,QAAAA;AAAS,CAAC;;;;"}
1
+ {"version":3,"file":"ListItem.js","sources":["../../../../../../src/components/List/ListItem.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport React from 'react';\nimport { useListContext } from './ListContext';\nimport { UnorderedItemIcon } from './ListItemIcons';\nimport { ListItemElement } from './ListItemElement';\nimport {\n listItemBulletMarginRight,\n listItemBulletMarginTop,\n listItemOrderedBulletBoxSize,\n listItemMarginBottom,\n listItemMarginLeft,\n} from './listTokens';\nimport type { ListProps } from './List';\nimport { getOrderedListItemBullet } from './getOrderedListItemBullet';\nimport getIn from '~utils/lodashButBetter/get';\nimport { Text } from '~components/Typography';\nimport type { IconComponent } from '~components/Icons';\nimport { useTheme } from '~components/BladeProvider';\nimport BaseBox from '~components/Box/BaseBox';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { TestID } from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getComponentId, isValidAllowedChildren } from '~utils/isValidAllowedChildren';\nimport { getPlatformType } from '~utils/getPlatformType';\nimport { throwBladeError } from '~utils/logger';\n\ntype ListItemProps = {\n /**\n * Children to be rendered for ListItem. This can be a text, ListItemLink or another List.\n *\n */\n children: React.ReactNode;\n /**\n * Icon to be rendered for a ListItem's bullet.\n *\n */\n icon?: IconComponent;\n /**\n * Icon color of the ListItem's bullet.\n *\n */\n iconColor?: ListProps['iconColor'];\n /**\n * This is a private prop to be used only for internal logic purposes.\n *\n */\n _itemNumber?: undefined;\n} & TestID;\n\nconst StyledListItem = styled(ListItemElement)<{\n level?: number;\n variant: NonNullable<ListProps['variant']>;\n hasIcon: boolean;\n}>(({ level, theme, variant, hasIcon }) => ({\n marginLeft: level\n ? getIn(\n theme,\n listItemMarginLeft[\n `${variant}${variant === 'unordered' && hasIcon ? 'WithIcon' : ''}` as NonNullable<\n ListProps['variant'] | 'unorderedWithIcon'\n >\n ][level],\n )\n : 0,\n}));\n\nconst ListItemContentChildren = ({\n children,\n size,\n}: {\n children: React.ReactNode[];\n size: NonNullable<ListProps['size']>;\n}): React.ReactElement => {\n /* Having a <View><Text>...</Text><View/> inside <Text /> breaks vertical alignment. Issue: https://github.com/facebook/react-native/issues/31955\n As a workaround, we wrap individual strings in their own <Text /> and handle alignment with a parent <View> (BaseBox).\n */\n return getPlatformType() === 'react-native' ? (\n <BaseBox display=\"flex\" flexDirection=\"row\" flexWrap=\"wrap\">\n {children.map((child, index) => {\n if (typeof child === 'string') {\n return (\n <Text key={index} variant=\"body\" size={size}>\n {child}\n </Text>\n );\n }\n return child;\n })}\n </BaseBox>\n ) : (\n <Text variant=\"body\" size={size}>\n {children}\n </Text>\n );\n};\n\nconst _ListItem = ({\n children,\n icon: Icon,\n iconColor: listItemIconColor,\n _itemNumber,\n testID,\n}: ListItemProps): React.ReactElement => {\n const { level, size, icon: ListContextIcon, variant, iconColor } = useListContext();\n const { theme, platform } = useTheme();\n const ItemIcon = Icon ?? ListContextIcon;\n const iconColorToken = listItemIconColor ?? iconColor ?? 'surface.icon.gray.muted';\n\n if (__DEV__) {\n if (level && level > 3) {\n throwBladeError({\n message: 'List Nesting is allowed only upto 3 levels.',\n moduleName: 'List',\n });\n }\n }\n\n const childrenArray = React.Children.toArray(children);\n\n // Get children that are not a List component and are valid allowed children\n const validChildItem = childrenArray.filter((child) => {\n if (getComponentId(child) === MetaConstants.List) return null;\n\n if (\n typeof child === 'string' ||\n typeof child === 'number' ||\n isValidAllowedChildren(child, MetaConstants.ListItemLink) ||\n isValidAllowedChildren(child, MetaConstants.ListItemText) ||\n isValidAllowedChildren(child, MetaConstants.ListItemCode)\n ) {\n return child;\n } else if (__DEV__) {\n throwBladeError({\n message: `You can only pass a List, ListItemLink, ListItemCode, ListItemText or a string as a child to ListItem.`,\n moduleName: 'ListItem',\n });\n }\n return null;\n });\n // Get child that is a List component\n const childList = childrenArray.filter((child) =>\n getComponentId(child) === MetaConstants.List ? child : null,\n );\n const hasIcon = Boolean(ItemIcon);\n\n return (\n <StyledListItem\n level={level}\n variant={variant}\n hasIcon={hasIcon}\n {...metaAttribute({ name: MetaConstants.ListItem, testID })}\n >\n <BaseBox\n display=\"flex\"\n flexDirection=\"row\"\n alignItems=\"center\"\n marginBottom={listItemMarginBottom}\n >\n {variant === 'unordered' ? (\n <BaseBox\n marginRight={listItemBulletMarginRight[variant]}\n marginTop={\n listItemBulletMarginTop[`${variant}${hasIcon ? 'WithIcon' : ''}`][platform][size]\n }\n display=\"flex\"\n alignSelf=\"flex-start\"\n >\n {ItemIcon ? (\n <ItemIcon size={size} color={iconColorToken} />\n ) : (\n <UnorderedItemIcon level={level} />\n )}\n </BaseBox>\n ) : (\n <BaseBox\n width={listItemOrderedBulletBoxSize[variant][platform][size]}\n height={listItemOrderedBulletBoxSize[variant][platform][size]}\n marginRight={listItemBulletMarginRight[variant]}\n marginTop={listItemBulletMarginTop[variant][platform][size]}\n display=\"flex\"\n flexShrink={0}\n justifyContent=\"center\"\n alignSelf=\"flex-start\"\n alignItems=\"center\"\n borderRadius={variant === 'ordered-filled' ? 'max' : undefined}\n backgroundColor={\n variant === 'ordered-filled'\n ? getIn(theme.colors, 'feedback.background.neutral.subtle')\n : undefined\n }\n >\n <Text\n variant=\"body\"\n color=\"surface.text.gray.muted\"\n size={variant === 'ordered' ? size : 'xsmall'}\n >\n {`${getOrderedListItemBullet({\n itemNumber: _itemNumber ?? 1,\n level: level ?? 1,\n })}${variant === 'ordered' ? '.' : ''}`}\n </Text>\n </BaseBox>\n )}\n <ListItemContentChildren size={size}>{validChildItem}</ListItemContentChildren>\n </BaseBox>\n {childList}\n </StyledListItem>\n );\n};\n\nconst ListItem = assignWithoutSideEffects(_ListItem, { componentId: MetaConstants.ListItem });\n\nexport { ListItem };\nexport type { ListItemProps };\n"],"names":["StyledListItem","styled","ListItemElement","withConfig","displayName","componentId","_ref","level","theme","variant","hasIcon","marginLeft","getIn","listItemMarginLeft","concat","ListItemContentChildren","_ref2","children","size","getPlatformType","_jsx","BaseBox","display","flexDirection","flexWrap","map","child","index","Text","_ListItem","_ref3","_ref4","Icon","icon","listItemIconColor","iconColor","_itemNumber","testID","_useListContext","useListContext","ListContextIcon","_useTheme","useTheme","platform","ItemIcon","iconColorToken","throwBladeError","message","moduleName","childrenArray","React","Children","toArray","validChildItem","filter","getComponentId","MetaConstants","List","isValidAllowedChildren","ListItemLink","ListItemText","ListItemCode","childList","Boolean","_jsxs","_objectSpread","metaAttribute","name","ListItem","alignItems","marginBottom","listItemMarginBottom","marginRight","listItemBulletMarginRight","marginTop","listItemBulletMarginTop","alignSelf","color","UnorderedItemIcon","width","listItemOrderedBulletBoxSize","height","flexShrink","justifyContent","borderRadius","undefined","backgroundColor","colors","getOrderedListItemBullet","itemNumber","assignWithoutSideEffects"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDA,IAAMA,cAAc,gBAAGC,MAAM,CAACC,eAAe,CAAC,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,0BAAA;EAAAC,WAAA,EAAA,aAAA;AAAA,CAAA,CAAA,CAI3C,UAAAC,IAAA,EAAA;AAAA,EAAA,IAAGC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAEC,KAAK,GAAAF,IAAA,CAALE,KAAK;IAAEC,OAAO,GAAAH,IAAA,CAAPG,OAAO;IAAEC,OAAO,GAAAJ,IAAA,CAAPI,OAAO,CAAA;EAAA,OAAQ;AAC1CC,IAAAA,UAAU,EAAEJ,KAAK,GACbK,KAAK,CACHJ,KAAK,EACLK,kBAAkB,CAAAC,EAAAA,CAAAA,MAAA,CACbL,OAAO,CAAAK,CAAAA,MAAA,CAAGL,OAAO,KA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
27
  import useTheme from '../BladeProvider/useTheme.js';
28
28
  import { logger } from '../../utils/logger/logger.js';
29
29
  import { Box } from '../Box/Box.js';
30
- import { makeAnalyticsAttribute } from '../../utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js';
31
30
  import { metaAttribute } from '../../utils/metaAttribute/metaAttribute.web.js';
32
31
  import { MetaConstants } from '../../utils/metaAttribute/metaConstants.js';
33
32
  import { makeAccessible } from '../../utils/makeAccessible/makeAccessible.web.js';
33
+ import { makeAnalyticsAttribute } from '../../utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js';
34
34
 
35
35
  var _excluded = ["isOpen", "children", "onDismiss", "initialFocusRef", "size", "accessibilityLabel", "zIndex"];
36
36
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -110,18 +110,17 @@ var Modal = function Modal(_ref2) {
110
110
  initialFocus: initialFocusRef !== null && initialFocusRef !== void 0 ? initialFocusRef : defaultInitialFocusRef,
111
111
  context: context,
112
112
  modal: true,
113
- children: /*#__PURE__*/jsxs(Box, _objectSpread(_objectSpread({
113
+ children: /*#__PURE__*/jsxs(Box, {
114
114
  zIndex: zIndex,
115
115
  position: "fixed",
116
- testID: "modal-wrapper"
117
- }, makeAnalyticsAttribute(rest)), {}, {
118
- children: [/*#__PURE__*/jsx(ModalBackdrop, {}), /*#__PURE__*/jsx(ModalContent, _objectSpread(_objectSpread(_objectSpread({}, metaAttribute({
116
+ testID: "modal-wrapper",
117
+ children: [/*#__PURE__*/jsx(ModalBackdrop, {}), /*#__PURE__*/jsx(ModalContent, _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, metaAttribute({
119
118
  name: MetaConstants.Modal
120
119
  })), makeAccessible({
121
120
  role: 'dialog',
122
121
  modal: true,
123
122
  label: accessibilityLabel
124
- })), {}, {
123
+ })), makeAnalyticsAttribute(rest)), {}, {
125
124
  maxWidth: size === 'full' ? '100%' : makeSize(modalMaxWidth[size]),
126
125
  minWidth: makeSize(modalMinWidth),
127
126
  maxHeight: modalMaxHeight[size],
@@ -139,7 +138,7 @@ var Modal = function Modal(_ref2) {
139
138
  overflow: "hidden",
140
139
  children: children
141
140
  }))]
142
- }))
141
+ })
143
142
  }) : null
144
143
  })
145
144
  });