@razorpay/blade 12.8.2 → 12.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/build/lib/native/components/Button/IconButton/StyledIconButton.native.js +1 -1
  2. package/build/lib/native/components/Button/IconButton/StyledIconButton.native.js.map +1 -1
  3. package/build/lib/native/components/Dropdown/Dropdown.js +1 -1
  4. package/build/lib/native/components/Dropdown/Dropdown.js.map +1 -1
  5. package/build/lib/native/components/Dropdown/DropdownButton.js.map +1 -1
  6. package/build/lib/native/components/Dropdown/DropdownIconButton.js +13 -0
  7. package/build/lib/native/components/Dropdown/DropdownIconButton.js.map +1 -0
  8. package/build/lib/native/components/Dropdown/DropdownLink.js.map +1 -1
  9. package/build/lib/native/components/Dropdown/dropdownComponentIds.js +1 -1
  10. package/build/lib/native/components/Dropdown/dropdownComponentIds.js.map +1 -1
  11. package/build/lib/native/components/Dropdown/useDropdown.js.map +1 -1
  12. package/build/lib/native/components/index.js +1 -0
  13. package/build/lib/native/components/index.js.map +1 -1
  14. package/build/lib/web/development/components/Button/IconButton/StyledIconButton.web.js +7 -4
  15. package/build/lib/web/development/components/Button/IconButton/StyledIconButton.web.js.map +1 -1
  16. package/build/lib/web/development/components/Dropdown/Dropdown.js +4 -1
  17. package/build/lib/web/development/components/Dropdown/Dropdown.js.map +1 -1
  18. package/build/lib/web/development/components/Dropdown/DropdownButton.js +1 -7
  19. package/build/lib/web/development/components/Dropdown/DropdownButton.js.map +1 -1
  20. package/build/lib/web/development/components/Dropdown/DropdownIconButton.js +78 -0
  21. package/build/lib/web/development/components/Dropdown/DropdownIconButton.js.map +1 -0
  22. package/build/lib/web/development/components/Dropdown/DropdownLink.js +0 -5
  23. package/build/lib/web/development/components/Dropdown/DropdownLink.js.map +1 -1
  24. package/build/lib/web/development/components/Dropdown/dropdownComponentIds.js +2 -1
  25. package/build/lib/web/development/components/Dropdown/dropdownComponentIds.js.map +1 -1
  26. package/build/lib/web/development/components/Dropdown/index.js +1 -0
  27. package/build/lib/web/development/components/Dropdown/index.js.map +1 -1
  28. package/build/lib/web/development/components/Dropdown/useDropdown.js.map +1 -1
  29. package/build/lib/web/development/components/SideNav/SideNavItems/SideNavItem.web.js +2 -2
  30. package/build/lib/web/development/components/SideNav/SideNavItems/SideNavItem.web.js.map +1 -1
  31. package/build/lib/web/development/components/SideNav/SideNavItems/SideNavLink.web.js +3 -3
  32. package/build/lib/web/development/components/SideNav/SideNavItems/SideNavLink.web.js.map +1 -1
  33. package/build/lib/web/development/components/Tooltip/Tooltip.web.js +3 -1
  34. package/build/lib/web/development/components/Tooltip/Tooltip.web.js.map +1 -1
  35. package/build/lib/web/development/components/index.js +1 -0
  36. package/build/lib/web/development/components/index.js.map +1 -1
  37. package/build/lib/web/development/{components/SideNav/SideNavItems/TooltipifyNavItem.js → utils/TooltipifyComponent.js} +23 -6
  38. package/build/lib/web/development/utils/TooltipifyComponent.js.map +1 -0
  39. package/build/lib/web/production/components/Button/IconButton/StyledIconButton.web.js +7 -4
  40. package/build/lib/web/production/components/Button/IconButton/StyledIconButton.web.js.map +1 -1
  41. package/build/lib/web/production/components/Dropdown/Dropdown.js +4 -1
  42. package/build/lib/web/production/components/Dropdown/Dropdown.js.map +1 -1
  43. package/build/lib/web/production/components/Dropdown/DropdownButton.js +1 -7
  44. package/build/lib/web/production/components/Dropdown/DropdownButton.js.map +1 -1
  45. package/build/lib/web/production/components/Dropdown/DropdownIconButton.js +78 -0
  46. package/build/lib/web/production/components/Dropdown/DropdownIconButton.js.map +1 -0
  47. package/build/lib/web/production/components/Dropdown/DropdownLink.js +0 -5
  48. package/build/lib/web/production/components/Dropdown/DropdownLink.js.map +1 -1
  49. package/build/lib/web/production/components/Dropdown/dropdownComponentIds.js +2 -1
  50. package/build/lib/web/production/components/Dropdown/dropdownComponentIds.js.map +1 -1
  51. package/build/lib/web/production/components/Dropdown/index.js +1 -0
  52. package/build/lib/web/production/components/Dropdown/index.js.map +1 -1
  53. package/build/lib/web/production/components/Dropdown/useDropdown.js.map +1 -1
  54. package/build/lib/web/production/components/SideNav/SideNavItems/SideNavItem.web.js +2 -2
  55. package/build/lib/web/production/components/SideNav/SideNavItems/SideNavItem.web.js.map +1 -1
  56. package/build/lib/web/production/components/SideNav/SideNavItems/SideNavLink.web.js +3 -3
  57. package/build/lib/web/production/components/SideNav/SideNavItems/SideNavLink.web.js.map +1 -1
  58. package/build/lib/web/production/components/Tooltip/Tooltip.web.js +3 -1
  59. package/build/lib/web/production/components/Tooltip/Tooltip.web.js.map +1 -1
  60. package/build/lib/web/production/components/index.js +1 -0
  61. package/build/lib/web/production/components/index.js.map +1 -1
  62. package/build/lib/web/production/{components/SideNav/SideNavItems/TooltipifyNavItem.js → utils/TooltipifyComponent.js} +23 -6
  63. package/build/lib/web/production/utils/TooltipifyComponent.js.map +1 -0
  64. package/build/types/components/index.d.ts +14 -2
  65. package/build/types/components/index.native.d.ts +14 -2
  66. package/package.json +1 -1
  67. package/build/lib/web/development/components/SideNav/SideNavItems/TooltipifyNavItem.js.map +0 -1
  68. package/build/lib/web/production/components/SideNav/SideNavItems/TooltipifyNavItem.js.map +0 -1
@@ -7,7 +7,7 @@ import { castNativeType } from '../../../utils/platform/castUtils.js';
7
7
  import '../../BladeProvider/useTheme.js';
8
8
  import { jsx } from 'react/jsx-runtime';
9
9
 
10
- var StyledPressable=styled.Pressable({alignSelf:'center'});var StyledIconButton=React__default.forwardRef(function(_ref,ref){var Icon=_ref.icon,isDisabled=_ref.isDisabled,onClick=_ref.onClick,onBlur=_ref.onBlur,onFocus=_ref.onFocus,onMouseLeave=_ref.onMouseLeave,onMouseMove=_ref.onMouseMove,onPointerDown=_ref.onPointerDown,onPointerEnter=_ref.onPointerEnter,onTouchEnd=_ref.onTouchEnd,onTouchStart=_ref.onTouchStart,size=_ref.size,emphasis=_ref.emphasis,accessibilityLabel=_ref.accessibilityLabel;var _useState=useState(false),_useState2=_slicedToArray(_useState,2),isPressed=_useState2[0],setIsPressed=_useState2[1];var getIconColorToken=function getIconColorToken(){var emphasisColor=emphasis==='intense'?'gray':'staticWhite';if(isDisabled){return `interactive.icon.${emphasisColor}.disabled`;}var state=isPressed?'subtle':'muted';return `interactive.icon.${emphasisColor}.${state}`;};var iconColorToken=getIconColorToken();return jsx(StyledPressable,Object.assign({ref:ref,emphasis:emphasis,onPress:castNativeType(onClick),disabled:isDisabled,onPressIn:function onPressIn(){return setIsPressed(true);},onPressOut:function onPressOut(){return setIsPressed(false);},onBlur:onBlur,onFocus:onFocus,onMouseLeave:onMouseLeave,onMouseMove:onMouseMove,onPointerDown:onPointerDown,onPointerEnter:onPointerEnter,onTouchEnd:onTouchEnd,onTouchStart:onTouchStart},makeAccessible({label:accessibilityLabel,role:'button'}),{children:jsx(Icon,{size:size,color:iconColorToken})}));});
10
+ var StyledPressable=styled.Pressable({alignSelf:'center'});var StyledIconButton=React__default.forwardRef(function(_ref,ref){var _accessibilityProps$r;var Icon=_ref.icon,isDisabled=_ref.isDisabled,onClick=_ref.onClick,onBlur=_ref.onBlur,onFocus=_ref.onFocus,onMouseLeave=_ref.onMouseLeave,onMouseMove=_ref.onMouseMove,onPointerDown=_ref.onPointerDown,onPointerEnter=_ref.onPointerEnter,onTouchEnd=_ref.onTouchEnd,onTouchStart=_ref.onTouchStart,size=_ref.size,emphasis=_ref.emphasis,accessibilityLabel=_ref.accessibilityLabel,accessibilityProps=_ref.accessibilityProps;var _useState=useState(false),_useState2=_slicedToArray(_useState,2),isPressed=_useState2[0],setIsPressed=_useState2[1];var getIconColorToken=function getIconColorToken(){var emphasisColor=emphasis==='intense'?'gray':'staticWhite';if(isDisabled){return `interactive.icon.${emphasisColor}.disabled`;}var state=isPressed?'subtle':'muted';return `interactive.icon.${emphasisColor}.${state}`;};var iconColorToken=getIconColorToken();return jsx(StyledPressable,Object.assign({ref:ref,emphasis:emphasis,onPress:castNativeType(onClick),disabled:isDisabled,onPressIn:function onPressIn(){return setIsPressed(true);},onPressOut:function onPressOut(){return setIsPressed(false);},onBlur:onBlur,onFocus:onFocus,onMouseLeave:onMouseLeave,onMouseMove:onMouseMove,onPointerDown:onPointerDown,onPointerEnter:onPointerEnter,onTouchEnd:onTouchEnd,onTouchStart:onTouchStart},makeAccessible(Object.assign({},accessibilityProps,{label:accessibilityLabel!=null?accessibilityLabel:accessibilityProps==null?void 0:accessibilityProps.label,role:(_accessibilityProps$r=accessibilityProps==null?void 0:accessibilityProps.role)!=null?_accessibilityProps$r:'button'})),{children:jsx(Icon,{size:size,color:iconColorToken})}));});
11
11
 
12
12
  export { StyledIconButton as default };
13
13
  //# sourceMappingURL=StyledIconButton.native.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"StyledIconButton.native.js","sources":["../../../../../../src/components/Button/IconButton/StyledIconButton.native.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable react/display-name */\nimport React, { useState } from 'react';\nimport styled from 'styled-components/native';\n\nimport type { View } from 'react-native';\nimport type { StyledIconButtonProps } from './types';\nimport type { Emphasis, SubtleOrIntense } from '~tokens/theme/theme';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport type { BladeCommonEvents } from '~components/types';\nimport { castNativeType } from '~utils';\n\ntype IconColorStates = keyof Pick<Emphasis, 'muted' | 'subtle' | 'disabled'>;\ntype EmphasisIconColorsType = 'staticWhite' | 'gray';\ntype IconColorToken = `interactive.icon.${EmphasisIconColorsType}.${IconColorStates}`;\n\ntype StyledPressableProps = {\n emphasis: SubtleOrIntense;\n} & BladeCommonEvents;\n\nconst StyledPressable = styled.Pressable<StyledPressableProps>({\n alignSelf: 'center', // ensure button only takes needed width\n});\n\nconst StyledIconButton = React.forwardRef<View, StyledIconButtonProps>(\n (\n {\n icon: Icon,\n isDisabled,\n onClick,\n onBlur,\n onFocus,\n onMouseLeave,\n onMouseMove,\n onPointerDown,\n onPointerEnter,\n onTouchEnd,\n onTouchStart,\n size,\n emphasis,\n accessibilityLabel,\n },\n ref,\n ) => {\n const [isPressed, setIsPressed] = useState(false);\n const getIconColorToken = (): IconColorToken => {\n const emphasisColor = emphasis === 'intense' ? 'gray' : 'staticWhite';\n\n if (isDisabled) {\n return `interactive.icon.${emphasisColor}.disabled`;\n }\n\n const state = isPressed ? 'subtle' : 'muted';\n\n return `interactive.icon.${emphasisColor}.${state}`;\n };\n const iconColorToken = getIconColorToken();\n\n return (\n <StyledPressable\n ref={ref as any}\n emphasis={emphasis}\n onPress={castNativeType(onClick)}\n disabled={isDisabled}\n onPressIn={() => setIsPressed(true)}\n onPressOut={() => setIsPressed(false)}\n onBlur={onBlur}\n onFocus={onFocus}\n onMouseLeave={onMouseLeave}\n onMouseMove={onMouseMove}\n onPointerDown={onPointerDown}\n onPointerEnter={onPointerEnter}\n onTouchEnd={onTouchEnd}\n onTouchStart={onTouchStart}\n {...makeAccessible({ label: accessibilityLabel, role: 'button' })}\n >\n <Icon size={size} color={iconColorToken} />\n </StyledPressable>\n );\n },\n);\n\nexport default StyledIconButton;\n"],"names":["StyledPressable","styled","Pressable","alignSelf","StyledIconButton","React","forwardRef","_ref","ref","Icon","icon","isDisabled","onClick","onBlur","onFocus","onMouseLeave","onMouseMove","onPointerDown","onPointerEnter","onTouchEnd","onTouchStart","size","emphasis","accessibilityLabel","_useState","useState","_useState2","_slicedToArray","isPressed","setIsPressed","getIconColorToken","emphasisColor","state","iconColorToken","_jsx","Object","assign","onPress","castNativeType","disabled","onPressIn","onPressOut","makeAccessible","label","role","children","color"],"mappings":";;;;;;;;;AAoBA,IAAMA,eAAe,CAAGC,MAAM,CAACC,SAAS,CAAuB,CAC7DC,SAAS,CAAE,QACb,CAAC,CAAC,CAEI,IAAAC,gBAAgB,CAAGC,cAAK,CAACC,UAAU,CACvC,SAAAC,IAAA,CAiBEC,GAAG,CACA,CAAA,IAhBKC,IAAI,CAAAF,IAAA,CAAVG,IAAI,CACJC,UAAU,CAAAJ,IAAA,CAAVI,UAAU,CACVC,OAAO,CAAAL,IAAA,CAAP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B,UAAW,CACrB6B,SAAS,CAAE,SAAAA,SAAA,EAAA,CAAA,OAAMX,YAAY,CAAC,IAAI,CAAC,EAAC,CACpCY,UAAU,CAAE,SAAAA,YAAM,CAAA,OAAAZ,YAAY,CAAC,KAAK,CAAC,CAAA,CAAC,CACtChB,MAAM,CAAEA,MAAO,CACfC,OAAO,CAAEA,OAAQ,CACjBC,YAAY,CAAEA,YAAa,CAC3BC,WAAW,CAAEA,WAAY,CACzBC,aAAa,CAAEA,aAAc,CAC7BC,cAAc,CAAEA,cAAe,CAC/BC,UAAU,CAAEA,UAAW,CACvBC,YAAY,CAAEA,YAAa,CAAA,CACvBsB,cAAc,CAAC,CAAEC,KAAK,CAAEpB,kBAAkB,CAAEqB,IAAI,CAAE,QAAS,CAAC,CAAC,CAAA,CAAAC,QAAA,CAEjEX,GAAA,CAACzB,IAAI,EAACY,IAAI,CAAEA,IAAK,CAACyB,KAAK,CAAEb,cAAe,CAAE,CAAC,CAAA,CAC5B,CAAC,CAEtB,CACF;;;;"}
