@fluentui/react-tabs 9.8.2 → 9.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/Tab/useTabStyles.styles.ts"],"sourcesContent":["import { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { TabSlots, TabState } from './Tab.types';\nimport { useTabAnimatedIndicatorStyles_unstable } from './useTabAnimatedIndicator.styles';\n\nexport const tabClassNames: SlotClassNames<TabSlots> = {\n root: 'fui-Tab',\n icon: 'fui-Tab__icon',\n content: 'fui-Tab__content',\n};\n\nconst reservedSpaceClassNames = {\n content: 'fui-Tab__content--reserved-space',\n};\n\n// These should match the constants defined in @fluentui/react-icons\n// This package avoids taking a dependency on the icons package for only the constants.\nconst iconClassNames = {\n filled: 'fui-Icon-filled',\n regular: 'fui-Icon-regular',\n};\n\n/**\n * Styles for the root slot\n */\nconst useRootStyles = makeStyles({\n root: {\n alignItems: 'center',\n display: 'grid',\n flexShrink: 0,\n gridAutoFlow: 'column',\n gridTemplateColumns: 'auto',\n gridTemplateRows: 'auto',\n outlineStyle: 'none',\n position: 'relative',\n },\n button: {\n alignItems: 'center',\n border: 'none',\n borderRadius: tokens.borderRadiusMedium,\n cursor: 'pointer',\n display: 'grid',\n flexShrink: 0,\n gridAutoFlow: 'column',\n gridTemplateColumns: 'auto',\n gridTemplateRows: 'auto',\n fontFamily: tokens.fontFamilyBase,\n lineHeight: tokens.lineHeightBase300,\n outlineStyle: 'none',\n position: 'relative',\n overflow: 'hidden',\n textTransform: 'none',\n },\n horizontal: {\n justifyContent: 'center',\n },\n vertical: {\n justifyContent: 'start',\n },\n smallHorizontal: {\n columnGap: tokens.spacingHorizontalXXS,\n padding: `${tokens.spacingVerticalSNudge} ${tokens.spacingHorizontalSNudge}`,\n },\n smallVertical: {\n // horizontal spacing is deliberate. This is the gap between icon and content.\n columnGap: tokens.spacingHorizontalXXS,\n padding: `${tokens.spacingVerticalXXS} ${tokens.spacingHorizontalSNudge}`,\n },\n mediumHorizontal: {\n columnGap: tokens.spacingHorizontalSNudge,\n padding: `${tokens.spacingVerticalM} ${tokens.spacingHorizontalMNudge}`,\n },\n mediumVertical: {\n // horizontal spacing is deliberate. This is the gap between icon and content.\n columnGap: tokens.spacingHorizontalSNudge,\n padding: `${tokens.spacingVerticalSNudge} ${tokens.spacingHorizontalMNudge}`,\n },\n largeHorizontal: {\n columnGap: tokens.spacingHorizontalSNudge,\n padding: `${tokens.spacingVerticalL} ${tokens.spacingHorizontalMNudge}`,\n },\n largeVertical: {\n // horizontal spacing is deliberate. This is the gap between icon and content.\n columnGap: tokens.spacingHorizontalSNudge,\n padding: `${tokens.spacingVerticalS} ${tokens.spacingHorizontalMNudge}`,\n },\n transparent: {\n backgroundColor: tokens.colorTransparentBackground,\n ':enabled:hover': {\n backgroundColor: tokens.colorTransparentBackgroundHover,\n },\n ':enabled:active': {\n backgroundColor: tokens.colorTransparentBackgroundPressed,\n },\n [`& .${tabClassNames.icon}`]: {\n color: tokens.colorNeutralForeground2,\n },\n [`:enabled:hover .${tabClassNames.icon}`]: {\n color: tokens.colorNeutralForeground2Hover,\n },\n [`:enabled:active .${tabClassNames.icon}`]: {\n color: tokens.colorNeutralForeground2Pressed,\n },\n [`& .${tabClassNames.content}`]: {\n color: tokens.colorNeutralForeground2,\n },\n [`:enabled:hover .${tabClassNames.content}`]: {\n color: tokens.colorNeutralForeground2Hover,\n },\n [`:enabled:active .${tabClassNames.content}`]: {\n color: tokens.colorNeutralForeground2Pressed,\n },\n },\n subtle: {\n backgroundColor: tokens.colorSubtleBackground,\n ':enabled:hover': {\n backgroundColor: tokens.colorSubtleBackgroundHover,\n },\n ':enabled:active': {\n backgroundColor: tokens.colorSubtleBackgroundPressed,\n },\n [`& .${tabClassNames.icon}`]: {\n color: tokens.colorNeutralForeground2,\n },\n [`:enabled:hover .${tabClassNames.icon}`]: {\n color: tokens.colorNeutralForeground2Hover,\n },\n [`:enabled:active .${tabClassNames.icon}`]: {\n color: tokens.colorNeutralForeground2Pressed,\n },\n [`& .${tabClassNames.content}`]: {\n color: tokens.colorNeutralForeground2,\n },\n [`:enabled:hover .${tabClassNames.content}`]: {\n color: tokens.colorNeutralForeground2Hover,\n },\n [`:enabled:active .${tabClassNames.content}`]: {\n color: tokens.colorNeutralForeground2Pressed,\n },\n },\n disabledCursor: {\n cursor: 'not-allowed',\n },\n disabled: {\n backgroundColor: tokens.colorTransparentBackground,\n\n [`& .${tabClassNames.icon}`]: {\n color: tokens.colorNeutralForegroundDisabled,\n },\n [`& .${tabClassNames.content}`]: {\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n selected: {\n [`& .${tabClassNames.icon}`]: {\n color: tokens.colorCompoundBrandForeground1,\n },\n [`:enabled:hover .${tabClassNames.icon}`]: {\n color: tokens.colorCompoundBrandForeground1Hover,\n },\n [`:enabled:active .${tabClassNames.icon}`]: {\n color: tokens.colorCompoundBrandForeground1Pressed,\n },\n [`& .${tabClassNames.content}`]: {\n color: tokens.colorNeutralForeground1,\n },\n [`:enabled:hover .${tabClassNames.content}`]: {\n color: tokens.colorNeutralForeground1Hover,\n },\n [`:enabled:active .${tabClassNames.content}`]: {\n color: tokens.colorNeutralForeground1Pressed,\n },\n },\n});\n\nconst useCircularAppearanceStyles = makeStyles({\n base: {\n borderRadius: tokens.borderRadiusCircular,\n border: `solid ${tokens.strokeWidthThin} ${tokens.colorTransparentStroke}`,\n [`& .${tabClassNames.icon}`]: {\n color: 'inherit',\n },\n [`& .${tabClassNames.content}`]: {\n color: 'inherit',\n },\n },\n medium: {\n paddingBlock: `${tokens.spacingVerticalSNudge}`,\n },\n subtle: {\n backgroundColor: tokens.colorSubtleBackground,\n color: tokens.colorNeutralForeground2,\n ':enabled:hover': {\n backgroundColor: tokens.colorSubtleBackgroundHover,\n border: `solid ${tokens.strokeWidthThin} ${tokens.colorNeutralStroke1Hover}`,\n color: tokens.colorNeutralForeground2Hover,\n },\n ':enabled:active': {\n backgroundColor: tokens.colorSubtleBackgroundPressed,\n border: `solid ${tokens.strokeWidthThin} ${tokens.colorNeutralStroke1Pressed}`,\n color: tokens.colorNeutralForeground2Pressed,\n },\n '@media (forced-colors: active)': {\n border: `solid ${tokens.strokeWidthThin} Canvas`,\n },\n },\n subtleSelected: {\n backgroundColor: tokens.colorBrandBackground2,\n border: `solid ${tokens.strokeWidthThin} ${tokens.colorCompoundBrandStroke}`,\n color: tokens.colorBrandForeground2,\n ':enabled:hover': {\n backgroundColor: tokens.colorBrandBackground2Hover,\n border: `solid ${tokens.strokeWidthThin} ${tokens.colorCompoundBrandStrokeHover}`,\n color: tokens.colorBrandForeground2Hover,\n },\n ':enabled:active': {\n backgroundColor: tokens.colorBrandBackground2Pressed,\n border: `solid ${tokens.strokeWidthThin} ${tokens.colorCompoundBrandStrokePressed}`,\n color: tokens.colorBrandForeground2Pressed,\n },\n '@media (forced-colors: active)': {\n border: `solid ${tokens.strokeWidthThin} Highlight`,\n },\n },\n subtleDisabled: {\n backgroundColor: tokens.colorSubtleBackground,\n color: tokens.colorNeutralForegroundDisabled,\n },\n subtleDisabledSelected: {\n backgroundColor: tokens.colorNeutralBackgroundDisabled,\n border: `solid ${tokens.strokeWidthThin} ${tokens.colorNeutralStrokeDisabled}`,\n color: tokens.colorNeutralForegroundDisabled,\n },\n filled: {\n backgroundColor: tokens.colorNeutralBackground3,\n color: tokens.colorNeutralForeground2,\n ':enabled:hover': {\n backgroundColor: tokens.colorNeutralBackground3Hover,\n color: tokens.colorNeutralForeground2Hover,\n },\n ':enabled:active': {\n backgroundColor: tokens.colorNeutralBackground3Pressed,\n color: tokens.colorNeutralForeground2Pressed,\n },\n '@media (forced-colors: active)': {\n ':enabled:hover': {\n backgroundColor: 'Highlight',\n forcedColorAdjust: 'none',\n [`& .${tabClassNames.content}`]: {\n color: 'HighlightText',\n },\n [`& .${iconClassNames.filled}`]: {\n color: 'HighlightText',\n },\n [`& .${iconClassNames.regular}`]: {\n color: 'HighlightText',\n },\n },\n },\n },\n filledSelected: {\n backgroundColor: tokens.colorBrandBackground,\n color: tokens.colorNeutralForegroundOnBrand,\n ':enabled:hover': {\n backgroundColor: tokens.colorBrandBackgroundHover,\n color: tokens.colorNeutralForegroundOnBrand,\n },\n ':enabled:active': {\n backgroundColor: tokens.colorBrandBackgroundPressed,\n color: tokens.colorNeutralForegroundOnBrand,\n },\n '@media (forced-colors: active)': {\n ':enabled': {\n backgroundColor: 'ButtonText',\n [`& .${tabClassNames.content}`]: {\n color: 'ButtonFace',\n forcedColorAdjust: 'none',\n },\n },\n [`:enabled .${tabClassNames.icon}`]: {\n color: 'ButtonFace',\n },\n },\n },\n filledDisabled: {\n backgroundColor: tokens.colorNeutralBackgroundDisabled,\n color: tokens.colorNeutralForegroundDisabled,\n },\n filledDisabledSelected: {\n backgroundColor: tokens.colorNeutralBackgroundDisabled,\n border: `solid ${tokens.strokeWidthThin} ${tokens.colorNeutralStrokeDisabled}`,\n color: tokens.colorNeutralForegroundDisabled,\n },\n});\n\n/**\n * Focus styles for the root slot\n */\nconst useFocusStyles = makeStyles({\n // Tab creates a custom focus indicator because the default focus indicator\n // is applied using an ::after pseudo-element on the root. Since the selection\n // indicator uses an ::after pseudo-element on the root, there is a conflict.\n base: createCustomFocusIndicatorStyle(\n {\n ...shorthands.borderColor('transparent'),\n outlineWidth: tokens.strokeWidthThick,\n outlineColor: 'transparent',\n outlineStyle: 'solid',\n boxShadow: `\n ${tokens.shadow4},\n 0 0 0 ${tokens.strokeWidthThick} ${tokens.colorStrokeFocus2}\n `,\n zIndex: 1,\n },\n { enableOutline: true },\n ),\n circular: createCustomFocusIndicatorStyle(\n {\n ...shorthands.borderColor('transparent'),\n outlineWidth: tokens.strokeWidthThick,\n outlineColor: 'transparent',\n outlineStyle: 'solid',\n boxShadow: `\n ${tokens.shadow4},\n 0 0 0 ${tokens.strokeWidthThick} ${tokens.colorStrokeFocus2},\n 0 0 0 ${tokens.strokeWidthThin} ${tokens.colorNeutralStrokeOnBrand} inset\n `,\n zIndex: 1,\n },\n { enableOutline: true },\n ),\n});\n\n/** Indicator styles for when pending selection */\nconst usePendingIndicatorStyles = makeStyles({\n base: {\n ':hover::before': {\n backgroundColor: tokens.colorNeutralStroke1Hover,\n borderRadius: tokens.borderRadiusCircular,\n content: '\"\"',\n position: 'absolute',\n },\n ':active::before': {\n backgroundColor: tokens.colorNeutralStroke1Pressed,\n borderRadius: tokens.borderRadiusCircular,\n content: '\"\"',\n position: 'absolute',\n },\n '@media (forced-colors: active)': {\n ':hover::before': {\n backgroundColor: 'Highlight',\n },\n ':active::before': {\n backgroundColor: 'Highlight',\n },\n },\n },\n disabled: {\n ':hover::before': {\n backgroundColor: tokens.colorTransparentStroke,\n },\n ':active::before': {\n backgroundColor: tokens.colorTransparentStroke,\n },\n '@media (forced-colors: active)': {\n ':hover::before': {\n backgroundColor: 'transparent',\n },\n ':active::before': {\n backgroundColor: 'transparent',\n },\n },\n },\n smallHorizontal: {\n '::before': {\n bottom: 0,\n height: tokens.strokeWidthThick,\n left: tokens.spacingHorizontalSNudge,\n right: tokens.spacingHorizontalSNudge,\n },\n },\n smallVertical: {\n '::before': {\n bottom: tokens.spacingVerticalXS,\n left: 0,\n top: tokens.spacingVerticalXS,\n width: tokens.strokeWidthThicker,\n },\n },\n mediumHorizontal: {\n '::before': {\n bottom: 0,\n height: tokens.strokeWidthThicker,\n left: tokens.spacingHorizontalM,\n right: tokens.spacingHorizontalM,\n },\n },\n mediumVertical: {\n '::before': {\n bottom: tokens.spacingVerticalS,\n left: 0,\n top: tokens.spacingVerticalS,\n width: tokens.strokeWidthThicker,\n },\n },\n largeHorizontal: {\n '::before': {\n bottom: 0,\n height: tokens.strokeWidthThicker,\n left: tokens.spacingHorizontalM,\n right: tokens.spacingHorizontalM,\n },\n },\n largeVertical: {\n '::before': {\n bottom: tokens.spacingVerticalMNudge,\n left: 0,\n top: tokens.spacingVerticalMNudge,\n width: tokens.strokeWidthThicker,\n },\n },\n});\n\nconst useActiveIndicatorStyles = makeStyles({\n base: {\n '::after': {\n backgroundColor: tokens.colorTransparentStroke,\n borderRadius: tokens.borderRadiusCircular,\n content: '\"\"',\n position: 'absolute',\n },\n },\n selected: {\n '::after': {\n backgroundColor: tokens.colorCompoundBrandStroke,\n },\n ':enabled:hover::after': {\n backgroundColor: tokens.colorCompoundBrandStrokeHover,\n },\n ':enabled:active::after': {\n backgroundColor: tokens.colorCompoundBrandStrokePressed,\n },\n '@media (forced-colors: active)': {\n '::after': {\n backgroundColor: 'ButtonText',\n },\n ':enabled:hover::after': {\n backgroundColor: 'ButtonText',\n },\n ':enabled:active::after': {\n backgroundColor: 'ButtonText',\n },\n },\n },\n disabled: {\n '::after': {\n backgroundColor: tokens.colorNeutralForegroundDisabled,\n },\n },\n smallHorizontal: {\n '::after': {\n bottom: 0,\n height: tokens.strokeWidthThick,\n left: tokens.spacingHorizontalSNudge,\n right: tokens.spacingHorizontalSNudge,\n },\n },\n smallVertical: {\n '::after': {\n bottom: tokens.spacingVerticalXS,\n left: '0',\n top: tokens.spacingVerticalXS,\n width: tokens.strokeWidthThicker,\n },\n },\n mediumHorizontal: {\n '::after': {\n bottom: '0',\n height: tokens.strokeWidthThicker,\n left: tokens.spacingHorizontalM,\n right: tokens.spacingHorizontalM,\n },\n },\n mediumVertical: {\n '::after': {\n bottom: tokens.spacingVerticalS,\n left: 0,\n top: tokens.spacingVerticalS,\n width: tokens.strokeWidthThicker,\n },\n },\n largeHorizontal: {\n '::after': {\n bottom: 0,\n height: tokens.strokeWidthThicker,\n left: tokens.spacingHorizontalM,\n right: tokens.spacingHorizontalM,\n },\n },\n largeVertical: {\n '::after': {\n bottom: tokens.spacingVerticalMNudge,\n left: 0,\n top: tokens.spacingVerticalMNudge,\n width: tokens.strokeWidthThicker,\n },\n },\n});\n\n/**\n * Styles for the icon slot.\n */\nconst useIconStyles = makeStyles({\n base: {\n gridColumnStart: 1,\n gridRowStart: 1,\n alignItems: 'center',\n display: 'inline-flex',\n justifyContent: 'center',\n overflow: 'hidden',\n [`& .${iconClassNames.filled}`]: {\n display: 'none',\n },\n [`& .${iconClassNames.regular}`]: {\n display: 'inline',\n },\n },\n // per design, the small and medium font sizes are the same.\n // the size prop only affects spacing.\n small: {\n fontSize: '20px',\n height: '20px',\n width: '20px',\n },\n medium: {\n fontSize: '20px',\n height: '20px',\n width: '20px',\n },\n large: {\n fontSize: '24px',\n height: '24px',\n width: '24px',\n },\n selected: {\n [`& .${iconClassNames.filled}`]: {\n display: 'inline',\n },\n [`& .${iconClassNames.regular}`]: {\n display: 'none',\n },\n },\n});\n\n/**\n * Styles for the content slot (children)\n */\nconst useContentStyles = makeStyles({\n base: {\n ...typographyStyles.body1,\n overflow: 'hidden',\n // content padding is the same for medium & small, horizontal & vertical\n padding: `${tokens.spacingVerticalNone} ${tokens.spacingHorizontalXXS}`,\n },\n selected: {\n ...typographyStyles.body1Strong,\n },\n large: {\n ...typographyStyles.body2,\n },\n largeSelected: {\n ...typographyStyles.subtitle2,\n },\n noIconBefore: {\n gridColumnStart: 1,\n gridRowStart: 1,\n },\n iconBefore: {\n gridColumnStart: 2,\n gridRowStart: 1,\n },\n placeholder: {\n visibility: 'hidden',\n },\n});\n\n/**\n * Apply styling to the Tab slots based on the state\n */\nexport const useTabStyles_unstable = (state: TabState): TabState => {\n 'use no memo';\n\n useTabIndicatorStyles_unstable(state);\n\n useTabButtonStyles_unstable(state, state.root);\n\n useTabContentStyles_unstable(state);\n\n return state;\n};\n\n/**\n * Applies styles for the Tab indicator based on its current state.\n *\n * This hook is typically used internally by `useTabStyles_unstable`. You should\n * only use it directly if you're creating a custom `Tab` component.\n *\n * @param state - The `Tab` component's current state\n * @returns The state object with updated button styles\n */\nexport const useTabIndicatorStyles_unstable = (state: TabState): TabState => {\n 'use no memo';\n\n const rootStyles = useRootStyles();\n const pendingIndicatorStyles = usePendingIndicatorStyles();\n const activeIndicatorStyles = useActiveIndicatorStyles();\n\n const { appearance, disabled, selected, size, vertical } = state;\n\n const classes: Parameters<typeof mergeClasses> = [tabClassNames.root, rootStyles.root];\n\n if (appearance !== 'subtle-circular' && appearance !== 'filled-circular') {\n classes.push(\n // pending indicator (before pseudo element)\n pendingIndicatorStyles.base,\n size === 'small' && (vertical ? pendingIndicatorStyles.smallVertical : pendingIndicatorStyles.smallHorizontal),\n size === 'medium' && (vertical ? pendingIndicatorStyles.mediumVertical : pendingIndicatorStyles.mediumHorizontal),\n size === 'large' && (vertical ? pendingIndicatorStyles.largeVertical : pendingIndicatorStyles.largeHorizontal),\n disabled && pendingIndicatorStyles.disabled,\n\n // active indicator (after pseudo element)\n selected && activeIndicatorStyles.base,\n selected && !disabled && activeIndicatorStyles.selected,\n selected &&\n size === 'small' &&\n (vertical ? activeIndicatorStyles.smallVertical : activeIndicatorStyles.smallHorizontal),\n selected &&\n size === 'medium' &&\n (vertical ? activeIndicatorStyles.mediumVertical : activeIndicatorStyles.mediumHorizontal),\n selected &&\n size === 'large' &&\n (vertical ? activeIndicatorStyles.largeVertical : activeIndicatorStyles.largeHorizontal),\n selected && disabled && activeIndicatorStyles.disabled,\n );\n }\n\n state.root.className = mergeClasses(...classes, state.root.className);\n\n useTabAnimatedIndicatorStyles_unstable(state);\n\n return state;\n};\n\n/**\n * Applies styles to the Tab button slot based on its current state.\n *\n * This hook is typically used internally by `useTabStyles_unstable`. You should\n * only use it directly if you're creating a custom `Tab` component.\n *\n * @param state - The Tab component's current state\n * @param slot - The button slot of the Tab component\n * @returns The state object with updated button styles\n */\nexport const useTabButtonStyles_unstable = (state: TabState, slot: TabState['root']): TabState => {\n 'use no memo';\n\n const rootStyles = useRootStyles();\n const focusStyles = useFocusStyles();\n const circularStyles = useCircularAppearanceStyles();\n\n const { appearance, disabled, selected, size, vertical } = state;\n\n const isSubtleCircular = appearance === 'subtle-circular';\n const isFilledCircular = appearance === 'filled-circular';\n const isCircular = isSubtleCircular || isFilledCircular;\n\n const circularAppearance = [\n circularStyles.base,\n focusStyles.circular,\n // sizes\n size === 'medium' && circularStyles.medium,\n // subtle-circular appearance\n isSubtleCircular && circularStyles.subtle,\n selected && isSubtleCircular && circularStyles.subtleSelected,\n disabled && isSubtleCircular && circularStyles.subtleDisabled,\n selected && disabled && isSubtleCircular && circularStyles.subtleDisabledSelected,\n // filled-circular appearance\n isFilledCircular && circularStyles.filled,\n selected && isFilledCircular && circularStyles.filledSelected,\n disabled && isFilledCircular && circularStyles.filledDisabled,\n selected && disabled && isFilledCircular && circularStyles.filledDisabledSelected,\n ];\n\n const regularAppearance = [\n focusStyles.base,\n !disabled && appearance === 'subtle' && rootStyles.subtle,\n !disabled && appearance === 'transparent' && rootStyles.transparent,\n !disabled && selected && rootStyles.selected,\n disabled && rootStyles.disabled,\n ];\n\n slot.className = mergeClasses(\n rootStyles.button,\n // orientation\n vertical ? rootStyles.vertical : rootStyles.horizontal,\n // size\n size === 'small' && (vertical ? rootStyles.smallVertical : rootStyles.smallHorizontal),\n size === 'medium' && (vertical ? rootStyles.mediumVertical : rootStyles.mediumHorizontal),\n size === 'large' && (vertical ? rootStyles.largeVertical : rootStyles.largeHorizontal),\n ...(isCircular ? circularAppearance : regularAppearance),\n disabled && rootStyles.disabledCursor,\n slot.className,\n );\n\n return state;\n};\n\n/**\n * Applies styles to the Tab content slot based on its current state.\n *\n * This hook is typically used internally by `useTabStyles_unstable`. You should\n * only use it directly if you're creating a custom `Tab` component.\n *\n * @param state - The Tab component's current state\n * @returns The state object with updated content styles\n */\nexport const useTabContentStyles_unstable = (state: TabState): TabState => {\n 'use no memo';\n\n const iconStyles = useIconStyles();\n const contentStyles = useContentStyles();\n\n const { selected, size } = state;\n\n if (state.icon) {\n state.icon.className = mergeClasses(\n tabClassNames.icon,\n iconStyles.base,\n iconStyles[size],\n selected && iconStyles.selected,\n state.icon.className,\n );\n }\n\n // This needs to be before state.content.className is updated\n if (state.contentReservedSpace) {\n state.contentReservedSpace.className = mergeClasses(\n reservedSpaceClassNames.content,\n contentStyles.base,\n size === 'large' ? contentStyles.largeSelected : contentStyles.selected,\n state.icon ? contentStyles.iconBefore : contentStyles.noIconBefore,\n contentStyles.placeholder,\n state.content.className,\n );\n // FIXME: this is a deprecated API\n // should be removed in the next major version\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n state.contentReservedSpaceClassName = state.contentReservedSpace.className;\n }\n\n state.content.className = mergeClasses(\n tabClassNames.content,\n contentStyles.base,\n size === 'large' && contentStyles.large,\n selected && (size === 'large' ? contentStyles.largeSelected : contentStyles.selected),\n state.icon ? contentStyles.iconBefore : contentStyles.noIconBefore,\n state.content.className,\n );\n\n return state;\n};\n"],"names":["makeStyles","mergeClasses","shorthands","createCustomFocusIndicatorStyle","tokens","typographyStyles","useTabAnimatedIndicatorStyles_unstable","tabClassNames","root","icon","content","reservedSpaceClassNames","iconClassNames","filled","regular","useRootStyles","alignItems","display","flexShrink","gridAutoFlow","gridTemplateColumns","gridTemplateRows","outlineStyle","position","button","border","borderRadius","borderRadiusMedium","cursor","fontFamily","fontFamilyBase","lineHeight","lineHeightBase300","overflow","textTransform","horizontal","justifyContent","vertical","smallHorizontal","columnGap","spacingHorizontalXXS","padding","spacingVerticalSNudge","spacingHorizontalSNudge","smallVertical","spacingVerticalXXS","mediumHorizontal","spacingVerticalM","spacingHorizontalMNudge","mediumVertical","largeHorizontal","spacingVerticalL","largeVertical","spacingVerticalS","transparent","backgroundColor","colorTransparentBackground","colorTransparentBackgroundHover","colorTransparentBackgroundPressed","color","colorNeutralForeground2","colorNeutralForeground2Hover","colorNeutralForeground2Pressed","subtle","colorSubtleBackground","colorSubtleBackgroundHover","colorSubtleBackgroundPressed","disabledCursor","disabled","colorNeutralForegroundDisabled","selected","colorCompoundBrandForeground1","colorCompoundBrandForeground1Hover","colorCompoundBrandForeground1Pressed","colorNeutralForeground1","colorNeutralForeground1Hover","colorNeutralForeground1Pressed","useCircularAppearanceStyles","base","borderRadiusCircular","strokeWidthThin","colorTransparentStroke","medium","paddingBlock","colorNeutralStroke1Hover","colorNeutralStroke1Pressed","subtleSelected","colorBrandBackground2","colorCompoundBrandStroke","colorBrandForeground2","colorBrandBackground2Hover","colorCompoundBrandStrokeHover","colorBrandForeground2Hover","colorBrandBackground2Pressed","colorCompoundBrandStrokePressed","colorBrandForeground2Pressed","subtleDisabled","subtleDisabledSelected","colorNeutralBackgroundDisabled","colorNeutralStrokeDisabled","colorNeutralBackground3","colorNeutralBackground3Hover","colorNeutralBackground3Pressed","forcedColorAdjust","filledSelected","colorBrandBackground","colorNeutralForegroundOnBrand","colorBrandBackgroundHover","colorBrandBackgroundPressed","filledDisabled","filledDisabledSelected","useFocusStyles","borderColor","outlineWidth","strokeWidthThick","outlineColor","boxShadow","shadow4","colorStrokeFocus2","zIndex","enableOutline","circular","colorNeutralStrokeOnBrand","usePendingIndicatorStyles","bottom","height","left","right","spacingVerticalXS","top","width","strokeWidthThicker","spacingHorizontalM","spacingVerticalMNudge","useActiveIndicatorStyles","useIconStyles","gridColumnStart","gridRowStart","small","fontSize","large","useContentStyles","body1","spacingVerticalNone","body1Strong","body2","largeSelected","subtitle2","noIconBefore","iconBefore","placeholder","visibility","useTabStyles_unstable","state","useTabIndicatorStyles_unstable","useTabButtonStyles_unstable","useTabContentStyles_unstable","rootStyles","pendingIndicatorStyles","activeIndicatorStyles","appearance","size","classes","push","className","slot","focusStyles","circularStyles","isSubtleCircular","isFilledCircular","isCircular","circularAppearance","regularAppearance","iconStyles","contentStyles","contentReservedSpace","contentReservedSpaceClassName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAK,EACvCtE,YAAa2F,CAAAA,SAAS,UAAUa,cAAc5B,aAAa,GAAG4B,cAAcxG,QAAQ,AAAD,GACnFmF,MAAMhJ,IAAI,GAAGqK,cAAczB,UAAU,GAAGyB,cAAc1B,YAAY,EAClEK,MAAM/I,OAAO,CAAC0J,SAAS;IAGzB,OAAOX;AACT,EAAE"}
@@ -0,0 +1,40 @@
1
+ import { makeStyles, mergeClasses } from '@griffel/react';
2
+ import { tokens } from '@fluentui/react-theme';
3
+ export const tabListClassNames = {
4
+ root: 'fui-TabList'
5
+ };
6
+ /**
7
+ * Styles for the root slot
8
+ */ const useStyles = makeStyles({
9
+ root: {
10
+ display: 'flex',
11
+ flexDirection: 'row',
12
+ flexShrink: 0,
13
+ flexWrap: 'nowrap',
14
+ position: 'relative'
15
+ },
16
+ horizontal: {
17
+ alignItems: 'stretch',
18
+ flexDirection: 'row'
19
+ },
20
+ vertical: {
21
+ alignItems: 'stretch',
22
+ flexDirection: 'column'
23
+ },
24
+ roundedSmall: {
25
+ gap: tokens.spacingHorizontalSNudge
26
+ },
27
+ rounded: {
28
+ gap: tokens.spacingHorizontalS
29
+ }
30
+ });
31
+ /**
32
+ * Apply styling to the TabList slots based on the state
33
+ */ export const useTabListStyles_unstable = (state)=>{
34
+ 'use no memo';
35
+ const { appearance, vertical, size } = state;
36
+ const styles = useStyles();
37
+ const isRounded = appearance === 'subtle-circular' || appearance === 'filled-circular';
38
+ state.root.className = mergeClasses(tabListClassNames.root, styles.root, vertical ? styles.vertical : styles.horizontal, isRounded && (size === 'small' ? styles.roundedSmall : styles.rounded), state.root.className);
39
+ return state;
40
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/TabList/useTabListStyles.styles.ts"],"sourcesContent":["import { SlotClassNames } from '@fluentui/react-utilities';\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport type { TabListSlots, TabListState } from './TabList.types';\n\nexport const tabListClassNames: SlotClassNames<TabListSlots> = {\n root: 'fui-TabList',\n};\n\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n root: {\n display: 'flex',\n flexDirection: 'row',\n flexShrink: 0,\n flexWrap: 'nowrap',\n position: 'relative',\n },\n horizontal: {\n alignItems: 'stretch',\n flexDirection: 'row',\n },\n vertical: {\n alignItems: 'stretch',\n flexDirection: 'column',\n },\n roundedSmall: {\n gap: tokens.spacingHorizontalSNudge,\n },\n rounded: {\n gap: tokens.spacingHorizontalS,\n },\n});\n\n/**\n * Apply styling to the TabList slots based on the state\n */\nexport const useTabListStyles_unstable = (state: TabListState): TabListState => {\n 'use no memo';\n\n const { appearance, vertical, size } = state;\n\n const styles = useStyles();\n\n const isRounded = appearance === 'subtle-circular' || appearance === 'filled-circular';\n\n state.root.className = mergeClasses(\n tabListClassNames.root,\n styles.root,\n vertical ? styles.vertical : styles.horizontal,\n isRounded && (size === 'small' ? styles.roundedSmall : styles.rounded),\n state.root.className,\n );\n\n return state;\n};\n"],"names":["makeStyles","mergeClasses","tokens","tabListClassNames","root","useStyles","display","flexDirection","flexShrink","flexWrap","position","horizontal","alignItems","vertical","roundedSmall","gap","spacingHorizontalSNudge","rounded","spacingHorizontalS","useTabListStyles_unstable","state","appearance","size","styles","isRounded","className"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AACA,SAASA,UAAU,EAAEC,YAAY,QAAQ,iBAAiB;AAC1D,SAASC,MAAM,QAAQ,wBAAwB;AAG/C,OAAO,MAAMC,oBAAkD;IAC7DC,MAAM;AACR,EAAE;AAEF;;CAEC,GACD,MAAMC,YAAYL,WAAW;IAC3BI,MAAM;QACJE,SAAS;QACTC,eAAe;QACfC,YAAY;QACZC,UAAU;QACVC,UAAU;IACZ;IACAC,YAAY;QACVC,YAAY;QACZL,eAAe;IACjB;IACAM,UAAU;QACRD,YAAY;QACZL,eAAe;IACjB;IACAO,cAAc;QACZC,KAAKb,OAAOc,uBAAuB;IACrC;IACAC,SAAS;QACPF,KAAKb,OAAOgB,kBAAkB;IAChC;AACF;AAEA;;CAEC,GACD,OAAO,MAAMC,4BAA4B,CAACC;IACxC;IAEA,MAAM,EAAEC,UAAU,EAAER,QAAQ,EAAES,IAAI,EAAE,GAAGF;IAEvC,MAAMG,SAASlB;IAEf,MAAMmB,YAAYH,eAAe,qBAAqBA,eAAe;IAErED,MAAMhB,IAAI,CAACqB,SAAS,GAAGxB,aACrBE,kBAAkBC,IAAI,EACtBmB,OAAOnB,IAAI,EACXS,WAAWU,OAAOV,QAAQ,GAAGU,OAAOZ,UAAU,EAC9Ca,aAAcF,CAAAA,SAAS,UAAUC,OAAOT,YAAY,GAAGS,OAAON,OAAO,AAAD,GACpEG,MAAMhB,IAAI,CAACqB,SAAS;IAGtB,OAAOL;AACT,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Tab/useTab.ts"],"sourcesContent":["import * as React from 'react';\nimport { useTabsterAttributes } from '@fluentui/react-tabster';\nimport {\n getIntrinsicElementProps,\n mergeCallbacks,\n useEventCallback,\n useMergedRefs,\n slot,\n omit,\n} from '@fluentui/react-utilities';\nimport type { TabProps, TabState } from './Tab.types';\nimport { useTabListContext_unstable } from '../TabList/TabListContext';\nimport { SelectTabEvent } from '../TabList/TabList.types';\n\n/**\n * Create the state required to render Tab.\n *\n * The returned state can be modified with hooks such as useTabStyles_unstable,\n * before being passed to renderTab_unstable.\n *\n * @param props - props from this instance of Tab\n * @param ref - reference to root HTMLElement of Tab\n */\nexport const useTab_unstable = (props: TabProps, ref: React.Ref<HTMLElement>): TabState => {\n const { content, disabled: tabDisabled = false, icon, onClick, onFocus, value } = props;\n\n const appearance = useTabListContext_unstable(ctx => ctx.appearance);\n const reserveSelectedTabSpace = useTabListContext_unstable(ctx => ctx.reserveSelectedTabSpace);\n const selectTabOnFocus = useTabListContext_unstable(ctx => ctx.selectTabOnFocus);\n const listDisabled = useTabListContext_unstable(ctx => ctx.disabled);\n const selected = useTabListContext_unstable(ctx => ctx.selectedValue === value);\n const onRegister = useTabListContext_unstable(ctx => ctx.onRegister);\n const onUnregister = useTabListContext_unstable(ctx => ctx.onUnregister);\n const onSelect = useTabListContext_unstable(ctx => ctx.onSelect);\n const size = useTabListContext_unstable(ctx => ctx.size);\n const vertical = useTabListContext_unstable(ctx => !!ctx.vertical);\n const disabled = listDisabled || tabDisabled;\n\n const innerRef = React.useRef<HTMLElement>(null);\n const onSelectCallback = (event: SelectTabEvent) => onSelect(event, { value });\n const onTabClick = useEventCallback(mergeCallbacks(onClick, onSelectCallback));\n const onTabFocus = useEventCallback(mergeCallbacks(onFocus, onSelectCallback));\n\n const focusProps = useTabsterAttributes({\n focusable: { isDefault: selected },\n });\n\n React.useEffect(() => {\n onRegister({\n value,\n ref: innerRef,\n });\n\n return () => {\n onUnregister({ value, ref: innerRef });\n };\n }, [onRegister, onUnregister, innerRef, value]);\n\n const iconSlot = slot.optional(icon, { elementType: 'span' });\n const contentSlot = slot.always(content, {\n defaultProps: { children: props.children },\n elementType: 'span',\n });\n const contentReservedSpace: typeof content =\n content && typeof content === 'object' ? omit(content, ['ref' as keyof typeof content]) : content;\n const iconOnly = Boolean(iconSlot?.children && !contentSlot.children);\n return {\n components: { root: 'button', icon: 'span', content: 'span', contentReservedSpace: 'span' },\n root: slot.always(\n getIntrinsicElementProps('button', {\n // FIXME:\n // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLButtonElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: useMergedRefs(ref, innerRef) as React.Ref<HTMLButtonElement>,\n role: 'tab',\n type: 'button',\n // aria-selected undefined indicates it is not selectable\n // according to https://www.w3.org/TR/wai-aria-1.1/#aria-selected\n 'aria-selected': disabled ? undefined : (`${selected}` as 'true' | 'false'),\n ...focusProps,\n ...props,\n disabled,\n onClick: onTabClick,\n onFocus: selectTabOnFocus ? onTabFocus : onFocus,\n }),\n { elementType: 'button' },\n ),\n icon: iconSlot,\n iconOnly,\n content: contentSlot,\n contentReservedSpace: slot.optional(contentReservedSpace, {\n renderByDefault: !selected && !iconOnly && reserveSelectedTabSpace,\n defaultProps: { children: props.children },\n elementType: 'span',\n }),\n appearance,\n disabled,\n selected,\n size,\n value,\n vertical,\n };\n};\n"],"names":["useTab_unstable","props","ref","content","disabled","tabDisabled","icon","onClick","onFocus","value","appearance","useTabListContext_unstable","ctx","reserveSelectedTabSpace","selectTabOnFocus","listDisabled","selected","selectedValue","onRegister","onUnregister","onSelect","size","vertical","innerRef","React","useRef","onSelectCallback","event","onTabClick","useEventCallback","mergeCallbacks","onTabFocus","focusProps","useTabsterAttributes","focusable","isDefault","useEffect","iconSlot","slot","optional","elementType","contentSlot","always","defaultProps","children","contentReservedSpace","omit","iconOnly","Boolean","components","root","getIntrinsicElementProps","useMergedRefs","role","type","undefined","renderByDefault"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAuBaA;;;eAAAA;;;;iEAvBU;8BACc;gCAQ9B;gCAEoC;AAYpC,MAAMA,kBAAkB,CAACC,OAAiBC;IAC/C,MAAM,EAAEC,OAAO,EAAEC,UAAUC,cAAc,KAAK,EAAEC,IAAI,EAAEC,OAAO,EAAEC,OAAO,EAAEC,KAAK,EAAE,GAAGR;IAElF,MAAMS,aAAaC,IAAAA,0CAAAA,EAA2BC,CAAAA,MAAOA,IAAIF,UAAU;IACnE,MAAMG,0BAA0BF,IAAAA,0CAAAA,EAA2BC,CAAAA,MAAOA,IAAIC,uBAAuB;IAC7F,MAAMC,mBAAmBH,IAAAA,0CAAAA,EAA2BC,CAAAA,MAAOA,IAAIE,gBAAgB;IAC/E,MAAMC,eAAeJ,IAAAA,0CAAAA,EAA2BC,CAAAA,MAAOA,IAAIR,QAAQ;IACnE,MAAMY,WAAWL,IAAAA,0CAAAA,EAA2B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,EAAK3C,SAAS;QAAC;KAA8B,IAAIA;IAC5F,MAAM4C,WAAWC,QAAQX,CAAAA,aAAAA,QAAAA,aAAAA,KAAAA,IAAAA,KAAAA,IAAAA,SAAUO,QAAQ,AAARA,KAAY,CAACH,YAAYG,QAAQ;IACpE,OAAO;QACLK,YAAY;YAAEC,MAAM;YAAU5C,MAAM;YAAQH,SAAS;YAAQ0C,sBAAsB;QAAO;QAC1FK,MAAMZ,oBAAAA,CAAKI,MAAM,CACfS,IAAAA,wCAAAA,EAAyB,UAAU;YACjC,SAAS;YACT,+EAA+E;YAC/E,4FAA4F;YAC5FjD,KAAKkD,IAAAA,6BAAAA,EAAclD,KAAKqB;YACxB8B,MAAM;YACNC,MAAM;YACN,yDAAyD;YACzD,iEAAiE;YACjE,iBAAiBlD,WAAWmD,YAAa,CAAC,EAAEvC,SAAS,CAAC;YACtD,GAAGgB,UAAU;YACb,GAAG/B,KAAK;YACRG;YACAG,SAASqB;YACTpB,SAASM,mBAAmBiB,aAAavB;QAC3C,IACA;YAAEgC,aAAa;QAAS;QAE1BlC,MAAM+B;QACNU;QACA5C,SAASsC;QACTI,sBAAsBP,oBAAAA,CAAKC,QAAQ,CAACM,sBAAsB;YACxDW,iBAAiB,CAACxC,YAAY,CAAC+B,YAAYlC;YAC3C8B,cAAc;gBAAEC,UAAU3C,MAAM2C,QAAQ;YAAC;YACzCJ,aAAa;QACf;QACA9B;QACAN;QACAY;QACAK;QACAZ;QACAa;IACF;AACF"}
1
+ {"version":3,"sources":["../src/components/Tab/useTab.ts"],"sourcesContent":["import * as React from 'react';\nimport { useTabsterAttributes } from '@fluentui/react-tabster';\nimport {\n getIntrinsicElementProps,\n mergeCallbacks,\n useEventCallback,\n useMergedRefs,\n slot,\n omit,\n} from '@fluentui/react-utilities';\nimport type { TabProps, TabState } from './Tab.types';\nimport { useTabListContext_unstable } from '../TabList/TabListContext';\nimport { SelectTabEvent } from '../TabList/TabList.types';\n\n/**\n * Create the state required to render Tab.\n *\n * The returned state can be modified with hooks such as useTabStyles_unstable,\n * before being passed to renderTab_unstable.\n *\n * @param props - props from this instance of Tab\n * @param ref - reference to root HTMLElement of Tab\n */\nexport const useTab_unstable = (props: TabProps, ref: React.Ref<HTMLElement>): TabState => {\n const { content, disabled: tabDisabled = false, icon, onClick, onFocus, value } = props;\n\n const appearance = useTabListContext_unstable(ctx => ctx.appearance);\n const reserveSelectedTabSpace = useTabListContext_unstable(ctx => ctx.reserveSelectedTabSpace);\n const selectTabOnFocus = useTabListContext_unstable(ctx => ctx.selectTabOnFocus);\n const listDisabled = useTabListContext_unstable(ctx => ctx.disabled);\n const selected = useTabListContext_unstable(ctx => ctx.selectedValue === value);\n const onRegister = useTabListContext_unstable(ctx => ctx.onRegister);\n const onUnregister = useTabListContext_unstable(ctx => ctx.onUnregister);\n const onSelect = useTabListContext_unstable(ctx => ctx.onSelect);\n const size = useTabListContext_unstable(ctx => ctx.size);\n const vertical = useTabListContext_unstable(ctx => !!ctx.vertical);\n const disabled = listDisabled || tabDisabled;\n\n const innerRef = React.useRef<HTMLElement>(null);\n const onSelectCallback = (event: SelectTabEvent) => onSelect(event, { value });\n const onTabClick = useEventCallback(mergeCallbacks(onClick, onSelectCallback));\n const onTabFocus = useEventCallback(mergeCallbacks(onFocus, onSelectCallback));\n\n const focusProps = useTabsterAttributes({\n focusable: { isDefault: selected },\n });\n\n React.useEffect(() => {\n onRegister({\n value,\n ref: innerRef,\n });\n\n return () => {\n onUnregister({ value, ref: innerRef });\n };\n }, [onRegister, onUnregister, innerRef, value]);\n\n const iconSlot = slot.optional(icon, { elementType: 'span' });\n const contentSlot = slot.always(content, {\n defaultProps: { children: props.children },\n elementType: 'span',\n });\n const contentReservedSpace: typeof content =\n content && typeof content === 'object' ? omit(content, ['ref' as keyof typeof content]) : content;\n const iconOnly = Boolean(iconSlot?.children && !contentSlot.children);\n return {\n components: { root: 'button', icon: 'span', content: 'span', contentReservedSpace: 'span' },\n root: slot.always(\n getIntrinsicElementProps('button', {\n // FIXME:\n // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLButtonElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: useMergedRefs(ref, innerRef) as React.Ref<HTMLButtonElement>,\n role: 'tab',\n type: 'button',\n // aria-selected undefined indicates it is not selectable\n // according to https://www.w3.org/TR/wai-aria-1.1/#aria-selected\n 'aria-selected': disabled ? undefined : (`${selected}` as 'true' | 'false'),\n ...focusProps,\n ...props,\n disabled,\n onClick: onTabClick,\n onFocus: selectTabOnFocus ? onTabFocus : onFocus,\n }),\n { elementType: 'button' },\n ) as TabState['root'],\n icon: iconSlot,\n iconOnly,\n content: contentSlot,\n contentReservedSpace: slot.optional(contentReservedSpace, {\n renderByDefault: !selected && !iconOnly && reserveSelectedTabSpace,\n defaultProps: { children: props.children },\n elementType: 'span',\n }),\n appearance,\n disabled,\n selected,\n size,\n value,\n vertical,\n };\n};\n"],"names":["useTab_unstable","props","ref","content","disabled","tabDisabled","icon","onClick","onFocus","value","appearance","useTabListContext_unstable","ctx","reserveSelectedTabSpace","selectTabOnFocus","listDisabled","selected","selectedValue","onRegister","onUnregister","onSelect","size","vertical","innerRef","React","useRef","onSelectCallback","event","onTabClick","useEventCallback","mergeCallbacks","onTabFocus","focusProps","useTabsterAttributes","focusable","isDefault","useEffect","iconSlot","slot","optional","elementType","contentSlot","always","defaultProps","children","contentReservedSpace","omit","iconOnly","Boolean","components","root","getIntrinsicElementProps","useMergedRefs","role","type","undefined","renderByDefault"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAuBaA;;;eAAAA;;;;iEAvBU;8BACc;gCAQ9B;gCAEoC;AAYpC,MAAMA,kBAAkB,CAACC,OAAiBC;IAC/C,MAAM,EAAEC,OAAO,EAAEC,UAAUC,cAAc,KAAK,EAAEC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,MAAM2C,QAAQ;YAAC;YACzCJ,aAAa;QACf;QACA9B;QACAN;QACAY;QACAK;QACAZ;QACAa;IACF;AACF"}
@@ -0,0 +1,133 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "useTabAnimatedIndicatorStyles_unstable", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return useTabAnimatedIndicatorStyles_unstable;
9
+ }
10
+ });
11
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
13
+ const _react1 = require("@griffel/react");
14
+ const _TabListContext = require("../TabList/TabListContext");
15
+ const _reacttheme = require("@fluentui/react-theme");
16
+ const _reactutilities = require("@fluentui/react-utilities");
17
+ // eslint-disable-next-line @typescript-eslint/naming-convention
18
+ const tabIndicatorCssVars_unstable = {
19
+ offsetVar: '--fui-Tab__indicator--offset',
20
+ scaleVar: '--fui-Tab__indicator--scale'
21
+ };
22
+ const useActiveIndicatorStyles = (0, _react1.makeStyles)({
23
+ base: {
24
+ // overflow is required to allow the selection indicator to animate outside the tab area.
25
+ overflow: 'visible'
26
+ },
27
+ animated: {
28
+ '::after': {
29
+ transitionProperty: 'transform',
30
+ transitionDuration: `${_reacttheme.tokens.durationSlow}`,
31
+ transitionTimingFunction: `${_reacttheme.tokens.curveDecelerateMax}`
32
+ },
33
+ '@media (prefers-reduced-motion: reduce)': {
34
+ '::after': {
35
+ transitionProperty: 'none',
36
+ transitionDuration: '0.01ms'
37
+ }
38
+ }
39
+ },
40
+ horizontal: {
41
+ '::after': {
42
+ transformOrigin: 'left',
43
+ transform: `translateX(var(${tabIndicatorCssVars_unstable.offsetVar}))
44
+ scaleX(var(${tabIndicatorCssVars_unstable.scaleVar}))`
45
+ }
46
+ },
47
+ vertical: {
48
+ '::after': {
49
+ transformOrigin: 'top',
50
+ transform: `translateY(var(${tabIndicatorCssVars_unstable.offsetVar}))
51
+ scaleY(var(${tabIndicatorCssVars_unstable.scaleVar}))`
52
+ }
53
+ }
54
+ });
55
+ const calculateTabRect = (element)=>{
56
+ if (element) {
57
+ var _element_parentElement;
58
+ const parentRect = ((_element_parentElement = element.parentElement) === null || _element_parentElement === void 0 ? void 0 : _element_parentElement.getBoundingClientRect()) || {
59
+ x: 0,
60
+ y: 0,
61
+ width: 0,
62
+ height: 0
63
+ };
64
+ const tabRect = element.getBoundingClientRect();
65
+ return {
66
+ x: tabRect.x - parentRect.x,
67
+ y: tabRect.y - parentRect.y,
68
+ width: tabRect.width,
69
+ height: tabRect.height
70
+ };
71
+ }
72
+ return undefined;
73
+ };
74
+ const getRegisteredTabRect = (registeredTabs, value)=>{
75
+ var _registeredTabs_JSON_stringify;
76
+ const element = isValueDefined(value) ? (_registeredTabs_JSON_stringify = registeredTabs[JSON.stringify(value)]) === null || _registeredTabs_JSON_stringify === void 0 ? void 0 : _registeredTabs_JSON_stringify.ref.current : undefined;
77
+ return element ? calculateTabRect(element) : undefined;
78
+ };
79
+ // eslint-disable-next-line eqeqeq
80
+ const isValueDefined = (value)=>value != null;
81
+ const useTabAnimatedIndicatorStyles_unstable = (state)=>{
82
+ const { disabled, selected, vertical } = state;
83
+ const activeIndicatorStyles = useActiveIndicatorStyles();
84
+ const [lastAnimatedFrom, setLastAnimatedFrom] = _react.useState();
85
+ const [animationValues, setAnimationValues] = _react.useState({
86
+ offset: 0,
87
+ scale: 1
88
+ });
89
+ const getRegisteredTabs = (0, _TabListContext.useTabListContext_unstable)((ctx)=>ctx.getRegisteredTabs);
90
+ const [requestAnimationFrame] = (0, _reactutilities.useAnimationFrame)();
91
+ if (selected) {
92
+ const { previousSelectedValue, selectedValue, registeredTabs } = getRegisteredTabs();
93
+ if (isValueDefined(previousSelectedValue) && lastAnimatedFrom !== previousSelectedValue) {
94
+ const previousSelectedTabRect = getRegisteredTabRect(registeredTabs, previousSelectedValue);
95
+ const selectedTabRect = getRegisteredTabRect(registeredTabs, selectedValue);
96
+ if (selectedTabRect && previousSelectedTabRect) {
97
+ const offset = vertical ? previousSelectedTabRect.y - selectedTabRect.y : previousSelectedTabRect.x - selectedTabRect.x;
98
+ const scale = vertical ? previousSelectedTabRect.height / selectedTabRect.height : previousSelectedTabRect.width / selectedTabRect.width;
99
+ setAnimationValues({
100
+ offset,
101
+ scale
102
+ });
103
+ setLastAnimatedFrom(previousSelectedValue);
104
+ // Reset the animation values after the animation is complete
105
+ requestAnimationFrame(()=>setAnimationValues({
106
+ offset: 0,
107
+ scale: 1
108
+ }));
109
+ }
110
+ }
111
+ } else if (isValueDefined(lastAnimatedFrom)) {
112
+ // need to clear the last animated from so that if this tab is selected again
113
+ // from the same previous tab as last time, that animation still happens.
114
+ setLastAnimatedFrom(undefined);
115
+ }
116
+ // do not apply any animation if the tab is disabled
117
+ if (disabled) {
118
+ return state;
119
+ }
120
+ // the animation should only happen as the selection indicator returns to its
121
+ // original position and not when set at the previous tabs position.
122
+ const animating = animationValues.offset === 0 && animationValues.scale === 1;
123
+ state.root.className = (0, _react1.mergeClasses)(state.root.className, selected && activeIndicatorStyles.base, selected && animating && activeIndicatorStyles.animated, selected && (vertical ? activeIndicatorStyles.vertical : activeIndicatorStyles.horizontal));
124
+ const rootCssVars = {
125
+ [tabIndicatorCssVars_unstable.offsetVar]: `${animationValues.offset}px`,
126
+ [tabIndicatorCssVars_unstable.scaleVar]: `${animationValues.scale}`
127
+ };
128
+ state.root.style = {
129
+ ...rootCssVars,
130
+ ...state.root.style
131
+ };
132
+ return state;
133
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/Tab/useTabAnimatedIndicator.styles.ts"],"sourcesContent":["import * as React from 'react';\nimport type { TabState, TabValue } from './Tab.types';\n\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport { useTabListContext_unstable } from '../TabList/TabListContext';\nimport { TabRegisterData } from '../TabList/TabList.types';\nimport { tokens } from '@fluentui/react-theme';\nimport { useAnimationFrame } from '@fluentui/react-utilities';\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nconst tabIndicatorCssVars_unstable = {\n offsetVar: '--fui-Tab__indicator--offset',\n scaleVar: '--fui-Tab__indicator--scale',\n};\n\nconst useActiveIndicatorStyles = makeStyles({\n base: {\n // overflow is required to allow the selection indicator to animate outside the tab area.\n overflow: 'visible',\n },\n animated: {\n '::after': {\n transitionProperty: 'transform',\n transitionDuration: `${tokens.durationSlow}`,\n transitionTimingFunction: `${tokens.curveDecelerateMax}`,\n },\n '@media (prefers-reduced-motion: reduce)': {\n '::after': {\n transitionProperty: 'none',\n transitionDuration: '0.01ms',\n },\n },\n },\n horizontal: {\n '::after': {\n transformOrigin: 'left',\n transform: `translateX(var(${tabIndicatorCssVars_unstable.offsetVar}))\n scaleX(var(${tabIndicatorCssVars_unstable.scaleVar}))`,\n },\n },\n vertical: {\n '::after': {\n transformOrigin: 'top',\n transform: `translateY(var(${tabIndicatorCssVars_unstable.offsetVar}))\n scaleY(var(${tabIndicatorCssVars_unstable.scaleVar}))`,\n },\n },\n});\n\nconst calculateTabRect = (element: HTMLElement) => {\n if (element) {\n const parentRect = element.parentElement?.getBoundingClientRect() || { x: 0, y: 0, width: 0, height: 0 };\n const tabRect = element.getBoundingClientRect();\n\n return {\n x: tabRect.x - parentRect.x,\n y: tabRect.y - parentRect.y,\n width: tabRect.width,\n height: tabRect.height,\n };\n }\n return undefined;\n};\n\nconst getRegisteredTabRect = (registeredTabs: Record<string, TabRegisterData>, value?: TabValue) => {\n const element = isValueDefined(value) ? registeredTabs[JSON.stringify(value)]?.ref.current : undefined;\n return element ? calculateTabRect(element) : undefined;\n};\n\n// eslint-disable-next-line eqeqeq\nconst isValueDefined = (value: TabValue) => value != null;\n\n/**\n * Adds additional styling to the active tab selection indicator to create a sliding animation.\n */\nexport const useTabAnimatedIndicatorStyles_unstable = (state: TabState): TabState => {\n const { disabled, selected, vertical } = state;\n\n const activeIndicatorStyles = useActiveIndicatorStyles();\n const [lastAnimatedFrom, setLastAnimatedFrom] = React.useState<TabValue>();\n const [animationValues, setAnimationValues] = React.useState({ offset: 0, scale: 1 });\n const getRegisteredTabs = useTabListContext_unstable(ctx => ctx.getRegisteredTabs);\n\n const [requestAnimationFrame] = useAnimationFrame();\n\n if (selected) {\n const { previousSelectedValue, selectedValue, registeredTabs } = getRegisteredTabs();\n\n if (isValueDefined(previousSelectedValue) && lastAnimatedFrom !== previousSelectedValue) {\n const previousSelectedTabRect = getRegisteredTabRect(registeredTabs, previousSelectedValue);\n const selectedTabRect = getRegisteredTabRect(registeredTabs, selectedValue);\n\n if (selectedTabRect && previousSelectedTabRect) {\n const offset = vertical\n ? previousSelectedTabRect.y - selectedTabRect.y\n : previousSelectedTabRect.x - selectedTabRect.x;\n\n const scale = vertical\n ? previousSelectedTabRect.height / selectedTabRect.height\n : previousSelectedTabRect.width / selectedTabRect.width;\n\n setAnimationValues({ offset, scale });\n setLastAnimatedFrom(previousSelectedValue);\n\n // Reset the animation values after the animation is complete\n requestAnimationFrame(() => setAnimationValues({ offset: 0, scale: 1 }));\n }\n }\n } else if (isValueDefined(lastAnimatedFrom)) {\n // need to clear the last animated from so that if this tab is selected again\n // from the same previous tab as last time, that animation still happens.\n setLastAnimatedFrom(undefined);\n }\n\n // do not apply any animation if the tab is disabled\n if (disabled) {\n return state;\n }\n\n // the animation should only happen as the selection indicator returns to its\n // original position and not when set at the previous tabs position.\n const animating = animationValues.offset === 0 && animationValues.scale === 1;\n\n state.root.className = mergeClasses(\n state.root.className,\n selected && activeIndicatorStyles.base,\n selected && animating && activeIndicatorStyles.animated,\n selected && (vertical ? activeIndicatorStyles.vertical : activeIndicatorStyles.horizontal),\n );\n\n const rootCssVars = {\n [tabIndicatorCssVars_unstable.offsetVar]: `${animationValues.offset}px`,\n [tabIndicatorCssVars_unstable.scaleVar]: `${animationValues.scale}`,\n };\n\n state.root.style = {\n ...rootCssVars,\n ...state.root.style,\n };\n\n return state;\n};\n"],"names":["useTabAnimatedIndicatorStyles_unstable","tabIndicatorCssVars_unstable","offsetVar","scaleVar","useActiveIndicatorStyles","makeStyles","base","overflow","animated","transitionProperty","transitionDuration","tokens","durationSlow","transitionTimingFunction","curveDecelerateMax","horizontal","transformOrigin","transform","vertical","calculateTabRect","element","parentRect","parentElement","getBoundingClientRect","x","y","width","height","tabRect","undefined","getRegisteredTabRect","registeredTabs","value","isValueDefined","JSON","stringify","ref","current","state","disabled","selected","activeIndicatorStyles","lastAnimatedFrom","setLastAnimatedFrom","React","useState","animationValues","setAnimationValues","offset","scale","getRegisteredTabs","useTabListContext_unstable","ctx","requestAnimationFrame","useAnimationFrame","previousSelectedValue","selectedValue","previousSelectedTabRect","selectedTabRect","animating","root","className","mergeClasses","rootCssVars","style"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BA2EaA;;;eAAAA;;;;iEA3EU;wBAGkB;gCACE;4BAEpB;gCACW;AAElC,gEAAgE;AAChE,MAAMC,+BAA+B;IACnCC,WAAW;IACXC,UAAU;AACZ;AAEA,MAAMC,2BAA2BC,IAAAA,kBAAAA,EAAW;IAC1CC,MAAM;QACJ,yFAAyF;QACzFC,UAAU;IACZ;IACAC,UAAU;QACR,WAAW;YACTC,oBAAoB;YACpBC,oBAAoB,CAAC,EAAEC,kBAAAA,CAAOC,YAAY,CAAC,CAAC;YAC5CC,0BAA0B,CAAC,EAAEF,kBAAAA,CAAOG,kBAAkB,CAAC,CAAC;QAC1D;QACA,2CAA2C;YACzC,WAAW;gBACTL,oBAAoB;gBACpBC,oBAAoB;YACtB;QACF;IACF;IACAK,YAAY;QACV,WAAW;YACTC,iBAAiB;YACjBC,WAAW,CAAC,eAAe,EAAEhB,6BAA6BC,SAAS,CAAC;eAC3D,EAAED,6BAA6BE,QAAQ,CAAC,EAAE,C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