@razorpay/blade 12.33.1 → 12.33.2

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 (170) 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/Typography/Text/Text.js +0 -1
  100. package/build/lib/web/development/components/Typography/Text/Text.js.map +1 -1
  101. package/build/lib/web/development/components/index.js +2 -0
  102. package/build/lib/web/development/components/index.js.map +1 -1
  103. package/build/lib/web/development/utils/useControlledDropdownInput/index.js +2 -0
  104. package/build/lib/web/development/utils/useControlledDropdownInput/index.js.map +1 -0
  105. package/build/lib/web/development/utils/useControlledDropdownInput/useControlledDropdownInput.js +108 -0
  106. package/build/lib/web/development/utils/useControlledDropdownInput/useControlledDropdownInput.js.map +1 -0
  107. package/build/lib/web/production/components/Accordion/AccordionItemHeader.js +18 -2
  108. package/build/lib/web/production/components/Accordion/AccordionItemHeader.js.map +1 -1
  109. package/build/lib/web/production/components/Accordion/StyledAccordionButton.web.js +4 -3
  110. package/build/lib/web/production/components/Accordion/StyledAccordionButton.web.js.map +1 -1
  111. package/build/lib/web/production/components/Accordion/commonStyles.js +1 -11
  112. package/build/lib/web/production/components/Accordion/commonStyles.js.map +1 -1
  113. package/build/lib/web/production/components/ActionList/ActionListItem.js +2 -1
  114. package/build/lib/web/production/components/ActionList/ActionListItem.js.map +1 -1
  115. package/build/lib/web/production/components/BaseHeaderFooter/BaseHeader.js +6 -3
  116. package/build/lib/web/production/components/BaseHeaderFooter/BaseHeader.js.map +1 -1
  117. package/build/lib/web/production/components/Button/BaseButton/BaseButton.js +24 -3
  118. package/build/lib/web/production/components/Button/BaseButton/BaseButton.js.map +1 -1
  119. package/build/lib/web/production/components/Button/BaseButton/StyledBaseButton.web.js +14 -2
  120. package/build/lib/web/production/components/Button/BaseButton/StyledBaseButton.web.js.map +1 -1
  121. package/build/lib/web/production/components/Button/BaseButton/buttonTokens.js +19 -0
  122. package/build/lib/web/production/components/Button/BaseButton/buttonTokens.js.map +1 -1
  123. package/build/lib/web/production/components/Dropdown/Dropdown.js +4 -1
  124. package/build/lib/web/production/components/Dropdown/Dropdown.js.map +1 -1
  125. package/build/lib/web/production/components/Dropdown/DropdownButton.js +4 -1
  126. package/build/lib/web/production/components/Dropdown/DropdownButton.js.map +1 -1
  127. package/build/lib/web/production/components/Dropdown/DropdownOverlay.web.js +4 -2
  128. package/build/lib/web/production/components/Dropdown/DropdownOverlay.web.js.map +1 -1
  129. package/build/lib/web/production/components/Dropdown/InputDropdownButton.web.js +180 -0
  130. package/build/lib/web/production/components/Dropdown/InputDropdownButton.web.js.map +1 -0
  131. package/build/lib/web/production/components/Dropdown/dropdownComponentIds.js +2 -1
  132. package/build/lib/web/production/components/Dropdown/dropdownComponentIds.js.map +1 -1
  133. package/build/lib/web/production/components/Dropdown/index.js +1 -0
  134. package/build/lib/web/production/components/Dropdown/index.js.map +1 -1
  135. package/build/lib/web/production/components/Dropdown/useDropdown.js.map +1 -1
  136. package/build/lib/web/production/components/Icons/ChevronUpDownIcon/ChevronUpDownIcon.js +40 -0
  137. package/build/lib/web/production/components/Icons/ChevronUpDownIcon/ChevronUpDownIcon.js.map +1 -0
  138. package/build/lib/web/production/components/Icons/ChevronUpDownIcon/index.js +2 -0
  139. package/build/lib/web/production/components/Icons/ChevronUpDownIcon/index.js.map +1 -0
  140. package/build/lib/web/production/components/Icons/index.js +1 -0
  141. package/build/lib/web/production/components/Icons/index.js.map +1 -1
  142. package/build/lib/web/production/components/Input/BaseInput/BaseInput.js +10 -4
  143. package/build/lib/web/production/components/Input/BaseInput/BaseInput.js.map +1 -1
  144. package/build/lib/web/production/components/Input/BaseInput/BaseInputVisuals.js +32 -8
  145. package/build/lib/web/production/components/Input/BaseInput/BaseInputVisuals.js.map +1 -1
  146. package/build/lib/web/production/components/Input/BaseInput/StyledBaseInput.web.js +2 -1
  147. package/build/lib/web/production/components/Input/BaseInput/StyledBaseInput.web.js.map +1 -1
  148. package/build/lib/web/production/components/Input/BaseInput/baseInputStyles.js +8 -4
  149. package/build/lib/web/production/components/Input/BaseInput/baseInputStyles.js.map +1 -1
  150. package/build/lib/web/production/components/Input/BaseInput/baseInputTokens.js +1 -1
  151. package/build/lib/web/production/components/Input/BaseInput/baseInputTokens.js.map +1 -1
  152. package/build/lib/web/production/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js +25 -124
  153. package/build/lib/web/production/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js.map +1 -1
  154. package/build/lib/web/production/components/Input/PhoneNumberInput/CountrySelector.web.js +6 -4
  155. package/build/lib/web/production/components/Input/PhoneNumberInput/CountrySelector.web.js.map +1 -1
  156. package/build/lib/web/production/components/Input/SearchInput/SearchInput.js +97 -30
  157. package/build/lib/web/production/components/Input/SearchInput/SearchInput.js.map +1 -1
  158. package/build/lib/web/production/components/Input/TextInput/TextInput.js +123 -31
  159. package/build/lib/web/production/components/Input/TextInput/TextInput.js.map +1 -1
  160. package/build/lib/web/production/components/Typography/Text/Text.js +0 -1
  161. package/build/lib/web/production/components/Typography/Text/Text.js.map +1 -1
  162. package/build/lib/web/production/components/index.js +2 -0
  163. package/build/lib/web/production/components/index.js.map +1 -1
  164. package/build/lib/web/production/utils/useControlledDropdownInput/index.js +2 -0
  165. package/build/lib/web/production/utils/useControlledDropdownInput/index.js.map +1 -0
  166. package/build/lib/web/production/utils/useControlledDropdownInput/useControlledDropdownInput.js +108 -0
  167. package/build/lib/web/production/utils/useControlledDropdownInput/useControlledDropdownInput.js.map +1 -0
  168. package/build/types/components/index.d.ts +3098 -3001
  169. package/build/types/components/index.native.d.ts +2719 -2686
  170. package/package.json +1 -1
