carbon-react 144.4.0 → 144.5.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/__internal__/checkable-input/checkable-input.style.js +5 -2
- package/esm/__internal__/label/label.component.d.ts +4 -2
- package/esm/__internal__/label/label.component.js +3 -1
- package/esm/__internal__/label/label.style.d.ts +2 -0
- package/esm/__internal__/label/label.style.js +5 -1
- package/esm/__internal__/utils/helpers/events/composedPath.js +1 -6
- package/esm/__internal__/utils/helpers/events/events.js +1 -1
- package/esm/__internal__/validation-message/validation-message.component.d.ts +3 -1
- package/esm/__internal__/validation-message/validation-message.component.js +4 -2
- package/esm/__internal__/validation-message/validation-message.style.d.ts +1 -0
- package/esm/__internal__/validation-message/validation-message.style.js +11 -7
- package/esm/components/action-popover/action-popover.style.js +8 -8
- package/esm/components/breadcrumbs/crumb/crumb.style.js +2 -2
- package/esm/components/button-toggle/button-toggle.style.js +19 -19
- package/esm/components/card/card.config.d.ts +2 -2
- package/esm/components/date/__internal__/date-picker/day-picker.style.js +6 -2
- package/esm/components/dialog/dialog.component.d.ts +1 -1
- package/esm/components/dialog/dialog.config.d.ts +1 -1
- package/esm/components/dialog/dialog.style.js +2 -2
- package/esm/components/drawer/drawer.style.js +16 -16
- package/esm/components/flat-table/flat-table.component.d.ts +3 -1
- package/esm/components/flat-table/flat-table.component.js +3 -1
- package/esm/components/flat-table/flat-table.style.js +9 -9
- package/esm/components/form/form.config.d.ts +1 -1
- package/esm/components/hr/hr.component.d.ts +1 -0
- package/esm/components/loader-spinner/loader-spinner.config.d.ts +2 -2
- package/esm/components/loader-spinner/loader-spinner.style.js +5 -5
- package/esm/components/loader-star/internal/star.component.d.ts +1 -0
- package/esm/components/loader-star/loader-star.component.d.ts +1 -0
- package/esm/components/menu/menu-segment-title/menu-segment-title.component.d.ts +1 -1
- package/esm/components/numeral-date/numeral-date.component.d.ts +1 -1
- package/esm/components/pager/pager.style.js +2 -2
- package/esm/components/pod/pod.config.d.ts +3 -3
- package/esm/components/pod/pod.style.js +34 -34
- package/esm/components/progress-tracker/progress-tracker.style.js +2 -2
- package/esm/components/select/__internal__/list-action-button/list-action-button.style.js +3 -1
- package/esm/components/switch/__internal__/switch-slider-panel.style.d.ts +1 -0
- package/esm/components/switch/__internal__/switch-slider-panel.style.js +6 -4
- package/esm/components/switch/__internal__/switch-slider.component.d.ts +2 -1
- package/esm/components/switch/__internal__/switch-slider.component.js +6 -3
- package/esm/components/switch/__internal__/switch-slider.style.d.ts +2 -1
- package/esm/components/switch/__internal__/switch-slider.style.js +7 -6
- package/esm/components/switch/switch.component.d.ts +2 -0
- package/esm/components/switch/switch.component.js +64 -18
- package/esm/components/switch/switch.style.d.ts +6 -1
- package/esm/components/switch/switch.style.js +24 -11
- package/esm/components/text-editor/__internal__/toolbar/toolbar-button/toolbar-button.component.js +2 -1
- package/esm/components/textbox/textbox.style.js +8 -8
- package/esm/components/tile/flex-tile-divider/flex-tile-divider.component.d.ts +1 -0
- package/esm/components/tile/tile.component.d.ts +1 -1
- package/esm/components/time/time.style.d.ts +1 -1
- package/esm/components/typography/typography.component.d.ts +1 -1
- package/esm/components/typography/typography.style.js +1 -1
- package/esm/components/vertical-divider/vertical-divider.component.d.ts +1 -0
- package/esm/global.d.ts +1 -1
- package/esm/hooks/__internal__/useCharacterCount/useCharacterCount.d.ts +1 -0
- package/esm/style/utils/box-gap.d.ts +1 -1
- package/lib/__internal__/checkable-input/checkable-input.style.js +5 -2
- package/lib/__internal__/label/label.component.d.ts +4 -2
- package/lib/__internal__/label/label.component.js +3 -1
- package/lib/__internal__/label/label.style.d.ts +2 -0
- package/lib/__internal__/label/label.style.js +5 -1
- package/lib/__internal__/utils/helpers/events/composedPath.js +1 -6
- package/lib/__internal__/utils/helpers/events/events.js +1 -1
- package/lib/__internal__/validation-message/validation-message.component.d.ts +3 -1
- package/lib/__internal__/validation-message/validation-message.component.js +4 -2
- package/lib/__internal__/validation-message/validation-message.style.d.ts +1 -0
- package/lib/__internal__/validation-message/validation-message.style.js +11 -7
- package/lib/components/action-popover/action-popover.style.js +8 -8
- package/lib/components/breadcrumbs/crumb/crumb.style.js +2 -2
- package/lib/components/button-toggle/button-toggle.style.js +19 -19
- package/lib/components/card/card.config.d.ts +2 -2
- package/lib/components/date/__internal__/date-picker/day-picker.style.js +6 -2
- package/lib/components/dialog/dialog.component.d.ts +1 -1
- package/lib/components/dialog/dialog.config.d.ts +1 -1
- package/lib/components/dialog/dialog.style.js +2 -2
- package/lib/components/drawer/drawer.style.js +16 -16
- package/lib/components/flat-table/flat-table.component.d.ts +3 -1
- package/lib/components/flat-table/flat-table.component.js +3 -1
- package/lib/components/flat-table/flat-table.style.js +9 -9
- package/lib/components/form/form.config.d.ts +1 -1
- package/lib/components/hr/hr.component.d.ts +1 -0
- package/lib/components/loader-spinner/loader-spinner.config.d.ts +2 -2
- package/lib/components/loader-spinner/loader-spinner.style.js +5 -5
- package/lib/components/loader-star/internal/star.component.d.ts +1 -0
- package/lib/components/loader-star/loader-star.component.d.ts +1 -0
- package/lib/components/menu/menu-segment-title/menu-segment-title.component.d.ts +1 -1
- package/lib/components/numeral-date/numeral-date.component.d.ts +1 -1
- package/lib/components/pager/pager.style.js +2 -2
- package/lib/components/pod/pod.config.d.ts +3 -3
- package/lib/components/pod/pod.style.js +34 -34
- package/lib/components/progress-tracker/progress-tracker.style.js +2 -2
- package/lib/components/select/__internal__/list-action-button/list-action-button.style.js +3 -1
- package/lib/components/switch/__internal__/switch-slider-panel.style.d.ts +1 -0
- package/lib/components/switch/__internal__/switch-slider-panel.style.js +6 -4
- package/lib/components/switch/__internal__/switch-slider.component.d.ts +2 -1
- package/lib/components/switch/__internal__/switch-slider.component.js +6 -3
- package/lib/components/switch/__internal__/switch-slider.style.d.ts +2 -1
- package/lib/components/switch/__internal__/switch-slider.style.js +7 -6
- package/lib/components/switch/switch.component.d.ts +2 -0
- package/lib/components/switch/switch.component.js +64 -18
- package/lib/components/switch/switch.style.d.ts +6 -1
- package/lib/components/switch/switch.style.js +24 -11
- package/lib/components/text-editor/__internal__/toolbar/toolbar-button/toolbar-button.component.js +2 -1
- package/lib/components/textbox/textbox.style.js +8 -8
- package/lib/components/tile/flex-tile-divider/flex-tile-divider.component.d.ts +1 -0
- package/lib/components/tile/tile.component.d.ts +1 -1
- package/lib/components/time/time.style.d.ts +1 -1
- package/lib/components/typography/typography.component.d.ts +1 -1
- package/lib/components/typography/typography.style.js +1 -1
- package/lib/components/vertical-divider/vertical-divider.component.d.ts +1 -0
- package/lib/global.d.ts +1 -1
- package/lib/hooks/__internal__/useCharacterCount/useCharacterCount.d.ts +1 -0
- package/lib/style/utils/box-gap.d.ts +1 -1
- package/package.json +3 -10
|
@@ -4,7 +4,9 @@ const StyledListActionButtonWrapper = styled.div`
|
|
|
4
4
|
padding-top: var(--spacing100);
|
|
5
5
|
padding-bottom: var(--spacing100);
|
|
6
6
|
border-top: 1px solid var(--colorsUtilityDisabled600);
|
|
7
|
-
box-shadow:
|
|
7
|
+
box-shadow:
|
|
8
|
+
0 0px 0 0 rgba(0, 0, 0, 0),
|
|
9
|
+
0 -8px 8px 0 rgba(0, 0, 0, 0.03);
|
|
8
10
|
width: 100%;
|
|
9
11
|
position: sticky;
|
|
10
12
|
bottom: 0;
|
|
@@ -2,6 +2,7 @@ import { SwitchProps } from "../switch.component";
|
|
|
2
2
|
export interface SwitchSliderPanelProps {
|
|
3
3
|
isLoading?: boolean;
|
|
4
4
|
size?: SwitchProps["size"];
|
|
5
|
+
isDarkBackground?: boolean;
|
|
5
6
|
}
|
|
6
7
|
declare const SwitchSliderPanel: import("styled-components").StyledComponent<"div", any, SwitchSliderPanelProps, never>;
|
|
7
8
|
export default SwitchSliderPanel;
|
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
import styled, { css } from "styled-components";
|
|
2
|
-
import StyledLoader from "../../loader/loader.style";
|
|
3
2
|
import StyledLoaderSquare from "../../loader/loader-square.style";
|
|
3
|
+
import StyledLoader from "../../loader/loader.style";
|
|
4
4
|
const SwitchSliderPanel = styled.div`
|
|
5
5
|
${({
|
|
6
6
|
isLoading,
|
|
7
|
-
size
|
|
7
|
+
size,
|
|
8
|
+
isDarkBackground
|
|
8
9
|
}) => css`
|
|
9
10
|
border: 0;
|
|
10
|
-
color: var(--colorsActionMinorYang100);
|
|
11
|
+
color: ${isDarkBackground ? "var(--colorsUtilityYin100)" : "var(--colorsActionMinorYang100)"};
|
|
11
12
|
margin: auto;
|
|
12
13
|
position: absolute;
|
|
13
14
|
left: 0;
|
|
14
15
|
|
|
15
16
|
&[type="on"] {
|
|
17
|
+
color: ${isDarkBackground ? "var(--colorsUtilityYin100)" : "var(--colorsUtilityYang100)"};
|
|
16
18
|
margin-left: 9px;
|
|
17
19
|
padding-right: ${size === "large" ? "43px" : "27px"};
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
&[type="off"] {
|
|
21
|
-
color: var(--colorsActionMinor500);
|
|
23
|
+
color: ${isDarkBackground ? "var(--colorsUtilityYang100)" : "var(--colorsActionMinor500)"};
|
|
22
24
|
margin-right: 9px;
|
|
23
25
|
padding-left: ${size === "large" ? "43px" : "27px"};
|
|
24
26
|
}
|
|
@@ -6,6 +6,7 @@ export interface SwitchSliderProps extends ValidationProps {
|
|
|
6
6
|
loading?: boolean;
|
|
7
7
|
size?: "small" | "large";
|
|
8
8
|
useValidationIcon?: boolean;
|
|
9
|
+
isDarkBackground?: boolean;
|
|
9
10
|
}
|
|
10
|
-
declare const SwitchSlider: ({ checked, disabled, loading, size, error, warning, info, useValidationIcon, }: SwitchSliderProps) => React.JSX.Element;
|
|
11
|
+
declare const SwitchSlider: ({ checked, disabled, loading, size, error, warning, info, useValidationIcon, isDarkBackground, }: SwitchSliderProps) => React.JSX.Element;
|
|
11
12
|
export default SwitchSlider;
|
|
@@ -14,7 +14,8 @@ const SwitchSlider = ({
|
|
|
14
14
|
error,
|
|
15
15
|
warning,
|
|
16
16
|
info,
|
|
17
|
-
useValidationIcon
|
|
17
|
+
useValidationIcon,
|
|
18
|
+
isDarkBackground
|
|
18
19
|
}) => {
|
|
19
20
|
const locale = useLocale();
|
|
20
21
|
const onText = locale.switch.on();
|
|
@@ -31,13 +32,15 @@ const SwitchSlider = ({
|
|
|
31
32
|
size,
|
|
32
33
|
error,
|
|
33
34
|
warning,
|
|
34
|
-
info
|
|
35
|
+
info,
|
|
36
|
+
isDarkBackground
|
|
35
37
|
};
|
|
36
38
|
const sliderPanelStyleProps = {
|
|
37
39
|
isLoading: loading,
|
|
38
40
|
size,
|
|
39
41
|
type: checked ? "on" : "off",
|
|
40
|
-
disabled
|
|
42
|
+
disabled,
|
|
43
|
+
isDarkBackground
|
|
41
44
|
};
|
|
42
45
|
const loaderProps = {
|
|
43
46
|
isInsideButton: true,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { SwitchSliderProps } from "./switch-slider.component";
|
|
2
1
|
import { ThemeObject } from "../../../style/themes/base";
|
|
2
|
+
import { SwitchSliderProps } from "./switch-slider.component";
|
|
3
3
|
interface StyledSwitchSliderProps extends Pick<SwitchSliderProps, "checked" | "disabled" | "size" | "error" | "warning"> {
|
|
4
4
|
isLoading?: boolean;
|
|
5
5
|
theme?: Partial<ThemeObject>;
|
|
6
|
+
isDarkBackground?: boolean;
|
|
6
7
|
}
|
|
7
8
|
declare const StyledSwitchSlider: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
8
9
|
declare const HiddenContent: import("styled-components").StyledComponent<"div", any, Pick<StyledSwitchSliderProps, "size">, never>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import styled, { css } from "styled-components";
|
|
2
|
-
import SwitchSliderPanel from "./switch-slider-panel.style";
|
|
3
2
|
import StyledValidationIcon from "../../../__internal__/validations/validation-icon.style";
|
|
4
3
|
import baseTheme from "../../../style/themes/base";
|
|
4
|
+
import SwitchSliderPanel from "./switch-slider-panel.style";
|
|
5
5
|
const StyledSwitchSlider = styled.div`
|
|
6
6
|
${({
|
|
7
7
|
checked,
|
|
@@ -10,7 +10,8 @@ const StyledSwitchSlider = styled.div`
|
|
|
10
10
|
size,
|
|
11
11
|
error,
|
|
12
12
|
warning,
|
|
13
|
-
theme
|
|
13
|
+
theme,
|
|
14
|
+
isDarkBackground
|
|
14
15
|
}) => css`
|
|
15
16
|
display: flex;
|
|
16
17
|
font-size: 12px;
|
|
@@ -25,14 +26,14 @@ const StyledSwitchSlider = styled.div`
|
|
|
25
26
|
z-index: 2;
|
|
26
27
|
border-radius: ${theme?.roundedCornersOptOut ? "90px" : "var(--borderRadius400)"};
|
|
27
28
|
border-style: solid;
|
|
28
|
-
border-color: var(--colorsActionMinor400);
|
|
29
|
+
border-color: ${isDarkBackground ? "var(--colorsUtilityYang100)" : "var(--colorsActionMinor400)"};
|
|
29
30
|
border-width: var(--borderWidth200);
|
|
30
31
|
box-sizing: border-box;
|
|
31
32
|
margin-top: ${size === "large" ? "-47px" : "-28px"};
|
|
32
33
|
align-items: center;
|
|
33
34
|
|
|
34
35
|
&::before {
|
|
35
|
-
background-color: var(--colorsActionMinor400);
|
|
36
|
+
background-color: ${isDarkBackground ? "var(--colorsUtilityYang100)" : "var(--colorsActionMinor400)"};
|
|
36
37
|
bottom: 4px;
|
|
37
38
|
content: "";
|
|
38
39
|
height: ${size === "large" ? "var(--spacing400)" : "var(--spacing200)"};
|
|
@@ -45,7 +46,7 @@ const StyledSwitchSlider = styled.div`
|
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
${checked && css`
|
|
48
|
-
background-color: var(--colorsActionMinor500);
|
|
49
|
+
background-color: ${isDarkBackground ? "var(--colorsUtilityYang100)" : "var(--colorsActionMinor500)"};
|
|
49
50
|
border-color: var(--colorsActionMinorTransparent);
|
|
50
51
|
|
|
51
52
|
&::before {
|
|
@@ -53,7 +54,7 @@ const StyledSwitchSlider = styled.div`
|
|
|
53
54
|
100% -
|
|
54
55
|
${size === "large" ? "var(--spacing500)" : "var(--spacing300)"}
|
|
55
56
|
);
|
|
56
|
-
background-color: var(--colorsActionMinorYang100);
|
|
57
|
+
background-color: ${isDarkBackground ? "var(--colorsUtilityYin100)" : "var(--colorsActionMinorYang100)"};
|
|
57
58
|
}
|
|
58
59
|
`}
|
|
59
60
|
|
|
@@ -24,6 +24,8 @@ export interface SwitchProps extends CommonCheckableInputProps, MarginProps {
|
|
|
24
24
|
tooltipPosition?: "top" | "bottom" | "left" | "right";
|
|
25
25
|
/** [Legacy] Aria label for rendered help component */
|
|
26
26
|
helpAriaLabel?: string;
|
|
27
|
+
/** Whether this component resides on a dark background */
|
|
28
|
+
isDarkBackground?: boolean;
|
|
27
29
|
}
|
|
28
30
|
export declare const Switch: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLInputElement>>;
|
|
29
31
|
export default Switch;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
2
|
import React, { useState, useCallback, useContext, useRef } from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
|
-
import
|
|
4
|
+
import Box from "../box";
|
|
5
5
|
import CheckableInput from "../../__internal__/checkable-input";
|
|
6
|
-
import
|
|
7
|
-
import useIsAboveBreakpoint from "../../hooks/__internal__/useIsAboveBreakpoint";
|
|
6
|
+
import Label from "../../__internal__/label";
|
|
8
7
|
import { TooltipProvider } from "../../__internal__/tooltip-provider";
|
|
9
|
-
import Logger from "../../__internal__/utils/logger";
|
|
10
|
-
import useFormSpacing from "../../hooks/__internal__/useFormSpacing";
|
|
11
8
|
import NewValidationContext from "../carbon-provider/__internal__/new-validation.context";
|
|
9
|
+
import Logger from "../../__internal__/utils/logger";
|
|
12
10
|
import ValidationMessage from "../../__internal__/validation-message/validation-message.component";
|
|
13
|
-
import
|
|
14
|
-
import
|
|
11
|
+
import useFormSpacing from "../../hooks/__internal__/useFormSpacing";
|
|
12
|
+
import useIsAboveBreakpoint from "../../hooks/__internal__/useIsAboveBreakpoint";
|
|
13
|
+
import StyledSwitch, { ErrorBorder, StyledHintText } from "./switch.style";
|
|
14
|
+
import SwitchSlider from "./__internal__/switch-slider.component";
|
|
15
15
|
import guid from "../../__internal__/utils/helpers/guid";
|
|
16
16
|
let deprecateUncontrolledWarnTriggered = false;
|
|
17
17
|
const Switch = /*#__PURE__*/React.forwardRef(({
|
|
@@ -45,6 +45,7 @@ const Switch = /*#__PURE__*/React.forwardRef(({
|
|
|
45
45
|
"data-element": dataElement,
|
|
46
46
|
"data-role": dataRole,
|
|
47
47
|
helpAriaLabel,
|
|
48
|
+
isDarkBackground = false,
|
|
48
49
|
...rest
|
|
49
50
|
}, ref) => {
|
|
50
51
|
const isControlled = checked !== undefined;
|
|
@@ -77,6 +78,7 @@ const Switch = /*#__PURE__*/React.forwardRef(({
|
|
|
77
78
|
"data-role": dataRole,
|
|
78
79
|
"data-element": dataElement,
|
|
79
80
|
checked: isControlled ? checked : checkedInternal,
|
|
81
|
+
isDarkBackground,
|
|
80
82
|
fieldHelpInline,
|
|
81
83
|
labelInline: shouldLabelBeInline,
|
|
82
84
|
labelSpacing,
|
|
@@ -89,6 +91,7 @@ const Switch = /*#__PURE__*/React.forwardRef(({
|
|
|
89
91
|
checked: isControlled ? checked : checkedInternal,
|
|
90
92
|
disabled: disabled || loading,
|
|
91
93
|
loading,
|
|
94
|
+
isDarkBackground,
|
|
92
95
|
size,
|
|
93
96
|
error,
|
|
94
97
|
warning,
|
|
@@ -109,6 +112,7 @@ const Switch = /*#__PURE__*/React.forwardRef(({
|
|
|
109
112
|
labelInline: shouldLabelBeInline,
|
|
110
113
|
labelSpacing,
|
|
111
114
|
onBlur,
|
|
115
|
+
isDarkBackground,
|
|
112
116
|
onFocus,
|
|
113
117
|
onChange: isControlled ? onChange : onChangeInternal,
|
|
114
118
|
id,
|
|
@@ -132,6 +136,8 @@ const Switch = /*#__PURE__*/React.forwardRef(({
|
|
|
132
136
|
"data-role": dataRole,
|
|
133
137
|
"data-element": dataElement,
|
|
134
138
|
checked: isControlled ? checked : checkedInternal,
|
|
139
|
+
labelInline: shouldLabelBeInline,
|
|
140
|
+
isDarkBackground,
|
|
135
141
|
size,
|
|
136
142
|
...marginProps
|
|
137
143
|
};
|
|
@@ -139,6 +145,7 @@ const Switch = /*#__PURE__*/React.forwardRef(({
|
|
|
139
145
|
checked: isControlled ? checked : checkedInternal,
|
|
140
146
|
disabled: disabled || loading,
|
|
141
147
|
loading,
|
|
148
|
+
isDarkBackground,
|
|
142
149
|
size,
|
|
143
150
|
error,
|
|
144
151
|
warning
|
|
@@ -147,10 +154,12 @@ const Switch = /*#__PURE__*/React.forwardRef(({
|
|
|
147
154
|
autoFocus,
|
|
148
155
|
// set aria-invalid but prevent validationIconId from being added to aria-describedby
|
|
149
156
|
error: !!error,
|
|
157
|
+
warning,
|
|
150
158
|
disabled: disabled || loading,
|
|
151
159
|
loading,
|
|
152
160
|
checked: isControlled ? checked : checkedInternal,
|
|
153
161
|
onBlur,
|
|
162
|
+
isDarkBackground,
|
|
154
163
|
onFocus,
|
|
155
164
|
onChange: isControlled ? onChange : onChangeInternal,
|
|
156
165
|
id,
|
|
@@ -165,30 +174,66 @@ const Switch = /*#__PURE__*/React.forwardRef(({
|
|
|
165
174
|
};
|
|
166
175
|
const applyValidation = error || warning;
|
|
167
176
|
const ariaDescribedBy = [labelHelp && inputHintId.current, applyValidation && validationMessageId.current].filter(Boolean).join(" ");
|
|
168
|
-
|
|
177
|
+
if (!validationRedesignOptIn) {
|
|
178
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TooltipProvider, {
|
|
179
|
+
helpAriaLabel: helpAriaLabel,
|
|
180
|
+
tooltipPosition: tooltipPosition
|
|
181
|
+
}, /*#__PURE__*/React.createElement(StyledSwitch, switchStyleProps, /*#__PURE__*/React.createElement(CheckableInput, inputProps, /*#__PURE__*/React.createElement(SwitchSlider, switchSliderProps)))));
|
|
182
|
+
}
|
|
183
|
+
const defaultMargin = labelInline ? 1 : 0;
|
|
184
|
+
const defaultInputWrapperMargin = labelInline ? 3 : 0;
|
|
185
|
+
const errorMargin = error || warning ? defaultInputWrapperMargin : defaultMargin;
|
|
186
|
+
const direction = labelInline ? "row" : "column";
|
|
187
|
+
const reverseDirection = labelInline ? "row-reverse" : "column";
|
|
188
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StyledSwitch, switchStylePropsForNewValidation, /*#__PURE__*/React.createElement(Box, {
|
|
189
|
+
"data-role": "field-reverse-wrapper",
|
|
190
|
+
display: "flex",
|
|
191
|
+
flexWrap: "wrap",
|
|
192
|
+
alignItems: error || warning ? "flex-start" : undefined,
|
|
193
|
+
flexDirection: !reverse ? reverseDirection : direction,
|
|
194
|
+
width: labelInline ? "100%" : "auto"
|
|
195
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
196
|
+
"data-role": "label-wrapper"
|
|
197
|
+
// width={labelInline ? rest.labelWidth : 30}
|
|
198
|
+
// minWidth={label && labelInline ? "32px" : 0}
|
|
199
|
+
}, /*#__PURE__*/React.createElement(Label, {
|
|
200
|
+
isDarkBackground: isDarkBackground,
|
|
169
201
|
labelId: labelId.current,
|
|
170
202
|
disabled: disabled,
|
|
171
203
|
isRequired: required,
|
|
172
204
|
optional: isOptional
|
|
173
|
-
}, label), labelHelp && /*#__PURE__*/React.createElement(
|
|
205
|
+
}, label), labelHelp && /*#__PURE__*/React.createElement(Box, {
|
|
206
|
+
"data-role": "hint-text-wrapper",
|
|
207
|
+
mb: labelInline ? 0 : 1,
|
|
208
|
+
mr: reverse ? 0 : 1,
|
|
209
|
+
ml: reverse ? 0 : 1
|
|
210
|
+
}, /*#__PURE__*/React.createElement(StyledHintText, {
|
|
174
211
|
"data-role": "hint-text",
|
|
175
|
-
id: inputHintId.current
|
|
176
|
-
|
|
177
|
-
|
|
212
|
+
id: inputHintId.current,
|
|
213
|
+
isDarkBackground: isDarkBackground
|
|
214
|
+
}, labelHelp))), /*#__PURE__*/React.createElement(Box, {
|
|
215
|
+
ml: reverse ? errorMargin : defaultInputWrapperMargin,
|
|
216
|
+
mr: !reverse ? errorMargin : defaultInputWrapperMargin,
|
|
217
|
+
position: "relative",
|
|
218
|
+
id: "input-wrapper"
|
|
178
219
|
}, /*#__PURE__*/React.createElement(ValidationMessage, {
|
|
179
220
|
error: error,
|
|
180
221
|
warning: warning,
|
|
181
|
-
validationId: validationMessageId.current
|
|
222
|
+
validationId: validationMessageId.current,
|
|
223
|
+
isDarkBackground: isDarkBackground
|
|
182
224
|
}), applyValidation && /*#__PURE__*/React.createElement(ErrorBorder, {
|
|
183
225
|
"data-role": "error-border",
|
|
184
|
-
warning: !!(!error && warning)
|
|
226
|
+
warning: !!(!error && warning),
|
|
227
|
+
reverse: !reverse,
|
|
228
|
+
isDarkBackground: isDarkBackground
|
|
185
229
|
}), /*#__PURE__*/React.createElement(CheckableInput, _extends({
|
|
186
230
|
ariaLabelledBy: `${label && labelId.current}`,
|
|
187
231
|
ariaDescribedBy: ariaDescribedBy
|
|
188
|
-
}, inputPropsForNewValidation
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
232
|
+
}, inputPropsForNewValidation, {
|
|
233
|
+
fieldHelp: labelInline ? undefined : rest.fieldHelp
|
|
234
|
+
}), /*#__PURE__*/React.createElement(SwitchSlider, switchSliderPropsForNewValidation))))), labelInline && rest.fieldHelp && /*#__PURE__*/React.createElement(Box, {
|
|
235
|
+
color: isDarkBackground ? "var(--colorsUtilityYang100)" : "var(--colorsUtilityYin090)"
|
|
236
|
+
}, rest.fieldHelp));
|
|
192
237
|
});
|
|
193
238
|
if (process.env.NODE_ENV !== "production") {
|
|
194
239
|
Switch.propTypes = {
|
|
@@ -341,6 +386,7 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
341
386
|
"inputMode": PropTypes.oneOf(["decimal", "email", "none", "numeric", "search", "tel", "text", "url"]),
|
|
342
387
|
"inputWidth": PropTypes.number,
|
|
343
388
|
"is": PropTypes.string,
|
|
389
|
+
"isDarkBackground": PropTypes.bool,
|
|
344
390
|
"isOptional": PropTypes.bool,
|
|
345
391
|
"itemID": PropTypes.string,
|
|
346
392
|
"itemProp": PropTypes.string,
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
interface StyledHintTextProps {
|
|
2
|
+
isDarkBackground?: boolean;
|
|
3
|
+
}
|
|
1
4
|
export declare const ErrorBorder: import("styled-components").StyledComponent<"span", any, {
|
|
5
|
+
reverse: boolean;
|
|
2
6
|
warning: boolean;
|
|
7
|
+
isDarkBackground: boolean;
|
|
3
8
|
}, never>;
|
|
4
|
-
export declare const StyledHintText: import("styled-components").StyledComponent<"div", any,
|
|
9
|
+
export declare const StyledHintText: import("styled-components").StyledComponent<"div", any, StyledHintTextProps, never>;
|
|
5
10
|
declare const StyledSwitch: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
6
11
|
export default StyledSwitch;
|
|
@@ -1,36 +1,46 @@
|
|
|
1
1
|
import styled, { css } from "styled-components";
|
|
2
2
|
import { margin } from "styled-system";
|
|
3
|
-
import
|
|
4
|
-
import FieldHelpStyle from "../../__internal__/field-help/field-help.style";
|
|
3
|
+
import { StyledCheckableInput } from "../../__internal__/checkable-input/checkable-input.style";
|
|
5
4
|
import HiddenCheckableInputStyle from "../../__internal__/checkable-input/hidden-checkable-input.style";
|
|
5
|
+
import FieldHelpStyle from "../../__internal__/field-help/field-help.style";
|
|
6
|
+
import { FieldLineStyle } from "../../__internal__/form-field/form-field.style";
|
|
6
7
|
import { StyledLabelContainer } from "../../__internal__/label/label.style";
|
|
7
|
-
import { StyledCheckableInput } from "../../__internal__/checkable-input/checkable-input.style";
|
|
8
|
-
import StyledSwitchSlider from "./__internal__/switch-slider.style";
|
|
9
8
|
import StyledValidationIcon from "../../__internal__/validations/validation-icon.style";
|
|
10
|
-
import
|
|
9
|
+
import baseTheme from "../../style/themes/base";
|
|
11
10
|
import addFocusStyling from "../../style/utils/add-focus-styling";
|
|
11
|
+
import StyledSwitchSlider from "./__internal__/switch-slider.style";
|
|
12
12
|
const oldFocusStyling = `
|
|
13
13
|
outline: solid 3px var(--colorsSemanticFocus500);
|
|
14
14
|
`;
|
|
15
15
|
export const ErrorBorder = styled.span`
|
|
16
16
|
${({
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
reverse,
|
|
18
|
+
warning,
|
|
19
|
+
isDarkBackground
|
|
20
|
+
}) => {
|
|
21
|
+
const darkBgColour = isDarkBackground ? "var(--colorsSemanticNegative450)" : "var(--colorsSemanticNegative500)";
|
|
22
|
+
return css`
|
|
19
23
|
position: absolute;
|
|
20
24
|
z-index: 6;
|
|
21
25
|
width: 2px;
|
|
22
|
-
background-color: ${warning ? "var(--colorsSemanticCaution500)" :
|
|
23
|
-
left: -12px;
|
|
26
|
+
background-color: ${warning ? "var(--colorsSemanticCaution500)" : darkBgColour};
|
|
27
|
+
${reverse ? "right" : "left"}: -12px;
|
|
24
28
|
bottom: -4px;
|
|
25
29
|
top: 2px;
|
|
26
|
-
|
|
30
|
+
`;
|
|
31
|
+
}}
|
|
27
32
|
`;
|
|
28
33
|
export const StyledHintText = styled.div`
|
|
29
34
|
margin-top: 8px;
|
|
30
35
|
margin-bottom: 8px;
|
|
31
|
-
color: var(--colorsUtilityYin055);
|
|
32
36
|
font-size: 14px;
|
|
33
37
|
font-weight: 400;
|
|
38
|
+
max-width: 160px;
|
|
39
|
+
${({
|
|
40
|
+
isDarkBackground
|
|
41
|
+
}) => css`
|
|
42
|
+
color: ${isDarkBackground ? "var(--colorsUtilityYang065)" : "var(--colorsUtilityYin055)"};
|
|
43
|
+
`}
|
|
34
44
|
`;
|
|
35
45
|
const StyledSwitch = styled.div`
|
|
36
46
|
${({
|
|
@@ -51,6 +61,9 @@ const StyledSwitch = styled.div`
|
|
|
51
61
|
`}
|
|
52
62
|
}
|
|
53
63
|
|
|
64
|
+
display: flex;
|
|
65
|
+
flex-flow: ${labelInline ? "row wrap" : "column wrap"};
|
|
66
|
+
|
|
54
67
|
${StyledCheckableInput}, ${HiddenCheckableInputStyle} {
|
|
55
68
|
border: none;
|
|
56
69
|
box-sizing: border-box;
|
package/esm/components/text-editor/__internal__/toolbar/toolbar-button/toolbar-button.component.js
CHANGED
|
@@ -20,7 +20,8 @@ const ToolbarButton = /*#__PURE__*/React.forwardRef(({
|
|
|
20
20
|
onKeyDown: onKeyDown,
|
|
21
21
|
onMouseDown: onMouseDown,
|
|
22
22
|
isActive: activated,
|
|
23
|
-
"aria-label": ariaLabel
|
|
23
|
+
"aria-label": ariaLabel,
|
|
24
|
+
"aria-pressed": activated
|
|
24
25
|
}, !tabbable && {
|
|
25
26
|
tabIndex: -1
|
|
26
27
|
}, {
|
|
@@ -4,14 +4,14 @@ const ErrorBorder = styled.span`
|
|
|
4
4
|
warning,
|
|
5
5
|
inline
|
|
6
6
|
}) => css`
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
position: absolute;
|
|
8
|
+
z-index: 6;
|
|
9
|
+
width: 2px;
|
|
10
|
+
background-color: ${warning ? "var(--colorsSemanticCaution500)" : "var(--colorsSemanticNegative500)"};
|
|
11
|
+
left: -12px;
|
|
12
|
+
bottom: ${inline ? "10px" : "0px"};
|
|
13
|
+
top: 0px;
|
|
14
|
+
`}
|
|
15
15
|
`;
|
|
16
16
|
const StyledHintText = styled.div`
|
|
17
17
|
::after {
|
|
@@ -4,7 +4,7 @@ import { SpaceProps, WidthProps } from "styled-system";
|
|
|
4
4
|
import { TagProps } from "../../__internal__/utils/helpers/tags";
|
|
5
5
|
import { TILE_HIGHLIGHT_VARIANTS } from "./tile.config";
|
|
6
6
|
declare type DesignTokensType = keyof typeof DesignTokens;
|
|
7
|
-
declare type HighlightVariantType = typeof TILE_HIGHLIGHT_VARIANTS[number];
|
|
7
|
+
declare type HighlightVariantType = (typeof TILE_HIGHLIGHT_VARIANTS)[number];
|
|
8
8
|
export interface TileProps extends SpaceProps, WidthProps, TagProps {
|
|
9
9
|
/** Sets the theme of the tile */
|
|
10
10
|
variant?: "tile" | "transparent" | "active" | "grey";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const StyledLabel: import("styled-components").StyledComponent<import("react").MemoExoticComponent<({ align, as, children, disabled, error, help, helpIcon, htmlFor, info, inline, isRequired, labelId, optional, pr, pl, tooltipId, useValidationIcon, validationIconId, warning, width, className, "aria-label": ariaLabel, }: import("../../__internal__/label").LabelProps) => import("react").JSX.Element>, any, {}, never>;
|
|
2
|
+
export declare const StyledLabel: import("styled-components").StyledComponent<import("react").MemoExoticComponent<({ align, as, children, disabled, error, help, helpIcon, htmlFor, info, inline, isDarkBackground, isRequired, labelId, optional, pr, pl, tooltipId, useValidationIcon, validationIconId, warning, width, className, "aria-label": ariaLabel, }: import("../../__internal__/label").LabelProps) => import("react").JSX.Element>, any, {}, never>;
|
|
3
3
|
export declare const StyledHintText: import("styled-components").StyledComponent<"div", any, {
|
|
4
4
|
isDisabled?: boolean | undefined;
|
|
5
5
|
hasError?: boolean | undefined;
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { SpaceProps } from "styled-system";
|
|
3
3
|
import { TagProps } from "../../__internal__/utils/helpers/tags";
|
|
4
4
|
export declare const VARIANT_TYPES: readonly ["h1-large", "h1", "h2", "h3", "h4", "h5", "segment-header", "segment-header-small", "segment-subheader", "segment-subheader-alt", "p", "span", "small", "big", "sup", "sub", "strong", "b", "em", "ul", "ol"];
|
|
5
|
-
export declare type VariantTypes = typeof VARIANT_TYPES[number];
|
|
5
|
+
export declare type VariantTypes = (typeof VARIANT_TYPES)[number];
|
|
6
6
|
export interface TypographyProps extends SpaceProps, TagProps {
|
|
7
7
|
/** Override the variant component */
|
|
8
8
|
as?: React.ElementType;
|
|
@@ -182,7 +182,7 @@ const StyledTypography = styled.span.attrs(({
|
|
|
182
182
|
${variant === "sup" && "vertical-align: super;"};
|
|
183
183
|
${variant === "sub" && "vertical-align: sub;"};
|
|
184
184
|
${display && `display: ${display};`};
|
|
185
|
-
${listStyleType && `list-style-type: ${listStyleType};`};
|
|
185
|
+
${listStyleType && `list-style-type: ${listStyleType};`};
|
|
186
186
|
`}
|
|
187
187
|
${space}
|
|
188
188
|
${({
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { SpaceProps } from "styled-system";
|
|
2
3
|
declare type TintRange = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100;
|
|
3
4
|
export interface VerticalDividerProps extends SpaceProps {
|
package/esm/global.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ declare global {
|
|
|
7
7
|
interface Window {
|
|
8
8
|
__CARBON_INTERNALS_MODAL_LIST?: ModalList;
|
|
9
9
|
__CARBON_INTERNALS_MODAL_SETTER_LIST?: ((
|
|
10
|
-
topModal: HTMLElement | null
|
|
10
|
+
topModal: HTMLElement | null,
|
|
11
11
|
) => void)[];
|
|
12
12
|
__CARBON_INTERNALS_SCROLL_BLOCKERS?: {
|
|
13
13
|
components: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const GAP_VALUES: number[];
|
|
2
|
-
export declare type AllowedNumericalValues = typeof GAP_VALUES[number];
|
|
2
|
+
export declare type AllowedNumericalValues = (typeof GAP_VALUES)[number];
|
|
3
3
|
export declare type Gap = AllowedNumericalValues | string;
|
|
4
4
|
export declare const getGapValue: (gapValue: number | string) => string;
|
|
5
5
|
export default function gap(gapValue: number | string): string;
|
|
@@ -7,10 +7,10 @@ exports.StyledCheckableInputWrapper = exports.StyledCheckableInput = void 0;
|
|
|
7
7
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
8
8
|
var _fieldHelp = _interopRequireDefault(require("../field-help/field-help.style"));
|
|
9
9
|
var _formField = require("../form-field/form-field.style");
|
|
10
|
-
var _hiddenCheckableInput = _interopRequireDefault(require("./hidden-checkable-input.style"));
|
|
11
10
|
var _label = _interopRequireWildcard(require("../label/label.style"));
|
|
12
|
-
var _help = _interopRequireDefault(require("../../components/help/help.style"));
|
|
13
11
|
var _validationIcon = _interopRequireDefault(require("../validations/validation-icon.style"));
|
|
12
|
+
var _help = _interopRequireDefault(require("../../components/help/help.style"));
|
|
13
|
+
var _hiddenCheckableInput = _interopRequireDefault(require("./hidden-checkable-input.style"));
|
|
14
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
15
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
16
16
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -27,6 +27,8 @@ const StyledCheckableInputWrapper = exports.StyledCheckableInputWrapper = _style
|
|
|
27
27
|
labelInline,
|
|
28
28
|
reverse
|
|
29
29
|
}) => (0, _styledComponents.css)`
|
|
30
|
+
width: 100% !important;
|
|
31
|
+
|
|
30
32
|
${_formField.FieldLineStyle} {
|
|
31
33
|
display: flex;
|
|
32
34
|
}
|
|
@@ -95,6 +97,7 @@ const StyledCheckableInputWrapper = exports.StyledCheckableInputWrapper = _style
|
|
|
95
97
|
${inputWidth !== undefined && inputWidth !== 0 && (0, _styledComponents.css)`
|
|
96
98
|
${StyledCheckableInput} {
|
|
97
99
|
width: ${inputWidth}% !important;
|
|
100
|
+
min-width: 67px;
|
|
98
101
|
}
|
|
99
102
|
`}
|
|
100
103
|
|
|
@@ -24,7 +24,9 @@ export interface LabelProps extends ValidationProps, StyledLabelProps, StyledLab
|
|
|
24
24
|
className?: string;
|
|
25
25
|
/** Sets aria-label for label element */
|
|
26
26
|
"aria-label"?: string;
|
|
27
|
+
/** Whether this component is shown against a dark background */
|
|
28
|
+
isDarkBackground?: boolean;
|
|
27
29
|
}
|
|
28
|
-
export declare const Label: ({ align, as, children, disabled, error, help, helpIcon, htmlFor, info, inline, isRequired, labelId, optional, pr, pl, tooltipId, useValidationIcon, validationIconId, warning, width, className, "aria-label": ariaLabel, }: LabelProps) => React.JSX.Element;
|
|
29
|
-
declare const _default: React.MemoExoticComponent<({ align, as, children, disabled, error, help, helpIcon, htmlFor, info, inline, isRequired, labelId, optional, pr, pl, tooltipId, useValidationIcon, validationIconId, warning, width, className, "aria-label": ariaLabel, }: LabelProps) => React.JSX.Element>;
|
|
30
|
+
export declare const Label: ({ align, as, children, disabled, error, help, helpIcon, htmlFor, info, inline, isDarkBackground, isRequired, labelId, optional, pr, pl, tooltipId, useValidationIcon, validationIconId, warning, width, className, "aria-label": ariaLabel, }: LabelProps) => React.JSX.Element;
|
|
31
|
+
declare const _default: React.MemoExoticComponent<({ align, as, children, disabled, error, help, helpIcon, htmlFor, info, inline, isDarkBackground, isRequired, labelId, optional, pr, pl, tooltipId, useValidationIcon, validationIconId, warning, width, className, "aria-label": ariaLabel, }: LabelProps) => React.JSX.Element>;
|
|
30
32
|
export default _default;
|
|
@@ -43,6 +43,7 @@ const Label = ({
|
|
|
43
43
|
htmlFor,
|
|
44
44
|
info,
|
|
45
45
|
inline,
|
|
46
|
+
isDarkBackground = false,
|
|
46
47
|
isRequired,
|
|
47
48
|
labelId,
|
|
48
49
|
optional,
|
|
@@ -125,7 +126,8 @@ const Label = ({
|
|
|
125
126
|
onMouseLeave: handleMouseLeave,
|
|
126
127
|
isRequired: isRequired,
|
|
127
128
|
as: as,
|
|
128
|
-
"aria-label": ariaLabel
|
|
129
|
+
"aria-label": ariaLabel,
|
|
130
|
+
isDarkBackground: isDarkBackground
|
|
129
131
|
}), children), icon());
|
|
130
132
|
};
|
|
131
133
|
exports.Label = Label;
|
|
@@ -3,6 +3,8 @@ export interface StyledLabelProps {
|
|
|
3
3
|
disabled?: boolean;
|
|
4
4
|
/** Flag to configure component as mandatory */
|
|
5
5
|
isRequired?: boolean;
|
|
6
|
+
/** Flag to determine whether to use colours for dark backgrounds */
|
|
7
|
+
isDarkBackground?: boolean;
|
|
6
8
|
}
|
|
7
9
|
declare const StyledLabel: import("styled-components").StyledComponent<"label", any, StyledLabelProps, never>;
|
|
8
10
|
export interface StyledLabelContainerProps {
|
|
@@ -8,7 +8,11 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
|
8
8
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
9
9
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
10
10
|
const StyledLabel = _styledComponents.default.label`
|
|
11
|
-
|
|
11
|
+
${({
|
|
12
|
+
isDarkBackground
|
|
13
|
+
}) => (0, _styledComponents.css)`
|
|
14
|
+
color: ${isDarkBackground ? "var(--colorsUtilityYang100)" : "var(--colorsUtilityYin090)"};
|
|
15
|
+
`}
|
|
12
16
|
display: block;
|
|
13
17
|
font-weight: var(--fontWeights500);
|
|
14
18
|
|
|
@@ -9,14 +9,9 @@ exports.default = void 0;
|
|
|
9
9
|
// IE does not support composedPath
|
|
10
10
|
// https://developer.mozilla.org/en-US/docs/Web/API/Event/composedPath
|
|
11
11
|
var _default = ev => {
|
|
12
|
-
// When testing with enzyme, we want to trigger a listener on an element but pretend
|
|
13
|
-
// that it bubbled from the enzymeTestingTarget
|
|
14
|
-
// e.g. document.dispatchEvent(new MouseClick('click', {
|
|
15
|
-
// detail: {enzymeTestingTarget: document.body}
|
|
16
|
-
// }))
|
|
17
12
|
// In this example composedPath would show that the event started at document.body
|
|
18
13
|
// but it would trigger the eventListener on document
|
|
19
|
-
let element = ev.
|
|
14
|
+
let element = ev.target || null;
|
|
20
15
|
if (!element || !element.parentElement) {
|
|
21
16
|
return [];
|
|
22
17
|
}
|