@razorpay/blade 12.36.0 → 12.38.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/Card/Card.js +1 -1
- package/build/lib/native/components/Card/Card.js.map +1 -1
- package/build/lib/native/components/Card/CardContext.js +2 -2
- package/build/lib/native/components/Card/CardContext.js.map +1 -1
- package/build/lib/native/components/Card/CardHeader.js +3 -3
- package/build/lib/native/components/Card/CardHeader.js.map +1 -1
- package/build/lib/native/components/Input/BaseInput/BaseInputVisuals.js +1 -1
- package/build/lib/native/components/Input/BaseInput/BaseInputVisuals.js.map +1 -1
- package/build/lib/native/components/List/ListItem.js +1 -1
- package/build/lib/native/components/List/ListItem.js.map +1 -1
- package/build/lib/native/components/Typography/BaseText/BaseText.native.js +1 -1
- package/build/lib/native/components/Typography/BaseText/BaseText.native.js.map +1 -1
- package/build/lib/native/components/Typography/BaseText/getBaseTextStyles.js +1 -1
- package/build/lib/native/components/Typography/BaseText/getBaseTextStyles.js.map +1 -1
- package/build/lib/native/components/Typography/Code/Code.js +1 -1
- package/build/lib/native/components/Typography/Code/Code.js.map +1 -1
- package/build/lib/native/components/Typography/Display/Display.js +1 -1
- package/build/lib/native/components/Typography/Display/Display.js.map +1 -1
- package/build/lib/native/components/Typography/Heading/Heading.js +1 -1
- package/build/lib/native/components/Typography/Heading/Heading.js.map +1 -1
- package/build/lib/native/components/Typography/Text/Text.js +1 -1
- package/build/lib/native/components/Typography/Text/Text.js.map +1 -1
- package/build/lib/web/development/components/Card/Card.js +4 -1
- package/build/lib/web/development/components/Card/Card.js.map +1 -1
- package/build/lib/web/development/components/Card/CardContext.js +11 -6
- package/build/lib/web/development/components/Card/CardContext.js.map +1 -1
- package/build/lib/web/development/components/Card/CardHeader.js +38 -44
- package/build/lib/web/development/components/Card/CardHeader.js.map +1 -1
- package/build/lib/web/development/components/Input/BaseInput/BaseInputVisuals.js +1 -1
- package/build/lib/web/development/components/Input/BaseInput/BaseInputVisuals.js.map +1 -1
- package/build/lib/web/development/components/List/ListItem.js +1 -1
- package/build/lib/web/development/components/List/ListItem.js.map +1 -1
- package/build/lib/web/development/components/Table/TableEditableCell.web.js +11 -8
- package/build/lib/web/development/components/Table/TableEditableCell.web.js.map +1 -1
- package/build/lib/web/development/components/Tooltip/Tooltip.web.js +2 -2
- package/build/lib/web/development/components/Tooltip/Tooltip.web.js.map +1 -1
- package/build/lib/web/development/components/Typography/BaseText/BaseText.web.js +7 -3
- package/build/lib/web/development/components/Typography/BaseText/BaseText.web.js.map +1 -1
- package/build/lib/web/development/components/Typography/BaseText/getBaseTextStyles.js +4 -2
- package/build/lib/web/development/components/Typography/BaseText/getBaseTextStyles.js.map +1 -1
- package/build/lib/web/development/components/Typography/Code/Code.js +3 -1
- package/build/lib/web/development/components/Typography/Code/Code.js.map +1 -1
- package/build/lib/web/development/components/Typography/Display/Display.js +4 -2
- package/build/lib/web/development/components/Typography/Display/Display.js.map +1 -1
- package/build/lib/web/development/components/Typography/Heading/Heading.js +3 -1
- package/build/lib/web/development/components/Typography/Heading/Heading.js.map +1 -1
- package/build/lib/web/development/components/Typography/Text/Text.js +4 -2
- package/build/lib/web/development/components/Typography/Text/Text.js.map +1 -1
- package/build/lib/web/production/components/Card/Card.js +4 -1
- package/build/lib/web/production/components/Card/Card.js.map +1 -1
- package/build/lib/web/production/components/Card/CardContext.js +11 -6
- package/build/lib/web/production/components/Card/CardContext.js.map +1 -1
- package/build/lib/web/production/components/Card/CardHeader.js +38 -44
- package/build/lib/web/production/components/Card/CardHeader.js.map +1 -1
- package/build/lib/web/production/components/Input/BaseInput/BaseInputVisuals.js +1 -1
- package/build/lib/web/production/components/Input/BaseInput/BaseInputVisuals.js.map +1 -1
- package/build/lib/web/production/components/List/ListItem.js +1 -1
- package/build/lib/web/production/components/List/ListItem.js.map +1 -1
- package/build/lib/web/production/components/Table/TableEditableCell.web.js +11 -8
- package/build/lib/web/production/components/Table/TableEditableCell.web.js.map +1 -1
- package/build/lib/web/production/components/Tooltip/Tooltip.web.js +2 -2
- package/build/lib/web/production/components/Tooltip/Tooltip.web.js.map +1 -1
- package/build/lib/web/production/components/Typography/BaseText/BaseText.web.js +7 -3
- package/build/lib/web/production/components/Typography/BaseText/BaseText.web.js.map +1 -1
- package/build/lib/web/production/components/Typography/BaseText/getBaseTextStyles.js +4 -2
- package/build/lib/web/production/components/Typography/BaseText/getBaseTextStyles.js.map +1 -1
- package/build/lib/web/production/components/Typography/Code/Code.js +3 -1
- package/build/lib/web/production/components/Typography/Code/Code.js.map +1 -1
- package/build/lib/web/production/components/Typography/Display/Display.js +4 -2
- package/build/lib/web/production/components/Typography/Display/Display.js.map +1 -1
- package/build/lib/web/production/components/Typography/Heading/Heading.js +3 -1
- package/build/lib/web/production/components/Typography/Heading/Heading.js.map +1 -1
- package/build/lib/web/production/components/Typography/Text/Text.js +4 -2
- package/build/lib/web/production/components/Typography/Text/Text.js.map +1 -1
- package/build/types/components/index.d.ts +24 -5
- package/build/types/components/index.native.d.ts +23 -4
- package/package.json +1 -1
|
@@ -23,7 +23,7 @@ import { useCheckboxGroupContext } from '../Checkbox/CheckboxGroup/CheckboxGroup
|
|
|
23
23
|
import { useRadioGroupContext } from '../Radio/RadioGroup/RadioContext.js';
|
|
24
24
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
25
25
|
|
|
26
|
-
var _excluded=["children","backgroundColor","borderRadius","elevation","testID","padding","width","height","minHeight","minWidth","maxWidth","onClick","isSelected","accessibilityLabel","shouldScaleOnHover","onHover","href","target","rel","as"],_excluded2=["height","children","testID"];var ComponentIds={CardHeader:'CardHeader',CardHeaderTrailing:'CardHeaderTrailing',CardHeaderLeading:'CardHeaderLeading',CardFooter:'CardFooter',CardFooterTrailing:'CardFooterTrailing',CardFooterLeading:'CardFooterLeading',CardBody:'CardBody',CardHeaderIcon:'CardHeaderIcon',CardHeaderCounter:'CardHeaderCounter',CardHeaderBadge:'CardHeaderBadge',CardHeaderAmount:'CardHeaderAmount',CardHeaderText:'CardHeaderText',CardHeaderLink:'CardHeaderLink',CardHeaderIconButton:'CardHeaderIconButton'};var _Card=function _Card(_ref,ref){var children=_ref.children,_ref$backgroundColor=_ref.backgroundColor,backgroundColor=_ref$backgroundColor===void 0?'surface.background.gray.intense':_ref$backgroundColor,_ref$borderRadius=_ref.borderRadius,borderRadius=_ref$borderRadius===void 0?'medium':_ref$borderRadius,_ref$elevation=_ref.elevation,elevation=_ref$elevation===void 0?'lowRaised':_ref$elevation,testID=_ref.testID,_ref$padding=_ref.padding,padding=_ref$padding===void 0?'spacing.7':_ref$padding,width=_ref.width,height=_ref.height,minHeight=_ref.minHeight,minWidth=_ref.minWidth,maxWidth=_ref.maxWidth,onClick=_ref.onClick,_ref$isSelected=_ref.isSelected,isSelected=_ref$isSelected===void 0?false:_ref$isSelected,accessibilityLabel=_ref.accessibilityLabel,_ref$shouldScaleOnHov=_ref.shouldScaleOnHover,shouldScaleOnHover=_ref$shouldScaleOnHov===void 0?false:_ref$shouldScaleOnHov,onHover=_ref.onHover,href=_ref.href,target=_ref.target,rel=_ref.rel,as=_ref.as,rest=_objectWithoutProperties(_ref,_excluded);var _React$useState=React__default.useState(false),_React$useState2=_slicedToArray(_React$useState,2),isFocused=_React$useState2[0],setIsFocused=_React$useState2[1];useVerifyAllowedChildren({children:children,componentName:'Card',allowedComponents:[ComponentIds.CardHeader,ComponentIds.CardBody,ComponentIds.CardFooter]});var linkOverlayProps=Object.assign({},metaAttribute({name:CARD_LINK_OVERLAY_ID}),makeAccessible({label:accessibilityLabel,pressed:href?undefined:isSelected}),{onFocus:function onFocus(){setIsFocused(true);},onBlur:function onBlur(){setIsFocused(false);}});var defaultRel=target&&target==='_blank'?'noreferrer noopener':undefined;var checkboxGroupProps=useCheckboxGroupContext();var radioGroupProps=useRadioGroupContext();var getGroupProps=function getGroupProps(){if(Object.keys(checkboxGroupProps).length>0)return checkboxGroupProps;if(Object.keys(radioGroupProps).length>0)return radioGroupProps;return undefined;};var groupProps=getGroupProps();var _validationState=groupProps==null?void 0:groupProps.validationState;return jsx(CardProvider,{children:jsx(CardRoot,Object.assign({as:as,ref:ref,display:'block',borderRadius:borderRadius,onMouseEnter:onHover,shouldScaleOnHover:shouldScaleOnHover,isSelected:isSelected,isFocused:isFocused,onClick:isReactNative()?onClick:undefined,width:width,height:height,minHeight:minHeight,minWidth:minWidth,maxWidth:maxWidth,href:href,accessibilityLabel:accessibilityLabel,validationState:_validationState},metaAttribute({name:MetaConstants.Card,testID:testID}),getStyledProps(rest),makeAnalyticsAttribute(rest),{children:jsxs(CardSurface,{height:height,minHeight:minHeight,padding:padding,borderRadius:borderRadius,elevation:elevation,textAlign:'left',backgroundColor:backgroundColor,children:[href?jsx(LinkOverlay,Object.assign({onClick:onClick,href:href,target:target,rel:rel!=null?rel:defaultRel},linkOverlayProps)):null,!href&&onClick?jsx(LinkOverlay,Object.assign({as:"button",onClick:onClick},linkOverlayProps)):null,children]})}))});};var _CardBody=function _CardBody(_ref2){var height=_ref2.height,children=_ref2.children,testID=_ref2.testID,rest=_objectWithoutProperties(_ref2,_excluded2);useVerifyInsideCard('CardBody');return jsx(BaseBox,Object.assign({},metaAttribute({name:MetaConstants.CardBody,testID:testID}),makeAnalyticsAttribute(rest),{height:height,children:children}));};var Card=React__default.forwardRef(_Card);var CardBody=assignWithoutSideEffects(_CardBody,{componentId:ComponentIds.CardBody});
|
|
26
|
+
var _excluded=["children","backgroundColor","borderRadius","elevation","testID","padding","width","height","minHeight","minWidth","maxWidth","onClick","isSelected","accessibilityLabel","shouldScaleOnHover","onHover","href","target","rel","as","size"],_excluded2=["height","children","testID"];var ComponentIds={CardHeader:'CardHeader',CardHeaderTrailing:'CardHeaderTrailing',CardHeaderLeading:'CardHeaderLeading',CardFooter:'CardFooter',CardFooterTrailing:'CardFooterTrailing',CardFooterLeading:'CardFooterLeading',CardBody:'CardBody',CardHeaderIcon:'CardHeaderIcon',CardHeaderCounter:'CardHeaderCounter',CardHeaderBadge:'CardHeaderBadge',CardHeaderAmount:'CardHeaderAmount',CardHeaderText:'CardHeaderText',CardHeaderLink:'CardHeaderLink',CardHeaderIconButton:'CardHeaderIconButton'};var _Card=function _Card(_ref,ref){var children=_ref.children,_ref$backgroundColor=_ref.backgroundColor,backgroundColor=_ref$backgroundColor===void 0?'surface.background.gray.intense':_ref$backgroundColor,_ref$borderRadius=_ref.borderRadius,borderRadius=_ref$borderRadius===void 0?'medium':_ref$borderRadius,_ref$elevation=_ref.elevation,elevation=_ref$elevation===void 0?'lowRaised':_ref$elevation,testID=_ref.testID,_ref$padding=_ref.padding,padding=_ref$padding===void 0?'spacing.7':_ref$padding,width=_ref.width,height=_ref.height,minHeight=_ref.minHeight,minWidth=_ref.minWidth,maxWidth=_ref.maxWidth,onClick=_ref.onClick,_ref$isSelected=_ref.isSelected,isSelected=_ref$isSelected===void 0?false:_ref$isSelected,accessibilityLabel=_ref.accessibilityLabel,_ref$shouldScaleOnHov=_ref.shouldScaleOnHover,shouldScaleOnHover=_ref$shouldScaleOnHov===void 0?false:_ref$shouldScaleOnHov,onHover=_ref.onHover,href=_ref.href,target=_ref.target,rel=_ref.rel,as=_ref.as,_ref$size=_ref.size,size=_ref$size===void 0?'large':_ref$size,rest=_objectWithoutProperties(_ref,_excluded);var _React$useState=React__default.useState(false),_React$useState2=_slicedToArray(_React$useState,2),isFocused=_React$useState2[0],setIsFocused=_React$useState2[1];useVerifyAllowedChildren({children:children,componentName:'Card',allowedComponents:[ComponentIds.CardHeader,ComponentIds.CardBody,ComponentIds.CardFooter]});var linkOverlayProps=Object.assign({},metaAttribute({name:CARD_LINK_OVERLAY_ID}),makeAccessible({label:accessibilityLabel,pressed:href?undefined:isSelected}),{onFocus:function onFocus(){setIsFocused(true);},onBlur:function onBlur(){setIsFocused(false);}});var defaultRel=target&&target==='_blank'?'noreferrer noopener':undefined;var checkboxGroupProps=useCheckboxGroupContext();var radioGroupProps=useRadioGroupContext();var getGroupProps=function getGroupProps(){if(Object.keys(checkboxGroupProps).length>0)return checkboxGroupProps;if(Object.keys(radioGroupProps).length>0)return radioGroupProps;return undefined;};var groupProps=getGroupProps();var _validationState=groupProps==null?void 0:groupProps.validationState;return jsx(CardProvider,{size:size,children:jsx(CardRoot,Object.assign({as:as,ref:ref,display:'block',borderRadius:borderRadius,onMouseEnter:onHover,shouldScaleOnHover:shouldScaleOnHover,isSelected:isSelected,isFocused:isFocused,onClick:isReactNative()?onClick:undefined,width:width,height:height,minHeight:minHeight,minWidth:minWidth,maxWidth:maxWidth,href:href,accessibilityLabel:accessibilityLabel,validationState:_validationState},metaAttribute({name:MetaConstants.Card,testID:testID}),getStyledProps(rest),makeAnalyticsAttribute(rest),{children:jsxs(CardSurface,{height:height,minHeight:minHeight,padding:padding,borderRadius:borderRadius,elevation:elevation,textAlign:'left',backgroundColor:backgroundColor,children:[href?jsx(LinkOverlay,Object.assign({onClick:onClick,href:href,target:target,rel:rel!=null?rel:defaultRel},linkOverlayProps)):null,!href&&onClick?jsx(LinkOverlay,Object.assign({as:"button",onClick:onClick},linkOverlayProps)):null,children]})}))});};var _CardBody=function _CardBody(_ref2){var height=_ref2.height,children=_ref2.children,testID=_ref2.testID,rest=_objectWithoutProperties(_ref2,_excluded2);useVerifyInsideCard('CardBody');return jsx(BaseBox,Object.assign({},metaAttribute({name:MetaConstants.CardBody,testID:testID}),makeAnalyticsAttribute(rest),{height:height,children:children}));};var Card=React__default.forwardRef(_Card);var CardBody=assignWithoutSideEffects(_CardBody,{componentId:ComponentIds.CardBody});
|
|
27
27
|
|
|
28
28
|
export { Card, CardBody, ComponentIds };
|
|
29
29
|
//# sourceMappingURL=Card.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.js","sources":["../../../../../src/components/Card/Card.tsx"],"sourcesContent":["import React from 'react';\nimport type { GestureResponderEvent } from 'react-native';\nimport { CardSurface } from './CardSurface';\nimport { CardProvider, useVerifyInsideCard } from './CardContext';\nimport { LinkOverlay } from './LinkOverlay';\nimport { CardRoot } from './CardRoot';\nimport type { CardSpacingValueType, LinkOverlayProps } from './types';\nimport { CARD_LINK_OVERLAY_ID } from './constants';\nimport BaseBox from '~components/Box/BaseBox';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport type { DataAnalyticsAttribute, BladeElementRef, TestID } from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport type { Elevation } from '~tokens/global';\nimport type { BoxProps } from '~components/Box';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { useVerifyAllowedChildren } from '~utils/useVerifyAllowedChildren/useVerifyAllowedChildren';\nimport type { Platform } from '~utils';\nimport { isReactNative } from '~utils';\nimport type { Theme } from '~components/BladeProvider';\nimport type { DotNotationToken } from '~utils/lodashButBetter/get';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\nimport { useCheckboxGroupContext } from '~components/Checkbox/CheckboxGroup/CheckboxGroupContext';\nimport { useRadioGroupContext } from '~components/Radio/RadioGroup/RadioContext';\nimport type { CheckboxGroupContextType } from '~components/Checkbox/CheckboxGroup/CheckboxGroupContext';\nimport type { RadioGroupContextType } from '~components/Radio/RadioGroup/RadioContext';\n\nexport const ComponentIds = {\n CardHeader: 'CardHeader',\n CardHeaderTrailing: 'CardHeaderTrailing',\n CardHeaderLeading: 'CardHeaderLeading',\n CardFooter: 'CardFooter',\n CardFooterTrailing: 'CardFooterTrailing',\n CardFooterLeading: 'CardFooterLeading',\n CardBody: 'CardBody',\n CardHeaderIcon: 'CardHeaderIcon',\n CardHeaderCounter: 'CardHeaderCounter',\n CardHeaderBadge: 'CardHeaderBadge',\n CardHeaderAmount: 'CardHeaderAmount',\n CardHeaderText: 'CardHeaderText',\n CardHeaderLink: 'CardHeaderLink',\n CardHeaderIconButton: 'CardHeaderIconButton',\n};\n\ntype CardSurfaceBackgroundColors = `surface.background.gray.${DotNotationToken<\n Theme['colors']['surface']['background']['gray']\n>}`;\n\nexport type CardProps = {\n /**\n * Card contents\n */\n children: React.ReactNode;\n /**\n * Sets the background color of the Card\n *\n * @default `surface.background.gray.intense`\n */\n backgroundColor?: CardSurfaceBackgroundColors;\n /**\n * Sets the border radius of the Card\n *\n * @default `medium`\n */\n borderRadius?: Extract<BoxProps['borderRadius'], 'medium' | 'large' | 'xlarge'>;\n /**\n * Sets the elevation for Cards\n *\n * eg: `theme.elevation.midRaised`\n *\n * @default `theme.elevation.lowRaised`\n *\n * **Links:**\n * - Docs: https://blade.razorpay.com/?path=/docs/tokens-elevation--docs\n */\n elevation?: keyof Elevation;\n /**\n * Sets the padding equally on all sides. Only few `spacing` tokens are allowed deliberately\n * @default `spacing.7`\n *\n * **Links:**\n * - Docs: https://blade.razorpay.com/?path=/docs/tokens-spacing--docs\n */\n padding?: CardSpacingValueType;\n /**\n * Sets the width of the card\n */\n width?: BoxProps['width'];\n /**\n * Sets the height of the card\n */\n height?: BoxProps['height'];\n /**\n * Sets minimum height of the card\n */\n minHeight?: BoxProps['minHeight'];\n /**\n * Sets minimum width of the card\n */\n minWidth?: BoxProps['minWidth'];\n /**\n * Sets maximum width of the card\n */\n maxWidth?: BoxProps['maxWidth'];\n /**\n * If `true`, the card will be in selected state\n * Card will have a primary color border around it.\n *\n * @default false\n */\n isSelected?: boolean;\n /**\n * Makes the Card linkable by setting the `href` prop\n *\n * @default undefined\n */\n href?: string;\n /**\n * Sets the `target` attribute for the linkable card\n */\n target?: string;\n /**\n * Sets the `rel` attribute for the linkable card\n */\n rel?: string;\n /**\n * Sets the accessibility label for the card\n * This is useful when the card has an `href` or `onClick` prop\n * Setting this will announce the label when the card is focused\n */\n accessibilityLabel?: string;\n /**\n * If `true`, the card will scale up on hover\n *\n * On mobile devices it will scale down on press\n *\n * **This prop is deprecated in favour of motion presets released in v12**\n *\n * ### Migration\n *\n * ```diff\n * - <Card\n * - shouldScaleOnHover\n * - />\n *\n * + <Scale motionTriggers={['hover']}>\n * + <Card />\n * + </Scale>\n * ```\n *\n * @default false\n *\n * @deprecated This prop is deprecated in favour of motion presets released in v12\n */\n shouldScaleOnHover?: boolean;\n /**\n * Callback triggered when the card is hovered\n */\n onHover?: () => void;\n /**\n * Callback triggered when the card is clicked\n */\n onClick?: (\n event: Platform.Select<{\n web: React.MouseEvent;\n native: GestureResponderEvent;\n }>,\n ) => void;\n /**\n * Sets the HTML element for the Card\n *\n * When `as` is set to `label`, the card will be rendered as a label element\n * This can be used to create a custom checkbox or radio button using the card\n *\n * @default undefined\n */\n as?: 'label';\n} & TestID &\n DataAnalyticsAttribute &\n StyledPropsBlade;\n\nconst _Card: React.ForwardRefRenderFunction<BladeElementRef, CardProps> = (\n {\n children,\n backgroundColor = 'surface.background.gray.intense',\n borderRadius = 'medium',\n elevation = 'lowRaised',\n testID,\n padding = 'spacing.7',\n width,\n height,\n minHeight,\n minWidth,\n maxWidth,\n onClick,\n isSelected = false,\n accessibilityLabel,\n shouldScaleOnHover = false,\n onHover,\n href,\n target,\n rel,\n as,\n ...rest\n },\n ref,\n): React.ReactElement => {\n const [isFocused, setIsFocused] = React.useState(false);\n\n useVerifyAllowedChildren({\n children,\n componentName: 'Card',\n allowedComponents: [ComponentIds.CardHeader, ComponentIds.CardBody, ComponentIds.CardFooter],\n });\n\n const linkOverlayProps: LinkOverlayProps = {\n ...metaAttribute({ name: CARD_LINK_OVERLAY_ID }),\n ...makeAccessible({ label: accessibilityLabel, pressed: href ? undefined : isSelected }),\n onFocus: () => {\n setIsFocused(true);\n },\n onBlur: () => {\n setIsFocused(false);\n },\n };\n const defaultRel = target && target === '_blank' ? 'noreferrer noopener' : undefined;\n\n const checkboxGroupProps = useCheckboxGroupContext();\n const radioGroupProps = useRadioGroupContext();\n\n const getGroupProps = (): CheckboxGroupContextType | RadioGroupContextType | undefined => {\n if (Object.keys(checkboxGroupProps).length > 0) return checkboxGroupProps;\n if (Object.keys(radioGroupProps).length > 0) return radioGroupProps;\n return undefined;\n };\n\n const groupProps = getGroupProps();\n\n const _validationState = groupProps?.validationState;\n\n return (\n <CardProvider>\n <CardRoot\n as={as}\n ref={ref as never}\n display={'block' as never}\n borderRadius={borderRadius}\n onMouseEnter={onHover as never}\n shouldScaleOnHover={shouldScaleOnHover}\n isSelected={isSelected}\n isFocused={isFocused}\n // on react native we need to pass onClick to root, because we don't need the LinkOverlay in RN\n onClick={isReactNative() ? onClick : undefined}\n width={width}\n height={height}\n minHeight={minHeight}\n minWidth={minWidth}\n maxWidth={maxWidth}\n href={href}\n accessibilityLabel={accessibilityLabel}\n validationState={_validationState}\n {...metaAttribute({ name: MetaConstants.Card, testID })}\n {...getStyledProps(rest)}\n {...makeAnalyticsAttribute(rest)}\n >\n <CardSurface\n height={height}\n minHeight={minHeight}\n padding={padding}\n borderRadius={borderRadius}\n elevation={elevation}\n textAlign={'left' as never}\n backgroundColor={backgroundColor}\n >\n {href ? (\n <LinkOverlay\n onClick={onClick}\n href={href}\n target={target}\n rel={rel ?? defaultRel}\n {...linkOverlayProps}\n />\n ) : null}\n {!href && onClick ? (\n <LinkOverlay as=\"button\" onClick={onClick} {...linkOverlayProps} />\n ) : null}\n {children}\n </CardSurface>\n </CardRoot>\n </CardProvider>\n );\n};\n\ntype CardBodyProps = {\n children: React.ReactNode;\n height?: BoxProps['height'];\n} & TestID &\n DataAnalyticsAttribute;\n\nconst _CardBody = ({ height, children, testID, ...rest }: CardBodyProps): React.ReactElement => {\n useVerifyInsideCard('CardBody');\n\n return (\n <BaseBox\n {...metaAttribute({ name: MetaConstants.CardBody, testID })}\n {...makeAnalyticsAttribute(rest)}\n height={height}\n >\n {children}\n </BaseBox>\n );\n};\n\nconst Card = React.forwardRef(_Card);\nconst CardBody = assignWithoutSideEffects(_CardBody, { componentId: ComponentIds.CardBody });\n\nexport { Card, CardBody };\n"],"names":["ComponentIds","CardHeader","CardHeaderTrailing","CardHeaderLeading","CardFooter","CardFooterTrailing","CardFooterLeading","CardBody","CardHeaderIcon","CardHeaderCounter","CardHeaderBadge","CardHeaderAmount","CardHeaderText","CardHeaderLink","CardHeaderIconButton","_Card","_ref","ref","children","_ref$backgroundColor","backgroundColor","_ref$borderRadius","borderRadius","_ref$elevation","elevation","testID","_ref$padding","padding","width","height","minHeight","minWidth","maxWidth","onClick","_ref$isSelected","isSelected","accessibilityLabel","_ref$shouldScaleOnHov","shouldScaleOnHover","onHover","href","target","rel","as","rest","_objectWithoutProperties","_excluded","_React$useState","React","useState","_React$useState2","_slicedToArray","isFocused","setIsFocused","useVerifyAllowedChildren","componentName","allowedComponents","linkOverlayProps","Object","assign","metaAttribute","name","CARD_LINK_OVERLAY_ID","makeAccessible","label","pressed","undefined","onFocus","onBlur","defaultRel","checkboxGroupProps","useCheckboxGroupContext","radioGroupProps","useRadioGroupContext","getGroupProps","keys","length","groupProps","_validationState","validationState","_jsx","CardProvider","CardRoot","display","onMouseEnter","isReactNative","MetaConstants","Card","getStyledProps","makeAnalyticsAttribute","_jsxs","CardSurface","textAlign","LinkOverlay","_CardBody","_ref2","_excluded2","useVerifyInsideCard","BaseBox","forwardRef","assignWithoutSideEffects","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;8RA4Ba,IAAAA,YAAY,CAAG,CAC1BC,UAAU,CAAE,YAAY,CACxBC,kBAAkB,CAAE,oBAAoB,CACxCC,iBAAiB,CAAE,mBAAmB,CACtCC,UAAU,CAAE,YAAY,CACxBC,kBAAkB,CAAE,oBAAoB,CACxCC,iBAAiB,CAAE,mBAAmB,CACtCC,QAAQ,CAAE,UAAU,CACpBC,cAAc,CAAE,gBAAgB,CAChCC,iBAAiB,CAAE,mBAAmB,CACtCC,eAAe,CAAE,iBAAiB,CAClCC,gBAAgB,CAAE,kBAAkB,CACpCC,cAAc,CAAE,gBAAgB,CAChCC,cAAc,CAAE,gBAAgB,CAChCC,oBAAoB,CAAE,sBACxB,EA2IA,IAAMC,KAAiE,CAAG,SAApEA,KAAiEA,CAAAC,IAAA,CAwB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AAC,CAEK,IAAAqE,IAAI,CAAGvC,cAAK,CAACmD,UAAU,CAACpF,KAAK,EAC7B,IAAAR,QAAQ,CAAG6F,wBAAwB,CAACN,SAAS,CAAE,CAAEO,WAAW,CAAErG,YAAY,CAACO,QAAS,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"Card.js","sources":["../../../../../src/components/Card/Card.tsx"],"sourcesContent":["import React from 'react';\nimport type { GestureResponderEvent } from 'react-native';\nimport { CardSurface } from './CardSurface';\nimport { CardProvider, useVerifyInsideCard } from './CardContext';\nimport { LinkOverlay } from './LinkOverlay';\nimport { CardRoot } from './CardRoot';\nimport type { CardSpacingValueType, LinkOverlayProps } from './types';\nimport { CARD_LINK_OVERLAY_ID } from './constants';\nimport BaseBox from '~components/Box/BaseBox';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport type { DataAnalyticsAttribute, BladeElementRef, TestID } from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport type { Elevation } from '~tokens/global';\nimport type { BoxProps } from '~components/Box';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { useVerifyAllowedChildren } from '~utils/useVerifyAllowedChildren/useVerifyAllowedChildren';\nimport type { Platform } from '~utils';\nimport { isReactNative } from '~utils';\nimport type { Theme } from '~components/BladeProvider';\nimport type { DotNotationToken } from '~utils/lodashButBetter/get';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\nimport { useCheckboxGroupContext } from '~components/Checkbox/CheckboxGroup/CheckboxGroupContext';\nimport { useRadioGroupContext } from '~components/Radio/RadioGroup/RadioContext';\nimport type { CheckboxGroupContextType } from '~components/Checkbox/CheckboxGroup/CheckboxGroupContext';\nimport type { RadioGroupContextType } from '~components/Radio/RadioGroup/RadioContext';\n\nexport const ComponentIds = {\n CardHeader: 'CardHeader',\n CardHeaderTrailing: 'CardHeaderTrailing',\n CardHeaderLeading: 'CardHeaderLeading',\n CardFooter: 'CardFooter',\n CardFooterTrailing: 'CardFooterTrailing',\n CardFooterLeading: 'CardFooterLeading',\n CardBody: 'CardBody',\n CardHeaderIcon: 'CardHeaderIcon',\n CardHeaderCounter: 'CardHeaderCounter',\n CardHeaderBadge: 'CardHeaderBadge',\n CardHeaderAmount: 'CardHeaderAmount',\n CardHeaderText: 'CardHeaderText',\n CardHeaderLink: 'CardHeaderLink',\n CardHeaderIconButton: 'CardHeaderIconButton',\n};\n\ntype CardSurfaceBackgroundColors = `surface.background.gray.${DotNotationToken<\n Theme['colors']['surface']['background']['gray']\n>}`;\n\nexport type CardProps = {\n /**\n * Card contents\n */\n children: React.ReactNode;\n /**\n * Sets the background color of the Card\n *\n * @default `surface.background.gray.intense`\n */\n backgroundColor?: CardSurfaceBackgroundColors;\n /**\n * Sets the border radius of the Card\n *\n * @default `medium`\n */\n borderRadius?: Extract<BoxProps['borderRadius'], 'medium' | 'large' | 'xlarge'>;\n /**\n * Sets the elevation for Cards\n *\n * eg: `theme.elevation.midRaised`\n *\n * @default `theme.elevation.lowRaised`\n *\n * **Links:**\n * - Docs: https://blade.razorpay.com/?path=/docs/tokens-elevation--docs\n */\n elevation?: keyof Elevation;\n /**\n * Sets the padding equally on all sides. Only few `spacing` tokens are allowed deliberately\n * @default `spacing.7`\n *\n * **Links:**\n * - Docs: https://blade.razorpay.com/?path=/docs/tokens-spacing--docs\n */\n padding?: CardSpacingValueType;\n /**\n * Sets the width of the card\n */\n width?: BoxProps['width'];\n /**\n * Sets the height of the card\n */\n height?: BoxProps['height'];\n /**\n * Sets minimum height of the card\n */\n minHeight?: BoxProps['minHeight'];\n /**\n * Sets minimum width of the card\n */\n minWidth?: BoxProps['minWidth'];\n /**\n * Sets maximum width of the card\n */\n maxWidth?: BoxProps['maxWidth'];\n /**\n * If `true`, the card will be in selected state\n * Card will have a primary color border around it.\n *\n * @default false\n */\n isSelected?: boolean;\n /**\n * Makes the Card linkable by setting the `href` prop\n *\n * @default undefined\n */\n href?: string;\n /**\n * Sets the `target` attribute for the linkable card\n */\n target?: string;\n /**\n * Sets the `rel` attribute for the linkable card\n */\n rel?: string;\n /**\n * Sets the accessibility label for the card\n * This is useful when the card has an `href` or `onClick` prop\n * Setting this will announce the label when the card is focused\n */\n accessibilityLabel?: string;\n /**\n * If `true`, the card will scale up on hover\n *\n * On mobile devices it will scale down on press\n *\n * **This prop is deprecated in favour of motion presets released in v12**\n *\n * ### Migration\n *\n * ```diff\n * - <Card\n * - shouldScaleOnHover\n * - />\n *\n * + <Scale motionTriggers={['hover']}>\n * + <Card />\n * + </Scale>\n * ```\n *\n * @default false\n *\n * @deprecated This prop is deprecated in favour of motion presets released in v12\n */\n shouldScaleOnHover?: boolean;\n /**\n * Callback triggered when the card is hovered\n */\n onHover?: () => void;\n /**\n * Sets the size of the card header title\n *\n * @default 'large'\n */\n size?: 'large' | 'medium';\n /**\n * Callback triggered when the card is clicked\n */\n onClick?: (\n event: Platform.Select<{\n web: React.MouseEvent;\n native: GestureResponderEvent;\n }>,\n ) => void;\n /**\n * Sets the HTML element for the Card\n *\n * When `as` is set to `label`, the card will be rendered as a label element\n * This can be used to create a custom checkbox or radio button using the card\n *\n * @default undefined\n */\n as?: 'label';\n} & TestID &\n DataAnalyticsAttribute &\n StyledPropsBlade;\n\nconst _Card: React.ForwardRefRenderFunction<BladeElementRef, CardProps> = (\n {\n children,\n backgroundColor = 'surface.background.gray.intense',\n borderRadius = 'medium',\n elevation = 'lowRaised',\n testID,\n padding = 'spacing.7',\n width,\n height,\n minHeight,\n minWidth,\n maxWidth,\n onClick,\n isSelected = false,\n accessibilityLabel,\n shouldScaleOnHover = false,\n onHover,\n href,\n target,\n rel,\n as,\n size = 'large',\n ...rest\n },\n ref,\n): React.ReactElement => {\n const [isFocused, setIsFocused] = React.useState(false);\n\n useVerifyAllowedChildren({\n children,\n componentName: 'Card',\n allowedComponents: [ComponentIds.CardHeader, ComponentIds.CardBody, ComponentIds.CardFooter],\n });\n\n const linkOverlayProps: LinkOverlayProps = {\n ...metaAttribute({ name: CARD_LINK_OVERLAY_ID }),\n ...makeAccessible({ label: accessibilityLabel, pressed: href ? undefined : isSelected }),\n onFocus: () => {\n setIsFocused(true);\n },\n onBlur: () => {\n setIsFocused(false);\n },\n };\n const defaultRel = target && target === '_blank' ? 'noreferrer noopener' : undefined;\n\n const checkboxGroupProps = useCheckboxGroupContext();\n const radioGroupProps = useRadioGroupContext();\n\n const getGroupProps = (): CheckboxGroupContextType | RadioGroupContextType | undefined => {\n if (Object.keys(checkboxGroupProps).length > 0) return checkboxGroupProps;\n if (Object.keys(radioGroupProps).length > 0) return radioGroupProps;\n return undefined;\n };\n\n const groupProps = getGroupProps();\n\n const _validationState = groupProps?.validationState;\n\n return (\n <CardProvider size={size}>\n <CardRoot\n as={as}\n ref={ref as never}\n display={'block' as never}\n borderRadius={borderRadius}\n onMouseEnter={onHover as never}\n shouldScaleOnHover={shouldScaleOnHover}\n isSelected={isSelected}\n isFocused={isFocused}\n // on react native we need to pass onClick to root, because we don't need the LinkOverlay in RN\n onClick={isReactNative() ? onClick : undefined}\n width={width}\n height={height}\n minHeight={minHeight}\n minWidth={minWidth}\n maxWidth={maxWidth}\n href={href}\n accessibilityLabel={accessibilityLabel}\n validationState={_validationState}\n {...metaAttribute({ name: MetaConstants.Card, testID })}\n {...getStyledProps(rest)}\n {...makeAnalyticsAttribute(rest)}\n >\n <CardSurface\n height={height}\n minHeight={minHeight}\n padding={padding}\n borderRadius={borderRadius}\n elevation={elevation}\n textAlign={'left' as never}\n backgroundColor={backgroundColor}\n >\n {href ? (\n <LinkOverlay\n onClick={onClick}\n href={href}\n target={target}\n rel={rel ?? defaultRel}\n {...linkOverlayProps}\n />\n ) : null}\n {!href && onClick ? (\n <LinkOverlay as=\"button\" onClick={onClick} {...linkOverlayProps} />\n ) : null}\n {children}\n </CardSurface>\n </CardRoot>\n </CardProvider>\n );\n};\n\ntype CardBodyProps = {\n children: React.ReactNode;\n height?: BoxProps['height'];\n} & TestID &\n DataAnalyticsAttribute;\n\nconst _CardBody = ({ height, children, testID, ...rest }: CardBodyProps): React.ReactElement => {\n useVerifyInsideCard('CardBody');\n\n return (\n <BaseBox\n {...metaAttribute({ name: MetaConstants.CardBody, testID })}\n {...makeAnalyticsAttribute(rest)}\n height={height}\n >\n {children}\n </BaseBox>\n );\n};\n\nconst Card = React.forwardRef(_Card);\nconst CardBody = assignWithoutSideEffects(_CardBody, { componentId: ComponentIds.CardBody });\n\nexport { Card, CardBody };\n"],"names":["ComponentIds","CardHeader","CardHeaderTrailing","CardHeaderLeading","CardFooter","CardFooterTrailing","CardFooterLeading","CardBody","CardHeaderIcon","CardHeaderCounter","CardHeaderBadge","CardHeaderAmount","CardHeaderText","CardHeaderLink","CardHeaderIconButton","_Card","_ref","ref","children","_ref$backgroundColor","backgroundColor","_ref$borderRadius","borderRadius","_ref$elevation","elevation","testID","_ref$padding","padding","width","height","minHeight","minWidth","maxWidth","onClick","_ref$isSelected","isSelected","accessibilityLabel","_ref$shouldScaleOnHov","shouldScaleOnHover","onHover","href","target","rel","as","_ref$size","size","rest","_objectWithoutProperties","_excluded","_React$useState","React","useState","_React$useState2","_slicedToArray","isFocused","setIsFocused","useVerifyAllowedChildren","componentName","allowedComponents","linkOverlayProps","Object","assign","metaAttribute","name","CARD_LINK_OVERLAY_ID","makeAccessible","label","pressed","undefined","onFocus","onBlur","defaultRel","checkboxGroupProps","useCheckboxGroupContext","radioGroupProps","useRadioGroupContext","getGroupProps","keys","length","groupProps","_validationState","validationState","_jsx","CardProvider","CardRoot","display","onMouseEnter","isReactNative","MetaConstants","Card","getStyledProps","makeAnalyticsAttribute","_jsxs","CardSurface","textAlign","LinkOverlay","_CardBody","_ref2","_excluded2","useVerifyInsideCard","BaseBox","forwardRef","assignWithoutSideEffects","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;qSA4Ba,IAAAA,YAAY,CAAG,CAC1BC,UAAU,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AZA,SAASA,CAAAC,KAAA,CAAiF,CAAA,IAA3EpE,MAAM,CAAAoE,KAAA,CAANpE,MAAM,CAAEX,QAAQ,CAAA+E,KAAA,CAAR/E,QAAQ,CAAEO,MAAM,CAAAwE,KAAA,CAANxE,MAAM,CAAKqB,IAAI,CAAAC,wBAAA,CAAAkD,KAAA,CAAAC,UAAA,CACpDC,CAAAA,mBAAmB,CAAC,UAAU,CAAC,CAE/B,OACEjB,GAAA,CAACkB,OAAO,CAAAxC,MAAA,CAAAC,MAAA,CAAA,EAAA,CACFC,aAAa,CAAC,CAAEC,IAAI,CAAEyB,aAAa,CAACjF,QAAQ,CAAEkB,MAAM,CAANA,MAAO,CAAC,CAAC,CACvDkE,sBAAsB,CAAC7C,IAAI,CAAC,CAChCjB,CAAAA,MAAM,CAAEA,MAAO,CAAAX,QAAA,CAEdA,QAAQ,CAAA,CACF,CAAC,CAEd,CAAC,CAEK,IAAAuE,IAAI,CAAGvC,cAAK,CAACmD,UAAU,CAACtF,KAAK,EAC7B,IAAAR,QAAQ,CAAG+F,wBAAwB,CAACN,SAAS,CAAE,CAAEO,WAAW,CAAEvG,YAAY,CAACO,QAAS,CAAC;;;;"}
|
|
@@ -2,7 +2,7 @@ import React__default from 'react';
|
|
|
2
2
|
import { throwBladeError } from '../../utils/logger/logger.js';
|
|
3
3
|
import { jsx } from 'react/jsx-runtime';
|
|
4
4
|
|
|
5
|
-
var CardContext=React__default.createContext(
|
|
5
|
+
var CardContext=React__default.createContext({size:undefined});var useVerifyInsideCard=function useVerifyInsideCard(componentName){var context=React__default.useContext(CardContext);if(__DEV__){if(!(context!=null&&context.size)){throwBladeError({message:`${componentName} cannot be used outside of Card component`,moduleName:'Card'});}}return context;};var CardProvider=function CardProvider(_ref){var children=_ref.children,size=_ref.size;return jsx(CardContext.Provider,{value:{size:size},children:children});};
|
|
6
6
|
|
|
7
|
-
export { CardProvider, useVerifyInsideCard };
|
|
7
|
+
export { CardContext, CardProvider, useVerifyInsideCard };
|
|
8
8
|
//# sourceMappingURL=CardContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardContext.js","sources":["../../../../../src/components/Card/CardContext.tsx"],"sourcesContent":["import React from 'react';\nimport { throwBladeError } from '~utils/logger';\n\ntype CardContextType =
|
|
1
|
+
{"version":3,"file":"CardContext.js","sources":["../../../../../src/components/Card/CardContext.tsx"],"sourcesContent":["import React from 'react';\nimport { throwBladeError } from '~utils/logger';\n\ntype CardContextType = { size: 'large' | 'medium' | undefined };\nconst CardContext = React.createContext<CardContextType>({ size: undefined });\n\nconst useVerifyInsideCard = (componentName: string): CardContextType => {\n const context = React.useContext(CardContext);\n if (__DEV__) {\n if (!context?.size) {\n throwBladeError({\n message: `${componentName} cannot be used outside of Card component`,\n moduleName: 'Card',\n });\n }\n }\n return context;\n};\n\ntype CardProviderProps = { children: React.ReactNode };\nconst CardProvider = ({\n children,\n size,\n}: CardProviderProps & { size: 'large' | 'medium' }): React.ReactElement => {\n return <CardContext.Provider value={{ size }}>{children}</CardContext.Provider>;\n};\n\nexport { useVerifyInsideCard, CardProvider, CardContext };\n"],"names":["CardContext","React","createContext","size","undefined","useVerifyInsideCard","componentName","context","useContext","__DEV__","throwBladeError","message","moduleName","CardProvider","_ref","children","_jsx","Provider","value"],"mappings":";;;;AAIM,IAAAA,WAAW,CAAGC,cAAK,CAACC,aAAa,CAAkB,CAAEC,IAAI,CAAEC,SAAU,CAAC,EAEtE,IAAAC,mBAAmB,CAAG,SAAtBA,mBAAmBA,CAAIC,aAAqB,CAAsB,CACtE,IAAMC,OAAO,CAAGN,cAAK,CAACO,UAAU,CAACR,WAAW,CAAC,CAC7C,GAAIS,OAAO,CAAE,CACX,GAAI,EAACF,OAAO,QAAPA,OAAO,CAAEJ,IAAI,CAAA,CAAE,CAClBO,eAAe,CAAC,CACdC,OAAO,CAAG,CAAA,EAAEL,aAAc,CAAA,yCAAA,CAA0C,CACpEM,UAAU,CAAE,MACd,CAAC,CAAC,CACJ,CACF,CACA,OAAOL,OAAO,CAChB,EAGM,IAAAM,YAAY,CAAG,SAAfA,YAAYA,CAAAC,IAAA,CAG0D,CAF1E,IAAAC,QAAQ,CAAAD,IAAA,CAARC,QAAQ,CACRZ,IAAI,CAAAW,IAAA,CAAJX,IAAI,CAEJ,OAAOa,GAAA,CAAChB,WAAW,CAACiB,QAAQ,CAAA,CAACC,KAAK,CAAE,CAAEf,IAAI,CAAJA,IAAK,CAAE,CAAAY,QAAA,CAAEA,QAAQ,CAAuB,CAAC,CACjF;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
2
|
-
import 'react';
|
|
3
|
-
import { useVerifyInsideCard } from './CardContext.js';
|
|
2
|
+
import { useContext } from 'react';
|
|
3
|
+
import { useVerifyInsideCard, CardContext } from './CardContext.js';
|
|
4
4
|
import { ComponentIds } from './Card.js';
|
|
5
5
|
import { Badge } from '../Badge/Badge.js';
|
|
6
6
|
import Link from '../Link/Link/Link.js';
|
|
@@ -24,7 +24,7 @@ import { Amount } from '../Amount/Amount.js';
|
|
|
24
24
|
import { makeAnalyticsAttribute } from '../../utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js';
|
|
25
25
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
26
26
|
|
|
27
|
-
var _excluded=["children","testID","marginBottom","paddingBottom","showDivider"],_excluded2=["title","subtitle","prefix","suffix"];var _CardHeaderIcon=function _CardHeaderIcon(_ref){var Icon=_ref.icon;useVerifyInsideCard('CardHeaderIcon');return jsx(Icon,{color:"surface.icon.gray.normal",size:"large"});};var CardHeaderIcon=assignWithoutSideEffects(_CardHeaderIcon,{componentId:ComponentIds.CardHeaderIcon});var _CardHeaderCounter=function _CardHeaderCounter(props){useVerifyInsideCard('CardHeaderCounter');return jsx(Counter,Object.assign({},props));};var CardHeaderCounter=assignWithoutSideEffects(_CardHeaderCounter,{componentId:ComponentIds.CardHeaderCounter});var _CardHeaderBadge=function _CardHeaderBadge(props){useVerifyInsideCard('CardHeaderBadge');return jsx(Badge,Object.assign({},props));};var CardHeaderBadge=assignWithoutSideEffects(_CardHeaderBadge,{componentId:ComponentIds.CardHeaderBadge});var _CardHeaderAmount=function _CardHeaderAmount(props){useVerifyInsideCard('CardHeaderAmount');return jsx(Amount,Object.assign({},props));};var CardHeaderAmount=assignWithoutSideEffects(_CardHeaderAmount,{componentId:ComponentIds.CardHeaderAmount});var _CardHeaderText=function _CardHeaderText(props){useVerifyInsideCard('CardHeaderText');return jsx(Text,Object.assign({textAlign:"left"},props));};var CardHeaderText=assignWithoutSideEffects(_CardHeaderText,{componentId:ComponentIds.CardHeaderText});var _CardHeaderLink=function _CardHeaderLink(props){useVerifyInsideCard('CardHeaderLink');return jsx(Link,Object.assign({},props));};var CardHeaderLink=assignWithoutSideEffects(_CardHeaderLink,{componentId:ComponentIds.CardHeaderLink});var _CardHeaderIconButton=function _CardHeaderIconButton(props){useVerifyInsideCard('CardHeaderIconButton');return jsx(BaseBox,{width:makeSpace(minHeight.xsmall),children:jsx(Button,Object.assign({},props,{variant:"tertiary",size:"xsmall",iconPosition:"left",isFullWidth:true}))});};var CardHeaderIconButton=assignWithoutSideEffects(_CardHeaderIconButton,{componentId:ComponentIds.CardHeaderIconButton});var _CardHeader=function _CardHeader(_ref2){var children=_ref2.children,testID=_ref2.testID,_ref2$marginBottom=_ref2.marginBottom,marginBottom=_ref2$marginBottom===void 0?'spacing.4':_ref2$marginBottom,_ref2$paddingBottom=_ref2.paddingBottom,paddingBottom=_ref2$paddingBottom===void 0?'spacing.4':_ref2$paddingBottom,_ref2$showDivider=_ref2.showDivider,showDivider=_ref2$showDivider===void 0?true:_ref2$showDivider,rest=_objectWithoutProperties(_ref2,_excluded);useVerifyInsideCard('CardHeader');useVerifyAllowedChildren({children:children,componentName:'CardHeader',allowedComponents:[ComponentIds.CardHeaderLeading,ComponentIds.CardHeaderTrailing]});return jsxs(BaseBox,Object.assign({marginBottom:marginBottom},metaAttribute({name:MetaConstants.CardHeader,testID:testID}),makeAnalyticsAttribute(rest),{children:[jsx(BaseBox,{paddingBottom:paddingBottom,display:"flex",flexDirection:"row",justifyContent:"space-between",children:children}),showDivider?jsx(Divider,{}):null]}));};var CardHeader=assignWithoutSideEffects(_CardHeader,{componentId:ComponentIds.CardHeader});var _CardHeaderLeading=function _CardHeaderLeading(_ref3){var title=_ref3.title,subtitle=_ref3.subtitle,prefix=_ref3.prefix,suffix=_ref3.suffix,rest=_objectWithoutProperties(_ref3,_excluded2);useVerifyInsideCard('CardHeaderLeading');if(__DEV__){if(prefix&&!isValidAllowedChildren(prefix,ComponentIds.CardHeaderIcon)){throwBladeError({message:`Only \`${ComponentIds.CardHeaderIcon}\` component is accepted in prefix`,moduleName:'CardHeaderLeading'});}
|
|
27
|
+
var _excluded=["children","testID","marginBottom","paddingBottom","showDivider"],_excluded2=["title","subtitle","prefix","suffix"];var _CardHeaderIcon=function _CardHeaderIcon(_ref){var Icon=_ref.icon;useVerifyInsideCard('CardHeaderIcon');return jsx(Icon,{color:"surface.icon.gray.normal",size:"large"});};var CardHeaderIcon=assignWithoutSideEffects(_CardHeaderIcon,{componentId:ComponentIds.CardHeaderIcon});var _CardHeaderCounter=function _CardHeaderCounter(props){useVerifyInsideCard('CardHeaderCounter');return jsx(Counter,Object.assign({},props));};var CardHeaderCounter=assignWithoutSideEffects(_CardHeaderCounter,{componentId:ComponentIds.CardHeaderCounter});var _CardHeaderBadge=function _CardHeaderBadge(props){useVerifyInsideCard('CardHeaderBadge');return jsx(Badge,Object.assign({},props));};var CardHeaderBadge=assignWithoutSideEffects(_CardHeaderBadge,{componentId:ComponentIds.CardHeaderBadge});var _CardHeaderAmount=function _CardHeaderAmount(props){useVerifyInsideCard('CardHeaderAmount');return jsx(Amount,Object.assign({},props));};var CardHeaderAmount=assignWithoutSideEffects(_CardHeaderAmount,{componentId:ComponentIds.CardHeaderAmount});var _CardHeaderText=function _CardHeaderText(props){useVerifyInsideCard('CardHeaderText');return jsx(Text,Object.assign({textAlign:"left"},props));};var CardHeaderText=assignWithoutSideEffects(_CardHeaderText,{componentId:ComponentIds.CardHeaderText});var _CardHeaderLink=function _CardHeaderLink(props){useVerifyInsideCard('CardHeaderLink');return jsx(Link,Object.assign({},props));};var CardHeaderLink=assignWithoutSideEffects(_CardHeaderLink,{componentId:ComponentIds.CardHeaderLink});var _CardHeaderIconButton=function _CardHeaderIconButton(props){useVerifyInsideCard('CardHeaderIconButton');return jsx(BaseBox,{width:makeSpace(minHeight.xsmall),children:jsx(Button,Object.assign({},props,{variant:"tertiary",size:"xsmall",iconPosition:"left",isFullWidth:true}))});};var CardHeaderIconButton=assignWithoutSideEffects(_CardHeaderIconButton,{componentId:ComponentIds.CardHeaderIconButton});var _CardHeader=function _CardHeader(_ref2){var children=_ref2.children,testID=_ref2.testID,_ref2$marginBottom=_ref2.marginBottom,marginBottom=_ref2$marginBottom===void 0?'spacing.4':_ref2$marginBottom,_ref2$paddingBottom=_ref2.paddingBottom,paddingBottom=_ref2$paddingBottom===void 0?'spacing.4':_ref2$paddingBottom,_ref2$showDivider=_ref2.showDivider,showDivider=_ref2$showDivider===void 0?true:_ref2$showDivider,rest=_objectWithoutProperties(_ref2,_excluded);useVerifyInsideCard('CardHeader');useVerifyAllowedChildren({children:children,componentName:'CardHeader',allowedComponents:[ComponentIds.CardHeaderLeading,ComponentIds.CardHeaderTrailing]});return jsxs(BaseBox,Object.assign({marginBottom:marginBottom},metaAttribute({name:MetaConstants.CardHeader,testID:testID}),makeAnalyticsAttribute(rest),{children:[jsx(BaseBox,{paddingBottom:paddingBottom,display:"flex",flexDirection:"row",justifyContent:"space-between",children:children}),showDivider?jsx(Divider,{}):null]}));};var CardHeader=assignWithoutSideEffects(_CardHeader,{componentId:ComponentIds.CardHeader});var CardHeaderSuffixComponents=[ComponentIds.CardHeaderCounter,ComponentIds.CardHeaderLink];var _CardHeaderLeading=function _CardHeaderLeading(_ref3){var title=_ref3.title,subtitle=_ref3.subtitle,prefix=_ref3.prefix,suffix=_ref3.suffix,rest=_objectWithoutProperties(_ref3,_excluded2);useVerifyInsideCard('CardHeaderLeading');var _useContext=useContext(CardContext),size=_useContext.size;if(__DEV__){if(prefix&&!isValidAllowedChildren(prefix,ComponentIds.CardHeaderIcon)){throwBladeError({message:`Only \`${ComponentIds.CardHeaderIcon}\` component is accepted in prefix`,moduleName:'CardHeaderLeading'});}}var isSuffixACardComponent=CardHeaderSuffixComponents.includes(getComponentId(suffix));return jsx(BaseBox,Object.assign({},makeAnalyticsAttribute(rest),{display:"flex",flexDirection:"column",gap:"spacing.4",children:jsxs(BaseBox,{flex:1,display:"flex",flexDirection:"row",children:[prefix&&jsx(BaseBox,{marginRight:"spacing.3",alignSelf:"center",display:"flex",children:prefix}),jsxs(BaseBox,{marginRight:"spacing.5",children:[jsxs(BaseBox,{display:"flex",flexDirection:"row",alignItems:"center",flexWrap:"wrap",children:[jsx(Text,{color:"surface.text.gray.normal",size:size,weight:"semibold",children:title}),suffix&&isSuffixACardComponent?jsx(BaseBox,{marginLeft:"spacing.3",children:suffix}):suffix]}),subtitle&&jsx(Text,{color:"surface.text.gray.subtle",textAlign:"left",size:"small",children:subtitle})]})]})}));};var CardHeaderLeading=assignWithoutSideEffects(_CardHeaderLeading,{componentId:ComponentIds.CardHeaderLeading});var _CardHeaderTrailing=function _CardHeaderTrailing(_ref4){var visual=_ref4.visual;useVerifyInsideCard('CardHeaderTrailing');return jsx(BaseBox,{alignSelf:"center",children:visual});};var CardHeaderTrailing=assignWithoutSideEffects(_CardHeaderTrailing,{componentId:ComponentIds.CardHeaderTrailing});
|
|
28
28
|
|
|
29
29
|
export { CardHeader, CardHeaderAmount, CardHeaderBadge, CardHeaderCounter, CardHeaderIcon, CardHeaderIconButton, CardHeaderLeading, CardHeaderLink, CardHeaderText, CardHeaderTrailing };
|
|
30
30
|
//# sourceMappingURL=CardHeader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardHeader.js","sources":["../../../../../src/components/Card/CardHeader.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React from 'react';\nimport { useVerifyInsideCard } from './CardContext';\nimport { ComponentIds } from './Card';\nimport type { CardSpacingValueType } from './types';\nimport type { BadgeProps } from '~components/Badge';\nimport { Badge } from '~components/Badge';\nimport type { LinkProps } from '~components/Link';\nimport { Link } from '~components/Link';\nimport type { ButtonProps } from '~components/Button';\nimport { Button } from '~components/Button';\nimport { Counter } from '~components/Counter';\nimport type { CounterProps } from '~components/Counter';\nimport { Divider } from '~components/Divider';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { TextProps, TextVariant } from '~components/Typography';\nimport { Text } from '~components/Typography';\nimport type { IconComponent } from '~components/Icons';\nimport { minHeight } from '~components/Button/BaseButton/buttonTokens';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { DataAnalyticsAttribute, TestID } from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { makeSpace } from '~utils/makeSpace';\nimport { getComponentId, isValidAllowedChildren } from '~utils/isValidAllowedChildren';\nimport { throwBladeError } from '~utils/logger';\nimport { useVerifyAllowedChildren } from '~utils/useVerifyAllowedChildren/useVerifyAllowedChildren';\nimport type { AmountProps } from '~components/Amount';\nimport { Amount } from '~components/Amount';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\nconst _CardHeaderIcon = ({ icon: Icon }: { icon: IconComponent }): React.ReactElement => {\n useVerifyInsideCard('CardHeaderIcon');\n\n return <Icon color=\"surface.icon.gray.normal\" size=\"large\" />;\n};\nconst CardHeaderIcon = assignWithoutSideEffects(_CardHeaderIcon, {\n componentId: ComponentIds.CardHeaderIcon,\n});\n\nconst _CardHeaderCounter = (props: CounterProps): React.ReactElement => {\n useVerifyInsideCard('CardHeaderCounter');\n\n return <Counter {...props} />;\n};\nconst CardHeaderCounter = assignWithoutSideEffects(_CardHeaderCounter, {\n componentId: ComponentIds.CardHeaderCounter,\n});\n\nconst _CardHeaderBadge = (props: BadgeProps): React.ReactElement => {\n useVerifyInsideCard('CardHeaderBadge');\n\n return <Badge {...props} />;\n};\nconst CardHeaderBadge = assignWithoutSideEffects(_CardHeaderBadge, {\n componentId: ComponentIds.CardHeaderBadge,\n});\n\nconst _CardHeaderAmount = (props: AmountProps): React.ReactElement => {\n useVerifyInsideCard('CardHeaderAmount');\n\n return <Amount {...props} />;\n};\n\nconst CardHeaderAmount = assignWithoutSideEffects(_CardHeaderAmount, {\n componentId: ComponentIds.CardHeaderAmount,\n});\n\nconst _CardHeaderText = (props: TextProps<{ variant: TextVariant }>): React.ReactElement => {\n useVerifyInsideCard('CardHeaderText');\n\n return <Text textAlign=\"left\" {...props} />;\n};\nconst CardHeaderText = assignWithoutSideEffects(_CardHeaderText, {\n componentId: ComponentIds.CardHeaderText,\n});\n\nconst _CardHeaderLink = (props: LinkProps): React.ReactElement => {\n useVerifyInsideCard('CardHeaderLink');\n\n return <Link {...props} />;\n};\nconst CardHeaderLink = assignWithoutSideEffects(_CardHeaderLink, {\n componentId: ComponentIds.CardHeaderLink,\n});\n\ntype CardHeaderIconButtonProps = Omit<\n ButtonProps,\n 'variant' | 'size' | 'iconPosition' | 'isFullWidth' | 'children'\n> & {\n icon: IconComponent;\n};\n\nconst _CardHeaderIconButton = (props: CardHeaderIconButtonProps): React.ReactElement => {\n useVerifyInsideCard('CardHeaderIconButton');\n\n return (\n <BaseBox width={makeSpace(minHeight.xsmall)}>\n <Button {...props} variant=\"tertiary\" size=\"xsmall\" iconPosition=\"left\" isFullWidth />\n </BaseBox>\n );\n};\nconst CardHeaderIconButton = assignWithoutSideEffects(_CardHeaderIconButton, {\n componentId: ComponentIds.CardHeaderIconButton,\n});\n\ntype CardHeaderProps = {\n children?: React.ReactNode;\n /**\n * For spacing between divider and header title\n */\n paddingBottom?: CardSpacingValueType;\n /**\n * For spacing between body content and divider\n */\n marginBottom?: CardSpacingValueType;\n /**\n * @default true\n */\n showDivider?: boolean;\n} & TestID &\n DataAnalyticsAttribute;\n\nconst _CardHeader = ({\n children,\n testID,\n marginBottom = 'spacing.4',\n paddingBottom = 'spacing.4',\n showDivider = true,\n ...rest\n}: CardHeaderProps): React.ReactElement => {\n useVerifyInsideCard('CardHeader');\n useVerifyAllowedChildren({\n children,\n componentName: 'CardHeader',\n allowedComponents: [ComponentIds.CardHeaderLeading, ComponentIds.CardHeaderTrailing],\n });\n\n return (\n <BaseBox\n marginBottom={marginBottom}\n {...metaAttribute({ name: MetaConstants.CardHeader, testID })}\n {...makeAnalyticsAttribute(rest)}\n >\n <BaseBox\n paddingBottom={paddingBottom}\n display=\"flex\"\n flexDirection=\"row\"\n justifyContent=\"space-between\"\n >\n {children}\n </BaseBox>\n {showDivider ? <Divider /> : null}\n </BaseBox>\n );\n};\nconst CardHeader = assignWithoutSideEffects(_CardHeader, { componentId: ComponentIds.CardHeader });\n\ntype CardHeaderLeadingProps = {\n title: string;\n subtitle?: string;\n /**\n * prefix element of Card\n *\n * Accepts: `CardHeaderIcon` component\n */\n prefix?: React.ReactNode;\n /**\n * suffix element of Card\n *\n * Accepts: `CardHeaderCounter` component\n */\n suffix?: React.ReactNode;\n} & DataAnalyticsAttribute;\nconst _CardHeaderLeading = ({\n title,\n subtitle,\n prefix,\n suffix,\n ...rest\n}: CardHeaderLeadingProps): React.ReactElement => {\n useVerifyInsideCard('CardHeaderLeading');\n\n if (__DEV__) {\n if (prefix && !isValidAllowedChildren(prefix, ComponentIds.CardHeaderIcon)) {\n throwBladeError({\n message: `Only \\`${ComponentIds.CardHeaderIcon}\\` component is accepted in prefix`,\n moduleName: 'CardHeaderLeading',\n });\n }\n\n if (suffix && !isValidAllowedChildren(suffix, ComponentIds.CardHeaderCounter)) {\n throwBladeError({\n message: `Only \\`${ComponentIds.CardHeaderCounter}\\` component is accepted in prefix`,\n moduleName: 'CardHeaderLeading',\n });\n }\n }\n\n return (\n <BaseBox {...makeAnalyticsAttribute(rest)} flex={1} display=\"flex\" flexDirection=\"row\">\n <BaseBox marginRight=\"spacing.3\" alignSelf=\"center\" display=\"flex\">\n {prefix}\n </BaseBox>\n <BaseBox marginRight=\"spacing.5\">\n <BaseBox display=\"flex\" flexDirection=\"row\" alignItems=\"center\" flexWrap=\"wrap\">\n <Text color=\"surface.text.gray.normal\" size=\"large\" weight=\"semibold\">\n {title}\n </Text>\n <BaseBox marginLeft=\"spacing.3\">{suffix}</BaseBox>\n </BaseBox>\n {subtitle && (\n <Text color=\"surface.text.gray.subtle\" textAlign=\"left\" size=\"small\">\n {subtitle}\n </Text>\n )}\n </BaseBox>\n </BaseBox>\n );\n};\nconst CardHeaderLeading = assignWithoutSideEffects(_CardHeaderLeading, {\n componentId: ComponentIds.CardHeaderLeading,\n});\n\ntype CardHeaderTrailingProps = {\n /**\n * Renders a visual ornament in card header trailing section\n *\n * Accepts: `CardHeaderLink`, `CardHeaderText`, `CardHeaderIconButton`, `CardHeaderBadge`\n */\n visual?: React.ReactNode;\n};\n\nconst headerTrailingAllowedComponents = [\n ComponentIds.CardHeaderLink,\n ComponentIds.CardHeaderText,\n ComponentIds.CardHeaderIconButton,\n ComponentIds.CardHeaderBadge,\n ComponentIds.CardHeaderAmount,\n];\n\nconst _CardHeaderTrailing = ({ visual }: CardHeaderTrailingProps): React.ReactElement => {\n useVerifyInsideCard('CardHeaderTrailing');\n\n if (__DEV__) {\n if (visual && !headerTrailingAllowedComponents.includes(getComponentId(visual)!)) {\n throwBladeError({\n message: `Only one of \\`${headerTrailingAllowedComponents.join(\n ', ',\n )}\\` component is accepted in visual`,\n moduleName: 'CardHeaderTrailing',\n });\n }\n }\n\n return <BaseBox alignSelf=\"center\">{visual}</BaseBox>;\n};\nconst CardHeaderTrailing = assignWithoutSideEffects(_CardHeaderTrailing, {\n componentId: ComponentIds.CardHeaderTrailing,\n});\n\nexport {\n CardHeader,\n CardHeaderLeading,\n CardHeaderTrailing,\n CardHeaderBadge,\n CardHeaderIcon,\n CardHeaderCounter,\n CardHeaderText,\n CardHeaderLink,\n CardHeaderAmount,\n CardHeaderIconButton,\n};\n"],"names":["_CardHeaderIcon","_ref","Icon","icon","useVerifyInsideCard","_jsx","color","size","CardHeaderIcon","assignWithoutSideEffects","componentId","ComponentIds","_CardHeaderCounter","props","Counter","Object","assign","CardHeaderCounter","_CardHeaderBadge","Badge","CardHeaderBadge","_CardHeaderAmount","Amount","CardHeaderAmount","_CardHeaderText","Text","textAlign","CardHeaderText","_CardHeaderLink","Link","CardHeaderLink","_CardHeaderIconButton","BaseBox","width","makeSpace","minHeight","xsmall","children","Button","variant","iconPosition","isFullWidth","CardHeaderIconButton","_CardHeader","_ref2","testID","_ref2$marginBottom","marginBottom","_ref2$paddingBottom","paddingBottom","_ref2$showDivider","showDivider","rest","_objectWithoutProperties","_excluded","useVerifyAllowedChildren","componentName","allowedComponents","CardHeaderLeading","CardHeaderTrailing","_jsxs","metaAttribute","name","MetaConstants","CardHeader","makeAnalyticsAttribute","display","flexDirection","justifyContent","Divider","_CardHeaderLeading","_ref3","title","subtitle","prefix","suffix","_excluded2","__DEV__","isValidAllowedChildren","throwBladeError","message","moduleName","flex","marginRight","alignSelf","alignItems","flexWrap","weight","marginLeft","headerTrailingAllowedComponents","_CardHeaderTrailing","_ref4","visual","includes","getComponentId","join"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAA,SAAA,CAAA,CAAA,UAAA,CAAA,QAAA,CAAA,cAAA,CAAA,eAAA,CAAA,aAAA,CAAA,CAAA,UAAA,CAAA,CAAA,OAAA,CAAA,UAAA,CAAA,QAAA,CAAA,QAAA,CAAA,CA6BA,IAAMA,eAAe,CAAG,SAAlBA,eAAeA,CAAAC,IAAA,CAAoE,CAAxD,IAAAC,IAAI,CAAAD,IAAA,CAAVE,IAAI,CAC7BC,mBAAmB,CAAC,gBAAgB,CAAC,CAErC,OAAOC,GAAA,CAACH,IAAI,CAAA,CAACI,KAAK,CAAC,0BAA0B,CAACC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,CACdC,OAAO,CAAG,CAAA,cAAA,EAAgBS,+BAA+B,CAACM,IAAI,CAC5D,IACF,CAAE,CAAA,kCAAA,CAAmC,CACrCd,UAAU,CAAE,oBACd,CAAC,CAAC,CACJ,CACF,CAEA,OAAO5E,GAAA,CAAC2B,OAAO,CAAA,CAACoD,SAAS,CAAC,QAAQ,CAAA/C,QAAA,CAAEuD,MAAM,CAAU,CAAC,CACvD,CAAC,CACK,IAAAjC,kBAAkB,CAAGlD,wBAAwB,CAACiF,mBAAmB,CAAE,CACvEhF,WAAW,CAAEC,YAAY,CAACgD,kBAC5B,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"CardHeader.js","sources":["../../../../../src/components/Card/CardHeader.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React, { useContext } from 'react';\nimport { useVerifyInsideCard, CardContext } from './CardContext';\nimport { ComponentIds } from './Card';\nimport type { CardSpacingValueType } from './types';\nimport type { BadgeProps } from '~components/Badge';\nimport { Badge } from '~components/Badge';\nimport type { LinkProps } from '~components/Link';\nimport { Link } from '~components/Link';\nimport type { ButtonProps } from '~components/Button';\nimport { Button } from '~components/Button';\nimport { Counter } from '~components/Counter';\nimport type { CounterProps } from '~components/Counter';\nimport { Divider } from '~components/Divider';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { TextProps, TextVariant } from '~components/Typography';\nimport { Text } from '~components/Typography';\nimport type { IconComponent } from '~components/Icons';\nimport { minHeight } from '~components/Button/BaseButton/buttonTokens';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { DataAnalyticsAttribute, TestID } from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { makeSpace } from '~utils/makeSpace';\nimport { getComponentId, isValidAllowedChildren } from '~utils/isValidAllowedChildren';\nimport { throwBladeError } from '~utils/logger';\nimport { useVerifyAllowedChildren } from '~utils/useVerifyAllowedChildren/useVerifyAllowedChildren';\nimport type { AmountProps } from '~components/Amount';\nimport { Amount } from '~components/Amount';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\nconst _CardHeaderIcon = ({ icon: Icon }: { icon: IconComponent }): React.ReactElement => {\n useVerifyInsideCard('CardHeaderIcon');\n\n return <Icon color=\"surface.icon.gray.normal\" size=\"large\" />;\n};\nconst CardHeaderIcon = assignWithoutSideEffects(_CardHeaderIcon, {\n componentId: ComponentIds.CardHeaderIcon,\n});\n\nconst _CardHeaderCounter = (props: CounterProps): React.ReactElement => {\n useVerifyInsideCard('CardHeaderCounter');\n\n return <Counter {...props} />;\n};\nconst CardHeaderCounter = assignWithoutSideEffects(_CardHeaderCounter, {\n componentId: ComponentIds.CardHeaderCounter,\n});\n\nconst _CardHeaderBadge = (props: BadgeProps): React.ReactElement => {\n useVerifyInsideCard('CardHeaderBadge');\n\n return <Badge {...props} />;\n};\nconst CardHeaderBadge = assignWithoutSideEffects(_CardHeaderBadge, {\n componentId: ComponentIds.CardHeaderBadge,\n});\n\nconst _CardHeaderAmount = (props: AmountProps): React.ReactElement => {\n useVerifyInsideCard('CardHeaderAmount');\n\n return <Amount {...props} />;\n};\n\nconst CardHeaderAmount = assignWithoutSideEffects(_CardHeaderAmount, {\n componentId: ComponentIds.CardHeaderAmount,\n});\n\nconst _CardHeaderText = (props: TextProps<{ variant: TextVariant }>): React.ReactElement => {\n useVerifyInsideCard('CardHeaderText');\n\n return <Text textAlign=\"left\" {...props} />;\n};\nconst CardHeaderText = assignWithoutSideEffects(_CardHeaderText, {\n componentId: ComponentIds.CardHeaderText,\n});\n\nconst _CardHeaderLink = (props: LinkProps): React.ReactElement => {\n useVerifyInsideCard('CardHeaderLink');\n\n return <Link {...props} />;\n};\nconst CardHeaderLink = assignWithoutSideEffects(_CardHeaderLink, {\n componentId: ComponentIds.CardHeaderLink,\n});\n\ntype CardHeaderIconButtonProps = Omit<\n ButtonProps,\n 'variant' | 'size' | 'iconPosition' | 'isFullWidth' | 'children'\n> & {\n icon: IconComponent;\n};\n\nconst _CardHeaderIconButton = (props: CardHeaderIconButtonProps): React.ReactElement => {\n useVerifyInsideCard('CardHeaderIconButton');\n\n return (\n <BaseBox width={makeSpace(minHeight.xsmall)}>\n <Button {...props} variant=\"tertiary\" size=\"xsmall\" iconPosition=\"left\" isFullWidth />\n </BaseBox>\n );\n};\nconst CardHeaderIconButton = assignWithoutSideEffects(_CardHeaderIconButton, {\n componentId: ComponentIds.CardHeaderIconButton,\n});\n\ntype CardHeaderProps = {\n children?: React.ReactNode;\n /**\n * For spacing between divider and header title\n */\n paddingBottom?: CardSpacingValueType;\n /**\n * For spacing between body content and divider\n */\n marginBottom?: CardSpacingValueType;\n /**\n * @default true\n */\n showDivider?: boolean;\n} & TestID &\n DataAnalyticsAttribute;\n\nconst _CardHeader = ({\n children,\n testID,\n marginBottom = 'spacing.4',\n paddingBottom = 'spacing.4',\n showDivider = true,\n ...rest\n}: CardHeaderProps): React.ReactElement => {\n useVerifyInsideCard('CardHeader');\n useVerifyAllowedChildren({\n children,\n componentName: 'CardHeader',\n allowedComponents: [ComponentIds.CardHeaderLeading, ComponentIds.CardHeaderTrailing],\n });\n\n return (\n <BaseBox\n marginBottom={marginBottom}\n {...metaAttribute({ name: MetaConstants.CardHeader, testID })}\n {...makeAnalyticsAttribute(rest)}\n >\n <BaseBox\n paddingBottom={paddingBottom}\n display=\"flex\"\n flexDirection=\"row\"\n justifyContent=\"space-between\"\n >\n {children}\n </BaseBox>\n {showDivider ? <Divider /> : null}\n </BaseBox>\n );\n};\nconst CardHeader = assignWithoutSideEffects(_CardHeader, { componentId: ComponentIds.CardHeader });\n\nconst CardHeaderSuffixComponents = [ComponentIds.CardHeaderCounter, ComponentIds.CardHeaderLink];\ntype CardHeaderLeadingProps = {\n title: string;\n subtitle?: string;\n /**\n * prefix element of Card\n *\n * Accepts: `CardHeaderIcon` component\n */\n prefix?: React.ReactNode;\n /**\n * suffix element of Card\n *\n * it add marginLeft to `CardHeaderCounter`,`CardHeaderLink` components by default.\n */\n suffix?: React.ReactNode;\n} & DataAnalyticsAttribute;\nconst _CardHeaderLeading = ({\n title,\n subtitle,\n prefix,\n suffix,\n ...rest\n}: CardHeaderLeadingProps): React.ReactElement => {\n useVerifyInsideCard('CardHeaderLeading');\n const { size } = useContext(CardContext);\n\n if (__DEV__) {\n if (prefix && !isValidAllowedChildren(prefix, ComponentIds.CardHeaderIcon)) {\n throwBladeError({\n message: `Only \\`${ComponentIds.CardHeaderIcon}\\` component is accepted in prefix`,\n moduleName: 'CardHeaderLeading',\n });\n }\n }\n\n const isSuffixACardComponent = CardHeaderSuffixComponents.includes(getComponentId(suffix)!);\n\n return (\n <BaseBox\n {...makeAnalyticsAttribute(rest)}\n display=\"flex\"\n flexDirection=\"column\"\n gap=\"spacing.4\"\n >\n <BaseBox flex={1} display=\"flex\" flexDirection=\"row\">\n {prefix && (\n <BaseBox marginRight=\"spacing.3\" alignSelf=\"center\" display=\"flex\">\n {prefix}\n </BaseBox>\n )}\n\n <BaseBox marginRight=\"spacing.5\">\n <BaseBox display=\"flex\" flexDirection=\"row\" alignItems=\"center\" flexWrap=\"wrap\">\n <Text color=\"surface.text.gray.normal\" size={size} weight=\"semibold\">\n {title}\n </Text>\n {/* if we are using CardHeaderSuffixComponents we still need marginLeft for spacing ,\n but if it's not a CardHeaderSuffixComponents we don't need marginLeft for example in case of tooltip */}\n {suffix && isSuffixACardComponent ? (\n <BaseBox marginLeft=\"spacing.3\">{suffix}</BaseBox>\n ) : (\n suffix\n )}\n </BaseBox>\n {subtitle && (\n <Text color=\"surface.text.gray.subtle\" textAlign=\"left\" size=\"small\">\n {subtitle}\n </Text>\n )}\n </BaseBox>\n </BaseBox>\n </BaseBox>\n );\n};\nconst CardHeaderLeading = assignWithoutSideEffects(_CardHeaderLeading, {\n componentId: ComponentIds.CardHeaderLeading,\n});\n\ntype CardHeaderTrailingProps = {\n /**\n * Renders a visual ornament in card header trailing section\n *\n */\n visual?: React.ReactNode;\n};\n\nconst _CardHeaderTrailing = ({ visual }: CardHeaderTrailingProps): React.ReactElement => {\n useVerifyInsideCard('CardHeaderTrailing');\n\n return <BaseBox alignSelf=\"center\">{visual}</BaseBox>;\n};\nconst CardHeaderTrailing = assignWithoutSideEffects(_CardHeaderTrailing, {\n componentId: ComponentIds.CardHeaderTrailing,\n});\n\nexport {\n CardHeader,\n CardHeaderLeading,\n CardHeaderTrailing,\n CardHeaderBadge,\n CardHeaderIcon,\n CardHeaderCounter,\n CardHeaderText,\n CardHeaderLink,\n CardHeaderAmount,\n CardHeaderIconButton,\n};\n"],"names":["_CardHeaderIcon","_ref","Icon","icon","useVerifyInsideCard","_jsx","color","size","CardHeaderIcon","assignWithoutSideEffects","componentId","ComponentIds","_CardHeaderCounter","props","Counter","Object","assign","CardHeaderCounter","_CardHeaderBadge","Badge","CardHeaderBadge","_CardHeaderAmount","Amount","CardHeaderAmount","_CardHeaderText","Text","textAlign","CardHeaderText","_CardHeaderLink","Link","CardHeaderLink","_CardHeaderIconButton","BaseBox","width","makeSpace","minHeight","xsmall","children","Button","variant","iconPosition","isFullWidth","CardHeaderIconButton","_CardHeader","_ref2","testID","_ref2$marginBottom","marginBottom","_ref2$paddingBottom","paddingBottom","_ref2$showDivider","showDivider","rest","_objectWithoutProperties","_excluded","useVerifyAllowedChildren","componentName","allowedComponents","CardHeaderLeading","CardHeaderTrailing","_jsxs","metaAttribute","name","MetaConstants","CardHeader","makeAnalyticsAttribute","display","flexDirection","justifyContent","Divider","CardHeaderSuffixComponents","_CardHeaderLeading","_ref3","title","subtitle","prefix","suffix","_excluded2","_useContext","useContext","CardContext","__DEV__","isValidAllowedChildren","throwBladeError","message","moduleName","isSuffixACardComponent","includes","getComponentId","gap","flex","marginRight","alignSelf","alignItems","flexWrap","weight","marginLeft","_CardHeaderTrailing","_ref4","visual"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAA,SAAA,CAAA,CAAA,UAAA,CAAA,QAAA,CAAA,cAAA,CAAA,eAAA,CAAA,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AwB,CAAC8D,kBAAkB,CAAE,CACrE7D,WAAW,CAAEC,YAAY,CAAC+C,iBAC5B,CAAC,EAUD,IAAMuC,mBAAmB,CAAG,SAAtBA,mBAAmBA,CAAAC,KAAA,CAAgE,CAA1D,IAAAC,MAAM,CAAAD,KAAA,CAANC,MAAM,CACnC/F,mBAAmB,CAAC,oBAAoB,CAAC,CAEzC,OAAOC,GAAA,CAAC2B,OAAO,CAAC4D,CAAAA,SAAS,CAAC,QAAQ,CAAAvD,QAAA,CAAE8D,MAAM,CAAU,CAAC,CACvD,CAAC,CACK,IAAAxC,kBAAkB,CAAGlD,wBAAwB,CAACwF,mBAAmB,CAAE,CACvEvF,WAAW,CAAEC,YAAY,CAACgD,kBAC5B,CAAC;;;;"}
|
|
@@ -15,7 +15,7 @@ import { isReactNative } from '../../../utils/platform/isReactNative.js';
|
|
|
15
15
|
import '../../BladeProvider/useTheme.js';
|
|
16
16
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
17
17
|
|
|
18
|
-
var getVisualContainerStyles=function getVisualContainerStyles(){var _ref=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},shouldStretchTrailingBox=_ref.shouldStretchTrailingBox;return {display:'flex',flexDirection:'row',alignItems:'center',alignSelf:shouldStretchTrailingBox?'stretch':'center'};};var trailingIconColor={none:'surface.icon.gray.subtle',error:'feedback.icon.negative.intense',success:'feedback.icon.positive.intense'};var iconSize={medium:'medium',large:'large'};var textSize={medium:'medium',large:'large'};var getPrefixStyles=function getPrefixStyles(_ref2){var hasLeadingIcon=_ref2.hasLeadingIcon,hasPrefix=_ref2.hasPrefix;if(hasPrefix&&hasLeadingIcon){return {paddingLeft:'spacing.3'};}if(hasPrefix&&!hasLeadingIcon){return {paddingLeft:'spacing.4'};}return {paddingLeft:'spacing.0'};};var getInteractionElementStyles=function getInteractionElementStyles(_ref3){var hasTrailingIcon=_ref3.hasTrailingIcon,hasLeadingInteractionElement=_ref3.hasLeadingInteractionElement,hasLeadingDropDown=_ref3.hasLeadingDropDown,hasTrailingInteractionElement=_ref3.hasTrailingInteractionElement,hasSuffix=_ref3.hasSuffix,hasTrailingButton=_ref3.hasTrailingButton,hasTrailingDropDown=_ref3.hasTrailingDropDown;if(hasTrailingInteractionElement&&(hasSuffix||hasTrailingIcon||hasTrailingButton)){return 'spacing.2';}if(hasLeadingDropDown||hasTrailingDropDown){return 'spacing.2';}if(hasTrailingInteractionElement&&!hasSuffix&&!hasTrailingIcon&&!hasTrailingButton){return 'spacing.4';}if(hasLeadingInteractionElement){return 'spacing.3';}return 'spacing.0';};var getSuffixStyles=function getSuffixStyles(_ref4){var hasTrailingIcon=_ref4.hasTrailingIcon,hasSuffix=_ref4.hasSuffix,hasTrailingButton=_ref4.hasTrailingButton;if(hasSuffix&&(hasTrailingIcon||hasTrailingButton)){return {paddingRight:'spacing.3'};}if(hasSuffix&&!hasTrailingIcon&&!hasTrailingButton){return {paddingRight:'spacing.4'};}return {paddingRight:'spacing.0'};};var getTrailingIconStyles=function getTrailingIconStyles(_ref5){var hasTrailingIcon=_ref5.hasTrailingIcon,hasTrailingButton=_ref5.hasTrailingButton;if(hasTrailingIcon&&hasTrailingButton){return {paddingRight:'spacing.3'};}if(hasTrailingIcon&&!hasTrailingButton){return {paddingRight:'spacing.4'};}return {paddingRight:'spacing.0'};};var getInputVisualsToBeRendered=function getInputVisualsToBeRendered(_ref6){var leadingIcon=_ref6.leadingIcon,prefix=_ref6.prefix,trailingInteractionElement=_ref6.trailingInteractionElement,leadingInteractionElement=_ref6.leadingInteractionElement,suffix=_ref6.suffix,trailingIcon=_ref6.trailingIcon,trailingButton=_ref6.trailingButton,leadingDropDown=_ref6.leadingDropDown,trailingDropDown=_ref6.trailingDropDown;return {hasLeadingIcon:Boolean(leadingIcon),hasPrefix:Boolean(prefix),hasTrailingInteractionElement:Boolean(trailingInteractionElement),hasLeadingInteractionElement:Boolean(leadingInteractionElement),hasSuffix:Boolean(suffix),hasTrailingIcon:Boolean(trailingIcon),hasTrailingButton:Boolean(trailingButton),hasLeadingDropDown:Boolean(leadingDropDown),hasTrailingDropDown:Boolean(trailingDropDown)};};var getTooltipContent=function getTooltipContent(_ref7){var validationState=_ref7.validationState,errorText=_ref7.errorText,successText=_ref7.successText;if(validationState==='error'&&errorText){return errorText;}if(validationState==='success'&&successText){return successText;}return '';};var ValidationIconTooltip=function ValidationIconTooltip(_ref8){var children=_ref8.children,validationState=_ref8.validationState,errorText=_ref8.errorText,successText=_ref8.successText,showHintsAsTooltip=_ref8.showHintsAsTooltip;if(showHintsAsTooltip&&validationState==='error'&&errorText||validationState==='success'&&successText){return jsx(Tooltip,{content:getTooltipContent({validationState:validationState,errorText:errorText,successText:successText}),children:jsx(Box,{display:"flex",justifyContent:"center",alignItems:"center",children:children})});}return children;};var BaseInputVisuals=function BaseInputVisuals(_ref9){var LeadingIcon=_ref9.leadingIcon,prefix=_ref9.prefix,trailingInteractionElement=_ref9.trailingInteractionElement,onTrailingInteractionElementClick=_ref9.onTrailingInteractionElementClick,leadingDropDown=_ref9.leadingDropDown,trailingDropDown=_ref9.trailingDropDown,leadingInteractionElement=_ref9.leadingInteractionElement,suffix=_ref9.suffix,TrailingIcon=_ref9.trailingIcon,isDisabled=_ref9.isDisabled,_ref9$validationState=_ref9.validationState,validationState=_ref9$validationState===void 0?'none':_ref9$validationState,size=_ref9.size,showHintsAsTooltip=_ref9.showHintsAsTooltip,errorText=_ref9.errorText,successText=_ref9.successText,TrailingButton=_ref9.trailingButton;var _getInputVisualsToBeR=getInputVisualsToBeRendered({leadingIcon:LeadingIcon,prefix:prefix,leadingInteractionElement:leadingInteractionElement,trailingInteractionElement:trailingInteractionElement,suffix:suffix,trailingIcon:TrailingIcon,trailingButton:TrailingButton,leadingDropDown:leadingDropDown,trailingDropDown:trailingDropDown,size:size}),hasLeadingIcon=_getInputVisualsToBeR.hasLeadingIcon,hasPrefix=_getInputVisualsToBeR.hasPrefix,hasSuffix=_getInputVisualsToBeR.hasSuffix,hasTrailingInteractionElement=_getInputVisualsToBeR.hasTrailingInteractionElement,hasLeadingInteractionElement=_getInputVisualsToBeR.hasLeadingInteractionElement,hasTrailingIcon=_getInputVisualsToBeR.hasTrailingIcon,hasTrailingButton=_getInputVisualsToBeR.hasTrailingButton,hasLeadingDropDown=_getInputVisualsToBeR.hasLeadingDropDown,hasTrailingDropDown=_getInputVisualsToBeR.hasTrailingDropDown;var hasLeadingVisuals=hasLeadingInteractionElement||hasLeadingIcon||hasPrefix||hasLeadingDropDown;var hasTrailingVisuals=hasTrailingInteractionElement||hasSuffix||hasTrailingIcon||hasTrailingButton||hasTrailingDropDown;if(__DEV__){if(hasTrailingButton&&!isValidAllowedChildren(TrailingButton,'Link')){throwBladeError({message:'trailingButton must be a valid Blade Link component',moduleName:'BaseInput'});}}if(hasLeadingVisuals){return jsxs(BaseBox,Object.assign({},getVisualContainerStyles(),{children:[hasLeadingInteractionElement?jsx(BaseBox,{paddingLeft:getInteractionElementStyles({hasTrailingIcon:hasTrailingIcon,hasLeadingInteractionElement:hasLeadingInteractionElement,hasSuffix:hasSuffix,hasTrailingButton:hasTrailingButton}),display:"flex",alignItems:"stretch",alignSelf:"stretch",children:leadingInteractionElement}):null,LeadingIcon?jsx(BaseBox,{paddingLeft:"spacing.4",display:"flex",children:jsx(LeadingIcon,{size:iconSize[size],color:isDisabled?'surface.icon.gray.disabled':'surface.icon.gray.muted'})}):null,hasPrefix?jsx(BaseBox,Object.assign({},getPrefixStyles({hasLeadingIcon:hasLeadingIcon,hasPrefix:hasPrefix}),{children:jsx(Text,{size:textSize[size],variant:"body",weight:"regular",color:isDisabled?'surface.text.gray.disabled':'surface.text.gray.
|
|
18
|
+
var getVisualContainerStyles=function getVisualContainerStyles(){var _ref=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},shouldStretchTrailingBox=_ref.shouldStretchTrailingBox;return {display:'flex',flexDirection:'row',alignItems:'center',alignSelf:shouldStretchTrailingBox?'stretch':'center'};};var trailingIconColor={none:'surface.icon.gray.subtle',error:'feedback.icon.negative.intense',success:'feedback.icon.positive.intense'};var iconSize={medium:'medium',large:'large'};var textSize={medium:'medium',large:'large'};var getPrefixStyles=function getPrefixStyles(_ref2){var hasLeadingIcon=_ref2.hasLeadingIcon,hasPrefix=_ref2.hasPrefix;if(hasPrefix&&hasLeadingIcon){return {paddingLeft:'spacing.3'};}if(hasPrefix&&!hasLeadingIcon){return {paddingLeft:'spacing.4'};}return {paddingLeft:'spacing.0'};};var getInteractionElementStyles=function getInteractionElementStyles(_ref3){var hasTrailingIcon=_ref3.hasTrailingIcon,hasLeadingInteractionElement=_ref3.hasLeadingInteractionElement,hasLeadingDropDown=_ref3.hasLeadingDropDown,hasTrailingInteractionElement=_ref3.hasTrailingInteractionElement,hasSuffix=_ref3.hasSuffix,hasTrailingButton=_ref3.hasTrailingButton,hasTrailingDropDown=_ref3.hasTrailingDropDown;if(hasTrailingInteractionElement&&(hasSuffix||hasTrailingIcon||hasTrailingButton)){return 'spacing.2';}if(hasLeadingDropDown||hasTrailingDropDown){return 'spacing.2';}if(hasTrailingInteractionElement&&!hasSuffix&&!hasTrailingIcon&&!hasTrailingButton){return 'spacing.4';}if(hasLeadingInteractionElement){return 'spacing.3';}return 'spacing.0';};var getSuffixStyles=function getSuffixStyles(_ref4){var hasTrailingIcon=_ref4.hasTrailingIcon,hasSuffix=_ref4.hasSuffix,hasTrailingButton=_ref4.hasTrailingButton;if(hasSuffix&&(hasTrailingIcon||hasTrailingButton)){return {paddingRight:'spacing.3'};}if(hasSuffix&&!hasTrailingIcon&&!hasTrailingButton){return {paddingRight:'spacing.4'};}return {paddingRight:'spacing.0'};};var getTrailingIconStyles=function getTrailingIconStyles(_ref5){var hasTrailingIcon=_ref5.hasTrailingIcon,hasTrailingButton=_ref5.hasTrailingButton;if(hasTrailingIcon&&hasTrailingButton){return {paddingRight:'spacing.3'};}if(hasTrailingIcon&&!hasTrailingButton){return {paddingRight:'spacing.4'};}return {paddingRight:'spacing.0'};};var getInputVisualsToBeRendered=function getInputVisualsToBeRendered(_ref6){var leadingIcon=_ref6.leadingIcon,prefix=_ref6.prefix,trailingInteractionElement=_ref6.trailingInteractionElement,leadingInteractionElement=_ref6.leadingInteractionElement,suffix=_ref6.suffix,trailingIcon=_ref6.trailingIcon,trailingButton=_ref6.trailingButton,leadingDropDown=_ref6.leadingDropDown,trailingDropDown=_ref6.trailingDropDown;return {hasLeadingIcon:Boolean(leadingIcon),hasPrefix:Boolean(prefix),hasTrailingInteractionElement:Boolean(trailingInteractionElement),hasLeadingInteractionElement:Boolean(leadingInteractionElement),hasSuffix:Boolean(suffix),hasTrailingIcon:Boolean(trailingIcon),hasTrailingButton:Boolean(trailingButton),hasLeadingDropDown:Boolean(leadingDropDown),hasTrailingDropDown:Boolean(trailingDropDown)};};var getTooltipContent=function getTooltipContent(_ref7){var validationState=_ref7.validationState,errorText=_ref7.errorText,successText=_ref7.successText;if(validationState==='error'&&errorText){return errorText;}if(validationState==='success'&&successText){return successText;}return '';};var ValidationIconTooltip=function ValidationIconTooltip(_ref8){var children=_ref8.children,validationState=_ref8.validationState,errorText=_ref8.errorText,successText=_ref8.successText,showHintsAsTooltip=_ref8.showHintsAsTooltip;if(showHintsAsTooltip&&validationState==='error'&&errorText||validationState==='success'&&successText){return jsx(Tooltip,{content:getTooltipContent({validationState:validationState,errorText:errorText,successText:successText}),children:jsx(Box,{display:"flex",justifyContent:"center",alignItems:"center",children:children})});}return children;};var BaseInputVisuals=function BaseInputVisuals(_ref9){var LeadingIcon=_ref9.leadingIcon,prefix=_ref9.prefix,trailingInteractionElement=_ref9.trailingInteractionElement,onTrailingInteractionElementClick=_ref9.onTrailingInteractionElementClick,leadingDropDown=_ref9.leadingDropDown,trailingDropDown=_ref9.trailingDropDown,leadingInteractionElement=_ref9.leadingInteractionElement,suffix=_ref9.suffix,TrailingIcon=_ref9.trailingIcon,isDisabled=_ref9.isDisabled,_ref9$validationState=_ref9.validationState,validationState=_ref9$validationState===void 0?'none':_ref9$validationState,size=_ref9.size,showHintsAsTooltip=_ref9.showHintsAsTooltip,errorText=_ref9.errorText,successText=_ref9.successText,TrailingButton=_ref9.trailingButton;var _getInputVisualsToBeR=getInputVisualsToBeRendered({leadingIcon:LeadingIcon,prefix:prefix,leadingInteractionElement:leadingInteractionElement,trailingInteractionElement:trailingInteractionElement,suffix:suffix,trailingIcon:TrailingIcon,trailingButton:TrailingButton,leadingDropDown:leadingDropDown,trailingDropDown:trailingDropDown,size:size}),hasLeadingIcon=_getInputVisualsToBeR.hasLeadingIcon,hasPrefix=_getInputVisualsToBeR.hasPrefix,hasSuffix=_getInputVisualsToBeR.hasSuffix,hasTrailingInteractionElement=_getInputVisualsToBeR.hasTrailingInteractionElement,hasLeadingInteractionElement=_getInputVisualsToBeR.hasLeadingInteractionElement,hasTrailingIcon=_getInputVisualsToBeR.hasTrailingIcon,hasTrailingButton=_getInputVisualsToBeR.hasTrailingButton,hasLeadingDropDown=_getInputVisualsToBeR.hasLeadingDropDown,hasTrailingDropDown=_getInputVisualsToBeR.hasTrailingDropDown;var hasLeadingVisuals=hasLeadingInteractionElement||hasLeadingIcon||hasPrefix||hasLeadingDropDown;var hasTrailingVisuals=hasTrailingInteractionElement||hasSuffix||hasTrailingIcon||hasTrailingButton||hasTrailingDropDown;if(__DEV__){if(hasTrailingButton&&!isValidAllowedChildren(TrailingButton,'Link')){throwBladeError({message:'trailingButton must be a valid Blade Link component',moduleName:'BaseInput'});}}if(hasLeadingVisuals){return jsxs(BaseBox,Object.assign({},getVisualContainerStyles(),{children:[hasLeadingInteractionElement?jsx(BaseBox,{paddingLeft:getInteractionElementStyles({hasTrailingIcon:hasTrailingIcon,hasLeadingInteractionElement:hasLeadingInteractionElement,hasSuffix:hasSuffix,hasTrailingButton:hasTrailingButton}),display:"flex",alignItems:"stretch",alignSelf:"stretch",children:leadingInteractionElement}):null,LeadingIcon?jsx(BaseBox,{paddingLeft:"spacing.4",display:"flex",children:jsx(LeadingIcon,{size:iconSize[size],color:isDisabled?'surface.icon.gray.disabled':'surface.icon.gray.muted'})}):null,hasPrefix?jsx(BaseBox,Object.assign({},getPrefixStyles({hasLeadingIcon:hasLeadingIcon,hasPrefix:hasPrefix}),{children:jsx(Text,{size:textSize[size],variant:"body",weight:"regular",color:isDisabled?'surface.text.gray.disabled':'surface.text.gray.muted',children:prefix})})):null,leadingDropDown?jsx(BaseBox,{paddingLeft:"spacing.2",display:"flex",children:leadingDropDown}):null]}));}if(hasTrailingVisuals){return jsxs(BaseBox,Object.assign({},getVisualContainerStyles({shouldStretchTrailingBox:hasTrailingInteractionElement&&Boolean(onTrailingInteractionElementClick)}),{children:[hasTrailingInteractionElement?jsx(BaseBox,Object.assign({},getVisualContainerStyles({shouldStretchTrailingBox:hasTrailingInteractionElement&&Boolean(onTrailingInteractionElementClick)}),{children:jsx(BaseBox,Object.assign({paddingRight:getInteractionElementStyles({hasTrailingIcon:hasTrailingIcon,hasTrailingInteractionElement:hasTrailingInteractionElement,hasSuffix:hasSuffix,hasTrailingButton:hasTrailingButton,hasTrailingDropDown:hasTrailingDropDown}),display:"flex",alignItems:"stretch",alignSelf:"stretch"},!isReactNative()&&{onClick:onTrailingInteractionElementClick},{children:trailingInteractionElement}))})):null,hasSuffix?jsx(BaseBox,Object.assign({},getSuffixStyles({hasTrailingIcon:hasTrailingIcon,hasSuffix:hasSuffix,hasTrailingButton:hasTrailingButton}),{children:jsx(Text,{size:textSize[size],variant:"body",weight:"regular",color:isDisabled?'surface.text.gray.disabled':'surface.text.gray.subtle',children:suffix})})):null,TrailingIcon?jsx(BaseBox,Object.assign({display:"flex",justifyContent:"center",alignItems:"center"},getTrailingIconStyles({hasTrailingIcon:hasTrailingIcon,hasTrailingButton:hasTrailingButton}),{children:jsx(ValidationIconTooltip,{showHintsAsTooltip:showHintsAsTooltip,errorText:errorText,successText:successText,validationState:validationState,children:jsx(TrailingIcon,{size:iconSize[size],color:isDisabled?'interactive.icon.gray.disabled':trailingIconColor[validationState]})})})):null,TrailingButton?jsx(BaseBox,{paddingRight:"spacing.4",display:"flex",children:React__default.cloneElement(TrailingButton,{size:size,variant:'button',isDisabled:isDisabled})}):null,hasTrailingDropDown?jsx(BaseBox,{paddingRight:"spacing.2",display:"flex",children:trailingDropDown}):null]}));}return null;};
|
|
19
19
|
|
|
20
20
|
export { BaseInputVisuals, getInputVisualsToBeRendered };
|
|
21
21
|
//# sourceMappingURL=BaseInputVisuals.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseInputVisuals.js","sources":["../../../../../../src/components/Input/BaseInput/BaseInputVisuals.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/explicit-function-return-type */\nimport React from 'react';\nimport type { ReactElement } from 'react';\nimport type { BaseInputProps } from './BaseInput';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Text } from '~components/Typography';\nimport type { BaseBoxProps, SpacingValueType } from '~components/Box/BaseBox';\nimport type { IconColors } from '~components/Icons';\nimport { isValidAllowedChildren } from '~utils/isValidAllowedChildren';\nimport { throwBladeError } from '~utils/logger';\nimport { Tooltip } from '~components/Tooltip';\nimport { Box } from '~components/Box';\nimport { isReactNative } from '~utils';\n\ntype InputVisuals = Pick<\n BaseInputProps,\n | 'leadingIcon'\n | 'prefix'\n | 'trailingInteractionElement'\n | 'onTrailingInteractionElementClick'\n | 'leadingInteractionElement'\n | 'leadingDropDown'\n | 'trailingDropDown'\n | 'suffix'\n | 'trailingIcon'\n | 'isDisabled'\n | 'validationState'\n | 'size'\n | 'trailingButton'\n | 'showHintsAsTooltip'\n | 'errorText'\n | 'successText'\n> & {\n size: NonNullable<BaseInputProps['size']>;\n};\n\nconst getVisualContainerStyles = ({\n shouldStretchTrailingBox,\n}: {\n shouldStretchTrailingBox?: boolean;\n} = {}): Pick<BaseBoxProps, 'display' | 'flexDirection' | 'alignItems' | 'alignSelf'> => ({\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n alignSelf: shouldStretchTrailingBox ? 'stretch' : 'center',\n});\n\nconst trailingIconColor: Record<NonNullable<InputVisuals['validationState']>, IconColors> = {\n none: 'surface.icon.gray.subtle',\n error: 'feedback.icon.negative.intense',\n success: 'feedback.icon.positive.intense',\n};\n\nconst iconSize = {\n medium: 'medium',\n large: 'large',\n} as const;\n\nconst textSize = {\n medium: 'medium',\n large: 'large',\n} as const;\n\nconst getPrefixStyles = ({\n hasLeadingIcon,\n hasPrefix,\n}: {\n hasLeadingIcon: boolean;\n hasPrefix: boolean;\n}): Pick<BaseBoxProps, 'paddingLeft'> => {\n if (hasPrefix && hasLeadingIcon) {\n return {\n paddingLeft: 'spacing.3',\n };\n }\n\n if (hasPrefix && !hasLeadingIcon) {\n return {\n paddingLeft: 'spacing.4',\n };\n }\n\n return {\n paddingLeft: 'spacing.0',\n };\n};\n\nconst getInteractionElementStyles = ({\n hasTrailingIcon,\n hasLeadingInteractionElement,\n hasLeadingDropDown,\n hasTrailingInteractionElement,\n hasSuffix,\n hasTrailingButton,\n hasTrailingDropDown,\n}: {\n hasTrailingIcon: boolean;\n hasLeadingInteractionElement?: boolean;\n hasLeadingDropDown?: boolean;\n hasTrailingInteractionElement?: boolean;\n hasSuffix: boolean;\n hasTrailingButton: boolean;\n hasTrailingDropDown?: boolean;\n}): SpacingValueType => {\n if (hasTrailingInteractionElement && (hasSuffix || hasTrailingIcon || hasTrailingButton)) {\n return 'spacing.2';\n }\n\n if (hasLeadingDropDown || hasTrailingDropDown) {\n return 'spacing.2';\n }\n\n if (hasTrailingInteractionElement && !hasSuffix && !hasTrailingIcon && !hasTrailingButton) {\n return 'spacing.4';\n }\n\n if (hasLeadingInteractionElement) {\n return 'spacing.3';\n }\n\n return 'spacing.0';\n};\n\nconst getSuffixStyles = ({\n hasTrailingIcon,\n hasSuffix,\n hasTrailingButton,\n}: {\n hasTrailingIcon: boolean;\n hasSuffix: boolean;\n hasTrailingButton: boolean;\n}): Pick<BaseBoxProps, 'paddingRight'> => {\n if (hasSuffix && (hasTrailingIcon || hasTrailingButton)) {\n return {\n paddingRight: 'spacing.3',\n };\n }\n\n if (hasSuffix && !hasTrailingIcon && !hasTrailingButton) {\n return {\n paddingRight: 'spacing.4',\n };\n }\n\n return {\n paddingRight: 'spacing.0',\n };\n};\n\nconst getTrailingIconStyles = ({\n hasTrailingIcon,\n hasTrailingButton,\n}: {\n hasTrailingIcon: boolean;\n hasTrailingButton: boolean;\n}): Pick<BaseBoxProps, 'paddingRight'> => {\n if (hasTrailingIcon && hasTrailingButton) {\n return {\n paddingRight: 'spacing.3',\n };\n }\n\n if (hasTrailingIcon && !hasTrailingButton) {\n return {\n paddingRight: 'spacing.4',\n };\n }\n\n return {\n paddingRight: 'spacing.0',\n };\n};\n\nexport const getInputVisualsToBeRendered = ({\n leadingIcon,\n prefix,\n trailingInteractionElement,\n leadingInteractionElement,\n suffix,\n trailingIcon,\n trailingButton,\n leadingDropDown,\n trailingDropDown,\n}: InputVisuals) => ({\n hasLeadingIcon: Boolean(leadingIcon),\n hasPrefix: Boolean(prefix),\n hasTrailingInteractionElement: Boolean(trailingInteractionElement),\n hasLeadingInteractionElement: Boolean(leadingInteractionElement),\n hasSuffix: Boolean(suffix),\n hasTrailingIcon: Boolean(trailingIcon),\n hasTrailingButton: Boolean(trailingButton),\n hasLeadingDropDown: Boolean(leadingDropDown),\n hasTrailingDropDown: Boolean(trailingDropDown),\n});\n\nconst getTooltipContent = ({\n validationState,\n errorText,\n successText,\n}: {\n validationState: BaseInputProps['validationState'];\n errorText: BaseInputProps['errorText'];\n successText: BaseInputProps['errorText'];\n}): string => {\n if (validationState === 'error' && errorText) {\n return errorText;\n }\n\n if (validationState === 'success' && successText) {\n return successText;\n }\n\n return '';\n};\n\nconst ValidationIconTooltip = ({\n children,\n validationState,\n errorText,\n successText,\n showHintsAsTooltip,\n}: {\n children: ReactElement;\n validationState: BaseInputProps['validationState'];\n errorText: BaseInputProps['errorText'];\n successText: BaseInputProps['errorText'];\n showHintsAsTooltip: BaseInputProps['showHintsAsTooltip'];\n}) => {\n if (\n (showHintsAsTooltip && validationState === 'error' && errorText) ||\n (validationState === 'success' && successText)\n ) {\n return (\n <Tooltip content={getTooltipContent({ validationState, errorText, successText })}>\n <Box display=\"flex\" justifyContent=\"center\" alignItems=\"center\">\n {children}\n </Box>\n </Tooltip>\n );\n }\n\n return children;\n};\n\nexport const BaseInputVisuals = ({\n leadingIcon: LeadingIcon,\n prefix,\n trailingInteractionElement,\n onTrailingInteractionElementClick,\n leadingDropDown,\n trailingDropDown,\n leadingInteractionElement,\n suffix,\n trailingIcon: TrailingIcon,\n isDisabled,\n validationState = 'none',\n size,\n showHintsAsTooltip,\n errorText,\n successText,\n trailingButton: TrailingButton,\n}: InputVisuals): ReactElement | null => {\n const {\n hasLeadingIcon,\n hasPrefix,\n hasSuffix,\n hasTrailingInteractionElement,\n hasLeadingInteractionElement,\n hasTrailingIcon,\n hasTrailingButton,\n hasLeadingDropDown,\n hasTrailingDropDown,\n } = getInputVisualsToBeRendered({\n leadingIcon: LeadingIcon,\n prefix,\n leadingInteractionElement,\n trailingInteractionElement,\n suffix,\n trailingIcon: TrailingIcon,\n trailingButton: TrailingButton,\n leadingDropDown,\n trailingDropDown,\n size,\n });\n\n const hasLeadingVisuals =\n hasLeadingInteractionElement || hasLeadingIcon || hasPrefix || hasLeadingDropDown;\n const hasTrailingVisuals =\n hasTrailingInteractionElement ||\n hasSuffix ||\n hasTrailingIcon ||\n hasTrailingButton ||\n hasTrailingDropDown;\n\n if (__DEV__) {\n if (hasTrailingButton && !isValidAllowedChildren(TrailingButton, 'Link')) {\n throwBladeError({\n message: 'trailingButton must be a valid Blade Link component',\n moduleName: 'BaseInput',\n });\n }\n }\n\n if (hasLeadingVisuals) {\n return (\n <BaseBox {...getVisualContainerStyles()}>\n {hasLeadingInteractionElement ? (\n <BaseBox\n paddingLeft={getInteractionElementStyles({\n hasTrailingIcon,\n hasLeadingInteractionElement,\n hasSuffix,\n hasTrailingButton,\n })}\n display=\"flex\"\n alignItems=\"stretch\"\n alignSelf=\"stretch\"\n >\n {leadingInteractionElement}\n </BaseBox>\n ) : null}\n {LeadingIcon ? (\n <BaseBox paddingLeft=\"spacing.4\" display=\"flex\">\n <LeadingIcon\n size={iconSize[size]}\n color={isDisabled ? 'surface.icon.gray.disabled' : 'surface.icon.gray.muted'}\n />\n </BaseBox>\n ) : null}\n {hasPrefix ? (\n <BaseBox {...getPrefixStyles({ hasLeadingIcon, hasPrefix })}>\n <Text\n size={textSize[size]}\n variant=\"body\"\n weight=\"regular\"\n color={isDisabled ? 'surface.text.gray.disabled' : 'surface.text.gray.subtle'}\n >\n {prefix}\n </Text>\n </BaseBox>\n ) : null}\n {leadingDropDown ? (\n <BaseBox paddingLeft=\"spacing.2\" display=\"flex\">\n {leadingDropDown}\n </BaseBox>\n ) : null}\n </BaseBox>\n );\n }\n\n if (hasTrailingVisuals) {\n return (\n <BaseBox\n {...getVisualContainerStyles({\n shouldStretchTrailingBox:\n hasTrailingInteractionElement && Boolean(onTrailingInteractionElementClick),\n })}\n >\n {hasTrailingInteractionElement ? (\n <BaseBox\n {...getVisualContainerStyles({\n shouldStretchTrailingBox:\n hasTrailingInteractionElement && Boolean(onTrailingInteractionElementClick),\n })}\n >\n <BaseBox\n paddingRight={getInteractionElementStyles({\n hasTrailingIcon,\n hasTrailingInteractionElement,\n hasSuffix,\n hasTrailingButton,\n hasTrailingDropDown,\n })}\n display=\"flex\"\n alignItems=\"stretch\"\n alignSelf=\"stretch\"\n {...(!isReactNative() && { onClick: onTrailingInteractionElementClick })}\n >\n {trailingInteractionElement}\n </BaseBox>\n </BaseBox>\n ) : null}\n {hasSuffix ? (\n <BaseBox {...getSuffixStyles({ hasTrailingIcon, hasSuffix, hasTrailingButton })}>\n <Text\n size={textSize[size]}\n variant=\"body\"\n weight=\"regular\"\n color={isDisabled ? 'surface.text.gray.disabled' : 'surface.text.gray.subtle'}\n >\n {suffix}\n </Text>\n </BaseBox>\n ) : null}\n {TrailingIcon ? (\n <BaseBox\n display=\"flex\"\n justifyContent=\"center\"\n alignItems=\"center\"\n {...getTrailingIconStyles({ hasTrailingIcon, hasTrailingButton })}\n >\n <ValidationIconTooltip\n showHintsAsTooltip={showHintsAsTooltip}\n errorText={errorText}\n successText={successText}\n validationState={validationState}\n >\n <TrailingIcon\n size={iconSize[size]}\n color={\n isDisabled ? 'interactive.icon.gray.disabled' : trailingIconColor[validationState]\n }\n />\n </ValidationIconTooltip>\n </BaseBox>\n ) : null}\n {TrailingButton ? (\n <BaseBox paddingRight=\"spacing.4\" display=\"flex\">\n {React.cloneElement(TrailingButton, {\n size,\n variant: 'button',\n isDisabled,\n })}\n </BaseBox>\n ) : null}\n {hasTrailingDropDown ? (\n <BaseBox paddingRight=\"spacing.2\" display=\"flex\">\n {trailingDropDown}\n </BaseBox>\n ) : null}\n </BaseBox>\n );\n }\n\n return null;\n};\n"],"names":["getVisualContainerStyles","_ref","arguments","length","undefined","shouldStretchTrailingBox","display","flexDirection","alignItems","alignSelf","trailingIconColor","none","error","success","iconSize","medium","large","textSize","getPrefixStyles","_ref2","hasLeadingIcon","hasPrefix","paddingLeft","getInteractionElementStyles","_ref3","hasTrailingIcon","hasLeadingInteractionElement","hasLeadingDropDown","hasTrailingInteractionElement","hasSuffix","hasTrailingButton","hasTrailingDropDown","getSuffixStyles","_ref4","paddingRight","getTrailingIconStyles","_ref5","getInputVisualsToBeRendered","_ref6","leadingIcon","prefix","trailingInteractionElement","leadingInteractionElement","suffix","trailingIcon","trailingButton","leadingDropDown","trailingDropDown","Boolean","getTooltipContent","_ref7","validationState","errorText","successText","ValidationIconTooltip","_ref8","children","showHintsAsTooltip","_jsx","Tooltip","content","Box","justifyContent","BaseInputVisuals","_ref9","LeadingIcon","onTrailingInteractionElementClick","TrailingIcon","isDisabled","_ref9$validationState","size","TrailingButton","_getInputVisualsToBeR","hasLeadingVisuals","hasTrailingVisuals","__DEV__","isValidAllowedChildren","throwBladeError","message","moduleName","_jsxs","BaseBox","Object","assign","color","Text","variant","weight","isReactNative","onClick","React","cloneElement"],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,IAAI,CAAE,CACrBc,KAAK,CACHhB,UAAU,CAAG,gCAAgC,CAAG1D,iBAAiB,CAACyC,eAAe,CAClF,CACF,CAAC,CACmB,CAAC,CAAA,CACjB,CAAC,CACR,IAAI,CACPoB,cAAc,CACbb,GAAA,CAACuB,OAAO,EAAC/C,YAAY,CAAC,WAAW,CAAC5B,OAAO,CAAC,MAAM,CAAAkD,QAAA,CAC7CkC,cAAK,CAACC,YAAY,CAACpB,cAAc,CAAE,CAClCD,IAAI,CAAJA,IAAI,CACJgB,OAAO,CAAE,QAAQ,CACjBlB,UAAU,CAAVA,UACF,CAAC,CAAC,CACK,CAAC,CACR,IAAI,CACPrC,mBAAmB,CAClB2B,GAAA,CAACuB,OAAO,EAAC/C,YAAY,CAAC,WAAW,CAAC5B,OAAO,CAAC,MAAM,CAAAkD,QAAA,CAC7CT,gBAAgB,CACV,CAAC,CACR,IAAI,CACD,CAAA,CAAA,CAAC,CAEd,CAEA,OAAW,IAAA,CACb;;;;"}
|
|
1
|
+
{"version":3,"file":"BaseInputVisuals.js","sources":["../../../../../../src/components/Input/BaseInput/BaseInputVisuals.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/explicit-function-return-type */\nimport React from 'react';\nimport type { ReactElement } from 'react';\nimport type { BaseInputProps } from './BaseInput';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Text } from '~components/Typography';\nimport type { BaseBoxProps, SpacingValueType } from '~components/Box/BaseBox';\nimport type { IconColors } from '~components/Icons';\nimport { isValidAllowedChildren } from '~utils/isValidAllowedChildren';\nimport { throwBladeError } from '~utils/logger';\nimport { Tooltip } from '~components/Tooltip';\nimport { Box } from '~components/Box';\nimport { isReactNative } from '~utils';\n\ntype InputVisuals = Pick<\n BaseInputProps,\n | 'leadingIcon'\n | 'prefix'\n | 'trailingInteractionElement'\n | 'onTrailingInteractionElementClick'\n | 'leadingInteractionElement'\n | 'leadingDropDown'\n | 'trailingDropDown'\n | 'suffix'\n | 'trailingIcon'\n | 'isDisabled'\n | 'validationState'\n | 'size'\n | 'trailingButton'\n | 'showHintsAsTooltip'\n | 'errorText'\n | 'successText'\n> & {\n size: NonNullable<BaseInputProps['size']>;\n};\n\nconst getVisualContainerStyles = ({\n shouldStretchTrailingBox,\n}: {\n shouldStretchTrailingBox?: boolean;\n} = {}): Pick<BaseBoxProps, 'display' | 'flexDirection' | 'alignItems' | 'alignSelf'> => ({\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n alignSelf: shouldStretchTrailingBox ? 'stretch' : 'center',\n});\n\nconst trailingIconColor: Record<NonNullable<InputVisuals['validationState']>, IconColors> = {\n none: 'surface.icon.gray.subtle',\n error: 'feedback.icon.negative.intense',\n success: 'feedback.icon.positive.intense',\n};\n\nconst iconSize = {\n medium: 'medium',\n large: 'large',\n} as const;\n\nconst textSize = {\n medium: 'medium',\n large: 'large',\n} as const;\n\nconst getPrefixStyles = ({\n hasLeadingIcon,\n hasPrefix,\n}: {\n hasLeadingIcon: boolean;\n hasPrefix: boolean;\n}): Pick<BaseBoxProps, 'paddingLeft'> => {\n if (hasPrefix && hasLeadingIcon) {\n return {\n paddingLeft: 'spacing.3',\n };\n }\n\n if (hasPrefix && !hasLeadingIcon) {\n return {\n paddingLeft: 'spacing.4',\n };\n }\n\n return {\n paddingLeft: 'spacing.0',\n };\n};\n\nconst getInteractionElementStyles = ({\n hasTrailingIcon,\n hasLeadingInteractionElement,\n hasLeadingDropDown,\n hasTrailingInteractionElement,\n hasSuffix,\n hasTrailingButton,\n hasTrailingDropDown,\n}: {\n hasTrailingIcon: boolean;\n hasLeadingInteractionElement?: boolean;\n hasLeadingDropDown?: boolean;\n hasTrailingInteractionElement?: boolean;\n hasSuffix: boolean;\n hasTrailingButton: boolean;\n hasTrailingDropDown?: boolean;\n}): SpacingValueType => {\n if (hasTrailingInteractionElement && (hasSuffix || hasTrailingIcon || hasTrailingButton)) {\n return 'spacing.2';\n }\n\n if (hasLeadingDropDown || hasTrailingDropDown) {\n return 'spacing.2';\n }\n\n if (hasTrailingInteractionElement && !hasSuffix && !hasTrailingIcon && !hasTrailingButton) {\n return 'spacing.4';\n }\n\n if (hasLeadingInteractionElement) {\n return 'spacing.3';\n }\n\n return 'spacing.0';\n};\n\nconst getSuffixStyles = ({\n hasTrailingIcon,\n hasSuffix,\n hasTrailingButton,\n}: {\n hasTrailingIcon: boolean;\n hasSuffix: boolean;\n hasTrailingButton: boolean;\n}): Pick<BaseBoxProps, 'paddingRight'> => {\n if (hasSuffix && (hasTrailingIcon || hasTrailingButton)) {\n return {\n paddingRight: 'spacing.3',\n };\n }\n\n if (hasSuffix && !hasTrailingIcon && !hasTrailingButton) {\n return {\n paddingRight: 'spacing.4',\n };\n }\n\n return {\n paddingRight: 'spacing.0',\n };\n};\n\nconst getTrailingIconStyles = ({\n hasTrailingIcon,\n hasTrailingButton,\n}: {\n hasTrailingIcon: boolean;\n hasTrailingButton: boolean;\n}): Pick<BaseBoxProps, 'paddingRight'> => {\n if (hasTrailingIcon && hasTrailingButton) {\n return {\n paddingRight: 'spacing.3',\n };\n }\n\n if (hasTrailingIcon && !hasTrailingButton) {\n return {\n paddingRight: 'spacing.4',\n };\n }\n\n return {\n paddingRight: 'spacing.0',\n };\n};\n\nexport const getInputVisualsToBeRendered = ({\n leadingIcon,\n prefix,\n trailingInteractionElement,\n leadingInteractionElement,\n suffix,\n trailingIcon,\n trailingButton,\n leadingDropDown,\n trailingDropDown,\n}: InputVisuals) => ({\n hasLeadingIcon: Boolean(leadingIcon),\n hasPrefix: Boolean(prefix),\n hasTrailingInteractionElement: Boolean(trailingInteractionElement),\n hasLeadingInteractionElement: Boolean(leadingInteractionElement),\n hasSuffix: Boolean(suffix),\n hasTrailingIcon: Boolean(trailingIcon),\n hasTrailingButton: Boolean(trailingButton),\n hasLeadingDropDown: Boolean(leadingDropDown),\n hasTrailingDropDown: Boolean(trailingDropDown),\n});\n\nconst getTooltipContent = ({\n validationState,\n errorText,\n successText,\n}: {\n validationState: BaseInputProps['validationState'];\n errorText: BaseInputProps['errorText'];\n successText: BaseInputProps['errorText'];\n}): string => {\n if (validationState === 'error' && errorText) {\n return errorText;\n }\n\n if (validationState === 'success' && successText) {\n return successText;\n }\n\n return '';\n};\n\nconst ValidationIconTooltip = ({\n children,\n validationState,\n errorText,\n successText,\n showHintsAsTooltip,\n}: {\n children: ReactElement;\n validationState: BaseInputProps['validationState'];\n errorText: BaseInputProps['errorText'];\n successText: BaseInputProps['errorText'];\n showHintsAsTooltip: BaseInputProps['showHintsAsTooltip'];\n}) => {\n if (\n (showHintsAsTooltip && validationState === 'error' && errorText) ||\n (validationState === 'success' && successText)\n ) {\n return (\n <Tooltip content={getTooltipContent({ validationState, errorText, successText })}>\n <Box display=\"flex\" justifyContent=\"center\" alignItems=\"center\">\n {children}\n </Box>\n </Tooltip>\n );\n }\n\n return children;\n};\n\nexport const BaseInputVisuals = ({\n leadingIcon: LeadingIcon,\n prefix,\n trailingInteractionElement,\n onTrailingInteractionElementClick,\n leadingDropDown,\n trailingDropDown,\n leadingInteractionElement,\n suffix,\n trailingIcon: TrailingIcon,\n isDisabled,\n validationState = 'none',\n size,\n showHintsAsTooltip,\n errorText,\n successText,\n trailingButton: TrailingButton,\n}: InputVisuals): ReactElement | null => {\n const {\n hasLeadingIcon,\n hasPrefix,\n hasSuffix,\n hasTrailingInteractionElement,\n hasLeadingInteractionElement,\n hasTrailingIcon,\n hasTrailingButton,\n hasLeadingDropDown,\n hasTrailingDropDown,\n } = getInputVisualsToBeRendered({\n leadingIcon: LeadingIcon,\n prefix,\n leadingInteractionElement,\n trailingInteractionElement,\n suffix,\n trailingIcon: TrailingIcon,\n trailingButton: TrailingButton,\n leadingDropDown,\n trailingDropDown,\n size,\n });\n\n const hasLeadingVisuals =\n hasLeadingInteractionElement || hasLeadingIcon || hasPrefix || hasLeadingDropDown;\n const hasTrailingVisuals =\n hasTrailingInteractionElement ||\n hasSuffix ||\n hasTrailingIcon ||\n hasTrailingButton ||\n hasTrailingDropDown;\n\n if (__DEV__) {\n if (hasTrailingButton && !isValidAllowedChildren(TrailingButton, 'Link')) {\n throwBladeError({\n message: 'trailingButton must be a valid Blade Link component',\n moduleName: 'BaseInput',\n });\n }\n }\n\n if (hasLeadingVisuals) {\n return (\n <BaseBox {...getVisualContainerStyles()}>\n {hasLeadingInteractionElement ? (\n <BaseBox\n paddingLeft={getInteractionElementStyles({\n hasTrailingIcon,\n hasLeadingInteractionElement,\n hasSuffix,\n hasTrailingButton,\n })}\n display=\"flex\"\n alignItems=\"stretch\"\n alignSelf=\"stretch\"\n >\n {leadingInteractionElement}\n </BaseBox>\n ) : null}\n {LeadingIcon ? (\n <BaseBox paddingLeft=\"spacing.4\" display=\"flex\">\n <LeadingIcon\n size={iconSize[size]}\n color={isDisabled ? 'surface.icon.gray.disabled' : 'surface.icon.gray.muted'}\n />\n </BaseBox>\n ) : null}\n {hasPrefix ? (\n <BaseBox {...getPrefixStyles({ hasLeadingIcon, hasPrefix })}>\n <Text\n size={textSize[size]}\n variant=\"body\"\n weight=\"regular\"\n color={isDisabled ? 'surface.text.gray.disabled' : 'surface.text.gray.muted'}\n >\n {prefix}\n </Text>\n </BaseBox>\n ) : null}\n {leadingDropDown ? (\n <BaseBox paddingLeft=\"spacing.2\" display=\"flex\">\n {leadingDropDown}\n </BaseBox>\n ) : null}\n </BaseBox>\n );\n }\n\n if (hasTrailingVisuals) {\n return (\n <BaseBox\n {...getVisualContainerStyles({\n shouldStretchTrailingBox:\n hasTrailingInteractionElement && Boolean(onTrailingInteractionElementClick),\n })}\n >\n {hasTrailingInteractionElement ? (\n <BaseBox\n {...getVisualContainerStyles({\n shouldStretchTrailingBox:\n hasTrailingInteractionElement && Boolean(onTrailingInteractionElementClick),\n })}\n >\n <BaseBox\n paddingRight={getInteractionElementStyles({\n hasTrailingIcon,\n hasTrailingInteractionElement,\n hasSuffix,\n hasTrailingButton,\n hasTrailingDropDown,\n })}\n display=\"flex\"\n alignItems=\"stretch\"\n alignSelf=\"stretch\"\n {...(!isReactNative() && { onClick: onTrailingInteractionElementClick })}\n >\n {trailingInteractionElement}\n </BaseBox>\n </BaseBox>\n ) : null}\n {hasSuffix ? (\n <BaseBox {...getSuffixStyles({ hasTrailingIcon, hasSuffix, hasTrailingButton })}>\n <Text\n size={textSize[size]}\n variant=\"body\"\n weight=\"regular\"\n color={isDisabled ? 'surface.text.gray.disabled' : 'surface.text.gray.subtle'}\n >\n {suffix}\n </Text>\n </BaseBox>\n ) : null}\n {TrailingIcon ? (\n <BaseBox\n display=\"flex\"\n justifyContent=\"center\"\n alignItems=\"center\"\n {...getTrailingIconStyles({ hasTrailingIcon, hasTrailingButton })}\n >\n <ValidationIconTooltip\n showHintsAsTooltip={showHintsAsTooltip}\n errorText={errorText}\n successText={successText}\n validationState={validationState}\n >\n <TrailingIcon\n size={iconSize[size]}\n color={\n isDisabled ? 'interactive.icon.gray.disabled' : trailingIconColor[validationState]\n }\n />\n </ValidationIconTooltip>\n </BaseBox>\n ) : null}\n {TrailingButton ? (\n <BaseBox paddingRight=\"spacing.4\" display=\"flex\">\n {React.cloneElement(TrailingButton, {\n size,\n variant: 'button',\n isDisabled,\n })}\n </BaseBox>\n ) : null}\n {hasTrailingDropDown ? (\n <BaseBox paddingRight=\"spacing.2\" display=\"flex\">\n {trailingDropDown}\n </BaseBox>\n ) : null}\n </BaseBox>\n );\n }\n\n return null;\n};\n"],"names":["getVisualContainerStyles","_ref","arguments","length","undefined","shouldStretchTrailingBox","display","flexDirection","alignItems","alignSelf","trailingIconColor","none","error","success","iconSize","medium","large","textSize","getPrefixStyles","_ref2","hasLeadingIcon","hasPrefix","paddingLeft","getInteractionElementStyles","_ref3","hasTrailingIcon","hasLeadingInteractionElement","hasLeadingDropDown","hasTrailingInteractionElement","hasSuffix","hasTrailingButton","hasTrailingDropDown","getSuffixStyles","_ref4","paddingRight","getTrailingIconStyles","_ref5","getInputVisualsToBeRendered","_ref6","leadingIcon","prefix","trailingInteractionElement","leadingInteractionElement","suffix","trailingIcon","trailingButton","leadingDropDown","trailingDropDown","Boolean","getTooltipContent","_ref7","validationState","errorText","successText","ValidationIconTooltip","_ref8","children","showHintsAsTooltip","_jsx","Tooltip","content","Box","justifyContent","BaseInputVisuals","_ref9","LeadingIcon","onTrailingInteractionElementClick","TrailingIcon","isDisabled","_ref9$validationState","size","TrailingButton","_getInputVisualsToBeR","hasLeadingVisuals","hasTrailingVisuals","__DEV__","isValidAllowedChildren","throwBladeError","message","moduleName","_jsxs","BaseBox","Object","assign","color","Text","variant","weight","isReactNative","onClick","React","cloneElement"],"mappings":";;;;;;;;;;;;;;;;;AAoCA,IAAMA,wBAAwB,CAAG,SAA3BA,wBAAwBA,EAAA,CAAA,IAAAC,IAAA,CAAAC,SAAA,CAAAC,MAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,GAAAE,SAAA,CAAAF,SAAA,IAI1B,EAAE,CAHJG,wBAAwB,CAAAJ,IAAA,CAAxBI,wBAAwB,QAGgE,CACxFC,OAAO,CAAE,MAAM,CACfC,aAAa,CAAE,KAAK,CACpBC,UAAU,CAAE,QAAQ,CACpBC,SAAS,CAAEJ,wBAAwB,CAAG,SAAS,CAAG,QACpD,CAAC,CAAC,CAAA,CAEF,IAAMK,iBAAmF,CAAG,CAC1FC,IAAI,CAAE,0BAA0B,CAChCC,KAAK,CAAE,gCAAgC,CACvCC,OAAO,CAAE,gCACX,CAAC,CAED,IAAMC,QAAQ,CAAG,CACfC,MAAM,CAAE,QAAQ,CAChBC,KAAK,CAAE,OACT,CAAU,CAEV,IAAMC,QAAQ,CAAG,CACfF,MAAM,CAAE,QAAQ,CAChBC,KAAK,CAAE,OACT,CAAU,CAEV,IAAME,eAAe,CAAG,SAAlBA,eAAeA,CAAAC,KAAA,CAMoB,KALvCC,cAAc,CAAAD,KAAA,CAAdC,cAAc,CACdC,SAAS,CAAAF,KAAA,CAATE,SAAS,CAKT,GAAIA,SAAS,EAAID,cAAc,CAAE,CAC/B,OAAO,CACLE,WAAW,CAAE,WACf,CAAC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f2B,qBAAqB,CAAC,CAAEV,eAAe,CAAfA,eAAe,CAAEK,iBAAiB,CAAjBA,iBAAkB,CAAC,CAAC,CAAA0B,CAAAA,QAAA,CAEjEE,GAAA,CAACJ,qBAAqB,CACpBG,CAAAA,kBAAkB,CAAEA,kBAAmB,CACvCL,SAAS,CAAEA,SAAU,CACrBC,WAAW,CAAEA,WAAY,CACzBF,eAAe,CAAEA,eAAgB,CAAAK,QAAA,CAEjCE,GAAA,CAACS,YAAY,CACXG,CAAAA,IAAI,CAAExD,QAAQ,CAACwD,IAAI,CAAE,CACrBc,KAAK,CACHhB,UAAU,CAAG,gCAAgC,CAAG1D,iBAAiB,CAACyC,eAAe,CAClF,CACF,CAAC,CACmB,CAAC,CAAA,CACjB,CAAC,CACR,IAAI,CACPoB,cAAc,CACbb,GAAA,CAACuB,OAAO,EAAC/C,YAAY,CAAC,WAAW,CAAC5B,OAAO,CAAC,MAAM,CAAAkD,QAAA,CAC7CkC,cAAK,CAACC,YAAY,CAACpB,cAAc,CAAE,CAClCD,IAAI,CAAJA,IAAI,CACJgB,OAAO,CAAE,QAAQ,CACjBlB,UAAU,CAAVA,UACF,CAAC,CAAC,CACK,CAAC,CACR,IAAI,CACPrC,mBAAmB,CAClB2B,GAAA,CAACuB,OAAO,EAAC/C,YAAY,CAAC,WAAW,CAAC5B,OAAO,CAAC,MAAM,CAAAkD,QAAA,CAC7CT,gBAAgB,CACV,CAAC,CACR,IAAI,CACD,CAAA,CAAA,CAAC,CAEd,CAEA,OAAW,IAAA,CACb;;;;"}
|
|
@@ -25,7 +25,7 @@ import { MetaConstants } from '../../utils/metaAttribute/metaConstants.js';
|
|
|
25
25
|
import { assignWithoutSideEffects } from '../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
|
|
26
26
|
import { getComponentId, isValidAllowedChildren } from '../../utils/isValidAllowedChildren/isValidAllowedChildren.js';
|
|
27
27
|
|
|
28
|
-
var StyledListItem=styled(ListItemElement)(function(_ref){var level=_ref.level,theme=_ref.theme,variant=_ref.variant,hasIcon=_ref.hasIcon;return {marginLeft:level?getIn(theme,listItemMarginLeft[`${variant}${variant==='unordered'&&hasIcon?'WithIcon':''}`][level]):0};});var ListItemContentChildren=function ListItemContentChildren(_ref2){var children=_ref2.children,size=_ref2.size;return getPlatformType()==='react-native'?jsx(BaseBox,{display:"flex",flexDirection:"row",flexWrap:"wrap",children:children.map(function(child,index){if(typeof child==='string'){return jsx(Text,{variant:"body",size:size,children:child},index);}return child;})}):jsx(Text,{variant:"body",size:size,children:children});};var _ListItem=function _ListItem(_ref3){var _ref4;var children=_ref3.children,Icon=_ref3.icon,listItemIconColor=_ref3.iconColor,_itemNumber=_ref3._itemNumber,testID=_ref3.testID;var _useListContext=useListContext(),level=_useListContext.level,size=_useListContext.size,ListContextIcon=_useListContext.icon,variant=_useListContext.variant,iconColor=_useListContext.iconColor;var _useTheme=useTheme(),theme=_useTheme.theme,platform=_useTheme.platform;var ItemIcon=Icon!=null?Icon:ListContextIcon;var iconColorToken=(_ref4=listItemIconColor!=null?listItemIconColor:iconColor)!=null?_ref4:'surface.icon.gray.muted';if(__DEV__){if(level&&level>3){throwBladeError({message:'List Nesting is allowed only upto 3 levels.',moduleName:'List'});}}var childrenArray=React__default.Children.toArray(children);var validChildItem=childrenArray.filter(function(child){if(getComponentId(child)===MetaConstants.List)return null;if(typeof child==='string'||isValidAllowedChildren(child,MetaConstants.ListItemLink)||isValidAllowedChildren(child,MetaConstants.ListItemText)||isValidAllowedChildren(child,MetaConstants.ListItemCode)){return child;}else if(__DEV__){throwBladeError({message:`You can only pass a List, ListItemLink, ListItemCode, ListItemText or a string as a child to ListItem.`,moduleName:'ListItem'});}return null;});var childList=childrenArray.filter(function(child){return getComponentId(child)===MetaConstants.List?child:null;});var hasIcon=Boolean(ItemIcon);return jsxs(StyledListItem,Object.assign({level:level,variant:variant,hasIcon:hasIcon},metaAttribute({name:MetaConstants.ListItem,testID:testID}),{children:[jsxs(BaseBox,{display:"flex",flexDirection:"row",alignItems:"center",marginBottom:listItemMarginBottom,children:[variant==='unordered'?jsx(BaseBox,{marginRight:listItemBulletMarginRight[variant],marginTop:listItemBulletMarginTop[`${variant}${hasIcon?'WithIcon':''}`][platform][size],display:"flex",alignSelf:"flex-start",children:ItemIcon?jsx(ItemIcon,{size:size,color:iconColorToken}):jsx(UnorderedItemIcon,{level:level})}):jsx(BaseBox,{width:listItemOrderedBulletBoxSize[variant][platform][size],height:listItemOrderedBulletBoxSize[variant][platform][size],marginRight:listItemBulletMarginRight[variant],marginTop:listItemBulletMarginTop[variant][platform][size],display:"flex",flexShrink:0,justifyContent:"center",alignSelf:"flex-start",alignItems:"center",borderRadius:variant==='ordered-filled'?'max':undefined,backgroundColor:variant==='ordered-filled'?getIn(theme.colors,'feedback.background.neutral.subtle'):undefined,children:jsx(Text,{variant:"body",color:"surface.text.gray.muted",size:variant==='ordered'?size:'xsmall',children:`${getOrderedListItemBullet({itemNumber:_itemNumber!=null?_itemNumber:1,level:level!=null?level:1})}${variant==='ordered'?'.':''}`})}),jsx(ListItemContentChildren,{size:size,children:validChildItem})]}),childList]}));};var ListItem=assignWithoutSideEffects(_ListItem,{componentId:MetaConstants.ListItem});
|
|
28
|
+
var StyledListItem=styled(ListItemElement)(function(_ref){var level=_ref.level,theme=_ref.theme,variant=_ref.variant,hasIcon=_ref.hasIcon;return {marginLeft:level?getIn(theme,listItemMarginLeft[`${variant}${variant==='unordered'&&hasIcon?'WithIcon':''}`][level]):0};});var ListItemContentChildren=function ListItemContentChildren(_ref2){var children=_ref2.children,size=_ref2.size;return getPlatformType()==='react-native'?jsx(BaseBox,{display:"flex",flexDirection:"row",flexWrap:"wrap",children:children.map(function(child,index){if(typeof child==='string'){return jsx(Text,{variant:"body",size:size,children:child},index);}return child;})}):jsx(Text,{variant:"body",size:size,children:children});};var _ListItem=function _ListItem(_ref3){var _ref4;var children=_ref3.children,Icon=_ref3.icon,listItemIconColor=_ref3.iconColor,_itemNumber=_ref3._itemNumber,testID=_ref3.testID;var _useListContext=useListContext(),level=_useListContext.level,size=_useListContext.size,ListContextIcon=_useListContext.icon,variant=_useListContext.variant,iconColor=_useListContext.iconColor;var _useTheme=useTheme(),theme=_useTheme.theme,platform=_useTheme.platform;var ItemIcon=Icon!=null?Icon:ListContextIcon;var iconColorToken=(_ref4=listItemIconColor!=null?listItemIconColor:iconColor)!=null?_ref4:'surface.icon.gray.muted';if(__DEV__){if(level&&level>3){throwBladeError({message:'List Nesting is allowed only upto 3 levels.',moduleName:'List'});}}var childrenArray=React__default.Children.toArray(children);var validChildItem=childrenArray.filter(function(child){if(getComponentId(child)===MetaConstants.List)return null;if(typeof child==='string'||typeof child==='number'||isValidAllowedChildren(child,MetaConstants.ListItemLink)||isValidAllowedChildren(child,MetaConstants.ListItemText)||isValidAllowedChildren(child,MetaConstants.ListItemCode)){return child;}else if(__DEV__){throwBladeError({message:`You can only pass a List, ListItemLink, ListItemCode, ListItemText or a string as a child to ListItem.`,moduleName:'ListItem'});}return null;});var childList=childrenArray.filter(function(child){return getComponentId(child)===MetaConstants.List?child:null;});var hasIcon=Boolean(ItemIcon);return jsxs(StyledListItem,Object.assign({level:level,variant:variant,hasIcon:hasIcon},metaAttribute({name:MetaConstants.ListItem,testID:testID}),{children:[jsxs(BaseBox,{display:"flex",flexDirection:"row",alignItems:"center",marginBottom:listItemMarginBottom,children:[variant==='unordered'?jsx(BaseBox,{marginRight:listItemBulletMarginRight[variant],marginTop:listItemBulletMarginTop[`${variant}${hasIcon?'WithIcon':''}`][platform][size],display:"flex",alignSelf:"flex-start",children:ItemIcon?jsx(ItemIcon,{size:size,color:iconColorToken}):jsx(UnorderedItemIcon,{level:level})}):jsx(BaseBox,{width:listItemOrderedBulletBoxSize[variant][platform][size],height:listItemOrderedBulletBoxSize[variant][platform][size],marginRight:listItemBulletMarginRight[variant],marginTop:listItemBulletMarginTop[variant][platform][size],display:"flex",flexShrink:0,justifyContent:"center",alignSelf:"flex-start",alignItems:"center",borderRadius:variant==='ordered-filled'?'max':undefined,backgroundColor:variant==='ordered-filled'?getIn(theme.colors,'feedback.background.neutral.subtle'):undefined,children:jsx(Text,{variant:"body",color:"surface.text.gray.muted",size:variant==='ordered'?size:'xsmall',children:`${getOrderedListItemBullet({itemNumber:_itemNumber!=null?_itemNumber:1,level:level!=null?level:1})}${variant==='ordered'?'.':''}`})}),jsx(ListItemContentChildren,{size:size,children:validChildItem})]}),childList]}));};var ListItem=assignWithoutSideEffects(_ListItem,{componentId:MetaConstants.ListItem});
|
|
29
29
|
|
|
30
30
|
export { ListItem };
|
|
31
31
|
//# sourceMappingURL=ListItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItem.js","sources":["../../../../../src/components/List/ListItem.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport React from 'react';\nimport { useListContext } from './ListContext';\nimport { UnorderedItemIcon } from './ListItemIcons';\nimport { ListItemElement } from './ListItemElement';\nimport {\n listItemBulletMarginRight,\n listItemBulletMarginTop,\n listItemOrderedBulletBoxSize,\n listItemMarginBottom,\n listItemMarginLeft,\n} from './listTokens';\nimport type { ListProps } from './List';\nimport { getOrderedListItemBullet } from './getOrderedListItemBullet';\nimport getIn from '~utils/lodashButBetter/get';\nimport { Text } from '~components/Typography';\nimport type { IconComponent } from '~components/Icons';\nimport { useTheme } from '~components/BladeProvider';\nimport BaseBox from '~components/Box/BaseBox';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { TestID } from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getComponentId, isValidAllowedChildren } from '~utils/isValidAllowedChildren';\nimport { getPlatformType } from '~utils/getPlatformType';\nimport { throwBladeError } from '~utils/logger';\n\ntype ListItemProps = {\n /**\n * Children to be rendered for ListItem. This can be a text, ListItemLink or another List.\n *\n */\n children: React.ReactNode;\n /**\n * Icon to be rendered for a ListItem's bullet.\n *\n */\n icon?: IconComponent;\n /**\n * Icon color of the ListItem's bullet.\n *\n */\n iconColor?: ListProps['iconColor'];\n /**\n * This is a private prop to be used only for internal logic purposes.\n *\n */\n _itemNumber?: undefined;\n} & TestID;\n\nconst StyledListItem = styled(ListItemElement)<{\n level?: number;\n variant: NonNullable<ListProps['variant']>;\n hasIcon: boolean;\n}>(({ level, theme, variant, hasIcon }) => ({\n marginLeft: level\n ? getIn(\n theme,\n listItemMarginLeft[\n `${variant}${variant === 'unordered' && hasIcon ? 'WithIcon' : ''}` as NonNullable<\n ListProps['variant'] | 'unorderedWithIcon'\n >\n ][level],\n )\n : 0,\n}));\n\nconst ListItemContentChildren = ({\n children,\n size,\n}: {\n children: React.ReactNode[];\n size: NonNullable<ListProps['size']>;\n}): React.ReactElement => {\n /* Having a <View><Text>...</Text><View/> inside <Text /> breaks vertical alignment. Issue: https://github.com/facebook/react-native/issues/31955\n As a workaround, we wrap individual strings in their own <Text /> and handle alignment with a parent <View> (BaseBox).\n */\n return getPlatformType() === 'react-native' ? (\n <BaseBox display=\"flex\" flexDirection=\"row\" flexWrap=\"wrap\">\n {children.map((child, index) => {\n if (typeof child === 'string') {\n return (\n <Text key={index} variant=\"body\" size={size}>\n {child}\n </Text>\n );\n }\n return child;\n })}\n </BaseBox>\n ) : (\n <Text variant=\"body\" size={size}>\n {children}\n </Text>\n );\n};\n\nconst _ListItem = ({\n children,\n icon: Icon,\n iconColor: listItemIconColor,\n _itemNumber,\n testID,\n}: ListItemProps): React.ReactElement => {\n const { level, size, icon: ListContextIcon, variant, iconColor } = useListContext();\n const { theme, platform } = useTheme();\n const ItemIcon = Icon ?? ListContextIcon;\n const iconColorToken = listItemIconColor ?? iconColor ?? 'surface.icon.gray.muted';\n\n if (__DEV__) {\n if (level && level > 3) {\n throwBladeError({\n message: 'List Nesting is allowed only upto 3 levels.',\n moduleName: 'List',\n });\n }\n }\n\n const childrenArray = React.Children.toArray(children);\n\n // Get children that are not a List component and are valid allowed children\n const validChildItem = childrenArray.filter((child) => {\n if (getComponentId(child) === MetaConstants.List) return null;\n\n if (\n typeof child === 'string' ||\n isValidAllowedChildren(child, MetaConstants.ListItemLink) ||\n isValidAllowedChildren(child, MetaConstants.ListItemText) ||\n isValidAllowedChildren(child, MetaConstants.ListItemCode)\n ) {\n return child;\n } else if (__DEV__) {\n throwBladeError({\n message: `You can only pass a List, ListItemLink, ListItemCode, ListItemText or a string as a child to ListItem.`,\n moduleName: 'ListItem',\n });\n }\n return null;\n });\n // Get child that is a List component\n const childList = childrenArray.filter((child) =>\n getComponentId(child) === MetaConstants.List ? child : null,\n );\n const hasIcon = Boolean(ItemIcon);\n\n return (\n <StyledListItem\n level={level}\n variant={variant}\n hasIcon={hasIcon}\n {...metaAttribute({ name: MetaConstants.ListItem, testID })}\n >\n <BaseBox\n display=\"flex\"\n flexDirection=\"row\"\n alignItems=\"center\"\n marginBottom={listItemMarginBottom}\n >\n {variant === 'unordered' ? (\n <BaseBox\n marginRight={listItemBulletMarginRight[variant]}\n marginTop={\n listItemBulletMarginTop[`${variant}${hasIcon ? 'WithIcon' : ''}`][platform][size]\n }\n display=\"flex\"\n alignSelf=\"flex-start\"\n >\n {ItemIcon ? (\n <ItemIcon size={size} color={iconColorToken} />\n ) : (\n <UnorderedItemIcon level={level} />\n )}\n </BaseBox>\n ) : (\n <BaseBox\n width={listItemOrderedBulletBoxSize[variant][platform][size]}\n height={listItemOrderedBulletBoxSize[variant][platform][size]}\n marginRight={listItemBulletMarginRight[variant]}\n marginTop={listItemBulletMarginTop[variant][platform][size]}\n display=\"flex\"\n flexShrink={0}\n justifyContent=\"center\"\n alignSelf=\"flex-start\"\n alignItems=\"center\"\n borderRadius={variant === 'ordered-filled' ? 'max' : undefined}\n backgroundColor={\n variant === 'ordered-filled'\n ? getIn(theme.colors, 'feedback.background.neutral.subtle')\n : undefined\n }\n >\n <Text\n variant=\"body\"\n color=\"surface.text.gray.muted\"\n size={variant === 'ordered' ? size : 'xsmall'}\n >\n {`${getOrderedListItemBullet({\n itemNumber: _itemNumber ?? 1,\n level: level ?? 1,\n })}${variant === 'ordered' ? '.' : ''}`}\n </Text>\n </BaseBox>\n )}\n <ListItemContentChildren size={size}>{validChildItem}</ListItemContentChildren>\n </BaseBox>\n {childList}\n </StyledListItem>\n );\n};\n\nconst ListItem = assignWithoutSideEffects(_ListItem, { componentId: MetaConstants.ListItem });\n\nexport { ListItem };\nexport type { ListItemProps };\n"],"names":["StyledListItem","styled","ListItemElement","_ref","level","theme","variant","hasIcon","marginLeft","getIn","listItemMarginLeft","ListItemContentChildren","_ref2","children","size","getPlatformType","_jsx","BaseBox","display","flexDirection","flexWrap","map","child","index","Text","_ListItem","_ref3","_ref4","Icon","icon","listItemIconColor","iconColor","_itemNumber","testID","_useListContext","useListContext","ListContextIcon","_useTheme","useTheme","platform","ItemIcon","iconColorToken","__DEV__","throwBladeError","message","moduleName","childrenArray","React","Children","toArray","validChildItem","filter","getComponentId","MetaConstants","List","isValidAllowedChildren","ListItemLink","ListItemText","ListItemCode","childList","Boolean","_jsxs","Object","assign","metaAttribute","name","ListItem","alignItems","marginBottom","listItemMarginBottom","marginRight","listItemBulletMarginRight","marginTop","listItemBulletMarginTop","alignSelf","color","UnorderedItemIcon","width","listItemOrderedBulletBoxSize","height","flexShrink","justifyContent","borderRadius","undefined","backgroundColor","colors","getOrderedListItemBullet","itemNumber","assignWithoutSideEffects","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDA,IAAMA,cAAc,CAAGC,MAAM,CAACC,eAAe,CAAC,CAI3C,SAAAC,IAAA,CAAA,CAAA,IAAGC,KAAK,CAAAD,IAAA,CAALC,KAAK,CAAEC,KAAK,CAAAF,IAAA,CAALE,KAAK,CAAEC,OAAO,CAAAH,IAAA,CAAPG,OAAO,CAAEC,OAAO,CAAAJ,IAAA,CAAPI,OAAO,CAAQ,OAAA,CAC1CC,UAAU,CAAEJ,KAAK,CACbK,KAAK,CACHJ,KAAK,CACLK,kBAAkB,CACf,CAAA,EAAEJ,OAAQ,CAAEA,EAAAA,OAAO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EqC,cAAc,CAA0B,CAAC,CAAA,CACxE,CAAC,CACTS,SAAS,CACI,CAAA,CAAA,CAAC,CAErB,CAAC,CAEK,IAAAO,QAAQ,CAAGsB,wBAAwB,CAAC/D,SAAS,CAAE,CAAEgE,WAAW,CAAEpC,aAAa,CAACa,QAAS,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"ListItem.js","sources":["../../../../../src/components/List/ListItem.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport React from 'react';\nimport { useListContext } from './ListContext';\nimport { UnorderedItemIcon } from './ListItemIcons';\nimport { ListItemElement } from './ListItemElement';\nimport {\n listItemBulletMarginRight,\n listItemBulletMarginTop,\n listItemOrderedBulletBoxSize,\n listItemMarginBottom,\n listItemMarginLeft,\n} from './listTokens';\nimport type { ListProps } from './List';\nimport { getOrderedListItemBullet } from './getOrderedListItemBullet';\nimport getIn from '~utils/lodashButBetter/get';\nimport { Text } from '~components/Typography';\nimport type { IconComponent } from '~components/Icons';\nimport { useTheme } from '~components/BladeProvider';\nimport BaseBox from '~components/Box/BaseBox';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { TestID } from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getComponentId, isValidAllowedChildren } from '~utils/isValidAllowedChildren';\nimport { getPlatformType } from '~utils/getPlatformType';\nimport { throwBladeError } from '~utils/logger';\n\ntype ListItemProps = {\n /**\n * Children to be rendered for ListItem. This can be a text, ListItemLink or another List.\n *\n */\n children: React.ReactNode;\n /**\n * Icon to be rendered for a ListItem's bullet.\n *\n */\n icon?: IconComponent;\n /**\n * Icon color of the ListItem's bullet.\n *\n */\n iconColor?: ListProps['iconColor'];\n /**\n * This is a private prop to be used only for internal logic purposes.\n *\n */\n _itemNumber?: undefined;\n} & TestID;\n\nconst StyledListItem = styled(ListItemElement)<{\n level?: number;\n variant: NonNullable<ListProps['variant']>;\n hasIcon: boolean;\n}>(({ level, theme, variant, hasIcon }) => ({\n marginLeft: level\n ? getIn(\n theme,\n listItemMarginLeft[\n `${variant}${variant === 'unordered' && hasIcon ? 'WithIcon' : ''}` as NonNullable<\n ListProps['variant'] | 'unorderedWithIcon'\n >\n ][level],\n )\n : 0,\n}));\n\nconst ListItemContentChildren = ({\n children,\n size,\n}: {\n children: React.ReactNode[];\n size: NonNullable<ListProps['size']>;\n}): React.ReactElement => {\n /* Having a <View><Text>...</Text><View/> inside <Text /> breaks vertical alignment. Issue: https://github.com/facebook/react-native/issues/31955\n As a workaround, we wrap individual strings in their own <Text /> and handle alignment with a parent <View> (BaseBox).\n */\n return getPlatformType() === 'react-native' ? (\n <BaseBox display=\"flex\" flexDirection=\"row\" flexWrap=\"wrap\">\n {children.map((child, index) => {\n if (typeof child === 'string') {\n return (\n <Text key={index} variant=\"body\" size={size}>\n {child}\n </Text>\n );\n }\n return child;\n })}\n </BaseBox>\n ) : (\n <Text variant=\"body\" size={size}>\n {children}\n </Text>\n );\n};\n\nconst _ListItem = ({\n children,\n icon: Icon,\n iconColor: listItemIconColor,\n _itemNumber,\n testID,\n}: ListItemProps): React.ReactElement => {\n const { level, size, icon: ListContextIcon, variant, iconColor } = useListContext();\n const { theme, platform } = useTheme();\n const ItemIcon = Icon ?? ListContextIcon;\n const iconColorToken = listItemIconColor ?? iconColor ?? 'surface.icon.gray.muted';\n\n if (__DEV__) {\n if (level && level > 3) {\n throwBladeError({\n message: 'List Nesting is allowed only upto 3 levels.',\n moduleName: 'List',\n });\n }\n }\n\n const childrenArray = React.Children.toArray(children);\n\n // Get children that are not a List component and are valid allowed children\n const validChildItem = childrenArray.filter((child) => {\n if (getComponentId(child) === MetaConstants.List) return null;\n\n if (\n typeof child === 'string' ||\n typeof child === 'number' ||\n isValidAllowedChildren(child, MetaConstants.ListItemLink) ||\n isValidAllowedChildren(child, MetaConstants.ListItemText) ||\n isValidAllowedChildren(child, MetaConstants.ListItemCode)\n ) {\n return child;\n } else if (__DEV__) {\n throwBladeError({\n message: `You can only pass a List, ListItemLink, ListItemCode, ListItemText or a string as a child to ListItem.`,\n moduleName: 'ListItem',\n });\n }\n return null;\n });\n // Get child that is a List component\n const childList = childrenArray.filter((child) =>\n getComponentId(child) === MetaConstants.List ? child : null,\n );\n const hasIcon = Boolean(ItemIcon);\n\n return (\n <StyledListItem\n level={level}\n variant={variant}\n hasIcon={hasIcon}\n {...metaAttribute({ name: MetaConstants.ListItem, testID })}\n >\n <BaseBox\n display=\"flex\"\n flexDirection=\"row\"\n alignItems=\"center\"\n marginBottom={listItemMarginBottom}\n >\n {variant === 'unordered' ? (\n <BaseBox\n marginRight={listItemBulletMarginRight[variant]}\n marginTop={\n listItemBulletMarginTop[`${variant}${hasIcon ? 'WithIcon' : ''}`][platform][size]\n }\n display=\"flex\"\n alignSelf=\"flex-start\"\n >\n {ItemIcon ? (\n <ItemIcon size={size} color={iconColorToken} />\n ) : (\n <UnorderedItemIcon level={level} />\n )}\n </BaseBox>\n ) : (\n <BaseBox\n width={listItemOrderedBulletBoxSize[variant][platform][size]}\n height={listItemOrderedBulletBoxSize[variant][platform][size]}\n marginRight={listItemBulletMarginRight[variant]}\n marginTop={listItemBulletMarginTop[variant][platform][size]}\n display=\"flex\"\n flexShrink={0}\n justifyContent=\"center\"\n alignSelf=\"flex-start\"\n alignItems=\"center\"\n borderRadius={variant === 'ordered-filled' ? 'max' : undefined}\n backgroundColor={\n variant === 'ordered-filled'\n ? getIn(theme.colors, 'feedback.background.neutral.subtle')\n : undefined\n }\n >\n <Text\n variant=\"body\"\n color=\"surface.text.gray.muted\"\n size={variant === 'ordered' ? size : 'xsmall'}\n >\n {`${getOrderedListItemBullet({\n itemNumber: _itemNumber ?? 1,\n level: level ?? 1,\n })}${variant === 'ordered' ? '.' : ''}`}\n </Text>\n </BaseBox>\n )}\n <ListItemContentChildren size={size}>{validChildItem}</ListItemContentChildren>\n </BaseBox>\n {childList}\n </StyledListItem>\n );\n};\n\nconst ListItem = assignWithoutSideEffects(_ListItem, { componentId: MetaConstants.ListItem });\n\nexport { ListItem };\nexport type { ListItemProps };\n"],"names":["StyledListItem","styled","ListItemElement","_ref","level","theme","variant","hasIcon","marginLeft","getIn","listItemMarginLeft","ListItemContentChildren","_ref2","children","size","getPlatformType","_jsx","BaseBox","display","flexDirection","flexWrap","map","child","index","Text","_ListItem","_ref3","_ref4","Icon","icon","listItemIconColor","iconColor","_itemNumber","testID","_useListContext","useListContext","ListContextIcon","_useTheme","useTheme","platform","ItemIcon","iconColorToken","__DEV__","throwBladeError","message","moduleName","childrenArray","React","Children","toArray","validChildItem","filter","getComponentId","MetaConstants","List","isValidAllowedChildren","ListItemLink","ListItemText","ListItemCode","childList","Boolean","_jsxs","Object","assign","metaAttribute","name","ListItem","alignItems","marginBottom","listItemMarginBottom","marginRight","listItemBulletMarginRight","marginTop","listItemBulletMarginTop","alignSelf","color","UnorderedItemIcon","width","listItemOrderedBulletBoxSize","height","flexShrink","justifyContent","borderRadius","undefined","backgroundColor","colors","getOrderedListItemBullet","itemNumber","assignWithoutSideEffects","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDA,IAAMA,cAAc,CAAGC,MAAM,CAACC,eAAe,CAAC,CAI3C,SAAAC,IAAA,CAAG,CAAA,IAAAC,KAAK,CAAAD,IAAA,CAALC,KAAK,CAAEC,KAAK,CAAAF,IAAA,CAALE,KAAK,CAAEC,OAAO,CAAAH,IAAA,CAAPG,OAAO,CAAEC,OAAO,CAAAJ,IAAA,CAAPI,OAAO,QAAQ,CAC1CC,UAAU,CAAEJ,KAAK,CACbK,KAAK,CACHJ,KAAK,CACLK,kBAAkB,CACf,CAAEJ,EAAAA,OAAQ,GAAEA,OAAO,GAAK,WAAW,EAAIC,OAAO,CAAG,UAAU,CAAG,EAAG,CAAC,CAAA,CAGpE,CAACH,KAAK,CACT,CAAC,CACD,CACN,CAAC,CAAC,CAAA,CAAC,CAEH,IAAMO,uBAAuB,CAAG,SAA1BA,uBAAuBA,CAAAC,KAAA,CAMH,CAAA,I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AEgE,WAAW,CAAEpC,aAAa,CAACa,QAAS,CAAC;;;;"}
|
|
@@ -9,7 +9,7 @@ import { useStyledProps } from '../../Box/styledProps/useStyledProps.js';
|
|
|
9
9
|
import { makeAccessible } from '../../../utils/makeAccessible/makeAccessible.native.js';
|
|
10
10
|
import { jsx } from 'react/jsx-runtime';
|
|
11
11
|
|
|
12
|
-
var _excluded=["color","fontFamily","fontSize","fontWeight","fontStyle","textDecorationLine","numberOfLines","lineHeight","letterSpacing","textAlign","as","opacity"],_excluded2=["id","color","fontFamily","fontSize","fontWeight","fontStyle","textDecorationLine","lineHeight","textAlign","children","truncateAfterLines","opacity","className","style","accessibilityProps","componentName","testID"];var StyledBaseText=styled.Text(function(_ref){var color=_ref.color,fontFamily=_ref.fontFamily,fontSize=_ref.fontSize,fontWeight=_ref.fontWeight,fontStyle=_ref.fontStyle,textDecorationLine=_ref.textDecorationLine,numberOfLines=_ref.numberOfLines,lineHeight=_ref.lineHeight,letterSpacing=_ref.letterSpacing,textAlign=_ref.textAlign;_ref.as;var opacity=_ref.opacity,props=_objectWithoutProperties(_ref,_excluded);var styledPropsCSSObject=useStyledProps(props);return Object.assign({},getBaseTextStyles({color:color,fontFamily:fontFamily,fontSize:fontSize,fontWeight:fontWeight,fontStyle:fontStyle,textDecorationLine:textDecorationLine,numberOfLines:numberOfLines,lineHeight:lineHeight,letterSpacing:letterSpacing,textAlign:textAlign,opacity:opacity,theme:props.theme}),styledPropsCSSObject);});var _BaseText=function _BaseText(_ref2,ref){var id=_ref2.id,color=_ref2.color,fontFamily=_ref2.fontFamily,fontSize=_ref2.fontSize,fontWeight=_ref2.fontWeight,fontStyle=_ref2.fontStyle,textDecorationLine=_ref2.textDecorationLine,lineHeight=_ref2.lineHeight,textAlign=_ref2.textAlign,children=_ref2.children,truncateAfterLines=_ref2.truncateAfterLines,opacity=_ref2.opacity,className=_ref2.className,style=_ref2.style,_ref2$accessibilityPr=_ref2.accessibilityProps,accessibilityProps=_ref2$accessibilityPr===void 0?{}:_ref2$accessibilityPr,_ref2$componentName=_ref2.componentName,componentName=_ref2$componentName===void 0?MetaConstants.BaseText:_ref2$componentName,testID=_ref2.testID,styledProps=_objectWithoutProperties(_ref2,_excluded2);return jsx(StyledBaseText,Object.assign({ref:ref},getStyledProps(styledProps),{color:color,fontFamily:fontFamily,fontSize:fontSize,fontWeight:fontWeight,fontStyle:fontStyle,textDecorationLine:textDecorationLine,lineHeight:lineHeight,as:undefined,textAlign:textAlign,numberOfLines:truncateAfterLines,opacity:opacity,className:className,style:style,id:id},makeAccessible(accessibilityProps),metaAttribute({name:componentName,testID:testID}),{children:children}));};var BaseText=React__default.forwardRef(_BaseText);
|
|
12
|
+
var _excluded=["color","fontFamily","fontSize","fontWeight","fontStyle","textDecorationLine","numberOfLines","lineHeight","letterSpacing","textAlign","textTransform","as","opacity"],_excluded2=["id","color","fontFamily","fontSize","fontWeight","fontStyle","textDecorationLine","lineHeight","textAlign","children","truncateAfterLines","textTransform","opacity","className","style","accessibilityProps","componentName","testID"];var StyledBaseText=styled.Text(function(_ref){var color=_ref.color,fontFamily=_ref.fontFamily,fontSize=_ref.fontSize,fontWeight=_ref.fontWeight,fontStyle=_ref.fontStyle,textDecorationLine=_ref.textDecorationLine,numberOfLines=_ref.numberOfLines,lineHeight=_ref.lineHeight,letterSpacing=_ref.letterSpacing,textAlign=_ref.textAlign,textTransform=_ref.textTransform;_ref.as;var opacity=_ref.opacity,props=_objectWithoutProperties(_ref,_excluded);var styledPropsCSSObject=useStyledProps(props);return Object.assign({},getBaseTextStyles({color:color,fontFamily:fontFamily,fontSize:fontSize,fontWeight:fontWeight,fontStyle:fontStyle,textDecorationLine:textDecorationLine,numberOfLines:numberOfLines,lineHeight:lineHeight,letterSpacing:letterSpacing,textAlign:textAlign,opacity:opacity,textTransform:textTransform,theme:props.theme}),styledPropsCSSObject);});var _BaseText=function _BaseText(_ref2,ref){var id=_ref2.id,color=_ref2.color,fontFamily=_ref2.fontFamily,fontSize=_ref2.fontSize,fontWeight=_ref2.fontWeight,fontStyle=_ref2.fontStyle,textDecorationLine=_ref2.textDecorationLine,lineHeight=_ref2.lineHeight,textAlign=_ref2.textAlign,children=_ref2.children,truncateAfterLines=_ref2.truncateAfterLines,textTransform=_ref2.textTransform,opacity=_ref2.opacity,className=_ref2.className,style=_ref2.style,_ref2$accessibilityPr=_ref2.accessibilityProps,accessibilityProps=_ref2$accessibilityPr===void 0?{}:_ref2$accessibilityPr,_ref2$componentName=_ref2.componentName,componentName=_ref2$componentName===void 0?MetaConstants.BaseText:_ref2$componentName,testID=_ref2.testID,styledProps=_objectWithoutProperties(_ref2,_excluded2);return jsx(StyledBaseText,Object.assign({ref:ref},getStyledProps(styledProps),{color:color,fontFamily:fontFamily,fontSize:fontSize,fontWeight:fontWeight,fontStyle:fontStyle,textDecorationLine:textDecorationLine,lineHeight:lineHeight,as:undefined,textAlign:textAlign,numberOfLines:truncateAfterLines,opacity:opacity,className:className,style:style,id:id,textTransform:textTransform},makeAccessible(accessibilityProps),metaAttribute({name:componentName,testID:testID}),{children:children}));};var BaseText=React__default.forwardRef(_BaseText);
|
|
13
13
|
|
|
14
14
|
export { BaseText };
|
|
15
15
|
//# sourceMappingURL=BaseText.native.js.map
|