carbon-react 153.0.1 → 153.0.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/components/dialog/dialog.component.js +6 -0
- package/esm/components/dialog-full-screen/dialog-full-screen.component.d.ts +3 -1
- package/esm/components/dialog-full-screen/dialog-full-screen.component.js +11 -0
- package/esm/components/modal/modal.component.d.ts +1 -1
- package/lib/components/dialog/dialog.component.js +6 -0
- package/lib/components/dialog-full-screen/dialog-full-screen.component.d.ts +3 -1
- package/lib/components/dialog-full-screen/dialog-full-screen.component.js +11 -0
- package/lib/components/modal/modal.component.d.ts +1 -1
- package/package.json +2 -1
|
@@ -10,7 +10,9 @@ import IconButton from "../icon-button";
|
|
|
10
10
|
import Icon from "../icon";
|
|
11
11
|
import useLocale from "../../hooks/__internal__/useLocale";
|
|
12
12
|
import useModalAria from "../../hooks/__internal__/useModalAria/useModalAria";
|
|
13
|
+
import Logger from "../../__internal__/utils/logger";
|
|
13
14
|
const PADDING_VALUES = [0, 1, 2, 3, 4, 5, 6, 7, 8];
|
|
15
|
+
let deprecatedTimeoutTrigger = false;
|
|
14
16
|
export const Dialog = /*#__PURE__*/forwardRef(({
|
|
15
17
|
className,
|
|
16
18
|
"data-component": dataComponent = "dialog",
|
|
@@ -54,6 +56,10 @@ export const Dialog = /*#__PURE__*/forwardRef(({
|
|
|
54
56
|
current: subtitleId
|
|
55
57
|
} = useRef(createGuid());
|
|
56
58
|
const isTopModal = useModalAria(containerRef);
|
|
59
|
+
if (!deprecatedTimeoutTrigger && rest?.timeout) {
|
|
60
|
+
deprecatedTimeoutTrigger = true;
|
|
61
|
+
Logger.deprecate("The timeout prop in Dialog is deprecated and will soon be removed.");
|
|
62
|
+
}
|
|
57
63
|
useImperativeHandle(ref, () => ({
|
|
58
64
|
focus() {
|
|
59
65
|
containerRef.current?.focus();
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { ModalProps } from "../modal";
|
|
3
3
|
import { CustomRefObject } from "../../__internal__/focus-trap";
|
|
4
4
|
import { TagProps } from "../../__internal__/utils/helpers/tags";
|
|
5
|
-
export interface DialogFullScreenProps extends ModalProps {
|
|
5
|
+
export interface DialogFullScreenProps extends Omit<ModalProps, "disableClose"> {
|
|
6
6
|
/** Prop to specify the aria-describedby property of the DialogFullscreen component */
|
|
7
7
|
"aria-describedby"?: string;
|
|
8
8
|
/**
|
|
@@ -54,6 +54,8 @@ export interface DialogFullScreenProps extends ModalProps {
|
|
|
54
54
|
focusableSelectors?: string;
|
|
55
55
|
/** A custom close event handler */
|
|
56
56
|
onCancel?: (ev: React.KeyboardEvent<HTMLElement> | KeyboardEvent | React.MouseEvent<HTMLButtonElement>) => void;
|
|
57
|
+
/** @deprecated Determines if the Dialog can be closed */
|
|
58
|
+
disableClose?: boolean;
|
|
57
59
|
}
|
|
58
60
|
export declare const DialogFullScreen: ({ "aria-describedby": ariaDescribedBy, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, disableAutoFocus, focusFirstElement, bespokeFocusTrap, open, children, title, subtitle, pagesStyling, headerChildren, showCloseIcon, disableContentPadding, disableEscKey, onCancel, contentRef, help, role, focusableContainers, focusableSelectors, topModalOverride, closeButtonDataProps, restoreFocusOnClose, ...rest }: DialogFullScreenProps) => React.JSX.Element;
|
|
59
61
|
export default DialogFullScreen;
|
|
@@ -12,6 +12,9 @@ import Icon from "../icon";
|
|
|
12
12
|
import useLocale from "../../hooks/__internal__/useLocale";
|
|
13
13
|
import useModalAria from "../../hooks/__internal__/useModalAria/useModalAria";
|
|
14
14
|
import tagComponent from "../../__internal__/utils/helpers/tags";
|
|
15
|
+
import Logger from "../../__internal__/utils/logger";
|
|
16
|
+
let deprecatedDisableCloseTrigger = false;
|
|
17
|
+
let deprecatedTimeoutTrigger = false;
|
|
15
18
|
export const DialogFullScreen = ({
|
|
16
19
|
"aria-describedby": ariaDescribedBy,
|
|
17
20
|
"aria-label": ariaLabel,
|
|
@@ -49,6 +52,14 @@ export const DialogFullScreen = ({
|
|
|
49
52
|
current: subtitleId
|
|
50
53
|
} = useRef(createGuid());
|
|
51
54
|
const isTopModal = useModalAria(dialogRef);
|
|
55
|
+
if (!deprecatedDisableCloseTrigger && rest?.disableClose) {
|
|
56
|
+
deprecatedDisableCloseTrigger = true;
|
|
57
|
+
Logger.deprecate("The disableClose prop in DialogFullScreen is deprecated and will soon be removed.");
|
|
58
|
+
}
|
|
59
|
+
if (!deprecatedTimeoutTrigger && rest?.timeout) {
|
|
60
|
+
deprecatedTimeoutTrigger = true;
|
|
61
|
+
Logger.deprecate("The timeout prop in DialogFullScreen is deprecated and will soon be removed.");
|
|
62
|
+
}
|
|
52
63
|
const closeIcon = () => {
|
|
53
64
|
if (!showCloseIcon || !onCancel) return null;
|
|
54
65
|
return /*#__PURE__*/React.createElement(IconButton, _extends({
|
|
@@ -21,7 +21,7 @@ export interface ModalProps extends TagProps {
|
|
|
21
21
|
onCancel?: (ev: React.KeyboardEvent<HTMLElement> | KeyboardEvent) => void;
|
|
22
22
|
/** Sets the open state of the modal */
|
|
23
23
|
open: boolean;
|
|
24
|
-
/** Transition time */
|
|
24
|
+
/** @deprecated Transition time */
|
|
25
25
|
timeout?: number;
|
|
26
26
|
/** Manually override the internal modal stacking order to set this as top */
|
|
27
27
|
topModalOverride?: boolean;
|
|
@@ -15,11 +15,13 @@ var _iconButton = _interopRequireDefault(require("../icon-button"));
|
|
|
15
15
|
var _icon = _interopRequireDefault(require("../icon"));
|
|
16
16
|
var _useLocale = _interopRequireDefault(require("../../hooks/__internal__/useLocale"));
|
|
17
17
|
var _useModalAria = _interopRequireDefault(require("../../hooks/__internal__/useModalAria/useModalAria"));
|
|
18
|
+
var _logger = _interopRequireDefault(require("../../__internal__/utils/logger"));
|
|
18
19
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
20
|
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); }
|
|
20
21
|
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; }
|
|
21
22
|
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); }
|
|
22
23
|
const PADDING_VALUES = [0, 1, 2, 3, 4, 5, 6, 7, 8];
|
|
24
|
+
let deprecatedTimeoutTrigger = false;
|
|
23
25
|
const Dialog = exports.Dialog = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
24
26
|
className,
|
|
25
27
|
"data-component": dataComponent = "dialog",
|
|
@@ -63,6 +65,10 @@ const Dialog = exports.Dialog = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
63
65
|
current: subtitleId
|
|
64
66
|
} = (0, _react.useRef)((0, _guid.default)());
|
|
65
67
|
const isTopModal = (0, _useModalAria.default)(containerRef);
|
|
68
|
+
if (!deprecatedTimeoutTrigger && rest?.timeout) {
|
|
69
|
+
deprecatedTimeoutTrigger = true;
|
|
70
|
+
_logger.default.deprecate("The timeout prop in Dialog is deprecated and will soon be removed.");
|
|
71
|
+
}
|
|
66
72
|
(0, _react.useImperativeHandle)(ref, () => ({
|
|
67
73
|
focus() {
|
|
68
74
|
containerRef.current?.focus();
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { ModalProps } from "../modal";
|
|
3
3
|
import { CustomRefObject } from "../../__internal__/focus-trap";
|
|
4
4
|
import { TagProps } from "../../__internal__/utils/helpers/tags";
|
|
5
|
-
export interface DialogFullScreenProps extends ModalProps {
|
|
5
|
+
export interface DialogFullScreenProps extends Omit<ModalProps, "disableClose"> {
|
|
6
6
|
/** Prop to specify the aria-describedby property of the DialogFullscreen component */
|
|
7
7
|
"aria-describedby"?: string;
|
|
8
8
|
/**
|
|
@@ -54,6 +54,8 @@ export interface DialogFullScreenProps extends ModalProps {
|
|
|
54
54
|
focusableSelectors?: string;
|
|
55
55
|
/** A custom close event handler */
|
|
56
56
|
onCancel?: (ev: React.KeyboardEvent<HTMLElement> | KeyboardEvent | React.MouseEvent<HTMLButtonElement>) => void;
|
|
57
|
+
/** @deprecated Determines if the Dialog can be closed */
|
|
58
|
+
disableClose?: boolean;
|
|
57
59
|
}
|
|
58
60
|
export declare const DialogFullScreen: ({ "aria-describedby": ariaDescribedBy, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, disableAutoFocus, focusFirstElement, bespokeFocusTrap, open, children, title, subtitle, pagesStyling, headerChildren, showCloseIcon, disableContentPadding, disableEscKey, onCancel, contentRef, help, role, focusableContainers, focusableSelectors, topModalOverride, closeButtonDataProps, restoreFocusOnClose, ...rest }: DialogFullScreenProps) => React.JSX.Element;
|
|
59
61
|
export default DialogFullScreen;
|
|
@@ -17,10 +17,13 @@ var _icon = _interopRequireDefault(require("../icon"));
|
|
|
17
17
|
var _useLocale = _interopRequireDefault(require("../../hooks/__internal__/useLocale"));
|
|
18
18
|
var _useModalAria = _interopRequireDefault(require("../../hooks/__internal__/useModalAria/useModalAria"));
|
|
19
19
|
var _tags = _interopRequireDefault(require("../../__internal__/utils/helpers/tags"));
|
|
20
|
+
var _logger = _interopRequireDefault(require("../../__internal__/utils/logger"));
|
|
20
21
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
21
22
|
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); }
|
|
22
23
|
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; }
|
|
23
24
|
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); }
|
|
25
|
+
let deprecatedDisableCloseTrigger = false;
|
|
26
|
+
let deprecatedTimeoutTrigger = false;
|
|
24
27
|
const DialogFullScreen = ({
|
|
25
28
|
"aria-describedby": ariaDescribedBy,
|
|
26
29
|
"aria-label": ariaLabel,
|
|
@@ -58,6 +61,14 @@ const DialogFullScreen = ({
|
|
|
58
61
|
current: subtitleId
|
|
59
62
|
} = (0, _react.useRef)((0, _guid.default)());
|
|
60
63
|
const isTopModal = (0, _useModalAria.default)(dialogRef);
|
|
64
|
+
if (!deprecatedDisableCloseTrigger && rest?.disableClose) {
|
|
65
|
+
deprecatedDisableCloseTrigger = true;
|
|
66
|
+
_logger.default.deprecate("The disableClose prop in DialogFullScreen is deprecated and will soon be removed.");
|
|
67
|
+
}
|
|
68
|
+
if (!deprecatedTimeoutTrigger && rest?.timeout) {
|
|
69
|
+
deprecatedTimeoutTrigger = true;
|
|
70
|
+
_logger.default.deprecate("The timeout prop in DialogFullScreen is deprecated and will soon be removed.");
|
|
71
|
+
}
|
|
61
72
|
const closeIcon = () => {
|
|
62
73
|
if (!showCloseIcon || !onCancel) return null;
|
|
63
74
|
return /*#__PURE__*/_react.default.createElement(_iconButton.default, _extends({
|
|
@@ -21,7 +21,7 @@ export interface ModalProps extends TagProps {
|
|
|
21
21
|
onCancel?: (ev: React.KeyboardEvent<HTMLElement> | KeyboardEvent) => void;
|
|
22
22
|
/** Sets the open state of the modal */
|
|
23
23
|
open: boolean;
|
|
24
|
-
/** Transition time */
|
|
24
|
+
/** @deprecated Transition time */
|
|
25
25
|
timeout?: number;
|
|
26
26
|
/** Manually override the internal modal stacking order to set this as top */
|
|
27
27
|
topModalOverride?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "carbon-react",
|
|
3
|
-
"version": "153.0.
|
|
3
|
+
"version": "153.0.2",
|
|
4
4
|
"description": "A library of reusable React components for easily building user interfaces.",
|
|
5
5
|
"files": [
|
|
6
6
|
"lib",
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
],
|
|
9
9
|
"scripts": {
|
|
10
10
|
"start": "node ./scripts/check_node_version.mjs && dotenvx run -- storybook dev -p 9001 -c .storybook",
|
|
11
|
+
"start:strict-mode": "node ./scripts/check_node_version.mjs && dotenvx run --env ENABLE_REACT_STRICT_MODE=true -- storybook dev -p 9001 -c .storybook",
|
|
11
12
|
"test": "jest --config=./jest.config.ts",
|
|
12
13
|
"test-update": "jest --config=./jest.config.ts --updateSnapshot",
|
|
13
14
|
"format": "prettier --write './{src,playwright}/**/*.{js,jsx,ts,tsx}'",
|