@razorpay/blade 11.36.0 → 11.36.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 (66) hide show
  1. package/build/lib/native/components/Dropdown/useDropdown.js +3 -1
  2. package/build/lib/native/components/Dropdown/useDropdown.js.map +1 -1
  3. package/build/lib/native/components/Input/BaseInput/BaseInput.js +1 -1
  4. package/build/lib/native/components/Input/BaseInput/BaseInput.js.map +1 -1
  5. package/build/lib/native/components/Input/BaseInput/BaseInputVisuals.js +2 -1
  6. package/build/lib/native/components/Input/BaseInput/BaseInputVisuals.js.map +1 -1
  7. package/build/lib/native/components/Input/DropdownInputTriggers/AutoComplete.js.map +1 -1
  8. package/build/lib/native/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js +3 -1
  9. package/build/lib/native/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js.map +1 -1
  10. package/build/lib/native/utils/fireNativeEvent/fireNativeEvent.native.js +6 -0
  11. package/build/lib/native/utils/fireNativeEvent/fireNativeEvent.native.js.map +1 -0
  12. package/build/lib/native/utils/index.js +1 -0
  13. package/build/lib/native/utils/index.js.map +1 -1
  14. package/build/lib/native/utils/platform/isBrowser.js +6 -0
  15. package/build/lib/native/utils/platform/isBrowser.js.map +1 -0
  16. package/build/lib/web/development/components/DatePicker/DatePicker.web.js +7 -1
  17. package/build/lib/web/development/components/DatePicker/DatePicker.web.js.map +1 -1
  18. package/build/lib/web/development/components/Dropdown/useDropdown.js +7 -0
  19. package/build/lib/web/development/components/Dropdown/useDropdown.js.map +1 -1
  20. package/build/lib/web/development/components/FileUpload/FileUpload.web.js +6 -0
  21. package/build/lib/web/development/components/FileUpload/FileUpload.web.js.map +1 -1
  22. package/build/lib/web/development/components/Input/BaseInput/BaseInput.js +4 -2
  23. package/build/lib/web/development/components/Input/BaseInput/BaseInput.js.map +1 -1
  24. package/build/lib/web/development/components/Input/BaseInput/BaseInputVisuals.js +77 -66
  25. package/build/lib/web/development/components/Input/BaseInput/BaseInputVisuals.js.map +1 -1
  26. package/build/lib/web/development/components/Input/DropdownInputTriggers/AutoComplete.js.map +1 -1
  27. package/build/lib/web/development/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js +18 -11
  28. package/build/lib/web/development/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js.map +1 -1
  29. package/build/lib/web/development/utils/fireNativeEvent/fireNativeEvent.web.js +30 -0
  30. package/build/lib/web/development/utils/fireNativeEvent/fireNativeEvent.web.js.map +1 -0
  31. package/build/lib/web/development/utils/fireNativeEvent/index.js +2 -0
  32. package/build/lib/web/development/utils/fireNativeEvent/index.js.map +1 -0
  33. package/build/lib/web/development/utils/index.js +1 -0
  34. package/build/lib/web/development/utils/index.js.map +1 -1
  35. package/build/lib/web/development/utils/platform/index.js +1 -0
  36. package/build/lib/web/development/utils/platform/index.js.map +1 -1
  37. package/build/lib/web/development/utils/platform/isBrowser.js +9 -0
  38. package/build/lib/web/development/utils/platform/isBrowser.js.map +1 -0
  39. package/build/lib/web/production/components/DatePicker/DatePicker.web.js +7 -1
  40. package/build/lib/web/production/components/DatePicker/DatePicker.web.js.map +1 -1
  41. package/build/lib/web/production/components/Dropdown/useDropdown.js +7 -0
  42. package/build/lib/web/production/components/Dropdown/useDropdown.js.map +1 -1
  43. package/build/lib/web/production/components/FileUpload/FileUpload.web.js +6 -0
  44. package/build/lib/web/production/components/FileUpload/FileUpload.web.js.map +1 -1
  45. package/build/lib/web/production/components/Input/BaseInput/BaseInput.js +4 -2
  46. package/build/lib/web/production/components/Input/BaseInput/BaseInput.js.map +1 -1
  47. package/build/lib/web/production/components/Input/BaseInput/BaseInputVisuals.js +77 -66
  48. package/build/lib/web/production/components/Input/BaseInput/BaseInputVisuals.js.map +1 -1
  49. package/build/lib/web/production/components/Input/DropdownInputTriggers/AutoComplete.js.map +1 -1
  50. package/build/lib/web/production/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js +18 -11
  51. package/build/lib/web/production/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js.map +1 -1
  52. package/build/lib/web/production/utils/fireNativeEvent/fireNativeEvent.web.js +30 -0
  53. package/build/lib/web/production/utils/fireNativeEvent/fireNativeEvent.web.js.map +1 -0
  54. package/build/lib/web/production/utils/fireNativeEvent/index.js +2 -0
  55. package/build/lib/web/production/utils/fireNativeEvent/index.js.map +1 -0
  56. package/build/lib/web/production/utils/index.js +1 -0
  57. package/build/lib/web/production/utils/index.js.map +1 -1
  58. package/build/lib/web/production/utils/platform/index.js +1 -0
  59. package/build/lib/web/production/utils/platform/index.js.map +1 -1
  60. package/build/lib/web/production/utils/platform/isBrowser.js +9 -0
  61. package/build/lib/web/production/utils/platform/isBrowser.js.map +1 -0
  62. package/build/types/components/index.d.ts +4 -0
  63. package/build/types/components/index.native.d.ts +4 -0
  64. package/build/types/utils/index.d.ts +3 -1
  65. package/build/types/utils/index.native.d.ts +3 -1
  66. package/package.json +1 -1
@@ -7,6 +7,7 @@ import '@babel/runtime/helpers/slicedToArray';
7
7
  import 'react-native';
8
8
  import '../../../tokens/global/typography.js';
9
9
  import '../../../tokens/global/motion.js';
10
+ import { isReactNative } from '../../../utils/platform/isReactNative.js';
10
11
  import '../../BladeProvider/useTheme.js';
11
12
  import { jsxs, jsx } from 'react/jsx-runtime';
12
13
  import { Text } from '../../Typography/Text/Text.js';
@@ -16,7 +17,7 @@ import { Tooltip } from '../../Tooltip/Tooltip.native.js';
16
17
  import '../../Tooltip/TooltipInteractiveWrapper.native.js';
17
18
  import { Box } from '../../Box/Box.js';
18
19
 
19
- var getVisualContainerStyles=function getVisualContainerStyles(){return {display:'flex',flexDirection:'row',alignItems:'center',alignSelf:'center'};};var trailingIconColor={none:'surface.icon.gray.subtle',error:'feedback.icon.negative.intense',success:'feedback.icon.positive.intense'};var iconSize={medium:'medium',large:'large'};var textSize={medium:'medium',large:'large'};var getPrefixStyles=function getPrefixStyles(_ref){var hasLeadingIcon=_ref.hasLeadingIcon,hasPrefix=_ref.hasPrefix;if(hasPrefix&&hasLeadingIcon){return {paddingLeft:'spacing.3'};}if(hasPrefix&&!hasLeadingIcon){return {paddingLeft:'spacing.4'};}return {paddingLeft:'spacing.0'};};var getInteractionElementStyles=function getInteractionElementStyles(_ref2){var hasTrailingIcon=_ref2.hasTrailingIcon,hasLeadingInteractionElement=_ref2.hasLeadingInteractionElement,hasTrailingInteractionElement=_ref2.hasTrailingInteractionElement,hasSuffix=_ref2.hasSuffix,hasTrailingButton=_ref2.hasTrailingButton;if(hasTrailingInteractionElement&&(hasSuffix||hasTrailingIcon||hasTrailingButton)){return 'spacing.2';}if(hasTrailingInteractionElement&&!hasSuffix&&!hasTrailingIcon&&!hasTrailingButton){return 'spacing.4';}if(hasLeadingInteractionElement){return 'spacing.3';}return 'spacing.0';};var getSuffixStyles=function getSuffixStyles(_ref3){var hasTrailingIcon=_ref3.hasTrailingIcon,hasSuffix=_ref3.hasSuffix,hasTrailingButton=_ref3.hasTrailingButton;if(hasSuffix&&(hasTrailingIcon||hasTrailingButton)){return {paddingRight:'spacing.3'};}if(hasSuffix&&!hasTrailingIcon&&!hasTrailingButton){return {paddingRight:'spacing.4'};}return {paddingRight:'spacing.0'};};var getTrailingIconStyles=function getTrailingIconStyles(_ref4){var hasTrailingIcon=_ref4.hasTrailingIcon,hasTrailingButton=_ref4.hasTrailingButton;if(hasTrailingIcon&&hasTrailingButton){return {paddingRight:'spacing.3'};}if(hasTrailingIcon&&!hasTrailingButton){return {paddingRight:'spacing.4'};}return {paddingRight:'spacing.0'};};var getInputVisualsToBeRendered=function getInputVisualsToBeRendered(_ref5){var leadingIcon=_ref5.leadingIcon,prefix=_ref5.prefix,trailingInteractionElement=_ref5.trailingInteractionElement,leadingInteractionElement=_ref5.leadingInteractionElement,suffix=_ref5.suffix,trailingIcon=_ref5.trailingIcon,trailingButton=_ref5.trailingButton;return {hasLeadingIcon:Boolean(leadingIcon),hasPrefix:Boolean(prefix),hasTrailingInteractionElement:Boolean(trailingInteractionElement),hasLeadingInteractionElement:Boolean(leadingInteractionElement),hasSuffix:Boolean(suffix),hasTrailingIcon:Boolean(trailingIcon),hasTrailingButton:Boolean(trailingButton)};};var getTooltipContent=function getTooltipContent(_ref6){var validationState=_ref6.validationState,errorText=_ref6.errorText,successText=_ref6.successText;if(validationState==='error'&&errorText){return errorText;}if(validationState==='success'&&successText){return successText;}return '';};var ValidationIconTooltip=function ValidationIconTooltip(_ref7){var children=_ref7.children,validationState=_ref7.validationState,errorText=_ref7.errorText,successText=_ref7.successText,showHintsAsTooltip=_ref7.showHintsAsTooltip;if(showHintsAsTooltip&&validationState==='error'&&errorText||validationState==='success'&&successText){return jsx(Tooltip,{content:getTooltipContent({validationState:validationState,errorText:errorText,successText:successText}),children:jsx(Box,{display:"flex",justifyContent:"center",alignItems:"center",children:children})});}return children;};var BaseInputVisuals=function BaseInputVisuals(_ref8){var LeadingIcon=_ref8.leadingIcon,prefix=_ref8.prefix,trailingInteractionElement=_ref8.trailingInteractionElement,leadingInteractionElement=_ref8.leadingInteractionElement,suffix=_ref8.suffix,TrailingIcon=_ref8.trailingIcon,isDisabled=_ref8.isDisabled,_ref8$validationState=_ref8.validationState,validationState=_ref8$validationState===void 0?'none':_ref8$validationState,size=_ref8.size,showHintsAsTooltip=_ref8.showHintsAsTooltip,errorText=_ref8.errorText,successText=_ref8.successText,TrailingButton=_ref8.trailingButton;var _getInputVisualsToBeR=getInputVisualsToBeRendered({leadingIcon:LeadingIcon,prefix:prefix,leadingInteractionElement:leadingInteractionElement,trailingInteractionElement:trailingInteractionElement,suffix:suffix,trailingIcon:TrailingIcon,trailingButton:TrailingButton,size:size}),hasLeadingIcon=_getInputVisualsToBeR.hasLeadingIcon,hasPrefix=_getInputVisualsToBeR.hasPrefix,hasSuffix=_getInputVisualsToBeR.hasSuffix,hasTrailingInteractionElement=_getInputVisualsToBeR.hasTrailingInteractionElement,hasLeadingInteractionElement=_getInputVisualsToBeR.hasLeadingInteractionElement,hasTrailingIcon=_getInputVisualsToBeR.hasTrailingIcon,hasTrailingButton=_getInputVisualsToBeR.hasTrailingButton;var hasLeadingVisuals=hasLeadingInteractionElement||hasLeadingIcon||hasPrefix;var hasTrailingVisuals=hasTrailingInteractionElement||hasSuffix||hasTrailingIcon||hasTrailingButton;if(__DEV__){if(hasTrailingButton&&!isValidAllowedChildren(TrailingButton,'Link')){throwBladeError({message:'trailingButton must be a valid Blade Link component',moduleName:'BaseInput'});}}if(hasLeadingVisuals){return jsxs(BaseBox,Object.assign({},getVisualContainerStyles(),{children:[hasLeadingInteractionElement?jsx(BaseBox,{paddingLeft:getInteractionElementStyles({hasTrailingIcon:hasTrailingIcon,hasLeadingInteractionElement:hasLeadingInteractionElement,hasSuffix:hasSuffix,hasTrailingButton:hasTrailingButton}),display:"flex",alignItems:"stretch",alignSelf:"stretch",children:leadingInteractionElement}):null,LeadingIcon?jsx(BaseBox,{paddingLeft:"spacing.4",display:"flex",children:jsx(LeadingIcon,{size:iconSize[size],color:isDisabled?'surface.icon.gray.disabled':'surface.icon.gray.muted'})}):null,hasPrefix?jsx(BaseBox,Object.assign({},getPrefixStyles({hasLeadingIcon:hasLeadingIcon,hasPrefix:hasPrefix}),{children:jsx(Text,{size:textSize[size],variant:"body",weight:"regular",color:isDisabled?'surface.text.gray.disabled':'surface.text.gray.subtle',children:prefix})})):null]}));}if(hasTrailingVisuals){return jsxs(BaseBox,Object.assign({alignSelf:"stretch",alignItems:"stretch"},getVisualContainerStyles(),{children:[hasTrailingInteractionElement?jsx(BaseBox,{paddingRight:getInteractionElementStyles({hasTrailingIcon:hasTrailingIcon,hasTrailingInteractionElement:hasTrailingInteractionElement,hasSuffix:hasSuffix,hasTrailingButton:hasTrailingButton}),display:"flex",alignItems:"stretch",alignSelf:"stretch",children:trailingInteractionElement}):null,hasSuffix?jsx(BaseBox,Object.assign({},getSuffixStyles({hasTrailingIcon:hasTrailingIcon,hasSuffix:hasSuffix,hasTrailingButton:hasTrailingButton}),{children:jsx(Text,{size:textSize[size],variant:"body",weight:"regular",color:isDisabled?'surface.text.gray.disabled':'surface.text.gray.subtle',children:suffix})})):null,TrailingIcon?jsx(BaseBox,Object.assign({display:"flex",justifyContent:"center",alignItems:"center"},getTrailingIconStyles({hasTrailingIcon:hasTrailingIcon,hasTrailingButton:hasTrailingButton}),{children:jsx(ValidationIconTooltip,{showHintsAsTooltip:showHintsAsTooltip,errorText:errorText,successText:successText,validationState:validationState,children:jsx(TrailingIcon,{size:iconSize[size],color:isDisabled?'interactive.icon.gray.disabled':trailingIconColor[validationState]})})})):null,TrailingButton?jsx(BaseBox,{paddingRight:"spacing.4",display:"flex",children:React__default.cloneElement(TrailingButton,{size:size,variant:'button',isDisabled:isDisabled})}):null]}));}return null;};
20
+ var getVisualContainerStyles=function getVisualContainerStyles(){var _ref=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},shouldStretchTrailingBox=_ref.shouldStretchTrailingBox;return {display:'flex',flexDirection:'row',alignItems:'center',alignSelf:shouldStretchTrailingBox?'stretch':'center'};};var trailingIconColor={none:'surface.icon.gray.subtle',error:'feedback.icon.negative.intense',success:'feedback.icon.positive.intense'};var iconSize={medium:'medium',large:'large'};var textSize={medium:'medium',large:'large'};var getPrefixStyles=function getPrefixStyles(_ref2){var hasLeadingIcon=_ref2.hasLeadingIcon,hasPrefix=_ref2.hasPrefix;if(hasPrefix&&hasLeadingIcon){return {paddingLeft:'spacing.3'};}if(hasPrefix&&!hasLeadingIcon){return {paddingLeft:'spacing.4'};}return {paddingLeft:'spacing.0'};};var getInteractionElementStyles=function getInteractionElementStyles(_ref3){var hasTrailingIcon=_ref3.hasTrailingIcon,hasLeadingInteractionElement=_ref3.hasLeadingInteractionElement,hasTrailingInteractionElement=_ref3.hasTrailingInteractionElement,hasSuffix=_ref3.hasSuffix,hasTrailingButton=_ref3.hasTrailingButton;if(hasTrailingInteractionElement&&(hasSuffix||hasTrailingIcon||hasTrailingButton)){return 'spacing.2';}if(hasTrailingInteractionElement&&!hasSuffix&&!hasTrailingIcon&&!hasTrailingButton){return 'spacing.4';}if(hasLeadingInteractionElement){return 'spacing.3';}return 'spacing.0';};var getSuffixStyles=function getSuffixStyles(_ref4){var hasTrailingIcon=_ref4.hasTrailingIcon,hasSuffix=_ref4.hasSuffix,hasTrailingButton=_ref4.hasTrailingButton;if(hasSuffix&&(hasTrailingIcon||hasTrailingButton)){return {paddingRight:'spacing.3'};}if(hasSuffix&&!hasTrailingIcon&&!hasTrailingButton){return {paddingRight:'spacing.4'};}return {paddingRight:'spacing.0'};};var getTrailingIconStyles=function getTrailingIconStyles(_ref5){var hasTrailingIcon=_ref5.hasTrailingIcon,hasTrailingButton=_ref5.hasTrailingButton;if(hasTrailingIcon&&hasTrailingButton){return {paddingRight:'spacing.3'};}if(hasTrailingIcon&&!hasTrailingButton){return {paddingRight:'spacing.4'};}return {paddingRight:'spacing.0'};};var getInputVisualsToBeRendered=function getInputVisualsToBeRendered(_ref6){var leadingIcon=_ref6.leadingIcon,prefix=_ref6.prefix,trailingInteractionElement=_ref6.trailingInteractionElement,leadingInteractionElement=_ref6.leadingInteractionElement,suffix=_ref6.suffix,trailingIcon=_ref6.trailingIcon,trailingButton=_ref6.trailingButton;return {hasLeadingIcon:Boolean(leadingIcon),hasPrefix:Boolean(prefix),hasTrailingInteractionElement:Boolean(trailingInteractionElement),hasLeadingInteractionElement:Boolean(leadingInteractionElement),hasSuffix:Boolean(suffix),hasTrailingIcon:Boolean(trailingIcon),hasTrailingButton:Boolean(trailingButton)};};var getTooltipContent=function getTooltipContent(_ref7){var validationState=_ref7.validationState,errorText=_ref7.errorText,successText=_ref7.successText;if(validationState==='error'&&errorText){return errorText;}if(validationState==='success'&&successText){return successText;}return '';};var ValidationIconTooltip=function ValidationIconTooltip(_ref8){var children=_ref8.children,validationState=_ref8.validationState,errorText=_ref8.errorText,successText=_ref8.successText,showHintsAsTooltip=_ref8.showHintsAsTooltip;if(showHintsAsTooltip&&validationState==='error'&&errorText||validationState==='success'&&successText){return jsx(Tooltip,{content:getTooltipContent({validationState:validationState,errorText:errorText,successText:successText}),children:jsx(Box,{display:"flex",justifyContent:"center",alignItems:"center",children:children})});}return children;};var BaseInputVisuals=function BaseInputVisuals(_ref9){var LeadingIcon=_ref9.leadingIcon,prefix=_ref9.prefix,trailingInteractionElement=_ref9.trailingInteractionElement,onTrailingInteractionElementClick=_ref9.onTrailingInteractionElementClick,leadingInteractionElement=_ref9.leadingInteractionElement,suffix=_ref9.suffix,TrailingIcon=_ref9.trailingIcon,isDisabled=_ref9.isDisabled,_ref9$validationState=_ref9.validationState,validationState=_ref9$validationState===void 0?'none':_ref9$validationState,size=_ref9.size,showHintsAsTooltip=_ref9.showHintsAsTooltip,errorText=_ref9.errorText,successText=_ref9.successText,TrailingButton=_ref9.trailingButton;var _getInputVisualsToBeR=getInputVisualsToBeRendered({leadingIcon:LeadingIcon,prefix:prefix,leadingInteractionElement:leadingInteractionElement,trailingInteractionElement:trailingInteractionElement,suffix:suffix,trailingIcon:TrailingIcon,trailingButton:TrailingButton,size:size}),hasLeadingIcon=_getInputVisualsToBeR.hasLeadingIcon,hasPrefix=_getInputVisualsToBeR.hasPrefix,hasSuffix=_getInputVisualsToBeR.hasSuffix,hasTrailingInteractionElement=_getInputVisualsToBeR.hasTrailingInteractionElement,hasLeadingInteractionElement=_getInputVisualsToBeR.hasLeadingInteractionElement,hasTrailingIcon=_getInputVisualsToBeR.hasTrailingIcon,hasTrailingButton=_getInputVisualsToBeR.hasTrailingButton;var hasLeadingVisuals=hasLeadingInteractionElement||hasLeadingIcon||hasPrefix;var hasTrailingVisuals=hasTrailingInteractionElement||hasSuffix||hasTrailingIcon||hasTrailingButton;if(__DEV__){if(hasTrailingButton&&!isValidAllowedChildren(TrailingButton,'Link')){throwBladeError({message:'trailingButton must be a valid Blade Link component',moduleName:'BaseInput'});}}if(hasLeadingVisuals){return jsxs(BaseBox,Object.assign({},getVisualContainerStyles(),{children:[hasLeadingInteractionElement?jsx(BaseBox,{paddingLeft:getInteractionElementStyles({hasTrailingIcon:hasTrailingIcon,hasLeadingInteractionElement:hasLeadingInteractionElement,hasSuffix:hasSuffix,hasTrailingButton:hasTrailingButton}),display:"flex",alignItems:"stretch",alignSelf:"stretch",children:leadingInteractionElement}):null,LeadingIcon?jsx(BaseBox,{paddingLeft:"spacing.4",display:"flex",children:jsx(LeadingIcon,{size:iconSize[size],color:isDisabled?'surface.icon.gray.disabled':'surface.icon.gray.muted'})}):null,hasPrefix?jsx(BaseBox,Object.assign({},getPrefixStyles({hasLeadingIcon:hasLeadingIcon,hasPrefix:hasPrefix}),{children:jsx(Text,{size:textSize[size],variant:"body",weight:"regular",color:isDisabled?'surface.text.gray.disabled':'surface.text.gray.subtle',children:prefix})})):null]}));}if(hasTrailingVisuals){return jsxs(BaseBox,Object.assign({},getVisualContainerStyles({shouldStretchTrailingBox:hasTrailingInteractionElement&&Boolean(onTrailingInteractionElementClick)}),{children:[hasTrailingInteractionElement?jsx(BaseBox,Object.assign({},getVisualContainerStyles({shouldStretchTrailingBox:hasTrailingInteractionElement&&Boolean(onTrailingInteractionElementClick)}),{children:jsx(BaseBox,Object.assign({paddingRight:getInteractionElementStyles({hasTrailingIcon:hasTrailingIcon,hasTrailingInteractionElement:hasTrailingInteractionElement,hasSuffix:hasSuffix,hasTrailingButton:hasTrailingButton}),display:"flex",alignItems:"stretch",alignSelf:"stretch"},!isReactNative()&&{onClick:onTrailingInteractionElementClick},{children:trailingInteractionElement}))})):null,hasSuffix?jsx(BaseBox,Object.assign({},getSuffixStyles({hasTrailingIcon:hasTrailingIcon,hasSuffix:hasSuffix,hasTrailingButton:hasTrailingButton}),{children:jsx(Text,{size:textSize[size],variant:"body",weight:"regular",color:isDisabled?'surface.text.gray.disabled':'surface.text.gray.subtle',children:suffix})})):null,TrailingIcon?jsx(BaseBox,Object.assign({display:"flex",justifyContent:"center",alignItems:"center"},getTrailingIconStyles({hasTrailingIcon:hasTrailingIcon,hasTrailingButton:hasTrailingButton}),{children:jsx(ValidationIconTooltip,{showHintsAsTooltip:showHintsAsTooltip,errorText:errorText,successText:successText,validationState:validationState,children:jsx(TrailingIcon,{size:iconSize[size],color:isDisabled?'interactive.icon.gray.disabled':trailingIconColor[validationState]})})})):null,TrailingButton?jsx(BaseBox,{paddingRight:"spacing.4",display:"flex",children:React__default.cloneElement(TrailingButton,{size:size,variant:'button',isDisabled:isDisabled})}):null]}));}return null;};
20
21
 
