@fluentui/react-tabs 9.8.3 → 9.9.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 (50) hide show
  1. package/CHANGELOG.md +25 -2
  2. package/lib/Tab.js.map +1 -1
  3. package/lib/TabList.js.map +1 -1
  4. package/lib/components/Tab/Tab.js.map +1 -1
  5. package/lib/components/Tab/Tab.types.js.map +1 -1
  6. package/lib/components/Tab/index.js.map +1 -1
  7. package/lib/components/Tab/renderTab.js.map +1 -1
  8. package/lib/components/Tab/useTab.js.map +1 -1
  9. package/lib/components/Tab/useTabAnimatedIndicator.styles.raw.js +124 -0
  10. package/lib/components/Tab/useTabAnimatedIndicator.styles.raw.js.map +1 -0
  11. package/lib/components/Tab/useTabStyles.styles.js +17 -3
  12. package/lib/components/Tab/useTabStyles.styles.js.map +1 -1
  13. package/lib/components/Tab/useTabStyles.styles.raw.js +684 -0
  14. package/lib/components/Tab/useTabStyles.styles.raw.js.map +1 -0
  15. package/lib/components/TabList/TabList.js.map +1 -1
  16. package/lib/components/TabList/TabList.types.js.map +1 -1
  17. package/lib/components/TabList/TabListContext.js.map +1 -1
  18. package/lib/components/TabList/index.js.map +1 -1
  19. package/lib/components/TabList/renderTabList.js.map +1 -1
  20. package/lib/components/TabList/useTabList.js.map +1 -1
  21. package/lib/components/TabList/useTabListContextValues.js.map +1 -1
  22. package/lib/components/TabList/useTabListStyles.styles.raw.js +40 -0
  23. package/lib/components/TabList/useTabListStyles.styles.raw.js.map +1 -0
  24. package/lib/index.js.map +1 -1
  25. package/lib-commonjs/Tab.js.map +1 -1
  26. package/lib-commonjs/TabList.js.map +1 -1
  27. package/lib-commonjs/components/Tab/Tab.js.map +1 -1
  28. package/lib-commonjs/components/Tab/Tab.types.js.map +1 -1
  29. package/lib-commonjs/components/Tab/index.js.map +1 -1
  30. package/lib-commonjs/components/Tab/renderTab.js.map +1 -1
  31. package/lib-commonjs/components/Tab/useTab.js.map +1 -1
  32. package/lib-commonjs/components/Tab/useTabAnimatedIndicator.styles.js.map +1 -1
  33. package/lib-commonjs/components/Tab/useTabAnimatedIndicator.styles.raw.js +133 -0
  34. package/lib-commonjs/components/Tab/useTabAnimatedIndicator.styles.raw.js.map +1 -0
  35. package/lib-commonjs/components/Tab/useTabStyles.styles.js +26 -2
  36. package/lib-commonjs/components/Tab/useTabStyles.styles.js.map +1 -1
  37. package/lib-commonjs/components/Tab/useTabStyles.styles.raw.js +680 -0
  38. package/lib-commonjs/components/Tab/useTabStyles.styles.raw.js.map +1 -0
  39. package/lib-commonjs/components/TabList/TabList.js.map +1 -1
  40. package/lib-commonjs/components/TabList/TabList.types.js.map +1 -1
  41. package/lib-commonjs/components/TabList/TabListContext.js.map +1 -1
  42. package/lib-commonjs/components/TabList/index.js.map +1 -1
  43. package/lib-commonjs/components/TabList/renderTabList.js.map +1 -1
  44. package/lib-commonjs/components/TabList/useTabList.js.map +1 -1
  45. package/lib-commonjs/components/TabList/useTabListContextValues.js.map +1 -1
  46. package/lib-commonjs/components/TabList/useTabListStyles.styles.js.map +1 -1
  47. package/lib-commonjs/components/TabList/useTabListStyles.styles.raw.js +56 -0
  48. package/lib-commonjs/components/TabList/useTabListStyles.styles.raw.js.map +1 -0
  49. package/lib-commonjs/index.js.map +1 -1
  50. package/package.json +5 -5
