@auth0/quantum-product 2.10.8 → 2.12.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/dropdown-menu/dropdown-menu-list-item/dropdown-menu-list-item.js +2 -1
- package/dropdown-menu/dropdown-menu.js +1 -1
- package/esm/dropdown-menu/dropdown-menu-list-item/dropdown-menu-list-item.js +2 -1
- package/esm/dropdown-menu/dropdown-menu.js +1 -1
- package/esm/label/label.js +6 -0
- package/esm/switch/switch-classes.js +1 -1
- package/esm/switch/switch-overrides.js +119 -41
- package/esm/switch/switch.js +104 -10
- package/esm/tabs/tab/tab-override.js +18 -7
- package/esm/tabs/tab-list/tab-list-overrides.js +94 -0
- package/esm/tabs/tab-list/tab-list-utils.js +29 -0
- package/esm/tabs/tab-list/tab-list.js +111 -10
- package/esm/tabs/tab-list/use-tab-list-indicator/index.js +189 -0
- package/esm/tabs/tab-list/use-tab-list-keyboard/index.js +56 -0
- package/esm/tabs/tab-list/use-tab-list-overflow/index.js +149 -0
- package/esm/tabs/tabs-overrides.js +6 -7
- package/esm/tabs/tabs.js +12 -20
- package/label/label.d.ts +2 -2
- package/label/label.js +6 -0
- package/package.json +6 -1
- package/page/page-header/page-header.d.ts +1 -1
- package/switch/switch-classes.d.ts +1 -1
- package/switch/switch-classes.js +1 -1
- package/switch/switch-overrides.js +119 -41
- package/switch/switch.d.ts +1 -1
- package/switch/switch.js +103 -9
- package/tabs/tab/tab-override.d.ts +1 -1
- package/tabs/tab/tab-override.js +18 -7
- package/tabs/tab/tab.d.ts +1 -1
- package/tabs/tab-list/tab-list-overrides.d.ts +12 -0
- package/tabs/tab-list/tab-list-overrides.js +97 -0
- package/tabs/tab-list/tab-list-utils.d.ts +32 -0
- package/tabs/tab-list/tab-list-utils.js +70 -0
- package/tabs/tab-list/tab-list.d.ts +9 -2
- package/tabs/tab-list/tab-list.js +111 -11
- package/tabs/tab-list/use-tab-list-indicator/index.d.ts +26 -0
- package/tabs/tab-list/use-tab-list-indicator/index.js +226 -0
- package/tabs/tab-list/use-tab-list-keyboard/index.d.ts +13 -0
- package/tabs/tab-list/use-tab-list-keyboard/index.js +93 -0
- package/tabs/tab-list/use-tab-list-overflow/index.d.ts +25 -0
- package/tabs/tab-list/use-tab-list-overflow/index.js +186 -0
- package/tabs/tabs-overrides.d.ts +1 -1
- package/tabs/tabs-overrides.js +6 -7
- package/tabs/tabs.js +12 -20
|
@@ -70,7 +70,7 @@ var classes_1 = require("../../styles/classes");
|
|
|
70
70
|
var Root = (0, styled_1.styled)(menu_1.MenuItem, { name: dropdown_menu_list_item_classes_1.dropdownMenuListItemComponentName, slot: 'Root' })(function (_a) {
|
|
71
71
|
var _b, _c, _d, _e;
|
|
72
72
|
var theme = _a.theme, ownerState = _a.ownerState;
|
|
73
|
-
return (__assign(__assign(__assign(__assign(__assign(__assign(__assign({}, theme.typography.caption), { fontWeight: theme.typography.fontWeightRegular, color: theme.tokens.color_fg_link_subtle, height: 'auto', display: 'flex', alignItems: 'center', width: '100%', padding: theme.spacing(0.5, 1), borderRadius:
|
|
73
|
+
return (__assign(__assign(__assign(__assign(__assign(__assign(__assign({}, theme.typography.caption), { fontWeight: theme.typography.fontWeightRegular, color: theme.tokens.color_fg_link_subtle, minHeight: ownerState.isDetailed ? 'auto' : theme.spacing(4), height: 'auto', display: 'flex', alignItems: 'center', width: '100%', padding: theme.spacing(0.5, 1), borderRadius: theme.spacing(0.5), transition: theme.transitions.create(['color', 'background-color', 'box-shadow'], {
|
|
74
74
|
duration: theme.transitions.duration.shortest,
|
|
75
75
|
}), '&:active,&:hover': {
|
|
76
76
|
color: theme.tokens.color_fg_link_subtle_hover,
|
|
@@ -97,6 +97,7 @@ var Root = (0, styled_1.styled)(menu_1.MenuItem, { name: dropdown_menu_list_item
|
|
|
97
97
|
opacity: 1,
|
|
98
98
|
color: theme.tokens.color_fg_disabled,
|
|
99
99
|
} }), (ownerState.size === 'large' && {
|
|
100
|
+
minHeight: ownerState.isDetailed ? 'auto' : theme.spacing(5),
|
|
100
101
|
padding: theme.spacing(0.75, 1.5),
|
|
101
102
|
})), (ownerState.color === 'danger' && (_b = {
|
|
102
103
|
color: theme.tokens.color_fg_link_danger
|
|
@@ -76,7 +76,7 @@ var Root = (0, styled_1.styled)(popover_1.Popover, { name: dropdown_menu_classes
|
|
|
76
76
|
},
|
|
77
77
|
_b["& .".concat(dropdown_menu_classes_1.dropdownMenuClasses.paper)] = __assign({
|
|
78
78
|
// taken from MUI's menu component
|
|
79
|
-
maxHeight: 'calc(100% - 96px)', minWidth: theme.typography.pxToRem(180), WebkitOverflowScrolling: 'touch', padding: theme.spacing(1), borderRadius:
|
|
79
|
+
maxHeight: 'calc(100% - 96px)', minWidth: theme.typography.pxToRem(180), WebkitOverflowScrolling: 'touch', padding: theme.spacing(1), borderRadius: theme.spacing(1.25), border: "1px solid ".concat(theme.tokens.color_border_default), borderColor: theme.tokens.color_border_default, boxShadow: "0px 33px 80px rgba(0, 0, 0, 0.07), 0px 13.7866px 33.4221px rgba(0, 0, 0, 0.0503198), 0px 7.37098px 17.869px rgba(0, 0, 0, 0.0417275), 0px 4.13211px 10.0172px rgba(0, 0, 0, 0.035), 0px 2.19453px 5.32008px rgba(0, 0, 0, 0.0282725), 0px 0.913195px 2.21381px rgba(0, 0, 0, 0.0196802)" }, (ownerState.size === 'large' && {
|
|
80
80
|
padding: theme.spacing(1.5),
|
|
81
81
|
minWidth: theme.typography.pxToRem(260),
|
|
82
82
|
})),
|
|
@@ -31,7 +31,7 @@ import { useMergedClasses } from '../../styles/classes';
|
|
|
31
31
|
var Root = styled(MenuItem, { name: dropdownMenuListItemComponentName, slot: 'Root' })(function (_a) {
|
|
32
32
|
var _b, _c, _d, _e;
|
|
33
33
|
var theme = _a.theme, ownerState = _a.ownerState;
|
|
34
|
-
return (__assign(__assign(__assign(__assign(__assign(__assign(__assign({}, theme.typography.caption), { fontWeight: theme.typography.fontWeightRegular, color: theme.tokens.color_fg_link_subtle, height: 'auto', display: 'flex', alignItems: 'center', width: '100%', padding: theme.spacing(0.5, 1), borderRadius:
|
|
34
|
+
return (__assign(__assign(__assign(__assign(__assign(__assign(__assign({}, theme.typography.caption), { fontWeight: theme.typography.fontWeightRegular, color: theme.tokens.color_fg_link_subtle, minHeight: ownerState.isDetailed ? 'auto' : theme.spacing(4), height: 'auto', display: 'flex', alignItems: 'center', width: '100%', padding: theme.spacing(0.5, 1), borderRadius: theme.spacing(0.5), transition: theme.transitions.create(['color', 'background-color', 'box-shadow'], {
|
|
35
35
|
duration: theme.transitions.duration.shortest,
|
|
36
36
|
}), '&:active,&:hover': {
|
|
37
37
|
color: theme.tokens.color_fg_link_subtle_hover,
|
|
@@ -58,6 +58,7 @@ var Root = styled(MenuItem, { name: dropdownMenuListItemComponentName, slot: 'Ro
|
|
|
58
58
|
opacity: 1,
|
|
59
59
|
color: theme.tokens.color_fg_disabled,
|
|
60
60
|
} }), (ownerState.size === 'large' && {
|
|
61
|
+
minHeight: ownerState.isDetailed ? 'auto' : theme.spacing(5),
|
|
61
62
|
padding: theme.spacing(0.75, 1.5),
|
|
62
63
|
})), (ownerState.color === 'danger' && (_b = {
|
|
63
64
|
color: theme.tokens.color_fg_link_danger
|
|
@@ -37,7 +37,7 @@ var Root = styled(Popover, { name: dropdownMenuComponentName, slot: 'Root' })(fu
|
|
|
37
37
|
},
|
|
38
38
|
_b["& .".concat(dropdownMenuClasses.paper)] = __assign({
|
|
39
39
|
// taken from MUI's menu component
|
|
40
|
-
maxHeight: 'calc(100% - 96px)', minWidth: theme.typography.pxToRem(180), WebkitOverflowScrolling: 'touch', padding: theme.spacing(1), borderRadius:
|
|
40
|
+
maxHeight: 'calc(100% - 96px)', minWidth: theme.typography.pxToRem(180), WebkitOverflowScrolling: 'touch', padding: theme.spacing(1), borderRadius: theme.spacing(1.25), border: "1px solid ".concat(theme.tokens.color_border_default), borderColor: theme.tokens.color_border_default, boxShadow: "0px 33px 80px rgba(0, 0, 0, 0.07), 0px 13.7866px 33.4221px rgba(0, 0, 0, 0.0503198), 0px 7.37098px 17.869px rgba(0, 0, 0, 0.0417275), 0px 4.13211px 10.0172px rgba(0, 0, 0, 0.035), 0px 2.19453px 5.32008px rgba(0, 0, 0, 0.0282725), 0px 0.913195px 2.21381px rgba(0, 0, 0, 0.0196802)" }, (ownerState.size === 'large' && {
|
|
41
41
|
padding: theme.spacing(1.5),
|
|
42
42
|
minWidth: theme.typography.pxToRem(260),
|
|
43
43
|
})),
|
package/esm/label/label.js
CHANGED
|
@@ -35,6 +35,12 @@ var getReleaseStageLabelProps = function (productReleaseStage, productReleaseSta
|
|
|
35
35
|
labelProps.children = productReleaseStageLabel !== null && productReleaseStageLabel !== void 0 ? productReleaseStageLabel : 'New';
|
|
36
36
|
labelProps.color = 'primary';
|
|
37
37
|
break;
|
|
38
|
+
case 'developerPreview':
|
|
39
|
+
labelProps.color = 'primary';
|
|
40
|
+
productReleaseStageAbbr
|
|
41
|
+
? (labelProps.children = productReleaseStageLabel !== null && productReleaseStageLabel !== void 0 ? productReleaseStageLabel : 'Preview')
|
|
42
|
+
: (labelProps.children = productReleaseStageLabel !== null && productReleaseStageLabel !== void 0 ? productReleaseStageLabel : 'Developer Preview');
|
|
43
|
+
break;
|
|
38
44
|
case 'beta':
|
|
39
45
|
labelProps.children = productReleaseStageLabel !== null && productReleaseStageLabel !== void 0 ? productReleaseStageLabel : 'Beta';
|
|
40
46
|
labelProps.color = 'primary';
|
|
@@ -3,4 +3,4 @@ export var switchComponentName = 'QuantumSwitch';
|
|
|
3
3
|
export function getSwitchUtilityClass(slot) {
|
|
4
4
|
return generateUtilityClass(switchComponentName, slot);
|
|
5
5
|
}
|
|
6
|
-
export var switchClasses = generateUtilityClasses(switchComponentName, ['switch', 'formControlLabel']);
|
|
6
|
+
export var switchClasses = generateUtilityClasses(switchComponentName, ['switch', 'formControlLabel', 'pressing']);
|
|
@@ -10,82 +10,160 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { switchClasses } from '@mui/material/Switch';
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
import { switchClasses as quantumSwitchClasses } from './switch-classes';
|
|
14
|
+
var SWITCH_DIMENSIONS_BY_SIZE = {
|
|
15
|
+
medium: {
|
|
16
|
+
heightPx: 24,
|
|
17
|
+
widthPx: 40,
|
|
18
|
+
thumbSizePx: 22,
|
|
19
|
+
thumbActiveWidthPx: 28,
|
|
20
|
+
thumbEndPositionPx: 16,
|
|
21
|
+
},
|
|
22
|
+
small: {
|
|
23
|
+
heightPx: 20,
|
|
24
|
+
widthPx: 32,
|
|
25
|
+
thumbSizePx: 18,
|
|
26
|
+
thumbActiveWidthPx: 26,
|
|
27
|
+
thumbEndPositionPx: 12,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
var getSwitchSizeStyles = function (size, pxToRem) {
|
|
31
|
+
var _a, _b, _c;
|
|
32
|
+
var dimensions = SWITCH_DIMENSIONS_BY_SIZE[size];
|
|
33
|
+
var thumbActiveExtensionPx = dimensions.thumbActiveWidthPx - dimensions.thumbSizePx;
|
|
34
|
+
return _a = {
|
|
35
|
+
width: pxToRem(dimensions.widthPx),
|
|
36
|
+
height: pxToRem(dimensions.heightPx),
|
|
37
|
+
'&:active': (_b = {},
|
|
38
|
+
_b["& .".concat(switchClasses.switchBase, ":not(.").concat(switchClasses.checked, "):not(.").concat(switchClasses.disabled, ") .").concat(switchClasses.thumb, "::before")] = {
|
|
39
|
+
insetInlineEnd: pxToRem(-thumbActiveExtensionPx),
|
|
40
|
+
},
|
|
41
|
+
_b["& .".concat(switchClasses.switchBase, ".").concat(switchClasses.checked, ":not(.").concat(switchClasses.disabled, ") .").concat(switchClasses.thumb, "::before")] = {
|
|
42
|
+
insetInlineStart: pxToRem(-thumbActiveExtensionPx),
|
|
43
|
+
},
|
|
44
|
+
_b)
|
|
45
|
+
},
|
|
46
|
+
_a["&.".concat(quantumSwitchClasses.pressing)] = (_c = {},
|
|
47
|
+
_c["& .".concat(switchClasses.switchBase, ":not(.").concat(switchClasses.checked, "):not(.").concat(switchClasses.disabled, ") .").concat(switchClasses.thumb, "::before")] = {
|
|
48
|
+
insetInlineEnd: pxToRem(-thumbActiveExtensionPx),
|
|
49
|
+
},
|
|
50
|
+
_c["& .".concat(switchClasses.switchBase, ".").concat(switchClasses.checked, ":not(.").concat(switchClasses.disabled, ") .").concat(switchClasses.thumb, "::before")] = {
|
|
51
|
+
insetInlineStart: pxToRem(-thumbActiveExtensionPx),
|
|
52
|
+
},
|
|
53
|
+
_c),
|
|
54
|
+
_a["& .".concat(switchClasses.track)] = {
|
|
55
|
+
borderRadius: pxToRem(dimensions.heightPx * 2),
|
|
56
|
+
},
|
|
57
|
+
_a["& .".concat(switchClasses.switchBase)] = {
|
|
58
|
+
padding: pxToRem((dimensions.heightPx - dimensions.thumbSizePx) / 2),
|
|
59
|
+
},
|
|
60
|
+
_a["& .".concat(switchClasses.switchBase, ".").concat(switchClasses.checked)] = {
|
|
61
|
+
transform: "translateX(".concat(pxToRem(dimensions.thumbEndPositionPx), ")"),
|
|
62
|
+
},
|
|
63
|
+
_a["& .".concat(switchClasses.thumb)] = {
|
|
64
|
+
height: pxToRem(dimensions.thumbSizePx),
|
|
65
|
+
width: pxToRem(dimensions.thumbSizePx),
|
|
66
|
+
borderRadius: pxToRem(dimensions.thumbSizePx),
|
|
67
|
+
},
|
|
68
|
+
_a["& .".concat(switchClasses.thumb, "::before")] = {
|
|
69
|
+
borderRadius: pxToRem(dimensions.thumbSizePx),
|
|
70
|
+
},
|
|
71
|
+
_a;
|
|
17
72
|
};
|
|
18
73
|
export var createMuiSwitchOverrides = function (_a) {
|
|
19
|
-
var _b, _c, _d, _e, _f, _g, _h;
|
|
20
|
-
var typography = _a.typography, tokens = _a.tokens, mixins = _a.mixins;
|
|
74
|
+
var _b, _c, _d, _e, _f, _g, _h, _j;
|
|
75
|
+
var typography = _a.typography, tokens = _a.tokens, transitions = _a.transitions, mixins = _a.mixins;
|
|
21
76
|
return {
|
|
22
77
|
defaultProps: {
|
|
23
78
|
color: 'primary',
|
|
24
79
|
size: 'medium',
|
|
25
80
|
},
|
|
26
81
|
styleOverrides: {
|
|
27
|
-
root: {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
},
|
|
36
|
-
colorPrimary: (_c = {
|
|
82
|
+
root: __assign(__assign({ padding: 0, overflow: 'visible' }, getSwitchSizeStyles('medium', typography.pxToRem)), (_b = {}, _b["& .".concat(switchClasses.switchBase, ".").concat(switchClasses.disabled)] = {
|
|
83
|
+
cursor: 'not-allowed',
|
|
84
|
+
}, _b["& .".concat(switchClasses.switchBase, ".").concat(switchClasses.disabled, " + .").concat(switchClasses.track)] = {
|
|
85
|
+
cursor: 'not-allowed',
|
|
86
|
+
}, _b['&:focus-within,&.Mui-focused'] = (_c = {},
|
|
87
|
+
_c["& .".concat(switchClasses.track)] = __assign({ outlineOffset: 2 }, mixins.focusRing()),
|
|
88
|
+
_c), _b)),
|
|
89
|
+
colorPrimary: (_d = {
|
|
37
90
|
color: tokens.color_bg_layer
|
|
38
91
|
},
|
|
39
|
-
|
|
92
|
+
_d["&.".concat(switchClasses.checked)] = (_e = {
|
|
40
93
|
color: tokens.color_bg_layer
|
|
41
94
|
},
|
|
42
|
-
|
|
95
|
+
_e["& + .".concat(switchClasses.track)] = {
|
|
43
96
|
backgroundColor: tokens.color_bg_switch_on,
|
|
44
97
|
},
|
|
45
|
-
|
|
98
|
+
_e["&.".concat(switchClasses.disabled)] = (_f = {
|
|
46
99
|
color: tokens.color_bg_layer
|
|
47
100
|
},
|
|
48
|
-
|
|
101
|
+
_f["& + .".concat(switchClasses.track)] = {
|
|
49
102
|
backgroundColor: tokens.color_bg_switch_on_disabled,
|
|
50
103
|
},
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
104
|
+
_f),
|
|
105
|
+
_e),
|
|
106
|
+
_d["&.".concat(switchClasses.disabled)] = (_g = {
|
|
54
107
|
color: tokens.color_bg_layer
|
|
55
108
|
},
|
|
56
|
-
|
|
109
|
+
_g["& + .".concat(switchClasses.track)] = {
|
|
57
110
|
opacity: 1,
|
|
58
111
|
backgroundColor: tokens.color_bg_disabled,
|
|
59
112
|
},
|
|
60
|
-
|
|
61
|
-
|
|
113
|
+
_g),
|
|
114
|
+
_d),
|
|
62
115
|
track: {
|
|
63
116
|
opacity: 1,
|
|
64
|
-
backgroundColor: tokens.
|
|
65
|
-
|
|
117
|
+
backgroundColor: tokens.color_bg_layer_alternate_bold,
|
|
118
|
+
boxShadow: "".concat(mixins.borderAsBoxShadow(tokens.color_border_default), ", 0 1px 2px rgba(0, 0, 0, 0.08) inset"),
|
|
119
|
+
transition: transitions.create(['background-color', 'box-shadow'], {
|
|
120
|
+
duration: transitions.duration.shorter,
|
|
121
|
+
easing: transitions.easing.easeOut,
|
|
122
|
+
}),
|
|
66
123
|
},
|
|
67
|
-
switchBase: (
|
|
124
|
+
switchBase: (_h = {
|
|
68
125
|
borderRadius: '50%',
|
|
69
|
-
padding: typography.pxToRem((SWITCH_DIMENSIONS.heightPx - SWITCH_DIMENSIONS.thumbSizePx) / 2),
|
|
70
126
|
height: 'unset',
|
|
71
|
-
width: 'unset'
|
|
127
|
+
width: 'unset',
|
|
128
|
+
transition: transitions.create(['transform'], {
|
|
129
|
+
duration: transitions.duration.shorter,
|
|
130
|
+
easing: 'cubic-bezier(0, 0, 0.2, 1)',
|
|
131
|
+
})
|
|
72
132
|
},
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
},
|
|
76
|
-
_h["& + .".concat(switchClasses.track)] = {
|
|
133
|
+
_h["&.".concat(switchClasses.checked)] = (_j = {},
|
|
134
|
+
_j["& + .".concat(switchClasses.track)] = {
|
|
77
135
|
opacity: 1,
|
|
136
|
+
boxShadow: "".concat(mixins.borderAsBoxShadow(tokens.color_fg_state_success), ", 0 1px 2px rgba(0, 0, 0, 0.08) inset"),
|
|
78
137
|
},
|
|
79
|
-
|
|
80
|
-
|
|
138
|
+
_j),
|
|
139
|
+
_h["&.".concat(switchClasses.disabled, ",&:hover,&:active")] = {
|
|
81
140
|
backgroundColor: 'transparent',
|
|
82
141
|
},
|
|
83
|
-
|
|
142
|
+
_h),
|
|
84
143
|
thumb: {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
144
|
+
position: 'relative',
|
|
145
|
+
display: 'block',
|
|
146
|
+
overflow: 'visible',
|
|
147
|
+
backgroundColor: 'transparent',
|
|
148
|
+
boxShadow: 'none',
|
|
149
|
+
'&::before': {
|
|
150
|
+
content: '""',
|
|
151
|
+
position: 'absolute',
|
|
152
|
+
inset: 0,
|
|
153
|
+
backgroundColor: 'currentColor',
|
|
154
|
+
boxShadow: '0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px -1px rgba(0, 0, 0, 0.04), 0 2px 4px -2px rgba(0, 0, 0, 0.04), 0 3px 6px -3px rgba(0, 0, 0, 0.04), 0 4px 8px -4px rgba(0, 0, 0, 0.04)',
|
|
155
|
+
transition: transitions.create(['inset-inline-start', 'inset-inline-end'], {
|
|
156
|
+
duration: transitions.duration.shorter,
|
|
157
|
+
easing: 'cubic-bezier(0, 0, 0.2, 1)',
|
|
158
|
+
}),
|
|
159
|
+
},
|
|
88
160
|
},
|
|
89
161
|
},
|
|
162
|
+
variants: [
|
|
163
|
+
{
|
|
164
|
+
props: { size: 'small' },
|
|
165
|
+
style: getSwitchSizeStyles('small', typography.pxToRem),
|
|
166
|
+
},
|
|
167
|
+
],
|
|
90
168
|
};
|
|
91
169
|
};
|
package/esm/switch/switch.js
CHANGED
|
@@ -20,25 +20,68 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
20
20
|
}
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
24
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
25
|
+
if (!m) return o;
|
|
26
|
+
var i = m.call(o), r, ar = [], e;
|
|
27
|
+
try {
|
|
28
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
29
|
+
}
|
|
30
|
+
catch (error) { e = { error: error }; }
|
|
31
|
+
finally {
|
|
32
|
+
try {
|
|
33
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
34
|
+
}
|
|
35
|
+
finally { if (e) throw e.error; }
|
|
36
|
+
}
|
|
37
|
+
return ar;
|
|
38
|
+
};
|
|
23
39
|
import * as React from 'react';
|
|
24
40
|
import { formControlLabelClasses, FormControlLabel as BaseFormControlLabel, } from '../form';
|
|
25
41
|
import MuiSwitch from '@mui/material/Switch';
|
|
26
|
-
import { styled } from '../styled';
|
|
42
|
+
import { rootShouldForwardProp, styled } from '../styled';
|
|
27
43
|
import clsx from '../utils/clsx';
|
|
28
44
|
import { switchComponentName, switchClasses, getSwitchUtilityClass } from './switch-classes';
|
|
29
45
|
import { useMergedClasses } from '../styles/classes';
|
|
30
|
-
var
|
|
46
|
+
var SWITCH_HEIGHT_BY_SIZE = {
|
|
47
|
+
medium: 24,
|
|
48
|
+
small: 20,
|
|
49
|
+
};
|
|
31
50
|
var SwitchLineHeight = 18;
|
|
51
|
+
var StatusLabel = styled('span', {
|
|
52
|
+
name: switchComponentName,
|
|
53
|
+
slot: 'StatusLabel',
|
|
54
|
+
})(function () { return ({
|
|
55
|
+
display: 'inline-block',
|
|
56
|
+
'@keyframes fadeInFromLeft': {
|
|
57
|
+
'0%': {
|
|
58
|
+
opacity: 0,
|
|
59
|
+
filter: 'blur(4px)',
|
|
60
|
+
transform: 'translateX(-12px)',
|
|
61
|
+
},
|
|
62
|
+
'100%': {
|
|
63
|
+
opacity: 1,
|
|
64
|
+
filter: 'blur(0)',
|
|
65
|
+
transform: 'translateX(0)',
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
animation: "fadeInFromLeft 200ms cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards",
|
|
69
|
+
'@media (prefers-reduced-motion: reduce)': {
|
|
70
|
+
animation: 'none',
|
|
71
|
+
},
|
|
72
|
+
}); });
|
|
32
73
|
var StyledFormControlLabel = styled(BaseFormControlLabel, {
|
|
33
74
|
name: switchComponentName,
|
|
34
75
|
slot: 'FormControlLabel',
|
|
76
|
+
shouldForwardProp: function (prop) { return rootShouldForwardProp(prop) && prop !== 'switchSize' && prop !== 'switchDisabled'; },
|
|
35
77
|
})(function (_a) {
|
|
36
78
|
var _b, _c;
|
|
37
|
-
var theme = _a.theme, noWrap = _a.noWrap, labelPlacement = _a.labelPlacement;
|
|
38
|
-
return __assign((_b = { paddingLeft: 0, paddingTop: 0, paddingBottom: 0, marginLeft: 0 }, _b["& .".concat(formControlLabelClasses.container)] = {
|
|
39
|
-
lineHeight: theme.typography.pxToRem(
|
|
79
|
+
var theme = _a.theme, noWrap = _a.noWrap, labelPlacement = _a.labelPlacement, switchSize = _a.switchSize, switchDisabled = _a.switchDisabled;
|
|
80
|
+
return __assign((_b = { paddingLeft: 0, paddingTop: 0, paddingBottom: 0, marginLeft: 0, cursor: switchDisabled ? 'not-allowed' : undefined }, _b["& .".concat(formControlLabelClasses.container)] = {
|
|
81
|
+
lineHeight: theme.typography.pxToRem(SWITCH_HEIGHT_BY_SIZE[switchSize]),
|
|
40
82
|
minWidth: noWrap ? 0 : undefined, // prevents overflow of parent flex container
|
|
41
83
|
marginLeft: theme.spacing(2),
|
|
84
|
+
cursor: switchDisabled ? 'not-allowed' : undefined,
|
|
42
85
|
'& > *:first-of-type': {
|
|
43
86
|
marginLeft: 0,
|
|
44
87
|
},
|
|
@@ -50,12 +93,63 @@ var StyledFormControlLabel = styled(BaseFormControlLabel, {
|
|
|
50
93
|
_c)));
|
|
51
94
|
});
|
|
52
95
|
export var Switch = React.forwardRef(function (props, ref) {
|
|
53
|
-
var
|
|
96
|
+
var _a;
|
|
97
|
+
var children = props.children, noWrap = props.noWrap, labelPlacement = props.labelPlacement, labels = props.labels, checked = props.checked, disabled = props.disabled, readOnly = props.readOnly, _b = props.size, size = _b === void 0 ? 'medium' : _b, defaultChecked = props.defaultChecked, className = props.className, onMouseDown = props.onMouseDown, onMouseUp = props.onMouseUp, onKeyDown = props.onKeyDown, onKeyUp = props.onKeyUp, onValueChange = props.onValueChange, onChange = props.onChange, helperText = props.helperText, _c = props.HelperTextProps, HelperTextProps = _c === void 0 ? {} : _c, decoration = props.decoration, propClasses = props.classes, switchProps = __rest(props, ["children", "noWrap", "labelPlacement", "labels", "checked", "disabled", "readOnly", "size", "defaultChecked", "className", "onMouseDown", "onMouseUp", "onKeyDown", "onKeyUp", "onValueChange", "onChange", "helperText", "HelperTextProps", "decoration", "classes"]);
|
|
54
98
|
var classes = useMergedClasses(switchClasses, getSwitchUtilityClass, propClasses);
|
|
55
|
-
var
|
|
56
|
-
var
|
|
99
|
+
var isDisabled = readOnly || disabled;
|
|
100
|
+
var _d = __read(React.useState(false), 2), isPressing = _d[0], setIsPressing = _d[1];
|
|
101
|
+
var handleMouseDown = React.useCallback(function () {
|
|
102
|
+
if (!isDisabled) {
|
|
103
|
+
setIsPressing(true);
|
|
104
|
+
}
|
|
105
|
+
}, [isDisabled]);
|
|
106
|
+
var handleMouseUp = React.useCallback(function () { return setIsPressing(false); }, []);
|
|
107
|
+
var handleSwitchMouseDown = React.useCallback(function (event) {
|
|
108
|
+
onMouseDown === null || onMouseDown === void 0 ? void 0 : onMouseDown(event);
|
|
109
|
+
if (!isDisabled) {
|
|
110
|
+
handleMouseDown();
|
|
111
|
+
}
|
|
112
|
+
}, [handleMouseDown, isDisabled, onMouseDown]);
|
|
113
|
+
var handleSwitchMouseUp = React.useCallback(function (event) {
|
|
114
|
+
onMouseUp === null || onMouseUp === void 0 ? void 0 : onMouseUp(event);
|
|
115
|
+
handleMouseUp();
|
|
116
|
+
}, [handleMouseUp, onMouseUp]);
|
|
117
|
+
var handleSwitchKeyDown = React.useCallback(function (event) {
|
|
118
|
+
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
|
|
119
|
+
if (event.key === ' ' && !isDisabled) {
|
|
120
|
+
setIsPressing(true);
|
|
121
|
+
}
|
|
122
|
+
}, [isDisabled, onKeyDown]);
|
|
123
|
+
var handleSwitchKeyUp = React.useCallback(function (event) {
|
|
124
|
+
onKeyUp === null || onKeyUp === void 0 ? void 0 : onKeyUp(event);
|
|
125
|
+
if (event.key === ' ') {
|
|
126
|
+
setIsPressing(false);
|
|
127
|
+
}
|
|
128
|
+
}, [onKeyUp]);
|
|
129
|
+
React.useEffect(function () {
|
|
130
|
+
if (isPressing) {
|
|
131
|
+
var release_1 = function () { return setIsPressing(false); };
|
|
132
|
+
window.addEventListener('mouseup', release_1);
|
|
133
|
+
return function () { return window.removeEventListener('mouseup', release_1); };
|
|
134
|
+
}
|
|
135
|
+
return undefined;
|
|
136
|
+
}, [isPressing]);
|
|
137
|
+
React.useEffect(function () {
|
|
138
|
+
if (isDisabled && isPressing) {
|
|
139
|
+
setIsPressing(false);
|
|
140
|
+
}
|
|
141
|
+
}, [isDisabled, isPressing]);
|
|
142
|
+
var _e = __read(React.useState((_a = checked !== null && checked !== void 0 ? checked : defaultChecked) !== null && _a !== void 0 ? _a : false), 2), uncontrolledChecked = _e[0], setUncontrolledChecked = _e[1];
|
|
143
|
+
var isChecked = checked !== null && checked !== void 0 ? checked : uncontrolledChecked;
|
|
144
|
+
var hasStatusLabels = labels && labels.length === 2;
|
|
145
|
+
var valueLabel = hasStatusLabels ? labels[isChecked ? 0 : 1] : '';
|
|
146
|
+
var animatedValueLabel = hasStatusLabels ? React.createElement(StatusLabel, { key: valueLabel }, valueLabel) : '';
|
|
147
|
+
var label = children || animatedValueLabel;
|
|
57
148
|
var hasLabelOrHelperText = !!helperText || !!label;
|
|
58
149
|
var handleChange = function (event) {
|
|
150
|
+
if (checked === undefined) {
|
|
151
|
+
setUncontrolledChecked(event.target.checked);
|
|
152
|
+
}
|
|
59
153
|
if (onChange) {
|
|
60
154
|
onChange(event, event.target.checked);
|
|
61
155
|
}
|
|
@@ -63,9 +157,9 @@ export var Switch = React.forwardRef(function (props, ref) {
|
|
|
63
157
|
onValueChange(event.target.checked);
|
|
64
158
|
}
|
|
65
159
|
};
|
|
66
|
-
var switchButton = (React.createElement(MuiSwitch, __assign({ checked: checked, disabled:
|
|
160
|
+
var switchButton = (React.createElement(MuiSwitch, __assign({ checked: checked, disabled: isDisabled, defaultChecked: defaultChecked, size: size, className: clsx(!hasLabelOrHelperText ? className : classes.switch, isPressing && classes.pressing), onMouseDown: handleSwitchMouseDown, onMouseUp: handleSwitchMouseUp, onKeyDown: handleSwitchKeyDown, onKeyUp: handleSwitchKeyUp, onChange: onChange || onValueChange || hasStatusLabels ? handleChange : undefined }, switchProps, { ref: ref })));
|
|
67
161
|
if (hasLabelOrHelperText) {
|
|
68
|
-
return (React.createElement(StyledFormControlLabel, { className: clsx(classes.formControlLabel, className), height: SwitchLineHeight, label: label, labelPlacement: labelPlacement, helperText: helperText, HelperTextProps: HelperTextProps, decoration: decoration, noWrap: noWrap, disabled:
|
|
162
|
+
return (React.createElement(StyledFormControlLabel, { className: clsx(classes.formControlLabel, className, isPressing && classes.pressing), height: SwitchLineHeight, switchSize: size, switchDisabled: isDisabled, onMouseDown: handleMouseDown, onMouseUp: handleMouseUp, label: label, labelPlacement: labelPlacement, helperText: helperText, HelperTextProps: HelperTextProps, decoration: decoration, noWrap: noWrap, disabled: isDisabled, control: switchButton, ref: ref }));
|
|
69
163
|
}
|
|
70
164
|
return switchButton;
|
|
71
165
|
});
|
|
@@ -15,10 +15,18 @@ export var createMuiTabOverrides = function (_a) {
|
|
|
15
15
|
],
|
|
16
16
|
styleOverrides: {
|
|
17
17
|
root: (_b = {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
position: 'relative',
|
|
19
|
+
zIndex: 1,
|
|
20
|
+
padding: spacing(0.75),
|
|
21
|
+
marginRight: 0,
|
|
22
|
+
height: spacing(4),
|
|
23
|
+
minHeight: spacing(4),
|
|
24
|
+
minWidth: 'unset',
|
|
25
|
+
transition: 'background-color 0.25s cubic-bezier(0, 0, 0.2, 1)',
|
|
26
|
+
'@media (prefers-reduced-motion: reduce)': {
|
|
27
|
+
transition: 'none',
|
|
28
|
+
},
|
|
29
|
+
borderRadius: spacing(0.5)
|
|
22
30
|
},
|
|
23
31
|
_b[breakpoints.up('sm')] = {
|
|
24
32
|
minWidth: 'unset',
|
|
@@ -28,17 +36,20 @@ export var createMuiTabOverrides = function (_a) {
|
|
|
28
36
|
},
|
|
29
37
|
_b),
|
|
30
38
|
textColorPrimary: (_c = {},
|
|
39
|
+
_c["&.".concat(tabClasses.disabled)] = {
|
|
40
|
+
color: tokens.color_fg_disabled,
|
|
41
|
+
},
|
|
31
42
|
_c["&.".concat(tabClasses.selected)] = {
|
|
32
|
-
color: tokens.
|
|
43
|
+
color: tokens.color_fg_bold,
|
|
33
44
|
},
|
|
34
45
|
_c['&:hover'] = {
|
|
35
|
-
color: tokens.
|
|
46
|
+
color: tokens.color_fg_bold,
|
|
36
47
|
},
|
|
37
48
|
_c['&:focus-visible'] = {
|
|
38
49
|
boxShadow: "0 0 0 2px ".concat(tokens.color_border_focus, " inset"),
|
|
39
50
|
},
|
|
40
51
|
_c.color = tokens.color_fg_link_subtle,
|
|
41
|
-
_c.fontWeight = typography.
|
|
52
|
+
_c.fontWeight = typography.fontWeightSemibold,
|
|
42
53
|
_c),
|
|
43
54
|
},
|
|
44
55
|
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { styled } from '../../styled';
|
|
2
|
+
export var tabListComponentName = 'QuantumTabList';
|
|
3
|
+
export var TabListContainer = styled('div', {
|
|
4
|
+
name: tabListComponentName,
|
|
5
|
+
slot: 'Root',
|
|
6
|
+
})(function (_a) {
|
|
7
|
+
var theme = _a.theme;
|
|
8
|
+
return ({
|
|
9
|
+
display: 'flex',
|
|
10
|
+
alignItems: 'center',
|
|
11
|
+
position: 'relative',
|
|
12
|
+
isolation: 'isolate',
|
|
13
|
+
borderBottom: "1px solid ".concat(theme.tokens.color_border_default),
|
|
14
|
+
overflow: 'hidden',
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
export var OverflowButtonWrapper = styled('div', {
|
|
18
|
+
name: tabListComponentName,
|
|
19
|
+
slot: 'OverflowButtonWrapper',
|
|
20
|
+
})(function (_a) {
|
|
21
|
+
var theme = _a.theme;
|
|
22
|
+
return ({
|
|
23
|
+
display: 'flex',
|
|
24
|
+
alignItems: 'center',
|
|
25
|
+
marginLeft: theme.spacing(0.5),
|
|
26
|
+
flexShrink: 0,
|
|
27
|
+
height: theme.spacing(3.5),
|
|
28
|
+
marginBottom: theme.spacing(1),
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
export var OverflowLabelContainer = styled('span', {
|
|
32
|
+
name: tabListComponentName,
|
|
33
|
+
slot: 'OverflowLabelContainer',
|
|
34
|
+
})(function (_a) {
|
|
35
|
+
var theme = _a.theme;
|
|
36
|
+
return ({
|
|
37
|
+
position: 'relative',
|
|
38
|
+
display: 'inline-flex',
|
|
39
|
+
alignItems: 'center',
|
|
40
|
+
gap: theme.spacing(0.5),
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
export var OverflowLabel = styled('span', {
|
|
44
|
+
name: tabListComponentName,
|
|
45
|
+
slot: 'OverflowLabel',
|
|
46
|
+
})(function (_a) {
|
|
47
|
+
var theme = _a.theme;
|
|
48
|
+
return ({
|
|
49
|
+
display: 'flex',
|
|
50
|
+
alignItems: 'center',
|
|
51
|
+
justifyContent: 'space-between',
|
|
52
|
+
gap: theme.spacing(1),
|
|
53
|
+
fontSize: theme.typography.pxToRem(14),
|
|
54
|
+
fontWeight: theme.typography.fontWeightSemibold,
|
|
55
|
+
color: theme.tokens.color_fg_default,
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
var TIMING_FUNCTION = 'cubic-bezier(0.19, 1, 0.22, 1)';
|
|
59
|
+
export var SelectionIndicator = styled('span', {
|
|
60
|
+
name: tabListComponentName,
|
|
61
|
+
slot: 'SelectionIndicator',
|
|
62
|
+
shouldForwardProp: function (prop) { return !['ownerState'].includes(String(prop)); },
|
|
63
|
+
})(function (_a) {
|
|
64
|
+
var theme = _a.theme, _b = _a.ownerState, leftOffset = _b.leftOffset, indicatorWidth = _b.indicatorWidth, isVisible = _b.isVisible;
|
|
65
|
+
return ({
|
|
66
|
+
position: 'absolute',
|
|
67
|
+
top: 0,
|
|
68
|
+
bottom: theme.spacing(1),
|
|
69
|
+
left: 0,
|
|
70
|
+
width: indicatorWidth,
|
|
71
|
+
borderRadius: theme.spacing(0.5),
|
|
72
|
+
backgroundColor: theme.tokens.color_bg_layer_alternate_bold,
|
|
73
|
+
pointerEvents: 'none',
|
|
74
|
+
zIndex: 0,
|
|
75
|
+
opacity: isVisible ? 1 : 0,
|
|
76
|
+
transform: "translate3d(".concat(leftOffset, "px, 0, 0)"),
|
|
77
|
+
willChange: 'transform, width, opacity',
|
|
78
|
+
transition: "transform ".concat(theme.transitions.duration.short, "ms ").concat(TIMING_FUNCTION, ", width ").concat(theme.transitions.duration.short, "ms ").concat(TIMING_FUNCTION, ", opacity ").concat(theme.transitions.duration.short, "ms ").concat(TIMING_FUNCTION),
|
|
79
|
+
'@media (prefers-reduced-motion: reduce)': {
|
|
80
|
+
transition: 'none',
|
|
81
|
+
},
|
|
82
|
+
'&::before': {
|
|
83
|
+
content: '""',
|
|
84
|
+
position: 'absolute',
|
|
85
|
+
display: 'block',
|
|
86
|
+
bottom: theme.spacing(-1),
|
|
87
|
+
left: '50%',
|
|
88
|
+
transform: 'translateX(-50%)',
|
|
89
|
+
height: theme.spacing(0.25),
|
|
90
|
+
width: "calc(100% - ".concat(theme.spacing(2), ")"),
|
|
91
|
+
backgroundColor: theme.tokens.color_bg_brand_primary,
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export var isTabChild = function (child) { return React.isValidElement(child); };
|
|
3
|
+
export var getResolvedChildValue = function (child, index) { var _a; return (_a = child.props.value) !== null && _a !== void 0 ? _a : index; };
|
|
4
|
+
export var getChildOrderValue = function (child, index) {
|
|
5
|
+
var _a, _b;
|
|
6
|
+
if (isTabChild(child)) {
|
|
7
|
+
return (_b = (_a = child.props.value) !== null && _a !== void 0 ? _a : child.key) !== null && _b !== void 0 ? _b : index;
|
|
8
|
+
}
|
|
9
|
+
return index;
|
|
10
|
+
};
|
|
11
|
+
// Tab selection uses identity equality for object values elsewhere in the tabs stack,
|
|
12
|
+
// so overflow ordering should follow the same semantics.
|
|
13
|
+
var areTabValuesEqual = function (left, right) { return left === right; };
|
|
14
|
+
export var areValueArraysEqual = function (left, right) {
|
|
15
|
+
if (left.length !== right.length) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
return left.every(function (value, index) { return areTabValuesEqual(value, right[index]); });
|
|
19
|
+
};
|
|
20
|
+
export var createOverflowState = function (_a) {
|
|
21
|
+
var baseVisibleTabCount = _a.baseVisibleTabCount, moreLabel = _a.moreLabel, defaultTabOrder = _a.defaultTabOrder, _b = _a.overflowCompensation, overflowCompensation = _b === void 0 ? 0 : _b, orderedTabValues = _a.orderedTabValues;
|
|
22
|
+
return ({
|
|
23
|
+
overflowCompensation: overflowCompensation,
|
|
24
|
+
orderedTabValues: orderedTabValues,
|
|
25
|
+
baselineVisibleTabCount: baseVisibleTabCount,
|
|
26
|
+
baselineMoreLabel: moreLabel,
|
|
27
|
+
baselineTabOrder: defaultTabOrder,
|
|
28
|
+
});
|
|
29
|
+
};
|