@@ -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;AAAbA,IAAAA,aAAa,GAAAD,kBAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,kBAAA;IACrBE,WAAW,GAAAN,IAAA,CAAXM,WAAW;IAAAC,SAAA,GAAAP,IAAA,CACXQ,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAG,KAAA,CAAA,GAAA,MAAM,GAAAA,SAAA;IACbE,YAAY,GAAAT,IAAA,CAAZS,YAAY;IACZC,IAAI,GAAAV,IAAA,CAAJU,IAAI;IACJC,KAAK,GAAAX,IAAA,CAALW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AClB6D,GAAA,CAAC6B,OAAO,EAAA;AAACC,QAAAA,SAAS,EAAEC,aAAa,CAACnE,IAAI,CAAE;AAACoE,QAAAA,WAAW,EAAC,WAAW;QAAAC,QAAA,eAC9DjC,GAAA,CAACkC,gBAAgB,EAAA;AACfC,UAAAA,YAAY,EAAAP,CAAAA,aAAA,GAAE1F,KAAK,aAALA,KAAK,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAALA,KAAK,CAAEqF,MAAM,MAAAK,IAAAA,IAAAA,aAAA,KAAAA,KAAAA,CAAAA,GAAAA,aAAA,GAAI,CAAE;AACjCQ,UAAAA,QAAQ,EAAEjG,aAAc;AACxByB,UAAAA,IAAI,EAAEA,IAAAA;SACP,CAAA;OACM,CAAC,GACR,IAAI,CAAA;AACV,KAAA;AACA;AAAA;AACAN,IAAAA,SAAS,EAAEA,SAAU;AACrBI,IAAAA,MAAM,EAAEA,MAAAA;AAAO,GAAA,EACX2E,+BAA+B,CAAC;AAClCtG,IAAAA,IAAI,EAAJA,IAAI;AACJwB,IAAAA,qBAAqB,EAArBA,qBAAqB;AACrBC,IAAAA,0BAA0B,EAA1BA,0BAA0B;AAC1BC,IAAAA,cAAc,EAAdA,cAAAA;AACF,GAAC,CAAC,CAAA,EAAA,EAAA,EAAA;AACFG,IAAAA,IAAI,EAAEA,IAAAA;GACFM,EAAAA,IAAI,CACT,CAAC,CAAA;AAEN,CAAC,CAAA;AAEK8C,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,SA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A,CAAA;AAC7B,MAAA,OAAO1I,aAAa,gBAClBmG,GAAA,CAACc,OAAO,EAAA;AAAC0B,QAAAA,SAAS,EAAEC,aAAa,CAACnH,IAAI,CAAE;AAACoH,QAAAA,WAAW,EAAC,WAAW;QAAAtD,QAAA,eAC9DY,GAAA,CAAC2C,gBAAgB,EAAA;AACfC,UAAAA,YAAY,EAAAL,CAAAA,aAAA,GAAE3I,KAAK,aAALA,KAAK,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAALA,KAAK,CAAEsI,MAAM,MAAAK,IAAAA,IAAAA,aAAA,KAAAA,KAAAA,CAAAA,GAAAA,aAAA,GAAI,CAAE;AACjCM,UAAAA,QAAQ,EAAEhJ,aAAc;AACxByB,UAAAA,IAAI,EAAEA,IAAAA;SACP,CAAA;OACM,CAAC,GACR,IAAI,CAAA;AACV,KAAA;AACA;AAAA;AACAN,IAAAA,SAAS,EAAEA,SAAU;AACrBI,IAAAA,MAAM,EAAEA,MAAAA;AAAO,GAAA,EACX0H,+BAA+B,CAAC;AAClCrJ,IAAAA,IAAI,EAAJA,IAAI;AACJwB,IAAAA,qBAAqB,EAArBA,qBAAqB;AACrBC,IAAAA,0BAA0B,EAA1BA,0BAA0B;AAC1BC,IAAAA,cAAc,EAAdA,cAAAA;AACF,GAAC,CAAC,CAAA,EAAA,EAAA,EAAA;AACFG,IAAAA,IAAI,EAAEA,IAAAA;GACFQ,EAAAA,IAAI,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;;;;"}
@@ -81,7 +81,6 @@ var getTextProps = function getTextProps(_ref) {
81
81
  props.lineHeight = 50;
82
82
  props.fontWeight = 'regular';
83
83
  }
