@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","Object","assign","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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,SAAA,CAAA,CAAA,OAAA,CAAA,oBAAA,CAAA,eAAA,CAAA,aAAA,CAAA,MAAA,CAAA,cAAA,CAAA,MAAA,CAAA,OAAA,CAAA,eAAA,CAAA,UAAA,CAAA,SAAA,CAAA,SAAA,CAAA,QAAA,CAAA,UAAA,CAAA,YAAA,CAAA,oBAAA,CAAA,iBAAA,CAAA,WAAA,CAAA,UAAA,CAAA,aAAA,CAAA,YAAA,CAAA,MAAA,CAAA,QAAA,CAAA,iBAAA,CAAA,oBAAA,CAAA,WAAA,CAAA,QAAA,CAAA,WAAA,CAAA,uBAAA,CAAA,4BAAA,CAAA,gBAAA,CAAA,QAAA,CAAA,MAAA,CAAA,aAAA,CAAA,cAAA,CAAA,eAAA,CAAA,MAAA,CAAA,aAAA,CAAA,CAwIA,IAAMA,aAAa,CAAG,SAAhBA,aAAaA,CAAIC,aAAkB,CAA4C,CACnF,OAAOC,eAAe,EAAE,GAAK,cAAc,CAC7C,CAAC,CAED,IAAMC,UAA2E,CAAG,SAA9EA,UAA2EA,CAAAC,IAAA,CA0C/EC,GAAG,CACc,CAzCf,IAAAC,KA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;;"}
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","Object","assign","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":";;;;;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A0B,CAC1BC,cAAc,CAAdA,cACF,CAAC,CAAC,EACFG,IAAI,CAAEA,IAAK,CAAA,CACPQ,IAAI,CACT,CAAC,CAEN,CAAC,CAEK,IAAA2F,SAAS,CAAGuB,wBAAwB,CAAC9G,cAAK,CAAC+G,UAAU,CAACpK,UAAU,CAAC,CAAE,CACvEqK,WAAW,CAAE,WACf,CAAC;;;;"}
@@ -12,7 +12,7 @@ import '../../BladeProvider/useTheme.js';
12
12
  import { assignWithoutSideEffects } from '../../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
13
13
  import { jsx } from 'react/jsx-runtime';
14
14
 
15
- var _excluded=["as","variant","weight","size","truncateAfterLines","children","color","testID","textAlign","textDecorationLine","wordBreak"];var validAsValues=['p','span','div','abbr','figcaption','cite','q','label'];var getTextProps=function getTextProps(_ref){var variant=_ref.variant,weight=_ref.weight,size=_ref.size,_ref$color=_ref.color,color=_ref$color===void 0?'surface.text.gray.normal':_ref$color,testID=_ref.testID,textAlign=_ref.textAlign,textDecorationLine=_ref.textDecorationLine;var props={color:color,fontSize:100,fontWeight:weight!=null?weight:'regular',fontStyle:'normal',lineHeight:100,fontFamily:'text',componentName:'text',testID:testID,textAlign:textAlign,textDecorationLine:textDecorationLine};if(variant==='caption'){if(size&&size!=='small'&&size!=='medium'){if(__DEV__){throwBladeError({moduleName:'Text',message:`size cannot be '${size}' when variant is 'caption'`});}size='small';}}else if(variant!=='caption'&&!size){size='medium';}if(variant==='body'){if(size==='xsmall'){props.fontSize=25;props.lineHeight=25;}if(size==='small'){props.fontSize=75;props.lineHeight=75;}if(size==='medium'){props.fontSize=100;props.lineHeight=100;}if(size==='large'){props.fontSize=200;props.lineHeight=200;}}if(variant==='caption'){if(size==='small'){props.fontSize=50;props.lineHeight=50;props.fontWeight='regular';}if(size==='medium'){props.fontSize=100;props.lineHeight=50;props.fontWeight='regular';}props.fontStyle='italic';}return props;};var _Text=function _Text(_ref2,ref){var _ref2$as=_ref2.as,as=_ref2$as===void 0?'p':_ref2$as,_ref2$variant=_ref2.variant,variant=_ref2$variant===void 0?'body':_ref2$variant,_ref2$weight=_ref2.weight,weight=_ref2$weight===void 0?'regular':_ref2$weight,size=_ref2.size,truncateAfterLines=_ref2.truncateAfterLines,children=_ref2.children,color=_ref2.color,testID=_ref2.testID,textAlign=_ref2.textAlign,textDecorationLine=_ref2.textDecorationLine,wordBreak=_ref2.wordBreak,styledProps=_objectWithoutProperties(_ref2,_excluded);var props=Object.assign({as:as,truncateAfterLines:truncateAfterLines,wordBreak:wordBreak},getTextProps({variant:variant,weight:weight,color:color,size:size,testID:testID,textAlign:textAlign,textDecorationLine:textDecorationLine}));useValidateAsProp({componentName:'Text',as:as,validAsValues:validAsValues});return jsx(BaseText,Object.assign({ref:ref},props,getStyledProps(styledProps),{children:children}));};var Text=assignWithoutSideEffects(React__default.forwardRef(_Text),{displayName:'Text',componentId:'Text'});
15
+ var _excluded=["as","variant","weight","size","truncateAfterLines","children","color","testID","textAlign","textDecorationLine","wordBreak"];var validAsValues=['p','span','div','abbr','figcaption','cite','q','label'];var getTextProps=function getTextProps(_ref){var variant=_ref.variant,weight=_ref.weight,size=_ref.size,_ref$color=_ref.color,color=_ref$color===void 0?'surface.text.gray.normal':_ref$color,testID=_ref.testID,textAlign=_ref.textAlign,textDecorationLine=_ref.textDecorationLine;var props={color:color,fontSize:100,fontWeight:weight!=null?weight:'regular',fontStyle:'normal',lineHeight:100,fontFamily:'text',componentName:'text',testID:testID,textAlign:textAlign,textDecorationLine:textDecorationLine};if(variant==='caption'){if(size&&size!=='small'&&size!=='medium'){if(__DEV__){throwBladeError({moduleName:'Text',message:`size cannot be '${size}' when variant is 'caption'`});}size='small';}}else if(variant!=='caption'&&!size){size='medium';}if(variant==='body'){if(size==='xsmall'){props.fontSize=25;props.lineHeight=25;}if(size==='small'){props.fontSize=75;props.lineHeight=75;}if(size==='medium'){props.fontSize=100;props.lineHeight=100;}if(size==='large'){props.fontSize=200;props.lineHeight=200;}}if(variant==='caption'){if(size==='small'){props.fontSize=50;props.lineHeight=50;props.fontWeight='regular';}if(size==='medium'){props.fontSize=100;props.lineHeight=50;props.fontWeight='regular';}}return props;};var _Text=function _Text(_ref2,ref){var _ref2$as=_ref2.as,as=_ref2$as===void 0?'p':_ref2$as,_ref2$variant=_ref2.variant,variant=_ref2$variant===void 0?'body':_ref2$variant,_ref2$weight=_ref2.weight,weight=_ref2$weight===void 0?'regular':_ref2$weight,size=_ref2.size,truncateAfterLines=_ref2.truncateAfterLines,children=_ref2.children,color=_ref2.color,testID=_ref2.testID,textAlign=_ref2.textAlign,textDecorationLine=_ref2.textDecorationLine,wordBreak=_ref2.wordBreak,styledProps=_objectWithoutProperties(_ref2,_excluded);var props=Object.assign({as:as,truncateAfterLines:truncateAfterLines,wordBreak:wordBreak},getTextProps({variant:variant,weight:weight,color:color,size:size,testID:testID,textAlign:textAlign,textDecorationLine:textDecorationLine}));useValidateAsProp({componentName:'Text',as:as,validAsValues:validAsValues});return jsx(BaseText,Object.assign({ref:ref},props,getStyledProps(styledProps),{children:children}));};var Text=assignWithoutSideEffects(React__default.forwardRef(_Text),{displayName:'Text',componentId:'Text'});
16
16
 
