carbon-react 107.1.8 → 107.2.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.
@@ -221,9 +221,6 @@ Input.propTypes = {
221
221
  "contentEditable": PropTypes.oneOfType([PropTypes.oneOf(["false", "inherit", "true"]), PropTypes.bool]),
222
222
  "contextMenu": PropTypes.string,
223
223
  "crossOrigin": PropTypes.string,
224
- "css": PropTypes.oneOfType([PropTypes.func, PropTypes.number, PropTypes.object, PropTypes.shape({
225
- "__emotion_styles": PropTypes.any.isRequired
226
- }), PropTypes.string, PropTypes.bool]),
227
224
  "dangerouslySetInnerHTML": PropTypes.shape({
228
225
  "__html": PropTypes.string.isRequired
229
226
  }),
@@ -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
- className: stickyFooter ? "sticky" : ""
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
  `}
@@ -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;
@@ -0,0 +1,2 @@
1
+ export const StyledModal: import("styled-components").StyledComponent<"div", any, {}, never>;
2
+ export const StyledModalBackground: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -283,9 +283,6 @@ MultiActionButton.propTypes = {
283
283
  "color": PropTypes.string,
284
284
  "contentEditable": PropTypes.oneOfType([PropTypes.oneOf(["false", "inherit", "true"]), PropTypes.bool]),
285
285
  "contextMenu": PropTypes.string,
286
- "css": PropTypes.oneOfType([PropTypes.func, PropTypes.number, PropTypes.object, PropTypes.shape({
287
- "__emotion_styles": PropTypes.any.isRequired
288
- }), PropTypes.string, PropTypes.bool]),
289
286
  "dangerouslySetInnerHTML": PropTypes.shape({
290
287
  "__html": PropTypes.string.isRequired
291
288
  }),
@@ -238,9 +238,6 @@ Input.propTypes = {
238
238
  "contentEditable": _propTypes.default.oneOfType([_propTypes.default.oneOf(["false", "inherit", "true"]), _propTypes.default.bool]),
239
239
  "contextMenu": _propTypes.default.string,
240
240
  "crossOrigin": _propTypes.default.string,
241
- "css": _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
242
- "__emotion_styles": _propTypes.default.any.isRequired
243
- }), _propTypes.default.string, _propTypes.default.bool]),
244
241
  "dangerouslySetInnerHTML": _propTypes.default.shape({
245
242
  "__html": _propTypes.default.string.isRequired
246
243
  }),
@@ -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
- className: stickyFooter ? "sticky" : ""
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
  `}
@@ -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
- var _modal = _interopRequireDefault(require("./modal.component"));
21
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
14
22
 
15
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
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;
@@ -0,0 +1,2 @@
1
+ export const StyledModal: import("styled-components").StyledComponent<"div", any, {}, never>;
2
+ export const StyledModalBackground: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -304,9 +304,6 @@ MultiActionButton.propTypes = {
304
304
  "color": _propTypes.default.string,
305
305
  "contentEditable": _propTypes.default.oneOfType([_propTypes.default.oneOf(["false", "inherit", "true"]), _propTypes.default.bool]),
306
306
  "contextMenu": _propTypes.default.string,
307
- "css": _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
308
- "__emotion_styles": _propTypes.default.any.isRequired
309
- }), _propTypes.default.string, _propTypes.default.bool]),
310
307
  "dangerouslySetInnerHTML": _propTypes.default.shape({
311
308
  "__html": _propTypes.default.string.isRequired
312
309
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "107.1.8",
3
+ "version": "107.2.0",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "engineStrict": true,
6
6
  "engines": {
@@ -78,14 +78,14 @@
78
78
  "@storybook/addon-a11y": "^6.4.18",
79
79
  "@storybook/addon-actions": "^6.4.18",
80
80
  "@storybook/addon-controls": "^6.4.18",
81
- "@storybook/addon-docs": "^6.4.18",
81
+ "@storybook/addon-docs": "^6.5.8",
82
82
  "@storybook/addon-google-analytics": "^6.2.9",
83
83
  "@storybook/addon-links": "^6.4.18",
84
84
  "@storybook/addon-toolbars": "^6.4.18",
85
85
  "@storybook/addon-viewport": "^6.4.18",
86
86
  "@storybook/addons": "^6.4.18",
87
87
  "@storybook/components": "^6.4.18",
88
- "@storybook/react": "^6.4.18",
88
+ "@storybook/react": "^6.5.8",
89
89
  "@storybook/theming": "^6.4.18",
90
90
  "@testing-library/jest-dom": "^5.16.2",
91
91
  "@testing-library/react": "^12.1.3",