@fluentui/react-card 9.0.0-beta.3 → 9.0.0-beta.31

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 (178) hide show
  1. package/CHANGELOG.json +1473 -1
  2. package/CHANGELOG.md +422 -31
  3. package/README.md +68 -4
  4. package/dist/index.d.ts +286 -0
  5. package/lib/Card.js.map +1 -1
  6. package/lib/CardFooter.js.map +1 -1
  7. package/lib/CardHeader.js.map +1 -1
  8. package/lib/CardPreview.js.map +1 -1
  9. package/lib/components/Card/Card.js +8 -8
  10. package/lib/components/Card/Card.js.map +1 -1
  11. package/lib/components/Card/Card.types.js.map +1 -1
  12. package/lib/components/Card/index.js.map +1 -1
  13. package/lib/components/Card/renderCard.js +8 -8
  14. package/lib/components/Card/renderCard.js.map +1 -1
  15. package/lib/components/Card/useCard.js +31 -11
  16. package/lib/components/Card/useCard.js.map +1 -1
  17. package/lib/components/Card/useCardStyles.js +221 -25
  18. package/lib/components/Card/useCardStyles.js.map +1 -1
  19. package/lib/components/CardFooter/CardFooter.js +7 -7
  20. package/lib/components/CardFooter/CardFooter.js.map +1 -1
  21. package/lib/components/CardFooter/CardFooter.types.js.map +1 -1
  22. package/lib/components/CardFooter/index.js.map +1 -1
  23. package/lib/components/CardFooter/renderCardFooter.js +9 -9
  24. package/lib/components/CardFooter/renderCardFooter.js.map +1 -1
  25. package/lib/components/CardFooter/useCardFooter.js +10 -13
  26. package/lib/components/CardFooter/useCardFooter.js.map +1 -1
  27. package/lib/components/CardFooter/useCardFooterStyles.js +16 -10
  28. package/lib/components/CardFooter/useCardFooterStyles.js.map +1 -1
  29. package/lib/components/CardHeader/CardHeader.js +7 -7
  30. package/lib/components/CardHeader/CardHeader.js.map +1 -1
  31. package/lib/components/CardHeader/CardHeader.types.js.map +1 -1
  32. package/lib/components/CardHeader/index.js.map +1 -1
  33. package/lib/components/CardHeader/renderCardHeader.js +12 -9
  34. package/lib/components/CardHeader/renderCardHeader.js.map +1 -1
  35. package/lib/components/CardHeader/useCardHeader.js +16 -23
  36. package/lib/components/CardHeader/useCardHeader.js.map +1 -1
  37. package/lib/components/CardHeader/useCardHeaderStyles.js +54 -32
  38. package/lib/components/CardHeader/useCardHeaderStyles.js.map +1 -1
  39. package/lib/components/CardPreview/CardPreview.js +7 -7
  40. package/lib/components/CardPreview/CardPreview.js.map +1 -1
  41. package/lib/components/CardPreview/CardPreview.types.js.map +1 -1
  42. package/lib/components/CardPreview/index.js.map +1 -1
  43. package/lib/components/CardPreview/renderCardPreview.js +9 -9
  44. package/lib/components/CardPreview/renderCardPreview.js.map +1 -1
  45. package/lib/components/CardPreview/useCardPreview.js +10 -13
  46. package/lib/components/CardPreview/useCardPreview.js.map +1 -1
  47. package/lib/components/CardPreview/useCardPreviewStyles.js +17 -15
  48. package/lib/components/CardPreview/useCardPreviewStyles.js.map +1 -1
  49. package/lib/index.js +4 -4
  50. package/lib/index.js.map +1 -1
  51. package/lib-commonjs/Card.js +1 -1
  52. package/lib-commonjs/Card.js.map +1 -1
  53. package/lib-commonjs/CardFooter.js +1 -1
  54. package/lib-commonjs/CardFooter.js.map +1 -1
  55. package/lib-commonjs/CardHeader.js +1 -1
  56. package/lib-commonjs/CardHeader.js.map +1 -1
  57. package/lib-commonjs/CardPreview.js +1 -1
  58. package/lib-commonjs/CardPreview.js.map +1 -1
  59. package/lib-commonjs/components/Card/Card.js +9 -9
  60. package/lib-commonjs/components/Card/Card.js.map +1 -1
  61. package/lib-commonjs/components/Card/Card.types.js.map +1 -1
  62. package/lib-commonjs/components/Card/index.js +1 -1
  63. package/lib-commonjs/components/Card/index.js.map +1 -1
  64. package/lib-commonjs/components/Card/renderCard.js +12 -13
  65. package/lib-commonjs/components/Card/renderCard.js.map +1 -1
  66. package/lib-commonjs/components/Card/useCard.js +34 -15
  67. package/lib-commonjs/components/Card/useCard.js.map +1 -1
  68. package/lib-commonjs/components/Card/useCardStyles.js +228 -27
  69. package/lib-commonjs/components/Card/useCardStyles.js.map +1 -1
  70. package/lib-commonjs/components/CardFooter/CardFooter.js +8 -8
  71. package/lib-commonjs/components/CardFooter/CardFooter.js.map +1 -1
  72. package/lib-commonjs/components/CardFooter/CardFooter.types.js.map +1 -1
  73. package/lib-commonjs/components/CardFooter/index.js +1 -1
  74. package/lib-commonjs/components/CardFooter/index.js.map +1 -1
  75. package/lib-commonjs/components/CardFooter/renderCardFooter.js +13 -15
  76. package/lib-commonjs/components/CardFooter/renderCardFooter.js.map +1 -1
  77. package/lib-commonjs/components/CardFooter/useCardFooter.js +14 -18
  78. package/lib-commonjs/components/CardFooter/useCardFooter.js.map +1 -1
  79. package/lib-commonjs/components/CardFooter/useCardFooterStyles.js +18 -12
  80. package/lib-commonjs/components/CardFooter/useCardFooterStyles.js.map +1 -1
  81. package/lib-commonjs/components/CardHeader/CardHeader.js +8 -8
  82. package/lib-commonjs/components/CardHeader/CardHeader.js.map +1 -1
  83. package/lib-commonjs/components/CardHeader/CardHeader.types.js.map +1 -1
  84. package/lib-commonjs/components/CardHeader/index.js +1 -1
  85. package/lib-commonjs/components/CardHeader/index.js.map +1 -1
  86. package/lib-commonjs/components/CardHeader/renderCardHeader.js +16 -15
  87. package/lib-commonjs/components/CardHeader/renderCardHeader.js.map +1 -1
  88. package/lib-commonjs/components/CardHeader/useCardHeader.js +20 -29
  89. package/lib-commonjs/components/CardHeader/useCardHeader.js.map +1 -1
  90. package/lib-commonjs/components/CardHeader/useCardHeaderStyles.js +56 -34
  91. package/lib-commonjs/components/CardHeader/useCardHeaderStyles.js.map +1 -1
  92. package/lib-commonjs/components/CardPreview/CardPreview.js +8 -8
  93. package/lib-commonjs/components/CardPreview/CardPreview.js.map +1 -1
  94. package/lib-commonjs/components/CardPreview/CardPreview.types.js.map +1 -1
  95. package/lib-commonjs/components/CardPreview/index.js +1 -1
  96. package/lib-commonjs/components/CardPreview/index.js.map +1 -1
  97. package/lib-commonjs/components/CardPreview/renderCardPreview.js +13 -15
  98. package/lib-commonjs/components/CardPreview/renderCardPreview.js.map +1 -1
  99. package/lib-commonjs/components/CardPreview/useCardPreview.js +14 -18
  100. package/lib-commonjs/components/CardPreview/useCardPreview.js.map +1 -1
  101. package/lib-commonjs/components/CardPreview/useCardPreviewStyles.js +19 -17
  102. package/lib-commonjs/components/CardPreview/useCardPreviewStyles.js.map +1 -1
  103. package/lib-commonjs/index.js +140 -5
  104. package/lib-commonjs/index.js.map +1 -1
  105. package/package.json +27 -29
  106. package/assets/ai_deck_template.png +0 -0
  107. package/assets/avatar_elvia.svg +0 -9
  108. package/assets/avatar_mauricio.svg +0 -9
  109. package/assets/doc_template.png +0 -0
  110. package/assets/powerpoint_logo.svg +0 -9
  111. package/assets/sales_template.png +0 -0
  112. package/assets/word_logo.svg +0 -9
  113. package/dist/react-card.d.ts +0 -188
  114. package/lib/Card.d.ts +0 -1
  115. package/lib/CardFooter.d.ts +0 -1
  116. package/lib/CardHeader.d.ts +0 -1
  117. package/lib/CardPreview.d.ts +0 -1
  118. package/lib/common/isConformant.d.ts +0 -4
  119. package/lib/common/isConformant.js +0 -11
  120. package/lib/common/isConformant.js.map +0 -1
  121. package/lib/components/Card/Card.d.ts +0 -6
  122. package/lib/components/Card/Card.types.d.ts +0 -13
  123. package/lib/components/Card/index.d.ts +0 -5
  124. package/lib/components/Card/renderCard.d.ts +0 -5
  125. package/lib/components/Card/useCard.d.ts +0 -12
  126. package/lib/components/Card/useCardStyles.d.ts +0 -5
  127. package/lib/components/CardFooter/CardFooter.d.ts +0 -6
  128. package/lib/components/CardFooter/CardFooter.types.d.ts +0 -13
  129. package/lib/components/CardFooter/index.d.ts +0 -5
  130. package/lib/components/CardFooter/renderCardFooter.d.ts +0 -5
  131. package/lib/components/CardFooter/useCardFooter.d.ts +0 -16
  132. package/lib/components/CardFooter/useCardFooterStyles.d.ts +0 -5
  133. package/lib/components/CardHeader/CardHeader.d.ts +0 -6
  134. package/lib/components/CardHeader/CardHeader.types.d.ts +0 -17
  135. package/lib/components/CardHeader/index.d.ts +0 -5
  136. package/lib/components/CardHeader/renderCardHeader.d.ts +0 -5
  137. package/lib/components/CardHeader/useCardHeader.d.ts +0 -13
  138. package/lib/components/CardHeader/useCardHeaderStyles.d.ts +0 -5
  139. package/lib/components/CardPreview/CardPreview.d.ts +0 -6
  140. package/lib/components/CardPreview/CardPreview.types.d.ts +0 -13
  141. package/lib/components/CardPreview/index.d.ts +0 -5
  142. package/lib/components/CardPreview/renderCardPreview.d.ts +0 -5
  143. package/lib/components/CardPreview/useCardPreview.d.ts +0 -16
  144. package/lib/components/CardPreview/useCardPreviewStyles.d.ts +0 -5
  145. package/lib/index.d.ts +0 -4
  146. package/lib/tsdoc-metadata.json +0 -11
  147. package/lib-commonjs/Card.d.ts +0 -1
  148. package/lib-commonjs/CardFooter.d.ts +0 -1
  149. package/lib-commonjs/CardHeader.d.ts +0 -1
  150. package/lib-commonjs/CardPreview.d.ts +0 -1
  151. package/lib-commonjs/common/isConformant.d.ts +0 -4
  152. package/lib-commonjs/common/isConformant.js +0 -22
  153. package/lib-commonjs/common/isConformant.js.map +0 -1
  154. package/lib-commonjs/components/Card/Card.d.ts +0 -6
  155. package/lib-commonjs/components/Card/Card.types.d.ts +0 -13
  156. package/lib-commonjs/components/Card/index.d.ts +0 -5
  157. package/lib-commonjs/components/Card/renderCard.d.ts +0 -5
  158. package/lib-commonjs/components/Card/useCard.d.ts +0 -12
  159. package/lib-commonjs/components/Card/useCardStyles.d.ts +0 -5
  160. package/lib-commonjs/components/CardFooter/CardFooter.d.ts +0 -6
  161. package/lib-commonjs/components/CardFooter/CardFooter.types.d.ts +0 -13
  162. package/lib-commonjs/components/CardFooter/index.d.ts +0 -5
  163. package/lib-commonjs/components/CardFooter/renderCardFooter.d.ts +0 -5
  164. package/lib-commonjs/components/CardFooter/useCardFooter.d.ts +0 -16
  165. package/lib-commonjs/components/CardFooter/useCardFooterStyles.d.ts +0 -5
  166. package/lib-commonjs/components/CardHeader/CardHeader.d.ts +0 -6
  167. package/lib-commonjs/components/CardHeader/CardHeader.types.d.ts +0 -17
  168. package/lib-commonjs/components/CardHeader/index.d.ts +0 -5
  169. package/lib-commonjs/components/CardHeader/renderCardHeader.d.ts +0 -5
  170. package/lib-commonjs/components/CardHeader/useCardHeader.d.ts +0 -13
  171. package/lib-commonjs/components/CardHeader/useCardHeaderStyles.d.ts +0 -5
  172. package/lib-commonjs/components/CardPreview/CardPreview.d.ts +0 -6
  173. package/lib-commonjs/components/CardPreview/CardPreview.types.d.ts +0 -13
  174. package/lib-commonjs/components/CardPreview/index.d.ts +0 -5
  175. package/lib-commonjs/components/CardPreview/renderCardPreview.d.ts +0 -5
  176. package/lib-commonjs/components/CardPreview/useCardPreview.d.ts +0 -16
  177. package/lib-commonjs/components/CardPreview/useCardPreviewStyles.d.ts +0 -5
  178. package/lib-commonjs/index.d.ts +0 -4
