@statsbygg/layout 0.0.6 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,22 @@
1
+ .breadcrumbs {
2
+ --dsc-breadcrumbs-color: var(--ds-color-text-default);
3
+ padding: 2.5rem 0 0 0;
4
+ }
5
+
6
+ .link {
7
+ text-decoration: underline;
8
+ text-underline-offset: 2px;
9
+ color: var(--ds-color-text-default);
10
+ }
11
+
12
+ .link:hover
13
+ .link:visited{
14
+ color: var(--ds-color-text-default);
15
+ }
16
+
17
+ .currentLink {
18
+ text-decoration: none;
19
+ font-weight: 500;
20
+ pointer-events: none;
21
+ color: var(--ds-color-text-default);
22
+ }
@@ -0,0 +1,28 @@
1
+ .footer {
2
+ background-color: var(--ds-color-neutral-surface-subtle);
3
+ border-top: 1px solid var(--ds-color-neutral-border-subtle);
4
+ margin-top: auto;
5
+ }
6
+
7
+ .container {
8
+ max-width: 1440px;
9
+ margin: 0 auto;
10
+ padding: var(--ds-spacing-6) var(--ds-spacing-4);
11
+ }
12
+
13
+ .content {
14
+ display: flex;
15
+ justify-content: space-between;
16
+ align-items: center;
17
+ gap: var(--ds-spacing-4);
18
+ flex-wrap: wrap;
19
+ }
20
+
21
+ @media (max-width: 768px) {
22
+ .content {
23
+ flex-direction: column;
24
+ align-items: flex-start;
25
+ }
26
+
27
+
28
+ }
@@ -0,0 +1,70 @@
1
+ .header {
2
+ background-color: var(--ds-color-accent-surface-tinted);
3
+ border-bottom: 1px solid var(--ds-color-neutral-border-subtle);
4
+ position: sticky;
5
+ top: 0;
6
+ z-index: 100;
7
+ }
8
+
9
+ .headerContainer {
10
+ max-width: 90rem;
11
+ margin: 0 auto;
12
+ padding: 0 var(--ds-size-30);
13
+ }
14
+
15
+ .topBarContainer {
16
+ display: flex;
17
+ justify-content: space-between;
18
+ align-items: center;
19
+ padding: 1.25rem 0;
20
+ }
21
+
22
+ .logo {
23
+ margin: 0;
24
+ color: var(--ds-color-neutral-text-default);
25
+ white-space: nowrap;
26
+ display: flex;
27
+ align-items: center;
28
+ min-height: inherit;
29
+ }
30
+
31
+ .actionsContainer {
32
+ display: flex;
33
+ align-items: stretch;
34
+ gap: var(--ds-size-9);
35
+ min-height: inherit;
36
+ }
37
+
38
+ .searchInput {
39
+ min-width: 12.5rem;
40
+ display: flex;
41
+ align-items: center;
42
+ }
43
+
44
+ @media (max-width: 768px) {
45
+ .container {
46
+ padding: 0 var(--ds-spacing-4);
47
+ }
48
+
49
+ .topBar {
50
+ flex-wrap: wrap;
51
+ padding: var(--ds-spacing-4) 0;
52
+ }
53
+
54
+ .actions {
55
+ order: 3;
56
+ width: 100%;
57
+ flex-direction: column;
58
+ gap: var(--ds-spacing-3);
59
+ }
60
+
61
+ .searchInput {
62
+ width: 100%;
63
+ min-width: auto;
64
+ }
65
+
66
+ .menuButton {
67
+ width: 100%;
68
+ justify-content: center;
69
+ }
70
+ }
@@ -0,0 +1,41 @@
1
+ .userInfo {
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: var(--ds-spacing-1);
5
+ padding: var(--ds-spacing-2) var(--ds-spacing-3);
6
+ }
7
+
8
+ .userName {
9
+ font-size: var(--ds-font-size-sm);
10
+ font-weight: var(--ds-font-weight-medium);
11
+ color: var(--ds-color-neutral-text-default);
12
+ }
13
+
14
+ .userEmail {
15
+ font-size: var(--ds-font-size-xs);
16
+ color: var(--ds-color-neutral-text-subtle);
17
+ }
18
+
19
+ .menuButton {
20
+ background-color: var(--ds-color-neutral-base-default);
21
+ }
22
+
23
+ .devContainer {
24
+ display: flex;
25
+ gap: var(--ds-spacing-4);
26
+ padding: var(--ds-spacing-2);
27
+ }
28
+
29
+ .zoneSection {
30
+ flex: 1;
31
+ min-width: 12rem;
32
+ }
33
+
34
+ .zoneTitle {
35
+ font-weight: 600;
36
+ padding: var(--ds-spacing-2);
37
+ color: var(--ds-color-neutral-text-default);
38
+ border-bottom: 1px solid var(--ds-color-neutral-border-subtle);
39
+ margin-bottom: var(--ds-spacing-2);
40
+ text-transform: capitalize;
41
+ }
@@ -0,0 +1,9 @@
1
+ .root {
2
+ display: flex;
3
+ flex-direction: column;
4
+ min-height: 100vh;
5
+ }
6
+
7
+ .main {
8
+ flex: 1;
9
+ }
package/dist/index.js CHANGED
@@ -1,10 +1,8 @@
1
1
  "use strict";
2
2
  "use client";
3
- var __create = Object.create;
4
3
  var __defProp = Object.defineProperty;
5
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf;
8
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
7
  var __export = (target, all) => {
10
8
  for (var name in all)
@@ -18,345 +16,15 @@ var __copyProps = (to, from, except, desc) => {
18
16
  }
19
17
  return to;
20
18
  };
21
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
- // If the importer is in node compatibility mode or this is not an ESM
23
- // file that has been converted to a CommonJS file using a Babel-
24
- // compatible transform (i.e. "__esModule" has not been set), then set
25
- // "default" to the CommonJS "module.exports" for node compatibility.
26
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
- mod
28
- ));
29
19
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
-
31
- // src/index.ts
32
20
  var index_exports = {};
33
21
  __export(index_exports, {
34
- RootLayout: () => RootLayout,
35
- useGlobalStore: () => useGlobalStore
22
+ RootLayout: () => import_RootLayout.RootLayout,
23
+ useGlobalStore: () => import_globalState.useGlobalStore
36
24
  });
37
25
  module.exports = __toCommonJS(index_exports);
