@mattilsynet/design 2.2.7 → 2.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/mtds/app/app-observer.js +1 -1
- package/mtds/app/app-toggle.js +10 -26
- package/mtds/app/app-toggle.js.map +1 -1
- package/mtds/app/app-toggle2.js +26 -10
- package/mtds/app/app-toggle2.js.map +1 -1
- package/mtds/app/app.js +1 -1
- package/mtds/dialog/dialog-observer.js +20 -19
- package/mtds/dialog/dialog-observer.js.map +1 -1
- package/mtds/dialog/dialog.stories.d.ts +3 -1
- package/mtds/index.d.ts +0 -1
- package/mtds/index.iife.js +14 -14
- package/mtds/map/map-element.d.ts +7 -3
- package/mtds/map/map-element.js +54 -46
- package/mtds/map/map-element.js.map +1 -1
- package/mtds/map/map.css.js +30 -6
- package/mtds/map/map.css.js.map +1 -1
- package/mtds/map.iife.js +47 -8
- package/mtds/map.js +5 -3
- package/mtds/map.js.map +1 -1
- package/mtds/package.json.js +1 -1
- package/mtds/popover/popover-observer.js +29 -26
- package/mtds/popover/popover-observer.js.map +1 -1
- package/mtds/styles.css +1 -1
- package/mtds/styles.json +41 -42
- package/mtds/styles.module.css.js +72 -74
- package/mtds/styles.module.css.js.map +1 -1
- package/package.json +5 -3
package/mtds/app/app-observer.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import S from "../styles.module.css.js";
|
|
2
2
|
import { onLoaded as _, onMutation as P, on as r, QUICK_EVENT as p, debounce as E } from "../utils.js";
|
|
3
|
-
import "./app-
|
|
3
|
+
import "./app-toggle.js";
|
|
4
4
|
const g = S.app.split(" ")[0], h = S.sticky.split(" ")[0], I = '[data-command="toggle-app-expanded"]', y = `.${g} > dialog,.${g} dialog ~ main`, C = (t) => {
|
|
5
5
|
document.startViewTransition ? document.startViewTransition(t) : t();
|
|
6
6
|
}, x = (t) => (
|
package/mtds/app/app-toggle.js
CHANGED
|
@@ -1,27 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
)
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
document.adoptedStyleSheets.push(sheet);
|
|
12
|
-
window.mtdsToggleAppExpanded = (force) => {
|
|
13
|
-
try {
|
|
14
|
-
const next = force ?? !prev();
|
|
15
|
-
sheet.replaceSync?.(\`:root { \${key}: var(\${key}--\${next})}\`);
|
|
16
|
-
window.localStorage.setItem(key, next);
|
|
17
|
-
} catch (_err) {} // localStorage is full or replaceSync is not supported
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
// Set and store initial state
|
|
21
|
-
window.mtdsToggleAppExpanded(prev());
|
|
22
|
-
})();
|
|
23
|
-
`;
|
|
24
|
-
export {
|
|
25
|
-
t as default
|
|
26
|
-
};
|
|
1
|
+
typeof window < "u" && window.CSSStyleSheet && document.adoptedStyleSheets && (() => {
|
|
2
|
+
const e = "--mtds-app-expanded", d = new CSSStyleSheet(), o = () => !window.localStorage.getItem(e)?.includes("false");
|
|
3
|
+
document.adoptedStyleSheets.push(d), window.mtdsToggleAppExpanded = (n) => {
|
|
4
|
+
try {
|
|
5
|
+
const t = n ?? !o();
|
|
6
|
+
d.replaceSync?.(`:root { ${e}: var(${e}--${t})}`), window.localStorage.setItem(e, t);
|
|
7
|
+
} catch {
|
|
8
|
+
}
|
|
9
|
+
}, window.mtdsToggleAppExpanded(o());
|
|
10
|
+
})();
|
|
27
11
|
//# sourceMappingURL=app-toggle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-toggle.js","sources":["../../designsystem/app/app-toggle.js
|
|
1
|
+
{"version":3,"file":"app-toggle.js","sources":["../../designsystem/app/app-toggle.js"],"sourcesContent":["if (\n\ttypeof window !== \"undefined\" &&\n\twindow.CSSStyleSheet &&\n\tdocument.adoptedStyleSheets\n)\n\t(() => {\n\t\tconst key = \"--mtds-app-expanded\";\n\t\tconst sheet = new CSSStyleSheet();\n\t\tconst prev = () => !window.localStorage.getItem(key)?.includes(\"false\");\n\n\t\tdocument.adoptedStyleSheets.push(sheet);\n\t\twindow.mtdsToggleAppExpanded = (force) => {\n\t\t\ttry {\n\t\t\t\tconst next = force ?? !prev();\n\t\t\t\tsheet.replaceSync?.(`:root { ${key}: var(${key}--${next})}`);\n\t\t\t\twindow.localStorage.setItem(key, next);\n\t\t\t} catch (_err) {} // localStorage is full or replaceSync is not supported\n\t\t};\n\n\t\t// Set and store initial state\n\t\twindow.mtdsToggleAppExpanded(prev());\n\t})();\n"],"names":["key","sheet","prev","force","next"],"mappings":"AACC,OAAO,SAAW,OAClB,OAAO,iBACP,SAAS,uBAER,MAAM;AACN,QAAMA,IAAM,uBACNC,IAAQ,IAAI,cAAa,GACzBC,IAAO,MAAM,CAAC,OAAO,aAAa,QAAQF,CAAG,GAAG,SAAS,OAAO;AAEtE,WAAS,mBAAmB,KAAKC,CAAK,GACtC,OAAO,wBAAwB,CAACE,MAAU;AACzC,QAAI;AACH,YAAMC,IAAOD,KAAS,CAACD,EAAI;AAC3B,MAAAD,EAAM,cAAc,WAAWD,CAAG,SAASA,CAAG,KAAKI,CAAI,IAAI,GAC3D,OAAO,aAAa,QAAQJ,GAAKI,CAAI;AAAA,IACtC,QAAe;AAAA,IAAC;AAAA,EACjB,GAGA,OAAO,sBAAsBF,GAAM;AACpC,GAAC;"}
|
package/mtds/app/app-toggle2.js
CHANGED
|
@@ -1,11 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
const t = `if (
|
|
2
|
+
typeof window !== "undefined" &&
|
|
3
|
+
window.CSSStyleSheet &&
|
|
4
|
+
document.adoptedStyleSheets
|
|
5
|
+
)
|
|
6
|
+
(() => {
|
|
7
|
+
const key = "--mtds-app-expanded";
|
|
8
|
+
const sheet = new CSSStyleSheet();
|
|
9
|
+
const prev = () => !window.localStorage.getItem(key)?.includes("false");
|
|
10
|
+
|
|
11
|
+
document.adoptedStyleSheets.push(sheet);
|
|
12
|
+
window.mtdsToggleAppExpanded = (force) => {
|
|
13
|
+
try {
|
|
14
|
+
const next = force ?? !prev();
|
|
15
|
+
sheet.replaceSync?.(\`:root { \${key}: var(\${key}--\${next})}\`);
|
|
16
|
+
window.localStorage.setItem(key, next);
|
|
17
|
+
} catch (_err) {} // localStorage is full or replaceSync is not supported
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
// Set and store initial state
|
|
21
|
+
window.mtdsToggleAppExpanded(prev());
|
|
22
|
+
})();
|
|
23
|
+
`;
|
|
24
|
+
export {
|
|
25
|
+
t as default
|
|
26
|
+
};
|
|
11
27
|
//# sourceMappingURL=app-toggle2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-toggle2.js","sources":["../../designsystem/app/app-toggle.js"],"sourcesContent":["if (
|
|
1
|
+
{"version":3,"file":"app-toggle2.js","sources":["../../designsystem/app/app-toggle.js?raw"],"sourcesContent":["export default \"if (\\n\\ttypeof window !== \\\"undefined\\\" &&\\n\\twindow.CSSStyleSheet &&\\n\\tdocument.adoptedStyleSheets\\n)\\n\\t(() => {\\n\\t\\tconst key = \\\"--mtds-app-expanded\\\";\\n\\t\\tconst sheet = new CSSStyleSheet();\\n\\t\\tconst prev = () => !window.localStorage.getItem(key)?.includes(\\\"false\\\");\\n\\n\\t\\tdocument.adoptedStyleSheets.push(sheet);\\n\\t\\twindow.mtdsToggleAppExpanded = (force) => {\\n\\t\\t\\ttry {\\n\\t\\t\\t\\tconst next = force ?? !prev();\\n\\t\\t\\t\\tsheet.replaceSync?.(`:root { ${key}: var(${key}--${next})}`);\\n\\t\\t\\t\\twindow.localStorage.setItem(key, next);\\n\\t\\t\\t} catch (_err) {} // localStorage is full or replaceSync is not supported\\n\\t\\t};\\n\\n\\t\\t// Set and store initial state\\n\\t\\twindow.mtdsToggleAppExpanded(prev());\\n\\t})();\\n\""],"names":["script"],"mappings":"AAAA,MAAAA,IAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
|
package/mtds/app/app.js
CHANGED
|
@@ -3,7 +3,7 @@ import a from "clsx";
|
|
|
3
3
|
import { forwardRef as p } from "react";
|
|
4
4
|
import { Button as s } from "../button/button.js";
|
|
5
5
|
import c from "../styles.module.css.js";
|
|
6
|
-
import d from "./app-
|
|
6
|
+
import d from "./app-toggle2.js";
|
|
7
7
|
const f = p(function({ as: t, className: r, ...i }, e) {
|
|
8
8
|
return /* @__PURE__ */ o(t || "div", { className: a(c.app, r), ref: e, ...i });
|
|
9
9
|
}), u = p(function({ as: t, className: r, ...i }, e) {
|
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { IS_BROWSER as
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
) : [],
|
|
6
|
-
for (const
|
|
7
|
-
|
|
8
|
-
},
|
|
9
|
-
clientX:
|
|
10
|
-
clientY:
|
|
11
|
-
target:
|
|
1
|
+
import m from "../styles.module.css.js";
|
|
2
|
+
import { IS_BROWSER as f, onLoaded as u, on as g, QUICK_EVENT as p, createOptimizedMutationObserver as h, attr as e } from "../utils.js";
|
|
3
|
+
const b = m.dialog.split(" ")[0], c = f ? document.getElementsByClassName(
|
|
4
|
+
b
|
|
5
|
+
) : [], C = () => {
|
|
6
|
+
for (const o of c)
|
|
7
|
+
o.isConnected && o.showModal && o.close && (o.matches('[open]:not([data-modal="false"]):not(:modal)') ? (e(o, "open", null), o.showModal()) : o.matches(":modal:not([open])") && (e(o, "open", ""), o.close()));
|
|
8
|
+
}, I = ({
|
|
9
|
+
clientX: o,
|
|
10
|
+
clientY: s,
|
|
11
|
+
target: n
|
|
12
12
|
}) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
for (const t of c)
|
|
14
|
+
if (t.open && e(t, "data-closedby") === "any") {
|
|
15
|
+
const { top: i, right: a, bottom: d, left: r } = t.getBoundingClientRect();
|
|
16
|
+
if (!(i <= s && s <= d && r <= o && o <= a)) return t.close();
|
|
17
|
+
}
|
|
18
|
+
const l = n?.closest?.("dialog");
|
|
19
|
+
l && n?.closest?.('[data-command="close"]') && l.close();
|
|
19
20
|
};
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
u(() => {
|
|
22
|
+
g(document, "click", I, p), h(C).observe(
|
|
22
23
|
document.documentElement,
|
|
23
24
|
{
|
|
24
25
|
attributeFilter: ["open"],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog-observer.js","sources":["../../designsystem/dialog/dialog-observer.ts"],"sourcesContent":["import styles from \"../styles.module.css\";\nimport {\n\tattr,\n\tcreateOptimizedMutationObserver,\n\tIS_BROWSER,\n\ton,\n\tonLoaded,\n\tQUICK_EVENT,\n} from \"../utils\";\n\nconst CSS_DIALOG = styles.dialog.split(\" \")[0];\nconst DIALOGS = IS_BROWSER\n\t? (document.getElementsByClassName(\n\t\t\tCSS_DIALOG,\n\t\t) as HTMLCollectionOf<HTMLDialogElement>)\n\t: [];\n\nconst handleModal = () => {\n\tfor (const dialog of DIALOGS)\n\t\tif (dialog.isConnected && dialog.showModal && dialog.close) {\n\t\t\tif (dialog.matches('[open]:not([data-modal=\"false\"]):not(:modal)')) {\n\t\t\t\tattr(dialog, \"open\", null); // Using attribute instead of .close to avoid `close` event\n\t\t\t\tdialog.showModal();\n\t\t\t} else if (dialog.matches(\":modal:not([open])\")) {\n\t\t\t\tattr(dialog, \"open\", \"\"); // Set as open\n\t\t\t\tdialog.close(); // So we correclty can call .close, removing <dialog> from #top-layer\n\t\t\t}\n\t\t}\n};\n\nconst handleDialogClick = ({\n\tclientX: x,\n\tclientY: y,\n\ttarget: el,\n}: MouseEvent) => {\n\
|
|
1
|
+
{"version":3,"file":"dialog-observer.js","sources":["../../designsystem/dialog/dialog-observer.ts"],"sourcesContent":["import styles from \"../styles.module.css\";\nimport {\n\tattr,\n\tcreateOptimizedMutationObserver,\n\tIS_BROWSER,\n\ton,\n\tonLoaded,\n\tQUICK_EVENT,\n} from \"../utils\";\n\nconst CSS_DIALOG = styles.dialog.split(\" \")[0];\nconst DIALOGS = IS_BROWSER\n\t? (document.getElementsByClassName(\n\t\t\tCSS_DIALOG,\n\t\t) as HTMLCollectionOf<HTMLDialogElement>)\n\t: [];\n\nconst handleModal = () => {\n\tfor (const dialog of DIALOGS)\n\t\tif (dialog.isConnected && dialog.showModal && dialog.close) {\n\t\t\tif (dialog.matches('[open]:not([data-modal=\"false\"]):not(:modal)')) {\n\t\t\t\tattr(dialog, \"open\", null); // Using attribute instead of .close to avoid `close` event\n\t\t\t\tdialog.showModal();\n\t\t\t} else if (dialog.matches(\":modal:not([open])\")) {\n\t\t\t\tattr(dialog, \"open\", \"\"); // Set as open\n\t\t\t\tdialog.close(); // So we correclty can call .close, removing <dialog> from #top-layer\n\t\t\t}\n\t\t}\n};\n\nconst handleDialogClick = ({\n\tclientX: x,\n\tclientY: y,\n\ttarget: el,\n}: MouseEvent) => {\n\tfor (const dialog of DIALOGS)\n\t\tif (dialog.open && attr(dialog, \"data-closedby\") === \"any\") {\n\t\t\tconst { top, right, bottom, left } = dialog.getBoundingClientRect();\n\t\t\tconst isInside = top <= y && y <= bottom && left <= x && x <= right;\n\t\t\tif (!isInside) return dialog.close();\n\t\t}\n\tconst dialog = (el as Element)?.closest?.(\"dialog\");\n\tconst close = dialog && (el as Element)?.closest?.('[data-command=\"close\"]');\n\tif (close) dialog.close();\n};\n\nonLoaded(() => {\n\ton(document, \"click\", handleDialogClick as EventListener, QUICK_EVENT);\n\tcreateOptimizedMutationObserver(handleModal).observe(\n\t\tdocument.documentElement,\n\t\t{\n\t\t\tattributeFilter: [\"open\"],\n\t\t\tattributes: true,\n\t\t\tchildList: true,\n\t\t\tsubtree: true,\n\t\t},\n\t);\n});\n"],"names":["CSS_DIALOG","styles","DIALOGS","IS_BROWSER","handleModal","dialog","attr","handleDialogClick","x","y","el","top","right","bottom","left","onLoaded","on","QUICK_EVENT","createOptimizedMutationObserver"],"mappings":";;AAUA,MAAMA,IAAaC,EAAO,OAAO,MAAM,GAAG,EAAE,CAAC,GACvCC,IAAUC,IACZ,SAAS;AAAA,EACVH;AACD,IACC,CAAA,GAEGI,IAAc,MAAM;AACzB,aAAWC,KAAUH;AACpB,IAAIG,EAAO,eAAeA,EAAO,aAAaA,EAAO,UAChDA,EAAO,QAAQ,8CAA8C,KAChEC,EAAKD,GAAQ,QAAQ,IAAI,GACzBA,EAAO,UAAA,KACGA,EAAO,QAAQ,oBAAoB,MAC7CC,EAAKD,GAAQ,QAAQ,EAAE,GACvBA,EAAO,MAAA;AAGX,GAEME,IAAoB,CAAC;AAAA,EAC1B,SAASC;AAAA,EACT,SAASC;AAAA,EACT,QAAQC;AACT,MAAkB;AACjB,aAAWL,KAAUH;AACpB,QAAIG,EAAO,QAAQC,EAAKD,GAAQ,eAAe,MAAM,OAAO;AAC3D,YAAM,EAAE,KAAAM,GAAK,OAAAC,GAAO,QAAAC,GAAQ,MAAAC,EAAA,IAAST,EAAO,sBAAA;AAE5C,UAAI,EADaM,KAAOF,KAAKA,KAAKI,KAAUC,KAAQN,KAAKA,KAAKI,GAC/C,QAAOP,EAAO,MAAA;AAAA,IAC9B;AACD,QAAMA,IAAUK,GAAgB,UAAU,QAAQ;AAElD,EADcL,KAAWK,GAAgB,UAAU,wBAAwB,OACzD,MAAA;AACnB;AAEAK,EAAS,MAAM;AACd,EAAAC,EAAG,UAAU,SAAST,GAAoCU,CAAW,GACrEC,EAAgCd,CAAW,EAAE;AAAA,IAC5C,SAAS;AAAA,IACT;AAAA,MACC,iBAAiB,CAAC,MAAM;AAAA,MACxB,YAAY;AAAA,MACZ,WAAW;AAAA,MACX,SAAS;AAAA,IAAA;AAAA,EACV;AAEF,CAAC;"}
|
|
@@ -8,5 +8,7 @@ export declare const Default: Story;
|
|
|
8
8
|
export declare const React: Story;
|
|
9
9
|
export declare const WithClose: Story;
|
|
10
10
|
export declare const WithBackdropClose: Story;
|
|
11
|
+
export declare const WithStickyFooter: Story;
|
|
11
12
|
export declare const WithoutBackdrop: Story;
|
|
12
|
-
export declare const
|
|
13
|
+
export declare const VariantDrawer: Story;
|
|
14
|
+
export declare const VariantDrawerWithoutBackdrop: Story;
|