17
17
  export { Text, getTextProps };
18
18
  //# sourceMappingURL=Text.js.map
@@ -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","__DEV__","throwBladeError","moduleName","message","_Text","_ref2","ref","_ref2$as","as","_ref2$variant","_ref2$weight","truncateAfterLines","children","wordBreak","styledProps","_objectWithoutProperties","_excluded","Object","assign","useValidateAsProp","_jsx","BaseText","getSty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Ac,CAAC,CAAC,CAE/D,OACEsC,GAAA,CAACC,QAAQ,CAAAJ,MAAA,CAAAC,MAAA,CAACZ,CAAAA,GAAG,CAAEA,GAAI,CAAA,CAAKb,KAAK,CAAM6B,cAAc,CAACR,WAAW,CAAC,CAAA,CAAAF,QAAA,CAC3DA,QAAQ,CAAA,CACD,CAAC,CAEf,CAAC,CAEK,IAAAW,IAAI,CAAGC,wBAAwB,CAACC,cAAK,CAACC,UAAU,CAACtB,KAAK,CAAC,CAAE,CAC7DuB,WAAW,CAAE,MAAM,CACnBC,WAAW,CAAE,MACf,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","__DEV__","throwBladeError","moduleName","message","_Text","_ref2","ref","_ref2$as","as","_ref2$variant","_ref2$weight","truncateAfterLines","children","wordBreak","styledProps","_objectWithoutProperties","_excluded","Object","assign","useValidateAsProp","_jsx","BaseText","getStyledProps","Text","assignWithoutSideEffects","React","forwardRef","displayName","componentId"],"mappings":";;;;;;;;;;;;;;AAEA,IAAA,SAAA,CAAA,CAAA,IAAA,CAAA,SAAA,CAAA,QAAA,CAAA,MAAA,CAAA,oBAAA,CAAA,UAAA,CAAA,OAAA,CAAA,QAAA,CAAA,WAAA,CAAA,oBAAA,CAAA,WAAA,CAAA,CAUA,IAAMA,aAAa,CAAG,CAAC,GAAG,CAAE,MAAM,CAAE,KAAK,CAAE,MAAM,CAAE,YAAY,CAAE,MAAM,CAAE,GAAG,CAAE,OAAO,CAAU,CA4CzF,IAAAC,YAAY,CAAG,SAAfA,YAAYA,CAAAC,IAAA,CAQyB,CAAA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BM,kBAAkB,CAClBC,QAAQ,CAAAP,KAAA,CAARO,QAAQ,CACRvB,KAAK,CAAAgB,KAAA,CAALhB,KAAK,CACLC,MAAM,CAAAe,KAAA,CAANf,MAAM,CACNC,SAAS,CAAAc,KAAA,CAATd,SAAS,CACTC,kBAAkB,CAAAa,KAAA,CAAlBb,kBAAkB,CAClBqB,SAAS,CAAAR,KAAA,CAATQ,SAAS,CACNC,WAAW,CAAAC,wBAAA,CAAAV,KAAA,CAAAW,SAAA,CAAA,CAIhB,IAAMvB,KAAsC,CAAAwB,MAAA,CAAAC,MAAA,EAC1CV,EAAE,CAAFA,EAAE,CACFG,kBAAkB,CAAlBA,kBAAkB,CAClBE,SAAS,CAATA,SAAS,CACN9B,CAAAA,YAAY,CAAC,CACdE,OAAO,CAAPA,OAAO,CACPC,MAAM,CAANA,MAAM,CACNG,KAAK,CAALA,KAAK,CACLF,IAAI,CAAJA,IAAI,CACJG,MAAM,CAANA,MAAM,CACNC,SAAS,CAATA,SAAS,CACTC,kBAAkB,CAAlBA,kBACF,CAAC,CAAC,CACH,CAED2B,iBAAiB,CAAC,CAAEpB,aAAa,CAAE,MAAM,CAAES,EAAE,CAAFA,EAAE,CAAE1B,aAAa,CAAbA,aAAc,CAAC,CAAC,CAE/D,OACEsC,GAAA,CAACC,QAAQ,CAAAJ,MAAA,CAAAC,MAAA,CAAA,CAACZ,GAAG,CAAEA,GAAI,CAAKb,CAAAA,KAAK,CAAM6B,cAAc,CAACR,WAAW,CAAC,CAAAF,CAAAA,QAAA,CAC3DA,QAAQ,CACD,CAAA,CAAC,CAEf,CAAC,CAEK,IAAAW,IAAI,CAAGC,wBAAwB,CAACC,cAAK,CAACC,UAAU,CAACtB,KAAK,CAAC,CAAE,CAC7DuB,WAAW,CAAE,MAAM,CACnBC,WAAW,CAAE,MACf,CAAC;;;;"}
@@ -50,6 +50,7 @@ export { DropdownIconButton } from './Dropdown/DropdownIconButton.js';
50
50
  export { DropdownFooter, DropdownHeader } from './Dropdown/DropdownHeaderFooter.js';
51
51
  export { BaseFilterChip } from './Dropdown/FilterChipSelectInput.native.js';
52
52
  export { FilterChipGroup } from './Dropdown/FilterChipGroup.native.js';
53
+ export { InputDropdownButton } from './Dropdown/InputDropdownButton.native.js';
53
54
  export { Elevate } from './Elevate/Elevate.native.js';
54
55
  export { Fade } from './Fade/Fade.native.js';
55
56
  export { FileUpload } from './FileUpload/FileUpload.native.js';