21
22
  export { BaseInputVisuals, getInputVisualsToBeRendered };
22
23
  //# sourceMappingURL=BaseInputVisuals.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BaseInputVisuals.js","sources":["../../../../../../src/components/Input/BaseInput/BaseInputVisuals.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/explicit-function-return-type */\nimport React from 'react';\nimport type { ReactElement } from 'react';\nimport type { BaseInputProps } from './BaseInput';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Text } from '~components/Typography';\nimport type { BaseBoxProps, SpacingValueType } from '~components/Box/BaseBox';\nimport type { IconColors } from '~components/Icons';\nimport { isValidAllowedChildren } from '~utils/isValidAllowedChildren';\nimport { throwBladeError } from '~utils/logger';\nimport { Tooltip } from '~components/Tooltip';\nimport { Box } from '~components/Box';\n\ntype InputVisuals = Pick<\n BaseInputProps,\n | 'leadingIcon'\n | 'prefix'\n | 'trailingInteractionElement'\n | 'leadingInteractionElement'\n | 'suffix'\n | 'trailingIcon'\n | 'isDisabled'\n | 'validationState'\n | 'size'\n | 'trailingButton'\n | 'showHintsAsTooltip'\n | 'errorText'\n | 'successText'\n> & {\n size: NonNullable<BaseInputProps['size']>;\n};\n\nconst getVisualContainerStyles = (): Pick<\n BaseBoxProps,\n 'display' | 'flexDirection' | 'alignItems' | 'alignSelf'\n> => ({\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n alignSelf: 'center',\n});\n\nconst trailingIconColor: Record<NonNullable<InputVisuals['validationState']>, IconColors> = {\n none: 'surface.icon.gray.subtle',\n error: 'feedback.icon.negative.intense',\n success: 'feedback.icon.positive.intense',\n};\n\nconst iconSize = {\n medium: 'medium',\n large: 'large',\n} as const;\n\nconst textSize = {\n medium: 'medium',\n large: 'large',\n} as const;\n\nconst getPrefixStyles = ({\n hasLeadingIcon,\n hasPrefix,\n}: {\n hasLeadingIcon: boolean;\n hasPrefix: boolean;\n}): Pick<BaseBoxProps, 'paddingLeft'> => {\n if (hasPrefix && hasLeadingIcon) {\n return {\n paddingLeft: 'spacing.3',\n };\n }\n\n if (hasPrefix && !hasLeadingIcon) {\n return {\n paddingLeft: 'spacing.4',\n };\n }\n\n return {\n paddingLeft: 'spacing.0',\n };\n};\n\nconst getInteractionElementStyles = ({\n hasTrailingIcon,\n hasLeadingInteractionElement,\n hasTrailingInteractionElement,\n hasSuffix,\n hasTrailingButton,\n}: {\n hasTrailingIcon: boolean;\n hasLeadingInteractionElement?: boolean;\n hasTrailingInteractionElement?: boolean;\n hasSuffix: boolean;\n hasTrailingButton: boolean;\n}): SpacingValueType => {\n if (hasTrailingInteractionElement && (hasSuffix || hasTrailingIcon || hasTrailingButton)) {\n return 'spacing.2';\n }\n\n if (hasTrailingInteractionElement && !hasSuffix && !hasTrailingIcon && !hasTrailingButton) {\n return 'spacing.4';\n }\n\n if (hasLeadingInteractionElement) {\n return 'spacing.3';\n }\n\n return 'spacing.0';\n};\n\nconst getSuffixStyles = ({\n hasTrailingIcon,\n hasSuffix,\n hasTrailingButton,\n}: {\n hasTrailingIcon: boolean;\n hasSuffix: boolean;\n hasTrailingButton: boolean;\n}): Pick<BaseBoxProps, 'paddingRight'> => {\n if (hasSuffix && (hasTrailingIcon || hasTrailingButton)) {\n return {\n paddingRight: 'spacing.3',\n };\n }\n\n if (hasSuffix && !hasTrailingIcon && !hasTrailingButton) {\n return {\n paddingRight: 'spacing.4',\n };\n }\n\n return {\n paddingRight: 'spacing.0',\n };\n};\n\nconst getTrailingIconStyles = ({\n hasTrailingIcon,\n hasTrailingButton,\n}: {\n hasTrailingIcon: boolean;\n hasTrailingButton: boolean;\n}): Pick<BaseBoxProps, 'paddingRight'> => {\n if (hasTrailingIcon && hasTrailingButton) {\n return {\n paddingRight: 'spacing.3',\n };\n }\n\n if (hasTrailingIcon && !hasTrailingButton) {\n return {\n paddingRight: 'spacing.4',\n };\n }\n\n return {\n paddingRight: 'spacing.0',\n };\n};\n\nexport const getInputVisualsToBeRendered = ({\n leadingIcon,\n prefix,\n trailingInteractionElement,\n leadingInteractionElement,\n suffix,\n trailingIcon,\n trailingButton,\n}: InputVisuals) => ({\n hasLeadingIcon: Boolean(leadingIcon),\n hasPrefix: Boolean(prefix),\n hasTrailingInteractionElement: Boolean(trailingInteractionElement),\n hasLeadingInteractionElement: Boolean(leadingInteractionElement),\n hasSuffix: Boolean(suffix),\n hasTrailingIcon: Boolean(trailingIcon),\n hasTrailingButton: Boolean(trailingButton),\n});\n\nconst getTooltipContent = ({\n validationState,\n errorText,\n successText,\n}: {\n validationState: BaseInputProps['validationState'];\n errorText: BaseInputProps['errorText'];\n successText: BaseInputProps['errorText'];\n}): string => {\n if (validationState === 'error' && errorText) {\n return errorText;\n }\n\n if (validationState === 'success' && successText) {\n return successText;\n }\n\n return '';\n};\n\nconst ValidationIconTooltip = ({\n children,\n validationState,\n errorText,\n successText,\n showHintsAsTooltip,\n}: {\n children: ReactElement;\n validationState: BaseInputProps['validationState'];\n errorText: BaseInputProps['errorText'];\n successText: BaseInputProps['errorText'];\n showHintsAsTooltip: BaseInputProps['showHintsAsTooltip'];\n}) => {\n if (\n (showHintsAsTooltip && validationState === 'error' && errorText) ||\n (validationState === 'success' && successText)\n ) {\n return (\n <Tooltip content={getTooltipContent({ validationState, errorText, successText })}>\n <Box display=\"flex\" justifyContent=\"center\" alignItems=\"center\">\n {children}\n </Box>\n </Tooltip>\n );\n }\n\n return children;\n};\n\nexport const BaseInputVisuals = ({\n leadingIcon: LeadingIcon,\n prefix,\n trailingInteractionElement,\n leadingInteractionElement,\n suffix,\n trailingIcon: TrailingIcon,\n isDisabled,\n validationState = 'none',\n size,\n showHintsAsTooltip,\n errorText,\n successText,\n trailingButton: TrailingButton,\n}: InputVisuals): ReactElement | null => {\n const {\n hasLeadingIcon,\n hasPrefix,\n hasSuffix,\n hasTrailingInteractionElement,\n hasLeadingInteractionElement,\n hasTrailingIcon,\n hasTrailingButton,\n } = getInputVisualsToBeRendered({\n leadingIcon: LeadingIcon,\n prefix,\n leadingInteractionElement,\n trailingInteractionElement,\n suffix,\n trailingIcon: TrailingIcon,\n trailingButton: TrailingButton,\n size,\n });\n\n const hasLeadingVisuals = hasLeadingInteractionElement || hasLeadingIcon || hasPrefix;\n const hasTrailingVisuals =\n hasTrailingInteractionElement || hasSuffix || hasTrailingIcon || hasTrailingButton;\n\n if (__DEV__) {\n if (hasTrailingButton && !isValidAllowedChildren(TrailingButton, 'Link')) {\n throwBladeError({\n message: 'trailingButton must be a valid Blade Link component',\n moduleName: 'BaseInput',\n });\n }\n }\n\n if (hasLeadingVisuals) {\n return (\n <BaseBox {...getVisualContainerStyles()}>\n {hasLeadingInteractionElement ? (\n <BaseBox\n paddingLeft={getInteractionElementStyles({\n hasTrailingIcon,\n hasLeadingInteractionElement,\n hasSuffix,\n hasTrailingButton,\n })}\n display=\"flex\"\n alignItems=\"stretch\"\n alignSelf=\"stretch\"\n >\n {leadingInteractionElement}\n </BaseBox>\n ) : null}\n {LeadingIcon ? (\n <BaseBox paddingLeft=\"spacing.4\" display=\"flex\">\n <LeadingIcon\n size={iconSize[size]}\n color={isDisabled ? 'surface.icon.gray.disabled' : 'surface.icon.gray.muted'}\n />\n </BaseBox>\n ) : null}\n {hasPrefix ? (\n <BaseBox {...getPrefixStyles({ hasLeadingIcon, hasPrefix })}>\n <Text\n size={textSize[size]}\n variant=\"body\"\n weight=\"regular\"\n color={isDisabled ? 'surface.text.gray.disabled' : 'surface.text.gray.subtle'}\n >\n {prefix}\n </Text>\n </BaseBox>\n ) : null}\n </BaseBox>\n );\n }\n\n if (hasTrailingVisuals) {\n return (\n <BaseBox alignSelf=\"stretch\" alignItems=\"stretch\" {...getVisualContainerStyles()}>\n {hasTrailingInteractionElement ? (\n <BaseBox\n paddingRight={getInteractionElementStyles({\n hasTrailingIcon,\n hasTrailingInteractionElement,\n hasSuffix,\n hasTrailingButton,\n })}\n display=\"flex\"\n alignItems=\"stretch\"\n alignSelf=\"stretch\"\n >\n {trailingInteractionElement}\n </BaseBox>\n ) : null}\n {hasSuffix ? (\n <BaseBox {...getSuffixStyles({ hasTrailingIcon, hasSuffix, hasTrailingButton })}>\n <Text\n size={textSize[size]}\n variant=\"body\"\n weight=\"regular\"\n color={isDisabled ? 'surface.text.gray.disabled' : 'surface.text.gray.subtle'}\n >\n {suffix}\n </Text>\n </BaseBox>\n ) : null}\n {TrailingIcon ? (\n <BaseBox\n display=\"flex\"\n justifyContent=\"center\"\n alignItems=\"center\"\n {...getTrailingIconStyles({ hasTrailingIcon, hasTrailingButton })}\n >\n <ValidationIconTooltip\n showHintsAsTooltip={showHintsAsTooltip}\n errorText={errorText}\n successText={successText}\n validationState={validationState}\n >\n <TrailingIcon\n size={iconSize[size]}\n color={\n isDisabled ? 'interactive.icon.gray.disabled' : trailingIconColor[validationState]\n }\n />\n </ValidationIconTooltip>\n </BaseBox>\n ) : null}\n {TrailingButton ? (\n <BaseBox paddingRight=\"spacing.4\" display=\"flex\">\n {React.cloneElement(TrailingButton, {\n size,\n variant: 'button',\n isDisabled,\n })}\n </BaseBox>\n ) : null}\n </BaseBox>\n );\n }\n\n return null;\n};\n"],"names":["getVisualContainerStyles","display","flexDirection","alignItems","alignSelf","trailingIconColor","none","error","success","iconSize","medium","large","textSize","getPrefixStyles","_ref","hasLeadingIcon","hasPrefix","paddingLeft","getInteractionElementStyles","_ref2","hasTrailingIcon","hasLeadingInteractionElement","hasTrailingInteractionElement","hasSuffix","hasTrailingButton","getSuffixStyles","_ref3","paddingRight","getTrailingIconStyles","_ref4","getInputVisualsToBeRendered","_ref5","leadingIcon","prefix","trailingInteractionElement","leadingInteractionElement","suffix","trailingIcon","trailingButton","Boolean","getTooltipContent","_ref6","validationState","errorText","successText","ValidationIconTooltip","_ref7","children","showHintsAsTooltip","_jsx","Tooltip","content","Box","justifyContent","BaseInputVisuals","_ref8","LeadingIcon","TrailingIcon","isDisabled","_ref8$validationState","size","TrailingButton","_getInputVisualsToBeR","hasLeadingVisuals","hasTrailingVisuals","__DEV__","isValidAllowedChildren","throwBladeError","message","moduleName","_jsxs","BaseBox","Object","assign","color","Text","variant","weight","React","cloneElement"],"mappings":";;;;;;;;;;;;;;;;;;AAgCA,IAAMA,wBAAwB,CAAG,SAA3BA,wBAAwBA,EAAA,CAAA,OAGxB,CACJC,OAAO,CAAE,MAAM,CACfC,aAAa,CAAE,KAAK,CACpBC,UAAU,CAAE,QAAQ,CACpBC,SAAS,CAAE,QACb,CAAC,CAAC,CAAA,CAEF,IAAMC,iBAAmF,CAAG,CAC1FC,IAAI,CAAE,0BAA0B,CAChCC,KAAK,CAAE,gCAAgC,CACvCC,OAAO,CAAE,gCACX,CAAC,CAED,IAAMC,QAAQ,CAAG,CACfC,MAAM,CAAE,QAAQ,CAChBC,KAAK,CAAE,OACT,CAAU,CAEV,IAAMC,QAAQ,CAAG,CACfF,MAAM,CAAE,QAAQ,CAChBC,KAAK,CAAE,OACT,CAAU,CAEV,IAAME,eAAe,CAAG,SAAlBA,eAAeA,CAAAC,IAAA,CAMoB,CALvC,IAAAC,cAAc,CAAAD,IAAA,CAAdC,cAAc,CACdC,SAAS,CAAAF,IAAA,CAATE,SAAS,CAKT,GAAIA,SAAS,EAAID,cAAc,CAAE,CAC/B,OAAO,CACLE,WAAW,CAAE,WACf,CAAC,CACH,CAEA,GAAID,SAAS,EAAI,CAACD,cAAc,CAAE,CAChC,OAAO,CACLE,WAAW,CAAE,WACf,CAAC,CACH,CAEA,OAAO,CACLA,WAAW,CAAE,WACf,CAAC,CACH,CAAC,CAED,IAAMC,2BAA2B,CAAG,SAA9BA,2BAA2BA,CAAAC,KAAA,CAYT,CA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A,SAAU,CACrBC,WAAW,CAAEA,WAAY,CACzBF,eAAe,CAAEA,eAAgB,CAAAK,QAAA,CAEjCE,GAAA,CAACQ,YAAY,CACXG,CAAAA,IAAI,CAAEnD,QAAQ,CAACmD,IAAI,CAAE,CACrBc,KAAK,CACHhB,UAAU,CAAG,gCAAgC,CAAGrD,iBAAiB,CAACqC,eAAe,CAClF,CACF,CAAC,CACmB,CAAC,CACjB,CAAA,CAAC,CACR,IAAI,CACPmB,cAAc,CACbZ,GAAA,CAACsB,OAAO,CAAA,CAAC5C,YAAY,CAAC,WAAW,CAAC1B,OAAO,CAAC,MAAM,CAAA8C,QAAA,CAC7C+B,cAAK,CAACC,YAAY,CAAClB,cAAc,CAAE,CAClCD,IAAI,CAAJA,IAAI,CACJgB,OAAO,CAAE,QAAQ,CACjBlB,UAAU,CAAVA,UACF,CAAC,CAAC,CACK,CAAC,CACR,IAAI,GACD,CAAC,CAEd,CAEA,OAAO,IAAI,CACb;;;;"}
