@fluentui/react-card 0.0.0-nightly-20230317-0436.1 → 0.0.0-nightly-20230317-1454.1
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/.swcrc +39 -0
- package/CHANGELOG.json +15 -15
- package/CHANGELOG.md +10 -10
- package/lib/Card.js +1 -1
- package/lib/Card.js.map +1 -1
- package/lib/CardFooter.js +1 -1
- package/lib/CardFooter.js.map +1 -1
- package/lib/CardHeader.js +1 -1
- package/lib/CardHeader.js.map +1 -1
- package/lib/CardPreview.js +1 -1
- package/lib/CardPreview.js.map +1 -1
- package/lib/components/Card/Card.js +6 -6
- package/lib/components/Card/Card.js.map +1 -1
- package/lib/components/Card/Card.types.js +1 -1
- package/lib/components/Card/Card.types.js.map +1 -1
- package/lib/components/Card/CardContext.js +4 -9
- package/lib/components/Card/CardContext.js.map +1 -1
- package/lib/components/Card/index.js +6 -6
- package/lib/components/Card/index.js.map +1 -1
- package/lib/components/Card/renderCard.js +5 -11
- package/lib/components/Card/renderCard.js.map +1 -1
- package/lib/components/Card/useCard.js +20 -20
- package/lib/components/Card/useCard.js.map +1 -1
- package/lib/components/Card/useCardContextValue.js.map +1 -1
- package/lib/components/Card/useCardSelectable.js +10 -10
- package/lib/components/Card/useCardSelectable.js.map +1 -1
- package/lib/components/Card/useCardStyles.js +14 -14
- package/lib/components/Card/useCardStyles.js.map +1 -1
- package/lib/components/CardFooter/CardFooter.js +5 -5
- package/lib/components/CardFooter/CardFooter.js.map +1 -1
- package/lib/components/CardFooter/CardFooter.types.js.map +1 -1
- package/lib/components/CardFooter/index.js +5 -5
- package/lib/components/CardFooter/index.js.map +1 -1
- package/lib/components/CardFooter/renderCardFooter.js +3 -7
- package/lib/components/CardFooter/renderCardFooter.js.map +1 -1
- package/lib/components/CardFooter/useCardFooter.js +5 -4
- package/lib/components/CardFooter/useCardFooter.js.map +1 -1
- package/lib/components/CardFooter/useCardFooterStyles.js +3 -3
- package/lib/components/CardFooter/useCardFooterStyles.js.map +1 -1
- package/lib/components/CardHeader/CardHeader.js +5 -5
- package/lib/components/CardHeader/CardHeader.js.map +1 -1
- package/lib/components/CardHeader/CardHeader.types.js.map +1 -1
- package/lib/components/CardHeader/index.js +5 -5
- package/lib/components/CardHeader/index.js.map +1 -1
- package/lib/components/CardHeader/renderCardHeader.js +3 -13
- package/lib/components/CardHeader/renderCardHeader.js.map +1 -1
- package/lib/components/CardHeader/useCardHeader.js +10 -10
- package/lib/components/CardHeader/useCardHeader.js.map +1 -1
- package/lib/components/CardHeader/useCardHeaderStyles.js +7 -7
- package/lib/components/CardHeader/useCardHeaderStyles.js.map +1 -1
- package/lib/components/CardPreview/CardPreview.js +5 -5
- package/lib/components/CardPreview/CardPreview.js.map +1 -1
- package/lib/components/CardPreview/CardPreview.types.js.map +1 -1
- package/lib/components/CardPreview/index.js +5 -5
- package/lib/components/CardPreview/index.js.map +1 -1
- package/lib/components/CardPreview/renderCardPreview.js +3 -7
- package/lib/components/CardPreview/renderCardPreview.js.map +1 -1
- package/lib/components/CardPreview/useCardPreview.js +9 -9
- package/lib/components/CardPreview/useCardPreview.js.map +1 -1
- package/lib/components/CardPreview/useCardPreviewStyles.js +3 -3
- package/lib/components/CardPreview/useCardPreviewStyles.js.map +1 -1
- package/lib/index.js +5 -5
- package/lib/index.js.map +1 -1
- package/lib-commonjs/Card.js +5 -4
- package/lib-commonjs/Card.js.map +1 -1
- package/lib-commonjs/CardFooter.js +5 -4
- package/lib-commonjs/CardFooter.js.map +1 -1
- package/lib-commonjs/CardHeader.js +5 -4
- package/lib-commonjs/CardHeader.js.map +1 -1
- package/lib-commonjs/CardPreview.js +5 -4
- package/lib-commonjs/CardPreview.js.map +1 -1
- package/lib-commonjs/components/Card/Card.js +18 -17
- package/lib-commonjs/components/Card/Card.js.map +1 -1
- package/lib-commonjs/components/Card/Card.types.js +5 -2
- package/lib-commonjs/components/Card/Card.types.js.map +1 -1
- package/lib-commonjs/components/Card/CardContext.js +26 -30
- package/lib-commonjs/components/Card/CardContext.js.map +1 -1
- package/lib-commonjs/components/Card/index.js +10 -9
- package/lib-commonjs/components/Card/index.js.map +1 -1
- package/lib-commonjs/components/Card/renderCard.js +16 -25
- package/lib-commonjs/components/Card/renderCard.js.map +1 -1
- package/lib-commonjs/components/Card/useCard.js +81 -94
- package/lib-commonjs/components/Card/useCard.js.map +1 -1
- package/lib-commonjs/components/Card/useCardContextValue.js +11 -11
- package/lib-commonjs/components/Card/useCardContextValue.js.map +1 -1
- package/lib-commonjs/components/Card/useCardSelectable.js +130 -117
- package/lib-commonjs/components/Card/useCardSelectable.js.map +1 -1
- package/lib-commonjs/components/Card/useCardStyles.js +738 -336
- package/lib-commonjs/components/Card/useCardStyles.js.map +1 -1
- package/lib-commonjs/components/CardFooter/CardFooter.js +16 -15
- package/lib-commonjs/components/CardFooter/CardFooter.js.map +1 -1
- package/lib-commonjs/components/CardFooter/CardFooter.types.js +3 -2
- package/lib-commonjs/components/CardFooter/CardFooter.types.js.map +1 -1
- package/lib-commonjs/components/CardFooter/index.js +9 -8
- package/lib-commonjs/components/CardFooter/index.js.map +1 -1
- package/lib-commonjs/components/CardFooter/renderCardFooter.js +13 -20
- package/lib-commonjs/components/CardFooter/renderCardFooter.js.map +1 -1
- package/lib-commonjs/components/CardFooter/useCardFooter.js +23 -30
- package/lib-commonjs/components/CardFooter/useCardFooter.js.map +1 -1
- package/lib-commonjs/components/CardFooter/useCardFooterStyles.js +45 -33
- package/lib-commonjs/components/CardFooter/useCardFooterStyles.js.map +1 -1
- package/lib-commonjs/components/CardHeader/CardHeader.js +16 -15
- package/lib-commonjs/components/CardHeader/CardHeader.js.map +1 -1
- package/lib-commonjs/components/CardHeader/CardHeader.types.js +3 -2
- package/lib-commonjs/components/CardHeader/CardHeader.types.js.map +1 -1
- package/lib-commonjs/components/CardHeader/index.js +9 -8
- package/lib-commonjs/components/CardHeader/index.js.map +1 -1
- package/lib-commonjs/components/CardHeader/renderCardHeader.js +13 -26
- package/lib-commonjs/components/CardHeader/renderCardHeader.js.map +1 -1
- package/lib-commonjs/components/CardHeader/useCardHeader.js +50 -64
- package/lib-commonjs/components/CardHeader/useCardHeader.js.map +1 -1
- package/lib-commonjs/components/CardHeader/useCardHeaderStyles.js +88 -67
- package/lib-commonjs/components/CardHeader/useCardHeaderStyles.js.map +1 -1
- package/lib-commonjs/components/CardPreview/CardPreview.js +16 -15
- package/lib-commonjs/components/CardPreview/CardPreview.js.map +1 -1
- package/lib-commonjs/components/CardPreview/CardPreview.types.js +3 -2
- package/lib-commonjs/components/CardPreview/CardPreview.types.js.map +1 -1
- package/lib-commonjs/components/CardPreview/index.js +9 -8
- package/lib-commonjs/components/CardPreview/index.js.map +1 -1
- package/lib-commonjs/components/CardPreview/renderCardPreview.js +13 -20
- package/lib-commonjs/components/CardPreview/renderCardPreview.js.map +1 -1
- package/lib-commonjs/components/CardPreview/useCardPreview.js +51 -60
- package/lib-commonjs/components/CardPreview/useCardPreview.js.map +1 -1
- package/lib-commonjs/components/CardPreview/useCardPreviewStyles.js +53 -37
- package/lib-commonjs/components/CardPreview/useCardPreviewStyles.js.map +1 -1
- package/lib-commonjs/index.js +40 -153
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +9 -9
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","mergeCallbacks","resolveShorthand","Enter","useFocusFinders","useCardSelectable","props","referenceLabel","referenceId","cardRef","checkbox","selected","defaultSelected","onSelectionChange","floatingAction","onClick","onKeyDown","findAllFocusable","checkboxRef","useRef","isSelectable","some","prop","isCardSelected","setIsCardSelected","useState","isSelectFocused","setIsSelectFocused","shouldRestrictTriggerAction","useCallback","event","current","focusableElements","target","isElementInFocusableGroup","element","contains","isCheckboxSlot","onChangeHandler","newCheckedValue","onKeyDownHandler","includes","key","preventDefault","checkboxSlot","useMemo","selectableCheckboxProps","defaultProps","ref","type","checked","onChange","onFocus","onBlur","floatingActionSlot","selectableCardProps","useEffect","Boolean","selectable","selectFocused"],"sources":["
|
1
|
+
{"version":3,"names":["React","mergeCallbacks","resolveShorthand","Enter","useFocusFinders","useCardSelectable","props","referenceLabel","referenceId","cardRef","checkbox","selected","defaultSelected","onSelectionChange","floatingAction","onClick","onKeyDown","findAllFocusable","checkboxRef","useRef","isSelectable","some","prop","isCardSelected","setIsCardSelected","useState","isSelectFocused","setIsSelectFocused","shouldRestrictTriggerAction","useCallback","event","current","focusableElements","target","isElementInFocusableGroup","element","contains","isCheckboxSlot","onChangeHandler","newCheckedValue","onKeyDownHandler","includes","key","preventDefault","checkboxSlot","useMemo","selectableCheckboxProps","defaultProps","ref","type","checked","onChange","onFocus","onBlur","floatingActionSlot","selectableCardProps","useEffect","Boolean","selectable","selectFocused"],"sources":["../../../src/components/Card/useCardSelectable.ts"],"sourcesContent":["import * as React from 'react';\nimport { mergeCallbacks, resolveShorthand } from '@fluentui/react-utilities';\nimport { Enter } from '@fluentui/keyboard-keys';\nimport { useFocusFinders } from '@fluentui/react-tabster';\n\nimport type { CardContextValue, CardOnSelectionChangeEvent, CardProps, CardSlots } from './Card.types';\n\n/**\n * @internal\n *\n * Create the state related to selectable cards.\n *\n * This internal hook controls all the logic for selectable cards and is\n * intended to be used alongside with useCard_unstable.\n *\n * @param props - props from this instance of Card\n * @param a11yProps - accessibility props shared between elements of the card\n * @param ref - reference to the root element of Card\n */\nexport const useCardSelectable = (\n props: CardProps,\n { referenceLabel, referenceId }: Pick<CardContextValue['selectableA11yProps'], 'referenceId' | 'referenceLabel'>,\n cardRef: React.RefObject<HTMLDivElement>,\n) => {\n const { checkbox = {}, selected, defaultSelected, onSelectionChange, floatingAction, onClick, onKeyDown } = props;\n\n const { findAllFocusable } = useFocusFinders();\n\n const checkboxRef = React.useRef<HTMLInputElement>(null);\n\n const isSelectable = [selected, defaultSelected, onSelectionChange].some(prop => typeof prop !== 'undefined');\n\n const [isCardSelected, setIsCardSelected] = React.useState(false);\n const [isSelectFocused, setIsSelectFocused] = React.useState(false);\n\n const shouldRestrictTriggerAction = React.useCallback(\n (event: CardOnSelectionChangeEvent) => {\n if (!cardRef.current) {\n return false;\n }\n\n const focusableElements = findAllFocusable(cardRef.current);\n const target = event.target as HTMLElement;\n const isElementInFocusableGroup = focusableElements.some(element => element.contains(target));\n const isCheckboxSlot = checkboxRef?.current === target;\n\n return isElementInFocusableGroup && !isCheckboxSlot;\n },\n [cardRef, findAllFocusable],\n );\n\n const onChangeHandler = React.useCallback(\n (event: CardOnSelectionChangeEvent) => {\n if (shouldRestrictTriggerAction(event)) {\n return;\n }\n\n const newCheckedValue = !isCardSelected;\n\n setIsCardSelected(newCheckedValue);\n\n if (onSelectionChange) {\n onSelectionChange(event, { selected: newCheckedValue });\n }\n },\n [onSelectionChange, isCardSelected, shouldRestrictTriggerAction],\n );\n\n const onKeyDownHandler = React.useCallback(\n (event: React.KeyboardEvent<HTMLElement>) => {\n if ([Enter].includes(event.key)) {\n event.preventDefault();\n onChangeHandler(event);\n }\n },\n [onChangeHandler],\n );\n\n const checkboxSlot = React.useMemo(() => {\n if (!isSelectable || floatingAction) {\n return;\n }\n\n const selectableCheckboxProps: CardSlots['checkbox'] = {};\n\n if (referenceId) {\n selectableCheckboxProps['aria-labelledby'] = referenceId;\n } else if (referenceLabel) {\n selectableCheckboxProps['aria-label'] = referenceLabel;\n }\n\n return resolveShorthand(checkbox, {\n defaultProps: {\n ref: checkboxRef,\n type: 'checkbox',\n checked: isCardSelected,\n onChange: (event: React.ChangeEvent<HTMLInputElement>) => onChangeHandler(event),\n onFocus: () => setIsSelectFocused(true),\n onBlur: () => setIsSelectFocused(false),\n ...selectableCheckboxProps,\n },\n });\n }, [checkbox, floatingAction, isCardSelected, isSelectable, onChangeHandler, referenceId, referenceLabel]);\n\n const floatingActionSlot = React.useMemo(() => {\n if (!floatingAction) {\n return;\n }\n\n return resolveShorthand(floatingAction, {\n defaultProps: {\n ref: checkboxRef,\n },\n });\n }, [floatingAction]);\n\n const selectableCardProps = React.useMemo(() => {\n if (!isSelectable) {\n return null;\n }\n\n return {\n onClick: mergeCallbacks(onClick, onChangeHandler),\n onKeyDown: mergeCallbacks(onKeyDown, onKeyDownHandler),\n };\n }, [isSelectable, onChangeHandler, onClick, onKeyDown, onKeyDownHandler]);\n\n React.useEffect(\n () => setIsCardSelected(Boolean(defaultSelected ?? selected)),\n [defaultSelected, selected, setIsCardSelected],\n );\n\n return {\n selected: isCardSelected,\n selectable: isSelectable,\n selectFocused: isSelectFocused,\n selectableCardProps,\n checkboxSlot,\n floatingActionSlot,\n };\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,cAAc,EAAEC,gBAAgB,QAAQ;AACjD,SAASC,KAAK,QAAQ;AACtB,SAASC,eAAe,QAAQ;AAIhC;;;;;;;;;;;;AAYA,OAAO,MAAMC,iBAAA,GAAoBA,CAC/BC,KAAA,EACA;EAAEC,cAAA;EAAgBC;AAAW,CAAmF,EAChHC,OAAA,KACG;EACH,MAAM;IAAEC,QAAA,GAAW,CAAC;IAAGC,QAAA;IAAUC,eAAA;IAAiBC,iBAAA;IAAmBC,cAAA;IAAgBC,OAAA;IAASC;EAAS,CAAE,GAAGV,KAAA;EAE5G,MAAM;IAAEW;EAAgB,CAAE,GAAGb,eAAA;EAE7B,MAAMc,WAAA,GAAclB,KAAA,CAAMmB,MAAM,CAAmB,IAAI;EAEvD,MAAMC,YAAA,GAAe,CAACT,QAAA,EAAUC,eAAA,EAAiBC,iBAAA,CAAkB,CAACQ,IAAI,CAACC,IAAA,IAAQ,OAAOA,IAAA,KAAS;EAEjG,MAAM,CAACC,cAAA,EAAgBC,iBAAA,CAAkB,GAAGxB,KAAA,CAAMyB,QAAQ,CAAC,KAAK;EAChE,MAAM,CAACC,eAAA,EAAiBC,kBAAA,CAAmB,GAAG3B,KAAA,CAAMyB,QAAQ,CAAC,KAAK;EAElE,MAAMG,2BAAA,GAA8B5B,KAAA,CAAM6B,WAAW,CAClDC,KAAA,IAAsC;IACrC,IAAI,CAACrB,OAAA,CA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AAkB;EAGhD,OAAO;IACLb,QAAA,EAAUY,cAAA;IACVmC,UAAA,EAAYtC,YAAA;IACZuC,aAAA,EAAejC,eAAA;IACf6B,mBAAA;IACAX,YAAA;IACAU;EACF;AACF"}
|
@@ -1,23 +1,23 @@
|
|
1
|
-
import { shorthands, __styles, mergeClasses } from
|
2
|
-
import { tokens } from
|
3
|
-
import { createFocusOutlineStyle } from
|
4
|
-
import { cardPreviewClassNames } from
|
5
|
-
import { cardHeaderClassNames } from
|
6
|
-
import { cardFooterClassNames } from
|
1
|
+
import { shorthands, __styles, mergeClasses } from "@griffel/react";
|
2
|
+
import { tokens } from "@fluentui/react-theme";
|
3
|
+
import { createFocusOutlineStyle } from "@fluentui/react-tabster";
|
4
|
+
import { cardPreviewClassNames } from "../CardPreview/useCardPreviewStyles";
|
5
|
+
import { cardHeaderClassNames } from "../CardHeader/useCardHeaderStyles";
|
6
|
+
import { cardFooterClassNames } from "../CardFooter/useCardFooterStyles";
|
7
7
|
/**
|
8
8
|
* Static CSS class names used internally for the component slots.
|
9
9
|
*/
|
10
10
|
export const cardClassNames = {
|
11
|
-
root:
|
12
|
-
floatingAction:
|
13
|
-
checkbox:
|
11
|
+
root: "fui-Card",
|
12
|
+
floatingAction: "fui-Card__floatingAction",
|
13
|
+
checkbox: "fui-Card__checkbox"
|
14
14
|
};
|
15
15
|
/**
|
16
16
|
* CSS variable names used internally for uniform styling in Card.
|
17
17
|
*/
|
18
18
|
export const cardCSSVars = {
|
19
|
-
cardSizeVar:
|
20
|
-
cardBorderRadiusVar:
|
19
|
+
cardSizeVar: "--fui-Card--size",
|
20
|
+
cardBorderRadiusVar: "--fui-Card--border-radius"
|
21
21
|
};
|
22
22
|
const focusOutlineStyle = {
|
23
23
|
outlineRadius: `var(${cardCSSVars.cardBorderRadiusVar})`,
|
@@ -311,19 +311,19 @@ export const useCardStyles_unstable = state => {
|
|
311
311
|
};
|
312
312
|
const appearanceMap = {
|
313
313
|
filled: styles.filled,
|
314
|
-
|
314
|
+
"filled-alternative": styles.filledAlternative,
|
315
315
|
outline: styles.outline,
|
316
316
|
subtle: styles.subtle
|
317
317
|
};
|
318
318
|
const selectedMap = {
|
319
319
|
filled: styles.filledInteractiveSelected,
|
320
|
-
|
320
|
+
"filled-alternative": styles.filledAlternativeInteractiveSelected,
|
321
321
|
outline: styles.outlineInteractiveSelected,
|
322
322
|
subtle: styles.subtleInteractiveSelected
|
323
323
|
};
|
324
324
|
const interactiveMap = {
|
325
325
|
filled: styles.filledInteractive,
|
326
|
-
|
326
|
+
"filled-alternative": styles.filledAlternativeInteractive,
|
327
327
|
outline: styles.outlineInteractive,
|
328
328
|
subtle: styles.subtleInteractive
|
329
329
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["shorthands","__styles","mergeClasses","tokens","createFocusOutlineStyle","cardPreviewClassNames","cardHeaderClassNames","cardFooterClassNames","cardClassNames","root","floatingAction","checkbox","cardCSSVars","cardSizeVar","cardBorderRadiusVar","focusOutlineStyle","outlineRadius","outlineWidth","strokeWidthThick","useStyles","B68tc82","Bmxbyg5","Bbmb7ep","Beyfa6y","B7oj6ja","Btl43ni","z8tnut","z189sj","Byoj8tv","uwmqm3","i8kkvl","Belr9w4","mc9l5x","qhf8xq","B7ck84d","sj55zd","E3zdtr","bn5sak","Eqx8gd","B1piin3","By385i5","Bsft5z2","B80jsxd","Bm2nyyq","Barhvk9","Bw17bha","vfts7","xrcqlc","Ihftqj","Bcgy8vk","Bhxzhr1","B3778ie","d9w3h3","Bl18szs","B4j8arr","B2jhnfs","wiictr","Brovlpu","B486eqv","B8q5s1w","Bci5o5g","n8qw10","Bdrgwmp","Bm4h7ae","B7ys5i9","Busjfv9","Bhk32uz","Bf4ptjt","kclons","Bhdgwq3","Blkhhs4","Bqtpl0w","clg4pj","hgwjuy","Bonggc9","B1tsrr9","Dah5zi","Bkh64rk","qqdqy8","B6dhp37","i03rao","Boxcth7","Bsom6fd","J0r882","Bjwuhne","Ghsupd","Bule8hv","selectableFocused","Bssx7fj","uh7if5","clntm0","Dlk2r6","B2j2mmj","wigs8","pbfy6t","B0v4ure","ghq09","B24cy0v","Bwckmig","Bvwlmkc","Bbgo44z","Bil7v7r","skfxo0","jo1ztg","Ba3ybja","az1dzo","vppk2z","B6352mv","nr063g","Blmvk6g","Bsiemmq","B98u21t","B2pnrqr","Bhhzhcn","Bec0n69","B29w5g4","orientationHorizontal","Beiy3e4","Bt984gj","Bnoktp0","Idhjb2","ihgzqh","Bgp6ld0","Bbucpmy","orientationVertical","Bt4kzjz","B1ou843","y1433z","B7egwnw","B49b4xf","sizeSmall","B7balbw","B1h88n7","sizeMedium","sizeLarge","filled","De3pzq","E5pizo","B0n5ga8","s924m2","B1q35kw","Gp14am","filledInteractive","Bceei9c","Jwef8y","Bvxd0ez","ecr2s2","filledInteractiveSelected","filledAlternative","filledAlternativeInteractive","filledAlternativeInteractiveSelected","outline","outlineInteractive","Be0v6ae","B5kxglz","B3pwyw6","Bymgtzf","dmfk","B4ofi8","jgq6uv","Baxewws","outlineInteractiveSelected","subtle","subtleInteractive","subtleInteractiveSelected","select","Bhzewxz","j35jbq","Bj3rh1h","hiddenCheckbox","a9b677","Bqenvij","Bh84pgu","Bgl5zvf","Huce71","d","f","i","h","a","useCardStyles_unstable","state","styles","orientationMap","horizontal","vertical","sizeMap","small","medium","large","appearanceMap","selectedMap","interactiveMap","className","orientation","size","appearance","interactive","selectable","selected","selectFocused"],"sources":["../../../../../../../../../packages/react-components/react-card/src/components/Card/useCardStyles.ts"],"sourcesContent":["import { shorthands, makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { createFocusOutlineStyle } from '@fluentui/react-tabster';\n\nimport { cardPreviewClassNames } from '../CardPreview/useCardPreviewStyles';\nimport { cardHeaderClassNames } from '../CardHeader/useCardHeaderStyles';\nimport { cardFooterClassNames } from '../CardFooter/useCardFooterStyles';\nimport type { CardSlots, CardState } from './Card.types';\n\n/**\n * Static CSS class names used internally for the component slots.\n */\nexport const cardClassNames: SlotClassNames<CardSlots> = {\n root: 'fui-Card',\n floatingAction: 'fui-Card__floatingAction',\n checkbox: 'fui-Card__checkbox',\n};\n\n/**\n * CSS variable names used internally for uniform styling in Card.\n */\nexport const cardCSSVars = {\n cardSizeVar: '--fui-Card--size',\n cardBorderRadiusVar: '--fui-Card--border-radius',\n};\n\nconst focusOutlineStyle = {\n outlineRadius: `var(${cardCSSVars.cardBorderRadiusVar})`,\n outlineWidth: tokens.strokeWidthThick,\n};\n\nconst useStyles = makeStyles({\n root: {\n ...shorthands.overflow('hidden'),\n ...shorthands.borderRadius(`var(${cardCSSVars.cardBorderRadiusVar})`),\n ...shorthands.padding(`var(${cardCSSVars.cardSizeVar})`),\n ...shorthands.gap(`var(${cardCSSVars.cardSizeVar})`),\n\n display: 'flex',\n position: 'relative',\n boxSizing: 'border-box',\n color: tokens.colorNeutralForeground1,\n\n // Border setting using after pseudo element to allow CardPreview to render behind it.\n '::after': {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n content: '\"\"',\n pointerEvents: 'none',\n\n ...shorthands.borderStyle('solid'),\n ...shorthands.borderWidth(tokens.strokeWidthThin),\n ...shorthands.borderRadius(`var(${cardCSSVars.cardBorderRadiusVar})`),\n },\n\n // Prevents CardHeader and CardFooter from shrinking.\n [`> .${cardHeaderClassNames.root}, > .${cardFooterClassNames.root}`]: {\n flexShrink: 0,\n },\n // Allows non-card components to grow to fill the available space.\n [`> :not(.${cardPreviewClassNames.root}):not(.${cardHeaderClassNames.root}):not(.${cardFooterClassNames.root})`]: {\n flexGrow: 1,\n },\n\n ...createFocusOutlineStyle({\n style: focusOutlineStyle,\n selector: 'focus',\n }),\n },\n\n selectableFocused: createFocusOutlineStyle({\n style: focusOutlineStyle,\n selector: 'focus-within',\n }),\n\n orientationHorizontal: {\n flexDirection: 'row',\n alignItems: 'center',\n\n // Remove vertical padding to keep CardPreview content flush with Card's borders.\n [`> .${cardPreviewClassNames.root}`]: {\n marginTop: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`,\n marginBottom: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`,\n },\n // Due to Tabster's \"Groupper\" focus functionality, hidden elements are injected before and after Card's content.\n // As such, the code below targets a CardPreview, when it's the first element.\n // Since this is on horizontal cards, the left padding is removed to keep the content flush with the border.\n [`> :not([aria-hidden=\"true\"]).${cardPreviewClassNames.root}:first-of-type`]: {\n marginLeft: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`,\n },\n // Due to Tabster's \"Groupper\" focus functionality, hidden elements are injected before and after Card's content.\n // As such, the code below targets a CardPreview, when it's the last element.\n // Since this is on horizontal cards, the right padding is removed to keep the content flush with the border.\n [`> :not([aria-hidden=\"true\"]).${cardPreviewClassNames.root}:last-of-type`]: {\n marginRight: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`,\n },\n\n // If the last child is a CardHeader or CardFooter, allow it to grow to fill the available space.\n [`> .${cardHeaderClassNames.root}:last-of-type, > .${cardFooterClassNames.root}:last-of-type`]: {\n flexGrow: 1,\n },\n },\n orientationVertical: {\n flexDirection: 'column',\n\n // Remove lateral padding to keep CardPreview content flush with Card's borders.\n [`> .${cardPreviewClassNames.root}`]: {\n marginLeft: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`,\n marginRight: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`,\n },\n\n // Due to Tabster's \"Groupper\" focus functionality, hidden elements are injected before and after Card's content.\n // As such, the code below targets a CardPreview, when it's the first element.\n // Since this is on vertical cards, the top padding is removed to keep the content flush with the border.\n [`> :not([aria-hidden=\"true\"]).${cardPreviewClassNames.root}:first-of-type`]: {\n marginTop: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`,\n },\n [`> .${cardClassNames.floatingAction} + .${cardPreviewClassNames.root}`]: {\n marginTop: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`,\n },\n\n // Due to Tabster's \"Groupper\" focus functionality, hidden elements are injected before and after Card's content.\n // As such, the code below targets a CardPreview, when it's the first element.\n // Since this is on vertical cards, the bottom padding is removed to keep the content flush with the border.\n [`> :not([aria-hidden=\"true\"]).${cardPreviewClassNames.root}:last-of-type`]: {\n marginBottom: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`,\n },\n },\n\n sizeSmall: {\n [cardCSSVars.cardSizeVar]: '8px',\n [cardCSSVars.cardBorderRadiusVar]: tokens.borderRadiusSmall,\n },\n sizeMedium: {\n [cardCSSVars.cardSizeVar]: '12px',\n [cardCSSVars.cardBorderRadiusVar]: tokens.borderRadiusMedium,\n },\n sizeLarge: {\n [cardCSSVars.cardSizeVar]: '16px',\n [cardCSSVars.cardBorderRadiusVar]: tokens.borderRadiusLarge,\n },\n\n filled: {\n backgroundColor: tokens.colorNeutralBackground1,\n boxShadow: tokens.shadow4,\n\n '::after': {\n ...shorthands.borderColor(tokens.colorTransparentStroke),\n },\n },\n filledInteractive: {\n cursor: 'pointer',\n backgroundColor: tokens.colorNeutralBackground1,\n boxShadow: tokens.shadow4,\n\n '::after': {\n ...shorthands.borderColor(tokens.colorTransparentStroke),\n },\n\n ':hover': {\n backgroundColor: tokens.colorNeutralBackground1Hover,\n boxShadow: tokens.shadow8,\n },\n ':active': {\n backgroundColor: tokens.colorNeutralBackground1Pressed,\n },\n },\n filledInteractiveSelected: {\n backgroundColor: tokens.colorNeutralBackground1Selected,\n\n '::after': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Selected),\n },\n\n ':hover': {\n backgroundColor: tokens.colorNeutralBackground1Selected,\n },\n },\n\n filledAlternative: {\n backgroundColor: tokens.colorNeutralBackground2,\n boxShadow: tokens.shadow4,\n\n '::after': {\n ...shorthands.borderColor(tokens.colorTransparentStroke),\n },\n },\n filledAlternativeInteractive: {\n cursor: 'pointer',\n backgroundColor: tokens.colorNeutralBackground2,\n boxShadow: tokens.shadow4,\n\n '::after': {\n ...shorthands.borderColor(tokens.colorTransparentStroke),\n },\n\n ':hover': {\n backgroundColor: tokens.colorNeutralBackground2Hover,\n boxShadow: tokens.shadow8,\n },\n ':active': {\n backgroundColor: tokens.colorNeutralBackground2Pressed,\n },\n },\n filledAlternativeInteractiveSelected: {\n backgroundColor: tokens.colorNeutralBackground2Selected,\n\n '::after': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Selected),\n },\n\n ':hover': {\n backgroundColor: tokens.colorNeutralBackground2Selected,\n },\n },\n\n outline: {\n backgroundColor: tokens.colorTransparentBackground,\n boxShadow: 'none',\n\n '::after': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1),\n },\n },\n outlineInteractive: {\n cursor: 'pointer',\n backgroundColor: tokens.colorTransparentBackground,\n boxShadow: 'none',\n\n '::after': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1),\n },\n\n ':hover': {\n backgroundColor: tokens.colorTransparentBackgroundHover,\n\n '::after': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Hover),\n },\n },\n ':active': {\n backgroundColor: tokens.colorTransparentBackgroundPressed,\n\n '::after': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Pressed),\n },\n },\n },\n outlineInteractiveSelected: {\n backgroundColor: tokens.colorTransparentBackgroundSelected,\n\n '::after': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Selected),\n },\n\n ':hover': {\n backgroundColor: tokens.colorTransparentBackgroundSelected,\n },\n },\n\n subtle: {\n backgroundColor: tokens.colorSubtleBackground,\n boxShadow: 'none',\n\n '::after': {\n ...shorthands.borderColor(tokens.colorTransparentStroke),\n },\n },\n subtleInteractive: {\n cursor: 'pointer',\n backgroundColor: tokens.colorSubtleBackground,\n boxShadow: 'none',\n\n '::after': {\n ...shorthands.borderColor(tokens.colorTransparentStroke),\n },\n\n ':hover': {\n backgroundColor: tokens.colorSubtleBackgroundHover,\n },\n ':active': {\n backgroundColor: tokens.colorSubtleBackgroundPressed,\n },\n },\n subtleInteractiveSelected: {\n backgroundColor: tokens.colorSubtleBackgroundSelected,\n\n '::after': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Selected),\n },\n\n ':hover': {\n backgroundColor: tokens.colorSubtleBackgroundSelected,\n },\n },\n\n select: {\n position: 'absolute',\n top: '4px',\n right: '4px',\n zIndex: 1,\n },\n\n hiddenCheckbox: {\n ...shorthands.overflow('hidden'),\n width: '1px',\n height: '1px',\n position: 'absolute',\n clip: 'rect(0 0 0 0)',\n clipPath: 'inset(50%)',\n whiteSpace: 'nowrap',\n },\n});\n\n/**\n * Apply styling to the Card slots based on the state.\n */\nexport const useCardStyles_unstable = (state: CardState): CardState => {\n const styles = useStyles();\n\n const orientationMap = {\n horizontal: styles.orientationHorizontal,\n vertical: styles.orientationVertical,\n };\n\n const sizeMap = {\n small: styles.sizeSmall,\n medium: styles.sizeMedium,\n large: styles.sizeLarge,\n };\n\n const appearanceMap = {\n filled: styles.filled,\n 'filled-alternative': styles.filledAlternative,\n outline: styles.outline,\n subtle: styles.subtle,\n };\n\n const selectedMap = {\n filled: styles.filledInteractiveSelected,\n 'filled-alternative': styles.filledAlternativeInteractiveSelected,\n outline: styles.outlineInteractiveSelected,\n subtle: styles.subtleInteractiveSelected,\n };\n const interactiveMap = {\n filled: styles.filledInteractive,\n 'filled-alternative': styles.filledAlternativeInteractive,\n outline: styles.outlineInteractive,\n subtle: styles.subtleInteractive,\n };\n\n state.root.className = mergeClasses(\n cardClassNames.root,\n styles.root,\n orientationMap[state.orientation],\n sizeMap[state.size],\n appearanceMap[state.appearance],\n (state.interactive || state.selectable) && interactiveMap[state.appearance],\n state.selected && selectedMap[state.appearance],\n state.selectFocused && styles.selectableFocused,\n state.root.className,\n );\n\n if (state.floatingAction) {\n state.floatingAction.className = mergeClasses(\n cardClassNames.floatingAction,\n styles.select,\n state.floatingAction.className,\n );\n }\n\n if (state.checkbox) {\n state.checkbox.className = mergeClasses(cardClassNames.checkbox, styles.hiddenCheckbox, state.checkbox.className);\n }\n\n return state;\n};\n"],"mappings":"AAAA,SA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AA4B;IACzDE,OAAO,EAAE+B,MAAM,CAAC9B,kBAAkB;IAClCU,MAAM,EAAEoB,MAAM,CAACnB;GAChB;EAEDkB,KAAK,CAAC5K,IAAI,CAACwL,SAAS,GAAG/L,YAAY,CACjCM,cAAc,CAACC,IAAI,EACnB6K,MAAM,CAAC7K,IAAI,EACX8K,cAAc,CAACF,KAAK,CAACa,WAAW,CAAC,EACjCR,OAAO,CAACL,KAAK,CAACc,IAAI,CAAC,EACnBL,aAAa,CAACT,KAAK,CAACe,UAAU,CAAC,EAC/B,CAACf,KAAK,CAACgB,WAAW,IAAIhB,KAAK,CAACiB,UAAU,KAAKN,cAAc,CAACX,KAAK,CAACe,UAAU,CAAC,EAC3Ef,KAAK,CAACkB,QAAQ,IAAIR,WAAW,CAACV,KAAK,CAACe,UAAU,CAAC,EAC/Cf,KAAK,CAACmB,aAAa,IAAIlB,MAAM,CAAC/F,iBAAiB,EAC/C8F,KAAK,CAAC5K,IAAI,CAACwL,SAAS,CACrB;EAED,IAAIZ,KAAK,CAAC3K,cAAc,EAAE;IACxB2K,KAAK,CAAC3K,cAAc,CAACuL,SAAS,GAAG/L,YAAY,CAC3CM,cAAc,CAACE,cAAc,EAC7B4K,MAAM,CAACjB,MAAM,EACbgB,KAAK,CAAC3K,cAAc,CAACuL,SAAS,CAC/B;;EAGH,IAAIZ,KAAK,CAAC1K,QAAQ,EAAE;IAClB0K,KAAK,CAAC1K,QAAQ,CAACsL,SAAS,GAAG/L,YAAY,CAACM,cAAc,CAACG,QAAQ,EAAE2K,MAAM,CAACb,cAAc,EAAEY,KAAK,CAAC1K,QAAQ,CAACsL,SAAS,CAAC;;EAGnH,OAAOZ,KAAK;AACd,CAAC"}
|
1
|
+
{"version":3,"names":["shorthands","__styles","mergeClasses","tokens","createFocusOutlineStyle","cardPreviewClassNames","cardHeaderClassNames","cardFooterClassNames","cardClassNames","root","floatingAction","checkbox","cardCSSVars","cardSizeVar","cardBorderRadiusVar","focusOutlineStyle","outlineRadius","outlineWidth","strokeWidthThick","useStyles","B68tc82","Bmxbyg5","Bbmb7ep","Beyfa6y","B7oj6ja","Btl43ni","z8tnut","z189sj","Byoj8tv","uwmqm3","i8kkvl","Belr9w4","mc9l5x","qhf8xq","B7ck84d","sj55zd","E3zdtr","bn5sak","Eqx8gd","B1piin3","By385i5","Bsft5z2","B80jsxd","Bm2nyyq","Barhvk9","Bw17bha","vfts7","xrcqlc","Ihftqj","Bcgy8vk","Bhxzhr1","B3778ie","d9w3h3","Bl18szs","B4j8arr","B2jhnfs","wiictr","Brovlpu","B486eqv","B8q5s1w","Bci5o5g","n8qw10","Bdrgwmp","Bm4h7ae","B7ys5i9","Busjfv9","Bhk32uz","Bf4ptjt","kclons","Bhdgwq3","Blkhhs4","Bqtpl0w","clg4pj","hgwjuy","Bonggc9","B1tsrr9","Dah5zi","Bkh64rk","qqdqy8","B6dhp37","i03rao","Boxcth7","Bsom6fd","J0r882","Bjwuhne","Ghsupd","Bule8hv","selectableFocused","Bssx7fj","uh7if5","clntm0","Dlk2r6","B2j2mmj","wigs8","pbfy6t","B0v4ure","ghq09","B24cy0v","Bwckmig","Bvwlmkc","Bbgo44z","Bil7v7r","skfxo0","jo1ztg","Ba3ybja","az1dzo","vppk2z","B6352mv","nr063g","Blmvk6g","Bsiemmq","B98u21t","B2pnrqr","Bhhzhcn","Bec0n69","B29w5g4","orientationHorizontal","Beiy3e4","Bt984gj","Bnoktp0","Idhjb2","ihgzqh","Bgp6ld0","Bbucpmy","orientationVertical","Bt4kzjz","B1ou843","y1433z","B7egwnw","B49b4xf","sizeSmall","B7balbw","B1h88n7","sizeMedium","sizeLarge","filled","De3pzq","E5pizo","B0n5ga8","s924m2","B1q35kw","Gp14am","filledInteractive","Bceei9c","Jwef8y","Bvxd0ez","ecr2s2","filledInteractiveSelected","filledAlternative","filledAlternativeInteractive","filledAlternativeInteractiveSelected","outline","outlineInteractive","Be0v6ae","B5kxglz","B3pwyw6","Bymgtzf","dmfk","B4ofi8","jgq6uv","Baxewws","outlineInteractiveSelected","subtle","subtleInteractive","subtleInteractiveSelected","select","Bhzewxz","j35jbq","Bj3rh1h","hiddenCheckbox","a9b677","Bqenvij","Bh84pgu","Bgl5zvf","Huce71","d","f","i","h","a","useCardStyles_unstable","state","styles","orientationMap","horizontal","vertical","sizeMap","small","medium","large","appearanceMap","selectedMap","interactiveMap","className","orientation","size","appearance","interactive","selectable","selected","selectFocused"],"sources":["../../../src/components/Card/useCardStyles.ts"],"sourcesContent":["import { shorthands, makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { createFocusOutlineStyle } from '@fluentui/react-tabster';\n\nimport { cardPreviewClassNames } from '../CardPreview/useCardPreviewStyles';\nimport { cardHeaderClassNames } from '../CardHeader/useCardHeaderStyles';\nimport { cardFooterClassNames } from '../CardFooter/useCardFooterStyles';\nimport type { CardSlots, CardState } from './Card.types';\n\n/**\n * Static CSS class names used internally for the component slots.\n */\nexport const cardClassNames: SlotClassNames<CardSlots> = {\n root: 'fui-Card',\n floatingAction: 'fui-Card__floatingAction',\n checkbox: 'fui-Card__checkbox',\n};\n\n/**\n * CSS variable names used internally for uniform styling in Card.\n */\nexport const cardCSSVars = {\n cardSizeVar: '--fui-Card--size',\n cardBorderRadiusVar: '--fui-Card--border-radius',\n};\n\nconst focusOutlineStyle = {\n outlineRadius: `var(${cardCSSVars.cardBorderRadiusVar})`,\n outlineWidth: tokens.strokeWidthThick,\n};\n\nconst useStyles = makeStyles({\n root: {\n ...shorthands.overflow('hidden'),\n ...shorthands.borderRadius(`var(${cardCSSVars.cardBorderRadiusVar})`),\n ...shorthands.padding(`var(${cardCSSVars.cardSizeVar})`),\n ...shorthands.gap(`var(${cardCSSVars.cardSizeVar})`),\n\n display: 'flex',\n position: 'relative',\n boxSizing: 'border-box',\n color: tokens.colorNeutralForeground1,\n\n // Border setting using after pseudo element to allow CardPreview to render behind it.\n '::after': {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n content: '\"\"',\n pointerEvents: 'none',\n\n ...shorthands.borderStyle('solid'),\n ...shorthands.borderWidth(tokens.strokeWidthThin),\n ...shorthands.borderRadius(`var(${cardCSSVars.cardBorderRadiusVar})`),\n },\n\n // Prevents CardHeader and CardFooter from shrinking.\n [`> .${cardHeaderClassNames.root}, > .${cardFooterClassNames.root}`]: {\n flexShrink: 0,\n },\n // Allows non-card components to grow to fill the available space.\n [`> :not(.${cardPreviewClassNames.root}):not(.${cardHeaderClassNames.root}):not(.${cardFooterClassNames.root})`]: {\n flexGrow: 1,\n },\n\n ...createFocusOutlineStyle({\n style: focusOutlineStyle,\n selector: 'focus',\n }),\n },\n\n selectableFocused: createFocusOutlineStyle({\n style: focusOutlineStyle,\n selector: 'focus-within',\n }),\n\n orientationHorizontal: {\n flexDirection: 'row',\n alignItems: 'center',\n\n // Remove vertical padding to keep CardPreview content flush with Card's borders.\n [`> .${cardPreviewClassNames.root}`]: {\n marginTop: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`,\n marginBottom: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`,\n },\n // Due to Tabster's \"Groupper\" focus functionality, hidden elements are injected before and after Card's content.\n // As such, the code below targets a CardPreview, when it's the first element.\n // Since this is on horizontal cards, the left padding is removed to keep the content flush with the border.\n [`> :not([aria-hidden=\"true\"]).${cardPreviewClassNames.root}:first-of-type`]: {\n marginLeft: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`,\n },\n // Due to Tabster's \"Groupper\" focus functionality, hidden elements are injected before and after Card's content.\n // As such, the code below targets a CardPreview, when it's the last element.\n // Since this is on horizontal cards, the right padding is removed to keep the content flush with the border.\n [`> :not([aria-hidden=\"true\"]).${cardPreviewClassNames.root}:last-of-type`]: {\n marginRight: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`,\n },\n\n // If the last child is a CardHeader or CardFooter, allow it to grow to fill the available space.\n [`> .${cardHeaderClassNames.root}:last-of-type, > .${cardFooterClassNames.root}:last-of-type`]: {\n flexGrow: 1,\n },\n },\n orientationVertical: {\n flexDirection: 'column',\n\n // Remove lateral padding to keep CardPreview content flush with Card's borders.\n [`> .${cardPreviewClassNames.root}`]: {\n marginLeft: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`,\n marginRight: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`,\n },\n\n // Due to Tabster's \"Groupper\" focus functionality, hidden elements are injected before and after Card's content.\n // As such, the code below targets a CardPreview, when it's the first element.\n // Since this is on vertical cards, the top padding is removed to keep the content flush with the border.\n [`> :not([aria-hidden=\"true\"]).${cardPreviewClassNames.root}:first-of-type`]: {\n marginTop: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`,\n },\n [`> .${cardClassNames.floatingAction} + .${cardPreviewClassNames.root}`]: {\n marginTop: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`,\n },\n\n // Due to Tabster's \"Groupper\" focus functionality, hidden elements are injected before and after Card's content.\n // As such, the code below targets a CardPreview, when it's the first element.\n // Since this is on vertical cards, the bottom padding is removed to keep the content flush with the border.\n [`> :not([aria-hidden=\"true\"]).${cardPreviewClassNames.root}:last-of-type`]: {\n marginBottom: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`,\n },\n },\n\n sizeSmall: {\n [cardCSSVars.cardSizeVar]: '8px',\n [cardCSSVars.cardBorderRadiusVar]: tokens.borderRadiusSmall,\n },\n sizeMedium: {\n [cardCSSVars.cardSizeVar]: '12px',\n [cardCSSVars.cardBorderRadiusVar]: tokens.borderRadiusMedium,\n },\n sizeLarge: {\n [cardCSSVars.cardSizeVar]: '16px',\n [cardCSSVars.cardBorderRadiusVar]: tokens.borderRadiusLarge,\n },\n\n filled: {\n backgroundColor: tokens.colorNeutralBackground1,\n boxShadow: tokens.shadow4,\n\n '::after': {\n ...shorthands.borderColor(tokens.colorTransparentStroke),\n },\n },\n filledInteractive: {\n cursor: 'pointer',\n backgroundColor: tokens.colorNeutralBackground1,\n boxShadow: tokens.shadow4,\n\n '::after': {\n ...shorthands.borderColor(tokens.colorTransparentStroke),\n },\n\n ':hover': {\n backgroundColor: tokens.colorNeutralBackground1Hover,\n boxShadow: tokens.shadow8,\n },\n ':active': {\n backgroundColor: tokens.colorNeutralBackground1Pressed,\n },\n },\n filledInteractiveSelected: {\n backgroundColor: tokens.colorNeutralBackground1Selected,\n\n '::after': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Selected),\n },\n\n ':hover': {\n backgroundColor: tokens.colorNeutralBackground1Selected,\n },\n },\n\n filledAlternative: {\n backgroundColor: tokens.colorNeutralBackground2,\n boxShadow: tokens.shadow4,\n\n '::after': {\n ...shorthands.borderColor(tokens.colorTransparentStroke),\n },\n },\n filledAlternativeInteractive: {\n cursor: 'pointer',\n backgroundColor: tokens.colorNeutralBackground2,\n boxShadow: tokens.shadow4,\n\n '::after': {\n ...shorthands.borderColor(tokens.colorTransparentStroke),\n },\n\n ':hover': {\n backgroundColor: tokens.colorNeutralBackground2Hover,\n boxShadow: tokens.shadow8,\n },\n ':active': {\n backgroundColor: tokens.colorNeutralBackground2Pressed,\n },\n },\n filledAlternativeInteractiveSelected: {\n backgroundColor: tokens.colorNeutralBackground2Selected,\n\n '::after': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Selected),\n },\n\n ':hover': {\n backgroundColor: tokens.colorNeutralBackground2Selected,\n },\n },\n\n outline: {\n backgroundColor: tokens.colorTransparentBackground,\n boxShadow: 'none',\n\n '::after': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1),\n },\n },\n outlineInteractive: {\n cursor: 'pointer',\n backgroundColor: tokens.colorTransparentBackground,\n boxShadow: 'none',\n\n '::after': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1),\n },\n\n ':hover': {\n backgroundColor: tokens.colorTransparentBackgroundHover,\n\n '::after': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Hover),\n },\n },\n ':active': {\n backgroundColor: tokens.colorTransparentBackgroundPressed,\n\n '::after': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Pressed),\n },\n },\n },\n outlineInteractiveSelected: {\n backgroundColor: tokens.colorTransparentBackgroundSelected,\n\n '::after': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Selected),\n },\n\n ':hover': {\n backgroundColor: tokens.colorTransparentBackgroundSelected,\n },\n },\n\n subtle: {\n backgroundColor: tokens.colorSubtleBackground,\n boxShadow: 'none',\n\n '::after': {\n ...shorthands.borderColor(tokens.colorTransparentStroke),\n },\n },\n subtleInteractive: {\n cursor: 'pointer',\n backgroundColor: tokens.colorSubtleBackground,\n boxShadow: 'none',\n\n '::after': {\n ...shorthands.borderColor(tokens.colorTransparentStroke),\n },\n\n ':hover': {\n backgroundColor: tokens.colorSubtleBackgroundHover,\n },\n ':active': {\n backgroundColor: tokens.colorSubtleBackgroundPressed,\n },\n },\n subtleInteractiveSelected: {\n backgroundColor: tokens.colorSubtleBackgroundSelected,\n\n '::after': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Selected),\n },\n\n ':hover': {\n backgroundColor: tokens.colorSubtleBackgroundSelected,\n },\n },\n\n select: {\n position: 'absolute',\n top: '4px',\n right: '4px',\n zIndex: 1,\n },\n\n hiddenCheckbox: {\n ...shorthands.overflow('hidden'),\n width: '1px',\n height: '1px',\n position: 'absolute',\n clip: 'rect(0 0 0 0)',\n clipPath: 'inset(50%)',\n whiteSpace: 'nowrap',\n },\n});\n\n/**\n * Apply styling to the Card slots based on the state.\n */\nexport const useCardStyles_unstable = (state: CardState): CardState => {\n const styles = useStyles();\n\n const orientationMap = {\n horizontal: styles.orientationHorizontal,\n vertical: styles.orientationVertical,\n };\n\n const sizeMap = {\n small: styles.sizeSmall,\n medium: styles.sizeMedium,\n large: styles.sizeLarge,\n };\n\n const appearanceMap = {\n filled: styles.filled,\n 'filled-alternative': styles.filledAlternative,\n outline: styles.outline,\n subtle: styles.subtle,\n };\n\n const selectedMap = {\n filled: styles.filledInteractiveSelected,\n 'filled-alternative': styles.filledAlternativeInteractiveSelected,\n outline: styles.outlineInteractiveSelected,\n subtle: styles.subtleInteractiveSelected,\n };\n const interactiveMap = {\n filled: styles.filledInteractive,\n 'filled-alternative': styles.filledAlternativeInteractive,\n outline: styles.outlineInteractive,\n subtle: styles.subtleInteractive,\n };\n\n state.root.className = mergeClasses(\n cardClassNames.root,\n styles.root,\n orientationMap[state.orientation],\n sizeMap[state.size],\n appearanceMap[state.appearance],\n (state.interactive || state.selectable) && interactiveMap[state.appearance],\n state.selected && selectedMap[state.appearance],\n state.selectFocused && styles.selectableFocused,\n state.root.className,\n );\n\n if (state.floatingAction) {\n state.floatingAction.className = mergeClasses(\n cardClassNames.floatingAction,\n styles.select,\n state.floatingAction.className,\n );\n }\n\n if (state.checkbox) {\n state.checkbox.className = mergeClasses(cardClassNames.checkbox, styles.hiddenCheckbox, state.checkbox.className);\n }\n\n return state;\n};\n"],"mappings":"AAAA,SAASA,UAAU,EAAAC,QAAA,EAAcC,YAAY,QAAQ;AACrD,SAASC,MAAM,QAAQ;AAEvB,SAASC,uBAAuB,QAAQ;AAExC,SAASC,qBAAqB,QAAQ;AACtC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,oBAAoB,QAAQ;AAGrC;;;AAGA,OAAO,MAAMC,cAAA,GAA4C;EACvDC,IAAA,EAAM;EACNC,cAAA,EAAgB;EAChBC,QAAA,EAAU;AACZ;AAEA;;;AAGA,OAAO,MAAMC,WAAA,GAAc;EACzBC,WAAA,EAAa;EACbC,mBAAA,EAAqB;AACvB;AAEA,MAAMC,iBAAA,GAAoB;EACxBC,aAAA,EAAgB,OAAMJ,WAAA,CAAYE,mBAAoB,GAAE;EACxDG,YAAA,EAAcd,MAAA,CAAOe;AACvB;AAEA,MAAMC,SAAA,gBAAYlB,QAAA;EAAAQ,IAAA;IAAAW,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA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,CAC/BM,cAAA,CAAeE,cAAc,EAC7B4K,MAAA,CAAOjB,MAAM,EACbgB,KAAA,CAAM3K,cAAc,CAACuL,SAAS;EAElC;EAEA,IAAIZ,KAAA,CAAM1K,QAAQ,EAAE;IAClB0K,KAAA,CAAM1K,QAAQ,CAACsL,SAAS,GAAG/L,YAAA,CAAaM,cAAA,CAAeG,QAAQ,EAAE2K,MAAA,CAAOb,cAAc,EAAEY,KAAA,CAAM1K,QAAQ,CAACsL,SAAS;EAClH;EAEA,OAAOZ,KAAA;AACT"}
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import * as React from
|
2
|
-
import { useCardFooter_unstable } from
|
3
|
-
import { renderCardFooter_unstable } from
|
4
|
-
import { useCardFooterStyles_unstable } from
|
1
|
+
import * as React from "react";
|
2
|
+
import { useCardFooter_unstable } from "./useCardFooter";
|
3
|
+
import { renderCardFooter_unstable } from "./renderCardFooter";
|
4
|
+
import { useCardFooterStyles_unstable } from "./useCardFooterStyles";
|
5
5
|
/**
|
6
6
|
* Component to render Button actions in a Card component.
|
7
7
|
*/
|
@@ -10,5 +10,5 @@ export const CardFooter = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
10
10
|
useCardFooterStyles_unstable(state);
|
11
11
|
return renderCardFooter_unstable(state);
|
12
12
|
});
|
13
|
-
CardFooter.displayName =
|
13
|
+
CardFooter.displayName = "CardFooter";
|
14
14
|
//# sourceMappingURL=CardFooter.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","useCardFooter_unstable","renderCardFooter_unstable","useCardFooterStyles_unstable","CardFooter","forwardRef","props","ref","state","displayName"],"sources":["
|
1
|
+
{"version":3,"names":["React","useCardFooter_unstable","renderCardFooter_unstable","useCardFooterStyles_unstable","CardFooter","forwardRef","props","ref","state","displayName"],"sources":["../../../src/components/CardFooter/CardFooter.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useCardFooter_unstable } from './useCardFooter';\nimport { renderCardFooter_unstable } from './renderCardFooter';\nimport { useCardFooterStyles_unstable } from './useCardFooterStyles';\nimport type { CardFooterProps } from './CardFooter.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * Component to render Button actions in a Card component.\n */\nexport const CardFooter: ForwardRefComponent<CardFooterProps> = React.forwardRef((props, ref) => {\n const state = useCardFooter_unstable(props, ref);\n\n useCardFooterStyles_unstable(state);\n return renderCardFooter_unstable(state);\n});\n\nCardFooter.displayName = 'CardFooter';\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,sBAAsB,QAAQ;AACvC,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,4BAA4B,QAAQ;AAI7C;;;AAGA,OAAO,MAAMC,UAAA,gBAAmDJ,KAAA,CAAMK,UAAU,CAAC,CAACC,KAAA,EAAOC,GAAA,KAAQ;EAC/F,MAAMC,KAAA,GAAQP,sBAAA,CAAuBK,KAAA,EAAOC,GAAA;EAE5CJ,4BAAA,CAA6BK,KAAA;EAC7B,OAAON,yBAAA,CAA0BM,KAAA;AACnC;AAEAJ,UAAA,CAAWK,WAAW,GAAG"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":[],"sources":["../../../src/components/CardFooter/CardFooter.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\n/**\n * Slots available in the CardFooter component.\n */\nexport type CardFooterSlots = {\n /**\n * Root element of the component.\n */\n root: Slot<'div'>;\n\n /**\n * Container that renders on the far end of the footer, used for action buttons.\n */\n action?: Slot<'div'>;\n};\n\n/**\n * CardFooter component props.\n */\nexport type CardFooterProps = ComponentProps<CardFooterSlots>;\n\n/**\n * State used in rendering CardFooter.\n */\nexport type CardFooterState = ComponentState<CardFooterSlots>;\n"],"mappings":"AAAA"}
|
@@ -1,6 +1,6 @@
|
|
1
|
-
export * from
|
2
|
-
export * from
|
3
|
-
export * from
|
4
|
-
export * from
|
5
|
-
export * from
|
1
|
+
export * from "./CardFooter";
|
2
|
+
export * from "./CardFooter.types";
|
3
|
+
export * from "./renderCardFooter";
|
4
|
+
export * from "./useCardFooter";
|
5
|
+
export * from "./useCardFooterStyles";
|
6
6
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":[],"sources":["../../../src/components/CardFooter/index.ts"],"sourcesContent":["export * from './CardFooter';\nexport * from './CardFooter.types';\nexport * from './renderCardFooter';\nexport * from './useCardFooter';\nexport * from './useCardFooterStyles';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc"}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import * as React from
|
2
|
-
import { getSlots } from
|
1
|
+
import * as React from "react";
|
2
|
+
import { getSlots } from "@fluentui/react-utilities";
|
3
3
|
/**
|
4
4
|
* Render the final JSX of CardFooter.
|
5
5
|
*/
|
@@ -8,10 +8,6 @@ export const renderCardFooter_unstable = state => {
|
|
8
8
|
slots,
|
9
9
|
slotProps
|
10
10
|
} = getSlots(state);
|
11
|
-
return /*#__PURE__*/React.createElement(slots.root,
|
12
|
-
...slotProps.root
|
13
|
-
}, slotProps.root.children, slots.action && /*#__PURE__*/React.createElement(slots.action, {
|
14
|
-
...slotProps.action
|
15
|
-
}));
|
11
|
+
return /*#__PURE__*/React.createElement(slots.root, slotProps.root, slotProps.root.children, slots.action && /*#__PURE__*/React.createElement(slots.action, slotProps.action));
|
16
12
|
};
|
17
13
|
//# sourceMappingURL=renderCardFooter.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","getSlots","renderCardFooter_unstable","state","slots","slotProps","createElement","root","children","action"],"sources":["
|
1
|
+
{"version":3,"names":["React","getSlots","renderCardFooter_unstable","state","slots","slotProps","createElement","root","children","action"],"sources":["../../../src/components/CardFooter/renderCardFooter.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { CardFooterSlots, CardFooterState } from './CardFooter.types';\n\n/**\n * Render the final JSX of CardFooter.\n */\nexport const renderCardFooter_unstable = (state: CardFooterState) => {\n const { slots, slotProps } = getSlots<CardFooterSlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n {slotProps.root.children}\n {slots.action && <slots.action {...slotProps.action} />}\n </slots.root>\n );\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,QAAQ,QAAQ;AAGzB;;;AAGA,OAAO,MAAMC,yBAAA,GAA6BC,KAAA,IAA2B;EACnE,MAAM;IAAEC,KAAA;IAAOC;EAAS,CAAE,GAAGJ,QAAA,CAA0BE,KAAA;EAEvD,oBACEH,KAAA,CAAAM,aAAA,CAACF,KAAA,CAAMG,IAAI,EAAKF,SAAA,CAAUE,IAAI,EAC3BF,SAAA,CAAUE,IAAI,CAACC,QAAQ,EACvBJ,KAAA,CAAMK,MAAM,iBAAIT,KAAA,CAAAM,aAAA,CAACF,KAAA,CAAMK,MAAM,EAAKJ,SAAA,CAAUI,MAAM;AAGzD"}
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import
|
1
|
+
import * as React from "react";
|
2
|
+
import { getNativeElementProps, resolveShorthand } from "@fluentui/react-utilities";
|
2
3
|
/**
|
3
4
|
* Create the state required to render CardFooter.
|
4
5
|
*
|
@@ -14,10 +15,10 @@ export const useCardFooter_unstable = (props, ref) => {
|
|
14
15
|
} = props;
|
15
16
|
return {
|
16
17
|
components: {
|
17
|
-
root:
|
18
|
-
action:
|
18
|
+
root: "div",
|
19
|
+
action: "div"
|
19
20
|
},
|
20
|
-
root: getNativeElementProps(
|
21
|
+
root: getNativeElementProps("div", {
|
21
22
|
ref,
|
22
23
|
...props
|
23
24
|
}),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["getNativeElementProps","resolveShorthand","useCardFooter_unstable","props","ref","action","components","root"],"sources":["
|
1
|
+
{"version":3,"names":["React","getNativeElementProps","resolveShorthand","useCardFooter_unstable","props","ref","action","components","root"],"sources":["../../../src/components/CardFooter/useCardFooter.ts"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, resolveShorthand } from '@fluentui/react-utilities';\nimport type { CardFooterProps, CardFooterState } from './CardFooter.types';\n\n/**\n * Create the state required to render CardFooter.\n *\n * The returned state can be modified with hooks such as useCardFooterStyles_unstable,\n * before being passed to renderCardFooter_unstable.\n *\n * @param props - props from this instance of CardFooter\n * @param ref - reference to root HTMLElement of CardFooter\n */\nexport const useCardFooter_unstable = (props: CardFooterProps, ref: React.Ref<HTMLElement>): CardFooterState => {\n const { action } = props;\n\n return {\n components: {\n root: 'div',\n action: 'div',\n },\n\n root: getNativeElementProps('div', {\n ref,\n ...props,\n }),\n action: resolveShorthand(action),\n };\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,qBAAqB,EAAEC,gBAAgB,QAAQ;AAGxD;;;;;;;;;AASA,OAAO,MAAMC,sBAAA,GAAyBA,CAACC,KAAA,EAAwBC,GAAA,KAAiD;EAC9G,MAAM;IAAEC;EAAM,CAAE,GAAGF,KAAA;EAEnB,OAAO;IACLG,UAAA,EAAY;MACVC,IAAA,EAAM;MACNF,MAAA,EAAQ;IACV;IAEAE,IAAA,EAAMP,qBAAA,CAAsB,OAAO;MACjCI,GAAA;MACA,GAAGD;IACL;IACAE,MAAA,EAAQJ,gBAAA,CAAiBI,MAAA;EAC3B;AACF"}
|
@@ -1,10 +1,10 @@
|
|
1
|
-
import { __styles, mergeClasses, shorthands } from
|
1
|
+
import { __styles, mergeClasses, shorthands } from "@griffel/react";
|
2
2
|
/**
|
3
3
|
* Static CSS class names used internally for the component slots.
|
4
4
|
*/
|
5
5
|
export const cardFooterClassNames = {
|
6
|
-
root:
|
7
|
-
action:
|
6
|
+
root: "fui-CardFooter",
|
7
|
+
action: "fui-CardFooter__action"
|
8
8
|
};
|
9
9
|
const useStyles = /*#__PURE__*/__styles({
|
10
10
|
root: {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["__styles","mergeClasses","shorthands","cardFooterClassNames","root","action","useStyles","mc9l5x","Beiy3e4","i8kkvl","Belr9w4","Frg6f3","d","useCardFooterStyles_unstable","state","styles","className"],"sources":["
|
1
|
+
{"version":3,"names":["__styles","mergeClasses","shorthands","cardFooterClassNames","root","action","useStyles","mc9l5x","Beiy3e4","i8kkvl","Belr9w4","Frg6f3","d","useCardFooterStyles_unstable","state","styles","className"],"sources":["../../../src/components/CardFooter/useCardFooterStyles.ts"],"sourcesContent":["import type { SlotClassNames } from '@fluentui/react-utilities';\nimport { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport type { CardFooterSlots, CardFooterState } from './CardFooter.types';\n\n/**\n * Static CSS class names used internally for the component slots.\n */\nexport const cardFooterClassNames: SlotClassNames<CardFooterSlots> = {\n root: 'fui-CardFooter',\n action: 'fui-CardFooter__action',\n};\n\nconst useStyles = makeStyles({\n root: {\n display: 'flex',\n flexDirection: 'row',\n ...shorthands.gap('12px'),\n },\n action: {\n marginLeft: 'auto',\n },\n});\n\n/**\n * Apply styling to the CardFooter slots based on the state.\n */\nexport const useCardFooterStyles_unstable = (state: CardFooterState): CardFooterState => {\n const styles = useStyles();\n state.root.className = mergeClasses(cardFooterClassNames.root, styles.root, state.root.className);\n\n if (state.action) {\n state.action.className = mergeClasses(cardFooterClassNames.action, styles.action, state.action.className);\n }\n\n return state;\n};\n"],"mappings":"AACA,SAAAA,QAAA,EAAqBC,YAAY,EAAEC,UAAU,QAAQ;AAGrD;;;AAGA,OAAO,MAAMC,oBAAA,GAAwD;EACnEC,IAAA,EAAM;EACNC,MAAA,EAAQ;AACV;AAEA,MAAMC,SAAA,gBAAYN,QAAA;EAAAI,IAAA;IAAAG,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;EAAA;EAAAL,MAAA;IAAAM,MAAA;EAAA;AAAA;EAAAC,CAAA;AAAA,EASlB;AAEA;;;AAGA,OAAO,MAAMC,4BAAA,GAAgCC,KAAA,IAA4C;EACvF,MAAMC,MAAA,GAAST,SAAA;EACfQ,KAAA,CAAMV,IAAI,CAACY,SAAS,GAAGf,YAAA,CAAaE,oBAAA,CAAqBC,IAAI,EAAEW,MAAA,CAAOX,IAAI,EAAEU,KAAA,CAAMV,IAAI,CAACY,SAAS;EAEhG,IAAIF,KAAA,CAAMT,MAAM,EAAE;IAChBS,KAAA,CAAMT,MAAM,CAACW,SAAS,GAAGf,YAAA,CAAaE,oBAAA,CAAqBE,MAAM,EAAEU,MAAA,CAAOV,MAAM,EAAES,KAAA,CAAMT,MAAM,CAACW,SAAS;EAC1G;EAEA,OAAOF,KAAA;AACT"}
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import * as React from
|
2
|
-
import { useCardHeader_unstable } from
|
3
|
-
import { renderCardHeader_unstable } from
|
4
|
-
import { useCardHeaderStyles_unstable } from
|
1
|
+
import * as React from "react";
|
2
|
+
import { useCardHeader_unstable } from "./useCardHeader";
|
3
|
+
import { renderCardHeader_unstable } from "./renderCardHeader";
|
4
|
+
import { useCardHeaderStyles_unstable } from "./useCardHeaderStyles";
|
5
5
|
/**
|
6
6
|
* Component to render an image, text and an action in a Card component.
|
7
7
|
*/
|
@@ -10,5 +10,5 @@ export const CardHeader = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
10
10
|
useCardHeaderStyles_unstable(state);
|
11
11
|
return renderCardHeader_unstable(state);
|
12
12
|
});
|
13
|
-
CardHeader.displayName =
|
13
|
+
CardHeader.displayName = "CardHeader";
|
14
14
|
//# sourceMappingURL=CardHeader.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","useCardHeader_unstable","renderCardHeader_unstable","useCardHeaderStyles_unstable","CardHeader","forwardRef","props","ref","state","displayName"],"sources":["
|
1
|
+
{"version":3,"names":["React","useCardHeader_unstable","renderCardHeader_unstable","useCardHeaderStyles_unstable","CardHeader","forwardRef","props","ref","state","displayName"],"sources":["../../../src/components/CardHeader/CardHeader.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useCardHeader_unstable } from './useCardHeader';\nimport { renderCardHeader_unstable } from './renderCardHeader';\nimport { useCardHeaderStyles_unstable } from './useCardHeaderStyles';\nimport type { CardHeaderProps } from './CardHeader.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * Component to render an image, text and an action in a Card component.\n */\nexport const CardHeader: ForwardRefComponent<CardHeaderProps> = React.forwardRef((props, ref) => {\n const state = useCardHeader_unstable(props, ref);\n\n useCardHeaderStyles_unstable(state);\n return renderCardHeader_unstable(state);\n});\n\nCardHeader.displayName = 'CardHeader';\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,sBAAsB,QAAQ;AACvC,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,4BAA4B,QAAQ;AAI7C;;;AAGA,OAAO,MAAMC,UAAA,gBAAmDJ,KAAA,CAAMK,UAAU,CAAC,CAACC,KAAA,EAAOC,GAAA,KAAQ;EAC/F,MAAMC,KAAA,GAAQP,sBAAA,CAAuBK,KAAA,EAAOC,GAAA;EAE5CJ,4BAAA,CAA6BK,KAAA;EAC7B,OAAON,yBAAA,CAA0BM,KAAA;AACnC;AAEAJ,UAAA,CAAWK,WAAW,GAAG"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":[],"sources":["../../../src/components/CardHeader/CardHeader.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\n/**\n * Slots available in the CardHeader component.\n */\nexport type CardHeaderSlots = {\n /**\n * Root element of the component.\n */\n root: Slot<'div'>;\n\n /**\n * Element used to render an image or avatar related to the card.\n */\n image: Slot<'div', 'img'>;\n\n /**\n * Element used to render the main header title.\n */\n header: Slot<'div'>;\n\n /**\n * Element used to render short descriptions related to the title.\n */\n description: Slot<'div'>;\n\n /**\n * Container that renders on the far end of the footer, used for action buttons.\n */\n action?: Slot<'div'>;\n};\n\n/**\n * CardHeader component props.\n */\nexport type CardHeaderProps = ComponentProps<Partial<CardHeaderSlots>>;\n\n/**\n * State used in rendering CardHeader.\n */\nexport type CardHeaderState = ComponentState<CardHeaderSlots>;\n"],"mappings":"AAAA"}
|
@@ -1,6 +1,6 @@
|
|
1
|
-
export * from
|
2
|
-
export * from
|
3
|
-
export * from
|
4
|
-
export * from
|
5
|
-
export * from
|
1
|
+
export * from "./CardHeader";
|
2
|
+
export * from "./CardHeader.types";
|
3
|
+
export * from "./renderCardHeader";
|
4
|
+
export * from "./useCardHeader";
|
5
|
+
export * from "./useCardHeaderStyles";
|
6
6
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":[],"sources":["../../../src/components/CardHeader/index.ts"],"sourcesContent":["export * from './CardHeader';\nexport * from './CardHeader.types';\nexport * from './renderCardHeader';\nexport * from './useCardHeader';\nexport * from './useCardHeaderStyles';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc"}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import * as React from
|
2
|
-
import { getSlots } from
|
1
|
+
import * as React from "react";
|
2
|
+
import { getSlots } from "@fluentui/react-utilities";
|
3
3
|
/**
|
4
4
|
* Render the final JSX of CardHeader.
|
5
5
|
*/
|
@@ -8,16 +8,6 @@ export const renderCardHeader_unstable = state => {
|
|
8
8
|
slots,
|
9
9
|
slotProps
|
10
10
|
} = getSlots(state);
|
11
|
-
return /*#__PURE__*/React.createElement(slots.root,
|
12
|
-
...slotProps.root
|
13
|
-
}, slots.image && /*#__PURE__*/React.createElement(slots.image, {
|
14
|
-
...slotProps.image
|
15
|
-
}), /*#__PURE__*/React.createElement(slots.header, {
|
16
|
-
...slotProps.header
|
17
|
-
}), slots.description && /*#__PURE__*/React.createElement(slots.description, {
|
18
|
-
...slotProps.description
|
19
|
-
}), slots.action && /*#__PURE__*/React.createElement(slots.action, {
|
20
|
-
...slotProps.action
|
21
|
-
}));
|
11
|
+
return /*#__PURE__*/React.createElement(slots.root, slotProps.root, slots.image && /*#__PURE__*/React.createElement(slots.image, slotProps.image), /*#__PURE__*/React.createElement(slots.header, slotProps.header), slots.description && /*#__PURE__*/React.createElement(slots.description, slotProps.description), slots.action && /*#__PURE__*/React.createElement(slots.action, slotProps.action));
|
22
12
|
};
|
23
13
|
//# sourceMappingURL=renderCardHeader.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","getSlots","renderCardHeader_unstable","state","slots","slotProps","createElement","root","image","header","description","action"],"sources":["
|
1
|
+
{"version":3,"names":["React","getSlots","renderCardHeader_unstable","state","slots","slotProps","createElement","root","image","header","description","action"],"sources":["../../../src/components/CardHeader/renderCardHeader.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { CardHeaderSlots, CardHeaderState } from './CardHeader.types';\n\n/**\n * Render the final JSX of CardHeader.\n */\nexport const renderCardHeader_unstable = (state: CardHeaderState) => {\n const { slots, slotProps } = getSlots<CardHeaderSlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n {slots.image && <slots.image {...slotProps.image} />}\n <slots.header {...slotProps.header} />\n {slots.description && <slots.description {...slotProps.description} />}\n {slots.action && <slots.action {...slotProps.action} />}\n </slots.root>\n );\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,QAAQ,QAAQ;AAGzB;;;AAGA,OAAO,MAAMC,yBAAA,GAA6BC,KAAA,IAA2B;EACnE,MAAM;IAAEC,KAAA;IAAOC;EAAS,CAAE,GAAGJ,QAAA,CAA0BE,KAAA;EAEvD,oBACEH,KAAA,CAAAM,aAAA,CAACF,KAAA,CAAMG,IAAI,EAAKF,SAAA,CAAUE,IAAI,EAC3BH,KAAA,CAAMI,KAAK,iBAAIR,KAAA,CAAAM,aAAA,CAACF,KAAA,CAAMI,KAAK,EAAKH,SAAA,CAAUG,KAAK,gBAChDR,KAAA,CAAAM,aAAA,CAACF,KAAA,CAAMK,MAAM,EAAKJ,SAAA,CAAUI,MAAM,GACjCL,KAAA,CAAMM,WAAW,iBAAIV,KAAA,CAAAM,aAAA,CAACF,KAAA,CAAMM,WAAW,EAAKL,SAAA,CAAUK,WAAW,GACjEN,KAAA,CAAMO,MAAM,iBAAIX,KAAA,CAAAM,aAAA,CAACF,KAAA,CAAMO,MAAM,EAAKN,SAAA,CAAUM,MAAM;AAGzD"}
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import * as React from
|
2
|
-
import { getNativeElementProps, resolveShorthand, useId } from
|
3
|
-
import { useCardContext_unstable } from
|
4
|
-
import { cardHeaderClassNames } from
|
1
|
+
import * as React from "react";
|
2
|
+
import { getNativeElementProps, resolveShorthand, useId } from "@fluentui/react-utilities";
|
3
|
+
import { useCardContext_unstable } from "../Card/CardContext";
|
4
|
+
import { cardHeaderClassNames } from "./useCardHeaderStyles";
|
5
5
|
/**
|
6
6
|
* Create the state required to render CardHeader.
|
7
7
|
*
|
@@ -36,13 +36,13 @@ export const useCardHeader_unstable = (props, ref) => {
|
|
36
36
|
}, [header, setReferenceId, generatedId]);
|
37
37
|
return {
|
38
38
|
components: {
|
39
|
-
root:
|
40
|
-
image:
|
41
|
-
header:
|
42
|
-
description:
|
43
|
-
action:
|
39
|
+
root: "div",
|
40
|
+
image: "div",
|
41
|
+
header: "div",
|
42
|
+
description: "div",
|
43
|
+
action: "div"
|
44
44
|
},
|
45
|
-
root: getNativeElementProps(
|
45
|
+
root: getNativeElementProps("div", {
|
46
46
|
ref,
|
47
47
|
...props
|
48
48
|
}),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","getNativeElementProps","resolveShorthand","useId","useCardContext_unstable","cardHeaderClassNames","useCardHeader_unstable","props","ref","image","header","description","action","selectableA11yProps","referenceId","setReferenceId","headerRef","useRef","generatedId","useEffect","current","id","components","root","required","defaultProps"],"sources":["
|
1
|
+
{"version":3,"names":["React","getNativeElementProps","resolveShorthand","useId","useCardContext_unstable","cardHeaderClassNames","useCardHeader_unstable","props","ref","image","header","description","action","selectableA11yProps","referenceId","setReferenceId","headerRef","useRef","generatedId","useEffect","current","id","components","root","required","defaultProps"],"sources":["../../../src/components/CardHeader/useCardHeader.ts"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, resolveShorthand, useId } from '@fluentui/react-utilities';\nimport type { CardHeaderProps, CardHeaderState } from './CardHeader.types';\nimport { useCardContext_unstable } from '../Card/CardContext';\nimport { cardHeaderClassNames } from './useCardHeaderStyles';\n\n/**\n * Create the state required to render CardHeader.\n *\n * The returned state can be modified with hooks such as useCardHeaderStyles_unstable,\n * before being passed to renderCardHeader_unstable.\n *\n * @param props - props from this instance of CardHeader\n * @param ref - reference to root HTMLElement of CardHeader\n */\nexport const useCardHeader_unstable = (props: CardHeaderProps, ref: React.Ref<HTMLElement>): CardHeaderState => {\n const { image, header, description, action } = props;\n\n const {\n selectableA11yProps: { referenceId, setReferenceId },\n } = useCardContext_unstable();\n const headerRef = React.useRef<HTMLDivElement>(null);\n\n const generatedId = useId(cardHeaderClassNames.header, referenceId);\n\n React.useEffect(() => {\n if (header && headerRef.current) {\n const { id } = headerRef.current;\n\n setReferenceId(id ? id : generatedId);\n }\n }, [header, setReferenceId, generatedId]);\n\n return {\n components: {\n root: 'div',\n image: 'div',\n header: 'div',\n description: 'div',\n action: 'div',\n },\n\n root: getNativeElementProps('div', {\n ref,\n ...props,\n }),\n image: resolveShorthand(image),\n header: resolveShorthand(header, {\n required: true,\n defaultProps: {\n ref: headerRef,\n id: referenceId,\n },\n }),\n description: resolveShorthand(description),\n action: resolveShorthand(action),\n };\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,qBAAqB,EAAEC,gBAAgB,EAAEC,KAAK,QAAQ;AAE/D,SAASC,uBAAuB,QAAQ;AACxC,SAASC,oBAAoB,QAAQ;AAErC;;;;;;;;;AASA,OAAO,MAAMC,sBAAA,GAAyBA,CAACC,KAAA,EAAwBC,GAAA,KAAiD;EAC9G,MAAM;IAAEC,KAAA;IAAOC,MAAA;IAAQC,WAAA;IAAaC;EAAM,CAAE,GAAGL,KAAA;EAE/C,MAAM;IACJM,mBAAA,EAAqB;MAAEC,WAAA;MAAaC;IAAc;EAAE,CACrD,GAAGX,uBAAA;EACJ,MAAMY,SAAA,GAAYhB,KAAA,CAAMiB,MAAM,CAAiB,IAAI;EAEnD,MAAMC,WAAA,GAAcf,KAAA,CAAME,oBAAA,CAAqBK,MAAM,EAAEI,WAAA;EAEvDd,KAAA,CAAMmB,SAAS,CAAC,MAAM;IACpB,IAAIT,MAAA,IAAUM,SAAA,CAAUI,OAAO,EAAE;MAC/B,MAAM;QAAEC;MAAE,CAAE,GAAGL,SAAA,CAAUI,OAAO;MAEhCL,cAAA,CAAeM,EAAA,GAAKA,EAAA,GAAKH,WAAW;IACtC;EACF,GAAG,CAACR,MAAA,EAAQK,cAAA,EAAgBG,WAAA,CAAY;EAExC,OAAO;IACLI,UAAA,EAAY;MACVC,IAAA,EAAM;MACNd,KAAA,EAAO;MACPC,MAAA,EAAQ;MACRC,WAAA,EAAa;MACbC,MAAA,EAAQ;IACV;IAEAW,IAAA,EAAMtB,qBAAA,CAAsB,OAAO;MACjCO,GAAA;MACA,GAAGD;IACL;IACAE,KAAA,EAAOP,gBAAA,CAAiBO,KAAA;IACxBC,MAAA,EAAQR,gBAAA,CAAiBQ,MAAA,EAAQ;MAC/Bc,QAAA,EAAU,IAAI;MACdC,YAAA,EAAc;QACZjB,GAAA,EAAKQ,SAAA;QACLK,EAAA,EAAIP;MACN;IACF;IACAH,WAAA,EAAaT,gBAAA,CAAiBS,WAAA;IAC9BC,MAAA,EAAQV,gBAAA,CAAiBU,MAAA;EAC3B;AACF"}
|
@@ -1,19 +1,19 @@
|
|
1
|
-
import { __styles, mergeClasses } from
|
1
|
+
import { __styles, mergeClasses } from "@griffel/react";
|
2
2
|
/**
|
3
3
|
* Static CSS class names used internally for the component slots.
|
4
4
|
*/
|
5
5
|
export const cardHeaderClassNames = {
|
6
|
-
root:
|
7
|
-
image:
|
8
|
-
header:
|
9
|
-
description:
|
10
|
-
action:
|
6
|
+
root: "fui-CardHeader",
|
7
|
+
image: "fui-CardHeader__image",
|
8
|
+
header: "fui-CardHeader__header",
|
9
|
+
description: "fui-CardHeader__description",
|
10
|
+
action: "fui-CardHeader__action"
|
11
11
|
};
|
12
12
|
/**
|
13
13
|
* CSS variable names used internally for uniform styling in CardHeader.
|
14
14
|
*/
|
15
15
|
export const cardHeaderCSSVars = {
|
16
|
-
cardHeaderGapVar:
|
16
|
+
cardHeaderGapVar: "--fui-CardHeader--gap"
|
17
17
|
};
|
18
18
|
const useStyles = /*#__PURE__*/__styles({
|
19
19
|
root: {
|