@@ -133,6 +134,7 @@ export { default as CheckSquareIcon } from './Icons/CheckSquareIcon/CheckSquareI
133
134
  export { default as ChevronDownIcon } from './Icons/ChevronDownIcon/ChevronDownIcon.js';
134
135
  export { default as ChevronLeftIcon } from './Icons/ChevronLeftIcon/ChevronLeftIcon.js';
135
136
  export { default as ChevronRightIcon } from './Icons/ChevronRightIcon/ChevronRightIcon.js';
137
+ export { default as ChevronUpDownIcon } from './Icons/ChevronUpDownIcon/ChevronUpDownIcon.js';
136
138
  export { default as ChevronUpIcon } from './Icons/ChevronUpIcon/ChevronUpIcon.js';
137
139
  export { default as ChevronsDownIcon } from './Icons/ChevronsDownIcon/ChevronsDownIcon.js';
138
140
  export { default as ChevronsLeftIcon } from './Icons/ChevronsLeftIcon/ChevronsLeftIcon.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,14 @@
1
+ import React__default from 'react';
2
+ import isEmpty from '../lodashButBetter/isEmpty.js';
3
+ import 'react-native';
4
+ import '@babel/runtime/helpers/slicedToArray';
5
+ import { isBrowser } from '../platform/isBrowser.js';
6
+ import '../../components/BladeProvider/useTheme.js';
7
+ import { useFirstRender } from '../useFirstRender.js';
8
+ import { fireNativeEvent } from '../fireNativeEvent/fireNativeEvent.native.js';
9
+ import { useDropdown } from '../../components/Dropdown/useDropdown.js';
10
+
11
+ var useControlledDropdownInput=function useControlledDropdownInput(props){var isFirstRender=useFirstRender();var _useDropdown=useDropdown(),changeCallbackTriggerer=_useDropdown.changeCallbackTriggerer,isControlled=_useDropdown.isControlled,options=_useDropdown.options,selectedIndices=_useDropdown.selectedIndices,controlledValueIndices=_useDropdown.controlledValueIndices,setSelectedIndices=_useDropdown.setSelectedIndices,selectionType=_useDropdown.selectionType,setIsControlled=_useDropdown.setIsControlled;var getValuesArrayFromIndices=function getValuesArrayFromIndices(){var indices=[];if(isControlled){indices=controlledValueIndices;}else {indices=selectedIndices;}return indices.map(function(selectionIndex){return options[selectionIndex].value;});};var selectValues=function selectValues(valuesToSelect){if(options.length>0){if(isEmpty(valuesToSelect)){setSelectedIndices([]);}else if(typeof valuesToSelect==='string'){var selectedItemIndex=options.findIndex(function(option){return option.value===valuesToSelect;});if(selectedItemIndex>=0){setSelectedIndices([selectedItemIndex]);}}else {var uniqueValues=Array.from(new Set(valuesToSelect));var userValues=selectionType==='single'?[valuesToSelect==null?void 0:valuesToSelect[0]]:uniqueValues;var selectedItemIndices=userValues.map(function(optionValue){return options.findIndex(function(option){return option.value===optionValue;});}).filter(function(value){return value>=0;});setSelectedIndices(selectedItemIndices);}}};React__default.useEffect(function(){if(options.length>0&&props.defaultValue){selectValues(props.defaultValue);}},[options.length]);React__default.useEffect(function(){if(options.length>0&&props.value!==undefined){if(!isControlled){setIsControlled(true);}selectValues(props.value);if(selectionType==='single'&&!Array.isArray(props.value)&&!props.isSelectInput){props.syncInputValueWithSelection==null?void 0:props.syncInputValueWithSelection(props.value);}}},[props.value,options]);React__default.useEffect(function(){if(!isFirstRender){props.onChange==null?void 0:props.onChange({name:props.name,values:getValuesArrayFromIndices()});if(isBrowser()){fireNativeEvent(props.triggererRef);}}},[changeCallbackTriggerer]);};
12
+
13
+ export { useControlledDropdownInput };
14
+ //# 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","syncInputValueWithSelection","onChange","name","values","isBrowser","fireNativeEvent","triggererRef"],"mappings":";;;;;;;;;;AAqBM,IAAAA,0BAA0B,CAAG,SAA7BA,0BAA0BA,CAAIC,KAAsC,CAAW,CACnF,IAAMC,aAAa,CAAGC,cAAc,EAAE,CACtC,IAAAC,YAAA,CASIC,WAAW,EAAE,CARfC,uBAAuB,CAAAF,YAAA,CAAvBE,uBAAuB,CACvBC,YAAY,CAAAH,YAAA,CAAZG,YAAY,CACZC,OAAO,CAAAJ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AAK,CAACC,SAAS,CAAC,UAAM,CAGpB,GAAI,CAACjC,aAAa,CAAE,CAClBD,KAAK,CAACwC,QAAQ,EAAdxC,IAAAA,CAAAA,KAAAA,CAAAA,CAAAA,KAAK,CAACwC,QAAQ,CAAG,CACfC,IAAI,CAAEzC,KAAK,CAACyC,IAAI,CAChBC,MAAM,CAAE7B,yBAAyB,EACnC,CAAC,CAAC,CACF,GAAI8B,SAAS,EAAE,CAAE,CACfC,eAAe,CAAC5C,KAAK,CAAC6C,YAAiC,CAAC,CAC1D,CACF,CAEF,CAAC,CAAE,CAACxC,uBAAuB,CAAC,CAAC,CAC/B;;;;"}
@@ -1,5 +1,6 @@
1
1
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
2
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
3
+ import React__default from 'react';
3
4
  import { useAccordion, useAccordionItemIndex } from './AccordionContext.js';
4
5
  import { componentIds } from './componentIds.js';
5
6
  import { BaseHeader } from '../BaseHeaderFooter/BaseHeader.js';
