@mattilsynet/design 0.4.0 → 0.5.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.
Files changed (76) hide show
  1. package/mtds/alert/alert.d.ts +3 -1
  2. package/mtds/alert/alert.js.map +1 -1
  3. package/mtds/alert/alert.stories.d.ts +1 -1
  4. package/mtds/avatar/avatar.stories.d.ts +1 -1
  5. package/mtds/badge/badge.d.ts +6 -2
  6. package/mtds/badge/badge.js.map +1 -1
  7. package/mtds/badge/badge.stories.d.ts +1 -1
  8. package/mtds/breadcrumbs/breadcrumbs.js +18 -23
  9. package/mtds/breadcrumbs/breadcrumbs.js.map +1 -1
  10. package/mtds/breadcrumbs/breadcrumbs.stories.d.ts +1 -1
  11. package/mtds/button/button.d.ts +4 -0
  12. package/mtds/button/button.js.map +1 -1
  13. package/mtds/button/button.stories.d.ts +1 -1
  14. package/mtds/card/card.stories.d.ts +1 -2
  15. package/mtds/chip/chip.d.ts +10 -2
  16. package/mtds/chip/chip.js +7 -6
  17. package/mtds/chip/chip.js.map +1 -1
  18. package/mtds/chip/chip.stories.d.ts +2 -1
  19. package/mtds/dialog/dialog.d.ts +2 -0
  20. package/mtds/dialog/dialog.js.map +1 -1
  21. package/mtds/divider/divider.d.ts +6 -2
  22. package/mtds/divider/divider.js.map +1 -1
  23. package/mtds/errorsummary/errorsummary.js +15 -18
  24. package/mtds/errorsummary/errorsummary.js.map +1 -1
  25. package/mtds/errorsummary/errorsummary.stories.d.ts +1 -1
  26. package/mtds/field/field-observer.js +33 -30
  27. package/mtds/field/field-observer.js.map +1 -1
  28. package/mtds/field/field.stories.d.ts +1 -1
  29. package/mtds/fieldset/fieldset-observer.js +9 -10
  30. package/mtds/fieldset/fieldset-observer.js.map +1 -1
  31. package/mtds/heading/heading.d.ts +3 -1
  32. package/mtds/heading/heading.js.map +1 -1
  33. package/mtds/heading/heading.stories.d.ts +1 -1
  34. package/mtds/index.d.ts +1 -0
  35. package/mtds/index.iife.js +2 -2
  36. package/mtds/index.iife.js.map +1 -1
  37. package/mtds/index.js +18 -17
  38. package/mtds/index.js.map +1 -1
  39. package/mtds/input/input.stories.d.ts +1 -1
  40. package/mtds/layout/layout-observer.js +12 -15
  41. package/mtds/layout/layout-observer.js.map +1 -1
  42. package/mtds/layout/layout.d.ts +15 -6
  43. package/mtds/layout/layout.js.map +1 -1
  44. package/mtds/layout/layout.stories.d.ts +1 -1
  45. package/mtds/logo/logo-observer.d.ts +2 -0
  46. package/mtds/logo/logo-observer.js +23 -0
  47. package/mtds/logo/logo-observer.js.map +1 -0
  48. package/mtds/logo/logo.d.ts +1 -0
  49. package/mtds/logo/logo.js.map +1 -1
  50. package/mtds/logo/logo.stories.d.ts +9 -2
  51. package/mtds/popover/popover-observer.js +16 -12
  52. package/mtds/popover/popover-observer.js.map +1 -1
  53. package/mtds/popover/popover.d.ts +3 -1
  54. package/mtds/popover/popover.js.map +1 -1
  55. package/mtds/react-types.d.ts +9 -1
  56. package/mtds/skeleton/skeleton.d.ts +4 -3
  57. package/mtds/skeleton/skeleton.js.map +1 -1
  58. package/mtds/spinner/spinner.d.ts +6 -2
  59. package/mtds/spinner/spinner.js.map +1 -1
  60. package/mtds/spinner/spinner.stories.d.ts +1 -1
  61. package/mtds/styles.css +1 -1
  62. package/mtds/styles.json +33 -32
  63. package/mtds/styles.module.css.js +64 -62
  64. package/mtds/styles.module.css.js.map +1 -1
  65. package/mtds/table/table-observer.js +19 -16
  66. package/mtds/table/table-observer.js.map +1 -1
  67. package/mtds/table/table.d.ts +12 -2
  68. package/mtds/table/table.js.map +1 -1
  69. package/mtds/table/table.stories.d.ts +1 -1
  70. package/mtds/tag/tag.d.ts +6 -2
  71. package/mtds/tag/tag.js.map +1 -1
  72. package/mtds/tag/tag.stories.d.ts +1 -1
  73. package/mtds/tooltip/tooltip-observer.js +21 -21
  74. package/mtds/tooltip/tooltip-observer.js.map +1 -1
  75. package/mtds/tooltip/tooltip.stories.d.ts +1 -1
  76. package/package.json +12 -12
@@ -1,6 +1,8 @@
1
1
  import { JSX } from 'react';
2
2
  import { PolymorphicComponentPropWithRef } from '../react-types';
3
- export type AlertProps<As extends React.ElementType = "output"> = PolymorphicComponentPropWithRef<As>;
3
+ export type AlertProps<As extends React.ElementType = "output"> = PolymorphicComponentPropWithRef<As, {
4
+ "data-color"?: "info" | "success" | "warning" | "danger";
5
+ }>;
4
6
  type AlertComponent = <As extends React.ElementType = "output">(props: AlertProps<As>) => JSX.Element;
5
7
  export declare const Alert: AlertComponent;
6
8
  export {};
@@ -1 +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;"}
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<\n\t\tAs,\n\t\t{\n\t\t\t\"data-color\"?: \"info\" | \"success\" | \"warning\" | \"danger\";\n\t\t}\n\t>;\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":";;;;AAoBa,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;"}
@@ -1,7 +1,7 @@
1
1
  import { StoryObj } from '@storybook/react';
