@mattilsynet/design 2.2.6 → 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/alert/alert.js +1 -1
- 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.d.ts +1 -1
- package/mtds/app/app.js +11 -42
- package/mtds/app/app.js.map +1 -1
- package/mtds/avatar/avatar.js +1 -1
- package/mtds/badge/badge.js +1 -1
- package/mtds/breadcrumbs/breadcrumbs.js +1 -1
- package/mtds/button/button.js +1 -1
- package/mtds/card/card.js +1 -1
- package/mtds/chart/chart-element.d.ts +1 -1
- package/mtds/chart/chart-element.js +4 -4
- package/mtds/chart/chart-element.js.map +1 -1
- package/mtds/chip/chip.js +1 -1
- package/mtds/details/details.d.ts +2 -0
- package/mtds/details/details.js.map +1 -1
- package/mtds/dialog/dialog-observer.js +20 -19
- package/mtds/dialog/dialog-observer.js.map +1 -1
- package/mtds/dialog/dialog.js +1 -1
- package/mtds/dialog/dialog.stories.d.ts +3 -1
- package/mtds/divider/divider.js +1 -1
- package/mtds/errorsummary/errorsummary.js +1 -1
- package/mtds/field/field-observer.js +3 -3
- package/mtds/field/field.d.ts +3 -5
- package/mtds/field/field.js +69 -99
- package/mtds/field/field.js.map +1 -1
- package/mtds/fieldset/fieldset.js +1 -1
- package/mtds/helptext/helptext.js +1 -1
- package/mtds/index.d.ts +0 -1
- package/mtds/index.iife.js +14 -15
- package/mtds/index.js +5 -5
- package/mtds/input/input.js +1 -1
- package/mtds/layout/layout.js +1 -1
- package/mtds/link/link.js +1 -1
- package/mtds/logo/logo.js +1 -1
- package/mtds/map/map-element.d.ts +47 -0
- package/mtds/map/map-element.js +74 -0
- package/mtds/map/map-element.js.map +1 -0
- package/mtds/map/map.css.js +46 -0
- package/mtds/map/map.css.js.map +1 -0
- package/mtds/map.d.ts +1 -0
- package/mtds/map.iife.js +722 -0
- package/mtds/map.js +8 -0
- package/mtds/map.js.map +1 -0
- package/mtds/package.json.js +1 -1
- package/mtds/pagination/pagination.d.ts +1 -1
- package/mtds/pagination/pagination.js +20 -51
- package/mtds/pagination/pagination.js.map +1 -1
- package/mtds/popover/popover-observer.js +29 -26
- package/mtds/popover/popover-observer.js.map +1 -1
- package/mtds/popover/popover.d.ts +2 -2
- package/mtds/popover/popover.js +1 -1
- package/mtds/popover/popover.js.map +1 -1
- package/mtds/react-types.d.ts +2 -3
- package/mtds/skeleton/skeleton.js +1 -1
- package/mtds/spinner/spinner.js +1 -1
- package/mtds/steps/steps.js +1 -1
- package/mtds/styles.css +1 -1
- package/mtds/styles.json +41 -42
- package/mtds/styles.module.css.js +86 -88
- package/mtds/styles.module.css.js.map +1 -1
- package/mtds/table/table.js +1 -1
- package/mtds/tag/tag.js +1 -1
- package/mtds/toast/toast-helper.js +1 -1
- package/mtds/toast/toast.js +1 -1
- package/mtds/togglegroup/togglegroup.js +1 -1
- package/mtds/tooltip/tooltip-observer.js +1 -1
- package/mtds/typography/typography.js +1 -1
- package/mtds/utils.js +2 -2
- package/mtds/validation/validation.js +1 -1
- package/package.json +17 -9
- package/mtds/external/@floating-ui/core/dist/floating-ui.core.js +0 -342
- package/mtds/external/@floating-ui/core/dist/floating-ui.core.js.map +0 -1
- package/mtds/external/@floating-ui/dom/dist/floating-ui.dom.js +0 -399
- package/mtds/external/@floating-ui/dom/dist/floating-ui.dom.js.map +0 -1
- package/mtds/external/@floating-ui/utils/dist/floating-ui.utils.dom.js +0 -137
- package/mtds/external/@floating-ui/utils/dist/floating-ui.utils.dom.js.map +0 -1
- package/mtds/external/@floating-ui/utils/dist/floating-ui.utils.js +0 -130
- package/mtds/external/@floating-ui/utils/dist/floating-ui.utils.js.map +0 -1
- package/mtds/external/@u-elements/u-combobox/dist/u-combobox.js +0 -266
- package/mtds/external/@u-elements/u-combobox/dist/u-combobox.js.map +0 -1
- package/mtds/external/@u-elements/u-datalist/dist/u-datalist.js +0 -231
- package/mtds/external/@u-elements/u-datalist/dist/u-datalist.js.map +0 -1
- package/mtds/external/@u-elements/u-details/dist/u-details.js +0 -89
- package/mtds/external/@u-elements/u-details/dist/u-details.js.map +0 -1
- package/mtds/external/@u-elements/u-progress/dist/u-progress.js +0 -94
- package/mtds/external/@u-elements/u-progress/dist/u-progress.js.map +0 -1
- package/mtds/external/@u-elements/u-tabs/dist/u-tabs.js +0 -186
- package/mtds/external/@u-elements/u-tabs/dist/u-tabs.js.map +0 -1
- package/mtds/external/clsx/dist/clsx.js +0 -18
- package/mtds/external/clsx/dist/clsx.js.map +0 -1
- package/mtds/map/map.d.ts +0 -14
package/mtds/map.js
ADDED
package/mtds/map.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
package/mtds/package.json.js
CHANGED
|
@@ -1,71 +1,40 @@
|
|
|
1
1
|
import { jsx as i, jsxs as u } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import x from "clsx";
|
|
3
3
|
import { forwardRef as b } from "react";
|
|
4
|
-
import "../
|
|
5
|
-
import "../app/app.js";
|
|
6
|
-
import "../avatar/avatar.js";
|
|
7
|
-
import "../badge/badge.js";
|
|
8
|
-
import "../breadcrumbs/breadcrumbs.js";
|
|
9
|
-
import { Button as o } from "../button/button.js";
|
|
10
|
-
import "../card/card.js";
|
|
11
|
-
import "../chart/chart.js";
|
|
12
|
-
import "../chip/chip.js";
|
|
13
|
-
import "../details/details.js";
|
|
14
|
-
import "../dialog/dialog.js";
|
|
15
|
-
import "../divider/divider.js";
|
|
16
|
-
import "../errorsummary/errorsummary.js";
|
|
17
|
-
import "../field/field.js";
|
|
18
|
-
import "../fieldset/fieldset.js";
|
|
19
|
-
import "../helptext/helptext.js";
|
|
20
|
-
import "../input/input.js";
|
|
21
|
-
import "../layout/layout.js";
|
|
22
|
-
import "../link/link.js";
|
|
23
|
-
import "../logo/logo.js";
|
|
24
|
-
import "../popover/popover.js";
|
|
25
|
-
import "../progress/progress.js";
|
|
26
|
-
import "../skeleton/skeleton.js";
|
|
27
|
-
import "../spinner/spinner.js";
|
|
28
|
-
import "../steps/steps.js";
|
|
29
|
-
import "../table/table.js";
|
|
30
|
-
import "../tabs/tabs.js";
|
|
31
|
-
import "../tag/tag.js";
|
|
32
|
-
import "../toast/toast.js";
|
|
33
|
-
import "../togglegroup/togglegroup.js";
|
|
34
|
-
import "../typography/typography.js";
|
|
35
|
-
import "../validation/validation.js";
|
|
4
|
+
import { Button as n } from "../button/button.js";
|
|
36
5
|
import y from "../styles.module.css.js";
|
|
37
6
|
import { pagination as v } from "./pagination-helper.js";
|
|
38
|
-
const
|
|
39
|
-
function({ children:
|
|
40
|
-
const { pages: f, next:
|
|
7
|
+
const q = b(
|
|
8
|
+
function({ children: l, className: m, current: c, total: p, show: d = 7, props: a, ...e }, s) {
|
|
9
|
+
const { pages: f, next: t, prev: o } = v({ current: c, total: p, show: d });
|
|
41
10
|
return /* @__PURE__ */ i(
|
|
42
11
|
"nav",
|
|
43
12
|
{
|
|
44
|
-
"aria-label":
|
|
45
|
-
className: x(y.pagination,
|
|
13
|
+
"aria-label": e["aria-label"] || "Pagination",
|
|
14
|
+
className: x(y.pagination, m),
|
|
46
15
|
ref: s,
|
|
47
|
-
...
|
|
48
|
-
children:
|
|
16
|
+
...e,
|
|
17
|
+
children: l || /* @__PURE__ */ u("ul", { children: [
|
|
49
18
|
/* @__PURE__ */ i("li", { children: /* @__PURE__ */ i(
|
|
50
|
-
|
|
19
|
+
n,
|
|
51
20
|
{
|
|
52
|
-
"aria-disabled": !
|
|
53
|
-
...
|
|
21
|
+
"aria-disabled": !o,
|
|
22
|
+
...a?.({ page: o, type: "prev" })
|
|
54
23
|
}
|
|
55
24
|
) }),
|
|
56
|
-
f.map(({ key: g, page:
|
|
57
|
-
|
|
25
|
+
f.map(({ key: g, page: r, current: h }) => /* @__PURE__ */ i("li", { children: !!r && /* @__PURE__ */ i(
|
|
26
|
+
n,
|
|
58
27
|
{
|
|
59
28
|
"aria-current": h,
|
|
60
|
-
children:
|
|
61
|
-
...
|
|
29
|
+
children: r,
|
|
30
|
+
...a?.({ page: r, type: "page" })
|
|
62
31
|
}
|
|
63
32
|
) }, g)),
|
|
64
33
|
/* @__PURE__ */ i("li", { children: /* @__PURE__ */ i(
|
|
65
|
-
|
|
34
|
+
n,
|
|
66
35
|
{
|
|
67
|
-
"aria-disabled": !
|
|
68
|
-
...
|
|
36
|
+
"aria-disabled": !t,
|
|
37
|
+
...a?.({ page: t, type: "next" })
|
|
69
38
|
}
|
|
70
39
|
) })
|
|
71
40
|
] })
|
|
@@ -74,6 +43,6 @@ const pi = b(
|
|
|
74
43
|
}
|
|
75
44
|
);
|
|
76
45
|
export {
|
|
77
|
-
|
|
46
|
+
q as Pagination
|
|
78
47
|
};
|
|
79
48
|
//# sourceMappingURL=pagination.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.js","sources":["../../designsystem/pagination/pagination.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef } from \"react\";\nimport { Button } from \"../
|
|
1
|
+
{"version":3,"file":"pagination.js","sources":["../../designsystem/pagination/pagination.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef } from \"react\";\nimport { Button } from \"../button/button\";\nimport styles from \"../styles.module.css\";\nimport { pagination } from \"./pagination-helper\";\n\nexport type PaginationProps = Omit<\n\tReact.ComponentPropsWithoutRef<\"nav\">,\n\t\"children\"\n> &\n\t(\n\t\t| {\n\t\t\t\tchildren?: never;\n\t\t\t\tcurrent: number;\n\t\t\t\tshow?: number;\n\t\t\t\ttotal: number;\n\t\t\t\tprops: (props: {\n\t\t\t\t\tpage: number;\n\t\t\t\t\ttype: \"prev\" | \"next\" | \"page\";\n\t\t\t\t}) => Parameters<typeof Button>[0];\n\t\t }\n\t\t| {\n\t\t\t\tchildren: React.ReactNode;\n\t\t\t\tcurrent?: never;\n\t\t\t\tshow?: never;\n\t\t\t\ttotal?: never;\n\t\t\t\tprops?: never;\n\t\t }\n\t);\n\nexport const Pagination = forwardRef<HTMLElement, PaginationProps>(\n\tfunction Pagination(\n\t\t{ children, className, current, total, show = 7, props, ...rest },\n\t\tref,\n\t) {\n\t\tconst { pages, next, prev } = pagination({ current, total, show });\n\n\t\treturn (\n\t\t\t<nav\n\t\t\t\taria-label={rest[\"aria-label\"] || \"Pagination\"}\n\t\t\t\tclassName={clsx(styles.pagination, className)}\n\t\t\t\tref={ref}\n\t\t\t\t{...rest}\n\t\t\t>\n\t\t\t\t{children || (\n\t\t\t\t\t<ul>\n\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\taria-disabled={!prev}\n\t\t\t\t\t\t\t\t{...props?.({ page: prev, type: \"prev\" })}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t\t{pages.map(({ key, page, current }) => (\n\t\t\t\t\t\t\t<li key={key}>\n\t\t\t\t\t\t\t\t{!!page && (\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\taria-current={current}\n\t\t\t\t\t\t\t\t\t\t{...{ children: page }}\n\t\t\t\t\t\t\t\t\t\t{...props?.({ page, type: \"page\" })}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t))}\n\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\taria-disabled={!next}\n\t\t\t\t\t\t\t\t{...props?.({ page: next, type: \"next\" })}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t</ul>\n\t\t\t\t)}\n\t\t\t</nav>\n\t\t);\n\t},\n);\n"],"names":["Pagination","forwardRef","children","className","current","total","show","props","rest","ref","pages","next","prev","pagination","jsx","clsx","styles","Button","key","page"],"mappings":";;;;;;AA8BO,MAAMA,IAAaC;AAAA,EACzB,SACC,EAAE,UAAAC,GAAU,WAAAC,GAAW,SAAAC,GAAS,OAAAC,GAAO,MAAAC,IAAO,GAAG,OAAAC,GAAO,GAAGC,EAAA,GAC3DC,GACC;AACD,UAAM,EAAE,OAAAC,GAAO,MAAAC,GAAM,MAAAC,EAAA,IAASC,EAAW,EAAE,SAAAT,GAAS,OAAAC,GAAO,MAAAC,GAAM;AAEjE,WACC,gBAAAQ;AAAA,MAAC;AAAA,MAAA;AAAA,QACA,cAAYN,EAAK,YAAY,KAAK;AAAA,QAClC,WAAWO,EAAKC,EAAO,YAAYb,CAAS;AAAA,QAC5C,KAAAM;AAAA,QACC,GAAGD;AAAA,QAEH,UAAAN,uBACC,MAAA,EACA,UAAA;AAAA,UAAA,gBAAAY,EAAC,MAAA,EACA,UAAA,gBAAAA;AAAA,YAACG;AAAA,YAAA;AAAA,cACA,iBAAe,CAACL;AAAA,cACf,GAAGL,IAAQ,EAAE,MAAMK,GAAM,MAAM,QAAQ;AAAA,YAAA;AAAA,UAAA,GAE1C;AAAA,UACCF,EAAM,IAAI,CAAC,EAAE,KAAAQ,GAAK,MAAAC,GAAM,SAAAf,QACxB,gBAAAU,EAAC,MAAA,EACC,UAAA,CAAC,CAACK,KACF,gBAAAL;AAAA,YAACG;AAAA,YAAA;AAAA,cACA,gBAAcb;AAAAA,cACR,UAAUe;AAAA,cACf,GAAGZ,IAAQ,EAAE,MAAAY,GAAM,MAAM,QAAQ;AAAA,YAAA;AAAA,UAAA,EACnC,GANOD,CAQT,CACA;AAAA,4BACA,MAAA,EACA,UAAA,gBAAAJ;AAAA,YAACG;AAAA,YAAA;AAAA,cACA,iBAAe,CAACN;AAAA,cACf,GAAGJ,IAAQ,EAAE,MAAMI,GAAM,MAAM,QAAQ;AAAA,YAAA;AAAA,UAAA,EACzC,CACD;AAAA,QAAA,EAAA,CACD;AAAA,MAAA;AAAA,IAAA;AAAA,EAIJ;AACD;"}
|
|
@@ -1,39 +1,42 @@
|
|
|
1
|
-
import { flip as f, shift as g, size as
|
|
2
|
-
import
|
|
3
|
-
import { onLoaded as
|
|
4
|
-
const
|
|
5
|
-
function
|
|
6
|
-
if (o instanceof HTMLElement && o.classList.contains(
|
|
7
|
-
const
|
|
1
|
+
import { flip as f, shift as g, size as u } from "@floating-ui/dom";
|
|
2
|
+
import v from "../styles.module.css.js";
|
|
3
|
+
import { onLoaded as h, on as r, QUICK_EVENT as p, attr as s, anchorPosition as l } from "../utils.js";
|
|
4
|
+
const c = v.popover.split(" ")[0], d = "_mtds-popover-auto";
|
|
5
|
+
function E({ target: o, newState: t }) {
|
|
6
|
+
if (o instanceof HTMLElement && o.classList.contains(c)) {
|
|
7
|
+
const i = t === "closed", e = s(o, "data-overscroll") === "contain", n = Number(s(o, "data-inset")) || 20, a = o.getRootNode()?.querySelector(
|
|
8
8
|
`[popovertarget="${o.id}"]`
|
|
9
9
|
);
|
|
10
|
-
|
|
11
|
-
placement:
|
|
12
|
-
middleware: [f(), g({ padding:
|
|
13
|
-
|
|
14
|
-
padding:
|
|
15
|
-
apply({ availableHeight:
|
|
16
|
-
o.style.maxHeight = `${Math.max(50,
|
|
10
|
+
i ? l(o, !1) : a && l(o, a, {
|
|
11
|
+
placement: s(o, "data-position") || "bottom",
|
|
12
|
+
middleware: [f(), g({ padding: n })].concat(
|
|
13
|
+
e ? u({
|
|
14
|
+
padding: n,
|
|
15
|
+
apply({ availableHeight: m }) {
|
|
16
|
+
o.style.maxHeight = `${Math.max(50, m)}px`;
|
|
17
17
|
}
|
|
18
18
|
}) : []
|
|
19
19
|
)
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
function
|
|
24
|
-
t === "open" && o instanceof HTMLElement && o.classList.contains(
|
|
23
|
+
function L({ target: o, newState: t }) {
|
|
24
|
+
t === "open" && o instanceof HTMLElement && o.classList.contains(c) && s(o, "popover") !== "manual" && (o.classList.add(d), s(o, "popover", "manual"));
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
const t = o.target?.closest?.("a,button"),
|
|
28
|
-
for (const
|
|
29
|
-
!
|
|
30
|
-
if (
|
|
31
|
-
const
|
|
32
|
-
if (t instanceof HTMLButtonElement && !
|
|
33
|
-
|
|
26
|
+
function C(o) {
|
|
27
|
+
const t = o.target?.closest?.("a,button"), i = t && s(t, "popovertarget"), e = i ? document.getElementById(i) : t?.closest(`.${c}`);
|
|
28
|
+
for (const n of document.getElementsByClassName(d))
|
|
29
|
+
!n.contains(o.target) && e !== n && n.hidePopover();
|
|
30
|
+
if (e?.classList.contains(c) && t) {
|
|
31
|
+
const n = s(t, "popovertargetaction"), a = n === "show" || (n === "hide" ? !1 : void 0);
|
|
32
|
+
if (t instanceof HTMLButtonElement && !n && e.contains(t)) return;
|
|
33
|
+
if (e instanceof HTMLElement && e.isConnected) {
|
|
34
|
+
if (o.preventDefault(), e.hasAttribute("popover")) return e.togglePopover(a);
|
|
35
|
+
console.error(`Element "${e.id}" is missing "popover" attribute`);
|
|
36
|
+
}
|
|
34
37
|
}
|
|
35
38
|
}
|
|
36
|
-
|
|
37
|
-
|
|
39
|
+
h(() => {
|
|
40
|
+
r(document, "click", C), r(document, "toggle", E, p), r(document, "beforetoggle", L, p);
|
|
38
41
|
});
|
|
39
42
|
//# sourceMappingURL=popover-observer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover-observer.js","sources":["../../designsystem/popover/popover-observer.ts"],"sourcesContent":["import { flip, type Placement, shift, size } from \"@floating-ui/dom\";\nimport styles from \"../styles.module.css\";\nimport { anchorPosition, attr, on, onLoaded, QUICK_EVENT } from \"../utils\";\n\nconst CSS_POPOVER = styles.popover.split(\" \")[0];\nconst CSS_AUTO = `_mtds-popover-auto`;\n\ntype EventToggle = Event & Partial<ToggleEvent>;\n\nfunction handlePopoverToggle({ target: el, newState }: EventToggle) {\n\tif (el instanceof HTMLElement && el.classList.contains(CSS_POPOVER)) {\n\t\tconst isClosing = newState === \"closed\";\n\t\tconst isContain = attr(el, \"data-overscroll\") === \"contain\";\n\t\tconst anchor = (el.getRootNode() as ShadowRoot)?.querySelector<HTMLElement>(\n\t\t\t`[popovertarget=\"${el.id}\"]`,\n\t\t);\n\n\t\tif (isClosing) anchorPosition(el, false);\n\t\telse if (anchor)\n\t\t\tanchorPosition(el, anchor, {\n\t\t\t\tplacement: (attr(el, \"data-position\") || \"bottom\") as Placement,\n\t\t\t\tmiddleware: [flip(), shift({ padding
|
|
1
|
+
{"version":3,"file":"popover-observer.js","sources":["../../designsystem/popover/popover-observer.ts"],"sourcesContent":["import { flip, type Placement, shift, size } from \"@floating-ui/dom\";\nimport styles from \"../styles.module.css\";\nimport { anchorPosition, attr, on, onLoaded, QUICK_EVENT } from \"../utils\";\n\nconst CSS_POPOVER = styles.popover.split(\" \")[0];\nconst CSS_AUTO = `_mtds-popover-auto`;\n\ntype EventToggle = Event & Partial<ToggleEvent>;\n\nfunction handlePopoverToggle({ target: el, newState }: EventToggle) {\n\tif (el instanceof HTMLElement && el.classList.contains(CSS_POPOVER)) {\n\t\tconst isClosing = newState === \"closed\";\n\t\tconst isContain = attr(el, \"data-overscroll\") === \"contain\";\n\t\tconst padding = Number(attr(el, \"data-inset\")) || 20;\n\t\tconst anchor = (el.getRootNode() as ShadowRoot)?.querySelector<HTMLElement>(\n\t\t\t`[popovertarget=\"${el.id}\"]`,\n\t\t);\n\n\t\tif (isClosing) anchorPosition(el, false);\n\t\telse if (anchor)\n\t\t\tanchorPosition(el, anchor, {\n\t\t\t\tplacement: (attr(el, \"data-position\") || \"bottom\") as Placement,\n\t\t\t\tmiddleware: [flip(), shift({ padding })].concat(\n\t\t\t\t\tisContain\n\t\t\t\t\t\t? size({\n\t\t\t\t\t\t\t\tpadding,\n\t\t\t\t\t\t\t\tapply({ availableHeight }) {\n\t\t\t\t\t\t\t\t\tel.style.maxHeight = `${Math.max(50, availableHeight)}px`;\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t: [],\n\t\t\t\t),\n\t\t\t});\n\t}\n}\n\nfunction handlePopoverBeforetoggle({ target: el, newState }: EventToggle) {\n\tif (\n\t\tnewState === \"open\" &&\n\t\tel instanceof HTMLElement &&\n\t\tel.classList.contains(CSS_POPOVER) &&\n\t\tattr(el, \"popover\") !== \"manual\"\n\t) {\n\t\tel.classList.add(CSS_AUTO);\n\t\tattr(el, \"popover\", \"manual\"); // Make manual to prevent closing when clicking scrollbar\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 handlePopoverLinkClick(event: Event) {\n\tconst el = (event.target as Element)?.closest?.(\"a,button\");\n\tconst id = el && attr(el, \"popovertarget\");\n\tconst pop = id ? document.getElementById(id) : el?.closest(`.${CSS_POPOVER}`);\n\n\t// Manually close popovers where click was outside\n\tfor (const open of document.getElementsByClassName(CSS_AUTO))\n\t\tif (!open.contains(event.target as Node) && pop !== open)\n\t\t\t(open as HTMLElement).hidePopover();\n\n\tif (pop?.classList.contains(CSS_POPOVER) && el) {\n\t\tconst action = attr(el, \"popovertargetaction\");\n\t\tconst open = action === \"show\" || (action === \"hide\" ? false : undefined);\n\n\t\t// Popover can be disconneted by click handler deeper down in the DOM three before reaching document\n\t\tif (el instanceof HTMLButtonElement && !action && pop.contains(el)) return; // Require \"popovertargetaction\" attribute to make buttons inside popover toggle\n\t\tif (pop instanceof HTMLElement && pop.isConnected) {\n\t\t\tevent.preventDefault(); // Prevent browser popover API since we are doing it ourselves\n\t\t\tif (pop.hasAttribute(\"popover\")) return pop.togglePopover(open);\n\t\t\tconsole.error(`Element \"${pop.id}\" is missing \"popover\" attribute`);\n\t\t}\n\t}\n}\n\nonLoaded(() => {\n\ton(document, \"click\", handlePopoverLinkClick); // Allow `<a>` to use `popovertarget` as well\n\ton(document, \"toggle\", handlePopoverToggle, QUICK_EVENT); // Use capture since toggle does not bubble\n\ton(document, \"beforetoggle\", handlePopoverBeforetoggle, QUICK_EVENT); // Use capture since toggle does not bubble\n});\n"],"names":["CSS_POPOVER","styles","CSS_AUTO","handlePopoverToggle","el","newState","isClosing","isContain","attr","padding","anchor","anchorPosition","flip","shift","size","availableHeight","handlePopoverBeforetoggle","handlePopoverLinkClick","event","id","pop","open","action","onLoaded","on","QUICK_EVENT"],"mappings":";;;AAIA,MAAMA,IAAcC,EAAO,QAAQ,MAAM,GAAG,EAAE,CAAC,GACzCC,IAAW;AAIjB,SAASC,EAAoB,EAAE,QAAQC,GAAI,UAAAC,KAAyB;AACnE,MAAID,aAAc,eAAeA,EAAG,UAAU,SAASJ,CAAW,GAAG;AACpE,UAAMM,IAAYD,MAAa,UACzBE,IAAYC,EAAKJ,GAAI,iBAAiB,MAAM,WAC5CK,IAAU,OAAOD,EAAKJ,GAAI,YAAY,CAAC,KAAK,IAC5CM,IAAUN,EAAG,YAAA,GAA8B;AAAA,MAChD,mBAAmBA,EAAG,EAAE;AAAA,IAAA;AAGzB,IAAIE,IAAWK,EAAeP,GAAI,EAAK,IAC9BM,KACRC,EAAeP,GAAIM,GAAQ;AAAA,MAC1B,WAAYF,EAAKJ,GAAI,eAAe,KAAK;AAAA,MACzC,YAAY,CAACQ,KAAQC,EAAM,EAAE,SAAAJ,EAAA,CAAS,CAAC,EAAE;AAAA,QACxCF,IACGO,EAAK;AAAA,UACL,SAAAL;AAAA,UACA,MAAM,EAAE,iBAAAM,KAAmB;AAC1B,YAAAX,EAAG,MAAM,YAAY,GAAG,KAAK,IAAI,IAAIW,CAAe,CAAC;AAAA,UACtD;AAAA,QAAA,CACA,IACA,CAAA;AAAA,MAAC;AAAA,IACL,CACA;AAAA,EACH;AACD;AAEA,SAASC,EAA0B,EAAE,QAAQZ,GAAI,UAAAC,KAAyB;AACzE,EACCA,MAAa,UACbD,aAAc,eACdA,EAAG,UAAU,SAASJ,CAAW,KACjCQ,EAAKJ,GAAI,SAAS,MAAM,aAExBA,EAAG,UAAU,IAAIF,CAAQ,GACzBM,EAAKJ,GAAI,WAAW,QAAQ;AAE9B;AAKA,SAASa,EAAuBC,GAAc;AAC7C,QAAMd,IAAMc,EAAM,QAAoB,UAAU,UAAU,GACpDC,IAAKf,KAAMI,EAAKJ,GAAI,eAAe,GACnCgB,IAAMD,IAAK,SAAS,eAAeA,CAAE,IAAIf,GAAI,QAAQ,IAAIJ,CAAW,EAAE;AAG5E,aAAWqB,KAAQ,SAAS,uBAAuBnB,CAAQ;AAC1D,IAAI,CAACmB,EAAK,SAASH,EAAM,MAAc,KAAKE,MAAQC,KAClDA,EAAqB,YAAA;AAExB,MAAID,GAAK,UAAU,SAASpB,CAAW,KAAKI,GAAI;AAC/C,UAAMkB,IAASd,EAAKJ,GAAI,qBAAqB,GACvCiB,IAAOC,MAAW,WAAWA,MAAW,SAAS,KAAQ;AAG/D,QAAIlB,aAAc,qBAAqB,CAACkB,KAAUF,EAAI,SAAShB,CAAE,EAAG;AACpE,QAAIgB,aAAe,eAAeA,EAAI,aAAa;AAElD,UADAF,EAAM,eAAA,GACFE,EAAI,aAAa,SAAS,EAAG,QAAOA,EAAI,cAAcC,CAAI;AAC9D,cAAQ,MAAM,YAAYD,EAAI,EAAE,kCAAkC;AAAA,IACnE;AAAA,EACD;AACD;AAEAG,EAAS,MAAM;AACd,EAAAC,EAAG,UAAU,SAASP,CAAsB,GAC5CO,EAAG,UAAU,UAAUrB,GAAqBsB,CAAW,GACvDD,EAAG,UAAU,gBAAgBR,GAA2BS,CAAW;AACpE,CAAC;"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Placement } from '@floating-ui/dom';
|
|
2
2
|
import { JSX } from 'react';
|
|
3
|
-
import { PolymorphicComponentPropWithRef
|
|
3
|
+
import { PolymorphicComponentPropWithRef } from '../react-types';
|
|
4
4
|
export type PopoverProps<As extends React.ElementType = "div"> = PolymorphicComponentPropWithRef<As, {
|
|
5
5
|
"data-position"?: Placement;
|
|
6
6
|
"data-overscroll"?: "contain";
|
|
7
|
-
popover?:
|
|
7
|
+
popover?: React.HTMLAttributes<HTMLElement>["popover"];
|
|
8
8
|
}>;
|
|
9
9
|
type PopoverComponent = <As extends React.ElementType = "div">(props: PopoverProps<As>) => JSX.Element;
|
|
10
10
|
export declare const Popover: PopoverComponent;
|
package/mtds/popover/popover.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import m from "clsx";
|
|
3
3
|
import { forwardRef as s } from "react";
|
|
4
4
|
import f from "../styles.module.css.js";
|
|
5
5
|
const u = s(function({ as: o, className: r, ...p }, t) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.js","sources":["../../designsystem/popover/popover.tsx"],"sourcesContent":["import type { Placement } from \"@floating-ui/dom\";\nimport clsx from \"clsx\";\nimport { forwardRef, type JSX } from \"react\";\nimport type {\n\tPolymorphicComponentPropWithRef,\n\tPolymorphicRef,\n
|
|
1
|
+
{"version":3,"file":"popover.js","sources":["../../designsystem/popover/popover.tsx"],"sourcesContent":["import type { Placement } from \"@floating-ui/dom\";\nimport 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\nexport type PopoverProps<As extends React.ElementType = \"div\"> =\n\tPolymorphicComponentPropWithRef<\n\t\tAs,\n\t\t{\n\t\t\t\"data-position\"?: Placement;\n\t\t\t\"data-overscroll\"?: \"contain\";\n\t\t\tpopover?: React.HTMLAttributes<HTMLElement>[\"popover\"];\n\t\t}\n\t>;\n\ntype PopoverComponent = <As extends React.ElementType = \"div\">(\n\tprops: PopoverProps<As>,\n) => JSX.Element;\n\nexport const Popover: PopoverComponent = forwardRef<null>(function Popover<\n\tAs extends React.ElementType = \"div\",\n>({ as, className, ...rest }: PopoverProps<As>, ref?: PolymorphicRef<As>) {\n\tconst Tag = as || \"div\";\n\n\treturn (\n\t\t<Tag\n\t\t\tpopover=\"auto\"\n\t\t\tclassName={clsx(styles.popover, className)}\n\t\t\tref={ref}\n\t\t\t{...rest}\n\t\t/>\n\t);\n}) as PopoverComponent; // Needed to tell Typescript this does not return ReactNode but acutally JSX.Element\n"],"names":["Popover","forwardRef","as","className","rest","ref","jsx","clsx","styles"],"mappings":";;;;AAuBO,MAAMA,IAA4BC,EAAiB,SAExD,EAAE,IAAAC,GAAI,WAAAC,GAAW,GAAGC,EAAA,GAA0BC,GAA0B;AAGzE,SACC,gBAAAC;AAAA,IAHWJ,KAAM;AAAA,IAGhB;AAAA,MACA,SAAQ;AAAA,MACR,WAAWK,EAAKC,EAAO,SAASL,CAAS;AAAA,MACzC,KAAAE;AAAA,MACC,GAAGD;AAAA,IAAA;AAAA,EAAA;AAGP,CAAC;"}
|
package/mtds/react-types.d.ts
CHANGED
|
@@ -7,12 +7,11 @@ export type PolymorphicComponentPropWithRef<As extends React.ElementType, Props
|
|
|
7
7
|
ref?: PolymorphicRef<As>;
|
|
8
8
|
};
|
|
9
9
|
export type PolymorphicRef<As extends React.ElementType> = React.ComponentPropsWithRef<As>["ref"];
|
|
10
|
-
export type PopoverValues = "" | "auto" | "manual" | undefined;
|
|
11
10
|
export type Sizes = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "13" | "14" | "15" | "18" | "22" | "26" | "30" | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 18 | 22 | 26 | 30;
|
|
12
11
|
declare global {
|
|
13
12
|
namespace React {
|
|
14
13
|
interface HTMLAttributes<T> {
|
|
15
|
-
popover?:
|
|
14
|
+
popover?: React.HTMLAttributes<HTMLElement>["popover"];
|
|
16
15
|
popovertarget?: string;
|
|
17
16
|
"data-color"?: "main" | "neutral" | "success" | "danger" | "info" | "warning" | "inverted";
|
|
18
17
|
"data-size"?: "sm" | "md" | "lg" | (string & {});
|
|
@@ -22,7 +21,7 @@ declare global {
|
|
|
22
21
|
}
|
|
23
22
|
namespace React.JSX {
|
|
24
23
|
interface IntrinsicAttributes {
|
|
25
|
-
popover?:
|
|
24
|
+
popover?: React.HTMLAttributes<HTMLElement>["popover"];
|
|
26
25
|
popovertarget?: string;
|
|
27
26
|
popovertargetaction?: string;
|
|
28
27
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import s from "clsx";
|
|
3
3
|
import { forwardRef as f } from "react";
|
|
4
4
|
import i from "../styles.module.css.js";
|
|
5
5
|
const x = f(function({ as: r, className: t, ...o }, e) {
|
package/mtds/spinner/spinner.js
CHANGED
package/mtds/steps/steps.js
CHANGED