1
+ {"version":3,"file":"StyledIconButton.native.js","sources":["../../../../../../src/components/Button/IconButton/StyledIconButton.native.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable react/display-name */\nimport React, { useState } from 'react';\nimport styled from 'styled-components/native';\n\nimport type { View } from 'react-native';\nimport type { StyledIconButtonProps } from './types';\nimport type { Emphasis, SubtleOrIntense } from '~tokens/theme/theme';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport type { BladeCommonEvents } from '~components/types';\nimport { castNativeType } from '~utils';\n\ntype IconColorStates = keyof Pick<Emphasis, 'muted' | 'subtle' | 'disabled'>;\ntype EmphasisIconColorsType = 'staticWhite' | 'gray';\ntype IconColorToken = `interactive.icon.${EmphasisIconColorsType}.${IconColorStates}`;\n\ntype StyledPressableProps = {\n emphasis: SubtleOrIntense;\n} & BladeCommonEvents;\n\nconst StyledPressable = styled.Pressable<StyledPressableProps>({\n alignSelf: 'center', // ensure button only takes needed width\n});\n\nconst StyledIconButton = React.forwardRef<View, StyledIconButtonProps>(\n (\n {\n icon: Icon,\n isDisabled,\n onClick,\n onBlur,\n onFocus,\n onMouseLeave,\n onMouseMove,\n onPointerDown,\n onPointerEnter,\n onTouchEnd,\n onTouchStart,\n size,\n emphasis,\n accessibilityLabel,\n accessibilityProps,\n },\n ref,\n ) => {\n const [isPressed, setIsPressed] = useState(false);\n const getIconColorToken = (): IconColorToken => {\n const emphasisColor = emphasis === 'intense' ? 'gray' : 'staticWhite';\n\n if (isDisabled) {\n return `interactive.icon.${emphasisColor}.disabled`;\n }\n\n const state = isPressed ? 'subtle' : 'muted';\n\n return `interactive.icon.${emphasisColor}.${state}`;\n };\n const iconColorToken = getIconColorToken();\n\n return (\n <StyledPressable\n ref={ref as any}\n emphasis={emphasis}\n onPress={castNativeType(onClick)}\n disabled={isDisabled}\n onPressIn={() => setIsPressed(true)}\n onPressOut={() => setIsPressed(false)}\n onBlur={onBlur}\n onFocus={onFocus}\n onMouseLeave={onMouseLeave}\n onMouseMove={onMouseMove}\n onPointerDown={onPointerDown}\n onPointerEnter={onPointerEnter}\n onTouchEnd={onTouchEnd}\n onTouchStart={onTouchStart}\n {...makeAccessible({\n ...accessibilityProps,\n label: accessibilityLabel ?? accessibilityProps?.label,\n role: accessibilityProps?.role ?? 'button',\n })}\n >\n <Icon size={size} color={iconColorToken} />\n </StyledPressable>\n );\n },\n);\n\nexport default StyledIconButton;\n"],"names":["StyledPressable","styled","Pressable","alignSelf","StyledIconButton","React","forwardRef","_ref","ref","_accessibilityProps$r","Icon","icon","isDisabled","onClick","onBlur","onFocus","onMouseLeave","onMouseMove","onPointerDown","onPointerEnter","onTouchEnd","onTouchStart","size","emphasis","accessibilityLabel","accessibilityProps","_useState","useState","_useState2","_slicedToArray","isPressed","setIsPressed","getIconColorToken","emphasisColor","state","iconColorToken","_jsx","Object","assign","onPress","castNativeType","disabled","onPressIn","onPressOut","makeAccessible","label","role","children","color"],"mappings":";;;;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}
@@ -22,7 +22,7 @@ import { mergeRefs } from '../../utils/useMergeRefs.js';
22
22
  import { makeAnalyticsAttribute } from '../../utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js';
23
23
  import { jsx } from 'react/jsx-runtime';
24
24
 
25
- var _excluded=["children","isOpen","onOpenChange","selectionType","testID","_width"];var validDropdownChildren=[dropdownComponentIds.BaseBox,dropdownComponentIds.triggers.SelectInput,dropdownComponentIds.triggers.SearchInput,dropdownComponentIds.triggers.DropdownButton,dropdownComponentIds.triggers.DropdownLink,dropdownComponentIds.DropdownOverlay,dropdownComponentIds.triggers.AutoComplete,ComponentIds.BottomSheet];var _Dropdown=function _Dropdown(_ref,ref){var children=_ref.children,isOpenControlled=_ref.isOpen,onOpenChange=_ref.onOpenChange,_ref$selectionType=_ref.selectionType,selectionType=_ref$selectionType===void 0?'single':_ref$selectionType,testID=_ref.testID,_width=_ref._width,rest=_objectWithoutProperties(_ref,_excluded);var _React$useState=React__default.useState([]),_React$useState2=_slicedToArray(_React$useState,2),options=_React$useState2[0],setOptions=_React$useState2[1];var _React$useState3=React__default.useState([]),_React$useState4=_slicedToArray(_React$useState3,2),filteredValues=_React$useState4[0],setFilteredValues=_React$useState4[1];var _React$useState5=React__default.useState([]),_React$useState6=_slicedToArray(_React$useState5,2),selectedIndices=_React$useState6[0],setSelectedIndices=_React$useState6[1];var _React$useState7=React__default.useState([]),_React$useState8=_slicedToArray(_React$useState7,2),controlledValueIndices=_React$useState8[0],setControlledValueIndices=_React$useState8[1];var _React$useState9=React__default.useState(-1),_React$useState10=_slicedToArray(_React$useState9,2),activeIndex=_React$useState10[0],setActiveIndex=_React$useState10[1];var _React$useState11=React__default.useState(-1),_React$useState12=_slicedToArray(_React$useState11,2),activeTagIndex=_React$useState12[0],setActiveTagIndex=_React$useState12[1];var _React$useState13=React__default.useState(false),_React$useState14=_slicedToArray(_React$useState13,2),shouldIgnoreBlurAnimation=_React$useState14[0],setShouldIgnoreBlurAnimation=_React$useState14[1];var _React$useState15=React__default.useState(false),_React$useState16=_slicedToArray(_React$useState15,2),hasFooterAction=_React$useState16[0],setHasFooterAction=_React$useState16[1];var _React$useState17=React__default.useState(false),_React$useState18=_slicedToArray(_React$useState17,2),hasAutoCompleteInBottomSheetHeader=_React$useState18[0],setHasAutoCompleteInBottomSheetHeader=_React$useState18[1];var _React$useState19=React__default.useState(false),_React$useState20=_slicedToArray(_React$useState19,2),isKeydownPressed=_React$useState20[0],setIsKeydownPressed=_React$useState20[1];var _React$useState21=React__default.useState(0),_React$useState22=_slicedToArray(_React$useState21,2),changeCallbackTriggerer=_React$useState22[0],setChangeCallbackTriggerer=_React$useState22[1];var _React$useState23=React__default.useState(false),_React$useState24=_slicedToArray(_React$useState23,2),isControlled=_React$useState24[0],setIsControlled=_React$useState24[1];var _React$useState25=React__default.useState(false),_React$useState26=_slicedToArray(_React$useState25,2),dropdownHasBottomSheet=_React$useState26[0],setDropdownHasBottomSheet=_React$useState26[1];var triggererWrapperRef=React__default.useRef(null);var triggererRef=React__default.useRef(null);var actionListItemRef=React__default.useRef(null);var dropdownTriggerer=React__default.useRef();var isTagDismissedRef=React__default.useRef({value:false});var visibleTagsCountRef=React__default.useRef({value:0});var dropdownContainerRef=React__default.useRef(null);var dropdownBaseId=useId('dropdown');var isDropdownOpenRef=React__default.useRef(isOpenControlled);var _useControllableState=useControllableState({value:isOpenControlled,defaultValue:false,onChange:function onChange(isOpenControlledValue){isDropdownOpenRef.current=isOpenControlledValue;onOpenChange==null?void 0:onOpenChange(isOpenControlledValue);}}),_useControllableState2=_slicedToArray(_useControllableState,2),isDropdownOpen=_useControllableState2[0],setIsDropdownOpen=_useControllableState2[1];isDropdownOpenRef.current=isDropdownOpen;var setIsOpen=function setIsOpen(isOpenValue){isDropdownOpenRef.current=isOpenValue;setIsDropdownOpen(function(){return isOpenValue;});};var close=React__default.useCallback(function(){setActiveTagIndex(-1);setIsOpen(false);},[]);React__default.Children.map(children,function(child){if(React__default.isValidElement(child)){if(__DEV__){var _getComponentId;if(!validDropdownChildren.includes((_getComponentId=getComponentId(child))!=null?_getComponentId:'')){throwBladeError({message:`Dropdown can only have one of following elements as children - \n\n ${validDropdownChildren.join(', ')} \n\n Check out: https://blade.razorpay.com/?path=/story/components-dropdown`,moduleName:'Dropdown'});}}if(isValidAllowedChildren(child,dropdownComponentIds.triggers.SelectInput)){dropdownTriggerer.current='SelectInput';}if(isValidAllowedChildren(child,dropdownComponentIds.triggers.SearchInput)){dropdownTriggerer.current='SearchInput';}if(isValidAllowedChildren(child,dropdownComponentIds.triggers.DropdownButton)){dropdownTriggerer.current='DropdownButton';}if(isValidAllowedChildren(child,dropdownComponentIds.triggers.AutoComplete)){dropdownTriggerer.current='AutoComplete';}}});var contextValue=React__default.useMemo(function(){return {isOpen:isDropdownOpen,setIsOpen:setIsOpen,close:close,selectedIndices:selectedIndices,setSelectedIndices:setSelectedIndices,controlledValueIndices:controlledValueIndices,setControlledValueIndices:setControlledValueIndices,options:options,setOptions:setOptions,filteredValues:filteredValues,setFilteredValues:setFilteredValues,activeIndex:activeIndex,setActiveIndex:setActiveIndex,activeTagIndex:activeTagIndex,setActiveTagIndex:setActiveTagIndex,visibleTagsCountRef:visibleTagsCountRef,shouldIgnoreBlurAnimation:shouldIgnoreBlurAnimation,setShouldIgnoreBlurAnimation:setShouldIgnoreBlurAnimation,isKeydownPressed:isKeydownPressed,setIsKeydownPressed:setIsKeydownPressed,dropdownBaseId:dropdownBaseId,triggererRef:triggererRef,triggererWrapperRef:triggererWrapperRef,actionListItemRef:actionListItemRef,selectionType:selectionType,hasFooterAction:hasFooterAction,setHasFooterAction:setHasFooterAction,hasAutoCompleteInBottomSheetHeader:hasAutoCompleteInBottomSheetHeader,setHasAutoCompleteInBottomSheetHeader:setHasAutoCompleteInBottomSheetHeader,dropdownTriggerer:dropdownTriggerer.current,changeCallbackTriggerer:changeCallbackTriggerer,setChangeCallbackTriggerer:setChangeCallbackTriggerer,isControlled:isControlled,setIsControlled:setIsControlled,isTagDismissedRef:isTagDismissedRef};},[isDropdownOpen,isOpenControlled,selectedIndices,controlledValueIndices,options,filteredValues,activeIndex,activeTagIndex,shouldIgnoreBlurAnimation,selectionType,hasFooterAction,isKeydownPressed,changeCallbackTriggerer,isControlled]);var BottomSheetAndDropdownGlueContextValue=React__default.useMemo(function(){return {isOpen:isDropdownOpen,dropdownHasBottomSheet:dropdownHasBottomSheet,hasAutoCompleteInBottomSheetHeader:hasAutoCompleteInBottomSheetHeader,setDropdownHasBottomSheet:setDropdownHasBottomSheet,onBottomSheetDismiss:close};},[dropdownHasBottomSheet,hasAutoCompleteInBottomSheetHeader,isDropdownOpen,close]);return jsx(BottomSheetAndDropdownGlueContext.Provider,{value:BottomSheetAndDropdownGlueContextValue,children:jsx(DropdownContext.Provider,{value:contextValue,children:jsx(BaseBox,Object.assign({ref:mergeRefs(ref,dropdownContainerRef)},metaAttribute({name:MetaConstants.Dropdown,testID:testID}),getStyledProps(rest),makeAnalyticsAttribute(rest),{width:_width,children:jsx(BaseBox,{position:"relative",textAlign:'left',children:children})}))})});};var Dropdown=assignWithoutSideEffects(React__default.forwardRef(_Dropdown),{componentId:dropdownComponentIds.Dropdown});
25
+ var _excluded=["children","isOpen","onOpenChange","selectionType","testID","_width"];var validDropdownChildren=[dropdownComponentIds.BaseBox,dropdownComponentIds.triggers.SelectInput,dropdownComponentIds.triggers.SearchInput,dropdownComponentIds.triggers.DropdownButton,dropdownComponentIds.triggers.DropdownIconButton,dropdownComponentIds.triggers.DropdownLink,dropdownComponentIds.DropdownOverlay,dropdownComponentIds.triggers.AutoComplete,ComponentIds.BottomSheet];var _Dropdown=function _Dropdown(_ref,ref){var children=_ref.children,isOpenControlled=_ref.isOpen,onOpenChange=_ref.onOpenChange,_ref$selectionType=_ref.selectionType,selectionType=_ref$selectionType===void 0?'single':_ref$selectionType,testID=_ref.testID,_width=_ref._width,rest=_objectWithoutProperties(_ref,_excluded);var _React$useState=React__default.useState([]),_React$useState2=_slicedToArray(_React$useState,2),options=_React$useState2[0],setOptions=_React$useState2[1];var _React$useState3=React__default.useState([]),_React$useState4=_slicedToArray(_React$useState3,2),filteredValues=_React$useState4[0],setFilteredValues=_React$useState4[1];var _React$useState5=React__default.useState([]),_React$useState6=_slicedToArray(_React$useState5,2),selectedIndices=_React$useState6[0],setSelectedIndices=_React$useState6[1];var _React$useState7=React__default.useState([]),_React$useState8=_slicedToArray(_React$useState7,2),controlledValueIndices=_React$useState8[0],setControlledValueIndices=_React$useState8[1];var _React$useState9=React__default.useState(-1),_React$useState10=_slicedToArray(_React$useState9,2),activeIndex=_React$useState10[0],setActiveIndex=_React$useState10[1];var _React$useState11=React__default.useState(-1),_React$useState12=_slicedToArray(_React$useState11,2),activeTagIndex=_React$useState12[0],setActiveTagIndex=_React$useState12[1];var _React$useState13=React__default.useState(false),_React$useState14=_slicedToArray(_React$useState13,2),shouldIgnoreBlurAnimation=_React$useState14[0],setShouldIgnoreBlurAnimation=_React$useState14[1];var _React$useState15=React__default.useState(false),_React$useState16=_slicedToArray(_React$useState15,2),hasFooterAction=_React$useState16[0],setHasFooterAction=_React$useState16[1];var _React$useState17=React__default.useState(false),_React$useState18=_slicedToArray(_React$useState17,2),hasAutoCompleteInBottomSheetHeader=_React$useState18[0],setHasAutoCompleteInBottomSheetHeader=_React$useState18[1];var _React$useState19=React__default.useState(false),_React$useState20=_slicedToArray(_React$useState19,2),isKeydownPressed=_React$useState20[0],setIsKeydownPressed=_React$useState20[1];var _React$useState21=React__default.useState(0),_React$useState22=_slicedToArray(_React$useState21,2),changeCallbackTriggerer=_React$useState22[0],setChangeCallbackTriggerer=_React$useState22[1];var _React$useState23=React__default.useState(false),_React$useState24=_slicedToArray(_React$useState23,2),isControlled=_React$useState24[0],setIsControlled=_React$useState24[1];var _React$useState25=React__default.useState(false),_React$useState26=_slicedToArray(_React$useState25,2),dropdownHasBottomSheet=_React$useState26[0],setDropdownHasBottomSheet=_React$useState26[1];var triggererWrapperRef=React__default.useRef(null);var triggererRef=React__default.useRef(null);var actionListItemRef=React__default.useRef(null);var dropdownTriggerer=React__default.useRef();var isTagDismissedRef=React__default.useRef({value:false});var visibleTagsCountRef=React__default.useRef({value:0});var dropdownContainerRef=React__default.useRef(null);var dropdownBaseId=useId('dropdown');var isDropdownOpenRef=React__default.useRef(isOpenControlled);var _useControllableState=useControllableState({value:isOpenControlled,defaultValue:false,onChange:function onChange(isOpenControlledValue){isDropdownOpenRef.current=isOpenControlledValue;onOpenChange==null?void 0:onOpenChange(isOpenControlledValue);}}),_useControllableState2=_slicedToArray(_useControllableState,2),isDropdownOpen=_useControllableState2[0],setIsDropdownOpen=_useControllableState2[1];isDropdownOpenRef.current=isDropdownOpen;var setIsOpen=function setIsOpen(isOpenValue){isDropdownOpenRef.current=isOpenValue;setIsDropdownOpen(function(){return isOpenValue;});};var close=React__default.useCallback(function(){setActiveTagIndex(-1);setIsOpen(false);},[]);React__default.Children.map(children,function(child){if(React__default.isValidElement(child)){if(__DEV__){var _getComponentId;if(!validDropdownChildren.includes((_getComponentId=getComponentId(child))!=null?_getComponentId:'')){throwBladeError({message:`Dropdown can only have one of following elements as children - \n\n ${validDropdownChildren.join(', ')} \n\n Check out: https://blade.razorpay.com/?path=/story/components-dropdown`,moduleName:'Dropdown'});}}if(isValidAllowedChildren(child,dropdownComponentIds.triggers.SelectInput)){dropdownTriggerer.current='SelectInput';}if(isValidAllowedChildren(child,dropdownComponentIds.triggers.SearchInput)){dropdownTriggerer.current='SearchInput';}if(isValidAllowedChildren(child,dropdownComponentIds.triggers.DropdownButton)){dropdownTriggerer.current='DropdownButton';}if(isValidAllowedChildren(child,dropdownComponentIds.triggers.DropdownIconButton)){dropdownTriggerer.current='DropdownIconButton';}if(isValidAllowedChildren(child,dropdownComponentIds.triggers.AutoComplete)){dropdownTriggerer.current='AutoComplete';}}});var contextValue=React__default.useMemo(function(){return {isOpen:isDropdownOpen,setIsOpen:setIsOpen,close:close,selectedIndices:selectedIndices,setSelectedIndices:setSelectedIndices,controlledValueIndices:controlledValueIndices,setControlledValueIndices:setControlledValueIndices,options:options,setOptions:setOptions,filteredValues:filteredValues,setFilteredValues:setFilteredValues,activeIndex:activeIndex,setActiveIndex:setActiveIndex,activeTagIndex:activeTagIndex,setActiveTagIndex:setActiveTagIndex,visibleTagsCountRef:visibleTagsCountRef,shouldIgnoreBlurAnimation:shouldIgnoreBlurAnimation,setShouldIgnoreBlurAnimation:setShouldIgnoreBlurAnimation,isKeydownPressed:isKeydownPressed,setIsKeydownPressed:setIsKeydownPressed,dropdownBaseId:dropdownBaseId,triggererRef:triggererRef,triggererWrapperRef:triggererWrapperRef,actionListItemRef:actionListItemRef,selectionType:selectionType,hasFooterAction:hasFooterAction,setHasFooterAction:setHasFooterAction,hasAutoCompleteInBottomSheetHeader:hasAutoCompleteInBottomSheetHeader,setHasAutoCompleteInBottomSheetHeader:setHasAutoCompleteInBottomSheetHeader,dropdownTriggerer:dropdownTriggerer.current,changeCallbackTriggerer:changeCallbackTriggerer,setChangeCallbackTriggerer:setChangeCallbackTriggerer,isControlled:isControlled,setIsControlled:setIsControlled,isTagDismissedRef:isTagDismissedRef};},[isDropdownOpen,isOpenControlled,selectedIndices,controlledValueIndices,options,filteredValues,activeIndex,activeTagIndex,shouldIgnoreBlurAnimation,selectionType,hasFooterAction,isKeydownPressed,changeCallbackTriggerer,isControlled]);var BottomSheetAndDropdownGlueContextValue=React__default.useMemo(function(){return {isOpen:isDropdownOpen,dropdownHasBottomSheet:dropdownHasBottomSheet,hasAutoCompleteInBottomSheetHeader:hasAutoCompleteInBottomSheetHeader,setDropdownHasBottomSheet:setDropdownHasBottomSheet,onBottomSheetDismiss:close};},[dropdownHasBottomSheet,hasAutoCompleteInBottomSheetHeader,isDropdownOpen,close]);return jsx(BottomSheetAndDropdownGlueContext.Provider,{value:BottomSheetAndDropdownGlueContextValue,children:jsx(DropdownContext.Provider,{value:contextValue,children:jsx(BaseBox,Object.assign({ref:mergeRefs(ref,dropdownContainerRef)},metaAttribute({name:MetaConstants.Dropdown,testID:testID}),getStyledProps(rest),makeAnalyticsAttribute(rest),{width:_width,children:jsx(BaseBox,{position:"relative",textAlign:'left',children:children})}))})});};var Dropdown=assignWithoutSideEffects(React__default.forwardRef(_Dropdown),{componentId:dropdownComponentIds.Dropdown});
26
26
 
27
27
  export { Dropdown };
28
28
  //# sourceMappingURL=Dropdown.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Dropdown.js","sources":["../../../../../src/components/Dropdown/Dropdown.tsx"],"sourcesContent":["import React from 'react';\nimport { DropdownContext } from './useDropdown';\nimport type { DropdownContextType } from './useDropdown';\nimport type { DropdownProps } from './types';\nimport { dropdownComponentIds } from './dropdownComponentIds';\nimport { useId } from '~utils/useId';\nimport { ComponentIds as bottomSheetComponentIds } from '~components/BottomSheet/componentIds';\nimport { BottomSheetAndDropdownGlueContext } from '~components/BottomSheet/BottomSheetContext';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport BaseBox from '~components/Box/BaseBox';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getComponentId, isValidAllowedChildren } from '~utils/isValidAllowedChildren';\nimport { MetaConstants, metaAttribute } from '~utils/metaAttribute';\nimport { throwBladeError } from '~utils/logger';\nimport type { BladeElementRef, ContainerElementType } from '~utils/types';\nimport { useControllableState } from '~utils/useControllable';\nimport { mergeRefs } from '~utils/useMergeRefs';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\nconst validDropdownChildren = [\n // TODO: Remove Box once CountrySelector's button sizing is fixed\n dropdownComponentIds.BaseBox,\n dropdownComponentIds.triggers.SelectInput,\n dropdownComponentIds.triggers.SearchInput,\n dropdownComponentIds.triggers.DropdownButton,\n dropdownComponentIds.triggers.DropdownLink,\n dropdownComponentIds.DropdownOverlay,\n dropdownComponentIds.triggers.AutoComplete,\n bottomSheetComponentIds.BottomSheet,\n];\n\n/**\n * ### Dropdown component\n *\n * Dropdown component is generic component that controls the dropdown functionality.\n * It can be used with multiple triggers and mostly contains ActionList component inside it\n *\n * ---\n *\n * #### Usage\n *\n * ```jsx\n * <Dropdown selectionType=\"single\">\n * <SelectInput />\n * <DropdownOverlay>\n * <ActionList>\n * <ActionListItem />\n * <ActionListItem />\n * </ActionList>\n * </DropdownOverlay>\n * </Dropdown>\n * ```\n *\n * ---\n *\n * Checkout {@link https://blade.razorpay.com/?path=/docs/components-dropdown-with-select--with-single-select Dropdown Documentation}\n */\nconst _Dropdown = (\n {\n children,\n isOpen: isOpenControlled,\n onOpenChange,\n selectionType = 'single',\n testID,\n _width,\n ...rest\n }: DropdownProps,\n ref: React.Ref<BladeElementRef>,\n): React.ReactElement => {\n const [options, setOptions] = React.useState<DropdownContextType['options']>([]);\n const [filteredValues, setFilteredValues] = React.useState<string[]>([]);\n const [selectedIndices, setSelectedIndices] = React.useState<\n DropdownContextType['selectedIndices']\n >([]);\n const [controlledValueIndices, setControlledValueIndices] = React.useState<\n DropdownContextType['selectedIndices']\n >([]);\n const [activeIndex, setActiveIndex] = React.useState(-1);\n const [activeTagIndex, setActiveTagIndex] = React.useState(-1);\n const [shouldIgnoreBlurAnimation, setShouldIgnoreBlurAnimation] = React.useState(false);\n const [hasFooterAction, setHasFooterAction] = React.useState(false);\n const [\n hasAutoCompleteInBottomSheetHeader,\n setHasAutoCompleteInBottomSheetHeader,\n ] = React.useState(false);\n const [isKeydownPressed, setIsKeydownPressed] = React.useState(false);\n const [changeCallbackTriggerer, setChangeCallbackTriggerer] = React.useState<\n DropdownContextType['changeCallbackTriggerer']\n >(0);\n const [isControlled, setIsControlled] = React.useState(false);\n // keep track if dropdown contains bottomsheet\n const [dropdownHasBottomSheet, setDropdownHasBottomSheet] = React.useState(false);\n\n /**\n * In inputs, actual input is smaller than the visible input wrapper.\n * You can set this reference in such cases so floating ui calculations happen correctly\n * */\n const triggererWrapperRef = React.useRef<ContainerElementType>(null);\n const triggererRef = React.useRef<HTMLButtonElement>(null);\n const actionListItemRef = React.useRef<HTMLDivElement>(null);\n const dropdownTriggerer = React.useRef<DropdownContextType['dropdownTriggerer']>();\n const isTagDismissedRef = React.useRef<{ value: boolean } | null>({ value: false });\n const visibleTagsCountRef = React.useRef<{ value: number }>({ value: 0 });\n const dropdownContainerRef = React.useRef<HTMLDivElement>(null);\n\n const dropdownBaseId = useId('dropdown');\n const isDropdownOpenRef = React.useRef(isOpenControlled);\n\n const [isDropdownOpen, setIsDropdownOpen] = useControllableState({\n value: isOpenControlled,\n defaultValue: false,\n onChange: (isOpenControlledValue) => {\n isDropdownOpenRef.current = isOpenControlledValue;\n onOpenChange?.(isOpenControlledValue);\n },\n });\n\n isDropdownOpenRef.current = isDropdownOpen;\n\n const setIsOpen = (isOpenValue: boolean): void => {\n isDropdownOpenRef.current = isOpenValue;\n setIsDropdownOpen(() => isOpenValue);\n };\n\n const close = React.useCallback(() => {\n setActiveTagIndex(-1);\n setIsOpen(false);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n React.Children.map(children, (child) => {\n if (React.isValidElement(child)) {\n if (__DEV__) {\n if (!validDropdownChildren.includes(getComponentId(child) ?? '')) {\n throwBladeError({\n message: `Dropdown can only have one of following elements as children - \\n\\n ${validDropdownChildren.join(\n ', ',\n )} \\n\\n Check out: https://blade.razorpay.com/?path=/story/components-dropdown`,\n moduleName: 'Dropdown',\n });\n }\n }\n\n if (isValidAllowedChildren(child, dropdownComponentIds.triggers.SelectInput)) {\n dropdownTriggerer.current = 'SelectInput';\n }\n\n if (isValidAllowedChildren(child, dropdownComponentIds.triggers.SearchInput)) {\n dropdownTriggerer.current = 'SearchInput';\n }\n\n if (isValidAllowedChildren(child, dropdownComponentIds.triggers.DropdownButton)) {\n dropdownTriggerer.current = 'DropdownButton';\n }\n\n if (isValidAllowedChildren(child, dropdownComponentIds.triggers.AutoComplete)) {\n dropdownTriggerer.current = 'AutoComplete';\n }\n }\n });\n\n const contextValue = React.useMemo<DropdownContextType>(\n () => ({\n isOpen: isDropdownOpen,\n setIsOpen,\n close,\n selectedIndices,\n setSelectedIndices,\n controlledValueIndices,\n setControlledValueIndices,\n options,\n setOptions,\n filteredValues,\n setFilteredValues,\n activeIndex,\n setActiveIndex,\n activeTagIndex,\n setActiveTagIndex,\n visibleTagsCountRef,\n shouldIgnoreBlurAnimation,\n setShouldIgnoreBlurAnimation,\n isKeydownPressed,\n setIsKeydownPressed,\n dropdownBaseId,\n triggererRef,\n triggererWrapperRef,\n actionListItemRef,\n selectionType,\n hasFooterAction,\n setHasFooterAction,\n hasAutoCompleteInBottomSheetHeader,\n setHasAutoCompleteInBottomSheetHeader,\n dropdownTriggerer: dropdownTriggerer.current,\n changeCallbackTriggerer,\n setChangeCallbackTriggerer,\n isControlled,\n setIsControlled,\n isTagDismissedRef,\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n isDropdownOpen,\n isOpenControlled,\n selectedIndices,\n controlledValueIndices,\n options,\n filteredValues,\n activeIndex,\n activeTagIndex,\n shouldIgnoreBlurAnimation,\n selectionType,\n hasFooterAction,\n isKeydownPressed,\n changeCallbackTriggerer,\n isControlled,\n ],\n );\n\n const BottomSheetAndDropdownGlueContextValue = React.useMemo((): BottomSheetAndDropdownGlueContext => {\n return {\n isOpen: isDropdownOpen,\n dropdownHasBottomSheet,\n hasAutoCompleteInBottomSheetHeader,\n setDropdownHasBottomSheet,\n // This is the dismiss function which will be injected into the BottomSheet\n // Basically <BottomSheet onDismiss={onBottomSheetDismiss} />\n onBottomSheetDismiss: close,\n };\n }, [dropdownHasBottomSheet, hasAutoCompleteInBottomSheetHeader, isDropdownOpen, close]);\n\n return (\n <BottomSheetAndDropdownGlueContext.Provider value={BottomSheetAndDropdownGlueContextValue}>\n <DropdownContext.Provider value={contextValue}>\n <BaseBox\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref={mergeRefs(ref, dropdownContainerRef as any)}\n {...metaAttribute({ name: MetaConstants.Dropdown, testID })}\n {...getStyledProps(rest)}\n {...makeAnalyticsAttribute(rest)}\n width={_width}\n >\n <BaseBox position=\"relative\" textAlign={'left' as never}>\n {children}\n </BaseBox>\n </BaseBox>\n </DropdownContext.Provider>\n </BottomSheetAndDropdownGlueContext.Provider>\n );\n};\n\nconst Dropdown = assignWithoutSideEffects(React.forwardRef(_Dropdown), {\n componentId: dropdownComponentIds.Dropdown,\n});\n\nexport { Dropdown };\n"],"names":["validDropdownChildren","dropdownComponentIds","BaseBox","triggers","SelectInput","SearchInput","DropdownButton","DropdownLink","DropdownOverlay","AutoComplete","bottomSheetComponentIds","BottomSheet","_Dropdown","_ref","ref","children","isOpenControlled","isOpen","onOpenChange","_ref$selectionType","selectionType","testID","_width","rest","_objectWithoutProperties","_excluded","_React$useState","React","useState","_React$useState2","_slicedToArray","options","setOptions","_React$useState3","_React$useState4","filteredValues","setFilteredValues","_React$useState5","_React$useState6","selectedIndices","setSelectedIndices","_React$useState7","_React$useState8","controlledValueIndices","setControlledValueIndices","_React$useState9","_React$useState10","activeIndex","setActiveIndex","_React$useState11","_React$useState12","activeTagIndex","setActiveTagIndex","_React$useState13","_React$useState14","shouldIgnoreBlurAnimation","setShouldIgnoreBlurAnimation","_React$useState15","_React$useState16","hasFooterAction","setHasFooterAction","_React$useState17","_React$useState18","hasAutoCompleteInBottomSheetHeader","setHasAutoCompleteInBottomSheetHeader","_React$useState19","_React$useState20","isKeydownPressed","setIsKeydownPressed","_React$useState21","_React$useState22","changeCallbackTriggerer","setChangeCallbackTriggerer","_React$useState23","_React$useState24","isControlled","setIsControlled","_React$useState25","_React$useState26","dropdownHasBottomSheet","setDropdownHasBottomSheet","triggererWrapperRef","useRef","triggererRef","actionListItemRef","dropdownTriggerer","isTagDismissedRef","value","visibleTagsCountRef","dropdownContainerRef","dropdownBaseId","useId","isDropdownOpenRef","_useControllableState","useControllableState","defaultValue","onChange","isOpenControlledValue","current","_useControllableState2","isDropdownOpen","setIsDropdownOpen","setIsOpen","isOpenValue","close","useCallback","Children","map","child","isValidElement","__DEV__","_getComponentId","includes","getComponentId","throwBladeError","message","join","moduleName","isValidAllowedChildren","contextValue","useMemo","BottomSheetAndDropdownGlueContextValue","onBottomSheetDismiss","_jsx","BottomSheetAndDropdownGlueContext","Provider","DropdownContext","Object","assign","mergeRefs","metaAttribute","name","MetaConstants","Dropdown","getStyledProps","makeAnalyticsAttribute","width","position","textAlign","assignWithoutSideEffects","forwardRef","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,SAAA,CAAA,CAAA,UAAA,CAAA,QAAA,CAAA,cAAA,CAAA,eAAA,CAAA,QAAA,CAAA,QAAA,CAAA,CAmBA,IAAMA,qBAAqB,CAAG,CAE5BC,oBAAoB,CAACC,OAAO,CAC5BD,oBAAoB,CAACE,QAAQ,CAACC,WAAW,CACzCH,oBAAoB,CAACE,QAAQ,CAACE,WAAW,CACzCJ,oBAAoB,CAACE,QAAQ,CAACG,cAAc,CAC5CL,oBAAoB,CAACE,QAAQ,CAACI,YAAY,CAC1CN,oBAAoB,CAACO,eAAe,CACpCP,oBAAoB,CAACE,QAAQ,CAACM,YAAY,CAC1CC,YAAuB,CAACC,WAAW,CACpC,CA4BD,IAAMC,SAAS,CAAG,SAAZA,SAASA,CAAAC,IAAA,CAUbC,GAA+B,CACR,CATrB,IAAAC,QAAQ,CAAAF,IAAA,CAARE,QAAQ,CACAC,gBAAgB,CAAAH,IAAA,CAAxBI,MAAM,CACNC,YAAY,CAAAL,IAAA,CAAZK,YAAY,CAAAC,kBAAA,CAAAN,IAAA,CACZO,aAAa,CAAbA,aAAa,CAAAD,kBAAA,GAAG,KAAA,CAAA,CAAA,QAAQ,CAAAA,kBAAA,CACxBE,MAAM,CAAAR,IAAA,CAANQ,MAAM,CACNC,MAAM,CAAAT,IAAA,CAANS,MAAM,CACHC,IAAI,CAAAC,wBAAA,CAAAX,IAAA,CAAAY,SAAA,CAAA,CAIT,IAAAC,eAAA,CAA8BC,cAAK,CAACC,QAAQ,CAAiC,EAAE,CAAC,CAAAC,gBAAA,CAAAC,cAAA,CAAAJ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CAAC,CACpBgH,sBAAsB,CAAChH,IAAI,CAAC,CAAA,CAChCiH,KAAK,CAAElH,MAAO,CAAAP,QAAA,CAEd4G,GAAA,CAACzH,OAAO,CAACuI,CAAAA,QAAQ,CAAC,UAAU,CAACC,SAAS,CAAE,MAAgB,CAAA3H,QAAA,CACrDA,QAAQ,CACF,CAAC,CACH,CAAA,CAAC,CACc,CAAC,CACe,CAAC,CAEjD,CAAC,CAEK,IAAAsH,QAAQ,CAAGM,wBAAwB,CAAChH,cAAK,CAACiH,UAAU,CAAChI,SAAS,CAAC,CAAE,CACrEiI,WAAW,CAAE5I,oBAAoB,CAACoI,QACpC,CAAC;;;;"}
1
+ {"version":3,"file":"Dropdown.js","sources":["../../../../../src/components/Dropdown/Dropdown.tsx"],"sourcesContent":["import React from 'react';\nimport { DropdownContext } from './useDropdown';\nimport type { DropdownContextType } from './useDropdown';\nimport type { DropdownProps } from './types';\nimport { dropdownComponentIds } from './dropdownComponentIds';\nimport { useId } from '~utils/useId';\nimport { ComponentIds as bottomSheetComponentIds } from '~components/BottomSheet/componentIds';\nimport { BottomSheetAndDropdownGlueContext } from '~components/BottomSheet/BottomSheetContext';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport BaseBox from '~components/Box/BaseBox';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getComponentId, isValidAllowedChildren } from '~utils/isValidAllowedChildren';\nimport { MetaConstants, metaAttribute } from '~utils/metaAttribute';\nimport { throwBladeError } from '~utils/logger';\nimport type { BladeElementRef, ContainerElementType } from '~utils/types';\nimport { useControllableState } from '~utils/useControllable';\nimport { mergeRefs } from '~utils/useMergeRefs';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\nconst validDropdownChildren = [\n // TODO: Remove Box once CountrySelector's button sizing is fixed\n dropdownComponentIds.BaseBox,\n dropdownComponentIds.triggers.SelectInput,\n dropdownComponentIds.triggers.SearchInput,\n dropdownComponentIds.triggers.DropdownButton,\n dropdownComponentIds.triggers.DropdownIconButton,\n dropdownComponentIds.triggers.DropdownLink,\n dropdownComponentIds.DropdownOverlay,\n dropdownComponentIds.triggers.AutoComplete,\n bottomSheetComponentIds.BottomSheet,\n];\n\n/**\n * ### Dropdown component\n *\n * Dropdown component is generic component that controls the dropdown functionality.\n * It can be used with multiple triggers and mostly contains ActionList component inside it\n *\n * ---\n *\n * #### Usage\n *\n * ```jsx\n * <Dropdown selectionType=\"single\">\n * <SelectInput />\n * <DropdownOverlay>\n * <ActionList>\n * <ActionListItem />\n * <ActionListItem />\n * </ActionList>\n * </DropdownOverlay>\n * </Dropdown>\n * ```\n *\n * ---\n *\n * Checkout {@link https://blade.razorpay.com/?path=/docs/components-dropdown-with-select--with-single-select Dropdown Documentation}\n */\nconst _Dropdown = (\n {\n children,\n isOpen: isOpenControlled,\n onOpenChange,\n selectionType = 'single',\n testID,\n _width,\n ...rest\n }: DropdownProps,\n ref: React.Ref<BladeElementRef>,\n): React.ReactElement => {\n const [options, setOptions] = React.useState<DropdownContextType['options']>([]);\n const [filteredValues, setFilteredValues] = React.useState<string[]>([]);\n const [selectedIndices, setSelectedIndices] = React.useState<\n DropdownContextType['selectedIndices']\n >([]);\n const [controlledValueIndices, setControlledValueIndices] = React.useState<\n DropdownContextType['selectedIndices']\n >([]);\n const [activeIndex, setActiveIndex] = React.useState(-1);\n const [activeTagIndex, setActiveTagIndex] = React.useState(-1);\n const [shouldIgnoreBlurAnimation, setShouldIgnoreBlurAnimation] = React.useState(false);\n const [hasFooterAction, setHasFooterAction] = React.useState(false);\n const [\n hasAutoCompleteInBottomSheetHeader,\n setHasAutoCompleteInBottomSheetHeader,\n ] = React.useState(false);\n const [isKeydownPressed, setIsKeydownPressed] = React.useState(false);\n const [changeCallbackTriggerer, setChangeCallbackTriggerer] = React.useState<\n DropdownContextType['changeCallbackTriggerer']\n >(0);\n const [isControlled, setIsControlled] = React.useState(false);\n // keep track if dropdown contains bottomsheet\n const [dropdownHasBottomSheet, setDropdownHasBottomSheet] = React.useState(false);\n\n /**\n * In inputs, actual input is smaller than the visible input wrapper.\n * You can set this reference in such cases so floating ui calculations happen correctly\n * */\n const triggererWrapperRef = React.useRef<ContainerElementType>(null);\n const triggererRef = React.useRef<HTMLButtonElement>(null);\n const actionListItemRef = React.useRef<HTMLDivElement>(null);\n const dropdownTriggerer = React.useRef<DropdownContextType['dropdownTriggerer']>();\n const isTagDismissedRef = React.useRef<{ value: boolean } | null>({ value: false });\n const visibleTagsCountRef = React.useRef<{ value: number }>({ value: 0 });\n const dropdownContainerRef = React.useRef<HTMLDivElement>(null);\n\n const dropdownBaseId = useId('dropdown');\n const isDropdownOpenRef = React.useRef(isOpenControlled);\n\n const [isDropdownOpen, setIsDropdownOpen] = useControllableState({\n value: isOpenControlled,\n defaultValue: false,\n onChange: (isOpenControlledValue) => {\n isDropdownOpenRef.current = isOpenControlledValue;\n onOpenChange?.(isOpenControlledValue);\n },\n });\n\n isDropdownOpenRef.current = isDropdownOpen;\n\n const setIsOpen = (isOpenValue: boolean): void => {\n isDropdownOpenRef.current = isOpenValue;\n setIsDropdownOpen(() => isOpenValue);\n };\n\n const close = React.useCallback(() => {\n setActiveTagIndex(-1);\n setIsOpen(false);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n React.Children.map(children, (child) => {\n if (React.isValidElement(child)) {\n if (__DEV__) {\n if (!validDropdownChildren.includes(getComponentId(child) ?? '')) {\n throwBladeError({\n message: `Dropdown can only have one of following elements as children - \\n\\n ${validDropdownChildren.join(\n ', ',\n )} \\n\\n Check out: https://blade.razorpay.com/?path=/story/components-dropdown`,\n moduleName: 'Dropdown',\n });\n }\n }\n\n if (isValidAllowedChildren(child, dropdownComponentIds.triggers.SelectInput)) {\n dropdownTriggerer.current = 'SelectInput';\n }\n\n if (isValidAllowedChildren(child, dropdownComponentIds.triggers.SearchInput)) {\n dropdownTriggerer.current = 'SearchInput';\n }\n\n if (isValidAllowedChildren(child, dropdownComponentIds.triggers.DropdownButton)) {\n dropdownTriggerer.current = 'DropdownButton';\n }\n\n if (isValidAllowedChildren(child, dropdownComponentIds.triggers.DropdownIconButton)) {\n dropdownTriggerer.current = 'DropdownIconButton';\n }\n\n if (isValidAllowedChildren(child, dropdownComponentIds.triggers.AutoComplete)) {\n dropdownTriggerer.current = 'AutoComplete';\n }\n }\n });\n\n const contextValue = React.useMemo<DropdownContextType>(\n () => ({\n isOpen: isDropdownOpen,\n setIsOpen,\n close,\n selectedIndices,\n setSelectedIndices,\n controlledValueIndices,\n setControlledValueIndices,\n options,\n setOptions,\n filteredValues,\n setFilteredValues,\n activeIndex,\n setActiveIndex,\n activeTagIndex,\n setActiveTagIndex,\n visibleTagsCountRef,\n shouldIgnoreBlurAnimation,\n setShouldIgnoreBlurAnimation,\n isKeydownPressed,\n setIsKeydownPressed,\n dropdownBaseId,\n triggererRef,\n triggererWrapperRef,\n actionListItemRef,\n selectionType,\n hasFooterAction,\n setHasFooterAction,\n hasAutoCompleteInBottomSheetHeader,\n setHasAutoCompleteInBottomSheetHeader,\n dropdownTriggerer: dropdownTriggerer.current,\n changeCallbackTriggerer,\n setChangeCallbackTriggerer,\n isControlled,\n setIsControlled,\n isTagDismissedRef,\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n isDropdownOpen,\n isOpenControlled,\n selectedIndices,\n controlledValueIndices,\n options,\n filteredValues,\n activeIndex,\n activeTagIndex,\n shouldIgnoreBlurAnimation,\n selectionType,\n hasFooterAction,\n isKeydownPressed,\n changeCallbackTriggerer,\n isControlled,\n ],\n );\n\n const BottomSheetAndDropdownGlueContextValue = React.useMemo((): BottomSheetAndDropdownGlueContext => {\n return {\n isOpen: isDropdownOpen,\n dropdownHasBottomSheet,\n hasAutoCompleteInBottomSheetHeader,\n setDropdownHasBottomSheet,\n // This is the dismiss function which will be injected into the BottomSheet\n // Basically <BottomSheet onDismiss={onBottomSheetDismiss} />\n onBottomSheetDismiss: close,\n };\n }, [dropdownHasBottomSheet, hasAutoCompleteInBottomSheetHeader, isDropdownOpen, close]);\n\n return (\n <BottomSheetAndDropdownGlueContext.Provider value={BottomSheetAndDropdownGlueContextValue}>\n <DropdownContext.Provider value={contextValue}>\n <BaseBox\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref={mergeRefs(ref, dropdownContainerRef as any)}\n {...metaAttribute({ name: MetaConstants.Dropdown, testID })}\n {...getStyledProps(rest)}\n {...makeAnalyticsAttribute(rest)}\n width={_width}\n >\n <BaseBox position=\"relative\" textAlign={'left' as never}>\n {children}\n </BaseBox>\n </BaseBox>\n </DropdownContext.Provider>\n </BottomSheetAndDropdownGlueContext.Provider>\n );\n};\n\nconst Dropdown = assignWithoutSideEffects(React.forwardRef(_Dropdown), {\n componentId: dropdownComponentIds.Dropdown,\n});\n\nexport { Dropdown };\n"],"names":["validDropdownChildren","dropdownComponentIds","BaseBox","triggers","SelectInput","SearchInput","DropdownButton","DropdownIconButton","DropdownLink","DropdownOverlay","AutoComplete","bottomSheetComponentIds","BottomSheet","_Dropdown","_ref","ref","children","isOpenControlled","isOpen","onOpenChange","_ref$selectionType","selectionType","testID","_width","rest","_objectWithoutProperties","_excluded","_React$useState","React","useState","_React$useState2","_slicedToArray","options","setOptions","_React$useState3","_React$useState4","filteredValues","setFilteredValues","_React$useState5","_React$useState6","selectedIndices","setSelectedIndices","_React$useState7","_React$useState8","controlledValueIndices","setControlledValueIndices","_React$useState9","_React$useState10","activeIndex","setActiveIndex","_React$useState11","_React$useState12","activeTagIndex","setActiveTagIndex","_React$useState13","_React$useState14","shouldIgnoreBlurAnimation","setShouldIgnoreBlurAnimation","_React$useState15","_React$useState16","hasFooterAction","setHasFooterAction","_React$useState17","_React$useState18","hasAutoCompleteInBottomSheetHeader","setHasAutoCompleteInBottomSheetHeader","_React$useState19","_React$useState20","isKeydownPressed","setIsKeydownPressed","_React$useState21","_React$useState22","changeCallbackTriggerer","setChangeCallbackTriggerer","_React$useState23","_React$useState24","isControlled","setIsControlled","_React$useState25","_React$useState26","dropdownHasBottomSheet","setDropdownHasBottomSheet","triggererWrapperRef","useRef","triggererRef","actionListItemRef","dropdownTriggerer","isTagDismissedRef","value","visibleTagsCountRef","dropdownContainerRef","dropdownBaseId","useId","isDropdownOpenRef","_useControllableState","useControllableState","defaultValue","onChange","isOpenControlledValue","current","_useControllableState2","isDropdownOpen","setIsDropdownOpen","setIsOpen","isOpenValue","close","useCallback","Children","map","child","isValidElement","__DEV__","_getComponentId","includes","getComponentId","throwBladeError","message","join","moduleName","isValidAllowedChildren","contextValue","useMemo","BottomSheetAndDropdownGlueContextValue","onBottomSheetDismiss","_jsx","BottomSheetAndDropdownGlueContext","Provider","DropdownContext","Object","assign","mergeRefs","metaAttribute","name","MetaConstants","Dropdown","getStyledProps","makeAnalyticsAttribute","width","position","textAlign","assignWithoutSideEffects","forwardRef","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,SAAA,CAAA,CAAA,UAAA,CAAA,QAAA,CAAA,cAAA,CAAA,eAAA,CAAA,QAAA,CAAA,QAAA,CAAA,CAmBA,IAAMA,qBAAqB,CAAG,CAE5BC,oBAAoB,CAACC,OAAO,CAC5BD,oBAAoB,CAACE,QAAQ,CAACC,WAAW,CACzCH,oBAAoB,CAACE,QAAQ,CAACE,WAAW,CACzCJ,oBAAoB,CAACE,QAAQ,CAACG,cAAc,CAC5CL,oBAAoB,CAACE,QAAQ,CAACI,kBAAkB,CAChDN,oBAAoB,CAACE,QAAQ,CAACK,YAAY,CAC1CP,oBAAoB,CAACQ,eAAe,CACpCR,oBAAoB,CAACE,QAAQ,CAACO,YAAY,CAC1CC,YAAuB,CAACC,WAAW,CACpC,CA4BD,IAAMC,SAAS,CAAG,SAAZA,SAASA,CAAAC,IAAA,CAUbC,GAA+B,CACR,CAAA,IATrBC,QAAQ,CAAAF,IAAA,CAARE,QAAQ,CACAC,gBAAgB,CAAAH,IAAA,CAAxBI,MAAM,CACNC,YAAY,CAAAL,IAAA,CAAZK,YAAY,CA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BrB,sBAAsB,CAAtBA,sBAAsB,CACtBhB,kCAAkC,CAAlCA,kCAAkC,CAClCiB,yBAAyB,CAAzBA,yBAAyB,CAGzB0C,oBAAoB,CAAElB,KACxB,CAAC,CACH,CAAC,CAAE,CAACzB,sBAAsB,CAAEhB,kCAAkC,CAAEqC,cAAc,CAAEI,KAAK,CAAC,CAAC,CAEvF,OACEmB,GAAA,CAACC,iCAAiC,CAACC,QAAQ,CAAA,CAACtC,KAAK,CAAEkC,sCAAuC,CAAA1G,QAAA,CACxF4G,GAAA,CAACG,eAAe,CAACD,QAAQ,EAACtC,KAAK,CAAEgC,YAAa,CAAAxG,QAAA,CAC5C4G,GAAA,CAAC1H,OAAO,CAAA8H,MAAA,CAAAC,MAAA,CAAA,CAENlH,GAAG,CAAEmH,SAAS,CAACnH,GAAG,CAAE2E,oBAA2B,CAAE,CAC7CyC,CAAAA,aAAa,CAAC,CAAEC,IAAI,CAAEC,aAAa,CAACC,QAAQ,CAAEhH,MAAM,CAANA,MAAO,CAAC,CAAC,CACvDiH,cAAc,CAAC/G,IAAI,CAAC,CACpBgH,sBAAsB,CAAChH,IAAI,CAAC,CAAA,CAChCiH,KAAK,CAAElH,MAAO,CAAAP,QAAA,CAEd4G,GAAA,CAAC1H,OAAO,CAAA,CAACwI,QAAQ,CAAC,UAAU,CAACC,SAAS,CAAE,MAAgB,CAAA3H,QAAA,CACrDA,QAAQ,CACF,CAAC,CAAA,CACH,CAAC,CACc,CAAC,CACe,CAAC,CAEjD,CAAC,CAEK,IAAAsH,QAAQ,CAAGM,wBAAwB,CAAChH,cAAK,CAACiH,UAAU,CAAChI,SAAS,CAAC,CAAE,CACrEiI,WAAW,CAAE7I,oBAAoB,CAACqI,QACpC,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownButton.js","sources":["../../../../../src/components/Dropdown/DropdownButton.tsx"],"sourcesContent":["import React from 'react';\nimport { useDropdown } from './useDropdown';\nimport { dropdownComponentIds } from './dropdownComponentIds';\nimport BaseButton from '~components/Button/BaseButton';\nimport type { ButtonProps } from '~components/Button';\nimport { getActionListContainerRole } from '~components/ActionList/getA11yRoles';\nimport type { BaseButtonProps } from '~components/Button/BaseButton/BaseButton';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\n\ntype DropdownButtonProps = ButtonProps & {\n onBlur?: BaseButtonProps['onBlur'];\n onKeyDown?: BaseButtonProps['onKeyDown'];\n};\n\nconst _DropdownButton = ({\n children,\n icon,\n iconPosition = 'left',\n isDisabled = false,\n isFullWidth = false,\n isLoading = false,\n onClick,\n onBlur,\n onKeyDown,\n size = 'medium',\n type = 'button',\n variant = 'primary',\n accessibilityLabel,\n testID,\n ...rest\n}: DropdownButtonProps): React.ReactElement => {\n const {\n onTriggerClick,\n onTriggerKeydown,\n dropdownBaseId,\n isOpen,\n activeIndex,\n hasFooterAction,\n triggererRef,\n } = useDropdown();\n\n return (\n // Using BaseButton here to avoid exporting onBlur and onKeyDown from Button\n // If in future we decide to export onBlur and onKeyDown on Button, this can be replaced with Button\n <BaseButton\n {...rest}\n {...(icon ? { icon, children } : { children })}\n iconPosition={iconPosition}\n isDisabled={isDisabled}\n isFullWidth={isFullWidth}\n isLoading={isLoading}\n size={size}\n type={type}\n variant={variant}\n testID={testID}\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref={triggererRef as any}\n accessibilityProps={{\n label: accessibilityLabel,\n hasPopup: getActionListContainerRole(hasFooterAction, 'DropdownButton'),\n expanded: isOpen,\n controls: `${dropdownBaseId}-actionlist`,\n activeDescendant: activeIndex >= 0 ? `${dropdownBaseId}-${activeIndex}` : undefined,\n }}\n onClick={(e) => {\n onTriggerClick();\n // Setting it for web fails it on native typecheck and vice versa\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion, @typescript-eslint/no-explicit-any\n onClick?.(e as any);\n }}\n onBlur={(e) => {\n // With button trigger, there is no \"value\" as such. It's just clickable items\n // Setting it for web fails it on native typecheck and vice versa\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion, @typescript-eslint/no-explicit-any\n onBlur?.(e as any);\n }}\n onKeyDown={(e) => {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion, @typescript-eslint/no-explicit-any\n onTriggerKeydown?.({ event: e as any });\n // Setting it for web fails it on native typecheck and vice versa\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion, @typescript-eslint/no-explicit-any\n onKeyDown?.(e as any);\n }}\n />\n );\n};\n\nconst DropdownButton = assignWithoutSideEffects(_DropdownButton, {\n componentId: dropdownComponentIds.triggers.DropdownButton,\n});\n\nexport { DropdownButton };\n"],"names":["_DropdownButton","_ref","children","icon","_ref$iconPosition","iconPosition","_ref$isDisabled","isDisabled","_ref$isFullWidth","isFullWidth","_ref$isLoading","isLoading","onClick","onBlur","onKeyDown","_ref$size","size","_ref$type","type","_ref$variant","variant","accessibilityLabel","testID","rest","_objectWithoutProperties","_excluded","_useDropdown","useDropdown","onTriggerClick","onTriggerKeydown","dropdownBaseId","isOpen","activeIndex","hasFooterAction","triggererRef","_jsx","BaseButton","Object","assign","ref","accessibilityProps","label","hasPopup","getActionListContainerRole","expanded","controls","activeDescendant","undefined","e","event","DropdownButton","assignWithoutSideEffects","componentId","dropdownComponentIds","triggers"],"mappings":";;;;;;;;;6KAcA,IAAMA,eAAe,CAAG,SAAlBA,eAAeA,CAAAC,IAAA,CAgB0B,CAf7C,IAAAC,QAAQ,CAAAD,IAAA,CAARC,QAAQ,CACRC,IAAI,CAAAF,IAAA,CAAJE,IAAI,CAAAC,iBAAA,CAAAH,IAAA,CACJI,YAAY,CAAZA,YAAY,CAAAD,iBAAA,GAAG,KAAA,CAAA,CAAA,MAAM,CAAAA,iBAAA,CAAAE,eAAA,CAAAL,IAAA,CACrBM,UAAU,CAAVA,UAAU,CAAAD,eAAA,GAAG,KAAA,CAAA,CAAA,KAAK,CAAAA,eAAA,CAAAE,gBAAA,CAAAP,IAAA,CAClBQ,WAAW,C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AAE,CAC/DoD,WAAW,CAAEC,oBAAoB,CAACC,QAAQ,CAACJ,cAC7C,CAAC;;;;"}
1
+ {"version":3,"file":"DropdownButton.js","sources":["../../../../../src/components/Dropdown/DropdownButton.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */\n\nimport React from 'react';\nimport { useDropdown } from './useDropdown';\nimport { dropdownComponentIds } from './dropdownComponentIds';\nimport BaseButton from '~components/Button/BaseButton';\nimport type { ButtonProps } from '~components/Button';\nimport { getActionListContainerRole } from '~components/ActionList/getA11yRoles';\nimport type { BaseButtonProps } from '~components/Button/BaseButton/BaseButton';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\n\ntype DropdownButtonProps = ButtonProps & {\n onBlur?: BaseButtonProps['onBlur'];\n onKeyDown?: BaseButtonProps['onKeyDown'];\n};\n\nconst _DropdownButton = ({\n children,\n icon,\n iconPosition = 'left',\n isDisabled = false,\n isFullWidth = false,\n isLoading = false,\n onClick,\n onBlur,\n onKeyDown,\n size = 'medium',\n type = 'button',\n variant = 'primary',\n accessibilityLabel,\n testID,\n ...rest\n}: DropdownButtonProps): React.ReactElement => {\n const {\n onTriggerClick,\n onTriggerKeydown,\n dropdownBaseId,\n isOpen,\n activeIndex,\n hasFooterAction,\n triggererRef,\n } = useDropdown();\n\n return (\n // Using BaseButton here to avoid exporting onBlur and onKeyDown from Button\n // If in future we decide to export onBlur and onKeyDown on Button, this can be replaced with Button\n <BaseButton\n {...rest}\n {...(icon ? { icon, children } : { children })}\n iconPosition={iconPosition}\n isDisabled={isDisabled}\n isFullWidth={isFullWidth}\n isLoading={isLoading}\n size={size}\n type={type}\n variant={variant}\n testID={testID}\n ref={triggererRef as any}\n accessibilityProps={{\n label: accessibilityLabel,\n hasPopup: getActionListContainerRole(hasFooterAction, 'DropdownButton'),\n expanded: isOpen,\n controls: `${dropdownBaseId}-actionlist`,\n activeDescendant: activeIndex >= 0 ? `${dropdownBaseId}-${activeIndex}` : undefined,\n }}\n onClick={(e) => {\n onTriggerClick();\n // Setting it for web fails it on native typecheck and vice versa\n onClick?.(e as any);\n }}\n onBlur={(e) => {\n // With button trigger, there is no \"value\" as such. It's just clickable items\n // Setting it for web fails it on native typecheck and vice versa\n onBlur?.(e as any);\n }}\n onKeyDown={(e) => {\n onTriggerKeydown?.({ event: e as any });\n // Setting it for web fails it on native typecheck and vice versa\n onKeyDown?.(e as any);\n }}\n />\n );\n};\n\nconst DropdownButton = assignWithoutSideEffects(_DropdownButton, {\n componentId: dropdownComponentIds.triggers.DropdownButton,\n});\n\nexport { DropdownButton };\n"],"names":["_DropdownButton","_ref","children","icon","_ref$iconPosition","iconPosition","_ref$isDisabled","isDisabled","_ref$isFullWidth","isFullWidth","_ref$isLoading","isLoading","onClick","onBlur","onKeyDown","_ref$size","size","_ref$type","type","_ref$variant","variant","accessibilityLabel","testID","rest","_objectWithoutProperties","_excluded","_useDropdown","useDropdown","onTriggerClick","onTriggerKeydown","dropdownBaseId","isOpen","activeIndex","hasFooterAction","triggererRef","_jsx","BaseButton","Object","assign","ref","accessibilityProps","label","hasPopup","getActionListContainerRole","expanded","controls","activeDescendant","undefined","e","event","DropdownButton","assignWithoutSideEffects","componentId","dropdownComponentIds","triggers"],"mappings":";;;;;;;;;6KAiBA,IAAMA,eAAe,CAAG,SAAlBA,eAAeA,CAAAC,IAAA,CAgB0B,CAf7C,IAAAC,QAAQ,CAAAD,IAAA,CAARC,QAAQ,CACRC,IAAI,CAAAF,IAAA,CAAJE,IAAI,CAAAC,iBAAA,CAAAH,IAAA,CACJI,YAAY,CAAZA,YAAY,CAAAD,iBAAA,GAAG,KAAA,CAAA,CAAA,MAAM,CAAAA,iBAAA,CAAAE,eAAA,CAAAL,IAAA,CACrBM,UAAU,CAAVA,UAAU,CAAAD,eAAA,GAAG,KAAA,CAAA,CAAA,KAAK,CAAAA,eAAA,CAAAE,gBAAA,CAAAP,IAAA,CAClBQ,W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e,CAAE,CAC/DoD,WAAW,CAAEC,oBAAoB,CAACC,QAAQ,CAACJ,cAC7C,CAAC;;;;"}
@@ -0,0 +1,13 @@
1
+ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
2
+ import 'react';
3
+ import { useDropdown } from './useDropdown.js';
4
+ import { dropdownComponentIds } from './dropdownComponentIds.js';
5
+ import { getActionListContainerRole } from '../ActionList/getA11yRoles.js';
6
+ import { assignWithoutSideEffects } from '../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
7
+ import StyledIconButton from '../Button/IconButton/StyledIconButton.native.js';
8
+ import { jsx } from 'react/jsx-runtime';
9
+
10
+ var _excluded=["icon","isDisabled","onClick","onBlur","onKeyDown","size","accessibilityLabel","emphasis"];var _DropdownIconButton=function _DropdownIconButton(_ref){var icon=_ref.icon,_ref$isDisabled=_ref.isDisabled,isDisabled=_ref$isDisabled===void 0?false:_ref$isDisabled,_onClick=_ref.onClick,_onBlur=_ref.onBlur,_onKeyDown=_ref.onKeyDown,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,accessibilityLabel=_ref.accessibilityLabel,_ref$emphasis=_ref.emphasis,emphasis=_ref$emphasis===void 0?'intense':_ref$emphasis,rest=_objectWithoutProperties(_ref,_excluded);var _useDropdown=useDropdown(),onTriggerClick=_useDropdown.onTriggerClick,onTriggerKeydown=_useDropdown.onTriggerKeydown,dropdownBaseId=_useDropdown.dropdownBaseId,isOpen=_useDropdown.isOpen,activeIndex=_useDropdown.activeIndex,hasFooterAction=_useDropdown.hasFooterAction,triggererRef=_useDropdown.triggererRef;return jsx(StyledIconButton,Object.assign({},rest,{icon:icon,isDisabled:isDisabled,size:size,emphasis:emphasis,ref:triggererRef,accessibilityLabel:accessibilityLabel,accessibilityProps:{label:accessibilityLabel,hasPopup:getActionListContainerRole(hasFooterAction,'DropdownIconButton'),expanded:isOpen,controls:`${dropdownBaseId}-actionlist`,activeDescendant:activeIndex>=0?`${dropdownBaseId}-${activeIndex}`:undefined},onClick:function onClick(e){onTriggerClick();_onClick==null?void 0:_onClick(e);},onBlur:function onBlur(e){_onBlur==null?void 0:_onBlur(e);},onKeyDown:function onKeyDown(e){onTriggerKeydown==null?void 0:onTriggerKeydown({event:e});_onKeyDown==null?void 0:_onKeyDown(e);}}));};var DropdownIconButton=assignWithoutSideEffects(_DropdownIconButton,{componentId:dropdownComponentIds.triggers.DropdownIconButton});
11
+
12
+ export { DropdownIconButton };
13
+ //# sourceMappingURL=DropdownIconButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DropdownIconButton.js","sources":["../../../../../src/components/Dropdown/DropdownIconButton.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */\n\nimport React from 'react';\nimport { useDropdown } from './useDropdown';\nimport { dropdownComponentIds } from './dropdownComponentIds';\nimport { getActionListContainerRole } from '~components/ActionList/getA11yRoles';\nimport type { BaseButtonProps } from '~components/Button/BaseButton/BaseButton';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport type { IconButtonProps } from '~components/Button/IconButton';\nimport StyledIconButton from '~components/Button/IconButton/StyledIconButton';\n\ntype DropdownIconButtonProps = Omit<IconButtonProps, 'onClick'> & {\n onBlur?: BaseButtonProps['onBlur'];\n onKeyDown?: BaseButtonProps['onKeyDown'];\n onClick?: IconButtonProps['onClick'];\n};\n\nconst _DropdownIconButton = ({\n icon,\n isDisabled = false,\n onClick,\n onBlur,\n onKeyDown,\n size = 'medium',\n accessibilityLabel,\n emphasis = 'intense',\n ...rest\n}: DropdownIconButtonProps): React.ReactElement => {\n const {\n onTriggerClick,\n onTriggerKeydown,\n dropdownBaseId,\n isOpen,\n activeIndex,\n hasFooterAction,\n triggererRef,\n } = useDropdown();\n\n return (\n // Using StyledIconButton here to avoid exporting onKeydown, and accessibiltiyProps object\n <StyledIconButton\n {...rest}\n icon={icon}\n isDisabled={isDisabled}\n size={size}\n emphasis={emphasis}\n ref={triggererRef as any}\n accessibilityLabel={accessibilityLabel}\n accessibilityProps={{\n label: accessibilityLabel,\n hasPopup: getActionListContainerRole(hasFooterAction, 'DropdownIconButton'),\n expanded: isOpen,\n controls: `${dropdownBaseId}-actionlist`,\n activeDescendant: activeIndex >= 0 ? `${dropdownBaseId}-${activeIndex}` : undefined,\n }}\n onClick={(e) => {\n onTriggerClick();\n // Setting it for web fails it on native typecheck and vice versa\n onClick?.(e as any);\n }}\n onBlur={(e) => {\n // With button trigger, there is no \"value\" as such. It's just clickable items\n // Setting it for web fails it on native typecheck and vice versa\n onBlur?.(e as any);\n }}\n onKeyDown={(e) => {\n onTriggerKeydown?.({ event: e as any });\n // Setting it for web fails it on native typecheck and vice versa\n onKeyDown?.(e as any);\n }}\n />\n );\n};\n\nconst DropdownIconButton = assignWithoutSideEffects(_DropdownIconButton, {\n componentId: dropdownComponentIds.triggers.DropdownIconButton,\n});\n\nexport { DropdownIconButton };\n"],"names":["_DropdownIconButton","_ref","icon","_ref$isDisabled","isDisabled","onClick","onBlur","onKeyDown","_ref$size","size","accessibilityLabel","_ref$emphasis","emphasis","rest","_objectWithoutProperties","_excluded","_useDropdown","useDropdown","onTriggerClick","onTriggerKeydown","dropdownBaseId","isOpen","activeIndex","hasFooterAction","triggererRef","_jsx","StyledIconButton","Object","assign","ref","accessibilityProps","label","hasPopup","getActionListContainerRole","expanded","controls","activeDescendant","undefined","e","event","DropdownIconButton","assignWithoutSideEffects","componentId","dropdownComponentIds","triggers"],"mappings":";;;;;;;;;AAGA,IAAA,SAAA,CAAA,CAAA,MAAA,CAAA,YAAA,CAAA,SAAA,CAAA,QAAA,CAAA,WAAA,CAAA,MAAA,CAAA,oBAAA,CAAA,UAAA,CAAA,CAeA,IAAMA,mBAAmB,CAAG,SAAtBA,mBAAmBA,CAAAC,IAAA,CAU0B,KATjDC,IAAI,CAAAD,IAAA,CAAJC,IAAI,CAAAC,eAAA,CAAAF,IAAA,CACJG,UAAU,CAA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,CAAG,GAAEf,cAAe,CAAA,WAAA,CAAY,CACxCgB,gBAAgB,CAAEd,WAAW,EAAI,CAAC,CAAI,GAAEF,cAAe,CAAA,CAAA,EAAGE,WAAY,CAAA,CAAC,CAAGe,SAC5E,CAAE,CACFhC,OAAO,CAAE,SAAAA,OAACiC,CAAAA,CAAC,CAAK,CACdpB,cAAc,EAAE,CAEhBb,QAAO,cAAPA,QAAO,CAAGiC,CAAQ,CAAC,CACrB,CAAE,CACFhC,MAAM,CAAE,SAAAA,OAACgC,CAAC,CAAK,CAGbhC,OAAM,cAANA,OAAM,CAAGgC,CAAQ,CAAC,CACpB,CAAE,CACF/B,SAAS,CAAE,SAAAA,SAAC+B,CAAAA,CAAC,CAAK,CAChBnB,gBAAgB,cAAhBA,gBAAgB,CAAG,CAAEoB,KAAK,CAAED,CAAS,CAAC,CAAC,CAEvC/B,UAAS,EAATA,IAAAA,CAAAA,KAAAA,CAAAA,CAAAA,UAAS,CAAG+B,CAAQ,CAAC,CACvB,CAAE,EACH,CAAC,CAEN,CAAC,CAEK,IAAAE,kBAAkB,CAAGC,wBAAwB,CAACzC,mBAAmB,CAAE,CACvE0C,WAAW,CAAEC,oBAAoB,CAACC,QAAQ,CAACJ,kBAC7C,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownLink.js","sources":["../../../../../src/components/Dropdown/DropdownLink.tsx"],"sourcesContent":["import React from 'react';\nimport { getActionListContainerRole } from '../ActionList/getA11yRoles';\nimport { BaseLink } from '../Link/BaseLink';\nimport type { BaseLinkProps } from '../Link/BaseLink';\nimport type { LinkButtonVariantProps } from '../Link';\nimport { useDropdown } from './useDropdown';\nimport { dropdownComponentIds } from './dropdownComponentIds';\nimport { assignWithoutSideEffects } from '~src/utils/assignWithoutSideEffects';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\ntype DropdownLinkProps = LinkButtonVariantProps & {\n onBlur?: BaseLinkProps['onBlur'];\n onKeyDown?: BaseLinkProps['onKeyDown'];\n};\n\nconst _DropdownLink = ({\n children,\n icon,\n iconPosition = 'left',\n onClick,\n onBlur,\n onKeyDown,\n isDisabled,\n href,\n target,\n rel,\n accessibilityLabel,\n size = 'medium',\n testID,\n hitSlop,\n htmlTitle,\n ...props\n}: DropdownLinkProps): React.ReactElement => {\n const {\n onTriggerClick,\n onTriggerKeydown,\n dropdownBaseId,\n isOpen,\n activeIndex,\n hasFooterAction,\n triggererRef,\n } = useDropdown();\n\n return (\n // Using BaseButton here to avoid exporting onBlur and onKeyDown from Button\n // If in future we decide to export onBlur and onKeyDown on Button, this can be replaced with Button\n <BaseLink\n variant=\"button\"\n {...(icon ? { icon, children } : { children })}\n iconPosition={iconPosition}\n size={size}\n testID={testID}\n hitSlop={hitSlop}\n htmlTitle={htmlTitle}\n isDisabled={isDisabled}\n {...props}\n {...makeAnalyticsAttribute(props)}\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref={triggererRef as any}\n accessibilityProps={{\n label: accessibilityLabel,\n hasPopup: getActionListContainerRole(hasFooterAction, 'DropdownButton'),\n expanded: isOpen,\n controls: `${dropdownBaseId}-actionlist`,\n activeDescendant: activeIndex >= 0 ? `${dropdownBaseId}-${activeIndex}` : undefined,\n }}\n onClick={(e) => {\n onTriggerClick();\n // Setting it for web fails it on native typecheck and vice versa\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion, @typescript-eslint/no-explicit-any\n onClick?.(e as any);\n }}\n onBlur={(e) => {\n // Setting it for web fails it on native typecheck and vice versa\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion, @typescript-eslint/no-explicit-any\n onBlur?.(e as any);\n }}\n onKeyDown={(e) => {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion, @typescript-eslint/no-explicit-any\n onTriggerKeydown?.({ event: e as any });\n // Setting it for web fails it on native typecheck and vice versa\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion, @typescript-eslint/no-explicit-any\n onKeyDown?.(e as any);\n }}\n />\n );\n};\n\nconst DropdownLink = assignWithoutSideEffects(_DropdownLink, {\n componentId: dropdownComponentIds.triggers.DropdownLink,\n});\n\nexport { DropdownLink };\n"],"names":["_DropdownLink","_ref","children","icon","_ref$iconPosition","iconPosition","onClick","onBlur","onKeyDown","isDisabled","href","target","rel","accessibilityLabel","_ref$size","size","testID","hitSlop","htmlTitle","props","_objectWithoutProperties","_excluded","_useDropdown","useDropdown","onTriggerClick","onTriggerKeydown","dropdownBaseId","isOpen","activeIndex","hasFooterAction","triggererRef","_jsx","BaseLink","Object","assign","variant","makeAnalyticsAttribute","ref","accessibilityProps","label","hasPopup","getActionListContainerRole","expanded","controls","activeDescendant","undefined","e","event","DropdownLink","assignWithoutSideEffects","componentId","dropdownComponentIds","triggers"],"mappings":";;;;;;;;;;8KAeA,IAAMA,aAAa,CAAG,SAAhBA,aAAaA,CAAAC,IAAA,CAiB0B,CAhB3C,IAAAC,QAAQ,CAAAD,IAAA,CAARC,QAAQ,CACRC,IAAI,CAAAF,IAAA,CAAJE,IAAI,CAAAC,iBAAA,CAAAH,IAAA,CACJI,YAAY,CAAZA,YAAY,CAAAD,iBAAA,GAAG,KAAA,CAAA,CAAA,MAAM,CAAAA,iBAAA,CACrBE,QAAO,CAAAL,IAAA,CAAPK,OAAO,CACPC,OAAM,CAAAN,IAAA,CAANM,MAAM,CACNC,UAAS,CAAAP,IAAA,CAATO,SAAS,CACTC,UAAU,CAAAR,IAAA,CAAVQ,UAAU,CACNR,IAAA,CAAJS,IAAI,CACET,IAAA,CAANU,MAAM,CACHV,IAAA,CAAHW,GAAG,KACHC,kBAAkB,CAAAZ,IAAA,CAAlBY,kBAAkB,CAAAC,SAAA,CAAAb,IAAA,CAClBc,IAAI,CAAJA,IAAI,CAAAD,SAAA,UAAG,QAAQ,CAAAA,SAAA,CACfE,MAAM,CAAAf,IAAA,CAANe,MAAM,CACNC,OAAO,CAAAhB,IAAA,CAAPgB,OAAO,CACPC,SAAS,CAAAj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,cAAc,EAAE,CAGhBlB,QAAO,EAAA,IAAA,CAAA,KAAA,CAAA,CAAPA,QAAO,CAAGwC,CAAQ,CAAC,CACrB,CAAE,CACFvC,MAAM,CAAE,SAAAA,MAACuC,CAAAA,CAAC,CAAK,CAGbvC,OAAM,cAANA,OAAM,CAAGuC,CAAQ,CAAC,CACpB,CAAE,CACFtC,SAAS,CAAE,SAAAA,SAACsC,CAAAA,CAAC,CAAK,CAEhBrB,gBAAgB,cAAhBA,gBAAgB,CAAG,CAAEsB,KAAK,CAAED,CAAS,CAAC,CAAC,CAGvCtC,UAAS,EAAA,IAAA,CAAA,KAAA,CAAA,CAATA,UAAS,CAAGsC,CAAQ,CAAC,CACvB,CAAE,CAAA,CACH,CAAC,CAEN,CAAC,CAEK,IAAAE,YAAY,CAAGC,wBAAwB,CAACjD,aAAa,CAAE,CAC3DkD,WAAW,CAAEC,oBAAoB,CAACC,QAAQ,CAACJ,YAC7C,CAAC;;;;"}
1
+ {"version":3,"file":"DropdownLink.js","sources":["../../../../../src/components/Dropdown/DropdownLink.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */\n\nimport React from 'react';\nimport { getActionListContainerRole } from '../ActionList/getA11yRoles';\nimport { BaseLink } from '../Link/BaseLink';\nimport type { BaseLinkProps } from '../Link/BaseLink';\nimport type { LinkButtonVariantProps } from '../Link';\nimport { useDropdown } from './useDropdown';\nimport { dropdownComponentIds } from './dropdownComponentIds';\nimport { assignWithoutSideEffects } from '~src/utils/assignWithoutSideEffects';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\ntype DropdownLinkProps = LinkButtonVariantProps & {\n onBlur?: BaseLinkProps['onBlur'];\n onKeyDown?: BaseLinkProps['onKeyDown'];\n};\n\nconst _DropdownLink = ({\n children,\n icon,\n iconPosition = 'left',\n onClick,\n onBlur,\n onKeyDown,\n isDisabled,\n href,\n target,\n rel,\n accessibilityLabel,\n size = 'medium',\n testID,\n hitSlop,\n htmlTitle,\n ...props\n}: DropdownLinkProps): React.ReactElement => {\n const {\n onTriggerClick,\n onTriggerKeydown,\n dropdownBaseId,\n isOpen,\n activeIndex,\n hasFooterAction,\n triggererRef,\n } = useDropdown();\n\n return (\n // Using BaseButton here to avoid exporting onBlur and onKeyDown from Button\n // If in future we decide to export onBlur and onKeyDown on Button, this can be replaced with Button\n <BaseLink\n variant=\"button\"\n {...(icon ? { icon, children } : { children })}\n iconPosition={iconPosition}\n size={size}\n testID={testID}\n hitSlop={hitSlop}\n htmlTitle={htmlTitle}\n isDisabled={isDisabled}\n {...props}\n {...makeAnalyticsAttribute(props)}\n ref={triggererRef as any}\n accessibilityProps={{\n label: accessibilityLabel,\n hasPopup: getActionListContainerRole(hasFooterAction, 'DropdownButton'),\n expanded: isOpen,\n controls: `${dropdownBaseId}-actionlist`,\n activeDescendant: activeIndex >= 0 ? `${dropdownBaseId}-${activeIndex}` : undefined,\n }}\n onClick={(e) => {\n onTriggerClick();\n // Setting it for web fails it on native typecheck and vice versa\n onClick?.(e as any);\n }}\n onBlur={(e) => {\n // Setting it for web fails it on native typecheck and vice versa\n onBlur?.(e as any);\n }}\n onKeyDown={(e) => {\n onTriggerKeydown?.({ event: e as any });\n // Setting it for web fails it on native typecheck and vice versa\n onKeyDown?.(e as any);\n }}\n />\n );\n};\n\nconst DropdownLink = assignWithoutSideEffects(_DropdownLink, {\n componentId: dropdownComponentIds.triggers.DropdownLink,\n});\n\nexport { DropdownLink };\n"],"names":["_DropdownLink","_ref","children","icon","_ref$iconPosition","iconPosition","onClick","onBlur","onKeyDown","isDisabled","href","target","rel","accessibilityLabel","_ref$size","size","testID","hitSlop","htmlTitle","props","_objectWithoutProperties","_excluded","_useDropdown","useDropdown","onTriggerClick","onTriggerKeydown","dropdownBaseId","isOpen","activeIndex","hasFooterAction","triggererRef","_jsx","BaseLink","Object","assign","variant","makeAnalyticsAttribute","ref","accessibilityProps","label","hasPopup","getActionListContainerRole","expanded","controls","activeDescendant","undefined","e","event","DropdownLink","assignWithoutSideEffects","componentId","dropdownComponentIds","triggers"],"mappings":";;;;;;;;;;8KAkBA,IAAMA,aAAa,CAAG,SAAhBA,aAAaA,CAAAC,IAAA,CAiB0B,CAhB3C,IAAAC,QAAQ,CAAAD,IAAA,CAARC,QAAQ,CACRC,IAAI,CAAAF,IAAA,CAAJE,IAAI,CAAAC,iBAAA,CAAAH,IAAA,CACJI,YAAY,CAAZA,YAAY,CAAAD,iBAAA,GAAG,KAAA,CAAA,CAAA,MAAM,CAAAA,iBAAA,CACrBE,QAAO,CAAAL,IAAA,CAAPK,OAAO,CACPC,OAAM,CAAAN,IAAA,CAANM,MAAM,CACNC,UAAS,CAAAP,IAAA,CAATO,SAAS,CACTC,UAAU,CAAAR,IAAA,CAAVQ,UAAU,CACNR,IAAA,CAAJS,IAAI,CACET,IAAA,CAANU,MAAM,CACHV,IAAA,CAAHW,GAAG,KACHC,kBAAkB,CAAAZ,IAAA,CAAlBY,kBAAkB,CAAAC,SAAA,CAAAb,IAAA,CAClBc,IAAI,CAAJA,IAAI,CAAAD,SAAA,UAAG,QAAQ,CAAAA,SAAA,CACfE,MAAM,CAAAf,IAAA,CAANe,MAAM,CACNC,OAAO,CAAAhB,IAAA,CAAPgB,OAAO,CACPC,SAAS,CAAAjB,IAAA,CAATiB,SAAS,CACNC,KAAK,CAAAC,wBAAA,CAAAnB,IAAA,CAAAoB,SAAA,EAER,IAAAC,YAAA,CAQIC,WAAW,EAAE,CAPfC,cAAc,CAAAF,YAAA,CAAdE,cAAc,CACdC,gBAAgB,CAAAH,YAAA,CAAhBG,gBAAgB,CAChBC,cAAc,CAAAJ,YAAA,CAAdI,cAAc,CACdC,MAAM,CAAAL,YAAA,CAANK,MAAM,CACNC,WAAW,CAAAN,YAAA,CAAXM,WAAW,CACXC,eAAe,CAAAP,YAAA,CAAfO,eAAe,CACfC,YAAY,CAAAR,YAAA,CAAZQ,YAAY,CAGd,OAGE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S,CAAGsC,CAAQ,CAAC,CACvB,CAAE,CAAA,CACH,CAAC,CAEN,CAAC,CAEK,IAAAE,YAAY,CAAGC,wBAAwB,CAACjD,aAAa,CAAE,CAC3DkD,WAAW,CAAEC,oBAAoB,CAACC,QAAQ,CAACJ,YAC7C,CAAC;;;;"}
@@ -1,4 +1,4 @@
1
- var dropdownComponentIds={DropdownOverlay:'DropdownOverlay',Dropdown:'Dropdown',BaseBox:'BaseBox',triggers:{SelectInput:'SelectInput',DropdownButton:'DropdownButton',DropdownLink:'DropdownLink',AutoComplete:'AutoComplete',SearchInput:'SearchInput'}};
1
+ var dropdownComponentIds={DropdownOverlay:'DropdownOverlay',Dropdown:'Dropdown',BaseBox:'BaseBox',triggers:{SelectInput:'SelectInput',DropdownButton:'DropdownButton',DropdownLink:'DropdownLink',AutoComplete:'AutoComplete',SearchInput:'SearchInput',DropdownIconButton:'DropdownIconButton'}};
2
2
 
3
3
  export { dropdownComponentIds };
4
4
  //# sourceMappingURL=dropdownComponentIds.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dropdownComponentIds.js","sources":["../../../../../src/components/Dropdown/dropdownComponentIds.ts"],"sourcesContent":["export const dropdownComponentIds = {\n DropdownOverlay: 'DropdownOverlay',\n Dropdown: 'Dropdown',\n BaseBox: 'BaseBox',\n triggers: {\n SelectInput: 'SelectInput',\n DropdownButton: 'DropdownButton',\n DropdownLink: 'DropdownLink',\n AutoComplete: 'AutoComplete',\n SearchInput: 'SearchInput',\n },\n};\n"],"names":["dropdownComponentIds","DropdownOverlay","Dropdown","BaseBox","triggers","SelectInput","DropdownButton","DropdownLink","AutoComplete","SearchInput"],"mappings":"AAAa,IAAAA,oBAAoB,CAAG,CAClCC,eAAe,CAAE,iBAAiB,CAClCC,QAAQ,CAAE,UAAU,CACpBC,OAAO,CAAE,SAAS,CAClBC,QAAQ,CAAE,CACRC,WAAW,CAAE,aAAa,CAC1BC,cAAc,CAAE,gBAAgB,CAChCC,YAAY,CAAE,cAAc,CAC5BC,YAAY,CAAE,cAAc,CAC5BC,WAAW,CAAE,aACf,CACF;;;;"}
1
+ {"version":3,"file":"dropdownComponentIds.js","sources":["../../../../../src/components/Dropdown/dropdownComponentIds.ts"],"sourcesContent":["export const dropdownComponentIds = {\n DropdownOverlay: 'DropdownOverlay',\n Dropdown: 'Dropdown',\n BaseBox: 'BaseBox',\n triggers: {\n SelectInput: 'SelectInput',\n DropdownButton: 'DropdownButton',\n DropdownLink: 'DropdownLink',\n AutoComplete: 'AutoComplete',\n SearchInput: 'SearchInput',\n DropdownIconButton: 'DropdownIconButton',\n },\n};\n"],"names":["dropdownComponentIds","DropdownOverlay","Dropdown","BaseBox","triggers","SelectInput","DropdownButton","DropdownLink","AutoComplete","SearchInput","DropdownIconButton"],"mappings":"AAAa,IAAAA,oBAAoB,CAAG,CAClCC,eAAe,CAAE,iBAAiB,CAClCC,QAAQ,CAAE,UAAU,CACpBC,OAAO,CAAE,SAAS,CAClBC,QAAQ,CAAE,CACRC,WAAW,CAAE,aAAa,CAC1BC,cAAc,CAAE,gBAAgB,CAChCC,YAAY,CAAE,cAAc,CAC5BC,YAAY,CAAE,cAAc,CAC5BC,WAAW,CAAE,aAAa,CAC1BC,kBAAkB,CAAE,oBACtB,CACF;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useDropdown.js","sources":["../../../../../src/components/Dropdown/useDropdown.ts"],"sourcesContent":["import React from 'react';\n\nimport {\n ensureScrollVisiblity,\n getActionFromKey,\n getIndexByLetter,\n getUpdatedIndex,\n makeInputDisplayValue,\n makeInputValue,\n performAction,\n} from './dropdownUtils';\nimport type { SelectActionsType } from './dropdownUtils';\nimport type { DropdownProps } from './types';\n\nimport { dropdownComponentIds } from './dropdownComponentIds';\nimport type { FormInputHandleOnKeyDownEvent } from '~components/Form/FormTypes';\nimport { isReactNative, isBrowser } from '~utils';\nimport type { ContainerElementType } from '~utils/types';\nimport { fireNativeEvent } from '~utils/fireNativeEvent';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nconst noop = (): void => {};\n\ntype OptionsType = {\n title: string;\n value: string;\n onClickTrigger?: (isSelected: boolean) => void;\n}[];\n\ntype DropdownContextType = {\n isOpen: boolean;\n setIsOpen: (isOpen: boolean) => void;\n close: () => void;\n /**\n * contains the indexes of selected items\n */\n selectedIndices: number[];\n setSelectedIndices: (value: number[]) => void;\n /**\n * contains the indexes of selected items during controlled selection\n */\n controlledValueIndices: number[];\n setControlledValueIndices: (value: number[]) => void;\n /**\n * contains information about all the options inside actionlist\n */\n options: OptionsType;\n setOptions: (value: OptionsType) => void;\n\n /**\n * Filtered values for AutoComplete Inputs\n */\n filteredValues: string[];\n setFilteredValues: (values: string[]) => void;\n\n /** Currently active (focussed) index */\n activeIndex: number;\n setActiveIndex: (value: number) => void;\n\n /** Currently active (focussed) tag */\n activeTagIndex: number;\n setActiveTagIndex: (value: number) => void;\n\n /**\n * Sometimes we want to ignore the blur event to keep dropdown open but not ignore the blur animation from selectinput\n * E.g. When someone clicks on Footer, we just want to ignore the blur event and not the blur animation\n */\n shouldIgnoreBlurAnimation: boolean;\n setShouldIgnoreBlurAnimation: (value: boolean) => void;\n /** Tells you if keyboard was used. Its false by default and turns into true when keydown is called */\n isKeydownPressed: boolean;\n setIsKeydownPressed: (value: boolean) => void;\n /** common baseId which is prepended to multiple other ids inside this dropdown */\n dropdownBaseId: string;\n /** Which element has triggered the dropdown */\n dropdownTriggerer?:\n | 'SelectInput'\n | 'DropdownButton'\n | 'AutoComplete'\n | 'DropdownLink'\n | 'SearchInput';\n /** ref of triggerer. Used to call focus in certain places */\n triggererRef: React.MutableRefObject<HTMLButtonElement | null>;\n triggererWrapperRef: React.MutableRefObject<ContainerElementType | null>;\n actionListItemRef: React.RefObject<HTMLDivElement | null>;\n isTagDismissedRef: React.RefObject<{ value: boolean } | null>;\n visibleTagsCountRef: React.RefObject<{ value: number } | null>;\n\n selectionType?: DropdownProps['selectionType'];\n /** whether footer has an action item.\n * certain a11y behaviour changes happen here\n * E.g. tabbing moves focus to that action instead of outside\n */\n hasFooterAction: boolean;\n setHasFooterAction: (value: boolean) => void;\n\n /**\n * Apart from dropdownTriggerer prop, we also set this boolean because in BottomSheet, the initial trigger can be Select but also have autocomplete inside of it\n */\n hasAutoCompleteInBottomSheetHeader: boolean;\n setHasAutoCompleteInBottomSheetHeader: (value: boolean) => void;\n\n /**\n * A value that can be used in dependency array to know when Dropdown value is changed.\n *\n * E.g.\n * ```ts\n * useEffect(() => {\n * console.log('Uncontrolled value change');\n * }, [changeCallbackTriggerer])\n * ```\n */\n changeCallbackTriggerer: number;\n setChangeCallbackTriggerer: (changeCallbackTriggerer: number) => void;\n\n /**\n * true when SelectInput has `value` prop (when it is controlled)\n */\n isControlled: boolean;\n setIsControlled: (isControlled: boolean) => void;\n};\n\nconst DropdownContext = React.createContext<DropdownContextType>({\n isOpen: false,\n setIsOpen: noop,\n close: noop,\n selectedIndices: [],\n setSelectedIndices: noop,\n controlledValueIndices: [],\n setControlledValueIndices: noop,\n options: [],\n setOptions: noop,\n filteredValues: [],\n setFilteredValues: noop,\n activeIndex: -1,\n setActiveIndex: noop,\n activeTagIndex: -1,\n setActiveTagIndex: noop,\n shouldIgnoreBlurAnimation: false,\n setShouldIgnoreBlurAnimation: noop,\n hasFooterAction: false,\n setHasFooterAction: noop,\n hasAutoCompleteInBottomSheetHeader: false,\n setHasAutoCompleteInBottomSheetHeader: noop,\n isKeydownPressed: false,\n setIsKeydownPressed: noop,\n changeCallbackTriggerer: 0,\n setChangeCallbackTriggerer: noop,\n isControlled: false,\n setIsControlled: noop,\n dropdownBaseId: '',\n actionListItemRef: {\n current: null,\n },\n triggererRef: {\n current: null,\n },\n isTagDismissedRef: {\n current: null,\n },\n visibleTagsCountRef: {\n current: null,\n },\n triggererWrapperRef: {\n current: null,\n },\n});\n\nlet searchTimeout: number;\nlet searchString = '';\n\ntype UseDropdownReturnValue = DropdownContextType & {\n /**\n * Click event on combobox. Toggles the dropdown\n */\n onTriggerClick: () => void;\n\n /**\n * Keydown event of combobox. Handles most of the keyboard accessibility of dropdown\n */\n onTriggerKeydown: FormInputHandleOnKeyDownEvent | undefined;\n\n /**\n * Handles the click even on option.\n *\n * Contains the logic that selects the option, moves the focus, etc\n */\n onOptionClick: (\n e: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLInputElement>,\n index: number,\n ) => void;\n\n /**\n * Removes the option with given optionsIndex\n */\n removeOption: (index: number) => void;\n\n /**\n * value that is used during form submissions\n */\n value: string;\n /**\n * This is the value that is displayed inside select after selection\n */\n displayValue: string;\n};\n\n/**\n * Handles almost all the functionality of dropdown.\n *\n * Returns the values from DropdownContext along with some helper functions and event handlers\n *\n */\nconst useDropdown = (): UseDropdownReturnValue => {\n const {\n isOpen,\n setIsOpen,\n close,\n selectedIndices,\n setSelectedIndices,\n activeIndex,\n setActiveIndex,\n activeTagIndex,\n setActiveTagIndex,\n visibleTagsCountRef,\n isKeydownPressed,\n setIsKeydownPressed,\n options,\n selectionType,\n changeCallbackTriggerer,\n setChangeCallbackTriggerer,\n isControlled,\n setControlledValueIndices,\n filteredValues,\n dropdownTriggerer,\n ...rest\n } = React.useContext(DropdownContext);\n\n type SelectOptionType = (\n index: number,\n properties?: {\n closeOnSelection?: boolean;\n },\n ) => boolean;\n\n const setIndices = (indices: number[]): void => {\n if (isControlled) {\n setControlledValueIndices(indices);\n } else {\n setSelectedIndices(indices);\n }\n };\n\n const removeOption = (index: number): void => {\n // remove existing item\n const existingItemIndex = selectedIndices.indexOf(index);\n if (existingItemIndex < 0) {\n return;\n }\n\n setIndices([\n ...selectedIndices.slice(0, existingItemIndex),\n ...selectedIndices.slice(existingItemIndex + 1),\n ]);\n };\n\n /**\n * Marks the given index as selected.\n *\n * In single select, it also closes the menu.\n * In multiselect, it keeps the menu open for more selections\n */\n const selectOption: SelectOptionType = (\n index,\n properties = {\n closeOnSelection: true,\n },\n ) => {\n let isSelected = false;\n\n if (index < 0 || index > options.length - 1) {\n return isSelected;\n }\n\n if (selectionType === 'multiple') {\n if (selectedIndices.includes(index)) {\n removeOption(index);\n isSelected = false;\n } else {\n setIndices([...selectedIndices, index]);\n isSelected = true;\n }\n } else {\n setIndices([index]);\n isSelected = true;\n }\n\n // Triggers `onChange` on SelectInput\n setChangeCallbackTriggerer(changeCallbackTriggerer + 1);\n\n if (activeIndex !== index) {\n setActiveIndex(index);\n }\n\n if (properties?.closeOnSelection && selectionType !== 'multiple') {\n close();\n }\n\n return isSelected;\n };\n\n /**\n * Click listener for combobox (or any triggerer of the dropdown)\n */\n const onTriggerClick = (): void => {\n if (isOpen) {\n close();\n } else {\n setIsOpen(true);\n }\n };\n\n /**\n * Function that we call when we want to move focus from one option to other\n */\n const onOptionChange = (actionType: SelectActionsType, index?: number): void => {\n setActiveTagIndex(-1);\n const newIndex = index ?? activeIndex;\n let updatedIndex: number;\n const hasAutoComplete =\n rest.hasAutoCompleteInBottomSheetHeader ||\n dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete;\n if (hasAutoComplete && filteredValues.length > 0) {\n // When its autocomplete, we don't loop over all options. We only loop on filtered options\n\n const filteredIndexes = filteredValues\n .map((filteredValue) => options.findIndex((option) => option.value === filteredValue))\n .sort((a, b) => a - b);\n\n updatedIndex =\n filteredIndexes[\n getUpdatedIndex({\n currentIndex: filteredIndexes.indexOf(newIndex),\n maxIndex: filteredIndexes.length - 1,\n actionType,\n })\n ];\n } else {\n updatedIndex = getUpdatedIndex({\n currentIndex: newIndex,\n maxIndex: options.length - 1,\n actionType,\n });\n }\n setActiveIndex(updatedIndex);\n\n const optionValues = options.map((option) => option.value);\n ensureScrollVisiblity(updatedIndex, rest.actionListItemRef.current, optionValues);\n if (isBrowser()) {\n fireNativeEvent(rest.actionListItemRef as React.RefObject<HTMLElement>, ['change', 'input']);\n }\n };\n\n /**\n * Click handler when user clicks on any particular option.\n *\n * It\n * - changes the option focus\n * - selects that option\n * - moves focus to combobox\n */\n const onOptionClick = (\n e: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLInputElement>,\n index: number,\n ): void => {\n const actionType = getActionFromKey(e, isOpen, dropdownTriggerer);\n if (typeof actionType === 'number') {\n onOptionChange(actionType, index);\n }\n selectOption(index);\n if (!isReactNative()) {\n rest.triggererRef.current?.focus();\n }\n };\n\n /**\n * Function we call to handle the typeahead.\n *\n * It takes a letter, stores that letter in searchString (and clears it after timeout) to maintain a word\n *\n * Then searches for that word in options and moves focus there.\n */\n const onComboType = (letter: string, actionType: SelectActionsType): void => {\n // open the listbox if it is closed\n setIsOpen(true);\n\n if (\n rest.hasAutoCompleteInBottomSheetHeader ||\n dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete\n ) {\n return;\n }\n\n if (typeof searchTimeout === 'number') {\n window.clearTimeout(searchTimeout);\n }\n\n searchTimeout = window.setTimeout(() => {\n searchString = '';\n }, 500);\n // eslint-disable-next-line @typescript-eslint/restrict-plus-operands\n searchString = searchString + letter;\n const optionTitles = options.map((option) => option.title);\n const searchIndex = getIndexByLetter(optionTitles, searchString, activeIndex + 1);\n\n // if a match was found, go to it\n if (searchIndex >= 0) {\n onOptionChange(actionType, searchIndex);\n }\n // if no matches, clear the timeout and search string\n else {\n window.clearTimeout(searchTimeout);\n searchString = '';\n }\n };\n\n /**\n * Keydown event of combobox. Handles most of the keyboard accessibility of dropdown\n */\n const onTriggerKeydown = (e: {\n event: React.KeyboardEvent<HTMLInputElement | HTMLButtonElement>;\n }): void => {\n if (!isKeydownPressed && ![' ', 'Enter', 'Escape', 'Meta'].includes(e.event.key)) {\n // When keydown is not already pressed and its not Enter, Space, Command, or Escape key (those are generic keys and we only want to handle arrow keys or home buttons etc)\n setIsKeydownPressed(true);\n }\n\n const actionType = getActionFromKey(e.event, isOpen, dropdownTriggerer);\n\n if (actionType) {\n performAction(actionType, e, {\n setIsOpen,\n close,\n onOptionChange,\n onComboType,\n selectCurrentOption: () => {\n if (activeIndex < 0) {\n return;\n }\n\n const isSelected = selectOption(activeIndex);\n if (rest.hasFooterAction && !isReactNative()) {\n rest.triggererRef.current?.focus();\n }\n\n options[activeIndex].onClickTrigger?.(isSelected);\n },\n });\n }\n };\n\n return {\n isOpen,\n setIsOpen,\n close,\n selectedIndices,\n setSelectedIndices,\n filteredValues,\n removeOption,\n setControlledValueIndices,\n onTriggerClick,\n onTriggerKeydown,\n onOptionClick,\n activeIndex,\n setActiveIndex,\n activeTagIndex,\n setActiveTagIndex,\n visibleTagsCountRef,\n isKeydownPressed,\n setIsKeydownPressed,\n changeCallbackTriggerer,\n setChangeCallbackTriggerer,\n isControlled,\n options,\n value: makeInputValue(selectedIndices, options),\n displayValue: makeInputDisplayValue(selectedIndices, options),\n selectionType,\n dropdownTriggerer,\n ...rest,\n };\n};\n\nexport type { DropdownContextType, OptionsType };\nexport { useDropdown, DropdownContext };\n"],"names":["noop","DropdownContext","React","createContext","isOpen","setIsOpen","close","selectedIndices","setSelectedIndices","controlledValueIndices","setControlledValueIndices","options","setOptions","filteredValues","setFilteredValues","activeIndex","setActiveIndex","activeTagIndex","setActiveTagIndex","shouldIgnoreBlurAnimation","setShouldIgnoreBlurAnimation","hasFooterAction","setHasFooterAction","hasAutoCompleteInBottomSheetHeader","setHasAutoCompleteInBottomSheetHeader","isKeydownPressed","setIsKeydownPressed","changeCallbackTriggerer","setChangeCallbackTriggerer","isControlled","setIsControlled","dropdownBaseId","actionListItemRef","current","triggererRef","isTagDismissedRef","visibleTagsCountRef","triggererWrapperRef","searchTimeout","searchString","useDropdown","_React$useContext","useContext","selectionType","dropdownTriggerer","rest","_objectWithoutProperties","_excluded","setIndices","indices","removeOption","index","existingItemIndex","indexOf","concat","_toConsumableArray","slice","selectOption","properties","arguments","length","undefined","closeOnSelection","isSelected","includes","onTriggerClick","onOptionChange","actionType","newIndex","updatedIndex","hasAutoComplete","dropdownComponentIds","triggers","AutoComplete","filteredIndexes","map","filteredValue","findIndex","option","value","sort","a","b","getUpdatedIndex","currentIndex","maxIndex","optionValues","ensureScrollVisiblity","isBrowser","fireNativeEvent","onOptionClick","e","getActionFromKey","isReactNative","_rest$triggererRef$cu","focus","onComboType","letter","window","clearTimeout","setTimeout","optionTitles","title","searchIndex","getIndexByLetter","onTriggerKeydown","event","key","performAction","selectCurrentOption","_options$activeIndex$","_options$activeIndex","_rest$triggererRef$cu2","onClickTrigger","call","Object","assign","makeInputValue","displayValue","makeInputDisplayValue"],"mappings":";;;;;;;;;;;;AAAA,IAAA,SAAA,CAAA,CAAA,QAAA,CAAA,WAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,oBAAA,CAAA,aAAA,CAAA,gBAAA,CAAA,gBAAA,CAAA,mBAAA,CAAA,qBAAA,CAAA,kBAAA,CAAA,qBAAA,CAAA,SAAA,CAAA,eAAA,CAAA,yBAAA,CAAA,4BAAA,CAAA,cAAA,CAAA,2BAAA,CAAA,gBAAA,CAAA,mBAAA,CAAA,CAqBA,IAAMA,IAAI,CAAG,SAAPA,IAAIA,EAAe,EAAE,CAqGrB,IAAAC,eAAe,CAAGC,cAAK,CAACC,aAAa,CAAsB,CAC/DC,MAAM,CAAE,KAAK,CACbC,SAAS,CAAEL,IAAI,CACfM,KAAK,CAAEN,IAAI,CACXO,eAAe,CAAE,EAAE,CACnBC,kBAAkB,CAAER,IAAI,CACxBS,sBAAsB,CAAE,EAAE,CAC1BC,yBAAyB,CAAEV,IAAI,CAC/BW,OAAO,CAAE,EAAE,CACXC,UAAU,CAAEZ,IAAI,CAChBa,cAAc,CAAE,EAAE,CAClBC,iBAAiB,CAAEd,IAAI,CACvBe,WAAW,CAAE,CAAC,CAAC,CACfC,cAAc,CAAEhB,IAAI,CACpBiB,cAAc,CAAE,CAAC,CAAC,CAClBC,iBAAiB,CAAElB,IAAI,CACvBmB,yBAAyB,CAAE,KAAK,CAChCC,4BAA4B,CAAEpB,IAAI,CAClCqB,eAAe,CAAE,KAAK,CACtBC,kBAAkB,CAAEtB,IAAI,CACxBuB,kCAAkC,CAAE,KAAK,CACzCC,qCAAqC,CAAExB,IAAI,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e,CACfC,kBAAkB,CAAlBA,kBAAkB,CAClBK,cAAc,CAAdA,cAAc,CACdqC,YAAY,CAAZA,YAAY,CACZxC,yBAAyB,CAAzBA,yBAAyB,CACzBuD,cAAc,CAAdA,cAAc,CACdwC,gBAAgB,CAAhBA,gBAAgB,CAChBf,aAAa,CAAbA,aAAa,CACb3E,WAAW,CAAXA,WAAW,CACXC,cAAc,CAAdA,cAAc,CACdC,cAAc,CAAdA,cAAc,CACdC,iBAAiB,CAAjBA,iBAAiB,CACjBkB,mBAAmB,CAAnBA,mBAAmB,CACnBX,gBAAgB,CAAhBA,gBAAgB,CAChBC,mBAAmB,CAAnBA,mBAAmB,CACnBC,uBAAuB,CAAvBA,uBAAuB,CACvBC,0BAA0B,CAA1BA,0BAA0B,CAC1BC,YAAY,CAAZA,YAAY,CACZlB,OAAO,CAAPA,OAAO,CACPoE,KAAK,CAAEsC,cAAc,CAAC9G,eAAe,CAAEI,OAAO,CAAC,CAC/C2G,YAAY,CAAEC,qBAAqB,CAAChH,eAAe,CAAEI,OAAO,CAAC,CAC7DgC,aAAa,CAAbA,aAAa,CACbC,iBAAiB,CAAjBA,iBAAiB,CAAA,CACdC,IAAI,CAEX,CAAA;;;;"}
1
+ {"version":3,"file":"useDropdown.js","sources":["../../../../../src/components/Dropdown/useDropdown.ts"],"sourcesContent":["import React from 'react';\n\nimport {\n ensureScrollVisiblity,\n getActionFromKey,\n getIndexByLetter,\n getUpdatedIndex,\n makeInputDisplayValue,\n makeInputValue,\n performAction,\n} from './dropdownUtils';\nimport type { SelectActionsType } from './dropdownUtils';\nimport type { DropdownProps } from './types';\n\nimport { dropdownComponentIds } from './dropdownComponentIds';\nimport type { FormInputHandleOnKeyDownEvent } from '~components/Form/FormTypes';\nimport { isReactNative, isBrowser } from '~utils';\nimport type { ContainerElementType } from '~utils/types';\nimport { fireNativeEvent } from '~utils/fireNativeEvent';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nconst noop = (): void => {};\n\ntype OptionsType = {\n title: string;\n value: string;\n onClickTrigger?: (isSelected: boolean) => void;\n}[];\n\ntype DropdownContextType = {\n isOpen: boolean;\n setIsOpen: (isOpen: boolean) => void;\n close: () => void;\n /**\n * contains the indexes of selected items\n */\n selectedIndices: number[];\n setSelectedIndices: (value: number[]) => void;\n /**\n * contains the indexes of selected items during controlled selection\n */\n controlledValueIndices: number[];\n setControlledValueIndices: (value: number[]) => void;\n /**\n * contains information about all the options inside actionlist\n */\n options: OptionsType;\n setOptions: (value: OptionsType) => void;\n\n /**\n * Filtered values for AutoComplete Inputs\n */\n filteredValues: string[];\n setFilteredValues: (values: string[]) => void;\n\n /** Currently active (focussed) index */\n activeIndex: number;\n setActiveIndex: (value: number) => void;\n\n /** Currently active (focussed) tag */\n activeTagIndex: number;\n setActiveTagIndex: (value: number) => void;\n\n /**\n * Sometimes we want to ignore the blur event to keep dropdown open but not ignore the blur animation from selectinput\n * E.g. When someone clicks on Footer, we just want to ignore the blur event and not the blur animation\n */\n shouldIgnoreBlurAnimation: boolean;\n setShouldIgnoreBlurAnimation: (value: boolean) => void;\n /** Tells you if keyboard was used. Its false by default and turns into true when keydown is called */\n isKeydownPressed: boolean;\n setIsKeydownPressed: (value: boolean) => void;\n /** common baseId which is prepended to multiple other ids inside this dropdown */\n dropdownBaseId: string;\n /** Which element has triggered the dropdown */\n dropdownTriggerer?:\n | 'SelectInput'\n | 'DropdownButton'\n | 'DropdownIconButton'\n | 'AutoComplete'\n | 'DropdownLink'\n | 'SearchInput';\n /** ref of triggerer. Used to call focus in certain places */\n triggererRef: React.MutableRefObject<HTMLButtonElement | null>;\n triggererWrapperRef: React.MutableRefObject<ContainerElementType | null>;\n actionListItemRef: React.RefObject<HTMLDivElement | null>;\n isTagDismissedRef: React.RefObject<{ value: boolean } | null>;\n visibleTagsCountRef: React.RefObject<{ value: number } | null>;\n\n selectionType?: DropdownProps['selectionType'];\n /** whether footer has an action item.\n * certain a11y behaviour changes happen here\n * E.g. tabbing moves focus to that action instead of outside\n */\n hasFooterAction: boolean;\n setHasFooterAction: (value: boolean) => void;\n\n /**\n * Apart from dropdownTriggerer prop, we also set this boolean because in BottomSheet, the initial trigger can be Select but also have autocomplete inside of it\n */\n hasAutoCompleteInBottomSheetHeader: boolean;\n setHasAutoCompleteInBottomSheetHeader: (value: boolean) => void;\n\n /**\n * A value that can be used in dependency array to know when Dropdown value is changed.\n *\n * E.g.\n * ```ts\n * useEffect(() => {\n * console.log('Uncontrolled value change');\n * }, [changeCallbackTriggerer])\n * ```\n */\n changeCallbackTriggerer: number;\n setChangeCallbackTriggerer: (changeCallbackTriggerer: number) => void;\n\n /**\n * true when SelectInput has `value` prop (when it is controlled)\n */\n isControlled: boolean;\n setIsControlled: (isControlled: boolean) => void;\n};\n\nconst DropdownContext = React.createContext<DropdownContextType>({\n isOpen: false,\n setIsOpen: noop,\n close: noop,\n selectedIndices: [],\n setSelectedIndices: noop,\n controlledValueIndices: [],\n setControlledValueIndices: noop,\n options: [],\n setOptions: noop,\n filteredValues: [],\n setFilteredValues: noop,\n activeIndex: -1,\n setActiveIndex: noop,\n activeTagIndex: -1,\n setActiveTagIndex: noop,\n shouldIgnoreBlurAnimation: false,\n setShouldIgnoreBlurAnimation: noop,\n hasFooterAction: false,\n setHasFooterAction: noop,\n hasAutoCompleteInBottomSheetHeader: false,\n setHasAutoCompleteInBottomSheetHeader: noop,\n isKeydownPressed: false,\n setIsKeydownPressed: noop,\n changeCallbackTriggerer: 0,\n setChangeCallbackTriggerer: noop,\n isControlled: false,\n setIsControlled: noop,\n dropdownBaseId: '',\n actionListItemRef: {\n current: null,\n },\n triggererRef: {\n current: null,\n },\n isTagDismissedRef: {\n current: null,\n },\n visibleTagsCountRef: {\n current: null,\n },\n triggererWrapperRef: {\n current: null,\n },\n});\n\nlet searchTimeout: number;\nlet searchString = '';\n\ntype UseDropdownReturnValue = DropdownContextType & {\n /**\n * Click event on combobox. Toggles the dropdown\n */\n onTriggerClick: () => void;\n\n /**\n * Keydown event of combobox. Handles most of the keyboard accessibility of dropdown\n */\n onTriggerKeydown: FormInputHandleOnKeyDownEvent | undefined;\n\n /**\n * Handles the click even on option.\n *\n * Contains the logic that selects the option, moves the focus, etc\n */\n onOptionClick: (\n e: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLInputElement>,\n index: number,\n ) => void;\n\n /**\n * Removes the option with given optionsIndex\n */\n removeOption: (index: number) => void;\n\n /**\n * value that is used during form submissions\n */\n value: string;\n /**\n * This is the value that is displayed inside select after selection\n */\n displayValue: string;\n};\n\n/**\n * Handles almost all the functionality of dropdown.\n *\n * Returns the values from DropdownContext along with some helper functions and event handlers\n *\n */\nconst useDropdown = (): UseDropdownReturnValue => {\n const {\n isOpen,\n setIsOpen,\n close,\n selectedIndices,\n setSelectedIndices,\n activeIndex,\n setActiveIndex,\n activeTagIndex,\n setActiveTagIndex,\n visibleTagsCountRef,\n isKeydownPressed,\n setIsKeydownPressed,\n options,\n selectionType,\n changeCallbackTriggerer,\n setChangeCallbackTriggerer,\n isControlled,\n setControlledValueIndices,\n filteredValues,\n dropdownTriggerer,\n ...rest\n } = React.useContext(DropdownContext);\n\n type SelectOptionType = (\n index: number,\n properties?: {\n closeOnSelection?: boolean;\n },\n ) => boolean;\n\n const setIndices = (indices: number[]): void => {\n if (isControlled) {\n setControlledValueIndices(indices);\n } else {\n setSelectedIndices(indices);\n }\n };\n\n const removeOption = (index: number): void => {\n // remove existing item\n const existingItemIndex = selectedIndices.indexOf(index);\n if (existingItemIndex < 0) {\n return;\n }\n\n setIndices([\n ...selectedIndices.slice(0, existingItemIndex),\n ...selectedIndices.slice(existingItemIndex + 1),\n ]);\n };\n\n /**\n * Marks the given index as selected.\n *\n * In single select, it also closes the menu.\n * In multiselect, it keeps the menu open for more selections\n */\n const selectOption: SelectOptionType = (\n index,\n properties = {\n closeOnSelection: true,\n },\n ) => {\n let isSelected = false;\n\n if (index < 0 || index > options.length - 1) {\n return isSelected;\n }\n\n if (selectionType === 'multiple') {\n if (selectedIndices.includes(index)) {\n removeOption(index);\n isSelected = false;\n } else {\n setIndices([...selectedIndices, index]);\n isSelected = true;\n }\n } else {\n setIndices([index]);\n isSelected = true;\n }\n\n // Triggers `onChange` on SelectInput\n setChangeCallbackTriggerer(changeCallbackTriggerer + 1);\n\n if (activeIndex !== index) {\n setActiveIndex(index);\n }\n\n if (properties?.closeOnSelection && selectionType !== 'multiple') {\n close();\n }\n\n return isSelected;\n };\n\n /**\n * Click listener for combobox (or any triggerer of the dropdown)\n */\n const onTriggerClick = (): void => {\n if (isOpen) {\n close();\n } else {\n setIsOpen(true);\n }\n };\n\n /**\n * Function that we call when we want to move focus from one option to other\n */\n const onOptionChange = (actionType: SelectActionsType, index?: number): void => {\n setActiveTagIndex(-1);\n const newIndex = index ?? activeIndex;\n let updatedIndex: number;\n const hasAutoComplete =\n rest.hasAutoCompleteInBottomSheetHeader ||\n dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete;\n if (hasAutoComplete && filteredValues.length > 0) {\n // When its autocomplete, we don't loop over all options. We only loop on filtered options\n\n const filteredIndexes = filteredValues\n .map((filteredValue) => options.findIndex((option) => option.value === filteredValue))\n .sort((a, b) => a - b);\n\n updatedIndex =\n filteredIndexes[\n getUpdatedIndex({\n currentIndex: filteredIndexes.indexOf(newIndex),\n maxIndex: filteredIndexes.length - 1,\n actionType,\n })\n ];\n } else {\n updatedIndex = getUpdatedIndex({\n currentIndex: newIndex,\n maxIndex: options.length - 1,\n actionType,\n });\n }\n setActiveIndex(updatedIndex);\n\n const optionValues = options.map((option) => option.value);\n ensureScrollVisiblity(updatedIndex, rest.actionListItemRef.current, optionValues);\n if (isBrowser()) {\n fireNativeEvent(rest.actionListItemRef as React.RefObject<HTMLElement>, ['change', 'input']);\n }\n };\n\n /**\n * Click handler when user clicks on any particular option.\n *\n * It\n * - changes the option focus\n * - selects that option\n * - moves focus to combobox\n */\n const onOptionClick = (\n e: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLInputElement>,\n index: number,\n ): void => {\n const actionType = getActionFromKey(e, isOpen, dropdownTriggerer);\n if (typeof actionType === 'number') {\n onOptionChange(actionType, index);\n }\n selectOption(index);\n if (!isReactNative()) {\n rest.triggererRef.current?.focus();\n }\n };\n\n /**\n * Function we call to handle the typeahead.\n *\n * It takes a letter, stores that letter in searchString (and clears it after timeout) to maintain a word\n *\n * Then searches for that word in options and moves focus there.\n */\n const onComboType = (letter: string, actionType: SelectActionsType): void => {\n // open the listbox if it is closed\n setIsOpen(true);\n\n if (\n rest.hasAutoCompleteInBottomSheetHeader ||\n dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete\n ) {\n return;\n }\n\n if (typeof searchTimeout === 'number') {\n window.clearTimeout(searchTimeout);\n }\n\n searchTimeout = window.setTimeout(() => {\n searchString = '';\n }, 500);\n // eslint-disable-next-line @typescript-eslint/restrict-plus-operands\n searchString = searchString + letter;\n const optionTitles = options.map((option) => option.title);\n const searchIndex = getIndexByLetter(optionTitles, searchString, activeIndex + 1);\n\n // if a match was found, go to it\n if (searchIndex >= 0) {\n onOptionChange(actionType, searchIndex);\n }\n // if no matches, clear the timeout and search string\n else {\n window.clearTimeout(searchTimeout);\n searchString = '';\n }\n };\n\n /**\n * Keydown event of combobox. Handles most of the keyboard accessibility of dropdown\n */\n const onTriggerKeydown = (e: {\n event: React.KeyboardEvent<HTMLInputElement | HTMLButtonElement>;\n }): void => {\n if (!isKeydownPressed && ![' ', 'Enter', 'Escape', 'Meta'].includes(e.event.key)) {\n // When keydown is not already pressed and its not Enter, Space, Command, or Escape key (those are generic keys and we only want to handle arrow keys or home buttons etc)\n setIsKeydownPressed(true);\n }\n\n const actionType = getActionFromKey(e.event, isOpen, dropdownTriggerer);\n\n if (actionType) {\n performAction(actionType, e, {\n setIsOpen,\n close,\n onOptionChange,\n onComboType,\n selectCurrentOption: () => {\n if (activeIndex < 0) {\n return;\n }\n\n const isSelected = selectOption(activeIndex);\n if (rest.hasFooterAction && !isReactNative()) {\n rest.triggererRef.current?.focus();\n }\n\n options[activeIndex].onClickTrigger?.(isSelected);\n },\n });\n }\n };\n\n return {\n isOpen,\n setIsOpen,\n close,\n selectedIndices,\n setSelectedIndices,\n filteredValues,\n removeOption,\n setControlledValueIndices,\n onTriggerClick,\n onTriggerKeydown,\n onOptionClick,\n activeIndex,\n setActiveIndex,\n activeTagIndex,\n setActiveTagIndex,\n visibleTagsCountRef,\n isKeydownPressed,\n setIsKeydownPressed,\n changeCallbackTriggerer,\n setChangeCallbackTriggerer,\n isControlled,\n options,\n value: makeInputValue(selectedIndices, options),\n displayValue: makeInputDisplayValue(selectedIndices, options),\n selectionType,\n dropdownTriggerer,\n ...rest,\n };\n};\n\nexport type { DropdownContextType, OptionsType };\nexport { useDropdown, DropdownContext };\n"],"names":["noop","DropdownContext","React","createContext","isOpen","setIsOpen","close","selectedIndices","setSelectedIndices","controlledValueIndices","setControlledValueIndices","options","setOptions","filteredValues","setFilteredValues","activeIndex","setActiveIndex","activeTagIndex","setActiveTagIndex","shouldIgnoreBlurAnimation","setShouldIgnoreBlurAnimation","hasFooterAction","setHasFooterAction","hasAutoCompleteInBottomSheetHeader","setHasAutoCompleteInBottomSheetHeader","isKeydownPressed","setIsKeydownPressed","changeCallbackTriggerer","setChangeCallbackTriggerer","isControlled","setIsControlled","dropdownBaseId","actionListItemRef","current","triggererRef","isTagDismissedRef","visibleTagsCountRef","triggererWrapperRef","searchTimeout","searchString","useDropdown","_React$useContext","useContext","selectionType","dropdownTriggerer","rest","_objectWithoutProperties","_excluded","setIndices","indices","removeOption","index","existingItemIndex","indexOf","concat","_toConsumableArray","slice","selectOption","properties","arguments","length","undefined","closeOnSelection","isSelected","includes","onTriggerClick","onOptionChange","actionType","newIndex","updatedIndex","hasAutoComplete","dropdownComponentIds","triggers","AutoComplete","filteredIndexes","map","filteredValue","findIndex","option","value","sort","a","b","getUpdatedIndex","currentIndex","maxIndex","optionValues","ensureScrollVisiblity","isBrowser","fireNativeEvent","onOptionClick","e","getActionFromKey","isReactNative","_rest$triggererRef$cu","focus","onComboType","letter","window","clearTimeout","setTimeout","optionTitles","title","searchIndex","getIndexByLetter","onTriggerKeydown","event","key","performAction","selectCurrentOption","_options$activeIndex$","_options$activeIndex","_rest$triggererRef$cu2","onClickTrigger","call","Object","assign","makeInputValue","displayValue","makeInputDisplayValue"],"mappings":";;;;;;;;;;;;AAAA,IAAA,SAAA,CAAA,CAAA,QAAA,CAAA,WAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,oBAAA,CAAA,aAAA,CAAA,gBAAA,CAAA,gBAAA,CAAA,mBAAA,CAAA,qBAAA,CAAA,kBAAA,CAAA,qBAAA,CAAA,SAAA,CAAA,eAAA,CAAA,yBAAA,CAAA,4BAAA,CAAA,cAAA,CAAA,2BAAA,CAAA,gBAAA,CAAA,mBAAA,CAAA,CAqBA,IAAMA,IAAI,CAAG,SAAPA,IAAIA,EAAe,EAAE,CAsGrB,IAAAC,eAAe,CAAGC,cAAK,CAACC,aAAa,CAAsB,CAC/DC,MAAM,CAAE,KAAK,CACbC,SAAS,CAAEL,IAAI,CACfM,KAAK,CAAEN,IAAI,CACXO,eAAe,CAAE,EAAE,CACnBC,kBAAkB,CAAER,IAAI,CACxBS,sBAAsB,CAAE,EAAE,CAC1BC,yBAAyB,CAAEV,IAAI,CAC/BW,OAAO,CAAE,EAAE,CACXC,UAAU,CAAEZ,IAAI,CAChBa,cAAc,CAAE,EAAE,CAClBC,iBAAiB,CAAEd,IAAI,CACvBe,WAAW,CAAE,CAAC,CAAC,CACfC,cAAc,CAAEhB,IAAI,CACpBiB,cAAc,CAAE,CAAC,CAAC,CAClBC,iBAAiB,CAAElB,IAAI,CACvBmB,yBAAyB,CAAE,KAAK,CAChCC,4BAA4B,CAAEpB,IAAI,CAClCqB,eAAe,CAAE,KAAK,CACtBC,kBAAkB,CAAEtB,IAAI,CACxBuB,kCAAkC,CAAE,KAAK,CACzCC,qCAAqC,CAAExB,IAAI,CAC3CyB,gBAAgB,CAAE,K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kBAAkB,CAClBK,cAAc,CAAdA,cAAc,CACdqC,YAAY,CAAZA,YAAY,CACZxC,yBAAyB,CAAzBA,yBAAyB,CACzBuD,cAAc,CAAdA,cAAc,CACdwC,gBAAgB,CAAhBA,gBAAgB,CAChBf,aAAa,CAAbA,aAAa,CACb3E,WAAW,CAAXA,WAAW,CACXC,cAAc,CAAdA,cAAc,CACdC,cAAc,CAAdA,cAAc,CACdC,iBAAiB,CAAjBA,iBAAiB,CACjBkB,mBAAmB,CAAnBA,mBAAmB,CACnBX,gBAAgB,CAAhBA,gBAAgB,CAChBC,mBAAmB,CAAnBA,mBAAmB,CACnBC,uBAAuB,CAAvBA,uBAAuB,CACvBC,0BAA0B,CAA1BA,0BAA0B,CAC1BC,YAAY,CAAZA,YAAY,CACZlB,OAAO,CAAPA,OAAO,CACPoE,KAAK,CAAEsC,cAAc,CAAC9G,eAAe,CAAEI,OAAO,CAAC,CAC/C2G,YAAY,CAAEC,qBAAqB,CAAChH,eAAe,CAAEI,OAAO,CAAC,CAC7DgC,aAAa,CAAbA,aAAa,CACbC,iBAAiB,CAAjBA,iBAAiB,CAAA,CACdC,IAAI,CAEX,CAAA;;;;"}
@@ -44,6 +44,7 @@ export { Dropdown } from './Dropdown/Dropdown.js';
44
44
  export { DropdownOverlay } from './Dropdown/DropdownOverlay.native.js';
45
45
  export { DropdownButton } from './Dropdown/DropdownButton.js';
46
46
  export { DropdownLink } from './Dropdown/DropdownLink.js';
47
+ export { DropdownIconButton } from './Dropdown/DropdownIconButton.js';
47
48
  export { DropdownFooter, DropdownHeader } from './Dropdown/DropdownHeaderFooter.js';
48
49
  export { Elevate } from './Elevate/Elevate.native.js';
49
50
  export { Fade } from './Fade/Fade.native.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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/metaAttribute.web.js
24
24
  import { MetaConstants } from '../../../utils/metaAttribute/metaConstants.js';
25
25
  import { makeAnalyticsAttribute } from '../../../utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js';
26
26
 
27
- var _excluded = ["icon", "onClick", "size", "emphasis", "accessibilityLabel", "isDisabled", "isHighlighted", "testID", "onBlur", "onFocus", "onMouseLeave", "onMouseMove", "onPointerDown", "onPointerEnter", "onTouchEnd", "onTouchStart", "tabIndex"];
27
+ var _excluded = ["icon", "onClick", "size", "emphasis", "accessibilityLabel", "accessibilityProps", "isDisabled", "isHighlighted", "testID", "onBlur", "onFocus", "onMouseLeave", "onMouseMove", "onPointerDown", "onPointerEnter", "onTouchEnd", "onTouchStart", "onKeyDown", "tabIndex"];
28
28
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
29
29
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
30
30
  var StyledButton = /*#__PURE__*/styled.button.withConfig({
@@ -82,6 +82,7 @@ var StyledIconButton = /*#__PURE__*/React__default.forwardRef(function (_ref, re
82
82
  size = _ref.size,
83
83
  emphasis = _ref.emphasis,
84
84
  accessibilityLabel = _ref.accessibilityLabel,
85
+ accessibilityProps = _ref.accessibilityProps,
85
86
  isDisabled = _ref.isDisabled,
86
87
  isHighlighted = _ref.isHighlighted,
87
88
  testID = _ref.testID,
@@ -93,6 +94,7 @@ var StyledIconButton = /*#__PURE__*/React__default.forwardRef(function (_ref, re
93
94
  onPointerEnter = _ref.onPointerEnter,
94
95
  onTouchEnd = _ref.onTouchEnd,
95
96
  onTouchStart = _ref.onTouchStart,
97
+ onKeyDown = _ref.onKeyDown,
96
98
  tabIndex = _ref.tabIndex,
97
99
  rest = _objectWithoutProperties(_ref, _excluded);
98
100
  return /*#__PURE__*/jsx(StyledButton, _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
@@ -108,13 +110,14 @@ var StyledIconButton = /*#__PURE__*/React__default.forwardRef(function (_ref, re
108
110
  onPointerEnter: onPointerEnter,
109
111
  onTouchEnd: onTouchEnd,
110
112
  onTouchStart: onTouchStart,
113
+ onKeyDown: onKeyDown,
111
114
  disabled: isDisabled,
112
115
  $isHighlighted: isHighlighted,
113
116
  $size: size,
114
117
  tabIndex: tabIndex
115
- }, makeAccessible({
116
- label: accessibilityLabel
117
- })), metaAttribute({
118
+ }, makeAccessible(_objectSpread(_objectSpread({}, accessibilityProps), {}, {
119
+ label: accessibilityLabel !== null && accessibilityLabel !== void 0 ? accessibilityLabel : accessibilityProps === null || accessibilityProps === void 0 ? void 0 : accessibilityProps.label
120
+ }))), metaAttribute({
118
121
  name: MetaConstants.IconButton,
119
122
  testID: testID
120
123
  })), makeAnalyticsAttribute(rest)), rest), {}, {
@@ -1 +1 @@
1
- {"version":3,"file":"StyledIconButton.web.js","sources":["../../../../../../../src/components/Button/IconButton/StyledIconButton.web.tsx"],"sourcesContent":["/* eslint-disable react/display-name */\nimport styled from 'styled-components';\nimport type { ReactElement } from 'react';\nimport React from 'react';\nimport type { StyledIconButtonProps } from './types';\nimport { highlightedButtonSizeMap, highlightedHoverColorMap } from './tokens';\nimport { castWebType, makeSize } from '~utils';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { SubtleOrIntense } from '~tokens/theme/theme';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { makeMotionTime } from '~utils/makeMotionTime';\nimport { getFocusRingStyles } from '~utils/getFocusRingStyles';\nimport { throwBladeError } from '~utils/logger';\nimport getIn from '~utils/lodashButBetter/get';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\nimport { useStyledProps } from '~components/Box/styledProps';\n\ntype StyledButtonProps = {\n emphasis: SubtleOrIntense;\n $isHighlighted: StyledIconButtonProps['isHighlighted'];\n $size: StyledIconButtonProps['size'];\n};\n\nconst StyledButton = styled.button<StyledButtonProps>((props) => {\n const { theme, emphasis } = props;\n const motionToken = theme.motion;\n const styledPropsCSSObject = useStyledProps(props);\n const emphasisColor = emphasis === 'intense' ? 'gray' : 'staticWhite';\n\n if (__DEV__) {\n if (props.$size === 'large' && props.$isHighlighted) {\n throwBladeError({\n moduleName: 'IconButton',\n message: 'size large is not allowed with isHighlighted true',\n });\n return null;\n }\n }\n\n return {\n border: 'none',\n cursor: props.disabled ? 'not-allowed' : 'pointer',\n padding: 0,\n height: props.$isHighlighted\n ? // We throw error for size large on top\n makeSize(highlightedButtonSizeMap[props.$size as 'small' | 'medium'])\n : undefined,\n width: props.$isHighlighted\n ? makeSize(highlightedButtonSizeMap[props.$size as 'small' | 'medium'])\n : undefined,\n borderRadius: props.$isHighlighted ? theme.border.radius.round : theme.border.radius.small,\n background: 'transparent',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n color: props.disabled\n ? theme.colors.interactive.icon[emphasisColor].disabled\n : theme.colors.interactive.icon[emphasisColor].muted,\n transitionProperty: 'color, box-shadow',\n transitionDuration: castWebType(makeMotionTime(motionToken.duration.xquick)),\n transitionTimingFunction: motionToken.easing.standard as string,\n\n '&:hover:not([disabled])': {\n color: theme.colors.interactive.icon[emphasisColor].subtle,\n backgroundColor: props.$isHighlighted\n ? getIn(theme.colors, highlightedHoverColorMap[emphasis])\n : 'transparent',\n },\n\n '&:focus-visible': {\n ...getFocusRingStyles({ theme }),\n color: theme.colors.interactive.icon[emphasisColor].subtle,\n },\n\n '&:active': {\n color: theme.colors.interactive.icon[emphasisColor].subtle,\n },\n ...styledPropsCSSObject,\n };\n});\n\nconst StyledIconButton = React.forwardRef<HTMLButtonElement, StyledIconButtonProps>(\n (\n {\n icon: Icon,\n onClick,\n size,\n emphasis,\n accessibilityLabel,\n isDisabled,\n isHighlighted,\n testID,\n onBlur,\n onFocus,\n onMouseLeave,\n onMouseMove,\n onPointerDown,\n onPointerEnter,\n onTouchEnd,\n onTouchStart,\n tabIndex,\n ...rest\n },\n ref,\n ): ReactElement => (\n <StyledButton\n ref={ref}\n onClick={castWebType(onClick)}\n emphasis={emphasis}\n type=\"button\"\n onBlur={onBlur}\n onFocus={onFocus}\n onMouseLeave={onMouseLeave}\n onMouseMove={onMouseMove}\n onPointerDown={onPointerDown}\n onPointerEnter={onPointerEnter}\n onTouchEnd={onTouchEnd}\n onTouchStart={onTouchStart}\n disabled={isDisabled}\n $isHighlighted={isHighlighted}\n $size={size}\n tabIndex={tabIndex}\n {...makeAccessible({ label: accessibilityLabel })}\n {...metaAttribute({ name: MetaConstants.IconButton, testID })}\n {...makeAnalyticsAttribute(rest)}\n {...rest}\n >\n <Icon size={size} color={isDisabled ? 'interactive.icon.gray.disabled' : 'currentColor'} />\n </StyledButton>\n ),\n);\n\nexport default StyledIconButton;\n"],"names":["StyledButton","styled","button","withConfig","displayName","componentId","props","theme","emphasis","motionToken","motion","styledPropsCSSObject","useStyledProps","emphasisColor","$size","$isHighlighted","throwBladeError","moduleName","message","_objectSpread","border","cursor","disabled","padding","height","makeSize","highlightedButtonSizeMap","undefined","width","borderRadius","radius","round","small","background","display","alignItems","justifyContent","color","colors","interactive","icon","muted","transitionProperty","transitionDuration","castWebType","makeMotionTime","duration","xquick","transitionTimingFunction","easing","standard","subtle","backgroundColor","getIn","highlightedHoverColorMap","getFocusRingStyles","StyledIconButton","React","forwardRef","_ref","ref","Icon","onClick","size","accessibilityLabel","isDisabled","isHighlighted","testID","onBlur","onFocus","onMouseLeave","onMouseMove","onPointerDown","onPointerEnter","onTouchEnd","onTouchStart","tabIndex","rest","_objectWithoutProperties","_excluded","_jsx","type","makeAccessible","label","metaAttribute","name","MetaConstants","IconButton","makeAnalyticsAttribute","children"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,IAAMA,YAAY,gBAAGC,MAAM,CAACC,MAAM,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,mCAAA;EAAAC,WAAA,EAAA,cAAA;AAAA,CAAoB,CAAA,CAAA,UAACC,KAAK,EAAK;AAC/D,EAAA,IAAQC,KAAK,GAAeD,KAAK,CAAzBC,KAAK;IAAEC,QAAQ,GAAKF,KAAK,CAAlBE,QAAQ,CAAA;AACvB,EAAA,IAAMC,WAAW,GAAGF,KAAK,CAACG,MAAM,CAAA;AAChC,EAAA,IAAMC,oBAAoB,GAAGC,cAAc,CAACN,KAAK,CAAC,CAAA;EAClD,IAAMO,aAAa,GAAGL,QAAQ,KAAK,SAAS,GAAG,MAAM,GAAG,aAAa,CAAA;AAErE,EAAA,IAAI,IAAO,EAAE;IACX,IAAIF,KAAK,CAACQ,KAAK,KAAK,OAAO,IAAIR,KAAK,CAACS,cAAc,EAAE;AACnDC,MAAAA,eAAe,CAAC;AACdC,QAAAA,UAAU,EAAE,YAAY;AACxBC,QAAAA,OAAO,EAAE,mDAAA;AACX,OAAC,CAAC,CAAA;AACF,MAAA,OAAO,IAAI,CAAA;AACb,KAAA;AACF,GAAA;AAEA,EAAA,OAAAC,aAAA,CAAA;AACEC,IAAAA,MAAM,EAAE,MAAM;AACdC,IAAAA,MAAM,EAAEf,KAAK,CAACgB,QAAQ,GAAG,aAAa,GAAG,SAAS;AAClDC,IAAAA,OAAO,EAAE,CAAC;IACVC,MAAM,EAAElB,KAAK,CAACS,cAAc;AACxB;IACAU,QAAQ,CAACC,wBAAwB,CAACpB,KAAK,CAACQ,KAAK,CAAuB,CAAC,GACrEa,SAAS;AACbC,IAAAA,KAAK,EAAEtB,KAAK,CAACS,cAAc,GACvBU,QAAQ,CAACC,wBAAwB,CAACpB,KAAK,CAACQ,KAAK,CA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AAEA,GAAI;AACTE,IAAAA,OAAO,EAAElB,WAAW,CAACkB,OAAO,CAAE;AAC9BtD,IAAAA,QAAQ,EAAEA,QAAS;AACnByE,IAAAA,IAAI,EAAC,QAAQ;AACbb,IAAAA,MAAM,EAAEA,MAAO;AACfC,IAAAA,OAAO,EAAEA,OAAQ;AACjBC,IAAAA,YAAY,EAAEA,YAAa;AAC3BC,IAAAA,WAAW,EAAEA,WAAY;AACzBC,IAAAA,aAAa,EAAEA,aAAc;AAC7BC,IAAAA,cAAc,EAAEA,cAAe;AAC/BC,IAAAA,UAAU,EAAEA,UAAW;AACvBC,IAAAA,YAAY,EAAEA,YAAa;AAC3BrD,IAAAA,QAAQ,EAAE2C,UAAW;AACrBlD,IAAAA,cAAc,EAAEmD,aAAc;AAC9BpD,IAAAA,KAAK,EAAEiD,IAAK;AACZa,IAAAA,QAAQ,EAAEA,QAAAA;AAAS,GAAA,EACfM,cAAc,CAAC;AAAEC,IAAAA,KAAK,EAAEnB,kBAAAA;GAAoB,CAAC,CAC7CoB,EAAAA,aAAa,CAAC;IAAEC,IAAI,EAAEC,aAAa,CAACC,UAAU;AAAEpB,IAAAA,MAAM,EAANA,MAAAA;AAAO,GAAC,CAAC,CACzDqB,EAAAA,sBAAsB,CAACX,IAAI,CAAC,GAC5BA,IAAI,CAAA,EAAA,EAAA,EAAA;IAAAY,QAAA,eAERT,GAAA,CAACnB,IAAI,EAAA;AAACE,MAAAA,IAAI,EAAEA,IAAK;AAAC1B,MAAAA,KAAK,EAAE4B,UAAU,GAAG,gCAAgC,GAAG,cAAA;KAAiB,CAAA;AAAC,GAAA,CAC/E,CAAC,CAAA;AAAA,CAEnB;;;;"}
1
+ {"version":3,"file":"StyledIconButton.web.js","sources":["../../../../../../../src/components/Button/IconButton/StyledIconButton.web.tsx"],"sourcesContent":["/* eslint-disable react/display-name */\nimport styled from 'styled-components';\nimport type { ReactElement } from 'react';\nimport React from 'react';\nimport type { StyledIconButtonProps } from './types';\nimport { highlightedButtonSizeMap, highlightedHoverColorMap } from './tokens';\nimport { castWebType, makeSize } from '~utils';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { SubtleOrIntense } from '~tokens/theme/theme';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { makeMotionTime } from '~utils/makeMotionTime';\nimport { getFocusRingStyles } from '~utils/getFocusRingStyles';\nimport { throwBladeError } from '~utils/logger';\nimport getIn from '~utils/lodashButBetter/get';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\nimport { useStyledProps } from '~components/Box/styledProps';\n\ntype StyledButtonProps = {\n emphasis: SubtleOrIntense;\n $isHighlighted: StyledIconButtonProps['isHighlighted'];\n $size: StyledIconButtonProps['size'];\n};\n\nconst StyledButton = styled.button<StyledButtonProps>((props) => {\n const { theme, emphasis } = props;\n const motionToken = theme.motion;\n const styledPropsCSSObject = useStyledProps(props);\n const emphasisColor = emphasis === 'intense' ? 'gray' : 'staticWhite';\n\n if (__DEV__) {\n if (props.$size === 'large' && props.$isHighlighted) {\n throwBladeError({\n moduleName: 'IconButton',\n message: 'size large is not allowed with isHighlighted true',\n });\n return null;\n }\n }\n\n return {\n border: 'none',\n cursor: props.disabled ? 'not-allowed' : 'pointer',\n padding: 0,\n height: props.$isHighlighted\n ? // We throw error for size large on top\n makeSize(highlightedButtonSizeMap[props.$size as 'small' | 'medium'])\n : undefined,\n width: props.$isHighlighted\n ? makeSize(highlightedButtonSizeMap[props.$size as 'small' | 'medium'])\n : undefined,\n borderRadius: props.$isHighlighted ? theme.border.radius.round : theme.border.radius.small,\n background: 'transparent',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n color: props.disabled\n ? theme.colors.interactive.icon[emphasisColor].disabled\n : theme.colors.interactive.icon[emphasisColor].muted,\n transitionProperty: 'color, box-shadow',\n transitionDuration: castWebType(makeMotionTime(motionToken.duration.xquick)),\n transitionTimingFunction: motionToken.easing.standard as string,\n\n '&:hover:not([disabled])': {\n color: theme.colors.interactive.icon[emphasisColor].subtle,\n backgroundColor: props.$isHighlighted\n ? getIn(theme.colors, highlightedHoverColorMap[emphasis])\n : 'transparent',\n },\n\n '&:focus-visible': {\n ...getFocusRingStyles({ theme }),\n color: theme.colors.interactive.icon[emphasisColor].subtle,\n },\n\n '&:active': {\n color: theme.colors.interactive.icon[emphasisColor].subtle,\n },\n ...styledPropsCSSObject,\n };\n});\n\nconst StyledIconButton = React.forwardRef<HTMLButtonElement, StyledIconButtonProps>(\n (\n {\n icon: Icon,\n onClick,\n size,\n emphasis,\n accessibilityLabel,\n accessibilityProps,\n isDisabled,\n isHighlighted,\n testID,\n onBlur,\n onFocus,\n onMouseLeave,\n onMouseMove,\n onPointerDown,\n onPointerEnter,\n onTouchEnd,\n onTouchStart,\n onKeyDown,\n tabIndex,\n ...rest\n },\n ref,\n ): ReactElement => (\n <StyledButton\n ref={ref}\n onClick={castWebType(onClick)}\n emphasis={emphasis}\n type=\"button\"\n onBlur={onBlur}\n onFocus={onFocus}\n onMouseLeave={onMouseLeave}\n onMouseMove={onMouseMove}\n onPointerDown={onPointerDown}\n onPointerEnter={onPointerEnter}\n onTouchEnd={onTouchEnd}\n onTouchStart={onTouchStart}\n onKeyDown={onKeyDown}\n disabled={isDisabled}\n $isHighlighted={isHighlighted}\n $size={size}\n tabIndex={tabIndex}\n {...makeAccessible({\n ...accessibilityProps,\n label: accessibilityLabel ?? accessibilityProps?.label,\n })}\n {...metaAttribute({ name: MetaConstants.IconButton, testID })}\n {...makeAnalyticsAttribute(rest)}\n {...rest}\n >\n <Icon size={size} color={isDisabled ? 'interactive.icon.gray.disabled' : 'currentColor'} />\n </StyledButton>\n ),\n);\n\nexport default StyledIconButton;\n"],"names":["StyledButton","styled","button","withConfig","displayName","componentId","props","theme","emphasis","motionToken","motion","styledPropsCSSObject","useStyledProps","emphasisColor","$size","$isHighlighted","throwBladeError","moduleName","message","_objectSpread","border","cursor","disabled","padding","height","makeSize","highlightedButtonSizeMap","undefined","width","borderRadius","radius","round","small","background","display","alignItems","justifyContent","color","colors","interactive","icon","muted","transitionProperty","transitionDuration","castWebType","makeMotionTime","duration","xquick","transitionTimingFunction","easing","standard","subtle","backgroundColor","getIn","highlightedHoverColorMap","getFocusRingStyles","StyledIconButton","React","forwardRef","_ref","ref","Icon","onClick","size","accessibilityLabel","accessibilityProps","isDisabled","isHighlighted","testID","onBlur","onFocus","onMouseLeave","onMouseMove","onPointerDown","onPointerEnter","onTouchEnd","onTouchStart","onKeyDown","tabIndex","rest","_objectWithoutProperties","_excluded","_jsx","type","makeAccessible","label","metaAttribute","name","MetaConstants","IconButton","makeAnalyticsAttribute","children"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,IAAMA,YAAY,gBAAGC,MAAM,CAACC,MAAM,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,mCAAA;EAAAC,WAAA,EAAA,cAAA;AAAA,CAAoB,CAAA,CAAA,UAACC,KAAK,EAAK;AAC/D,EAAA,IAAQC,KAAK,GAAeD,KAAK,CAAzBC,KAAK;IAAEC,QAAQ,GAAKF,KAAK,CAAlBE,QAAQ,CAAA;AACvB,EAAA,IAAMC,WAAW,GAAGF,KAAK,CAACG,MAAM,CAAA;AAChC,EAAA,IAAMC,oBAAoB,GAAGC,cAAc,CAACN,KAAK,CAAC,CAAA;EAClD,IAAMO,aAAa,GAAGL,QAAQ,KAAK,SAAS,GAAG,MAAM,GAAG,aAAa,CAAA;AAErE,EAAA,IAAI,IAAO,EAAE;IACX,IAAIF,KAAK,CAACQ,KAAK,KAAK,OAAO,IAAIR,KAAK,CAACS,cAAc,EAAE;AACnDC,MAAAA,eAAe,CAAC;AACdC,QAAAA,UAAU,EAAE,YAAY;AACxBC,QAAAA,OAAO,EAAE,mDAAA;AACX,OAAC,CAAC,CAAA;AACF,MAAA,OAAO,IAAI,CAAA;AACb,KAAA;AACF,GAAA;AAEA,EAAA,OAAAC,aAAA,CAAA;AACEC,IAAAA,MAAM,EAAE,MAAM;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