@navikt/ds-react 3.0.1 → 3.1.1
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/Fieldset/Fieldset.js +3 -6
- package/cjs/form/Select.js +3 -5
- package/cjs/form/Switch.js +1 -2
- package/cjs/form/TextField.js +3 -5
- package/cjs/form/Textarea.js +5 -8
- package/cjs/form/checkbox/Checkbox.js +1 -2
- package/cjs/form/radio/Radio.js +1 -2
- package/cjs/form/search/Search.js +2 -2
- package/esm/form/Fieldset/Fieldset.js +4 -7
- package/esm/form/Fieldset/Fieldset.js.map +1 -1
- package/esm/form/Select.js +4 -6
- package/esm/form/Select.js.map +1 -1
- package/esm/form/Switch.js +2 -3
- package/esm/form/Switch.js.map +1 -1
- package/esm/form/TextField.js +4 -6
- package/esm/form/TextField.js.map +1 -1
- package/esm/form/Textarea.js +5 -8
- package/esm/form/Textarea.js.map +1 -1
- package/esm/form/checkbox/Checkbox.js +2 -3
- package/esm/form/checkbox/Checkbox.js.map +1 -1
- package/esm/form/radio/Radio.js +2 -3
- package/esm/form/radio/Radio.js.map +1 -1
- package/esm/form/search/Search.js +2 -2
- package/esm/form/search/Search.js.map +1 -1
- package/package.json +2 -2
- package/src/form/Fieldset/Fieldset.tsx +13 -25
- package/src/form/Select.tsx +12 -27
- package/src/form/Switch.tsx +5 -7
- package/src/form/TextField.tsx +12 -27
- package/src/form/Textarea.tsx +13 -29
- package/src/form/checkbox/Checkbox.tsx +7 -5
- package/src/form/radio/Radio.tsx +7 -5
- package/src/form/radio/radio.stories.tsx +3 -1
- package/src/form/search/Search.tsx +1 -1
|
@@ -61,12 +61,9 @@ exports.Fieldset = (0, react_1.forwardRef)((props, ref) => {
|
|
|
61
61
|
react_1.default.createElement(__1.Label, { size: size, as: "legend", className: (0, clsx_1.default)("navds-fieldset__legend", {
|
|
62
62
|
"navds-sr-only": !!hideLegend,
|
|
63
63
|
}) }, legend),
|
|
64
|
-
!!description &&
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}), id: inputDescriptionId, size: "small", as: "div" }, props.description)) : (react_1.default.createElement(__1.Detail, { className: (0, clsx_1.default)("navds-fieldset__description", {
|
|
68
|
-
"navds-sr-only": !!hideLegend,
|
|
69
|
-
}), id: inputDescriptionId, size: "small", as: "div" }, props.description))),
|
|
64
|
+
!!description && (react_1.default.createElement(__1.BodyShort, { className: (0, clsx_1.default)("navds-fieldset__description", {
|
|
65
|
+
"navds-sr-only": !!hideLegend,
|
|
66
|
+
}), id: inputDescriptionId, size: size !== null && size !== void 0 ? size : "medium", as: "div" }, props.description)),
|
|
70
67
|
children,
|
|
71
68
|
react_1.default.createElement("div", { id: errorId, "aria-relevant": "additions removals", "aria-live": "polite", className: "navds-fieldset__error" }, showErrorMsg && (react_1.default.createElement(__1.ErrorMessage, { size: size }, props.error))))));
|
|
72
69
|
});
|
package/cjs/form/Select.js
CHANGED
|
@@ -38,8 +38,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
38
38
|
};
|
|
39
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
40
|
exports.Select = void 0;
|
|
41
|
-
const react_1 = __importStar(require("react"));
|
|
42
41
|
const clsx_1 = __importDefault(require("clsx"));
|
|
42
|
+
const react_1 = __importStar(require("react"));
|
|
43
43
|
const aksel_icons_1 = require("@navikt/aksel-icons");
|
|
44
44
|
const __1 = require("..");
|
|
45
45
|
const useFormField_1 = require("./useFormField");
|
|
@@ -53,11 +53,9 @@ exports.Select = (0, react_1.forwardRef)((props, ref) => {
|
|
|
53
53
|
react_1.default.createElement(__1.Label, { htmlFor: inputProps.id, size: size, className: (0, clsx_1.default)("navds-form-field__label", {
|
|
54
54
|
"navds-sr-only": hideLabel,
|
|
55
55
|
}) }, label),
|
|
56
|
-
!!description && (react_1.default.createElement(
|
|
57
|
-
"navds-sr-only": hideLabel,
|
|
58
|
-
}), id: inputDescriptionId, size: "small", as: "div" }, description)) : (react_1.default.createElement(__1.Detail, { className: (0, clsx_1.default)("navds-form-field__description", {
|
|
56
|
+
!!description && (react_1.default.createElement(__1.BodyShort, { className: (0, clsx_1.default)("navds-form-field__description", {
|
|
59
57
|
"navds-sr-only": hideLabel,
|
|
60
|
-
}), id: inputDescriptionId, size:
|
|
58
|
+
}), id: inputDescriptionId, size: size, as: "div" }, description)),
|
|
61
59
|
react_1.default.createElement("div", { className: "navds-select__container", style: style },
|
|
62
60
|
react_1.default.createElement("select", Object.assign({}, (0, __1.omit)(rest, ["error", "errorId", "size"]), inputProps, { ref: ref, className: (0, clsx_1.default)("navds-select__input", "navds-body-short", `navds-body--${size !== null && size !== void 0 ? size : "medium"}`), size: props.htmlSize }), children),
|
|
63
61
|
react_1.default.createElement(aksel_icons_1.ChevronDownIcon, { className: "navds-select__chevron", "aria-hidden": true })),
|
package/cjs/form/Switch.js
CHANGED
|
@@ -48,7 +48,6 @@ exports.Switch = (0, react_1.forwardRef)((props, ref) => {
|
|
|
48
48
|
var _a, _b, _c;
|
|
49
49
|
const { inputProps, size } = (0, useFormField_1.useFormField)(props, "switch");
|
|
50
50
|
const { children, className, description, hideLabel = false, loading, checked: checkedProp, defaultChecked, position = "left" } = props, rest = __rest(props, ["children", "className", "description", "hideLabel", "loading", "checked", "defaultChecked", "position"]);
|
|
51
|
-
const Description = size === "medium" ? __1.BodyShort : __1.Detail;
|
|
52
51
|
const [checked, setChecked] = (0, react_1.useState)((_a = defaultChecked !== null && defaultChecked !== void 0 ? defaultChecked : checkedProp) !== null && _a !== void 0 ? _a : false);
|
|
53
52
|
(0, react_1.useEffect)(() => {
|
|
54
53
|
checkedProp !== undefined && setChecked(checkedProp);
|
|
@@ -70,6 +69,6 @@ exports.Switch = (0, react_1.forwardRef)((props, ref) => {
|
|
|
70
69
|
"navds-switch--with-description": !!description && !hideLabel,
|
|
71
70
|
}) },
|
|
72
71
|
react_1.default.createElement(__1.BodyShort, { as: "div", size: size, className: "navds-switch__label" }, children),
|
|
73
|
-
description && (react_1.default.createElement(
|
|
72
|
+
description && (react_1.default.createElement(__1.BodyShort, { size: size, as: "div", className: "navds-form-field__subdescription navds-switch__description" }, description))))));
|
|
74
73
|
});
|
|
75
74
|
exports.default = exports.Switch;
|
package/cjs/form/TextField.js
CHANGED
|
@@ -38,8 +38,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
38
38
|
};
|
|
39
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
40
|
exports.TextField = void 0;
|
|
41
|
-
const react_1 = __importStar(require("react"));
|
|
42
41
|
const clsx_1 = __importDefault(require("clsx"));
|
|
42
|
+
const react_1 = __importStar(require("react"));
|
|
43
43
|
const __1 = require("..");
|
|
44
44
|
const useFormField_1 = require("./useFormField");
|
|
45
45
|
exports.TextField = (0, react_1.forwardRef)((props, ref) => {
|
|
@@ -53,11 +53,9 @@ exports.TextField = (0, react_1.forwardRef)((props, ref) => {
|
|
|
53
53
|
react_1.default.createElement(__1.Label, { htmlFor: inputProps.id, size: size, className: (0, clsx_1.default)("navds-form-field__label", {
|
|
54
54
|
"navds-sr-only": hideLabel,
|
|
55
55
|
}) }, label),
|
|
56
|
-
!!description && (react_1.default.createElement(
|
|
57
|
-
"navds-sr-only": hideLabel,
|
|
58
|
-
}), id: inputDescriptionId, size: "small", as: "div" }, description)) : (react_1.default.createElement(__1.Detail, { className: (0, clsx_1.default)("navds-form-field__description", {
|
|
56
|
+
!!description && (react_1.default.createElement(__1.BodyShort, { className: (0, clsx_1.default)("navds-form-field__description", {
|
|
59
57
|
"navds-sr-only": hideLabel,
|
|
60
|
-
}), id: inputDescriptionId, size:
|
|
58
|
+
}), id: inputDescriptionId, size: size, as: "div" }, description)),
|
|
61
59
|
react_1.default.createElement("input", Object.assign({}, (0, __1.omit)(rest, ["error", "errorId", "size"]), inputProps, { ref: ref, type: type, className: (0, clsx_1.default)("navds-text-field__input", "navds-body-short", `navds-body-${size !== null && size !== void 0 ? size : "medium"}`), size: htmlSize })),
|
|
62
60
|
react_1.default.createElement("div", { className: "navds-form-field__error", id: errorId, "aria-relevant": "additions removals", "aria-live": "polite" }, showErrorMsg && (react_1.default.createElement(__1.ErrorMessage, { size: size }, props.error)))));
|
|
63
61
|
});
|
package/cjs/form/Textarea.js
CHANGED
|
@@ -38,17 +38,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
38
38
|
};
|
|
39
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
40
|
exports.Counter = exports.Textarea = void 0;
|
|
41
|
-
const react_1 = __importStar(require("react"));
|
|
42
41
|
const clsx_1 = __importDefault(require("clsx"));
|
|
42
|
+
const react_1 = __importStar(require("react"));
|
|
43
43
|
const __1 = require("..");
|
|
44
|
-
const useFormField_1 = require("./useFormField");
|
|
45
|
-
const __2 = require("..");
|
|
46
44
|
const TextareaAutoSize_1 = __importDefault(require("../util/TextareaAutoSize"));
|
|
45
|
+
const useFormField_1 = require("./useFormField");
|
|
47
46
|
exports.Textarea = (0, react_1.forwardRef)((props, ref) => {
|
|
48
47
|
var _a, _b, _c;
|
|
49
48
|
const { inputProps, errorId, showErrorMsg, hasError, size, inputDescriptionId, } = (0, useFormField_1.useFormField)(props, "textarea");
|
|
50
49
|
const { label, className, description, maxLength, hideLabel = false, resize, i18n } = props, rest = __rest(props, ["label", "className", "description", "maxLength", "hideLabel", "resize", "i18n"]);
|
|
51
|
-
const maxLengthId = (0,
|
|
50
|
+
const maxLengthId = (0, __1.useId)();
|
|
52
51
|
const hasMaxLength = maxLength !== undefined && maxLength > 0;
|
|
53
52
|
const [controlledValue, setControlledValue] = (0, react_1.useState)((_a = props === null || props === void 0 ? void 0 : props.defaultValue) !== null && _a !== void 0 ? _a : "");
|
|
54
53
|
const getMinRows = () => {
|
|
@@ -69,11 +68,9 @@ exports.Textarea = (0, react_1.forwardRef)((props, ref) => {
|
|
|
69
68
|
react_1.default.createElement(__1.Label, { htmlFor: inputProps.id, size: size, className: (0, clsx_1.default)("navds-form-field__label", {
|
|
70
69
|
"navds-sr-only": hideLabel,
|
|
71
70
|
}) }, label),
|
|
72
|
-
!!description && (react_1.default.createElement(
|
|
73
|
-
"navds-sr-only": hideLabel,
|
|
74
|
-
}), id: inputDescriptionId, size: "small", as: "div" }, description)) : (react_1.default.createElement(__1.Detail, { className: (0, clsx_1.default)("navds-form-field__description", {
|
|
71
|
+
!!description && (react_1.default.createElement(__1.BodyShort, { className: (0, clsx_1.default)("navds-form-field__description", {
|
|
75
72
|
"navds-sr-only": hideLabel,
|
|
76
|
-
}), id: inputDescriptionId, size:
|
|
73
|
+
}), id: inputDescriptionId, size: size, as: "div" }, description)),
|
|
77
74
|
react_1.default.createElement("div", { className: "navds-textarea__wrapper" },
|
|
78
75
|
react_1.default.createElement(TextareaAutoSize_1.default, Object.assign({}, (0, __1.omit)(rest, ["error", "errorId", "size"]), inputProps, { onChange: (e) => props.onChange
|
|
79
76
|
? props.onChange(e)
|
|
@@ -34,7 +34,6 @@ const util_1 = require("../../util");
|
|
|
34
34
|
const useCheckbox_1 = __importDefault(require("./useCheckbox"));
|
|
35
35
|
exports.Checkbox = (0, react_1.forwardRef)((props, ref) => {
|
|
36
36
|
const { inputProps, hasError, size } = (0, useCheckbox_1.default)(props);
|
|
37
|
-
const Description = size === "medium" ? typography_1.BodyLong : typography_1.Detail;
|
|
38
37
|
return (react_1.default.createElement("div", { className: (0, clsx_1.default)(props.className, "navds-checkbox", `navds-checkbox--${size}`, {
|
|
39
38
|
"navds-checkbox--error": hasError,
|
|
40
39
|
"navds-checkbox--disabled": inputProps.disabled,
|
|
@@ -64,6 +63,6 @@ exports.Checkbox = (0, react_1.forwardRef)((props, ref) => {
|
|
|
64
63
|
"navds-sr-only": props.hideLabel,
|
|
65
64
|
}) },
|
|
66
65
|
react_1.default.createElement(typography_1.BodyShort, { as: "span", size: size }, props.children),
|
|
67
|
-
props.description && (react_1.default.createElement(
|
|
66
|
+
props.description && (react_1.default.createElement(typography_1.BodyShort, { as: "span", size: size, className: "navds-form-field__subdescription navds-checkbox__description" }, props.description))))));
|
|
68
67
|
});
|
|
69
68
|
exports.default = exports.Checkbox;
|
package/cjs/form/radio/Radio.js
CHANGED
|
@@ -34,7 +34,6 @@ const util_1 = require("../../util");
|
|
|
34
34
|
const useRadio_1 = require("./useRadio");
|
|
35
35
|
exports.Radio = (0, react_1.forwardRef)((props, ref) => {
|
|
36
36
|
const { inputProps, size, hasError } = (0, useRadio_1.useRadio)(props);
|
|
37
|
-
const Description = size === "medium" ? typography_1.BodyLong : typography_1.Detail;
|
|
38
37
|
return (react_1.default.createElement("div", { className: (0, clsx_1.default)(props.className, "navds-radio", `navds-radio--${size}`, {
|
|
39
38
|
"navds-radio--error": hasError,
|
|
40
39
|
"navds-radio--disabled": inputProps.disabled,
|
|
@@ -43,6 +42,6 @@ exports.Radio = (0, react_1.forwardRef)((props, ref) => {
|
|
|
43
42
|
react_1.default.createElement("label", { htmlFor: inputProps.id, className: "navds-radio__label" },
|
|
44
43
|
react_1.default.createElement("span", { className: "navds-radio__content" },
|
|
45
44
|
react_1.default.createElement(typography_1.BodyShort, { as: "span", size: size }, props.children),
|
|
46
|
-
props.description && (react_1.default.createElement(
|
|
45
|
+
props.description && (react_1.default.createElement(typography_1.BodyShort, { as: "span", size: size, className: "navds-form-field__subdescription navds-radio__description" }, props.description))))));
|
|
47
46
|
});
|
|
48
47
|
exports.default = exports.Radio;
|
|
@@ -78,9 +78,9 @@ exports.Search = (0, react_1.forwardRef)((props, ref) => {
|
|
|
78
78
|
react_1.default.createElement(__1.Label, { htmlFor: inputProps.id, size: size, className: (0, clsx_1.default)("navds-form-field__label", {
|
|
79
79
|
"navds-sr-only": hideLabel,
|
|
80
80
|
}) }, label),
|
|
81
|
-
!!description && (react_1.default.createElement(__1.BodyShort, {
|
|
81
|
+
!!description && (react_1.default.createElement(__1.BodyShort, { className: (0, clsx_1.default)("navds-form-field__description", {
|
|
82
82
|
"navds-sr-only": hideLabel,
|
|
83
|
-
}), id: inputDescriptionId, size: size }, description)),
|
|
83
|
+
}), id: inputDescriptionId, size: size, as: "div" }, description)),
|
|
84
84
|
react_1.default.createElement("div", { className: "navds-search__wrapper" },
|
|
85
85
|
react_1.default.createElement("div", { className: "navds-search__wrapper-inner" },
|
|
86
86
|
variant === "simple" && (react_1.default.createElement(aksel_icons_1.MagnifyingGlassIcon, { "aria-hidden": true, className: "navds-search__search-icon" })),
|
|
@@ -11,7 +11,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import cl from "clsx";
|
|
13
13
|
import React, { forwardRef, useContext } from "react";
|
|
14
|
-
import {
|
|
14
|
+
import { BodyShort, ErrorMessage, Label, omit } from "../..";
|
|
15
15
|
import { useFieldset } from "./useFieldset";
|
|
16
16
|
export const FieldsetContext = React.createContext(null);
|
|
17
17
|
export const Fieldset = forwardRef((props, ref) => {
|
|
@@ -32,12 +32,9 @@ export const Fieldset = forwardRef((props, ref) => {
|
|
|
32
32
|
React.createElement(Label, { size: size, as: "legend", className: cl("navds-fieldset__legend", {
|
|
33
33
|
"navds-sr-only": !!hideLegend,
|
|
34
34
|
}) }, legend),
|
|
35
|
-
!!description &&
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}), id: inputDescriptionId, size: "small", as: "div" }, props.description)) : (React.createElement(Detail, { className: cl("navds-fieldset__description", {
|
|
39
|
-
"navds-sr-only": !!hideLegend,
|
|
40
|
-
}), id: inputDescriptionId, size: "small", as: "div" }, props.description))),
|
|
35
|
+
!!description && (React.createElement(BodyShort, { className: cl("navds-fieldset__description", {
|
|
36
|
+
"navds-sr-only": !!hideLegend,
|
|
37
|
+
}), id: inputDescriptionId, size: size !== null && size !== void 0 ? size : "medium", as: "div" }, props.description)),
|
|
41
38
|
children,
|
|
42
39
|
React.createElement("div", { id: errorId, "aria-relevant": "additions removals", "aria-live": "polite", className: "navds-fieldset__error" }, showErrorMsg && (React.createElement(ErrorMessage, { size: size }, props.error))))));
|
|
43
40
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Fieldset.js","sourceRoot":"","sources":["../../../src/form/Fieldset/Fieldset.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EAA0B,UAAU,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC9E,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Fieldset.js","sourceRoot":"","sources":["../../../src/form/Fieldset/Fieldset.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EAA0B,UAAU,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAE7D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAqB5C,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC,aAAa,CAChD,IAAI,CACL,CAAC;AAwBF,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAChC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;;IACb,MAAM,EACJ,UAAU,EACV,OAAO,EACP,YAAY,EACZ,QAAQ,EACR,IAAI,EACJ,kBAAkB,GACnB,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;IAEvB,MAAM,QAAQ,GAAG,UAAU,CAAC,eAAe,CAAC,CAAC;IAE7C,MAAM,EACJ,QAAQ,EACR,SAAS,EACT,gBAAgB,GAAG,IAAI,EACvB,MAAM,EACN,WAAW,EACX,UAAU,KAER,KAAK,EADJ,IAAI,UACL,KAAK,EARH,oFAQL,CAAQ,CAAC;IAEV,OAAO,CACL,oBAAC,eAAe,CAAC,QAAQ,IACvB,KAAK,EAAE;YACL,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,MAAA,KAAK,CAAC,KAAK,mCAAI,QA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I,EAAE,IAAI,IAAG,KAAK,CAAC,KAAK,CAAgB,CACvD,CACG,CACG,CACc,CAC5B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
package/esm/form/Select.js
CHANGED
|
@@ -9,10 +9,10 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import React, { forwardRef } from "react";
|
|
13
12
|
import cl from "clsx";
|
|
13
|
+
import React, { forwardRef } from "react";
|
|
14
14
|
import { ChevronDownIcon } from "@navikt/aksel-icons";
|
|
15
|
-
import {
|
|
15
|
+
import { BodyShort, ErrorMessage, Label, omit } from "..";
|
|
16
16
|
import { useFormField } from "./useFormField";
|
|
17
17
|
export const Select = forwardRef((props, ref) => {
|
|
18
18
|
const { inputProps, errorId, showErrorMsg, hasError, size, inputDescriptionId, } = useFormField(props, "textField");
|
|
@@ -24,11 +24,9 @@ export const Select = forwardRef((props, ref) => {
|
|
|
24
24
|
React.createElement(Label, { htmlFor: inputProps.id, size: size, className: cl("navds-form-field__label", {
|
|
25
25
|
"navds-sr-only": hideLabel,
|
|
26
26
|
}) }, label),
|
|
27
|
-
!!description && (React.createElement(
|
|
28
|
-
"navds-sr-only": hideLabel,
|
|
29
|
-
}), id: inputDescriptionId, size: "small", as: "div" }, description)) : (React.createElement(Detail, { className: cl("navds-form-field__description", {
|
|
27
|
+
!!description && (React.createElement(BodyShort, { className: cl("navds-form-field__description", {
|
|
30
28
|
"navds-sr-only": hideLabel,
|
|
31
|
-
}), id: inputDescriptionId, size:
|
|
29
|
+
}), id: inputDescriptionId, size: size, as: "div" }, description)),
|
|
32
30
|
React.createElement("div", { className: "navds-select__container", style: style },
|
|
33
31
|
React.createElement("select", Object.assign({}, omit(rest, ["error", "errorId", "size"]), inputProps, { ref: ref, className: cl("navds-select__input", "navds-body-short", `navds-body--${size !== null && size !== void 0 ? size : "medium"}`), size: props.htmlSize }), children),
|
|
34
32
|
React.createElement(ChevronDownIcon, { className: "navds-select__chevron", "aria-hidden": true })),
|
package/esm/form/Select.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.js","sourceRoot":"","sources":["../../src/form/Select.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Select.js","sourceRoot":"","sources":["../../src/form/Select.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EAAE,UAAU,EAAwB,MAAM,OAAO,CAAC;AAEhE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1D,OAAO,EAAkB,YAAY,EAAE,MAAM,gBAAgB,CAAC;AA2B9D,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAC9B,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACb,MAAM,EACJ,UAAU,EACV,OAAO,EACP,YAAY,EACZ,QAAQ,EACR,IAAI,EACJ,kBAAkB,GACnB,GAAG,YAAY,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;IAErC,MAAM,EACJ,QAAQ,EACR,KAAK,EACL,SAAS,EACT,WAAW,EACX,QAAQ,EACR,SAAS,GAAG,KAAK,EACjB,KAAK,KAEH,KAAK,EADJ,IAAI,UACL,KAAK,EATH,mFASL,CAAQ,CAAC;IAEV,OAAO,CACL,6BACE,SAAS,EAAE,EAAE,CACX,SAAS,EACT,kBAAkB,EAClB,qBAAqB,IAAI,EAAE,EAC3B;YACE,4BAA4B,EAAE,CAAC,CAAC,UAAU,CAAC,QAAQ;YACnD,qBAAqB,EAAE,QAAQ;SAChC,CACF;QAED,oBAAC,KAAK,IACJ,OAAO,EAAE,UAAU,CAAC,EAAE,EACtB,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,EAAE,CAAC,yBAAyB,EAAE;gBACvC,eAAe,EAAE,SAAS;aAC3B,CAAC,IAED,KAAK,CACA;QACP,CAAC,CAAC,WAAW,IAAI,CAChB,oBAAC,SAAS,IACR,SAAS,EAAE,EAAE,CAAC,+BAA+B,EAAE;gBAC7C,eAAe,EAAE,SAAS;aAC3B,CAAC,EACF,EAAE,EAAE,kBAAkB,EACtB,IAAI,EAAE,IAAI,EACV,EAAE,EAAC,KAAK,IAEP,WAAW,CACF,CACb;QACD,6BAAK,SAAS,EAAC,yBAAyB,EAAC,KAAK,EAAE,KAAK;YACnD,gDACM,IAAI,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC,EACxC,UAAU,IACd,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACX,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,QAAQ,EAAE,CAClC,EACD,IAAI,EAAE,KAAK,CAAC,QAAQ,KAEnB,QAAQ,CACF;YACT,oBAAC,eAAe,IAAC,SAAS,EAAC,uBAAuB,wBAAe,CAC7D;QACN,6BACE,SAAS,EAAC,yBAAyB,EACnC,EAAE,EAAE,OAAO,mBACG,oBAAoB,eACxB,QAAQ,IAEjB,YAAY,IAAI,CACf,oBAAC,YAAY,IAAC,IAAI,EAAE,IAAI,IAAG,KAAK,CAAC,KAAK,CAAgB,CACvD,CACG,CACF,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/esm/form/Switch.js
CHANGED
|
@@ -11,7 +11,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import cl from "clsx";
|
|
13
13
|
import React, { forwardRef, useEffect, useState, } from "react";
|
|
14
|
-
import { BodyShort,
|
|
14
|
+
import { BodyShort, Loader, omit } from "..";
|
|
15
15
|
import { useFormField } from "./useFormField";
|
|
16
16
|
const SelectedIcon = () => (React.createElement("svg", { width: "12", height: "10", viewBox: "0 0 12 10", fill: "none", xmlns: "http://www.w3.org/2000/svg", focusable: false, role: "img", "aria-hidden": true, "aria-label": "Deaktiver valg" },
|
|
17
17
|
React.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M11.2674 0.647802C11.8762 1.20971 11.9141 2.1587 11.3522 2.76743L5.35221 9.26743C5.07531 9.56739 4.68813 9.74155 4.27998 9.74971C3.87184 9.75787 3.478 9.59933 3.18934 9.31067L0.68934 6.81067C0.103553 6.22488 0.103553 5.27513 0.68934 4.68935C1.27513 4.10356 2.22487 4.10356 2.81066 4.68935L4.20673 6.08541L9.14779 0.732587C9.7097 0.123856 10.6587 0.0858967 11.2674 0.647802Z", fill: "currentColor" })));
|
|
@@ -19,7 +19,6 @@ export const Switch = forwardRef((props, ref) => {
|
|
|
19
19
|
var _a, _b, _c;
|
|
20
20
|
const { inputProps, size } = useFormField(props, "switch");
|
|
21
21
|
const { children, className, description, hideLabel = false, loading, checked: checkedProp, defaultChecked, position = "left" } = props, rest = __rest(props, ["children", "className", "description", "hideLabel", "loading", "checked", "defaultChecked", "position"]);
|
|
22
|
-
const Description = size === "medium" ? BodyShort : Detail;
|
|
23
22
|
const [checked, setChecked] = useState((_a = defaultChecked !== null && defaultChecked !== void 0 ? defaultChecked : checkedProp) !== null && _a !== void 0 ? _a : false);
|
|
24
23
|
useEffect(() => {
|
|
25
24
|
checkedProp !== undefined && setChecked(checkedProp);
|
|
@@ -41,7 +40,7 @@ export const Switch = forwardRef((props, ref) => {
|
|
|
41
40
|
"navds-switch--with-description": !!description && !hideLabel,
|
|
42
41
|
}) },
|
|
43
42
|
React.createElement(BodyShort, { as: "div", size: size, className: "navds-switch__label" }, children),
|
|
44
|
-
description && (React.createElement(
|
|
43
|
+
description && (React.createElement(BodyShort, { size: size, as: "div", className: "navds-form-field__subdescription navds-switch__description" }, description))))));
|
|
45
44
|
});
|
|
46
45
|
export default Switch;
|
|
47
46
|
//# sourceMappingURL=Switch.js.map
|
package/esm/form/Switch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.js","sourceRoot":"","sources":["../../src/form/Switch.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EACZ,UAAU,EAEV,SAAS,EACT,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"Switch.js","sourceRoot":"","sources":["../../src/form/Switch.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EACZ,UAAU,EAEV,SAAS,EACT,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC7C,OAAO,EAAkB,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9D,MAAM,YAAY,GAAG,GAAG,EAAE,CAAC,CACzB,6BACE,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,4BAA4B,EAClC,SAAS,EAAE,KAAK,EAChB,IAAI,EAAC,KAAK,qCAEC,gBAAgB;IAE3B,8BACE,QAAQ,EAAC,SAAS,EAClB,QAAQ,EAAC,SAAS,EAClB,CAAC,EAAC,uXAAuX,EACzX,IAAI,EAAC,cAAc,GACnB,CACE,CACP,CAAC;AA4BF,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAC9B,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;;IACb,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAE3D,MAAM,EACJ,QA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AAC,CAAC,EAChC,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE,qBAAqB,CAAC,IAC/C;QACF,8BAAM,SAAS,EAAC,qBAAqB;YACnC,8BAAM,SAAS,EAAC,qBAAqB,IAClC,OAAO,CAAC,CAAC,CAAC,CACT,oBAAC,MAAM,IAAC,IAAI,EAAC,QAAQ,eAAW,QAAQ,GAAG,CAC5C,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CACZ,oBAAC,YAAY,OAAG,CACjB,CAAC,CAAC,CAAC,IAAI,CACH,CACF;QACP,+BAAO,OAAO,EAAE,UAAU,CAAC,EAAE,EAAE,SAAS,EAAC,6BAA6B;YACpE,6BACE,SAAS,EAAE,EAAE,CAAC,uBAAuB,EAAE;oBACrC,eAAe,EAAE,SAAS;oBAC1B,gCAAgC,EAAE,CAAC,CAAC,WAAW,IAAI,CAAC,SAAS;iBAC9D,CAAC;gBAEF,oBAAC,SAAS,IAAC,EAAE,EAAC,KAAK,EAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAC,qBAAqB,IAC5D,QAAQ,CACC;gBACX,WAAW,IAAI,CACd,oBAAC,SAAS,IACR,IAAI,EAAE,IAAI,EACV,EAAE,EAAC,KAAK,EACR,SAAS,EAAC,4DAA4D,IAErE,WAAW,CACF,CACb,CACG,CACA,CACJ,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/esm/form/TextField.js
CHANGED
|
@@ -9,9 +9,9 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import React, { forwardRef } from "react";
|
|
13
12
|
import cl from "clsx";
|
|
14
|
-
import
|
|
13
|
+
import React, { forwardRef } from "react";
|
|
14
|
+
import { BodyShort, ErrorMessage, Label, omit } from "..";
|
|
15
15
|
import { useFormField } from "./useFormField";
|
|
16
16
|
export const TextField = forwardRef((props, ref) => {
|
|
17
17
|
const { inputProps, errorId, showErrorMsg, hasError, size, inputDescriptionId, } = useFormField(props, "textField");
|
|
@@ -24,11 +24,9 @@ export const TextField = forwardRef((props, ref) => {
|
|
|
24
24
|
React.createElement(Label, { htmlFor: inputProps.id, size: size, className: cl("navds-form-field__label", {
|
|
25
25
|
"navds-sr-only": hideLabel,
|
|
26
26
|
}) }, label),
|
|
27
|
-
!!description && (React.createElement(
|
|
28
|
-
"navds-sr-only": hideLabel,
|
|
29
|
-
}), id: inputDescriptionId, size: "small", as: "div" }, description)) : (React.createElement(Detail, { className: cl("navds-form-field__description", {
|
|
27
|
+
!!description && (React.createElement(BodyShort, { className: cl("navds-form-field__description", {
|
|
30
28
|
"navds-sr-only": hideLabel,
|
|
31
|
-
}), id: inputDescriptionId, size:
|
|
29
|
+
}), id: inputDescriptionId, size: size, as: "div" }, description)),
|
|
32
30
|
React.createElement("input", Object.assign({}, omit(rest, ["error", "errorId", "size"]), inputProps, { ref: ref, type: type, className: cl("navds-text-field__input", "navds-body-short", `navds-body-${size !== null && size !== void 0 ? size : "medium"}`), size: htmlSize })),
|
|
33
31
|
React.createElement("div", { className: "navds-form-field__error", id: errorId, "aria-relevant": "additions removals", "aria-live": "polite" }, showErrorMsg && (React.createElement(ErrorMessage, { size: size }, props.error)))));
|
|
34
32
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextField.js","sourceRoot":"","sources":["../../src/form/TextField.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAuB,MAAM,OAAO,CAAC;AAC/D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"TextField.js","sourceRoot":"","sources":["../../src/form/TextField.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,YAAY,EAAE,KAA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,GAAG,EACR,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,EAAE,CACX,yBAAyB,EACzB,kBAAkB,EAClB,cAAc,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,QAAQ,EAAE,CACjC,EACD,IAAI,EAAE,QAAQ,IACd;QACF,6BACE,SAAS,EAAC,yBAAyB,EACnC,EAAE,EAAE,OAAO,mBACG,oBAAoB,eACxB,QAAQ,IAEjB,YAAY,IAAI,CACf,oBAAC,YAAY,IAAC,IAAI,EAAE,IAAI,IAAG,KAAK,CAAC,KAAK,CAAgB,CACvD,CACG,CACF,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
package/esm/form/Textarea.js
CHANGED
|
@@ -9,12 +9,11 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import React, { forwardRef, useState } from "react";
|
|
13
12
|
import cl from "clsx";
|
|
14
|
-
import
|
|
15
|
-
import {
|
|
16
|
-
import { useId } from "..";
|
|
13
|
+
import React, { forwardRef, useState } from "react";
|
|
14
|
+
import { BodyShort, ErrorMessage, Label, omit, useId } from "..";
|
|
17
15
|
import TextareaAutosize from "../util/TextareaAutoSize";
|
|
16
|
+
import { useFormField } from "./useFormField";
|
|
18
17
|
export const Textarea = forwardRef((props, ref) => {
|
|
19
18
|
var _a, _b, _c;
|
|
20
19
|
const { inputProps, errorId, showErrorMsg, hasError, size, inputDescriptionId, } = useFormField(props, "textarea");
|
|
@@ -40,11 +39,9 @@ export const Textarea = forwardRef((props, ref) => {
|
|
|
40
39
|
React.createElement(Label, { htmlFor: inputProps.id, size: size, className: cl("navds-form-field__label", {
|
|
41
40
|
"navds-sr-only": hideLabel,
|
|
42
41
|
}) }, label),
|
|
43
|
-
!!description && (React.createElement(
|
|
44
|
-
"navds-sr-only": hideLabel,
|
|
45
|
-
}), id: inputDescriptionId, size: "small", as: "div" }, description)) : (React.createElement(Detail, { className: cl("navds-form-field__description", {
|
|
42
|
+
!!description && (React.createElement(BodyShort, { className: cl("navds-form-field__description", {
|
|
46
43
|
"navds-sr-only": hideLabel,
|
|
47
|
-
}), id: inputDescriptionId, size:
|
|
44
|
+
}), id: inputDescriptionId, size: size, as: "div" }, description)),
|
|
48
45
|
React.createElement("div", { className: "navds-textarea__wrapper" },
|
|
49
46
|
React.createElement(TextareaAutosize, Object.assign({}, omit(rest, ["error", "errorId", "size"]), inputProps, { onChange: (e) => props.onChange
|
|
50
47
|
? props.onChange(e)
|
package/esm/form/Textarea.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Textarea.js","sourceRoot":"","sources":["../../src/form/Textarea.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Textarea.js","sourceRoot":"","sources":["../../src/form/Textarea.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;AACjE,OAAO,gBAAgB,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAkB,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAqD9D,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAChC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;;IACb,MAAM,EACJ,UAAU,EACV,OAAO,EACP,YAAY,EACZ,QAAQ,EACR,IAAI,EACJ,kBAAkB,GACnB,GAAG,YAAY,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IAEpC,MAAM,EACJ,KAAK,EACL,SAAS,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AM,mCAAI,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,MAAM,EAC7D,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,IAAI,GACV,CACD,CACJ,CACG;QACN,6BACE,SAAS,EAAC,yBAAyB,EACnC,EAAE,EAAE,OAAO,mBACG,oBAAoB,eACxB,QAAQ,IAEjB,YAAY,IAAI,CACf,oBAAC,YAAY,IAAC,IAAI,EAAE,IAAI,IAAG,KAAK,CAAC,KAAK,CAAgB,CACvD,CACG,CACF,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE;;IAClE,MAAM,UAAU,GAAG,SAAS,GAAG,aAAa,CAAC;IAE7C,OAAO,CACL,oBAAC,SAAS,IACR,SAAS,EAAE,EAAE,CAAC,yBAAyB,EAAE;YACvC,gCAAgC,EAAE,UAAU,GAAG,CAAC;SACjD,CAAC,eACS,UAAU,GAAG,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,EAC7C,IAAI,EAAE,IAAI,IAET,UAAU,GAAG,CAAC;QACb,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,mCAAI,cAAc,EAAE;QAClE,CAAC,CAAC,GAAG,UAAU,IAAI,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,cAAc,mCAAI,YAAY,EAAE,CACjD,CACb,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { forwardRef } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { BodyShort } from "../../typography";
|
|
4
4
|
import { omit } from "../../util";
|
|
5
5
|
import useCheckbox from "./useCheckbox";
|
|
6
6
|
export const Checkbox = forwardRef((props, ref) => {
|
|
7
7
|
const { inputProps, hasError, size } = useCheckbox(props);
|
|
8
|
-
const Description = size === "medium" ? BodyLong : Detail;
|
|
9
8
|
return (React.createElement("div", { className: cl(props.className, "navds-checkbox", `navds-checkbox--${size}`, {
|
|
10
9
|
"navds-checkbox--error": hasError,
|
|
11
10
|
"navds-checkbox--disabled": inputProps.disabled,
|
|
@@ -35,7 +34,7 @@ export const Checkbox = forwardRef((props, ref) => {
|
|
|
35
34
|
"navds-sr-only": props.hideLabel,
|
|
36
35
|
}) },
|
|
37
36
|
React.createElement(BodyShort, { as: "span", size: size }, props.children),
|
|
38
|
-
props.description && (React.createElement(
|
|
37
|
+
props.description && (React.createElement(BodyShort, { as: "span", size: size, className: "navds-form-field__subdescription navds-checkbox__description" }, props.description))))));
|
|
39
38
|
});
|
|
40
39
|
export default Checkbox;
|
|
41
40
|
//# sourceMappingURL=Checkbox.js.map
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,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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MAAM,EACT,IAAI,EAAE,IAAI,EACV,SAAS,EAAC,8DAA8D,IAEvE,KAAK,CAAC,WAAW,CACR,CACb,CACI,CACD,CACJ,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
package/esm/form/radio/Radio.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { forwardRef } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { BodyShort } from "../../typography";
|
|
4
4
|
import { omit } from "../../util";
|
|
5
5
|
import { useRadio } from "./useRadio";
|
|
6
6
|
export const Radio = forwardRef((props, ref) => {
|
|
7
7
|
const { inputProps, size, hasError } = useRadio(props);
|
|
8
|
-
const Description = size === "medium" ? BodyLong : Detail;
|
|
9
8
|
return (React.createElement("div", { className: cl(props.className, "navds-radio", `navds-radio--${size}`, {
|
|
10
9
|
"navds-radio--error": hasError,
|
|
11
10
|
"navds-radio--disabled": inputProps.disabled,
|
|
@@ -14,7 +13,7 @@ export const Radio = forwardRef((props, ref) => {
|
|
|
14
13
|
React.createElement("label", { htmlFor: inputProps.id, className: "navds-radio__label" },
|
|
15
14
|
React.createElement("span", { className: "navds-radio__content" },
|
|
16
15
|
React.createElement(BodyShort, { as: "span", size: size }, props.children),
|
|
17
|
-
props.description && (React.createElement(
|
|
16
|
+
props.description && (React.createElement(BodyShort, { as: "span", size: size, className: "navds-form-field__subdescription navds-radio__description" }, props.description))))));
|
|
18
17
|
});
|
|
19
18
|
export default Radio;
|
|
20
19
|
//# 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,
|
|
1
|
+
{"version":3,"file":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AAC,CAAC;AAEH,eAAe,KAAK,CAAC"}
|
|
@@ -49,9 +49,9 @@ export const Search = forwardRef((props, ref) => {
|
|
|
49
49
|
React.createElement(Label, { htmlFor: inputProps.id, size: size, className: cl("navds-form-field__label", {
|
|
50
50
|
"navds-sr-only": hideLabel,
|
|
51
51
|
}) }, label),
|
|
52
|
-
!!description && (React.createElement(BodyShort, {
|
|
52
|
+
!!description && (React.createElement(BodyShort, { className: cl("navds-form-field__description", {
|
|
53
53
|
"navds-sr-only": hideLabel,
|
|
54
|
-
}), id: inputDescriptionId, size: size }, description)),
|
|
54
|
+
}), id: inputDescriptionId, size: size, as: "div" }, description)),
|
|
55
55
|
React.createElement("div", { className: "navds-search__wrapper" },
|
|
56
56
|
React.createElement("div", { className: "navds-search__wrapper-inner" },
|
|
57
57
|
variant === "simple" && (React.createElement(MagnifyingGlassIcon, { "aria-hidden": true, className: "navds-search__search-icon" })),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Search.js","sourceRoot":"","sources":["../../../src/form/search/Search.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EACZ,UAAU,EAEV,WAAW,EACX,OAAO,EACP,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EACL,SAAS,EACT,YAAY,EACZ,KAAK,EACL,SAAS,EACT,IAAI,EACJ,gBAAgB,GACjB,MAAM,OAAO,CAAC;AACf,OAAO,EAAkB,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,YAAkC,MAAM,gBAAgB,CAAC;AAkEhE,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,CAAC,aAAa,CAC9C,IAAI,CACL,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAC9B,CAAC,KAAK,EAAE,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EAAC,QAAQ,EACb,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAC3D,SAAS,EAAC,4BAA4B;oBAEtC,8BAAM,SAAS,EAAC,eAAe,IAC5B,gBAAgB,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,KAAK,CACvC;oBACP,oBAAC,SAAS,0BAAe,CAClB,CACV,CACG;YACN,oBAAC,aAAa,CAAC,QAAQ,IACrB,KAAK,EAAE;oBACL,IAAI;oBACJ,QAAQ,EAAE,UAAU,CAAC,QAAQ;oBAC7B,OAAO;oBACP,WAAW;iBACZ,IAEA,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,KAAK,QAAQ,IAAI,oBAAC,YAAY,OAAG,CACxC,CACrB;QACN,6BACE,SAAS,EAAC,yBAAyB,EACnC,EAAE,EAAE,OAAO,mBACG,oBAAoB,eACxB,QAAQ,IAEjB,YAAY,IAAI,CACf,oBAAC,YAAY,IAAC,IAAI,EAAE,IAAI,IAAG,KAAK,CAAC,KAAK,CAAgB,CACvD,CACG,CACF,CACP,CAAC;AACJ,CAAC,CACiB,CAAC;AAErB,MAAM,CAAC,MAAM,GAAG,YAAY,CAAC;AAE7B,eAAe,MAAM,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@navikt/ds-react",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"description": "Aksel react-components for NAV designsystem",
|
|
5
5
|
"author": "Aksel | NAV designsystem team",
|
|
6
6
|
"license": "MIT",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@floating-ui/react": "0.17.0",
|
|
41
|
-
"@navikt/aksel-icons": "^3.
|
|
41
|
+
"@navikt/aksel-icons": "^3.1.1",
|
|
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,6 +1,6 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { FieldsetHTMLAttributes, forwardRef, useContext } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { BodyShort, ErrorMessage, Label, omit } from "../..";
|
|
4
4
|
import { FormFieldProps } from "../useFormField";
|
|
5
5
|
import { useFieldset } from "./useFieldset";
|
|
6
6
|
|
|
@@ -104,30 +104,18 @@ export const Fieldset = forwardRef<HTMLFieldSetElement, FieldsetProps>(
|
|
|
104
104
|
>
|
|
105
105
|
{legend}
|
|
106
106
|
</Label>
|
|
107
|
-
{!!description &&
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
) : (
|
|
120
|
-
<Detail
|
|
121
|
-
className={cl("navds-fieldset__description", {
|
|
122
|
-
"navds-sr-only": !!hideLegend,
|
|
123
|
-
})}
|
|
124
|
-
id={inputDescriptionId}
|
|
125
|
-
size="small"
|
|
126
|
-
as="div"
|
|
127
|
-
>
|
|
128
|
-
{props.description}
|
|
129
|
-
</Detail>
|
|
130
|
-
))}
|
|
107
|
+
{!!description && (
|
|
108
|
+
<BodyShort
|
|
109
|
+
className={cl("navds-fieldset__description", {
|
|
110
|
+
"navds-sr-only": !!hideLegend,
|
|
111
|
+
})}
|
|
112
|
+
id={inputDescriptionId}
|
|
113
|
+
size={size ?? "medium"}
|
|
114
|
+
as="div"
|
|
115
|
+
>
|
|
116
|
+
{props.description}
|
|
117
|
+
</BodyShort>
|
|
118
|
+
)}
|
|
131
119
|
{children}
|
|
132
120
|
<div
|
|
133
121
|
id={errorId}
|
package/src/form/Select.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React, { forwardRef, SelectHTMLAttributes } from "react";
|
|
2
1
|
import cl from "clsx";
|
|
2
|
+
import React, { forwardRef, SelectHTMLAttributes } from "react";
|
|
3
3
|
|
|
4
4
|
import { ChevronDownIcon } from "@navikt/aksel-icons";
|
|
5
|
-
import {
|
|
5
|
+
import { BodyShort, ErrorMessage, Label, omit } from "..";
|
|
6
6
|
import { FormFieldProps, useFormField } from "./useFormField";
|
|
7
7
|
|
|
8
8
|
export interface SelectProps
|
|
@@ -74,31 +74,16 @@ export const Select = forwardRef<HTMLSelectElement, SelectProps>(
|
|
|
74
74
|
{label}
|
|
75
75
|
</Label>
|
|
76
76
|
{!!description && (
|
|
77
|
-
|
|
78
|
-
{
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
{description}
|
|
88
|
-
</BodyLong>
|
|
89
|
-
) : (
|
|
90
|
-
<Detail
|
|
91
|
-
className={cl("navds-form-field__description", {
|
|
92
|
-
"navds-sr-only": hideLabel,
|
|
93
|
-
})}
|
|
94
|
-
id={inputDescriptionId}
|
|
95
|
-
size="small"
|
|
96
|
-
as="div"
|
|
97
|
-
>
|
|
98
|
-
{description}
|
|
99
|
-
</Detail>
|
|
100
|
-
)}
|
|
101
|
-
</>
|
|
77
|
+
<BodyShort
|
|
78
|
+
className={cl("navds-form-field__description", {
|
|
79
|
+
"navds-sr-only": hideLabel,
|
|
80
|
+
})}
|
|
81
|
+
id={inputDescriptionId}
|
|
82
|
+
size={size}
|
|
83
|
+
as="div"
|
|
84
|
+
>
|
|
85
|
+
{description}
|
|
86
|
+
</BodyShort>
|
|
102
87
|
)}
|
|
103
88
|
<div className="navds-select__container" style={style}>
|
|
104
89
|
<select
|
package/src/form/Switch.tsx
CHANGED
|
@@ -5,7 +5,7 @@ import React, {
|
|
|
5
5
|
useEffect,
|
|
6
6
|
useState,
|
|
7
7
|
} from "react";
|
|
8
|
-
import { BodyShort,
|
|
8
|
+
import { BodyShort, Loader, omit } from "..";
|
|
9
9
|
import { FormFieldProps, useFormField } from "./useFormField";
|
|
10
10
|
|
|
11
11
|
const SelectedIcon = () => (
|
|
@@ -71,8 +71,6 @@ export const Switch = forwardRef<HTMLInputElement, SwitchProps>(
|
|
|
71
71
|
...rest
|
|
72
72
|
} = props;
|
|
73
73
|
|
|
74
|
-
const Description = size === "medium" ? BodyShort : Detail;
|
|
75
|
-
|
|
76
74
|
const [checked, setChecked] = useState(
|
|
77
75
|
defaultChecked ?? checkedProp ?? false
|
|
78
76
|
);
|
|
@@ -130,13 +128,13 @@ export const Switch = forwardRef<HTMLInputElement, SwitchProps>(
|
|
|
130
128
|
{children}
|
|
131
129
|
</BodyShort>
|
|
132
130
|
{description && (
|
|
133
|
-
<
|
|
131
|
+
<BodyShort
|
|
132
|
+
size={size}
|
|
134
133
|
as="div"
|
|
135
|
-
|
|
136
|
-
className="navds-switch__description"
|
|
134
|
+
className="navds-form-field__subdescription navds-switch__description"
|
|
137
135
|
>
|
|
138
136
|
{description}
|
|
139
|
-
</
|
|
137
|
+
</BodyShort>
|
|
140
138
|
)}
|
|
141
139
|
</div>
|
|
142
140
|
</label>
|
package/src/form/TextField.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React, { forwardRef, InputHTMLAttributes } from "react";
|
|
2
1
|
import cl from "clsx";
|
|
3
|
-
import
|
|
2
|
+
import React, { forwardRef, InputHTMLAttributes } from "react";
|
|
3
|
+
import { BodyShort, ErrorMessage, Label, omit } from "..";
|
|
4
4
|
import { FormFieldProps, useFormField } from "./useFormField";
|
|
5
5
|
|
|
6
6
|
export interface TextFieldProps
|
|
@@ -78,31 +78,16 @@ export const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
|
|
|
78
78
|
</Label>
|
|
79
79
|
|
|
80
80
|
{!!description && (
|
|
81
|
-
|
|
82
|
-
{
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
{description}
|
|
92
|
-
</BodyLong>
|
|
93
|
-
) : (
|
|
94
|
-
<Detail
|
|
95
|
-
className={cl("navds-form-field__description", {
|
|
96
|
-
"navds-sr-only": hideLabel,
|
|
97
|
-
})}
|
|
98
|
-
id={inputDescriptionId}
|
|
99
|
-
size="small"
|
|
100
|
-
as="div"
|
|
101
|
-
>
|
|
102
|
-
{description}
|
|
103
|
-
</Detail>
|
|
104
|
-
)}
|
|
105
|
-
</>
|
|
81
|
+
<BodyShort
|
|
82
|
+
className={cl("navds-form-field__description", {
|
|
83
|
+
"navds-sr-only": hideLabel,
|
|
84
|
+
})}
|
|
85
|
+
id={inputDescriptionId}
|
|
86
|
+
size={size}
|
|
87
|
+
as="div"
|
|
88
|
+
>
|
|
89
|
+
{description}
|
|
90
|
+
</BodyShort>
|
|
106
91
|
)}
|
|
107
92
|
<input
|
|
108
93
|
{...omit(rest, ["error", "errorId", "size"])}
|
package/src/form/Textarea.tsx
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import React, { forwardRef, useState } from "react";
|
|
2
1
|
import cl from "clsx";
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import { useId } from "..";
|
|
2
|
+
import React, { forwardRef, useState } from "react";
|
|
3
|
+
import { BodyShort, ErrorMessage, Label, omit, useId } from "..";
|
|
6
4
|
import TextareaAutosize from "../util/TextareaAutoSize";
|
|
5
|
+
import { FormFieldProps, useFormField } from "./useFormField";
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* TODO: Mulighet for lokalisering av sr-only/counter text
|
|
@@ -120,31 +119,16 @@ export const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|
|
120
119
|
{label}
|
|
121
120
|
</Label>
|
|
122
121
|
{!!description && (
|
|
123
|
-
|
|
124
|
-
{
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
{description}
|
|
134
|
-
</BodyLong>
|
|
135
|
-
) : (
|
|
136
|
-
<Detail
|
|
137
|
-
className={cl("navds-form-field__description", {
|
|
138
|
-
"navds-sr-only": hideLabel,
|
|
139
|
-
})}
|
|
140
|
-
id={inputDescriptionId}
|
|
141
|
-
size="small"
|
|
142
|
-
as="div"
|
|
143
|
-
>
|
|
144
|
-
{description}
|
|
145
|
-
</Detail>
|
|
146
|
-
)}
|
|
147
|
-
</>
|
|
122
|
+
<BodyShort
|
|
123
|
+
className={cl("navds-form-field__description", {
|
|
124
|
+
"navds-sr-only": hideLabel,
|
|
125
|
+
})}
|
|
126
|
+
id={inputDescriptionId}
|
|
127
|
+
size={size}
|
|
128
|
+
as="div"
|
|
129
|
+
>
|
|
130
|
+
{description}
|
|
131
|
+
</BodyShort>
|
|
148
132
|
)}
|
|
149
133
|
<div className="navds-textarea__wrapper">
|
|
150
134
|
<TextareaAutosize
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { forwardRef, InputHTMLAttributes } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { BodyShort } from "../../typography";
|
|
4
4
|
import { omit } from "../../util";
|
|
5
5
|
import { FormFieldProps } from "../useFormField";
|
|
6
6
|
import useCheckbox from "./useCheckbox";
|
|
@@ -44,8 +44,6 @@ export const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(
|
|
|
44
44
|
(props, ref) => {
|
|
45
45
|
const { inputProps, hasError, size } = useCheckbox(props);
|
|
46
46
|
|
|
47
|
-
const Description = size === "medium" ? BodyLong : Detail;
|
|
48
|
-
|
|
49
47
|
return (
|
|
50
48
|
<div
|
|
51
49
|
className={cl(
|
|
@@ -94,9 +92,13 @@ export const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(
|
|
|
94
92
|
{props.children}
|
|
95
93
|
</BodyShort>
|
|
96
94
|
{props.description && (
|
|
97
|
-
<
|
|
95
|
+
<BodyShort
|
|
96
|
+
as="span"
|
|
97
|
+
size={size}
|
|
98
|
+
className="navds-form-field__subdescription navds-checkbox__description"
|
|
99
|
+
>
|
|
98
100
|
{props.description}
|
|
99
|
-
</
|
|
101
|
+
</BodyShort>
|
|
100
102
|
)}
|
|
101
103
|
</span>
|
|
102
104
|
</label>
|
package/src/form/radio/Radio.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { forwardRef, InputHTMLAttributes } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { BodyShort } from "../../typography";
|
|
4
4
|
import { omit } from "../../util";
|
|
5
5
|
import { FormFieldProps } from "../useFormField";
|
|
6
6
|
import { useRadio } from "./useRadio";
|
|
@@ -25,8 +25,6 @@ export interface RadioProps
|
|
|
25
25
|
export const Radio = forwardRef<HTMLInputElement, RadioProps>((props, ref) => {
|
|
26
26
|
const { inputProps, size, hasError } = useRadio(props);
|
|
27
27
|
|
|
28
|
-
const Description = size === "medium" ? BodyLong : Detail;
|
|
29
|
-
|
|
30
28
|
return (
|
|
31
29
|
<div
|
|
32
30
|
className={cl(props.className, "navds-radio", `navds-radio--${size}`, {
|
|
@@ -46,9 +44,13 @@ export const Radio = forwardRef<HTMLInputElement, RadioProps>((props, ref) => {
|
|
|
46
44
|
{props.children}
|
|
47
45
|
</BodyShort>
|
|
48
46
|
{props.description && (
|
|
49
|
-
<
|
|
47
|
+
<BodyShort
|
|
48
|
+
as="span"
|
|
49
|
+
size={size}
|
|
50
|
+
className="navds-form-field__subdescription navds-radio__description"
|
|
51
|
+
>
|
|
50
52
|
{props.description}
|
|
51
|
-
</
|
|
53
|
+
</BodyShort>
|
|
52
54
|
)}
|
|
53
55
|
</span>
|
|
54
56
|
</label>
|
|
@@ -86,7 +86,9 @@ export const GroupDescription = () => (
|
|
|
86
86
|
defaultValue="tekst2"
|
|
87
87
|
description="Group description"
|
|
88
88
|
>
|
|
89
|
-
<Radio value="tekst">
|
|
89
|
+
<Radio value="tekst" description="textdesc">
|
|
90
|
+
Radiotekst
|
|
91
|
+
</Radio>
|
|
90
92
|
<Radio value="tekst2">Radiotekst</Radio>
|
|
91
93
|
</RadioGroup>
|
|
92
94
|
);
|
|
@@ -181,12 +181,12 @@ export const Search = forwardRef<HTMLInputElement, SearchProps>(
|
|
|
181
181
|
</Label>
|
|
182
182
|
{!!description && (
|
|
183
183
|
<BodyShort
|
|
184
|
-
as="div"
|
|
185
184
|
className={cl("navds-form-field__description", {
|
|
186
185
|
"navds-sr-only": hideLabel,
|
|
187
186
|
})}
|
|
188
187
|
id={inputDescriptionId}
|
|
189
188
|
size={size}
|
|
189
|
+
as="div"
|
|
190
190
|
>
|
|
191
191
|
{description}
|
|
192
192
|
</BodyShort>
|