@fluentui/react-card 9.5.11 → 9.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -2
- package/dist/index.d.ts +76 -4
- 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.types.js.map +1 -1
- package/lib/components/Card/index.js +1 -1
- package/lib/components/Card/index.js.map +1 -1
- package/lib/components/Card/renderCard.js.map +1 -1
- package/lib/components/Card/useCard.js +17 -4
- package/lib/components/Card/useCard.js.map +1 -1
- package/lib/components/Card/useCardSelectable.js +1 -2
- package/lib/components/Card/useCardSelectable.js.map +1 -1
- package/lib/components/CardFooter/CardFooter.types.js +1 -1
- package/lib/components/CardFooter/CardFooter.types.js.map +1 -1
- package/lib/components/CardFooter/index.js +1 -1
- package/lib/components/CardFooter/index.js.map +1 -1
- package/lib/components/CardFooter/renderCardFooter.js.map +1 -1
- package/lib/components/CardFooter/useCardFooter.js +10 -0
- package/lib/components/CardFooter/useCardFooter.js.map +1 -1
- package/lib/components/CardHeader/CardHeader.types.js +1 -1
- package/lib/components/CardHeader/CardHeader.types.js.map +1 -1
- package/lib/components/CardHeader/index.js +1 -1
- package/lib/components/CardHeader/index.js.map +1 -1
- package/lib/components/CardHeader/renderCardHeader.js.map +1 -1
- package/lib/components/CardHeader/useCardHeader.js +10 -0
- package/lib/components/CardHeader/useCardHeader.js.map +1 -1
- package/lib/components/CardPreview/CardPreview.types.js +1 -1
- package/lib/components/CardPreview/CardPreview.types.js.map +1 -1
- package/lib/components/CardPreview/index.js +1 -1
- package/lib/components/CardPreview/index.js.map +1 -1
- package/lib/components/CardPreview/renderCardPreview.js.map +1 -1
- package/lib/components/CardPreview/useCardPreview.js +10 -0
- package/lib/components/CardPreview/useCardPreview.js.map +1 -1
- package/lib/index.js +4 -4
- package/lib/index.js.map +1 -1
- package/lib-commonjs/Card.js +3 -0
- package/lib-commonjs/Card.js.map +1 -1
- package/lib-commonjs/CardFooter.js +3 -0
- package/lib-commonjs/CardFooter.js.map +1 -1
- package/lib-commonjs/CardHeader.js +3 -0
- package/lib-commonjs/CardHeader.js.map +1 -1
- package/lib-commonjs/CardPreview.js +3 -0
- package/lib-commonjs/CardPreview.js.map +1 -1
- package/lib-commonjs/components/Card/Card.types.js.map +1 -1
- package/lib-commonjs/components/Card/index.js +3 -0
- 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 +22 -7
- package/lib-commonjs/components/Card/useCard.js.map +1 -1
- package/lib-commonjs/components/Card/useCardSelectable.js.map +1 -1
- package/lib-commonjs/components/CardFooter/CardFooter.types.js +1 -1
- package/lib-commonjs/components/CardFooter/CardFooter.types.js.map +1 -1
- package/lib-commonjs/components/CardFooter/index.js +3 -0
- 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 +15 -3
- package/lib-commonjs/components/CardFooter/useCardFooter.js.map +1 -1
- package/lib-commonjs/components/CardHeader/CardHeader.types.js +1 -1
- package/lib-commonjs/components/CardHeader/CardHeader.types.js.map +1 -1
- package/lib-commonjs/components/CardHeader/index.js +3 -0
- 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 +14 -3
- package/lib-commonjs/components/CardHeader/useCardHeader.js.map +1 -1
- package/lib-commonjs/components/CardPreview/CardPreview.types.js +1 -1
- package/lib-commonjs/components/CardPreview/CardPreview.types.js.map +1 -1
- package/lib-commonjs/components/CardPreview/index.js +3 -0
- 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 +14 -3
- package/lib-commonjs/components/CardPreview/useCardPreview.js.map +1 -1
- package/lib-commonjs/index.js +12 -0
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
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":"
|
|
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 * CardPreview base props (same as CardPreviewProps since CardPreview has no design props)\n */\nexport type CardPreviewBaseProps = CardPreviewProps;\n\n/**\n * State used in rendering CardPreview.\n */\nexport type CardPreviewState = ComponentState<CardPreviewSlots>;\n\n/**\n * CardPreview base state (same as CardPreviewState since CardPreview has no design props)\n */\nexport type CardPreviewBaseState = CardPreviewState;\n"],"names":[],"mappings":"AAgCA;;CAEC,GACD,WAAoD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { CardPreview } from './CardPreview';
|
|
2
2
|
export { renderCardPreview_unstable } from './renderCardPreview';
|
|
3
|
-
export { useCardPreview_unstable } from './useCardPreview';
|
|
3
|
+
export { useCardPreview_unstable, useCardPreviewBase_unstable } from './useCardPreview';
|
|
4
4
|
export { cardPreviewClassNames, useCardPreviewStyles_unstable } from './useCardPreviewStyles.styles';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/CardPreview/index.ts"],"sourcesContent":["export { CardPreview } from './CardPreview';\nexport type {
|
|
1
|
+
{"version":3,"sources":["../src/components/CardPreview/index.ts"],"sourcesContent":["export { CardPreview } from './CardPreview';\nexport type {\n CardPreviewBaseProps,\n CardPreviewBaseState,\n CardPreviewProps,\n CardPreviewSlots,\n CardPreviewState,\n} from './CardPreview.types';\nexport { renderCardPreview_unstable } from './renderCardPreview';\nexport { useCardPreview_unstable, useCardPreviewBase_unstable } from './useCardPreview';\nexport { cardPreviewClassNames, useCardPreviewStyles_unstable } from './useCardPreviewStyles.styles';\n"],"names":["CardPreview","renderCardPreview_unstable","useCardPreview_unstable","useCardPreviewBase_unstable","cardPreviewClassNames","useCardPreviewStyles_unstable"],"mappings":"AAAA,SAASA,WAAW,QAAQ,gBAAgB;AAQ5C,SAASC,0BAA0B,QAAQ,sBAAsB;AACjE,SAASC,uBAAuB,EAAEC,2BAA2B,QAAQ,mBAAmB;AACxF,SAASC,qBAAqB,EAAEC,6BAA6B,QAAQ,gCAAgC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/CardPreview/renderCardPreview.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type { CardPreviewSlots,
|
|
1
|
+
{"version":3,"sources":["../src/components/CardPreview/renderCardPreview.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type { CardPreviewSlots, CardPreviewBaseState } from './CardPreview.types';\n\n/**\n * Render the final JSX of CardPreview.\n */\nexport const renderCardPreview_unstable = (state: CardPreviewBaseState): JSXElement => {\n assertSlots<CardPreviewSlots>(state);\n\n return (\n <state.root>\n {state.root.children}\n {state.logo && <state.logo />}\n </state.root>\n );\n};\n"],"names":["assertSlots","renderCardPreview_unstable","state","root","children","logo"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,4BAA4B;AAIxD;;CAEC,GACD,OAAO,MAAMC,6BAA6B,CAACC;IACzCF,YAA8BE;IAE9B,qBACE,MAACA,MAAMC,IAAI;;YACRD,MAAMC,IAAI,CAACC,QAAQ;YACnBF,MAAMG,IAAI,kBAAI,KAACH,MAAMG,IAAI;;;AAGhC,EAAE"}
|
|
@@ -12,6 +12,16 @@ import { cardPreviewClassNames } from './useCardPreviewStyles.styles';
|
|
|
12
12
|
* @param props - props from this instance of CardPreview
|
|
13
13
|
* @param ref - reference to root HTMLElement of CardPreview
|
|
14
14
|
*/ export const useCardPreview_unstable = (props, ref)=>{
|
|
15
|
+
return useCardPreviewBase_unstable(props, ref);
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Base hook for CardPreview component, which manages state related to slots structure
|
|
19
|
+
* and the card's selectable accessibility label.
|
|
20
|
+
* Note: CardPreview has no design props, so this is equivalent to useCardPreview_unstable.
|
|
21
|
+
*
|
|
22
|
+
* @param props - props from this instance of CardPreview
|
|
23
|
+
* @param ref - reference to root HTMLElement of CardPreview
|
|
24
|
+
*/ export const useCardPreviewBase_unstable = (props, ref)=>{
|
|
15
25
|
const { logo } = props;
|
|
16
26
|
const { selectableA11yProps: { referenceLabel, referenceId, setReferenceLabel, setReferenceId } } = useCardContext_unstable();
|
|
17
27
|
// FIXME:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/CardPreview/useCardPreview.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { getIntrinsicElementProps, useMergedRefs, slot } from '@fluentui/react-utilities';\nimport type {
|
|
1
|
+
{"version":3,"sources":["../src/components/CardPreview/useCardPreview.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { getIntrinsicElementProps, useMergedRefs, slot } from '@fluentui/react-utilities';\nimport type {\n CardPreviewBaseProps,\n CardPreviewBaseState,\n CardPreviewProps,\n CardPreviewState,\n} 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 return useCardPreviewBase_unstable(props, ref);\n};\n\n/**\n * Base hook for CardPreview component, which manages state related to slots structure\n * and the card's selectable accessibility label.\n * Note: CardPreview has no design props, so this is equivalent to useCardPreview_unstable.\n *\n * @param props - props from this instance of CardPreview\n * @param ref - reference to root HTMLElement of CardPreview\n */\nexport const useCardPreviewBase_unstable = (\n props: CardPreviewBaseProps,\n ref: React.Ref<HTMLElement>,\n): CardPreviewBaseState => {\n const { logo } = props;\n\n const {\n selectableA11yProps: { referenceLabel, referenceId, setReferenceLabel, setReferenceId },\n } = useCardContext_unstable();\n // FIXME:\n // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n const previewRef = useMergedRefs(ref as React.Ref<HTMLDivElement>, 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: slot.always(\n getIntrinsicElementProps('div', {\n ref: previewRef,\n ...props,\n }),\n { elementType: 'div' },\n ),\n logo: slot.optional(logo, { elementType: 'div' }),\n };\n};\n"],"names":["React","getIntrinsicElementProps","useMergedRefs","slot","useCardContext_unstable","cardPreviewClassNames","useCardPreview_unstable","props","ref","useCardPreviewBase_unstable","logo","selectableA11yProps","referenceLabel","referenceId","setReferenceLabel","setReferenceId","previewRef","useRef","useEffect","current","parentNode","img","querySelector","root","ariaLabel","getAttribute","ariaDescribedby","alt","components","always","elementType","optional"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,wBAAwB,EAAEC,aAAa,EAAEC,IAAI,QAAQ,4BAA4B;AAO1F,SAASC,uBAAuB,QAAQ,sBAAsB;AAC9D,SAASC,qBAAqB,QAAQ,gCAAgC;AAEtE;;;;;;;;CAQC,GACD,OAAO,MAAMC,0BAA0B,CAACC,OAAyBC;IAC/D,OAAOC,4BAA4BF,OAAOC;AAC5C,EAAE;AAEF;;;;;;;CAOC,GACD,OAAO,MAAMC,8BAA8B,CACzCF,OACAC;IAEA,MAAM,EAAEE,IAAI,EAAE,GAAGH;IAEjB,MAAM,EACJI,qBAAqB,EAAEC,cAAc,EAAEC,WAAW,EAAEC,iBAAiB,EAAEC,cAAc,EAAE,EACxF,GAAGX;IACJ,SAAS;IACT,4EAA4E;IAC5E,4FAA4F;IAC5F,MAAMY,aAAad,cAAcM,KAAkCR,MAAMiB,MAAM,CAAiB;IAEhGjB,MAAMkB,SAAS,CAAC;QACd,IAAIN,kBAAkBC,aAAa;YACjC;QACF;QAEA,IAAIG,WAAWG,OAAO,IAAIH,WAAWG,OAAO,CAACC,UAAU,EAAE;YACvD,MAAMC,MAAML,WAAWG,OAAO,CAACC,UAAU,CAACE,aAAa,CAAmB,CAAC,CAAC,EAAEjB,sBAAsBkB,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;YACF;QACF;IACF,GAAG;QAACV;QAAmBF;QAAgBI;QAAYH;QAAaE;KAAe;IAE/E,OAAO;QACLa,YAAY;YACVL,MAAM;YACNb,MAAM;QACR;QAEAa,MAAMpB,KAAK0B,MAAM,CACf5B,yBAAyB,OAAO;YAC9BO,KAAKQ;YACL,GAAGT,KAAK;QACV,IACA;YAAEuB,aAAa;QAAM;QAEvBpB,MAAMP,KAAK4B,QAAQ,CAACrB,MAAM;YAAEoB,aAAa;QAAM;IACjD;AACF,EAAE"}
|
package/lib/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { Card, cardClassNames, cardCSSVars, renderCard_unstable, useCardStyles_unstable, useCard_unstable } from './Card';
|
|
2
|
-
export { CardFooter, cardFooterClassNames, renderCardFooter_unstable, useCardFooterStyles_unstable, useCardFooter_unstable } from './CardFooter';
|
|
3
|
-
export { CardHeader, cardHeaderClassNames, cardHeaderCSSVars, renderCardHeader_unstable, useCardHeaderStyles_unstable, useCardHeader_unstable } from './CardHeader';
|
|
4
|
-
export { CardPreview, cardPreviewClassNames, renderCardPreview_unstable, useCardPreviewStyles_unstable, useCardPreview_unstable } from './CardPreview';
|
|
1
|
+
export { Card, cardClassNames, cardCSSVars, renderCard_unstable, useCardStyles_unstable, useCard_unstable, useCardBase_unstable } from './Card';
|
|
2
|
+
export { CardFooter, cardFooterClassNames, renderCardFooter_unstable, useCardFooterStyles_unstable, useCardFooter_unstable, useCardFooterBase_unstable } from './CardFooter';
|
|
3
|
+
export { CardHeader, cardHeaderClassNames, cardHeaderCSSVars, renderCardHeader_unstable, useCardHeaderStyles_unstable, useCardHeader_unstable, useCardHeaderBase_unstable } from './CardHeader';
|
|
4
|
+
export { CardPreview, cardPreviewClassNames, renderCardPreview_unstable, useCardPreviewStyles_unstable, useCardPreview_unstable, useCardPreviewBase_unstable } from './CardPreview';
|
|
5
5
|
export { CardProvider, useCardContext_unstable } from './Card';
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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 {
|
|
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 useCardBase_unstable,\n} from './Card';\nexport type { CardProps, CardSlots, CardState, CardBaseProps, CardBaseState, CardOnSelectionChangeEvent } from './Card';\nexport {\n CardFooter,\n cardFooterClassNames,\n renderCardFooter_unstable,\n useCardFooterStyles_unstable,\n useCardFooter_unstable,\n useCardFooterBase_unstable,\n} from './CardFooter';\nexport type {\n CardFooterProps,\n CardFooterSlots,\n CardFooterState,\n CardFooterBaseProps,\n CardFooterBaseState,\n} from './CardFooter';\nexport {\n CardHeader,\n cardHeaderClassNames,\n cardHeaderCSSVars,\n renderCardHeader_unstable,\n useCardHeaderStyles_unstable,\n useCardHeader_unstable,\n useCardHeaderBase_unstable,\n} from './CardHeader';\nexport type {\n CardHeaderProps,\n CardHeaderSlots,\n CardHeaderState,\n CardHeaderBaseProps,\n CardHeaderBaseState,\n} from './CardHeader';\nexport {\n CardPreview,\n cardPreviewClassNames,\n renderCardPreview_unstable,\n useCardPreviewStyles_unstable,\n useCardPreview_unstable,\n useCardPreviewBase_unstable,\n} from './CardPreview';\nexport type {\n CardPreviewProps,\n CardPreviewSlots,\n CardPreviewState,\n CardPreviewBaseProps,\n CardPreviewBaseState,\n} from './CardPreview';\nexport { CardProvider, useCardContext_unstable } from './Card';\nexport type { CardContextValue } from './Card';\n"],"names":["Card","cardClassNames","cardCSSVars","renderCard_unstable","useCardStyles_unstable","useCard_unstable","useCardBase_unstable","CardFooter","cardFooterClassNames","renderCardFooter_unstable","useCardFooterStyles_unstable","useCardFooter_unstable","useCardFooterBase_unstable","CardHeader","cardHeaderClassNames","cardHeaderCSSVars","renderCardHeader_unstable","useCardHeaderStyles_unstable","useCardHeader_unstable","useCardHeaderBase_unstable","CardPreview","cardPreviewClassNames","renderCardPreview_unstable","useCardPreviewStyles_unstable","useCardPreview_unstable","useCardPreviewBase_unstable","CardProvider","useCardContext_unstable"],"mappings":"AAAA,SACEA,IAAI,EACJC,cAAc,EACdC,WAAW,EACXC,mBAAmB,EACnBC,sBAAsB,EACtBC,gBAAgB,EAChBC,oBAAoB,QACf,SAAS;AAEhB,SACEC,UAAU,EACVC,oBAAoB,EACpBC,yBAAyB,EACzBC,4BAA4B,EAC5BC,sBAAsB,EACtBC,0BAA0B,QACrB,eAAe;AAQtB,SACEC,UAAU,EACVC,oBAAoB,EACpBC,iBAAiB,EACjBC,yBAAyB,EACzBC,4BAA4B,EAC5BC,sBAAsB,EACtBC,0BAA0B,QACrB,eAAe;AAQtB,SACEC,WAAW,EACXC,qBAAqB,EACrBC,0BAA0B,EAC1BC,6BAA6B,EAC7BC,uBAAuB,EACvBC,2BAA2B,QACtB,gBAAgB;AAQvB,SAASC,YAAY,EAAEC,uBAAuB,QAAQ,SAAS"}
|
package/lib-commonjs/Card.js
CHANGED
|
@@ -27,6 +27,9 @@ _export(exports, {
|
|
|
27
27
|
renderCard_unstable: function() {
|
|
28
28
|
return _index.renderCard_unstable;
|
|
29
29
|
},
|
|
30
|
+
useCardBase_unstable: function() {
|
|
31
|
+
return _index.useCardBase_unstable;
|
|
32
|
+
},
|
|
30
33
|
useCardContext_unstable: function() {
|
|
31
34
|
return _index.useCardContext_unstable;
|
|
32
35
|
},
|
package/lib-commonjs/Card.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/Card.ts"],"sourcesContent":["export type {\n CardContextValue,\n CardOnSelectData,\n CardOnSelectionChangeEvent,\n CardProps,\n CardSlots,\n CardState,\n} from './components/Card/index';\nexport {\n Card,\n CardProvider,\n cardCSSVars,\n cardClassNames,\n cardContextDefaultValue,\n renderCard_unstable,\n useCardContext_unstable,\n useCardStyles_unstable,\n useCard_unstable,\n} from './components/Card/index';\n"],"names":["Card","CardProvider","cardCSSVars","cardClassNames","cardContextDefaultValue","renderCard_unstable","useCardContext_unstable","useCardStyles_unstable","useCard_unstable"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["../src/Card.ts"],"sourcesContent":["export type {\n CardContextValue,\n CardOnSelectData,\n CardOnSelectionChangeEvent,\n CardProps,\n CardSlots,\n CardState,\n CardBaseProps,\n CardBaseState,\n} from './components/Card/index';\nexport {\n Card,\n CardProvider,\n cardCSSVars,\n cardClassNames,\n cardContextDefaultValue,\n renderCard_unstable,\n useCardContext_unstable,\n useCardStyles_unstable,\n useCard_unstable,\n useCardBase_unstable,\n} from './components/Card/index';\n"],"names":["Card","CardProvider","cardCSSVars","cardClassNames","cardContextDefaultValue","renderCard_unstable","useCardContext_unstable","useCardStyles_unstable","useCard_unstable","useCardBase_unstable"],"mappings":";;;;;;;;;;;IAWEA;0BAAI;;;eACJC,mBAAY;;;eACZC,kBAAW;;;eACXC,qBAAc;;;eACdC,8BAAuB;;;eACvBC,0BAAmB;;;eAInBI,2BAAoB;;;eAHpBH,8BAAuB;;;eACvBC,6BAAsB;;;eACtBC,uBAAgB;;;uBAEX,0BAA0B"}
|
|
@@ -18,6 +18,9 @@ _export(exports, {
|
|
|
18
18
|
renderCardFooter_unstable: function() {
|
|
19
19
|
return _index.renderCardFooter_unstable;
|
|
20
20
|
},
|
|
21
|
+
useCardFooterBase_unstable: function() {
|
|
22
|
+
return _index.useCardFooterBase_unstable;
|
|
23
|
+
},
|
|
21
24
|
useCardFooterStyles_unstable: function() {
|
|
22
25
|
return _index.useCardFooterStyles_unstable;
|
|
23
26
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/CardFooter.ts"],"sourcesContent":["export type {
|
|
1
|
+
{"version":3,"sources":["../src/CardFooter.ts"],"sourcesContent":["export type {\n CardFooterProps,\n CardFooterSlots,\n CardFooterState,\n CardFooterBaseProps,\n CardFooterBaseState,\n} from './components/CardFooter/index';\nexport {\n CardFooter,\n cardFooterClassNames,\n renderCardFooter_unstable,\n useCardFooterStyles_unstable,\n useCardFooter_unstable,\n useCardFooterBase_unstable,\n} from './components/CardFooter/index';\n"],"names":["CardFooter","cardFooterClassNames","renderCardFooter_unstable","useCardFooterStyles_unstable","useCardFooter_unstable","useCardFooterBase_unstable"],"mappings":";;;;;;;;;;;;eAQEA,iBAAU;;;eACVC,2BAAoB;;;eACpBC,gCAAyB;;;eAGzBG,iCAA0B;;;eAF1BF,mCAA4B;;;eAC5BC,6BAAsB;;;uBAEjB,gCAAgC"}
|
|
@@ -21,6 +21,9 @@ _export(exports, {
|
|
|
21
21
|
renderCardHeader_unstable: function() {
|
|
22
22
|
return _index.renderCardHeader_unstable;
|
|
23
23
|
},
|
|
24
|
+
useCardHeaderBase_unstable: function() {
|
|
25
|
+
return _index.useCardHeaderBase_unstable;
|
|
26
|
+
},
|
|
24
27
|
useCardHeaderStyles_unstable: function() {
|
|
25
28
|
return _index.useCardHeaderStyles_unstable;
|
|
26
29
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/CardHeader.ts"],"sourcesContent":["export type {
|
|
1
|
+
{"version":3,"sources":["../src/CardHeader.ts"],"sourcesContent":["export type {\n CardHeaderProps,\n CardHeaderSlots,\n CardHeaderState,\n CardHeaderBaseProps,\n CardHeaderBaseState,\n} from './components/CardHeader/index';\nexport {\n CardHeader,\n cardHeaderCSSVars,\n cardHeaderClassNames,\n renderCardHeader_unstable,\n useCardHeaderStyles_unstable,\n useCardHeader_unstable,\n useCardHeaderBase_unstable,\n} from './components/CardHeader/index';\n"],"names":["CardHeader","cardHeaderCSSVars","cardHeaderClassNames","renderCardHeader_unstable","useCardHeaderStyles_unstable","useCardHeader_unstable","useCardHeaderBase_unstable"],"mappings":";;;;;;;;;;;;eAQEA,iBAAU;;;eACVC,wBAAiB;;;eACjBC,2BAAoB;;;eACpBC,gCAAyB;;;eAGzBG,iCAA0B;;;eAF1BF,mCAA4B;;;eAC5BC,6BAAsB;;;uBAEjB,gCAAgC"}
|
|
@@ -18,6 +18,9 @@ _export(exports, {
|
|
|
18
18
|
renderCardPreview_unstable: function() {
|
|
19
19
|
return _index.renderCardPreview_unstable;
|
|
20
20
|
},
|
|
21
|
+
useCardPreviewBase_unstable: function() {
|
|
22
|
+
return _index.useCardPreviewBase_unstable;
|
|
23
|
+
},
|
|
21
24
|
useCardPreviewStyles_unstable: function() {
|
|
22
25
|
return _index.useCardPreviewStyles_unstable;
|
|
23
26
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/CardPreview.ts"],"sourcesContent":["export type {
|
|
1
|
+
{"version":3,"sources":["../src/CardPreview.ts"],"sourcesContent":["export type {\n CardPreviewProps,\n CardPreviewSlots,\n CardPreviewState,\n CardPreviewBaseProps,\n CardPreviewBaseState,\n} from './components/CardPreview/index';\nexport {\n CardPreview,\n cardPreviewClassNames,\n renderCardPreview_unstable,\n useCardPreviewStyles_unstable,\n useCardPreview_unstable,\n useCardPreviewBase_unstable,\n} from './components/CardPreview/index';\n"],"names":["CardPreview","cardPreviewClassNames","renderCardPreview_unstable","useCardPreviewStyles_unstable","useCardPreview_unstable","useCardPreviewBase_unstable"],"mappings":";;;;;;;;;;;;eAQEA,kBAAW;;;eACXC,4BAAqB;;;eACrBC,iCAA0B;;;eAG1BG,kCAA2B;;;eAF3BF,oCAA6B;;;eAC7BC,8BAAuB;;;uBAElB,iCAAiC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Card/Card.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\n/**\n * Card selected event type\n *\n * This event is fired when a selectable card changes its selection state.\n */\nexport type CardOnSelectionChangeEvent = React.MouseEvent | React.KeyboardEvent | React.ChangeEvent;\n\n/**\n * Data sent from the selection events on a selectable card.\n */\nexport type CardOnSelectData = {\n selected: boolean;\n};\n\n/**\n * Data shared between card components\n */\nexport interface CardContextValue {\n selectableA11yProps: {\n referenceId?: string;\n setReferenceId: (referenceId: string) => void;\n referenceLabel?: string;\n setReferenceLabel: (referenceLabel: string) => void;\n };\n}\n\n/**\n * Slots available in the Card component.\n */\nexport type CardSlots = {\n /**\n * Root element of the component.\n */\n root: Slot<'div'>;\n\n /**\n * Floating action that can be rendered on the top-right of a card. Often used together with\n * `selected`, `defaultSelected`, and `onSelectionChange` props\n */\n floatingAction?: Slot<'div'>;\n\n /**\n * The internal checkbox element that renders when the card is selectable.\n */\n checkbox?: Slot<'input'>;\n};\n\n/**\n * Card component props.\n */\nexport type CardProps = ComponentProps<CardSlots> & {\n /**\n * Sets the appearance of the card.\n *\n * `filled`\n * The card will have a shadow, border and background color.\n *\n * `filled-alternative`\n * This appearance is similar to `filled`, but the background color will be a little darker.\n *\n * `outline`\n * This appearance is similar to `filled`, but the background color will be transparent and no shadow applied.\n *\n * `subtle`\n * This appearance is similar to `filled-alternative`, but no border is applied.\n *\n * @default 'filled'\n */\n appearance?: 'filled' | 'filled-alternative' | 'outline' | 'subtle';\n\n /**\n * Sets the focus behavior for the card.\n *\n * `off`\n * The card will not focusable.\n *\n * `no-tab`\n * This behaviour traps the focus inside of the Card when pressing the Enter key and will only release focus when\n * pressing the Escape key.\n *\n * `tab-exit`\n * This behaviour traps the focus inside of the Card when pressing the Enter key but will release focus when pressing\n * the Tab key on the last inner element.\n *\n * `tab-only`\n * This behaviour will cycle through all elements inside of the Card when pressing the Tab key and then release focus\n * after the last inner element.\n *\n * @default 'off'\n */\n focusMode?: 'off' | 'no-tab' | 'tab-exit' | 'tab-only';\n\n /**\n * Defines the orientation of the card.\n *\n * @default 'vertical'\n */\n orientation?: 'horizontal' | 'vertical';\n\n /**\n * Controls the card's border radius and padding between inner elements.\n *\n * @default 'medium'\n */\n size?: 'small' | 'medium' | 'large';\n\n /**\n * Defines the controlled selected state of the card.\n *\n * @default false\n */\n selected?: boolean;\n\n /**\n * Defines whether the card is initially in a selected state when rendered.\n *\n * @default false\n */\n defaultSelected?: boolean;\n\n /**\n * Callback to be called when the selected state value changes.\n */\n // eslint-disable-next-line @nx/workspace-consistent-callback-type -- can't change type of existing callback\n onSelectionChange?: (event: CardOnSelectionChangeEvent, data: CardOnSelectData) => void;\n\n /**\n * Makes the card and card selection disabled (not propagated to children).\n *\n * @default false\n */\n disabled?: boolean;\n};\n\n/**\n * State used in rendering Card.\n */\nexport type CardState = ComponentState<CardSlots> &\n CardContextValue &\n Required<\n Pick<CardProps, 'appearance' | 'orientation' | 'size'> & {\n /**\n * Represents a card that contains interactive events (MouseEvents) or is a button/a tag.\n *\n * @default false\n */\n interactive: boolean;\n\n /**\n * Represents a selectable card.\n *\n * @default false\n */\n selectable: boolean;\n\n /**\n * Defines whether the card is currently selected.\n *\n * @default false\n */\n selected: boolean;\n\n /**\n * Defines whether the card internal checkbox is currently focused.\n *\n * @default false\n */\n selectFocused: boolean;\n\n /**\n * Defines whether the card is disabled.\n *\n * @default false\n */\n disabled: boolean;\n }\n >;\n"],"names":["React"],"mappings":";;;;;iEAAuB,QAAQ"}
|
|
1
|
+
{"version":3,"sources":["../src/components/Card/Card.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\n/**\n * Card selected event type\n *\n * This event is fired when a selectable card changes its selection state.\n */\nexport type CardOnSelectionChangeEvent = React.MouseEvent | React.KeyboardEvent | React.ChangeEvent;\n\n/**\n * Data sent from the selection events on a selectable card.\n */\nexport type CardOnSelectData = {\n selected: boolean;\n};\n\n/**\n * Data shared between card components\n */\nexport interface CardContextValue {\n selectableA11yProps: {\n referenceId?: string;\n setReferenceId: (referenceId: string) => void;\n referenceLabel?: string;\n setReferenceLabel: (referenceLabel: string) => void;\n };\n}\n\n/**\n * Slots available in the Card component.\n */\nexport type CardSlots = {\n /**\n * Root element of the component.\n */\n root: Slot<'div'>;\n\n /**\n * Floating action that can be rendered on the top-right of a card. Often used together with\n * `selected`, `defaultSelected`, and `onSelectionChange` props\n */\n floatingAction?: Slot<'div'>;\n\n /**\n * The internal checkbox element that renders when the card is selectable.\n */\n checkbox?: Slot<'input'>;\n};\n\n/**\n * Card component props.\n */\nexport type CardProps = ComponentProps<CardSlots> & {\n /**\n * Sets the appearance of the card.\n *\n * `filled`\n * The card will have a shadow, border and background color.\n *\n * `filled-alternative`\n * This appearance is similar to `filled`, but the background color will be a little darker.\n *\n * `outline`\n * This appearance is similar to `filled`, but the background color will be transparent and no shadow applied.\n *\n * `subtle`\n * This appearance is similar to `filled-alternative`, but no border is applied.\n *\n * @default 'filled'\n */\n appearance?: 'filled' | 'filled-alternative' | 'outline' | 'subtle';\n\n /**\n * Sets the focus behavior for the card.\n *\n * `off`\n * The card will not focusable.\n *\n * `no-tab`\n * This behaviour traps the focus inside of the Card when pressing the Enter key and will only release focus when\n * pressing the Escape key.\n *\n * `tab-exit`\n * This behaviour traps the focus inside of the Card when pressing the Enter key but will release focus when pressing\n * the Tab key on the last inner element.\n *\n * `tab-only`\n * This behaviour will cycle through all elements inside of the Card when pressing the Tab key and then release focus\n * after the last inner element.\n *\n * @default 'off'\n */\n focusMode?: 'off' | 'no-tab' | 'tab-exit' | 'tab-only';\n\n /**\n * Defines the orientation of the card.\n *\n * @default 'vertical'\n */\n orientation?: 'horizontal' | 'vertical';\n\n /**\n * Controls the card's border radius and padding between inner elements.\n *\n * @default 'medium'\n */\n size?: 'small' | 'medium' | 'large';\n\n /**\n * Defines the controlled selected state of the card.\n *\n * @default false\n */\n selected?: boolean;\n\n /**\n * Defines whether the card is initially in a selected state when rendered.\n *\n * @default false\n */\n defaultSelected?: boolean;\n\n /**\n * Callback to be called when the selected state value changes.\n */\n // eslint-disable-next-line @nx/workspace-consistent-callback-type -- can't change type of existing callback\n onSelectionChange?: (event: CardOnSelectionChangeEvent, data: CardOnSelectData) => void;\n\n /**\n * Makes the card and card selection disabled (not propagated to children).\n *\n * @default false\n */\n disabled?: boolean;\n};\n\nexport type CardBaseProps = Omit<CardProps, 'appearance' | 'orientation' | 'size'>;\n\n/**\n * State used in rendering Card.\n */\nexport type CardState = ComponentState<CardSlots> &\n CardContextValue &\n Required<\n Pick<CardProps, 'appearance' | 'orientation' | 'size'> & {\n /**\n * Represents a card that contains interactive events (MouseEvents) or is a button/a tag.\n *\n * @default false\n */\n interactive: boolean;\n\n /**\n * Represents a selectable card.\n *\n * @default false\n */\n selectable: boolean;\n\n /**\n * Defines whether the card is currently selected.\n *\n * @default false\n */\n selected: boolean;\n\n /**\n * Defines whether the card internal checkbox is currently focused.\n *\n * @default false\n */\n selectFocused: boolean;\n\n /**\n * Defines whether the card is disabled.\n *\n * @default false\n */\n disabled: boolean;\n }\n >;\n\nexport type CardBaseState = Omit<CardState, 'appearance' | 'orientation' | 'size'>;\n"],"names":["React"],"mappings":";;;;;iEAAuB,QAAQ"}
|
|
@@ -27,6 +27,9 @@ _export(exports, {
|
|
|
27
27
|
renderCard_unstable: function() {
|
|
28
28
|
return _renderCard.renderCard_unstable;
|
|
29
29
|
},
|
|
30
|
+
useCardBase_unstable: function() {
|
|
31
|
+
return _useCard.useCardBase_unstable;
|
|
32
|
+
},
|
|
30
33
|
useCardContext_unstable: function() {
|
|
31
34
|
return _CardContext.useCardContext_unstable;
|
|
32
35
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Card/index.ts"],"sourcesContent":["export { Card } from './Card';\nexport type {\n CardContextValue,\n CardOnSelectData,\n CardOnSelectionChangeEvent,\n CardProps,\n CardSlots,\n CardState,\n} from './Card.types';\nexport { CardProvider, cardContextDefaultValue, useCardContext_unstable } from './CardContext';\nexport { renderCard_unstable } from './renderCard';\nexport { useCard_unstable } from './useCard';\nexport { cardCSSVars, cardClassNames, useCardStyles_unstable } from './useCardStyles.styles';\n"],"names":["Card","CardProvider","cardContextDefaultValue","useCardContext_unstable","renderCard_unstable","useCard_unstable","cardCSSVars","cardClassNames","useCardStyles_unstable"],"mappings":";;;;;;;;;;;IAASA;yBAAI;;;
|
|
1
|
+
{"version":3,"sources":["../src/components/Card/index.ts"],"sourcesContent":["export { Card } from './Card';\nexport type {\n CardBaseProps,\n CardBaseState,\n CardContextValue,\n CardOnSelectData,\n CardOnSelectionChangeEvent,\n CardProps,\n CardSlots,\n CardState,\n} from './Card.types';\nexport { CardProvider, cardContextDefaultValue, useCardContext_unstable } from './CardContext';\nexport { renderCard_unstable } from './renderCard';\nexport { useCard_unstable, useCardBase_unstable } from './useCard';\nexport { cardCSSVars, cardClassNames, useCardStyles_unstable } from './useCardStyles.styles';\n"],"names":["Card","CardProvider","cardContextDefaultValue","useCardContext_unstable","renderCard_unstable","useCard_unstable","useCardBase_unstable","cardCSSVars","cardClassNames","useCardStyles_unstable"],"mappings":";;;;;;;;;;;IAASA;yBAAI;;;eAWJC,yBAAY;;eAGD;eAAXM;;;eAAaC,mCAAc;;;eAHbN,oCAAuB;;;eACrCE,+BAAmB;;;eACDE,6BAAoB;;;eAFCH,oCAAuB;;;eAGjCM,2CAAsB;;;eADnDJ,yBAAgB;;;sBAbJ,SAAS;6BAWiD,gBAAgB;4BAC3D,eAAe;yBACI,YAAY;qCACC,yBAAyB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Card/renderCard.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type { CardContextValue, CardSlots,
|
|
1
|
+
{"version":3,"sources":["../src/components/Card/renderCard.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type { CardContextValue, CardSlots, CardBaseState } from './Card.types';\nimport { CardProvider } from './CardContext';\n\n/**\n * Render the final JSX of Card.\n */\nexport const renderCard_unstable = (state: CardBaseState, cardContextValue: CardContextValue): JSXElement => {\n assertSlots<CardSlots>(state);\n\n return (\n <state.root>\n <CardProvider value={cardContextValue}>\n {state.checkbox ? <state.checkbox /> : null}\n {state.floatingAction ? <state.floatingAction /> : null}\n {state.root.children}\n </CardProvider>\n </state.root>\n );\n};\n"],"names":["assertSlots","CardProvider","renderCard_unstable","state","cardContextValue","root","value","checkbox","floatingAction","children"],"mappings":";;;;+BAWaE;;;;;;4BAVb,iCAAiD;gCAErB,4BAA4B;6BAG3B,gBAAgB;AAKtC,4BAA4B,CAACC,OAAsBC;QACxDJ,2BAAAA,EAAuBG;IAEvB,OAAA,WAAA,OACE,eAAA,EAACA,MAAME,IAAI,EAAA;kBACT,WAAA,OAAA,gBAAA,EAACJ,yBAAAA,EAAAA;YAAaK,OAAOF;;gBAClBD,MAAMI,QAAQ,GAAA,WAAA,OAAG,eAAA,EAACJ,MAAMI,QAAQ,EAAA,CAAA,KAAM;gBACtCJ,MAAMK,cAAc,GAAA,WAAA,GAAG,mBAAA,EAACL,MAAMK,cAAc,EAAA,CAAA,KAAM;gBAClDL,MAAME,IAAI,CAACI,QAAQ;;;;AAI5B,EAAE"}
|
|
@@ -3,9 +3,17 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
function _export(target, all) {
|
|
7
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: all[name]
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
_export(exports, {
|
|
13
|
+
useCardBase_unstable: function() {
|
|
14
|
+
return useCardBase_unstable;
|
|
15
|
+
},
|
|
16
|
+
useCard_unstable: function() {
|
|
9
17
|
return useCard_unstable;
|
|
10
18
|
}
|
|
11
19
|
});
|
|
@@ -67,7 +75,17 @@ const focusMap = {
|
|
|
67
75
|
};
|
|
68
76
|
};
|
|
69
77
|
const useCard_unstable = (props, ref)=>{
|
|
70
|
-
const { appearance = 'filled', orientation = 'vertical', size = 'medium',
|
|
78
|
+
const { appearance = 'filled', orientation = 'vertical', size = 'medium', ...cardProps } = props;
|
|
79
|
+
const state = useCardBase_unstable(cardProps, ref);
|
|
80
|
+
return {
|
|
81
|
+
...state,
|
|
82
|
+
appearance,
|
|
83
|
+
orientation,
|
|
84
|
+
size
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
const useCardBase_unstable = (props, ref)=>{
|
|
88
|
+
const { disabled = false, ...restProps } = props;
|
|
71
89
|
const [referenceId, setReferenceId] = _react.useState(_CardContext.cardContextDefaultValue.selectableA11yProps.referenceId);
|
|
72
90
|
const [referenceLabel, setReferenceLabel] = _react.useState(_CardContext.cardContextDefaultValue.selectableA11yProps.referenceId);
|
|
73
91
|
const cardBaseRef = (0, _reacttabster.useFocusWithin)();
|
|
@@ -90,9 +108,6 @@ const useCard_unstable = (props, ref)=>{
|
|
|
90
108
|
};
|
|
91
109
|
}
|
|
92
110
|
return {
|
|
93
|
-
appearance,
|
|
94
|
-
orientation,
|
|
95
|
-
size,
|
|
96
111
|
interactive,
|
|
97
112
|
selectable,
|
|
98
113
|
selectFocused,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Card/useCard.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { getIntrinsicElementProps, useMergedRefs, slot } from '@fluentui/react-utilities';\nimport { useFocusableGroup, useFocusWithin } from '@fluentui/react-tabster';\n\nimport type { CardProps, CardState } from './Card.types';\nimport { useCardSelectable } from './useCardSelectable';\nimport { cardContextDefaultValue } from './CardContext';\n\nconst focusMap = {\n off: undefined,\n 'no-tab': 'limited-trap-focus',\n 'tab-exit': 'limited',\n 'tab-only': 'unlimited',\n} as const;\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 */\nconst useCardInteractive = ({ focusMode: initialFocusMode, disabled = false, ...props }: CardProps) => {\n const interactive = (\n [\n 'onClick',\n 'onDoubleClick',\n 'onMouseUp',\n 'onMouseDown',\n 'onPointerUp',\n 'onPointerDown',\n 'onTouchStart',\n 'onTouchEnd',\n 'onDragStart',\n 'onDragEnd',\n ] as (keyof React.HTMLAttributes<HTMLElement>)[]\n ).some(prop => props[prop]);\n\n // default focusMode to tab-only when interactive, and off when not\n const focusMode = initialFocusMode ?? (interactive ? 'no-tab' : 'off');\n\n const groupperAttrs = useFocusableGroup({\n tabBehavior: focusMap[focusMode],\n });\n\n if (disabled) {\n return {\n interactive: false,\n focusAttributes: null,\n };\n }\n\n if (focusMode === 'off') {\n return {\n interactive,\n focusAttributes: null,\n };\n }\n\n return {\n interactive,\n focusAttributes: {\n ...groupperAttrs,\n tabIndex: 0,\n },\n };\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 */\nexport const useCard_unstable = (props: CardProps, ref: React.Ref<HTMLDivElement>): CardState => {\n const { appearance = 'filled', orientation = 'vertical', size = 'medium', disabled = false, ...restProps } = props;\n\n const [referenceId, setReferenceId] = React.useState(cardContextDefaultValue.selectableA11yProps.referenceId);\n const [referenceLabel, setReferenceLabel] = React.useState(cardContextDefaultValue.selectableA11yProps.referenceId);\n\n const cardBaseRef = useFocusWithin<HTMLDivElement>();\n const { selectable, selected, selectableCardProps, selectFocused, checkboxSlot, floatingActionSlot } =\n useCardSelectable(props, { referenceId, referenceLabel }, cardBaseRef);\n\n const cardRef = useMergedRefs(cardBaseRef, ref);\n\n const { interactive, focusAttributes } = useCardInteractive(props);\n\n let cardRootProps = {\n ...(!selectable ? focusAttributes : null),\n ...restProps,\n ...selectableCardProps,\n };\n\n if (disabled) {\n cardRootProps = {\n ...restProps,\n 'aria-disabled': true,\n onClick: undefined,\n };\n }\n\n return {\n
|
|
1
|
+
{"version":3,"sources":["../src/components/Card/useCard.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { getIntrinsicElementProps, useMergedRefs, slot } from '@fluentui/react-utilities';\nimport { useFocusableGroup, useFocusWithin } from '@fluentui/react-tabster';\n\nimport type { CardBaseProps, CardBaseState, CardProps, CardState } from './Card.types';\nimport { useCardSelectable } from './useCardSelectable';\nimport { cardContextDefaultValue } from './CardContext';\n\nconst focusMap = {\n off: undefined,\n 'no-tab': 'limited-trap-focus',\n 'tab-exit': 'limited',\n 'tab-only': 'unlimited',\n} as const;\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 */\nconst useCardInteractive = ({ focusMode: initialFocusMode, disabled = false, ...props }: CardProps) => {\n const interactive = (\n [\n 'onClick',\n 'onDoubleClick',\n 'onMouseUp',\n 'onMouseDown',\n 'onPointerUp',\n 'onPointerDown',\n 'onTouchStart',\n 'onTouchEnd',\n 'onDragStart',\n 'onDragEnd',\n ] as (keyof React.HTMLAttributes<HTMLElement>)[]\n ).some(prop => props[prop]);\n\n // default focusMode to tab-only when interactive, and off when not\n const focusMode = initialFocusMode ?? (interactive ? 'no-tab' : 'off');\n\n const groupperAttrs = useFocusableGroup({\n tabBehavior: focusMap[focusMode],\n });\n\n if (disabled) {\n return {\n interactive: false,\n focusAttributes: null,\n };\n }\n\n if (focusMode === 'off') {\n return {\n interactive,\n focusAttributes: null,\n };\n }\n\n return {\n interactive,\n focusAttributes: {\n ...groupperAttrs,\n tabIndex: 0,\n },\n };\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 */\nexport const useCard_unstable = (props: CardProps, ref: React.Ref<HTMLDivElement>): CardState => {\n const { appearance = 'filled', orientation = 'vertical', size = 'medium', ...cardProps } = props;\n const state = useCardBase_unstable(cardProps, ref);\n\n return {\n ...state,\n appearance,\n orientation,\n size,\n };\n};\n\n/**\n * Base hook for Card component, which manages state related to interactivity, selection,\n * focus management, ARIA attributes, and slot structure without design props.\n *\n * @param props - props from this instance of Card\n * @param ref - reference to the root element of Card\n */\nexport const useCardBase_unstable = (props: CardBaseProps, ref: React.Ref<HTMLDivElement>): CardBaseState => {\n const { disabled = false, ...restProps } = props;\n\n const [referenceId, setReferenceId] = React.useState(cardContextDefaultValue.selectableA11yProps.referenceId);\n const [referenceLabel, setReferenceLabel] = React.useState(cardContextDefaultValue.selectableA11yProps.referenceId);\n\n const cardBaseRef = useFocusWithin<HTMLDivElement>();\n const { selectable, selected, selectableCardProps, selectFocused, checkboxSlot, floatingActionSlot } =\n useCardSelectable(props, { referenceId, referenceLabel }, cardBaseRef);\n\n const cardRef = useMergedRefs(cardBaseRef, ref);\n\n const { interactive, focusAttributes } = useCardInteractive(props);\n\n let cardRootProps = {\n ...(!selectable ? focusAttributes : null),\n ...restProps,\n ...selectableCardProps,\n };\n\n if (disabled) {\n cardRootProps = {\n ...restProps,\n 'aria-disabled': true,\n onClick: undefined,\n };\n }\n\n return {\n interactive,\n selectable,\n selectFocused,\n selected,\n disabled,\n selectableA11yProps: {\n setReferenceId,\n referenceId,\n referenceLabel,\n setReferenceLabel,\n },\n\n components: {\n root: 'div',\n floatingAction: 'div',\n checkbox: 'input',\n },\n\n root: slot.always(\n getIntrinsicElementProps('div', {\n ref: cardRef,\n role: 'group',\n ...cardRootProps,\n }),\n { elementType: 'div' },\n ),\n\n floatingAction: floatingActionSlot,\n checkbox: checkboxSlot,\n };\n};\n"],"names":["React","getIntrinsicElementProps","useMergedRefs","slot","useFocusableGroup","useFocusWithin","useCardSelectable","cardContextDefaultValue","focusMap","off","undefined","useCardInteractive","focusMode","initialFocusMode","disabled","props","interactive","some","prop","groupperAttrs","tabBehavior","focusAttributes","tabIndex","useCard_unstable","ref","appearance","orientation","size","cardProps","state","useCardBase_unstable","restProps","referenceId","setReferenceId","useState","selectableA11yProps","referenceLabel","setReferenceLabel","cardBaseRef","selectable","selected","selectableCardProps","selectFocused","checkboxSlot","floatingActionSlot","cardRef","cardRootProps","onClick","components","root","floatingAction","checkbox","always","role","elementType"],"mappings":"AAAA;;;;;;;;;;;;wBAmGa8B;;;oBAnBAP;eAAAA;;;;iEA9EU,QAAQ;gCAC+B,4BAA4B;8BACxC,0BAA0B;mCAG1C,sBAAsB;6BAChB,gBAAgB;AAExD,MAAMf,WAAW;IACfC,KAAKC;IACL,UAAU;IACV,YAAY;IACZ,YAAY;AACd;AAEA;;;;;;;CAOC,GACD,MAAMC,qBAAqB,CAAC,EAAEC,WAAWC,gBAAgB,EAAEC,WAAW,KAAK,EAAE,GAAGC,OAAkB;IAChG,MAAMC,cACJ;QACE;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;KACD,CACDC,IAAI,CAACC,CAAAA,OAAQH,KAAK,CAACG,KAAK;IAE1B,mEAAmE;IACnE,MAAMN,YAAYC,qBAAAA,QAAAA,qBAAAA,KAAAA,IAAAA,mBAAqBG,cAAc,WAAW;IAEhE,MAAMG,oBAAgBf,+BAAAA,EAAkB;QACtCgB,aAAaZ,QAAQ,CAACI,UAAU;IAClC;IAEA,IAAIE,UAAU;QACZ,OAAO;YACLE,aAAa;YACbK,iBAAiB;QACnB;IACF;IAEA,IAAIT,cAAc,OAAO;QACvB,OAAO;YACLI;YACAK,iBAAiB;QACnB;IACF;IAEA,OAAO;QACLL;QACAK,iBAAiB;YACf,GAAGF,aAAa;YAChBG,UAAU;QACZ;IACF;AACF;AAWO,yBAAyB,CAACP,OAAkBS;IACjD,MAAM,EAAEC,aAAa,QAAQ,EAAEC,cAAc,UAAU,EAAEC,OAAO,QAAQ,EAAE,GAAGC,WAAW,GAAGb;IAC3F,MAAMc,QAAQC,qBAAqBF,WAAWJ;IAE9C,OAAO;QACL,GAAGK,KAAK;QACRJ;QACAC;QACAC;IACF;AACF,EAAE;AASK,MAAMG,uBAAuB,CAACf,OAAsBS;IACzD,MAAM,EAAEV,WAAW,KAAK,EAAE,GAAGiB,WAAW,GAAGhB;IAE3C,MAAM,CAACiB,aAAaC,eAAe,GAAGjC,OAAMkC,QAAQ,CAAC3B,oCAAAA,CAAwB4B,mBAAmB,CAACH,WAAW;IAC5G,MAAM,CAACI,gBAAgBC,kBAAkB,GAAGrC,OAAMkC,QAAQ,CAAC3B,oCAAAA,CAAwB4B,mBAAmB,CAACH,WAAW;IAElH,MAAMM,kBAAcjC,4BAAAA;IACpB,MAAM,EAAEkC,UAAU,EAAEC,QAAQ,EAAEC,mBAAmB,EAAEC,aAAa,EAAEC,YAAY,EAAEC,kBAAkB,EAAE,OAClGtC,oCAAAA,EAAkBS,OAAO;QAAEiB;QAAaI;IAAe,GAAGE;IAE5D,MAAMO,cAAU3C,6BAAAA,EAAcoC,aAAad;IAE3C,MAAM,EAAER,WAAW,EAAEK,eAAe,EAAE,GAAGV,mBAAmBI;IAE5D,IAAI+B,gBAAgB;QAClB,GAAI,CAACP,aAAalB,kBAAkB,IAAI;QACxC,GAAGU,SAAS;QACZ,GAAGU,mBAAmB;IACxB;IAEA,IAAI3B,UAAU;QACZgC,gBAAgB;YACd,GAAGf,SAAS;YACZ,iBAAiB;YACjBgB,SAASrC;QACX;IACF;IAEA,OAAO;QACLM;QACAuB;QACAG;QACAF;QACA1B;QACAqB,qBAAqB;YACnBF;YACAD;YACAI;YACAC;QACF;QAEAW,YAAY;YACVC,MAAM;YACNC,gBAAgB;YAChBC,UAAU;QACZ;QAEAF,MAAM9C,oBAAAA,CAAKiD,MAAM,KACfnD,wCAAAA,EAAyB,OAAO;YAC9BuB,KAAKqB;YACLQ,MAAM;YACN,GAAGP,aAAa;QAClB,IACA;YAAEQ,aAAa;QAAM;QAGvBJ,gBAAgBN;QAChBO,UAAUR;IACZ;AACF,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Card/useCardSelectable.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { mergeCallbacks, slot, useControllableState } from '@fluentui/react-utilities';\nimport { Enter } from '@fluentui/keyboard-keys';\nimport { useFocusFinders } from '@fluentui/react-tabster';\n\nimport type { CardContextValue, CardOnSelectionChangeEvent, CardProps, CardSlots, CardState } from './Card.types';\n\ntype SelectableA11yProps = Pick<CardContextValue['selectableA11yProps'], 'referenceId' | 'referenceLabel'>;\n\n/**\n *
|
|
1
|
+
{"version":3,"sources":["../src/components/Card/useCardSelectable.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { mergeCallbacks, slot, useControllableState } from '@fluentui/react-utilities';\nimport { Enter } from '@fluentui/keyboard-keys';\nimport { useFocusFinders } from '@fluentui/react-tabster';\n\nimport type { CardContextValue, CardOnSelectionChangeEvent, CardProps, CardSlots, CardState } from './Card.types';\n\ntype SelectableA11yProps = Pick<CardContextValue['selectableA11yProps'], 'referenceId' | 'referenceLabel'>;\n\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 * @internal\n * @param props - props from this instance of Card\n * @param a11yProps - accessibility props shared between elements of the card\n * @param cardRef - reference to the root element of Card\n */\nexport const useCardSelectable = (\n props: CardProps,\n { referenceLabel, referenceId }: SelectableA11yProps,\n cardRef: React.RefObject<HTMLDivElement | null>,\n): {\n selected: boolean;\n selectable: boolean;\n selectFocused: boolean;\n selectableCardProps: {\n onClick: React.MouseEventHandler<HTMLDivElement>;\n onKeyDown: React.KeyboardEventHandler<HTMLDivElement>;\n } | null;\n checkboxSlot: CardState['checkbox'];\n floatingActionSlot: CardState['floatingAction'];\n} => {\n const { checkbox = {}, onSelectionChange, floatingAction, onClick, onKeyDown, disabled } = props;\n\n const { findAllFocusable } = useFocusFinders();\n const checkboxRef = React.useRef<HTMLInputElement>(null);\n\n const [selected, setSelected] = useControllableState({\n state: props.selected,\n defaultState: props.defaultSelected,\n initialState: false,\n });\n const selectable = [props.selected, props.defaultSelected, onSelectionChange].some(\n prop => typeof prop !== 'undefined',\n );\n\n const [selectFocused, setSelectFocused] = 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 (disabled || shouldRestrictTriggerAction(event)) {\n return;\n }\n\n const newCheckedValue = !selected;\n\n setSelected(newCheckedValue);\n\n if (onSelectionChange) {\n onSelectionChange(event, { selected: newCheckedValue });\n }\n },\n [disabled, onSelectionChange, selected, setSelected, 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 (!selectable || 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 slot.optional(checkbox, {\n defaultProps: {\n ref: checkboxRef,\n type: 'checkbox',\n checked: selected,\n disabled,\n onChange: (event: React.ChangeEvent<HTMLInputElement>) => onChangeHandler(event),\n onFocus: () => setSelectFocused(true),\n onBlur: () => setSelectFocused(false),\n ...selectableCheckboxProps,\n },\n elementType: 'input',\n });\n }, [checkbox, disabled, floatingAction, selected, selectable, onChangeHandler, referenceId, referenceLabel]);\n\n const floatingActionSlot = React.useMemo(() => {\n if (!floatingAction) {\n return;\n }\n\n return slot.optional(floatingAction, {\n defaultProps: {\n ref: checkboxRef,\n },\n elementType: 'div',\n });\n }, [floatingAction]);\n\n const selectableCardProps = React.useMemo(() => {\n if (!selectable) {\n return null;\n }\n\n return {\n onClick: mergeCallbacks(onClick, onChangeHandler),\n onKeyDown: mergeCallbacks(onKeyDown, onKeyDownHandler),\n };\n }, [selectable, onChangeHandler, onClick, onKeyDown, onKeyDownHandler]);\n\n return {\n selected,\n selectable,\n selectFocused,\n selectableCardProps,\n checkboxSlot,\n floatingActionSlot,\n };\n};\n"],"names":["React","mergeCallbacks","slot","useControllableState","Enter","useFocusFinders","useCardSelectable","props","referenceLabel","referenceId","cardRef","checkbox","onSelectionChange","floatingAction","onClick","onKeyDown","disabled","findAllFocusable","checkboxRef","useRef","selected","setSelected","state","defaultState","defaultSelected","initialState","selectable","some","prop","selectFocused","setSelectFocused","useState","shouldRestrictTriggerAction","useCallback","event","current","focusableElements","target","isElementInFocusableGroup","element","contains","isCheckboxSlot","onChangeHandler","newCheckedValue","onKeyDownHandler","includes","key","preventDefault","checkboxSlot","useMemo","selectableCheckboxProps","optional","defaultProps","ref","type","checked","onChange","onFocus","onBlur","elementType","floatingActionSlot","selectableCardProps"],"mappings":"AAAA;;;;;+BAsBaM;;;;;;;iEApBU,QAAQ;gCAC4B,4BAA4B;8BACjE,0BAA0B;8BAChB,0BAA0B;AAiBnD,0BAA0B,CAC/BC,OACA,EAAEC,cAAc,EAAEC,WAAW,EAAuB,EACpDC;IAYA,MAAM,EAAEC,WAAW,CAAC,CAAC,EAAEC,iBAAiB,EAAEC,cAAc,EAAEC,OAAO,EAAEC,SAAS,EAAEC,QAAQ,EAAE,GAAGT;IAE3F,MAAM,EAAEU,gBAAgB,EAAE,OAAGZ,6BAAAA;IAC7B,MAAMa,cAAclB,OAAMmB,MAAM,CAAmB;IAEnD,MAAM,CAACC,UAAUC,YAAY,OAAGlB,oCAAAA,EAAqB;QACnDmB,OAAOf,MAAMa,QAAQ;QACrBG,cAAchB,MAAMiB,eAAe;QACnCC,cAAc;IAChB;IACA,MAAMC,aAAa;QAACnB,MAAMa,QAAQ;QAAEb,MAAMiB,eAAe;QAAEZ;KAAkB,CAACe,IAAI,CAChFC,CAAAA,OAAQ,OAAOA,SAAS;IAG1B,MAAM,CAACC,eAAeC,iBAAiB,GAAG9B,OAAM+B,QAAQ,CAAC;IAEzD,MAAMC,8BAA8BhC,OAAMiC,WAAW,CACnD,CAACC;QACC,IAAI,CAACxB,QAAQyB,OAAO,EAAE;YACpB,OAAO;QACT;QAEA,MAAMC,oBAAoBnB,iBAAiBP,QAAQyB,OAAO;QAC1D,MAAME,SAASH,MAAMG,MAAM;QAC3B,MAAMC,4BAA4BF,kBAAkBT,IAAI,CAACY,CAAAA,UAAWA,QAAQC,QAAQ,CAACH;QACrF,MAAMI,iBAAiBvB,CAAAA,gBAAAA,QAAAA,gBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,YAAaiB,OAAAA,AAAO,MAAKE;QAEhD,OAAOC,6BAA6B,CAACG;IACvC,GACA;QAAC/B;QAASO;KAAiB;IAG7B,MAAMyB,kBAAkB1C,OAAMiC,WAAW,CACvC,CAACC;QACC,IAAIlB,YAAYgB,4BAA4BE,QAAQ;YAClD;QACF;QAEA,MAAMS,kBAAkB,CAACvB;QAEzBC,YAAYsB;QAEZ,IAAI/B,mBAAmB;YACrBA,kBAAkBsB,OAAO;gBAAEd,UAAUuB;YAAgB;QACvD;IACF,GACA;QAAC3B;QAAUJ;QAAmBQ;QAAUC;QAAaW;KAA4B;IAGnF,MAAMY,mBAAmB5C,OAAMiC,WAAW,CACxC,CAACC;QACC,IAAI;YAAC9B,mBAAAA;SAAM,CAACyC,QAAQ,CAACX,MAAMY,GAAG,GAAG;YAC/BZ,MAAMa,cAAc;YACpBL,gBAAgBR;QAClB;IACF,GACA;QAACQ;KAAgB;IAGnB,MAAMM,eAAehD,OAAMiD,OAAO,CAAC;QACjC,IAAI,CAACvB,cAAcb,gBAAgB;YACjC;QACF;QAEA,MAAMqC,0BAAiD,CAAC;QAExD,IAAIzC,aAAa;YACfyC,uBAAuB,CAAC,kBAAkB,GAAGzC;QAC/C,OAAO,IAAID,gBAAgB;YACzB0C,uBAAuB,CAAC,aAAa,GAAG1C;QAC1C;QAEA,OAAON,oBAAAA,CAAKiD,QAAQ,CAACxC,UAAU;YAC7ByC,cAAc;gBACZC,KAAKnC;gBACLoC,MAAM;gBACNC,SAASnC;gBACTJ;gBACAwC,UAAU,CAACtB,QAA+CQ,gBAAgBR;gBAC1EuB,SAAS,IAAM3B,iBAAiB;gBAChC4B,QAAQ,IAAM5B,iBAAiB;gBAC/B,GAAGoB,uBAAuB;YAC5B;YACAS,aAAa;QACf;IACF,GAAG;QAAChD;QAAUK;QAAUH;QAAgBO;QAAUM;QAAYgB;QAAiBjC;QAAaD;KAAe;IAE3G,MAAMoD,qBAAqB5D,OAAMiD,OAAO,CAAC;QACvC,IAAI,CAACpC,gBAAgB;YACnB;QACF;QAEA,OAAOX,oBAAAA,CAAKiD,QAAQ,CAACtC,gBAAgB;YACnCuC,cAAc;gBACZC,KAAKnC;YACP;YACAyC,aAAa;QACf;IACF,GAAG;QAAC9C;KAAe;IAEnB,MAAMgD,sBAAsB7D,OAAMiD,OAAO,CAAC;QACxC,IAAI,CAACvB,YAAY;YACf,OAAO;QACT;QAEA,OAAO;YACLZ,aAASb,8BAAAA,EAAea,SAAS4B;YACjC3B,eAAWd,8BAAAA,EAAec,WAAW6B;QACvC;IACF,GAAG;QAAClB;QAAYgB;QAAiB5B;QAASC;QAAW6B;KAAiB;IAEtE,OAAO;QACLxB;QACAM;QACAG;QACAgC;QACAb;QACAY;IACF;AACF,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"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"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"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 * CardFooter base props (same as CardFooterProps since CardFooter has no design props)\n */\nexport type CardFooterBaseProps = CardFooterProps;\n\n/**\n * State used in rendering CardFooter.\n */\nexport type CardFooterState = ComponentState<CardFooterSlots>;\n\n/**\n * CardFooter base state (same as CardFooterState since CardFooter has no design props)\n */\nexport type CardFooterBaseState = CardFooterState;\n"],"names":[],"mappings":"AAgCA;;CAEC,GACD,WAAkD"}
|
|
@@ -18,6 +18,9 @@ _export(exports, {
|
|
|
18
18
|
renderCardFooter_unstable: function() {
|
|
19
19
|
return _renderCardFooter.renderCardFooter_unstable;
|
|
20
20
|
},
|
|
21
|
+
useCardFooterBase_unstable: function() {
|
|
22
|
+
return _useCardFooter.useCardFooterBase_unstable;
|
|
23
|
+
},
|
|
21
24
|
useCardFooterStyles_unstable: function() {
|
|
22
25
|
return _useCardFooterStylesstyles.useCardFooterStyles_unstable;
|
|
23
26
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/CardFooter/index.ts"],"sourcesContent":["export { CardFooter } from './CardFooter';\nexport type {
|
|
1
|
+
{"version":3,"sources":["../src/components/CardFooter/index.ts"],"sourcesContent":["export { CardFooter } from './CardFooter';\nexport type {\n CardFooterBaseProps,\n CardFooterBaseState,\n CardFooterProps,\n CardFooterSlots,\n CardFooterState,\n} from './CardFooter.types';\nexport { renderCardFooter_unstable } from './renderCardFooter';\nexport { useCardFooter_unstable, useCardFooterBase_unstable } from './useCardFooter';\nexport { cardFooterClassNames, useCardFooterStyles_unstable } from './useCardFooterStyles.styles';\n"],"names":["CardFooter","renderCardFooter_unstable","useCardFooter_unstable","useCardFooterBase_unstable","cardFooterClassNames","useCardFooterStyles_unstable"],"mappings":";;;;;;;;;;;;eAASA,sBAAU;;;eAUVI,+CAAoB;;;eAFpBH,2CAAyB;;;eACDE,yCAA0B;;;eAC5BE,uDAA4B;;;eADlDH,qCAAsB;;;4BATJ,eAAe;kCAQA,qBAAqB;+BACI,kBAAkB;2CAClB,+BAA+B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/CardFooter/renderCardFooter.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type { CardFooterSlots,
|
|
1
|
+
{"version":3,"sources":["../src/components/CardFooter/renderCardFooter.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type { CardFooterSlots, CardFooterBaseState } from './CardFooter.types';\n\n/**\n * Render the final JSX of CardFooter.\n */\nexport const renderCardFooter_unstable = (state: CardFooterBaseState): JSXElement => {\n assertSlots<CardFooterSlots>(state);\n\n return (\n <state.root>\n {state.root.children}\n {state.action && <state.action />}\n </state.root>\n );\n};\n"],"names":["assertSlots","renderCardFooter_unstable","state","root","children","action"],"mappings":";;;;+BAUaC;;;;;;4BATb,iCAAiD;gCAErB,4BAA4B;AAOjD,kCAAkC,CAACC;QACxCF,2BAAAA,EAA6BE;IAE7B,OAAA,WAAA,OACE,gBAAA,EAACA,MAAMC,IAAI,EAAA;;YACRD,MAAMC,IAAI,CAACC,QAAQ;YACnBF,MAAMG,MAAM,IAAA,WAAA,OAAI,eAAA,EAACH,MAAMG,MAAM,EAAA,CAAA;;;AAGpC,EAAE"}
|
|
@@ -1,10 +1,19 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
"use strict";
|
|
2
3
|
Object.defineProperty(exports, "__esModule", {
|
|
3
4
|
value: true
|
|
4
5
|
});
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
function _export(target, all) {
|
|
7
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: all[name]
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
_export(exports, {
|
|
13
|
+
useCardFooterBase_unstable: function() {
|
|
14
|
+
return useCardFooterBase_unstable;
|
|
15
|
+
},
|
|
16
|
+
useCardFooter_unstable: function() {
|
|
8
17
|
return useCardFooter_unstable;
|
|
9
18
|
}
|
|
10
19
|
});
|
|
@@ -12,6 +21,9 @@ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildc
|
|
|
12
21
|
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
13
22
|
const _reactutilities = require("@fluentui/react-utilities");
|
|
14
23
|
const useCardFooter_unstable = (props, ref)=>{
|
|
24
|
+
return useCardFooterBase_unstable(props, ref);
|
|
25
|
+
};
|
|
26
|
+
const useCardFooterBase_unstable = (props, ref)=>{
|
|
15
27
|
const { action } = props;
|
|
16
28
|
return {
|
|
17
29
|
components: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/CardFooter/useCardFooter.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../src/components/CardFooter/useCardFooter.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport type { CardFooterBaseProps, CardFooterBaseState, 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 return useCardFooterBase_unstable(props, ref);\n};\n\n/**\n * Base hook for CardFooter component, which manages state related to slots structure.\n * Note: CardFooter has no design props, so this is equivalent to useCardFooter_unstable.\n *\n * @param props - props from this instance of CardFooter\n * @param ref - reference to root HTMLElement of CardFooter\n */\nexport const useCardFooterBase_unstable = (\n props: CardFooterBaseProps,\n ref: React.Ref<HTMLElement>,\n): CardFooterBaseState => {\n const { action } = props;\n\n return {\n components: {\n root: 'div',\n action: 'div',\n },\n\n root: slot.always(\n getIntrinsicElementProps('div', {\n // FIXME:\n // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: ref as React.Ref<HTMLDivElement>,\n ...props,\n }),\n { elementType: 'div' },\n ),\n action: slot.optional(action, { elementType: 'div' }),\n };\n};\n"],"names":["React","getIntrinsicElementProps","slot","useCardFooter_unstable","props","ref","useCardFooterBase_unstable","action","components","root","always","elementType","optional"],"mappings":"AAAA;;;;;;;;;;;;IA0BaM,0BAAAA;;;0BAXAH;;;;;iEAbU,QAAQ;gCACgB,4BAA4B;AAYpE,MAAMA,yBAAyB,CAACC,OAAwBC;IAC7D,OAAOC,2BAA2BF,OAAOC;AAC3C,EAAE;AASK,mCAAmC,CACxCD,OACAC;IAEA,MAAM,EAAEE,MAAM,EAAE,GAAGH;IAEnB,OAAO;QACLI,YAAY;YACVC,MAAM;YACNF,QAAQ;QACV;QAEAE,MAAMP,oBAAAA,CAAKQ,MAAM,KACfT,wCAAAA,EAAyB,OAAO;YAC9B,SAAS;YACT,4EAA4E;YAC5E,4FAA4F;YAC5FI,KAAKA;YACL,GAAGD,KAAK;QACV,IACA;YAAEO,aAAa;QAAM;QAEvBJ,QAAQL,oBAAAA,CAAKU,QAAQ,CAACL,QAAQ;YAAEI,aAAa;QAAM;IACrD;AACF,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"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"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"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 * CardHeader base props (same as CardHeaderProps since CardHeader has no design props)\n */\nexport type CardHeaderBaseProps = CardHeaderProps;\n\n/**\n * State used in rendering CardHeader.\n */\nexport type CardHeaderState = ComponentState<CardHeaderSlots>;\n\n/**\n * CardHeader base state (same as CardHeaderState since CardHeader has no design props)\n */\nexport type CardHeaderBaseState = CardHeaderState;\n"],"names":[],"mappings":"AA+CA;;CAEC,GACD,WAAkD"}
|
|
@@ -21,6 +21,9 @@ _export(exports, {
|
|
|
21
21
|
renderCardHeader_unstable: function() {
|
|
22
22
|
return _renderCardHeader.renderCardHeader_unstable;
|
|
23
23
|
},
|
|
24
|
+
useCardHeaderBase_unstable: function() {
|
|
25
|
+
return _useCardHeader.useCardHeaderBase_unstable;
|
|
26
|
+
},
|
|
24
27
|
useCardHeaderStyles_unstable: function() {
|
|
25
28
|
return _useCardHeaderStylesstyles.useCardHeaderStyles_unstable;
|
|
26
29
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/CardHeader/index.ts"],"sourcesContent":["export { CardHeader } from './CardHeader';\nexport type {
|
|
1
|
+
{"version":3,"sources":["../src/components/CardHeader/index.ts"],"sourcesContent":["export { CardHeader } from './CardHeader';\nexport type {\n CardHeaderBaseProps,\n CardHeaderBaseState,\n CardHeaderProps,\n CardHeaderSlots,\n CardHeaderState,\n} from './CardHeader.types';\nexport { renderCardHeader_unstable } from './renderCardHeader';\nexport { useCardHeader_unstable, useCardHeaderBase_unstable } from './useCardHeader';\nexport { cardHeaderCSSVars, cardHeaderClassNames, useCardHeaderStyles_unstable } from './useCardHeaderStyles.styles';\n"],"names":["CardHeader","renderCardHeader_unstable","useCardHeader_unstable","useCardHeaderBase_unstable","cardHeaderCSSVars","cardHeaderClassNames","useCardHeaderStyles_unstable"],"mappings":";;;;;;;;;;;;eAASA,sBAAU;;;eAUVI,4CAAiB;;;eAAEC,+CAAoB;;;eAFvCJ,2CAAyB;;;eACDE,yCAA0B;;;eACTG,uDAA4B;;;eADrEJ,qCAAsB;;;4BATJ,eAAe;kCAQA,qBAAqB;+BACI,kBAAkB;2CACC,+BAA+B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/CardHeader/renderCardHeader.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type { CardHeaderSlots,
|
|
1
|
+
{"version":3,"sources":["../src/components/CardHeader/renderCardHeader.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type { CardHeaderSlots, CardHeaderBaseState } from './CardHeader.types';\n\n/**\n * Render the final JSX of CardHeader.\n */\nexport const renderCardHeader_unstable = (state: CardHeaderBaseState): JSXElement => {\n assertSlots<CardHeaderSlots>(state);\n\n return (\n <state.root>\n {state.image && <state.image />}\n {state.header && <state.header />}\n {state.description && <state.description />}\n {state.action && <state.action />}\n </state.root>\n );\n};\n"],"names":["assertSlots","renderCardHeader_unstable","state","root","image","header","description","action"],"mappings":";;;;+BAUaC;;;;;;4BATb,iCAAiD;gCAErB,4BAA4B;AAOjD,kCAAkC,CAACC;QACxCF,2BAAAA,EAA6BE;IAE7B,OAAA,WAAA,OACE,gBAAA,EAACA,MAAMC,IAAI,EAAA;;YACRD,MAAME,KAAK,IAAA,WAAA,OAAI,eAAA,EAACF,MAAME,KAAK,EAAA,CAAA;YAC3BF,MAAMG,MAAM,IAAA,WAAA,OAAI,eAAA,EAACH,MAAMG,MAAM,EAAA,CAAA;YAC7BH,MAAMI,WAAW,IAAA,WAAA,OAAI,eAAA,EAACJ,MAAMI,WAAW,EAAA,CAAA;YACvCJ,MAAMK,MAAM,IAAA,WAAA,OAAI,eAAA,EAACL,MAAMK,MAAM,EAAA,CAAA;;;AAGpC,EAAE"}
|
|
@@ -3,9 +3,17 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
function _export(target, all) {
|
|
7
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: all[name]
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
_export(exports, {
|
|
13
|
+
useCardHeaderBase_unstable: function() {
|
|
14
|
+
return useCardHeaderBase_unstable;
|
|
15
|
+
},
|
|
16
|
+
useCardHeader_unstable: function() {
|
|
9
17
|
return useCardHeader_unstable;
|
|
10
18
|
}
|
|
11
19
|
});
|
|
@@ -42,6 +50,9 @@ const _useCardHeaderStylesstyles = require("./useCardHeaderStyles.styles");
|
|
|
42
50
|
return generatedId;
|
|
43
51
|
}
|
|
44
52
|
const useCardHeader_unstable = (props, ref)=>{
|
|
53
|
+
return useCardHeaderBase_unstable(props, ref);
|
|
54
|
+
};
|
|
55
|
+
const useCardHeaderBase_unstable = (props, ref)=>{
|
|
45
56
|
const { image, header, description, action } = props;
|
|
46
57
|
const { selectableA11yProps: { referenceId, setReferenceId } } = (0, _CardContext.useCardContext_unstable)();
|
|
47
58
|
const headerRef = _react.useRef(null);
|