carbon-react 111.5.3 → 111.7.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__/focus-trap/focus-trap.component.d.ts +3 -1
- package/esm/__internal__/focus-trap/focus-trap.component.js +4 -2
- package/esm/components/alert/alert.component.js +1 -0
- package/esm/components/dialog/dialog.component.d.ts +3 -1
- package/esm/components/dialog/dialog.component.js +3 -0
- package/esm/components/dialog-full-screen/dialog-full-screen.component.js +7 -2
- package/esm/components/dialog-full-screen/dialog-full-screen.d.ts +2 -0
- package/esm/components/image/image.component.js +1 -0
- package/esm/components/image/image.style.d.ts +6 -3
- package/esm/components/image/image.style.js +4 -2
- package/esm/components/sidebar/sidebar.component.d.ts +2 -0
- package/esm/components/sidebar/sidebar.component.js +4 -1
- package/esm/global.d.ts +1 -0
- package/lib/__internal__/focus-trap/focus-trap.component.d.ts +3 -1
- package/lib/__internal__/focus-trap/focus-trap.component.js +4 -2
- package/lib/components/alert/alert.component.js +1 -0
- package/lib/components/dialog/dialog.component.d.ts +3 -1
- package/lib/components/dialog/dialog.component.js +3 -0
- package/lib/components/dialog-full-screen/dialog-full-screen.component.js +7 -2
- package/lib/components/dialog-full-screen/dialog-full-screen.d.ts +2 -0
- package/lib/components/image/image.component.js +1 -0
- package/lib/components/image/image.style.d.ts +6 -3
- package/lib/components/image/image.style.js +4 -2
- package/lib/components/sidebar/sidebar.component.d.ts +2 -0
- package/lib/components/sidebar/sidebar.component.js +4 -1
- package/lib/global.d.ts +1 -0
- package/package.json +1 -1
|
@@ -9,11 +9,13 @@ export interface FocusTrapProps {
|
|
|
9
9
|
focusFirstElement?: CustomRefObject<HTMLElement> | HTMLElement;
|
|
10
10
|
/** a custom callback that will override the default focus trap behaviour */
|
|
11
11
|
bespokeTrap?: (ev: KeyboardEvent, firstElement?: HTMLElement, lastElement?: HTMLElement) => void;
|
|
12
|
+
/** optional selector to identify the focusable elements, if not provided a default selector is used */
|
|
13
|
+
focusableSelectors?: string;
|
|
12
14
|
/** a ref to the container wrapping the focusable elements */
|
|
13
15
|
wrapperRef?: CustomRefObject<HTMLElement>;
|
|
14
16
|
isOpen?: boolean;
|
|
15
17
|
/** an optional array of refs to containers whose content should also be reachable from the FocusTrap */
|
|
16
18
|
additionalWrapperRefs?: CustomRefObject<HTMLElement>[];
|
|
17
19
|
}
|
|
18
|
-
declare const FocusTrap: ({ children, autoFocus, focusFirstElement, bespokeTrap, wrapperRef, isOpen, additionalWrapperRefs, }: FocusTrapProps) => JSX.Element;
|
|
20
|
+
declare const FocusTrap: ({ children, autoFocus, focusableSelectors, focusFirstElement, bespokeTrap, wrapperRef, isOpen, additionalWrapperRefs, }: FocusTrapProps) => JSX.Element;
|
|
19
21
|
export default FocusTrap;
|
|
@@ -7,6 +7,7 @@ import usePrevious from "../../hooks/__internal__/usePrevious"; // TODO investig
|
|
|
7
7
|
const FocusTrap = ({
|
|
8
8
|
children,
|
|
9
9
|
autoFocus = true,
|
|
10
|
+
focusableSelectors,
|
|
10
11
|
focusFirstElement,
|
|
11
12
|
bespokeTrap,
|
|
12
13
|
wrapperRef,
|
|
@@ -35,7 +36,7 @@ const FocusTrap = ({
|
|
|
35
36
|
const elements = [];
|
|
36
37
|
allRefs.forEach(ref => {
|
|
37
38
|
if (ref) {
|
|
38
|
-
elements.push(...Array.from(ref.querySelectorAll(defaultFocusableSelectors)).filter(el => Number(el.tabIndex) !== -1));
|
|
39
|
+
elements.push(...Array.from(ref.querySelectorAll(focusableSelectors || defaultFocusableSelectors)).filter(el => Number(el.tabIndex) !== -1));
|
|
39
40
|
}
|
|
40
41
|
});
|
|
41
42
|
|
|
@@ -44,7 +45,7 @@ const FocusTrap = ({
|
|
|
44
45
|
setFirstElement(elements[0]);
|
|
45
46
|
setLastElement(elements[elements.length - 1]);
|
|
46
47
|
}
|
|
47
|
-
}, [hasNewInputs, allRefs]);
|
|
48
|
+
}, [hasNewInputs, allRefs, focusableSelectors]);
|
|
48
49
|
useEffect(() => {
|
|
49
50
|
const observer = new MutationObserver(updateFocusableElements);
|
|
50
51
|
trapWrappers.forEach(wrapper => {
|
|
@@ -180,6 +181,7 @@ FocusTrap.propTypes = {
|
|
|
180
181
|
"autoFocus": PropTypes.bool,
|
|
181
182
|
"bespokeTrap": PropTypes.func,
|
|
182
183
|
"children": PropTypes.node,
|
|
184
|
+
"focusableSelectors": PropTypes.string,
|
|
183
185
|
"focusFirstElement": PropTypes.oneOfType([function (props, propName) {
|
|
184
186
|
if (props[propName] == null) {
|
|
185
187
|
return new Error("Prop '" + propName + "' is required but wasn't specified");
|
|
@@ -38,6 +38,8 @@ export interface DialogProps extends ModalProps, TagProps {
|
|
|
38
38
|
bespokeFocusTrap?: (ev: KeyboardEvent, firstElement?: HTMLElement, lastElement?: HTMLElement) => void;
|
|
39
39
|
/** Optional reference to an element meant to be focused on open */
|
|
40
40
|
focusFirstElement?: React.MutableRefObject<HTMLElement | null>;
|
|
41
|
+
/** Optional selector to identify the focusable elements, if not provided a default selector is used */
|
|
42
|
+
focusableSelectors?: string;
|
|
41
43
|
/** Allows developers to specify a specific height for the dialog. */
|
|
42
44
|
height?: string;
|
|
43
45
|
/** Adds Help tooltip to Header */
|
|
@@ -59,5 +61,5 @@ export interface DialogProps extends ModalProps, TagProps {
|
|
|
59
61
|
/** an optional array of refs to containers whose content should also be reachable by tabbing from the dialog */
|
|
60
62
|
focusableContainers?: CustomRefObject<HTMLElement>[];
|
|
61
63
|
}
|
|
62
|
-
export declare const Dialog: ({ className, children, open, height, size, title, disableEscKey, subtitle, disableAutoFocus, focusFirstElement, onCancel, showCloseIcon, bespokeFocusTrap, disableClose, help, role, contentPadding, focusableContainers, ...rest }: DialogProps) => JSX.Element;
|
|
64
|
+
export declare const Dialog: ({ className, children, open, height, size, title, disableEscKey, subtitle, disableAutoFocus, focusFirstElement, focusableSelectors, onCancel, showCloseIcon, bespokeFocusTrap, disableClose, help, role, contentPadding, focusableContainers, ...rest }: DialogProps) => JSX.Element;
|
|
63
65
|
export default Dialog;
|
|
@@ -27,6 +27,7 @@ const Dialog = ({
|
|
|
27
27
|
subtitle,
|
|
28
28
|
disableAutoFocus = false,
|
|
29
29
|
focusFirstElement,
|
|
30
|
+
focusableSelectors,
|
|
30
31
|
onCancel,
|
|
31
32
|
showCloseIcon = true,
|
|
32
33
|
bespokeFocusTrap,
|
|
@@ -168,6 +169,7 @@ const Dialog = ({
|
|
|
168
169
|
autoFocus: !disableAutoFocus,
|
|
169
170
|
focusFirstElement: focusFirstElement,
|
|
170
171
|
bespokeTrap: bespokeFocusTrap,
|
|
172
|
+
focusableSelectors: focusableSelectors,
|
|
171
173
|
wrapperRef: dialogRef,
|
|
172
174
|
isOpen: open,
|
|
173
175
|
additionalWrapperRefs: focusableContainers
|
|
@@ -217,6 +219,7 @@ Dialog.propTypes = {
|
|
|
217
219
|
}
|
|
218
220
|
}
|
|
219
221
|
})),
|
|
222
|
+
"focusableSelectors": PropTypes.string,
|
|
220
223
|
"focusFirstElement": PropTypes.shape({
|
|
221
224
|
"current": PropTypes.oneOfType([PropTypes.oneOf([null]), function (props, propName) {
|
|
222
225
|
if (props[propName] == null) {
|
|
@@ -35,6 +35,7 @@ const DialogFullScreen = ({
|
|
|
35
35
|
help,
|
|
36
36
|
role = "dialog",
|
|
37
37
|
focusableContainers,
|
|
38
|
+
focusableSelectors,
|
|
38
39
|
...rest
|
|
39
40
|
}) => {
|
|
40
41
|
const locale = useLocale();
|
|
@@ -94,7 +95,8 @@ const DialogFullScreen = ({
|
|
|
94
95
|
focusFirstElement: focusFirstElement,
|
|
95
96
|
wrapperRef: dialogRef,
|
|
96
97
|
isOpen: open,
|
|
97
|
-
additionalWrapperRefs: focusableContainers
|
|
98
|
+
additionalWrapperRefs: focusableContainers,
|
|
99
|
+
focusableSelectors: focusableSelectors
|
|
98
100
|
}, /*#__PURE__*/React.createElement(StyledDialogFullScreen, _extends({
|
|
99
101
|
"aria-modal": role === "dialog" && topModal !== null && topModal !== void 0 && topModal.contains(dialogRef.current) ? true : undefined
|
|
100
102
|
}, ariaProps, {
|
|
@@ -184,6 +186,9 @@ DialogFullScreen.propTypes = {
|
|
|
184
186
|
/** an optional array of refs to containers whose content should also be reachable by tabbing from the dialog */
|
|
185
187
|
focusableContainers: PropTypes.arrayOf(PropTypes.shape({
|
|
186
188
|
current: PropTypes.any
|
|
187
|
-
}))
|
|
189
|
+
})),
|
|
190
|
+
|
|
191
|
+
/** Optional selector to identify the focusable elements, if not provided a default selector is used */
|
|
192
|
+
focusableSelectors: PropTypes.string
|
|
188
193
|
};
|
|
189
194
|
export default DialogFullScreen;
|
|
@@ -43,6 +43,8 @@ export interface DialogFullScreenProps extends ModalProps {
|
|
|
43
43
|
role?: string;
|
|
44
44
|
/** an optional array of refs to containers whose content should also be reachable by tabbing from the dialog */
|
|
45
45
|
focusableContainers?: React.MutableRefObject<HTMLElement | null>[];
|
|
46
|
+
/** Optional selector to identify the focusable elements, if not provided a default selector is used */
|
|
47
|
+
focusableSelectors?: string;
|
|
46
48
|
}
|
|
47
49
|
|
|
48
50
|
declare function DialogFullScreen(props: DialogFullScreenProps): JSX.Element;
|
|
@@ -729,6 +729,7 @@ Image.propTypes = {
|
|
|
729
729
|
"trimStart": PropTypes.func.isRequired,
|
|
730
730
|
"valueOf": PropTypes.func.isRequired
|
|
731
731
|
}), PropTypes.string]),
|
|
732
|
+
"hidden": PropTypes.bool,
|
|
732
733
|
"m": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
733
734
|
"__@toStringTag": PropTypes.string.isRequired,
|
|
734
735
|
"description": PropTypes.string,
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { MarginProps, BackgroundProps, LayoutProps } from "styled-system";
|
|
3
3
|
export interface StyledImageProps extends MarginProps, BackgroundProps, LayoutProps {
|
|
4
|
-
/** alt property to display when an img fails to load */
|
|
4
|
+
/** HTML alt property to display when an img fails to load */
|
|
5
5
|
alt?: string;
|
|
6
|
-
/**
|
|
6
|
+
/** Any valid file path, passing this will render the component as an img element */
|
|
7
7
|
src?: string;
|
|
8
|
+
/** HTML hidden property to indicate whether to remain hidden visually and from screen readers */
|
|
9
|
+
hidden?: boolean;
|
|
8
10
|
/** Children elements, will only render if component is a div element */
|
|
9
11
|
children?: React.ReactNode;
|
|
10
12
|
}
|
|
11
13
|
declare const StyledImage: import("styled-components").StyledComponent<"div", any, {
|
|
12
14
|
children: import("react").ReactNode;
|
|
13
15
|
src: string | undefined;
|
|
16
|
+
hidden: boolean;
|
|
14
17
|
as?: string | undefined;
|
|
15
|
-
} & StyledImageProps, "children" | "as" | "src">;
|
|
18
|
+
} & StyledImageProps, "hidden" | "children" | "as" | "src">;
|
|
16
19
|
export { StyledImage };
|
|
@@ -3,12 +3,14 @@ import { margin, layout, background } from "styled-system";
|
|
|
3
3
|
import { baseTheme } from "../../style/themes";
|
|
4
4
|
const StyledImage = styled.div.attrs(({
|
|
5
5
|
src,
|
|
6
|
-
children
|
|
6
|
+
children,
|
|
7
|
+
hidden = false
|
|
7
8
|
}) => ({ ...(src && {
|
|
8
9
|
as: "img"
|
|
9
10
|
}),
|
|
10
11
|
children: src ? undefined : children,
|
|
11
|
-
src
|
|
12
|
+
src,
|
|
13
|
+
hidden
|
|
12
14
|
}))`
|
|
13
15
|
${margin}
|
|
14
16
|
${layout}
|
|
@@ -42,6 +42,8 @@ export interface SidebarProps extends PaddingProps, TagProps {
|
|
|
42
42
|
size?: "extra-small" | "small" | "medium-small" | "medium" | "medium-large" | "large" | "extra-large";
|
|
43
43
|
/** an optional array of refs to containers whose content should also be reachable by tabbing from the sidebar */
|
|
44
44
|
focusableContainers?: CustomRefObject<HTMLElement>[];
|
|
45
|
+
/** Optional selector to identify the focusable elements, if not provided a default selector is used */
|
|
46
|
+
focusableSelectors?: string;
|
|
45
47
|
}
|
|
46
48
|
export declare const Sidebar: React.ForwardRefExoticComponent<SidebarProps & React.RefAttributes<HTMLDivElement>>;
|
|
47
49
|
export default Sidebar;
|
|
@@ -30,6 +30,7 @@ const Sidebar = /*#__PURE__*/React.forwardRef(({
|
|
|
30
30
|
onCancel,
|
|
31
31
|
role = "dialog",
|
|
32
32
|
focusableContainers,
|
|
33
|
+
focusableSelectors,
|
|
33
34
|
...rest
|
|
34
35
|
}, ref) => {
|
|
35
36
|
const locale = useLocale();
|
|
@@ -99,7 +100,8 @@ const Sidebar = /*#__PURE__*/React.forwardRef(({
|
|
|
99
100
|
}, componentTags), enableBackgroundUI ? sidebar : /*#__PURE__*/React.createElement(FocusTrap, {
|
|
100
101
|
wrapperRef: sidebarRef,
|
|
101
102
|
isOpen: open,
|
|
102
|
-
additionalWrapperRefs: focusableContainers
|
|
103
|
+
additionalWrapperRefs: focusableContainers,
|
|
104
|
+
focusableSelectors: focusableSelectors
|
|
103
105
|
}, sidebar));
|
|
104
106
|
});
|
|
105
107
|
Sidebar.propTypes = {
|
|
@@ -121,6 +123,7 @@ Sidebar.propTypes = {
|
|
|
121
123
|
}
|
|
122
124
|
}
|
|
123
125
|
})),
|
|
126
|
+
"focusableSelectors": PropTypes.string,
|
|
124
127
|
"header": PropTypes.node,
|
|
125
128
|
"onCancel": PropTypes.func,
|
|
126
129
|
"open": PropTypes.bool.isRequired,
|
package/esm/global.d.ts
CHANGED
|
@@ -9,11 +9,13 @@ export interface FocusTrapProps {
|
|
|
9
9
|
focusFirstElement?: CustomRefObject<HTMLElement> | HTMLElement;
|
|
10
10
|
/** a custom callback that will override the default focus trap behaviour */
|
|
11
11
|
bespokeTrap?: (ev: KeyboardEvent, firstElement?: HTMLElement, lastElement?: HTMLElement) => void;
|
|
12
|
+
/** optional selector to identify the focusable elements, if not provided a default selector is used */
|
|
13
|
+
focusableSelectors?: string;
|
|
12
14
|
/** a ref to the container wrapping the focusable elements */
|
|
13
15
|
wrapperRef?: CustomRefObject<HTMLElement>;
|
|
14
16
|
isOpen?: boolean;
|
|
15
17
|
/** an optional array of refs to containers whose content should also be reachable from the FocusTrap */
|
|
16
18
|
additionalWrapperRefs?: CustomRefObject<HTMLElement>[];
|
|
17
19
|
}
|
|
18
|
-
declare const FocusTrap: ({ children, autoFocus, focusFirstElement, bespokeTrap, wrapperRef, isOpen, additionalWrapperRefs, }: FocusTrapProps) => JSX.Element;
|
|
20
|
+
declare const FocusTrap: ({ children, autoFocus, focusableSelectors, focusFirstElement, bespokeTrap, wrapperRef, isOpen, additionalWrapperRefs, }: FocusTrapProps) => JSX.Element;
|
|
19
21
|
export default FocusTrap;
|
|
@@ -24,6 +24,7 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
|
|
24
24
|
const FocusTrap = ({
|
|
25
25
|
children,
|
|
26
26
|
autoFocus = true,
|
|
27
|
+
focusableSelectors,
|
|
27
28
|
focusFirstElement,
|
|
28
29
|
bespokeTrap,
|
|
29
30
|
wrapperRef,
|
|
@@ -52,7 +53,7 @@ const FocusTrap = ({
|
|
|
52
53
|
const elements = [];
|
|
53
54
|
allRefs.forEach(ref => {
|
|
54
55
|
if (ref) {
|
|
55
|
-
elements.push(...Array.from(ref.querySelectorAll(_focusTrapUtils.defaultFocusableSelectors)).filter(el => Number(el.tabIndex) !== -1));
|
|
56
|
+
elements.push(...Array.from(ref.querySelectorAll(focusableSelectors || _focusTrapUtils.defaultFocusableSelectors)).filter(el => Number(el.tabIndex) !== -1));
|
|
56
57
|
}
|
|
57
58
|
});
|
|
58
59
|
|
|
@@ -61,7 +62,7 @@ const FocusTrap = ({
|
|
|
61
62
|
setFirstElement(elements[0]);
|
|
62
63
|
setLastElement(elements[elements.length - 1]);
|
|
63
64
|
}
|
|
64
|
-
}, [hasNewInputs, allRefs]);
|
|
65
|
+
}, [hasNewInputs, allRefs, focusableSelectors]);
|
|
65
66
|
(0, _react.useEffect)(() => {
|
|
66
67
|
const observer = new MutationObserver(updateFocusableElements);
|
|
67
68
|
trapWrappers.forEach(wrapper => {
|
|
@@ -198,6 +199,7 @@ FocusTrap.propTypes = {
|
|
|
198
199
|
"autoFocus": _propTypes.default.bool,
|
|
199
200
|
"bespokeTrap": _propTypes.default.func,
|
|
200
201
|
"children": _propTypes.default.node,
|
|
202
|
+
"focusableSelectors": _propTypes.default.string,
|
|
201
203
|
"focusFirstElement": _propTypes.default.oneOfType([function (props, propName) {
|
|
202
204
|
if (props[propName] == null) {
|
|
203
205
|
return new Error("Prop '" + propName + "' is required but wasn't specified");
|
|
@@ -56,6 +56,7 @@ Alert.propTypes = {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
})),
|
|
59
|
+
"focusableSelectors": _propTypes.default.string,
|
|
59
60
|
"focusFirstElement": _propTypes.default.shape({
|
|
60
61
|
"current": _propTypes.default.oneOfType([_propTypes.default.oneOf([null]), function (props, propName) {
|
|
61
62
|
if (props[propName] == null) {
|
|
@@ -38,6 +38,8 @@ export interface DialogProps extends ModalProps, TagProps {
|
|
|
38
38
|
bespokeFocusTrap?: (ev: KeyboardEvent, firstElement?: HTMLElement, lastElement?: HTMLElement) => void;
|
|
39
39
|
/** Optional reference to an element meant to be focused on open */
|
|
40
40
|
focusFirstElement?: React.MutableRefObject<HTMLElement | null>;
|
|
41
|
+
/** Optional selector to identify the focusable elements, if not provided a default selector is used */
|
|
42
|
+
focusableSelectors?: string;
|
|
41
43
|
/** Allows developers to specify a specific height for the dialog. */
|
|
42
44
|
height?: string;
|
|
43
45
|
/** Adds Help tooltip to Header */
|
|
@@ -59,5 +61,5 @@ export interface DialogProps extends ModalProps, TagProps {
|
|
|
59
61
|
/** an optional array of refs to containers whose content should also be reachable by tabbing from the dialog */
|
|
60
62
|
focusableContainers?: CustomRefObject<HTMLElement>[];
|
|
61
63
|
}
|
|
62
|
-
export declare const Dialog: ({ className, children, open, height, size, title, disableEscKey, subtitle, disableAutoFocus, focusFirstElement, onCancel, showCloseIcon, bespokeFocusTrap, disableClose, help, role, contentPadding, focusableContainers, ...rest }: DialogProps) => JSX.Element;
|
|
64
|
+
export declare const Dialog: ({ className, children, open, height, size, title, disableEscKey, subtitle, disableAutoFocus, focusFirstElement, focusableSelectors, onCancel, showCloseIcon, bespokeFocusTrap, disableClose, help, role, contentPadding, focusableContainers, ...rest }: DialogProps) => JSX.Element;
|
|
63
65
|
export default Dialog;
|
|
@@ -54,6 +54,7 @@ const Dialog = ({
|
|
|
54
54
|
subtitle,
|
|
55
55
|
disableAutoFocus = false,
|
|
56
56
|
focusFirstElement,
|
|
57
|
+
focusableSelectors,
|
|
57
58
|
onCancel,
|
|
58
59
|
showCloseIcon = true,
|
|
59
60
|
bespokeFocusTrap,
|
|
@@ -195,6 +196,7 @@ const Dialog = ({
|
|
|
195
196
|
autoFocus: !disableAutoFocus,
|
|
196
197
|
focusFirstElement: focusFirstElement,
|
|
197
198
|
bespokeTrap: bespokeFocusTrap,
|
|
199
|
+
focusableSelectors: focusableSelectors,
|
|
198
200
|
wrapperRef: dialogRef,
|
|
199
201
|
isOpen: open,
|
|
200
202
|
additionalWrapperRefs: focusableContainers
|
|
@@ -245,6 +247,7 @@ Dialog.propTypes = {
|
|
|
245
247
|
}
|
|
246
248
|
}
|
|
247
249
|
})),
|
|
250
|
+
"focusableSelectors": _propTypes.default.string,
|
|
248
251
|
"focusFirstElement": _propTypes.default.shape({
|
|
249
252
|
"current": _propTypes.default.oneOfType([_propTypes.default.oneOf([null]), function (props, propName) {
|
|
250
253
|
if (props[propName] == null) {
|
|
@@ -61,6 +61,7 @@ const DialogFullScreen = ({
|
|
|
61
61
|
help,
|
|
62
62
|
role = "dialog",
|
|
63
63
|
focusableContainers,
|
|
64
|
+
focusableSelectors,
|
|
64
65
|
...rest
|
|
65
66
|
}) => {
|
|
66
67
|
const locale = (0, _useLocale.default)();
|
|
@@ -120,7 +121,8 @@ const DialogFullScreen = ({
|
|
|
120
121
|
focusFirstElement: focusFirstElement,
|
|
121
122
|
wrapperRef: dialogRef,
|
|
122
123
|
isOpen: open,
|
|
123
|
-
additionalWrapperRefs: focusableContainers
|
|
124
|
+
additionalWrapperRefs: focusableContainers,
|
|
125
|
+
focusableSelectors: focusableSelectors
|
|
124
126
|
}, /*#__PURE__*/_react.default.createElement(_dialogFullScreen.default, _extends({
|
|
125
127
|
"aria-modal": role === "dialog" && topModal !== null && topModal !== void 0 && topModal.contains(dialogRef.current) ? true : undefined
|
|
126
128
|
}, ariaProps, {
|
|
@@ -210,7 +212,10 @@ DialogFullScreen.propTypes = {
|
|
|
210
212
|
/** an optional array of refs to containers whose content should also be reachable by tabbing from the dialog */
|
|
211
213
|
focusableContainers: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
212
214
|
current: _propTypes.default.any
|
|
213
|
-
}))
|
|
215
|
+
})),
|
|
216
|
+
|
|
217
|
+
/** Optional selector to identify the focusable elements, if not provided a default selector is used */
|
|
218
|
+
focusableSelectors: _propTypes.default.string
|
|
214
219
|
};
|
|
215
220
|
var _default = DialogFullScreen;
|
|
216
221
|
exports.default = _default;
|
|
@@ -43,6 +43,8 @@ export interface DialogFullScreenProps extends ModalProps {
|
|
|
43
43
|
role?: string;
|
|
44
44
|
/** an optional array of refs to containers whose content should also be reachable by tabbing from the dialog */
|
|
45
45
|
focusableContainers?: React.MutableRefObject<HTMLElement | null>[];
|
|
46
|
+
/** Optional selector to identify the focusable elements, if not provided a default selector is used */
|
|
47
|
+
focusableSelectors?: string;
|
|
46
48
|
}
|
|
47
49
|
|
|
48
50
|
declare function DialogFullScreen(props: DialogFullScreenProps): JSX.Element;
|
|
@@ -742,6 +742,7 @@ Image.propTypes = {
|
|
|
742
742
|
"trimStart": _propTypes.default.func.isRequired,
|
|
743
743
|
"valueOf": _propTypes.default.func.isRequired
|
|
744
744
|
}), _propTypes.default.string]),
|
|
745
|
+
"hidden": _propTypes.default.bool,
|
|
745
746
|
"m": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
746
747
|
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
747
748
|
"description": _propTypes.default.string,
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { MarginProps, BackgroundProps, LayoutProps } from "styled-system";
|
|
3
3
|
export interface StyledImageProps extends MarginProps, BackgroundProps, LayoutProps {
|
|
4
|
-
/** alt property to display when an img fails to load */
|
|
4
|
+
/** HTML alt property to display when an img fails to load */
|
|
5
5
|
alt?: string;
|
|
6
|
-
/**
|
|
6
|
+
/** Any valid file path, passing this will render the component as an img element */
|
|
7
7
|
src?: string;
|
|
8
|
+
/** HTML hidden property to indicate whether to remain hidden visually and from screen readers */
|
|
9
|
+
hidden?: boolean;
|
|
8
10
|
/** Children elements, will only render if component is a div element */
|
|
9
11
|
children?: React.ReactNode;
|
|
10
12
|
}
|
|
11
13
|
declare const StyledImage: import("styled-components").StyledComponent<"div", any, {
|
|
12
14
|
children: import("react").ReactNode;
|
|
13
15
|
src: string | undefined;
|
|
16
|
+
hidden: boolean;
|
|
14
17
|
as?: string | undefined;
|
|
15
|
-
} & StyledImageProps, "children" | "as" | "src">;
|
|
18
|
+
} & StyledImageProps, "hidden" | "children" | "as" | "src">;
|
|
16
19
|
export { StyledImage };
|
|
@@ -17,12 +17,14 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
|
|
17
17
|
|
|
18
18
|
const StyledImage = _styledComponents.default.div.attrs(({
|
|
19
19
|
src,
|
|
20
|
-
children
|
|
20
|
+
children,
|
|
21
|
+
hidden = false
|
|
21
22
|
}) => ({ ...(src && {
|
|
22
23
|
as: "img"
|
|
23
24
|
}),
|
|
24
25
|
children: src ? undefined : children,
|
|
25
|
-
src
|
|
26
|
+
src,
|
|
27
|
+
hidden
|
|
26
28
|
}))`
|
|
27
29
|
${_styledSystem.margin}
|
|
28
30
|
${_styledSystem.layout}
|
|
@@ -42,6 +42,8 @@ export interface SidebarProps extends PaddingProps, TagProps {
|
|
|
42
42
|
size?: "extra-small" | "small" | "medium-small" | "medium" | "medium-large" | "large" | "extra-large";
|
|
43
43
|
/** an optional array of refs to containers whose content should also be reachable by tabbing from the sidebar */
|
|
44
44
|
focusableContainers?: CustomRefObject<HTMLElement>[];
|
|
45
|
+
/** Optional selector to identify the focusable elements, if not provided a default selector is used */
|
|
46
|
+
focusableSelectors?: string;
|
|
45
47
|
}
|
|
46
48
|
export declare const Sidebar: React.ForwardRefExoticComponent<SidebarProps & React.RefAttributes<HTMLDivElement>>;
|
|
47
49
|
export default Sidebar;
|
|
@@ -59,6 +59,7 @@ const Sidebar = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
59
59
|
onCancel,
|
|
60
60
|
role = "dialog",
|
|
61
61
|
focusableContainers,
|
|
62
|
+
focusableSelectors,
|
|
62
63
|
...rest
|
|
63
64
|
}, ref) => {
|
|
64
65
|
const locale = (0, _useLocale.default)();
|
|
@@ -130,7 +131,8 @@ const Sidebar = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
130
131
|
}, componentTags), enableBackgroundUI ? sidebar : /*#__PURE__*/_react.default.createElement(_focusTrap.default, {
|
|
131
132
|
wrapperRef: sidebarRef,
|
|
132
133
|
isOpen: open,
|
|
133
|
-
additionalWrapperRefs: focusableContainers
|
|
134
|
+
additionalWrapperRefs: focusableContainers,
|
|
135
|
+
focusableSelectors: focusableSelectors
|
|
134
136
|
}, sidebar));
|
|
135
137
|
});
|
|
136
138
|
|
|
@@ -154,6 +156,7 @@ Sidebar.propTypes = {
|
|
|
154
156
|
}
|
|
155
157
|
}
|
|
156
158
|
})),
|
|
159
|
+
"focusableSelectors": _propTypes.default.string,
|
|
157
160
|
"header": _propTypes.default.node,
|
|
158
161
|
"onCancel": _propTypes.default.func,
|
|
159
162
|
"open": _propTypes.default.bool.isRequired,
|
package/lib/global.d.ts
CHANGED