1
+ {"version":3,"file":"BaseInputVisuals.js","sources":["../../../../../../src/components/Input/BaseInput/BaseInputVisuals.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/explicit-function-return-type */\nimport React from 'react';\nimport type { ReactElement } from 'react';\nimport type { BaseInputProps } from './BaseInput';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Text } from '~components/Typography';\nimport type { BaseBoxProps, SpacingValueType } from '~components/Box/BaseBox';\nimport type { IconColors } from '~components/Icons';\nimport { isValidAllowedChildren } from '~utils/isValidAllowedChildren';\nimport { throwBladeError } from '~utils/logger';\nimport { Tooltip } from '~components/Tooltip';\nimport { Box } from '~components/Box';\nimport { isReactNative } from '~utils';\n\ntype InputVisuals = Pick<\n BaseInputProps,\n | 'leadingIcon'\n | 'prefix'\n | 'trailingInteractionElement'\n | 'onTrailingInteractionElementClick'\n | 'leadingInteractionElement'\n | 'suffix'\n | 'trailingIcon'\n | 'isDisabled'\n | 'validationState'\n | 'size'\n | 'trailingButton'\n | 'showHintsAsTooltip'\n | 'errorText'\n | 'successText'\n> & {\n size: NonNullable<BaseInputProps['size']>;\n};\n\nconst getVisualContainerStyles = ({\n shouldStretchTrailingBox,\n}: {\n shouldStretchTrailingBox?: boolean;\n} = {}): Pick<BaseBoxProps, 'display' | 'flexDirection' | 'alignItems' | 'alignSelf'> => ({\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n alignSelf: shouldStretchTrailingBox ? 'stretch' : 'center',\n});\n\nconst trailingIconColor: Record<NonNullable<InputVisuals['validationState']>, IconColors> = {\n none: 'surface.icon.gray.subtle',\n error: 'feedback.icon.negative.intense',\n success: 'feedback.icon.positive.intense',\n};\n\nconst iconSize = {\n medium: 'medium',\n large: 'large',\n} as const;\n\nconst textSize = {\n medium: 'medium',\n large: 'large',\n} as const;\n\nconst getPrefixStyles = ({\n hasLeadingIcon,\n hasPrefix,\n}: {\n hasLeadingIcon: boolean;\n hasPrefix: boolean;\n}): Pick<BaseBoxProps, 'paddingLeft'> => {\n if (hasPrefix && hasLeadingIcon) {\n return {\n paddingLeft: 'spacing.3',\n };\n }\n\n if (hasPrefix && !hasLeadingIcon) {\n return {\n paddingLeft: 'spacing.4',\n };\n }\n\n return {\n paddingLeft: 'spacing.0',\n };\n};\n\nconst getInteractionElementStyles = ({\n hasTrailingIcon,\n hasLeadingInteractionElement,\n hasTrailingInteractionElement,\n hasSuffix,\n hasTrailingButton,\n}: {\n hasTrailingIcon: boolean;\n hasLeadingInteractionElement?: boolean;\n hasTrailingInteractionElement?: boolean;\n hasSuffix: boolean;\n hasTrailingButton: boolean;\n}): SpacingValueType => {\n if (hasTrailingInteractionElement && (hasSuffix || hasTrailingIcon || hasTrailingButton)) {\n return 'spacing.2';\n }\n\n if (hasTrailingInteractionElement && !hasSuffix && !hasTrailingIcon && !hasTrailingButton) {\n return 'spacing.4';\n }\n\n if (hasLeadingInteractionElement) {\n return 'spacing.3';\n }\n\n return 'spacing.0';\n};\n\nconst getSuffixStyles = ({\n hasTrailingIcon,\n hasSuffix,\n hasTrailingButton,\n}: {\n hasTrailingIcon: boolean;\n hasSuffix: boolean;\n hasTrailingButton: boolean;\n}): Pick<BaseBoxProps, 'paddingRight'> => {\n if (hasSuffix && (hasTrailingIcon || hasTrailingButton)) {\n return {\n paddingRight: 'spacing.3',\n };\n }\n\n if (hasSuffix && !hasTrailingIcon && !hasTrailingButton) {\n return {\n paddingRight: 'spacing.4',\n };\n }\n\n return {\n paddingRight: 'spacing.0',\n };\n};\n\nconst getTrailingIconStyles = ({\n hasTrailingIcon,\n hasTrailingButton,\n}: {\n hasTrailingIcon: boolean;\n hasTrailingButton: boolean;\n}): Pick<BaseBoxProps, 'paddingRight'> => {\n if (hasTrailingIcon && hasTrailingButton) {\n return {\n paddingRight: 'spacing.3',\n };\n }\n\n if (hasTrailingIcon && !hasTrailingButton) {\n return {\n paddingRight: 'spacing.4',\n };\n }\n\n return {\n paddingRight: 'spacing.0',\n };\n};\n\nexport const getInputVisualsToBeRendered = ({\n leadingIcon,\n prefix,\n trailingInteractionElement,\n leadingInteractionElement,\n suffix,\n trailingIcon,\n trailingButton,\n}: InputVisuals) => ({\n hasLeadingIcon: Boolean(leadingIcon),\n hasPrefix: Boolean(prefix),\n hasTrailingInteractionElement: Boolean(trailingInteractionElement),\n hasLeadingInteractionElement: Boolean(leadingInteractionElement),\n hasSuffix: Boolean(suffix),\n hasTrailingIcon: Boolean(trailingIcon),\n hasTrailingButton: Boolean(trailingButton),\n});\n\nconst getTooltipContent = ({\n validationState,\n errorText,\n successText,\n}: {\n validationState: BaseInputProps['validationState'];\n errorText: BaseInputProps['errorText'];\n successText: BaseInputProps['errorText'];\n}): string => {\n if (validationState === 'error' && errorText) {\n return errorText;\n }\n\n if (validationState === 'success' && successText) {\n return successText;\n }\n\n return '';\n};\n\nconst ValidationIconTooltip = ({\n children,\n validationState,\n errorText,\n successText,\n showHintsAsTooltip,\n}: {\n children: ReactElement;\n validationState: BaseInputProps['validationState'];\n errorText: BaseInputProps['errorText'];\n successText: BaseInputProps['errorText'];\n showHintsAsTooltip: BaseInputProps['showHintsAsTooltip'];\n}) => {\n if (\n (showHintsAsTooltip && validationState === 'error' && errorText) ||\n (validationState === 'success' && successText)\n ) {\n return (\n <Tooltip content={getTooltipContent({ validationState, errorText, successText })}>\n <Box display=\"flex\" justifyContent=\"center\" alignItems=\"center\">\n {children}\n </Box>\n </Tooltip>\n );\n }\n\n return children;\n};\n\nexport const BaseInputVisuals = ({\n leadingIcon: LeadingIcon,\n prefix,\n trailingInteractionElement,\n onTrailingInteractionElementClick,\n leadingInteractionElement,\n suffix,\n trailingIcon: TrailingIcon,\n isDisabled,\n validationState = 'none',\n size,\n showHintsAsTooltip,\n errorText,\n successText,\n trailingButton: TrailingButton,\n}: InputVisuals): ReactElement | null => {\n const {\n hasLeadingIcon,\n hasPrefix,\n hasSuffix,\n hasTrailingInteractionElement,\n hasLeadingInteractionElement,\n hasTrailingIcon,\n hasTrailingButton,\n } = getInputVisualsToBeRendered({\n leadingIcon: LeadingIcon,\n prefix,\n leadingInteractionElement,\n trailingInteractionElement,\n suffix,\n trailingIcon: TrailingIcon,\n trailingButton: TrailingButton,\n size,\n });\n\n const hasLeadingVisuals = hasLeadingInteractionElement || hasLeadingIcon || hasPrefix;\n const hasTrailingVisuals =\n hasTrailingInteractionElement || hasSuffix || hasTrailingIcon || hasTrailingButton;\n\n if (__DEV__) {\n if (hasTrailingButton && !isValidAllowedChildren(TrailingButton, 'Link')) {\n throwBladeError({\n message: 'trailingButton must be a valid Blade Link component',\n moduleName: 'BaseInput',\n });\n }\n }\n\n if (hasLeadingVisuals) {\n return (\n <BaseBox {...getVisualContainerStyles()}>\n {hasLeadingInteractionElement ? (\n <BaseBox\n paddingLeft={getInteractionElementStyles({\n hasTrailingIcon,\n hasLeadingInteractionElement,\n hasSuffix,\n hasTrailingButton,\n })}\n display=\"flex\"\n alignItems=\"stretch\"\n alignSelf=\"stretch\"\n >\n {leadingInteractionElement}\n </BaseBox>\n ) : null}\n {LeadingIcon ? (\n <BaseBox paddingLeft=\"spacing.4\" display=\"flex\">\n <LeadingIcon\n size={iconSize[size]}\n color={isDisabled ? 'surface.icon.gray.disabled' : 'surface.icon.gray.muted'}\n />\n </BaseBox>\n ) : null}\n {hasPrefix ? (\n <BaseBox {...getPrefixStyles({ hasLeadingIcon, hasPrefix })}>\n <Text\n size={textSize[size]}\n variant=\"body\"\n weight=\"regular\"\n color={isDisabled ? 'surface.text.gray.disabled' : 'surface.text.gray.subtle'}\n >\n {prefix}\n </Text>\n </BaseBox>\n ) : null}\n </BaseBox>\n );\n }\n\n if (hasTrailingVisuals) {\n return (\n <BaseBox\n {...getVisualContainerStyles({\n shouldStretchTrailingBox:\n hasTrailingInteractionElement && Boolean(onTrailingInteractionElementClick),\n })}\n >\n {hasTrailingInteractionElement ? (\n <BaseBox\n {...getVisualContainerStyles({\n shouldStretchTrailingBox:\n hasTrailingInteractionElement && Boolean(onTrailingInteractionElementClick),\n })}\n >\n <BaseBox\n paddingRight={getInteractionElementStyles({\n hasTrailingIcon,\n hasTrailingInteractionElement,\n hasSuffix,\n hasTrailingButton,\n })}\n display=\"flex\"\n alignItems=\"stretch\"\n alignSelf=\"stretch\"\n {...(!isReactNative() && { onClick: onTrailingInteractionElementClick })}\n >\n {trailingInteractionElement}\n </BaseBox>\n </BaseBox>\n ) : null}\n {hasSuffix ? (\n <BaseBox {...getSuffixStyles({ hasTrailingIcon, hasSuffix, hasTrailingButton })}>\n <Text\n size={textSize[size]}\n variant=\"body\"\n weight=\"regular\"\n color={isDisabled ? 'surface.text.gray.disabled' : 'surface.text.gray.subtle'}\n >\n {suffix}\n </Text>\n </BaseBox>\n ) : null}\n {TrailingIcon ? (\n <BaseBox\n display=\"flex\"\n justifyContent=\"center\"\n alignItems=\"center\"\n {...getTrailingIconStyles({ hasTrailingIcon, hasTrailingButton })}\n >\n <ValidationIconTooltip\n showHintsAsTooltip={showHintsAsTooltip}\n errorText={errorText}\n successText={successText}\n validationState={validationState}\n >\n <TrailingIcon\n size={iconSize[size]}\n color={\n isDisabled ? 'interactive.icon.gray.disabled' : trailingIconColor[validationState]\n }\n />\n </ValidationIconTooltip>\n </BaseBox>\n ) : null}\n {TrailingButton ? (\n <BaseBox paddingRight=\"spacing.4\" display=\"flex\">\n {React.cloneElement(TrailingButton, {\n size,\n variant: 'button',\n isDisabled,\n })}\n </BaseBox>\n ) : null}\n </BaseBox>\n );\n }\n\n return null;\n};\n"],"names":["getVisualContainerStyles","_ref","arguments","length","undefined","shouldStretchTrailingBox","display","flexDirection","alignItems","alignSelf","trailingIconColor","none","error","success","iconSize","medium","large","textSize","getPrefixStyles","_ref2","hasLeadingIcon","hasPrefix","paddingLeft","getInteractionElementStyles","_ref3","hasTrailingIcon","hasLeadingInteractionElement","hasTrailingInteractionElement","hasSuffix","hasTrailingButton","getSuffixStyles","_ref4","paddingRight","getTrailingIconStyles","_ref5","getInputVisualsToBeRendered","_ref6","leadingIcon","prefix","trailingInteractionElement","leadingInteractionElement","suffix","trailingIcon","trailingButton","Boolean","getTooltipContent","_ref7","validationState","errorText","successText","ValidationIconTooltip","_ref8","children","showHintsAsTooltip","_jsx","Tooltip","content","Box","justifyContent","BaseInputVisuals","_ref9","LeadingIcon","onTrailingInteractionElementClick","TrailingIcon","isDisabled","_ref9$validationState","size","TrailingButton","_getInputVisualsToBeR","hasLeadingVisuals","hasTrailingVisuals","__DEV__","isValidAllowedChildren","throwBladeError","message","moduleName","_jsxs","BaseBox","Object","assign","color","Text","variant","weight","isReactNative","onClick","React","cloneElement"],"mappings":";;;;;;;;;;;;;;;;;;;AAkCA,IAAMA,wBAAwB,CAAG,SAA3BA,wBAAwBA,EAAA,CAAA,IAAAC,IAAA,CAAAC,SAAA,CAAAC,MAAA,CAAA,CAAA,EAAAD,SAAA,CAAAE,CAAAA,CAAAA,GAAAA,SAAA,CAAAF,SAAA,IAI1B,EAAE,CAHJG,wBAAwB,CAAAJ,IAAA,CAAxBI,wBAAwB,CAGgE,OAAA,CACxF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CAAEA,WAAY,CACzBF,eAAe,CAAEA,eAAgB,CAAAK,QAAA,CAEjCE,GAAA,CAACS,YAAY,CAAA,CACXG,IAAI,CAAEpD,QAAQ,CAACoD,IAAI,CAAE,CACrBc,KAAK,CACHhB,UAAU,CAAG,gCAAgC,CAAGtD,iBAAiB,CAACqC,eAAe,CAClF,CACF,CAAC,CACmB,CAAC,CACjB,CAAA,CAAC,CACR,IAAI,CACPoB,cAAc,CACbb,GAAA,CAACuB,OAAO,EAAC7C,YAAY,CAAC,WAAW,CAAC1B,OAAO,CAAC,MAAM,CAAA8C,QAAA,CAC7CkC,cAAK,CAACC,YAAY,CAACpB,cAAc,CAAE,CAClCD,IAAI,CAAJA,IAAI,CACJgB,OAAO,CAAE,QAAQ,CACjBlB,UAAU,CAAVA,UACF,CAAC,CAAC,CACK,CAAC,CACR,IAAI,GACD,CAAC,CAEd,CAEA,OAAO,IAAI,CACb;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"AutoComplete.js","sources":["../../../../../../src/components/Input/DropdownInputTriggers/AutoComplete.tsx"],"sourcesContent":["import React from 'react';\nimport { useDropdown } from '../../Dropdown/useDropdown';\nimport type { AutoCompleteProps, BaseDropdownInputTriggerProps } from './types';\nimport { BaseDropdownInputTrigger } from './BaseDropdownInputTrigger';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { BladeElementRef } from '~utils/types';\nimport { dropdownComponentIds } from '~components/Dropdown/dropdownComponentIds';\nimport { isReactNative } from '~utils';\n\nconst useAutoComplete = ({\n props,\n inputValue,\n setInputValue,\n getOptionValues,\n}: {\n props: AutoCompleteProps;\n setInputValue: (inputValue: string) => void;\n inputValue: string;\n getOptionValues: () => string[];\n}): {\n onTriggerKeydown: BaseDropdownInputTriggerProps['onTriggerKeydown'];\n onSelectionChange: BaseDropdownInputTriggerProps['onChange'];\n onInputValueChange: BaseDropdownInputTriggerProps['onInputValueChange'];\n} => {\n const {\n onTriggerKeydown: onBaseDropdownInputKeydown,\n isOpen,\n setIsOpen,\n selectedIndices,\n setSelectedIndices,\n setControlledValueIndices,\n isControlled,\n options,\n setFilteredValues: setGlobalFilteredValues,\n activeTagIndex,\n setActiveTagIndex,\n setActiveIndex,\n filteredValues: globalFilteredValues,\n selectionType,\n triggererRef,\n hasAutoCompleteInBottomSheetHeader,\n } = useDropdown();\n\n const resetFilters = (): void => setGlobalFilteredValues(getOptionValues());\n\n // Makes sure that first item is always in focus\n React.useEffect((): void => {\n const firstItemOptionIndex = options.findIndex(\n (option) => option.value === globalFilteredValues[0],\n );\n\n if (firstItemOptionIndex >= 0) {\n setActiveIndex(firstItemOptionIndex);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [globalFilteredValues.length, options.length]);\n\n // When input is empty or its single select, we want all items to be shown in filter on open of dropdown\n React.useEffect(() => {\n if (isOpen && !inputValue) {\n resetFilters();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isOpen, options]);\n\n React.useEffect(() => {\n if (isOpen && selectionType === 'single') {\n resetFilters();\n }\n\n // Just setting autoFocus is setting the input in focus state but its not showing keyboard active.\n // We do this in web to get around that\n if (hasAutoCompleteInBottomSheetHeader && isOpen && !isReactNative()) {\n triggererRef.current?.focus();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isOpen]);\n\n const onInputValueChange: BaseDropdownInputTriggerProps['onInputValueChange'] = ({\n name,\n value,\n }) => {\n setInputValue(value ?? '');\n props.onInputValueChange?.({ name, value });\n setActiveTagIndex(-1);\n\n if (!isOpen) {\n setIsOpen(true);\n }\n\n // default filtering when filteredValues is uncontrolled\n if (!props.filteredValues) {\n // eslint-disable-next-line no-lonely-if\n if (value && options && options.length > 0) {\n const filteredOptions = getOptionValues().filter((optionValue) =>\n optionValue.toLowerCase().includes(value.toLowerCase()),\n );\n setGlobalFilteredValues(filteredOptions);\n } else {\n resetFilters();\n }\n }\n };\n\n const onTriggerKeydown: BaseDropdownInputTriggerProps['onTriggerKeydown'] = (e) => {\n // Pressing backspace on empty input should remove the last tag\n if (e.key === 'Backspace' && !inputValue && activeTagIndex < 0 && selectedIndices.length > 0) {\n if (isControlled) {\n setControlledValueIndices(selectedIndices.slice(0, -1));\n } else {\n setSelectedIndices(selectedIndices.slice(0, -1));\n }\n }\n onBaseDropdownInputKeydown?.(e);\n };\n\n const onSelectionChange: BaseDropdownInputTriggerProps['onChange'] = ({ values }) => {\n if (selectionType === 'multiple') {\n setInputValue('');\n props.onInputValueChange?.({ name: props.name, value: '' });\n setActiveTagIndex(-1);\n resetFilters();\n } else {\n const displayText = options.find((option) => option.value === values[0])?.title;\n props.onInputValueChange?.({\n name: props.name,\n value: displayText,\n });\n // Use displayText as inputValue only if its not controlled by user\n if (typeof props.value === 'undefined') {\n setInputValue(displayText ?? '');\n }\n }\n props.onChange?.({ name: props.name, values });\n };\n\n return {\n onSelectionChange,\n onTriggerKeydown,\n onInputValueChange,\n };\n};\n\nconst _AutoComplete = (\n props: AutoCompleteProps,\n ref: React.ForwardedRef<BladeElementRef>,\n): React.ReactElement => {\n const [uncontrolledInputValue, setInputValue] = React.useState('');\n const inputValue = props.inputValue ?? uncontrolledInputValue;\n\n const {\n options,\n setFilteredValues: setGlobalFilteredValues,\n hasAutoCompleteInBottomSheetHeader,\n setHasAutoCompleteInBottomSheetHeader,\n onTriggerClick,\n dropdownTriggerer,\n } = useDropdown();\n\n const getOptionValues = React.useCallback(() => {\n return options.map((option) => option.value);\n }, [options]);\n\n const { onSelectionChange, onTriggerKeydown, onInputValueChange } = useAutoComplete({\n props,\n inputValue,\n setInputValue,\n getOptionValues,\n });\n\n React.useEffect(() => {\n if (dropdownTriggerer !== dropdownComponentIds.triggers.AutoComplete) {\n // When AutoComplete is mounted but not as trigger,\n // it has to be somewhere in the BottomSheet (most likely header based on UI but works in other parts too)\n setHasAutoCompleteInBottomSheetHeader(true);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // handles controlled filteredValues state (syncs it with our global filteredValues)\n React.useEffect(() => {\n if (props.filteredValues) {\n setGlobalFilteredValues(props.filteredValues);\n }\n }, [props.filteredValues, setGlobalFilteredValues]);\n\n // set autoFocus to true when used inside bottomsheet\n const defaultAutoFocusState = hasAutoCompleteInBottomSheetHeader ? true : undefined;\n\n return (\n <BaseBox position=\"relative\">\n <BaseDropdownInputTrigger\n {...props}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={props.autoFocus ?? defaultAutoFocusState}\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref={ref as any}\n onChange={onSelectionChange}\n isSelectInput={false}\n inputValue={inputValue}\n syncInputValueWithSelection={(value) => {\n if (!value) {\n setInputValue('');\n return;\n }\n const selectedOption = options.find((option) => option.value === value);\n setInputValue(selectedOption?.title ?? '');\n }}\n onTriggerKeydown={onTriggerKeydown}\n onInputValueChange={onInputValueChange}\n onTriggerClick={(triggerEvent) => {\n if (!hasAutoCompleteInBottomSheetHeader) {\n // we don't want clicking on autocomplete to open / close Dropdown when it is used inside BottomSheet's header\n onTriggerClick();\n }\n props?.onClick?.(triggerEvent);\n }}\n />\n </BaseBox>\n );\n};\n\n/**\n * ### AutoComplete\n *\n * Extension on top of SelectInput which allows you type and filter between ActionList items\n *\n * To be used in combination of `Dropdown` and `ActionList` component\n *\n * ---\n *\n * #### Usage in Desktop\n *\n * ```diff\n * <Dropdown>\n * + <AutoComplete label=\"Select Fruits\" />\n * <DropdownOverlay>\n * <ActionList>\n * <ActionListItem title=\"Mango\" value=\"mango\" />\n * <ActionListItem title=\"Apple\" value=\"apple\" />\n * </ActionList>\n * </DropdownOverlay>\n * </Dropdown>\n * ```\n *\n * #### Usage in Mobile\n *\n * ```diff\n * <Dropdown>\n * + <SelectInput label=\"Select Fruits\" />\n * <BottomSheet>\n * <BottomSheetHeader>\n * + <AutoComplete label=\"Select Fruits\" />\n * </BottomSheetHeader>\n * <BottomSheetBody>\n * <ActionList>\n * <ActionListItem title=\"Mango\" value=\"mango\" />\n * <ActionListItem title=\"Apple\" value=\"apple\" />\n * </ActionList>\n * </BottomSheetBody>\n * </BottomSheet>\n * </Dropdown>\n * ```\n *\n * ---\n *\n * Checkout {@link https://blade.razorpay.com/?path=/docs/components-dropdown-with-autocomplete--with-single-select AutoComplete Documentation}.\n */\nconst AutoComplete = assignWithoutSideEffects(React.forwardRef(_AutoComplete), {\n componentId: dropdownComponentIds.triggers.AutoComplete,\n});\n\nexport { AutoComplete };\n"],"names":["useAutoComplete","_ref","props","inputValue","setInputValue","getOptionValues","_useDropdown","useDropdown","onBaseDropdownInputKeydown","onTriggerKeydown","isOpen","setIsOpen","selectedIndices","setSelectedIndices","setControlledValueIndices","isControlled","options","setGlobalFilteredValues","setFilteredValues","activeTagIndex","setActiveTagIndex","setActiveIndex","globalFilteredValues","filteredValues","selectionType","triggererRef","hasAutoCompleteInBottomSheetHeader","resetFilters","React","useEffect","firstItemOptionIndex","findIndex","option","value","length","isReactNative","_triggererRef$current","current","focus","onInputValueChange","_ref2","name","filteredOptions","filter","optionValue","toLowerCase","includes","e","key","slice","onSelectionChange","_ref3","values","_options$find","displayText","find","title","onChange","_AutoComplete","ref","_props$inputValue","_props$autoFocus","_React$useState","useState","_React$useState2","_slicedToArray","uncontrolledInputValue","_useDropdown2","setHasAutoCompleteInBottomSheetHeader","onTriggerClick","dropdownTriggerer","useCallback","map","_useAutoComplete","dropdownComponentIds","triggers","AutoComplete","defaultAutoFocusState","undefined","_jsx","BaseBox","position","children","BaseDropdownInputTrigger","Object","assign","autoFocus","isSelectInput","syncInputValueWithSelection","_selectedOption$title","selectedOption","triggerEvent","onClick","assignWithoutSideEffects","forwardRef","componentId"],"mappings":";;;;;;;;;;;;AAUA,IAAMA,eAAe,CAAG,SAAlBA,eAAeA,CAAAC,IAAA,CAchB,CAbH,IAAAC,KAAK,CAAAD,IAAA,CAALC,KAAK,CACLC,UAAU,CAAAF,IAAA,CAAVE,UAAU,CACVC,aAAa,CAAAH,IA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,CACK,CAAC,CAEd,CAAC,CAgDK,IAAAf,YAAY,CAAGiB,wBAAwB,CAACjE,cAAK,CAACkE,UAAU,CAACpC,aAAa,CAAC,CAAE,CAC7EqC,WAAW,CAAErB,oBAAoB,CAACC,QAAQ,CAACC,YAC7C,CAAC;;;;"}
1
+ {"version":3,"file":"AutoComplete.js","sources":["../../../../../../src/components/Input/DropdownInputTriggers/AutoComplete.tsx"],"sourcesContent":["import React from 'react';\nimport { useDropdown } from '../../Dropdown/useDropdown';\nimport type { AutoCompleteProps, BaseDropdownInputTriggerProps } from './types';\nimport { BaseDropdownInputTrigger } from './BaseDropdownInputTrigger';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { BladeElementRef } from '~utils/types';\nimport { dropdownComponentIds } from '~components/Dropdown/dropdownComponentIds';\nimport { isReactNative } from '~utils';\n\nconst useAutoComplete = ({\n props,\n inputValue,\n setInputValue,\n getOptionValues,\n}: {\n props: AutoCompleteProps;\n setInputValue: (inputValue: string) => void;\n inputValue: string;\n getOptionValues: () => string[];\n}): {\n onTriggerKeydown: BaseDropdownInputTriggerProps['onTriggerKeydown'];\n onSelectionChange: BaseDropdownInputTriggerProps['onChange'];\n onInputValueChange: BaseDropdownInputTriggerProps['onInputValueChange'];\n} => {\n const {\n onTriggerKeydown: onBaseDropdownInputKeydown,\n isOpen,\n setIsOpen,\n selectedIndices,\n setSelectedIndices,\n setControlledValueIndices,\n isControlled,\n options,\n setFilteredValues: setGlobalFilteredValues,\n activeTagIndex,\n setActiveTagIndex,\n setActiveIndex,\n filteredValues: globalFilteredValues,\n selectionType,\n triggererRef,\n hasAutoCompleteInBottomSheetHeader,\n } = useDropdown();\n\n const resetFilters = (): void => setGlobalFilteredValues(getOptionValues());\n\n // Makes sure that first item is always in focus\n React.useEffect((): void => {\n const firstItemOptionIndex = options.findIndex(\n (option) => option.value === globalFilteredValues[0],\n );\n\n if (firstItemOptionIndex >= 0) {\n setActiveIndex(firstItemOptionIndex);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [globalFilteredValues.length, options.length]);\n\n // When input is empty or its single select, we want all items to be shown in filter on open of dropdown\n React.useEffect(() => {\n if (isOpen && !inputValue) {\n resetFilters();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isOpen, options]);\n\n React.useEffect(() => {\n if (isOpen && selectionType === 'single') {\n resetFilters();\n }\n\n // Just setting autoFocus is setting the input in focus state but its not showing keyboard active.\n // We do this in web to get around that\n if (hasAutoCompleteInBottomSheetHeader && isOpen && !isReactNative()) {\n triggererRef.current?.focus();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isOpen]);\n\n const onInputValueChange: BaseDropdownInputTriggerProps['onInputValueChange'] = ({\n name,\n value,\n }) => {\n setInputValue(value ?? '');\n props.onInputValueChange?.({ name, value });\n setActiveTagIndex(-1);\n\n if (!isOpen) {\n setIsOpen(true);\n }\n\n // default filtering when filteredValues is uncontrolled\n if (!props.filteredValues) {\n // eslint-disable-next-line no-lonely-if\n if (value && options && options.length > 0) {\n const filteredOptions = getOptionValues().filter((optionValue) =>\n optionValue.toLowerCase().includes(value.toLowerCase()),\n );\n setGlobalFilteredValues(filteredOptions);\n } else {\n resetFilters();\n }\n }\n };\n\n const onTriggerKeydown: BaseDropdownInputTriggerProps['onTriggerKeydown'] = (e) => {\n // Pressing backspace on empty input should remove the last tag\n if (e.key === 'Backspace' && !inputValue && activeTagIndex < 0 && selectedIndices.length > 0) {\n if (isControlled) {\n setControlledValueIndices(selectedIndices.slice(0, -1));\n } else {\n setSelectedIndices(selectedIndices.slice(0, -1));\n }\n }\n onBaseDropdownInputKeydown?.(e);\n };\n\n const onSelectionChange: BaseDropdownInputTriggerProps['onChange'] = ({ values }) => {\n if (selectionType === 'multiple') {\n setInputValue('');\n props.onInputValueChange?.({ name: props.name, value: '' });\n setActiveTagIndex(-1);\n resetFilters();\n } else {\n const displayText = options.find((option) => option.value === values[0])?.title;\n props.onInputValueChange?.({\n name: props.name,\n value: displayText,\n });\n // Use displayText as inputValue only if its not controlled by user\n if (typeof props.value === 'undefined') {\n setInputValue(displayText ?? '');\n }\n }\n props.onChange?.({ name: props.name, values });\n };\n return {\n onSelectionChange,\n onTriggerKeydown,\n onInputValueChange,\n };\n};\n\nconst _AutoComplete = (\n props: AutoCompleteProps,\n ref: React.ForwardedRef<BladeElementRef>,\n): React.ReactElement => {\n const [uncontrolledInputValue, setInputValue] = React.useState('');\n const inputValue = props.inputValue ?? uncontrolledInputValue;\n\n const {\n options,\n setFilteredValues: setGlobalFilteredValues,\n hasAutoCompleteInBottomSheetHeader,\n setHasAutoCompleteInBottomSheetHeader,\n onTriggerClick,\n dropdownTriggerer,\n } = useDropdown();\n\n const getOptionValues = React.useCallback(() => {\n return options.map((option) => option.value);\n }, [options]);\n\n const { onSelectionChange, onTriggerKeydown, onInputValueChange } = useAutoComplete({\n props,\n inputValue,\n setInputValue,\n getOptionValues,\n });\n\n React.useEffect(() => {\n if (dropdownTriggerer !== dropdownComponentIds.triggers.AutoComplete) {\n // When AutoComplete is mounted but not as trigger,\n // it has to be somewhere in the BottomSheet (most likely header based on UI but works in other parts too)\n setHasAutoCompleteInBottomSheetHeader(true);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // handles controlled filteredValues state (syncs it with our global filteredValues)\n React.useEffect(() => {\n if (props.filteredValues) {\n setGlobalFilteredValues(props.filteredValues);\n }\n }, [props.filteredValues, setGlobalFilteredValues]);\n\n // set autoFocus to true when used inside bottomsheet\n const defaultAutoFocusState = hasAutoCompleteInBottomSheetHeader ? true : undefined;\n\n return (\n <BaseBox position=\"relative\">\n <BaseDropdownInputTrigger\n {...props}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={props.autoFocus ?? defaultAutoFocusState}\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref={ref as any}\n onChange={onSelectionChange}\n isSelectInput={false}\n inputValue={inputValue}\n syncInputValueWithSelection={(value) => {\n if (!value) {\n setInputValue('');\n return;\n }\n const selectedOption = options.find((option) => option.value === value);\n setInputValue(selectedOption?.title ?? '');\n }}\n onTriggerKeydown={onTriggerKeydown}\n onInputValueChange={onInputValueChange}\n onTriggerClick={(triggerEvent) => {\n if (!hasAutoCompleteInBottomSheetHeader) {\n // we don't want clicking on autocomplete to open / close Dropdown when it is used inside BottomSheet's header\n onTriggerClick();\n }\n props?.onClick?.(triggerEvent);\n }}\n />\n </BaseBox>\n );\n};\n\n/**\n * ### AutoComplete\n *\n * Extension on top of SelectInput which allows you type and filter between ActionList items\n *\n * To be used in combination of `Dropdown` and `ActionList` component\n *\n * ---\n *\n * #### Usage in Desktop\n *\n * ```diff\n * <Dropdown>\n * + <AutoComplete label=\"Select Fruits\" />\n * <DropdownOverlay>\n * <ActionList>\n * <ActionListItem title=\"Mango\" value=\"mango\" />\n * <ActionListItem title=\"Apple\" value=\"apple\" />\n * </ActionList>\n * </DropdownOverlay>\n * </Dropdown>\n * ```\n *\n * #### Usage in Mobile\n *\n * ```diff\n * <Dropdown>\n * + <SelectInput label=\"Select Fruits\" />\n * <BottomSheet>\n * <BottomSheetHeader>\n * + <AutoComplete label=\"Select Fruits\" />\n * </BottomSheetHeader>\n * <BottomSheetBody>\n * <ActionList>\n * <ActionListItem title=\"Mango\" value=\"mango\" />\n * <ActionListItem title=\"Apple\" value=\"apple\" />\n * </ActionList>\n * </BottomSheetBody>\n * </BottomSheet>\n * </Dropdown>\n * ```\n *\n * ---\n *\n * Checkout {@link https://blade.razorpay.com/?path=/docs/components-dropdown-with-autocomplete--with-single-select AutoComplete Documentation}.\n */\nconst AutoComplete = assignWithoutSideEffects(React.forwardRef(_AutoComplete), {\n componentId: dropdownComponentIds.triggers.AutoComplete,\n});\n\nexport { AutoComplete };\n"],"names":["useAutoComplete","_ref","props","inputValue","setInputValue","getOptionValues","_useDropdown","useDropdown","onBaseDropdownInputKeydown","onTriggerKeydown","isOpen","setIsOpen","selectedIndices","setSelectedIndices","setControlledValueIndices","isControlled","options","setGlobalFilteredValues","setFilteredValues","activeTagIndex","setActiveTagIndex","setActiveIndex","globalFilteredValues","filteredValues","selectionType","triggererRef","hasAutoCompleteInBottomSheetHeader","resetFilters","React","useEffect","firstItemOptionIndex","findIndex","option","value","length","isReactNative","_triggererRef$current","current","focus","onInputValueChange","_ref2","name","filteredOptions","filter","optionValue","toLowerCase","includes","e","key","slice","onSelectionChange","_ref3","values","_options$find","displayText","find","title","onChange","_AutoComplete","ref","_props$inputValue","_props$autoFocus","_React$useState","useState","_React$useState2","_slicedToArray","uncontrolledInputValue","_useDropdown2","setHasAutoCompleteInBottomSheetHeader","onTriggerClick","dropdownTriggerer","useCallback","map","_useAutoComplete","dropdownComponentIds","triggers","AutoComplete","defaultAutoFocusState","undefined","_jsx","BaseBox","position","children","BaseDropdownInputTrigger","Object","assign","autoFocus","isSelectInput","syncInputValueWithSelection","_selectedOption$title","selectedOption","triggerEvent","onClick","assignWithoutSideEffects","forwardRef","componentId"],"mappings":";;;;;;;;;;;;AAUA,IAAMA,eAAe,CAAG,SAAlBA,eAAeA,CAAAC,IAAA,CAchB,CAbH,IAAAC,KAAK,CAAAD,IAAA,CAALC,KAAK,CACLC,UAAU,CAAAF,IAAA,CAAVE,UAAU,CACVC,aAAa,CAAAH,IAAA,CAAbG,aAAa,CACbC,eAAe,CAAAJ,IAAA,CAAfI,eAAe,CAWf,IAAAC,YAAA,CAiBIC,WAAW,EAAE,CAhBGC,0BAA0B,CAAAF,YAAA,CAA5CG,gBAAgB,CAChBC,MAAM,CAAAJ,YAAA,CAANI,MAAM,CACNC,SAAS,CAAAL,YAAA,CAATK,SAAS,CACTC,eAAe,CAAAN,YAAA,CAAfM,eAAe,CACfC,kBAAkB,CAAAP,YAAA,CAAlBO,kBAAkB,CAClBC,yBAAyB,CAAAR,YAAA,CAAzBQ,yBAAyB,CACzBC,YAAY,CAAAT,YAAA,CAAZS,YAAY,CACZC,OAAO,CAAA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AAU,CAAEA,UAAW,CACvBqF,2BAA2B,CAAE,SAAAA,4BAACvD,KAAK,CAAK,CAAAwD,IAAAA,qBAAA,CACtC,GAAI,CAACxD,KAAK,CAAE,CACV7B,aAAa,CAAC,EAAE,CAAC,CACjB,OACF,CACA,IAAMsF,cAAc,CAAG1E,OAAO,CAACuC,IAAI,CAAC,SAACvB,MAAM,CAAA,CAAA,OAAKA,MAAM,CAACC,KAAK,GAAKA,KAAK,GAAC,CACvE7B,aAAa,CAAAqF,CAAAA,qBAAA,CAACC,cAAc,EAAdA,IAAAA,CAAAA,KAAAA,CAAAA,CAAAA,cAAc,CAAElC,KAAK,GAAA,IAAA,CAAAiC,qBAAA,CAAI,EAAE,CAAC,CAC5C,CAAE,CACFhF,gBAAgB,CAAEA,gBAAiB,CACnC8B,kBAAkB,CAAEA,kBAAmB,CACvC8B,cAAc,CAAE,SAAAA,cAAAA,CAACsB,YAAY,CAAK,CAChC,GAAI,CAACjE,kCAAkC,CAAE,CAEvC2C,eAAc,EAAE,CAClB,CACAnE,KAAK,EAALA,IAAAA,CAAAA,KAAAA,CAAAA,CAAAA,KAAK,CAAE0F,OAAO,EAAd1F,IAAAA,CAAAA,KAAAA,CAAAA,CAAAA,KAAK,CAAE0F,OAAO,CAAGD,YAAY,CAAC,CAChC,CAAE,CACH,CAAA,CAAC,CACK,CAAC,CAEd,CAAC,CAgDK,IAAAf,YAAY,CAAGiB,wBAAwB,CAACjE,cAAK,CAACkE,UAAU,CAACpC,aAAa,CAAC,CAAE,CAC7EqC,WAAW,CAAErB,oBAAoB,CAACC,QAAQ,CAACC,YAC7C,CAAC;;;;"}
@@ -6,6 +6,7 @@ import { useDropdown } from '../../Dropdown/useDropdown.js';
6
6
  import 'react-native';
7
7
  import '@babel/runtime/helpers/slicedToArray';
8
8
  import { isReactNative } from '../../../utils/platform/isReactNative.js';
9
+ import { isBrowser } from '../../../utils/platform/isBrowser.js';
9
10
  import '../../BladeProvider/useTheme.js';
10
11
  import { getActionListContainerRole } from '../../ActionList/getA11yRoles.js';
11
12
  import '@babel/runtime/helpers/defineProperty';
@@ -15,9 +16,10 @@ import { useFirstRender } from '../../../utils/useFirstRender.js';
15
16
  import { useTableContext } from '../../Table/TableContext.js';
16
17
  import { rowDensityToIsTableInputCellMapping, tableEditableCellRowDensityToInputSizeMap, validationStateToInputTrailingIconMap } from '../../Table/tokens.js';
17
18
  import { useTableEditableCell } from '../../Table/TableEditableCellContext.js';
19
+ import { fireNativeEvent } from '../../../utils/fireNativeEvent/fireNativeEvent.native.js';
18
20
  import { jsx } from 'react/jsx-runtime';
19
21
 
20
- 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()});}},[changeCallbackTriggerer]);};var _BaseDropdownInputTrigger=function _BaseDropdownInputTrigger(props,ref){var _props$placeholder,_props$validationStat,_props$maxRows,_props$label;var _useDropdown2=useDropdown(),isOpen=_useDropdown2.isOpen,activeTagIndex=_useDropdown2.activeTagIndex,setActiveTagIndex=_useDropdown2.setActiveTagIndex,displayValue=_useDropdown2.displayValue,selectionType=_useDropdown2.selectionType,dropdownTriggerer=_useDropdown2.dropdownTriggerer,dropdownBaseId=_useDropdown2.dropdownBaseId,selectedIndices=_useDropdown2.selectedIndices,triggererRef=_useDropdown2.triggererRef,triggererWrapperRef=_useDropdown2.triggererWrapperRef,isTagDismissedRef=_useDropdown2.isTagDismissedRef,onTriggerClick=_useDropdown2.onTriggerClick,value=_useDropdown2.value,shouldIgnoreBlurAnimation=_useDropdown2.shouldIgnoreBlurAnimation,setShouldIgnoreBlurAnimation=_useDropdown2.setShouldIgnoreBlurAnimation,activeIndex=_useDropdown2.activeIndex,hasFooterAction=_useDropdown2.hasFooterAction,hasAutoCompleteInBottomSheetHeader=_useDropdown2.hasAutoCompleteInBottomSheetHeader,options=_useDropdown2.options,removeOption=_useDropdown2.removeOption,setChangeCallbackTriggerer=_useDropdown2.setChangeCallbackTriggerer,changeCallbackTriggerer=_useDropdown2.changeCallbackTriggerer;var _useTableContext=useTableContext(),rowDensity=_useTableContext.rowDensity;var _useTableEditableCell=useTableEditableCell(),isInsideTableEditableCell=_useTableEditableCell.isInsideTableEditableCell;var dropdownTriggerPlaceholder=(_props$placeholder=props.placeholder)!=null?_props$placeholder:'Select Option';var isAutoCompleteInHeader=!props.isSelectInput&&hasAutoCompleteInBottomSheetHeader;var getShowAllTags=React__default.useCallback(function(){if(hasAutoCompleteInBottomSheetHeader){if(props.isSelectInput){return false;}return true;}return isOpen;},[hasAutoCompleteInBottomSheetHeader,props.isSelectInput,isOpen]);useControlledDropdownInput({onChange:props.onChange,name:props.name,value:props.value,defaultValue:props.defaultValue,syncInputValueWithSelection:props.syncInputValueWithSelection,isSelectInput:props.isSelectInput});var getValue=function getValue(){var prefix='';if(props.labelPosition==='inside-input'&&props.label){prefix=`${props.label}: `;}if(props.isSelectInput){if(selectionType==='single'){return `${prefix}${displayValue}`;}return undefined;}return props.inputValue;};var getTags=React__default.useMemo(function(){return function(_ref){var size=_ref.size;if(selectionType==='single'){return undefined;}return getTagsGroup({size:size,tags:selectedIndices.map(function(selectedIndex){var _options$selectedInde;return (_options$selectedInde=options[selectedIndex])==null?void 0:_options$selectedInde.title;}),activeTagIndex:activeTagIndex,isDisabled:props.isDisabled,onDismiss:function onDismiss(_ref2){var tagIndex=_ref2.tagIndex;if(isTagDismissedRef.current){isTagDismissedRef.current.value=true;}if(!isReactNative()){var _triggererRef$current;(_triggererRef$current=triggererRef.current)==null?void 0:_triggererRef$current.focus();}removeOption(selectedIndices[tagIndex]);setChangeCallbackTriggerer(Number(changeCallbackTriggerer)+1);}});};},[selectedIndices,selectionType,activeTagIndex,changeCallbackTriggerer,options]);var tableInputProps={isTableInputCell:rowDensityToIsTableInputCellMapping[rowDensity],id:'table-editable-cell-input',size:tableEditableCellRowDensityToInputSizeMap[rowDensity],trailingIcon:validationStateToInputTrailingIconMap[(_props$validationStat=props.validationState)!=null?_props$validationStat:'none'],showHintsAsTooltip:true};var isValidationStateNone=props.validationState==='none'||props.validationState===undefined;return jsx(BaseInput,Object.assign({as:props.isSelectInput?'button':'input',ref:!isReactNative()?function(node){triggererRef.current=node;if(ref){if(typeof ref==='function'){ref(node);}else {ref.current=node;}}}:null,isDropdownTrigger:true,setInputWrapperRef:function setInputWrapperRef(wrapperNode){triggererWrapperRef.current=wrapperNode;},maxTagRows:(_props$maxRows=props.maxRows)!=null?_props$maxRows:'single',tags:getTags({size:props.size||'medium'}),showAllTags:getShowAllTags(),activeTagIndex:activeTagIndex,setActiveTagIndex:setActiveTagIndex,shouldIgnoreBlurAnimation:shouldIgnoreBlurAnimation,setShouldIgnoreBlurAnimation:setShouldIgnoreBlurAnimation,textAlign:"left",label:props.label,placeholder:selectionType==='multiple'&&selectedIndices.length>0?undefined:dropdownTriggerPlaceholder,hideLabelText:((_props$label=props.label)==null?void 0:_props$label.length)===0,accessibilityLabel:props.accessibilityLabel,labelPosition:props.labelPosition==='inside-input'?undefined:props.labelPosition,isLabelInsideInput:props.labelPosition==='inside-input',necessityIndicator:props.necessityIndicator,autoCompleteSuggestionType:"none",validationState:props.validationState,helpText:props.helpText,errorText:props.errorText,successText:props.successText,name:props.name,isDisabled:props.isDisabled,isRequired:props.isRequired,prefix:props.prefix,suffix:props.suffix,autoFocus:props.autoFocus,value:getValue(),onClick:function onClick(e){if(props.isDisabled){return;}props.onTriggerClick==null?void 0:props.onTriggerClick(e);},onFocus:props.onFocus,onBlur:function onBlur(_ref3){var name=_ref3.name;props.onBlur==null?void 0:props.onBlur({name:name,value:value});},leadingIcon:props.icon,componentName:props.isSelectInput?MetaConstants.SelectInput:MetaConstants.AutoComplete,testID:props.testID,id:`${dropdownBaseId}-trigger`,labelId:`${dropdownBaseId}-label`,hasPopup:getActionListContainerRole(hasFooterAction,dropdownTriggerer),isPopupExpanded:isOpen,activeDescendant:activeIndex>=0?`${dropdownBaseId}-${activeIndex}`:undefined,popupId:`${dropdownBaseId}-actionlist`,onChange:props.isSelectInput?undefined:props.onInputValueChange,onKeyDown:props.onTriggerKeydown,size:props.size,trailingInteractionElement:isAutoCompleteInHeader||isInsideTableEditableCell&&!isValidationStateNone?null:jsx(InputChevronIcon,{onClick:function onClick(){if(!props.isDisabled){if(!isReactNative()){var _triggererRef$current2;(_triggererRef$current2=triggererRef.current)==null?void 0:_triggererRef$current2.focus();}onTriggerClick();}},isDisabled:props.isDisabled,isOpen:isOpen})},isInsideTableEditableCell?tableInputProps:undefined));};var BaseDropdownInputTrigger=React__default.forwardRef(_BaseDropdownInputTrigger);
22
+ 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]);};var _BaseDropdownInputTrigger=function _BaseDropdownInputTrigger(props,ref){var _props$placeholder,_props$validationStat,_props$maxRows,_props$label;var _useDropdown2=useDropdown(),isOpen=_useDropdown2.isOpen,activeTagIndex=_useDropdown2.activeTagIndex,setActiveTagIndex=_useDropdown2.setActiveTagIndex,displayValue=_useDropdown2.displayValue,selectionType=_useDropdown2.selectionType,dropdownTriggerer=_useDropdown2.dropdownTriggerer,dropdownBaseId=_useDropdown2.dropdownBaseId,selectedIndices=_useDropdown2.selectedIndices,triggererRef=_useDropdown2.triggererRef,triggererWrapperRef=_useDropdown2.triggererWrapperRef,isTagDismissedRef=_useDropdown2.isTagDismissedRef,onTriggerClick=_useDropdown2.onTriggerClick,value=_useDropdown2.value,shouldIgnoreBlurAnimation=_useDropdown2.shouldIgnoreBlurAnimation,setShouldIgnoreBlurAnimation=_useDropdown2.setShouldIgnoreBlurAnimation,activeIndex=_useDropdown2.activeIndex,hasFooterAction=_useDropdown2.hasFooterAction,hasAutoCompleteInBottomSheetHeader=_useDropdown2.hasAutoCompleteInBottomSheetHeader,options=_useDropdown2.options,removeOption=_useDropdown2.removeOption,setChangeCallbackTriggerer=_useDropdown2.setChangeCallbackTriggerer,changeCallbackTriggerer=_useDropdown2.changeCallbackTriggerer;var _useTableContext=useTableContext(),rowDensity=_useTableContext.rowDensity;var _useTableEditableCell=useTableEditableCell(),isInsideTableEditableCell=_useTableEditableCell.isInsideTableEditableCell;var dropdownTriggerPlaceholder=(_props$placeholder=props.placeholder)!=null?_props$placeholder:'Select Option';var isAutoCompleteInHeader=!props.isSelectInput&&hasAutoCompleteInBottomSheetHeader;var getShowAllTags=React__default.useCallback(function(){if(hasAutoCompleteInBottomSheetHeader){if(props.isSelectInput){return false;}return true;}return isOpen;},[hasAutoCompleteInBottomSheetHeader,props.isSelectInput,isOpen]);useControlledDropdownInput({onChange:props.onChange,name:props.name,value:props.value,defaultValue:props.defaultValue,syncInputValueWithSelection:props.syncInputValueWithSelection,isSelectInput:props.isSelectInput,triggererRef:triggererRef});var getValue=function getValue(){var prefix='';if(props.labelPosition==='inside-input'&&props.label){prefix=`${props.label}: `;}if(props.isSelectInput){if(selectionType==='single'){return `${prefix}${displayValue}`;}return undefined;}return props.inputValue;};var getTags=React__default.useMemo(function(){return function(_ref){var size=_ref.size;if(selectionType==='single'){return undefined;}return getTagsGroup({size:size,tags:selectedIndices.map(function(selectedIndex){var _options$selectedInde;return (_options$selectedInde=options[selectedIndex])==null?void 0:_options$selectedInde.title;}),activeTagIndex:activeTagIndex,isDisabled:props.isDisabled,onDismiss:function onDismiss(_ref2){var tagIndex=_ref2.tagIndex;if(isTagDismissedRef.current){isTagDismissedRef.current.value=true;}if(!isReactNative()){var _triggererRef$current;(_triggererRef$current=triggererRef.current)==null?void 0:_triggererRef$current.focus();}removeOption(selectedIndices[tagIndex]);setChangeCallbackTriggerer(Number(changeCallbackTriggerer)+1);}});};},[selectedIndices,selectionType,activeTagIndex,changeCallbackTriggerer,options]);var tableInputProps={isTableInputCell:rowDensityToIsTableInputCellMapping[rowDensity],id:'table-editable-cell-input',size:tableEditableCellRowDensityToInputSizeMap[rowDensity],trailingIcon:validationStateToInputTrailingIconMap[(_props$validationStat=props.validationState)!=null?_props$validationStat:'none'],showHintsAsTooltip:true};var isValidationStateNone=props.validationState==='none'||props.validationState===undefined;return jsx(BaseInput,Object.assign({as:props.isSelectInput?'button':'input',ref:!isReactNative()?function(node){triggererRef.current=node;if(ref){if(typeof ref==='function'){ref(node);}else {ref.current=node;}}}:null,isDropdownTrigger:true,setInputWrapperRef:function setInputWrapperRef(wrapperNode){triggererWrapperRef.current=wrapperNode;},maxTagRows:(_props$maxRows=props.maxRows)!=null?_props$maxRows:'single',tags:getTags({size:props.size||'medium'}),showAllTags:getShowAllTags(),activeTagIndex:activeTagIndex,setActiveTagIndex:setActiveTagIndex,shouldIgnoreBlurAnimation:shouldIgnoreBlurAnimation,setShouldIgnoreBlurAnimation:setShouldIgnoreBlurAnimation,textAlign:"left",label:props.label,placeholder:selectionType==='multiple'&&selectedIndices.length>0?undefined:dropdownTriggerPlaceholder,hideLabelText:((_props$label=props.label)==null?void 0:_props$label.length)===0,accessibilityLabel:props.accessibilityLabel,labelPosition:props.labelPosition==='inside-input'?undefined:props.labelPosition,isLabelInsideInput:props.labelPosition==='inside-input',necessityIndicator:props.necessityIndicator,autoCompleteSuggestionType:"none",validationState:props.validationState,helpText:props.helpText,errorText:props.errorText,successText:props.successText,name:props.name,isDisabled:props.isDisabled,isRequired:props.isRequired,prefix:props.prefix,suffix:props.suffix,autoFocus:props.autoFocus,value:getValue(),onClick:function onClick(e){if(props.isDisabled){return;}props.onTriggerClick==null?void 0:props.onTriggerClick(e);},onFocus:props.onFocus,onBlur:function onBlur(_ref3){var name=_ref3.name;props.onBlur==null?void 0:props.onBlur({name:name,value:value});},leadingIcon:props.icon,componentName:props.isSelectInput?MetaConstants.SelectInput:MetaConstants.AutoComplete,testID:props.testID,id:`${dropdownBaseId}-trigger`,labelId:`${dropdownBaseId}-label`,hasPopup:getActionListContainerRole(hasFooterAction,dropdownTriggerer),isPopupExpanded:isOpen,activeDescendant:activeIndex>=0?`${dropdownBaseId}-${activeIndex}`:undefined,popupId:`${dropdownBaseId}-actionlist`,onChange:props.isSelectInput?undefined:props.onInputValueChange,onKeyDown:props.onTriggerKeydown,size:props.size,onTrailingInteractionElementClick:function onTrailingInteractionElementClick(){if(!props.isDisabled){if(!isReactNative()){var _triggererRef$current2;(_triggererRef$current2=triggererRef.current)==null?void 0:_triggererRef$current2.focus();}onTriggerClick();}},trailingInteractionElement:isAutoCompleteInHeader||isInsideTableEditableCell&&!isValidationStateNone?null:jsx(InputChevronIcon,{isDisabled:props.isDisabled,isOpen:isOpen})},isInsideTableEditableCell?tableInputProps:undefined));};var BaseDropdownInputTrigger=React__default.forwardRef(_BaseDropdownInputTrigger);
21
23
 
