@navikt/ds-react 0.16.0 → 0.16.4
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/cjs/modal/Modal.js
CHANGED
|
@@ -41,7 +41,7 @@ const ds_icons_1 = require("@navikt/ds-icons");
|
|
|
41
41
|
const __1 = require("..");
|
|
42
42
|
const ModalContent_1 = __importDefault(require("./ModalContent"));
|
|
43
43
|
const Modal = (0, react_1.forwardRef)((_a, ref) => {
|
|
44
|
-
var { children, open, onClose, className, shouldCloseOnOverlayClick = true, closeButton = true } = _a, rest = __rest(_a, ["children", "open", "onClose", "className", "shouldCloseOnOverlayClick", "closeButton"]);
|
|
44
|
+
var { children, open, onClose, className, shouldCloseOnOverlayClick = true, closeButton = true, "aria-describedby": ariaDescribedBy, "aria-labelledby": ariaLabelledBy, "aria-modal": ariaModal } = _a, rest = __rest(_a, ["children", "open", "onClose", "className", "shouldCloseOnOverlayClick", "closeButton", "aria-describedby", "aria-labelledby", "aria-modal"]);
|
|
45
45
|
const modalRef = (0, react_1.useRef)(null);
|
|
46
46
|
const mergedRef = (0, react_merge_refs_1.default)([modalRef, ref]);
|
|
47
47
|
const buttonRef = (0, react_1.useRef)(null);
|
|
@@ -53,7 +53,11 @@ const Modal = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
53
53
|
buttonRef.current.focus();
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
|
-
return (react_1.default.createElement(react_modal_1.default, Object.assign({}, rest, { isOpen: open, ref: mergedRef, className: (0, classnames_1.default)("navds-modal", className), overlayClassName: "navds-modal__overlay", shouldCloseOnOverlayClick: shouldCloseOnOverlayClick, onRequestClose: (e) => onModalCloseRequest(e)
|
|
56
|
+
return (react_1.default.createElement(react_modal_1.default, Object.assign({}, rest, { isOpen: open, ref: mergedRef, className: (0, classnames_1.default)("navds-modal", className), overlayClassName: "navds-modal__overlay", shouldCloseOnOverlayClick: shouldCloseOnOverlayClick, onRequestClose: (e) => onModalCloseRequest(e), aria: {
|
|
57
|
+
describedby: ariaDescribedBy,
|
|
58
|
+
labelledby: ariaLabelledBy,
|
|
59
|
+
modal: ariaModal,
|
|
60
|
+
} }),
|
|
57
61
|
children,
|
|
58
62
|
closeButton && (react_1.default.createElement(__1.Button, { className: (0, classnames_1.default)("navds-modal__button", {
|
|
59
63
|
"navds-modal__button--shake": shouldCloseOnOverlayClick,
|
package/esm/modal/Modal.d.ts
CHANGED
|
@@ -28,6 +28,9 @@ export interface ModalProps {
|
|
|
28
28
|
* @default true
|
|
29
29
|
*/
|
|
30
30
|
closeButton?: boolean;
|
|
31
|
+
"aria-labelledby"?: string;
|
|
32
|
+
"aria-describedby"?: string;
|
|
33
|
+
"aria-modal"?: boolean;
|
|
31
34
|
}
|
|
32
35
|
interface ModalComponent extends ModalLifecycle, React.ForwardRefExoticComponent<ModalProps & React.RefAttributes<ReactModal>> {
|
|
33
36
|
Content: ModalContentType;
|
package/esm/modal/Modal.js
CHANGED
|
@@ -17,7 +17,7 @@ import { Close } from "@navikt/ds-icons";
|
|
|
17
17
|
import { Button } from "..";
|
|
18
18
|
import ModalContent from "./ModalContent";
|
|
19
19
|
const Modal = forwardRef((_a, ref) => {
|
|
20
|
-
var { children, open, onClose, className, shouldCloseOnOverlayClick = true, closeButton = true } = _a, rest = __rest(_a, ["children", "open", "onClose", "className", "shouldCloseOnOverlayClick", "closeButton"]);
|
|
20
|
+
var { children, open, onClose, className, shouldCloseOnOverlayClick = true, closeButton = true, "aria-describedby": ariaDescribedBy, "aria-labelledby": ariaLabelledBy, "aria-modal": ariaModal } = _a, rest = __rest(_a, ["children", "open", "onClose", "className", "shouldCloseOnOverlayClick", "closeButton", "aria-describedby", "aria-labelledby", "aria-modal"]);
|
|
21
21
|
const modalRef = useRef(null);
|
|
22
22
|
const mergedRef = mergeRefs([modalRef, ref]);
|
|
23
23
|
const buttonRef = useRef(null);
|
|
@@ -29,7 +29,11 @@ const Modal = forwardRef((_a, ref) => {
|
|
|
29
29
|
buttonRef.current.focus();
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
|
-
return (React.createElement(ReactModal, Object.assign({}, rest, { isOpen: open, ref: mergedRef, className: cl("navds-modal", className), overlayClassName: "navds-modal__overlay", shouldCloseOnOverlayClick: shouldCloseOnOverlayClick, onRequestClose: (e) => onModalCloseRequest(e)
|
|
32
|
+
return (React.createElement(ReactModal, Object.assign({}, rest, { isOpen: open, ref: mergedRef, className: cl("navds-modal", className), overlayClassName: "navds-modal__overlay", shouldCloseOnOverlayClick: shouldCloseOnOverlayClick, onRequestClose: (e) => onModalCloseRequest(e), aria: {
|
|
33
|
+
describedby: ariaDescribedBy,
|
|
34
|
+
labelledby: ariaLabelledBy,
|
|
35
|
+
modal: ariaModal,
|
|
36
|
+
} }),
|
|
33
37
|
children,
|
|
34
38
|
closeButton && (React.createElement(Button, { className: cl("navds-modal__button", {
|
|
35
39
|
"navds-modal__button--shake": shouldCloseOnOverlayClick,
|
package/esm/modal/Modal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.js","sourceRoot":"","sources":["../../src/modal/Modal.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,SAAS,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAC5B,OAAO,YAAkC,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"Modal.js","sourceRoot":"","sources":["../../src/modal/Modal.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAClD,OA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C,CAAC,CAAC,EAC7C,IAAI,EAAE;YACJ,WAAW,EAAE,eAAe;YAC5B,UAAU,EAAE,cAAc;YAC1B,KAAK,EAAE,SAAS;SACjB;QAEA,QAAQ;QACR,WAAW,IAAI,CACd,oBAAC,MAAM,IACL,SAAS,EAAE,EAAE,CAAC,qBAAqB,EAAE;gBACnC,4BAA4B,EAAE,yBAAyB;aACxD,CAAC,EACF,IAAI,EAAC,OAAO,EACZ,OAAO,EAAC,UAAU,EAClB,GAAG,EAAE,SAAS,EACd,OAAO,EAAE,OAAO;YAEhB,oBAAC,KAAK,IAAC,KAAK,EAAC,iBAAiB,GAAG,CAC1B,CACV,CACU,CACd,CAAC;AACJ,CAAC,CACgB,CAAC;AAEpB,KAAK,CAAC,aAAa,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;AACrE,KAAK,CAAC,OAAO,GAAG,YAAY,CAAC;AAE7B,eAAe,KAAK,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@navikt/ds-react",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "NAV designsystem react components",
|
|
6
6
|
"author": "NAV Designsystem team",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@material-ui/core": "^4.12.3",
|
|
38
|
-
"@navikt/ds-icons": "^0.8.
|
|
38
|
+
"@navikt/ds-icons": "^0.8.3",
|
|
39
39
|
"@popperjs/core": "^2.10.1",
|
|
40
40
|
"classnames": "^2.2.6",
|
|
41
41
|
"react-collapse": "^5.1.0",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"@types/react": "^17.0.30",
|
|
65
65
|
"react": "^17.0.0"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "ead03786446ac0b057a553f9646627656489abaf"
|
|
68
68
|
}
|
package/src/modal/Modal.tsx
CHANGED
|
@@ -33,6 +33,9 @@ export interface ModalProps {
|
|
|
33
33
|
* @default true
|
|
34
34
|
*/
|
|
35
35
|
closeButton?: boolean;
|
|
36
|
+
"aria-labelledby"?: string;
|
|
37
|
+
"aria-describedby"?: string;
|
|
38
|
+
"aria-modal"?: boolean;
|
|
36
39
|
}
|
|
37
40
|
|
|
38
41
|
interface ModalComponent
|
|
@@ -56,6 +59,9 @@ const Modal = forwardRef<ReactModal, ModalProps>(
|
|
|
56
59
|
className,
|
|
57
60
|
shouldCloseOnOverlayClick = true,
|
|
58
61
|
closeButton = true,
|
|
62
|
+
"aria-describedby": ariaDescribedBy,
|
|
63
|
+
"aria-labelledby": ariaLabelledBy,
|
|
64
|
+
"aria-modal": ariaModal,
|
|
59
65
|
...rest
|
|
60
66
|
},
|
|
61
67
|
ref
|
|
@@ -81,6 +87,11 @@ const Modal = forwardRef<ReactModal, ModalProps>(
|
|
|
81
87
|
overlayClassName="navds-modal__overlay"
|
|
82
88
|
shouldCloseOnOverlayClick={shouldCloseOnOverlayClick}
|
|
83
89
|
onRequestClose={(e) => onModalCloseRequest(e)}
|
|
90
|
+
aria={{
|
|
91
|
+
describedby: ariaDescribedBy,
|
|
92
|
+
labelledby: ariaLabelledBy,
|
|
93
|
+
modal: ariaModal,
|
|
94
|
+
}}
|
|
84
95
|
>
|
|
85
96
|
{children}
|
|
86
97
|
{closeButton && (
|