@razorpay/blade 12.61.1 → 12.62.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/web/development/components/Card/Card.js +4 -2
- package/build/lib/web/development/components/Card/Card.js.map +1 -1
- package/build/lib/web/development/components/Card/CardRoot.web.js +3 -2
- package/build/lib/web/development/components/Card/CardRoot.web.js.map +1 -1
- package/build/lib/web/production/components/Card/Card.js +4 -2
- package/build/lib/web/production/components/Card/Card.js.map +1 -1
- package/build/lib/web/production/components/Card/CardRoot.web.js +3 -2
- package/build/lib/web/production/components/Card/CardRoot.web.js.map +1 -1
- package/build/types/components/index.d.ts +8 -0
- package/build/types/components/index.native.d.ts +5 -0
- 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","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});
|
|
26
|
+
var _excluded=["children","backgroundColor","borderRadius","elevation","testID","padding","width","height","minHeight","minWidth","maxWidth","onClick","isSelected","accessibilityLabel","shouldScaleOnHover","onHover","href","target","rel","as","size","cursor"],_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,cursor=_ref.cursor,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,cursor:isReactNative()?undefined:cursor},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 * 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,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,EAiJA,IAAMC,KA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EkB,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;;;;"}
|
|
1
|
+
{"version":3,"file":"Card.js","sources":["../../../../../src/components/Card/Card.tsx"],"sourcesContent":["import React from 'react';\nimport type { GestureResponderEvent } from 'react-native';\nimport type { CSSObject } from 'styled-components';\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 cursor?: Platform.Select<{\n web: CSSObject['cursor'];\n native: undefined;\n }>;\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 cursor,\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 cursor={isReactNative() ? undefined : cursor}\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","cursor","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":";;;;;;;;;;;;;;;;;;;;;;;;;8SA6Ba,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,EAqJA,IAAMC,KAAiE,CAAG,SAApEA,KAAiEA,CAAAC,IAAA,CA0BrEC,GAAG,CACoB,KAzBrBC,QAAQ,CAAAF,IAAA,CAARE,QAAQ,CAAAC,oBAAA,CAAAH,IAAA,CACRI,eAAe,CAAfA,eAAe,CAAAD,oBAAA,GAAG,KAAA,CAAA,CAAA,iCAAiC,CAAAA,oBAAA,CAAAE,iBAAA,CAAAL,IAAA,CACnDM,YAAY,CAAZA,YAAY,CAAAD,iBAAA,GAAG,KAAA,CAAA,CAAA,QAAQ,CAAAA,iBAAA,CAAAE,cAAA,CAAAP,IAAA,CACvBQ,SAAS,CAATA,SAAS,CAAAD,cAAA,GAAG,KAAA,CAAA,CAAA,WAAW,CAAAA,cAAA,CACvBE,MAAM,CAAAT,IAAA,CAANS,MAAM,CAAAC,YAAA,CAAAV,IAAA,CACNW,OAAO,CAAPA,OAAO,CAAAD,YAAA,GAAA,KAAA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'../Box/BaseBox/BaseBox.web.js';
|
|
28
28
|
import { assignWithoutSideEffects } from '../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
|
|
29
29
|
|
|
30
|
-
var _excluded = ["children", "backgroundColor", "borderRadius", "elevation", "testID", "padding", "width", "height", "minHeight", "minWidth", "maxWidth", "onClick", "isSelected", "accessibilityLabel", "shouldScaleOnHover", "onHover", "href", "target", "rel", "as", "size"],
|
|
30
|
+
var _excluded = ["children", "backgroundColor", "borderRadius", "elevation", "testID", "padding", "width", "height", "minHeight", "minWidth", "maxWidth", "onClick", "isSelected", "accessibilityLabel", "shouldScaleOnHover", "onHover", "href", "target", "rel", "as", "size", "cursor"],
|
|
31
31
|
_excluded2 = ["height", "children", "testID"];
|
|
32
32
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
33
33
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -76,6 +76,7 @@ var _Card = function _Card(_ref, ref) {
|
|
|
76
76
|
as = _ref.as,
|
|
77
77
|
_ref$size = _ref.size,
|
|
78
78
|
size = _ref$size === void 0 ? 'large' : _ref$size,
|
|
79
|
+
cursor = _ref.cursor,
|
|
79
80
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
80
81
|
var _React$useState = React__default.useState(false),
|
|
81
82
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -130,7 +131,8 @@ var _Card = function _Card(_ref, ref) {
|
|
|
130
131
|
maxWidth: maxWidth,
|
|
131
132
|
href: href,
|
|
132
133
|
accessibilityLabel: accessibilityLabel,
|
|
133
|
-
validationState: _validationState
|
|
134
|
+
validationState: _validationState,
|
|
135
|
+
cursor: isReactNative() ? undefined : cursor
|
|
134
136
|
}, metaAttribute({
|
|
135
137
|
name: MetaConstants.Card,
|
|
136
138
|
testID: testID
|
|
@@ -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 * 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","_objectSpread","metaAttribute","name","CARD_LINK_OVERLAY_ID","makeAccessible","label","pressed","undefined","onFocus","onBlur","defaultRel","checkboxGroupProps","useCheckboxGroupContext","radioGroupProps","useRadioGroupContext","getGroupProps","Object","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","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/B,oBACEjB,GAAA,CAACkB,OAAO,EAAAxC,aAAA,CAAAA,aAAA,CAAAA,aAAA,CACFC,EAAAA,EAAAA,aAAa,CAAC;IAAEC,IAAI,EAAE0B,aAAa,CAACjF,QAAQ;AAAEkB,IAAAA,MAAM,EAANA,MAAAA;AAAO,GAAC,CAAC,CAAA,EACvDkE,sBAAsB,CAAC7C,IAAI,CAAC,CAAA,EAAA,EAAA,EAAA;AAChCjB,IAAAA,MAAM,EAAEA,MAAO;AAAAX,IAAAA,QAAA,EAEdA,QAAAA;AAAQ,GAAA,CACF,CAAC,CAAA;AAEd,CAAC,CAAA;AAED,IAAMuE,IAAI,gBAAGvC,cAAK,CAACmD,UAAU,CAACtF,KAAK,EAAC;AACpC,IAAMR,QAAQ,gBAAG+F,wBAAwB,CAACN,SAAS,EAAE;EAAEO,WAAW,EAAEvG,YAAY,CAACO,QAAAA;AAAS,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 type { CSSObject } from 'styled-components';\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 cursor?: Platform.Select<{\n web: CSSObject['cursor'];\n native: undefined;\n }>;\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 cursor,\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 cursor={isReactNative() ? undefined : cursor}\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","cursor","rest","_objectWithoutProperties","_excluded","_React$useState","React","useState","_React$useState2","_slicedToArray","isFocused","setIsFocused","useVerifyAllowedChildren","componentName","allowedComponents","linkOverlayProps","_objectSpread","metaAttribute","name","CARD_LINK_OVERLAY_ID","makeAccessible","label","pressed","undefined","onFocus","onBlur","defaultRel","checkboxGroupProps","useCheckboxGroupContext","radioGroupProps","useRadioGroupContext","getGroupProps","Object","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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BO,IAAMA,YAAY,GAAG;AAC1BC,EAAAA,UAAU,EAAE,YAAY;AACxBC,EAAAA,kBAAkB,EAAE,oBAAoB;AACxCC,EAAAA,iBAAiB,EAAE,mBAAmB;AACtCC,EAAAA,UAAU,EAAE,YAAY;AACxBC,EAAAA,kBAAkB,EAAE,oBAAoB;AACxCC,EAAAA,iBAAiB,EAAE,mBAAmB;AACtCC,EAAAA,QAAQ,EAAE,UAAU;AACpBC,EAAAA,cAAc,EAAE,gBAAgB;AAChCC,EAAAA,iBAAiB,EAAE,mBAAmB;AACtCC,EAAAA,eAAe,EAAE,iBAAiB;AAClCC,EAAAA,gBAAgB,EAAE,kBAAkB;AACpCC,EAAAA,cAAc,EAAE,gBAAgB;AAChCC,EAAAA,cAAc,EAAE,gBAAgB;AAChCC,EAAAA,oBAAoB,EAAE,sBAAA;AACxB,EAAC;AAqJD,IAAMC,KAAiE,GAAG,SAApEA,KAAiEA,CAAAC,IAAA,EA0BrEC,GAAG,EACoB;AAAA,EAAA,IAzBrBC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IAAAC,oBAAA,GAAAH,IAAA,CACRI,eAAe;AAAfA,IAAAA,eAAe,GAAAD,oBAAA,KAAG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isPressed = _ref.isPressed,
|
|
30
30
|
isMobile = _ref.isMobile,
|
|
31
|
-
validationState = _ref.validationState
|
|
31
|
+
validationState = _ref.validationState,
|
|
32
|
+
cursor = _ref.cursor;
|
|
32
33
|
var getCardBorderColor = function getCardBorderColor() {
|
|
33
34
|
if (validationState === 'error') return theme.colors.interactive.border.negative["default"];
|
|
34
35
|
if (validationState === 'success') return theme.colors.interactive.border.positive["default"];
|
|
@@ -42,7 +43,7 @@ var StyledCardRoot = /*#__PURE__*/styled(BaseBox).withConfig({
|
|
|
42
43
|
return _objectSpread(_objectSpread(_objectSpread({
|
|
43
44
|
// Selected state
|
|
44
45
|
boxShadow: "".concat(selectedBorder).concat(focusRing),
|
|
45
|
-
cursor: as === 'label' ? 'pointer' : 'initial'
|
|
46
|
+
cursor: cursor ? cursor : as === 'label' ? 'pointer' : 'initial'
|
|
46
47
|
}, isMobile && isPressed && {
|
|
47
48
|
transform: "scale(".concat(CARD_SCALE_DOWN_VALUE, ")")
|
|
48
49
|
}), !isMobile && shouldScaleOnHover && {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardRoot.web.js","sources":["../../../../../../src/components/Card/CardRoot.web.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport React from 'react';\nimport type { CardRootProps } from './types';\nimport { CARD_LINK_OVERLAY_ID, CARD_SCALE_DOWN_VALUE, CARD_SCALE_UP_VALUE } from './constants';\nimport BaseBox from '~components/Box/BaseBox';\nimport { castWebType, makeMotionTime } from '~utils';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { useIsMobile } from '~utils/useIsMobile';\nimport type { BladeElementRef } from '~utils/types';\n\nconst StyledCardRoot = styled(BaseBox)<CardRootProps & { isPressed: boolean; isMobile: boolean }>(\n ({\n as,\n theme,\n isSelected,\n isFocused,\n shouldScaleOnHover,\n isPressed,\n isMobile,\n validationState,\n }) => {\n const getCardBorderColor = (): string => {\n if (validationState === 'error') return theme.colors.interactive.border.negative.default;\n if (validationState === 'success') return theme.colors.interactive.border.positive.default;\n if (isSelected) return theme.colors.surface.border.primary.normal;\n return 'transparent';\n };\n\n const selectedColor = getCardBorderColor();\n const selectedBorder = `0px 0px 0px ${theme.border.width.thicker}px ${selectedColor}`;\n // focused state\n const focusRing = isFocused\n ? `, 0px 0px 0px 4px ${theme.colors.surface.border.primary.muted}`\n : '';\n\n return {\n // Selected state\n boxShadow: `${selectedBorder}${focusRing}`,\n cursor: as === 'label' ? 'pointer' : 'initial',\n\n // pressed state for mobile only\n ...(isMobile &&\n isPressed && {\n transform: `scale(${CARD_SCALE_DOWN_VALUE})`,\n }),\n\n // Hover state for desktop only\n ...(!isMobile &&\n shouldScaleOnHover && {\n transitionDuration: castWebType(makeMotionTime(theme.motion.duration.xquick)),\n transitionTimingFunction: castWebType(theme.motion.easing.standard),\n transitionProperty: 'transform, box-shadow',\n\n '&:hover': {\n transform: `scale(${CARD_SCALE_UP_VALUE})`,\n },\n }),\n\n // uplift all the nested links so they receive clicks and events (except the LinkOverlay)\n // https://www.sarasoueidan.com/blog/nested-links\n [`& a[href]:not(a[data-blade-component=\"${CARD_LINK_OVERLAY_ID}\"])`]: {\n zIndex: 2,\n position: 'relative',\n },\n [`& button:not(button[data-blade-component=\"${CARD_LINK_OVERLAY_ID}\"])`]: {\n zIndex: 2,\n position: 'relative',\n },\n [`& label:not(a[data-blade-component=\"${CARD_LINK_OVERLAY_ID}\"])`]: {\n zIndex: 2,\n position: 'relative',\n },\n [`& label:not(button[data-blade-component=\"${CARD_LINK_OVERLAY_ID}\"])`]: {\n zIndex: 2,\n position: 'relative',\n },\n };\n },\n);\n\nconst _CardRoot: React.ForwardRefRenderFunction<BladeElementRef, CardRootProps> = (\n { as, accessibilityLabel, children, ...props },\n ref,\n): React.ReactElement => {\n const isMobile = useIsMobile();\n const [isPressed, setIsPressed] = React.useState(false);\n\n return (\n <StyledCardRoot\n ref={ref as never}\n as={as}\n {...props}\n isMobile={isMobile}\n isPressed={props.shouldScaleOnHover ? isPressed : false}\n onTouchStart={() => setIsPressed(true)}\n onTouchEnd={() => setIsPressed(false)}\n onMouseDown={() => setIsPressed(true)}\n onMouseUp={() => setIsPressed(false)}\n {...makeAccessible({\n label: as === 'label' ? accessibilityLabel : undefined,\n })}\n >\n {children}\n </StyledCardRoot>\n );\n};\n\nconst CardRoot = React.forwardRef(_CardRoot);\n\nexport { CardRoot };\n"],"names":["StyledCardRoot","styled","BaseBox","withConfig","displayName","componentId","_ref","as","theme","isSelected","isFocused","shouldScaleOnHover","isPressed","isMobile","validationState","getCardBorderColor","colors","interactive","border","negative","positive","surface","primary","normal","selectedColor","selectedBorder","concat","width","thicker","focusRing","muted","_objectSpread","boxShadow","
|
|
1
|
+
{"version":3,"file":"CardRoot.web.js","sources":["../../../../../../src/components/Card/CardRoot.web.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport React from 'react';\nimport type { CardRootProps } from './types';\nimport { CARD_LINK_OVERLAY_ID, CARD_SCALE_DOWN_VALUE, CARD_SCALE_UP_VALUE } from './constants';\nimport BaseBox from '~components/Box/BaseBox';\nimport { castWebType, makeMotionTime } from '~utils';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { useIsMobile } from '~utils/useIsMobile';\nimport type { BladeElementRef } from '~utils/types';\n\nconst StyledCardRoot = styled(BaseBox)<CardRootProps & { isPressed: boolean; isMobile: boolean }>(\n ({\n as,\n theme,\n isSelected,\n isFocused,\n shouldScaleOnHover,\n isPressed,\n isMobile,\n validationState,\n cursor,\n }) => {\n const getCardBorderColor = (): string => {\n if (validationState === 'error') return theme.colors.interactive.border.negative.default;\n if (validationState === 'success') return theme.colors.interactive.border.positive.default;\n if (isSelected) return theme.colors.surface.border.primary.normal;\n return 'transparent';\n };\n\n const selectedColor = getCardBorderColor();\n const selectedBorder = `0px 0px 0px ${theme.border.width.thicker}px ${selectedColor}`;\n // focused state\n const focusRing = isFocused\n ? `, 0px 0px 0px 4px ${theme.colors.surface.border.primary.muted}`\n : '';\n\n return {\n // Selected state\n boxShadow: `${selectedBorder}${focusRing}`,\n cursor: cursor ? cursor : as === 'label' ? 'pointer' : 'initial',\n\n // pressed state for mobile only\n ...(isMobile &&\n isPressed && {\n transform: `scale(${CARD_SCALE_DOWN_VALUE})`,\n }),\n\n // Hover state for desktop only\n ...(!isMobile &&\n shouldScaleOnHover && {\n transitionDuration: castWebType(makeMotionTime(theme.motion.duration.xquick)),\n transitionTimingFunction: castWebType(theme.motion.easing.standard),\n transitionProperty: 'transform, box-shadow',\n\n '&:hover': {\n transform: `scale(${CARD_SCALE_UP_VALUE})`,\n },\n }),\n\n // uplift all the nested links so they receive clicks and events (except the LinkOverlay)\n // https://www.sarasoueidan.com/blog/nested-links\n [`& a[href]:not(a[data-blade-component=\"${CARD_LINK_OVERLAY_ID}\"])`]: {\n zIndex: 2,\n position: 'relative',\n },\n [`& button:not(button[data-blade-component=\"${CARD_LINK_OVERLAY_ID}\"])`]: {\n zIndex: 2,\n position: 'relative',\n },\n [`& label:not(a[data-blade-component=\"${CARD_LINK_OVERLAY_ID}\"])`]: {\n zIndex: 2,\n position: 'relative',\n },\n [`& label:not(button[data-blade-component=\"${CARD_LINK_OVERLAY_ID}\"])`]: {\n zIndex: 2,\n position: 'relative',\n },\n };\n },\n);\n\nconst _CardRoot: React.ForwardRefRenderFunction<BladeElementRef, CardRootProps> = (\n { as, accessibilityLabel, children, ...props },\n ref,\n): React.ReactElement => {\n const isMobile = useIsMobile();\n const [isPressed, setIsPressed] = React.useState(false);\n\n return (\n <StyledCardRoot\n ref={ref as never}\n as={as}\n {...props}\n isMobile={isMobile}\n isPressed={props.shouldScaleOnHover ? isPressed : false}\n onTouchStart={() => setIsPressed(true)}\n onTouchEnd={() => setIsPressed(false)}\n onMouseDown={() => setIsPressed(true)}\n onMouseUp={() => setIsPressed(false)}\n {...makeAccessible({\n label: as === 'label' ? accessibilityLabel : undefined,\n })}\n >\n {children}\n </StyledCardRoot>\n );\n};\n\nconst CardRoot = React.forwardRef(_CardRoot);\n\nexport { CardRoot };\n"],"names":["StyledCardRoot","styled","BaseBox","withConfig","displayName","componentId","_ref","as","theme","isSelected","isFocused","shouldScaleOnHover","isPressed","isMobile","validationState","cursor","getCardBorderColor","colors","interactive","border","negative","positive","surface","primary","normal","selectedColor","selectedBorder","concat","width","thicker","focusRing","muted","_objectSpread","boxShadow","transform","CARD_SCALE_DOWN_VALUE","transitionDuration","castWebType","makeMotionTime","motion","duration","xquick","transitionTimingFunction","easing","standard","transitionProperty","CARD_SCALE_UP_VALUE","_defineProperty","CARD_LINK_OVERLAY_ID","zIndex","position","_CardRoot","_ref2","ref","accessibilityLabel","children","props","_objectWithoutProperties","_excluded","useIsMobile","_React$useState","React","useState","_React$useState2","_slicedToArray","setIsPressed","_jsx","onTouchStart","onTouchEnd","onMouseDown","onMouseUp","makeAccessible","label","undefined","CardRoot","forwardRef"],"mappings":";;;;;;;;;;;;;;;;;;;AAUA,IAAMA,cAAc,gBAAGC,MAAM,CAACC,OAAO,CAAC,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,6BAAA;EAAAC,WAAA,EAAA,cAAA;AAAA,CACpC,CAAA,CAAA,UAAAC,IAAA,EAUM;AAAA,EAAA,IATJC,EAAE,GAAAD,IAAA,CAAFC,EAAE;IACFC,KAAK,GAAAF,IAAA,CAALE,KAAK;IACLC,UAAU,GAAAH,IAAA,CAAVG,UAAU;IACVC,SAAS,GAAAJ,IAAA,CAATI,SAAS;IACTC,kBAAkB,GAAAL,IAAA,CAAlBK,kBAAkB;IAClBC,SAAS,GAAAN,IAAA,CAATM,SAAS;IACTC,QAAQ,GAAAP,IAAA,CAARO,QAAQ;IACRC,eAAe,GAAAR,IAAA,CAAfQ,eAAe;IACfC,MAAM,GAAAT,IAAA,CAANS,MAAM,CAAA;AAEN,EAAA,IAAMC,kBAAkB,GAAG,SAArBA,kBAAkBA,GAAiB;AACvC,IAAA,IAAIF,eAAe,KAAK,OAAO,EAAE,OAAON,KAAK,CAACS,MAAM,CAACC,WAAW,C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,CAAC,CAAA;AAErB,CAAC,CAAA;AAED,IAAMmB,QAAQ,gBAAGb,cAAK,CAACc,UAAU,CAACxB,SAAS;;;;"}
|
|
@@ -27,7 +27,7 @@ import { makeAnalyticsAttribute } from '../../utils/makeAnalyticsAttribute/makeA
|
|
|
27
27
|
import { BaseBox } from '../Box/BaseBox/BaseBox.web.js';
|
|
28
28
|
import { assignWithoutSideEffects } from '../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
|
|
29
29
|
|
|
30
|
-
var _excluded = ["children", "backgroundColor", "borderRadius", "elevation", "testID", "padding", "width", "height", "minHeight", "minWidth", "maxWidth", "onClick", "isSelected", "accessibilityLabel", "shouldScaleOnHover", "onHover", "href", "target", "rel", "as", "size"],
|
|
30
|
+
var _excluded = ["children", "backgroundColor", "borderRadius", "elevation", "testID", "padding", "width", "height", "minHeight", "minWidth", "maxWidth", "onClick", "isSelected", "accessibilityLabel", "shouldScaleOnHover", "onHover", "href", "target", "rel", "as", "size", "cursor"],
|
|
31
31
|
_excluded2 = ["height", "children", "testID"];
|
|
32
32
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
33
33
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -76,6 +76,7 @@ var _Card = function _Card(_ref, ref) {
|
|
|
76
76
|
as = _ref.as,
|
|
77
77
|
_ref$size = _ref.size,
|
|
78
78
|
size = _ref$size === void 0 ? 'large' : _ref$size,
|
|
79
|
+
cursor = _ref.cursor,
|
|
79
80
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
80
81
|
var _React$useState = React__default.useState(false),
|
|
81
82
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -130,7 +131,8 @@ var _Card = function _Card(_ref, ref) {
|
|
|
130
131
|
maxWidth: maxWidth,
|
|
131
132
|
href: href,
|
|
132
133
|
accessibilityLabel: accessibilityLabel,
|
|
133
|
-
validationState: _validationState
|
|
134
|
+
validationState: _validationState,
|
|
135
|
+
cursor: isReactNative() ? undefined : cursor
|
|
134
136
|
}, metaAttribute({
|
|
135
137
|
name: MetaConstants.Card,
|
|
136
138
|
testID: testID
|
|
@@ -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 * 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","_objectSpread","metaAttribute","name","CARD_LINK_OVERLAY_ID","makeAccessible","label","pressed","undefined","onFocus","onBlur","defaultRel","checkboxGroupProps","useCheckboxGroupContext","radioGroupProps","useRadioGroupContext","getGroupProps","Object","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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BO,IAAMA,YAAY,GAAG;AAC1BC,EAAAA,UAAU,EAAE,YAAY;AACxBC,EAAAA,kBAAkB,EAAE,oBAAoB;AACxCC,EAAAA,iBAAiB,EAAE,mBAAmB;AACtCC,EAAAA,UAAU,EAAE,YAAY;AACxBC,EAAAA,kBAAkB,EAAE,oBAAoB;AACxCC,EAAAA,iBAAiB,EAAE,mBAAmB;AACtCC,EAAAA,QAAQ,EAAE,UAAU;AACpBC,EAAAA,cAAc,EAAE,gBAAgB;AAChCC,EAAAA,iBAAiB,EAAE,mBAAmB;AACtCC,EAAAA,eAAe,EAAE,iBAAiB;AAClCC,EAAAA,gBAAgB,EAAE,kBAAkB;AACpCC,EAAAA,cAAc,EAAE,gBAAgB;AAChCC,EAAAA,cAAc,EAAE,gBAAgB;AAChCC,EAAAA,oBAAoB,EAAE,sBAAA;AACxB,EAAC;AAiJD,IAAMC,KAAiE,GAAG,SAApEA,KAAiEA,CAAAC,IAAA,EAyBrEC,GAAG,EACoB;AAAA,EAAA,IAxBrBC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IAAAC,oBAAA,GAAAH,IAAA,CACRI,eAAe;AAAfA,IAAAA,eAAe,GAAAD,oBAAA,KAAG,KAAA,CAAA,GAAA,iCAAiC,GAAAA,oBAAA;IAAAE,iBAAA,GAAAL,IAAA,CACnDM,YAAY;AAAZA,IAAAA,YAAY,GAAAD,iBAAA,KAAG,KAAA,CAAA,GAAA,QAAQ,GAAAA,iBAAA;IAAAE,cAAA,GAAAP,IAAA,CACvBQ,SAAS;AAATA,IAAAA,SAAS,GAAAD,cAA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AQ,GAAA+E,KAAA,CAAR/E,QAAQ;IAAEO,MAAM,GAAAwE,KAAA,CAANxE,MAAM;AAAKqB,IAAAA,IAAI,GAAAC,wBAAA,CAAAkD,KAAA,EAAAC,UAAA,CAAA,CAAA;EACpDC,mBAAmB,CAAC,UAAU,CAAC,CAAA;EAE/B,oBACEjB,GAAA,CAACkB,OAAO,EAAAxC,aAAA,CAAAA,aAAA,CAAAA,aAAA,CACFC,EAAAA,EAAAA,aAAa,CAAC;IAAEC,IAAI,EAAE0B,aAAa,CAACjF,QAAQ;AAAEkB,IAAAA,MAAM,EAANA,MAAAA;AAAO,GAAC,CAAC,CAAA,EACvDkE,sBAAsB,CAAC7C,IAAI,CAAC,CAAA,EAAA,EAAA,EAAA;AAChCjB,IAAAA,MAAM,EAAEA,MAAO;AAAAX,IAAAA,QAAA,EAEdA,QAAAA;AAAQ,GAAA,CACF,CAAC,CAAA;AAEd,CAAC,CAAA;AAED,IAAMuE,IAAI,gBAAGvC,cAAK,CAACmD,UAAU,CAACtF,KAAK,EAAC;AACpC,IAAMR,QAAQ,gBAAG+F,wBAAwB,CAACN,SAAS,EAAE;EAAEO,WAAW,EAAEvG,YAAY,CAACO,QAAAA;AAAS,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 type { CSSObject } from 'styled-components';\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 cursor?: Platform.Select<{\n web: CSSObject['cursor'];\n native: undefined;\n }>;\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 cursor,\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 cursor={isReactNative() ? undefined : cursor}\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","cursor","rest","_objectWithoutProperties","_excluded","_React$useState","React","useState","_React$useState2","_slicedToArray","isFocused","setIsFocused","useVerifyAllowedChildren","componentName","allowedComponents","linkOverlayProps","_objectSpread","metaAttribute","name","CARD_LINK_OVERLAY_ID","makeAccessible","label","pressed","undefined","onFocus","onBlur","defaultRel","checkboxGroupProps","useCheckboxGroupContext","radioGroupProps","useRadioGroupContext","getGroupProps","Object","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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BO,IAAMA,YAAY,GAAG;AAC1BC,EAAAA,UAAU,EAAE,YAAY;AACxBC,EAAAA,kBAAkB,EAAE,oBAAoB;AACxCC,EAAAA,iBAAiB,EAAE,mBAAmB;AACtCC,EAAAA,UAAU,EAAE,YAAY;AACxBC,EAAAA,kBAAkB,EAAE,oBAAoB;AACxCC,EAAAA,iBAAiB,EAAE,mBAAmB;AACtCC,EAAAA,QAAQ,EAAE,UAAU;AACpBC,EAAAA,cAAc,EAAE,gBAAgB;AAChCC,EAAAA,iBAAiB,EAAE,mBAAmB;AACtCC,EAAAA,eAAe,EAAE,iBAAiB;AAClCC,EAAAA,gBAAgB,EAAE,kBAAkB;AACpCC,EAAAA,cAAc,EAAE,gBAAgB;AAChCC,EAAAA,cAAc,EAAE,gBAAgB;AAChCC,EAAAA,oBAAoB,EAAE,sBAAA;AACxB,EAAC;AAqJD,IAAMC,KAA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AAS,EAAE;EAAEO,WAAW,EAAExG,YAAY,CAACO,QAAAA;AAAS,CAAC;;;;"}
|
|
@@ -28,7 +28,8 @@ var StyledCardRoot = /*#__PURE__*/styled(BaseBox).withConfig({
|
|
|
28
28
|
shouldScaleOnHover = _ref.shouldScaleOnHover,
|
|
29
29
|
isPressed = _ref.isPressed,
|
|
30
30
|
isMobile = _ref.isMobile,
|
|
31
|
-
validationState = _ref.validationState
|
|
31
|
+
validationState = _ref.validationState,
|
|
32
|
+
cursor = _ref.cursor;
|
|
32
33
|
var getCardBorderColor = function getCardBorderColor() {
|
|
33
34
|
if (validationState === 'error') return theme.colors.interactive.border.negative["default"];
|
|
34
35
|
if (validationState === 'success') return theme.colors.interactive.border.positive["default"];
|
|
@@ -42,7 +43,7 @@ var StyledCardRoot = /*#__PURE__*/styled(BaseBox).withConfig({
|
|
|
42
43
|
return _objectSpread(_objectSpread(_objectSpread({
|
|
43
44
|
// Selected state
|
|
44
45
|
boxShadow: "".concat(selectedBorder).concat(focusRing),
|
|
45
|
-
cursor: as === 'label' ? 'pointer' : 'initial'
|
|
46
|
+
cursor: cursor ? cursor : as === 'label' ? 'pointer' : 'initial'
|
|
46
47
|
}, isMobile && isPressed && {
|
|
47
48
|
transform: "scale(".concat(CARD_SCALE_DOWN_VALUE, ")")
|
|
48
49
|
}), !isMobile && shouldScaleOnHover && {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardRoot.web.js","sources":["../../../../../../src/components/Card/CardRoot.web.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport React from 'react';\nimport type { CardRootProps } from './types';\nimport { CARD_LINK_OVERLAY_ID, CARD_SCALE_DOWN_VALUE, CARD_SCALE_UP_VALUE } from './constants';\nimport BaseBox from '~components/Box/BaseBox';\nimport { castWebType, makeMotionTime } from '~utils';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { useIsMobile } from '~utils/useIsMobile';\nimport type { BladeElementRef } from '~utils/types';\n\nconst StyledCardRoot = styled(BaseBox)<CardRootProps & { isPressed: boolean; isMobile: boolean }>(\n ({\n as,\n theme,\n isSelected,\n isFocused,\n shouldScaleOnHover,\n isPressed,\n isMobile,\n validationState,\n }) => {\n const getCardBorderColor = (): string => {\n if (validationState === 'error') return theme.colors.interactive.border.negative.default;\n if (validationState === 'success') return theme.colors.interactive.border.positive.default;\n if (isSelected) return theme.colors.surface.border.primary.normal;\n return 'transparent';\n };\n\n const selectedColor = getCardBorderColor();\n const selectedBorder = `0px 0px 0px ${theme.border.width.thicker}px ${selectedColor}`;\n // focused state\n const focusRing = isFocused\n ? `, 0px 0px 0px 4px ${theme.colors.surface.border.primary.muted}`\n : '';\n\n return {\n // Selected state\n boxShadow: `${selectedBorder}${focusRing}`,\n cursor: as === 'label' ? 'pointer' : 'initial',\n\n // pressed state for mobile only\n ...(isMobile &&\n isPressed && {\n transform: `scale(${CARD_SCALE_DOWN_VALUE})`,\n }),\n\n // Hover state for desktop only\n ...(!isMobile &&\n shouldScaleOnHover && {\n transitionDuration: castWebType(makeMotionTime(theme.motion.duration.xquick)),\n transitionTimingFunction: castWebType(theme.motion.easing.standard),\n transitionProperty: 'transform, box-shadow',\n\n '&:hover': {\n transform: `scale(${CARD_SCALE_UP_VALUE})`,\n },\n }),\n\n // uplift all the nested links so they receive clicks and events (except the LinkOverlay)\n // https://www.sarasoueidan.com/blog/nested-links\n [`& a[href]:not(a[data-blade-component=\"${CARD_LINK_OVERLAY_ID}\"])`]: {\n zIndex: 2,\n position: 'relative',\n },\n [`& button:not(button[data-blade-component=\"${CARD_LINK_OVERLAY_ID}\"])`]: {\n zIndex: 2,\n position: 'relative',\n },\n [`& label:not(a[data-blade-component=\"${CARD_LINK_OVERLAY_ID}\"])`]: {\n zIndex: 2,\n position: 'relative',\n },\n [`& label:not(button[data-blade-component=\"${CARD_LINK_OVERLAY_ID}\"])`]: {\n zIndex: 2,\n position: 'relative',\n },\n };\n },\n);\n\nconst _CardRoot: React.ForwardRefRenderFunction<BladeElementRef, CardRootProps> = (\n { as, accessibilityLabel, children, ...props },\n ref,\n): React.ReactElement => {\n const isMobile = useIsMobile();\n const [isPressed, setIsPressed] = React.useState(false);\n\n return (\n <StyledCardRoot\n ref={ref as never}\n as={as}\n {...props}\n isMobile={isMobile}\n isPressed={props.shouldScaleOnHover ? isPressed : false}\n onTouchStart={() => setIsPressed(true)}\n onTouchEnd={() => setIsPressed(false)}\n onMouseDown={() => setIsPressed(true)}\n onMouseUp={() => setIsPressed(false)}\n {...makeAccessible({\n label: as === 'label' ? accessibilityLabel : undefined,\n })}\n >\n {children}\n </StyledCardRoot>\n );\n};\n\nconst CardRoot = React.forwardRef(_CardRoot);\n\nexport { CardRoot };\n"],"names":["StyledCardRoot","styled","BaseBox","withConfig","displayName","componentId","_ref","as","theme","isSelected","isFocused","shouldScaleOnHover","isPressed","isMobile","validationState","getCardBorderColor","colors","interactive","border","negative","positive","surface","primary","normal","selectedColor","selectedBorder","concat","width","thicker","focusRing","muted","_objectSpread","boxShadow","
|
|
1
|
+
{"version":3,"file":"CardRoot.web.js","sources":["../../../../../../src/components/Card/CardRoot.web.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport React from 'react';\nimport type { CardRootProps } from './types';\nimport { CARD_LINK_OVERLAY_ID, CARD_SCALE_DOWN_VALUE, CARD_SCALE_UP_VALUE } from './constants';\nimport BaseBox from '~components/Box/BaseBox';\nimport { castWebType, makeMotionTime } from '~utils';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { useIsMobile } from '~utils/useIsMobile';\nimport type { BladeElementRef } from '~utils/types';\n\nconst StyledCardRoot = styled(BaseBox)<CardRootProps & { isPressed: boolean; isMobile: boolean }>(\n ({\n as,\n theme,\n isSelected,\n isFocused,\n shouldScaleOnHover,\n isPressed,\n isMobile,\n validationState,\n cursor,\n }) => {\n const getCardBorderColor = (): string => {\n if (validationState === 'error') return theme.colors.interactive.border.negative.default;\n if (validationState === 'success') return theme.colors.interactive.border.positive.default;\n if (isSelected) return theme.colors.surface.border.primary.normal;\n return 'transparent';\n };\n\n const selectedColor = getCardBorderColor();\n const selectedBorder = `0px 0px 0px ${theme.border.width.thicker}px ${selectedColor}`;\n // focused state\n const focusRing = isFocused\n ? `, 0px 0px 0px 4px ${theme.colors.surface.border.primary.muted}`\n : '';\n\n return {\n // Selected state\n boxShadow: `${selectedBorder}${focusRing}`,\n cursor: cursor ? cursor : as === 'label' ? 'pointer' : 'initial',\n\n // pressed state for mobile only\n ...(isMobile &&\n isPressed && {\n transform: `scale(${CARD_SCALE_DOWN_VALUE})`,\n }),\n\n // Hover state for desktop only\n ...(!isMobile &&\n shouldScaleOnHover && {\n transitionDuration: castWebType(makeMotionTime(theme.motion.duration.xquick)),\n transitionTimingFunction: castWebType(theme.motion.easing.standard),\n transitionProperty: 'transform, box-shadow',\n\n '&:hover': {\n transform: `scale(${CARD_SCALE_UP_VALUE})`,\n },\n }),\n\n // uplift all the nested links so they receive clicks and events (except the LinkOverlay)\n // https://www.sarasoueidan.com/blog/nested-links\n [`& a[href]:not(a[data-blade-component=\"${CARD_LINK_OVERLAY_ID}\"])`]: {\n zIndex: 2,\n position: 'relative',\n },\n [`& button:not(button[data-blade-component=\"${CARD_LINK_OVERLAY_ID}\"])`]: {\n zIndex: 2,\n position: 'relative',\n },\n [`& label:not(a[data-blade-component=\"${CARD_LINK_OVERLAY_ID}\"])`]: {\n zIndex: 2,\n position: 'relative',\n },\n [`& label:not(button[data-blade-component=\"${CARD_LINK_OVERLAY_ID}\"])`]: {\n zIndex: 2,\n position: 'relative',\n },\n };\n },\n);\n\nconst _CardRoot: React.ForwardRefRenderFunction<BladeElementRef, CardRootProps> = (\n { as, accessibilityLabel, children, ...props },\n ref,\n): React.ReactElement => {\n const isMobile = useIsMobile();\n const [isPressed, setIsPressed] = React.useState(false);\n\n return (\n <StyledCardRoot\n ref={ref as never}\n as={as}\n {...props}\n isMobile={isMobile}\n isPressed={props.shouldScaleOnHover ? isPressed : false}\n onTouchStart={() => setIsPressed(true)}\n onTouchEnd={() => setIsPressed(false)}\n onMouseDown={() => setIsPressed(true)}\n onMouseUp={() => setIsPressed(false)}\n {...makeAccessible({\n label: as === 'label' ? accessibilityLabel : undefined,\n })}\n >\n {children}\n </StyledCardRoot>\n );\n};\n\nconst CardRoot = React.forwardRef(_CardRoot);\n\nexport { CardRoot };\n"],"names":["StyledCardRoot","styled","BaseBox","withConfig","displayName","componentId","_ref","as","theme","isSelected","isFocused","shouldScaleOnHover","isPressed","isMobile","validationState","cursor","getCardBorderColor","colors","interactive","border","negative","positive","surface","primary","normal","selectedColor","selectedBorder","concat","width","thicker","focusRing","muted","_objectSpread","boxShadow","transform","CARD_SCALE_DOWN_VALUE","transitionDuration","castWebType","makeMotionTime","motion","duration","xquick","transitionTimingFunction","easing","standard","transitionProperty","CARD_SCALE_UP_VALUE","_defineProperty","CARD_LINK_OVERLAY_ID","zIndex","position","_CardRoot","_ref2","ref","accessibilityLabel","children","props","_objectWithoutProperties","_excluded","useIsMobile","_React$useState","React","useState","_React$useState2","_slicedToArray","setIsPressed","_jsx","onTouchStart","onTouchEnd","onMouseDown","onMouseUp","makeAccessible","label","undefined","CardRoot","forwardRef"],"mappings":";;;;;;;;;;;;;;;;;;;AAUA,IAAMA,cAAc,gBAAGC,MAAM,CAACC,OAAO,CAAC,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,6BAAA;EAAAC,WAAA,EAAA,cAAA;AAAA,CACpC,CAAA,CAAA,UAAAC,IAAA,EAUM;AAAA,EAAA,IATJC,EAAE,GAAAD,IAAA,CAAFC,EAAE;IACFC,KAAK,GAAAF,IAAA,CAALE,KAAK;IACLC,UAAU,GAAAH,IAAA,CAAVG,UAAU;IACVC,SAAS,GAAAJ,IAAA,CAATI,SAAS;IACTC,kBAAkB,GAAAL,IAAA,CAAlBK,kBAAkB;IAClBC,SAAS,GAAAN,IAAA,CAATM,SAAS;IACTC,QAAQ,GAAAP,IAAA,CAARO,QAAQ;IACRC,eAAe,GAAAR,IAAA,C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EACjCM,cAAc,CAAC;AACjBC,IAAAA,KAAK,EAAEjE,EAAE,KAAK,OAAO,GAAG+C,kBAAkB,GAAGmB,SAAAA;AAC/C,GAAC,CAAC,CAAA,EAAA,EAAA,EAAA;AAAAlB,IAAAA,QAAA,EAEDA,QAAAA;AAAQ,GAAA,CACK,CAAC,CAAA;AAErB,CAAC,CAAA;AAED,IAAMmB,QAAQ,gBAAGb,cAAK,CAACc,UAAU,CAACxB,SAAS;;;;"}
|
|
@@ -9323,6 +9323,10 @@ type CardProps = {
|
|
|
9323
9323
|
* @default undefined
|
|
9324
9324
|
*/
|
|
9325
9325
|
as?: 'label';
|
|
9326
|
+
cursor?: Platform.Select<{
|
|
9327
|
+
web: CSSObject['cursor'];
|
|
9328
|
+
native: undefined;
|
|
9329
|
+
}>;
|
|
9326
9330
|
} & TestID & DataAnalyticsAttribute & StyledPropsBlade;
|
|
9327
9331
|
type CardBodyProps = {
|
|
9328
9332
|
children: React__default.ReactNode;
|
|
@@ -9461,6 +9465,10 @@ declare const Card: React__default.ForwardRefExoticComponent<{
|
|
|
9461
9465
|
* @default undefined
|
|
9462
9466
|
*/
|
|
9463
9467
|
as?: "label" | undefined;
|
|
9468
|
+
cursor?: Platform.Select<{
|
|
9469
|
+
web: CSSObject['cursor'];
|
|
9470
|
+
native: undefined;
|
|
9471
|
+
}> | undefined;
|
|
9464
9472
|
} & TestID & DataAnalyticsAttribute & Partial<Omit<MarginProps & Pick<FlexboxProps, "alignSelf" | "flexWrap" | "justifySelf" | "order" | "placeSelf"> & {
|
|
9465
9473
|
bottom: SpacingValueType | {
|
|
9466
9474
|
readonly base?: SpacingValueType | undefined;
|
|
@@ -6531,6 +6531,10 @@ type CardProps = {
|
|
|
6531
6531
|
* @default undefined
|
|
6532
6532
|
*/
|
|
6533
6533
|
as?: 'label';
|
|
6534
|
+
cursor?: Platform.Select<{
|
|
6535
|
+
web: CSSObject['cursor'];
|
|
6536
|
+
native: undefined;
|
|
6537
|
+
}>;
|
|
6534
6538
|
} & TestID & DataAnalyticsAttribute & StyledPropsBlade;
|
|
6535
6539
|
type CardBodyProps = {
|
|
6536
6540
|
children: react__default.ReactNode;
|
|
@@ -6669,6 +6673,7 @@ declare const Card: react__default.ForwardRefExoticComponent<{
|
|
|
6669
6673
|
* @default undefined
|
|
6670
6674
|
*/
|
|
6671
6675
|
as?: "label" | undefined;
|
|
6676
|
+
cursor?: undefined;
|
|
6672
6677
|
} & TestID & DataAnalyticsAttribute & Partial<Omit<MarginProps & Pick<FlexboxProps, "alignSelf" | "flexWrap" | "justifySelf" | "order" | "placeSelf"> & {
|
|
6673
6678
|
bottom: SpacingValueType | {
|
|
6674
6679
|
readonly base?: SpacingValueType | undefined;
|