@mattilsynet/design 1.0.6 → 1.0.7

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.
Files changed (79) hide show
  1. package/mtds/avatar/avatar.stories.d.ts +1 -0
  2. package/mtds/badge/badge.d.ts +2 -2
  3. package/mtds/badge/badge.js.map +1 -1
  4. package/mtds/breadcrumbs/breadcrumbs-observer.d.ts +1 -0
  5. package/mtds/breadcrumbs/breadcrumbs-observer.js +12 -0
  6. package/mtds/breadcrumbs/breadcrumbs-observer.js.map +1 -0
  7. package/mtds/breadcrumbs/breadcrumbs.js +13 -21
  8. package/mtds/breadcrumbs/breadcrumbs.js.map +1 -1
  9. package/mtds/button/button.d.ts +1 -1
  10. package/mtds/button/button.js.map +1 -1
  11. package/mtds/card/card.d.ts +9 -1
  12. package/mtds/card/card.js +22 -8
  13. package/mtds/card/card.js.map +1 -1
  14. package/mtds/card/card.stories.d.ts +1 -1
  15. package/mtds/dialog/dialog-observer.d.ts +1 -2
  16. package/mtds/dialog/dialog-observer.js +19 -17
  17. package/mtds/dialog/dialog-observer.js.map +1 -1
  18. package/mtds/dialog/dialog.d.ts +4 -2
  19. package/mtds/dialog/dialog.js +11 -15
  20. package/mtds/dialog/dialog.js.map +1 -1
  21. package/mtds/dialog/dialog.stories.d.ts +1 -0
  22. package/mtds/divider/divider.d.ts +2 -2
  23. package/mtds/divider/divider.js.map +1 -1
  24. package/mtds/errorsummary/errorsummary-observer.d.ts +1 -0
  25. package/mtds/errorsummary/errorsummary-observer.js +10 -0
  26. package/mtds/errorsummary/errorsummary-observer.js.map +1 -0
  27. package/mtds/errorsummary/errorsummary.js +11 -17
  28. package/mtds/errorsummary/errorsummary.js.map +1 -1
  29. package/mtds/external/@u-elements/u-datalist/dist/u-datalist.js +47 -48
  30. package/mtds/external/@u-elements/u-datalist/dist/u-datalist.js.map +1 -1
  31. package/mtds/external/@u-elements/u-details/dist/u-details.js +9 -8
  32. package/mtds/external/@u-elements/u-details/dist/u-details.js.map +1 -1
  33. package/mtds/external/@u-elements/u-tags/dist/u-tags.js +160 -162
  34. package/mtds/external/@u-elements/u-tags/dist/u-tags.js.map +1 -1
  35. package/mtds/field/field-helper.d.ts +1 -0
  36. package/mtds/field/field-observer.d.ts +1 -2
  37. package/mtds/field/field-observer.js +32 -41
  38. package/mtds/field/field-observer.js.map +1 -1
  39. package/mtds/field/field.d.ts +7 -0
  40. package/mtds/field/field.js +49 -34
  41. package/mtds/field/field.js.map +1 -1
  42. package/mtds/field/field.stories.d.ts +4 -2
  43. package/mtds/fieldset/fieldset-observer.d.ts +1 -2
  44. package/mtds/fieldset/fieldset-observer.js +12 -16
  45. package/mtds/fieldset/fieldset-observer.js.map +1 -1
  46. package/mtds/index.d.ts +3 -3
  47. package/mtds/index.iife.js +6 -5
  48. package/mtds/index.iife.js.map +1 -1
  49. package/mtds/index.js +13 -24
  50. package/mtds/index.js.map +1 -1
  51. package/mtds/layout/app-observer.d.ts +1 -2
  52. package/mtds/layout/app-observer.js +11 -16
  53. package/mtds/layout/app-observer.js.map +1 -1
  54. package/mtds/layout/layout.d.ts +17 -6
  55. package/mtds/layout/layout.js +12 -9
  56. package/mtds/layout/layout.js.map +1 -1
  57. package/mtds/logo/logo-observer.d.ts +1 -2
  58. package/mtds/logo/logo-observer.js +14 -18
  59. package/mtds/logo/logo-observer.js.map +1 -1
  60. package/mtds/popover/popover-observer.d.ts +1 -2
  61. package/mtds/popover/popover-observer.js +12 -21
  62. package/mtds/popover/popover-observer.js.map +1 -1
  63. package/mtds/react-types.d.ts +11 -0
  64. package/mtds/react.js +42 -40
  65. package/mtds/styles.css +1 -1
  66. package/mtds/styles.json +34 -34
  67. package/mtds/styles.module.css.js +58 -56
  68. package/mtds/styles.module.css.js.map +1 -1
  69. package/mtds/table/table-observer.d.ts +1 -2
  70. package/mtds/table/table-observer.js +10 -14
  71. package/mtds/table/table-observer.js.map +1 -1
  72. package/mtds/tag/tag.d.ts +2 -6
  73. package/mtds/tag/tag.js.map +1 -1
  74. package/mtds/tooltip/tooltip-observer.js +27 -20
  75. package/mtds/tooltip/tooltip-observer.js.map +1 -1
  76. package/mtds/utils.d.ts +2 -19
  77. package/mtds/utils.js +32 -26
  78. package/mtds/utils.js.map +1 -1
  79. package/package.json +18 -18
