@fluentui/react-card 0.0.0-nightly-20230526-0415.1 → 0.0.0-nightly-20230530-0415.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/CHANGELOG.json +17 -17
- package/CHANGELOG.md +11 -11
- package/lib/Card.js +1 -0
- package/lib/Card.js.map +1 -1
- package/lib/CardFooter.js +1 -0
- package/lib/CardFooter.js.map +1 -1
- package/lib/CardHeader.js +1 -0
- package/lib/CardHeader.js.map +1 -1
- package/lib/CardPreview.js +1 -0
- 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 -0
- package/lib/components/Card/Card.types.js.map +1 -1
- package/lib/components/Card/CardContext.js +13 -15
- package/lib/components/Card/CardContext.js.map +1 -1
- package/lib/components/Card/index.js +1 -0
- package/lib/components/Card/index.js.map +1 -1
- package/lib/components/Card/renderCard.js +7 -10
- package/lib/components/Card/renderCard.js.map +1 -1
- package/lib/components/Card/useCard.js +69 -76
- package/lib/components/Card/useCard.js.map +1 -1
- package/lib/components/Card/useCardContextValue.js +5 -6
- package/lib/components/Card/useCardContextValue.js.map +1 -1
- package/lib/components/Card/useCardSelectable.js +119 -97
- package/lib/components/Card/useCardSelectable.js.map +1 -1
- package/lib/components/Card/useCardStyles.styles.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 +2 -1
- package/lib/components/CardFooter/CardFooter.types.js.map +1 -1
- package/lib/components/CardFooter/index.js +1 -0
- package/lib/components/CardFooter/index.js.map +1 -1
- package/lib/components/CardFooter/renderCardFooter.js +5 -8
- package/lib/components/CardFooter/renderCardFooter.js.map +1 -1
- package/lib/components/CardFooter/useCardFooter.js +14 -16
- package/lib/components/CardFooter/useCardFooter.js.map +1 -1
- package/lib/components/CardFooter/useCardFooterStyles.styles.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 +2 -1
- package/lib/components/CardHeader/CardHeader.types.js.map +1 -1
- package/lib/components/CardHeader/index.js +1 -0
- package/lib/components/CardHeader/index.js.map +1 -1
- package/lib/components/CardHeader/renderCardHeader.js +5 -8
- package/lib/components/CardHeader/renderCardHeader.js.map +1 -1
- package/lib/components/CardHeader/useCardHeader.js +39 -47
- package/lib/components/CardHeader/useCardHeader.js.map +1 -1
- package/lib/components/CardHeader/useCardHeaderStyles.styles.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 +2 -1
- package/lib/components/CardPreview/CardPreview.types.js.map +1 -1
- package/lib/components/CardPreview/index.js +1 -0
- package/lib/components/CardPreview/index.js.map +1 -1
- package/lib/components/CardPreview/renderCardPreview.js +5 -8
- package/lib/components/CardPreview/renderCardPreview.js.map +1 -1
- package/lib/components/CardPreview/useCardPreview.js +40 -43
- package/lib/components/CardPreview/useCardPreview.js.map +1 -1
- package/lib/components/CardPreview/useCardPreviewStyles.styles.js.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib-commonjs/Card.js.map +1 -1
- package/lib-commonjs/CardFooter.js.map +1 -1
- package/lib-commonjs/CardHeader.js.map +1 -1
- package/lib-commonjs/CardPreview.js.map +1 -1
- package/lib-commonjs/components/Card/Card.js.map +1 -1
- package/lib-commonjs/components/Card/Card.types.js.map +1 -1
- package/lib-commonjs/components/Card/CardContext.js.map +1 -1
- package/lib-commonjs/components/Card/index.js.map +1 -1
- package/lib-commonjs/components/Card/renderCard.js.map +1 -1
- package/lib-commonjs/components/Card/useCard.js.map +1 -1
- package/lib-commonjs/components/Card/useCardContextValue.js.map +1 -1
- package/lib-commonjs/components/Card/useCardSelectable.js.map +1 -1
- package/lib-commonjs/components/CardFooter/CardFooter.js.map +1 -1
- package/lib-commonjs/components/CardFooter/CardFooter.types.js.map +1 -1
- package/lib-commonjs/components/CardFooter/index.js.map +1 -1
- package/lib-commonjs/components/CardFooter/renderCardFooter.js.map +1 -1
- package/lib-commonjs/components/CardFooter/useCardFooter.js.map +1 -1
- package/lib-commonjs/components/CardHeader/CardHeader.js.map +1 -1
- package/lib-commonjs/components/CardHeader/CardHeader.types.js.map +1 -1
- package/lib-commonjs/components/CardHeader/index.js.map +1 -1
- package/lib-commonjs/components/CardHeader/renderCardHeader.js.map +1 -1
- package/lib-commonjs/components/CardHeader/useCardHeader.js.map +1 -1
- package/lib-commonjs/components/CardPreview/CardPreview.js.map +1 -1
- package/lib-commonjs/components/CardPreview/CardPreview.types.js.map +1 -1
- package/lib-commonjs/components/CardPreview/index.js.map +1 -1
- package/lib-commonjs/components/CardPreview/renderCardPreview.js.map +1 -1
- package/lib-commonjs/components/CardPreview/useCardPreview.js.map +1 -1
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +8 -8
@@ -1,13 +1,10 @@
|
|
1
|
-
/** @jsxRuntime classic */ /** @jsx createElement */import { createElement } from '@fluentui/react-jsx-runtime';
|
1
|
+
/** @jsxRuntime classic */ /** @jsx createElement */ import { createElement } from '@fluentui/react-jsx-runtime';
|
2
2
|
import { getSlotsNext } from '@fluentui/react-utilities';
|
3
3
|
/**
|
4
4
|
* Render the final JSX of CardHeader.
|
5
|
-
*/
|
6
|
-
|
7
|
-
|
8
|
-
slots,
|
9
|
-
slotProps
|
10
|
-
} = getSlotsNext(state);
|
11
|
-
return /*#__PURE__*/createElement(slots.root, slotProps.root, slots.image && /*#__PURE__*/createElement(slots.image, slotProps.image), /*#__PURE__*/createElement(slots.header, slotProps.header), slots.description && /*#__PURE__*/createElement(slots.description, slotProps.description), slots.action && /*#__PURE__*/createElement(slots.action, slotProps.action));
|
5
|
+
*/ export const renderCardHeader_unstable = (state)=>{
|
6
|
+
const { slots , slotProps } = getSlotsNext(state);
|
7
|
+
return /*#__PURE__*/ createElement(slots.root, slotProps.root, slots.image && /*#__PURE__*/ createElement(slots.image, slotProps.image), /*#__PURE__*/ createElement(slots.header, slotProps.header), slots.description && /*#__PURE__*/ createElement(slots.description, slotProps.description), slots.action && /*#__PURE__*/ createElement(slots.action, slotProps.action));
|
12
8
|
};
|
9
|
+
|
13
10
|
//# sourceMappingURL=renderCardHeader.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../../src/components/CardHeader/renderCardHeader.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsx createElement */\n\nimport { createElement } from '@fluentui/react-jsx-runtime';\n\nimport { getSlotsNext } 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 } = getSlotsNext<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"],"names":["createElement","getSlotsNext","renderCardHeader_unstable","state","slots","slotProps","root","image","header","description","action"],"mappings":"AAAA,wBAAwB,GACxB,uBAAuB,GAEvB,SAASA,aAAa,QAAQ,8BAA8B;AAE5D,SAASC,YAAY,QAAQ,4BAA4B;AAGzD;;CAEC,GACD,OAAO,MAAMC,4BAA4B,CAACC,QAA2B;IACnE,MAAM,EAAEC,MAAK,EAAEC,UAAS,EAAE,GAAGJ,aAA8BE;IAE3D,qBACE,AAdJ,cAcKC,MAAME,IAAI,EAAKD,UAAUC,IAAI,EAC3BF,MAAMG,KAAK,kBAAI,AAftB,cAeuBH,MAAMG,KAAK,EAAKF,UAAUE,KAAK,iBAChD,AAhBN,cAgBOH,MAAMI,MAAM,EAAKH,UAAUG,MAAM,GACjCJ,MAAMK,WAAW,kBAAI,AAjB5B,cAiB6BL,MAAMK,WAAW,EAAKJ,UAAUI,WAAW,GACjEL,MAAMM,MAAM,kBAAI,AAlBvB,cAkBwBN,MAAMM,MAAM,EAAKL,UAAUK,MAAM;AAGzD,EAAE"}
|
@@ -10,52 +10,44 @@ import { cardHeaderClassNames } from './useCardHeaderStyles.styles';
|
|
10
10
|
*
|
11
11
|
* @param props - props from this instance of CardHeader
|
12
12
|
* @param ref - reference to root HTMLElement of CardHeader
|
13
|
-
*/
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
header,
|
18
|
-
|
19
|
-
|
20
|
-
} =
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
required: true,
|
52
|
-
defaultProps: {
|
53
|
-
ref: headerRef,
|
54
|
-
id: referenceId
|
55
|
-
}
|
56
|
-
}),
|
57
|
-
description: resolveShorthand(description),
|
58
|
-
action: resolveShorthand(action)
|
59
|
-
};
|
13
|
+
*/ export const useCardHeader_unstable = (props, ref)=>{
|
14
|
+
const { image , header , description , action } = props;
|
15
|
+
const { selectableA11yProps: { referenceId , setReferenceId } } = useCardContext_unstable();
|
16
|
+
const headerRef = React.useRef(null);
|
17
|
+
const generatedId = useId(cardHeaderClassNames.header, referenceId);
|
18
|
+
React.useEffect(()=>{
|
19
|
+
if (header && headerRef.current) {
|
20
|
+
const { id } = headerRef.current;
|
21
|
+
setReferenceId(id ? id : generatedId);
|
22
|
+
}
|
23
|
+
}, [
|
24
|
+
header,
|
25
|
+
setReferenceId,
|
26
|
+
generatedId
|
27
|
+
]);
|
28
|
+
return {
|
29
|
+
components: {
|
30
|
+
root: 'div',
|
31
|
+
image: 'div',
|
32
|
+
header: 'div',
|
33
|
+
description: 'div',
|
34
|
+
action: 'div'
|
35
|
+
},
|
36
|
+
root: getNativeElementProps('div', {
|
37
|
+
ref,
|
38
|
+
...props
|
39
|
+
}),
|
40
|
+
image: resolveShorthand(image),
|
41
|
+
header: resolveShorthand(header, {
|
42
|
+
required: true,
|
43
|
+
defaultProps: {
|
44
|
+
ref: headerRef,
|
45
|
+
id: referenceId
|
46
|
+
}
|
47
|
+
}),
|
48
|
+
description: resolveShorthand(description),
|
49
|
+
action: resolveShorthand(action)
|
50
|
+
};
|
60
51
|
};
|
52
|
+
|
61
53
|
//# sourceMappingURL=useCardHeader.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"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.styles';\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"],"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"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,EAAEC,gBAAgB,EAAEC,KAAK,QAAQ,4BAA4B;AAE3F,SAASC,uBAAuB,QAAQ,sBAAsB;AAC9D,SAASC,oBAAoB,QAAQ,+BAA+B;AAEpE;;;;;;;;CAQC,GACD,OAAO,MAAMC,yBAAyB,CAACC,OAAwBC,MAAiD;IAC9G,MAAM,EAAEC,MAAK,EAAEC,OAAM,EAAEC,YAAW,EAAEC,OAAM,EAAE,GAAGL;IAE/C,MAAM,EACJM,qBAAqB,EAAEC,YAAW,EAAEC,eAAc,EAAE,CAAA,EACrD,GAAGX;IACJ,MAAMY,YAAYhB,MAAMiB,MAAM,CAAiB,IAAI;IAEnD,MAAMC,cAAcf,MAAME,qBAAqBK,MAAM,EAAEI;IAEvDd,MAAMmB,SAAS,CAAC,IAAM;QACpB,IAAIT,UAAUM,UAAUI,OAAO,EAAE;YAC/B,MAAM,EAAEC,GAAE,EAAE,GAAGL,UAAUI,OAAO;YAEhCL,eAAeM,KAAKA,KAAKH,WAAW;QACtC,CAAC;IACH,GAAG;QAACR;QAAQK;QAAgBG;KAAY;IAExC,OAAO;QACLI,YAAY;YACVC,MAAM;YACNd,OAAO;YACPC,QAAQ;YACRC,aAAa;YACbC,QAAQ;QACV;QAEAW,MAAMtB,sBAAsB,OAAO;YACjCO;YACA,GAAGD,KAAK;QACV;QACAE,OAAOP,iBAAiBO;QACxBC,QAAQR,iBAAiBQ,QAAQ;YAC/Bc,UAAU,IAAI;YACdC,cAAc;gBACZjB,KAAKQ;gBACLK,IAAIP;YACN;QACF;QACAH,aAAaT,iBAAiBS;QAC9BC,QAAQV,iBAAiBU;IAC3B;AACF,EAAE"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["__styles","mergeClasses","cardHeaderClassNames","root","image","header","description","action","cardHeaderCSSVars","cardHeaderGapVar","useStyles","Bkc6ea2","mc9l5x","t4k1zu","v29qe6","Bt984gj","t21cq0","Br312pm","Ijaq50","Frg6f3","d","useCardHeaderStyles_unstable","state","styles","className"],"sources":["../../../src/components/CardHeader/useCardHeaderStyles.styles.ts"],"sourcesContent":["import type { SlotClassNames } from '@fluentui/react-utilities';\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport type { CardHeaderSlots, CardHeaderState } from './CardHeader.types';\n\n/**\n * Static CSS class names used internally for the component slots.\n */\nexport const cardHeaderClassNames: SlotClassNames<CardHeaderSlots> = {\n root: 'fui-CardHeader',\n image: 'fui-CardHeader__image',\n header: 'fui-CardHeader__header',\n description: 'fui-CardHeader__description',\n action: 'fui-CardHeader__action',\n};\n\n/**\n * CSS variable names used internally for uniform styling in CardHeader.\n */\nexport const cardHeaderCSSVars = {\n cardHeaderGapVar: '--fui-CardHeader--gap',\n};\n\nconst useStyles = makeStyles({\n root: {\n [cardHeaderCSSVars.cardHeaderGapVar]: '12px',\n display: 'grid',\n gridAutoColumns: 'min-content 1fr min-content',\n gridAutoRows: '1fr min-content',\n alignItems: 'center',\n },\n image: {\n display: 'inline-flex',\n marginRight: `var(${cardHeaderCSSVars.cardHeaderGapVar})`,\n gridColumnStart: '1',\n gridRowStart: 'span 2',\n },\n header: {\n gridColumnStart: '2',\n gridRowStart: '1',\n },\n description: {\n gridColumnStart: '2',\n gridRowStart: '2',\n },\n action: {\n marginLeft: `var(${cardHeaderCSSVars.cardHeaderGapVar})`,\n gridColumnStart: '3',\n gridRowStart: 'span 2',\n },\n});\n\n/**\n * Apply styling to the CardHeader slots based on the state.\n */\nexport const useCardHeaderStyles_unstable = (state: CardHeaderState): CardHeaderState => {\n const styles = useStyles();\n state.root.className = mergeClasses(cardHeaderClassNames.root, styles.root, state.root.className);\n\n if (state.image) {\n state.image.className = mergeClasses(cardHeaderClassNames.image, styles.image, state.image.className);\n }\n\n if (state.header) {\n state.header.className = mergeClasses(cardHeaderClassNames.header, styles.header, state.header.className);\n }\n\n if (state.description) {\n state.description.className = mergeClasses(\n cardHeaderClassNames.description,\n styles.description,\n state.description.className,\n );\n }\n\n if (state.action) {\n state.action.className = mergeClasses(cardHeaderClassNames.action, styles.action, state.action.className);\n }\n\n return state;\n};\n"],"mappings":"AACA,SAAAA,QAAA,EAAqBC,YAAY,QAAQ;AAGzC;;;AAGA,OAAO,MAAMC,oBAAA,GAAwD;EACnEC,IAAA,EAAM;EACNC,KAAA,EAAO;EACPC,MAAA,EAAQ;EACRC,WAAA,EAAa;EACbC,MAAA,EAAQ;AACV;AAEA;;;AAGA,OAAO,MAAMC,iBAAA,GAAoB;EAC/BC,gBAAA,EAAkB;AACpB;AAEA,MAAMC,SAAA,gBAAYV,QAAA;EAAAG,IAAA;IAAAQ,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;EAAA;EAAAX,KAAA;IAAAQ,MAAA;IAAAI,MAAA;IAAAC,OAAA;IAAAC,MAAA;EAAA;EAAAb,MAAA;IAAAY,OAAA;IAAAC,MAAA;EAAA;EAAAZ,WAAA;IAAAW,OAAA;IAAAC,MAAA;EAAA;EAAAX,MAAA;IAAAY,MAAA;IAAAF,OAAA;IAAAC,MAAA;EAAA;AAAA;EAAAE,CAAA;AAAA,
|
1
|
+
{"version":3,"names":["__styles","mergeClasses","cardHeaderClassNames","root","image","header","description","action","cardHeaderCSSVars","cardHeaderGapVar","useStyles","Bkc6ea2","mc9l5x","t4k1zu","v29qe6","Bt984gj","t21cq0","Br312pm","Ijaq50","Frg6f3","d","useCardHeaderStyles_unstable","state","styles","className"],"sources":["../../../src/components/CardHeader/useCardHeaderStyles.styles.ts"],"sourcesContent":["import type { SlotClassNames } from '@fluentui/react-utilities';\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport type { CardHeaderSlots, CardHeaderState } from './CardHeader.types';\n\n/**\n * Static CSS class names used internally for the component slots.\n */\nexport const cardHeaderClassNames: SlotClassNames<CardHeaderSlots> = {\n root: 'fui-CardHeader',\n image: 'fui-CardHeader__image',\n header: 'fui-CardHeader__header',\n description: 'fui-CardHeader__description',\n action: 'fui-CardHeader__action',\n};\n\n/**\n * CSS variable names used internally for uniform styling in CardHeader.\n */\nexport const cardHeaderCSSVars = {\n cardHeaderGapVar: '--fui-CardHeader--gap',\n};\n\nconst useStyles = makeStyles({\n root: {\n [cardHeaderCSSVars.cardHeaderGapVar]: '12px',\n display: 'grid',\n gridAutoColumns: 'min-content 1fr min-content',\n gridAutoRows: '1fr min-content',\n alignItems: 'center',\n },\n image: {\n display: 'inline-flex',\n marginRight: `var(${cardHeaderCSSVars.cardHeaderGapVar})`,\n gridColumnStart: '1',\n gridRowStart: 'span 2',\n },\n header: {\n gridColumnStart: '2',\n gridRowStart: '1',\n },\n description: {\n gridColumnStart: '2',\n gridRowStart: '2',\n },\n action: {\n marginLeft: `var(${cardHeaderCSSVars.cardHeaderGapVar})`,\n gridColumnStart: '3',\n gridRowStart: 'span 2',\n },\n});\n\n/**\n * Apply styling to the CardHeader slots based on the state.\n */\nexport const useCardHeaderStyles_unstable = (state: CardHeaderState): CardHeaderState => {\n const styles = useStyles();\n state.root.className = mergeClasses(cardHeaderClassNames.root, styles.root, state.root.className);\n\n if (state.image) {\n state.image.className = mergeClasses(cardHeaderClassNames.image, styles.image, state.image.className);\n }\n\n if (state.header) {\n state.header.className = mergeClasses(cardHeaderClassNames.header, styles.header, state.header.className);\n }\n\n if (state.description) {\n state.description.className = mergeClasses(\n cardHeaderClassNames.description,\n styles.description,\n state.description.className,\n );\n }\n\n if (state.action) {\n state.action.className = mergeClasses(cardHeaderClassNames.action, styles.action, state.action.className);\n }\n\n return state;\n};\n"],"mappings":"AACA,SAAAA,QAAA,EAAqBC,YAAY,QAAQ;AAGzC;;;AAGA,OAAO,MAAMC,oBAAA,GAAwD;EACnEC,IAAA,EAAM;EACNC,KAAA,EAAO;EACPC,MAAA,EAAQ;EACRC,WAAA,EAAa;EACbC,MAAA,EAAQ;AACV;AAEA;;;AAGA,OAAO,MAAMC,iBAAA,GAAoB;EAC/BC,gBAAA,EAAkB;AACpB;AAEA,MAAMC,SAAA,gBAAYV,QAAA;EAAAG,IAAA;IAAAQ,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;EAAA;EAAAX,KAAA;IAAAQ,MAAA;IAAAI,MAAA;IAAAC,OAAA;IAAAC,MAAA;EAAA;EAAAb,MAAA;IAAAY,OAAA;IAAAC,MAAA;EAAA;EAAAZ,WAAA;IAAAW,OAAA;IAAAC,MAAA;EAAA;EAAAX,MAAA;IAAAY,MAAA;IAAAF,OAAA;IAAAC,MAAA;EAAA;AAAA;EAAAE,CAAA;AAAA,CA2BlB;AAEA;;;AAGA,OAAO,MAAMC,4BAAA,GAAgCC,KAAA,IAA4C;EACvF,MAAMC,MAAA,GAASb,SAAA;EACfY,KAAA,CAAMnB,IAAI,CAACqB,SAAS,GAAGvB,YAAA,CAAaC,oBAAA,CAAqBC,IAAI,EAAEoB,MAAA,CAAOpB,IAAI,EAAEmB,KAAA,CAAMnB,IAAI,CAACqB,SAAS;EAEhG,IAAIF,KAAA,CAAMlB,KAAK,EAAE;IACfkB,KAAA,CAAMlB,KAAK,CAACoB,SAAS,GAAGvB,YAAA,CAAaC,oBAAA,CAAqBE,KAAK,EAAEmB,MAAA,CAAOnB,KAAK,EAAEkB,KAAA,CAAMlB,KAAK,CAACoB,SAAS;EACtG;EAEA,IAAIF,KAAA,CAAMjB,MAAM,EAAE;IAChBiB,KAAA,CAAMjB,MAAM,CAACmB,SAAS,GAAGvB,YAAA,CAAaC,oBAAA,CAAqBG,MAAM,EAAEkB,MAAA,CAAOlB,MAAM,EAAEiB,KAAA,CAAMjB,MAAM,CAACmB,SAAS;EAC1G;EAEA,IAAIF,KAAA,CAAMhB,WAAW,EAAE;IACrBgB,KAAA,CAAMhB,WAAW,CAACkB,SAAS,GAAGvB,YAAA,CAC5BC,oBAAA,CAAqBI,WAAW,EAChCiB,MAAA,CAAOjB,WAAW,EAClBgB,KAAA,CAAMhB,WAAW,CAACkB,SAAS;EAE/B;EAEA,IAAIF,KAAA,CAAMf,MAAM,EAAE;IAChBe,KAAA,CAAMf,MAAM,CAACiB,SAAS,GAAGvB,YAAA,CAAaC,oBAAA,CAAqBK,MAAM,EAAEgB,MAAA,CAAOhB,MAAM,EAAEe,KAAA,CAAMf,MAAM,CAACiB,SAAS;EAC1G;EAEA,OAAOF,KAAA;AACT"}
|
@@ -4,11 +4,11 @@ import { renderCardPreview_unstable } from './renderCardPreview';
|
|
4
4
|
import { useCardPreviewStyles_unstable } from './useCardPreviewStyles.styles';
|
5
5
|
/**
|
6
6
|
* Component to render image previews of documents or articles in a Card component.
|
7
|
-
*/
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
return renderCardPreview_unstable(state);
|
7
|
+
*/ export const CardPreview = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
8
|
+
const state = useCardPreview_unstable(props, ref);
|
9
|
+
useCardPreviewStyles_unstable(state);
|
10
|
+
return renderCardPreview_unstable(state);
|
12
11
|
});
|
13
12
|
CardPreview.displayName = 'CardPreview';
|
13
|
+
|
14
14
|
//# sourceMappingURL=CardPreview.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../../src/components/CardPreview/CardPreview.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useCardPreview_unstable } from './useCardPreview';\nimport { renderCardPreview_unstable } from './renderCardPreview';\nimport { useCardPreviewStyles_unstable } from './useCardPreviewStyles.styles';\nimport type { CardPreviewProps } from './CardPreview.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * Component to render image previews of documents or articles in a Card component.\n */\nexport const CardPreview: ForwardRefComponent<CardPreviewProps> = React.forwardRef((props, ref) => {\n const state = useCardPreview_unstable(props, ref);\n\n useCardPreviewStyles_unstable(state);\n return renderCardPreview_unstable(state);\n});\n\nCardPreview.displayName = 'CardPreview';\n"],"names":["React","useCardPreview_unstable","renderCardPreview_unstable","useCardPreviewStyles_unstable","CardPreview","forwardRef","props","ref","state","displayName"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,uBAAuB,QAAQ,mBAAmB;AAC3D,SAASC,0BAA0B,QAAQ,sBAAsB;AACjE,SAASC,6BAA6B,QAAQ,gCAAgC;AAI9E;;CAEC,GACD,OAAO,MAAMC,4BAAqDJ,MAAMK,UAAU,CAAC,CAACC,OAAOC,MAAQ;IACjG,MAAMC,QAAQP,wBAAwBK,OAAOC;IAE7CJ,8BAA8BK;IAC9B,OAAON,2BAA2BM;AACpC,GAAG;AAEHJ,YAAYK,WAAW,GAAG"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../../src/components/CardPreview/CardPreview.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\n/**\n * Slots available in the Card component.\n */\nexport type CardPreviewSlots = {\n /**\n * Root element of the component.\n */\n root: Slot<'div'>;\n\n /**\n * Container that holds a logo related to the image preview provided.\n */\n logo?: Slot<'div', 'img'>;\n};\n\n/**\n * CardPreview component props.\n */\nexport type CardPreviewProps = ComponentProps<CardPreviewSlots>;\n\n/**\n * State used in rendering CardPreview.\n */\nexport type CardPreviewState = ComponentState<CardPreviewSlots>;\n"],"names":[],"mappings":"AAAA,WAyBgE"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../../src/components/CardPreview/index.ts"],"sourcesContent":["export * from './CardPreview';\nexport * from './CardPreview.types';\nexport * from './renderCardPreview';\nexport * from './useCardPreview';\nexport * from './useCardPreviewStyles.styles';\n"],"names":[],"mappings":"AAAA,cAAc,gBAAgB;AAC9B,cAAc,sBAAsB;AACpC,cAAc,sBAAsB;AACpC,cAAc,mBAAmB;AACjC,cAAc,gCAAgC"}
|
@@ -1,13 +1,10 @@
|
|
1
|
-
/** @jsxRuntime classic */ /** @jsx createElement */import { createElement } from '@fluentui/react-jsx-runtime';
|
1
|
+
/** @jsxRuntime classic */ /** @jsx createElement */ import { createElement } from '@fluentui/react-jsx-runtime';
|
2
2
|
import { getSlotsNext } from '@fluentui/react-utilities';
|
3
3
|
/**
|
4
4
|
* Render the final JSX of CardPreview.
|
5
|
-
*/
|
6
|
-
|
7
|
-
|
8
|
-
slots,
|
9
|
-
slotProps
|
10
|
-
} = getSlotsNext(state);
|
11
|
-
return /*#__PURE__*/createElement(slots.root, slotProps.root, slotProps.root.children, slots.logo && /*#__PURE__*/createElement(slots.logo, slotProps.logo));
|
5
|
+
*/ export const renderCardPreview_unstable = (state)=>{
|
6
|
+
const { slots , slotProps } = getSlotsNext(state);
|
7
|
+
return /*#__PURE__*/ createElement(slots.root, slotProps.root, slotProps.root.children, slots.logo && /*#__PURE__*/ createElement(slots.logo, slotProps.logo));
|
12
8
|
};
|
9
|
+
|
13
10
|
//# sourceMappingURL=renderCardPreview.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../../src/components/CardPreview/renderCardPreview.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsx createElement */\n\nimport { createElement } from '@fluentui/react-jsx-runtime';\n\nimport { getSlotsNext } from '@fluentui/react-utilities';\nimport type { CardPreviewSlots, CardPreviewState } from './CardPreview.types';\n\n/**\n * Render the final JSX of CardPreview.\n */\nexport const renderCardPreview_unstable = (state: CardPreviewState) => {\n const { slots, slotProps } = getSlotsNext<CardPreviewSlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n {slotProps.root.children}\n {slots.logo && <slots.logo {...slotProps.logo} />}\n </slots.root>\n );\n};\n"],"names":["createElement","getSlotsNext","renderCardPreview_unstable","state","slots","slotProps","root","children","logo"],"mappings":"AAAA,wBAAwB,GACxB,uBAAuB,GAEvB,SAASA,aAAa,QAAQ,8BAA8B;AAE5D,SAASC,YAAY,QAAQ,4BAA4B;AAGzD;;CAEC,GACD,OAAO,MAAMC,6BAA6B,CAACC,QAA4B;IACrE,MAAM,EAAEC,MAAK,EAAEC,UAAS,EAAE,GAAGJ,aAA+BE;IAE5D,qBACE,AAdJ,cAcKC,MAAME,IAAI,EAAKD,UAAUC,IAAI,EAC3BD,UAAUC,IAAI,CAACC,QAAQ,EACvBH,MAAMI,IAAI,kBAAI,AAhBrB,cAgBsBJ,MAAMI,IAAI,EAAKH,UAAUG,IAAI;AAGnD,EAAE"}
|
@@ -10,49 +10,46 @@ import { cardPreviewClassNames } from './useCardPreviewStyles.styles';
|
|
10
10
|
*
|
11
11
|
* @param props - props from this instance of CardPreview
|
12
12
|
* @param ref - reference to root HTMLElement of CardPreview
|
13
|
-
*/
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
referenceLabel,
|
21
|
-
referenceId,
|
22
|
-
setReferenceLabel,
|
23
|
-
setReferenceId
|
24
|
-
}
|
25
|
-
} = useCardContext_unstable();
|
26
|
-
const previewRef = useMergedRefs(ref, React.useRef(null));
|
27
|
-
React.useEffect(() => {
|
28
|
-
if (referenceLabel && referenceId) {
|
29
|
-
return;
|
30
|
-
}
|
31
|
-
if (previewRef.current && previewRef.current.parentNode) {
|
32
|
-
const img = previewRef.current.parentNode.querySelector(`.${cardPreviewClassNames.root} > img`);
|
33
|
-
if (img) {
|
34
|
-
const ariaLabel = img.getAttribute('aria-label');
|
35
|
-
const ariaDescribedby = img.getAttribute('aria-describedby');
|
36
|
-
if (ariaDescribedby) {
|
37
|
-
setReferenceId(ariaDescribedby);
|
38
|
-
} else if (img.alt) {
|
39
|
-
setReferenceLabel(img.alt);
|
40
|
-
} else if (ariaLabel) {
|
41
|
-
setReferenceLabel(ariaLabel);
|
13
|
+
*/ export const useCardPreview_unstable = (props, ref)=>{
|
14
|
+
const { logo } = props;
|
15
|
+
const { selectableA11yProps: { referenceLabel , referenceId , setReferenceLabel , setReferenceId } } = useCardContext_unstable();
|
16
|
+
const previewRef = useMergedRefs(ref, React.useRef(null));
|
17
|
+
React.useEffect(()=>{
|
18
|
+
if (referenceLabel && referenceId) {
|
19
|
+
return;
|
42
20
|
}
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
21
|
+
if (previewRef.current && previewRef.current.parentNode) {
|
22
|
+
const img = previewRef.current.parentNode.querySelector(`.${cardPreviewClassNames.root} > img`);
|
23
|
+
if (img) {
|
24
|
+
const ariaLabel = img.getAttribute('aria-label');
|
25
|
+
const ariaDescribedby = img.getAttribute('aria-describedby');
|
26
|
+
if (ariaDescribedby) {
|
27
|
+
setReferenceId(ariaDescribedby);
|
28
|
+
} else if (img.alt) {
|
29
|
+
setReferenceLabel(img.alt);
|
30
|
+
} else if (ariaLabel) {
|
31
|
+
setReferenceLabel(ariaLabel);
|
32
|
+
}
|
33
|
+
}
|
34
|
+
}
|
35
|
+
}, [
|
36
|
+
setReferenceLabel,
|
37
|
+
referenceLabel,
|
38
|
+
previewRef,
|
39
|
+
referenceId,
|
40
|
+
setReferenceId
|
41
|
+
]);
|
42
|
+
return {
|
43
|
+
components: {
|
44
|
+
root: 'div',
|
45
|
+
logo: 'div'
|
46
|
+
},
|
47
|
+
root: getNativeElementProps('div', {
|
48
|
+
ref: previewRef,
|
49
|
+
...props
|
50
|
+
}),
|
51
|
+
logo: resolveShorthand(logo)
|
52
|
+
};
|
57
53
|
};
|
54
|
+
|
58
55
|
//# sourceMappingURL=useCardPreview.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../../src/components/CardPreview/useCardPreview.ts"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, resolveShorthand, useMergedRefs } from '@fluentui/react-utilities';\nimport type { CardPreviewProps, CardPreviewState } from './CardPreview.types';\nimport { useCardContext_unstable } from '../Card/CardContext';\nimport { cardPreviewClassNames } from './useCardPreviewStyles.styles';\n\n/**\n * Create the state required to render CardPreview.\n *\n * The returned state can be modified with hooks such as useCardPreviewStyles_unstable,\n * before being passed to renderCardPreview_unstable.\n *\n * @param props - props from this instance of CardPreview\n * @param ref - reference to root HTMLElement of CardPreview\n */\nexport const useCardPreview_unstable = (props: CardPreviewProps, ref: React.Ref<HTMLElement>): CardPreviewState => {\n const { logo } = props;\n\n const {\n selectableA11yProps: { referenceLabel, referenceId, setReferenceLabel, setReferenceId },\n } = useCardContext_unstable();\n const previewRef = useMergedRefs(ref, React.useRef<HTMLDivElement>(null));\n\n React.useEffect(() => {\n if (referenceLabel && referenceId) {\n return;\n }\n\n if (previewRef.current && previewRef.current.parentNode) {\n const img = previewRef.current.parentNode.querySelector<HTMLImageElement>(`.${cardPreviewClassNames.root} > img`);\n\n if (img) {\n const ariaLabel = img.getAttribute('aria-label');\n const ariaDescribedby = img.getAttribute('aria-describedby');\n\n if (ariaDescribedby) {\n setReferenceId(ariaDescribedby);\n } else if (img.alt) {\n setReferenceLabel(img.alt);\n } else if (ariaLabel) {\n setReferenceLabel(ariaLabel);\n }\n }\n }\n }, [setReferenceLabel, referenceLabel, previewRef, referenceId, setReferenceId]);\n\n return {\n components: {\n root: 'div',\n logo: 'div',\n },\n\n root: getNativeElementProps('div', {\n ref: previewRef,\n ...props,\n }),\n logo: resolveShorthand(logo),\n };\n};\n"],"names":["React","getNativeElementProps","resolveShorthand","useMergedRefs","useCardContext_unstable","cardPreviewClassNames","useCardPreview_unstable","props","ref","logo","selectableA11yProps","referenceLabel","referenceId","setReferenceLabel","setReferenceId","previewRef","useRef","useEffect","current","parentNode","img","querySelector","root","ariaLabel","getAttribute","ariaDescribedby","alt","components"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,EAAEC,gBAAgB,EAAEC,aAAa,QAAQ,4BAA4B;AAEnG,SAASC,uBAAuB,QAAQ,sBAAsB;AAC9D,SAASC,qBAAqB,QAAQ,gCAAgC;AAEtE;;;;;;;;CAQC,GACD,OAAO,MAAMC,0BAA0B,CAACC,OAAyBC,MAAkD;IACjH,MAAM,EAAEC,KAAI,EAAE,GAAGF;IAEjB,MAAM,EACJG,qBAAqB,EAAEC,eAAc,EAAEC,YAAW,EAAEC,kBAAiB,EAAEC,eAAc,EAAE,CAAA,EACxF,GAAGV;IACJ,MAAMW,aAAaZ,cAAcK,KAAKR,MAAMgB,MAAM,CAAiB,IAAI;IAEvEhB,MAAMiB,SAAS,CAAC,IAAM;QACpB,IAAIN,kBAAkBC,aAAa;YACjC;QACF,CAAC;QAED,IAAIG,WAAWG,OAAO,IAAIH,WAAWG,OAAO,CAACC,UAAU,EAAE;YACvD,MAAMC,MAAML,WAAWG,OAAO,CAACC,UAAU,CAACE,aAAa,CAAmB,CAAC,CAAC,EAAEhB,sBAAsBiB,IAAI,CAAC,MAAM,CAAC;YAEhH,IAAIF,KAAK;gBACP,MAAMG,YAAYH,IAAII,YAAY,CAAC;gBACnC,MAAMC,kBAAkBL,IAAII,YAAY,CAAC;gBAEzC,IAAIC,iBAAiB;oBACnBX,eAAeW;gBACjB,OAAO,IAAIL,IAAIM,GAAG,EAAE;oBAClBb,kBAAkBO,IAAIM,GAAG;gBAC3B,OAAO,IAAIH,WAAW;oBACpBV,kBAAkBU;gBACpB,CAAC;YACH,CAAC;QACH,CAAC;IACH,GAAG;QAACV;QAAmBF;QAAgBI;QAAYH;QAAaE;KAAe;IAE/E,OAAO;QACLa,YAAY;YACVL,MAAM;YACNb,MAAM;QACR;QAEAa,MAAMrB,sBAAsB,OAAO;YACjCO,KAAKO;YACL,GAAGR,KAAK;QACV;QACAE,MAAMP,iBAAiBO;IACzB;AACF,EAAE"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["__styles","mergeClasses","cardPreviewClassNames","root","logo","useStyles","qhf8xq","pnb5jt","Elg2ur","B184ckt","B5kzvoi","oyh7mz","a9b677","Bqenvij","d","useCardPreviewStyles_unstable","state","styles","className"],"sources":["../../../src/components/CardPreview/useCardPreviewStyles.styles.ts"],"sourcesContent":["import type { SlotClassNames } from '@fluentui/react-utilities';\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport type { CardPreviewSlots, CardPreviewState } from './CardPreview.types';\n\n/**\n * Static CSS class names used internally for the component slots.\n */\nexport const cardPreviewClassNames: SlotClassNames<CardPreviewSlots> = {\n root: 'fui-CardPreview',\n logo: 'fui-CardPreview__logo',\n};\n\nconst useStyles = makeStyles({\n root: {\n position: 'relative',\n\n [`> :not(.${cardPreviewClassNames.logo})`]: {\n display: 'block',\n height: '100%',\n width: '100%',\n },\n },\n\n logo: {\n position: 'absolute',\n bottom: '12px',\n left: '12px',\n width: '32px',\n height: '32px',\n },\n});\n\n/**\n * Apply styling to the CardPreview slots based on the state.\n */\nexport const useCardPreviewStyles_unstable = (state: CardPreviewState): CardPreviewState => {\n const styles = useStyles();\n state.root.className = mergeClasses(cardPreviewClassNames.root, styles.root, state.root.className);\n\n if (state.logo) {\n state.logo.className = mergeClasses(cardPreviewClassNames.logo, styles.logo, state.logo.className);\n }\n\n return state;\n};\n"],"mappings":"AACA,SAAAA,QAAA,EAAqBC,YAAY,QAAQ;AAGzC;;;AAGA,OAAO,MAAMC,qBAAA,GAA0D;EACrEC,IAAA,EAAM;EACNC,IAAA,EAAM;AACR;AAEA,MAAMC,SAAA,gBAAYL,QAAA;EAAAG,IAAA;IAAAG,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;EAAA;EAAAL,IAAA;IAAAE,MAAA;IAAAI,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;EAAA;AAAA;EAAAC,CAAA;AAAA,
|
1
|
+
{"version":3,"names":["__styles","mergeClasses","cardPreviewClassNames","root","logo","useStyles","qhf8xq","pnb5jt","Elg2ur","B184ckt","B5kzvoi","oyh7mz","a9b677","Bqenvij","d","useCardPreviewStyles_unstable","state","styles","className"],"sources":["../../../src/components/CardPreview/useCardPreviewStyles.styles.ts"],"sourcesContent":["import type { SlotClassNames } from '@fluentui/react-utilities';\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport type { CardPreviewSlots, CardPreviewState } from './CardPreview.types';\n\n/**\n * Static CSS class names used internally for the component slots.\n */\nexport const cardPreviewClassNames: SlotClassNames<CardPreviewSlots> = {\n root: 'fui-CardPreview',\n logo: 'fui-CardPreview__logo',\n};\n\nconst useStyles = makeStyles({\n root: {\n position: 'relative',\n\n [`> :not(.${cardPreviewClassNames.logo})`]: {\n display: 'block',\n height: '100%',\n width: '100%',\n },\n },\n\n logo: {\n position: 'absolute',\n bottom: '12px',\n left: '12px',\n width: '32px',\n height: '32px',\n },\n});\n\n/**\n * Apply styling to the CardPreview slots based on the state.\n */\nexport const useCardPreviewStyles_unstable = (state: CardPreviewState): CardPreviewState => {\n const styles = useStyles();\n state.root.className = mergeClasses(cardPreviewClassNames.root, styles.root, state.root.className);\n\n if (state.logo) {\n state.logo.className = mergeClasses(cardPreviewClassNames.logo, styles.logo, state.logo.className);\n }\n\n return state;\n};\n"],"mappings":"AACA,SAAAA,QAAA,EAAqBC,YAAY,QAAQ;AAGzC;;;AAGA,OAAO,MAAMC,qBAAA,GAA0D;EACrEC,IAAA,EAAM;EACNC,IAAA,EAAM;AACR;AAEA,MAAMC,SAAA,gBAAYL,QAAA;EAAAG,IAAA;IAAAG,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;EAAA;EAAAL,IAAA;IAAAE,MAAA;IAAAI,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;EAAA;AAAA;EAAAC,CAAA;AAAA,CAkBlB;AAEA;;;AAGA,OAAO,MAAMC,6BAAA,GAAiCC,KAAA,IAA8C;EAC1F,MAAMC,MAAA,GAASZ,SAAA;EACfW,KAAA,CAAMb,IAAI,CAACe,SAAS,GAAGjB,YAAA,CAAaC,qBAAA,CAAsBC,IAAI,EAAEc,MAAA,CAAOd,IAAI,EAAEa,KAAA,CAAMb,IAAI,CAACe,SAAS;EAEjG,IAAIF,KAAA,CAAMZ,IAAI,EAAE;IACdY,KAAA,CAAMZ,IAAI,CAACc,SAAS,GAAGjB,YAAA,CAAaC,qBAAA,CAAsBE,IAAI,EAAEa,MAAA,CAAOb,IAAI,EAAEY,KAAA,CAAMZ,IAAI,CAACc,SAAS;EACnG;EAEA,OAAOF,KAAA;AACT"}
|
package/lib/index.js
CHANGED
@@ -3,4 +3,5 @@ export { CardFooter, cardFooterClassNames, renderCardFooter_unstable, useCardFoo
|
|
3
3
|
export { CardHeader, cardHeaderClassNames, cardHeaderCSSVars, renderCardHeader_unstable, useCardHeaderStyles_unstable, useCardHeader_unstable } from './CardHeader';
|
4
4
|
export { CardPreview, cardPreviewClassNames, renderCardPreview_unstable, useCardPreviewStyles_unstable, useCardPreview_unstable } from './CardPreview';
|
5
5
|
export { CardProvider, useCardContext_unstable } from './Card';
|
6
|
+
|
6
7
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n Card,\n cardClassNames,\n cardCSSVars,\n renderCard_unstable,\n useCardStyles_unstable,\n useCard_unstable,\n} from './Card';\nexport type { CardProps, CardSlots, CardState, CardOnSelectionChangeEvent } from './Card';\nexport {\n CardFooter,\n cardFooterClassNames,\n renderCardFooter_unstable,\n useCardFooterStyles_unstable,\n useCardFooter_unstable,\n} from './CardFooter';\nexport type { CardFooterProps, CardFooterSlots, CardFooterState } from './CardFooter';\nexport {\n CardHeader,\n cardHeaderClassNames,\n cardHeaderCSSVars,\n renderCardHeader_unstable,\n useCardHeaderStyles_unstable,\n useCardHeader_unstable,\n} from './CardHeader';\nexport type { CardHeaderProps, CardHeaderSlots, CardHeaderState } from './CardHeader';\nexport {\n CardPreview,\n cardPreviewClassNames,\n renderCardPreview_unstable,\n useCardPreviewStyles_unstable,\n useCardPreview_unstable,\n} from './CardPreview';\nexport type { CardPreviewProps, CardPreviewSlots, CardPreviewState } from './CardPreview';\nexport { CardProvider, useCardContext_unstable } from './Card';\nexport type { CardContextValue } from './Card';\n"],"names":["Card","cardClassNames","cardCSSVars","renderCard_unstable","useCardStyles_unstable","useCard_unstable","CardFooter","cardFooterClassNames","renderCardFooter_unstable","useCardFooterStyles_unstable","useCardFooter_unstable","CardHeader","cardHeaderClassNames","cardHeaderCSSVars","renderCardHeader_unstable","useCardHeaderStyles_unstable","useCardHeader_unstable","CardPreview","cardPreviewClassNames","renderCardPreview_unstable","useCardPreviewStyles_unstable","useCardPreview_unstable","CardProvider","useCardContext_unstable"],"mappings":"AAAA,SACEA,IAAI,EACJC,cAAc,EACdC,WAAW,EACXC,mBAAmB,EACnBC,sBAAsB,EACtBC,gBAAgB,QACX,SAAS;AAEhB,SACEC,UAAU,EACVC,oBAAoB,EACpBC,yBAAyB,EACzBC,4BAA4B,EAC5BC,sBAAsB,QACjB,eAAe;AAEtB,SACEC,UAAU,EACVC,oBAAoB,EACpBC,iBAAiB,EACjBC,yBAAyB,EACzBC,4BAA4B,EAC5BC,sBAAsB,QACjB,eAAe;AAEtB,SACEC,WAAW,EACXC,qBAAqB,EACrBC,0BAA0B,EAC1BC,6BAA6B,EAC7BC,uBAAuB,QAClB,gBAAgB;AAEvB,SAASC,YAAY,EAAEC,uBAAuB,QAAQ,SAAS"}
|
package/lib-commonjs/Card.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../lib/Card.js"],"sourcesContent":["export * from './components/Card/index';\n//# sourceMappingURL=Card.js.map"],"names":[],"mappings":";;;;;oBAAc;
|
1
|
+
{"version":3,"sources":["../lib/Card.js"],"sourcesContent":["export * from './components/Card/index';\n\n//# sourceMappingURL=Card.js.map"],"names":[],"mappings":";;;;;oBAAc;CAEd,gCAAgC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../lib/CardFooter.js"],"sourcesContent":["export * from './components/CardFooter/index';\n//# sourceMappingURL=CardFooter.js.map"],"names":[],"mappings":";;;;;oBAAc;
|
1
|
+
{"version":3,"sources":["../lib/CardFooter.js"],"sourcesContent":["export * from './components/CardFooter/index';\n\n//# sourceMappingURL=CardFooter.js.map"],"names":[],"mappings":";;;;;oBAAc;CAEd,sCAAsC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../lib/CardHeader.js"],"sourcesContent":["export * from './components/CardHeader/index';\n//# sourceMappingURL=CardHeader.js.map"],"names":[],"mappings":";;;;;oBAAc;
|
1
|
+
{"version":3,"sources":["../lib/CardHeader.js"],"sourcesContent":["export * from './components/CardHeader/index';\n\n//# sourceMappingURL=CardHeader.js.map"],"names":[],"mappings":";;;;;oBAAc;CAEd,sCAAsC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../lib/CardPreview.js"],"sourcesContent":["export * from './components/CardPreview/index';\n//# sourceMappingURL=CardPreview.js.map"],"names":[],"mappings":";;;;;oBAAc;
|
1
|
+
{"version":3,"sources":["../lib/CardPreview.js"],"sourcesContent":["export * from './components/CardPreview/index';\n\n//# sourceMappingURL=CardPreview.js.map"],"names":[],"mappings":";;;;;oBAAc;CAEd,uCAAuC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../lib/components/Card/Card.js"],"sourcesContent":["import * as React from 'react';\nimport { useCard_unstable } from './useCard';\nimport { renderCard_unstable } from './renderCard';\nimport { useCardStyles_unstable } from './useCardStyles.styles';\nimport { useCardContextValue } from './useCardContextValue';\n/**\n * A card provides scaffolding for hosting actions and content for a single topic.\n
|
1
|
+
{"version":3,"sources":["../../../lib/components/Card/Card.js"],"sourcesContent":["import * as React from 'react';\nimport { useCard_unstable } from './useCard';\nimport { renderCard_unstable } from './renderCard';\nimport { useCardStyles_unstable } from './useCardStyles.styles';\nimport { useCardContextValue } from './useCardContextValue';\n/**\n * A card provides scaffolding for hosting actions and content for a single topic.\n */ export const Card = /*#__PURE__*/ React.forwardRef((props, ref)=>{\n const state = useCard_unstable(props, ref);\n const cardContextValue = useCardContextValue(state);\n useCardStyles_unstable(state);\n return renderCard_unstable(state, cardContextValue);\n});\nCard.displayName = 'Card';\n\n//# sourceMappingURL=Card.js.map"],"names":["Card","React","forwardRef","props","ref","state","useCard_unstable","cardContextValue","useCardContextValue","useCardStyles_unstable","renderCard_unstable","displayName"],"mappings":";;;;+BAOiBA;;aAAAA;;;6DAPM;yBACU;4BACG;qCACG;qCACH;AAGzB,MAAMA,OAAO,WAAW,GAAGC,OAAMC,UAAU,CAAC,CAACC,OAAOC,MAAM;IACjE,MAAMC,QAAQC,IAAAA,yBAAgB,EAACH,OAAOC;IACtC,MAAMG,mBAAmBC,IAAAA,wCAAmB,EAACH;IAC7CI,IAAAA,2CAAsB,EAACJ;IACvB,OAAOK,IAAAA,+BAAmB,EAACL,OAAOE;AACtC;AACAP,KAAKW,WAAW,GAAG,QAEnB,gCAAgC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../lib/components/Card/Card.types.js"],"sourcesContent":["import * as React from 'react';\n//# sourceMappingURL=Card.types.js.map"],"names":[],"mappings":";;;;;6DAAuB;
|
1
|
+
{"version":3,"sources":["../../../lib/components/Card/Card.types.js"],"sourcesContent":["import * as React from 'react';\n\n//# sourceMappingURL=Card.types.js.map"],"names":[],"mappings":";;;;;6DAAuB;CAEvB,sCAAsC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../lib/components/Card/CardContext.js"],"sourcesContent":["import * as React from 'react';\nconst cardContext =
|
1
|
+
{"version":3,"sources":["../../../lib/components/Card/CardContext.js"],"sourcesContent":["import * as React from 'react';\nconst cardContext = React.createContext(undefined);\n/**\n * @internal\n */ export const cardContextDefaultValue = {\n selectableA11yProps: {\n referenceId: undefined,\n setReferenceId () {\n /* Noop */ },\n referenceLabel: undefined,\n setReferenceLabel () {\n /* Noop */ }\n }\n};\n/**\n * @internal\n */ export const CardProvider = cardContext.Provider;\nvar _React_useContext;\n/**\n * @internal\n */ export const useCardContext_unstable = ()=>(_React_useContext = React.useContext(cardContext)) !== null && _React_useContext !== void 0 ? _React_useContext : cardContextDefaultValue;\n\n//# sourceMappingURL=CardContext.js.map"],"names":["cardContextDefaultValue","CardProvider","useCardContext_unstable","cardContext","React","createContext","undefined","selectableA11yProps","referenceId","setReferenceId","referenceLabel","setReferenceLabel","Provider","_React_useContext","useContext"],"mappings":";;;;;;;;;;;IAIiBA,uBAAuB,MAAvBA;IAYAC,YAAY,MAAZA;IAIAC,uBAAuB,MAAvBA;;;6DApBM;AACvB,MAAMC,4BAAcC,OAAMC,aAAa,CAACC;AAG7B,MAAMN,0BAA0B;IACvCO,qBAAqB;QACjBC,aAAaF;QACbG,kBAAkB;QAClB,QAAQ,GAAG;QACXC,gBAAgBJ;QAChBK,qBAAqB;QACrB,QAAQ,GAAG;IACf;AACJ;AAGW,MAAMV,eAAeE,YAAYS,QAAQ;AACpD,IAAIC;AAGO,MAAMX,0BAA0B,IAAI,AAACW,CAAAA,oBAAoBT,OAAMU,UAAU,CAACX,YAAW,MAAO,IAAI,IAAIU,sBAAsB,KAAK,IAAIA,oBAAoBb,uBAAuB,EAEzL,uCAAuC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../lib/components/Card/index.js"],"sourcesContent":["export * from './Card';\nexport * from './Card.types';\nexport * from './CardContext';\nexport * from './renderCard';\nexport * from './useCard';\nexport * from './useCardStyles.styles';\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;oBAAc;oBACA;oBACA;oBACA;oBACA;oBACA;
|
1
|
+
{"version":3,"sources":["../../../lib/components/Card/index.js"],"sourcesContent":["export * from './Card';\nexport * from './Card.types';\nexport * from './CardContext';\nexport * from './renderCard';\nexport * from './useCard';\nexport * from './useCardStyles.styles';\n\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;oBAAc;oBACA;oBACA;oBACA;oBACA;oBACA;CAEd,iCAAiC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../lib/components/Card/renderCard.js"],"sourcesContent":["/** @jsxRuntime classic */ /** @jsx createElement */import { createElement } from '@fluentui/react-jsx-runtime';\nimport { getSlotsNext } from '@fluentui/react-utilities';\nimport { CardProvider } from './CardContext';\n/**\n * Render the final JSX of Card.\n
|
1
|
+
{"version":3,"sources":["../../../lib/components/Card/renderCard.js"],"sourcesContent":["/** @jsxRuntime classic */ /** @jsx createElement */ import { createElement } from '@fluentui/react-jsx-runtime';\nimport { getSlotsNext } from '@fluentui/react-utilities';\nimport { CardProvider } from './CardContext';\n/**\n * Render the final JSX of Card.\n */ export const renderCard_unstable = (state, cardContextValue)=>{\n const { slots , slotProps } = getSlotsNext(state);\n return /*#__PURE__*/ createElement(slots.root, slotProps.root, /*#__PURE__*/ createElement(CardProvider, {\n value: cardContextValue\n }, slots.checkbox ? /*#__PURE__*/ createElement(slots.checkbox, slotProps.checkbox) : null, slots.floatingAction ? /*#__PURE__*/ createElement(slots.floatingAction, slotProps.floatingAction) : null, slotProps.root.children));\n};\n\n//# sourceMappingURL=renderCard.js.map"],"names":["renderCard_unstable","state","cardContextValue","slots","slotProps","getSlotsNext","createElement","root","CardProvider","value","checkbox","floatingAction","children"],"mappings":"AAAA,wBAAwB,GAAG,uBAAuB;;;;+BAKjCA;;aAAAA;;iCALkE;gCACtD;6BACA;AAGlB,MAAMA,sBAAsB,CAACC,OAAOC,mBAAmB;IAC9D,MAAM,EAAEC,MAAK,EAAGC,UAAS,EAAG,GAAGC,IAAAA,4BAAY,EAACJ;IAC5C,OAAO,WAAW,GAAGK,IAAAA,8BAAa,EAACH,MAAMI,IAAI,EAAEH,UAAUG,IAAI,EAAE,WAAW,GAAGD,IAAAA,8BAAa,EAACE,yBAAY,EAAE;QACrGC,OAAOP;IACX,GAAGC,MAAMO,QAAQ,GAAG,WAAW,GAAGJ,IAAAA,8BAAa,EAACH,MAAMO,QAAQ,EAAEN,UAAUM,QAAQ,IAAI,IAAI,EAAEP,MAAMQ,cAAc,GAAG,WAAW,GAAGL,IAAAA,8BAAa,EAACH,MAAMQ,cAAc,EAAEP,UAAUO,cAAc,IAAI,IAAI,EAAEP,UAAUG,IAAI,CAACK,QAAQ;AAClO,GAEA,sCAAsC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../lib/components/Card/useCard.js"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, useMergedRefs } from '@fluentui/react-utilities';\nimport { useFocusableGroup, useFocusWithin } from '@fluentui/react-tabster';\nimport { useCardSelectable } from './useCardSelectable';\nimport { cardContextDefaultValue } from './CardContext';\nconst focusMap = {\n
|
1
|
+
{"version":3,"sources":["../../../lib/components/Card/useCard.js"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, useMergedRefs } from '@fluentui/react-utilities';\nimport { useFocusableGroup, useFocusWithin } from '@fluentui/react-tabster';\nimport { useCardSelectable } from './useCardSelectable';\nimport { cardContextDefaultValue } from './CardContext';\nconst focusMap = {\n off: undefined,\n 'no-tab': 'limited-trap-focus',\n 'tab-exit': 'limited',\n 'tab-only': 'unlimited'\n};\n/**\n * Create the state for interactive cards.\n *\n * This internal hook defines if the card is interactive\n * and control focus properties based on that.\n *\n * @param props - props from this instance of Card\n */ const useCardInteractive = ({ focusMode ='off' , ...props })=>{\n const interactive = [\n 'onClick',\n 'onDoubleClick',\n 'onMouseUp',\n 'onMouseDown',\n 'onPointerUp',\n 'onPointerDown',\n 'onTouchStart',\n 'onTouchEnd',\n 'onDragStart',\n 'onDragEnd'\n ].some((prop)=>props[prop]);\n const groupperAttrs = useFocusableGroup({\n tabBehavior: focusMap[interactive ? 'no-tab' : focusMode]\n });\n const interactiveFocusAttributes = {\n ...groupperAttrs,\n tabIndex: 0\n };\n return {\n interactive,\n focusAttributes: focusMode === 'off' ? null : interactiveFocusAttributes\n };\n};\n/**\n * Create the state required to render Card.\n *\n * The returned state can be modified with hooks such as useCardStyles_unstable,\n * before being passed to renderCard_unstable.\n *\n * @param props - props from this instance of Card\n * @param ref - reference to the root element of Card\n */ export const useCard_unstable = (props, ref)=>{\n const { appearance ='filled' , orientation ='vertical' , size ='medium' } = props;\n const [referenceId, setReferenceId] = React.useState(cardContextDefaultValue.selectableA11yProps.referenceId);\n const [referenceLabel, setReferenceLabel] = React.useState(cardContextDefaultValue.selectableA11yProps.referenceId);\n const cardBaseRef = useFocusWithin();\n const { selectable , selected , selectableCardProps , selectFocused , checkboxSlot , floatingActionSlot } = useCardSelectable(props, {\n referenceId,\n referenceLabel\n }, cardBaseRef);\n const cardRef = useMergedRefs(cardBaseRef, ref);\n const { interactive , focusAttributes } = useCardInteractive(props);\n return {\n appearance,\n orientation,\n size,\n interactive,\n selectable,\n selectFocused,\n selected,\n selectableA11yProps: {\n setReferenceId,\n referenceId,\n referenceLabel,\n setReferenceLabel\n },\n components: {\n root: 'div',\n floatingAction: 'div',\n checkbox: 'input'\n },\n root: getNativeElementProps('div', {\n ref: cardRef,\n role: 'group',\n ...focusAttributes,\n ...props,\n ...selectableCardProps\n }),\n floatingAction: floatingActionSlot,\n checkbox: checkboxSlot\n };\n};\n\n//# sourceMappingURL=useCard.js.map"],"names":["useCard_unstable","focusMap","off","undefined","useCardInteractive","focusMode","props","interactive","some","prop","groupperAttrs","useFocusableGroup","tabBehavior","interactiveFocusAttributes","tabIndex","focusAttributes","ref","appearance","orientation","size","referenceId","setReferenceId","React","useState","cardContextDefaultValue","selectableA11yProps","referenceLabel","setReferenceLabel","cardBaseRef","useFocusWithin","selectable","selected","selectableCardProps","selectFocused","checkboxSlot","floatingActionSlot","useCardSelectable","cardRef","useMergedRefs","components","root","floatingAction","checkbox","getNativeElementProps","role"],"mappings":";;;;+BAmDiBA;;aAAAA;;;6DAnDM;gCAC8B;8BACH;mCAChB;6BACM;AACxC,MAAMC,WAAW;IACbC,KAAKC;IACL,UAAU;IACV,YAAY;IACZ,YAAY;AAChB;AACA;;;;;;;CAOC,GAAG,MAAMC,qBAAqB,CAAC,EAAEC,WAAW,MAAK,EAAG,GAAGC,OAAO,GAAG;IAC9D,MAAMC,cAAc;QAChB;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;KACH,CAACC,IAAI,CAAC,CAACC,OAAOH,KAAK,CAACG,KAAK;IAC1B,MAAMC,gBAAgBC,IAAAA,+BAAiB,EAAC;QACpCC,aAAaX,QAAQ,CAACM,cAAc,WAAWF,SAAS,CAAC;IAC7D;IACA,MAAMQ,6BAA6B;QAC/B,GAAGH,aAAa;QAChBI,UAAU;IACd;IACA,OAAO;QACHP;QACAQ,iBAAiBV,cAAc,QAAQ,IAAI,GAAGQ,0BAA0B;IAC5E;AACJ;AASW,MAAMb,mBAAmB,CAACM,OAAOU,MAAM;IAC9C,MAAM,EAAEC,YAAY,SAAQ,EAAGC,aAAa,WAAU,EAAGC,MAAM,SAAQ,EAAG,GAAGb;IAC7E,MAAM,CAACc,aAAaC,eAAe,GAAGC,OAAMC,QAAQ,CAACC,oCAAuB,CAACC,mBAAmB,CAACL,WAAW;IAC5G,MAAM,CAACM,gBAAgBC,kBAAkB,GAAGL,OAAMC,QAAQ,CAACC,oCAAuB,CAACC,mBAAmB,CAACL,WAAW;IAClH,MAAMQ,cAAcC,IAAAA,4BAAc;IAClC,MAAM,EAAEC,WAAU,EAAGC,SAAQ,EAAGC,oBAAmB,EAAGC,cAAa,EAAGC,aAAY,EAAGC,mBAAkB,EAAG,GAAGC,IAAAA,oCAAiB,EAAC9B,OAAO;QAClIc;QACAM;IACJ,GAAGE;IACH,MAAMS,UAAUC,IAAAA,6BAAa,EAACV,aAAaZ;IAC3C,MAAM,EAAET,YAAW,EAAGQ,gBAAe,EAAG,GAAGX,mBAAmBE;IAC9D,OAAO;QACHW;QACAC;QACAC;QACAZ;QACAuB;QACAG;QACAF;QACAN,qBAAqB;YACjBJ;YACAD;YACAM;YACAC;QACJ;QACAY,YAAY;YACRC,MAAM;YACNC,gBAAgB;YAChBC,UAAU;QACd;QACAF,MAAMG,IAAAA,qCAAqB,EAAC,OAAO;YAC/B3B,KAAKqB;YACLO,MAAM;YACN,GAAG7B,eAAe;YAClB,GAAGT,KAAK;YACR,GAAG0B,mBAAmB;QAC1B;QACAS,gBAAgBN;QAChBO,UAAUR;IACd;AACJ,GAEA,mCAAmC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../lib/components/Card/useCardContextValue.js"],"sourcesContent":["export function useCardContextValue({
|
1
|
+
{"version":3,"sources":["../../../lib/components/Card/useCardContextValue.js"],"sourcesContent":["export function useCardContextValue({ selectableA11yProps }) {\n return {\n selectableA11yProps\n };\n}\n\n//# sourceMappingURL=useCardContextValue.js.map"],"names":["useCardContextValue","selectableA11yProps"],"mappings":";;;;+BAAgBA;;aAAAA;;AAAT,SAASA,oBAAoB,EAAEC,oBAAmB,EAAG,EAAE;IAC1D,OAAO;QACHA;IACJ;AACJ,EAEA,+CAA+C"}
|