@mattilsynet/design 2.2.2 → 2.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/mtds/analytics/analytics.js +25 -30
- package/mtds/analytics/analytics.js.map +1 -1
- package/mtds/app/app.js +3 -2
- package/mtds/app/app.js.map +1 -1
- package/mtds/chart/chart-axis.d.ts +10 -0
- package/mtds/chart/chart-axis.js +21 -0
- package/mtds/chart/chart-axis.js.map +1 -0
- package/mtds/chart/chart-bars.d.ts +2 -0
- package/mtds/chart/chart-bars.js +24 -0
- package/mtds/chart/chart-bars.js.map +1 -0
- package/mtds/chart/chart-element.d.ts +14 -15
- package/mtds/chart/chart-element.js +64 -102
- package/mtds/chart/chart-element.js.map +1 -1
- package/mtds/chart/chart-lines.d.ts +8 -0
- package/mtds/chart/chart-lines.js +44 -0
- package/mtds/chart/chart-lines.js.map +1 -0
- package/mtds/chart/chart-pies.d.ts +4 -0
- package/mtds/chart/chart-pies.js +17 -0
- package/mtds/chart/chart-pies.js.map +1 -0
- package/mtds/chart/chart.css.js +299 -0
- package/mtds/chart/chart.css.js.map +1 -0
- package/mtds/chart/chart.d.ts +16 -4
- package/mtds/chart/chart.js +11 -0
- package/mtds/chart/chart.js.map +1 -0
- package/mtds/chart/chart.stories.d.ts +15 -0
- package/mtds/details/details.d.ts +6 -2
- package/mtds/details/details.js.map +1 -1
- package/mtds/field/field.js +15 -14
- package/mtds/field/field.js.map +1 -1
- package/mtds/index.d.ts +4 -4
- package/mtds/index.iife.js +149 -175
- package/mtds/logo/logo-observer.js +11 -11
- package/mtds/logo/logo-observer.js.map +1 -1
- package/mtds/package.json.js +1 -1
- package/mtds/pagination/pagination.js +3 -2
- package/mtds/pagination/pagination.js.map +1 -1
- package/mtds/popover/popover-observer.js +14 -15
- package/mtds/popover/popover-observer.js.map +1 -1
- package/mtds/react.d.ts +1 -0
- package/mtds/react.js +60 -58
- package/mtds/react.js.map +1 -1
- package/mtds/styles.css +1 -1
- package/mtds/styles.json +41 -41
- package/mtds/styles.module.css.js +33 -33
- package/mtds/tailwind.css +1 -0
- package/mtds/toast/toast-helper.d.ts +12 -0
- package/mtds/toast/toast-helper.js +22 -8
- package/mtds/toast/toast-helper.js.map +1 -1
- package/mtds/toast/toast.d.ts +12 -0
- package/mtds/toast/toast.js +35 -21
- package/mtds/toast/toast.js.map +1 -1
- package/mtds/toast/toast.stories.d.ts +1 -0
- package/mtds/tooltip/tooltip-observer.js +16 -16
- package/mtds/tooltip/tooltip-observer.js.map +1 -1
- package/mtds/utils.d.ts +13 -0
- package/mtds/utils.js +65 -58
- package/mtds/utils.js.map +1 -1
- package/package.json +6 -6
- package/mtds/chart/chart.module.css.js +0 -325
- package/mtds/chart/chart.module.css.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import m from "../styles.module.css.js";
|
|
2
|
-
import { onLoaded as w, IS_BROWSER as
|
|
3
|
-
const
|
|
4
|
-
function
|
|
5
|
-
if (
|
|
2
|
+
import { onLoaded as w, IS_BROWSER as g, tag as b, on as y, QUICK_EVENT as _, attr as i } from "../utils.js";
|
|
3
|
+
const k = `.${m.breadcrumbs.split(" ")[0]}`, S = `.${m.card.split(" ")[0]}`, u = `.${m.chip.split(" ")[0]}`, v = `.${m.helptext.split(" ")[0]}`, T = `.${m.pagination.split(" ")[0]}`, x = 'summary,u-summary,a,button,[role="tab"],[role="button"]', C = "click,toggle,submit,change", p = "mattilsynet.matomo.cloud", s = "mtds-analytics-banner", E = "https://www.mattilsynet.no/om-mattilsynet/personvernerklaering/informasjonskapsler";
|
|
4
|
+
function q(t, a = {}) {
|
|
5
|
+
if (g) {
|
|
6
6
|
if (window._paq || (window._paq = [], window._paq.push(["HeatmapSessionRecording::disable"]), window._paq.push(["enableLinkTracking"]), window._paq.push(["setTrackerUrl", `https://${p}/matomo.php`])), window._mtm || (window._mtm = window._mtm || [], window._mtm.push({ "mtm.startTime": Date.now(), event: "mtm.Start" })), t === "init") {
|
|
7
7
|
window._mtdsTracking = {
|
|
8
8
|
enabled: window.location.hostname !== "localhost",
|
|
@@ -11,14 +11,9 @@ function C(t, a = {}) {
|
|
|
11
11
|
};
|
|
12
12
|
const { consent: e, enabled: o, matomoId: n, matomoTagManagerId: r } = window._mtdsTracking;
|
|
13
13
|
if (n && window._paq.push(["setSiteId", n]), o) {
|
|
14
|
-
e !== "custom" &&
|
|
14
|
+
e !== "custom" && $();
|
|
15
15
|
const l = r ? `https://cdn.matomo.cloud/${p}/container_${r}.js` : `https://cdn.matomo.cloud/${p}/matomo.js`;
|
|
16
|
-
document.querySelector(`script[src="${l}"]`) || document.head.append(
|
|
17
|
-
Object.assign(document.createElement("script"), {
|
|
18
|
-
async: !0,
|
|
19
|
-
src: l
|
|
20
|
-
})
|
|
21
|
-
);
|
|
16
|
+
document.querySelector(`script[src="${l}"]`) || document.head.append(b("script", { async: "", src: l }));
|
|
22
17
|
}
|
|
23
18
|
}
|
|
24
19
|
if (window._mtdsTracking?.enabled !== !1) {
|
|
@@ -34,7 +29,7 @@ function C(t, a = {}) {
|
|
|
34
29
|
function() {
|
|
35
30
|
c = this.getCurrentUrl();
|
|
36
31
|
}
|
|
37
|
-
]), window._paq.push(["setCustomUrl", c.split("#")[0]]), window._paq.push(l.filter((
|
|
32
|
+
]), window._paq.push(["setCustomUrl", c.split("#")[0]]), window._paq.push(l.filter((h) => h !== void 0)), window._paq.push(["setCustomUrl", c]);
|
|
38
33
|
} else if (t === "search") {
|
|
39
34
|
const {
|
|
40
35
|
query: e,
|
|
@@ -46,7 +41,7 @@ function C(t, a = {}) {
|
|
|
46
41
|
}
|
|
47
42
|
}
|
|
48
43
|
}
|
|
49
|
-
function
|
|
44
|
+
function $() {
|
|
50
45
|
if (document.getElementById(s) || window.localStorage.getItem(s)) return;
|
|
51
46
|
document.body.insertAdjacentHTML(
|
|
52
47
|
"afterbegin",
|
|
@@ -65,14 +60,14 @@ function q() {
|
|
|
65
60
|
const a = document.getElementById(s), e = () => window.localStorage.setItem(s, "seen");
|
|
66
61
|
a.addEventListener("close", e, { once: !0 }), a.show();
|
|
67
62
|
}
|
|
68
|
-
function
|
|
69
|
-
window._mtdsTracking?.enabled && setTimeout(
|
|
63
|
+
function A(t) {
|
|
64
|
+
window._mtdsTracking?.enabled && setTimeout(I, 0, t);
|
|
70
65
|
}
|
|
71
|
-
function
|
|
72
|
-
const e = t === "click" ? a?.closest?.(
|
|
66
|
+
function I({ type: t, target: a }) {
|
|
67
|
+
const e = t === "click" ? a?.closest?.(x) : a;
|
|
73
68
|
if (!(e instanceof Element) || e.closest('[data-analytics="ignore"]'))
|
|
74
69
|
return;
|
|
75
|
-
let o = "click", n = "Button", r =
|
|
70
|
+
let o = "click", n = "Button", r = f(e) || R(e) || i(e, "data-tooltip") || "";
|
|
76
71
|
if (t === "submit")
|
|
77
72
|
n = "Form", o = "submit", r = r || document.title;
|
|
78
73
|
else if (t === "toggle") {
|
|
@@ -80,25 +75,25 @@ function A({ type: t, target: a }) {
|
|
|
80
75
|
n = "Dialog", o = "open";
|
|
81
76
|
} else if (t === "change") {
|
|
82
77
|
const l = i(e, "type"), c = l === "checkbox" || l === "radio" ? e.closest("fieldset") : null;
|
|
83
|
-
n = "Form", o = "change", r =
|
|
78
|
+
n = e.closest(u) ? "Chip" : "Form", o = "change", r = f(c || e) || d(c?.querySelector("legend")) || d(e?.labels?.[0]);
|
|
84
79
|
} else if (i(e, "role") === "tab")
|
|
85
80
|
n = "Tab", o = "navigate";
|
|
86
81
|
else if (i(e, "popovertarget")) {
|
|
87
|
-
if (!
|
|
88
|
-
n = e.closest(
|
|
82
|
+
if (!B(e)?.matches(":popover-open")) return;
|
|
83
|
+
n = e.closest(v) ? "HelpText" : "Popover", o = "open";
|
|
89
84
|
} else if (e.nodeName.endsWith("SUMMARY")) {
|
|
90
85
|
if (!e.parentElement.open) return;
|
|
91
86
|
n = "Details", o = "open";
|
|
92
87
|
} else if (i(e, "data-command") === "toggle-app-expanded") {
|
|
93
|
-
const l =
|
|
88
|
+
const l = L(e, "--mtds-tooltip-position") === "none";
|
|
94
89
|
n = "Sidebar", o = l ? "expand" : "minimize", r = l && i(e, "data-tooltip") || d(e);
|
|
95
|
-
} else if (e.closest(
|
|
90
|
+
} else if (e.closest(k))
|
|
96
91
|
n = "Breadcrumbs", o = "navigate";
|
|
97
|
-
else if (e.closest(
|
|
92
|
+
else if (e.closest(T))
|
|
98
93
|
n = "Pagintation", o = "navigate";
|
|
99
|
-
else if (e.closest(
|
|
94
|
+
else if (e.closest(S))
|
|
100
95
|
n = "Card", o = e instanceof HTMLAnchorElement ? "navigate" : "click";
|
|
101
|
-
else if (e.closest(
|
|
96
|
+
else if (e.closest(u))
|
|
102
97
|
n = "Chip", o = e.hasAttribute("data-removable") ? "remove" : "click";
|
|
103
98
|
else if (e.closest("th[aria-sort]"))
|
|
104
99
|
n = "Table", o = "sort";
|
|
@@ -108,18 +103,18 @@ function A({ type: t, target: a }) {
|
|
|
108
103
|
if (i(e, "aria-expanded") !== "true") return;
|
|
109
104
|
n = "Expand", o = "open";
|
|
110
105
|
}
|
|
111
|
-
|
|
106
|
+
q("event", {
|
|
112
107
|
category: i(e, "data-analytics-category") ?? n,
|
|
113
108
|
action: i(e, "data-analytics-action") ?? o,
|
|
114
109
|
name: i(e, "data-analytics-name") ?? r
|
|
115
110
|
});
|
|
116
111
|
}
|
|
117
|
-
const d = (t) => t?.textContent?.trim() || "",
|
|
112
|
+
const d = (t) => t?.textContent?.trim() || "", f = (t) => t && i(t, "aria-label") || "", B = (t) => document.getElementById(i(t, "popovertarget") || ""), L = (t, a) => window.getComputedStyle(t).getPropertyValue(a)?.trim(), R = (t) => {
|
|
118
113
|
const a = d(t), e = d(t.querySelector("h1,h2,h3,h4,h5,h6"));
|
|
119
114
|
return a.startsWith(e) && e || a.slice(0, 100).trim();
|
|
120
115
|
};
|
|
121
|
-
w(() =>
|
|
116
|
+
w(() => y(document, C, A, _));
|
|
122
117
|
export {
|
|
123
|
-
|
|
118
|
+
q as analytics
|
|
124
119
|
};
|
|
125
120
|
//# sourceMappingURL=analytics.js.map
|
|
@@ -1 +1 @@
|
|
|
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_CARD = `.${styles.card.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\";\nconst BANNER = \"mtds-analytics-banner\"; // Dialog to show Matomo script loading\nconst BANNER_URL =\n\t\"https://www.mattilsynet.no/om-mattilsynet/personvernerklaering/informasjonskapsler\";\n\ntype Matomo = (\n\t| string\n\t| number\n\t| boolean\n\t| Document\n\t| Element\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\tconsent?: \"custom\" | true;\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 { consent, enabled, matomoId, matomoTagManagerId } =\n\t\t\twindow._mtdsTracking;\n\n\t\tif (matomoId) window._paq.push([\"setSiteId\", matomoId]);\n\t\tif (enabled) {\n\t\t\tif (consent !== \"custom\") renderBanner();\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\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\nfunction renderBanner() {\n\tconst hasSeenBanner =\n\t\tdocument.getElementById(BANNER) || window.localStorage.getItem(BANNER);\n\n\tif (hasSeenBanner) return;\n\n\tdocument.body.insertAdjacentHTML(\n\t\t\"afterbegin\",\n\t\t`<dialog id=\"${BANNER}\" data-analytics=\"ignore\"><style>\n\t\t\t\t#${BANNER}[open] { box-sizing: border-box; display: flex; align-items: center; background: #116e6b; border-radius: .5em; border: 0; box-shadow: 0 .25em .5em rgba(0,0,0,.3); color: #fff; font-size: .875em; inset: auto auto 1em 1em; max-width: calc(100vw - 2em); outline: 0; padding: .5em; position: fixed; z-index: 99999 }\n\t\t\t\t#${BANNER} button { all: unset; box-sizing: border-box; cursor: pointer; display: flex; width: 1.5em; height: 1.5em; font: 300 1.5em/1.35 sans-serif; border-radius: .25em; place-content: center; transition: .2s; transition-property: background, scale }\n\t\t\t\t#${BANNER} button:focus-visible { outline: 2px solid }\n\t\t\t\t#${BANNER} button:hover { background: #0a4e4f }\n\t\t\t\t#${BANNER} button:active { background: #054449; scale: .9 }\n\t\t\t\t#${BANNER} p { margin: 0 .25em }\n\t\t\t</style>\n\t\t\t<p>Vi bruker <a href=\"${BANNER_URL}\" target=\"_blank\">informasjonskapsler</a> for å forbedre brukeropplevelsen.</p>\n\t\t\t<form method=\"dialog\" data-analytics=\"ignore\"><button type=\"submit\" aria-label=\"OK\">×</button></form>\n\t\t</dialog>`,\n\t);\n\tconst banner = document.getElementById(BANNER) as HTMLDialogElement;\n\tconst onClose = () => window.localStorage.setItem(BANNER, \"seen\");\n\tbanner.addEventListener(\"close\", onClose, { once: true });\n\tbanner.show();\n}\n\nfunction handleTrack(event: Event) {\n\tif (window._mtdsTracking?.enabled) setTimeout(processTrack, 0, event); // Let other events process first\n}\n\nfunction processTrack({ type, target }: Event) {\n\tconst el = type === \"click\" ? (target as Element)?.closest?.(CLICKS) : target;\n\tif (!(el instanceof Element) || el.closest('[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_CARD)) {\n\t\tcategory = \"Card\";\n\t\taction = el instanceof HTMLAnchorElement ? \"navigate\" : \"click\";\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_CARD","CSS_CHIP","CSS_HELPTEXT","CSS_PAGINATION","CLICKS","EVENTS","MATOMO","BANNER","BANNER_URL","analytics","action","args","IS_BROWSER","consent","enabled","matomoId","matomoTagManagerId","renderBanner","src","url","title","category","name","value","event","v","query","results","banner","onClose","handleTrack","processTrack","type","target","el","label","heading","attr","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,IAAW,IAAIF,EAAO,KAAK,MAAM,GAAG,EAAE,CAAC,CAAC,IACxCG,IAAe,IAAIH,EAAO,SAAS,MAAM,GAAG,EAAE,CAAC,CAAC,IAChDI,IAAiB,IAAIJ,EAAO,W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AAQgB,EAAKH,GAAI,uBAAuB,KAAKxB;AAAA,IAC7C,MAAM2B,EAAKH,GAAI,qBAAqB,KAAKZ;AAAA,EAAA,CACzC;AACF;AAGA,MAAMiB,IAAO,CAACL,MAAwBA,GAAI,aAAa,UAAU,IAC3DC,IAAQ,CAACD,MAAyBA,KAAMG,EAAKH,GAAI,YAAY,KAAM,IACnEM,IAAU,CAACN,MAChB,SAAS,eAAeG,EAAKH,GAAI,eAAe,KAAK,EAAE,GAClDQ,IAAQ,CAACR,GAAaS,MAC3B,OAAO,iBAAiBT,CAAE,EAAE,iBAAiBS,CAAG,GAAG,KAAA,GAC9CP,IAAU,CAACF,MAAgB;AAChC,QAAMU,IAAOL,EAAKL,CAAE,GACdW,IAAON,EAAKL,EAAG,cAAc,mBAAmB,CAAC;AACvD,SAAQU,EAAK,WAAWC,CAAI,KAAKA,KAASD,EAAK,MAAM,GAAG,GAAG,EAAE,KAAA;AAC9D;AAEAE,EAAS,MAAMC,EAAG,UAAU1C,GAAQyB,GAAakB,CAAW,CAAC;"}
|
|
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, tag } from \"../utils\";\n\nconst CSS_BREADCRUMBS = `.${styles.breadcrumbs.split(\" \")[0]}`;\nconst CSS_CARD = `.${styles.card.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\";\nconst BANNER = \"mtds-analytics-banner\"; // Dialog to show Matomo script loading\nconst BANNER_URL =\n\t\"https://www.mattilsynet.no/om-mattilsynet/personvernerklaering/informasjonskapsler\";\n\ntype Matomo = (\n\t| string\n\t| number\n\t| boolean\n\t| Document\n\t| Element\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\tconsent?: \"custom\" | true;\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 { consent, enabled, matomoId, matomoTagManagerId } =\n\t\t\twindow._mtdsTracking;\n\n\t\tif (matomoId) window._paq.push([\"setSiteId\", matomoId]);\n\t\tif (enabled) {\n\t\t\tif (consent !== \"custom\") renderBanner();\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\n\t\t\tdocument.querySelector(`script[src=\"${src}\"]`) ||\n\t\t\t\tdocument.head.append(tag(\"script\", { async: \"\", src }));\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\nfunction renderBanner() {\n\tconst hasSeenBanner =\n\t\tdocument.getElementById(BANNER) || window.localStorage.getItem(BANNER);\n\n\tif (hasSeenBanner) return;\n\n\tdocument.body.insertAdjacentHTML(\n\t\t\"afterbegin\",\n\t\t`<dialog id=\"${BANNER}\" data-analytics=\"ignore\"><style>\n\t\t\t\t#${BANNER}[open] { box-sizing: border-box; display: flex; align-items: center; background: #116e6b; border-radius: .5em; border: 0; box-shadow: 0 .25em .5em rgba(0,0,0,.3); color: #fff; font-size: .875em; inset: auto auto 1em 1em; max-width: calc(100vw - 2em); outline: 0; padding: .5em; position: fixed; z-index: 99999 }\n\t\t\t\t#${BANNER} button { all: unset; box-sizing: border-box; cursor: pointer; display: flex; width: 1.5em; height: 1.5em; font: 300 1.5em/1.35 sans-serif; border-radius: .25em; place-content: center; transition: .2s; transition-property: background, scale }\n\t\t\t\t#${BANNER} button:focus-visible { outline: 2px solid }\n\t\t\t\t#${BANNER} button:hover { background: #0a4e4f }\n\t\t\t\t#${BANNER} button:active { background: #054449; scale: .9 }\n\t\t\t\t#${BANNER} p { margin: 0 .25em }\n\t\t\t</style>\n\t\t\t<p>Vi bruker <a href=\"${BANNER_URL}\" target=\"_blank\">informasjonskapsler</a> for å forbedre brukeropplevelsen.</p>\n\t\t\t<form method=\"dialog\" data-analytics=\"ignore\"><button type=\"submit\" aria-label=\"OK\">×</button></form>\n\t\t</dialog>`,\n\t);\n\tconst banner = document.getElementById(BANNER) as HTMLDialogElement;\n\tconst onClose = () => window.localStorage.setItem(BANNER, \"seen\");\n\tbanner.addEventListener(\"close\", onClose, { once: true });\n\tbanner.show();\n}\n\nfunction handleTrack(event: Event) {\n\tif (window._mtdsTracking?.enabled) setTimeout(processTrack, 0, event); // Let other events process first\n}\n\nfunction processTrack({ type, target }: Event) {\n\tconst el = type === \"click\" ? (target as Element)?.closest?.(CLICKS) : target;\n\tif (!(el instanceof Element) || el.closest('[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 = el.closest(CSS_CHIP) ? \"Chip\" : \"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_CARD)) {\n\t\tcategory = \"Card\";\n\t\taction = el instanceof HTMLAnchorElement ? \"navigate\" : \"click\";\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_CARD","CSS_CHIP","CSS_HELPTEXT","CSS_PAGINATION","CLICKS","EVENTS","MATOMO","BANNER","BANNER_URL","analytics","action","args","IS_BROWSER","consent","enabled","matomoId","matomoTagManagerId","renderBanner","src","tag","url","title","category","name","value","event","v","query","results","banner","onClose","handleTrack","processTrack","type","target","el","label","heading","attr","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,IAAW,IAAIF,EAAO,KAAK,MAAM,GAAG,EAAE,CAAC,CAAC,IACxCG,IAAe,IAAIH,EAAO,SAAS,MAAM,GAAG,EAAE,CAAC,CAAC,IAChDI,IAAiB,IAAIJ,EAAO,WAAW,MAAM,GAAG,EAAE,CAAC,CAAC,IACpDK,IAAS,2DACTC,IAAS,8BACTC,IAAS,4BACTC,IAAS,yBACTC,IACL;AAmDM,SAASC,EACfC,GACAC,IAAO,IACN;AACD,MAAKC,GAYL;AAAA,QAXK,OAAO,SACX,OAAO,OAAO,CAAA,GACd,OAAO,KAAK,KAAK,CAAC,kCAAkC,CAAC,GACrD,OAAO,KAAK,KAAK,CAAC,oBAAoB,CAAC,GACvC,OAAO,KAAK,KAAK,CAAC,iBAAiB,WAAWN,CAAM,aAAa,CAAC,IAE9D,OAAO,SACX,OAAO,OAAO,OAAO,QAAQ,CAAA,GAC7B,OAAO,KAAK,KAAK,EAAE,iBAAiB,KAAK,IAAA,GAAO,OAAO,aAAa,IAGjEI,MAAW,QAAQ;AACtB,aAAO,gBAAgB;AAAA,QACtB,SAAS,OAAO,SAAS,aAAa;AAAA,QACtC,GAAG,OAAO;AAAA,QACV,GAAGC;AAAA,MAAA;AAEJ,YAAM,EAAE,SAAAE,GAAS,SAAAC,GAAS,UAAAC,GAAU,oBAAAC,EAAA,IACnC,OAAO;AAGR,UADID,KAAU,OAAO,KAAK,KAAK,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7
7
|
import "../breadcrumbs/breadcrumbs.js";
|
|
8
8
|
import { Button as s } from "../button/button.js";
|
|
9
9
|
import "../card/card.js";
|
|
10
|
+
import "../chart/chart.js";
|
|
10
11
|
import "../chip/chip.js";
|
|
11
12
|
import "../details/details.js";
|
|
12
13
|
import "../dialog/dialog.js";
|
|
@@ -38,7 +39,7 @@ const f = p(function({ as: t, className: r, ...m }, n) {
|
|
|
38
39
|
return /* @__PURE__ */ o(t || "div", { className: e(a.app, r), ref: n, ...m });
|
|
39
40
|
}), u = p(function({ as: t, className: r, ...m }, n) {
|
|
40
41
|
return /* @__PURE__ */ o(t || "div", { className: e(a.sticky, r), ref: n, ...m });
|
|
41
|
-
}),
|
|
42
|
+
}), Z = Object.assign(f, {
|
|
42
43
|
Header: p(
|
|
43
44
|
function(t, r) {
|
|
44
45
|
return /* @__PURE__ */ o("header", { ref: r, ...t });
|
|
@@ -76,6 +77,6 @@ const f = p(function({ as: t, className: r, ...m }, n) {
|
|
|
76
77
|
Script: () => /* @__PURE__ */ o("script", { id: "mtds-app-script", children: d })
|
|
77
78
|
});
|
|
78
79
|
export {
|
|
79
|
-
|
|
80
|
+
Z as App
|
|
80
81
|
};
|
|
81
82
|
//# sourceMappingURL=app.js.map
|
package/mtds/app/app.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sources":["../../designsystem/app/app.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef, type JSX } from \"react\";\nimport { Button, type ButtonProps } from \"../react\";\nimport type {\n\tPolymorphicComponentPropWithRef,\n\tPolymorphicRef,\n} from \"../react-types\";\nimport styles from \"../styles.module.css\";\nimport script from \"./app-toggle.js?raw\";\n\nexport type AppHeaderProps = React.ComponentPropsWithoutRef<\"header\">;\nexport type AppSidebarProps = React.ComponentPropsWithoutRef<\"dialog\">;\nexport type AppStickyProps = React.ComponentPropsWithoutRef<\"div\">;\nexport type AppMainProps = React.ComponentPropsWithoutRef<\"main\">;\nexport type AppFooterProps = React.ComponentPropsWithoutRef<\"footer\">;\nexport type AppProps<As extends React.ElementType = \"div\"> =\n\tPolymorphicComponentPropWithRef<As>;\n\ntype AppComponent = <As extends React.ElementType = \"div\">(\n\tprops: AppProps<As>,\n) => JSX.Element;\n\nconst AppComp = forwardRef<null>(function App<\n\tAs extends React.ElementType = \"div\",\n>({ as, className, ...rest }: AppProps<As>, ref?: PolymorphicRef<As>) {\n\tconst Tag = as || \"div\";\n\n\treturn <Tag className={clsx(styles.app, className)} ref={ref} {...rest} />;\n}) as AppComponent; // Needed to tell Typescript this does not return ReactNode but acutally JSX.Element\n\nconst AppSticky = forwardRef<null>(function App<\n\tAs extends React.ElementType = \"div\",\n>({ as, className, ...rest }: AppProps<As>, ref?: PolymorphicRef<As>) {\n\tconst Tag = as || \"div\";\n\n\treturn <Tag className={clsx(styles.sticky, className)} ref={ref} {...rest} />;\n}) as AppComponent; // Needed to tell Typescript this does not return ReactNode but acutally JSX.Element\n\nexport const App = Object.assign(AppComp, {\n\tHeader: forwardRef<HTMLElement, AppHeaderProps>(\n\t\tfunction AppHeader(rest, ref) {\n\t\t\treturn <header ref={ref} {...rest} />;\n\t\t},\n\t),\n\tSidebar: forwardRef<HTMLDialogElement, AppSidebarProps>(\n\t\tfunction AppSidebar(rest, ref) {\n\t\t\treturn <dialog role=\"navigation\" ref={ref} {...rest} />;\n\t\t},\n\t),\n\tSticky: AppSticky,\n\tToggle: forwardRef<HTMLButtonElement, ButtonProps<\"button\">>(\n\t\tfunction AppToggle({ children, ...rest }: ButtonProps<\"button\">, ref) {\n\t\t\treturn (\n\t\t\t\t<Button\n\t\t\t\t\tdata-command=\"toggle-app-expanded\"\n\t\t\t\t\tdata-tooltip=\"Vis meny\"\n\t\t\t\t\tref={ref as React.Ref<HTMLAnchorElement>}\n\t\t\t\t\t{...rest}\n\t\t\t\t>\n\t\t\t\t\t{children ?? \"Skjul meny\"}\n\t\t\t\t</Button>\n\t\t\t);\n\t\t},\n\t),\n\tMain: forwardRef<HTMLElement, AppMainProps>(function AppMain(rest, ref) {\n\t\treturn <main ref={ref} {...rest} />;\n\t}),\n\tFooter: forwardRef<HTMLElement, AppFooterProps>(\n\t\tfunction AppFooter(rest, ref) {\n\t\t\treturn <footer ref={ref} {...rest} />;\n\t\t},\n\t),\n\t// Needed to avoid flash of unstyled content and still be Next.js hydration compatible\n\tScript: () => <script id=\"mtds-app-script\">{script}</script>,\n});\n"],"names":["AppComp","forwardRef","as","className","rest","ref","jsx","clsx","styles","AppSticky","App","children","Button","script"],"mappings":"
|
|
1
|
+
{"version":3,"file":"app.js","sources":["../../designsystem/app/app.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef, type JSX } from \"react\";\nimport { Button, type ButtonProps } from \"../react\";\nimport type {\n\tPolymorphicComponentPropWithRef,\n\tPolymorphicRef,\n} from \"../react-types\";\nimport styles from \"../styles.module.css\";\nimport script from \"./app-toggle.js?raw\";\n\nexport type AppHeaderProps = React.ComponentPropsWithoutRef<\"header\">;\nexport type AppSidebarProps = React.ComponentPropsWithoutRef<\"dialog\">;\nexport type AppStickyProps = React.ComponentPropsWithoutRef<\"div\">;\nexport type AppMainProps = React.ComponentPropsWithoutRef<\"main\">;\nexport type AppFooterProps = React.ComponentPropsWithoutRef<\"footer\">;\nexport type AppProps<As extends React.ElementType = \"div\"> =\n\tPolymorphicComponentPropWithRef<As>;\n\ntype AppComponent = <As extends React.ElementType = \"div\">(\n\tprops: AppProps<As>,\n) => JSX.Element;\n\nconst AppComp = forwardRef<null>(function App<\n\tAs extends React.ElementType = \"div\",\n>({ as, className, ...rest }: AppProps<As>, ref?: PolymorphicRef<As>) {\n\tconst Tag = as || \"div\";\n\n\treturn <Tag className={clsx(styles.app, className)} ref={ref} {...rest} />;\n}) as AppComponent; // Needed to tell Typescript this does not return ReactNode but acutally JSX.Element\n\nconst AppSticky = forwardRef<null>(function App<\n\tAs extends React.ElementType = \"div\",\n>({ as, className, ...rest }: AppProps<As>, ref?: PolymorphicRef<As>) {\n\tconst Tag = as || \"div\";\n\n\treturn <Tag className={clsx(styles.sticky, className)} ref={ref} {...rest} />;\n}) as AppComponent; // Needed to tell Typescript this does not return ReactNode but acutally JSX.Element\n\nexport const App = Object.assign(AppComp, {\n\tHeader: forwardRef<HTMLElement, AppHeaderProps>(\n\t\tfunction AppHeader(rest, ref) {\n\t\t\treturn <header ref={ref} {...rest} />;\n\t\t},\n\t),\n\tSidebar: forwardRef<HTMLDialogElement, AppSidebarProps>(\n\t\tfunction AppSidebar(rest, ref) {\n\t\t\treturn <dialog role=\"navigation\" ref={ref} {...rest} />;\n\t\t},\n\t),\n\tSticky: AppSticky,\n\tToggle: forwardRef<HTMLButtonElement, ButtonProps<\"button\">>(\n\t\tfunction AppToggle({ children, ...rest }: ButtonProps<\"button\">, ref) {\n\t\t\treturn (\n\t\t\t\t<Button\n\t\t\t\t\tdata-command=\"toggle-app-expanded\"\n\t\t\t\t\tdata-tooltip=\"Vis meny\"\n\t\t\t\t\tref={ref as React.Ref<HTMLAnchorElement>}\n\t\t\t\t\t{...rest}\n\t\t\t\t>\n\t\t\t\t\t{children ?? \"Skjul meny\"}\n\t\t\t\t</Button>\n\t\t\t);\n\t\t},\n\t),\n\tMain: forwardRef<HTMLElement, AppMainProps>(function AppMain(rest, ref) {\n\t\treturn <main ref={ref} {...rest} />;\n\t}),\n\tFooter: forwardRef<HTMLElement, AppFooterProps>(\n\t\tfunction AppFooter(rest, ref) {\n\t\t\treturn <footer ref={ref} {...rest} />;\n\t\t},\n\t),\n\t// Needed to avoid flash of unstyled content and still be Next.js hydration compatible\n\tScript: () => <script id=\"mtds-app-script\">{script}</script>,\n});\n"],"names":["AppComp","forwardRef","as","className","rest","ref","jsx","clsx","styles","AppSticky","App","children","Button","script"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAMA,IAAUC,EAAiB,SAE/B,EAAE,IAAAC,GAAI,WAAAC,GAAW,GAAGC,EAAA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AAA,CAAM;AAAA,IACpC;AAAA,EAAA;AAAA;AAAA,EAGD,QAAQ,MAAM,gBAAAE,EAAC,UAAA,EAAO,IAAG,mBAAmB,UAAAO,EAAA,CAAO;AACpD,CAAC;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { tag as r } from "../utils.js";
|
|
2
|
+
function b(t, { type: d }) {
|
|
3
|
+
const g = d === "stacked", o = t[0].reduce((a, u, x) => {
|
|
4
|
+
const m = t.map((i) => i[x].number), v = m.reduce((i, f) => i + f, 0);
|
|
5
|
+
return Math.max(a, ...g ? [v] : m);
|
|
6
|
+
}, 0), n = 10 ** (`${~~o}`.length - 1), s = o / n < 5 ? n / 2 : n, l = Math.ceil(o / s) * s, p = r("div", { class: "axisGroups" }), c = r("div");
|
|
7
|
+
c.classList.add("axisSteps"), c.append(
|
|
8
|
+
...Array.from({ length: l / s + 1 }, (a, u) => h(s * u)).reverse().map((a) => r("div", { class: "axisStep", "data-label": a }))
|
|
9
|
+
);
|
|
10
|
+
const e = r("div", {
|
|
11
|
+
"aria-label": t[0][0].value || null,
|
|
12
|
+
class: "axis",
|
|
13
|
+
role: "figure"
|
|
14
|
+
});
|
|
15
|
+
return e.style.setProperty("--groups", `${t.length - 1}`), e.style.setProperty("--total", `${l}`), e.append(c, p), { total: l, groups: p, axis: e };
|
|
16
|
+
}
|
|
17
|
+
const h = new Intl.NumberFormat().format;
|
|
18
|
+
export {
|
|
19
|
+
b as toAxis
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=chart-axis.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart-axis.js","sources":["../../designsystem/chart/chart-axis.ts"],"sourcesContent":["import { tag } from \"../utils\";\nimport type { ChartData } from \"./chart-element\";\n\ntype Config = { type: string };\n\nexport function toAxis(data: ChartData, { type }: Config) {\n\tconst isStacked = type === \"stacked\";\n\tconst max = data[0].reduce((acc, _, index) => {\n\t\tconst all = data.map((row) => row[index].number);\n\t\tconst sum = all.reduce((acc, num) => acc + num, 0);\n\t\treturn Math.max(acc, ...(isStacked ? [sum] : all));\n\t}, 0);\n\n\tconst digits = 10 ** (`${~~max}`.length - 1); // Get amount of digits in total number\n\tconst step = max / digits < 5 ? digits / 2 : digits; // If we get less than 5 steps, make smaller steps\n\tconst total = Math.ceil(max / step) * step;\n\tconst groups = tag(\"div\", { class: \"axisGroups\" });\n\tconst steps = tag(\"div\");\n\n\tsteps.classList.add(\"axisSteps\");\n\tsteps.append(\n\t\t...Array.from({ length: total / step + 1 }, (_, i) => getNum(step * i))\n\t\t\t.reverse()\n\t\t\t.map((num) => tag(\"div\", { class: \"axisStep\", \"data-label\": num })),\n\t);\n\n\tconst axis = tag(\"div\", {\n\t\t\"aria-label\": data[0][0].value || null,\n\t\tclass: \"axis\",\n\t\trole: \"figure\",\n\t});\n\taxis.style.setProperty(\"--groups\", `${data.length - 1}`);\n\taxis.style.setProperty(\"--total\", `${total}`);\n\taxis.append(steps, groups);\n\n\treturn { total, groups, axis };\n}\n\nconst getNum = new Intl.NumberFormat().format;\n"],"names":["toAxis","data","type","isStacked","max","acc","_","index","all","row","sum","num","digits","step","total","groups","tag","steps","i","getNum","axis"],"mappings":";AAKO,SAASA,EAAOC,GAAiB,EAAE,MAAAC,KAAgB;AACzD,QAAMC,IAAYD,MAAS,WACrBE,IAAMH,EAAK,CAAC,EAAE,OAAO,CAACI,GAAKC,GAAGC,MAAU;AAC7C,UAAMC,IAAMP,EAAK,IAAI,CAACQ,MAAQA,EAAIF,CAAK,EAAE,MAAM,GACzCG,IAAMF,EAAI,OAAO,CAACH,GAAKM,MAAQN,IAAMM,GAAK,CAAC;AACjD,WAAO,KAAK,IAAIN,GAAK,GAAIF,IAAY,CAACO,CAAG,IAAIF,CAAI;AAAA,EAClD,GAAG,CAAC,GAEEI,IAAS,OAAO,GAAG,CAAC,CAACR,CAAG,GAAG,SAAS,IACpCS,IAAOT,IAAMQ,IAAS,IAAIA,IAAS,IAAIA,GACvCE,IAAQ,KAAK,KAAKV,IAAMS,CAAI,IAAIA,GAChCE,IAASC,EAAI,OAAO,EAAE,OAAO,cAAc,GAC3CC,IAAQD,EAAI,KAAK;AAEvB,EAAAC,EAAM,UAAU,IAAI,WAAW,GAC/BA,EAAM;AAAA,IACL,GAAG,MAAM,KAAK,EAAE,QAAQH,IAAQD,IAAO,EAAA,GAAK,CAACP,GAAGY,MAAMC,EAAON,IAAOK,CAAC,CAAC,EACpE,QAAA,EACA,IAAI,CAACP,MAAQK,EAAI,OAAO,EAAE,OAAO,YAAY,cAAcL,EAAA,CAAK,CAAC;AAAA,EAAA;AAGpE,QAAMS,IAAOJ,EAAI,OAAO;AAAA,IACvB,cAAcf,EAAK,CAAC,EAAE,CAAC,EAAE,SAAS;AAAA,IAClC,OAAO;AAAA,IACP,MAAM;AAAA,EAAA,CACN;AACD,SAAAmB,EAAK,MAAM,YAAY,YAAY,GAAGnB,EAAK,SAAS,CAAC,EAAE,GACvDmB,EAAK,MAAM,YAAY,WAAW,GAAGN,CAAK,EAAE,GAC5CM,EAAK,OAAOH,GAAOF,CAAM,GAElB,EAAE,OAAAD,GAAO,QAAAC,GAAQ,MAAAK,EAAA;AACzB;AAEA,MAAMD,IAAS,IAAI,KAAK,aAAA,EAAe;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { tag as e } from "../utils.js";
|
|
2
|
+
function d(t) {
|
|
3
|
+
return t[0].slice(1).map(({ value: l, event: n }, r) => {
|
|
4
|
+
const i = e("div", { class: "axisGroup", "data-label": l }), s = i.appendChild(
|
|
5
|
+
e("div", { class: "axisGroupContent" })
|
|
6
|
+
);
|
|
7
|
+
return t.slice(1).map((a) => a[r + 1]).map(
|
|
8
|
+
({ tooltip: a, style: o, number: p }) => s.appendChild(
|
|
9
|
+
e("div", {
|
|
10
|
+
"aria-label": a,
|
|
11
|
+
"data-event": n,
|
|
12
|
+
class: "bar",
|
|
13
|
+
role: "img",
|
|
14
|
+
style: `${o}; --value: ${p}`,
|
|
15
|
+
tabindex: "0"
|
|
16
|
+
})
|
|
17
|
+
)
|
|
18
|
+
), i;
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
d as toBars
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=chart-bars.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart-bars.js","sources":["../../designsystem/chart/chart-bars.ts"],"sourcesContent":["import { tag } from \"../utils\";\nimport type { ChartData } from \"./chart-element\";\n\nexport function toBars(data: ChartData) {\n\treturn data[0].slice(1).map(({ value, event }, index) => {\n\t\tconst group = tag(\"div\", { class: \"axisGroup\", \"data-label\": value });\n\t\tconst content = group.appendChild(\n\t\t\ttag(\"div\", { class: \"axisGroupContent\" }),\n\t\t);\n\n\t\tdata\n\t\t\t.slice(1)\n\t\t\t.map((values) => values[index + 1])\n\t\t\t.map(({ tooltip, style, number }) =>\n\t\t\t\tcontent.appendChild(\n\t\t\t\t\ttag(\"div\", {\n\t\t\t\t\t\t\"aria-label\": tooltip,\n\t\t\t\t\t\t\"data-event\": event,\n\t\t\t\t\t\tclass: \"bar\",\n\t\t\t\t\t\trole: \"img\",\n\t\t\t\t\t\tstyle: `${style}; --value: ${number}`,\n\t\t\t\t\t\ttabindex: \"0\",\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t);\n\t\treturn group;\n\t});\n}\n"],"names":["toBars","data","value","event","index","group","tag","content","values","tooltip","style","number"],"mappings":";AAGO,SAASA,EAAOC,GAAiB;AACvC,SAAOA,EAAK,CAAC,EAAE,MAAM,CAAC,EAAE,IAAI,CAAC,EAAE,OAAAC,GAAO,OAAAC,EAAA,GAASC,MAAU;AACxD,UAAMC,IAAQC,EAAI,OAAO,EAAE,OAAO,aAAa,cAAcJ,GAAO,GAC9DK,IAAUF,EAAM;AAAA,MACrBC,EAAI,OAAO,EAAE,OAAO,oBAAoB;AAAA,IAAA;AAGzC,WAAAL,EACE,MAAM,CAAC,EACP,IAAI,CAACO,MAAWA,EAAOJ,IAAQ,CAAC,CAAC,EACjC;AAAA,MAAI,CAAC,EAAE,SAAAK,GAAS,OAAAC,GAAO,QAAAC,EAAA,MACvBJ,EAAQ;AAAA,QACPD,EAAI,OAAO;AAAA,UACV,cAAcG;AAAA,UACd,cAAcN;AAAA,UACd,OAAO;AAAA,UACP,MAAM;AAAA,UACN,OAAO,GAAGO,CAAK,cAAcC,CAAM;AAAA,UACnC,UAAU;AAAA,QAAA,CACV;AAAA,MAAA;AAAA,IACF,GAEKN;AAAA,EACR,CAAC;AACF;"}
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
new (): HTMLElement;
|
|
4
|
-
prototype: HTMLElement;
|
|
5
|
-
};
|
|
6
|
-
export type ReactChart = ReactTypes.JSX.IntrinsicElements["div"] & {
|
|
7
|
-
class?: string;
|
|
8
|
-
};
|
|
9
|
-
declare global {
|
|
10
|
-
namespace React.JSX {
|
|
11
|
-
interface IntrinsicElements {
|
|
12
|
-
"mtds-chart": ReactChart;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
1
|
+
import { MTDSElement } from '../utils';
|
|
2
|
+
export type ChartData = ReturnType<typeof toData>;
|
|
16
3
|
export declare class MTDSChart extends MTDSElement {
|
|
4
|
+
_observer?: MutationObserver;
|
|
5
|
+
static get observedAttributes(): string[];
|
|
17
6
|
constructor();
|
|
18
7
|
connectedCallback(): void;
|
|
8
|
+
disconnectedCallback(): void;
|
|
9
|
+
attributeChangedCallback(): void;
|
|
10
|
+
handleEvent(e: Event): void;
|
|
19
11
|
}
|
|
12
|
+
declare const toData: (table?: HTMLTableElement | null) => {
|
|
13
|
+
number: number;
|
|
14
|
+
event: string | null;
|
|
15
|
+
style: string;
|
|
16
|
+
value: string;
|
|
17
|
+
tooltip: string;
|
|
18
|
+
}[][];
|
|
20
19
|
export {};
|
|
@@ -1,111 +1,73 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import g from "../styles.module.css.js";
|
|
2
|
+
import { IS_BROWSER as b, tag as c, MTDSElement as C, on as E, off as k, attr as d } from "../utils.js";
|
|
3
|
+
import T from "./chart.css.js";
|
|
4
|
+
import { toAxis as w } from "./chart-axis.js";
|
|
5
|
+
import { toBars as S } from "./chart-bars.js";
|
|
6
|
+
import { toLines as _ } from "./chart-lines.js";
|
|
7
|
+
import { toPies as O } from "./chart-pies.js";
|
|
8
|
+
const h = "click,keydown,mousemove,mouseout", p = "mtds-chart-tooltip", a = b ? document.getElementById(p) || c("div", { class: g._tooltip, id: p, hidden: "" }) : null;
|
|
9
|
+
class $ extends C {
|
|
10
|
+
_observer;
|
|
11
|
+
// Using underscore instead of # for backwards compatibility
|
|
12
|
+
static get observedAttributes() {
|
|
13
|
+
return ["data-variant"];
|
|
14
|
+
}
|
|
6
15
|
constructor() {
|
|
7
16
|
super(), this.attachShadow({ mode: "open" });
|
|
8
17
|
}
|
|
9
18
|
connectedCallback() {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}),
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
style: `--value: ${i[m]}`,
|
|
35
|
-
tabindex: "0",
|
|
36
|
-
title: `${i[0]}: ${i[m]}`
|
|
37
|
-
})
|
|
38
|
-
);
|
|
39
|
-
});
|
|
40
|
-
}), l === "line" || l === "area") {
|
|
41
|
-
const p = d("div", { class: "axisGroup" });
|
|
42
|
-
t.slice(1).forEach(([m, ...h], e) => {
|
|
43
|
-
const r = d("div", {
|
|
44
|
-
class: `lineContainer color-${e + 1}`,
|
|
45
|
-
role: "list"
|
|
46
|
-
}), i = document.createElementNS(M, "svg");
|
|
47
|
-
a(i, "aria-hidden", "true"), a(i, "preserveAspectRatio", "none"), a(i, "viewBox", "0 0 100 100");
|
|
48
|
-
const $ = V(
|
|
49
|
-
h.map((g, x, { length: w }) => [
|
|
50
|
-
100 / (w - 1) * x,
|
|
51
|
-
100 - Number(g) / N.total * 100
|
|
52
|
-
]),
|
|
53
|
-
H / 100
|
|
54
|
-
), u = document.createElementNS(M, "path");
|
|
55
|
-
a(u, "class", "line"), a(u, "d", $), a(u, "fill", "none"), a(u, "stroke", "currentColor");
|
|
56
|
-
const f = u.cloneNode(!0);
|
|
57
|
-
if (a(f, "class", "lineBorder"), l === "area") {
|
|
58
|
-
const g = u.cloneNode(!0);
|
|
59
|
-
a(g, "d", `M-100,100 L${$.slice(1)}L200,100`), a(g, "class", "lineShade"), i.append(g);
|
|
60
|
-
}
|
|
61
|
-
h.forEach((g, x) => {
|
|
62
|
-
const w = d("div", { role: "listitem" });
|
|
63
|
-
w.appendChild(
|
|
64
|
-
d("div", {
|
|
65
|
-
"aria-describedby": L[e],
|
|
66
|
-
tabindex: "0",
|
|
67
|
-
title: `${t[0][x + 1]}: ${g} (${m})`,
|
|
68
|
-
class: "linePoint",
|
|
69
|
-
role: "img",
|
|
70
|
-
style: `--value: ${g}`
|
|
71
|
-
})
|
|
72
|
-
), r.append(w);
|
|
73
|
-
}), i.append(f, u), r.append(i), p.append(r);
|
|
74
|
-
}), S.append(p);
|
|
75
|
-
}
|
|
76
|
-
if (l === "doughnut") {
|
|
77
|
-
const p = document.createElementNS(M, "svg"), m = t.slice(1).reduce((i, [, $]) => i + Number($), 0);
|
|
78
|
-
a(p, "class", "doughnut"), a(p, "viewBox", "0 0 100 100");
|
|
79
|
-
let h = 0;
|
|
80
|
-
const e = 50, r = 25;
|
|
81
|
-
t.slice(1).forEach(([i, $], u) => {
|
|
82
|
-
const f = document.createElementNS(M, "path"), g = h / m;
|
|
83
|
-
h += Number($);
|
|
84
|
-
const x = h / m, w = x - g > 0.5 ? 1 : 0, R = 2 * Math.PI * (g - 0.25), B = 2 * Math.PI * (x - 0.25), C = Math.cos(R), A = Math.sin(R), T = Math.cos(B), G = Math.sin(B), X = `M ${e + r * C} ${e + r * A} L ${e + e * C} ${e + e * A} A ${e} ${e} 0 ${w} 1 ${e + e * T} ${e + e * G} L ${e + r * T} ${e + r * G} A ${r} ${r} 0 ${w} 0 ${e + r * C} ${e + r * A}`;
|
|
85
|
-
a(f, "aria-describedby", L[u]), a(f, "class", `color-${u + 1}`), a(f, "d", X), a(f, "role", "img"), a(f, "tabindex", "0"), a(f, "title", i || null), p.appendChild(f), this.shadowRoot?.append(p);
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
l !== "doughnut" && this.shadowRoot?.append(y), P.append(...k), this.shadowRoot?.append(O, P);
|
|
19
|
+
this._observer = new MutationObserver(
|
|
20
|
+
this.attributeChangedCallback.bind(this)
|
|
21
|
+
), this._observer.observe(this, {
|
|
22
|
+
attributeFilter: ["data-tooltip"],
|
|
23
|
+
attributes: !0,
|
|
24
|
+
characterData: !0,
|
|
25
|
+
childList: !0,
|
|
26
|
+
subtree: !0
|
|
27
|
+
}), this.attributeChangedCallback(), E(this, h, this);
|
|
28
|
+
}
|
|
29
|
+
disconnectedCallback() {
|
|
30
|
+
a && (a.hidden = !0), k(this, h, this), this._observer?.disconnect(), this._observer = void 0;
|
|
31
|
+
}
|
|
32
|
+
attributeChangedCallback() {
|
|
33
|
+
Array.from(this.shadowRoot?.children || []).map((l) => l.remove());
|
|
34
|
+
const e = x(this.querySelector("table")), [t, s] = (d(this, "data-variant") || "bar").split("-"), r = c("style", {}, T), n = c("div", { class: "legends" });
|
|
35
|
+
e.slice(1).forEach(([{ value: l, style: v }]) => {
|
|
36
|
+
n.appendChild(c("div", { class: "legend", style: v }, l));
|
|
37
|
+
});
|
|
38
|
+
const { axis: f, groups: m, total: y } = w(e, { type: s });
|
|
39
|
+
(t === "bar" || t === "column") && m.append(...S(e)), (t === "line" || t === "area") && m.append(_(e, { total: y, variant: t, type: s })), (t === "doughnut" || t === "pie") && this.shadowRoot?.append(O(e, { variant: t })), this.shadowRoot?.append(r, f, n);
|
|
40
|
+
}
|
|
41
|
+
handleEvent(e) {
|
|
42
|
+
e.type === "click" || e.type === "keydown" ? A(e, this) : P(e);
|
|
89
43
|
}
|
|
90
44
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
45
|
+
function A(o, e) {
|
|
46
|
+
if (o instanceof KeyboardEvent && o.key !== "Enter") return;
|
|
47
|
+
const t = o.composedPath()[0], s = e.querySelector("table"), [r, n] = t instanceof Element && d(t, "data-event")?.split("-").map(Number) || [];
|
|
48
|
+
s?.rows[r]?.cells[n]?.querySelector("a,button")?.click?.();
|
|
49
|
+
}
|
|
50
|
+
let u = "";
|
|
51
|
+
function P(o) {
|
|
52
|
+
if (!a) return;
|
|
53
|
+
a?.isConnected || document.body.append(a);
|
|
54
|
+
const e = o.composedPath()[0], t = e instanceof Element && e.getAttribute("aria-label") || "";
|
|
55
|
+
t && (a.style.transform = `translate(${o.pageX}px, ${o.pageY}px)`), t !== u && (t && (a.textContent = t), u = t, a.hidden = !t);
|
|
56
|
+
}
|
|
57
|
+
const i = (o) => o?.textContent?.trim() || "", x = (o) => Array.from(
|
|
58
|
+
o?.rows || [],
|
|
59
|
+
(e, t) => Array.from(e.cells, (s, r) => ({
|
|
60
|
+
number: r && t && Number.parseFloat(i(s)) || 0,
|
|
61
|
+
// First row and column is not a number
|
|
62
|
+
event: s.querySelector("a,button") && `${t}-${r}`,
|
|
63
|
+
// Reference to proxy events
|
|
64
|
+
style: `--color: var(--mtdsc-chart-color-${t}, var(--mtdsc-chart-color-base))`,
|
|
65
|
+
value: i(s),
|
|
66
|
+
tooltip: d(s, "data-tooltip") || `${i(e.cells[0])}: ${i(s)} (${i(o?.rows[0].cells[r])})`
|
|
67
|
+
}))
|
|
68
|
+
);
|
|
69
|
+
b && !window.customElements.get("mtds-chart") && window.customElements.define("mtds-chart", $);
|
|
108
70
|
export {
|
|
109
|
-
|
|
71
|
+
$ as MTDSChart
|
|
110
72
|
};
|
|
111
73
|
//# sourceMappingURL=chart-element.js.map
|