@@ -0,0 +1,684 @@
1
+ import { makeStyles, mergeClasses, shorthands } from '@griffel/react';
2
+ import { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';
3
+ import { tokens, typographyStyles } from '@fluentui/react-theme';
4
+ import { useTabAnimatedIndicatorStyles_unstable } from './useTabAnimatedIndicator.styles';
5
+ export const tabClassNames = {
6
+ root: 'fui-Tab',
7
+ icon: 'fui-Tab__icon',
8
+ content: 'fui-Tab__content'
9
+ };
10
+ const reservedSpaceClassNames = {
11
+ content: 'fui-Tab__content--reserved-space'
12
+ };
13
+ // These should match the constants defined in @fluentui/react-icons
14
+ // This package avoids taking a dependency on the icons package for only the constants.
15
+ const iconClassNames = {
16
+ filled: 'fui-Icon-filled',
17
+ regular: 'fui-Icon-regular'
18
+ };
19
+ /**
20
+ * Styles for the root slot
21
+ */ const useRootStyles = makeStyles({
22
+ root: {
23
+ alignItems: 'center',
24
+ display: 'grid',
25
+ flexShrink: 0,
26
+ gridAutoFlow: 'column',
27
+ gridTemplateColumns: 'auto',
28
+ gridTemplateRows: 'auto',
29
+ outlineStyle: 'none',
30
+ position: 'relative'
31
+ },
32
+ button: {
33
+ alignItems: 'center',
34
+ border: 'none',
35
+ borderRadius: tokens.borderRadiusMedium,
36
+ cursor: 'pointer',
37
+ display: 'grid',
38
+ flexShrink: 0,
39
+ gridAutoFlow: 'column',
40
+ gridTemplateColumns: 'auto',
41
+ gridTemplateRows: 'auto',
42
+ fontFamily: tokens.fontFamilyBase,
43
+ lineHeight: tokens.lineHeightBase300,
44
+ outlineStyle: 'none',
45
+ position: 'relative',
46
+ overflow: 'hidden',
47
+ textTransform: 'none'
48
+ },
49
+ horizontal: {
50
+ justifyContent: 'center'
51
+ },
52
+ vertical: {
53
+ justifyContent: 'start'
54
+ },
55
+ smallHorizontal: {
56
+ columnGap: tokens.spacingHorizontalXXS,
57
+ padding: `${tokens.spacingVerticalSNudge} ${tokens.spacingHorizontalSNudge}`
58
+ },
59
+ smallVertical: {
60
+ // horizontal spacing is deliberate. This is the gap between icon and content.
61
+ columnGap: tokens.spacingHorizontalXXS,
62
+ padding: `${tokens.spacingVerticalXXS} ${tokens.spacingHorizontalSNudge}`
63
+ },
64
+ mediumHorizontal: {
65
+ columnGap: tokens.spacingHorizontalSNudge,
66
+ padding: `${tokens.spacingVerticalM} ${tokens.spacingHorizontalMNudge}`
67
+ },
68
+ mediumVertical: {
69
+ // horizontal spacing is deliberate. This is the gap between icon and content.
70
+ columnGap: tokens.spacingHorizontalSNudge,
71
+ padding: `${tokens.spacingVerticalSNudge} ${tokens.spacingHorizontalMNudge}`
72
+ },
73
+ largeHorizontal: {
74
+ columnGap: tokens.spacingHorizontalSNudge,
75
+ padding: `${tokens.spacingVerticalL} ${tokens.spacingHorizontalMNudge}`
76
+ },
77
+ largeVertical: {
78
+ // horizontal spacing is deliberate. This is the gap between icon and content.
79
+ columnGap: tokens.spacingHorizontalSNudge,
80
+ padding: `${tokens.spacingVerticalS} ${tokens.spacingHorizontalMNudge}`
81
+ },
82
+ transparent: {
83
+ backgroundColor: tokens.colorTransparentBackground,
84
+ ':enabled:hover': {
85
+ backgroundColor: tokens.colorTransparentBackgroundHover
86
+ },
87
+ ':enabled:active': {
88
+ backgroundColor: tokens.colorTransparentBackgroundPressed
89
+ },
90
+ [`& .${tabClassNames.icon}`]: {
91
+ color: tokens.colorNeutralForeground2
92
+ },
93
+ [`:enabled:hover .${tabClassNames.icon}`]: {
94
+ color: tokens.colorNeutralForeground2Hover
95
+ },
96
+ [`:enabled:active .${tabClassNames.icon}`]: {
97
+ color: tokens.colorNeutralForeground2Pressed
98
+ },
99
+ [`& .${tabClassNames.content}`]: {
100
+ color: tokens.colorNeutralForeground2
101
+ },
102
+ [`:enabled:hover .${tabClassNames.content}`]: {
103
+ color: tokens.colorNeutralForeground2Hover
104
+ },
105
+ [`:enabled:active .${tabClassNames.content}`]: {
106
+ color: tokens.colorNeutralForeground2Pressed
107
+ }
108
+ },
109
+ subtle: {
110
+ backgroundColor: tokens.colorSubtleBackground,
111
+ ':enabled:hover': {
112
+ backgroundColor: tokens.colorSubtleBackgroundHover
113
+ },
114
+ ':enabled:active': {
115
+ backgroundColor: tokens.colorSubtleBackgroundPressed
116
+ },
117
+ [`& .${tabClassNames.icon}`]: {
118
+ color: tokens.colorNeutralForeground2
119
+ },
120
+ [`:enabled:hover .${tabClassNames.icon}`]: {
121
+ color: tokens.colorNeutralForeground2Hover
122
+ },
123
+ [`:enabled:active .${tabClassNames.icon}`]: {
124
+ color: tokens.colorNeutralForeground2Pressed
125
+ },
126
+ [`& .${tabClassNames.content}`]: {
127
+ color: tokens.colorNeutralForeground2
128
+ },
129
+ [`:enabled:hover .${tabClassNames.content}`]: {
130
+ color: tokens.colorNeutralForeground2Hover
131
+ },
132
+ [`:enabled:active .${tabClassNames.content}`]: {
133
+ color: tokens.colorNeutralForeground2Pressed
134
+ }
135
+ },
136
+ disabledCursor: {
137
+ cursor: 'not-allowed'
138
+ },
139
+ disabled: {
140
+ backgroundColor: tokens.colorTransparentBackground,
141
+ [`& .${tabClassNames.icon}`]: {
142
+ color: tokens.colorNeutralForegroundDisabled
143
+ },
144
+ [`& .${tabClassNames.content}`]: {
145
+ color: tokens.colorNeutralForegroundDisabled
146
+ }
147
+ },
148
+ selected: {
149
+ [`& .${tabClassNames.icon}`]: {
150
+ color: tokens.colorCompoundBrandForeground1
151
+ },
152
+ [`:enabled:hover .${tabClassNames.icon}`]: {
153
+ color: tokens.colorCompoundBrandForeground1Hover
154
+ },
155
+ [`:enabled:active .${tabClassNames.icon}`]: {
156
+ color: tokens.colorCompoundBrandForeground1Pressed
157
+ },
158
+ [`& .${tabClassNames.content}`]: {
159
+ color: tokens.colorNeutralForeground1
160
+ },
161
+ [`:enabled:hover .${tabClassNames.content}`]: {
162
+ color: tokens.colorNeutralForeground1Hover
163
+ },
164
+ [`:enabled:active .${tabClassNames.content}`]: {
165
+ color: tokens.colorNeutralForeground1Pressed
166
+ }
167
+ }
168
+ });
169
+ const useCircularAppearanceStyles = makeStyles({
170
+ base: {
171
+ borderRadius: tokens.borderRadiusCircular,
172
+ border: `solid ${tokens.strokeWidthThin} ${tokens.colorTransparentStroke}`,
173
+ [`& .${tabClassNames.icon}`]: {
174
+ color: 'inherit'
175
+ },
176
+ [`& .${tabClassNames.content}`]: {
177
+ color: 'inherit'
178
+ }
179
+ },
180
+ small: {
181
+ paddingBlock: `calc(${tokens.spacingVerticalXXS} - ${tokens.strokeWidthThin})`
182
+ },
183
+ medium: {
184
+ paddingBlock: `calc(${tokens.spacingVerticalSNudge} - ${tokens.strokeWidthThin})`
185
+ },
186
+ large: {
187
+ paddingBlock: `calc(${tokens.spacingVerticalS} - ${tokens.strokeWidthThin})`
188
+ },
189
+ subtle: {
190
+ backgroundColor: tokens.colorSubtleBackground,
191
+ color: tokens.colorNeutralForeground2,
192
+ ':enabled:hover': {
193
+ backgroundColor: tokens.colorSubtleBackgroundHover,
194
+ border: `solid ${tokens.strokeWidthThin} ${tokens.colorNeutralStroke1Hover}`,
195
+ color: tokens.colorNeutralForeground2Hover
196
+ },
197
+ ':enabled:active': {
198
+ backgroundColor: tokens.colorSubtleBackgroundPressed,
199
+ border: `solid ${tokens.strokeWidthThin} ${tokens.colorNeutralStroke1Pressed}`,
200
+ color: tokens.colorNeutralForeground2Pressed
201
+ },
202
+ '@media (forced-colors: active)': {
203
+ border: `solid ${tokens.strokeWidthThin} Canvas`
204
+ }
205
+ },
206
+ subtleSelected: {
207
+ backgroundColor: tokens.colorBrandBackground2,
208
+ border: `solid ${tokens.strokeWidthThin} ${tokens.colorCompoundBrandStroke}`,
209
+ color: tokens.colorBrandForeground2,
210
+ ':enabled:hover': {
211
+ backgroundColor: tokens.colorBrandBackground2Hover,
212
+ border: `solid ${tokens.strokeWidthThin} ${tokens.colorCompoundBrandStrokeHover}`,
213
+ color: tokens.colorBrandForeground2Hover
214
+ },
215
+ ':enabled:active': {
216
+ backgroundColor: tokens.colorBrandBackground2Pressed,
217
+ border: `solid ${tokens.strokeWidthThin} ${tokens.colorCompoundBrandStrokePressed}`,
218
+ color: tokens.colorBrandForeground2Pressed
219
+ },
220
+ '@media (forced-colors: active)': {
221
+ border: `solid ${tokens.strokeWidthThin} Highlight`
222
+ }
223
+ },
224
+ subtleDisabled: {
225
+ backgroundColor: tokens.colorSubtleBackground,
226
+ color: tokens.colorNeutralForegroundDisabled
227
+ },
228
+ subtleDisabledSelected: {
229
+ backgroundColor: tokens.colorNeutralBackgroundDisabled,
230
+ border: `solid ${tokens.strokeWidthThin} ${tokens.colorNeutralStrokeDisabled}`,
231
+ color: tokens.colorNeutralForegroundDisabled
232
+ },
233
+ filled: {
234
+ backgroundColor: tokens.colorNeutralBackground3,
235
+ color: tokens.colorNeutralForeground2,
236
+ ':enabled:hover': {
237
+ backgroundColor: tokens.colorNeutralBackground3Hover,
238
+ color: tokens.colorNeutralForeground2Hover
239
+ },
240
+ ':enabled:active': {
241
+ backgroundColor: tokens.colorNeutralBackground3Pressed,
242
+ color: tokens.colorNeutralForeground2Pressed
243
+ },
244
+ '@media (forced-colors: active)': {
245
+ ':enabled:hover': {
246
+ backgroundColor: 'Highlight',
247
+ forcedColorAdjust: 'none',
248
+ [`& .${tabClassNames.content}`]: {
249
+ color: 'HighlightText'
250
+ },
251
+ [`& .${iconClassNames.filled}`]: {
252
+ color: 'HighlightText'
253
+ },
254
+ [`& .${iconClassNames.regular}`]: {
255
+ color: 'HighlightText'
256
+ }
257
+ }
258
+ }
259
+ },
260
+ filledSelected: {
261
+ backgroundColor: tokens.colorBrandBackground,
262
+ color: tokens.colorNeutralForegroundOnBrand,
263
+ ':enabled:hover': {
264
+ backgroundColor: tokens.colorBrandBackgroundHover,
265
+ color: tokens.colorNeutralForegroundOnBrand
266
+ },
267
+ ':enabled:active': {
268
+ backgroundColor: tokens.colorBrandBackgroundPressed,
269
+ color: tokens.colorNeutralForegroundOnBrand
270
+ },
271
+ '@media (forced-colors: active)': {
272
+ ':enabled': {
273
+ backgroundColor: 'ButtonText',
274
+ [`& .${tabClassNames.content}`]: {
275
+ color: 'ButtonFace',
276
+ forcedColorAdjust: 'none'
277
+ }
278
+ },
279
+ [`:enabled .${tabClassNames.icon}`]: {
280
+ color: 'ButtonFace'
281
+ }
282
+ }
283
+ },
284
+ filledDisabled: {
285
+ backgroundColor: tokens.colorNeutralBackgroundDisabled,
286
+ color: tokens.colorNeutralForegroundDisabled
287
+ },
288
+ filledDisabledSelected: {
289
+ backgroundColor: tokens.colorNeutralBackgroundDisabled,
290
+ border: `solid ${tokens.strokeWidthThin} ${tokens.colorNeutralStrokeDisabled}`,
291
+ color: tokens.colorNeutralForegroundDisabled
292
+ }
293
+ });
294
+ /**
295
+ * Focus styles for the root slot
296
+ */ const useFocusStyles = makeStyles({
297
+ // Tab creates a custom focus indicator because the default focus indicator
298
+ // is applied using an ::after pseudo-element on the root. Since the selection
299
+ // indicator uses an ::after pseudo-element on the root, there is a conflict.
300
+ base: createCustomFocusIndicatorStyle({
301
+ ...shorthands.borderColor('transparent'),
302
+ outlineWidth: tokens.strokeWidthThick,
303
+ outlineColor: 'transparent',
304
+ outlineStyle: 'solid',
305
+ boxShadow: `
306
+ ${tokens.shadow4},
307
+ 0 0 0 ${tokens.strokeWidthThick} ${tokens.colorStrokeFocus2}
308
+ `,
309
+ zIndex: 1
310
+ }, {
311
+ enableOutline: true
312
+ }),
313
+ circular: createCustomFocusIndicatorStyle({
314
+ ...shorthands.borderColor('transparent'),
315
+ outlineWidth: tokens.strokeWidthThick,
316
+ outlineColor: 'transparent',
317
+ outlineStyle: 'solid',
318
+ boxShadow: `
319
+ ${tokens.shadow4},
320
+ 0 0 0 ${tokens.strokeWidthThick} ${tokens.colorStrokeFocus2},
321
+ 0 0 0 ${tokens.strokeWidthThin} ${tokens.colorNeutralStrokeOnBrand} inset
322
+ `,
323
+ zIndex: 1
324
+ }, {
325
+ enableOutline: true
326
+ })
327
+ });
328
+ /** Indicator styles for when pending selection */ const usePendingIndicatorStyles = makeStyles({
329
+ base: {
330
+ ':hover::before': {
331
+ backgroundColor: tokens.colorNeutralStroke1Hover,
332
+ borderRadius: tokens.borderRadiusCircular,
333
+ content: '""',
334
+ position: 'absolute'
335
+ },
336
+ ':active::before': {
337
+ backgroundColor: tokens.colorNeutralStroke1Pressed,
338
+ borderRadius: tokens.borderRadiusCircular,
339
+ content: '""',
340
+ position: 'absolute'
341
+ },
342
+ '@media (forced-colors: active)': {
343
+ ':hover::before': {
344
+ backgroundColor: 'Highlight'
345
+ },
346
+ ':active::before': {
347
+ backgroundColor: 'Highlight'
348
+ }
349
+ }
350
+ },
351
+ disabled: {
352
+ ':hover::before': {
353
+ backgroundColor: tokens.colorTransparentStroke
354
+ },
355
+ ':active::before': {
356
+ backgroundColor: tokens.colorTransparentStroke
357
+ },
358
+ '@media (forced-colors: active)': {
359
+ ':hover::before': {
360
+ backgroundColor: 'transparent'
361
+ },
362
+ ':active::before': {
363
+ backgroundColor: 'transparent'
364
+ }
365
+ }
366
+ },
367
+ smallHorizontal: {
368
+ '::before': {
369
+ bottom: 0,
370
+ height: tokens.strokeWidthThick,
371
+ left: tokens.spacingHorizontalSNudge,
372
+ right: tokens.spacingHorizontalSNudge
373
+ }
374
+ },
375
+ smallVertical: {
376
+ '::before': {
377
+ bottom: tokens.spacingVerticalXS,
378
+ left: 0,
379
+ top: tokens.spacingVerticalXS,
380
+ width: tokens.strokeWidthThicker
381
+ }
382
+ },
383
+ mediumHorizontal: {
384
+ '::before': {
385
+ bottom: 0,
386
+ height: tokens.strokeWidthThicker,
387
+ left: tokens.spacingHorizontalM,
388
+ right: tokens.spacingHorizontalM
389
+ }
390
+ },
391
+ mediumVertical: {
392
+ '::before': {
393
+ bottom: tokens.spacingVerticalS,
394
+ left: 0,
395
+ top: tokens.spacingVerticalS,
396
+ width: tokens.strokeWidthThicker
397
+ }
398
+ },
399
+ largeHorizontal: {
400
+ '::before': {
401
+ bottom: 0,
402
+ height: tokens.strokeWidthThicker,
403
+ left: tokens.spacingHorizontalM,
404
+ right: tokens.spacingHorizontalM
405
+ }
406
+ },
407
+ largeVertical: {
408
+ '::before': {
409
+ bottom: tokens.spacingVerticalMNudge,
410
+ left: 0,
411
+ top: tokens.spacingVerticalMNudge,
412
+ width: tokens.strokeWidthThicker
413
+ }
414
+ }
415
+ });
416
+ const useActiveIndicatorStyles = makeStyles({
417
+ base: {
418
+ '::after': {
419
+ backgroundColor: tokens.colorTransparentStroke,
420
+ borderRadius: tokens.borderRadiusCircular,
421
+ content: '""',
422
+ position: 'absolute'
423
+ }
424
+ },
425
+ selected: {
426
+ '::after': {
427
+ backgroundColor: tokens.colorCompoundBrandStroke
428
+ },
429
+ ':enabled:hover::after': {
430
+ backgroundColor: tokens.colorCompoundBrandStrokeHover
431
+ },
432
+ ':enabled:active::after': {
433
+ backgroundColor: tokens.colorCompoundBrandStrokePressed
434
+ },
435
+ '@media (forced-colors: active)': {
436
+ '::after': {
437
+ backgroundColor: 'ButtonText'
438
+ },
439
+ ':enabled:hover::after': {
440
+ backgroundColor: 'ButtonText'
441
+ },
442
+ ':enabled:active::after': {
443
+ backgroundColor: 'ButtonText'
444
+ }
445
+ }
446
+ },
447
+ disabled: {
448
+ '::after': {
449
+ backgroundColor: tokens.colorNeutralForegroundDisabled
450
+ }
451
+ },
452
+ smallHorizontal: {
453
+ '::after': {
454
+ bottom: 0,
455
+ height: tokens.strokeWidthThick,
456
+ left: tokens.spacingHorizontalSNudge,
457
+ right: tokens.spacingHorizontalSNudge
458
+ }
459
+ },
460
+ smallVertical: {
461
+ '::after': {
462
+ bottom: tokens.spacingVerticalXS,
463
+ left: '0',
464
+ top: tokens.spacingVerticalXS,
465
+ width: tokens.strokeWidthThicker
466
+ }
467
+ },
468
+ mediumHorizontal: {
469
+ '::after': {
470
+ bottom: '0',
471
+ height: tokens.strokeWidthThicker,
472
+ left: tokens.spacingHorizontalM,
473
+ right: tokens.spacingHorizontalM
474
+ }
475
+ },
476
+ mediumVertical: {
477
+ '::after': {
478
+ bottom: tokens.spacingVerticalS,
479
+ left: 0,
480
+ top: tokens.spacingVerticalS,
481
+ width: tokens.strokeWidthThicker
482
+ }
483
+ },
484
+ largeHorizontal: {
485
+ '::after': {
486
+ bottom: 0,
487
+ height: tokens.strokeWidthThicker,
488
+ left: tokens.spacingHorizontalM,
489
+ right: tokens.spacingHorizontalM
490
+ }
491
+ },
492
+ largeVertical: {
493
+ '::after': {
494
+ bottom: tokens.spacingVerticalMNudge,
495
+ left: 0,
496
+ top: tokens.spacingVerticalMNudge,
497
+ width: tokens.strokeWidthThicker
498
+ }
499
+ }
500
+ });
501
+ /**
502
+ * Styles for the icon slot.
503
+ */ const useIconStyles = makeStyles({
504
+ base: {
505
+ gridColumnStart: 1,
506
+ gridRowStart: 1,
507
+ alignItems: 'center',
508
+ display: 'inline-flex',
509
+ justifyContent: 'center',
510
+ overflow: 'hidden',
511
+ [`& .${iconClassNames.filled}`]: {
512
+ display: 'none'
513
+ },
514
+ [`& .${iconClassNames.regular}`]: {
515
+ display: 'inline'
516
+ }
517
+ },
518
+ // per design, the small and medium font sizes are the same.
519
+ // the size prop only affects spacing.
520
+ small: {
521
+ fontSize: '20px',
522
+ height: '20px',
523
+ width: '20px'
524
+ },
525
+ medium: {
526
+ fontSize: '20px',
527
+ height: '20px',
528
+ width: '20px'
529
+ },
530
+ large: {
531
+ fontSize: '24px',
532
+ height: '24px',
533
+ width: '24px'
534
+ },
535
+ selected: {
536
+ [`& .${iconClassNames.filled}`]: {
537
+ display: 'inline'
538
+ },
539
+ [`& .${iconClassNames.regular}`]: {
540
+ display: 'none'
541
+ }
542
+ }
543
+ });
544
+ /**
545
+ * Styles for the content slot (children)
546
+ */ const useContentStyles = makeStyles({
547
+ base: {
548
+ ...typographyStyles.body1,
549
+ overflow: 'hidden',
550
+ // content padding is the same for medium & small, horizontal & vertical
551
+ padding: `${tokens.spacingVerticalNone} ${tokens.spacingHorizontalXXS}`
552
+ },
553
+ selected: {
554
+ ...typographyStyles.body1Strong
555
+ },
556
+ large: {
557
+ ...typographyStyles.body2
558
+ },
559
+ largeSelected: {
560
+ ...typographyStyles.subtitle2
561
+ },
562
+ noIconBefore: {
563
+ gridColumnStart: 1,
564
+ gridRowStart: 1
565
+ },
566
+ iconBefore: {
567
+ gridColumnStart: 2,
568
+ gridRowStart: 1
569
+ },
570
+ placeholder: {
571
+ visibility: 'hidden'
572
+ }
573
+ });
574
+ /**
575
+ * Apply styling to the Tab slots based on the state
576
+ */ export const useTabStyles_unstable = (state)=>{
577
+ 'use no memo';
578
+ useTabIndicatorStyles_unstable(state);
579
+ useTabButtonStyles_unstable(state, state.root);
580
+ useTabContentStyles_unstable(state);
581
+ return state;
582
+ };
583
+ /**
584
+ * Applies styles for the Tab indicator based on its current state.
585
+ *
586
+ * This hook is typically used internally by `useTabStyles_unstable`. You should
587
+ * only use it directly if you're creating a custom `Tab` component.
588
+ *
589
+ * @param state - The `Tab` component's current state
590
+ * @returns The state object with updated button styles
591
+ */ export const useTabIndicatorStyles_unstable = (state)=>{
592
+ 'use no memo';
593
+ const rootStyles = useRootStyles();
594
+ const pendingIndicatorStyles = usePendingIndicatorStyles();
595
+ const activeIndicatorStyles = useActiveIndicatorStyles();
596
+ const { appearance, disabled, selected, size, vertical } = state;
597
+ const classes = [
598
+ tabClassNames.root,
599
+ rootStyles.root
600
+ ];
601
+ if (appearance !== 'subtle-circular' && appearance !== 'filled-circular') {
602
+ classes.push(// pending indicator (before pseudo element)
603
+ pendingIndicatorStyles.base, size === 'small' && (vertical ? pendingIndicatorStyles.smallVertical : pendingIndicatorStyles.smallHorizontal), size === 'medium' && (vertical ? pendingIndicatorStyles.mediumVertical : pendingIndicatorStyles.mediumHorizontal), size === 'large' && (vertical ? pendingIndicatorStyles.largeVertical : pendingIndicatorStyles.largeHorizontal), disabled && pendingIndicatorStyles.disabled, // active indicator (after pseudo element)
604
+ selected && activeIndicatorStyles.base, selected && !disabled && activeIndicatorStyles.selected, selected && size === 'small' && (vertical ? activeIndicatorStyles.smallVertical : activeIndicatorStyles.smallHorizontal), selected && size === 'medium' && (vertical ? activeIndicatorStyles.mediumVertical : activeIndicatorStyles.mediumHorizontal), selected && size === 'large' && (vertical ? activeIndicatorStyles.largeVertical : activeIndicatorStyles.largeHorizontal), selected && disabled && activeIndicatorStyles.disabled);
605
+ }
606
+ state.root.className = mergeClasses(...classes, state.root.className);
607
+ useTabAnimatedIndicatorStyles_unstable(state);
608
+ return state;
609
+ };
610
+ /**
611
+ * Applies styles to the Tab button slot based on its current state.
612
+ *
613
+ * This hook is typically used internally by `useTabStyles_unstable`. You should
614
+ * only use it directly if you're creating a custom `Tab` component.
615
+ *
616
+ * @param state - The Tab component's current state
617
+ * @param slot - The button slot of the Tab component
618
+ * @returns The state object with updated button styles
619
+ */ export const useTabButtonStyles_unstable = (state, slot)=>{
620
+ 'use no memo';
621
+ const rootStyles = useRootStyles();
622
+ const focusStyles = useFocusStyles();
623
+ const circularStyles = useCircularAppearanceStyles();
624
+ const { appearance, disabled, selected, size, vertical } = state;
625
+ const isSubtleCircular = appearance === 'subtle-circular';
626
+ const isFilledCircular = appearance === 'filled-circular';
627
+ const isCircular = isSubtleCircular || isFilledCircular;
628
+ const circularAppearance = [
629
+ circularStyles.base,
630
+ focusStyles.circular,
631
+ // sizes
632
+ size === 'small' && circularStyles.small,
633
+ size === 'medium' && circularStyles.medium,
634
+ size === 'large' && circularStyles.large,
635
+ // subtle-circular appearance
636
+ isSubtleCircular && circularStyles.subtle,
637
+ selected && isSubtleCircular && circularStyles.subtleSelected,
638
+ disabled && isSubtleCircular && circularStyles.subtleDisabled,
639
+ selected && disabled && isSubtleCircular && circularStyles.subtleDisabledSelected,
640
+ // filled-circular appearance
641
+ isFilledCircular && circularStyles.filled,
642
+ selected && isFilledCircular && circularStyles.filledSelected,
643
+ disabled && isFilledCircular && circularStyles.filledDisabled,
644
+ selected && disabled && isFilledCircular && circularStyles.filledDisabledSelected
645
+ ];
646
+ const regularAppearance = [
647
+ focusStyles.base,
648
+ !disabled && appearance === 'subtle' && rootStyles.subtle,
649
+ !disabled && appearance === 'transparent' && rootStyles.transparent,
650
+ !disabled && selected && rootStyles.selected,
651
+ disabled && rootStyles.disabled
652
+ ];
653
+ slot.className = mergeClasses(rootStyles.button, // orientation
654
+ vertical ? rootStyles.vertical : rootStyles.horizontal, // size
655
+ size === 'small' && (vertical ? rootStyles.smallVertical : rootStyles.smallHorizontal), size === 'medium' && (vertical ? rootStyles.mediumVertical : rootStyles.mediumHorizontal), size === 'large' && (vertical ? rootStyles.largeVertical : rootStyles.largeHorizontal), ...isCircular ? circularAppearance : regularAppearance, disabled && rootStyles.disabledCursor, slot.className);
656
+ return state;
657
+ };
658
+ /**
659
+ * Applies styles to the Tab content slot based on its current state.
660
+ *
661
+ * This hook is typically used internally by `useTabStyles_unstable`. You should
662
+ * only use it directly if you're creating a custom `Tab` component.
663
+ *
664
+ * @param state - The Tab component's current state
665
+ * @returns The state object with updated content styles
666
+ */ export const useTabContentStyles_unstable = (state)=>{
667
+ 'use no memo';
668
+ const iconStyles = useIconStyles();
669
+ const contentStyles = useContentStyles();
670
+ const { selected, size } = state;
671
+ if (state.icon) {
672
+ state.icon.className = mergeClasses(tabClassNames.icon, iconStyles.base, iconStyles[size], selected && iconStyles.selected, state.icon.className);
673
+ }
674
+ // This needs to be before state.content.className is updated
675
+ if (state.contentReservedSpace) {
676
+ state.contentReservedSpace.className = mergeClasses(reservedSpaceClassNames.content, contentStyles.base, size === 'large' ? contentStyles.largeSelected : contentStyles.selected, state.icon ? contentStyles.iconBefore : contentStyles.noIconBefore, contentStyles.placeholder, state.content.className);
677
+ // FIXME: this is a deprecated API
678
+ // should be removed in the next major version
679
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
680
+ state.contentReservedSpaceClassName = state.contentReservedSpace.className;
681
+ }
682
+ state.content.className = mergeClasses(tabClassNames.content, contentStyles.base, size === 'large' && contentStyles.large, selected && (size === 'large' ? contentStyles.largeSelected : contentStyles.selected), state.icon ? contentStyles.iconBefore : contentStyles.noIconBefore, state.content.className);
683
+ return state;
684
+ };