@@ -10,3 +10,4 @@ type Story = StoryObj<typeof meta>;
10
10
  export declare const Default: Story;
11
11
  export declare const React: Story;
12
12
  export declare const Sizes: Story;
13
+ export declare const WithBadge: Story;
@@ -1,6 +1,6 @@
1
1
  export type BadgeProps = React.ComponentPropsWithoutRef<"span"> & {
2
- "data-badge"?: string | number;
2
+ "data-badge"?: string | number | boolean;
3
3
  };
4
4
  export declare const Badge: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
5
- "data-badge"?: string | number;
5
+ "data-badge"?: string | number | boolean;
6
6
  } & React.RefAttributes<HTMLSpanElement>>;
@@ -1 +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\t\"data-badge\"?: string | number;\n};\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":";;;;AAQa,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;"}
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\t\"data-badge\"?: string | number | boolean;\n};\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":";;;;AAQa,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 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ import n from "../styles.module.css.js";
2
+ import { IS_BROWSER as t, on as i, QUICK_EVENT as l, debounce as s, attr as u } from "../utils.js";
3
+ const f = n.breadcrumbs.split(" ")[0], e = t && document.getElementsByClassName(f);
4
+ function d(o) {
5
+ if (!(!e || o.animationName !== n._onInjectCrumb))
6
+ for (const r of e)
7
+ r.querySelectorAll("li a").forEach((a, c, { length: m }) => {
8
+ u(a, "aria-current", c === m - 1 ? "page" : null);
9
+ });
10
+ }
11
+ t && i(document, "animationend", s(d, 100), l);
12
+ //# sourceMappingURL=breadcrumbs-observer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"breadcrumbs-observer.js","sources":["../../designsystem/breadcrumbs/breadcrumbs-observer.ts"],"sourcesContent":["import styles from \"../styles.module.css\";\nimport { IS_BROWSER, QUICK_EVENT, attr, debounce, on } from \"../utils\";\n\nconst CSS_BREADCRUMBS = styles.breadcrumbs.split(\" \")[0];\nconst BREADCRUMBS = IS_BROWSER && document.getElementsByClassName(CSS_BREADCRUMBS);\n\nfunction handleInject(event: Event & { animationName?: string }) {\n if (!BREADCRUMBS || event.animationName !== styles._onInjectCrumb) return;\n for (const breadcumbs of BREADCRUMBS)\n breadcumbs.querySelectorAll('li a').forEach((crumb, index, { length }) => {\n attr(crumb, 'aria-current', index === length - 1 ? 'page' : null);\n });\n}\n\nif (IS_BROWSER)\n on(document, 'animationend', debounce(handleInject, 100), QUICK_EVENT);"],"names":["CSS_BREADCRUMBS","styles","BREADCRUMBS","IS_BROWSER","handleInject","event","breadcumbs","crumb","index","length","attr","on","debounce","QUICK_EVENT"],"mappings":";;AAGA,MAAMA,IAAkBC,EAAO,YAAY,MAAM,GAAG,EAAE,CAAC,GACjDC,IAAcC,KAAc,SAAS,uBAAuBH,CAAe;AAEjF,SAASI,EAAaC,GAA2C;AAC/D,MAAI,GAACH,KAAeG,EAAM,kBAAkBJ,EAAO;AACnD,eAAWK,KAAcJ;AACZ,MAAAI,EAAA,iBAAiB,MAAM,EAAE,QAAQ,CAACC,GAAOC,GAAO,EAAE,QAAAC,QAAa;AACxE,QAAAC,EAAKH,GAAO,gBAAgBC,MAAUC,IAAS,IAAI,SAAS,IAAI;AAAA,MAAA,CACjE;AACL;AAEIN,KACFQ,EAAG,UAAU,gBAAgBC,EAASR,GAAc,GAAG,GAAGS,CAAW;"}
@@ -1,29 +1,21 @@
1
- import { jsx as m } from "react/jsx-runtime";
2
- import { clsx as f } from "../external/clsx/dist/clsx.js";
3
- import { forwardRef as i, useRef as u, useImperativeHandle as p, useEffect as b } from "react";
4
- import d from "../styles.module.css.js";
5
- import { attr as g } from "../utils.js";
6
- const E = i(
7
- function({ as: o, className: a, ...t }, s) {
8
- const r = u(null), c = o || "nav";
9
- return p(s, () => r.current), b(() => {
10
- if (r.current instanceof HTMLElement) {
11
- const e = r.current.querySelectorAll("li > :is(a,button)"), l = e[e.length - 1];
12
- for (const n of e)
13
- g(n, "aria-current", n === l ? "page" : null);
14
- }
15
- }), /* @__PURE__ */ m(
16
- c,
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import { clsx as s } from "../external/clsx/dist/clsx.js";
3
+ import { forwardRef as t } from "react";
4
+ import c from "../styles.module.css.js";
5
+ const p = t(
6
+ function({ as: a, className: o, ...r }, m) {
7
+ return /* @__PURE__ */ e(
8
+ a || "nav",
17
9
  {
18
- "aria-label": t["aria-label"] || "Du er her:",
19
- className: f(d.breadcrumbs, a),
20
- ref: r,
21
- ...t
10
+ "aria-label": r["aria-label"] || "Du er her:",
11
+ className: s(c.breadcrumbs, o),
12
+ ref: m,
13
+ ...r
22
14
  }
23
15
  );
24
16
  }
25
17
  );
26
18
  export {
27
- E as Breadcrumbs
19
+ p as Breadcrumbs
28
20
  };
29
21
  //# sourceMappingURL=breadcrumbs.js.map
@@ -1 +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\";\nimport { attr } from \"../utils\";\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\tattr(item, \"aria-current\", item === last ? \"page\" : null);\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","attr","jsx","clsx","styles"],"mappings":";;;;;AAsBO,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;AAClB,UAAAG,EAAKD,GAAM,gBAAgBA,MAASD,IAAO,SAAS,IAAI;AAAA,MAAA;AAAA,IAC1D,CACA,GAGA,gBAAAG;AAAA,MAACP;AAAA,MAAA;AAAA,QACA,cAAYJ,EAAK,YAAY,KAAK;AAAA,QAClC,WAAWY,EAAKC,EAAO,aAAad,CAAS;AAAA,QAC7C,KAAKG;AAAA,QACJ,GAAGF;AAAA,MAAA;AAAA,IACL;AAAA,EAAA;AAGH;"}
1
+ {"version":3,"file":"breadcrumbs.js","sources":["../../designsystem/breadcrumbs/breadcrumbs.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 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 Tag = as || \"nav\";\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={ref}\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","jsx","clsx","styles"],"mappings":";;;;AAeO,MAAMA,IAAoCC;AAAA,EAChD,SACC,EAAE,IAAAC,GAAI,WAAAC,GAAW,GAAGC,KACpBC,GACC;AAIA,WAAA,gBAAAC;AAAA,MAHWJ,KAAM;AAAA,MAGhB;AAAA,QACA,cAAYE,EAAK,YAAY,KAAK;AAAA,QAClC,WAAWG,EAAKC,EAAO,aAAaL,CAAS;AAAA,QAC7C,KAAAE;AAAA,QACC,GAAGD;AAAA,MAAA;AAAA,IACL;AAAA,EAAA;AAGH;"}
@@ -2,7 +2,7 @@ import { JSX } from 'react';
2
2
  import { PolymorphicComponentPropWithRef } from '../react-types';
3
3
  type ButtonBaseProps<Href> = {
4
4
  "data-arrow"?: "left" | "right" | true;
5
- "data-color"?: "accent" | "danger";
5
+ "data-color"?: "main" | "danger";
6
6
  "data-justify"?: "start" | "center" | "right";
7
7
  "data-nowrap"?: boolean;
8
8
  "data-variant"?: "primary" | "secondary" | "tertiary";
@@ -1 +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\t\"data-arrow\"?: \"left\" | \"right\" | true;\n\t\"data-color\"?: \"accent\" | \"danger\";\n\t\"data-justify\"?: \"start\" | \"center\" | \"right\";\n\t\"data-nowrap\"?: boolean;\n\t\"data-variant\"?: \"primary\" | \"secondary\" | \"tertiary\";\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":";;;;AA6Ba,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;"}
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\t\"data-arrow\"?: \"left\" | \"right\" | true;\n\t\"data-color\"?: \"main\" | \"danger\";\n\t\"data-justify\"?: \"start\" | \"center\" | \"right\";\n\t\"data-nowrap\"?: boolean;\n\t\"data-variant\"?: \"primary\" | \"secondary\" | \"tertiary\";\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":";;;;AA6Ba,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;"}
@@ -5,5 +5,13 @@ type CardBaseProps<Href> = {
5
5
  };
