@mattilsynet/design 0.0.13 → 0.1.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 (53) hide show
  1. package/mtds/alert/alert.stories.d.ts +10 -0
  2. package/mtds/avatar/avatar.stories.d.ts +7 -0
  3. package/mtds/breadcrumbs/breadcrumbs.stories.d.ts +9 -0
  4. package/mtds/button/button.stories.d.ts +15 -0
  5. package/mtds/card/card.stories.d.ts +7 -0
  6. package/mtds/chip/chip.stories.d.ts +7 -0
  7. package/mtds/details/details.stories.d.ts +10 -0
  8. package/mtds/errorsummary/errorsummary.stories.d.ts +7 -0
  9. package/mtds/favicon-dark.ico +0 -0
  10. package/mtds/favicon.ico +0 -0
  11. package/mtds/favicon.svg +4 -0
  12. package/mtds/field/field.d.ts +2 -2
  13. package/mtds/field/field.js +34 -26
  14. package/mtds/field/field.js.map +1 -1
  15. package/mtds/field/field.stories.d.ts +11 -0
  16. package/mtds/fieldset/fieldset.d.ts +2 -0
  17. package/mtds/fieldset/fieldset.js +28 -0
  18. package/mtds/fieldset/fieldset.js.map +1 -0
  19. package/mtds/fieldset/fieldset.stories.d.ts +12 -0
  20. package/mtds/index.d.ts +19 -1
  21. package/mtds/index.iife.js +2 -2
  22. package/mtds/index.iife.js.map +1 -1
  23. package/mtds/index.js +14 -10
  24. package/mtds/index.js.map +1 -1
  25. package/mtds/input/input.stories.d.ts +12 -0
  26. package/mtds/layout/layout.stories.d.ts +17 -0
  27. package/mtds/link/link.stories.d.ts +7 -0
  28. package/mtds/logo/logo.stories.d.ts +7 -0
  29. package/mtds/modal/modal.stories.d.ts +8 -0
  30. package/mtds/pagination/pagination.d.ts +13 -0
  31. package/mtds/pagination/pagination.js +20 -0
  32. package/mtds/pagination/pagination.js.map +1 -0
  33. package/mtds/pagination/pagination.stories.d.ts +10 -0
  34. package/mtds/popover/popover.js +24 -24
  35. package/mtds/popover/popover.js.map +1 -1
  36. package/mtds/popover/popover.stories.d.ts +10 -0
  37. package/mtds/styles.css +2097 -2332
  38. package/mtds/styles.json +30 -13
  39. package/mtds/styles.module.css.js +60 -26
  40. package/mtds/styles.module.css.js.map +1 -1
  41. package/mtds/table/table.d.ts +2 -0
  42. package/mtds/table/table.js +30 -0
  43. package/mtds/table/table.js.map +1 -0
  44. package/mtds/table/table.mockData.d.ts +8 -0
  45. package/mtds/table/table.stories.d.ts +28 -0
  46. package/mtds/tabs/tabs.stories.d.ts +8 -0
  47. package/mtds/tag/tag.stories.d.ts +7 -0
  48. package/mtds/utils.d.ts +29 -0
  49. package/mtds/utils.js +23 -20
  50. package/mtds/utils.js.map +1 -1
  51. package/mtds/validation/validation.stories.d.ts +7 -0
  52. package/package.json +32 -13
  53. package/mtds/input/input.d.ts +0 -1
