@mattilsynet/design 0.3.7 → 0.4.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/alert/alert.js +12 -0
- package/mtds/alert/alert.js.map +1 -0
- package/mtds/avatar/avatar.d.ts +1 -1
- package/mtds/avatar/avatar.js +12 -0
- package/mtds/avatar/avatar.js.map +1 -0
- package/mtds/badge/badge.d.ts +2 -6
- package/mtds/badge/badge.js +11 -0
- package/mtds/badge/badge.js.map +1 -0
- package/mtds/breadcrumbs/breadcrumbs.js +34 -0
- package/mtds/breadcrumbs/breadcrumbs.js.map +1 -0
- package/mtds/button/button.d.ts +1 -1
- package/mtds/button/button.js +12 -0
- package/mtds/button/button.js.map +1 -0
- package/mtds/button/button.stories.d.ts +1 -0
- package/mtds/card/card.d.ts +1 -1
- package/mtds/card/card.js +12 -0
- package/mtds/card/card.js.map +1 -0
- package/mtds/card/card.stories.d.ts +1 -0
- package/mtds/chip/chip.js +11 -0
- package/mtds/chip/chip.js.map +1 -0
- package/mtds/chip/chip.stories.d.ts +1 -0
- package/mtds/details/details.d.ts +4 -1
- package/mtds/details/details.js +18 -0
- package/mtds/details/details.js.map +1 -0
- package/mtds/details/details.stories.d.ts +1 -0
- package/mtds/dialog/dialog.js +25 -0
- package/mtds/dialog/dialog.js.map +1 -0
- package/mtds/dialog/dialog.stories.d.ts +1 -0
- package/mtds/divider/divider.js +22 -0
- package/mtds/divider/divider.js.map +1 -0
- package/mtds/divider/divider.stories.d.ts +1 -0
- package/mtds/errorsummary/errorsummary.js +30 -0
- package/mtds/errorsummary/errorsummary.js.map +1 -0
- package/mtds/errorsummary/errorsummary.stories.d.ts +1 -0
- package/mtds/external/@u-elements/u-details/dist/u-details.js +91 -0
- package/mtds/external/@u-elements/u-details/dist/u-details.js.map +1 -0
- package/mtds/external/@u-elements/u-tabs/dist/u-tabs.js +185 -0
- package/mtds/external/@u-elements/u-tabs/dist/u-tabs.js.map +1 -0
- package/mtds/external/clsx/dist/clsx.js +18 -0
- package/mtds/external/clsx/dist/clsx.js.map +1 -0
- package/mtds/field/field.d.ts +21 -0
- package/mtds/field/field.js +44 -0
- package/mtds/field/field.js.map +1 -0
- package/mtds/field/field.stories.d.ts +1 -0
- package/mtds/fieldset/fieldset.js +20 -0
- package/mtds/fieldset/fieldset.js.map +1 -0
- package/mtds/fieldset/fieldset.stories.d.ts +1 -0
- package/mtds/heading/heading.js +11 -0
- package/mtds/heading/heading.js.map +1 -0
- package/mtds/heading/heading.stories.d.ts +2 -0
- package/mtds/index.d.ts +2 -1
- package/mtds/index.iife.js +4 -1
- package/mtds/index.iife.js.map +1 -1
- package/mtds/index.js +12 -11
- package/mtds/index.js.map +1 -1
- package/mtds/input/input.d.ts +2 -0
- package/mtds/input/input.js +19 -0
- package/mtds/input/input.js.map +1 -0
- package/mtds/input/input.stories.d.ts +1 -0
- package/mtds/layout/layout.d.ts +9 -0
- package/mtds/layout/layout.js +14 -0
- package/mtds/layout/layout.js.map +1 -0
- package/mtds/layout/layout.stories.d.ts +3 -2
- package/mtds/link/link.js +11 -0
- package/mtds/link/link.js.map +1 -0
- package/mtds/link/link.stories.d.ts +1 -0
- package/mtds/logo/logo.d.ts +9 -0
- package/mtds/logo/logo.js +12 -0
- package/mtds/logo/logo.js.map +1 -0
- package/mtds/logo/logo.stories.d.ts +1 -0
- package/mtds/pagination/pagination-helper.d.ts +13 -0
- package/mtds/pagination/pagination-helper.js +16 -0
- package/mtds/pagination/pagination-helper.js.map +1 -0
- package/mtds/pagination/pagination.d.ts +2 -13
- package/mtds/pagination/pagination.js +18 -17
- package/mtds/pagination/pagination.js.map +1 -1
- package/mtds/pagination/pagination.stories.d.ts +1 -0
- package/mtds/popover/popover-observer.js +14 -14
- package/mtds/popover/popover.d.ts +6 -0
- package/mtds/popover/popover.js +19 -0
- package/mtds/popover/popover.js.map +1 -0
- package/mtds/popover/popover.stories.d.ts +1 -0
- package/mtds/react.d.ts +13 -0
- package/mtds/react.js +57 -0
- package/mtds/react.js.map +1 -0
- package/mtds/skeleton/skeleton.d.ts +9 -0
- package/mtds/skeleton/skeleton.js +12 -0
- package/mtds/skeleton/skeleton.js.map +1 -0
- package/mtds/skeleton/skeleton.stories.d.ts +1 -0
- package/mtds/spinner/spinner.d.ts +2 -0
- package/mtds/spinner/spinner.js +13 -0
- package/mtds/spinner/spinner.js.map +1 -0
- package/mtds/spinner/spinner.stories.d.ts +1 -0
- package/mtds/styles.css +1 -1
- package/mtds/styles.json +32 -31
- package/mtds/styles.module.css.js +39 -39
- package/mtds/table/table.d.ts +2 -0
- package/mtds/table/table.js +11 -0
- package/mtds/table/table.js.map +1 -0
- package/mtds/table/table.stories.d.ts +1 -0
- package/mtds/tabs/tabs.d.ts +10 -0
- package/mtds/tabs/tabs.js +28 -0
- package/mtds/tabs/tabs.js.map +1 -0
- package/mtds/tabs/tabs.stories.d.ts +1 -0
- package/mtds/tag/tag.d.ts +2 -0
- package/mtds/tag/tag.js +11 -0
- package/mtds/tag/tag.js.map +1 -0
- package/mtds/tag/tag.stories.d.ts +1 -0
- package/mtds/tooltip/tooltip-observer.js +8 -2
- package/mtds/tooltip/tooltip-observer.js.map +1 -1
- package/mtds/tooltip/tooltip.stories.d.ts +11 -0
- package/mtds/utils.js +19 -19
- package/mtds/validation/validation.d.ts +2 -0
- package/mtds/validation/validation.js +13 -0
- package/mtds/validation/validation.js.map +1 -0
- package/mtds/validation/validation.stories.d.ts +1 -0
- package/package.json +25 -21
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { clsx as f } from "../external/clsx/dist/clsx.js";
|
|
3
|
+
import { forwardRef as s } from "react";
|
|
4
|
+
import a from "../styles.module.css.js";
|
|
5
|
+
const x = s(function({ as: t, className: e, ...o }, l) {
|
|
6
|
+
const r = t || "output";
|
|
7
|
+
return !o.role && r !== "output" && Object.assign(o, { role: "alert" }), /* @__PURE__ */ m(r, { className: f(a.alert, e), ref: l, ...o });
|
|
8
|
+
});
|
|
9
|
+
export {
|
|
10
|
+
x as Alert
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=alert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert.js","sources":["../../designsystem/alert/alert.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { type JSX, forwardRef } from \"react\";\nimport type {\n\tPolymorphicComponentPropWithRef,\n\tPolymorphicRef,\n} from \"../react-types\";\nimport styles from \"../styles.module.css\";\n\nexport type AlertProps<As extends React.ElementType = \"output\"> =\n\tPolymorphicComponentPropWithRef<As>;\n\ntype AlertComponent = <As extends React.ElementType = \"output\">(\n\tprops: AlertProps<As>,\n) => JSX.Element;\n\nexport const Alert: AlertComponent = forwardRef<null>(function Alert<\n\tAs extends React.ElementType = \"output\",\n>({ as, className, ...rest }: AlertProps<As>, ref?: PolymorphicRef<As>) {\n\tconst Tag = as || \"output\";\n\n\tif (!rest.role && Tag !== \"output\") Object.assign(rest, { role: \"alert\" }); // Ensure role is set to 'alert' if not <output>\n\n\treturn <Tag className={clsx(styles.alert, className)} ref={ref} {...rest} />;\n}) as AlertComponent; // Needed to tell Typescript this does not return ReactNode but acutally JSX.Element\n"],"names":["Alert","forwardRef","as","className","rest","ref","Tag","jsx","clsx","styles"],"mappings":";;;;AAea,MAAAA,IAAwBC,EAAiB,SAEpD,EAAE,IAAAC,GAAI,WAAAC,GAAW,GAAGC,EAAK,GAAmBC,GAA0B;AACvE,QAAMC,IAAMJ,KAAM;AAEd,SAAA,CAACE,EAAK,QAAQE,MAAQ,YAAiB,OAAA,OAAOF,GAAM,EAAE,MAAM,QAAA,CAAS,GAElE,gBAAAG,EAACD,GAAI,EAAA,WAAWE,EAAKC,EAAO,OAAON,CAAS,GAAG,KAAAE,GAAW,GAAGD,EAAM,CAAA;AAC3E,CAAC;"}
|
package/mtds/avatar/avatar.d.ts
CHANGED
|
@@ -4,6 +4,6 @@ type AvatarBaseProps<Href> = {
|
|
|
4
4
|
href?: Href;
|
|
5
5
|
};
|
|
6
6
|
export type AvatarProps<Href, As extends React.ElementType = Href extends string ? "a" : "span"> = PolymorphicComponentPropWithRef<As, AvatarBaseProps<Href>>;
|
|
7
|
-
type AvatarComponent = <Href, As extends React.ElementType = Href extends string ? "a" : "span">(props: AvatarProps<As>) => JSX.Element;
|
|
7
|
+
type AvatarComponent = <Href, As extends React.ElementType = Href extends string ? "a" : "span">(props: AvatarProps<Href, As>) => JSX.Element;
|
|
8
8
|
export declare const Avatar: AvatarComponent;
|
|
9
9
|
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
2
|
+
import { clsx as s } from "../external/clsx/dist/clsx.js";
|
|
3
|
+
import { forwardRef as n } from "react";
|
|
4
|
+
import p from "../styles.module.css.js";
|
|
5
|
+
const x = n(function({ as: a, className: o, ...r }, t) {
|
|
6
|
+
const m = a || (r.href ? "a" : "span");
|
|
7
|
+
return /* @__PURE__ */ f(m, { className: s(p.avatar, o), ref: t, ...r });
|
|
8
|
+
});
|
|
9
|
+
export {
|
|
10
|
+
x as Avatar
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=avatar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avatar.js","sources":["../../designsystem/avatar/avatar.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { type JSX, forwardRef } from \"react\";\nimport type {\n\tPolymorphicComponentPropWithRef,\n\tPolymorphicRef,\n} from \"../react-types\";\nimport styles from \"../styles.module.css\";\n\ntype AvatarBaseProps<Href> = {\n\thref?: Href;\n};\n\nexport type AvatarProps<\n\tHref,\n\tAs extends React.ElementType = Href extends string ? \"a\" : \"span\",\n> = PolymorphicComponentPropWithRef<As, AvatarBaseProps<Href>>;\n\ntype AvatarComponent = <\n\tHref,\n\tAs extends React.ElementType = Href extends string ? \"a\" : \"span\",\n>(\n\tprops: AvatarProps<Href, As>,\n) => JSX.Element;\n\nexport const Avatar: AvatarComponent = forwardRef<null>(function Avatar<\n\tHref,\n\tAs extends React.ElementType = Href extends string ? \"a\" : \"span\",\n>({ as, className, ...rest }: AvatarProps<Href, As>, ref?: PolymorphicRef<As>) {\n\tconst Tag = as || (rest.href ? \"a\" : \"span\");\n\n\treturn <Tag className={clsx(styles.avatar, className)} ref={ref} {...rest} />;\n}) as AvatarComponent; // Needed to tell Typescript this does not return ReactNode but acutally JSX.Element\n"],"names":["Avatar","forwardRef","as","className","rest","ref","Tag","jsx","clsx","styles"],"mappings":";;;;AAwBa,MAAAA,IAA0BC,EAAiB,SAGtD,EAAE,IAAAC,GAAI,WAAAC,GAAW,GAAGC,EAAK,GAA0BC,GAA0B;AAC9E,QAAMC,IAAMJ,MAAOE,EAAK,OAAO,MAAM;AAE9B,SAAA,gBAAAG,EAACD,GAAI,EAAA,WAAWE,EAAKC,EAAO,QAAQN,CAAS,GAAG,KAAAE,GAAW,GAAGD,EAAM,CAAA;AAC5E,CAAC;"}
|
package/mtds/badge/badge.d.ts
CHANGED
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export type BadgeProps<As extends React.ElementType = "span"> = PolymorphicComponentPropWithRef<As>;
|
|
4
|
-
type BadgeComponent = <As extends React.ElementType = "span">(props: BadgeProps<As>) => JSX.Element;
|
|
5
|
-
export declare const Badge: BadgeComponent;
|
|
6
|
-
export {};
|
|
1
|
+
export type BadgeProps = React.ComponentPropsWithoutRef<"span">;
|
|
2
|
+
export declare const Badge: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { clsx as e } from "../external/clsx/dist/clsx.js";
|
|
3
|
+
import { forwardRef as s } from "react";
|
|
4
|
+
import a from "../styles.module.css.js";
|
|
5
|
+
const d = s(function({ className: r, ...o }, m) {
|
|
6
|
+
return /* @__PURE__ */ t("span", { className: e(a.badge, r), ref: m, ...o });
|
|
7
|
+
});
|
|
8
|
+
export {
|
|
9
|
+
d as Badge
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=badge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"badge.js","sources":["../../designsystem/badge/badge.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef } from \"react\";\nimport styles from \"../styles.module.css\";\n\nexport type BadgeProps = React.ComponentPropsWithoutRef<\"span\">;\n\nexport const Badge = forwardRef<HTMLSpanElement, BadgeProps>(function Badge(\n\t{ className, ...rest },\n\tref,\n) {\n\treturn <span className={clsx(styles.badge, className)} ref={ref} {...rest} />;\n});\n"],"names":["Badge","forwardRef","className","rest","ref","jsx","clsx","styles"],"mappings":";;;;AAMa,MAAAA,IAAQC,EAAwC,SAC5D,EAAE,WAAAC,GAAW,GAAGC,EAAK,GACrBC,GACC;AACM,SAAA,gBAAAC,EAAC,QAAK,EAAA,WAAWC,EAAKC,EAAO,OAAOL,CAAS,GAAG,KAAAE,GAAW,GAAGD,EAAM,CAAA;AAC5E,CAAC;"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
2
|
+
import { clsx as b } from "../external/clsx/dist/clsx.js";
|
|
3
|
+
import { forwardRef as p, useRef as A, useImperativeHandle as a, useEffect as s } from "react";
|
|
4
|
+
import d from "../styles.module.css.js";
|
|
5
|
+
const E = p(
|
|
6
|
+
function({ as: i, className: u, ...o }, c) {
|
|
7
|
+
const t = A(null), l = i || "nav";
|
|
8
|
+
return a(c, () => t.current), s(() => {
|
|
9
|
+
if (t.current instanceof HTMLElement) {
|
|
10
|
+
const e = t.current.querySelectorAll("li > :is(a,button)"), n = e[e.length - 1];
|
|
11
|
+
for (const r of e)
|
|
12
|
+
r[r === n ? "setAttribute" : "removeAttribute"]("aria-current", "page");
|
|
13
|
+
}
|
|
14
|
+
}), a(c, () => t.current), s(() => {
|
|
15
|
+
if (t.current instanceof HTMLElement) {
|
|
16
|
+
const e = t.current.querySelectorAll("li > :is(a,button)"), n = e[e.length - 1];
|
|
17
|
+
for (const r of e)
|
|
18
|
+
r[r === n ? "setAttribute" : "removeAttribute"]("aria-current", "page");
|
|
19
|
+
}
|
|
20
|
+
}), /* @__PURE__ */ f(
|
|
21
|
+
l,
|
|
22
|
+
{
|
|
23
|
+
"aria-label": o["aria-label"] || "Du er her:",
|
|
24
|
+
className: b(d.breadcrumbs, u),
|
|
25
|
+
ref: t,
|
|
26
|
+
...o
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
export {
|
|
32
|
+
E as Breadcrumbs
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=breadcrumbs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"breadcrumbs.js","sources":["../../designsystem/breadcrumbs/breadcrumbs.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport {\n\ttype JSX,\n\tforwardRef,\n\tuseEffect,\n\tuseImperativeHandle,\n\tuseRef,\n} from \"react\";\nimport type {\n\tPolymorphicComponentPropWithRef,\n\tPolymorphicRef,\n} from \"../react-types\";\nimport styles from \"../styles.module.css\";\n\nexport type BreadcrumbsProps<As extends React.ElementType = \"nav\"> =\n\tPolymorphicComponentPropWithRef<As, { \"aria-label\"?: string }>;\n\ntype BreadcrumbsComponent = <As extends React.ElementType = \"nav\">(\n\tprops: BreadcrumbsProps<As>,\n) => JSX.Element;\n\nexport const Breadcrumbs: BreadcrumbsComponent = forwardRef<null>(\n\tfunction Breadcrumbs<As extends React.ElementType = \"nav\">(\n\t\t{ as, className, ...rest }: BreadcrumbsProps<As>,\n\t\tref?: PolymorphicRef<As>,\n\t) {\n\t\tconst innerRef = useRef<As>(null);\n\t\tconst Tag = as || \"nav\";\n\n\t\tuseImperativeHandle(ref, () => innerRef.current as As); // Forward innerRef\n\t\tuseEffect(() => {\n\t\t\tif (innerRef.current instanceof HTMLElement) {\n\t\t\t\tconst items = innerRef.current.querySelectorAll(\"li > :is(a,button)\");\n\t\t\t\tconst last = items[items.length - 1];\n\n\t\t\t\tfor (const item of items) {\n\t\t\t\t\tconst action = item === last ? \"setAttribute\" : \"removeAttribute\";\n\t\t\t\t\titem[action](\"aria-current\", \"page\");\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tuseImperativeHandle(ref, () => innerRef.current as As); // Forward innerRef\n\t\tuseEffect(() => {\n\t\t\tif (innerRef.current instanceof HTMLElement) {\n\t\t\t\tconst items = innerRef.current.querySelectorAll(\"li > :is(a,button)\");\n\t\t\t\tconst last = items[items.length - 1];\n\n\t\t\t\tfor (const item of items) {\n\t\t\t\t\tconst action = item === last ? \"setAttribute\" : \"removeAttribute\";\n\t\t\t\t\titem[action](\"aria-current\", \"page\");\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\treturn (\n\t\t\t<Tag\n\t\t\t\taria-label={rest[\"aria-label\"] || \"Du er her:\"}\n\t\t\t\tclassName={clsx(styles.breadcrumbs, className)}\n\t\t\t\tref={innerRef}\n\t\t\t\t{...rest}\n\t\t\t/>\n\t\t);\n\t},\n) as BreadcrumbsComponent; // Needed to tell Typescript this does not return ReactNode but acutally JSX.Element\n"],"names":["Breadcrumbs","forwardRef","as","className","rest","ref","innerRef","useRef","Tag","useImperativeHandle","useEffect","items","last","item","jsx","clsx","styles"],"mappings":";;;;AAqBO,MAAMA,IAAoCC;AAAA,EAChD,SACC,EAAE,IAAAC,GAAI,WAAAC,GAAW,GAAGC,KACpBC,GACC;AACK,UAAAC,IAAWC,EAAW,IAAI,GAC1BC,IAAMN,KAAM;AAEE,WAAAO,EAAAJ,GAAK,MAAMC,EAAS,OAAa,GACrDI,EAAU,MAAM;AACX,UAAAJ,EAAS,mBAAmB,aAAa;AAC5C,cAAMK,IAAQL,EAAS,QAAQ,iBAAiB,oBAAoB,GAC9DM,IAAOD,EAAMA,EAAM,SAAS,CAAC;AAEnC,mBAAWE,KAAQF;AAEb,UAAAE,EADUA,MAASD,IAAO,iBAAiB,iBACrC,EAAE,gBAAgB,MAAM;AAAA,MACpC;AAAA,IACD,CACA,GACmBH,EAAAJ,GAAK,MAAMC,EAAS,OAAa,GACrDI,EAAU,MAAM;AACX,UAAAJ,EAAS,mBAAmB,aAAa;AAC5C,cAAMK,IAAQL,EAAS,QAAQ,iBAAiB,oBAAoB,GAC9DM,IAAOD,EAAMA,EAAM,SAAS,CAAC;AAEnC,mBAAWE,KAAQF;AAEb,UAAAE,EADUA,MAASD,IAAO,iBAAiB,iBACrC,EAAE,gBAAgB,MAAM;AAAA,MACpC;AAAA,IACD,CACA,GAGA,gBAAAE;AAAA,MAACN;AAAA,MAAA;AAAA,QACA,cAAYJ,EAAK,YAAY,KAAK;AAAA,QAClC,WAAWW,EAAKC,EAAO,aAAab,CAAS;AAAA,QAC7C,KAAKG;AAAA,QACJ,GAAGF;AAAA,MAAA;AAAA,IACL;AAAA,EAAA;AAGH;"}
|
package/mtds/button/button.d.ts
CHANGED
|
@@ -4,6 +4,6 @@ type ButtonBaseProps<Href> = {
|
|
|
4
4
|
href?: Href;
|
|
5
5
|
};
|
|
6
6
|
export type ButtonProps<Href, As extends React.ElementType = Href extends string ? "a" : "button"> = PolymorphicComponentPropWithRef<As, ButtonBaseProps<Href>>;
|
|
7
|
-
type ButtonComponent = <Href, As extends React.ElementType = Href extends string ? "a" : "button">(props: ButtonProps<As>) => JSX.Element;
|
|
7
|
+
type ButtonComponent = <Href, As extends React.ElementType = Href extends string ? "a" : "button">(props: ButtonProps<Href, As>) => JSX.Element;
|
|
8
8
|
export declare const Button: ButtonComponent;
|
|
9
9
|
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
2
|
+
import { clsx as s } from "../external/clsx/dist/clsx.js";
|
|
3
|
+
import { forwardRef as u } from "react";
|
|
4
|
+
import a from "../styles.module.css.js";
|
|
5
|
+
const x = u(function({ as: t, className: r, ...o }, m) {
|
|
6
|
+
const n = t || (o.href ? "a" : "button");
|
|
7
|
+
return /* @__PURE__ */ f(n, { className: s(a.button, r), ref: m, ...o });
|
|
8
|
+
});
|
|
9
|
+
export {
|
|
10
|
+
x as Button
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.js","sources":["../../designsystem/button/button.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { type JSX, forwardRef } from \"react\";\nimport type {\n\tPolymorphicComponentPropWithRef,\n\tPolymorphicRef,\n} from \"../react-types\";\nimport styles from \"../styles.module.css\";\n\ntype ButtonBaseProps<Href> = {\n\thref?: Href;\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>({ as, className, ...rest }: ButtonProps<Href, As>, ref?: PolymorphicRef<As>) {\n\tconst Tag = as || (rest.href ? \"a\" : \"button\");\n\n\treturn <Tag className={clsx(styles.button, className)} ref={ref} {...rest} />;\n}) as ButtonComponent; // Needed to tell Typescript this does not return ReactNode but acutally JSX.Element\n"],"names":["Button","forwardRef","as","className","rest","ref","Tag","jsx","clsx","styles"],"mappings":";;;;AAwBa,MAAAA,IAA0BC,EAAiB,SAGtD,EAAE,IAAAC,GAAI,WAAAC,GAAW,GAAGC,EAAK,GAA0BC,GAA0B;AAC9E,QAAMC,IAAMJ,MAAOE,EAAK,OAAO,MAAM;AAE9B,SAAA,gBAAAG,EAACD,GAAI,EAAA,WAAWE,EAAKC,EAAO,QAAQN,CAAS,GAAG,KAAAE,GAAW,GAAGD,EAAM,CAAA;AAC5E,CAAC;"}
|
|
@@ -8,6 +8,7 @@ declare const meta: {
|
|
|
8
8
|
export default meta;
|
|
9
9
|
type Story = StoryObj<typeof meta>;
|
|
10
10
|
export declare const Default: Story;
|
|
11
|
+
export declare const React: Story;
|
|
11
12
|
export declare const Sizes: Story;
|
|
12
13
|
export declare const Colors: Story;
|
|
13
14
|
export declare const Nowrap: Story;
|
package/mtds/card/card.d.ts
CHANGED
|
@@ -4,6 +4,6 @@ type CardBaseProps<Href> = {
|
|
|
4
4
|
href?: Href;
|
|
5
5
|
};
|
|
6
6
|
export type CardProps<Href, As extends React.ElementType = Href extends string ? "a" : "div"> = PolymorphicComponentPropWithRef<As, CardBaseProps<Href>>;
|
|
7
|
-
type CardComponent = <Href, As extends React.ElementType = Href extends string ? "a" : "div">(props: CardProps<As>) => JSX.Element;
|
|
7
|
+
type CardComponent = <Href, As extends React.ElementType = Href extends string ? "a" : "div">(props: CardProps<Href, As>) => JSX.Element;
|
|
8
8
|
export declare const Card: CardComponent;
|
|
9
9
|
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
2
|
+
import { clsx as s } from "../external/clsx/dist/clsx.js";
|
|
3
|
+
import { forwardRef as c } from "react";
|
|
4
|
+
import i from "../styles.module.css.js";
|
|
5
|
+
const x = c(function({ as: o, className: m, ...r }, t) {
|
|
6
|
+
const a = o || (r.href ? "a" : "div");
|
|
7
|
+
return /* @__PURE__ */ f(a, { className: s(i.card, m), ref: t, ...r });
|
|
8
|
+
});
|
|
9
|
+
export {
|
|
10
|
+
x as Card
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=card.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card.js","sources":["../../designsystem/card/card.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { type JSX, forwardRef } from \"react\";\nimport type {\n\tPolymorphicComponentPropWithRef,\n\tPolymorphicRef,\n} from \"../react-types\";\nimport styles from \"../styles.module.css\";\n\ntype CardBaseProps<Href> = {\n\thref?: Href;\n};\n\nexport type CardProps<\n\tHref,\n\tAs extends React.ElementType = Href extends string ? \"a\" : \"div\",\n> = PolymorphicComponentPropWithRef<As, CardBaseProps<Href>>;\n\ntype CardComponent = <\n\tHref,\n\tAs extends React.ElementType = Href extends string ? \"a\" : \"div\",\n>(\n\tprops: CardProps<Href, As>,\n) => JSX.Element;\n\nexport const Card: CardComponent = forwardRef<null>(function Card<\n\tHref,\n\tAs extends React.ElementType = Href extends string ? \"a\" : \"div\",\n>({ as, className, ...rest }: CardProps<Href, As>, ref?: PolymorphicRef<As>) {\n\tconst Tag = as || (rest.href ? \"a\" : \"div\");\n\n\treturn <Tag className={clsx(styles.card, className)} ref={ref} {...rest} />;\n}) as CardComponent; // Needed to tell Typescript this does not return ReactNode but acutally JSX.Element\n"],"names":["Card","forwardRef","as","className","rest","ref","Tag","jsx","clsx","styles"],"mappings":";;;;AAwBa,MAAAA,IAAsBC,EAAiB,SAGlD,EAAE,IAAAC,GAAI,WAAAC,GAAW,GAAGC,EAAK,GAAwBC,GAA0B;AAC5E,QAAMC,IAAMJ,MAAOE,EAAK,OAAO,MAAM;AAE9B,SAAA,gBAAAG,EAACD,GAAI,EAAA,WAAWE,EAAKC,EAAO,MAAMN,CAAS,GAAG,KAAAE,GAAW,GAAGD,EAAM,CAAA;AAC1E,CAAC;"}
|
|
@@ -11,6 +11,7 @@ declare const meta: {
|
|
|
11
11
|
export default meta;
|
|
12
12
|
type Story = StoryObj<typeof meta>;
|
|
13
13
|
export declare const Default: Story;
|
|
14
|
+
export declare const React: Story;
|
|
14
15
|
export declare const Sizes: Story;
|
|
15
16
|
export declare const AsLink: Story;
|
|
16
17
|
export declare const Tableish: Story;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { clsx as i } from "../external/clsx/dist/clsx.js";
|
|
3
|
+
import { forwardRef as p } from "react";
|
|
4
|
+
import f from "../styles.module.css.js";
|
|
5
|
+
const n = p(function({ className: r, ...o }, m) {
|
|
6
|
+
return /* @__PURE__ */ t("label", { className: i(f.chip, r), ref: m, ...o });
|
|
7
|
+
});
|
|
8
|
+
export {
|
|
9
|
+
n as Chip
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=chip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chip.js","sources":["../../designsystem/chip/chip.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef } from \"react\";\nimport styles from \"../styles.module.css\";\n\nexport type ChipProps = React.ComponentPropsWithoutRef<\"label\">;\n\nexport const Chip = forwardRef<HTMLLabelElement, ChipProps>(function Chip(\n\t{ className, ...rest },\n\tref,\n) {\n\treturn <label className={clsx(styles.chip, className)} ref={ref} {...rest} />;\n});\n"],"names":["Chip","forwardRef","className","rest","ref","jsx","clsx","styles"],"mappings":";;;;AAMa,MAAAA,IAAOC,EAAwC,SAC3D,EAAE,WAAAC,GAAW,GAAGC,EAAK,GACrBC,GACC;AACM,SAAA,gBAAAC,EAAC,SAAM,EAAA,WAAWC,EAAKC,EAAO,MAAML,CAAS,GAAG,KAAAE,GAAW,GAAGD,EAAM,CAAA;AAC5E,CAAC;"}
|
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
export type DetailsProps = React.ComponentPropsWithoutRef<"details">;
|
|
2
|
-
export
|
|
2
|
+
export type SummaryProps = React.ComponentPropsWithoutRef<"summary">;
|
|
3
|
+
export declare const Details: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.DetailsHTMLAttributes<HTMLDetailsElement>, HTMLDetailsElement>, "ref"> & React.RefAttributes<HTMLDetailsElement>> & {
|
|
4
|
+
Summary: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
5
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { clsx as i } from "../external/clsx/dist/clsx.js";
|
|
3
|
+
import { forwardRef as o } from "react";
|
|
4
|
+
import e from "../styles.module.css.js";
|
|
5
|
+
import "../external/@u-elements/u-details/dist/u-details.js";
|
|
6
|
+
const l = o(
|
|
7
|
+
function({ className: t, ...s }, r) {
|
|
8
|
+
return /* @__PURE__ */ m("u-details", { class: i(e.details, t), ref: r, ...s });
|
|
9
|
+
}
|
|
10
|
+
), n = o(
|
|
11
|
+
function({ className: t, ...s }, r) {
|
|
12
|
+
return /* @__PURE__ */ m("u-summary", { class: t, ref: r, ...s });
|
|
13
|
+
}
|
|
14
|
+
), D = Object.assign(l, { Summary: n });
|
|
15
|
+
export {
|
|
16
|
+
D as Details
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=details.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"details.js","sources":["../../designsystem/details/details.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef } from \"react\";\nimport styles from \"../styles.module.css\";\nimport \"@u-elements/u-details\";\n\nexport type DetailsProps = React.ComponentPropsWithoutRef<\"details\">;\nconst DetailsComp = forwardRef<HTMLDetailsElement, DetailsProps>(\n\tfunction Details({ className, ...rest }, ref) {\n\t\treturn (\n\t\t\t<u-details class={clsx(styles.details, className)} ref={ref} {...rest} />\n\t\t);\n\t},\n);\n\nexport type SummaryProps = React.ComponentPropsWithoutRef<\"summary\">;\nconst DetailsSummary = forwardRef<HTMLElement, SummaryProps>(\n\tfunction DetailsSummary({ className, ...rest }, ref) {\n\t\treturn <u-summary class={className} ref={ref} {...rest} />;\n\t},\n);\n\nexport const Details = Object.assign(DetailsComp, { Summary: DetailsSummary });\n"],"names":["DetailsComp","forwardRef","className","rest","ref","jsx","clsx","styles","DetailsSummary","Details"],"mappings":";;;;;AAMA,MAAMA,IAAcC;AAAA,EACnB,SAAiB,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAAQC,GAAK;AAE5C,WAAA,gBAAAC,EAAC,aAAU,EAAA,OAAOC,EAAKC,EAAO,SAASL,CAAS,GAAG,KAAAE,GAAW,GAAGD,EAAM,CAAA;AAAA,EAAA;AAG1E,GAGMK,IAAiBP;AAAA,EACtB,SAAwB,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAAQC,GAAK;AACpD,6BAAQ,aAAU,EAAA,OAAOF,GAAW,KAAAE,GAAW,GAAGD,GAAM;AAAA,EAAA;AAE1D,GAEaM,IAAU,OAAO,OAAOT,GAAa,EAAE,SAASQ,EAAgB,CAAA;"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { clsx as l } from "../external/clsx/dist/clsx.js";
|
|
3
|
+
import { forwardRef as a, useRef as m, useImperativeHandle as u, useEffect as p } from "react";
|
|
4
|
+
import d from "../styles.module.css.js";
|
|
5
|
+
const D = a(
|
|
6
|
+
function({ className: s, open: r, modal: e, ...f }, i) {
|
|
7
|
+
const o = m(null);
|
|
8
|
+
return u(i, () => o.current), p(() => {
|
|
9
|
+
var t;
|
|
10
|
+
const n = r ? e ? "showModal" : "show" : "close";
|
|
11
|
+
(t = o.current) == null || t[n]();
|
|
12
|
+
}, [r, e]), /* @__PURE__ */ c(
|
|
13
|
+
"dialog",
|
|
14
|
+
{
|
|
15
|
+
className: l(d.dialog, s),
|
|
16
|
+
ref: o,
|
|
17
|
+
...f
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
export {
|
|
23
|
+
D as Dialog
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.js","sources":["../../designsystem/dialog/dialog.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef, useEffect, useImperativeHandle, useRef } from \"react\";\nimport styles from \"../styles.module.css\";\n\nexport type DialogProps = React.ComponentPropsWithoutRef<\"dialog\"> & {\n\tmodal: boolean;\n};\n\nexport const Dialog = forwardRef<HTMLDialogElement, DialogProps>(\n\tfunction Dialog({ className, open, modal, ...rest }, ref) {\n\t\tconst innerRef = useRef<HTMLDialogElement>(null);\n\n\t\tuseImperativeHandle(ref, () => innerRef.current as HTMLDialogElement); // Forward innerRef\n\t\tuseEffect(() => {\n\t\t\tconst action = open ? (modal ? \"showModal\" : \"show\") : \"close\";\n\t\t\tinnerRef.current?.[action]();\n\t\t}, [open, modal]);\n\n\t\treturn (\n\t\t\t<dialog\n\t\t\t\tclassName={clsx(styles.dialog, className)}\n\t\t\t\tref={innerRef}\n\t\t\t\t{...rest}\n\t\t\t/>\n\t\t);\n\t},\n);\n"],"names":["Dialog","forwardRef","className","open","modal","rest","ref","innerRef","useRef","useImperativeHandle","useEffect","action","_a","jsx","clsx","styles"],"mappings":";;;;AAQO,MAAMA,IAASC;AAAA,EACrB,SAAgB,EAAE,WAAAC,GAAW,MAAAC,GAAM,OAAAC,GAAO,GAAGC,EAAK,GAAGC,GAAK;AACnD,UAAAC,IAAWC,EAA0B,IAAI;AAE3B,WAAAC,EAAAH,GAAK,MAAMC,EAAS,OAA4B,GACpEG,EAAU,MAAM;;AACf,YAAMC,IAASR,IAAQC,IAAQ,cAAc,SAAU;AAC9C,OAAAQ,IAAAL,EAAA,YAAA,QAAAK,EAAUD;AAAA,IAAQ,GACzB,CAACR,GAAMC,CAAK,CAAC,GAGf,gBAAAS;AAAA,MAAC;AAAA,MAAA;AAAA,QACA,WAAWC,EAAKC,EAAO,QAAQb,CAAS;AAAA,QACxC,KAAKK;AAAA,QACJ,GAAGF;AAAA,MAAA;AAAA,IACL;AAAA,EAAA;AAGH;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { clsx as t } from "../external/clsx/dist/clsx.js";
|
|
3
|
+
import { forwardRef as m } from "react";
|
|
4
|
+
import d from "../styles.module.css.js";
|
|
5
|
+
const c = m(function({ className: r, ...i }, o) {
|
|
6
|
+
return (
|
|
7
|
+
// biome-ignore lint/a11y/noAriaHiddenOnFocusable: This is a decorative element
|
|
8
|
+
/* @__PURE__ */ e(
|
|
9
|
+
"hr",
|
|
10
|
+
{
|
|
11
|
+
"aria-hidden": "true",
|
|
12
|
+
className: t(d.divider, r),
|
|
13
|
+
ref: o,
|
|
14
|
+
...i
|
|
15
|
+
}
|
|
16
|
+
)
|
|
17
|
+
);
|
|
18
|
+
});
|
|
19
|
+
export {
|
|
20
|
+
c as Divider
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=divider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"divider.js","sources":["../../designsystem/divider/divider.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef } from \"react\";\nimport styles from \"../styles.module.css\";\n\nexport type DividerProps = React.ComponentPropsWithoutRef<\"hr\">;\n\nexport const Divider = forwardRef<HTMLHRElement, DividerProps>(function Divider(\n\t{ className, ...rest },\n\tref,\n) {\n\treturn (\n\t\t// biome-ignore lint/a11y/noAriaHiddenOnFocusable: This is a decorative element\n\t\t<hr\n\t\t\taria-hidden=\"true\"\n\t\t\tclassName={clsx(styles.divider, className)}\n\t\t\tref={ref}\n\t\t\t{...rest}\n\t\t/>\n\t);\n});\n"],"names":["Divider","forwardRef","className","rest","ref","jsx","clsx","styles"],"mappings":";;;;AAMa,MAAAA,IAAUC,EAAwC,SAC9D,EAAE,WAAAC,GAAW,GAAGC,EAAK,GACrBC,GACC;AACD;AAAA;AAAA,IAEC,gBAAAC;AAAA,MAAC;AAAA,MAAA;AAAA,QACA,eAAY;AAAA,QACZ,WAAWC,EAAKC,EAAO,SAASL,CAAS;AAAA,QACzC,KAAAE;AAAA,QACC,GAAGD;AAAA,MAAA;AAAA,IAAA;AAAA;AAGP,CAAC;"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { clsx as u } from "../external/clsx/dist/clsx.js";
|
|
3
|
+
import { forwardRef as c, useRef as a, useImperativeHandle as s, useEffect as i } from "react";
|
|
4
|
+
import l from "../styles.module.css.js";
|
|
5
|
+
const b = c(
|
|
6
|
+
function({ className: o, ...f }, n) {
|
|
7
|
+
const e = a(null);
|
|
8
|
+
return s(n, () => e.current), i(() => {
|
|
9
|
+
var t;
|
|
10
|
+
const r = (t = e.current) == null ? void 0 : t.firstElementChild;
|
|
11
|
+
r instanceof HTMLHeadingElement && (r.setAttribute("tabindex", "-1"), r.focus());
|
|
12
|
+
}, []), s(n, () => e.current), i(() => {
|
|
13
|
+
var t;
|
|
14
|
+
const r = (t = e.current) == null ? void 0 : t.firstElementChild;
|
|
15
|
+
r instanceof HTMLHeadingElement && (r.setAttribute("tabindex", "-1"), r.focus());
|
|
16
|
+
}, []), /* @__PURE__ */ m(
|
|
17
|
+
"div",
|
|
18
|
+
{
|
|
19
|
+
className: u(l.errorsummary, o),
|
|
20
|
+
role: "alert",
|
|
21
|
+
ref: e,
|
|
22
|
+
...f
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
export {
|
|
28
|
+
b as Errorsummary
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=errorsummary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errorsummary.js","sources":["../../designsystem/errorsummary/errorsummary.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef, useEffect, useImperativeHandle, useRef } from \"react\";\nimport styles from \"../styles.module.css\";\n\nexport type ErrorsummaryProps = React.ComponentPropsWithoutRef<\"div\">;\n\nexport const Errorsummary = forwardRef<HTMLDivElement, ErrorsummaryProps>(\n\tfunction Errorsummary({ className, ...rest }, ref) {\n\t\tconst innerRef = useRef<HTMLDivElement>(null);\n\n\t\tuseImperativeHandle(ref, () => innerRef.current as HTMLDivElement); // Forward innerRef\n\t\tuseEffect(() => {\n\t\t\tconst first = innerRef.current?.firstElementChild;\n\n\t\t\tif (first instanceof HTMLHeadingElement) {\n\t\t\t\tfirst.setAttribute(\"tabindex\", \"-1\");\n\t\t\t\tfirst.focus(); // Autofocus first heading\n\t\t\t}\n\t\t}, []);\n\n\t\tuseImperativeHandle(ref, () => innerRef.current as HTMLDivElement); // Forward innerRef\n\t\tuseEffect(() => {\n\t\t\tconst first = innerRef.current?.firstElementChild;\n\n\t\t\tif (first instanceof HTMLHeadingElement) {\n\t\t\t\tfirst.setAttribute(\"tabindex\", \"-1\");\n\t\t\t\tfirst.focus(); // Autofocus first heading\n\t\t\t}\n\t\t}, []);\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tclassName={clsx(styles.errorsummary, className)}\n\t\t\t\trole=\"alert\"\n\t\t\t\tref={innerRef}\n\t\t\t\t{...rest}\n\t\t\t/>\n\t\t);\n\t},\n);\n"],"names":["Errorsummary","forwardRef","className","rest","ref","innerRef","useRef","useImperativeHandle","useEffect","first","_a","jsx","clsx","styles"],"mappings":";;;;AAMO,MAAMA,IAAeC;AAAA,EAC3B,SAAsB,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAAQC,GAAK;AAC5C,UAAAC,IAAWC,EAAuB,IAAI;AAExB,WAAAC,EAAAH,GAAK,MAAMC,EAAS,OAAyB,GACjEG,EAAU,MAAM;;AACT,YAAAC,KAAQC,IAAAL,EAAS,YAAT,gBAAAK,EAAkB;AAEhC,MAAID,aAAiB,uBACdA,EAAA,aAAa,YAAY,IAAI,GACnCA,EAAM,MAAM;AAAA,IAEd,GAAG,EAAE,GAEeF,EAAAH,GAAK,MAAMC,EAAS,OAAyB,GACjEG,EAAU,MAAM;;AACT,YAAAC,KAAQC,IAAAL,EAAS,YAAT,gBAAAK,EAAkB;AAEhC,MAAID,aAAiB,uBACdA,EAAA,aAAa,YAAY,IAAI,GACnCA,EAAM,MAAM;AAAA,IAEd,GAAG,EAAE,GAGJ,gBAAAE;AAAA,MAAC;AAAA,MAAA;AAAA,QACA,WAAWC,EAAKC,EAAO,cAAcX,CAAS;AAAA,QAC9C,MAAK;AAAA,QACL,KAAKG;AAAA,QACJ,GAAGF;AAAA,MAAA;AAAA,IACL;AAAA,EAAA;AAGH;"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
var h = typeof window < "u" && typeof window.document < "u" && typeof window.navigator < "u", c;
|
|
2
|
+
h && // @ts-expect-error Typescript has not implemented userAgentData yet https://stackoverflow.com/a/71392474
|
|
3
|
+
/^Mac/i.test(((c = navigator.userAgentData) == null ? void 0 : c.platform) || navigator.platform);
|
|
4
|
+
var y = ":host(:not([hidden])) { display: block }", m = typeof HTMLElement > "u" ? class {
|
|
5
|
+
} : HTMLElement;
|
|
6
|
+
function i(t, e, n) {
|
|
7
|
+
var o;
|
|
8
|
+
return n === void 0 ? (o = t.getAttribute(e)) != null ? o : null : (n === null ? t.removeAttribute(e) : t.getAttribute(e) !== n && t.setAttribute(e, n), null);
|
|
9
|
+
}
|
|
10
|
+
var f = (t, e, n) => {
|
|
11
|
+
for (const o of n[0].split(","))
|
|
12
|
+
n[0] = o, Element.prototype[`${t}EventListener`].apply(e, n);
|
|
13
|
+
}, d = (t, ...e) => f("add", t, e), u = (t, ...e) => f("remove", t, e), b = (t) => {
|
|
14
|
+
const e = "key" in t && (t.key === " " || t.key === "Enter");
|
|
15
|
+
return e && t.preventDefault(), e && t.target instanceof HTMLElement && t.target.click(), e;
|
|
16
|
+
}, v = (t) => {
|
|
17
|
+
var e;
|
|
18
|
+
const n = ((e = t.getRootNode) == null ? void 0 : e.call(t)) || t.ownerDocument;
|
|
19
|
+
return n instanceof Document || n instanceof ShadowRoot ? n : document;
|
|
20
|
+
}, r = (t, e, n) => {
|
|
21
|
+
const o = document.createElement(t);
|
|
22
|
+
if (e && (o.textContent = e), n) for (const [s, a] of Object.entries(n)) i(o, s, a);
|
|
23
|
+
return o;
|
|
24
|
+
}, p = {
|
|
25
|
+
define: (t, e) => !h || window.customElements.get(t) || window.customElements.define(t, e)
|
|
26
|
+
}, g = class extends m {
|
|
27
|
+
constructor() {
|
|
28
|
+
super(), this._content = null, this.attachShadow({ mode: "open" }).append(
|
|
29
|
+
r("slot", null, { name: "summary" }),
|
|
30
|
+
r("slot", null, { part: "details-content" }),
|
|
31
|
+
r(
|
|
32
|
+
"style",
|
|
33
|
+
`${y}
|
|
34
|
+
::slotted(u-summary) { cursor: pointer; display: list-item; counter-increment: list-item 0; list-style: disclosure-closed inside }
|
|
35
|
+
::slotted(u-summary[aria-expanded="true"]) { list-style-type: disclosure-open }
|
|
36
|
+
:host > [part="details-content"]:not([hidden=""]) { display: block }`
|
|
37
|
+
)
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
// Using ES2015 syntax for backwards compatibility
|
|
41
|
+
static get observedAttributes() {
|
|
42
|
+
return ["open"];
|
|
43
|
+
}
|
|
44
|
+
connectedCallback() {
|
|
45
|
+
var t;
|
|
46
|
+
this._content = (t = this.shadowRoot) == null ? void 0 : t.children[1], d(this._content, "beforematch", this), d(this, "click,keydown", this), this.attributeChangedCallback();
|
|
47
|
+
}
|
|
48
|
+
disconnectedCallback() {
|
|
49
|
+
this._content && u(this._content, "beforematch", this), u(this, "click,keydown", this), this._content = null;
|
|
50
|
+
}
|
|
51
|
+
attributeChangedCallback(t, e, n) {
|
|
52
|
+
const o = "onbeforematch" in this ? "until-found" : !0, s = this.open;
|
|
53
|
+
for (const a of this.children)
|
|
54
|
+
a.nodeName === "U-SUMMARY" && i(a, "aria-expanded", `${s}`);
|
|
55
|
+
if (this._content && (i(this._content, "aria-hidden", `${!s}`), this._content.hidden = s ? !1 : o), s && this.name) {
|
|
56
|
+
const a = v(this).querySelectorAll(
|
|
57
|
+
`${this.nodeName}[name="${this.name}"]`
|
|
58
|
+
);
|
|
59
|
+
for (const l of a)
|
|
60
|
+
l !== this && (l.open = !1);
|
|
61
|
+
}
|
|
62
|
+
t === "open" && e === null != (n === null) && this.dispatchEvent(new Event("toggle"));
|
|
63
|
+
}
|
|
64
|
+
handleEvent(t) {
|
|
65
|
+
const e = this.querySelector(":scope > u-summary"), n = e == null ? void 0 : e.contains(t.target);
|
|
66
|
+
t.defaultPrevented || (t.type === "beforematch" && (this.open = !0), n && t.type === "keydown" && b(t), n && t.type === "click" && (this.open = !this.open));
|
|
67
|
+
}
|
|
68
|
+
get open() {
|
|
69
|
+
return this.hasAttribute("open");
|
|
70
|
+
}
|
|
71
|
+
set open(t) {
|
|
72
|
+
i(this, "open", t ? "" : null);
|
|
73
|
+
}
|
|
74
|
+
get name() {
|
|
75
|
+
return i(this, "name") || "";
|
|
76
|
+
}
|
|
77
|
+
set name(t) {
|
|
78
|
+
i(this, "name", t);
|
|
79
|
+
}
|
|
80
|
+
}, k = class extends m {
|
|
81
|
+
connectedCallback() {
|
|
82
|
+
i(this, "role", "button"), this.slot = "summary", this.tabIndex = 0;
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
p.define("u-details", g);
|
|
86
|
+
p.define("u-summary", k);
|
|
87
|
+
export {
|
|
88
|
+
g as UHTMLDetailsElement,
|
|
89
|
+
k as UHTMLSummaryElement
|
|
90
|
+
};
|
|
91
|
+
//# sourceMappingURL=u-details.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"u-details.js","sources":["../../../../../node_modules/@u-elements/u-details/dist/u-details.js"],"sourcesContent":["// ../utils.ts\nvar IS_BROWSER = typeof window !== \"undefined\" && typeof window.document !== \"undefined\" && typeof window.navigator !== \"undefined\";\nvar _a;\nIS_BROWSER && // @ts-expect-error Typescript has not implemented userAgentData yet https://stackoverflow.com/a/71392474\n/^Mac/i.test(((_a = navigator.userAgentData) == null ? void 0 : _a.platform) || navigator.platform);\nvar DISPLAY_BLOCK = \":host(:not([hidden])) { display: block }\";\nvar UHTMLElement = typeof HTMLElement === \"undefined\" ? class {\n} : HTMLElement;\nfunction attr(el, name, value) {\n var _a2;\n if (value === void 0) return (_a2 = el.getAttribute(name)) != null ? _a2 : null;\n if (value === null) el.removeAttribute(name);\n else if (el.getAttribute(name) !== value) el.setAttribute(name, value);\n return null;\n}\nvar events = (action, element, rest) => {\n for (const type of rest[0].split(\",\")) {\n rest[0] = type;\n Element.prototype[`${action}EventListener`].apply(element, rest);\n }\n};\nvar on = (element, ...rest) => events(\"add\", element, rest);\nvar off = (element, ...rest) => events(\"remove\", element, rest);\nvar asButton = (event) => {\n const isClick = \"key\" in event && (event.key === \" \" || event.key === \"Enter\");\n if (isClick) event.preventDefault();\n if (isClick && event.target instanceof HTMLElement) event.target.click();\n return isClick;\n};\nvar getRoot = (node) => {\n var _a2;\n const root = ((_a2 = node.getRootNode) == null ? void 0 : _a2.call(node)) || node.ownerDocument;\n return root instanceof Document || root instanceof ShadowRoot ? root : document;\n};\nvar createElement = (tagName, text, attrs) => {\n const el = document.createElement(tagName);\n if (text) el.textContent = text;\n if (attrs) for (const [key, val] of Object.entries(attrs)) attr(el, key, val);\n return el;\n};\nvar customElements = {\n define: (name, instance) => !IS_BROWSER || window.customElements.get(name) || window.customElements.define(name, instance)\n};\n\n// u-details.ts\nvar UHTMLDetailsElement = class extends UHTMLElement {\n constructor() {\n super();\n // Using underscore instead of private fields for backwards compatibility\n this._content = null;\n this.attachShadow({ mode: \"open\" }).append(\n createElement(\"slot\", null, { name: \"summary\" }),\n createElement(\"slot\", null, { part: \"details-content\" }),\n createElement(\n \"style\",\n `${DISPLAY_BLOCK}\n ::slotted(u-summary) { cursor: pointer; display: list-item; counter-increment: list-item 0; list-style: disclosure-closed inside }\n ::slotted(u-summary[aria-expanded=\"true\"]) { list-style-type: disclosure-open }\n\t\t\t\t:host > [part=\"details-content\"]:not([hidden=\"\"]) { display: block }`\n )\n );\n }\n // Using ES2015 syntax for backwards compatibility\n static get observedAttributes() {\n return [\"open\"];\n }\n connectedCallback() {\n var _a2;\n this._content = (_a2 = this.shadowRoot) == null ? void 0 : _a2.children[1];\n on(this._content, \"beforematch\", this);\n on(this, \"click,keydown\", this);\n this.attributeChangedCallback();\n }\n disconnectedCallback() {\n if (this._content) off(this._content, \"beforematch\", this);\n off(this, \"click,keydown\", this);\n this._content = null;\n }\n attributeChangedCallback(prop, prev, next) {\n const hide = \"onbeforematch\" in this ? \"until-found\" : true;\n const open = this.open;\n for (const el of this.children)\n if (el.nodeName === \"U-SUMMARY\") attr(el, \"aria-expanded\", `${open}`);\n if (this._content) {\n attr(this._content, \"aria-hidden\", `${!open}`);\n this._content.hidden = open ? false : hide;\n }\n if (open && this.name) {\n const uDetailsList = getRoot(this).querySelectorAll(\n `${this.nodeName}[name=\"${this.name}\"]`\n );\n for (const uDetails of uDetailsList)\n if (uDetails !== this) uDetails.open = false;\n }\n if (prop === \"open\" && prev === null !== (next === null))\n this.dispatchEvent(new Event(\"toggle\"));\n }\n handleEvent(event) {\n const summary = this.querySelector(\":scope > u-summary\");\n const isSummary = summary == null ? void 0 : summary.contains(event.target);\n if (event.defaultPrevented) return;\n if (event.type === \"beforematch\") this.open = true;\n if (isSummary && event.type === \"keydown\") asButton(event);\n if (isSummary && event.type === \"click\") this.open = !this.open;\n }\n get open() {\n return this.hasAttribute(\"open\");\n }\n set open(value) {\n attr(this, \"open\", value ? \"\" : null);\n }\n get name() {\n return attr(this, \"name\") || \"\";\n }\n set name(value) {\n attr(this, \"name\", value);\n }\n};\nvar UHTMLSummaryElement = class extends UHTMLElement {\n connectedCallback() {\n attr(this, \"role\", \"button\");\n this.slot = \"summary\";\n this.tabIndex = 0;\n }\n};\ncustomElements.define(\"u-details\", UHTMLDetailsElement);\ncustomElements.define(\"u-summary\", UHTMLSummaryElement);\n\nexport { UHTMLDetailsElement, UHTMLSummaryElement };\n"],"names":["IS_BROWSER","_a","DISPLAY_BLOCK","UHTMLElement","attr","el","name","value","_a2","events","action","element","rest","type","on","off","asButton","event","isClick","getRoot","node","root","createElement","tagName","text","attrs","key","val","customElements","instance","UHTMLDetailsElement","prop","prev","next","hide","open","uDetailsList","uDetails","summary","isSummary","UHTMLSummaryElement"],"mappings":"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","x_google_ignoreList":[0]}
|