@statsbygg/layout 0.0.12 → 0.0.14
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/dist/index.d.ts +40 -5
- package/dist/index.js +314 -4
- package/dist/index.js.map +1 -1
- package/dist/logo-JRXKWS5H.svg +29 -0
- package/package.json +9 -13
- package/dist/RootLayout-DOu_tRrR.d.mts +0 -11
- package/dist/RootLayout-DOu_tRrR.d.ts +0 -11
- package/dist/components/Breadcrumbs.d.mts +0 -10
- package/dist/components/Breadcrumbs.d.ts +0 -10
- package/dist/components/Breadcrumbs.js +0 -35
- package/dist/components/Breadcrumbs.js.map +0 -1
- package/dist/components/Breadcrumbs.mjs +0 -35
- package/dist/components/Breadcrumbs.mjs.map +0 -1
- package/dist/components/GlobalFooter.d.mts +0 -9
- package/dist/components/GlobalFooter.d.ts +0 -9
- package/dist/components/GlobalFooter.js +0 -12
- package/dist/components/GlobalFooter.js.map +0 -1
- package/dist/components/GlobalFooter.mjs +0 -12
- package/dist/components/GlobalFooter.mjs.map +0 -1
- package/dist/components/GlobalHeader.d.mts +0 -10
- package/dist/components/GlobalHeader.d.ts +0 -10
- package/dist/components/GlobalHeader.js +0 -35
- package/dist/components/GlobalHeader.js.map +0 -1
- package/dist/components/GlobalHeader.mjs +0 -35
- package/dist/components/GlobalHeader.mjs.map +0 -1
- package/dist/components/MenuButton.d.mts +0 -9
- package/dist/components/MenuButton.d.ts +0 -9
- package/dist/components/MenuButton.js +0 -29
- package/dist/components/MenuButton.js.map +0 -1
- package/dist/components/MenuButton.mjs +0 -29
- package/dist/components/MenuButton.mjs.map +0 -1
- package/dist/components/RootLayout.d.mts +0 -2
- package/dist/components/RootLayout.d.ts +0 -2
- package/dist/components/RootLayout.js +0 -36
- package/dist/components/RootLayout.js.map +0 -1
- package/dist/components/RootLayout.mjs +0 -36
- package/dist/components/RootLayout.mjs.map +0 -1
- package/dist/index.d.mts +0 -5
- package/dist/index.mjs +0 -8
- package/dist/index.mjs.map +0 -1
- package/dist/store/globalState.d.mts +0 -31
- package/dist/store/globalState.d.ts +0 -31
- package/dist/store/globalState.js +0 -30
- package/dist/store/globalState.js.map +0 -1
- package/dist/store/globalState.mjs +0 -30
- package/dist/store/globalState.mjs.map +0 -1
- /package/dist/{components/Breadcrumbs.module.css → Breadcrumbs.module.css} +0 -0
- /package/dist/{components/GlobalFooter.module.css → GlobalFooter.module.css} +0 -0
- /package/dist/{components/GlobalHeader.module.css → GlobalHeader.module.css} +0 -0
- /package/dist/{components/MenuButton.module.css → MenuButton.module.css} +0 -0
- /package/dist/{components/RootLayout.module.css → RootLayout.module.css} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import '
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as zustand_middleware from 'zustand/middleware';
|
|
3
|
+
import * as zustand from 'zustand';
|
|
4
|
+
|
|
5
|
+
interface RootLayoutProps {
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
zone: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare function RootLayout({ children, zone, className, }: RootLayoutProps): react_jsx_runtime.JSX.Element;
|
|
12
|
+
|
|
13
|
+
type Theme = 'light' | 'dark' | 'system';
|
|
14
|
+
type GlobalState = {
|
|
15
|
+
user?: {
|
|
16
|
+
id: string;
|
|
17
|
+
name?: string;
|
|
18
|
+
} | null;
|
|
19
|
+
theme: Theme;
|
|
20
|
+
locale: string;
|
|
21
|
+
setUser: (user: GlobalState['user']) => void;
|
|
22
|
+
setTheme: (theme: Theme) => void;
|
|
23
|
+
setLocale: (locale: string) => void;
|
|
24
|
+
initialize: () => void | Promise<void>;
|
|
25
|
+
};
|
|
26
|
+
declare const useGlobalStore: zustand.UseBoundStore<Omit<zustand.StoreApi<GlobalState>, "setState" | "persist"> & {
|
|
27
|
+
setState(partial: GlobalState | Partial<GlobalState> | ((state: GlobalState) => GlobalState | Partial<GlobalState>), replace?: false | undefined): unknown;
|
|
28
|
+
setState(state: GlobalState | ((state: GlobalState) => GlobalState), replace: true): unknown;
|
|
29
|
+
persist: {
|
|
30
|
+
setOptions: (options: Partial<zustand_middleware.PersistOptions<GlobalState, unknown, unknown>>) => void;
|
|
31
|
+
clearStorage: () => void;
|
|
32
|
+
rehydrate: () => Promise<void> | void;
|
|
33
|
+
hasHydrated: () => boolean;
|
|
34
|
+
onHydrate: (fn: (state: GlobalState) => void) => () => void;
|
|
35
|
+
onFinishHydration: (fn: (state: GlobalState) => void) => () => void;
|
|
36
|
+
getOptions: () => Partial<zustand_middleware.PersistOptions<GlobalState, unknown, unknown>>;
|
|
37
|
+
};
|
|
38
|
+
}>;
|
|
39
|
+
|
|
40
|
+
export { type GlobalState, RootLayout, type RootLayoutProps, useGlobalStore };
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,318 @@
|
|
|
1
|
-
"use
|
|
2
|
-
var _RootLayout = require('./components/RootLayout');
|
|
3
|
-
var _globalState = require('./store/globalState');
|
|
1
|
+
"use client";
|
|
4
2
|
|
|
3
|
+
// src/components/RootLayout/RootLayout.tsx
|
|
4
|
+
import { useEffect } from "react";
|
|
5
|
+
import clsx4 from "clsx";
|
|
5
6
|
|
|
7
|
+
// src/components/GlobalHeader/GlobalHeader.tsx
|
|
8
|
+
import { useState } from "react";
|
|
9
|
+
import { Link as Link2, Textfield } from "@digdir/designsystemet-react";
|
|
10
|
+
import clsx2 from "clsx";
|
|
6
11
|
|
|
7
|
-
|
|
12
|
+
// src/components/Breadcrumbs/Breadcrumbs.tsx
|
|
13
|
+
import { usePathname } from "next/navigation";
|
|
14
|
+
import { Breadcrumbs } from "@digdir/designsystemet-react";
|
|
15
|
+
import clsx from "clsx";
|
|
16
|
+
import styles from "./Breadcrumbs.module.css";
|
|
17
|
+
|
|
18
|
+
// src/routes.ts
|
|
19
|
+
var ZONE_TREES_INPUT = {
|
|
20
|
+
sbno: {
|
|
21
|
+
segment: "",
|
|
22
|
+
// primary root route, no breadcrumb
|
|
23
|
+
label: "Hjem",
|
|
24
|
+
children: [
|
|
25
|
+
{ segment: "nyheter", label: "Nyheter" }
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
lokaler: {
|
|
29
|
+
segment: "lokaler",
|
|
30
|
+
label: "Statens eide og leide lokaler",
|
|
31
|
+
children: [
|
|
32
|
+
{
|
|
33
|
+
segment: "lokalbruk",
|
|
34
|
+
label: "Lokalbruk"
|
|
35
|
+
},
|
|
36
|
+
{ segment: "veiledning", label: "Veiledning" },
|
|
37
|
+
{ segment: "statlige-eiendommer", label: "Statlige eiendommer" },
|
|
38
|
+
{ segment: "ledig-for-fremleie", label: "Ledig for fremleie" },
|
|
39
|
+
{ segment: "statistikk", label: "Statistikk" }
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
var ROUTES_INDEX = {};
|
|
44
|
+
var PARENT_INDEX = /* @__PURE__ */ new Map();
|
|
45
|
+
var ZONE_TREES = {};
|
|
46
|
+
function isSegmentNode(n) {
|
|
47
|
+
return n.segment !== void 0 && n.path === void 0;
|
|
48
|
+
}
|
|
49
|
+
function isPathNode(n) {
|
|
50
|
+
return n.path !== void 0;
|
|
51
|
+
}
|
|
52
|
+
function joinPath(base, seg) {
|
|
53
|
+
if (!base) return seg ? `/${seg}` : "/";
|
|
54
|
+
return seg ? `${base.replace(/\/+$/, "")}/${seg.replace(/^\/+/, "")}` : base || "/";
|
|
55
|
+
}
|
|
56
|
+
function normalizeToAbsolute(node, base = "") {
|
|
57
|
+
var _a;
|
|
58
|
+
const path = isSegmentNode(node) ? joinPath(base, node.segment) : isPathNode(node) ? node.path === "" ? "/" : node.path : "/";
|
|
59
|
+
const children = ((_a = node.children) != null ? _a : []).map((c) => normalizeToAbsolute(c, path));
|
|
60
|
+
return { path, label: node.label, children: children.length ? children : void 0 };
|
|
61
|
+
}
|
|
62
|
+
(function buildAll() {
|
|
63
|
+
Object.keys(ZONE_TREES_INPUT).forEach((zone) => {
|
|
64
|
+
ZONE_TREES[zone] = normalizeToAbsolute(ZONE_TREES_INPUT[zone]);
|
|
65
|
+
});
|
|
66
|
+
function walk(zone, node, parentKey) {
|
|
67
|
+
var _a;
|
|
68
|
+
const def = { zone, path: node.path, label: node.label };
|
|
69
|
+
const key = `${zone}:${node.path}`;
|
|
70
|
+
ROUTES_INDEX[zone].push(def);
|
|
71
|
+
PARENT_INDEX.set(key, parentKey);
|
|
72
|
+
for (const child of (_a = node.children) != null ? _a : []) {
|
|
73
|
+
walk(zone, child, key);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
Object.keys(ZONE_TREES).forEach((zone) => {
|
|
77
|
+
ROUTES_INDEX[zone] = [];
|
|
78
|
+
walk(zone, ZONE_TREES[zone], null);
|
|
79
|
+
});
|
|
80
|
+
})();
|
|
81
|
+
function findBestMatch(zone, pathname) {
|
|
82
|
+
var _a;
|
|
83
|
+
const list = (_a = ROUTES_INDEX[zone]) != null ? _a : [];
|
|
84
|
+
let best;
|
|
85
|
+
for (const r of list) {
|
|
86
|
+
if (pathname === r.path) {
|
|
87
|
+
best = r;
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
if (pathname.startsWith(r.path.endsWith("/") ? r.path : r.path + "/")) {
|
|
91
|
+
if (!best || r.path.length > best.path.length) best = r;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return best != null ? best : list.find((r) => {
|
|
95
|
+
var _a2;
|
|
96
|
+
return r.path === ((_a2 = ZONE_TREES[zone]) == null ? void 0 : _a2.path);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
function getZoneMenuRoutes(zone) {
|
|
100
|
+
var _a;
|
|
101
|
+
const root = ZONE_TREES[zone];
|
|
102
|
+
const children = (_a = root == null ? void 0 : root.children) != null ? _a : [];
|
|
103
|
+
return children.map((c) => ({ zone, path: c.path, label: c.label }));
|
|
104
|
+
}
|
|
105
|
+
function getAllZones() {
|
|
106
|
+
return Object.keys(ZONE_TREES);
|
|
107
|
+
}
|
|
108
|
+
function getZoneRoot(zone) {
|
|
109
|
+
var _a;
|
|
110
|
+
return ((_a = ZONE_TREES[zone]) == null ? void 0 : _a.path) || "/";
|
|
111
|
+
}
|
|
112
|
+
function labelFromSlug(slug) {
|
|
113
|
+
try {
|
|
114
|
+
const s = decodeURIComponent(slug).replace(/[-_]+/g, " ").trim();
|
|
115
|
+
return s ? s.charAt(0).toUpperCase() + s.slice(1) : slug;
|
|
116
|
+
} catch (e) {
|
|
117
|
+
return slug;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
function getBreadcrumbs(zone, pathname) {
|
|
121
|
+
var _a, _b;
|
|
122
|
+
const normalizedPathname = pathname === "/" ? pathname : pathname.replace(/\/+$/, "");
|
|
123
|
+
if (zone === "sbno" && normalizedPathname === "/") return [];
|
|
124
|
+
const match = findBestMatch(zone, normalizedPathname);
|
|
125
|
+
if (!match) return [];
|
|
126
|
+
const chain = [];
|
|
127
|
+
let key = `${zone}:${match.path}`;
|
|
128
|
+
while (key) {
|
|
129
|
+
const parentKey = PARENT_INDEX.get(key);
|
|
130
|
+
const [z, p] = key.split(":");
|
|
131
|
+
const def = ((_a = ROUTES_INDEX[z]) != null ? _a : []).find((r) => r.path === p);
|
|
132
|
+
if (def) chain.unshift(def);
|
|
133
|
+
key = parentKey != null ? parentKey : void 0;
|
|
134
|
+
}
|
|
135
|
+
const homeRoute = ((_b = ROUTES_INDEX.sbno) != null ? _b : []).find((r) => r.path === "/");
|
|
136
|
+
if (homeRoute && !(chain.length === 1 && chain[0].zone === "sbno" && chain[0].path === "/") && (chain.length === 0 || chain[0].path !== homeRoute.path)) {
|
|
137
|
+
chain.unshift(homeRoute);
|
|
138
|
+
}
|
|
139
|
+
const last = chain[chain.length - 1];
|
|
140
|
+
if (last && normalizedPathname !== last.path && normalizedPathname.startsWith(last.path.endsWith("/") ? last.path : last.path + "/")) {
|
|
141
|
+
const segments = normalizedPathname.split("/").filter(Boolean);
|
|
142
|
+
const tail = segments[segments.length - 1];
|
|
143
|
+
chain.push({ zone, path: normalizedPathname, label: labelFromSlug(tail) });
|
|
144
|
+
}
|
|
145
|
+
return chain.map((r) => ({ label: r.label, href: r.path }));
|
|
146
|
+
}
|
|
147
|
+
function transformHrefForZone(targetPath, currentZone, options) {
|
|
148
|
+
const { isDev, prodUrl } = options;
|
|
149
|
+
const targetZone = getZoneFromPathname(targetPath);
|
|
150
|
+
const isCrossZone = targetZone !== currentZone;
|
|
151
|
+
if (isCrossZone && isDev && prodUrl) {
|
|
152
|
+
return `${prodUrl}${targetPath}`;
|
|
153
|
+
}
|
|
154
|
+
const currentZoneRoot = getZoneRoot(currentZone);
|
|
155
|
+
if (!isCrossZone && isDev && currentZoneRoot !== "/") {
|
|
156
|
+
return targetPath.replace(currentZoneRoot, "") || "/";
|
|
157
|
+
}
|
|
158
|
+
return targetPath;
|
|
159
|
+
}
|
|
160
|
+
function getZoneFromPathname(pathname) {
|
|
161
|
+
if (pathname.startsWith("/lokaler")) return "lokaler";
|
|
162
|
+
return "sbno";
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// src/components/Breadcrumbs/Breadcrumbs.tsx
|
|
166
|
+
import { jsx } from "react/jsx-runtime";
|
|
167
|
+
function SbBreadcrumbs({ className, zone }) {
|
|
168
|
+
const pathname = usePathname();
|
|
169
|
+
const isDev = process.env.NODE_ENV === "development";
|
|
170
|
+
const prodUrl = "https://www.statsbygg.no";
|
|
171
|
+
const zoneRoot = getZoneRoot(zone);
|
|
172
|
+
const fullPath = isDev && zoneRoot !== "/" && !pathname.startsWith(zoneRoot) ? `${zoneRoot}${pathname}` : pathname;
|
|
173
|
+
const breadcrumbs = getBreadcrumbs(zone, fullPath);
|
|
174
|
+
if (breadcrumbs.length <= 1) {
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
return /* @__PURE__ */ jsx(Breadcrumbs, { "aria-label": "Du er her:", className: clsx(styles.breadcrumbs, className), children: /* @__PURE__ */ jsx(Breadcrumbs.List, { children: breadcrumbs.map((crumb, index) => {
|
|
178
|
+
const isLast = index === breadcrumbs.length - 1;
|
|
179
|
+
const href = transformHrefForZone(crumb.href, zone, { isDev, prodUrl });
|
|
180
|
+
return /* @__PURE__ */ jsx(Breadcrumbs.Item, { children: /* @__PURE__ */ jsx(
|
|
181
|
+
Breadcrumbs.Link,
|
|
182
|
+
{
|
|
183
|
+
href,
|
|
184
|
+
"aria-current": isLast ? "page" : void 0,
|
|
185
|
+
className: isLast ? styles.currentLink : styles.link,
|
|
186
|
+
children: crumb.label
|
|
187
|
+
}
|
|
188
|
+
) }, crumb.href);
|
|
189
|
+
}) }) });
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// src/components/MenuButton/MenuButton.tsx
|
|
193
|
+
import Link from "next/link";
|
|
194
|
+
import { Dropdown } from "@digdir/designsystemet-react";
|
|
195
|
+
import { Menu } from "lucide-react";
|
|
196
|
+
import styles2 from "./MenuButton.module.css";
|
|
197
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
198
|
+
function MenuButton({ zone }) {
|
|
199
|
+
const isDev = process.env.NODE_ENV === "development";
|
|
200
|
+
const prodUrl = "https://www.statsbygg.no";
|
|
201
|
+
const allZones = getAllZones();
|
|
202
|
+
return /* @__PURE__ */ jsxs(Dropdown.TriggerContext, { children: [
|
|
203
|
+
/* @__PURE__ */ jsxs(Dropdown.Trigger, { asChild: true, className: styles2.menuButton, children: [
|
|
204
|
+
/* @__PURE__ */ jsx2(Menu, { size: 20, "aria-hidden": true }),
|
|
205
|
+
"Meny"
|
|
206
|
+
] }),
|
|
207
|
+
/* @__PURE__ */ jsx2(Dropdown, { children: isDev ? /* @__PURE__ */ jsx2("div", { className: styles2.devContainer, children: allZones.map((z) => {
|
|
208
|
+
const routes = getZoneMenuRoutes(z);
|
|
209
|
+
return /* @__PURE__ */ jsxs("div", { className: styles2.zoneSection, children: [
|
|
210
|
+
/* @__PURE__ */ jsx2("div", { className: styles2.zoneTitle, children: z }),
|
|
211
|
+
/* @__PURE__ */ jsx2(Dropdown.List, { children: routes.map((r) => /* @__PURE__ */ jsx2(Dropdown.Item, { children: /* @__PURE__ */ jsx2(Link, { href: transformHrefForZone(r.path, zone, { isDev, prodUrl }), children: r.label }) }, `${r.zone}:${r.path}`)) })
|
|
212
|
+
] }, z);
|
|
213
|
+
}) }) : /* @__PURE__ */ jsx2(Dropdown.List, { children: getZoneMenuRoutes(zone).map((r) => /* @__PURE__ */ jsx2(Dropdown.Item, { children: /* @__PURE__ */ jsx2(Link, { href: transformHrefForZone(r.path, zone, { isDev, prodUrl }), children: r.label }) }, `${r.zone}:${r.path}`)) }) })
|
|
214
|
+
] });
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// src/components/GlobalHeader/GlobalHeader.tsx
|
|
218
|
+
import styles3 from "./GlobalHeader.module.css";
|
|
219
|
+
|
|
220
|
+
// src/logo.svg
|
|
221
|
+
var logo_default = "./logo-JRXKWS5H.svg";
|
|
222
|
+
|
|
223
|
+
// src/components/GlobalHeader/GlobalHeader.tsx
|
|
224
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
225
|
+
function GlobalHeader({ className, zone }) {
|
|
226
|
+
const [searchValue, setSearchValue] = useState("");
|
|
227
|
+
return /* @__PURE__ */ jsx3("header", { className: clsx2(styles3.header, className), children: /* @__PURE__ */ jsxs2("div", { className: styles3.headerContainer, children: [
|
|
228
|
+
/* @__PURE__ */ jsxs2("div", { className: styles3.topBarContainer, children: [
|
|
229
|
+
/* @__PURE__ */ jsx3(Link2, { href: "https://www.statsbygg.no", children: /* @__PURE__ */ jsx3("img", { src: logo_default, alt: "Logo", className: styles3.logo }) }),
|
|
230
|
+
/* @__PURE__ */ jsxs2("div", { className: styles3.actionsContainer, children: [
|
|
231
|
+
/* @__PURE__ */ jsx3(
|
|
232
|
+
Textfield,
|
|
233
|
+
{
|
|
234
|
+
value: searchValue,
|
|
235
|
+
onChange: (e) => setSearchValue(e.target.value),
|
|
236
|
+
placeholder: "S\xF8k...",
|
|
237
|
+
className: styles3.searchInput,
|
|
238
|
+
"aria-label": "S\xF8k"
|
|
239
|
+
}
|
|
240
|
+
),
|
|
241
|
+
/* @__PURE__ */ jsx3(MenuButton, { zone })
|
|
242
|
+
] })
|
|
243
|
+
] }),
|
|
244
|
+
/* @__PURE__ */ jsx3(SbBreadcrumbs, { zone })
|
|
245
|
+
] }) });
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// src/components/GlobalFooter/GlobalFooter.tsx
|
|
249
|
+
import { Paragraph } from "@digdir/designsystemet-react";
|
|
250
|
+
import clsx3 from "clsx";
|
|
251
|
+
import styles4 from "./GlobalFooter.module.css";
|
|
252
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
253
|
+
function GlobalFooter({ className }) {
|
|
254
|
+
return /* @__PURE__ */ jsx4("footer", { className: clsx3(styles4.footer, className), children: /* @__PURE__ */ jsx4("div", { className: styles4.container, children: /* @__PURE__ */ jsx4("div", { className: styles4.content, children: /* @__PURE__ */ jsx4(Paragraph, { children: "Statsbygg Footer" }) }) }) });
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// src/components/RootLayout/RootLayout.tsx
|
|
258
|
+
import styles5 from "./RootLayout.module.css";
|
|
259
|
+
|
|
260
|
+
// src/store/globalState.ts
|
|
261
|
+
import { create } from "zustand";
|
|
262
|
+
import { persist, createJSONStorage } from "zustand/middleware";
|
|
263
|
+
var creator = (set, get) => ({
|
|
264
|
+
user: null,
|
|
265
|
+
theme: "light",
|
|
266
|
+
locale: "no",
|
|
267
|
+
setUser: (user) => set({ user }),
|
|
268
|
+
setTheme: (theme) => {
|
|
269
|
+
set({ theme });
|
|
270
|
+
if (typeof document !== "undefined") {
|
|
271
|
+
document.documentElement.setAttribute("data-color-scheme", theme);
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
setLocale: (locale) => set({ locale }),
|
|
275
|
+
initialize: () => {
|
|
276
|
+
if (typeof document !== "undefined") {
|
|
277
|
+
document.documentElement.setAttribute("data-color-scheme", get().theme);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
var useGlobalStore = create()(
|
|
282
|
+
persist(creator, {
|
|
283
|
+
name: "statsbygg-global-state",
|
|
284
|
+
storage: createJSONStorage(() => localStorage)
|
|
285
|
+
})
|
|
286
|
+
);
|
|
287
|
+
|
|
288
|
+
// src/components/RootLayout/RootLayout.tsx
|
|
289
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
290
|
+
function RootLayout({
|
|
291
|
+
children,
|
|
292
|
+
zone,
|
|
293
|
+
className
|
|
294
|
+
}) {
|
|
295
|
+
const initialize = useGlobalStore((state) => state.initialize);
|
|
296
|
+
useEffect(() => {
|
|
297
|
+
try {
|
|
298
|
+
const maybe = initialize();
|
|
299
|
+
if (maybe && typeof maybe.then === "function") {
|
|
300
|
+
maybe.catch((error) => {
|
|
301
|
+
console.error("Failed to initialize global state:", error);
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
} catch (error) {
|
|
305
|
+
console.error("Failed to initialize global state:", error);
|
|
306
|
+
}
|
|
307
|
+
}, [initialize]);
|
|
308
|
+
return /* @__PURE__ */ jsxs3("div", { className: clsx4(styles5.root, className), "data-zone": zone, children: [
|
|
309
|
+
/* @__PURE__ */ jsx5(GlobalHeader, { zone }),
|
|
310
|
+
/* @__PURE__ */ jsx5("main", { className: styles5.main, children }),
|
|
311
|
+
/* @__PURE__ */ jsx5(GlobalFooter, {})
|
|
312
|
+
] });
|
|
313
|
+
}
|
|
314
|
+
export {
|
|
315
|
+
RootLayout,
|
|
316
|
+
useGlobalStore
|
|
317
|
+
};
|
|
8
318
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/jimmy/dev/work/statsbygg-components/packages/layout/dist/index.js","../src/index.ts"],"names":[],"mappings":"AAAA,qFAAY;ACEZ,qDAA2B;AAG3B,kDAA+B;ADF/B;AACE;AACA;AACF,kGAAC","file":"/home/jimmy/dev/work/statsbygg-components/packages/layout/dist/index.js","sourcesContent":[null,"'use client';\n\nexport { RootLayout } from './components/RootLayout';\nexport type { RootLayoutProps } from './components/RootLayout';\n\nexport { useGlobalStore } from './store/globalState';\nexport type { GlobalState } from './store/globalState';\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/RootLayout/RootLayout.tsx","../src/components/GlobalHeader/GlobalHeader.tsx","../src/components/Breadcrumbs/Breadcrumbs.tsx","../src/routes.ts","../src/components/MenuButton/MenuButton.tsx","../src/components/GlobalFooter/GlobalFooter.tsx","../src/store/globalState.ts"],"sourcesContent":["'use client';\n\nimport { useEffect } from 'react';\nimport clsx from 'clsx';\nimport { GlobalHeader } from '../GlobalHeader';\nimport { GlobalFooter } from '../GlobalFooter';\nimport type { RootLayoutProps } from './RootLayout.types';\nimport styles from './RootLayout.module.css';\nimport { useGlobalStore } from '@/store/globalState';\n\nexport function RootLayout({\n children,\n zone, \n className,\n}: RootLayoutProps) {\n const initialize = useGlobalStore((state) => state.initialize);\n\n useEffect(() => {\n try {\n const maybe = initialize();\n if (maybe && typeof (maybe as Promise<void>).then === 'function') {\n (maybe as Promise<void>).catch((error) => {\n console.error('Failed to initialize global state:', error);\n });\n }\n } catch (error) {\n console.error('Failed to initialize global state:', error);\n }\n }, [initialize]);\n\n\n return (\n <div className={clsx(styles.root, className)} data-zone={zone}>\n <GlobalHeader zone={zone}/>\n <main className={styles.main}>{children}</main>\n <GlobalFooter />\n </div>\n );\n}\n","'use client';\n\nimport { useState } from 'react';\nimport { Link, Textfield } from '@digdir/designsystemet-react';\nimport clsx from 'clsx';\nimport { Breadcrumbs } from '../Breadcrumbs';\nimport { MenuButton } from '../MenuButton';\nimport type { GlobalHeaderProps } from './GlobalHeader.types';\nimport styles from './GlobalHeader.module.css';\nimport logo from '../../logo.svg'; \n\nexport function GlobalHeader({ className, zone }: GlobalHeaderProps) {\n const [searchValue, setSearchValue] = useState('');\n\n return (\n <header className={clsx(styles.header, className)}>\n <div className={styles.headerContainer}>\n <div className={styles.topBarContainer}>\n <Link href=\"https://www.statsbygg.no\">\n <img src={logo} alt=\"Logo\" className={styles.logo} />\n </Link>\n <div className={styles.actionsContainer}>\n <Textfield\n value={searchValue}\n onChange={(e) => setSearchValue(e.target.value)}\n placeholder=\"Søk...\"\n className={styles.searchInput}\n aria-label=\"Søk\"\n />\n <MenuButton zone={zone}/>\n </div>\n </div>\n <Breadcrumbs zone={zone} />\n </div>\n </header>\n );\n}","'use client';\n\nimport { usePathname } from 'next/navigation';\nimport { Breadcrumbs } from '@digdir/designsystemet-react';\nimport clsx from 'clsx';\nimport type { BreadcrumbsProps } from './Breadcrumbs.types';\nimport styles from './Breadcrumbs.module.css';\nimport { getBreadcrumbs, getZoneRoot, transformHrefForZone } from '@/routes';\n\nexport function SbBreadcrumbs({ className, zone }: BreadcrumbsProps) {\n const pathname = usePathname();\n const isDev = process.env.NODE_ENV === 'development';\n const prodUrl = 'https://www.statsbygg.no';\n const zoneRoot = getZoneRoot(zone);\n \n const fullPath = isDev && zoneRoot !== '/' && !pathname.startsWith(zoneRoot)\n ? `${zoneRoot}${pathname}`\n : pathname;\n \n const breadcrumbs = getBreadcrumbs(zone, fullPath);\n\n if (breadcrumbs.length <= 1) {\n return null;\n }\n\n\n return (\n <Breadcrumbs aria-label=\"Du er her:\" className={clsx(styles.breadcrumbs, className)}>\n <Breadcrumbs.List>\n {breadcrumbs.map((crumb, index) => {\n const isLast = index === breadcrumbs.length - 1;\n const href = transformHrefForZone(crumb.href, zone, { isDev, prodUrl });\n \n return (\n <Breadcrumbs.Item key={crumb.href}>\n <Breadcrumbs.Link\n href={href}\n aria-current={isLast ? 'page' : undefined}\n className={isLast ? styles.currentLink : styles.link}\n >\n {crumb.label}\n </Breadcrumbs.Link>\n </Breadcrumbs.Item>\n );\n })}\n </Breadcrumbs.List>\n </Breadcrumbs>\n );\n}","export type RouteNodeInput =\n | { segment: string; label: string; children?: RouteNodeInput[] }\n | { path: string; label: string; children?: RouteNodeInput[] };\n\nexport type RouteNode = {\n path: string;\n label: string;\n children?: RouteNode[];\n};\n\nexport type RouteDefinition = {\n path: string;\n label: string;\n zone: string;\n};\n\nconst ZONE_TREES_INPUT: Record<string, RouteNodeInput> = {\n sbno: {\n segment: '',// primary root route, no breadcrumb\n label: 'Hjem',\n children: [\n { segment: 'nyheter', label: 'Nyheter' },\n ],\n },\n lokaler: {\n segment: 'lokaler',\n label: 'Statens eide og leide lokaler',\n children: [\n {\n segment: 'lokalbruk', label: 'Lokalbruk'\n },\n { segment: 'veiledning', label: 'Veiledning' },\n { segment: 'statlige-eiendommer', label: 'Statlige eiendommer' },\n { segment: 'ledig-for-fremleie', label: 'Ledig for fremleie' },\n { segment: 'statistikk', label: 'Statistikk' },\n ],\n },\n};\n\n\ntype Key = `${string}:${string}`; // `${zone}:${absolutePath}`\n\nconst ROUTES_INDEX: Record<string, RouteDefinition[]> = {};\nconst PARENT_INDEX = new Map<Key, Key | null>(); // child -> parent\nconst ZONE_TREES: Record<string, RouteNode> = {}; // normalized absolute trees\n\nfunction isSegmentNode(n: RouteNodeInput): n is Extract<RouteNodeInput, { segment: string }> {\n return (n as any).segment !== undefined && (n as any).path === undefined;\n}\nfunction isPathNode(n: RouteNodeInput): n is Extract<RouteNodeInput, { path: string }> {\n return (n as any).path !== undefined;\n}\n\nfunction joinPath(base: string, seg: string): string {\n if (!base) return seg ? `/${seg}` : '/';\n return seg ? `${base.replace(/\\/+$/, '')}/${seg.replace(/^\\/+/, '')}` : base || '/';\n}\n\nfunction normalizeToAbsolute(node: RouteNodeInput, base = ''): RouteNode {\n const path = isSegmentNode(node)\n ? joinPath(base, node.segment)\n : isPathNode(node)\n ? (node.path === '' ? '/' : node.path)\n : '/';\n\n const children = (node.children ?? []).map((c) => normalizeToAbsolute(c, path));\n return { path, label: (node as any).label, children: children.length ? children : undefined };\n}\n\n(function buildAll() {\n // Normalize each zone tree to absolute paths\n Object.keys(ZONE_TREES_INPUT).forEach((zone) => {\n ZONE_TREES[zone] = normalizeToAbsolute(ZONE_TREES_INPUT[zone]);\n });\n\n // Build flat indexes + parent relationships\n function walk(zone: string, node: RouteNode, parentKey: Key | null) {\n const def: RouteDefinition = { zone, path: node.path, label: node.label };\n const key: Key = `${zone}:${node.path}`;\n ROUTES_INDEX[zone].push(def);\n PARENT_INDEX.set(key, parentKey);\n for (const child of node.children ?? []) {\n walk(zone, child, key);\n }\n }\n\n (Object.keys(ZONE_TREES) as string[]).forEach((zone) => {\n ROUTES_INDEX[zone] = [];\n walk(zone, ZONE_TREES[zone], null);\n });\n})();\n\n\nfunction findBestMatch(zone: string, pathname: string): RouteDefinition | undefined {\n const list = ROUTES_INDEX[zone] ?? [];\n let best: RouteDefinition | undefined;\n\n for (const r of list) {\n if (pathname === r.path) {\n best = r; // exact wins\n break;\n }\n if (pathname.startsWith(r.path.endsWith('/') ? r.path : r.path + '/')) {\n if (!best || r.path.length > best.path.length) best = r;\n }\n }\n // fallback: zone root\n return best ?? list.find((r) => r.path === ZONE_TREES[zone]?.path);\n}\n\nexport function getZoneRoutes(zone: string): RouteDefinition[] {\n return ROUTES_INDEX[zone] ?? [];\n}\n\n// Top-level links for a zone’s menu (children of the zone root)\nexport function getZoneMenuRoutes(zone: string): RouteDefinition[] {\n const root = ZONE_TREES[zone];\n const children = root?.children ?? [];\n return children.map((c) => ({ zone, path: c.path, label: c.label }));\n}\n\nexport function getAllZones(): string[] {\n return Object.keys(ZONE_TREES);\n}\n\nexport function getZoneRoot(zone: string): string {\n return ZONE_TREES[zone]?.path || '/';\n}\n\n// prettify dynamic slug labels\nfunction labelFromSlug(slug: string): string {\n try {\n const s = decodeURIComponent(slug).replace(/[-_]+/g, ' ').trim();\n return s ? s.charAt(0).toUpperCase() + s.slice(1) : slug;\n } catch {\n return slug;\n }\n}\n\nexport function getBreadcrumbs(\n zone: string,\n pathname: string\n): Array<{ label: string; href: string }> {\n\n const normalizedPathname = pathname === '/' ? pathname : pathname.replace(/\\/+$/, '');\n\n // sbno root has no crumbs\n if (zone === 'sbno' && normalizedPathname === '/') return [];\n\n const match = findBestMatch(zone, normalizedPathname);\n if (!match) return [];\n\n const chain: RouteDefinition[] = [];\n let key: Key | undefined = `${zone}:${match.path}`;\n while (key) {\n const parentKey = PARENT_INDEX.get(key);\n const [z, p] = key.split(':') as [string, string];\n const def = (ROUTES_INDEX[z] ?? []).find((r) => r.path === p);\n if (def) chain.unshift(def);\n key = parentKey ?? undefined;\n }\n\n const homeRoute = (ROUTES_INDEX.sbno ?? []).find((r) => r.path === '/');\n if (\n homeRoute &&\n !(chain.length === 1 && chain[0].zone === 'sbno' && chain[0].path === '/') &&\n (chain.length === 0 || chain[0].path !== homeRoute.path)\n ) {\n chain.unshift(homeRoute);\n }\n\n // If the pathname is deeper than the best static match, add a dynamic tail\n const last = chain[chain.length - 1];\n if (last && normalizedPathname !== last.path && normalizedPathname.startsWith(last.path.endsWith('/') ? last.path : last.path + '/')) {\n const segments = normalizedPathname.split('/').filter(Boolean);\n const tail = segments[segments.length - 1];\n chain.push({ zone, path: normalizedPathname, label: labelFromSlug(tail) });\n }\n\n return chain.map((r) => ({ label: r.label, href: r.path }));\n}\n\nexport function transformHrefForZone(\n targetPath: string,\n currentZone: string,\n options: {\n isDev: boolean;\n prodUrl?: string;\n }\n): string {\n const { isDev, prodUrl } = options;\n\n const targetZone = getZoneFromPathname(targetPath);\n const isCrossZone = targetZone !== currentZone;\n\n if (isCrossZone && isDev && prodUrl) {\n return `${prodUrl}${targetPath}`;\n }\n\n const currentZoneRoot = getZoneRoot(currentZone);\n if (!isCrossZone && isDev && currentZoneRoot !== '/') {\n return targetPath.replace(currentZoneRoot, '') || '/';\n }\n\n return targetPath;\n}\n\nexport function getZoneFromPathname(pathname: string): string {\n if (pathname.startsWith('/lokaler')) return 'lokaler';\n return 'sbno';\n}","'use client';\n\nimport Link from 'next/link';\nimport { Dropdown } from '@digdir/designsystemet-react';\nimport { Menu } from 'lucide-react';\nimport { getZoneMenuRoutes, getAllZones, transformHrefForZone } from '@/routes';\nimport type { MenuButtonProps } from './MenuButton.types';\nimport styles from './MenuButton.module.css';\n\nexport function MenuButton({ zone }: MenuButtonProps) {\n const isDev = process.env.NODE_ENV === 'development';\n // TODO: Temporary here. Should come from env or something\n const prodUrl = 'https://www.statsbygg.no';\n const allZones = getAllZones();\n\n return (\n <Dropdown.TriggerContext>\n <Dropdown.Trigger asChild className={styles.menuButton}>\n <Menu size={20} aria-hidden />\n Meny\n </Dropdown.Trigger>\n <Dropdown>\n {isDev ? (\n <div className={styles.devContainer}>\n {allZones.map((z) => {\n const routes = getZoneMenuRoutes(z);\n return (\n <div key={z} className={styles.zoneSection}>\n <div className={styles.zoneTitle}>{z}</div>\n <Dropdown.List>\n {routes.map((r) => (\n <Dropdown.Item key={`${r.zone}:${r.path}`}>\n <Link href={transformHrefForZone(r.path, zone, { isDev, prodUrl })}>\n {r.label}\n </Link>\n </Dropdown.Item>\n ))}\n </Dropdown.List>\n </div>\n );\n })}\n </div>\n ) : (\n <Dropdown.List>\n {getZoneMenuRoutes(zone).map((r) => (\n <Dropdown.Item key={`${r.zone}:${r.path}`}>\n <Link href={transformHrefForZone(r.path, zone, { isDev, prodUrl })}>\n {r.label}\n </Link>\n </Dropdown.Item>\n ))}\n </Dropdown.List>\n )}\n </Dropdown>\n </Dropdown.TriggerContext>\n );\n}","'use client';\n\nimport { Paragraph } from '@digdir/designsystemet-react';\nimport clsx from 'clsx';\nimport type { GlobalFooterProps } from './GlobalFooter.types';\nimport styles from './GlobalFooter.module.css';\n\nexport function GlobalFooter({ className }: GlobalFooterProps) {\n\n return (\n <footer className={clsx(styles.footer, className)}>\n <div className={styles.container}>\n <div className={styles.content}>\n <Paragraph>\n Statsbygg Footer\n </Paragraph>\n\n\n </div>\n </div>\n </footer>\n );\n}","import { create, StateCreator } from 'zustand';\nimport { persist, createJSONStorage } from 'zustand/middleware';\n\nexport type Theme = 'light' | 'dark' | 'system';\n\nexport type GlobalState = {\n user?: { id: string; name?: string } | null;\n theme: Theme;\n locale: string;\n setUser: (user: GlobalState['user']) => void;\n setTheme: (theme: Theme) => void;\n setLocale: (locale: string) => void;\n initialize: () => void | Promise<void>;\n};\n\nconst creator: StateCreator<GlobalState, [['zustand/persist', unknown]]> = (set, get) => ({\n user: null,\n theme: 'light',\n locale: 'no',\n setUser: (user) => set({ user }),\n setTheme: (theme) => {\n set({ theme });\n if (typeof document !== 'undefined') {\n document.documentElement.setAttribute('data-color-scheme', theme);\n }\n },\n setLocale: (locale) => set({ locale }),\n initialize: () => {\n if (typeof document !== 'undefined') {\n document.documentElement.setAttribute('data-color-scheme', get().theme);\n }\n },\n});\n\nexport const useGlobalStore = create<GlobalState>()(\n persist(creator, {\n name: 'statsbygg-global-state',\n storage: createJSONStorage(() => localStorage),\n })\n);\n"],"mappings":";;;AAEA,SAAS,iBAAiB;AAC1B,OAAOA,WAAU;;;ACDjB,SAAS,gBAAgB;AACzB,SAAS,QAAAC,OAAM,iBAAiB;AAChC,OAAOC,WAAU;;;ACFjB,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAC5B,OAAO,UAAU;AAEjB,OAAO,YAAY;;;ACUnB,IAAM,mBAAmD;AAAA,EACvD,MAAM;AAAA,IACJ,SAAS;AAAA;AAAA,IACT,OAAO;AAAA,IACP,UAAU;AAAA,MACR,EAAE,SAAS,WAAW,OAAO,UAAU;AAAA,IACzC;AAAA,EACF;AAAA,EACA,SAAS;AAAA,IACP,SAAS;AAAA,IACT,OAAO;AAAA,IACP,UAAU;AAAA,MACR;AAAA,QACE,SAAS;AAAA,QAAa,OAAO;AAAA,MAC/B;AAAA,MACA,EAAE,SAAS,cAAc,OAAO,aAAa;AAAA,MAC7C,EA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,IACF,SAAS,OAAO;AACd,cAAQ,MAAM,sCAAsC,KAAK;AAAA,IAC3D;AAAA,EACF,GAAG,CAAC,UAAU,CAAC;AAGf,SACE,gBAAAA,MAAC,SAAI,WAAWC,MAAKC,QAAO,MAAM,SAAS,GAAG,aAAW,MACvD;AAAA,oBAAAH,KAAC,gBAAa,MAAW;AAAA,IACzB,gBAAAA,KAAC,UAAK,WAAWG,QAAO,MAAO,UAAS;AAAA,IACxC,gBAAAH,KAAC,gBAAa;AAAA,KAChB;AAEJ;","names":["clsx","Link","clsx","_a","styles","jsx","styles","jsx","jsxs","clsx","styles","Link","clsx","styles","jsx","styles","jsx","jsxs","clsx","styles"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 75.1 14.9">
|
|
3
|
+
<!-- Generator: Adobe Illustrator 29.8.2, SVG Export Plug-In . SVG Version: 2.1.1 Build 3) -->
|
|
4
|
+
<defs>
|
|
5
|
+
<style>
|
|
6
|
+
.st0 {
|
|
7
|
+
fill: #131819;
|
|
8
|
+
}
|
|
9
|
+
</style>
|
|
10
|
+
</defs>
|
|
11
|
+
<path class="st0" d="M16.6,11.4c-1.2-.5-1.8-1.1-1.8-2s.3-1.2.7-1.5c.5-.4,1.1-.5,1.8-.5s1.1.1,2.1.4v1.6h-.6c0-.4,0-.7-.2-1-.3-.4-.8-.5-1.2-.5-1,0-1.5.5-1.5,1.1s.3.8,1.5,1.4c1.4.6,2.4,1,2.4,2.3s-1.2,2.2-2.5,2.2-1,0-1.8-.3c-.4-.1-.5-.2-.5-.2v-2.1h.6c0,.8,0,2,1.7,2s1.6-.5,1.6-1.2-.3-.9-1.5-1.5l-.5-.2h-.3Z"/>
|
|
12
|
+
<path class="st0" d="M41.6,11.4c-1.2-.5-1.8-1.1-1.8-2s.3-1.2.7-1.5c.5-.4,1.1-.5,1.8-.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20
|
+
<g>
|
|
21
|
+
<g>
|
|
22
|
+
<polygon class="st0" points="0 9.9 .7 10.6 9.7 10.6 10.4 9.9 5.2 7.3 0 9.9"/>
|
|
23
|
+
<rect class="st0" x=".7" y="11.4" width="9" height=".6"/>
|
|
24
|
+
<rect class="st0" x=".7" y="12.7" width="9" height=".6"/>
|
|
25
|
+
<rect class="st0" x=".7" y="14.1" width="9" height=".6"/>
|
|
26
|
+
</g>
|
|
27
|
+
<path class="st0" d="M8.1,3.1c-.3,0-.7,0-.9.2-.1-.1-.3-.2-.6-.2s-.8.2-.9.2h-.2s.5-.2.5-.8-.7-.8-.7-.8v-.9h.5v-.3h-.5v-.5h-.3v.5h-.5v.3h.5v.9s-.7,0-.7.8.5.8.5.8h-.2c-.1,0-.5-.2-.9-.2s-.5.1-.6.2c-.2-.1-.6-.2-.9-.2-.5,0-1.1.4-1,.9,0,.5.5,2.3.5,2.3h6.9s.4-1.8.5-2.3c0-.5-.5-.9-1-.9ZM3.2,5.2s-.2.5-.8.5-.9-.4-.9-.7h.1s.2.2.4.2.3-.1.3-.3-.1-.3-.2-.3c-.2,0-.3.2-.4.2,0,0-.2,0-.1-.1,0,0,.3-.2.3-.4s-.2-.3-.3-.3c0-.2.2-.6.8-.6s.8.1.8.1v.5s-.2,0-.2.3.2.4.2.4h0q0,.1-.1,0s-.2-.2-.3-.2-.2.1-.2.3.1.3.2.3.3-.2.3-.2h.1v.2h0ZM5,5.2s-.3.5-.8.5-.8-.5-.8-.5v-.2h.1s.2.2.3.2.2-.1.2-.3-.1-.3-.2-.3-.2.1-.3.2h-.1c0-.1.2-.3.2-.5s-.2-.3-.2-.3v-.4c0-.2.2-.2.4-.2s.9,0,1.1.1v.5s-.2,0-.2.3.2.4.2.4h0q0,.1-.1,0s-.2-.2-.3-.2-.2.1-.2.3.1.3.2.3.3-.2.3-.2h.1v.2h0ZM7,5.2s-.3.5-.8.5-.8-.5-.8-.5v-.2h.1s.2.2.3.2.2-.1.2-.3-.1-.3-.2-.3-.2.1-.3.2h-.1c0-.1.2-.3.2-.5s-.2-.3-.2-.3v-.5c.2,0,.9-.1,1.1-.1s.4,0,.4.2v.4s-.2,0-.2.3.2.4.2.4h0q0,.1-.1,0s-.2-.2-.3-.2-.2.1-.2.3.1.3.2.3.3-.2.3-.2h.1v.2h0ZM8.8,4.7s0,.1-.1.1c0,0-.2-.2-.4-.2s-.2.2-.2.3.2.3.3.3.3-.2.4-.2h.1c0,.3-.3.7-.9.7s-.8-.5-.8-.5v-.2h.1s.2.2.3.2.2-.1.2-.3-.1-.3-.2-.3-.2.1-.3.2h-.1c0-.1.2-.3.2-.5s-.2-.3-.2-.3v-.5s0-.1.8-.1.8.4.8.6c-.1,0-.3,0-.3.3s.2.3.3.4ZM8.3,4.5c-.1,0-.2.1-.2.3s.2.3.3.3"/>
|
|
28
|
+
</g>
|
|
29
|
+
</svg>
|
package/package.json
CHANGED
|
@@ -1,31 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@statsbygg/layout",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
7
|
"description": "Shared layout components for Statsbygg microfrontend architecture",
|
|
8
|
+
"type": "module",
|
|
8
9
|
"main": "./dist/index.js",
|
|
9
|
-
"module": "./dist/index.mjs",
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
11
|
-
"files": [
|
|
12
|
-
"dist/**"
|
|
13
|
-
],
|
|
14
11
|
"exports": {
|
|
15
12
|
".": {
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
},
|
|
20
|
-
"./components/*": "./dist/components/*",
|
|
21
|
-
"./store/*": "./dist/store/*"
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"default": "./dist/index.js"
|
|
15
|
+
}
|
|
22
16
|
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist/**"
|
|
19
|
+
],
|
|
23
20
|
"sideEffects": [
|
|
24
21
|
"**/*.css"
|
|
25
22
|
],
|
|
26
23
|
"scripts": {
|
|
27
|
-
"build": "tsup &&
|
|
28
|
-
"copy:css": "node scripts/copy-css.js",
|
|
24
|
+
"build": "tsup && node scripts/copy-css.js",
|
|
29
25
|
"dev": "tsup --watch",
|
|
30
26
|
"lint": "eslint src --ext .ts,.tsx",
|
|
31
27
|
"type-check": "tsc --noEmit",
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
|
|
3
|
-
interface RootLayoutProps {
|
|
4
|
-
children: React.ReactNode;
|
|
5
|
-
zone: string;
|
|
6
|
-
className?: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
declare function RootLayout({ children, zone, className, }: RootLayoutProps): react_jsx_runtime.JSX.Element;
|
|
10
|
-
|
|
11
|
-
export { RootLayout as R, type RootLayoutProps as a };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
|
|
3
|
-
interface RootLayoutProps {
|
|
4
|
-
children: React.ReactNode;
|
|
5
|
-
zone: string;
|
|
6
|
-
className?: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
declare function RootLayout({ children, zone, className, }: RootLayoutProps): react_jsx_runtime.JSX.Element;
|
|
10
|
-
|
|
11
|
-
export { RootLayout as R, type RootLayoutProps as a };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
|
|
3
|
-
interface BreadcrumbsProps {
|
|
4
|
-
className?: string;
|
|
5
|
-
zone: string;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
declare function SbBreadcrumbs({ className, zone }: BreadcrumbsProps): react_jsx_runtime.JSX.Element | null;
|
|
9
|
-
|
|
10
|
-
export { SbBreadcrumbs };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
|
|
3
|
-
interface BreadcrumbsProps {
|
|
4
|
-
className?: string;
|
|
5
|
-
zone: string;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
declare function SbBreadcrumbs({ className, zone }: BreadcrumbsProps): react_jsx_runtime.JSX.Element | null;
|
|
9
|
-
|
|
10
|
-
export { SbBreadcrumbs };
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }"use client";
|
|
2
|
-
var _jsxruntime = require('react/jsx-runtime');
|
|
3
|
-
var _navigation = require('next/navigation');
|
|
4
|
-
var _designsystemetreact = require('@digdir/designsystemet-react');
|
|
5
|
-
var _clsx = require('clsx'); var _clsx2 = _interopRequireDefault(_clsx);
|
|
6
|
-
var _Breadcrumbsmodulecss = require('./Breadcrumbs.module.css'); var _Breadcrumbsmodulecss2 = _interopRequireDefault(_Breadcrumbsmodulecss);
|
|
7
|
-
var _routes = require('@/routes');
|
|
8
|
-
function SbBreadcrumbs({ className, zone }) {
|
|
9
|
-
const pathname = _navigation.usePathname.call(void 0, );
|
|
10
|
-
const isDev = process.env.NODE_ENV === "development";
|
|
11
|
-
const prodUrl = "https://www.statsbygg.no";
|
|
12
|
-
const zoneRoot = _routes.getZoneRoot.call(void 0, zone);
|
|
13
|
-
const fullPath = isDev && zoneRoot !== "/" && !pathname.startsWith(zoneRoot) ? `${zoneRoot}${pathname}` : pathname;
|
|
14
|
-
const breadcrumbs = _routes.getBreadcrumbs.call(void 0, zone, fullPath);
|
|
15
|
-
if (breadcrumbs.length <= 1) {
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _designsystemetreact.Breadcrumbs, { "aria-label": "Du er her:", className: _clsx2.default.call(void 0, _Breadcrumbsmodulecss2.default.breadcrumbs, className), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _designsystemetreact.Breadcrumbs.List, { children: breadcrumbs.map((crumb, index) => {
|
|
19
|
-
const isLast = index === breadcrumbs.length - 1;
|
|
20
|
-
const href = _routes.transformHrefForZone.call(void 0, crumb.href, zone, { isDev, prodUrl });
|
|
21
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _designsystemetreact.Breadcrumbs.Item, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
22
|
-
_designsystemetreact.Breadcrumbs.Link,
|
|
23
|
-
{
|
|
24
|
-
href,
|
|
25
|
-
"aria-current": isLast ? "page" : void 0,
|
|
26
|
-
className: isLast ? _Breadcrumbsmodulecss2.default.currentLink : _Breadcrumbsmodulecss2.default.link,
|
|
27
|
-
children: crumb.label
|
|
28
|
-
}
|
|
29
|
-
) }, crumb.href);
|
|
30
|
-
}) }) });
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
exports.SbBreadcrumbs = SbBreadcrumbs;
|
|
35
|
-
//# sourceMappingURL=Breadcrumbs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/jimmy/dev/work/statsbygg-components/packages/layout/dist/components/Breadcrumbs.js","../../src/components/Breadcrumbs/Breadcrumbs.tsx"],"names":[],"mappings":"AAAA,qLAAY;ACmCE,+CAAA;AAjCd,6CAA4B;AAC5B,mEAA4B;AAC5B,wEAAiB;AAEjB,4IAAmB;AACnB,kCAAkE;AAE3D,SAAS,aAAA,CAAc,EAAE,SAAA,EAAW,KAAK,CAAA,EAAqB;AACpE,EAAA,MAAM,SAAA,EAAW,qCAAA,CAAY;AAC5B,EAAA,MAAM,MAAA,EAAQ,OAAA,CAAQ,GAAA,CAAI,SAAA,IAAa,aAAA;AACvC,EAAA,MAAM,QAAA,EAAU,0BAAA;AAChB,EAAA,MAAM,SAAA,EAAW,iCAAA,IAAgB,CAAA;AAEjC,EAAA,MAAM,SAAA,EAAW,MAAA,GAAS,SAAA,IAAa,IAAA,GAAO,CAAC,QAAA,CAAS,UAAA,CAAW,QAAQ,EAAA,EACvE,CAAA,EAAA;AAG6C,EAAA;AAEpB,EAAA;AACpB,IAAA;AACT,EAAA;AAIuC,EAAA;AAGe,IAAA;AACwB,IAAA;AAIlE,IAAA;AAAa,MAAA;AAAZ,MAAA;AACC,QAAA;AACgC,QAAA;AACgB,QAAA;AAEzC,QAAA;AAAA,MAAA;AAEX,IAAA;AAIR,EAAA;AAEJ;ADjBkF;AACA;AACA","file":"/home/jimmy/dev/work/statsbygg-components/packages/layout/dist/components/Breadcrumbs.js","sourcesContent":[null,"'use client';\n\nimport { usePathname } from 'next/navigation';\nimport { Breadcrumbs } from '@digdir/designsystemet-react';\nimport clsx from 'clsx';\nimport type { BreadcrumbsProps } from './Breadcrumbs.types';\nimport styles from './Breadcrumbs.module.css';\nimport { getBreadcrumbs, getZoneRoot, transformHrefForZone } from '@/routes';\n\nexport function SbBreadcrumbs({ className, zone }: BreadcrumbsProps) {\n const pathname = usePathname();\n const isDev = process.env.NODE_ENV === 'development';\n const prodUrl = 'https://www.statsbygg.no';\n const zoneRoot = getZoneRoot(zone);\n \n const fullPath = isDev && zoneRoot !== '/' && !pathname.startsWith(zoneRoot)\n ? `${zoneRoot}${pathname}`\n : pathname;\n \n const breadcrumbs = getBreadcrumbs(zone, fullPath);\n\n if (breadcrumbs.length <= 1) {\n return null;\n }\n\n\n return (\n <Breadcrumbs aria-label=\"Du er her:\" className={clsx(styles.breadcrumbs, className)}>\n <Breadcrumbs.List>\n {breadcrumbs.map((crumb, index) => {\n const isLast = index === breadcrumbs.length - 1;\n const href = transformHrefForZone(crumb.href, zone, { isDev, prodUrl });\n \n return (\n <Breadcrumbs.Item key={crumb.href}>\n <Breadcrumbs.Link\n href={href}\n aria-current={isLast ? 'page' : undefined}\n className={isLast ? styles.currentLink : styles.link}\n >\n {crumb.label}\n </Breadcrumbs.Link>\n </Breadcrumbs.Item>\n );\n })}\n </Breadcrumbs.List>\n </Breadcrumbs>\n );\n}"]}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { usePathname } from "next/navigation";
|
|
4
|
-
import { Breadcrumbs } from "@digdir/designsystemet-react";
|
|
5
|
-
import clsx from "clsx";
|
|
6
|
-
import styles from "./Breadcrumbs.module.css";
|
|
7
|
-
import { getBreadcrumbs, getZoneRoot, transformHrefForZone } from "@/routes";
|
|
8
|
-
function SbBreadcrumbs({ className, zone }) {
|
|
9
|
-
const pathname = usePathname();
|
|
10
|
-
const isDev = process.env.NODE_ENV === "development";
|
|
11
|
-
const prodUrl = "https://www.statsbygg.no";
|
|
12
|
-
const zoneRoot = getZoneRoot(zone);
|
|
13
|
-
const fullPath = isDev && zoneRoot !== "/" && !pathname.startsWith(zoneRoot) ? `${zoneRoot}${pathname}` : pathname;
|
|
14
|
-
const breadcrumbs = getBreadcrumbs(zone, fullPath);
|
|
15
|
-
if (breadcrumbs.length <= 1) {
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
return /* @__PURE__ */ jsx(Breadcrumbs, { "aria-label": "Du er her:", className: clsx(styles.breadcrumbs, className), children: /* @__PURE__ */ jsx(Breadcrumbs.List, { children: breadcrumbs.map((crumb, index) => {
|
|
19
|
-
const isLast = index === breadcrumbs.length - 1;
|
|
20
|
-
const href = transformHrefForZone(crumb.href, zone, { isDev, prodUrl });
|
|
21
|
-
return /* @__PURE__ */ jsx(Breadcrumbs.Item, { children: /* @__PURE__ */ jsx(
|
|
22
|
-
Breadcrumbs.Link,
|
|
23
|
-
{
|
|
24
|
-
href,
|
|
25
|
-
"aria-current": isLast ? "page" : void 0,
|
|
26
|
-
className: isLast ? styles.currentLink : styles.link,
|
|
27
|
-
children: crumb.label
|
|
28
|
-
}
|
|
29
|
-
) }, crumb.href);
|
|
30
|
-
}) }) });
|
|
31
|
-
}
|
|
32
|
-
export {
|
|
33
|
-
SbBreadcrumbs
|
|
34
|
-
};
|
|
35
|
-
//# sourceMappingURL=Breadcrumbs.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/Breadcrumbs/Breadcrumbs.tsx"],"sourcesContent":["'use client';\n\nimport { usePathname } from 'next/navigation';\nimport { Breadcrumbs } from '@digdir/designsystemet-react';\nimport clsx from 'clsx';\nimport type { BreadcrumbsProps } from './Breadcrumbs.types';\nimport styles from './Breadcrumbs.module.css';\nimport { getBreadcrumbs, getZoneRoot, transformHrefForZone } from '@/routes';\n\nexport function SbBreadcrumbs({ className, zone }: BreadcrumbsProps) {\n const pathname = usePathname();\n const isDev = process.env.NODE_ENV === 'development';\n const prodUrl = 'https://www.statsbygg.no';\n const zoneRoot = getZoneRoot(zone);\n \n const fullPath = isDev && zoneRoot !== '/' && !pathname.startsWith(zoneRoot)\n ? `${zoneRoot}${pathname}`\n : pathname;\n \n const breadcrumbs = getBreadcrumbs(zone, fullPath);\n\n if (breadcrumbs.length <= 1) {\n return null;\n }\n\n\n return (\n <Breadcrumbs aria-label=\"Du er her:\" className={clsx(styles.breadcrumbs, className)}>\n <Breadcrumbs.List>\n {breadcrumbs.map((crumb, index) => {\n const isLast = index === breadcrumbs.length - 1;\n const href = transformHrefForZone(crumb.href, zone, { isDev, prodUrl });\n \n return (\n <Breadcrumbs.Item key={crumb.href}>\n <Breadcrumbs.Link\n href={href}\n aria-current={isLast ? 'page' : undefined}\n className={isLast ? styles.currentLink : styles.link}\n >\n {crumb.label}\n </Breadcrumbs.Link>\n </Breadcrumbs.Item>\n );\n })}\n </Breadcrumbs.List>\n </Breadcrumbs>\n );\n}"],"mappings":";AAmCc;AAjCd,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAC5B,OAAO,UAAU;AAEjB,OAAO,YAAY;AACnB,SAAS,gBAAgB,aAAa,4BAA4B;AAE3D,SAAS,cAAc,EAAE,WAAW,KAAK,GAAqB;AACpE,QAAM,WAAW,YAAY;AAC5B,QAAM,QAAQ,QAAQ,IAAI,aAAa;AACvC,QAAM,UAAU;AAChB,QAAM,WAAW,YAAY,IAAI;AAEjC,QAAM,WAAW,SAAS,aAAa,OAAO,CAAC,SAAS,WAAW,QAAQ,IACvE,GAAG,QAAQ,GAAG,QAAQ,KACtB;AAEJ,QAAM,cAAc,eAAe,MAAM,QAAQ;AAEjD,MAAI,YAAY,UAAU,GAAG;AAC3B,WAAO;AAAA,EACT;AAGA,SACE,oBAAC,eAAY,cAAW,cAAa,WAAW,KAAK,OAAO,aAAa,SAAS,GAChF,8BAAC,YAAY,MAAZ,EACE,sBAAY,IAAI,CAAC,OAAO,UAAU;AACjC,UAAM,SAAS,UAAU,YAAY,SAAS;AAC9C,UAAM,OAAO,qBAAqB,MAAM,MAAM,MAAM,EAAE,OAAO,QAAQ,CAAC;AAEtE,WACE,oBAAC,YAAY,MAAZ,EACC;AAAA,MAAC,YAAY;AAAA,MAAZ;AAAA,QACC;AAAA,QACA,gBAAc,SAAS,SAAS;AAAA,QAChC,WAAW,SAAS,OAAO,cAAc,OAAO;AAAA,QAE/C,gBAAM;AAAA;AAAA,IACT,KAPqB,MAAM,IAQ7B;AAAA,EAEJ,CAAC,GACH,GACF;AAEJ;","names":[]}
|