carbon-react 106.0.3 → 106.1.2
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__/input/input-presentation.component.d.ts +2 -2
- package/esm/__internal__/validations/index.d.ts +1 -1
- package/esm/__internal__/validations/validation-icon.component.d.ts +50 -40
- package/esm/__internal__/validations/validation-icon.component.js +12 -64
- package/esm/__internal__/validations/validation-icon.style.d.ts +5 -1
- package/esm/__internal__/validations/validation-icon.style.js +0 -1
- package/esm/components/duelling-picklist/picklist-item/picklist-item.component.js +7 -3
- package/esm/components/icon/icon.d.ts +4 -0
- package/esm/components/modal/modal.component.js +7 -1
- package/esm/components/pages/page/page.component.js +7 -3
- package/esm/components/popover-container/popover-container.component.js +5 -2
- package/esm/components/portal/portal.js +12 -8
- package/esm/components/select/simple-select/simple-select.component.js +1 -1
- package/esm/components/show-edit-pod/show-edit-pod.component.js +10 -4
- package/esm/components/textarea/textarea-test.stories.js +21 -1
- package/esm/components/toast/toast.component.js +6 -2
- package/esm/style/fonts.css +22 -16
- package/esm/style/themes/base/base-theme.config.d.ts +78 -10
- package/esm/style/themes/sage/index.d.ts +78 -10
- package/lib/__internal__/input/input-presentation.component.d.ts +2 -2
- package/lib/__internal__/validations/index.d.ts +1 -1
- package/lib/__internal__/validations/validation-icon.component.d.ts +50 -40
- package/lib/__internal__/validations/validation-icon.component.js +13 -65
- package/lib/__internal__/validations/validation-icon.style.d.ts +5 -1
- package/lib/__internal__/validations/validation-icon.style.js +0 -1
- package/lib/components/duelling-picklist/picklist-item/picklist-item.component.js +6 -2
- package/lib/components/icon/icon.d.ts +4 -0
- package/lib/components/modal/modal.component.js +7 -1
- package/lib/components/pages/page/page.component.js +11 -3
- package/lib/components/popover-container/popover-container.component.js +5 -2
- package/lib/components/portal/portal.js +15 -8
- package/lib/components/select/simple-select/simple-select.component.js +1 -1
- package/lib/components/show-edit-pod/show-edit-pod.component.js +10 -4
- package/lib/components/textarea/textarea-test.stories.js +21 -1
- package/lib/components/toast/toast.component.js +6 -2
- package/lib/style/fonts.css +22 -16
- package/lib/style/themes/base/base-theme.config.d.ts +78 -10
- package/lib/style/themes/sage/index.d.ts +78 -10
- package/package.json +2 -2
- package/esm/__internal__/validations/validation-icon.d.ts +0 -38
- package/esm/__internal__/validations/validations.d.ts +0 -17
- package/lib/__internal__/validations/validation-icon.d.ts +0 -38
- package/lib/__internal__/validations/validations.d.ts +0 -17
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { ValidationProps } from "../validations";
|
|
3
3
|
export declare type Sizes = "small" | "medium" | "large";
|
|
4
|
-
export interface CommonInputPresentationProps extends
|
|
4
|
+
export interface CommonInputPresentationProps extends ValidationProps {
|
|
5
5
|
children: React.ReactNode;
|
|
6
6
|
/** If true, the component will be disabled */
|
|
7
7
|
disabled?: boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default } from "./validation-icon.component";
|
|
2
|
-
export {
|
|
2
|
+
export type { ValidationProps, ValidationIconProps, } from "./validation-icon.component";
|
|
@@ -1,41 +1,51 @@
|
|
|
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
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface ValidationProps {
|
|
3
|
+
/** Indicate that error has occurred
|
|
4
|
+
* Pass string to display icon, tooltip and red border
|
|
5
|
+
* Pass true boolean to only display red border
|
|
6
|
+
*/
|
|
7
|
+
error?: boolean | string;
|
|
8
|
+
/** Indicate additional information
|
|
9
|
+
* Pass string to display icon, tooltip and blue border
|
|
10
|
+
* Pass true boolean to only display blue border
|
|
11
|
+
*/
|
|
12
|
+
info?: boolean | string;
|
|
13
|
+
/** Indicate that warning has occurred
|
|
14
|
+
* Pass string to display icon, tooltip and orange border
|
|
15
|
+
* Pass true boolean to only display orange border
|
|
16
|
+
*/
|
|
17
|
+
warning?: boolean | string;
|
|
18
|
+
}
|
|
19
|
+
declare type TooltipPositions = "top" | "bottom" | "left" | "right";
|
|
20
|
+
export interface ValidationIconProps extends ValidationProps {
|
|
21
|
+
/** A small string to indicate the size of the icon */
|
|
22
|
+
size?: "small" | "medium" | "large";
|
|
23
|
+
/** The unique id of the component (used with aria-describedby for accessibility) */
|
|
24
|
+
iconId?: string;
|
|
25
|
+
/** Define position of the tooltip */
|
|
26
|
+
tooltipPosition?: TooltipPositions;
|
|
27
|
+
/**
|
|
28
|
+
* Overrides the default flip behaviour of the Tooltip,
|
|
29
|
+
* must be an array containing some or all of ["top", "bottom", "left", "right"]
|
|
30
|
+
* (see https://popper.js.org/docs/v2/modifiers/flip/#fallbackplacements)
|
|
31
|
+
*/
|
|
32
|
+
tooltipFlipOverrides?: TooltipPositions[];
|
|
33
|
+
/** Id passed to the tooltip container, used for accessibility purposes */
|
|
34
|
+
tooltipId?: string;
|
|
35
|
+
/** An onClick handler */
|
|
36
|
+
onClick?: (ev: React.MouseEvent<HTMLElement>) => void;
|
|
37
|
+
/** An onBlur handler */
|
|
38
|
+
onBlur?: (ev: React.FocusEvent<HTMLElement>) => void;
|
|
39
|
+
/** An onFocus handler */
|
|
40
|
+
onFocus?: (ev: React.FocusEvent<HTMLElement>) => void;
|
|
41
|
+
/** A boolean to indicate if the icon is part of an input */
|
|
42
|
+
isPartOfInput?: boolean;
|
|
43
|
+
/** Overrides the default tabindex of the component */
|
|
44
|
+
tabIndex?: number;
|
|
45
|
+
/** Margin right, given number will be multiplied by base spacing unit (8) */
|
|
46
|
+
mr?: number;
|
|
47
|
+
/** Margin left, given number will be multiplied by base spacing unit (8) */
|
|
48
|
+
ml?: number;
|
|
40
49
|
}
|
|
41
|
-
|
|
50
|
+
export declare const ValidationIcon: ({ error, warning, info, size, onFocus, onBlur, iconId, tooltipId, isPartOfInput, tabIndex, onClick, tooltipPosition, tooltipFlipOverrides, ...rest }: ValidationIconProps) => JSX.Element | null;
|
|
51
|
+
export default ValidationIcon;
|
|
@@ -1,13 +1,11 @@
|
|
|
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
3
|
import React, { useContext, useState } from "react";
|
|
4
|
-
import
|
|
5
|
-
import styledSystemPropTypes from "@styled-system/prop-types";
|
|
4
|
+
import invariant from "invariant";
|
|
6
5
|
import Icon from "../../components/icon";
|
|
7
6
|
import ValidationIconStyle from "./validation-icon.style";
|
|
8
7
|
import { InputContext, InputGroupContext } from "../input-behaviour";
|
|
9
8
|
import { filterStyledSystemMarginProps } from "../../style/utils";
|
|
10
|
-
const marginPropTypes = filterStyledSystemMarginProps(styledSystemPropTypes.space);
|
|
11
9
|
|
|
12
10
|
const getValidationType = ({
|
|
13
11
|
error,
|
|
@@ -17,10 +15,10 @@ const getValidationType = ({
|
|
|
17
15
|
if (error) return "error";
|
|
18
16
|
if (warning) return "warning";
|
|
19
17
|
if (info) return "info";
|
|
20
|
-
return
|
|
18
|
+
return null;
|
|
21
19
|
};
|
|
22
20
|
|
|
23
|
-
const ValidationIcon = ({
|
|
21
|
+
export const ValidationIcon = ({
|
|
24
22
|
error,
|
|
25
23
|
warning,
|
|
26
24
|
info,
|
|
@@ -30,12 +28,18 @@ const ValidationIcon = ({
|
|
|
30
28
|
iconId,
|
|
31
29
|
tooltipId,
|
|
32
30
|
isPartOfInput,
|
|
33
|
-
tabIndex,
|
|
31
|
+
tabIndex = -1,
|
|
34
32
|
onClick,
|
|
35
|
-
tooltipPosition,
|
|
33
|
+
tooltipPosition = "right",
|
|
36
34
|
tooltipFlipOverrides,
|
|
37
35
|
...rest
|
|
38
36
|
}) => {
|
|
37
|
+
const flipBehaviourCheck = Array.isArray(tooltipFlipOverrides) && tooltipFlipOverrides.every(override => ["bottom", "left", "right", "top"].includes(override));
|
|
38
|
+
|
|
39
|
+
if (tooltipFlipOverrides) {
|
|
40
|
+
invariant(flipBehaviourCheck, `The tooltipFlipOverrides prop supplied to ValidationIcon must be an array containing some or all of ["top", "bottom", "left", "right"].`);
|
|
41
|
+
}
|
|
42
|
+
|
|
39
43
|
const {
|
|
40
44
|
hasFocus,
|
|
41
45
|
hasMouseOver
|
|
@@ -52,7 +56,7 @@ const ValidationIcon = ({
|
|
|
52
56
|
});
|
|
53
57
|
const validationMessage = error || warning || info;
|
|
54
58
|
|
|
55
|
-
if (typeof validationMessage !== "string") {
|
|
59
|
+
if (typeof validationMessage !== "string" || !validationType) {
|
|
56
60
|
return null;
|
|
57
61
|
}
|
|
58
62
|
|
|
@@ -86,60 +90,4 @@ const ValidationIcon = ({
|
|
|
86
90
|
focusable: tabIndex !== -1
|
|
87
91
|
}));
|
|
88
92
|
};
|
|
89
|
-
|
|
90
|
-
ValidationIcon.propTypes = { ...marginPropTypes,
|
|
91
|
-
|
|
92
|
-
/** A small string to indicate the size of the icon */
|
|
93
|
-
size: PropTypes.oneOf(["small", "medium", "large"]),
|
|
94
|
-
|
|
95
|
-
/** The unique id of the component (used with aria-describedby for accessibility) */
|
|
96
|
-
iconId: PropTypes.string,
|
|
97
|
-
|
|
98
|
-
/** Define position of the tooltip */
|
|
99
|
-
tooltipPosition: PropTypes.string,
|
|
100
|
-
|
|
101
|
-
/** Overrides the default flip behaviour of the Tooltip, must be an array containing some or all of ["top", "bottom", "left", "right"] (see https://popper.js.org/docs/v2/modifiers/flip/#fallbackplacements) */
|
|
102
|
-
tooltipFlipOverrides: (props, propName, componentName) => {
|
|
103
|
-
const prop = props[propName];
|
|
104
|
-
const isValid = prop && Array.isArray(prop) && prop.every(placement => ["bottom", "left", "right", "top"].includes(placement));
|
|
105
|
-
|
|
106
|
-
if (!prop || isValid) {
|
|
107
|
-
return null;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
return new Error( // eslint-disable-next-line max-len
|
|
111
|
-
`The \`${propName}\` prop supplied to \`${componentName}\` must be an array containing some or all of ["top", "bottom", "left", "right"].`);
|
|
112
|
-
},
|
|
113
|
-
|
|
114
|
-
/** Id passed to the tooltip container, used for accessibility purposes. */
|
|
115
|
-
tooltipId: PropTypes.string,
|
|
116
|
-
|
|
117
|
-
/** An onClick handler */
|
|
118
|
-
onClick: PropTypes.func,
|
|
119
|
-
|
|
120
|
-
/** An onFocus handler */
|
|
121
|
-
onFocus: PropTypes.func,
|
|
122
|
-
|
|
123
|
-
/** An onBlur handler */
|
|
124
|
-
onBlur: PropTypes.func,
|
|
125
|
-
|
|
126
|
-
/** A boolean to indicate if the icon is part of an input */
|
|
127
|
-
isPartOfInput: PropTypes.bool,
|
|
128
|
-
|
|
129
|
-
/** Overrides the default tabindex of the component */
|
|
130
|
-
tabIndex: PropTypes.number,
|
|
131
|
-
|
|
132
|
-
/** Status of error validations */
|
|
133
|
-
error: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
|
134
|
-
|
|
135
|
-
/** Status of warnings */
|
|
136
|
-
warning: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
|
137
|
-
|
|
138
|
-
/** Status of info */
|
|
139
|
-
info: PropTypes.oneOfType([PropTypes.bool, PropTypes.string])
|
|
140
|
-
};
|
|
141
|
-
ValidationIcon.defaultProps = {
|
|
142
|
-
tooltipPosition: "right",
|
|
143
|
-
tabIndex: -1
|
|
144
|
-
};
|
|
145
93
|
export default ValidationIcon;
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
+
import { ValidationIconProps } from "./validation-icon.component";
|
|
2
|
+
declare type ValidationType = "error" | "warning" | "info";
|
|
3
|
+
declare const ValidationIconStyle: import("styled-components").StyledComponent<"span", any, ValidationIconProps & {
|
|
4
|
+
validationType: ValidationType;
|
|
5
|
+
}, never>;
|
|
1
6
|
export default ValidationIconStyle;
|
|
2
|
-
declare const ValidationIconStyle: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
@@ -5,7 +5,6 @@ import StyledIcon from "../../components/icon/icon.style";
|
|
|
5
5
|
const validationIconTypes = {
|
|
6
6
|
error: "var(--colorsSemanticNegative500)",
|
|
7
7
|
info: "var(--colorsSemanticInfo500)",
|
|
8
|
-
success: "var(--colorsSemanticPositive500)",
|
|
9
8
|
warning: "var(--colorsSemanticCaution500)"
|
|
10
9
|
};
|
|
11
10
|
const ValidationIconStyle = styled.span`
|
|
@@ -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, { useCallback, useContext } from "react";
|
|
3
|
+
import React, { useCallback, useContext, useRef } from "react";
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
5
|
import { CSSTransition } from "react-transition-group";
|
|
6
6
|
import { StyledPicklistItem, StyledButton, StyledLockIcon } from "./picklist-item.style";
|
|
@@ -25,6 +25,7 @@ const PicklistItem = /*#__PURE__*/React.forwardRef(({
|
|
|
25
25
|
const {
|
|
26
26
|
setElementToFocus
|
|
27
27
|
} = useContext(FocusContext);
|
|
28
|
+
const picklistItemNodeRef = useRef();
|
|
28
29
|
const calculateFocusIndex = useCallback(() => {
|
|
29
30
|
if (isLastItem) {
|
|
30
31
|
const toggledListIndex = listIndex === 0 ? 1 : 0;
|
|
@@ -70,10 +71,13 @@ const PicklistItem = /*#__PURE__*/React.forwardRef(({
|
|
|
70
71
|
classNames: "picklist-item"
|
|
71
72
|
}, rest, type === "add" ? {
|
|
72
73
|
enter: false
|
|
73
|
-
} : {}
|
|
74
|
+
} : {}, {
|
|
75
|
+
nodeRef: picklistItemNodeRef
|
|
76
|
+
}), /*#__PURE__*/React.createElement(StyledPicklistItem, {
|
|
74
77
|
onKeyDown: handleKeydown,
|
|
75
78
|
"data-element": "picklist-item",
|
|
76
|
-
locked: locked
|
|
79
|
+
locked: locked,
|
|
80
|
+
ref: picklistItemNodeRef
|
|
77
81
|
}, children, !locked && /*#__PURE__*/React.createElement(StyledButton, {
|
|
78
82
|
buttonType: "primary",
|
|
79
83
|
destructive: type === "remove",
|
|
@@ -239,6 +239,10 @@ export interface IconProps extends MarginProps {
|
|
|
239
239
|
tooltipId?: string;
|
|
240
240
|
/** Id passed to the icon. */
|
|
241
241
|
id?: string;
|
|
242
|
+
tabIndex?: number;
|
|
243
|
+
isPartOfInput?: boolean;
|
|
244
|
+
inputSize?: "small" | "medium" | "large";
|
|
245
|
+
focusable?: boolean;
|
|
242
246
|
}
|
|
243
247
|
|
|
244
248
|
declare function Icon(
|
|
@@ -21,6 +21,8 @@ const Modal = ({
|
|
|
21
21
|
...rest
|
|
22
22
|
}) => {
|
|
23
23
|
const ref = useRef();
|
|
24
|
+
const backgroundNodeRef = useRef();
|
|
25
|
+
const contentNodeRef = useRef();
|
|
24
26
|
const listenerAdded = useRef(false);
|
|
25
27
|
const modalRegistered = useRef(false);
|
|
26
28
|
const [isAnimationComplete, setAnimationComplete] = useState(false);
|
|
@@ -114,6 +116,7 @@ const Modal = ({
|
|
|
114
116
|
|
|
115
117
|
if (open) {
|
|
116
118
|
background = !enableBackgroundUI ? /*#__PURE__*/React.createElement(StyledModalBackground, {
|
|
119
|
+
ref: backgroundNodeRef,
|
|
117
120
|
"data-element": "modal-background",
|
|
118
121
|
transitionName: "modal-background",
|
|
119
122
|
transitionTime: timeout
|
|
@@ -127,6 +130,7 @@ const Modal = ({
|
|
|
127
130
|
transitionTime: timeout,
|
|
128
131
|
ref: ref
|
|
129
132
|
}, rest), /*#__PURE__*/React.createElement(TransitionGroup, null, background && /*#__PURE__*/React.createElement(CSSTransition, {
|
|
133
|
+
nodeRef: backgroundNodeRef,
|
|
130
134
|
key: "modal",
|
|
131
135
|
appear: true,
|
|
132
136
|
classNames: "modal-background",
|
|
@@ -134,6 +138,7 @@ const Modal = ({
|
|
|
134
138
|
onEntered: () => setAnimationComplete(true),
|
|
135
139
|
onExiting: () => setAnimationComplete(false)
|
|
136
140
|
}, background)), /*#__PURE__*/React.createElement(TransitionGroup, null, content && /*#__PURE__*/React.createElement(CSSTransition, {
|
|
141
|
+
nodeRef: contentNodeRef,
|
|
137
142
|
appear: true,
|
|
138
143
|
classNames: "modal",
|
|
139
144
|
timeout: timeout
|
|
@@ -142,7 +147,8 @@ const Modal = ({
|
|
|
142
147
|
isAnimationComplete,
|
|
143
148
|
triggerRefocusFlag,
|
|
144
149
|
isInModal: true
|
|
145
|
-
}
|
|
150
|
+
},
|
|
151
|
+
ref: contentNodeRef
|
|
146
152
|
}, content)))));
|
|
147
153
|
};
|
|
148
154
|
|
|
@@ -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 from "react";
|
|
3
|
+
import React, { useRef } from "react";
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
5
|
import { CSSTransition } from "react-transition-group";
|
|
6
6
|
import tagComponent from "../../../__internal__/utils/helpers/tags/tags";
|
|
@@ -13,6 +13,7 @@ const Page = ({
|
|
|
13
13
|
children,
|
|
14
14
|
...props
|
|
15
15
|
}) => {
|
|
16
|
+
const styledPageNodeRef = useRef();
|
|
16
17
|
return /*#__PURE__*/React.createElement(CSSTransition, _extends({
|
|
17
18
|
className: "carbon-carousel__transition",
|
|
18
19
|
timeout: {
|
|
@@ -21,8 +22,11 @@ const Page = ({
|
|
|
21
22
|
exit: 0
|
|
22
23
|
} // eslint-disable-next-line react/prop-types
|
|
23
24
|
,
|
|
24
|
-
classNames: props.transitionName()
|
|
25
|
-
|
|
25
|
+
classNames: props.transitionName(),
|
|
26
|
+
nodeRef: styledPageNodeRef
|
|
27
|
+
}, props), /*#__PURE__*/React.createElement(StyledPage, _extends({}, tagComponent("page", props), {
|
|
28
|
+
ref: styledPageNodeRef
|
|
29
|
+
}), /*#__PURE__*/React.createElement(FullScreenHeading, {
|
|
26
30
|
hasContent: title
|
|
27
31
|
}, title), /*#__PURE__*/React.createElement(StyledPageContent, {
|
|
28
32
|
"data-element": "carbon-page-content"
|
|
@@ -31,6 +31,7 @@ const PopoverContainer = ({
|
|
|
31
31
|
const closeButtonRef = useRef();
|
|
32
32
|
const openButtonRef = useRef();
|
|
33
33
|
const guid = useRef(createGuid());
|
|
34
|
+
const popoverContentNodeRef = useRef();
|
|
34
35
|
const popoverContainerId = title ? `PopoverContainer_${guid.current}` : undefined;
|
|
35
36
|
const isOpen = isControlled ? open : isOpenInternal;
|
|
36
37
|
useEffect(() => {
|
|
@@ -78,7 +79,8 @@ const PopoverContainer = ({
|
|
|
78
79
|
},
|
|
79
80
|
appear: true,
|
|
80
81
|
mountOnEnter: true,
|
|
81
|
-
unmountOnExit: true
|
|
82
|
+
unmountOnExit: true,
|
|
83
|
+
nodeRef: popoverContentNodeRef
|
|
82
84
|
}, state => /*#__PURE__*/React.createElement(PopoverContainerContentStyle, _extends({
|
|
83
85
|
"data-element": "popover-container-content",
|
|
84
86
|
role: "dialog",
|
|
@@ -88,7 +90,8 @@ const PopoverContainer = ({
|
|
|
88
90
|
"aria-labelledby": popoverContainerId,
|
|
89
91
|
"aria-label": containerAriaLabel,
|
|
90
92
|
"aria-describedby": ariaDescribedBy,
|
|
91
|
-
p: "16px 24px"
|
|
93
|
+
p: "16px 24px",
|
|
94
|
+
ref: popoverContentNodeRef
|
|
92
95
|
}, filterStyledSystemPaddingProps(rest)), /*#__PURE__*/React.createElement(PopoverContainerHeaderStyle, null, /*#__PURE__*/React.createElement(PopoverContainerTitleStyle, {
|
|
93
96
|
id: popoverContainerId,
|
|
94
97
|
"data-element": "popover-container-title"
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import React, { useEffect, useMemo, useState } from "react";
|
|
1
|
+
import React, { useContext, useEffect, useMemo, useState } from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import ReactDOM from "react-dom";
|
|
4
4
|
import guid from "../../__internal__/utils/helpers/guid";
|
|
5
5
|
import Browser from "../../__internal__/utils/helpers/browser";
|
|
6
6
|
import CarbonScopedTokensProvider from "../../style/design-tokens/carbon-scoped-tokens-provider/carbon-scoped-tokens-provider.component";
|
|
7
|
+
export const PortalContext = /*#__PURE__*/React.createContext({});
|
|
7
8
|
|
|
8
9
|
const Portal = ({
|
|
9
10
|
children,
|
|
@@ -13,6 +14,9 @@ const Portal = ({
|
|
|
13
14
|
}) => {
|
|
14
15
|
const [portalNode, setPortalNode] = useState(null);
|
|
15
16
|
const uniqueId = useMemo(() => guid(), []);
|
|
17
|
+
const {
|
|
18
|
+
renderInRoot
|
|
19
|
+
} = useContext(PortalContext);
|
|
16
20
|
useEffect(() => {
|
|
17
21
|
if (onReposition) {
|
|
18
22
|
onReposition();
|
|
@@ -45,7 +49,7 @@ const Portal = ({
|
|
|
45
49
|
if (!node && id !== undefined && document.getElementById(id)) {
|
|
46
50
|
node = document.getElementById(id);
|
|
47
51
|
setPortalNode(node);
|
|
48
|
-
} else if (!node) {
|
|
52
|
+
} else if (!node || document.getElementsByClassName(portalClassName).length === 0) {
|
|
49
53
|
node = document.createElement("div");
|
|
50
54
|
node.classList.add(portalClassName);
|
|
51
55
|
node.setAttribute("data-portal-exit", uniqueId);
|
|
@@ -55,14 +59,14 @@ const Portal = ({
|
|
|
55
59
|
}
|
|
56
60
|
|
|
57
61
|
setPortalNode(node);
|
|
58
|
-
|
|
59
|
-
|
|
62
|
+
let mainNode = document.body;
|
|
63
|
+
const rootDiv = document.getElementById("root");
|
|
60
64
|
|
|
61
|
-
if (rootDiv &&
|
|
62
|
-
rootDiv
|
|
63
|
-
} else {
|
|
64
|
-
document.body.appendChild(node);
|
|
65
|
+
if (rootDiv && renderInRoot) {
|
|
66
|
+
mainNode = rootDiv;
|
|
65
67
|
}
|
|
68
|
+
|
|
69
|
+
mainNode.appendChild(node);
|
|
66
70
|
}
|
|
67
71
|
|
|
68
72
|
if (className) {
|
|
@@ -130,7 +130,7 @@ const SimpleSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
130
130
|
|
|
131
131
|
return true;
|
|
132
132
|
});
|
|
133
|
-
} else if (key.length === 1) {
|
|
133
|
+
} else if (key.length === 1 && !event.metaKey && !event.ctrlKey) {
|
|
134
134
|
triggerFilterChange(key);
|
|
135
135
|
}
|
|
136
136
|
}, [triggerFilterChange, onKeyDown, onOpen, readOnly]);
|
|
@@ -37,6 +37,8 @@ const ShowEditPod = ({
|
|
|
37
37
|
}) => {
|
|
38
38
|
const locale = useContext(LocaleContext);
|
|
39
39
|
const ref = useRef();
|
|
40
|
+
const editModeNodeRef = useRef();
|
|
41
|
+
const showModeNodeRef = useRef();
|
|
40
42
|
const [isEditing, setIsEditingState] = useState(false);
|
|
41
43
|
const isControlled = editing !== undefined;
|
|
42
44
|
|
|
@@ -122,9 +124,11 @@ const ShowEditPod = ({
|
|
|
122
124
|
timeout: {
|
|
123
125
|
enter: 300,
|
|
124
126
|
exit: 50
|
|
125
|
-
}
|
|
127
|
+
},
|
|
128
|
+
nodeRef: editModeNodeRef
|
|
126
129
|
}, /*#__PURE__*/React.createElement("div", {
|
|
127
|
-
key: "edit"
|
|
130
|
+
key: "edit",
|
|
131
|
+
ref: editModeNodeRef
|
|
128
132
|
}, editContent()));
|
|
129
133
|
}
|
|
130
134
|
|
|
@@ -134,9 +138,11 @@ const ShowEditPod = ({
|
|
|
134
138
|
timeout: {
|
|
135
139
|
enter: 300,
|
|
136
140
|
exit: 50
|
|
137
|
-
}
|
|
141
|
+
},
|
|
142
|
+
nodeRef: showModeNodeRef
|
|
138
143
|
}, /*#__PURE__*/React.createElement("div", {
|
|
139
|
-
key: "show"
|
|
144
|
+
key: "show",
|
|
145
|
+
ref: showModeNodeRef
|
|
140
146
|
}, children));
|
|
141
147
|
};
|
|
142
148
|
|
|
@@ -68,7 +68,27 @@ export default {
|
|
|
68
68
|
...number.mapping
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
|
-
fieldHelpSpecialCharacters: specialCharacters
|
|
71
|
+
fieldHelpSpecialCharacters: specialCharacters,
|
|
72
|
+
children: {
|
|
73
|
+
control: {
|
|
74
|
+
type: "text"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
error: {
|
|
78
|
+
control: {
|
|
79
|
+
type: "text"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
warning: {
|
|
83
|
+
control: {
|
|
84
|
+
type: "text"
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
info: {
|
|
88
|
+
control: {
|
|
89
|
+
type: "text"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
72
92
|
},
|
|
73
93
|
args: {
|
|
74
94
|
expandable: false,
|
|
@@ -37,6 +37,7 @@ const Toast = ({
|
|
|
37
37
|
const locale = useLocale();
|
|
38
38
|
const toastRef = useRef();
|
|
39
39
|
const timer = useRef();
|
|
40
|
+
const toastContentNodeRef = useRef();
|
|
40
41
|
const componentClasses = useMemo(() => {
|
|
41
42
|
return classNames(className);
|
|
42
43
|
}, [className]);
|
|
@@ -93,10 +94,13 @@ const Toast = ({
|
|
|
93
94
|
appear: 1600,
|
|
94
95
|
enter: 1500,
|
|
95
96
|
exit: 500
|
|
96
|
-
}
|
|
97
|
+
},
|
|
98
|
+
nodeRef: toastContentNodeRef
|
|
97
99
|
}, /*#__PURE__*/React.createElement(ToastStyle, _extends({
|
|
98
100
|
className: componentClasses
|
|
99
|
-
}, tagComponent(restProps["data-component"] || "toast", restProps), toastProps
|
|
101
|
+
}, tagComponent(restProps["data-component"] || "toast", restProps), toastProps, {
|
|
102
|
+
ref: toastContentNodeRef
|
|
103
|
+
}), /*#__PURE__*/React.createElement(TypeIcon, {
|
|
100
104
|
variant: toastProps.variant
|
|
101
105
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
102
106
|
type: toastProps.variant
|
package/esm/style/fonts.css
CHANGED
|
@@ -1,30 +1,36 @@
|
|
|
1
|
-
@font-face{
|
|
2
|
-
font-family: "
|
|
3
|
-
src: url(
|
|
4
|
-
font-weight:
|
|
1
|
+
@font-face {
|
|
2
|
+
font-family: "CarbonIcons";
|
|
3
|
+
src: url("./assets/carbon-icons-webfont.woff") format("woff");
|
|
4
|
+
font-weight: normal;
|
|
5
5
|
font-style: normal;
|
|
6
|
-
font-display: swap;
|
|
7
6
|
}
|
|
8
7
|
|
|
9
|
-
@font-face{
|
|
8
|
+
@font-face {
|
|
10
9
|
font-family: "Sage UI";
|
|
11
|
-
src: url('https://fonts.sage.com/Sage_UI-Medium.woff2') format("woff2"), url('https://fonts.sage.com/Sage_UI-Medium.woff') format("woff");
|
|
12
|
-
font-weight: 700;
|
|
13
10
|
font-style: normal;
|
|
14
|
-
font-
|
|
11
|
+
font-weight: 400;
|
|
12
|
+
src: url("~@sage/design-tokens/assets/fonts/sageui-regular.woff2") format("woff2"),
|
|
13
|
+
url("~@sage/design-tokens/assets/fonts/sageui-regular.woff") format("woff"),
|
|
14
|
+
url("~@sage/design-tokens/assets/fonts/sageui-regular.ttf") format("truetype"),
|
|
15
|
+
url("~@sage/design-tokens/assets/fonts/sageui-regular.otf") format("opentype");
|
|
15
16
|
}
|
|
16
17
|
|
|
17
|
-
@font-face{
|
|
18
|
+
@font-face {
|
|
18
19
|
font-family: "Sage UI";
|
|
19
|
-
src: url('https://fonts.sage.com/Sage_UI-Bold.woff2') format("woff2"), url('https://fonts.sage.com/Sage_UI-Bold.woff') format("woff");
|
|
20
|
-
font-weight: 900;
|
|
21
20
|
font-style: normal;
|
|
22
|
-
font-
|
|
21
|
+
font-weight: 700;
|
|
22
|
+
src: url("~@sage/design-tokens/assets/fonts/sageui-medium.woff2") format("woff2"),
|
|
23
|
+
url("~@sage/design-tokens/assets/fonts/sageui-medium.woff") format("woff"),
|
|
24
|
+
url("~@sage/design-tokens/assets/fonts/sageui-medium.ttf") format("truetype"),
|
|
25
|
+
url("~@sage/design-tokens/assets/fonts/sageui-medium.otf") format("opentype");
|
|
23
26
|
}
|
|
24
27
|
|
|
25
28
|
@font-face {
|
|
26
|
-
font-family: "
|
|
27
|
-
src: url("./assets/carbon-icons-webfont.woff") format("woff");
|
|
28
|
-
font-weight: normal;
|
|
29
|
+
font-family: "Sage UI";
|
|
29
30
|
font-style: normal;
|
|
31
|
+
font-weight: 900;
|
|
32
|
+
src: url("~@sage/design-tokens/assets/fonts/sageui-bold.woff2") format("woff2"),
|
|
33
|
+
url("~@sage/design-tokens/assets/fonts/sageui-bold.woff") format("woff"),
|
|
34
|
+
url("~@sage/design-tokens/assets/fonts/sageui-bold.ttf") format("truetype"),
|
|
35
|
+
url("~@sage/design-tokens/assets/fonts/sageui-bold.otf") format("opentype");
|
|
30
36
|
}
|