38
-
39
- // src/components/RootLayout/RootLayout.tsx
40
- var import_react2 = require("react");
41
- var import_clsx4 = __toESM(require("clsx"));
42
-
43
- // src/components/GlobalHeader/GlobalHeader.tsx
44
- var import_react = require("react");
45
- var import_designsystemet_react3 = require("@digdir/designsystemet-react");
46
- var import_clsx2 = __toESM(require("clsx"));
47
-
48
- // src/components/Breadcrumbs/Breadcrumbs.tsx
49
- var import_navigation = require("next/navigation");
50
- var import_designsystemet_react = require("@digdir/designsystemet-react");
51
- var import_clsx = __toESM(require("clsx"));
52
-
53
- // src/components/Breadcrumbs/Breadcrumbs.module.css
54
- var Breadcrumbs_default = {};
55
-
56
- // src/routes.ts
57
- var ZONE_TREES_INPUT = {
58
- sbno: {
59
- segment: "",
60
- // primary root route, no breadcrumb
61
- label: "Hjem",
62
- children: [
63
- { segment: "nyheter", label: "Nyheter" }
64
- ]
65
- },
66
- lokaler: {
67
- segment: "lokaler",
68
- label: "Statens eide og leide lokaler",
69
- children: [
70
- {
71
- segment: "lokalbruk",
72
- label: "Lokalbruk"
73
- },
74
- { segment: "veiledning", label: "Veiledning" },
75
- { segment: "statlige-eiendommer", label: "Statlige eiendommer" },
76
- { segment: "ledig-for-fremleie", label: "Ledig for fremleie" },
77
- { segment: "statistikk", label: "Statistikk" }
78
- ]
79
- }
80
- };
81
- var ROUTES_INDEX = {};
82
- var PARENT_INDEX = /* @__PURE__ */ new Map();
83
- var ZONE_TREES = {};
84
- function isSegmentNode(n) {
85
- return n.segment !== void 0 && n.path === void 0;
86
- }
87
- function isPathNode(n) {
88
- return n.path !== void 0;
89
- }
90
- function joinPath(base, seg) {
91
- if (!base) return seg ? `/${seg}` : "/";
92
- return seg ? `${base.replace(/\/+$/, "")}/${seg.replace(/^\/+/, "")}` : base || "/";
93
- }
94
- function normalizeToAbsolute(node, base = "") {
95
- var _a;
96
- const path = isSegmentNode(node) ? joinPath(base, node.segment) : isPathNode(node) ? node.path === "" ? "/" : node.path : "/";
97
- const children = ((_a = node.children) != null ? _a : []).map((c) => normalizeToAbsolute(c, path));
98
- return { path, label: node.label, children: children.length ? children : void 0 };
99
- }
100
- (function buildAll() {
101
- Object.keys(ZONE_TREES_INPUT).forEach((zone) => {
102
- ZONE_TREES[zone] = normalizeToAbsolute(ZONE_TREES_INPUT[zone]);
103
- });
104
- function walk(zone, node, parentKey) {
105
- var _a;
106
- const def = { zone, path: node.path, label: node.label };
107
- const key = `${zone}:${node.path}`;
108
- ROUTES_INDEX[zone].push(def);
109
- PARENT_INDEX.set(key, parentKey);
110
- for (const child of (_a = node.children) != null ? _a : []) {
111
- walk(zone, child, key);
112
- }
113
- }
114
- Object.keys(ZONE_TREES).forEach((zone) => {
115
- ROUTES_INDEX[zone] = [];
116
- walk(zone, ZONE_TREES[zone], null);
117
- });
118
- })();
119
- function findBestMatch(zone, pathname) {
120
- var _a;
121
- const list = (_a = ROUTES_INDEX[zone]) != null ? _a : [];
122
- let best;
123
- for (const r of list) {
124
- if (pathname === r.path) {
125
- best = r;
126
- break;
127
- }
128
- if (pathname.startsWith(r.path.endsWith("/") ? r.path : r.path + "/")) {
129
- if (!best || r.path.length > best.path.length) best = r;
130
- }
131
- }
132
- return best != null ? best : list.find((r) => {
133
- var _a2;
134
- return r.path === ((_a2 = ZONE_TREES[zone]) == null ? void 0 : _a2.path);
135
- });
136
- }
137
- function getZoneMenuRoutes(zone) {
138
- var _a;
139
- const root = ZONE_TREES[zone];
140
- const children = (_a = root == null ? void 0 : root.children) != null ? _a : [];
141
- return children.map((c) => ({ zone, path: c.path, label: c.label }));
142
- }
143
- function getAllZones() {
144
- return Object.keys(ZONE_TREES);
145
- }
146
- function getZoneRoot(zone) {
147
- var _a;
148
- return ((_a = ZONE_TREES[zone]) == null ? void 0 : _a.path) || "/";
149
- }
150
- function labelFromSlug(slug) {
151
- try {
152
- const s = decodeURIComponent(slug).replace(/[-_]+/g, " ").trim();
153
- return s ? s.charAt(0).toUpperCase() + s.slice(1) : slug;
154
- } catch (e) {
155
- return slug;
156
- }
157
- }
158
- function getBreadcrumbs(zone, pathname) {
159
- var _a, _b;
160
- const normalizedPathname = pathname === "/" ? pathname : pathname.replace(/\/+$/, "");
161
- if (zone === "sbno" && normalizedPathname === "/") return [];
162
- const match = findBestMatch(zone, normalizedPathname);
163
- if (!match) return [];
164
- const chain = [];
165
- let key = `${zone}:${match.path}`;
166
- while (key) {
167
- const parentKey = PARENT_INDEX.get(key);
168
- const [z, p] = key.split(":");
169
- const def = ((_a = ROUTES_INDEX[z]) != null ? _a : []).find((r) => r.path === p);
170
- if (def) chain.unshift(def);
171
- key = parentKey != null ? parentKey : void 0;
172
- }
173
- const homeRoute = ((_b = ROUTES_INDEX.sbno) != null ? _b : []).find((r) => r.path === "/");
174
- if (homeRoute && !(chain.length === 1 && chain[0].zone === "sbno" && chain[0].path === "/") && (chain.length === 0 || chain[0].path !== homeRoute.path)) {
175
- chain.unshift(homeRoute);
176
- }
177
- const last = chain[chain.length - 1];
178
- if (last && normalizedPathname !== last.path && normalizedPathname.startsWith(last.path.endsWith("/") ? last.path : last.path + "/")) {
179
- const segments = normalizedPathname.split("/").filter(Boolean);
180
- const tail = segments[segments.length - 1];
181
- chain.push({ zone, path: normalizedPathname, label: labelFromSlug(tail) });
182
- }
183
- return chain.map((r) => ({ label: r.label, href: r.path }));
184
- }
185
- function transformHrefForZone(targetPath, currentZone, options) {
186
- const { isDev, prodUrl } = options;
187
- const targetZone = getZoneFromPathname(targetPath);
188
- const isCrossZone = targetZone !== currentZone;
189
- if (isCrossZone && isDev && prodUrl) {
190
- return `${prodUrl}${targetPath}`;
191
- }
192
- const currentZoneRoot = getZoneRoot(currentZone);
193
- if (!isCrossZone && isDev && currentZoneRoot !== "/") {
194
- return targetPath.replace(currentZoneRoot, "") || "/";
195
- }
196
- return targetPath;
197
- }
198
- function getZoneFromPathname(pathname) {
199
- if (pathname.startsWith("/lokaler")) return "lokaler";
200
- return "sbno";
201
- }
202
-
203
- // src/components/Breadcrumbs/Breadcrumbs.tsx
204
- var import_jsx_runtime = require("react/jsx-runtime");
205
- function SbBreadcrumbs({ className, zone }) {
206
- const pathname = (0, import_navigation.usePathname)();
207
- const isDev = process.env.NODE_ENV === "development";
208
- const prodUrl = "https://www.statsbygg.no";
209
- const zoneRoot = getZoneRoot(zone);
210
- const fullPath = isDev && zoneRoot !== "/" && !pathname.startsWith(zoneRoot) ? `${zoneRoot}${pathname}` : pathname;
211
- const breadcrumbs = getBreadcrumbs(zone, fullPath);
212
- if (breadcrumbs.length <= 1) {
213
- return null;
214
- }
215
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_designsystemet_react.Breadcrumbs, { "aria-label": "Du er her:", className: (0, import_clsx.default)(Breadcrumbs_default.breadcrumbs, className), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_designsystemet_react.Breadcrumbs.List, { children: breadcrumbs.map((crumb, index) => {
216
- const isLast = index === breadcrumbs.length - 1;
217
- const href = transformHrefForZone(crumb.href, zone, { isDev, prodUrl });
218
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_designsystemet_react.Breadcrumbs.Item, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
219
- import_designsystemet_react.Breadcrumbs.Link,
220
- {
221
- href,
222
- "aria-current": isLast ? "page" : void 0,
223
- className: isLast ? Breadcrumbs_default.currentLink : Breadcrumbs_default.link,
224
- children: crumb.label
225
- }
226
- ) }, crumb.href);
227
- }) }) });
228
- }
229
-
230
- // src/components/MenuButton/MenuButton.tsx
231
- var import_link = __toESM(require("next/link"));
232
- var import_designsystemet_react2 = require("@digdir/designsystemet-react");
233
- var import_lucide_react = require("lucide-react");
234
-
235
- // src/components/MenuButton/MenuButton.module.css
236
- var MenuButton_default = {};
237
-
238
- // src/components/MenuButton/MenuButton.tsx
239
- var import_jsx_runtime2 = require("react/jsx-runtime");
240
- function MenuButton({ zone }) {
241
- const isDev = process.env.NODE_ENV === "development";
242
- const prodUrl = "https://www.statsbygg.no";
243
- const allZones = getAllZones();
244
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_designsystemet_react2.Dropdown.TriggerContext, { children: [
245
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_designsystemet_react2.Dropdown.Trigger, { asChild: true, className: MenuButton_default.menuButton, children: [
246
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_lucide_react.Menu, { size: 20, "aria-hidden": true }),
247
- "Meny"
248
- ] }),
249
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_designsystemet_react2.Dropdown, { children: isDev ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: MenuButton_default.devContainer, children: allZones.map((z) => {
250
- const routes = getZoneMenuRoutes(z);
251
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: MenuButton_default.zoneSection, children: [
252
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: MenuButton_default.zoneTitle, children: z }),
253
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_designsystemet_react2.Dropdown.List, { children: routes.map((r) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_designsystemet_react2.Dropdown.Item, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_link.default, { href: transformHrefForZone(r.path, zone, { isDev, prodUrl }), children: r.label }) }, `${r.zone}:${r.path}`)) })
254
- ] }, z);
255
- }) }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_designsystemet_react2.Dropdown.List, { children: getZoneMenuRoutes(zone).map((r) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_designsystemet_react2.Dropdown.Item, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_link.default, { href: transformHrefForZone(r.path, zone, { isDev, prodUrl }), children: r.label }) }, `${r.zone}:${r.path}`)) }) })
256
- ] });
257
- }
258
-
259
- // src/components/GlobalHeader/GlobalHeader.module.css
260
- var GlobalHeader_default = {};
261
-
262
- // src/logo.svg
263
- var logo_default = "./logo-JRXKWS5H.svg";
264
-
265
- // src/components/GlobalHeader/GlobalHeader.tsx
266
- var import_jsx_runtime3 = require("react/jsx-runtime");
267
- function GlobalHeader({ className, zone }) {
268
- const [searchValue, setSearchValue] = (0, import_react.useState)("");
269
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("header", { className: (0, import_clsx2.default)(GlobalHeader_default.header, className), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: GlobalHeader_default.headerContainer, children: [
270
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: GlobalHeader_default.topBarContainer, children: [
271
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_designsystemet_react3.Link, { href: "https://www.statsbygg.no", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("img", { src: logo_default, alt: "Logo", className: GlobalHeader_default.logo }) }),
272
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: GlobalHeader_default.actionsContainer, children: [
273
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
274
- import_designsystemet_react3.Textfield,
275
- {
276
- value: searchValue,
277
- onChange: (e) => setSearchValue(e.target.value),
278
- placeholder: "S\xF8k...",
279
- className: GlobalHeader_default.searchInput,
280
- "aria-label": "S\xF8k"
281
- }
282
- ),
283
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(MenuButton, { zone })
284
- ] })
285
- ] }),
286
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SbBreadcrumbs, { zone })
287
- ] }) });
288
- }
289
-
290
- // src/components/GlobalFooter/GlobalFooter.tsx
291
- var import_designsystemet_react4 = require("@digdir/designsystemet-react");
292
- var import_clsx3 = __toESM(require("clsx"));
293
-
294
- // src/components/GlobalFooter/GlobalFooter.module.css
295
- var GlobalFooter_default = {};
296
-
297
- // src/components/GlobalFooter/GlobalFooter.tsx
298
- var import_jsx_runtime4 = require("react/jsx-runtime");
299
- function GlobalFooter({ className }) {
300
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("footer", { className: (0, import_clsx3.default)(GlobalFooter_default.footer, className), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: GlobalFooter_default.container, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: GlobalFooter_default.content, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_designsystemet_react4.Paragraph, { children: "Statsbygg Footer" }) }) }) });
301
- }
302
-
303
- // src/components/RootLayout/RootLayout.module.css
304
- var RootLayout_default = {};
305
-
306
- // src/store/globalState.ts
307
- var import_zustand = require("zustand");
308
- var import_middleware = require("zustand/middleware");
309
- var creator = (set, get) => ({
310
- user: null,
311
- theme: "light",
312
- locale: "no",
313
- setUser: (user) => set({ user }),
314
- setTheme: (theme) => {
315
- set({ theme });
316
- if (typeof document !== "undefined") {
317
- document.documentElement.setAttribute("data-color-scheme", theme);
318
- }
319
- },
320
- setLocale: (locale) => set({ locale }),
321
- initialize: () => {
322
- if (typeof document !== "undefined") {
323
- document.documentElement.setAttribute("data-color-scheme", get().theme);
324
- }
325
- }
326
- });
327
- var useGlobalStore = (0, import_zustand.create)()(
328
- (0, import_middleware.persist)(creator, {
329
- name: "statsbygg-global-state",
330
- storage: (0, import_middleware.createJSONStorage)(() => localStorage)
331
- })
332
- );
333
-
334
- // src/components/RootLayout/RootLayout.tsx
335
- var import_jsx_runtime5 = require("react/jsx-runtime");
336
- function RootLayout({
337
- children,
338
- zone,
339
- className
340
- }) {
341
- const initialize = useGlobalStore((state) => state.initialize);
342
- (0, import_react2.useEffect)(() => {
343
- try {
344
- const maybe = initialize();
345
- if (maybe && typeof maybe.then === "function") {
346
- maybe.catch((error) => {
347
- console.error("Failed to initialize global state:", error);
348
- });
349
- }
350
- } catch (error) {
351
- console.error("Failed to initialize global state:", error);
352
- }
353
- }, [initialize]);
354
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: (0, import_clsx4.default)(RootLayout_default.root, className), "data-zone": zone, children: [
355
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(GlobalHeader, { zone }),
356
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("main", { className: RootLayout_default.main, children }),
357
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(GlobalFooter, {})
358
- ] });
359
- }
26
+ var import_RootLayout = require("./components/RootLayout");
27
+ var import_globalState = require("./store/globalState");
360
28
  // Annotate the CommonJS export names for ESM import in node:
