@razorpay/blade 12.95.1 → 12.95.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lib/native/components/Card/Card.js +1 -1
- package/build/lib/native/components/Card/Card.js.map +1 -1
- package/build/lib/native/components/Input/BaseInput/baseInputStyles.js +1 -1
- package/build/lib/native/components/Input/BaseInput/baseInputStyles.js.map +1 -1
- package/build/lib/web/development/components/Card/Card.js +8 -1
- package/build/lib/web/development/components/Card/Card.js.map +1 -1
- package/build/lib/web/development/components/Dropdown/DropdownOverlay.web.js +0 -1
- package/build/lib/web/development/components/Dropdown/DropdownOverlay.web.js.map +1 -1
- package/build/lib/web/development/components/Input/BaseInput/baseInputStyles.js +1 -0
- package/build/lib/web/development/components/Input/BaseInput/baseInputStyles.js.map +1 -1
- package/build/lib/web/development/components/Modal/Modal.web.js +31 -28
- package/build/lib/web/development/components/Modal/Modal.web.js.map +1 -1
- package/build/lib/web/development/components/SideNav/SideNavItems/SideNavItem.web.js +1 -1
- package/build/lib/web/development/components/SideNav/SideNavItems/SideNavItem.web.js.map +1 -1
- package/build/lib/web/production/_virtual/cloneDeep.js +1 -1
- package/build/lib/web/production/_virtual/cloneDeep3.js +1 -1
- package/build/lib/web/production/components/Card/Card.js +8 -1
- package/build/lib/web/production/components/Card/Card.js.map +1 -1
- package/build/lib/web/production/components/Dropdown/DropdownOverlay.web.js +0 -1
- package/build/lib/web/production/components/Dropdown/DropdownOverlay.web.js.map +1 -1
- package/build/lib/web/production/components/Input/BaseInput/baseInputStyles.js +1 -0
- package/build/lib/web/production/components/Input/BaseInput/baseInputStyles.js.map +1 -1
- package/build/lib/web/production/components/Modal/Modal.web.js +31 -28
- package/build/lib/web/production/components/Modal/Modal.web.js.map +1 -1
- package/build/lib/web/production/components/SideNav/SideNavItems/SideNavItem.web.js +1 -1
- package/build/lib/web/production/components/SideNav/SideNavItems/SideNavItem.web.js.map +1 -1
- package/build/lib/web/production/node_modules/es-toolkit/dist/compat/object/cloneDeep.js +1 -1
- package/build/lib/web/production/node_modules/es-toolkit/dist/compat/predicate/matches.js +2 -2
- package/build/lib/web/production/node_modules/es-toolkit/dist/compat/predicate/matchesProperty.js +2 -2
- package/build/lib/web/production/node_modules/es-toolkit/dist/object/cloneDeep.js +1 -1
- package/build/types/components/index.d.ts +24 -0
- package/build/types/components/index.native.d.ts +24 -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","cursor","opacity","transition","flexShrink"],_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.borderRadius;_ref.elevation
|
|
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","opacity","transition","flexShrink","overflow","overflowX","overflowY"],_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.borderRadius;var _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,opacity=_ref.opacity,transition=_ref.transition,flexShrink=_ref.flexShrink,overflow=_ref.overflow,overflowX=_ref.overflowX,overflowY=_ref.overflowY,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];var _useTheme=useTheme(),colorScheme=_useTheme.colorScheme;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:"medium",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,opacity:opacity,transition:transition,flexShrink:flexShrink},metaAttribute({name:MetaConstants.Card,testID:testID}),getStyledProps(rest),makeAnalyticsAttribute(rest),{children:jsxs(CardSurface,{height:height,minHeight:minHeight,padding:padding,borderRadius:"medium",textAlign:'left',backgroundColor:"surface.background.gray.intense",colorScheme:colorScheme,isSelected:isSelected,elevation:elevation,overflow:overflow,overflowX:overflowX,overflowY:overflowY,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":["/* eslint-disable @typescript-eslint/no-unused-vars */\nimport 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, useTheme } 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 * @deprecated The `backgroundColor` prop is deprecated and is a no-op. The Card always uses `surface.background.gray.intense`. This prop will be removed in a future major version.\n */\n backgroundColor?: CardSurfaceBackgroundColors;\n /**\n * Sets the border radius of the Card\n *\n * @default `medium`\n *\n * @deprecated The `borderRadius` prop is deprecated and is a no-op. The Card always uses `medium` borderRadius. This prop will be removed in a future major version.\n */\n borderRadius?: Extract<BoxProps['borderRadius'], 'medium' | 'large' | 'xlarge'>;\n /**\n * Sets the elevation for Cards\n *\n * **Links:**\n * - Docs: https://blade.razorpay.com/?path=/docs/tokens-elevation--docs\n *\n * @deprecated The `elevation` prop is deprecated and is a no-op. The Card always uses a custom elevation. This prop will be removed in a future major version.\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 opacity?: BoxProps['opacity'];\n transition?: BoxProps['transition'];\n flexShrink?: BoxProps['flexShrink'];\n} & TestID &\n DataAnalyticsAttribute &\n StyledPropsBlade;\n\nconst _Card: React.ForwardRefRenderFunction<BladeElementRef, CardProps> = (\n {\n children,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n backgroundColor,\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 opacity,\n transition,\n flexShrink,\n ...rest\n },\n ref,\n): React.ReactElement => {\n const [isFocused, setIsFocused] = React.useState(false);\n const { colorScheme } = useTheme();\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=\"medium\"\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 opacity={opacity}\n transition={transition}\n flexShrink={flexShrink}\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=\"medium\"\n textAlign={'left' as never}\n backgroundColor=\"surface.background.gray.intense\"\n colorScheme={colorScheme}\n isSelected={isSelected}\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","backgroundColor","borderRadius","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","opacity","transition","flexShrink","rest","_objectWithoutProperties","_excluded","_React$useState","React","useState","_React$useState2","_slicedToArray","isFocused","setIsFocused","_useTheme","useTheme","colorScheme","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":";;;;;;;;;;;;;;;;;;;;;;;;;kVA8Ba,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,EA0JA,IAAMC,KAAiE,CAAG,SAApEA,KAAiEA,CAAAC,IAAA,CA8BrEC,GAAG,CACoB,CA7BrB,IAAAC,QAAQ,CAAAF,IAAA,CAARE,QAAQ,CAEOF,IAAA,CAAfG,eAAe,CAAAH,IAAA,CACfI,YAAY,CAAWJ,IAAA,CACvBK,SAAS,KACTC,MAAM,CAAAN,IAAA,CAANM,MAAM,CAAAC,YAAA,CAAAP,IAAA,CACNQ,OAAO,CAAPA,OAAO,CAAAD,YAAA,GAAA,KAAA,CAAA,CAAG,WAAW,CAAAA,YAAA,CACrBE,KAAK,CAAAT,I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1C,cAAK,CAACsD,UAAU,CAAC1F,KAAK,EAC7B,IAAAR,QAAQ,CAAGmG,wBAAwB,CAACN,SAAS,CAAE,CAAEO,WAAW,CAAE3G,YAAY,CAACO,QAAS,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"Card.js","sources":["../../../../../src/components/Card/Card.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\nimport 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, useTheme } 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 * @deprecated The `backgroundColor` prop is deprecated and is a no-op. The Card always uses `surface.background.gray.intense`. This prop will be removed in a future major version.\n */\n backgroundColor?: CardSurfaceBackgroundColors;\n /**\n * Sets the border radius of the Card\n *\n * @default `medium`\n *\n * @deprecated The `borderRadius` prop is deprecated and is a no-op. The Card always uses `medium` borderRadius. This prop will be removed in a future major version.\n */\n borderRadius?: Extract<BoxProps['borderRadius'], 'medium' | 'large' | 'xlarge'>;\n /**\n * Sets the elevation for Cards\n *\n * **Links:**\n * - Docs: https://blade.razorpay.com/?path=/docs/tokens-elevation--docs\n *\n * @deprecated The `elevation` prop is deprecated and is a no-op. The Card always uses a custom elevation. This prop will be removed in a future major version.\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 opacity?: BoxProps['opacity'];\n transition?: BoxProps['transition'];\n flexShrink?: BoxProps['flexShrink'];\n /**\n * Sets the overflow behavior of the card content\n */\n overflow?: BoxProps['overflow'];\n /**\n * Sets the horizontal overflow behavior of the card content\n */\n overflowX?: BoxProps['overflowX'];\n /**\n * Sets the vertical overflow behavior of the card content\n */\n overflowY?: BoxProps['overflowY'];\n} & TestID &\n DataAnalyticsAttribute &\n StyledPropsBlade;\n\nconst _Card: React.ForwardRefRenderFunction<BladeElementRef, CardProps> = (\n {\n children,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n backgroundColor,\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 opacity,\n transition,\n flexShrink,\n overflow,\n overflowX,\n overflowY,\n ...rest\n },\n ref,\n): React.ReactElement => {\n const [isFocused, setIsFocused] = React.useState(false);\n const { colorScheme } = useTheme();\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=\"medium\"\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 opacity={opacity}\n transition={transition}\n flexShrink={flexShrink}\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=\"medium\"\n textAlign={'left' as never}\n backgroundColor=\"surface.background.gray.intense\"\n colorScheme={colorScheme}\n isSelected={isSelected}\n elevation={elevation}\n overflow={overflow}\n overflowX={overflowX}\n overflowY={overflowY}\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","backgroundColor","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","opacity","transition","flexShrink","overflow","overflowX","overflowY","rest","_objectWithoutProperties","_excluded","_React$useState","React","useState","_React$useState2","_slicedToArray","isFocused","setIsFocused","_useTheme","useTheme","colorScheme","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":";;;;;;;;;;;;;;;;;;;;;;;;;qXA8Ba,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,EAsKA,IAAMC,KAAiE,CAAG,SAApEA,KAAiEA,CAAAC,IAAA,CAiCrEC,GAAG,CACoB,CAhCrB,I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AAG,SAAZA,SAASA,CAAAC,KAAA,CAAiF,KAA3E9E,MAAM,CAAA8E,KAAA,CAAN9E,MAAM,CAAET,QAAQ,CAAAuF,KAAA,CAARvF,QAAQ,CAAEK,MAAM,CAAAkF,KAAA,CAANlF,MAAM,CAAK4B,IAAI,CAAAC,wBAAA,CAAAqD,KAAA,CAAAC,UAAA,CAAA,CACpDC,mBAAmB,CAAC,UAAU,CAAC,CAE/B,OACEjB,GAAA,CAACkB,OAAO,CAAAxC,MAAA,CAAAC,MAAA,CACFC,EAAAA,CAAAA,aAAa,CAAC,CAAEC,IAAI,CAAEyB,aAAa,CAACzF,QAAQ,CAAEgB,MAAM,CAANA,MAAO,CAAC,CAAC,CACvD4E,sBAAsB,CAAChD,IAAI,CAAC,CAAA,CAChCxB,MAAM,CAAEA,MAAO,CAAAT,QAAA,CAEdA,QAAQ,CAAA,CACF,CAAC,CAEd,CAAC,CAEK,IAAA+E,IAAI,CAAG1C,cAAK,CAACsD,UAAU,CAAC9F,KAAK,EAC7B,IAAAR,QAAQ,CAAGuG,wBAAwB,CAACN,SAAS,CAAE,CAAEO,WAAW,CAAE/G,YAAY,CAACO,QAAS,CAAC;;;;"}
|
|
@@ -14,7 +14,7 @@ import getIn from '../../../utils/lodashButBetter/get.js';
|
|
|
14
14
|
import getTextStyles from '../../Typography/Text/getTextStyles.js';
|
|
15
15
|
import getHeadingStyles from '../../Typography/Heading/getHeadingStyles.js';
|
|
16
16
|
|
|
17
|
-
var getBaseInputState=function getBaseInputState(_ref){var isFocused=_ref.isFocused,isHovered=_ref.isHovered,isDisabled=_ref.isDisabled;if(isDisabled){return 'disabled';}else if(isFocused){return 'focused';}else if(isHovered){return 'hovered';}else {return 'default';}};var getInputBackgroundAndBorderStyles=function getInputBackgroundAndBorderStyles(_ref2){var theme=_ref2.theme,isHovered=_ref2.isHovered,isFocused=_ref2.isFocused,isDisabled=_ref2.isDisabled,validationState=_ref2.validationState,isTextArea=_ref2.isTextArea,isDropdownTrigger=_ref2.isDropdownTrigger,isTableInputCell=_ref2.isTableInputCell,_ref2$size=_ref2.size,size=_ref2$size===void 0?'medium':_ref2$size,borderRadius=_ref2.borderRadius;var backgroundColorTokens=isTableInputCell?baseInputBorderlessBackgroundColor:baseInputBackgroundColor;var backgroundColor=getIn(theme.colors,backgroundColorTokens.default);var borderColor=isTableInputCell?theme.colors.transparent:getIn(theme.colors,baseInputBorderColor.default);var borderWidth=getIn(theme.border.width,baseInputBorderWidth.default);var zIndex;var baseInputState=getBaseInputState({isFocused:isFocused,isHovered:isHovered,isDisabled:isDisabled});backgroundColor=getIn(theme.colors,backgroundColorTokens[baseInputState]);borderColor=isTableInputCell&&baseInputState!=='focused'?theme.colors.transparent:getIn(theme.colors,baseInputBorderColor[baseInputState]);borderWidth=getIn(theme.border.width,baseInputBorderWidth[baseInputState]);if(!isTableInputCell&&validationState&&validationState!=='none'){borderColor=getIn(theme.colors,baseInputBorderColor[validationState]);borderWidth=getIn(theme.border.width,baseInputBorderWidth[validationState]);zIndex=1;}else if(validationState&&validationState!=='none'){backgroundColor=getIn(theme.colors,baseInputBorderlessBackgroundColor[validationState]);}return Object.assign({backgroundColor:backgroundColor,borderRadius:makeBorderSize(isTableInputCell?theme.border.radius.none:theme.border.radius[borderRadius!=null?borderRadius:baseInputBorderRadius[size]]),borderStyle:'solid',display:'flex',flexDirection:'row',width:'100%',alignItems:isTextArea?'flex-start':'center',position:'relative',height:isDropdownTrigger&&!isTextArea?'auto':undefined,border:'none',zIndex:zIndex},getBaseInputBorderStyles({theme:theme,borderColor:borderColor,borderWidth:borderWidth,isFocused:isFocused}));};var getLeftPadding=function getLeftPadding(_ref3){var theme=_ref3.theme,isDropdownTrigger=_ref3.isDropdownTrigger,hasLeadingIcon=_ref3.hasLeadingIcon,hasPrefix=_ref3.hasPrefix,size=_ref3.size,hasLeadingDropdown=_ref3.hasLeadingDropdown,isInsideCounterInput=_ref3.isInsideCounterInput;if(isDropdownTrigger){return theme.spacing[0];}if(hasLeadingIcon||hasPrefix||hasLeadingDropdown){return theme.spacing[3];}if(isInsideCounterInput){return theme.spacing[baseInputCounterInputPaddingTokens.left[size]];}return theme.spacing[baseInputPaddingTokens.left[size]];};var getRightPadding=function getRightPadding(_ref4){var theme=_ref4.theme,hasTrailingInteractionElement=_ref4.hasTrailingInteractionElement,hasSuffix=_ref4.hasSuffix,hasTrailingIcon=_ref4.hasTrailingIcon,size=_ref4.size,isInsideCounterInput=_ref4.isInsideCounterInput;if(hasTrailingInteractionElement||hasSuffix||hasTrailingIcon){return theme.spacing[3];}if(isInsideCounterInput){return theme.spacing[baseInputCounterInputPaddingTokens.right[size]];}return theme.spacing[baseInputPaddingTokens.right[size]];};var getTopPadding=function getTopPadding(_ref5){var theme=_ref5.theme,size=_ref5.size,isInsideCounterInput=_ref5.isInsideCounterInput;if(isInsideCounterInput){return theme.spacing[baseInputCounterInputPaddingTokens.top[size]];}return theme.spacing[baseInputPaddingTokens.top[size]];};var getBottomPadding=function getBottomPadding(_ref6){var theme=_ref6.theme,size=_ref6.size,isInsideCounterInput=_ref6.isInsideCounterInput;if(isInsideCounterInput){return theme.spacing[baseInputCounterInputPaddingTokens.top[size]];}return theme.spacing[baseInputPaddingTokens.bottom[size]];};var getBaseInputStyles=function getBaseInputStyles(_ref7){var theme=_ref7.theme,isDisabled=_ref7.isDisabled,leadingIcon=_ref7.leadingIcon,prefix=_ref7.prefix,trailingInteractionElement=_ref7.trailingInteractionElement,leadingInteractionElement=_ref7.leadingInteractionElement,suffix=_ref7.suffix,trailingIcon=_ref7.trailingIcon,textAlign=_ref7.textAlign,isTextArea=_ref7.isTextArea,hasTags=_ref7.hasTags,isDropdownTrigger=_ref7.isDropdownTrigger,size=_ref7.size,padding=_ref7.padding,valueComponentType=_ref7.valueComponentType,_ref7$hasLeadingDropd=_ref7.hasLeadingDropdown,hasLeadingDropdown=_ref7$hasLeadingDropd===void 0?false:_ref7$hasLeadingDropd,color=_ref7.color,disabledColor=_ref7.disabledColor,isInsideCounterInput=_ref7.isInsideCounterInput;var _getInputVisualsToBeR=getInputVisualsToBeRendered({leadingIcon:leadingIcon,prefix:prefix,trailingInteractionElement:trailingInteractionElement,leadingInteractionElement:leadingInteractionElement,suffix:suffix,trailingIcon:trailingIcon,size:size}),hasLeadingIcon=_getInputVisualsToBeR.hasLeadingIcon,hasPrefix=_getInputVisualsToBeR.hasPrefix,hasTrailingInteractionElement=_getInputVisualsToBeR.hasTrailingInteractionElement,hasSuffix=_getInputVisualsToBeR.hasSuffix,hasTrailingIcon=_getInputVisualsToBeR.hasTrailingIcon;var isDropdownWithTags=isDropdownTrigger&&hasTags;var isReactNative=getPlatformType()==='react-native';var shouldHaveFlexibleHeight=isTextArea||isDropdownWithTags;return Object.assign({},valueComponentType==='heading'?getHeadingStyles({size:size==='xsmall'?'small':size,weight:'regular',color:isDisabled?'surface.text.gray.disabled':'interactive.text.gray.normal',theme:theme}):getTextStyles({size:isInsideCounterInput&&size==='xsmall'?'small':size,variant:'body',weight:isInsideCounterInput?'semibold':'regular',color:isDisabled?disabledColor!=null?disabledColor:'surface.text.gray.disabled':color!=null?color:'interactive.text.gray.normal',theme:theme}),{flex:1,backgroundColor:theme.colors.transparent,paddingTop:padding!=null?padding:makeSpace(getTopPadding({theme:theme,size:size,isInsideCounterInput:isInsideCounterInput})),paddingBottom:padding!=null?padding:makeSpace(getBottomPadding({theme:theme,size:size,isInsideCounterInput:isInsideCounterInput})),paddingLeft:padding!=null?padding:makeSpace(getLeftPadding({theme:theme,isDropdownTrigger:isDropdownTrigger,hasLeadingIcon:hasLeadingIcon,hasPrefix:hasPrefix,size:size,hasLeadingDropdown:hasLeadingDropdown,isInsideCounterInput:isInsideCounterInput})),paddingRight:padding!=null?padding:getRightPadding({theme:theme,hasTrailingInteractionElement:hasTrailingInteractionElement,hasSuffix:hasSuffix,hasTrailingIcon:hasTrailingIcon,size:size,isInsideCounterInput:isInsideCounterInput}),textAlign:textAlign,width:'100%',height:shouldHaveFlexibleHeight?undefined:makeSpace(baseInputHeight[size]),minHeight:shouldHaveFlexibleHeight?undefined:makeSpace(baseInputHeight[size])},isReactNative?{}:{resize:'none',boxSizing:'border-box'});};var getAnimatedBaseInputWrapperMaxHeight=function getAnimatedBaseInputWrapperMaxHeight(_ref8){var maxTagRows=_ref8.maxTagRows,showAllTags=_ref8.showAllTags,size=_ref8.size;if(maxTagRows==='single'){return baseInputHeight[size];}if(maxTagRows==='multiple'){return baseInputWrapperMaxHeight[size];}return showAllTags?baseInputWrapperMaxHeight[size]:baseInputHeight[size];};
|
|
17
|
+
var getBaseInputState=function getBaseInputState(_ref){var isFocused=_ref.isFocused,isHovered=_ref.isHovered,isDisabled=_ref.isDisabled;if(isDisabled){return 'disabled';}else if(isFocused){return 'focused';}else if(isHovered){return 'hovered';}else {return 'default';}};var getInputBackgroundAndBorderStyles=function getInputBackgroundAndBorderStyles(_ref2){var theme=_ref2.theme,isHovered=_ref2.isHovered,isFocused=_ref2.isFocused,isDisabled=_ref2.isDisabled,validationState=_ref2.validationState,isTextArea=_ref2.isTextArea,isDropdownTrigger=_ref2.isDropdownTrigger,isTableInputCell=_ref2.isTableInputCell,_ref2$size=_ref2.size,size=_ref2$size===void 0?'medium':_ref2$size,borderRadius=_ref2.borderRadius;var backgroundColorTokens=isTableInputCell?baseInputBorderlessBackgroundColor:baseInputBackgroundColor;var backgroundColor=getIn(theme.colors,backgroundColorTokens.default);var borderColor=isTableInputCell?theme.colors.transparent:getIn(theme.colors,baseInputBorderColor.default);var borderWidth=getIn(theme.border.width,baseInputBorderWidth.default);var zIndex;var baseInputState=getBaseInputState({isFocused:isFocused,isHovered:isHovered,isDisabled:isDisabled});backgroundColor=getIn(theme.colors,backgroundColorTokens[baseInputState]);borderColor=isTableInputCell&&baseInputState!=='focused'?theme.colors.transparent:getIn(theme.colors,baseInputBorderColor[baseInputState]);borderWidth=getIn(theme.border.width,baseInputBorderWidth[baseInputState]);if(!isTableInputCell&&validationState&&validationState!=='none'){borderColor=getIn(theme.colors,baseInputBorderColor[validationState]);borderWidth=getIn(theme.border.width,baseInputBorderWidth[validationState]);zIndex=1;}else if(validationState&&validationState!=='none'){backgroundColor=getIn(theme.colors,baseInputBorderlessBackgroundColor[validationState]);}return Object.assign({backgroundColor:backgroundColor,borderRadius:makeBorderSize(isTableInputCell?theme.border.radius.none:theme.border.radius[borderRadius!=null?borderRadius:baseInputBorderRadius[size]]),overflow:'hidden',borderStyle:'solid',display:'flex',flexDirection:'row',width:'100%',alignItems:isTextArea?'flex-start':'center',position:'relative',height:isDropdownTrigger&&!isTextArea?'auto':undefined,border:'none',zIndex:zIndex},getBaseInputBorderStyles({theme:theme,borderColor:borderColor,borderWidth:borderWidth,isFocused:isFocused}));};var getLeftPadding=function getLeftPadding(_ref3){var theme=_ref3.theme,isDropdownTrigger=_ref3.isDropdownTrigger,hasLeadingIcon=_ref3.hasLeadingIcon,hasPrefix=_ref3.hasPrefix,size=_ref3.size,hasLeadingDropdown=_ref3.hasLeadingDropdown,isInsideCounterInput=_ref3.isInsideCounterInput;if(isDropdownTrigger){return theme.spacing[0];}if(hasLeadingIcon||hasPrefix||hasLeadingDropdown){return theme.spacing[3];}if(isInsideCounterInput){return theme.spacing[baseInputCounterInputPaddingTokens.left[size]];}return theme.spacing[baseInputPaddingTokens.left[size]];};var getRightPadding=function getRightPadding(_ref4){var theme=_ref4.theme,hasTrailingInteractionElement=_ref4.hasTrailingInteractionElement,hasSuffix=_ref4.hasSuffix,hasTrailingIcon=_ref4.hasTrailingIcon,size=_ref4.size,isInsideCounterInput=_ref4.isInsideCounterInput;if(hasTrailingInteractionElement||hasSuffix||hasTrailingIcon){return theme.spacing[3];}if(isInsideCounterInput){return theme.spacing[baseInputCounterInputPaddingTokens.right[size]];}return theme.spacing[baseInputPaddingTokens.right[size]];};var getTopPadding=function getTopPadding(_ref5){var theme=_ref5.theme,size=_ref5.size,isInsideCounterInput=_ref5.isInsideCounterInput;if(isInsideCounterInput){return theme.spacing[baseInputCounterInputPaddingTokens.top[size]];}return theme.spacing[baseInputPaddingTokens.top[size]];};var getBottomPadding=function getBottomPadding(_ref6){var theme=_ref6.theme,size=_ref6.size,isInsideCounterInput=_ref6.isInsideCounterInput;if(isInsideCounterInput){return theme.spacing[baseInputCounterInputPaddingTokens.top[size]];}return theme.spacing[baseInputPaddingTokens.bottom[size]];};var getBaseInputStyles=function getBaseInputStyles(_ref7){var theme=_ref7.theme,isDisabled=_ref7.isDisabled,leadingIcon=_ref7.leadingIcon,prefix=_ref7.prefix,trailingInteractionElement=_ref7.trailingInteractionElement,leadingInteractionElement=_ref7.leadingInteractionElement,suffix=_ref7.suffix,trailingIcon=_ref7.trailingIcon,textAlign=_ref7.textAlign,isTextArea=_ref7.isTextArea,hasTags=_ref7.hasTags,isDropdownTrigger=_ref7.isDropdownTrigger,size=_ref7.size,padding=_ref7.padding,valueComponentType=_ref7.valueComponentType,_ref7$hasLeadingDropd=_ref7.hasLeadingDropdown,hasLeadingDropdown=_ref7$hasLeadingDropd===void 0?false:_ref7$hasLeadingDropd,color=_ref7.color,disabledColor=_ref7.disabledColor,isInsideCounterInput=_ref7.isInsideCounterInput;var _getInputVisualsToBeR=getInputVisualsToBeRendered({leadingIcon:leadingIcon,prefix:prefix,trailingInteractionElement:trailingInteractionElement,leadingInteractionElement:leadingInteractionElement,suffix:suffix,trailingIcon:trailingIcon,size:size}),hasLeadingIcon=_getInputVisualsToBeR.hasLeadingIcon,hasPrefix=_getInputVisualsToBeR.hasPrefix,hasTrailingInteractionElement=_getInputVisualsToBeR.hasTrailingInteractionElement,hasSuffix=_getInputVisualsToBeR.hasSuffix,hasTrailingIcon=_getInputVisualsToBeR.hasTrailingIcon;var isDropdownWithTags=isDropdownTrigger&&hasTags;var isReactNative=getPlatformType()==='react-native';var shouldHaveFlexibleHeight=isTextArea||isDropdownWithTags;return Object.assign({},valueComponentType==='heading'?getHeadingStyles({size:size==='xsmall'?'small':size,weight:'regular',color:isDisabled?'surface.text.gray.disabled':'interactive.text.gray.normal',theme:theme}):getTextStyles({size:isInsideCounterInput&&size==='xsmall'?'small':size,variant:'body',weight:isInsideCounterInput?'semibold':'regular',color:isDisabled?disabledColor!=null?disabledColor:'surface.text.gray.disabled':color!=null?color:'interactive.text.gray.normal',theme:theme}),{flex:1,backgroundColor:theme.colors.transparent,paddingTop:padding!=null?padding:makeSpace(getTopPadding({theme:theme,size:size,isInsideCounterInput:isInsideCounterInput})),paddingBottom:padding!=null?padding:makeSpace(getBottomPadding({theme:theme,size:size,isInsideCounterInput:isInsideCounterInput})),paddingLeft:padding!=null?padding:makeSpace(getLeftPadding({theme:theme,isDropdownTrigger:isDropdownTrigger,hasLeadingIcon:hasLeadingIcon,hasPrefix:hasPrefix,size:size,hasLeadingDropdown:hasLeadingDropdown,isInsideCounterInput:isInsideCounterInput})),paddingRight:padding!=null?padding:getRightPadding({theme:theme,hasTrailingInteractionElement:hasTrailingInteractionElement,hasSuffix:hasSuffix,hasTrailingIcon:hasTrailingIcon,size:size,isInsideCounterInput:isInsideCounterInput}),textAlign:textAlign,width:'100%',height:shouldHaveFlexibleHeight?undefined:makeSpace(baseInputHeight[size]),minHeight:shouldHaveFlexibleHeight?undefined:makeSpace(baseInputHeight[size])},isReactNative?{}:{resize:'none',boxSizing:'border-box'});};var getAnimatedBaseInputWrapperMaxHeight=function getAnimatedBaseInputWrapperMaxHeight(_ref8){var maxTagRows=_ref8.maxTagRows,showAllTags=_ref8.showAllTags,size=_ref8.size;if(maxTagRows==='single'){return baseInputHeight[size];}if(maxTagRows==='multiple'){return baseInputWrapperMaxHeight[size];}return showAllTags?baseInputWrapperMaxHeight[size]:baseInputHeight[size];};
|
|
18
18
|
|
|
19
19
|
export { getAnimatedBaseInputWrapperMaxHeight, getBaseInputState, getBaseInputStyles, getInputBackgroundAndBorderStyles };
|
|
20
20
|
//# sourceMappingURL=baseInputStyles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseInputStyles.js","sources":["../../../../../../src/components/Input/BaseInput/baseInputStyles.ts"],"sourcesContent":["import type { CSSObject } from 'styled-components';\nimport type { BaseInputProps } from './BaseInput';\nimport { getBaseInputBorderStyles } from './getBaseInputBorderStyles';\nimport {\n baseInputBackgroundColor,\n baseInputBorderColor,\n baseInputBorderRadius,\n baseInputBorderWidth,\n baseInputBorderlessBackgroundColor,\n baseInputCounterInputPaddingTokens,\n baseInputHeight,\n baseInputPaddingTokens,\n baseInputWrapperMaxHeight,\n} from './baseInputTokens';\nimport { getInputVisualsToBeRendered } from './BaseInputVisuals';\nimport type { BaseInputWrapperProps } from './types';\nimport { makeBorderSize } from '~utils/makeBorderSize';\nimport { getPlatformType } from '~utils';\nimport getIn from '~utils/lodashButBetter/get';\nimport type { Theme } from '~components/BladeProvider';\nimport getTextStyles from '~components/Typography/Text/getTextStyles';\nimport { makeSpace } from '~utils/makeSpace';\nimport getHeadingStyles from '~components/Typography/Heading/getHeadingStyles';\nimport type { BaseTextProps } from '~components/Typography/BaseText/types';\n\ntype GetInputStyles = Pick<\n BaseInputProps,\n | 'isDisabled'\n | 'validationState'\n | 'leadingIcon'\n | 'prefix'\n | 'trailingInteractionElement'\n | 'leadingInteractionElement'\n | 'suffix'\n | 'trailingIcon'\n | 'textAlign'\n | 'isDropdownTrigger'\n | 'valueComponentType'\n> & {\n isHovered?: boolean;\n isFocused?: boolean;\n isTextArea?: boolean;\n hasTags?: boolean;\n theme: Theme;\n size: NonNullable<BaseInputProps['size']>;\n padding?: BaseInputProps['padding'];\n borderRadius?: BaseInputProps['borderRadius'];\n isTableInputCell: NonNullable<BaseInputProps['isTableInputCell']>;\n hasLeadingDropdown?: boolean;\n color?: BaseTextProps['color'];\n disabledColor?: BaseTextProps['color'];\n isInsideCounterInput?: boolean;\n};\n\nexport const getBaseInputState = ({\n isFocused,\n isHovered,\n isDisabled,\n}: {\n isFocused?: boolean;\n isHovered?: boolean;\n isDisabled?: boolean;\n}): 'focused' | 'hovered' | 'disabled' | 'default' => {\n if (isDisabled) {\n return 'disabled';\n } else if (isFocused) {\n return 'focused';\n } else if (isHovered) {\n return 'hovered';\n } else {\n return 'default';\n }\n};\n\nexport const getInputBackgroundAndBorderStyles = ({\n theme,\n isHovered,\n isFocused,\n isDisabled,\n validationState,\n isTextArea,\n isDropdownTrigger,\n isTableInputCell,\n size = 'medium',\n borderRadius,\n}: Pick<\n GetInputStyles,\n | 'theme'\n | 'isFocused'\n | 'isDisabled'\n | 'validationState'\n | 'isHovered'\n | 'isTextArea'\n | 'isDropdownTrigger'\n | 'isTableInputCell'\n | 'size'\n | 'borderRadius'\n>): CSSObject => {\n // normal state\n const backgroundColorTokens = isTableInputCell\n ? baseInputBorderlessBackgroundColor\n : baseInputBackgroundColor;\n let backgroundColor = getIn(theme.colors, backgroundColorTokens.default);\n let borderColor = isTableInputCell\n ? theme.colors.transparent\n : getIn(theme.colors, baseInputBorderColor.default);\n let borderWidth = getIn(theme.border.width, baseInputBorderWidth.default);\n let zIndex: number | undefined;\n\n const baseInputState = getBaseInputState({ isFocused, isHovered, isDisabled });\n\n backgroundColor = getIn(theme.colors, backgroundColorTokens[baseInputState]);\n borderColor =\n isTableInputCell && baseInputState !== 'focused'\n ? theme.colors.transparent\n : getIn(theme.colors, baseInputBorderColor[baseInputState]);\n borderWidth = getIn(theme.border.width, baseInputBorderWidth[baseInputState]);\n\n if (!isTableInputCell && validationState && validationState !== 'none') {\n borderColor = getIn(theme.colors, baseInputBorderColor[validationState]);\n borderWidth = getIn(theme.border.width, baseInputBorderWidth[validationState]);\n zIndex = 1; // Prevent validation ring clipping by adjacent inputs in InputGroup\n } else if (validationState && validationState !== 'none') {\n backgroundColor = getIn(theme.colors, baseInputBorderlessBackgroundColor[validationState]);\n }\n return {\n backgroundColor,\n borderRadius: makeBorderSize(\n isTableInputCell\n ? theme.border.radius.none\n : theme.border.radius[borderRadius ?? baseInputBorderRadius[size]],\n ),\n borderStyle: 'solid',\n display: 'flex',\n flexDirection: 'row',\n width: '100%',\n alignItems: isTextArea ? 'flex-start' : 'center',\n position: 'relative',\n height: isDropdownTrigger && !isTextArea ? 'auto' : undefined,\n border: 'none',\n zIndex,\n ...getBaseInputBorderStyles({ theme, borderColor, borderWidth, isFocused }),\n };\n};\n\nconst getLeftPadding = ({\n theme,\n isDropdownTrigger,\n hasLeadingIcon,\n hasPrefix,\n size,\n hasLeadingDropdown,\n isInsideCounterInput,\n}: {\n theme: Theme;\n hasLeadingIcon: boolean;\n hasPrefix: boolean;\n isDropdownTrigger: GetInputStyles['isDropdownTrigger'];\n size: GetInputStyles['size'];\n hasLeadingDropdown: boolean;\n isInsideCounterInput?: boolean;\n}): number => {\n if (isDropdownTrigger) {\n return theme.spacing[0];\n }\n\n if (hasLeadingIcon || hasPrefix || hasLeadingDropdown) {\n return theme.spacing[3];\n }\n\n /**\n * CounterInput uses tighter padding (4px vs 8-12px) for compact design\n */\n if (isInsideCounterInput) {\n return theme.spacing[baseInputCounterInputPaddingTokens.left[size]];\n }\n\n return theme.spacing[baseInputPaddingTokens.left[size]];\n};\n\nconst getRightPadding = ({\n theme,\n hasTrailingInteractionElement,\n hasSuffix,\n hasTrailingIcon,\n size,\n isInsideCounterInput,\n}: {\n theme: Theme;\n hasTrailingInteractionElement: boolean;\n hasSuffix: boolean;\n hasTrailingIcon: boolean;\n size: GetInputStyles['size'];\n isInsideCounterInput?: boolean;\n}): number => {\n if (hasTrailingInteractionElement || hasSuffix || hasTrailingIcon) {\n return theme.spacing[3];\n }\n\n // CounterInput uses compact padding\n if (isInsideCounterInput) {\n return theme.spacing[baseInputCounterInputPaddingTokens.right[size]];\n }\n return theme.spacing[baseInputPaddingTokens.right[size]];\n};\n\nconst getTopPadding = ({\n theme,\n size,\n isInsideCounterInput,\n}: {\n theme: Theme;\n size: GetInputStyles['size'];\n isInsideCounterInput?: boolean;\n}): number => {\n // CounterInput uses compact padding\n if (isInsideCounterInput) {\n return theme.spacing[baseInputCounterInputPaddingTokens.top[size]];\n }\n return theme.spacing[baseInputPaddingTokens.top[size]];\n};\n\nconst getBottomPadding = ({\n theme,\n size,\n isInsideCounterInput,\n}: {\n theme: Theme;\n size: GetInputStyles['size'];\n isInsideCounterInput?: boolean;\n}): number => {\n // CounterInput uses compact padding\n if (isInsideCounterInput) {\n return theme.spacing[baseInputCounterInputPaddingTokens.top[size]];\n }\n return theme.spacing[baseInputPaddingTokens.bottom[size]];\n};\n\nexport const getBaseInputStyles = ({\n theme,\n isDisabled,\n leadingIcon,\n prefix,\n trailingInteractionElement,\n leadingInteractionElement,\n suffix,\n trailingIcon,\n textAlign,\n isTextArea,\n hasTags,\n isDropdownTrigger,\n size,\n padding,\n valueComponentType,\n hasLeadingDropdown = false,\n color,\n disabledColor,\n isInsideCounterInput,\n}: GetInputStyles): CSSObject => {\n const {\n hasLeadingIcon,\n hasPrefix,\n hasTrailingInteractionElement,\n hasSuffix,\n hasTrailingIcon,\n } = getInputVisualsToBeRendered({\n leadingIcon,\n prefix,\n trailingInteractionElement,\n leadingInteractionElement,\n suffix,\n trailingIcon,\n size,\n });\n\n const isDropdownWithTags = isDropdownTrigger && hasTags;\n const isReactNative = getPlatformType() === 'react-native';\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n const shouldHaveFlexibleHeight = isTextArea || isDropdownWithTags;\n\n return {\n ...(valueComponentType === 'heading'\n ? getHeadingStyles({\n size: size === 'xsmall' ? 'small' : size,\n weight: 'regular',\n color: isDisabled ? 'surface.text.gray.disabled' : 'interactive.text.gray.normal',\n theme,\n })\n : getTextStyles({\n /**\n * CounterInput: uses 'small' size for xsmall and 'semibold' weight for prominence\n */\n size: isInsideCounterInput && size === 'xsmall' ? 'small' : size,\n variant: 'body',\n weight: isInsideCounterInput ? 'semibold' : 'regular',\n color: isDisabled\n ? disabledColor ?? 'surface.text.gray.disabled'\n : color ?? 'interactive.text.gray.normal',\n theme,\n })),\n\n // take the full available width of parent container for input field\n flex: 1,\n backgroundColor: theme.colors.transparent,\n\n paddingTop: padding ?? makeSpace(getTopPadding({ theme, size, isInsideCounterInput })),\n paddingBottom: padding ?? makeSpace(getBottomPadding({ theme, size, isInsideCounterInput })),\n paddingLeft:\n padding ??\n makeSpace(\n getLeftPadding({\n theme,\n isDropdownTrigger,\n hasLeadingIcon,\n hasPrefix,\n size,\n hasLeadingDropdown,\n isInsideCounterInput,\n }),\n ),\n paddingRight:\n padding ??\n getRightPadding({\n theme,\n hasTrailingInteractionElement,\n hasSuffix,\n hasTrailingIcon,\n size,\n isInsideCounterInput,\n }),\n\n textAlign,\n width: '100%',\n height: shouldHaveFlexibleHeight ? undefined : makeSpace(baseInputHeight[size]),\n minHeight: shouldHaveFlexibleHeight ? undefined : makeSpace(baseInputHeight[size]),\n ...(isReactNative ? {} : { resize: 'none', boxSizing: 'border-box' }),\n };\n};\n\nexport const getAnimatedBaseInputWrapperMaxHeight = ({\n maxTagRows,\n showAllTags,\n size,\n}: Pick<BaseInputWrapperProps, 'maxTagRows' | 'showAllTags' | 'size'>): number => {\n if (maxTagRows === 'single') {\n return baseInputHeight[size];\n }\n\n if (maxTagRows === 'multiple') {\n return baseInputWrapperMaxHeight[size];\n }\n\n // In expandable, max-height depends on the state\n return showAllTags ? baseInputWrapperMaxHeight[size] : baseInputHeight[size];\n};\n"],"names":["getBaseInputState","_ref","isFocused","isHovered","isDisabled","getInputBackgroundAndBorderStyles","_ref2","theme","validationState","isTextArea","isDropdownTrigger","isTableInputCell","_ref2$size","size","borderRadius","backgroundColorTokens","baseInputBorderlessBackgroundColor","baseInputBackgroundColor","backgroundColor","getIn","colors","default","borderColor","transparent","baseInputBorderColor","borderWidth","border","width","baseInputBorderWidth","zIndex","baseInputState","Object","assign","makeBorderSize","radius","none","baseInputBorderRadius","borderStyle","display","flexDirection","alignItems","position","height","undefined","getBaseInputBorderStyles","getLeftPadding","_ref3","hasLeadingIcon","hasPrefix","hasLeadingDropdown","isInsideCounterInput","spacing","baseInputCounterInputPaddingTokens","left","baseInputPaddingTokens","getRightPadding","_ref4","hasTrailingInteractionElement","hasSuffix","hasTrailingIcon","right","getTopPadding","_ref5","top","getBottomPadding","_ref6","bottom","getBaseInputStyles","_ref7","leadingIcon","prefix","trailingInteractionElement","leadingInteractionElement","suffix","trailingIcon","textAlign","hasTags","padding","valueComponentType","_ref7$hasLeadingDropd","color","disabledColor","_getInputVisualsToBeR","getInputVisualsToBeRendered","isDropdownWithTags","isReactNative","getPlatformType","shouldHaveFlexibleHeight","getHeadingStyles","weight","getTextStyles","variant","flex","paddingTop","makeSpace","paddingBottom","paddingLeft","paddingRight","baseInputHeight","minHeight","resize","boxSizing","getAnimatedBaseInputWrapperMaxHeight","_ref8","maxTagRows","showAllTags","baseInputWrapperMaxHeight"],"mappings":";;;;;;;;;;;;;;;;AAsDa,IAAAA,iBAAiB,CAAG,SAApBA,iBAAiBA,CAAAC,IAAA,CAQwB,CAAA,IAPpDC,SAAS,CAAAD,IAAA,CAATC,SAAS,CACTC,SAAS,CAAAF,IAAA,CAATE,SAAS,CACTC,UAAU,CAAAH,IAAA,CAAVG,UAAU,CAMV,GAAIA,UAAU,CAAE,CACd,OAAO,UAAU,CACnB,CAAC,KAAM,GAAIF,SAAS,CAAE,CACpB,OAAO,SAAS,CAClB,CAAC,QAAUC,SAAS,CAAE,CACpB,OAAO,SAAS,CAClB,CAAC,KAAM,CACL,OAAO,SAAS,CAClB,CACF,EAEa,IAAAE,iCAAiC,CAAG,SAApCA,iCAAiCA,CAAAC,KAAA,CAuB7B,CAAA,IAtBfC,KAAK,CAAAD,KAAA,CAALC,KAAK,CACLJ,SAAS,CAAAG,KAAA,CAATH,SAAS,CACTD,SAAS,CAAAI,KAAA,CAATJ,SAAS,CACTE,UAAU,CAAAE,KAAA,CAAVF,UAAU,CACVI,eAAe,CAAAF,KAAA,CAAfE,eAAe,CACfC,UAAU,CAAAH,KAAA,CAAVG,UAAU,CACVC,iBAAiB,CAAAJ,KAAA,CAAjBI,iBAAiB,CACjBC,gBAAgB,CAAAL,KAAA,CAAhBK,gBAAgB,CAAAC,UAAA,CAAAN,KAAA,CACh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put/baseInputStyles.ts"],"sourcesContent":["import type { CSSObject } from 'styled-components';\nimport type { BaseInputProps } from './BaseInput';\nimport { getBaseInputBorderStyles } from './getBaseInputBorderStyles';\nimport {\n baseInputBackgroundColor,\n baseInputBorderColor,\n baseInputBorderRadius,\n baseInputBorderWidth,\n baseInputBorderlessBackgroundColor,\n baseInputCounterInputPaddingTokens,\n baseInputHeight,\n baseInputPaddingTokens,\n baseInputWrapperMaxHeight,\n} from './baseInputTokens';\nimport { getInputVisualsToBeRendered } from './BaseInputVisuals';\nimport type { BaseInputWrapperProps } from './types';\nimport { makeBorderSize } from '~utils/makeBorderSize';\nimport { getPlatformType } from '~utils';\nimport getIn from '~utils/lodashButBetter/get';\nimport type { Theme } from '~components/BladeProvider';\nimport getTextStyles from '~components/Typography/Text/getTextStyles';\nimport { makeSpace } from '~utils/makeSpace';\nimport getHeadingStyles from '~components/Typography/Heading/getHeadingStyles';\nimport type { BaseTextProps } from '~components/Typography/BaseText/types';\n\ntype GetInputStyles = Pick<\n BaseInputProps,\n | 'isDisabled'\n | 'validationState'\n | 'leadingIcon'\n | 'prefix'\n | 'trailingInteractionElement'\n | 'leadingInteractionElement'\n | 'suffix'\n | 'trailingIcon'\n | 'textAlign'\n | 'isDropdownTrigger'\n | 'valueComponentType'\n> & {\n isHovered?: boolean;\n isFocused?: boolean;\n isTextArea?: boolean;\n hasTags?: boolean;\n theme: Theme;\n size: NonNullable<BaseInputProps['size']>;\n padding?: BaseInputProps['padding'];\n borderRadius?: BaseInputProps['borderRadius'];\n isTableInputCell: NonNullable<BaseInputProps['isTableInputCell']>;\n hasLeadingDropdown?: boolean;\n color?: BaseTextProps['color'];\n disabledColor?: BaseTextProps['color'];\n isInsideCounterInput?: boolean;\n};\n\nexport const getBaseInputState = ({\n isFocused,\n isHovered,\n isDisabled,\n}: {\n isFocused?: boolean;\n isHovered?: boolean;\n isDisabled?: boolean;\n}): 'focused' | 'hovered' | 'disabled' | 'default' => {\n if (isDisabled) {\n return 'disabled';\n } else if (isFocused) {\n return 'focused';\n } else if (isHovered) {\n return 'hovered';\n } else {\n return 'default';\n }\n};\n\nexport const getInputBackgroundAndBorderStyles = ({\n theme,\n isHovered,\n isFocused,\n isDisabled,\n validationState,\n isTextArea,\n isDropdownTrigger,\n isTableInputCell,\n size = 'medium',\n borderRadius,\n}: Pick<\n GetInputStyles,\n | 'theme'\n | 'isFocused'\n | 'isDisabled'\n | 'validationState'\n | 'isHovered'\n | 'isTextArea'\n | 'isDropdownTrigger'\n | 'isTableInputCell'\n | 'size'\n | 'borderRadius'\n>): CSSObject => {\n // normal state\n const backgroundColorTokens = isTableInputCell\n ? baseInputBorderlessBackgroundColor\n : baseInputBackgroundColor;\n let backgroundColor = getIn(theme.colors, backgroundColorTokens.default);\n let borderColor = isTableInputCell\n ? theme.colors.transparent\n : getIn(theme.colors, baseInputBorderColor.default);\n let borderWidth = getIn(theme.border.width, baseInputBorderWidth.default);\n let zIndex: number | undefined;\n\n const baseInputState = getBaseInputState({ isFocused, isHovered, isDisabled });\n\n backgroundColor = getIn(theme.colors, backgroundColorTokens[baseInputState]);\n borderColor =\n isTableInputCell && baseInputState !== 'focused'\n ? theme.colors.transparent\n : getIn(theme.colors, baseInputBorderColor[baseInputState]);\n borderWidth = getIn(theme.border.width, baseInputBorderWidth[baseInputState]);\n\n if (!isTableInputCell && validationState && validationState !== 'none') {\n borderColor = getIn(theme.colors, baseInputBorderColor[validationState]);\n borderWidth = getIn(theme.border.width, baseInputBorderWidth[validationState]);\n zIndex = 1; // Prevent validation ring clipping by adjacent inputs in InputGroup\n } else if (validationState && validationState !== 'none') {\n backgroundColor = getIn(theme.colors, baseInputBorderlessBackgroundColor[validationState]);\n }\n return {\n backgroundColor,\n borderRadius: makeBorderSize(\n isTableInputCell\n ? theme.border.radius.none\n : theme.border.radius[borderRadius ?? baseInputBorderRadius[size]],\n ),\n overflow: 'hidden',\n borderStyle: 'solid',\n display: 'flex',\n flexDirection: 'row',\n width: '100%',\n alignItems: isTextArea ? 'flex-start' : 'center',\n position: 'relative',\n height: isDropdownTrigger && !isTextArea ? 'auto' : undefined,\n border: 'none',\n zIndex,\n ...getBaseInputBorderStyles({ theme, borderColor, borderWidth, isFocused }),\n };\n};\n\nconst getLeftPadding = ({\n theme,\n isDropdownTrigger,\n hasLeadingIcon,\n hasPrefix,\n size,\n hasLeadingDropdown,\n isInsideCounterInput,\n}: {\n theme: Theme;\n hasLeadingIcon: boolean;\n hasPrefix: boolean;\n isDropdownTrigger: GetInputStyles['isDropdownTrigger'];\n size: GetInputStyles['size'];\n hasLeadingDropdown: boolean;\n isInsideCounterInput?: boolean;\n}): number => {\n if (isDropdownTrigger) {\n return theme.spacing[0];\n }\n\n if (hasLeadingIcon || hasPrefix || hasLeadingDropdown) {\n return theme.spacing[3];\n }\n\n /**\n * CounterInput uses tighter padding (4px vs 8-12px) for compact design\n */\n if (isInsideCounterInput) {\n return theme.spacing[baseInputCounterInputPaddingTokens.left[size]];\n }\n\n return theme.spacing[baseInputPaddingTokens.left[size]];\n};\n\nconst getRightPadding = ({\n theme,\n hasTrailingInteractionElement,\n hasSuffix,\n hasTrailingIcon,\n size,\n isInsideCounterInput,\n}: {\n theme: Theme;\n hasTrailingInteractionElement: boolean;\n hasSuffix: boolean;\n hasTrailingIcon: boolean;\n size: GetInputStyles['size'];\n isInsideCounterInput?: boolean;\n}): number => {\n if (hasTrailingInteractionElement || hasSuffix || hasTrailingIcon) {\n return theme.spacing[3];\n }\n\n // CounterInput uses compact padding\n if (isInsideCounterInput) {\n return theme.spacing[baseInputCounterInputPaddingTokens.right[size]];\n }\n return theme.spacing[baseInputPaddingTokens.right[size]];\n};\n\nconst getTopPadding = ({\n theme,\n size,\n isInsideCounterInput,\n}: {\n theme: Theme;\n size: GetInputStyles['size'];\n isInsideCounterInput?: boolean;\n}): number => {\n // CounterInput uses compact padding\n if (isInsideCounterInput) {\n return theme.spacing[baseInputCounterInputPaddingTokens.top[size]];\n }\n return theme.spacing[baseInputPaddingTokens.top[size]];\n};\n\nconst getBottomPadding = ({\n theme,\n size,\n isInsideCounterInput,\n}: {\n theme: Theme;\n size: GetInputStyles['size'];\n isInsideCounterInput?: boolean;\n}): number => {\n // CounterInput uses compact padding\n if (isInsideCounterInput) {\n return theme.spacing[baseInputCounterInputPaddingTokens.top[size]];\n }\n return theme.spacing[baseInputPaddingTokens.bottom[size]];\n};\n\nexport const getBaseInputStyles = ({\n theme,\n isDisabled,\n leadingIcon,\n prefix,\n trailingInteractionElement,\n leadingInteractionElement,\n suffix,\n trailingIcon,\n textAlign,\n isTextArea,\n hasTags,\n isDropdownTrigger,\n size,\n padding,\n valueComponentType,\n hasLeadingDropdown = false,\n color,\n disabledColor,\n isInsideCounterInput,\n}: GetInputStyles): CSSObject => {\n const {\n hasLeadingIcon,\n hasPrefix,\n hasTrailingInteractionElement,\n hasSuffix,\n hasTrailingIcon,\n } = getInputVisualsToBeRendered({\n leadingIcon,\n prefix,\n trailingInteractionElement,\n leadingInteractionElement,\n suffix,\n trailingIcon,\n size,\n });\n\n const isDropdownWithTags = isDropdownTrigger && hasTags;\n const isReactNative = getPlatformType() === 'react-native';\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n const shouldHaveFlexibleHeight = isTextArea || isDropdownWithTags;\n\n return {\n ...(valueComponentType === 'heading'\n ? getHeadingStyles({\n size: size === 'xsmall' ? 'small' : size,\n weight: 'regular',\n color: isDisabled ? 'surface.text.gray.disabled' : 'interactive.text.gray.normal',\n theme,\n })\n : getTextStyles({\n /**\n * CounterInput: uses 'small' size for xsmall and 'semibold' weight for prominence\n */\n size: isInsideCounterInput && size === 'xsmall' ? 'small' : size,\n variant: 'body',\n weight: isInsideCounterInput ? 'semibold' : 'regular',\n color: isDisabled\n ? disabledColor ?? 'surface.text.gray.disabled'\n : color ?? 'interactive.text.gray.normal',\n theme,\n })),\n\n // take the full available width of parent container for input field\n flex: 1,\n backgroundColor: theme.colors.transparent,\n\n paddingTop: padding ?? makeSpace(getTopPadding({ theme, size, isInsideCounterInput })),\n paddingBottom: padding ?? makeSpace(getBottomPadding({ theme, size, isInsideCounterInput })),\n paddingLeft:\n padding ??\n makeSpace(\n getLeftPadding({\n theme,\n isDropdownTrigger,\n hasLeadingIcon,\n hasPrefix,\n size,\n hasLeadingDropdown,\n isInsideCounterInput,\n }),\n ),\n paddingRight:\n padding ??\n getRightPadding({\n theme,\n hasTrailingInteractionElement,\n hasSuffix,\n hasTrailingIcon,\n size,\n isInsideCounterInput,\n }),\n\n textAlign,\n width: '100%',\n height: shouldHaveFlexibleHeight ? undefined : makeSpace(baseInputHeight[size]),\n minHeight: shouldHaveFlexibleHeight ? undefined : makeSpace(baseInputHeight[size]),\n ...(isReactNative ? {} : { resize: 'none', boxSizing: 'border-box' }),\n };\n};\n\nexport const getAnimatedBaseInputWrapperMaxHeight = ({\n maxTagRows,\n showAllTags,\n size,\n}: Pick<BaseInputWrapperProps, 'maxTagRows' | 'showAllTags' | 'size'>): number => {\n if (maxTagRows === 'single') {\n return baseInputHeight[size];\n }\n\n if (maxTagRows === 'multiple') {\n return baseInputWrapperMaxHeight[size];\n }\n\n // In expandable, max-height depends on the state\n return showAllTags ? baseInputWrapperMaxHeight[size] : baseInputHeight[size];\n};\n"],"names":["getBaseInputState","_ref","isFocused","isHovered","isDisabled","getInputBackgroundAndBorderStyles","_ref2","theme","validationState","isTextArea","isDropdownTrigger","isTableInputCell","_ref2$size","size","borderRadius","backgroundColorTokens","baseInputBorderlessBackgroundColor","baseInputBackgroundColor","backgroundColor","getIn","colors","default","borderColor","transparent","baseInputBorderColor","borderWidth","border","width","baseInputBorderWidth","zIndex","baseInputState","Object","assign","makeBorderSize","radius","none","baseInputBorderRadius","overflow","borderStyle","display","flexDirection","alignItems","position","height","undefined","getBaseInputBorderStyles","getLeftPadding","_ref3","hasLeadingIcon","hasPrefix","hasLeadingDropdown","isInsideCounterInput","spacing","baseInputCounterInputPaddingTokens","left","baseInputPaddingTokens","getRightPadding","_ref4","hasTrailingInteractionElement","hasSuffix","hasTrailingIcon","right","getTopPadding","_ref5","top","getBottomPadding","_ref6","bottom","getBaseInputStyles","_ref7","leadingIcon","prefix","trailingInteractionElement","leadingInteractionElement","suffix","trailingIcon","textAlign","hasTags","padding","valueComponentType","_ref7$hasLeadingDropd","color","disabledColor","_getInputVisualsToBeR","getInputVisualsToBeRendered","isDropdownWithTags","isReactNative","getPlatformType","shouldHaveFlexibleHeight","getHeadingStyles","weight","getTextStyles","variant","flex","paddingTop","makeSpace","paddingBottom","paddingLeft","paddingRight","baseInputHeight","minHeight","resize","boxSizing","getAnimatedBaseInputWrapperMaxHeight","_ref8","maxTagRows","showAllTags","baseInputWrapperMaxHeight"],"mappings":";;;;;;;;;;;;;;;;AAsDa,IAAAA,iBAAiB,CAAG,SAApBA,iBAAiBA,CAAAC,IAAA,CAQwB,CAAA,IAPpDC,SAAS,CAAAD,IAAA,CAATC,SAAS,CACTC,SAAS,CAAAF,IAAA,CAATE,SAAS,CACTC,UAAU,CAAAH,IAAA,CAAVG,UAAU,CAMV,GAAIA,UAAU,CAAE,CACd,OAAO,UAAU,CACnB,CAAC,KAAM,GAAIF,SAAS,CAAE,CACpB,OAAO,SAAS,CAClB,CAAC,QAAUC,SAAS,CAAE,CACpB,OAAO,SAAS,CAClB,CAAC,KAAM,CACL,OAAO,SAAS,CAClB,CACF,EAEa,IAAAE,iCAAiC,CAAG,SAApCA,iCAAiCA,CAAAC,KAAA,CAuB7B,CAAA,IAtBfC,KAAK,CAAAD,KAAA,CAALC,KAAK,CACLJ,SAAS,CAAAG,KAAA,CAATH,SAAS,CACTD,SAAS,CAAAI,KAAA,CAATJ,SAAS,CACTE,UAAU,CAAAE,KAAA,CAAVF,UAAU,CACVI,eAAe,CAAAF,KAAA,CAAfE,eAAe,CACfC,UAAU,CAAAH,KAAA,CAAVG,UAAU,CACVC,iBAAiB,CAAAJ,KAAA,CAAjBI,iBAAiB,CACjBC,gBAAgB,CAAAL,KAAA,CAAhBK,gBAAgB,CAA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;;"}
|
|
@@ -28,7 +28,7 @@ import { makeAnalyticsAttribute } from '../../utils/makeAnalyticsAttribute/makeA
|
|
|
28
28
|
import { BaseBox } from '../Box/BaseBox/BaseBox.web.js';
|
|
29
29
|
import { assignWithoutSideEffects } from '../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
|
|
30
30
|
|
|
31
|
-
var _excluded = ["children", "backgroundColor", "borderRadius", "elevation", "testID", "padding", "width", "height", "minHeight", "minWidth", "maxWidth", "onClick", "isSelected", "accessibilityLabel", "shouldScaleOnHover", "onHover", "href", "target", "rel", "as", "size", "cursor", "opacity", "transition", "flexShrink"],
|
|
31
|
+
var _excluded = ["children", "backgroundColor", "borderRadius", "elevation", "testID", "padding", "width", "height", "minHeight", "minWidth", "maxWidth", "onClick", "isSelected", "accessibilityLabel", "shouldScaleOnHover", "onHover", "href", "target", "rel", "as", "size", "cursor", "opacity", "transition", "flexShrink", "overflow", "overflowX", "overflowY"],
|
|
32
32
|
_excluded2 = ["height", "children", "testID"];
|
|
33
33
|
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; }
|
|
34
34
|
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; }
|
|
@@ -80,6 +80,9 @@ var _Card = function _Card(_ref, ref) {
|
|
|
80
80
|
opacity = _ref.opacity,
|
|
81
81
|
transition = _ref.transition,
|
|
82
82
|
flexShrink = _ref.flexShrink,
|
|
83
|
+
overflow = _ref.overflow,
|
|
84
|
+
overflowX = _ref.overflowX,
|
|
85
|
+
overflowY = _ref.overflowY,
|
|
83
86
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
84
87
|
var _React$useState = React__default.useState(false),
|
|
85
88
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -154,6 +157,10 @@ var _Card = function _Card(_ref, ref) {
|
|
|
154
157
|
backgroundColor: "surface.background.gray.intense",
|
|
155
158
|
colorScheme: colorScheme,
|
|
156
159
|
isSelected: isSelected,
|
|
160
|
+
elevation: elevation,
|
|
161
|
+
overflow: overflow,
|
|
162
|
+
overflowX: overflowX,
|
|
163
|
+
overflowY: overflowY,
|
|
157
164
|
children: [href ? /*#__PURE__*/jsx(LinkOverlay, _objectSpread({
|
|
158
165
|
onClick: onClick,
|
|
159
166
|
href: href,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.js","sources":["../../../../../../src/components/Card/Card.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\nimport 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, useTheme } 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 * @deprecated The `backgroundColor` prop is deprecated and is a no-op. The Card always uses `surface.background.gray.intense`. This prop will be removed in a future major version.\n */\n backgroundColor?: CardSurfaceBackgroundColors;\n /**\n * Sets the border radius of the Card\n *\n * @default `medium`\n *\n * @deprecated The `borderRadius` prop is deprecated and is a no-op. The Card always uses `medium` borderRadius. This prop will be removed in a future major version.\n */\n borderRadius?: Extract<BoxProps['borderRadius'], 'medium' | 'large' | 'xlarge'>;\n /**\n * Sets the elevation for Cards\n *\n * **Links:**\n * - Docs: https://blade.razorpay.com/?path=/docs/tokens-elevation--docs\n *\n * @deprecated The `elevation` prop is deprecated and is a no-op. The Card always uses a custom elevation. This prop will be removed in a future major version.\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 opacity?: BoxProps['opacity'];\n transition?: BoxProps['transition'];\n flexShrink?: BoxProps['flexShrink'];\n} & TestID &\n DataAnalyticsAttribute &\n StyledPropsBlade;\n\nconst _Card: React.ForwardRefRenderFunction<BladeElementRef, CardProps> = (\n {\n children,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n backgroundColor,\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 opacity,\n transition,\n flexShrink,\n ...rest\n },\n ref,\n): React.ReactElement => {\n const [isFocused, setIsFocused] = React.useState(false);\n const { colorScheme } = useTheme();\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=\"medium\"\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 opacity={opacity}\n transition={transition}\n flexShrink={flexShrink}\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=\"medium\"\n textAlign={'left' as never}\n backgroundColor=\"surface.background.gray.intense\"\n colorScheme={colorScheme}\n isSelected={isSelected}\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","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","opacity","transition","flexShrink","rest","_objectWithoutProperties","_excluded","_React$useState","React","useState","_React$useState2","_slicedToArray","isFocused","setIsFocused","_useTheme","useTheme","colorScheme","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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BO,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,EAA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AxC,aAAA,CAAAA,aAAA,CAAAA,aAAA,CACFC,EAAAA,EAAAA,aAAa,CAAC;IAAEC,IAAI,EAAE0B,aAAa,CAACvF,QAAQ;AAAEiB,IAAAA,MAAM,EAANA,MAAAA;AAAO,GAAC,CAAC,CAAA,EACvDyE,sBAAsB,CAAChD,IAAI,CAAC,CAAA,EAAA,EAAA,EAAA;AAChCrB,IAAAA,MAAM,EAAEA,MAAO;AAAAV,IAAAA,QAAA,EAEdA,QAAAA;AAAQ,GAAA,CACF,CAAC,CAAA;AAEd,CAAC,CAAA;AAED,IAAM6E,IAAI,gBAAG1C,cAAK,CAACsD,UAAU,CAAC5F,KAAK,EAAC;AACpC,IAAMR,QAAQ,gBAAGqG,wBAAwB,CAACN,SAAS,EAAE;EAAEO,WAAW,EAAE7G,YAAY,CAACO,QAAAA;AAAS,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"Card.js","sources":["../../../../../../src/components/Card/Card.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\nimport 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, useTheme } 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 * @deprecated The `backgroundColor` prop is deprecated and is a no-op. The Card always uses `surface.background.gray.intense`. This prop will be removed in a future major version.\n */\n backgroundColor?: CardSurfaceBackgroundColors;\n /**\n * Sets the border radius of the Card\n *\n * @default `medium`\n *\n * @deprecated The `borderRadius` prop is deprecated and is a no-op. The Card always uses `medium` borderRadius. This prop will be removed in a future major version.\n */\n borderRadius?: Extract<BoxProps['borderRadius'], 'medium' | 'large' | 'xlarge'>;\n /**\n * Sets the elevation for Cards\n *\n * **Links:**\n * - Docs: https://blade.razorpay.com/?path=/docs/tokens-elevation--docs\n *\n * @deprecated The `elevation` prop is deprecated and is a no-op. The Card always uses a custom elevation. This prop will be removed in a future major version.\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 opacity?: BoxProps['opacity'];\n transition?: BoxProps['transition'];\n flexShrink?: BoxProps['flexShrink'];\n /**\n * Sets the overflow behavior of the card content\n */\n overflow?: BoxProps['overflow'];\n /**\n * Sets the horizontal overflow behavior of the card content\n */\n overflowX?: BoxProps['overflowX'];\n /**\n * Sets the vertical overflow behavior of the card content\n */\n overflowY?: BoxProps['overflowY'];\n} & TestID &\n DataAnalyticsAttribute &\n StyledPropsBlade;\n\nconst _Card: React.ForwardRefRenderFunction<BladeElementRef, CardProps> = (\n {\n children,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n backgroundColor,\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 opacity,\n transition,\n flexShrink,\n overflow,\n overflowX,\n overflowY,\n ...rest\n },\n ref,\n): React.ReactElement => {\n const [isFocused, setIsFocused] = React.useState(false);\n const { colorScheme } = useTheme();\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=\"medium\"\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 opacity={opacity}\n transition={transition}\n flexShrink={flexShrink}\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=\"medium\"\n textAlign={'left' as never}\n backgroundColor=\"surface.background.gray.intense\"\n colorScheme={colorScheme}\n isSelected={isSelected}\n elevation={elevation}\n overflow={overflow}\n overflowX={overflowX}\n overflowY={overflowY}\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","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","opacity","transition","flexShrink","overflow","overflowX","overflowY","rest","_objectWithoutProperties","_excluded","_React$useState","React","useState","_React$useState2","_slicedToArray","isFocused","setIsFocused","_useTheme","useTheme","colorScheme","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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BO,IAAMA,YAAY,GAAG;AAC1BC,EAAAA,UAAU,EAAE,YAAY;AACxBC,EAAAA,kBAAkB,EAAE,oBAAoB;A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V,UAAAA,OAAO,EAAEA,OAAAA;AAAQ,SAAA,EAAKoC,gBAAgB,CAAG,CAAC,GACjE,IAAI,EACPlD,QAAQ,CAAA;OACE,CAAA;KACL,CAAA,CAAA;AAAC,GACC,CAAC,CAAA;AAEnB,CAAC,CAAA;AAQD,IAAMuF,SAAS,GAAG,SAAZA,SAASA,CAAAC,KAAA,EAAiF;AAAA,EAAA,IAA3E9E,MAAM,GAAA8E,KAAA,CAAN9E,MAAM;IAAEV,QAAQ,GAAAwF,KAAA,CAARxF,QAAQ;IAAEM,MAAM,GAAAkF,KAAA,CAANlF,MAAM;AAAK4B,IAAAA,IAAI,GAAAC,wBAAA,CAAAqD,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,CAAC1F,QAAQ;AAAEiB,IAAAA,MAAM,EAANA,MAAAA;AAAO,GAAC,CAAC,CAAA,EACvD4E,sBAAsB,CAAChD,IAAI,CAAC,CAAA,EAAA,EAAA,EAAA;AAChCxB,IAAAA,MAAM,EAAEA,MAAO;AAAAV,IAAAA,QAAA,EAEdA,QAAAA;AAAQ,GAAA,CACF,CAAC,CAAA;AAEd,CAAC,CAAA;AAED,IAAMgF,IAAI,gBAAG1C,cAAK,CAACsD,UAAU,CAAC/F,KAAK,EAAC;AACpC,IAAMR,QAAQ,gBAAGwG,wBAAwB,CAACN,SAAS,EAAE;EAAEO,WAAW,EAAEhH,YAAY,CAACO,QAAAA;AAAS,CAAC;;;;"}
|
|
@@ -137,7 +137,6 @@ var _DropdownOverlay = function _DropdownOverlay(_ref) {
|
|
|
137
137
|
children: /*#__PURE__*/jsx(StyledDropdownOverlay, _objectSpread(_objectSpread(_objectSpread({
|
|
138
138
|
isInBottomSheet: bottomSheetAndDropdownGlue === null || bottomSheetAndDropdownGlue === void 0 ? void 0 : bottomSheetAndDropdownGlue.dropdownHasBottomSheet,
|
|
139
139
|
colorScheme: colorScheme,
|
|
140
|
-
elevation: bottomSheetAndDropdownGlue !== null && bottomSheetAndDropdownGlue !== void 0 && bottomSheetAndDropdownGlue.dropdownHasBottomSheet ? undefined : 'midRaised',
|
|
141
140
|
style: _objectSpread({}, styles),
|
|
142
141
|
width: width ? width : '100%',
|
|
143
142
|
minWidth: minWidth,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownOverlay.web.js","sources":["../../../../../../src/components/Dropdown/DropdownOverlay.web.tsx"],"sourcesContent":["import React from 'react';\nimport {\n autoUpdate,\n offset,\n size as sizeMiddleware,\n useFloating,\n useTransitionStyles,\n flip,\n FloatingPortal,\n useDismiss,\n useInteractions,\n} from '@floating-ui/react';\nimport { useDropdown } from './useDropdown';\nimport { StyledDropdownOverlay } from './StyledDropdownOverlay';\nimport type { DropdownOverlayProps } from './types';\nimport { dropdownComponentIds } from './dropdownComponentIds';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { makeSize } from '~utils';\nimport { size } from '~tokens/global';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\nimport { useTheme } from '~components/BladeProvider';\nimport { TopNavOverlayThemeOverride } from '~components/TopNav/TopNavOverlayThemeOverride';\n// Reading directly because its not possible to get theme object on top level to be used in keyframes\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { useBottomSheetAndDropdownGlue } from '~components/BottomSheet/BottomSheetContext';\nimport BaseBox from '~components/Box/BaseBox';\nimport { componentZIndices } from '~utils/componentZIndices';\nimport { OVERLAY_OFFSET, OVERLAY_TRANSITION_OFFSET } from '~components/BaseMenu/tokens';\nimport { OverlayContextReset } from '~components/OverlayContextReset';\n\nconst OVERLAY_PADDING: number = size['12']; // doesn't have to be exact. Just rough padding for floating ui to decide to show overlay on top or bottom\n\n/**\n * Overlay of dropdown\n *\n * Wrap your ActionList within this component\n */\nconst _DropdownOverlay = ({\n children,\n testID,\n zIndex = componentZIndices.dropdownOverlay,\n width,\n minWidth,\n maxWidth,\n referenceRef,\n defaultPlacement = 'bottom-start',\n _isNestedDropdown = false,\n ...dataAnalyticsProps\n}: DropdownOverlayProps): React.ReactElement | null => {\n const { isOpen, triggererRef, triggererWrapperRef, dropdownTriggerer, setIsOpen } = useDropdown();\n const { theme, colorScheme } = useTheme();\n const bottomSheetAndDropdownGlue = useBottomSheetAndDropdownGlue();\n\n const isMenu =\n (dropdownTriggerer !== dropdownComponentIds.triggers.SelectInput &&\n dropdownTriggerer !== dropdownComponentIds.triggers.SearchInput &&\n dropdownTriggerer !== dropdownComponentIds.triggers.AutoComplete &&\n referenceRef == undefined) ||\n _isNestedDropdown;\n\n const { refs, floatingStyles, context } = useFloating({\n open: isOpen,\n onOpenChange: setIsOpen,\n strategy: 'fixed',\n placement: defaultPlacement,\n elements: {\n // Input triggers have their ref on internal input element but we want width height of overall visible input hence wrapperRef is needed\n // We fallback to use `triggererRef` for triggers like button and link where wrapper is not needed\n // Checkout: https://github.com/razorpay/blade/pull/1559#discussion_r1305438920\n reference: (referenceRef?.current ??\n triggererWrapperRef.current ??\n triggererRef.current) as Element,\n },\n middleware: [\n offset({\n mainAxis: OVERLAY_OFFSET,\n }),\n flip({\n // eslint-disable-next-line @typescript-eslint/restrict-plus-operands\n padding: OVERLAY_OFFSET + OVERLAY_PADDING,\n }),\n sizeMiddleware({\n apply({ rects, elements }) {\n const overlayWidth = isMenu ? undefined : makeSize(rects.reference.width);\n const overlayMinWidth = isMenu ? makeSize(size['240']) : undefined;\n const overlayMaxWidth = isMenu ? makeSize(size['400']) : undefined;\n\n Object.assign(elements.floating.style, {\n // in menu, we have flexible width between min and max\n // in input triggers, we just take width of trigger\n width: width ?? overlayWidth,\n minWidth: minWidth ?? overlayMinWidth,\n maxWidth: maxWidth ?? overlayMaxWidth,\n });\n },\n }),\n ],\n whileElementsMounted: autoUpdate,\n });\n\n const dismiss = useDismiss(context);\n const { getFloatingProps } = useInteractions([dismiss]);\n\n const { isMounted, styles } = useTransitionStyles(context, {\n duration: theme.motion.duration.quick,\n initial: () => ({\n transform: `translateY(-${makeSize(OVERLAY_TRANSITION_OFFSET)})`,\n opacity: 0,\n }),\n });\n\n React.useEffect(() => {\n if (isOpen) {\n // On Safari clicking on a non input element doesn't focuses it https://bugs.webkit.org/show_bug.cgi?id=22261\n triggererRef.current?.focus();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isOpen]);\n\n return (\n <FloatingPortal>\n <TopNavOverlayThemeOverride>\n <OverlayContextReset>\n <BaseBox\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref={refs.setFloating as any}\n style={floatingStyles}\n zIndex={zIndex}\n display={isMounted ? 'flex' : 'none'}\n {...getFloatingProps()}\n >\n <StyledDropdownOverlay\n isInBottomSheet={bottomSheetAndDropdownGlue?.dropdownHasBottomSheet}\n colorScheme={colorScheme}\n elevation={\n bottomSheetAndDropdownGlue?.dropdownHasBottomSheet ? undefined : 'midRaised'\n }\n style={{ ...styles }}\n width={width ? width : '100%'}\n minWidth={minWidth}\n maxWidth={maxWidth}\n {...metaAttribute({ name: MetaConstants.DropdownOverlay, testID })}\n {...makeAnalyticsAttribute(dataAnalyticsProps)}\n >\n {children}\n </StyledDropdownOverlay>\n </BaseBox>\n </OverlayContextReset>\n </TopNavOverlayThemeOverride>\n </FloatingPortal>\n );\n};\n\nconst DropdownOverlay = assignWithoutSideEffects(_DropdownOverlay, {\n componentId: dropdownComponentIds.DropdownOverlay,\n});\n\nexport { DropdownOverlay };\n"],"names":["OVERLAY_PADDING","size","_DropdownOverlay","_ref","_ref2","_referenceRef$current","children","testID","_ref$zIndex","zIndex","componentZIndices","dropdownOverlay","width","minWidth","maxWidth","referenceRef","_ref$defaultPlacement","defaultPlacement","_ref$_isNestedDropdow","_isNestedDropdown","dataAnalyticsProps","_objectWithoutProperties","_excluded","_useDropdown","useDropdown","isOpen","triggererRef","triggererWrapperRef","dropdownTriggerer","setIsOpen","_useTheme","useTheme","theme","colorScheme","bottomSheetAndDropdownGlue","useBottomSheetAndDropdownGlue","isMenu","dropdownComponentIds","triggers","SelectInput","SearchInput","AutoComplete","undefined","_useFloating","useFloating","open","onOpenChange","strategy","placement","elements","reference","current","middleware","offset","mainAxis","OVERLAY_OFFSET","flip","padding","sizeMiddleware","apply","_ref3","rects","overlayWidth","makeSize","overlayMinWidth","overlayMaxWidth","Object","assign","floating","style","whileElementsMounted","autoUpdate","refs","floatingStyles","context","dismiss","useDismiss","_useInteractions","useInteractions","getFloatingProps","_useTransitionStyles","useTransitionStyles","duration","motion","quick","initial","transform","concat","OVERLAY_TRANSITION_OFFSET","opacity","isMounted","styles","React","useEffect","_triggererRef$current","focus","_jsx","FloatingPortal","TopNavOverlayThemeOverride","OverlayContextReset","BaseBox","_objectSpread","ref","setFloating","display","StyledDropdownOverlay","isInBottomSheet","dropdownHasBottomSheet","elevation","metaAttribute","name","MetaConstants","DropdownOverlay","makeAnalyticsAttribute","assignWithoutSideEffects","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,IAAMA,eAAuB,GAAGC,IAAI,CAAC,IAAI,CAAC,CAAC;;AAE3C;AACA;AACA;AACA;AACA;AACA,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAAC,IAAA,EAWiC;EAAA,IAAAC,KAAA,EAAAC,qBAAA,CAAA;AAAA,EAAA,IAVrDC,QAAQ,GAAAH,IAAA,CAARG,QAAQ;IACRC,MAAM,GAAAJ,IAAA,CAANI,MAAM;IAAAC,WAAA,GAAAL,IAAA,CACNM,MAAM;AAANA,IAAAA,MAAM,GAAAD,WAAA,KAAA,KAAA,CAAA,GAAGE,iBAAiB,CAACC,eAAe,GAAAH,WAAA;IAC1CI,KAAK,GAAAT,IAAA,CAALS,KAAK;IACLC,QAAQ,GAAAV,IAAA,CAARU,Q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GAAGA,KAAK,GAAG,MAAO;AAC9BC,YAAAA,QAAQ,EAAEA,QAAS;AACnBC,YAAAA,QAAQ,EAAEA,QAAAA;AAAS,WAAA,EACf+F,aAAa,CAAC;YAAEC,IAAI,EAAEC,aAAa,CAACC,eAAe;AAAEzG,YAAAA,MAAM,EAANA,MAAAA;AAAO,WAAC,CAAC,CAAA,EAC9D0G,sBAAsB,CAAC7F,kBAAkB,CAAC,CAAA,EAAA,EAAA,EAAA;AAAAd,YAAAA,QAAA,EAE7CA,QAAAA;WACoB,CAAA,CAAA;SAChB,CAAA,CAAA;OACU,CAAA;KACK,CAAA;AAAC,GACf,CAAC,CAAA;AAErB,CAAC,CAAA;AAED,IAAM0G,eAAe,gBAAGE,wBAAwB,CAAChH,gBAAgB,EAAE;EACjEiH,WAAW,EAAE9E,oBAAoB,CAAC2E,eAAAA;AACpC,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"DropdownOverlay.web.js","sources":["../../../../../../src/components/Dropdown/DropdownOverlay.web.tsx"],"sourcesContent":["import React from 'react';\nimport {\n autoUpdate,\n offset,\n size as sizeMiddleware,\n useFloating,\n useTransitionStyles,\n flip,\n FloatingPortal,\n useDismiss,\n useInteractions,\n} from '@floating-ui/react';\nimport { useDropdown } from './useDropdown';\nimport { StyledDropdownOverlay } from './StyledDropdownOverlay';\nimport type { DropdownOverlayProps } from './types';\nimport { dropdownComponentIds } from './dropdownComponentIds';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { makeSize } from '~utils';\nimport { size } from '~tokens/global';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\nimport { useTheme } from '~components/BladeProvider';\nimport { TopNavOverlayThemeOverride } from '~components/TopNav/TopNavOverlayThemeOverride';\n// Reading directly because its not possible to get theme object on top level to be used in keyframes\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { useBottomSheetAndDropdownGlue } from '~components/BottomSheet/BottomSheetContext';\nimport BaseBox from '~components/Box/BaseBox';\nimport { componentZIndices } from '~utils/componentZIndices';\nimport { OVERLAY_OFFSET, OVERLAY_TRANSITION_OFFSET } from '~components/BaseMenu/tokens';\nimport { OverlayContextReset } from '~components/OverlayContextReset';\n\nconst OVERLAY_PADDING: number = size['12']; // doesn't have to be exact. Just rough padding for floating ui to decide to show overlay on top or bottom\n\n/**\n * Overlay of dropdown\n *\n * Wrap your ActionList within this component\n */\nconst _DropdownOverlay = ({\n children,\n testID,\n zIndex = componentZIndices.dropdownOverlay,\n width,\n minWidth,\n maxWidth,\n referenceRef,\n defaultPlacement = 'bottom-start',\n _isNestedDropdown = false,\n ...dataAnalyticsProps\n}: DropdownOverlayProps): React.ReactElement | null => {\n const { isOpen, triggererRef, triggererWrapperRef, dropdownTriggerer, setIsOpen } = useDropdown();\n const { theme, colorScheme } = useTheme();\n const bottomSheetAndDropdownGlue = useBottomSheetAndDropdownGlue();\n\n const isMenu =\n (dropdownTriggerer !== dropdownComponentIds.triggers.SelectInput &&\n dropdownTriggerer !== dropdownComponentIds.triggers.SearchInput &&\n dropdownTriggerer !== dropdownComponentIds.triggers.AutoComplete &&\n referenceRef == undefined) ||\n _isNestedDropdown;\n\n const { refs, floatingStyles, context } = useFloating({\n open: isOpen,\n onOpenChange: setIsOpen,\n strategy: 'fixed',\n placement: defaultPlacement,\n elements: {\n // Input triggers have their ref on internal input element but we want width height of overall visible input hence wrapperRef is needed\n // We fallback to use `triggererRef` for triggers like button and link where wrapper is not needed\n // Checkout: https://github.com/razorpay/blade/pull/1559#discussion_r1305438920\n reference: (referenceRef?.current ??\n triggererWrapperRef.current ??\n triggererRef.current) as Element,\n },\n middleware: [\n offset({\n mainAxis: OVERLAY_OFFSET,\n }),\n flip({\n // eslint-disable-next-line @typescript-eslint/restrict-plus-operands\n padding: OVERLAY_OFFSET + OVERLAY_PADDING,\n }),\n sizeMiddleware({\n apply({ rects, elements }) {\n const overlayWidth = isMenu ? undefined : makeSize(rects.reference.width);\n const overlayMinWidth = isMenu ? makeSize(size['240']) : undefined;\n const overlayMaxWidth = isMenu ? makeSize(size['400']) : undefined;\n\n Object.assign(elements.floating.style, {\n // in menu, we have flexible width between min and max\n // in input triggers, we just take width of trigger\n width: width ?? overlayWidth,\n minWidth: minWidth ?? overlayMinWidth,\n maxWidth: maxWidth ?? overlayMaxWidth,\n });\n },\n }),\n ],\n whileElementsMounted: autoUpdate,\n });\n\n const dismiss = useDismiss(context);\n const { getFloatingProps } = useInteractions([dismiss]);\n\n const { isMounted, styles } = useTransitionStyles(context, {\n duration: theme.motion.duration.quick,\n initial: () => ({\n transform: `translateY(-${makeSize(OVERLAY_TRANSITION_OFFSET)})`,\n opacity: 0,\n }),\n });\n\n React.useEffect(() => {\n if (isOpen) {\n // On Safari clicking on a non input element doesn't focuses it https://bugs.webkit.org/show_bug.cgi?id=22261\n triggererRef.current?.focus();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isOpen]);\n\n return (\n <FloatingPortal>\n <TopNavOverlayThemeOverride>\n <OverlayContextReset>\n <BaseBox\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref={refs.setFloating as any}\n style={floatingStyles}\n zIndex={zIndex}\n display={isMounted ? 'flex' : 'none'}\n {...getFloatingProps()}\n >\n <StyledDropdownOverlay\n isInBottomSheet={bottomSheetAndDropdownGlue?.dropdownHasBottomSheet}\n colorScheme={colorScheme}\n style={{ ...styles }}\n width={width ? width : '100%'}\n minWidth={minWidth}\n maxWidth={maxWidth}\n {...metaAttribute({ name: MetaConstants.DropdownOverlay, testID })}\n {...makeAnalyticsAttribute(dataAnalyticsProps)}\n >\n {children}\n </StyledDropdownOverlay>\n </BaseBox>\n </OverlayContextReset>\n </TopNavOverlayThemeOverride>\n </FloatingPortal>\n );\n};\n\nconst DropdownOverlay = assignWithoutSideEffects(_DropdownOverlay, {\n componentId: dropdownComponentIds.DropdownOverlay,\n});\n\nexport { DropdownOverlay };\n"],"names":["OVERLAY_PADDING","size","_DropdownOverlay","_ref","_ref2","_referenceRef$current","children","testID","_ref$zIndex","zIndex","componentZIndices","dropdownOverlay","width","minWidth","maxWidth","referenceRef","_ref$defaultPlacement","defaultPlacement","_ref$_isNestedDropdow","_isNestedDropdown","dataAnalyticsProps","_objectWithoutProperties","_excluded","_useDropdown","useDropdown","isOpen","triggererRef","triggererWrapperRef","dropdownTriggerer","setIsOpen","_useTheme","useTheme","theme","colorScheme","bottomSheetAndDropdownGlue","useBottomSheetAndDropdownGlue","isMenu","dropdownComponentIds","triggers","SelectInput","SearchInput","AutoComplete","undefined","_useFloating","useFloating","open","onOpenChange","strategy","placement","elements","reference","current","middleware","offset","mainAxis","OVERLAY_OFFSET","flip","padding","sizeMiddleware","apply","_ref3","rects","overlayWidth","makeSize","overlayMinWidth","overlayMaxWidth","Object","assign","floating","style","whileElementsMounted","autoUpdate","refs","floatingStyles","context","dismiss","useDismiss","_useInteractions","useInteractions","getFloatingProps","_useTransitionStyles","useTransitionStyles","duration","motion","quick","initial","transform","concat","OVERLAY_TRANSITION_OFFSET","opacity","isMounted","styles","React","useEffect","_triggererRef$current","focus","_jsx","FloatingPortal","TopNavOverlayThemeOverride","OverlayContextReset","BaseBox","_objectSpread","ref","setFloating","display","StyledDropdownOverlay","isInBottomSheet","dropdownHasBottomSheet","metaAttribute","name","MetaConstants","DropdownOverlay","makeAnalyticsAttribute","assignWithoutSideEffects","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,IAAMA,eAAuB,GAAGC,IAAI,CAAC,IAAI,CAAC,CAAC;;AAE3C;AACA;AACA;AACA;AACA;AACA,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAAC,IAAA,EAWiC;EAAA,IAAAC,KAAA,EAAAC,qBAAA,CAAA;AAAA,EAAA,IAVrDC,QAAQ,GAAAH,IAAA,CAARG,QAAQ;IACRC,MAAM,GAAAJ,IAAA,CAANI,MAAM;IAAAC,WAAA,GAAAL,IAAA,CACNM,MAAM;AAANA,IAA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KAAK,EAAEA,KAAK,GAAGA,KAAK,GAAG,MAAO;AAC9BC,YAAAA,QAAQ,EAAEA,QAAS;AACnBC,YAAAA,QAAQ,EAAEA,QAAAA;AAAS,WAAA,EACf8F,aAAa,CAAC;YAAEC,IAAI,EAAEC,aAAa,CAACC,eAAe;AAAExG,YAAAA,MAAM,EAANA,MAAAA;AAAO,WAAC,CAAC,CAAA,EAC9DyG,sBAAsB,CAAC5F,kBAAkB,CAAC,CAAA,EAAA,EAAA,EAAA;AAAAd,YAAAA,QAAA,EAE7CA,QAAAA;WACoB,CAAA,CAAA;SAChB,CAAA,CAAA;OACU,CAAA;KACK,CAAA;AAAC,GACf,CAAC,CAAA;AAErB,CAAC,CAAA;AAED,IAAMyG,eAAe,gBAAGE,wBAAwB,CAAC/G,gBAAgB,EAAE;EACjEgH,WAAW,EAAE7E,oBAAoB,CAAC0E,eAAAA;AACpC,CAAC;;;;"}
|
|
@@ -64,6 +64,7 @@ var getInputBackgroundAndBorderStyles = function getInputBackgroundAndBorderStyl
|
|
|
64
64
|
return _objectSpread({
|
|
65
65
|
backgroundColor: backgroundColor,
|
|
66
66
|
borderRadius: makeBorderSize(isTableInputCell ? theme.border.radius.none : theme.border.radius[borderRadius !== null && borderRadius !== void 0 ? borderRadius : baseInputBorderRadius[size]]),
|
|
67
|
+
overflow: 'hidden',
|
|
67
68
|
borderStyle: 'solid',
|
|
68
69
|
display: 'flex',
|
|
69
70
|
flexDirection: 'row',
|