@@ -30,10 +31,20 @@ var _AccordionItemHeader = function _AccordionItemHeader(_ref) {
30
31
  rest = _objectWithoutProperties(_ref, _excluded);
31
32
  var _useAccordion = useAccordion(),
32
33
  size = _useAccordion.size,
33
- showNumberPrefix = _useAccordion.showNumberPrefix;
34
+ showNumberPrefix = _useAccordion.showNumberPrefix,
35
+ expandedIndex = _useAccordion.expandedIndex;
34
36
  var _useAccordionItemInde = useAccordionItemIndex(),
35
37
  index = _useAccordionItemInde.index,
36
38
  isDisabled = _useAccordionItemInde.isDisabled;
39
+ var isLeadingNumberOrIcon = React__default.useMemo(function () {
40
+ var _leading$type$name;
41
+ // Check if leading is a number
42
+ if (showNumberPrefix && typeof index === 'number') return true;
43
+
44
+ // Check if leading is an Icon component (name ends with "Icon")
45
+ if (leading && /*#__PURE__*/React__default.isValidElement(leading) && typeof leading.type === 'function' && (_leading$type$name = leading.type.name) !== null && _leading$type$name !== void 0 && _leading$type$name.endsWith('Icon')) return true;
46
+ return false;
47
+ }, [leading, showNumberPrefix, index]);
37
48
  return /*#__PURE__*/jsx(BaseBox, _objectSpread(_objectSpread({}, metaAttribute({
38
49
  name: MetaConstants.AccordionItemHeader
39
50
  })), {}, {
@@ -56,10 +67,15 @@ var _AccordionItemHeader = function _AccordionItemHeader(_ref) {
56
67
  isDisabled: isDisabled,
57
68
  showBackButton: false,
58
69
  showCloseButton: false,
59
- showDivider: false,
70
+ showDivider: expandedIndex === index,
60
71
  paddingX: "spacing.5",
61
72
  marginY: "spacing.5",
62
73
  size: size,
74
+ alignItems: !subtitle && !isLeadingNumberOrIcon ? 'center' : 'flex-start',
75
+ dividerProps: {
76
+ thickness: 'thinner',
77
+ marginX: 'spacing.5'
78
+ },
63
79
  trailingInteractionElement: /*#__PURE__*/jsx(CollapsibleChevronIcon, {
64
80
  color: isDisabled ? 'interactive.icon.gray.disabled' : 'interactive.icon.gray.muted',
65
81
  size: "large"
@@ -1 +1 @@
1
- {"version":3,"file":"AccordionItemHeader.js","sources":["../../../../../../src/components/Accordion/AccordionItemHeader.tsx"],"sourcesContent":["import { useAccordion, useAccordionItemIndex } from './AccordionContext';\nimport { componentIds } from './componentIds';\nimport type { BaseHeaderProps } from '~components/BaseHeaderFooter/BaseHeader';\nimport { BaseHeader } from '~components/BaseHeaderFooter/BaseHeader';\nimport { Text } from '~components/Typography';\nimport BaseBox from '~components/Box/BaseBox';\nimport { CollapsibleChevronIcon } from '~components/Collapsible/CollapsibleChevronIcon';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport type { DataAnalyticsAttribute } from '~utils/types';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\nconst _AccordionItemHeader = ({\n title,\n subtitle,\n leading,\n children,\n trailing,\n titleSuffix,\n ...rest\n}: Pick<\n BaseHeaderProps,\n 'title' | 'subtitle' | 'leading' | 'children' | 'trailing' | 'titleSuffix'\n> &\n DataAnalyticsAttribute): React.ReactElement => {\n const { size, showNumberPrefix } = useAccordion();\n const { index, isDisabled } = useAccordionItemIndex();\n\n return (\n <BaseBox {...metaAttribute({ name: MetaConstants.AccordionItemHeader })} flex=\"1\">\n <BaseHeader\n leading={\n showNumberPrefix && typeof index === 'number' ? (\n // we have to add -2px margin to align the number with title of BaseHeader\n <Text size={size} weight=\"semibold\" marginTop=\"-2px\" as=\"span\">\n {index + 1}.\n </Text>\n ) : (\n leading\n )\n }\n title={title}\n subtitle={subtitle}\n trailing={trailing}\n titleSuffix={titleSuffix}\n isDisabled={isDisabled}\n showBackButton={false}\n showCloseButton={false}\n showDivider={false}\n paddingX=\"spacing.5\"\n marginY=\"spacing.5\"\n size={size}\n trailingInteractionElement={\n <CollapsibleChevronIcon\n color={isDisabled ? 'interactive.icon.gray.disabled' : 'interactive.icon.gray.muted'}\n size=\"large\"\n />\n }\n {...makeAnalyticsAttribute(rest)}\n >\n {children}\n </BaseHeader>\n </BaseBox>\n );\n};\n\nconst AccordionItemHeader = assignWithoutSideEffects(_AccordionItemHeader, {\n componentId: componentIds.AccordionItemHeader,\n});\n\nexport { AccordionItemHeader };\n"],"names":["_AccordionItemHeader","_ref","title","subtitle","leading","children","trailing","titleSuffix","rest","_objectWithoutProperties","_excluded","_useAccordion","useAccordion","size","showNumberPrefix","_useAccordionItemInde","useAccordionItemIndex","index","isDisabled","_jsx","BaseBox","_objectSpread","metaAttribute","name","MetaConstants","AccordionItemHeader","flex","BaseHeader","_jsxs","Text","weight","marginTop","as","showBackButton","showCloseButton","showDivider","paddingX","marginY","trailingInteractionElement","CollapsibleChevronIcon","color","makeAnalyticsAttribute","assignWithoutSideEffects","componentId","componentIds"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAYA,IAAMA,oBAAoB,GAAG,SAAvBA,oBAAoBA,CAAAC,IAAA,EAYuB;AAAA,EAAA,IAX/CC,KAAK,GAAAD,IAAA,CAALC,KAAK;IACLC,QAAQ,GAAAF,IA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MAAAA,QAAQ,EAAEA,QAAS;AACnBC,MAAAA,WAAW,EAAEA,WAAY;AACzBW,MAAAA,UAAU,EAAEA,UAAW;AACvBe,MAAAA,cAAc,EAAE,KAAM;AACtBC,MAAAA,eAAe,EAAE,KAAM;AACvBC,MAAAA,WAAW,EAAE,KAAM;AACnBC,MAAAA,QAAQ,EAAC,WAAW;AACpBC,MAAAA,OAAO,EAAC,WAAW;AACnBxB,MAAAA,IAAI,EAAEA,IAAK;MACXyB,0BAA0B,eACxBnB,GAAA,CAACoB,sBAAsB,EAAA;AACrBC,QAAAA,KAAK,EAAEtB,UAAU,GAAG,gCAAgC,GAAG,6BAA8B;AACrFL,QAAAA,IAAI,EAAC,OAAA;OACN,CAAA;KAEC4B,EAAAA,sBAAsB,CAACjC,IAAI,CAAC,CAAA,EAAA,EAAA,EAAA;AAAAH,MAAAA,QAAA,EAE/BA,QAAAA;KACS,CAAA,CAAA;AAAC,GAAA,CACN,CAAC,CAAA;AAEd,CAAC,CAAA;AAED,IAAMoB,mBAAmB,gBAAGiB,wBAAwB,CAAC1C,oBAAoB,EAAE;EACzE2C,WAAW,EAAEC,YAAY,CAACnB,mBAAAA;AAC5B,CAAC;;;;"}
1
+ {"version":3,"file":"AccordionItemHeader.js","sources":["../../../../../../src/components/Accordion/AccordionItemHeader.tsx"],"sourcesContent":["import React from 'react';\nimport { useAccordion, useAccordionItemIndex } from './AccordionContext';\nimport { componentIds } from './componentIds';\nimport type { BaseHeaderProps } from '~components/BaseHeaderFooter/BaseHeader';\nimport { BaseHeader } from '~components/BaseHeaderFooter/BaseHeader';\nimport { Text } from '~components/Typography';\nimport BaseBox from '~components/Box/BaseBox';\nimport { CollapsibleChevronIcon } from '~components/Collapsible/CollapsibleChevronIcon';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport type { DataAnalyticsAttribute } from '~utils/types';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\nconst _AccordionItemHeader = ({\n title,\n subtitle,\n leading,\n children,\n trailing,\n titleSuffix,\n ...rest\n}: Pick<\n BaseHeaderProps,\n 'title' | 'subtitle' | 'leading' | 'children' | 'trailing' | 'titleSuffix'\n> &\n DataAnalyticsAttribute): React.ReactElement => {\n const { size, showNumberPrefix, expandedIndex } = useAccordion();\n const { index, isDisabled } = useAccordionItemIndex();\n\n const isLeadingNumberOrIcon = React.useMemo(() => {\n // Check if leading is a number\n if (showNumberPrefix && typeof index === 'number') return true;\n\n // Check if leading is an Icon component (name ends with \"Icon\")\n if (\n leading &&\n React.isValidElement(leading) &&\n typeof leading.type === 'function' &&\n leading.type.name?.endsWith('Icon')\n )\n return true;\n\n return false;\n }, [leading, showNumberPrefix, index]);\n\n return (\n <BaseBox {...metaAttribute({ name: MetaConstants.AccordionItemHeader })} flex=\"1\">\n <BaseHeader\n leading={\n showNumberPrefix && typeof index === 'number' ? (\n // we have to add -2px margin to align the number with title of BaseHeader\n <Text size={size} weight=\"semibold\" marginTop=\"-2px\" as=\"span\">\n {index + 1}.\n </Text>\n ) : (\n leading\n )\n }\n title={title}\n subtitle={subtitle}\n trailing={trailing}\n titleSuffix={titleSuffix}\n isDisabled={isDisabled}\n showBackButton={false}\n showCloseButton={false}\n showDivider={expandedIndex === index}\n paddingX=\"spacing.5\"\n marginY=\"spacing.5\"\n size={size}\n alignItems={!subtitle && !isLeadingNumberOrIcon ? 'center' : 'flex-start'}\n dividerProps={{\n thickness: 'thinner',\n marginX: 'spacing.5',\n }}\n trailingInteractionElement={\n <CollapsibleChevronIcon\n color={isDisabled ? 'interactive.icon.gray.disabled' : 'interactive.icon.gray.muted'}\n size=\"large\"\n />\n }\n {...makeAnalyticsAttribute(rest)}\n >\n {children}\n </BaseHeader>\n </BaseBox>\n );\n};\n\nconst AccordionItemHeader = assignWithoutSideEffects(_AccordionItemHeader, {\n componentId: componentIds.AccordionItemHeader,\n});\n\nexport { AccordionItemHeader };\n"],"names":["_AccordionItemHeader","_ref","title","subtitle","leading","children","trailing","titleSuffix","rest","_objectWithoutProperties","_excluded","_useAccordion","useAccordion","size","showNumberPrefix","expandedIndex","_useAccordionItemInde","useAccordionItemIndex","index","isDisabled","isLeadingNumberOrIcon","React","useMemo","_leading$type$name","isValidElement","type","name","endsWith","_jsx","BaseBox","_objectSpread","metaAttribute","MetaConstants","AccordionItemHeader","flex","BaseHeader","_jsxs","Text","weight","marginTop","as","showBackButton","showCloseButton","showDivider","paddingX","marginY","alignItems","dividerProps","thickness","marginX","trailingInteractionElement","CollapsibleChevronIcon","color","makeAnalyticsAttribute","assignWithoutSideEffects","componentId","componentIds"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAaA,IAAMA,oBAAoB,GAAG,SAAvBA,oBAAoBA,CAAAC,IAAA,EAYuB;AAAA,EAAA,IAX/CC,KAAK,GAAAD,IAAA,CAALC,KAAK;IACLC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,OAAO,GAAAH,IAAA,CAAPG,OAAO;IACPC,QAAQ,GAAAJ,IAAA,CAARI,QAAQ;IACRC,QAAQ,GAAAL,IAAA,CAARK,QAAQ;IACRC,WAAW,GAAAN,IAAA,CAAXM,WAAW;AACRC,IAAAA,IAAI,GAAAC,wBAAA,CAAAR,IAAA,EAAAS,SAAA,CAAA,CAAA;AAMP,EAAA,IAAAC,aAAA,GAAkDC,YAAY,EAAE;IAAxDC,IAAI,GAAAF,aAAA,CAAJE,IAAI;IAAEC,gBAAgB,GAAAH,aAAA,CAAhBG,gBAAgB;IAAEC,aAAa,GAAAJ,aAAA,CAAbI,aAAa,CAAA;AAC7C,EAAA,IAAAC,qBAAA,GAA8BC,qBAAqB,EAAE;IAA7CC,KAAK,GAAAF,qBAAA,CAALE,KAAK;IAAEC,UAAU,GAAAH,qBAAA,CAAVG,UAAU,CAAA;AAEzB,EAAA,IAAMC,qBAAqB,GAAGC,cAAK,CAACC,OAAO,CAAC,YAAM;AAAA,IAAA,IAAAC,k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MAAAA,WAAW,EAAEA,WAAY;AACzBY,MAAAA,UAAU,EAAEA,UAAW;AACvBsB,MAAAA,cAAc,EAAE,KAAM;AACtBC,MAAAA,eAAe,EAAE,KAAM;MACvBC,WAAW,EAAE5B,aAAa,KAAKG,KAAM;AACrC0B,MAAAA,QAAQ,EAAC,WAAW;AACpBC,MAAAA,OAAO,EAAC,WAAW;AACnBhC,MAAAA,IAAI,EAAEA,IAAK;MACXiC,UAAU,EAAE,CAAC3C,QAAQ,IAAI,CAACiB,qBAAqB,GAAG,QAAQ,GAAG,YAAa;AAC1E2B,MAAAA,YAAY,EAAE;AACZC,QAAAA,SAAS,EAAE,SAAS;AACpBC,QAAAA,OAAO,EAAE,WAAA;OACT;MACFC,0BAA0B,eACxBtB,GAAA,CAACuB,sBAAsB,EAAA;AACrBC,QAAAA,KAAK,EAAEjC,UAAU,GAAG,gCAAgC,GAAG,6BAA8B;AACrFN,QAAAA,IAAI,EAAC,OAAA;OACN,CAAA;KAECwC,EAAAA,sBAAsB,CAAC7C,IAAI,CAAC,CAAA,EAAA,EAAA,EAAA;AAAAH,MAAAA,QAAA,EAE/BA,QAAAA;KACS,CAAA,CAAA;AAAC,GAAA,CACN,CAAC,CAAA;AAEd,CAAC,CAAA;AAED,IAAM4B,mBAAmB,gBAAGqB,wBAAwB,CAACtD,oBAAoB,EAAE;EACzEuD,WAAW,EAAEC,YAAY,CAACvB,mBAAAA;AAC5B,CAAC;;;;"}
@@ -19,7 +19,6 @@ var StyledAccordionButton = /*#__PURE__*/styled.button.withConfig({
19
19
  return _objectSpread(_objectSpread({}, commonStyles), {}, {
20
20
  backgroundColor: getBackgroundColor({
21
21
  theme: theme,
22
- isExpanded: isExpanded,
23
22
  isActive: false
24
23
  }),
25
24
  transitionProperty: 'background-color, box-shadow, border-radius, color',
@@ -33,10 +32,12 @@ var StyledAccordionButton = /*#__PURE__*/styled.button.withConfig({
33
32
  '&:hover, &:focus-visible': {
34
33
  backgroundColor: getBackgroundColor({
35
34
  theme: theme,
36
- isExpanded: isExpanded,
37
35
  isActive: true
38
36
  }),
39
- color: theme.colors.interactive.icon.gray.subtle
37
+ color: theme.colors.interactive.icon.gray.subtle,
38
+ '& [data-blade-component="divider"]': {
39
+ opacity: 0
40
+ }
40
41
  },
41
42
  '&:focus-visible': _objectSpread(_objectSpread({}, getFocusRingStyles({
42
43
  theme: theme
@@ -1 +1 @@
1
- {"version":3,"file":"StyledAccordionButton.web.js","sources":["../../../../../../src/components/Accordion/StyledAccordionButton.web.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport type { StyledAccordionButtonProps } from './types';\nimport {\n getBackgroundColor,\n getCommonAccordionButtonStyles,\n getTransitionDuration,\n getTransitionEasing,\n} from './commonStyles';\nimport { castWebType } from '~utils';\nimport { getFocusRingStyles } from '~utils/getFocusRingStyles';\n\nconst StyledAccordionButton = styled.button<StyledAccordionButtonProps>((props) => {\n const { theme, isExpanded, disabled } = props;\n const commonStyles = getCommonAccordionButtonStyles(props);\n return {\n ...commonStyles,\n backgroundColor: getBackgroundColor({ theme, isExpanded, isActive: false }),\n transitionProperty: 'background-color, box-shadow, border-radius, color',\n transitionDuration: castWebType(getTransitionDuration(theme)),\n transitionTimingFunction: castWebType(getTransitionEasing(theme)),\n cursor: disabled ? 'not-allowed' : 'pointer',\n color: theme.colors.interactive.icon.gray[isExpanded ? 'subtle' : 'muted'],\n width: '100%',\n border: 'none',\n textAlign: 'left',\n\n '&:hover, &:focus-visible': {\n backgroundColor: getBackgroundColor({ theme, isExpanded, isActive: true }),\n color: theme.colors.interactive.icon.gray.subtle,\n },\n '&:focus-visible': {\n ...getFocusRingStyles({ theme }),\n // only need border radius on the focus ring\n borderRadius: theme.border.radius.small,\n },\n };\n});\n\nexport { StyledAccordionButton };\n"],"names":["StyledAccordionButton","styled","button","withConfig","displayName","componentId","props","theme","isExpanded","disabled","commonStyles","getCommonAccordionButtonStyles","_objectSpread","backgroundColor","getBackgroundColor","isActive","transitionProperty","transitionDuration","castWebType","getTransitionDuration","transitionTimingFunction","getTransitionEasing","cursor","color","colors","interactive","icon","gray","width","border","textAlign","subtle","getFocusRingStyles","borderRadius","radius","small"],"mappings":";;;;;;;;;;AAWA,IAAMA,qBAAqB,gBAAGC,MAAM,CAACC,MAAM,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,iDAAA;EAAAC,WAAA,EAAA,cAAA;AAAA,CAA6B,CAAA,CAAA,UAACC,KAAK,EAAK;AACjF,EAAA,IAAQC,KAAK,GAA2BD,KAAK,CAArCC,KAAK;IAAEC,UAAU,GAAeF,KAAK,CAA9BE,UAAU;IAAEC,QAAQ,GAAKH,KAAK,CAAlBG,QAAQ,CAAA;AACnC,EAAA,IAAMC,YAAY,GAAGC,8BAA8B,CAACL,KAAK,CAAC,CAAA;AAC1D,EAAA,OAAAM,aAAA,CAAAA,aAAA,CAAA,EAAA,EACKF,YAAY,CAAA,EAAA,EAAA,EAAA;IACfG,eAAe,EAAEC,kBAAkB,CAAC;AAAEP,MAAAA,KAAK,EAALA,KAAK;AAAEC,MAAAA,UAAU,EAAVA,UAAU;AAAEO,MAAAA,QAAQ,EAAE,KAAA;AAAM,KAAC,CAAC;AAC3EC,IAAAA,kBAAkB,EAAE,oDAAoD;AACxEC,IAAAA,kBAAkB,EAAEC,WAAW,CAACC,qBAAqB,CAACZ,KAAK,CAAC,CAAC;AAC7Da,IAAAA,wBAAwB,EAAEF,WAAW,CAACG,mBAAmB,CAACd,KAAK,CAAC,CAAC;AACjEe,IAAAA,MAAM,EAAEb,QAAQ,GAAG,aAAa,GAAG,SAAS;AAC5Cc,IAAAA,KAAK,EAAEhB,KAAK,CAACiB,MAAM,CAACC,WAAW,CAACC,IAAI,CAACC,IAAI,CAACnB,UAAU,GAAG,QAAQ,GAAG,OAAO,CAAC;AAC1EoB,IAAAA,KAAK,EAAE,MAAM;AACbC,IAAAA,MAAM,EAAE,MAAM;AACdC,IAAAA,SAAS,EAAE,MAAM;AAEjB,IAAA,0BAA0B,EAAE;MAC1BjB,eAAe,EAAEC,kBAAkB,CAAC;AAAEP,QAAAA,KAAK,EAALA,KAAK;AAAEC,QAAAA,UAAU,EAAVA,UAAU;AAAEO,QAAAA,QAAQ,EAAE,IAAA;AAAK,OAAC,CAAC;MAC1EQ,KAAK,EAAEhB,KAAK,CAACiB,MAAM,CAACC,WAAW,CAACC,IAAI,CAACC,IAAI,CAACI,MAAAA;KAC3C;AACD,IAAA,iBAAiB,EAAAnB,aAAA,CAAAA,aAAA,CAAA,EAAA,EACZoB,kBAAkB,CAAC;AAAEzB,MAAAA,KAAK,EAALA,KAAAA;AAAM,KAAC,CAAC,CAAA,EAAA,EAAA,EAAA;AAChC;AACA0B,MAAAA,YAAY,EAAE1B,KAAK,CAACsB,MAAM,CAACK,MAAM,CAACC,KAAAA;AAAK,KAAA,CAAA;AACxC,GAAA,CAAA,CAAA;AAEL,CAAC;;;;"}
1
+ {"version":3,"file":"StyledAccordionButton.web.js","sources":["../../../../../../src/components/Accordion/StyledAccordionButton.web.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport type { StyledAccordionButtonProps } from './types';\nimport {\n getBackgroundColor,\n getCommonAccordionButtonStyles,\n getTransitionDuration,\n getTransitionEasing,\n} from './commonStyles';\nimport { castWebType } from '~utils';\nimport { getFocusRingStyles } from '~utils/getFocusRingStyles';\n\nconst StyledAccordionButton = styled.button<StyledAccordionButtonProps>((props) => {\n const { theme, isExpanded, disabled } = props;\n const commonStyles = getCommonAccordionButtonStyles(props);\n return {\n ...commonStyles,\n backgroundColor: getBackgroundColor({ theme, isActive: false }),\n transitionProperty: 'background-color, box-shadow, border-radius, color',\n transitionDuration: castWebType(getTransitionDuration(theme)),\n transitionTimingFunction: castWebType(getTransitionEasing(theme)),\n cursor: disabled ? 'not-allowed' : 'pointer',\n color: theme.colors.interactive.icon.gray[isExpanded ? 'subtle' : 'muted'],\n width: '100%',\n border: 'none',\n textAlign: 'left',\n\n '&:hover, &:focus-visible': {\n backgroundColor: getBackgroundColor({ theme, isActive: true }),\n color: theme.colors.interactive.icon.gray.subtle,\n\n '& [data-blade-component=\"divider\"]': {\n opacity: 0,\n },\n },\n '&:focus-visible': {\n ...getFocusRingStyles({ theme }),\n // only need border radius on the focus ring\n borderRadius: theme.border.radius.small,\n },\n };\n});\n\nexport { StyledAccordionButton };\n"],"names":["StyledAccordionButton","styled","button","withConfig","displayName","componentId","props","theme","isExpanded","disabled","commonStyles","getCommonAccordionButtonStyles","_objectSpread","backgroundColor","getBackgroundColor","isActive","transitionProperty","transitionDuration","castWebType","getTransitionDuration","transitionTimingFunction","getTransitionEasing","cursor","color","colors","interactive","icon","gray","width","border","textAlign","subtle","opacity","getFocusRingStyles","borderRadius","radius","small"],"mappings":";;;;;;;;;;AAWA,IAAMA,qBAAqB,gBAAGC,MAAM,CAACC,MAAM,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,iDAAA;EAAAC,WAAA,EAAA,cAAA;AAAA,CAA6B,CAAA,CAAA,UAACC,KAAK,EAAK;AACjF,EAAA,IAAQC,KAAK,GAA2BD,KAAK,CAArCC,KAAK;IAAEC,UAAU,GAAeF,KAAK,CAA9BE,UAAU;IAAEC,QAAQ,GAAKH,KAAK,CAAlBG,QAAQ,CAAA;AACnC,EAAA,IAAMC,YAAY,GAAGC,8BAA8B,CAACL,KAAK,CAAC,CAAA;AAC1D,EAAA,OAAAM,aAAA,CAAAA,aAAA,CAAA,EAAA,EACKF,YAAY,CAAA,EAAA,EAAA,EAAA;IACfG,eAAe,EAAEC,kBAAkB,CAAC;AAAEP,MAAAA,KAAK,EAALA,KAAK;AAAEQ,MAAAA,QAAQ,EAAE,KAAA;AAAM,KAAC,CAAC;AAC/DC,IAAAA,kBAAkB,EAAE,oDAAoD;AACxEC,IAAAA,kBAAkB,EAAEC,WAAW,CAACC,qBAAqB,CAACZ,KAAK,CAAC,CAAC;AAC7Da,IAAAA,wBAAwB,EAAEF,WAAW,CAACG,mBAAmB,CAACd,KAAK,CAAC,CAAC;AACjEe,IAAAA,MAAM,EAAEb,QAAQ,GAAG,aAAa,GAAG,SAAS;AAC5Cc,IAAAA,KAAK,EAAEhB,KAAK,CAACiB,MAAM,CAACC,WAAW,CAACC,IAAI,CAACC,IAAI,CAACnB,UAAU,GAAG,QAAQ,GAAG,OAAO,CAAC;AAC1EoB,IAAAA,KAAK,EAAE,MAAM;AACbC,IAAAA,MAAM,EAAE,MAAM;AACdC,IAAAA,SAAS,EAAE,MAAM;AAEjB,IAAA,0BAA0B,EAAE;MAC1BjB,eAAe,EAAEC,kBAAkB,CAAC;AAAEP,QAAAA,KAAK,EAALA,KAAK;AAAEQ,QAAAA,QAAQ,EAAE,IAAA;AAAK,OAAC,CAAC;MAC9DQ,KAAK,EAAEhB,KAAK,CAACiB,MAAM,CAACC,WAAW,CAACC,IAAI,CAACC,IAAI,CAACI,MAAM;AAEhD,MAAA,oCAAoC,EAAE;AACpCC,QAAAA,OAAO,EAAE,CAAA;AACX,OAAA;KACD;AACD,IAAA,iBAAiB,EAAApB,aAAA,CAAAA,aAAA,CAAA,EAAA,EACZqB,kBAAkB,CAAC;AAAE1B,MAAAA,KAAK,EAALA,KAAAA;AAAM,KAAC,CAAC,CAAA,EAAA,EAAA,EAAA;AAChC;AACA2B,MAAAA,YAAY,EAAE3B,KAAK,CAACsB,MAAM,CAACM,MAAM,CAACC,KAAAA;AAAK,KAAA,CAAA;AACxC,GAAA,CAAA,CAAA;AAEL,CAAC;;;;"}
@@ -12,19 +12,9 @@ var getTransitionEasing = function getTransitionEasing(theme) {
12
12
  };
13
13
  var getBackgroundColor = function getBackgroundColor(_ref) {
14
14
  var theme = _ref.theme,
15
- isExpanded = _ref.isExpanded,
16
15
  isActive = _ref.isActive;
17
16
  var gray = theme.colors.interactive.background.gray;
18
- if (isExpanded) {
19
- if (isActive) {
20
- return gray.fadedHighlighted;
21
- }
22
- return gray.faded;
23
- }
24
- if (isActive) {
25
- return gray.faded;
26
- }
27
- return theme.colors.transparent;
17
+ return isActive ? gray.faded : theme.colors.transparent;
28
18
  };
29
19
  var getCommonAccordionButtonStyles = function getCommonAccordionButtonStyles(props) {
30
20
  var theme = props.theme;
@@ -1 +1 @@
1
- {"version":3,"file":"commonStyles.js","sources":["../../../../../../src/components/Accordion/commonStyles.ts"],"sourcesContent":["import type { CSSObject, StyledProps } from 'styled-components';\nimport type { StyledAccordionButtonProps } from './types';\nimport type { Theme } from '~components/BladeProvider';\nimport { makeMotionTime } from '~utils';\n\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nconst getTransitionDuration = (theme: Theme) => makeMotionTime(theme.motion.duration['2xquick']);\n\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nconst getTransitionEasing = (theme: Theme) => theme.motion.easing.standard;\n\nconst getBackgroundColor = ({\n theme,\n isExpanded,\n isActive,\n}: {\n theme: Theme;\n isExpanded: boolean;\n isActive: boolean;\n}): string => {\n const { gray } = theme.colors.interactive.background;\n\n if (isExpanded) {\n if (isActive) {\n return gray.fadedHighlighted;\n }\n\n return gray.faded;\n }\n\n if (isActive) {\n return gray.faded;\n }\n\n return theme.colors.transparent;\n};\n\nconst getCommonAccordionButtonStyles = (\n props: StyledProps<StyledAccordionButtonProps>,\n): CSSObject => {\n const { theme } = props;\n\n return {\n padding: theme.spacing[0],\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n };\n};\n\nexport {\n getTransitionDuration,\n getTransitionEasing,\n getBackgroundColor,\n getCommonAccordionButtonStyles,\n};\n"],"names":["getTransitionDuration","theme","makeMotionTime","motion","duration","getTransitionEasing","easing","standard","getBackgroundColor","_ref","isExpanded","isActive","gray","colors","interactive","background","fadedHighlighted","faded","transparent","getCommonAccordionButtonStyles","props","padding","spacing","display","flexDirection","alignItems","justifyContent"],"mappings":";;;AAKA;AACA,IAAMA,qBAAqB,GAAG,SAAxBA,qBAAqBA,CAAIC,KAAY,EAAA;EAAA,OAAKC,cAAc,CAACD,KAAK,CAACE,MAAM,CAACC,QAAQ,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["import type { CSSObject, StyledProps } from 'styled-components';\nimport type { StyledAccordionButtonProps } from './types';\nimport type { Theme } from '~components/BladeProvider';\nimport { makeMotionTime } from '~utils';\n\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nconst getTransitionDuration = (theme: Theme) => makeMotionTime(theme.motion.duration['2xquick']);\n\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nconst getTransitionEasing = (theme: Theme) => theme.motion.easing.standard;\n\nconst getBackgroundColor = ({ theme, isActive }: { theme: Theme; isActive: boolean }): string => {\n const { gray } = theme.colors.interactive.background;\n\n return isActive ? gray.faded : theme.colors.transparent;\n};\n\nconst getCommonAccordionButtonStyles = (\n props: StyledProps<StyledAccordionButtonProps>,\n): CSSObject => {\n const { theme } = props;\n\n return {\n padding: theme.spacing[0],\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n };\n};\n\nexport {\n getTransitionDuration,\n getTransitionEasing,\n getBackgroundColor,\n getCommonAccordionButtonStyles,\n};\n"],"names":["getTransitionDuration","theme","makeMotionTime","motion","duration","getTransitionEasing","easing","standard","getBackgroundColor","_ref","isActive","gray","colors","interactive","background","faded","transparent","getCommonAccordionButtonStyles","props","padding","spacing","display","flexDirection","alignItems","justifyContent"],"mappings":";;;AAKA;AACA,IAAMA,qBAAqB,GAAG,SAAxBA,qBAAqBA,CAAIC,KAAY,EAAA;EAAA,OAAKC,cAAc,CAACD,KAAK,CAACE,MAAM,CAACC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAA;AAAA,EAAA;;AAEhG;AACA,IAAMC,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAIJ,KAAY,EAAA;AAAA,EAAA,OAAKA,KAAK,CAACE,MAAM,CAACG,MAAM,CAACC,QAAQ,CAAA;AAAA,EAAA;AAE1E,IAAMC,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAAC,IAAA,EAAyE;AAAA,EAAA,IAAnER,KAAK,GAAAQ,IAAA,CAALR,KAAK;IAAES,QAAQ,GAAAD,IAAA,CAARC,QAAQ,CAAA;EAC3C,IAAQC,IAAI,GAAKV,KAAK,CAACW,MAAM,CAACC,WAAW,CAACC,UAAU,CAA5CH,IAAI,CAAA;EAEZ,OAAOD,QAAQ,GAAGC,IAAI,CAACI,KAAK,GAAGd,KAAK,CAACW,MAAM,CAACI,WAAW,CAAA;AACzD,EAAC;AAED,IAAMC,8BAA8B,GAAG,SAAjCA,8BAA8BA,CAClCC,KAA8C,EAChC;AACd,EAAA,IAAQjB,KAAK,GAAKiB,KAAK,CAAfjB,KAAK,CAAA;EAEb,OAAO;AACLkB,IAAAA,OAAO,EAAElB,KAAK,CAACmB,OAAO,CAAC,CAAC,CAAC;AACzBC,IAAAA,OAAO,EAAE,MAAM;AACfC,IAAAA,aAAa,EAAE,KAAK;AACpBC,IAAAA,UAAU,EAAE,QAAQ;AACpBC,IAAAA,cAAc,EAAE,eAAA;GACjB,CAAA;AACH;;;;"}
@@ -248,6 +248,7 @@ var _ActionListItem = function _ActionListItem(props) {
248
248
  }, [activeIndex]);
249
249
  var hasAutoComplete = hasAutoCompleteInHeader || dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete;
250
250
  var hasFilterChipSelectInput = dropdownTriggerer === dropdownComponentIds.triggers.FilterChipSelectInput;
251
+ var hasInputDropdownButton = dropdownTriggerer === dropdownComponentIds.triggers.InputDropdownButton;
251
252
  var renderOnWebAs = props.href ? 'a' : 'button';
252
253
  /**
253
254
  * In SelectInput, returns the isSelected according to selected indexes in the state
@@ -256,7 +257,7 @@ var _ActionListItem = function _ActionListItem(props) {
256
257
  * isSelected prop explicitly is the only way to select item in menu
257
258
  */
258
259
  var getIsSelected = function getIsSelected() {
259
- if (dropdownTriggerer === dropdownComponentIds.triggers.SelectInput || hasAutoComplete || hasFilterChipSelectInput) {
260
+ if (dropdownTriggerer === dropdownComponentIds.triggers.SelectInput || hasAutoComplete || hasFilterChipSelectInput || hasInputDropdownButton) {
260
261
  if (typeof props._index === 'number') {
261
262
  return selectedIndices.includes(props._index);
262
263
  }