@mattilsynet/design 0.0.12 → 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.
- package/mtds/alert/alert.stories.d.ts +10 -0
- package/mtds/avatar/avatar.stories.d.ts +7 -0
- package/mtds/breadcrumbs/breadcrumbs.stories.d.ts +9 -0
- package/mtds/button/button.stories.d.ts +15 -0
- package/mtds/card/card.stories.d.ts +7 -0
- package/mtds/chip/chip.stories.d.ts +7 -0
- package/mtds/details/details.stories.d.ts +10 -0
- package/mtds/errorsummary/errorsummary.stories.d.ts +7 -0
- package/mtds/favicon-dark.ico +0 -0
- package/mtds/favicon.ico +0 -0
- package/mtds/favicon.svg +4 -0
- package/mtds/field/field.d.ts +2 -2
- package/mtds/field/field.js +34 -26
- package/mtds/field/field.js.map +1 -1
- package/mtds/field/field.stories.d.ts +11 -0
- package/mtds/fieldset/fieldset.d.ts +2 -0
- package/mtds/fieldset/fieldset.js +28 -0
- package/mtds/fieldset/fieldset.js.map +1 -0
- package/mtds/fieldset/fieldset.stories.d.ts +12 -0
- package/mtds/index.d.ts +19 -1
- package/mtds/index.iife.js +2 -2
- package/mtds/index.iife.js.map +1 -1
- package/mtds/index.js +14 -10
- package/mtds/index.js.map +1 -1
- package/mtds/input/input.stories.d.ts +12 -0
- package/mtds/layout/layout.stories.d.ts +17 -0
- package/mtds/link/link.stories.d.ts +7 -0
- package/mtds/logo/logo.stories.d.ts +7 -0
- package/mtds/modal/modal.stories.d.ts +8 -0
- package/mtds/pagination/pagination.d.ts +13 -0
- package/mtds/pagination/pagination.js +20 -0
- package/mtds/pagination/pagination.js.map +1 -0
- package/mtds/pagination/pagination.stories.d.ts +10 -0
- package/mtds/popover/popover.js +24 -24
- package/mtds/popover/popover.js.map +1 -1
- package/mtds/popover/popover.stories.d.ts +10 -0
- package/mtds/styles.css +2099 -2335
- package/mtds/styles.json +30 -13
- package/mtds/styles.module.css.js +62 -28
- package/mtds/styles.module.css.js.map +1 -1
- package/mtds/table/table.d.ts +2 -0
- package/mtds/table/table.js +30 -0
- package/mtds/table/table.js.map +1 -0
- package/mtds/table/table.mockData.d.ts +8 -0
- package/mtds/table/table.stories.d.ts +28 -0
- package/mtds/tabs/tabs.stories.d.ts +8 -0
- package/mtds/tag/tag.stories.d.ts +7 -0
- package/mtds/utils.d.ts +29 -0
- package/mtds/utils.js +23 -20
- package/mtds/utils.js.map +1 -1
- package/mtds/validation/validation.stories.d.ts +7 -0
- package/package.json +32 -13
- package/mtds/input/input.d.ts +0 -1
package/mtds/styles.json
CHANGED
|
@@ -1,15 +1,32 @@
|
|
|
1
1
|
{
|
|
2
|
-
"alert": "
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
2
|
+
"alert": "_alert_d52qk_1 _ds-alert_whhdm_1",
|
|
3
|
+
"avatar": "_avatar_d52qk_1 _ds-avatar_whhdm_1",
|
|
4
|
+
"breadcrumbs": "_breadcrumbs_d52qk_1 _ds-breadcrumbs_whhdm_1",
|
|
5
|
+
"button": "_button_d52qk_1 _ds-button_whhdm_1",
|
|
6
|
+
"card": "_card_d52qk_1 _ds-card_whhdm_1",
|
|
7
|
+
"chip": "_chip_d52qk_1 _ds-chip_whhdm_1",
|
|
8
|
+
"details": "_details_d52qk_1 _ds-details_whhdm_1",
|
|
9
|
+
"errorsummary": "_errorsummary_d52qk_1 _ds-error-summary_whhdm_1",
|
|
10
|
+
"field": "_field_d52qk_1 _ds-field_whhdm_1",
|
|
11
|
+
"fieldChildAdded": "_fieldChildAdded_d52qk_1",
|
|
12
|
+
"affixes": "_affixes_d52qk_1 _ds-field-affixes_whhdm_1",
|
|
13
|
+
"count": "_count_d52qk_1",
|
|
14
|
+
"fieldset": "_fieldset_d52qk_1 _ds-fieldset_whhdm_1",
|
|
15
|
+
"fieldsetValidationAdded": "_fieldsetValidationAdded_d52qk_1",
|
|
16
|
+
"input": "_input_d52qk_1 _ds-input_whhdm_1",
|
|
17
|
+
"grid": "_grid_d52qk_1",
|
|
18
|
+
"flex": "_flex_d52qk_1",
|
|
19
|
+
"box": "_box_d52qk_1",
|
|
20
|
+
"link": "_link_d52qk_1",
|
|
21
|
+
"logo": "_logo_d52qk_1 _ds-focus_whhdm_1",
|
|
22
|
+
"modal": "_modal_d52qk_1 _ds-modal_whhdm_1",
|
|
23
|
+
"pagination": "_pagination_d52qk_1 _ds-pagination_whhdm_1",
|
|
24
|
+
"popover": "_popover_d52qk_1",
|
|
25
|
+
"table": "_table_d52qk_1 _ds-table_whhdm_1",
|
|
26
|
+
"scrollShadow": "_scrollShadow_d52qk_1",
|
|
27
|
+
"tableChildAdded": "_tableChildAdded_d52qk_1",
|
|
28
|
+
"tabs": "_tabs_d52qk_1",
|
|
29
|
+
"tag": "_tag_d52qk_1 _ds-tag_whhdm_1",
|
|
30
|
+
"validation": "_validation_d52qk_1 _ds-validation-message_whhdm_1",
|
|
31
|
+
"body": "_body_d52qk_65"
|
|
15
32
|
}
|
|
@@ -1,32 +1,66 @@
|
|
|
1
|
-
const
|
|
2
|
-
alert:
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
const d = "_alert_d52qk_1 _ds-alert_whhdm_1", _ = "_avatar_d52qk_1 _ds-avatar_whhdm_1", t = "_breadcrumbs_d52qk_1 _ds-breadcrumbs_whhdm_1", s = "_button_d52qk_1 _ds-button_whhdm_1", o = "_card_d52qk_1 _ds-card_whhdm_1", a = "_chip_d52qk_1 _ds-chip_whhdm_1", e = "_details_d52qk_1 _ds-details_whhdm_1", i = "_errorsummary_d52qk_1 _ds-error-summary_whhdm_1", l = "_field_d52qk_1 _ds-field_whhdm_1", n = "_fieldChildAdded_d52qk_1", c = "_affixes_d52qk_1 _ds-field-affixes_whhdm_1", h = "_count_d52qk_1", r = "_fieldset_d52qk_1 _ds-fieldset_whhdm_1", m = "_fieldsetValidationAdded_d52qk_1", k = "_input_d52qk_1 _ds-input_whhdm_1", q = "_grid_d52qk_1", b = "_flex_d52qk_1", f = "_box_d52qk_1", u = "_link_d52qk_1", w = "_logo_d52qk_1 _ds-focus_whhdm_1", p = "_modal_d52qk_1 _ds-modal_whhdm_1", g = "_pagination_d52qk_1 _ds-pagination_whhdm_1", v = "_popover_d52qk_1", x = "_table_d52qk_1 _ds-table_whhdm_1", A = "_scrollShadow_d52qk_1", y = "_tableChildAdded_d52qk_1", C = "_tabs_d52qk_1", S = "_tag_d52qk_1 _ds-tag_whhdm_1", V = "_validation_d52qk_1 _ds-validation-message_whhdm_1", j = "_body_d52qk_65", z = {
|
|
2
|
+
alert: d,
|
|
3
|
+
avatar: _,
|
|
4
|
+
breadcrumbs: t,
|
|
5
|
+
button: s,
|
|
6
|
+
card: o,
|
|
7
|
+
chip: a,
|
|
8
|
+
details: e,
|
|
9
|
+
errorsummary: i,
|
|
10
|
+
field: l,
|
|
11
|
+
fieldChildAdded: n,
|
|
12
|
+
affixes: c,
|
|
13
|
+
count: h,
|
|
14
|
+
fieldset: r,
|
|
15
|
+
fieldsetValidationAdded: m,
|
|
16
|
+
input: k,
|
|
17
|
+
grid: q,
|
|
18
|
+
flex: b,
|
|
19
|
+
box: f,
|
|
20
|
+
link: u,
|
|
21
|
+
logo: w,
|
|
22
|
+
modal: p,
|
|
23
|
+
pagination: g,
|
|
24
|
+
popover: v,
|
|
25
|
+
table: x,
|
|
26
|
+
scrollShadow: A,
|
|
27
|
+
tableChildAdded: y,
|
|
28
|
+
tabs: C,
|
|
29
|
+
tag: S,
|
|
30
|
+
validation: V,
|
|
31
|
+
body: j
|
|
15
32
|
};
|
|
16
33
|
export {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
h as
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
i as
|
|
30
|
-
|
|
34
|
+
c as affixes,
|
|
35
|
+
d as alert,
|
|
36
|
+
_ as avatar,
|
|
37
|
+
j as body,
|
|
38
|
+
f as box,
|
|
39
|
+
t as breadcrumbs,
|
|
40
|
+
s as button,
|
|
41
|
+
o as card,
|
|
42
|
+
a as chip,
|
|
43
|
+
h as count,
|
|
44
|
+
z as default,
|
|
45
|
+
e as details,
|
|
46
|
+
i as errorsummary,
|
|
47
|
+
l as field,
|
|
48
|
+
n as fieldChildAdded,
|
|
49
|
+
r as fieldset,
|
|
50
|
+
m as fieldsetValidationAdded,
|
|
51
|
+
b as flex,
|
|
52
|
+
q as grid,
|
|
53
|
+
k as input,
|
|
54
|
+
u as link,
|
|
55
|
+
w as logo,
|
|
56
|
+
p as modal,
|
|
57
|
+
g as pagination,
|
|
58
|
+
v as popover,
|
|
59
|
+
A as scrollShadow,
|
|
60
|
+
x as table,
|
|
61
|
+
y as tableChildAdded,
|
|
62
|
+
C as tabs,
|
|
63
|
+
S as tag,
|
|
64
|
+
V as validation
|
|
31
65
|
};
|
|
32
66
|
//# sourceMappingURL=styles.module.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"styles.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import f from "../styles.module.css.js";
|
|
2
|
+
import { IS_BROWSER as d, onAdd as i } from "../utils.js";
|
|
3
|
+
const b = f.table.split(" ")[0], l = /* @__PURE__ */ new WeakMap();
|
|
4
|
+
function m(t) {
|
|
5
|
+
var o, e;
|
|
6
|
+
for (const n of t) if (n instanceof HTMLTableElement) {
|
|
7
|
+
const a = Array.from(((e = (o = n.tHead) == null ? void 0 : o.rows[0]) == null ? void 0 : e.cells) || [], (r) => {
|
|
8
|
+
var s;
|
|
9
|
+
return (s = r.innerText) == null ? void 0 : s.trim();
|
|
10
|
+
});
|
|
11
|
+
for (const r of n.tBodies)
|
|
12
|
+
for (const s of r.rows)
|
|
13
|
+
for (const c of s.cells)
|
|
14
|
+
c.setAttribute("data-th", a[c.cellIndex] || "");
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
d && p(document);
|
|
18
|
+
function p(t) {
|
|
19
|
+
const o = t.getElementsByClassName(b), e = i(f.tableChildAdded, () => m(o));
|
|
20
|
+
l.set(t, e), e.observe(t);
|
|
21
|
+
}
|
|
22
|
+
function B(t) {
|
|
23
|
+
var o;
|
|
24
|
+
(o = l.get(t)) == null || o.disconnect(t);
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
p as observe,
|
|
28
|
+
B as unobserve
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.js","sources":["../../designsystem/table/table.ts"],"sourcesContent":["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"],"names":["CSS_TABLE","styles","BOUND","process","tables","table","ths","_b","_a","el","tbody","row","cell","IS_BROWSER","observe","add","onAdd","unobserve"],"mappings":";;AAEA,MAAMA,IAAYC,EAAO,MAAM,MAAM,GAAG,EAAE,CAAC,GACrCC,wBAAY,QAAsD;AAExE,SAASC,EAAQC,GAAmC;;AAClD,aAAUC,KAASD,EAAY,KAAAC,aAAiB,kBAAkB;AAChE,UAAMC,IAAM,MAAM,OAAKC,KAAAC,IAAAH,EAAM,UAAN,gBAAAG,EAAa,KAAK,OAAlB,gBAAAD,EAAsB,UAAS,IAAI,CAACE,MAAO;;AAAA,cAAAD,IAAAC,EAAG,cAAH,gBAAAD,EAAc;AAAA,KAAM;AAC3E,eAAAE,KAASL,EAAM;AACb,iBAAAM,KAAOD,EAAM;AACX,mBAAAE,KAAQD,EAAI;AACrB,UAAAC,EAAK,aAAa,WAAWN,EAAIM,EAAK,SAAS,KAAK,EAAE;AAAA,EAG5D;AAEJ;AAEIC,OAAoB,QAAQ;AAEzB,SAASC,EAASL,GAAwB;AACzC,QAAAL,IAASK,EAAG,uBAAuBT,CAAS,GAC5Ce,IAAMC,EAAMf,EAAO,iBAAiB,MAAME,EAAQC,CAAM,CAAC;AACzD,EAAAF,EAAA,IAAIO,GAAIM,CAAG,GACjBA,EAAI,QAAQN,CAAE;AAChB;AAEO,SAASQ,EAAWR,GAAwB;;AACjD,GAAAD,IAAAN,EAAM,IAAIO,CAAE,MAAZ,QAAAD,EAAe,WAAWC;AAC5B;"}
|
|
@@ -0,0 +1,28 @@
|
|
|
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 DefaultTanstack: Story;
|
|
9
|
+
export declare const HeadingsSimple: Story;
|
|
10
|
+
export declare const HeadingsTanstack: Story;
|
|
11
|
+
export declare const SortableSimple: Story;
|
|
12
|
+
export declare const SortableTanstack: Story;
|
|
13
|
+
export declare const PaginatableSimple: Story;
|
|
14
|
+
export declare const PaginatableTanstack: Story;
|
|
15
|
+
export declare const SearchableSimple: Story;
|
|
16
|
+
export declare const SearchableTanstack: Story;
|
|
17
|
+
export declare const ExpandableSimple: Story;
|
|
18
|
+
export declare const ExpandableTanstack: Story;
|
|
19
|
+
export declare const CheckableSimple: Story;
|
|
20
|
+
export declare const CheckableTanstack: Story;
|
|
21
|
+
export declare const HorizontalTitles: Story;
|
|
22
|
+
export declare const FixedWidths: Story;
|
|
23
|
+
export declare const NumericValues: Story;
|
|
24
|
+
export declare const Footer: Story;
|
|
25
|
+
export declare const Sizes: Story;
|
|
26
|
+
export declare const Checkbox: Story;
|
|
27
|
+
export declare const MobileScroll: Story;
|
|
28
|
+
export declare const MobileDivide: Story;
|
package/mtds/utils.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export declare const IS_BROWSER: boolean;
|
|
2
|
+
export declare const QUICK_EVENT: {
|
|
3
|
+
capture: boolean;
|
|
4
|
+
passive: boolean;
|
|
5
|
+
};
|
|
2
6
|
export declare function useId(el: Element): string;
|
|
3
7
|
/**
|
|
4
8
|
* Speed up MutationObserver by debouncing and only running when page is visible
|
|
@@ -19,3 +23,28 @@ export declare const on: (element: Node | Window, type: string, listener: EventL
|
|
|
19
23
|
* @param listener An event listener function or listener object
|
|
20
24
|
*/
|
|
21
25
|
export declare const off: (element: Node | Window, type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions | undefined) => void;
|
|
26
|
+
/**
|
|
27
|
+
* Child added event inspired by:
|
|
28
|
+
* https://davidwalsh.name/detect-node-insertion
|
|
29
|
+
*/
|
|
30
|
+
export declare const onAdd: (animationName: string, callback: () => void) => {
|
|
31
|
+
observe: (el: Element | Document) => void;
|
|
32
|
+
disconnect: (el: Element | Document) => void;
|
|
33
|
+
};
|
|
34
|
+
export declare const isInputLike: (el: unknown) => el is HTMLInputElement;
|
|
35
|
+
declare global {
|
|
36
|
+
namespace React.JSX {
|
|
37
|
+
interface IntrinsicAttributes {
|
|
38
|
+
popovertargetaction?: string;
|
|
39
|
+
popovertarget?: string;
|
|
40
|
+
popover?: string | boolean;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
namespace React {
|
|
44
|
+
interface HTMLAttributes<T> {
|
|
45
|
+
popovertargetaction?: string;
|
|
46
|
+
popovertarget?: string;
|
|
47
|
+
popover?: string | boolean;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
package/mtds/utils.js
CHANGED
|
@@ -1,26 +1,29 @@
|
|
|
1
|
-
const
|
|
2
|
-
let
|
|
3
|
-
const
|
|
4
|
-
function u(
|
|
5
|
-
return
|
|
1
|
+
const f = typeof window < "u" && typeof document < "u", a = { capture: !0, passive: !0 };
|
|
2
|
+
let c = 0;
|
|
3
|
+
const d = `${Date.now().toString(36)}${Math.random().toString(36).slice(2, 5)}`;
|
|
4
|
+
function u(n) {
|
|
5
|
+
return n.id || (n.id = `${d}${++c}`), n.id;
|
|
6
6
|
}
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
e[0]
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
const s = (n, t, e) => {
|
|
8
|
+
for (const i of e[0].split(","))
|
|
9
|
+
e[0] = i, Element.prototype[`${n}EventListener`].apply(t, e);
|
|
10
|
+
}, r = (n, ...t) => s("add", n, t), m = (n, ...t) => s("remove", n, t), p = (n, t) => {
|
|
11
|
+
let e = 0;
|
|
12
|
+
const i = (o) => {
|
|
13
|
+
o.animationName === n && (cancelAnimationFrame(e), e = requestAnimationFrame(t));
|
|
12
14
|
};
|
|
13
|
-
return
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}, p = (t, ...e) => i("add", t, e), a = (t, ...e) => i("remove", t, e);
|
|
15
|
+
return {
|
|
16
|
+
observe: (o) => r(o, "animationend", i, a),
|
|
17
|
+
disconnect: (o) => m(o, "animationstart", i, a)
|
|
18
|
+
};
|
|
19
|
+
}, E = (n) => n instanceof HTMLElement && "validity" in n && !(n instanceof HTMLButtonElement);
|
|
19
20
|
export {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
f as IS_BROWSER,
|
|
22
|
+
a as QUICK_EVENT,
|
|
23
|
+
E as isInputLike,
|
|
24
|
+
m as off,
|
|
25
|
+
r as on,
|
|
26
|
+
p as onAdd,
|
|
24
27
|
u as useId
|
|
25
28
|
};
|
|
26
29
|
//# sourceMappingURL=utils.js.map
|
package/mtds/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../designsystem/utils.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"],"names":["IS_BROWSER","id","UUID","useId","el","
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../designsystem/utils.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}"],"names":["IS_BROWSER","QUICK_EVENT","id","UUID","useId","el","events","action","element","rest","type","on","off","onAdd","animationName","callback","timer","onAnimation","event","isInputLike"],"mappings":"AAAO,MAAMA,IAAa,OAAO,SAAW,OAAe,OAAO,WAAa,KAClEC,IAAc,EAAE,SAAS,IAAM,SAAS,GAAK;AAM1D,IAAIC,IAAK;AACT,MAAMC,IAAO,GAAG,KAAK,IAAM,EAAA,SAAS,EAAE,CAAC,GAAG,KAAK,SAAS,SAAS,EAAE,EAAE,MAAM,GAAG,CAAC,CAAC;AACzE,SAASC,EAAOC,GAAa;AAC9B,SAACA,EAAG,OAAIA,EAAG,KAAK,GAAGF,CAAI,GAAG,EAAED,CAAE,KAC5BG,EAAG;AACX;AAsBA,MAAMC,IAAS,CACdC,GACAC,GACAC,MACU;AACV,aAAWC,KAAQD,EAAK,CAAC,EAAE,MAAM,GAAG;AACnC,IAAAA,EAAK,CAAC,IAAIC,GACV,QAAQ,UAAU,GAAGH,CAAM,eAAe,EAAE,MAAMC,GAASC,CAAI;AAEjE,GAQaE,IAAK,CACjBH,MACGC,MACOH,EAAO,OAAOE,GAASC,CAAI,GAQzBG,IAAM,CAClBJ,MACGC,MACOH,EAAO,UAAUE,GAASC,CAAI,GAM5BI,IAAQ,CAACC,GAAuBC,MAAyB;AACpE,MAAIC,IAA2D;AACzD,QAAAC,IAAc,CAACC,MAA8C;AAC7D,IAAAA,EAAM,kBAAkBJ,MAC1B,qBAAqBE,CAAK,GAC1BA,IAAQ,sBAAsBD,CAAQ;AAAA,EAE1C;AAEM,SAAA;AAAA,IACN,SAAS,CAACV,MAA6BM,EAAGN,GAAI,gBAAgBY,GAAahB,CAAW;AAAA,IACtF,YAAY,CAACI,MAA6BO,EAAIP,GAAI,kBAAkBY,GAAahB,CAAW;AAAA,EAC7F;AACD,GAEakB,IAAc,CAACd,MAC3BA,aAAc,eAAe,cAAcA,KAAM,EAAEA,aAAc;"}
|
package/package.json
CHANGED
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mattilsynet/design",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./mtds/index.js",
|
|
6
6
|
"types": "./mtds/index.d.ts",
|
|
7
7
|
"files": [
|
|
8
8
|
"mtds"
|
|
9
9
|
],
|
|
10
|
+
"engines": {
|
|
11
|
+
"npm": "^10.x",
|
|
12
|
+
"node": "^20.x"
|
|
13
|
+
},
|
|
10
14
|
"exports": {
|
|
11
15
|
".": {
|
|
12
16
|
"import": "./mtds/index.js",
|
|
13
17
|
"types": "./mtds/index.d.ts"
|
|
14
18
|
},
|
|
15
19
|
"./*.svg": "./mtds/*.svg",
|
|
20
|
+
"./*.ico": "./mtds/*.ico",
|
|
16
21
|
"./icons/*": "./mtds/icons/*",
|
|
17
22
|
"./illustrations/*": "./mtds/illustrations/*",
|
|
18
23
|
"./index.iife.js": "./mtds/index.iife.js",
|
|
@@ -21,16 +26,14 @@
|
|
|
21
26
|
"./styles.json": "./mtds/styles.json"
|
|
22
27
|
},
|
|
23
28
|
"scripts": {
|
|
24
|
-
"start": "vite",
|
|
25
29
|
"build": "vite build && rm -rf mtds/docs/",
|
|
26
30
|
"lint": "npx @biomejs/biome lint",
|
|
27
|
-
"
|
|
28
|
-
"docs:dev": "vitepress dev",
|
|
29
|
-
"docs:build": "vitepress build",
|
|
30
|
-
"docs:preview": "vitepress preview",
|
|
31
|
-
"publish:patch": "npm run build && npm version patch --message 'Release %s' && git push --tags && npm publish --access public",
|
|
31
|
+
"publish:clojure": "cd ./clojure && ./publish.sh",
|
|
32
32
|
"publish:minor": "npm run build && npm version minor --message 'Release %s' && git push --tags && npm publish --access public",
|
|
33
|
-
"publish:
|
|
33
|
+
"publish:patch": "npm run build && npm version patch --message 'Release %s' && git push --tags && npm publish --access public",
|
|
34
|
+
"start": "vite",
|
|
35
|
+
"storybook": "storybook dev -p 6006",
|
|
36
|
+
"storybook:build": "npm run build && storybook build"
|
|
34
37
|
},
|
|
35
38
|
"dependencies": {
|
|
36
39
|
"nanopop": "^2.4.2"
|
|
@@ -39,15 +42,31 @@
|
|
|
39
42
|
"@biomejs/biome": "^1.9.4",
|
|
40
43
|
"@digdir/designsystemet-css": "^1.0.0-next.44",
|
|
41
44
|
"@digdir/designsystemet-theme": "^1.0.0-next.44",
|
|
42
|
-
"@navikt/aksel-icons": "^7.
|
|
45
|
+
"@navikt/aksel-icons": "^7.9.0",
|
|
46
|
+
"@phosphor-icons/react": "^2.1.7",
|
|
47
|
+
"@storybook/addon-essentials": "^8.4.7",
|
|
48
|
+
"@storybook/addon-storysource": "^8.4.7",
|
|
49
|
+
"@storybook/blocks": "^8.4.7",
|
|
50
|
+
"@storybook/manager-api": "^8.4.7",
|
|
51
|
+
"@storybook/react": "^8.4.7",
|
|
52
|
+
"@storybook/react-vite": "^8.4.7",
|
|
53
|
+
"@storybook/theming": "^8.4.7",
|
|
54
|
+
"@tanstack/react-table": "^8.20.6",
|
|
43
55
|
"@types/node": "^22.10.2",
|
|
56
|
+
"@types/react": "^18.3.12",
|
|
57
|
+
"@types/react-dom": "^18.3.1",
|
|
44
58
|
"@u-elements/u-details": "^0.1.0",
|
|
59
|
+
"@u-elements/u-tabs": "^0.0.8",
|
|
60
|
+
"@vitejs/plugin-react": "^4.3.4",
|
|
61
|
+
"fast-glob": "^3.3.2",
|
|
62
|
+
"globals": "^15.12.0",
|
|
45
63
|
"postcss": "^8.4.49",
|
|
46
64
|
"postcss-nesting": "^13.0.1",
|
|
65
|
+
"react": "^18.3.1",
|
|
66
|
+
"react-dom": "^18.3.1",
|
|
67
|
+
"storybook": "^8.4.7",
|
|
47
68
|
"typescript": "^5.7.2",
|
|
48
|
-
"vite": "^6.0.
|
|
49
|
-
"vite-plugin-dts": "^4.
|
|
50
|
-
"vitepress": "^1.5.0",
|
|
51
|
-
"vue": "^3.5.13"
|
|
69
|
+
"vite": "^6.0.6",
|
|
70
|
+
"vite-plugin-dts": "^4.4.0"
|
|
52
71
|
}
|
|
53
72
|
}
|
package/mtds/input/input.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|