@navikt/ds-react 0.16.2 → 0.16.6
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 +6 -2
- package/esm/modal/Modal.d.ts +3 -0
- package/esm/modal/Modal.js +6 -2
- package/esm/modal/Modal.js.map +1 -1
- package/esm/table/DataCell.d.ts +1 -1
- package/esm/table/HeaderCell.d.ts +1 -1
- package/esm/table/Table.d.ts +1 -1
- package/esm/table/Table.js.map +1 -1
- package/package.json +3 -3
- package/src/button/button.stories.tsx +3 -0
- package/src/modal/Modal.tsx +11 -0
- package/src/table/DataCell.tsx +1 -1
- package/src/table/HeaderCell.tsx +1 -1
- package/src/table/Table.tsx +2 -1
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;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CAAC,OAAO,EAAE;YAC5B,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;SAC3B;IACH,CAAC,CAAC;IAEF,OAAO,CACL,oBAAC,UAAU,oBACL,IAAI,IACR,MAAM,EAAE,IAAI,EACZ,GAAG,EAAE,SAAS,EACd,SAAS,EAAE,EAAE,CAAC,aAAa,EAAE,SAAS,CAAC,EACvC,gBAAgB,EAAC,sBAAsB,EACvC,yBAAyB,EAAE,yBAAyB,EACpD,cAAc,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,mBAAmB,CAAC,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/esm/table/DataCell.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
interface DataCellProps extends React.
|
|
2
|
+
interface DataCellProps extends React.TdHTMLAttributes<HTMLTableCellElement> {
|
|
3
3
|
}
|
|
4
4
|
export interface DataCellType extends React.ForwardRefExoticComponent<DataCellProps & React.RefAttributes<HTMLTableCellElement>> {
|
|
5
5
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
interface HeaderCellProps extends React.
|
|
2
|
+
interface HeaderCellProps extends React.ThHTMLAttributes<HTMLTableCellElement> {
|
|
3
3
|
scope?: string;
|
|
4
4
|
}
|
|
5
5
|
export interface HeaderCellType extends React.ForwardRefExoticComponent<HeaderCellProps & React.RefAttributes<HTMLTableCellElement>> {
|
package/esm/table/Table.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { BodyType } from "./Body";
|
|
|
4
4
|
import { RowType } from "./Row";
|
|
5
5
|
import { HeaderCellType } from "./HeaderCell";
|
|
6
6
|
import { DataCellType } from "./DataCell";
|
|
7
|
-
export interface TableProps extends React.
|
|
7
|
+
export interface TableProps extends React.TableHTMLAttributes<HTMLTableElement> {
|
|
8
8
|
/**
|
|
9
9
|
* Changes padding
|
|
10
10
|
* @default "medium"
|
package/esm/table/Table.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.js","sourceRoot":"","sources":["../../src/table/Table.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,MAAsB,MAAM,UAAU,CAAC;AAC9C,OAAO,IAAkB,MAAM,QAAQ,CAAC;AACxC,OAAO,GAAgB,MAAM,OAAO,CAAC;AACrC,OAAO,UAA8B,MAAM,cAAc,CAAC;AAC1D,OAAO,QAA0B,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"Table.js","sourceRoot":"","sources":["../../src/table/Table.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,MAAsB,MAAM,UAAU,CAAC;AAC9C,OAAO,IAAkB,MAAM,QAAQ,CAAC;AACxC,OAAO,GAAgB,MAAM,OAAO,CAAC;AACrC,OAAO,UAA8B,MAAM,cAAc,CAAC;AAC1D,OAAO,QAA0B,MAAM,YAAY,CAAC;AA+BpD,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAA2B,IAAI,CAAC,CAAC;AAE1E,MAAM,KAAK,GAAG,UAAU,CACtB,CAAC,EAA6D,EAAE,GAAG,EAAE,EAAE;QAAtE,EAAE,SAAS,EAAE,YAAY,GAAG,KAAK,EAAE,IAAI,GAAG,QAAQ,OAAW,EAAN,IAAI,cAA3D,qCAA6D,CAAF;IAAY,OAAA,CACtE,oBAAC,YAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,IAAI,EAAE;QACpC,+CACM,IAAI,IACR,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,aAAa,EAAE,gBAAgB,IAAI,EAAE,EAAE,SAAS,EAAE;gBAC9D,4BAA4B,EAAE,YAAY;aAC3C,CAAC,IACF,CACoB,CACzB,CAAA;CAAA,CACW,CAAC;AAEf,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;AACtB,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;AAClB,KAAK,CAAC,GAAG,GAAG,GAAG,CAAC;AAChB,KAAK,CAAC,UAAU,GAAG,UAAU,CAAC;AAC9B,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAE1B,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.6",
|
|
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.4",
|
|
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": "5f6bd160d6793768c5b10daac65ba788d19b14d1"
|
|
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 && (
|
package/src/table/DataCell.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import cl from "classnames";
|
|
|
3
3
|
import { BodyShort } from "..";
|
|
4
4
|
import { TableContext } from ".";
|
|
5
5
|
|
|
6
|
-
interface DataCellProps extends React.
|
|
6
|
+
interface DataCellProps extends React.TdHTMLAttributes<HTMLTableCellElement> {}
|
|
7
7
|
|
|
8
8
|
export interface DataCellType
|
|
9
9
|
extends React.ForwardRefExoticComponent<
|
package/src/table/HeaderCell.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import React, { forwardRef, useContext } from "react";
|
|
|
2
2
|
import cl from "classnames";
|
|
3
3
|
import { Label, TableContext } from "..";
|
|
4
4
|
|
|
5
|
-
interface HeaderCellProps extends React.
|
|
5
|
+
interface HeaderCellProps extends React.ThHTMLAttributes<HTMLTableCellElement> {
|
|
6
6
|
scope?: string;
|
|
7
7
|
}
|
|
8
8
|
|
package/src/table/Table.tsx
CHANGED
|
@@ -6,7 +6,8 @@ import Row, { RowType } from "./Row";
|
|
|
6
6
|
import HeaderCell, { HeaderCellType } from "./HeaderCell";
|
|
7
7
|
import DataCell, { DataCellType } from "./DataCell";
|
|
8
8
|
|
|
9
|
-
export interface TableProps
|
|
9
|
+
export interface TableProps
|
|
10
|
+
extends React.TableHTMLAttributes<HTMLTableElement> {
|
|
10
11
|
/**
|
|
11
12
|
* Changes padding
|
|
12
13
|
* @default "medium"
|