@fluentui/react-card 0.0.0-nightly-20230807-0415.1 → 0.0.0-nightly-20230808-0415.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/CHANGELOG.json +19 -19
  2. package/CHANGELOG.md +12 -12
  3. package/lib/components/Card/renderCard.js +4 -4
  4. package/lib/components/Card/renderCard.js.map +1 -1
  5. package/lib/components/Card/useCard.js +4 -2
  6. package/lib/components/Card/useCard.js.map +1 -1
  7. package/lib/components/Card/useCardSelectable.js +7 -5
  8. package/lib/components/Card/useCardSelectable.js.map +1 -1
  9. package/lib/components/CardFooter/renderCardFooter.js +3 -3
  10. package/lib/components/CardFooter/renderCardFooter.js.map +1 -1
  11. package/lib/components/CardFooter/useCardFooter.js +7 -3
  12. package/lib/components/CardFooter/useCardFooter.js.map +1 -1
  13. package/lib/components/CardHeader/renderCardHeader.js +3 -3
  14. package/lib/components/CardHeader/renderCardHeader.js.map +1 -1
  15. package/lib/components/CardHeader/useCardHeader.js +17 -8
  16. package/lib/components/CardHeader/useCardHeader.js.map +1 -1
  17. package/lib/components/CardPreview/renderCardPreview.js +3 -3
  18. package/lib/components/CardPreview/renderCardPreview.js.map +1 -1
  19. package/lib/components/CardPreview/useCardPreview.js +7 -3
  20. package/lib/components/CardPreview/useCardPreview.js.map +1 -1
  21. package/lib-commonjs/components/Card/renderCard.js +3 -3
  22. package/lib-commonjs/components/Card/renderCard.js.map +1 -1
  23. package/lib-commonjs/components/Card/useCard.js +3 -1
  24. package/lib-commonjs/components/Card/useCard.js.map +1 -1
  25. package/lib-commonjs/components/Card/useCardSelectable.js +6 -4
  26. package/lib-commonjs/components/Card/useCardSelectable.js.map +1 -1
  27. package/lib-commonjs/components/CardFooter/renderCardFooter.js +2 -2
  28. package/lib-commonjs/components/CardFooter/renderCardFooter.js.map +1 -1
  29. package/lib-commonjs/components/CardFooter/useCardFooter.js +6 -2
  30. package/lib-commonjs/components/CardFooter/useCardFooter.js.map +1 -1
  31. package/lib-commonjs/components/CardHeader/renderCardHeader.js +2 -2
  32. package/lib-commonjs/components/CardHeader/renderCardHeader.js.map +1 -1
  33. package/lib-commonjs/components/CardHeader/useCardHeader.js +16 -7
  34. package/lib-commonjs/components/CardHeader/useCardHeader.js.map +1 -1
  35. package/lib-commonjs/components/CardPreview/renderCardPreview.js +2 -2
  36. package/lib-commonjs/components/CardPreview/renderCardPreview.js.map +1 -1
  37. package/lib-commonjs/components/CardPreview/useCardPreview.js +6 -2
  38. package/lib-commonjs/components/CardPreview/useCardPreview.js.map +1 -1
  39. package/package.json +9 -9
package/CHANGELOG.json CHANGED
@@ -2,9 +2,9 @@
2
2
  "name": "@fluentui/react-card",
3
3
  "entries": [
4
4
  {
5
- "date": "Mon, 07 Aug 2023 04:22:28 GMT",
6
- "tag": "@fluentui/react-card_v0.0.0-nightly-20230807-0415.1",
7
- "version": "0.0.0-nightly-20230807-0415.1",
5
+ "date": "Tue, 08 Aug 2023 04:22:18 GMT",
6
+ "tag": "@fluentui/react-card_v0.0.0-nightly-20230808-0415.1",
7
+ "version": "0.0.0-nightly-20230808-0415.1",
8
8
  "comments": {
9
9
  "prerelease": [
10
10
  {
@@ -16,50 +16,50 @@
16
16
  {
17
17
  "author": "beachball",
18
18
  "package": "@fluentui/react-card",
19
- "comment": "Bump @fluentui/keyboard-keys to v0.0.0-nightly-20230807-0415.1",
20
- "commit": "272d9efb55a09fdcdf1014ff7075d14e312e31e7"
19
+ "comment": "Bump @fluentui/keyboard-keys to v0.0.0-nightly-20230808-0415.1",
20
+ "commit": "307bdb0a82868b26dbcb9a7aa2318bda66c1cd64"
21
21
  },
22
22
  {
23
23
  "author": "beachball",
24
24
  "package": "@fluentui/react-card",
25
- "comment": "Bump @fluentui/react-tabster to v0.0.0-nightly-20230807-0415.1",
26
- "commit": "272d9efb55a09fdcdf1014ff7075d14e312e31e7"
25
+ "comment": "Bump @fluentui/react-tabster to v0.0.0-nightly-20230808-0415.1",
26
+ "commit": "307bdb0a82868b26dbcb9a7aa2318bda66c1cd64"
27
27
  },
28
28
  {
29
29
  "author": "beachball",
30
30
  "package": "@fluentui/react-card",
31
- "comment": "Bump @fluentui/react-theme to v0.0.0-nightly-20230807-0415.1",
32
- "commit": "272d9efb55a09fdcdf1014ff7075d14e312e31e7"
31
+ "comment": "Bump @fluentui/react-theme to v0.0.0-nightly-20230808-0415.1",
32
+ "commit": "307bdb0a82868b26dbcb9a7aa2318bda66c1cd64"
33
33
  },
34
34
  {
35
35
  "author": "beachball",
36
36
  "package": "@fluentui/react-card",
37
- "comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-20230807-0415.1",
38
- "commit": "272d9efb55a09fdcdf1014ff7075d14e312e31e7"
37
+ "comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-20230808-0415.1",
38
+ "commit": "307bdb0a82868b26dbcb9a7aa2318bda66c1cd64"
39
39
  },
40
40
  {
41
41
  "author": "beachball",
42
42
  "package": "@fluentui/react-card",
43
- "comment": "Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-20230807-0415.1",
44
- "commit": "272d9efb55a09fdcdf1014ff7075d14e312e31e7"
43
+ "comment": "Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-20230808-0415.1",
44
+ "commit": "307bdb0a82868b26dbcb9a7aa2318bda66c1cd64"
45
45
  },
46
46
  {
47
47
  "author": "beachball",
48
48
  "package": "@fluentui/react-card",
49
- "comment": "Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20230807-0415.1",
50
- "commit": "272d9efb55a09fdcdf1014ff7075d14e312e31e7"
49
+ "comment": "Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20230808-0415.1",
50
+ "commit": "307bdb0a82868b26dbcb9a7aa2318bda66c1cd64"
51
51
  },
52
52
  {
53
53
  "author": "beachball",
54
54
  "package": "@fluentui/react-card",
55
- "comment": "Bump @fluentui/react-conformance to v0.0.0-nightly-20230807-0415.1",
56
- "commit": "272d9efb55a09fdcdf1014ff7075d14e312e31e7"
55
+ "comment": "Bump @fluentui/react-conformance to v0.0.0-nightly-20230808-0415.1",
56
+ "commit": "307bdb0a82868b26dbcb9a7aa2318bda66c1cd64"
57
57
  },
58
58
  {
59
59
  "author": "beachball",
60
60
  "package": "@fluentui/react-card",
61
- "comment": "Bump @fluentui/react-button to v0.0.0-nightly-20230807-0415.1",
62
- "commit": "272d9efb55a09fdcdf1014ff7075d14e312e31e7"
61
+ "comment": "Bump @fluentui/react-button to v0.0.0-nightly-20230808-0415.1",
62
+ "commit": "307bdb0a82868b26dbcb9a7aa2318bda66c1cd64"
63
63
  }
64
64
  ]
65
65
  }
package/CHANGELOG.md CHANGED
@@ -1,25 +1,25 @@
1
1
  # Change Log - @fluentui/react-card
2
2
 
3
- This log was last generated on Mon, 07 Aug 2023 04:22:28 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 08 Aug 2023 04:22:18 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## [0.0.0-nightly-20230807-0415.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-card_v0.0.0-nightly-20230807-0415.1)
7
+ ## [0.0.0-nightly-20230808-0415.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-card_v0.0.0-nightly-20230808-0415.1)
8
8
 
9
- Mon, 07 Aug 2023 04:22:28 GMT
10
- [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-card_v9.0.26..@fluentui/react-card_v0.0.0-nightly-20230807-0415.1)
9
+ Tue, 08 Aug 2023 04:22:18 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-card_v9.0.26..@fluentui/react-card_v0.0.0-nightly-20230808-0415.1)
11
11
 
12
12
  ### Changes
13
13
 
14
14
  - Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/not available) by fluentui-internal@service.microsoft.com)
15
- - Bump @fluentui/keyboard-keys to v0.0.0-nightly-20230807-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/272d9efb55a09fdcdf1014ff7075d14e312e31e7) by beachball)
16
- - Bump @fluentui/react-tabster to v0.0.0-nightly-20230807-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/272d9efb55a09fdcdf1014ff7075d14e312e31e7) by beachball)
17
- - Bump @fluentui/react-theme to v0.0.0-nightly-20230807-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/272d9efb55a09fdcdf1014ff7075d14e312e31e7) by beachball)
18
- - Bump @fluentui/react-utilities to v0.0.0-nightly-20230807-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/272d9efb55a09fdcdf1014ff7075d14e312e31e7) by beachball)
19
- - Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-20230807-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/272d9efb55a09fdcdf1014ff7075d14e312e31e7) by beachball)
20
- - Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20230807-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/272d9efb55a09fdcdf1014ff7075d14e312e31e7) by beachball)
21
- - Bump @fluentui/react-conformance to v0.0.0-nightly-20230807-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/272d9efb55a09fdcdf1014ff7075d14e312e31e7) by beachball)
22
- - Bump @fluentui/react-button to v0.0.0-nightly-20230807-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/272d9efb55a09fdcdf1014ff7075d14e312e31e7) by beachball)
15
+ - Bump @fluentui/keyboard-keys to v0.0.0-nightly-20230808-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/307bdb0a82868b26dbcb9a7aa2318bda66c1cd64) by beachball)
16
+ - Bump @fluentui/react-tabster to v0.0.0-nightly-20230808-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/307bdb0a82868b26dbcb9a7aa2318bda66c1cd64) by beachball)
17
+ - Bump @fluentui/react-theme to v0.0.0-nightly-20230808-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/307bdb0a82868b26dbcb9a7aa2318bda66c1cd64) by beachball)
18
+ - Bump @fluentui/react-utilities to v0.0.0-nightly-20230808-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/307bdb0a82868b26dbcb9a7aa2318bda66c1cd64) by beachball)
19
+ - Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-20230808-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/307bdb0a82868b26dbcb9a7aa2318bda66c1cd64) by beachball)
20
+ - Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20230808-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/307bdb0a82868b26dbcb9a7aa2318bda66c1cd64) by beachball)
21
+ - Bump @fluentui/react-conformance to v0.0.0-nightly-20230808-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/307bdb0a82868b26dbcb9a7aa2318bda66c1cd64) by beachball)
22
+ - Bump @fluentui/react-button to v0.0.0-nightly-20230808-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/307bdb0a82868b26dbcb9a7aa2318bda66c1cd64) by beachball)
23
23
 
24
24
  ## [9.0.26](https://github.com/microsoft/fluentui/tree/@fluentui/react-card_v9.0.26)
25
25
 
@@ -1,11 +1,11 @@
1
1
  /** @jsxRuntime classic */ /** @jsx createElement */ import { createElement } from '@fluentui/react-jsx-runtime';
2
- import { getSlotsNext } from '@fluentui/react-utilities';
2
+ import { assertSlots } from '@fluentui/react-utilities';
3
3
  import { CardProvider } from './CardContext';