22
24
  export { BaseDropdownInputTrigger };
23
25
  //# sourceMappingURL=BaseDropdownInputTrigger.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BaseDropdownInputTrigger.js","sources":["../../../../../../src/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.tsx"],"sourcesContent":["import React from 'react';\nimport { BaseInput } from '../BaseInput';\nimport type { BaseInputProps } from '../BaseInput';\nimport { InputChevronIcon } from './InputChevronIcon';\nimport type { BaseDropdownInputTriggerProps } from './types';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport { useDropdown } from '~components/Dropdown/useDropdown';\nimport { isReactNative } from '~utils';\nimport { getActionListContainerRole } from '~components/ActionList/getA11yRoles';\nimport { MetaConstants } from '~utils/metaAttribute';\nimport { getTagsGroup } from '~components/Tag/getTagsGroup';\nimport type { BladeElementRef } from '~utils/types';\nimport { useFirstRender } from '~utils/useFirstRender';\nimport { useTableContext } from '~components/Table/TableContext';\nimport {\n rowDensityToIsTableInputCellMapping,\n tableEditableCellRowDensityToInputSizeMap,\n validationStateToInputTrailingIconMap,\n} from '~components/Table/tokens';\nimport { useTableEditableCell } from '~components/Table/TableEditableCellContext';\n\nconst useControlledDropdownInput = (\n props: Pick<\n BaseDropdownInputTriggerProps,\n | 'onChange'\n | 'name'\n | 'value'\n | 'defaultValue'\n | 'onInputValueChange'\n | 'syncInputValueWithSelection'\n | 'isSelectInput'\n >,\n): 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 }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [changeCallbackTriggerer]);\n};\n\nconst _BaseDropdownInputTrigger = (\n props: BaseDropdownInputTriggerProps,\n ref: React.ForwardedRef<BladeElementRef>,\n): React.ReactElement => {\n const {\n isOpen,\n activeTagIndex,\n setActiveTagIndex,\n displayValue,\n selectionType,\n dropdownTriggerer,\n dropdownBaseId,\n selectedIndices,\n triggererRef,\n triggererWrapperRef,\n isTagDismissedRef,\n onTriggerClick,\n value,\n shouldIgnoreBlurAnimation,\n setShouldIgnoreBlurAnimation,\n activeIndex,\n hasFooterAction,\n hasAutoCompleteInBottomSheetHeader,\n options,\n removeOption,\n setChangeCallbackTriggerer,\n changeCallbackTriggerer,\n } = useDropdown();\n const { rowDensity } = useTableContext();\n const { isInsideTableEditableCell } = useTableEditableCell();\n\n const dropdownTriggerPlaceholder = props.placeholder ?? 'Select Option';\n const isAutoCompleteInHeader = !props.isSelectInput && hasAutoCompleteInBottomSheetHeader;\n\n const getShowAllTags = React.useCallback((): boolean => {\n if (hasAutoCompleteInBottomSheetHeader) {\n // When AutoComplete is in bottomsheet header, we never want to show all tags in outer select input\n if (props.isSelectInput) {\n return false;\n }\n\n // ... And we always want to show all tags in inner AutoComplete\n return true;\n }\n\n return isOpen;\n }, [hasAutoCompleteInBottomSheetHeader, props.isSelectInput, isOpen]);\n\n useControlledDropdownInput({\n onChange: props.onChange,\n name: props.name,\n value: props.value,\n defaultValue: props.defaultValue,\n syncInputValueWithSelection: props.syncInputValueWithSelection,\n isSelectInput: props.isSelectInput,\n });\n\n const getValue = (): string | undefined => {\n let prefix = '';\n if (props.labelPosition === 'inside-input' && props.label) {\n prefix = `${props.label}: `;\n }\n\n if (props.isSelectInput) {\n if (selectionType === 'single') {\n return `${prefix}${displayValue}`;\n }\n\n // In multiselect, we return tags so no display value is required\n return undefined;\n }\n\n // In AutoComplete, input has a special value too\n return props.inputValue;\n };\n\n const getTags = React.useMemo(\n () => ({ size }: { size: NonNullable<BaseInputProps['size']> }) => {\n if (selectionType === 'single') {\n return undefined;\n }\n\n return getTagsGroup({\n size,\n tags: selectedIndices.map((selectedIndex) => options[selectedIndex]?.title),\n activeTagIndex,\n isDisabled: props.isDisabled,\n onDismiss: ({ tagIndex }) => {\n if (isTagDismissedRef.current) {\n isTagDismissedRef.current.value = true;\n }\n\n if (!isReactNative()) {\n triggererRef.current?.focus();\n }\n\n removeOption(selectedIndices[tagIndex]);\n setChangeCallbackTriggerer(Number(changeCallbackTriggerer) + 1);\n },\n });\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [selectedIndices, selectionType, activeTagIndex, changeCallbackTriggerer, options],\n );\n\n const tableInputProps: Partial<BaseInputProps> = {\n isTableInputCell: rowDensityToIsTableInputCellMapping[rowDensity],\n id: 'table-editable-cell-input',\n size: tableEditableCellRowDensityToInputSizeMap[rowDensity],\n trailingIcon: validationStateToInputTrailingIconMap[props.validationState ?? 'none'],\n showHintsAsTooltip: true,\n };\n\n const isValidationStateNone =\n props.validationState === 'none' || props.validationState === undefined;\n\n return (\n <BaseInput\n as={props.isSelectInput ? 'button' : 'input'}\n ref={\n (!isReactNative()\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (node: any) => {\n triggererRef.current = node;\n if (ref) {\n if (typeof ref === 'function') {\n ref(node);\n } else {\n ref.current = node;\n }\n }\n }\n : null) as never\n }\n isDropdownTrigger={true}\n setInputWrapperRef={(wrapperNode) => {\n triggererWrapperRef.current = wrapperNode;\n }}\n maxTagRows={props.maxRows ?? 'single'}\n tags={getTags({ size: props.size || 'medium' })}\n showAllTags={getShowAllTags()}\n activeTagIndex={activeTagIndex}\n setActiveTagIndex={setActiveTagIndex}\n shouldIgnoreBlurAnimation={shouldIgnoreBlurAnimation}\n setShouldIgnoreBlurAnimation={setShouldIgnoreBlurAnimation}\n textAlign=\"left\"\n // Form Props\n label={props.label as string}\n placeholder={\n selectionType === 'multiple' && selectedIndices.length > 0\n ? undefined\n : dropdownTriggerPlaceholder\n }\n hideLabelText={props.label?.length === 0}\n accessibilityLabel={props.accessibilityLabel}\n labelPosition={props.labelPosition === 'inside-input' ? undefined : props.labelPosition}\n isLabelInsideInput={props.labelPosition === 'inside-input'}\n necessityIndicator={props.necessityIndicator}\n autoCompleteSuggestionType=\"none\"\n validationState={props.validationState}\n helpText={props.helpText}\n errorText={props.errorText}\n successText={props.successText}\n name={props.name}\n isDisabled={props.isDisabled}\n isRequired={props.isRequired}\n prefix={props.prefix}\n suffix={props.suffix}\n autoFocus={props.autoFocus} // eslint-disable-line jsx-a11y/no-autofocus\n value={getValue()}\n onClick={(e) => {\n if (props.isDisabled) {\n return;\n }\n props.onTriggerClick?.(e);\n }}\n onFocus={props.onFocus}\n onBlur={({ name }) => {\n props.onBlur?.({ name, value });\n }}\n leadingIcon={props.icon}\n // Meta Props\n componentName={props.isSelectInput ? MetaConstants.SelectInput : MetaConstants.AutoComplete}\n testID={props.testID}\n // a11y Props\n id={`${dropdownBaseId}-trigger`}\n labelId={`${dropdownBaseId}-label`}\n hasPopup={getActionListContainerRole(hasFooterAction, dropdownTriggerer)}\n isPopupExpanded={isOpen}\n activeDescendant={activeIndex >= 0 ? `${dropdownBaseId}-${activeIndex}` : undefined}\n popupId={`${dropdownBaseId}-actionlist`}\n // Special Props for Unique behaviour between Select and AutoComplete\n onChange={props.isSelectInput ? undefined : props.onInputValueChange}\n onKeyDown={props.onTriggerKeydown}\n size={props.size}\n trailingInteractionElement={\n isAutoCompleteInHeader || (isInsideTableEditableCell && !isValidationStateNone) ? null : (\n <InputChevronIcon\n onClick={() => {\n if (!props.isDisabled) {\n // Icon onClicks to the SelectInput itself\n if (!isReactNative()) {\n triggererRef.current?.focus();\n }\n onTriggerClick();\n }\n }}\n isDisabled={props.isDisabled}\n isOpen={isOpen}\n />\n )\n }\n {...(isInsideTableEditableCell ? tableInputProps : undefined)}\n />\n );\n};\n\nconst BaseDropdownInputTrigger = React.forwardRef(_BaseDropdownInputTrigger);\n\nexport { BaseDropdownInputTrigger };\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","_BaseDropdownInputTrigger","ref","_props$placeholder","_props$validationStat","_props$maxRows","_props$label","_useDropdown2","isOpen","activeTagIndex","setActiveTagIndex","displayValue","dropdownTriggerer","dropdownBaseId","triggererRef","triggererWrapperRef","isTagDismissedRef","onTriggerClick","shouldIgnoreBlurAnimation","setShouldIgnoreBlurAnimation","activeIndex","hasFooterAction","hasAutoCompleteInBottomSheetHeader","removeOption","setChangeCallbackTriggerer","_useTableContext","useTableContext","rowDensity","_useTableEditableCell","useTableEditableCell","isInsideTableEditableCell","dropdownTriggerPlaceholder","placeholder","isAutoCompleteInHeader","getShowAllTags","useCallback","getValue","prefix","labelPosition","label","inputValue","getTags","useMemo","_ref","size","getTagsGroup","tags","selectedIndex","_options$selectedInde","title","isDisabled","onDismiss","_ref2","tagIndex","current","isReactNative","_triggererRef$current","focus","Number","tableInputProps","isTableInputCell","rowDensityToIsTableInputCellMapping","id","tableEditableCellRowDensityToInputSizeMap","trailingIcon","validationStateToInputTrailingIconMap","validationState","showHintsAsTooltip","isValidationStateNone","_jsx","BaseInput","Object","assign","as","node","isDropdownTrigger","setInputWrapperRef","wrapperNode","maxTagRows","maxRows","showAllTags","textAlign","hideLabelText","accessibilityLabel","isLabelInsideInput","necessityIndicator","autoCompleteSuggestionType","helpText","errorText","successText","isRequired","suffix","autoFocus","onClick","e","onFocus","onBlur","_ref3","leadingIcon","icon","componentName","MetaConstants","SelectInput","AutoComplete","testID","labelId","hasPopup","getActionListContainerRole","isPopupExpanded","activeDescendant","popupId","onInputValueChange","onKeyDown","onTriggerKeydown","trailingInteractionElement","InputChevronIcon","_triggererRef$current2","BaseDropdownInputTrigger","forwardRef"],"mappings":";;;;;;;;;;;;;;;;;;;AAqBA,IAAMA,0BAA0B,CAAG,SAA7BA,0BAA0BA,CAC9BC,KASC,CACQ,CACT,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,YAAA,CAAPI,OAAO,CACPC,eAAe,CAAAL,YAAA,CAAfK,eAAe,CACfC,sBA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,CAACyJ,kBAAmB,CACrEC,SAAS,CAAE1J,KAAK,CAAC2J,gBAAiB,CAClCrE,IAAI,CAAEtF,KAAK,CAACsF,IAAK,CACjBsE,0BAA0B,CACxBjF,sBAAsB,EAAKH,yBAAyB,EAAI,CAACsC,qBAAsB,CAAG,IAAI,CACpFC,GAAA,CAAC8C,gBAAgB,CAAA,CACftB,OAAO,CAAE,SAAAA,OAAA,EAAM,CACb,GAAI,CAACvI,KAAK,CAAC4F,UAAU,CAAE,CAErB,GAAI,CAACK,aAAa,EAAE,CAAE,CAAA6D,IAAAA,sBAAA,CACpB,CAAAA,sBAAA,CAAAtG,YAAY,CAACwC,OAAO,eAApB8D,sBAAA,CAAsB3D,KAAK,EAAE,CAC/B,CACAxC,cAAc,EAAE,CAClB,CACF,CAAE,CACFiC,UAAU,CAAE5F,KAAK,CAAC4F,UAAW,CAC7B1C,MAAM,CAAEA,MAAO,CAChB,CAEJ,CACIsB,CAAAA,yBAAyB,CAAG6B,eAAe,CAAGjE,SAAS,CAC7D,CAAC,CAEN,CAAC,CAEK,IAAA2H,wBAAwB,CAAG9H,cAAK,CAAC+H,UAAU,CAACrH,yBAAyB;;;;"}
