@razorpay/blade 12.33.1 → 12.34.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 (174) hide show
  1. package/build/lib/native/components/Accordion/AccordionButton.native.js +1 -1
  2. package/build/lib/native/components/Accordion/AccordionButton.native.js.map +1 -1
  3. package/build/lib/native/components/Accordion/AccordionItemHeader.js +2 -1
  4. package/build/lib/native/components/Accordion/AccordionItemHeader.js.map +1 -1
  5. package/build/lib/native/components/Accordion/commonStyles.js +1 -1
  6. package/build/lib/native/components/Accordion/commonStyles.js.map +1 -1
  7. package/build/lib/native/components/ActionList/ActionListItem.js +1 -1
  8. package/build/lib/native/components/ActionList/ActionListItem.js.map +1 -1
  9. package/build/lib/native/components/BaseHeaderFooter/BaseHeader.js +1 -1
  10. package/build/lib/native/components/BaseHeaderFooter/BaseHeader.js.map +1 -1
  11. package/build/lib/native/components/Button/BaseButton/BaseButton.js +1 -1
  12. package/build/lib/native/components/Button/BaseButton/BaseButton.js.map +1 -1
  13. package/build/lib/native/components/Button/BaseButton/buttonTokens.js +1 -1
  14. package/build/lib/native/components/Button/BaseButton/buttonTokens.js.map +1 -1
  15. package/build/lib/native/components/Dropdown/Dropdown.js +1 -1
  16. package/build/lib/native/components/Dropdown/Dropdown.js.map +1 -1
  17. package/build/lib/native/components/Dropdown/DropdownButton.js +1 -1
  18. package/build/lib/native/components/Dropdown/DropdownButton.js.map +1 -1
  19. package/build/lib/native/components/Dropdown/InputDropdownButton.native.js +7 -0
  20. package/build/lib/native/components/Dropdown/InputDropdownButton.native.js.map +1 -0
  21. package/build/lib/native/components/Dropdown/dropdownComponentIds.js +1 -1
  22. package/build/lib/native/components/Dropdown/dropdownComponentIds.js.map +1 -1
  23. package/build/lib/native/components/Dropdown/useDropdown.js.map +1 -1
  24. package/build/lib/native/components/Icons/ChevronUpDownIcon/ChevronUpDownIcon.js +12 -0
  25. package/build/lib/native/components/Icons/ChevronUpDownIcon/ChevronUpDownIcon.js.map +1 -0
  26. package/build/lib/native/components/Input/BaseInput/BaseInput.js +1 -1
  27. package/build/lib/native/components/Input/BaseInput/BaseInput.js.map +1 -1
  28. package/build/lib/native/components/Input/BaseInput/BaseInputVisuals.js +1 -1
  29. package/build/lib/native/components/Input/BaseInput/BaseInputVisuals.js.map +1 -1
  30. package/build/lib/native/components/Input/BaseInput/baseInputStyles.js +1 -1
  31. package/build/lib/native/components/Input/BaseInput/baseInputStyles.js.map +1 -1
  32. package/build/lib/native/components/Input/BaseInput/baseInputTokens.js +1 -1
  33. package/build/lib/native/components/Input/BaseInput/baseInputTokens.js.map +1 -1
  34. package/build/lib/native/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js +2 -5
  35. package/build/lib/native/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js.map +1 -1
  36. package/build/lib/native/components/Input/SearchInput/SearchInput.js +12 -3
  37. package/build/lib/native/components/Input/SearchInput/SearchInput.js.map +1 -1
  38. package/build/lib/native/components/Input/TextInput/TextInput.js +11 -3
  39. package/build/lib/native/components/Input/TextInput/TextInput.js.map +1 -1
  40. package/build/lib/native/components/Typography/Text/Text.js +1 -1
  41. package/build/lib/native/components/Typography/Text/Text.js.map +1 -1
  42. package/build/lib/native/components/index.js +2 -0
  43. package/build/lib/native/components/index.js.map +1 -1
  44. package/build/lib/native/utils/useControlledDropdownInput/useControlledDropdownInput.js +14 -0
  45. package/build/lib/native/utils/useControlledDropdownInput/useControlledDropdownInput.js.map +1 -0
  46. package/build/lib/web/development/components/Accordion/AccordionItemHeader.js +18 -2
  47. package/build/lib/web/development/components/Accordion/AccordionItemHeader.js.map +1 -1
  48. package/build/lib/web/development/components/Accordion/StyledAccordionButton.web.js +4 -3
  49. package/build/lib/web/development/components/Accordion/StyledAccordionButton.web.js.map +1 -1
  50. package/build/lib/web/development/components/Accordion/commonStyles.js +1 -11
  51. package/build/lib/web/development/components/Accordion/commonStyles.js.map +1 -1
  52. package/build/lib/web/development/components/ActionList/ActionListItem.js +2 -1
  53. package/build/lib/web/development/components/ActionList/ActionListItem.js.map +1 -1
  54. package/build/lib/web/development/components/BaseHeaderFooter/BaseHeader.js +6 -3
  55. package/build/lib/web/development/components/BaseHeaderFooter/BaseHeader.js.map +1 -1
  56. package/build/lib/web/development/components/Button/BaseButton/BaseButton.js +24 -3
  57. package/build/lib/web/development/components/Button/BaseButton/BaseButton.js.map +1 -1
  58. package/build/lib/web/development/components/Button/BaseButton/StyledBaseButton.web.js +14 -2
  59. package/build/lib/web/development/components/Button/BaseButton/StyledBaseButton.web.js.map +1 -1
  60. package/build/lib/web/development/components/Button/BaseButton/buttonTokens.js +19 -0
  61. package/build/lib/web/development/components/Button/BaseButton/buttonTokens.js.map +1 -1
  62. package/build/lib/web/development/components/Dropdown/Dropdown.js +4 -1
  63. package/build/lib/web/development/components/Dropdown/Dropdown.js.map +1 -1
  64. package/build/lib/web/development/components/Dropdown/DropdownButton.js +4 -1
  65. package/build/lib/web/development/components/Dropdown/DropdownButton.js.map +1 -1
  66. package/build/lib/web/development/components/Dropdown/DropdownOverlay.web.js +4 -2
  67. package/build/lib/web/development/components/Dropdown/DropdownOverlay.web.js.map +1 -1
  68. package/build/lib/web/development/components/Dropdown/InputDropdownButton.web.js +180 -0
  69. package/build/lib/web/development/components/Dropdown/InputDropdownButton.web.js.map +1 -0
  70. package/build/lib/web/development/components/Dropdown/dropdownComponentIds.js +2 -1
  71. package/build/lib/web/development/components/Dropdown/dropdownComponentIds.js.map +1 -1
  72. package/build/lib/web/development/components/Dropdown/index.js +1 -0
  73. package/build/lib/web/development/components/Dropdown/index.js.map +1 -1
  74. package/build/lib/web/development/components/Dropdown/useDropdown.js.map +1 -1
  75. package/build/lib/web/development/components/Icons/ChevronUpDownIcon/ChevronUpDownIcon.js +40 -0
  76. package/build/lib/web/development/components/Icons/ChevronUpDownIcon/ChevronUpDownIcon.js.map +1 -0
  77. package/build/lib/web/development/components/Icons/ChevronUpDownIcon/index.js +2 -0
  78. package/build/lib/web/development/components/Icons/ChevronUpDownIcon/index.js.map +1 -0
  79. package/build/lib/web/development/components/Icons/index.js +1 -0
  80. package/build/lib/web/development/components/Icons/index.js.map +1 -1
  81. package/build/lib/web/development/components/Input/BaseInput/BaseInput.js +10 -4
  82. package/build/lib/web/development/components/Input/BaseInput/BaseInput.js.map +1 -1
  83. package/build/lib/web/development/components/Input/BaseInput/BaseInputVisuals.js +32 -8
  84. package/build/lib/web/development/components/Input/BaseInput/BaseInputVisuals.js.map +1 -1
  85. package/build/lib/web/development/components/Input/BaseInput/StyledBaseInput.web.js +2 -1
  86. package/build/lib/web/development/components/Input/BaseInput/StyledBaseInput.web.js.map +1 -1
  87. package/build/lib/web/development/components/Input/BaseInput/baseInputStyles.js +8 -4
  88. package/build/lib/web/development/components/Input/BaseInput/baseInputStyles.js.map +1 -1
  89. package/build/lib/web/development/components/Input/BaseInput/baseInputTokens.js +1 -1
  90. package/build/lib/web/development/components/Input/BaseInput/baseInputTokens.js.map +1 -1
  91. package/build/lib/web/development/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js +25 -124
  92. package/build/lib/web/development/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js.map +1 -1
  93. package/build/lib/web/development/components/Input/PhoneNumberInput/CountrySelector.web.js +6 -4
  94. package/build/lib/web/development/components/Input/PhoneNumberInput/CountrySelector.web.js.map +1 -1
  95. package/build/lib/web/development/components/Input/SearchInput/SearchInput.js +97 -30
  96. package/build/lib/web/development/components/Input/SearchInput/SearchInput.js.map +1 -1
  97. package/build/lib/web/development/components/Input/TextInput/TextInput.js +123 -31
  98. package/build/lib/web/development/components/Input/TextInput/TextInput.js.map +1 -1
  99. package/build/lib/web/development/components/Toast/ToastContainer.web.js +12 -8
  100. package/build/lib/web/development/components/Toast/ToastContainer.web.js.map +1 -1
  101. package/build/lib/web/development/components/Typography/Text/Text.js +0 -1
  102. package/build/lib/web/development/components/Typography/Text/Text.js.map +1 -1
  103. package/build/lib/web/development/components/index.js +2 -0
  104. package/build/lib/web/development/components/index.js.map +1 -1
  105. package/build/lib/web/development/utils/useControlledDropdownInput/index.js +2 -0
  106. package/build/lib/web/development/utils/useControlledDropdownInput/index.js.map +1 -0
  107. package/build/lib/web/development/utils/useControlledDropdownInput/useControlledDropdownInput.js +108 -0
  108. package/build/lib/web/development/utils/useControlledDropdownInput/useControlledDropdownInput.js.map +1 -0
  109. package/build/lib/web/production/components/Accordion/AccordionItemHeader.js +18 -2
  110. package/build/lib/web/production/components/Accordion/AccordionItemHeader.js.map +1 -1
  111. package/build/lib/web/production/components/Accordion/StyledAccordionButton.web.js +4 -3
  112. package/build/lib/web/production/components/Accordion/StyledAccordionButton.web.js.map +1 -1
  113. package/build/lib/web/production/components/Accordion/commonStyles.js +1 -11
  114. package/build/lib/web/production/components/Accordion/commonStyles.js.map +1 -1
  115. package/build/lib/web/production/components/ActionList/ActionListItem.js +2 -1
  116. package/build/lib/web/production/components/ActionList/ActionListItem.js.map +1 -1
  117. package/build/lib/web/production/components/BaseHeaderFooter/BaseHeader.js +6 -3
  118. package/build/lib/web/production/components/BaseHeaderFooter/BaseHeader.js.map +1 -1
  119. package/build/lib/web/production/components/Button/BaseButton/BaseButton.js +24 -3
  120. package/build/lib/web/production/components/Button/BaseButton/BaseButton.js.map +1 -1
  121. package/build/lib/web/production/components/Button/BaseButton/StyledBaseButton.web.js +14 -2
  122. package/build/lib/web/production/components/Button/BaseButton/StyledBaseButton.web.js.map +1 -1
  123. package/build/lib/web/production/components/Button/BaseButton/buttonTokens.js +19 -0
  124. package/build/lib/web/production/components/Button/BaseButton/buttonTokens.js.map +1 -1
  125. package/build/lib/web/production/components/Dropdown/Dropdown.js +4 -1
  126. package/build/lib/web/production/components/Dropdown/Dropdown.js.map +1 -1
  127. package/build/lib/web/production/components/Dropdown/DropdownButton.js +4 -1
  128. package/build/lib/web/production/components/Dropdown/DropdownButton.js.map +1 -1
  129. package/build/lib/web/production/components/Dropdown/DropdownOverlay.web.js +4 -2
  130. package/build/lib/web/production/components/Dropdown/DropdownOverlay.web.js.map +1 -1
  131. package/build/lib/web/production/components/Dropdown/InputDropdownButton.web.js +180 -0
  132. package/build/lib/web/production/components/Dropdown/InputDropdownButton.web.js.map +1 -0
  133. package/build/lib/web/production/components/Dropdown/dropdownComponentIds.js +2 -1
  134. package/build/lib/web/production/components/Dropdown/dropdownComponentIds.js.map +1 -1
  135. package/build/lib/web/production/components/Dropdown/index.js +1 -0
  136. package/build/lib/web/production/components/Dropdown/index.js.map +1 -1
  137. package/build/lib/web/production/components/Dropdown/useDropdown.js.map +1 -1
  138. package/build/lib/web/production/components/Icons/ChevronUpDownIcon/ChevronUpDownIcon.js +40 -0
  139. package/build/lib/web/production/components/Icons/ChevronUpDownIcon/ChevronUpDownIcon.js.map +1 -0
  140. package/build/lib/web/production/components/Icons/ChevronUpDownIcon/index.js +2 -0
  141. package/build/lib/web/production/components/Icons/ChevronUpDownIcon/index.js.map +1 -0
  142. package/build/lib/web/production/components/Icons/index.js +1 -0
  143. package/build/lib/web/production/components/Icons/index.js.map +1 -1
  144. package/build/lib/web/production/components/Input/BaseInput/BaseInput.js +10 -4
  145. package/build/lib/web/production/components/Input/BaseInput/BaseInput.js.map +1 -1
  146. package/build/lib/web/production/components/Input/BaseInput/BaseInputVisuals.js +32 -8
  147. package/build/lib/web/production/components/Input/BaseInput/BaseInputVisuals.js.map +1 -1
  148. package/build/lib/web/production/components/Input/BaseInput/StyledBaseInput.web.js +2 -1
  149. package/build/lib/web/production/components/Input/BaseInput/StyledBaseInput.web.js.map +1 -1
  150. package/build/lib/web/production/components/Input/BaseInput/baseInputStyles.js +8 -4
  151. package/build/lib/web/production/components/Input/BaseInput/baseInputStyles.js.map +1 -1
  152. package/build/lib/web/production/components/Input/BaseInput/baseInputTokens.js +1 -1
  153. package/build/lib/web/production/components/Input/BaseInput/baseInputTokens.js.map +1 -1
  154. package/build/lib/web/production/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js +25 -124
  155. package/build/lib/web/production/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js.map +1 -1
  156. package/build/lib/web/production/components/Input/PhoneNumberInput/CountrySelector.web.js +6 -4
  157. package/build/lib/web/production/components/Input/PhoneNumberInput/CountrySelector.web.js.map +1 -1
  158. package/build/lib/web/production/components/Input/SearchInput/SearchInput.js +97 -30
  159. package/build/lib/web/production/components/Input/SearchInput/SearchInput.js.map +1 -1
  160. package/build/lib/web/production/components/Input/TextInput/TextInput.js +123 -31
  161. package/build/lib/web/production/components/Input/TextInput/TextInput.js.map +1 -1
  162. package/build/lib/web/production/components/Toast/ToastContainer.web.js +12 -8
  163. package/build/lib/web/production/components/Toast/ToastContainer.web.js.map +1 -1
  164. package/build/lib/web/production/components/Typography/Text/Text.js +0 -1
  165. package/build/lib/web/production/components/Typography/Text/Text.js.map +1 -1
  166. package/build/lib/web/production/components/index.js +2 -0
  167. package/build/lib/web/production/components/index.js.map +1 -1
  168. package/build/lib/web/production/utils/useControlledDropdownInput/index.js +2 -0
  169. package/build/lib/web/production/utils/useControlledDropdownInput/index.js.map +1 -0
  170. package/build/lib/web/production/utils/useControlledDropdownInput/useControlledDropdownInput.js +108 -0
  171. package/build/lib/web/production/utils/useControlledDropdownInput/useControlledDropdownInput.js.map +1 -0
  172. package/build/types/components/index.d.ts +2875 -2768
  173. package/build/types/components/index.native.d.ts +2719 -2686
  174. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"SearchInput.js","sources":["../../../../../../../src/components/Input/SearchInput/SearchInput.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport type { ReactElement, ReactNode } from 'react';\nimport type { TextInput as TextInputReactNative } from 'react-native';\nimport type { BaseInputProps } from '../BaseInput';\nimport { BaseInput } from '../BaseInput';\nimport { getKeyboardAndAutocompleteProps } from '../BaseInput/utils';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport { CloseIcon, SearchIcon } from '~components/Icons';\nimport { IconButton } from '~components/Button/IconButton';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { MetaConstants } from '~utils/metaAttribute';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Spinner } from '~components/Spinner';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getPlatformType } from '~utils';\nimport { useMergeRefs } from '~utils/useMergeRefs';\nimport type {\n BladeElementRef,\n BladeElementRefWithValue,\n DataAnalyticsAttribute,\n} from '~utils/types';\nimport { dropdownComponentIds } from '~components/Dropdown/dropdownComponentIds';\nimport { useDropdown } from '~components/Dropdown/useDropdown';\n\ntype SearchInputCommonProps = Pick<\n BaseInputProps,\n | 'label'\n | 'accessibilityLabel'\n | 'labelPosition'\n | 'helpText'\n | 'placeholder'\n | 'defaultValue'\n | 'name'\n | 'onChange'\n | 'onFocus'\n | 'onBlur'\n | 'value'\n | 'isDisabled'\n | 'autoFocus'\n | 'onSubmit'\n | 'autoCapitalize'\n | 'testID'\n | 'onClick'\n | 'size'\n | keyof DataAnalyticsAttribute\n> & {\n /**\n * Event handler to handle the onClick event for clear button.\n */\n onClearButtonClick?: () => void;\n\n /**\n * Decides whether to show a loading spinner for the input field.\n */\n isLoading?: boolean;\n /**\n * Toggle the visibility of the search icon.\n *\n * @default true\n */\n showSearchIcon?: boolean;\n} & StyledPropsBlade;\n\n/*\n Mandatory accessibilityLabel prop when label is not provided\n*/\ntype SearchInputPropsWithA11yLabel = {\n /**\n * Label to be shown for the input field\n */\n label?: undefined;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel: string;\n};\n\n/*\n Optional accessibilityLabel prop when label is provided\n*/\ntype SearchInputPropsWithLabel = {\n /**\n * Label to be shown for the input field\n */\n label: string;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel?: string;\n};\n\ntype SearchInputProps = (SearchInputPropsWithA11yLabel | SearchInputPropsWithLabel) &\n SearchInputCommonProps;\n\n// need to do this to tell TS to infer type as SearchInput of React Native and make it believe that `ref.current.clear()` exists\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst isReactNative = (_textInputRef?: any): _textInputRef is TextInputReactNative => {\n return getPlatformType() === 'react-native';\n};\n\nconst _SearchInput: React.ForwardRefRenderFunction<BladeElementRef, SearchInputProps> = (\n {\n label,\n accessibilityLabel,\n labelPosition = 'top',\n placeholder,\n defaultValue,\n name,\n value,\n onChange,\n onClick,\n onFocus,\n onBlur,\n onSubmit,\n isDisabled,\n helpText,\n onClearButtonClick,\n isLoading,\n autoCapitalize,\n autoFocus,\n testID,\n size = 'medium',\n showSearchIcon = true,\n ...rest\n },\n ref,\n): ReactElement => {\n const textInputRef = React.useRef<BladeElementRefWithValue>(null);\n const mergedRef = useMergeRefs(ref, textInputRef);\n const [shouldShowClearButton, setShouldShowClearButton] = useState(false);\n const {\n triggererWrapperRef,\n onTriggerKeydown,\n onTriggerClick,\n dropdownTriggerer,\n } = useDropdown();\n const isInsideDropdown = dropdownTriggerer === 'SearchInput';\n\n React.useEffect(() => {\n setShouldShowClearButton(Boolean(defaultValue ?? value));\n }, [defaultValue, value]);\n\n const renderInteractionElement = (): ReactNode => {\n if (isLoading) {\n return <Spinner accessibilityLabel=\"Loading Content\" color=\"primary\" />;\n }\n\n if (shouldShowClearButton) {\n return (\n <IconButton\n size=\"medium\"\n icon={CloseIcon}\n onClick={() => {\n if (isEmpty(value) && textInputRef.current) {\n // when the input field is uncontrolled take the ref and clear the input and then call the onClearButtonClick function\n if (isReactNative(textInputRef.current)) {\n textInputRef.current.clear();\n textInputRef.current.focus();\n } else if (textInputRef.current instanceof HTMLInputElement) {\n textInputRef.current.value = '';\n textInputRef.current.focus();\n }\n }\n\n // if the input field is controlled just call the click handler and the value change shall be left upto the consumer\n onClearButtonClick?.();\n textInputRef?.current?.focus();\n setShouldShowClearButton(false);\n }}\n isDisabled={isDisabled}\n accessibilityLabel=\"Clear Input Content\"\n />\n );\n }\n\n return null;\n };\n\n return (\n <BaseBox position=\"relative\">\n <BaseInput\n id=\"searchinput\"\n componentName={MetaConstants.SearchInput}\n ref={mergedRef}\n isDropdownTrigger={true}\n setInputWrapperRef={\n isInsideDropdown\n ? (wrapperNode) => {\n triggererWrapperRef.current = wrapperNode;\n }\n : undefined\n }\n label={label as string}\n accessibilityLabel={accessibilityLabel}\n hideLabelText={!Boolean(label)}\n labelPosition={labelPosition}\n placeholder={placeholder}\n defaultValue={defaultValue}\n value={value}\n name={name}\n onKeyDown={isInsideDropdown ? onTriggerKeydown : undefined}\n onChange={({ name, value }) => {\n if (value?.length) {\n // show the clear button when the user starts typing in\n setShouldShowClearButton(true);\n }\n\n if (shouldShowClearButton && !value?.length) {\n // hide the clear button when the input field is empty\n setShouldShowClearButton(false);\n }\n\n onChange?.({ name, value });\n }}\n onClick={(e) => {\n if (isDisabled) return;\n if (isInsideDropdown) {\n onTriggerClick();\n }\n onClick?.(e);\n }}\n onFocus={onFocus}\n onBlur={onBlur}\n onSubmit={onSubmit}\n isDisabled={isDisabled}\n leadingIcon={showSearchIcon ? SearchIcon : undefined}\n trailingInteractionElement={renderInteractionElement()}\n helpText={helpText}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n testID={testID}\n {...getKeyboardAndAutocompleteProps({\n type: 'search',\n autoCapitalize,\n })}\n size={size}\n {...rest}\n />\n </BaseBox>\n );\n};\n\nconst SearchInput = assignWithoutSideEffects(React.forwardRef(_SearchInput), {\n displayName: 'SearchInput',\n componentId: dropdownComponentIds.triggers.SearchInput,\n});\n\nexport type { SearchInputProps };\nexport { SearchInput };\n"],"names":["isReactNative","_textInputRef","getPlatformType","_SearchInput","_ref","ref","label","accessibilityLabel","_ref$labelPosition","labelPosition","placeholder","defaultValue","name","value","onChange","onClick","onFocus","onBlur","onSubmit","isDisabled","helpText","onClearButtonClick","isLoading","autoCapitalize","autoFocus","testID","_ref$size","size","_ref$showSearchIcon","showSearchIcon","rest","_objectWithoutProperties","_excluded","textInputRef","React","useRef","mergedRef","useMergeRefs","_useState","useState","_useState2","_slicedToArray","shouldShowClearButton","setShouldShowClearButton","_useDropdown","useDropdown","triggererWrapperRef","onTriggerKeydown","onTriggerClick","dropdownTriggerer","isInsideDropdown","useEffect","Boolean","renderInteractionElement","_jsx","Spinner","color","IconButton","icon","CloseIcon","_textInputRef$current","isEmpty","current","clear","focus","HTMLInputElement","BaseBox","position","children","BaseInput","_objectSpread","id","componentName","MetaConstants","SearchInput","isDropdownTrigger","setInputWrapperRef","wrapperNode","undefined","hideLabelText","onKeyDown","_ref2","length","e","leadingIcon","SearchIcon","trailingInteractionElement","getKeyboardAndAutocompleteProps","type","assignWithoutSideEffects","forwardRef","displayName","componentId","dropdownComponentIds","triggers"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8FA;AACA;AACA,IAAMA,aAAa,GAAG,SAAhBA,aAAaA,CAAIC,aAAmB,EAA4C;AACpF,EAAA,OAAOC,eAAe,EAAE,KAAK,cAAc,CAAA;AAC7C,CAAC,CAAA;AAED,IAAMC,YAA+E,GAAG,SAAlFA,YAA+EA,CAAAC,IAAA,EAyBnFC,GAAG,EACc;AAAA,EAAA,IAxBfC,KAAK,GAAAF,IAAA,CAALE,KAAK;IACLC,kBAAkB,GAAAH,IAAA,CAAlBG,kBAAkB;IAAAC,kBAAA,GAAAJ,IAAA,CAClBK,aAAa;AAAbA,IAAAA,aAAa,GAAAD,kBAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,kBAAA;IACrBE,WAAW,GAAAN,IAAA,CAAXM,WAAW;IACXC,YAAY,GAAAP,IAAA,CAAZO,YAAY;IACZC,IAAI,GAAAR,IAAA,CAAJQ,IAAI;IACJC,KAAK,GAAAT,IAAA,CAALS,KAAK;IACLC,SAAQ,GAAAV,IAAA,CAARU,QAAQ;IACRC,QAAO,GAAAX,IAAA,CAAPW,OAAO;IACPC,OAAO,GAAAZ,IAAA,CAAPY,OAAO;IACPC,MAAM,GAAAb,IAAA,CAANa,MAAM;IACNC,QAAQ,GAAAd,IAAA,CAARc,QAAQ;IACRC,UAAU,GAA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ACnBC,MAAAA,UAAU,EAAEA,UAAW;AACvBiE,MAAAA,WAAW,EAAEvD,cAAc,GAAGwD,UAAU,GAAGP,SAAU;MACrDQ,0BAA0B,EAAEjC,wBAAwB,EAAG;AACvDjC,MAAAA,QAAQ,EAAEA,QAAAA;AACV;AAAA;AACAI,MAAAA,SAAS,EAAEA,SAAU;AACrBC,MAAAA,MAAM,EAAEA,MAAAA;AAAO,KAAA,EACX8D,+BAA+B,CAAC;AAClCC,MAAAA,IAAI,EAAE,QAAQ;AACdjE,MAAAA,cAAc,EAAdA,cAAAA;AACF,KAAC,CAAC,CAAA,EAAA,EAAA,EAAA;AACFI,MAAAA,IAAI,EAAEA,IAAAA;AAAK,KAAA,EACPG,IAAI,CACT,CAAA;AAAC,GACK,CAAC,CAAA;AAEd,CAAC,CAAA;AAEK4C,IAAAA,WAAW,gBAAGe,wBAAwB,eAACvD,cAAK,CAACwD,UAAU,CAACvF,YAAY,CAAC,EAAE;AAC3EwF,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 | '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,OAAOC,eAAe,EAAE,KAAK,cAAc,CAAA;AAC7C,CAAC,CAAA;AAED,IAAMC,YAA+E,GAAG,SAAlFA,YAA+EA,CAAAC,IAAA,EA0BnFC,GAAG,EACc;AAAA,EAAA,IAzBfC,KAAK,GAAAF,IAAA,CAALE,KAAK;IACLC,kBAAkB,GAAAH,IAAA,CAAlBG,kBAAkB;IAAAC,kBAAA,GAAAJ,IAAA,CAClBK,aAAa;AAAbA,IAAAA,aAAa,GAAAD,kBAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,kBAAA;IACrBE,WAAW,GAAAN,IAAA,CAAXM,WAAW;IACXC,YAAY,GAAAP,IAAA,CAAZO,YAAY;IACZC,IAAI,GAAAR,IAAA,CAAJQ,IAAI;IACJC,KAAK,GAAAT,IAAA,CAALS,KAAK;IACLC,SAAQ,GAAAV,IAAA,CAARU,QAAQ;IACRC,QAAO,GAAAX,IAAA,CAAPW,OAAO;IACPC,OAAO,GAAAZ,IAAA,CAAPY,OAAO;IACPC,MAAM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MAAAA,WAAW,EAAEvF,cAAc,GAAGwF,UAAU,GAAGP,SAAU;MACrDQ,0BAA0B,EAAE3B,wBAAwB,EAAG;MACvD4B,gBAAgB,EAAEvD,sBAAsB,EAAG;AAC3C5C,MAAAA,QAAQ,EAAEA,QAAAA;AACV;AAAA;AACAI,MAAAA,SAAS,EAAEA,SAAU;AACrBC,MAAAA,MAAM,EAAEA,MAAAA;AAAO,KAAA,EACX+F,+BAA+B,CAAC;AAClC/C,MAAAA,IAAI,EAAE,QAAQ;AACdlD,MAAAA,cAAc,EAAdA,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,CAACvH,YAAY,CAAC,EAAE;AAC3EwH,EAAAA,WAAW,EAAE,aAAa;AAC1BC,EAAAA,WAAW,EAAEC,oBAAoB,CAACC,QAAQ,CAACpB,WAAAA;AAC7C,CAAC;;;;"}
@@ -1,7 +1,7 @@
1
1
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
2
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
3
3
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
4
- import React__default, { useState } from 'react';
4
+ import React__default, { useState, useRef, useEffect } from 'react';
5
5
  import '../BaseInput/index.js';
6
6
  import { getKeyboardAndAutocompleteProps } from '../BaseInput/utils.js';
7
7
  import { useTaggedInput } from '../BaseInput/useTaggedInput.js';
@@ -16,18 +16,24 @@ import '../../../utils/assignWithoutSideEffects/index.js';
16
16
  import '../../../utils/index.js';
17
17
  import { useMergeRefs } from '../../../utils/useMergeRefs.js';
18
18
  import { hintMarginTop } from '../../Form/formTokens.js';
19
- import { jsx } from 'react/jsx-runtime';
19
+ import '../../Divider/index.js';
20
+ import '../../../utils/isValidAllowedChildren/index.js';
21
+ import '../../Dropdown/index.js';
22
+ import { jsx, jsxs } from 'react/jsx-runtime';
20
23
  import { getPlatformType } from '../../../utils/getPlatformType/getPlatformType.js';
21
- import { Spinner } from '../../Spinner/Spinner/Spinner.js';
24
+ import { getComponentId } from '../../../utils/isValidAllowedChildren/isValidAllowedChildren.js';
25
+ import { DropdownOverlay } from '../../Dropdown/DropdownOverlay.web.js';
22
26
  import { IconButton } from '../../Button/IconButton/IconButton.js';
23
27
  import CloseIcon from '../../Icons/CloseIcon/CloseIcon.js';
28
+ import { Spinner } from '../../Spinner/Spinner/Spinner.js';
29
+ import { BaseBox } from '../../Box/BaseBox/BaseBox.web.js';
30
+ import { Divider } from '../../Divider/Divider.js';
24
31
  import { BaseInput } from '../BaseInput/BaseInput.js';
25
32
  import { MetaConstants } from '../../../utils/metaAttribute/metaConstants.js';
26
- import { BaseBox } from '../../Box/BaseBox/BaseBox.web.js';
27
33
  import { CharacterCounter } from '../../Form/CharacterCounter/CharacterCounter.js';
28
34
  import { assignWithoutSideEffects } from '../../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
29
35
 
30
- var _excluded = ["label", "accessibilityLabel", "labelPosition", "placeholder", "type", "defaultValue", "name", "value", "maxCharacters", "onChange", "onClick", "onFocus", "onBlur", "onSubmit", "isDisabled", "necessityIndicator", "validationState", "errorText", "helpText", "successText", "isRequired", "icon", "prefix", "showClearButton", "onClearButtonClick", "isLoading", "suffix", "autoFocus", "keyboardReturnKeyType", "autoCompleteSuggestionType", "autoCapitalize", "testID", "size", "leadingIcon", "trailingIcon", "isTaggedInput", "tags", "onTagChange"];
36
+ var _excluded = ["label", "accessibilityLabel", "labelPosition", "placeholder", "type", "defaultValue", "name", "value", "maxCharacters", "onChange", "onClick", "onFocus", "onBlur", "onSubmit", "isDisabled", "necessityIndicator", "validationState", "errorText", "helpText", "successText", "isRequired", "icon", "prefix", "showClearButton", "onClearButtonClick", "isLoading", "suffix", "autoFocus", "keyboardReturnKeyType", "autoCompleteSuggestionType", "autoCapitalize", "testID", "size", "leadingIcon", "trailingIcon", "isTaggedInput", "tags", "onTagChange", "trailing", "leading"];
31
37
  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; }
