carbon-react 118.3.3 → 118.4.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/esm/components/action-popover/action-popover-item/action-popover-item.component.js +30 -24
- package/esm/components/action-popover/action-popover.style.d.ts +2 -1
- package/esm/components/action-popover/action-popover.style.js +9 -2
- 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/action-popover/action-popover-item/action-popover-item.component.js +29 -23
- package/lib/components/action-popover/action-popover.style.d.ts +2 -1
- package/lib/components/action-popover/action-popover.style.js +10 -2
- 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
|
@@ -3,7 +3,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
3
3
|
import React, { useCallback, useEffect, useRef, useState, useContext } from "react";
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
5
|
import invariant from "invariant";
|
|
6
|
-
import { MenuItemIcon, SubMenuItemIcon, StyledMenuItem } from "../action-popover.style";
|
|
6
|
+
import { MenuItemIcon, SubMenuItemIcon, StyledMenuItem, StyledMenuItemWrapper } from "../action-popover.style";
|
|
7
7
|
import Events from "../../../__internal__/utils/helpers/events";
|
|
8
8
|
import createGuid from "../../../__internal__/utils/helpers/guid";
|
|
9
9
|
import ActionPopoverContext from "../action-popover-context";
|
|
@@ -172,7 +172,8 @@ const ActionPopoverItem = ({
|
|
|
172
172
|
(_ref$current5 = ref.current) === null || _ref$current5 === void 0 ? void 0 : _ref$current5.click();
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
-
e.preventDefault();
|
|
175
|
+
e.preventDefault(); // this type assertion should be safe as the onclick handler is designed to catch events propagating from the inner buttons
|
|
176
|
+
|
|
176
177
|
onClick(e);
|
|
177
178
|
}
|
|
178
179
|
} else if (Events.isEnterKey(e)) {
|
|
@@ -180,6 +181,21 @@ const ActionPopoverItem = ({
|
|
|
180
181
|
}
|
|
181
182
|
}, [disabled, download, isHref, isLeftAligned, onClick, submenu]);
|
|
182
183
|
const itemSubmenuProps = { ...(!disabled && {
|
|
184
|
+
onClick: e => {
|
|
185
|
+
var _ref$current6;
|
|
186
|
+
|
|
187
|
+
setOpen(true);
|
|
188
|
+
(_ref$current6 = ref.current) === null || _ref$current6 === void 0 ? void 0 : _ref$current6.focus();
|
|
189
|
+
e.preventDefault();
|
|
190
|
+
e.stopPropagation();
|
|
191
|
+
}
|
|
192
|
+
}),
|
|
193
|
+
"aria-haspopup": "true",
|
|
194
|
+
"aria-label": l.actionPopover.ariaLabel(),
|
|
195
|
+
"aria-controls": `ActionPopoverMenu_${guid}`,
|
|
196
|
+
"aria-expanded": isOpen
|
|
197
|
+
};
|
|
198
|
+
const wrapperDivProps = { ...(!disabled && {
|
|
183
199
|
onMouseEnter: e => {
|
|
184
200
|
if (mouseEnterTimer.current) clearTimeout(mouseEnterTimer.current);
|
|
185
201
|
setFocusIndex(-1);
|
|
@@ -194,20 +210,8 @@ const ActionPopoverItem = ({
|
|
|
194
210
|
setOpen(false);
|
|
195
211
|
}, INTERVAL);
|
|
196
212
|
e.stopPropagation();
|
|
197
|
-
},
|
|
198
|
-
onClick: e => {
|
|
199
|
-
var _ref$current6;
|
|
200
|
-
|
|
201
|
-
setOpen(true);
|
|
202
|
-
(_ref$current6 = ref.current) === null || _ref$current6 === void 0 ? void 0 : _ref$current6.focus();
|
|
203
|
-
e.preventDefault();
|
|
204
|
-
e.stopPropagation();
|
|
205
213
|
}
|
|
206
|
-
})
|
|
207
|
-
"aria-haspopup": "true",
|
|
208
|
-
"aria-label": l.actionPopover.ariaLabel(),
|
|
209
|
-
"aria-controls": `ActionPopoverMenu_${guid}`,
|
|
210
|
-
"aria-expanded": isOpen
|
|
214
|
+
})
|
|
211
215
|
};
|
|
212
216
|
|
|
213
217
|
const renderMenuItemIcon = () => {
|
|
@@ -217,13 +221,15 @@ const ActionPopoverItem = ({
|
|
|
217
221
|
});
|
|
218
222
|
};
|
|
219
223
|
|
|
220
|
-
return /*#__PURE__*/React.createElement(
|
|
224
|
+
return /*#__PURE__*/React.createElement(StyledMenuItemWrapper, submenu && wrapperDivProps, /*#__PURE__*/React.createElement("div", {
|
|
225
|
+
onKeyDown: onKeyDown,
|
|
226
|
+
role: "presentation"
|
|
227
|
+
}, /*#__PURE__*/React.createElement(StyledMenuItem, _extends({}, rest, {
|
|
221
228
|
ref: ref,
|
|
222
229
|
onClick: onClick,
|
|
223
|
-
onKeyDown: onKeyDown,
|
|
224
230
|
type: "button",
|
|
225
|
-
tabIndex: 0,
|
|
226
231
|
role: "menuitem",
|
|
232
|
+
tabIndex: 0,
|
|
227
233
|
isDisabled: disabled,
|
|
228
234
|
horizontalAlignment: horizontalAlignment
|
|
229
235
|
}, disabled && {
|
|
@@ -232,7 +238,11 @@ const ActionPopoverItem = ({
|
|
|
232
238
|
as: "a",
|
|
233
239
|
download,
|
|
234
240
|
href
|
|
235
|
-
}, submenu && itemSubmenuProps),
|
|
241
|
+
}, submenu && itemSubmenuProps), submenu && checkRef(ref) && isLeftAligned ? /*#__PURE__*/React.createElement(SubMenuItemIcon, {
|
|
242
|
+
type: "chevron_left"
|
|
243
|
+
}) : null, horizontalAlignment === "left" ? renderMenuItemIcon() : null, children, horizontalAlignment === "right" ? renderMenuItemIcon() : null, submenu && checkRef(ref) && !isLeftAligned ? /*#__PURE__*/React.createElement(SubMenuItemIcon, {
|
|
244
|
+
type: "chevron_right"
|
|
245
|
+
}) : null), /*#__PURE__*/React.isValidElement(submenu) ? /*#__PURE__*/React.cloneElement(submenu, {
|
|
236
246
|
parentID: `ActionPopoverItem_${guid}`,
|
|
237
247
|
menuID: `ActionPopoverMenu_${guid}`,
|
|
238
248
|
"data-element": "action-popover-submenu",
|
|
@@ -242,11 +252,7 @@ const ActionPopoverItem = ({
|
|
|
242
252
|
setOpen,
|
|
243
253
|
setFocusIndex,
|
|
244
254
|
focusIndex
|
|
245
|
-
}) : null
|
|
246
|
-
type: "chevron_left"
|
|
247
|
-
}) : null, horizontalAlignment === "left" ? renderMenuItemIcon() : null, children, horizontalAlignment === "right" ? renderMenuItemIcon() : null, submenu && checkRef(ref) && !isLeftAligned ? /*#__PURE__*/React.createElement(SubMenuItemIcon, {
|
|
248
|
-
type: "chevron_right"
|
|
249
|
-
}) : null);
|
|
255
|
+
}) : null));
|
|
250
256
|
};
|
|
251
257
|
|
|
252
258
|
ActionPopoverItem.propTypes = {
|
|
@@ -7,6 +7,7 @@ declare type StyledMenuItemProps = {
|
|
|
7
7
|
horizontalAlignment: "left" | "right";
|
|
8
8
|
};
|
|
9
9
|
declare const StyledMenuItem: import("styled-components").StyledComponent<"button", any, StyledMenuItemProps, never>;
|
|
10
|
+
declare const StyledMenuItemWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
10
11
|
declare const MenuItemDivider: import("styled-components").StyledComponent<"div", any, {
|
|
11
12
|
"data-element": string;
|
|
12
13
|
}, "data-element">;
|
|
@@ -16,4 +17,4 @@ declare const StyledButtonIcon: import("styled-components").StyledComponent<"div
|
|
|
16
17
|
declare const MenuItemIcon: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../icon").IconProps & import("react").RefAttributes<HTMLSpanElement>>, any, {}, never>;
|
|
17
18
|
declare const SubMenuItemIcon: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../icon").IconProps & import("react").RefAttributes<HTMLSpanElement>>, any, {}, never>;
|
|
18
19
|
declare const MenuButtonOverrideWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
19
|
-
export { Menu, MenuButton, ButtonIcon, StyledButtonIcon, MenuItemIcon, MenuItemDivider, SubMenuItemIcon, MenuButtonOverrideWrapper, StyledMenuItem, };
|
|
20
|
+
export { Menu, MenuButton, ButtonIcon, StyledButtonIcon, MenuItemIcon, MenuItemDivider, SubMenuItemIcon, MenuButtonOverrideWrapper, StyledMenuItem, StyledMenuItemWrapper, };
|
|
@@ -16,7 +16,11 @@ const Menu = styled.div`
|
|
|
16
16
|
background-color: var(--colorsUtilityYang100);
|
|
17
17
|
z-index: ${({
|
|
18
18
|
theme
|
|
19
|
-
}) =>
|
|
19
|
+
}) => {
|
|
20
|
+
var _theme$zIndex;
|
|
21
|
+
|
|
22
|
+
return `${(_theme$zIndex = theme.zIndex) === null || _theme$zIndex === void 0 ? void 0 : _theme$zIndex.popover}`;
|
|
23
|
+
}}; // TODO (tokens): implement elevation tokens - FE-4437
|
|
20
24
|
`;
|
|
21
25
|
const StyledMenuItem = styled.button`
|
|
22
26
|
text-decoration: none;
|
|
@@ -69,6 +73,9 @@ const StyledMenuItem = styled.button`
|
|
|
69
73
|
}
|
|
70
74
|
`}
|
|
71
75
|
`;
|
|
76
|
+
const StyledMenuItemWrapper = styled.div`
|
|
77
|
+
position: relative;
|
|
78
|
+
`;
|
|
72
79
|
const MenuItemDivider = styled.div.attrs({
|
|
73
80
|
"data-element": "action-popover-divider"
|
|
74
81
|
})`
|
|
@@ -135,4 +142,4 @@ const MenuButtonOverrideWrapper = styled.div`
|
|
|
135
142
|
}
|
|
136
143
|
}
|
|
137
144
|
`;
|
|
138
|
-
export { Menu, MenuButton, ButtonIcon, StyledButtonIcon, MenuItemIcon, MenuItemDivider, SubMenuItemIcon, MenuButtonOverrideWrapper, StyledMenuItem };
|
|
145
|
+
export { Menu, MenuButton, ButtonIcon, StyledButtonIcon, MenuItemIcon, MenuItemDivider, SubMenuItemIcon, MenuButtonOverrideWrapper, StyledMenuItem, StyledMenuItemWrapper };
|
|
@@ -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"));
|