@razorpay/blade 12.21.1 → 12.21.3
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.
- package/build/lib/native/components/ActionList/ActionListItem.js +1 -1
- package/build/lib/native/components/ActionList/ActionListItem.js.map +1 -1
- package/build/lib/native/components/Dropdown/Dropdown.js +1 -1
- package/build/lib/native/components/Dropdown/Dropdown.js.map +1 -1
- package/build/lib/native/components/Dropdown/useDropdown.js +1 -1
- package/build/lib/native/components/Dropdown/useDropdown.js.map +1 -1
- package/build/lib/web/development/components/ActionList/ActionListItem.js +18 -25
- package/build/lib/web/development/components/ActionList/ActionListItem.js.map +1 -1
- package/build/lib/web/development/components/Dropdown/Dropdown.js +11 -17
- package/build/lib/web/development/components/Dropdown/Dropdown.js.map +1 -1
- package/build/lib/web/development/components/Dropdown/FilterChipSelectInput.web.js +32 -14
- package/build/lib/web/development/components/Dropdown/FilterChipSelectInput.web.js.map +1 -1
- package/build/lib/web/development/components/Dropdown/useDropdown.js +0 -2
- package/build/lib/web/development/components/Dropdown/useDropdown.js.map +1 -1
- package/build/lib/web/development/components/FilterChip/BaseFilterChip.web.js +2 -2
- package/build/lib/web/development/components/FilterChip/BaseFilterChip.web.js.map +1 -1
- package/build/lib/web/production/components/ActionList/ActionListItem.js +18 -25
- package/build/lib/web/production/components/ActionList/ActionListItem.js.map +1 -1
- package/build/lib/web/production/components/Dropdown/Dropdown.js +11 -17
- package/build/lib/web/production/components/Dropdown/Dropdown.js.map +1 -1
- package/build/lib/web/production/components/Dropdown/FilterChipSelectInput.web.js +32 -14
- package/build/lib/web/production/components/Dropdown/FilterChipSelectInput.web.js.map +1 -1
- package/build/lib/web/production/components/Dropdown/useDropdown.js +0 -2
- package/build/lib/web/production/components/Dropdown/useDropdown.js.map +1 -1
- package/build/lib/web/production/components/FilterChip/BaseFilterChip.web.js +2 -2
- package/build/lib/web/production/components/FilterChip/BaseFilterChip.web.js.map +1 -1
- package/build/types/components/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -42,7 +42,7 @@ import '../VisuallyHidden/VisuallyHidden.native.js';
|
|
|
42
42
|
import { makeAnalyticsAttribute } from '../../utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js';
|
|
43
43
|
import { Avatar } from '../Avatar/Avatar.native.js';
|
|
44
44
|
|
|
45
|
-
var _excluded=["title","children","testID","_hideDivider","_sectionChildValues"];var StyledActionListSectionTitle=styled(BaseBox)(function(props){return {padding:makeSize(props.theme.spacing[3])};});var _ActionListSectionTitle=function _ActionListSectionTitle(_ref){var title=_ref.title,_ref$isInsideVirtuali=_ref.isInsideVirtualizedList,isInsideVirtualizedList=_ref$isInsideVirtuali===void 0?false:_ref$isInsideVirtuali;return jsx(StyledActionListSectionTitle,Object.assign({},makeAccessible({hidden:!isInsideVirtualizedList,role:isInsideVirtualizedList?'heading':undefined}),{children:jsx(Text,{color:"surface.text.gray.muted",size:"small",weight:"semibold",children:title})}));};var ActionListSectionTitle=assignWithoutSideEffects(_ActionListSectionTitle,{componentId:componentIds.ActionListSectionTitle});var _ActionListSection=function _ActionListSection(_ref2){var title=_ref2.title,children=_ref2.children,testID=_ref2.testID,_hideDivider=_ref2._hideDivider,_sectionChildValues=_ref2._sectionChildValues,rest=_objectWithoutProperties(_ref2,_excluded);var _useDropdown=useDropdown(),hasAutoCompleteInHeader=_useDropdown.hasAutoCompleteInHeader,dropdownTriggerer=_useDropdown.dropdownTriggerer,filteredValues=_useDropdown.filteredValues;var hasAutoComplete=hasAutoCompleteInHeader||dropdownTriggerer===dropdownComponentIds.triggers.AutoComplete;var isSectionVisible=React__default.useMemo(function(){if(hasAutoComplete){var visibleActionListItemInSection=_sectionChildValues==null?void 0:_sectionChildValues.find(function(actionItemValue){return filteredValues.includes(actionItemValue);});return Boolean(visibleActionListItemInSection);}return true;},[_sectionChildValues,hasAutoComplete,filteredValues]);var showDividerInRN=!(_hideDivider&&isReactNative());var showDividerInAutoComplete=hasAutoComplete?isSectionVisible&&filteredValues.length>1:true;return jsxs(BaseBox,Object.assign({},makeAccessible({role:getActionListSectionRole(),label:title}),metaAttribute({name:MetaConstants.ActionListSection,testID:testID}),makeAnalyticsAttribute(rest),{children:[isSectionVisible?jsx(ActionListSectionTitle,{title:title}):null,jsx(BaseBox,Object.assign({},makeAccessible({role:isReactNative()?undefined:'listbox'}),{children:children})),showDividerInAutoComplete&&showDividerInRN?jsx(Divider,{marginX:"spacing.3",marginY:"spacing.1"}):null]}));};var ActionListSection=assignWithoutSideEffects(React__default.memo(_ActionListSection),{componentId:componentIds.ActionListSection});var _ActionListItemIcon=function _ActionListItemIcon(_ref3){var icon=_ref3.icon;var Icon=icon;var _useBaseMenuItem=useBaseMenuItem(),color=_useBaseMenuItem.color,isDisabled=_useBaseMenuItem.isDisabled;var iconState=isDisabled?'disabled':'muted';return jsx(Icon,{color:color==='negative'?'feedback.icon.negative.intense':`interactive.icon.gray.${iconState}`,size:"medium"});};var ActionListItemIcon=assignWithoutSideEffects(_ActionListItemIcon,{componentId:componentIds.ActionListItemIcon});var _ActionListItemBadgeGroup=function _ActionListItemBadgeGroup(_ref4){var children=_ref4.children;return jsx(Box,{display:"flex",alignItems:"center",flexDirection:"row",children:children});};var ActionListItemBadgeGroup=assignWithoutSideEffects(_ActionListItemBadgeGroup,{componentId:componentIds.ActionListItemBadgeGroup});var _ActionListItemAvatar=function _ActionListItemAvatar(avatarProps){return jsx(Avatar,Object.assign({size:"xsmall"},avatarProps));};var ActionListItemAvatar=assignWithoutSideEffects(_ActionListItemAvatar,{componentId:componentIds.ActionListItemAvatar});var _ActionListItemBadge=function _ActionListItemBadge(props){return jsx(Badge,Object.assign({size:"medium",marginLeft:"spacing.3"},props));};var ActionListItemBadge=assignWithoutSideEffects(_ActionListItemBadge,{componentId:componentIds.ActionListItemBadge});var _ActionListItemText=function _ActionListItemText(_ref5){var children=_ref5.children;var _useBaseMenuItem2=useBaseMenuItem(),isDisabled=_useBaseMenuItem2.isDisabled;return jsx(Text,{variant:"caption",color:getNormalTextColor(isDisabled,{isMuted:true}),children:children});};var ActionListItemText=assignWithoutSideEffects(_ActionListItemText,{componentId:componentIds.ActionListItemText});var BaseMenuLeadingItem=function BaseMenuLeadingItem(_ref6){var isSelected=_ref6.isSelected,
|
|
45
|
+
var _excluded=["title","children","testID","_hideDivider","_sectionChildValues"];var StyledActionListSectionTitle=styled(BaseBox)(function(props){return {padding:makeSize(props.theme.spacing[3])};});var _ActionListSectionTitle=function _ActionListSectionTitle(_ref){var title=_ref.title,_ref$isInsideVirtuali=_ref.isInsideVirtualizedList,isInsideVirtualizedList=_ref$isInsideVirtuali===void 0?false:_ref$isInsideVirtuali;return jsx(StyledActionListSectionTitle,Object.assign({},makeAccessible({hidden:!isInsideVirtualizedList,role:isInsideVirtualizedList?'heading':undefined}),{children:jsx(Text,{color:"surface.text.gray.muted",size:"small",weight:"semibold",children:title})}));};var ActionListSectionTitle=assignWithoutSideEffects(_ActionListSectionTitle,{componentId:componentIds.ActionListSectionTitle});var _ActionListSection=function _ActionListSection(_ref2){var title=_ref2.title,children=_ref2.children,testID=_ref2.testID,_hideDivider=_ref2._hideDivider,_sectionChildValues=_ref2._sectionChildValues,rest=_objectWithoutProperties(_ref2,_excluded);var _useDropdown=useDropdown(),hasAutoCompleteInHeader=_useDropdown.hasAutoCompleteInHeader,dropdownTriggerer=_useDropdown.dropdownTriggerer,filteredValues=_useDropdown.filteredValues;var hasAutoComplete=hasAutoCompleteInHeader||dropdownTriggerer===dropdownComponentIds.triggers.AutoComplete;var isSectionVisible=React__default.useMemo(function(){if(hasAutoComplete){var visibleActionListItemInSection=_sectionChildValues==null?void 0:_sectionChildValues.find(function(actionItemValue){return filteredValues.includes(actionItemValue);});return Boolean(visibleActionListItemInSection);}return true;},[_sectionChildValues,hasAutoComplete,filteredValues]);var showDividerInRN=!(_hideDivider&&isReactNative());var showDividerInAutoComplete=hasAutoComplete?isSectionVisible&&filteredValues.length>1:true;return jsxs(BaseBox,Object.assign({},makeAccessible({role:getActionListSectionRole(),label:title}),metaAttribute({name:MetaConstants.ActionListSection,testID:testID}),makeAnalyticsAttribute(rest),{children:[isSectionVisible?jsx(ActionListSectionTitle,{title:title}):null,jsx(BaseBox,Object.assign({},makeAccessible({role:isReactNative()?undefined:'listbox'}),{children:children})),showDividerInAutoComplete&&showDividerInRN?jsx(Divider,{marginX:"spacing.3",marginY:"spacing.1"}):null]}));};var ActionListSection=assignWithoutSideEffects(React__default.memo(_ActionListSection),{componentId:componentIds.ActionListSection});var _ActionListItemIcon=function _ActionListItemIcon(_ref3){var icon=_ref3.icon;var Icon=icon;var _useBaseMenuItem=useBaseMenuItem(),color=_useBaseMenuItem.color,isDisabled=_useBaseMenuItem.isDisabled;var iconState=isDisabled?'disabled':'muted';return jsx(Icon,{color:color==='negative'?'feedback.icon.negative.intense':`interactive.icon.gray.${iconState}`,size:"medium"});};var ActionListItemIcon=assignWithoutSideEffects(_ActionListItemIcon,{componentId:componentIds.ActionListItemIcon});var _ActionListItemBadgeGroup=function _ActionListItemBadgeGroup(_ref4){var children=_ref4.children;return jsx(Box,{display:"flex",alignItems:"center",flexDirection:"row",children:children});};var ActionListItemBadgeGroup=assignWithoutSideEffects(_ActionListItemBadgeGroup,{componentId:componentIds.ActionListItemBadgeGroup});var _ActionListItemAvatar=function _ActionListItemAvatar(avatarProps){return jsx(Avatar,Object.assign({size:"xsmall"},avatarProps));};var ActionListItemAvatar=assignWithoutSideEffects(_ActionListItemAvatar,{componentId:componentIds.ActionListItemAvatar});var _ActionListItemBadge=function _ActionListItemBadge(props){return jsx(Badge,Object.assign({size:"medium",marginLeft:"spacing.3"},props));};var ActionListItemBadge=assignWithoutSideEffects(_ActionListItemBadge,{componentId:componentIds.ActionListItemBadge});var _ActionListItemText=function _ActionListItemText(_ref5){var children=_ref5.children;var _useBaseMenuItem2=useBaseMenuItem(),isDisabled=_useBaseMenuItem2.isDisabled;return jsx(Text,{variant:"caption",color:getNormalTextColor(isDisabled,{isMuted:true}),children:children});};var ActionListItemText=assignWithoutSideEffects(_ActionListItemText,{componentId:componentIds.ActionListItemText});var BaseMenuLeadingItem=function BaseMenuLeadingItem(_ref6){var isSelected=_ref6.isSelected,isDisabled=_ref6.isDisabled;return jsx(BaseBox,Object.assign({pointerEvents:"none"},makeAccessible({hidden:true}),{children:jsx(Checkbox,{isChecked:isSelected,tabIndex:-1,isDisabled:isDisabled,children:null})}));};var makeActionListItemClickable=function makeActionListItemClickable(clickHandler){if(isReactNative()){return {onPress:clickHandler};}return {onClick:clickHandler};};var _ActionListItem=function _ActionListItem(props){var _useDropdown2=useDropdown(),activeIndex=_useDropdown2.activeIndex,dropdownBaseId=_useDropdown2.dropdownBaseId,onOptionClick=_useDropdown2.onOptionClick,selectedIndices=_useDropdown2.selectedIndices,setShouldIgnoreBlurAnimation=_useDropdown2.setShouldIgnoreBlurAnimation,selectionType=_useDropdown2.selectionType,dropdownTriggerer=_useDropdown2.dropdownTriggerer,isKeydownPressed=_useDropdown2.isKeydownPressed,filteredValues=_useDropdown2.filteredValues,hasAutoCompleteInHeader=_useDropdown2.hasAutoCompleteInHeader;React__default.useEffect(function(){if(activeIndex===props._index&&props._virtualizedIndex!==undefined){props._onVirtualizedFocus==null?void 0:props._onVirtualizedFocus(props._virtualizedIndex);}},[activeIndex]);var hasAutoComplete=hasAutoCompleteInHeader||dropdownTriggerer===dropdownComponentIds.triggers.AutoComplete;var hasFilterChipSelectInput=dropdownTriggerer===dropdownComponentIds.triggers.FilterChipSelectInput;var renderOnWebAs=props.href?'a':'button';var getIsSelected=function getIsSelected(){if(dropdownTriggerer===dropdownComponentIds.triggers.SelectInput||hasAutoComplete||hasFilterChipSelectInput){if(typeof props._index==='number'){return selectedIndices.includes(props._index);}return undefined;}return props.isSelected;};var isSelected=getIsSelected();React__default.useEffect(function(){validateActionListItemProps({leading:props.leading,trailing:props.trailing,titleSuffix:props.titleSuffix});},[props.leading,props.trailing,props.titleSuffix]);React__default.useEffect(function(){if(__DEV__){if(dropdownTriggerer===dropdownComponentIds.triggers.SelectInput&&props.intent==='negative'){throwBladeError({message:'negative intent ActionListItem cannot be used inside Dropdown with SelectInput trigger',moduleName:'ActionListItem'});}}},[props.intent,dropdownTriggerer]);var isVisible=hasAutoComplete&&filteredValues?filteredValues.includes(props.value):true;return jsx(BaseMenuItem,Object.assign({isVisible:isVisible,as:!isReactNative()?renderOnWebAs:undefined,id:`${dropdownBaseId}-${props._index}`,tabIndex:-1,title:props.title,description:props.description,leading:selectionType==='multiple'?jsx(BaseMenuLeadingItem,{isSelected:isSelected,isDisabled:props.isDisabled},`${dropdownBaseId}-${props._index}-leading-${isSelected}`):props.leading,trailing:props.trailing,titleSuffix:props.titleSuffix,href:props.href,target:props.target,className:activeIndex===props._index?'active-focus':'',isSelected:isSelected,isDisabled:props.isDisabled,role:getActionListItemRole(dropdownTriggerer,props.href)},makeActionListItemClickable(function(e){if(typeof props._index==='number'){onOptionClick(e,props._index);props.onClick==null?void 0:props.onClick({name:props.value,value:isSelected,event:castWebType(e)});}}),makeAnalyticsAttribute(Object.assign({},props)),metaAttribute({name:MetaConstants.ActionListItem,testID:props.testID}),{onMouseDown:function onMouseDown(){setShouldIgnoreBlurAnimation(true);},onMouseUp:function onMouseUp(){setShouldIgnoreBlurAnimation(false);},"data-value":props.value,"data-index":props._index,selectionType:selectionType,color:props.intent,isKeydownPressed:isKeydownPressed}));};var ActionListItem=assignWithoutSideEffects(React__default.memo(_ActionListItem),{componentId:componentIds.ActionListItem,displayName:componentIds.ActionListItem});
|
|
46
46
|
|
|
47
47
|
export { ActionListItem, ActionListItemAvatar, ActionListItemBadge, ActionListItemBadgeGroup, ActionListItemIcon, ActionListItemText, ActionListSection, ActionListSectionTitle };
|
|
48
48
|
//# sourceMappingURL=ActionListItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionListItem.js","sources":["../../../../../src/components/ActionList/ActionListItem.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/ban-ts-comment */\nimport React from 'react';\nimport styled from 'styled-components';\nimport type { TouchableOpacity } from 'react-native';\nimport { componentIds } from './componentIds';\nimport { validateActionListItemProps, getNormalTextColor } from './actionListUtils';\nimport { getActionListItemRole, getActionListSectionRole } from './getA11yRoles';\nimport { Divider } from '~components/Divider';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { IconComponent } from '~components/Icons';\nimport { useDropdown } from '~components/Dropdown/useDropdown';\nimport type { FeedbackColors } from '~tokens/theme/theme';\nimport { Text } from '~components/Typography';\nimport type { Platform } from '~utils';\nimport { castWebType, isReactNative } from '~utils';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { DataAnalyticsAttribute, StringChildrenType, TestID } from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { makeSize } from '~utils/makeSize';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { throwBladeError } from '~utils/logger';\nimport type { BadgeProps } from '~components/Badge';\nimport { Badge } from '~components/Badge';\nimport { Box } from '~components/Box';\nimport { dropdownComponentIds } from '~components/Dropdown/dropdownComponentIds';\nimport { BaseMenuItem, useBaseMenuItem } from '~components/BaseMenu';\nimport { Checkbox } from '~components/Checkbox';\nimport type { AvatarProps } from '~components/Avatar/types';\nimport { Avatar } from '~components/Avatar';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\ntype ActionListItemProps = {\n title: string;\n description?: string;\n onClick?: (clickProps: {\n name: string;\n value?: boolean;\n event: Platform.Select<{\n web: React.MouseEvent;\n native: React.TouchEvent<TouchableOpacity>;\n }>;\n }) => void;\n /**\n * value that you get from `onChange` event on SelectInput or in form submissions.\n */\n value: string;\n /**\n * Link to open when item is clicked.\n */\n href?: string;\n /**\n * HTML target of the link\n */\n target?: string;\n /**\n * Item that goes on left-side of item.\n *\n * Valid elements - `<ActionListItemIcon />`, `<ActionListItemAsset />`\n *\n * Will be overriden in multiselect\n */\n leading?: React.ReactNode;\n /**\n * Item that goes on right-side of item.\n *\n * Valid elements - `<ActionListItemText />`, `<ActionListItemIcon />`\n */\n trailing?: React.ReactNode;\n /**\n * Item that goes immediately next to the title.\n *\n * Valid elements - `<ActionListItemBadge />`, `<ActionListItemBadgeGroup />`\n *\n */\n titleSuffix?: React.ReactElement;\n isDisabled?: boolean;\n intent?: Extract<FeedbackColors, 'negative'>;\n /**\n * Can be used in combination of `onClick` to highlight item as selected in Button Triggers.\n *\n * When trigger is SelectInput, Use `value` prop on SelectInput instead to make dropdown controlled.\n */\n isSelected?: boolean;\n /**\n * Internally passed from ActionList. No need to pass it explicitly\n *\n * @private\n */\n _index?: number;\n /**\n * Internally used to pass index for virtualized lists\n *\n * @private\n */\n _virtualizedIndex?: number;\n /**\n * Internally used to focus on virtualized list\n *\n * @private\n */\n _onVirtualizedFocus?: (_virtuazedIndex: number) => void;\n} & TestID &\n DataAnalyticsAttribute;\n\nconst StyledActionListSectionTitle = styled(BaseBox)((props) => ({\n // @TODO: replace this styled-component with new layout box when we have padding shorthand\n padding: makeSize(props.theme.spacing[3]),\n}));\n\ntype ActionListSectionProps = {\n title: string;\n children: React.ReactNode[] | React.ReactNode;\n /**\n * Internally used to hide the divider on final item in React Native\n *\n * Should not be used by consumers (also won't work on web)\n *\n * @private\n */\n _hideDivider?: boolean;\n /**\n * Internally used to hide / show section in AutoComplete\n *\n * @private\n */\n _sectionChildValues?: string[];\n} & TestID &\n DataAnalyticsAttribute;\n\nconst _ActionListSectionTitle = ({\n title,\n isInsideVirtualizedList = false,\n}: {\n title: string;\n isInsideVirtualizedList?: boolean;\n}): React.ReactElement => {\n return (\n <StyledActionListSectionTitle\n {...makeAccessible({\n hidden: !isInsideVirtualizedList,\n role: isInsideVirtualizedList ? 'heading' : undefined,\n })}\n >\n <Text color=\"surface.text.gray.muted\" size=\"small\" weight=\"semibold\">\n {title}\n </Text>\n </StyledActionListSectionTitle>\n );\n};\n\nconst ActionListSectionTitle = assignWithoutSideEffects(_ActionListSectionTitle, {\n componentId: componentIds.ActionListSectionTitle,\n});\nconst _ActionListSection = ({\n title,\n children,\n testID,\n _hideDivider,\n _sectionChildValues,\n ...rest\n}: ActionListSectionProps): React.ReactElement => {\n const { hasAutoCompleteInHeader, dropdownTriggerer, filteredValues } = useDropdown();\n const hasAutoComplete =\n hasAutoCompleteInHeader || dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete;\n\n const isSectionVisible = React.useMemo(() => {\n if (hasAutoComplete) {\n const visibleActionListItemInSection = _sectionChildValues?.find((actionItemValue) =>\n filteredValues.includes(actionItemValue),\n );\n\n return Boolean(visibleActionListItemInSection);\n }\n\n return true;\n }, [_sectionChildValues, hasAutoComplete, filteredValues]);\n\n const showDividerInRN = !(_hideDivider && isReactNative());\n const showDividerInAutoComplete = hasAutoComplete\n ? isSectionVisible && filteredValues.length > 1\n : true;\n\n return (\n <BaseBox\n {...makeAccessible({\n role: getActionListSectionRole(),\n label: title,\n })}\n {...metaAttribute({ name: MetaConstants.ActionListSection, testID })}\n {...makeAnalyticsAttribute(rest as Record<string, unknown>)}\n >\n {/* We're announcing title as group label so we can hide this */}\n {isSectionVisible ? <ActionListSectionTitle title={title} /> : null}\n\n <BaseBox\n {...makeAccessible({\n // On web, we just wrap it in another listbox to announce item count properly for particular group.\n // On React Native, we ignore it since `menu` + `group` role will take care of accessibility\n role: isReactNative() ? undefined : 'listbox',\n })}\n >\n {children}\n </BaseBox>\n {showDividerInAutoComplete && showDividerInRN ? (\n <Divider marginX=\"spacing.3\" marginY=\"spacing.1\" />\n ) : null}\n </BaseBox>\n );\n};\n\nconst ActionListSection = assignWithoutSideEffects(React.memo(_ActionListSection), {\n componentId: componentIds.ActionListSection,\n});\n\nconst _ActionListItemIcon = ({ icon }: { icon: IconComponent }): React.ReactElement => {\n const Icon = icon;\n const { color, isDisabled } = useBaseMenuItem();\n const iconState = isDisabled ? 'disabled' : 'muted';\n return (\n <Icon\n color={\n color === 'negative'\n ? 'feedback.icon.negative.intense'\n : `interactive.icon.gray.${iconState}`\n }\n size=\"medium\"\n />\n );\n};\n\nconst ActionListItemIcon = assignWithoutSideEffects(_ActionListItemIcon, {\n componentId: componentIds.ActionListItemIcon,\n});\n\nconst _ActionListItemBadgeGroup = ({\n children,\n}: {\n children: React.ReactElement[] | React.ReactElement;\n}): React.ReactElement => {\n return (\n <Box display=\"flex\" alignItems=\"center\" flexDirection=\"row\">\n {children}\n </Box>\n );\n};\n\nconst ActionListItemBadgeGroup = assignWithoutSideEffects(_ActionListItemBadgeGroup, {\n componentId: componentIds.ActionListItemBadgeGroup,\n});\n\nconst _ActionListItemAvatar = (avatarProps: Omit<AvatarProps, 'size' | ''>): React.ReactElement => {\n return <Avatar size=\"xsmall\" {...avatarProps} />;\n};\n\nconst ActionListItemAvatar = assignWithoutSideEffects(_ActionListItemAvatar, {\n componentId: componentIds.ActionListItemAvatar,\n});\n\nconst _ActionListItemBadge = (props: BadgeProps): React.ReactElement => {\n return <Badge size=\"medium\" marginLeft=\"spacing.3\" {...props} />;\n};\n\nconst ActionListItemBadge = assignWithoutSideEffects(_ActionListItemBadge, {\n componentId: componentIds.ActionListItemBadge,\n});\n\nconst _ActionListItemText = ({\n children,\n}: {\n children: StringChildrenType;\n}): React.ReactElement => {\n const { isDisabled } = useBaseMenuItem();\n\n return (\n <Text variant=\"caption\" color={getNormalTextColor(isDisabled, { isMuted: true })}>\n {children}\n </Text>\n );\n};\n\nconst ActionListItemText = assignWithoutSideEffects(_ActionListItemText, {\n componentId: componentIds.ActionListItemText,\n});\n\nconst BaseMenuLeadingItem = ({\n isSelected,\n leading,\n selectionType,\n isDisabled,\n}: {\n isSelected?: boolean;\n leading?: React.ReactNode;\n selectionType: string | undefined;\n isDisabled?: boolean;\n}): React.ReactElement | null => {\n if (selectionType === 'multiple') {\n return (\n <BaseBox\n pointerEvents=\"none\"\n // Adding aria-hidden because the listbox item in multiselect in itself explains the behaviour so announcing checkbox is unneccesary and just a nice UI tweak for us\n {...makeAccessible({\n hidden: true,\n })}\n >\n <Checkbox isChecked={isSelected} tabIndex={-1} isDisabled={isDisabled}>\n {/*\n Checkbox requires children. Didn't want to make it optional because its helpful for consumers\n But for this case in particular, we just want to use Text separately so that we can control spacing and color and keep it consistent with non-multiselect dropdowns\n */}\n {null}\n </Checkbox>\n </BaseBox>\n );\n }\n return React.isValidElement(leading) ? leading : null;\n};\n\ntype ClickHandlerType = (e: React.MouseEvent<HTMLButtonElement>) => void;\n\nconst makeActionListItemClickable = (\n clickHandler: ClickHandlerType,\n): { onPress?: (e: React.TouchEvent<TouchableOpacity>) => void; onClick?: ClickHandlerType } => {\n if (isReactNative()) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment, @typescript-eslint/prefer-ts-expect-error\n // @ts-ignore: ignoring ReactNative press type for the peace of mind\n return { onPress: clickHandler };\n }\n\n return {\n onClick: clickHandler,\n };\n};\n\n/**\n * ### ActionListItem\n *\n * Creates option inside `ActionList`.\n *\n * #### Usage\n *\n * ```jsx\n * <ActionList>\n * <ActionListItem\n * title=\"Home\"\n * value=\"home\"\n * leading={<ActionListItemIcon icon={HomeIcon} />}\n * trailing={<ActionListItemText>⌘ + S</ActionListItemText>}\n * />\n * </ActionList>\n * ```\n */\nconst _ActionListItem = (props: ActionListItemProps): React.ReactElement => {\n const {\n activeIndex,\n dropdownBaseId,\n onOptionClick,\n selectedIndices,\n setShouldIgnoreBlurAnimation,\n selectionType,\n dropdownTriggerer,\n isKeydownPressed,\n filteredValues,\n hasAutoCompleteInHeader,\n hasUnControlledFilterChipSelectInput,\n } = useDropdown();\n\n React.useEffect(() => {\n if (activeIndex === props._index && props._virtualizedIndex !== undefined) {\n props._onVirtualizedFocus?.(props._virtualizedIndex as number);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [activeIndex]);\n\n const hasAutoComplete =\n hasAutoCompleteInHeader || dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete;\n\n const renderOnWebAs = props.href ? 'a' : 'button';\n /**\n * In SelectInput, returns the isSelected according to selected indexes in the state\n *\n * In Other Triggers (Menu Usecase), returns `props.isSelected` since passing the\n * isSelected prop explicitly is the only way to select item in menu\n */\n const getIsSelected = (): boolean | undefined => {\n if (\n dropdownTriggerer === dropdownComponentIds.triggers.SelectInput ||\n hasAutoComplete ||\n hasUnControlledFilterChipSelectInput\n ) {\n if (typeof props._index === 'number') {\n return selectedIndices.includes(props._index);\n }\n return undefined;\n }\n\n return props.isSelected;\n };\n\n const isSelected = getIsSelected();\n\n React.useEffect(() => {\n validateActionListItemProps({\n leading: props.leading,\n trailing: props.trailing,\n titleSuffix: props.titleSuffix,\n });\n }, [props.leading, props.trailing, props.titleSuffix]);\n\n React.useEffect(() => {\n if (__DEV__) {\n if (\n dropdownTriggerer === dropdownComponentIds.triggers.SelectInput &&\n props.intent === 'negative'\n ) {\n throwBladeError({\n message:\n 'negative intent ActionListItem cannot be used inside Dropdown with SelectInput trigger',\n moduleName: 'ActionListItem',\n });\n }\n }\n }, [props.intent, dropdownTriggerer]);\n\n const isVisible = hasAutoComplete && filteredValues ? filteredValues.includes(props.value) : true;\n\n return (\n <BaseMenuItem\n isVisible={isVisible}\n as={!isReactNative() ? renderOnWebAs : undefined}\n id={`${dropdownBaseId}-${props._index}`}\n tabIndex={-1}\n title={props.title}\n description={props.description}\n leading={\n <BaseMenuLeadingItem\n key={`${dropdownBaseId}-${props._index}-leading-${isSelected}`}\n isSelected={isSelected}\n leading={props.leading}\n selectionType={selectionType}\n isDisabled={props.isDisabled}\n />\n }\n trailing={props.trailing}\n titleSuffix={props.titleSuffix}\n href={props.href}\n target={props.target}\n className={activeIndex === props._index ? 'active-focus' : ''}\n isSelected={isSelected}\n isDisabled={props.isDisabled}\n role={getActionListItemRole(dropdownTriggerer, props.href)}\n {...makeActionListItemClickable((e: React.MouseEvent<HTMLButtonElement>): void => {\n if (typeof props._index === 'number') {\n onOptionClick(e, props._index);\n props.onClick?.({ name: props.value, value: isSelected, event: castWebType(e) });\n }\n })}\n {...makeAnalyticsAttribute({ ...props })}\n {...metaAttribute({ name: MetaConstants.ActionListItem, testID: props.testID })}\n onMouseDown={() => {\n // We want to keep focus on Dropdown's trigger while option is being clicked\n // So We set this flag that ignores the blur animation to avoid the flicker between focus out + focus in\n setShouldIgnoreBlurAnimation(true);\n }}\n onMouseUp={() => {\n // (Contd from above comment...) We set this flag back to false since blur of SelectInput is done calling by this time\n setShouldIgnoreBlurAnimation(false);\n }}\n data-value={props.value}\n data-index={props._index}\n selectionType={selectionType}\n color={props.intent}\n isKeydownPressed={isKeydownPressed}\n />\n );\n};\n\nconst ActionListItem = assignWithoutSideEffects(React.memo(_ActionListItem), {\n componentId: componentIds.ActionListItem,\n displayName: componentIds.ActionListItem,\n});\n\nexport type { ActionListItemProps, ActionListSectionProps };\nexport {\n ActionListItem,\n ActionListItemIcon,\n ActionListItemText,\n ActionListItemAvatar,\n ActionListItemBadge,\n ActionListItemBadgeGroup,\n ActionListSection,\n ActionListSectionTitle,\n};\n"],"names":["StyledActionListSectionTitle","styled","BaseBox","props","padding","makeSize","theme","spacing","_ActionListSectionTitle","_ref","title","_ref$isInsideVirtuali","isInsideVirtualizedList","_jsx","Object","assign","makeAccessible","hidden","role","undefined","children","Text","color","size","weight","ActionListSectionTitle","assignWithoutSideEffects","componentId","componentIds","_ActionListSection","_ref2","testID","_hideDivider","_sectionChildValues","rest","_objectWithoutProperties","_excluded","_useDropdown","useDropdown","hasAutoCompleteInHeader","dropdownTriggerer","filteredValues","hasAutoComplete","dropdownComponentIds","triggers","AutoComplete","isSectionVisible","React","useMemo","visibleActionListItemInSection","find","actionItemValue","includes","Boolean","showDividerInRN","isReactNative","showDividerInAutoComplete","length","_jsxs","getActionListSectionRole","label","metaAttribute","name","MetaConstants","ActionListSection","makeAnalyticsAttribute","Divider","marginX","marginY","memo","_ActionListItemIcon","_ref3","icon","Icon","_useBaseMenuItem","useBaseMenuItem","isDisabled","iconState","ActionListItemIcon","_ActionListItemBadgeGroup","_ref4","Box","display","alignItems","flexDirection","ActionListItemBadgeGroup","_ActionListItemAvatar","avatarProps","Avatar","ActionListItemAvatar","_ActionListItemBadge","Badge","marginLeft","ActionListItemBadge","_ActionListItemText","_ref5","_useBaseMenuItem2","variant","getNormalTextColor","isMuted","ActionListItemText","BaseMenuLeadingItem","_ref6","isSelected","leading","selectionType","pointerEvents","Checkbox","isChecked","tabIndex","isValidElement","makeActionListItemClickable","clickHandler","onPress","onClick","_ActionListItem","_useDropdown2","activeIndex","dropdownBaseId","onOptionClick","selectedIndices","setShouldIgnoreBlurAnimation","isKeydownPressed","hasUnControlledFilterChipSelectInput","useEffect","_index","_virtualizedIndex","_onVirtualizedFocus","renderOnWebAs","href","getIsSelected","SelectInput","validateActionListItemProps","trailing","titleSuffix","__DEV__","intent","throwBladeError","message","moduleName","isVisible","value","BaseMenuItem","as","id","description","target","className","getActionListItemRole","e","event","castWebType","ActionListItem","onMouseDown","onMouseUp","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iFAwGA,IAAMA,4BAA4B,CAAGC,MAAM,CAACC,OAAO,CAAC,CAAC,SAACC,KAAK,CAAA,CAAA,OAAM,CAE/DC,OAAO,CAAEC,QAAQ,CAACF,KAAK,CAACG,KAAK,CAACC,OAAO,CAAC,CAAC,CAAC,CAC1C,CAAC,EAAC,CAAC,CAsBH,IAAMC,uBAAuB,CAAG,SAA1BA,uBAAuBA,CAAAC,IAAA,CAMH,KALxBC,KAAK,CAAAD,IAAA,CAALC,KAAK,CAAAC,qBAAA,CAAAF,IAAA,CACLG,uBAAuB,CAAvBA,uBAAuB,CAAAD,qBAAA,GAAG,KAAA,CAAA,CAAA,KAAK,CAAAA,qBAAA,CAK/B,OACEE,GAAA,CAACb,4BAA4B,CAAAc,MAAA,CAAAC,MAAA,CAAA,EAAA,CACvBC,cAAc,CAAC,CACjBC,MAAM,CAAE,CAACL,uBAAuB,CAChCM,IAAI,CAAEN,uBAAuB,CAAG,SAAS,CAAGO,SAC9C,CAAC,CAAC,CAAA,C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CAAC4H,cAAc,CACxCG,WAAW,CAAE/H,YAAY,CAAC4H,cAC5B,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"ActionListItem.js","sources":["../../../../../src/components/ActionList/ActionListItem.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/ban-ts-comment */\nimport React from 'react';\nimport styled from 'styled-components';\nimport type { TouchableOpacity } from 'react-native';\nimport { componentIds } from './componentIds';\nimport { validateActionListItemProps, getNormalTextColor } from './actionListUtils';\nimport { getActionListItemRole, getActionListSectionRole } from './getA11yRoles';\nimport { Divider } from '~components/Divider';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { IconComponent } from '~components/Icons';\nimport { useDropdown } from '~components/Dropdown/useDropdown';\nimport type { FeedbackColors } from '~tokens/theme/theme';\nimport { Text } from '~components/Typography';\nimport type { Platform } from '~utils';\nimport { castWebType, isReactNative } from '~utils';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { DataAnalyticsAttribute, StringChildrenType, TestID } from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { makeSize } from '~utils/makeSize';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { throwBladeError } from '~utils/logger';\nimport type { BadgeProps } from '~components/Badge';\nimport { Badge } from '~components/Badge';\nimport { Box } from '~components/Box';\nimport { dropdownComponentIds } from '~components/Dropdown/dropdownComponentIds';\nimport { BaseMenuItem, useBaseMenuItem } from '~components/BaseMenu';\nimport { Checkbox } from '~components/Checkbox';\nimport type { AvatarProps } from '~components/Avatar/types';\nimport { Avatar } from '~components/Avatar';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\ntype ActionListItemProps = {\n title: string;\n description?: string;\n onClick?: (clickProps: {\n name: string;\n value?: boolean;\n event: Platform.Select<{\n web: React.MouseEvent;\n native: React.TouchEvent<TouchableOpacity>;\n }>;\n }) => void;\n /**\n * value that you get from `onChange` event on SelectInput or in form submissions.\n */\n value: string;\n /**\n * Link to open when item is clicked.\n */\n href?: string;\n /**\n * HTML target of the link\n */\n target?: string;\n /**\n * Item that goes on left-side of item.\n *\n * Valid elements - `<ActionListItemIcon />`, `<ActionListItemAsset />`\n *\n * Will be overriden in multiselect\n */\n leading?: React.ReactNode;\n /**\n * Item that goes on right-side of item.\n *\n * Valid elements - `<ActionListItemText />`, `<ActionListItemIcon />`\n */\n trailing?: React.ReactNode;\n /**\n * Item that goes immediately next to the title.\n *\n * Valid elements - `<ActionListItemBadge />`, `<ActionListItemBadgeGroup />`\n *\n */\n titleSuffix?: React.ReactElement;\n isDisabled?: boolean;\n intent?: Extract<FeedbackColors, 'negative'>;\n /**\n * Can be used in combination of `onClick` to highlight item as selected in Button Triggers.\n *\n * When trigger is SelectInput, Use `value` prop on SelectInput instead to make dropdown controlled.\n */\n isSelected?: boolean;\n /**\n * Internally passed from ActionList. No need to pass it explicitly\n *\n * @private\n */\n _index?: number;\n /**\n * Internally used to pass index for virtualized lists\n *\n * @private\n */\n _virtualizedIndex?: number;\n /**\n * Internally used to focus on virtualized list\n *\n * @private\n */\n _onVirtualizedFocus?: (_virtuazedIndex: number) => void;\n} & TestID &\n DataAnalyticsAttribute;\n\nconst StyledActionListSectionTitle = styled(BaseBox)((props) => ({\n // @TODO: replace this styled-component with new layout box when we have padding shorthand\n padding: makeSize(props.theme.spacing[3]),\n}));\n\ntype ActionListSectionProps = {\n title: string;\n children: React.ReactNode[] | React.ReactNode;\n /**\n * Internally used to hide the divider on final item in React Native\n *\n * Should not be used by consumers (also won't work on web)\n *\n * @private\n */\n _hideDivider?: boolean;\n /**\n * Internally used to hide / show section in AutoComplete\n *\n * @private\n */\n _sectionChildValues?: string[];\n} & TestID &\n DataAnalyticsAttribute;\n\nconst _ActionListSectionTitle = ({\n title,\n isInsideVirtualizedList = false,\n}: {\n title: string;\n isInsideVirtualizedList?: boolean;\n}): React.ReactElement => {\n return (\n <StyledActionListSectionTitle\n {...makeAccessible({\n hidden: !isInsideVirtualizedList,\n role: isInsideVirtualizedList ? 'heading' : undefined,\n })}\n >\n <Text color=\"surface.text.gray.muted\" size=\"small\" weight=\"semibold\">\n {title}\n </Text>\n </StyledActionListSectionTitle>\n );\n};\n\nconst ActionListSectionTitle = assignWithoutSideEffects(_ActionListSectionTitle, {\n componentId: componentIds.ActionListSectionTitle,\n});\nconst _ActionListSection = ({\n title,\n children,\n testID,\n _hideDivider,\n _sectionChildValues,\n ...rest\n}: ActionListSectionProps): React.ReactElement => {\n const { hasAutoCompleteInHeader, dropdownTriggerer, filteredValues } = useDropdown();\n const hasAutoComplete =\n hasAutoCompleteInHeader || dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete;\n\n const isSectionVisible = React.useMemo(() => {\n if (hasAutoComplete) {\n const visibleActionListItemInSection = _sectionChildValues?.find((actionItemValue) =>\n filteredValues.includes(actionItemValue),\n );\n\n return Boolean(visibleActionListItemInSection);\n }\n\n return true;\n }, [_sectionChildValues, hasAutoComplete, filteredValues]);\n\n const showDividerInRN = !(_hideDivider && isReactNative());\n const showDividerInAutoComplete = hasAutoComplete\n ? isSectionVisible && filteredValues.length > 1\n : true;\n\n return (\n <BaseBox\n {...makeAccessible({\n role: getActionListSectionRole(),\n label: title,\n })}\n {...metaAttribute({ name: MetaConstants.ActionListSection, testID })}\n {...makeAnalyticsAttribute(rest as Record<string, unknown>)}\n >\n {/* We're announcing title as group label so we can hide this */}\n {isSectionVisible ? <ActionListSectionTitle title={title} /> : null}\n\n <BaseBox\n {...makeAccessible({\n // On web, we just wrap it in another listbox to announce item count properly for particular group.\n // On React Native, we ignore it since `menu` + `group` role will take care of accessibility\n role: isReactNative() ? undefined : 'listbox',\n })}\n >\n {children}\n </BaseBox>\n {showDividerInAutoComplete && showDividerInRN ? (\n <Divider marginX=\"spacing.3\" marginY=\"spacing.1\" />\n ) : null}\n </BaseBox>\n );\n};\n\nconst ActionListSection = assignWithoutSideEffects(React.memo(_ActionListSection), {\n componentId: componentIds.ActionListSection,\n});\n\nconst _ActionListItemIcon = ({ icon }: { icon: IconComponent }): React.ReactElement => {\n const Icon = icon;\n const { color, isDisabled } = useBaseMenuItem();\n const iconState = isDisabled ? 'disabled' : 'muted';\n return (\n <Icon\n color={\n color === 'negative'\n ? 'feedback.icon.negative.intense'\n : `interactive.icon.gray.${iconState}`\n }\n size=\"medium\"\n />\n );\n};\n\nconst ActionListItemIcon = assignWithoutSideEffects(_ActionListItemIcon, {\n componentId: componentIds.ActionListItemIcon,\n});\n\nconst _ActionListItemBadgeGroup = ({\n children,\n}: {\n children: React.ReactElement[] | React.ReactElement;\n}): React.ReactElement => {\n return (\n <Box display=\"flex\" alignItems=\"center\" flexDirection=\"row\">\n {children}\n </Box>\n );\n};\n\nconst ActionListItemBadgeGroup = assignWithoutSideEffects(_ActionListItemBadgeGroup, {\n componentId: componentIds.ActionListItemBadgeGroup,\n});\n\nconst _ActionListItemAvatar = (avatarProps: Omit<AvatarProps, 'size' | ''>): React.ReactElement => {\n return <Avatar size=\"xsmall\" {...avatarProps} />;\n};\n\nconst ActionListItemAvatar = assignWithoutSideEffects(_ActionListItemAvatar, {\n componentId: componentIds.ActionListItemAvatar,\n});\n\nconst _ActionListItemBadge = (props: BadgeProps): React.ReactElement => {\n return <Badge size=\"medium\" marginLeft=\"spacing.3\" {...props} />;\n};\n\nconst ActionListItemBadge = assignWithoutSideEffects(_ActionListItemBadge, {\n componentId: componentIds.ActionListItemBadge,\n});\n\nconst _ActionListItemText = ({\n children,\n}: {\n children: StringChildrenType;\n}): React.ReactElement => {\n const { isDisabled } = useBaseMenuItem();\n\n return (\n <Text variant=\"caption\" color={getNormalTextColor(isDisabled, { isMuted: true })}>\n {children}\n </Text>\n );\n};\n\nconst ActionListItemText = assignWithoutSideEffects(_ActionListItemText, {\n componentId: componentIds.ActionListItemText,\n});\n\nconst BaseMenuLeadingItem = ({\n isSelected,\n isDisabled,\n}: {\n isSelected?: boolean;\n isDisabled?: boolean;\n}): React.ReactElement => {\n return (\n <BaseBox\n pointerEvents=\"none\"\n // Adding aria-hidden because the listbox item in multiselect in itself explains the behaviour so announcing checkbox is unneccesary and just a nice UI tweak for us\n {...makeAccessible({\n hidden: true,\n })}\n >\n <Checkbox isChecked={isSelected} tabIndex={-1} isDisabled={isDisabled}>\n {/*\n Checkbox requires children. Didn't want to make it optional because its helpful for consumers\n But for this case in particular, we just want to use Text separately so that we can control spacing and color and keep it consistent with non-multiselect dropdowns\n */}\n {null}\n </Checkbox>\n </BaseBox>\n );\n};\n\ntype ClickHandlerType = (e: React.MouseEvent<HTMLButtonElement>) => void;\n\nconst makeActionListItemClickable = (\n clickHandler: ClickHandlerType,\n): { onPress?: (e: React.TouchEvent<TouchableOpacity>) => void; onClick?: ClickHandlerType } => {\n if (isReactNative()) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment, @typescript-eslint/prefer-ts-expect-error\n // @ts-ignore: ignoring ReactNative press type for the peace of mind\n return { onPress: clickHandler };\n }\n\n return {\n onClick: clickHandler,\n };\n};\n\n/**\n * ### ActionListItem\n *\n * Creates option inside `ActionList`.\n *\n * #### Usage\n *\n * ```jsx\n * <ActionList>\n * <ActionListItem\n * title=\"Home\"\n * value=\"home\"\n * leading={<ActionListItemIcon icon={HomeIcon} />}\n * trailing={<ActionListItemText>⌘ + S</ActionListItemText>}\n * />\n * </ActionList>\n * ```\n */\nconst _ActionListItem = (props: ActionListItemProps): React.ReactElement => {\n const {\n activeIndex,\n dropdownBaseId,\n onOptionClick,\n selectedIndices,\n setShouldIgnoreBlurAnimation,\n selectionType,\n dropdownTriggerer,\n isKeydownPressed,\n filteredValues,\n hasAutoCompleteInHeader,\n } = useDropdown();\n\n React.useEffect(() => {\n if (activeIndex === props._index && props._virtualizedIndex !== undefined) {\n props._onVirtualizedFocus?.(props._virtualizedIndex as number);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [activeIndex]);\n\n const hasAutoComplete =\n hasAutoCompleteInHeader || dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete;\n\n const hasFilterChipSelectInput =\n dropdownTriggerer === dropdownComponentIds.triggers.FilterChipSelectInput;\n\n const renderOnWebAs = props.href ? 'a' : 'button';\n /**\n * In SelectInput, returns the isSelected according to selected indexes in the state\n *\n * In Other Triggers (Menu Usecase), returns `props.isSelected` since passing the\n * isSelected prop explicitly is the only way to select item in menu\n */\n const getIsSelected = (): boolean | undefined => {\n if (\n dropdownTriggerer === dropdownComponentIds.triggers.SelectInput ||\n hasAutoComplete ||\n hasFilterChipSelectInput\n ) {\n if (typeof props._index === 'number') {\n return selectedIndices.includes(props._index);\n }\n return undefined;\n }\n\n return props.isSelected;\n };\n\n const isSelected = getIsSelected();\n\n React.useEffect(() => {\n validateActionListItemProps({\n leading: props.leading,\n trailing: props.trailing,\n titleSuffix: props.titleSuffix,\n });\n }, [props.leading, props.trailing, props.titleSuffix]);\n\n React.useEffect(() => {\n if (__DEV__) {\n if (\n dropdownTriggerer === dropdownComponentIds.triggers.SelectInput &&\n props.intent === 'negative'\n ) {\n throwBladeError({\n message:\n 'negative intent ActionListItem cannot be used inside Dropdown with SelectInput trigger',\n moduleName: 'ActionListItem',\n });\n }\n }\n }, [props.intent, dropdownTriggerer]);\n\n const isVisible = hasAutoComplete && filteredValues ? filteredValues.includes(props.value) : true;\n\n return (\n <BaseMenuItem\n isVisible={isVisible}\n as={!isReactNative() ? renderOnWebAs : undefined}\n id={`${dropdownBaseId}-${props._index}`}\n tabIndex={-1}\n title={props.title}\n description={props.description}\n leading={\n selectionType === 'multiple' ? (\n <BaseMenuLeadingItem\n key={`${dropdownBaseId}-${props._index}-leading-${isSelected}`}\n isSelected={isSelected}\n isDisabled={props.isDisabled}\n />\n ) : (\n props.leading\n )\n }\n trailing={props.trailing}\n titleSuffix={props.titleSuffix}\n href={props.href}\n target={props.target}\n className={activeIndex === props._index ? 'active-focus' : ''}\n isSelected={isSelected}\n isDisabled={props.isDisabled}\n role={getActionListItemRole(dropdownTriggerer, props.href)}\n {...makeActionListItemClickable((e: React.MouseEvent<HTMLButtonElement>): void => {\n if (typeof props._index === 'number') {\n onOptionClick(e, props._index);\n props.onClick?.({ name: props.value, value: isSelected, event: castWebType(e) });\n }\n })}\n {...makeAnalyticsAttribute({ ...props })}\n {...metaAttribute({ name: MetaConstants.ActionListItem, testID: props.testID })}\n onMouseDown={() => {\n // We want to keep focus on Dropdown's trigger while option is being clicked\n // So We set this flag that ignores the blur animation to avoid the flicker between focus out + focus in\n setShouldIgnoreBlurAnimation(true);\n }}\n onMouseUp={() => {\n // (Contd from above comment...) We set this flag back to false since blur of SelectInput is done calling by this time\n setShouldIgnoreBlurAnimation(false);\n }}\n data-value={props.value}\n data-index={props._index}\n selectionType={selectionType}\n color={props.intent}\n isKeydownPressed={isKeydownPressed}\n />\n );\n};\n\nconst ActionListItem = assignWithoutSideEffects(React.memo(_ActionListItem), {\n componentId: componentIds.ActionListItem,\n displayName: componentIds.ActionListItem,\n});\n\nexport type { ActionListItemProps, ActionListSectionProps };\nexport {\n ActionListItem,\n ActionListItemIcon,\n ActionListItemText,\n ActionListItemAvatar,\n ActionListItemBadge,\n ActionListItemBadgeGroup,\n ActionListSection,\n ActionListSectionTitle,\n};\n"],"names":["StyledActionListSectionTitle","styled","BaseBox","props","padding","makeSize","theme","spacing","_ActionListSectionTitle","_ref","title","_ref$isInsideVirtuali","isInsideVirtualizedList","_jsx","Object","assign","makeAccessible","hidden","role","undefined","children","Text","color","size","weight","ActionListSectionTitle","assignWithoutSideEffects","componentId","componentIds","_ActionListSection","_ref2","testID","_hideDivider","_sectionChildValues","rest","_objectWithoutProperties","_excluded","_useDropdown","useDropdown","hasAutoCompleteInHeader","dropdownTriggerer","filteredValues","hasAutoComplete","dropdownComponentIds","triggers","AutoComplete","isSectionVisible","React","useMemo","visibleActionListItemInSection","find","actionItemValue","includes","Boolean","showDividerInRN","isReactNative","showDividerInAutoComplete","length","_jsxs","getActionListSectionRole","label","metaAttribute","name","MetaConstants","ActionListSection","makeAnalyticsAttribute","Divider","marginX","marginY","memo","_ActionListItemIcon","_ref3","icon","Icon","_useBaseMenuItem","useBaseMenuItem","isDisabled","iconState","ActionListItemIcon","_ActionListItemBadgeGroup","_ref4","Box","display","alignItems","flexDirection","ActionListItemBadgeGroup","_ActionListItemAvatar","avatarProps","Avatar","ActionListItemAvatar","_ActionListItemBadge","Badge","marginLeft","ActionListItemBadge","_ActionListItemText","_ref5","_useBaseMenuItem2","variant","getNormalTextColor","isMuted","ActionListItemText","BaseMenuLeadingItem","_ref6","isSelected","pointerEvents","Checkbox","isChecked","tabIndex","makeActionListItemClickable","clickHandler","onPress","onClick","_ActionListItem","_useDropdown2","activeIndex","dropdownBaseId","onOptionClick","selectedIndices","setShouldIgnoreBlurAnimation","selectionType","isKeydownPressed","useEffect","_index","_virtualizedIndex","_onVirtualizedFocus","hasFilterChipSelectInput","FilterChipSelectInput","renderOnWebAs","href","getIsSelected","SelectInput","validateActionListItemProps","leading","trailing","titleSuffix","__DEV__","intent","throwBladeError","message","moduleName","isVisible","value","BaseMenuItem","as","id","description","target","className","getActionListItemRole","e","event","castWebType","ActionListItem","onMouseDown","onMouseUp","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iFAwGA,IAAMA,4BAA4B,CAAGC,MAAM,CAACC,OAAO,CAAC,CAAC,SAACC,KAAK,CAAA,CAAA,OAAM,CAE/DC,OAAO,CAAEC,QAAQ,CAACF,KAAK,CAACG,KAAK,CAACC,OAAO,CAAC,CAAC,CAAC,CAC1C,CAAC,EAAC,CAAC,CAsBH,IAAMC,uBAAuB,CAAG,SAA1BA,uBAAuBA,CAAAC,IAAA,CAMH,KALxBC,KAAK,CAAAD,IAAA,CAALC,KAAK,CAAAC,qBAAA,CAAAF,IAAA,CACLG,uBAAuB,CAAvBA,uBAAuB,CAAAD,qBAAA,GAAG,KAAA,CAAA,CAAA,KAAK,CAAAA,qBAAA,CAK/B,OACEE,GAAA,CAACb,4BAA4B,CAAAc,MAAA,CAAAC,MAAA,C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cAAc,CACxCG,WAAW,CAAE/H,YAAY,CAAC4H,cAC5B,CAAC;;;;"}
|
|
@@ -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.DropdownIconButton,dropdownComponentIds.triggers.DropdownLink,dropdownComponentIds.DropdownOverlay,dropdownComponentIds.triggers.AutoComplete,ComponentIds.BottomSheet,dropdownComponentIds.triggers.FilterChipSelectInput];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),hasAutoCompleteInHeader=_React$useState18[0],setHasAutoCompleteInHeader=_React$useState18[1];var _React$useState19=React__default.useState(false),_React$useState20=_slicedToArray(_React$useState19,2),
|
|
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,dropdownComponentIds.triggers.FilterChipSelectInput];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),hasAutoCompleteInHeader=_React$useState18[0],setHasAutoCompleteInHeader=_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 headerAutoCompleteRef=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';}if(isValidAllowedChildren(child,dropdownComponentIds.triggers.FilterChipSelectInput)){dropdownTriggerer.current='FilterChipSelectInput';}}});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,headerAutoCompleteRef:headerAutoCompleteRef,triggererWrapperRef:triggererWrapperRef,actionListItemRef:actionListItemRef,selectionType:selectionType,hasFooterAction:hasFooterAction,setHasFooterAction:setHasFooterAction,hasAutoCompleteInHeader:hasAutoCompleteInHeader,setHasAutoCompleteInHeader:setHasAutoCompleteInHeader,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,hasAutoCompleteInHeader:hasAutoCompleteInHeader,setDropdownHasBottomSheet:setDropdownHasBottomSheet,onBottomSheetDismiss:close};},[dropdownHasBottomSheet,hasAutoCompleteInHeader,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.DropdownIconButton,\n dropdownComponentIds.triggers.DropdownLink,\n dropdownComponentIds.DropdownOverlay,\n dropdownComponentIds.triggers.AutoComplete,\n bottomSheetComponentIds.BottomSheet,\n dropdownComponentIds.triggers.FilterChipSelectInput,\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 [hasAutoCompleteInHeader, setHasAutoCompleteInHeader] = React.useState(false);\n const [\n hasUnControlledFilterChipSelectInput,\n setHasUnControlledFilterChipSelectInput,\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 headerAutoCompleteRef = 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 if (isValidAllowedChildren(child, dropdownComponentIds.triggers.FilterChipSelectInput)) {\n dropdownTriggerer.current = 'FilterChipSelectInput';\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 headerAutoCompleteRef,\n triggererWrapperRef,\n actionListItemRef,\n selectionType,\n hasFooterAction,\n setHasFooterAction,\n hasAutoCompleteInHeader,\n setHasAutoCompleteInHeader,\n hasUnControlledFilterChipSelectInput,\n setHasUnControlledFilterChipSelectInput,\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 hasAutoCompleteInHeader,\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, hasAutoCompleteInHeader, 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","FilterChipSelectInput","_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","hasAutoCompleteInHeader","setHasAutoCompleteInHeader","_React$useState19","_React$useState20","hasUnControlledFilterChipSelectInput","setHasUnControlledFilterChipSelectInput","_React$useState21","_React$useState22","isKeydownPressed","setIsKeydownPressed","_React$useState23","_React$useState24","changeCallbackTriggerer","setChangeCallbackTriggerer","_React$useState25","_React$useState26","isControlled","setIsControlled","_React$useState27","_React$useState28","dropdownHasBottomSheet","setDropdownHasBottomSheet","triggererWrapperRef","useRef","triggererRef","headerAutoCompleteRef","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,CACnCX,oBAAoB,CAACE,QAAQ,CAACU,qBAAqB,CACpD,CA4BD,IAAMC,SAAS,CAAG,SAAZA,SAASA,CAAAC,IAAA,CAUbC,GAA+B,CACR,KATrBC,QAAQ,CAAAF,IAAA,CAARE,QAAQ,CACAC,gBAAgB,CAAAH,IAAA,CAAxBI,MAAM,CACNC,YAAY,CAAAL,IAAA,CAAZK,YAAY,CAAAC,kBAAA,C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,CAAC,CAEK,IAAA2H,QAAQ,CAAGM,wBAAwB,CAACrH,cAAK,CAACsH,UAAU,CAACrI,SAAS,CAAC,CAAE,CACrEsI,WAAW,CAAEnJ,oBAAoB,CAAC2I,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 dropdownComponentIds.triggers.FilterChipSelectInput,\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 [hasAutoCompleteInHeader, setHasAutoCompleteInHeader] = 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 headerAutoCompleteRef = 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 if (isValidAllowedChildren(child, dropdownComponentIds.triggers.FilterChipSelectInput)) {\n dropdownTriggerer.current = 'FilterChipSelectInput';\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 headerAutoCompleteRef,\n triggererWrapperRef,\n actionListItemRef,\n selectionType,\n hasFooterAction,\n setHasFooterAction,\n hasAutoCompleteInHeader,\n setHasAutoCompleteInHeader,\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 hasAutoCompleteInHeader,\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, hasAutoCompleteInHeader, 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","FilterChipSelectInput","_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","hasAutoCompleteInHeader","setHasAutoCompleteInHeader","_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","headerAutoCompleteRef","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,CACnCX,oBAAoB,CAACE,QAAQ,CAACU,qBAAqB,CACpD,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,GA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AM,CAAEoF,cAAc,CACtBtB,sBAAsB,CAAtBA,sBAAsB,CACtBhB,uBAAuB,CAAvBA,uBAAuB,CACvBiB,yBAAyB,CAAzBA,yBAAyB,CAGzB2C,oBAAoB,CAAElB,KACxB,CAAC,CACH,CAAC,CAAE,CAAC1B,sBAAsB,CAAEhB,uBAAuB,CAAEsC,cAAc,CAAEI,KAAK,CAAC,CAAC,CAE5E,OACEmB,GAAA,CAACC,iCAAiC,CAACC,QAAQ,EAACtC,KAAK,CAAEkC,sCAAuC,CAAA3G,QAAA,CACxF6G,GAAA,CAACG,eAAe,CAACD,QAAQ,CAAA,CAACtC,KAAK,CAAEgC,YAAa,CAAAzG,QAAA,CAC5C6G,GAAA,CAAC5H,OAAO,CAAAgI,MAAA,CAAAC,MAAA,CAENnH,CAAAA,GAAG,CAAEoH,SAAS,CAACpH,GAAG,CAAE4E,oBAA2B,CAAE,EAC7CyC,aAAa,CAAC,CAAEC,IAAI,CAAEC,aAAa,CAACC,QAAQ,CAAEjH,MAAM,CAANA,MAAO,CAAC,CAAC,CACvDkH,cAAc,CAAChH,IAAI,CAAC,CACpBiH,sBAAsB,CAACjH,IAAI,CAAC,EAChCkH,KAAK,CAAEnH,MAAO,CAAAP,QAAA,CAEd6G,GAAA,CAAC5H,OAAO,EAAC0I,QAAQ,CAAC,UAAU,CAACC,SAAS,CAAE,MAAgB,CAAA5H,QAAA,CACrDA,QAAQ,CACF,CAAC,CAAA,CACH,CAAC,CACc,CAAC,CACe,CAAC,CAEjD,CAAC,CAEK,IAAAuH,QAAQ,CAAGM,wBAAwB,CAACjH,cAAK,CAACkH,UAAU,CAACjI,SAAS,CAAC,CAAE,CACrEkI,WAAW,CAAE/I,oBAAoB,CAACuI,QACpC,CAAC;;;;"}
|
|
@@ -10,7 +10,7 @@ import { isBrowser } from '../../utils/platform/isBrowser.js';
|
|
|
10
10
|
import '../BladeProvider/useTheme.js';
|
|
11
11
|
import { fireNativeEvent } from '../../utils/fireNativeEvent/fireNativeEvent.native.js';
|
|
12
12
|
|
|
13
|
-
var _excluded=["isOpen","setIsOpen","close","selectedIndices","setSelectedIndices","activeIndex","setActiveIndex","activeTagIndex","setActiveTagIndex","visibleTagsCountRef","isKeydownPressed","setIsKeydownPressed","options","selectionType","changeCallbackTriggerer","setChangeCallbackTriggerer","isControlled","setControlledValueIndices","filteredValues","dropdownTriggerer"];var noop=function noop(){};var DropdownContext=React__default.createContext({isOpen:false,setIsOpen:noop,close:noop,selectedIndices:[],setSelectedIndices:noop,controlledValueIndices:[],setControlledValueIndices:noop,options:[],setOptions:noop,filteredValues:[],setFilteredValues:noop,activeIndex:-1,setActiveIndex:noop,activeTagIndex:-1,setActiveTagIndex:noop,shouldIgnoreBlurAnimation:false,setShouldIgnoreBlurAnimation:noop,hasFooterAction:false,setHasFooterAction:noop,hasAutoCompleteInHeader:false,setHasAutoCompleteInHeader:noop,isKeydownPressed:false,setIsKeydownPressed:noop,changeCallbackTriggerer:0,setChangeCallbackTriggerer:noop,isControlled:false,setIsControlled:noop,
|
|
13
|
+
var _excluded=["isOpen","setIsOpen","close","selectedIndices","setSelectedIndices","activeIndex","setActiveIndex","activeTagIndex","setActiveTagIndex","visibleTagsCountRef","isKeydownPressed","setIsKeydownPressed","options","selectionType","changeCallbackTriggerer","setChangeCallbackTriggerer","isControlled","setControlledValueIndices","filteredValues","dropdownTriggerer"];var noop=function noop(){};var DropdownContext=React__default.createContext({isOpen:false,setIsOpen:noop,close:noop,selectedIndices:[],setSelectedIndices:noop,controlledValueIndices:[],setControlledValueIndices:noop,options:[],setOptions:noop,filteredValues:[],setFilteredValues:noop,activeIndex:-1,setActiveIndex:noop,activeTagIndex:-1,setActiveTagIndex:noop,shouldIgnoreBlurAnimation:false,setShouldIgnoreBlurAnimation:noop,hasFooterAction:false,setHasFooterAction:noop,hasAutoCompleteInHeader:false,setHasAutoCompleteInHeader:noop,isKeydownPressed:false,setIsKeydownPressed:noop,changeCallbackTriggerer:0,setChangeCallbackTriggerer:noop,isControlled:false,setIsControlled:noop,dropdownBaseId:'',actionListItemRef:{current:null},triggererRef:{current:null},headerAutoCompleteRef:{current:null},isTagDismissedRef:{current:null},visibleTagsCountRef:{current:null},triggererWrapperRef:{current:null}});var searchTimeout;var searchString='';var useDropdown=function useDropdown(){var _React$useContext=React__default.useContext(DropdownContext),isOpen=_React$useContext.isOpen,setIsOpen=_React$useContext.setIsOpen,close=_React$useContext.close,selectedIndices=_React$useContext.selectedIndices,setSelectedIndices=_React$useContext.setSelectedIndices,activeIndex=_React$useContext.activeIndex,setActiveIndex=_React$useContext.setActiveIndex,activeTagIndex=_React$useContext.activeTagIndex,setActiveTagIndex=_React$useContext.setActiveTagIndex,visibleTagsCountRef=_React$useContext.visibleTagsCountRef,isKeydownPressed=_React$useContext.isKeydownPressed,setIsKeydownPressed=_React$useContext.setIsKeydownPressed,options=_React$useContext.options,selectionType=_React$useContext.selectionType,changeCallbackTriggerer=_React$useContext.changeCallbackTriggerer,setChangeCallbackTriggerer=_React$useContext.setChangeCallbackTriggerer,isControlled=_React$useContext.isControlled,setControlledValueIndices=_React$useContext.setControlledValueIndices,filteredValues=_React$useContext.filteredValues,dropdownTriggerer=_React$useContext.dropdownTriggerer,rest=_objectWithoutProperties(_React$useContext,_excluded);var setIndices=function setIndices(indices){if(isControlled){setControlledValueIndices(indices);}else {setSelectedIndices(indices);}};var removeOption=function removeOption(index){var existingItemIndex=selectedIndices.indexOf(index);if(existingItemIndex<0){return;}setIndices([].concat(_toConsumableArray(selectedIndices.slice(0,existingItemIndex)),_toConsumableArray(selectedIndices.slice(existingItemIndex+1))));};var selectOption=function selectOption(index){var properties=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{closeOnSelection:true};var isSelected=false;if(index<0||index>options.length-1){return isSelected;}if(selectionType==='multiple'){if(selectedIndices.includes(index)){removeOption(index);isSelected=false;}else {setIndices([].concat(_toConsumableArray(selectedIndices),[index]));isSelected=true;}}else {setIndices([index]);isSelected=true;}setChangeCallbackTriggerer(changeCallbackTriggerer+1);if(activeIndex!==index){setActiveIndex(index);}if(properties!=null&&properties.closeOnSelection&&selectionType!=='multiple'){close();}return isSelected;};var onTriggerClick=function onTriggerClick(){if(isOpen){close();}else {setIsOpen(true);}};var onOptionChange=function onOptionChange(actionType,index){setActiveTagIndex(-1);var newIndex=index!=null?index:activeIndex;var updatedIndex;var hasAutoComplete=rest.hasAutoCompleteInHeader||dropdownTriggerer===dropdownComponentIds.triggers.AutoComplete;if(hasAutoComplete&&filteredValues.length>0){var filteredIndexes=filteredValues.map(function(filteredValue){return options.findIndex(function(option){return option.value===filteredValue;});}).sort(function(a,b){return a-b;});updatedIndex=filteredIndexes[getUpdatedIndex({currentIndex:filteredIndexes.indexOf(newIndex),maxIndex:filteredIndexes.length-1,actionType:actionType})];}else {updatedIndex=getUpdatedIndex({currentIndex:newIndex,maxIndex:options.length-1,actionType:actionType});}setActiveIndex(updatedIndex);var optionValues=options.map(function(option){return option.value;});ensureScrollVisiblity(updatedIndex,rest.actionListItemRef.current,optionValues);if(isBrowser()){fireNativeEvent(rest.actionListItemRef);}};var onOptionClick=function onOptionClick(e,index){setIsKeydownPressed(false);var actionType=getActionFromKey(e,isOpen,dropdownTriggerer);if(typeof actionType==='number'){onOptionChange(actionType,index);}selectOption(index);if(!isReactNative()){if(rest.hasAutoCompleteInHeader){var _rest$headerAutoCompl;(_rest$headerAutoCompl=rest.headerAutoCompleteRef.current)==null?void 0:_rest$headerAutoCompl.focus();}else {var _rest$triggererRef$cu;(_rest$triggererRef$cu=rest.triggererRef.current)==null?void 0:_rest$triggererRef$cu.focus();}}};var onComboType=function onComboType(letter,actionType){setIsOpen(true);if(rest.hasAutoCompleteInHeader||dropdownTriggerer===dropdownComponentIds.triggers.AutoComplete){return;}if(typeof searchTimeout==='number'){window.clearTimeout(searchTimeout);}searchTimeout=window.setTimeout(function(){searchString='';},500);searchString=searchString+letter;var optionTitles=options.map(function(option){return option.title;});var searchIndex=getIndexByLetter(optionTitles,searchString,activeIndex+1);if(searchIndex>=0){onOptionChange(actionType,searchIndex);}else {window.clearTimeout(searchTimeout);searchString='';}};var onTriggerKeydown=function onTriggerKeydown(e){if(!isKeydownPressed&&![' ','Enter','Escape','Meta'].includes(e.event.key)){setIsKeydownPressed(true);}var actionType=getActionFromKey(e.event,isOpen,dropdownTriggerer);if(actionType){performAction(actionType,e,{setIsOpen:setIsOpen,close:close,onOptionChange:onOptionChange,onComboType:onComboType,selectCurrentOption:function selectCurrentOption(){var _options$activeIndex$,_options$activeIndex;if(activeIndex<0){return;}var isSelected=selectOption(activeIndex);if(rest.hasFooterAction&&!isReactNative()){var _rest$triggererRef$cu2;(_rest$triggererRef$cu2=rest.triggererRef.current)==null?void 0:_rest$triggererRef$cu2.focus();}(_options$activeIndex$=(_options$activeIndex=options[activeIndex]).onClickTrigger)==null?void 0:_options$activeIndex$.call(_options$activeIndex,isSelected);}});}};return Object.assign({isOpen:isOpen,setIsOpen:setIsOpen,close:close,selectedIndices:selectedIndices,setSelectedIndices:setSelectedIndices,filteredValues:filteredValues,removeOption:removeOption,setControlledValueIndices:setControlledValueIndices,onTriggerClick:onTriggerClick,onTriggerKeydown:onTriggerKeydown,onOptionClick:onOptionClick,activeIndex:activeIndex,setActiveIndex:setActiveIndex,activeTagIndex:activeTagIndex,setActiveTagIndex:setActiveTagIndex,visibleTagsCountRef:visibleTagsCountRef,isKeydownPressed:isKeydownPressed,setIsKeydownPressed:setIsKeydownPressed,changeCallbackTriggerer:changeCallbackTriggerer,setChangeCallbackTriggerer:setChangeCallbackTriggerer,isControlled:isControlled,options:options,value:makeInputValue(selectedIndices,options),displayValue:makeInputDisplayValue(selectedIndices,options),selectionType:selectionType,dropdownTriggerer:dropdownTriggerer},rest);};
|
|
14
14
|
|
|
15
15
|
export { DropdownContext, useDropdown };
|
|
16
16
|
//# sourceMappingURL=useDropdown.js.map
|
|
@@ -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 | 'DropdownIconButton'\n | 'AutoComplete'\n | 'DropdownLink'\n | 'SearchInput'\n | 'FilterChipSelectInput';\n\n /** ref of triggerer. Used to call focus in certain places */\n triggererRef: React.MutableRefObject<HTMLButtonElement | null>;\n headerAutoCompleteRef: 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 * Whether the FilterChipSelectInput is uncontrolled\n */\n hasUnControlledFilterChipSelectInput: boolean;\n setHasUnControlledFilterChipSelectInput: (value: boolean) => void;\n /**\n * Apart from dropdownTriggerer prop, we also set this boolean because in BottomSheetHeader and DropdownHeader, the trigger can be Select but they can also have autocomplete inside of header\n */\n hasAutoCompleteInHeader: boolean;\n setHasAutoCompleteInHeader: (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 hasAutoCompleteInHeader: false,\n setHasAutoCompleteInHeader: noop,\n isKeydownPressed: false,\n setIsKeydownPressed: noop,\n changeCallbackTriggerer: 0,\n setChangeCallbackTriggerer: noop,\n isControlled: false,\n setIsControlled: noop,\n hasUnControlledFilterChipSelectInput: false,\n setHasUnControlledFilterChipSelectInput: noop,\n dropdownBaseId: '',\n actionListItemRef: {\n current: null,\n },\n triggererRef: {\n current: null,\n },\n headerAutoCompleteRef: {\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.hasAutoCompleteInHeader ||\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 setIsKeydownPressed(false);\n const actionType = getActionFromKey(e, isOpen, dropdownTriggerer);\n if (typeof actionType === 'number') {\n onOptionChange(actionType, index);\n }\n selectOption(index);\n\n if (!isReactNative()) {\n if (rest.hasAutoCompleteInHeader) {\n // move focus to autocomplete\n rest.headerAutoCompleteRef.current?.focus();\n } else {\n rest.triggererRef.current?.focus();\n }\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.hasAutoCompleteInHeader ||\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","hasAutoCompleteInHeader","setHasAutoCompleteInHeader","isKeydownPressed","setIsKeydownPressed","changeCallbackTriggerer","setChangeCallbackTriggerer","isControlled","setIsControlled","hasUnControlledFilterChipSelectInput","setHasUnControlledFilterChipSelectInput","dropdownBaseId","actionListItemRef","current","triggererRef","headerAutoCompleteRef","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$headerAutoCompl","focus","_rest$triggererRef$cu","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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AAzBA,yBAAyB,CACzB0D,cAAc,CAAdA,cAAc,CACdyC,gBAAgB,CAAhBA,gBAAgB,CAChBhB,aAAa,CAAbA,aAAa,CACb9E,WAAW,CAAXA,WAAW,CACXC,cAAc,CAAdA,cAAc,CACdC,cAAc,CAAdA,cAAc,CACdC,iBAAiB,CAAjBA,iBAAiB,CACjBqB,mBAAmB,CAAnBA,mBAAmB,CACnBd,gBAAgB,CAAhBA,gBAAgB,CAChBC,mBAAmB,CAAnBA,mBAAmB,CACnBC,uBAAuB,CAAvBA,uBAAuB,CACvBC,0BAA0B,CAA1BA,0BAA0B,CAC1BC,YAAY,CAAZA,YAAY,CACZlB,OAAO,CAAPA,OAAO,CACPuE,KAAK,CAAEuC,cAAc,CAAClH,eAAe,CAAEI,OAAO,CAAC,CAC/C+G,YAAY,CAAEC,qBAAqB,CAACpH,eAAe,CAAEI,OAAO,CAAC,CAC7DmC,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 | 'FilterChipSelectInput';\n\n /** ref of triggerer. Used to call focus in certain places */\n triggererRef: React.MutableRefObject<HTMLButtonElement | null>;\n headerAutoCompleteRef: 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 BottomSheetHeader and DropdownHeader, the trigger can be Select but they can also have autocomplete inside of header\n */\n hasAutoCompleteInHeader: boolean;\n setHasAutoCompleteInHeader: (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 hasAutoCompleteInHeader: false,\n setHasAutoCompleteInHeader: 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 headerAutoCompleteRef: {\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.hasAutoCompleteInHeader ||\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 setIsKeydownPressed(false);\n const actionType = getActionFromKey(e, isOpen, dropdownTriggerer);\n if (typeof actionType === 'number') {\n onOptionChange(actionType, index);\n }\n selectOption(index);\n\n if (!isReactNative()) {\n if (rest.hasAutoCompleteInHeader) {\n // move focus to autocomplete\n rest.headerAutoCompleteRef.current?.focus();\n } else {\n rest.triggererRef.current?.focus();\n }\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.hasAutoCompleteInHeader ||\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","hasAutoCompleteInHeader","setHasAutoCompleteInHeader","isKeydownPressed","setIsKeydownPressed","changeCallbackTriggerer","setChangeCallbackTriggerer","isControlled","setIsControlled","dropdownBaseId","actionListItemRef","current","triggererRef","headerAutoCompleteRef","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$headerAutoCompl","focus","_rest$triggererRef$cu","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,CAyGrB,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,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