32
38
  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; }
33
39
  // 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 +42,7 @@ var isReactNative = function isReactNative(_textInputRef) {
36
42
  return getPlatformType() === 'react-native';
37
43
  };
38
44
  var _TextInput = function _TextInput(_ref, ref) {
45
+ var _leading$name, _trailing$name, _ref3;
39
46
  var label = _ref.label,
40
47
  accessibilityLabel = _ref.accessibilityLabel,
41
48
  _ref$labelPosition = _ref.labelPosition,
@@ -77,6 +84,8 @@ var _TextInput = function _TextInput(_ref, ref) {
77
84
  isTaggedInput = _ref.isTaggedInput,
78
85
  tags = _ref.tags,
79
86
  onTagChange = _ref.onTagChange,
87
+ trailing = _ref.trailing,
88
+ leading = _ref.leading,
80
89
  rest = _objectWithoutProperties(_ref, _excluded);
81
90
  var textInputRef = React__default.useRef(null);
82
91
  var mergedRef = useMergeRefs(ref, textInputRef);
@@ -104,9 +113,88 @@ var _TextInput = function _TextInput(_ref, ref) {
104
113
  handleTaggedInputKeydown = _useTaggedInput.handleTaggedInputKeydown,
105
114
  handleTaggedInputChange = _useTaggedInput.handleTaggedInputChange,
106
115
  handleTagsClear = _useTaggedInput.handleTagsClear;
116
+ var _React$useState = React__default.useState(false),
117
+ _React$useState2 = _slicedToArray(_React$useState, 2),
118
+ isTrailingDropDownOpen = _React$useState2[0],
119
+ setIsTrailingDropDownOpen = _React$useState2[1];
120
+ var _React$useState3 = React__default.useState(false),
121
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
122
+ isLeadingDropDownOpen = _React$useState4[0],
123
+ setIsLeadingDropDownOpen = _React$useState4[1];
124
+ var textInputWrapperRef = useRef(null);
125
+ useEffect(function () {
126
+ if (isTrailingDropDownOpen && isLeadingDropDownOpen) {
127
+ setIsLeadingDropDownOpen(false);
128
+ }
129
+ // eslint-disable-next-line react-hooks/exhaustive-deps
130
+ }, [isTrailingDropDownOpen]);
131
+ useEffect(function () {
132
+ if (isLeadingDropDownOpen && isTrailingDropDownOpen) {
133
+ setIsTrailingDropDownOpen(false);
134
+ }
135
+ // eslint-disable-next-line react-hooks/exhaustive-deps
136
+ }, [isLeadingDropDownOpen]);
137
+ var leadingDropDown = leading && getComponentId(leading) === 'Dropdown' ? leading : null;
138
+ var trailingDropdown = trailing && getComponentId(trailing) === 'Dropdown' ? trailing : null;
139
+ // we need to look into name of component and check if it 's and icon or a dropdown
140
+ var _leadingIcon = leading && typeof leading === 'function' && (_leading$name = leading.name) !== null && _leading$name !== void 0 && _leading$name.endsWith('Icon') ? leading : undefined;
141
+ var _trailingIcon = trailing && typeof trailing === 'function' && (_trailing$name = trailing.name) !== null && _trailing$name !== void 0 && _trailing$name.endsWith('Icon') ? trailing : undefined;
142
+ var hasLeadingInteractionElement = !_leadingIcon && !leadingDropDown && leading;
143
+ var hasTrailingInteractionElement = !_trailingIcon && !trailingDropdown && trailing;
144
+ var renderDropdown = function renderDropdown(dropdown, isOpen, setIsOpen, defaultPlacement) {
145
+ if (!dropdown) {
146
+ return null;
147
+ }
148
+ return /*#__PURE__*/React__default.cloneElement(dropdown, {
149
+ selectionType: 'single',
150
+ isOpen: isOpen,
151
+ onOpenChange: function onOpenChange(isOpen) {
152
+ setIsOpen(isOpen);
153
+ },
154
+ children: React__default.Children.map(dropdown.props.children, function (child) {
155
+ if (child.type === DropdownOverlay) {
156
+ return /*#__PURE__*/React__default.cloneElement(child, {
157
+ referenceRef: textInputWrapperRef,
158
+ _isNestedDropdown: true,
159
+ defaultPlacement: defaultPlacement
160
+ });
161
+ }
162
+ return child;
163
+ })
164
+ });
165
+ };
166
+ var renderLeadingDropDown = renderDropdown(leadingDropDown, isLeadingDropDownOpen, setIsLeadingDropDownOpen, 'bottom-start');
167
+ var renderTrailingDropDown = renderDropdown(trailingDropdown, isTrailingDropDownOpen, setIsTrailingDropDownOpen, 'bottom-end');
107
168
  React__default.useEffect(function () {
108
169
  setShouldShowClearButton(Boolean(showClearButton && (defaultValue !== null && defaultValue !== void 0 ? defaultValue : value)));
109
170
  }, [showClearButton, defaultValue, value]);
171
+ var renderClearButton = function renderClearButton() {
172
+ return /*#__PURE__*/jsx(IconButton, {
173
+ size: "medium",
174
+ icon: CloseIcon,
175
+ onClick: function onClick() {
176
+ var _textInputRef$current;
177
+ if (isEmpty(value) && textInputRef.current) {
178
+ // when the input field is uncontrolled take the ref and clear the input and then call the onClearButtonClick function
179
+ if (isReactNative(textInputRef.current)) {
180
+ textInputRef.current.clear();
181
+ textInputRef.current.focus();
182
+ } else if (textInputRef.current instanceof HTMLInputElement) {
183
+ textInputRef.current.value = '';
184
+ textInputRef.current.focus();
185
+ }
186
+ }
187
+ handleTagsClear();
188
+ // if the input field is controlled just call the click handler and the value change shall be left upto the consumer
189
+ onClearButtonClick === null || onClearButtonClick === void 0 ? void 0 : onClearButtonClick();
190
+ textInputRef === null || textInputRef === void 0 ? void 0 : (_textInputRef$current = textInputRef.current) === null || _textInputRef$current === void 0 ? void 0 : _textInputRef$current.focus();
191
+ setShouldShowClearButton(false);
192
+ },
193
+ isDisabled: isDisabled,
194
+ accessibilityLabel: "Clear Input Content"
195
+ });
196
+ };
197
+ var hasTrailingDropDown = Boolean(trailingDropdown);
110
198
  var renderInteractionElement = function renderInteractionElement() {
111
199
  if (isLoading) {
112
200
  return /*#__PURE__*/jsx(Spinner, {
@@ -114,38 +202,39 @@ var _TextInput = function _TextInput(_ref, ref) {
114
202
  color: "primary"
115
203
  });
116
204
  }
117
- if (shouldShowClearButton) {
118
- return /*#__PURE__*/jsx(IconButton, {
119
- size: "medium",
120
- icon: CloseIcon,
121
- onClick: function onClick() {
122
- var _textInputRef$current;
123
- if (isEmpty(value) && textInputRef.current) {
124
- // when the input field is uncontrolled take the ref and clear the input and then call the onClearButtonClick function
125
- if (isReactNative(textInputRef.current)) {
126
- textInputRef.current.clear();
127
- textInputRef.current.focus();
128
- } else if (textInputRef.current instanceof HTMLInputElement) {
129
- textInputRef.current.value = '';
130
- textInputRef.current.focus();
131
- }
132
- }
133
- handleTagsClear();
134
- // if the input field is controlled just call the click handler and the value change shall be left upto the consumer
135
- onClearButtonClick === null || onClearButtonClick === void 0 ? void 0 : onClearButtonClick();
136
- textInputRef === null || textInputRef === void 0 ? void 0 : (_textInputRef$current = textInputRef.current) === null || _textInputRef$current === void 0 ? void 0 : _textInputRef$current.focus();
137
- setShouldShowClearButton(false);
138
- },
139
- isDisabled: isDisabled,
140
- accessibilityLabel: "Clear Input Content"
205
+ if (shouldShowClearButton && hasTrailingDropDown) {
206
+ return /*#__PURE__*/jsxs(BaseBox, {
207
+ display: "flex",
208
+ gap: "spacing.3",
209
+ children: [renderClearButton(), " ", /*#__PURE__*/jsx(Divider, {
210
+ orientation: "vertical"
211
+ })]
212
+ });
213
+ }
214
+ if (showClearButton && hasTrailingInteractionElement) {
215
+ return /*#__PURE__*/jsxs(BaseBox, {
216
+ display: "flex",
217
+ gap: "spacing.3",
218
+ children: [renderClearButton(), " ", /*#__PURE__*/jsx(Divider, {
219
+ orientation: "vertical"
220
+ }), " ", trailing]
141
221
  });
142
222
  }
223
+ if (shouldShowClearButton) {
224
+ return renderClearButton();
225
+ }
226
+ if (hasTrailingInteractionElement) {
227
+ return trailing;
228
+ }
143
229
  return null;
144
230
  };
145
231
  return /*#__PURE__*/jsx(BaseInput, _objectSpread(_objectSpread({
146
232
  id: "textinput",
147
233
  componentName: MetaConstants.TextInput,
148
234
  ref: mergedRef,
235
+ setInputWrapperRef: function setInputWrapperRef(wrapperNode) {
236
+ textInputWrapperRef.current = wrapperNode;
237
+ },
149
238
  label: label,
150
239
  accessibilityLabel: accessibilityLabel,
151
240
  hideLabelText: !Boolean(label),
@@ -163,6 +252,9 @@ var _TextInput = function _TextInput(_ref, ref) {
163
252
  maxTagRows: "single",
164
253
  activeTagIndex: activeTagIndex,
165
254
  setActiveTagIndex: setActiveTagIndex,
255
+ leadingDropDown: renderLeadingDropDown,
256
+ trailingDropDown: renderTrailingDropDown,
257
+ leadingInteractionElement: hasLeadingInteractionElement ? leading : null,
166
258
  onChange: function onChange(_ref2) {
167
259
  var name = _ref2.name,
168
260
  value = _ref2.value;
@@ -199,10 +291,10 @@ var _TextInput = function _TextInput(_ref, ref) {
199
291
  isDisabled: isDisabled,
200
292
  necessityIndicator: necessityIndicator,
201
293
  isRequired: isRequired,
202
- leadingIcon: leadingIcon !== null && leadingIcon !== void 0 ? leadingIcon : icon,
294
+ leadingIcon: (_ref3 = _leadingIcon !== null && _leadingIcon !== void 0 ? _leadingIcon : leadingIcon) !== null && _ref3 !== void 0 ? _ref3 : icon,
203
295
  prefix: prefix,
204
296
  trailingInteractionElement: renderInteractionElement(),
205
- trailingIcon: trailingIcon,
297
+ trailingIcon: _trailingIcon !== null && _trailingIcon !== void 0 ? _trailingIcon : trailingIcon,
206
298
  suffix: suffix,
207
299
  validationState: validationState,
208
300
  errorText: errorText,
@@ -1 +1 @@
1
- {"version":3,"file":"TextInput.js","sources":["../../../../../../../src/components/Input/TextInput/TextInput.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport type { ReactElement, ReactNode } from 'react';\nimport type { TextInput as TextInputReactNative } from 'react-native';\nimport type { BaseInputProps } from '../BaseInput';\nimport { BaseInput } from '../BaseInput';\nimport { getKeyboardAndAutocompleteProps } from '../BaseInput/utils';\nimport type { TaggedInputProps } from '../BaseInput/useTaggedInput';\nimport { useTaggedInput } from '../BaseInput/useTaggedInput';\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 DataAnalyticsAttribute,\n} from '~utils/types';\nimport { hintMarginTop } from '~components/Form/formTokens';\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 `leadingIcon` 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} & 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 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 ...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 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,\n name,\n value,\n inputRef: textInputRef,\n });\n\n React.useEffect(() => {\n setShouldShowClearButton(Boolean(showClearButton && (defaultValue ?? value)));\n }, [showClearButton, defaultValue, value]);\n\n const renderInteractionElement = (): ReactNode => {\n if (isLoading) {\n return <Spinner accessibilityLabel=\"Loading Content\" color=\"primary\" />;\n }\n\n if (shouldShowClearButton) {\n return (\n <IconButton\n size=\"medium\"\n icon={CloseIcon}\n onClick={() => {\n if (isEmpty(value) && textInputRef.current) {\n // when the input field is uncontrolled take the ref and clear the input and then call the onClearButtonClick function\n if (isReactNative(textInputRef.current)) {\n textInputRef.current.clear();\n textInputRef.current.focus();\n } else if (textInputRef.current instanceof HTMLInputElement) {\n textInputRef.current.value = '';\n textInputRef.current.focus();\n }\n }\n 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\n return null;\n };\n\n return (\n <BaseInput\n id=\"textinput\"\n componentName={MetaConstants.TextInput}\n ref={mergedRef}\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 maxCharacters={maxCharacters}\n isDropdownTrigger={isTaggedInput}\n tags={isTaggedInput ? getTags({ size }) : undefined}\n showAllTags={isInputFocussed}\n maxTagRows=\"single\"\n activeTagIndex={activeTagIndex}\n setActiveTagIndex={setActiveTagIndex}\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 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 }}\n onSubmit={onSubmit}\n isDisabled={isDisabled}\n necessityIndicator={necessityIndicator}\n isRequired={isRequired}\n leadingIcon={leadingIcon ?? icon}\n prefix={prefix}\n trailingInteractionElement={renderInteractionElement()}\n trailingIcon={trailingIcon}\n suffix={suffix}\n validationState={validationState}\n errorText={errorText}\n helpText={helpText}\n successText={successText}\n trailingFooterSlot={(value) => {\n return maxCharacters ? (\n <BaseBox marginTop={hintMarginTop[size]} marginRight=\"spacing.1\">\n <CharacterCounter\n currentCount={value?.length ?? 0}\n maxCount={maxCharacters}\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","label","accessibilityLabel","_ref$labelPosition","labelPosition","placeholder","_ref$type","type","defaultValue","name","value","maxCharacters","onChange","onClick","onFocus","onBlur","onSubmit","isDisabled","necessityIndicator","validationState","errorText","helpText","successText","isRequired","icon","prefix","showClearButton","onClearButtonClick","isLoading","suffix","autoFocus","keyboardReturnKeyType","autoCompleteSuggestionType","autoCapitalize","testID","_ref$size","size","leadingIcon","trailingIcon","isTaggedInput","tags","onTagChange","rest","_objectWithoutProperties","_excluded","textInputRef","React","useRef","mergedRef","useMergeRefs","_useState","useState","_useState2","_slicedToArray","shouldShowClearButton","setShouldShowClearButton","_useState3","_useState4","isInputFocussed","setIsInputFocussed","_useTaggedInput","useTaggedInput","inputRef","activeTagIndex","setActiveTagIndex","getTags","handleTaggedInputKeydown","handleTaggedInputChange","handleTagsClear","useEffect","Boolean","renderInteractionElement","_jsx","Spinner","color","IconButton","CloseIcon","_textInputRef$current","isEmpty","current","clear","focus","HTMLInputElement","BaseInput","_objectSpread","id","componentName","MetaConstants","TextInput","hideLabelText","isDropdownTrigger","undefined","showAllTags","maxTagRows","_ref2","length","e","onKeyDown","trailingInteractionElement","trailingFooterSlot","_value$length","BaseBox","marginTop","hintMarginTop","marginRight","children","CharacterCounter","currentCount","maxCount","getKeyboardAndAutocompleteProps","assignWithoutSideEffects","forwardRef","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsIA;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,EA0C/EC,GAAG,EACc;AAAA,EAAA,IAzCfC,KAAK,GAAAF,IAAA,CAALE,KAAK;IACLC,kBAAkB,GAAAH,IAAA,CAAlBG,kBAAkB;IAAAC,kBAAA,GAAAJ,IAAA,CAClBK,aAAa;A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,IAAAA,SAAS,gBAAGsB,wBAAwB,eAAChE,cAAK,CAACiE,UAAU,CAACjH,UAAU,CAAC,EAAE;AACvEkH,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 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';\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} & 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 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 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,\n name,\n value,\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 ?? value)));\n }, [showClearButton, defaultValue, value]);\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 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 defaultValue={defaultValue}\n value={value}\n name={name}\n maxCharacters={maxCharacters}\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 }) => {\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 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 }}\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 maxCharacters ? (\n <BaseBox marginTop={hintMarginTop[size]} marginRight=\"spacing.1\">\n <CharacterCounter\n currentCount={value?.length ?? 0}\n maxCount={maxCharacters}\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","_ref3","label","accessibilityLabel","_ref$labelPosition","labelPosition","placeholder","_ref$type","type","defaultValue","name","value","maxCharacters","onChange","onClick","onFocus","onBlur","onSubmit","isDisabled","necessityIndicator","validationState","errorText","helpText","successText","isRequired","icon","prefix","showClearButton","onClearButtonClick","isLoading","suffix","autoFocus","keyboardReturnKeyType","autoCompleteSuggestionType","autoCapitalize","testID","_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","_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","_ref2","length","e","onKeyDown","trailingInteractionElement","trailingFooterSlot","_value$length","marginTop","hintMarginTop","marginRight","CharacterCounter","currentCount","maxCount","getKeyboardAndAutocompleteProps","assignWithoutSideEffects","forwardRef","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmJA;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,EA4C/EC,GAAG,EACc;AAAA,EAAA,IAAAC,aAAA,EAAAC,cAAA,EAAAC,KAAA,CAAA;AAAA,EAAA,IA3CfC,KAAK,GAAAL,IAAA,CAALK,KAAK;IACLC,kBAAkB,GAAAN,IAAA,CAAlBM,kBAAkB;IAAAC,kBAAA,GAAAP,IAAA,CAClBQ,aAAa;AAAbA,IAAAA,aAAa,GAAAD,kBAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,kBAAA;IACrBE,WAAW,GAAAT,IAAA,CAAXS,WAAW;IAAAC,SAAA,GAAAV,IAAA,CACXW,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAG,KAAA,CAAA,GAAA,MAAM,GAAAA,SAAA;IACbE,YAAY,GAAAZ,IAAA,CAAZY,YAAY;IACZC,IAAI,GAAAb,IAAA,CAAJa,IAAI;IACJC,KAAK,GAAAd,IAAA,CAALc,KAAK;IACLC,aAAa,GAAAf,IAAA,CAAbe,aAAa;IACbC,SAAQ,GAAAhB,IAAA,CAARgB,QAAQ;IACRC,OAAO,GAAAjB,IAAA,CAAPiB,OAAO;IACPC,QAAO,GAAAlB,IAAA,CAAPkB,OAAO;IACPC,OAAM,GAAAnB,IAAA,CAANmB,MAAM;IACNC,QAAQ,GAAApB,IAAA,CAARoB,QAAQ;IACRC,UAAU,GAAArB,IAAA,CAAVqB,UAAU;IACVC,kBAAkB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CACT,CAAC,CAAA;AAEN,CAAC,CAAA;AAEK0F,IAAAA,SAAS,gBAAGuB,wBAAwB,eAAC7G,cAAK,CAAC8G,UAAU,CAACnK,UAAU,CAAC,EAAE;AACvEoK,EAAAA,WAAW,EAAE,WAAA;AACf,CAAC;;;;"}
@@ -20,7 +20,7 @@ import { metaAttribute } from '../../utils/metaAttribute/metaAttribute.web.js';
20
20
  import { MetaConstants } from '../../utils/metaAttribute/metaConstants.js';
21
21
  import { makeAnalyticsAttribute } from '../../utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js';
22
22
 
23
- var _excluded = ["reverseOrder", "position", "toastOptions", "containerClassName"];
23
+ var _excluded = ["reverseOrder", "position", "offsetBottom", "toastOptions", "containerClassName"];
24
24
  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; }
25
25
  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; }
26
26
  var StyledToastWrapper = /*#__PURE__*/styled(BaseBox).withConfig({
@@ -80,6 +80,7 @@ var Toaster = function Toaster(_ref2) {
80
80
  var reverseOrder = _ref2.reverseOrder,
81
81
  _ref2$position = _ref2.position,
82
82
  position = _ref2$position === void 0 ? 'top-center' : _ref2$position,
83
+ offsetBottom = _ref2.offsetBottom,
83
84
  toastOptions = _ref2.toastOptions,
84
85
  containerClassName = _ref2.containerClassName,
85
86
  rest = _objectWithoutProperties(_ref2, _excluded);
@@ -98,7 +99,8 @@ var Toaster = function Toaster(_ref2) {
98
99
  setHasManuallyExpanded = _React$useState4[1];
99
100
  var isMobile = useIsMobile();
100
101
  var minToasts = isMobile ? MIN_TOAST_MOBILE : MIN_TOAST_DESKTOP;
101
- var containerGutter = isMobile ? CONTAINER_GUTTER_MOBILE : CONTAINER_GUTTER_DESKTOP;
102
+ var defaultGutter = isMobile ? CONTAINER_GUTTER_MOBILE : CONTAINER_GUTTER_DESKTOP;
103
+ var bottomGutter = offsetBottom !== null && offsetBottom !== void 0 ? offsetBottom : defaultGutter;
102
104
  var infoToasts = React__default.useMemo(function () {
103
105
  return toasts.filter(function (toast) {
104
106
  return !isPromotionalToast(toast);
@@ -219,11 +221,11 @@ var Toaster = function Toaster(_ref2) {
219
221
  return /*#__PURE__*/jsxs(BaseBox, _objectSpread(_objectSpread(_objectSpread({
220
222
  position: "fixed",
221
223
  zIndex: TOAST_Z_INDEX,
222
- top: makeSize(containerGutter),
223
- left: makeSize(containerGutter),
224
- right: makeSize(containerGutter),
225
- bottom: makeSize(containerGutter),
226
- width: "calc(100% - ".concat(containerGutter * 2, "px)"),
224
+ top: makeSize(defaultGutter),
225
+ left: makeSize(defaultGutter),
226
+ right: makeSize(defaultGutter),
227
+ bottom: makeSize(bottomGutter),
228
+ width: "calc(100% - ".concat(defaultGutter * 2, "px)"),
227
229
  maxWidth: makeSize(TOAST_MAX_WIDTH),
228
230
  pointerEvents: "none",
229
231
  className: containerClassName
@@ -304,8 +306,10 @@ var Toaster = function Toaster(_ref2) {
304
306
  })]
305
307
  }));
306
308
  };
307
- var ToastContainer = function ToastContainer() {
309
+ var ToastContainer = function ToastContainer(_ref4) {
310
+ var offsetBottom = _ref4.offsetBottom;
308
311
  return /*#__PURE__*/jsx(Toaster, {
312
+ offsetBottom: offsetBottom,
309
313
  position: "bottom-left"
310
314
  });
311
315
  };