@navikt/ds-react 2.8.6 → 2.8.8
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/form/checkbox/Checkbox.js +7 -6
- package/cjs/form/radio/Radio.js +6 -5
- package/esm/form/Fieldset/useFieldset.d.ts +1 -1
- package/esm/form/checkbox/Checkbox.js +5 -4
- package/esm/form/checkbox/Checkbox.js.map +1 -1
- package/esm/form/checkbox/useCheckbox.d.ts +1 -1
- package/esm/form/radio/Radio.js +4 -3
- package/esm/form/radio/Radio.js.map +1 -1
- package/esm/form/radio/useRadio.d.ts +1 -1
- package/esm/form/useFormField.d.ts +1 -1
- package/package.json +3 -3
- package/src/form/checkbox/Checkbox.tsx +6 -9
- package/src/form/radio/Radio.tsx +4 -7
|
@@ -27,18 +27,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.Checkbox = void 0;
|
|
30
|
-
const react_1 = __importStar(require("react"));
|
|
31
30
|
const clsx_1 = __importDefault(require("clsx"));
|
|
31
|
+
const react_1 = __importStar(require("react"));
|
|
32
|
+
const typography_1 = require("../../typography");
|
|
33
|
+
const util_1 = require("../../util");
|
|
32
34
|
const useCheckbox_1 = __importDefault(require("./useCheckbox"));
|
|
33
|
-
const __1 = require("../..");
|
|
34
35
|
exports.Checkbox = (0, react_1.forwardRef)((props, ref) => {
|
|
35
36
|
const { inputProps, hasError, size } = (0, useCheckbox_1.default)(props);
|
|
36
|
-
const Description = size === "medium" ?
|
|
37
|
+
const Description = size === "medium" ? typography_1.BodyLong : typography_1.Detail;
|
|
37
38
|
return (react_1.default.createElement("div", { className: (0, clsx_1.default)(props.className, "navds-checkbox", `navds-checkbox--${size}`, {
|
|
38
39
|
"navds-checkbox--error": hasError,
|
|
39
40
|
"navds-checkbox--disabled": inputProps.disabled,
|
|
40
41
|
}) },
|
|
41
|
-
react_1.default.createElement("input", Object.assign({}, (0,
|
|
42
|
+
react_1.default.createElement("input", Object.assign({}, (0, util_1.omit)(props, [
|
|
42
43
|
"children",
|
|
43
44
|
"size",
|
|
44
45
|
"error",
|
|
@@ -62,7 +63,7 @@ exports.Checkbox = (0, react_1.forwardRef)((props, ref) => {
|
|
|
62
63
|
react_1.default.createElement("span", { className: (0, clsx_1.default)("navds-checkbox__content", {
|
|
63
64
|
"navds-sr-only": props.hideLabel,
|
|
64
65
|
}) },
|
|
65
|
-
react_1.default.createElement(
|
|
66
|
-
props.description && (react_1.default.createElement(Description, { as: "span",
|
|
66
|
+
react_1.default.createElement(typography_1.BodyShort, { as: "span", size: size }, props.children),
|
|
67
|
+
props.description && (react_1.default.createElement(Description, { as: "span", className: "navds-checkbox__description" }, props.description))))));
|
|
67
68
|
});
|
|
68
69
|
exports.default = exports.Checkbox;
|
package/cjs/form/radio/Radio.js
CHANGED
|
@@ -29,19 +29,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
exports.Radio = void 0;
|
|
30
30
|
const clsx_1 = __importDefault(require("clsx"));
|
|
31
31
|
const react_1 = __importStar(require("react"));
|
|
32
|
-
const
|
|
32
|
+
const typography_1 = require("../../typography");
|
|
33
|
+
const util_1 = require("../../util");
|
|
33
34
|
const useRadio_1 = require("./useRadio");
|
|
34
35
|
exports.Radio = (0, react_1.forwardRef)((props, ref) => {
|
|
35
36
|
const { inputProps, size, hasError } = (0, useRadio_1.useRadio)(props);
|
|
36
|
-
const Description = size === "medium" ?
|
|
37
|
+
const Description = size === "medium" ? typography_1.BodyLong : typography_1.Detail;
|
|
37
38
|
return (react_1.default.createElement("div", { className: (0, clsx_1.default)(props.className, "navds-radio", `navds-radio--${size}`, {
|
|
38
39
|
"navds-radio--error": hasError,
|
|
39
40
|
"navds-radio--disabled": inputProps.disabled,
|
|
40
41
|
}) },
|
|
41
|
-
react_1.default.createElement("input", Object.assign({}, (0,
|
|
42
|
+
react_1.default.createElement("input", Object.assign({}, (0, util_1.omit)(props, ["children", "size", "description"]), inputProps, { className: "navds-radio__input", ref: ref })),
|
|
42
43
|
react_1.default.createElement("label", { htmlFor: inputProps.id, className: "navds-radio__label" },
|
|
43
44
|
react_1.default.createElement("span", { className: "navds-radio__content" },
|
|
44
|
-
react_1.default.createElement(
|
|
45
|
-
props.description && (react_1.default.createElement(Description, { as: "span",
|
|
45
|
+
react_1.default.createElement(typography_1.BodyShort, { as: "span", size: size }, props.children),
|
|
46
|
+
props.description && (react_1.default.createElement(Description, { as: "span", className: "navds-radio__description" }, props.description))))));
|
|
46
47
|
});
|
|
47
48
|
exports.default = exports.Radio;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import React, { forwardRef } from "react";
|
|
2
1
|
import cl from "clsx";
|
|
2
|
+
import React, { forwardRef } from "react";
|
|
3
|
+
import { BodyLong, BodyShort, Detail } from "../../typography";
|
|
4
|
+
import { omit } from "../../util";
|
|
3
5
|
import useCheckbox from "./useCheckbox";
|
|
4
|
-
import { BodyShort, Detail, omit } from "../..";
|
|
5
6
|
export const Checkbox = forwardRef((props, ref) => {
|
|
6
7
|
const { inputProps, hasError, size } = useCheckbox(props);
|
|
7
|
-
const Description = size === "medium" ?
|
|
8
|
+
const Description = size === "medium" ? BodyLong : Detail;
|
|
8
9
|
return (React.createElement("div", { className: cl(props.className, "navds-checkbox", `navds-checkbox--${size}`, {
|
|
9
10
|
"navds-checkbox--error": hasError,
|
|
10
11
|
"navds-checkbox--disabled": inputProps.disabled,
|
|
@@ -34,7 +35,7 @@ export const Checkbox = forwardRef((props, ref) => {
|
|
|
34
35
|
"navds-sr-only": props.hideLabel,
|
|
35
36
|
}) },
|
|
36
37
|
React.createElement(BodyShort, { as: "span", size: size }, props.children),
|
|
37
|
-
props.description && (React.createElement(Description, { as: "span",
|
|
38
|
+
props.description && (React.createElement(Description, { as: "span", className: "navds-checkbox__description" }, props.description))))));
|
|
38
39
|
});
|
|
39
40
|
export default Checkbox;
|
|
40
41
|
//# sourceMappingURL=Checkbox.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.js","sourceRoot":"","sources":["../../../src/form/checkbox/Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAuB,MAAM,OAAO,CAAC;AAC/D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Checkbox.js","sourceRoot":"","sources":["../../../src/form/checkbox/Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EAAE,UAAU,EAAuB,MAAM,OAAO,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,OAAO,WAAW,MAAM,eAAe,CAAC;AAqCxC,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAChC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACb,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;IAE1D,MAAM,WAAW,GAAG,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC;IAE1D,OAAO,CACL,6BACE,SAAS,EAAE,EAAE,CACX,KAAK,CAAC,SAAS,EACf,gBAAgB,EAChB,mBAAmB,IAAI,EAAE,EACzB;YACE,uBAAuB,EAAE,QAAQ;YACjC,0BAA0B,EAAE,UAAU,CAAC,QAAQ;SAChD,CACF;QAED,+CACM,IAAI,CAAC,KAAK,EAAE;YACd,UAAU;YACV,MAAM;YACN,OAAO;YACP,aAAa;YACb,WAAW;YACX,eAAe;YACf,SAAS;SACV,CAAC,EACE,UAAU,IACd,IAAI,EAAC,UAAU,EACf,SAAS,EAAC,uBAAuB,kBACnB,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,EAChE,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE;;gBACV,IAAI,EAAE,EAAE;oBACN,EAAE,CAAC,aAAa,GAAG,MAAA,KAAK,CAAC,aAAa,mCAAI,KAAK,CAAC;iBACjD;gBAED,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE;oBAC7B,GAAG,CAAC,EAAE,CAAC,CAAC;iBACT;qBAAM,IAAI,GAAG,IAAI,IAAI,EAAE;oBACtB,GAAG,CAAC,OAAO,GAAG,EAAE,CAAC;iBAClB;YACH,CAAC,IACD;QACF,+BAAO,OAAO,EAAE,UAAU,CAAC,EAAE,EAAE,SAAS,EAAC,uBAAuB;YAC9D,8BACE,SAAS,EAAE,EAAE,CAAC,yBAAyB,EAAE;oBACvC,eAAe,EAAE,KAAK,CAAC,SAAS;iBACjC,CAAC;gBAEF,oBAAC,SAAS,IAAC,EAAE,EAAC,MAAM,EAAC,IAAI,EAAE,IAAI,IAC5B,KAAK,CAAC,QAAQ,CACL;gBACX,KAAK,CAAC,WAAW,IAAI,CACpB,oBAAC,WAAW,IAAC,EAAE,EAAC,MAAM,EAAC,SAAS,EAAC,6BAA6B,IAC3D,KAAK,CAAC,WAAW,CACN,CACf,CACI,CACD,CACJ,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
package/esm/form/radio/Radio.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { forwardRef } from "react";
|
|
3
|
-
import { BodyShort, Detail
|
|
3
|
+
import { BodyLong, BodyShort, Detail } from "../../typography";
|
|
4
|
+
import { omit } from "../../util";
|
|
4
5
|
import { useRadio } from "./useRadio";
|
|
5
6
|
export const Radio = forwardRef((props, ref) => {
|
|
6
7
|
const { inputProps, size, hasError } = useRadio(props);
|
|
7
|
-
const Description = size === "medium" ?
|
|
8
|
+
const Description = size === "medium" ? BodyLong : Detail;
|
|
8
9
|
return (React.createElement("div", { className: cl(props.className, "navds-radio", `navds-radio--${size}`, {
|
|
9
10
|
"navds-radio--error": hasError,
|
|
10
11
|
"navds-radio--disabled": inputProps.disabled,
|
|
@@ -13,7 +14,7 @@ export const Radio = forwardRef((props, ref) => {
|
|
|
13
14
|
React.createElement("label", { htmlFor: inputProps.id, className: "navds-radio__label" },
|
|
14
15
|
React.createElement("span", { className: "navds-radio__content" },
|
|
15
16
|
React.createElement(BodyShort, { as: "span", size: size }, props.children),
|
|
16
|
-
props.description && (React.createElement(Description, { as: "span",
|
|
17
|
+
props.description && (React.createElement(Description, { as: "span", className: "navds-radio__description" }, props.description))))));
|
|
17
18
|
});
|
|
18
19
|
export default Radio;
|
|
19
20
|
//# sourceMappingURL=Radio.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.js","sourceRoot":"","sources":["../../../src/form/radio/Radio.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EAAE,UAAU,EAAuB,MAAM,OAAO,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Radio.js","sourceRoot":"","sources":["../../../src/form/radio/Radio.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EAAE,UAAU,EAAuB,MAAM,OAAO,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAmBtC,MAAM,CAAC,MAAM,KAAK,GAAG,UAAU,CAA+B,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IAC3E,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAEvD,MAAM,WAAW,GAAG,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC;IAE1D,OAAO,CACL,6BACE,SAAS,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,EAAE,aAAa,EAAE,gBAAgB,IAAI,EAAE,EAAE;YACpE,oBAAoB,EAAE,QAAQ;YAC9B,uBAAuB,EAAE,UAAU,CAAC,QAAQ;SAC7C,CAAC;QAEF,+CACM,IAAI,CAAC,KAAK,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,EAChD,UAAU,IACd,SAAS,EAAC,oBAAoB,EAC9B,GAAG,EAAE,GAAG,IACR;QACF,+BAAO,OAAO,EAAE,UAAU,CAAC,EAAE,EAAE,SAAS,EAAC,oBAAoB;YAC3D,8BAAM,SAAS,EAAC,sBAAsB;gBACpC,oBAAC,SAAS,IAAC,EAAE,EAAC,MAAM,EAAC,IAAI,EAAE,IAAI,IAC5B,KAAK,CAAC,QAAQ,CACL;gBACX,KAAK,CAAC,WAAW,IAAI,CACpB,oBAAC,WAAW,IAAC,EAAE,EAAC,MAAM,EAAC,SAAS,EAAC,0BAA0B,IACxD,KAAK,CAAC,WAAW,CACN,CACf,CACI,CACD,CACJ,CACP,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,KAAK,CAAC"}
|
|
@@ -34,7 +34,7 @@ export declare const useFormField: (props: FormFieldProps, prefix: string) => {
|
|
|
34
34
|
hasError: boolean;
|
|
35
35
|
errorId: string;
|
|
36
36
|
inputDescriptionId: string;
|
|
37
|
-
size: "
|
|
37
|
+
size: "small" | "medium";
|
|
38
38
|
inputProps: {
|
|
39
39
|
id: string;
|
|
40
40
|
"aria-invalid": boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@navikt/ds-react",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.8",
|
|
4
4
|
"description": "Aksel react-components for NAV designsystem",
|
|
5
5
|
"author": "Aksel | NAV designsystem team",
|
|
6
6
|
"license": "MIT",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@floating-ui/react": "0.17.0",
|
|
40
|
-
"@navikt/aksel-icons": "^2.8.
|
|
41
|
-
"@navikt/ds-icons": "^2.8.
|
|
40
|
+
"@navikt/aksel-icons": "^2.8.8",
|
|
41
|
+
"@navikt/ds-icons": "^2.8.8",
|
|
42
42
|
"@radix-ui/react-tabs": "1.0.0",
|
|
43
43
|
"@radix-ui/react-toggle-group": "1.0.0",
|
|
44
44
|
"clsx": "^1.2.1",
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import React, { forwardRef, InputHTMLAttributes } from "react";
|
|
2
1
|
import cl from "clsx";
|
|
3
|
-
import
|
|
2
|
+
import React, { forwardRef, InputHTMLAttributes } from "react";
|
|
3
|
+
import { BodyLong, BodyShort, Detail } from "../../typography";
|
|
4
|
+
import { omit } from "../../util";
|
|
4
5
|
import { FormFieldProps } from "../useFormField";
|
|
5
|
-
import
|
|
6
|
+
import useCheckbox from "./useCheckbox";
|
|
6
7
|
|
|
7
8
|
export interface CheckboxProps
|
|
8
9
|
extends FormFieldProps,
|
|
@@ -43,7 +44,7 @@ export const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(
|
|
|
43
44
|
(props, ref) => {
|
|
44
45
|
const { inputProps, hasError, size } = useCheckbox(props);
|
|
45
46
|
|
|
46
|
-
const Description = size === "medium" ?
|
|
47
|
+
const Description = size === "medium" ? BodyLong : Detail;
|
|
47
48
|
|
|
48
49
|
return (
|
|
49
50
|
<div
|
|
@@ -93,11 +94,7 @@ export const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(
|
|
|
93
94
|
{props.children}
|
|
94
95
|
</BodyShort>
|
|
95
96
|
{props.description && (
|
|
96
|
-
<Description
|
|
97
|
-
as="span"
|
|
98
|
-
size="small"
|
|
99
|
-
className="navds-checkbox__description"
|
|
100
|
-
>
|
|
97
|
+
<Description as="span" className="navds-checkbox__description">
|
|
101
98
|
{props.description}
|
|
102
99
|
</Description>
|
|
103
100
|
)}
|
package/src/form/radio/Radio.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { forwardRef, InputHTMLAttributes } from "react";
|
|
3
|
-
import { BodyShort, Detail
|
|
3
|
+
import { BodyLong, BodyShort, Detail } from "../../typography";
|
|
4
|
+
import { omit } from "../../util";
|
|
4
5
|
import { FormFieldProps } from "../useFormField";
|
|
5
6
|
import { useRadio } from "./useRadio";
|
|
6
7
|
|
|
@@ -24,7 +25,7 @@ export interface RadioProps
|
|
|
24
25
|
export const Radio = forwardRef<HTMLInputElement, RadioProps>((props, ref) => {
|
|
25
26
|
const { inputProps, size, hasError } = useRadio(props);
|
|
26
27
|
|
|
27
|
-
const Description = size === "medium" ?
|
|
28
|
+
const Description = size === "medium" ? BodyLong : Detail;
|
|
28
29
|
|
|
29
30
|
return (
|
|
30
31
|
<div
|
|
@@ -45,11 +46,7 @@ export const Radio = forwardRef<HTMLInputElement, RadioProps>((props, ref) => {
|
|
|
45
46
|
{props.children}
|
|
46
47
|
</BodyShort>
|
|
47
48
|
{props.description && (
|
|
48
|
-
<Description
|
|
49
|
-
as="span"
|
|
50
|
-
size="small"
|
|
51
|
-
className="navds-radio__description"
|
|
52
|
-
>
|
|
49
|
+
<Description as="span" className="navds-radio__description">
|
|
53
50
|
{props.description}
|
|
54
51
|
</Description>
|
|
55
52
|
)}
|