6
6
  export type CardProps<Href, As extends React.ElementType = Href extends string ? "a" : "div"> = PolymorphicComponentPropWithRef<As, CardBaseProps<Href>>;
7
7
  type CardComponent = <Href, As extends React.ElementType = Href extends string ? "a" : "div">(props: CardProps<Href, As>) => JSX.Element;
8
- export declare const Card: CardComponent;
8
+ export type GroupProps<As extends React.ElementType = "div"> = PolymorphicComponentPropWithRef<As>;
9
+ type GroupComponent = <As extends React.ElementType = "div">(props: GroupProps<As>) => JSX.Element;
10
+ export declare const Group: GroupComponent;
11
+ export type CardDetailsProps = React.ComponentPropsWithoutRef<"details">;
12
+ export type CardSummaryProps = React.ComponentPropsWithoutRef<"summary">;
13
+ export declare const Card: CardComponent & {
14
+ Details: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.DetailsHTMLAttributes<HTMLDetailsElement>, HTMLDetailsElement>, "ref"> & React.RefAttributes<HTMLDetailsElement>>;
15
+ Summary: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & React.RefAttributes<HTMLElement>>;
16
+ };
9
17
  export {};
package/mtds/card/card.js CHANGED
@@ -1,12 +1,26 @@
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 });
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import { clsx as m } from "../external/clsx/dist/clsx.js";
3
+ import { forwardRef as t } from "react";
4
+ import u from "../styles.module.css.js";
5
+ const e = t(function({ as: a, className: o, ...r }, c) {
6
+ const i = a || (r.href ? "a" : "div");
7
+ return /* @__PURE__ */ s(i, { className: m(u.card, o), ref: c, ...r });
8
+ }), y = t(function({ as: a, className: o, ...r }, c) {
9
+ return /* @__PURE__ */ s(a || "div", { className: m(u.group, o), ref: c, ...r });
10
+ }), d = t(
11
+ function({ className: a, ...o }, r) {
12
+ return /* @__PURE__ */ s("u-details", { class: m(u.card, a), ref: r, ...o });
13
+ }
14
+ ), f = t(
15
+ function({ className: a, ...o }, r) {
16
+ return /* @__PURE__ */ s("u-summary", { class: a, ref: r, ...o });
17
+ }
18
+ ), x = Object.assign(e, {
19
+ Details: d,
20
+ Summary: f
8
21
  });