361
29
  0 && (module.exports = {
362
30
  RootLayout,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/components/RootLayout/RootLayout.tsx","../src/components/GlobalHeader/GlobalHeader.tsx","../src/components/Breadcrumbs/Breadcrumbs.tsx","../src/components/Breadcrumbs/Breadcrumbs.module.css","../src/routes.ts","../src/components/MenuButton/MenuButton.tsx","../src/components/MenuButton/MenuButton.module.css","../src/components/GlobalHeader/GlobalHeader.module.css","../src/components/GlobalFooter/GlobalFooter.tsx","../src/components/GlobalFooter/GlobalFooter.module.css","../src/components/RootLayout/RootLayout.module.css","../src/store/globalState.ts"],"sourcesContent":["'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","'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}",".breadcrumbs {\n --dsc-breadcrumbs-color: var(--ds-color-text-default);\n padding: 2.5rem 0 0 0;\n}\n\n.link {\n text-decoration: underline;\n text-underline-offset: 2px;\n color: var(--ds-color-text-default);\n}\n\n.link:hover \n.link:visited{\n color: var(--ds-color-text-default);\n}\n\n.currentLink {\n text-decoration: none;\n font-weight: 500;\n pointer-events: none;\n color: var(--ds-color-text-default);\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}",".userInfo {\n display: flex;\n flex-direction: column;\n gap: var(--ds-spacing-1);\n padding: var(--ds-spacing-2) var(--ds-spacing-3);\n}\n\n.userName {\n font-size: var(--ds-font-size-sm);\n font-weight: var(--ds-font-weight-medium);\n color: var(--ds-color-neutral-text-default);\n}\n\n.userEmail {\n font-size: var(--ds-font-size-xs);\n color: var(--ds-color-neutral-text-subtle);\n}\n\n.menuButton {\n background-color: var(--ds-color-neutral-base-default);\n}\n\n.devContainer {\n display: flex;\n gap: var(--ds-spacing-4);\n padding: var(--ds-spacing-2);\n}\n\n.zoneSection {\n flex: 1;\n min-width: 12rem;\n}\n\n.zoneTitle {\n font-weight: 600;\n padding: var(--ds-spacing-2);\n color: var(--ds-color-neutral-text-default);\n border-bottom: 1px solid var(--ds-color-neutral-border-subtle);\n margin-bottom: var(--ds-spacing-2);\n text-transform: capitalize;\n}\n",".header {\n background-color: var(--ds-color-accent-surface-tinted);\n border-bottom: 1px solid var(--ds-color-neutral-border-subtle);\n position: sticky;\n top: 0;\n z-index: 100;\n}\n\n.headerContainer {\n max-width: 90rem;\n margin: 0 auto;\n padding: 0 var(--ds-size-30);\n}\n\n.topBarContainer {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 1.25rem 0;\n}\n\n.logo {\n margin: 0;\n color: var(--ds-color-neutral-text-default);\n white-space: nowrap;\n display: flex;\n align-items: center;\n min-height: inherit;\n}\n\n.actionsContainer {\n display: flex;\n align-items: stretch;\n gap: var(--ds-size-9);\n min-height: inherit;\n}\n\n.searchInput {\n min-width: 12.5rem;\n display: flex;\n align-items: center;\n}\n\n@media (max-width: 768px) {\n .container {\n padding: 0 var(--ds-spacing-4);\n }\n\n .topBar {\n flex-wrap: wrap;\n padding: var(--ds-spacing-4) 0;\n }\n\n .actions {\n order: 3;\n width: 100%;\n flex-direction: column;\n gap: var(--ds-spacing-3);\n }\n\n .searchInput {\n width: 100%;\n min-width: auto;\n }\n\n .menuButton {\n width: 100%;\n justify-content: center;\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}",".footer {\n background-color: var(--ds-color-neutral-surface-subtle);\n border-top: 1px solid var(--ds-color-neutral-border-subtle);\n margin-top: auto;\n}\n\n.container {\n max-width: 1440px;\n margin: 0 auto;\n padding: var(--ds-spacing-6) var(--ds-spacing-4);\n}\n\n.content {\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: var(--ds-spacing-4);\n flex-wrap: wrap;\n}\n\n@media (max-width: 768px) {\n .content {\n flex-direction: column;\n align-items: flex-start;\n }\n\n\n}",".root {\n display: flex;\n flex-direction: column;\n min-height: 100vh;\n}\n\n.main {\n flex: 1;\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,IAAAA,gBAA0B;AAC1B,IAAAC,eAAiB;;;ACDjB,mBAAyB;AACzB,IAAAC,+BAAgC;AAChC,IAAAC,eAAiB;;;ACFjB,wBAA4B;AAC5B,kCAA4B;AAC5B,kBAAiB;;;ACJjB;;;ACgBA,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,EAAE,SAAS,uBAAuB,OAAO,sBAAsB;AAAA,MAC/D,EAAE,SAAS,sBAAsB,OAAO,qBAAqB;AAAA,MAC7D,EAAE,SAAS,cAAc,OAAO,aAAa;AAAA,IAC/C;AAAA,EACF;AACF;AAKA,IAAM,eAAkD,CAAC;AACzD,IAAM,eAAe,oBAAI,IAAqB;AAC9C,IAAM,aAAwC,CAAC;AAE/C,SAAS,cAAc,GAAsE;AAC3F,SAAQ,EAAU,YAAY,UAAc,EAAU,SAAS;AACjE;AACA,SAAS,WAAW,GAAmE;AACrF,SAAQ,EAAU,SAAS;AAC7B;AAEA,SAAS,SAAS,MAAc,KAAqB;AACnD,MAAI,CAAC,KAAM,QAAO,MAAM,IAAI,GAAG,KAAK;AACpC,SAAO,MAAM,GAAG,KAAK,QAAQ,QAAQ,EAAE,CAA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qB,IAAI,EAAE,KAAK;AAAA,IACxE;AAAA,EACF;AACF;AAEO,IAAM,qBAAiB,uBAAoB;AAAA,MAChD,2BAAQ,SAAS;AAAA,IACf,MAAM;AAAA,IACN,aAAS,qCAAkB,MAAM,YAAY;AAAA,EAC/C,CAAC;AACH;;;AXPI,IAAAC,sBAAA;AAtBG,SAAS,WAAW;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AACF,GAAoB;AAClB,QAAM,aAAa,eAAe,CAAC,UAAU,MAAM,UAAU;AAE7D,+BAAU,MAAM;AACd,QAAI;AACF,YAAM,QAAQ,WAAW;AACzB,UAAI,SAAS,OAAQ,MAAwB,SAAS,YAAY;AAChE,QAAC,MAAwB,MAAM,CAAC,UAAU;AACxC,kBAAQ,MAAM,sCAAsC,KAAK;AAAA,QAC3D,CAAC;AAAA,MACH;AAAA,IACF,SAAS,OAAO;AACd,cAAQ,MAAM,sCAAsC,KAAK;AAAA,IAC3D;AAAA,EACF,GAAG,CAAC,UAAU,CAAC;AAGf,SACE,8CAAC,SAAI,eAAW,aAAAC,SAAK,mBAAO,MAAM,SAAS,GAAG,aAAW,MACvD;AAAA,iDAAC,gBAAa,MAAW;AAAA,IACzB,6CAAC,UAAK,WAAW,mBAAO,MAAO,UAAS;AAAA,IACxC,6CAAC,gBAAa;AAAA,KAChB;AAEJ;","names":["import_react","import_clsx","import_designsystemet_react","import_clsx","_a","clsx","import_designsystemet_react","import_jsx_runtime","Link","import_jsx_runtime","clsx","import_designsystemet_react","import_clsx","import_jsx_runtime","clsx","import_jsx_runtime","clsx"]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["'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"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,wBAA2B;AAG3B,yBAA+B;","names":[]}
package/dist/index.mjs CHANGED
@@ -1,326 +1,6 @@
1
1
  "use client";
2
-
3
- // src/components/RootLayout/RootLayout.tsx
4
- import { useEffect } from "react";
5
- import clsx4 from "clsx";
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";
11
-
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
-
17
- // src/components/Breadcrumbs/Breadcrumbs.module.css
18
- var Breadcrumbs_default = {};
19
-
20
- // src/routes.ts
21
- var ZONE_TREES_INPUT = {
22
- sbno: {
23
- segment: "",
24
- // primary root route, no breadcrumb
25
- label: "Hjem",
26
- children: [
27
- { segment: "nyheter", label: "Nyheter" }
28
- ]
29
- },
30
- lokaler: {
31
- segment: "lokaler",
32
- label: "Statens eide og leide lokaler",
33
- children: [
34
- {
35
- segment: "lokalbruk",
36
- label: "Lokalbruk"
37
- },
38
- { segment: "veiledning", label: "Veiledning" },
39
- { segment: "statlige-eiendommer", label: "Statlige eiendommer" },
40
- { segment: "ledig-for-fremleie", label: "Ledig for fremleie" },
41
- { segment: "statistikk", label: "Statistikk" }
42
- ]
43
- }
44
- };
45
- var ROUTES_INDEX = {};
46
- var PARENT_INDEX = /* @__PURE__ */ new Map();
47
- var ZONE_TREES = {};
48
- function isSegmentNode(n) {
49
- return n.segment !== void 0 && n.path === void 0;
50
- }
51
- function isPathNode(n) {
52
- return n.path !== void 0;
53
- }
54
- function joinPath(base, seg) {
55
- if (!base) return seg ? `/${seg}` : "/";
56
- return seg ? `${base.replace(/\/+$/, "")}/${seg.replace(/^\/+/, "")}` : base || "/";
57
- }
58
- function normalizeToAbsolute(node, base = "") {
59
- var _a;
60
- const path = isSegmentNode(node) ? joinPath(base, node.segment) : isPathNode(node) ? node.path === "" ? "/" : node.path : "/";
61
- const children = ((_a = node.children) != null ? _a : []).map((c) => normalizeToAbsolute(c, path));
62
- return { path, label: node.label, children: children.length ? children : void 0 };
63
- }
64
- (function buildAll() {
65
- Object.keys(ZONE_TREES_INPUT).forEach((zone) => {
66
- ZONE_TREES[zone] = normalizeToAbsolute(ZONE_TREES_INPUT[zone]);
67
- });
68
- function walk(zone, node, parentKey) {
69
- var _a;
70
- const def = { zone, path: node.path, label: node.label };
71
- const key = `${zone}:${node.path}`;
72
- ROUTES_INDEX[zone].push(def);
73
- PARENT_INDEX.set(key, parentKey);
74
- for (const child of (_a = node.children) != null ? _a : []) {
75
- walk(zone, child, key);
76
- }
77
- }
78
- Object.keys(ZONE_TREES).forEach((zone) => {
79
- ROUTES_INDEX[zone] = [];
80
- walk(zone, ZONE_TREES[zone], null);
81
- });
82
- })();
83
- function findBestMatch(zone, pathname) {
84
- var _a;
85
- const list = (_a = ROUTES_INDEX[zone]) != null ? _a : [];
86
- let best;
87
- for (const r of list) {
88
- if (pathname === r.path) {
89
- best = r;
90
- break;
91
- }
92
- if (pathname.startsWith(r.path.endsWith("/") ? r.path : r.path + "/")) {
93
- if (!best || r.path.length > best.path.length) best = r;
94
- }
95
- }
96
- return best != null ? best : list.find((r) => {
97
- var _a2;
98
- return r.path === ((_a2 = ZONE_TREES[zone]) == null ? void 0 : _a2.path);
99
- });
100
- }
101
- function getZoneMenuRoutes(zone) {
102
- var _a;
103
- const root = ZONE_TREES[zone];
104
- const children = (_a = root == null ? void 0 : root.children) != null ? _a : [];
105
- return children.map((c) => ({ zone, path: c.path, label: c.label }));
106
- }
107
- function getAllZones() {
108
- return Object.keys(ZONE_TREES);
109
- }
110
- function getZoneRoot(zone) {
111
- var _a;
112
- return ((_a = ZONE_TREES[zone]) == null ? void 0 : _a.path) || "/";
113
- }
114
- function labelFromSlug(slug) {
115
- try {
116
- const s = decodeURIComponent(slug).replace(/[-_]+/g, " ").trim();
117
- return s ? s.charAt(0).toUpperCase() + s.slice(1) : slug;
118
- } catch (e) {
119
- return slug;
120
- }
121
- }
122
- function getBreadcrumbs(zone, pathname) {
123
- var _a, _b;
124
- const normalizedPathname = pathname === "/" ? pathname : pathname.replace(/\/+$/, "");
125
- if (zone === "sbno" && normalizedPathname === "/") return [];
126
- const match = findBestMatch(zone, normalizedPathname);
127
- if (!match) return [];
128
- const chain = [];
129
- let key = `${zone}:${match.path}`;
130
- while (key) {
131
- const parentKey = PARENT_INDEX.get(key);
132
- const [z, p] = key.split(":");
133
- const def = ((_a = ROUTES_INDEX[z]) != null ? _a : []).find((r) => r.path === p);
134
- if (def) chain.unshift(def);
135
- key = parentKey != null ? parentKey : void 0;
136
- }
137
- const homeRoute = ((_b = ROUTES_INDEX.sbno) != null ? _b : []).find((r) => r.path === "/");
138
- if (homeRoute && !(chain.length === 1 && chain[0].zone === "sbno" && chain[0].path === "/") && (chain.length === 0 || chain[0].path !== homeRoute.path)) {
139
- chain.unshift(homeRoute);
140
- }
141
- const last = chain[chain.length - 1];
142
- if (last && normalizedPathname !== last.path && normalizedPathname.startsWith(last.path.endsWith("/") ? last.path : last.path + "/")) {
143
- const segments = normalizedPathname.split("/").filter(Boolean);
144
- const tail = segments[segments.length - 1];
145
- chain.push({ zone, path: normalizedPathname, label: labelFromSlug(tail) });
146
- }
147
- return chain.map((r) => ({ label: r.label, href: r.path }));
148
- }
149
- function transformHrefForZone(targetPath, currentZone, options) {
150
- const { isDev, prodUrl } = options;
151
- const targetZone = getZoneFromPathname(targetPath);
152
- const isCrossZone = targetZone !== currentZone;
153
- if (isCrossZone && isDev && prodUrl) {
154
- return `${prodUrl}${targetPath}`;
155
- }
156
- const currentZoneRoot = getZoneRoot(currentZone);
157
- if (!isCrossZone && isDev && currentZoneRoot !== "/") {
158
- return targetPath.replace(currentZoneRoot, "") || "/";
159
- }
160
- return targetPath;
161
- }
162
- function getZoneFromPathname(pathname) {
163
- if (pathname.startsWith("/lokaler")) return "lokaler";
164
- return "sbno";
165
- }
166
-
167
- // src/components/Breadcrumbs/Breadcrumbs.tsx
168
- import { jsx } from "react/jsx-runtime";
169
- function SbBreadcrumbs({ className, zone }) {
170
- const pathname = usePathname();
171
- const isDev = process.env.NODE_ENV === "development";
172
- const prodUrl = "https://www.statsbygg.no";
173
- const zoneRoot = getZoneRoot(zone);
174
- const fullPath = isDev && zoneRoot !== "/" && !pathname.startsWith(zoneRoot) ? `${zoneRoot}${pathname}` : pathname;
175
- const breadcrumbs = getBreadcrumbs(zone, fullPath);
176
- if (breadcrumbs.length <= 1) {
177
- return null;
178
- }
179
- return /* @__PURE__ */ jsx(Breadcrumbs, { "aria-label": "Du er her:", className: clsx(Breadcrumbs_default.breadcrumbs, className), children: /* @__PURE__ */ jsx(Breadcrumbs.List, { children: breadcrumbs.map((crumb, index) => {
180
- const isLast = index === breadcrumbs.length - 1;
181
- const href = transformHrefForZone(crumb.href, zone, { isDev, prodUrl });
182
- return /* @__PURE__ */ jsx(Breadcrumbs.Item, { children: /* @__PURE__ */ jsx(
183
- Breadcrumbs.Link,
184
- {
185
- href,
186
- "aria-current": isLast ? "page" : void 0,
187
- className: isLast ? Breadcrumbs_default.currentLink : Breadcrumbs_default.link,
188
- children: crumb.label
189
- }
190
- ) }, crumb.href);
191
- }) }) });
192
- }
193
-
194
- // src/components/MenuButton/MenuButton.tsx
195
- import Link from "next/link";
196
- import { Dropdown } from "@digdir/designsystemet-react";
197
- import { Menu } from "lucide-react";
198
-
199
- // src/components/MenuButton/MenuButton.module.css
200
- var MenuButton_default = {};
201
-
202
- // src/components/MenuButton/MenuButton.tsx
203
- import { jsx as jsx2, jsxs } from "react/jsx-runtime";
204
- function MenuButton({ zone }) {
205
- const isDev = process.env.NODE_ENV === "development";
206
- const prodUrl = "https://www.statsbygg.no";
207
- const allZones = getAllZones();
208
- return /* @__PURE__ */ jsxs(Dropdown.TriggerContext, { children: [
209
- /* @__PURE__ */ jsxs(Dropdown.Trigger, { asChild: true, className: MenuButton_default.menuButton, children: [
210
- /* @__PURE__ */ jsx2(Menu, { size: 20, "aria-hidden": true }),
211
- "Meny"
212
- ] }),
213
- /* @__PURE__ */ jsx2(Dropdown, { children: isDev ? /* @__PURE__ */ jsx2("div", { className: MenuButton_default.devContainer, children: allZones.map((z) => {
214
- const routes = getZoneMenuRoutes(z);
215
- return /* @__PURE__ */ jsxs("div", { className: MenuButton_default.zoneSection, children: [
216
- /* @__PURE__ */ jsx2("div", { className: MenuButton_default.zoneTitle, children: z }),
217
- /* @__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}`)) })
218
- ] }, z);
219
- }) }) : /* @__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}`)) }) })
220
- ] });
221
- }
222
-
223
- // src/components/GlobalHeader/GlobalHeader.module.css
224
- var GlobalHeader_default = {};
225
-
226
- // src/logo.svg
227
- var logo_default = "./logo-JRXKWS5H.svg";
228
-
229
- // src/components/GlobalHeader/GlobalHeader.tsx
230
- import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
231
- function GlobalHeader({ className, zone }) {
232
- const [searchValue, setSearchValue] = useState("");
233
- return /* @__PURE__ */ jsx3("header", { className: clsx2(GlobalHeader_default.header, className), children: /* @__PURE__ */ jsxs2("div", { className: GlobalHeader_default.headerContainer, children: [
234
- /* @__PURE__ */ jsxs2("div", { className: GlobalHeader_default.topBarContainer, children: [
235
- /* @__PURE__ */ jsx3(Link2, { href: "https://www.statsbygg.no", children: /* @__PURE__ */ jsx3("img", { src: logo_default, alt: "Logo", className: GlobalHeader_default.logo }) }),
236
- /* @__PURE__ */ jsxs2("div", { className: GlobalHeader_default.actionsContainer, children: [
237
- /* @__PURE__ */ jsx3(
238
- Textfield,
239
- {
240
- value: searchValue,
241
- onChange: (e) => setSearchValue(e.target.value),
242
- placeholder: "S\xF8k...",
243
- className: GlobalHeader_default.searchInput,
244
- "aria-label": "S\xF8k"
245
- }
246
- ),
247
- /* @__PURE__ */ jsx3(MenuButton, { zone })
248
- ] })
249
- ] }),
250
- /* @__PURE__ */ jsx3(SbBreadcrumbs, { zone })
251
- ] }) });
252
- }
253
-
254
- // src/components/GlobalFooter/GlobalFooter.tsx
255
- import { Paragraph } from "@digdir/designsystemet-react";
256
- import clsx3 from "clsx";
257
-
258
- // src/components/GlobalFooter/GlobalFooter.module.css
259
- var GlobalFooter_default = {};
260
-
261
- // src/components/GlobalFooter/GlobalFooter.tsx
262
- import { jsx as jsx4 } from "react/jsx-runtime";
263
- function GlobalFooter({ className }) {
264
- return /* @__PURE__ */ jsx4("footer", { className: clsx3(GlobalFooter_default.footer, className), children: /* @__PURE__ */ jsx4("div", { className: GlobalFooter_default.container, children: /* @__PURE__ */ jsx4("div", { className: GlobalFooter_default.content, children: /* @__PURE__ */ jsx4(Paragraph, { children: "Statsbygg Footer" }) }) }) });
265
- }
266
-
267
- // src/components/RootLayout/RootLayout.module.css
268
- var RootLayout_default = {};
269
-
270
- // src/store/globalState.ts
271
- import { create } from "zustand";
272
- import { persist, createJSONStorage } from "zustand/middleware";
273
- var creator = (set, get) => ({
274
- user: null,
275
- theme: "light",
276
- locale: "no",
277
- setUser: (user) => set({ user }),
278
- setTheme: (theme) => {
279
- set({ theme });
280
- if (typeof document !== "undefined") {
281
- document.documentElement.setAttribute("data-color-scheme", theme);
282
- }
283
- },
284
- setLocale: (locale) => set({ locale }),
285
- initialize: () => {
286
- if (typeof document !== "undefined") {
287
- document.documentElement.setAttribute("data-color-scheme", get().theme);
288
- }
289
- }
290
- });
291
- var useGlobalStore = create()(
292
- persist(creator, {
293
- name: "statsbygg-global-state",
294
- storage: createJSONStorage(() => localStorage)
295
- })
296
- );
297
-
298
- // src/components/RootLayout/RootLayout.tsx
299
- import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
300
- function RootLayout({
301
- children,
302
- zone,
303
- className
304
- }) {
305
- const initialize = useGlobalStore((state) => state.initialize);
306
- useEffect(() => {
307
- try {
308
- const maybe = initialize();
309
- if (maybe && typeof maybe.then === "function") {
310
- maybe.catch((error) => {
311
- console.error("Failed to initialize global state:", error);
312
- });
313
- }
314
- } catch (error) {
315
- console.error("Failed to initialize global state:", error);
316
- }
317
- }, [initialize]);
318
- return /* @__PURE__ */ jsxs3("div", { className: clsx4(RootLayout_default.root, className), "data-zone": zone, children: [
319
- /* @__PURE__ */ jsx5(GlobalHeader, { zone }),
320
- /* @__PURE__ */ jsx5("main", { className: RootLayout_default.main, children }),
321
- /* @__PURE__ */ jsx5(GlobalFooter, {})
322
- ] });
323
- }
2
+ import { RootLayout } from "./components/RootLayout";
3
+ import { useGlobalStore } from "./store/globalState";
324
4
  export {
325
5
  RootLayout,
326
6
  useGlobalStore
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/RootLayout/RootLayout.tsx","../src/components/GlobalHeader/GlobalHeader.tsx","../src/components/Breadcrumbs/Breadcrumbs.tsx","../src/components/Breadcrumbs/Breadcrumbs.module.css","../src/routes.ts","../src/components/MenuButton/MenuButton.tsx","../src/components/MenuButton/MenuButton.module.css","../src/components/GlobalHeader/GlobalHeader.module.css","../src/components/GlobalFooter/GlobalFooter.tsx","../src/components/GlobalFooter/GlobalFooter.module.css","../src/components/RootLayout/RootLayout.module.css","../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}",".breadcrumbs {\n --dsc-breadcrumbs-color: var(--ds-color-text-default);\n padding: 2.5rem 0 0 0;\n}\n\n.link {\n text-decoration: underline;\n text-underline-offset: 2px;\n color: var(--ds-color-text-default);\n}\n\n.link:hover \n.link:visited{\n color: var(--ds-color-text-default);\n}\n\n.currentLink {\n text-decoration: none;\n font-weight: 500;\n pointer-events: none;\n color: var(--ds-color-text-default);\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}",".userInfo {\n display: flex;\n flex-direction: column;\n gap: var(--ds-spacing-1);\n padding: var(--ds-spacing-2) var(--ds-spacing-3);\n}\n\n.userName {\n font-size: var(--ds-font-size-sm);\n font-weight: var(--ds-font-weight-medium);\n color: var(--ds-color-neutral-text-default);\n}\n\n.userEmail {\n font-size: var(--ds-font-size-xs);\n color: var(--ds-color-neutral-text-subtle);\n}\n\n.menuButton {\n background-color: var(--ds-color-neutral-base-default);\n}\n\n.devContainer {\n display: flex;\n gap: var(--ds-spacing-4);\n padding: var(--ds-spacing-2);\n}\n\n.zoneSection {\n flex: 1;\n min-width: 12rem;\n}\n\n.zoneTitle {\n font-weight: 600;\n padding: var(--ds-spacing-2);\n color: var(--ds-color-neutral-text-default);\n border-bottom: 1px solid var(--ds-color-neutral-border-subtle);\n margin-bottom: var(--ds-spacing-2);\n text-transform: capitalize;\n}\n",".header {\n background-color: var(--ds-color-accent-surface-tinted);\n border-bottom: 1px solid var(--ds-color-neutral-border-subtle);\n position: sticky;\n top: 0;\n z-index: 100;\n}\n\n.headerContainer {\n max-width: 90rem;\n margin: 0 auto;\n padding: 0 var(--ds-size-30);\n}\n\n.topBarContainer {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 1.25rem 0;\n}\n\n.logo {\n margin: 0;\n color: var(--ds-color-neutral-text-default);\n white-space: nowrap;\n display: flex;\n align-items: center;\n min-height: inherit;\n}\n\n.actionsContainer {\n display: flex;\n align-items: stretch;\n gap: var(--ds-size-9);\n min-height: inherit;\n}\n\n.searchInput {\n min-width: 12.5rem;\n display: flex;\n align-items: center;\n}\n\n@media (max-width: 768px) {\n .container {\n padding: 0 var(--ds-spacing-4);\n }\n\n .topBar {\n flex-wrap: wrap;\n padding: var(--ds-spacing-4) 0;\n }\n\n .actions {\n order: 3;\n width: 100%;\n flex-direction: column;\n gap: var(--ds-spacing-3);\n }\n\n .searchInput {\n width: 100%;\n min-width: auto;\n }\n\n .menuButton {\n width: 100%;\n justify-content: center;\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}",".footer {\n background-color: var(--ds-color-neutral-surface-subtle);\n border-top: 1px solid var(--ds-color-neutral-border-subtle);\n margin-top: auto;\n}\n\n.container {\n max-width: 1440px;\n margin: 0 auto;\n padding: var(--ds-spacing-6) var(--ds-spacing-4);\n}\n\n.content {\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: var(--ds-spacing-4);\n flex-wrap: wrap;\n}\n\n@media (max-width: 768px) {\n .content {\n flex-direction: column;\n align-items: flex-start;\n }\n\n\n}",".root {\n display: flex;\n flex-direction: column;\n min-height: 100vh;\n}\n\n.main {\n flex: 1;\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;;;ACJjB;;;ACgBA,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,EAAE,SAAS,uBAAuB,OAAO,sBAAsB;AAAA,MAC/D,EAAE,SAAS,sBAAsB,OAAO,qBAAqB;AAAA,MAC7D,EAAE,SAAS,cAAc,OAAO,aAAa;AAAA,IAC/C;AAAA,EACF;AACF;AAKA,IAAM,eAAkD,CAAC;AACzD,IAAM,eAAe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KAAC,UAAK,WAAW,mBAAO,MAAO,UAAS;AAAA,IACxC,gBAAAA,KAAC,gBAAa;AAAA,KAChB;AAEJ;","names":["clsx","Link","clsx","_a","jsx","jsx","jsxs","clsx","Link","clsx","jsx","clsx","jsx","jsxs","clsx"]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["'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"],"mappings":";AAEA,SAAS,kBAAkB;AAG3B,SAAS,sBAAsB;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@statsbygg/layout",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "publishConfig": { "access": "public" },
5
5
  "description": "Shared layout components for Statsbygg microfrontend architecture",
6
6
  "main": "./dist/index.js",
@@ -15,8 +15,8 @@
15
15
  }
16
16
  },
17
17
  "scripts": {
18
- "build": "tsup",
19
- "dev": "tsup --watch",
18
+ "build": "tsup && rsync -a --prune-empty-dirs --include='*/' --include='*.module.css' --exclude='*' src/ dist/",
19
+ "dev": "tsup --watch",
20
20
  "lint": "eslint src --ext .ts,.tsx",
21
21
  "type-check": "tsc --noEmit"
22
22
  },
package/dist/index.css DELETED
@@ -1,154 +0,0 @@
1
- /* src/components/Breadcrumbs/Breadcrumbs.module.css */
2
- .breadcrumbs {
3
- --dsc-breadcrumbs-color: var(--ds-color-text-default);
4
- padding: 2.5rem 0 0 0;
5
- }
6
- .link {
7
- text-decoration: underline;
8
- text-underline-offset: 2px;
9
- color: var(--ds-color-text-default);
10
- }
11
- .link:hover .link:visited {
12
- color: var(--ds-color-text-default);
13
- }
14
- .currentLink {
15
- text-decoration: none;
16
- font-weight: 500;
17
- pointer-events: none;
18
- color: var(--ds-color-text-default);
19
- }
20
-
21
- /* src/components/MenuButton/MenuButton.module.css */
22
- .userInfo {
23
- display: flex;
24
- flex-direction: column;
25
- gap: var(--ds-spacing-1);
26
- padding: var(--ds-spacing-2) var(--ds-spacing-3);
27
- }
28
- .userName {
29
- font-size: var(--ds-font-size-sm);
30
- font-weight: var(--ds-font-weight-medium);
31
- color: var(--ds-color-neutral-text-default);
32
- }
33
- .userEmail {
34
- font-size: var(--ds-font-size-xs);
35
- color: var(--ds-color-neutral-text-subtle);
36
- }
37
- .menuButton {
38
- background-color: var(--ds-color-neutral-base-default);
39
- }
40
- .devContainer {
41
- display: flex;
42
- gap: var(--ds-spacing-4);
43
- padding: var(--ds-spacing-2);
44
- }
45
- .zoneSection {
46
- flex: 1;
47
- min-width: 12rem;
48
- }
49
- .zoneTitle {
50
- font-weight: 600;
51
- padding: var(--ds-spacing-2);
52
- color: var(--ds-color-neutral-text-default);
53
- border-bottom: 1px solid var(--ds-color-neutral-border-subtle);
54
- margin-bottom: var(--ds-spacing-2);
55
- text-transform: capitalize;
56
- }
57
-
58
- /* src/components/GlobalHeader/GlobalHeader.module.css */
59
- .header {
60
- background-color: var(--ds-color-accent-surface-tinted);
61
- border-bottom: 1px solid var(--ds-color-neutral-border-subtle);
62
- position: sticky;
63
- top: 0;
64
- z-index: 100;
65
- }
66
- .headerContainer {
67
- max-width: 90rem;
68
- margin: 0 auto;
69
- padding: 0 var(--ds-size-30);
70
- }
71
- .topBarContainer {
72
- display: flex;
73
- justify-content: space-between;
74
- align-items: center;
75
- padding: 1.25rem 0;
76
- }
77
- .logo {
78
- margin: 0;
79
- color: var(--ds-color-neutral-text-default);
80
- white-space: nowrap;
81
- display: flex;
82
- align-items: center;
83
- min-height: inherit;
84
- }
85
- .actionsContainer {
86
- display: flex;
87
- align-items: stretch;
88
- gap: var(--ds-size-9);
89
- min-height: inherit;
90
- }
91
- .searchInput {
92
- min-width: 12.5rem;
93
- display: flex;
94
- align-items: center;
95
- }
96
- @media (max-width: 768px) {
97
- .container {
98
- padding: 0 var(--ds-spacing-4);
99
- }
100
- .topBar {
101
- flex-wrap: wrap;
102
- padding: var(--ds-spacing-4) 0;
103
- }
104
- .actions {
105
- order: 3;
106
- width: 100%;
107
- flex-direction: column;
108
- gap: var(--ds-spacing-3);
109
- }
110
- .searchInput {
111
- width: 100%;
112
- min-width: auto;
113
- }
114
- .menuButton {
115
- width: 100%;
116
- justify-content: center;
117
- }
118
- }
119
-
120
- /* src/components/GlobalFooter/GlobalFooter.module.css */
121
- .footer {
122
- background-color: var(--ds-color-neutral-surface-subtle);
123
- border-top: 1px solid var(--ds-color-neutral-border-subtle);
124
- margin-top: auto;
125
- }
126
- .container {
127
- max-width: 1440px;
128
- margin: 0 auto;
129
- padding: var(--ds-spacing-6) var(--ds-spacing-4);
130
- }
131
- .content {
132
- display: flex;
133
- justify-content: space-between;
134
- align-items: center;
135
- gap: var(--ds-spacing-4);
136
- flex-wrap: wrap;
137
- }
138
- @media (max-width: 768px) {
139
- .content {
140
- flex-direction: column;
141
- align-items: flex-start;
142
- }
143
- }
144
-
145
- /* src/components/RootLayout/RootLayout.module.css */
146
- .root {
147
- display: flex;
148
- flex-direction: column;
149
- min-height: 100vh;
150
- }
151
- .main {
152
- flex: 1;
153
- }
154
- /*# sourceMappingURL=index.css.map */
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/Breadcrumbs/Breadcrumbs.module.css","../src/components/MenuButton/MenuButton.module.css","../src/components/GlobalHeader/GlobalHeader.module.css","../src/components/GlobalFooter/GlobalFooter.module.css","../src/components/RootLayout/RootLayout.module.css"],"sourcesContent":[".breadcrumbs {\n --dsc-breadcrumbs-color: var(--ds-color-text-default);\n padding: 2.5rem 0 0 0;\n}\n\n.link {\n text-decoration: underline;\n text-underline-offset: 2px;\n color: var(--ds-color-text-default);\n}\n\n.link:hover \n.link:visited{\n color: var(--ds-color-text-default);\n}\n\n.currentLink {\n text-decoration: none;\n font-weight: 500;\n pointer-events: none;\n color: var(--ds-color-text-default);\n}\n",".userInfo {\n display: flex;\n flex-direction: column;\n gap: var(--ds-spacing-1);\n padding: var(--ds-spacing-2) var(--ds-spacing-3);\n}\n\n.userName {\n font-size: var(--ds-font-size-sm);\n font-weight: var(--ds-font-weight-medium);\n color: var(--ds-color-neutral-text-default);\n}\n\n.userEmail {\n font-size: var(--ds-font-size-xs);\n color: var(--ds-color-neutral-text-subtle);\n}\n\n.menuButton {\n background-color: var(--ds-color-neutral-base-default);\n}\n\n.devContainer {\n display: flex;\n gap: var(--ds-spacing-4);\n padding: var(--ds-spacing-2);\n}\n\n.zoneSection {\n flex: 1;\n min-width: 12rem;\n}\n\n.zoneTitle {\n font-weight: 600;\n padding: var(--ds-spacing-2);\n color: var(--ds-color-neutral-text-default);\n border-bottom: 1px solid var(--ds-color-neutral-border-subtle);\n margin-bottom: var(--ds-spacing-2);\n text-transform: capitalize;\n}\n",".header {\n background-color: var(--ds-color-accent-surface-tinted);\n border-bottom: 1px solid var(--ds-color-neutral-border-subtle);\n position: sticky;\n top: 0;\n z-index: 100;\n}\n\n.headerContainer {\n max-width: 90rem;\n margin: 0 auto;\n padding: 0 var(--ds-size-30);\n}\n\n.topBarContainer {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 1.25rem 0;\n}\n\n.logo {\n margin: 0;\n color: var(--ds-color-neutral-text-default);\n white-space: nowrap;\n display: flex;\n align-items: center;\n min-height: inherit;\n}\n\n.actionsContainer {\n display: flex;\n align-items: stretch;\n gap: var(--ds-size-9);\n min-height: inherit;\n}\n\n.searchInput {\n min-width: 12.5rem;\n display: flex;\n align-items: center;\n}\n\n@media (max-width: 768px) {\n .container {\n padding: 0 var(--ds-spacing-4);\n }\n\n .topBar {\n flex-wrap: wrap;\n padding: var(--ds-spacing-4) 0;\n }\n\n .actions {\n order: 3;\n width: 100%;\n flex-direction: column;\n gap: var(--ds-spacing-3);\n }\n\n .searchInput {\n width: 100%;\n min-width: auto;\n }\n\n .menuButton {\n width: 100%;\n justify-content: center;\n }\n}",".footer {\n background-color: var(--ds-color-neutral-surface-subtle);\n border-top: 1px solid var(--ds-color-neutral-border-subtle);\n margin-top: auto;\n}\n\n.container {\n max-width: 1440px;\n margin: 0 auto;\n padding: var(--ds-spacing-6) var(--ds-spacing-4);\n}\n\n.content {\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: var(--ds-spacing-4);\n flex-wrap: wrap;\n}\n\n@media (max-width: 768px) {\n .content {\n flex-direction: column;\n align-items: flex-start;\n }\n\n\n}",".root {\n display: flex;\n flex-direction: column;\n min-height: 100vh;\n}\n\n.main {\n flex: 1;\n}"],"mappings":";AAAA,CAAC;AACC,2BAAyB,IAAI;AAC7B,WAAS,OAAO,EAAE,EAAE;AACtB;AAEA,CAAC;AACC,mBAAiB;AACjB,yBAAuB;AACvB,SAAO,IAAI;AACb;AAEA,CANC,IAMI,OACL,CAPC,IAOI;AACH,SAAO,IAAI;AACb;AAEA,CAAC;AACC,mBAAiB;AACjB,eAAa;AACb,kBAAgB;AAChB,SAAO,IAAI;AACb;;;ACrBA,CAAC;AACC,WAAS;AACT,kBAAgB;AAChB,OAAK,IAAI;AACT,WAAS,IAAI,gBAAgB,IAAI;AACnC;AAEA,CAAC;AACC,aAAW,IAAI;AACf,eAAa,IAAI;AACjB,SAAO,IAAI;AACb;AAEA,CAAC;AACC,aAAW,IAAI;AACf,SAAO,IAAI;AACb;AAEA,CAAC;AACC,oBAAkB,IAAI;AACxB;AAEA,CAAC;AACC,WAAS;AACT,OAAK,IAAI;AACT,WAAS,IAAI;AACf;AAEA,CAAC;AACC,QAAM;AACN,aAAW;AACb;AAEA,CAAC;AACC,eAAa;AACb,WAAS,IAAI;AACb,SAAO,IAAI;AACX,iBAAe,IAAI,MAAM,IAAI;AAC7B,iBAAe,IAAI;AACnB,kBAAgB;AAClB;;;ACxCA,CAAC;AACC,oBAAkB,IAAI;AACtB,iBAAe,IAAI,MAAM,IAAI;AAC7B,YAAU;AACV,OAAK;AACL,WAAS;AACX;AAEA,CAAC;AACC,aAAW;AACX,UAAQ,EAAE;AACV,WAAS,EAAE,IAAI;AACjB;AAEA,CAAC;AACC,WAAS;AACT,mBAAiB;AACjB,eAAa;AACb,WAAS,QAAQ;AACnB;AAEA,CAAC;AACC,UAAQ;AACR,SAAO,IAAI;AACX,eAAa;AACb,WAAS;AACT,eAAa;AACb,cAAY;AACd;AAEA,CAAC;AACC,WAAS;AACT,eAAa;AACb,OAAK,IAAI;AACT,cAAY;AACd;AAEA,CAAC;AACC,aAAW;AACX,WAAS;AACT,eAAa;AACf;AAEA,OAAO,CAAC,SAAS,EAAE;AACjB,GAAC;AACC,aAAS,EAAE,IAAI;AACjB;AAEA,GAAC;AACC,eAAW;AACX,aAAS,IAAI,gBAAgB;AAC/B;AAEA,GAAC;AACC,WAAO;AACP,WAAO;AACP,oBAAgB;AAChB,SAAK,IAAI;AACX;AAEA,GAvBD;AAwBG,WAAO;AACP,eAAW;AACb;AAEA,GAAC;AACC,WAAO;AACP,qBAAiB;AACnB;AACF;;;ACrEA,CAAC;AACC,oBAAkB,IAAI;AACtB,cAAY,IAAI,MAAM,IAAI;AAC1B,cAAY;AACd;AAEA,CAAC;AACC,aAAW;AACX,UAAQ,EAAE;AACV,WAAS,IAAI,gBAAgB,IAAI;AACnC;AAEA,CAAC;AACC,WAAS;AACT,mBAAiB;AACjB,eAAa;AACb,OAAK,IAAI;AACT,aAAW;AACb;AAEA,OAAO,CAAC,SAAS,EAAE;AACjB,GATD;AAUG,oBAAgB;AAChB,iBAAa;AACf;AAGF;;;AC3BA,CAAC;AACC,WAAS;AACT,kBAAgB;AAChB,cAAY;AACd;AAEA,CAAC;AACC,QAAM;AACR;","names":[]}
@@ -1,29 +0,0 @@
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="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d="M72.1,11.2h3v.3c-.7,0-.7.1-.7.6v2.1c-.3,0-.5.1-.7.2-1.1.3-1.6.4-2.3.4-2.5,0-3.9-1.7-3.9-3.9s.6-2.3,1.3-2.8c.8-.7,1.8-.8,2.5-.8s.9,0,1.7.2q.8.1,1.3.2v2h-.5c0-.4,0-.8-.5-1.2-.5-.4-1.2-.6-1.8-.6-1.8,0-2.7,1.3-2.7,2.9s.3,1.9.7,2.4c.7,1,1.7,1.1,2.3,1.1s.6,0,1-.1c.5-.2.5-.3.5-.8v-1.1c0-.6,0-.7-.8-.7h-.3v-.4h0Z"/>
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-.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