@fluentui/react-card 9.3.3 → 9.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -2
- package/lib/components/Card/useCardStyles.styles.raw.js +366 -0
- package/lib/components/Card/useCardStyles.styles.raw.js.map +1 -0
- package/lib/components/CardFooter/useCardFooterStyles.styles.raw.js +37 -0
- package/lib/components/CardFooter/useCardFooterStyles.styles.raw.js.map +1 -0
- package/lib/components/CardHeader/useCardHeaderStyles.styles.raw.js +103 -0
- package/lib/components/CardHeader/useCardHeaderStyles.styles.raw.js.map +1 -0
- package/lib/components/CardPreview/useCardPreviewStyles.styles.raw.js +35 -0
- package/lib/components/CardPreview/useCardPreviewStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/Card/useCardStyles.styles.raw.js +382 -0
- package/lib-commonjs/components/Card/useCardStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/CardFooter/useCardFooterStyles.styles.raw.js +51 -0
- package/lib-commonjs/components/CardFooter/useCardFooterStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/CardHeader/useCardHeaderStyles.styles.raw.js +118 -0
- package/lib-commonjs/components/CardHeader/useCardHeaderStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/CardPreview/useCardPreviewStyles.styles.raw.js +49 -0
- package/lib-commonjs/components/CardPreview/useCardPreviewStyles.styles.raw.js.map +1 -0
- package/package.json +3 -3
@@ -0,0 +1,382 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
function _export(target, all) {
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
7
|
+
enumerable: true,
|
8
|
+
get: all[name]
|
9
|
+
});
|
10
|
+
}
|
11
|
+
_export(exports, {
|
12
|
+
cardCSSVars: function() {
|
13
|
+
return cardCSSVars;
|
14
|
+
},
|
15
|
+
cardClassNames: function() {
|
16
|
+
return cardClassNames;
|
17
|
+
},
|
18
|
+
useCardStyles_unstable: function() {
|
19
|
+
return useCardStyles_unstable;
|
20
|
+
}
|
21
|
+
});
|
22
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
23
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
24
|
+
const _react1 = require("@griffel/react");
|
25
|
+
const _reacttheme = require("@fluentui/react-theme");
|
26
|
+
const _reacttext = require("@fluentui/react-text");
|
27
|
+
const _reacttabster = require("@fluentui/react-tabster");
|
28
|
+
const _useCardPreviewStylesstyles = require("../CardPreview/useCardPreviewStyles.styles");
|
29
|
+
const _useCardHeaderStylesstyles = require("../CardHeader/useCardHeaderStyles.styles");
|
30
|
+
const _useCardFooterStylesstyles = require("../CardFooter/useCardFooterStyles.styles");
|
31
|
+
const cardClassNames = {
|
32
|
+
root: 'fui-Card',
|
33
|
+
floatingAction: 'fui-Card__floatingAction',
|
34
|
+
checkbox: 'fui-Card__checkbox'
|
35
|
+
};
|
36
|
+
const cardCSSVars = {
|
37
|
+
cardSizeVar: '--fui-Card--size',
|
38
|
+
cardBorderRadiusVar: '--fui-Card--border-radius'
|
39
|
+
};
|
40
|
+
const focusOutlineStyle = {
|
41
|
+
outlineRadius: `var(${cardCSSVars.cardBorderRadiusVar})`,
|
42
|
+
outlineWidth: _reacttheme.tokens.strokeWidthThick,
|
43
|
+
outlineOffset: '-2px'
|
44
|
+
};
|
45
|
+
const useCardResetStyles = (0, _react1.makeResetStyles)({
|
46
|
+
overflow: 'hidden',
|
47
|
+
borderRadius: `var(${cardCSSVars.cardBorderRadiusVar})`,
|
48
|
+
padding: `var(${cardCSSVars.cardSizeVar})`,
|
49
|
+
gap: `var(${cardCSSVars.cardSizeVar})`,
|
50
|
+
display: 'flex',
|
51
|
+
position: 'relative',
|
52
|
+
boxSizing: 'border-box',
|
53
|
+
color: _reacttheme.tokens.colorNeutralForeground1,
|
54
|
+
// Border setting using after pseudo element to allow CardPreview to render behind it.
|
55
|
+
'::after': {
|
56
|
+
position: 'absolute',
|
57
|
+
top: 0,
|
58
|
+
left: 0,
|
59
|
+
right: 0,
|
60
|
+
bottom: 0,
|
61
|
+
content: '""',
|
62
|
+
pointerEvents: 'none',
|
63
|
+
..._react1.shorthands.borderStyle('solid'),
|
64
|
+
..._react1.shorthands.borderWidth(_reacttheme.tokens.strokeWidthThin),
|
65
|
+
borderRadius: `var(${cardCSSVars.cardBorderRadiusVar})`
|
66
|
+
},
|
67
|
+
// Prevents CardHeader and CardFooter from shrinking.
|
68
|
+
[`> .${_useCardHeaderStylesstyles.cardHeaderClassNames.root}, > .${_useCardFooterStylesstyles.cardFooterClassNames.root}`]: {
|
69
|
+
flexShrink: 0
|
70
|
+
}
|
71
|
+
});
|
72
|
+
const useCardStyles = (0, _react1.makeStyles)({
|
73
|
+
focused: {
|
74
|
+
...(0, _reacttabster.createFocusOutlineStyle)({
|
75
|
+
style: focusOutlineStyle,
|
76
|
+
selector: 'focus'
|
77
|
+
})
|
78
|
+
},
|
79
|
+
selectableFocused: (0, _reacttabster.createFocusOutlineStyle)({
|
80
|
+
style: focusOutlineStyle,
|
81
|
+
selector: 'focus-within'
|
82
|
+
}),
|
83
|
+
orientationHorizontal: {
|
84
|
+
flexDirection: 'row',
|
85
|
+
alignItems: 'center',
|
86
|
+
// Remove vertical padding to keep CardPreview content flush with Card's borders.
|
87
|
+
[`> .${_useCardPreviewStylesstyles.cardPreviewClassNames.root}`]: {
|
88
|
+
marginTop: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`,
|
89
|
+
marginBottom: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`
|
90
|
+
},
|
91
|
+
// Due to Tabster's "Groupper" focus functionality, hidden elements are injected before and after Card's content.
|
92
|
+
// As such, the code below targets a CardPreview, when it's the first element.
|
93
|
+
// Since this is on horizontal cards, the left padding is removed to keep the content flush with the border.
|
94
|
+
[`> :not([aria-hidden="true"]).${_useCardPreviewStylesstyles.cardPreviewClassNames.root}:first-of-type`]: {
|
95
|
+
marginLeft: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`
|
96
|
+
},
|
97
|
+
// Due to Tabster's "Groupper" focus functionality, hidden elements are injected before and after Card's content.
|
98
|
+
// As such, the code below targets a CardPreview, when it's the last element.
|
99
|
+
// Since this is on horizontal cards, the right padding is removed to keep the content flush with the border.
|
100
|
+
[`> :not([aria-hidden="true"]).${_useCardPreviewStylesstyles.cardPreviewClassNames.root}:last-of-type`]: {
|
101
|
+
marginRight: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`
|
102
|
+
},
|
103
|
+
// If the last child is a CardHeader or CardFooter, allow it to grow to fill the available space.
|
104
|
+
[`> .${_useCardHeaderStylesstyles.cardHeaderClassNames.root}:last-of-type, > .${_useCardFooterStylesstyles.cardFooterClassNames.root}:last-of-type`]: {
|
105
|
+
flexGrow: 1
|
106
|
+
}
|
107
|
+
},
|
108
|
+
orientationVertical: {
|
109
|
+
flexDirection: 'column',
|
110
|
+
// Remove lateral padding to keep CardPreview content flush with Card's borders.
|
111
|
+
[`> .${_useCardPreviewStylesstyles.cardPreviewClassNames.root}`]: {
|
112
|
+
marginLeft: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`,
|
113
|
+
marginRight: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`
|
114
|
+
},
|
115
|
+
// Due to Tabster's "Groupper" focus functionality, hidden elements are injected before and after Card's content.
|
116
|
+
// As such, the code below targets a CardPreview, when it's the first element.
|
117
|
+
// Since this is on vertical cards, the top padding is removed to keep the content flush with the border.
|
118
|
+
[`> :not([aria-hidden="true"]).${_useCardPreviewStylesstyles.cardPreviewClassNames.root}:first-of-type`]: {
|
119
|
+
marginTop: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`
|
120
|
+
},
|
121
|
+
[`> .${cardClassNames.floatingAction} + .${_useCardPreviewStylesstyles.cardPreviewClassNames.root}`]: {
|
122
|
+
marginTop: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`
|
123
|
+
},
|
124
|
+
// Due to Tabster's "Groupper" focus functionality, hidden elements are injected before and after Card's content.
|
125
|
+
// As such, the code below targets a CardPreview, when it's the first element.
|
126
|
+
// Since this is on vertical cards, the bottom padding is removed to keep the content flush with the border.
|
127
|
+
[`> :not([aria-hidden="true"]).${_useCardPreviewStylesstyles.cardPreviewClassNames.root}:last-of-type`]: {
|
128
|
+
marginBottom: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`
|
129
|
+
}
|
130
|
+
},
|
131
|
+
sizeSmall: {
|
132
|
+
[cardCSSVars.cardSizeVar]: '8px',
|
133
|
+
[cardCSSVars.cardBorderRadiusVar]: _reacttheme.tokens.borderRadiusSmall
|
134
|
+
},
|
135
|
+
sizeMedium: {
|
136
|
+
[cardCSSVars.cardSizeVar]: '12px',
|
137
|
+
[cardCSSVars.cardBorderRadiusVar]: _reacttheme.tokens.borderRadiusMedium
|
138
|
+
},
|
139
|
+
sizeLarge: {
|
140
|
+
[cardCSSVars.cardSizeVar]: '16px',
|
141
|
+
[cardCSSVars.cardBorderRadiusVar]: _reacttheme.tokens.borderRadiusLarge
|
142
|
+
},
|
143
|
+
interactive: {
|
144
|
+
[`& .${_reacttext.textClassNames.root}`]: {
|
145
|
+
color: 'currentColor'
|
146
|
+
}
|
147
|
+
},
|
148
|
+
filled: {
|
149
|
+
backgroundColor: _reacttheme.tokens.colorNeutralBackground1,
|
150
|
+
boxShadow: _reacttheme.tokens.shadow4,
|
151
|
+
'::after': {
|
152
|
+
..._react1.shorthands.borderColor(_reacttheme.tokens.colorTransparentStroke)
|
153
|
+
}
|
154
|
+
},
|
155
|
+
filledInteractive: {
|
156
|
+
cursor: 'pointer',
|
157
|
+
backgroundColor: _reacttheme.tokens.colorNeutralBackground1,
|
158
|
+
boxShadow: _reacttheme.tokens.shadow4,
|
159
|
+
'::after': {
|
160
|
+
..._react1.shorthands.borderColor(_reacttheme.tokens.colorTransparentStroke)
|
161
|
+
},
|
162
|
+
':hover': {
|
163
|
+
color: _reacttheme.tokens.colorNeutralForeground1Hover,
|
164
|
+
backgroundColor: _reacttheme.tokens.colorNeutralBackground1Hover,
|
165
|
+
boxShadow: _reacttheme.tokens.shadow8
|
166
|
+
},
|
167
|
+
':active': {
|
168
|
+
backgroundColor: _reacttheme.tokens.colorNeutralBackground1Pressed
|
169
|
+
}
|
170
|
+
},
|
171
|
+
filledInteractiveSelected: {
|
172
|
+
backgroundColor: _reacttheme.tokens.colorNeutralBackground1Selected,
|
173
|
+
'::after': {
|
174
|
+
..._react1.shorthands.borderColor(_reacttheme.tokens.colorNeutralStroke1Selected)
|
175
|
+
},
|
176
|
+
':hover': {
|
177
|
+
color: _reacttheme.tokens.colorNeutralForeground1Selected,
|
178
|
+
backgroundColor: _reacttheme.tokens.colorNeutralBackground1Selected
|
179
|
+
}
|
180
|
+
},
|
181
|
+
filledAlternative: {
|
182
|
+
backgroundColor: _reacttheme.tokens.colorNeutralBackground2,
|
183
|
+
boxShadow: _reacttheme.tokens.shadow4,
|
184
|
+
'::after': {
|
185
|
+
..._react1.shorthands.borderColor(_reacttheme.tokens.colorTransparentStroke)
|
186
|
+
}
|
187
|
+
},
|
188
|
+
filledAlternativeInteractive: {
|
189
|
+
cursor: 'pointer',
|
190
|
+
backgroundColor: _reacttheme.tokens.colorNeutralBackground2,
|
191
|
+
boxShadow: _reacttheme.tokens.shadow4,
|
192
|
+
'::after': {
|
193
|
+
..._react1.shorthands.borderColor(_reacttheme.tokens.colorTransparentStroke)
|
194
|
+
},
|
195
|
+
':hover': {
|
196
|
+
color: _reacttheme.tokens.colorNeutralForeground2Hover,
|
197
|
+
backgroundColor: _reacttheme.tokens.colorNeutralBackground2Hover,
|
198
|
+
boxShadow: _reacttheme.tokens.shadow8
|
199
|
+
},
|
200
|
+
':active': {
|
201
|
+
backgroundColor: _reacttheme.tokens.colorNeutralBackground2Pressed
|
202
|
+
}
|
203
|
+
},
|
204
|
+
filledAlternativeInteractiveSelected: {
|
205
|
+
backgroundColor: _reacttheme.tokens.colorNeutralBackground2Selected,
|
206
|
+
'::after': {
|
207
|
+
..._react1.shorthands.borderColor(_reacttheme.tokens.colorNeutralStroke1Selected)
|
208
|
+
},
|
209
|
+
':hover': {
|
210
|
+
color: _reacttheme.tokens.colorNeutralForeground2Selected,
|
211
|
+
backgroundColor: _reacttheme.tokens.colorNeutralBackground2Selected
|
212
|
+
}
|
213
|
+
},
|
214
|
+
outline: {
|
215
|
+
backgroundColor: _reacttheme.tokens.colorTransparentBackground,
|
216
|
+
boxShadow: 'none',
|
217
|
+
'::after': {
|
218
|
+
..._react1.shorthands.borderColor(_reacttheme.tokens.colorNeutralStroke1)
|
219
|
+
}
|
220
|
+
},
|
221
|
+
outlineInteractive: {
|
222
|
+
cursor: 'pointer',
|
223
|
+
backgroundColor: _reacttheme.tokens.colorTransparentBackground,
|
224
|
+
boxShadow: 'none',
|
225
|
+
'::after': {
|
226
|
+
..._react1.shorthands.borderColor(_reacttheme.tokens.colorNeutralStroke1)
|
227
|
+
},
|
228
|
+
':hover': {
|
229
|
+
color: _reacttheme.tokens.colorNeutralForeground1Hover,
|
230
|
+
backgroundColor: _reacttheme.tokens.colorTransparentBackgroundHover,
|
231
|
+
'::after': {
|
232
|
+
..._react1.shorthands.borderColor(_reacttheme.tokens.colorNeutralStroke1Hover)
|
233
|
+
}
|
234
|
+
},
|
235
|
+
':active': {
|
236
|
+
backgroundColor: _reacttheme.tokens.colorTransparentBackgroundPressed,
|
237
|
+
'::after': {
|
238
|
+
..._react1.shorthands.borderColor(_reacttheme.tokens.colorNeutralStroke1Pressed)
|
239
|
+
}
|
240
|
+
}
|
241
|
+
},
|
242
|
+
outlineInteractiveSelected: {
|
243
|
+
backgroundColor: _reacttheme.tokens.colorTransparentBackgroundSelected,
|
244
|
+
'::after': {
|
245
|
+
..._react1.shorthands.borderColor(_reacttheme.tokens.colorNeutralStroke1Selected)
|
246
|
+
},
|
247
|
+
':hover': {
|
248
|
+
color: _reacttheme.tokens.colorNeutralForeground1Selected,
|
249
|
+
backgroundColor: _reacttheme.tokens.colorTransparentBackgroundSelected
|
250
|
+
}
|
251
|
+
},
|
252
|
+
subtle: {
|
253
|
+
backgroundColor: _reacttheme.tokens.colorSubtleBackground,
|
254
|
+
boxShadow: 'none',
|
255
|
+
'::after': {
|
256
|
+
..._react1.shorthands.borderColor(_reacttheme.tokens.colorTransparentStroke)
|
257
|
+
}
|
258
|
+
},
|
259
|
+
subtleInteractive: {
|
260
|
+
cursor: 'pointer',
|
261
|
+
backgroundColor: _reacttheme.tokens.colorSubtleBackground,
|
262
|
+
boxShadow: 'none',
|
263
|
+
'::after': {
|
264
|
+
..._react1.shorthands.borderColor(_reacttheme.tokens.colorTransparentStroke)
|
265
|
+
},
|
266
|
+
':hover': {
|
267
|
+
color: _reacttheme.tokens.colorNeutralForeground1Hover,
|
268
|
+
backgroundColor: _reacttheme.tokens.colorSubtleBackgroundHover
|
269
|
+
},
|
270
|
+
':active': {
|
271
|
+
backgroundColor: _reacttheme.tokens.colorSubtleBackgroundPressed
|
272
|
+
}
|
273
|
+
},
|
274
|
+
subtleInteractiveSelected: {
|
275
|
+
backgroundColor: _reacttheme.tokens.colorSubtleBackgroundSelected,
|
276
|
+
'::after': {
|
277
|
+
..._react1.shorthands.borderColor(_reacttheme.tokens.colorNeutralStroke1Selected)
|
278
|
+
},
|
279
|
+
':hover': {
|
280
|
+
color: _reacttheme.tokens.colorNeutralForeground1Selected,
|
281
|
+
backgroundColor: _reacttheme.tokens.colorSubtleBackgroundSelected
|
282
|
+
}
|
283
|
+
},
|
284
|
+
highContrastSelected: {
|
285
|
+
'@media (forced-colors: active)': {
|
286
|
+
forcedColorAdjust: 'none',
|
287
|
+
backgroundColor: 'Highlight',
|
288
|
+
color: 'HighlightText',
|
289
|
+
[`& .${_useCardPreviewStylesstyles.cardPreviewClassNames.root}, & .${_useCardFooterStylesstyles.cardFooterClassNames.root}`]: {
|
290
|
+
forcedColorAdjust: 'auto'
|
291
|
+
},
|
292
|
+
'::after': {
|
293
|
+
..._react1.shorthands.borderColor('Highlight')
|
294
|
+
}
|
295
|
+
}
|
296
|
+
},
|
297
|
+
highContrastInteractive: {
|
298
|
+
'@media (forced-colors: active)': {
|
299
|
+
':hover, :active': {
|
300
|
+
forcedColorAdjust: 'none',
|
301
|
+
backgroundColor: 'Highlight',
|
302
|
+
color: 'HighlightText',
|
303
|
+
[`& .${_useCardPreviewStylesstyles.cardPreviewClassNames.root}, & .${_useCardFooterStylesstyles.cardFooterClassNames.root}`]: {
|
304
|
+
forcedColorAdjust: 'auto'
|
305
|
+
}
|
306
|
+
},
|
307
|
+
'::after': {
|
308
|
+
..._react1.shorthands.borderColor('Highlight')
|
309
|
+
}
|
310
|
+
}
|
311
|
+
},
|
312
|
+
select: {
|
313
|
+
position: 'absolute',
|
314
|
+
top: '4px',
|
315
|
+
right: '4px',
|
316
|
+
zIndex: 1
|
317
|
+
},
|
318
|
+
hiddenCheckbox: {
|
319
|
+
overflow: 'hidden',
|
320
|
+
width: '1px',
|
321
|
+
height: '1px',
|
322
|
+
position: 'absolute',
|
323
|
+
clip: 'rect(0 0 0 0)',
|
324
|
+
clipPath: 'inset(50%)',
|
325
|
+
whiteSpace: 'nowrap'
|
326
|
+
}
|
327
|
+
});
|
328
|
+
const useCardStyles_unstable = (state)=>{
|
329
|
+
'use no memo';
|
330
|
+
const resetStyles = useCardResetStyles();
|
331
|
+
const styles = useCardStyles();
|
332
|
+
const orientationMap = {
|
333
|
+
horizontal: styles.orientationHorizontal,
|
334
|
+
vertical: styles.orientationVertical
|
335
|
+
};
|
336
|
+
const sizeMap = {
|
337
|
+
small: styles.sizeSmall,
|
338
|
+
medium: styles.sizeMedium,
|
339
|
+
large: styles.sizeLarge
|
340
|
+
};
|
341
|
+
const appearanceMap = {
|
342
|
+
filled: styles.filled,
|
343
|
+
'filled-alternative': styles.filledAlternative,
|
344
|
+
outline: styles.outline,
|
345
|
+
subtle: styles.subtle
|
346
|
+
};
|
347
|
+
const selectedMap = {
|
348
|
+
filled: styles.filledInteractiveSelected,
|
349
|
+
'filled-alternative': styles.filledAlternativeInteractiveSelected,
|
350
|
+
outline: styles.outlineInteractiveSelected,
|
351
|
+
subtle: styles.subtleInteractiveSelected
|
352
|
+
};
|
353
|
+
const interactiveMap = {
|
354
|
+
filled: styles.filledInteractive,
|
355
|
+
'filled-alternative': styles.filledAlternativeInteractive,
|
356
|
+
outline: styles.outlineInteractive,
|
357
|
+
subtle: styles.subtleInteractive
|
358
|
+
};
|
359
|
+
const isSelectableOrInteractive = state.interactive || state.selectable;
|
360
|
+
const focusedClassName = _react.useMemo(()=>{
|
361
|
+
if (state.selectable) {
|
362
|
+
if (state.selectFocused) {
|
363
|
+
return styles.selectableFocused;
|
364
|
+
}
|
365
|
+
return '';
|
366
|
+
}
|
367
|
+
return styles.focused;
|
368
|
+
}, [
|
369
|
+
state.selectFocused,
|
370
|
+
state.selectable,
|
371
|
+
styles.focused,
|
372
|
+
styles.selectableFocused
|
373
|
+
]);
|
374
|
+
state.root.className = (0, _react1.mergeClasses)(cardClassNames.root, resetStyles, orientationMap[state.orientation], sizeMap[state.size], appearanceMap[state.appearance], isSelectableOrInteractive && styles.interactive, isSelectableOrInteractive && interactiveMap[state.appearance], state.selected && selectedMap[state.appearance], focusedClassName, isSelectableOrInteractive && styles.highContrastInteractive, state.selected && styles.highContrastSelected, state.root.className);
|
375
|
+
if (state.floatingAction) {
|
376
|
+
state.floatingAction.className = (0, _react1.mergeClasses)(cardClassNames.floatingAction, styles.select, state.floatingAction.className);
|
377
|
+
}
|
378
|
+
if (state.checkbox) {
|
379
|
+
state.checkbox.className = (0, _react1.mergeClasses)(cardClassNames.checkbox, styles.hiddenCheckbox, state.checkbox.className);
|
380
|
+
}
|
381
|
+
return state;
|
382
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/components/Card/useCardStyles.styles.ts"],"sourcesContent":["import * as React from 'react';\nimport { shorthands, makeStyles, mergeClasses, makeResetStyles } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { textClassNames } from '@fluentui/react-text';\nimport { FocusOutlineStyleOptions, createFocusOutlineStyle } from '@fluentui/react-tabster';\n\nimport { cardPreviewClassNames } from '../CardPreview/useCardPreviewStyles.styles';\nimport { cardHeaderClassNames } from '../CardHeader/useCardHeaderStyles.styles';\nimport { cardFooterClassNames } from '../CardFooter/useCardFooterStyles.styles';\nimport type { CardSlots, CardState } from './Card.types';\n\n/**\n * Static CSS class names used internally for the component slots.\n */\nexport const cardClassNames: SlotClassNames<CardSlots> = {\n root: 'fui-Card',\n floatingAction: 'fui-Card__floatingAction',\n checkbox: 'fui-Card__checkbox',\n};\n\n/**\n * CSS variable names used internally for uniform styling in Card.\n */\nexport const cardCSSVars = {\n cardSizeVar: '--fui-Card--size',\n cardBorderRadiusVar: '--fui-Card--border-radius',\n};\n\nconst focusOutlineStyle: Partial<FocusOutlineStyleOptions> = {\n outlineRadius: `var(${cardCSSVars.cardBorderRadiusVar})`,\n outlineWidth: tokens.strokeWidthThick,\n outlineOffset: '-2px', // FIXME: tokens.strokeWidthThick causes some weird bugs\n};\n\nconst useCardResetStyles = makeResetStyles({\n overflow: 'hidden',\n borderRadius: `var(${cardCSSVars.cardBorderRadiusVar})`,\n padding: `var(${cardCSSVars.cardSizeVar})`,\n gap: `var(${cardCSSVars.cardSizeVar})`,\n\n display: 'flex',\n position: 'relative',\n boxSizing: 'border-box',\n color: tokens.colorNeutralForeground1,\n\n // Border setting using after pseudo element to allow CardPreview to render behind it.\n '::after': {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n content: '\"\"',\n pointerEvents: 'none',\n\n ...shorthands.borderStyle('solid'),\n ...shorthands.borderWidth(tokens.strokeWidthThin),\n borderRadius: `var(${cardCSSVars.cardBorderRadiusVar})`,\n },\n\n // Prevents CardHeader and CardFooter from shrinking.\n [`> .${cardHeaderClassNames.root}, > .${cardFooterClassNames.root}`]: {\n flexShrink: 0,\n },\n});\n\nconst useCardStyles = makeStyles({\n focused: {\n ...createFocusOutlineStyle({\n style: focusOutlineStyle,\n selector: 'focus',\n }),\n },\n\n selectableFocused: createFocusOutlineStyle({\n style: focusOutlineStyle,\n selector: 'focus-within',\n }),\n\n orientationHorizontal: {\n flexDirection: 'row',\n alignItems: 'center',\n\n // Remove vertical padding to keep CardPreview content flush with Card's borders.\n [`> .${cardPreviewClassNames.root}`]: {\n marginTop: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`,\n marginBottom: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`,\n },\n // Due to Tabster's \"Groupper\" focus functionality, hidden elements are injected before and after Card's content.\n // As such, the code below targets a CardPreview, when it's the first element.\n // Since this is on horizontal cards, the left padding is removed to keep the content flush with the border.\n [`> :not([aria-hidden=\"true\"]).${cardPreviewClassNames.root}:first-of-type`]: {\n marginLeft: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`,\n },\n // Due to Tabster's \"Groupper\" focus functionality, hidden elements are injected before and after Card's content.\n // As such, the code below targets a CardPreview, when it's the last element.\n // Since this is on horizontal cards, the right padding is removed to keep the content flush with the border.\n [`> :not([aria-hidden=\"true\"]).${cardPreviewClassNames.root}:last-of-type`]: {\n marginRight: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`,\n },\n\n // If the last child is a CardHeader or CardFooter, allow it to grow to fill the available space.\n [`> .${cardHeaderClassNames.root}:last-of-type, > .${cardFooterClassNames.root}:last-of-type`]: {\n flexGrow: 1,\n },\n },\n orientationVertical: {\n flexDirection: 'column',\n\n // Remove lateral padding to keep CardPreview content flush with Card's borders.\n [`> .${cardPreviewClassNames.root}`]: {\n marginLeft: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`,\n marginRight: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`,\n },\n\n // Due to Tabster's \"Groupper\" focus functionality, hidden elements are injected before and after Card's content.\n // As such, the code below targets a CardPreview, when it's the first element.\n // Since this is on vertical cards, the top padding is removed to keep the content flush with the border.\n [`> :not([aria-hidden=\"true\"]).${cardPreviewClassNames.root}:first-of-type`]: {\n marginTop: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`,\n },\n [`> .${cardClassNames.floatingAction} + .${cardPreviewClassNames.root}`]: {\n marginTop: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`,\n },\n\n // Due to Tabster's \"Groupper\" focus functionality, hidden elements are injected before and after Card's content.\n // As such, the code below targets a CardPreview, when it's the first element.\n // Since this is on vertical cards, the bottom padding is removed to keep the content flush with the border.\n [`> :not([aria-hidden=\"true\"]).${cardPreviewClassNames.root}:last-of-type`]: {\n marginBottom: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`,\n },\n },\n\n sizeSmall: {\n [cardCSSVars.cardSizeVar]: '8px',\n [cardCSSVars.cardBorderRadiusVar]: tokens.borderRadiusSmall,\n },\n sizeMedium: {\n [cardCSSVars.cardSizeVar]: '12px',\n [cardCSSVars.cardBorderRadiusVar]: tokens.borderRadiusMedium,\n },\n sizeLarge: {\n [cardCSSVars.cardSizeVar]: '16px',\n [cardCSSVars.cardBorderRadiusVar]: tokens.borderRadiusLarge,\n },\n\n interactive: {\n [`& .${textClassNames.root}`]: {\n color: 'currentColor',\n },\n },\n\n filled: {\n backgroundColor: tokens.colorNeutralBackground1,\n boxShadow: tokens.shadow4,\n\n '::after': {\n ...shorthands.borderColor(tokens.colorTransparentStroke),\n },\n },\n filledInteractive: {\n cursor: 'pointer',\n backgroundColor: tokens.colorNeutralBackground1,\n boxShadow: tokens.shadow4,\n\n '::after': {\n ...shorthands.borderColor(tokens.colorTransparentStroke),\n },\n\n ':hover': {\n color: tokens.colorNeutralForeground1Hover,\n backgroundColor: tokens.colorNeutralBackground1Hover,\n boxShadow: tokens.shadow8,\n },\n ':active': {\n backgroundColor: tokens.colorNeutralBackground1Pressed,\n },\n },\n filledInteractiveSelected: {\n backgroundColor: tokens.colorNeutralBackground1Selected,\n\n '::after': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Selected),\n },\n\n ':hover': {\n color: tokens.colorNeutralForeground1Selected,\n backgroundColor: tokens.colorNeutralBackground1Selected,\n },\n },\n\n filledAlternative: {\n backgroundColor: tokens.colorNeutralBackground2,\n boxShadow: tokens.shadow4,\n\n '::after': {\n ...shorthands.borderColor(tokens.colorTransparentStroke),\n },\n },\n filledAlternativeInteractive: {\n cursor: 'pointer',\n backgroundColor: tokens.colorNeutralBackground2,\n boxShadow: tokens.shadow4,\n\n '::after': {\n ...shorthands.borderColor(tokens.colorTransparentStroke),\n },\n\n ':hover': {\n color: tokens.colorNeutralForeground2Hover,\n backgroundColor: tokens.colorNeutralBackground2Hover,\n boxShadow: tokens.shadow8,\n },\n ':active': {\n backgroundColor: tokens.colorNeutralBackground2Pressed,\n },\n },\n filledAlternativeInteractiveSelected: {\n backgroundColor: tokens.colorNeutralBackground2Selected,\n\n '::after': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Selected),\n },\n\n ':hover': {\n color: tokens.colorNeutralForeground2Selected,\n backgroundColor: tokens.colorNeutralBackground2Selected,\n },\n },\n\n outline: {\n backgroundColor: tokens.colorTransparentBackground,\n boxShadow: 'none',\n\n '::after': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1),\n },\n },\n outlineInteractive: {\n cursor: 'pointer',\n backgroundColor: tokens.colorTransparentBackground,\n boxShadow: 'none',\n\n '::after': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1),\n },\n\n ':hover': {\n color: tokens.colorNeutralForeground1Hover,\n backgroundColor: tokens.colorTransparentBackgroundHover,\n\n '::after': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Hover),\n },\n },\n ':active': {\n backgroundColor: tokens.colorTransparentBackgroundPressed,\n\n '::after': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Pressed),\n },\n },\n },\n outlineInteractiveSelected: {\n backgroundColor: tokens.colorTransparentBackgroundSelected,\n\n '::after': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Selected),\n },\n\n ':hover': {\n color: tokens.colorNeutralForeground1Selected,\n backgroundColor: tokens.colorTransparentBackgroundSelected,\n },\n },\n\n subtle: {\n backgroundColor: tokens.colorSubtleBackground,\n boxShadow: 'none',\n\n '::after': {\n ...shorthands.borderColor(tokens.colorTransparentStroke),\n },\n },\n subtleInteractive: {\n cursor: 'pointer',\n backgroundColor: tokens.colorSubtleBackground,\n boxShadow: 'none',\n\n '::after': {\n ...shorthands.borderColor(tokens.colorTransparentStroke),\n },\n\n ':hover': {\n color: tokens.colorNeutralForeground1Hover,\n backgroundColor: tokens.colorSubtleBackgroundHover,\n },\n ':active': {\n backgroundColor: tokens.colorSubtleBackgroundPressed,\n },\n },\n subtleInteractiveSelected: {\n backgroundColor: tokens.colorSubtleBackgroundSelected,\n\n '::after': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Selected),\n },\n\n ':hover': {\n color: tokens.colorNeutralForeground1Selected,\n backgroundColor: tokens.colorSubtleBackgroundSelected,\n },\n },\n\n highContrastSelected: {\n '@media (forced-colors: active)': {\n forcedColorAdjust: 'none',\n backgroundColor: 'Highlight',\n color: 'HighlightText',\n\n [`& .${cardPreviewClassNames.root}, & .${cardFooterClassNames.root}`]: {\n forcedColorAdjust: 'auto',\n },\n\n '::after': {\n ...shorthands.borderColor('Highlight'),\n },\n },\n },\n\n highContrastInteractive: {\n '@media (forced-colors: active)': {\n ':hover, :active': {\n forcedColorAdjust: 'none',\n backgroundColor: 'Highlight',\n color: 'HighlightText',\n\n [`& .${cardPreviewClassNames.root}, & .${cardFooterClassNames.root}`]: {\n forcedColorAdjust: 'auto',\n },\n },\n\n '::after': {\n ...shorthands.borderColor('Highlight'),\n },\n },\n },\n\n select: {\n position: 'absolute',\n top: '4px',\n right: '4px',\n zIndex: 1,\n },\n\n hiddenCheckbox: {\n overflow: 'hidden',\n width: '1px',\n height: '1px',\n position: 'absolute',\n clip: 'rect(0 0 0 0)',\n clipPath: 'inset(50%)',\n whiteSpace: 'nowrap',\n },\n});\n\n/**\n * Apply styling to the Card slots based on the state.\n */\nexport const useCardStyles_unstable = (state: CardState): CardState => {\n 'use no memo';\n\n const resetStyles = useCardResetStyles();\n const styles = useCardStyles();\n\n const orientationMap = {\n horizontal: styles.orientationHorizontal,\n vertical: styles.orientationVertical,\n };\n\n const sizeMap = {\n small: styles.sizeSmall,\n medium: styles.sizeMedium,\n large: styles.sizeLarge,\n };\n\n const appearanceMap = {\n filled: styles.filled,\n 'filled-alternative': styles.filledAlternative,\n outline: styles.outline,\n subtle: styles.subtle,\n };\n\n const selectedMap = {\n filled: styles.filledInteractiveSelected,\n 'filled-alternative': styles.filledAlternativeInteractiveSelected,\n outline: styles.outlineInteractiveSelected,\n subtle: styles.subtleInteractiveSelected,\n };\n const interactiveMap = {\n filled: styles.filledInteractive,\n 'filled-alternative': styles.filledAlternativeInteractive,\n outline: styles.outlineInteractive,\n subtle: styles.subtleInteractive,\n };\n\n const isSelectableOrInteractive = state.interactive || state.selectable;\n\n const focusedClassName = React.useMemo(() => {\n if (state.selectable) {\n if (state.selectFocused) {\n return styles.selectableFocused;\n }\n\n return '';\n }\n\n return styles.focused;\n }, [state.selectFocused, state.selectable, styles.focused, styles.selectableFocused]);\n\n state.root.className = mergeClasses(\n cardClassNames.root,\n resetStyles,\n orientationMap[state.orientation],\n sizeMap[state.size],\n appearanceMap[state.appearance],\n isSelectableOrInteractive && styles.interactive,\n isSelectableOrInteractive && interactiveMap[state.appearance],\n state.selected && selectedMap[state.appearance],\n focusedClassName,\n isSelectableOrInteractive && styles.highContrastInteractive,\n state.selected && styles.highContrastSelected,\n state.root.className,\n );\n\n if (state.floatingAction) {\n state.floatingAction.className = mergeClasses(\n cardClassNames.floatingAction,\n styles.select,\n state.floatingAction.className,\n );\n }\n\n if (state.checkbox) {\n state.checkbox.className = mergeClasses(cardClassNames.checkbox, styles.hiddenCheckbox, state.checkbox.className);\n }\n\n return state;\n};\n"],"names":["cardCSSVars","cardClassNames","useCardStyles_unstable","root","floatingAction","checkbox","cardSizeVar","cardBorderRadiusVar","focusOutlineStyle","outlineRadius","outlineWidth","tokens","strokeWidthThick","outlineOffset","useCardResetStyles","makeResetStyles","overflow","borderRadius","padding","gap","display","position","boxSizing","color","colorNeutralForeground1","top","left","right","bottom","content","pointerEvents","shorthands","borderStyle","borderWidth","strokeWidthThin","cardHeaderClassNames","cardFooterClassNames","flexShrink","useCardStyles","makeStyles","focused","createFocusOutlineStyle","style","selector","selectableFocused","orientationHorizontal","flexDirection","alignItems","cardPreviewClassNames","marginTop","marginBottom","marginLeft","marginRight","flexGrow","orientationVertical","sizeSmall","borderRadiusSmall","sizeMedium","borderRadiusMedium","sizeLarge","borderRadiusLarge","interactive","textClassNames","filled","backgroundColor","colorNeutralBackground1","boxShadow","shadow4","borderColor","colorTransparentStroke","filledInteractive","cursor","colorNeutralForeground1Hover","colorNeutralBackground1Hover","shadow8","colorNeutralBackground1Pressed","filledInteractiveSelected","colorNeutralBackground1Selected","colorNeutralStroke1Selected","colorNeutralForeground1Selected","filledAlternative","colorNeutralBackground2","filledAlternativeInteractive","colorNeutralForeground2Hover","colorNeutralBackground2Hover","colorNeutralBackground2Pressed","filledAlternativeInteractiveSelected","colorNeutralBackground2Selected","colorNeutralForeground2Selected","outline","colorTransparentBackground","colorNeutralStroke1","outlineInteractive","colorTransparentBackgroundHover","colorNeutralStroke1Hover","colorTransparentBackgroundPressed","colorNeutralStroke1Pressed","outlineInteractiveSelected","colorTransparentBackgroundSelected","subtle","colorSubtleBackground","subtleInteractive","colorSubtleBackgroundHover","colorSubtleBackgroundPressed","subtleInteractiveSelected","colorSubtleBackgroundSelected","highContrastSelected","forcedColorAdjust","highContrastInteractive","select","zIndex","hiddenCheckbox","width","height","clip","clipPath","whiteSpace","state","resetStyles","styles","orientationMap","horizontal","vertical","sizeMap","small","medium","large","appearanceMap","selectedMap","interactiveMap","isSelectableOrInteractive","selectable","focusedClassName","React","useMemo","selectFocused","className","merg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/CqE,6BAA6BD,cAAc,CAACZ,MAAMuB,UAAU,CAAC,EAC7DvB,MAAMwB,QAAQ,IAAIb,WAAW,CAACX,MAAMuB,UAAU,CAAC,EAC/CR,kBACAF,6BAA6BX,OAAOX,uBAAuB,EAC3DS,MAAMwB,QAAQ,IAAItB,OAAOb,oBAAoB,EAC7CW,MAAMlH,IAAI,CAACqI,SAAS;IAGtB,IAAInB,MAAMjH,cAAc,EAAE;QACxBiH,MAAMjH,cAAc,CAACoI,SAAS,GAAGC,IAAAA,oBAAAA,EAC/BxI,eAAeG,cAAc,EAC7BmH,OAAOV,MAAM,EACbQ,MAAMjH,cAAc,CAACoI,SAAS;IAElC;IAEA,IAAInB,MAAMhH,QAAQ,EAAE;QAClBgH,MAAMhH,QAAQ,CAACmI,SAAS,GAAGC,IAAAA,oBAAAA,EAAaxI,eAAeI,QAAQ,EAAEkH,OAAOR,cAAc,EAAEM,MAAMhH,QAAQ,CAACmI,SAAS;IAClH;IAEA,OAAOnB;AACT"}
|
@@ -0,0 +1,51 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
function _export(target, all) {
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
7
|
+
enumerable: true,
|
8
|
+
get: all[name]
|
9
|
+
});
|
10
|
+
}
|
11
|
+
_export(exports, {
|
12
|
+
cardFooterClassNames: function() {
|
13
|
+
return cardFooterClassNames;
|
14
|
+
},
|
15
|
+
useCardFooterStyles_unstable: function() {
|
16
|
+
return useCardFooterStyles_unstable;
|
17
|
+
}
|
18
|
+
});
|
19
|
+
const _react = require("@griffel/react");
|
20
|
+
const cardFooterClassNames = {
|
21
|
+
root: 'fui-CardFooter',
|
22
|
+
action: 'fui-CardFooter__action'
|
23
|
+
};
|
24
|
+
const useStyles = (0, _react.makeStyles)({
|
25
|
+
root: {
|
26
|
+
display: 'flex',
|
27
|
+
flexDirection: 'row',
|
28
|
+
gap: '12px'
|
29
|
+
},
|
30
|
+
action: {
|
31
|
+
marginLeft: 'auto',
|
32
|
+
// when the card is selected or hovered, it has custom high contrast color and background styles
|
33
|
+
// setting this ensures action buttons adopt those colors and are still visible in forced-colors mode
|
34
|
+
'@media (forced-colors: active)': {
|
35
|
+
'& .fui-Button, & .fui-Link': {
|
36
|
+
..._react.shorthands.borderColor('currentColor'),
|
37
|
+
color: 'currentColor',
|
38
|
+
outlineColor: 'currentColor'
|
39
|
+
}
|
40
|
+
}
|
41
|
+
}
|
42
|
+
});
|
43
|
+
const useCardFooterStyles_unstable = (state)=>{
|
44
|
+
'use no memo';
|
45
|
+
const styles = useStyles();
|
46
|
+
state.root.className = (0, _react.mergeClasses)(cardFooterClassNames.root, styles.root, state.root.className);
|
47
|
+
if (state.action) {
|
48
|
+
state.action.className = (0, _react.mergeClasses)(cardFooterClassNames.action, styles.action, state.action.className);
|
49
|
+
}
|
50
|
+
return state;
|
51
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/components/CardFooter/useCardFooterStyles.styles.ts"],"sourcesContent":["import type { SlotClassNames } from '@fluentui/react-utilities';\nimport { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport type { CardFooterSlots, CardFooterState } from './CardFooter.types';\n\n/**\n * Static CSS class names used internally for the component slots.\n */\nexport const cardFooterClassNames: SlotClassNames<CardFooterSlots> = {\n root: 'fui-CardFooter',\n action: 'fui-CardFooter__action',\n};\n\nconst useStyles = makeStyles({\n root: {\n display: 'flex',\n flexDirection: 'row',\n gap: '12px',\n },\n action: {\n marginLeft: 'auto',\n\n // when the card is selected or hovered, it has custom high contrast color and background styles\n // setting this ensures action buttons adopt those colors and are still visible in forced-colors mode\n '@media (forced-colors: active)': {\n '& .fui-Button, & .fui-Link': {\n ...shorthands.borderColor('currentColor'),\n color: 'currentColor',\n outlineColor: 'currentColor',\n },\n },\n },\n});\n\n/**\n * Apply styling to the CardFooter slots based on the state.\n */\nexport const useCardFooterStyles_unstable = (state: CardFooterState): CardFooterState => {\n 'use no memo';\n\n const styles = useStyles();\n state.root.className = mergeClasses(cardFooterClassNames.root, styles.root, state.root.className);\n\n if (state.action) {\n state.action.className = mergeClasses(cardFooterClassNames.action, styles.action, state.action.className);\n }\n\n return state;\n};\n"],"names":["cardFooterClassNames","useCardFooterStyles_unstable","root","action","useStyles","makeStyles","display","flexDirection","gap","marginLeft","shorthands","borderColor","color","outlineColor","state","styles","className","mergeClasses"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAOaA,oBAAAA;eAAAA;;IA6BAC,4BAAAA;eAAAA;;;uBAnCwC;AAM9C,MAAMD,uBAAwD;IACnEE,MAAM;IACNC,QAAQ;AACV;AAEA,MAAMC,YAAYC,IAAAA,iBAAAA,EAAW;IAC3BH,MAAM;QACJI,SAAS;QACTC,eAAe;QACfC,KAAK;IACP;IACAL,QAAQ;QACNM,YAAY;QAEZ,gGAAgG;QAChG,qGAAqG;QACrG,kCAAkC;YAChC,8BAA8B;gBAC5B,GAAGC,iBAAAA,CAAWC,WAAW,CAAC,eAAe;gBACzCC,OAAO;gBACPC,cAAc;YAChB;QACF;IACF;AACF;AAKO,MAAMZ,+BAA+B,CAACa;IAC3C;IAEA,MAAMC,SAASX;IACfU,MAAMZ,IAAI,CAACc,SAAS,GAAGC,IAAAA,mBAAAA,EAAajB,qBAAqBE,IAAI,EAAEa,OAAOb,IAAI,EAAEY,MAAMZ,IAAI,CAACc,SAAS;IAEhG,IAAIF,MAAMX,MAAM,EAAE;QAChBW,MAAMX,MAAM,CAACa,SAAS,GAAGC,IAAAA,mBAAAA,EAAajB,qBAAqBG,MAAM,EAAEY,OAAOZ,MAAM,EAAEW,MAAMX,MAAM,CAACa,SAAS;IAC1G;IAEA,OAAOF;AACT"}
|
@@ -0,0 +1,118 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
function _export(target, all) {
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
7
|
+
enumerable: true,
|
8
|
+
get: all[name]
|
9
|
+
});
|
10
|
+
}
|
11
|
+
_export(exports, {
|
12
|
+
cardHeaderCSSVars: function() {
|
13
|
+
return cardHeaderCSSVars;
|
14
|
+
},
|
15
|
+
cardHeaderClassNames: function() {
|
16
|
+
return cardHeaderClassNames;
|
17
|
+
},
|
18
|
+
useCardHeaderStyles_unstable: function() {
|
19
|
+
return useCardHeaderStyles_unstable;
|
20
|
+
}
|
21
|
+
});
|
22
|
+
const _react = require("@griffel/react");
|
23
|
+
const cardHeaderClassNames = {
|
24
|
+
root: 'fui-CardHeader',
|
25
|
+
image: 'fui-CardHeader__image',
|
26
|
+
header: 'fui-CardHeader__header',
|
27
|
+
description: 'fui-CardHeader__description',
|
28
|
+
action: 'fui-CardHeader__action'
|
29
|
+
};
|
30
|
+
const cardHeaderCSSVars = {
|
31
|
+
cardHeaderGapVar: '--fui-CardHeader--gap'
|
32
|
+
};
|
33
|
+
const useStyles = (0, _react.makeStyles)({
|
34
|
+
root: {
|
35
|
+
[cardHeaderCSSVars.cardHeaderGapVar]: '12px',
|
36
|
+
alignItems: 'center'
|
37
|
+
},
|
38
|
+
image: {
|
39
|
+
display: 'inline-flex',
|
40
|
+
marginRight: `var(${cardHeaderCSSVars.cardHeaderGapVar})`
|
41
|
+
},
|
42
|
+
header: {
|
43
|
+
display: 'flex'
|
44
|
+
},
|
45
|
+
description: {
|
46
|
+
display: 'flex'
|
47
|
+
},
|
48
|
+
action: {
|
49
|
+
marginLeft: `var(${cardHeaderCSSVars.cardHeaderGapVar})`,
|
50
|
+
// when the card is selected or hovered, it has custom high contrast color and background styles
|
51
|
+
// setting this ensures action buttons adopt those colors and are still visible in forced-colors mode
|
52
|
+
'@media (forced-colors: active)': {
|
53
|
+
'& .fui-Button, & .fui-Link': {
|
54
|
+
..._react.shorthands.borderColor('currentColor'),
|
55
|
+
color: 'currentColor',
|
56
|
+
outlineColor: 'currentColor'
|
57
|
+
}
|
58
|
+
}
|
59
|
+
}
|
60
|
+
});
|
61
|
+
const useStylesGrid = (0, _react.makeStyles)({
|
62
|
+
root: {
|
63
|
+
display: 'grid',
|
64
|
+
gridAutoColumns: 'min-content 1fr min-content'
|
65
|
+
},
|
66
|
+
image: {
|
67
|
+
gridColumnStart: '1',
|
68
|
+
gridRowStart: 'span 2'
|
69
|
+
},
|
70
|
+
header: {
|
71
|
+
gridColumnStart: '2',
|
72
|
+
gridRowStart: '1'
|
73
|
+
},
|
74
|
+
description: {
|
75
|
+
gridColumnStart: '2',
|
76
|
+
gridRowStart: '2'
|
77
|
+
},
|
78
|
+
action: {
|
79
|
+
gridColumnStart: '3',
|
80
|
+
gridRowStart: 'span 2'
|
81
|
+
}
|
82
|
+
});
|
83
|
+
const useStylesFlex = (0, _react.makeStyles)({
|
84
|
+
root: {
|
85
|
+
display: 'flex'
|
86
|
+
},
|
87
|
+
header: {
|
88
|
+
flexGrow: 1
|
89
|
+
},
|
90
|
+
image: {},
|
91
|
+
description: {},
|
92
|
+
action: {}
|
93
|
+
});
|
94
|
+
const useCardHeaderStyles_unstable = (state)=>{
|
95
|
+
'use no memo';
|
96
|
+
const styles = useStyles();
|
97
|
+
const stylesGrid = useStylesGrid();
|
98
|
+
const stylesFlex = useStylesFlex();
|
99
|
+
const boxModelStyles = state.description ? stylesGrid : stylesFlex;
|
100
|
+
const getSlotStyles = (slotName)=>{
|
101
|
+
var _state_slotName;
|
102
|
+
return (0, _react.mergeClasses)(cardHeaderClassNames[slotName], styles[slotName], boxModelStyles[slotName], (_state_slotName = state[slotName]) === null || _state_slotName === void 0 ? void 0 : _state_slotName.className);
|
103
|
+
};
|
104
|
+
state.root.className = getSlotStyles('root');
|
105
|
+
if (state.image) {
|
106
|
+
state.image.className = getSlotStyles('image');
|
107
|
+
}
|
108
|
+
if (state.header) {
|
109
|
+
state.header.className = getSlotStyles('header');
|
110
|
+
}
|
111
|
+
if (state.description) {
|
112
|
+
state.description.className = getSlotStyles('description');
|
113
|
+
}
|
114
|
+
if (state.action) {
|
115
|
+
state.action.className = getSlotStyles('action');
|
116
|
+
}
|
117
|
+
return state;
|
118
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/components/CardHeader/useCardHeaderStyles.styles.ts"],"sourcesContent":["import type { SlotClassNames } from '@fluentui/react-utilities';\nimport { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport type { CardHeaderSlots, CardHeaderState } from './CardHeader.types';\n\n/**\n * Static CSS class names used internally for the component slots.\n */\nexport const cardHeaderClassNames: SlotClassNames<CardHeaderSlots> = {\n root: 'fui-CardHeader',\n image: 'fui-CardHeader__image',\n header: 'fui-CardHeader__header',\n description: 'fui-CardHeader__description',\n action: 'fui-CardHeader__action',\n};\n\n/**\n * CSS variable names used internally for uniform styling in CardHeader.\n */\nexport const cardHeaderCSSVars = {\n cardHeaderGapVar: '--fui-CardHeader--gap',\n};\n\nconst useStyles = makeStyles<keyof CardHeaderSlots>({\n root: {\n [cardHeaderCSSVars.cardHeaderGapVar]: '12px',\n alignItems: 'center',\n },\n image: {\n display: 'inline-flex',\n marginRight: `var(${cardHeaderCSSVars.cardHeaderGapVar})`,\n },\n header: {\n display: 'flex',\n },\n description: {\n display: 'flex',\n },\n action: {\n marginLeft: `var(${cardHeaderCSSVars.cardHeaderGapVar})`,\n\n // when the card is selected or hovered, it has custom high contrast color and background styles\n // setting this ensures action buttons adopt those colors and are still visible in forced-colors mode\n '@media (forced-colors: active)': {\n '& .fui-Button, & .fui-Link': {\n ...shorthands.borderColor('currentColor'),\n color: 'currentColor',\n outlineColor: 'currentColor',\n },\n },\n },\n});\n\nconst useStylesGrid = makeStyles<keyof CardHeaderSlots>({\n root: {\n display: 'grid',\n gridAutoColumns: 'min-content 1fr min-content',\n },\n\n image: {\n gridColumnStart: '1',\n gridRowStart: 'span 2',\n },\n\n header: {\n gridColumnStart: '2',\n gridRowStart: '1',\n },\n\n description: {\n gridColumnStart: '2',\n gridRowStart: '2',\n },\n\n action: {\n gridColumnStart: '3',\n gridRowStart: 'span 2',\n },\n});\n\nconst useStylesFlex = makeStyles<keyof CardHeaderSlots>({\n root: {\n display: 'flex',\n },\n\n header: {\n flexGrow: 1,\n },\n\n image: {},\n description: {},\n action: {},\n});\n\n/**\n * Apply styling to the CardHeader slots based on the state.\n */\nexport const useCardHeaderStyles_unstable = (state: CardHeaderState): CardHeaderState => {\n 'use no memo';\n\n const styles = useStyles();\n const stylesGrid = useStylesGrid();\n const stylesFlex = useStylesFlex();\n\n const boxModelStyles = state.description ? stylesGrid : stylesFlex;\n\n const getSlotStyles = (slotName: keyof CardHeaderSlots): string => {\n return mergeClasses(\n cardHeaderClassNames[slotName],\n styles[slotName],\n boxModelStyles[slotName],\n state[slotName]?.className,\n );\n };\n\n state.root.className = getSlotStyles('root');\n\n if (state.image) {\n state.image.className = getSlotStyles('image');\n }\n\n if (state.header) {\n state.header.className = getSlotStyles('header');\n }\n\n if (state.description) {\n state.description.className = getSlotStyles('description');\n }\n\n if (state.action) {\n state.action.className = getSlotStyles('action');\n }\n\n return state;\n};\n"],"names":["cardHeaderCSSVars","cardHeaderClassNames","useCardHeaderStyles_unstable","root","image","header","description","action","cardHeaderGapVar","useStyles","makeStyles","alignItems","display","marginRight","marginLeft","shorthands","borderColor","color","outlineColor","useStylesGrid","gridAutoColumns","gridColumnStart","gridRowStart","useStylesFlex","flexGrow","state","styles","stylesGrid","stylesFlex","boxModelStyles","getSlotStyles","slotName","mergeClasses","className"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAkBaA,iBAAAA;eAAAA;;IAXAC,oBAAAA;eAAAA;;IAyFAC,4BAAAA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