@mattilsynet/design 2.0.2 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,15 +1,22 @@
1
- type Matomo = (string | number | boolean)[];
1
+ type Matomo = (string | number | boolean | ((this: Record<string, <T>() => T>) => void))[];
2
2
  declare global {
3
3
  interface Window {
4
4
  _paq?: Matomo[];
5
5
  _mtm?: Record<string, string | number>[];
6
+ _mtdsTracking?: AnalyticsActions["init"];
7
+ _mtdsUntrack?: () => void;
6
8
  }
7
9
  }
8
10
  export type AnalyticsActions = {
9
11
  init: {
10
- matomoId: number | string;
11
12
  enabled?: boolean | "debug";
12
- };
13
+ } & ({
14
+ matomoId: number | string;
15
+ matomoTagManagerId?: never;
16
+ } | {
17
+ matomoId?: never;
18
+ matomoTagManagerId: string;
19
+ });
13
20
  pageview: {
14
21
  url?: string;
15
22
  title?: string;
@@ -1,36 +1,99 @@
1
- import { IS_BROWSER as r } from "../utils.js";
2
- const s = "mattilsynet.matomo.cloud";
3
- let a = !0;
4
- function d(o, n = {}) {
5
- if (r) {
6
- if (window._paq || (window._paq = [], window._paq.push(["HeatmapSessionRecording::disable"]), window._paq.push(["enableLinkTracking"]), window._paq.push(["setTrackerUrl", `https://${s}/matomo.php`])), o === "init") {
7
- const { matomoId: e, enabled: t } = n;
8
- a = t ?? window.location.hostname === "localhost", window._paq.push(["setSiteId", e]), document.querySelector('script[src*="matomo.js"]') || document.head.append(
9
- Object.assign(document.createElement("script"), {
10
- async: !0,
11
- src: `https://cdn.matomo.cloud/${s}/matomo.js`
12
- })
13
- );
1
+ import d from "../styles.module.css.js";
2
+ import { onLoaded as w, IS_BROWSER as h, on as f, QUICK_EVENT as g, attr as i } from "../utils.js";
3
+ const _ = `.${d.breadcrumbs.split(" ")[0]}`, b = `.${d.chip.split(" ")[0]}`, y = `.${d.helptext.split(" ")[0]}`, S = `.${d.pagination.split(" ")[0]}`, T = 'summary,u-summary,a,button,[role="tab"],[role="button"]', k = "click,toggle,submit,change", m = "mattilsynet.matomo.cloud";
4
+ function q(e, a = {}) {
5
+ if (h) {
6
+ if (window._paq || (window._paq = [], window._paq.push(["HeatmapSessionRecording::disable"]), window._paq.push(["enableLinkTracking"]), window._paq.push(["setTrackerUrl", `https://${m}/matomo.php`])), window._mtm || (window._mtm = window._mtm || [], window._mtm.push({ "mtm.startTime": Date.now(), event: "mtm.Start" })), e === "init") {
7
+ window._mtdsTracking = {
8
+ enabled: window.location.hostname !== "localhost",
9
+ ...window._mtdsTracking,
10
+ ...a
11
+ };
12
+ const { enabled: t, matomoId: o, matomoTagManagerId: n } = window._mtdsTracking;
13
+ if (o && window._paq.push(["setSiteId", o]), t) {
14
+ const s = n ? `https://cdn.matomo.cloud/${m}/container_${n}.js` : `https://cdn.matomo.cloud/${m}/matomo.js`;
15
+ document.querySelector(`script[src="${s}"]`) || document.head.append(
16
+ Object.assign(document.createElement("script"), {
17
+ async: !0,
18
+ src: s
19
+ })
20
+ );
21
+ }
14
22
  }
15
- if (a === "debug") return console.info(`Analytics: "${o}"`, n);
16
- if (a !== !1)
17
- if (o === "pageview") {
18
- const { url: e, title: t } = n;
19
- window._paq.push(["setCustomUrl", e || location.href]), window._paq.push(["setDocumentTitle", t || document.title]), window._paq.push(["trackPageView"]);
20
- } else if (o === "event") {
21
- const { category: e, action: t, name: i, value: c } = n, p = ["trackEvent", e, t, i, c];
22
- window._paq.push(p.filter((l) => l !== void 0));
23
- } else if (o === "search") {
23
+ if (window._mtdsTracking?.enabled !== !1) {
24
+ if (window._mtdsTracking?.enabled === "debug")
25
+ return console.info(`analytics("${e}", `, a, ")");
26
+ if (e === "pageview") {
27
+ const { url: t, title: o } = a;
28
+ window._paq.push(["setCustomUrl", t || location.href]), window._paq.push(["setDocumentTitle", o || document.title]), window._paq.push(["trackPageView"]);
29
+ } else if (e === "event") {
30
+ const { category: t, action: o, name: n, value: s } = a, l = ["trackEvent", t, o, n, s];
31
+ let c = location.href;
32
+ window._paq.push([
33
+ function() {
34
+ c = this.getCurrentUrl();
35
+ }
36
+ ]), window._paq.push(["setCustomUrl", c.split("#")[0]]), window._paq.push(l.filter((u) => u !== void 0)), window._paq.push(["setCustomUrl", c]);
37
+ } else if (e === "search") {
24
38
  const {
25
- query: e,
26
- category: t = !1,
27
- results: i = !1
28
- } = n;
29
- window._paq.push(["trackSiteSearch", e, t, i]);
30
- } else o === "matomo" && window._paq.push(n);
39
+ query: t,
40
+ category: o = !1,
41
+ results: n = !1
42
+ } = a;
43
+ window._paq.push(["trackSiteSearch", t, o, n]);
44
+ } else e === "matomo" && window._paq.push(a);
45
+ }
31
46
  }
32
47
  }
48
+ const v = (e) => window._mtdsTracking?.enabled && setTimeout(C, 0, e), C = ({ type: e, target: a }) => {
49
+ const t = e === "click" ? a?.closest?.(T) : a;
50
+ if (!(t instanceof Element) || i(t, "data-analytics") === "ignore")
51
+ return;
52
+ let o = "click", n = "Button", s = p(t) || I(t) || i(t, "data-tooltip") || "";
53
+ if (e === "submit")
54
+ n = "Form", o = "submit", s = s || document.title;
55
+ else if (e === "toggle") {
56
+ if (!t.matches("dialog:modal")) return;
57
+ n = "Dialog", o = "open";
58
+ } else if (e === "change") {
59
+ const l = i(t, "type"), c = l === "checkbox" || l === "radio" ? t.closest("fieldset") : null;
60
+ n = "Form", o = "change", s = p(c || t) || r(c?.querySelector("legend")) || r(t?.labels?.[0]);
61
+ } else if (i(t, "role") === "tab")
62
+ n = "Tab", o = "navigate";
63
+ else if (i(t, "popovertarget")) {
64
+ if (!E(t)?.matches(":popover-open")) return;
65
+ n = t.closest(y) ? "HelpText" : "Popover", o = "open";
66
+ } else if (t.nodeName.endsWith("SUMMARY")) {
67
+ if (!t.parentElement.open) return;
68
+ n = "Details", o = "open";
69
+ } else if (i(t, "data-command") === "toggle-app-expanded") {
70
+ const l = x(t, "--mtds-tooltip-position") === "none";
71
+ n = "Sidebar", o = l ? "expand" : "minimize", s = l && i(t, "data-tooltip") || r(t);
72
+ } else if (t.closest(_))
73
+ n = "Breadcrumbs", o = "navigate";
74
+ else if (t.closest(S))
75
+ n = "Pagintation", o = "navigate";
76
+ else if (t.closest(b))
77
+ n = "Chip", o = t.hasAttribute("data-removable") ? "remove" : "click";
78
+ else if (t.closest("th[aria-sort]"))
79
+ n = "Table", o = "sort";
80
+ else if (t instanceof HTMLAnchorElement)
81
+ n = "Link", o = t.protocol === "mailto:" ? "email" : "navigate", t.hasAttribute("download") ? o = "download" : t.hash && t.href.startsWith(location.href.split("#")[0]) && (o = "anchor");
82
+ else if (t.hasAttribute("aria-expanded")) {
83
+ if (i(t, "aria-expanded") !== "true") return;
84
+ n = "Expand", o = "open";
85
+ }
86
+ q("event", {
87
+ category: i(t, "data-analytics-category") ?? n,
88
+ action: i(t, "data-analytics-action") ?? o,
89
+ name: i(t, "data-analytics-name") ?? s
90
+ });
91
+ }, r = (e) => e?.textContent?.trim() || "", p = (e) => e && i(e, "aria-label") || "", E = (e) => document.getElementById(i(e, "popovertarget") || ""), x = (e, a) => window.getComputedStyle(e).getPropertyValue(a)?.trim(), I = (e) => {
92
+ const a = r(e), t = r(e.querySelector("h1,h2,h3,h4,h5,h6"));
93
+ return a.startsWith(t) && t || a.slice(0, 100).trim();
94
+ };
95
+ w(() => f(document, k, v, g));
33
96
  export {
34
- d as analytics
97
+ q as analytics
35
98
  };
36
99
  //# sourceMappingURL=analytics.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"analytics.js","sources":["../../designsystem/analytics/analytics.ts"],"sourcesContent":["import { IS_BROWSER } from \"../utils\";\n\nconst MATOMO = \"mattilsynet.matomo.cloud\";\nlet ENABLED: AnalyticsActions[\"init\"][\"enabled\"] = true;\n\ntype Matomo = (string | number | boolean)[];\ndeclare global {\n\tinterface Window {\n\t\t_paq?: Matomo[];\n\t\t_mtm?: Record<string, string | number>[];\n\t}\n}\n\n// window._paq = window._paq || [];\n// window._mtm = window._mtm || [];\n\n// window._paq.push([\"setCustomUrl\", `${document.location.href}&eirik`]);\n// window._paq.push([\"setDocumentTitle\", \"Eirik 3\"]);\n// window._mtm.push({\n// \tevent: \"mtm.Start\",\n// \t\"mtm.startTime\": new Date().getTime(),\n// \tcustomTitle: \"Eirik 1\",\n// \tcustomUrl: `${document.location.href}&eirik`,\n// });\n\n// window._mtm.push({\n// \tevent: \"mtm.PageView\",\n// \tcustomTitle: \"Eirik 2\",\n// \tcustomUrl: `${document.location.href}&eirik`,\n// });\n\n// const containerId = \"A9utKk3O\";\n\n// document.head.append(\n// \tObject.assign(document.createElement(\"script\"), {\n// \t\tsrc: `https://cdn.matomo.cloud/mattilsynet.matomo.cloud/container_${containerId}.js`,\n// \t\tasync: true,\n// \t\tonload: () => console.log(window._paq),\n// \t}),\n// );\n\nexport type AnalyticsActions = {\n\tinit: {\n\t\tmatomoId: number | string;\n\t\tenabled?: boolean | \"debug\";\n\t};\n\tpageview: {\n\t\turl?: string;\n\t\ttitle?: string;\n\t};\n\tevent: {\n\t\tcategory: string;\n\t\taction: string;\n\t\tname?: string;\n\t\tvalue?: number;\n\t};\n\tsearch: {\n\t\tquery: string;\n\t\tcategory?: string;\n\t\tresults?: number;\n\t};\n\tmatomo: Matomo;\n};\n\nexport function analytics<Action extends keyof AnalyticsActions>(\n\taction: Action,\n\targs = {} as AnalyticsActions[Action],\n) {\n\tif (!IS_BROWSER) return;\n\tif (!window._paq) {\n\t\twindow._paq = [];\n\t\twindow._paq.push([\"HeatmapSessionRecording::disable\"]); // Disable heatmaps by default as this require cookies\n\t\twindow._paq.push([\"enableLinkTracking\"]);\n\t\twindow._paq.push([\"setTrackerUrl\", `https://${MATOMO}/matomo.php`]);\n\t}\n\tif (action === \"init\") {\n\t\tconst { matomoId, enabled } = args as AnalyticsActions[\"init\"];\n\t\tENABLED = enabled ?? window.location.hostname === \"localhost\";\n\t\twindow._paq.push([\"setSiteId\", matomoId]);\n\t\tdocument.querySelector('script[src*=\"matomo.js\"]') ||\n\t\t\tdocument.head.append(\n\t\t\t\tObject.assign(document.createElement(\"script\"), {\n\t\t\t\t\tasync: true,\n\t\t\t\t\tsrc: `https://cdn.matomo.cloud/${MATOMO}/matomo.js`,\n\t\t\t\t}),\n\t\t\t);\n\t}\n\n\tif (ENABLED === \"debug\") return console.info(`Analytics: \"${action}\"`, args);\n\tif (ENABLED === false) return;\n\n\tif (action === \"pageview\") {\n\t\tconst { url, title } = args as AnalyticsActions[\"pageview\"];\n\t\twindow._paq.push([\"setCustomUrl\", url || location.href]);\n\t\twindow._paq.push([\"setDocumentTitle\", title || document.title]);\n\t\twindow._paq.push([\"trackPageView\"]);\n\t} else if (action === \"event\") {\n\t\tconst { category, action, name, value } = args as AnalyticsActions[\"event\"];\n\t\tconst event = [\"trackEvent\", category, action, name, value];\n\t\twindow._paq.push(event.filter((v) => v !== undefined));\n\t} else if (action === \"search\") {\n\t\tconst {\n\t\t\tquery,\n\t\t\tcategory = false,\n\t\t\tresults = false,\n\t\t} = args as AnalyticsActions[\"search\"];\n\t\twindow._paq.push([\"trackSiteSearch\", query, category, results]);\n\t} else if (action === \"matomo\") {\n\t\twindow._paq.push(args as AnalyticsActions[\"matomo\"]);\n\t}\n}\n"],"names":["MATOMO","ENABLED","analytics","action","args","IS_BROWSER","matomoId","enabled","url","title","category","name","value","event","v","query","results"],"mappings":";AAEA,MAAMA,IAAS;AACf,IAAIC,IAA+C;AA6D5C,SAASC,EACfC,GACAC,IAAO,IACN;AACD,MAAKC,GAOL;AAAA,QANK,OAAO,SACX,OAAO,OAAO,CAAC,GACf,OAAO,KAAK,KAAK,CAAC,kCAAkC,CAAC,GACrD,OAAO,KAAK,KAAK,CAAC,oBAAoB,CAAC,GACvC,OAAO,KAAK,KAAK,CAAC,iBAAiB,WAAWL,CAAM,aAAa,CAAC,IAE/DG,MAAW,QAAQ;AAChB,YAAA,EAAE,UAAAG,GAAU,SAAAC,EAAA,IAAYH;AACpB,MAAAH,IAAAM,KAAW,OAAO,SAAS,aAAa,aAClD,OAAO,KAAK,KAAK,CAAC,aAAaD,CAAQ,CAAC,GACxC,SAAS,cAAc,0BAA0B,KAChD,SAAS,KAAK;AAAA,QACb,OAAO,OAAO,SAAS,cAAc,QAAQ,GAAG;AAAA,UAC/C,OAAO;AAAA,UACP,KAAK,4BAA4BN,CAAM;AAAA,QACvC,CAAA;AAAA,MACF;AAAA,IAAA;AAGE,QAAAC,MAAY,QAAgB,QAAA,QAAQ,KAAK,eAAeE,CAAM,KAAKC,CAAI;AAC3E,QAAIH,MAAY;AAEhB,UAAIE,MAAW,YAAY;AACpB,cAAA,EAAE,KAAAK,GAAK,OAAAC,EAAA,IAAUL;AACvB,eAAO,KAAK,KAAK,CAAC,gBAAgBI,KAAO,SAAS,IAAI,CAAC,GACvD,OAAO,KAAK,KAAK,CAAC,oBAAoBC,KAAS,SAAS,KAAK,CAAC,GAC9D,OAAO,KAAK,KAAK,CAAC,eAAe,CAAC;AAAA,MAAA,WACxBN,MAAW,SAAS;AAC9B,cAAM,EAAE,UAAAO,GAAU,QAAAP,GAAQ,MAAAQ,GAAM,OAAAC,MAAUR,GACpCS,IAAQ,CAAC,cAAcH,GAAUP,GAAQQ,GAAMC,CAAK;AACnD,eAAA,KAAK,KAAKC,EAAM,OAAO,CAACC,MAAMA,MAAM,MAAS,CAAC;AAAA,MAAA,WAC3CX,MAAW,UAAU;AACzB,cAAA;AAAA,UACL,OAAAY;AAAA,UACA,UAAAL,IAAW;AAAA,UACX,SAAAM,IAAU;AAAA,QAAA,IACPZ;AACJ,eAAO,KAAK,KAAK,CAAC,mBAAmBW,GAAOL,GAAUM,CAAO,CAAC;AAAA,MAAA,MAC/D,CAAWb,MAAW,YACd,OAAA,KAAK,KAAKC,CAAkC;AAAA;AAErD;"}
1
+ {"version":3,"file":"analytics.js","sources":["../../designsystem/analytics/analytics.ts"],"sourcesContent":["import styles from \"../styles.module.css\";\nimport { attr, IS_BROWSER, on, onLoaded, QUICK_EVENT } from \"../utils\";\n\nconst CSS_BREADCRUMBS = `.${styles.breadcrumbs.split(\" \")[0]}`;\nconst CSS_CHIP = `.${styles.chip.split(\" \")[0]}`;\nconst CSS_HELPTEXT = `.${styles.helptext.split(\" \")[0]}`;\nconst CSS_PAGINATION = `.${styles.pagination.split(\" \")[0]}`;\nconst CLICKS = `summary,u-summary,a,button,[role=\"tab\"],[role=\"button\"]`;\nconst EVENTS = \"click,toggle,submit,change\";\nconst MATOMO = \"mattilsynet.matomo.cloud\";\n\ntype Matomo = (\n\t| string\n\t| number\n\t| boolean\n\t| ((this: Record<string, <T>() => T>) => void)\n)[];\ndeclare global {\n\tinterface Window {\n\t\t_paq?: Matomo[];\n\t\t_mtm?: Record<string, string | number>[];\n\t\t_mtdsTracking?: AnalyticsActions[\"init\"];\n\t\t_mtdsUntrack?: () => void;\n\t}\n}\n\nexport type AnalyticsActions = {\n\tinit: {\n\t\tenabled?: boolean | \"debug\";\n\t} & (\n\t\t| {\n\t\t\t\tmatomoId: number | string;\n\t\t\t\tmatomoTagManagerId?: never;\n\t\t }\n\t\t| {\n\t\t\t\tmatomoId?: never;\n\t\t\t\tmatomoTagManagerId: string;\n\t\t }\n\t);\n\tpageview: {\n\t\turl?: string;\n\t\ttitle?: string;\n\t};\n\tevent: {\n\t\tcategory: string;\n\t\taction: string;\n\t\tname?: string;\n\t\tvalue?: number;\n\t};\n\tsearch: {\n\t\tquery: string;\n\t\tcategory?: string;\n\t\tresults?: number;\n\t};\n\tmatomo: Matomo;\n};\n\nexport function analytics<Action extends keyof AnalyticsActions>(\n\taction: Action,\n\targs = {} as AnalyticsActions[Action],\n) {\n\tif (!IS_BROWSER) return;\n\tif (!window._paq) {\n\t\twindow._paq = [];\n\t\twindow._paq.push([\"HeatmapSessionRecording::disable\"]); // Disable heatmaps by default as this require cookies\n\t\twindow._paq.push([\"enableLinkTracking\"]);\n\t\twindow._paq.push([\"setTrackerUrl\", `https://${MATOMO}/matomo.php`]);\n\t}\n\tif (!window._mtm) {\n\t\twindow._mtm = window._mtm || []; // Prepare Matomo Tag Manager\n\t\twindow._mtm.push({ \"mtm.startTime\": Date.now(), event: \"mtm.Start\" });\n\t}\n\n\tif (action === \"init\") {\n\t\twindow._mtdsTracking = {\n\t\t\tenabled: window.location.hostname !== \"localhost\",\n\t\t\t...window._mtdsTracking,\n\t\t\t...args,\n\t\t} as AnalyticsActions[\"init\"];\n\t\tconst { enabled, matomoId, matomoTagManagerId } = window._mtdsTracking;\n\n\t\tif (matomoId) window._paq.push([\"setSiteId\", matomoId]);\n\t\tif (enabled) {\n\t\t\tconst src = matomoTagManagerId\n\t\t\t\t? `https://cdn.matomo.cloud/${MATOMO}/container_${matomoTagManagerId}.js`\n\t\t\t\t: `https://cdn.matomo.cloud/${MATOMO}/matomo.js`;\n\t\t\tdocument.querySelector(`script[src=\"${src}\"]`) ||\n\t\t\t\tdocument.head.append(\n\t\t\t\t\tObject.assign(document.createElement(\"script\"), {\n\t\t\t\t\t\tasync: true,\n\t\t\t\t\t\tsrc,\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t}\n\t}\n\n\tif (window._mtdsTracking?.enabled === false) return;\n\tif (window._mtdsTracking?.enabled === \"debug\")\n\t\treturn console.info(`analytics(\"${action}\", `, args, \")\");\n\n\tif (action === \"pageview\") {\n\t\tconst { url, title } = args as AnalyticsActions[\"pageview\"];\n\t\twindow._paq.push([\"setCustomUrl\", url || location.href]);\n\t\twindow._paq.push([\"setDocumentTitle\", title || document.title]);\n\t\twindow._paq.push([\"trackPageView\"]);\n\t} else if (action === \"event\") {\n\t\tconst { category, action, name, value } = args as AnalyticsActions[\"event\"];\n\t\tconst event = [\"trackEvent\", category, action, name, value];\n\n\t\t// We do not want to track events with hash in URL as this causes hard-to-read data,\n\t\t// so temporarily remove the hash part, and add it back after the event is pushed\n\t\tlet url = location.href;\n\t\twindow._paq.push([\n\t\t\tfunction () {\n\t\t\t\turl = this.getCurrentUrl<string>();\n\t\t\t},\n\t\t]);\n\t\twindow._paq.push([\"setCustomUrl\", url.split(\"#\")[0]]); // Skip hash part of URL\n\t\twindow._paq.push(event.filter((v) => v !== undefined)); // Push event\n\t\twindow._paq.push([\"setCustomUrl\", url]); // Reverrt to original URL with hash\n\t} else if (action === \"search\") {\n\t\tconst {\n\t\t\tquery,\n\t\t\tcategory = false,\n\t\t\tresults = false,\n\t\t} = args as AnalyticsActions[\"search\"];\n\t\twindow._paq.push([\"trackSiteSearch\", query, category, results]);\n\t} else if (action === \"matomo\") {\n\t\twindow._paq.push(args as AnalyticsActions[\"matomo\"]);\n\t}\n}\n\nconst handleTrack = (event: Event) =>\n\twindow._mtdsTracking?.enabled && setTimeout(processTrack, 0, event); // Let other events process first\n\nconst processTrack = ({ type, target }: Event) => {\n\tconst el = type === \"click\" ? (target as Element)?.closest?.(CLICKS) : target;\n\tif (!(el instanceof Element) || attr(el, \"data-analytics\") === \"ignore\")\n\t\treturn;\n\n\tlet action = \"click\";\n\tlet category = \"Button\";\n\tlet name = label(el) || heading(el) || attr(el, \"data-tooltip\") || \"\";\n\n\tif (type === \"submit\") {\n\t\tcategory = \"Form\";\n\t\taction = \"submit\";\n\t\tname = name || document.title;\n\t} else if (type === \"toggle\") {\n\t\tif (!el.matches(\"dialog:modal\")) return; // Skip non-modal dialogs\n\t\tcategory = \"Dialog\";\n\t\taction = \"open\";\n\t} else if (type === \"change\") {\n\t\tconst type = attr(el, \"type\");\n\t\tconst group =\n\t\t\ttype === \"checkbox\" || type === \"radio\" ? el.closest(\"fieldset\") : null;\n\n\t\tcategory = \"Form\";\n\t\taction = \"change\";\n\t\tname =\n\t\t\tlabel(group || el) ||\n\t\t\ttext(group?.querySelector(\"legend\")) ||\n\t\t\ttext((el as HTMLInputElement)?.labels?.[0]);\n\t} else if (attr(el, \"role\") === \"tab\") {\n\t\tcategory = \"Tab\";\n\t\taction = \"navigate\";\n\t} else if (attr(el, \"popovertarget\")) {\n\t\tif (!popover(el)?.matches(\":popover-open\")) return; // Skip if not open\n\t\tcategory = el.closest(CSS_HELPTEXT) ? \"HelpText\" : \"Popover\";\n\t\taction = \"open\";\n\t} else if (el.nodeName.endsWith(\"SUMMARY\")) {\n\t\tif (!(el.parentElement as HTMLDetailsElement).open) return; // Skip if not open\n\t\tcategory = \"Details\";\n\t\taction = \"open\";\n\t} else if (attr(el, \"data-command\") === \"toggle-app-expanded\") {\n\t\tconst open = style(el, \"--mtds-tooltip-position\") === \"none\";\n\t\tcategory = \"Sidebar\";\n\t\taction = open ? \"expand\" : \"minimize\";\n\t\tname = (open && attr(el, \"data-tooltip\")) || text(el);\n\t} else if (el.closest(CSS_BREADCRUMBS)) {\n\t\tcategory = \"Breadcrumbs\";\n\t\taction = \"navigate\";\n\t} else if (el.closest(CSS_PAGINATION)) {\n\t\tcategory = \"Pagintation\";\n\t\taction = \"navigate\";\n\t} else if (el.closest(CSS_CHIP)) {\n\t\tcategory = \"Chip\";\n\t\taction = el.hasAttribute(\"data-removable\") ? \"remove\" : \"click\";\n\t} else if (el.closest(\"th[aria-sort]\")) {\n\t\tcategory = \"Table\";\n\t\taction = \"sort\";\n\t} else if (el instanceof HTMLAnchorElement) {\n\t\tcategory = \"Link\";\n\t\taction = el.protocol === \"mailto:\" ? \"email\" : \"navigate\";\n\t\tif (el.hasAttribute(\"download\")) action = \"download\";\n\t\telse if (el.hash && el.href.startsWith(location.href.split(\"#\")[0]))\n\t\t\taction = \"anchor\"; // Only track as anchor if same page\n\t} else if (el.hasAttribute(\"aria-expanded\")) {\n\t\tif (attr(el, \"aria-expanded\") !== \"true\") return; // Skip if not open\n\t\tcategory = \"Expand\";\n\t\taction = \"open\";\n\t}\n\n\t// Respect attributes and send\n\tanalytics(\"event\", {\n\t\tcategory: attr(el, \"data-analytics-category\") ?? category,\n\t\taction: attr(el, \"data-analytics-action\") ?? action,\n\t\tname: attr(el, \"data-analytics-name\") ?? name,\n\t});\n};\n\n// Utilities\nconst text = (el?: Element | null) => el?.textContent?.trim() || \"\";\nconst label = (el?: Element | null) => (el && attr(el, \"aria-label\")) || \"\";\nconst popover = (el: Element) =>\n\tdocument.getElementById(attr(el, \"popovertarget\") || \"\");\nconst style = (el: Element, key: string) =>\n\twindow.getComputedStyle(el).getPropertyValue(key)?.trim();\nconst heading = (el: Element) => {\n\tconst body = text(el);\n\tconst head = text(el.querySelector(\"h1,h2,h3,h4,h5,h6\")); // Note: head might be empty string ''\n\treturn (body.startsWith(head) && head) || body.slice(0, 100).trim(); // Limit to 100 characters\n};\n\nonLoaded(() => on(document, EVENTS, handleTrack, QUICK_EVENT));\n"],"names":["CSS_BREADCRUMBS","styles","CSS_CHIP","CSS_HELPTEXT","CSS_PAGINATION","CLICKS","EVENTS","MATOMO","analytics","action","args","IS_BROWSER","enabled","matomoId","matomoTagManagerId","src","url","title","category","name","value","event","v","query","results","handleTrack","processTrack","type","target","el","attr","label","heading","group","text","popover","open","style","key","body","head","onLoaded","on","QUICK_EVENT"],"mappings":";;AAGA,MAAMA,IAAkB,IAAIC,EAAO,YAAY,MAAM,GAAG,EAAE,CAAC,CAAC,IACtDC,IAAW,IAAID,EAAO,KAAK,MAAM,GAAG,EAAE,CAAC,CAAC,IACxCE,IAAe,IAAIF,EAAO,SAAS,MAAM,GAAG,EAAE,CAAC,CAAC,IAChDG,IAAiB,IAAIH,EAAO,WAAW,MAAM,GAAG,EAAE,CAAC,CAAC,IACpDI,IAAS,2DACTC,IAAS,8BACTC,IAAS;AAgDR,SAASC,EACfC,GACAC,IAAO,IACN;AACD,MAAKC,GAYL;AAAA,QAXK,OAAO,SACX,OAAO,OAAO,CAAC,GACf,OAAO,KAAK,KAAK,CAAC,kCAAkC,CAAC,GACrD,OAAO,KAAK,KAAK,CAAC,oBAAoB,CAAC,GACvC,OAAO,KAAK,KAAK,CAAC,iBAAiB,WAAWJ,CAAM,aAAa,CAAC,IAE9D,OAAO,SACJ,OAAA,OAAO,OAAO,QAAQ,CAAC,GACvB,OAAA,KAAK,KAAK,EAAE,iBAAiB,KAAK,IAAI,GAAG,OAAO,aAAa,IAGjEE,MAAW,QAAQ;AACtB,aAAO,gBAAgB;AAAA,QACtB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AD,EAAU,SAAS;AAAA,IAClB,UAAUsB,EAAKD,GAAI,yBAAyB,KAAKX;AAAA,IACjD,QAAQY,EAAKD,GAAI,uBAAuB,KAAKpB;AAAA,IAC7C,MAAMqB,EAAKD,GAAI,qBAAqB,KAAKV;AAAA,EAAA,CACzC;AACF,GAGMe,IAAO,CAACL,MAAwBA,GAAI,aAAa,KAAU,KAAA,IAC3DE,IAAQ,CAACF,MAAyBA,KAAMC,EAAKD,GAAI,YAAY,KAAM,IACnEM,IAAU,CAACN,MAChB,SAAS,eAAeC,EAAKD,GAAI,eAAe,KAAK,EAAE,GAClDQ,IAAQ,CAACR,GAAaS,MAC3B,OAAO,iBAAiBT,CAAE,EAAE,iBAAiBS,CAAG,GAAG,KAAK,GACnDN,IAAU,CAACH,MAAgB;AAC1B,QAAAU,IAAOL,EAAKL,CAAE,GACdW,IAAON,EAAKL,EAAG,cAAc,mBAAmB,CAAC;AAC/C,SAAAU,EAAK,WAAWC,CAAI,KAAKA,KAASD,EAAK,MAAM,GAAG,GAAG,EAAE,KAAK;AACnE;AAEAE,EAAS,MAAMC,EAAG,UAAUpC,GAAQmB,GAAakB,CAAW,CAAC;"}
@@ -1,6 +1,6 @@
1
1
  import S from "../styles.module.css.js";
2
2
  import { onLoaded as _, onMutation as P, on as r, QUICK_EVENT as c, debounce as E } from "../utils.js";
3
- import "./app-toggle2.js";
3
+ import "./app-toggle.js";
4
4
  const g = S.app.split(" ")[0], h = S.sticky.split(" ")[0], I = '[data-command="toggle-app-expanded"]', y = `.${g} > dialog,.${g} dialog ~ main`, C = (t) => {
5
5
  document.startViewTransition ? document.startViewTransition(t) : t();
6
6
  }, x = (t) => (
@@ -1,27 +1,11 @@
1
- const t = `if (
2
- typeof window !== "undefined" &&
3
- window.CSSStyleSheet &&
4
- document.adoptedStyleSheets
5
- )
6
- (() => {
7
- const key = "--mtds-app-expanded";
8
- const sheet = new CSSStyleSheet();
9
- const prev = () => !window.localStorage.getItem(key)?.includes("false");
10
-
11
- document.adoptedStyleSheets.push(sheet);
12
- window.mtdsToggleAppExpanded = (force) => {
13
- try {
14
- const next = force ?? !prev();
15
- sheet.replaceSync?.(\`:root { \${key}: var(\${key}--\${next})}\`);
16
- window.localStorage.setItem(key, next);
17
- } catch (_err) {} // localStorage is full or replaceSync is not supported
18
- };
19
-
20
- // Set and store initial state
21
- window.mtdsToggleAppExpanded(prev());
22
- })();
23
- `;
24
- export {
25
- t as default
26
- };
1
+ typeof window < "u" && window.CSSStyleSheet && document.adoptedStyleSheets && (() => {
2
+ const e = "--mtds-app-expanded", d = new CSSStyleSheet(), o = () => !window.localStorage.getItem(e)?.includes("false");
3
+ document.adoptedStyleSheets.push(d), window.mtdsToggleAppExpanded = (n) => {
4
+ try {
5
+ const t = n ?? !o();
6
+ d.replaceSync?.(`:root { ${e}: var(${e}--${t})}`), window.localStorage.setItem(e, t);
7
+ } catch {
8
+ }
9
+ }, window.mtdsToggleAppExpanded(o());
10
+ })();
27
11
  //# sourceMappingURL=app-toggle.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"app-toggle.js","sources":["../../designsystem/app/app-toggle.js?raw"],"sourcesContent":["export default \"if (\\n\\ttypeof window !== \\\"undefined\\\" &&\\n\\twindow.CSSStyleSheet &&\\n\\tdocument.adoptedStyleSheets\\n)\\n\\t(() => {\\n\\t\\tconst key = \\\"--mtds-app-expanded\\\";\\n\\t\\tconst sheet = new CSSStyleSheet();\\n\\t\\tconst prev = () => !window.localStorage.getItem(key)?.includes(\\\"false\\\");\\n\\n\\t\\tdocument.adoptedStyleSheets.push(sheet);\\n\\t\\twindow.mtdsToggleAppExpanded = (force) => {\\n\\t\\t\\ttry {\\n\\t\\t\\t\\tconst next = force ?? !prev();\\n\\t\\t\\t\\tsheet.replaceSync?.(`:root { ${key}: var(${key}--${next})}`);\\n\\t\\t\\t\\twindow.localStorage.setItem(key, next);\\n\\t\\t\\t} catch (_err) {} // localStorage is full or replaceSync is not supported\\n\\t\\t};\\n\\n\\t\\t// Set and store initial state\\n\\t\\twindow.mtdsToggleAppExpanded(prev());\\n\\t})();\\n\""],"names":["script"],"mappings":"AAAA,MAAeA,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
1
+ {"version":3,"file":"app-toggle.js","sources":["../../designsystem/app/app-toggle.js"],"sourcesContent":["if (\n\ttypeof window !== \"undefined\" &&\n\twindow.CSSStyleSheet &&\n\tdocument.adoptedStyleSheets\n)\n\t(() => {\n\t\tconst key = \"--mtds-app-expanded\";\n\t\tconst sheet = new CSSStyleSheet();\n\t\tconst prev = () => !window.localStorage.getItem(key)?.includes(\"false\");\n\n\t\tdocument.adoptedStyleSheets.push(sheet);\n\t\twindow.mtdsToggleAppExpanded = (force) => {\n\t\t\ttry {\n\t\t\t\tconst next = force ?? !prev();\n\t\t\t\tsheet.replaceSync?.(`:root { ${key}: var(${key}--${next})}`);\n\t\t\t\twindow.localStorage.setItem(key, next);\n\t\t\t} catch (_err) {} // localStorage is full or replaceSync is not supported\n\t\t};\n\n\t\t// Set and store initial state\n\t\twindow.mtdsToggleAppExpanded(prev());\n\t})();\n"],"names":["key","sheet","prev","force","next"],"mappings":"AACC,OAAO,SAAW,OAClB,OAAO,iBACP,SAAS,uBAER,MAAM;AACN,QAAMA,IAAM,uBACNC,IAAQ,IAAI,cAAe,GAC3BC,IAAO,MAAM,CAAC,OAAO,aAAa,QAAQF,CAAG,GAAG,SAAS,OAAO;AAEtE,WAAS,mBAAmB,KAAKC,CAAK,GACtC,OAAO,wBAAwB,CAACE,MAAU;AACzC,QAAI;AACH,YAAMC,IAAOD,KAAS,CAACD,EAAM;AAC7B,MAAAD,EAAM,cAAc,WAAWD,CAAG,SAASA,CAAG,KAAKI,CAAI,IAAI,GAC3D,OAAO,aAAa,QAAQJ,GAAKI,CAAI;AAAA,IACzC,QAAkB;AAAA,IAAE;AAAA,EACjB,GAGD,OAAO,sBAAsBF,GAAM;AACrC,GAAK;"}
@@ -1,11 +1,27 @@
1
- typeof window < "u" && window.CSSStyleSheet && document.adoptedStyleSheets && (() => {
2
- const e = "--mtds-app-expanded", d = new CSSStyleSheet(), o = () => !window.localStorage.getItem(e)?.includes("false");
3
- document.adoptedStyleSheets.push(d), window.mtdsToggleAppExpanded = (n) => {
4
- try {
5
- const t = n ?? !o();
6
- d.replaceSync?.(`:root { ${e}: var(${e}--${t})}`), window.localStorage.setItem(e, t);
7
- } catch {
8
- }
9
- }, window.mtdsToggleAppExpanded(o());
10
- })();
1
+ const t = `if (
2
+ typeof window !== "undefined" &&
3
+ window.CSSStyleSheet &&
4
+ document.adoptedStyleSheets
5
+ )
6
+ (() => {
7
+ const key = "--mtds-app-expanded";
8
+ const sheet = new CSSStyleSheet();
9
+ const prev = () => !window.localStorage.getItem(key)?.includes("false");
10
+
11
+ document.adoptedStyleSheets.push(sheet);
12
+ window.mtdsToggleAppExpanded = (force) => {
13
+ try {
14
+ const next = force ?? !prev();
15
+ sheet.replaceSync?.(\`:root { \${key}: var(\${key}--\${next})}\`);
16
+ window.localStorage.setItem(key, next);
17
+ } catch (_err) {} // localStorage is full or replaceSync is not supported
18
+ };
19
+
20
+ // Set and store initial state
21
+ window.mtdsToggleAppExpanded(prev());
22
+ })();
23
+ `;
24
+ export {
25
+ t as default
26
+ };
11
27
  //# sourceMappingURL=app-toggle2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"app-toggle2.js","sources":["../../designsystem/app/app-toggle.js"],"sourcesContent":["if (\n\ttypeof window !== \"undefined\" &&\n\twindow.CSSStyleSheet &&\n\tdocument.adoptedStyleSheets\n)\n\t(() => {\n\t\tconst key = \"--mtds-app-expanded\";\n\t\tconst sheet = new CSSStyleSheet();\n\t\tconst prev = () => !window.localStorage.getItem(key)?.includes(\"false\");\n\n\t\tdocument.adoptedStyleSheets.push(sheet);\n\t\twindow.mtdsToggleAppExpanded = (force) => {\n\t\t\ttry {\n\t\t\t\tconst next = force ?? !prev();\n\t\t\t\tsheet.replaceSync?.(`:root { ${key}: var(${key}--${next})}`);\n\t\t\t\twindow.localStorage.setItem(key, next);\n\t\t\t} catch (_err) {} // localStorage is full or replaceSync is not supported\n\t\t};\n\n\t\t// Set and store initial state\n\t\twindow.mtdsToggleAppExpanded(prev());\n\t})();\n"],"names":["key","sheet","prev","force","next"],"mappings":"AACC,OAAO,SAAW,OAClB,OAAO,iBACP,SAAS,uBAER,MAAM;AACN,QAAMA,IAAM,uBACNC,IAAQ,IAAI,cAAe,GAC3BC,IAAO,MAAM,CAAC,OAAO,aAAa,QAAQF,CAAG,GAAG,SAAS,OAAO;AAEtE,WAAS,mBAAmB,KAAKC,CAAK,GACtC,OAAO,wBAAwB,CAACE,MAAU;AACzC,QAAI;AACH,YAAMC,IAAOD,KAAS,CAACD,EAAM;AAC7B,MAAAD,EAAM,cAAc,WAAWD,CAAG,SAASA,CAAG,KAAKI,CAAI,IAAI,GAC3D,OAAO,aAAa,QAAQJ,GAAKI,CAAI;AAAA,IACzC,QAAkB;AAAA,IAAE;AAAA,EACjB,GAGD,OAAO,sBAAsBF,GAAM;AACrC,GAAK;"}
1
+ {"version":3,"file":"app-toggle2.js","sources":["../../designsystem/app/app-toggle.js?raw"],"sourcesContent":["export default \"if (\\n\\ttypeof window !== \\\"undefined\\\" &&\\n\\twindow.CSSStyleSheet &&\\n\\tdocument.adoptedStyleSheets\\n)\\n\\t(() => {\\n\\t\\tconst key = \\\"--mtds-app-expanded\\\";\\n\\t\\tconst sheet = new CSSStyleSheet();\\n\\t\\tconst prev = () => !window.localStorage.getItem(key)?.includes(\\\"false\\\");\\n\\n\\t\\tdocument.adoptedStyleSheets.push(sheet);\\n\\t\\twindow.mtdsToggleAppExpanded = (force) => {\\n\\t\\t\\ttry {\\n\\t\\t\\t\\tconst next = force ?? !prev();\\n\\t\\t\\t\\tsheet.replaceSync?.(`:root { ${key}: var(${key}--${next})}`);\\n\\t\\t\\t\\twindow.localStorage.setItem(key, next);\\n\\t\\t\\t} catch (_err) {} // localStorage is full or replaceSync is not supported\\n\\t\\t};\\n\\n\\t\\t// Set and store initial state\\n\\t\\twindow.mtdsToggleAppExpanded(prev());\\n\\t})();\\n\""],"names":["script"],"mappings":"AAAA,MAAeA,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
package/mtds/app/app.js CHANGED
@@ -32,7 +32,7 @@ import "../togglegroup/togglegroup.js";
32
32
  import "../typography/typography.js";
33
33
  import "../validation/validation.js";
34
34
  import a from "../styles.module.css.js";
35
- import d from "./app-toggle.js";
35
+ import d from "./app-toggle2.js";
36
36
  const f = p(function({ as: t, className: r, ...m }, n) {
37
37
  return /* @__PURE__ */ o(t || "div", { className: e(a.app, r), ref: n, ...m });
38
38
  }), u = p(function({ as: t, className: r, ...m }, n) {
@@ -1,22 +1,20 @@
1
1
  import d from "../styles.module.css.js";
2
- import { IS_BROWSER as r, onLoaded as m, on as u, QUICK_EVENT as f, createOptimizedMutationObserver as p, attr as o } from "../utils.js";
3
- const g = d.dialog.split(" ")[0], h = r ? document.getElementsByClassName(
4
- g
2
+ import { IS_BROWSER as m, onLoaded as r, on as u, QUICK_EVENT as f, createOptimizedMutationObserver as g, attr as e } from "../utils.js";
3
+ const p = d.dialog.split(" ")[0], h = m ? document.getElementsByClassName(
4
+ p
5
5
  ) : [], b = () => {
6
6
  for (const t of h)
7
- t.isConnected && t.showModal && t.close && (t.matches('[open]:not([data-modal="false"]):not(:modal)') ? (o(t, "open", null), t.showModal()) : t.matches(":modal:not([open])") && (o(t, "open", ""), t.close()));
8
- }, C = ({ clientX: t, clientY: n, target: s }) => {
9
- const e = s?.closest?.("dialog");
10
- if (e) {
11
- if (s.closest('[data-command="close"]')) return e.close();
12
- if (o(e, "data-closedby") === "any") {
13
- const { top: l, right: i, bottom: a, left: c } = e.getBoundingClientRect();
14
- l <= n && n <= a && c <= t && t <= i || e.close();
15
- }
7
+ t.isConnected && t.showModal && t.close && (t.matches('[open]:not([data-modal="false"]):not(:modal)') ? (e(t, "open", null), t.showModal()) : t.matches(":modal:not([open])") && (e(t, "open", ""), t.close()));
8
+ }, C = ({ clientX: t, clientY: n, target: o }) => {
9
+ if (o instanceof HTMLDialogElement && e(o, "data-closedby") === "any") {
10
+ const { top: c, right: l, bottom: i, left: a } = o.getBoundingClientRect();
11
+ if (!(c <= n && n <= i && a <= t && t <= l)) return o.close();
16
12
  }
13
+ const s = o?.closest?.("dialog");
14
+ s && o?.closest?.('[data-command="close"]') && s.close();
17
15
  };
18
- m(() => {
19
- u(document, "click", C, f), p(b).observe(
16
+ r(() => {
17
+ u(document, "click", C, f), g(b).observe(
20
18
  document.documentElement,
21
19
  {
22
20
  attributeFilter: ["open"],
@@ -1 +1 @@
1
- {"version":3,"file":"dialog-observer.js","sources":["../../designsystem/dialog/dialog-observer.ts"],"sourcesContent":["import styles from \"../styles.module.css\";\nimport {\n\tattr,\n\tcreateOptimizedMutationObserver,\n\tIS_BROWSER,\n\ton,\n\tonLoaded,\n\tQUICK_EVENT,\n} from \"../utils\";\n\nconst CSS_DIALOG = styles.dialog.split(\" \")[0];\nconst DIALOGS = IS_BROWSER\n\t? (document.getElementsByClassName(\n\t\t\tCSS_DIALOG,\n\t\t) as HTMLCollectionOf<HTMLDialogElement>)\n\t: [];\n\nconst handleModal = () => {\n\tfor (const dialog of DIALOGS)\n\t\tif (dialog.isConnected && dialog.showModal && dialog.close) {\n\t\t\tif (dialog.matches('[open]:not([data-modal=\"false\"]):not(:modal)')) {\n\t\t\t\tattr(dialog, \"open\", null); // Using attribute instead of .close to avoid `close` event\n\t\t\t\tdialog.showModal();\n\t\t\t} else if (dialog.matches(\":modal:not([open])\")) {\n\t\t\t\tattr(dialog, \"open\", \"\"); // Set as open\n\t\t\t\tdialog.close(); // So we correclty can call .close, removing <dialog> from #top-layer\n\t\t\t}\n\t\t}\n};\n\nconst handleClick = ({ clientX: x, clientY: y, target: el }: MouseEvent) => {\n\tconst dialog = (el as Element)?.closest?.(\"dialog\");\n\n\tif (!dialog) return;\n\tif ((el as Element).closest('[data-command=\"close\"]')) return dialog.close();\n\tif (attr(dialog, \"data-closedby\") === \"any\") {\n\t\tconst { top, right, bottom, left } = dialog.getBoundingClientRect();\n\t\tconst isInside = top <= y && y <= bottom && left <= x && x <= right;\n\t\tif (!isInside) dialog.close();\n\t}\n};\n\nonLoaded(() => {\n\ton(document, \"click\", handleClick as EventListener, QUICK_EVENT);\n\tcreateOptimizedMutationObserver(handleModal).observe(\n\t\tdocument.documentElement,\n\t\t{\n\t\t\tattributeFilter: [\"open\"],\n\t\t\tattributes: true,\n\t\t\tchildList: true,\n\t\t\tsubtree: true,\n\t\t},\n\t);\n});\n"],"names":["CSS_DIALOG","styles","DIALOGS","IS_BROWSER","handleModal","dialog","attr","handleClick","x","y","el","top","right","bottom","left","onLoaded","on","QUICK_EVENT","createOptimizedMutationObserver"],"mappings":";;AAUA,MAAMA,IAAaC,EAAO,OAAO,MAAM,GAAG,EAAE,CAAC,GACvCC,IAAUC,IACZ,SAAS;AAAA,EACVH;AACD,IACC,CAAC,GAEEI,IAAc,MAAM;AACzB,aAAWC,KAAUH;AACpB,IAAIG,EAAO,eAAeA,EAAO,aAAaA,EAAO,UAChDA,EAAO,QAAQ,8CAA8C,KAC3DC,EAAAD,GAAQ,QAAQ,IAAI,GACzBA,EAAO,UAAU,KACPA,EAAO,QAAQ,oBAAoB,MACxCC,EAAAD,GAAQ,QAAQ,EAAE,GACvBA,EAAO,MAAM;AAGjB,GAEME,IAAc,CAAC,EAAE,SAASC,GAAG,SAASC,GAAG,QAAQC,QAAqB;AACrE,QAAAL,IAAUK,GAAgB,UAAU,QAAQ;AAElD,MAAKL,GACL;AAAA,QAAKK,EAAe,QAAQ,wBAAwB,EAAG,QAAOL,EAAO,MAAM;AAC3E,QAAIC,EAAKD,GAAQ,eAAe,MAAM,OAAO;AAC5C,YAAM,EAAE,KAAAM,GAAK,OAAAC,GAAO,QAAAC,GAAQ,MAAAC,EAAK,IAAIT,EAAO,sBAAsB;AAE9D,MADaM,KAAOF,KAAKA,KAAKI,KAAUC,KAAQN,KAAKA,KAAKI,KAC/CP,EAAO,MAAM;AAAA,IAAA;AAAA;AAE9B;AAEAU,EAAS,MAAM;AACX,EAAAC,EAAA,UAAU,SAAST,GAA8BU,CAAW,GAC/DC,EAAgCd,CAAW,EAAE;AAAA,IAC5C,SAAS;AAAA,IACT;AAAA,MACC,iBAAiB,CAAC,MAAM;AAAA,MACxB,YAAY;AAAA,MACZ,WAAW;AAAA,MACX,SAAS;AAAA,IAAA;AAAA,EAEX;AACD,CAAC;"}
1
+ {"version":3,"file":"dialog-observer.js","sources":["../../designsystem/dialog/dialog-observer.ts"],"sourcesContent":["import styles from \"../styles.module.css\";\nimport {\n\tattr,\n\tcreateOptimizedMutationObserver,\n\tIS_BROWSER,\n\ton,\n\tonLoaded,\n\tQUICK_EVENT,\n} from \"../utils\";\n\nconst CSS_DIALOG = styles.dialog.split(\" \")[0];\nconst DIALOGS = IS_BROWSER\n\t? (document.getElementsByClassName(\n\t\t\tCSS_DIALOG,\n\t\t) as HTMLCollectionOf<HTMLDialogElement>)\n\t: [];\n\nconst handleModal = () => {\n\tfor (const dialog of DIALOGS)\n\t\tif (dialog.isConnected && dialog.showModal && dialog.close) {\n\t\t\tif (dialog.matches('[open]:not([data-modal=\"false\"]):not(:modal)')) {\n\t\t\t\tattr(dialog, \"open\", null); // Using attribute instead of .close to avoid `close` event\n\t\t\t\tdialog.showModal();\n\t\t\t} else if (dialog.matches(\":modal:not([open])\")) {\n\t\t\t\tattr(dialog, \"open\", \"\"); // Set as open\n\t\t\t\tdialog.close(); // So we correclty can call .close, removing <dialog> from #top-layer\n\t\t\t}\n\t\t}\n};\n\nconst handleClick = ({ clientX: x, clientY: y, target: el }: MouseEvent) => {\n\tif (el instanceof HTMLDialogElement && attr(el, \"data-closedby\") === \"any\") {\n\t\tconst { top, right, bottom, left } = el.getBoundingClientRect();\n\t\tconst isInside = top <= y && y <= bottom && left <= x && x <= right;\n\t\tif (!isInside) return el.close();\n\t}\n\tconst dialog = (el as Element)?.closest?.(\"dialog\");\n\tconst close = dialog && (el as Element)?.closest?.('[data-command=\"close\"]');\n\tif (close) dialog.close();\n};\n\nonLoaded(() => {\n\ton(document, \"click\", handleClick as EventListener, QUICK_EVENT);\n\tcreateOptimizedMutationObserver(handleModal).observe(\n\t\tdocument.documentElement,\n\t\t{\n\t\t\tattributeFilter: [\"open\"],\n\t\t\tattributes: true,\n\t\t\tchildList: true,\n\t\t\tsubtree: true,\n\t\t},\n\t);\n});\n"],"names":["CSS_DIALOG","styles","DIALOGS","IS_BROWSER","handleModal","dialog","attr","handleClick","x","y","el","top","right","bottom","left","onLoaded","on","QUICK_EVENT","createOptimizedMutationObserver"],"mappings":";;AAUA,MAAMA,IAAaC,EAAO,OAAO,MAAM,GAAG,EAAE,CAAC,GACvCC,IAAUC,IACZ,SAAS;AAAA,EACVH;AACD,IACC,CAAC,GAEEI,IAAc,MAAM;AACzB,aAAWC,KAAUH;AACpB,IAAIG,EAAO,eAAeA,EAAO,aAAaA,EAAO,UAChDA,EAAO,QAAQ,8CAA8C,KAC3DC,EAAAD,GAAQ,QAAQ,IAAI,GACzBA,EAAO,UAAU,KACPA,EAAO,QAAQ,oBAAoB,MACxCC,EAAAD,GAAQ,QAAQ,EAAE,GACvBA,EAAO,MAAM;AAGjB,GAEME,IAAc,CAAC,EAAE,SAASC,GAAG,SAASC,GAAG,QAAQC,QAAqB;AAC3E,MAAIA,aAAc,qBAAqBJ,EAAKI,GAAI,eAAe,MAAM,OAAO;AAC3E,UAAM,EAAE,KAAAC,GAAK,OAAAC,GAAO,QAAAC,GAAQ,MAAAC,EAAK,IAAIJ,EAAG,sBAAsB;AAE9D,QAAI,EADaC,KAAOF,KAAKA,KAAKI,KAAUC,KAAQN,KAAKA,KAAKI,GACxC,QAAAF,EAAG,MAAM;AAAA,EAAA;AAE1B,QAAAL,IAAUK,GAAgB,UAAU,QAAQ;AAE9C,EADUL,KAAWK,GAAgB,UAAU,wBAAwB,OACzD,MAAM;AACzB;AAEAK,EAAS,MAAM;AACX,EAAAC,EAAA,UAAU,SAAST,GAA8BU,CAAW,GAC/DC,EAAgCd,CAAW,EAAE;AAAA,IAC5C,SAAS;AAAA,IACT;AAAA,MACC,iBAAiB,CAAC,MAAM;AAAA,MACxB,YAAY;AAAA,MACZ,WAAW;AAAA,MACX,SAAS;AAAA,IAAA;AAAA,EAEX;AACD,CAAC;"}
@@ -1,26 +1,27 @@
1
- import { jsxs as n, Fragment as a, jsx as t } from "react/jsx-runtime";
1
+ import { jsxs as l, Fragment as m, jsx as o } from "react/jsx-runtime";
2
2
  import { clsx as i } from "../external/clsx/dist/clsx.js";
3
- import { forwardRef as l, useId as c } from "react";
4
- import e from "../styles.module.css.js";
5
- const T = l(
6
- function({ className: r, children: p, ...s }, m) {
7
- const o = c();
8
- return /* @__PURE__ */ n(a, { children: [
9
- /* @__PURE__ */ t(
3
+ import { forwardRef as n, useId as c } from "react";
4
+ import t from "../styles.module.css.js";
5
+ const b = n(
6
+ function({ className: r, children: p, ...s }, a) {
7
+ const e = c();
8
+ return /* @__PURE__ */ l(m, { children: [
9
+ /* @__PURE__ */ o(
10
10
  "button",
11
11
  {
12
- className: i(e.helptext, r),
13
- popoverTarget: o,
14
- ref: m,
12
+ "aria-label": "Hjelptekst",
13
+ className: i(t.helptext, r),
14
+ popoverTarget: e,
15
+ ref: a,
15
16
  type: "button",
16
17
  ...s
17
18
  }
18
19
  ),
19
- /* @__PURE__ */ t("div", { className: e.popover, id: o, popover: "auto", children: p })
20
+ /* @__PURE__ */ o("div", { className: t.popover, id: e, popover: "auto", children: p })
20
21
  ] });
21
22
  }
22
23
  );
23
24
  export {
24
- T as HelpText
25
+ b as HelpText
25
26
  };
26
27
  //# sourceMappingURL=helptext.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"helptext.js","sources":["../../designsystem/helptext/helptext.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef, useId } from \"react\";\nimport styles from \"../styles.module.css\";\n\nexport type HelpTextProps = React.ComponentPropsWithoutRef<\"button\">;\n\nexport const HelpText = forwardRef<HTMLButtonElement, HelpTextProps>(\n\tfunction HelpText({ className, children, ...rest }, ref) {\n\t\tconst popoverId = useId();\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<button\n\t\t\t\t\tclassName={clsx(styles.helptext, className)}\n\t\t\t\t\tpopoverTarget={popoverId}\n\t\t\t\t\tref={ref}\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t{...rest}\n\t\t\t\t/>\n\t\t\t\t<div className={styles.popover} id={popoverId} popover=\"auto\">\n\t\t\t\t\t{children}\n\t\t\t\t</div>\n\t\t\t</>\n\t\t);\n\t},\n);\n"],"names":["HelpText","forwardRef","className","children","rest","ref","popoverId","useId","jsxs","Fragment","jsx","clsx","styles"],"mappings":";;;;AAMO,MAAMA,IAAWC;AAAA,EACvB,SAAkB,EAAE,WAAAC,GAAW,UAAAC,GAAU,GAAGC,KAAQC,GAAK;AACxD,UAAMC,IAAYC,EAAM;AACxB,WAEE,gBAAAC,EAAAC,GAAA,EAAA,UAAA;AAAA,MAAA,gBAAAC;AAAA,QAAC;AAAA,QAAA;AAAA,UACA,WAAWC,EAAKC,EAAO,UAAUV,CAAS;AAAA,UAC1C,eAAeI;AAAA,UACf,KAAAD;AAAA,UACA,MAAK;AAAA,UACJ,GAAGD;AAAA,QAAA;AAAA,MACL;AAAA,MACA,gBAAAM,EAAC,SAAI,WAAWE,EAAO,SAAS,IAAIN,GAAW,SAAQ,QACrD,UAAAH,EACF,CAAA;AAAA,IAAA,GACD;AAAA,EAAA;AAGH;"}
1
+ {"version":3,"file":"helptext.js","sources":["../../designsystem/helptext/helptext.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef, useId } from \"react\";\nimport styles from \"../styles.module.css\";\n\nexport type HelpTextProps = React.ComponentPropsWithoutRef<\"button\">;\n\nexport const HelpText = forwardRef<HTMLButtonElement, HelpTextProps>(\n\tfunction HelpText({ className, children, ...rest }, ref) {\n\t\tconst popoverId = useId();\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<button\n\t\t\t\t\taria-label=\"Hjelptekst\"\n\t\t\t\t\tclassName={clsx(styles.helptext, className)}\n\t\t\t\t\tpopoverTarget={popoverId}\n\t\t\t\t\tref={ref}\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t{...rest}\n\t\t\t\t/>\n\t\t\t\t<div className={styles.popover} id={popoverId} popover=\"auto\">\n\t\t\t\t\t{children}\n\t\t\t\t</div>\n\t\t\t</>\n\t\t);\n\t},\n);\n"],"names":["HelpText","forwardRef","className","children","rest","ref","popoverId","useId","jsxs","Fragment","jsx","clsx","styles"],"mappings":";;;;AAMO,MAAMA,IAAWC;AAAA,EACvB,SAAkB,EAAE,WAAAC,GAAW,UAAAC,GAAU,GAAGC,KAAQC,GAAK;AACxD,UAAMC,IAAYC,EAAM;AACxB,WAEE,gBAAAC,EAAAC,GAAA,EAAA,UAAA;AAAA,MAAA,gBAAAC;AAAA,QAAC;AAAA,QAAA;AAAA,UACA,cAAW;AAAA,UACX,WAAWC,EAAKC,EAAO,UAAUV,CAAS;AAAA,UAC1C,eAAeI;AAAA,UACf,KAAAD;AAAA,UACA,MAAK;AAAA,UACJ,GAAGD;AAAA,QAAA;AAAA,MACL;AAAA,MACA,gBAAAM,EAAC,SAAI,WAAWE,EAAO,SAAS,IAAIN,GAAW,SAAQ,QACrD,UAAAH,EACF,CAAA;AAAA,IAAA,GACD;AAAA,EAAA;AAGH;"}