carbon-react 118.3.3 → 118.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/components/box/box.component.d.ts +1 -1
- package/esm/components/box/box.component.js +4 -1
- package/esm/components/carbon-provider/carbon-provider.component.d.ts +3 -2
- package/esm/components/carbon-provider/carbon-provider.component.js +20 -9
- package/esm/components/loader/loader-square.style.js +8 -9
- package/esm/components/pill/pill.style.js +42 -8
- package/esm/components/portrait/portrait.component.js +11 -6
- package/esm/components/progress-tracker/progress-tracker.config.d.ts +1 -0
- package/esm/components/progress-tracker/progress-tracker.style.js +12 -4
- package/esm/components/switch/__internal__/switch-slider.style.d.ts +1 -5
- package/esm/components/switch/__internal__/switch-slider.style.js +8 -2
- package/esm/style/design-tokens/carbon-scoped-tokens-provider/carbon-scoped-tokens-provider.component.d.ts +2 -1
- package/esm/style/design-tokens/carbon-scoped-tokens-provider/carbon-scoped-tokens-provider.component.js +2 -2
- package/esm/style/design-tokens/generate-css-variables.util.d.ts +1 -1
- package/esm/style/design-tokens/generate-css-variables.util.js +7 -1
- package/lib/components/box/box.component.d.ts +1 -1
- package/lib/components/box/box.component.js +4 -1
- package/lib/components/carbon-provider/carbon-provider.component.d.ts +3 -2
- package/lib/components/carbon-provider/carbon-provider.component.js +19 -8
- package/lib/components/loader/loader-square.style.js +11 -9
- package/lib/components/pill/pill.style.js +42 -8
- package/lib/components/portrait/portrait.component.js +11 -5
- package/lib/components/progress-tracker/progress-tracker.config.d.ts +1 -0
- package/lib/components/progress-tracker/progress-tracker.style.js +12 -4
- package/lib/components/switch/__internal__/switch-slider.style.d.ts +1 -5
- package/lib/components/switch/__internal__/switch-slider.style.js +9 -2
- package/lib/style/design-tokens/carbon-scoped-tokens-provider/carbon-scoped-tokens-provider.component.d.ts +2 -1
- package/lib/style/design-tokens/carbon-scoped-tokens-provider/carbon-scoped-tokens-provider.component.js +1 -1
- package/lib/style/design-tokens/generate-css-variables.util.d.ts +1 -1
- package/lib/style/design-tokens/generate-css-variables.util.js +7 -1
- package/package.json +1 -1
|
@@ -28,7 +28,7 @@ export interface BoxProps extends SpaceProps, LayoutProps, FlexboxProps, ColorPr
|
|
|
28
28
|
rowGap?: Gap;
|
|
29
29
|
/** Design Token for Box Shadow. Note: please check that the box shadow design token you are using is compatible with the Box component. */
|
|
30
30
|
boxShadow?: BoxShadowsType;
|
|
31
|
-
/** Design Token for Border Radius. Note: please check that the border radius design token you are using is compatible with the Box component. */
|
|
31
|
+
/** Design Token for Border Radius. Note: please check that the border radius design token you are using is compatible with the Box component. **This prop will not do anything if you have the roundedCornerOptOut flag set in the CarbonProvider** */
|
|
32
32
|
borderRadius?: BorderRadiusType;
|
|
33
33
|
}
|
|
34
34
|
export declare const Box: import("styled-components").StyledComponent<"div", any, BoxProps, never>;
|
|
@@ -35,8 +35,11 @@ export const Box = styled.div`
|
|
|
35
35
|
${calculatePosition}
|
|
36
36
|
|
|
37
37
|
${({
|
|
38
|
+
theme,
|
|
38
39
|
borderRadius = "borderRadius000"
|
|
39
|
-
}) => `
|
|
40
|
+
}) => !theme.roundedCornersOptOut && css`
|
|
41
|
+
border-radius: var(--${borderRadius});
|
|
42
|
+
`}
|
|
40
43
|
|
|
41
44
|
${({
|
|
42
45
|
color,
|
|
@@ -4,7 +4,8 @@ export interface CarbonProviderProps {
|
|
|
4
4
|
theme?: Partial<ThemeObject>;
|
|
5
5
|
children: React.ReactNode;
|
|
6
6
|
validationRedesignOptIn?: boolean;
|
|
7
|
+
roundedCornersOptOut?: boolean;
|
|
7
8
|
}
|
|
8
|
-
export declare const NewValidationContext: React.Context<Pick<CarbonProviderProps, "validationRedesignOptIn">>;
|
|
9
|
-
export declare const CarbonProvider: ({ children, theme, validationRedesignOptIn, }: CarbonProviderProps) => JSX.Element;
|
|
9
|
+
export declare const NewValidationContext: React.Context<Pick<CarbonProviderProps, "validationRedesignOptIn" | "roundedCornersOptOut">>;
|
|
10
|
+
export declare const CarbonProvider: ({ children, theme, validationRedesignOptIn, roundedCornersOptOut, }: CarbonProviderProps) => JSX.Element;
|
|
10
11
|
export default CarbonProvider;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { createContext } from "react";
|
|
1
|
+
import React, { createContext, useContext } from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import { ThemeProvider } from "styled-components";
|
|
4
4
|
import mintTheme from "../../style/themes/mint";
|
|
@@ -9,17 +9,28 @@ export const NewValidationContext = /*#__PURE__*/createContext({});
|
|
|
9
9
|
const CarbonProvider = ({
|
|
10
10
|
children,
|
|
11
11
|
theme = mintTheme,
|
|
12
|
-
validationRedesignOptIn = false
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
validationRedesignOptIn = false,
|
|
13
|
+
roundedCornersOptOut = false
|
|
14
|
+
}) => {
|
|
15
|
+
const {
|
|
16
|
+
roundedCornersOptOut: existingRoundedCornersOptOut
|
|
17
|
+
} = useContext(NewValidationContext);
|
|
18
|
+
const roundedCornersOptOutValue = existingRoundedCornersOptOut || roundedCornersOptOut;
|
|
19
|
+
return /*#__PURE__*/React.createElement(ThemeProvider, {
|
|
20
|
+
theme: { ...theme,
|
|
21
|
+
roundedCornersOptOut: roundedCornersOptOutValue
|
|
22
|
+
}
|
|
23
|
+
}, /*#__PURE__*/React.createElement(CarbonScopedTokensProvider, null, /*#__PURE__*/React.createElement(NewValidationContext.Provider, {
|
|
24
|
+
value: {
|
|
25
|
+
validationRedesignOptIn,
|
|
26
|
+
roundedCornersOptOut: roundedCornersOptOutValue
|
|
27
|
+
}
|
|
28
|
+
}, /*#__PURE__*/React.createElement(TopModalContextProvider, null, children))));
|
|
29
|
+
};
|
|
20
30
|
|
|
21
31
|
CarbonProvider.propTypes = {
|
|
22
32
|
"children": PropTypes.node,
|
|
33
|
+
"roundedCornersOptOut": PropTypes.bool,
|
|
23
34
|
"theme": PropTypes.shape({
|
|
24
35
|
"colors": PropTypes.shape({
|
|
25
36
|
"destructive": PropTypes.shape({
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import styled, { css, keyframes } from "styled-components";
|
|
2
|
+
import baseTheme from "../../style/themes/base";
|
|
2
3
|
const loaderAnimation = keyframes`
|
|
3
4
|
0%, 80%, 100% {
|
|
4
5
|
opacity: 0;
|
|
@@ -10,35 +11,31 @@ const loaderAnimation = keyframes`
|
|
|
10
11
|
}
|
|
11
12
|
`;
|
|
12
13
|
|
|
13
|
-
const getDimentions = size => {
|
|
14
|
+
const getDimentions = (size, roundedCornersOptOut) => {
|
|
14
15
|
let width;
|
|
15
16
|
let marginRight;
|
|
16
|
-
let borderRadius;
|
|
17
17
|
|
|
18
18
|
switch (size) {
|
|
19
19
|
case "medium":
|
|
20
20
|
width = "16px";
|
|
21
21
|
marginRight = "8px";
|
|
22
|
-
borderRadius = "var(--borderRadiusCircle)";
|
|
23
22
|
break;
|
|
24
23
|
|
|
25
24
|
case "large":
|
|
26
25
|
width = "20px";
|
|
27
26
|
marginRight = "8px";
|
|
28
|
-
borderRadius = "var(--borderRadiusCircle)";
|
|
29
27
|
break;
|
|
30
28
|
|
|
31
29
|
default:
|
|
32
30
|
width = "12px";
|
|
33
31
|
marginRight = "6px";
|
|
34
|
-
borderRadius = "var(--borderRadiusCircle)";
|
|
35
32
|
}
|
|
36
33
|
|
|
37
34
|
return css`
|
|
38
35
|
width: ${width};
|
|
39
36
|
height: ${width};
|
|
40
37
|
margin-right: ${marginRight};
|
|
41
|
-
border-radius:
|
|
38
|
+
${!roundedCornersOptOut && "border-radius: var(--borderRadiusCircle);"}
|
|
42
39
|
`;
|
|
43
40
|
};
|
|
44
41
|
|
|
@@ -46,12 +43,13 @@ const StyledLoaderSquare = styled.div`
|
|
|
46
43
|
${({
|
|
47
44
|
size,
|
|
48
45
|
isInsideButton,
|
|
49
|
-
isActive
|
|
46
|
+
isActive,
|
|
47
|
+
theme
|
|
50
48
|
}) => css`
|
|
51
49
|
animation: ${loaderAnimation} 1s infinite ease-in-out both;
|
|
52
50
|
background-color: var(--colorsActionMajor500);
|
|
53
51
|
display: inline-block;
|
|
54
|
-
${getDimentions(size)}
|
|
52
|
+
${getDimentions(size, theme.roundedCornersOptOut)}
|
|
55
53
|
|
|
56
54
|
${isInsideButton && css`
|
|
57
55
|
background-color: ${isActive ? "var(--colorsUtilityYang100)" : "var(--colorsSemanticNeutral500)"};
|
|
@@ -74,6 +72,7 @@ const StyledLoaderSquare = styled.div`
|
|
|
74
72
|
StyledLoaderSquare.defaultProps = {
|
|
75
73
|
size: "small",
|
|
76
74
|
isInsideButton: false,
|
|
77
|
-
isActive: true
|
|
75
|
+
isActive: true,
|
|
76
|
+
theme: baseTheme
|
|
78
77
|
};
|
|
79
78
|
export default StyledLoaderSquare;
|
|
@@ -69,7 +69,9 @@ const StyledPill = styled.span`
|
|
|
69
69
|
align-items: center;
|
|
70
70
|
justify-content: center;
|
|
71
71
|
border: 2px solid ${pillColor};
|
|
72
|
-
|
|
72
|
+
${!theme.roundedCornersOptOut && css`
|
|
73
|
+
border-radius: var(--borderRadius025);
|
|
74
|
+
`}
|
|
73
75
|
height: auto;
|
|
74
76
|
${!wrapText && css`
|
|
75
77
|
white-space: nowrap;
|
|
@@ -92,30 +94,64 @@ const StyledPill = styled.span`
|
|
|
92
94
|
min-height: 16px;
|
|
93
95
|
line-height: 16px;
|
|
94
96
|
font-size: 10px;
|
|
97
|
+
|
|
98
|
+
${theme.roundedCornersOptOut && css`
|
|
99
|
+
border-radius: 12px;
|
|
100
|
+
|
|
101
|
+
button {
|
|
102
|
+
border-radius: 0 10px 10px 0;
|
|
103
|
+
}
|
|
104
|
+
`}
|
|
95
105
|
`}
|
|
96
106
|
|
|
97
107
|
${size === "M" && css`
|
|
98
108
|
min-height: 20px;
|
|
99
109
|
line-height: 20px;
|
|
100
110
|
font-size: 12px;
|
|
111
|
+
|
|
112
|
+
${theme.roundedCornersOptOut && css`
|
|
113
|
+
border-radius: 12px;
|
|
114
|
+
|
|
115
|
+
button {
|
|
116
|
+
border-radius: 0 10px 10px 0;
|
|
117
|
+
}
|
|
118
|
+
`}
|
|
101
119
|
`}
|
|
102
120
|
|
|
103
121
|
${size === "L" && css`
|
|
104
122
|
min-height: 24px;
|
|
105
123
|
line-height: 24px;
|
|
106
124
|
font-size: 14px;
|
|
125
|
+
|
|
126
|
+
${theme.roundedCornersOptOut && css`
|
|
127
|
+
border-radius: 13px;
|
|
128
|
+
|
|
129
|
+
button {
|
|
130
|
+
border-radius: 0 11px 11px 0;
|
|
131
|
+
}
|
|
132
|
+
`}
|
|
107
133
|
`}
|
|
108
134
|
|
|
109
135
|
${size === "XL" && css`
|
|
110
136
|
min-height: 26px;
|
|
111
137
|
line-height: 26px;
|
|
112
138
|
font-size: 16px;
|
|
139
|
+
|
|
140
|
+
${theme.roundedCornersOptOut && css`
|
|
141
|
+
border-radius: 15px;
|
|
142
|
+
|
|
143
|
+
button {
|
|
144
|
+
border-radius: 0 12px 12px 0;
|
|
145
|
+
}
|
|
146
|
+
`}
|
|
113
147
|
`}
|
|
114
148
|
|
|
115
149
|
${isDeletable && css`
|
|
116
150
|
button {
|
|
117
151
|
-webkit-appearance: none;
|
|
118
|
-
|
|
152
|
+
${!theme.roundedCornersOptOut && css`
|
|
153
|
+
border-radius: var(--borderRadius000);
|
|
154
|
+
`}
|
|
119
155
|
border: none;
|
|
120
156
|
bottom: 0;
|
|
121
157
|
font-size: 100%;
|
|
@@ -130,8 +166,10 @@ const StyledPill = styled.span`
|
|
|
130
166
|
outline: none;
|
|
131
167
|
box-shadow: 0 0 0 3px var(--colorsSemanticFocus500);
|
|
132
168
|
background-color: ${buttonFocusColor};
|
|
133
|
-
|
|
134
|
-
var(--
|
|
169
|
+
${!theme.roundedCornersOptOut && css`
|
|
170
|
+
border-radius: var(--borderRadius000) var(--borderRadius025)
|
|
171
|
+
var(--borderRadius025) var(--borderRadius000);
|
|
172
|
+
`}
|
|
135
173
|
|
|
136
174
|
& {
|
|
137
175
|
color: ${contentColor};
|
|
@@ -179,7 +217,6 @@ const StyledPill = styled.span`
|
|
|
179
217
|
button {
|
|
180
218
|
padding: 0;
|
|
181
219
|
line-height: 14px;
|
|
182
|
-
|
|
183
220
|
${addStyleToPillIcon("7px")}
|
|
184
221
|
}
|
|
185
222
|
`}
|
|
@@ -191,7 +228,6 @@ const StyledPill = styled.span`
|
|
|
191
228
|
width: 24px;
|
|
192
229
|
padding: 0;
|
|
193
230
|
line-height: 15px;
|
|
194
|
-
|
|
195
231
|
${addStyleToPillIcon("10px")}
|
|
196
232
|
}
|
|
197
233
|
`}
|
|
@@ -203,7 +239,6 @@ const StyledPill = styled.span`
|
|
|
203
239
|
width: 28px;
|
|
204
240
|
padding: 0;
|
|
205
241
|
line-height: 16px;
|
|
206
|
-
|
|
207
242
|
${addStyleToPillIcon("12px")}
|
|
208
243
|
}
|
|
209
244
|
`}
|
|
@@ -215,7 +250,6 @@ const StyledPill = styled.span`
|
|
|
215
250
|
width: 32px;
|
|
216
251
|
padding: 0;
|
|
217
252
|
line-height: 18px;
|
|
218
|
-
|
|
219
253
|
${addStyleToPillIcon("13px")}
|
|
220
254
|
}
|
|
221
255
|
`}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
|
|
3
|
-
import React, { useEffect, useState } from "react";
|
|
3
|
+
import React, { useEffect, useState, useContext } from "react";
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
5
|
import Tooltip from "../tooltip";
|
|
6
6
|
import tagComponent from "../../__internal__/utils/helpers/tags/tags";
|
|
@@ -8,6 +8,7 @@ import PortraitGravatar from "./portrait-gravatar.component";
|
|
|
8
8
|
import PortraitInitials from "./portrait-initials.component";
|
|
9
9
|
import { StyledCustomImg, StyledIcon, StyledPortraitContainer } from "./portrait.style";
|
|
10
10
|
import { filterStyledSystemMarginProps } from "../../style/utils";
|
|
11
|
+
import { NewValidationContext as RoundedCornersOptOutContext } from "../carbon-provider/carbon-provider.component";
|
|
11
12
|
|
|
12
13
|
const Portrait = ({
|
|
13
14
|
alt = "",
|
|
@@ -15,7 +16,7 @@ const Portrait = ({
|
|
|
15
16
|
gravatar,
|
|
16
17
|
iconType = "individual",
|
|
17
18
|
initials,
|
|
18
|
-
shape
|
|
19
|
+
shape,
|
|
19
20
|
size = "M",
|
|
20
21
|
src,
|
|
21
22
|
onClick,
|
|
@@ -30,6 +31,10 @@ const Portrait = ({
|
|
|
30
31
|
...rest
|
|
31
32
|
}) => {
|
|
32
33
|
const [externalError, setExternalError] = useState(false);
|
|
34
|
+
const {
|
|
35
|
+
roundedCornersOptOut
|
|
36
|
+
} = useContext(RoundedCornersOptOutContext);
|
|
37
|
+
const defaultShape = roundedCornersOptOut ? "square" : "circle";
|
|
33
38
|
useEffect(() => {
|
|
34
39
|
setExternalError(false);
|
|
35
40
|
}, [gravatar, src]);
|
|
@@ -39,14 +44,14 @@ const Portrait = ({
|
|
|
39
44
|
let portrait = /*#__PURE__*/React.createElement(StyledIcon, {
|
|
40
45
|
type: iconType,
|
|
41
46
|
size: size,
|
|
42
|
-
shape: shape,
|
|
47
|
+
shape: shape || defaultShape,
|
|
43
48
|
darkBackground: darkBackground
|
|
44
49
|
});
|
|
45
50
|
|
|
46
51
|
if (initials) {
|
|
47
52
|
portrait = /*#__PURE__*/React.createElement(PortraitInitials, {
|
|
48
53
|
size: size,
|
|
49
|
-
shape: shape,
|
|
54
|
+
shape: shape || defaultShape,
|
|
50
55
|
initials: initials,
|
|
51
56
|
darkBackground: darkBackground,
|
|
52
57
|
alt: alt
|
|
@@ -58,7 +63,7 @@ const Portrait = ({
|
|
|
58
63
|
src: src,
|
|
59
64
|
alt: alt,
|
|
60
65
|
size: size,
|
|
61
|
-
shape: shape,
|
|
66
|
+
shape: shape || defaultShape,
|
|
62
67
|
"data-element": "user-image",
|
|
63
68
|
onError: () => setExternalError(true)
|
|
64
69
|
});
|
|
@@ -67,7 +72,7 @@ const Portrait = ({
|
|
|
67
72
|
if (gravatar && !externalError) {
|
|
68
73
|
portrait = /*#__PURE__*/React.createElement(PortraitGravatar, {
|
|
69
74
|
gravatarEmail: gravatar,
|
|
70
|
-
shape: shape,
|
|
75
|
+
shape: shape || defaultShape,
|
|
71
76
|
size: size,
|
|
72
77
|
alt: alt,
|
|
73
78
|
errorCallback: () => setExternalError(true)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PROGRESS_TRACKER_SIZES: string[];
|
|
@@ -48,7 +48,8 @@ const StyledProgressBar = styled.span`
|
|
|
48
48
|
${({
|
|
49
49
|
size,
|
|
50
50
|
progress,
|
|
51
|
-
error
|
|
51
|
+
error,
|
|
52
|
+
theme
|
|
52
53
|
}) => css`
|
|
53
54
|
display: flex;
|
|
54
55
|
position: relative;
|
|
@@ -57,7 +58,7 @@ const StyledProgressBar = styled.span`
|
|
|
57
58
|
progress,
|
|
58
59
|
error
|
|
59
60
|
})};
|
|
60
|
-
border-radius: var(--borderRadius400);
|
|
61
|
+
border-radius: ${theme.roundedCornersOptOut ? "25px" : "var(--borderRadius400)"};
|
|
61
62
|
overflow-x: hidden;
|
|
62
63
|
height: ${getHeight(size)};
|
|
63
64
|
width: 100%;
|
|
@@ -96,7 +97,8 @@ const InnerBar = styled.span`
|
|
|
96
97
|
progress,
|
|
97
98
|
size = "medium",
|
|
98
99
|
length,
|
|
99
|
-
error
|
|
100
|
+
error,
|
|
101
|
+
theme
|
|
100
102
|
}) => css`
|
|
101
103
|
position: relative;
|
|
102
104
|
left: 0;
|
|
@@ -104,12 +106,18 @@ const InnerBar = styled.span`
|
|
|
104
106
|
progress,
|
|
105
107
|
error
|
|
106
108
|
})};
|
|
107
|
-
border-radius: var(--borderRadius400);
|
|
109
|
+
border-radius: ${theme.roundedCornersOptOut ? "25px" : "var(--borderRadius400)"};
|
|
108
110
|
width: calc(${length} * ${progress && progress / 100});
|
|
109
111
|
min-width: 2px;
|
|
110
112
|
height: ${getHeight(size)};
|
|
111
113
|
`}
|
|
112
114
|
`;
|
|
115
|
+
InnerBar.defaultProps = {
|
|
116
|
+
theme: baseTheme
|
|
117
|
+
};
|
|
118
|
+
StyledProgressBar.defaultProps = {
|
|
119
|
+
theme: baseTheme
|
|
120
|
+
};
|
|
113
121
|
StyledProgressTracker.defaultProps = {
|
|
114
122
|
theme: baseTheme
|
|
115
123
|
};
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
interface StyledSwitchSliderProps extends Pick<SwitchSliderProps, "checked" | "disabled" | "size" | "error" | "warning"> {
|
|
3
|
-
isLoading?: boolean;
|
|
4
|
-
}
|
|
5
|
-
declare const StyledSwitchSlider: import("styled-components").StyledComponent<"span", any, StyledSwitchSliderProps, never>;
|
|
1
|
+
declare const StyledSwitchSlider: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
6
2
|
export default StyledSwitchSlider;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import styled, { css } from "styled-components";
|
|
2
2
|
import SwitchSliderPanel from "./switch-slider-panel.style";
|
|
3
3
|
import StyledValidationIcon from "../../../__internal__/validations/validation-icon.style";
|
|
4
|
+
import baseTheme from "../../../style/themes/base";
|
|
4
5
|
const StyledSwitchSlider = styled.span`
|
|
5
6
|
${({
|
|
6
7
|
checked,
|
|
@@ -8,7 +9,8 @@ const StyledSwitchSlider = styled.span`
|
|
|
8
9
|
disabled,
|
|
9
10
|
size,
|
|
10
11
|
error,
|
|
11
|
-
warning
|
|
12
|
+
warning,
|
|
13
|
+
theme
|
|
12
14
|
}) => css`
|
|
13
15
|
display: flex;
|
|
14
16
|
font-size: 12px;
|
|
@@ -22,7 +24,7 @@ const StyledSwitchSlider = styled.span`
|
|
|
22
24
|
width: 64px;
|
|
23
25
|
min-width: fit-content;
|
|
24
26
|
z-index: 2;
|
|
25
|
-
border-radius: var(--borderRadius400);
|
|
27
|
+
border-radius: ${theme !== null && theme !== void 0 && theme.roundedCornersOptOut ? "90px" : "var(--borderRadius400)"};
|
|
26
28
|
border-style: solid;
|
|
27
29
|
border-color: var(--colorsActionMinor400);
|
|
28
30
|
border-width: var(--borderWidth200);
|
|
@@ -76,6 +78,7 @@ const StyledSwitchSlider = styled.span`
|
|
|
76
78
|
`}
|
|
77
79
|
|
|
78
80
|
${size === "large" && css`
|
|
81
|
+
${theme !== null && theme !== void 0 && theme.roundedCornersOptOut ? "border-radius: 30px;" : ""}
|
|
79
82
|
&::before {
|
|
80
83
|
height: 32px;
|
|
81
84
|
width: 32px;
|
|
@@ -107,4 +110,7 @@ const StyledSwitchSlider = styled.span`
|
|
|
107
110
|
}
|
|
108
111
|
`}
|
|
109
112
|
`;
|
|
113
|
+
StyledSwitchSlider.defaultProps = {
|
|
114
|
+
theme: baseTheme
|
|
115
|
+
};
|
|
110
116
|
export default StyledSwitchSlider;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ThemeObject } from "../../themes/base";
|
|
2
|
+
import { CarbonProviderProps } from "../../../components/carbon-provider";
|
|
2
3
|
/**
|
|
3
4
|
*
|
|
4
5
|
* Converts theme properties to css variables form and set them locally for
|
|
5
6
|
* given scope
|
|
6
7
|
*
|
|
7
8
|
*/
|
|
8
|
-
declare const CarbonScopedTokensProvider: import("styled-components").StyledComponent<"div", any, ThemeObject, never>;
|
|
9
|
+
declare const CarbonScopedTokensProvider: import("styled-components").StyledComponent<"div", any, ThemeObject & Pick<CarbonProviderProps, "roundedCornersOptOut">, never>;
|
|
9
10
|
export default CarbonScopedTokensProvider;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import styled from "styled-components";
|
|
2
2
|
import { baseTheme } from "../../themes";
|
|
3
3
|
import generateCssVariables from "../generate-css-variables.util";
|
|
4
|
+
|
|
4
5
|
/**
|
|
5
6
|
*
|
|
6
7
|
* Converts theme properties to css variables form and set them locally for
|
|
7
8
|
* given scope
|
|
8
9
|
*
|
|
9
10
|
*/
|
|
10
|
-
|
|
11
11
|
const CarbonScopedTokensProvider = styled.div`
|
|
12
12
|
margin: 0;
|
|
13
13
|
padding: 0;
|
|
@@ -16,7 +16,7 @@ const CarbonScopedTokensProvider = styled.div`
|
|
|
16
16
|
|
|
17
17
|
${({
|
|
18
18
|
theme
|
|
19
|
-
}) => generateCssVariables(theme.compatibility)}
|
|
19
|
+
}) => generateCssVariables(theme.compatibility, theme.roundedCornersOptOut)}
|
|
20
20
|
`;
|
|
21
21
|
CarbonScopedTokensProvider.defaultProps = {
|
|
22
22
|
theme: baseTheme
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ThemeObject } from "../themes/base";
|
|
2
|
-
declare const _default: (theme: ThemeObject | Record<string, string
|
|
2
|
+
declare const _default: (theme: ThemeObject | Record<string, string>, roundedCornersOptOupt?: boolean | undefined) => string;
|
|
3
3
|
/**
|
|
4
4
|
*
|
|
5
5
|
* Converts theme properties to the string in form of css variable definitions.
|
|
@@ -6,4 +6,10 @@
|
|
|
6
6
|
* form of CSS variables along with styled-components ThemeProvider.
|
|
7
7
|
*
|
|
8
8
|
*/
|
|
9
|
-
export default (theme => Object.entries(theme).map(([key, value]) =>
|
|
9
|
+
export default ((theme, roundedCornersOptOupt) => Object.entries(theme).map(([key, value]) => {
|
|
10
|
+
if (roundedCornersOptOupt && key.startsWith("borderRadius") && key !== "borderRadiusCircle") {
|
|
11
|
+
return `--${key}: 0px;`;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return `--${key}: ${value};`;
|
|
15
|
+
}).join("\r\n"));
|
|
@@ -28,7 +28,7 @@ export interface BoxProps extends SpaceProps, LayoutProps, FlexboxProps, ColorPr
|
|
|
28
28
|
rowGap?: Gap;
|
|
29
29
|
/** Design Token for Box Shadow. Note: please check that the box shadow design token you are using is compatible with the Box component. */
|
|
30
30
|
boxShadow?: BoxShadowsType;
|
|
31
|
-
/** Design Token for Border Radius. Note: please check that the border radius design token you are using is compatible with the Box component. */
|
|
31
|
+
/** Design Token for Border Radius. Note: please check that the border radius design token you are using is compatible with the Box component. **This prop will not do anything if you have the roundedCornerOptOut flag set in the CarbonProvider** */
|
|
32
32
|
borderRadius?: BorderRadiusType;
|
|
33
33
|
}
|
|
34
34
|
export declare const Box: import("styled-components").StyledComponent<"div", any, BoxProps, never>;
|
|
@@ -55,8 +55,11 @@ const Box = _styledComponents.default.div`
|
|
|
55
55
|
${calculatePosition}
|
|
56
56
|
|
|
57
57
|
${({
|
|
58
|
+
theme,
|
|
58
59
|
borderRadius = "borderRadius000"
|
|
59
|
-
}) =>
|
|
60
|
+
}) => !theme.roundedCornersOptOut && (0, _styledComponents.css)`
|
|
61
|
+
border-radius: var(--${borderRadius});
|
|
62
|
+
`}
|
|
60
63
|
|
|
61
64
|
${({
|
|
62
65
|
color,
|
|
@@ -4,7 +4,8 @@ export interface CarbonProviderProps {
|
|
|
4
4
|
theme?: Partial<ThemeObject>;
|
|
5
5
|
children: React.ReactNode;
|
|
6
6
|
validationRedesignOptIn?: boolean;
|
|
7
|
+
roundedCornersOptOut?: boolean;
|
|
7
8
|
}
|
|
8
|
-
export declare const NewValidationContext: React.Context<Pick<CarbonProviderProps, "validationRedesignOptIn">>;
|
|
9
|
-
export declare const CarbonProvider: ({ children, theme, validationRedesignOptIn, }: CarbonProviderProps) => JSX.Element;
|
|
9
|
+
export declare const NewValidationContext: React.Context<Pick<CarbonProviderProps, "validationRedesignOptIn" | "roundedCornersOptOut">>;
|
|
10
|
+
export declare const CarbonProvider: ({ children, theme, validationRedesignOptIn, roundedCornersOptOut, }: CarbonProviderProps) => JSX.Element;
|
|
10
11
|
export default CarbonProvider;
|
|
@@ -29,18 +29,29 @@ exports.NewValidationContext = NewValidationContext;
|
|
|
29
29
|
const CarbonProvider = ({
|
|
30
30
|
children,
|
|
31
31
|
theme = _mint.default,
|
|
32
|
-
validationRedesignOptIn = false
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
32
|
+
validationRedesignOptIn = false,
|
|
33
|
+
roundedCornersOptOut = false
|
|
34
|
+
}) => {
|
|
35
|
+
const {
|
|
36
|
+
roundedCornersOptOut: existingRoundedCornersOptOut
|
|
37
|
+
} = (0, _react.useContext)(NewValidationContext);
|
|
38
|
+
const roundedCornersOptOutValue = existingRoundedCornersOptOut || roundedCornersOptOut;
|
|
39
|
+
return /*#__PURE__*/_react.default.createElement(_styledComponents.ThemeProvider, {
|
|
40
|
+
theme: { ...theme,
|
|
41
|
+
roundedCornersOptOut: roundedCornersOptOutValue
|
|
42
|
+
}
|
|
43
|
+
}, /*#__PURE__*/_react.default.createElement(_carbonScopedTokensProvider.default, null, /*#__PURE__*/_react.default.createElement(NewValidationContext.Provider, {
|
|
44
|
+
value: {
|
|
45
|
+
validationRedesignOptIn,
|
|
46
|
+
roundedCornersOptOut: roundedCornersOptOutValue
|
|
47
|
+
}
|
|
48
|
+
}, /*#__PURE__*/_react.default.createElement(_topModalContext.TopModalContextProvider, null, children))));
|
|
49
|
+
};
|
|
40
50
|
|
|
41
51
|
exports.CarbonProvider = CarbonProvider;
|
|
42
52
|
CarbonProvider.propTypes = {
|
|
43
53
|
"children": _propTypes.default.node,
|
|
54
|
+
"roundedCornersOptOut": _propTypes.default.bool,
|
|
44
55
|
"theme": _propTypes.default.shape({
|
|
45
56
|
"colors": _propTypes.default.shape({
|
|
46
57
|
"destructive": _propTypes.default.shape({
|
|
@@ -7,6 +7,10 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
9
9
|
|
|
10
|
+
var _base = _interopRequireDefault(require("../../style/themes/base"));
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
10
14
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
11
15
|
|
|
12
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; }
|
|
@@ -22,35 +26,31 @@ const loaderAnimation = (0, _styledComponents.keyframes)`
|
|
|
22
26
|
}
|
|
23
27
|
`;
|
|
24
28
|
|
|
25
|
-
const getDimentions = size => {
|
|
29
|
+
const getDimentions = (size, roundedCornersOptOut) => {
|
|
26
30
|
let width;
|
|
27
31
|
let marginRight;
|
|
28
|
-
let borderRadius;
|
|
29
32
|
|
|
30
33
|
switch (size) {
|
|
31
34
|
case "medium":
|
|
32
35
|
width = "16px";
|
|
33
36
|
marginRight = "8px";
|
|
34
|
-
borderRadius = "var(--borderRadiusCircle)";
|
|
35
37
|
break;
|
|
36
38
|
|
|
37
39
|
case "large":
|
|
38
40
|
width = "20px";
|
|
39
41
|
marginRight = "8px";
|
|
40
|
-
borderRadius = "var(--borderRadiusCircle)";
|
|
41
42
|
break;
|
|
42
43
|
|
|
43
44
|
default:
|
|
44
45
|
width = "12px";
|
|
45
46
|
marginRight = "6px";
|
|
46
|
-
borderRadius = "var(--borderRadiusCircle)";
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
return (0, _styledComponents.css)`
|
|
50
50
|
width: ${width};
|
|
51
51
|
height: ${width};
|
|
52
52
|
margin-right: ${marginRight};
|
|
53
|
-
border-radius:
|
|
53
|
+
${!roundedCornersOptOut && "border-radius: var(--borderRadiusCircle);"}
|
|
54
54
|
`;
|
|
55
55
|
};
|
|
56
56
|
|
|
@@ -58,12 +58,13 @@ const StyledLoaderSquare = _styledComponents.default.div`
|
|
|
58
58
|
${({
|
|
59
59
|
size,
|
|
60
60
|
isInsideButton,
|
|
61
|
-
isActive
|
|
61
|
+
isActive,
|
|
62
|
+
theme
|
|
62
63
|
}) => (0, _styledComponents.css)`
|
|
63
64
|
animation: ${loaderAnimation} 1s infinite ease-in-out both;
|
|
64
65
|
background-color: var(--colorsActionMajor500);
|
|
65
66
|
display: inline-block;
|
|
66
|
-
${getDimentions(size)}
|
|
67
|
+
${getDimentions(size, theme.roundedCornersOptOut)}
|
|
67
68
|
|
|
68
69
|
${isInsideButton && (0, _styledComponents.css)`
|
|
69
70
|
background-color: ${isActive ? "var(--colorsUtilityYang100)" : "var(--colorsSemanticNeutral500)"};
|
|
@@ -86,7 +87,8 @@ const StyledLoaderSquare = _styledComponents.default.div`
|
|
|
86
87
|
StyledLoaderSquare.defaultProps = {
|
|
87
88
|
size: "small",
|
|
88
89
|
isInsideButton: false,
|
|
89
|
-
isActive: true
|
|
90
|
+
isActive: true,
|
|
91
|
+
theme: _base.default
|
|
90
92
|
};
|
|
91
93
|
var _default = StyledLoaderSquare;
|
|
92
94
|
exports.default = _default;
|
|
@@ -89,7 +89,9 @@ const StyledPill = _styledComponents.default.span`
|
|
|
89
89
|
align-items: center;
|
|
90
90
|
justify-content: center;
|
|
91
91
|
border: 2px solid ${pillColor};
|
|
92
|
-
|
|
92
|
+
${!theme.roundedCornersOptOut && (0, _styledComponents.css)`
|
|
93
|
+
border-radius: var(--borderRadius025);
|
|
94
|
+
`}
|
|
93
95
|
height: auto;
|
|
94
96
|
${!wrapText && (0, _styledComponents.css)`
|
|
95
97
|
white-space: nowrap;
|
|
@@ -112,30 +114,64 @@ const StyledPill = _styledComponents.default.span`
|
|
|
112
114
|
min-height: 16px;
|
|
113
115
|
line-height: 16px;
|
|
114
116
|
font-size: 10px;
|
|
117
|
+
|
|
118
|
+
${theme.roundedCornersOptOut && (0, _styledComponents.css)`
|
|
119
|
+
border-radius: 12px;
|
|
120
|
+
|
|
121
|
+
button {
|
|
122
|
+
border-radius: 0 10px 10px 0;
|
|
123
|
+
}
|
|
124
|
+
`}
|
|
115
125
|
`}
|
|
116
126
|
|
|
117
127
|
${size === "M" && (0, _styledComponents.css)`
|
|
118
128
|
min-height: 20px;
|
|
119
129
|
line-height: 20px;
|
|
120
130
|
font-size: 12px;
|
|
131
|
+
|
|
132
|
+
${theme.roundedCornersOptOut && (0, _styledComponents.css)`
|
|
133
|
+
border-radius: 12px;
|
|
134
|
+
|
|
135
|
+
button {
|
|
136
|
+
border-radius: 0 10px 10px 0;
|
|
137
|
+
}
|
|
138
|
+
`}
|
|
121
139
|
`}
|
|
122
140
|
|
|
123
141
|
${size === "L" && (0, _styledComponents.css)`
|
|
124
142
|
min-height: 24px;
|
|
125
143
|
line-height: 24px;
|
|
126
144
|
font-size: 14px;
|
|
145
|
+
|
|
146
|
+
${theme.roundedCornersOptOut && (0, _styledComponents.css)`
|
|
147
|
+
border-radius: 13px;
|
|
148
|
+
|
|
149
|
+
button {
|
|
150
|
+
border-radius: 0 11px 11px 0;
|
|
151
|
+
}
|
|
152
|
+
`}
|
|
127
153
|
`}
|
|
128
154
|
|
|
129
155
|
${size === "XL" && (0, _styledComponents.css)`
|
|
130
156
|
min-height: 26px;
|
|
131
157
|
line-height: 26px;
|
|
132
158
|
font-size: 16px;
|
|
159
|
+
|
|
160
|
+
${theme.roundedCornersOptOut && (0, _styledComponents.css)`
|
|
161
|
+
border-radius: 15px;
|
|
162
|
+
|
|
163
|
+
button {
|
|
164
|
+
border-radius: 0 12px 12px 0;
|
|
165
|
+
}
|
|
166
|
+
`}
|
|
133
167
|
`}
|
|
134
168
|
|
|
135
169
|
${isDeletable && (0, _styledComponents.css)`
|
|
136
170
|
button {
|
|
137
171
|
-webkit-appearance: none;
|
|
138
|
-
|
|
172
|
+
${!theme.roundedCornersOptOut && (0, _styledComponents.css)`
|
|
173
|
+
border-radius: var(--borderRadius000);
|
|
174
|
+
`}
|
|
139
175
|
border: none;
|
|
140
176
|
bottom: 0;
|
|
141
177
|
font-size: 100%;
|
|
@@ -150,8 +186,10 @@ const StyledPill = _styledComponents.default.span`
|
|
|
150
186
|
outline: none;
|
|
151
187
|
box-shadow: 0 0 0 3px var(--colorsSemanticFocus500);
|
|
152
188
|
background-color: ${buttonFocusColor};
|
|
153
|
-
|
|
154
|
-
var(--
|
|
189
|
+
${!theme.roundedCornersOptOut && (0, _styledComponents.css)`
|
|
190
|
+
border-radius: var(--borderRadius000) var(--borderRadius025)
|
|
191
|
+
var(--borderRadius025) var(--borderRadius000);
|
|
192
|
+
`}
|
|
155
193
|
|
|
156
194
|
& {
|
|
157
195
|
color: ${contentColor};
|
|
@@ -199,7 +237,6 @@ const StyledPill = _styledComponents.default.span`
|
|
|
199
237
|
button {
|
|
200
238
|
padding: 0;
|
|
201
239
|
line-height: 14px;
|
|
202
|
-
|
|
203
240
|
${addStyleToPillIcon("7px")}
|
|
204
241
|
}
|
|
205
242
|
`}
|
|
@@ -211,7 +248,6 @@ const StyledPill = _styledComponents.default.span`
|
|
|
211
248
|
width: 24px;
|
|
212
249
|
padding: 0;
|
|
213
250
|
line-height: 15px;
|
|
214
|
-
|
|
215
251
|
${addStyleToPillIcon("10px")}
|
|
216
252
|
}
|
|
217
253
|
`}
|
|
@@ -223,7 +259,6 @@ const StyledPill = _styledComponents.default.span`
|
|
|
223
259
|
width: 28px;
|
|
224
260
|
padding: 0;
|
|
225
261
|
line-height: 16px;
|
|
226
|
-
|
|
227
262
|
${addStyleToPillIcon("12px")}
|
|
228
263
|
}
|
|
229
264
|
`}
|
|
@@ -235,7 +270,6 @@ const StyledPill = _styledComponents.default.span`
|
|
|
235
270
|
width: 32px;
|
|
236
271
|
padding: 0;
|
|
237
272
|
line-height: 18px;
|
|
238
|
-
|
|
239
273
|
${addStyleToPillIcon("13px")}
|
|
240
274
|
}
|
|
241
275
|
`}
|
|
@@ -21,6 +21,8 @@ var _portrait = require("./portrait.style");
|
|
|
21
21
|
|
|
22
22
|
var _utils = require("../../style/utils");
|
|
23
23
|
|
|
24
|
+
var _carbonProvider = require("../carbon-provider/carbon-provider.component");
|
|
25
|
+
|
|
24
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
27
|
|
|
26
28
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
@@ -35,7 +37,7 @@ const Portrait = ({
|
|
|
35
37
|
gravatar,
|
|
36
38
|
iconType = "individual",
|
|
37
39
|
initials,
|
|
38
|
-
shape
|
|
40
|
+
shape,
|
|
39
41
|
size = "M",
|
|
40
42
|
src,
|
|
41
43
|
onClick,
|
|
@@ -50,6 +52,10 @@ const Portrait = ({
|
|
|
50
52
|
...rest
|
|
51
53
|
}) => {
|
|
52
54
|
const [externalError, setExternalError] = (0, _react.useState)(false);
|
|
55
|
+
const {
|
|
56
|
+
roundedCornersOptOut
|
|
57
|
+
} = (0, _react.useContext)(_carbonProvider.NewValidationContext);
|
|
58
|
+
const defaultShape = roundedCornersOptOut ? "square" : "circle";
|
|
53
59
|
(0, _react.useEffect)(() => {
|
|
54
60
|
setExternalError(false);
|
|
55
61
|
}, [gravatar, src]);
|
|
@@ -59,14 +65,14 @@ const Portrait = ({
|
|
|
59
65
|
let portrait = /*#__PURE__*/_react.default.createElement(_portrait.StyledIcon, {
|
|
60
66
|
type: iconType,
|
|
61
67
|
size: size,
|
|
62
|
-
shape: shape,
|
|
68
|
+
shape: shape || defaultShape,
|
|
63
69
|
darkBackground: darkBackground
|
|
64
70
|
});
|
|
65
71
|
|
|
66
72
|
if (initials) {
|
|
67
73
|
portrait = /*#__PURE__*/_react.default.createElement(_portraitInitials.default, {
|
|
68
74
|
size: size,
|
|
69
|
-
shape: shape,
|
|
75
|
+
shape: shape || defaultShape,
|
|
70
76
|
initials: initials,
|
|
71
77
|
darkBackground: darkBackground,
|
|
72
78
|
alt: alt
|
|
@@ -78,7 +84,7 @@ const Portrait = ({
|
|
|
78
84
|
src: src,
|
|
79
85
|
alt: alt,
|
|
80
86
|
size: size,
|
|
81
|
-
shape: shape,
|
|
87
|
+
shape: shape || defaultShape,
|
|
82
88
|
"data-element": "user-image",
|
|
83
89
|
onError: () => setExternalError(true)
|
|
84
90
|
});
|
|
@@ -87,7 +93,7 @@ const Portrait = ({
|
|
|
87
93
|
if (gravatar && !externalError) {
|
|
88
94
|
portrait = /*#__PURE__*/_react.default.createElement(_portraitGravatar.default, {
|
|
89
95
|
gravatarEmail: gravatar,
|
|
90
|
-
shape: shape,
|
|
96
|
+
shape: shape || defaultShape,
|
|
91
97
|
size: size,
|
|
92
98
|
alt: alt,
|
|
93
99
|
errorCallback: () => setExternalError(true)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PROGRESS_TRACKER_SIZES: string[];
|
|
@@ -64,7 +64,8 @@ const StyledProgressBar = _styledComponents.default.span`
|
|
|
64
64
|
${({
|
|
65
65
|
size,
|
|
66
66
|
progress,
|
|
67
|
-
error
|
|
67
|
+
error,
|
|
68
|
+
theme
|
|
68
69
|
}) => (0, _styledComponents.css)`
|
|
69
70
|
display: flex;
|
|
70
71
|
position: relative;
|
|
@@ -73,7 +74,7 @@ const StyledProgressBar = _styledComponents.default.span`
|
|
|
73
74
|
progress,
|
|
74
75
|
error
|
|
75
76
|
})};
|
|
76
|
-
border-radius: var(--borderRadius400);
|
|
77
|
+
border-radius: ${theme.roundedCornersOptOut ? "25px" : "var(--borderRadius400)"};
|
|
77
78
|
overflow-x: hidden;
|
|
78
79
|
height: ${getHeight(size)};
|
|
79
80
|
width: 100%;
|
|
@@ -116,7 +117,8 @@ const InnerBar = _styledComponents.default.span`
|
|
|
116
117
|
progress,
|
|
117
118
|
size = "medium",
|
|
118
119
|
length,
|
|
119
|
-
error
|
|
120
|
+
error,
|
|
121
|
+
theme
|
|
120
122
|
}) => (0, _styledComponents.css)`
|
|
121
123
|
position: relative;
|
|
122
124
|
left: 0;
|
|
@@ -124,13 +126,19 @@ const InnerBar = _styledComponents.default.span`
|
|
|
124
126
|
progress,
|
|
125
127
|
error
|
|
126
128
|
})};
|
|
127
|
-
border-radius: var(--borderRadius400);
|
|
129
|
+
border-radius: ${theme.roundedCornersOptOut ? "25px" : "var(--borderRadius400)"};
|
|
128
130
|
width: calc(${length} * ${progress && progress / 100});
|
|
129
131
|
min-width: 2px;
|
|
130
132
|
height: ${getHeight(size)};
|
|
131
133
|
`}
|
|
132
134
|
`;
|
|
133
135
|
exports.InnerBar = InnerBar;
|
|
136
|
+
InnerBar.defaultProps = {
|
|
137
|
+
theme: _base.default
|
|
138
|
+
};
|
|
139
|
+
StyledProgressBar.defaultProps = {
|
|
140
|
+
theme: _base.default
|
|
141
|
+
};
|
|
134
142
|
StyledProgressTracker.defaultProps = {
|
|
135
143
|
theme: _base.default
|
|
136
144
|
};
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
interface StyledSwitchSliderProps extends Pick<SwitchSliderProps, "checked" | "disabled" | "size" | "error" | "warning"> {
|
|
3
|
-
isLoading?: boolean;
|
|
4
|
-
}
|
|
5
|
-
declare const StyledSwitchSlider: import("styled-components").StyledComponent<"span", any, StyledSwitchSliderProps, never>;
|
|
1
|
+
declare const StyledSwitchSlider: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
6
2
|
export default StyledSwitchSlider;
|
|
@@ -11,6 +11,8 @@ var _switchSliderPanel = _interopRequireDefault(require("./switch-slider-panel.s
|
|
|
11
11
|
|
|
12
12
|
var _validationIcon = _interopRequireDefault(require("../../../__internal__/validations/validation-icon.style"));
|
|
13
13
|
|
|
14
|
+
var _base = _interopRequireDefault(require("../../../style/themes/base"));
|
|
15
|
+
|
|
14
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
17
|
|
|
16
18
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
@@ -24,7 +26,8 @@ const StyledSwitchSlider = _styledComponents.default.span`
|
|
|
24
26
|
disabled,
|
|
25
27
|
size,
|
|
26
28
|
error,
|
|
27
|
-
warning
|
|
29
|
+
warning,
|
|
30
|
+
theme
|
|
28
31
|
}) => (0, _styledComponents.css)`
|
|
29
32
|
display: flex;
|
|
30
33
|
font-size: 12px;
|
|
@@ -38,7 +41,7 @@ const StyledSwitchSlider = _styledComponents.default.span`
|
|
|
38
41
|
width: 64px;
|
|
39
42
|
min-width: fit-content;
|
|
40
43
|
z-index: 2;
|
|
41
|
-
border-radius: var(--borderRadius400);
|
|
44
|
+
border-radius: ${theme !== null && theme !== void 0 && theme.roundedCornersOptOut ? "90px" : "var(--borderRadius400)"};
|
|
42
45
|
border-style: solid;
|
|
43
46
|
border-color: var(--colorsActionMinor400);
|
|
44
47
|
border-width: var(--borderWidth200);
|
|
@@ -92,6 +95,7 @@ const StyledSwitchSlider = _styledComponents.default.span`
|
|
|
92
95
|
`}
|
|
93
96
|
|
|
94
97
|
${size === "large" && (0, _styledComponents.css)`
|
|
98
|
+
${theme !== null && theme !== void 0 && theme.roundedCornersOptOut ? "border-radius: 30px;" : ""}
|
|
95
99
|
&::before {
|
|
96
100
|
height: 32px;
|
|
97
101
|
width: 32px;
|
|
@@ -123,5 +127,8 @@ const StyledSwitchSlider = _styledComponents.default.span`
|
|
|
123
127
|
}
|
|
124
128
|
`}
|
|
125
129
|
`;
|
|
130
|
+
StyledSwitchSlider.defaultProps = {
|
|
131
|
+
theme: _base.default
|
|
132
|
+
};
|
|
126
133
|
var _default = StyledSwitchSlider;
|
|
127
134
|
exports.default = _default;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ThemeObject } from "../../themes/base";
|
|
2
|
+
import { CarbonProviderProps } from "../../../components/carbon-provider";
|
|
2
3
|
/**
|
|
3
4
|
*
|
|
4
5
|
* Converts theme properties to css variables form and set them locally for
|
|
5
6
|
* given scope
|
|
6
7
|
*
|
|
7
8
|
*/
|
|
8
|
-
declare const CarbonScopedTokensProvider: import("styled-components").StyledComponent<"div", any, ThemeObject, never>;
|
|
9
|
+
declare const CarbonScopedTokensProvider: import("styled-components").StyledComponent<"div", any, ThemeObject & Pick<CarbonProviderProps, "roundedCornersOptOut">, never>;
|
|
9
10
|
export default CarbonScopedTokensProvider;
|
|
@@ -27,7 +27,7 @@ const CarbonScopedTokensProvider = _styledComponents.default.div`
|
|
|
27
27
|
|
|
28
28
|
${({
|
|
29
29
|
theme
|
|
30
|
-
}) => (0, _generateCssVariables.default)(theme.compatibility)}
|
|
30
|
+
}) => (0, _generateCssVariables.default)(theme.compatibility, theme.roundedCornersOptOut)}
|
|
31
31
|
`;
|
|
32
32
|
CarbonScopedTokensProvider.defaultProps = {
|
|
33
33
|
theme: _themes.baseTheme
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ThemeObject } from "../themes/base";
|
|
2
|
-
declare const _default: (theme: ThemeObject | Record<string, string
|
|
2
|
+
declare const _default: (theme: ThemeObject | Record<string, string>, roundedCornersOptOupt?: boolean | undefined) => string;
|
|
3
3
|
/**
|
|
4
4
|
*
|
|
5
5
|
* Converts theme properties to the string in form of css variable definitions.
|
|
@@ -13,6 +13,12 @@ exports.default = void 0;
|
|
|
13
13
|
* form of CSS variables along with styled-components ThemeProvider.
|
|
14
14
|
*
|
|
15
15
|
*/
|
|
16
|
-
var _default = theme => Object.entries(theme).map(([key, value]) =>
|
|
16
|
+
var _default = (theme, roundedCornersOptOupt) => Object.entries(theme).map(([key, value]) => {
|
|
17
|
+
if (roundedCornersOptOupt && key.startsWith("borderRadius") && key !== "borderRadiusCircle") {
|
|
18
|
+
return `--${key}: 0px;`;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return `--${key}: ${value};`;
|
|
22
|
+
}).join("\r\n");
|
|
17
23
|
|
|
18
24
|
exports.default = _default;
|