4
4
  /**
5
5
  * Render the final JSX of Card.
6
6
  */ export const renderCard_unstable = (state, cardContextValue)=>{
7
- const { slots , slotProps } = getSlotsNext(state);
8
- return /*#__PURE__*/ createElement(slots.root, slotProps.root, /*#__PURE__*/ createElement(CardProvider, {
7
+ assertSlots(state);
8
+ return /*#__PURE__*/ createElement(state.root, null, /*#__PURE__*/ createElement(CardProvider, {
9
9
  value: cardContextValue
10
- }, slots.checkbox ? /*#__PURE__*/ createElement(slots.checkbox, slotProps.checkbox) : null, slots.floatingAction ? /*#__PURE__*/ createElement(slots.floatingAction, slotProps.floatingAction) : null, slotProps.root.children));
10
+ }, state.checkbox ? /*#__PURE__*/ createElement(state.checkbox, null) : null, state.floatingAction ? /*#__PURE__*/ createElement(state.floatingAction, null) : null, state.root.children));
11
11
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["renderCard.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsx createElement */\n\nimport { createElement } from '@fluentui/react-jsx-runtime';\n\nimport { getSlotsNext } from '@fluentui/react-utilities';\nimport type { CardContextValue, CardSlots, CardState } from './Card.types';\nimport { CardProvider } from './CardContext';\n\n/**\n * Render the final JSX of Card.\n */\nexport const renderCard_unstable = (state: CardState, cardContextValue: CardContextValue) => {\n const { slots, slotProps } = getSlotsNext<CardSlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n <CardProvider value={cardContextValue}>\n {slots.checkbox ? <slots.checkbox {...slotProps.checkbox} /> : null}\n {slots.floatingAction ? <slots.floatingAction {...slotProps.floatingAction} /> : null}\n {slotProps.root.children}\n </CardProvider>\n </slots.root>\n );\n};\n"],"names":["createElement","getSlotsNext","CardProvider","renderCard_unstable","state","cardContextValue","slots","slotProps","root","value","checkbox","floatingAction","children"],"mappings":"AAAA,wBAAwB,GACxB,uBAAuB,GAEvB,SAASA,aAAa,QAAQ,8BAA8B;AAE5D,SAASC,YAAY,QAAQ,4BAA4B;AAEzD,SAASC,YAAY,QAAQ,gBAAgB;AAE7C;;CAEC,GACD,OAAO,MAAMC,sBAAsB,CAACC,OAAkBC,mBAAuC;IAC3F,MAAM,EAAEC,MAAK,EAAEC,UAAS,EAAE,GAAGN,aAAwBG;IAErD,qBACE,AAfJ,cAeKE,MAAME,IAAI,EAAKD,UAAUC,IAAI,gBAC5B,AAhBN,cAgBON;QAAaO,OAAOJ;OAClBC,MAAMI,QAAQ,iBAAG,AAjB1B,cAiB2BJ,MAAMI,QAAQ,EAAKH,UAAUG,QAAQ,IAAO,IAAI,EAClEJ,MAAMK,cAAc,iBAAG,AAlBhC,cAkBiCL,MAAMK,cAAc,EAAKJ,UAAUI,cAAc,IAAO,IAAI,EACpFJ,UAAUC,IAAI,CAACI,QAAQ;AAIhC,EAAE"}
1
+ {"version":3,"sources":["renderCard.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsx createElement */\n\nimport { createElement } from '@fluentui/react-jsx-runtime';\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { CardContextValue, CardSlots, CardState } from './Card.types';\nimport { CardProvider } from './CardContext';\n\n/**\n * Render the final JSX of Card.\n */\nexport const renderCard_unstable = (state: CardState, cardContextValue: CardContextValue) => {\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":["createElement","assertSlots","CardProvider","renderCard_unstable","state","cardContextValue","root","value","checkbox","floatingAction","children"],"mappings":"AAAA,wBAAwB,GACxB,uBAAuB,GAEvB,SAASA,aAAa,QAAQ,8BAA8B;AAE5D,SAASC,WAAW,QAAQ,4BAA4B;AAExD,SAASC,YAAY,QAAQ,gBAAgB;AAE7C;;CAEC,GACD,OAAO,MAAMC,sBAAsB,CAACC,OAAkBC,mBAAuC;IAC3FJ,YAAuBG;IAEvB,qBACE,AAfJ,cAeKA,MAAME,IAAI,sBACT,AAhBN,cAgBOJ;QAAaK,OAAOF;OAClBD,MAAMI,QAAQ,iBAAG,AAjB1B,cAiB2BJ,MAAMI,QAAQ,UAAM,IAAI,EAC1CJ,MAAMK,cAAc,iBAAG,AAlBhC,cAkBiCL,MAAMK,cAAc,UAAM,IAAI,EACtDL,MAAME,IAAI,CAACI,QAAQ;AAI5B,EAAE"}
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { getNativeElementProps, useMergedRefs } from '@fluentui/react-utilities';
2
+ import { getNativeElementProps, useMergedRefs, slot } from '@fluentui/react-utilities';
3
3
  import { useFocusableGroup, useFocusWithin } from '@fluentui/react-tabster';
4
4
  import { useCardSelectable } from './useCardSelectable';
5
5
  import { cardContextDefaultValue } from './CardContext';
@@ -79,12 +79,14 @@ const focusMap = {
79
79
  floatingAction: 'div',
80
80
  checkbox: 'input'
81
81
  },
82
- root: getNativeElementProps('div', {
82
+ root: slot.always(getNativeElementProps('div', {
83
83
  ref: cardRef,
84
84
  role: 'group',
85
85
  ...focusAttributes,
86
86
  ...props,
87
87
  ...selectableCardProps
88
+ }), {
89
+ elementType: 'div'
88
90
  }),
89
91
  floatingAction: floatingActionSlot,
90
92
  checkbox: checkboxSlot
@@ -1 +1 @@
1
- {"version":3,"sources":["useCard.ts"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, useMergedRefs } 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 = 'off', ...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 const groupperAttrs = useFocusableGroup({\n tabBehavior: focusMap[interactive ? 'no-tab' : focusMode],\n });\n\n const interactiveFocusAttributes = {\n ...groupperAttrs,\n tabIndex: 0,\n };\n\n return {\n interactive,\n focusAttributes: focusMode === 'off' ? null : interactiveFocusAttributes,\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' } = 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 return {\n appearance,\n orientation,\n size,\n interactive,\n selectable,\n selectFocused,\n selected,\n selectableA11yProps: {\n setReferenceId,\n referenceId,\n referenceLabel,\n setReferenceLabel,\n },\n\n components: {\n root: 'div',\n floatingAction: 'div',\n checkbox: 'input',\n },\n\n root: getNativeElementProps('div', {\n ref: cardRef,\n role: 'group',\n ...focusAttributes,\n ...props,\n ...selectableCardProps,\n }),\n\n floatingAction: floatingActionSlot,\n checkbox: checkboxSlot,\n };\n};\n"],"names":["React","getNativeElementProps","useMergedRefs","useFocusableGroup","useFocusWithin","useCardSelectable","cardContextDefaultValue","focusMap","off","undefined","useCardInteractive","focusMode","props","interactive","some","prop","groupperAttrs","tabBehavior","interactiveFocusAttributes","tabIndex","focusAttributes","useCard_unstable","ref","appearance","orientation","size","referenceId","setReferenceId","useState","selectableA11yProps","referenceLabel","setReferenceLabel","cardBaseRef","selectable","selected","selectableCardProps","selectFocused","checkboxSlot","floatingActionSlot","cardRef","components","root","floatingAction","checkbox","role"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,EAAEC,aAAa,QAAQ,4BAA4B;AACjF,SAASC,iB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gBAAe,EAAE,GAAGV,mBAAmBE;IAE5D,OAAO;QACLW;QACAC;QACAC;QACAZ;QACAoB;QACAG;QACAF;QACAL,qBAAqB;YACnBF;YACAD;YACAI;YACAC;QACF;QAEAS,YAAY;YACVC,MAAM;YACNC,gBAAgB;YAChBC,UAAU;QACZ;QAEAF,MAAMxC,sBAAsB,OAAO;YACjCqB,KAAKiB;YACLK,MAAM;YACN,GAAGxB,eAAe;YAClB,GAAGR,KAAK;YACR,GAAGuB,mBAAmB;QACxB;QAEAO,gBAAgBJ;QAChBK,UAAUN;IACZ;AACF,EAAE"}
1
+ {"version":3,"sources":["useCard.ts"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, 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 = 'off', ...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 const groupperAttrs = useFocusableGroup({\n tabBehavior: focusMap[interactive ? 'no-tab' : focusMode],\n });\n\n const interactiveFocusAttributes = {\n ...groupperAttrs,\n tabIndex: 0,\n };\n\n return {\n interactive,\n focusAttributes: focusMode === 'off' ? null : interactiveFocusAttributes,\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' } = 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 return {\n appearance,\n orientation,\n size,\n interactive,\n selectable,\n selectFocused,\n selected,\n selectableA11yProps: {\n setReferenceId,\n referenceId,\n referenceLabel,\n setReferenceLabel,\n },\n\n components: {\n root: 'div',\n floatingAction: 'div',\n checkbox: 'input',\n },\n\n root: slot.always(\n getNativeElementProps('div', {\n ref: cardRef,\n role: 'group',\n ...focusAttributes,\n ...props,\n ...selectableCardProps,\n }),\n { elementType: 'div' },\n ),\n\n floatingAction: floatingActionSlot,\n checkbox: checkboxSlot,\n };\n};\n"],"names":["React","getNativeElementProps","useMergedRefs","slot","useFocusableGroup","useFocusWithin","useCardSelectable","cardContextDefaultValue","focusMap","off","undefined","useCardInteractive","focusMode","props","interactive","some","prop","groupperAttrs","tabBehavior","interactiveFocusAttributes","tabIndex","focusAttributes","useCard_unstable","ref","appearance","orientation","size","referenceId","setReferenceId","useState","selectableA11yProps","referenceLabel","setReferenceLabel","cardBaseRef","selectable","selected","selectableCardProps","selectFocused","checkboxSlot","floatingActionSlot","cardRef","components","root","floatingAction","checkbox","always","role","elementType"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,EAAEC,aAA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Ac+B,aAAaV;IAE3C,MAAM,EAAET,YAAW,EAAEO,gBAAe,EAAE,GAAGV,mBAAmBE;IAE5D,OAAO;QACLW;QACAC;QACAC;QACAZ;QACAoB;QACAG;QACAF;QACAL,qBAAqB;YACnBF;YACAD;YACAI;YACAC;QACF;QAEAS,YAAY;YACVC,MAAM;YACNC,gBAAgB;YAChBC,UAAU;QACZ;QAEAF,MAAMvC,KAAK0C,MAAM,CACf5C,sBAAsB,OAAO;YAC3BsB,KAAKiB;YACLM,MAAM;YACN,GAAGzB,eAAe;YAClB,GAAGR,KAAK;YACR,GAAGuB,mBAAmB;QACxB,IACA;YAAEW,aAAa;QAAM;QAGvBJ,gBAAgBJ;QAChBK,UAAUN;IACZ;AACF,EAAE"}
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { mergeCallbacks, resolveShorthand } from '@fluentui/react-utilities';
2
+ import { mergeCallbacks, slot } from '@fluentui/react-utilities';
3
3
  import { Enter } from '@fluentui/keyboard-keys';
4
4
  import { useFocusFinders } from '@fluentui/react-tabster';
5
5
  /**
@@ -73,7 +73,7 @@ import { useFocusFinders } from '@fluentui/react-tabster';
73
73
  } else if (referenceLabel) {
74
74
  selectableCheckboxProps['aria-label'] = referenceLabel;
75
75
  }
76
- return resolveShorthand(checkbox, {
76
+ return slot.optional(checkbox, {
77
77
  defaultProps: {
78
78
  ref: checkboxRef,
79
79
  type: 'checkbox',
@@ -82,7 +82,8 @@ import { useFocusFinders } from '@fluentui/react-tabster';
82
82
  onFocus: ()=>setIsSelectFocused(true),
83
83
  onBlur: ()=>setIsSelectFocused(false),
84
84
  ...selectableCheckboxProps
85
- }
85
+ },
86
+ elementType: 'input'
86
87
  });
87
88
  }, [
88
89
  checkbox,
@@ -97,10 +98,11 @@ import { useFocusFinders } from '@fluentui/react-tabster';
97
98
  if (!floatingAction) {
98
99
  return;
99
100
  }
100
- return resolveShorthand(floatingAction, {
101
+ return slot.optional(floatingAction, {
101
102
  defaultProps: {
102
103
  ref: checkboxRef
103
- }
104
+ },
105
+ elementType: 'div'
104
106
  });
105
107
  }, [
106
108
  floatingAction
@@ -1 +1 @@
1
- {"version":3,"sources":["useCardSelectable.ts"],"sourcesContent":["import * as React from 'react';\nimport { mergeCallbacks, resolveShorthand } from '@fluentui/react-utilities';\nimport { Enter } from '@fluentui/keyboard-keys';\nimport { useFocusFinders } from '@fluentui/react-tabster';\n\nimport type { CardContextValue, CardOnSelectionChangeEvent, CardProps, CardSlots } from './Card.types';\n\n/**\n * @internal\n *\n * Create the state related to selectable cards.\n *\n * This internal hook controls all the logic for selectable cards and is\n * intended to be used alongside with useCard_unstable.\n *\n * @param props - props from this instance of Card\n * @param a11yProps - accessibility props shared between elements of the card\n * @param ref - reference to the root element of Card\n */\nexport const useCardSelectable = (\n props: CardProps,\n { referenceLabel, referenceId }: Pick<CardContextValue['selectableA11yProps'], 'referenceId' | 'referenceLabel'>,\n cardRef: React.RefObject<HTMLDivElement>,\n) => {\n const { checkbox = {}, selected, defaultSelected, onSelectionChange, floatingAction, onClick, onKeyDown } = props;\n\n const { findAllFocusable } = useFocusFinders();\n\n const checkboxRef = React.useRef<HTMLInputElement>(null);\n\n const isSelectable = [selected, defaultSelected, onSelectionChange].some(prop => typeof prop !== 'undefined');\n\n const [isCardSelected, setIsCardSelected] = React.useState(false);\n const [isSelectFocused, setIsSelectFocused] = React.useState(false);\n\n const shouldRestrictTriggerAction = React.useCallback(\n (event: CardOnSelectionChangeEvent) => {\n if (!cardRef.current) {\n return false;\n }\n\n const focusableElements = findAllFocusable(cardRef.current);\n const target = event.target as HTMLElement;\n const isElementInFocusableGroup = focusableElements.some(element => element.contains(target));\n const isCheckboxSlot = checkboxRef?.current === target;\n\n return isElementInFocusableGroup && !isCheckboxSlot;\n },\n [cardRef, findAllFocusable],\n );\n\n const onChangeHandler = React.useCallback(\n (event: CardOnSelectionChangeEvent) => {\n if (shouldRestrictTriggerAction(event)) {\n return;\n }\n\n const newCheckedValue = !isCardSelected;\n\n setIsCardSelected(newCheckedValue);\n\n if (onSelectionChange) {\n onSelectionChange(event, { selected: newCheckedValue });\n }\n },\n [onSelectionChange, isCardSelected, shouldRestrictTriggerAction],\n );\n\n const onKeyDownHandler = React.useCallback(\n (event: React.KeyboardEvent<HTMLElement>) => {\n if ([Enter].includes(event.key)) {\n event.preventDefault();\n onChangeHandler(event);\n }\n },\n [onChangeHandler],\n );\n\n const checkboxSlot = React.useMemo(() => {\n if (!isSelectable || floatingAction) {\n return;\n }\n\n const selectableCheckboxProps: CardSlots['checkbox'] = {};\n\n if (referenceId) {\n selectableCheckboxProps['aria-labelledby'] = referenceId;\n } else if (referenceLabel) {\n selectableCheckboxProps['aria-label'] = referenceLabel;\n }\n\n return resolveShorthand(checkbox, {\n defaultProps: {\n ref: checkboxRef,\n type: 'checkbox',\n checked: isCardSelected,\n onChange: (event: React.ChangeEvent<HTMLInputElement>) => onChangeHandler(event),\n onFocus: () => setIsSelectFocused(true),\n onBlur: () => setIsSelectFocused(false),\n ...selectableCheckboxProps,\n },\n });\n }, [checkbox, floatingAction, isCardSelected, isSelectable, onChangeHandler, referenceId, referenceLabel]);\n\n const floatingActionSlot = React.useMemo(() => {\n if (!floatingAction) {\n return;\n }\n\n return resolveShorthand(floatingAction, {\n defaultProps: {\n ref: checkboxRef,\n },\n });\n }, [floatingAction]);\n\n const selectableCardProps = React.useMemo(() => {\n if (!isSelectable) {\n return null;\n }\n\n return {\n onClick: mergeCallbacks(onClick, onChangeHandler),\n onKeyDown: mergeCallbacks(onKeyDown, onKeyDownHandler),\n };\n }, [isSelectable, onChangeHandler, onClick, onKeyDown, onKeyDownHandler]);\n\n React.useEffect(\n () => setIsCardSelected(Boolean(defaultSelected ?? selected)),\n [defaultSelected, selected, setIsCardSelected],\n );\n\n return {\n selected: isCardSelected,\n selectable: isSelectable,\n selectFocused: isSelectFocused,\n selectableCardProps,\n checkboxSlot,\n floatingActionSlot,\n };\n};\n"],"names":["React","mergeCallbacks","resolveShorthand","Enter","useFocusFinders","useCardSelectable","props","referenceLabel","referenceId","cardRef","checkbox","selected","defaultSelected","onSelectionChange","floatingAction","onClick","onKeyDown","findAllFocusable","checkboxRef","useRef","isSelectable","some","prop","isCardSelected","setIsCardSelected","useState","isSelectFocused","setIsSelectFocused","shouldRestrictTriggerAction","useCallback","event","current","focusableElements","target","isElementInFocusableGroup","element","contains","isCheckboxSlot","onChangeHandler","newCheckedValue","onKeyDownHandler","includes","key","preventDefault","checkboxSlot","useMemo","selectableCheckboxProps","defaultProps","ref","type","checked","onChange","onFocus","onBlur","floatingActionSlot","selectableCardProps","useEffect","Boolean","selectable","selectFocused"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,cAAc,EAAEC,gBAAgB,QAAQ,4BAA4B;AAC7E,SAASC,KAAK,QAAQ,0BAA0B;AAChD,SAASC,eAAe,QAAQ,0BAA0B;AAI1D;;;;;;;;;;;CAWC,GACD,OAAO,MAAMC,oBAAoB,CAC/BC,OACA,EAAEC,eAAc,EAAEC,YAAW,EAAmF,EAChHC,UACG;IACH,MAAM,EAAEC,UAAW,CAAC,EAAC,EAAEC,SAAQ,EAAEC,gBAAe,EAAEC,kBAAiB,EAAEC,eAAc,EAAEC,QAAO,EAAEC,UAAS,EAAE,GAAGV;IAE5G,MAAM,EAAEW,iBAAgB,EAAE,GAAGb;IAE7B,MAAMc,cAAclB,MAAMmB,MAAM,CAAmB,IAAI;IAEvD,MAAMC,eAAe;QAACT;QAAUC;QAAiBC;KAAkB,CAACQ,IAAI,CAACC,CAAAA,OAAQ,OAAOA,SAAS;IAEjG,MAAM,CAACC,gBAAgBC,kBAAkB,GAAGxB,MAAMyB,QAAQ,CAAC,KAAK;IAChE,MAAM,CAACC,iBAAiBC,mBAAmB,GAAG3B,MAAMyB,QAAQ,CAAC,KAAK;IAElE,MAAMG,8BAA8B5B,MAAM6B,WAAW,CACnD,CAACC,QAAsC;QACrC,IAAI,CAACrB,QAAQsB,OAAO,EAAE;YACpB,OAAO,KAA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B,IAAI;gBACtC0B,QAAQ,IAAM1B,mBAAmB,KAAK;gBACtC,GAAGmB,uBAAuB;YAC5B;QACF;IACF,GAAG;QAACpC;QAAUI;QAAgBS;QAAgBH;QAAckB;QAAiB9B;QAAaD;KAAe;IAEzG,MAAM+C,qBAAqBtD,MAAM6C,OAAO,CAAC,IAAM;QAC7C,IAAI,CAAC/B,gBAAgB;YACnB;QACF,CAAC;QAED,OAAOZ,iBAAiBY,gBAAgB;YACtCiC,cAAc;gBACZC,KAAK9B;YACP;QACF;IACF,GAAG;QAACJ;KAAe;IAEnB,MAAMyC,sBAAsBvD,MAAM6C,OAAO,CAAC,IAAM;QAC9C,IAAI,CAACzB,cAAc;YACjB,OAAO,IAAI;QACb,CAAC;QAED,OAAO;YACLL,SAASd,eAAec,SAASuB;YACjCtB,WAAWf,eAAee,WAAWwB;QACvC;IACF,GAAG;QAACpB;QAAckB;QAAiBvB;QAASC;QAAWwB;KAAiB;IAExExC,MAAMwD,SAAS,CACb,IAAMhC,kBAAkBiC,QAAQ7C,4BAAAA,6BAAAA,kBAAmBD,QAAQ,IAC3D;QAACC;QAAiBD;QAAUa;KAAkB;IAGhD,OAAO;QACLb,UAAUY;QACVmC,YAAYtC;QACZuC,eAAejC;QACf6B;QACAX;QACAU;IACF;AACF,EAAE"}
1
+ {"version":3,"sources":["useCardSelectable.ts"],"sourcesContent":["import * as React from 'react';\nimport { mergeCallbacks, slot } from '@fluentui/react-utilities';\nimport { Enter } from '@fluentui/keyboard-keys';\nimport { useFocusFinders } from '@fluentui/react-tabster';\n\nimport type { CardContextValue, CardOnSelectionChangeEvent, CardProps, CardSlots } from './Card.types';\n\n/**\n * @internal\n *\n * Create the state related to selectable cards.\n *\n * This internal hook controls all the logic for selectable cards and is\n * intended to be used alongside with useCard_unstable.\n *\n * @param props - props from this instance of Card\n * @param a11yProps - accessibility props shared between elements of the card\n * @param ref - reference to the root element of Card\n */\nexport const useCardSelectable = (\n props: CardProps,\n { referenceLabel, referenceId }: Pick<CardContextValue['selectableA11yProps'], 'referenceId' | 'referenceLabel'>,\n cardRef: React.RefObject<HTMLDivElement>,\n) => {\n const { checkbox = {}, selected, defaultSelected, onSelectionChange, floatingAction, onClick, onKeyDown } = props;\n\n const { findAllFocusable } = useFocusFinders();\n\n const checkboxRef = React.useRef<HTMLInputElement>(null);\n\n const isSelectable = [selected, defaultSelected, onSelectionChange].some(prop => typeof prop !== 'undefined');\n\n const [isCardSelected, setIsCardSelected] = React.useState(false);\n const [isSelectFocused, setIsSelectFocused] = React.useState(false);\n\n const shouldRestrictTriggerAction = React.useCallback(\n (event: CardOnSelectionChangeEvent) => {\n if (!cardRef.current) {\n return false;\n }\n\n const focusableElements = findAllFocusable(cardRef.current);\n const target = event.target as HTMLElement;\n const isElementInFocusableGroup = focusableElements.some(element => element.contains(target));\n const isCheckboxSlot = checkboxRef?.current === target;\n\n return isElementInFocusableGroup && !isCheckboxSlot;\n },\n [cardRef, findAllFocusable],\n );\n\n const onChangeHandler = React.useCallback(\n (event: CardOnSelectionChangeEvent) => {\n if (shouldRestrictTriggerAction(event)) {\n return;\n }\n\n const newCheckedValue = !isCardSelected;\n\n setIsCardSelected(newCheckedValue);\n\n if (onSelectionChange) {\n onSelectionChange(event, { selected: newCheckedValue });\n }\n },\n [onSelectionChange, isCardSelected, shouldRestrictTriggerAction],\n );\n\n const onKeyDownHandler = React.useCallback(\n (event: React.KeyboardEvent<HTMLElement>) => {\n if ([Enter].includes(event.key)) {\n event.preventDefault();\n onChangeHandler(event);\n }\n },\n [onChangeHandler],\n );\n\n const checkboxSlot = React.useMemo(() => {\n if (!isSelectable || floatingAction) {\n return;\n }\n\n const selectableCheckboxProps: CardSlots['checkbox'] = {};\n\n if (referenceId) {\n selectableCheckboxProps['aria-labelledby'] = referenceId;\n } else if (referenceLabel) {\n selectableCheckboxProps['aria-label'] = referenceLabel;\n }\n\n return slot.optional(checkbox, {\n defaultProps: {\n ref: checkboxRef,\n type: 'checkbox',\n checked: isCardSelected,\n onChange: (event: React.ChangeEvent<HTMLInputElement>) => onChangeHandler(event),\n onFocus: () => setIsSelectFocused(true),\n onBlur: () => setIsSelectFocused(false),\n ...selectableCheckboxProps,\n },\n elementType: 'input',\n });\n }, [checkbox, floatingAction, isCardSelected, isSelectable, 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 (!isSelectable) {\n return null;\n }\n\n return {\n onClick: mergeCallbacks(onClick, onChangeHandler),\n onKeyDown: mergeCallbacks(onKeyDown, onKeyDownHandler),\n };\n }, [isSelectable, onChangeHandler, onClick, onKeyDown, onKeyDownHandler]);\n\n React.useEffect(\n () => setIsCardSelected(Boolean(defaultSelected ?? selected)),\n [defaultSelected, selected, setIsCardSelected],\n );\n\n return {\n selected: isCardSelected,\n selectable: isSelectable,\n selectFocused: isSelectFocused,\n selectableCardProps,\n checkboxSlot,\n floatingActionSlot,\n };\n};\n"],"names":["React","mergeCallbacks","slot","Enter","useFocusFinders","useCardSelectable","props","referenceLabel","referenceId","cardRef","checkbox","selected","defaultSelected","onSelectionChange","floatingAction","onClick","onKeyDown","findAllFocusable","checkboxRef","useRef","isSelectable","some","prop","isCardSelected","setIsCardSelected","useState","isSelectFocused","setIsSelectFocused","shouldRestrictTriggerAction","useCallback","event","current","focusableElements","target","isElementInFocusableGroup","element","contains","isCheckboxSlot","onChangeHandler","newCheckedValue","onKeyDownHandler","includes","key","preventDefault","checkboxSlot","useMemo","selectableCheckboxProps","optional","defaultProps","ref","type","checked","onChange","onFocus","onBlur","elementType","floatingActionSlot","selectableCardProps","useEffect","Boolean","selectable","selectFocused"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,cAAc,EAAEC,IAAI,QAAQ,4BAA4B;AACjE,SAASC,KAAK,QAAQ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AI;QACb,CAAC;QAED,OAAO;YACLL,SAASd,eAAec,SAASuB;YACjCtB,WAAWf,eAAee,WAAWwB;QACvC;IACF,GAAG;QAACpB;QAAckB;QAAiBvB;QAASC;QAAWwB;KAAiB;IAExExC,MAAM0D,SAAS,CACb,IAAMlC,kBAAkBmC,QAAQ/C,4BAAAA,6BAAAA,kBAAmBD,QAAQ,IAC3D;QAACC;QAAiBD;QAAUa;KAAkB;IAGhD,OAAO;QACLb,UAAUY;QACVqC,YAAYxC;QACZyC,eAAenC;QACf+B;QACAb;QACAY;IACF;AACF,EAAE"}
@@ -1,8 +1,8 @@
1
1
  /** @jsxRuntime classic */ /** @jsx createElement */ import { createElement } from '@fluentui/react-jsx-runtime';
2
- import { getSlotsNext } from '@fluentui/react-utilities';
2
+ import { assertSlots } from '@fluentui/react-utilities';
3
3
  /**
4
4
  * Render the final JSX of CardFooter.
5
5
  */ export const renderCardFooter_unstable = (state)=>{
6
- const { slots , slotProps } = getSlotsNext(state);
7
- return /*#__PURE__*/ createElement(slots.root, slotProps.root, slotProps.root.children, slots.action && /*#__PURE__*/ createElement(slots.action, slotProps.action));
6
+ assertSlots(state);
7
+ return /*#__PURE__*/ createElement(state.root, null, state.root.children, state.action && /*#__PURE__*/ createElement(state.action, null));
8
8
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["renderCardFooter.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsx createElement */\n\nimport { createElement } from '@fluentui/react-jsx-runtime';\n\nimport { getSlotsNext } from '@fluentui/react-utilities';\nimport type { CardFooterSlots, CardFooterState } from './CardFooter.types';\n\n/**\n * Render the final JSX of CardFooter.\n */\nexport const renderCardFooter_unstable = (state: CardFooterState) => {\n const { slots, slotProps } = getSlotsNext<CardFooterSlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n {slotProps.root.children}\n {slots.action && <slots.action {...slotProps.action} />}\n </slots.root>\n );\n};\n"],"names":["createElement","getSlotsNext","renderCardFooter_unstable","state","slots","slotProps","root","children","action"],"mappings":"AAAA,wBAAwB,GACxB,uBAAuB,GAEvB,SAASA,aAAa,QAAQ,8BAA8B;AAE5D,SAASC,YAAY,QAAQ,4BAA4B;AAGzD;;CAEC,GACD,OAAO,MAAMC,4BAA4B,CAACC,QAA2B;IACnE,MAAM,EAAEC,MAAK,EAAEC,UAAS,EAAE,GAAGJ,aAA8BE;IAE3D,qBACE,AAdJ,cAcKC,MAAME,IAAI,EAAKD,UAAUC,IAAI,EAC3BD,UAAUC,IAAI,CAACC,QAAQ,EACvBH,MAAMI,MAAM,kBAAI,AAhBvB,cAgBwBJ,MAAMI,MAAM,EAAKH,UAAUG,MAAM;AAGzD,EAAE"}
1
+ {"version":3,"sources":["renderCardFooter.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsx createElement */\n\nimport { createElement } from '@fluentui/react-jsx-runtime';\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { CardFooterSlots, CardFooterState } from './CardFooter.types';\n\n/**\n * Render the final JSX of CardFooter.\n */\nexport const renderCardFooter_unstable = (state: CardFooterState) => {\n 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":["createElement","assertSlots","renderCardFooter_unstable","state","root","children","action"],"mappings":"AAAA,wBAAwB,GACxB,uBAAuB,GAEvB,SAASA,aAAa,QAAQ,8BAA8B;AAE5D,SAASC,WAAW,QAAQ,4BAA4B;AAGxD;;CAEC,GACD,OAAO,MAAMC,4BAA4B,CAACC,QAA2B;IACnEF,YAA6BE;IAE7B,qBACE,AAdJ,cAcKA,MAAMC,IAAI,QACRD,MAAMC,IAAI,CAACC,QAAQ,EACnBF,MAAMG,MAAM,kBAAI,AAhBvB,cAgBwBH,MAAMG,MAAM;AAGpC,EAAE"}
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { getNativeElementProps, resolveShorthand } from '@fluentui/react-utilities';
2
+ import { getNativeElementProps, slot } from '@fluentui/react-utilities';
3
3
  /**
4
4
  * Create the state required to render CardFooter.
5
5
  *
@@ -15,10 +15,14 @@ import { getNativeElementProps, resolveShorthand } from '@fluentui/react-utiliti
15
15
  root: 'div',
16
16
  action: 'div'
17
17
  },
18
- root: getNativeElementProps('div', {
18
+ root: slot.always(getNativeElementProps('div', {
19
19
  ref,
20
20
  ...props
21
+ }), {
22
+ elementType: 'div'
21
23
  }),
22
- action: resolveShorthand(action)
24
+ action: slot.optional(action, {
25
+ elementType: 'div'
26
+ })
23
27
  };
24
28
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["useCardFooter.ts"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, resolveShorthand } from '@fluentui/react-utilities';\nimport type { CardFooterProps, CardFooterState } from './CardFooter.types';\n\n/**\n * Create the state required to render CardFooter.\n *\n * The returned state can be modified with hooks such as useCardFooterStyles_unstable,\n * before being passed to renderCardFooter_unstable.\n *\n * @param props - props from this instance of CardFooter\n * @param ref - reference to root HTMLElement of CardFooter\n */\nexport const useCardFooter_unstable = (props: CardFooterProps, ref: React.Ref<HTMLElement>): CardFooterState => {\n const { action } = props;\n\n return {\n components: {\n root: 'div',\n action: 'div',\n },\n\n root: getNativeElementProps('div', {\n ref,\n ...props,\n }),\n action: resolveShorthand(action),\n };\n};\n"],"names":["React","getNativeElementProps","resolveShorthand","useCardFooter_unstable","props","ref","action","components","root"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,EAAEC,gBAAgB,QAAQ,4BAA4B;AAGpF;;;;;;;;CAQC,GACD,OAAO,MAAMC,yBAAyB,CAACC,OAAwBC,MAAiD;IAC9G,MAAM,EAAEC,OAAM,EAAE,GAAGF;IAEnB,OAAO;QACLG,YAAY;YACVC,MAAM;YACNF,QAAQ;QACV;QAEAE,MAAMP,sBAAsB,OAAO;YACjCI;YACA,GAAGD,KAAK;QACV;QACAE,QAAQJ,iBAAiBI;IAC3B;AACF,EAAE"}
1
+ {"version":3,"sources":["useCardFooter.ts"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, slot } from '@fluentui/react-utilities';\nimport type { CardFooterProps, CardFooterState } from './CardFooter.types';\n\n/**\n * Create the state required to render CardFooter.\n *\n * The returned state can be modified with hooks such as useCardFooterStyles_unstable,\n * before being passed to renderCardFooter_unstable.\n *\n * @param props - props from this instance of CardFooter\n * @param ref - reference to root HTMLElement of CardFooter\n */\nexport const useCardFooter_unstable = (props: CardFooterProps, ref: React.Ref<HTMLElement>): CardFooterState => {\n const { action } = props;\n\n return {\n components: {\n root: 'div',\n action: 'div',\n },\n\n root: slot.always(\n getNativeElementProps('div', {\n ref,\n ...props,\n }),\n { elementType: 'div' },\n ),\n action: slot.optional(action, { elementType: 'div' }),\n };\n};\n"],"names":["React","getNativeElementProps","slot","useCardFooter_unstable","props","ref","action","components","root","always","elementType","optional"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,EAAEC,IAAI,QAAQ,4BAA4B;AAGxE;;;;;;;;CAQC,GACD,OAAO,MAAMC,yBAAyB,CAACC,OAAwBC,MAAiD;IAC9G,MAAM,EAAEC,OAAM,EAAE,GAAGF;IAEnB,OAAO;QACLG,YAAY;YACVC,MAAM;YACNF,QAAQ;QACV;QAEAE,MAAMN,KAAKO,MAAM,CACfR,sBAAsB,OAAO;YAC3BI;YACA,GAAGD,KAAK;QACV,IACA;YAAEM,aAAa;QAAM;QAEvBJ,QAAQJ,KAAKS,QAAQ,CAACL,QAAQ;YAAEI,aAAa;QAAM;IACrD;AACF,EAAE"}
@@ -1,8 +1,8 @@
1
1
  /** @jsxRuntime classic */ /** @jsx createElement */ import { createElement } from '@fluentui/react-jsx-runtime';
2
- import { getSlotsNext } from '@fluentui/react-utilities';
2
+ import { assertSlots } from '@fluentui/react-utilities';
3
3
  /**
4
4
  * Render the final JSX of CardHeader.
5
5
  */ export const renderCardHeader_unstable = (state)=>{
6
- const { slots , slotProps } = getSlotsNext(state);
7
- return /*#__PURE__*/ createElement(slots.root, slotProps.root, slots.image && /*#__PURE__*/ createElement(slots.image, slotProps.image), /*#__PURE__*/ createElement(slots.header, slotProps.header), slots.description && /*#__PURE__*/ createElement(slots.description, slotProps.description), slots.action && /*#__PURE__*/ createElement(slots.action, slotProps.action));
6
+ assertSlots(state);
7
+ return /*#__PURE__*/ createElement(state.root, null, state.image && /*#__PURE__*/ createElement(state.image, null), /*#__PURE__*/ createElement(state.header, null), state.description && /*#__PURE__*/ createElement(state.description, null), state.action && /*#__PURE__*/ createElement(state.action, null));
8
8
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["renderCardHeader.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsx createElement */\n\nimport { createElement } from '@fluentui/react-jsx-runtime';\n\nimport { getSlotsNext } from '@fluentui/react-utilities';\nimport type { CardHeaderSlots, CardHeaderState } from './CardHeader.types';\n\n/**\n * Render the final JSX of CardHeader.\n */\nexport const renderCardHeader_unstable = (state: CardHeaderState) => {\n const { slots, slotProps } = getSlotsNext<CardHeaderSlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n {slots.image && <slots.image {...slotProps.image} />}\n <slots.header {...slotProps.header} />\n {slots.description && <slots.description {...slotProps.description} />}\n {slots.action && <slots.action {...slotProps.action} />}\n </slots.root>\n );\n};\n"],"names":["createElement","getSlotsNext","renderCardHeader_unstable","state","slots","slotProps","root","image","header","description","action"],"mappings":"AAAA,wBAAwB,GACxB,uBAAuB,GAEvB,SAASA,aAAa,QAAQ,8BAA8B;AAE5D,SAASC,YAAY,QAAQ,4BAA4B;AAGzD;;CAEC,GACD,OAAO,MAAMC,4BAA4B,CAACC,QAA2B;IACnE,MAAM,EAAEC,MAAK,EAAEC,UAAS,EAAE,GAAGJ,aAA8BE;IAE3D,qBACE,AAdJ,cAcKC,MAAME,IAAI,EAAKD,UAAUC,IAAI,EAC3BF,MAAMG,KAAK,kBAAI,AAftB,cAeuBH,MAAMG,KAAK,EAAKF,UAAUE,KAAK,iBAChD,AAhBN,cAgBOH,MAAMI,MAAM,EAAKH,UAAUG,MAAM,GACjCJ,MAAMK,WAAW,kBAAI,AAjB5B,cAiB6BL,MAAMK,WAAW,EAAKJ,UAAUI,WAAW,GACjEL,MAAMM,MAAM,kBAAI,AAlBvB,cAkBwBN,MAAMM,MAAM,EAAKL,UAAUK,MAAM;AAGzD,EAAE"}
1
+ {"version":3,"sources":["renderCardHeader.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsx createElement */\n\nimport { createElement } from '@fluentui/react-jsx-runtime';\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { CardHeaderSlots, CardHeaderState } from './CardHeader.types';\n\n/**\n * Render the final JSX of CardHeader.\n */\nexport const renderCardHeader_unstable = (state: CardHeaderState) => {\n assertSlots<CardHeaderSlots>(state);\n\n return (\n <state.root>\n {state.image && <state.image />}\n <state.header />\n {state.description && <state.description />}\n {state.action && <state.action />}\n </state.root>\n );\n};\n"],"names":["createElement","assertSlots","renderCardHeader_unstable","state","root","image","header","description","action"],"mappings":"AAAA,wBAAwB,GACxB,uBAAuB,GAEvB,SAASA,aAAa,QAAQ,8BAA8B;AAE5D,SAASC,WAAW,QAAQ,4BAA4B;AAGxD;;CAEC,GACD,OAAO,MAAMC,4BAA4B,CAACC,QAA2B;IACnEF,YAA6BE;IAE7B,qBACE,AAdJ,cAcKA,MAAMC,IAAI,QACRD,MAAME,KAAK,kBAAI,AAftB,cAeuBF,MAAME,KAAK,uBAC5B,AAhBN,cAgBOF,MAAMG,MAAM,SACZH,MAAMI,WAAW,kBAAI,AAjB5B,cAiB6BJ,MAAMI,WAAW,SACvCJ,MAAMK,MAAM,kBAAI,AAlBvB,cAkBwBL,MAAMK,MAAM;AAGpC,EAAE"}
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { getNativeElementProps, resolveShorthand, useId } from '@fluentui/react-utilities';
2
+ import { getNativeElementProps, useId, slot } from '@fluentui/react-utilities';
3
3
  import { useCardContext_unstable } from '../Card/CardContext';
4
4
  import { cardHeaderClassNames } from './useCardHeaderStyles.styles';
5
5
  /**
@@ -43,12 +43,13 @@ 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,
46
+ const headerSlot = slot.optional(header, {
47
+ renderByDefault: true,
48
48
  defaultProps: {
49
49
  ref: headerRef,
50
50
  id: !hasChildId.current ? referenceId : undefined
51
- }
51
+ },
52
+ elementType: 'div'
52
53
  });
53
54
  React.useEffect(()=>{
54
55
  var _headerRef_current;
@@ -70,13 +71,21 @@ import { cardHeaderClassNames } from './useCardHeaderStyles.styles';
70
71
  description: 'div',
71
72
  action: 'div'
72
73
  },
73
- root: getNativeElementProps('div', {
74
+ root: slot.always(getNativeElementProps('div', {
74
75
  ref,
75
76
  ...props
77
+ }), {
78
+ elementType: 'div'
79
+ }),
80
+ image: slot.optional(image, {
81
+ elementType: 'div'
76
82
  }),
77
- image: resolveShorthand(image),
78
83
  header: headerSlot,
79
- description: resolveShorthand(description),
80
- action: resolveShorthand(action)
84
+ description: slot.optional(description, {
85
+ elementType: 'div'
86
+ }),
87
+ action: slot.optional(action, {
88
+ elementType: 'div'
89
+ })
81
90
  };
82
91
  };
@@ -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: 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"}
1
+ {"version":3,"sources":["useCardHeader.ts"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, useId, slot } 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 = slot.optional(header, {\n renderByDefault: true,\n defaultProps: {\n ref: headerRef,\n id: !hasChildId.current ? referenceId : undefined,\n },\n elementType: 'div',\n });\n React.useEffect(() => {\n const headerId = !hasChildId.current ? headerRef.current?.id : undefined;\n const childWithId = getChildWithId(headerSlot?.children);\n hasChildId.current = Boolean(childWithId);\n setReferenceId(getReferenceId(headerId, childWithId, generatedId));\n }, [generatedId, header, headerSlot, setReferenceId]);\n return {\n components: { root: 'div', image: 'div', header: 'div', description: 'div', action: 'div' },\n\n root: slot.always(\n getNativeElementProps('div', {\n ref,\n ...props,\n }),\n { elementType: 'div' },\n ),\n image: slot.optional(image, { elementType: 'div' }),\n header: headerSlot,\n description: slot.optional(description, { elementType: 'div' }),\n action: slot.optional(action, { elementType: 'div' }),\n };\n};\n"],"names":["React","getNativeElementProps","useId","slot","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","optional","renderByDefault","defaultProps","current","undefined","elementType","useEffect","children","components","root","always"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,EAAEC,KAAK,EAAEC,IAAI,QAAQ,4BAA4B;AAE/E,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,cAAclB,MAAMG,qBAAqBE,MAAM,EAAEoB;IAEvD,MAAMK,aAAa7B,KAAK8B,QAAQ,CAAC1B,QAAQ;QACvC2B,iBAAiB,IAAI;QACrBC,cAAc;YACZb,KAAKO;YACLhB,IAAI,CAACkB,WAAWK,OAAO,GAAGT,cAAcU,SAAS;QACnD;QACAC,aAAa;IACf;IACAtC,MAAMuC,SAAS,CAAC,IAAM;YACmBV;QAAvC,MAAMX,WAAW,CAACa,WAAWK,OAAO,GAAGP,CAAAA,qBAAAA,UAAUO,OAAO,cAAjBP,gCAAAA,KAAAA,IAAAA,mBAAmBhB,EAAE,GAAGwB,SAAS;QACxE,MAAMlB,cAAcb,eAAe0B,uBAAAA,wBAAAA,KAAAA,IAAAA,WAAYQ,QAAQ;QACvDT,WAAWK,OAAO,GAAGzB,QAAQQ;QAC7BS,eAAeX,eAAeC,UAAUC,aAAaC;IACvD,GAAG;QAACA;QAAab;QAAQyB;QAAYJ;KAAe;IACpD,OAAO;QACLa,YAAY;YAAEC,MAAM;YAAOnB,OAAO;YAAOhB,QAAQ;YAAOiB,aAAa;YAAOC,QAAQ;QAAM;QAE1FiB,MAAMvC,KAAKwC,MAAM,CACf1C,sBAAsB,OAAO;YAC3BqB;YACA,GAAGV,KAAK;QACV,IACA;YAAE0B,aAAa;QAAM;QAEvBf,OAAOpB,KAAK8B,QAAQ,CAACV,OAAO;YAAEe,aAAa;QAAM;QACjD/B,QAAQyB;QACRR,aAAarB,KAAK8B,QAAQ,CAACT,aAAa;YAAEc,aAAa;QAAM;QAC7Db,QAAQtB,KAAK8B,QAAQ,CAACR,QAAQ;YAAEa,aAAa;QAAM;IACrD;AACF,EAAE"}
@@ -1,8 +1,8 @@
1
1
  /** @jsxRuntime classic */ /** @jsx createElement */ import { createElement } from '@fluentui/react-jsx-runtime';
2
- import { getSlotsNext } from '@fluentui/react-utilities';
2
+ import { assertSlots } from '@fluentui/react-utilities';
3
3
  /**
4
4
  * Render the final JSX of CardPreview.
5
5
  */ export const renderCardPreview_unstable = (state)=>{
6
- const { slots , slotProps } = getSlotsNext(state);
7
- return /*#__PURE__*/ createElement(slots.root, slotProps.root, slotProps.root.children, slots.logo && /*#__PURE__*/ createElement(slots.logo, slotProps.logo));
6
+ assertSlots(state);
7
+ return /*#__PURE__*/ createElement(state.root, null, state.root.children, state.logo && /*#__PURE__*/ createElement(state.logo, null));
8
8
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["renderCardPreview.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsx createElement */\n\nimport { createElement } from '@fluentui/react-jsx-runtime';\n\nimport { getSlotsNext } from '@fluentui/react-utilities';\nimport type { CardPreviewSlots, CardPreviewState } from './CardPreview.types';\n\n/**\n * Render the final JSX of CardPreview.\n */\nexport const renderCardPreview_unstable = (state: CardPreviewState) => {\n const { slots, slotProps } = getSlotsNext<CardPreviewSlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n {slotProps.root.children}\n {slots.logo && <slots.logo {...slotProps.logo} />}\n </slots.root>\n );\n};\n"],"names":["createElement","getSlotsNext","renderCardPreview_unstable","state","slots","slotProps","root","children","logo"],"mappings":"AAAA,wBAAwB,GACxB,uBAAuB,GAEvB,SAASA,aAAa,QAAQ,8BAA8B;AAE5D,SAASC,YAAY,QAAQ,4BAA4B;AAGzD;;CAEC,GACD,OAAO,MAAMC,6BAA6B,CAACC,QAA4B;IACrE,MAAM,EAAEC,MAAK,EAAEC,UAAS,EAAE,GAAGJ,aAA+BE;IAE5D,qBACE,AAdJ,cAcKC,MAAME,IAAI,EAAKD,UAAUC,IAAI,EAC3BD,UAAUC,IAAI,CAACC,QAAQ,EACvBH,MAAMI,IAAI,kBAAI,AAhBrB,cAgBsBJ,MAAMI,IAAI,EAAKH,UAAUG,IAAI;AAGnD,EAAE"}
1
+ {"version":3,"sources":["renderCardPreview.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsx createElement */\n\nimport { createElement } from '@fluentui/react-jsx-runtime';\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { CardPreviewSlots, CardPreviewState } from './CardPreview.types';\n\n/**\n * Render the final JSX of CardPreview.\n */\nexport const renderCardPreview_unstable = (state: CardPreviewState) => {\n 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":["createElement","assertSlots","renderCardPreview_unstable","state","root","children","logo"],"mappings":"AAAA,wBAAwB,GACxB,uBAAuB,GAEvB,SAASA,aAAa,QAAQ,8BAA8B;AAE5D,SAASC,WAAW,QAAQ,4BAA4B;AAGxD;;CAEC,GACD,OAAO,MAAMC,6BAA6B,CAACC,QAA4B;IACrEF,YAA8BE;IAE9B,qBACE,AAdJ,cAcKA,MAAMC,IAAI,QACRD,MAAMC,IAAI,CAACC,QAAQ,EACnBF,MAAMG,IAAI,kBAAI,AAhBrB,cAgBsBH,MAAMG,IAAI;AAGhC,EAAE"}
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { getNativeElementProps, resolveShorthand, useMergedRefs } from '@fluentui/react-utilities';
2
+ import { getNativeElementProps, useMergedRefs, slot } from '@fluentui/react-utilities';
3
3
  import { useCardContext_unstable } from '../Card/CardContext';
4
4
  import { cardPreviewClassNames } from './useCardPreviewStyles.styles';
5
5
  /**
@@ -44,10 +44,14 @@ import { cardPreviewClassNames } from './useCardPreviewStyles.styles';
44
44
  root: 'div',
45
45
  logo: 'div'
46
46
  },
47
- root: getNativeElementProps('div', {
47
+ root: slot.always(getNativeElementProps('div', {
48
48
  ref: previewRef,
49
49
  ...props
50
+ }), {
51
+ elementType: 'div'
50
52
  }),
51
- logo: resolveShorthand(logo)
53
+ logo: slot.optional(logo, {
54
+ elementType: 'div'
55
+ })
52
56
  };
53
57
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["useCardPreview.ts"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, resolveShorthand, useMergedRefs } from '@fluentui/react-utilities';\nimport type { CardPreviewProps, CardPreviewState } from './CardPreview.types';\nimport { useCardContext_unstable } from '../Card/CardContext';\nimport { cardPreviewClassNames } from './useCardPreviewStyles.styles';\n\n/**\n * Create the state required to render CardPreview.\n *\n * The returned state can be modified with hooks such as useCardPreviewStyles_unstable,\n * before being passed to renderCardPreview_unstable.\n *\n * @param props - props from this instance of CardPreview\n * @param ref - reference to root HTMLElement of CardPreview\n */\nexport const useCardPreview_unstable = (props: CardPreviewProps, ref: React.Ref<HTMLElement>): CardPreviewState => {\n const { logo } = props;\n\n const {\n selectableA11yProps: { referenceLabel, referenceId, setReferenceLabel, setReferenceId },\n } = useCardContext_unstable();\n const previewRef = useMergedRefs(ref, React.useRef<HTMLDivElement>(null));\n\n React.useEffect(() => {\n if (referenceLabel && referenceId) {\n return;\n }\n\n if (previewRef.current && previewRef.current.parentNode) {\n const img = previewRef.current.parentNode.querySelector<HTMLImageElement>(`.${cardPreviewClassNames.root} > img`);\n\n if (img) {\n const ariaLabel = img.getAttribute('aria-label');\n const ariaDescribedby = img.getAttribute('aria-describedby');\n\n if (ariaDescribedby) {\n setReferenceId(ariaDescribedby);\n } else if (img.alt) {\n setReferenceLabel(img.alt);\n } else if (ariaLabel) {\n setReferenceLabel(ariaLabel);\n }\n }\n }\n }, [setReferenceLabel, referenceLabel, previewRef, referenceId, setReferenceId]);\n\n return {\n components: {\n root: 'div',\n logo: 'div',\n },\n\n root: getNativeElementProps('div', {\n ref: previewRef,\n ...props,\n }),\n logo: resolveShorthand(logo),\n };\n};\n"],"names":["React","getNativeElementProps","resolveShorthand","useMergedRefs","useCardContext_unstable","cardPreviewClassNames","useCardPreview_unstable","props","ref","logo","selectableA11yProps","referenceLabel","referenceId","setReferenceLabel","setReferenceId","previewRef","useRef","useEffect","current","parentNode","img","querySelector","root","ariaLabel","getAttribute","ariaDescribedby","alt","components"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,EAAEC,gBAAgB,EAAEC,aAAa,QAAQ,4BAA4B;AAEnG,SAASC,uBAAuB,QAAQ,sBAAsB;AAC9D,SAASC,qBAAqB,QAAQ,gCAAgC;AAEtE;;;;;;;;CAQC,GACD,OAAO,MAAMC,0BAA0B,CAACC,OAAyBC,MAAkD;IACjH,MAAM,EAAEC,KAAI,EAAE,GAAGF;IAEjB,MAAM,EACJG,qBAAqB,EAAEC,eAAc,EAAEC,YAAW,EAAEC,kBAAiB,EAAEC,eAAc,EAAE,CAAA,EACxF,GAAGV;IACJ,MAAMW,aAAaZ,cAAcK,KAAKR,MAAMgB,MAAM,CAAiB,IAAI;IAEvEhB,MAAMiB,SAAS,CAAC,IAAM;QACpB,IAAIN,kBAAkBC,aAAa;YACjC;QACF,CAAC;QAED,IAAIG,WAAWG,OAAO,IAAIH,WAAWG,OAAO,CAACC,UAAU,EAAE;YACvD,MAAMC,MAAML,WAAWG,OAAO,CAACC,UAAU,CAACE,aAAa,CAAmB,CAAC,CAAC,EAAEhB,sBAAsBiB,IAAI,CAAC,MAAM,CAAC;YAEhH,IAAIF,KAAK;gBACP,MAAMG,YAAYH,IAAII,YAAY,CAAC;gBACnC,MAAMC,kBAAkBL,IAAII,YAAY,CAAC;gBAEzC,IAAIC,iBAAiB;oBACnBX,eAAeW;gBACjB,OAAO,IAAIL,IAAIM,GAAG,EAAE;oBAClBb,kBAAkBO,IAAIM,GAAG;gBAC3B,OAAO,IAAIH,WAAW;oBACpBV,kBAAkBU;gBACpB,CAAC;YACH,CAAC;QACH,CAAC;IACH,GAAG;QAACV;QAAmBF;QAAgBI;QAAYH;QAAaE;KAAe;IAE/E,OAAO;QACLa,YAAY;YACVL,MAAM;YACNb,MAAM;QACR;QAEAa,MAAMrB,sBAAsB,OAAO;YACjCO,KAAKO;YACL,GAAGR,KAAK;QACV;QACAE,MAAMP,iBAAiBO;IACzB;AACF,EAAE"}
1
+ {"version":3,"sources":["useCardPreview.ts"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, useMergedRefs, slot } from '@fluentui/react-utilities';\nimport type { CardPreviewProps, CardPreviewState } from './CardPreview.types';\nimport { useCardContext_unstable } from '../Card/CardContext';\nimport { cardPreviewClassNames } from './useCardPreviewStyles.styles';\n\n/**\n * Create the state required to render CardPreview.\n *\n * The returned state can be modified with hooks such as useCardPreviewStyles_unstable,\n * before being passed to renderCardPreview_unstable.\n *\n * @param props - props from this instance of CardPreview\n * @param ref - reference to root HTMLElement of CardPreview\n */\nexport const useCardPreview_unstable = (props: CardPreviewProps, ref: React.Ref<HTMLElement>): CardPreviewState => {\n const { logo } = props;\n\n const {\n selectableA11yProps: { referenceLabel, referenceId, setReferenceLabel, setReferenceId },\n } = useCardContext_unstable();\n const previewRef = useMergedRefs(ref, React.useRef<HTMLDivElement>(null));\n\n React.useEffect(() => {\n if (referenceLabel && referenceId) {\n return;\n }\n\n if (previewRef.current && previewRef.current.parentNode) {\n const img = previewRef.current.parentNode.querySelector<HTMLImageElement>(`.${cardPreviewClassNames.root} > img`);\n\n if (img) {\n const ariaLabel = img.getAttribute('aria-label');\n const ariaDescribedby = img.getAttribute('aria-describedby');\n\n if (ariaDescribedby) {\n setReferenceId(ariaDescribedby);\n } else if (img.alt) {\n setReferenceLabel(img.alt);\n } else if (ariaLabel) {\n setReferenceLabel(ariaLabel);\n }\n }\n }\n }, [setReferenceLabel, referenceLabel, previewRef, referenceId, setReferenceId]);\n\n return {\n components: {\n root: 'div',\n logo: 'div',\n },\n\n root: slot.always(\n getNativeElementProps('div', {\n ref: previewRef,\n ...props,\n }),\n { elementType: 'div' },\n ),\n logo: slot.optional(logo, { elementType: 'div' }),\n };\n};\n"],"names":["React","getNativeElementProps","useMergedRefs","slot","useCardContext_unstable","cardPreviewClassNames","useCardPreview_unstable","props","ref","logo","selectableA11yProps","referenceLabel","referenceId","setReferenceLabel","setReferenceId","previewRef","useRef","useEffect","current","parentNode","img","querySelector","root","ariaLabel","getAttribute","ariaDescribedby","alt","components","always","elementType","optional"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,EAAEC,aAAa,EAAEC,IAAI,QAA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@ -10,8 +10,8 @@ const _reactJsxRuntime = require("@fluentui/react-jsx-runtime");
10
10
  const _reactUtilities = require("@fluentui/react-utilities");
11
11
  const _cardContext = require("./CardContext");
12
12
  const renderCard_unstable = (state, cardContextValue)=>{
13
- const { slots , slotProps } = (0, _reactUtilities.getSlotsNext)(state);
14
- return /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(slots.root, slotProps.root, /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(_cardContext.CardProvider, {
13
+ (0, _reactUtilities.assertSlots)(state);
14
+ return /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(state.root, null, /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(_cardContext.CardProvider, {
15
15
  value: cardContextValue
16
- }, slots.checkbox ? /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(slots.checkbox, slotProps.checkbox) : null, slots.floatingAction ? /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(slots.floatingAction, slotProps.floatingAction) : null, slotProps.root.children));
16
+ }, state.checkbox ? /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(state.checkbox, null) : null, state.floatingAction ? /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(state.floatingAction, null) : null, state.root.children));
17
17
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["renderCard.js"],"sourcesContent":["/** @jsxRuntime classic */ /** @jsx createElement */ import { createElement } from '@fluentui/react-jsx-runtime';\nimport { getSlotsNext } from '@fluentui/react-utilities';\nimport { CardProvider } from './CardContext';\n/**\n * Render the final JSX of Card.\n */ export const renderCard_unstable = (state, cardContextValue)=>{\n const { slots , slotProps } = getSlotsNext(state);\n return /*#__PURE__*/ createElement(slots.root, slotProps.root, /*#__PURE__*/ createElement(CardProvider, {\n value: cardContextValue\n }, slots.checkbox ? /*#__PURE__*/ createElement(slots.checkbox, slotProps.checkbox) : null, slots.floatingAction ? /*#__PURE__*/ createElement(slots.floatingAction, slotProps.floatingAction) : null, slotProps.root.children));\n};\n"],"names":["renderCard_unstable","state","cardContextValue","slots","slotProps","getSlotsNext","createElement","root","CardProvider","value","checkbox","floatingAction","children"],"mappings":"AAAA,wBAAwB,GAAG,uBAAuB;;;;+BAKjCA;;aAAAA;;iCALkE;gCACtD;6BACA;AAGlB,MAAMA,sBAAsB,CAACC,OAAOC,mBAAmB;IAC9D,MAAM,EAAEC,MAAK,EAAGC,UAAS,EAAG,GAAGC,IAAAA,4BAAY,EAACJ;IAC5C,OAAO,WAAW,GAAGK,IAAAA,8BAAa,EAACH,MAAMI,IAAI,EAAEH,UAAUG,IAAI,EAAE,WAAW,GAAGD,IAAAA,8BAAa,EAACE,yBAAY,EAAE;QACrGC,OAAOP;IACX,GAAGC,MAAMO,QAAQ,GAAG,WAAW,GAAGJ,IAAAA,8BAAa,EAACH,MAAMO,QAAQ,EAAEN,UAAUM,QAAQ,IAAI,IAAI,EAAEP,MAAMQ,cAAc,GAAG,WAAW,GAAGL,IAAAA,8BAAa,EAACH,MAAMQ,cAAc,EAAEP,UAAUO,cAAc,IAAI,IAAI,EAAEP,UAAUG,IAAI,CAACK,QAAQ;AAClO"}
1
+ {"version":3,"sources":["renderCard.js"],"sourcesContent":["/** @jsxRuntime classic */ /** @jsx createElement */ import { createElement } from '@fluentui/react-jsx-runtime';\nimport { assertSlots } from '@fluentui/react-utilities';\nimport { CardProvider } from './CardContext';\n/**\n * Render the final JSX of Card.\n */ export const renderCard_unstable = (state, cardContextValue)=>{\n assertSlots(state);\n return /*#__PURE__*/ createElement(state.root, null, /*#__PURE__*/ createElement(CardProvider, {\n value: cardContextValue\n }, state.checkbox ? /*#__PURE__*/ createElement(state.checkbox, null) : null, state.floatingAction ? /*#__PURE__*/ createElement(state.floatingAction, null) : null, state.root.children));\n};\n"],"names":["renderCard_unstable","state","cardContextValue","assertSlots","createElement","root","CardProvider","value","checkbox","floatingAction","children"],"mappings":"AAAA,wBAAwB,GAAG,uBAAuB;;;;+BAKjCA;;aAAAA;;iCALkE;gCACvD;6BACC;AAGlB,MAAMA,sBAAsB,CAACC,OAAOC,mBAAmB;IAC9DC,IAAAA,2BAAW,EAACF;IACZ,OAAO,WAAW,GAAGG,IAAAA,8BAAa,EAACH,MAAMI,IAAI,EAAE,IAAI,EAAE,WAAW,GAAGD,IAAAA,8BAAa,EAACE,yBAAY,EAAE;QAC3FC,OAAOL;IACX,GAAGD,MAAMO,QAAQ,GAAG,WAAW,GAAGJ,IAAAA,8BAAa,EAACH,MAAMO,QAAQ,EAAE,IAAI,IAAI,IAAI,EAAEP,MAAMQ,cAAc,GAAG,WAAW,GAAGL,IAAAA,8BAAa,EAACH,MAAMQ,cAAc,EAAE,IAAI,IAAI,IAAI,EAAER,MAAMI,IAAI,CAACK,QAAQ;AAC5L"}
@@ -80,12 +80,14 @@ const useCard_unstable = (props, ref)=>{
80
80
  floatingAction: 'div',
81
81
  checkbox: 'input'
82
82
  },
83
- root: (0, _reactUtilities.getNativeElementProps)('div', {
83
+ root: _reactUtilities.slot.always((0, _reactUtilities.getNativeElementProps)('div', {
84
84
  ref: cardRef,
85
85
  role: 'group',
86
86
  ...focusAttributes,
87
87
  ...props,
88
88
  ...selectableCardProps
89
+ }), {
90
+ elementType: 'div'
89
91
  }),
90
92
  floatingAction: floatingActionSlot,
91
93
  checkbox: checkboxSlot
@@ -1 +1 @@
1
- {"version":3,"sources":["useCard.js"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, useMergedRefs } from '@fluentui/react-utilities';\nimport { useFocusableGroup, useFocusWithin } from '@fluentui/react-tabster';\nimport { useCardSelectable } from './useCardSelectable';\nimport { cardContextDefaultValue } from './CardContext';\nconst focusMap = {\n off: undefined,\n 'no-tab': 'limited-trap-focus',\n 'tab-exit': 'limited',\n 'tab-only': 'unlimited'\n};\n/**\n * Create the state for interactive cards.\n *\n * This internal hook defines if the card is interactive\n * and control focus properties based on that.\n *\n * @param props - props from this instance of Card\n */ const useCardInteractive = ({ focusMode ='off' , ...props })=>{\n const interactive = [\n 'onClick',\n 'onDoubleClick',\n 'onMouseUp',\n 'onMouseDown',\n 'onPointerUp',\n 'onPointerDown',\n 'onTouchStart',\n 'onTouchEnd',\n 'onDragStart',\n 'onDragEnd'\n ].some((prop)=>props[prop]);\n const groupperAttrs = useFocusableGroup({\n tabBehavior: focusMap[interactive ? 'no-tab' : focusMode]\n });\n const interactiveFocusAttributes = {\n ...groupperAttrs,\n tabIndex: 0\n };\n return {\n interactive,\n focusAttributes: focusMode === 'off' ? null : interactiveFocusAttributes\n };\n};\n/**\n * Create the state required to render Card.\n *\n * The returned state can be modified with hooks such as useCardStyles_unstable,\n * before being passed to renderCard_unstable.\n *\n * @param props - props from this instance of Card\n * @param ref - reference to the root element of Card\n */ export const useCard_unstable = (props, ref)=>{\n const { appearance ='filled' , orientation ='vertical' , size ='medium' } = props;\n const [referenceId, setReferenceId] = React.useState(cardContextDefaultValue.selectableA11yProps.referenceId);\n const [referenceLabel, setReferenceLabel] = React.useState(cardContextDefaultValue.selectableA11yProps.referenceId);\n const cardBaseRef = useFocusWithin();\n const { selectable , selected , selectableCardProps , selectFocused , checkboxSlot , floatingActionSlot } = useCardSelectable(props, {\n referenceId,\n referenceLabel\n }, cardBaseRef);\n const cardRef = useMergedRefs(cardBaseRef, ref);\n const { interactive , focusAttributes } = useCardInteractive(props);\n return {\n appearance,\n orientation,\n size,\n interactive,\n selectable,\n selectFocused,\n selected,\n selectableA11yProps: {\n setReferenceId,\n referenceId,\n referenceLabel,\n setReferenceLabel\n },\n components: {\n root: 'div',\n floatingAction: 'div',\n checkbox: 'input'\n },\n root: getNativeElementProps('div', {\n ref: cardRef,\n role: 'group',\n ...focusAttributes,\n ...props,\n ...selectableCardProps\n }),\n floatingAction: floatingActionSlot,\n checkbox: checkboxSlot\n };\n};\n"],"names":["useCard_unstable","focusMap","off","undefined","useCardInteractive","focusMode","props","interactive","some","prop","groupperAttrs","useFocusableGroup","tabBehavior","interactiveFocusAttributes","tabIndex","focusAttributes","ref","appearance","orientation","size","referenceId","setReferenceId","React","useState","cardContextDefaultValue","selectableA11yProps","referenceLabel","setReferenceLabel","cardBaseRef","useFocusWithin","selectable","selected","selectableCardProps","selectFocused","checkboxSlot","floatingActionSlot","useCardSelectable","cardRef","useMergedRefs","components","root","floatingAction","checkbox","getNativeElementProps","role"],"mappings":";;;;+BAmDiBA;;aAAAA;;;6DAnDM;gCAC8B;8BACH;mCAChB;6BACM;AACxC,MAAMC,WAAW;IACbC,KAAKC;IACL,UAAU;IACV,YAAY;IACZ,YAAY;AAChB;AACA;;;;;;;CAOC,GAAG,MAAMC,qBAAqB,CAAC,EAAEC,WAAW,MAAK,EAAG,GAAGC,OAAO,GAAG;IAC9D,MAAMC,cAAc;QAChB;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;KACH,CAACC,IAAI,CAAC,CAACC,OAAOH,KAAK,CAACG,KAAK;IAC1B,MAAMC,gBAAgBC,IAAAA,+BAAiB,EAAC;QACpCC,aAAaX,QAAQ,CAACM,cAAc,WAAWF,SAAS,CAAC;IAC7D;IACA,MAAMQ,6BAA6B;QAC/B,GAAGH,aAAa;QAChBI,UAAU;IACd;IACA,OAAO;QACHP;QACAQ,iBAAiBV,cAAc,QAAQ,IAAI,GAAGQ,0BAA0B;IAC5E;AACJ;AASW,MAAMb,mBAAmB,CAACM,OAAOU,MAAM;IAC9C,MAAM,EAAEC,YAAY,SAAQ,EAAGC,aAAa,WAAU,EAAGC,MAAM,SAAQ,EAAG,GAAGb;IAC7E,MAAM,CAACc,aAAaC,eAAe,GAAGC,OAAMC,QAAQ,CAACC,oCAAuB,CAACC,mBAAmB,CAACL,WAAW;IAC5G,MAAM,CAACM,gBAAgBC,kBAAkB,GAAGL,OAAMC,QAAQ,CAACC,oCAAuB,CAACC,mBAAmB,CAACL,WAAW;IAClH,MAAMQ,cAAcC,IAAAA,4BAAc;IAClC,MAAM,EAAEC,WAAU,EAAGC,SAAQ,EAAGC,oBAAmB,EAAGC,cAAa,EAAGC,aAAY,EAAGC,mBAAkB,EAAG,GAAGC,IAAAA,oCAAiB,EAAC9B,OAAO;QAClIc;QACAM;IACJ,GAAGE;IACH,MAAMS,UAAUC,IAAAA,6BAAa,EAACV,aAAaZ;IAC3C,MAAM,EAAET,YAAW,EAAGQ,gBAAe,EAAG,GAAGX,mBAAmBE;IAC9D,OAAO;QACHW;QACAC;QACAC;QACAZ;QACAuB;QACAG;QACAF;QACAN,qBAAqB;YACjBJ;YACAD;YACAM;YACAC;QACJ;QACAY,YAAY;YACRC,MAAM;YACNC,gBAAgB;YAChBC,UAAU;QACd;QACAF,MAAMG,IAAAA,qCAAqB,EAAC,OAAO;YAC/B3B,KAAKqB;YACLO,MAAM;YACN,GAAG7B,eAAe;YAClB,GAAGT,KAAK;YACR,GAAG0B,mBAAmB;QAC1B;QACAS,gBAAgBN;QAChBO,UAAUR;IACd;AACJ"}
1
+ {"version":3,"sources":["useCard.js"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, useMergedRefs, slot } from '@fluentui/react-utilities';\nimport { useFocusableGroup, useFocusWithin } from '@fluentui/react-tabster';\nimport { useCardSelectable } from './useCardSelectable';\nimport { cardContextDefaultValue } from './CardContext';\nconst focusMap = {\n off: undefined,\n 'no-tab': 'limited-trap-focus',\n 'tab-exit': 'limited',\n 'tab-only': 'unlimited'\n};\n/**\n * Create the state for interactive cards.\n *\n * This internal hook defines if the card is interactive\n * and control focus properties based on that.\n *\n * @param props - props from this instance of Card\n */ const useCardInteractive = ({ focusMode ='off' , ...props })=>{\n const interactive = [\n 'onClick',\n 'onDoubleClick',\n 'onMouseUp',\n 'onMouseDown',\n 'onPointerUp',\n 'onPointerDown',\n 'onTouchStart',\n 'onTouchEnd',\n 'onDragStart',\n 'onDragEnd'\n ].some((prop)=>props[prop]);\n const groupperAttrs = useFocusableGroup({\n tabBehavior: focusMap[interactive ? 'no-tab' : focusMode]\n });\n const interactiveFocusAttributes = {\n ...groupperAttrs,\n tabIndex: 0\n };\n return {\n interactive,\n focusAttributes: focusMode === 'off' ? null : interactiveFocusAttributes\n };\n};\n/**\n * Create the state required to render Card.\n *\n * The returned state can be modified with hooks such as useCardStyles_unstable,\n * before being passed to renderCard_unstable.\n *\n * @param props - props from this instance of Card\n * @param ref - reference to the root element of Card\n */ export const useCard_unstable = (props, ref)=>{\n const { appearance ='filled' , orientation ='vertical' , size ='medium' } = props;\n const [referenceId, setReferenceId] = React.useState(cardContextDefaultValue.selectableA11yProps.referenceId);\n const [referenceLabel, setReferenceLabel] = React.useState(cardContextDefaultValue.selectableA11yProps.referenceId);\n const cardBaseRef = useFocusWithin();\n const { selectable , selected , selectableCardProps , selectFocused , checkboxSlot , floatingActionSlot } = useCardSelectable(props, {\n referenceId,\n referenceLabel\n }, cardBaseRef);\n const cardRef = useMergedRefs(cardBaseRef, ref);\n const { interactive , focusAttributes } = useCardInteractive(props);\n return {\n appearance,\n orientation,\n size,\n interactive,\n selectable,\n selectFocused,\n selected,\n selectableA11yProps: {\n setReferenceId,\n referenceId,\n referenceLabel,\n setReferenceLabel\n },\n components: {\n root: 'div',\n floatingAction: 'div',\n checkbox: 'input'\n },\n root: slot.always(getNativeElementProps('div', {\n ref: cardRef,\n role: 'group',\n ...focusAttributes,\n ...props,\n ...selectableCardProps\n }), {\n elementType: 'div'\n }),\n floatingAction: floatingActionSlot,\n checkbox: checkboxSlot\n };\n};\n"],"names":["useCard_unstable","focusMap","off","undefined","useCardInteractive","focusMode","props","interactive","some","prop","groupperAttrs","useFocusableGroup","tabBehavior","interactiveFocusAttributes","tabIndex","focusAttributes","ref","appearance","orientation","size","referenceId","setReferenceId","React","useState","cardContextDefaultValue","selectableA11yProps","referenceLabel","setReferenceLabel","cardBaseRef","useFocusWithin","selectable","selected","selectableCardProps","selectFocused","checkboxSlot","floatingActionSlot","useCardSelectable","cardRef","useMergedRefs","components","root","floatingAction","checkbox","slot","always","getNativeElementProps","role","elementType"],"mappings":";;;;+BAmDiBA;;aAAAA;;;6DAnDM;gCACoC;8BACT;mCAChB;6BACM;AACxC,MAAM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;YACjBJ;YACAD;YACAM;YACAC;QACJ;QACAY,YAAY;YACRC,MAAM;YACNC,gBAAgB;YAChBC,UAAU;QACd;QACAF,MAAMG,oBAAI,CAACC,MAAM,CAACC,IAAAA,qCAAqB,EAAC,OAAO;YAC3C7B,KAAKqB;YACLS,MAAM;YACN,GAAG/B,eAAe;YAClB,GAAGT,KAAK;YACR,GAAG0B,mBAAmB;QAC1B,IAAI;YACAe,aAAa;QACjB;QACAN,gBAAgBN;QAChBO,UAAUR;IACd;AACJ"}
@@ -71,7 +71,7 @@ const useCardSelectable = (props, { referenceLabel , referenceId }, cardRef)=>{
71
71
  } else if (referenceLabel) {
72
72
  selectableCheckboxProps['aria-label'] = referenceLabel;
73
73
  }
74
- return (0, _reactUtilities.resolveShorthand)(checkbox, {
74
+ return _reactUtilities.slot.optional(checkbox, {
75
75
  defaultProps: {
76
76
  ref: checkboxRef,
77
77
  type: 'checkbox',
@@ -80,7 +80,8 @@ const useCardSelectable = (props, { referenceLabel , referenceId }, cardRef)=>{
80
80
  onFocus: ()=>setIsSelectFocused(true),
81
81
  onBlur: ()=>setIsSelectFocused(false),
82
82
  ...selectableCheckboxProps
83
- }
83
+ },
84
+ elementType: 'input'
84
85
  });
85
86
  }, [
86
87
  checkbox,
@@ -95,10 +96,11 @@ const useCardSelectable = (props, { referenceLabel , referenceId }, cardRef)=>{
95
96
  if (!floatingAction) {
96
97
  return;
97
98
  }
98
- return (0, _reactUtilities.resolveShorthand)(floatingAction, {
99
+ return _reactUtilities.slot.optional(floatingAction, {
99
100
  defaultProps: {
100
101
  ref: checkboxRef
101
- }
102
+ },
103
+ elementType: 'div'
102
104
  });
103
105
  }, [
104
106
  floatingAction
@@ -1 +1 @@
1
- {"version":3,"sources":["useCardSelectable.js"],"sourcesContent":["import * as React from 'react';\nimport { mergeCallbacks, resolveShorthand } from '@fluentui/react-utilities';\nimport { Enter } from '@fluentui/keyboard-keys';\nimport { useFocusFinders } from '@fluentui/react-tabster';\n/**\n * @internal\n *\n * Create the state related to selectable cards.\n *\n * This internal hook controls all the logic for selectable cards and is\n * intended to be used alongside with useCard_unstable.\n *\n * @param props - props from this instance of Card\n * @param a11yProps - accessibility props shared between elements of the card\n * @param ref - reference to the root element of Card\n */ export const useCardSelectable = (props, { referenceLabel , referenceId }, cardRef)=>{\n const { checkbox ={} , selected , defaultSelected , onSelectionChange , floatingAction , onClick , onKeyDown } = props;\n const { findAllFocusable } = useFocusFinders();\n const checkboxRef = React.useRef(null);\n const isSelectable = [\n selected,\n defaultSelected,\n onSelectionChange\n ].some((prop)=>typeof prop !== 'undefined');\n const [isCardSelected, setIsCardSelected] = React.useState(false);\n const [isSelectFocused, setIsSelectFocused] = React.useState(false);\n const shouldRestrictTriggerAction = React.useCallback((event)=>{\n if (!cardRef.current) {\n return false;\n }\n const focusableElements = findAllFocusable(cardRef.current);\n const target = event.target;\n const isElementInFocusableGroup = focusableElements.some((element)=>element.contains(target));\n const isCheckboxSlot = (checkboxRef === null || checkboxRef === void 0 ? void 0 : checkboxRef.current) === target;\n return isElementInFocusableGroup && !isCheckboxSlot;\n }, [\n cardRef,\n findAllFocusable\n ]);\n const onChangeHandler = React.useCallback((event)=>{\n if (shouldRestrictTriggerAction(event)) {\n return;\n }\n const newCheckedValue = !isCardSelected;\n setIsCardSelected(newCheckedValue);\n if (onSelectionChange) {\n onSelectionChange(event, {\n selected: newCheckedValue\n });\n }\n }, [\n onSelectionChange,\n isCardSelected,\n shouldRestrictTriggerAction\n ]);\n const onKeyDownHandler = React.useCallback((event)=>{\n if ([\n Enter\n ].includes(event.key)) {\n event.preventDefault();\n onChangeHandler(event);\n }\n }, [\n onChangeHandler\n ]);\n const checkboxSlot = React.useMemo(()=>{\n if (!isSelectable || floatingAction) {\n return;\n }\n const selectableCheckboxProps = {};\n if (referenceId) {\n selectableCheckboxProps['aria-labelledby'] = referenceId;\n } else if (referenceLabel) {\n selectableCheckboxProps['aria-label'] = referenceLabel;\n }\n return resolveShorthand(checkbox, {\n defaultProps: {\n ref: checkboxRef,\n type: 'checkbox',\n checked: isCardSelected,\n onChange: (event)=>onChangeHandler(event),\n onFocus: ()=>setIsSelectFocused(true),\n onBlur: ()=>setIsSelectFocused(false),\n ...selectableCheckboxProps\n }\n });\n }, [\n checkbox,\n floatingAction,\n isCardSelected,\n isSelectable,\n onChangeHandler,\n referenceId,\n referenceLabel\n ]);\n const floatingActionSlot = React.useMemo(()=>{\n if (!floatingAction) {\n return;\n }\n return resolveShorthand(floatingAction, {\n defaultProps: {\n ref: checkboxRef\n }\n });\n }, [\n floatingAction\n ]);\n const selectableCardProps = React.useMemo(()=>{\n if (!isSelectable) {\n return null;\n }\n return {\n onClick: mergeCallbacks(onClick, onChangeHandler),\n onKeyDown: mergeCallbacks(onKeyDown, onKeyDownHandler)\n };\n }, [\n isSelectable,\n onChangeHandler,\n onClick,\n onKeyDown,\n onKeyDownHandler\n ]);\n React.useEffect(()=>setIsCardSelected(Boolean(defaultSelected !== null && defaultSelected !== void 0 ? defaultSelected : selected)), [\n defaultSelected,\n selected,\n setIsCardSelected\n ]);\n return {\n selected: isCardSelected,\n selectable: isSelectable,\n selectFocused: isSelectFocused,\n selectableCardProps,\n checkboxSlot,\n floatingActionSlot\n };\n};\n"],"names":["useCardSelectable","props","referenceLabel","referenceId","cardRef","checkbox","selected","defaultSelected","onSelectionChange","floatingAction","onClick","onKeyDown","findAllFocusable","useFocusFinders","checkboxRef","React","useRef","isSelectable","some","prop","isCardSelected","setIsCardSelected","useState","isSelectFocused","setIsSelectFocused","shouldRestrictTriggerAction","useCallback","event","current","focusableElements","target","isElementInFocusableGroup","element","contains","isCheckboxSlot","onChangeHandler","newCheckedValue","onKeyDownHandler","Enter","includes","key","preventDefault","checkboxSlot","useMemo","selectableCheckboxProps","resolveShorthand","defaultProps","ref","type","checked","onChange","onFocus","onBlur","floatingActionSlot","selectableCardProps","mergeCallbacks","useEffect","Boolean","selectable","selectFocused"],"mappings":";;;;+BAeiBA;;aAAAA;;;6DAfM;gCAC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AAA,8BAAc,EAAC5C,WAAW0B;QACzC;IACJ,GAAG;QACCpB;QACAkB;QACAzB;QACAC;QACA0B;KACH;IACDtB,OAAMyC,SAAS,CAAC,IAAInC,kBAAkBoC,QAAQlD,oBAAoB,IAAI,IAAIA,oBAAoB,KAAK,IAAIA,kBAAkBD,QAAQ,IAAI;QACjIC;QACAD;QACAe;KACH;IACD,OAAO;QACHf,UAAUc;QACVsC,YAAYzC;QACZ0C,eAAepC;QACf+B;QACAZ;QACAW;IACJ;AACJ"}
1
+ {"version":3,"sources":["useCardSelectable.js"],"sourcesContent":["import * as React from 'react';\nimport { mergeCallbacks, slot } from '@fluentui/react-utilities';\nimport { Enter } from '@fluentui/keyboard-keys';\nimport { useFocusFinders } from '@fluentui/react-tabster';\n/**\n * @internal\n *\n * Create the state related to selectable cards.\n *\n * This internal hook controls all the logic for selectable cards and is\n * intended to be used alongside with useCard_unstable.\n *\n * @param props - props from this instance of Card\n * @param a11yProps - accessibility props shared between elements of the card\n * @param ref - reference to the root element of Card\n */ export const useCardSelectable = (props, { referenceLabel , referenceId }, cardRef)=>{\n const { checkbox ={} , selected , defaultSelected , onSelectionChange , floatingAction , onClick , onKeyDown } = props;\n const { findAllFocusable } = useFocusFinders();\n const checkboxRef = React.useRef(null);\n const isSelectable = [\n selected,\n defaultSelected,\n onSelectionChange\n ].some((prop)=>typeof prop !== 'undefined');\n const [isCardSelected, setIsCardSelected] = React.useState(false);\n const [isSelectFocused, setIsSelectFocused] = React.useState(false);\n const shouldRestrictTriggerAction = React.useCallback((event)=>{\n if (!cardRef.current) {\n return false;\n }\n const focusableElements = findAllFocusable(cardRef.current);\n const target = event.target;\n const isElementInFocusableGroup = focusableElements.some((element)=>element.contains(target));\n const isCheckboxSlot = (checkboxRef === null || checkboxRef === void 0 ? void 0 : checkboxRef.current) === target;\n return isElementInFocusableGroup && !isCheckboxSlot;\n }, [\n cardRef,\n findAllFocusable\n ]);\n const onChangeHandler = React.useCallback((event)=>{\n if (shouldRestrictTriggerAction(event)) {\n return;\n }\n const newCheckedValue = !isCardSelected;\n setIsCardSelected(newCheckedValue);\n if (onSelectionChange) {\n onSelectionChange(event, {\n selected: newCheckedValue\n });\n }\n }, [\n onSelectionChange,\n isCardSelected,\n shouldRestrictTriggerAction\n ]);\n const onKeyDownHandler = React.useCallback((event)=>{\n if ([\n Enter\n ].includes(event.key)) {\n event.preventDefault();\n onChangeHandler(event);\n }\n }, [\n onChangeHandler\n ]);\n const checkboxSlot = React.useMemo(()=>{\n if (!isSelectable || floatingAction) {\n return;\n }\n const selectableCheckboxProps = {};\n if (referenceId) {\n selectableCheckboxProps['aria-labelledby'] = referenceId;\n } else if (referenceLabel) {\n selectableCheckboxProps['aria-label'] = referenceLabel;\n }\n return slot.optional(checkbox, {\n defaultProps: {\n ref: checkboxRef,\n type: 'checkbox',\n checked: isCardSelected,\n onChange: (event)=>onChangeHandler(event),\n onFocus: ()=>setIsSelectFocused(true),\n onBlur: ()=>setIsSelectFocused(false),\n ...selectableCheckboxProps\n },\n elementType: 'input'\n });\n }, [\n checkbox,\n floatingAction,\n isCardSelected,\n isSelectable,\n onChangeHandler,\n referenceId,\n referenceLabel\n ]);\n const floatingActionSlot = React.useMemo(()=>{\n if (!floatingAction) {\n return;\n }\n return slot.optional(floatingAction, {\n defaultProps: {\n ref: checkboxRef\n },\n elementType: 'div'\n });\n }, [\n floatingAction\n ]);\n const selectableCardProps = React.useMemo(()=>{\n if (!isSelectable) {\n return null;\n }\n return {\n onClick: mergeCallbacks(onClick, onChangeHandler),\n onKeyDown: mergeCallbacks(onKeyDown, onKeyDownHandler)\n };\n }, [\n isSelectable,\n onChangeHandler,\n onClick,\n onKeyDown,\n onKeyDownHandler\n ]);\n React.useEffect(()=>setIsCardSelected(Boolean(defaultSelected !== null && defaultSelected !== void 0 ? defaultSelected : selected)), [\n defaultSelected,\n selected,\n setIsCardSelected\n ]);\n return {\n selected: isCardSelected,\n selectable: isSelectable,\n selectFocused: isSelectFocused,\n selectableCardProps,\n checkboxSlot,\n floatingActionSlot\n };\n};\n"],"names":["useCardSelectable","props","referenceLabel","referenceId","cardRef","checkbox","selected","defaultSelected","onSelectionChange","floatingAction","onClick","onKeyDown","findAllFocusable","useFocusFinders","checkboxRef","React","useRef","isSelectable","some","prop","isCardSelected","setIsCardSelected","useState","isSelectFocused","setIsSelectFocused","shouldRestrictTriggerAction","useCallback","event","current","focusableElements","target","isElementInFocusableGroup","element","contains","isCheckboxSlot","onChangeHandler","newCheckedValue","onKeyDownHandler","Enter","includes","key","preventDefault","checkboxSlot","useMemo","selectableCheckboxProps","slot","optional","defaultProps","ref","type","checked","onChange","onFocus","onBlur","elementType","floatingActionSlot","selectableCardProps","mergeCallbacks","useEffect","Boolean","selectable","selectFocused"],"mappings":";;;;+BAeiBA;;aAAAA;;;6DAfM;gCACc;8BACf;8BACU;AAYrB,MAAMA,oBAAoB,CAACC,OAAO,EAAEC,eAAc,EAAGC,YAAW,EAAG,EAAEC,UAAU;IACtF,MAAM,EAAEC,UAAU,CAAC,EAAC,EAAGC,SAAQ,EAAGC,gBAAe,EAAGC,kBAAiB,EAAGC,eAAc,EAAGC,QAAO,EAAGC,UAAS,EAAG,GAAGV;IAClH,MAAM,EAAEW,iBAAgB,EAAG,GAAGC,IAAAA,6BAAe;IAC7C,MAAMC,cAAcC,OAAMC,MAAM,CAAC,IAAI;IACrC,MAAMC,eAAe;QACjBX;QACAC;QACAC;KACH,CAACU,IAAI,CAAC,CAACC,OAAO,OAAOA,SAAS;IAC/B,MAAM,CAACC,gBAAgBC,kBAAkB,GAAGN,OAAMO,QAAQ,CAAC,KAAK;IAChE,MAAM,CAACC,iBAAiBC,mBAAmB,GAAGT,OAAMO,QAAQ,CAAC,KAAK;IAClE,MAAMG,8BAA8BV,OAAMW,WAAW,CAAC,CAACC,QAAQ;QAC3D,IAAI,CAACvB,QAAQwB,OAAO,EAAE;YAClB,OAAO,KAAK;QAChB,CAAC;QACD,MAAMC,oBAAoBjB,iBAAiBR,QAAQ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,IAAI7B,mBAAmB,KAAK;gBACpC,GAAGoB,uBAAuB;YAC9B;YACAU,aAAa;QACjB;IACJ,GAAG;QACCjD;QACAI;QACAW;QACAH;QACAkB;QACAhC;QACAD;KACH;IACD,MAAMqD,qBAAqBxC,OAAM4B,OAAO,CAAC,IAAI;QACzC,IAAI,CAAClC,gBAAgB;YACjB;QACJ,CAAC;QACD,OAAOoC,oBAAI,CAACC,QAAQ,CAACrC,gBAAgB;YACjCsC,cAAc;gBACVC,KAAKlC;YACT;YACAwC,aAAa;QACjB;IACJ,GAAG;QACC7C;KACH;IACD,MAAM+C,sBAAsBzC,OAAM4B,OAAO,CAAC,IAAI;QAC1C,IAAI,CAAC1B,cAAc;YACf,OAAO,IAAI;QACf,CAAC;QACD,OAAO;YACHP,SAAS+C,IAAAA,8BAAc,EAAC/C,SAASyB;YACjCxB,WAAW8C,IAAAA,8BAAc,EAAC9C,WAAW0B;QACzC;IACJ,GAAG;QACCpB;QACAkB;QACAzB;QACAC;QACA0B;KACH;IACDtB,OAAM2C,SAAS,CAAC,IAAIrC,kBAAkBsC,QAAQpD,oBAAoB,IAAI,IAAIA,oBAAoB,KAAK,IAAIA,kBAAkBD,QAAQ,IAAI;QACjIC;QACAD;QACAe;KACH;IACD,OAAO;QACHf,UAAUc;QACVwC,YAAY3C;QACZ4C,eAAetC;QACfiC;QACAd;QACAa;IACJ;AACJ"}
@@ -9,6 +9,6 @@ Object.defineProperty(exports, "renderCardFooter_unstable", {
9
9
  const _reactJsxRuntime = require("@fluentui/react-jsx-runtime");
10
10
  const _reactUtilities = require("@fluentui/react-utilities");
11
11
  const renderCardFooter_unstable = (state)=>{
12
- const { slots , slotProps } = (0, _reactUtilities.getSlotsNext)(state);
13
- return /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(slots.root, slotProps.root, slotProps.root.children, slots.action && /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(slots.action, slotProps.action));
12
+ (0, _reactUtilities.assertSlots)(state);
13
+ return /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(state.root, null, state.root.children, state.action && /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(state.action, null));
14
14
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["renderCardFooter.js"],"sourcesContent":["/** @jsxRuntime classic */ /** @jsx createElement */ import { createElement } from '@fluentui/react-jsx-runtime';\nimport { getSlotsNext } from '@fluentui/react-utilities';\n/**\n * Render the final JSX of CardFooter.\n */ export const renderCardFooter_unstable = (state)=>{\n const { slots , slotProps } = getSlotsNext(state);\n return /*#__PURE__*/ createElement(slots.root, slotProps.root, slotProps.root.children, slots.action && /*#__PURE__*/ createElement(slots.action, slotProps.action));\n};\n"],"names":["renderCardFooter_unstable","state","slots","slotProps","getSlotsNext","createElement","root","children","action"],"mappings":"AAAA,wBAAwB,GAAG,uBAAuB;;;;+BAIjCA;;aAAAA;;iCAJkE;gCACtD;AAGlB,MAAMA,4BAA4B,CAACC,QAAQ;IAClD,MAAM,EAAEC,MAAK,EAAGC,UAAS,EAAG,GAAGC,IAAAA,4BAAY,EAACH;IAC5C,OAAO,WAAW,GAAGI,IAAAA,8BAAa,EAACH,MAAMI,IAAI,EAAEH,UAAUG,IAAI,EAAEH,UAAUG,IAAI,CAACC,QAAQ,EAAEL,MAAMM,MAAM,IAAI,WAAW,GAAGH,IAAAA,8BAAa,EAACH,MAAMM,MAAM,EAAEL,UAAUK,MAAM;AACtK"}
1
+ {"version":3,"sources":["renderCardFooter.js"],"sourcesContent":["/** @jsxRuntime classic */ /** @jsx createElement */ import { createElement } from '@fluentui/react-jsx-runtime';\nimport { assertSlots } from '@fluentui/react-utilities';\n/**\n * Render the final JSX of CardFooter.\n */ export const renderCardFooter_unstable = (state)=>{\n assertSlots(state);\n return /*#__PURE__*/ createElement(state.root, null, state.root.children, state.action && /*#__PURE__*/ createElement(state.action, null));\n};\n"],"names":["renderCardFooter_unstable","state","assertSlots","createElement","root","children","action"],"mappings":"AAAA,wBAAwB,GAAG,uBAAuB;;;;+BAIjCA;;aAAAA;;iCAJkE;gCACvD;AAGjB,MAAMA,4BAA4B,CAACC,QAAQ;IAClDC,IAAAA,2BAAW,EAACD;IACZ,OAAO,WAAW,GAAGE,IAAAA,8BAAa,EAACF,MAAMG,IAAI,EAAE,IAAI,EAAEH,MAAMG,IAAI,CAACC,QAAQ,EAAEJ,MAAMK,MAAM,IAAI,WAAW,GAAGH,IAAAA,8BAAa,EAACF,MAAMK,MAAM,EAAE,IAAI;AAC5I"}
@@ -16,10 +16,14 @@ const useCardFooter_unstable = (props, ref)=>{
16
16
  root: 'div',
17
17
  action: 'div'
18
18
  },
19
- root: (0, _reactUtilities.getNativeElementProps)('div', {
19
+ root: _reactUtilities.slot.always((0, _reactUtilities.getNativeElementProps)('div', {
20
20
  ref,
21
21
  ...props
22
+ }), {
23
+ elementType: 'div'
22
24
  }),
23
- action: (0, _reactUtilities.resolveShorthand)(action)
25
+ action: _reactUtilities.slot.optional(action, {
26
+ elementType: 'div'
27
+ })
24
28
  };
25
29
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["useCardFooter.js"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, resolveShorthand } from '@fluentui/react-utilities';\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 */ export const useCardFooter_unstable = (props, ref)=>{\n const { action } = props;\n return {\n components: {\n root: 'div',\n action: 'div'\n },\n root: getNativeElementProps('div', {\n ref,\n ...props\n }),\n action: resolveShorthand(action)\n };\n};\n"],"names":["useCardFooter_unstable","props","ref","action","components","root","getNativeElementProps","resolveShorthand"],"mappings":";;;;+BAUiBA;;aAAAA;;;6DAVM;gCACiC;AAS7C,MAAMA,yBAAyB,CAACC,OAAOC,MAAM;IACpD,MAAM,EAAEC,OAAM,EAAG,GAAGF;IACpB,OAAO;QACHG,YAAY;YACRC,MAAM;YACNF,QAAQ;QACZ;QACAE,MAAMC,IAAAA,qCAAqB,EAAC,OAAO;YAC/BJ;YACA,GAAGD,KAAK;QACZ;QACAE,QAAQI,IAAAA,gCAAgB,EAACJ;IAC7B;AACJ"}
1
+ {"version":3,"sources":["useCardFooter.js"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, slot } from '@fluentui/react-utilities';\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 */ export const useCardFooter_unstable = (props, ref)=>{\n const { action } = props;\n return {\n components: {\n root: 'div',\n action: 'div'\n },\n root: slot.always(getNativeElementProps('div', {\n ref,\n ...props\n }), {\n elementType: 'div'\n }),\n action: slot.optional(action, {\n elementType: 'div'\n })\n };\n};\n"],"names":["useCardFooter_unstable","props","ref","action","components","root","slot","always","getNativeElementProps","elementType","optional"],"mappings":";;;;+BAUiBA;;aAAAA;;;6DAVM;gCACqB;AASjC,MAAMA,yBAAyB,CAACC,OAAOC,MAAM;IACpD,MAAM,EAAEC,OAAM,EAAG,GAAGF;IACpB,OAAO;QACHG,YAAY;YACRC,MAAM;YACNF,QAAQ;QACZ;QACAE,MAAMC,oBAAI,CAACC,MAAM,CAACC,IAAAA,qCAAqB,EAAC,OAAO;YAC3CN;YACA,GAAGD,KAAK;QACZ,IAAI;YACAQ,aAAa;QACjB;QACAN,QAAQG,oBAAI,CAACI,QAAQ,CAACP,QAAQ;YAC1BM,aAAa;QACjB;IACJ;AACJ"}
@@ -9,6 +9,6 @@ Object.defineProperty(exports, "renderCardHeader_unstable", {
9
9
  const _reactJsxRuntime = require("@fluentui/react-jsx-runtime");
10
10
  const _reactUtilities = require("@fluentui/react-utilities");
11
11
  const renderCardHeader_unstable = (state)=>{
12
- const { slots , slotProps } = (0, _reactUtilities.getSlotsNext)(state);
13
- return /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(slots.root, slotProps.root, slots.image && /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(slots.image, slotProps.image), /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(slots.header, slotProps.header), slots.description && /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(slots.description, slotProps.description), slots.action && /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(slots.action, slotProps.action));
12
+ (0, _reactUtilities.assertSlots)(state);
13
+ return /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(state.root, null, state.image && /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(state.image, null), /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(state.header, null), state.description && /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(state.description, null), state.action && /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(state.action, null));
14
14
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["renderCardHeader.js"],"sourcesContent":["/** @jsxRuntime classic */ /** @jsx createElement */ import { createElement } from '@fluentui/react-jsx-runtime';\nimport { getSlotsNext } from '@fluentui/react-utilities';\n/**\n * Render the final JSX of CardHeader.\n */ export const renderCardHeader_unstable = (state)=>{\n const { slots , slotProps } = getSlotsNext(state);\n return /*#__PURE__*/ createElement(slots.root, slotProps.root, slots.image && /*#__PURE__*/ createElement(slots.image, slotProps.image), /*#__PURE__*/ createElement(slots.header, slotProps.header), slots.description && /*#__PURE__*/ createElement(slots.description, slotProps.description), slots.action && /*#__PURE__*/ createElement(slots.action, slotProps.action));\n};\n"],"names":["renderCardHeader_unstable","state","slots","slotProps","getSlotsNext","createElement","root","image","header","description","action"],"mappings":"AAAA,wBAAwB,GAAG,uBAAuB;;;;+BAIjCA;;aAAAA;;iCAJkE;gCACtD;AAGlB,MAAMA,4BAA4B,CAACC,QAAQ;IAClD,MAAM,EAAEC,MAAK,EAAGC,UAAS,EAAG,GAAGC,IAAAA,4BAAY,EAACH;IAC5C,OAAO,WAAW,GAAGI,IAAAA,8BAAa,EAACH,MAAMI,IAAI,EAAEH,UAAUG,IAAI,EAAEJ,MAAMK,KAAK,IAAI,WAAW,GAAGF,IAAAA,8BAAa,EAACH,MAAMK,KAAK,EAAEJ,UAAUI,KAAK,GAAG,WAAW,GAAGF,IAAAA,8BAAa,EAACH,MAAMM,MAAM,EAAEL,UAAUK,MAAM,GAAGN,MAAMO,WAAW,IAAI,WAAW,GAAGJ,IAAAA,8BAAa,EAACH,MAAMO,WAAW,EAAEN,UAAUM,WAAW,GAAGP,MAAMQ,MAAM,IAAI,WAAW,GAAGL,IAAAA,8BAAa,EAACH,MAAMQ,MAAM,EAAEP,UAAUO,MAAM;AAChX"}
1
+ {"version":3,"sources":["renderCardHeader.js"],"sourcesContent":["/** @jsxRuntime classic */ /** @jsx createElement */ import { createElement } from '@fluentui/react-jsx-runtime';\nimport { assertSlots } from '@fluentui/react-utilities';\n/**\n * Render the final JSX of CardHeader.\n */ export const renderCardHeader_unstable = (state)=>{\n assertSlots(state);\n return /*#__PURE__*/ createElement(state.root, null, state.image && /*#__PURE__*/ createElement(state.image, null), /*#__PURE__*/ createElement(state.header, null), state.description && /*#__PURE__*/ createElement(state.description, null), state.action && /*#__PURE__*/ createElement(state.action, null));\n};\n"],"names":["renderCardHeader_unstable","state","assertSlots","createElement","root","image","header","description","action"],"mappings":"AAAA,wBAAwB,GAAG,uBAAuB;;;;+BAIjCA;;aAAAA;;iCAJkE;gCACvD;AAGjB,MAAMA,4BAA4B,CAACC,QAAQ;IAClDC,IAAAA,2BAAW,EAACD;IACZ,OAAO,WAAW,GAAGE,IAAAA,8BAAa,EAACF,MAAMG,IAAI,EAAE,IAAI,EAAEH,MAAMI,KAAK,IAAI,WAAW,GAAGF,IAAAA,8BAAa,EAACF,MAAMI,KAAK,EAAE,IAAI,GAAG,WAAW,GAAGF,IAAAA,8BAAa,EAACF,MAAMK,MAAM,EAAE,IAAI,GAAGL,MAAMM,WAAW,IAAI,WAAW,GAAGJ,IAAAA,8BAAa,EAACF,MAAMM,WAAW,EAAE,IAAI,GAAGN,MAAMO,MAAM,IAAI,WAAW,GAAGL,IAAAA,8BAAa,EAACF,MAAMO,MAAM,EAAE,IAAI;AAClT"}
@@ -44,12 +44,13 @@ 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,
47
+ const headerSlot = _reactUtilities.slot.optional(header, {
48
+ renderByDefault: true,
49
49
  defaultProps: {
50
50
  ref: headerRef,
51
51
  id: !hasChildId.current ? referenceId : undefined
52
- }
52
+ },
53
+ elementType: 'div'
53
54
  });
54
55
  _react.useEffect(()=>{
55
56
  var _headerRef_current;
@@ -71,13 +72,21 @@ const useCardHeader_unstable = (props, ref)=>{
71
72
  description: 'div',
72
73
  action: 'div'
73
74
  },
74
- root: (0, _reactUtilities.getNativeElementProps)('div', {
75
+ root: _reactUtilities.slot.always((0, _reactUtilities.getNativeElementProps)('div', {
75
76
  ref,
76
77
  ...props
78
+ }), {
79
+ elementType: 'div'
80
+ }),
81
+ image: _reactUtilities.slot.optional(image, {
82
+ elementType: 'div'
77
83
  }),
78
- image: (0, _reactUtilities.resolveShorthand)(image),
79
84
  header: headerSlot,
80
- description: (0, _reactUtilities.resolveShorthand)(description),
81
- action: (0, _reactUtilities.resolveShorthand)(action)
85
+ description: _reactUtilities.slot.optional(description, {
86
+ elementType: 'div'
87
+ }),
88
+ action: _reactUtilities.slot.optional(action, {
89
+ elementType: 'div'
90
+ })
82
91
  };
83
92
  };
@@ -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 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;IACpE;IACA,OAAOJ,OAAMK,QAAQ,CAACC,OAAO,CAACT,QAAQU,IAAI,CAACT;AAC/C;AACA;;;;;;;;CAQC,GAAG,SAASU,eAAeC,QAAQ,EAAEC,WAAW,EAAEC,WAAW,EAAE;IAC5D,IAAIF,UAAU;QACV,OAAOA;IACX,CAAC;IACD,IAAIC,gBAAgB,IAAI,IAAIA,gBAAgB,KAAK,IAAI,KAAK,IAAIA,YAAYP,KAAK,CAACC,EAAE,EAAE;QAChF,OAAOM,YAAYP,KAAK,CAACC,EAAE;IAC/B,CAAC;IACD,OAAOO;AACX;AASW,MAAMhB,yBAAyB,CAACQ,OAAOS,MAAM;IACpD,MAAM,EAAEC,MAAK,EAAGhB,OAAM,EAAGiB,YAAW,EAAGC,OAAM,EAAG,GAAGZ;IACnD,MAAM,EAAEa,qBAAqB,EAAEC,YAAW,EAAGC,eAAc,EAAG,CAAA,EAAG,GAAGC,IAAAA,oCAAuB;IAC3F,MAAMC,YAAYpB,OAAMqB,MAAM,CAAC,IAAI;IACnC,MAAMC,aAAatB,OAAMqB,MAAM,CAAC,KAAK;IACrC,MAAMV,cAAcY,IAAAA,qBAAK,EAACC,+CAAoB,CAAC3B,MAAM,EAAEoB;IACvD,MAAMQ,aAAaC,IAAAA,gCAAgB,EAAC7B,QAAQ;QACxC8B,UAAU,IAAI;QACdC,cAAc;YACVhB,KAAKQ;YACLhB,IAAI,CAACkB,WAAWO,OAAO,GAAGZ,cAAca,SAAS;QACrD;IACJ;IACA9B,OAAM+B,SAAS,CAAC,IAAI;QAChB,IAAIC;QACJ,MAAMvB,WAAW,CAACa,WAAWO,OAAO,GAAG,AAACG,CAAAA,qBAAqBZ,UAAUS,OAAO,AAAD,MAAO,IAAI,IAAIG,uBAAuB,KAAK,IAAI,KAAK,IAAIA,mBAAmB5B,EAAE,GAAG0B,SAAS;QACtK,MAAMpB,cAAcd,eAAe6B,eAAe,IAAI,IAAIA,eAAe,KAAK,IAAI,KAAK,IAAIA,WAAWQ,QAAQ;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"}
1
+ {"version":3,"sources":["useCardHeader.js"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, useId, slot } 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 = slot.optional(header, {\n renderByDefault: true,\n defaultProps: {\n ref: headerRef,\n id: !hasChildId.current ? referenceId : undefined\n },\n elementType: 'div'\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: slot.always(getNativeElementProps('div', {\n ref,\n ...props\n }), {\n elementType: 'div'\n }),\n image: slot.optional(image, {\n elementType: 'div'\n }),\n header: headerSlot,\n description: slot.optional(description, {\n elementType: 'div'\n }),\n action: slot.optional(action, {\n elementType: 'div'\n })\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","slot","optional","renderByDefault","defaultProps","current","undefined","elementType","useEffect","_headerRef_current","children","components","root","always","getNativeElementProps"],"mappings":";;;;+BAuCiBA;;aAAAA;;;6DAvCM;gCAC4B;6BACX;2CACH;AACrC;;;;CAIC,GAAG,SAASC,eAAeC,MAAM,EAAE;IAChC,SAASC,yBAAyBC,OAAO,EAAE;QACvC,qBAAOC,OAAMC,cAAc,CAACF,YAAYG,QAAQH,QAAQI,KAAK,CAACC,EAAE;IACpE;IACA,OAAOJ,OAAMK,QAAQ,CAACC,OAAO,CAACT,QAAQU,IAAI,CAACT;AAC/C;AACA;;;;;;;;CAQC,GAAG,SAASU,eAAeC,QAAQ,EAAEC,WAAW,EAAEC,WAAW,EAAE;IAC5D,IAAIF,UAAU;QACV,OAAOA;IACX,CAAC;IACD,IAAIC,gBAAgB,IAAI,IAAIA,gBAAgB,KAAK,IAAI,KAAK,IAAIA,YAAYP,KAAK,CAACC,EAAE,EAAE;QAChF,OAAOM,YAAYP,KAAK,CAACC,EAAE;IAC/B,CAAC;IACD,OAAOO;AACX;AASW,MAAMhB,yBAAyB,CAACQ,OAAOS,MAAM;IACpD,MAAM,EAAEC,MAAK,EAAGhB,OAAM,EAAGiB,YAAW,EAAGC,OAAM,EAAG,GAAGZ;IACnD,MAAM,EAAEa,qBAAqB,EAAEC,YAAW,EAAGC,eAAc,EAAG,CAAA,EAAG,GAAGC,IAAAA,oCAAuB;IAC3F,MAAMC,YAAYpB,OAAMqB,MAAM,CAAC,IAAI;IACnC,MAAMC,aAAatB,OAAMqB,MAAM,CAAC,KAAK;IACrC,MAAMV,cAAcY,IAAAA,qBAAK,EAACC,+CAAoB,CAAC3B,MAAM,EAAEoB;IACvD,MAAMQ,aAAaC,oBAAI,CAACC,QAAQ,CAAC9B,QAAQ;QACrC+B,iBAAiB,IAAI;QACrBC,cAAc;YACVjB,KAAKQ;YACLhB,IAAI,CAACkB,WAAWQ,OAAO,GAAGb,cAAcc,SAAS;QACrD;QACAC,aAAa;IACjB;IACAhC,OAAMiC,SAAS,CAAC,IAAI;QAChB,IAAIC;QACJ,MAAMzB,WAAW,CAACa,WAAWQ,OAAO,GAAG,AAACI,CAAAA,qBAAqBd,UAAUU,OAAO,AAAD,MAAO,IAAI,IAAII,uBAAuB,KAAK,IAAI,KAAK,IAAIA,mBAAmB9B,EAAE,GAAG2B,SAAS;QACtK,MAAMrB,cAAcd,eAAe6B,eAAe,IAAI,IAAIA,eAAe,KAAK,IAAI,KAAK,IAAIA,WAAWU,QAAQ;QAC9Gb,WAAWQ,OAAO,GAAG5B,QAAQQ;QAC7BQ,eAAeV,eAAeC,UAAUC,aAAaC;IACzD,GAAG;QACCA;QACAd;QACA4B;QACAP;KACH;IACD,OAAO;QACHkB,YAAY;YACRC,MAAM;YACNxB,OAAO;YACPhB,QAAQ;YACRiB,aAAa;YACbC,QAAQ;QACZ;QACAsB,MAAMX,oBAAI,CAACY,MAAM,CAACC,IAAAA,qCAAqB,EAAC,OAAO;YAC3C3B;YACA,GAAGT,KAAK;QACZ,IAAI;YACA6B,aAAa;QACjB;QACAnB,OAAOa,oBAAI,CAACC,QAAQ,CAACd,OAAO;YACxBmB,aAAa;QACjB;QACAnC,QAAQ4B;QACRX,aAAaY,oBAAI,CAACC,QAAQ,CAACb,aAAa;YACpCkB,aAAa;QACjB;QACAjB,QAAQW,oBAAI,CAACC,QAAQ,CAACZ,QAAQ;YAC1BiB,aAAa;QACjB;IACJ;AACJ"}
@@ -9,6 +9,6 @@ Object.defineProperty(exports, "renderCardPreview_unstable", {
9
9
  const _reactJsxRuntime = require("@fluentui/react-jsx-runtime");
10
10
  const _reactUtilities = require("@fluentui/react-utilities");
11
11
  const renderCardPreview_unstable = (state)=>{
12
- const { slots , slotProps } = (0, _reactUtilities.getSlotsNext)(state);
13
- return /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(slots.root, slotProps.root, slotProps.root.children, slots.logo && /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(slots.logo, slotProps.logo));
12
+ (0, _reactUtilities.assertSlots)(state);
13
+ return /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(state.root, null, state.root.children, state.logo && /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(state.logo, null));
14
14
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["renderCardPreview.js"],"sourcesContent":["/** @jsxRuntime classic */ /** @jsx createElement */ import { createElement } from '@fluentui/react-jsx-runtime';\nimport { getSlotsNext } from '@fluentui/react-utilities';\n/**\n * Render the final JSX of CardPreview.\n */ export const renderCardPreview_unstable = (state)=>{\n const { slots , slotProps } = getSlotsNext(state);\n return /*#__PURE__*/ createElement(slots.root, slotProps.root, slotProps.root.children, slots.logo && /*#__PURE__*/ createElement(slots.logo, slotProps.logo));\n};\n"],"names":["renderCardPreview_unstable","state","slots","slotProps","getSlotsNext","createElement","root","children","logo"],"mappings":"AAAA,wBAAwB,GAAG,uBAAuB;;;;+BAIjCA;;aAAAA;;iCAJkE;gCACtD;AAGlB,MAAMA,6BAA6B,CAACC,QAAQ;IACnD,MAAM,EAAEC,MAAK,EAAGC,UAAS,EAAG,GAAGC,IAAAA,4BAAY,EAACH;IAC5C,OAAO,WAAW,GAAGI,IAAAA,8BAAa,EAACH,MAAMI,IAAI,EAAEH,UAAUG,IAAI,EAAEH,UAAUG,IAAI,CAACC,QAAQ,EAAEL,MAAMM,IAAI,IAAI,WAAW,GAAGH,IAAAA,8BAAa,EAACH,MAAMM,IAAI,EAAEL,UAAUK,IAAI;AAChK"}
1
+ {"version":3,"sources":["renderCardPreview.js"],"sourcesContent":["/** @jsxRuntime classic */ /** @jsx createElement */ import { createElement } from '@fluentui/react-jsx-runtime';\nimport { assertSlots } from '@fluentui/react-utilities';\n/**\n * Render the final JSX of CardPreview.\n */ export const renderCardPreview_unstable = (state)=>{\n assertSlots(state);\n return /*#__PURE__*/ createElement(state.root, null, state.root.children, state.logo && /*#__PURE__*/ createElement(state.logo, null));\n};\n"],"names":["renderCardPreview_unstable","state","assertSlots","createElement","root","children","logo"],"mappings":"AAAA,wBAAwB,GAAG,uBAAuB;;;;+BAIjCA;;aAAAA;;iCAJkE;gCACvD;AAGjB,MAAMA,6BAA6B,CAACC,QAAQ;IACnDC,IAAAA,2BAAW,EAACD;IACZ,OAAO,WAAW,GAAGE,IAAAA,8BAAa,EAACF,MAAMG,IAAI,EAAE,IAAI,EAAEH,MAAMG,IAAI,CAACC,QAAQ,EAAEJ,MAAMK,IAAI,IAAI,WAAW,GAAGH,IAAAA,8BAAa,EAACF,MAAMK,IAAI,EAAE,IAAI;AACxI"}
@@ -45,10 +45,14 @@ const useCardPreview_unstable = (props, ref)=>{
45
45
  root: 'div',
46
46
  logo: 'div'
47
47
  },
48
- root: (0, _reactUtilities.getNativeElementProps)('div', {
48
+ root: _reactUtilities.slot.always((0, _reactUtilities.getNativeElementProps)('div', {
49
49
  ref: previewRef,
50
50
  ...props
51
+ }), {
52
+ elementType: 'div'
51
53
  }),
52
- logo: (0, _reactUtilities.resolveShorthand)(logo)
54
+ logo: _reactUtilities.slot.optional(logo, {
55
+ elementType: 'div'
56
+ })
53
57
  };
54
58
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["useCardPreview.js"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, resolveShorthand, useMergedRefs } from '@fluentui/react-utilities';\nimport { useCardContext_unstable } from '../Card/CardContext';\nimport { cardPreviewClassNames } from './useCardPreviewStyles.styles';\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 */ export const useCardPreview_unstable = (props, ref)=>{\n const { logo } = props;\n const { selectableA11yProps: { referenceLabel , referenceId , setReferenceLabel , setReferenceId } } = useCardContext_unstable();\n const previewRef = useMergedRefs(ref, React.useRef(null));\n React.useEffect(()=>{\n if (referenceLabel && referenceId) {\n return;\n }\n if (previewRef.current && previewRef.current.parentNode) {\n const img = previewRef.current.parentNode.querySelector(`.${cardPreviewClassNames.root} > img`);\n if (img) {\n const ariaLabel = img.getAttribute('aria-label');\n const ariaDescribedby = img.getAttribute('aria-describedby');\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 }, [\n setReferenceLabel,\n referenceLabel,\n previewRef,\n referenceId,\n setReferenceId\n ]);\n return {\n components: {\n root: 'div',\n logo: 'div'\n },\n root: getNativeElementProps('div', {\n ref: previewRef,\n ...props\n }),\n logo: resolveShorthand(logo)\n };\n};\n"],"names":["useCardPreview_unstable","props","ref","logo","selectableA11yProps","referenceLabel","referenceId","setReferenceLabel","setReferenceId","useCardContext_unstable","previewRef","useMergedRefs","React","useRef","useEffect","current","parentNode","img","querySelector","cardPreviewClassNames","root","ariaLabel","getAttribute","ariaDescribedby","alt","components","getNativeElementProps","resolveShorthand"],"mappings":";;;;+BAYiBA;;aAAAA;;;6DAZM;gCACgD;6BAC/B;4CACF;AAS3B,MAAMA,0BAA0B,CAACC,OAAOC,MAAM;IACrD,MAAM,EAAEC,KAAI,EAAG,GAAGF;IAClB,MAAM,EAAEG,qBAAqB,EAAEC,eAAc,EAAGC,YAAW,EAAGC,kBAAiB,EAAGC,eAAc,EAAG,CAAA,EAAG,GAAGC,IAAAA,oCAAuB;IAChI,MAAMC,aAAaC,IAAAA,6BAAa,EAACT,KAAKU,OAAMC,MAAM,CAAC,IAAI;IACvDD,OAAME,SAAS,CAAC,IAAI;QAChB,IAAIT,kBAAkBC,aAAa;YAC/B;QACJ,CAAC;QACD,IAAII,WAAWK,OAAO,IAAIL,WAAWK,OAAO,CAACC,UAAU,EAAE;YACrD,MAAMC,MAAMP,WAAWK,OAAO,CAACC,UAAU,CAACE,aAAa,CAAC,CAAC,CAAC,EAAEC,iDAAqB,CAACC,IAAI,CAAC,MAAM,CAAC;YAC9F,IAAIH,KAAK;gBACL,MAAMI,YAAYJ,IAAIK,YAAY,CAAC;gBACnC,MAAMC,kBAAkBN,IAAIK,YAAY,CAAC;gBACzC,IAAIC,iBAAiB;oBACjBf,eAAee;gBACnB,OAAO,IAAIN,IAAIO,GAAG,EAAE;oBAChBjB,kBAAkBU,IAAIO,GAAG;gBAC7B,OAAO,IAAIH,WAAW;oBAClBd,kBAAkBc;gBACtB,CAAC;YACL,CAAC;QACL,CAAC;IACL,GAAG;QACCd;QACAF;QACAK;QACAJ;QACAE;KACH;IACD,OAAO;QACHiB,YAAY;YACRL,MAAM;YACNjB,MAAM;QACV;QACAiB,MAAMM,IAAAA,qCAAqB,EAAC,OAAO;YAC/BxB,KAAKQ;YACL,GAAGT,KAAK;QACZ;QACAE,MAAMwB,IAAAA,gCAAgB,EAACxB;IAC3B;AACJ"}
1
+ {"version":3,"sources":["useCardPreview.js"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, useMergedRefs, slot } from '@fluentui/react-utilities';\nimport { useCardContext_unstable } from '../Card/CardContext';\nimport { cardPreviewClassNames } from './useCardPreviewStyles.styles';\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 */ export const useCardPreview_unstable = (props, ref)=>{\n const { logo } = props;\n const { selectableA11yProps: { referenceLabel , referenceId , setReferenceLabel , setReferenceId } } = useCardContext_unstable();\n const previewRef = useMergedRefs(ref, React.useRef(null));\n React.useEffect(()=>{\n if (referenceLabel && referenceId) {\n return;\n }\n if (previewRef.current && previewRef.current.parentNode) {\n const img = previewRef.current.parentNode.querySelector(`.${cardPreviewClassNames.root} > img`);\n if (img) {\n const ariaLabel = img.getAttribute('aria-label');\n const ariaDescribedby = img.getAttribute('aria-describedby');\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 }, [\n setReferenceLabel,\n referenceLabel,\n previewRef,\n referenceId,\n setReferenceId\n ]);\n return {\n components: {\n root: 'div',\n logo: 'div'\n },\n root: slot.always(getNativeElementProps('div', {\n ref: previewRef,\n ...props\n }), {\n elementType: 'div'\n }),\n logo: slot.optional(logo, {\n elementType: 'div'\n })\n };\n};\n"],"names":["useCardPreview_unstable","props","ref","logo","selectableA11yProps","referenceLabel","referenceId","setReferenceLabel","setReferenceId","useCardContext_unstable","previewRef","useMergedRefs","React","useRef","useEffect","current","parentNode","img","querySelector","cardPreviewClassNames","root","ariaLabel","getAttribute","ariaDescribedby","alt","components","slot","always","getNativeElementProps","elementType","optional"],"mappings":";;;;+BAYiBA;;aAAAA;;;6DAZM;gCACoC;6BACnB;4CACF;AAS3B,MAAMA,0BAA0B,CAACC,OAAOC,MAAM;IACrD,MAAM,EAAEC,KAAI,EAAG,GAAGF;IAClB,MAAM,EAAEG,qBAAqB,EAAEC,eAAc,EAAGC,YAAW,EAAGC,kBAAiB,EAAGC,eAAc,EAAG,CAAA,EAAG,GAAGC,IAAAA,oCAAuB;IAChI,MAAMC,aAAaC,IAAAA,6BAAa,EAACT,KAAKU,OAAMC,MAAM,CAAC,IAAI;IACvDD,OAAME,SAAS,CAAC,IAAI;QAChB,IAAIT,kBAAkBC,aAAa;YAC/B;QACJ,CAAC;QACD,IAAII,WAAWK,OAAO,IAAIL,WAAWK,OAAO,CAACC,UAAU,EAAE;YACrD,MAAMC,MAAMP,WAAWK,OAAO,CAACC,UAAU,CAACE,aAAa,CAAC,CAAC,CAAC,EAAEC,iDAAqB,CAACC,IAAI,CAAC,MAAM,CAAC;YAC9F,IAAIH,KAAK;gBACL,MAAMI,YAAYJ,IAAIK,YAAY,CAAC;gBACnC,MAAMC,kBAAkBN,IAAIK,YAAY,CAAC;gBACzC,IAAIC,iBAAiB;oBACjBf,eAAee;gBACnB,OAAO,IAAIN,IAAIO,GAAG,EAAE;oBAChBjB,kBAAkBU,IAAIO,GAAG;gBAC7B,OAAO,IAAIH,WAAW;oBAClBd,kBAAkBc;gBACtB,CAAC;YACL,CAAC;QACL,CAAC;IACL,GAAG;QACCd;QACAF;QACAK;QACAJ;QACAE;KACH;IACD,OAAO;QACHiB,YAAY;YACRL,MAAM;YACNjB,MAAM;QACV;QACAiB,MAAMM,oBAAI,CAACC,MAAM,CAACC,IAAAA,qCAAqB,EAAC,OAAO;YAC3C1B,KAAKQ;YACL,GAAGT,KAAK;QACZ,IAAI;YACA4B,aAAa;QACjB;QACA1B,MAAMuB,oBAAI,CAACI,QAAQ,CAAC3B,MAAM;YACtB0B,aAAa;QACjB;IACJ;AACJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-card",
3
- "version": "0.0.0-nightly-20230807-0415.1",
3
+ "version": "0.0.0-nightly-20230808-0415.1",
4
4
  "private": false,
5
5
  "description": "Card container components for Fluent UI React.",
6
6
  "main": "lib-commonjs/index.js",
@@ -30,19 +30,19 @@
30
30
  },
31
31
  "devDependencies": {
32
32
  "@fluentui/eslint-plugin": "*",
33
- "@fluentui/react-conformance-griffel": "0.0.0-nightly-20230807-0415.1",
34
- "@fluentui/react-conformance": "0.0.0-nightly-20230807-0415.1",
35
- "@fluentui/react-button": "0.0.0-nightly-20230807-0415.1",
33
+ "@fluentui/react-conformance-griffel": "0.0.0-nightly-20230808-0415.1",
34
+ "@fluentui/react-conformance": "0.0.0-nightly-20230808-0415.1",
35
+ "@fluentui/react-button": "0.0.0-nightly-20230808-0415.1",
36
36
  "@fluentui/scripts-api-extractor": "*",
37
37
  "@fluentui/scripts-cypress": "*",
38
38
  "@fluentui/scripts-tasks": "*"
39
39
  },
40
40
  "dependencies": {
41
- "@fluentui/keyboard-keys": "0.0.0-nightly-20230807-0415.1",
42
- "@fluentui/react-tabster": "0.0.0-nightly-20230807-0415.1",
43
- "@fluentui/react-theme": "0.0.0-nightly-20230807-0415.1",
44
- "@fluentui/react-utilities": "0.0.0-nightly-20230807-0415.1",
45
- "@fluentui/react-jsx-runtime": "0.0.0-nightly-20230807-0415.1",
41
+ "@fluentui/keyboard-keys": "0.0.0-nightly-20230808-0415.1",
42
+ "@fluentui/react-tabster": "0.0.0-nightly-20230808-0415.1",
43
+ "@fluentui/react-theme": "0.0.0-nightly-20230808-0415.1",
44
+ "@fluentui/react-utilities": "0.0.0-nightly-20230808-0415.1",
45
+ "@fluentui/react-jsx-runtime": "0.0.0-nightly-20230808-0415.1",
46
46
  "@griffel/react": "^1.5.7",
47
47
  "@swc/helpers": "^0.4.14"
48
48
  },