@mattilsynet/design 2.1.12 → 2.2.0
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/_virtual/client.js +6 -0
- package/mtds/_virtual/client.js.map +1 -0
- package/mtds/_virtual/client2.js +5 -0
- package/mtds/_virtual/client2.js.map +1 -0
- package/mtds/_virtual/index.js +5 -0
- package/mtds/_virtual/index.js.map +1 -0
- package/mtds/_virtual/react-dom-client.development.js +5 -0
- package/mtds/_virtual/react-dom-client.development.js.map +1 -0
- package/mtds/_virtual/react-dom-client.production.js +5 -0
- package/mtds/_virtual/react-dom-client.production.js.map +1 -0
- package/mtds/_virtual/scheduler.development.js +5 -0
- package/mtds/_virtual/scheduler.development.js.map +1 -0
- package/mtds/_virtual/scheduler.production.js +5 -0
- package/mtds/_virtual/scheduler.production.js.map +1 -0
- package/mtds/analytics/analytics.js +16 -14
- 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/button/button.d.ts +2 -1
- package/mtds/button/button.js +12 -12
- package/mtds/button/button.js.map +1 -1
- package/mtds/chart/chart-element.d.ts +5 -4
- package/mtds/chart/chart-element.js +111 -0
- package/mtds/chart/chart-element.js.map +1 -0
- package/mtds/chart/chart.d.ts +6 -0
- package/mtds/chart/chart.module.css.js +325 -0
- package/mtds/chart/chart.module.css.js.map +1 -0
- package/mtds/chart/chart.stories.d.ts +10 -0
- package/mtds/external/@u-elements/u-details/dist/u-details.js +1 -1
- package/mtds/external/@u-elements/u-details/dist/u-details.js.map +1 -1
- package/mtds/external/react-dom/cjs/react-dom-client.development.js +15323 -0
- package/mtds/external/react-dom/cjs/react-dom-client.development.js.map +1 -0
- package/mtds/external/react-dom/cjs/react-dom-client.production.js +9409 -0
- package/mtds/external/react-dom/cjs/react-dom-client.production.js.map +1 -0
- package/mtds/external/react-dom/client.js +24 -0
- package/mtds/external/react-dom/client.js.map +1 -0
- package/mtds/external/scheduler/cjs/scheduler.development.js +237 -0
- package/mtds/external/scheduler/cjs/scheduler.development.js.map +1 -0
- package/mtds/external/scheduler/cjs/scheduler.production.js +234 -0
- package/mtds/external/scheduler/cjs/scheduler.production.js.map +1 -0
- package/mtds/external/scheduler/index.js +11 -0
- package/mtds/external/scheduler/index.js.map +1 -0
- package/mtds/field/field.js +36 -35
- package/mtds/field/field.js.map +1 -1
- package/mtds/illustrations/bunny.svg +1 -0
- package/mtds/illustrations/eagle.svg +1 -0
- package/mtds/illustrations/index.json +22 -2
- package/mtds/illustrations/moose.svg +1 -0
- package/mtds/illustrations/polarbear.svg +1 -0
- package/mtds/illustrations/puppy.svg +1 -0
- package/mtds/index.d.ts +29 -5
- package/mtds/index.iife.js +335 -15
- package/mtds/index.js +19 -15
- package/mtds/index.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 +24 -23
- package/mtds/popover/popover-observer.js.map +1 -1
- package/mtds/react.d.ts +1 -0
- package/mtds/react.js +16 -14
- package/mtds/react.js.map +1 -1
- package/mtds/styles.css +1 -1
- package/mtds/styles.json +63 -40
- package/mtds/styles.module.css.js +138 -92
- package/mtds/styles.module.css.js.map +1 -1
- package/mtds/table/table-observer.js +20 -15
- package/mtds/table/table-observer.js.map +1 -1
- package/mtds/table/table.d.ts +2 -2
- package/mtds/table/table.js.map +1 -1
- package/mtds/table/table.stories.d.ts +5 -4
- package/mtds/tailwind.css +1 -0
- package/mtds/toast/toast-helper.d.ts +11 -0
- package/mtds/toast/toast-helper.js +14 -0
- package/mtds/toast/toast-helper.js.map +1 -0
- package/mtds/toast/toast-observer.js +19 -0
- package/mtds/toast/toast-observer.js.map +1 -0
- package/mtds/toast/toast.d.ts +10 -2
- package/mtds/toast/toast.js +39 -0
- package/mtds/toast/toast.js.map +1 -0
- package/mtds/toast/toast.stories.d.ts +19 -0
- package/mtds/utils.d.ts +0 -7
- package/mtds/utils.js +14 -16
- package/mtds/utils.js.map +1 -1
- package/package.json +21 -14
- package/mtds/chart/chart-doughnut.d.ts +0 -1
- /package/mtds/{chart/chart-axis.d.ts → toast/toast-observer.d.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client2.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-dom-client.development.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-dom-client.production.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduler.development.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduler.production.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import m from "../styles.module.css.js";
|
|
2
|
-
import { onLoaded as w, IS_BROWSER as h, on as
|
|
3
|
-
const y = `.${m.breadcrumbs.split(" ")[0]}`, _ = `.${m.
|
|
4
|
-
function
|
|
2
|
+
import { onLoaded as w, IS_BROWSER as h, on as g, QUICK_EVENT as b, attr as i } from "../utils.js";
|
|
3
|
+
const y = `.${m.breadcrumbs.split(" ")[0]}`, _ = `.${m.card.split(" ")[0]}`, k = `.${m.chip.split(" ")[0]}`, S = `.${m.helptext.split(" ")[0]}`, v = `.${m.pagination.split(" ")[0]}`, T = 'summary,u-summary,a,button,[role="tab"],[role="button"]', x = "click,toggle,submit,change", p = "mattilsynet.matomo.cloud", s = "mtds-analytics-banner", E = "https://www.mattilsynet.no/om-mattilsynet/personvernerklaering/informasjonskapsler";
|
|
4
|
+
function C(t, a = {}) {
|
|
5
5
|
if (h) {
|
|
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 = {
|
|
@@ -58,7 +58,7 @@ function q() {
|
|
|
58
58
|
#${s} button:active { background: #054449; scale: .9 }
|
|
59
59
|
#${s} p { margin: 0 .25em }
|
|
60
60
|
</style>
|
|
61
|
-
<p>Vi bruker <a href="${
|
|
61
|
+
<p>Vi bruker <a href="${E}" target="_blank">informasjonskapsler</a> for å forbedre brukeropplevelsen.</p>
|
|
62
62
|
<form method="dialog" data-analytics="ignore"><button type="submit" aria-label="OK">×</button></form>
|
|
63
63
|
</dialog>`
|
|
64
64
|
);
|
|
@@ -66,13 +66,13 @@ function q() {
|
|
|
66
66
|
a.addEventListener("close", e, { once: !0 }), a.show();
|
|
67
67
|
}
|
|
68
68
|
function $(t) {
|
|
69
|
-
window._mtdsTracking?.enabled && setTimeout(
|
|
69
|
+
window._mtdsTracking?.enabled && setTimeout(A, 0, t);
|
|
70
70
|
}
|
|
71
|
-
function
|
|
72
|
-
const e = t === "click" ? a?.closest?.(
|
|
71
|
+
function A({ type: t, target: a }) {
|
|
72
|
+
const e = t === "click" ? a?.closest?.(T) : a;
|
|
73
73
|
if (!(e instanceof Element) || e.closest('[data-analytics="ignore"]'))
|
|
74
74
|
return;
|
|
75
|
-
let o = "click", n = "Button", r = u(e) ||
|
|
75
|
+
let o = "click", n = "Button", r = u(e) || L(e) || i(e, "data-tooltip") || "";
|
|
76
76
|
if (t === "submit")
|
|
77
77
|
n = "Form", o = "submit", r = r || document.title;
|
|
78
78
|
else if (t === "toggle") {
|
|
@@ -85,7 +85,7 @@ function C({ type: t, target: a }) {
|
|
|
85
85
|
n = "Tab", o = "navigate";
|
|
86
86
|
else if (i(e, "popovertarget")) {
|
|
87
87
|
if (!I(e)?.matches(":popover-open")) return;
|
|
88
|
-
n = e.closest(
|
|
88
|
+
n = e.closest(S) ? "HelpText" : "Popover", o = "open";
|
|
89
89
|
} else if (e.nodeName.endsWith("SUMMARY")) {
|
|
90
90
|
if (!e.parentElement.open) return;
|
|
91
91
|
n = "Details", o = "open";
|
|
@@ -94,9 +94,11 @@ function C({ type: t, target: a }) {
|
|
|
94
94
|
n = "Sidebar", o = l ? "expand" : "minimize", r = l && i(e, "data-tooltip") || d(e);
|
|
95
95
|
} else if (e.closest(y))
|
|
96
96
|
n = "Breadcrumbs", o = "navigate";
|
|
97
|
-
else if (e.closest(
|
|
97
|
+
else if (e.closest(v))
|
|
98
98
|
n = "Pagintation", o = "navigate";
|
|
99
99
|
else if (e.closest(_))
|
|
100
|
+
n = "Card", o = e instanceof HTMLAnchorElement ? "navigate" : "click";
|
|
101
|
+
else if (e.closest(k))
|
|
100
102
|
n = "Chip", o = e.hasAttribute("data-removable") ? "remove" : "click";
|
|
101
103
|
else if (e.closest("th[aria-sort]"))
|
|
102
104
|
n = "Table", o = "sort";
|
|
@@ -106,18 +108,18 @@ function C({ type: t, target: a }) {
|
|
|
106
108
|
if (i(e, "aria-expanded") !== "true") return;
|
|
107
109
|
n = "Expand", o = "open";
|
|
108
110
|
}
|
|
109
|
-
|
|
111
|
+
C("event", {
|
|
110
112
|
category: i(e, "data-analytics-category") ?? n,
|
|
111
113
|
action: i(e, "data-analytics-action") ?? o,
|
|
112
114
|
name: i(e, "data-analytics-name") ?? r
|
|
113
115
|
});
|
|
114
116
|
}
|
|
115
|
-
const d = (t) => t?.textContent?.trim() || "", u = (t) => t && i(t, "aria-label") || "", I = (t) => document.getElementById(i(t, "popovertarget") || ""), B = (t, a) => window.getComputedStyle(t).getPropertyValue(a)?.trim(),
|
|
117
|
+
const d = (t) => t?.textContent?.trim() || "", u = (t) => t && i(t, "aria-label") || "", I = (t) => document.getElementById(i(t, "popovertarget") || ""), B = (t, a) => window.getComputedStyle(t).getPropertyValue(a)?.trim(), L = (t) => {
|
|
116
118
|
const a = d(t), e = d(t.querySelector("h1,h2,h3,h4,h5,h6"));
|
|
117
119
|
return a.startsWith(e) && e || a.slice(0, 100).trim();
|
|
118
120
|
};
|
|
119
|
-
w(() =>
|
|
121
|
+
w(() => g(document, x, $, b));
|
|
120
122
|
export {
|
|
121
|
-
|
|
123
|
+
C as analytics
|
|
122
124
|
};
|
|
123
125
|
//# 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_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_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","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,MAA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AAGA,EAAAD,EAAU,SAAS;AAAA,IAClB,UAAU4B,EAAKH,GAAI,yBAAyB,KAAKb;AAAA,IACjD,QAAQgB,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 } 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,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,QAC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;AAC9D;AAEAE,EAAS,MAAMC,EAAG,UAAU1C,GAAQyB,GAAakB,CAAW,CAAC;"}
|
package/mtds/app/app.js
CHANGED
|
@@ -28,6 +28,7 @@ import "../steps/steps.js";
|
|
|
28
28
|
import "../table/table.js";
|
|
29
29
|
import "../tabs/tabs.js";
|
|
30
30
|
import "../tag/tag.js";
|
|
31
|
+
import "../toast/toast.js";
|
|
31
32
|
import "../togglegroup/togglegroup.js";
|
|
32
33
|
import "../typography/typography.js";
|
|
33
34
|
import "../validation/validation.js";
|
|
@@ -37,7 +38,7 @@ const f = p(function({ as: t, className: r, ...m }, n) {
|
|
|
37
38
|
return /* @__PURE__ */ o(t || "div", { className: e(a.app, r), ref: n, ...m });
|
|
38
39
|
}), u = p(function({ as: t, className: r, ...m }, n) {
|
|
39
40
|
return /* @__PURE__ */ o(t || "div", { className: e(a.sticky, r), ref: n, ...m });
|
|
40
|
-
}),
|
|
41
|
+
}), Y = Object.assign(f, {
|
|
41
42
|
Header: p(
|
|
42
43
|
function(t, r) {
|
|
43
44
|
return /* @__PURE__ */ o("header", { ref: r, ...t });
|
|
@@ -75,6 +76,6 @@ const f = p(function({ as: t, className: r, ...m }, n) {
|
|
|
75
76
|
Script: () => /* @__PURE__ */ o("script", { id: "mtds-app-script", children: d })
|
|
76
77
|
});
|
|
77
78
|
export {
|
|
78
|
-
|
|
79
|
+
Y as App
|
|
79
80
|
};
|
|
80
81
|
//# 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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M;AAAA,EAClC,CAAC;AAAA,EACD,QAAQH;AAAA,IACP,SAAmBG,GAAMC,GAAK;AAC7B,aAAO,gBAAAC,EAAC,UAAA,EAAO,KAAAD,GAAW,GAAGD,EAAA,CAAM;AAAA,IACpC;AAAA,EAAA;AAAA;AAAA,EAGD,QAAQ,MAAM,gBAAAE,EAAC,UAAA,EAAO,IAAG,mBAAmB,UAAAO,EAAA,CAAO;AACpD,CAAC;"}
|
package/mtds/button/button.d.ts
CHANGED
|
@@ -2,9 +2,10 @@ import { JSX } from 'react';
|
|
|
2
2
|
import { PolymorphicComponentPropWithRef } from '../react-types';
|
|
3
3
|
type ButtonBaseProps<Href> = {
|
|
4
4
|
"data-arrow"?: "left" | "right" | true;
|
|
5
|
-
"data-justify"?: "start" | "center" | "right";
|
|
5
|
+
"data-justify"?: "start" | "center" | "end" | "right" | "left";
|
|
6
6
|
"data-nowrap"?: boolean;
|
|
7
7
|
"data-variant"?: "primary" | "secondary" | "tertiary";
|
|
8
|
+
"data-command"?: string;
|
|
8
9
|
href?: Href;
|
|
9
10
|
popovertarget?: string;
|
|
10
11
|
popovertargetaction?: string;
|
package/mtds/button/button.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { clsx as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
return /* @__PURE__ */
|
|
8
|
-
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { clsx as m } from "../external/clsx/dist/clsx.js";
|
|
3
|
+
import { forwardRef as a } from "react";
|
|
4
|
+
import s from "../styles.module.css.js";
|
|
5
|
+
const l = a(function({ as: r, className: n, type: u, ...t }, f) {
|
|
6
|
+
const o = r || (t.href ? "a" : "button");
|
|
7
|
+
return o === "button" && t["aria-busy"] && (t.disabled = !0), /* @__PURE__ */ i(
|
|
8
|
+
o,
|
|
9
9
|
{
|
|
10
|
-
className:
|
|
11
|
-
type:
|
|
10
|
+
className: m(s.button, n),
|
|
11
|
+
type: u ?? (o === "button" ? o : void 0),
|
|
12
12
|
ref: f,
|
|
13
|
-
...
|
|
13
|
+
...t
|
|
14
14
|
}
|
|
15
15
|
);
|
|
16
16
|
});
|
|
17
17
|
export {
|
|
18
|
-
|
|
18
|
+
l as Button
|
|
19
19
|
};
|
|
20
20
|
//# sourceMappingURL=button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","sources":["../../designsystem/button/button.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef, type JSX } from \"react\";\nimport type {\n\tPolymorphicComponentPropWithRef,\n\tPolymorphicRef,\n} from \"../react-types\";\nimport styles from \"../styles.module.css\";\n\ntype ButtonBaseProps<Href> = {\n\t\"data-arrow\"?: \"left\" | \"right\" | true;\n\t\"data-justify\"?: \"start\" | \"center\" | \"right\";\n\t\"data-nowrap\"?: boolean;\n\t\"data-variant\"?: \"primary\" | \"secondary\" | \"tertiary\";\n\thref?: Href;\n\tpopovertarget?: string;\n\tpopovertargetaction?: string;\n};\n\nexport type ButtonProps<\n\tHref,\n\tAs extends React.ElementType = Href extends string ? \"a\" : \"button\",\n> = PolymorphicComponentPropWithRef<As, ButtonBaseProps<Href>>;\n\ntype ButtonComponent = <\n\tHref,\n\tAs extends React.ElementType = Href extends string ? \"a\" : \"button\",\n>(\n\tprops: ButtonProps<Href, As>,\n) => JSX.Element;\n\nexport const Button: ButtonComponent = forwardRef<null>(function Button<\n\tHref,\n\tAs extends React.ElementType = Href extends string ? \"a\" : \"button\",\n>(\n\t{ as, className, type, ...rest }: ButtonProps<Href, As>,\n\tref?: PolymorphicRef<As>,\n) {\n\tconst Tag = as || (rest.href ? \"a\" : \"button\");\n\n\treturn (\n\t\t<Tag\n\t\t\tclassName={clsx(styles.button, className)}\n\t\t\ttype={type ?? (Tag === \"button\" ? Tag : undefined)} // Default to type=\"button\" if not set and tag is button\n\t\t\tref={ref}\n\t\t\t{...rest}\n\t\t/>\n\t);\n}) as ButtonComponent; // Needed to tell Typescript this does not return ReactNode but acutally JSX.Element\n"],"names":["Button","forwardRef","as","className","type","rest","ref","Tag","jsx","clsx","styles"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"button.js","sources":["../../designsystem/button/button.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef, type JSX } from \"react\";\nimport type {\n\tPolymorphicComponentPropWithRef,\n\tPolymorphicRef,\n} from \"../react-types\";\nimport styles from \"../styles.module.css\";\n\ntype ButtonBaseProps<Href> = {\n\t\"data-arrow\"?: \"left\" | \"right\" | true;\n\t\"data-justify\"?: \"start\" | \"center\" | \"end\" | \"right\" | \"left\";\n\t\"data-nowrap\"?: boolean;\n\t\"data-variant\"?: \"primary\" | \"secondary\" | \"tertiary\";\n\t\"data-command\"?: string;\n\thref?: Href;\n\tpopovertarget?: string;\n\tpopovertargetaction?: string;\n};\n\nexport type ButtonProps<\n\tHref,\n\tAs extends React.ElementType = Href extends string ? \"a\" : \"button\",\n> = PolymorphicComponentPropWithRef<As, ButtonBaseProps<Href>>;\n\ntype ButtonElement = ButtonProps<null, \"button\">;\ntype ButtonComponent = <\n\tHref,\n\tAs extends React.ElementType = Href extends string ? \"a\" : \"button\",\n>(\n\tprops: ButtonProps<Href, As>,\n) => JSX.Element;\n\nexport const Button: ButtonComponent = forwardRef<null>(function Button<\n\tHref,\n\tAs extends React.ElementType = Href extends string ? \"a\" : \"button\",\n>(\n\t{ as, className, type, ...rest }: ButtonProps<Href, As>,\n\tref?: PolymorphicRef<As>,\n) {\n\tconst Tag = as || (rest.href ? \"a\" : \"button\");\n\n\tif (Tag === \"button\" && (rest as ButtonElement)[\"aria-busy\"])\n\t\t(rest as ButtonElement).disabled = true; // Automatically disable button if aria-busy is set\n\n\treturn (\n\t\t<Tag\n\t\t\tclassName={clsx(styles.button, className)}\n\t\t\ttype={type ?? (Tag === \"button\" ? Tag : undefined)} // Default to type=\"button\" if not set and tag is button\n\t\t\tref={ref}\n\t\t\t{...rest}\n\t\t/>\n\t);\n}) as ButtonComponent; // Needed to tell Typescript this does not return ReactNode but acutally JSX.Element\n"],"names":["Button","forwardRef","as","className","type","rest","ref","Tag","jsx","clsx","styles"],"mappings":";;;;AAgCO,MAAMA,IAA0BC,EAAiB,SAIvD,EAAE,IAAAC,GAAI,WAAAC,GAAW,MAAAC,GAAM,GAAGC,EAAA,GAC1BC,GACC;AACD,QAAMC,IAAML,MAAOG,EAAK,OAAO,MAAM;AAErC,SAAIE,MAAQ,YAAaF,EAAuB,WAAW,MACzDA,EAAuB,WAAW,KAGnC,gBAAAG;AAAA,IAACD;AAAA,IAAA;AAAA,MACA,WAAWE,EAAKC,EAAO,QAAQP,CAAS;AAAA,MACxC,MAAMC,MAASG,MAAQ,WAAWA,IAAM;AAAA,MACxC,KAAAD;AAAA,MACC,GAAGD;AAAA,IAAA;AAAA,EAAA;AAGP,CAAC;"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { MTDSElement } from '../utils';
|
|
2
1
|
import type * as ReactTypes from "react";
|
|
2
|
+
declare const MTDSElement: {
|
|
3
|
+
new (): HTMLElement;
|
|
4
|
+
prototype: HTMLElement;
|
|
5
|
+
};
|
|
3
6
|
export type ReactChart = ReactTypes.JSX.IntrinsicElements["div"] & {
|
|
4
7
|
class?: string;
|
|
5
8
|
};
|
|
@@ -11,9 +14,7 @@ declare global {
|
|
|
11
14
|
}
|
|
12
15
|
}
|
|
13
16
|
export declare class MTDSChart extends MTDSElement {
|
|
14
|
-
_resizeObserver: ResizeObserver | null;
|
|
15
|
-
_svg: SVGSVGElement | null;
|
|
16
17
|
constructor();
|
|
17
18
|
connectedCallback(): void;
|
|
18
|
-
disconnectedCallback(): void;
|
|
19
19
|
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { IS_BROWSER as Y, attr as a, useId as _ } from "../utils.js";
|
|
2
|
+
import q from "./chart.module.css.js";
|
|
3
|
+
const z = typeof HTMLElement > "u" ? class {
|
|
4
|
+
} : HTMLElement, M = "http://www.w3.org/2000/svg";
|
|
5
|
+
class F extends z {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(), this.attachShadow({ mode: "open" });
|
|
8
|
+
}
|
|
9
|
+
connectedCallback() {
|
|
10
|
+
let s = 0, o = 0;
|
|
11
|
+
const c = this.querySelector("table"), t = Array.from(c?.rows || [], (p, m) => {
|
|
12
|
+
let h = 0;
|
|
13
|
+
const e = Array.from(p.cells, (r, i) => {
|
|
14
|
+
const $ = r.textContent.trim() || "", u = Number($) || 0;
|
|
15
|
+
return m && i && (s = Math.max(s, u), h += u), $;
|
|
16
|
+
});
|
|
17
|
+
return o = Math.max(o, h), e;
|
|
18
|
+
}), [l, b] = (a(this, "data-variant") || "bar").split("-"), v = l === "column", E = b === "stacked", H = Number(b || 10) || 0, O = d("style", {}, q), y = d("div", {
|
|
19
|
+
"aria-label": t[0][0] || null,
|
|
20
|
+
class: "axis",
|
|
21
|
+
role: "figure"
|
|
22
|
+
}), S = d("div", { class: "axisGroups" }), N = K(E ? o : s), P = d("div", { class: "legends" }), k = t.slice(1).map(
|
|
23
|
+
([p], m) => d("div", { class: `legend color-${m + 1}` }, p)
|
|
24
|
+
), L = k.map(_);
|
|
25
|
+
if (y.classList.toggle("is-horizontal", !v), y.classList.toggle("is-vertical", v), y.classList.toggle("is-stacked", E), y.style.setProperty("--groups", `${t.length - 1}`), y.style.setProperty("--total", `${N.total}`), y.append(N.el, S), (l === "bar" || l === "column") && t[0].forEach((p, m) => {
|
|
26
|
+
if (m === 0) return;
|
|
27
|
+
const h = d("div", { class: "axisGroup" }), e = d("div", { class: "axisGroupContent" }), r = d("div", { class: "axisLabel" }, p);
|
|
28
|
+
h.append(e, r), S.append(h), t.slice(1).forEach((i, $) => {
|
|
29
|
+
e.append(
|
|
30
|
+
d("div", {
|
|
31
|
+
"aria-describedby": L[$],
|
|
32
|
+
class: `bar color-${$ + 1}`,
|
|
33
|
+
role: "img",
|
|
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);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
Y && !window.customElements.get("mtds-chart") && window.customElements.define("mtds-chart", F);
|
|
92
|
+
const V = (n, s) => n.map(([o, c], t, l) => t ? W(t, l, s) : `M${o},${c}`).join(" "), I = ([n, s], [o, c]) => [n + o, s + c], j = ([n, s], [o, c]) => [n - o, s - c], D = (n, [s, o]) => [n * s, n * o], W = (n, s, o) => {
|
|
93
|
+
const c = s[n - 1], t = s[n], [l, b] = I(c, D(o, j(t, s[n - 2] || c))), [v, E] = I(t, D(o, j(c, s[n + 1] || t)));
|
|
94
|
+
return `C ${l},${b} ${v},${E} ${t[0]},${t[1]}`;
|
|
95
|
+
}, J = new Intl.NumberFormat().format, K = (n) => {
|
|
96
|
+
const s = 10 ** (`${~~n}`.length - 1), o = n / s < 5 ? s / 2 : s, c = Math.ceil(n / o) * o, t = d("div");
|
|
97
|
+
return t.classList.add("axisSteps"), t.append(
|
|
98
|
+
...Array.from({ length: c / o + 1 }, (l, b) => J(o * b)).reverse().map((l) => {
|
|
99
|
+
const b = d("div", { class: "axisLabel" }, l), v = d("div", { class: "axisStep" });
|
|
100
|
+
return v.append(b), v;
|
|
101
|
+
})
|
|
102
|
+
), { total: c, el: t };
|
|
103
|
+
}, d = (n, s, o) => {
|
|
104
|
+
const c = document.createElement(n);
|
|
105
|
+
if (o && (c.textContent = o), s) for (const [t, l] of Object.entries(s)) a(c, t, l);
|
|
106
|
+
return c;
|
|
107
|
+
};
|
|
108
|
+
export {
|
|
109
|
+
F as MTDSChart
|
|
110
|
+
};
|
|
111
|
+
//# sourceMappingURL=chart-element.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart-element.js","sources":["../../designsystem/chart/chart-element.ts"],"sourcesContent":["import type * as ReactTypes from \"react\";\nimport { attr, IS_BROWSER, useId } from \"../utils\";\nimport css from \"./chart.module.css?raw\";\n\nconst MTDSElement =\n\ttypeof HTMLElement === \"undefined\"\n\t\t? (class {} as typeof HTMLElement)\n\t\t: HTMLElement;\n\nexport type ReactChart = ReactTypes.JSX.IntrinsicElements[\"div\"] & {\n\tclass?: string;\n};\n\ndeclare global {\n\tnamespace React.JSX {\n\t\tinterface IntrinsicElements {\n\t\t\t\"mtds-chart\": ReactChart;\n\t\t}\n\t}\n}\n\nconst xmlns = \"http://www.w3.org/2000/svg\";\nexport class MTDSChart extends MTDSElement {\n\tconstructor() {\n\t\tsuper();\n\t\tthis.attachShadow({ mode: \"open\" });\n\t}\n\tconnectedCallback() {\n\t\tlet max = 0;\n\t\tlet rowMax = 0;\n\t\tconst table = this.querySelector(\"table\");\n\t\tconst data = Array.from(table?.rows || [], (row, isTbody) => {\n\t\t\tlet rowTotal = 0;\n\t\t\tconst values = Array.from(row.cells, (cell, isTd) => {\n\t\t\t\tconst val = cell.textContent.trim() || \"\";\n\t\t\t\tconst num = Number(val) || 0;\n\t\t\t\tif (isTbody && isTd) {\n\t\t\t\t\tmax = Math.max(max, num);\n\t\t\t\t\trowTotal += num;\n\t\t\t\t}\n\t\t\t\treturn val;\n\t\t\t});\n\t\t\trowMax = Math.max(rowMax, rowTotal);\n\t\t\treturn values;\n\t\t});\n\n\t\tconst [variant, type] = (attr(this, \"data-variant\") || \"bar\").split(\"-\");\n\t\tconst isVertical = variant === \"column\";\n\t\tconst isStacked = type === \"stacked\";\n\n\t\tconst smoothing = Number(type || 10) || 0;\n\t\tconst style = createElement(\"style\", {}, css);\n\t\tconst axis = createElement(\"div\", {\n\t\t\t\"aria-label\": data[0][0] || null,\n\t\t\tclass: \"axis\",\n\t\t\trole: \"figure\",\n\t\t});\n\t\tconst groups = createElement(\"div\", { class: \"axisGroups\" });\n\t\tconst steps = toSteps(isStacked ? rowMax : max);\n\t\tconst legend = createElement(\"div\", { class: \"legends\" });\n\t\tconst legends = data\n\t\t\t.slice(1)\n\t\t\t.map(([text], index) =>\n\t\t\t\tcreateElement(\"div\", { class: `legend color-${index + 1}` }, text),\n\t\t\t);\n\t\tconst legendIds = legends.map(useId);\n\n\t\taxis.classList.toggle(\"is-horizontal\", !isVertical);\n\t\taxis.classList.toggle(\"is-vertical\", isVertical);\n\t\taxis.classList.toggle(\"is-stacked\", isStacked);\n\t\taxis.style.setProperty(\"--groups\", `${data.length - 1}`);\n\t\taxis.style.setProperty(\"--total\", `${steps.total}`);\n\t\taxis.append(steps.el, groups);\n\n\t\tif (variant === \"bar\" || variant === \"column\") {\n\t\t\tdata[0].forEach((groupLabel, index) => {\n\t\t\t\tif (index === 0) return; // Skip first column internally so index matches rest of data\n\t\t\t\tconst group = createElement(\"div\", { class: \"axisGroup\" });\n\t\t\t\tconst content = createElement(\"div\", { class: \"axisGroupContent\" });\n\t\t\t\tconst label = createElement(\"div\", { class: \"axisLabel\" }, groupLabel);\n\t\t\t\tgroup.append(content, label);\n\t\t\t\tgroups.append(group);\n\n\t\t\t\tdata.slice(1).forEach((values, legendIndex) => {\n\t\t\t\t\tcontent.append(\n\t\t\t\t\t\tcreateElement(\"div\", {\n\t\t\t\t\t\t\t\"aria-describedby\": legendIds[legendIndex],\n\t\t\t\t\t\t\tclass: `bar color-${legendIndex + 1}`,\n\t\t\t\t\t\t\trole: \"img\",\n\t\t\t\t\t\t\tstyle: `--value: ${values[index]}`,\n\t\t\t\t\t\t\ttabindex: \"0\",\n\t\t\t\t\t\t\ttitle: `${values[0]}: ${values[index]}`,\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\n\t\tif (variant === \"line\" || variant === \"area\") {\n\t\t\tconst group = createElement(\"div\", { class: \"axisGroup\" });\n\t\t\tdata.slice(1).forEach(([legend, ...values], legendIndex) => {\n\t\t\t\tconst lineContainer = createElement(\"div\", {\n\t\t\t\t\tclass: `lineContainer color-${legendIndex + 1}`,\n\t\t\t\t\trole: \"list\",\n\t\t\t\t});\n\n\t\t\t\tconst line = document.createElementNS(xmlns, \"svg\");\n\t\t\t\tattr(line, \"aria-hidden\", \"true\");\n\t\t\t\tattr(line, \"preserveAspectRatio\", \"none\");\n\t\t\t\tattr(line, \"viewBox\", \"0 0 100 100\");\n\n\t\t\t\tconst path = toPath(\n\t\t\t\t\tvalues.map((value, index, { length }) => [\n\t\t\t\t\t\t(100 / (length - 1)) * index,\n\t\t\t\t\t\t100 - (Number(value) / steps.total) * 100,\n\t\t\t\t\t]),\n\t\t\t\t\tsmoothing / 100,\n\t\t\t\t);\n\n\t\t\t\tconst linePath = document.createElementNS(xmlns, \"path\");\n\t\t\t\tattr(linePath, \"class\", \"line\");\n\t\t\t\tattr(linePath, \"d\", path);\n\t\t\t\tattr(linePath, \"fill\", \"none\");\n\t\t\t\tattr(linePath, \"stroke\", \"currentColor\");\n\t\t\t\tconst lineBorder = linePath.cloneNode(true) as SVGPathElement;\n\t\t\t\tattr(lineBorder, \"class\", \"lineBorder\");\n\n\t\t\t\tif (variant === \"area\") {\n\t\t\t\t\tconst lineShade = linePath.cloneNode(true) as SVGPathElement;\n\t\t\t\t\tattr(lineShade, \"d\", `M-100,100 L${path.slice(1)}L200,100`);\n\t\t\t\t\tattr(lineShade, \"class\", \"lineShade\");\n\t\t\t\t\tline.append(lineShade);\n\t\t\t\t}\n\n\t\t\t\tvalues.forEach((value, index) => {\n\t\t\t\t\tconst col = createElement(\"div\", { role: \"listitem\" });\n\t\t\t\t\tcol.appendChild(\n\t\t\t\t\t\tcreateElement(\"div\", {\n\t\t\t\t\t\t\t\"aria-describedby\": legendIds[legendIndex],\n\t\t\t\t\t\t\ttabindex: \"0\",\n\t\t\t\t\t\t\ttitle: `${data[0][index + 1]}: ${value} (${legend})`,\n\t\t\t\t\t\t\tclass: \"linePoint\",\n\t\t\t\t\t\t\trole: \"img\",\n\t\t\t\t\t\t\tstyle: `--value: ${value}`,\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t\tlineContainer.append(col);\n\t\t\t\t});\n\n\t\t\t\tline.append(lineBorder, linePath);\n\t\t\t\tlineContainer.append(line);\n\t\t\t\tgroup.append(lineContainer);\n\t\t\t});\n\t\t\tgroups.append(group);\n\t\t}\n\n\t\tif (variant === \"doughnut\") {\n\t\t\tconst doughnut = document.createElementNS(xmlns, \"svg\");\n\t\t\tconst tot = data.slice(1).reduce((acc, [, val]) => acc + Number(val), 0);\n\t\t\tattr(doughnut, \"class\", \"doughnut\");\n\t\t\tattr(doughnut, \"viewBox\", \"0 0 100 100\");\n\n\t\t\tlet offset = 0;\n\t\t\tconst radius = 50;\n\t\t\tconst inner = 25;\n\n\t\t\tdata.slice(1).forEach(([label, value], legendIndex) => {\n\t\t\t\tconst path = document.createElementNS(xmlns, \"path\");\n\t\t\t\tconst start = offset / tot;\n\t\t\t\toffset += Number(value);\n\t\t\t\tconst end = offset / tot;\n\t\t\t\tconst largeArc = end - start > 0.5 ? 1 : 0;\n\t\t\t\tconst a0 = 2 * Math.PI * (start - 0.25);\n\t\t\t\tconst a1 = 2 * Math.PI * (end - 0.25);\n\t\t\t\tconst x0 = Math.cos(a0);\n\t\t\t\tconst y0 = Math.sin(a0);\n\t\t\t\tconst x1 = Math.cos(a1);\n\t\t\t\tconst y1 = Math.sin(a1);\n\t\t\t\tconst d = `M ${radius + inner * x0} ${radius + inner * y0} L ${radius + radius * x0} ${radius + radius * y0} A ${radius} ${radius} 0 ${largeArc} 1 ${radius + radius * x1} ${radius + radius * y1} L ${radius + inner * x1} ${radius + inner * y1} A ${inner} ${inner} 0 ${largeArc} 0 ${radius + inner * x0} ${radius + inner * y0}`;\n\n\t\t\t\tattr(path, \"aria-describedby\", legendIds[legendIndex]);\n\t\t\t\tattr(path, \"class\", `color-${legendIndex + 1}`);\n\t\t\t\tattr(path, \"d\", d);\n\t\t\t\tattr(path, \"role\", \"img\");\n\t\t\t\tattr(path, \"tabindex\", \"0\");\n\t\t\t\tattr(path, \"title\", label || null);\n\t\t\t\tdoughnut.appendChild(path);\n\t\t\t\tthis.shadowRoot?.append(doughnut);\n\t\t\t});\n\t\t}\n\n\t\tif (variant !== \"doughnut\") this.shadowRoot?.append(axis);\n\n\t\tlegend.append(...legends);\n\n\t\tthis.shadowRoot?.append(style, legend);\n\t}\n}\n\nif (IS_BROWSER && !window.customElements.get(\"mtds-chart\"))\n\twindow.customElements.define(\"mtds-chart\", MTDSChart);\n\n// Based on https://observablehq.com/@ndry/smooth-a-svg-path-with-cubic-bezier-curves\nconst toPath = (points: number[][], s: number) =>\n\tpoints.map(([x, y], i, a) => (i ? smooth(i, a, s) : `M${x},${y}`)).join(\" \");\nconst add = ([ax, ay]: number[], [bx, by]: number[]) => [ax + bx, ay + by];\nconst sub = ([ax, ay]: number[], [bx, by]: number[]) => [ax - bx, ay - by];\nconst scale = (s: number, [x, y]: number[]) => [s * x, s * y];\nconst smooth = (i: number, all: number[][], smooth: number) => {\n\tconst start = all[i - 1];\n\tconst end = all[i];\n\tconst [csX, csY] = add(start, scale(smooth, sub(end, all[i - 2] || start))); // start control point\n\tconst [ceX, ceY] = add(end, scale(smooth, sub(start, all[i + 1] || end))); // end control point\n\treturn `C ${csX},${csY} ${ceX},${ceY} ${end[0]},${end[1]}`;\n};\n\nconst getNum = new Intl.NumberFormat().format;\nconst toSteps = (max: number) => {\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 el = createElement(\"div\");\n\n\tel.classList.add(\"axisSteps\");\n\tel.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) => {\n\t\t\t\tconst label = createElement(\"div\", { class: \"axisLabel\" }, num);\n\t\t\t\tconst value = createElement(\"div\", { class: \"axisStep\" });\n\t\t\t\tvalue.append(label);\n\t\t\t\treturn value;\n\t\t\t}),\n\t);\n\n\treturn { total, el };\n};\n\n/**\n * createElement\n * @description creates element and assigns properties\n * @param taName The tagname of element to create\n * @param props Optional properties to add to the element\n * @return HTMLElement with props\n */\nconst createElement = <TagName extends keyof HTMLElementTagNameMap>(\n\ttagName: TagName,\n\tattrs?: Record<string, string | null>,\n\ttext?: string | null,\n): HTMLElementTagNameMap[TagName] => {\n\tconst el = document.createElement(tagName);\n\tif (text) el.textContent = text;\n\tif (attrs) for (const [key, val] of Object.entries(attrs)) attr(el, key, val);\n\treturn el;\n};\n"],"names":["MTDSElement","xmlns","MTDSChart","max","rowMax","table","data","row","isTbody","rowTotal","values","cell","isTd","val","num","variant","type","attr","isVertical","isStacked","smoothing","style","createElement","css","axis","groups","steps","toSteps","legend","legends","text","index","legendIds","useId","groupLabel","group","content","label","legendIndex","lineContainer","line","path","toPath","value","length","linePath","lineBorder","lineShade","col","doughnut","tot","acc","offset","radius","inner","start","end","largeArc","a0","a1","x0","y0","x1","y1","d","IS_BROWSER","points","x","y","i","a","smooth","add","ax","ay","bx","by","sub","scale","s","all","csX","csY","ceX","ceY","getNum","digits","step","total","el","_","tagName","attrs","key"],"mappings":";;AAIA,MAAMA,IACL,OAAO,cAAgB,MACnB,MAAM;AAAC,IACR,aAcEC,IAAQ;AACP,MAAMC,UAAkBF,EAAY;AAAA,EAC1C,cAAc;AACb,UAAA,GACA,KAAK,aAAa,EAAE,MAAM,OAAA,CAAQ;AAAA,EACnC;AAAA,EACA,oBAAoB;AACnB,QAAIG,IAAM,GACNC,IAAS;AACb,UAAMC,IAAQ,KAAK,cAAc,OAAO,GAClCC,IAAO,MAAM,KAAKD,GAAO,QAAQ,CAAA,GAAI,CAACE,GAAKC,MAAY;AAC5D,UAAIC,IAAW;AACf,YAAMC,IAAS,MAAM,KAAKH,EAAI,OAAO,CAACI,GAAMC,MAAS;AACpD,cAAMC,IAAMF,EAAK,YAAY,KAAA,KAAU,IACjCG,IAAM,OAAOD,CAAG,KAAK;AAC3B,eAAIL,KAAWI,MACdT,IAAM,KAAK,IAAIA,GAAKW,CAAG,GACvBL,KAAYK,IAEND;AAAA,MACR,CAAC;AACD,aAAAT,IAAS,KAAK,IAAIA,GAAQK,CAAQ,GAC3BC;AAAA,IACR,CAAC,GAEK,CAACK,GAASC,CAAI,KAAKC,EAAK,MAAM,cAAc,KAAK,OAAO,MAAM,GAAG,GACjEC,IAAaH,MAAY,UACzBI,IAAYH,MAAS,WAErBI,IAAY,OAAOJ,KAAQ,EAAE,KAAK,GAClCK,IAAQC,EAAc,SAAS,CAAA,GAAIC,CAAG,GACtCC,IAAOF,EAAc,OAAO;AAAA,MACjC,cAAchB,EAAK,CAAC,EAAE,CAAC,KAAK;AAAA,MAC5B,OAAO;AAAA,MACP,MAAM;AAAA,IAAA,CACN,GACKmB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,CAACG,GAAGrB,MAAMgB,EAAOE,IAAOlB,CAAC,CAAC,EACpE,UACA,IAAI,CAACvD,MAAQ;AACb,YAAMuB,IAAQf,EAAc,OAAO,EAAE,OAAO,YAAA,GAAeR,CAAG,GACxD6B,IAAQrB,EAAc,OAAO,EAAE,OAAO,YAAY;AACxD,aAAAqB,EAAM,OAAON,CAAK,GACXM;AAAA,IACR,CAAC;AAAA,EAAA,GAGI,EAAE,OAAA6C,GAAO,IAAAC,EAAA;AACjB,GASMnE,IAAgB,CACrBqE,GACAC,GACA9D,MACoC;AACpC,QAAM2D,IAAK,SAAS,cAAcE,CAAO;AAEzC,MADI7D,QAAS,cAAcA,IACvB8D,EAAO,YAAW,CAACC,GAAKhF,CAAG,KAAK,OAAO,QAAQ+E,CAAK,EAAG,CAAA3E,EAAKwE,GAAII,GAAKhF,CAAG;AAC5E,SAAO4E;AACR;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type ChartProps = React.ComponentPropsWithoutRef<"div"> & {
|
|
2
|
+
"data-variant"?: "bar" | "column" | "column-stacked" | "area" | "line" | "doughnut";
|
|
3
|
+
};
|
|
4
|
+
export declare const Chart: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
5
|
+
"data-variant"?: "bar" | "column" | "column-stacked" | "area" | "line" | "doughnut";
|
|
6
|
+
} & React.RefAttributes<HTMLDivElement>>;
|