@razorpay/blade 11.21.9 → 11.23.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 +12 -12
- package/build/lib/native/components/ActionList/ActionListItem.js.map +1 -1
- package/build/lib/native/components/BaseHeaderFooter/BaseFooter.js +1 -1
- package/build/lib/native/components/BaseHeaderFooter/BaseFooter.js.map +1 -1
- package/build/lib/native/components/BaseHeaderFooter/BaseHeader.js +1 -1
- package/build/lib/native/components/BaseHeaderFooter/BaseHeader.js.map +1 -1
- package/build/lib/native/components/BaseMenu/BaseMenuContext.js +6 -0
- package/build/lib/native/components/BaseMenu/BaseMenuContext.js.map +1 -0
- package/build/lib/native/components/BaseMenu/BaseMenuItem/BaseMenuItem.js +22 -0
- package/build/lib/native/components/BaseMenu/BaseMenuItem/BaseMenuItem.js.map +1 -0
- package/build/lib/native/components/BaseMenu/BaseMenuItem/StyledMenuItemContainer.native.js +12 -0
- package/build/lib/native/components/BaseMenu/BaseMenuItem/StyledMenuItemContainer.native.js.map +1 -0
- package/build/lib/native/components/BaseMenu/BaseMenuItem/getBaseMenuItemStyles.js +12 -0
- package/build/lib/native/components/BaseMenu/BaseMenuItem/getBaseMenuItemStyles.js.map +1 -0
- package/build/lib/native/components/Button/BaseButton/BaseButton.js +1 -1
- package/build/lib/native/components/Button/BaseButton/BaseButton.js.map +1 -1
- package/build/lib/native/components/Button/Button/Button.js +1 -1
- package/build/lib/native/components/Button/Button/Button.js.map +1 -1
- package/build/lib/native/components/Link/BaseLink/BaseLink.js +1 -1
- package/build/lib/native/components/Link/BaseLink/BaseLink.js.map +1 -1
- package/build/lib/native/components/Link/Link/Link.js +1 -1
- package/build/lib/native/components/Link/Link/Link.js.map +1 -1
- package/build/lib/native/components/Menu/Menu.native.js +17 -0
- package/build/lib/native/components/Menu/Menu.native.js.map +1 -0
- package/build/lib/native/components/Menu/MenuItem.native.js +17 -0
- package/build/lib/native/components/Menu/MenuItem.native.js.map +1 -0
- package/build/lib/native/components/Menu/MenuOverlay.native.js +17 -0
- package/build/lib/native/components/Menu/MenuOverlay.native.js.map +1 -0
- package/build/lib/native/components/Menu/VisualSubComponents/MenuDivider.native.js +17 -0
- package/build/lib/native/components/Menu/VisualSubComponents/MenuDivider.native.js.map +1 -0
- package/build/lib/native/components/Menu/VisualSubComponents/MenuHeaderFooter.native.js +17 -0
- package/build/lib/native/components/Menu/VisualSubComponents/MenuHeaderFooter.native.js.map +1 -0
- package/build/lib/native/components/SideNav/tokens.js +12 -0
- package/build/lib/native/components/SideNav/tokens.js.map +1 -0
- package/build/lib/native/components/TopNav/TabNav/TabNav.native.js +17 -0
- package/build/lib/native/components/TopNav/TabNav/TabNav.native.js.map +1 -0
- package/build/lib/native/components/TopNav/TabNav/TabNavItem.native.js +17 -0
- package/build/lib/native/components/TopNav/TabNav/TabNavItem.native.js.map +1 -0
- package/build/lib/native/components/TopNav/TopNav.native.js +17 -0
- package/build/lib/native/components/TopNav/TopNav.native.js.map +1 -0
- package/build/lib/native/components/index.js +9 -0
- package/build/lib/native/components/index.js.map +1 -1
- package/build/lib/native/tokens/global/size.js +1 -1
- package/build/lib/native/tokens/global/size.js.map +1 -1
- package/build/lib/native/utils/metaAttribute/metaConstants.js +1 -1
- package/build/lib/native/utils/metaAttribute/metaConstants.js.map +1 -1
- package/build/lib/web/development/components/ActionList/ActionListItem.js +43 -118
- package/build/lib/web/development/components/ActionList/ActionListItem.js.map +1 -1
- package/build/lib/web/development/components/Avatar/Avatar.web.js +29 -6
- package/build/lib/web/development/components/Avatar/Avatar.web.js.map +1 -1
- package/build/lib/web/development/components/Avatar/AvatarButton.js +25 -3
- package/build/lib/web/development/components/Avatar/AvatarButton.js.map +1 -1
- package/build/lib/web/development/components/BaseHeaderFooter/BaseFooter.js +2 -1
- package/build/lib/web/development/components/BaseHeaderFooter/BaseFooter.js.map +1 -1
- package/build/lib/web/development/components/BaseHeaderFooter/BaseHeader.js +4 -0
- package/build/lib/web/development/components/BaseHeaderFooter/BaseHeader.js.map +1 -1
- package/build/lib/web/development/components/BaseMenu/BaseMenuContext.js +10 -0
- package/build/lib/web/development/components/BaseMenu/BaseMenuContext.js.map +1 -0
- package/build/lib/web/development/components/BaseMenu/BaseMenuItem/BaseMenuItem.js +124 -0
- package/build/lib/web/development/components/BaseMenu/BaseMenuItem/BaseMenuItem.js.map +1 -0
- package/build/lib/web/development/components/BaseMenu/BaseMenuItem/StyledMenuItemContainer.web.js +41 -0
- package/build/lib/web/development/components/BaseMenu/BaseMenuItem/StyledMenuItemContainer.web.js.map +1 -0
- package/build/lib/web/development/components/{ActionList/styles/getBaseActionListItemStyles.js → BaseMenu/BaseMenuItem/getBaseMenuItemStyles.js} +10 -9
- package/build/lib/web/development/components/BaseMenu/BaseMenuItem/getBaseMenuItemStyles.js.map +1 -0
- package/build/lib/web/development/components/BaseMenu/index.js +3 -0
- package/build/lib/web/development/components/BaseMenu/index.js.map +1 -0
- package/build/lib/web/development/components/BaseMenu/tokens.js +8 -0
- package/build/lib/web/development/components/BaseMenu/tokens.js.map +1 -0
- package/build/lib/web/development/components/Button/BaseButton/BaseButton.js +16 -7
- package/build/lib/web/development/components/Button/BaseButton/BaseButton.js.map +1 -1
- package/build/lib/web/development/components/Button/Button/Button.js +8 -2
- package/build/lib/web/development/components/Button/Button/Button.js.map +1 -1
- package/build/lib/web/development/components/DatePicker/QuickSelection/QuickSelectionItem.web.js +6 -27
- package/build/lib/web/development/components/DatePicker/QuickSelection/QuickSelectionItem.web.js.map +1 -1
- package/build/lib/web/development/components/Dropdown/DropdownOverlay.web.js +3 -2
- package/build/lib/web/development/components/Dropdown/DropdownOverlay.web.js.map +1 -1
- package/build/lib/web/development/components/Link/BaseLink/BaseLink.js +5 -1
- package/build/lib/web/development/components/Link/BaseLink/BaseLink.js.map +1 -1
- package/build/lib/web/development/components/Link/Link/Link.js +6 -2
- package/build/lib/web/development/components/Link/Link/Link.js.map +1 -1
- package/build/lib/web/development/components/Menu/Menu.web.js +99 -0
- package/build/lib/web/development/components/Menu/Menu.web.js.map +1 -0
- package/build/lib/web/development/components/Menu/MenuItem.web.js +63 -0
- package/build/lib/web/development/components/Menu/MenuItem.web.js.map +1 -0
- package/build/lib/web/development/components/Menu/MenuOverlay.web.js +59 -0
- package/build/lib/web/development/components/Menu/MenuOverlay.web.js.map +1 -0
- package/build/lib/web/development/components/Menu/VisualSubComponents/MenuDivider.web.js +18 -0
- package/build/lib/web/development/components/Menu/VisualSubComponents/MenuDivider.web.js.map +1 -0
- package/build/lib/web/development/components/Menu/VisualSubComponents/MenuHeaderFooter.web.js +65 -0
- package/build/lib/web/development/components/Menu/VisualSubComponents/MenuHeaderFooter.web.js.map +1 -0
- package/build/lib/web/development/components/Menu/index.js +6 -0
- package/build/lib/web/development/components/Menu/index.js.map +1 -0
- package/build/lib/web/development/components/Menu/tokens.js +26 -0
- package/build/lib/web/development/components/Menu/tokens.js.map +1 -0
- package/build/lib/web/development/components/Menu/useMenu.js +178 -0
- package/build/lib/web/development/components/Menu/useMenu.js.map +1 -0
- package/build/lib/web/development/components/SideNav/SideNav.web.js +5 -2
- package/build/lib/web/development/components/SideNav/SideNav.web.js.map +1 -1
- package/build/lib/web/development/components/SideNav/index.js +1 -0
- package/build/lib/web/development/components/SideNav/index.js.map +1 -1
- package/build/lib/web/development/components/SideNav/tokens.js +3 -2
- package/build/lib/web/development/components/SideNav/tokens.js.map +1 -1
- package/build/lib/web/development/components/Tooltip/Tooltip.web.js +1 -3
- package/build/lib/web/development/components/Tooltip/Tooltip.web.js.map +1 -1
- package/build/lib/web/development/components/TopNav/TabNav/TabNav.web.js +172 -0
- package/build/lib/web/development/components/TopNav/TabNav/TabNav.web.js.map +1 -0
- package/build/lib/web/development/components/TopNav/TabNav/TabNavContext.js +18 -0
- package/build/lib/web/development/components/TopNav/TabNav/TabNavContext.js.map +1 -0
- package/build/lib/web/development/components/TopNav/TabNav/TabNavItem.web.js +198 -0
- package/build/lib/web/development/components/TopNav/TabNav/TabNavItem.web.js.map +1 -0
- package/build/lib/web/development/components/TopNav/TabNav/index.js +4 -0
- package/build/lib/web/development/components/TopNav/TabNav/index.js.map +1 -0
- package/build/lib/web/development/components/TopNav/TabNav/types.js +2 -0
- package/build/lib/web/development/components/TopNav/TabNav/types.js.map +1 -0
- package/build/lib/web/development/components/TopNav/TabNav/utils.js +48 -0
- package/build/lib/web/development/components/TopNav/TabNav/utils.js.map +1 -0
- package/build/lib/web/development/components/TopNav/TopNav.web.js +158 -0
- package/build/lib/web/development/components/TopNav/TopNav.web.js.map +1 -0
- package/build/lib/web/development/components/TopNav/TopNavContext.js +13 -0
- package/build/lib/web/development/components/TopNav/TopNavContext.js.map +1 -0
- package/build/lib/web/development/components/TopNav/index.js +3 -0
- package/build/lib/web/development/components/TopNav/index.js.map +1 -0
- package/build/lib/web/development/components/index.js +11 -0
- package/build/lib/web/development/components/index.js.map +1 -1
- package/build/lib/web/development/tokens/global/size.js +4 -0
- package/build/lib/web/development/tokens/global/size.js.map +1 -1
- package/build/lib/web/development/utils/metaAttribute/metaConstants.js +9 -0
- package/build/lib/web/development/utils/metaAttribute/metaConstants.js.map +1 -1
- package/build/lib/web/production/components/ActionList/ActionListItem.js +43 -118
- package/build/lib/web/production/components/ActionList/ActionListItem.js.map +1 -1
- package/build/lib/web/production/components/Avatar/Avatar.web.js +29 -6
- package/build/lib/web/production/components/Avatar/Avatar.web.js.map +1 -1
- package/build/lib/web/production/components/Avatar/AvatarButton.js +25 -3
- package/build/lib/web/production/components/Avatar/AvatarButton.js.map +1 -1
- package/build/lib/web/production/components/BaseHeaderFooter/BaseFooter.js +2 -1
- package/build/lib/web/production/components/BaseHeaderFooter/BaseFooter.js.map +1 -1
- package/build/lib/web/production/components/BaseHeaderFooter/BaseHeader.js +4 -0
- package/build/lib/web/production/components/BaseHeaderFooter/BaseHeader.js.map +1 -1
- package/build/lib/web/production/components/BaseMenu/BaseMenuContext.js +10 -0
- package/build/lib/web/production/components/BaseMenu/BaseMenuContext.js.map +1 -0
- package/build/lib/web/production/components/BaseMenu/BaseMenuItem/BaseMenuItem.js +124 -0
- package/build/lib/web/production/components/BaseMenu/BaseMenuItem/BaseMenuItem.js.map +1 -0
- package/build/lib/web/production/components/BaseMenu/BaseMenuItem/StyledMenuItemContainer.web.js +41 -0
- package/build/lib/web/production/components/BaseMenu/BaseMenuItem/StyledMenuItemContainer.web.js.map +1 -0
- package/build/lib/web/production/components/{ActionList/styles/getBaseActionListItemStyles.js → BaseMenu/BaseMenuItem/getBaseMenuItemStyles.js} +10 -9
- package/build/lib/web/production/components/BaseMenu/BaseMenuItem/getBaseMenuItemStyles.js.map +1 -0
- package/build/lib/web/production/components/BaseMenu/index.js +3 -0
- package/build/lib/web/production/components/BaseMenu/index.js.map +1 -0
- package/build/lib/web/production/components/BaseMenu/tokens.js +8 -0
- package/build/lib/web/production/components/BaseMenu/tokens.js.map +1 -0
- package/build/lib/web/production/components/Button/BaseButton/BaseButton.js +16 -7
- package/build/lib/web/production/components/Button/BaseButton/BaseButton.js.map +1 -1
- package/build/lib/web/production/components/Button/Button/Button.js +8 -2
- package/build/lib/web/production/components/Button/Button/Button.js.map +1 -1
- package/build/lib/web/production/components/DatePicker/QuickSelection/QuickSelectionItem.web.js +6 -27
- package/build/lib/web/production/components/DatePicker/QuickSelection/QuickSelectionItem.web.js.map +1 -1
- package/build/lib/web/production/components/Dropdown/DropdownOverlay.web.js +3 -2
- package/build/lib/web/production/components/Dropdown/DropdownOverlay.web.js.map +1 -1
- package/build/lib/web/production/components/Link/BaseLink/BaseLink.js +5 -1
- package/build/lib/web/production/components/Link/BaseLink/BaseLink.js.map +1 -1
- package/build/lib/web/production/components/Link/Link/Link.js +6 -2
- package/build/lib/web/production/components/Link/Link/Link.js.map +1 -1
- package/build/lib/web/production/components/Menu/Menu.web.js +99 -0
- package/build/lib/web/production/components/Menu/Menu.web.js.map +1 -0
- package/build/lib/web/production/components/Menu/MenuItem.web.js +63 -0
- package/build/lib/web/production/components/Menu/MenuItem.web.js.map +1 -0
- package/build/lib/web/production/components/Menu/MenuOverlay.web.js +59 -0
- package/build/lib/web/production/components/Menu/MenuOverlay.web.js.map +1 -0
- package/build/lib/web/production/components/Menu/VisualSubComponents/MenuDivider.web.js +18 -0
- package/build/lib/web/production/components/Menu/VisualSubComponents/MenuDivider.web.js.map +1 -0
- package/build/lib/web/production/components/Menu/VisualSubComponents/MenuHeaderFooter.web.js +65 -0
- package/build/lib/web/production/components/Menu/VisualSubComponents/MenuHeaderFooter.web.js.map +1 -0
- package/build/lib/web/production/components/Menu/index.js +6 -0
- package/build/lib/web/production/components/Menu/index.js.map +1 -0
- package/build/lib/web/production/components/Menu/tokens.js +26 -0
- package/build/lib/web/production/components/Menu/tokens.js.map +1 -0
- package/build/lib/web/production/components/Menu/useMenu.js +178 -0
- package/build/lib/web/production/components/Menu/useMenu.js.map +1 -0
- package/build/lib/web/production/components/SideNav/SideNav.web.js +5 -2
- package/build/lib/web/production/components/SideNav/SideNav.web.js.map +1 -1
- package/build/lib/web/production/components/SideNav/index.js +1 -0
- package/build/lib/web/production/components/SideNav/index.js.map +1 -1
- package/build/lib/web/production/components/SideNav/tokens.js +3 -2
- package/build/lib/web/production/components/SideNav/tokens.js.map +1 -1
- package/build/lib/web/production/components/Tooltip/Tooltip.web.js +1 -3
- package/build/lib/web/production/components/Tooltip/Tooltip.web.js.map +1 -1
- package/build/lib/web/production/components/TopNav/TabNav/TabNav.web.js +172 -0
- package/build/lib/web/production/components/TopNav/TabNav/TabNav.web.js.map +1 -0
- package/build/lib/web/production/components/TopNav/TabNav/TabNavContext.js +18 -0
- package/build/lib/web/production/components/TopNav/TabNav/TabNavContext.js.map +1 -0
- package/build/lib/web/production/components/TopNav/TabNav/TabNavItem.web.js +198 -0
- package/build/lib/web/production/components/TopNav/TabNav/TabNavItem.web.js.map +1 -0
- package/build/lib/web/production/components/TopNav/TabNav/index.js +4 -0
- package/build/lib/web/production/components/TopNav/TabNav/index.js.map +1 -0
- package/build/lib/web/production/components/TopNav/TabNav/types.js +2 -0
- package/build/lib/web/production/components/TopNav/TabNav/types.js.map +1 -0
- package/build/lib/web/production/components/TopNav/TabNav/utils.js +48 -0
- package/build/lib/web/production/components/TopNav/TabNav/utils.js.map +1 -0
- package/build/lib/web/production/components/TopNav/TopNav.web.js +158 -0
- package/build/lib/web/production/components/TopNav/TopNav.web.js.map +1 -0
- package/build/lib/web/production/components/TopNav/TopNavContext.js +13 -0
- package/build/lib/web/production/components/TopNav/TopNavContext.js.map +1 -0
- package/build/lib/web/production/components/TopNav/index.js +3 -0
- package/build/lib/web/production/components/TopNav/index.js.map +1 -0
- package/build/lib/web/production/components/index.js +11 -0
- package/build/lib/web/production/components/index.js.map +1 -1
- package/build/lib/web/production/tokens/global/size.js +4 -0
- package/build/lib/web/production/tokens/global/size.js.map +1 -1
- package/build/lib/web/production/utils/metaAttribute/metaConstants.js +9 -0
- package/build/lib/web/production/utils/metaAttribute/metaConstants.js.map +1 -1
- package/build/types/components/index.d.ts +883 -3
- package/build/types/components/index.native.d.ts +253 -2
- package/build/types/tokens/index.d.ts +4 -0
- package/build/types/tokens/index.native.d.ts +4 -0
- package/package.json +1 -1
- package/build/lib/native/components/ActionList/styles/StyledActionListItem.native.js +0 -8
- package/build/lib/native/components/ActionList/styles/StyledActionListItem.native.js.map +0 -1
- package/build/lib/native/components/ActionList/styles/getBaseActionListItemStyles.js +0 -11
- package/build/lib/native/components/ActionList/styles/getBaseActionListItemStyles.js.map +0 -1
- package/build/lib/web/development/components/ActionList/styles/StyledActionListItem.web.js +0 -33
- package/build/lib/web/development/components/ActionList/styles/StyledActionListItem.web.js.map +0 -1
- package/build/lib/web/development/components/ActionList/styles/getBaseActionListItemStyles.js.map +0 -1
- package/build/lib/web/production/components/ActionList/styles/StyledActionListItem.web.js +0 -33
- package/build/lib/web/production/components/ActionList/styles/StyledActionListItem.web.js.map +0 -1
- package/build/lib/web/production/components/ActionList/styles/getBaseActionListItemStyles.js.map +0 -1
|
@@ -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 { StyledActionListItem } from './styles/StyledActionListItem';\nimport { componentIds } from './componentIds';\nimport type { StyledActionListItemProps } from './styles/getBaseActionListItemStyles';\nimport { validateActionListItemProps, getNormalTextColor } from './actionListUtils';\nimport { getActionListItemRole, getActionListSectionRole, isRoleMenu } 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 { Checkbox } from '~components/Checkbox';\nimport { size } from '~tokens/global';\nimport type { DropdownProps } from '~components/Dropdown';\nimport type { StringChildrenType, TestID } from '~utils/types';\nimport { useTheme } from '~components/BladeProvider';\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';\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 ActionListItemContext = React.createContext<{\n intent?: ActionListItemProps['intent'];\n isDisabled?: ActionListItemProps['isDisabled'];\n}>({});\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 { intent, isDisabled } = React.useContext(ActionListItemContext);\n const iconState = isDisabled ? 'disabled' : 'muted';\n return (\n <Icon\n color={\n intent === '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 } = React.useContext(ActionListItemContext);\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?: StyledActionListItemProps['onPress']; 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\nconst _ActionListItemBody = ({\n selectionType,\n intent,\n description,\n isDisabled,\n leading,\n trailing,\n title,\n titleSuffix,\n isSelected,\n}: Pick<\n ActionListItemProps,\n 'intent' | 'isDisabled' | 'description' | 'trailing' | 'leading' | 'title' | 'titleSuffix'\n> & {\n selectionType: DropdownProps['selectionType'];\n isSelected?: boolean;\n}): React.ReactElement => {\n return (\n <>\n <BaseBox\n display=\"flex\"\n justifyContent=\"center\"\n flexDirection=\"row\"\n alignItems=\"center\"\n maxHeight={isReactNative() ? undefined : makeSize(size[20])}\n >\n <BaseBox display=\"flex\" justifyContent=\"center\" alignItems=\"center\">\n {selectionType === 'multiple' ? (\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 <BaseBox\n pointerEvents=\"none\"\n paddingRight=\"spacing.2\"\n {...makeAccessible({\n hidden: true,\n })}\n >\n <Checkbox isChecked={isSelected} tabIndex={-1} isDisabled={isDisabled}>\n {/* \n Checkbox requires children. Didn't want to make it optional because its helpful for consumers\n But for this case in particular, we just want to use Text separately so that we can control spacing and color and keep it consistent with non-multiselect dropdowns\n */}\n {null}\n </Checkbox>\n </BaseBox>\n ) : (\n leading\n )}\n </BaseBox>\n <BaseBox\n paddingLeft={selectionType === 'multiple' || !leading ? 'spacing.0' : 'spacing.3'}\n paddingRight=\"spacing.3\"\n display=\"flex\"\n alignItems=\"center\"\n flexDirection=\"row\"\n >\n <Text\n truncateAfterLines={1}\n color={\n intent === 'negative'\n ? 'feedback.text.negative.intense'\n : getNormalTextColor(isDisabled)\n }\n >\n {title}\n </Text>\n {titleSuffix}\n </BaseBox>\n <BaseBox marginLeft=\"auto\">{trailing}</BaseBox>\n </BaseBox>\n <BaseBox paddingLeft={leading || selectionType === 'multiple' ? 'spacing.7' : undefined}>\n {description ? (\n <Text color={getNormalTextColor(isDisabled, { isMuted: true })} size=\"small\">\n {description}\n </Text>\n ) : null}\n </BaseBox>\n </>\n );\n};\n\nconst ActionListItemBody = React.memo(_ActionListItemBody);\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 { platform } = useTheme();\n const isMobile = platform === 'onMobile';\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 <ActionListItemContext.Provider value={{ intent: props.intent, isDisabled: props.isDisabled }}>\n <StyledActionListItem\n isVisible={hasAutoComplete && filteredValues ? filteredValues.includes(props.value) : true}\n as={!isReactNative() ? renderOnWebAs : undefined}\n id={`${dropdownBaseId}-${props._index}`}\n type=\"button\"\n tabIndex={-1}\n href={props.href}\n target={props.target}\n className={activeIndex === props._index ? 'active-focus' : ''}\n {...makeAccessible({\n selected: isSelected,\n current: isRoleMenu(dropdownTriggerer) ? isSelected : undefined,\n role: getActionListItemRole(dropdownTriggerer, props.href),\n disabled: props.isDisabled,\n })}\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 // Custom props for changes in styles\n selectionType={selectionType}\n hasDescription={Boolean(props.description)}\n intent={props.intent}\n isSelected={isSelected}\n isKeydownPressed={isKeydownPressed}\n isMobile={isMobile}\n >\n <ActionListItemBody\n selectionType={selectionType}\n intent={props.intent}\n description={props.description}\n isDisabled={props.isDisabled}\n leading={props.leading}\n trailing={props.trailing}\n title={props.title}\n titleSuffix={props.titleSuffix}\n isSelected={isSelected}\n />\n </StyledActionListItem>\n </ActionListItemContext.Provider>\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":["ActionListItemContext","React","createContext","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","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","_React$useContext","useContext","intent","isDisabled","iconState","concat","ActionListItemIcon","_ActionListItemBadgeGroup","_ref3","Box","display","alignItems","flexDirection","ActionListItemBadgeGroup","_ActionListItemBadge","Badge","marginLeft","ActionListItemBadge","_ActionListItemText","_ref4","_React$useContext2","variant","getNormalTextColor","isMuted","ActionListItemText","makeActionListItemClickable","clickHandler","onPress","onClick","_ActionListItemBody","_ref5","selectionType","description","leading","trailing","titleSuffix","isSelected","_Fragment","justifyContent","maxHeight","pointerEvents","paddingRight","Checkbox","isChecked","tabIndex","paddingLeft","truncateAfterLines","ActionListItemBody","memo","_ActionListItem","_useDropdown2","activeIndex","dropdownBaseId","onOptionClick","selectedIndices","setShouldIgnoreBlurAnimation","isKeydownPressed","_useTheme","useTheme","platform","isMobile","renderOnWebAs","href","getIsSelected","SelectInput","_index","useEffect","validateActionListItemProps","throwBladeError","message","moduleName","Provider","value","StyledActionListItem","isVisible","as","id","type","target","className","selected","current","isRoleMenu","getActionListItemRole","disabled","e","_props$onClick","call","event","castWebType","ActionListItem","onMouseDown","onMouseUp","hasDescription"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4FA,IAAMA,qBAAqB,gBAAGC,cAAK,CAACC,aAAa,CAG9C,EAAE,CAAC,CAAA;AAEN,IAAMC,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,I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AAA,QAAQ,EAAEA,QAAS;MAAA9G,QAAA,eAEnBkC,GAAA,CAAC+D,kBAAkB,EAAA;AACjBhB,QAAAA,aAAa,EAAEA,aAAc;QAC7B7B,MAAM,EAAE5D,KAAK,CAAC4D,MAAO;QACrB8B,WAAW,EAAE1F,KAAK,CAAC0F,WAAY;QAC/B7B,UAAU,EAAE7D,KAAK,CAAC6D,UAAW;QAC7B8B,OAAO,EAAE3F,KAAK,CAAC2F,OAAQ;QACvBC,QAAQ,EAAE5F,KAAK,CAAC4F,QAAS;QACzBrF,KAAK,EAAEP,KAAK,CAACO,KAAM;QACnBsF,WAAW,EAAE7F,KAAK,CAAC6F,WAAY;AAC/BC,QAAAA,UAAU,EAAEA,UAAAA;OACb,CAAA;KACmB,CAAA,CAAA;AAAC,GACO,CAAC,CAAA;AAErC,CAAC,CAAA;AAEKsD,IAAAA,cAAc,gBAAGhG,wBAAwB,eAAC5D,cAAK,CAACkH,IAAI,CAACC,eAAe,CAAC,EAAE;EAC3E5G,WAAW,EAAEsD,YAAY,CAAC+F,cAAc;EACxCtJ,WAAW,EAAEuD,YAAY,CAAC+F,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';\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwF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AAAA,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,6 +1,6 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
2
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
3
|
-
import 'react';
|
|
3
|
+
import React__default from 'react';
|
|
4
4
|
import { StyledAvatar } from './StyledAvatar.js';
|
|
5
5
|
import { useAvatarGroupContext } from './AvatarGroupContext.js';
|
|
6
6
|
import { AvatarButton } from './AvatarButton.js';
|
|
@@ -17,7 +17,7 @@ import { MetaConstants } from '../../utils/metaAttribute/metaConstants.js';
|
|
|
17
17
|
import { getStyledProps } from '../Box/styledProps/getStyledProps.js';
|
|
18
18
|
import { assignWithoutSideEffects } from '../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
|
|
19
19
|
|
|
20
|
-
var _excluded = ["name", "color", "size", "variant", "icon", "href", "target", "rel", "src", "alt", "srcSet", "crossOrigin", "referrerPolicy", "testID"];
|
|
20
|
+
var _excluded = ["name", "color", "size", "variant", "icon", "href", "target", "rel", "src", "alt", "srcSet", "crossOrigin", "referrerPolicy", "testID", "onBlur", "onFocus", "onClick", "onMouseLeave", "onMouseMove", "onMouseDown", "onPointerDown", "onPointerEnter", "onTouchStart", "onTouchEnd"];
|
|
21
21
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
22
22
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
23
23
|
var getInitials = function getInitials(name) {
|
|
@@ -28,7 +28,7 @@ var getInitials = function getInitials(name) {
|
|
|
28
28
|
}
|
|
29
29
|
return names[0][0] + names[names.length - 1][0];
|
|
30
30
|
};
|
|
31
|
-
var _Avatar = function _Avatar(_ref) {
|
|
31
|
+
var _Avatar = function _Avatar(_ref, ref) {
|
|
32
32
|
var _groupProps$size;
|
|
33
33
|
var name = _ref.name,
|
|
34
34
|
_ref$color = _ref.color,
|
|
@@ -47,6 +47,16 @@ var _Avatar = function _Avatar(_ref) {
|
|
|
47
47
|
crossOrigin = _ref.crossOrigin,
|
|
48
48
|
referrerPolicy = _ref.referrerPolicy,
|
|
49
49
|
testID = _ref.testID,
|
|
50
|
+
onBlur = _ref.onBlur,
|
|
51
|
+
onFocus = _ref.onFocus,
|
|
52
|
+
onClick = _ref.onClick,
|
|
53
|
+
onMouseLeave = _ref.onMouseLeave,
|
|
54
|
+
onMouseMove = _ref.onMouseMove,
|
|
55
|
+
onMouseDown = _ref.onMouseDown,
|
|
56
|
+
onPointerDown = _ref.onPointerDown,
|
|
57
|
+
onPointerEnter = _ref.onPointerEnter,
|
|
58
|
+
onTouchStart = _ref.onTouchStart,
|
|
59
|
+
onTouchEnd = _ref.onTouchEnd,
|
|
50
60
|
styledProps = _objectWithoutProperties(_ref, _excluded);
|
|
51
61
|
if (true) {
|
|
52
62
|
if (src && !alt && !name) {
|
|
@@ -64,11 +74,22 @@ var _Avatar = function _Avatar(_ref) {
|
|
|
64
74
|
size: avatarSize,
|
|
65
75
|
href: href,
|
|
66
76
|
target: target,
|
|
67
|
-
rel: rel
|
|
77
|
+
rel: rel,
|
|
78
|
+
onBlur: onBlur,
|
|
79
|
+
onFocus: onFocus,
|
|
80
|
+
onClick: onClick,
|
|
81
|
+
onMouseLeave: onMouseLeave,
|
|
82
|
+
onMouseMove: onMouseMove,
|
|
83
|
+
onMouseDown: onMouseDown,
|
|
84
|
+
onPointerDown: onPointerDown,
|
|
85
|
+
onPointerEnter: onPointerEnter,
|
|
86
|
+
onTouchStart: onTouchStart,
|
|
87
|
+
onTouchEnd: onTouchEnd
|
|
68
88
|
};
|
|
69
89
|
var getChildrenToRender = function getChildrenToRender() {
|
|
70
90
|
if (src) {
|
|
71
91
|
return /*#__PURE__*/jsx(AvatarButton, _objectSpread(_objectSpread({}, commonButtonProps), {}, {
|
|
92
|
+
ref: ref,
|
|
72
93
|
imgProps: {
|
|
73
94
|
src: src,
|
|
74
95
|
alt: alt !== null && alt !== void 0 ? alt : name,
|
|
@@ -79,7 +100,9 @@ var _Avatar = function _Avatar(_ref) {
|
|
|
79
100
|
}));
|
|
80
101
|
}
|
|
81
102
|
if (name && !src) {
|
|
82
|
-
return /*#__PURE__*/jsx(AvatarButton, _objectSpread(_objectSpread({
|
|
103
|
+
return /*#__PURE__*/jsx(AvatarButton, _objectSpread(_objectSpread({
|
|
104
|
+
ref: ref
|
|
105
|
+
}, commonButtonProps), {}, {
|
|
83
106
|
children: getInitials(name)
|
|
84
107
|
}));
|
|
85
108
|
}
|
|
@@ -116,7 +139,7 @@ var _Avatar = function _Avatar(_ref) {
|
|
|
116
139
|
* Checkout {@link https://blade.razorpay.com/?path=/docs/components-avatar-avatar Avatar Documentation}
|
|
117
140
|
*
|
|
118
141
|
*/
|
|
119
|
-
var Avatar = /*#__PURE__*/assignWithoutSideEffects(_Avatar, {
|
|
142
|
+
var Avatar = /*#__PURE__*/assignWithoutSideEffects( /*#__PURE__*/React__default.forwardRef(_Avatar), {
|
|
120
143
|
displayName: 'Avatar',
|
|
121
144
|
componentId: 'Avatar'
|
|
122
145
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.web.js","sources":["../../../../../../src/components/Avatar/Avatar.web.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\nimport React from 'react';\nimport type { AvatarProps } from './types';\nimport { StyledAvatar } from './StyledAvatar';\nimport { useAvatarGroupContext } from './AvatarGroupContext';\nimport { AvatarButton } from './AvatarButton';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { throwBladeError } from '~utils/logger';\nimport { UserIcon } from '~components/Icons';\n\nconst getInitials = (name: string): string => {\n // Combine first and last name initials\n const names = name.trim().toUpperCase().split(' ');\n\n if (names.length === 1) {\n return names[0].substring(0, 2);\n }\n return names[0][0] + names[names.length - 1][0];\n};\n\nconst _Avatar = ({\n
|
|
1
|
+
{"version":3,"file":"Avatar.web.js","sources":["../../../../../../src/components/Avatar/Avatar.web.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\nimport React from 'react';\nimport type { AvatarProps } from './types';\nimport { StyledAvatar } from './StyledAvatar';\nimport { useAvatarGroupContext } from './AvatarGroupContext';\nimport { AvatarButton } from './AvatarButton';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { throwBladeError } from '~utils/logger';\nimport { UserIcon } from '~components/Icons';\nimport type { BladeElementRef } from '~utils/types';\n\nconst getInitials = (name: string): string => {\n // Combine first and last name initials\n const names = name.trim().toUpperCase().split(' ');\n\n if (names.length === 1) {\n return names[0].substring(0, 2);\n }\n return names[0][0] + names[names.length - 1][0];\n};\n\nconst _Avatar: React.ForwardRefRenderFunction<BladeElementRef, AvatarProps> = (\n {\n name,\n color = 'neutral',\n size = 'medium',\n variant = 'circle',\n icon,\n href,\n target,\n rel,\n // Image Props\n src,\n alt,\n srcSet,\n crossOrigin,\n referrerPolicy,\n testID,\n // interaction props\n onBlur,\n onFocus,\n onClick,\n onMouseLeave,\n onMouseMove,\n onMouseDown,\n onPointerDown,\n onPointerEnter,\n onTouchStart,\n onTouchEnd,\n ...styledProps\n },\n ref,\n): ReactElement => {\n if (__DEV__) {\n if (src && !alt && !name) {\n throwBladeError({\n moduleName: 'Avatar',\n message: '\"alt\" or \"name\" prop is required when the \"src\" prop is provided.',\n });\n }\n }\n\n const groupProps = useAvatarGroupContext();\n const avatarSize = groupProps?.size ?? size;\n\n const commonButtonProps = {\n variant,\n color,\n size: avatarSize,\n href,\n target,\n rel,\n onBlur,\n onFocus,\n onClick,\n onMouseLeave,\n onMouseMove,\n onMouseDown,\n onPointerDown,\n onPointerEnter,\n onTouchStart,\n onTouchEnd,\n };\n\n const getChildrenToRender = (): React.ReactElement => {\n if (src) {\n return (\n <AvatarButton\n {...commonButtonProps}\n ref={ref as never}\n imgProps={{\n src,\n alt: alt ?? name,\n srcSet,\n crossOrigin,\n referrerPolicy,\n }}\n />\n );\n }\n\n if (name && !src) {\n return (\n <AvatarButton ref={ref as never} {...commonButtonProps}>\n {getInitials(name)}\n </AvatarButton>\n );\n }\n\n return <AvatarButton {...commonButtonProps} icon={icon ?? UserIcon} />;\n };\n\n return (\n <StyledAvatar\n {...metaAttribute({ name: MetaConstants.Avatar, testID })}\n {...getStyledProps(styledProps)}\n backgroundColor=\"surface.background.gray.intense\"\n variant={variant}\n size={avatarSize}\n >\n {getChildrenToRender()}\n </StyledAvatar>\n );\n};\n\n/**\n * ### Avatar Component\n * \n * An avatar component is a standardized visual representation of a user or entity.\n * \n * ---\n * \n * #### Usage\n * \n * ```jsx\n <Avatar name=\"Nitin Kumar\" src=\"https://avatars.githubusercontent.com/u/46647141?v=4\" /> \n * ```\n *\n * ---\n *\n * Checkout {@link https://blade.razorpay.com/?path=/docs/components-avatar-avatar Avatar Documentation}\n * \n */\nconst Avatar = assignWithoutSideEffects(React.forwardRef(_Avatar), {\n displayName: 'Avatar',\n componentId: 'Avatar',\n});\n\nexport { Avatar };\nexport type { AvatarProps };\n"],"names":["getInitials","name","names","trim","toUpperCase","split","length","substring","_Avatar","_ref","ref","_groupProps$size","_ref$color","color","_ref$size","size","_ref$variant","variant","icon","href","target","rel","src","alt","srcSet","crossOrigin","referrerPolicy","testID","onBlur","onFocus","onClick","onMouseLeave","onMouseMove","onMouseDown","onPointerDown","onPointerEnter","onTouchStart","onTouchEnd","styledProps","_objectWithoutProperties","_excluded","throwBladeError","moduleName","message","groupProps","useAvatarGroupContext","avatarSize","commonButtonProps","getChildrenToRender","_jsx","AvatarButton","_objectSpread","imgProps","children","UserIcon","StyledAvatar","metaAttribute","MetaConstants","Avatar","getStyledProps","backgroundColor","assignWithoutSideEffects","React","forwardRef","displayName","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAaA,IAAMA,WAAW,GAAG,SAAdA,WAAWA,CAAIC,IAAY,EAAa;AAC5C;AACA,EAAA,IAAMC,KAAK,GAAGD,IAAI,CAACE,IAAI,EAAE,CAACC,WAAW,EAAE,CAACC,KAAK,CAAC,GAAG,CAAC,CAAA;AAElD,EAAA,IAAIH,KAAK,CAACI,MAAM,KAAK,CAAC,EAAE;IACtB,OAAOJ,KAAK,CAAC,CAAC,CAAC,CAACK,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;AACjC,GAAA;AACA,EAAA,OAAOL,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAGA,KAAK,CAACA,KAAK,CAACI,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AACjD,CAAC,CAAA;AAED,IAAME,OAAqE,GAAG,SAAxEA,OAAqEA,CAAAC,IAAA,EA8BzEC,GAAG,EACc;AAAA,EAAA,IAAAC,gBAAA,CAAA;AAAA,EAAA,IA7BfV,IAAI,GAAAQ,IAAA,CAAJR,IAAI;IAAAW,UAAA,GAAAH,IAAA,CACJI,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A,OAAQ;AACjBF,IAAAA,IAAI,EAAE+B,UAAW;IAAAO,QAAA,EAEhBL,mBAAmB,EAAC;AAAC,GAAA,CACV,CAAC,CAAA;AAEnB,CAAC,CAAA;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACMU,IAAAA,MAAM,gBAAGG,wBAAwB,eAACC,cAAK,CAACC,UAAU,CAACvD,OAAO,CAAC,EAAE;AACjEwD,EAAAA,WAAW,EAAE,QAAQ;AACrBC,EAAAA,WAAW,EAAE,QAAA;AACf,CAAC;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
-
import 'react';
|
|
2
|
+
import React__default from 'react';
|
|
3
3
|
import { StyledAvatarButton } from './StyledAvatarButton.js';
|
|
4
4
|
import { avatarIconSizeTokens, avatarTextSizeMapping } from './avatarTokens.js';
|
|
5
5
|
import '../Box/BaseBox/index.js';
|
|
@@ -14,7 +14,7 @@ import { Text } from '../Typography/Text/Text.js';
|
|
|
14
14
|
|
|
15
15
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
16
16
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
17
|
-
var
|
|
17
|
+
var _AvatarButton = function _AvatarButton(_ref, ref) {
|
|
18
18
|
var href = _ref.href,
|
|
19
19
|
target = _ref.target,
|
|
20
20
|
rel = _ref.rel,
|
|
@@ -26,7 +26,17 @@ var AvatarButton = function AvatarButton(_ref) {
|
|
|
26
26
|
size = _ref$size === void 0 ? 'medium' : _ref$size,
|
|
27
27
|
Icon = _ref.icon,
|
|
28
28
|
imgProps = _ref.imgProps,
|
|
29
|
-
children = _ref.children
|
|
29
|
+
children = _ref.children,
|
|
30
|
+
onBlur = _ref.onBlur,
|
|
31
|
+
onFocus = _ref.onFocus,
|
|
32
|
+
onClick = _ref.onClick,
|
|
33
|
+
onMouseLeave = _ref.onMouseLeave,
|
|
34
|
+
onMouseMove = _ref.onMouseMove,
|
|
35
|
+
onMouseDown = _ref.onMouseDown,
|
|
36
|
+
onPointerDown = _ref.onPointerDown,
|
|
37
|
+
onPointerEnter = _ref.onPointerEnter,
|
|
38
|
+
onTouchStart = _ref.onTouchStart,
|
|
39
|
+
onTouchEnd = _ref.onTouchEnd;
|
|
30
40
|
var isLink = Boolean(href);
|
|
31
41
|
var defaultRel = target === '_blank' ? 'noreferrer noopener' : undefined;
|
|
32
42
|
var iconColor = getTextColorToken({
|
|
@@ -42,6 +52,7 @@ var AvatarButton = function AvatarButton(_ref) {
|
|
|
42
52
|
state: 'default'
|
|
43
53
|
});
|
|
44
54
|
return /*#__PURE__*/jsx(StyledAvatarButton, {
|
|
55
|
+
ref: ref,
|
|
45
56
|
as: href ? 'a' : 'button',
|
|
46
57
|
size: size,
|
|
47
58
|
color: color,
|
|
@@ -52,6 +63,16 @@ var AvatarButton = function AvatarButton(_ref) {
|
|
|
52
63
|
accessibilityProps: _objectSpread({}, makeAccessible({
|
|
53
64
|
role: isLink ? 'link' : 'button'
|
|
54
65
|
})),
|
|
66
|
+
onBlur: onBlur,
|
|
67
|
+
onFocus: onFocus,
|
|
68
|
+
onClick: onClick,
|
|
69
|
+
onMouseLeave: onMouseLeave,
|
|
70
|
+
onMouseMove: onMouseMove,
|
|
71
|
+
onMouseDown: onMouseDown,
|
|
72
|
+
onPointerDown: onPointerDown,
|
|
73
|
+
onPointerEnter: onPointerEnter,
|
|
74
|
+
onTouchStart: onTouchStart,
|
|
75
|
+
onTouchEnd: onTouchEnd,
|
|
55
76
|
children: /*#__PURE__*/jsxs(BaseBox, {
|
|
56
77
|
display: "flex",
|
|
57
78
|
flexDirection: "row",
|
|
@@ -81,6 +102,7 @@ var AvatarButton = function AvatarButton(_ref) {
|
|
|
81
102
|
})
|
|
82
103
|
});
|
|
83
104
|
};
|
|
105
|
+
var AvatarButton = /*#__PURE__*/React__default.forwardRef(_AvatarButton);
|
|
84
106
|
|
|
85
107
|
export { AvatarButton };
|
|
86
108
|
//# sourceMappingURL=AvatarButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AvatarButton.js","sources":["../../../../../../src/components/Avatar/AvatarButton.tsx"],"sourcesContent":["import React from 'react';\nimport { StyledAvatarButton } from './StyledAvatarButton';\nimport type { AvatarButtonProps } from './types';\nimport { avatarTextSizeMapping, avatarIconSizeTokens } from './avatarTokens';\nimport BaseBox from '~components/Box/BaseBox';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { Heading, Text } from '~components/Typography';\nimport { getTextColorToken } from '~components/Button/BaseButton/BaseButton';\nimport type { IconColor } from '~components/Button/BaseButton/types';\nimport type { BaseTextProps } from '~components/Typography/BaseText/types';\n\nconst
|
|
1
|
+
{"version":3,"file":"AvatarButton.js","sources":["../../../../../../src/components/Avatar/AvatarButton.tsx"],"sourcesContent":["import React from 'react';\nimport { StyledAvatarButton } from './StyledAvatarButton';\nimport type { AvatarButtonProps } from './types';\nimport { avatarTextSizeMapping, avatarIconSizeTokens } from './avatarTokens';\nimport BaseBox from '~components/Box/BaseBox';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { Heading, Text } from '~components/Typography';\nimport { getTextColorToken } from '~components/Button/BaseButton/BaseButton';\nimport type { IconColor } from '~components/Button/BaseButton/types';\nimport type { BaseTextProps } from '~components/Typography/BaseText/types';\nimport type { BladeElementRef } from '~utils/types';\n\nconst _AvatarButton: React.ForwardRefRenderFunction<BladeElementRef, AvatarButtonProps> = (\n {\n href,\n target,\n rel,\n variant = 'circle',\n color = 'neutral',\n size = 'medium',\n icon: Icon,\n imgProps,\n children,\n onBlur,\n onFocus,\n onClick,\n onMouseLeave,\n onMouseMove,\n onMouseDown,\n onPointerDown,\n onPointerEnter,\n onTouchStart,\n onTouchEnd,\n },\n ref,\n): React.ReactElement => {\n const isLink = Boolean(href);\n const defaultRel = target === '_blank' ? 'noreferrer noopener' : undefined;\n const iconColor = getTextColorToken({\n property: 'icon',\n variant: 'secondary',\n color,\n state: 'default',\n }) as IconColor;\n const textColor = getTextColorToken({\n property: 'text',\n variant: 'secondary',\n color,\n state: 'default',\n }) as BaseTextProps['color'];\n\n return (\n <StyledAvatarButton\n ref={ref as never}\n as={href ? 'a' : 'button'}\n size={size}\n color={color}\n href={href}\n variant={variant}\n target={target}\n rel={rel ?? defaultRel}\n accessibilityProps={{\n ...makeAccessible({\n role: isLink ? 'link' : 'button',\n }),\n }}\n onBlur={onBlur}\n onFocus={onFocus}\n onClick={onClick}\n onMouseLeave={onMouseLeave}\n onMouseMove={onMouseMove}\n onMouseDown={onMouseDown}\n onPointerDown={onPointerDown}\n onPointerEnter={onPointerEnter}\n onTouchStart={onTouchStart}\n onTouchEnd={onTouchEnd}\n >\n <BaseBox\n display=\"flex\"\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent=\"center\"\n zIndex={1}\n height=\"100%\"\n >\n {Icon ? (\n <BaseBox display=\"flex\" justifyContent=\"center\" alignItems=\"center\">\n <Icon size={avatarIconSizeTokens[size]} color={iconColor} />\n </BaseBox>\n ) : null}\n\n {/* eslint-disable-next-line jsx-a11y/alt-text -- alt text is provided in imgProps */}\n {imgProps?.src ? <img {...imgProps} /> : null}\n\n {size === 'xlarge' ? (\n <Heading size={avatarTextSizeMapping[size]} weight=\"semibold\" color={textColor}>\n {children}\n </Heading>\n ) : (\n <Text size={avatarTextSizeMapping[size]} weight=\"semibold\" color={textColor}>\n {children}\n </Text>\n )}\n </BaseBox>\n </StyledAvatarButton>\n );\n};\n\nconst AvatarButton = React.forwardRef(_AvatarButton);\n\nexport { AvatarButton };\n"],"names":["_AvatarButton","_ref","ref","href","target","rel","_ref$variant","variant","_ref$color","color","_ref$size","size","Icon","icon","imgProps","children","onBlur","onFocus","onClick","onMouseLeave","onMouseMove","onMouseDown","onPointerDown","onPointerEnter","onTouchStart","onTouchEnd","isLink","Boolean","defaultRel","undefined","iconColor","getTextColorToken","property","state","textColor","_jsx","StyledAvatarButton","as","accessibilityProps","_objectSpread","makeAccessible","role","_jsxs","BaseBox","display","flexDirection","alignItems","justifyContent","zIndex","height","avatarIconSizeTokens","src","Heading","avatarTextSizeMapping","weight","Text","AvatarButton","React","forwardRef"],"mappings":";;;;;;;;;;;;;;;;AAYA,IAAMA,aAAiF,GAAG,SAApFA,aAAiFA,CAAAC,IAAA,EAsBrFC,GAAG,EACoB;AAAA,EAAA,IArBrBC,IAAI,GAAAF,IAAA,CAAJE,IAAI;IACJC,MAAM,GAAAH,IAAA,CAANG,MAAM;IACNC,GAAG,GAAAJ,IAAA,CAAHI,GAAG;IAAAC,YAAA,GAAAL,IAAA,CACHM,OAAO;AAAPA,IAAAA,OAAO,GAAAD,YAAA,KAAG,KAAA,CAAA,GAAA,QAAQ,GAAAA,YAAA;IAAAE,UAAA,GAAAP,IAAA,CAClBQ,KAAK;AAALA,IAAAA,KAAK,GAAAD,UAAA,KAAG,KAAA,CAAA,GAAA,SAAS,GAAAA,UAAA;IAAAE,SAAA,GAAAT,IAAA,CACjBU,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAG,KAAA,CAAA,GAAA,QAAQ,GAAAA,SAAA;IACTE,IAAI,GAAAX,IAAA,CAAVY,IAAI;IACJC,QAAQ,GAAAb,IAAA,CAARa,QAAQ;IACRC,QAAQ,GAAAd,IAAA,CAARc,QAAQ;IACRC,MAAM,GAAAf,IAAA,CAANe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AAA,CAAA,IAARA,QAAQ,CAAEqC,GAAG,gBAAGhB,GAAA,CAAA,KAAA,EAAAI,aAAA,CAAA,EAAA,EAASzB,QAAQ,CAAG,CAAC,GAAG,IAAI,EAE5CH,IAAI,KAAK,QAAQ,gBAChBwB,GAAA,CAACiB,OAAO,EAAA;AAACzC,QAAAA,IAAI,EAAE0C,qBAAqB,CAAC1C,IAAI,CAAE;AAAC2C,QAAAA,MAAM,EAAC,UAAU;AAAC7C,QAAAA,KAAK,EAAEyB,SAAU;AAAAnB,QAAAA,QAAA,EAC5EA,QAAAA;AAAQ,OACF,CAAC,gBAEVoB,GAAA,CAACoB,IAAI,EAAA;AAAC5C,QAAAA,IAAI,EAAE0C,qBAAqB,CAAC1C,IAAI,CAAE;AAAC2C,QAAAA,MAAM,EAAC,UAAU;AAAC7C,QAAAA,KAAK,EAAEyB,SAAU;AAAAnB,QAAAA,QAAA,EACzEA,QAAAA;AAAQ,OACL,CACP,CAAA;KACM,CAAA;AAAC,GACQ,CAAC,CAAA;AAEzB,CAAC,CAAA;AAED,IAAMyC,YAAY,gBAAGC,cAAK,CAACC,UAAU,CAAC1D,aAAa;;;;"}
|
|
@@ -17,13 +17,14 @@ var _BaseFooter = function _BaseFooter(_ref) {
|
|
|
17
17
|
_ref$showDivider = _ref.showDivider,
|
|
18
18
|
showDivider = _ref$showDivider === void 0 ? true : _ref$showDivider,
|
|
19
19
|
metaComponentName = _ref.metaComponentName,
|
|
20
|
+
padding = _ref.padding,
|
|
20
21
|
testID = _ref.testID;
|
|
21
22
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
22
23
|
children: [showDivider && /*#__PURE__*/jsx(Divider, {}), /*#__PURE__*/jsx(BaseBox, _objectSpread(_objectSpread({}, metaAttribute({
|
|
23
24
|
name: metaComponentName,
|
|
24
25
|
testID: testID
|
|
25
26
|
})), {}, {
|
|
26
|
-
padding: {
|
|
27
|
+
padding: padding !== null && padding !== void 0 ? padding : {
|
|
27
28
|
base: 'spacing.5',
|
|
28
29
|
m: 'spacing.6'
|
|
29
30
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseFooter.js","sources":["../../../../../../src/components/BaseHeaderFooter/BaseFooter.tsx"],"sourcesContent":["import React from 'react';\nimport { Divider } from '~components/Divider';\nimport BaseBox from '~components/Box/BaseBox';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { metaAttribute } from '~utils/metaAttribute';\nimport type { TestID } from '~utils/types';\n\ntype BaseFooterProps = {\n children: React.ReactNode;\n metaComponentName?: string;\n showDivider?: boolean;\n} & TestID;\n\nconst _BaseFooter = ({\n children,\n showDivider = true,\n metaComponentName,\n testID,\n}: BaseFooterProps): React.ReactElement => {\n return (\n <>\n {showDivider && <Divider />}\n <BaseBox\n {...metaAttribute({ name: metaComponentName, testID })}\n padding={{ base: 'spacing.5', m: 'spacing.6' }}\n >\n {children}\n </BaseBox>\n </>\n );\n};\n\nconst BaseFooter = assignWithoutSideEffects(_BaseFooter, {\n componentId: 'BaseFooter',\n});\n\nexport type { BaseFooterProps };\nexport { BaseFooter };\n"],"names":["_BaseFooter","_ref","children","_ref$showDivider","showDivider","metaComponentName","testID","_jsxs","_Fragment","_jsx","Divider","BaseBox","_objectSpread","metaAttribute","name","
|
|
1
|
+
{"version":3,"file":"BaseFooter.js","sources":["../../../../../../src/components/BaseHeaderFooter/BaseFooter.tsx"],"sourcesContent":["import React from 'react';\nimport { Divider } from '~components/Divider';\nimport BaseBox from '~components/Box/BaseBox';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { metaAttribute } from '~utils/metaAttribute';\nimport type { TestID } from '~utils/types';\nimport type { BoxProps } from '~components/Box';\n\ntype BaseFooterProps = {\n children: React.ReactNode;\n metaComponentName?: string;\n showDivider?: boolean;\n padding?: BoxProps['padding'];\n} & TestID;\n\nconst _BaseFooter = ({\n children,\n showDivider = true,\n metaComponentName,\n padding,\n testID,\n}: BaseFooterProps): React.ReactElement => {\n return (\n <>\n {showDivider && <Divider />}\n <BaseBox\n {...metaAttribute({ name: metaComponentName, testID })}\n padding={padding ?? { base: 'spacing.5', m: 'spacing.6' }}\n >\n {children}\n </BaseBox>\n </>\n );\n};\n\nconst BaseFooter = assignWithoutSideEffects(_BaseFooter, {\n componentId: 'BaseFooter',\n});\n\nexport type { BaseFooterProps };\nexport { BaseFooter };\n"],"names":["_BaseFooter","_ref","children","_ref$showDivider","showDivider","metaComponentName","padding","testID","_jsxs","_Fragment","_jsx","Divider","BaseBox","_objectSpread","metaAttribute","name","base","m","BaseFooter","assignWithoutSideEffects","componentId"],"mappings":";;;;;;;;;;;;;;AAeA,IAAMA,WAAW,GAAG,SAAdA,WAAWA,CAAAC,IAAA,EAM0B;AAAA,EAAA,IALzCC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IAAAC,gBAAA,GAAAF,IAAA,CACRG,WAAW;AAAXA,IAAAA,WAAW,GAAAD,gBAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,gBAAA;IAClBE,iBAAiB,GAAAJ,IAAA,CAAjBI,iBAAiB;IACjBC,OAAO,GAAAL,IAAA,CAAPK,OAAO;IACPC,MAAM,GAAAN,IAAA,CAANM,MAAM,CAAA;EAEN,oBACEC,IAAA,CAAAC,QAAA,EAAA;AAAAP,IAAAA,QAAA,GACGE,WAAW,iBAAIM,GAAA,CAACC,OAAO,IAAE,CAAC,eAC3BD,GAAA,CAACE,OAAO,EAAAC,aAAA,CAAAA,aAAA,CAAA,EAAA,EACFC,aAAa,CAAC;AAAEC,MAAAA,IAAI,EAAEV,iBAAiB;AAAEE,MAAAA,MAAM,EAANA,MAAAA;AAAO,KAAC,CAAC,CAAA,EAAA,EAAA,EAAA;AACtDD,MAAAA,OAAO,EAAEA,OAAO,KAAA,IAAA,IAAPA,OAAO,KAAA,KAAA,CAAA,GAAPA,OAAO,GAAI;AAAEU,QAAAA,IAAI,EAAE,WAAW;AAAEC,QAAAA,CAAC,EAAE,WAAA;OAAc;AAAAf,MAAAA,QAAA,EAEzDA,QAAAA;AAAQ,KAAA,CACF,CAAC,CAAA;AAAA,GACV,CAAC,CAAA;AAEP,CAAC,CAAA;AAED,IAAMgB,UAAU,gBAAGC,wBAAwB,CAACnB,WAAW,EAAE;AACvDoB,EAAAA,WAAW,EAAE,YAAA;AACf,CAAC;;;;"}
|
|
@@ -167,6 +167,8 @@ var _BaseHeader = function _BaseHeader(_ref2) {
|
|
|
167
167
|
metaComponentName = _ref2.metaComponentName,
|
|
168
168
|
paddingX = _ref2.paddingX,
|
|
169
169
|
marginY = _ref2.marginY,
|
|
170
|
+
marginBottom = _ref2.marginBottom,
|
|
171
|
+
marginTop = _ref2.marginTop,
|
|
170
172
|
_ref2$size = _ref2.size,
|
|
171
173
|
size$1 = _ref2$size === void 0 ? 'large' : _ref2$size,
|
|
172
174
|
isDisabled = _ref2.isDisabled,
|
|
@@ -200,6 +202,8 @@ var _BaseHeader = function _BaseHeader(_ref2) {
|
|
|
200
202
|
base: 'spacing.5',
|
|
201
203
|
m: 'spacing.6'
|
|
202
204
|
},
|
|
205
|
+
marginTop: marginTop,
|
|
206
|
+
marginBottom: marginBottom,
|
|
203
207
|
touchAction: "none"
|
|
204
208
|
}, webOnlyEventHandlers), {}, {
|
|
205
209
|
children: [/*#__PURE__*/jsxs(BaseBox, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseHeader.js","sources":["../../../../../../src/components/BaseHeaderFooter/BaseHeader.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React from 'react';\nimport type { ReactDOMAttributes } from '@use-gesture/react/dist/declarations/src/types';\nimport { Divider } from '~components/Divider';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Text } from '~components/Typography';\nimport { IconButton } from '~components/Button/IconButton';\nimport { ChevronLeftIcon, CloseIcon } from '~components/Icons';\nimport type { TestID } from '~utils/types';\nimport type { BoxProps } from '~components/Box';\nimport { Box } from '~components/Box';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getComponentId } from '~utils/isValidAllowedChildren';\nimport { isReactNative, makeSize } from '~utils';\nimport { metaAttribute } from '~utils/metaAttribute';\nimport { logger, throwBladeError } from '~utils/logger';\nimport { size as sizeToken } from '~tokens/global';\n\ntype BaseHeaderProps = {\n title?: string;\n subtitle?: string;\n /**\n * Leading part of the header placed at the left most side of the header\n */\n leading?: React.ReactNode;\n /**\n * Trailing part of the header placed at the right most side of the header\n */\n trailing?: React.ReactNode;\n /**\n * Placed adjacent to the title text\n */\n titleSuffix?: React.ReactNode;\n /**\n * @default true\n */\n showDivider?: boolean;\n /**\n * @default false\n */\n showBackButton?: boolean;\n\n /**\n * Slot for rendering any trailing interaction element into BaseHeader.\n *\n * E.g. Used in accordion to render CollapsibleChevronIcon\n */\n trailingInteractionElement?: React.ReactNode;\n\n /**\n * Decides size of the Header\n */\n size?: 'large' | 'medium';\n /**\n * @default true\n */\n showCloseButton?: boolean;\n\n /**\n * Disabled state of BaseHeader\n *\n * @default false\n */\n isDisabled?: boolean;\n\n paddingX?: BoxProps['paddingX'];\n marginY?: BoxProps['marginY'];\n onCloseButtonClick?: () => void;\n onBackButtonClick?: () => void;\n closeButtonRef?: React.MutableRefObject<any>;\n backButtonRef?: React.MutableRefObject<any>;\n metaComponentName?: string;\n /**\n * inner child of BottomSheetHeader. Meant to be used for AutoComplete only\n */\n children?: React.ReactElement | React.ReactElement[];\n} & Pick<\n ReactDOMAttributes,\n | 'onClickCapture'\n | 'onKeyDown'\n | 'onKeyUp'\n | 'onLostPointerCapture'\n | 'onPointerCancel'\n | 'onPointerDown'\n | 'onPointerMove'\n | 'onPointerUp'\n> &\n TestID;\n\ntype TrailingComponents = 'Button' | 'Badge' | 'Link' | 'Text' | 'Amount';\n\nconst commonCenterBoxProps: BoxProps = {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n};\n\nconst centerBoxProps: { large: BoxProps; medium: BoxProps } = {\n large: {\n ...commonCenterBoxProps,\n // We want to align title, icon, titleSuffix, trailing, closeButton to baseline\n // But we also want to keep them center aligned to each other\n // So we add a virtual Box around these slots with 28px and center align them to that box\n // We have done similar thing in figma as well (which is where this 28px comes from)\n height: '28px',\n },\n medium: {\n ...commonCenterBoxProps,\n height: '20px',\n },\n};\n\nconst sizeTokensMapping = {\n large: {\n title: 'large',\n },\n medium: {\n title: 'medium',\n },\n} as const;\n\n// prop restriction map for corresponding sub components\nconst propRestrictionMap = {\n large: {\n Button: {\n size: 'xsmall',\n variant: 'tertiary',\n },\n Badge: {\n size: 'medium',\n },\n Link: {\n size: 'medium',\n },\n Text: {\n size: 'medium',\n variant: 'body',\n },\n Amount: {\n type: 'body',\n size: 'medium',\n },\n },\n medium: {\n Button: {\n size: 'xsmall',\n variant: 'tertiary',\n },\n Badge: {\n size: 'small',\n },\n Link: {\n size: 'small',\n },\n Text: {\n size: 'small',\n variant: 'body',\n },\n Amount: {\n type: 'body',\n size: 'small',\n },\n },\n} as const;\n\nconst useTrailingRestriction = ({\n trailing,\n size,\n}: {\n size: NonNullable<BaseHeaderProps['size']>;\n trailing: BaseHeaderProps['trailing'];\n}): React.ReactNode => {\n const [\n validatedTrailingComponent,\n setValidatedTrailingComponent,\n ] = React.useState<React.ReactElement | null>(null);\n\n // validate and restrict sub component props in trailing prop\n React.useEffect(() => {\n if (React.isValidElement(trailing)) {\n const trailingComponentType = getComponentId(trailing) as TrailingComponents;\n const restrictedProps = propRestrictionMap[size][trailingComponentType];\n const allowedComponents = Object.keys(propRestrictionMap[size]);\n if (__DEV__) {\n if (!restrictedProps) {\n throwBladeError({\n message: `Only one of \\`${allowedComponents.join(\n ', ',\n )}\\` component is accepted as trailing`,\n moduleName: 'Header',\n });\n }\n }\n\n const restrictedPropKeys = Object.keys(propRestrictionMap[size][trailingComponentType]);\n for (const prop of restrictedPropKeys) {\n if (trailing?.props?.hasOwnProperty(prop)) {\n logger({\n message: `Do not pass \"${prop}\" to \"${trailingComponentType}\" while inside Header trailing, because we override it.`,\n moduleName: 'Header',\n type: 'warn',\n });\n }\n }\n setValidatedTrailingComponent(\n React.cloneElement(trailing as React.ReactElement, restrictedProps),\n );\n }\n }, [trailing, size]);\n\n return validatedTrailingComponent;\n};\n\nconst _BaseHeader = ({\n title,\n subtitle,\n leading,\n titleSuffix,\n trailing,\n showDivider = true,\n showBackButton = false,\n showCloseButton = true,\n onBackButtonClick,\n onCloseButtonClick,\n closeButtonRef,\n backButtonRef,\n testID,\n onClickCapture,\n onKeyDown,\n onKeyUp,\n onLostPointerCapture,\n onPointerCancel,\n onPointerDown,\n onPointerMove,\n onPointerUp,\n metaComponentName,\n paddingX,\n marginY,\n size = 'large',\n isDisabled,\n children,\n trailingInteractionElement,\n}: BaseHeaderProps): React.ReactElement => {\n const validatedTrailingComponent = useTrailingRestriction({ trailing, size });\n const shouldWrapTitle = titleSuffix && trailing && showBackButton && showCloseButton;\n\n const webOnlyEventHandlers: Record<string, any> = isReactNative()\n ? {}\n : {\n onClickCapture,\n onKeyDown,\n onKeyUp,\n onLostPointerCapture,\n onPointerCancel,\n onPointerDown,\n onPointerMove,\n onPointerUp,\n };\n\n return (\n <BaseBox {...metaAttribute({ name: metaComponentName, testID })}>\n <BaseBox\n marginY={marginY ?? { base: 'spacing.5', m: 'spacing.6' }}\n paddingX={paddingX ?? { base: 'spacing.5', m: 'spacing.6' }}\n touchAction=\"none\"\n {...webOnlyEventHandlers}\n >\n <BaseBox display=\"flex\" flexDirection=\"row\" userSelect=\"none\">\n {showBackButton ? (\n <BaseBox overflow=\"visible\" marginRight=\"spacing.5\">\n <Box {...centerBoxProps[size]}>\n <IconButton\n ref={backButtonRef}\n size=\"large\"\n icon={ChevronLeftIcon}\n onClick={() => onBackButtonClick?.()}\n accessibilityLabel=\"Back\"\n />\n </Box>\n </BaseBox>\n ) : null}\n <BaseBox\n paddingRight=\"spacing.5\"\n marginRight=\"auto\"\n flex=\"auto\"\n display=\"flex\"\n flexDirection=\"row\"\n alignItems=\"flex-start\"\n >\n {leading ? (\n <BaseBox marginRight=\"spacing.3\" {...centerBoxProps[size]}>\n {leading}\n </BaseBox>\n ) : null}\n <BaseBox flex=\"auto\">\n <BaseBox\n // Explicitly setting maxWidth in React Native because text is not being wrapped properly when multiple fix width components are rendered in header\n // In web, flex containers seem to work a expected\n // @todo: resolve this if we figure out some better solution later\n maxWidth={isReactNative() && shouldWrapTitle ? '100px' : undefined}\n flexShrink={0}\n display=\"flex\"\n flexDirection=\"row\"\n >\n {title ? (\n <Text\n size={sizeTokensMapping[size].title}\n marginTop={makeSize(sizeToken['1'])}\n weight=\"semibold\"\n color={isDisabled ? 'surface.text.gray.disabled' : 'surface.text.gray.normal'}\n >\n {title}\n </Text>\n ) : null}\n {titleSuffix && (\n <BaseBox marginLeft=\"spacing.3\">\n <Box {...centerBoxProps[size]}>{titleSuffix}</Box>\n </BaseBox>\n )}\n </BaseBox>\n {subtitle ? (\n <Text\n variant=\"body\"\n size=\"small\"\n weight=\"regular\"\n color={isDisabled ? 'surface.text.gray.disabled' : 'surface.text.gray.muted'}\n >\n {subtitle}\n </Text>\n ) : null}\n </BaseBox>\n </BaseBox>\n {validatedTrailingComponent ? (\n <BaseBox marginRight=\"spacing.5\">\n <Box {...centerBoxProps[size]}>{validatedTrailingComponent}</Box>\n </BaseBox>\n ) : null}\n {showCloseButton ? (\n <Box {...centerBoxProps[size]}>\n <IconButton\n ref={closeButtonRef}\n size=\"large\"\n icon={CloseIcon}\n accessibilityLabel=\"Close\"\n onClick={() => onCloseButtonClick?.()}\n />\n </Box>\n ) : null}\n {trailingInteractionElement && !children ? (\n <Box {...centerBoxProps[size]}>{trailingInteractionElement}</Box>\n ) : null}\n </BaseBox>\n <BaseBox\n display=\"flex\"\n width=\"100%\"\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent=\"space-between\"\n >\n <Box>{children}</Box>\n {trailingInteractionElement && children ? (\n <Box alignSelf=\"flex-start\" {...centerBoxProps[size]}>\n {trailingInteractionElement}\n </Box>\n ) : null}\n </BaseBox>\n </BaseBox>\n {showDivider ? <Divider /> : null}\n </BaseBox>\n );\n};\n\nconst BaseHeader = assignWithoutSideEffects(_BaseHeader, {\n componentId: 'BaseHeader',\n});\n\nexport type { BaseHeaderProps };\nexport { BaseHeader };\n"],"names":["commonCenterBoxProps","display","alignItems","justifyContent","centerBoxProps","large","_objectSpread","height","medium","sizeTokensMapping","title","propRestrictionMap","Button","size","variant","Badge","Link","Text","Amount","type","useTrailingRestriction","_ref","trailing","_React$useState","React","useState","_React$useState2","_slicedToArray","validatedTrailingComponent","setValidatedTrailingComponent","useEffect","isValidElement","trailingComponentType","getComponentId","restrictedProps","allowedComponents","Object","keys","throwBladeError","message","concat","join","moduleName","restrictedPropKeys","_i","_restrictedPropKeys","length","_trailing$props","prop","props","hasOwnProperty","logger","cloneElement","_BaseHeader","_ref2","subtitle","leading","titleSuffix","_ref2$showDivider","showDivider","_ref2$showBackButton","showBackButton","_ref2$showCloseButton","showCloseButton","onBackButtonClick","onCloseButtonClick","closeButtonRef","backButtonRef","testID","onClickCapture","onKeyDown","onKeyUp","onLostPointerCapture","onPointerCancel","onPointerDown","onPointerMove","onPointerUp","metaComponentName","paddingX","marginY","_ref2$size","isDisabled","children","trailingInteractionElement","shouldWrapTitle","webOnlyEventHandlers","isReactNative","_jsxs","BaseBox","metaAttribute","name","base","m","touchAction","flexDirection","userSelect","_jsx","overflow","marginRight","Box","IconButton","ref","icon","ChevronLeftIcon","onClick","accessibilityLabel","paddingRight","flex","maxWidth","undefined","flexShrink","marginTop","makeSize","sizeToken","weight","color","marginLeft","CloseIcon","width","alignSelf","Divider","BaseHeader","assignWithoutSideEffects","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2FA,IAAMA,oBAA8B,GAAG;AACrCC,EAAAA,OAAO,EAAE,MAAM;AACfC,EAAAA,UAAU,EAAE,QAAQ;AACpBC,EAAAA,cAAc,EAAE,QAAA;AAClB,CAAC,CAA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AQ,gBACtCc,GAAA,CAACG,GAAG,EAAA7F,aAAA,CAAAA,aAAA,KAAKF,cAAc,CAACS,MAAI,CAAC,CAAA,EAAA,EAAA,EAAA;AAAAqE,UAAAA,QAAA,EAAGC,0BAAAA;SAAgC,CAAA,CAAC,GAC/D,IAAI,CAAA;AAAA,OACD,CAAC,eACVI,IAAA,CAACC,OAAO,EAAA;AACNvF,QAAAA,OAAO,EAAC,MAAM;AACdqH,QAAAA,KAAK,EAAC,MAAM;AACZxB,QAAAA,aAAa,EAAC,KAAK;AACnB5F,QAAAA,UAAU,EAAC,QAAQ;AACnBC,QAAAA,cAAc,EAAC,eAAe;QAAA+E,QAAA,EAAA,cAE9Bc,GAAA,CAACG,GAAG,EAAA;AAAAjB,UAAAA,QAAA,EAAEA,QAAAA;AAAQ,SAAM,CAAC,EACpBC,0BAA0B,IAAID,QAAQ,gBACrCc,GAAA,CAACG,GAAG,EAAA7F,aAAA,CAAAA,aAAA,CAAA;AAACiH,UAAAA,SAAS,EAAC,YAAA;SAAiBnH,EAAAA,cAAc,CAACS,MAAI,CAAC,CAAA,EAAA,EAAA,EAAA;AAAAqE,UAAAA,QAAA,EACjDC,0BAAAA;SACE,CAAA,CAAC,GACJ,IAAI,CAAA;AAAA,OACD,CAAC,CAAA;KACH,CAAA,CAAC,EACTxB,WAAW,gBAAGqC,GAAA,CAACwB,OAAO,EAAA,EAAE,CAAC,GAAG,IAAI,CAAA;AAAA,GAAA,CAC1B,CAAC,CAAA;AAEd,CAAC,CAAA;AAED,IAAMC,UAAU,gBAAGC,wBAAwB,CAACrE,WAAW,EAAE;AACvDsE,EAAAA,WAAW,EAAE,YAAA;AACf,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"BaseHeader.js","sources":["../../../../../../src/components/BaseHeaderFooter/BaseHeader.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React from 'react';\nimport type { ReactDOMAttributes } from '@use-gesture/react/dist/declarations/src/types';\nimport { Divider } from '~components/Divider';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Text } from '~components/Typography';\nimport { IconButton } from '~components/Button/IconButton';\nimport { ChevronLeftIcon, CloseIcon } from '~components/Icons';\nimport type { TestID } from '~utils/types';\nimport type { BoxProps } from '~components/Box';\nimport { Box } from '~components/Box';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getComponentId } from '~utils/isValidAllowedChildren';\nimport { isReactNative, makeSize } from '~utils';\nimport { metaAttribute } from '~utils/metaAttribute';\nimport { logger, throwBladeError } from '~utils/logger';\nimport { size as sizeToken } from '~tokens/global';\n\ntype BaseHeaderProps = {\n title?: string;\n subtitle?: string;\n /**\n * Leading part of the header placed at the left most side of the header\n */\n leading?: React.ReactNode;\n /**\n * Trailing part of the header placed at the right most side of the header\n */\n trailing?: React.ReactNode;\n /**\n * Placed adjacent to the title text\n */\n titleSuffix?: React.ReactNode;\n /**\n * @default true\n */\n showDivider?: boolean;\n /**\n * @default false\n */\n showBackButton?: boolean;\n\n /**\n * Slot for rendering any trailing interaction element into BaseHeader.\n *\n * E.g. Used in accordion to render CollapsibleChevronIcon\n */\n trailingInteractionElement?: React.ReactNode;\n\n /**\n * Decides size of the Header\n */\n size?: 'large' | 'medium';\n /**\n * @default true\n */\n showCloseButton?: boolean;\n\n /**\n * Disabled state of BaseHeader\n *\n * @default false\n */\n isDisabled?: boolean;\n\n paddingX?: BoxProps['paddingX'];\n marginY?: BoxProps['marginY'];\n marginTop?: BoxProps['marginTop'];\n marginBottom?: BoxProps['marginBottom'];\n onCloseButtonClick?: () => void;\n onBackButtonClick?: () => void;\n closeButtonRef?: React.MutableRefObject<any>;\n backButtonRef?: React.MutableRefObject<any>;\n metaComponentName?: string;\n /**\n * inner child of BottomSheetHeader. Meant to be used for AutoComplete only\n */\n children?: React.ReactElement | React.ReactElement[];\n} & Pick<\n ReactDOMAttributes,\n | 'onClickCapture'\n | 'onKeyDown'\n | 'onKeyUp'\n | 'onLostPointerCapture'\n | 'onPointerCancel'\n | 'onPointerDown'\n | 'onPointerMove'\n | 'onPointerUp'\n> &\n TestID;\n\ntype TrailingComponents = 'Button' | 'Badge' | 'Link' | 'Text' | 'Amount';\n\nconst commonCenterBoxProps: BoxProps = {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n};\n\nconst centerBoxProps: { large: BoxProps; medium: BoxProps } = {\n large: {\n ...commonCenterBoxProps,\n // We want to align title, icon, titleSuffix, trailing, closeButton to baseline\n // But we also want to keep them center aligned to each other\n // So we add a virtual Box around these slots with 28px and center align them to that box\n // We have done similar thing in figma as well (which is where this 28px comes from)\n height: '28px',\n },\n medium: {\n ...commonCenterBoxProps,\n height: '20px',\n },\n};\n\nconst sizeTokensMapping = {\n large: {\n title: 'large',\n },\n medium: {\n title: 'medium',\n },\n} as const;\n\n// prop restriction map for corresponding sub components\nconst propRestrictionMap = {\n large: {\n Button: {\n size: 'xsmall',\n variant: 'tertiary',\n },\n Badge: {\n size: 'medium',\n },\n Link: {\n size: 'medium',\n },\n Text: {\n size: 'medium',\n variant: 'body',\n },\n Amount: {\n type: 'body',\n size: 'medium',\n },\n },\n medium: {\n Button: {\n size: 'xsmall',\n variant: 'tertiary',\n },\n Badge: {\n size: 'small',\n },\n Link: {\n size: 'small',\n },\n Text: {\n size: 'small',\n variant: 'body',\n },\n Amount: {\n type: 'body',\n size: 'small',\n },\n },\n} as const;\n\nconst useTrailingRestriction = ({\n trailing,\n size,\n}: {\n size: NonNullable<BaseHeaderProps['size']>;\n trailing: BaseHeaderProps['trailing'];\n}): React.ReactNode => {\n const [\n validatedTrailingComponent,\n setValidatedTrailingComponent,\n ] = React.useState<React.ReactElement | null>(null);\n\n // validate and restrict sub component props in trailing prop\n React.useEffect(() => {\n if (React.isValidElement(trailing)) {\n const trailingComponentType = getComponentId(trailing) as TrailingComponents;\n const restrictedProps = propRestrictionMap[size][trailingComponentType];\n const allowedComponents = Object.keys(propRestrictionMap[size]);\n if (__DEV__) {\n if (!restrictedProps) {\n throwBladeError({\n message: `Only one of \\`${allowedComponents.join(\n ', ',\n )}\\` component is accepted as trailing`,\n moduleName: 'Header',\n });\n }\n }\n\n const restrictedPropKeys = Object.keys(propRestrictionMap[size][trailingComponentType]);\n for (const prop of restrictedPropKeys) {\n if (trailing?.props?.hasOwnProperty(prop)) {\n logger({\n message: `Do not pass \"${prop}\" to \"${trailingComponentType}\" while inside Header trailing, because we override it.`,\n moduleName: 'Header',\n type: 'warn',\n });\n }\n }\n setValidatedTrailingComponent(\n React.cloneElement(trailing as React.ReactElement, restrictedProps),\n );\n }\n }, [trailing, size]);\n\n return validatedTrailingComponent;\n};\n\nconst _BaseHeader = ({\n title,\n subtitle,\n leading,\n titleSuffix,\n trailing,\n showDivider = true,\n showBackButton = false,\n showCloseButton = true,\n onBackButtonClick,\n onCloseButtonClick,\n closeButtonRef,\n backButtonRef,\n testID,\n onClickCapture,\n onKeyDown,\n onKeyUp,\n onLostPointerCapture,\n onPointerCancel,\n onPointerDown,\n onPointerMove,\n onPointerUp,\n metaComponentName,\n paddingX,\n marginY,\n marginBottom,\n marginTop,\n size = 'large',\n isDisabled,\n children,\n trailingInteractionElement,\n}: BaseHeaderProps): React.ReactElement => {\n const validatedTrailingComponent = useTrailingRestriction({ trailing, size });\n const shouldWrapTitle = titleSuffix && trailing && showBackButton && showCloseButton;\n\n const webOnlyEventHandlers: Record<string, any> = isReactNative()\n ? {}\n : {\n onClickCapture,\n onKeyDown,\n onKeyUp,\n onLostPointerCapture,\n onPointerCancel,\n onPointerDown,\n onPointerMove,\n onPointerUp,\n };\n\n return (\n <BaseBox {...metaAttribute({ name: metaComponentName, testID })}>\n <BaseBox\n marginY={marginY ?? { base: 'spacing.5', m: 'spacing.6' }}\n paddingX={paddingX ?? { base: 'spacing.5', m: 'spacing.6' }}\n marginTop={marginTop}\n marginBottom={marginBottom}\n touchAction=\"none\"\n {...webOnlyEventHandlers}\n >\n <BaseBox display=\"flex\" flexDirection=\"row\" userSelect=\"none\">\n {showBackButton ? (\n <BaseBox overflow=\"visible\" marginRight=\"spacing.5\">\n <Box {...centerBoxProps[size]}>\n <IconButton\n ref={backButtonRef}\n size=\"large\"\n icon={ChevronLeftIcon}\n onClick={() => onBackButtonClick?.()}\n accessibilityLabel=\"Back\"\n />\n </Box>\n </BaseBox>\n ) : null}\n <BaseBox\n paddingRight=\"spacing.5\"\n marginRight=\"auto\"\n flex=\"auto\"\n display=\"flex\"\n flexDirection=\"row\"\n alignItems=\"flex-start\"\n >\n {leading ? (\n <BaseBox marginRight=\"spacing.3\" {...centerBoxProps[size]}>\n {leading}\n </BaseBox>\n ) : null}\n <BaseBox flex=\"auto\">\n <BaseBox\n // Explicitly setting maxWidth in React Native because text is not being wrapped properly when multiple fix width components are rendered in header\n // In web, flex containers seem to work a expected\n // @todo: resolve this if we figure out some better solution later\n maxWidth={isReactNative() && shouldWrapTitle ? '100px' : undefined}\n flexShrink={0}\n display=\"flex\"\n flexDirection=\"row\"\n >\n {title ? (\n <Text\n size={sizeTokensMapping[size].title}\n marginTop={makeSize(sizeToken['1'])}\n weight=\"semibold\"\n color={isDisabled ? 'surface.text.gray.disabled' : 'surface.text.gray.normal'}\n >\n {title}\n </Text>\n ) : null}\n {titleSuffix && (\n <BaseBox marginLeft=\"spacing.3\">\n <Box {...centerBoxProps[size]}>{titleSuffix}</Box>\n </BaseBox>\n )}\n </BaseBox>\n {subtitle ? (\n <Text\n variant=\"body\"\n size=\"small\"\n weight=\"regular\"\n color={isDisabled ? 'surface.text.gray.disabled' : 'surface.text.gray.muted'}\n >\n {subtitle}\n </Text>\n ) : null}\n </BaseBox>\n </BaseBox>\n {validatedTrailingComponent ? (\n <BaseBox marginRight=\"spacing.5\">\n <Box {...centerBoxProps[size]}>{validatedTrailingComponent}</Box>\n </BaseBox>\n ) : null}\n {showCloseButton ? (\n <Box {...centerBoxProps[size]}>\n <IconButton\n ref={closeButtonRef}\n size=\"large\"\n icon={CloseIcon}\n accessibilityLabel=\"Close\"\n onClick={() => onCloseButtonClick?.()}\n />\n </Box>\n ) : null}\n {trailingInteractionElement && !children ? (\n <Box {...centerBoxProps[size]}>{trailingInteractionElement}</Box>\n ) : null}\n </BaseBox>\n <BaseBox\n display=\"flex\"\n width=\"100%\"\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent=\"space-between\"\n >\n <Box>{children}</Box>\n {trailingInteractionElement && children ? (\n <Box alignSelf=\"flex-start\" {...centerBoxProps[size]}>\n {trailingInteractionElement}\n </Box>\n ) : null}\n </BaseBox>\n </BaseBox>\n {showDivider ? <Divider /> : null}\n </BaseBox>\n );\n};\n\nconst BaseHeader = assignWithoutSideEffects(_BaseHeader, {\n componentId: 'BaseHeader',\n});\n\nexport type { BaseHeaderProps };\nexport { BaseHeader };\n"],"names":["commonCenterBoxProps","display","alignItems","justifyContent","centerBoxProps","large","_objectSpread","height","medium","sizeTokensMapping","title","propRestrictionMap","Button","size","variant","Badge","Link","Text","Amount","type","useTrailingRestriction","_ref","trailing","_React$useState","React","useState","_React$useState2","_slicedToArray","validatedTrailingComponent","setValidatedTrailingComponent","useEffect","isValidElement","trailingComponentType","getComponentId","restrictedProps","allowedComponents","Object","keys","throwBladeError","message","concat","join","moduleName","restrictedPropKeys","_i","_restrictedPropKeys","length","_trailing$props","prop","props","hasOwnProperty","logger","cloneElement","_BaseHeader","_ref2","subtitle","leading","titleSuffix","_ref2$showDivider","showDivider","_ref2$showBackButton","showBackButton","_ref2$showCloseButton","showCloseButton","onBackButtonClick","onCloseButtonClick","closeButtonRef","backButtonRef","testID","onClickCapture","onKeyDown","onKeyUp","onLostPointerCapture","onPointerCancel","onPointerDown","onPointerMove","onPointerUp","metaComponentName","paddingX","marginY","marginBottom","marginTop","_ref2$size","isDisabled","children","trailingInteractionElement","shouldWrapTitle","webOnlyEventHandlers","isReactNative","_jsxs","BaseBox","metaAttribute","name","base","m","touchAction","flexDirection","userSelect","_jsx","overflow","marginRight","Box","IconButton","ref","icon","ChevronLeftIcon","onClick","accessibilityLabel","paddingRight","flex","maxWidth","undefined","flexShrink","makeSize","sizeToken","weight","color","marginLeft","CloseIcon","width","alignSelf","Divider","BaseHeader","assignWithoutSideEffects","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6FA,IAAMA,oBAA8B,GAAG;AACrCC,EAAAA,OAAO,EAAE,MAAM;AACfC,EAAAA,UAAU,EAAE,QAAQ;AACpBC,EAAAA,cAAc,EAAE,QAAA;AAClB,CAAC,CAAA;AAED,IAAMC,cAAqD,GAAG;AAC5DC,EAAAA,KAAK,EAAAC,aAAA,CAAAA,aAAA,KACAN,oBAAoB,CAAA,EAAA,EAAA,EAAA;AACvB;AACA;AACA;AACA;AACAO,IAAAA,MAAM,EAAE,MAAA;GACT,CAAA;AACDC,EAAAA,MAAM,EAAAF,aAAA,CAAAA,aAAA,KACDN,oBAAoB,CAAA,EAAA,EAAA,EAAA;AACvBO,IAAAA,MAAM,EAAE,MAAA;AAAM,GAAA,CAAA;AAElB,CAAC,CAAA;AAED,IAAME,iBAAiB,GAAG;AACxBJ,EAAAA,KAAK,EAAE;AACLK,IAAAA,KAAK,EAAE,OAAA;GACR;AACDF,EAAAA,MAAM,EAAE;AACNE,IAAAA,KAAK,EAAE,QAAA;AACT,GAAA;AACF,CAAU,CAAA;;AAEV;AACA,IAAMC,kBAAkB,GAAG;AACzBN,EAAAA,KAAK,EAAE;AACLO,IAAAA,MAAM,EAAE;AACNC,MAAAA,IAAI,EAAE,QAAQ;AACdC,MAAAA,OAAO,EAAE,UAAA;KACV;AACDC,IAAAA,KAAK,EAAE;AACLF,MAAAA,IAAI,EAAE,QAAA;KACP;AACDG,IAAAA,IAAI,EAAE;AACJH,MAAAA,IAAI,EAAE,QAAA;KACP;AACDI,IAAAA,IAAI,EAAE;AACJJ,MAAAA,IAAI,EAAE,QAAQ;AACdC,MAAAA,OAAO,EAAE,MAAA;KACV;AACDI,IAAAA,MAAM,EAAE;AACNC,MAAAA,IAAI,EAAE,MAAM;A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CAAC,CAAA;KACH,CAAA,CAAC,EACT1B,WAAW,gBAAGuC,GAAA,CAACuB,OAAO,EAAA,EAAE,CAAC,GAAG,IAAI,CAAA;AAAA,GAAA,CAC1B,CAAC,CAAA;AAEd,CAAC,CAAA;AAED,IAAMC,UAAU,gBAAGC,wBAAwB,CAACtE,WAAW,EAAE;AACvDuE,EAAAA,WAAW,EAAE,YAAA;AACf,CAAC;;;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
|
|
3
|
+
var BaseMenuItemContext = /*#__PURE__*/React__default.createContext({});
|
|
4
|
+
var useBaseMenuItem = function useBaseMenuItem() {
|
|
5
|
+
var menuItemValue = React__default.useContext(BaseMenuItemContext);
|
|
6
|
+
return menuItemValue;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export { BaseMenuItemContext, useBaseMenuItem };
|
|
10
|
+
//# sourceMappingURL=BaseMenuContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseMenuContext.js","sources":["../../../../../../src/components/BaseMenu/BaseMenuContext.ts"],"sourcesContent":["import React from 'react';\nimport type { BaseMenuItemContextType } from './types';\n\nconst BaseMenuItemContext = React.createContext<BaseMenuItemContextType>({});\n\nconst useBaseMenuItem = (): BaseMenuItemContextType => {\n const menuItemValue = React.useContext(BaseMenuItemContext);\n return menuItemValue;\n};\n\nexport { useBaseMenuItem, BaseMenuItemContext };\n"],"names":["BaseMenuItemContext","React","createContext","useBaseMenuItem","menuItemValue","useContext"],"mappings":";;AAGMA,IAAAA,mBAAmB,gBAAGC,cAAK,CAACC,aAAa,CAA0B,EAAE,EAAC;AAE5E,IAAMC,eAAe,GAAG,SAAlBA,eAAeA,GAAkC;AACrD,EAAA,IAAMC,aAAa,GAAGH,cAAK,CAACI,UAAU,CAACL,mBAAmB,CAAC,CAAA;AAC3D,EAAA,OAAOI,aAAa,CAAA;AACtB;;;;"}
|