9
22
  export {
10
- x as Card
23
+ x as Card,
24
+ y as Group
11
25
  };
12
26
  //# sourceMappingURL=card.js.map
@@ -1 +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;"}
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\nconst CardComp: 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\nexport type GroupProps<As extends React.ElementType = \"div\"> =\n\tPolymorphicComponentPropWithRef<As>;\n\ntype GroupComponent = <As extends React.ElementType = \"div\">(\n\tprops: GroupProps<As>,\n) => JSX.Element;\n\nexport const Group: GroupComponent = forwardRef<null>(function Group<\n\tAs extends React.ElementType = \"div\",\n>({ as, className, ...rest }: GroupProps<As>, ref?: PolymorphicRef<As>) {\n\tconst Tag = as || \"div\";\n\n\treturn <Tag className={clsx(styles.group, className)} ref={ref} {...rest} />;\n}) as GroupComponent; // Needed to tell Typescript this does not return ReactNode but acutally JSX.Element\n\nexport type CardDetailsProps = React.ComponentPropsWithoutRef<\"details\">;\nconst CardDetails = forwardRef<HTMLDetailsElement, CardDetailsProps>(\n\tfunction CardDetails({ className, ...rest }, ref) {\n\t\treturn (\n\t\t\t<u-details class={clsx(styles.card, className)} ref={ref} {...rest} />\n\t\t);\n\t},\n);\n\nexport type CardSummaryProps = React.ComponentPropsWithoutRef<\"summary\">;\nconst CardSummary = forwardRef<HTMLElement, CardSummaryProps>(\n\tfunction CardSummary({ className, ...rest }, ref) {\n\t\treturn <u-summary class={className} ref={ref} {...rest} />;\n\t},\n);\n\nexport const Card = Object.assign(CardComp, {\n\tDetails: CardDetails,\n\tSummary: CardSummary,\n});\n"],"names":["CardComp","forwardRef","as","className","rest","ref","Tag","jsx","clsx","styles","Group","CardDetails","CardSummary","Card"],"mappings":";;;;AAwBA,MAAMA,IAA0BC,EAAiB,SAG/C,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,GASYM,IAAwBT,EAAiB,SAEpD,EAAE,IAAAC,GAAI,WAAAC,GAAW,GAAGC,EAAK,GAAmBC,GAA0B;AAGhE,SAAA,gBAAAE,EAFKL,KAAM,OAEN,EAAA,WAAWM,EAAKC,EAAO,OAAON,CAAS,GAAG,KAAAE,GAAW,GAAGD,EAAM,CAAA;AAC3E,CAAC,GAGKO,IAAcV;AAAA,EACnB,SAAqB,EAAE,WAAAE,GAAW,GAAGC,EAAA,GAAQC,GAAK;AAEhD,WAAA,gBAAAE,EAAC,aAAU,EAAA,OAAOC,EAAKC,EAAO,MAAMN,CAAS,GAAG,KAAAE,GAAW,GAAGD,EAAM,CAAA;AAAA,EAAA;AAGvE,GAGMQ,IAAcX;AAAA,EACnB,SAAqB,EAAE,WAAAE,GAAW,GAAGC,EAAA,GAAQC,GAAK;AACjD,6BAAQ,aAAU,EAAA,OAAOF,GAAW,KAAAE,GAAW,GAAGD,GAAM;AAAA,EAAA;AAE1D,GAEaS,IAAO,OAAO,OAAOb,GAAU;AAAA,EAC3C,SAASW;AAAA,EACT,SAASC;AACV,CAAC;"}
@@ -15,4 +15,4 @@ export declare const Default: Story;
15
15
  export declare const React: Story;
16
16
  export declare const Interactive: Story;
17
17
  export declare const Responsive: Story;
