carbon-react 102.18.0 → 102.20.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.
- package/lib/__internal__/label/label.style.js +2 -2
- package/lib/components/action-popover/action-popover.style.d.ts +4 -22
- package/lib/components/action-popover/action-popover.style.js +40 -98
- package/lib/components/confirm/confirm.component.js +1 -1
- package/lib/components/switch/__internal__/switch-slider-panel.style.js +31 -16
- package/lib/components/switch/__internal__/switch-slider.style.js +38 -29
- package/lib/components/switch/switch.style.js +5 -15
- package/lib/components/tabs/__internal__/tabs-header/tabs-header.style.js +1 -1
- package/package.json +1 -1
|
@@ -16,7 +16,7 @@ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return
|
|
|
16
16
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
17
|
|
|
18
18
|
const LabelStyle = _styledComponents.default.label`
|
|
19
|
-
color: var(--
|
|
19
|
+
color: var(--colorsUtilityYin090);
|
|
20
20
|
display: block;
|
|
21
21
|
font-weight: 600; //TODO: (tokens) use token var(--fontWeights500)
|
|
22
22
|
|
|
@@ -34,7 +34,7 @@ const LabelStyle = _styledComponents.default.label`
|
|
|
34
34
|
${({
|
|
35
35
|
disabled
|
|
36
36
|
}) => disabled && (0, _styledComponents.css)`
|
|
37
|
-
color: var(--
|
|
37
|
+
color: var(--colorsUtilityYin030);
|
|
38
38
|
`}
|
|
39
39
|
`;
|
|
40
40
|
LabelStyle.propTypes = {
|
|
@@ -1,31 +1,13 @@
|
|
|
1
1
|
export const Menu: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
2
|
export function MenuItemFactory(button: any): import("styled-components").StyledComponent<any, any, object, string | number | symbol>;
|
|
3
3
|
export const MenuButton: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
|
-
export const ButtonIcon:
|
|
5
|
-
[x: string]: any;
|
|
6
|
-
[x: number]: any;
|
|
7
|
-
[x: symbol]: any;
|
|
8
|
-
} & {
|
|
9
|
-
theme?: any;
|
|
10
|
-
}>;
|
|
4
|
+
export const ButtonIcon: import("styled-components").StyledComponent<typeof Icon, any, {}, never>;
|
|
11
5
|
export const StyledButtonIcon: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
12
|
-
export const MenuItemIcon: import("styled-components").StyledComponent<
|
|
13
|
-
[x: string]: any;
|
|
14
|
-
[x: number]: any;
|
|
15
|
-
[x: symbol]: any;
|
|
16
|
-
} & {
|
|
17
|
-
theme?: any;
|
|
18
|
-
}>, any, {}, never>;
|
|
6
|
+
export const MenuItemIcon: import("styled-components").StyledComponent<typeof Icon, any, {}, never>;
|
|
19
7
|
export const MenuItemDivider: import("styled-components").StyledComponent<"div", any, {
|
|
20
8
|
"data-element": string;
|
|
21
9
|
}, "data-element">;
|
|
22
|
-
export const SubMenuItemIcon: import("styled-components").StyledComponent<
|
|
23
|
-
[x: string]: any;
|
|
24
|
-
[x: number]: any;
|
|
25
|
-
[x: symbol]: any;
|
|
26
|
-
} & {
|
|
27
|
-
theme?: any;
|
|
28
|
-
}>, any, {}, never>;
|
|
10
|
+
export const SubMenuItemIcon: import("styled-components").StyledComponent<typeof Icon, any, {}, never>;
|
|
29
11
|
export const MenuButtonOverrideWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
30
12
|
export const StyledMenuItem: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
31
|
-
import
|
|
13
|
+
import Icon from "../icon";
|
|
@@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.StyledMenuItem = exports.MenuButtonOverrideWrapper = exports.SubMenuItemIcon = exports.MenuItemDivider = exports.MenuItemIcon = exports.StyledButtonIcon = exports.ButtonIcon = exports.MenuButton = exports.MenuItemFactory = exports.Menu = void 0;
|
|
7
7
|
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
11
9
|
|
|
12
10
|
var _styledSystem = require("styled-system");
|
|
@@ -19,30 +17,24 @@ var _button = _interopRequireDefault(require("../button/button.style"));
|
|
|
19
17
|
|
|
20
18
|
var _browserTypeCheck = require("../../__internal__/utils/helpers/browser-type-check");
|
|
21
19
|
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
+
|
|
22
22
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
23
23
|
|
|
24
24
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
25
|
|
|
26
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
|
-
|
|
28
26
|
const Menu = _styledComponents.default.div`
|
|
29
27
|
${({
|
|
30
28
|
isOpen
|
|
31
29
|
}) => isOpen ? "display: block;" : "visibility: hidden;"}
|
|
32
30
|
margin: 0;
|
|
33
|
-
padding:
|
|
34
|
-
|
|
35
|
-
}) => `${theme.spacing}px 0`};
|
|
36
|
-
box-shadow: ${({
|
|
37
|
-
theme
|
|
38
|
-
}) => theme.shadows.depth1};
|
|
31
|
+
padding: var(--spacing100) 0;
|
|
32
|
+
box-shadow: var(--boxShadow100);
|
|
39
33
|
position: absolute;
|
|
40
|
-
background-color:
|
|
41
|
-
theme
|
|
42
|
-
}) => theme.colors.white};
|
|
34
|
+
background-color: var(--colorsUtilityYang100);
|
|
43
35
|
z-index: ${({
|
|
44
36
|
theme
|
|
45
|
-
}) => `${theme.zIndex.popover}`};
|
|
37
|
+
}) => `${theme.zIndex.popover}`}; // TODO (tokens): implement elevation tokens - FE-4437
|
|
46
38
|
`;
|
|
47
39
|
exports.Menu = Menu;
|
|
48
40
|
const StyledMenuItem = _styledComponents.default.div`
|
|
@@ -55,9 +47,7 @@ const MenuItemFactory = button => (0, _styledComponents.default)(button)`
|
|
|
55
47
|
disabled
|
|
56
48
|
}) => disabled ? "not-allowed" : "pointer"};
|
|
57
49
|
box-sizing: border-box;
|
|
58
|
-
|
|
59
|
-
theme
|
|
60
|
-
}) => `padding: 0 ${theme.spacing * 3}px;`}
|
|
50
|
+
padding: 0 var(--spacing150);
|
|
61
51
|
position: relative;
|
|
62
52
|
line-height: 40px;
|
|
63
53
|
white-space: nowrap;
|
|
@@ -67,9 +57,8 @@ const MenuItemFactory = button => (0, _styledComponents.default)(button)`
|
|
|
67
57
|
border: none;
|
|
68
58
|
width: 100%;
|
|
69
59
|
color: ${({
|
|
70
|
-
disabled
|
|
71
|
-
|
|
72
|
-
}) => disabled ? theme.menu.itemColorDisabled : theme.menu.itemColor};
|
|
60
|
+
disabled
|
|
61
|
+
}) => disabled ? "var(--colorsUtilityYin030)" : "var(--colorsUtilityYin090)"};
|
|
73
62
|
font-size: 14px;
|
|
74
63
|
font-weight: 700;
|
|
75
64
|
justify-content: ${({
|
|
@@ -80,16 +69,12 @@ const MenuItemFactory = button => (0, _styledComponents.default)(button)`
|
|
|
80
69
|
${({
|
|
81
70
|
disabled
|
|
82
71
|
}) => !disabled && (0, _styledComponents.css)`
|
|
83
|
-
background-color:
|
|
84
|
-
theme
|
|
85
|
-
}) => theme.menu.focus};
|
|
72
|
+
background-color: var(--colorsUtilityMajor025);
|
|
86
73
|
`}
|
|
87
74
|
}
|
|
88
75
|
&:focus {
|
|
89
|
-
outline:
|
|
90
|
-
|
|
91
|
-
theme
|
|
92
|
-
}) => theme.colors.focus};
|
|
76
|
+
outline: var(--borderWidth300) solid var(--colorsSemanticFocus500);
|
|
77
|
+
z-index: 1;
|
|
93
78
|
}
|
|
94
79
|
${({
|
|
95
80
|
disabled
|
|
@@ -103,7 +88,7 @@ const MenuItemFactory = button => (0, _styledComponents.default)(button)`
|
|
|
103
88
|
}) => disabled && (0, _styledComponents.css)`
|
|
104
89
|
&& ${_icon2.default} {
|
|
105
90
|
cursor: not-allowed;
|
|
106
|
-
color:
|
|
91
|
+
color: var(--colorsUtilityYin030);
|
|
107
92
|
}
|
|
108
93
|
`}
|
|
109
94
|
`;
|
|
@@ -112,11 +97,9 @@ exports.MenuItemFactory = MenuItemFactory;
|
|
|
112
97
|
const MenuItemDivider = _styledComponents.default.div.attrs({
|
|
113
98
|
"data-element": "action-popover-divider"
|
|
114
99
|
})`
|
|
115
|
-
background-color:
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
height: 1px;
|
|
119
|
-
margin: 9px;
|
|
100
|
+
background-color: var(--colorsUtilityMajor050);
|
|
101
|
+
height: var(--borderWidth100);
|
|
102
|
+
margin: var(--spacing100) var(--spacing150);
|
|
120
103
|
`;
|
|
121
104
|
exports.MenuItemDivider = MenuItemDivider;
|
|
122
105
|
const MenuButton = _styledComponents.default.div`
|
|
@@ -127,100 +110,59 @@ const MenuButton = _styledComponents.default.div`
|
|
|
127
110
|
width: fit-content;
|
|
128
111
|
margin: auto;
|
|
129
112
|
${_styledSystem.margin}
|
|
130
|
-
${({
|
|
131
|
-
isOpen,
|
|
132
|
-
theme
|
|
133
|
-
}) => isOpen && `background-color: ${theme.colors.white}`}
|
|
134
113
|
`;
|
|
135
|
-
/**
|
|
136
|
-
* Creates a factory that returns a styled component with a custom
|
|
137
|
-
* theme provider wrapped around it
|
|
138
|
-
* @param {*} themeFn
|
|
139
|
-
*/
|
|
140
|
-
|
|
141
114
|
exports.MenuButton = MenuButton;
|
|
115
|
+
const ButtonIcon = (0, _styledComponents.default)(_icon.default)`
|
|
116
|
+
color: var(--colorsActionMinor500);
|
|
142
117
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
const color = themeFn(theme.palette);
|
|
148
|
-
const customTheme = { ...theme,
|
|
149
|
-
icon: {
|
|
150
|
-
default: color,
|
|
151
|
-
defaultHover: color
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
return /*#__PURE__*/_react.default.createElement(_styledComponents.ThemeProvider, {
|
|
155
|
-
theme: customTheme
|
|
156
|
-
}, /*#__PURE__*/_react.default.createElement(Component, props));
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
const ButtonIcon = iconThemeProviderFactory(_icon.default, palette => palette.slate);
|
|
118
|
+
:hover {
|
|
119
|
+
color: var(--colorsActionMinor600);
|
|
120
|
+
}
|
|
121
|
+
`;
|
|
160
122
|
exports.ButtonIcon = ButtonIcon;
|
|
161
123
|
const StyledButtonIcon = _styledComponents.default.div`
|
|
162
|
-
&:hover,
|
|
163
|
-
&:focus {
|
|
164
|
-
background-color: ${({
|
|
165
|
-
theme
|
|
166
|
-
}) => theme.colors.white};
|
|
167
|
-
}
|
|
168
|
-
|
|
169
124
|
&:focus {
|
|
170
|
-
outline:
|
|
171
|
-
theme
|
|
172
|
-
}) => theme.colors.focus};
|
|
125
|
+
outline: var(--borderWidth300) solid var(--colorsSemanticFocus500);
|
|
173
126
|
}
|
|
174
127
|
`;
|
|
175
128
|
exports.StyledButtonIcon = StyledButtonIcon;
|
|
176
|
-
const MenuItemIcon = (0, _styledComponents.default)(
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
horizontalAlignment
|
|
180
|
-
}) => (0, _styledComponents.css)`
|
|
181
|
-
${horizontalAlignment === "right" ? "padding-left" : "padding-right"}: ${theme.spacing}px;
|
|
182
|
-
`}
|
|
129
|
+
const MenuItemIcon = (0, _styledComponents.default)(_icon.default)`
|
|
130
|
+
padding: var(--spacing100);
|
|
131
|
+
color: var(--colorsUtilityYin065);
|
|
183
132
|
`;
|
|
184
133
|
exports.MenuItemIcon = MenuItemIcon;
|
|
185
134
|
const SubMenuItemIcon = (0, _styledComponents.default)(ButtonIcon)`
|
|
186
135
|
${({
|
|
187
|
-
theme,
|
|
188
136
|
type
|
|
189
137
|
}) => (0, _styledComponents.css)`
|
|
190
138
|
position: absolute;
|
|
191
|
-
&,
|
|
192
|
-
:hover {
|
|
193
|
-
color: ${theme.colors.border};
|
|
194
|
-
}
|
|
195
139
|
${type === "chevron_left" && (0, _styledComponents.css)`
|
|
196
|
-
left:
|
|
140
|
+
left: -2px;
|
|
197
141
|
`}
|
|
198
142
|
|
|
199
143
|
${type === "chevron_right" && (0, _styledComponents.css)`
|
|
200
|
-
right:
|
|
144
|
+
right: -5px;
|
|
201
145
|
${(0, _browserTypeCheck.isSafari)(navigator) && (0, _styledComponents.css)`
|
|
202
|
-
top:
|
|
146
|
+
top: var(--sizing100);
|
|
203
147
|
`}
|
|
204
148
|
`}
|
|
205
149
|
`}
|
|
206
150
|
`;
|
|
207
151
|
exports.SubMenuItemIcon = SubMenuItemIcon;
|
|
208
152
|
const MenuButtonOverrideWrapper = _styledComponents.default.div`
|
|
209
|
-
${
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
}
|
|
153
|
+
${_button.default} {
|
|
154
|
+
padding: 0px var(--sizing100);
|
|
155
|
+
width: 100%;
|
|
156
|
+
|
|
157
|
+
&:hover,
|
|
158
|
+
&:focus {
|
|
159
|
+
background-color: var(--colorsActionMajorTransparent);
|
|
160
|
+
color: var(--colorsActionMajor600);
|
|
218
161
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
background-color: ${theme.colors.white};
|
|
162
|
+
span[color] {
|
|
163
|
+
color: var(--colorsActionMajor600);
|
|
222
164
|
}
|
|
223
165
|
}
|
|
224
|
-
|
|
166
|
+
}
|
|
225
167
|
`;
|
|
226
168
|
exports.MenuButtonOverrideWrapper = MenuButtonOverrideWrapper;
|
|
@@ -82,7 +82,7 @@ const Confirm = ({
|
|
|
82
82
|
buttonType: confirmButtonType,
|
|
83
83
|
destructive: destructive || confirmButtonDestructive,
|
|
84
84
|
disabled: isLoadingConfirm || disableConfirm,
|
|
85
|
-
ml:
|
|
85
|
+
ml: 2,
|
|
86
86
|
iconType: confirmButtonIconType,
|
|
87
87
|
iconPosition: confirmButtonIconPosition
|
|
88
88
|
}, isLoadingConfirm ? /*#__PURE__*/_react.default.createElement(_loader.default, {
|
|
@@ -9,8 +9,6 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
|
9
9
|
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
|
|
12
|
-
var _base = _interopRequireDefault(require("../../../style/themes/base"));
|
|
13
|
-
|
|
14
12
|
var _loader = _interopRequireDefault(require("../../loader/loader.style"));
|
|
15
13
|
|
|
16
14
|
var _loaderSquare = _interopRequireDefault(require("../../loader/loader-square.style"));
|
|
@@ -24,11 +22,10 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
|
|
24
22
|
const SwitchSliderPanel = _styledComponents.default.div`
|
|
25
23
|
${({
|
|
26
24
|
isLoading,
|
|
27
|
-
size
|
|
28
|
-
theme
|
|
25
|
+
size
|
|
29
26
|
}) => (0, _styledComponents.css)`
|
|
30
27
|
border: 0;
|
|
31
|
-
color:
|
|
28
|
+
color: var(--colorsActionMinorYang100);
|
|
32
29
|
margin: auto;
|
|
33
30
|
margin-top: ${size === "large" ? "12px" : "5px"};
|
|
34
31
|
|
|
@@ -37,20 +34,42 @@ const SwitchSliderPanel = _styledComponents.default.div`
|
|
|
37
34
|
}
|
|
38
35
|
|
|
39
36
|
&[type="off"] {
|
|
40
|
-
color:
|
|
37
|
+
color: var(--colorsActionMinor500);
|
|
41
38
|
margin-right: 6px;
|
|
42
39
|
}
|
|
43
40
|
|
|
44
41
|
${isLoading && (0, _styledComponents.css)`
|
|
42
|
+
&[type="off"],
|
|
43
|
+
&[type="on"] {
|
|
44
|
+
margin: 0;
|
|
45
|
+
width: 100%;
|
|
46
|
+
box-sizing: border-box;
|
|
47
|
+
padding: 2px 8px;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&[type="off"] {
|
|
51
|
+
${_loaderSquare.default} {
|
|
52
|
+
background-color: var(--colorsSemanticNeutral500);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&[type="on"] {
|
|
57
|
+
${_loaderSquare.default} {
|
|
58
|
+
background-color: var(--colorsActionMinorYang100);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
45
62
|
${_loader.default} {
|
|
46
63
|
{
|
|
47
|
-
|
|
64
|
+
display: flex;
|
|
65
|
+
justify-content: center;
|
|
66
|
+
align-items: center;
|
|
67
|
+
width: 100%;
|
|
68
|
+
height: 100%;
|
|
48
69
|
|
|
49
70
|
${_loaderSquare.default} {
|
|
50
|
-
height:
|
|
51
|
-
|
|
52
|
-
margin-right: 2px;
|
|
53
|
-
width: 5px;
|
|
71
|
+
height: ${size === "large" ? "var(--sizing200)" : "var(--sizing150)"};
|
|
72
|
+
width: ${size === "large" ? "var(--sizing200)" : "var(--sizing150)"};
|
|
54
73
|
}
|
|
55
74
|
}
|
|
56
75
|
}
|
|
@@ -59,11 +78,7 @@ const SwitchSliderPanel = _styledComponents.default.div`
|
|
|
59
78
|
`;
|
|
60
79
|
SwitchSliderPanel.propTypes = {
|
|
61
80
|
isLoading: _propTypes.default.bool,
|
|
62
|
-
size: _propTypes.default.string
|
|
63
|
-
theme: _propTypes.default.object
|
|
64
|
-
};
|
|
65
|
-
SwitchSliderPanel.defaultProps = {
|
|
66
|
-
theme: _base.default
|
|
81
|
+
size: _propTypes.default.string
|
|
67
82
|
};
|
|
68
83
|
var _default = SwitchSliderPanel;
|
|
69
84
|
exports.default = _default;
|
|
@@ -9,8 +9,6 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
|
9
9
|
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
|
|
12
|
-
var _base = _interopRequireDefault(require("../../../style/themes/base"));
|
|
13
|
-
|
|
14
12
|
var _switchSliderPanel = _interopRequireDefault(require("./switch-slider-panel.style"));
|
|
15
13
|
|
|
16
14
|
var _validationIcon = _interopRequireDefault(require("../../../__internal__/validations/validation-icon.style"));
|
|
@@ -24,14 +22,12 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
|
|
24
22
|
const StyledSwitchSlider = _styledComponents.default.span`
|
|
25
23
|
${({
|
|
26
24
|
checked,
|
|
25
|
+
isLoading,
|
|
27
26
|
disabled,
|
|
28
27
|
size,
|
|
29
|
-
theme,
|
|
30
28
|
error,
|
|
31
|
-
warning
|
|
32
|
-
info
|
|
29
|
+
warning
|
|
33
30
|
}) => (0, _styledComponents.css)`
|
|
34
|
-
background-color: ${theme.switch.off};
|
|
35
31
|
display: flex;
|
|
36
32
|
font-size: 12px;
|
|
37
33
|
font-weight: bold;
|
|
@@ -44,21 +40,13 @@ const StyledSwitchSlider = _styledComponents.default.span`
|
|
|
44
40
|
width: 60px;
|
|
45
41
|
z-index: 2;
|
|
46
42
|
border-radius: 90px;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
`}
|
|
51
|
-
${warning && !disabled && (0, _styledComponents.css)`
|
|
52
|
-
box-shadow: inset 0px 0px 0px 1px ${theme.colors.warning};
|
|
53
|
-
`}
|
|
54
|
-
${error && !disabled && (0, _styledComponents.css)`
|
|
55
|
-
box-shadow: inset 0px 0px 0px 2px ${theme.colors.error};
|
|
56
|
-
`}
|
|
43
|
+
border-style: solid;
|
|
44
|
+
border-color: var(--colorsActionMinor400);
|
|
45
|
+
border-width: var(--borderWidth200);
|
|
57
46
|
|
|
58
47
|
&::before {
|
|
59
|
-
background-color:
|
|
48
|
+
background-color: var(--colorsActionMinor400);
|
|
60
49
|
bottom: 4px;
|
|
61
|
-
box-shadow: ${theme.shadows.cards};
|
|
62
50
|
content: "";
|
|
63
51
|
height: 16px;
|
|
64
52
|
position: absolute;
|
|
@@ -70,28 +58,36 @@ const StyledSwitchSlider = _styledComponents.default.span`
|
|
|
70
58
|
}
|
|
71
59
|
|
|
72
60
|
${checked && `
|
|
73
|
-
background-color:
|
|
61
|
+
background-color: var(--colorsActionMinor500);
|
|
62
|
+
border-color: var(--colorsActionMinorTransparent);
|
|
74
63
|
|
|
75
64
|
&::before {
|
|
76
65
|
transform: translateX(36px);
|
|
66
|
+
background-color: var(--colorsActionMinorYang100);
|
|
77
67
|
}
|
|
68
|
+
|
|
78
69
|
`}
|
|
79
70
|
|
|
80
|
-
${disabled && (0, _styledComponents.css)`
|
|
81
|
-
|
|
71
|
+
${disabled && !isLoading && (0, _styledComponents.css)`
|
|
72
|
+
border-color: var(--colorsActionDisabled600);
|
|
82
73
|
|
|
83
74
|
&::before {
|
|
84
|
-
|
|
75
|
+
background-color: var(--colorsActionDisabled600);
|
|
85
76
|
}
|
|
86
77
|
|
|
87
78
|
${_switchSliderPanel.default} {
|
|
88
|
-
color:
|
|
79
|
+
color: var(--colorsUtilityYin030);
|
|
89
80
|
}
|
|
90
81
|
|
|
91
82
|
${checked && `
|
|
92
|
-
background-color:
|
|
83
|
+
background-color: var(--colorsActionDisabled500);
|
|
84
|
+
border-color: var(--colorsActionMinorTransparent);
|
|
93
85
|
|
|
94
|
-
|
|
86
|
+
&::before {
|
|
87
|
+
background-color: var(--colorsActionMinorYang100);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
${_switchSliderPanel.default} { color: var(--colorsUtilityYin030); }
|
|
95
91
|
`}
|
|
96
92
|
`}
|
|
97
93
|
|
|
@@ -107,6 +103,20 @@ const StyledSwitchSlider = _styledComponents.default.span`
|
|
|
107
103
|
}
|
|
108
104
|
`}
|
|
109
105
|
|
|
106
|
+
${isLoading && (0, _styledComponents.css)`
|
|
107
|
+
&::before {
|
|
108
|
+
display: none;
|
|
109
|
+
}
|
|
110
|
+
`}
|
|
111
|
+
|
|
112
|
+
${warning && !disabled && (0, _styledComponents.css)`
|
|
113
|
+
border-color: var(--colorsSemanticCaution500);
|
|
114
|
+
`}
|
|
115
|
+
|
|
116
|
+
${error && !disabled && (0, _styledComponents.css)`
|
|
117
|
+
border-color: var(--colorsSemanticNegative500);
|
|
118
|
+
`}
|
|
119
|
+
|
|
110
120
|
${_validationIcon.default} {
|
|
111
121
|
position: absolute;
|
|
112
122
|
right: -30px;
|
|
@@ -118,10 +128,9 @@ StyledSwitchSlider.propTypes = {
|
|
|
118
128
|
checked: _propTypes.default.bool,
|
|
119
129
|
disabled: _propTypes.default.bool,
|
|
120
130
|
size: _propTypes.default.string,
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
theme: _base.default
|
|
131
|
+
isLoading: _propTypes.default.bool,
|
|
132
|
+
error: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool]),
|
|
133
|
+
warning: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool])
|
|
125
134
|
};
|
|
126
135
|
var _default = StyledSwitchSlider;
|
|
127
136
|
exports.default = _default;
|
|
@@ -35,13 +35,10 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
|
|
35
35
|
|
|
36
36
|
const StyledSwitch = _styledComponents.default.div`
|
|
37
37
|
${({
|
|
38
|
-
checked,
|
|
39
38
|
fieldHelpInline,
|
|
40
39
|
labelInline,
|
|
41
|
-
labelSpacing,
|
|
42
40
|
reverse,
|
|
43
|
-
size
|
|
44
|
-
theme
|
|
41
|
+
size
|
|
45
42
|
}) => (0, _styledComponents.css)`
|
|
46
43
|
${_styledSystem.margin}
|
|
47
44
|
${_formField.FieldLineStyle} {
|
|
@@ -60,11 +57,7 @@ const StyledSwitch = _styledComponents.default.div`
|
|
|
60
57
|
|
|
61
58
|
${_hiddenCheckableInput.default}:not([disabled]) {
|
|
62
59
|
&:focus + ${_switchSlider.default} {
|
|
63
|
-
outline: solid 3px
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
&:hover + ${_switchSlider.default} {
|
|
67
|
-
background-color: ${checked ? theme.switch.onHover : theme.switch.offHover};
|
|
60
|
+
outline: solid 3px var(--colorsSemanticFocus500);
|
|
68
61
|
}
|
|
69
62
|
}
|
|
70
63
|
|
|
@@ -128,10 +121,9 @@ const StyledSwitch = _styledComponents.default.div`
|
|
|
128
121
|
margin-top: 0;
|
|
129
122
|
}
|
|
130
123
|
|
|
131
|
-
${!fieldHelpInline && `
|
|
124
|
+
${!fieldHelpInline && (0, _styledComponents.css)`
|
|
132
125
|
${_fieldHelp.default} {
|
|
133
126
|
margin-left: 60px;
|
|
134
|
-
padding-left: ${labelSpacing * theme.spacing}px;
|
|
135
127
|
}
|
|
136
128
|
`}
|
|
137
129
|
`}
|
|
@@ -173,10 +165,9 @@ const StyledSwitch = _styledComponents.default.div`
|
|
|
173
165
|
padding-bottom: 10px;
|
|
174
166
|
}
|
|
175
167
|
|
|
176
|
-
${!fieldHelpInline && reverse && `
|
|
168
|
+
${!fieldHelpInline && reverse && (0, _styledComponents.css)`
|
|
177
169
|
${_fieldHelp.default} {
|
|
178
170
|
margin-left: 78px;
|
|
179
|
-
padding-left: ${labelSpacing * theme.spacing}px;
|
|
180
171
|
}
|
|
181
172
|
`}
|
|
182
173
|
`}
|
|
@@ -188,8 +179,7 @@ StyledSwitch.propTypes = {
|
|
|
188
179
|
fieldHelpInline: _propTypes.default.bool,
|
|
189
180
|
labelInline: _propTypes.default.bool,
|
|
190
181
|
reverse: _propTypes.default.bool,
|
|
191
|
-
size: _propTypes.default.string
|
|
192
|
-
theme: _propTypes.default.object
|
|
182
|
+
size: _propTypes.default.string
|
|
193
183
|
};
|
|
194
184
|
StyledSwitch.defaultProps = {
|
|
195
185
|
theme: _base.default
|