diff --git a/playroom/snippets.tsx b/playroom/snippets.tsx index f7fd27c3f..a421738ce 100644 --- a/playroom/snippets.tsx +++ b/playroom/snippets.tsx @@ -945,9 +945,9 @@ const tabsSnippets: Array = [ selectedIndex={getState('tabIndex', 0)} onChange={setState('tabIndex')} tabs={[ - {text: 'Tab 1', icon: }, - {text: 'Tab 2', icon: }, - {text: 'Tab 3', icon: }, + {text: 'Tab 1', Icon: IconAppointmentRegular}, + {text: 'Tab 2', Icon: IconBrainRegular}, + {text: 'Tab 3', Icon: IconBusRegular}, ]} />`, }, @@ -1440,20 +1440,20 @@ const layoutSnippets: Array = [ { categoryName: "Personal information", settings: [ - { title: "Personal details", icon: }, - { title: "Security", icon: }, + { title: "Personal details", asset: }, + { title: "Security", asset: }, { title: "Payment methods", - icon: , + asset: , }, ], }, { categoryName: "Configuration", settings: [ - { title: "Notifications", icon: }, - { title: "FAQs", icon: }, - { title: "About", icon: }, + { title: "Notifications", asset: }, + { title: "FAQs", asset: }, + { title: "About", asset: }, ], }, ].map((category) => ( @@ -1619,21 +1619,21 @@ const exampleScreens: Array = [ settings: [ { title: "Personal details", - icon: , + asset: , }, - { title: "Security", icon: }, + { title: "Security", asset: }, { title: "Payment methods", - icon: , + asset: , }, ], }, { categoryName: "Configuration", settings: [ - { title: "Notifications", icon: }, - { title: "FAQs", icon: }, - { title: "About", icon: }, + { title: "Notifications", asset: }, + { title: "FAQs", asset: }, + { title: "About", asset: }, ], }, ].map((category) => ( @@ -2647,7 +2647,7 @@ const alertSnippets = [ forceWeb: true, showCancel: true, link: Link, - icon: , + asset: , }) } > diff --git a/src/__acceptance_tests__/__ssr_pages__/card.tsx b/src/__acceptance_tests__/__ssr_pages__/card.tsx index e235d13d5..ee4f7adac 100644 --- a/src/__acceptance_tests__/__ssr_pages__/card.tsx +++ b/src/__acceptance_tests__/__ssr_pages__/card.tsx @@ -21,7 +21,7 @@ const CardsTest = (): JSX.Element => ( title="title" subtitle="subtitle" description="description" - icon={} + asset={} button={ Action diff --git a/src/__private_stories__/carousel-on-different-container-sizes-story.tsx b/src/__private_stories__/carousel-on-different-container-sizes-story.tsx index 1f2ad0135..3d6f84fd0 100644 --- a/src/__private_stories__/carousel-on-different-container-sizes-story.tsx +++ b/src/__private_stories__/carousel-on-different-container-sizes-story.tsx @@ -80,7 +80,7 @@ export const Default: StoryComponent = ({ } + asset={} /> = ({variant}) => { {/** Callout */} } + asset={} onClose={() => {}} title="Title" description="Description" diff --git a/src/__stories__/callout-story.tsx b/src/__stories__/callout-story.tsx index ef71df4e8..e27ab7084 100644 --- a/src/__stories__/callout-story.tsx +++ b/src/__stories__/callout-story.tsx @@ -42,7 +42,7 @@ export const Default: StoryComponent = ({title, description, asset, action : undefined} + asset={asset ? : undefined} onClose={closable ? () => {} : undefined} title={title} description={description} diff --git a/src/__stories__/card-action-icon-button-story.tsx b/src/__stories__/card-action-icon-button-story.tsx index 6f6444ecd..27c629d56 100644 --- a/src/__stories__/card-action-icon-button-story.tsx +++ b/src/__stories__/card-action-icon-button-story.tsx @@ -66,7 +66,7 @@ export const Default: StoryComponent = () => { , , ]} - icon={ + asset={ diff --git a/src/__stories__/carousel-story.tsx b/src/__stories__/carousel-story.tsx index baa615311..a8365fd85 100644 --- a/src/__stories__/carousel-story.tsx +++ b/src/__stories__/carousel-story.tsx @@ -62,7 +62,7 @@ export const Default: StoryComponent = ({ } + asset={} /> = ({numItems, initialActiveItem}) => } + asset={} /> = ({ topAction, aspectRatio, }) => { - let icon; + let assetElement; if (asset === 'icon') { - icon = ( + assetElement = ( ); } else if (asset === 'image') { - icon = ; + assetElement = ; } const interactiveActions = { @@ -92,7 +92,7 @@ export const Default: StoryComponent = ({ return ( {} : undefined} - icon={icon} + asset={assetElement} headline={headline && {headline}} pretitle={pretitle} title={title} @@ -191,7 +191,7 @@ export const Group: StoryComponent = () => { title="Title" subtitle="Subtitle" description="Description" - icon={ + asset={ @@ -201,7 +201,7 @@ export const Group: StoryComponent = () => { diff --git a/src/__stories__/dialog-story.tsx b/src/__stories__/dialog-story.tsx index 6bd6e8df8..247b41863 100644 --- a/src/__stories__/dialog-story.tsx +++ b/src/__stories__/dialog-story.tsx @@ -120,7 +120,7 @@ export const Dialog: StoryComponent = ({ ) : undefined, link: link ? Link : undefined, - icon: asset ? ( + asset: asset ? ( ) : undefined, onAccept: onAccept ? () => console.log('Accepted') : undefined, diff --git a/src/__stories__/display-data-card-story.tsx b/src/__stories__/display-data-card-story.tsx index ac8a4b4ba..4f705aa8e 100644 --- a/src/__stories__/display-data-card-story.tsx +++ b/src/__stories__/display-data-card-story.tsx @@ -66,19 +66,19 @@ export const Default: StoryComponent = ({ isInverse, aspectRatio, }) => { - let icon; + let assetElement; if (asset === 'circle + icon') { - icon = ( + assetElement = ( ); } else if (asset === 'circle + image') { - icon = ; + assetElement = ; } else if (asset === 'icon') { - icon = ; + assetElement = ; } else if (asset === 'image') { - icon = ; + assetElement = ; } const interactiveActions = { @@ -134,7 +134,7 @@ export const Default: StoryComponent = ({ ] : undefined } - icon={icon} + asset={assetElement} headline={headline ? {headline} : undefined} pretitle={pretitle} title={title} @@ -221,7 +221,7 @@ export const Group: StoryComponent = () => { } />, diff --git a/src/__stories__/display-media-card-story.tsx b/src/__stories__/display-media-card-story.tsx index 50a1c439f..59aa36531 100644 --- a/src/__stories__/display-media-card-story.tsx +++ b/src/__stories__/display-media-card-story.tsx @@ -76,15 +76,15 @@ export const Default: StoryComponent = ({ emptySource, inverse, }) => { - let icon; + let assetElement; if (asset === 'circle with icon') { - icon = ( + assetElement = ( ); } else if (asset === 'circle with image') { - icon = ; + assetElement = ; } const interactiveActions = { @@ -146,7 +146,7 @@ export const Default: StoryComponent = ({ {headline} : undefined} pretitle={pretitle} title={title} diff --git a/src/__stories__/empty-state-card-story.tsx b/src/__stories__/empty-state-card-story.tsx index 9081e4b94..51c518e9d 100644 --- a/src/__stories__/empty-state-card-story.tsx +++ b/src/__stories__/empty-state-card-story.tsx @@ -28,15 +28,15 @@ export const Default: StoryComponent = ({actions, title, description, asse if (asset === 'Icon') { assetProps = { - icon: , + asset: , }; } else if (asset === 'icon as Image') { assetProps = { - icon: , + asset: , }; } else if (asset === 'icon as img') { assetProps = { - icon: , + asset: , }; } else { assetProps = { diff --git a/src/__stories__/empty-state-story.tsx b/src/__stories__/empty-state-story.tsx index 6e558aa40..f5bd1ac40 100644 --- a/src/__stories__/empty-state-story.tsx +++ b/src/__stories__/empty-state-story.tsx @@ -50,15 +50,15 @@ export const WithIcon: StoryComponent = ({actions, asset}) => { let assetProps; if (asset === 'Icon') { assetProps = { - icon: , + asset: , }; } else if (asset === 'Image') { assetProps = { - icon: , + asset: , }; } else { assetProps = { - icon: , + asset: , }; } diff --git a/src/__stories__/feedback-screen-story.tsx b/src/__stories__/feedback-screen-story.tsx index 17548a436..52bc27a6f 100644 --- a/src/__stories__/feedback-screen-story.tsx +++ b/src/__stories__/feedback-screen-story.tsx @@ -103,7 +103,7 @@ export const FeedbackScreenStory: StoryComponent = ({ multipleParagraphs ? [description, 'paragraph 2', 'paragraph 3'] : description } animateText={animateText} - icon={icon ? : undefined} + asset={icon ? : undefined} imageUrl={imageUrl ?? undefined} imageFit={imageFit} primaryButton={ diff --git a/src/__stories__/grid-story.tsx b/src/__stories__/grid-story.tsx index f4bc73945..6f1b26ab1 100644 --- a/src/__stories__/grid-story.tsx +++ b/src/__stories__/grid-story.tsx @@ -39,7 +39,7 @@ export const Default: StoryComponent = ({gap}) => ( @@ -50,7 +50,7 @@ export const Default: StoryComponent = ({gap}) => ( @@ -61,7 +61,7 @@ export const Default: StoryComponent = ({gap}) => ( @@ -72,7 +72,7 @@ export const Default: StoryComponent = ({gap}) => ( @@ -83,7 +83,7 @@ export const Default: StoryComponent = ({gap}) => ( @@ -94,7 +94,7 @@ export const Default: StoryComponent = ({gap}) => ( @@ -111,7 +111,7 @@ export const Default: StoryComponent = ({gap}) => ( @@ -122,7 +122,7 @@ export const Default: StoryComponent = ({gap}) => ( @@ -133,7 +133,7 @@ export const Default: StoryComponent = ({gap}) => ( @@ -144,7 +144,7 @@ export const Default: StoryComponent = ({gap}) => ( @@ -155,7 +155,7 @@ export const Default: StoryComponent = ({gap}) => ( @@ -166,7 +166,7 @@ export const Default: StoryComponent = ({gap}) => ( @@ -183,7 +183,7 @@ export const Default: StoryComponent = ({gap}) => ( @@ -194,7 +194,7 @@ export const Default: StoryComponent = ({gap}) => ( @@ -205,7 +205,7 @@ export const Default: StoryComponent = ({gap}) => ( @@ -240,7 +240,7 @@ export const AutoColumns: StoryComponent = ({gap, columnsMinSiz {Array.from({length: numItems}, (_, idx) => ( diff --git a/src/__stories__/header-story.tsx b/src/__stories__/header-story.tsx index 58e7a6195..f91e05203 100644 --- a/src/__stories__/header-story.tsx +++ b/src/__stories__/header-story.tsx @@ -91,7 +91,7 @@ export const Default: StoryComponent = ({ /> } + asset={} title="Note:" description="A HeaderLayout can be rendered without a Header (in webviews) to allow delegating the header visualization to the native app. For example, in Novum App (Mi Movistar, Meu diff --git a/src/__stories__/media-card-story.tsx b/src/__stories__/media-card-story.tsx index c5bea2f4d..c18adde3b 100644 --- a/src/__stories__/media-card-story.tsx +++ b/src/__stories__/media-card-story.tsx @@ -61,15 +61,15 @@ export const Default: StoryComponent = ({ asset, emptySource, }) => { - let icon; + let assetElement; if (asset === 'circle with icon') { - icon = ( + assetElement = ( ); } else if (asset === 'circle with image') { - icon = ; + assetElement = ; } const interactiveActions = { @@ -98,7 +98,7 @@ export const Default: StoryComponent = ({ title={title} subtitle={subtitle} description={description} - icon={icon} + asset={assetElement} media={ media === 'video' ? ( } + asset={} buttonLink={ See docs diff --git a/src/__stories__/slideshow-story.tsx b/src/__stories__/slideshow-story.tsx index 9c1e9aafc..5564cc2f9 100644 --- a/src/__stories__/slideshow-story.tsx +++ b/src/__stories__/slideshow-story.tsx @@ -32,7 +32,7 @@ export const Default: StoryComponent = ({numItems, autoplay, loop, bullets } + asset={} /> = ({ return ( { @@ -139,7 +139,7 @@ export const Group: StoryComponent = () => { />, diff --git a/src/__stories__/tabs-story.tsx b/src/__stories__/tabs-story.tsx index 37d0c63af..6c04e9e82 100644 --- a/src/__stories__/tabs-story.tsx +++ b/src/__stories__/tabs-story.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import {Box, IconCloseRegular, pxToRem, ResponsiveLayout, Tabs} from '..'; +import {Box, IconCloseRegular, ResponsiveLayout, Tabs} from '..'; import type {Variant} from '../theme-variant-context'; @@ -35,7 +35,7 @@ export const Default: StoryComponent = ({tabCount, text, theme, icon}) => onChange={setSelectedIndex} tabs={Array.from({length: tabCount}).map((_, index) => ({ text: `${text} ${index + 1}`, - icon: icon ? : undefined, + Icon: icon ? IconCloseRegular : undefined, }))} /> diff --git a/src/callout.tsx b/src/callout.tsx index 745c90655..3a5befb6e 100644 --- a/src/callout.tsx +++ b/src/callout.tsx @@ -26,7 +26,7 @@ type Props = { description: string; onClose?: () => void; closeButtonLabel?: string; - icon?: React.ReactElement; + asset?: React.ReactElement; button?: RendersNullableElement; secondaryButton?: RendersNullableElement; buttonLink?: RendersNullableElement; @@ -40,7 +40,7 @@ const Callout = ({ title, titleAs = 'h2', description, - icon, + asset, onClose, closeButtonLabel, button, @@ -72,7 +72,7 @@ const Callout = ({ {...getPrefixedDataAttributes(dataAttributes, 'Callout')} > - {icon && {icon}} + {asset && {asset}}
diff --git a/src/card.css.ts b/src/card.css.ts index 0b81eb7aa..0998e54b9 100644 --- a/src/card.css.ts +++ b/src/card.css.ts @@ -215,7 +215,7 @@ export const mediaCardContent = style([ }, ]); -export const mediaCardIcon = style([ +export const mediaCardAsset = style([ { position: 'absolute', zIndex: 1, diff --git a/src/card.tsx b/src/card.tsx index dd1c7d9c2..9e9864258 100644 --- a/src/card.tsx +++ b/src/card.tsx @@ -509,7 +509,7 @@ type MaybeTouchableCard = ExclusifyUnion | T>; interface MediaCardBaseProps { media: RendersElement | RendersElement; - icon?: React.ReactElement; + asset?: React.ReactElement; headline?: string | RendersNullableElement; pretitle?: string; pretitleLinesMax?: number; @@ -542,7 +542,7 @@ export const MediaCard = React.forwardRef( ( { media, - icon, + asset, headline, pretitle, pretitleLinesMax, @@ -611,9 +611,9 @@ export const MediaCard = React.forwardRef( buttonLink={buttonLink} />
- {icon && ( + {asset && ( @@ -622,7 +622,7 @@ export const MediaCard = React.forwardRef( [mediaStyles.vars.mediaBorderRadius]: vars.borderRadii.mediaSmall, })} > - {icon} + {asset} )} @@ -644,7 +644,7 @@ export const NakedCard = React.forwardRef( ( { media, - icon, + asset, headline, pretitle, pretitleLinesMax, @@ -719,9 +719,9 @@ export const NakedCard = React.forwardRef( buttonLink={buttonLink} /> - {icon && ( + {asset && ( @@ -730,7 +730,7 @@ export const NakedCard = React.forwardRef( [mediaStyles.vars.mediaBorderRadius]: vars.borderRadii.mediaSmall, })} > - {icon} + {asset} )} @@ -856,7 +856,7 @@ interface DataCardBaseProps { /** * Typically a mistica-icons component element */ - icon?: React.ReactElement; + asset?: React.ReactElement; headline?: string | RendersNullableElement; pretitle?: string; pretitleLinesMax?: number; @@ -890,7 +890,7 @@ type DataCardProps = DataCardBaseProps & export const DataCard = React.forwardRef( ( { - icon, + asset, headline, pretitle, pretitleLinesMax, @@ -914,7 +914,7 @@ export const DataCard = React.forwardRef( }, ref ) => { - const hasIconOrHeadline = !!icon || !!headline; + const hasIconOrHeadline = !!asset || !!headline; const isTouchable = !!(touchableProps.href || touchableProps.to || touchableProps.onPress); const {text: headlineText, ref: headlineRef} = useInnerText(); const {text: extraText, ref: extraRef} = useInnerText(); @@ -944,14 +944,14 @@ export const DataCard = React.forwardRef(
- {icon && ( + {asset && (
- {icon} + {asset}
)} ( ); type SnapCardProps = MaybeTouchableCard<{ - icon?: React.ReactElement; + asset?: React.ReactElement; title?: string; titleAs?: HeadingType; titleLinesMax?: number; @@ -1021,7 +1021,7 @@ type SnapCardProps = MaybeTouchableCard<{ export const SnapCard = React.forwardRef( ( { - icon, + asset, title, titleAs = 'h3', titleLinesMax, @@ -1064,13 +1064,13 @@ export const SnapCard = React.forwardRef( {isTouchable &&
}
- {icon && ( + {asset && (
- {icon} + {asset}
)} @@ -1172,7 +1172,7 @@ interface CommonDisplayCardProps { /** * Typically a mistica-icons component element */ - icon?: React.ReactElement; + asset?: React.ReactElement; actions?: ReadonlyArray; onClose?: () => void; closeButtonLabel?: string; @@ -1239,7 +1239,7 @@ const DisplayCard = React.forwardRef( backgroundVideo, backgroundVideoRef, poster, - icon, + asset, headline, pretitle, pretitleLinesMax, @@ -1336,17 +1336,18 @@ const DisplayCard = React.forwardRef(
- {icon ? ( + {asset ? (
- {icon} + {asset}
) : ( @@ -1465,7 +1466,7 @@ interface PosterCardBaseProps { aspectRatio?: AspectRatio | number; width?: number | string; height?: number | string; - icon?: React.ReactElement; + asset?: React.ReactElement; actions?: ReadonlyArray; onClose?: () => void; closeButtonLabel?: string; @@ -1523,7 +1524,7 @@ export const PosterCard = React.forwardRef( actions, onClose, closeButtonLabel, - icon, + asset, headline, pretitle, pretitleLinesMax, @@ -1630,12 +1631,12 @@ export const PosterCard = React.forwardRef( - {icon ? ( + {asset ? (
( paddingBottom={withGradient ? 0 : 40} paddingX={{mobile: 16, desktop: 24}} > - {icon} + {asset}
) : ( diff --git a/src/dialog.tsx b/src/dialog.tsx index f4c303bfe..241a40ccb 100644 --- a/src/dialog.tsx +++ b/src/dialog.tsx @@ -43,7 +43,7 @@ export interface ConfirmProps extends BaseDialogProps { } export interface ExtendedDialogProps extends BaseDialogProps { - icon?: React.ReactElement; + asset?: React.ReactElement; subtitle?: string; extra?: React.ReactNode; cancelText?: string; @@ -63,7 +63,7 @@ const InternalDialog = (props: InternalDialogProps) => { className, title, message, - icon, + asset, extra, showCancelButton, showAcceptButton, @@ -85,9 +85,9 @@ const InternalDialog = (props: InternalDialogProps) => { return (
- {icon && ( + {asset && ( -
{React.cloneElement(icon, {size: '100%'})}
+
{React.cloneElement(asset, {size: '100%'})}
)} {title && ( diff --git a/src/empty-state-card.css.ts b/src/empty-state-card.css.ts index 3901ef9ca..9d08017a9 100644 --- a/src/empty-state-card.css.ts +++ b/src/empty-state-card.css.ts @@ -24,7 +24,7 @@ export const image = style([ }, ]); -export const iconContainer = style([ +export const assetContainer = style([ sprinkles({ width: 48, height: 48, diff --git a/src/empty-state-card.tsx b/src/empty-state-card.tsx index f896beb0b..c80f26149 100644 --- a/src/empty-state-card.tsx +++ b/src/empty-state-card.tsx @@ -26,13 +26,13 @@ interface CommonProps { } interface IconProps extends CommonProps { - icon: React.ReactElement; + asset: React.ReactElement; imageUrl?: undefined; } interface ImageProps extends CommonProps { imageUrl: string; - icon?: undefined; + asset?: undefined; } type Props = IconProps | ImageProps; @@ -44,7 +44,7 @@ const EmptyStateCard = ({ button, secondaryButton, buttonLink, - icon, + asset, imageUrl, 'aria-label': ariaLabel, dataAttributes, @@ -63,7 +63,7 @@ const EmptyStateCard = ({
- {image ?? (icon &&
{icon}
)} + {image ?? (asset &&
{asset}
)} diff --git a/src/empty-state.css.ts b/src/empty-state.css.ts index e2c17af4a..4aadf7cea 100644 --- a/src/empty-state.css.ts +++ b/src/empty-state.css.ts @@ -76,7 +76,7 @@ export const largeImage = style([ }, ]); -export const iconContainer = style([ +export const assetContainer = style([ sprinkles({ width: 64, height: 64, diff --git a/src/empty-state.tsx b/src/empty-state.tsx index 3d8192d86..1cab65acf 100644 --- a/src/empty-state.tsx +++ b/src/empty-state.tsx @@ -34,18 +34,18 @@ interface ImageProps extends BaseProps { imageUrl: string; largeImageUrl?: undefined; - icon?: undefined; + asset?: undefined; } interface LargeImageProps extends BaseProps { largeImageUrl: string; imageUrl?: undefined; - icon?: undefined; + asset?: undefined; } interface IconProps extends BaseProps { - icon: React.ReactElement; + asset: React.ReactElement; imageUrl?: undefined; largeImageUrl?: undefined; @@ -61,7 +61,7 @@ const EmptyState = ({ buttonLink, largeImageUrl, imageUrl, - icon, + asset, 'aria-label': ariaLabel, dataAttributes, }: Props): JSX.Element => { @@ -96,7 +96,7 @@ const EmptyState = ({ largeImageUrl ? styles.contentVariants.largeImage : styles.contentVariants.default } > - {image ?? (icon &&
{icon}
)} + {image ?? (asset &&
{asset}
)} {title} { }; const renderFeedbackBody = ( - {icon, title, description, extra}: Pick, + { + asset, + title, + description, + extra, + }: Pick, animateText: boolean ) => { const normalizedDescription = @@ -75,7 +80,7 @@ const renderFeedbackBody = ( ); return ( -
{icon}
+
{asset}
{title} @@ -185,7 +190,7 @@ interface AssetFeedbackProps extends FeedbackProps { interface FeedbackScreenProps extends AssetFeedbackProps { hapticFeedback?: HapticFeedback; - icon?: React.ReactNode; + asset?: React.ReactNode; animateText?: boolean; isInverse?: boolean; } @@ -198,7 +203,7 @@ export const FeedbackScreen = ({ secondaryButton, link, hapticFeedback, - icon, + asset, animateText = false, isInverse = false, unstable_inlineInDesktop, @@ -213,7 +218,7 @@ export const FeedbackScreen = ({ const hasButtons = checkHasButtons({primaryButton, secondaryButton, link}); const feedbackBody = renderFeedbackBody( - {icon, title, description, extra}, + {asset, title, description, extra}, animateText && areAnimationsSupported(platformOverrides) ); @@ -284,7 +289,7 @@ export const SuccessFeedbackScreen = ({dataAttributes, ...props}: AssetFeedbackP {...props} isInverse={!props.unstable_inlineInDesktop || isTabletOrSmaller} hapticFeedback="success" - icon={ + asset={ skinName === VIVO_SKIN ? ( ) : skinName === VIVO_NEW_SKIN ? ( @@ -314,7 +319,7 @@ export const ErrorFeedbackScreen = ({ } + asset={} animateText dataAttributes={{'component-name': 'ErrorFeedbackScreen', ...dataAttributes}} extra={ @@ -342,7 +347,7 @@ export const InfoFeedbackScreen = ({ return ( } + asset={} {...props} /> ); @@ -362,7 +367,7 @@ export const SuccessFeedback = ({ useHapticFeedback('success'); const {skinName, platformOverrides} = useTheme(); - const icon = + const asset = skinName === VIVO_SKIN ? ( ) : skinName === VIVO_NEW_SKIN ? ( @@ -371,7 +376,7 @@ export const SuccessFeedback = ({ ); const feedbackBody = renderFeedbackBody( - {icon, title, description, extra}, + {asset, title, description, extra}, areAnimationsSupported(platformOverrides) ); const inlineFeedbackBody = renderInlineFeedbackBody(feedbackBody, { diff --git a/src/tabs.tsx b/src/tabs.tsx index 5b4d296b0..f8d637ad9 100644 --- a/src/tabs.tsx +++ b/src/tabs.tsx @@ -12,7 +12,7 @@ import Inline from './inline'; import {useIsInverseVariant} from './theme-variant-context'; import {vars} from './skins/skin-contract.css'; -import type {DataAttributes, TrackingEvent} from './utils/types'; +import type {DataAttributes, IconProps, TrackingEvent} from './utils/types'; const LINE_ANIMATION_DURATION_MS = isRunningAcceptanceTest() ? 0 : 300; @@ -33,7 +33,7 @@ export type TabsProps = { tabs: ReadonlyArray<{ readonly text: string; readonly trackingEvent?: TrackingEvent | ReadonlyArray; - readonly icon?: React.ReactNode; + readonly Icon?: (props: IconProps) => JSX.Element; readonly 'aria-controls'?: string; }>; children?: void; @@ -87,7 +87,7 @@ const Tabs = ({selectedIndex, onChange, tabs, dataAttributes}: TabsProps): JSX.E
- {tabs.map(({text, trackingEvent, icon, 'aria-controls': ariaControls}, index) => { + {tabs.map(({text, trackingEvent, Icon, 'aria-controls': ariaControls}, index) => { const isSelected = index === selectedIndex; return ( - - {icon &&
{icon}
} + + {Icon && ( +
+ +
+ )}