@@ -0,0 +1,10 @@
1
+ import { StoryObj } from '@storybook/react';
2
+ declare const meta: {
3
+ title: string;
4
+ };
5
+ export default meta;
6
+ type Story = StoryObj<typeof meta>;
7
+ export declare const Default: Story;
8
+ export declare const Variants: Story;
9
+ export declare const Sizes: Story;
10
+ export declare const Title: Story;
@@ -0,0 +1,7 @@
1
+ import { StoryObj } from '@storybook/react';
2
+ declare const meta: {
3
+ title: string;
4
+ };
5
+ export default meta;
6
+ type Story = StoryObj<typeof meta>;
7
+ export declare const Default: Story;
@@ -0,0 +1,9 @@
1
+ import { StoryObj } from '@storybook/react';
2
+ declare const meta: {
3
+ title: string;
4
+ };
5
+ export default meta;
6
+ type Story = StoryObj<typeof meta>;
7
+ export declare const Default: Story;
8
+ export declare const Backbutton: Story;
9
+ export declare const Sizes: Story;
@@ -0,0 +1,15 @@
1
+ import { StoryObj } from '@storybook/react';
2
+ declare const meta: {
3
+ title: string;
4
+ };
5
+ export default meta;
6
+ type Story = StoryObj<typeof meta>;
7
+ export declare const Default: Story;
8
+ export declare const Variants: Story;
9
+ export declare const Sizes: Story;
10
+ export declare const Arrows: Story;
11
+ export declare const Icons: Story;
12
+ export declare const Loading: Story;
13
+ export declare const Contextmenu: Story;
14
+ export declare const Pressed: Story;
15
+ export declare const Tooltip: Story;
@@ -0,0 +1,7 @@
1
+ import { StoryObj } from '@storybook/react';
2
+ declare const meta: {
3
+ title: string;
4
+ };
5
+ export default meta;
6
+ type Story = StoryObj<typeof meta>;
7
+ export declare const Default: Story;
@@ -0,0 +1,7 @@
1
+ import { StoryObj } from '@storybook/react';
2
+ declare const meta: {
3
+ title: string;
4
+ };
5
+ export default meta;
6
+ type Story = StoryObj<typeof meta>;
7
+ export declare const Default: Story;
@@ -0,0 +1,10 @@
1
+ import { StoryObj } from '@storybook/react';
2
+ declare const meta: {
3
+ title: string;
4
+ parameters: {
5
+ layout: string;
6
+ };
7
+ };
8
+ export default meta;
9
+ type Story = StoryObj<typeof meta>;
10
+ export declare const Default: Story;
@@ -0,0 +1,7 @@
1
+ import { StoryObj } from '@storybook/react';
2
+ declare const meta: {
3
+ title: string;
4
+ };
5
+ export default meta;
6
+ type Story = StoryObj<typeof meta>;
7
+ export declare const Default: Story;
Binary file
Binary file
@@ -0,0 +1,4 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="47" height="47" fill="none" viewBox="0 0 47 47">
2
+ <style>path{fill:#054449}@media(prefers-color-scheme: dark){path{fill:#E2F1DF}}</style>
3
+ <path d="M23.37 0A23.37 23.37 0 0 0 .62 18.02 26 26 0 0 1 14 21.6a9.53 9.53 0 0 1 18.87.92 26 26 0 0 1 13.63-2.5A23.36 23.36 0 0 0 23.37 0ZM46.73 23.35v-.2c-13.7-1.6-25.93 9.67-25.44 23.45 13.57 1.27 25.51-9.63 25.44-23.25ZM18.16 45.98a25.9 25.9 0 0 1 3.1-12.33A23.06 23.06 0 0 0 .12 21.12a23.4 23.4 0 0 0 18.04 24.99v-.13Z"/>
4
+ </svg>
@@ -1,2 +1,2 @@
1
- export declare function observe(el: Element): void;
2
- export declare function unobserve(el: Element): void;
1
+ export declare function observe(el: Element | Document): void;
2
+ export declare function unobserve(el: Element | Document): void;
@@ -1,33 +1,41 @@
1
- import f from "../styles.module.css.js";
2
- import { IS_BROWSER as u, createOptimizedMutationObserver as b, useId as r } from "../utils.js";
3
- const d = f.field.split(" ")[0], m = f.validation.split(" ")[0], a = /* @__PURE__ */ new WeakMap();
4
- function c(s) {
5
- for (const i of s) {
6
- const o = [], n = [];
7
- let t = null, l = !0;
8
- for (const e of i.getElementsByTagName("*"))
9
- e instanceof HTMLLabelElement ? o.push(e) : "validity" in e && !(e instanceof HTMLButtonElement) ? t = e : e.classList.contains(m) ? (l = e.getAttribute("data-color") === "success", n.unshift(r(e))) : e instanceof HTMLParagraphElement && n.push(r(e));
10
- if (t) for (const e of o) e.htmlFor = r(t);
11
- t == null || t.setAttribute("aria-describedby", n.join(" ")), t == null || t.setAttribute("aria-invalid", `${!l}`);
1
+ import r from "../styles.module.css.js";
2
+ import { IS_BROWSER as v, on as g, onAdd as A, QUICK_EVENT as c, isInputLike as f, off as I, useId as l } from "../utils.js";
3
+ const S = r.field.split(" ")[0], d = r.validation.split(" "), h = d[0], u = /* @__PURE__ */ new WeakMap();
4
+ function p(t) {
5
+ for (const n of t) {
6
+ const o = [], i = [];
7
+ let e = null, a = !0;
8
+ for (const s of n.getElementsByTagName("*"))
9
+ s instanceof HTMLLabelElement ? o.push(s) : f(s) ? e = s : s.classList.contains(h) ? (a = s.getAttribute("data-color") === "success", i.unshift(l(s))) : s instanceof HTMLParagraphElement && i.push(l(s));
10
+ if (e) for (const s of o) s.htmlFor = l(e);
11
+ e && m(e), e == null || e.setAttribute("aria-describedby", i.join(" ")), e == null || e.setAttribute("aria-invalid", `${!a}`);
12
12
  }
13
13
  }
14
- u && v(document.body);
15
- function v(s) {
16
- if (a.has(s)) return;
17
- const i = s.getElementsByClassName(d), o = b(() => c(i));
18
- o.observe(s, {
19
- attributeFilter: ["class"],
20
- attributes: !0,
21
- childList: !0,
22
- subtree: !0
23
- }), c(i), a.set(s, o);
14
+ function b({ target: t }) {
15
+ f(t) && m(t);
24
16
  }
25
- function L(s) {
26
- var i;
27
- (i = a.get(s)) == null || i.disconnect();
17
+ function m(t) {
18
+ const n = t == null ? void 0 : t.nextElementSibling, o = n == null ? void 0 : n.getAttribute("data-count");
19
+ if (n && o) {
20
+ const i = Number(o) - t.value.length, e = i < 0;
21
+ if (n.getAttribute("aria-live") === "polite" !== e) {
22
+ n.setAttribute("aria-live", e ? "polite" : "off");
23
+ for (const s of d) n.classList.toggle(s, e);
24
+ }
25
+ n.textContent = `${Math.abs(i)} tegn ${e ? "for mye" : "igjen"}`;
26
+ }
27
+ }
28
+ v && E(document);
29
+ function E(t) {
30
+ const n = t.getElementsByClassName(S), o = A(r.fieldChildAdded, () => p(n));
31
+ u.set(t, o), o.observe(t), g(t, "input", b, c);
32
+ }
33
+ function N(t) {
34
+ var n;
35
+ (n = u.get(t)) == null || n.disconnect(t), I(t, "input", b, c);
28
36
  }
29
37
  export {
30
- v as observe,
31
- L as unobserve
38
+ E as observe,
39
+ N as unobserve
32
40
  };
33
41
  //# sourceMappingURL=field.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"field.js","sources":["../../designsystem/field/field.ts"],"sourcesContent":["import styles from '../styles.module.css';\nimport { IS_BROWSER, createOptimizedMutationObserver, useId } from '../utils';\n\nconst CSS_FIELD = styles.field.split(' ')[0];\nconst CSS_VALIDATION = styles.validation.split(' ')[0];\nconst OBSERVERS = new WeakMap();\n\n\nfunction process(fields: HTMLCollectionOf<Element>) {\n for(const field of fields) {\n const labels: HTMLLabelElement[] = [];\n const descs: string[] = [];\n let input: Element | 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 ('validity' in el && !(el instanceof HTMLButtonElement)) input = el;\n else if (el.classList.contains(CSS_VALIDATION)) { // Must be before validation since it 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) for (const label of labels) label.htmlFor = useId(input);\n input?.setAttribute('aria-describedby', descs.join(' '));\n input?.setAttribute('aria-invalid', `${!valid}`);\n }\n}\n\n// Automatically observe <body> if in browser\nif (IS_BROWSER) observe(document.body);\n\nexport function observe (el: Element) {\n if (OBSERVERS.has(el)) return;\n const fields = el.getElementsByClassName(CSS_FIELD); // Reutrns a live HTMLCollection\n const observer = createOptimizedMutationObserver(() => process(fields));\n observer.observe(el, {\n attributeFilter: ['class'],\n attributes: true,\n childList: true,\n subtree: true\n });\n\n process(fields); // Initial run\n OBSERVERS.set(el, observer);\n}\n\nexport function unobserve (el: Element) {\n OBSERVERS.get(el)?.disconnect();\n}\n"],"names":["CSS_FIELD","styles","CSS_VALIDATION","OBSERVERS","process","fields","field","labels","descs","input","valid","el","useId","label","IS_BROWSER","observe","observer","createOptimizedMutationObserver","unobserve","_a"],"mappings":";;AAGA,MAAMA,IAAYC,EAAO,MAAM,MAAM,GAAG,EAAE,CAAC,GACrCC,IAAiBD,EAAO,WAAW,MAAM,GAAG,EAAE,CAAC,GAC/CE,wBAAgB,QAAQ;AAG9B,SAASC,EAAQC,GAAmC;AAClD,aAAUC,KAASD,GAAQ;AACzB,UAAME,IAA6B,CAAC,GAC9BC,IAAkB,CAAC;AACzB,QAAIC,IAAwB,MACxBC,IAAQ;AAEZ,eAAWC,KAAML,EAAM,qBAAqB,GAAG;AAC7C,MAAIK,aAAc,mBAAyBJ,EAAA,KAAKI,CAAE,IACzC,cAAcA,KAAM,EAAEA,aAAc,qBAA4BF,IAAAE,IAChEA,EAAG,UAAU,SAAST,CAAc,KACnCQ,IAAAC,EAAG,aAAa,YAAY,MAAM,WACpCH,EAAA,QAAQI,EAAMD,CAAE,CAAC,KACdA,aAAc,0BAA4B,KAAKC,EAAMD,CAAE,CAAC;AAGrE,QAAIF,EAAkB,YAAAI,KAASN,EAAc,CAAAM,EAAA,UAAUD,EAAMH,CAAK;AAClE,IAAAA,KAAA,QAAAA,EAAO,aAAa,oBAAoBD,EAAM,KAAK,GAAG,IACtDC,KAAA,QAAAA,EAAO,aAAa,gBAAgB,GAAG,CAACC,CAAK;AAAA,EAAE;AAEnD;AAGII,KAAoBC,EAAA,SAAS,IAAI;AAE9B,SAASA,EAASJ,GAAa;AAChC,MAAAR,EAAU,IAAIQ,CAAE,EAAG;AACjB,QAAAN,IAASM,EAAG,uBAAuBX,CAAS,GAC5CgB,IAAWC,EAAgC,MAAMb,EAAQC,CAAM,CAAC;AACtE,EAAAW,EAAS,QAAQL,GAAI;AAAA,IACnB,iBAAiB,CAAC,OAAO;AAAA,IACzB,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,SAAS;AAAA,EAAA,CACV,GAEDP,EAAQC,CAAM,GACJF,EAAA,IAAIQ,GAAIK,CAAQ;AAC5B;AAEO,SAASE,EAAWP,GAAa;;AAC5B,GAAAQ,IAAAhB,EAAA,IAAIQ,CAAE,MAAN,QAAAQ,EAAS;AACrB;"}
1
+ {"version":3,"file":"field.js","sources":["../../designsystem/field/field.ts"],"sourcesContent":["import styles from '../styles.module.css';\nimport { IS_BROWSER, QUICK_EVENT, isInputLike, off, on, onAdd, useId } from '../utils';\n\nconst CSS_FIELD = styles.field.split(' ')[0];\nconst CSS_VALIDATIONS = styles.validation.split(' ');\nconst CSS_VALIDATION = CSS_VALIDATIONS[0];\nconst BOUND = new WeakMap<Element | Document, ReturnType<typeof onAdd>>();\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) for (const label of labels) label.htmlFor = useId(input);\n if (input) renderCounter(input);\n\n input?.setAttribute('aria-describedby', descs.join(' '));\n input?.setAttribute('aria-invalid', `${!valid}`);\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\n if (prevInvalid !== nextInvalid) {\n el.setAttribute('aria-live', nextInvalid ? 'polite' : 'off');\n for (const css of CSS_VALIDATIONS) el.classList.toggle(css, nextInvalid);\n }\n el.textContent = `${Math.abs(remainder)} tegn ${nextInvalid ? 'for mye' : 'igjen'}`;\n }\n}\n\nif (IS_BROWSER) observe(document);\n\nexport function observe (el: Element | Document) {\n const fields = el.getElementsByClassName(CSS_FIELD);\n const add = onAdd(styles.fieldChildAdded, () => renderAria(fields));\n BOUND.set(el, add);\n add.observe(el);\n on(el, 'input', handleInput, QUICK_EVENT);\n}\n\nexport function unobserve (el: Element | Document) {\n BOUND.get(el)?.disconnect(el);\n off(el, 'input', handleInput, QUICK_EVENT);\n}\n"],"names":["CSS_FIELD","styles","CSS_VALIDATIONS","CSS_VALIDATION","BOUND","renderAria","fields","field","labels","descs","input","valid","el","isInputLike","useId","label","handleInput","target","renderCounter","limit","remainder","nextInvalid","css","IS_BROWSER","observe","add","onAdd","on","QUICK_EVENT","unobserve","_a","off"],"mappings":";;AAGA,MAAMA,IAAYC,EAAO,MAAM,MAAM,GAAG,EAAE,CAAC,GACrCC,IAAkBD,EAAO,WAAW,MAAM,GAAG,GAC7CE,IAAiBD,EAAgB,CAAC,GAClCE,wBAAY,QAAsD;AAExE,SAASC,EAAWC,GAAmC;AACrD,aAAUC,KAASD,GAAQ;AACzB,UAAME,IAA6B,CAAC,GAC9BC,IAAkB,CAAC;AACzB,QAAIC,IAAiC,MACjCC,IAAQ;AAEZ,eAAWC,K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,MAAMI,EAAWC,CAAM,CAAC;AAC5D,EAAAF,EAAA,IAAIQ,GAAIa,CAAG,GACjBA,EAAI,QAAQb,CAAE,GACXe,EAAAf,GAAI,SAASI,GAAaY,CAAW;AAC1C;AAEO,SAASC,EAAWjB,GAAwB;;AACjD,GAAAkB,IAAA1B,EAAM,IAAIQ,CAAE,MAAZ,QAAAkB,EAAe,WAAWlB,IACtBmB,EAAAnB,GAAI,SAASI,GAAaY,CAAW;AAC3C;"}
@@ -0,0 +1,11 @@
1
+ import { StoryObj } from '@storybook/react';
2
+ declare const meta: {
3
+ title: string;
4
+ };
5
+ export default meta;
6
+ type Story = StoryObj<typeof meta>;
7
+ export declare const Default: Story;
8
+ export declare const Toggles: Story;
9
+ export declare const ValidationMessage: Story;
10
+ export declare const Affixes: Story;
11
+ export declare const Count: Story;
@@ -0,0 +1,2 @@
1
+ export declare function observe(el: Element | Document): void;
2
+ export declare function unobserve(el: Element | Document): void;
@@ -0,0 +1,28 @@
1
+ import n from "../styles.module.css.js";
2
+ import { IS_BROWSER as a, onAdd as c, useId as f, isInputLike as r } from "../utils.js";
3
+ const l = n.fieldset.split(" ")[0], u = n.validation.split(" ")[0], d = /* @__PURE__ */ new WeakMap();
4
+ function p(t) {
5
+ for (const s of t) {
6
+ const i = [];
7
+ let o = "";
8
+ for (const e of s.getElementsByTagName("*"))
9
+ e.classList.contains(u) ? o = f(e) : r(e) && i.push(e);
10
+ if (o)
11
+ for (const e of i)
12
+ e.setAttribute("aria-describedby", o), e.setAttribute("aria-invalid", "true");
13
+ }
14
+ }
15
+ a && m(document);
16
+ function m(t) {
17
+ const s = t.getElementsByClassName(l), i = c(n.fieldsetValidationAdded, () => p(s));
18
+ d.set(t, i), i.observe(t);
19
+ }
20
+ function S(t) {
21
+ var s;
22
+ (s = d.get(t)) == null || s.disconnect(t);
23
+ }
24
+ export {
25
+ m as observe,
26
+ S as unobserve
27
+ };
28
+ //# sourceMappingURL=fieldset.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fieldset.js","sources":["../../designsystem/fieldset/fieldset.ts"],"sourcesContent":["import styles from '../styles.module.css';\nimport { IS_BROWSER, isInputLike, onAdd, useId } from '../utils';\nconst CSS_FIELDSET = styles.fieldset.split(' ')[0];\nconst CSS_VALIDATION = styles.validation.split(' ')[0];\nconst BOUND = new WeakMap<Element | Document, ReturnType<typeof onAdd>>();\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 input.setAttribute('aria-describedby', validationId);\n input.setAttribute('aria-invalid', 'true');\n }\n }\n}\n\nif (IS_BROWSER) observe(document);\n\nexport function observe (el: Element | Document) {\n const fields = el.getElementsByClassName(CSS_FIELDSET);\n const add = onAdd(styles.fieldsetValidationAdded, () => process(fields));\n BOUND.set(el, add);\n add.observe(el);\n}\n\nexport function unobserve (el: Element | Document) {\n BOUND.get(el)?.disconnect(el);\n}\n"],"names":["CSS_FIELDSET","styles","CSS_VALIDATION","BOUND","process","fieldsets","fieldset","inputs","validationId","el","useId","isInputLike","input","IS_BROWSER","observe","fields","add","onAdd","unobserve","_a"],"mappings":";;AAEA,MAAMA,IAAeC,EAAO,SAAS,MAAM,GAAG,EAAE,CAAC,GAC3CC,IAAiBD,EAAO,WAAW,MAAM,GAAG,EAAE,CAAC,GAC/CE,wBAAY,QAAsD;AAExE,SAASC,EAAQC,GAAsC;AACrD,aAAUC,KAAYD,GAAW;AAC/B,UAAME,IAA6B,CAAC;AACpC,QAAIC,IAAe;AAEnB,eAAWC,KAAMH,EAAS,qBAAqB,GAAG;AAChD,MAAIG,EAAG,UAAU,SAASP,CAAc,IAAGM,IAAeE,EAAMD,CAAE,IACzDE,EAAYF,CAAE,KAAGF,EAAO,KAAKE,CAAE;AAGtC,QAAAD;AACF,iBAAUI,KAASL;AACX,QAAAK,EAAA,aAAa,oBAAoBJ,CAAY,GAC7CI,EAAA,aAAa,gBAAgB,MAAM;AAAA,EAC3C;AAEN;AAEIC,OAAoB,QAAQ;AAEzB,SAASC,EAASL,GAAwB;AACzC,QAAAM,IAASN,EAAG,uBAAuBT,CAAY,GAC/CgB,IAAMC,EAAMhB,EAAO,yBAAyB,MAAMG,EAAQW,CAAM,CAAC;AACjE,EAAAZ,EAAA,IAAIM,GAAIO,CAAG,GACjBA,EAAI,QAAQP,CAAE;AAChB;AAEO,SAASS,EAAWT,GAAwB;;AACjD,GAAAU,IAAAhB,EAAM,IAAIM,CAAE,MAAZ,QAAAU,EAAe,WAAWV;AAC5B;"}
@@ -0,0 +1,12 @@
1
+ import { StoryObj } from '@storybook/react';
2
+ declare const meta: {
3
+ title: string;
4
+ };
5
+ export default meta;
6
+ type Story = StoryObj<typeof meta>;
7
+ export declare const Radios: Story;
8
+ export declare const Checkboxes: Story;
9
+ export declare const Disabled: Story;
10
+ export declare const ReadOnly: Story;
11
+ export declare const Horizontal: Story;
12
+ export declare const ValidationMessage: Story;
package/mtds/index.d.ts CHANGED
@@ -1,15 +1,33 @@
1
+ export { pagination } from './pagination/pagination';
1
2
  export declare const styles: {
2
3
  alert: string;
4
+ avatar: string;
3
5
  breadcrumbs: string;
4
6
  button: string;
7
+ card: string;
8
+ chip: string;
5
9
  details: string;
10
+ errorsummary: string;
6
11
  field: string;
12
+ fieldChildAdded: string;
13
+ affixes: string;
14
+ count: string;
7
15
  fieldset: string;
8
- autolayout: string;
16
+ fieldsetValidationAdded: string;
9
17
  input: string;
18
+ grid: string;
19
+ flex: string;
20
+ box: string;
10
21
  link: string;
11
22
  logo: string;
23
+ modal: string;
24
+ pagination: string;
12
25
  popover: string;
26
+ table: string;
27
+ scrollShadow: string;
28
+ tableChildAdded: string;
29
+ tabs: string;
30
+ tag: string;
13
31
  validation: string;
14
32
  body: string;
15
33
  };
@@ -1,4 +1,4 @@
1
- var mtds=function(a){"use strict";const q="_alert_1q289_1 _ds-alert_whhdm_1",L="_breadcrumbs_1q289_1 _ds-breadcrumbs_whhdm_1",M="_button_1q289_1 _ds-button_whhdm_1",R="_details_1q289_1 _ds-details_whhdm_1",C="_field_1q289_1 _ds-field_whhdm_1",F="_fieldset_1q289_1 _ds-fieldset_whhdm_1",I="_autolayout_1q289_1",T="_input_1q289_1 _ds-input_whhdm_1",P="_link_1q289_1",A="_logo_1q289_1 _ds-focus_whhdm_1",B="_popover_1q289_1",N="_validation_1q289_1",D="_body_1q289_50",h={alert:q,breadcrumbs:L,button:M,details:R,field:C,fieldset:F,autolayout:I,input:T,link:P,logo:A,popover:B,validation:N,body:D},Q=Object.freeze(Object.defineProperty({__proto__:null,alert:q,autolayout:I,body:D,breadcrumbs:L,button:M,default:h,details:R,field:C,fieldset:F,input:T,link:P,logo:A,popover:B,validation:N},Symbol.toStringTag,{value:"Module"})),H=typeof window<"u"&&typeof document<"u";let X=0;const Y=`${Date.now().toString(36)}${Math.random().toString(36).slice(2,5)}`;function b(t){return t.id||(t.id=`${Y}${++X}`),t.id}function Z(t){const e=[],n=new MutationObserver(o=>{e[0]||requestAnimationFrame(i),e.push(...o)}),i=()=>{t(e,n),e.length=0};return n}const j=(t,e,n)=>{for(const i of n[0].split(","))n[0]=i,Element.prototype[`${t}EventListener`].apply(e,n)},p=(t,...e)=>j("add",t,e),g=(t,...e)=>j("remove",t,e),tt=h.field.split(" ")[0],et=h.validation.split(" ")[0],v=new WeakMap;function k(t){for(const e of t){const n=[],i=[];let o=null,l=!0;for(const s of e.getElementsByTagName("*"))s instanceof HTMLLabelElement?n.push(s):"validity"in s&&!(s instanceof HTMLButtonElement)?o=s:s.classList.contains(et)?(l=s.getAttribute("data-color")==="success",i.unshift(b(s))):s instanceof HTMLParagraphElement&&i.push(b(s));if(o)for(const s of n)s.htmlFor=b(o);o==null||o.setAttribute("aria-describedby",i.join(" ")),o==null||o.setAttribute("aria-invalid",`${!l}`)}}H&&z(document.body);function z(t){if(v.has(t))return;const e=t.getElementsByClassName(tt),n=Z(()=>k(e));n.observe(t,{attributeFilter:["class"],attributes:!0,childList:!0,subtree:!0}),k(e),v.set(t,n)}function ot(t){var e;(e=v.get(t))==null||e.disconnect()}/*! NanoPop 2.4.2 MIT | https://github.com/Simonwep/nanopop */const nt={variantFlipOrder:{start:"sme",middle:"mse",end:"ems"},positionFlipOrder:{top:"tbrl",right:"rltb",bottom:"btrl",left:"lrbt"},position:"bottom",margin:8,padding:0},it=(t,e,n)=>{const{container:i,arrow:o,margin:l,padding:s,position:ft,variantFlipOrder:_t,positionFlipOrder:ht}={container:document.documentElement.getBoundingClientRect(),...nt,...n},{left:mt,top:bt}=e.style;e.style.left="0",e.style.top="0";const r=t.getBoundingClientRect(),d=e.getBoundingClientRect(),pt={t:r.top-d.height-l,b:r.bottom+l,r:r.right+l,l:r.left-d.width-l},gt={vs:r.left,vm:r.left+r.width/2-d.width/2,ve:r.left+r.width-d.width,hs:r.top,hm:r.bottom-r.height/2-d.height/2,he:r.bottom-d.height},[vt,yt="middle"]=ft.split("-"),wt=ht[vt],Ot=_t[yt],{top:x,left:J,bottom:U,right:G}=i;for(const u of wt){const c=u==="t"||u==="b";let f=pt[u];const[y,w]=c?["top","left"]:["left","top"],[O,S]=c?[d.height,d.width]:[d.width,d.height],[St,Et]=c?[U,G]:[G,U],[$t,qt]=c?[x,J]:[J,x];if(!(f<$t||f+O+s>St))for(const E of Ot){let _=gt[(c?"v":"h")+E];if(!(_<qt||_+S+s>Et)){if(_-=d[w],f-=d[y],e.style[w]=`${_}px`,e.style[y]=`${f}px`,o){const $=c?r.width/2:r.height/2,m=S/2,K=$>m,Lt={s:K?m:$,m,e:K?m:S-$},Mt={t:O,b:0,r:0,l:O},Rt=_+Lt[E],Ct=f+Mt[u];o.style[w]=`${Rt}px`,o.style[y]=`${Ct}px`}return u+E}}}return e.style.left=mt,e.style.top=bt,null},st=h.popover.split(" ")[0],rt={toJSON:()=>"",bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0},dt=/(top|right|bottom|left)-(start|middle|end)/;H&&W(document);function lt(t,e){const n=e.getAttribute("data-position")||"bottom-start";if(!dt.test(n))return console.error(`Found invalid data-position="${n}"
1
+ var mtds=function(_){"use strict";const M="_alert_d52qk_1 _ds-alert_whhdm_1",T="_avatar_d52qk_1 _ds-avatar_whhdm_1",L="_breadcrumbs_d52qk_1 _ds-breadcrumbs_whhdm_1",N="_button_d52qk_1 _ds-button_whhdm_1",x="_card_d52qk_1 _ds-card_whhdm_1",B="_chip_d52qk_1 _ds-chip_whhdm_1",D="_details_d52qk_1 _ds-details_whhdm_1",F="_errorsummary_d52qk_1 _ds-error-summary_whhdm_1",R="_field_d52qk_1 _ds-field_whhdm_1",P="_fieldChildAdded_d52qk_1",V="_affixes_d52qk_1 _ds-field-affixes_whhdm_1",H="_count_d52qk_1",j="_fieldset_d52qk_1 _ds-fieldset_whhdm_1",U="_fieldsetValidationAdded_d52qk_1",W="_input_d52qk_1 _ds-input_whhdm_1",z="_grid_d52qk_1",J="_flex_d52qk_1",K="_box_d52qk_1",G="_link_d52qk_1",Q="_logo_d52qk_1 _ds-focus_whhdm_1",X="_modal_d52qk_1 _ds-modal_whhdm_1",Y="_pagination_d52qk_1 _ds-pagination_whhdm_1",Z="_popover_d52qk_1",tt="_table_d52qk_1 _ds-table_whhdm_1",et="_scrollShadow_d52qk_1",ot="_tableChildAdded_d52qk_1",nt="_tabs_d52qk_1",it="_tag_d52qk_1 _ds-tag_whhdm_1",st="_validation_d52qk_1 _ds-validation-message_whhdm_1",dt="_body_d52qk_65",r={alert:M,avatar:T,breadcrumbs:L,button:N,card:x,chip:B,details:D,errorsummary:F,field:R,fieldChildAdded:P,affixes:V,count:H,fieldset:j,fieldsetValidationAdded:U,input:W,grid:z,flex:J,box:K,link:G,logo:Q,modal:X,pagination:Y,popover:Z,table:tt,scrollShadow:et,tableChildAdded:ot,tabs:nt,tag:it,validation:st,body:dt},St=Object.freeze(Object.defineProperty({__proto__:null,affixes:V,alert:M,avatar:T,body:dt,box:K,breadcrumbs:L,button:N,card:x,chip:B,count:H,default:r,details:D,errorsummary:F,field:R,fieldChildAdded:P,fieldset:j,fieldsetValidationAdded:U,flex:J,grid:z,input:W,link:G,logo:Q,modal:X,pagination:Y,popover:Z,scrollShadow:et,table:tt,tableChildAdded:ot,tabs:nt,tag:it,validation:st},Symbol.toStringTag,{value:"Module"})),v=typeof window<"u"&&typeof document<"u",l={capture:!0,passive:!0};let qt=0;const $t=`${Date.now().toString(36)}${Math.random().toString(36).slice(2,5)}`;function y(t){return t.id||(t.id=`${$t}${++qt}`),t.id}const at=(t,e,n)=>{for(const i of n[0].split(","))n[0]=i,Element.prototype[`${t}EventListener`].apply(e,n)},f=(t,...e)=>at("add",t,e),m=(t,...e)=>at("remove",t,e),k=(t,e)=>{let n=0;const i=o=>{o.animationName===t&&(cancelAnimationFrame(n),n=requestAnimationFrame(e))};return{observe:o=>f(o,"animationend",i,l),disconnect:o=>m(o,"animationstart",i,l)}},A=t=>t instanceof HTMLElement&&"validity"in t&&!(t instanceof HTMLButtonElement),Ct=r.field.split(" ")[0],lt=r.validation.split(" "),Et=lt[0],ct=new WeakMap;function It(t){for(const e of t){const n=[],i=[];let o=null,d=!0;for(const s of e.getElementsByTagName("*"))s instanceof HTMLLabelElement?n.push(s):A(s)?o=s:s.classList.contains(Et)?(d=s.getAttribute("data-color")==="success",i.unshift(y(s))):s instanceof HTMLParagraphElement&&i.push(y(s));if(o)for(const s of n)s.htmlFor=y(o);o&&_t(o),o==null||o.setAttribute("aria-describedby",i.join(" ")),o==null||o.setAttribute("aria-invalid",`${!d}`)}}function rt({target:t}){A(t)&&_t(t)}function _t(t){const e=t==null?void 0:t.nextElementSibling,n=e==null?void 0:e.getAttribute("data-count");if(e&&n){const i=Number(n)-t.value.length,o=i<0;if(e.getAttribute("aria-live")==="polite"!==o){e.setAttribute("aria-live",o?"polite":"off");for(const s of lt)e.classList.toggle(s,o)}e.textContent=`${Math.abs(i)} tegn ${o?"for mye":"igjen"}`}}v&&ft(document);function ft(t){const e=t.getElementsByClassName(Ct),n=k(r.fieldChildAdded,()=>It(e));ct.set(t,n),n.observe(t),f(t,"input",rt,l)}function Ot(t){var e;(e=ct.get(t))==null||e.disconnect(t),m(t,"input",rt,l)}const Mt=r.fieldset.split(" ")[0],Tt=r.validation.split(" ")[0],mt=new WeakMap;function Lt(t){for(const e of t){const n=[];let i="";for(const o of e.getElementsByTagName("*"))o.classList.contains(Tt)?i=y(o):A(o)&&n.push(o);if(i)for(const o of n)o.setAttribute("aria-describedby",i),o.setAttribute("aria-invalid","true")}}v&&ht(document);function ht(t){const e=t.getElementsByClassName(Mt),n=k(r.fieldsetValidationAdded,()=>Lt(e));mt.set(t,n),n.observe(t)}function Nt(t){var e;(e=mt.get(t))==null||e.disconnect(t)}/*! NanoPop 2.4.2 MIT | https://github.com/Simonwep/nanopop */const xt={variantFlipOrder:{start:"sme",middle:"mse",end:"ems"},positionFlipOrder:{top:"tbrl",right:"rltb",bottom:"btrl",left:"lrbt"},position:"bottom",margin:8,padding:0},Bt=(t,e,n)=>{const{container:i,arrow:o,margin:d,padding:s,position:u,variantFlipOrder:S,positionFlipOrder:Gt}={container:document.documentElement.getBoundingClientRect(),...xt,...n},{left:Qt,top:Xt}=e.style;e.style.left="0",e.style.top="0";const a=t.getBoundingClientRect(),c=e.getBoundingClientRect(),Yt={t:a.top-c.height-d,b:a.bottom+d,r:a.right+d,l:a.left-c.width-d},Zt={vs:a.left,vm:a.left+a.width/2-c.width/2,ve:a.left+a.width-c.width,hs:a.top,hm:a.bottom-a.height/2-c.height/2,he:a.bottom-c.height},[te,ee="middle"]=u.split("-"),oe=Gt[te],ne=S[ee],{top:vt,left:yt,bottom:wt,right:kt}=i;for(const b of oe){const h=b==="t"||b==="b";let g=Yt[b];const[q,$]=h?["top","left"]:["left","top"],[C,E]=h?[c.height,c.width]:[c.width,c.height],[ie,se]=h?[wt,kt]:[kt,wt],[de,ae]=h?[vt,yt]:[yt,vt];if(!(g<de||g+C+s>ie))for(const I of ne){let p=Zt[(h?"v":"h")+I];if(!(p<ae||p+E+s>se)){if(p-=c[$],g-=c[q],e.style[$]=`${p}px`,e.style[q]=`${g}px`,o){const O=h?a.width/2:a.height/2,w=E/2,At=O>w,le={s:At?w:O,m:w,e:At?w:E-O},ce={t:C,b:0,r:0,l:C},re=p+le[I],_e=g+ce[b];o.style[$]=`${re}px`,o.style[q]=`${_e}px`}return b+I}}}return e.style.left=Qt,e.style.top=Xt,null},Dt=r.popover.split(" ")[0],Ft={toJSON:()=>"",bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0},Rt=/(top|right|bottom|left)-(start|middle|end)/;v&&bt(document);function Pt(t,e){const n=e.getAttribute("data-position")||"bottom-start";if(!Rt.test(n))return console.error(`Found invalid data-position="${n}"
2
2
  - It must be [top|right|bottom|left]-[start|middle|end]
3
- - Found on element:`,e);const i=()=>it(t,e,{container:{...rt,bottom:window.innerHeight,right:window.innerWidth},margin:4,padding:16,position:n}),o=({newState:l})=>{l!=="open"&&(g(document,"DOMContentReady",i),g(e,"toggle",o),g(window,"load,resize,scroll",i,!0))};document.fonts.ready.then(i),p(document,"DOMContentReady",i),p(e,"toggle",o),p(window,"load,resize,scroll",i,!0)}function V({target:t,newState:e}){var o;const i=e==="open"&&t instanceof HTMLElement&&t.classList.contains(st)&&((o=t.getRootNode())==null?void 0:o.querySelector(`[popovertarget="${t.id}"]`));i&&lt(i,t)}function W(t){t.addEventListener("toggle",V,!0)}function ct(t){t.removeEventListener("toggle",V,!0)}function at(t){z(t),W(t)}function ut(t){ot(t),ct(t)}return a.observe=at,a.styles=Q,a.unobserve=ut,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),a}({});
3
+ - Found on element:`,e);const i=()=>Bt(t,e,{container:{...Ft,bottom:window.innerHeight,right:window.innerWidth},margin:4,padding:16,position:n}),o=({newState:d})=>{d!=="open"&&(m(document,"DOMContentReady",i,l),m(e,"toggle",o,l),m(window,"load,resize,scroll",i,l))};document.fonts.ready.then(i),f(document,"DOMContentReady",i,l),f(e,"toggle",o,l),f(window,"load,resize,scroll",i,l)}function ut({target:t,newState:e}){var o;const i=e==="open"&&t instanceof HTMLElement&&t.classList.contains(Dt)&&((o=t.getRootNode())==null?void 0:o.querySelector(`[popovertarget="${t.id}"]`));i&&Pt(i,t)}function bt(t){f(t,"toggle",ut,l)}function Vt(t){m(t,"toggle",ut,l)}const Ht=r.table.split(" ")[0],gt=new WeakMap;function jt(t){var e,n;for(const i of t)if(i instanceof HTMLTableElement){const o=Array.from(((n=(e=i.tHead)==null?void 0:e.rows[0])==null?void 0:n.cells)||[],d=>{var s;return(s=d.innerText)==null?void 0:s.trim()});for(const d of i.tBodies)for(const s of d.rows)for(const u of s.cells)u.setAttribute("data-th",o[u.cellIndex]||"")}}v&&pt(document);function pt(t){const e=t.getElementsByClassName(Ht),n=k(r.tableChildAdded,()=>jt(e));gt.set(t,n),n.observe(t)}function Ut(t){var e;(e=gt.get(t))==null||e.disconnect(t)}const Wt=(t,e,n)=>{const i=(n-1)/2,o=Math.min(Math.max(t-Math.floor(i),1),e-n+1),d=Math.min(Math.max(t+Math.ceil(i),n),e),s=Array.from({length:d+1-o},(u,S)=>S+o);return n>4&&o>1&&s.splice(0,2,1,0),n>3&&d<e&&s.splice(-2,2,0,e),s},zt=({current:t=1,total:e=10,show:n=7})=>({prev:t>1?t-1:0,next:t<e?t+1:0,pages:Wt(t,e,n).map((i,o)=>({current:i===t&&"page",key:`key-${i}-${o}`,page:i}))});function Jt(t){ft(t),ht(t),bt(t),pt(t)}function Kt(t){Ot(t),Nt(t),Vt(t),Ut(t)}return _.observe=Jt,_.pagination=zt,_.styles=St,_.unobserve=Kt,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"}),_}({});
4
4
  //# sourceMappingURL=index.iife.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.iife.js","sources":["../designsystem/utils.ts","../designsystem/field/field.ts","../node_modules/nanopop/dist/nanopop.mjs","../designsystem/popover/popover.ts","../designsystem/index.ts"],"sourcesContent":["export const IS_BROWSER = typeof window !== 'undefined' && typeof document !== 'undefined';\n\n/**\n * useId\n * @return A generated unique ID\n */\nlet id = 0;\nconst UUID = `${Date.now().toString(36)}${Math.random().toString(36).slice(2, 5)}`;\nexport function useId (el: Element) {\n if (!el.id) el.id = `${UUID}${++id}`;\n\treturn el.id;\n};\n\n/**\n * Speed up MutationObserver by debouncing and only running when page is visible\n * @return new MutaionObserver\n */\nexport function createOptimizedMutationObserver(callback: MutationCallback) {\n const queue: MutationRecord[] = [];\n const observer = new MutationObserver((mutations) => {\n if (!queue[0]) requestAnimationFrame(process);\n queue.push(...mutations);\n });\n\n const process = () => {\n callback(queue, observer);\n queue.length = 0; // Reset queue\n };\n\n return observer;\n}\n\n// Internal helper for on / off\nconst events = (\n\taction: \"add\" | \"remove\",\n\telement: Node | Window,\n\trest: Parameters<typeof Element.prototype.addEventListener>,\n): void => {\n\tfor (const type of rest[0].split(\",\")) {\n\t\trest[0] = type;\n\t\tElement.prototype[`${action}EventListener`].apply(element, rest);\n\t}\n};\n\n/**\n * on\n * @param element The Element to use as EventTarget\n * @param types A comma separated string of event types\n * @param listener An event listener function or listener object\n */\nexport const on = (\n\telement: Node | Window,\n\t...rest: Parameters<typeof Element.prototype.addEventListener>\n): void => events(\"add\", element, rest);\n\n/**\n * off\n * @param element The Element to use as EventTarget\n * @param types A comma separated string of event types\n * @param listener An event listener function or listener object\n */\nexport const off = (\n\telement: Node | Window,\n\t...rest: Parameters<typeof Element.prototype.removeEventListener>\n): void => events(\"remove\", element, rest);\n\n","import styles from '../styles.module.css';\nimport { IS_BROWSER, createOptimizedMutationObserver, useId } from '../utils';\n\nconst CSS_FIELD = styles.field.split(' ')[0];\nconst CSS_VALIDATION = styles.validation.split(' ')[0];\nconst OBSERVERS = new WeakMap();\n\n\nfunction process(fields: HTMLCollectionOf<Element>) {\n for(const field of fields) {\n const labels: HTMLLabelElement[] = [];\n const descs: string[] = [];\n let input: Element | 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 ('validity' in el && !(el instanceof HTMLButtonElement)) input = el;\n else if (el.classList.contains(CSS_VALIDATION)) { // Must be before validation since it 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) for (const label of labels) label.htmlFor = useId(input);\n input?.setAttribute('aria-describedby', descs.join(' '));\n input?.setAttribute('aria-invalid', `${!valid}`);\n }\n}\n\n// Automatically observe <body> if in browser\nif (IS_BROWSER) observe(document.body);\n\nexport function observe (el: Element) {\n if (OBSERVERS.has(el)) return;\n const fields = el.getElementsByClassName(CSS_FIELD); // Reutrns a live HTMLCollection\n const observer = createOptimizedMutationObserver(() => process(fields));\n observer.observe(el, {\n attributeFilter: ['class'],\n attributes: true,\n childList: true,\n subtree: true\n });\n\n process(fields); // Initial run\n OBSERVERS.set(el, observer);\n}\n\nexport function unobserve (el: Element) {\n OBSERVERS.get(el)?.disconnect();\n}\n","/*! NanoPop 2.4.2 MIT | https://github.com/Simonwep/nanopop */\nconst N = \"2.4.2\", I = {\n variantFlipOrder: { start: \"sme\", middle: \"mse\", end: \"ems\" },\n positionFlipOrder: { top: \"tbrl\", right: \"rltb\", bottom: \"btrl\", left: \"lrbt\" },\n position: \"bottom\",\n margin: 8,\n padding: 0\n}, J = (n, i, m) => {\n const {\n container: r,\n arrow: a,\n margin: e,\n padding: l,\n position: V,\n variantFlipOrder: C,\n positionFlipOrder: M\n } = {\n container: document.documentElement.getBoundingClientRect(),\n ...I,\n ...m\n }, { left: F, top: K } = i.style;\n i.style.left = \"0\", i.style.top = \"0\";\n const t = n.getBoundingClientRect(), o = i.getBoundingClientRect(), P = {\n t: t.top - o.height - e,\n b: t.bottom + e,\n r: t.right + e,\n l: t.left - o.width - e\n }, R = {\n vs: t.left,\n vm: t.left + t.width / 2 - o.width / 2,\n ve: t.left + t.width - o.width,\n hs: t.top,\n hm: t.bottom - t.height / 2 - o.height / 2,\n he: t.bottom - o.height\n }, [$, E = \"middle\"] = V.split(\"-\"), L = M[$], j = C[E], { top: y, left: x, bottom: B, right: O } = r;\n for (const c of L) {\n const s = c === \"t\" || c === \"b\";\n let p = P[c];\n const [d, g] = s ? [\"top\", \"left\"] : [\"left\", \"top\"], [u, v] = s ? [o.height, o.width] : [o.width, o.height], [z, T] = s ? [B, O] : [O, B], [H, k] = s ? [y, x] : [x, y];\n if (!(p < H || p + u + l > z))\n for (const b of j) {\n let f = R[(s ? \"v\" : \"h\") + b];\n if (!(f < k || f + v + l > T)) {\n if (f -= o[g], p -= o[d], i.style[g] = `${f}px`, i.style[d] = `${p}px`, a) {\n const w = s ? t.width / 2 : t.height / 2, h = v / 2, S = w > h, q = {\n s: S ? h : w,\n m: h,\n e: S ? h : v - w\n }, A = {\n t: u,\n b: 0,\n r: 0,\n l: u\n }, D = f + q[b], G = p + A[c];\n a.style[g] = `${D}px`, a.style[d] = `${G}px`;\n }\n return c + b;\n }\n }\n }\n return i.style.left = F, i.style.top = K, null;\n}, Q = (n, i, m) => {\n const r = typeof n == \"object\" && !(n instanceof HTMLElement) ? n : { reference: n, popper: i, ...m };\n return {\n /**\n * Repositions the current popper.\n * @param options Optional options which get merged with the current ones.\n */\n update(a = r) {\n const { reference: e, popper: l } = Object.assign(r, a);\n if (!l || !e)\n throw new Error(\"Popper- or reference-element missing.\");\n return J(e, l, r);\n }\n };\n};\nexport {\n Q as createPopper,\n I as defaults,\n J as reposition,\n N as version\n};\n//# sourceMappingURL=nanopop.mjs.map\n","import { type NanoPopPosition, reposition } from 'nanopop';\nimport styles from '../styles.module.css';\nimport { IS_BROWSER, off, on } from '../utils';\n\nconst CSS_POPOVER = styles.popover.split(' ')[0];\nconst CONTAINER = { toJSON: () => '', bottom: 0, height: 0, left: 0, right: 0, top: 0, width: 0, x: 0, y: 0 };\nconst POSITIONS = /(top|right|bottom|left)-(start|middle|end)/;\ntype Toggle = Event & { newState?: string };\n\nif (IS_BROWSER) observe(document);\n\n// Not exposed as a hook, as it is nice to allow consuming components to use it as a callback\nexport function anchorPosition(anchor: HTMLElement, popover: HTMLElement) {\n const position = (popover.getAttribute('data-position') || 'bottom-start') as NanoPopPosition;\n if (!POSITIONS.test(position)) return console.error(`Found invalid data-position=\"${position}\"\\n- It must be [top|right|bottom|left]-[start|middle|end]\\n- Found on element:`, popover);\n\n const update = () =>\n reposition(anchor, popover, {\n container: { ...CONTAINER, bottom: window.innerHeight, right: window.innerWidth },\n margin: 4, // Margin between the popper element and the reference\n padding: 16, // Minimum space between the popper and the container\n position // [top|right|bottom|left]-[start|middle|end]\n });\n\n const removeEvent = ({ newState }: Toggle) => {\n if (newState === 'open') return;\n off(document, 'DOMContentReady', update);\n off(popover, 'toggle', removeEvent);\n off(window, 'load,resize,scroll', update, true);\n }\n \n\n document.fonts.ready.then(update); // Inital render and when fonts load\n on(document, 'DOMContentReady', update);\n on(popover, 'toggle', removeEvent);\n on(window, 'load,resize,scroll', update, true); // Use capture to also listen for elements with overflow\n}\n\nfunction process ({ target: el, newState }: Toggle){\n const isPopping = newState === 'open' && el instanceof HTMLElement && el.classList.contains(CSS_POPOVER);\n const anchor = isPopping && (el.getRootNode() as ShadowRoot)?.querySelector<HTMLElement>(`[popovertarget=\"${el.id}\"]`);\n\n if (anchor) anchorPosition(anchor, el);\n}\n\nexport function observe(el: Node) {\n el.addEventListener('toggle', process, true); // Use capture since toggle does not bubble\n}\nexport function unobserve(el: Node) {\n el.removeEventListener('toggle', process, true); // Use capture since toggle does not bubble\n}","import * as field from './field/field';\nimport * as popover from './popover/popover';\nexport * as styles from './styles.module.css';\n\nexport function observe(el: Element) {\n field.observe(el);\n popover.observe(el);\n}\n\nexport function unobserve(el: Element) {\n field.unobserve(el);\n popover.unobserve(el);\n}"],"names":["IS_BROWSER","id","UUID","useId","el","createOptimizedMutationObserver","callback","queue","observer","mutations","process","events","action","element","rest","type","on","off","CSS_FIELD","styles","CSS_VALIDATION","OBSERVERS","fields","field","labels","descs","input","valid","label","observe","unobserve","_a","I","J","n","i","m","r","a","e","l","V","C","M","F","K","t","o","P","R","$","E","L","j","y","x","B","O","c","s","p","d","g","u","v","z","T","H","k","b","f","w","h","S","q","A","D","G","CSS_POPOVER","CONTAINER","POSITIONS","anchorPosition","anchor","popover","position","update","reposition","removeEvent","newState","field.observe","popover.observe","field.unobserve","popover.unobserve"],"mappings":"szBAAaA,EAAa,OAAO,OAAW,KAAe,OAAO,SAAa,IAM/E,IAAIC,EAAK,EACT,MAAMC,EAAO,GAAG,KAAK,IAAM,EAAA,SAAS,EAAE,CAAC,GAAG,KAAK,SAAS,SAAS,EAAE,EAAE,MAAM,EAAG,CAAC,CAAC,GACzE,SAASC,EAAOC,EAAa,CAC9B,OAACA,EAAG,KAAIA,EAAG,GAAK,GAAGF,CAAI,GAAG,EAAED,CAAE,IAC5BG,EAAG,EACX,CAMO,SAASC,EAAgCC,EAA4B,CAC1E,MAAMC,EAA0B,CAAC,EAC3BC,EAAW,IAAI,iBAAkBC,GAAc,CAC9CF,EAAM,CAAC,yBAAyBG,CAAO,EACtCH,EAAA,KAAK,GAAGE,CAAS,CAAA,CACxB,EAEKC,EAAU,IAAM,CACpBJ,EAASC,EAAOC,CAAQ,EACxBD,EAAM,OAAS,CACjB,EAEO,OAAAC,CACT,CAGA,MAAMG,EAAS,CACdC,EACAC,EACAC,IACU,CACV,UAAWC,KAAQD,EAAK,CAAC,EAAE,MAAM,GAAG,EACnCA,EAAK,CAAC,EAAIC,EACV,QAAQ,UAAU,GAAGH,CAAM,eAAe,EAAE,MAAMC,EAASC,CAAI,CAEjE,EAQaE,EAAK,CACjBH,KACGC,IACOH,EAAO,MAAOE,EAASC,CAAI,EAQzBG,EAAM,CAClBJ,KACGC,IACOH,EAAO,SAAUE,EAASC,CAAI,EC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Q9E,CAAE,CACvC,CAEO,SAASyB,EAAQzB,EAAU,CAC7BA,EAAA,iBAAiB,SAAUM,EAAS,EAAI,CAC7C,CACO,SAASoB,GAAU1B,EAAU,CAC/BA,EAAA,oBAAoB,SAAUM,EAAS,EAAI,CAChD,CC9CO,SAASmB,GAAQzB,EAAa,CACnCqF,EAAcrF,CAAE,EAChBsF,EAAgBtF,CAAE,CACpB,CAEO,SAAS0B,GAAU1B,EAAa,CACrCuF,GAAgBvF,CAAE,EAClBwF,GAAkBxF,CAAE,CACtB","x_google_ignoreList":[2]}
1
+ {"version":3,"file":"index.iife.js","sources":["../designsystem/utils.ts","../designsystem/field/field.ts","../designsystem/fieldset/fieldset.ts","../node_modules/nanopop/dist/nanopop.mjs","../designsystem/popover/popover.ts","../designsystem/table/table.ts","../designsystem/pagination/pagination.ts","../designsystem/index.ts"],"sourcesContent":["export const IS_BROWSER = typeof window !== 'undefined' && typeof document !== 'undefined';\nexport const QUICK_EVENT = { capture: true, passive: true };\n\n/**\n * useId\n * @return A generated unique ID\n */\nlet id = 0;\nconst UUID = `${Date.now().toString(36)}${Math.random().toString(36).slice(2, 5)}`;\nexport function useId (el: Element) {\n if (!el.id) el.id = `${UUID}${++id}`;\n\treturn el.id;\n};\n\n/**\n * Speed up MutationObserver by debouncing and only running when page is visible\n * @return new MutaionObserver\n */\nexport function createOptimizedMutationObserver(callback: MutationCallback) {\n const queue: MutationRecord[] = [];\n const observer = new MutationObserver((mutations) => {\n if (!queue[0]) requestAnimationFrame(process);\n queue.push(...mutations);\n });\n\n const process = () => {\n callback(queue, observer);\n queue.length = 0; // Reset queue\n };\n\n return observer;\n}\n\n// Internal helper for on / off\nconst events = (\n\taction: \"add\" | \"remove\",\n\telement: Node | Window,\n\trest: Parameters<typeof Element.prototype.addEventListener>,\n): void => {\n\tfor (const type of rest[0].split(\",\")) {\n\t\trest[0] = type;\n\t\tElement.prototype[`${action}EventListener`].apply(element, rest);\n\t}\n};\n\n/**\n * on\n * @param element The Element to use as EventTarget\n * @param types A comma separated string of event types\n * @param listener An event listener function or listener object\n */\nexport const on = (\n\telement: Node | Window,\n\t...rest: Parameters<typeof Element.prototype.addEventListener>\n): void => events(\"add\", element, rest);\n\n/**\n * off\n * @param element The Element to use as EventTarget\n * @param types A comma separated string of event types\n * @param listener An event listener function or listener object\n */\nexport const off = (\n\telement: Node | Window,\n\t...rest: Parameters<typeof Element.prototype.removeEventListener>\n): void => events(\"remove\", element, rest);\n\n/**\n * Child added event inspired by:\n * https://davidwalsh.name/detect-node-insertion\n */\nexport const onAdd = (animationName: string, callback: () => void) => {\n let timer: ReturnType<typeof requestAnimationFrame> | number = 0;\n const onAnimation = (event: Event & { animationName?: string }) => {\n if (event.animationName === animationName) {\n cancelAnimationFrame(timer);\n timer = requestAnimationFrame(callback);\n }\n };\n\n\treturn {\n\t\tobserve: (el: Element | Document, ) => on(el, 'animationend', onAnimation, QUICK_EVENT),\n\t\tdisconnect: (el: Element | Document, ) => off(el, 'animationstart', onAnimation, QUICK_EVENT)\n\t};\n}\n\nexport const isInputLike = (el: unknown): el is HTMLInputElement =>\n\tel instanceof HTMLElement && 'validity' in el && !(el instanceof HTMLButtonElement);\n\n// Make React support popover=\"\"target attribute\n// https://github.com/facebook/react/issues/27479\ndeclare global {\n\tnamespace React.JSX {\n\t\tinterface IntrinsicAttributes {\n\t\t\tpopovertargetaction?: string;\n\t\t\tpopovertarget?: string;\n\t\t\tpopover?: string | boolean;\n\t\t}\n\t}\n\tnamespace React {\n\t\tinterface HTMLAttributes<T> {\n\t\t\tpopovertargetaction?: string;\n\t\t\tpopovertarget?: string;\n\t\t\tpopover?: string | boolean;\n\t\t}\n\t}\n}","import styles from '../styles.module.css';\nimport { IS_BROWSER, QUICK_EVENT, isInputLike, off, on, onAdd, useId } from '../utils';\n\nconst CSS_FIELD = styles.field.split(' ')[0];\nconst CSS_VALIDATIONS = styles.validation.split(' ');\nconst CSS_VALIDATION = CSS_VALIDATIONS[0];\nconst BOUND = new WeakMap<Element | Document, ReturnType<typeof onAdd>>();\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) for (const label of labels) label.htmlFor = useId(input);\n if (input) renderCounter(input);\n\n input?.setAttribute('aria-describedby', descs.join(' '));\n input?.setAttribute('aria-invalid', `${!valid}`);\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\n if (prevInvalid !== nextInvalid) {\n el.setAttribute('aria-live', nextInvalid ? 'polite' : 'off');\n for (const css of CSS_VALIDATIONS) el.classList.toggle(css, nextInvalid);\n }\n el.textContent = `${Math.abs(remainder)} tegn ${nextInvalid ? 'for mye' : 'igjen'}`;\n }\n}\n\nif (IS_BROWSER) observe(document);\n\nexport function observe (el: Element | Document) {\n const fields = el.getElementsByClassName(CSS_FIELD);\n const add = onAdd(styles.fieldChildAdded, () => renderAria(fields));\n BOUND.set(el, add);\n add.observe(el);\n on(el, 'input', handleInput, QUICK_EVENT);\n}\n\nexport function unobserve (el: Element | Document) {\n BOUND.get(el)?.disconnect(el);\n off(el, 'input', handleInput, QUICK_EVENT);\n}\n","import styles from '../styles.module.css';\nimport { IS_BROWSER, isInputLike, onAdd, useId } from '../utils';\nconst CSS_FIELDSET = styles.fieldset.split(' ')[0];\nconst CSS_VALIDATION = styles.validation.split(' ')[0];\nconst BOUND = new WeakMap<Element | Document, ReturnType<typeof onAdd>>();\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 input.setAttribute('aria-describedby', validationId);\n input.setAttribute('aria-invalid', 'true');\n }\n }\n}\n\nif (IS_BROWSER) observe(document);\n\nexport function observe (el: Element | Document) {\n const fields = el.getElementsByClassName(CSS_FIELDSET);\n const add = onAdd(styles.fieldsetValidationAdded, () => process(fields));\n BOUND.set(el, add);\n add.observe(el);\n}\n\nexport function unobserve (el: Element | Document) {\n BOUND.get(el)?.disconnect(el);\n}\n","/*! NanoPop 2.4.2 MIT | https://github.com/Simonwep/nanopop */\nconst N = \"2.4.2\", I = {\n variantFlipOrder: { start: \"sme\", middle: \"mse\", end: \"ems\" },\n positionFlipOrder: { top: \"tbrl\", right: \"rltb\", bottom: \"btrl\", left: \"lrbt\" },\n position: \"bottom\",\n margin: 8,\n padding: 0\n}, J = (n, i, m) => {\n const {\n container: r,\n arrow: a,\n margin: e,\n padding: l,\n position: V,\n variantFlipOrder: C,\n positionFlipOrder: M\n } = {\n container: document.documentElement.getBoundingClientRect(),\n ...I,\n ...m\n }, { left: F, top: K } = i.style;\n i.style.left = \"0\", i.style.top = \"0\";\n const t = n.getBoundingClientRect(), o = i.getBoundingClientRect(), P = {\n t: t.top - o.height - e,\n b: t.bottom + e,\n r: t.right + e,\n l: t.left - o.width - e\n }, R = {\n vs: t.left,\n vm: t.left + t.width / 2 - o.width / 2,\n ve: t.left + t.width - o.width,\n hs: t.top,\n hm: t.bottom - t.height / 2 - o.height / 2,\n he: t.bottom - o.height\n }, [$, E = \"middle\"] = V.split(\"-\"), L = M[$], j = C[E], { top: y, left: x, bottom: B, right: O } = r;\n for (const c of L) {\n const s = c === \"t\" || c === \"b\";\n let p = P[c];\n const [d, g] = s ? [\"top\", \"left\"] : [\"left\", \"top\"], [u, v] = s ? [o.height, o.width] : [o.width, o.height], [z, T] = s ? [B, O] : [O, B], [H, k] = s ? [y, x] : [x, y];\n if (!(p < H || p + u + l > z))\n for (const b of j) {\n let f = R[(s ? \"v\" : \"h\") + b];\n if (!(f < k || f + v + l > T)) {\n if (f -= o[g], p -= o[d], i.style[g] = `${f}px`, i.style[d] = `${p}px`, a) {\n const w = s ? t.width / 2 : t.height / 2, h = v / 2, S = w > h, q = {\n s: S ? h : w,\n m: h,\n e: S ? h : v - w\n }, A = {\n t: u,\n b: 0,\n r: 0,\n l: u\n }, D = f + q[b], G = p + A[c];\n a.style[g] = `${D}px`, a.style[d] = `${G}px`;\n }\n return c + b;\n }\n }\n }\n return i.style.left = F, i.style.top = K, null;\n}, Q = (n, i, m) => {\n const r = typeof n == \"object\" && !(n instanceof HTMLElement) ? n : { reference: n, popper: i, ...m };\n return {\n /**\n * Repositions the current popper.\n * @param options Optional options which get merged with the current ones.\n */\n update(a = r) {\n const { reference: e, popper: l } = Object.assign(r, a);\n if (!l || !e)\n throw new Error(\"Popper- or reference-element missing.\");\n return J(e, l, r);\n }\n };\n};\nexport {\n Q as createPopper,\n I as defaults,\n J as reposition,\n N as version\n};\n//# sourceMappingURL=nanopop.mjs.map\n","import { type NanoPopPosition, reposition } from 'nanopop';\nimport styles from '../styles.module.css';\nimport { IS_BROWSER, QUICK_EVENT, off, on } from '../utils';\n\nconst CSS_POPOVER = styles.popover.split(' ')[0];\nconst CONTAINER = { toJSON: () => '', bottom: 0, height: 0, left: 0, right: 0, top: 0, width: 0, x: 0, y: 0 };\nconst POSITIONS = /(top|right|bottom|left)-(start|middle|end)/;\ntype Toggle = Event & { newState?: string };\n\nif (IS_BROWSER) observe(document);\n\n// Not exposed as a hook, as it is nice to allow consuming components to use it as a callback\nexport function anchorPosition(anchor: HTMLElement, popover: HTMLElement) {\n const position = (popover.getAttribute('data-position') || 'bottom-start') as NanoPopPosition;\n if (!POSITIONS.test(position)) return console.error(`Found invalid data-position=\"${position}\"\\n- It must be [top|right|bottom|left]-[start|middle|end]\\n- Found on element:`, popover);\n\n const update = () =>\n reposition(anchor, popover, {\n container: { ...CONTAINER, bottom: window.innerHeight, right: window.innerWidth },\n margin: 4, // Margin between the popper element and the reference\n padding: 16, // Minimum space between the popper and the container\n position // [top|right|bottom|left]-[start|middle|end]\n });\n\n const removeEvent = ({ newState }: Toggle) => {\n if (newState === 'open') return;\n off(document, 'DOMContentReady', update, QUICK_EVENT);\n off(popover, 'toggle', removeEvent, QUICK_EVENT);\n off(window, 'load,resize,scroll', update, QUICK_EVENT);\n }\n \n\n document.fonts.ready.then(update); // Inital render and when fonts load\n on(document, 'DOMContentReady', update, QUICK_EVENT);\n on(popover, 'toggle', removeEvent, QUICK_EVENT);\n on(window, 'load,resize,scroll', update, QUICK_EVENT);\n}\n\nfunction handleToggle ({ target: el, newState }: Toggle){\n const isPopping = newState === 'open' && el instanceof HTMLElement && el.classList.contains(CSS_POPOVER);\n const anchor = isPopping && (el.getRootNode() as ShadowRoot)?.querySelector<HTMLElement>(`[popovertarget=\"${el.id}\"]`);\n\n if (anchor) anchorPosition(anchor, el);\n}\n\nexport function observe(el: Node) {\n on(el, 'toggle', handleToggle, QUICK_EVENT); // Use capture since toggle does not bubble\n}\nexport function unobserve(el: Node) {\n off(el, 'toggle', handleToggle, QUICK_EVENT); // Use capture since toggle does not bubble\n}","import styles from '../styles.module.css';\nimport { IS_BROWSER, onAdd } from '../utils';\nconst CSS_TABLE = styles.table.split(' ')[0];\nconst BOUND = new WeakMap<Element | Document, ReturnType<typeof onAdd>>();\n\nfunction process(tables: HTMLCollectionOf<Element>) {\n for(const table of tables) if (table instanceof HTMLTableElement) {\n const ths = Array.from(table.tHead?.rows[0]?.cells || [], (el) => el.innerText?.trim()); // Using innerText to only include visible text\n for (const tbody of table.tBodies) {\n for (const row of tbody.rows) {\n for (const cell of row.cells) {\n cell.setAttribute('data-th', ths[cell.cellIndex] || '');\n }\n }\n }\n }\n}\n\nif (IS_BROWSER) observe(document);\n\nexport function observe (el: Element | Document) {\n const tables = el.getElementsByClassName(CSS_TABLE);\n const add = onAdd(styles.tableChildAdded, () => process(tables));\n BOUND.set(el, add);\n add.observe(el);\n}\n\nexport function unobserve (el: Element | Document) {\n BOUND.get(el)?.disconnect(el);\n}\n","const getSteps = (now: number, max: number, show: number) => {\n const offset = (show - 1) / 2;\n const start = Math.min(Math.max(now - Math.floor(offset), 1), max - show + 1);\n const end = Math.min(Math.max(now + Math.ceil(offset), show), max);\n const pages = Array.from({ length: end + 1 - start }, (_, i) => i + start);\n\n if (show > 4 && start > 1) pages.splice(0, 2, 1, 0);\n if (show > 3 && end < max) pages.splice(-2, 2, 0, max);\n return pages;\n};\n\nexport const pagination = ({\n current = 1,\n total = 10,\n show = 7,\n}) => ({\n prev: current > 1 ? current - 1 : 0,\n next: current < total ? current + 1 : 0,\n pages: getSteps(current, total, show).map((page, index) => ({\n current: page === current && 'page' as const,\n key: `key-${page}-${index}`,\n page,\n })),\n});\n","import * as field from './field/field';\nimport * as fieldset from './fieldset/fieldset';\nimport * as popover from './popover/popover';\nimport * as table from './table/table';\nexport { pagination } from './pagination/pagination';\nexport * as styles from './styles.module.css';\n\nexport function observe(el: Element) {\n field.observe(el);\n fieldset.observe(el);\n popover.observe(el);\n table.observe(el);\n}\n\nexport function unobserve(el: Element) {\n field.unobserve(el);\n fieldset.unobserve(el);\n popover.unobserve(el);\n table.unobserve(el);\n}"],"names":["IS_BROWSER","QUICK_EVENT","id","UUID","useId","el","events","action","element","rest","type","on","off","onAdd","animationName","callback","timer","onAnimation","event","isInputLike","CSS_FIELD","styles","CSS_VALIDATIONS","CSS_VALIDATION","BOUND","renderAria","fields","field","labels","descs","input","valid","label","handleInput","target","renderCounter","limit","remainder","nextInvalid","css","observe","add","unobserve","CSS_FIELDSET","process","fieldsets","fieldset","inputs","validationId","I","J","n","i","m","r","a","e","l","V","C","M","F","K","t","o","P","R","$","E","L","j","y","x","B","O","c","s","p","d","g","u","v","z","T","H","k","b","f","w","h","S","q","A","D","G","CSS_POPOVER","CONTAINER","POSITIONS","anchorPosition","anchor","popover","position","update","reposition","removeEvent","newState","handleToggle","_a","CSS_TABLE","tables","table","ths","_b","tbody","row","cell","getSteps","now","max","show","offset","start","end","pages","_","pagination","current","total","page","index","field.observe","fieldset.observe","popover.observe","table.observe","field.unobserve","fieldset.unobserve","popover.unobserve","table.unobserve"],"mappings":"4vDAAaA,EAAa,OAAO,OAAW,KAAe,OAAO,SAAa,IAClEC,EAAc,CAAE,QAAS,GAAM,QAAS,EAAK,EAM1D,IAAIC,GAAK,EACT,MAAMC,GAAO,GAAG,KAAK,IAAM,EAAA,SAAS,EAAE,CAAC,GAAG,KAAK,SAAS,SAAS,EAAE,EAAE,MAAM,EAAG,CAAC,CAAC,GACzE,SAASC,EAAOC,EAAa,CAC9B,OAACA,EAAG,KAAIA,EAAG,GAAK,GAAGF,EAAI,GAAG,EAAED,EAAE,IAC5BG,EAAG,EACX,CAsBA,MAAMC,GAAS,CACdC,EACAC,EACAC,IACU,CACV,UAAWC,KAAQD,EAAK,CAAC,EAAE,MAAM,GAAG,EACnCA,EAAK,CAAC,EAAIC,EACV,QAAQ,UAAU,GAAGH,CAAM,eAAe,EAAE,MAAMC,EAASC,CAAI,CAEjE,EAQaE,EAAK,CACjBH,KACGC,IACOH,GAAO,MAAOE,EAASC,CAAI,EAQzBG,EAAM,CAClBJ,KACGC,IACOH,GAAO,SAAUE,EAASC,CAAI,EAM5BI,EAAQ,CAACC,EAAuBC,IAAyB,CACpE,IAAIC,EAA2D,EACzD,MAAAC,EAAeC,GAA8C,CAC7DA,EAAM,gBAAkBJ,IAC1B,qBAAqBE,CAAK,EAC1BA,EAAQ,sBAAsBD,CAAQ,E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BnI,CAAE,EACpBoI,GAAgBpI,CAAE,CACpB","x_google_ignoreList":[3]}
package/mtds/index.js CHANGED
@@ -1,15 +1,19 @@
1
- import { observe as o, unobserve as s } from "./field/field.js";
2
- import { observe as r, unobserve as b } from "./popover/popover.js";
3
- import * as t from "./styles.module.css.js";
4
- function u(e) {
5
- o(e), r(e);
1
+ import { observe as o, unobserve as r } from "./field/field.js";
2
+ import { observe as s, unobserve as b } from "./fieldset/fieldset.js";
3
+ import { observe as v, unobserve as n } from "./popover/popover.js";
4
+ import { observe as t, unobserve as a } from "./table/table.js";
5
+ import { pagination as d } from "./pagination/pagination.js";
6
+ import * as f from "./styles.module.css.js";
7
+ function $(e) {
8
+ o(e), s(e), v(e), t(e);
6
9
  }
7
- function m(e) {
8
- s(e), b(e);
10
+ function x(e) {
11
+ r(e), b(e), n(e), a(e);
9
12
  }
10
13
  export {
11
- u as observe,
12
- t as styles,
13
- m as unobserve
14
+ $ as observe,
15
+ d as pagination,
16
+ f as styles,
17
+ x as unobserve
14
18
  };
15
19
  //# sourceMappingURL=index.js.map
package/mtds/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../designsystem/index.ts"],"sourcesContent":["import * as field from './field/field';\nimport * as popover from './popover/popover';\nexport * as styles from './styles.module.css';\n\nexport function observe(el: Element) {\n field.observe(el);\n popover.observe(el);\n}\n\nexport function unobserve(el: Element) {\n field.unobserve(el);\n popover.unobserve(el);\n}"],"names":["observe","el","field.observe","popover.observe","unobserve","field.unobserve","popover.unobserve"],"mappings":";;;AAIO,SAASA,EAAQC,GAAa;AACnCC,EAAAA,EAAcD,CAAE,GAChBE,EAAgBF,CAAE;AACpB;AAEO,SAASG,EAAUH,GAAa;AACrCI,EAAAA,EAAgBJ,CAAE,GAClBK,EAAkBL,CAAE;AACtB;"}
1
+ {"version":3,"file":"index.js","sources":["../designsystem/index.ts"],"sourcesContent":["import * as field from './field/field';\nimport * as fieldset from './fieldset/fieldset';\nimport * as popover from './popover/popover';\nimport * as table from './table/table';\nexport { pagination } from './pagination/pagination';\nexport * as styles from './styles.module.css';\n\nexport function observe(el: Element) {\n field.observe(el);\n fieldset.observe(el);\n popover.observe(el);\n table.observe(el);\n}\n\nexport function unobserve(el: Element) {\n field.unobserve(el);\n fieldset.unobserve(el);\n popover.unobserve(el);\n table.unobserve(el);\n}"],"names":["observe","el","field.observe","fieldset.observe","popover.observe","table.observe","unobserve","field.unobserve","fieldset.unobserve","popover.unobserve","table.unobserve"],"mappings":";;;;;;AAOO,SAASA,EAAQC,GAAa;AACnCC,EAAAA,EAAcD,CAAE,GAChBE,EAAiBF,CAAE,GACnBG,EAAgBH,CAAE,GAClBI,EAAcJ,CAAE;AAClB;AAEO,SAASK,EAAUL,GAAa;AACrCM,EAAAA,EAAgBN,CAAE,GAClBO,EAAmBP,CAAE,GACrBQ,EAAkBR,CAAE,GACpBS,EAAgBT,CAAE;AACpB;"}
@@ -0,0 +1,12 @@
1
+ import { StoryObj } from '@storybook/react';
2
+ declare const meta: {
3
+ title: string;
4
+ };
5
+ export default meta;
6
+ type Story = StoryObj<typeof meta>;
7
+ export declare const Default: Story;
8
+ export declare const Variants: Story;
9
+ export declare const Sizes: Story;
10
+ export declare const ReadOnly: Story;
11
+ export declare const Disabled: Story;
12
+ export declare const Search: Story;
@@ -0,0 +1,17 @@
1
+ import { StoryObj } from '@storybook/react';
2
+ declare const meta: {
3
+ title: string;
4
+ parameters: {
5
+ layout: string;
6
+ };
7
+ };
8
+ export default meta;
9
+ type Story = StoryObj<typeof meta>;
10
+ export declare const Flex: Story;
11
+ export declare const Grid: Story;
12
+ export declare const Box: Story;
13
+ export declare const Gap: Story;
14
+ export declare const Center: Story;
15
+ export declare const Align: Story;
16
+ export declare const Justify: Story;
17
+ export declare const AlignContent: Story;
@@ -0,0 +1,7 @@
1
+ import { StoryObj } from '@storybook/react';
2
+ declare const meta: {
3
+ title: string;
4
+ };
5
+ export default meta;
6
+ type Story = StoryObj<typeof meta>;
7
+ export declare const Default: Story;
@@ -0,0 +1,7 @@
1
+ import { StoryObj } from '@storybook/react';
2
+ declare const meta: {
3
+ title: string;
4
+ };
5
+ export default meta;
6
+ type Story = StoryObj<typeof meta>;
7
+ export declare const Default: Story;
@@ -0,0 +1,8 @@
1
+ import { StoryObj } from '@storybook/react';
2
+ declare const meta: {
3
+ title: string;
4
+ };
5
+ export default meta;
6
+ type Story = StoryObj<typeof meta>;
7
+ export declare const Default: Story;
8
+ export declare const Close: Story;
@@ -0,0 +1,13 @@
1
+ export declare const pagination: ({ current, total, show, }: {
2
+ current?: number | undefined;
3
+ total?: number | undefined;
4
+ show?: number | undefined;
5
+ }) => {
6
+ prev: number;
7
+ next: number;
8
+ pages: {
9
+ current: false | "page";
10
+ key: string;
11
+ page: number;
12
+ }[];
13
+ };
@@ -0,0 +1,20 @@
1
+ const o = (t, e, a) => {
2
+ const i = (a - 1) / 2, n = Math.min(Math.max(t - Math.floor(i), 1), e - a + 1), p = Math.min(Math.max(t + Math.ceil(i), a), e), s = Array.from({ length: p + 1 - n }, (M, f) => f + n);
3
+ return a > 4 && n > 1 && s.splice(0, 2, 1, 0), a > 3 && p < e && s.splice(-2, 2, 0, e), s;
4
+ }, c = ({
5
+ current: t = 1,
6
+ total: e = 10,
7
+ show: a = 7
8
+ }) => ({
9
+ prev: t > 1 ? t - 1 : 0,
10
+ next: t < e ? t + 1 : 0,
11
+ pages: o(t, e, a).map((i, n) => ({
12
+ current: i === t && "page",
13
+ key: `key-${i}-${n}`,
14
+ page: i
15
+ }))
16
+ });
17
+ export {
18
+ c as pagination
19
+ };
20
+ //# sourceMappingURL=pagination.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pagination.js","sources":["../../designsystem/pagination/pagination.ts"],"sourcesContent":["const getSteps = (now: number, max: number, show: number) => {\n const offset = (show - 1) / 2;\n const start = Math.min(Math.max(now - Math.floor(offset), 1), max - show + 1);\n const end = Math.min(Math.max(now + Math.ceil(offset), show), max);\n const pages = Array.from({ length: end + 1 - start }, (_, i) => i + start);\n\n if (show > 4 && start > 1) pages.splice(0, 2, 1, 0);\n if (show > 3 && end < max) pages.splice(-2, 2, 0, max);\n return pages;\n};\n\nexport const pagination = ({\n current = 1,\n total = 10,\n show = 7,\n}) => ({\n prev: current > 1 ? current - 1 : 0,\n next: current < total ? current + 1 : 0,\n pages: getSteps(current, total, show).map((page, index) => ({\n current: page === current && 'page' as const,\n key: `key-${page}-${index}`,\n page,\n })),\n});\n"],"names":["getSteps","now","max","show","offset","start","end","pages","_","i","pagination","current","total","page","index"],"mappings":"AAAA,MAAMA,IAAW,CAACC,GAAaC,GAAaC,MAAiB;AACrD,QAAAC,KAAUD,IAAO,KAAK,GACtBE,IAAQ,KAAK,IAAI,KAAK,IAAIJ,IAAM,KAAK,MAAMG,CAAM,GAAG,CAAC,GAAGF,IAAMC,IAAO,CAAC,GACtEG,IAAM,KAAK,IAAI,KAAK,IAAIL,IAAM,KAAK,KAAKG,CAAM,GAAGD,CAAI,GAAGD,CAAG,GAC3DK,IAAQ,MAAM,KAAK,EAAE,QAAQD,IAAM,IAAID,EAAS,GAAA,CAACG,GAAGC,MAAMA,IAAIJ,CAAK;AAErE,SAAAF,IAAO,KAAKE,IAAQ,OAAS,OAAO,GAAG,GAAG,GAAG,CAAC,GAC9CF,IAAO,KAAKG,IAAMJ,OAAW,OAAO,IAAI,GAAG,GAAGA,CAAG,GAC9CK;AACT,GAEaG,IAAa,CAAC;AAAA,EACzB,SAAAC,IAAU;AAAA,EACV,OAAAC,IAAQ;AAAA,EACR,MAAAT,IAAO;AACT,OAAO;AAAA,EACL,MAAMQ,IAAU,IAAIA,IAAU,IAAI;AAAA,EAClC,MAAMA,IAAUC,IAAQD,IAAU,IAAI;AAAA,EACtC,OAAOX,EAASW,GAASC,GAAOT,CAAI,EAAE,IAAI,CAACU,GAAMC,OAAW;AAAA,IAC1D,SAASD,MAASF,KAAW;AAAA,IAC7B,KAAK,OAAOE,CAAI,IAAIC,CAAK;AAAA,IACzB,MAAAD;AAAA,EAAA,EACA;AACJ;"}