@razorpay/blade 11.21.9 → 11.22.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/index.js +5 -0
- package/build/lib/native/components/index.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/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/index.js +6 -0
- package/build/lib/web/development/components/index.js.map +1 -1
- package/build/lib/web/development/utils/metaAttribute/metaConstants.js +3 -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/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/index.js +6 -0
- package/build/lib/web/production/components/index.js.map +1 -1
- package/build/lib/web/production/utils/metaAttribute/metaConstants.js +3 -0
- package/build/lib/web/production/utils/metaAttribute/metaConstants.js.map +1 -1
- package/build/types/components/index.d.ts +755 -3
- package/build/types/components/index.native.d.ts +170 -2
- 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":"BaseLink.js","sources":["../../../../../../../src/components/Link/BaseLink/BaseLink.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/prefer-ts-expect-error */\n/* eslint-disable @typescript-eslint/ban-ts-comment */\nimport type { SyntheticEvent } from 'react';\nimport React from 'react';\nimport type { CSSObject } from 'styled-components';\nimport type { GestureResponderEvent } from 'react-native';\nimport StyledBaseLink from './StyledBaseLink';\nimport getIn from '~utils/lodashButBetter/get';\nimport useInteraction from '~utils/useInteraction';\nimport type { IconColors, IconComponent, IconProps } from '~components/Icons';\nimport type { Theme } from '~components/BladeProvider';\nimport { useTheme } from '~components/BladeProvider';\nimport BaseBox from '~components/Box/BaseBox';\nimport { BaseText } from '~components/Typography/BaseText';\nimport type {\n DotNotationSpacingStringToken,\n StringChildrenType,\n TestID,\n BladeElementRef,\n} from '~utils/types';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { Platform } from '~utils';\nimport { isReactNative } from '~utils';\nimport type { DurationString, EasingString, FontSize, Typography } from '~tokens/global';\nimport type {\n BaseTextProps,\n BaseTextSizes,\n TextColors,\n} from '~components/Typography/BaseText/types';\nimport { getStringFromReactText } from '~src/utils/getStringChildren';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { AccessibilityProps } from '~utils/makeAccessible';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport type { BladeCommonEvents } from '~components/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { throwBladeError } from '~utils/logger';\nimport type { ActionStates } from '~utils/useInteraction';\n\ntype BaseLinkCommonProps = {\n color?: 'primary' | 'white' | 'positive' | 'negative' | 'notice' | 'information' | 'neutral';\n icon?: IconComponent;\n iconPosition?: 'left' | 'right';\n onClick?: (event: SyntheticEvent) => void;\n onBlur?: Platform.Select<{\n native: (event: GestureResponderEvent) => void;\n web: (event: React.FocusEvent<HTMLButtonElement>) => void;\n }>;\n onMouseLeave?: Platform.Select<{\n native: (event: GestureResponderEvent) => void;\n web: (event: React.MouseEvent<HTMLButtonElement>) => void;\n }>;\n onKeyDown?: Platform.Select<{\n native: (event: GestureResponderEvent) => void;\n web: (event: React.KeyboardEvent<HTMLButtonElement>) => void;\n }>;\n accessibilityProps?: Partial<AccessibilityProps>;\n\n /**\n * Sets the size of the link\n *\n * @default medium\n */\n size?: Extract<BaseTextSizes, 'xsmall' | 'small' | 'medium' | 'large'>;\n /**\n * Defines how far your touch can start away from the link. This is a react-native only prop and has no effect on web.\n */\n hitSlop?:\n | {\n top?: number;\n right?: number;\n bottom?: number;\n left?: number;\n }\n | number;\n /**\n * The title of the link which is displayed as a tooltip. This is a web only prop and has no effect on react-native.\n */\n htmlTitle?: string;\n opacity?: number;\n} & TestID &\n StyledPropsBlade &\n Omit<BladeCommonEvents, 'onBlur' | 'onMouseLeave'>;\n\n/*\n Mandatory children prop when icon is not provided\n*/\ntype BaseLinkWithoutIconProps = BaseLinkCommonProps & {\n icon?: undefined;\n children: StringChildrenType;\n};\n\n/*\n Optional children prop when icon is provided\n*/\ntype BaseLinkWithIconProps = BaseLinkCommonProps & {\n icon: IconComponent;\n children?: StringChildrenType;\n};\n\n/*\n BaseLink Props with or without an icon\n*/\ntype BaseLinkPropsWithOrWithoutIcon = BaseLinkWithIconProps | BaseLinkWithoutIconProps;\n\n/*\n BaseLink Props when variant is anchor\n*/\ntype BaseLinkAnchorVariantProps = BaseLinkPropsWithOrWithoutIcon & {\n variant?: 'anchor';\n href?: string;\n target?: string;\n rel?: string;\n isDisabled?: undefined;\n};\n\n/*\n BaseLink Props when variant is button\n*/\ntype BaseLinkButtonVariantProps = BaseLinkPropsWithOrWithoutIcon & {\n variant?: 'button';\n isDisabled?: boolean;\n href?: undefined;\n target?: undefined;\n rel?: undefined;\n};\n\n/*\n BaseLink Props when variant is anchor or button\n*/\nexport type BaseLinkProps = BaseLinkAnchorVariantProps | BaseLinkButtonVariantProps;\n\ntype BaseLinkStyleProps = {\n as: 'a' | 'button';\n textDecorationLine: 'underline' | 'none';\n iconColor: IconProps['color'];\n iconSize: IconProps['size'];\n iconPadding: DotNotationSpacingStringToken;\n textColor: BaseTextProps['color'];\n focusRingColor: string;\n motionDuration: DurationString;\n motionEasing: EasingString;\n cursor: CSSObject['cursor'];\n disabled: boolean;\n role: 'button' | 'link';\n defaultRel: BaseLinkProps['rel'];\n type?: 'button';\n fontSize: BaseTextProps['fontSize'];\n lineHeight: BaseTextProps['lineHeight'];\n};\n\ntype LinkActionStates = ActionStates;\nconst getColorToken = ({\n variant,\n color,\n currentInteraction,\n isDisabled,\n element,\n}: {\n variant: BaseLinkProps['variant'];\n color: BaseLinkProps['color'];\n element: 'icon' | 'text';\n currentInteraction: LinkActionStates;\n isDisabled: boolean;\n}): IconColors | TextColors => {\n let state = currentInteraction;\n const map = {\n default: 'normal',\n hover: 'subtle',\n focus: 'normal',\n disabled: 'disabled',\n } as const;\n\n if (isDisabled && variant == 'button') {\n state = 'disabled';\n }\n\n if (color && color !== 'primary') {\n if (color !== 'white') {\n return `interactive.${element}.${color}.${map[state]}`;\n }\n return `interactive.${element}.staticWhite.${map[state]}`;\n }\n return `interactive.${element}.primary.${map[state]}`;\n};\n\nconst getProps = ({\n theme,\n variant,\n currentInteraction,\n children,\n isDisabled,\n color,\n target,\n size,\n}: {\n theme: Theme;\n variant: NonNullable<BaseLinkProps['variant']>;\n currentInteraction: LinkActionStates;\n children?: string;\n isDisabled: boolean;\n color: BaseLinkProps['color'];\n target: BaseLinkProps['target'];\n size: NonNullable<BaseLinkProps['size']>;\n}): BaseLinkStyleProps => {\n const isButton = variant === 'button';\n const textSizes: {\n fontSize: Record<NonNullable<BaseLinkProps['size']>, keyof FontSize>;\n lineHeight: Record<NonNullable<BaseLinkProps['size']>, keyof Typography['lineHeights']>;\n } = {\n fontSize: {\n xsmall: 25,\n small: 75,\n medium: 100,\n large: 200,\n },\n lineHeight: {\n xsmall: 25,\n small: 75,\n medium: 100,\n large: 200,\n },\n };\n\n const props: BaseLinkStyleProps = {\n as: isButton ? 'button' : 'a',\n textDecorationLine: !isButton && currentInteraction !== 'default' ? 'underline' : 'none',\n iconColor: getColorToken({\n variant,\n color,\n element: 'icon',\n currentInteraction,\n isDisabled,\n }) as IconProps['color'],\n fontSize: textSizes.fontSize[size],\n lineHeight: textSizes.lineHeight[size],\n iconSize: size,\n iconPadding: children?.trim() ? 'spacing.2' : 'spacing.0',\n textColor: getColorToken({\n variant,\n color,\n element: 'text',\n currentInteraction,\n isDisabled,\n }) as BaseTextProps['color'],\n focusRingColor: getIn(theme.colors, 'interactive.background.primary.faded'),\n motionDuration: 'duration.2xquick',\n motionEasing: 'easing.standard.effective',\n cursor: isButton && isDisabled ? 'not-allowed' : 'pointer',\n disabled: isButton && isDisabled,\n role: isButton ? 'button' : 'link',\n defaultRel: target && target === '_blank' ? 'noreferrer noopener' : undefined,\n type: isButton ? 'button' : undefined,\n };\n\n return props;\n};\n\nconst _BaseLink: React.ForwardRefRenderFunction<BladeElementRef, BaseLinkProps> = (\n {\n children,\n icon: Icon,\n iconPosition = 'left',\n isDisabled = false,\n onClick,\n onKeyDown,\n variant = 'anchor',\n href,\n target,\n rel,\n color = 'primary',\n opacity,\n accessibilityProps,\n // @ts-expect-error avoiding exposing to public\n className,\n // @ts-expect-error avoiding exposing to public\n style,\n size = 'medium',\n testID,\n hitSlop,\n htmlTitle,\n onBlur,\n onFocus,\n onMouseLeave,\n onMouseMove,\n onPointerDown,\n onPointerEnter,\n onTouchStart,\n onTouchEnd,\n ...styledProps\n },\n ref,\n) => {\n const childrenString = getStringFromReactText(children);\n const { currentInteraction, setCurrentInteraction, ...syntheticEvents } = useInteraction();\n const { theme } = useTheme();\n if (__DEV__) {\n if (!Icon && !childrenString?.trim()) {\n throwBladeError({\n message: `At least one of icon or text is required to render a link.`,\n moduleName: 'BaseLink',\n });\n }\n }\n const {\n as,\n textDecorationLine,\n iconColor,\n iconPadding,\n iconSize,\n fontSize,\n textColor,\n focusRingColor,\n motionDuration,\n motionEasing,\n cursor,\n disabled,\n role,\n defaultRel,\n type,\n lineHeight,\n } = getProps({\n theme,\n variant,\n currentInteraction,\n children: childrenString,\n isDisabled,\n color,\n target,\n size,\n });\n\n const handleOnClick = (event: SyntheticEvent): void => {\n if (onClick) {\n onClick(event);\n }\n };\n\n const asProp = isReactNative() ? undefined : 'span';\n return (\n <StyledBaseLink\n ref={ref as never}\n {...metaAttribute({ name: MetaConstants.Link, testID })}\n accessibilityProps={{\n ...makeAccessible({\n role,\n disabled,\n ...accessibilityProps,\n }),\n }}\n variant={variant}\n as={as}\n href={href}\n target={target}\n rel={rel ?? defaultRel}\n onClick={handleOnClick}\n {...syntheticEvents}\n onBlur={(event: any) => {\n onBlur?.(event);\n syntheticEvents.onBlur();\n }}\n onFocus={(event: any) => {\n onFocus?.(event);\n syntheticEvents.onFocus();\n }}\n onMouseLeave={(event: any) => {\n if (onMouseLeave) {\n onMouseLeave(event);\n }\n syntheticEvents.onMouseLeave();\n }}\n onMouseMove={onMouseMove}\n onPointerDown={onPointerDown}\n onPointerEnter={onPointerEnter}\n onTouchStart={onTouchStart}\n onTouchEnd={onTouchEnd}\n onKeyDown={onKeyDown}\n disabled={disabled}\n type={type}\n cursor={cursor}\n focusRingColor={focusRingColor}\n motionDuration={motionDuration}\n motionEasing={motionEasing}\n setCurrentInteraction={setCurrentInteraction}\n {...getStyledProps(styledProps)}\n // @ts-ignore Because we avoided exposing className to public\n className={className}\n style={style}\n hitSlop={hitSlop}\n title={htmlTitle}\n >\n <BaseBox\n as={asProp}\n display=\"flex\"\n flexDirection=\"row\"\n className=\"content-container\"\n alignItems=\"center\"\n opacity={opacity}\n >\n {Icon && iconPosition == 'left' ? (\n <BaseBox as={asProp} paddingRight={iconPadding} display=\"flex\" alignItems=\"center\">\n <Icon color={iconColor} size={iconSize} />\n </BaseBox>\n ) : null}\n <BaseText\n as={asProp}\n textDecorationLine={textDecorationLine}\n color={textColor}\n fontSize={fontSize}\n lineHeight={lineHeight}\n textAlign=\"center\"\n fontWeight=\"medium\"\n >\n {children}\n </BaseText>\n {Icon && iconPosition == 'right' ? (\n <BaseBox as={asProp} paddingLeft={iconPadding} display=\"flex\" alignItems=\"center\">\n <Icon color={iconColor} size={iconSize} />\n </BaseBox>\n ) : null}\n </BaseBox>\n </StyledBaseLink>\n );\n};\n\nconst BaseLink = assignWithoutSideEffects(React.forwardRef(_BaseLink), {\n displayName: 'BaseLink',\n componentId: 'BaseLink',\n});\n\nexport default BaseLink;\n"],"names":["getColorToken","_ref","variant","color","currentInteraction","isDisabled","element","state","map","hover","focus","disabled","concat","getProps","_ref2","theme","children","target","size","isButton","textSizes","fontSize","xsmall","small","medium","large","lineHeight","props","as","textDecorationLine","iconColor","iconSize","iconPadding","trim","textColor","focusRingColor","getIn","colors","motionDuration","motionEasing","cursor","role","defaultRel","undefined","type","_BaseLink","_ref3","ref","Icon","icon","_ref3$iconPosition","iconPosition","_ref3$isDisabled","onClick","onKeyDown","_ref3$variant","href","rel","_ref3$color","opacity","accessibilityProps","className","style","_ref3$size","testID","hitSlop","htmlTitle","onBlur","onFocus","onMouseLeave","onMouseMove","onPointerDown","onPointerEnter","onTouchStart","onTouchEnd","styledProps","_objectWithoutProperties","_excluded","childrenString","getStringFromReactText","_useInteraction","useInteraction","setCurrentInteraction","syntheticEvents","_excluded2","_useTheme","useTheme","throwBladeError","message","moduleName","_getProps","handleOnClick","event","asProp","isReactNative","_jsx","StyledBaseLink","_objectSpread","metaAttribute","name","MetaConstants","Link","makeAccessible","getStyledProps","title","_jsxs","BaseBox","display","flexDirection","alignItems","paddingRight","BaseText","textAlign","fontWeight","paddingLeft","BaseLink","assignWithoutSideEffects","React","forwardRef","displayName","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyJA,IAAMA,aAAa,GAAG,SAAhBA,aAAaA,CAAAC,IAAA,EAYY;AAAA,EAAA,IAX7BC,OAAO,GAAAD,IAAA,CAAPC,OAAO;IACPC,KAAK,GAAAF,IAAA,CAALE,KAAK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AAU,EAAC,QAAQ;AAAAjG,QAAAA,QAAA,EAElBA,QAAAA;OACO,CAAC,EACVgC,IAAI,IAAIG,YAAY,IAAI,OAAO,gBAC9B4C,GAAA,CAACW,OAAO,EAAA;AAAC9E,QAAAA,EAAE,EAAEiE,MAAO;AAACqB,QAAAA,WAAW,EAAElF,WAAY;AAAC2E,QAAAA,OAAO,EAAC,MAAM;AAACE,QAAAA,UAAU,EAAC,QAAQ;QAAA7F,QAAA,eAC/E+E,GAAA,CAAC/C,IAAI,EAAA;AAAC7C,UAAAA,KAAK,EAAE2B,SAAU;AAACZ,UAAAA,IAAI,EAAEa,QAAAA;SAAW,CAAA;OAClC,CAAC,GACR,IAAI,CAAA;KACD,CAAA;AAAC,GAAA,CACI,CAAC,CAAA;AAErB,CAAC,CAAA;AAEKoF,IAAAA,QAAQ,gBAAGC,wBAAwB,eAACC,cAAK,CAACC,UAAU,CAACzE,SAAS,CAAC,EAAE;AACrE0E,EAAAA,WAAW,EAAE,UAAU;AACvBC,EAAAA,WAAW,EAAE,UAAA;AACf,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"BaseLink.js","sources":["../../../../../../../src/components/Link/BaseLink/BaseLink.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/prefer-ts-expect-error */\n/* eslint-disable @typescript-eslint/ban-ts-comment */\nimport type { SyntheticEvent } from 'react';\nimport React from 'react';\nimport type { CSSObject } from 'styled-components';\nimport type { GestureResponderEvent } from 'react-native';\nimport StyledBaseLink from './StyledBaseLink';\nimport getIn from '~utils/lodashButBetter/get';\nimport useInteraction from '~utils/useInteraction';\nimport type { IconColors, IconComponent, IconProps } from '~components/Icons';\nimport type { Theme } from '~components/BladeProvider';\nimport { useTheme } from '~components/BladeProvider';\nimport BaseBox from '~components/Box/BaseBox';\nimport { BaseText } from '~components/Typography/BaseText';\nimport type {\n DotNotationSpacingStringToken,\n StringChildrenType,\n TestID,\n BladeElementRef,\n} from '~utils/types';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { Platform } from '~utils';\nimport { isReactNative } from '~utils';\nimport type { DurationString, EasingString, FontSize, Typography } from '~tokens/global';\nimport type {\n BaseTextProps,\n BaseTextSizes,\n TextColors,\n} from '~components/Typography/BaseText/types';\nimport { getStringFromReactText } from '~src/utils/getStringChildren';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { AccessibilityProps } from '~utils/makeAccessible';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport type { BladeCommonEvents } from '~components/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { throwBladeError } from '~utils/logger';\nimport type { ActionStates } from '~utils/useInteraction';\n\ntype BaseLinkCommonProps = {\n color?: 'primary' | 'white' | 'positive' | 'negative' | 'notice' | 'information' | 'neutral';\n icon?: IconComponent;\n iconPosition?: 'left' | 'right';\n onClick?: (event: SyntheticEvent) => void;\n onBlur?: Platform.Select<{\n native: (event: GestureResponderEvent) => void;\n web: (event: React.FocusEvent<HTMLButtonElement>) => void;\n }>;\n onMouseLeave?: Platform.Select<{\n native: (event: GestureResponderEvent) => void;\n web: (event: React.MouseEvent<HTMLButtonElement>) => void;\n }>;\n onKeyDown?: Platform.Select<{\n native: (event: GestureResponderEvent) => void;\n web: (event: React.KeyboardEvent<HTMLButtonElement>) => void;\n }>;\n accessibilityProps?: Partial<AccessibilityProps>;\n\n /**\n * Sets the size of the link\n *\n * @default medium\n */\n size?: Extract<BaseTextSizes, 'xsmall' | 'small' | 'medium' | 'large'>;\n /**\n * Defines how far your touch can start away from the link. This is a react-native only prop and has no effect on web.\n */\n hitSlop?:\n | {\n top?: number;\n right?: number;\n bottom?: number;\n left?: number;\n }\n | number;\n /**\n * The title of the link which is displayed as a tooltip. This is a web only prop and has no effect on react-native.\n */\n htmlTitle?: string;\n opacity?: number;\n} & TestID &\n StyledPropsBlade &\n Omit<BladeCommonEvents, 'onBlur' | 'onMouseLeave'>;\n\n/*\n Mandatory children prop when icon is not provided\n*/\ntype BaseLinkWithoutIconProps = BaseLinkCommonProps & {\n icon?: undefined;\n children: StringChildrenType;\n};\n\n/*\n Optional children prop when icon is provided\n*/\ntype BaseLinkWithIconProps = BaseLinkCommonProps & {\n icon: IconComponent;\n children?: StringChildrenType;\n};\n\n/*\n BaseLink Props with or without an icon\n*/\ntype BaseLinkPropsWithOrWithoutIcon = BaseLinkWithIconProps | BaseLinkWithoutIconProps;\n\n/*\n BaseLink Props when variant is anchor\n*/\ntype BaseLinkAnchorVariantProps = BaseLinkPropsWithOrWithoutIcon & {\n variant?: 'anchor';\n href?: string;\n target?: string;\n rel?: string;\n isDisabled?: undefined;\n};\n\n/*\n BaseLink Props when variant is button\n*/\ntype BaseLinkButtonVariantProps = BaseLinkPropsWithOrWithoutIcon & {\n variant?: 'button';\n isDisabled?: boolean;\n href?: undefined;\n target?: undefined;\n rel?: undefined;\n};\n\n/*\n BaseLink Props when variant is anchor or button\n*/\nexport type BaseLinkProps = BaseLinkAnchorVariantProps | BaseLinkButtonVariantProps;\n\ntype BaseLinkStyleProps = {\n as: 'a' | 'button';\n textDecorationLine: 'underline' | 'none';\n iconColor: IconProps['color'];\n iconSize: IconProps['size'];\n iconPadding: DotNotationSpacingStringToken;\n textColor: BaseTextProps['color'];\n focusRingColor: string;\n motionDuration: DurationString;\n motionEasing: EasingString;\n cursor: CSSObject['cursor'];\n disabled: boolean;\n role: 'button' | 'link';\n defaultRel: BaseLinkProps['rel'];\n type?: 'button';\n fontSize: BaseTextProps['fontSize'];\n lineHeight: BaseTextProps['lineHeight'];\n};\n\ntype LinkActionStates = ActionStates;\nconst getColorToken = ({\n variant,\n color,\n currentInteraction,\n isDisabled,\n element,\n}: {\n variant: BaseLinkProps['variant'];\n color: BaseLinkProps['color'];\n element: 'icon' | 'text';\n currentInteraction: LinkActionStates;\n isDisabled: boolean;\n}): IconColors | TextColors => {\n let state = currentInteraction;\n const map = {\n default: 'normal',\n hover: 'subtle',\n focus: 'normal',\n disabled: 'disabled',\n } as const;\n\n if (isDisabled && variant == 'button') {\n state = 'disabled';\n }\n\n if (color && color !== 'primary') {\n if (color !== 'white') {\n return `interactive.${element}.${color}.${map[state]}`;\n }\n return `interactive.${element}.staticWhite.${map[state]}`;\n }\n return `interactive.${element}.primary.${map[state]}`;\n};\n\nconst getProps = ({\n theme,\n variant,\n currentInteraction,\n children,\n isDisabled,\n color,\n target,\n size,\n}: {\n theme: Theme;\n variant: NonNullable<BaseLinkProps['variant']>;\n currentInteraction: LinkActionStates;\n children?: string;\n isDisabled: boolean;\n color: BaseLinkProps['color'];\n target: BaseLinkProps['target'];\n size: NonNullable<BaseLinkProps['size']>;\n}): BaseLinkStyleProps => {\n const isButton = variant === 'button';\n const textSizes: {\n fontSize: Record<NonNullable<BaseLinkProps['size']>, keyof FontSize>;\n lineHeight: Record<NonNullable<BaseLinkProps['size']>, keyof Typography['lineHeights']>;\n } = {\n fontSize: {\n xsmall: 25,\n small: 75,\n medium: 100,\n large: 200,\n },\n lineHeight: {\n xsmall: 25,\n small: 75,\n medium: 100,\n large: 200,\n },\n };\n\n const props: BaseLinkStyleProps = {\n as: isButton ? 'button' : 'a',\n textDecorationLine: !isButton && currentInteraction !== 'default' ? 'underline' : 'none',\n iconColor: getColorToken({\n variant,\n color,\n element: 'icon',\n currentInteraction,\n isDisabled,\n }) as IconProps['color'],\n fontSize: textSizes.fontSize[size],\n lineHeight: textSizes.lineHeight[size],\n iconSize: size,\n iconPadding: children?.trim() ? 'spacing.2' : 'spacing.0',\n textColor: getColorToken({\n variant,\n color,\n element: 'text',\n currentInteraction,\n isDisabled,\n }) as BaseTextProps['color'],\n focusRingColor: getIn(theme.colors, 'interactive.background.primary.faded'),\n motionDuration: 'duration.2xquick',\n motionEasing: 'easing.standard.effective',\n cursor: isButton && isDisabled ? 'not-allowed' : 'pointer',\n disabled: isButton && isDisabled,\n role: isButton ? 'button' : 'link',\n defaultRel: target && target === '_blank' ? 'noreferrer noopener' : undefined,\n type: isButton ? 'button' : undefined,\n };\n\n return props;\n};\n\nconst _BaseLink: React.ForwardRefRenderFunction<BladeElementRef, BaseLinkProps> = (\n {\n children,\n icon: Icon,\n iconPosition = 'left',\n isDisabled = false,\n onClick,\n onKeyDown,\n variant = 'anchor',\n href,\n target,\n rel,\n color = 'primary',\n opacity,\n accessibilityProps,\n // @ts-expect-error avoiding exposing to public\n className,\n // @ts-expect-error avoiding exposing to public\n style,\n size = 'medium',\n testID,\n hitSlop,\n htmlTitle,\n onBlur,\n onFocus,\n onMouseLeave,\n onMouseMove,\n onPointerDown,\n onPointerEnter,\n onTouchStart,\n onTouchEnd,\n onMouseDown,\n onMouseUp,\n ...styledProps\n },\n ref,\n) => {\n const childrenString = getStringFromReactText(children);\n const { currentInteraction, setCurrentInteraction, ...syntheticEvents } = useInteraction();\n const { theme } = useTheme();\n if (__DEV__) {\n if (!Icon && !childrenString?.trim()) {\n throwBladeError({\n message: `At least one of icon or text is required to render a link.`,\n moduleName: 'BaseLink',\n });\n }\n }\n const {\n as,\n textDecorationLine,\n iconColor,\n iconPadding,\n iconSize,\n fontSize,\n textColor,\n focusRingColor,\n motionDuration,\n motionEasing,\n cursor,\n disabled,\n role,\n defaultRel,\n type,\n lineHeight,\n } = getProps({\n theme,\n variant,\n currentInteraction,\n children: childrenString,\n isDisabled,\n color,\n target,\n size,\n });\n\n const handleOnClick = (event: SyntheticEvent): void => {\n if (onClick) {\n onClick(event);\n }\n };\n\n const asProp = isReactNative() ? undefined : 'span';\n return (\n <StyledBaseLink\n ref={ref as never}\n {...metaAttribute({ name: MetaConstants.Link, testID })}\n accessibilityProps={{\n ...makeAccessible({\n role,\n disabled,\n ...accessibilityProps,\n }),\n }}\n variant={variant}\n as={as}\n href={href}\n target={target}\n rel={rel ?? defaultRel}\n onClick={handleOnClick}\n {...syntheticEvents}\n onBlur={(event: any) => {\n onBlur?.(event);\n syntheticEvents.onBlur();\n }}\n onFocus={(event: any) => {\n onFocus?.(event);\n syntheticEvents.onFocus();\n }}\n onMouseLeave={(event: any) => {\n if (onMouseLeave) {\n onMouseLeave(event);\n }\n syntheticEvents.onMouseLeave();\n }}\n onMouseMove={onMouseMove}\n onPointerDown={onPointerDown}\n onPointerEnter={onPointerEnter}\n onTouchStart={onTouchStart}\n onTouchEnd={onTouchEnd}\n onKeyDown={onKeyDown}\n onMouseDown={onMouseDown}\n onMouseUp={onMouseUp}\n disabled={disabled}\n type={type}\n cursor={cursor}\n focusRingColor={focusRingColor}\n motionDuration={motionDuration}\n motionEasing={motionEasing}\n setCurrentInteraction={setCurrentInteraction}\n {...getStyledProps(styledProps)}\n // @ts-ignore Because we avoided exposing className to public\n className={className}\n style={style}\n hitSlop={hitSlop}\n title={htmlTitle}\n >\n <BaseBox\n as={asProp}\n display=\"flex\"\n flexDirection=\"row\"\n className=\"content-container\"\n alignItems=\"center\"\n opacity={opacity}\n >\n {Icon && iconPosition == 'left' ? (\n <BaseBox as={asProp} paddingRight={iconPadding} display=\"flex\" alignItems=\"center\">\n <Icon color={iconColor} size={iconSize} />\n </BaseBox>\n ) : null}\n <BaseText\n as={asProp}\n textDecorationLine={textDecorationLine}\n color={textColor}\n fontSize={fontSize}\n lineHeight={lineHeight}\n textAlign=\"center\"\n fontWeight=\"medium\"\n >\n {children}\n </BaseText>\n {Icon && iconPosition == 'right' ? (\n <BaseBox as={asProp} paddingLeft={iconPadding} display=\"flex\" alignItems=\"center\">\n <Icon color={iconColor} size={iconSize} />\n </BaseBox>\n ) : null}\n </BaseBox>\n </StyledBaseLink>\n );\n};\n\nconst BaseLink = assignWithoutSideEffects(React.forwardRef(_BaseLink), {\n displayName: 'BaseLink',\n componentId: 'BaseLink',\n});\n\nexport default BaseLink;\n"],"names":["getColorToken","_ref","variant","color","currentInteraction","isDisabled","element","state","map","hover","focus","disabled","concat","getProps","_ref2","theme","children","target","size","isButton","textSizes","fontSize","xsmall","small","medium","large","lineHeight","props","as","textDecorationLine","iconColor","iconSize","iconPadding","trim","textColor","focusRingColor","getIn","colors","motionDuration","motionEasing","cursor","role","defaultRel","undefined","type","_BaseLink","_ref3","ref","Icon","icon","_ref3$iconPosition","iconPosition","_ref3$isDisabled","onClick","onKeyDown","_ref3$variant","href","rel","_ref3$color","opacity","accessibilityProps","className","style","_ref3$size","testID","hitSlop","htmlTitle","onBlur","onFocus","onMouseLeave","onMouseMove","onPointerDown","onPointerEnter","onTouchStart","onTouchEnd","onMouseDown","onMouseUp","styledProps","_objectWithoutProperties","_excluded","childrenString","getStringFromReactText","_useInteraction","useInteraction","setCurrentInteraction","syntheticEvents","_excluded2","_useTheme","useTheme","throwBladeError","message","moduleName","_getProps","handleOnClick","event","asProp","isReactNative","_jsx","StyledBaseLink","_objectSpread","metaAttribute","name","MetaConstants","Link","makeAccessible","getStyledProps","title","_jsxs","BaseBox","display","flexDirection","alignItems","paddingRight","BaseText","textAlign","fontWeight","paddingLeft","BaseLink","assignWithoutSideEffects","React","forwardRef","displayName","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyJA,IAAMA,aAAa,GAAG,SAAhBA,aAAaA,CAAAC,IAAA,EAYY;AAAA,EAAA,IAX7BC,OAAO,GAAAD,IAAA,CAAPC,OAAO;IACPC,KAAK,GAAAF,IAAA,CAALE,KAAK;IACLC,kBAAkB,GAAAH,IAAA,CAAlBG,kBAAkB;IAClBC,UAAU,GAAAJ,IAAA,CAAVI,UAAU;IACVC,OAAO,GAAAL,IAAA,CAAPK,OAAO,CAAA;EAQP,IAAIC,KAAK,GAAGH,kBAAkB,CAAA;AAC9B,EAAA,IAAMI,GAAG,GAAG;AACV,IAAA,SAAA,EAAS,QAAQ;AACjBC,IAAAA,KAAK,EAAE,QAAQ;AACfC,IAAAA,KAAK,EAAE,QAAQ;AACfC,IAAAA,QAAQ,EAAE,UAAA;GACF,CAAA;AAEV,EAAA,IAAIN,UAAU,IAAIH,OAAO,IAAI,QAAQ,EAAE;AACrCK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AAU,EAAC,QAAQ;QAAA/F,QAAA,eAC/EiF,GAAA,CAACjD,IAAI,EAAA;AAAC7C,UAAAA,KAAK,EAAE2B,SAAU;AAACZ,UAAAA,IAAI,EAAEa,QAAAA;SAAW,CAAA;OAClC,CAAC,GACR,IAAI,CAAA;KACD,CAAA;AAAC,GAAA,CACI,CAAC,CAAA;AAErB,CAAC,CAAA;AAEKsF,IAAAA,QAAQ,gBAAGC,wBAAwB,eAACC,cAAK,CAACC,UAAU,CAAC3E,SAAS,CAAC,EAAE;AACrE4E,EAAAA,WAAW,EAAE,UAAU;AACvBC,EAAAA,WAAW,EAAE,UAAA;AACf,CAAC;;;;"}
|
|
@@ -9,7 +9,7 @@ import BaseLink from '../BaseLink/BaseLink.js';
|
|
|
9
9
|
import { getStyledProps } from '../../Box/styledProps/getStyledProps.js';
|
|
10
10
|
import { assignWithoutSideEffects } from '../../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
|
|
11
11
|
|
|
12
|
-
var _excluded = ["children", "icon", "iconPosition", "isDisabled", "onClick", "variant", "color", "href", "target", "rel", "accessibilityLabel", "size", "testID", "hitSlop", "htmlTitle", "onBlur", "onFocus", "onMouseLeave", "onMouseMove", "onPointerDown", "onPointerEnter", "onTouchStart", "onTouchEnd"];
|
|
12
|
+
var _excluded = ["children", "icon", "iconPosition", "isDisabled", "onClick", "variant", "color", "href", "target", "rel", "accessibilityLabel", "size", "testID", "hitSlop", "htmlTitle", "onBlur", "onFocus", "onMouseLeave", "onMouseMove", "onPointerDown", "onPointerEnter", "onTouchStart", "onTouchEnd", "onMouseDown", "onMouseUp"];
|
|
13
13
|
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; }
|
|
14
14
|
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; }
|
|
15
15
|
var _Link = function _Link(_ref, ref) {
|
|
@@ -41,6 +41,8 @@ var _Link = function _Link(_ref, ref) {
|
|
|
41
41
|
onPointerEnter = _ref.onPointerEnter,
|
|
42
42
|
onTouchStart = _ref.onTouchStart,
|
|
43
43
|
onTouchEnd = _ref.onTouchEnd,
|
|
44
|
+
onMouseDown = _ref.onMouseDown,
|
|
45
|
+
onMouseUp = _ref.onMouseUp,
|
|
44
46
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
45
47
|
return /*#__PURE__*/jsx(BaseLink, _objectSpread(_objectSpread(_objectSpread({}, icon ? {
|
|
46
48
|
icon: icon,
|
|
@@ -75,7 +77,9 @@ var _Link = function _Link(_ref, ref) {
|
|
|
75
77
|
onPointerDown: onPointerDown,
|
|
76
78
|
onPointerEnter: onPointerEnter,
|
|
77
79
|
onTouchStart: onTouchStart,
|
|
78
|
-
onTouchEnd: onTouchEnd
|
|
80
|
+
onTouchEnd: onTouchEnd,
|
|
81
|
+
onMouseDown: onMouseDown,
|
|
82
|
+
onMouseUp: onMouseUp
|
|
79
83
|
}, getStyledProps(rest)));
|
|
80
84
|
};
|
|
81
85
|
var Link = /*#__PURE__*/assignWithoutSideEffects( /*#__PURE__*/React__default.forwardRef(_Link), {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.js","sources":["../../../../../../../src/components/Link/Link/Link.tsx"],"sourcesContent":["import type { ReactElement, SyntheticEvent } from 'react';\nimport React from 'react';\nimport type { BaseLinkProps } from '../BaseLink';\nimport { BaseLink } from '../BaseLink';\nimport type { IconComponent } from '~components/Icons';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StringChildrenType, TestID, BladeElementRef } from '~utils/types';\nimport type { Platform } from '~utils';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport type { BladeCommonEvents } from '~components/types';\n\ntype LinkCommonProps = {\n variant?: 'anchor' | 'button';\n icon?: IconComponent;\n color?: 'primary' | 'white' | 'neutral';\n iconPosition?: 'left' | 'right';\n isDisabled?: boolean;\n onClick?: (event: SyntheticEvent) => void;\n href?: string;\n target?: string;\n accessibilityLabel?: string;\n\n /**\n * It is exposed for internal usage with tooltip.\n *\n * @private\n */\n 'aria-describedby'?: string;\n\n /**\n * Sets the size of the link\n *\n * @default medium\n */\n size?: BaseLinkProps['size'];\n} & TestID &\n StyledPropsBlade &\n BladeCommonEvents &\n Platform.Select<{\n native: {\n /**\n * Defines how far your touch can start away from the link\n */\n hitSlop?:\n | {\n top?: number;\n right?: number;\n bottom?: number;\n left?: number;\n }\n | number;\n /**\n * This is a web only prop and has no effect on react-native.\n */\n htmlTitle?: undefined;\n };\n web: {\n /**\n * This is a react-native only prop and has no effect on web.\n */\n hitSlop?: undefined;\n /**\n * The title of the link which is displayed as a tooltip.\n */\n htmlTitle?: string;\n };\n }>;\n\n/*\n Mandatory children prop when icon is not provided\n*/\ntype LinkWithoutIconProps = LinkCommonProps & {\n icon?: undefined;\n children: StringChildrenType;\n};\n\n/*\n Optional children prop when icon is provided\n*/\ntype LinkWithIconProps = LinkCommonProps & {\n icon: IconComponent;\n children?: StringChildrenType;\n};\n\n/*\n Link Props with or without an icon\n*/\ntype LinkPropsWithOrWithoutIcon = LinkWithIconProps | LinkWithoutIconProps;\n\n/*\n Link Props when variant is anchor\n*/\ntype LinkAnchorVariantProps = LinkPropsWithOrWithoutIcon & {\n variant?: 'anchor';\n href?: string;\n target?: string;\n rel?: string;\n isDisabled?: undefined;\n};\n\n/*\n Link Props when variant is button\n*/\nexport type LinkButtonVariantProps = LinkPropsWithOrWithoutIcon & {\n variant?: 'button';\n isDisabled?: boolean;\n href?: undefined;\n target?: undefined;\n rel?: undefined;\n};\n\n/*\n Link Props when variant is anchor or button\n*/\nexport type LinkProps = LinkAnchorVariantProps | LinkButtonVariantProps;\n\nconst _Link: React.ForwardRefRenderFunction<BladeElementRef, LinkProps> = (\n {\n children,\n icon,\n iconPosition = 'left',\n isDisabled = false,\n onClick,\n variant = 'anchor',\n color = 'primary',\n href,\n target,\n rel,\n accessibilityLabel,\n size = 'medium',\n testID,\n hitSlop,\n htmlTitle,\n onBlur,\n onFocus,\n onMouseLeave,\n onMouseMove,\n onPointerDown,\n onPointerEnter,\n onTouchStart,\n onTouchEnd,\n ...rest\n },\n ref,\n): ReactElement => {\n return (\n <BaseLink\n {...(icon ? { icon, children } : { children })}\n {...(variant === 'anchor' ? { variant, href, target, rel } : { variant, isDisabled })}\n ref={ref as never}\n iconPosition={iconPosition}\n onClick={onClick}\n accessibilityProps={{ label: accessibilityLabel, describedBy: rest['aria-describedby'] }}\n size={size}\n color={color}\n testID={testID}\n hitSlop={hitSlop}\n htmlTitle={htmlTitle}\n onBlur={onBlur}\n onFocus={onFocus}\n onMouseLeave={onMouseLeave}\n onMouseMove={onMouseMove}\n onPointerDown={onPointerDown}\n onPointerEnter={onPointerEnter}\n onTouchStart={onTouchStart}\n onTouchEnd={onTouchEnd}\n {...getStyledProps(rest)}\n />\n );\n};\n\nconst Link = assignWithoutSideEffects(React.forwardRef(_Link), {\n displayName: 'Link',\n componentId: 'Link',\n});\n\nexport default Link;\n"],"names":["_Link","_ref","ref","children","icon","_ref$iconPosition","iconPosition","_ref$isDisabled","isDisabled","onClick","_ref$variant","variant","_ref$color","color","href","target","rel","accessibilityLabel","_ref$size","size","testID","hitSlop","htmlTitle","onBlur","onFocus","onMouseLeave","onMouseMove","onPointerDown","onPointerEnter","onTouchStart","onTouchEnd","rest","_objectWithoutProperties","_excluded","_jsx","BaseLink","_objectSpread","accessibilityProps","label","describedBy","getStyledProps","Link","assignWithoutSideEffects","React","forwardRef","displayName","componentId"],"mappings":";;;;;;;;;;;;;;AAqHA,IAAMA,KAAiE,GAAG,SAApEA,KAAiEA,CAAAC,IAAA,
|
|
1
|
+
{"version":3,"file":"Link.js","sources":["../../../../../../../src/components/Link/Link/Link.tsx"],"sourcesContent":["import type { ReactElement, SyntheticEvent } from 'react';\nimport React from 'react';\nimport type { BaseLinkProps } from '../BaseLink';\nimport { BaseLink } from '../BaseLink';\nimport type { IconComponent } from '~components/Icons';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StringChildrenType, TestID, BladeElementRef } from '~utils/types';\nimport type { Platform } from '~utils';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport type { BladeCommonEvents } from '~components/types';\n\ntype LinkCommonProps = {\n variant?: 'anchor' | 'button';\n icon?: IconComponent;\n color?: 'primary' | 'white' | 'neutral';\n iconPosition?: 'left' | 'right';\n isDisabled?: boolean;\n onClick?: (event: SyntheticEvent) => void;\n href?: string;\n target?: string;\n accessibilityLabel?: string;\n\n /**\n * It is exposed for internal usage with tooltip.\n *\n * @private\n */\n 'aria-describedby'?: string;\n\n /**\n * Sets the size of the link\n *\n * @default medium\n */\n size?: BaseLinkProps['size'];\n} & TestID &\n StyledPropsBlade &\n BladeCommonEvents &\n Platform.Select<{\n native: {\n /**\n * Defines how far your touch can start away from the link\n */\n hitSlop?:\n | {\n top?: number;\n right?: number;\n bottom?: number;\n left?: number;\n }\n | number;\n /**\n * This is a web only prop and has no effect on react-native.\n */\n htmlTitle?: undefined;\n };\n web: {\n /**\n * This is a react-native only prop and has no effect on web.\n */\n hitSlop?: undefined;\n /**\n * The title of the link which is displayed as a tooltip.\n */\n htmlTitle?: string;\n };\n }>;\n\n/*\n Mandatory children prop when icon is not provided\n*/\ntype LinkWithoutIconProps = LinkCommonProps & {\n icon?: undefined;\n children: StringChildrenType;\n};\n\n/*\n Optional children prop when icon is provided\n*/\ntype LinkWithIconProps = LinkCommonProps & {\n icon: IconComponent;\n children?: StringChildrenType;\n};\n\n/*\n Link Props with or without an icon\n*/\ntype LinkPropsWithOrWithoutIcon = LinkWithIconProps | LinkWithoutIconProps;\n\n/*\n Link Props when variant is anchor\n*/\ntype LinkAnchorVariantProps = LinkPropsWithOrWithoutIcon & {\n variant?: 'anchor';\n href?: string;\n target?: string;\n rel?: string;\n isDisabled?: undefined;\n};\n\n/*\n Link Props when variant is button\n*/\nexport type LinkButtonVariantProps = LinkPropsWithOrWithoutIcon & {\n variant?: 'button';\n isDisabled?: boolean;\n href?: undefined;\n target?: undefined;\n rel?: undefined;\n};\n\n/*\n Link Props when variant is anchor or button\n*/\nexport type LinkProps = LinkAnchorVariantProps | LinkButtonVariantProps;\n\nconst _Link: React.ForwardRefRenderFunction<BladeElementRef, LinkProps> = (\n {\n children,\n icon,\n iconPosition = 'left',\n isDisabled = false,\n onClick,\n variant = 'anchor',\n color = 'primary',\n href,\n target,\n rel,\n accessibilityLabel,\n size = 'medium',\n testID,\n hitSlop,\n htmlTitle,\n onBlur,\n onFocus,\n onMouseLeave,\n onMouseMove,\n onPointerDown,\n onPointerEnter,\n onTouchStart,\n onTouchEnd,\n onMouseDown,\n onMouseUp,\n ...rest\n },\n ref,\n): ReactElement => {\n return (\n <BaseLink\n {...(icon ? { icon, children } : { children })}\n {...(variant === 'anchor' ? { variant, href, target, rel } : { variant, isDisabled })}\n ref={ref as never}\n iconPosition={iconPosition}\n onClick={onClick}\n accessibilityProps={{ label: accessibilityLabel, describedBy: rest['aria-describedby'] }}\n size={size}\n color={color}\n testID={testID}\n hitSlop={hitSlop}\n htmlTitle={htmlTitle}\n onBlur={onBlur}\n onFocus={onFocus}\n onMouseLeave={onMouseLeave}\n onMouseMove={onMouseMove}\n onPointerDown={onPointerDown}\n onPointerEnter={onPointerEnter}\n onTouchStart={onTouchStart}\n onTouchEnd={onTouchEnd}\n onMouseDown={onMouseDown}\n onMouseUp={onMouseUp}\n {...getStyledProps(rest)}\n />\n );\n};\n\nconst Link = assignWithoutSideEffects(React.forwardRef(_Link), {\n displayName: 'Link',\n componentId: 'Link',\n});\n\nexport default Link;\n"],"names":["_Link","_ref","ref","children","icon","_ref$iconPosition","iconPosition","_ref$isDisabled","isDisabled","onClick","_ref$variant","variant","_ref$color","color","href","target","rel","accessibilityLabel","_ref$size","size","testID","hitSlop","htmlTitle","onBlur","onFocus","onMouseLeave","onMouseMove","onPointerDown","onPointerEnter","onTouchStart","onTouchEnd","onMouseDown","onMouseUp","rest","_objectWithoutProperties","_excluded","_jsx","BaseLink","_objectSpread","accessibilityProps","label","describedBy","getStyledProps","Link","assignWithoutSideEffects","React","forwardRef","displayName","componentId"],"mappings":";;;;;;;;;;;;;;AAqHA,IAAMA,KAAiE,GAAG,SAApEA,KAAiEA,CAAAC,IAAA,EA6BrEC,GAAG,EACc;AAAA,EAAA,IA5BfC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,IAAI,GAAAH,IAAA,CAAJG,IAAI;IAAAC,iBAAA,GAAAJ,IAAA,CACJK,YAAY;AAAZA,IAAAA,YAAY,GAAAD,iBAAA,KAAG,KAAA,CAAA,GAAA,MAAM,GAAAA,iBAAA;IAAAE,eAAA,GAAAN,IAAA,CACrBO,UAAU;AAAVA,IAAAA,UAAU,GAAAD,eAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,eAAA;IAClBE,OAAO,GAAAR,IAAA,CAAPQ,OAAO;IAAAC,YAAA,GAAAT,IAAA,CACPU,OAAO;AAAPA,IAAAA,OAAO,GAAAD,YAAA,KAAG,KAAA,CAAA,GAAA,QAAQ,GAAAA,YAAA;IAAAE,UAAA,GAAAX,IAAA,CAClBY,KAAK;AAALA,IAAAA,KAAK,GAAAD,UAAA,KAAG,KAAA,CAAA,GAAA,SAAS,GAAAA,UAAA;IACjBE,IAAI,GAAAb,IAAA,CAAJa,IAAI;IACJC,MAAM,GAAAd,IAAA,CAANc,MAAM;IACNC,GAAG,GAAAf,IAAA,C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,EAAPA,OAAO;AAAEH,IAAAA,UAAU,EAAVA,UAAAA;GAAY,CAAA,EAAA,EAAA,EAAA;AACpFN,IAAAA,GAAG,EAAEA,GAAa;AAClBI,IAAAA,YAAY,EAAEA,YAAa;AAC3BG,IAAAA,OAAO,EAAEA,OAAQ;AACjB8B,IAAAA,kBAAkB,EAAE;AAAEC,MAAAA,KAAK,EAAEvB,kBAAkB;MAAEwB,WAAW,EAAER,IAAI,CAAC,kBAAkB,CAAA;KAAI;AACzFd,IAAAA,IAAI,EAAEA,IAAK;AACXN,IAAAA,KAAK,EAAEA,KAAM;AACbO,IAAAA,MAAM,EAAEA,MAAO;AACfC,IAAAA,OAAO,EAAEA,OAAQ;AACjBC,IAAAA,SAAS,EAAEA,SAAU;AACrBC,IAAAA,MAAM,EAAEA,MAAO;AACfC,IAAAA,OAAO,EAAEA,OAAQ;AACjBC,IAAAA,YAAY,EAAEA,YAAa;AAC3BC,IAAAA,WAAW,EAAEA,WAAY;AACzBC,IAAAA,aAAa,EAAEA,aAAc;AAC7BC,IAAAA,cAAc,EAAEA,cAAe;AAC/BC,IAAAA,YAAY,EAAEA,YAAa;AAC3BC,IAAAA,UAAU,EAAEA,UAAW;AACvBC,IAAAA,WAAW,EAAEA,WAAY;AACzBC,IAAAA,SAAS,EAAEA,SAAAA;AAAU,GAAA,EACjBU,cAAc,CAACT,IAAI,CAAC,CACzB,CAAC,CAAA;AAEN,CAAC,CAAA;AAEKU,IAAAA,IAAI,gBAAGC,wBAAwB,eAACC,cAAK,CAACC,UAAU,CAAC9C,KAAK,CAAC,EAAE;AAC7D+C,EAAAA,WAAW,EAAE,MAAM;AACnBC,EAAAA,WAAW,EAAE,MAAA;AACf,CAAC;;;;"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
3
|
+
import { useMergeRefs, FloatingNode, FloatingList, FloatingPortal, FloatingFocusManager, useFloatingParentNodeId, FloatingTree } from '@floating-ui/react';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { useMenu, useFloatingMenuSetup, MenuContext } from './useMenu.js';
|
|
6
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
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; }
|
|
9
|
+
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; }
|
|
10
|
+
var MenuTree = function MenuTree(_ref) {
|
|
11
|
+
var children = _ref.children,
|
|
12
|
+
_ref$openInteraction = _ref.openInteraction,
|
|
13
|
+
openInteraction = _ref$openInteraction === void 0 ? 'click' : _ref$openInteraction,
|
|
14
|
+
onOpenChange = _ref.onOpenChange,
|
|
15
|
+
isOpenControlled = _ref.isOpen;
|
|
16
|
+
var _React$useState = React.useState(false),
|
|
17
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
18
|
+
hasFocusInside = _React$useState2[0],
|
|
19
|
+
setHasFocusInside = _React$useState2[1];
|
|
20
|
+
var elementsRef = React.useRef([]);
|
|
21
|
+
var labelsRef = React.useRef([]);
|
|
22
|
+
var parent = useMenu();
|
|
23
|
+
var _useFloatingMenuSetup = useFloatingMenuSetup({
|
|
24
|
+
elementsRef: elementsRef,
|
|
25
|
+
openInteraction: openInteraction,
|
|
26
|
+
onOpenChange: onOpenChange,
|
|
27
|
+
isOpen: isOpenControlled
|
|
28
|
+
}),
|
|
29
|
+
getReferenceProps = _useFloatingMenuSetup.getReferenceProps,
|
|
30
|
+
getFloatingProps = _useFloatingMenuSetup.getFloatingProps,
|
|
31
|
+
getItemProps = _useFloatingMenuSetup.getItemProps,
|
|
32
|
+
item = _useFloatingMenuSetup.item,
|
|
33
|
+
refs = _useFloatingMenuSetup.refs,
|
|
34
|
+
floatingStyles = _useFloatingMenuSetup.floatingStyles,
|
|
35
|
+
isOpen = _useFloatingMenuSetup.isOpen,
|
|
36
|
+
nodeId = _useFloatingMenuSetup.nodeId,
|
|
37
|
+
isNested = _useFloatingMenuSetup.isNested,
|
|
38
|
+
context = _useFloatingMenuSetup.context,
|
|
39
|
+
isMounted = _useFloatingMenuSetup.isMounted,
|
|
40
|
+
floatingTransitionStyles = _useFloatingMenuSetup.floatingTransitionStyles;
|
|
41
|
+
var referenceProps = _objectSpread({
|
|
42
|
+
ref: useMergeRefs([refs.setReference, item.ref])
|
|
43
|
+
}, getReferenceProps(parent.getItemProps({
|
|
44
|
+
onFocus: function onFocus() {
|
|
45
|
+
setHasFocusInside(false);
|
|
46
|
+
parent.setHasFocusInside(true);
|
|
47
|
+
}
|
|
48
|
+
})));
|
|
49
|
+
var floatingProps = _objectSpread({
|
|
50
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
51
|
+
ref: refs.setFloating,
|
|
52
|
+
style: floatingStyles,
|
|
53
|
+
_transitionStyle: floatingTransitionStyles
|
|
54
|
+
}, getFloatingProps());
|
|
55
|
+
var _ref2 = React.Children.toArray(children),
|
|
56
|
+
_ref3 = _slicedToArray(_ref2, 2),
|
|
57
|
+
menuTriggerChild = _ref3[0],
|
|
58
|
+
menuOverlayChild = _ref3[1];
|
|
59
|
+
var triggerWithReferenceProps = /*#__PURE__*/React.cloneElement(menuTriggerChild, _objectSpread(_objectSpread(_objectSpread({}, menuTriggerChild.props), referenceProps), {}, {
|
|
60
|
+
_hasFocusInside: hasFocusInside,
|
|
61
|
+
_isMenuTrigger: true
|
|
62
|
+
}));
|
|
63
|
+
var overlayWithFloatingProps = /*#__PURE__*/React.cloneElement(menuOverlayChild, _objectSpread(_objectSpread({}, menuOverlayChild.props), floatingProps));
|
|
64
|
+
return /*#__PURE__*/jsx(FloatingNode, {
|
|
65
|
+
id: nodeId,
|
|
66
|
+
children: /*#__PURE__*/jsxs(MenuContext.Provider, {
|
|
67
|
+
value: {
|
|
68
|
+
getItemProps: getItemProps,
|
|
69
|
+
setHasFocusInside: setHasFocusInside,
|
|
70
|
+
isOpen: isOpen
|
|
71
|
+
},
|
|
72
|
+
children: [triggerWithReferenceProps, /*#__PURE__*/jsx(FloatingList, {
|
|
73
|
+
elementsRef: elementsRef,
|
|
74
|
+
labelsRef: labelsRef,
|
|
75
|
+
children: isMounted && /*#__PURE__*/jsx(FloatingPortal, {
|
|
76
|
+
children: /*#__PURE__*/jsx(FloatingFocusManager, {
|
|
77
|
+
context: context,
|
|
78
|
+
modal: false,
|
|
79
|
+
initialFocus: -1,
|
|
80
|
+
returnFocus: !isNested,
|
|
81
|
+
children: overlayWithFloatingProps
|
|
82
|
+
})
|
|
83
|
+
})
|
|
84
|
+
})]
|
|
85
|
+
})
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
var Menu = function Menu(props) {
|
|
89
|
+
var parentId = useFloatingParentNodeId();
|
|
90
|
+
if (parentId === null) {
|
|
91
|
+
return /*#__PURE__*/jsx(FloatingTree, {
|
|
92
|
+
children: /*#__PURE__*/jsx(MenuTree, _objectSpread({}, props))
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
return /*#__PURE__*/jsx(MenuTree, _objectSpread({}, props));
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export { Menu };
|
|
99
|
+
//# sourceMappingURL=Menu.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Menu.web.js","sources":["../../../../../../src/components/Menu/Menu.web.tsx"],"sourcesContent":["import {\n FloatingFocusManager,\n FloatingList,\n FloatingNode,\n FloatingPortal,\n FloatingTree,\n useFloatingParentNodeId,\n useMergeRefs,\n} from '@floating-ui/react';\nimport * as React from 'react';\nimport { MenuContext, useFloatingMenuSetup, useMenu } from './useMenu';\nimport type { MenuProps } from './types';\n\nconst MenuTree = ({\n children,\n openInteraction = 'click',\n onOpenChange,\n isOpen: isOpenControlled,\n}: MenuProps): React.ReactElement => {\n const [hasFocusInside, setHasFocusInside] = React.useState(false);\n\n const elementsRef = React.useRef<(HTMLButtonElement | null)[]>([]);\n const labelsRef = React.useRef<(string | null)[]>([]);\n const parent = useMenu();\n\n const {\n getReferenceProps,\n getFloatingProps,\n getItemProps,\n item,\n refs,\n floatingStyles,\n isOpen,\n nodeId,\n isNested,\n context,\n isMounted,\n floatingTransitionStyles,\n } = useFloatingMenuSetup({\n elementsRef,\n openInteraction,\n onOpenChange,\n isOpen: isOpenControlled,\n });\n\n const referenceProps = {\n ref: useMergeRefs([refs.setReference, item.ref]),\n ...getReferenceProps(\n parent.getItemProps({\n onFocus() {\n setHasFocusInside(false);\n parent.setHasFocusInside(true);\n },\n }),\n ),\n };\n\n const floatingProps = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref: refs.setFloating as any,\n style: floatingStyles,\n _transitionStyle: floatingTransitionStyles,\n ...getFloatingProps(),\n };\n\n const [menuTriggerChild, menuOverlayChild] = React.Children.toArray(children) as [\n React.ReactElement,\n React.ReactElement,\n ];\n\n const triggerWithReferenceProps = React.cloneElement(menuTriggerChild, {\n ...menuTriggerChild.props,\n ...referenceProps,\n _hasFocusInside: hasFocusInside,\n _isMenuTrigger: true,\n });\n\n const overlayWithFloatingProps = React.cloneElement(menuOverlayChild, {\n ...menuOverlayChild.props,\n ...floatingProps,\n });\n\n return (\n <FloatingNode id={nodeId}>\n <MenuContext.Provider\n value={{\n getItemProps,\n setHasFocusInside,\n isOpen,\n }}\n >\n {triggerWithReferenceProps}\n <FloatingList elementsRef={elementsRef} labelsRef={labelsRef}>\n {isMounted && (\n <FloatingPortal>\n <FloatingFocusManager\n context={context}\n modal={false}\n initialFocus={-1}\n returnFocus={!isNested}\n >\n {overlayWithFloatingProps}\n </FloatingFocusManager>\n </FloatingPortal>\n )}\n </FloatingList>\n </MenuContext.Provider>\n </FloatingNode>\n );\n};\n\nconst Menu = (props: MenuProps): React.ReactElement => {\n const parentId = useFloatingParentNodeId();\n\n if (parentId === null) {\n return (\n <FloatingTree>\n <MenuTree {...props} />\n </FloatingTree>\n );\n }\n\n return <MenuTree {...props} />;\n};\n\nexport { Menu };\n"],"names":["MenuTree","_ref","children","_ref$openInteraction","openInteraction","onOpenChange","isOpenControlled","isOpen","_React$useState","React","useState","_React$useState2","_slicedToArray","hasFocusInside","setHasFocusInside","elementsRef","useRef","labelsRef","parent","useMenu","_useFloatingMenuSetup","useFloatingMenuSetup","getReferenceProps","getFloatingProps","getItemProps","item","refs","floatingStyles","nodeId","isNested","context","isMounted","floatingTransitionStyles","referenceProps","_objectSpread","ref","useMergeRefs","setReference","onFocus","floatingProps","setFloating","style","_transitionStyle","_ref2","Children","toArray","_ref3","menuTriggerChild","menuOverlayChild","triggerWithReferenceProps","cloneElement","props","_hasFocusInside","_isMenuTrigger","overlayWithFloatingProps","_jsx","FloatingNode","id","_jsxs","MenuContext","Provider","value","FloatingList","FloatingPortal","FloatingFocusManager","modal","initialFocus","returnFocus","Menu","parentId","useFloatingParentNodeId","FloatingTree"],"mappings":";;;;;;;;;AAaA,IAAMA,QAAQ,GAAG,SAAXA,QAAQA,CAAAC,IAAA,EAKuB;AAAA,EAAA,IAJnCC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IAAAC,oBAAA,GAAAF,IAAA,CACRG,eAAe;AAAfA,IAAAA,eAAe,GAAAD,oBAAA,KAAG,KAAA,CAAA,GAAA,OAAO,GAAAA,oBAAA;IACzBE,YAAY,GAAAJ,IAAA,CAAZI,YAAY;IACJC,gBAAgB,GAAAL,IAAA,CAAxBM,MAAM,CAAA;AAEN,EAAA,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
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
3
|
+
import { useListItem, useFloatingTree, useMergeRefs } from '@floating-ui/react';
|
|
4
|
+
import React__default from 'react';
|
|
5
|
+
import { useMenu } from './useMenu.js';
|
|
6
|
+
import '../BaseMenu/index.js';
|
|
7
|
+
import '../Icons/index.js';
|
|
8
|
+
import { jsx } from 'react/jsx-runtime';
|
|
9
|
+
import { BaseMenuItem } from '../BaseMenu/BaseMenuItem/BaseMenuItem.js';
|
|
10
|
+
import ChevronRightIcon from '../Icons/ChevronRightIcon/ChevronRightIcon.js';
|
|
11
|
+
|
|
12
|
+
var _excluded = ["title", "isDisabled", "description", "leading", "trailing", "_isMenuTrigger", "_hasFocusInside", "href", "target", "children", "as"];
|
|
13
|
+
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; }
|
|
14
|
+
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; }
|
|
15
|
+
var MenuItem = /*#__PURE__*/React__default.forwardRef(function (_ref, forwardedRef) {
|
|
16
|
+
var title = _ref.title,
|
|
17
|
+
isDisabled = _ref.isDisabled,
|
|
18
|
+
description = _ref.description,
|
|
19
|
+
leading = _ref.leading,
|
|
20
|
+
trailing = _ref.trailing,
|
|
21
|
+
_isMenuTrigger = _ref._isMenuTrigger,
|
|
22
|
+
_hasFocusInside = _ref._hasFocusInside,
|
|
23
|
+
href = _ref.href,
|
|
24
|
+
target = _ref.target,
|
|
25
|
+
children = _ref.children,
|
|
26
|
+
as = _ref.as,
|
|
27
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
28
|
+
var menu = useMenu();
|
|
29
|
+
var item = useListItem({
|
|
30
|
+
label: isDisabled && Boolean(children) ? null : title
|
|
31
|
+
});
|
|
32
|
+
var tree = useFloatingTree();
|
|
33
|
+
var isLink = Boolean(href);
|
|
34
|
+
var defaultAs = isLink ? 'a' : 'button';
|
|
35
|
+
return /*#__PURE__*/jsx(BaseMenuItem, _objectSpread(_objectSpread(_objectSpread({
|
|
36
|
+
title: title,
|
|
37
|
+
description: description,
|
|
38
|
+
leading: leading,
|
|
39
|
+
trailing: _isMenuTrigger ? /*#__PURE__*/jsx(ChevronRightIcon, {
|
|
40
|
+
color: "interactive.icon.gray.muted"
|
|
41
|
+
}) : trailing,
|
|
42
|
+
as: as !== null && as !== void 0 ? as : defaultAs,
|
|
43
|
+
href: href,
|
|
44
|
+
ref: useMergeRefs([item.ref, forwardedRef]),
|
|
45
|
+
isDisabled: isDisabled
|
|
46
|
+
}, props), _isMenuTrigger ? {} : menu.getItemProps({
|
|
47
|
+
onClick: function onClick(event) {
|
|
48
|
+
var _props$onClick;
|
|
49
|
+
(_props$onClick = props.onClick) === null || _props$onClick === void 0 ? void 0 : _props$onClick.call(props, event);
|
|
50
|
+
tree === null || tree === void 0 ? void 0 : tree.events.emit('click');
|
|
51
|
+
},
|
|
52
|
+
onFocus: function onFocus(event) {
|
|
53
|
+
var _props$onFocus;
|
|
54
|
+
(_props$onFocus = props.onFocus) === null || _props$onFocus === void 0 ? void 0 : _props$onFocus.call(props, event);
|
|
55
|
+
menu.setHasFocusInside(true);
|
|
56
|
+
}
|
|
57
|
+
})), {}, {
|
|
58
|
+
children: children
|
|
59
|
+
}));
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
export { MenuItem };
|
|
63
|
+
//# sourceMappingURL=MenuItem.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MenuItem.web.js","sources":["../../../../../../src/components/Menu/MenuItem.web.tsx"],"sourcesContent":["import { useFloatingTree, useListItem, useMergeRefs } from '@floating-ui/react';\nimport React from 'react';\nimport type { MenuItemProps } from './types';\nimport { useMenu } from './useMenu';\nimport { BaseMenuItem } from '~components/BaseMenu';\nimport { ChevronRightIcon } from '~components/Icons';\n\nconst MenuItem = React.forwardRef<HTMLButtonElement, MenuItemProps>(\n (\n {\n title,\n isDisabled,\n description,\n leading,\n trailing,\n _isMenuTrigger,\n _hasFocusInside,\n href,\n target,\n children,\n as,\n ...props\n },\n forwardedRef,\n ) => {\n const menu = useMenu();\n const item = useListItem({ label: isDisabled && Boolean(children) ? null : title });\n const tree = useFloatingTree();\n\n const isLink = Boolean(href);\n\n const defaultAs = isLink ? 'a' : 'button';\n\n return (\n <BaseMenuItem\n title={title}\n description={description}\n leading={leading}\n trailing={\n _isMenuTrigger ? <ChevronRightIcon color=\"interactive.icon.gray.muted\" /> : trailing\n }\n as={as ?? defaultAs}\n href={href}\n ref={useMergeRefs([item.ref, forwardedRef])}\n isDisabled={isDisabled}\n {...props}\n {...(_isMenuTrigger\n ? {}\n : menu.getItemProps({\n onClick(event: React.MouseEvent<HTMLButtonElement>) {\n props.onClick?.(event);\n tree?.events.emit('click');\n },\n onFocus(event: React.FocusEvent<HTMLButtonElement>) {\n props.onFocus?.(event);\n menu.setHasFocusInside(true);\n },\n }))}\n >\n {children}\n </BaseMenuItem>\n );\n },\n);\n\nexport { MenuItem };\n"],"names":["MenuItem","React","forwardRef","_ref","forwardedRef","title","isDisabled","description","leading","trailing","_isMenuTrigger","_hasFocusInside","href","target","children","as","props","_objectWithoutProperties","_excluded","menu","useMenu","item","useListItem","label","Boolean","tree","useFloatingTree","isLink","defaultAs","_jsx","BaseMenuItem","_objectSpread","ChevronRightIcon","color","ref","useMergeRefs","getItemProps","onClick","event","_props$onClick","call","events","emit","onFocus","_props$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,CAAC,CAAA,EAAA,EAAA,EAAA;AAAA/B,IAAAA,QAAA,EAELA,QAAAA;AAAQ,GAAA,CACG,CAAC,CAAA;AAEnB,CACF;;;;"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
3
|
+
import React__default from 'react';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
import { MENU_MIN_WIDTH, overlayPaddingX, overlayPaddingY } from './tokens.js';
|
|
6
|
+
import '../Box/BaseBox/index.js';
|
|
7
|
+
import { componentZIndices } from '../../utils/componentZIndices.js';
|
|
8
|
+
import '../../utils/metaAttribute/index.js';
|
|
9
|
+
import { jsx } from 'react/jsx-runtime';
|
|
10
|
+
import { BaseBox } from '../Box/BaseBox/BaseBox.web.js';
|
|
11
|
+
import { metaAttribute } from '../../utils/metaAttribute/metaAttribute.web.js';
|
|
12
|
+
import { MetaConstants } from '../../utils/metaAttribute/metaConstants.js';
|
|
13
|
+
|
|
14
|
+
var _excluded = ["children", "zIndex", "_transitionStyle", "testID"];
|
|
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
|
+
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 UnfocussableOverlay = /*#__PURE__*/styled(BaseBox).withConfig({
|
|
18
|
+
displayName: "MenuOverlayweb__UnfocussableOverlay",
|
|
19
|
+
componentId: "sc-1nhzg4x-0"
|
|
20
|
+
})(function (_props) {
|
|
21
|
+
return {
|
|
22
|
+
'&:focus-visible': {
|
|
23
|
+
outline: 'none'
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
var _MenuOverlay = function _MenuOverlay(_ref, ref) {
|
|
28
|
+
var children = _ref.children,
|
|
29
|
+
_ref$zIndex = _ref.zIndex,
|
|
30
|
+
zIndex = _ref$zIndex === void 0 ? componentZIndices.dropdownOverlay : _ref$zIndex,
|
|
31
|
+
_transitionStyle = _ref._transitionStyle,
|
|
32
|
+
testID = _ref.testID,
|
|
33
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
34
|
+
return /*#__PURE__*/jsx(UnfocussableOverlay, _objectSpread(_objectSpread(_objectSpread({
|
|
35
|
+
ref: ref
|
|
36
|
+
}, props), {}, {
|
|
37
|
+
minWidth: MENU_MIN_WIDTH,
|
|
38
|
+
zIndex: zIndex
|
|
39
|
+
}, metaAttribute({
|
|
40
|
+
name: MetaConstants.Menu,
|
|
41
|
+
testID: testID
|
|
42
|
+
})), {}, {
|
|
43
|
+
children: /*#__PURE__*/jsx(BaseBox, {
|
|
44
|
+
backgroundColor: "popup.background.subtle",
|
|
45
|
+
paddingX: overlayPaddingX,
|
|
46
|
+
paddingY: overlayPaddingY,
|
|
47
|
+
elevation: "midRaised",
|
|
48
|
+
borderWidth: "thin",
|
|
49
|
+
borderColor: "surface.border.gray.muted",
|
|
50
|
+
borderRadius: "medium",
|
|
51
|
+
style: _transitionStyle,
|
|
52
|
+
children: children
|
|
53
|
+
})
|
|
54
|
+
}));
|
|
55
|
+
};
|
|
56
|
+
var MenuOverlay = /*#__PURE__*/React__default.forwardRef(_MenuOverlay);
|
|
57
|
+
|
|
58
|
+
export { MenuOverlay };
|
|
59
|
+
//# sourceMappingURL=MenuOverlay.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MenuOverlay.web.js","sources":["../../../../../../src/components/Menu/MenuOverlay.web.tsx"],"sourcesContent":["import React from 'react';\nimport styled from 'styled-components';\nimport type { MenuOverlayProps } from './types';\nimport { MENU_MIN_WIDTH, overlayPaddingX, overlayPaddingY } from './tokens';\nimport BaseBox from '~components/Box/BaseBox';\nimport { componentZIndices } from '~utils/componentZIndices';\nimport type { BladeElementRef } from '~utils/types';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\n\nconst UnfocussableOverlay = styled(BaseBox)((_props) => {\n return {\n '&:focus-visible': {\n outline: 'none',\n },\n };\n});\n\nconst _MenuOverlay: React.ForwardRefRenderFunction<BladeElementRef, MenuOverlayProps> = (\n { children, zIndex = componentZIndices.dropdownOverlay, _transitionStyle, testID, ...props },\n ref,\n): React.ReactElement => {\n return (\n <UnfocussableOverlay\n ref={ref as never}\n {...props}\n minWidth={MENU_MIN_WIDTH}\n zIndex={zIndex}\n {...metaAttribute({ name: MetaConstants.Menu, testID })}\n >\n {/* \n Requires another nested div since floatingStyles clash with floatingTransitionStyles \n\n https://floating-ui.com/docs/usetransition#usetransitionstyles\n */}\n <BaseBox\n backgroundColor=\"popup.background.subtle\"\n paddingX={overlayPaddingX}\n paddingY={overlayPaddingY}\n elevation=\"midRaised\"\n borderWidth=\"thin\"\n borderColor=\"surface.border.gray.muted\"\n borderRadius=\"medium\"\n style={_transitionStyle}\n >\n {children}\n </BaseBox>\n </UnfocussableOverlay>\n );\n};\n\nconst MenuOverlay = React.forwardRef(_MenuOverlay);\n\nexport { MenuOverlay };\n"],"names":["UnfocussableOverlay","styled","BaseBox","withConfig","displayName","componentId","_props","outline","_MenuOverlay","_ref","ref","children","_ref$zIndex","zIndex","componentZIndices","dropdownOverlay","_transitionStyle","testID","props","_objectWithoutProperties","_excluded","_jsx","_objectSpread","minWidth","MENU_MIN_WIDTH","metaAttribute","name","MetaConstants","Menu","backgroundColor","paddingX","overlayPaddingX","paddingY","overlayPaddingY","elevation","borderWid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CC,MAAAA,QAAQ,EAAEC,eAAgB;AAC1BC,MAAAA,QAAQ,EAAEC,eAAgB;AAC1BC,MAAAA,SAAS,EAAC,WAAW;AACrBC,MAAAA,WAAW,EAAC,MAAM;AAClBC,MAAAA,WAAW,EAAC,2BAA2B;AACvCC,MAAAA,YAAY,EAAC,QAAQ;AACrBC,MAAAA,KAAK,EAAEtB,gBAAiB;AAAAL,MAAAA,QAAA,EAEvBA,QAAAA;KACM,CAAA;AAAC,GAAA,CACS,CAAC,CAAA;AAE1B,CAAC,CAAA;AAED,IAAM4B,WAAW,gBAAGC,cAAK,CAACC,UAAU,CAACjC,YAAY;;;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
+
import { getDividerMarginTokens } from '../tokens.js';
|
|
3
|
+
import '../../Divider/index.js';
|
|
4
|
+
import '../../../utils/index.js';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
|
+
import useTheme from '../../BladeProvider/useTheme.js';
|
|
7
|
+
import { Divider } from '../../Divider/Divider.js';
|
|
8
|
+
|
|
9
|
+
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; }
|
|
10
|
+
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; }
|
|
11
|
+
var MenuDivider = function MenuDivider(styledProps) {
|
|
12
|
+
var _useTheme = useTheme(),
|
|
13
|
+
theme = _useTheme.theme;
|
|
14
|
+
return /*#__PURE__*/jsx(Divider, _objectSpread(_objectSpread({}, getDividerMarginTokens(theme)), styledProps));
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { MenuDivider };
|
|
18
|
+
//# sourceMappingURL=MenuDivider.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MenuDivider.web.js","sources":["../../../../../../../src/components/Menu/VisualSubComponents/MenuDivider.web.tsx"],"sourcesContent":["import { getDividerMarginTokens } from '../tokens';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { Divider } from '~components/Divider';\nimport { useTheme } from '~utils';\n\nconst MenuDivider = (styledProps: StyledPropsBlade): React.ReactElement => {\n const { theme } = useTheme();\n return <Divider {...getDividerMarginTokens(theme)} {...styledProps} />;\n};\n\nexport { MenuDivider };\n"],"names":["MenuDivider","styledProps","_useTheme","useTheme","theme","_jsx","Divider","_objectSpread","getDividerMarginTokens"],"mappings":";;;;;;;;;;AAKA,IAAMA,WAAW,GAAG,SAAdA,WAAWA,CAAIC,WAA6B,EAAyB;AACzE,EAAA,IAAAC,SAAA,GAAkBC,QAAQ,EAAE;IAApBC,KAAK,GAAAF,SAAA,CAALE,KAAK,CAAA;AACb,EAAA,oBAAOC,GAAA,CAACC,OAAO,EAAAC,aAAA,CAAAA,aAAA,CAAKC,EAAAA,EAAAA,sBAAsB,CAACJ,KAAK,CAAC,CAAMH,EAAAA,WAAW,CAAG,CAAC,CAAA;AACxE;;;;"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import 'react';
|
|
2
|
+
import { overlayPaddingX, headerMarginBottom, footerPaddingTop } from '../tokens.js';
|
|
3
|
+
import { MenuDivider } from './MenuDivider.web.js';
|
|
4
|
+
import { BaseFooter } from '../../BaseHeaderFooter/BaseFooter.js';
|
|
5
|
+
import { BaseHeader } from '../../BaseHeaderFooter/BaseHeader.js';
|
|
6
|
+
import '../../../utils/assignWithoutSideEffects/index.js';
|
|
7
|
+
import { MetaConstants } from '../../../utils/metaAttribute/metaConstants.js';
|
|
8
|
+
import '../../Box/index.js';
|
|
9
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
10
|
+
import { assignWithoutSideEffects } from '../../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
|
|
11
|
+
import { Box } from '../../Box/Box.js';
|
|
12
|
+
|
|
13
|
+
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
|
14
|
+
var _MenuHeader = function _MenuHeader(_ref) {
|
|
15
|
+
var title = _ref.title,
|
|
16
|
+
subtitle = _ref.subtitle,
|
|
17
|
+
leading = _ref.leading,
|
|
18
|
+
titleSuffix = _ref.titleSuffix,
|
|
19
|
+
trailing = _ref.trailing,
|
|
20
|
+
testID = _ref.testID;
|
|
21
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
22
|
+
children: [/*#__PURE__*/jsx(BaseHeader, {
|
|
23
|
+
title: title,
|
|
24
|
+
subtitle: subtitle,
|
|
25
|
+
leading: leading,
|
|
26
|
+
trailing: trailing,
|
|
27
|
+
titleSuffix: titleSuffix,
|
|
28
|
+
metaComponentName: MetaConstants.MenuHeader,
|
|
29
|
+
testID: testID
|
|
30
|
+
// back button
|
|
31
|
+
,
|
|
32
|
+
showBackButton: false
|
|
33
|
+
// close button
|
|
34
|
+
,
|
|
35
|
+
showCloseButton: false,
|
|
36
|
+
paddingX: overlayPaddingX,
|
|
37
|
+
marginTop: "spacing.0",
|
|
38
|
+
marginBottom: headerMarginBottom,
|
|
39
|
+
showDivider: false
|
|
40
|
+
}), /*#__PURE__*/jsx(MenuDivider, {})]
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
var MenuHeader = /*#__PURE__*/assignWithoutSideEffects(_MenuHeader, {
|
|
44
|
+
componentId: 'MenuHeader'
|
|
45
|
+
});
|
|
46
|
+
var _MenuFooter = function _MenuFooter(_ref2) {
|
|
47
|
+
var children = _ref2.children,
|
|
48
|
+
testID = _ref2.testID;
|
|
49
|
+
return /*#__PURE__*/jsxs(Box, {
|
|
50
|
+
marginTop: "spacing.2",
|
|
51
|
+
children: [/*#__PURE__*/jsx(MenuDivider, {}), /*#__PURE__*/jsx(BaseFooter, {
|
|
52
|
+
metaComponentName: MetaConstants.MenuFooter,
|
|
53
|
+
showDivider: false,
|
|
54
|
+
padding: [footerPaddingTop, overlayPaddingX, 'spacing.0', overlayPaddingX],
|
|
55
|
+
testID: testID,
|
|
56
|
+
children: children
|
|
57
|
+
})]
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
var MenuFooter = /*#__PURE__*/assignWithoutSideEffects(_MenuFooter, {
|
|
61
|
+
componentId: 'MenuFooter'
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
export { MenuFooter, MenuHeader };
|
|
65
|
+
//# sourceMappingURL=MenuHeaderFooter.web.js.map
|
package/build/lib/web/production/components/Menu/VisualSubComponents/MenuHeaderFooter.web.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MenuHeaderFooter.web.js","sources":["../../../../../../../src/components/Menu/VisualSubComponents/MenuHeaderFooter.web.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */\nimport React from 'react';\nimport { footerPaddingTop, headerMarginBottom, overlayPaddingX } from '../tokens';\nimport type { MenuFooterProps, MenuHeaderProps } from '../types';\nimport { MenuDivider } from './MenuDivider';\nimport { BaseFooter } from '~components/BaseHeaderFooter/BaseFooter';\nimport { BaseHeader } from '~components/BaseHeaderFooter/BaseHeader';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { MetaConstants } from '~utils/metaAttribute/metaConstants';\nimport { Box } from '~components/Box';\n\nconst _MenuHeader = ({\n title,\n subtitle,\n leading,\n titleSuffix,\n trailing,\n testID,\n}: MenuHeaderProps): React.ReactElement => {\n return (\n <>\n <BaseHeader\n title={title}\n subtitle={subtitle}\n leading={leading}\n trailing={trailing}\n titleSuffix={titleSuffix}\n metaComponentName={MetaConstants.MenuHeader}\n testID={testID}\n // back button\n showBackButton={false}\n // close button\n showCloseButton={false}\n paddingX={overlayPaddingX}\n marginTop=\"spacing.0\"\n marginBottom={headerMarginBottom}\n showDivider={false}\n />\n <MenuDivider />\n </>\n );\n};\n\nconst MenuHeader = assignWithoutSideEffects(_MenuHeader, {\n componentId: 'MenuHeader',\n});\n\nconst _MenuFooter = ({ children, testID }: MenuFooterProps): React.ReactElement => {\n return (\n <Box marginTop=\"spacing.2\">\n <MenuDivider />\n <BaseFooter\n metaComponentName={MetaConstants.MenuFooter}\n showDivider={false}\n padding={[footerPaddingTop, overlayPaddingX, 'spacing.0', overlayPaddingX]}\n testID={testID}\n >\n {children}\n </BaseFooter>\n </Box>\n );\n};\n\nconst MenuFooter = assignWithoutSideEffects(_MenuFooter, {\n componentId: 'MenuFooter',\n});\n\nexport { MenuHeader, MenuFooter };\n"],"names":["_MenuHeader","_ref","title","subtitle","leading","titleSuffix","trailing","testID","_jsxs","_Fragment","children","_jsx","BaseHeader","metaComponentName","MetaConstants","MenuHeader","showBackButton","showCloseButton","paddingX","overlayPaddingX","marginTop","marginBottom","headerMarginBottom","showDivider","MenuDivider","assignWithoutSideEffects","componentId","_MenuFooter","_ref2","Box","BaseFooter","MenuFooter","padding","footerPaddingTop"],"mappings":";;;;;;;;;;;;AAAA;AAWA,IAAMA,WAAW,GAAG,SAAdA,WAAWA,CAAAC,IAAA,EAO0B;AAAA,EAAA,IANzCC,KAAK,GAAAD,IAAA,CAALC,KAAK;IACLC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,OAAO,GAAAH,IAAA,CAAPG,OAAO;IACPC,WAAW,GAAAJ,IAAA,CAAXI,WAAW;IACXC,QAAQ,GAAAL,IAAA,CAARK,QAAQ;IACRC,MAAM,GAAAN,IAAA,CAANM,MAAM,CAAA;EAEN,oBACEC,IAAA,CAAAC,QAAA,EAAA;IAAAC,QAAA,EAAA,cACEC,GAAA,CAACC,UAAU,EAAA;A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KACC,CAAC,CAAA;AAAA,GACV,CAAC,CAAA;AAEV,CAAC,CAAA;AAED,IAAMqB,UAAU,gBAAGN,wBAAwB,CAACE,WAAW,EAAE;AACvDD,EAAAA,WAAW,EAAE,YAAA;AACf,CAAC;;;;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Menu } from './Menu.web.js';
|
|
2
|
+
export { MenuItem } from './MenuItem.web.js';
|
|
3
|
+
export { MenuOverlay } from './MenuOverlay.web.js';
|
|
4
|
+
export { MenuDivider } from './VisualSubComponents/MenuDivider.web.js';
|
|
5
|
+
export { MenuFooter, MenuHeader } from './VisualSubComponents/MenuHeaderFooter.web.js';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import '../../tokens/global/index.js';
|
|
2
|
+
import '../../utils/index.js';
|
|
3
|
+
import getIn from '../../utils/lodashButBetter/get.js';
|
|
4
|
+
import { makeSpace } from '../../utils/makeSpace/makeSpace.js';
|
|
5
|
+
import { makeSize } from '../../utils/makeSize/makeSize.js';
|
|
6
|
+
import { size } from '../../tokens/global/size.js';
|
|
7
|
+
|
|
8
|
+
var overlayPaddingX = 'spacing.3';
|
|
9
|
+
var overlayPaddingY = 'spacing.4';
|
|
10
|
+
var headerMarginBottom = 'spacing.3';
|
|
11
|
+
var footerPaddingTop = 'spacing.3';
|
|
12
|
+
var getDividerMarginTokens = function getDividerMarginTokens(theme) {
|
|
13
|
+
var overlayPaddingXValue = getIn(theme, overlayPaddingX);
|
|
14
|
+
return {
|
|
15
|
+
marginLeft: "-".concat(makeSpace(overlayPaddingXValue)),
|
|
16
|
+
marginRight: "-".concat(makeSpace(overlayPaddingXValue)),
|
|
17
|
+
marginY: 'spacing.1'
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
var MENU_MIN_WIDTH = {
|
|
21
|
+
base: makeSize(size['200']),
|
|
22
|
+
s: makeSize(size['240'])
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export { MENU_MIN_WIDTH, footerPaddingTop, getDividerMarginTokens, headerMarginBottom, overlayPaddingX, overlayPaddingY };
|
|
26
|
+
//# sourceMappingURL=tokens.js.map
|