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