1
+ {"version":3,"file":"BaseDropdownInputTrigger.js","sources":["../../../../../../src/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.tsx"],"sourcesContent":["import React from 'react';\nimport { BaseInput } from '../BaseInput';\nimport type { BaseInputProps } from '../BaseInput';\nimport { InputChevronIcon } from './InputChevronIcon';\nimport type { BaseDropdownInputTriggerProps, useControlledDropdownInputProps } from './types';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport { useDropdown } from '~components/Dropdown/useDropdown';\nimport { isReactNative, isBrowser } from '~utils';\nimport { getActionListContainerRole } from '~components/ActionList/getA11yRoles';\nimport { MetaConstants } from '~utils/metaAttribute';\nimport { getTagsGroup } from '~components/Tag/getTagsGroup';\nimport type { BladeElementRef } from '~utils/types';\nimport { useFirstRender } from '~utils/useFirstRender';\nimport { useTableContext } from '~components/Table/TableContext';\nimport {\n rowDensityToIsTableInputCellMapping,\n tableEditableCellRowDensityToInputSizeMap,\n validationStateToInputTrailingIconMap,\n} from '~components/Table/tokens';\nimport { useTableEditableCell } from '~components/Table/TableEditableCellContext';\nimport { fireNativeEvent } from '~utils/fireNativeEvent';\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\nconst _BaseDropdownInputTrigger = (\n props: BaseDropdownInputTriggerProps,\n ref: React.ForwardedRef<BladeElementRef>,\n): React.ReactElement => {\n const {\n isOpen,\n activeTagIndex,\n setActiveTagIndex,\n displayValue,\n selectionType,\n dropdownTriggerer,\n dropdownBaseId,\n selectedIndices,\n triggererRef,\n triggererWrapperRef,\n isTagDismissedRef,\n onTriggerClick,\n value,\n shouldIgnoreBlurAnimation,\n setShouldIgnoreBlurAnimation,\n activeIndex,\n hasFooterAction,\n hasAutoCompleteInBottomSheetHeader,\n options,\n removeOption,\n setChangeCallbackTriggerer,\n changeCallbackTriggerer,\n } = useDropdown();\n const { rowDensity } = useTableContext();\n const { isInsideTableEditableCell } = useTableEditableCell();\n\n const dropdownTriggerPlaceholder = props.placeholder ?? 'Select Option';\n const isAutoCompleteInHeader = !props.isSelectInput && hasAutoCompleteInBottomSheetHeader;\n\n const getShowAllTags = React.useCallback((): boolean => {\n if (hasAutoCompleteInBottomSheetHeader) {\n // When AutoComplete is in bottomsheet header, we never want to show all tags in outer select input\n if (props.isSelectInput) {\n return false;\n }\n\n // ... And we always want to show all tags in inner AutoComplete\n return true;\n }\n\n return isOpen;\n }, [hasAutoCompleteInBottomSheetHeader, props.isSelectInput, isOpen]);\n\n useControlledDropdownInput({\n onChange: props.onChange,\n name: props.name,\n value: props.value,\n defaultValue: props.defaultValue,\n syncInputValueWithSelection: props.syncInputValueWithSelection,\n isSelectInput: props.isSelectInput,\n triggererRef,\n });\n\n const getValue = (): string | undefined => {\n let prefix = '';\n if (props.labelPosition === 'inside-input' && props.label) {\n prefix = `${props.label}: `;\n }\n\n if (props.isSelectInput) {\n if (selectionType === 'single') {\n return `${prefix}${displayValue}`;\n }\n\n // In multiselect, we return tags so no display value is required\n return undefined;\n }\n\n // In AutoComplete, input has a special value too\n return props.inputValue;\n };\n\n const getTags = React.useMemo(\n () => ({ size }: { size: NonNullable<BaseInputProps['size']> }) => {\n if (selectionType === 'single') {\n return undefined;\n }\n\n return getTagsGroup({\n size,\n tags: selectedIndices.map((selectedIndex) => options[selectedIndex]?.title),\n activeTagIndex,\n isDisabled: props.isDisabled,\n onDismiss: ({ tagIndex }) => {\n if (isTagDismissedRef.current) {\n isTagDismissedRef.current.value = true;\n }\n\n if (!isReactNative()) {\n triggererRef.current?.focus();\n }\n\n removeOption(selectedIndices[tagIndex]);\n setChangeCallbackTriggerer(Number(changeCallbackTriggerer) + 1);\n },\n });\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [selectedIndices, selectionType, activeTagIndex, changeCallbackTriggerer, options],\n );\n\n const tableInputProps: Partial<BaseInputProps> = {\n isTableInputCell: rowDensityToIsTableInputCellMapping[rowDensity],\n id: 'table-editable-cell-input',\n size: tableEditableCellRowDensityToInputSizeMap[rowDensity],\n trailingIcon: validationStateToInputTrailingIconMap[props.validationState ?? 'none'],\n showHintsAsTooltip: true,\n };\n\n const isValidationStateNone =\n props.validationState === 'none' || props.validationState === undefined;\n\n return (\n <BaseInput\n as={props.isSelectInput ? 'button' : 'input'}\n ref={\n (!isReactNative()\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (node: any) => {\n triggererRef.current = node;\n if (ref) {\n if (typeof ref === 'function') {\n ref(node);\n } else {\n ref.current = node;\n }\n }\n }\n : null) as never\n }\n isDropdownTrigger={true}\n setInputWrapperRef={(wrapperNode) => {\n triggererWrapperRef.current = wrapperNode;\n }}\n maxTagRows={props.maxRows ?? 'single'}\n tags={getTags({ size: props.size || 'medium' })}\n showAllTags={getShowAllTags()}\n activeTagIndex={activeTagIndex}\n setActiveTagIndex={setActiveTagIndex}\n shouldIgnoreBlurAnimation={shouldIgnoreBlurAnimation}\n setShouldIgnoreBlurAnimation={setShouldIgnoreBlurAnimation}\n textAlign=\"left\"\n // Form Props\n label={props.label as string}\n placeholder={\n selectionType === 'multiple' && selectedIndices.length > 0\n ? undefined\n : dropdownTriggerPlaceholder\n }\n hideLabelText={props.label?.length === 0}\n accessibilityLabel={props.accessibilityLabel}\n labelPosition={props.labelPosition === 'inside-input' ? undefined : props.labelPosition}\n isLabelInsideInput={props.labelPosition === 'inside-input'}\n necessityIndicator={props.necessityIndicator}\n autoCompleteSuggestionType=\"none\"\n validationState={props.validationState}\n helpText={props.helpText}\n errorText={props.errorText}\n successText={props.successText}\n name={props.name}\n isDisabled={props.isDisabled}\n isRequired={props.isRequired}\n prefix={props.prefix}\n suffix={props.suffix}\n autoFocus={props.autoFocus} // eslint-disable-line jsx-a11y/no-autofocus\n value={getValue()}\n onClick={(e) => {\n if (props.isDisabled) {\n return;\n }\n props.onTriggerClick?.(e);\n }}\n onFocus={props.onFocus}\n onBlur={({ name }) => {\n props.onBlur?.({ name, value });\n }}\n leadingIcon={props.icon}\n // Meta Props\n componentName={props.isSelectInput ? MetaConstants.SelectInput : MetaConstants.AutoComplete}\n testID={props.testID}\n // a11y Props\n id={`${dropdownBaseId}-trigger`}\n labelId={`${dropdownBaseId}-label`}\n hasPopup={getActionListContainerRole(hasFooterAction, dropdownTriggerer)}\n isPopupExpanded={isOpen}\n activeDescendant={activeIndex >= 0 ? `${dropdownBaseId}-${activeIndex}` : undefined}\n popupId={`${dropdownBaseId}-actionlist`}\n // Special Props for Unique behaviour between Select and AutoComplete\n onChange={props.isSelectInput ? undefined : props.onInputValueChange}\n onKeyDown={props.onTriggerKeydown}\n size={props.size}\n onTrailingInteractionElementClick={() => {\n if (!props.isDisabled) {\n // Icon onClicks to the SelectInput itself\n if (!isReactNative()) {\n triggererRef.current?.focus();\n }\n onTriggerClick();\n }\n }}\n trailingInteractionElement={\n isAutoCompleteInHeader || (isInsideTableEditableCell && !isValidationStateNone) ? null : (\n <InputChevronIcon isDisabled={props.isDisabled} isOpen={isOpen} />\n )\n }\n {...(isInsideTableEditableCell ? tableInputProps : undefined)}\n />\n );\n};\n\nconst BaseDropdownInputTrigger = React.forwardRef(_BaseDropdownInputTrigger);\n\nexport { BaseDropdownInputTrigger };\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","_BaseDropdownInputTrigger","ref","_props$placeholder","_props$validationStat","_props$maxRows","_props$label","_useDropdown2","isOpen","activeTagIndex","setActiveTagIndex","displayValue","dropdownTriggerer","dropdownBaseId","triggererWrapperRef","isTagDismissedRef","onTriggerClick","shouldIgnoreBlurAnimation","setShouldIgnoreBlurAnimation","activeIndex","hasFooterAction","hasAutoCompleteInBottomSheetHeader","removeOption","setChangeCallbackTriggerer","_useTableContext","useTableContext","rowDensity","_useTableEditableCell","useTableEditableCell","isInsideTableEditableCell","dropdownTriggerPlaceholder","placeholder","isAutoCompleteInHeader","getShowAllTags","useCallback","getValue","prefix","labelPosition","label","inputValue","getTags","useMemo","_ref","size","getTagsGroup","tags","selectedIndex","_options$selectedInde","title","isDisabled","onDismiss","_ref2","tagIndex","current","isReactNative","_triggererRef$current","focus","Number","tableInputProps","isTableInputCell","rowDensityToIsTableInputCellMapping","id","tableEditableCellRowDensityToInputSizeMap","trailingIcon","validationStateToInputTrailingIconMap","validationState","showHintsAsTooltip","isValidationStateNone","_jsx","BaseInput","Object","assign","as","node","isDropdownTrigger","setInputWrapperRef","wrapperNode","maxTagRows","maxRows","showAllTags","textAlign","hideLabelText","accessibilityLabel","isLabelInsideInput","necessityIndicator","autoCompleteSuggestionType","helpText","errorText","successText","isRequired","suffix","autoFocus","onClick","e","onFocus","onBlur","_ref3","leadingIcon","icon","componentName","MetaConstants","SelectInput","AutoComplete","testID","labelId","hasPopup","getActionListContainerRole","isPopupExpanded","activeDescendant","popupId","onInputValueChange","onKeyDown","onTriggerKeydown","onTrailingInteractionElementClick","_triggererRef$current2","trailingInteractionElement","InputChevronIcon","BaseDropdownInputTrigger","forwardRef"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAsBA,IAAMA,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,YAAA,CAAPI,OAAO,CACPC,eAAe,CAAAL,YAAA,CAAfK,eAAe,CACfC,sBAAsB,CAAAN,YAAA,CAAtBM,sBAAsB,CACtBC,kBAAkB,CAAAP,YAAA,CAAlBO,kBAAkB,CAClBC,aAAa,CAAAR,YAAA,CAAbQ,aAAa,CACbC,eAAe,CAAAT,YAAA,CAAfS,eAAe,CAGjB,IAAMC,yBAAyB,CAAG,SAA5BA,yBAAyBA,EAAmB,CAChD,IAAIC,OAAiB,CAAG,EAAE,CAC1B,GAAIR,YAAY,CAAE,CAChBQ,OAAO,CAAGL,sBAAsB,CAClC,CAAC,KAAM,CACLK,OAAO,CAAGN,eAAe,CAC3B,CAEA,OAAOM,OAAO,CAACC,GAAG,CAAC,SAACC,cAAc,CAAK,CAAA,OAAAT,OA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BAAA,CACpB,CAAAA,sBAAA,CAAAlH,YAAY,CAACqD,OAAO,GAAA,IAAA,CAAA,KAAA,CAAA,CAApB6D,sBAAA,CAAsB1D,KAAK,EAAE,CAC/B,CACAxC,cAAc,EAAE,CAClB,CACF,CAAE,CACFmG,0BAA0B,CACxBnF,sBAAsB,EAAKH,yBAAyB,EAAI,CAACsC,qBAAsB,CAAG,IAAI,CACpFC,GAAA,CAACgD,gBAAgB,CAAA,CAACnE,UAAU,CAAE9F,KAAK,CAAC8F,UAAW,CAACzC,MAAM,CAAEA,MAAO,CAAE,CAEpE,CACIqB,CAAAA,yBAAyB,CAAG6B,eAAe,CAAGnE,SAAS,CAC7D,CAAC,CAEN,CAAC,CAEK,IAAA8H,wBAAwB,CAAGjI,cAAK,CAACkI,UAAU,CAACrH,yBAAyB;;;;"}
@@ -0,0 +1,6 @@
1
+ import { throwBladeError } from '../logger/logger.js';
2
+
3
+ var fireNativeEvent=function fireNativeEvent(_ref,_eventTypes){throwBladeError({message:'FireNativeEvent is not supported on react-native',moduleName:'FireNativeEvent'});};
4
+
5
+ export { fireNativeEvent };
6
+ //# sourceMappingURL=fireNativeEvent.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fireNativeEvent.native.js","sources":["../../../../../src/utils/fireNativeEvent/fireNativeEvent.native.ts"],"sourcesContent":["import { throwBladeError } from '../logger';\n/**\n * FireNativeEvent is not supported on react-native\n */\n\nexport const fireNativeEvent = (\n _ref: React.RefObject<HTMLElement> | null,\n _eventTypes: Array<'change' | 'input'>,\n): void => {\n throwBladeError({\n message: 'FireNativeEvent is not supported on react-native',\n moduleName: 'FireNativeEvent',\n });\n};\n"],"names":["fireNativeEvent","_ref","_eventTypes","throwBladeError","message","moduleName"],"mappings":";;AAKa,IAAAA,eAAe,CAAG,SAAlBA,eAAeA,CAC1BC,IAAyC,CACzCC,WAAsC,CAC7B,CACTC,eAAe,CAAC,CACdC,OAAO,CAAE,kDAAkD,CAC3DC,UAAU,CAAE,iBACd,CAAC,CAAC,CACJ;;;;"}
@@ -5,6 +5,7 @@ export { useBreakpoint } from './useBreakpoint/useBreakpoint.js';
5
5
  export { useColorScheme } from './useColorScheme/useColorScheme.js';
6
6
  export { useInterval } from './useInterval.js';
7
7
  export { isReactNative } from './platform/isReactNative.js';
8
+ export { isBrowser } from './platform/isBrowser.js';
8
9
  export { getOS, isAndroid } from './platform/getOS.native.js';
9
10
  export { castNativeType, castWebType } from './platform/castUtils.js';
10
11
  export { makeBorderSize } from './makeBorderSize/makeBorderSize.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,6 @@
1
+ import { getPlatformType } from '../getPlatformType/getPlatformType.js';
2
+
3
+ var isBrowser=function isBrowser(){return getPlatformType()==='browser';};
4
+
5
+ export { isBrowser };
6
+ //# sourceMappingURL=isBrowser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isBrowser.js","sources":["../../../../../src/utils/platform/isBrowser.ts"],"sourcesContent":["import { getPlatformType } from '../getPlatformType';\n\nconst isBrowser = (): boolean => {\n return getPlatformType() === 'browser';\n};\n\nexport { isBrowser };\n"],"names":["isBrowser","getPlatformType"],"mappings":";;AAEM,IAAAA,SAAS,CAAG,SAAZA,SAASA,EAAkB,CAC/B,OAAOC,eAAe,EAAE,GAAK,SAAS,CACxC;;;;"}
@@ -26,8 +26,10 @@ import '../../utils/logger/index.js';
26
26
  import '../Box/styledProps/index.js';
27
27
  import '../../utils/metaAttribute/index.js';
28
28
  import { componentZIndices } from '../../utils/componentZIndices.js';
29
+ import '../../utils/fireNativeEvent/index.js';
29
30
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
30
31
  import useTheme from '../BladeProvider/useTheme.js';
32
+ import { fireNativeEvent } from '../../utils/fireNativeEvent/fireNativeEvent.web.js';
31
33
  import { BaseBox } from '../Box/BaseBox/BaseBox.web.js';
32
34
  import { logger } from '../../utils/logger/logger.js';
33
35
  import { getStyledProps } from '../Box/styledProps/getStyledProps.js';
@@ -90,6 +92,7 @@ var DatePicker = function DatePicker(_ref) {
90
92
  _React$useState2 = _slicedToArray(_React$useState, 2),
91
93
  selectedPreset = _React$useState2[0],
92
94
  setSelectedPreset = _React$useState2[1];
95
+ var referenceRef = React__default.useRef(null);
93
96
  var _useControllableState = useControllableState({
94
97
  defaultValue: defaultPicker,
95
98
  value: picker,
@@ -109,6 +112,7 @@ var DatePicker = function DatePicker(_ref) {
109
112
  defaultValue: defaultValue,
110
113
  onChange: function onChange(date) {
111
114
  _onChange === null || _onChange === void 0 ? void 0 : _onChange(date);
115
+ fireNativeEvent(referenceRef, ['input']);
112
116
  if (isSingle) return;
113
117
  // sync selected preset with value
114
118
  setSelectedPreset(date);
@@ -151,6 +155,7 @@ var DatePicker = function DatePicker(_ref) {
151
155
  var handleApply = function handleApply() {
152
156
  if (isSingle) {
153
157
  _onChange === null || _onChange === void 0 ? void 0 : _onChange(controlledValue);
158
+ fireNativeEvent(referenceRef, ['change']);
154
159
  setOldValue(controlledValue);
155
160
  onApply === null || onApply === void 0 ? void 0 : onApply(controlledValue);
156
161
  close();
@@ -159,6 +164,7 @@ var DatePicker = function DatePicker(_ref) {
159
164
  // only apply if both dates are selected
160
165
  if (hasBothDatesSelected) {
161
166
  _onChange === null || _onChange === void 0 ? void 0 : _onChange(controlledValue);
167
+ fireNativeEvent(referenceRef, ['change']);
162
168
  setOldValue(controlledValue);
163
169
  onApply === null || onApply === void 0 ? void 0 : onApply(controlledValue);
164
170
  close();
@@ -166,13 +172,13 @@ var DatePicker = function DatePicker(_ref) {
166
172
  };
167
173
  var handleCancel = function handleCancel() {
168
174
  setControlledValue(oldValue);
175
+ fireNativeEvent(referenceRef, ['change']);
169
176
  setPickedDate(null);
170
177
  close();
171
178
  };
172
179
  var isMobile = useIsMobile();
173
180
  var defaultInitialFocusRef = React__default.useRef(null);
174
181
  var titleId = useId('datepicker-title');
175
- var referenceRef = React__default.useRef(null);
176
182
  var _usePopup = usePopup({
177
183
  enabled: !isMobile,
178
184
  placement: 'bottom-start',