84
- props.fontStyle = 'italic';
85
84
  }
86
85
  return props;
87
86
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Text.js","sources":["../../../../../../../src/components/Typography/Text/Text.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */\nimport type { ReactElement } from 'react';\nimport React from 'react';\nimport { BaseText } from '../BaseText';\nimport type { BaseTextProps, BaseTextSizes } from '../BaseText/types';\nimport { useValidateAsProp } from '../utils';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport type { BladeElementRef, TestID } from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { throwBladeError } from '~utils/logger';\n\nconst validAsValues = ['p', 'span', 'div', 'abbr', 'figcaption', 'cite', 'q', 'label'] as const;\ntype TextCommonProps = {\n as?: typeof validAsValues[number];\n truncateAfterLines?: number;\n children: React.ReactNode;\n weight?: Extract<BaseTextProps['fontWeight'], 'regular' | 'medium' | 'semibold'>;\n /**\n * Overrides the color of the Text component.\n *\n * **Note** This takes priority over `type` and `contrast` prop to decide color of text\n */\n color?: BaseTextProps['color'];\n textAlign?: BaseTextProps['textAlign'];\n textDecorationLine?: BaseTextProps['textDecorationLine'];\n wordBreak?: BaseTextProps['wordBreak'];\n} & TestID &\n StyledPropsBlade;\n\nexport type TextVariant = 'body' | 'caption';\n\ntype TextBodyVariant = TextCommonProps & {\n variant?: Extract<TextVariant, 'body'>;\n size?: Extract<BaseTextSizes, 'xsmall' | 'small' | 'medium' | 'large'>;\n};\n\ntype TextCaptionVariant = TextCommonProps & {\n variant?: Extract<TextVariant, 'caption'>;\n size?: Extract<BaseTextSizes, 'small' | 'medium'>;\n};\n\nexport type TextProps<T> = T extends { variant: infer Variant }\n ? Variant extends 'caption'\n ? TextCaptionVariant\n : Variant extends 'body'\n ? TextBodyVariant\n : T\n : T;\n\ntype GetTextPropsReturn = Omit<BaseTextProps, 'children'>;\ntype GetTextProps<T extends { variant: TextVariant }> = Pick<\n TextProps<T>,\n 'variant' | 'weight' | 'size' | 'color' | 'testID' | 'textAlign' | 'textDecorationLine'\n>;\n\nconst getTextProps = <T extends { variant: TextVariant }>({\n variant,\n weight,\n size,\n color = 'surface.text.gray.normal',\n testID,\n textAlign,\n textDecorationLine,\n}: GetTextProps<T>): GetTextPropsReturn => {\n const props: GetTextPropsReturn = {\n color,\n fontSize: 100,\n fontWeight: weight ?? 'regular',\n fontStyle: 'normal',\n lineHeight: 100,\n fontFamily: 'text',\n componentName: 'text',\n testID,\n textAlign,\n textDecorationLine,\n };\n\n if (variant === 'caption') {\n // variant of caption can only have size of small\n if (size && size !== 'small' && size !== 'medium') {\n if (__DEV__) {\n throwBladeError({\n moduleName: 'Text',\n message: `size cannot be '${size}' when variant is 'caption'`,\n });\n }\n // Set size as small in case of invalid size\n size = 'small';\n }\n } else if (variant !== 'caption' && !size) {\n size = 'medium';\n }\n\n if (variant === 'body') {\n if (size === 'xsmall') {\n props.fontSize = 25;\n props.lineHeight = 25;\n }\n if (size === 'small') {\n props.fontSize = 75;\n props.lineHeight = 75;\n }\n if (size === 'medium') {\n props.fontSize = 100;\n props.lineHeight = 100;\n }\n if (size === 'large') {\n props.fontSize = 200;\n props.lineHeight = 200;\n }\n }\n if (variant === 'caption') {\n if (size === 'small') {\n props.fontSize = 50;\n props.lineHeight = 50;\n props.fontWeight = 'regular';\n }\n if (size === 'medium') {\n props.fontSize = 100;\n props.lineHeight = 50;\n props.fontWeight = 'regular';\n }\n props.fontStyle = 'italic';\n }\n\n return props;\n};\n\nconst _Text = <T extends { variant: TextVariant }>(\n {\n as = 'p',\n variant = 'body',\n weight = 'regular',\n size,\n truncateAfterLines,\n children,\n color,\n testID,\n textAlign,\n textDecorationLine,\n wordBreak,\n ...styledProps\n }: TextProps<T>,\n ref: React.Ref<BladeElementRef>,\n): ReactElement => {\n const props: Omit<BaseTextProps, 'children'> = {\n as,\n truncateAfterLines,\n wordBreak,\n ...getTextProps({\n variant,\n weight,\n color,\n size,\n testID,\n textAlign,\n textDecorationLine,\n }),\n };\n\n useValidateAsProp({ componentName: 'Text', as, validAsValues });\n\n return (\n <BaseText ref={ref} {...props} {...getStyledProps(styledProps)}>\n {children}\n </BaseText>\n );\n};\n\nconst Text = assignWithoutSideEffects(React.forwardRef(_Text), {\n displayName: 'Text',\n componentId: 'Text',\n});\n\nexport { Text, getTextProps };\n"],"names":["validAsValues","getTextProps","_ref","variant","weight","size","_ref$color","color","testID","textAlign","textDecorationLine","props","fontSize","fontWeight","fontStyle","lineHeight","fontFamily","componentName","throwBladeError","moduleName","message","concat","_Text","_ref2","ref","_ref2$as","as","_ref2$variant","_ref2$weight","truncateAfterLines","children","wordBreak","styledProps","_objectWithoutProperties","_excluded","_objectSpread","useValidateAsProp","_jsx","BaseText","getStyledProps","Text","assignWithoutSideEffects","React","forwardRef","displayName","componentId"],"mappings":";;;;;;;;;;;;;;;;;AAYA,IAAMA,aAAa,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,CAAU,CAAA;AA4C/F,IAAMC,YAAY,GAAG,SAAfA,YAAYA,CAAAC,IAAA,EAQyB;AAAA,EAAA,IAPzCC,OAAO,GAAAD,IAAA,CAAPC,OAAO;IACPC,MAAM,GAAAF,IAAA,CAANE,MAAM;IACNC,IAAI,GAAAH,IAAA,CAAJG,IAAI;IAAAC,UAAA,GAAAJ,IAAA,CACJK,KAAK;AAALA,IAAAA,KAAK,GAAAD,UAAA,KAAG,KAAA,CAAA,GAAA,0BAA0B,GAAAA,UAAA;IAClCE,MAAM,GAAAN,IAAA,CAANM,MAAM;IACNC,SAAS,GAAAP,IAAA,CAATO,SAAS;IACTC,kBAAkB,GAAAR,IAAA,CAAlBQ,kBAAkB,CAAA;AAElB,EAAA,IAAMC,KAAyB,GAAG;AAChCJ,IAAAA,KAAK,EAALA,KAAK;AACLK,IAAAA,QAAQ,EAAE,GAAG;AACbC,IAAAA,UAAU,EAAET,MAAM,KAAA,IAAA,IAANA,M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AAW,EAAE,MAAM;AACnBC,EAAAA,WAAW,EAAE,MAAA;AACf,CAAC;;;;"}
1
+ {"version":3,"file":"Text.js","sources":["../../../../../../../src/components/Typography/Text/Text.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */\nimport type { ReactElement } from 'react';\nimport React from 'react';\nimport { BaseText } from '../BaseText';\nimport type { BaseTextProps, BaseTextSizes } from '../BaseText/types';\nimport { useValidateAsProp } from '../utils';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport type { BladeElementRef, TestID } from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { throwBladeError } from '~utils/logger';\n\nconst validAsValues = ['p', 'span', 'div', 'abbr', 'figcaption', 'cite', 'q', 'label'] as const;\ntype TextCommonProps = {\n as?: typeof validAsValues[number];\n truncateAfterLines?: number;\n children: React.ReactNode;\n weight?: Extract<BaseTextProps['fontWeight'], 'regular' | 'medium' | 'semibold'>;\n /**\n * Overrides the color of the Text component.\n *\n * **Note** This takes priority over `type` and `contrast` prop to decide color of text\n */\n color?: BaseTextProps['color'];\n textAlign?: BaseTextProps['textAlign'];\n textDecorationLine?: BaseTextProps['textDecorationLine'];\n wordBreak?: BaseTextProps['wordBreak'];\n} & TestID &\n StyledPropsBlade;\n\nexport type TextVariant = 'body' | 'caption';\n\ntype TextBodyVariant = TextCommonProps & {\n variant?: Extract<TextVariant, 'body'>;\n size?: Extract<BaseTextSizes, 'xsmall' | 'small' | 'medium' | 'large'>;\n};\n\ntype TextCaptionVariant = TextCommonProps & {\n variant?: Extract<TextVariant, 'caption'>;\n size?: Extract<BaseTextSizes, 'small' | 'medium'>;\n};\n\nexport type TextProps<T> = T extends { variant: infer Variant }\n ? Variant extends 'caption'\n ? TextCaptionVariant\n : Variant extends 'body'\n ? TextBodyVariant\n : T\n : T;\n\ntype GetTextPropsReturn = Omit<BaseTextProps, 'children'>;\ntype GetTextProps<T extends { variant: TextVariant }> = Pick<\n TextProps<T>,\n 'variant' | 'weight' | 'size' | 'color' | 'testID' | 'textAlign' | 'textDecorationLine'\n>;\n\nconst getTextProps = <T extends { variant: TextVariant }>({\n variant,\n weight,\n size,\n color = 'surface.text.gray.normal',\n testID,\n textAlign,\n textDecorationLine,\n}: GetTextProps<T>): GetTextPropsReturn => {\n const props: GetTextPropsReturn = {\n color,\n fontSize: 100,\n fontWeight: weight ?? 'regular',\n fontStyle: 'normal',\n lineHeight: 100,\n fontFamily: 'text',\n componentName: 'text',\n testID,\n textAlign,\n textDecorationLine,\n };\n\n if (variant === 'caption') {\n // variant of caption can only have size of small\n if (size && size !== 'small' && size !== 'medium') {\n if (__DEV__) {\n throwBladeError({\n moduleName: 'Text',\n message: `size cannot be '${size}' when variant is 'caption'`,\n });\n }\n // Set size as small in case of invalid size\n size = 'small';\n }\n } else if (variant !== 'caption' && !size) {\n size = 'medium';\n }\n\n if (variant === 'body') {\n if (size === 'xsmall') {\n props.fontSize = 25;\n props.lineHeight = 25;\n }\n if (size === 'small') {\n props.fontSize = 75;\n props.lineHeight = 75;\n }\n if (size === 'medium') {\n props.fontSize = 100;\n props.lineHeight = 100;\n }\n if (size === 'large') {\n props.fontSize = 200;\n props.lineHeight = 200;\n }\n }\n if (variant === 'caption') {\n if (size === 'small') {\n props.fontSize = 50;\n props.lineHeight = 50;\n props.fontWeight = 'regular';\n }\n if (size === 'medium') {\n props.fontSize = 100;\n props.lineHeight = 50;\n props.fontWeight = 'regular';\n }\n }\n\n return props;\n};\n\nconst _Text = <T extends { variant: TextVariant }>(\n {\n as = 'p',\n variant = 'body',\n weight = 'regular',\n size,\n truncateAfterLines,\n children,\n color,\n testID,\n textAlign,\n textDecorationLine,\n wordBreak,\n ...styledProps\n }: TextProps<T>,\n ref: React.Ref<BladeElementRef>,\n): ReactElement => {\n const props: Omit<BaseTextProps, 'children'> = {\n as,\n truncateAfterLines,\n wordBreak,\n ...getTextProps({\n variant,\n weight,\n color,\n size,\n testID,\n textAlign,\n textDecorationLine,\n }),\n };\n\n useValidateAsProp({ componentName: 'Text', as, validAsValues });\n\n return (\n <BaseText ref={ref} {...props} {...getStyledProps(styledProps)}>\n {children}\n </BaseText>\n );\n};\n\nconst Text = assignWithoutSideEffects(React.forwardRef(_Text), {\n displayName: 'Text',\n componentId: 'Text',\n});\n\nexport { Text, getTextProps };\n"],"names":["validAsValues","getTextProps","_ref","variant","weight","size","_ref$color","color","testID","textAlign","textDecorationLine","props","fontSize","fontWeight","fontStyle","lineHeight","fontFamily","componentName","throwBladeError","moduleName","message","concat","_Text","_ref2","ref","_ref2$as","as","_ref2$variant","_ref2$weight","truncateAfterLines","children","wordBreak","styledProps","_objectWithoutProperties","_excluded","_objectSpread","useValidateAsProp","_jsx","BaseText","getStyledProps","Text","assignWithoutSideEffects","React","forwardRef","displayName","componentId"],"mappings":";;;;;;;;;;;;;;;;;AAYA,IAAMA,aAAa,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,CAAU,CAAA;AA4C/F,IAAMC,YAAY,GAAG,SAAfA,YAAYA,CAAAC,IAAA,EAQyB;AAAA,EAAA,IAPzCC,OAAO,GAAAD,IAAA,CAAPC,OAAO;IACPC,MAAM,GAAAF,IAAA,CAANE,MAAM;IACNC,IAAI,GAAAH,IAAA,CAAJG,IAAI;IAAAC,UAAA,GAAAJ,IAAA,CACJK,KAAK;AAALA,IAAAA,KAAK,GAAAD,UAAA,KAAG,KAAA,CAAA,GAAA,0BAA0B,GAAAA,UAAA;IAClCE,MAAM,GAAAN,IAAA,CAANM,MAAM;IACNC,SAAS,GAAAP,IAAA,CAATO,SAAS;IACTC,kBAAkB,GAAAR,IAAA,CAAlBQ,kBAAkB,CAAA;AAElB,EAAA,IAAMC,KAAyB,GAAG;AAChCJ,IAAAA,KAAK,EAALA,KAAK;AACLK,IAAAA,QAAQ,EAAE,GA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EAAAA,WAAW,EAAE,MAAM;AACnBC,EAAAA,WAAW,EAAE,MAAA;AACf,CAAC;;;;"}
@@ -125,6 +125,7 @@ export { DropdownIconButton } from './Dropdown/DropdownIconButton.js';
125
125
  export { DropdownFooter, DropdownHeader } from './Dropdown/DropdownHeaderFooter.js';
126
126
  export { FilterChipSelectInput } from './Dropdown/FilterChipSelectInput.web.js';
127
127
  export { FilterChipGroup } from './Dropdown/FilterChipGroup.web.js';
128
+ export { InputDropdownButton } from './Dropdown/InputDropdownButton.web.js';
128
129
  export { Elevate } from './Elevate/Elevate.web.js';
129
130
  export { Fade } from './Fade/Fade.web.js';
130
131
  export { FileUpload } from './FileUpload/FileUpload.web.js';
@@ -208,6 +209,7 @@ export { default as CheckSquareIcon } from './Icons/CheckSquareIcon/CheckSquareI
208
209
  export { default as ChevronDownIcon } from './Icons/ChevronDownIcon/ChevronDownIcon.js';
209
210
  export { default as ChevronLeftIcon } from './Icons/ChevronLeftIcon/ChevronLeftIcon.js';
210
211
  export { default as ChevronRightIcon } from './Icons/ChevronRightIcon/ChevronRightIcon.js';
212
+ export { default as ChevronUpDownIcon } from './Icons/ChevronUpDownIcon/ChevronUpDownIcon.js';
211
213
  export { default as ChevronUpIcon } from './Icons/ChevronUpIcon/ChevronUpIcon.js';
212
214
  export { default as ChevronsDownIcon } from './Icons/ChevronsDownIcon/ChevronsDownIcon.js';
213
215
  export { default as ChevronsLeftIcon } from './Icons/ChevronsLeftIcon/ChevronsLeftIcon.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,2 @@
1
+ export { useControlledDropdownInput } from './useControlledDropdownInput.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,108 @@
1
+ import React__default from 'react';
2
+ import isEmpty from '../lodashButBetter/isEmpty.js';
3
+ import '../index.js';
4
+ import { useFirstRender } from '../useFirstRender.js';
5
+ import '../fireNativeEvent/index.js';
6
+ import { useDropdown } from '../../components/Dropdown/useDropdown.js';
7
+ import { isBrowser } from '../platform/isBrowser.js';
8
+ import { fireNativeEvent } from '../fireNativeEvent/fireNativeEvent.web.js';
9
+
10
+ var useControlledDropdownInput = function useControlledDropdownInput(props) {
11
+ var isFirstRender = useFirstRender();
12
+ var _useDropdown = useDropdown(),
13
+ changeCallbackTriggerer = _useDropdown.changeCallbackTriggerer,
14
+ isControlled = _useDropdown.isControlled,
15
+ options = _useDropdown.options,
16
+ selectedIndices = _useDropdown.selectedIndices,
17
+ controlledValueIndices = _useDropdown.controlledValueIndices,
18
+ setSelectedIndices = _useDropdown.setSelectedIndices,
19
+ selectionType = _useDropdown.selectionType,
20
+ setIsControlled = _useDropdown.setIsControlled;
21
+ var getValuesArrayFromIndices = function getValuesArrayFromIndices() {
22
+ var indices = [];
23
+ if (isControlled) {
24
+ indices = controlledValueIndices;
25
+ } else {
26
+ indices = selectedIndices;
27
+ }
28
+ return indices.map(function (selectionIndex) {
29
+ return options[selectionIndex].value;
30
+ });
31
+ };
32
+ var selectValues = function selectValues(valuesToSelect) {
33
+ if (options.length > 0) {
34
+ // we use empty `''` for clearing the input
35
+ if (isEmpty(valuesToSelect)) {
36
+ setSelectedIndices([]);
37
+ } else if (typeof valuesToSelect === 'string') {
38
+ // single select control
39
+ var selectedItemIndex = options.findIndex(function (option) {
40
+ return option.value === valuesToSelect;
41
+ });
42
+ if (selectedItemIndex >= 0) {
43
+ setSelectedIndices([selectedItemIndex]);
44
+ }
45
+ } else {
46
+ // multiselect control
47
+
48
+ // Handles repeated values in user state
49
+ var uniqueValues = Array.from(new Set(valuesToSelect));
50
+ // Handle selectionType single with multiselect values
51
+ var userValues = selectionType === 'single' ? [valuesToSelect === null || valuesToSelect === void 0 ? void 0 : valuesToSelect[0]] : uniqueValues;
52
+ var selectedItemIndices = userValues.map(function (optionValue) {
53
+ return options.findIndex(function (option) {
54
+ return option.value === optionValue;
55
+ });
56
+ }).filter(function (value) {
57
+ return value >= 0;
58
+ });
59
+ setSelectedIndices(selectedItemIndices);
60
+ }
61
+ }
62
+ };
63
+
64
+ // Handles `defaultValue` prop
65
+ React__default.useEffect(function () {
66
+ if (options.length > 0 && props.defaultValue) {
67
+ selectValues(props.defaultValue);
68
+ }
69
+ // eslint-disable-next-line react-hooks/exhaustive-deps
70
+ }, [options.length]);
71
+
72
+ // Handles `value` prop
73
+ React__default.useEffect(function () {
74
+ if (options.length > 0 && props.value !== undefined) {
75
+ if (!isControlled) {
76
+ setIsControlled(true);
77
+ }
78
+ selectValues(props.value);
79
+
80
+ // in single select AutoComplete, we have to set inputValue of autocomplete according to the new selection.
81
+ if (selectionType === 'single' && !Array.isArray(props.value) && !props.isSelectInput) {
82
+ var _props$syncInputValue;
83
+ (_props$syncInputValue = props.syncInputValueWithSelection) === null || _props$syncInputValue === void 0 ? void 0 : _props$syncInputValue.call(props, props.value);
84
+ }
85
+ }
86
+ // eslint-disable-next-line react-hooks/exhaustive-deps
87
+ }, [props.value, options]);
88
+
89
+ // onChange behaviour
90
+ React__default.useEffect(function () {
91
+ // Ignore calling onChange on mount
92
+
93
+ if (!isFirstRender) {
94
+ var _props$onChange;
95
+ (_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, {
96
+ name: props.name,
97
+ values: getValuesArrayFromIndices()
98
+ });
99
+ if (isBrowser()) {
100
+ fireNativeEvent(props.triggererRef, ['change', 'input']);
101
+ }
102
+ }
103
+ // eslint-disable-next-line react-hooks/exhaustive-deps
104
+ }, [changeCallbackTriggerer]);
105
+ };
106
+
107
+ export { useControlledDropdownInput };
108
+ //# sourceMappingURL=useControlledDropdownInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useControlledDropdownInput.js","sources":["../../../../../../src/utils/useControlledDropdownInput/useControlledDropdownInput.tsx"],"sourcesContent":["import React from 'react';\nimport type { BaseDropdownInputTriggerProps } from '~components/Input/DropdownInputTriggers/types';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport { isBrowser } from '~utils';\nimport { useFirstRender } from '~utils/useFirstRender';\nimport { fireNativeEvent } from '~utils/fireNativeEvent';\nimport { useDropdown } from '~components/Dropdown/useDropdown';\n\nexport type useControlledDropdownInputProps = Pick<\n BaseDropdownInputTriggerProps,\n | 'onChange'\n | 'name'\n | 'value'\n | 'defaultValue'\n | 'onInputValueChange'\n | 'syncInputValueWithSelection'\n | 'isSelectInput'\n> & {\n triggererRef: React.RefObject<HTMLElement>;\n};\n\nconst useControlledDropdownInput = (props: useControlledDropdownInputProps): void => {\n const isFirstRender = useFirstRender();\n const {\n changeCallbackTriggerer,\n isControlled,\n options,\n selectedIndices,\n controlledValueIndices,\n setSelectedIndices,\n selectionType,\n setIsControlled,\n } = useDropdown();\n\n const getValuesArrayFromIndices = (): string[] => {\n let indices: number[] = [];\n if (isControlled) {\n indices = controlledValueIndices;\n } else {\n indices = selectedIndices;\n }\n\n return indices.map((selectionIndex) => options[selectionIndex].value);\n };\n\n const selectValues = (valuesToSelect: string | string[]): void => {\n if (options.length > 0) {\n // we use empty `''` for clearing the input\n if (isEmpty(valuesToSelect)) {\n setSelectedIndices([]);\n } else if (typeof valuesToSelect === 'string') {\n // single select control\n const selectedItemIndex = options.findIndex((option) => option.value === valuesToSelect);\n if (selectedItemIndex >= 0) {\n setSelectedIndices([selectedItemIndex]);\n }\n } else {\n // multiselect control\n\n // Handles repeated values in user state\n const uniqueValues = Array.from(new Set(valuesToSelect));\n // Handle selectionType single with multiselect values\n const userValues = selectionType === 'single' ? [valuesToSelect?.[0]] : uniqueValues;\n\n const selectedItemIndices = userValues\n .map((optionValue) => options.findIndex((option) => option.value === optionValue))\n .filter((value) => value >= 0);\n\n setSelectedIndices(selectedItemIndices);\n }\n }\n };\n\n // Handles `defaultValue` prop\n React.useEffect(() => {\n if (options.length > 0 && props.defaultValue) {\n selectValues(props.defaultValue);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [options.length]);\n\n // Handles `value` prop\n React.useEffect(() => {\n if (options.length > 0 && props.value !== undefined) {\n if (!isControlled) {\n setIsControlled(true);\n }\n\n selectValues(props.value);\n\n // in single select AutoComplete, we have to set inputValue of autocomplete according to the new selection.\n if (selectionType === 'single' && !Array.isArray(props.value) && !props.isSelectInput) {\n props.syncInputValueWithSelection?.(props.value);\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [props.value, options]);\n\n // onChange behaviour\n React.useEffect(() => {\n // Ignore calling onChange on mount\n\n if (!isFirstRender) {\n props.onChange?.({\n name: props.name,\n values: getValuesArrayFromIndices(),\n });\n if (isBrowser()) {\n fireNativeEvent(props.triggererRef, ['change', 'input']);\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [changeCallbackTriggerer]);\n};\n\nexport { useControlledDropdownInput };\n"],"names":["useControlledDropdownInput","props","isFirstRender","useFirstRender","_useDropdown","useDropdown","changeCallbackTriggerer","isControlled","options","selectedIndices","controlledValueIndices","setSelectedIndices","selectionType","setIsControlled","getValuesArrayFromIndices","indices","map","selectionIndex","value","selectValues","valuesToSelect","length","isEmpty","selectedItemIndex","findIndex","option","uniqueValues","Array","from","Set","userValues","selectedItemIndices","optionValue","filter","React","useEffect","defaultValue","undefined","isArray","isSelectInput","_props$syncInputValue","syncInputValueWithSelection","call","_props$onChange","onChange","name","values","isBrowser","fireNativeEvent","triggererRef"],"mappings":";;;;;;;;;AAqBA,IAAMA,0BAA0B,GAAG,SAA7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