@razorpay/blade 11.28.2 → 11.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lib/native/components/ActionList/ActionListItem.js +3 -2
- package/build/lib/native/components/ActionList/ActionListItem.js.map +1 -1
- package/build/lib/native/components/ActionList/actionListUtils.js +1 -1
- package/build/lib/native/components/ActionList/actionListUtils.js.map +1 -1
- package/build/lib/native/components/ActionList/componentIds.js +1 -1
- package/build/lib/native/components/ActionList/componentIds.js.map +1 -1
- package/build/lib/native/components/index.js +1 -1
- package/build/lib/web/development/components/ActionList/ActionListItem.js +11 -1
- package/build/lib/web/development/components/ActionList/ActionListItem.js.map +1 -1
- package/build/lib/web/development/components/ActionList/actionListUtils.js +2 -2
- package/build/lib/web/development/components/ActionList/actionListUtils.js.map +1 -1
- package/build/lib/web/development/components/ActionList/componentIds.js +1 -0
- package/build/lib/web/development/components/ActionList/componentIds.js.map +1 -1
- package/build/lib/web/development/components/ActionList/index.js +1 -1
- package/build/lib/web/development/components/Tooltip/TooltipInteractiveWrapper.web.js +9 -13
- package/build/lib/web/development/components/Tooltip/TooltipInteractiveWrapper.web.js.map +1 -1
- package/build/lib/web/development/components/index.js +1 -1
- package/build/lib/web/production/components/ActionList/ActionListItem.js +11 -1
- package/build/lib/web/production/components/ActionList/ActionListItem.js.map +1 -1
- package/build/lib/web/production/components/ActionList/actionListUtils.js +2 -2
- package/build/lib/web/production/components/ActionList/actionListUtils.js.map +1 -1
- package/build/lib/web/production/components/ActionList/componentIds.js +1 -0
- package/build/lib/web/production/components/ActionList/componentIds.js.map +1 -1
- package/build/lib/web/production/components/ActionList/index.js +1 -1
- package/build/lib/web/production/components/Tooltip/TooltipInteractiveWrapper.web.js +9 -13
- package/build/lib/web/production/components/Tooltip/TooltipInteractiveWrapper.web.js.map +1 -1
- package/build/lib/web/production/components/index.js +1 -1
- package/build/types/components/index.d.ts +261 -951
- package/build/types/components/index.native.d.ts +250 -249
- package/package.json +1 -1
|
@@ -37,8 +37,9 @@ import '../BottomSheet/BottomSheetStack.js';
|
|
|
37
37
|
import 'react-native-svg';
|
|
38
38
|
import '../Icons/_Svg/Svg/Svg.native.js';
|
|
39
39
|
import '../VisuallyHidden/VisuallyHidden.native.js';
|
|
40
|
+
import { Avatar } from '../Avatar/Avatar.native.js';
|
|
40
41
|
|
|
41
|
-
var StyledActionListSectionTitle=styled(BaseBox)(function(props){return {padding:makeSize(props.theme.spacing[3])};});var _ActionListSection=function _ActionListSection(_ref){var title=_ref.title,children=_ref.children,testID=_ref.testID,_hideDivider=_ref._hideDivider,_sectionChildValues=_ref._sectionChildValues;var _useDropdown=useDropdown(),hasAutoCompleteInBottomSheetHeader=_useDropdown.hasAutoCompleteInBottomSheetHeader,dropdownTriggerer=_useDropdown.dropdownTriggerer,filteredValues=_useDropdown.filteredValues;var hasAutoComplete=hasAutoCompleteInBottomSheetHeader||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}),{children:[isSectionVisible?jsx(StyledActionListSectionTitle,Object.assign({},makeAccessible({hidden:true}),{children:jsx(Text,{color:"surface.text.gray.muted",size:"small",weight:"semibold",children: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(_ActionListSection,{componentId:componentIds.ActionListSection});var _ActionListItemIcon=function _ActionListItemIcon(_ref2){var icon=_ref2.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(_ref3){var children=_ref3.children;return jsx(Box,{display:"flex",alignItems:"center",flexDirection:"row",children:children});};var ActionListItemBadgeGroup=assignWithoutSideEffects(_ActionListItemBadgeGroup,{componentId:componentIds.ActionListItemBadgeGroup});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(_ref4){var children=_ref4.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 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,hasAutoCompleteInBottomSheetHeader=_useDropdown2.hasAutoCompleteInBottomSheetHeader;var hasAutoComplete=hasAutoCompleteInBottomSheetHeader||dropdownTriggerer===dropdownComponentIds.triggers.AutoComplete;var renderOnWebAs=props.href?'a':'button';var getIsSelected=function getIsSelected(){if(dropdownTriggerer===dropdownComponentIds.triggers.SelectInput||hasAutoComplete){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]);return jsx(BaseMenuItem,Object.assign({isVisible:hasAutoComplete&&filteredValues?filteredValues.includes(props.value):true,as:!isReactNative()?renderOnWebAs:undefined,id:`${dropdownBaseId}-${props._index}`,tabIndex:-1,title:props.title,description:props.description,leading:selectionType==='multiple'?jsx(BaseBox,Object.assign({pointerEvents:"none"},makeAccessible({hidden:true}),{children:jsx(Checkbox,{isChecked:isSelected,tabIndex:-1,isDisabled:props.isDisabled,children:null})})):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)});}}),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});
|
|
42
|
+
var StyledActionListSectionTitle=styled(BaseBox)(function(props){return {padding:makeSize(props.theme.spacing[3])};});var _ActionListSection=function _ActionListSection(_ref){var title=_ref.title,children=_ref.children,testID=_ref.testID,_hideDivider=_ref._hideDivider,_sectionChildValues=_ref._sectionChildValues;var _useDropdown=useDropdown(),hasAutoCompleteInBottomSheetHeader=_useDropdown.hasAutoCompleteInBottomSheetHeader,dropdownTriggerer=_useDropdown.dropdownTriggerer,filteredValues=_useDropdown.filteredValues;var hasAutoComplete=hasAutoCompleteInBottomSheetHeader||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}),{children:[isSectionVisible?jsx(StyledActionListSectionTitle,Object.assign({},makeAccessible({hidden:true}),{children:jsx(Text,{color:"surface.text.gray.muted",size:"small",weight:"semibold",children: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(_ActionListSection,{componentId:componentIds.ActionListSection});var _ActionListItemIcon=function _ActionListItemIcon(_ref2){var icon=_ref2.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(_ref3){var children=_ref3.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(_ref4){var children=_ref4.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 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,hasAutoCompleteInBottomSheetHeader=_useDropdown2.hasAutoCompleteInBottomSheetHeader;var hasAutoComplete=hasAutoCompleteInBottomSheetHeader||dropdownTriggerer===dropdownComponentIds.triggers.AutoComplete;var renderOnWebAs=props.href?'a':'button';var getIsSelected=function getIsSelected(){if(dropdownTriggerer===dropdownComponentIds.triggers.SelectInput||hasAutoComplete){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]);return jsx(BaseMenuItem,Object.assign({isVisible:hasAutoComplete&&filteredValues?filteredValues.includes(props.value):true,as:!isReactNative()?renderOnWebAs:undefined,id:`${dropdownBaseId}-${props._index}`,tabIndex:-1,title:props.title,description:props.description,leading:selectionType==='multiple'?jsx(BaseBox,Object.assign({pointerEvents:"none"},makeAccessible({hidden:true}),{children:jsx(Checkbox,{isChecked:isSelected,tabIndex:-1,isDisabled:props.isDisabled,children:null})})):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)});}}),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});
|
|
42
43
|
|
|
43
|
-
export { ActionListItem, ActionListItemBadge, ActionListItemBadgeGroup, ActionListItemIcon, ActionListItemText, ActionListSection };
|
|
44
|
+
export { ActionListItem, ActionListItemAvatar, ActionListItemBadge, ActionListItemBadgeGroup, ActionListItemIcon, ActionListItemText, ActionListSection };
|
|
44
45
|
//# 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 { 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';\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} & TestID;\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;\nconst _ActionListSection = ({\n title,\n children,\n testID,\n _hideDivider,\n _sectionChildValues,\n}: ActionListSectionProps): React.ReactElement => {\n const { hasAutoCompleteInBottomSheetHeader, dropdownTriggerer, filteredValues } = useDropdown();\n const hasAutoComplete =\n hasAutoCompleteInBottomSheetHeader ||\n 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 >\n {/* We're announcing title as group label so we can hide this */}\n {isSectionVisible ? (\n <StyledActionListSectionTitle {...makeAccessible({ hidden: true })}>\n <Text color=\"surface.text.gray.muted\" size=\"small\" weight=\"semibold\">\n {title}\n </Text>\n </StyledActionListSectionTitle>\n ) : null}\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(_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 _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\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 hasAutoCompleteInBottomSheetHeader,\n } = useDropdown();\n\n const hasAutoComplete =\n hasAutoCompleteInBottomSheetHeader ||\n dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete;\n\n const renderOnWebAs = props.href ? 'a' : 'button';\n\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 (dropdownTriggerer === dropdownComponentIds.triggers.SelectInput || hasAutoComplete) {\n if (typeof props._index === 'number') {\n return selectedIndices.includes(props._index);\n }\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 return (\n // We use this context to change the color of subcomponents like ActionListItemIcon, ActionListItemText, etc\n <BaseMenuItem\n isVisible={hasAutoComplete && filteredValues ? filteredValues.includes(props.value) : true}\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 <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={props.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 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 {...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 ActionListItemBadge,\n ActionListItemBadgeGroup,\n ActionListSection,\n};\n"],"names":["StyledActionListSectionTitle","styled","BaseBox","props","padding","makeSize","theme","spacing","_ActionListSection","_ref","title","children","testID","_hideDivider","_sectionChildValues","_useDropdown","useDropdown","hasAutoCompleteInBottomSheetHeader","dropdownTriggerer","filteredValues","hasAutoComplete","dropdownComponentIds","triggers","AutoComplete","isSectionVisible","React","useMemo","visibleActionListItemInSection","find","actionItemValue","includes","Boolean","showDividerInRN","isReactNative","showDividerInAutoComplete","length","_jsxs","Object","assign","makeAccessible","role","getActionListSectionRole","label","metaAttribute","name","MetaConstants","ActionListSection","_jsx","hidden","Text","color","size","weight","undefined","Divider","marginX","marginY","assignWithoutSideEffects","componentId","componentIds","_ActionListItemIcon","_ref2","icon","Icon","_useBaseMenuItem","useBaseMenuItem","isDisabled","iconState","ActionListItemIcon","_ActionListItemBadgeGroup","_ref3","Box","display","alignItems","flexDirection","ActionListItemBadgeGroup","_ActionListItemBadge","Badge","marginLeft","ActionListItemBadge","_ActionListItemText","_ref4","_useBaseMenuItem2","variant","getNormalTextColor","isMuted","ActionListItemText","makeActionListItemClickable","clickHandler","onPress","onClick","_ActionListItem","_useDropdown2","activeIndex","dropdownBaseId","onOptionClick","selectedIndices","setShouldIgnoreBlurAnimation","selectionType","isKeydownPressed","renderOnWebAs","href","getIsSelected","SelectInput","_index","isSelected","useEffect","validateActionListItemProps","leading","trailing","titleSuffix","__DEV__","intent","throwBladeError","message","moduleName","BaseMenuItem","isVisible","value","as","id","tabIndex","description","pointerEvents","Checkbox","isChecked","target","className","getActionListItemRole","e","event","castWebType","ActionListItem","onMouseDown","onMouseUp","memo","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwFA,IAAMA,4BAA4B,CAAGC,MAAM,CAACC,OAAO,CAAC,CAAC,SAACC,KAAK,CAAM,CAAA,OAAA,CAE/DC,OAAO,CAAEC,QAAQ,CAACF,KAAK,CAACG,KAAK,CAACC,OAAO,CAAC,CAAC,CAAC,CAC1C,CAAC,EAAC,CAAC,CAoBH,IAAMC,kBAAkB,CAAG,SAArBA,kBAAkBA,CAAAC,IAAA,CAM0B,CAAA,IALhDC,KAAK,CAAAD,IAAA,CAALC,KAAK,CACLC,QAAQ,C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CAAG,CAAE9C,IAAI,CAAEzC,KAAK,CAACmH,KAAK,CAAEA,KAAK,CAAEb,UAAU,CAAEyB,KAAK,CAAEC,WAAW,CAACF,CAAC,CAAE,CAAC,CAAC,CAClF,CACF,CAAC,CAAC,CACEtF,aAAa,CAAC,CAAEC,IAAI,CAAEC,aAAa,CAACuF,cAAc,CAAExH,MAAM,CAAET,KAAK,CAACS,MAAO,CAAC,CAAC,EAC/EyH,WAAW,CAAE,SAAAA,WAAA,EAAM,CAGjBpC,4BAA4B,CAAC,IAAI,CAAC,CACpC,CAAE,CACFqC,SAAS,CAAE,SAAAA,SAAA,EAAM,CAEfrC,4BAA4B,CAAC,KAAK,CAAC,CACrC,CAAE,CACF,aAAY9F,KAAK,CAACmH,KAAM,CACxB,aAAYnH,KAAK,CAACqG,MAAO,CACzBN,aAAa,CAAEA,aAAc,CAC7BhD,KAAK,CAAE/C,KAAK,CAAC6G,MAAO,CACpBb,gBAAgB,CAAEA,gBAAiB,CACpC,CAAA,CAAC,CAEN,CAAC,CAEK,IAAAiC,cAAc,CAAG3E,wBAAwB,CAAChC,cAAK,CAAC8G,IAAI,CAAC5C,eAAe,CAAC,CAAE,CAC3EjC,WAAW,CAAEC,YAAY,CAACyE,cAAc,CACxCI,WAAW,CAAE7E,YAAY,CAACyE,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 { 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';\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} & TestID;\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;\nconst _ActionListSection = ({\n title,\n children,\n testID,\n _hideDivider,\n _sectionChildValues,\n}: ActionListSectionProps): React.ReactElement => {\n const { hasAutoCompleteInBottomSheetHeader, dropdownTriggerer, filteredValues } = useDropdown();\n const hasAutoComplete =\n hasAutoCompleteInBottomSheetHeader ||\n 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 >\n {/* We're announcing title as group label so we can hide this */}\n {isSectionVisible ? (\n <StyledActionListSectionTitle {...makeAccessible({ hidden: true })}>\n <Text color=\"surface.text.gray.muted\" size=\"small\" weight=\"semibold\">\n {title}\n </Text>\n </StyledActionListSectionTitle>\n ) : null}\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(_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\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 hasAutoCompleteInBottomSheetHeader,\n } = useDropdown();\n\n const hasAutoComplete =\n hasAutoCompleteInBottomSheetHeader ||\n dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete;\n\n const renderOnWebAs = props.href ? 'a' : 'button';\n\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 (dropdownTriggerer === dropdownComponentIds.triggers.SelectInput || hasAutoComplete) {\n if (typeof props._index === 'number') {\n return selectedIndices.includes(props._index);\n }\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 return (\n // We use this context to change the color of subcomponents like ActionListItemIcon, ActionListItemText, etc\n <BaseMenuItem\n isVisible={hasAutoComplete && filteredValues ? filteredValues.includes(props.value) : true}\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 <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={props.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 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 {...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};\n"],"names":["StyledActionListSectionTitle","styled","BaseBox","props","padding","makeSize","theme","spacing","_ActionListSection","_ref","title","children","testID","_hideDivider","_sectionChildValues","_useDropdown","useDropdown","hasAutoCompleteInBottomSheetHeader","dropdownTriggerer","filteredValues","hasAutoComplete","dropdownComponentIds","triggers","AutoComplete","isSectionVisible","React","useMemo","visibleActionListItemInSection","find","actionItemValue","includes","Boolean","showDividerInRN","isReactNative","showDividerInAutoComplete","length","_jsxs","Object","assign","makeAccessible","role","getActionListSectionRole","label","metaAttribute","name","MetaConstants","ActionListSection","_jsx","hidden","Text","color","size","weight","undefined","Divider","marginX","marginY","assignWithoutSideEffects","componentId","componentIds","_ActionListItemIcon","_ref2","icon","Icon","_useBaseMenuItem","useBaseMenuItem","isDisabled","iconState","ActionListItemIcon","_ActionListItemBadgeGroup","_ref3","Box","display","alignItems","flexDirection","ActionListItemBadgeGroup","_ActionListItemAvatar","avatarProps","Avatar","ActionListItemAvatar","_ActionListItemBadge","Badge","marginLeft","ActionListItemBadge","_ActionListItemText","_ref4","_useBaseMenuItem2","variant","getNormalTextColor","isMuted","ActionListItemText","makeActionListItemClickable","clickHandler","onPress","onClick","_ActionListItem","_useDropdown2","activeIndex","dropdownBaseId","onOptionClick","selectedIndices","setShouldIgnoreBlurAnimation","selectionType","isKeydownPressed","renderOnWebAs","href","getIsSelected","SelectInput","_index","isSelected","useEffect","validateActionListItemProps","leading","trailing","titleSuffix","__DEV__","intent","throwBladeError","message","moduleName","BaseMenuItem","isVisible","value","as","id","tabIndex","description","pointerEvents","Checkbox","isChecked","target","className","getActionListItemRole","e","event","castWebType","ActionListItem","onMouseDown","onMouseUp","memo","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0FA,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,CAAA,CAAC,CAAC,CAoBH,IAAMC,kBAAkB,CAAG,SAArBA,kBAAkBA,CAAAC,IAAA,CAM0B,KALhDC,KAAK,CAAAD,IAAA,CAALC,KAAK,CACLC,QAAQ,CAAAF,IAAA,CAARE,QAAQ,CACRC,MAAM,CAAAH,IAAA,CAANG,MAAM,CACNC,YAAY,CAAAJ,IAAA,CAAZI,YAAY,CACZC,mBAAmB,CAAAL,IAAA,CAAnBK,mBAAmB,CAEnB,IAAAC,YAAA,CAAkFC,WAAW,EAAE,CAAvFC,kCAAkC,CAAAF,YAAA,CAAlCE,kCAAkC,CAAEC,iBAAiB,CAAAH,YAAA,CAAjBG,iBAAiB,CAAEC,cAAc,CAAAJ,YAAA,CAAdI,cAAc,CAC7E,IAAMC,eAAe,CACnBH,kCAAkC,EAClCC,iBAAiB,GAAKG,oBAAoB,CAACC,QAAQ,CAACC,YAAY,CAElE,IAAMC,gBAAgB,CAAGC,cAAK,CAACC,OAAO,CAAC,UAAM,CAC3C,GAAIN,eAAe,CAAE,CACnB,IAAMO,8BAA8B,CAAGb,mBAAmB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,MAAM,CAAET,KAAK,CAACS,MAAO,CAAC,CAAC,CAC/E6H,CAAAA,WAAW,CAAE,SAAAA,WAAAA,EAAM,CAGjBpC,4BAA4B,CAAC,IAAI,CAAC,CACpC,CAAE,CACFqC,SAAS,CAAE,SAAAA,SAAA,EAAM,CAEfrC,4BAA4B,CAAC,KAAK,CAAC,CACrC,CAAE,CACF,aAAYlG,KAAK,CAACuH,KAAM,CACxB,aAAYvH,KAAK,CAACyG,MAAO,CACzBN,aAAa,CAAEA,aAAc,CAC7BpD,KAAK,CAAE/C,KAAK,CAACiH,MAAO,CACpBb,gBAAgB,CAAEA,gBAAiB,EACpC,CAAC,CAEN,CAAC,CAEK,IAAAiC,cAAc,CAAG/E,wBAAwB,CAAChC,cAAK,CAACkH,IAAI,CAAC5C,eAAe,CAAC,CAAE,CAC3ErC,WAAW,CAAEC,YAAY,CAAC6E,cAAc,CACxCI,WAAW,CAAEjF,YAAY,CAAC6E,cAC5B,CAAC;;;;"}
|
|
@@ -7,7 +7,7 @@ import { isReactNative } from '../../utils/platform/isReactNative.js';
|
|
|
7
7
|
import '../BladeProvider/useTheme.js';
|
|
8
8
|
import { isValidAllowedChildren, getComponentId } from '../../utils/isValidAllowedChildren/isValidAllowedChildren.js';
|
|
9
9
|
|
|
10
|
-
var getActionListSectionPosition=function getActionListSectionPosition(children){var childComponentIdArray=React__default.Children.toArray(children).map(function(child){return getComponentId(child);});var lastActionListSectionIndex=childComponentIdArray.lastIndexOf(componentIds.ActionListSection);var isActionListItemPresentAfterSection=childComponentIdArray.slice(lastActionListSectionIndex).includes(componentIds.ActionListItem);return {isActionListItemPresentAfterSection:isActionListItemPresentAfterSection,lastActionListSectionIndex:lastActionListSectionIndex};};var actionListAllowedChildren=[componentIds.ActionListItem,componentIds.ActionListSection];var getActionListProperties=function getActionListProperties(children){var sectionData=[];var currentSection=null;var actionListOptions=[];var getActionListItemWithId=function getActionListItemWithId(child,hideDivider){if(React__default.isValidElement(child)&&!child.props.isDisabled){actionListOptions.push({title:child.props.title,value:child.props.value,onClickTrigger:function onClickTrigger(value){var _child$props$isSelect;var anchorLink=child.props.href;child.props.onClick==null?void 0:child.props.onClick({name:child.props.value,value:(_child$props$isSelect=child.props.isSelected)!=null?_child$props$isSelect:value});if(anchorLink&&!isReactNative()){var _child$props$target;var target=(_child$props$target=child.props.target)!=null?_child$props$target:'_self';window.open(anchorLink,target);if(window.top){window.top.open(anchorLink,target);}}}});var currentIndex=actionListOptions.length-1;var foundSection=sectionData.find(function(v){return v.title===currentSection;});if(foundSection){foundSection==null?void 0:foundSection.data.push(Object.assign({},child.props,{_index:currentIndex}));}else {sectionData.push({title:currentSection,hideDivider:hideDivider,data:[Object.assign({},child.props,{_index:currentIndex})]});}var clonedChild=React__default.cloneElement(child,{_index:currentIndex});return clonedChild;}return child;};var isActionListItemPresentAfterSection;var lastActionListSectionIndex;if(isReactNative()){var _getActionListSection=getActionListSectionPosition(children);isActionListItemPresentAfterSection=_getActionListSection.isActionListItemPresentAfterSection;lastActionListSectionIndex=_getActionListSection.lastActionListSectionIndex;}var childrenWithId=React__default.Children.map(children,function(child,index){if(React__default.isValidElement(child)){if(isValidAllowedChildren(child,componentIds.ActionListSection)){var shouldHideDivider=index===lastActionListSectionIndex&&!isActionListItemPresentAfterSection;var sectionChildValues=[];return React__default.cloneElement(child,{children:React__default.Children.map(child.props.children,function(childInSection){currentSection=child.props.title;sectionChildValues.push(childInSection.props.value);if(isValidAllowedChildren(childInSection,componentIds.ActionListItem)){return getActionListItemWithId(childInSection,shouldHideDivider);}return childInSection;}),_hideDivider:isReactNative()?shouldHideDivider:undefined,_sectionChildValues:sectionChildValues});}if(isValidAllowedChildren(child,componentIds.ActionListItem)){return getActionListItemWithId(child,true);}if(__DEV__){throwBladeError({message:`Only ${actionListAllowedChildren.join(', ')} supported inside ActionList`,moduleName:'ActionList'});}}return child;});return {sectionData:sectionData,childrenWithId:childrenWithId,actionListOptions:actionListOptions};};var validateActionListItemProps=function validateActionListItemProps(_ref){var leading=_ref.leading,trailing=_ref.trailing,titleSuffix=_ref.titleSuffix;if(__DEV__){React__default.Children.map(trailing,function(child){if(!isValidAllowedChildren(child,componentIds.ActionListItemIcon)&&!isValidAllowedChildren(child,componentIds.ActionListItemText)){throwBladeError({message:`Only ${componentIds.ActionListItemIcon} and ${componentIds.ActionListItemText} are allowed in trailing prop`,moduleName:'ActionListItem'});}});React__default.Children.map(titleSuffix,function(child){if(!isValidAllowedChildren(child,componentIds.ActionListItemBadge)&&!isValidAllowedChildren(child,componentIds.ActionListItemBadgeGroup)){throwBladeError({message:`Only ${componentIds.ActionListItemBadge} and ${componentIds.ActionListItemBadgeGroup} are allowed in titleSuffix prop`,moduleName:'ActionListItem'});}});React__default.Children.map(leading,function(child){if(!isValidAllowedChildren(child,componentIds.ActionListItemIcon)&&!isValidAllowedChildren(child,componentIds.ActionListItemText)&&!isValidAllowedChildren(child,componentIds.ActionListItemAsset)){throwBladeError({message:`Only ${componentIds.ActionListItemIcon}, ${componentIds.ActionListItemAsset}, and ${componentIds.ActionListItemText} are allowed in leading prop`,moduleName:'ActionListItem'});}});}};var getNormalTextColor=function getNormalTextColor(isDisabled){var _ref2=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},isMuted=_ref2.isMuted;if(isDisabled){return 'interactive.text.gray.disabled';}if(isMuted){return 'interactive.text.gray.muted';}return 'interactive.text.gray.normal';};
|
|
10
|
+
var getActionListSectionPosition=function getActionListSectionPosition(children){var childComponentIdArray=React__default.Children.toArray(children).map(function(child){return getComponentId(child);});var lastActionListSectionIndex=childComponentIdArray.lastIndexOf(componentIds.ActionListSection);var isActionListItemPresentAfterSection=childComponentIdArray.slice(lastActionListSectionIndex).includes(componentIds.ActionListItem);return {isActionListItemPresentAfterSection:isActionListItemPresentAfterSection,lastActionListSectionIndex:lastActionListSectionIndex};};var actionListAllowedChildren=[componentIds.ActionListItem,componentIds.ActionListSection];var getActionListProperties=function getActionListProperties(children){var sectionData=[];var currentSection=null;var actionListOptions=[];var getActionListItemWithId=function getActionListItemWithId(child,hideDivider){if(React__default.isValidElement(child)&&!child.props.isDisabled){actionListOptions.push({title:child.props.title,value:child.props.value,onClickTrigger:function onClickTrigger(value){var _child$props$isSelect;var anchorLink=child.props.href;child.props.onClick==null?void 0:child.props.onClick({name:child.props.value,value:(_child$props$isSelect=child.props.isSelected)!=null?_child$props$isSelect:value});if(anchorLink&&!isReactNative()){var _child$props$target;var target=(_child$props$target=child.props.target)!=null?_child$props$target:'_self';window.open(anchorLink,target);if(window.top){window.top.open(anchorLink,target);}}}});var currentIndex=actionListOptions.length-1;var foundSection=sectionData.find(function(v){return v.title===currentSection;});if(foundSection){foundSection==null?void 0:foundSection.data.push(Object.assign({},child.props,{_index:currentIndex}));}else {sectionData.push({title:currentSection,hideDivider:hideDivider,data:[Object.assign({},child.props,{_index:currentIndex})]});}var clonedChild=React__default.cloneElement(child,{_index:currentIndex});return clonedChild;}return child;};var isActionListItemPresentAfterSection;var lastActionListSectionIndex;if(isReactNative()){var _getActionListSection=getActionListSectionPosition(children);isActionListItemPresentAfterSection=_getActionListSection.isActionListItemPresentAfterSection;lastActionListSectionIndex=_getActionListSection.lastActionListSectionIndex;}var childrenWithId=React__default.Children.map(children,function(child,index){if(React__default.isValidElement(child)){if(isValidAllowedChildren(child,componentIds.ActionListSection)){var shouldHideDivider=index===lastActionListSectionIndex&&!isActionListItemPresentAfterSection;var sectionChildValues=[];return React__default.cloneElement(child,{children:React__default.Children.map(child.props.children,function(childInSection){currentSection=child.props.title;sectionChildValues.push(childInSection.props.value);if(isValidAllowedChildren(childInSection,componentIds.ActionListItem)){return getActionListItemWithId(childInSection,shouldHideDivider);}return childInSection;}),_hideDivider:isReactNative()?shouldHideDivider:undefined,_sectionChildValues:sectionChildValues});}if(isValidAllowedChildren(child,componentIds.ActionListItem)){return getActionListItemWithId(child,true);}if(__DEV__){throwBladeError({message:`Only ${actionListAllowedChildren.join(', ')} supported inside ActionList`,moduleName:'ActionList'});}}return child;});return {sectionData:sectionData,childrenWithId:childrenWithId,actionListOptions:actionListOptions};};var validateActionListItemProps=function validateActionListItemProps(_ref){var leading=_ref.leading,trailing=_ref.trailing,titleSuffix=_ref.titleSuffix;if(__DEV__){React__default.Children.map(trailing,function(child){if(!isValidAllowedChildren(child,componentIds.ActionListItemIcon)&&!isValidAllowedChildren(child,componentIds.ActionListItemText)){throwBladeError({message:`Only ${componentIds.ActionListItemIcon} and ${componentIds.ActionListItemText} are allowed in trailing prop`,moduleName:'ActionListItem'});}});React__default.Children.map(titleSuffix,function(child){if(!isValidAllowedChildren(child,componentIds.ActionListItemBadge)&&!isValidAllowedChildren(child,componentIds.ActionListItemBadgeGroup)){throwBladeError({message:`Only ${componentIds.ActionListItemBadge} and ${componentIds.ActionListItemBadgeGroup} are allowed in titleSuffix prop`,moduleName:'ActionListItem'});}});React__default.Children.map(leading,function(child){if(!isValidAllowedChildren(child,componentIds.ActionListItemIcon)&&!isValidAllowedChildren(child,componentIds.ActionListItemText)&&!isValidAllowedChildren(child,componentIds.ActionListItemAsset)&&!isValidAllowedChildren(child,componentIds.ActionListItemAvatar)){throwBladeError({message:`Only ${componentIds.ActionListItemIcon}, ${componentIds.ActionListItemAvatar}, ${componentIds.ActionListItemAsset}, and ${componentIds.ActionListItemText} are allowed in leading prop`,moduleName:'ActionListItem'});}});}};var getNormalTextColor=function getNormalTextColor(isDisabled){var _ref2=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},isMuted=_ref2.isMuted;if(isDisabled){return 'interactive.text.gray.disabled';}if(isMuted){return 'interactive.text.gray.muted';}return 'interactive.text.gray.normal';};
|
|
11
11
|
|
|
12
12
|
export { getActionListProperties, getNormalTextColor, validateActionListItemProps };
|
|
13
13
|
//# sourceMappingURL=actionListUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actionListUtils.js","sources":["../../../../../src/components/ActionList/actionListUtils.ts"],"sourcesContent":["import React from 'react';\nimport { componentIds } from './componentIds';\nimport type { ActionListItemProps } from './ActionListItem';\nimport type { OptionsType } from '~components/Dropdown/useDropdown';\nimport { isReactNative } from '~utils';\nimport type { BaseTextProps } from '~components/Typography/BaseText/types';\nimport { getComponentId, isValidAllowedChildren } from '~utils/isValidAllowedChildren';\nimport { throwBladeError } from '~utils/logger';\n\n/**\n * Returns if there is ActionListItem after ActionListSection\n * and an index of last ActionListSection\n *\n * It is used to decide if ActionListSection add divider at the end\n */\nconst getActionListSectionPosition = (\n children: React.ReactNode,\n): {\n isActionListItemPresentAfterSection: boolean;\n lastActionListSectionIndex: number;\n} => {\n // Creating an array of componentIds\n const childComponentIdArray = React.Children.toArray(children).map((child) =>\n getComponentId(child),\n );\n\n // Reading the last `ActionListSection` component's index\n const lastActionListSectionIndex = childComponentIdArray.lastIndexOf(\n componentIds.ActionListSection,\n );\n\n // Checking if there is any `ActionListItem` present after `ActionListSection`\n const isActionListItemPresentAfterSection = childComponentIdArray\n .slice(lastActionListSectionIndex)\n .includes(componentIds.ActionListItem);\n\n return {\n isActionListItemPresentAfterSection,\n lastActionListSectionIndex,\n };\n};\n\nconst actionListAllowedChildren = [componentIds.ActionListItem, componentIds.ActionListSection];\n\nexport type SectionData = {\n title: string;\n hideDivider: boolean;\n data: ActionListItemProps[];\n}[];\n\n/**\n * Loops over action list items and returns different properties from children like option values, header and footer child, etc\n */\nconst getActionListProperties = (\n children: React.ReactNode,\n): {\n sectionData: SectionData;\n childrenWithId?: React.ReactNode[] | null;\n actionListOptions: OptionsType;\n} => {\n const sectionData: SectionData = [];\n let currentSection: string | null = null;\n const actionListOptions: OptionsType = [];\n\n const getActionListItemWithId = (\n child: React.ReactNode,\n hideDivider: boolean,\n ): React.ReactNode => {\n if (React.isValidElement(child) && !child.props.isDisabled) {\n actionListOptions.push({\n title: child.props.title,\n value: child.props.value,\n onClickTrigger: (value) => {\n const anchorLink = child.props.href;\n child.props.onClick?.({\n name: child.props.value,\n value: child.props.isSelected ?? value,\n });\n\n if (anchorLink && !isReactNative()) {\n const target = child.props.target ?? '_self';\n window.open(anchorLink, target);\n if (window.top) {\n window.top.open(anchorLink, target);\n }\n }\n },\n });\n const currentIndex = actionListOptions.length - 1;\n\n const foundSection = sectionData.find((v) => v.title === currentSection);\n // push the item in the appropriate bucket\n if (foundSection) {\n foundSection?.data.push({\n ...child.props,\n _index: currentIndex,\n });\n } else {\n // create a new bucket\n sectionData.push({\n title: currentSection!,\n hideDivider,\n data: [\n {\n ...child.props,\n _index: currentIndex,\n },\n ],\n });\n }\n\n const clonedChild = React.cloneElement(child, {\n // @ts-expect-error: TS doesn't understand the child's props\n _index: currentIndex,\n });\n return clonedChild;\n }\n\n return child;\n };\n\n let isActionListItemPresentAfterSection: boolean;\n // eslint-disable-next-line one-var\n let lastActionListSectionIndex: number;\n\n if (isReactNative()) {\n // We're reading this so that we can decide whether to show the divider or not.\n // If ActionListSection is final item and no ActionListItem is present after that, we hide the divider\n\n // On web, we do it using descendant styling\n ({\n isActionListItemPresentAfterSection,\n lastActionListSectionIndex,\n } = getActionListSectionPosition(children));\n }\n\n // Looping through ActionListItems to add index to them and get an options array for moving focus between items\n const childrenWithId = React.Children.map(children, (child, index) => {\n if (React.isValidElement(child)) {\n if (isValidAllowedChildren(child, componentIds.ActionListSection)) {\n const shouldHideDivider =\n index === lastActionListSectionIndex && !isActionListItemPresentAfterSection;\n const sectionChildValues: string[] = [];\n return React.cloneElement(child, {\n // @ts-expect-error: TS doesn't understand the child's props\n children: React.Children.map(child.props.children, (childInSection) => {\n currentSection = child.props.title;\n sectionChildValues.push(childInSection.props.value);\n if (isValidAllowedChildren(childInSection, componentIds.ActionListItem)) {\n return getActionListItemWithId(childInSection, shouldHideDivider);\n }\n\n return childInSection;\n }),\n // On web, we handle it with descendant styling in css so no need of JS there\n _hideDivider: isReactNative() ? shouldHideDivider : undefined,\n _sectionChildValues: sectionChildValues,\n });\n }\n\n if (isValidAllowedChildren(child, componentIds.ActionListItem)) {\n return getActionListItemWithId(child, true);\n }\n\n if (__DEV__) {\n throwBladeError({\n message: `Only ${actionListAllowedChildren.join(', ')} supported inside ActionList`,\n moduleName: 'ActionList',\n });\n }\n }\n return child;\n });\n\n return {\n sectionData,\n childrenWithId,\n actionListOptions,\n };\n};\n\nconst validateActionListItemProps = ({\n leading,\n trailing,\n titleSuffix,\n}: {\n leading: ActionListItemProps['leading'];\n trailing: ActionListItemProps['trailing'];\n titleSuffix: ActionListItemProps['titleSuffix'];\n}): void => {\n if (__DEV__) {\n React.Children.map(trailing, (child) => {\n if (\n !isValidAllowedChildren(child, componentIds.ActionListItemIcon) &&\n !isValidAllowedChildren(child, componentIds.ActionListItemText)\n ) {\n throwBladeError({\n message: `Only ${componentIds.ActionListItemIcon} and ${componentIds.ActionListItemText} are allowed in trailing prop`,\n moduleName: 'ActionListItem',\n });\n }\n });\n\n React.Children.map(titleSuffix, (child) => {\n if (\n !isValidAllowedChildren(child, componentIds.ActionListItemBadge) &&\n !isValidAllowedChildren(child, componentIds.ActionListItemBadgeGroup)\n ) {\n throwBladeError({\n message: `Only ${componentIds.ActionListItemBadge} and ${componentIds.ActionListItemBadgeGroup} are allowed in titleSuffix prop`,\n moduleName: 'ActionListItem',\n });\n }\n });\n\n React.Children.map(leading, (child) => {\n if (\n !isValidAllowedChildren(child, componentIds.ActionListItemIcon) &&\n !isValidAllowedChildren(child, componentIds.ActionListItemText) &&\n !isValidAllowedChildren(child, componentIds.ActionListItemAsset)\n ) {\n throwBladeError({\n message: `Only ${componentIds.ActionListItemIcon}, ${componentIds.ActionListItemAsset}, and ${componentIds.ActionListItemText} are allowed in leading prop`,\n moduleName: 'ActionListItem',\n });\n }\n });\n }\n};\n\nconst getNormalTextColor = (\n isDisabled: boolean | undefined,\n { isMuted }: { isMuted?: boolean } = {},\n): Extract<\n BaseTextProps['color'],\n 'interactive.text.gray.disabled' | 'interactive.text.gray.muted' | 'interactive.text.gray.normal'\n> => {\n if (isDisabled) {\n return 'interactive.text.gray.disabled';\n }\n\n if (isMuted) {\n return 'interactive.text.gray.muted';\n }\n\n return 'interactive.text.gray.normal';\n};\n\nexport { getActionListProperties, validateActionListItemProps, getNormalTextColor };\n"],"names":["getActionListSectionPosition","children","childComponentIdArray","React","Children","toArray","map","child","getComponentId","lastActionListSectionIndex","lastIndexOf","componentIds","ActionListSection","isActionListItemPresentAfterSection","slice","includes","ActionListItem","actionListAllowedChildren","getActionListProperties","sectionData","currentSection","actionListOptions","getActionListItemWithId","hideDivider","isValidElement","props","isDisabled","push","title","value","onClickTrigger","_child$props$isSelect","anchorLink","href","onClick","name","isSelected","isReactNative","_child$props$target","target","window","open","top","currentIndex","length","foundSection","find","v","data","Object","assign","_index","clonedChild","cloneElement","_getActionListSection","childrenWithId","index","isValidAllowedChildren","shouldHideDivider","sectionChildValues","childInSection","_hideDivider","undefined","_sectionChildValues","__DEV__","throwBladeError","message","join","moduleName","validateActionListItemProps","_ref","leading","trailing","titleSuffix","ActionListItemIcon","ActionListItemText","ActionListItemBadge","ActionListItemBadgeGroup","ActionListItemAsset","getNormalTextColor","_ref2","arguments","isMuted"],"mappings":";;;;;;;;;AAeA,IAAMA,4BAA4B,CAAG,SAA/BA,4BAA4BA,CAChCC,QAAyB,CAItB,CAEH,IAAMC,qBAAqB,CAAGC,cAAK,CAACC,QAAQ,CAACC,OAAO,CAACJ,QAAQ,CAAC,CAACK,GAAG,CAAC,SAACC,KAAK,CAAA,CAAA,OACvEC,cAAc,CAACD,KAAK,CAAC,CAAA,CACvB,CAAC,CAGD,IAAME,0BAA0B,CAAGP,qBAAqB,CAACQ,WAAW,CAClEC,YAAY,CAACC,iBACf,CAAC,CAGD,IAAMC,mCAAmC,CAAGX,qBAAqB,CAC9DY,KAAK,CAACL,0BAA0B,CAAC,CACjCM,QAAQ,CAACJ,YAAY,CAACK,cAAc,CAAC,CAExC,OAAO,CACLH,mCAAmC,CAAnCA,mCAAmC,CACnCJ,0BAA0B,CAA1BA,0BACF,CAAC,CACH,CAAC,CAED,IAAMQ,yBAAyB,CAAG,CAACN,YAAY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AC,CAEFjE,cAAK,CAACC,QAAQ,CAACE,GAAG,CAACiE,OAAO,CAAE,SAAChE,KAAK,CAAK,CACrC,GACE,CAACkD,sBAAsB,CAAClD,KAAK,CAAEI,YAAY,CAAC+D,kBAAkB,CAAC,EAC/D,CAACjB,sBAAsB,CAAClD,KAAK,CAAEI,YAAY,CAACgE,kBAAkB,CAAC,EAC/D,CAAClB,sBAAsB,CAAClD,KAAK,CAAEI,YAAY,CAACmE,mBAAmB,CAAC,CAChE,CACAb,eAAe,CAAC,CACdC,OAAO,CAAG,CAAA,KAAA,EAAOvD,YAAY,CAAC+D,kBAAmB,CAAA,EAAA,EAAI/D,YAAY,CAACmE,mBAAoB,CAAA,MAAA,EAAQnE,YAAY,CAACgE,kBAAmB,CAA6B,4BAAA,CAAA,CAC3JP,UAAU,CAAE,gBACd,CAAC,CAAC,CACJ,CACF,CAAC,CAAC,CACJ,CACF,EAEM,IAAAW,kBAAkB,CAAG,SAArBA,kBAAkBA,CACtBrD,UAA+B,CAK5B,CAAAsD,IAAAA,KAAA,CAAAC,SAAA,CAAArC,MAAA,CAAA,CAAA,EAAAqC,SAAA,CAAA,CAAA,CAAA,GAAAnB,SAAA,CAAAmB,SAAA,CAAA,CAAA,CAAA,CAJkC,EAAE,CAArCC,OAAO,CAAAF,KAAA,CAAPE,OAAO,CAKT,GAAIxD,UAAU,CAAE,CACd,OAAO,gCAAgC,CACzC,CAEA,GAAIwD,OAAO,CAAE,CACX,OAAO,6BAA6B,CACtC,CAEA,OAAO,8BAA8B,CACvC;;;;"}
|
|
1
|
+
{"version":3,"file":"actionListUtils.js","sources":["../../../../../src/components/ActionList/actionListUtils.ts"],"sourcesContent":["import React from 'react';\nimport { componentIds } from './componentIds';\nimport type { ActionListItemProps } from './ActionListItem';\nimport type { OptionsType } from '~components/Dropdown/useDropdown';\nimport { isReactNative } from '~utils';\nimport type { BaseTextProps } from '~components/Typography/BaseText/types';\nimport { getComponentId, isValidAllowedChildren } from '~utils/isValidAllowedChildren';\nimport { throwBladeError } from '~utils/logger';\n\n/**\n * Returns if there is ActionListItem after ActionListSection\n * and an index of last ActionListSection\n *\n * It is used to decide if ActionListSection add divider at the end\n */\nconst getActionListSectionPosition = (\n children: React.ReactNode,\n): {\n isActionListItemPresentAfterSection: boolean;\n lastActionListSectionIndex: number;\n} => {\n // Creating an array of componentIds\n const childComponentIdArray = React.Children.toArray(children).map((child) =>\n getComponentId(child),\n );\n\n // Reading the last `ActionListSection` component's index\n const lastActionListSectionIndex = childComponentIdArray.lastIndexOf(\n componentIds.ActionListSection,\n );\n\n // Checking if there is any `ActionListItem` present after `ActionListSection`\n const isActionListItemPresentAfterSection = childComponentIdArray\n .slice(lastActionListSectionIndex)\n .includes(componentIds.ActionListItem);\n\n return {\n isActionListItemPresentAfterSection,\n lastActionListSectionIndex,\n };\n};\n\nconst actionListAllowedChildren = [componentIds.ActionListItem, componentIds.ActionListSection];\n\nexport type SectionData = {\n title: string;\n hideDivider: boolean;\n data: ActionListItemProps[];\n}[];\n\n/**\n * Loops over action list items and returns different properties from children like option values, header and footer child, etc\n */\nconst getActionListProperties = (\n children: React.ReactNode,\n): {\n sectionData: SectionData;\n childrenWithId?: React.ReactNode[] | null;\n actionListOptions: OptionsType;\n} => {\n const sectionData: SectionData = [];\n let currentSection: string | null = null;\n const actionListOptions: OptionsType = [];\n\n const getActionListItemWithId = (\n child: React.ReactNode,\n hideDivider: boolean,\n ): React.ReactNode => {\n if (React.isValidElement(child) && !child.props.isDisabled) {\n actionListOptions.push({\n title: child.props.title,\n value: child.props.value,\n onClickTrigger: (value) => {\n const anchorLink = child.props.href;\n child.props.onClick?.({\n name: child.props.value,\n value: child.props.isSelected ?? value,\n });\n\n if (anchorLink && !isReactNative()) {\n const target = child.props.target ?? '_self';\n window.open(anchorLink, target);\n if (window.top) {\n window.top.open(anchorLink, target);\n }\n }\n },\n });\n const currentIndex = actionListOptions.length - 1;\n\n const foundSection = sectionData.find((v) => v.title === currentSection);\n // push the item in the appropriate bucket\n if (foundSection) {\n foundSection?.data.push({\n ...child.props,\n _index: currentIndex,\n });\n } else {\n // create a new bucket\n sectionData.push({\n title: currentSection!,\n hideDivider,\n data: [\n {\n ...child.props,\n _index: currentIndex,\n },\n ],\n });\n }\n\n const clonedChild = React.cloneElement(child, {\n // @ts-expect-error: TS doesn't understand the child's props\n _index: currentIndex,\n });\n return clonedChild;\n }\n\n return child;\n };\n\n let isActionListItemPresentAfterSection: boolean;\n // eslint-disable-next-line one-var\n let lastActionListSectionIndex: number;\n\n if (isReactNative()) {\n // We're reading this so that we can decide whether to show the divider or not.\n // If ActionListSection is final item and no ActionListItem is present after that, we hide the divider\n\n // On web, we do it using descendant styling\n ({\n isActionListItemPresentAfterSection,\n lastActionListSectionIndex,\n } = getActionListSectionPosition(children));\n }\n\n // Looping through ActionListItems to add index to them and get an options array for moving focus between items\n const childrenWithId = React.Children.map(children, (child, index) => {\n if (React.isValidElement(child)) {\n if (isValidAllowedChildren(child, componentIds.ActionListSection)) {\n const shouldHideDivider =\n index === lastActionListSectionIndex && !isActionListItemPresentAfterSection;\n const sectionChildValues: string[] = [];\n return React.cloneElement(child, {\n // @ts-expect-error: TS doesn't understand the child's props\n children: React.Children.map(child.props.children, (childInSection) => {\n currentSection = child.props.title;\n sectionChildValues.push(childInSection.props.value);\n if (isValidAllowedChildren(childInSection, componentIds.ActionListItem)) {\n return getActionListItemWithId(childInSection, shouldHideDivider);\n }\n\n return childInSection;\n }),\n // On web, we handle it with descendant styling in css so no need of JS there\n _hideDivider: isReactNative() ? shouldHideDivider : undefined,\n _sectionChildValues: sectionChildValues,\n });\n }\n\n if (isValidAllowedChildren(child, componentIds.ActionListItem)) {\n return getActionListItemWithId(child, true);\n }\n\n if (__DEV__) {\n throwBladeError({\n message: `Only ${actionListAllowedChildren.join(', ')} supported inside ActionList`,\n moduleName: 'ActionList',\n });\n }\n }\n return child;\n });\n\n return {\n sectionData,\n childrenWithId,\n actionListOptions,\n };\n};\n\nconst validateActionListItemProps = ({\n leading,\n trailing,\n titleSuffix,\n}: {\n leading: ActionListItemProps['leading'];\n trailing: ActionListItemProps['trailing'];\n titleSuffix: ActionListItemProps['titleSuffix'];\n}): void => {\n if (__DEV__) {\n React.Children.map(trailing, (child) => {\n if (\n !isValidAllowedChildren(child, componentIds.ActionListItemIcon) &&\n !isValidAllowedChildren(child, componentIds.ActionListItemText)\n ) {\n throwBladeError({\n message: `Only ${componentIds.ActionListItemIcon} and ${componentIds.ActionListItemText} are allowed in trailing prop`,\n moduleName: 'ActionListItem',\n });\n }\n });\n\n React.Children.map(titleSuffix, (child) => {\n if (\n !isValidAllowedChildren(child, componentIds.ActionListItemBadge) &&\n !isValidAllowedChildren(child, componentIds.ActionListItemBadgeGroup)\n ) {\n throwBladeError({\n message: `Only ${componentIds.ActionListItemBadge} and ${componentIds.ActionListItemBadgeGroup} are allowed in titleSuffix prop`,\n moduleName: 'ActionListItem',\n });\n }\n });\n\n React.Children.map(leading, (child) => {\n if (\n !isValidAllowedChildren(child, componentIds.ActionListItemIcon) &&\n !isValidAllowedChildren(child, componentIds.ActionListItemText) &&\n !isValidAllowedChildren(child, componentIds.ActionListItemAsset) &&\n !isValidAllowedChildren(child, componentIds.ActionListItemAvatar)\n ) {\n throwBladeError({\n message: `Only ${componentIds.ActionListItemIcon}, ${componentIds.ActionListItemAvatar}, ${componentIds.ActionListItemAsset}, and ${componentIds.ActionListItemText} are allowed in leading prop`,\n moduleName: 'ActionListItem',\n });\n }\n });\n }\n};\n\nconst getNormalTextColor = (\n isDisabled: boolean | undefined,\n { isMuted }: { isMuted?: boolean } = {},\n): Extract<\n BaseTextProps['color'],\n 'interactive.text.gray.disabled' | 'interactive.text.gray.muted' | 'interactive.text.gray.normal'\n> => {\n if (isDisabled) {\n return 'interactive.text.gray.disabled';\n }\n\n if (isMuted) {\n return 'interactive.text.gray.muted';\n }\n\n return 'interactive.text.gray.normal';\n};\n\nexport { getActionListProperties, validateActionListItemProps, getNormalTextColor };\n"],"names":["getActionListSectionPosition","children","childComponentIdArray","React","Children","toArray","map","child","getComponentId","lastActionListSectionIndex","lastIndexOf","componentIds","ActionListSection","isActionListItemPresentAfterSection","slice","includes","ActionListItem","actionListAllowedChildren","getActionListProperties","sectionData","currentSection","actionListOptions","getActionListItemWithId","hideDivider","isValidElement","props","isDisabled","push","title","value","onClickTrigger","_child$props$isSelect","anchorLink","href","onClick","name","isSelected","isReactNative","_child$props$target","target","window","open","top","currentIndex","length","foundSection","find","v","data","Object","assign","_index","clonedChild","cloneElement","_getActionListSection","childrenWithId","index","isValidAllowedChildren","shouldHideDivider","sectionChildValues","childInSection","_hideDivider","undefined","_sectionChildValues","__DEV__","throwBladeError","message","join","moduleName","validateActionListItemProps","_ref","leading","trailing","titleSuffix","ActionListItemIcon","ActionListItemText","ActionListItemBadge","ActionListItemBadgeGroup","ActionListItemAsset","ActionListItemAvatar","getNormalTextColor","_ref2","arguments","isMuted"],"mappings":";;;;;;;;;AAeA,IAAMA,4BAA4B,CAAG,SAA/BA,4BAA4BA,CAChCC,QAAyB,CAItB,CAEH,IAAMC,qBAAqB,CAAGC,cAAK,CAACC,QAAQ,CAACC,OAAO,CAACJ,QAAQ,CAAC,CAACK,GAAG,CAAC,SAACC,KAAK,CACvE,CAAA,OAAAC,cAAc,CAACD,KAAK,CAAC,CACvB,CAAA,CAAC,CAGD,IAAME,0BAA0B,CAAGP,qBAAqB,CAACQ,WAAW,CAClEC,YAAY,CAACC,iBACf,CAAC,CAGD,IAAMC,mCAAmC,CAAGX,qBAAqB,CAC9DY,KAAK,CAACL,0BAA0B,CAAC,CACjCM,QAAQ,CAACJ,YAAY,CAACK,cAAc,CAAC,CAExC,OAAO,CACLH,mCAAmC,CAAnCA,mCAAmC,CACnCJ,0BAA0B,CAA1BA,0BACF,CAAC,CACH,CAAC,CAED,IAAMQ,yBAAyB,CAAG,CAACN,YAAY,CAACK,cAAc,CAAEL,YAAY,CAACC,iBAAiB,CAAC,CAWzF,IAAAM,uBAAuB,CAAG,SA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AAChE,KAAK,CAAK,CACrC,GACE,CAACkD,sBAAsB,CAAClD,KAAK,CAAEI,YAAY,CAAC+D,kBAAkB,CAAC,EAC/D,CAACjB,sBAAsB,CAAClD,KAAK,CAAEI,YAAY,CAACgE,kBAAkB,CAAC,EAC/D,CAAClB,sBAAsB,CAAClD,KAAK,CAAEI,YAAY,CAACmE,mBAAmB,CAAC,EAChE,CAACrB,sBAAsB,CAAClD,KAAK,CAAEI,YAAY,CAACoE,oBAAoB,CAAC,CACjE,CACAd,eAAe,CAAC,CACdC,OAAO,CAAG,CAAA,KAAA,EAAOvD,YAAY,CAAC+D,kBAAmB,CAAA,EAAA,EAAI/D,YAAY,CAACoE,oBAAqB,CAAA,EAAA,EAAIpE,YAAY,CAACmE,mBAAoB,CAAA,MAAA,EAAQnE,YAAY,CAACgE,kBAAmB,CAAA,4BAAA,CAA6B,CACjMP,UAAU,CAAE,gBACd,CAAC,CAAC,CACJ,CACF,CAAC,CAAC,CACJ,CACF,EAEM,IAAAY,kBAAkB,CAAG,SAArBA,kBAAkBA,CACtBtD,UAA+B,CAK5B,CAAA,IAAAuD,KAAA,CAAAC,SAAA,CAAAtC,MAAA,CAAA,CAAA,EAAAsC,SAAA,CAAA,CAAA,CAAA,GAAApB,SAAA,CAAAoB,SAAA,CAAA,CAAA,CAAA,CAJkC,EAAE,CAArCC,OAAO,CAAAF,KAAA,CAAPE,OAAO,CAKT,GAAIzD,UAAU,CAAE,CACd,OAAO,gCAAgC,CACzC,CAEA,GAAIyD,OAAO,CAAE,CACX,OAAO,6BAA6B,CACtC,CAEA,OAAO,8BAA8B,CACvC;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var componentIds={ActionList:'ActionList',ActionListItem:'ActionListItem',ActionListItemBadge:'ActionListItemBadge',ActionListItemBadgeGroup:'ActionListItemBadgeGroup',ActionListItemAsset:'ActionListItemAsset',ActionListItemIcon:'ActionListItemIcon',ActionListItemText:'ActionListItemText',ActionListSection:'ActionListSection'};
|
|
1
|
+
var componentIds={ActionList:'ActionList',ActionListItem:'ActionListItem',ActionListItemBadge:'ActionListItemBadge',ActionListItemBadgeGroup:'ActionListItemBadgeGroup',ActionListItemAsset:'ActionListItemAsset',ActionListItemIcon:'ActionListItemIcon',ActionListItemAvatar:'ActionListItemAvatar',ActionListItemText:'ActionListItemText',ActionListSection:'ActionListSection'};
|
|
2
2
|
|
|
3
3
|
export { componentIds };
|
|
4
4
|
//# sourceMappingURL=componentIds.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"componentIds.js","sources":["../../../../../src/components/ActionList/componentIds.ts"],"sourcesContent":["export const componentIds = {\n ActionList: 'ActionList',\n ActionListItem: 'ActionListItem',\n ActionListItemBadge: 'ActionListItemBadge',\n ActionListItemBadgeGroup: 'ActionListItemBadgeGroup',\n ActionListItemAsset: 'ActionListItemAsset',\n ActionListItemIcon: 'ActionListItemIcon',\n ActionListItemText: 'ActionListItemText',\n ActionListSection: 'ActionListSection',\n};\n"],"names":["componentIds","ActionList","ActionListItem","ActionListItemBadge","ActionListItemBadgeGroup","ActionListItemAsset","ActionListItemIcon","ActionListItemText","ActionListSection"],"mappings":"AAAa,IAAAA,YAAY,CAAG,CAC1BC,UAAU,CAAE,YAAY,CACxBC,cAAc,CAAE,gBAAgB,CAChCC,mBAAmB,CAAE,qBAAqB,CAC1CC,wBAAwB,CAAE,0BAA0B,CACpDC,mBAAmB,CAAE,qBAAqB,CAC1CC,kBAAkB,CAAE,oBAAoB,CACxCC,kBAAkB,CAAE,oBAAoB,CACxCC,iBAAiB,CAAE,mBACrB;;;;"}
|
|
1
|
+
{"version":3,"file":"componentIds.js","sources":["../../../../../src/components/ActionList/componentIds.ts"],"sourcesContent":["export const componentIds = {\n ActionList: 'ActionList',\n ActionListItem: 'ActionListItem',\n ActionListItemBadge: 'ActionListItemBadge',\n ActionListItemBadgeGroup: 'ActionListItemBadgeGroup',\n ActionListItemAsset: 'ActionListItemAsset',\n ActionListItemIcon: 'ActionListItemIcon',\n ActionListItemAvatar: 'ActionListItemAvatar',\n ActionListItemText: 'ActionListItemText',\n ActionListSection: 'ActionListSection',\n};\n"],"names":["componentIds","ActionList","ActionListItem","ActionListItemBadge","ActionListItemBadgeGroup","ActionListItemAsset","ActionListItemIcon","ActionListItemAvatar","ActionListItemText","ActionListSection"],"mappings":"AAAa,IAAAA,YAAY,CAAG,CAC1BC,UAAU,CAAE,YAAY,CACxBC,cAAc,CAAE,gBAAgB,CAChCC,mBAAmB,CAAE,qBAAqB,CAC1CC,wBAAwB,CAAE,0BAA0B,CACpDC,mBAAmB,CAAE,qBAAqB,CAC1CC,kBAAkB,CAAE,oBAAoB,CACxCC,oBAAoB,CAAE,sBAAsB,CAC5CC,kBAAkB,CAAE,oBAAoB,CACxCC,iBAAiB,CAAE,mBACrB;;;;"}
|
|
@@ -3,7 +3,7 @@ export { AccordionItemHeader } from './Accordion/AccordionItemHeader.js';
|
|
|
3
3
|
export { AccordionItemBody } from './Accordion/AccordionItemBody.js';
|
|
4
4
|
export { AccordionItem } from './Accordion/AccordionItem.js';
|
|
5
5
|
export { ActionList } from './ActionList/ActionList.js';
|
|
6
|
-
export { ActionListItem, ActionListItemBadge, ActionListItemBadgeGroup, ActionListItemIcon, ActionListItemText, ActionListSection } from './ActionList/ActionListItem.js';
|
|
6
|
+
export { ActionListItem, ActionListItemAvatar, ActionListItemBadge, ActionListItemBadgeGroup, ActionListItemIcon, ActionListItemText, ActionListSection } from './ActionList/ActionListItem.js';
|
|
7
7
|
export { ActionListItemAsset } from './ActionList/ActionListItemAsset.native.js';
|
|
8
8
|
export { Alert } from './Alert/Alert.js';
|
|
9
9
|
export { Amount } from './Amount/Amount.js';
|
|
@@ -19,6 +19,7 @@ import '../Box/index.js';
|
|
|
19
19
|
import { dropdownComponentIds } from '../Dropdown/dropdownComponentIds.js';
|
|
20
20
|
import '../BaseMenu/index.js';
|
|
21
21
|
import '../Checkbox/index.js';
|
|
22
|
+
import '../Avatar/index.js';
|
|
22
23
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
23
24
|
import { BaseBox } from '../Box/BaseBox/BaseBox.web.js';
|
|
24
25
|
import { makeSize } from '../../utils/makeSize/makeSize.js';
|
|
@@ -31,6 +32,7 @@ import { Divider } from '../Divider/Divider.js';
|
|
|
31
32
|
import { assignWithoutSideEffects } from '../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
|
|
32
33
|
import { useBaseMenuItem } from '../BaseMenu/BaseMenuContext.js';
|
|
33
34
|
import { Box } from '../Box/Box.js';
|
|
35
|
+
import { Avatar } from '../Avatar/Avatar.web.js';
|
|
34
36
|
import { Badge } from '../Badge/Badge.js';
|
|
35
37
|
import { throwBladeError } from '../../utils/logger/logger.js';
|
|
36
38
|
import { BaseMenuItem } from '../BaseMenu/BaseMenuItem/BaseMenuItem.js';
|
|
@@ -128,6 +130,14 @@ var _ActionListItemBadgeGroup = function _ActionListItemBadgeGroup(_ref3) {
|
|
|
128
130
|
var ActionListItemBadgeGroup = /*#__PURE__*/assignWithoutSideEffects(_ActionListItemBadgeGroup, {
|
|
129
131
|
componentId: componentIds.ActionListItemBadgeGroup
|
|
130
132
|
});
|
|
133
|
+
var _ActionListItemAvatar = function _ActionListItemAvatar(avatarProps) {
|
|
134
|
+
return /*#__PURE__*/jsx(Avatar, _objectSpread({
|
|
135
|
+
size: "xsmall"
|
|
136
|
+
}, avatarProps));
|
|
137
|
+
};
|
|
138
|
+
var ActionListItemAvatar = /*#__PURE__*/assignWithoutSideEffects(_ActionListItemAvatar, {
|
|
139
|
+
componentId: componentIds.ActionListItemAvatar
|
|
140
|
+
});
|
|
131
141
|
var _ActionListItemBadge = function _ActionListItemBadge(props) {
|
|
132
142
|
return /*#__PURE__*/jsx(Badge, _objectSpread({
|
|
133
143
|
size: "medium",
|
|
@@ -298,5 +308,5 @@ var ActionListItem = /*#__PURE__*/assignWithoutSideEffects( /*#__PURE__*/React__
|
|
|
298
308
|
displayName: componentIds.ActionListItem
|
|
299
309
|
});
|
|
300
310
|
|
|
301
|
-
export { ActionListItem, ActionListItemBadge, ActionListItemBadgeGroup, ActionListItemIcon, ActionListItemText, ActionListSection };
|
|
311
|
+
export { ActionListItem, ActionListItemAvatar, ActionListItemBadge, ActionListItemBadgeGroup, ActionListItemIcon, ActionListItemText, ActionListSection };
|
|
302
312
|
//# 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 { 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';\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} & TestID;\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;\nconst _ActionListSection = ({\n title,\n children,\n testID,\n _hideDivider,\n _sectionChildValues,\n}: ActionListSectionProps): React.ReactElement => {\n const { hasAutoCompleteInBottomSheetHeader, dropdownTriggerer, filteredValues } = useDropdown();\n const hasAutoComplete =\n hasAutoCompleteInBottomSheetHeader ||\n 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 >\n {/* We're announcing title as group label so we can hide this */}\n {isSectionVisible ? (\n <StyledActionListSectionTitle {...makeAccessible({ hidden: true })}>\n <Text color=\"surface.text.gray.muted\" size=\"small\" weight=\"semibold\">\n {title}\n </Text>\n </StyledActionListSectionTitle>\n ) : null}\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(_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 _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\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 hasAutoCompleteInBottomSheetHeader,\n } = useDropdown();\n\n const hasAutoComplete =\n hasAutoCompleteInBottomSheetHeader ||\n dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete;\n\n const renderOnWebAs = props.href ? 'a' : 'button';\n\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 (dropdownTriggerer === dropdownComponentIds.triggers.SelectInput || hasAutoComplete) {\n if (typeof props._index === 'number') {\n return selectedIndices.includes(props._index);\n }\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 return (\n // We use this context to change the color of subcomponents like ActionListItemIcon, ActionListItemText, etc\n <BaseMenuItem\n isVisible={hasAutoComplete && filteredValues ? filteredValues.includes(props.value) : true}\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 <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={props.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 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 {...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 ActionListItemBadge,\n ActionListItemBadgeGroup,\n ActionListSection,\n};\n"],"names":["StyledActionListSectionTitle","styled","BaseBox","withConfig","displayName","componentId","props","padding","makeSize","theme","spacing","_ActionListSection","_ref","title","children","testID","_hideDivider","_sectionChildValues","_useDropdown","useDropdown","hasAutoCompleteInBottomSheetHeader","dropdownTriggerer","filteredValues","hasAutoComplete","dropdownComponentIds","triggers","AutoComplete","isSectionVisible","React","useMemo","visibleActionListItemInSection","find","actionItemValue","includes","Boolean","showDividerInRN","isReactNative","showDividerInAutoComplete","length","_jsxs","_objectSpread","makeAccessible","role","getActionListSectionRole","label","metaAttribute","name","MetaConstants","ActionListSection","_jsx","hidden","Text","color","size","weight","undefined","Divider","marginX","marginY","assignWithoutSideEffects","componentIds","_ActionListItemIcon","_ref2","icon","Icon","_useBaseMenuItem","useBaseMenuItem","isDisabled","iconState","concat","ActionListItemIcon","_ActionListItemBadgeGroup","_ref3","Box","display","alignItems","flexDirection","ActionListItemBadgeGroup","_ActionListItemBadge","Badge","marginLeft","ActionListItemBadge","_ActionListItemText","_ref4","_useBaseMenuItem2","variant","getNormalTextColor","isMuted","ActionListItemText","makeActionListItemClickable","clickHandler","onPress","onClick","_ActionListItem","_useDropdown2","activeIndex","dropdownBaseId","onOptionClick","selectedIndices","setShouldIgnoreBlurAnimation","selectionType","isKeydownPressed","renderOnWebAs","href","getIsSelected","SelectInput","_index","isSelected","useEffect","validateActionListItemProps","leading","trailing","titleSuffix","intent","throwBladeError","message","moduleName","BaseMenuItem","isVisible","value","as","id","tabIndex","description","pointerEvents","Checkbox","isChecked","target","className","getActionListItemRole","e","_props$onClick","call","event","castWebType","ActionListItem","onMouseDown","onMouseUp","memo"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwFA,IAAMA,4BAA4B,gBAAGC,MAAM,CAACC,OAAO,CAAC,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,8CAAA;EAAAC,WAAA,EAAA,UAAA;AAAA,CAAA,CAAA,CAAC,UAACC,KAAK,EAAA;EAAA,OAAM;AAC/D;IACAC,OAAO,EAAEC,QAAQ,CAACF,KAAK,CAACG,KAAK,CAACC,OAAO,CAAC,CAAC,CAAC,CAAA;GACzC,CAAA;AAAA,CAAC,CAAC,CAAA;AAoBH,IAAMC,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAAC,IAAA,EAM0B;AAAA,EAAA,IALhDC,KAAK,GAAAD,IAAA,CAALC,KAAK;IACLC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;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,IAAAuC,cAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAbA,cAAA,CAAAC,IAAA,CAAA9H,KAAK,EAAW;UAAEwC,IAAI,EAAExC,KAAK,CAACiH,KAAK;AAAEA,UAAAA,KAAK,EAAEZ,UAAU;UAAE0B,KAAK,EAAEC,WAAW,CAACJ,CAAC,CAAA;AAAE,SAAC,CAAC,CAAA;AAClF,OAAA;KACD,CAAC,CACErF,EAAAA,aAAa,CAAC;MAAEC,IAAI,EAAEC,aAAa,CAACwF,cAAc;MAAExH,MAAM,EAAET,KAAK,CAACS,MAAAA;AAAO,KAAC,CAAC,CAAA,EAAA,EAAA,EAAA;MAC/EyH,WAAW,EAAE,SAAAA,WAAAA,GAAM;AACjB;AACA;QACArC,4BAA4B,CAAC,IAAI,CAAC,CAAA;OAClC;MACFsC,SAAS,EAAE,SAAAA,SAAAA,GAAM;AACf;QACAtC,4BAA4B,CAAC,KAAK,CAAC,CAAA;OACnC;MACF,YAAY7F,EAAAA,KAAK,CAACiH,KAAM;MACxB,YAAYjH,EAAAA,KAAK,CAACoG,MAAO;AACzBN,MAAAA,aAAa,EAAEA,aAAc;MAC7BhD,KAAK,EAAE9C,KAAK,CAAC2G,MAAO;AACpBZ,MAAAA,gBAAgB,EAAEA,gBAAAA;KACnB,CAAA,CAAA;AAAC,IAAA;AAEN,CAAC,CAAA;AAEKkC,IAAAA,cAAc,gBAAG5E,wBAAwB,eAAC/B,cAAK,CAAC8G,IAAI,CAAC7C,eAAe,CAAC,EAAE;EAC3ExF,WAAW,EAAEuD,YAAY,CAAC2E,cAAc;EACxCnI,WAAW,EAAEwD,YAAY,CAAC2E,cAAAA;AAC5B,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 { 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';\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} & TestID;\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;\nconst _ActionListSection = ({\n title,\n children,\n testID,\n _hideDivider,\n _sectionChildValues,\n}: ActionListSectionProps): React.ReactElement => {\n const { hasAutoCompleteInBottomSheetHeader, dropdownTriggerer, filteredValues } = useDropdown();\n const hasAutoComplete =\n hasAutoCompleteInBottomSheetHeader ||\n 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 >\n {/* We're announcing title as group label so we can hide this */}\n {isSectionVisible ? (\n <StyledActionListSectionTitle {...makeAccessible({ hidden: true })}>\n <Text color=\"surface.text.gray.muted\" size=\"small\" weight=\"semibold\">\n {title}\n </Text>\n </StyledActionListSectionTitle>\n ) : null}\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(_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\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 hasAutoCompleteInBottomSheetHeader,\n } = useDropdown();\n\n const hasAutoComplete =\n hasAutoCompleteInBottomSheetHeader ||\n dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete;\n\n const renderOnWebAs = props.href ? 'a' : 'button';\n\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 (dropdownTriggerer === dropdownComponentIds.triggers.SelectInput || hasAutoComplete) {\n if (typeof props._index === 'number') {\n return selectedIndices.includes(props._index);\n }\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 return (\n // We use this context to change the color of subcomponents like ActionListItemIcon, ActionListItemText, etc\n <BaseMenuItem\n isVisible={hasAutoComplete && filteredValues ? filteredValues.includes(props.value) : true}\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 <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={props.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 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 {...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};\n"],"names":["StyledActionListSectionTitle","styled","BaseBox","withConfig","displayName","componentId","props","padding","makeSize","theme","spacing","_ActionListSection","_ref","title","children","testID","_hideDivider","_sectionChildValues","_useDropdown","useDropdown","hasAutoCompleteInBottomSheetHeader","dropdownTriggerer","filteredValues","hasAutoComplete","dropdownComponentIds","triggers","AutoComplete","isSectionVisible","React","useMemo","visibleActionListItemInSection","find","actionItemValue","includes","Boolean","showDividerInRN","isReactNative","showDividerInAutoComplete","length","_jsxs","_objectSpread","makeAccessible","role","getActionListSectionRole","label","metaAttribute","name","MetaConstants","ActionListSection","_jsx","hidden","Text","color","size","weight","undefined","Divider","marginX","marginY","assignWithoutSideEffects","componentIds","_ActionListItemIcon","_ref2","icon","Icon","_useBaseMenuItem","useBaseMenuItem","isDisabled","iconState","concat","ActionListItemIcon","_ActionListItemBadgeGroup","_ref3","Box","display","alignItems","flexDirection","ActionListItemBadgeGroup","_ActionListItemAvatar","avatarProps","Avatar","ActionListItemAvatar","_ActionListItemBadge","Badge","marginLeft","ActionListItemBadge","_ActionListItemText","_ref4","_useBaseMenuItem2","variant","getNormalTextColor","isMuted","ActionListItemText","makeActionListItemClickable","clickHandler","onPress","onClick","_ActionListItem","_useDropdown2","activeIndex","dropdownBaseId","onOptionClick","selectedIndices","setShouldIgnoreBlurAnimation","selectionType","isKeydownPressed","renderOnWebAs","href","getIsSelected","SelectInput","_index","isSelected","useEffect","validateActionListItemProps","leading","trailing","titleSuffix","intent","throwBladeError","message","moduleName","BaseMenuItem","isVisible","value","as","id","tabIndex","description","pointerEvents","Checkbox","isChecked","target","className","getActionListItemRole","e","_props$onClick","call","event","castWebType","ActionListItem","onMouseDown","onMouseUp","memo"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0FA,IAAMA,4BAA4B,gBAAGC,MAAM,CAACC,OAAO,CAAC,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,8CAAA;EAAAC,WAAA,EAAA,UAAA;AAAA,CAAA,CAAA,CAAC,UAACC,KAAK,EAAA;EAAA,OAAM;AAC/D;IACAC,OAAO,EAAEC,QAAQ,CAACF,KAAK,CAACG,KAAK,CAACC,OAAO,CAAC,CAAC,CAAC,CAAA;GACzC,CAAA;AAAA,CAAC,CAAC,CAAA;AAoBH,IAAMC,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAAC,IAAA,EAM0B;AAAA,EAAA,IALhDC,KAAK,GAAAD,IAAA,CAALC,KAAK;IACLC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,MAAM,GAAAH,IAAA,CAANG,MAAM;IACNC,YAAY,GAAAJ,IAAA,CAAZI,YAAY;IACZC,mBAAmB,GAAAL,IAAA,CAAnBK,mBAAmB,CAAA;AAEnB,EAAA,IAAAC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E,cAAAA;AAC5B,CAAC;;;;"}
|
|
@@ -163,9 +163,9 @@ var validateActionListItemProps = function validateActionListItemProps(_ref) {
|
|
|
163
163
|
}
|
|
164
164
|
});
|
|
165
165
|
React__default.Children.map(leading, function (child) {
|
|
166
|
-
if (!isValidAllowedChildren(child, componentIds.ActionListItemIcon) && !isValidAllowedChildren(child, componentIds.ActionListItemText) && !isValidAllowedChildren(child, componentIds.ActionListItemAsset)) {
|
|
166
|
+
if (!isValidAllowedChildren(child, componentIds.ActionListItemIcon) && !isValidAllowedChildren(child, componentIds.ActionListItemText) && !isValidAllowedChildren(child, componentIds.ActionListItemAsset) && !isValidAllowedChildren(child, componentIds.ActionListItemAvatar)) {
|
|
167
167
|
throwBladeError({
|
|
168
|
-
message: "Only ".concat(componentIds.ActionListItemIcon, ", ").concat(componentIds.ActionListItemAsset, ", and ").concat(componentIds.ActionListItemText, " are allowed in leading prop"),
|
|
168
|
+
message: "Only ".concat(componentIds.ActionListItemIcon, ", ").concat(componentIds.ActionListItemAvatar, ", ").concat(componentIds.ActionListItemAsset, ", and ").concat(componentIds.ActionListItemText, " are allowed in leading prop"),
|
|
169
169
|
moduleName: 'ActionListItem'
|
|
170
170
|
});
|
|
171
171
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actionListUtils.js","sources":["../../../../../../src/components/ActionList/actionListUtils.ts"],"sourcesContent":["import React from 'react';\nimport { componentIds } from './componentIds';\nimport type { ActionListItemProps } from './ActionListItem';\nimport type { OptionsType } from '~components/Dropdown/useDropdown';\nimport { isReactNative } from '~utils';\nimport type { BaseTextProps } from '~components/Typography/BaseText/types';\nimport { getComponentId, isValidAllowedChildren } from '~utils/isValidAllowedChildren';\nimport { throwBladeError } from '~utils/logger';\n\n/**\n * Returns if there is ActionListItem after ActionListSection\n * and an index of last ActionListSection\n *\n * It is used to decide if ActionListSection add divider at the end\n */\nconst getActionListSectionPosition = (\n children: React.ReactNode,\n): {\n isActionListItemPresentAfterSection: boolean;\n lastActionListSectionIndex: number;\n} => {\n // Creating an array of componentIds\n const childComponentIdArray = React.Children.toArray(children).map((child) =>\n getComponentId(child),\n );\n\n // Reading the last `ActionListSection` component's index\n const lastActionListSectionIndex = childComponentIdArray.lastIndexOf(\n componentIds.ActionListSection,\n );\n\n // Checking if there is any `ActionListItem` present after `ActionListSection`\n const isActionListItemPresentAfterSection = childComponentIdArray\n .slice(lastActionListSectionIndex)\n .includes(componentIds.ActionListItem);\n\n return {\n isActionListItemPresentAfterSection,\n lastActionListSectionIndex,\n };\n};\n\nconst actionListAllowedChildren = [componentIds.ActionListItem, componentIds.ActionListSection];\n\nexport type SectionData = {\n title: string;\n hideDivider: boolean;\n data: ActionListItemProps[];\n}[];\n\n/**\n * Loops over action list items and returns different properties from children like option values, header and footer child, etc\n */\nconst getActionListProperties = (\n children: React.ReactNode,\n): {\n sectionData: SectionData;\n childrenWithId?: React.ReactNode[] | null;\n actionListOptions: OptionsType;\n} => {\n const sectionData: SectionData = [];\n let currentSection: string | null = null;\n const actionListOptions: OptionsType = [];\n\n const getActionListItemWithId = (\n child: React.ReactNode,\n hideDivider: boolean,\n ): React.ReactNode => {\n if (React.isValidElement(child) && !child.props.isDisabled) {\n actionListOptions.push({\n title: child.props.title,\n value: child.props.value,\n onClickTrigger: (value) => {\n const anchorLink = child.props.href;\n child.props.onClick?.({\n name: child.props.value,\n value: child.props.isSelected ?? value,\n });\n\n if (anchorLink && !isReactNative()) {\n const target = child.props.target ?? '_self';\n window.open(anchorLink, target);\n if (window.top) {\n window.top.open(anchorLink, target);\n }\n }\n },\n });\n const currentIndex = actionListOptions.length - 1;\n\n const foundSection = sectionData.find((v) => v.title === currentSection);\n // push the item in the appropriate bucket\n if (foundSection) {\n foundSection?.data.push({\n ...child.props,\n _index: currentIndex,\n });\n } else {\n // create a new bucket\n sectionData.push({\n title: currentSection!,\n hideDivider,\n data: [\n {\n ...child.props,\n _index: currentIndex,\n },\n ],\n });\n }\n\n const clonedChild = React.cloneElement(child, {\n // @ts-expect-error: TS doesn't understand the child's props\n _index: currentIndex,\n });\n return clonedChild;\n }\n\n return child;\n };\n\n let isActionListItemPresentAfterSection: boolean;\n // eslint-disable-next-line one-var\n let lastActionListSectionIndex: number;\n\n if (isReactNative()) {\n // We're reading this so that we can decide whether to show the divider or not.\n // If ActionListSection is final item and no ActionListItem is present after that, we hide the divider\n\n // On web, we do it using descendant styling\n ({\n isActionListItemPresentAfterSection,\n lastActionListSectionIndex,\n } = getActionListSectionPosition(children));\n }\n\n // Looping through ActionListItems to add index to them and get an options array for moving focus between items\n const childrenWithId = React.Children.map(children, (child, index) => {\n if (React.isValidElement(child)) {\n if (isValidAllowedChildren(child, componentIds.ActionListSection)) {\n const shouldHideDivider =\n index === lastActionListSectionIndex && !isActionListItemPresentAfterSection;\n const sectionChildValues: string[] = [];\n return React.cloneElement(child, {\n // @ts-expect-error: TS doesn't understand the child's props\n children: React.Children.map(child.props.children, (childInSection) => {\n currentSection = child.props.title;\n sectionChildValues.push(childInSection.props.value);\n if (isValidAllowedChildren(childInSection, componentIds.ActionListItem)) {\n return getActionListItemWithId(childInSection, shouldHideDivider);\n }\n\n return childInSection;\n }),\n // On web, we handle it with descendant styling in css so no need of JS there\n _hideDivider: isReactNative() ? shouldHideDivider : undefined,\n _sectionChildValues: sectionChildValues,\n });\n }\n\n if (isValidAllowedChildren(child, componentIds.ActionListItem)) {\n return getActionListItemWithId(child, true);\n }\n\n if (__DEV__) {\n throwBladeError({\n message: `Only ${actionListAllowedChildren.join(', ')} supported inside ActionList`,\n moduleName: 'ActionList',\n });\n }\n }\n return child;\n });\n\n return {\n sectionData,\n childrenWithId,\n actionListOptions,\n };\n};\n\nconst validateActionListItemProps = ({\n leading,\n trailing,\n titleSuffix,\n}: {\n leading: ActionListItemProps['leading'];\n trailing: ActionListItemProps['trailing'];\n titleSuffix: ActionListItemProps['titleSuffix'];\n}): void => {\n if (__DEV__) {\n React.Children.map(trailing, (child) => {\n if (\n !isValidAllowedChildren(child, componentIds.ActionListItemIcon) &&\n !isValidAllowedChildren(child, componentIds.ActionListItemText)\n ) {\n throwBladeError({\n message: `Only ${componentIds.ActionListItemIcon} and ${componentIds.ActionListItemText} are allowed in trailing prop`,\n moduleName: 'ActionListItem',\n });\n }\n });\n\n React.Children.map(titleSuffix, (child) => {\n if (\n !isValidAllowedChildren(child, componentIds.ActionListItemBadge) &&\n !isValidAllowedChildren(child, componentIds.ActionListItemBadgeGroup)\n ) {\n throwBladeError({\n message: `Only ${componentIds.ActionListItemBadge} and ${componentIds.ActionListItemBadgeGroup} are allowed in titleSuffix prop`,\n moduleName: 'ActionListItem',\n });\n }\n });\n\n React.Children.map(leading, (child) => {\n if (\n !isValidAllowedChildren(child, componentIds.ActionListItemIcon) &&\n !isValidAllowedChildren(child, componentIds.ActionListItemText) &&\n !isValidAllowedChildren(child, componentIds.ActionListItemAsset)\n ) {\n throwBladeError({\n message: `Only ${componentIds.ActionListItemIcon}, ${componentIds.ActionListItemAsset}, and ${componentIds.ActionListItemText} are allowed in leading prop`,\n moduleName: 'ActionListItem',\n });\n }\n });\n }\n};\n\nconst getNormalTextColor = (\n isDisabled: boolean | undefined,\n { isMuted }: { isMuted?: boolean } = {},\n): Extract<\n BaseTextProps['color'],\n 'interactive.text.gray.disabled' | 'interactive.text.gray.muted' | 'interactive.text.gray.normal'\n> => {\n if (isDisabled) {\n return 'interactive.text.gray.disabled';\n }\n\n if (isMuted) {\n return 'interactive.text.gray.muted';\n }\n\n return 'interactive.text.gray.normal';\n};\n\nexport { getActionListProperties, validateActionListItemProps, getNormalTextColor };\n"],"names":["getActionListSectionPosition","children","childComponentIdArray","React","Children","toArray","map","child","getComponentId","lastActionListSectionIndex","lastIndexOf","componentIds","ActionListSection","isActionListItemPresentAfterSection","slice","includes","ActionListItem","actionListAllowedChildren","getActionListProperties","sectionData","currentSection","actionListOptions","getActionListItemWithId","hideDivider","isValidElement","props","isDisabled","push","title","value","onClickTrigger","_child$props$onClick","_child$props","_child$props$isSelect","anchorLink","href","onClick","call","name","isSelected","isReactNative","_child$props$target","target","window","open","top","currentIndex","length","foundSection","find","v","data","_objectSpread","_index","clonedChild","cloneElement","_getActionListSection","childrenWithId","index","isValidAllowedChildren","shouldHideDivider","sectionChildValues","childInSection","_hideDivider","undefined","_sectionChildValues","throwBladeError","message","concat","join","moduleName","validateActionListItemProps","_ref","leading","trailing","titleSuffix","ActionListItemIcon","ActionListItemText","ActionListItemBadge","ActionListItemBadgeGroup","ActionListItemAsset","getNormalTextColor","_ref2","arguments","isMuted"],"mappings":";;;;;;;;;;;;;AASA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMA,4BAA4B,GAAG,SAA/BA,4BAA4BA,CAChCC,QAAyB,EAItB;AACH;AACA,EAAA,IAAMC,qBAAqB,GAAGC,cAAK,CAACC,QAAQ,CAACC,OAAO,CAACJ,QAAQ,CAAC,CAACK,GAAG,CAAC,UAACC,KAAK,EAAA;IAAA,OACvEC,cAAc,CAACD,KAAK,CAAC,CAAA;AAAA,GACvB,CAAC,CAAA;;AAED;EACA,IAAME,0BAA0B,GAAGP,qBAAqB,CAACQ,WAAW,CAClEC,YAAY,CAACC,iBACf,CAAC,CAAA;;AAED;AACA,EAAA,IAAMC,mCAAmC,GAAGX,qBAAqB,CAC9DY,KAAK,CAACL,0BAA0B,CAAC,CACjCM,QAAQ,CAACJ,YAAY,CAACK,cAAc,CAAC,CAAA;EAExC,OAAO;AACLH,IAAAA,mCAAmC,EAAnCA,mCAAmC;AACnCJ,IAAAA,0BAA0B,EAA1BA,0BAAAA;GACD,CAAA;AACH,CAAC,CAAA;AAED,IAAMQ,yBAAyB,GAAG,CAACN,YAAY,CAACK,cAAc,EAAEL,YAAY,CAACC,iBAAiB,CAAC,CAAA;AAQ/F;AACA;AACA;AACA,IAAMM,uBAAuB,GAAG,SAA1BA,uBAAuBA,CAC3BjB,QAAyB,EAKtB;EACH,IAAMkB,WAAwB,GAAG,EAAE,CAAA;EACnC,IAAIC,cAA6B,GAA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B,CAACpD,KAAK,EAAEI,YAAY,CAACqE,mBAAmB,CAAC,EAChE;AACAd,QAAAA,eAAe,CAAC;AACdC,UAAAA,OAAO,UAAAC,MAAA,CAAUzD,YAAY,CAACiE,kBAAkB,QAAAR,MAAA,CAAKzD,YAAY,CAACqE,mBAAmB,EAAAZ,QAAAA,CAAAA,CAAAA,MAAA,CAASzD,YAAY,CAACkE,kBAAkB,EAA8B,8BAAA,CAAA;AAC3JP,UAAAA,UAAU,EAAE,gBAAA;AACd,SAAC,CAAC,CAAA;AACJ,OAAA;AACF,KAAC,CAAC,CAAA;AACJ,GAAA;AACF,EAAC;AAED,IAAMW,kBAAkB,GAAG,SAArBA,kBAAkBA,CACtBvD,UAA+B,EAK5B;AAAA,EAAA,IAAAwD,KAAA,GAAAC,SAAA,CAAApC,MAAA,GAAA,CAAA,IAAAoC,SAAA,CAAA,CAAA,CAAA,KAAAnB,SAAA,GAAAmB,SAAA,CAAA,CAAA,CAAA,GAJkC,EAAE;IAArCC,OAAO,GAAAF,KAAA,CAAPE,OAAO,CAAA;AAKT,EAAA,IAAI1D,UAAU,EAAE;AACd,IAAA,OAAO,gCAAgC,CAAA;AACzC,GAAA;AAEA,EAAA,IAAI0D,OAAO,EAAE;AACX,IAAA,OAAO,6BAA6B,CAAA;AACtC,GAAA;AAEA,EAAA,OAAO,8BAA8B,CAAA;AACvC;;;;"}
|
|
1
|
+
{"version":3,"file":"actionListUtils.js","sources":["../../../../../../src/components/ActionList/actionListUtils.ts"],"sourcesContent":["import React from 'react';\nimport { componentIds } from './componentIds';\nimport type { ActionListItemProps } from './ActionListItem';\nimport type { OptionsType } from '~components/Dropdown/useDropdown';\nimport { isReactNative } from '~utils';\nimport type { BaseTextProps } from '~components/Typography/BaseText/types';\nimport { getComponentId, isValidAllowedChildren } from '~utils/isValidAllowedChildren';\nimport { throwBladeError } from '~utils/logger';\n\n/**\n * Returns if there is ActionListItem after ActionListSection\n * and an index of last ActionListSection\n *\n * It is used to decide if ActionListSection add divider at the end\n */\nconst getActionListSectionPosition = (\n children: React.ReactNode,\n): {\n isActionListItemPresentAfterSection: boolean;\n lastActionListSectionIndex: number;\n} => {\n // Creating an array of componentIds\n const childComponentIdArray = React.Children.toArray(children).map((child) =>\n getComponentId(child),\n );\n\n // Reading the last `ActionListSection` component's index\n const lastActionListSectionIndex = childComponentIdArray.lastIndexOf(\n componentIds.ActionListSection,\n );\n\n // Checking if there is any `ActionListItem` present after `ActionListSection`\n const isActionListItemPresentAfterSection = childComponentIdArray\n .slice(lastActionListSectionIndex)\n .includes(componentIds.ActionListItem);\n\n return {\n isActionListItemPresentAfterSection,\n lastActionListSectionIndex,\n };\n};\n\nconst actionListAllowedChildren = [componentIds.ActionListItem, componentIds.ActionListSection];\n\nexport type SectionData = {\n title: string;\n hideDivider: boolean;\n data: ActionListItemProps[];\n}[];\n\n/**\n * Loops over action list items and returns different properties from children like option values, header and footer child, etc\n */\nconst getActionListProperties = (\n children: React.ReactNode,\n): {\n sectionData: SectionData;\n childrenWithId?: React.ReactNode[] | null;\n actionListOptions: OptionsType;\n} => {\n const sectionData: SectionData = [];\n let currentSection: string | null = null;\n const actionListOptions: OptionsType = [];\n\n const getActionListItemWithId = (\n child: React.ReactNode,\n hideDivider: boolean,\n ): React.ReactNode => {\n if (React.isValidElement(child) && !child.props.isDisabled) {\n actionListOptions.push({\n title: child.props.title,\n value: child.props.value,\n onClickTrigger: (value) => {\n const anchorLink = child.props.href;\n child.props.onClick?.({\n name: child.props.value,\n value: child.props.isSelected ?? value,\n });\n\n if (anchorLink && !isReactNative()) {\n const target = child.props.target ?? '_self';\n window.open(anchorLink, target);\n if (window.top) {\n window.top.open(anchorLink, target);\n }\n }\n },\n });\n const currentIndex = actionListOptions.length - 1;\n\n const foundSection = sectionData.find((v) => v.title === currentSection);\n // push the item in the appropriate bucket\n if (foundSection) {\n foundSection?.data.push({\n ...child.props,\n _index: currentIndex,\n });\n } else {\n // create a new bucket\n sectionData.push({\n title: currentSection!,\n hideDivider,\n data: [\n {\n ...child.props,\n _index: currentIndex,\n },\n ],\n });\n }\n\n const clonedChild = React.cloneElement(child, {\n // @ts-expect-error: TS doesn't understand the child's props\n _index: currentIndex,\n });\n return clonedChild;\n }\n\n return child;\n };\n\n let isActionListItemPresentAfterSection: boolean;\n // eslint-disable-next-line one-var\n let lastActionListSectionIndex: number;\n\n if (isReactNative()) {\n // We're reading this so that we can decide whether to show the divider or not.\n // If ActionListSection is final item and no ActionListItem is present after that, we hide the divider\n\n // On web, we do it using descendant styling\n ({\n isActionListItemPresentAfterSection,\n lastActionListSectionIndex,\n } = getActionListSectionPosition(children));\n }\n\n // Looping through ActionListItems to add index to them and get an options array for moving focus between items\n const childrenWithId = React.Children.map(children, (child, index) => {\n if (React.isValidElement(child)) {\n if (isValidAllowedChildren(child, componentIds.ActionListSection)) {\n const shouldHideDivider =\n index === lastActionListSectionIndex && !isActionListItemPresentAfterSection;\n const sectionChildValues: string[] = [];\n return React.cloneElement(child, {\n // @ts-expect-error: TS doesn't understand the child's props\n children: React.Children.map(child.props.children, (childInSection) => {\n currentSection = child.props.title;\n sectionChildValues.push(childInSection.props.value);\n if (isValidAllowedChildren(childInSection, componentIds.ActionListItem)) {\n return getActionListItemWithId(childInSection, shouldHideDivider);\n }\n\n return childInSection;\n }),\n // On web, we handle it with descendant styling in css so no need of JS there\n _hideDivider: isReactNative() ? shouldHideDivider : undefined,\n _sectionChildValues: sectionChildValues,\n });\n }\n\n if (isValidAllowedChildren(child, componentIds.ActionListItem)) {\n return getActionListItemWithId(child, true);\n }\n\n if (__DEV__) {\n throwBladeError({\n message: `Only ${actionListAllowedChildren.join(', ')} supported inside ActionList`,\n moduleName: 'ActionList',\n });\n }\n }\n return child;\n });\n\n return {\n sectionData,\n childrenWithId,\n actionListOptions,\n };\n};\n\nconst validateActionListItemProps = ({\n leading,\n trailing,\n titleSuffix,\n}: {\n leading: ActionListItemProps['leading'];\n trailing: ActionListItemProps['trailing'];\n titleSuffix: ActionListItemProps['titleSuffix'];\n}): void => {\n if (__DEV__) {\n React.Children.map(trailing, (child) => {\n if (\n !isValidAllowedChildren(child, componentIds.ActionListItemIcon) &&\n !isValidAllowedChildren(child, componentIds.ActionListItemText)\n ) {\n throwBladeError({\n message: `Only ${componentIds.ActionListItemIcon} and ${componentIds.ActionListItemText} are allowed in trailing prop`,\n moduleName: 'ActionListItem',\n });\n }\n });\n\n React.Children.map(titleSuffix, (child) => {\n if (\n !isValidAllowedChildren(child, componentIds.ActionListItemBadge) &&\n !isValidAllowedChildren(child, componentIds.ActionListItemBadgeGroup)\n ) {\n throwBladeError({\n message: `Only ${componentIds.ActionListItemBadge} and ${componentIds.ActionListItemBadgeGroup} are allowed in titleSuffix prop`,\n moduleName: 'ActionListItem',\n });\n }\n });\n\n React.Children.map(leading, (child) => {\n if (\n !isValidAllowedChildren(child, componentIds.ActionListItemIcon) &&\n !isValidAllowedChildren(child, componentIds.ActionListItemText) &&\n !isValidAllowedChildren(child, componentIds.ActionListItemAsset) &&\n !isValidAllowedChildren(child, componentIds.ActionListItemAvatar)\n ) {\n throwBladeError({\n message: `Only ${componentIds.ActionListItemIcon}, ${componentIds.ActionListItemAvatar}, ${componentIds.ActionListItemAsset}, and ${componentIds.ActionListItemText} are allowed in leading prop`,\n moduleName: 'ActionListItem',\n });\n }\n });\n }\n};\n\nconst getNormalTextColor = (\n isDisabled: boolean | undefined,\n { isMuted }: { isMuted?: boolean } = {},\n): Extract<\n BaseTextProps['color'],\n 'interactive.text.gray.disabled' | 'interactive.text.gray.muted' | 'interactive.text.gray.normal'\n> => {\n if (isDisabled) {\n return 'interactive.text.gray.disabled';\n }\n\n if (isMuted) {\n return 'interactive.text.gray.muted';\n }\n\n return 'interactive.text.gray.normal';\n};\n\nexport { getActionListProperties, validateActionListItemProps, getNormalTextColor };\n"],"names":["getActionListSectionPosition","children","childComponentIdArray","React","Children","toArray","map","child","getComponentId","lastActionListSectionIndex","lastIndexOf","componentIds","ActionListSection","isActionListItemPresentAfterSection","slice","includes","ActionListItem","actionListAllowedChildren","getActionListProperties","sectionData","currentSection","actionListOptions","getActionListItemWithId","hideDivider","isValidElement","props","isDisabled","push","title","value","onClickTrigger","_child$props$onClick","_child$props","_child$props$isSelect","anchorLink","href","onClick","call","name","isSelected","isReactNative","_child$props$target","target","window","open","top","currentIndex","length","foundSection","find","v","data","_objectSpread","_index","clonedChild","cloneElement","_getActionListSection","childrenWithId","index","isValidAllowedChildren","shouldHideDivider","sectionChildValues","childInSection","_hideDivider","undefined","_sectionChildValues","throwBladeError","message","concat","join","moduleName","validateActionListItemProps","_ref","leading","trailing","titleSuffix","ActionListItemIcon","ActionListItemText","ActionListItemBadge","ActionListItemBadgeGroup","ActionListItemAsset","ActionListItemAvatar","getNormalTextColor","_ref2","arguments","isMuted"],"mappings":";;;;;;;;;;;;;AASA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMA,4BAA4B,GAAG,SAA/BA,4BAA4BA,CAChCC,QAAyB,EAItB;AACH;AACA,EAAA,IAAMC,qBAAqB,GAAGC,cAAK,CAACC,QAAQ,CAACC,OAAO,CAACJ,QAAQ,CAAC,CAACK,GAAG,CAAC,UAACC,KAAK,EAAA;IAAA,OACvEC,cAAc,CAACD,KAAK,CAAC,CAAA;AAAA,GACvB,CAAC,CAAA;;AAED;EACA,IAAME,0BAA0B,GAAGP,qBAAqB,CAACQ,WAAW,CAClEC,YAAY,CAACC,iBACf,CAAC,CAAA;;AAED;AACA,EAAA,IAAMC,mCAAmC,GAAGX,qBAAqB,CAC9DY,KAAK,CAACL,0BAA0B,CAAC,CACjCM,QAAQ,CAACJ,YAAY,CAACK,cAAc,CAAC,CAAA;EAExC,OAAO;AACLH,IAAAA,mCAAmC,EAAnCA,mCAAmC;AACnCJ,IAAAA,0BAA0B,EAA1BA,0BAAAA;GACD,CAAA;AACH,CAAC,CAAA;AAED,IAAMQ,yBAAyB,GAAG,CAACN,YAAY,CAACK,cAAc,EAAEL,YAAY,CAACC,iBAAiB,CAAC,CAAA;A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|
ActionListItemAsset: 'ActionListItemAsset',
|
|
7
7
|
ActionListItemIcon: 'ActionListItemIcon',
|
|
8
|
+
ActionListItemAvatar: 'ActionListItemAvatar',
|
|
8
9
|
ActionListItemText: 'ActionListItemText',
|
|
9
10
|
ActionListSection: 'ActionListSection'
|
|
10
11
|
};
|