@navikt/ds-react 0.19.8 → 0.19.11
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/_docs.json +20 -1
- package/cjs/form/Textarea.js +12 -4
- package/cjs/form/error-summary/ErrorSummary.js +4 -2
- package/cjs/loader/Loader.js +2 -2
- package/esm/form/Textarea.d.ts +4 -0
- package/esm/form/Textarea.js +12 -4
- package/esm/form/Textarea.js.map +1 -1
- package/esm/form/error-summary/ErrorSummary.js +4 -2
- package/esm/form/error-summary/ErrorSummary.js.map +1 -1
- package/esm/loader/Loader.d.ts +1 -1
- package/esm/loader/Loader.js +2 -2
- package/esm/loader/Loader.js.map +1 -1
- package/package.json +2 -2
- package/src/alert/alert.stories.tsx +9 -1
- package/src/form/Textarea.tsx +17 -2
- package/src/form/error-summary/ErrorSummary.tsx +9 -3
- package/src/form/stories/textarea.stories.tsx +10 -0
- package/src/guide-panel/guidepanel.stories.tsx +51 -0
- package/src/help-text/help-text.stories.tsx +53 -18
- package/src/link/link.stories.tsx +77 -0
- package/src/link-panel/link-panel.stories.tsx +57 -0
- package/src/loader/Loader.tsx +8 -4
- package/src/loader/loader.stories.tsx +79 -0
- package/src/modal/modal.stories.tsx +71 -38
- package/src/panel/{stories/panel.stories.tsx → panel.stories.tsx} +27 -5
- package/src/popover/popover.stories.tsx +126 -0
- package/src/table/stories/table-async.stories.tsx +1 -1
- package/src/table/stories/table-expandable.stories.tsx +89 -62
- package/src/table/stories/table.stories.tsx +73 -83
- package/src/tag/tag.stories.tsx +45 -0
- package/src/toggle-group/ToggleGroup.stories.tsx +63 -81
- package/src/typography/heading.stories.tsx +75 -0
- package/src/typography/typography.stories.tsx +184 -111
- package/src/guide-panel/stories/example.css +0 -13
- package/src/guide-panel/stories/guidepanel.stories.mdx +0 -81
- package/src/guide-panel/stories/guidepanel.stories.tsx +0 -68
- package/src/link/stories/link.stories.mdx +0 -26
- package/src/link/stories/link.stories.tsx +0 -53
- package/src/link-panel/stories/illustration.tsx +0 -125
- package/src/link-panel/stories/link-panel.stories.mdx +0 -110
- package/src/link-panel/stories/link-panel.stories.tsx +0 -51
- package/src/loader/stories/loader.stories.mdx +0 -65
- package/src/loader/stories/loader.stories.tsx +0 -69
- package/src/panel/stories/panel.stories.mdx +0 -42
- package/src/popover/stories/popover.stories.mdx +0 -23
- package/src/popover/stories/popover.stories.tsx +0 -56
- package/src/table/stories/table-hot.stories.tsx +0 -376
- package/src/table/stories/table.stories.mdx +0 -112
- package/src/tag/stories/tag.stories.mdx +0 -56
- package/src/tag/stories/tag.stories.tsx +0 -32
package/_docs.json
CHANGED
|
@@ -1723,6 +1723,25 @@
|
|
|
1723
1723
|
"name": "boolean"
|
|
1724
1724
|
}
|
|
1725
1725
|
},
|
|
1726
|
+
"resize": {
|
|
1727
|
+
"defaultValue": null,
|
|
1728
|
+
"description": "Enables resizing of field",
|
|
1729
|
+
"name": "resize",
|
|
1730
|
+
"parent": {
|
|
1731
|
+
"fileName": "src/form/Textarea.tsx",
|
|
1732
|
+
"name": "TextareaProps"
|
|
1733
|
+
},
|
|
1734
|
+
"declarations": [
|
|
1735
|
+
{
|
|
1736
|
+
"fileName": "src/form/Textarea.tsx",
|
|
1737
|
+
"name": "TextareaProps"
|
|
1738
|
+
}
|
|
1739
|
+
],
|
|
1740
|
+
"required": false,
|
|
1741
|
+
"type": {
|
|
1742
|
+
"name": "boolean"
|
|
1743
|
+
}
|
|
1744
|
+
},
|
|
1726
1745
|
"error": {
|
|
1727
1746
|
"defaultValue": null,
|
|
1728
1747
|
"description": "Error message for element",
|
|
@@ -2764,7 +2783,7 @@
|
|
|
2764
2783
|
],
|
|
2765
2784
|
"required": false,
|
|
2766
2785
|
"type": {
|
|
2767
|
-
"name": "\"2xlarge\" | \"xlarge\" | \"large\" | \"medium\" | \"small\" | \"xsmall\""
|
|
2786
|
+
"name": "\"3xlarge\" | \"2xlarge\" | \"xlarge\" | \"large\" | \"medium\" | \"small\" | \"xsmall\""
|
|
2768
2787
|
}
|
|
2769
2788
|
},
|
|
2770
2789
|
"title": {
|
package/cjs/form/Textarea.js
CHANGED
|
@@ -47,13 +47,21 @@ const __2 = require("..");
|
|
|
47
47
|
exports.Textarea = (0, react_1.forwardRef)((props, ref) => {
|
|
48
48
|
var _a, _b, _c;
|
|
49
49
|
const { inputProps, errorId, showErrorMsg, hasError, size, inputDescriptionId, } = (0, useFormField_1.useFormField)(props, "textarea");
|
|
50
|
-
const { label, className, description, maxLength, hideLabel = false } = props, rest = __rest(props, ["label", "className", "description", "maxLength", "hideLabel"]);
|
|
50
|
+
const { label, className, description, maxLength, hideLabel = false, resize } = props, rest = __rest(props, ["label", "className", "description", "maxLength", "hideLabel", "resize"]);
|
|
51
51
|
const maxLengthId = `TextareaMaxLength-${(0, __2.useId)()}`;
|
|
52
52
|
const hasMaxLength = maxLength !== undefined && maxLength > 0;
|
|
53
53
|
const [controlledValue, setControlledValue] = (0, react_1.useState)((_a = props === null || props === void 0 ? void 0 : props.defaultValue) !== null && _a !== void 0 ? _a : "");
|
|
54
|
+
const getMinRows = () => {
|
|
55
|
+
let rows = (rest === null || rest === void 0 ? void 0 : rest.minRows) && (rest === null || rest === void 0 ? void 0 : rest.minRows) >= 3 ? rest === null || rest === void 0 ? void 0 : rest.minRows : 3;
|
|
56
|
+
if (size === "small") {
|
|
57
|
+
rows = (rest === null || rest === void 0 ? void 0 : rest.minRows) && (rest === null || rest === void 0 ? void 0 : rest.minRows) >= 2 ? rest === null || rest === void 0 ? void 0 : rest.minRows : 2;
|
|
58
|
+
}
|
|
59
|
+
return rows;
|
|
60
|
+
};
|
|
54
61
|
return (react_1.default.createElement("div", { className: (0, classnames_1.default)(className, "navds-form-field", `navds-form-field--${size}`, {
|
|
55
62
|
"navds-textarea--error": hasError,
|
|
56
63
|
"navds-textarea--disabled": !!inputProps.disabled,
|
|
64
|
+
"navds-textarea--resize": resize,
|
|
57
65
|
}) },
|
|
58
66
|
react_1.default.createElement(__1.Label, { htmlFor: inputProps.id, size: size, as: "label", className: (0, classnames_1.default)("navds-textarea__label", {
|
|
59
67
|
"navds-sr-only": hideLabel,
|
|
@@ -64,7 +72,7 @@ exports.Textarea = (0, react_1.forwardRef)((props, ref) => {
|
|
|
64
72
|
react_1.default.createElement("div", { className: "navds-textarea__wrapper" },
|
|
65
73
|
react_1.default.createElement(TextareaAutosize_1.default, Object.assign({}, (0, __1.omit)(rest, ["error", "errorId", "size"]), inputProps, { onChange: (e) => props.onChange
|
|
66
74
|
? props.onChange(e)
|
|
67
|
-
: setControlledValue(e.target.value), ref: ref, className: (0, classnames_1.default)("navds-textarea__input", "navds-body-short", `navds-body-${size !== null && size !== void 0 ? size : "medium"}`, {
|
|
75
|
+
: setControlledValue(e.target.value), minRows: getMinRows(), ref: ref, className: (0, classnames_1.default)("navds-textarea__input", "navds-body-short", `navds-body-${size !== null && size !== void 0 ? size : "medium"}`, {
|
|
68
76
|
"navds-textarea--counter": hasMaxLength,
|
|
69
77
|
}), "aria-describedby": (0, classnames_1.default)(inputProps["aria-describedby"], {
|
|
70
78
|
[maxLengthId]: hasMaxLength,
|
|
@@ -85,8 +93,8 @@ const Counter = ({ maxLength, currentLength, size }) => {
|
|
|
85
93
|
return (react_1.default.createElement(__1.BodyShort, { className: (0, classnames_1.default)("navds-textarea__counter", {
|
|
86
94
|
"navds-textarea__counter--error": difference < 0,
|
|
87
95
|
}), "aria-live": difference < 20 ? "polite" : "off", size: size }, difference < 0
|
|
88
|
-
? `
|
|
89
|
-
: `
|
|
96
|
+
? `Antall tegn for mye ${Math.abs(difference)}`
|
|
97
|
+
: `Antall tegn igjen ${difference}`));
|
|
90
98
|
};
|
|
91
99
|
exports.Counter = Counter;
|
|
92
100
|
exports.default = exports.Textarea;
|
|
@@ -42,10 +42,12 @@ const react_1 = __importStar(require("react"));
|
|
|
42
42
|
const classnames_1 = __importDefault(require("classnames"));
|
|
43
43
|
const __1 = require("../..");
|
|
44
44
|
const ErrorSummaryItem_1 = __importDefault(require("./ErrorSummaryItem"));
|
|
45
|
+
const util_1 = require("../../util");
|
|
45
46
|
exports.ErrorSummary = (0, react_1.forwardRef)((_a, ref) => {
|
|
46
47
|
var { children, className, size = "medium", headingTag = "h2", heading } = _a, rest = __rest(_a, ["children", "className", "size", "headingTag", "heading"]);
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
const headingId = (0, util_1.useId)();
|
|
49
|
+
return (react_1.default.createElement("section", Object.assign({ ref: ref }, rest, { className: (0, classnames_1.default)(className, "navds-error-summary", `navds-error-summary--${size}`), tabIndex: -1, "aria-live": "polite", "aria-relevant": "all", "aria-labelledby": `error-summary-${headingId}` }),
|
|
50
|
+
react_1.default.createElement(__1.Heading, { className: "navds-error-summary__heading", as: headingTag, size: "small", id: `error-summary-${headingId}` }, heading),
|
|
49
51
|
react_1.default.createElement(__1.BodyShort, { as: "ul", size: size, className: "navds-error-summary__list" }, react_1.default.Children.map(children, (child) => {
|
|
50
52
|
return react_1.default.createElement("li", { key: child === null || child === void 0 ? void 0 : child.toString() }, child);
|
|
51
53
|
}))));
|
package/cjs/loader/Loader.js
CHANGED
|
@@ -48,7 +48,7 @@ exports.Loader = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
48
48
|
"navds-loader--transparent": transparent,
|
|
49
49
|
}), focusable: "false", viewBox: "0 0 50 50", preserveAspectRatio: "xMidYMid" }, rest),
|
|
50
50
|
react_1.default.createElement("title", { id: id !== null && id !== void 0 ? id : `loader-${internalId}` }, title),
|
|
51
|
-
react_1.default.createElement("circle", { className: "navds-loader__background", xmlns: "http://www.w3.org/2000/svg", cx: "25", cy: "25", r: "20", fill: "none"
|
|
52
|
-
react_1.default.createElement("circle", { className: "navds-loader__foreground", cx: "25", cy: "25", r: "20", stroke: "var(--navds-global-color-gray-400)", fill: "none",
|
|
51
|
+
react_1.default.createElement("circle", { className: "navds-loader__background", xmlns: "http://www.w3.org/2000/svg", cx: "25", cy: "25", r: "20", fill: "none" }),
|
|
52
|
+
react_1.default.createElement("circle", { className: "navds-loader__foreground", cx: "25", cy: "25", r: "20", stroke: "var(--navds-global-color-gray-400)", fill: "none", strokeDasharray: "50 155" })));
|
|
53
53
|
});
|
|
54
54
|
exports.default = exports.Loader;
|
package/esm/form/Textarea.d.ts
CHANGED
|
@@ -34,6 +34,10 @@ export interface TextareaProps extends FormFieldProps, React.TextareaHTMLAttribu
|
|
|
34
34
|
* If enabled shows the label and description for screenreaders only
|
|
35
35
|
*/
|
|
36
36
|
hideLabel?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Enables resizing of field
|
|
39
|
+
*/
|
|
40
|
+
resize?: boolean;
|
|
37
41
|
}
|
|
38
42
|
export declare const Textarea: React.ForwardRefExoticComponent<TextareaProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
39
43
|
export declare const Counter: ({ maxLength, currentLength, size }: {
|
package/esm/form/Textarea.js
CHANGED
|
@@ -18,13 +18,21 @@ import { useId } from "..";
|
|
|
18
18
|
export const Textarea = forwardRef((props, ref) => {
|
|
19
19
|
var _a, _b, _c;
|
|
20
20
|
const { inputProps, errorId, showErrorMsg, hasError, size, inputDescriptionId, } = useFormField(props, "textarea");
|
|
21
|
-
const { label, className, description, maxLength, hideLabel = false } = props, rest = __rest(props, ["label", "className", "description", "maxLength", "hideLabel"]);
|
|
21
|
+
const { label, className, description, maxLength, hideLabel = false, resize } = props, rest = __rest(props, ["label", "className", "description", "maxLength", "hideLabel", "resize"]);
|
|
22
22
|
const maxLengthId = `TextareaMaxLength-${useId()}`;
|
|
23
23
|
const hasMaxLength = maxLength !== undefined && maxLength > 0;
|
|
24
24
|
const [controlledValue, setControlledValue] = useState((_a = props === null || props === void 0 ? void 0 : props.defaultValue) !== null && _a !== void 0 ? _a : "");
|
|
25
|
+
const getMinRows = () => {
|
|
26
|
+
let rows = (rest === null || rest === void 0 ? void 0 : rest.minRows) && (rest === null || rest === void 0 ? void 0 : rest.minRows) >= 3 ? rest === null || rest === void 0 ? void 0 : rest.minRows : 3;
|
|
27
|
+
if (size === "small") {
|
|
28
|
+
rows = (rest === null || rest === void 0 ? void 0 : rest.minRows) && (rest === null || rest === void 0 ? void 0 : rest.minRows) >= 2 ? rest === null || rest === void 0 ? void 0 : rest.minRows : 2;
|
|
29
|
+
}
|
|
30
|
+
return rows;
|
|
31
|
+
};
|
|
25
32
|
return (React.createElement("div", { className: cl(className, "navds-form-field", `navds-form-field--${size}`, {
|
|
26
33
|
"navds-textarea--error": hasError,
|
|
27
34
|
"navds-textarea--disabled": !!inputProps.disabled,
|
|
35
|
+
"navds-textarea--resize": resize,
|
|
28
36
|
}) },
|
|
29
37
|
React.createElement(Label, { htmlFor: inputProps.id, size: size, as: "label", className: cl("navds-textarea__label", {
|
|
30
38
|
"navds-sr-only": hideLabel,
|
|
@@ -35,7 +43,7 @@ export const Textarea = forwardRef((props, ref) => {
|
|
|
35
43
|
React.createElement("div", { className: "navds-textarea__wrapper" },
|
|
36
44
|
React.createElement(TextareaAutosize, Object.assign({}, omit(rest, ["error", "errorId", "size"]), inputProps, { onChange: (e) => props.onChange
|
|
37
45
|
? props.onChange(e)
|
|
38
|
-
: setControlledValue(e.target.value), ref: ref, className: cl("navds-textarea__input", "navds-body-short", `navds-body-${size !== null && size !== void 0 ? size : "medium"}`, {
|
|
46
|
+
: setControlledValue(e.target.value), minRows: getMinRows(), ref: ref, className: cl("navds-textarea__input", "navds-body-short", `navds-body-${size !== null && size !== void 0 ? size : "medium"}`, {
|
|
39
47
|
"navds-textarea--counter": hasMaxLength,
|
|
40
48
|
}), "aria-describedby": cl(inputProps["aria-describedby"], {
|
|
41
49
|
[maxLengthId]: hasMaxLength,
|
|
@@ -56,8 +64,8 @@ export const Counter = ({ maxLength, currentLength, size }) => {
|
|
|
56
64
|
return (React.createElement(BodyShort, { className: cl("navds-textarea__counter", {
|
|
57
65
|
"navds-textarea__counter--error": difference < 0,
|
|
58
66
|
}), "aria-live": difference < 20 ? "polite" : "off", size: size }, difference < 0
|
|
59
|
-
? `
|
|
60
|
-
: `
|
|
67
|
+
? `Antall tegn for mye ${Math.abs(difference)}`
|
|
68
|
+
: `Antall tegn igjen ${difference}`));
|
|
61
69
|
};
|
|
62
70
|
export default Textarea;
|
|
63
71
|
//# sourceMappingURL=Textarea.js.map
|
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,MAAM,YAAY,CAAC;AAC5B,OAAO,gBAAgB,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1D,OAAO,EAAkB,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;
|
|
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,MAAM,YAAY,CAAC;AAC5B,OAAO,gBAAgB,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1D,OAAO,EAAkB,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;AA4C3B,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,k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BAA2B,GAAG;oBACjE,SAAS;8BACL;gBACP,oBAAC,OAAO,IACN,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,MAAA,MAAA,KAAK,CAAC,KAAK,0CAAE,MAAM,mCAAI,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,MAAM,EAC7D,IAAI,EAAE,IAAI,GACV,CACD,CACJ,CACG;QACN,6BAAK,EAAE,EAAE,OAAO,mBAAgB,oBAAoB,eAAW,QAAQ,IACpE,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,EAAE,EAAE;IAC5D,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,uBAAuB,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;QAC/C,CAAC,CAAC,qBAAqB,UAAU,EAAE,CAC3B,CACb,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -13,10 +13,12 @@ import React, { forwardRef } from "react";
|
|
|
13
13
|
import cl from "classnames";
|
|
14
14
|
import { Heading, BodyShort } from "../..";
|
|
15
15
|
import ErrorSummaryItem from "./ErrorSummaryItem";
|
|
16
|
+
import { useId } from "../../util";
|
|
16
17
|
export const ErrorSummary = forwardRef((_a, ref) => {
|
|
17
18
|
var { children, className, size = "medium", headingTag = "h2", heading } = _a, rest = __rest(_a, ["children", "className", "size", "headingTag", "heading"]);
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
const headingId = useId();
|
|
20
|
+
return (React.createElement("section", Object.assign({ ref: ref }, rest, { className: cl(className, "navds-error-summary", `navds-error-summary--${size}`), tabIndex: -1, "aria-live": "polite", "aria-relevant": "all", "aria-labelledby": `error-summary-${headingId}` }),
|
|
21
|
+
React.createElement(Heading, { className: "navds-error-summary__heading", as: headingTag, size: "small", id: `error-summary-${headingId}` }, heading),
|
|
20
22
|
React.createElement(BodyShort, { as: "ul", size: size, className: "navds-error-summary__list" }, React.Children.map(children, (child) => {
|
|
21
23
|
return React.createElement("li", { key: child === null || child === void 0 ? void 0 : child.toString() }, child);
|
|
22
24
|
}))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorSummary.js","sourceRoot":"","sources":["../../../src/form/error-summary/ErrorSummary.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAkB,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,gBAA0C,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"ErrorSummary.js","sourceRoot":"","sources":["../../../src/form/error-summary/ErrorSummary.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAkB,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,gBAA0C,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AA8BnC,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CACpC,CACE,EAOC,EACD,GAAG,EACH,EAAE;QATF,EACE,QAAQ,EACR,SAAS,EACT,IAAI,GAAG,QAAQ,EACf,UAAU,GAAG,IAAI,EACjB,OAAO,OAER,EADI,IAAI,cANT,0DAOC,CADQ;IAIT,MAAM,SAAS,GAAG,KAAK,EAAE,CAAC;IAE1B,OAAO,CACL,+CACE,GAAG,EAAE,GAAG,IACJ,IAAI,IACR,SAAS,EAAE,EAAE,CACX,SAAS,EACT,qBAAqB,EACrB,wBAAwB,IAAI,EAAE,CAC/B,EACD,QAAQ,EAAE,CAAC,CAAC,eACF,QAAQ,mBACJ,KAAK,qBACF,iBAAiB,SAAS,EAAE;QAE7C,oBAAC,OAAO,IACN,SAAS,EAAC,8BAA8B,EACxC,EAAE,EAAE,UAAU,EACd,IAAI,EAAC,OAAO,EACZ,EAAE,EAAE,iBAAiB,SAAS,EAAE,IAE/B,OAAO,CACA;QACV,oBAAC,SAAS,IAAC,EAAE,EAAC,IAAI,EAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAC,2BAA2B,IACjE,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;YACtC,OAAO,4BAAI,GAAG,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,EAAE,IAAG,KAAK,CAAM,CAAC;QAClD,CAAC,CAAC,CACQ,CACJ,CACX,CAAC;AACJ,CAAC,CACuB,CAAC;AAE3B,YAAY,CAAC,IAAI,GAAG,gBAAgB,CAAC;AAErC,eAAe,YAAY,CAAC"}
|
package/esm/loader/Loader.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export interface LoaderProps extends SVGProps<SVGSVGElement> {
|
|
|
5
5
|
* 64px | 40px | 32px | 24px | 20px | 16px
|
|
6
6
|
* @default "medium"
|
|
7
7
|
*/
|
|
8
|
-
size?: "2xlarge" | "xlarge" | "large" | "medium" | "small" | "xsmall";
|
|
8
|
+
size?: "3xlarge" | "2xlarge" | "xlarge" | "large" | "medium" | "small" | "xsmall";
|
|
9
9
|
/**
|
|
10
10
|
* Title prop on svg
|
|
11
11
|
* @default "venter..."
|
package/esm/loader/Loader.js
CHANGED
|
@@ -19,8 +19,8 @@ export const Loader = forwardRef((_a, ref) => {
|
|
|
19
19
|
"navds-loader--transparent": transparent,
|
|
20
20
|
}), focusable: "false", viewBox: "0 0 50 50", preserveAspectRatio: "xMidYMid" }, rest),
|
|
21
21
|
React.createElement("title", { id: id !== null && id !== void 0 ? id : `loader-${internalId}` }, title),
|
|
22
|
-
React.createElement("circle", { className: "navds-loader__background", xmlns: "http://www.w3.org/2000/svg", cx: "25", cy: "25", r: "20", fill: "none"
|
|
23
|
-
React.createElement("circle", { className: "navds-loader__foreground", cx: "25", cy: "25", r: "20", stroke: "var(--navds-global-color-gray-400)", fill: "none",
|
|
22
|
+
React.createElement("circle", { className: "navds-loader__background", xmlns: "http://www.w3.org/2000/svg", cx: "25", cy: "25", r: "20", fill: "none" }),
|
|
23
|
+
React.createElement("circle", { className: "navds-loader__foreground", cx: "25", cy: "25", r: "20", stroke: "var(--navds-global-color-gray-400)", fill: "none", strokeDasharray: "50 155" })));
|
|
24
24
|
});
|
|
25
25
|
export default Loader;
|
|
26
26
|
//# sourceMappingURL=Loader.js.map
|
package/esm/loader/Loader.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Loader.js","sourceRoot":"","sources":["../../src/loader/Loader.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAY,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"Loader.js","sourceRoot":"","sources":["../../src/loader/Loader.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAY,MAAM,OAAO,CAAC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 -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@navikt/ds-react",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.11",
|
|
4
4
|
"description": "NAV designsystem react components",
|
|
5
5
|
"author": "NAV Designsystem team",
|
|
6
6
|
"license": "MIT",
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"@types/react": "^17.0.30 || ^18.0.0",
|
|
77
77
|
"react": "^17.0.0 || ^18.0.0"
|
|
78
78
|
},
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "bf41d8f1812acb47ec960edc85f3841123ef4b33"
|
|
80
80
|
}
|
|
@@ -5,6 +5,15 @@ import { BodyLong, Heading as DsHeading } from "..";
|
|
|
5
5
|
export default {
|
|
6
6
|
title: "ds-react/Alert",
|
|
7
7
|
component: Alert,
|
|
8
|
+
argTypes: {
|
|
9
|
+
variant: {
|
|
10
|
+
defaultValue: "info",
|
|
11
|
+
control: {
|
|
12
|
+
type: "radio",
|
|
13
|
+
options: ["error", "warning", "info", "success"],
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
8
17
|
};
|
|
9
18
|
|
|
10
19
|
const variants: Array<"error" | "warning" | "info" | "success"> = [
|
|
@@ -26,7 +35,6 @@ export const Default = (props) => (
|
|
|
26
35
|
);
|
|
27
36
|
|
|
28
37
|
Default.args = {
|
|
29
|
-
variant: "info",
|
|
30
38
|
children: "Id elit esse enim reprehenderit enim nisi veniam nostrud.",
|
|
31
39
|
};
|
|
32
40
|
|
package/src/form/Textarea.tsx
CHANGED
|
@@ -41,6 +41,10 @@ export interface TextareaProps
|
|
|
41
41
|
* If enabled shows the label and description for screenreaders only
|
|
42
42
|
*/
|
|
43
43
|
hideLabel?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Enables resizing of field
|
|
46
|
+
*/
|
|
47
|
+
resize?: boolean;
|
|
44
48
|
}
|
|
45
49
|
|
|
46
50
|
export const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|
@@ -60,6 +64,7 @@ export const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|
|
60
64
|
description,
|
|
61
65
|
maxLength,
|
|
62
66
|
hideLabel = false,
|
|
67
|
+
resize,
|
|
63
68
|
...rest
|
|
64
69
|
} = props;
|
|
65
70
|
|
|
@@ -70,6 +75,14 @@ export const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|
|
70
75
|
props?.defaultValue ?? ""
|
|
71
76
|
);
|
|
72
77
|
|
|
78
|
+
const getMinRows = () => {
|
|
79
|
+
let rows = rest?.minRows && rest?.minRows >= 3 ? rest?.minRows : 3;
|
|
80
|
+
if (size === "small") {
|
|
81
|
+
rows = rest?.minRows && rest?.minRows >= 2 ? rest?.minRows : 2;
|
|
82
|
+
}
|
|
83
|
+
return rows;
|
|
84
|
+
};
|
|
85
|
+
|
|
73
86
|
return (
|
|
74
87
|
<div
|
|
75
88
|
className={cl(
|
|
@@ -79,6 +92,7 @@ export const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|
|
79
92
|
{
|
|
80
93
|
"navds-textarea--error": hasError,
|
|
81
94
|
"navds-textarea--disabled": !!inputProps.disabled,
|
|
95
|
+
"navds-textarea--resize": resize,
|
|
82
96
|
}
|
|
83
97
|
)}
|
|
84
98
|
>
|
|
@@ -113,6 +127,7 @@ export const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|
|
113
127
|
? props.onChange(e)
|
|
114
128
|
: setControlledValue(e.target.value)
|
|
115
129
|
}
|
|
130
|
+
minRows={getMinRows()}
|
|
116
131
|
ref={ref}
|
|
117
132
|
className={cl(
|
|
118
133
|
"navds-textarea__input",
|
|
@@ -162,8 +177,8 @@ export const Counter = ({ maxLength, currentLength, size }) => {
|
|
|
162
177
|
size={size}
|
|
163
178
|
>
|
|
164
179
|
{difference < 0
|
|
165
|
-
? `
|
|
166
|
-
: `
|
|
180
|
+
? `Antall tegn for mye ${Math.abs(difference)}`
|
|
181
|
+
: `Antall tegn igjen ${difference}`}
|
|
167
182
|
</BodyShort>
|
|
168
183
|
);
|
|
169
184
|
};
|
|
@@ -2,6 +2,7 @@ import React, { forwardRef, HTMLAttributes } from "react";
|
|
|
2
2
|
import cl from "classnames";
|
|
3
3
|
import { Heading, BodyShort } from "../..";
|
|
4
4
|
import ErrorSummaryItem, { ErrorSummaryItemType } from "./ErrorSummaryItem";
|
|
5
|
+
import { useId } from "../../util";
|
|
5
6
|
|
|
6
7
|
export interface ErrorSummaryProps extends HTMLAttributes<HTMLDivElement> {
|
|
7
8
|
/**
|
|
@@ -43,8 +44,10 @@ export const ErrorSummary = forwardRef<HTMLDivElement, ErrorSummaryProps>(
|
|
|
43
44
|
},
|
|
44
45
|
ref
|
|
45
46
|
) => {
|
|
47
|
+
const headingId = useId();
|
|
48
|
+
|
|
46
49
|
return (
|
|
47
|
-
<
|
|
50
|
+
<section
|
|
48
51
|
ref={ref}
|
|
49
52
|
{...rest}
|
|
50
53
|
className={cl(
|
|
@@ -53,12 +56,15 @@ export const ErrorSummary = forwardRef<HTMLDivElement, ErrorSummaryProps>(
|
|
|
53
56
|
`navds-error-summary--${size}`
|
|
54
57
|
)}
|
|
55
58
|
tabIndex={-1}
|
|
56
|
-
|
|
59
|
+
aria-live="polite"
|
|
60
|
+
aria-relevant="all"
|
|
61
|
+
aria-labelledby={`error-summary-${headingId}`}
|
|
57
62
|
>
|
|
58
63
|
<Heading
|
|
59
64
|
className="navds-error-summary__heading"
|
|
60
65
|
as={headingTag}
|
|
61
66
|
size="small"
|
|
67
|
+
id={`error-summary-${headingId}`}
|
|
62
68
|
>
|
|
63
69
|
{heading}
|
|
64
70
|
</Heading>
|
|
@@ -67,7 +73,7 @@ export const ErrorSummary = forwardRef<HTMLDivElement, ErrorSummaryProps>(
|
|
|
67
73
|
return <li key={child?.toString()}>{child}</li>;
|
|
68
74
|
})}
|
|
69
75
|
</BodyShort>
|
|
70
|
-
</
|
|
76
|
+
</section>
|
|
71
77
|
);
|
|
72
78
|
}
|
|
73
79
|
) as ErrorSummaryComponent;
|
|
@@ -23,6 +23,12 @@ export default {
|
|
|
23
23
|
disabled: {
|
|
24
24
|
type: "boolean",
|
|
25
25
|
},
|
|
26
|
+
maxRows: {
|
|
27
|
+
type: "number",
|
|
28
|
+
},
|
|
29
|
+
minRows: {
|
|
30
|
+
type: "number",
|
|
31
|
+
},
|
|
26
32
|
},
|
|
27
33
|
} as Meta;
|
|
28
34
|
|
|
@@ -109,3 +115,7 @@ export const MaxRows = () => {
|
|
|
109
115
|
/>
|
|
110
116
|
);
|
|
111
117
|
};
|
|
118
|
+
|
|
119
|
+
export const Resize = () => {
|
|
120
|
+
return <Textarea resize label="Ipsum enim quis culpa" />;
|
|
121
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { GuidePanel } from "../index";
|
|
3
|
+
import { Meta } from "@storybook/react/types-6-0";
|
|
4
|
+
export default {
|
|
5
|
+
title: "ds-react/GuidePanel",
|
|
6
|
+
component: GuidePanel,
|
|
7
|
+
} as Meta;
|
|
8
|
+
|
|
9
|
+
const panelText = `Sit sint eu dolore reprehenderit exercitation labore aute anim sit
|
|
10
|
+
adipisicing proident. Tempor ipsum ea cupidatat qui esse do veniam
|
|
11
|
+
cupidatat. Excepteur irure reprehenderit esse tempor nisi duis qui ea
|
|
12
|
+
enim id.`;
|
|
13
|
+
|
|
14
|
+
export const Default = (props) => {
|
|
15
|
+
const newProps = props?.colorOverride
|
|
16
|
+
? {
|
|
17
|
+
style: {
|
|
18
|
+
["--navds-guide-panel-color-illustration-background" as any]:
|
|
19
|
+
"var(--navds-global-color-purple-200)",
|
|
20
|
+
["--navds-guide-panel-color-border" as any]:
|
|
21
|
+
"var(--navds-global-color-purple-400)",
|
|
22
|
+
},
|
|
23
|
+
}
|
|
24
|
+
: {};
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<GuidePanel {...newProps} poster={props?.poster}>
|
|
28
|
+
{panelText}
|
|
29
|
+
</GuidePanel>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
Default.args = {
|
|
34
|
+
poster: false,
|
|
35
|
+
colorOverride: false,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const Poster = () => <GuidePanel poster>{panelText}</GuidePanel>;
|
|
39
|
+
|
|
40
|
+
export const ColorOverride = () => (
|
|
41
|
+
<GuidePanel
|
|
42
|
+
style={{
|
|
43
|
+
["--navds-guide-panel-color-illustration-background" as any]:
|
|
44
|
+
"var(--navds-global-color-purple-200)",
|
|
45
|
+
["--navds-guide-panel-color-border" as any]:
|
|
46
|
+
"var(--navds-global-color-purple-400)",
|
|
47
|
+
}}
|
|
48
|
+
>
|
|
49
|
+
{panelText}
|
|
50
|
+
</GuidePanel>
|
|
51
|
+
);
|
|
@@ -2,27 +2,62 @@ import React from "react";
|
|
|
2
2
|
import { TextField, HelpText } from "..";
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
|
-
title: "ds-react/
|
|
5
|
+
title: "ds-react/HelpText",
|
|
6
6
|
component: HelpText,
|
|
7
|
+
argTypes: {
|
|
8
|
+
placement: {
|
|
9
|
+
control: {
|
|
10
|
+
type: "radio",
|
|
11
|
+
options: [
|
|
12
|
+
"bottom",
|
|
13
|
+
"right",
|
|
14
|
+
"left",
|
|
15
|
+
"top-start",
|
|
16
|
+
"top-end",
|
|
17
|
+
"bottom-start",
|
|
18
|
+
"bottom-end",
|
|
19
|
+
"right-start",
|
|
20
|
+
"right-end",
|
|
21
|
+
"left-start",
|
|
22
|
+
"left-end",
|
|
23
|
+
"auto",
|
|
24
|
+
"auto-start",
|
|
25
|
+
"auto-end",
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
strategy: {
|
|
30
|
+
control: {
|
|
31
|
+
type: "radio",
|
|
32
|
+
options: ["fixed", "absolute"],
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
7
36
|
};
|
|
8
37
|
|
|
9
|
-
export const
|
|
38
|
+
export const Default = (props: any) => {
|
|
10
39
|
return (
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
40
|
+
<HelpText title="show tooltip" strategy="fixed" {...props}>
|
|
41
|
+
Id ullamco excepteur elit fugiat labore.
|
|
42
|
+
</HelpText>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
Default.args = {
|
|
47
|
+
title: "show tooltip",
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const Inline = () => {
|
|
51
|
+
return (
|
|
52
|
+
<TextField
|
|
53
|
+
label={
|
|
54
|
+
<div style={{ display: "flex", gap: 8 }}>
|
|
55
|
+
Text field label
|
|
56
|
+
<HelpText title="show tooltip">
|
|
57
|
+
Id ullamco excepteur elit fugiat labore.
|
|
58
|
+
</HelpText>
|
|
59
|
+
</div>
|
|
60
|
+
}
|
|
61
|
+
/>
|
|
27
62
|
);
|
|
28
63
|
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Add } from "@navikt/ds-icons";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { ConfirmationPanel as DsConfirmationPanel, Link } from "..";
|
|
4
|
+
import { Alert as DsAlert, BodyLong } from "../..";
|
|
5
|
+
export default {
|
|
6
|
+
title: "ds-react/Link",
|
|
7
|
+
component: Link,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const Default = (props) => {
|
|
11
|
+
const LinkD = () => (
|
|
12
|
+
<Link href="#">
|
|
13
|
+
{props.icon && <Add />}Ex aliqua incididunt {props.icon && <Add />}
|
|
14
|
+
</Link>
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
if (props.inline) {
|
|
18
|
+
return (
|
|
19
|
+
<BodyLong>
|
|
20
|
+
Incididunt laborum nisi nisi Lorem <LinkD /> in. Laborum aute fugiat
|
|
21
|
+
officia adipisicing non veniam dolor nulla non ex consectetur fugiat
|
|
22
|
+
eiusmod aute. Culpa sit aute est duis minim in in voluptate velit
|
|
23
|
+
fugiat. Laboris est id deserunt ut ea Lorem eu. Esse elit laboris aute
|
|
24
|
+
commodo sint laborum fugiat aliqua.
|
|
25
|
+
</BodyLong>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
return <LinkD />;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
Default.args = {
|
|
32
|
+
icon: false,
|
|
33
|
+
inline: false,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const DemoLink = () => (
|
|
37
|
+
<Link href="#">
|
|
38
|
+
<Add aria-hidden /> Ex aliqua incididunt <Add aria-hidden />
|
|
39
|
+
</Link>
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
export const Icon = () => <DemoLink />;
|
|
43
|
+
|
|
44
|
+
export const Alert = () => {
|
|
45
|
+
return (
|
|
46
|
+
<div className="colgap">
|
|
47
|
+
<DsAlert variant="info">
|
|
48
|
+
<DemoLink />
|
|
49
|
+
</DsAlert>
|
|
50
|
+
<DsAlert variant="success">
|
|
51
|
+
<DemoLink />
|
|
52
|
+
</DsAlert>
|
|
53
|
+
<DsAlert variant="warning">
|
|
54
|
+
<DemoLink />
|
|
55
|
+
</DsAlert>
|
|
56
|
+
<DsAlert variant="error">
|
|
57
|
+
<DemoLink />
|
|
58
|
+
</DsAlert>
|
|
59
|
+
</div>
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export const ConfirmationPanel = () => {
|
|
64
|
+
return (
|
|
65
|
+
<div className="colgap">
|
|
66
|
+
<DsConfirmationPanel label="demo">
|
|
67
|
+
<DemoLink />
|
|
68
|
+
</DsConfirmationPanel>
|
|
69
|
+
<DsConfirmationPanel checked label="demo">
|
|
70
|
+
<DemoLink />
|
|
71
|
+
</DsConfirmationPanel>
|
|
72
|
+
<DsConfirmationPanel error="demo" label="demo">
|
|
73
|
+
<DemoLink />
|
|
74
|
+
</DsConfirmationPanel>
|
|
75
|
+
</div>
|
|
76
|
+
);
|
|
77
|
+
};
|