@mattilsynet/design 2.1.9 → 2.1.10

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.
@@ -1,12 +1,21 @@
1
1
  export type TableProps = React.ComponentPropsWithoutRef<"table"> & {
2
2
  "data-align"?: "start" | "center";
3
- "data-border"?: boolean | "true" | "false";
3
+ "data-border"?: boolean | "true" | "false" | "none";
4
4
  "data-fixed"?: boolean;
5
5
  "data-mobile"?: "divided" | "spaced" | "stacked";
6
6
  };
7
+ export type ThSortableProps = Omit<React.ComponentPropsWithoutRef<"th">, "aria-sort" | "onClick"> & {
8
+ onClick: React.ComponentPropsWithoutRef<"button">["onClick"];
9
+ "aria-sort"?: "" | "acending" | "asc" | "desc" | "descending" | "down" | "false" | "none" | "up" | false | null;
10
+ };
7
11
  export declare const Table: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, "ref"> & {
8
12
  "data-align"?: "start" | "center";
9
- "data-border"?: boolean | "true" | "false";
13
+ "data-border"?: boolean | "true" | "false" | "none";
10
14
  "data-fixed"?: boolean;
11
15
  "data-mobile"?: "divided" | "spaced" | "stacked";
12
- } & React.RefAttributes<HTMLTableElement>>;
16
+ } & React.RefAttributes<HTMLTableElement>> & {
17
+ ThSortable: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>, "ref">, "aria-sort" | "onClick"> & {
18
+ onClick: React.ComponentPropsWithoutRef<"button">["onClick"];
19
+ "aria-sort"?: "" | "acending" | "asc" | "desc" | "descending" | "down" | "false" | "none" | "up" | false | null;
20
+ } & React.RefAttributes<HTMLTableCellElement>>;
21
+ };
@@ -1,11 +1,28 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import { clsx as m } from "../external/clsx/dist/clsx.js";
3
- import { forwardRef as a } from "react";
4
- import f from "../styles.module.css.js";
5
- const c = a(function({ className: r, ...o }, t) {
6
- return /* @__PURE__ */ e("table", { className: m(f.table, r), ref: t, ...o });
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { clsx as i } from "../external/clsx/dist/clsx.js";
3
+ import { forwardRef as s } from "react";
4
+ import d from "../styles.module.css.js";
5
+ const l = {
6
+ "": "none",
7
+ asc: "ascending",
8
+ ascending: "ascending",
9
+ desc: "descending",
10
+ descending: "descending",
11
+ down: "descending",
12
+ false: "none",
13
+ none: "none",
14
+ null: "none",
15
+ up: "ascending"
16
+ }, b = s(function({ className: n, ...e }, o) {
17
+ return /* @__PURE__ */ t("table", { className: i(d.table, n), ref: o, ...e });
18
+ }), u = Object.assign(b, {
19
+ ThSortable: s(
20
+ function({ "aria-sort": n, children: e, onClick: o, ...a }, c) {
21
+ return /* @__PURE__ */ t("th", { ref: c, "aria-sort": l[`${n}`], ...a, children: /* @__PURE__ */ t("button", { type: "button", onClick: o, children: e }) });
22
+ }
23
+ )
7
24
  });
8
25
  export {
9
- c as Table
26
+ u as Table
10
27
  };
11
28
  //# sourceMappingURL=table.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"table.js","sources":["../../designsystem/table/table.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef } from \"react\";\nimport styles from \"../styles.module.css\";\n\nexport type TableProps = React.ComponentPropsWithoutRef<\"table\"> & {\n\t\"data-align\"?: \"start\" | \"center\";\n\t\"data-border\"?: boolean | \"true\" | \"false\";\n\t\"data-fixed\"?: boolean;\n\t\"data-mobile\"?: \"divided\" | \"spaced\" | \"stacked\";\n};\n\nexport const Table = forwardRef<HTMLTableElement, TableProps>(function Table(\n\t{ className, ...rest },\n\tref,\n) {\n\treturn (\n\t\t<table className={clsx(styles.table, className)} ref={ref} {...rest} />\n\t);\n});\n"],"names":["Table","forwardRef","className","rest","ref","jsx","clsx","styles"],"mappings":";;;;AAWO,MAAMA,IAAQC,EAAyC,SAC7D,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAChBC,GACC;AACD,SACC,gBAAAC,EAAC,SAAA,EAAM,WAAWC,EAAKC,EAAO,OAAOL,CAAS,GAAG,KAAAE,GAAW,GAAGD,EAAA,CAAM;AAEvE,CAAC;"}
1
+ {"version":3,"file":"table.js","sources":["../../designsystem/table/table.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef } from \"react\";\nimport styles from \"../styles.module.css\";\n\nexport type TableProps = React.ComponentPropsWithoutRef<\"table\"> & {\n\t\"data-align\"?: \"start\" | \"center\";\n\t\"data-border\"?: boolean | \"true\" | \"false\" | \"none\";\n\t\"data-fixed\"?: boolean;\n\t\"data-mobile\"?: \"divided\" | \"spaced\" | \"stacked\";\n};\n\nexport type ThSortableProps = Omit<\n\tReact.ComponentPropsWithoutRef<\"th\">,\n\t\"aria-sort\" | \"onClick\"\n> & {\n\tonClick: React.ComponentPropsWithoutRef<\"button\">[\"onClick\"];\n\t\"aria-sort\"?:\n\t\t| \"\"\n\t\t| \"acending\"\n\t\t| \"asc\"\n\t\t| \"desc\"\n\t\t| \"descending\"\n\t\t| \"down\"\n\t\t| \"false\"\n\t\t| \"none\"\n\t\t| \"up\"\n\t\t| false\n\t\t| null;\n};\n\ntype SORT_KEYS = keyof typeof SORT;\nconst SORT = {\n\t\"\": \"none\",\n\tasc: \"ascending\",\n\tascending: \"ascending\",\n\tdesc: \"descending\",\n\tdescending: \"descending\",\n\tdown: \"descending\",\n\tfalse: \"none\",\n\tnone: \"none\",\n\tnull: \"none\",\n\tup: \"ascending\",\n} as const;\n\nconst TableComp = forwardRef<HTMLTableElement, TableProps>(function Table(\n\t{ className, ...rest },\n\tref,\n) {\n\treturn (\n\t\t<table className={clsx(styles.table, className)} ref={ref} {...rest} />\n\t);\n});\n\nexport const Table = Object.assign(TableComp, {\n\tThSortable: forwardRef<HTMLTableCellElement, ThSortableProps>(\n\t\tfunction ThSortable(\n\t\t\t{ \"aria-sort\": sort, children, onClick, ...rest },\n\t\t\tref,\n\t\t) {\n\t\t\treturn (\n\t\t\t\t<th ref={ref} aria-sort={SORT[`${sort}` as SORT_KEYS]} {...rest}>\n\t\t\t\t\t<button type=\"button\" onClick={onClick}>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</button>\n\t\t\t\t</th>\n\t\t\t);\n\t\t},\n\t),\n});\n"],"names":["SORT","TableComp","forwardRef","className","rest","ref","jsx","clsx","styles","Table","sort","children","onClick"],"mappings":";;;;AA+BA,MAAMA,IAAO;AAAA,EACZ,IAAI;AAAA,EACJ,KAAK;AAAA,EACL,WAAW;AAAA,EACX,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,IAAI;AACL,GAEMC,IAAYC,EAAyC,SAC1D,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAChBC,GACC;AACD,SACC,gBAAAC,EAAC,SAAA,EAAM,WAAWC,EAAKC,EAAO,OAAOL,CAAS,GAAG,KAAAE,GAAW,GAAGD,EAAA,CAAM;AAEvE,CAAC,GAEYK,IAAQ,OAAO,OAAOR,GAAW;AAAA,EAC7C,YAAYC;AAAA,IACX,SACC,EAAE,aAAaQ,GAAM,UAAAC,GAAU,SAAAC,GAAS,GAAGR,EAAA,GAC3CC,GACC;AACD,+BACE,MAAA,EAAG,KAAAA,GAAU,aAAWL,EAAK,GAAGU,CAAI,EAAe,GAAI,GAAGN,GAC1D,UAAA,gBAAAE,EAAC,UAAA,EAAO,MAAK,UAAS,SAAAM,GACpB,UAAAD,GACF,GACD;AAAA,IAEF;AAAA,EAAA;AAEF,CAAC;"}
package/mtds/tag/tag.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { JSX } from 'react';
2
2
  import { PolymorphicComponentPropWithRef } from '../react-types';
3
3
  export type TagProps<Href, As extends React.ElementType = Href extends string ? "a" : "span"> = PolymorphicComponentPropWithRef<As, {
4
- 'data-icon'?: 'none';
4
+ "data-icon"?: boolean | "true" | "false" | "none";
5
5
  }>;
6
6
  type TagComponent = <Href, As extends React.ElementType = Href extends string ? "a" : "span">(props: TagProps<Href, As>) => JSX.Element;
7
7
  export declare const Tag: TagComponent;
@@ -1 +1 @@
1
- {"version":3,"file":"tag.js","sources":["../../designsystem/tag/tag.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef, type JSX } from \"react\";\nimport type {\n\tPolymorphicComponentPropWithRef,\n\tPolymorphicRef,\n} from \"../react-types\";\nimport styles from \"../styles.module.css\";\n\nexport type TagProps<\n\tHref,\n\tAs extends React.ElementType = Href extends string ? \"a\" : \"span\",\n> = PolymorphicComponentPropWithRef<As, { 'data-icon'?: 'none' }>;\n\ntype TagComponent = <\n\tHref,\n\tAs extends React.ElementType = Href extends string ? \"a\" : \"span\",\n>(\n\tprops: TagProps<Href, As>,\n) => JSX.Element;\n\nexport const Tag: TagComponent = forwardRef<null>(function Tag<\n\tHref,\n\tAs extends React.ElementType = Href extends string ? \"a\" : \"span\",\n>({ as, className, ...rest }: TagProps<Href, As>, ref?: PolymorphicRef<As>) {\n\tconst Tag = as || (rest.href ? \"a\" : \"span\");\n\n\treturn <Tag className={clsx(styles.tag, className)} ref={ref} {...rest} />;\n}) as TagComponent; // Needed to tell Typescript this does not return ReactNode but acutally JSX.Element\n"],"names":["Tag","forwardRef","as","className","rest","ref","jsx","clsx","styles"],"mappings":";;;;AAoBO,MAAMA,IAAoBC,EAAiB,SAGhD,EAAE,IAAAC,GAAI,WAAAC,GAAW,GAAGC,EAAA,GAA4BC,GAA0B;AAC3E,QAAML,IAAME,MAAOE,EAAK,OAAO,MAAM;AAErC,SAAO,gBAAAE,EAACN,GAAA,EAAI,WAAWO,EAAKC,EAAO,KAAKL,CAAS,GAAG,KAAAE,GAAW,GAAGD,EAAA,CAAM;AACzE,CAAC;"}
1
+ {"version":3,"file":"tag.js","sources":["../../designsystem/tag/tag.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef, type JSX } from \"react\";\nimport type {\n\tPolymorphicComponentPropWithRef,\n\tPolymorphicRef,\n} from \"../react-types\";\nimport styles from \"../styles.module.css\";\n\nexport type TagProps<\n\tHref,\n\tAs extends React.ElementType = Href extends string ? \"a\" : \"span\",\n> = PolymorphicComponentPropWithRef<\n\tAs,\n\t{ \"data-icon\"?: boolean | \"true\" | \"false\" | \"none\" }\n>;\n\ntype TagComponent = <\n\tHref,\n\tAs extends React.ElementType = Href extends string ? \"a\" : \"span\",\n>(\n\tprops: TagProps<Href, As>,\n) => JSX.Element;\n\nexport const Tag: TagComponent = forwardRef<null>(function Tag<\n\tHref,\n\tAs extends React.ElementType = Href extends string ? \"a\" : \"span\",\n>({ as, className, ...rest }: TagProps<Href, As>, ref?: PolymorphicRef<As>) {\n\tconst Tag = as || (rest.href ? \"a\" : \"span\");\n\n\treturn <Tag className={clsx(styles.tag, className)} ref={ref} {...rest} />;\n}) as TagComponent; // Needed to tell Typescript this does not return ReactNode but acutally JSX.Element\n"],"names":["Tag","forwardRef","as","className","rest","ref","jsx","clsx","styles"],"mappings":";;;;AAuBO,MAAMA,IAAoBC,EAAiB,SAGhD,EAAE,IAAAC,GAAI,WAAAC,GAAW,GAAGC,EAAA,GAA4BC,GAA0B;AAC3E,QAAML,IAAME,MAAOE,EAAK,OAAO,MAAM;AAErC,SAAO,gBAAAE,EAACN,GAAA,EAAI,WAAWO,EAAKC,EAAO,KAAKL,CAAS,GAAG,KAAAE,GAAW,GAAGD,EAAA,CAAM;AACzE,CAAC;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mattilsynet/design",
3
- "version": "2.1.9",
3
+ "version": "2.1.10",
4
4
  "type": "module",
5
5
  "main": "./mtds/index.js",
6
6
  "types": "./mtds/index.d.ts",