@mattilsynet/design 0.2.6 → 0.2.8
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/README.md +7 -0
- package/package.json +3 -6
- package/mtds/alert/alert.stories.d.ts +0 -12
- package/mtds/avatar/avatar.stories.d.ts +0 -7
- package/mtds/badge/badge.stories.d.ts +0 -10
- package/mtds/breadcrumbs/breadcrumbs.stories.d.ts +0 -9
- package/mtds/button/button.stories.d.ts +0 -15
- package/mtds/card/card.stories.d.ts +0 -8
- package/mtds/chip/chip.stories.d.ts +0 -7
- package/mtds/details/details.stories.d.ts +0 -10
- package/mtds/errorsummary/errorsummary.stories.d.ts +0 -7
- package/mtds/favicon-dark.ico +0 -0
- package/mtds/favicon.ico +0 -0
- package/mtds/favicon.svg +0 -4
- package/mtds/field/field.d.ts +0 -2
- package/mtds/field/field.js +0 -40
- package/mtds/field/field.js.map +0 -1
- package/mtds/field/field.stories.d.ts +0 -12
- package/mtds/fieldset/fieldset.d.ts +0 -2
- package/mtds/fieldset/fieldset.js +0 -27
- package/mtds/fieldset/fieldset.js.map +0 -1
- package/mtds/fieldset/fieldset.stories.d.ts +0 -12
- package/mtds/icons/cosmetics.svg +0 -1
- package/mtds/icons/cow.svg +0 -1
- package/mtds/icons/fish.svg +0 -1
- package/mtds/icons/food.svg +0 -1
- package/mtds/icons/plant.svg +0 -1
- package/mtds/icons/water.svg +0 -1
- package/mtds/illustrations/apple-cup.svg +0 -5
- package/mtds/illustrations/apple.svg +0 -4
- package/mtds/illustrations/banana-apple-cup.svg +0 -6
- package/mtds/illustrations/banana.svg +0 -3
- package/mtds/illustrations/bird.svg +0 -3
- package/mtds/illustrations/drop.svg +0 -3
- package/mtds/illustrations/farmer-inviting.svg +0 -12
- package/mtds/illustrations/farmer-pig-plant.svg +0 -14
- package/mtds/illustrations/farmer-pitchfork.svg +0 -13
- package/mtds/illustrations/farmer-turnip-plant.svg +0 -16
- package/mtds/illustrations/faucet.svg +0 -3
- package/mtds/illustrations/fish.svg +0 -3
- package/mtds/illustrations/flask-perfume.svg +0 -3
- package/mtds/illustrations/flask-pipette.svg +0 -4
- package/mtds/illustrations/flask-pump.svg +0 -3
- package/mtds/illustrations/flasks.svg +0 -7
- package/mtds/illustrations/flounder.svg +0 -3
- package/mtds/illustrations/flower-seeds.svg +0 -5
- package/mtds/illustrations/flower.svg +0 -4
- package/mtds/illustrations/grass-bush.svg +0 -3
- package/mtds/illustrations/illustrations.json +0 -59
- package/mtds/illustrations/inspector.svg +0 -13
- package/mtds/illustrations/jar.svg +0 -4
- package/mtds/illustrations/meeting-plant.svg +0 -24
- package/mtds/illustrations/mussel-1.svg +0 -3
- package/mtds/illustrations/mussel-2.svg +0 -3
- package/mtds/illustrations/mussel-3.svg +0 -3
- package/mtds/illustrations/mussels.svg +0 -3
- package/mtds/illustrations/oak-leaf.svg +0 -3
- package/mtds/illustrations/pear.svg +0 -5
- package/mtds/illustrations/person-animal-nature-1.svg +0 -1
- package/mtds/illustrations/person-animal-nature-2.svg +0 -1
- package/mtds/illustrations/person-apron-bush.svg +0 -14
- package/mtds/illustrations/person-apron.svg +0 -14
- package/mtds/illustrations/person-arm.svg +0 -11
- package/mtds/illustrations/person-drop.svg +0 -13
- package/mtds/illustrations/person-faucet-drop.svg +0 -13
- package/mtds/illustrations/person-fish-seaweed.svg +0 -16
- package/mtds/illustrations/person-fish.svg +0 -15
- package/mtds/illustrations/person-flasks.svg +0 -16
- package/mtds/illustrations/person-flower.svg +0 -13
- package/mtds/illustrations/person-fork-bush.svg +0 -15
- package/mtds/illustrations/person-ham.svg +0 -1
- package/mtds/illustrations/person-meat.svg +0 -22
- package/mtds/illustrations/person-mobile.svg +0 -1
- package/mtds/illustrations/person-mussels.svg +0 -12
- package/mtds/illustrations/person-pear.svg +0 -16
- package/mtds/illustrations/person-tubes.svg +0 -15
- package/mtds/illustrations/pig.svg +0 -3
- package/mtds/illustrations/plant-round-leaves.svg +0 -3
- package/mtds/illustrations/plant.svg +0 -3
- package/mtds/illustrations/seaweed.svg +0 -3
- package/mtds/illustrations/shrimp.svg +0 -3
- package/mtds/illustrations/team.svg +0 -25
- package/mtds/illustrations/tube-1.svg +0 -4
- package/mtds/illustrations/tube-2.svg +0 -4
- package/mtds/illustrations/turnip.svg +0 -4
- package/mtds/illustrations/water-plant.svg +0 -3
- package/mtds/index.d.ts +0 -38
- package/mtds/index.iife.js +0 -2
- package/mtds/index.iife.js.map +0 -1
- package/mtds/index.js +0 -21
- package/mtds/index.js.map +0 -1
- package/mtds/input/input.stories.d.ts +0 -16
- package/mtds/layout/layout.stories.d.ts +0 -17
- package/mtds/link/link.stories.d.ts +0 -7
- package/mtds/logo/logo.stories.d.ts +0 -8
- package/mtds/logo-english.svg +0 -1
- package/mtds/logo-samisk.svg +0 -1
- package/mtds/logo.svg +0 -1
- package/mtds/modal/modal.stories.d.ts +0 -8
- package/mtds/pagination/pagination.d.ts +0 -13
- package/mtds/pagination/pagination.js +0 -20
- package/mtds/pagination/pagination.js.map +0 -1
- package/mtds/pagination/pagination.stories.d.ts +0 -10
- package/mtds/popover/popover.d.ts +0 -2
- package/mtds/popover/popover.js +0 -42
- package/mtds/popover/popover.js.map +0 -1
- package/mtds/popover/popover.stories.d.ts +0 -11
- package/mtds/skeleton/skeleton.stories.d.ts +0 -9
- package/mtds/styles.css +0 -1
- package/mtds/styles.json +0 -35
- package/mtds/styles.module.css.js +0 -72
- package/mtds/styles.module.css.js.map +0 -1
- package/mtds/table/table.d.ts +0 -2
- package/mtds/table/table.js +0 -29
- package/mtds/table/table.js.map +0 -1
- package/mtds/table/table.mockData.d.ts +0 -8
- package/mtds/table/table.stories.d.ts +0 -30
- package/mtds/tabs/tabs.stories.d.ts +0 -8
- package/mtds/tag/tag.stories.d.ts +0 -10
- package/mtds/utils.d.ts +0 -50
- package/mtds/utils.js +0 -29
- package/mtds/utils.js.map +0 -1
- package/mtds/validation/validation.stories.d.ts +0 -7
package/mtds/styles.json
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"validation": "_validation_12jx5_1 _ds-validation-message_14y6r_1",
|
|
3
|
-
"tag": "_tag_12jx5_1 _ds-tag_14y6r_1",
|
|
4
|
-
"tabs": "_tabs_12jx5_1",
|
|
5
|
-
"table": "_table_12jx5_1 _ds-table_14y6r_1",
|
|
6
|
-
"scrollShadow": "_scrollShadow_12jx5_1",
|
|
7
|
-
"tableChildAdded": "_tableChildAdded_12jx5_1",
|
|
8
|
-
"skeleton": "_skeleton_12jx5_1 _ds-skeleton_14y6r_1",
|
|
9
|
-
"popover": "_popover_12jx5_1",
|
|
10
|
-
"pagination": "_pagination_12jx5_1 _ds-pagination_14y6r_1",
|
|
11
|
-
"modal": "_modal_12jx5_1 _ds-modal_14y6r_1",
|
|
12
|
-
"logo": "_logo_12jx5_1 _ds-focus_14y6r_1",
|
|
13
|
-
"link": "_link_12jx5_1",
|
|
14
|
-
"grid": "_grid_12jx5_1",
|
|
15
|
-
"flex": "_flex_12jx5_1",
|
|
16
|
-
"box": "_box_12jx5_1",
|
|
17
|
-
"input": "_input_12jx5_1 _ds-input_14y6r_1",
|
|
18
|
-
"fieldset": "_fieldset_12jx5_1 _ds-fieldset_14y6r_1",
|
|
19
|
-
"fieldsetValidationAdded": "_fieldsetValidationAdded_12jx5_1",
|
|
20
|
-
"field": "_field_12jx5_1 _ds-field_14y6r_1",
|
|
21
|
-
"fieldChildAdded": "_fieldChildAdded_12jx5_1",
|
|
22
|
-
"affixes": "_affixes_12jx5_1 _ds-field-affixes_14y6r_1",
|
|
23
|
-
"count": "_count_12jx5_1",
|
|
24
|
-
"errorsummary": "_errorsummary_12jx5_1 _ds-error-summary_14y6r_1",
|
|
25
|
-
"details": "_details_12jx5_1 _ds-details_14y6r_1",
|
|
26
|
-
"chip": "_chip_12jx5_1 _ds-chip_14y6r_1",
|
|
27
|
-
"card": "_card_12jx5_1",
|
|
28
|
-
"info": "_info_12jx5_1",
|
|
29
|
-
"button": "_button_12jx5_1 _ds-button_14y6r_1",
|
|
30
|
-
"breadcrumbs": "_breadcrumbs_12jx5_1 _ds-breadcrumbs_14y6r_1",
|
|
31
|
-
"badge": "_badge_12jx5_1",
|
|
32
|
-
"avatar": "_avatar_12jx5_1 _ds-avatar_14y6r_1",
|
|
33
|
-
"alert": "_alert_12jx5_1 _ds-alert_14y6r_1",
|
|
34
|
-
"body": "_body_12jx5_84"
|
|
35
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
const _ = "_validation_12jx5_1 _ds-validation-message_14y6r_1", d = "_tag_12jx5_1 _ds-tag_14y6r_1", t = "_tabs_12jx5_1", o = "_table_12jx5_1 _ds-table_14y6r_1", s = "_scrollShadow_12jx5_1", a = "_tableChildAdded_12jx5_1", e = "_skeleton_12jx5_1 _ds-skeleton_14y6r_1", n = "_popover_12jx5_1", i = "_pagination_12jx5_1 _ds-pagination_14y6r_1", l = "_modal_12jx5_1 _ds-modal_14y6r_1", r = "_logo_12jx5_1 _ds-focus_14y6r_1", c = "_link_12jx5_1", x = "_grid_12jx5_1", j = "_flex_12jx5_1", b = "_box_12jx5_1", f = "_input_12jx5_1 _ds-input_14y6r_1", y = "_fieldset_12jx5_1 _ds-fieldset_14y6r_1", u = "_fieldsetValidationAdded_12jx5_1", p = "_field_12jx5_1 _ds-field_14y6r_1", g = "_fieldChildAdded_12jx5_1", m = "_affixes_12jx5_1 _ds-field-affixes_14y6r_1", h = "_count_12jx5_1", v = "_errorsummary_12jx5_1 _ds-error-summary_14y6r_1", A = "_details_12jx5_1 _ds-details_14y6r_1", k = "_chip_12jx5_1 _ds-chip_14y6r_1", C = "_card_12jx5_1", w = "_info_12jx5_1", S = "_button_12jx5_1 _ds-button_14y6r_1", V = "_breadcrumbs_12jx5_1 _ds-breadcrumbs_14y6r_1", q = "_badge_12jx5_1", z = "_avatar_12jx5_1 _ds-avatar_14y6r_1", B = "_alert_12jx5_1 _ds-alert_14y6r_1", D = "_body_12jx5_84", E = {
|
|
2
|
-
validation: _,
|
|
3
|
-
tag: d,
|
|
4
|
-
tabs: t,
|
|
5
|
-
table: o,
|
|
6
|
-
scrollShadow: s,
|
|
7
|
-
tableChildAdded: a,
|
|
8
|
-
skeleton: e,
|
|
9
|
-
popover: n,
|
|
10
|
-
pagination: i,
|
|
11
|
-
modal: l,
|
|
12
|
-
logo: r,
|
|
13
|
-
link: c,
|
|
14
|
-
grid: x,
|
|
15
|
-
flex: j,
|
|
16
|
-
box: b,
|
|
17
|
-
input: f,
|
|
18
|
-
fieldset: y,
|
|
19
|
-
fieldsetValidationAdded: u,
|
|
20
|
-
field: p,
|
|
21
|
-
fieldChildAdded: g,
|
|
22
|
-
affixes: m,
|
|
23
|
-
count: h,
|
|
24
|
-
errorsummary: v,
|
|
25
|
-
details: A,
|
|
26
|
-
chip: k,
|
|
27
|
-
card: C,
|
|
28
|
-
info: w,
|
|
29
|
-
button: S,
|
|
30
|
-
breadcrumbs: V,
|
|
31
|
-
badge: q,
|
|
32
|
-
avatar: z,
|
|
33
|
-
alert: B,
|
|
34
|
-
body: D
|
|
35
|
-
};
|
|
36
|
-
export {
|
|
37
|
-
m as affixes,
|
|
38
|
-
B as alert,
|
|
39
|
-
z as avatar,
|
|
40
|
-
q as badge,
|
|
41
|
-
D as body,
|
|
42
|
-
b as box,
|
|
43
|
-
V as breadcrumbs,
|
|
44
|
-
S as button,
|
|
45
|
-
C as card,
|
|
46
|
-
k as chip,
|
|
47
|
-
h as count,
|
|
48
|
-
E as default,
|
|
49
|
-
A as details,
|
|
50
|
-
v as errorsummary,
|
|
51
|
-
p as field,
|
|
52
|
-
g as fieldChildAdded,
|
|
53
|
-
y as fieldset,
|
|
54
|
-
u as fieldsetValidationAdded,
|
|
55
|
-
j as flex,
|
|
56
|
-
x as grid,
|
|
57
|
-
w as info,
|
|
58
|
-
f as input,
|
|
59
|
-
c as link,
|
|
60
|
-
r as logo,
|
|
61
|
-
l as modal,
|
|
62
|
-
i as pagination,
|
|
63
|
-
n as popover,
|
|
64
|
-
s as scrollShadow,
|
|
65
|
-
e as skeleton,
|
|
66
|
-
o as table,
|
|
67
|
-
a as tableChildAdded,
|
|
68
|
-
t as tabs,
|
|
69
|
-
d as tag,
|
|
70
|
-
_ as validation
|
|
71
|
-
};
|
|
72
|
-
//# sourceMappingURL=styles.module.css.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"styles.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/mtds/table/table.d.ts
DELETED
package/mtds/table/table.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import f from "../styles.module.css.js";
|
|
2
|
-
import { onAdd as d } from "../utils.js";
|
|
3
|
-
const i = f.table.split(" ")[0], l = /* @__PURE__ */ new WeakMap();
|
|
4
|
-
function b(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] || ":empty");
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
function u(t) {
|
|
18
|
-
const o = t.getElementsByClassName(i), e = d(f.tableChildAdded, () => b(o));
|
|
19
|
-
l.set(t, e), e.observe(t);
|
|
20
|
-
}
|
|
21
|
-
function y(t) {
|
|
22
|
-
var o;
|
|
23
|
-
(o = l.get(t)) == null || o.disconnect(t);
|
|
24
|
-
}
|
|
25
|
-
export {
|
|
26
|
-
u as observe,
|
|
27
|
-
y as unobserve
|
|
28
|
-
};
|
|
29
|
-
//# sourceMappingURL=table.js.map
|
package/mtds/table/table.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"table.js","sources":["../../designsystem/table/table.ts"],"sourcesContent":["import styles from '../styles.module.css';\nimport { 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] || ':empty'); // Using U+200B to prevent empty string from collapsing\n }\n }\n }\n }\n}\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","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,QAAQ;AAAA,EAGlE;AAEJ;AAEO,SAASC,EAASJ,GAAwB;AACzC,QAAAL,IAASK,EAAG,uBAAuBT,CAAS,GAC5Cc,IAAMC,EAAMd,EAAO,iBAAiB,MAAME,EAAQC,CAAM,CAAC;AACzD,EAAAF,EAAA,IAAIO,GAAIK,CAAG,GACjBA,EAAI,QAAQL,CAAE;AAChB;AAEO,SAASO,EAAWP,GAAwB;;AACjD,GAAAD,IAAAN,EAAM,IAAIO,CAAE,MAAZ,QAAAD,EAAe,WAAWC;AAC5B;"}
|
|
@@ -1,30 +0,0 @@
|
|
|
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 WithHorizontalTitles: Story;
|
|
22
|
-
export declare const FixedWidths: Story;
|
|
23
|
-
export declare const Align: Story;
|
|
24
|
-
export declare const NumericValues: Story;
|
|
25
|
-
export declare const WithFooter: Story;
|
|
26
|
-
export declare const Sizes: Story;
|
|
27
|
-
export declare const Checkbox: Story;
|
|
28
|
-
export declare const MobileScroll: Story;
|
|
29
|
-
export declare const MobileDivided: Story;
|
|
30
|
-
export declare const MobileSpaced: Story;
|
|
@@ -1,10 +0,0 @@
|
|
|
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 Sizes: Story;
|
|
9
|
-
export declare const WithIcons: Story;
|
|
10
|
-
export declare const WithTooltip: Story;
|
package/mtds/utils.d.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
export declare const IS_BROWSER: boolean;
|
|
2
|
-
export declare const QUICK_EVENT: {
|
|
3
|
-
capture: boolean;
|
|
4
|
-
passive: boolean;
|
|
5
|
-
};
|
|
6
|
-
export declare function useId(el: Element): string;
|
|
7
|
-
/**
|
|
8
|
-
* Speed up MutationObserver by debouncing and only running when page is visible
|
|
9
|
-
* @return new MutaionObserver
|
|
10
|
-
*/
|
|
11
|
-
export declare function createOptimizedMutationObserver(callback: MutationCallback): MutationObserver;
|
|
12
|
-
/**
|
|
13
|
-
* on
|
|
14
|
-
* @param element The Element to use as EventTarget
|
|
15
|
-
* @param types A comma separated string of event types
|
|
16
|
-
* @param listener An event listener function or listener object
|
|
17
|
-
*/
|
|
18
|
-
export declare const on: (element: Node | Window, type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined) => void;
|
|
19
|
-
/**
|
|
20
|
-
* off
|
|
21
|
-
* @param element The Element to use as EventTarget
|
|
22
|
-
* @param types A comma separated string of event types
|
|
23
|
-
* @param listener An event listener function or listener object
|
|
24
|
-
*/
|
|
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?: "" | "auto" | "manual" | undefined;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
package/mtds/utils.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
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
|
-
}
|
|
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));
|
|
14
|
-
};
|
|
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);
|
|
20
|
-
export {
|
|
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,
|
|
27
|
-
u as useId
|
|
28
|
-
};
|
|
29
|
-
//# sourceMappingURL=utils.js.map
|
package/mtds/utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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?: \"\" | \"auto\" | \"manual\" | undefined;\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;"}
|