carbon-react 107.1.7 → 107.2.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/form/form.component.js +7 -2
- package/esm/components/form/form.style.js +3 -2
- package/esm/components/heading/heading.component.js +6 -2
- package/esm/components/help/help.component.js +2 -2
- package/esm/components/menu/__internal__/submenu/submenu.component.js +1 -3
- package/esm/components/modal/index.d.ts +1 -1
- package/esm/components/modal/index.js +1 -1
- package/esm/components/modal/modal.component.d.ts +35 -0
- package/esm/components/modal/modal.d.ts +11 -0
- package/esm/components/modal/modal.style.d.ts +2 -0
- package/esm/locales/en-gb.js +3 -0
- package/esm/locales/locale.d.ts +3 -0
- package/esm/locales/pl-pl.js +3 -0
- package/lib/components/form/form.component.js +9 -3
- package/lib/components/form/form.style.js +3 -2
- package/lib/components/heading/heading.component.js +7 -2
- package/lib/components/help/help.component.js +2 -2
- package/lib/components/menu/__internal__/submenu/submenu.component.js +1 -3
- package/lib/components/modal/index.d.ts +1 -1
- package/lib/components/modal/index.js +10 -2
- package/lib/components/modal/modal.component.d.ts +35 -0
- package/lib/components/modal/modal.d.ts +11 -0
- package/lib/components/modal/modal.style.d.ts +2 -0
- package/lib/locales/en-gb.js +3 -0
- package/lib/locales/locale.d.ts +3 -0
- package/lib/locales/pl-pl.js +3 -0
- package/package.json +1 -1
|
@@ -3,9 +3,10 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
3
3
|
import React, { useRef, useContext } from "react";
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
5
|
import styledSystemPropTypes from "@styled-system/prop-types";
|
|
6
|
+
import { ModalContext } from "../modal/modal.component";
|
|
7
|
+
import { SidebarContext } from "../sidebar/sidebar.component";
|
|
6
8
|
import FormSummary from "./__internal__/form-summary.component";
|
|
7
9
|
import { StyledForm, StyledFormContent, StyledFormFooter, StyledLeftButtons, StyledRightButtons } from "./form.style";
|
|
8
|
-
import { SidebarContext } from "../sidebar/sidebar.component";
|
|
9
10
|
|
|
10
11
|
const Form = ({
|
|
11
12
|
children,
|
|
@@ -25,6 +26,9 @@ const Form = ({
|
|
|
25
26
|
const {
|
|
26
27
|
isInSidebar
|
|
27
28
|
} = useContext(SidebarContext);
|
|
29
|
+
const {
|
|
30
|
+
isInModal
|
|
31
|
+
} = useContext(ModalContext);
|
|
28
32
|
const formRef = useRef();
|
|
29
33
|
const formFooterRef = useRef();
|
|
30
34
|
const renderFooter = !!(saveButton || leftSideButtons || rightSideButtons || errorCount || warningCount);
|
|
@@ -39,8 +43,9 @@ const Form = ({
|
|
|
39
43
|
height: height
|
|
40
44
|
}, rest), /*#__PURE__*/React.createElement(StyledFormContent, {
|
|
41
45
|
"data-element": "form-content",
|
|
46
|
+
className: stickyFooter ? "sticky" : "",
|
|
42
47
|
stickyFooter: stickyFooter,
|
|
43
|
-
|
|
48
|
+
isInModal: isInModal
|
|
44
49
|
}, children), renderFooter && /*#__PURE__*/React.createElement(StyledFormFooter, {
|
|
45
50
|
"data-element": "form-footer",
|
|
46
51
|
className: stickyFooter ? "sticky" : "",
|
|
@@ -12,10 +12,11 @@ import StyledSearch from "../search/search.style";
|
|
|
12
12
|
import StyledTextarea from "../textarea/textarea.style";
|
|
13
13
|
export const StyledFormContent = styled.div`
|
|
14
14
|
${({
|
|
15
|
-
stickyFooter
|
|
15
|
+
stickyFooter,
|
|
16
|
+
isInModal
|
|
16
17
|
}) => css`
|
|
17
18
|
${stickyFooter && css`
|
|
18
|
-
overflow-y: auto;
|
|
19
|
+
overflow-y: ${isInModal ? "visible" : "auto"};
|
|
19
20
|
flex: 1;
|
|
20
21
|
`}
|
|
21
22
|
`}
|
|
@@ -6,6 +6,7 @@ import styledSystemPropTypes from "@styled-system/prop-types";
|
|
|
6
6
|
import { filterStyledSystemMarginProps } from "../../style/utils";
|
|
7
7
|
import tagComponent from "../../__internal__/utils/helpers/tags/tags";
|
|
8
8
|
import { StyledHeading, StyledHeadingIcon, StyledSubHeader, StyledHeader, StyledSeparator, StyledHeaderHelp, StyledHeadingTitle, StyledDivider, StyledHeaderContent, StyledHeadingBackButton, StyledHeadingPills } from "./heading.style";
|
|
9
|
+
import useLocale from "../../hooks/__internal__/useLocale";
|
|
9
10
|
const marginPropTypes = filterStyledSystemMarginProps(styledSystemPropTypes.space);
|
|
10
11
|
|
|
11
12
|
const Heading = ({
|
|
@@ -32,6 +33,8 @@ const Heading = ({
|
|
|
32
33
|
}, help);
|
|
33
34
|
};
|
|
34
35
|
|
|
36
|
+
const l = useLocale();
|
|
37
|
+
|
|
35
38
|
const getBackButton = () => {
|
|
36
39
|
const backButtonProps = typeof backLink === "string" ? {
|
|
37
40
|
href: backLink
|
|
@@ -40,8 +43,9 @@ const Heading = ({
|
|
|
40
43
|
};
|
|
41
44
|
return /*#__PURE__*/React.createElement(StyledHeadingBackButton // this event allows an element to be focusable on click event on IE
|
|
42
45
|
, _extends({
|
|
43
|
-
|
|
44
|
-
"data-element": "back"
|
|
46
|
+
"aria-label": l.heading.backLinkAriaLabel(),
|
|
47
|
+
"data-element": "back",
|
|
48
|
+
onMouseDown: e => e.currentTarget.focus()
|
|
45
49
|
}, backButtonProps), /*#__PURE__*/React.createElement(StyledHeadingIcon, {
|
|
46
50
|
type: "chevron_left",
|
|
47
51
|
divider: divider
|
|
@@ -59,6 +59,7 @@ const Help = ({
|
|
|
59
59
|
|
|
60
60
|
return /*#__PURE__*/React.createElement(StyledHelp, _extends({
|
|
61
61
|
"aria-describedby": isFocused || isTooltipVisible ? tooltipId || defaultTooltipId.current : undefined,
|
|
62
|
+
"aria-label": helpAriaLabel || ariaLabel,
|
|
62
63
|
className: className,
|
|
63
64
|
as: tagType,
|
|
64
65
|
href: href,
|
|
@@ -77,8 +78,7 @@ const Help = ({
|
|
|
77
78
|
target: "_blank",
|
|
78
79
|
rel: "noopener noreferrer"
|
|
79
80
|
} : {
|
|
80
|
-
role: "button"
|
|
81
|
-
"aria-label": helpAriaLabel || ariaLabel
|
|
81
|
+
role: "button"
|
|
82
82
|
}, filterStyledSystemMarginProps(rest), rest), /*#__PURE__*/React.createElement(Icon, {
|
|
83
83
|
"aria-hidden": true,
|
|
84
84
|
type: type,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from "./modal";
|
|
1
|
+
export { default, ModalContext } from "./modal.component";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from "./modal.component";
|
|
1
|
+
export { default, ModalContext } from "./modal.component";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export const ModalContext: React.Context<{}>;
|
|
2
|
+
export default Modal;
|
|
3
|
+
import React from "react";
|
|
4
|
+
declare function Modal({ children, open, onCancel, disableEscKey, disableClose, enableBackgroundUI, timeout, ...rest }: {
|
|
5
|
+
[x: string]: any;
|
|
6
|
+
children: any;
|
|
7
|
+
open: any;
|
|
8
|
+
onCancel: any;
|
|
9
|
+
disableEscKey: any;
|
|
10
|
+
disableClose: any;
|
|
11
|
+
enableBackgroundUI: any;
|
|
12
|
+
timeout: any;
|
|
13
|
+
}): JSX.Element;
|
|
14
|
+
declare namespace Modal {
|
|
15
|
+
namespace propTypes {
|
|
16
|
+
const children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
17
|
+
const onCancel: PropTypes.Requireable<(...args: any[]) => any>;
|
|
18
|
+
const open: PropTypes.Validator<boolean>;
|
|
19
|
+
const enableBackgroundUI: PropTypes.Requireable<boolean>;
|
|
20
|
+
const disableEscKey: PropTypes.Requireable<boolean>;
|
|
21
|
+
const disableClose: PropTypes.Requireable<boolean>;
|
|
22
|
+
const timeout: PropTypes.Requireable<number>;
|
|
23
|
+
}
|
|
24
|
+
namespace defaultProps {
|
|
25
|
+
const onCancel_1: null;
|
|
26
|
+
export { onCancel_1 as onCancel };
|
|
27
|
+
const enableBackgroundUI_1: boolean;
|
|
28
|
+
export { enableBackgroundUI_1 as enableBackgroundUI };
|
|
29
|
+
const disableEscKey_1: boolean;
|
|
30
|
+
export { disableEscKey_1 as disableEscKey };
|
|
31
|
+
const timeout_1: number;
|
|
32
|
+
export { timeout_1 as timeout };
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
import PropTypes from "prop-types";
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
|
|
3
|
+
export interface ModalContextProps {
|
|
4
|
+
value?: {
|
|
5
|
+
isInModal?: boolean;
|
|
6
|
+
isAnimationComplete?: boolean;
|
|
7
|
+
triggerRefocusFlag?: boolean;
|
|
8
|
+
};
|
|
9
|
+
ref?: React.MutableRefObject<React.ReactNode>;
|
|
10
|
+
}
|
|
11
|
+
|
|
3
12
|
export interface ModalProps {
|
|
4
13
|
/** Modal content */
|
|
5
14
|
children?: React.ReactNode;
|
|
@@ -19,6 +28,8 @@ export interface ModalProps {
|
|
|
19
28
|
timeout?: number;
|
|
20
29
|
}
|
|
21
30
|
|
|
31
|
+
declare const ModelContext: React.Context<ModalContextProps>;
|
|
22
32
|
declare function Modal(props: ModalProps): JSX.Element;
|
|
23
33
|
|
|
34
|
+
export { ModalContext };
|
|
24
35
|
export default Modal;
|
package/esm/locales/en-gb.js
CHANGED
package/esm/locales/locale.d.ts
CHANGED
package/esm/locales/pl-pl.js
CHANGED
|
@@ -11,12 +11,14 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
11
11
|
|
|
12
12
|
var _propTypes2 = _interopRequireDefault(require("@styled-system/prop-types"));
|
|
13
13
|
|
|
14
|
+
var _modal = require("../modal/modal.component");
|
|
15
|
+
|
|
16
|
+
var _sidebar = require("../sidebar/sidebar.component");
|
|
17
|
+
|
|
14
18
|
var _formSummary = _interopRequireDefault(require("./__internal__/form-summary.component"));
|
|
15
19
|
|
|
16
20
|
var _form = require("./form.style");
|
|
17
21
|
|
|
18
|
-
var _sidebar = require("../sidebar/sidebar.component");
|
|
19
|
-
|
|
20
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
23
|
|
|
22
24
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
@@ -43,6 +45,9 @@ const Form = ({
|
|
|
43
45
|
const {
|
|
44
46
|
isInSidebar
|
|
45
47
|
} = (0, _react.useContext)(_sidebar.SidebarContext);
|
|
48
|
+
const {
|
|
49
|
+
isInModal
|
|
50
|
+
} = (0, _react.useContext)(_modal.ModalContext);
|
|
46
51
|
const formRef = (0, _react.useRef)();
|
|
47
52
|
const formFooterRef = (0, _react.useRef)();
|
|
48
53
|
const renderFooter = !!(saveButton || leftSideButtons || rightSideButtons || errorCount || warningCount);
|
|
@@ -57,8 +62,9 @@ const Form = ({
|
|
|
57
62
|
height: height
|
|
58
63
|
}, rest), /*#__PURE__*/_react.default.createElement(_form.StyledFormContent, {
|
|
59
64
|
"data-element": "form-content",
|
|
65
|
+
className: stickyFooter ? "sticky" : "",
|
|
60
66
|
stickyFooter: stickyFooter,
|
|
61
|
-
|
|
67
|
+
isInModal: isInModal
|
|
62
68
|
}, children), renderFooter && /*#__PURE__*/_react.default.createElement(_form.StyledFormFooter, {
|
|
63
69
|
"data-element": "form-footer",
|
|
64
70
|
className: stickyFooter ? "sticky" : "",
|
|
@@ -37,10 +37,11 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
|
|
37
37
|
|
|
38
38
|
const StyledFormContent = _styledComponents.default.div`
|
|
39
39
|
${({
|
|
40
|
-
stickyFooter
|
|
40
|
+
stickyFooter,
|
|
41
|
+
isInModal
|
|
41
42
|
}) => (0, _styledComponents.css)`
|
|
42
43
|
${stickyFooter && (0, _styledComponents.css)`
|
|
43
|
-
overflow-y: auto;
|
|
44
|
+
overflow-y: ${isInModal ? "visible" : "auto"};
|
|
44
45
|
flex: 1;
|
|
45
46
|
`}
|
|
46
47
|
`}
|
|
@@ -17,6 +17,8 @@ var _tags = _interopRequireDefault(require("../../__internal__/utils/helpers/tag
|
|
|
17
17
|
|
|
18
18
|
var _heading = require("./heading.style");
|
|
19
19
|
|
|
20
|
+
var _useLocale = _interopRequireDefault(require("../../hooks/__internal__/useLocale"));
|
|
21
|
+
|
|
20
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
23
|
|
|
22
24
|
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); }
|
|
@@ -47,6 +49,8 @@ const Heading = ({
|
|
|
47
49
|
}, help);
|
|
48
50
|
};
|
|
49
51
|
|
|
52
|
+
const l = (0, _useLocale.default)();
|
|
53
|
+
|
|
50
54
|
const getBackButton = () => {
|
|
51
55
|
const backButtonProps = typeof backLink === "string" ? {
|
|
52
56
|
href: backLink
|
|
@@ -55,8 +59,9 @@ const Heading = ({
|
|
|
55
59
|
};
|
|
56
60
|
return /*#__PURE__*/_react.default.createElement(_heading.StyledHeadingBackButton // this event allows an element to be focusable on click event on IE
|
|
57
61
|
, _extends({
|
|
58
|
-
|
|
59
|
-
"data-element": "back"
|
|
62
|
+
"aria-label": l.heading.backLinkAriaLabel(),
|
|
63
|
+
"data-element": "back",
|
|
64
|
+
onMouseDown: e => e.currentTarget.focus()
|
|
60
65
|
}, backButtonProps), /*#__PURE__*/_react.default.createElement(_heading.StyledHeadingIcon, {
|
|
61
66
|
type: "chevron_left",
|
|
62
67
|
divider: divider
|
|
@@ -83,6 +83,7 @@ const Help = ({
|
|
|
83
83
|
|
|
84
84
|
return /*#__PURE__*/_react.default.createElement(_help.default, _extends({
|
|
85
85
|
"aria-describedby": isFocused || isTooltipVisible ? tooltipId || defaultTooltipId.current : undefined,
|
|
86
|
+
"aria-label": helpAriaLabel || ariaLabel,
|
|
86
87
|
className: className,
|
|
87
88
|
as: tagType,
|
|
88
89
|
href: href,
|
|
@@ -101,8 +102,7 @@ const Help = ({
|
|
|
101
102
|
target: "_blank",
|
|
102
103
|
rel: "noopener noreferrer"
|
|
103
104
|
} : {
|
|
104
|
-
role: "button"
|
|
105
|
-
"aria-label": helpAriaLabel || ariaLabel
|
|
105
|
+
role: "button"
|
|
106
106
|
}, (0, _utils.filterStyledSystemMarginProps)(rest), rest), /*#__PURE__*/_react.default.createElement(_icon.default, {
|
|
107
107
|
"aria-hidden": true,
|
|
108
108
|
type: type,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from "./modal";
|
|
1
|
+
export { default, ModalContext } from "./modal.component";
|
|
@@ -9,7 +9,15 @@ Object.defineProperty(exports, "default", {
|
|
|
9
9
|
return _modal.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
+
Object.defineProperty(exports, "ModalContext", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _modal.ModalContext;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
var _modal = _interopRequireWildcard(require("./modal.component"));
|
|
12
20
|
|
|
13
|
-
|
|
21
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
14
22
|
|
|
15
|
-
function
|
|
23
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export const ModalContext: React.Context<{}>;
|
|
2
|
+
export default Modal;
|
|
3
|
+
import React from "react";
|
|
4
|
+
declare function Modal({ children, open, onCancel, disableEscKey, disableClose, enableBackgroundUI, timeout, ...rest }: {
|
|
5
|
+
[x: string]: any;
|
|
6
|
+
children: any;
|
|
7
|
+
open: any;
|
|
8
|
+
onCancel: any;
|
|
9
|
+
disableEscKey: any;
|
|
10
|
+
disableClose: any;
|
|
11
|
+
enableBackgroundUI: any;
|
|
12
|
+
timeout: any;
|
|
13
|
+
}): JSX.Element;
|
|
14
|
+
declare namespace Modal {
|
|
15
|
+
namespace propTypes {
|
|
16
|
+
const children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
17
|
+
const onCancel: PropTypes.Requireable<(...args: any[]) => any>;
|
|
18
|
+
const open: PropTypes.Validator<boolean>;
|
|
19
|
+
const enableBackgroundUI: PropTypes.Requireable<boolean>;
|
|
20
|
+
const disableEscKey: PropTypes.Requireable<boolean>;
|
|
21
|
+
const disableClose: PropTypes.Requireable<boolean>;
|
|
22
|
+
const timeout: PropTypes.Requireable<number>;
|
|
23
|
+
}
|
|
24
|
+
namespace defaultProps {
|
|
25
|
+
const onCancel_1: null;
|
|
26
|
+
export { onCancel_1 as onCancel };
|
|
27
|
+
const enableBackgroundUI_1: boolean;
|
|
28
|
+
export { enableBackgroundUI_1 as enableBackgroundUI };
|
|
29
|
+
const disableEscKey_1: boolean;
|
|
30
|
+
export { disableEscKey_1 as disableEscKey };
|
|
31
|
+
const timeout_1: number;
|
|
32
|
+
export { timeout_1 as timeout };
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
import PropTypes from "prop-types";
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
|
|
3
|
+
export interface ModalContextProps {
|
|
4
|
+
value?: {
|
|
5
|
+
isInModal?: boolean;
|
|
6
|
+
isAnimationComplete?: boolean;
|
|
7
|
+
triggerRefocusFlag?: boolean;
|
|
8
|
+
};
|
|
9
|
+
ref?: React.MutableRefObject<React.ReactNode>;
|
|
10
|
+
}
|
|
11
|
+
|
|
3
12
|
export interface ModalProps {
|
|
4
13
|
/** Modal content */
|
|
5
14
|
children?: React.ReactNode;
|
|
@@ -19,6 +28,8 @@ export interface ModalProps {
|
|
|
19
28
|
timeout?: number;
|
|
20
29
|
}
|
|
21
30
|
|
|
31
|
+
declare const ModelContext: React.Context<ModalContextProps>;
|
|
22
32
|
declare function Modal(props: ModalProps): JSX.Element;
|
|
23
33
|
|
|
34
|
+
export { ModalContext };
|
|
24
35
|
export default Modal;
|
package/lib/locales/en-gb.js
CHANGED
package/lib/locales/locale.d.ts
CHANGED
package/lib/locales/pl-pl.js
CHANGED