dibk-designsystemet 1.0.0-rc.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/CHANGELOG.md +32 -0
- package/LICENSE.md +13 -0
- package/README.md +365 -0
- package/dist/fonts.css +81 -0
- package/dist/icons.cjs +451 -0
- package/dist/icons.cjs.map +1 -0
- package/dist/icons.d.cts +33 -0
- package/dist/icons.d.ts +33 -0
- package/dist/icons.js +412 -0
- package/dist/icons.js.map +1 -0
- package/dist/index.cjs +706 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +886 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.cts +280 -0
- package/dist/index.d.ts +280 -0
- package/dist/index.js +666 -0
- package/dist/index.js.map +1 -0
- package/dist/layout.cjs +65 -0
- package/dist/layout.cjs.map +1 -0
- package/dist/layout.css +60 -0
- package/dist/layout.css.map +1 -0
- package/dist/layout.d.cts +42 -0
- package/dist/layout.d.ts +42 -0
- package/dist/layout.js +36 -0
- package/dist/layout.js.map +1 -0
- package/dist/styles.css +5 -0
- package/dist/swagger.css +213 -0
- package/dist/theme.css +982 -0
- package/icons/package.json +9 -0
- package/layout/package.json +9 -0
- package/package.json +106 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,706 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
|
|
22
|
+
// src/index.ts
|
|
23
|
+
var src_exports = {};
|
|
24
|
+
__export(src_exports, {
|
|
25
|
+
DibkAccountMenu: () => DibkAccountMenu,
|
|
26
|
+
DibkAppShell: () => DibkAppShell,
|
|
27
|
+
DibkCodeBlock: () => DibkCodeBlock,
|
|
28
|
+
DibkCopyButton: () => DibkCopyButton,
|
|
29
|
+
DibkCopyIconButton: () => DibkCopyIconButton,
|
|
30
|
+
DibkFeedbackWidget: () => DibkFeedbackWidget,
|
|
31
|
+
DibkFooter: () => DibkFooter,
|
|
32
|
+
DibkHeader: () => DibkHeader,
|
|
33
|
+
DibkIconLinkList: () => DibkIconLinkList,
|
|
34
|
+
DibkLogo: () => DibkLogo,
|
|
35
|
+
DibkMegaMenu: () => DibkMegaMenu,
|
|
36
|
+
DibkMenuLogin: () => DibkMenuLogin,
|
|
37
|
+
DibkMenuSection: () => DibkMenuSection,
|
|
38
|
+
DibkSearch: () => DibkSearch,
|
|
39
|
+
DibkSectionHeader: () => DibkSectionHeader
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(src_exports);
|
|
42
|
+
__reExport(src_exports, require("@digdir/designsystemet-react"), module.exports);
|
|
43
|
+
|
|
44
|
+
// src/components/Logo/index.tsx
|
|
45
|
+
var import_react = require("react");
|
|
46
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
47
|
+
var WORDMARK_PATH = "M163.209 108.713C155.725 108.713 150.078 113.687 150.078 122.023C150.078 130.358 154.918 135.78 163.209 135.78C171.499 135.78 176.294 130.672 176.294 122.023C176.294 113.374 171.454 108.713 163.209 108.713ZM170.513 122.023C170.513 127.131 167.824 130.896 163.254 130.896C158.683 130.896 155.904 127.624 155.904 122.023C155.904 116.421 158.817 113.598 163.254 113.598C167.69 113.598 170.513 116.959 170.513 122.023ZM162.985 66.1849C162.985 56.3259 155.994 49.5142 145.955 49.5142H133.811V83.2589H145.955C155.994 83.2589 162.985 76.0439 162.985 66.1849ZM139.592 54.7126H146.359C152.633 54.7126 157.024 59.5973 157.024 66.1849C157.024 72.7725 152.633 78.0605 146.359 78.0605H139.592V54.7126ZM136.052 106.338V109.52H131.57V114.36H136.052V135.108H141.743V114.36H149.182V109.52H141.743V106.741C141.743 104.814 142.774 103.739 144.611 103.739H149.765V98.8988H144.208C138.92 98.8988 136.052 101.498 136.052 106.338ZM463.056 108.713C455.931 108.713 450.374 113.911 450.374 122.381C450.374 130.179 455.707 135.78 463.549 135.78C471.392 135.78 473.857 132.464 475.156 126.952H469.599C468.748 129.507 466.507 130.941 463.594 130.941C459.247 130.941 456.469 127.893 456.066 123.412H475.246V122.067C475.111 113.777 470.182 108.713 463.056 108.713ZM456.29 119.423C457.141 115.749 459.695 113.553 463.056 113.553C466.417 113.553 468.658 115.794 469.375 119.423H456.29ZM185.033 69.277L195.923 60.7624L192.606 56.9533L184.63 63.3616L183.913 57.7151H179.342V83.2589H185.033V69.277ZM221.601 75.1924H216.044C215.192 77.7468 212.952 79.1808 209.994 79.1808C205.647 79.1808 202.869 76.1335 202.465 71.6522H221.646V70.3077C221.511 62.0172 216.582 56.9533 209.456 56.9533C202.331 56.9533 196.774 62.1517 196.774 70.6214C196.774 78.419 202.107 84.0207 209.949 84.0207C217.792 84.0207 220.256 80.7045 221.556 75.1924H221.601ZM209.501 61.7483C212.817 61.7483 215.103 63.989 215.82 67.6189H202.734C203.586 63.9442 206.14 61.7483 209.501 61.7483ZM186.019 115.166L185.302 109.52H180.731V135.063H186.422V121.082L197.312 112.567L193.996 108.758L186.019 115.166ZM494.067 114.315V109.475H487.48V100.736H481.789V109.475H477.307V114.315H481.789V127.221C481.789 132.285 484.791 135.019 490.348 135.019H493.619V130.179H490.706C488.6 130.179 487.48 128.969 487.48 126.818V114.27H494.067V114.315ZM351.381 75.4613C351.381 80.5252 354.383 83.2589 359.896 83.2589H363.167V78.419H360.254C358.148 78.419 357.027 77.209 357.027 75.058V62.5102H363.615V57.6703H357.027V48.9317H351.336V57.6703H346.855V62.5102H351.336V75.4165L351.381 75.4613ZM379.121 84.0207C385.17 84.0207 389.428 80.7045 390.727 75.1924H385.17C384.319 77.7468 382.078 79.1808 379.121 79.1808C374.774 79.1808 371.995 76.1335 371.592 71.6522H390.772V70.3077C390.638 62.0172 385.708 56.9533 378.583 56.9533C371.457 56.9533 365.901 62.1517 365.901 70.6214C365.901 78.419 371.233 84.0207 379.076 84.0207H379.121ZM378.628 61.7483C381.944 61.7483 384.229 63.989 384.946 67.6189H371.861C372.712 63.9442 375.267 61.7483 378.628 61.7483ZM307.419 69.277L318.309 60.7624L314.992 56.9533L307.016 63.3616L306.299 57.7151H301.728V83.2589H307.419V69.277ZM167.869 83.2589H173.561V57.7151H167.869V83.2589ZM170.693 54.3093C172.799 54.3093 174.367 52.6512 174.367 50.5898C174.367 48.5283 172.799 46.915 170.693 46.915C168.586 46.915 167.018 48.4835 167.018 50.5898C167.018 52.696 168.542 54.3093 170.693 54.3093ZM421.514 135.063H427.206V109.52H421.514V135.063ZM409.908 135.063H415.599V98.8988H409.908V135.063ZM337.937 79.4049C337.982 79.7186 338.071 80.0323 338.161 80.2564C338.609 82.1833 340.178 83.2589 342.777 83.2589H345.466V78.8223H344.076C343.225 78.8223 342.822 78.419 342.822 77.702V66.1401C342.822 60.6728 338.699 56.9085 332.111 56.9085C325.524 56.9085 320.684 60.6728 320.146 66.0953H325.882C326.241 63.4513 328.705 61.6139 332.022 61.6139C335.338 61.6139 337.22 63.272 337.265 65.7816C337.22 67.7982 334.352 67.9326 330.498 68.3808C325.524 68.9633 319.608 70.2181 319.563 76.1783C319.519 80.9286 323.372 83.7966 329.243 83.7966C335.114 83.7966 336.368 82.1385 337.892 79.4049H337.937ZM325.344 75.8198C325.344 73.131 327.988 72.6829 331.17 72.2795C333.859 71.921 336.324 71.6073 337.31 70.1285V73.7136C337.31 77.1194 334.352 79.3601 330.453 79.3601C326.554 79.3601 325.344 78.0605 325.344 75.8646V75.8198ZM350.619 109.52H343.673L332.783 120.633V98.9436H327.092V135.108H332.783V127.355L337.399 122.74L345.242 135.153H351.874L341.343 118.796L350.619 109.564V109.52ZM316.247 113.463C314.679 110.64 311.407 108.758 307.419 108.758C300.607 108.758 295.678 114.18 295.678 121.799C295.678 129.417 300.607 134.705 307.464 134.705C314.32 134.705 313.962 133.181 315.62 130.716V134.346C315.62 138.2 313.245 140.889 308.718 140.889C304.192 140.889 302.355 138.962 302.355 136.542H296.664C296.664 142.054 301.593 145.505 308.718 145.505C315.844 145.505 321.266 141.068 321.266 134.302V109.52H316.74L316.247 113.463ZM308.539 129.91C304.372 129.91 301.548 126.638 301.548 121.754C301.548 116.869 304.416 113.553 308.539 113.553C312.662 113.553 315.575 116.869 315.575 121.709C315.575 126.549 312.662 129.91 308.539 129.91ZM403.051 48.9765H397.36V57.7151H392.878V62.555H397.36V75.4613C397.36 80.5252 400.362 83.2589 405.874 83.2589H409.146V78.419H406.233C404.127 78.419 403.006 77.209 403.006 75.058V62.5102H409.594V57.6703H403.006V48.9317L403.051 48.9765ZM365.587 128.341L358.103 109.475H351.919L362.584 135.019H368.5L379.165 109.475H372.981L365.542 128.341H365.587ZM268.341 78.4638H265.429C263.322 78.4638 262.202 77.2538 262.202 75.1028V62.555H268.79V57.7151H262.202V48.9765H256.511V57.7151H252.029V62.555H256.511V75.4613C256.511 80.5252 259.513 83.2589 265.025 83.2589H268.297V78.419L268.341 78.4638ZM441.501 100.781H435.81V109.52H431.328V114.36H435.81V127.266C435.81 132.33 438.812 135.063 444.324 135.063H447.596V130.224H444.683C442.577 130.224 441.456 129.014 441.456 126.863V114.315H448.044V109.475H441.456V100.736L441.501 100.781ZM224.962 108.713C221.332 108.713 218.329 110.281 216.492 112.791V98.854H210.801V135.019H215.372L215.909 130.492C217.523 133.719 220.884 135.736 224.917 135.736C231.729 135.736 236.479 129.999 236.479 122.067C236.479 114.135 231.729 108.668 224.962 108.668V108.713ZM230.653 122.157C230.653 127.355 227.875 130.985 223.662 130.985C219.45 130.985 216.492 127.266 216.492 122.023C216.492 116.779 219.539 113.598 223.662 113.598C227.785 113.598 230.653 117.138 230.653 122.202V122.157ZM251.088 129.148L243.649 109.52H237.51L247.638 135.063H248.713L245.083 144.34L250.461 145.595L264.622 109.52H258.706L251.043 129.148H251.088ZM250.999 83.2589L240.467 66.9019L249.744 57.6703H242.798L231.908 68.7841V47.0943H226.217V83.2589H231.908V75.5061L236.524 70.8903L244.366 83.3037H250.999V83.2589ZM284.205 56.9533C276.722 56.9533 271.075 61.9276 271.075 70.2629C271.075 78.5983 275.915 84.0207 284.205 84.0207C292.496 84.0207 297.291 78.912 297.291 70.2629C297.291 61.6139 292.451 56.9533 284.205 56.9533ZM284.205 79.136C279.993 79.136 276.856 75.8646 276.856 70.2629C276.856 64.6612 279.769 61.838 284.205 61.838C288.642 61.838 291.465 65.199 291.465 70.2629C291.465 75.3269 288.776 79.136 284.205 79.136ZM403.634 129.507V117.945C403.634 112.477 399.511 108.713 392.923 108.713C386.336 108.713 381.496 112.477 380.958 117.9H386.694C387.053 115.256 389.517 113.418 392.834 113.418C396.15 113.418 398.032 115.077 398.077 117.586C398.032 119.603 395.164 119.737 391.31 120.185C386.336 120.768 380.42 122.023 380.375 127.983C380.331 132.733 384.185 135.601 390.055 135.601C395.926 135.601 397.18 133.943 398.704 131.209C398.749 131.523 398.839 131.837 398.928 132.061C399.376 133.988 400.945 135.063 403.544 135.063H406.233V130.627H404.844C403.992 130.627 403.589 130.224 403.589 129.507H403.634ZM398.122 125.473C398.122 128.879 395.164 131.12 391.265 131.12C387.366 131.12 386.156 129.82 386.156 127.58C386.156 125.339 388.8 124.443 391.982 124.039C394.671 123.681 397.136 123.367 398.122 121.888V125.473ZM424.338 98.7196C422.276 98.7196 420.663 100.288 420.663 102.394C420.663 104.501 422.186 106.114 424.338 106.114C426.489 106.114 428.012 104.456 428.012 102.394C428.012 100.333 426.444 98.7196 424.338 98.7196ZM286.267 113.463C284.698 110.64 281.427 108.758 277.439 108.758C270.627 108.758 265.697 114.18 265.697 121.799C265.697 129.417 270.627 134.705 277.483 134.705C284.34 134.705 283.981 133.181 285.639 130.716V134.346C285.639 138.2 283.264 140.889 278.738 140.889C274.212 140.889 272.375 138.962 272.375 136.542H266.683C266.683 142.054 271.613 145.505 278.738 145.505C285.864 145.505 291.286 141.068 291.286 134.302V109.52H286.76L286.267 113.463ZM278.604 129.91C274.436 129.91 271.613 126.638 271.613 121.754C271.613 116.869 274.481 113.553 278.604 113.553C282.727 113.553 285.639 116.869 285.639 121.709C285.639 126.549 282.727 129.91 278.604 129.91Z";
|
|
48
|
+
var MARK_PATH = "M45.6198 76.0443L7.88672 93.7904V110.103L45.6646 92.3116L83.4424 110.103V93.7904L45.7094 76.0443H45.6198ZM7.88672 135.064H83.4424V120.32H7.88672V135.064ZM42.9758 50.2764C33.8786 53.8167 25.0055 54.4889 16.6254 52.1586C12.5473 51.0383 9.54482 49.425 7.88672 48.4391V65.289C12.7266 67.1712 19.1349 68.7845 26.7084 68.7845C34.2819 68.7845 40.4214 67.6193 48.3534 64.5272C57.4506 60.9869 66.3236 60.3147 74.7038 62.645C78.7818 63.7653 81.7843 65.3786 83.4424 66.3645V49.5146C74.4797 46.064 60.3186 43.5096 42.9758 50.2764Z";
|
|
49
|
+
var DibkLogo = (0, import_react.forwardRef)(function DibkLogo2({ variant = "full", className, ...props }, ref) {
|
|
50
|
+
const cls = ["dibk-logo", `dibk-logo--${variant}`, className].filter(Boolean).join(" ");
|
|
51
|
+
if (variant === "mark") {
|
|
52
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
53
|
+
"svg",
|
|
54
|
+
{
|
|
55
|
+
ref,
|
|
56
|
+
className: cls,
|
|
57
|
+
viewBox: "4 42 84 98",
|
|
58
|
+
role: "img",
|
|
59
|
+
"aria-label": "Direktoratet for byggkvalitet",
|
|
60
|
+
fill: "currentColor",
|
|
61
|
+
...props,
|
|
62
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: MARK_PATH })
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
67
|
+
"svg",
|
|
68
|
+
{
|
|
69
|
+
ref,
|
|
70
|
+
className: cls,
|
|
71
|
+
viewBox: "6 41 490 106",
|
|
72
|
+
role: "img",
|
|
73
|
+
"aria-label": "Direktoratet for byggkvalitet",
|
|
74
|
+
fill: "currentColor",
|
|
75
|
+
...props,
|
|
76
|
+
children: [
|
|
77
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: WORDMARK_PATH }),
|
|
78
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: MARK_PATH })
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
// src/components/Header/index.tsx
|
|
85
|
+
var import_react2 = require("react");
|
|
86
|
+
var import_designsystemet_react = require("@digdir/designsystemet-react");
|
|
87
|
+
|
|
88
|
+
// src/components/icons.tsx
|
|
89
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
90
|
+
function SearchIcon({ size = 22 }) {
|
|
91
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("svg", { viewBox: "0 0 24 24", width: size, height: size, fill: "none", "aria-hidden": "true", children: [
|
|
92
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "11", cy: "11", r: "7", stroke: "currentColor", strokeWidth: "2" }),
|
|
93
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { x1: "16.5", y1: "16.5", x2: "21", y2: "21", stroke: "currentColor", strokeWidth: "2" })
|
|
94
|
+
] });
|
|
95
|
+
}
|
|
96
|
+
function MenuIcon() {
|
|
97
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
98
|
+
"svg",
|
|
99
|
+
{
|
|
100
|
+
className: "dibk-burger",
|
|
101
|
+
viewBox: "0 0 24 24",
|
|
102
|
+
width: "24",
|
|
103
|
+
height: "24",
|
|
104
|
+
fill: "none",
|
|
105
|
+
"aria-hidden": "true",
|
|
106
|
+
children: [
|
|
107
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { className: "dibk-burger__bar--top", x1: "3", y1: "6", x2: "21", y2: "6", stroke: "currentColor", strokeWidth: "2" }),
|
|
108
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { x1: "3", y1: "12", x2: "21", y2: "12", stroke: "currentColor", strokeWidth: "2" }),
|
|
109
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { className: "dibk-burger__bar--bottom", x1: "3", y1: "18", x2: "21", y2: "18", stroke: "currentColor", strokeWidth: "2" })
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
function CloseIcon() {
|
|
115
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "dibk-xglyph", "aria-hidden": "true", children: [
|
|
116
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "dibk-xglyph__bar dibk-xglyph__bar--a" }),
|
|
117
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "dibk-xglyph__bar dibk-xglyph__bar--b" })
|
|
118
|
+
] });
|
|
119
|
+
}
|
|
120
|
+
function LockIcon({ size = 14, className }) {
|
|
121
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
122
|
+
"svg",
|
|
123
|
+
{
|
|
124
|
+
className,
|
|
125
|
+
viewBox: "0 0 24 24",
|
|
126
|
+
width: size,
|
|
127
|
+
height: size,
|
|
128
|
+
fill: "none",
|
|
129
|
+
"aria-hidden": "true",
|
|
130
|
+
focusable: "false",
|
|
131
|
+
children: [
|
|
132
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("rect", { x: "5", y: "11", width: "14", height: "9", stroke: "currentColor", strokeWidth: "2" }),
|
|
133
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M8 11V7a4 4 0 0 1 8 0v4", stroke: "currentColor", strokeWidth: "2" })
|
|
134
|
+
]
|
|
135
|
+
}
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
function ChevronRight({
|
|
139
|
+
width = 20,
|
|
140
|
+
height = 20,
|
|
141
|
+
className
|
|
142
|
+
}) {
|
|
143
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
144
|
+
"svg",
|
|
145
|
+
{
|
|
146
|
+
className,
|
|
147
|
+
width,
|
|
148
|
+
height,
|
|
149
|
+
viewBox: "0 0 20 20",
|
|
150
|
+
fill: "none",
|
|
151
|
+
"aria-hidden": "true",
|
|
152
|
+
focusable: "false",
|
|
153
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
154
|
+
"path",
|
|
155
|
+
{
|
|
156
|
+
d: "M11.6856 9.99942L6.43408 4.75666L7.94603 3.24219L14.7145 9.99942L7.94603 16.7567L6.43408 15.2422L11.6856 9.99942Z",
|
|
157
|
+
fill: "currentColor"
|
|
158
|
+
}
|
|
159
|
+
)
|
|
160
|
+
}
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// src/components/Header/index.tsx
|
|
165
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
166
|
+
var DibkHeader = (0, import_react2.forwardRef)(function DibkHeader2({ menuOpen = false, onMenuToggle, menuPanelId, onSearchToggle, search = true, shortcuts, account, homeHref = "/", linkComponent: LinkComponent = "a", children, className, ...rest }, ref) {
|
|
167
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
168
|
+
"header",
|
|
169
|
+
{
|
|
170
|
+
...rest,
|
|
171
|
+
ref,
|
|
172
|
+
className: ["dibk-header", className].filter(Boolean).join(" "),
|
|
173
|
+
"data-dibk-header": true,
|
|
174
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dibk-header__inner", children: [
|
|
175
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(LinkComponent, { className: "dibk-header__brand", href: homeHref, "aria-label": "Direktoratet for byggkvalitet, til forsiden", children: [
|
|
176
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DibkLogo, { className: "dibk-header__logo--full" }),
|
|
177
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DibkLogo, { variant: "mark", className: "dibk-header__logo--mark", "aria-hidden": true })
|
|
178
|
+
] }),
|
|
179
|
+
children,
|
|
180
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dibk-header__actions", children: [
|
|
181
|
+
menuOpen ? null : shortcuts?.map((s) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(LinkComponent, { className: "dibk-header__btn dibk-header__shortcut", href: s.href, children: s.label }, s.href)),
|
|
182
|
+
search ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
183
|
+
import_designsystemet_react.Button,
|
|
184
|
+
{
|
|
185
|
+
variant: "tertiary",
|
|
186
|
+
className: "dibk-header__btn",
|
|
187
|
+
onClick: onSearchToggle,
|
|
188
|
+
"aria-label": "S\xF8k",
|
|
189
|
+
children: [
|
|
190
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dibk-header__btn-label", children: "S\xF8k" }),
|
|
191
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SearchIcon, {})
|
|
192
|
+
]
|
|
193
|
+
}
|
|
194
|
+
) : null,
|
|
195
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
196
|
+
import_designsystemet_react.Button,
|
|
197
|
+
{
|
|
198
|
+
variant: "tertiary",
|
|
199
|
+
className: "dibk-header__btn",
|
|
200
|
+
onClick: onMenuToggle,
|
|
201
|
+
"aria-expanded": menuOpen,
|
|
202
|
+
"aria-controls": menuPanelId,
|
|
203
|
+
"aria-label": menuOpen ? "Lukk meny" : "Meny",
|
|
204
|
+
children: [
|
|
205
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dibk-header__btn-label", children: menuOpen ? "Lukk" : "Meny" }),
|
|
206
|
+
menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(CloseIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(MenuIcon, {})
|
|
207
|
+
]
|
|
208
|
+
}
|
|
209
|
+
),
|
|
210
|
+
account
|
|
211
|
+
] })
|
|
212
|
+
] })
|
|
213
|
+
}
|
|
214
|
+
);
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
// src/components/MegaMenu/index.tsx
|
|
218
|
+
var import_react4 = require("react");
|
|
219
|
+
|
|
220
|
+
// src/components/Search/index.tsx
|
|
221
|
+
var import_react3 = require("react");
|
|
222
|
+
var import_designsystemet_react2 = require("@digdir/designsystemet-react");
|
|
223
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
224
|
+
var DibkSearch = (0, import_react3.forwardRef)(function DibkSearch2({ placeholder = "S\xF8k", hint, value, onValueChange, onSearch, onClear, inputId, className, ...rest }, ref) {
|
|
225
|
+
const handleSubmit = (e) => {
|
|
226
|
+
e.preventDefault();
|
|
227
|
+
const input = e.currentTarget.elements.namedItem("dibk-search");
|
|
228
|
+
onSearch?.(input instanceof HTMLInputElement ? input.value : "");
|
|
229
|
+
};
|
|
230
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
231
|
+
"form",
|
|
232
|
+
{
|
|
233
|
+
...rest,
|
|
234
|
+
ref,
|
|
235
|
+
role: "search",
|
|
236
|
+
onSubmit: handleSubmit,
|
|
237
|
+
className: ["dibk-search", className].filter(Boolean).join(" "),
|
|
238
|
+
children: [
|
|
239
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_designsystemet_react2.Search, { className: "dibk-search__field", children: [
|
|
240
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
241
|
+
import_designsystemet_react2.Search.Input,
|
|
242
|
+
{
|
|
243
|
+
id: inputId,
|
|
244
|
+
name: "dibk-search",
|
|
245
|
+
placeholder,
|
|
246
|
+
"aria-label": placeholder,
|
|
247
|
+
...value !== void 0 ? {
|
|
248
|
+
value,
|
|
249
|
+
onChange: (e) => onValueChange?.(e.target.value)
|
|
250
|
+
} : null
|
|
251
|
+
}
|
|
252
|
+
),
|
|
253
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_designsystemet_react2.Search.Clear, { "aria-label": "T\xF8m s\xF8k", onClick: onClear }),
|
|
254
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_designsystemet_react2.Search.Button, { type: "submit", icon: true, "aria-label": "S\xF8k", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SearchIcon, { size: 26 }) })
|
|
255
|
+
] }),
|
|
256
|
+
hint ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "dibk-search__hint", children: hint }) : null
|
|
257
|
+
]
|
|
258
|
+
}
|
|
259
|
+
);
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
// src/components/MegaMenu/index.tsx
|
|
263
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
264
|
+
var DibkMegaMenu = (0, import_react4.forwardRef)(function DibkMegaMenu2({ open, onClose, children, search = true, searchPlaceholder = "S\xF8k", onSearchSubmit, searchHint, className, id: idProp, ...rest }, ref) {
|
|
265
|
+
const autoId = (0, import_react4.useId)();
|
|
266
|
+
const id = idProp ?? autoId;
|
|
267
|
+
(0, import_react4.useEffect)(() => {
|
|
268
|
+
if (!open) return;
|
|
269
|
+
const onKeyDown = (e) => {
|
|
270
|
+
if (e.key !== "Escape") return;
|
|
271
|
+
onClose();
|
|
272
|
+
document.querySelector(`[aria-controls="${CSS.escape(id)}"]`)?.focus();
|
|
273
|
+
};
|
|
274
|
+
document.addEventListener("keydown", onKeyDown);
|
|
275
|
+
return () => document.removeEventListener("keydown", onKeyDown);
|
|
276
|
+
}, [open, onClose, id]);
|
|
277
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
278
|
+
"div",
|
|
279
|
+
{
|
|
280
|
+
...rest,
|
|
281
|
+
ref,
|
|
282
|
+
id,
|
|
283
|
+
hidden: !open,
|
|
284
|
+
className: ["dibk-megamenu", className].filter(Boolean).join(" "),
|
|
285
|
+
"data-dibk-megamenu": true,
|
|
286
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "dibk-megamenu__inner", children: [
|
|
287
|
+
search ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
288
|
+
DibkSearch,
|
|
289
|
+
{
|
|
290
|
+
className: "dibk-megamenu__search",
|
|
291
|
+
placeholder: searchPlaceholder,
|
|
292
|
+
onSearch: onSearchSubmit,
|
|
293
|
+
hint: searchHint
|
|
294
|
+
}
|
|
295
|
+
) : null,
|
|
296
|
+
children
|
|
297
|
+
] })
|
|
298
|
+
}
|
|
299
|
+
);
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
// src/components/MenuSection/index.tsx
|
|
303
|
+
var import_react6 = require("react");
|
|
304
|
+
|
|
305
|
+
// src/components/IconLinkList/index.tsx
|
|
306
|
+
var import_react5 = require("react");
|
|
307
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
308
|
+
var DibkIconLinkList = (0, import_react5.forwardRef)(
|
|
309
|
+
function DibkIconLinkList2({ items, columns = 2, chevron = true, linkComponent: LinkComponent = "a", className, ...rest }, ref) {
|
|
310
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
311
|
+
"ul",
|
|
312
|
+
{
|
|
313
|
+
...rest,
|
|
314
|
+
ref,
|
|
315
|
+
className: ["dibk-iconlinklist", className].filter(Boolean).join(" "),
|
|
316
|
+
"data-columns": columns,
|
|
317
|
+
"data-dibk-iconlinklist": true,
|
|
318
|
+
children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("li", { className: "dibk-iconlinklist__item", children: [
|
|
319
|
+
item.icon ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "dibk-iconlinklist__icon", children: item.icon }) : null,
|
|
320
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "dibk-iconlinklist__body", children: [
|
|
321
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(LinkComponent, { className: "dibk-iconlinklist__link", href: item.href, children: [
|
|
322
|
+
chevron ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ChevronRight, { className: "dibk-iconlinklist__chevron" }) : null,
|
|
323
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: item.label }),
|
|
324
|
+
item.locked ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "dibk-iconlinklist__lock", children: [
|
|
325
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(LockIcon, {}),
|
|
326
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "dibk-sr-only", children: "(krever innlogging)" })
|
|
327
|
+
] }) : null
|
|
328
|
+
] }),
|
|
329
|
+
item.description ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "dibk-iconlinklist__description", children: item.description }) : null
|
|
330
|
+
] })
|
|
331
|
+
] }, `${item.label}-${item.href}`))
|
|
332
|
+
}
|
|
333
|
+
);
|
|
334
|
+
}
|
|
335
|
+
);
|
|
336
|
+
|
|
337
|
+
// src/components/MenuSection/index.tsx
|
|
338
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
339
|
+
var DibkMenuSection = (0, import_react6.forwardRef)(function DibkMenuSection2({ title, href, icon, items, linkComponent, className, ...rest }, ref) {
|
|
340
|
+
const LinkComponent = linkComponent ?? "a";
|
|
341
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
342
|
+
"section",
|
|
343
|
+
{
|
|
344
|
+
...rest,
|
|
345
|
+
ref,
|
|
346
|
+
className: ["dibk-menusection", className].filter(Boolean).join(" "),
|
|
347
|
+
"data-dibk-menusection": true,
|
|
348
|
+
children: [
|
|
349
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("h3", { className: "dibk-menusection__header", children: [
|
|
350
|
+
icon ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "dibk-menusection__icon", "aria-hidden": "true", children: icon }) : null,
|
|
351
|
+
href ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(LinkComponent, { className: "dibk-menusection__titlelink", href, children: title }) : title
|
|
352
|
+
] }),
|
|
353
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "dibk-menusection__body", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DibkIconLinkList, { items, columns: 1, linkComponent }) })
|
|
354
|
+
]
|
|
355
|
+
}
|
|
356
|
+
);
|
|
357
|
+
});
|
|
358
|
+
|
|
359
|
+
// src/components/Footer/index.tsx
|
|
360
|
+
var import_react7 = require("react");
|
|
361
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
362
|
+
var BOTTOM_LINKS = [
|
|
363
|
+
{
|
|
364
|
+
label: "Tilgjengelighetserkl\xE6ring",
|
|
365
|
+
href: "https://uustatus.no/nb/erklaringer/publisert/8ca10ee4-2679-465b-b208-ed1a992ca705"
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
label: "Personvernerkl\xE6ring",
|
|
369
|
+
href: "https://www.dibk.no/om-direktoratet-for-byggkvalitet/personvernerklaring"
|
|
370
|
+
}
|
|
371
|
+
];
|
|
372
|
+
var DibkFooter = (0, import_react7.forwardRef)(function DibkFooter2({ children, className, ...rest }, ref) {
|
|
373
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
374
|
+
"footer",
|
|
375
|
+
{
|
|
376
|
+
...rest,
|
|
377
|
+
ref,
|
|
378
|
+
className: ["dibk-footer", className].filter(Boolean).join(" "),
|
|
379
|
+
"data-dibk-footer": true,
|
|
380
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "dibk-footer__inner", children: [
|
|
381
|
+
children ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "dibk-footer__content", children }) : null,
|
|
382
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "dibk-footer__bottom", children: [
|
|
383
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("nav", { className: "dibk-footer__links", "aria-label": "Juridisk", children: BOTTOM_LINKS.map((link) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("a", { className: "dibk-footer__link", href: link.href, children: link.label }, link.href)) }),
|
|
384
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "dibk-footer__brand", children: [
|
|
385
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DibkLogo, { variant: "mark", className: "dibk-footer__mark" }),
|
|
386
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "dibk-footer__wordmark", "aria-hidden": "true", children: [
|
|
387
|
+
"Direktoratet",
|
|
388
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("br", {}),
|
|
389
|
+
"for byggkvalitet"
|
|
390
|
+
] })
|
|
391
|
+
] })
|
|
392
|
+
] })
|
|
393
|
+
] })
|
|
394
|
+
}
|
|
395
|
+
);
|
|
396
|
+
});
|
|
397
|
+
|
|
398
|
+
// src/components/SectionHeader/index.tsx
|
|
399
|
+
var import_react8 = require("react");
|
|
400
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
401
|
+
var DibkSectionHeader = (0, import_react8.forwardRef)(
|
|
402
|
+
function DibkSectionHeader2({ title, icon, description, className, ...rest }, ref) {
|
|
403
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
404
|
+
"div",
|
|
405
|
+
{
|
|
406
|
+
...rest,
|
|
407
|
+
ref,
|
|
408
|
+
className: ["dibk-sectionheader", className].filter(Boolean).join(" "),
|
|
409
|
+
"data-dibk-sectionheader": true,
|
|
410
|
+
children: [
|
|
411
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "dibk-sectionheader__row", children: [
|
|
412
|
+
icon ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "dibk-sectionheader__icon", children: icon }) : null,
|
|
413
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h1", { className: "dibk-sectionheader__title", children: title })
|
|
414
|
+
] }),
|
|
415
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "dibk-sectionheader__description", children: description }) : null
|
|
416
|
+
]
|
|
417
|
+
}
|
|
418
|
+
);
|
|
419
|
+
}
|
|
420
|
+
);
|
|
421
|
+
|
|
422
|
+
// src/components/FeedbackWidget/index.tsx
|
|
423
|
+
var import_react9 = require("react");
|
|
424
|
+
var import_designsystemet_react3 = require("@digdir/designsystemet-react");
|
|
425
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
426
|
+
var DibkFeedbackWidget = (0, import_react9.forwardRef)(
|
|
427
|
+
function DibkFeedbackWidget2({ question = "Fant du det du lette etter?", onAnswer, className, ...rest }, ref) {
|
|
428
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
429
|
+
"div",
|
|
430
|
+
{
|
|
431
|
+
...rest,
|
|
432
|
+
ref,
|
|
433
|
+
className: ["dibk-feedback", className].filter(Boolean).join(" "),
|
|
434
|
+
"data-dibk-feedback": true,
|
|
435
|
+
children: [
|
|
436
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "dibk-feedback__question", children: question }),
|
|
437
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "dibk-feedback__actions", children: [
|
|
438
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_designsystemet_react3.Button, { variant: "primary", className: "dibk-feedback__btn", onClick: () => onAnswer?.("ja"), children: "Ja" }),
|
|
439
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_designsystemet_react3.Button, { variant: "secondary", className: "dibk-feedback__btn", onClick: () => onAnswer?.("nei"), children: "Nei" })
|
|
440
|
+
] })
|
|
441
|
+
]
|
|
442
|
+
}
|
|
443
|
+
);
|
|
444
|
+
}
|
|
445
|
+
);
|
|
446
|
+
|
|
447
|
+
// src/components/AppShell/index.tsx
|
|
448
|
+
var import_react10 = require("react");
|
|
449
|
+
var import_designsystemet_react4 = require("@digdir/designsystemet-react");
|
|
450
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
451
|
+
var DibkAppShell = (0, import_react10.forwardRef)(function DibkAppShell2({
|
|
452
|
+
title,
|
|
453
|
+
homeHref = "/",
|
|
454
|
+
search = true,
|
|
455
|
+
onSearchToggle,
|
|
456
|
+
shortcuts,
|
|
457
|
+
account,
|
|
458
|
+
menuHeading = "Meny",
|
|
459
|
+
menuItems,
|
|
460
|
+
menuColumns,
|
|
461
|
+
menuExtra,
|
|
462
|
+
footerContent,
|
|
463
|
+
linkComponent,
|
|
464
|
+
children,
|
|
465
|
+
className,
|
|
466
|
+
...rest
|
|
467
|
+
}, ref) {
|
|
468
|
+
const [menuOpen, setMenuOpen] = (0, import_react10.useState)(false);
|
|
469
|
+
const menuId = (0, import_react10.useId)();
|
|
470
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { ...rest, ref, className: ["dibk-appshell", className].filter(Boolean).join(" "), children: [
|
|
471
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("a", { className: "dibk-skiplink", href: "#dibk-main", children: "Hopp til hovedinnhold" }),
|
|
472
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
473
|
+
DibkHeader,
|
|
474
|
+
{
|
|
475
|
+
homeHref,
|
|
476
|
+
search,
|
|
477
|
+
onSearchToggle,
|
|
478
|
+
shortcuts,
|
|
479
|
+
account,
|
|
480
|
+
linkComponent,
|
|
481
|
+
menuOpen,
|
|
482
|
+
onMenuToggle: () => setMenuOpen((o) => !o),
|
|
483
|
+
menuPanelId: menuId,
|
|
484
|
+
children: title ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "dibk-appshell__title", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "dibk-appshell__titletext", children: title }) }) : null
|
|
485
|
+
}
|
|
486
|
+
),
|
|
487
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(DibkMegaMenu, { id: menuId, open: menuOpen, search, onClose: () => setMenuOpen(false), children: [
|
|
488
|
+
menuColumns ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
489
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h2", { className: "dibk-sr-only", children: menuHeading }),
|
|
490
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
491
|
+
"div",
|
|
492
|
+
{
|
|
493
|
+
className: "dibk-megamenu__columns",
|
|
494
|
+
onClick: (e) => {
|
|
495
|
+
if (e.target.closest("a")) setMenuOpen(false);
|
|
496
|
+
},
|
|
497
|
+
children: menuColumns.map((sections, column) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "dibk-megamenu__column", children: sections.map((section) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
498
|
+
DibkMenuSection,
|
|
499
|
+
{
|
|
500
|
+
linkComponent,
|
|
501
|
+
...section
|
|
502
|
+
},
|
|
503
|
+
`${section.title}`
|
|
504
|
+
)) }, column))
|
|
505
|
+
}
|
|
506
|
+
)
|
|
507
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
508
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_designsystemet_react4.Heading, { level: 2, "data-size": "sm", className: "dibk-appshell__menuheading", children: menuHeading }),
|
|
509
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
510
|
+
DibkIconLinkList,
|
|
511
|
+
{
|
|
512
|
+
items: menuItems ?? [],
|
|
513
|
+
columns: 2,
|
|
514
|
+
linkComponent,
|
|
515
|
+
onClick: (e) => {
|
|
516
|
+
if (e.target.closest("a")) setMenuOpen(false);
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
)
|
|
520
|
+
] }),
|
|
521
|
+
menuExtra
|
|
522
|
+
] }),
|
|
523
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("main", { id: "dibk-main", tabIndex: -1, className: "dibk-appshell__main", hidden: menuOpen, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "dibk-appshell__container", children }) }),
|
|
524
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(DibkFooter, { children: footerContent })
|
|
525
|
+
] });
|
|
526
|
+
});
|
|
527
|
+
|
|
528
|
+
// src/components/AccountMenu/index.tsx
|
|
529
|
+
var import_react11 = require("react");
|
|
530
|
+
var import_designsystemet_react5 = require("@digdir/designsystemet-react");
|
|
531
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
532
|
+
function initials(name) {
|
|
533
|
+
const parts = name.trim().split(/\s+/);
|
|
534
|
+
const first = parts[0]?.[0] ?? "";
|
|
535
|
+
const last = parts.length > 1 ? parts[parts.length - 1][0] : "";
|
|
536
|
+
return (first + last).toUpperCase();
|
|
537
|
+
}
|
|
538
|
+
var DibkAccountMenu = (0, import_react11.forwardRef)(
|
|
539
|
+
function DibkAccountMenu2({ name, email, roleLabel, onLogout, children, className, ...rest }, ref) {
|
|
540
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_designsystemet_react5.Dropdown.TriggerContext, { children: [
|
|
541
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
542
|
+
import_designsystemet_react5.Dropdown.Trigger,
|
|
543
|
+
{
|
|
544
|
+
...rest,
|
|
545
|
+
ref,
|
|
546
|
+
variant: "tertiary",
|
|
547
|
+
className: ["dibk-header__btn", className].filter(Boolean).join(" "),
|
|
548
|
+
"aria-label": `Konto: ${name}`,
|
|
549
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_designsystemet_react5.Avatar, { "aria-hidden": true, initials: initials(name), variant: "square", "data-size": "sm" })
|
|
550
|
+
}
|
|
551
|
+
),
|
|
552
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_designsystemet_react5.Dropdown, { placement: "bottom-end", children: [
|
|
553
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_designsystemet_react5.Dropdown.Heading, { children: name }),
|
|
554
|
+
email || roleLabel ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "dibk-account__id", children: [
|
|
555
|
+
email ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_designsystemet_react5.Paragraph, { "data-size": "sm", children: email }) : null,
|
|
556
|
+
roleLabel ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_designsystemet_react5.Tag, { "data-size": "sm", children: roleLabel }) : null
|
|
557
|
+
] }) : null,
|
|
558
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_designsystemet_react5.Dropdown.List, { children: [
|
|
559
|
+
children,
|
|
560
|
+
onLogout ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_designsystemet_react5.Dropdown.Item, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_designsystemet_react5.Dropdown.Button, { onClick: onLogout, children: "Logg ut" }) }) : null
|
|
561
|
+
] })
|
|
562
|
+
] })
|
|
563
|
+
] });
|
|
564
|
+
}
|
|
565
|
+
);
|
|
566
|
+
var DibkMenuLogin = (0, import_react11.forwardRef)(
|
|
567
|
+
function DibkMenuLogin2({ className, children = "Logg inn", ...rest }, ref) {
|
|
568
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
569
|
+
import_designsystemet_react5.Button,
|
|
570
|
+
{
|
|
571
|
+
...rest,
|
|
572
|
+
ref,
|
|
573
|
+
variant: "secondary",
|
|
574
|
+
className: ["dibk-menu-login", className].filter(Boolean).join(" "),
|
|
575
|
+
children
|
|
576
|
+
}
|
|
577
|
+
);
|
|
578
|
+
}
|
|
579
|
+
);
|
|
580
|
+
|
|
581
|
+
// src/components/CopyButton/index.tsx
|
|
582
|
+
var import_react12 = require("react");
|
|
583
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
584
|
+
function ClipboardIcon({ size }) {
|
|
585
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("svg", { viewBox: "0 0 24 24", width: size, height: size, fill: "none", "aria-hidden": "true", children: [
|
|
586
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("rect", { x: "8", y: "6", width: "11", height: "14", stroke: "currentColor", strokeWidth: "1.8" }),
|
|
587
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "M16 6V4H5v14h3", stroke: "currentColor", strokeWidth: "1.8" })
|
|
588
|
+
] });
|
|
589
|
+
}
|
|
590
|
+
function useCopy(value) {
|
|
591
|
+
const [done, setDone] = (0, import_react12.useState)(false);
|
|
592
|
+
const copy = async () => {
|
|
593
|
+
try {
|
|
594
|
+
await navigator.clipboard.writeText(value);
|
|
595
|
+
} catch {
|
|
596
|
+
const ta = document.createElement("textarea");
|
|
597
|
+
ta.value = value;
|
|
598
|
+
ta.setAttribute("readonly", "");
|
|
599
|
+
ta.style.position = "absolute";
|
|
600
|
+
ta.style.left = "-9999px";
|
|
601
|
+
document.body.appendChild(ta);
|
|
602
|
+
ta.select();
|
|
603
|
+
document.execCommand("copy");
|
|
604
|
+
document.body.removeChild(ta);
|
|
605
|
+
}
|
|
606
|
+
setDone(true);
|
|
607
|
+
setTimeout(() => setDone(false), 1700);
|
|
608
|
+
};
|
|
609
|
+
return { done, copy };
|
|
610
|
+
}
|
|
611
|
+
var DibkCopyButton = (0, import_react12.forwardRef)(
|
|
612
|
+
function DibkCopyButton2({ value, ariaLabel, className, onClick, ...rest }, ref) {
|
|
613
|
+
const { done, copy } = useCopy(value);
|
|
614
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
615
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
616
|
+
"button",
|
|
617
|
+
{
|
|
618
|
+
...rest,
|
|
619
|
+
ref,
|
|
620
|
+
type: "button",
|
|
621
|
+
className: ["dibk-copybtn", className].filter(Boolean).join(" "),
|
|
622
|
+
"data-done": done ? "1" : "0",
|
|
623
|
+
"aria-label": ariaLabel ?? (done ? "Kopiert" : "Kopier"),
|
|
624
|
+
onClick: (e) => {
|
|
625
|
+
void copy();
|
|
626
|
+
onClick?.(e);
|
|
627
|
+
},
|
|
628
|
+
children: [
|
|
629
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "dibk-copybtn__ico", "aria-hidden": "true", children: done ? "\u2713" : null }),
|
|
630
|
+
done ? "Kopiert!" : "Kopier"
|
|
631
|
+
]
|
|
632
|
+
}
|
|
633
|
+
),
|
|
634
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "dibk-sr-only", role: "status", children: done ? "Kopiert" : "" })
|
|
635
|
+
] });
|
|
636
|
+
}
|
|
637
|
+
);
|
|
638
|
+
var DibkCopyIconButton = (0, import_react12.forwardRef)(
|
|
639
|
+
function DibkCopyIconButton2({ value, ariaLabel = "Kopier", size = 18, className, style, onClick, ...rest }, ref) {
|
|
640
|
+
const { done, copy } = useCopy(value);
|
|
641
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
642
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
643
|
+
"button",
|
|
644
|
+
{
|
|
645
|
+
...rest,
|
|
646
|
+
ref,
|
|
647
|
+
type: "button",
|
|
648
|
+
className: ["dibk-copyiconbtn", className].filter(Boolean).join(" "),
|
|
649
|
+
style: { fontSize: size, ...style },
|
|
650
|
+
"data-done": done ? "1" : "0",
|
|
651
|
+
"aria-label": done ? "Kopiert" : ariaLabel,
|
|
652
|
+
title: done ? "Kopiert!" : ariaLabel,
|
|
653
|
+
onClick: (e) => {
|
|
654
|
+
void copy();
|
|
655
|
+
onClick?.(e);
|
|
656
|
+
},
|
|
657
|
+
children: done ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "dibk-copyiconbtn__done", "aria-hidden": "true", children: "\u2713" }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ClipboardIcon, { size })
|
|
658
|
+
}
|
|
659
|
+
),
|
|
660
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "dibk-sr-only", role: "status", children: done ? "Kopiert" : "" })
|
|
661
|
+
] });
|
|
662
|
+
}
|
|
663
|
+
);
|
|
664
|
+
|
|
665
|
+
// src/components/CodeBlock/index.tsx
|
|
666
|
+
var import_react13 = require("react");
|
|
667
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
668
|
+
var DibkCodeBlock = (0, import_react13.forwardRef)(
|
|
669
|
+
function DibkCodeBlock2({ label, value, display, copyable = true, className, ...rest }, ref) {
|
|
670
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
671
|
+
"div",
|
|
672
|
+
{
|
|
673
|
+
...rest,
|
|
674
|
+
ref,
|
|
675
|
+
className: ["dibk-code", className].filter(Boolean).join(" "),
|
|
676
|
+
children: [
|
|
677
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "dibk-code__bar", children: [
|
|
678
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "dibk-code__label", children: label }),
|
|
679
|
+
copyable ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DibkCopyButton, { value, ariaLabel: `Kopier ${label}` }) : null
|
|
680
|
+
] }),
|
|
681
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("pre", { className: "dibk-code__pre", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("code", { children: display ?? value }) })
|
|
682
|
+
]
|
|
683
|
+
}
|
|
684
|
+
);
|
|
685
|
+
}
|
|
686
|
+
);
|
|
687
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
688
|
+
0 && (module.exports = {
|
|
689
|
+
DibkAccountMenu,
|
|
690
|
+
DibkAppShell,
|
|
691
|
+
DibkCodeBlock,
|
|
692
|
+
DibkCopyButton,
|
|
693
|
+
DibkCopyIconButton,
|
|
694
|
+
DibkFeedbackWidget,
|
|
695
|
+
DibkFooter,
|
|
696
|
+
DibkHeader,
|
|
697
|
+
DibkIconLinkList,
|
|
698
|
+
DibkLogo,
|
|
699
|
+
DibkMegaMenu,
|
|
700
|
+
DibkMenuLogin,
|
|
701
|
+
DibkMenuSection,
|
|
702
|
+
DibkSearch,
|
|
703
|
+
DibkSectionHeader,
|
|
704
|
+
...require("@digdir/designsystemet-react")
|
|
705
|
+
});
|
|
706
|
+
//# sourceMappingURL=index.cjs.map
|