2
2
  declare const meta: {
3
3
  title: string;
4
- decorators: ((Story: import('@storybook/csf').PartialStoryFn<import('@storybook/react').ReactRenderer, {
4
+ decorators: ((Story: import('@storybook/core/csf').PartialStoryFn<import('@storybook/react').ReactRenderer, {
5
5
  [x: string]: any;
6
6
  }>) => import("react/jsx-runtime").JSX.Element)[];
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import { StoryObj } from '@storybook/react';
2
2
  declare const meta: {
3
3
  title: string;
4
- decorators: ((Story: import('@storybook/csf').PartialStoryFn<import('@storybook/react').ReactRenderer, {
4
+ decorators: ((Story: import('@storybook/core/csf').PartialStoryFn<import('@storybook/react').ReactRenderer, {
5
5
  [x: string]: any;
6
6
  }>) => import("react/jsx-runtime").JSX.Element)[];
7
7
  };
@@ -1,2 +1,6 @@
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>>;
1
+ export type BadgeProps = React.ComponentPropsWithoutRef<"span"> & {
2
+ "data-badge"?: string | number;
3
+ };
4
+ export declare const Badge: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
5
+ "data-badge"?: string | number;
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\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;"}
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,7 +1,7 @@
1
1
  import { StoryObj } from '@storybook/react';
2
2
  declare const meta: {
3
3
  title: string;
4
- decorators: ((Story: import('@storybook/csf').PartialStoryFn<import('@storybook/react').ReactRenderer, {
4
+ decorators: ((Story: import('@storybook/core/csf').PartialStoryFn<import('@storybook/react').ReactRenderer, {
5
5
  [x: string]: any;
6
6
  }>) => import("react/jsx-runtime").JSX.Element)[];
7
7
  };
@@ -1,29 +1,24 @@
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";
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
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");
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);
13
14
  }
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,
15
+ }), /* @__PURE__ */ m(
16
+ c,
22
17
  {
23
- "aria-label": o["aria-label"] || "Du er her:",
24
- className: b(d.breadcrumbs, u),
25
- ref: t,
26
- ...o
18
+ "aria-label": t["aria-label"] || "Du er her:",
19
+ className: f(d.breadcrumbs, a),
20
+ ref: r,
21
+ ...t
27
22
  }
28
23
  );
29
24
  }
@@ -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\";\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;"}
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,7 +1,7 @@
1
1
  import { StoryObj } from '@storybook/react';
2
2
  declare const meta: {
3
3
  title: string;
4
- decorators: ((Story: import('@storybook/csf').PartialStoryFn<import('@storybook/react').ReactRenderer, {
4
+ decorators: ((Story: import('@storybook/core/csf').PartialStoryFn<import('@storybook/react').ReactRenderer, {
5
5
  [x: string]: any;
6
6
  }>) => import("react/jsx-runtime").JSX.Element)[];
7
7
  };
@@ -1,6 +1,10 @@
1
1
  import { JSX } from 'react';
2
2
  import { PolymorphicComponentPropWithRef } from '../react-types';
3
3
  type ButtonBaseProps<Href> = {
4
+ "data-arrow"?: "left" | "right" | true;
5
+ "data-color"?: "accent" | "danger";
6
+ "data-nowrap"?: boolean;
7
+ "data-variant"?: "primary" | "secondary" | "tertiary";
4
8
  href?: Href;
5
9
  };
6
10
  export type ButtonProps<Href, As extends React.ElementType = Href extends string ? "a" : "button"> = PolymorphicComponentPropWithRef<As, ButtonBaseProps<Href>>;
@@ -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\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;"}
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-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":";;;;AA4Ba,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,7 +1,7 @@
1
1
  import { StoryObj } from '@storybook/react';
2
2
  declare const meta: {
3
3
  title: string;
4
- decorators: ((Story: import('@storybook/csf').PartialStoryFn<import('@storybook/react').ReactRenderer, {
4
+ decorators: ((Story: import('@storybook/core/csf').PartialStoryFn<import('@storybook/react').ReactRenderer, {
5
5
  [x: string]: any;
6
6
  }>) => import("react/jsx-runtime").JSX.Element)[];
7
7
  };
@@ -4,7 +4,7 @@ declare const meta: {
4
4
  parameters: {
5
5
  layout: string;
6
6
  };
7
- decorators: ((Story: import('@storybook/csf').PartialStoryFn<import('@storybook/react').ReactRenderer, {
7
+ decorators: ((Story: import('@storybook/core/csf').PartialStoryFn<import('@storybook/react').ReactRenderer, {
8
8
  [x: string]: any;
9
9
  }>) => import("react/jsx-runtime").JSX.Element)[];
10
10
  };
@@ -12,6 +12,5 @@ export default meta;
12
12
  type Story = StoryObj<typeof meta>;
13
13
  export declare const Default: Story;
14
14
  export declare const React: Story;
15
- export declare const Sizes: Story;
16
15
  export declare const AsLink: Story;
17
16
  export declare const Tableish: Story;
@@ -1,2 +1,10 @@
1
- export type ChipProps = React.ComponentPropsWithoutRef<"label">;
2
- export declare const Chip: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "ref"> & React.RefAttributes<HTMLLabelElement>>;
1
+ import { JSX } from 'react';
2
+ import { PolymorphicComponentPropWithRef } from '../react-types';
3
+ type ChipBaseProps<Removable> = {
4
+ href?: Removable;
5
+ "data-removable"?: boolean;
6
+ };
7
+ export type ChipProps<Removable, As extends React.ElementType = Removable extends true ? "button" : "label"> = PolymorphicComponentPropWithRef<As, ChipBaseProps<Removable>>;
8
+ type ChipComponent = <Removable, As extends React.ElementType = Removable extends true ? "button" : "label">(props: ChipProps<Removable, As>) => JSX.Element;
9
+ export declare const Chip: ChipComponent;
10
+ export {};
package/mtds/chip/chip.js CHANGED
@@ -1,11 +1,12 @@
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";
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import { clsx as p } from "../external/clsx/dist/clsx.js";
3
+ import { forwardRef as e } from "react";
4
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 });
5
+ const h = e(function({ as: r, className: t, ...o }, m) {
6
+ const a = r || (o["data-removable"] ? "button" : "label");
7
+ return /* @__PURE__ */ i(a, { className: p(f.chip, t), ref: m, ...o });
7
8
  });
8
9
  export {
9
- n as Chip
10
+ h as Chip
10
11
  };
11
12
  //# sourceMappingURL=chip.js.map
@@ -1 +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
+ {"version":3,"file":"chip.js","sources":["../../designsystem/chip/chip.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 ChipBaseProps<Removable> = {\n\thref?: Removable;\n\t\"data-removable\"?: boolean;\n};\n\nexport type ChipProps<\n\tRemovable,\n\tAs extends React.ElementType = Removable extends true ? \"button\" : \"label\",\n> = PolymorphicComponentPropWithRef<As, ChipBaseProps<Removable>>;\n\ntype ChipComponent = <\n\tRemovable,\n\tAs extends React.ElementType = Removable extends true ? \"button\" : \"label\",\n>(\n\tprops: ChipProps<Removable, As>,\n) => JSX.Element;\n\nexport const Chip: ChipComponent = forwardRef<null>(function Chip<\n\tHref,\n\tAs extends React.ElementType = Href extends string ? \"a\" : \"div\",\n>({ as, className, ...rest }: ChipProps<Href, As>, ref?: PolymorphicRef<As>) {\n\tconst Tag = as || (rest[\"data-removable\"] ? \"button\" : \"label\");\n\n\treturn <Tag className={clsx(styles.chip, className)} ref={ref} {...rest} />;\n}) as ChipComponent; // Needed to tell Typescript this does not return ReactNode but acutally JSX.Element\n"],"names":["Chip","forwardRef","as","className","rest","ref","Tag","jsx","clsx","styles"],"mappings":";;;;AAyBa,MAAAA,IAAsBC,EAAiB,SAGlD,EAAE,IAAAC,GAAI,WAAAC,GAAW,GAAGC,EAAK,GAAwBC,GAA0B;AAC5E,QAAMC,IAAMJ,MAAOE,EAAK,gBAAgB,IAAI,WAAW;AAEhD,SAAA,gBAAAG,EAACD,GAAI,EAAA,WAAWE,EAAKC,EAAO,MAAMN,CAAS,GAAG,KAAAE,GAAW,GAAGD,EAAM,CAAA;AAC1E,CAAC;"}
@@ -1,7 +1,7 @@
1
1
  import { StoryObj } from '@storybook/react';
2
2
  declare const meta: {
3
3
  title: string;
4
- decorators: ((Story: import('@storybook/csf').PartialStoryFn<import('@storybook/react').ReactRenderer, {
4
+ decorators: ((Story: import('@storybook/core/csf').PartialStoryFn<import('@storybook/react').ReactRenderer, {
5
5
  [x: string]: any;
6
6
  }>) => import("react/jsx-runtime").JSX.Element)[];
7
7
  };
@@ -10,3 +10,4 @@ type Story = StoryObj<typeof meta>;
10
10
  export declare const React: Story;
11
11
  export declare const Radio: Story;
12
12
  export declare const Checkbox: Story;
13
+ export declare const Removable: Story;
@@ -1,6 +1,8 @@
1
1
  export type DialogProps = React.ComponentPropsWithoutRef<"dialog"> & {
2
+ "data-closedby"?: "any" | "closerequest";
2
3
  modal: boolean;
3
4
  };
4
5
  export declare const Dialog: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.DialogHTMLAttributes<HTMLDialogElement>, HTMLDialogElement>, "ref"> & {
6
+ "data-closedby"?: "any" | "closerequest";
5
7
  modal: boolean;
6
8
  } & React.RefAttributes<HTMLDialogElement>>;
@@ -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\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;"}
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,2 +1,6 @@
1
- export type DividerProps = React.ComponentPropsWithoutRef<"hr">;
2
- export declare const Divider: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLHRElement>, HTMLHRElement>, "ref"> & React.RefAttributes<HTMLHRElement>>;
1
+ export type DividerProps = React.ComponentPropsWithoutRef<"hr"> & {
2
+ "data-gap"?: "none" | "xs" | "sm" | "md" | "lg" | false;
3
+ };
4
+ export declare const Divider: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLHRElement>, HTMLHRElement>, "ref"> & {
5
+ "data-gap"?: "none" | "xs" | "sm" | "md" | "lg" | false;
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\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;"}
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\"?: \"none\" | \"xs\" | \"sm\" | \"md\" | \"lg\" | false;\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":";;;;AAQa,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,30 +1,27 @@
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";
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
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(() => {
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(() => {
9
10
  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(
11
+ const e = (t = r.current) == null ? void 0 : t.firstElementChild;
12
+ e instanceof HTMLHeadingElement && (p(e, "tabindex", "-1"), e.focus());
13
+ }, []), /* @__PURE__ */ f(
17
14
  "div",
18
15
  {
19
- className: u(l.errorsummary, o),
16
+ className: n(l.errorsummary, o),
20
17
  role: "alert",
21
- ref: e,
22
- ...f
18
+ ref: r,
19
+ ...m
23
20
  }
24
21
  );
25
22
  }
26
23
  );
27
24
  export {
28
- b as Errorsummary
25
+ v as Errorsummary
29
26
  };
30
27
  //# 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\";\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;"}
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,7 +1,7 @@
1
1
  import { StoryObj } from '@storybook/react';
2
2
  declare const meta: {
3
3
  title: string;
4
- decorators: ((Story: import('@storybook/csf').PartialStoryFn<import('@storybook/react').ReactRenderer, {
4
+ decorators: ((Story: import('@storybook/core/csf').PartialStoryFn<import('@storybook/react').ReactRenderer, {
5
5
  [x: string]: any;
6
6
  }>) => import("react/jsx-runtime").JSX.Element)[];
7
7
  };
@@ -1,45 +1,48 @@
1
1
  import m from "../styles.module.css.js";
2
- import { onMutation as v, on as u, QUICK_EVENT as p, isInputLike as b, attr as r, off as d, useId as a } from "../utils.js";
3
- const c = m.field.split(" ")[0], T = "--mtds-text-count-over", _ = "--mtds-text-count-under", g = m.validation.split(" "), y = g[0];
4
- function P(t) {
5
- for (const e of t) {
6
- const i = [], s = [];
7
- let o = null, l = !0;
8
- for (const n of e.getElementsByTagName("*"))
9
- n instanceof HTMLLabelElement ? i.push(n) : b(n) ? o = n : n.classList.contains(y) ? (l = n.getAttribute("data-color") === "success", s.unshift(a(n))) : n instanceof HTMLParagraphElement && s.push(a(n));
2
+ import { onMutation as v, on as d, QUICK_EVENT as p, isInputLike as S, attr as l, off as u, useId as r } from "../utils.js";
3
+ const c = m.field.split(" ")[0], _ = "--mtds-text-count-over", y = "--mtds-text-count-under", I = m.validation.split(" "), P = I[0];
4
+ function x(t) {
5
+ for (const n of t) {
6
+ const s = [], i = [];
7
+ let o = null, a = !0;
8
+ for (const e of n.getElementsByTagName("*"))
9
+ e instanceof HTMLLabelElement ? s.push(e) : S(e) ? o = e : e.classList.contains(P) ? (a = l(e, "data-color") === "success", i.unshift(r(e))) : e instanceof HTMLParagraphElement && i.push(r(e));
10
10
  if (o) {
11
- for (const n of i) n.htmlFor = a(o);
12
- I(o), r(o, "aria-describedby", s.join(" ")), r(o, "aria-invalid", `${!l}`);
11
+ for (const e of s) e.htmlFor = r(o);
12
+ b(o), l(o, "aria-describedby", i.join(" ")), l(o, "aria-invalid", `${!a}`);
13
13
  }
14
14
  }
15
15
  }
16
- function S({ target: t }) {
17
- b(t) && I(t);
16
+ function E({ target: t }) {
17
+ S(t) && b(t);
18
18
  }
19
- function I(t) {
20
- var s, o;
21
- const e = t == null ? void 0 : t.nextElementSibling, i = e == null ? void 0 : e.getAttribute("data-count");
22
- if (e && i) {
23
- const l = Number(i) - t.value.length, n = l < 0, h = e.getAttribute("aria-live") === "polite", f = window.getComputedStyle(e || t), C = ((s = f.getPropertyValue(T)) == null ? void 0 : s.slice(1, -1)) || "", L = ((o = f.getPropertyValue(_)) == null ? void 0 : o.slice(1, -1)) || "";
24
- if (h !== n) {
25
- r(e, "aria-live", n ? "polite" : "off");
26
- for (const A of g) e.classList.toggle(A, n);
19
+ function b(t) {
20
+ var i, o;
21
+ const n = t == null ? void 0 : t.nextElementSibling, s = n && l(n, "data-count");
22
+ if (n && s) {
23
+ const a = Number(s) - t.value.length, e = a < 0, h = l(n, "aria-live") === "polite", f = window.getComputedStyle(n || t), C = ((i = f.getPropertyValue(_)) == null ? void 0 : i.slice(1, -1)) || "", L = ((o = f.getPropertyValue(y)) == null ? void 0 : o.slice(1, -1)) || "";
24
+ if (h !== e) {
25
+ l(n, "aria-live", e ? "polite" : "off");
26
+ for (const T of I) n.classList.toggle(T, e);
27
27
  }
28
- e.textContent = (n ? C : L).replace("%d", `${Math.abs(l)}`);
28
+ n.textContent = (e ? C : L).replace(
29
+ "%d",
30
+ `${Math.abs(a)}`
31
+ );
29
32
  }
30
33
  }
31
- function E(t) {
32
- var e, i;
33
- (i = (e = t.target) == null ? void 0 : e.closest) != null && i.call(e, `.${c}`) && t.preventDefault();
34
- }
35
- function R(t) {
36
- v(t, c, P), u(t, "input", S, p), u(t, "invalid", E, !0);
34
+ function g(t) {
35
+ var n, s;
36
+ (s = (n = t.target) == null ? void 0 : n.closest) != null && s.call(n, `.${c}`) && t.preventDefault();
37
37
  }
38
38
  function V(t) {
39
- v(t, c, !1), d(t, "input", S, p), d(t, "invalid", E, !0);
39
+ v(t, c, x), d(t, "input", E, p), d(t, "invalid", g, !0);
40
+ }
41
+ function A(t) {
42
+ v(t, c, !1), u(t, "input", E, p), u(t, "invalid", g, !0);
40
43
  }
41
44
  export {
42
- R as observe,
43
- V as unobserve
45
+ V as observe,
46
+ A as unobserve
44
47
  };
45
48
  //# sourceMappingURL=field-observer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"field-observer.js","sources":["../../designsystem/field/field-observer.ts"],"sourcesContent":["import styles from '../styles.module.css';\nimport { QUICK_EVENT, attr, isInputLike, off, on, onMutation, useId } from '../utils';\n\nconst CSS_FIELD = styles.field.split(' ')[0];\nconst CSS_PROPERTY_OVER = '--mtds-text-count-over';\nconst CSS_PROPERTY_UNDER = '--mtds-text-count-under';\nconst CSS_VALIDATIONS = styles.validation.split(' ');\nconst CSS_VALIDATION = CSS_VALIDATIONS[0];\n\nfunction renderAria(fields: HTMLCollectionOf<Element>) {\n for(const field of fields) {\n const labels: HTMLLabelElement[] = [];\n const descs: string[] = [];\n let input: HTMLInputElement | null = null;\n let valid = true;\n\n for (const el of field.getElementsByTagName('*')) {\n if (el instanceof HTMLLabelElement) labels.push(el);\n else if (isInputLike(el)) input = el;\n else if (el.classList.contains(CSS_VALIDATION)) { // Must be before instanceof HTMLParagraphElement since validation can also be a <p>\n valid = el.getAttribute('data-color') === 'success';\n descs.unshift(useId(el));\n } else if (el instanceof HTMLParagraphElement) descs.push(useId(el));\n }\n\n if (input) {\n for (const label of labels) label.htmlFor = useId(input);\n renderCounter(input);\n attr(input, 'aria-describedby', descs.join(' '));\n attr(input, 'aria-invalid', `${!valid}`);\n }\n }\n}\nfunction handleInput({ target }: Event) {\n if (isInputLike(target)) renderCounter(target);\n}\n\nfunction renderCounter(input: HTMLInputElement) {\n const el = input?.nextElementSibling;\n const limit = el?.getAttribute('data-count');\n \n if (el && limit) {\n const remainder = Number(limit) - input.value.length;\n const nextInvalid = remainder < 0;\n const prevInvalid = el.getAttribute('aria-live') === 'polite';\n const style = window.getComputedStyle(el || input);\n const over = style.getPropertyValue(CSS_PROPERTY_OVER)?.slice(1, -1) || ''; // slice to trim quotes\n const under = style.getPropertyValue(CSS_PROPERTY_UNDER)?.slice(1, -1) || ''; // slice to trim quotes\n\n if (prevInvalid !== nextInvalid) {\n attr(el, 'aria-live', nextInvalid ? 'polite' : 'off');\n for (const css of CSS_VALIDATIONS) el.classList.toggle(css, nextInvalid);\n }\n el.textContent = (nextInvalid ? over : under).replace('%d', `${Math.abs(remainder)}`);\n }\n}\n\n// Prevent browsers from showing default validation bubbles\nfunction handleInvalid(event: Event) {\n if ((event.target as Element)?.closest?.(`.${CSS_FIELD}`)) event.preventDefault();\n}\n\nexport function observe (el: Element) {\n onMutation(el, CSS_FIELD, renderAria);\n on(el, 'input', handleInput, QUICK_EVENT);\n on(el, 'invalid', handleInvalid, true); // Use capture as invalid does noe buttle\n}\n\nexport function unobserve (el: Element) {\n onMutation(el, CSS_FIELD, false);\n off(el, 'input', handleInput, QUICK_EVENT);\n off(el, 'invalid', handleInvalid, true);\n}\n"],"names":["CSS_FIELD","styles","CSS_PROPERTY_OVER","CSS_PROPERTY_UNDER","CSS_VALIDATIONS","CSS_VALIDATION","renderAria","fields","field","labels","descs","input","valid","el","isInputLike","useId","label","renderCounter","attr","handleInput","target","limit","remainder","nextInvalid","prevInvalid","style","over","_a","under","_b","css","handleInvalid","event","observe","onMutation","on","QUICK_EVENT","unobserve","off"],"mappings":";;AAGA,MAAMA,IAAYC,EAAO,MAAM,MAAM,GAAG,EAAE,CAAC,GACrCC,IAAoB,0BACpBC,IAAqB,2BACrBC,IAAkBH,EAAO,WAAW,MAAM,GAAG,GAC7CI,IAAiBD,EAAgB,CAAC;AAExC,SAASE,EAAWC,GAAmC;AACrD,aAAUC,KAASD,GAAQ;AACzB,UAAME,IAA6B,CAAC,GAC9BC,IAAkB,CAAC;AACzB,QAAIC,IAAiC,MACjCC,IAAQ;AAEZ,eAAWC,KAAML,EAAM,qBAAqB,GAAG;AAC7C,MAAIK,aAAc,mBAAyBJ,EAAA,KAAKI,CAAE,IACzCC,EAAYD,CAAE,IAAWF,IAAAE,IACzBA,EAAG,UAAU,SAASR,CAAc,KACnCO,IAAAC,EAAG,aAAa,YAAY,MAAM,WACpCH,EAAA,QAAQK,EAAMF,CAAE,CAAC,KACdA,aAAc,0BAA4B,KAAKE,EAAMF,CAAE,CAAC;AAGrE,QAAIF,GAAO;AACT,iBAAWK,KAASP,EAAc,CAAAO,EAAA,UAAUD,EAAMJ,CAAK;AACvD,MAAAM,EAAcN,CAAK,GACnBO,EAAKP,GAAO,oBAAoBD,EAAM,KAAK,GAAG,CAAC,GAC/CQ,EAAKP,GAAO,gBAAgB,GAAG,CAACC,CAAK,EAAE;AAAA,IAAA;AAAA,EACzC;AAEJ;AACA,SAASO,EAAY,EAAE,QAAAC,KAAiB;AACtC,EAAIN,EAAYM,CAAM,KAAGH,EAAcG,CAAM;AAC/C;AAEA,SAASH,EAAcN,GAAyB;;AAC9C,QAAME,IAAKF,KAAA,gBAAAA,EAAO,oBACZU,IAAQR,KAAA,gBAAAA,EAAI,aAAa;AAE/B,MAAIA,KAAMQ,GAAO;AACf,UAAMC,IAAY,OAAOD,CAAK,IAAIV,EAAM,MAAM,QACxCY,IAAcD,IAAY,GAC1BE,IAAcX,EAAG,aAAa,WAAW,MAAM,UAC/CY,IAAQ,OAAO,iBAAiBZ,KAAMF,CAAK,GAC3Ce,MAAOC,IAAAF,EAAM,iBAAiBvB,CAAiB,MAAxC,gBAAAyB,EAA2C,MAAM,GAAG,QAAO,IAClEC,MAAQC,IAAAJ,EAAM,iBAAiBtB,CAAkB,MAAzC,gBAAA0B,EAA4C,MAAM,GAAG,QAAO;AAE1E,QAAIL,MAAgBD,GAAa;AAC/B,MAAAL,EAAKL,GAAI,aAAaU,IAAc,WAAW,KAAK;AACpD,iBAAWO,KAAO1B,EAAiB,CAAAS,EAAG,UAAU,OAAOiB,GAAKP,CAAW;AAAA,IAAA;AAEtE,IAAAV,EAAA,eAAeU,IAAcG,IAAOE,GAAO,QAAQ,MAAM,GAAG,KAAK,IAAIN,CAAS,CAAC,EAAE;AAAA,EAAA;AAExF;AAGA,SAASS,EAAcC,GAAc;;AAC9B,GAAAH,KAAAF,IAAAK,EAAM,WAAN,gBAAAL,EAA0B,YAA1B,QAAAE,EAAA,KAAAF,GAAoC,IAAI3B,CAAS,SAAW,eAAe;AAClF;AAEO,SAASiC,EAASpB,GAAa;AACzB,EAAAqB,EAAArB,GAAIb,GAAWM,CAAU,GACjC6B,EAAAtB,GAAI,SAASM,GAAaiB,CAAW,GACrCD,EAAAtB,GAAI,WAAWkB,GAAe,EAAI;AACvC;AAEO,SAASM,EAAWxB,GAAa;AAC3B,EAAAqB,EAAArB,GAAIb,GAAW,EAAK,GAC3BsC,EAAAzB,GAAI,SAASM,GAAaiB,CAAW,GACrCE,EAAAzB,GAAI,WAAWkB,GAAe,EAAI;AACxC;"}
1
+ {"version":3,"file":"field-observer.js","sources":["../../designsystem/field/field-observer.ts"],"sourcesContent":["import styles from \"../styles.module.css\";\nimport {\n QUICK_EVENT,\n attr,\n isInputLike,\n off,\n on,\n onMutation,\n useId,\n} from \"../utils\";\n\nconst CSS_FIELD = styles.field.split(\" \")[0];\nconst CSS_PROPERTY_OVER = \"--mtds-text-count-over\";\nconst CSS_PROPERTY_UNDER = \"--mtds-text-count-under\";\nconst CSS_VALIDATIONS = styles.validation.split(\" \");\nconst CSS_VALIDATION = CSS_VALIDATIONS[0];\n\nfunction renderAria(fields: HTMLCollectionOf<Element>) {\n for (const field of fields) {\n const labels: HTMLLabelElement[] = [];\n const descs: string[] = [];\n let input: HTMLInputElement | null = null;\n let valid = true;\n\n for (const el of field.getElementsByTagName(\"*\")) {\n if (el instanceof HTMLLabelElement) labels.push(el);\n else if (isInputLike(el)) input = el;\n else if (el.classList.contains(CSS_VALIDATION)) {\n // Must be before instanceof HTMLParagraphElement since validation can also be a <p>\n valid = attr(el, \"data-color\") === \"success\";\n descs.unshift(useId(el));\n } else if (el instanceof HTMLParagraphElement) descs.push(useId(el));\n }\n\n if (input) {\n for (const label of labels) label.htmlFor = useId(input);\n renderCounter(input);\n attr(input, \"aria-describedby\", descs.join(\" \"));\n attr(input, \"aria-invalid\", `${!valid}`);\n }\n }\n}\nfunction handleInput({ target }: Event) {\n if (isInputLike(target)) renderCounter(target);\n}\n\nfunction renderCounter(input: HTMLInputElement) {\n const el = input?.nextElementSibling;\n const limit = el && attr(el, \"data-count\");\n\n if (el && limit) {\n const remainder = Number(limit) - input.value.length;\n const nextInvalid = remainder < 0;\n const prevInvalid = attr(el, \"aria-live\") === \"polite\";\n const style = window.getComputedStyle(el || input);\n const over = style.getPropertyValue(CSS_PROPERTY_OVER)?.slice(1, -1) || \"\"; // slice to trim quotes\n const under =\n style.getPropertyValue(CSS_PROPERTY_UNDER)?.slice(1, -1) || \"\"; // slice to trim quotes\n\n if (prevInvalid !== nextInvalid) {\n attr(el, \"aria-live\", nextInvalid ? \"polite\" : \"off\");\n for (const css of CSS_VALIDATIONS) el.classList.toggle(css, nextInvalid);\n }\n el.textContent = (nextInvalid ? over : under).replace(\n \"%d\",\n `${Math.abs(remainder)}`\n );\n }\n}\n\n// Prevent browsers from showing default validation bubbles\nfunction handleInvalid(event: Event) {\n if ((event.target as Element)?.closest?.(`.${CSS_FIELD}`))\n event.preventDefault();\n}\n\nexport function observe(el: Element) {\n onMutation(el, CSS_FIELD, renderAria);\n on(el, \"input\", handleInput, QUICK_EVENT);\n on(el, \"invalid\", handleInvalid, true); // Use capture as invalid does noe buttle\n}\n\nexport function unobserve(el: Element) {\n onMutation(el, CSS_FIELD, false);\n off(el, \"input\", handleInput, QUICK_EVENT);\n off(el, \"invalid\", handleInvalid, true);\n}\n"],"names":["CSS_FIELD","styles","CSS_PROPERTY_OVER","CSS_PROPERTY_UNDER","CSS_VALIDATIONS","CSS_VALIDATION","renderAria","fields","field","labels","descs","input","valid","el","isInputLike","attr","useId","label","renderCounter","handleInput","target","limit","remainder","nextInvalid","prevInvalid","style","over","_a","under","_b","css","handleInvalid","event","observe","onMutation","on","QUICK_EVENT","unobserve","off"],"mappings":";;AAWA,MAAMA,IAAYC,EAAO,MAAM,MAAM,GAAG,EAAE,CAAC,GACrCC,IAAoB,0BACpBC,IAAqB,2BACrBC,IAAkBH,EAAO,WAAW,MAAM,GAAG,GAC7CI,IAAiBD,EAAgB,CAAC;AAExC,SAASE,EAAWC,GAAmC;AACrD,aAAWC,KAASD,GAAQ;AAC1B,UAAME,IAA6B,CAAC,GAC9BC,IAAkB,CAAC;AACzB,QAAIC,IAAiC,MACjCC,IAAQ;AAEZ,eAAWC,KAAML,EAAM,qBAAqB,GAAG;AAC7C,MAAIK,aAAc,mBAAyBJ,EAAA,KAAKI,CAAE,IACzCC,EAAYD,CAAE,IAAWF,IAAAE,IACzBA,EAAG,UAAU,SAASR,CAAc,KAEnCO,IAAAG,EAAKF,GAAI,YAAY,MAAM,WAC7BH,EAAA,QAAQM,EAAMH,CAAE,CAAC,KACdA,aAAc,0BAA4B,KAAKG,EAAMH,CAAE,CAAC;AAGrE,QAAIF,GAAO;AACT,iBAAWM,KAASR,EAAc,CAAAQ,EAAA,UAAUD,EAAML,CAAK;AACvD,MAAAO,EAAcP,CAAK,GACnBI,EAAKJ,GAAO,oBAAoBD,EAAM,KAAK,GAAG,CAAC,GAC/CK,EAAKJ,GAAO,gBAAgB,GAAG,CAACC,CAAK,EAAE;AAAA,IAAA;AAAA,EACzC;AAEJ;AACA,SAASO,EAAY,EAAE,QAAAC,KAAiB;AACtC,EAAIN,EAAYM,CAAM,KAAGF,EAAcE,CAAM;AAC/C;AAEA,SAASF,EAAcP,GAAyB;;AAC9C,QAAME,IAAKF,KAAA,gBAAAA,EAAO,oBACZU,IAAQR,KAAME,EAAKF,GAAI,YAAY;AAEzC,MAAIA,KAAMQ,GAAO;AACf,UAAMC,IAAY,OAAOD,CAAK,IAAIV,EAAM,MAAM,QACxCY,IAAcD,IAAY,GAC1BE,IAAcT,EAAKF,GAAI,WAAW,MAAM,UACxCY,IAAQ,OAAO,iBAAiBZ,KAAMF,CAAK,GAC3Ce,MAAOC,IAAAF,EAAM,iBAAiBvB,CAAiB,MAAxC,gBAAAyB,EAA2C,MAAM,GAAG,QAAO,IAClEC,MACJC,IAAAJ,EAAM,iBAAiBtB,CAAkB,MAAzC,gBAAA0B,EAA4C,MAAM,GAAG,QAAO;AAE9D,QAAIL,MAAgBD,GAAa;AAC/B,MAAAR,EAAKF,GAAI,aAAaU,IAAc,WAAW,KAAK;AACpD,iBAAWO,KAAO1B,EAAiB,CAAAS,EAAG,UAAU,OAAOiB,GAAKP,CAAW;AAAA,IAAA;AAEtE,IAAAV,EAAA,eAAeU,IAAcG,IAAOE,GAAO;AAAA,MAC5C;AAAA,MACA,GAAG,KAAK,IAAIN,CAAS,CAAC;AAAA,IACxB;AAAA,EAAA;AAEJ;AAGA,SAASS,EAAcC,GAAc;;AACnC,GAAKH,KAAAF,IAAAK,EAAM,WAAN,gBAAAL,EAA0B,YAA1B,QAAAE,EAAA,KAAAF,GAAoC,IAAI3B,CAAS,OACpDgC,EAAM,eAAe;AACzB;AAEO,SAASC,EAAQpB,GAAa;AACxB,EAAAqB,EAAArB,GAAIb,GAAWM,CAAU,GACjC6B,EAAAtB,GAAI,SAASM,GAAaiB,CAAW,GACrCD,EAAAtB,GAAI,WAAWkB,GAAe,EAAI;AACvC;AAEO,SAASM,EAAUxB,GAAa;AAC1B,EAAAqB,EAAArB,GAAIb,GAAW,EAAK,GAC3BsC,EAAAzB,GAAI,SAASM,GAAaiB,CAAW,GACrCE,EAAAzB,GAAI,WAAWkB,GAAe,EAAI;AACxC;"}
@@ -1,7 +1,7 @@
1
1
  import { StoryObj } from '@storybook/react';
2
2
  declare const meta: {
3
3
  title: string;
4
- decorators: ((Story: import('@storybook/csf').PartialStoryFn<import('@storybook/react').ReactRenderer, {
4
+ decorators: ((Story: import('@storybook/core/csf').PartialStoryFn<import('@storybook/react').ReactRenderer, {
5
5
  [x: string]: any;
6
6
  }>) => import("react/jsx-runtime").JSX.Element)[];
7
7
  };
@@ -1,18 +1,17 @@
1
1
  import n from "../styles.module.css.js";
2
- import { onMutation as a, useId as l, attr as e, isInputLike as c } from "../utils.js";
3
- const r = n.fieldset.split(" ")[0], p = n.validation.split(" ")[0];
2
+ import { onMutation as a, useId as f, attr as e, isInputLike as c } from "../utils.js";
3
+ const l = n.fieldset.split(" ")[0], p = n.validation.split(" ")[0];
4
4
  function d(s) {
5
- for (const f of s) {
5
+ for (const r of s) {
6
6
  const i = [];
7
- let o = "";
8
- for (const t of f.getElementsByTagName("*"))
9
- t.classList.contains(p) ? o = l(t) : c(t) && i.push(t);
10
- if (o)
11
- for (const t of i)
12
- e(t, "aria-describedby", o), e(t, "aria-invalid", "true");
7
+ let o = null;
8
+ for (const t of r.getElementsByTagName("*"))
9
+ t.classList.contains(p) ? o = f(t) : c(t) && i.push(t);
10
+ for (const t of i)
11
+ e(t, "aria-describedby", o), e(t, "aria-invalid", `${!!o}`);
13
12
  }
14
13
  }
15
- const I = (s) => a(s, r, d), v = (s) => a(s, r, !1);
14
+ const I = (s) => a(s, l, d), v = (s) => a(s, l, !1);
16
15
  export {
17
16
  I as observe,
18
17
  v as unobserve
@@ -1 +1 @@
1
- {"version":3,"file":"fieldset-observer.js","sources":["../../designsystem/fieldset/fieldset-observer.ts"],"sourcesContent":["import styles from '../styles.module.css';\nimport { attr, isInputLike, onMutation, useId } from '../utils';\nconst CSS_FIELDSET = styles.fieldset.split(' ')[0];\nconst CSS_VALIDATION = styles.validation.split(' ')[0];\n\nfunction process(fieldsets: HTMLCollectionOf<Element>) {\n for(const fieldset of fieldsets) {\n const inputs: HTMLInputElement[] = [];\n let validationId = '';\n\n for (const el of fieldset.getElementsByTagName('*')) {\n if (el.classList.contains(CSS_VALIDATION)) validationId = useId(el);\n else if (isInputLike(el)) inputs.push(el);\n }\n\n if (validationId) \n for(const input of inputs) {\n attr(input, 'aria-describedby', validationId);\n attr(input, 'aria-invalid', 'true');\n }\n }\n}\n\nexport const observe = (el: Element) => onMutation(el, CSS_FIELDSET, process);\nexport const unobserve = (el: Element) => onMutation(el, CSS_FIELDSET, false);\n"],"names":["CSS_FIELDSET","styles","CSS_VALIDATION","process","fieldsets","fieldset","inputs","validationId","el","useId","isInputLike","input","attr","observe","onMutation","unobserve"],"mappings":";;AAEA,MAAMA,IAAeC,EAAO,SAAS,MAAM,GAAG,EAAE,CAAC,GAC3CC,IAAiBD,EAAO,WAAW,MAAM,GAAG,EAAE,CAAC;AAErD,SAASE,EAAQC,GAAsC;AACrD,aAAUC,KAAYD,GAAW;AAC/B,UAAME,IAA6B,CAAC;AACpC,QAAIC,IAAe;AAEnB,eAAWC,KAAMH,EAAS,qBAAqB,GAAG;AAChD,MAAIG,EAAG,UAAU,SAASN,CAAc,IAAGK,IAAeE,EAAMD,CAAE,IACzDE,EAAYF,CAAE,KAAGF,EAAO,KAAKE,CAAE;AAGtC,QAAAD;AACF,iBAAUI,KAASL;AACZ,QAAAM,EAAAD,GAAO,oBAAoBJ,CAAY,GACvCK,EAAAD,GAAO,gBAAgB,MAAM;AAAA,EACpC;AAEN;AAEO,MAAME,IAAU,CAACL,MAAgBM,EAAWN,GAAIR,GAAcG,CAAO,GAC/DY,IAAY,CAACP,MAAgBM,EAAWN,GAAIR,GAAc,EAAK;"}
1
+ {"version":3,"file":"fieldset-observer.js","sources":["../../designsystem/fieldset/fieldset-observer.ts"],"sourcesContent":["import styles from \"../styles.module.css\";\nimport { attr, isInputLike, onMutation, useId } from \"../utils\";\nconst CSS_FIELDSET = styles.fieldset.split(\" \")[0];\nconst CSS_VALIDATION = styles.validation.split(\" \")[0];\n\nfunction process(fieldsets: HTMLCollectionOf<Element>) {\n for (const fieldset of fieldsets) {\n const inputs: HTMLInputElement[] = [];\n let validationId: string | null = null;\n\n for (const el of fieldset.getElementsByTagName(\"*\")) {\n if (el.classList.contains(CSS_VALIDATION)) validationId = useId(el);\n else if (isInputLike(el)) inputs.push(el);\n }\n\n for (const input of inputs) {\n attr(input, \"aria-describedby\", validationId);\n attr(input, \"aria-invalid\", `${!!validationId}`);\n }\n }\n}\n\nexport const observe = (el: Element) => onMutation(el, CSS_FIELDSET, process);\nexport const unobserve = (el: Element) => onMutation(el, CSS_FIELDSET, false);\n"],"names":["CSS_FIELDSET","styles","CSS_VALIDATION","process","fieldsets","fieldset","inputs","validationId","el","useId","isInputLike","input","attr","observe","onMutation","unobserve"],"mappings":";;AAEA,MAAMA,IAAeC,EAAO,SAAS,MAAM,GAAG,EAAE,CAAC,GAC3CC,IAAiBD,EAAO,WAAW,MAAM,GAAG,EAAE,CAAC;AAErD,SAASE,EAAQC,GAAsC;AACrD,aAAWC,KAAYD,GAAW;AAChC,UAAME,IAA6B,CAAC;AACpC,QAAIC,IAA8B;AAElC,eAAWC,KAAMH,EAAS,qBAAqB,GAAG;AAChD,MAAIG,EAAG,UAAU,SAASN,CAAc,IAAGK,IAAeE,EAAMD,CAAE,IACzDE,EAAYF,CAAE,KAAGF,EAAO,KAAKE,CAAE;AAG1C,eAAWG,KAASL;AACb,MAAAM,EAAAD,GAAO,oBAAoBJ,CAAY,GAC5CK,EAAKD,GAAO,gBAAgB,GAAG,CAAC,CAACJ,CAAY,EAAE;AAAA,EACjD;AAEJ;AAEO,MAAMM,IAAU,CAACL,MAAgBM,EAAWN,GAAIR,GAAcG,CAAO,GAC/DY,IAAY,CAACP,MAAgBM,EAAWN,GAAIR,GAAc,EAAK;"}
@@ -1,6 +1,8 @@
1
1
  import { JSX } from 'react';
2
2
  import { PolymorphicComponentPropWithRef } from '../react-types';
3
- export type HeadingProps<As extends React.ElementType = "h2"> = PolymorphicComponentPropWithRef<As>;
3
+ export type HeadingProps<As extends React.ElementType = "h2"> = PolymorphicComponentPropWithRef<As, {
4
+ "data-size"?: "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
5
+ }>;
4
6
  type HeadingComponent = <As extends React.ElementType = "h2">(props: HeadingProps<As>) => JSX.Element;
5
7
  export declare const Heading: HeadingComponent;
6
8
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"heading.js","sources":["../../designsystem/heading/heading.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 HeadingProps<As extends React.ElementType = \"h2\"> =\n\tPolymorphicComponentPropWithRef<As>;\n\ntype HeadingComponent = <As extends React.ElementType = \"h2\">(\n\tprops: HeadingProps<As>,\n) => JSX.Element;\n\nexport const Heading: HeadingComponent = forwardRef<null>(function Heading<\n\tAs extends React.ElementType = \"h2\",\n>({ as, className, ...rest }: HeadingProps<As>, ref?: PolymorphicRef<As>) {\n\tconst Tag = as || \"h2\";\n\n\treturn (\n\t\t<Tag className={clsx(styles.heading, className)} ref={ref} {...rest} />\n\t);\n}) as HeadingComponent; // Needed to tell Typescript this does not return ReactNode but acutally JSX.Element\n"],"names":["Heading","forwardRef","as","className","rest","ref","jsx","clsx","styles"],"mappings":";;;;AAea,MAAAA,IAA4BC,EAAiB,SAExD,EAAE,IAAAC,GAAI,WAAAC,GAAW,GAAGC,EAAK,GAAqBC,GAA0B;AAIxE,SAAA,gBAAAC,EAHWJ,KAAM,MAGZ,EAAA,WAAWK,EAAKC,EAAO,SAASL,CAAS,GAAG,KAAAE,GAAW,GAAGD,EAAM,CAAA;AAEvE,CAAC;"}
1
+ {"version":3,"file":"heading.js","sources":["../../designsystem/heading/heading.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 HeadingProps<As extends React.ElementType = \"h2\"> =\n\tPolymorphicComponentPropWithRef<\n\t\tAs,\n\t\t{\n\t\t\t\"data-size\"?: \"2xs\" | \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\";\n\t\t}\n\t>;\n\ntype HeadingComponent = <As extends React.ElementType = \"h2\">(\n\tprops: HeadingProps<As>,\n) => JSX.Element;\n\nexport const Heading: HeadingComponent = forwardRef<null>(function Heading<\n\tAs extends React.ElementType = \"h2\",\n>({ as, className, ...rest }: HeadingProps<As>, ref?: PolymorphicRef<As>) {\n\tconst Tag = as || \"h2\";\n\n\treturn (\n\t\t<Tag className={clsx(styles.heading, className)} ref={ref} {...rest} />\n\t);\n}) as HeadingComponent; // Needed to tell Typescript this does not return ReactNode but acutally JSX.Element\n"],"names":["Heading","forwardRef","as","className","rest","ref","jsx","clsx","styles"],"mappings":";;;;AAoBa,MAAAA,IAA4BC,EAAiB,SAExD,EAAE,IAAAC,GAAI,WAAAC,GAAW,GAAGC,EAAK,GAAqBC,GAA0B;AAIxE,SAAA,gBAAAC,EAHWJ,KAAM,MAGZ,EAAA,WAAWK,EAAKC,EAAO,SAASL,CAAS,GAAG,KAAAE,GAAW,GAAGD,EAAM,CAAA;AAEvE,CAAC;"}
@@ -1,7 +1,7 @@
1
1
  import { StoryObj } from '@storybook/react';
2
2
  declare const meta: {
3
3
  title: string;
4
- decorators: ((Story: import('@storybook/csf').PartialStoryFn<import('@storybook/react').ReactRenderer, {
4
+ decorators: ((Story: import('@storybook/core/csf').PartialStoryFn<import('@storybook/react').ReactRenderer, {
5
5
  [x: string]: any;
6
6
  }>) => import("react/jsx-runtime").JSX.Element)[];
7
7
  };
package/mtds/index.d.ts CHANGED
@@ -5,6 +5,7 @@ badge: string;
5
5
  breadcrumbs: string;
6
6
  button: string;
7
7
  card: string;
8
+ group: string;
8
9
  chip: string;
9
10
  details: string;
10
11
  dialog: string;