@fluentui/react-card 9.0.21 → 9.0.22

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 CHANGED
@@ -2,7 +2,37 @@
2
2
  "name": "@fluentui/react-card",
3
3
  "entries": [
4
4
  {
5
- "date": "Tue, 11 Jul 2023 18:44:12 GMT",
5
+ "date": "Mon, 17 Jul 2023 21:26:50 GMT",
6
+ "tag": "@fluentui/react-card_v9.0.22",
7
+ "version": "9.0.22",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "marcosvmmoura@gmail.com",
12
+ "package": "@fluentui/react-card",
13
+ "commit": "820b2c5b432f0f72df241c197b8cc0f5112657b3",
14
+ "comment": "fix: use resolved slot instead of raw prop object"
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Thu, 13 Jul 2023 21:25:39 GMT",
21
+ "tag": "@fluentui/react-card_v9.0.21",
22
+ "version": "9.0.21",
23
+ "comments": {
24
+ "none": [
25
+ {
26
+ "author": "martinhochel@microsoft.com",
27
+ "package": "@fluentui/react-card",
28
+ "commit": "8a9e1018f2abb2c7608c49d32acf44e93c43cba6",
29
+ "comment": "chore: update devDependencies to use * for inner workspace dependencies"
30
+ }
31
+ ]
32
+ }
33
+ },
34
+ {
35
+ "date": "Tue, 11 Jul 2023 18:46:36 GMT",
6
36
  "tag": "@fluentui/react-card_v9.0.21",
7
37
  "version": "9.0.21",
8
38
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,21 @@
1
1
  # Change Log - @fluentui/react-card
2
2
 
3
- This log was last generated on Tue, 11 Jul 2023 18:44:12 GMT and should not be manually modified.
3
+ This log was last generated on Mon, 17 Jul 2023 21:26:50 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.0.22](https://github.com/microsoft/fluentui/tree/@fluentui/react-card_v9.0.22)
8
+
9
+ Mon, 17 Jul 2023 21:26:50 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-card_v9.0.21..@fluentui/react-card_v9.0.22)
11
+
12
+ ### Patches
13
+
14
+ - fix: use resolved slot instead of raw prop object ([PR #28517](https://github.com/microsoft/fluentui/pull/28517) by marcosvmmoura@gmail.com)
15
+
7
16
  ## [9.0.21](https://github.com/microsoft/fluentui/tree/@fluentui/react-card_v9.0.21)
8
17
 
9
- Tue, 11 Jul 2023 18:44:12 GMT
18
+ Tue, 11 Jul 2023 18:46:36 GMT
10
19
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-card_v9.0.20..@fluentui/react-card_v9.0.21)
11
20
 
12
21
  ### Patches
@@ -43,15 +43,23 @@ import { cardHeaderClassNames } from './useCardHeaderStyles.styles';
43
43
  const headerRef = React.useRef(null);
44
44
  const hasChildId = React.useRef(false);
45
45
  const generatedId = useId(cardHeaderClassNames.header, referenceId);
46
+ const headerSlot = resolveShorthand(header, {
47
+ required: true,
48
+ defaultProps: {
49
+ ref: headerRef,
50
+ id: !hasChildId.current ? referenceId : undefined
51
+ }
52
+ });
46
53
  React.useEffect(()=>{
47
54
  var _headerRef_current;
48
55
  const headerId = !hasChildId.current ? (_headerRef_current = headerRef.current) === null || _headerRef_current === void 0 ? void 0 : _headerRef_current.id : undefined;
49
- const childWithId = getChildWithId(header);
56
+ const childWithId = getChildWithId(headerSlot === null || headerSlot === void 0 ? void 0 : headerSlot.children);
50
57
  hasChildId.current = Boolean(childWithId);
51
58
  setReferenceId(getReferenceId(headerId, childWithId, generatedId));
52
59
  }, [
53
60
  generatedId,
54
61
  header,
62
+ headerSlot,
55
63
  setReferenceId
56
64
  ]);
57
65
  return {
@@ -67,13 +75,7 @@ import { cardHeaderClassNames } from './useCardHeaderStyles.styles';
67
75
  ...props
68
76
  }),
69
77
  image: resolveShorthand(image),
70
- header: resolveShorthand(header, {
71
- required: true,
72
- defaultProps: {
73
- ref: headerRef,
74
- id: !hasChildId.current ? referenceId : undefined
75
- }
76
- }),
78
+ header: headerSlot,
77
79
  description: resolveShorthand(description),
78
80
  action: resolveShorthand(action)
79
81
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["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 * Finds the first child of CardHeader with an id prop.\n *\n * @param header - the header prop of CardHeader\n */\nfunction getChildWithId(header: CardHeaderProps['header']) {\n function isReactElementWithIdProp(element: React.ReactNode): element is React.ReactElement {\n return React.isValidElement(element) && Boolean(element.props.id);\n }\n\n return React.Children.toArray(header).find(isReactElementWithIdProp);\n}\n\n/**\n * Returns the id to use for the CardHeader root element.\n *\n * @param headerId - the id prop of the CardHeader component\n * @param childWithId - the first child of the CardHeader component with an id prop\n * @param generatedId - a generated id\n *\n * @returns the id to use for the CardHeader root element\n */\nfunction getReferenceId(\n headerId: string | undefined,\n childWithId: React.ReactElement | undefined,\n generatedId: string,\n): string {\n if (headerId) {\n return headerId;\n }\n\n if (childWithId?.props.id) {\n return childWithId.props.id;\n }\n\n return generatedId;\n}\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 hasChildId = React.useRef(false);\n const generatedId = useId(cardHeaderClassNames.header, referenceId);\n\n React.useEffect(() => {\n const headerId = !hasChildId.current ? headerRef.current?.id : undefined;\n const childWithId = getChildWithId(header);\n\n hasChildId.current = Boolean(childWithId);\n\n setReferenceId(getReferenceId(headerId, childWithId, generatedId));\n }, [generatedId, header, setReferenceId]);\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: !hasChildId.current ? referenceId : undefined,\n },\n }),\n description: resolveShorthand(description),\n action: resolveShorthand(action),\n };\n};\n"],"names":["React","getNativeElementProps","resolveShorthand","useId","useCardContext_unstable","cardHeaderClassNames","getChildWithId","header","isReactElementWithIdProp","element","isValidElement","Boolean","props","id","Children","toArray","find","getReferenceId","headerId","childWithId","generatedId","useCardHeader_unstable","ref","image","description","action","selectableA11yProps","referenceId","setReferenceId","headerRef","useRef","hasChildId","useEffect","current","undefined","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;;;;CAIC,GACD,SAASC,eAAeC,MAAiC,EAAE;IACzD,SAASC,yBAAyBC,OAAwB,EAAiC;QACzF,OAAOT,MAAMU,cAAc,CAACD,YAAYE,QAAQF,QAAQG,KAAK,CAACC,EAAE;IAClE;IAEA,OAAOb,MAAMc,QAAQ,CAACC,OAAO,CAACR,QAAQS,IAAI,CAACR;AAC7C;AAEA;;;;;;;;CAQC,GACD,SAASS,eACPC,QAA4B,EAC5BC,WAA2C,EAC3CC,WAAmB,EACX;IACR,IAAIF,UAAU;QACZ,OAAOA;IACT,CAAC;IAED,IAAIC,wBAAAA,yBAAAA,KAAAA,IAAAA,YAAaP,KAAK,CAACC,EAAE,EAAE;QACzB,OAAOM,YAAYP,KAAK,CAACC,EAAE;IAC7B,CAAC;IAED,OAAOO;AACT;AAEA;;;;;;;;CAQC,GACD,OAAO,MAAMC,yBAAyB,CAACT,OAAwBU,MAAiD;IAC9G,MAAM,EAAEC,MAAK,EAAEhB,OAAM,EAAEiB,YAAW,EAAEC,OAAM,EAAE,GAAGb;IAE/C,MAAM,EACJc,qBAAqB,EAAEC,YAAW,EAAEC,eAAc,EAAE,CAAA,EACrD,GAAGxB;IACJ,MAAMyB,YAAY7B,MAAM8B,MAAM,CAAiB,IAAI;IAEnD,MAAMC,aAAa/B,MAAM8B,MAAM,CAAC,KAAK;IACrC,MAAMV,cAAcjB,MAAME,qBAAqBE,MAAM,EAAEoB;IAEvD3B,MAAMgC,SAAS,CAAC,IAAM;YACmBH;QAAvC,MAAMX,WAAW,CAACa,WAAWE,OAAO,GAAGJ,CAAAA,qBAAAA,UAAUI,OAAO,cAAjBJ,gCAAAA,KAAAA,IAAAA,mBAAmBhB,EAAE,GAAGqB,SAAS;QACxE,MAAMf,cAAcb,eAAeC;QAEnCwB,WAAWE,OAAO,GAAGtB,QAAQQ;QAE7BS,eAAeX,eAAeC,UAAUC,aAAaC;IACvD,GAAG;QAACA;QAAab;QAAQqB;KAAe;IAExC,OAAO;QACLO,YAAY;YACVC,MAAM;YACNb,OAAO;YACPhB,QAAQ;YACRiB,aAAa;YACbC,QAAQ;QACV;QAEAW,MAAMnC,sBAAsB,OAAO;YACjCqB;YACA,GAAGV,KAAK;QACV;QACAW,OAAOrB,iBAAiBqB;QACxBhB,QAAQL,iBAAiBK,QAAQ;YAC/B8B,UAAU,IAAI;YACdC,cAAc;gBACZhB,KAAKO;gBACLhB,IAAI,CAACkB,WAAWE,OAAO,GAAGN,cAAcO,SAAS;YACnD;QACF;QACAV,aAAatB,iBAAiBsB;QAC9BC,QAAQvB,iBAAiBuB;IAC3B;AACF,EAAE"}
1
+ {"version":3,"sources":["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 * Finds the first child of CardHeader with an id prop.\n *\n * @param header - the header prop of CardHeader\n */\nfunction getChildWithId(header: React.ReactNode) {\n function isReactElementWithIdProp(element: React.ReactNode): element is React.ReactElement {\n return React.isValidElement(element) && Boolean(element.props.id);\n }\n\n return React.Children.toArray(header).find(isReactElementWithIdProp);\n}\n\n/**\n * Returns the id to use for the CardHeader root element.\n *\n * @param headerId - the id prop of the CardHeader component\n * @param childWithId - the first child of the CardHeader component with an id prop\n * @param generatedId - a generated id\n *\n * @returns the id to use for the CardHeader root element\n */\nfunction getReferenceId(\n headerId: string | undefined,\n childWithId: React.ReactElement | undefined,\n generatedId: string,\n): string {\n if (headerId) {\n return headerId;\n }\n\n if (childWithId?.props.id) {\n return childWithId.props.id;\n }\n\n return generatedId;\n}\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 hasChildId = React.useRef(false);\n const generatedId = useId(cardHeaderClassNames.header, referenceId);\n\n const headerSlot = resolveShorthand(header, {\n required: true,\n defaultProps: {\n ref: headerRef,\n id: !hasChildId.current ? referenceId : undefined,\n },\n });\n\n React.useEffect(() => {\n const headerId = !hasChildId.current ? headerRef.current?.id : undefined;\n const childWithId = getChildWithId(headerSlot?.children);\n\n hasChildId.current = Boolean(childWithId);\n\n setReferenceId(getReferenceId(headerId, childWithId, generatedId));\n }, [generatedId, header, headerSlot, setReferenceId]);\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: headerSlot,\n description: resolveShorthand(description),\n action: resolveShorthand(action),\n };\n};\n"],"names":["React","getNativeElementProps","resolveShorthand","useId","useCardContext_unstable","cardHeaderClassNames","getChildWithId","header","isReactElementWithIdProp","element","isValidElement","Boolean","props","id","Children","toArray","find","getReferenceId","headerId","childWithId","generatedId","useCardHeader_unstable","ref","image","description","action","selectableA11yProps","referenceId","setReferenceId","headerRef","useRef","hasChildId","headerSlot","required","defaultProps","current","undefined","useEffect","children","components","root"],"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;;;;CAIC,GACD,SAASC,eAAeC,MAAuB,EAAE;IAC/C,SAASC,yBAAyBC,OAAwB,EAAiC;QACzF,OAAOT,MAAMU,cAAc,CAACD,YAAYE,QAAQF,QAAQG,KAAK,CAACC,EAAE;IAClE;IAEA,OAAOb,MAAMc,QAAQ,CAACC,OAAO,CAACR,QAAQS,IAAI,CAACR;AAC7C;AAEA;;;;;;;;CAQC,GACD,SAASS,eACPC,QAA4B,EAC5BC,WAA2C,EAC3CC,WAAmB,EACX;IACR,IAAIF,UAAU;QACZ,OAAOA;IACT,CAAC;IAED,IAAIC,wBAAAA,yBAAAA,KAAAA,IAAAA,YAAaP,KAAK,CAACC,EAAE,EAAE;QACzB,OAAOM,YAAYP,KAAK,CAACC,EAAE;IAC7B,CAAC;IAED,OAAOO;AACT;AAEA;;;;;;;;CAQC,GACD,OAAO,MAAMC,yBAAyB,CAACT,OAAwBU,MAAiD;IAC9G,MAAM,EAAEC,MAAK,EAAEhB,OAAM,EAAEiB,YAAW,EAAEC,OAAM,EAAE,GAAGb;IAE/C,MAAM,EACJc,qBAAqB,EAAEC,YAAW,EAAEC,eAAc,EAAE,CAAA,EACrD,GAAGxB;IACJ,MAAMyB,YAAY7B,MAAM8B,MAAM,CAAiB,IAAI;IAEnD,MAAMC,aAAa/B,MAAM8B,MAAM,CAAC,KAAK;IACrC,MAAMV,cAAcjB,MAAME,qBAAqBE,MAAM,EAAEoB;IAEvD,MAAMK,aAAa9B,iBAAiBK,QAAQ;QAC1C0B,UAAU,IAAI;QACdC,cAAc;YACZZ,KAAKO;YACLhB,IAAI,CAACkB,WAAWI,OAAO,GAAGR,cAAcS,SAAS;QACnD;IACF;IAEApC,MAAMqC,SAAS,CAAC,IAAM;YACmBR;QAAvC,MAAMX,WAAW,CAACa,WAAWI,OAAO,GAAGN,CAAAA,qBAAAA,UAAUM,OAAO,cAAjBN,gCAAAA,KAAAA,IAAAA,mBAAmBhB,EAAE,GAAGuB,SAAS;QACxE,MAAMjB,cAAcb,eAAe0B,uBAAAA,wBAAAA,KAAAA,IAAAA,WAAYM,QAAQ;QAEvDP,WAAWI,OAAO,GAAGxB,QAAQQ;QAE7BS,eAAeX,eAAeC,UAAUC,aAAaC;IACvD,GAAG;QAACA;QAAab;QAAQyB;QAAYJ;KAAe;IAEpD,OAAO;QACLW,YAAY;YACVC,MAAM;YACNjB,OAAO;YACPhB,QAAQ;YACRiB,aAAa;YACbC,QAAQ;QACV;QAEAe,MAAMvC,sBAAsB,OAAO;YACjCqB;YACA,GAAGV,KAAK;QACV;QACAW,OAAOrB,iBAAiBqB;QACxBhB,QAAQyB;QACRR,aAAatB,iBAAiBsB;QAC9BC,QAAQvB,iBAAiBuB;IAC3B;AACF,EAAE"}
@@ -44,15 +44,23 @@ const useCardHeader_unstable = (props, ref)=>{
44
44
  const headerRef = _react.useRef(null);
45
45
  const hasChildId = _react.useRef(false);
46
46
  const generatedId = (0, _reactUtilities.useId)(_useCardHeaderStylesStyles.cardHeaderClassNames.header, referenceId);
47
+ const headerSlot = (0, _reactUtilities.resolveShorthand)(header, {
48
+ required: true,
49
+ defaultProps: {
50
+ ref: headerRef,
51
+ id: !hasChildId.current ? referenceId : undefined
52
+ }
53
+ });
47
54
  _react.useEffect(()=>{
48
55
  var _headerRef_current;
49
56
  const headerId = !hasChildId.current ? (_headerRef_current = headerRef.current) === null || _headerRef_current === void 0 ? void 0 : _headerRef_current.id : undefined;
50
- const childWithId = getChildWithId(header);
57
+ const childWithId = getChildWithId(headerSlot === null || headerSlot === void 0 ? void 0 : headerSlot.children);
51
58
  hasChildId.current = Boolean(childWithId);
52
59
  setReferenceId(getReferenceId(headerId, childWithId, generatedId));
53
60
  }, [
54
61
  generatedId,
55
62
  header,
63
+ headerSlot,
56
64
  setReferenceId
57
65
  ]);
58
66
  return {
@@ -68,13 +76,7 @@ const useCardHeader_unstable = (props, ref)=>{
68
76
  ...props
69
77
  }),
70
78
  image: (0, _reactUtilities.resolveShorthand)(image),
71
- header: (0, _reactUtilities.resolveShorthand)(header, {
72
- required: true,
73
- defaultProps: {
74
- ref: headerRef,
75
- id: !hasChildId.current ? referenceId : undefined
76
- }
77
- }),
79
+ header: headerSlot,
78
80
  description: (0, _reactUtilities.resolveShorthand)(description),
79
81
  action: (0, _reactUtilities.resolveShorthand)(action)
80
82
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["useCardHeader.js"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, resolveShorthand, useId } from '@fluentui/react-utilities';\nimport { useCardContext_unstable } from '../Card/CardContext';\nimport { cardHeaderClassNames } from './useCardHeaderStyles.styles';\n/**\n * Finds the first child of CardHeader with an id prop.\n *\n * @param header - the header prop of CardHeader\n */ function getChildWithId(header) {\n function isReactElementWithIdProp(element) {\n return React.isValidElement(element) && Boolean(element.props.id);\n }\n return React.Children.toArray(header).find(isReactElementWithIdProp);\n}\n/**\n * Returns the id to use for the CardHeader root element.\n *\n * @param headerId - the id prop of the CardHeader component\n * @param childWithId - the first child of the CardHeader component with an id prop\n * @param generatedId - a generated id\n *\n * @returns the id to use for the CardHeader root element\n */ function getReferenceId(headerId, childWithId, generatedId) {\n if (headerId) {\n return headerId;\n }\n if (childWithId === null || childWithId === void 0 ? void 0 : childWithId.props.id) {\n return childWithId.props.id;\n }\n return generatedId;\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 */ export const useCardHeader_unstable = (props, ref)=>{\n const { image , header , description , action } = props;\n const { selectableA11yProps: { referenceId , setReferenceId } } = useCardContext_unstable();\n const headerRef = React.useRef(null);\n const hasChildId = React.useRef(false);\n const generatedId = useId(cardHeaderClassNames.header, referenceId);\n React.useEffect(()=>{\n var _headerRef_current;\n const headerId = !hasChildId.current ? (_headerRef_current = headerRef.current) === null || _headerRef_current === void 0 ? void 0 : _headerRef_current.id : undefined;\n const childWithId = getChildWithId(header);\n hasChildId.current = Boolean(childWithId);\n setReferenceId(getReferenceId(headerId, childWithId, generatedId));\n }, [\n generatedId,\n header,\n setReferenceId\n ]);\n return {\n components: {\n root: 'div',\n image: 'div',\n header: 'div',\n description: 'div',\n action: 'div'\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: !hasChildId.current ? referenceId : undefined\n }\n }),\n description: resolveShorthand(description),\n action: resolveShorthand(action)\n };\n};\n"],"names":["useCardHeader_unstable","getChildWithId","header","isReactElementWithIdProp","element","React","isValidElement","Boolean","props","id","Children","toArray","find","getReferenceId","headerId","childWithId","generatedId","ref","image","description","action","selectableA11yProps","referenceId","setReferenceId","useCardContext_unstable","headerRef","useRef","hasChildId","useId","cardHeaderClassNames","useEffect","_headerRef_current","current","undefined","components","root","getNativeElementProps","resolveShorthand","required","defaultProps"],"mappings":";;;;+BAu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QAAQQ;QAC7BQ,eAAeV,eAAeC,UAAUC,aAAaC;IACzD,GAAG;QACCA;QACAd;QACAqB;KACH;IACD,OAAO;QACHW,YAAY;YACRC,MAAM;YACNjB,OAAO;YACPhB,QAAQ;YACRiB,aAAa;YACbC,QAAQ;QACZ;QACAe,MAAMC,IAAAA,qCAAqB,EAAC,OAAO;YAC/BnB;YACA,GAAGT,KAAK;QACZ;QACAU,OAAOmB,IAAAA,gCAAgB,EAACnB;QACxBhB,QAAQmC,IAAAA,gCAAgB,EAACnC,QAAQ;YAC7BoC,UAAU,IAAI;YACdC,cAAc;gBACVtB,KAAKQ;gBACLhB,IAAI,CAACkB,WAAWK,OAAO,GAAGV,cAAcW,SAAS;YACrD;QACJ;QACAd,aAAakB,IAAAA,gCAAgB,EAAClB;QAC9BC,QAAQiB,IAAAA,gCAAgB,EAACjB;IAC7B;AACJ"}
1
+ {"version":3,"sources":["useCardHeader.js"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, resolveShorthand, useId } from '@fluentui/react-utilities';\nimport { useCardContext_unstable } from '../Card/CardContext';\nimport { cardHeaderClassNames } from './useCardHeaderStyles.styles';\n/**\n * Finds the first child of CardHeader with an id prop.\n *\n * @param header - the header prop of CardHeader\n */ function getChildWithId(header) {\n function isReactElementWithIdProp(element) {\n return React.isValidElement(element) && Boolean(element.props.id);\n }\n return React.Children.toArray(header).find(isReactElementWithIdProp);\n}\n/**\n * Returns the id to use for the CardHeader root element.\n *\n * @param headerId - the id prop of the CardHeader component\n * @param childWithId - the first child of the CardHeader component with an id prop\n * @param generatedId - a generated id\n *\n * @returns the id to use for the CardHeader root element\n */ function getReferenceId(headerId, childWithId, generatedId) {\n if (headerId) {\n return headerId;\n }\n if (childWithId === null || childWithId === void 0 ? void 0 : childWithId.props.id) {\n return childWithId.props.id;\n }\n return generatedId;\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 */ export const useCardHeader_unstable = (props, ref)=>{\n const { image , header , description , action } = props;\n const { selectableA11yProps: { referenceId , setReferenceId } } = useCardContext_unstable();\n const headerRef = React.useRef(null);\n const hasChildId = React.useRef(false);\n const generatedId = useId(cardHeaderClassNames.header, referenceId);\n const headerSlot = resolveShorthand(header, {\n required: true,\n defaultProps: {\n ref: headerRef,\n id: !hasChildId.current ? referenceId : undefined\n }\n });\n React.useEffect(()=>{\n var _headerRef_current;\n const headerId = !hasChildId.current ? (_headerRef_current = headerRef.current) === null || _headerRef_current === void 0 ? void 0 : _headerRef_current.id : undefined;\n const childWithId = getChildWithId(headerSlot === null || headerSlot === void 0 ? void 0 : headerSlot.children);\n hasChildId.current = Boolean(childWithId);\n setReferenceId(getReferenceId(headerId, childWithId, generatedId));\n }, [\n generatedId,\n header,\n headerSlot,\n setReferenceId\n ]);\n return {\n components: {\n root: 'div',\n image: 'div',\n header: 'div',\n description: 'div',\n action: 'div'\n },\n root: getNativeElementProps('div', {\n ref,\n ...props\n }),\n image: resolveShorthand(image),\n header: headerSlot,\n description: resolveShorthand(description),\n action: resolveShorthand(action)\n };\n};\n"],"names":["useCardHeader_unstable","getChildWithId","header","isReactElementWithIdProp","element","React","isValidElement","Boolean","props","id","Children","toArray","find","getReferenceId","headerId","childWithId","generatedId","ref","image","description","action","selectableA11yProps","referenceId","setReferenceId","useCardContext_unstable","headerRef","useRef","hasChildId","useId","cardHeaderClassNames","headerSlot","resolveShorthand","required","defaultProps","current","undefined","useEffect","_headerRef_current","children","components","root","getNativeElementProps"],"mappings":";;;;+BAuCiBA;;aAAAA;;;6DAvCM;gCACwC;6BACvB;2CACH;AACrC;;;;CAIC,GAAG,SAASC,eAAeC,MAAM,EAAE;IAChC,SAASC,yBAAyBC,OAAO,EAAE;QACvC,qBAAOC,OAAMC,cAAc,CAACF,YAAYG,QAAQH,QAAQI,KAAK,CAACC,EAAE;IAC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Q;QAC9GX,WAAWO,OAAO,GAAG3B,QAAQQ;QAC7BQ,eAAeV,eAAeC,UAAUC,aAAaC;IACzD,GAAG;QACCA;QACAd;QACA4B;QACAP;KACH;IACD,OAAO;QACHgB,YAAY;YACRC,MAAM;YACNtB,OAAO;YACPhB,QAAQ;YACRiB,aAAa;YACbC,QAAQ;QACZ;QACAoB,MAAMC,IAAAA,qCAAqB,EAAC,OAAO;YAC/BxB;YACA,GAAGT,KAAK;QACZ;QACAU,OAAOa,IAAAA,gCAAgB,EAACb;QACxBhB,QAAQ4B;QACRX,aAAaY,IAAAA,gCAAgB,EAACZ;QAC9BC,QAAQW,IAAAA,gCAAgB,EAACX;IAC7B;AACJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-card",
3
- "version": "9.0.21",
3
+ "version": "9.0.22",
4
4
  "private": false,
5
5
  "description": "Card container components for Fluent UI React.",
6
6
  "main": "lib-commonjs/index.js",
@@ -30,9 +30,9 @@
30
30
  },
31
31
  "devDependencies": {
32
32
  "@fluentui/eslint-plugin": "*",
33
- "@fluentui/react-conformance-griffel": "9.0.0",
33
+ "@fluentui/react-conformance-griffel": "*",
34
34
  "@fluentui/react-conformance": "*",
35
- "@fluentui/react-button": "^9.3.23",
35
+ "@fluentui/react-button": "*",
36
36
  "@fluentui/scripts-api-extractor": "*",
37
37
  "@fluentui/scripts-cypress": "*",
38
38
  "@fluentui/scripts-tasks": "*"