package/README.md CHANGED
@@ -1,11 +1,75 @@
1
- # @fluentui/react-card
1
+ # @fluentui/react-card [ALPHA]
2
2
 
3
- **React Card components for [Fluent UI React](https://developer.microsoft.com/en-us/fluentui)**
3
+ **React Card components for [Fluent UI React](https://react.fluentui.dev)**
4
4
 
5
- These are not production-ready components and **should never be used in product**. This space is useful for testing new components whose APIs might change before final release.
5
+ **⚠️ Please note that functionality is still being added to this package. Due to lockstep versioning, the version of this package is aligned with the others in _react-components_.**
6
+
7
+ These are not production-ready components and **should never be used in a product**. This space is useful for testing new components whose APIs might change before final release.
8
+
9
+ ## Usage
6
10
 
7
11
  To import React Card components:
8
12
 
9
13
  ```js
10
- import { ComponentName } from '@fluentui/react-card';
14
+ import { Card, CardPreview, CardHeader, CardFooter } from "@fluentui/react-components/unstable';
15
+ ```
16
+
17
+ Example Card usage:
18
+
19
+ ![example of a Card component in usage](./docs/assets/card-example.png)
20
+
21
+ ```jsx
22
+ import { Share16Regular, ArrowReply16Regular } from '@fluentui/react-icons';
23
+ import { Button, Body1, Caption1 } from '@fluentui/react-components';
24
+ import { Card, CardHeader, CardPreview, CardFooter } from '@fluentui/react-components/unstable';
25
+
26
+ const App = () => (
27
+ <>
28
+ <Card>
29
+ <CardHeader
30
+ image={
31
+ <img
32
+ src="https://raw.githubusercontent.com/microsoft/fluentui/master/packages/react-components/react-card/assets/avatar_elvia.svg"
33
+ alt="Face of a person"
34
+ />
35
+ }
36
+ header={
37
+ <Body1>
38
+ <b>Elvia Atkins</b> mentioned you
39
+ </Body1>
40
+ }
41
+ description={<Caption1>5h ago · About us - Overview</Caption1>}
42
+ />
43
+ <CardPreview
44
+ logo={
45
+ <img
46
+ src="https://raw.githubusercontent.com/microsoft/fluentui/master/packages/react-components/react-card/assets/word_logo.svg"
47
+ alt="Microsoft Word logo"
48
+ />
49
+ }
50
+ >
51
+ <img
52
+ src="https://raw.githubusercontent.com/microsoft/fluentui/master/packages/react-components/react-card/assets/doc_template.png"
53
+ alt="Preview of a Word document"
54
+ />
55
+ </CardPreview>
56
+ <CardFooter>
57
+ <Button icon={<ArrowReply16Regular />}>Reply</Button>
58
+ <Button icon={<Share16Regular />}>Share</Button>
59
+ </CardFooter>
60
+ </Card>
61
+ </>
62
+ );
11
63
  ```
64
+
65
+ ## Specification
66
+
67
+ See the [Spec.md](./Spec.md) file for background information on the design/engineering decisions of the component.
68
+
69
+ ## API
70
+
71
+ For information about the components, please refer to the [API documentation](https://react.fluentui.dev/?path=/docs/preview-components-card--default).
72
+
73
+ ## Migration
74
+
75
+ For migration information, have a look at the [migration guide](./MIGRATION.md).
@@ -0,0 +1,286 @@
1
+ import type { ComponentProps } from '@fluentui/react-utilities';
2
+ import type { ComponentState } from '@fluentui/react-utilities';
3
+ import type { ForwardRefComponent } from '@fluentui/react-utilities';
4
+ import * as React_2 from 'react';
5
+ import type { Slot } from '@fluentui/react-utilities';
6
+ import type { SlotClassNames } from '@fluentui/react-utilities';
7
+
8
+ /**
9
+ * A card provides scaffolding for hosting actions and content for a single topic.
10
+ */
11
+ export declare const Card: ForwardRefComponent<CardProps>;
12
+
13
+ /**
14
+ * Static CSS class names used internally for the component slots.
15
+ */
16
+ export declare const cardClassNames: SlotClassNames<CardSlots>;
17
+
18
+ /**
19
+ * CSS variable names used internally for uniform styling in Card.
20
+ */
21
+ export declare const cardCSSVars: {
22
+ cardSizeVar: string;
23
+ cardBorderRadiusVar: string;
24
+ };
25
+
26
+ /**
27
+ * Component to render Button actions in a Card component.
28
+ */
29
+ export declare const CardFooter: ForwardRefComponent<CardFooterProps>;
30
+
31
+ /**
32
+ * Static CSS class names used internally for the component slots.
33
+ */
34
+ export declare const cardFooterClassNames: SlotClassNames<CardFooterSlots>;
35
+
36
+ /**
37
+ * CardFooter component props.
38
+ */
39
+ export declare type CardFooterProps = ComponentProps<CardFooterSlots>;
40
+
41
+ /**
42
+ * Slots available in the CardFooter component.
43
+ */
44
+ export declare type CardFooterSlots = {
45
+ /**
46
+ * Root element of the component.
47
+ */
48
+ root: Slot<'div'>;
49
+ /**
50
+ * Container that renders on the far end of the footer, used for action buttons.
51
+ */
52
+ action?: Slot<'div'>;
53
+ };
54
+
55
+ /**
56
+ * State used in rendering CardFooter.
57
+ */
58
+ export declare type CardFooterState = ComponentState<CardFooterSlots>;
59
+
60
+ /**
61
+ * Component to render an image, text and an action in a Card component.
62
+ */
63
+ export declare const CardHeader: ForwardRefComponent<CardHeaderProps>;
64
+
65
+ /**
66
+ * Static CSS class names used internally for the component slots.
67
+ */
68
+ export declare const cardHeaderClassNames: SlotClassNames<CardHeaderSlots>;
69
+
70
+ /**
71
+ * CSS variable names used internally for uniform styling in CardHeader.
72
+ */
73
+ export declare const cardHeaderCSSVars: {
74
+ cardHeaderGapVar: string;
75
+ };
76
+
77
+ /**
78
+ * CardHeader component props.
79
+ */
80
+ export declare type CardHeaderProps = ComponentProps<Partial<CardHeaderSlots>>;
81
+
82
+ /**
83
+ * Slots available in the CardHeader component.
84
+ */
85
+ export declare type CardHeaderSlots = {
86
+ /**
87
+ * Root element of the component.
88
+ */
89
+ root: Slot<'div'>;
90
+ /**
91
+ * Element used to render an image or avatar related to the card.
92
+ */
93
+ image: Slot<'div', 'img'>;
94
+ /**
95
+ * Element used to render the main header title.
96
+ */
97
+ header: Slot<'span'>;
98
+ /**
99
+ * Element used to render short descriptions related to the title.
100
+ */
101
+ description: Slot<'span'>;
102
+ /**
103
+ * Container that renders on the far end of the footer, used for action buttons.
104
+ */
105
+ action?: Slot<'div'>;
106
+ };
107
+
108
+ /**
109
+ * State used in rendering CardHeader.
110
+ */
111
+ export declare type CardHeaderState = ComponentState<CardHeaderSlots>;
112
+
113
+ /**
114
+ * Component to render image previews of documents or articles in a Card component.
115
+ */
116
+ export declare const CardPreview: ForwardRefComponent<CardPreviewProps>;
117
+
118
+ /**
119
+ * Static CSS class names used internally for the component slots.
120
+ */
121
+ export declare const cardPreviewClassNames: SlotClassNames<CardPreviewSlots>;
122
+
123
+ /**
124
+ * CardPreview component props.
125
+ */
126
+ export declare type CardPreviewProps = ComponentProps<CardPreviewSlots>;
127
+
128
+ /**
129
+ * Slots available in the Card component.
130
+ */
131
+ export declare type CardPreviewSlots = {
132
+ /**
133
+ * Root element of the component.
134
+ */
135
+ root: Slot<'div'>;
136
+ /**
137
+ * Container that holds a logo related to the image preview provided.
138
+ */
139
+ logo?: Slot<'div', 'img'>;
140
+ };
141
+
142
+ /**
143
+ * State used in rendering CardPreview.
144
+ */
145
+ export declare type CardPreviewState = ComponentState<CardPreviewSlots>;
146
+
147
+ /**
148
+ * Card component props.
149
+ */
150
+ export declare type CardProps = ComponentProps<CardSlots> & {
151
+ appearance?: 'filled' | 'filled-alternative' | 'outline' | 'subtle';
152
+ /**
153
+ * Sets the focus behavior for the card. If `true`, the card will use the `noTab` focus behavior.
154
+ *
155
+ * `off`
156
+ * The card will not focusable.
157
+ *
158
+ * `no-tab`
159
+ * This behaviour traps the focus inside of the Card when pressing the Enter key and will only release focus when
160
+ * pressing the Escape key.
161
+ *
162
+ * `tab-exit`
163
+ * This behaviour traps the focus inside of the Card when pressing the Enter key but will release focus when pressing
164
+ * the Tab key on the last inner element.
165
+ *
166
+ * `tab-only`
167
+ * This behaviour will cycle through all elements inside of the Card when pressing the Tab key and then release focus
168
+ * after the last inner element.
169
+ *
170
+ * @default 'off'
171
+ */
172
+ focusMode?: 'off' | 'no-tab' | 'tab-exit' | 'tab-only';
173
+ /**
174
+ * Defines the orientation of the card.
175
+ *
176
+ * @default 'vertical'
177
+ */
178
+ orientation?: 'horizontal' | 'vertical';
179
+ /**
180
+ * Controls the card's border radius and padding between inner elements.
181
+ *
182
+ * @default 'medium'
183
+ */
184
+ size?: 'small' | 'medium' | 'large';
185
+ };
186
+
187
+ /**
188
+ * Slots available in the Card component.
189
+ */
190
+ export declare type CardSlots = {
191
+ /**
192
+ * Root element of the component.
193
+ */
194
+ root: Slot<'div'>;
195
+ };
196
+
197
+ /**
198
+ * State used in rendering Card.
199
+ */
200
+ export declare type CardState = ComponentState<CardSlots> & Required<Pick<CardProps, 'appearance' | 'orientation' | 'size'>>;
201
+
202
+ /**
203
+ * Render the final JSX of Card.
204
+ */
205
+ export declare const renderCard_unstable: (state: CardState) => JSX.Element;
206
+
207
+ /**
208
+ * Render the final JSX of CardFooter.
209
+ */
210
+ export declare const renderCardFooter_unstable: (state: CardFooterState) => JSX.Element;
211
+
212
+ /**
213
+ * Render the final JSX of CardHeader.
214
+ */
215
+ export declare const renderCardHeader_unstable: (state: CardHeaderState) => JSX.Element;
216
+
217
+ /**
218
+ * Render the final JSX of CardPreview.
219
+ */
220
+ export declare const renderCardPreview_unstable: (state: CardPreviewState) => JSX.Element;
221
+
222
+ /**
223
+ * Create the state required to render Card.
224
+ *
225
+ * The returned state can be modified with hooks such as useCardStyles_unstable,
226
+ * before being passed to renderCard_unstable.
227
+ *
228
+ * @param props - props from this instance of Card
229
+ * @param ref - reference to root HTMLElement of Card
230
+ */
231
+ export declare const useCard_unstable: (props: CardProps, ref: React_2.Ref<HTMLElement>) => CardState;
232
+
233
+ /**
234
+ * Create the state required to render CardFooter.
235
+ *
236
+ * The returned state can be modified with hooks such as useCardFooterStyles_unstable,
237
+ * before being passed to renderCardFooter_unstable.
238
+ *
239
+ * @param props - props from this instance of CardFooter
240
+ * @param ref - reference to root HTMLElement of CardFooter
241
+ */
242
+ export declare const useCardFooter_unstable: (props: CardFooterProps, ref: React_2.Ref<HTMLElement>) => CardFooterState;
243
+
244
+ /**
245
+ * Apply styling to the CardFooter slots based on the state.
246
+ */
247
+ export declare const useCardFooterStyles_unstable: (state: CardFooterState) => CardFooterState;
248
+
249
+ /**
250
+ * Create the state required to render CardHeader.
251
+ *
252
+ * The returned state can be modified with hooks such as useCardHeaderStyles_unstable,
253
+ * before being passed to renderCardHeader_unstable.
254
+ *
255
+ * @param props - props from this instance of CardHeader
256
+ * @param ref - reference to root HTMLElement of CardHeader
257
+ */
258
+ export declare const useCardHeader_unstable: (props: CardHeaderProps, ref: React_2.Ref<HTMLElement>) => CardHeaderState;
259
+
260
+ /**
261
+ * Apply styling to the CardHeader slots based on the state.
262
+ */
263
+ export declare const useCardHeaderStyles_unstable: (state: CardHeaderState) => CardHeaderState;
264
+
265
+ /**
266
+ * Create the state required to render CardPreview.
267
+ *
268
+ * The returned state can be modified with hooks such as useCardPreviewStyles_unstable,
269
+ * before being passed to renderCardPreview_unstable.
270
+ *
271
+ * @param props - props from this instance of CardPreview
272
+ * @param ref - reference to root HTMLElement of CardPreview
273
+ */
274
+ export declare const useCardPreview_unstable: (props: CardPreviewProps, ref: React_2.Ref<HTMLElement>) => CardPreviewState;
275
+
276
+ /**
277
+ * Apply styling to the CardPreview slots based on the state.
278
+ */
279
+ export declare const useCardPreviewStyles_unstable: (state: CardPreviewState) => CardPreviewState;
280
+
281
+ /**
282
+ * Apply styling to the Card slots based on the state.
283
+ */
284
+ export declare const useCardStyles_unstable: (state: CardState) => CardState;
285
+
286
+ export { }
package/lib/Card.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Card.js","sourceRoot":"","sources":["../src/Card.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC"}
1
+ {"version":3,"file":"Card.js","sourceRoot":"../src/","sources":["packages/react-components/react-card/src/Card.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC","sourcesContent":["export * from './components/Card/index';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"CardFooter.js","sourceRoot":"","sources":["../src/CardFooter.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC"}
1
+ {"version":3,"file":"CardFooter.js","sourceRoot":"../src/","sources":["packages/react-components/react-card/src/CardFooter.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC","sourcesContent":["export * from './components/CardFooter/index';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"CardHeader.js","sourceRoot":"","sources":["../src/CardHeader.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC"}
1
+ {"version":3,"file":"CardHeader.js","sourceRoot":"../src/","sources":["packages/react-components/react-card/src/CardHeader.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC","sourcesContent":["export * from './components/CardHeader/index';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"CardPreview.js","sourceRoot":"","sources":["../src/CardPreview.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC"}
1
+ {"version":3,"file":"CardPreview.js","sourceRoot":"../src/","sources":["packages/react-components/react-card/src/CardPreview.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC","sourcesContent":["export * from './components/CardPreview/index';\n"]}
@@ -1,15 +1,15 @@
1
1
  import * as React from 'react';
2
- import { useCard } from './useCard';
3
- import { renderCard } from './renderCard';
4
- import { useCardStyles } from './useCardStyles';
2
+ import { useCard_unstable } from './useCard';
3
+ import { renderCard_unstable } from './renderCard';
4
+ import { useCardStyles_unstable } from './useCardStyles';
5
5
  /**
6
- * Component to provide scaffolding for hosting actions and content for a single topic within a card sized object.
6
+ * A card provides scaffolding for hosting actions and content for a single topic.
7
7
  */
8
8
 
9
- export var Card = /*#__PURE__*/React.forwardRef(function (props, ref) {
10
- var state = useCard(props, ref);
11
- useCardStyles(state);
12
- return renderCard(state);
9
+ export const Card = /*#__PURE__*/React.forwardRef((props, ref) => {
10
+ const state = useCard_unstable(props, ref);
11
+ useCardStyles_unstable(state);
12
+ return renderCard_unstable(state);
13
13
  });
14
14
  Card.displayName = 'Card';
15
15
  //# sourceMappingURL=Card.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Card/Card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,OAAT,QAAwB,WAAxB;AACA,SAAS,UAAT,QAA2B,cAA3B;AACA,SAAS,aAAT,QAA8B,iBAA9B;AAIA;;AAEG;;AACH,OAAO,IAAM,IAAI,gBAAmC,KAAK,CAAC,UAAN,CAAiB,UAAC,KAAD,EAAQ,GAAR,EAAW;AAC9E,MAAM,KAAK,GAAG,OAAO,CAAC,KAAD,EAAQ,GAAR,CAArB;AAEA,EAAA,aAAa,CAAC,KAAD,CAAb;AACA,SAAO,UAAU,CAAC,KAAD,CAAjB;AACD,CALmD,CAA7C;AAOP,IAAI,CAAC,WAAL,GAAmB,MAAnB","sourceRoot":""}
1
+ {"version":3,"sources":["packages/react-components/react-card/src/components/Card/Card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,gBAAT,QAAiC,WAAjC;AACA,SAAS,mBAAT,QAAoC,cAApC;AACA,SAAS,sBAAT,QAAuC,iBAAvC;AAIA;;AAEG;;AACH,OAAO,MAAM,IAAI,gBAAmC,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;EAClF,MAAM,KAAK,GAAG,gBAAgB,CAAC,KAAD,EAAQ,GAAR,CAA9B;EAEA,sBAAsB,CAAC,KAAD,CAAtB;EACA,OAAO,mBAAmB,CAAC,KAAD,CAA1B;AACD,CALmD,CAA7C;AAOP,IAAI,CAAC,WAAL,GAAmB,MAAnB","sourcesContent":["import * as React from 'react';\nimport { useCard_unstable } from './useCard';\nimport { renderCard_unstable } from './renderCard';\nimport { useCardStyles_unstable } from './useCardStyles';\nimport type { CardProps } from './Card.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * A card provides scaffolding for hosting actions and content for a single topic.\n */\nexport const Card: ForwardRefComponent<CardProps> = React.forwardRef((props, ref) => {\n const state = useCard_unstable(props, ref);\n\n useCardStyles_unstable(state);\n return renderCard_unstable(state);\n});\n\nCard.displayName = 'Card';\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"file":"Card.types.js","sourceRoot":"","sources":["../../../src/components/Card/Card.types.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"Card.types.js","sourceRoot":"../src/","sources":["packages/react-components/react-card/src/components/Card/Card.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\n/**\n * Slots available in the Card component.\n */\nexport type CardSlots = {\n /**\n * Root element of the component.\n */\n root: Slot<'div'>;\n};\n\n/**\n * Card component props.\n */\nexport type CardProps = ComponentProps<CardSlots> & {\n appearance?: 'filled' | 'filled-alternative' | 'outline' | 'subtle';\n\n /**\n * Sets the focus behavior for the card. If `true`, the card will use the `noTab` focus behavior.\n *\n * `off`\n * The card will not focusable.\n *\n * `no-tab`\n * This behaviour traps the focus inside of the Card when pressing the Enter key and will only release focus when\n * pressing the Escape key.\n *\n * `tab-exit`\n * This behaviour traps the focus inside of the Card when pressing the Enter key but will release focus when pressing\n * the Tab key on the last inner element.\n *\n * `tab-only`\n * This behaviour will cycle through all elements inside of the Card when pressing the Tab key and then release focus\n * after the last inner element.\n *\n * @default 'off'\n */\n focusMode?: 'off' | 'no-tab' | 'tab-exit' | 'tab-only';\n\n /**\n * Defines the orientation of the card.\n *\n * @default 'vertical'\n */\n orientation?: 'horizontal' | 'vertical';\n\n /**\n * Controls the card's border radius and padding between inner elements.\n *\n * @default 'medium'\n */\n size?: 'small' | 'medium' | 'large';\n};\n\n/**\n * State used in rendering Card.\n */\nexport type CardState = ComponentState<CardSlots> & Required<Pick<CardProps, 'appearance' | 'orientation' | 'size'>>;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Card/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["packages/react-components/react-card/src/components/Card/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC","sourcesContent":["export * from './Card';\nexport * from './Card.types';\nexport * from './renderCard';\nexport * from './useCard';\nexport * from './useCardStyles';\n"]}
@@ -1,15 +1,15 @@
1
- import { __assign } from "tslib";
2
1
  import * as React from 'react';
3
2
  import { getSlots } from '@fluentui/react-utilities';
4
3
  /**
5
- * Render the final JSX of Card
4
+ * Render the final JSX of Card.
6
5
  */
7
6
 
8
- export var renderCard = function (state) {
9
- var _a = getSlots(state),
10
- slots = _a.slots,
11
- slotProps = _a.slotProps;
12
-
13
- return /*#__PURE__*/React.createElement(slots.root, __assign({}, slotProps.root));
7
+ export const renderCard_unstable = state => {
8
+ const {
9
+ slots,
10
+ slotProps
11
+ } = getSlots(state);
12
+ return /*#__PURE__*/React.createElement(slots.root, { ...slotProps.root
13
+ });
14
14
  };
15
15
  //# sourceMappingURL=renderCard.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Card/renderCard.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAGA;;AAEG;;AACH,OAAO,IAAM,UAAU,GAAG,UAAC,KAAD,EAAiB;AACnC,MAAA,EAAA,GAAuB,QAAQ,CAAY,KAAZ,CAA/B;AAAA,MAAE,KAAK,GAAA,EAAA,CAAA,KAAP;AAAA,MAAS,SAAS,GAAA,EAAA,CAAA,SAAlB;;AAEN,sBAAO,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,CAAP;AACD,CAJM","sourceRoot":""}
1
+ {"version":3,"sources":["packages/react-components/react-card/src/components/Card/renderCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAGA;;AAEG;;AACH,OAAO,MAAM,mBAAmB,GAAI,KAAD,IAAqB;EACtD,MAAM;IAAE,KAAF;IAAS;EAAT,IAAuB,QAAQ,CAAY,KAAZ,CAArC;EAEA,oBAAO,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;EAAf,CAAX,CAAP;AACD,CAJM","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { CardSlots, CardState } from './Card.types';\n\n/**\n * Render the final JSX of Card.\n */\nexport const renderCard_unstable = (state: CardState) => {\n const { slots, slotProps } = getSlots<CardSlots>(state);\n\n return <slots.root {...slotProps.root} />;\n};\n"],"sourceRoot":"../src/"}
@@ -1,28 +1,48 @@
1
- import { __assign } from "tslib";
2
1
  import { getNativeElementProps } from '@fluentui/react-utilities';
3
- import { useFocusableGroup, FocusableGroupTabBehavior } from '@fluentui/react-tabster';
2
+ import { useFocusableGroup } from '@fluentui/react-tabster';
4
3
  /**
5
4
  * Create the state required to render Card.
6
5
  *
7
- * The returned state can be modified with hooks such as useCardStyles,
8
- * before being passed to renderCard.
6
+ * The returned state can be modified with hooks such as useCardStyles_unstable,
7
+ * before being passed to renderCard_unstable.
9
8
  *
10
9
  * @param props - props from this instance of Card
11
10
  * @param ref - reference to root HTMLElement of Card
12
11
  */
13
12
 
14
- export var useCard = function (props, ref) {
15
- var groupperAttrs = useFocusableGroup({
16
- tabBehavior: FocusableGroupTabBehavior.LimitedTrapFocus
13
+ export const useCard_unstable = (props, ref) => {
14
+ const {
15
+ appearance = 'filled',
16
+ focusMode = 'off',
17
+ orientation = 'vertical',
18
+ size = 'medium'
19
+ } = props;
20
+ const focusMap = {
21
+ off: undefined,
22
+ 'no-tab': 'limited-trap-focus',
23
+ 'tab-exit': 'limited',
24
+ 'tab-only': 'unlimited'
25
+ };
26
+ const groupperAttrs = useFocusableGroup({
27
+ tabBehavior: focusMap[focusMode]
17
28
  });
29
+ const focusAttrs = focusMode !== 'off' ? {
30
+ tabIndex: 0,
31
+ ...groupperAttrs
32
+ } : null;
18
33
  return {
34
+ appearance,
35
+ orientation,
36
+ size,
19
37
  components: {
20
38
  root: 'div'
21
39
  },
22
- root: getNativeElementProps(props.as || 'div', __assign(__assign({
23
- ref: ref,
24
- role: 'group'
25
- }, groupperAttrs), props))
40
+ root: getNativeElementProps(props.as || 'div', {
41
+ ref,
42
+ role: 'group',
43
+ ...focusAttrs,
44
+ ...props
45
+ })
26
46
  };
27
47
  };
28
48
  //# sourceMappingURL=useCard.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Card/useCard.ts"],"names":[],"mappings":";AACA,SAAS,qBAAT,QAAsC,2BAAtC;AAEA,SAAS,iBAAT,EAA4B,yBAA5B,QAA6D,yBAA7D;AAEA;;;;;;;;AAQG;;AACH,OAAO,IAAM,OAAO,GAAG,UAAC,KAAD,EAAmB,GAAnB,EAA8C;AACnE,MAAM,aAAa,GAAG,iBAAiB,CAAC;AACtC,IAAA,WAAW,EAAE,yBAAyB,CAAC;AADD,GAAD,CAAvC;AAIA,SAAO;AACL,IAAA,UAAU,EAAE;AAAE,MAAA,IAAI,EAAE;AAAR,KADP;AAGL,IAAA,IAAI,EAAE,qBAAqB,CAAC,KAAK,CAAC,EAAN,IAAY,KAAb,EAAkB,QAAA,CAAA,QAAA,CAAA;AAC3C,MAAA,GAAG,EAAA,GADwC;AAE3C,MAAA,IAAI,EAAE;AAFqC,KAAA,EAGxC,aAHwC,CAAA,EAIxC,KAJwC,CAAlB;AAHtB,GAAP;AAUD,CAfM","sourceRoot":""}
1
+ {"version":3,"sources":["packages/react-components/react-card/src/components/Card/useCard.ts"],"names":[],"mappings":"AACA,SAAS,qBAAT,QAAsC,2BAAtC;AAEA,SAAS,iBAAT,QAAkC,yBAAlC;AAEA;;;;;;;;AAQG;;AACH,OAAO,MAAM,gBAAgB,GAAG,CAAC,KAAD,EAAmB,GAAnB,KAA6D;EAC3F,MAAM;IAAE,UAAU,GAAG,QAAf;IAAyB,SAAS,GAAG,KAArC;IAA4C,WAAW,GAAG,UAA1D;IAAsE,IAAI,GAAG;EAA7E,IAA0F,KAAhG;EAEA,MAAM,QAAQ,GAAG;IACf,GAAG,EAAE,SADU;IAEf,UAAU,oBAFK;IAGf,YAAY,SAHG;IAIf,YAAY;EAJG,CAAjB;EAOA,MAAM,aAAa,GAAG,iBAAiB,CAAC;IACtC,WAAW,EAAE,QAAQ,CAAC,SAAD;EADiB,CAAD,CAAvC;EAIA,MAAM,UAAU,GAAG,SAAS,KAAK,KAAd,GAAsB;IAAE,QAAQ,EAAE,CAAZ;IAAe,GAAG;EAAlB,CAAtB,GAA0D,IAA7E;EAEA,OAAO;IACL,UADK;IAEL,WAFK;IAGL,IAHK;IAKL,UAAU,EAAE;MAAE,IAAI,EAAE;IAAR,CALP;IAML,IAAI,EAAE,qBAAqB,CAAC,KAAK,CAAC,EAAN,IAAY,KAAb,EAAoB;MAC7C,GAD6C;MAE7C,IAAI,EAAE,OAFuC;MAG7C,GAAG,UAH0C;MAI7C,GAAG;IAJ0C,CAApB;EANtB,CAAP;AAaD,CA7BM","sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps } from '@fluentui/react-utilities';\nimport type { CardProps, CardState } from './Card.types';\nimport { useFocusableGroup } from '@fluentui/react-tabster';\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 root HTMLElement of Card\n */\nexport const useCard_unstable = (props: CardProps, ref: React.Ref<HTMLElement>): CardState => {\n const { appearance = 'filled', focusMode = 'off', orientation = 'vertical', size = 'medium' } = props;\n\n const focusMap = {\n off: undefined,\n 'no-tab': 'limited-trap-focus',\n 'tab-exit': 'limited',\n 'tab-only': 'unlimited',\n } as const;\n\n const groupperAttrs = useFocusableGroup({\n tabBehavior: focusMap[focusMode],\n });\n\n const focusAttrs = focusMode !== 'off' ? { tabIndex: 0, ...groupperAttrs } : null;\n\n return {\n appearance,\n orientation,\n size,\n\n components: { root: 'div' },\n root: getNativeElementProps(props.as || 'div', {\n ref,\n role: 'group',\n ...focusAttrs,\n ...props,\n }),\n };\n};\n"],"sourceRoot":"../src/"}