18
- export declare const Group: Story;
18
+ export declare const GroupStory: Story;
@@ -1,2 +1 @@
1
- export declare function observe(el: Element): void;
2
- export declare function unobserve(el: Element): void;
1
+ export {};
@@ -1,19 +1,21 @@
1
- import { on as l, QUICK_EVENT as i, attr as r, off as m } from "../utils.js";
2
- const s = ({ clientX: o, clientY: n, target: t }) => {
3
- var c;
4
- if (t instanceof HTMLDialogElement && r(t, "data-closedby") === "any") {
5
- const { top: e, right: a, bottom: f, left: d } = t.getBoundingClientRect();
6
- e <= n && n <= f && d <= o && o <= a || t.close();
7
- } else t instanceof Element && t.closest('button[data-command="close"]') && ((c = t == null ? void 0 : t.closest("dialog")) == null || c.close());
8
- };
9
- function u(o) {
10
- l(o, "click", s, i);
11
- }
12
- function E(o) {
13
- m(o, "click", s, i);
14
- }
15
- export {
16
- u as observe,
17
- E as unobserve
1
+ import m from "../styles.module.css.js";
2
+ import { IS_BROWSER as a, on as u, QUICK_EVENT as e, createOptimizedMutationObserver as f, attr as E } from "../utils.js";
3
+ const g = m.dialog.split(" ")[0], p = a ? document.getElementsByClassName(g) : [], i = (t) => {
4
+ t.stopImmediatePropagation(), t.stopPropagation();
5
+ }, b = () => {
6
+ for (const t of p)
7
+ t.matches('[open]:not([data-modal="false"]):not(:modal)') && (t.addEventListener("close", i, e), t.close(), t.showModal(), window.requestAnimationFrame(() => t.removeEventListener("close", i, e)));
8
+ }, I = ({ clientX: t, clientY: n, target: o }) => {
9
+ var s;
10
+ if (o instanceof HTMLDialogElement && E(o, "data-closedby") === "any") {
11
+ const { top: c, right: d, bottom: l, left: r } = o.getBoundingClientRect();
12
+ c <= n && n <= l && r <= t && t <= d || o.close();
13
+ } else o instanceof Element && o.closest('button[data-command="close"]') && ((s = o == null ? void 0 : o.closest("dialog")) == null || s.close());
18
14
  };
15
+ a && (u(document, "click", I, e), f(b).observe(document.documentElement, {
16
+ attributeFilter: ["open"],
17
+ attributes: !0,
18
+ childList: !0,
19
+ subtree: !0
20
+ }));
19
21
  //# sourceMappingURL=dialog-observer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dialog-observer.js","sources":["../../designsystem/dialog/dialog-observer.ts"],"sourcesContent":["import { QUICK_EVENT, attr, off, on } from '../utils';\n\nconst handleClick = ({ clientX: x, clientY: y, target: el }: MouseEvent) => {\n if (el instanceof HTMLDialogElement && attr(el, 'data-closedby') === 'any') {\n const { top, right, bottom, left } = el.getBoundingClientRect();\n const isInside = top <= y && y <= bottom && left <= x && x <= right;\n \n if (!isInside) el.close();\n } else if (el instanceof Element && el.closest('button[data-command=\"close\"]')) {\n el?.closest('dialog')?.close();\n }\n};\n\nexport function observe(el: Element) {\n on(el, 'click', handleClick as EventListener, QUICK_EVENT);\n}\n\nexport function unobserve(el: Element) {\n off(el, 'click', handleClick as EventListener, QUICK_EVENT);\n}"],"names":["handleClick","x","y","el","attr","top","right","bottom","left","_a","observe","on","QUICK_EVENT","unobserve","off"],"mappings":";AAEA,MAAMA,IAAc,CAAC,EAAE,SAASC,GAAG,SAASC,GAAG,QAAQC,QAAqB;;AAC1E,MAAIA,aAAc,qBAAqBC,EAAKD,GAAI,eAAe,MAAM,OAAO;AAC1E,UAAM,EAAE,KAAAE,GAAK,OAAAC,GAAO,QAAAC,GAAQ,MAAAC,EAAK,IAAIL,EAAG,sBAAsB;AAG1D,IAFaE,KAAOH,KAAKA,KAAKK,KAAUC,KAAQP,KAAKA,KAAKK,KAE/CH,EAAG,MAAM;AAAA,EAAA,OACfA,aAAc,WAAWA,EAAG,QAAQ,8BAA8B,OACvEM,IAAAN,KAAA,gBAAAA,EAAA,QAAQ,cAAR,QAAAM,EAAmB;AAE3B;AAEO,SAASC,EAAQP,GAAa;AAChC,EAAAQ,EAAAR,GAAI,SAASH,GAA8BY,CAAW;AAC3D;AAEO,SAASC,EAAUV,GAAa;AACjC,EAAAW,EAAAX,GAAI,SAASH,GAA8BY,CAAW;AAC5D;"}
1
+ {"version":3,"file":"dialog-observer.js","sources":["../../designsystem/dialog/dialog-observer.ts"],"sourcesContent":["import styles from \"../styles.module.css\";\nimport { IS_BROWSER, QUICK_EVENT, attr, createOptimizedMutationObserver, on } from '../utils';\n\nconst CSS_DIALOG = styles.dialog.split(\" \")[0];\nconst DIALOGS = IS_BROWSER ? document.getElementsByClassName(CSS_DIALOG) as HTMLCollectionOf<HTMLDialogElement> : [];\nconst PREVENT_EVENT = (event: Event) => {\n event.stopImmediatePropagation();\n event.stopPropagation();\n}\n\nconst handleModal = () => {\n for (const dialog of DIALOGS)\n if (dialog.matches('[open]:not([data-modal=\"false\"]):not(:modal)')) {\n dialog.addEventListener('close', PREVENT_EVENT, QUICK_EVENT); // Prevent closing events due to swapping to modal\n dialog.close();\n dialog.showModal();\n window.requestAnimationFrame(() => dialog.removeEventListener('close', PREVENT_EVENT, QUICK_EVENT)); // Re-enable closing events\n }\n};\n\nconst handleClick = ({ clientX: x, clientY: y, target: el }: MouseEvent) => {\n if (el instanceof HTMLDialogElement && attr(el, 'data-closedby') === 'any') {\n const { top, right, bottom, left } = el.getBoundingClientRect();\n const isInside = top <= y && y <= bottom && left <= x && x <= right;\n \n if (!isInside) el.close();\n } else if (el instanceof Element && el.closest('button[data-command=\"close\"]')) {\n el?.closest('dialog')?.close();\n }\n};\n\nif (IS_BROWSER) {\n on(document, 'click', handleClick as EventListener, QUICK_EVENT);\n createOptimizedMutationObserver(handleModal).observe(document.documentElement, {\n attributeFilter: ['open'],\n attributes: true,\n childList: true,\n subtree: true,\n });\n}"],"names":["CSS_DIALOG","styles","DIALOGS","IS_BROWSER","PREVENT_EVENT","event","handleModal","dialog","QUICK_EVENT","handleClick","x","y","el","attr","top","right","bottom","left","_a","on","createOptimizedMutationObserver"],"mappings":";;AAGA,MAAMA,IAAaC,EAAO,OAAO,MAAM,GAAG,EAAE,CAAC,GACvCC,IAAUC,IAAa,SAAS,uBAAuBH,CAAU,IAA2C,CAAC,GAC7GI,IAAgB,CAACC,MAAiB;AACtC,EAAAA,EAAM,yBAAyB,GAC/BA,EAAM,gBAAgB;AACxB,GAEMC,IAAc,MAAM;AACxB,aAAWC,KAAUL;AACf,IAAAK,EAAO,QAAQ,8CAA8C,MACxDA,EAAA,iBAAiB,SAASH,GAAeI,CAAW,GAC3DD,EAAO,MAAM,GACbA,EAAO,UAAU,GACjB,OAAO,sBAAsB,MAAMA,EAAO,oBAAoB,SAASH,GAAeI,CAAW,CAAC;AAExG,GAEMC,IAAc,CAAC,EAAE,SAASC,GAAG,SAASC,GAAG,QAAQC,QAAqB;;AAC1E,MAAIA,aAAc,qBAAqBC,EAAKD,GAAI,eAAe,MAAM,OAAO;AAC1E,UAAM,EAAE,KAAAE,GAAK,OAAAC,GAAO,QAAAC,GAAQ,MAAAC,EAAK,IAAIL,EAAG,sBAAsB;AAG1D,IAFaE,KAAOH,KAAKA,KAAKK,KAAUC,KAAQP,KAAKA,KAAKK,KAE/CH,EAAG,MAAM;AAAA,EAAA,OACfA,aAAc,WAAWA,EAAG,QAAQ,8BAA8B,OACvEM,IAAAN,KAAA,gBAAAA,EAAA,QAAQ,cAAR,QAAAM,EAAmB;AAE3B;AAEIf,MACCgB,EAAA,UAAU,SAASV,GAA8BD,CAAW,GAC/DY,EAAgCd,CAAW,EAAE,QAAQ,SAAS,iBAAiB;AAAA,EAC7E,iBAAiB,CAAC,MAAM;AAAA,EACxB,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,SAAS;AAAA,CACV;"}
@@ -1,8 +1,10 @@
1
1
  export type DialogProps = React.ComponentPropsWithoutRef<"dialog"> & {
2
2
  "data-closedby"?: "any" | "closerequest";
3
- modal: boolean;
3
+ "data-modal"?: boolean | "true" | "false";
4
+ modal?: boolean;
4
5
  };
5
6
  export declare const Dialog: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.DialogHTMLAttributes<HTMLDialogElement>, HTMLDialogElement>, "ref"> & {
6
7
  "data-closedby"?: "any" | "closerequest";
7
- modal: boolean;
8
+ "data-modal"?: boolean | "true" | "false";
9
+ modal?: boolean;
8
10
  } & React.RefAttributes<HTMLDialogElement>>;
@@ -1,25 +1,21 @@
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";
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { clsx as i } from "../external/clsx/dist/clsx.js";
3
+ import { forwardRef as l } from "react";
4
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(
5
+ const g = l(
6
+ function({ className: a, modal: r = !0, ...o }, m) {
7
+ return /* @__PURE__ */ t(
13
8
  "dialog",
14
9
  {
15
- className: l(d.dialog, s),
16
- ref: o,
17
- ...f
10
+ className: i(d.dialog, a),
11
+ "data-modal": o["data-modal"] ?? r,
12
+ ref: m,
13
+ ...o
18
14
  }
19
15
  );
20
16
  }
21
17
  );
22
18
  export {
23
- D as Dialog
19
+ g as Dialog
24
20
  };
25
21
  //# sourceMappingURL=dialog.js.map
@@ -1 +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\t\"data-closedby\"?: \"any\" | \"closerequest\";\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":";;;;AASO,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;"}
1
+ {"version":3,"file":"dialog.js","sources":["../../designsystem/dialog/dialog.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef } from \"react\";\nimport styles from \"../styles.module.css\";\n\nexport type DialogProps = React.ComponentPropsWithoutRef<\"dialog\"> & {\n\t\"data-closedby\"?: \"any\" | \"closerequest\";\n\t\"data-modal\"?: boolean | \"true\" | \"false\";\n\tmodal?: boolean; // Ketp for backwards compatibility\n};\n\nexport const Dialog = forwardRef<HTMLDialogElement, DialogProps>(\n\tfunction Dialog({ className, modal = true, ...rest }, ref) {\n\t\treturn (\n\t\t\t<dialog\n\t\t\t\tclassName={clsx(styles.dialog, className)}\n\t\t\t\tdata-modal={rest[\"data-modal\"] ?? modal}\n\t\t\t\tref={ref}\n\t\t\t\t{...rest}\n\t\t\t/>\n\t\t);\n\t},\n);\n"],"names":["Dialog","forwardRef","className","modal","rest","ref","jsx","clsx","styles"],"mappings":";;;;AAUO,MAAMA,IAASC;AAAA,EACrB,SAAgB,EAAE,WAAAC,GAAW,OAAAC,IAAQ,IAAM,GAAGC,EAAK,GAAGC,GAAK;AAEzD,WAAA,gBAAAC;AAAA,MAAC;AAAA,MAAA;AAAA,QACA,WAAWC,EAAKC,EAAO,QAAQN,CAAS;AAAA,QACxC,cAAYE,EAAK,YAAY,KAAKD;AAAA,QAClC,KAAAE;AAAA,QACC,GAAGD;AAAA,MAAA;AAAA,IACL;AAAA,EAAA;AAGH;"}
@@ -8,3 +8,4 @@ export declare const Default: Story;
8
8
  export declare const React: Story;
9
9
  export declare const WithClose: Story;
10
10
  export declare const WithBackdropClose: Story;
11
+ export declare const WithoutBackdrop: Story;
@@ -1,6 +1,6 @@
1
1
  export type DividerProps = React.ComponentPropsWithoutRef<"hr"> & {
2
- "data-gap"?: "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;
2
+ "data-gap"?: "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 | "none" | "sm" | "md" | "lg" | "xl";
3
3
  };
4
4
  export declare const Divider: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLHRElement>, HTMLHRElement>, "ref"> & {
5
- "data-gap"?: "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;
5
+ "data-gap"?: "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 | "none" | "sm" | "md" | "lg" | "xl";
6
6
  } & React.RefAttributes<HTMLHRElement>>;
@@ -1 +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\t\"data-gap\"?:\n\t\t| \"0\"\n\t\t| \"1\"\n\t\t| \"2\"\n\t\t| \"3\"\n\t\t| \"4\"\n\t\t| \"5\"\n\t\t| \"6\"\n\t\t| \"7\"\n\t\t| \"8\"\n\t\t| \"9\"\n\t\t| \"10\"\n\t\t| \"11\"\n\t\t| \"12\"\n\t\t| \"13\"\n\t\t| \"14\"\n\t\t| \"15\"\n\t\t| \"18\"\n\t\t| \"22\"\n\t\t| \"26\"\n\t\t| \"30\"\n\t\t| 0\n\t\t| 1\n\t\t| 2\n\t\t| 3\n\t\t| 4\n\t\t| 5\n\t\t| 6\n\t\t| 7\n\t\t| 8\n\t\t| 9\n\t\t| 10\n\t\t| 11\n\t\t| 12\n\t\t| 13\n\t\t| 14\n\t\t| 15\n\t\t| 18\n\t\t| 22\n\t\t| 26\n\t\t| 30;\n};\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":";;;;AAgDa,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;"}
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\t\"data-gap\"?:\n\t\t| \"0\"\n\t\t| \"1\"\n\t\t| \"2\"\n\t\t| \"3\"\n\t\t| \"4\"\n\t\t| \"5\"\n\t\t| \"6\"\n\t\t| \"7\"\n\t\t| \"8\"\n\t\t| \"9\"\n\t\t| \"10\"\n\t\t| \"11\"\n\t\t| \"12\"\n\t\t| \"13\"\n\t\t| \"14\"\n\t\t| \"15\"\n\t\t| \"18\"\n\t\t| \"22\"\n\t\t| \"26\"\n\t\t| \"30\"\n\t\t| 0\n\t\t| 1\n\t\t| 2\n\t\t| 3\n\t\t| 4\n\t\t| 5\n\t\t| 6\n\t\t| 7\n\t\t| 8\n\t\t| 9\n\t\t| 10\n\t\t| 11\n\t\t| 12\n\t\t| 13\n\t\t| 14\n\t\t| 15\n\t\t| 18\n\t\t| 22\n\t\t| 26\n\t\t| 30\n\t\t// Backwards compatibility:\n\t\t| \"none\"\n\t\t| \"sm\"\n\t\t| \"md\"\n\t\t| \"lg\"\n\t\t| \"xl\";\n};\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":";;;;AAsDa,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 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ import e from "../styles.module.css.js";
2
+ import { IS_BROWSER as r, on as o, QUICK_EVENT as a, attr as m } from "../utils.js";
3
+ function f(n) {
4
+ var i;
5
+ if (n.animationName !== e._errorsummary) return;
6
+ const t = (i = n.target) == null ? void 0 : i.firstElementChild;
7
+ t instanceof HTMLHeadingElement && (m(t, "tabindex", "-1"), t.focus());
8
+ }
9
+ r && o(document, "animationend", f, a);
10
+ //# sourceMappingURL=errorsummary-observer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errorsummary-observer.js","sources":["../../designsystem/errorsummary/errorsummary-observer.ts"],"sourcesContent":["import styles from \"../styles.module.css\";\nimport { IS_BROWSER, QUICK_EVENT, attr, on } from \"../utils\";\n\nfunction handleInject(event: Event & { animationName?: string }) {\n if (event.animationName !== styles._errorsummary) return;\n const first = (event.target as Element)?.firstElementChild;\n\n if (first instanceof HTMLHeadingElement) {\n attr(first, \"tabindex\", \"-1\");\n first.focus(); // Autofocus first heading\n }\n}\n\nif (IS_BROWSER)\n on(document, 'animationend', handleInject, QUICK_EVENT);"],"names":["handleInject","event","styles","first","_a","attr","IS_BROWSER","on","QUICK_EVENT"],"mappings":";;AAGA,SAASA,EAAaC,GAA2C;;AAC3D,MAAAA,EAAM,kBAAkBC,EAAO,cAAe;AAC5C,QAAAC,KAASC,IAAAH,EAAM,WAAN,gBAAAG,EAA0B;AAEzC,EAAID,aAAiB,uBACdE,EAAAF,GAAO,YAAY,IAAI,GAC5BA,EAAM,MAAM;AAEhB;AAEIG,KACCC,EAAA,UAAU,gBAAgBP,GAAcQ,CAAW;"}
@@ -1,27 +1,21 @@
1
- import { jsx as f } from "react/jsx-runtime";
2
- import { clsx as n } from "../external/clsx/dist/clsx.js";
3
- import { forwardRef as i, useRef as a, useImperativeHandle as u, useEffect as c } from "react";
4
- import l from "../styles.module.css.js";
5
- import { attr as p } from "../utils.js";
6
- const v = i(
7
- function({ className: o, ...m }, s) {
8
- const r = a(null);
9
- return u(s, () => r.current), c(() => {
10
- var t;
11
- const e = (t = r.current) == null ? void 0 : t.firstElementChild;
12
- e instanceof HTMLHeadingElement && (p(e, "tabindex", "-1"), e.focus());
13
- }, []), /* @__PURE__ */ f(
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import { clsx as t } from "../external/clsx/dist/clsx.js";
3
+ import { forwardRef as e } from "react";
4
+ import a from "../styles.module.css.js";
5
+ const c = e(
6
+ function({ className: r, ...o }, m) {
7
+ return /* @__PURE__ */ s(
14
8
  "div",
15
9
  {
16
- className: n(l.errorsummary, o),
10
+ className: t(a.errorsummary, r),
17
11
  role: "alert",
18
- ref: r,
19
- ...m
12
+ ref: m,
13
+ ...o
20
14
  }
21
15
  );
22
16
  }
23
17
  );
24
18
  export {
25
- v as Errorsummary
19
+ c as Errorsummary
26
20
  };
27
21
  //# sourceMappingURL=errorsummary.js.map
@@ -1 +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\";\nimport { attr } from \"../utils\";\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\tattr(first, \"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","attr","jsx","clsx","styles"],"mappings":";;;;;AAOO,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,uBACfE,EAAAF,GAAO,YAAY,IAAI,GAC5BA,EAAM,MAAM;AAAA,IAEd,GAAG,EAAE,GAGJ,gBAAAG;AAAA,MAAC;AAAA,MAAA;AAAA,QACA,WAAWC,EAAKC,EAAO,cAAcZ,CAAS;AAAA,QAC9C,MAAK;AAAA,QACL,KAAKG;AAAA,QACJ,GAAGF;AAAA,MAAA;AAAA,IACL;AAAA,EAAA;AAGH;"}
1
+ {"version":3,"file":"errorsummary.js","sources":["../../designsystem/errorsummary/errorsummary.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef } 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\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={ref}\n\t\t\t\t{...rest}\n\t\t\t/>\n\t\t);\n\t},\n);\n"],"names":["Errorsummary","forwardRef","className","rest","ref","jsx","clsx","styles"],"mappings":";;;;AAMO,MAAMA,IAAeC;AAAA,EAC3B,SAAsB,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAAQC,GAAK;AAEjD,WAAA,gBAAAC;AAAA,MAAC;AAAA,MAAA;AAAA,QACA,WAAWC,EAAKC,EAAO,cAAcL,CAAS;AAAA,QAC9C,MAAK;AAAA,QACL,KAAAE;AAAA,QACC,GAAGD;AAAA,MAAA;AAAA,IACL;AAAA,EAAA;AAGH;"}