@mattilsynet/design 1.1.0 → 1.1.2
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/card/card.d.ts +1 -6
- package/mtds/card/card.js +11 -22
- package/mtds/card/card.js.map +1 -1
- package/mtds/details/details.js +9 -9
- package/mtds/details/details.js.map +1 -1
- package/mtds/dialog/dialog-observer.js +12 -17
- package/mtds/dialog/dialog-observer.js.map +1 -1
- package/mtds/field/field-observer.js +20 -19
- package/mtds/field/field-observer.js.map +1 -1
- package/mtds/field/field.js +56 -55
- package/mtds/field/field.js.map +1 -1
- package/mtds/fieldset/fieldset-observer.js +16 -15
- package/mtds/fieldset/fieldset-observer.js.map +1 -1
- package/mtds/index.iife.js +5 -5
- package/mtds/layout/app-observer.js +23 -25
- package/mtds/layout/app-observer.js.map +1 -1
- package/mtds/layout/layout.stories.d.ts +1 -0
- package/mtds/logo/logo-observer.js +8 -10
- package/mtds/logo/logo-observer.js.map +1 -1
- package/mtds/popover/popover-observer.js +15 -15
- package/mtds/popover/popover-observer.js.map +1 -1
- package/mtds/progress/progress.js +8 -15
- package/mtds/progress/progress.js.map +1 -1
- package/mtds/styles.css +1 -1
- package/mtds/styles.json +35 -35
- package/mtds/styles.module.css.js +25 -25
- package/mtds/table/table-observer.js +1 -3
- package/mtds/table/table-observer.js.map +1 -1
- package/mtds/tabs/tabs.js +20 -18
- package/mtds/tabs/tabs.js.map +1 -1
- package/mtds/tooltip/tooltip-observer.js +24 -24
- package/mtds/tooltip/tooltip-observer.js.map +1 -1
- package/mtds/utils.d.ts +16 -8
- package/mtds/utils.js +50 -66
- package/mtds/utils.js.map +1 -1
- package/package.json +1 -2
- package/mtds/index.iife.js.map +0 -1
|
@@ -1,36 +1,34 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { IS_BROWSER as
|
|
3
|
-
const
|
|
1
|
+
import I from "../styles.module.css.js";
|
|
2
|
+
import { IS_BROWSER as E, onLoaded as A, onMutation as v, on as w, QUICK_EVENT as O } from "../utils.js";
|
|
3
|
+
const l = E ? new CSSStyleSheet() : null, S = I.app.split(" ")[0], T = `.${S} > nav, .${S} nav:has(+ main)`, V = '[data-command="toggle-app-expanded"]', a = "--mtdsc-app-expanded", Y = 960;
|
|
4
4
|
function x(e) {
|
|
5
|
-
e.target instanceof Element && (e.target.closest(V) && (e.preventDefault(), document.startViewTransition ? document.startViewTransition(u) : u()), window.innerWidth <= Y && e.target.matches(
|
|
5
|
+
e.target instanceof Element && (e.target.closest(V) && (e.preventDefault(), document.startViewTransition ? document.startViewTransition(u) : u()), window.innerWidth <= Y && e.target.matches(T) && console.log(e.target));
|
|
6
6
|
}
|
|
7
|
-
let t,
|
|
7
|
+
let t, h;
|
|
8
8
|
function C(e) {
|
|
9
|
-
for (const
|
|
10
|
-
|
|
11
|
-
t = c, T = h;
|
|
12
|
-
}
|
|
9
|
+
for (const o of e)
|
|
10
|
+
o.isConnected && (t = o.querySelector(T), h = o.querySelector("main"));
|
|
13
11
|
}
|
|
14
12
|
function u(e = !0) {
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
`:root { ${
|
|
18
|
-
), window.localStorage.setItem(
|
|
13
|
+
const o = window.localStorage.getItem(a) !== "false", g = e ? !o : o;
|
|
14
|
+
l == null || l.replaceSync(
|
|
15
|
+
`:root { ${a}: var(${a}--${g}) }`
|
|
16
|
+
), window.localStorage.setItem(a, `${g}`);
|
|
19
17
|
}
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
let
|
|
24
|
-
const
|
|
18
|
+
var N;
|
|
19
|
+
l && ((N = document.adoptedStyleSheets) == null || N.push(l));
|
|
20
|
+
E && u(!1);
|
|
21
|
+
let m = 0, i = 0, c = 0, n, s = 0, _ = 0, r = 0, P = !1;
|
|
22
|
+
const p = "--mtdsc-app-nav-align", y = "--mtdsc-app-nav-bottom", d = "--mtdsc-app-nav-position", f = "--mtdsc-app-nav-top";
|
|
25
23
|
function K() {
|
|
26
24
|
if (!(t != null && t.isConnected)) return;
|
|
27
|
-
const e = window.scrollY,
|
|
28
|
-
r = e,
|
|
29
|
-
|
|
30
|
-
`${Math.min(
|
|
31
|
-
), t.style.removeProperty(
|
|
25
|
+
const e = window.scrollY, o = e < r;
|
|
26
|
+
r = e, o !== n && (m = t.offsetHeight, P = t.offsetHeight <= window.innerHeight, i = t.offsetTop, c = h.offsetTop, n = o, _ = window.innerHeight), !(s === -1 && P) && (s !== -1 && (P || n && r <= i) ? (t.style.setProperty(d, "sticky"), t.style.setProperty(f, "0px"), t.style.removeProperty(y), t.style.setProperty(p, "start"), s = -1) : s === -1 && !n ? (t.style.setProperty(d, "relative"), t.style.setProperty(f, `${Math.max(0, r - c)}px`), t.style.removeProperty(y), t.style.setProperty(p, "start"), s = 0) : s !== 1 && !n && r + _ >= i + m ? (t.style.setProperty(d, "sticky"), t.style.removeProperty(f), t.style.setProperty(y, "0px"), t.style.setProperty(p, "end"), s = 1) : s === 1 && n && (t.style.setProperty(d, "relative"), t.style.setProperty(
|
|
27
|
+
f,
|
|
28
|
+
`${Math.min(i - c, r + _ - m - c)}px`
|
|
29
|
+
), t.style.removeProperty(y), t.style.setProperty(p, "start"), s = 0));
|
|
32
30
|
}
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
A(() => {
|
|
32
|
+
v(document.documentElement, S, C), w(window, "scroll", K, O), w(document, "click", x);
|
|
35
33
|
});
|
|
36
34
|
//# sourceMappingURL=app-observer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-observer.js","sources":["../../designsystem/layout/app-observer.ts"],"sourcesContent":["import styles from \"../styles.module.css\";\nimport { IS_BROWSER, QUICK_EVENT, on, onLoaded, onMutation } from \"../utils\";\n\n// Setting app-expanded as CSS custom property of constructed style sheet to\n// avoid flash of unstyled content and still be Next.js hydration compatible\nconst CSS_SHEET = IS_BROWSER ? new CSSStyleSheet() : null;\nconst CSS_APP = styles.app.split(\" \")[0];\nconst CSS_NAV = `.${CSS_APP} > nav, .${CSS_APP} nav:has(+ main)`;\nconst CSS_TOGGLE = '[data-command=\"toggle-app-expanded\"]';\nconst KEY_TOGGLE = \"--mtdsc-app-expanded\";\nconst MOBILE_NAV_BREAKPOINT = 960;\n\nfunction handleToggleClick(event: Event) {\n\tif (event.target instanceof Element) {\n\t\tif (event.target.closest(CSS_TOGGLE)) {\n\t\t\tevent.preventDefault(); // Ensure button does not cause submit even without `type=\"button\"`\n\t\t\tif (!document.startViewTransition) toggleExpanded();\n\t\t\telse document.startViewTransition(toggleExpanded);\n\t\t}\n\t\tif (\n\t\t\twindow.innerWidth <= MOBILE_NAV_BREAKPOINT &&\n\t\t\tevent.target.matches(CSS_NAV)\n\t\t) {\n\t\t\tconsole.log(event.target);\n\t\t}\n\t}\n}\n\n// TODO Better handle for when app is not in DOM\nlet NAV: HTMLElement;\nlet MAIN: HTMLElement;\nfunction handleMutation(apps: HTMLCollectionOf<HTMLElement>) {\n\tfor (const app of apps) {\n\t\
|
|
1
|
+
{"version":3,"file":"app-observer.js","sources":["../../designsystem/layout/app-observer.ts"],"sourcesContent":["import styles from \"../styles.module.css\";\nimport { IS_BROWSER, QUICK_EVENT, on, onLoaded, onMutation } from \"../utils\";\n\n// Setting app-expanded as CSS custom property of constructed style sheet to\n// avoid flash of unstyled content and still be Next.js hydration compatible\nconst CSS_SHEET = IS_BROWSER ? new CSSStyleSheet() : null;\nconst CSS_APP = styles.app.split(\" \")[0];\nconst CSS_NAV = `.${CSS_APP} > nav, .${CSS_APP} nav:has(+ main)`;\nconst CSS_TOGGLE = '[data-command=\"toggle-app-expanded\"]';\nconst KEY_TOGGLE = \"--mtdsc-app-expanded\";\nconst MOBILE_NAV_BREAKPOINT = 960;\n\nfunction handleToggleClick(event: Event) {\n\tif (event.target instanceof Element) {\n\t\tif (event.target.closest(CSS_TOGGLE)) {\n\t\t\tevent.preventDefault(); // Ensure button does not cause submit even without `type=\"button\"`\n\t\t\tif (!document.startViewTransition) toggleExpanded();\n\t\t\telse document.startViewTransition(toggleExpanded);\n\t\t}\n\t\tif (\n\t\t\twindow.innerWidth <= MOBILE_NAV_BREAKPOINT &&\n\t\t\tevent.target.matches(CSS_NAV)\n\t\t) {\n\t\t\tconsole.log(event.target);\n\t\t}\n\t}\n}\n\n// TODO Better handle for when app is not in DOM\nlet NAV: HTMLElement;\nlet MAIN: HTMLElement;\nfunction handleMutation(apps: HTMLCollectionOf<HTMLElement>) {\n\tfor (const app of apps)\n\t\tif (app.isConnected) {\n\t\t\tNAV = app.querySelector<HTMLElement>(CSS_NAV) as HTMLElement;\n\t\t\tMAIN = app.querySelector<HTMLElement>(\"main\") as HTMLElement;\n\t\t}\n}\n\nfunction toggleExpanded(toggle = true) {\n\tconst prev = window.localStorage.getItem(KEY_TOGGLE) !== \"false\";\n\tconst next = toggle ? !prev : prev;\n\tCSS_SHEET?.replaceSync(\n\t\t`:root { ${KEY_TOGGLE}: var(${KEY_TOGGLE}--${next}) }`,\n\t);\n\t// document.querySelector(`.${CSS_APP} aside`)?.toggleAttribute(\"hidden\"); // Just for testing\n\twindow.localStorage.setItem(KEY_TOGGLE, `${next}`);\n}\n\n// Run instantly to avoid flash of unstyled content\n// Using adoptedStyleSheets to avoid Next.js hydration conflict\nif (CSS_SHEET) document.adoptedStyleSheets?.push(CSS_SHEET);\nif (IS_BROWSER) toggleExpanded(false); // Sync UI with store\n\nlet NAV_H = 0;\nlet NAV_Y = 0;\nlet OFFSET_Y = 0; // Used to figure min top of the sidebar\nlet SCROLL_UP: boolean;\nlet STICK_DIR = 0; // -1 = stick top, 0 = relative, 1 = stick bottom\nlet WIN_H = 0;\nlet WIN_Y = 0;\nlet NAV_LT_WIN = false; // Used to figure if nav is larger than viewport\nconst KEY_NAV_ALIGN = \"--mtdsc-app-nav-align\";\nconst KEY_NAV_BOTTOM = \"--mtdsc-app-nav-bottom\";\nconst KEY_NAV_POS = \"--mtdsc-app-nav-position\";\nconst KEY_NAV_TOP = \"--mtdsc-app-nav-top\";\n\nfunction handleScroll() {\n\tif (!NAV?.isConnected) return;\n\tconst NEXT_Y = window.scrollY;\n\tconst NEXT_UP = NEXT_Y < WIN_Y;\n\tWIN_Y = NEXT_Y;\n\n\t// Only calculate if scroll direction has changed\n\tif (NEXT_UP !== SCROLL_UP) {\n\t\tNAV_H = NAV.offsetHeight;\n\t\tNAV_LT_WIN = NAV.offsetHeight <= window.innerHeight;\n\t\tNAV_Y = NAV.offsetTop;\n\t\tOFFSET_Y = MAIN.offsetTop;\n\t\tSCROLL_UP = NEXT_UP;\n\t\tWIN_H = window.innerHeight;\n\t}\n\n\tif (STICK_DIR === -1 && NAV_LT_WIN) return; // Allways sticky when sidebar is smaller than viewport\n\tif (STICK_DIR !== -1 && (NAV_LT_WIN || (SCROLL_UP && WIN_Y <= NAV_Y))) {\n\t\t// Not sticking to top and scrolling up or sidebar is smaller than viewport\n\t\tNAV.style.setProperty(KEY_NAV_POS, \"sticky\");\n\t\tNAV.style.setProperty(KEY_NAV_TOP, \"0px\");\n\t\tNAV.style.removeProperty(KEY_NAV_BOTTOM);\n\t\tNAV.style.setProperty(KEY_NAV_ALIGN, \"start\");\n\t\tSTICK_DIR = -1;\n\t\t// console.log(\"a\");\n\t} else if (STICK_DIR === -1 && !SCROLL_UP) {\n\t\t// Sticking to top and scrolling down\n\t\tNAV.style.setProperty(KEY_NAV_POS, \"relative\");\n\t\tNAV.style.setProperty(KEY_NAV_TOP, `${Math.max(0, WIN_Y - OFFSET_Y)}px`);\n\t\tNAV.style.removeProperty(KEY_NAV_BOTTOM);\n\t\tNAV.style.setProperty(KEY_NAV_ALIGN, \"start\");\n\t\tSTICK_DIR = 0;\n\t\t// console.log(\"b\");\n\t} else if (STICK_DIR !== 1 && !SCROLL_UP && WIN_Y + WIN_H >= NAV_Y + NAV_H) {\n\t\t// Not sticking to bottom and scrolling down\n\t\tNAV.style.setProperty(KEY_NAV_POS, \"sticky\");\n\t\tNAV.style.removeProperty(KEY_NAV_TOP);\n\t\tNAV.style.setProperty(KEY_NAV_BOTTOM, \"0px\");\n\t\tNAV.style.setProperty(KEY_NAV_ALIGN, \"end\");\n\t\tSTICK_DIR = 1;\n\t\t// console.log(\"c\");\n\t} else if (STICK_DIR === 1 && SCROLL_UP) {\n\t\tNAV.style.setProperty(KEY_NAV_POS, \"relative\");\n\t\tNAV.style.setProperty(\n\t\t\tKEY_NAV_TOP,\n\t\t\t`${Math.min(NAV_Y - OFFSET_Y, WIN_Y + WIN_H - NAV_H - OFFSET_Y)}px`,\n\t\t);\n\t\tNAV.style.removeProperty(KEY_NAV_BOTTOM);\n\t\tNAV.style.setProperty(KEY_NAV_ALIGN, \"start\");\n\t\tSTICK_DIR = 0;\n\t\t// console.log(\"d\");\n\t}\n}\n\nonLoaded(() => {\n\tonMutation(document.documentElement, CSS_APP, handleMutation);\n\ton(window, \"scroll\", handleScroll, QUICK_EVENT);\n\ton(document, \"click\", handleToggleClick);\n});\n"],"names":["CSS_SHEET","IS_BROWSER","CSS_APP","styles","CSS_NAV","CSS_TOGGLE","KEY_TOGGLE","MOBILE_NAV_BREAKPOINT","handleToggleClick","event","toggleExpanded","NAV","MAIN","handleMutation","apps","app","toggle","prev","next","_a","NAV_H","NAV_Y","OFFSET_Y","SCROLL_UP","STICK_DIR","WIN_H","WIN_Y","NAV_LT_WIN","KEY_NAV_ALIGN","KEY_NAV_BOTTOM","KEY_NAV_POS","KEY_NAV_TOP","handleScroll","NEXT_Y","NEXT_UP","onLoaded","onMutation","on","QUICK_EVENT"],"mappings":"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"}
|
|
@@ -16,6 +16,7 @@ export declare const React: Story;
|
|
|
16
16
|
export declare const Gap: Story;
|
|
17
17
|
export declare const Center: Story;
|
|
18
18
|
export declare const ItemSizes: Story;
|
|
19
|
+
export declare const ItemFixed: Story;
|
|
19
20
|
export declare const Align: Story;
|
|
20
21
|
export declare const Justify: Story;
|
|
21
22
|
export declare const AlignContent: Story;
|
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
import a from "../styles.module.css.js";
|
|
2
|
-
import { onLoaded as
|
|
3
|
-
const
|
|
2
|
+
import { onLoaded as o, onMutation as d } from "../utils.js";
|
|
3
|
+
const l = a.logo.split(" ")[0];
|
|
4
4
|
function m([t]) {
|
|
5
|
-
if ((t == null ? void 0 : t.firstElementChild) instanceof SVGSVGElement) {
|
|
6
|
-
for (const
|
|
7
|
-
|
|
8
|
-
const e = t.firstElementChild, n = t == null ? void 0 : t.hasAttribute("data-env"),
|
|
5
|
+
if (t != null && t.isConnected && (t == null ? void 0 : t.firstElementChild) instanceof SVGSVGElement) {
|
|
6
|
+
for (const c of document.head.querySelectorAll("link[rel~='icon']"))
|
|
7
|
+
c.remove();
|
|
8
|
+
const e = t.firstElementChild, n = t == null ? void 0 : t.hasAttribute("data-env"), i = window.getComputedStyle(e), r = i.getPropertyValue("color"), s = i.getPropertyValue("--mtds-logo-color");
|
|
9
9
|
document.head.appendChild(
|
|
10
10
|
Object.assign(document.createElement("link"), {
|
|
11
|
-
href: `data:image/svg+xml,${encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 55 55'><rect fill='${n ? "none" :
|
|
11
|
+
href: `data:image/svg+xml,${encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 55 55'><rect fill='${n ? "none" : s}' width='51' height='51' x='2' y='2' stroke='${r}' stroke-dasharray='0.09 6.38' stroke-linecap='round' stroke-opacity='${n ? 0.6 : 0}' stroke-width='2.3' rx='25.5'/><g transform="translate(7.5 7.5)">${e.outerHTML.replace(/(fill|width|height|xmlns)=\S+/gi, "").replace("<svg", `<svg width="40" height="40" fill="${r}"`)}</g></svg>`)}`,
|
|
12
12
|
rel: "icon"
|
|
13
13
|
})
|
|
14
14
|
);
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
l(document.documentElement, d, m);
|
|
19
|
-
});
|
|
17
|
+
o(() => d(document.documentElement, l, m));
|
|
20
18
|
//# sourceMappingURL=logo-observer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logo-observer.js","sources":["../../designsystem/logo/logo-observer.ts"],"sourcesContent":["import styles from \"../styles.module.css\";\nimport { onLoaded, onMutation } from \"../utils\";\n\nconst CSS_LOGO = styles.logo.split(\" \")[0];\n\nfunction handleMutation([logo]: HTMLCollectionOf<HTMLElement>) {\n\tif (logo?.firstElementChild instanceof SVGSVGElement) {\n\t\tfor (const icon of document.head.querySelectorAll(\"link[rel~='icon']\"))\n\t\t\ticon.remove();\n\n\t\tconst svg = logo.firstElementChild;\n\t\tconst isDot = logo?.hasAttribute(\"data-env\");\n\t\tconst style = window.getComputedStyle(svg);\n\t\tconst text = style.getPropertyValue(\"color\");\n\t\tconst back = style.getPropertyValue(\"--mtds-logo-color\");\n\n\t\tdocument.head.appendChild(\n\t\t\tObject.assign(document.createElement(\"link\"), {\n\t\t\t\thref: `data:image/svg+xml,${encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 55 55'><rect fill='${isDot ? \"none\" : back}' width='51' height='51' x='2' y='2' stroke='${text}' stroke-dasharray='0.09 6.38' stroke-linecap='round' stroke-opacity='${isDot ? 0.6 : 0}' stroke-width='2.3' rx='25.5'/><g transform=\"translate(7.5 7.5)\">${svg.outerHTML.replace(/(fill|width|height|xmlns)=\\S+/gi, \"\").replace(\"<svg\", `<svg width=\"40\" height=\"40\" fill=\"${text}\"`)}</g></svg>`)}`,\n\t\t\t\trel: \"icon\",\n\t\t\t}),\n\t\t);\n\t}\n}\n\nonLoaded(() =>
|
|
1
|
+
{"version":3,"file":"logo-observer.js","sources":["../../designsystem/logo/logo-observer.ts"],"sourcesContent":["import styles from \"../styles.module.css\";\nimport { onLoaded, onMutation } from \"../utils\";\n\nconst CSS_LOGO = styles.logo.split(\" \")[0];\n\nfunction handleMutation([logo]: HTMLCollectionOf<HTMLElement>) {\n\tif (logo?.isConnected && logo?.firstElementChild instanceof SVGSVGElement) {\n\t\tfor (const icon of document.head.querySelectorAll(\"link[rel~='icon']\"))\n\t\t\ticon.remove();\n\n\t\tconst svg = logo.firstElementChild;\n\t\tconst isDot = logo?.hasAttribute(\"data-env\");\n\t\tconst style = window.getComputedStyle(svg);\n\t\tconst text = style.getPropertyValue(\"color\");\n\t\tconst back = style.getPropertyValue(\"--mtds-logo-color\");\n\n\t\tdocument.head.appendChild(\n\t\t\tObject.assign(document.createElement(\"link\"), {\n\t\t\t\thref: `data:image/svg+xml,${encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 55 55'><rect fill='${isDot ? \"none\" : back}' width='51' height='51' x='2' y='2' stroke='${text}' stroke-dasharray='0.09 6.38' stroke-linecap='round' stroke-opacity='${isDot ? 0.6 : 0}' stroke-width='2.3' rx='25.5'/><g transform=\"translate(7.5 7.5)\">${svg.outerHTML.replace(/(fill|width|height|xmlns)=\\S+/gi, \"\").replace(\"<svg\", `<svg width=\"40\" height=\"40\" fill=\"${text}\"`)}</g></svg>`)}`,\n\t\t\t\trel: \"icon\",\n\t\t\t}),\n\t\t);\n\t}\n}\n\nonLoaded(() => onMutation(document.documentElement, CSS_LOGO, handleMutation));\n"],"names":["CSS_LOGO","styles","handleMutation","logo","icon","svg","isDot","style","text","back","onLoaded","onMutation"],"mappings":";;AAGA,MAAMA,IAAWC,EAAO,KAAK,MAAM,GAAG,EAAE,CAAC;AAEzC,SAASC,EAAe,CAACC,CAAI,GAAkC;AAC9D,MAAIA,KAAA,QAAAA,EAAM,gBAAeA,KAAA,gBAAAA,EAAM,8BAA6B,eAAe;AAC1E,eAAWC,KAAQ,SAAS,KAAK,iBAAiB,mBAAmB;AACpE,MAAAA,EAAK,OAAO;AAEb,UAAMC,IAAMF,EAAK,mBACXG,IAAQH,KAAA,gBAAAA,EAAM,aAAa,aAC3BI,IAAQ,OAAO,iBAAiBF,CAAG,GACnCG,IAAOD,EAAM,iBAAiB,OAAO,GACrCE,IAAOF,EAAM,iBAAiB,mBAAmB;AAEvD,aAAS,KAAK;AAAA,MACb,OAAO,OAAO,SAAS,cAAc,MAAM,GAAG;AAAA,QAC7C,MAAM,sBAAsB,mBAAmB,2EAA2ED,IAAQ,SAASG,CAAI,gDAAgDD,CAAI,yEAAyEF,IAAQ,MAAM,CAAC,qEAAqED,EAAI,UAAU,QAAQ,mCAAmC,EAAE,EAAE,QAAQ,QAAQ,qCAAqCG,CAAI,GAAG,CAAC,YAAY,CAAC;AAAA,QACve,KAAK;AAAA,MACL,CAAA;AAAA,IACF;AAAA,EAAA;AAEF;AAEAE,EAAS,MAAMC,EAAW,SAAS,iBAAiBX,GAAUE,CAAc,CAAC;"}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { onLoaded as
|
|
3
|
-
const
|
|
1
|
+
import d from "../styles.module.css.js";
|
|
2
|
+
import { onLoaded as f, on as l, QUICK_EVENT as g, anchorPosition as a, attr as s } from "../utils.js";
|
|
3
|
+
const p = d.popover.split(" ")[0];
|
|
4
4
|
let i = 0;
|
|
5
|
-
function
|
|
6
|
-
var
|
|
7
|
-
if (o instanceof HTMLElement && o.classList.contains(
|
|
8
|
-
const
|
|
5
|
+
function m({ target: o, newState: t }) {
|
|
6
|
+
var e;
|
|
7
|
+
if (o instanceof HTMLElement && o.classList.contains(p)) {
|
|
8
|
+
const n = (e = o.getRootNode()) == null ? void 0 : e.querySelector(
|
|
9
9
|
`[popovertarget="${o.id}"]`
|
|
10
10
|
);
|
|
11
|
-
|
|
11
|
+
t === "closed" ? (i -= 1, a(o, !1)) : n && (i += 1, a(o, n, s(o, "data-position") || "bottom"));
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
function P({ target: o }) {
|
|
15
|
-
var
|
|
16
|
-
const
|
|
17
|
-
if (
|
|
18
|
-
const
|
|
19
|
-
c
|
|
15
|
+
var e;
|
|
16
|
+
const t = i && ((e = o == null ? void 0 : o.closest) == null ? void 0 : e.call(o, "a,[popovertargetaction]"));
|
|
17
|
+
if (t) {
|
|
18
|
+
const n = s(t, "popovertargetaction") || "toggle", r = n === "show" || (n === "hide" ? !1 : void 0), c = (document.getElementById(s(t, "popovertarget") || "") || t).closest(`.${p}`);
|
|
19
|
+
c != null && c.togglePopover && c.togglePopover(r);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
f(() => {
|
|
23
|
+
l(document, "beforetoggle", m, g), l(document, "click", P);
|
|
24
24
|
});
|
|
25
25
|
//# sourceMappingURL=popover-observer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover-observer.js","sources":["../../designsystem/popover/popover-observer.ts"],"sourcesContent":["import styles from \"../styles.module.css\";\nimport { QUICK_EVENT, anchorPosition, attr, on, onLoaded } from \"../utils\";\n\nconst CSS_POPOVER = styles.popover.split(\" \")[0];\nlet OPEN_POPOVERS = 0; // Speed up by only checking clicks if we have open popovers\n\nfunction handleToggle({ target: el, newState }: Event & { newState?: string }) {\n\tif (el instanceof HTMLElement && el.classList.contains(CSS_POPOVER)) {\n\t\tconst anchor = (el.getRootNode() as ShadowRoot)?.querySelector<HTMLElement>(\n\t\t\t`[popovertarget=\"${el.id}\"]`,\n\t\t);\n\n\t\tif (newState === \"closed\") {\n\t\t\tOPEN_POPOVERS -= 1;\n\t\t\tanchorPosition(el, false);\n\t\t} else if (anchor) {\n\t\t\tOPEN_POPOVERS += 1;\n\t\t\tanchorPosition(el, anchor, attr(el, \"data-position\") || \"bottom\");\n\t\t}\n\t}\n}\n\n// Polyfill popovertarget for <a> (not supported by native)\n// and automatically assume popovertarget is the closest parent popover\n// but respect the popovertarget and popovertargetaction attribute\nfunction handleLinkClick({ target }: Event) {\n\tconst close =\n\t\tOPEN_POPOVERS && (target as Element)?.closest?.(\"a,[popovertargetaction]\");\n\n\tif (close) {\n\t\tconst action = attr(close, \"popovertargetaction\") || \"toggle\";\n\t\tconst open = action === \"show\" || (action === \"hide\" ? false : undefined);\n\t\tconst target
|
|
1
|
+
{"version":3,"file":"popover-observer.js","sources":["../../designsystem/popover/popover-observer.ts"],"sourcesContent":["import styles from \"../styles.module.css\";\nimport { QUICK_EVENT, anchorPosition, attr, on, onLoaded } from \"../utils\";\n\nconst CSS_POPOVER = styles.popover.split(\" \")[0];\nlet OPEN_POPOVERS = 0; // Speed up by only checking clicks if we have open popovers\n\nfunction handleToggle({ target: el, newState }: Event & { newState?: string }) {\n\tif (el instanceof HTMLElement && el.classList.contains(CSS_POPOVER)) {\n\t\tconst anchor = (el.getRootNode() as ShadowRoot)?.querySelector<HTMLElement>(\n\t\t\t`[popovertarget=\"${el.id}\"]`,\n\t\t);\n\n\t\tif (newState === \"closed\") {\n\t\t\tOPEN_POPOVERS -= 1;\n\t\t\tanchorPosition(el, false);\n\t\t} else if (anchor) {\n\t\t\tOPEN_POPOVERS += 1;\n\t\t\tanchorPosition(el, anchor, attr(el, \"data-position\") || \"bottom\");\n\t\t}\n\t}\n}\n\n// Polyfill popovertarget for <a> (not supported by native)\n// and automatically assume popovertarget is the closest parent popover\n// but respect the popovertarget and popovertargetaction attribute\nfunction handleLinkClick({ target }: Event) {\n\tconst close =\n\t\tOPEN_POPOVERS && (target as Element)?.closest?.(\"a,[popovertargetaction]\");\n\n\tif (close) {\n\t\tconst action = attr(close, \"popovertargetaction\") || \"toggle\";\n\t\tconst open = action === \"show\" || (action === \"hide\" ? false : undefined);\n\t\tconst target = document.getElementById(attr(close, \"popovertarget\") || \"\");\n\t\tconst popover = (target || close).closest<HTMLElement>(`.${CSS_POPOVER}`);\n\n\t\tif (popover?.togglePopover) popover.togglePopover(open);\n\t}\n}\n\nonLoaded(() => {\n\ton(document, \"beforetoggle\", handleToggle, QUICK_EVENT); // Use capture since toggle does not bubble\n\ton(document, \"click\", handleLinkClick); // Allow `<a>` to use `popovertarget` as well\n});\n"],"names":["CSS_POPOVER","styles","OPEN_POPOVERS","handleToggle","el","newState","anchor","_a","anchorPosition","attr","handleLinkClick","target","close","action","open","popover","onLoaded","on","QUICK_EVENT"],"mappings":";;AAGA,MAAMA,IAAcC,EAAO,QAAQ,MAAM,GAAG,EAAE,CAAC;AAC/C,IAAIC,IAAgB;AAEpB,SAASC,EAAa,EAAE,QAAQC,GAAI,UAAAC,KAA2C;;AAC9E,MAAID,aAAc,eAAeA,EAAG,UAAU,SAASJ,CAAW,GAAG;AAC9D,UAAAM,KAAUC,IAAAH,EAAG,YAAA,MAAH,gBAAAG,EAAiC;AAAA,MAChD,mBAAmBH,EAAG,EAAE;AAAA;AAGzB,IAAIC,MAAa,YACCH,KAAA,GACjBM,EAAeJ,GAAI,EAAK,KACdE,MACOJ,KAAA,GACjBM,EAAeJ,GAAIE,GAAQG,EAAKL,GAAI,eAAe,KAAK,QAAQ;AAAA,EACjE;AAEF;AAKA,SAASM,EAAgB,EAAE,QAAAC,KAAiB;;AAC3C,QAAMC,IACLV,OAAkBK,IAAAI,KAAA,gBAAAA,EAAoB,YAApB,gBAAAJ,EAAA,KAAAI,GAA8B;AAEjD,MAAIC,GAAO;AACV,UAAMC,IAASJ,EAAKG,GAAO,qBAAqB,KAAK,UAC/CE,IAAOD,MAAW,WAAWA,MAAW,SAAS,KAAQ,SAEzDE,KADS,SAAS,eAAeN,EAAKG,GAAO,eAAe,KAAK,EAAE,KAC9CA,GAAO,QAAqB,IAAIZ,CAAW,EAAE;AAExE,IAAIe,KAAA,QAAAA,EAAS,iBAAuBA,EAAA,cAAcD,CAAI;AAAA,EAAA;AAExD;AAEAE,EAAS,MAAM;AACX,EAAAC,EAAA,UAAU,gBAAgBd,GAAce,CAAW,GACnDD,EAAA,UAAU,SAASP,CAAe;AACtC,CAAC;"}
|
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
const
|
|
6
|
-
function(
|
|
7
|
-
return /* @__PURE__ */
|
|
8
|
-
"u-progress",
|
|
9
|
-
{
|
|
10
|
-
class: e(f.progress, r),
|
|
11
|
-
ref: s,
|
|
12
|
-
...o
|
|
13
|
-
}
|
|
14
|
-
);
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as t } from "react";
|
|
3
|
+
import e from "../styles.module.css.js";
|
|
4
|
+
import { toCustomElementProps as m } from "../utils.js";
|
|
5
|
+
const u = t(
|
|
6
|
+
function(r, o) {
|
|
7
|
+
return /* @__PURE__ */ s("u-progress", { ref: o, ...m(r, e.progress) });
|
|
15
8
|
}
|
|
16
9
|
);
|
|
17
10
|
export {
|
|
18
|
-
|
|
11
|
+
u as Progress
|
|
19
12
|
};
|
|
20
13
|
//# sourceMappingURL=progress.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress.js","sources":["../../designsystem/progress/progress.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"progress.js","sources":["../../designsystem/progress/progress.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport styles from \"../styles.module.css\";\nimport { toCustomElementProps } from \"../utils\";\n\nexport type ProgressProps = React.ComponentPropsWithoutRef<\"progress\">;\nexport const Progress = forwardRef<HTMLProgressElement, ProgressProps>(\n\tfunction Progress(props, ref) {\n\t\treturn (\n\t\t\t<u-progress ref={ref} {...toCustomElementProps(props, styles.progress)} />\n\t\t);\n\t},\n);\n"],"names":["Progress","forwardRef","props","ref","jsx","toCustomElementProps","styles"],"mappings":";;;;AAKO,MAAMA,IAAWC;AAAA,EACvB,SAAkBC,GAAOC,GAAK;AAE5B,WAAA,gBAAAC,EAAC,gBAAW,KAAAD,GAAW,GAAGE,EAAqBH,GAAOI,EAAO,QAAQ,GAAG;AAAA,EAAA;AAG3E;"}
|