carbon-react 106.6.10 → 107.1.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__/click-away-wrapper/click-away-wrapper.component.d.ts +12 -0
- package/esm/__internal__/click-away-wrapper/click-away-wrapper.component.js +43 -0
- package/esm/__internal__/click-away-wrapper/index.d.ts +2 -0
- package/esm/__internal__/click-away-wrapper/index.js +1 -0
- package/esm/__internal__/focus-trap/focus-trap-utils.js +25 -1
- package/esm/__internal__/focus-trap/focus-trap.component.d.ts +3 -1
- package/esm/__internal__/focus-trap/focus-trap.component.js +44 -12
- package/esm/{components/radio-button → __internal__/radio-button-mapper}/radio-button-mapper.component.d.ts +0 -0
- package/esm/{components/radio-button → __internal__/radio-button-mapper}/radio-button-mapper.component.js +0 -0
- package/esm/components/advanced-color-picker/advanced-color-picker.component.js +5 -5
- package/esm/components/badge/badge.style.d.ts +1 -1
- package/esm/components/button/button.component.d.ts +1 -3
- package/esm/components/button/button.component.js +1 -12
- package/esm/components/button/button.style.d.ts +1 -1
- package/esm/components/button-toggle-group/button-toggle-group.component.js +1 -1
- package/esm/components/confirm/confirm.component.d.ts +1 -5
- package/esm/components/confirm/confirm.component.js +2 -14
- package/esm/components/confirm/confirm.d.ts +0 -2
- package/esm/components/date/date.component.js +19 -20
- package/esm/components/dialog/dialog.component.js +4 -3
- package/esm/components/dialog-full-screen/content.style.js +4 -10
- package/esm/components/dialog-full-screen/dialog-full-screen.component.js +4 -3
- package/esm/components/heading/heading.component.d.ts +27 -52
- package/esm/components/heading/heading.component.js +86 -170
- package/esm/components/heading/heading.d.ts +5 -3
- package/esm/components/i18n-provider/i18n-provider.component.d.ts +0 -9
- package/esm/components/i18n-provider/i18n-provider.component.js +0 -9
- package/esm/components/menu/__internal__/submenu/submenu.component.js +11 -17
- package/esm/components/menu/index.d.ts +0 -1
- package/esm/components/menu/index.js +0 -1
- package/esm/components/menu/menu-full-screen/menu-full-screen.component.js +4 -18
- package/esm/components/menu/menu-full-screen/menu-full-screen.style.js +1 -0
- package/esm/components/menu/menu-item/menu-item.component.js +0 -6
- package/esm/components/multi-action-button/multi-action-button.component.d.ts +1 -1
- package/esm/components/multi-action-button/multi-action-button.component.js +1 -11
- package/esm/components/navigation-bar/navigation-bar.component.d.ts +1 -6
- package/esm/components/navigation-bar/navigation-bar.component.js +1 -15
- package/esm/components/navigation-bar/navigation-bar.style.d.ts +0 -4
- package/esm/components/navigation-bar/navigation-bar.style.js +0 -8
- package/esm/components/popover-container/popover-container.component.js +16 -3
- package/esm/components/radio-button/radio-button-group.component.js +1 -1
- package/esm/components/select/select-list/select-list.component.js +2 -2
- package/esm/components/sidebar/__internal__/sidebar-header/sidebar-header.component.d.ts +3 -1
- package/esm/components/sidebar/__internal__/sidebar-header/sidebar-header.component.js +7 -2
- package/esm/components/sidebar/sidebar.component.js +10 -3
- package/esm/components/simple-color-picker/simple-color-picker.component.js +1 -1
- package/esm/components/split-button/split-button-toggle.style.d.ts +1 -1
- package/esm/components/split-button/split-button.component.d.ts +1 -4
- package/esm/components/split-button/split-button.component.js +3 -16
- package/esm/components/split-button/split-button.d.ts +0 -2
- package/esm/components/tile/tile.component.d.ts +1 -2
- package/esm/components/tile/tile.component.js +1 -13
- package/esm/components/tile/tile.d.ts +0 -2
- package/esm/components/tile-select/tile-select-group.component.js +1 -1
- package/esm/components/toast/toast.component.d.ts +1 -4
- package/esm/components/toast/toast.component.js +1 -13
- package/esm/components/toast/toast.d.ts +0 -2
- package/esm/locales/en-gb.js +0 -9
- package/esm/locales/locale.d.ts +0 -9
- package/esm/locales/pl-pl.js +0 -9
- package/lib/__internal__/click-away-wrapper/click-away-wrapper.component.d.ts +12 -0
- package/lib/__internal__/click-away-wrapper/click-away-wrapper.component.js +59 -0
- package/lib/__internal__/click-away-wrapper/index.d.ts +2 -0
- package/lib/{components/menu/submenu-block → __internal__/click-away-wrapper}/index.js +2 -2
- package/lib/{components/scrollable-list → __internal__/click-away-wrapper}/package.json +1 -1
- package/lib/__internal__/focus-trap/focus-trap-utils.js +25 -1
- package/lib/__internal__/focus-trap/focus-trap.component.d.ts +3 -1
- package/lib/__internal__/focus-trap/focus-trap.component.js +46 -12
- package/lib/{components/radio-button → __internal__/radio-button-mapper}/radio-button-mapper.component.d.ts +0 -0
- package/lib/{components/radio-button → __internal__/radio-button-mapper}/radio-button-mapper.component.js +0 -0
- package/lib/components/advanced-color-picker/advanced-color-picker.component.js +5 -5
- package/lib/components/badge/badge.style.d.ts +1 -1
- package/lib/components/button/button.component.d.ts +1 -3
- package/lib/components/button/button.component.js +1 -14
- package/lib/components/button/button.style.d.ts +1 -1
- package/lib/components/button-toggle-group/button-toggle-group.component.js +1 -1
- package/lib/components/confirm/confirm.component.d.ts +1 -5
- package/lib/components/confirm/confirm.component.js +2 -17
- package/lib/components/confirm/confirm.d.ts +0 -2
- package/lib/components/date/date.component.js +20 -20
- package/lib/components/dialog/dialog.component.js +4 -3
- package/lib/components/dialog-full-screen/content.style.js +4 -10
- package/lib/components/dialog-full-screen/dialog-full-screen.component.js +4 -3
- package/lib/components/heading/heading.component.d.ts +27 -52
- package/lib/components/heading/heading.component.js +86 -170
- package/lib/components/heading/heading.d.ts +5 -3
- package/lib/components/i18n-provider/i18n-provider.component.d.ts +0 -9
- package/lib/components/i18n-provider/i18n-provider.component.js +0 -9
- package/lib/components/menu/__internal__/submenu/submenu.component.js +12 -17
- package/lib/components/menu/index.d.ts +0 -1
- package/lib/components/menu/index.js +0 -8
- package/lib/components/menu/menu-full-screen/menu-full-screen.component.js +3 -17
- package/lib/components/menu/menu-full-screen/menu-full-screen.style.js +1 -0
- package/lib/components/menu/menu-item/menu-item.component.js +0 -7
- package/lib/components/multi-action-button/multi-action-button.component.d.ts +1 -1
- package/lib/components/multi-action-button/multi-action-button.component.js +1 -14
- package/lib/components/navigation-bar/navigation-bar.component.d.ts +1 -6
- package/lib/components/navigation-bar/navigation-bar.component.js +1 -18
- package/lib/components/navigation-bar/navigation-bar.style.d.ts +0 -4
- package/lib/components/navigation-bar/navigation-bar.style.js +0 -8
- package/lib/components/popover-container/popover-container.component.js +17 -3
- package/lib/components/radio-button/radio-button-group.component.js +1 -1
- package/lib/components/select/select-list/select-list.component.js +2 -2
- package/lib/components/sidebar/__internal__/sidebar-header/sidebar-header.component.d.ts +3 -1
- package/lib/components/sidebar/__internal__/sidebar-header/sidebar-header.component.js +7 -2
- package/lib/components/sidebar/sidebar.component.js +11 -3
- package/lib/components/simple-color-picker/simple-color-picker.component.js +1 -1
- package/lib/components/split-button/split-button-toggle.style.d.ts +1 -1
- package/lib/components/split-button/split-button.component.d.ts +1 -4
- package/lib/components/split-button/split-button.component.js +3 -18
- package/lib/components/split-button/split-button.d.ts +0 -2
- package/lib/components/tile/tile.component.d.ts +1 -2
- package/lib/components/tile/tile.component.js +1 -16
- package/lib/components/tile/tile.d.ts +0 -2
- package/lib/components/tile-select/tile-select-group.component.js +1 -1
- package/lib/components/toast/toast.component.d.ts +1 -4
- package/lib/components/toast/toast.component.js +1 -16
- package/lib/components/toast/toast.d.ts +0 -2
- package/lib/locales/en-gb.js +0 -9
- package/lib/locales/locale.d.ts +0 -9
- package/lib/locales/pl-pl.js +0 -9
- package/package.json +1 -1
- package/esm/components/app-wrapper/app-wrapper.component.d.ts +0 -25
- package/esm/components/app-wrapper/app-wrapper.component.js +0 -104
- package/esm/components/app-wrapper/app-wrapper.d.ts +0 -12
- package/esm/components/app-wrapper/app-wrapper.style.d.ts +0 -2
- package/esm/components/app-wrapper/app-wrapper.style.js +0 -17
- package/esm/components/app-wrapper/index.d.ts +0 -1
- package/esm/components/app-wrapper/index.js +0 -1
- package/esm/components/menu/submenu-block/index.d.ts +0 -2
- package/esm/components/menu/submenu-block/index.js +0 -1
- package/esm/components/menu/submenu-block/submenu-block.component.d.ts +0 -12
- package/esm/components/menu/submenu-block/submenu-block.component.js +0 -34
- package/esm/components/menu/submenu-block/submenu-block.d.ts +0 -12
- package/esm/components/menu/submenu-block/submenu-block.style.d.ts +0 -2
- package/esm/components/menu/submenu-block/submenu-block.style.js +0 -16
- package/esm/components/mount-in-app/__spec__.d.ts +0 -1
- package/esm/components/mount-in-app/__spec__.js +0 -47
- package/esm/components/mount-in-app/index.d.ts +0 -1
- package/esm/components/mount-in-app/mount-in-app.d.ts +0 -12
- package/esm/components/mount-in-app/mount-in-app.js +0 -90
- package/esm/components/mount-in-app/package.json +0 -3
- package/esm/components/multi-step-wizard/__spec__.d.ts +0 -1
- package/esm/components/multi-step-wizard/__spec__.js +0 -191
- package/esm/components/multi-step-wizard/multi-step-wizard.d.ts +0 -109
- package/esm/components/multi-step-wizard/multi-step-wizard.js +0 -383
- package/esm/components/multi-step-wizard/multi-step-wizard.style.d.ts +0 -2
- package/esm/components/multi-step-wizard/multi-step-wizard.style.js +0 -10
- package/esm/components/multi-step-wizard/package.json +0 -4
- package/esm/components/multi-step-wizard/step/__spec__.d.ts +0 -1
- package/esm/components/multi-step-wizard/step/__spec__.js +0 -399
- package/esm/components/multi-step-wizard/step/package.json +0 -4
- package/esm/components/multi-step-wizard/step/step.d.ts +0 -166
- package/esm/components/multi-step-wizard/step/step.js +0 -407
- package/esm/components/multi-step-wizard/step/step.style.d.ts +0 -13
- package/esm/components/multi-step-wizard/step/step.style.js +0 -138
- package/esm/components/scrollable-list/as-scrollable-list-item.wrapper.d.ts +0 -2
- package/esm/components/scrollable-list/as-scrollable-list-item.wrapper.js +0 -10
- package/esm/components/scrollable-list/index.d.ts +0 -4
- package/esm/components/scrollable-list/index.js +0 -4
- package/esm/components/scrollable-list/scrollable-list-item.component.d.ts +0 -2
- package/esm/components/scrollable-list/scrollable-list-item.component.js +0 -26
- package/esm/components/scrollable-list/scrollable-list.component.d.ts +0 -52
- package/esm/components/scrollable-list/scrollable-list.component.js +0 -306
- package/esm/components/scrollable-list/scrollable-list.context.d.ts +0 -3
- package/esm/components/scrollable-list/scrollable-list.context.js +0 -2
- package/esm/components/scrollable-list/scrollable-list.style.d.ts +0 -2
- package/esm/components/scrollable-list/scrollable-list.style.js +0 -30
- package/esm/components/scrollable-list/test-utils.d.ts +0 -2
- package/esm/components/scrollable-list/test-utils.js +0 -25
- package/lib/components/app-wrapper/app-wrapper.component.d.ts +0 -25
- package/lib/components/app-wrapper/app-wrapper.component.js +0 -120
- package/lib/components/app-wrapper/app-wrapper.d.ts +0 -12
- package/lib/components/app-wrapper/app-wrapper.style.d.ts +0 -2
- package/lib/components/app-wrapper/app-wrapper.style.js +0 -28
- package/lib/components/app-wrapper/index.d.ts +0 -1
- package/lib/components/app-wrapper/index.js +0 -15
- package/lib/components/app-wrapper/package.json +0 -6
- package/lib/components/menu/submenu-block/index.d.ts +0 -2
- package/lib/components/menu/submenu-block/package.json +0 -6
- package/lib/components/menu/submenu-block/submenu-block.component.d.ts +0 -12
- package/lib/components/menu/submenu-block/submenu-block.component.js +0 -53
- package/lib/components/menu/submenu-block/submenu-block.d.ts +0 -12
- package/lib/components/menu/submenu-block/submenu-block.style.d.ts +0 -2
- package/lib/components/menu/submenu-block/submenu-block.style.js +0 -33
- package/lib/components/mount-in-app/__spec__.d.ts +0 -1
- package/lib/components/mount-in-app/__spec__.js +0 -55
- package/lib/components/mount-in-app/index.d.ts +0 -1
- package/lib/components/mount-in-app/mount-in-app.d.ts +0 -12
- package/lib/components/mount-in-app/mount-in-app.js +0 -105
- package/lib/components/mount-in-app/package.json +0 -3
- package/lib/components/multi-step-wizard/__spec__.d.ts +0 -1
- package/lib/components/multi-step-wizard/__spec__.js +0 -202
- package/lib/components/multi-step-wizard/multi-step-wizard.d.ts +0 -109
- package/lib/components/multi-step-wizard/multi-step-wizard.js +0 -397
- package/lib/components/multi-step-wizard/multi-step-wizard.style.d.ts +0 -2
- package/lib/components/multi-step-wizard/multi-step-wizard.style.js +0 -21
- package/lib/components/multi-step-wizard/package.json +0 -4
- package/lib/components/multi-step-wizard/step/__spec__.d.ts +0 -1
- package/lib/components/multi-step-wizard/step/__spec__.js +0 -409
- package/lib/components/multi-step-wizard/step/package.json +0 -4
- package/lib/components/multi-step-wizard/step/step.d.ts +0 -166
- package/lib/components/multi-step-wizard/step/step.js +0 -421
- package/lib/components/multi-step-wizard/step/step.style.d.ts +0 -13
- package/lib/components/multi-step-wizard/step/step.style.js +0 -162
- package/lib/components/scrollable-list/as-scrollable-list-item.wrapper.d.ts +0 -2
- package/lib/components/scrollable-list/as-scrollable-list-item.wrapper.js +0 -21
- package/lib/components/scrollable-list/index.d.ts +0 -4
- package/lib/components/scrollable-list/index.js +0 -31
- package/lib/components/scrollable-list/scrollable-list-item.component.d.ts +0 -2
- package/lib/components/scrollable-list/scrollable-list-item.component.js +0 -42
- package/lib/components/scrollable-list/scrollable-list.component.d.ts +0 -52
- package/lib/components/scrollable-list/scrollable-list.component.js +0 -328
- package/lib/components/scrollable-list/scrollable-list.context.d.ts +0 -3
- package/lib/components/scrollable-list/scrollable-list.context.js +0 -14
- package/lib/components/scrollable-list/scrollable-list.style.d.ts +0 -2
- package/lib/components/scrollable-list/scrollable-list.style.js +0 -41
- package/lib/components/scrollable-list/test-utils.d.ts +0 -2
- package/lib/components/scrollable-list/test-utils.js +0 -37
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface ClickAwayWrapperProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
handleClickAway: (ev: CustomEvent) => void;
|
|
5
|
+
eventTypeId?: "mousedown" | "click";
|
|
6
|
+
targets: React.RefObject<HTMLElement>[];
|
|
7
|
+
}
|
|
8
|
+
declare const ClickAwayWrapper: {
|
|
9
|
+
({ children, handleClickAway, eventTypeId, targets, }: ClickAwayWrapperProps): JSX.Element;
|
|
10
|
+
displayName: string;
|
|
11
|
+
};
|
|
12
|
+
export default ClickAwayWrapper;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React, { useEffect } from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import Events from "../utils/helpers/events";
|
|
4
|
+
|
|
5
|
+
const ClickAwayWrapper = ({
|
|
6
|
+
children,
|
|
7
|
+
handleClickAway,
|
|
8
|
+
eventTypeId = "click",
|
|
9
|
+
targets
|
|
10
|
+
}) => {
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
const fnClickAway = ev => {
|
|
13
|
+
const clickedElements = targets.filter(ref => (ref === null || ref === void 0 ? void 0 : ref.current) && Events.composedPath(ev).includes(ref.current));
|
|
14
|
+
|
|
15
|
+
if (!clickedElements || !clickedElements.length) {
|
|
16
|
+
handleClickAway(ev);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
document.addEventListener(eventTypeId, fnClickAway);
|
|
21
|
+
return function cleanup() {
|
|
22
|
+
document.removeEventListener(eventTypeId, fnClickAway);
|
|
23
|
+
};
|
|
24
|
+
}, [handleClickAway, targets, eventTypeId]);
|
|
25
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
ClickAwayWrapper.propTypes = {
|
|
29
|
+
"children": PropTypes.node,
|
|
30
|
+
"eventTypeId": PropTypes.oneOf(["click", "mousedown"]),
|
|
31
|
+
"handleClickAway": PropTypes.func.isRequired,
|
|
32
|
+
"targets": PropTypes.arrayOf(PropTypes.shape({
|
|
33
|
+
"current": PropTypes.oneOfType([PropTypes.oneOf([null]), function (props, propName) {
|
|
34
|
+
if (props[propName] == null) {
|
|
35
|
+
return new Error("Prop '" + propName + "' is required but wasn't specified");
|
|
36
|
+
} else if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
|
|
37
|
+
return new Error("Expected prop '" + propName + "' to be of type Element");
|
|
38
|
+
}
|
|
39
|
+
}]).isRequired
|
|
40
|
+
})).isRequired
|
|
41
|
+
};
|
|
42
|
+
ClickAwayWrapper.displayName = "ClickAwayWrapper";
|
|
43
|
+
export default ClickAwayWrapper;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./click-away-wrapper.component";
|
|
@@ -1,11 +1,35 @@
|
|
|
1
1
|
const defaultFocusableSelectors = 'button:not([disabled]), [href], input:not([type="hidden"]):not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]';
|
|
2
2
|
|
|
3
|
+
const waitForVisibleAndFocus = element => {
|
|
4
|
+
const INTERVAL = 10;
|
|
5
|
+
const MAX_TIME = 100;
|
|
6
|
+
let timeSoFar = 0;
|
|
7
|
+
|
|
8
|
+
const stylesMatch = () => {
|
|
9
|
+
const actualStyles = window.getComputedStyle(element);
|
|
10
|
+
return actualStyles.visibility === "visible";
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const check = () => {
|
|
14
|
+
/* istanbul ignore else */
|
|
15
|
+
if (stylesMatch()) {
|
|
16
|
+
element.focus();
|
|
17
|
+
} else if (timeSoFar < MAX_TIME) {
|
|
18
|
+
setTimeout(check, INTERVAL);
|
|
19
|
+
timeSoFar += INTERVAL;
|
|
20
|
+
} // just "fail" silently if maxTime exceeded - callback will never be called
|
|
21
|
+
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
check();
|
|
25
|
+
};
|
|
26
|
+
|
|
3
27
|
function setElementFocus(element) {
|
|
4
28
|
if (typeof element === "function") {
|
|
5
29
|
element();
|
|
6
30
|
} else {
|
|
7
31
|
const el = element.current || element;
|
|
8
|
-
el
|
|
32
|
+
waitForVisibleAndFocus(el);
|
|
9
33
|
}
|
|
10
34
|
}
|
|
11
35
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
export default FocusTrap;
|
|
2
|
-
declare function FocusTrap({ children, autoFocus, focusFirstElement, bespokeTrap, wrapperRef, }: {
|
|
2
|
+
declare function FocusTrap({ children, autoFocus, focusFirstElement, bespokeTrap, wrapperRef, isOpen, }: {
|
|
3
3
|
children: any;
|
|
4
4
|
autoFocus?: boolean | undefined;
|
|
5
5
|
focusFirstElement: any;
|
|
6
6
|
bespokeTrap: any;
|
|
7
7
|
wrapperRef: any;
|
|
8
|
+
isOpen: any;
|
|
8
9
|
}): JSX.Element;
|
|
9
10
|
declare namespace FocusTrap {
|
|
10
11
|
namespace propTypes {
|
|
@@ -17,6 +18,7 @@ declare namespace FocusTrap {
|
|
|
17
18
|
const wrapperRef: PropTypes.Requireable<PropTypes.InferProps<{
|
|
18
19
|
current: PropTypes.Requireable<any>;
|
|
19
20
|
}>>;
|
|
21
|
+
const isOpen: PropTypes.Requireable<boolean>;
|
|
20
22
|
}
|
|
21
23
|
}
|
|
22
24
|
import PropTypes from "prop-types";
|
|
@@ -2,22 +2,23 @@ import React, { useCallback, useContext, useEffect, useLayoutEffect, useRef, use
|
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import { defaultFocusableSelectors, nextNonRadioElementIndex, isRadio, setElementFocus } from "./focus-trap-utils";
|
|
4
4
|
import { ModalContext } from "../../components/modal/modal.component";
|
|
5
|
+
import usePrevious from "../../hooks/__internal__/usePrevious";
|
|
5
6
|
|
|
6
7
|
const FocusTrap = ({
|
|
7
8
|
children,
|
|
8
9
|
autoFocus = true,
|
|
9
10
|
focusFirstElement,
|
|
10
11
|
bespokeTrap,
|
|
11
|
-
wrapperRef
|
|
12
|
+
wrapperRef,
|
|
13
|
+
isOpen
|
|
12
14
|
}) => {
|
|
13
15
|
const trapRef = useRef(null);
|
|
14
|
-
const firstOpen = useRef(true);
|
|
15
16
|
const [focusableElements, setFocusableElements] = useState();
|
|
16
17
|
const [firstElement, setFirstElement] = useState();
|
|
17
18
|
const [lastElement, setLastElement] = useState();
|
|
18
19
|
const [currentFocusedElement, setCurrentFocusedElement] = useState();
|
|
19
20
|
const {
|
|
20
|
-
isAnimationComplete,
|
|
21
|
+
isAnimationComplete = true,
|
|
21
22
|
triggerRefocusFlag
|
|
22
23
|
} = useContext(ModalContext);
|
|
23
24
|
const hasNewInputs = useCallback(candidate => {
|
|
@@ -53,12 +54,13 @@ const FocusTrap = ({
|
|
|
53
54
|
useLayoutEffect(() => {
|
|
54
55
|
updateFocusableElements();
|
|
55
56
|
}, [children, updateFocusableElements]);
|
|
57
|
+
const shouldSetFocus = autoFocus && isOpen && isAnimationComplete && (focusFirstElement || (wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current));
|
|
58
|
+
const prevShouldSetFocus = usePrevious(shouldSetFocus);
|
|
56
59
|
useEffect(() => {
|
|
57
|
-
if (
|
|
58
|
-
setElementFocus(focusFirstElement ||
|
|
59
|
-
firstOpen.current = false;
|
|
60
|
+
if (shouldSetFocus && !prevShouldSetFocus) {
|
|
61
|
+
setElementFocus(focusFirstElement || (wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current));
|
|
60
62
|
}
|
|
61
|
-
}, [
|
|
63
|
+
}, [shouldSetFocus, prevShouldSetFocus, focusFirstElement, wrapperRef]);
|
|
62
64
|
useEffect(() => {
|
|
63
65
|
const trapFn = ev => {
|
|
64
66
|
if (bespokeTrap) {
|
|
@@ -76,7 +78,7 @@ const FocusTrap = ({
|
|
|
76
78
|
ev.preventDefault();
|
|
77
79
|
} else if (ev.shiftKey) {
|
|
78
80
|
/* shift + tab */
|
|
79
|
-
if (activeElement === firstElement) {
|
|
81
|
+
if (activeElement === firstElement || activeElement === wrapperRef.current) {
|
|
80
82
|
lastElement.focus();
|
|
81
83
|
ev.preventDefault();
|
|
82
84
|
} // If current element is radio button -
|
|
@@ -99,7 +101,7 @@ const FocusTrap = ({
|
|
|
99
101
|
return function cleanup() {
|
|
100
102
|
document.removeEventListener("keydown", trapFn);
|
|
101
103
|
};
|
|
102
|
-
}, [firstElement, lastElement, focusableElements, bespokeTrap]);
|
|
104
|
+
}, [firstElement, lastElement, focusableElements, bespokeTrap, wrapperRef]);
|
|
103
105
|
const updateCurrentFocusedElement = useCallback(() => {
|
|
104
106
|
const element = focusableElements === null || focusableElements === void 0 ? void 0 : focusableElements.find(el => el === document.activeElement);
|
|
105
107
|
|
|
@@ -114,22 +116,49 @@ const FocusTrap = ({
|
|
|
114
116
|
};
|
|
115
117
|
}, [updateCurrentFocusedElement]);
|
|
116
118
|
const refocusTrap = useCallback(() => {
|
|
119
|
+
var _wrapperRef$current;
|
|
120
|
+
|
|
117
121
|
/* istanbul ignore else */
|
|
118
122
|
if (currentFocusedElement && !currentFocusedElement.hasAttribute("disabled")) {
|
|
119
123
|
// the trap breaks if it tries to refocus a disabled element
|
|
120
124
|
setElementFocus(currentFocusedElement);
|
|
125
|
+
} else if (wrapperRef !== null && wrapperRef !== void 0 && (_wrapperRef$current = wrapperRef.current) !== null && _wrapperRef$current !== void 0 && _wrapperRef$current.hasAttribute("tabindex")) {
|
|
126
|
+
setElementFocus(wrapperRef.current);
|
|
121
127
|
} else if (firstElement) {
|
|
122
128
|
setElementFocus(firstElement);
|
|
123
129
|
}
|
|
124
|
-
}, [currentFocusedElement, firstElement]);
|
|
130
|
+
}, [currentFocusedElement, firstElement, wrapperRef]);
|
|
125
131
|
useEffect(() => {
|
|
126
132
|
if (triggerRefocusFlag) {
|
|
127
133
|
refocusTrap();
|
|
128
134
|
}
|
|
129
135
|
}, [triggerRefocusFlag, refocusTrap]);
|
|
136
|
+
const [tabIndex, setTabIndex] = useState(0);
|
|
137
|
+
useEffect(() => {
|
|
138
|
+
// issue in cypress prevents setting tabIndex to -1, instead tabIndex is set to 0 and removed on blur.
|
|
139
|
+
if (!isOpen) {
|
|
140
|
+
setTabIndex(0);
|
|
141
|
+
}
|
|
142
|
+
}, [isOpen]);
|
|
143
|
+
|
|
144
|
+
const onBlur = () => {
|
|
145
|
+
/* istanbul ignore else */
|
|
146
|
+
if (isOpen) {
|
|
147
|
+
setTabIndex(undefined);
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
const focusProps = {
|
|
152
|
+
tabIndex,
|
|
153
|
+
onBlur
|
|
154
|
+
}; // passes focusProps if no tabindex has been explicitly set on the wrapper
|
|
155
|
+
|
|
156
|
+
const clonedChildren = React.Children.map(children, child => {
|
|
157
|
+
return child.props.tabIndex === undefined ? /*#__PURE__*/React.cloneElement(child, focusProps) : child;
|
|
158
|
+
});
|
|
130
159
|
return /*#__PURE__*/React.createElement("div", {
|
|
131
160
|
ref: trapRef
|
|
132
|
-
},
|
|
161
|
+
}, clonedChildren);
|
|
133
162
|
};
|
|
134
163
|
|
|
135
164
|
FocusTrap.propTypes = {
|
|
@@ -149,6 +178,9 @@ FocusTrap.propTypes = {
|
|
|
149
178
|
/** a ref to the container wrapping the focusable elements */
|
|
150
179
|
wrapperRef: PropTypes.shape({
|
|
151
180
|
current: PropTypes.any
|
|
152
|
-
})
|
|
181
|
+
}),
|
|
182
|
+
|
|
183
|
+
/* whether the modal (etc.) component that the focus trap is inside is open or not */
|
|
184
|
+
isOpen: PropTypes.bool
|
|
153
185
|
};
|
|
154
186
|
export default FocusTrap;
|
|
File without changes
|
|
File without changes
|
|
@@ -48,17 +48,17 @@ const AdvancedColorPicker = ({
|
|
|
48
48
|
setSelectedColorRef(selected.ref.current);
|
|
49
49
|
}
|
|
50
50
|
}, [colors, currentColor, dialogOpen, isOpen]);
|
|
51
|
-
const handleFocus = useCallback((e, firstFocusableElement
|
|
51
|
+
const handleFocus = useCallback((e, firstFocusableElement) => {
|
|
52
52
|
if (e.key === "Tab") {
|
|
53
53
|
/* istanbul ignore else */
|
|
54
54
|
if (e.shiftKey) {
|
|
55
55
|
/* istanbul ignore else */
|
|
56
|
-
if (document.activeElement ===
|
|
57
|
-
|
|
56
|
+
if (document.activeElement === firstFocusableElement) {
|
|
57
|
+
selectedColorRef.focus();
|
|
58
58
|
e.preventDefault();
|
|
59
59
|
}
|
|
60
|
-
} else if (document.activeElement ===
|
|
61
|
-
|
|
60
|
+
} else if (document.activeElement === selectedColorRef) {
|
|
61
|
+
firstFocusableElement.focus();
|
|
62
62
|
e.preventDefault();
|
|
63
63
|
}
|
|
64
64
|
}
|
|
@@ -3,7 +3,7 @@ import Icon from "../icon";
|
|
|
3
3
|
declare const StyledBadgeWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
4
|
declare const StyledCounter: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
5
5
|
declare const StyledButton: import("styled-components").StyledComponent<{
|
|
6
|
-
({ size, subtext,
|
|
6
|
+
({ size, subtext, children, forwardRef, "aria-label": ariaLabel, disabled, destructive, buttonType: buttonTypeProp, iconType, iconPosition, href, m, px, noWrap, target, rel, iconTooltipMessage, iconTooltipPosition, fullWidth, ...rest }: import("../button").ButtonProps): JSX.Element;
|
|
7
7
|
displayName: string;
|
|
8
8
|
}, any, {}, never>;
|
|
9
9
|
declare const StyledCrossIcon: import("styled-components").StyledComponent<typeof Icon, any, {}, never>;
|
|
@@ -10,8 +10,6 @@ export interface ButtonProps extends SpaceProps {
|
|
|
10
10
|
* This is required to comply with WCAG 4.1.2 - Buttons must have discernible text
|
|
11
11
|
*/
|
|
12
12
|
"aria-label"?: string;
|
|
13
|
-
/** [Legacy] Button types for legacy theme: "primary" | "secondary" */
|
|
14
|
-
as?: ButtonTypes;
|
|
15
13
|
/** Color variants for new business themes: "primary" | "secondary" | "tertiary" | "darkBackground" */
|
|
16
14
|
buttonType?: ButtonTypes;
|
|
17
15
|
/** The text the button displays */
|
|
@@ -60,7 +58,7 @@ export interface ButtonProps extends SpaceProps {
|
|
|
60
58
|
rel?: string;
|
|
61
59
|
}
|
|
62
60
|
declare const Button: {
|
|
63
|
-
({ size, subtext,
|
|
61
|
+
({ size, subtext, children, forwardRef, "aria-label": ariaLabel, disabled, destructive, buttonType: buttonTypeProp, iconType, iconPosition, href, m, px, noWrap, target, rel, iconTooltipMessage, iconTooltipPosition, fullWidth, ...rest }: ButtonProps): JSX.Element;
|
|
64
62
|
displayName: string;
|
|
65
63
|
};
|
|
66
64
|
declare const ButtonWithForwardRef: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -7,7 +7,6 @@ import Icon from "../icon";
|
|
|
7
7
|
import StyledButton, { StyledButtonSubtext } from "./button.style";
|
|
8
8
|
import tagComponent from "../../__internal__/utils/helpers/tags/tags";
|
|
9
9
|
import { TooltipProvider } from "../../__internal__/tooltip-provider";
|
|
10
|
-
import Logger from "../../__internal__/utils/logger";
|
|
11
10
|
|
|
12
11
|
function renderChildren({
|
|
13
12
|
/* eslint-disable react/prop-types */
|
|
@@ -74,12 +73,10 @@ renderChildren.propTypes = {
|
|
|
74
73
|
}
|
|
75
74
|
}
|
|
76
75
|
};
|
|
77
|
-
let deprecatedWarnTriggered = false;
|
|
78
76
|
|
|
79
77
|
const Button = ({
|
|
80
78
|
size = "medium",
|
|
81
79
|
subtext = "",
|
|
82
|
-
as,
|
|
83
80
|
children,
|
|
84
81
|
forwardRef,
|
|
85
82
|
"aria-label": ariaLabel,
|
|
@@ -99,12 +96,6 @@ const Button = ({
|
|
|
99
96
|
fullWidth = false,
|
|
100
97
|
...rest
|
|
101
98
|
}) => {
|
|
102
|
-
if (!deprecatedWarnTriggered && as) {
|
|
103
|
-
deprecatedWarnTriggered = true;
|
|
104
|
-
Logger.deprecate( // eslint-disable-next-line max-len
|
|
105
|
-
"The `as` prop is deprecated and will soon be removed from the `Button` component interface. You should use the `buttonType` prop to achieve the same styling. The following codemod is available to help with updating your code https://github.com/Sage/carbon-codemod/tree/master/transforms/rename-prop");
|
|
106
|
-
}
|
|
107
|
-
|
|
108
99
|
invariant(!!(children || iconType), "Either prop `iconType` must be defined or this node must have children.");
|
|
109
100
|
|
|
110
101
|
if (subtext) {
|
|
@@ -112,7 +103,7 @@ const Button = ({
|
|
|
112
103
|
}
|
|
113
104
|
|
|
114
105
|
const [internalRef, setInternalRef] = useState();
|
|
115
|
-
const buttonType =
|
|
106
|
+
const buttonType = buttonTypeProp;
|
|
116
107
|
let paddingX;
|
|
117
108
|
|
|
118
109
|
const handleLinkKeyDown = event => {
|
|
@@ -182,7 +173,6 @@ const Button = ({
|
|
|
182
173
|
|
|
183
174
|
Button.propTypes = {
|
|
184
175
|
"aria-label": PropTypes.string,
|
|
185
|
-
"as": PropTypes.oneOf(["darkBackground", "dashed", "primary", "secondary", "tertiary"]),
|
|
186
176
|
"buttonType": PropTypes.oneOf(["darkBackground", "dashed", "primary", "secondary", "tertiary"]),
|
|
187
177
|
"children": PropTypes.node,
|
|
188
178
|
"destructive": PropTypes.bool,
|
|
@@ -522,7 +512,6 @@ const ButtonWithForwardRef = /*#__PURE__*/React.forwardRef((props, ref) => /*#__
|
|
|
522
512
|
}, props)));
|
|
523
513
|
ButtonWithForwardRef.propTypes = {
|
|
524
514
|
"aria-label": PropTypes.string,
|
|
525
|
-
"as": PropTypes.oneOf(["darkBackground", "dashed", "primary", "secondary", "tertiary"]),
|
|
526
515
|
"buttonType": PropTypes.oneOf(["darkBackground", "dashed", "primary", "secondary", "tertiary"]),
|
|
527
516
|
"children": PropTypes.node,
|
|
528
517
|
"destructive": PropTypes.bool,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SpaceProps } from "styled-system";
|
|
2
2
|
import { ButtonProps } from "./button.component";
|
|
3
|
-
declare const StyledButton: import("styled-components").StyledComponent<"button", any, SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> &
|
|
3
|
+
declare const StyledButton: import("styled-components").StyledComponent<"button", any, SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & ButtonProps & {
|
|
4
4
|
iconOnly?: boolean | undefined;
|
|
5
5
|
}, never>;
|
|
6
6
|
export declare const StyledButtonSubtext: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
@@ -6,7 +6,7 @@ import styledSystemPropTypes from "@styled-system/prop-types";
|
|
|
6
6
|
import FormField from "../../__internal__/form-field";
|
|
7
7
|
import ButtonToggleGroupStyle from "./button-toggle-group.style";
|
|
8
8
|
import ButtonToggle from "../button-toggle";
|
|
9
|
-
import RadioButtonMapper from "
|
|
9
|
+
import RadioButtonMapper from "../../__internal__/radio-button-mapper/radio-button-mapper.component";
|
|
10
10
|
import ValidationIcon from "../../__internal__/validations/validation-icon.component";
|
|
11
11
|
import { InputGroupBehaviour } from "../../__internal__/input-behaviour";
|
|
12
12
|
import { filterStyledSystemMarginProps } from "../../style/utils";
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
export default Confirm;
|
|
2
|
-
declare function Confirm({ "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-label": ariaLabel, open, children,
|
|
2
|
+
declare function Confirm({ "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-label": ariaLabel, open, children, cancelButtonDestructive, confirmButtonDestructive, cancelButtonType, confirmButtonType, cancelButtonIconType, cancelButtonIconPosition, confirmButtonIconType, confirmButtonIconPosition, cancelLabel, onCancel, disableCancel, onConfirm, isLoadingConfirm, disableConfirm, confirmLabel, iconType, subtitle, title, ...rest }: {
|
|
3
3
|
[x: string]: any;
|
|
4
4
|
"aria-labelledby": any;
|
|
5
5
|
"aria-describedby": any;
|
|
6
6
|
"aria-label": any;
|
|
7
7
|
open: any;
|
|
8
8
|
children: any;
|
|
9
|
-
destructive: any;
|
|
10
9
|
cancelButtonDestructive: any;
|
|
11
10
|
confirmButtonDestructive: any;
|
|
12
11
|
cancelButtonType: any;
|
|
@@ -30,7 +29,6 @@ declare namespace Confirm {
|
|
|
30
29
|
namespace defaultProps {
|
|
31
30
|
const size: string;
|
|
32
31
|
const showCloseIcon: boolean;
|
|
33
|
-
const destructive: boolean;
|
|
34
32
|
const cancelButtonDestructive: boolean;
|
|
35
33
|
const confirmButtonDestructive: boolean;
|
|
36
34
|
const iconType: null;
|
|
@@ -81,8 +79,6 @@ declare namespace Confirm {
|
|
|
81
79
|
confirmLabel: PropTypes.Requireable<string>;
|
|
82
80
|
/** Customise the cancel button label */
|
|
83
81
|
cancelLabel: PropTypes.Requireable<string>;
|
|
84
|
-
/** Apply destructive style to the buttons */
|
|
85
|
-
destructive: PropTypes.Requireable<boolean>;
|
|
86
82
|
/** Apply destructive style to the cancel button */
|
|
87
83
|
cancelButtonDestructive: PropTypes.Requireable<boolean>;
|
|
88
84
|
/** Apply destructive style to the confirm button */
|
|
@@ -3,7 +3,6 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
3
3
|
import React, { useRef } from "react";
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
5
|
import createGuid from "../../__internal__/utils/helpers/guid";
|
|
6
|
-
import Logger from "../../__internal__/utils/logger";
|
|
7
6
|
import Heading from "../heading";
|
|
8
7
|
import Dialog from "../dialog";
|
|
9
8
|
import { StyledConfirmButtons, StyledConfirmHeading } from "./confirm.style";
|
|
@@ -11,7 +10,6 @@ import Button from "../button/button.component";
|
|
|
11
10
|
import Icon from "../icon";
|
|
12
11
|
import Loader from "../loader";
|
|
13
12
|
import useLocale from "../../hooks/__internal__/useLocale";
|
|
14
|
-
let deprecatedWarnTriggered = false;
|
|
15
13
|
|
|
16
14
|
const Confirm = ({
|
|
17
15
|
"aria-labelledby": ariaLabelledBy,
|
|
@@ -19,7 +17,6 @@ const Confirm = ({
|
|
|
19
17
|
"aria-label": ariaLabel,
|
|
20
18
|
open,
|
|
21
19
|
children,
|
|
22
|
-
destructive,
|
|
23
20
|
cancelButtonDestructive,
|
|
24
21
|
confirmButtonDestructive,
|
|
25
22
|
cancelButtonType,
|
|
@@ -40,11 +37,6 @@ const Confirm = ({
|
|
|
40
37
|
title,
|
|
41
38
|
...rest
|
|
42
39
|
}) => {
|
|
43
|
-
if (!deprecatedWarnTriggered && destructive) {
|
|
44
|
-
deprecatedWarnTriggered = true;
|
|
45
|
-
Logger.deprecate("`destructive` prop is deprecated and will soon be removed. Please use `cancelButtonDestructive` and `confirmButtonDestructive` props.");
|
|
46
|
-
}
|
|
47
|
-
|
|
48
40
|
const l = useLocale();
|
|
49
41
|
const {
|
|
50
42
|
current: titleId
|
|
@@ -72,7 +64,7 @@ const Confirm = ({
|
|
|
72
64
|
onClick: onCancel,
|
|
73
65
|
"data-element": "cancel",
|
|
74
66
|
buttonType: cancelButtonType,
|
|
75
|
-
destructive:
|
|
67
|
+
destructive: cancelButtonDestructive,
|
|
76
68
|
disabled: disableCancel,
|
|
77
69
|
iconType: cancelButtonIconType,
|
|
78
70
|
iconPosition: cancelButtonIconPosition
|
|
@@ -83,7 +75,7 @@ const Confirm = ({
|
|
|
83
75
|
onClick: onConfirm,
|
|
84
76
|
"data-element": "confirm",
|
|
85
77
|
buttonType: confirmButtonType,
|
|
86
|
-
destructive:
|
|
78
|
+
destructive: confirmButtonDestructive,
|
|
87
79
|
disabled: isLoadingConfirm || disableConfirm,
|
|
88
80
|
ml: 2,
|
|
89
81
|
iconType: confirmButtonIconType,
|
|
@@ -127,7 +119,6 @@ const Confirm = ({
|
|
|
127
119
|
Confirm.defaultProps = {
|
|
128
120
|
size: "extra-small",
|
|
129
121
|
showCloseIcon: false,
|
|
130
|
-
destructive: false,
|
|
131
122
|
cancelButtonDestructive: false,
|
|
132
123
|
confirmButtonDestructive: false,
|
|
133
124
|
iconType: null,
|
|
@@ -195,9 +186,6 @@ Confirm.propTypes = {
|
|
|
195
186
|
/** Customise the cancel button label */
|
|
196
187
|
cancelLabel: PropTypes.string,
|
|
197
188
|
|
|
198
|
-
/** Apply destructive style to the buttons */
|
|
199
|
-
destructive: PropTypes.bool,
|
|
200
|
-
|
|
201
189
|
/** Apply destructive style to the cancel button */
|
|
202
190
|
cancelButtonDestructive: PropTypes.bool,
|
|
203
191
|
|
|
@@ -21,8 +21,6 @@ export interface ConfirmProps extends DialogProps {
|
|
|
21
21
|
cancelLabel?: string;
|
|
22
22
|
/** Customise the confirm button label */
|
|
23
23
|
confirmLabel?: string;
|
|
24
|
-
/** Apply destructive style to the buttons */
|
|
25
|
-
destructive?: boolean;
|
|
26
24
|
/** Apply destructive style to the cancel button */
|
|
27
25
|
cancelButtonDestructive?: boolean;
|
|
28
26
|
/** Apply destructive style to the confirm button */
|
|
@@ -12,6 +12,7 @@ import StyledDateInput from "./date.style";
|
|
|
12
12
|
import Textbox from "../textbox";
|
|
13
13
|
import DatePicker from "./__internal__/date-picker";
|
|
14
14
|
import DateRangeContext from "../date-range/date-range.context";
|
|
15
|
+
import ClickAwayWrapper from "../../__internal__/click-away-wrapper";
|
|
15
16
|
const marginPropTypes = filterStyledSystemMarginProps(styledSystemPropTypes.space);
|
|
16
17
|
|
|
17
18
|
const DateInput = ({
|
|
@@ -234,23 +235,6 @@ const DateInput = ({
|
|
|
234
235
|
}
|
|
235
236
|
};
|
|
236
237
|
|
|
237
|
-
useEffect(() => {
|
|
238
|
-
const fnClosePicker = ev => {
|
|
239
|
-
if (open && !Events.composedPath(ev).includes(parentRef.current) && !Events.composedPath(ev).includes(pickerRef.current)) {
|
|
240
|
-
alreadyFocused.current = true;
|
|
241
|
-
inputRef.current.focus();
|
|
242
|
-
isBlurBlocked.current = false;
|
|
243
|
-
inputRef.current.blur();
|
|
244
|
-
setOpen(false);
|
|
245
|
-
alreadyFocused.current = false;
|
|
246
|
-
}
|
|
247
|
-
};
|
|
248
|
-
|
|
249
|
-
document.addEventListener("mousedown", fnClosePicker);
|
|
250
|
-
return function cleanup() {
|
|
251
|
-
document.removeEventListener("mousedown", fnClosePicker);
|
|
252
|
-
};
|
|
253
|
-
}, [open]);
|
|
254
238
|
useEffect(() => {
|
|
255
239
|
const [matchedFormat, matchedValue] = findMatchedFormatAndValue(value, formats);
|
|
256
240
|
|
|
@@ -282,7 +266,22 @@ const DateInput = ({
|
|
|
282
266
|
return value;
|
|
283
267
|
};
|
|
284
268
|
|
|
285
|
-
|
|
269
|
+
const handleClickAway = () => {
|
|
270
|
+
if (open) {
|
|
271
|
+
alreadyFocused.current = true;
|
|
272
|
+
inputRef.current.focus();
|
|
273
|
+
isBlurBlocked.current = false;
|
|
274
|
+
inputRef.current.blur();
|
|
275
|
+
setOpen(false);
|
|
276
|
+
alreadyFocused.current = false;
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
return /*#__PURE__*/React.createElement(ClickAwayWrapper, {
|
|
281
|
+
handleClickAway: handleClickAway,
|
|
282
|
+
eventTypeId: "mousedown",
|
|
283
|
+
targets: [parentRef, pickerRef]
|
|
284
|
+
}, /*#__PURE__*/React.createElement(StyledDateInput, _extends({
|
|
286
285
|
ref: wrapperRef,
|
|
287
286
|
role: "presentation",
|
|
288
287
|
size: size,
|
|
@@ -322,13 +321,13 @@ const DateInput = ({
|
|
|
322
321
|
ref: pickerRef,
|
|
323
322
|
pickerMouseDown: handlePickerMouseDown,
|
|
324
323
|
open: open
|
|
325
|
-
}));
|
|
324
|
+
})));
|
|
326
325
|
};
|
|
327
326
|
|
|
328
327
|
DateInput.propTypes = { ...Textbox.propTypes,
|
|
329
328
|
...marginPropTypes,
|
|
330
329
|
|
|
331
|
-
/** Pass any props that match the [DayPickerProps](https://react-day-picker.
|
|
330
|
+
/** Pass any props that match the [DayPickerProps](https://react-day-picker-v7.netlify.app/docs/getting-started/)
|
|
332
331
|
* interface to override default behaviors
|
|
333
332
|
* */
|
|
334
333
|
pickerProps: PropTypes.object,
|
|
@@ -155,7 +155,8 @@ const Dialog = ({
|
|
|
155
155
|
autoFocus: !disableAutoFocus,
|
|
156
156
|
focusFirstElement: focusFirstElement,
|
|
157
157
|
bespokeTrap: bespokeFocusTrap,
|
|
158
|
-
wrapperRef: dialogRef
|
|
158
|
+
wrapperRef: dialogRef,
|
|
159
|
+
isOpen: open
|
|
159
160
|
}, /*#__PURE__*/React.createElement(DialogStyle, _extends({
|
|
160
161
|
"aria-modal": true,
|
|
161
162
|
ref: dialogRef,
|
|
@@ -165,9 +166,9 @@ const Dialog = ({
|
|
|
165
166
|
"data-element": "dialog",
|
|
166
167
|
"data-role": rest["data-role"],
|
|
167
168
|
role: role
|
|
168
|
-
}, contentPadding), dialogTitle(), /*#__PURE__*/React.createElement(DialogContentStyle, contentPadding, /*#__PURE__*/React.createElement(DialogInnerContentStyle, _extends({
|
|
169
|
+
}, contentPadding), dialogTitle(), closeIcon(), /*#__PURE__*/React.createElement(DialogContentStyle, contentPadding, /*#__PURE__*/React.createElement(DialogInnerContentStyle, _extends({
|
|
169
170
|
ref: innerContentRef
|
|
170
|
-
}, contentPadding), children))
|
|
171
|
+
}, contentPadding), children)))));
|
|
171
172
|
};
|
|
172
173
|
|
|
173
174
|
Dialog.propTypes = {
|
|
@@ -80,15 +80,9 @@ const StyledContent = styled.div`
|
|
|
80
80
|
|
|
81
81
|
${({
|
|
82
82
|
hasHeader
|
|
83
|
-
}) => !hasHeader && `
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
.carbon-app-wrapper {
|
|
88
|
-
max-width: 100%;
|
|
89
|
-
padding: 0;
|
|
90
|
-
height: 70px;
|
|
91
|
-
}
|
|
92
|
-
`}
|
|
83
|
+
}) => !hasHeader && css`
|
|
84
|
+
padding-top: 0;
|
|
85
|
+
margin-top: -25px;
|
|
86
|
+
`}
|
|
93
87
|
`;
|
|
94
88
|
export default StyledContent;
|
|
@@ -85,7 +85,8 @@ const DialogFullScreen = ({
|
|
|
85
85
|
}, componentTags), /*#__PURE__*/React.createElement(FocusTrap, {
|
|
86
86
|
autoFocus: !disableAutoFocus,
|
|
87
87
|
focusFirstElement: focusFirstElement,
|
|
88
|
-
wrapperRef: dialogRef
|
|
88
|
+
wrapperRef: dialogRef,
|
|
89
|
+
isOpen: open
|
|
89
90
|
}, /*#__PURE__*/React.createElement(StyledDialogFullScreen, _extends({
|
|
90
91
|
"aria-modal": role === "dialog" ? true : undefined
|
|
91
92
|
}, ariaProps, {
|
|
@@ -93,12 +94,12 @@ const DialogFullScreen = ({
|
|
|
93
94
|
"data-element": "dialog-full-screen",
|
|
94
95
|
pagesStyling: pagesStyling,
|
|
95
96
|
role: role
|
|
96
|
-
}), dialogTitle(), /*#__PURE__*/React.createElement(StyledContent, {
|
|
97
|
+
}), dialogTitle(), closeIcon(), /*#__PURE__*/React.createElement(StyledContent, {
|
|
97
98
|
hasHeader: title !== undefined,
|
|
98
99
|
"data-element": "content",
|
|
99
100
|
ref: contentRef,
|
|
100
101
|
disableContentPadding: disableContentPadding
|
|
101
|
-
}, children)
|
|
102
|
+
}, children))));
|
|
102
103
|
};
|
|
103
104
|
|
|
104
105
|
DialogFullScreen.defaultProps = {
|