@mattilsynet/design 0.3.8 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/mtds/alert/alert.d.ts +3 -1
  2. package/mtds/alert/alert.js +12 -0
  3. package/mtds/alert/alert.js.map +1 -0
  4. package/mtds/alert/alert.stories.d.ts +1 -1
  5. package/mtds/avatar/avatar.d.ts +1 -1
  6. package/mtds/avatar/avatar.js +12 -0
  7. package/mtds/avatar/avatar.js.map +1 -0
  8. package/mtds/avatar/avatar.stories.d.ts +1 -1
  9. package/mtds/badge/badge.d.ts +6 -6
  10. package/mtds/badge/badge.js +11 -0
  11. package/mtds/badge/badge.js.map +1 -0
  12. package/mtds/badge/badge.stories.d.ts +1 -1
  13. package/mtds/breadcrumbs/breadcrumbs.js +29 -0
  14. package/mtds/breadcrumbs/breadcrumbs.js.map +1 -0
  15. package/mtds/breadcrumbs/breadcrumbs.stories.d.ts +1 -1
  16. package/mtds/button/button.d.ts +5 -1
  17. package/mtds/button/button.js +12 -0
  18. package/mtds/button/button.js.map +1 -0
  19. package/mtds/button/button.stories.d.ts +2 -1
  20. package/mtds/card/card.d.ts +1 -1
  21. package/mtds/card/card.js +12 -0
  22. package/mtds/card/card.js.map +1 -0
  23. package/mtds/card/card.stories.d.ts +2 -2
  24. package/mtds/chip/chip.d.ts +10 -2
  25. package/mtds/chip/chip.js +12 -0
  26. package/mtds/chip/chip.js.map +1 -0
  27. package/mtds/chip/chip.stories.d.ts +3 -1
  28. package/mtds/details/details.d.ts +3 -2
  29. package/mtds/details/details.js +18 -0
  30. package/mtds/details/details.js.map +1 -0
  31. package/mtds/dialog/dialog.d.ts +2 -0
  32. package/mtds/dialog/dialog.js +25 -0
  33. package/mtds/dialog/dialog.js.map +1 -0
  34. package/mtds/divider/divider.d.ts +6 -2
  35. package/mtds/divider/divider.js +22 -0
  36. package/mtds/divider/divider.js.map +1 -0
  37. package/mtds/errorsummary/errorsummary.js +27 -0
  38. package/mtds/errorsummary/errorsummary.js.map +1 -0
  39. package/mtds/errorsummary/errorsummary.stories.d.ts +1 -1
  40. package/mtds/external/@u-elements/u-details/dist/u-details.js +91 -0
  41. package/mtds/external/@u-elements/u-details/dist/u-details.js.map +1 -0
  42. package/mtds/external/@u-elements/u-tabs/dist/u-tabs.js +185 -0
  43. package/mtds/external/@u-elements/u-tabs/dist/u-tabs.js.map +1 -0
  44. package/mtds/external/clsx/dist/clsx.js +18 -0
  45. package/mtds/external/clsx/dist/clsx.js.map +1 -0
  46. package/mtds/field/field-observer.js +33 -30
  47. package/mtds/field/field-observer.js.map +1 -1
  48. package/mtds/field/field.d.ts +21 -0
  49. package/mtds/field/field.js +44 -0
  50. package/mtds/field/field.js.map +1 -0
  51. package/mtds/field/field.stories.d.ts +2 -1
  52. package/mtds/fieldset/fieldset-observer.js +9 -10
  53. package/mtds/fieldset/fieldset-observer.js.map +1 -1
  54. package/mtds/fieldset/fieldset.js +20 -0
  55. package/mtds/fieldset/fieldset.js.map +1 -0
  56. package/mtds/fieldset/fieldset.stories.d.ts +1 -0
  57. package/mtds/heading/heading.d.ts +3 -1
  58. package/mtds/heading/heading.js +11 -0
  59. package/mtds/heading/heading.js.map +1 -0
  60. package/mtds/heading/heading.stories.d.ts +3 -1
  61. package/mtds/index.d.ts +3 -1
  62. package/mtds/index.iife.js +4 -1
  63. package/mtds/index.iife.js.map +1 -1
  64. package/mtds/index.js +20 -18
  65. package/mtds/index.js.map +1 -1
  66. package/mtds/input/input.d.ts +2 -0
  67. package/mtds/input/input.js +19 -0
  68. package/mtds/input/input.js.map +1 -0
  69. package/mtds/input/input.stories.d.ts +2 -1
  70. package/mtds/layout/layout-observer.js +12 -15
  71. package/mtds/layout/layout-observer.js.map +1 -1
  72. package/mtds/layout/layout.d.ts +18 -0
  73. package/mtds/layout/layout.js +14 -0
  74. package/mtds/layout/layout.js.map +1 -0
  75. package/mtds/layout/layout.stories.d.ts +4 -3
  76. package/mtds/link/link.js +11 -0
  77. package/mtds/link/link.js.map +1 -0
  78. package/mtds/link/link.stories.d.ts +1 -0
  79. package/mtds/logo/logo-observer.d.ts +2 -0
  80. package/mtds/logo/logo-observer.js +23 -0
  81. package/mtds/logo/logo-observer.js.map +1 -0
  82. package/mtds/logo/logo.d.ts +10 -0
  83. package/mtds/logo/logo.js +12 -0
  84. package/mtds/logo/logo.js.map +1 -0
  85. package/mtds/logo/logo.stories.d.ts +10 -2
  86. package/mtds/pagination/pagination-helper.d.ts +13 -0
  87. package/mtds/pagination/pagination-helper.js +16 -0
  88. package/mtds/pagination/pagination-helper.js.map +1 -0
  89. package/mtds/pagination/pagination.d.ts +2 -13
  90. package/mtds/pagination/pagination.js +18 -17
  91. package/mtds/pagination/pagination.js.map +1 -1
  92. package/mtds/pagination/pagination.stories.d.ts +1 -0
  93. package/mtds/popover/popover-observer.js +15 -11
  94. package/mtds/popover/popover-observer.js.map +1 -1
  95. package/mtds/popover/popover.d.ts +8 -0
  96. package/mtds/popover/popover.js +19 -0
  97. package/mtds/popover/popover.js.map +1 -0
  98. package/mtds/popover/popover.stories.d.ts +1 -0
  99. package/mtds/react-types.d.ts +9 -1
  100. package/mtds/react.d.ts +13 -0
  101. package/mtds/react.js +57 -0
  102. package/mtds/react.js.map +1 -0
  103. package/mtds/skeleton/skeleton.d.ts +10 -0
  104. package/mtds/skeleton/skeleton.js +12 -0
  105. package/mtds/skeleton/skeleton.js.map +1 -0
  106. package/mtds/skeleton/skeleton.stories.d.ts +1 -0
  107. package/mtds/spinner/spinner.d.ts +6 -0
  108. package/mtds/spinner/spinner.js +13 -0
  109. package/mtds/spinner/spinner.js.map +1 -0
  110. package/mtds/spinner/spinner.stories.d.ts +2 -1
  111. package/mtds/styles.css +1 -1
  112. package/mtds/styles.json +33 -31
  113. package/mtds/styles.module.css.js +70 -68
  114. package/mtds/styles.module.css.js.map +1 -1
  115. package/mtds/table/table-observer.js +19 -16
  116. package/mtds/table/table-observer.js.map +1 -1
  117. package/mtds/table/table.d.ts +12 -0
  118. package/mtds/table/table.js +11 -0
  119. package/mtds/table/table.js.map +1 -0
  120. package/mtds/table/table.stories.d.ts +2 -1
  121. package/mtds/tabs/tabs.d.ts +10 -0
  122. package/mtds/tabs/tabs.js +28 -0
  123. package/mtds/tabs/tabs.js.map +1 -0
  124. package/mtds/tabs/tabs.stories.d.ts +1 -0
  125. package/mtds/tag/tag.d.ts +6 -0
  126. package/mtds/tag/tag.js +11 -0
  127. package/mtds/tag/tag.js.map +1 -0
  128. package/mtds/tag/tag.stories.d.ts +2 -1
  129. package/mtds/tooltip/tooltip-observer.js +22 -16
  130. package/mtds/tooltip/tooltip-observer.js.map +1 -1
  131. package/mtds/tooltip/tooltip.stories.d.ts +11 -0
  132. package/mtds/utils.js +19 -19
  133. package/mtds/validation/validation.d.ts +2 -0
  134. package/mtds/validation/validation.js +13 -0
  135. package/mtds/validation/validation.js.map +1 -0
  136. package/mtds/validation/validation.stories.d.ts +1 -0
  137. package/package.json +26 -22
package/mtds/styles.json CHANGED
@@ -1,33 +1,35 @@
1
1
  {
2
- "alert": "_alert_1drby_1 _ds-alert_1w6ss_1",
3
- "avatar": "_avatar_1drby_1 _ds-avatar_1w6ss_1",
4
- "badge": "_badge_1drby_1",
5
- "breadcrumbs": "_breadcrumbs_1drby_1 _ds-breadcrumbs_1w6ss_1",
6
- "button": "_button_1drby_1 _ds-button_1w6ss_1",
7
- "card": "_card_1drby_1",
8
- "chip": "_chip_1drby_1 _ds-chip_1w6ss_1",
9
- "details": "_details_1drby_1 _ds-details_1w6ss_1",
10
- "dialog": "_dialog_1drby_1 _ds-modal_1w6ss_1",
11
- "divider": "_divider_1drby_1",
12
- "errorsummary": "_errorsummary_1drby_1 _ds-error-summary_1w6ss_1",
13
- "field": "_field_1drby_1 _ds-field_1w6ss_1",
14
- "affixes": "_affixes_1drby_1 _ds-field-affixes_1w6ss_1",
15
- "count": "_count_1drby_1",
16
- "fieldset": "_fieldset_1drby_1 _ds-fieldset_1w6ss_1",
17
- "heading": "_heading_1drby_1 _ds-heading_1w6ss_1",
18
- "input": "_input_1drby_1 _ds-input_1w6ss_1",
19
- "grid": "_grid_1drby_1",
20
- "flex": "_flex_1drby_1",
21
- "app": "_app_1drby_1",
22
- "link": "_link_1drby_1",
23
- "logo": "_logo_1drby_1 _ds-focus_1w6ss_1",
24
- "pagination": "_pagination_1drby_1 _ds-pagination_1w6ss_1",
25
- "popover": "_popover_1drby_1",
26
- "skeleton": "_skeleton_1drby_1 _ds-skeleton_1w6ss_1",
27
- "spinner": "_spinner_1drby_1",
28
- "table": "_table_1drby_1 _ds-table_1w6ss_1",
29
- "tabs": "_tabs_1drby_1 _ds-tabs_1w6ss_1",
30
- "tag": "_tag_1drby_1 _ds-tag_1w6ss_1",
31
- "validation": "_validation_1drby_1 _ds-validation-message_1w6ss_1",
32
- "body": "_body_1drby_143"
2
+ "alert": "_alert_14ty1_1 _ds-alert_194o1_1",
3
+ "avatar": "_avatar_14ty1_1 _ds-avatar_194o1_1",
4
+ "badge": "_badge_14ty1_1",
5
+ "breadcrumbs": "_breadcrumbs_14ty1_1 _ds-breadcrumbs_194o1_1",
6
+ "button": "_button_14ty1_1 _ds-button_194o1_1",
7
+ "card": "_card_14ty1_1",
8
+ "group": "_group_14ty1_1",
9
+ "chip": "_chip_14ty1_1 _ds-chip_194o1_1",
10
+ "details": "_details_14ty1_1 _ds-details_194o1_1",
11
+ "dialog": "_dialog_14ty1_1 _ds-dialog_194o1_1",
12
+ "divider": "_divider_14ty1_1",
13
+ "errorsummary": "_errorsummary_14ty1_1 _ds-error-summary_194o1_1",
14
+ "field": "_field_14ty1_1 _ds-field_194o1_1",
15
+ "affixes": "_affixes_14ty1_1 _ds-field-affixes_194o1_1",
16
+ "count": "_count_14ty1_1",
17
+ "fieldset": "_fieldset_14ty1_1 _ds-fieldset_194o1_1",
18
+ "heading": "_heading_14ty1_1 _ds-heading_194o1_1",
19
+ "stack": "_stack_14ty1_1",
20
+ "input": "_input_14ty1_1 _ds-input_194o1_1",
21
+ "grid": "_grid_14ty1_1",
22
+ "flex": "_flex_14ty1_1",
23
+ "app": "_app_14ty1_1",
24
+ "link": "_link_14ty1_1",
25
+ "logo": "_logo_14ty1_1",
26
+ "pagination": "_pagination_14ty1_1 _ds-pagination_194o1_1",
27
+ "popover": "_popover_14ty1_1",
28
+ "skeleton": "_skeleton_14ty1_1 _ds-skeleton_194o1_1",
29
+ "spinner": "_spinner_14ty1_1",
30
+ "table": "_table_14ty1_1 _ds-table_194o1_1",
31
+ "tabs": "_tabs_14ty1_1 _ds-tabs_194o1_1",
32
+ "tag": "_tag_14ty1_1 _ds-tag_194o1_1",
33
+ "validation": "_validation_14ty1_1 _ds-validation-message_194o1_1",
34
+ "body": "_body_14ty1_136"
33
35
  }
@@ -1,74 +1,76 @@
1
- const _ = "_alert_1drby_1 _ds-alert_1w6ss_1", s = "_avatar_1drby_1 _ds-avatar_1w6ss_1", d = "_badge_1drby_1", t = "_breadcrumbs_1drby_1 _ds-breadcrumbs_1w6ss_1", o = "_button_1drby_1 _ds-button_1w6ss_1", a = "_card_1drby_1", r = "_chip_1drby_1 _ds-chip_1w6ss_1", n = "_details_1drby_1 _ds-details_1w6ss_1", e = "_dialog_1drby_1 _ds-modal_1w6ss_1", i = "__fadein_1drby_1", b = "_divider_1drby_1", c = "_errorsummary_1drby_1 _ds-error-summary_1w6ss_1", l = "_field_1drby_1 _ds-field_1w6ss_1", y = "_affixes_1drby_1 _ds-field-affixes_1w6ss_1", p = "_count_1drby_1", f = "_fieldset_1drby_1 _ds-fieldset_1w6ss_1", g = "_heading_1drby_1 _ds-heading_1w6ss_1", w = "_input_1drby_1 _ds-input_1w6ss_1", u = "_grid_1drby_1", m = "_flex_1drby_1", v = "_app_1drby_1", h = "_link_1drby_1", x = "_logo_1drby_1 _ds-focus_1w6ss_1", k = "_pagination_1drby_1 _ds-pagination_1w6ss_1", S = "_popover_1drby_1", j = "_skeleton_1drby_1 _ds-skeleton_1w6ss_1", q = "_spinner_1drby_1", z = "_table_1drby_1 _ds-table_1w6ss_1", A = "__scrollShadow_1drby_1", B = "_tabs_1drby_1 _ds-tabs_1w6ss_1", C = "_tag_1drby_1 _ds-tag_1w6ss_1", D = "__tooltip_1drby_1", E = "_validation_1drby_1 _ds-validation-message_1w6ss_1", F = "_body_1drby_143", G = {
1
+ const _ = "_alert_14ty1_1 _ds-alert_194o1_1", t = "_avatar_14ty1_1 _ds-avatar_194o1_1", o = "_badge_14ty1_1", s = "_breadcrumbs_14ty1_1 _ds-breadcrumbs_194o1_1", a = "_button_14ty1_1 _ds-button_194o1_1", n = "_card_14ty1_1", d = "_group_14ty1_1", e = "_chip_14ty1_1 _ds-chip_194o1_1", i = "_details_14ty1_1 _ds-details_194o1_1", c = "_dialog_14ty1_1 _ds-dialog_194o1_1", r = "_divider_14ty1_1", l = "_errorsummary_14ty1_1 _ds-error-summary_194o1_1", y = "_field_14ty1_1 _ds-field_194o1_1", p = "_affixes_14ty1_1 _ds-field-affixes_194o1_1", g = "_count_14ty1_1", b = "_fieldset_14ty1_1 _ds-fieldset_194o1_1", u = "_heading_14ty1_1 _ds-heading_194o1_1", f = "_stack_14ty1_1", v = "_input_14ty1_1 _ds-input_194o1_1", m = "_grid_14ty1_1", h = "_flex_14ty1_1", k = "_app_14ty1_1", x = "_link_14ty1_1", w = "_logo_14ty1_1", S = "_pagination_14ty1_1 _ds-pagination_194o1_1", j = "_popover_14ty1_1", q = "_skeleton_14ty1_1 _ds-skeleton_194o1_1", z = "_spinner_14ty1_1", A = "_table_14ty1_1 _ds-table_194o1_1", B = "__scrollShadow_14ty1_1", C = "_tabs_14ty1_1 _ds-tabs_194o1_1", D = "_tag_14ty1_1 _ds-tag_194o1_1", E = "__tooltip_14ty1_1", F = "_validation_14ty1_1 _ds-validation-message_194o1_1", G = "_body_14ty1_136", H = {
2
2
  alert: _,
3
- avatar: s,
4
- badge: d,
5
- breadcrumbs: t,
6
- button: o,
7
- card: a,
8
- chip: r,
9
- details: n,
10
- dialog: e,
11
- _fadein: i,
12
- divider: b,
13
- errorsummary: c,
14
- field: l,
15
- affixes: y,
16
- count: p,
17
- fieldset: f,
18
- heading: g,
19
- input: w,
20
- grid: u,
21
- flex: m,
22
- app: v,
23
- link: h,
24
- logo: x,
25
- pagination: k,
26
- popover: S,
27
- skeleton: j,
28
- spinner: q,
29
- table: z,
30
- _scrollShadow: A,
31
- tabs: B,
32
- tag: C,
33
- _tooltip: D,
34
- validation: E,
35
- body: F
3
+ avatar: t,
4
+ badge: o,
5
+ breadcrumbs: s,
6
+ button: a,
7
+ card: n,
8
+ group: d,
9
+ chip: e,
10
+ details: i,
11
+ dialog: c,
12
+ divider: r,
13
+ errorsummary: l,
14
+ field: y,
15
+ affixes: p,
16
+ count: g,
17
+ fieldset: b,
18
+ heading: u,
19
+ stack: f,
20
+ input: v,
21
+ grid: m,
22
+ flex: h,
23
+ app: k,
24
+ link: x,
25
+ logo: w,
26
+ pagination: S,
27
+ popover: j,
28
+ skeleton: q,
29
+ spinner: z,
30
+ table: A,
31
+ _scrollShadow: B,
32
+ tabs: C,
33
+ tag: D,
34
+ _tooltip: E,
35
+ validation: F,
36
+ body: G
36
37
  };
37
38
  export {
38
- i as _fadein,
39
- A as _scrollShadow,
40
- D as _tooltip,
41
- y as affixes,
39
+ B as _scrollShadow,
40
+ E as _tooltip,
41
+ p as affixes,
42
42
  _ as alert,
43
- v as app,
44
- s as avatar,
45
- d as badge,
46
- F as body,
47
- t as breadcrumbs,
48
- o as button,
49
- a as card,
50
- r as chip,
51
- p as count,
52
- G as default,
53
- n as details,
54
- e as dialog,
55
- b as divider,
56
- c as errorsummary,
57
- l as field,
58
- f as fieldset,
59
- m as flex,
60
- u as grid,
61
- g as heading,
62
- w as input,
63
- h as link,
64
- x as logo,
65
- k as pagination,
66
- S as popover,
67
- j as skeleton,
68
- q as spinner,
69
- z as table,
70
- B as tabs,
71
- C as tag,
72
- E as validation
43
+ k as app,
44
+ t as avatar,
45
+ o as badge,
46
+ G as body,
47
+ s as breadcrumbs,
48
+ a as button,
49
+ n as card,
50
+ e as chip,
51
+ g as count,
52
+ H as default,
53
+ i as details,
54
+ c as dialog,
55
+ r as divider,
56
+ l as errorsummary,
57
+ y as field,
58
+ b as fieldset,
59
+ h as flex,
60
+ m as grid,
61
+ d as group,
62
+ u as heading,
63
+ v as input,
64
+ x as link,
65
+ w as logo,
66
+ S as pagination,
67
+ j as popover,
68
+ q as skeleton,
69
+ z as spinner,
70
+ f as stack,
71
+ A as table,
72
+ C as tabs,
73
+ D as tag,
74
+ F as validation
73
75
  };
74
76
  //# 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,22 +1,25 @@
1
1
  import i from "../styles.module.css.js";
2
- import { onMutation as f, attr as m } from "../utils.js";
3
- const l = i.table.split(" ")[0];
4
- function b(o) {
5
- var r, n;
6
- for (const e of o) if (e instanceof HTMLTableElement) {
7
- const a = Array.from(((n = (r = e.tHead) == null ? void 0 : r.rows[0]) == null ? void 0 : n.cells) || [], (s) => {
8
- var t;
9
- return (t = s.innerText) == null ? void 0 : t.trim();
10
- });
11
- for (const s of e.tBodies)
12
- for (const t of s.rows)
13
- for (const c of t.cells)
14
- m(c, "data-th", a[c.cellIndex] || ":empty");
2
+ import { onMutation as a, attr as o } from "../utils.js";
3
+ const f = i.table.split(" ")[0];
4
+ function p(r) {
5
+ for (const t of r) {
6
+ const n = [];
7
+ o(t, "role", "table"), t.caption && o(t.caption, "role", "caption");
8
+ for (const s of [t.tHead, t.tFoot, ...t.tBodies])
9
+ if (s) {
10
+ o(s, "role", "rowgroup");
11
+ const l = s.nodeName === "TBODY";
12
+ for (const c of s.rows) {
13
+ o(c, "role", "row");
14
+ for (const e of c.cells)
15
+ l ? o(e, "data-th", n[e.cellIndex] || ":empty") : n.push(e.innerText.trim()), e.nodeName === "TD" ? o(e, "role", "cell") : (o(e, "role", l ? "rowheader" : "columnheader"), o(e, "scope", l ? "row" : "col"));
16
+ }
17
+ }
15
18
  }
16
19
  }
17
- const y = (o) => f(o, l, b), T = (o) => f(o, l, !1);
20
+ const u = (r) => a(r, f, p), b = (r) => a(r, f, !1);
18
21
  export {
19
- y as observe,
20
- T as unobserve
22
+ u as observe,
23
+ b as unobserve
21
24
  };
22
25
  //# sourceMappingURL=table-observer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"table-observer.js","sources":["../../designsystem/table/table-observer.ts"],"sourcesContent":["import styles from '../styles.module.css';\nimport { attr, onMutation } from '../utils';\nconst CSS_TABLE = styles.table.split(' ')[0];\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 attr(cell, 'data-th', ths[cell.cellIndex] || ':empty');\n }\n }\n }\n }\n}\n\nexport const observe = (el: Element) => onMutation(el, CSS_TABLE, process);\nexport const unobserve = (el: Element) => onMutation(el, CSS_TABLE, false);\n"],"names":["CSS_TABLE","styles","process","tables","table","ths","_b","_a","el","tbody","row","cell","attr","observe","onMutation","unobserve"],"mappings":";;AAEA,MAAMA,IAAYC,EAAO,MAAM,MAAM,GAAG,EAAE,CAAC;AAE3C,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,UAAAE,EAAKD,GAAM,WAAWN,EAAIM,EAAK,SAAS,KAAK,QAAQ;AAAA,EAG3D;AAEJ;AAEO,MAAME,IAAU,CAACL,MAAgBM,EAAWN,GAAIR,GAAWE,CAAO,GAC5Da,IAAY,CAACP,MAAgBM,EAAWN,GAAIR,GAAW,EAAK;"}
1
+ {"version":3,"file":"table-observer.js","sources":["../../designsystem/table/table-observer.ts"],"sourcesContent":["import styles from \"../styles.module.css\";\nimport { attr, onMutation } from \"../utils\";\nconst CSS_TABLE = styles.table.split(\" \")[0];\n\nfunction process(tables: HTMLCollectionOf<Element>) {\n for (const table of tables as HTMLCollectionOf<HTMLTableElement>) {\n const ths: string[] = []; // Add data-th=\"\" to each cell to support data-mobile designs\n\n attr(table, \"role\", \"table\"); // Add helping role=\"\" to ensure screen readers understand the table regardless of CSS display\n if (table.caption) attr(table.caption, \"role\", \"caption\");\n for (const group of [table.tHead, table.tFoot, ...table.tBodies])\n if (group) {\n attr(group, \"role\", \"rowgroup\");\n const isTbody = group.nodeName === \"TBODY\";\n\n for (const row of group.rows) {\n attr(row, \"role\", \"row\");\n for (const cell of row.cells) {\n if (isTbody) attr(cell, \"data-th\", ths[cell.cellIndex] || \":empty\");\n else ths.push(cell.innerText.trim()); // Using innerText to only include visible text\n if (cell.nodeName === \"TD\") attr(cell, \"role\", \"cell\");\n else {\n attr(cell, \"role\", isTbody ? \"rowheader\" : \"columnheader\");\n attr(cell, \"scope\", isTbody ? \"row\" : \"col\");\n }\n }\n }\n }\n }\n}\n\nexport const observe = (el: Element) => onMutation(el, CSS_TABLE, process);\nexport const unobserve = (el: Element) => onMutation(el, CSS_TABLE, false);\n"],"names":["CSS_TABLE","styles","process","tables","table","ths","attr","group","isTbody","row","cell","observe","el","onMutation","unobserve"],"mappings":";;AAEA,MAAMA,IAAYC,EAAO,MAAM,MAAM,GAAG,EAAE,CAAC;AAE3C,SAASC,EAAQC,GAAmC;AAClD,aAAWC,KAASD,GAA8C;AAChE,UAAME,IAAgB,CAAC;AAElB,IAAAC,EAAAF,GAAO,QAAQ,OAAO,GACvBA,EAAM,WAASE,EAAKF,EAAM,SAAS,QAAQ,SAAS;AAC7C,eAAAG,KAAS,CAACH,EAAM,OAAOA,EAAM,OAAO,GAAGA,EAAM,OAAO;AAC7D,UAAIG,GAAO;AACJ,QAAAD,EAAAC,GAAO,QAAQ,UAAU;AACxB,cAAAC,IAAUD,EAAM,aAAa;AAExB,mBAAAE,KAAOF,EAAM,MAAM;AACvB,UAAAD,EAAAG,GAAK,QAAQ,KAAK;AACZ,qBAAAC,KAAQD,EAAI;AACjB,YAAAD,MAAcE,GAAM,WAAWL,EAAIK,EAAK,SAAS,KAAK,QAAQ,IACzDL,EAAA,KAAKK,EAAK,UAAU,MAAM,GAC/BA,EAAK,aAAa,OAAWJ,EAAAI,GAAM,QAAQ,MAAM,KAEnDJ,EAAKI,GAAM,QAAQF,IAAU,cAAc,cAAc,GACzDF,EAAKI,GAAM,SAASF,IAAU,QAAQ,KAAK;AAAA,QAE/C;AAAA,MACF;AAAA,EACF;AAEN;AAEO,MAAMG,IAAU,CAACC,MAAgBC,EAAWD,GAAIZ,GAAWE,CAAO,GAC5DY,IAAY,CAACF,MAAgBC,EAAWD,GAAIZ,GAAW,EAAK;"}
@@ -0,0 +1,12 @@
1
+ export type TableProps = React.ComponentPropsWithoutRef<"table"> & {
2
+ "data-align"?: "start | center";
3
+ "data-border"?: boolean;
4
+ "data-fixed"?: boolean;
5
+ "data-mobile"?: "divided" | "spaced" | "stacked";
6
+ };
7
+ export declare const Table: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, "ref"> & {
8
+ "data-align"?: "start | center";
9
+ "data-border"?: boolean;
10
+ "data-fixed"?: boolean;
11
+ "data-mobile"?: "divided" | "spaced" | "stacked";
12
+ } & React.RefAttributes<HTMLTableElement>>;
@@ -0,0 +1,11 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import { clsx as m } from "../external/clsx/dist/clsx.js";
3
+ import { forwardRef as a } from "react";
4
+ import f from "../styles.module.css.js";
5
+ const c = a(function({ className: r, ...o }, t) {
6
+ return /* @__PURE__ */ e("table", { className: m(f.table, r), ref: t, ...o });
7
+ });
8
+ export {
9
+ c as Table
10
+ };
11
+ //# sourceMappingURL=table.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table.js","sources":["../../designsystem/table/table.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef } from \"react\";\nimport styles from \"../styles.module.css\";\n\nexport type TableProps = React.ComponentPropsWithoutRef<\"table\"> & {\n\t\"data-align\"?: \"start | center\";\n\t\"data-border\"?: boolean;\n\t\"data-fixed\"?: boolean;\n\t\"data-mobile\"?: \"divided\" | \"spaced\" | \"stacked\";\n};\n\nexport const Table = forwardRef<HTMLTableElement, TableProps>(function Table(\n\t{ className, ...rest },\n\tref,\n) {\n\treturn (\n\t\t<table className={clsx(styles.table, className)} ref={ref} {...rest} />\n\t);\n});\n"],"names":["Table","forwardRef","className","rest","ref","jsx","clsx","styles"],"mappings":";;;;AAWa,MAAAA,IAAQC,EAAyC,SAC7D,EAAE,WAAAC,GAAW,GAAGC,EAAK,GACrBC,GACC;AAEA,SAAA,gBAAAC,EAAC,SAAM,EAAA,WAAWC,EAAKC,EAAO,OAAOL,CAAS,GAAG,KAAAE,GAAW,GAAGD,EAAM,CAAA;AAEvE,CAAC;"}
@@ -1,13 +1,14 @@
1
1
  import { StoryObj } from '@storybook/react';
2
2
  declare const meta: {
3
3
  title: string;
4
- decorators: ((Story: import('@storybook/csf').PartialStoryFn<import('@storybook/react').ReactRenderer, {
4
+ decorators: ((Story: import('@storybook/core/csf').PartialStoryFn<import('@storybook/react').ReactRenderer, {
5
5
  [x: string]: any;
6
6
  }>) => import("react/jsx-runtime").JSX.Element)[];
7
7
  };
8
8
  export default meta;
9
9
  type Story = StoryObj<typeof meta>;
10
10
  export declare const Default: Story;
11
+ export declare const React: Story;
11
12
  export declare const DefaultTanstack: Story;
12
13
  export declare const HeadingsSimple: Story;
13
14
  export declare const HeadingsTanstack: Story;
@@ -0,0 +1,10 @@
1
+ import type * as UTabs from "@u-elements/u-tabs";
2
+ export type TabsProps = UTabs.ReactUtabs;
3
+ export type TabsListProps = UTabs.ReactUtablist;
4
+ export type TabsPanelProps = UTabs.ReactUtabpanel;
5
+ export type TabsTabProps = UTabs.ReactUtab;
6
+ export declare const Tabs: React.ForwardRefExoticComponent<Omit<UTabs.ReactUtabs, "ref"> & React.RefAttributes<UTabs.UHTMLTabsElement>> & {
7
+ List: React.ForwardRefExoticComponent<Omit<UTabs.ReactUtablist, "ref"> & React.RefAttributes<UTabs.UHTMLTabListElement>>;
8
+ Panel: React.ForwardRefExoticComponent<Omit<UTabs.ReactUtabpanel, "ref"> & React.RefAttributes<UTabs.UHTMLTabPanelElement>>;
9
+ Tab: React.ForwardRefExoticComponent<Omit<UTabs.ReactUtab, "ref"> & React.RefAttributes<UTabs.UHTMLTabElement>>;
10
+ };
@@ -0,0 +1,28 @@
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { clsx as b } from "../external/clsx/dist/clsx.js";
3
+ import { forwardRef as o } from "react";
4
+ import c from "../styles.module.css.js";
5
+ import "../external/@u-elements/u-tabs/dist/u-tabs.js";
6
+ const i = o(function({ className: s, ...t }, a) {
7
+ return /* @__PURE__ */ n("u-tabs", { class: b(c.tabs, s), ref: a, ...t });
8
+ }), e = o(
9
+ function({ className: s, ...t }, a) {
10
+ return /* @__PURE__ */ n("u-tablist", { class: s, ref: a, ...t });
11
+ }
12
+ ), u = o(
13
+ function({ className: s, ...t }, a) {
14
+ return /* @__PURE__ */ n("u-tabpanel", { class: s, ref: a, ...t });
15
+ }
16
+ ), T = o(
17
+ function({ className: s, ...t }, a) {
18
+ return /* @__PURE__ */ n("u-tab", { class: s, ref: a, ...t });
19
+ }
20
+ ), L = Object.assign(i, {
21
+ List: e,
22
+ Panel: u,
23
+ Tab: T
24
+ });
25
+ export {
26
+ L as Tabs
27
+ };
28
+ //# sourceMappingURL=tabs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tabs.js","sources":["../../designsystem/tabs/tabs.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef } from \"react\";\nimport styles from \"../styles.module.css\";\nimport \"@u-elements/u-tabs\";\nimport type * as UTabs from \"@u-elements/u-tabs\";\n\nexport type TabsProps = UTabs.ReactUtabs;\nconst TabsComp = forwardRef<UTabs.UHTMLTabsElement, TabsProps>(function Tabs(\n\t{ className, ...rest },\n\tref,\n) {\n\treturn <u-tabs class={clsx(styles.tabs, className)} ref={ref} {...rest} />;\n});\n\nexport type TabsListProps = UTabs.ReactUtablist;\nconst TabsList = forwardRef<UTabs.UHTMLTabListElement, TabsListProps>(\n\tfunction TabsList({ className, ...rest }, ref) {\n\t\treturn <u-tablist class={className} ref={ref} {...rest} />;\n\t},\n);\n\nexport type TabsPanelProps = UTabs.ReactUtabpanel;\nconst TabsPanel = forwardRef<UTabs.UHTMLTabPanelElement, TabsPanelProps>(\n\tfunction TabsPanel({ className, ...rest }, ref) {\n\t\treturn <u-tabpanel class={className} ref={ref} {...rest} />;\n\t},\n);\n\nexport type TabsTabProps = UTabs.ReactUtab;\nconst TabsTab = forwardRef<UTabs.UHTMLTabElement, TabsTabProps>(\n\tfunction TabsTab({ className, ...rest }, ref) {\n\t\treturn <u-tab class={className} ref={ref} {...rest} />;\n\t},\n);\n\nexport const Tabs = Object.assign(TabsComp, {\n\tList: TabsList,\n\tPanel: TabsPanel,\n\tTab: TabsTab,\n});\n"],"names":["TabsComp","forwardRef","className","rest","ref","jsx","clsx","styles","TabsList","TabsPanel","TabsTab","Tabs"],"mappings":";;;;;AAOA,MAAMA,IAAWC,EAA8C,SAC9D,EAAE,WAAAC,GAAW,GAAGC,EAAK,GACrBC,GACC;AACM,SAAA,gBAAAC,EAAC,UAAO,EAAA,OAAOC,EAAKC,EAAO,MAAML,CAAS,GAAG,KAAAE,GAAW,GAAGD,EAAM,CAAA;AACzE,CAAC,GAGKK,IAAWP;AAAA,EAChB,SAAkB,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAAQC,GAAK;AAC9C,6BAAQ,aAAU,EAAA,OAAOF,GAAW,KAAAE,GAAW,GAAGD,GAAM;AAAA,EAAA;AAE1D,GAGMM,IAAYR;AAAA,EACjB,SAAmB,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAAQC,GAAK;AAC/C,6BAAQ,cAAW,EAAA,OAAOF,GAAW,KAAAE,GAAW,GAAGD,GAAM;AAAA,EAAA;AAE3D,GAGMO,IAAUT;AAAA,EACf,SAAiB,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAAQC,GAAK;AAC7C,6BAAQ,SAAM,EAAA,OAAOF,GAAW,KAAAE,GAAW,GAAGD,GAAM;AAAA,EAAA;AAEtD,GAEaQ,IAAO,OAAO,OAAOX,GAAU;AAAA,EAC3C,MAAMQ;AAAA,EACN,OAAOC;AAAA,EACP,KAAKC;AACN,CAAC;"}
@@ -5,4 +5,5 @@ declare const meta: {
5
5
  export default meta;
6
6
  type Story = StoryObj<typeof meta>;
7
7
  export declare const Default: Story;
8
+ export declare const React: Story;
8
9
  export declare const Sizes: Story;
@@ -0,0 +1,6 @@
1
+ export type TagProps = React.ComponentPropsWithoutRef<"span"> & {
2
+ "data-color"?: "neutral" | "info" | "success" | "warning" | "danger";
3
+ };
4
+ export declare const Tag: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
5
+ "data-color"?: "neutral" | "info" | "success" | "warning" | "danger";
6
+ } & React.RefAttributes<HTMLSpanElement>>;
@@ -0,0 +1,11 @@
1
+ import { jsx as m } from "react/jsx-runtime";
2
+ import { clsx as s } from "../external/clsx/dist/clsx.js";
3
+ import { forwardRef as a } from "react";
4
+ import f from "../styles.module.css.js";
5
+ const g = a(function({ className: r, ...o }, t) {
6
+ return /* @__PURE__ */ m("span", { className: s(f.tag, r), ref: t, ...o });
7
+ });
8
+ export {
9
+ g as Tag
10
+ };
11
+ //# sourceMappingURL=tag.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tag.js","sources":["../../designsystem/tag/tag.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef } from \"react\";\nimport styles from \"../styles.module.css\";\n\nexport type TagProps = React.ComponentPropsWithoutRef<\"span\"> & {\n\t\"data-color\"?: \"neutral\" | \"info\" | \"success\" | \"warning\" | \"danger\";\n};\n\nexport const Tag = forwardRef<HTMLSpanElement, TagProps>(function Tag(\n\t{ className, ...rest },\n\tref,\n) {\n\treturn <span className={clsx(styles.tag, className)} ref={ref} {...rest} />;\n});\n"],"names":["Tag","forwardRef","className","rest","ref","jsx","clsx","styles"],"mappings":";;;;AAQa,MAAAA,IAAMC,EAAsC,SACxD,EAAE,WAAAC,GAAW,GAAGC,EAAK,GACrBC,GACC;AACM,SAAA,gBAAAC,EAAC,QAAK,EAAA,WAAWC,EAAKC,EAAO,KAAKL,CAAS,GAAG,KAAAE,GAAW,GAAGD,EAAM,CAAA;AAC1E,CAAC;"}
@@ -1,13 +1,14 @@
1
1
  import { StoryObj } from '@storybook/react';
2
2
  declare const meta: {
3
3
  title: string;
4
- decorators: ((Story: import('@storybook/csf').PartialStoryFn<import('@storybook/react').ReactRenderer, {
4
+ decorators: ((Story: import('@storybook/core/csf').PartialStoryFn<import('@storybook/react').ReactRenderer, {
5
5
  [x: string]: any;
6
6
  }>) => import("react/jsx-runtime").JSX.Element)[];
7
7
  };
8
8
  export default meta;
9
9
  type Story = StoryObj<typeof meta>;
10
10
  export declare const Default: Story;
11
+ export declare const React: Story;
11
12
  export declare const Sizes: Story;
12
13
  export declare const WithIcon: Story;
13
14
  export declare const WithIconOverwrite: Story;
@@ -1,19 +1,25 @@
1
- import L from "../styles.module.css.js";
2
- import { IS_BROWSER as f, attr as w, on as d, QUICK_EVENT as m, anchorPosition as p } from "../utils.js";
3
- const S = L._tooltip.split(" "), r = "aria-describedby", b = "Escape", s = "aria-labelledby", _ = "--mtds-tooltip-position", y = 100, u = "mtds-tooltip";
4
- let o = null, E = Number.NEGATIVE_INFINITY, c = 0, e = null;
5
- function T({ target: i, type: t, key: l }) {
6
- if (t === "keydown" && l !== b) return;
7
- const n = E + y - Date.now();
8
- clearTimeout(c), c = setTimeout(A, Math.max(n, 0), l === b ? null : i);
1
+ import w from "../styles.module.css.js";
2
+ import { IS_BROWSER as O, attr as l, on as a, QUICK_EVENT as c, anchorPosition as p } from "../utils.js";
3
+ const S = w._tooltip.split(" "), r = "aria-describedby", E = "Escape", d = "aria-labelledby", _ = "--mtds-tooltip-position", y = 300, u = "mtds-tooltip";
4
+ let e = null, L = Number.NEGATIVE_INFINITY, b = 0, o = null;
5
+ function m({ target: n, type: t, key: i }) {
6
+ if (t === "keydown" && i !== E) return;
7
+ const s = L + y - Date.now();
8
+ clearTimeout(b), b = setTimeout(
9
+ P,
10
+ Math.max(s, 0),
11
+ i === E ? null : n
12
+ );
9
13
  }
10
- function A(i) {
11
- var a;
12
- if (E = Date.now(), !e || i === e) return;
13
- let t = ((a = i == null ? void 0 : i.closest) == null ? void 0 : a.call(i, "[data-tooltip]")) || null;
14
- if (t === o) return;
15
- const l = (t == null ? void 0 : t.getAttribute("data-tooltip")) || "", n = (t == null ? void 0 : t.getAttribute("data-tooltip-position")) || window.getComputedStyle(t || document.body).getPropertyValue(_) || "top", I = !!(t != null && t.innerText.trim()) || (t == null ? void 0 : t.hasAttribute(s)) || (t == null ? void 0 : t.hasAttribute("aria-label"));
16
- (!l || l === "false" || l === "true" || n === "none") && (t = null), t && (e.textContent = l), o == null || o.removeAttribute(o.getAttribute(s) === u ? s : r), p(e, !1), o = t, o == null || o.setAttribute(I ? r : s, u), e.togglePopover(!!t), p(e, t, n);
14
+ function P(n) {
15
+ var T;
16
+ if (L = Date.now(), !o || n === o) return;
17
+ let t = ((T = n == null ? void 0 : n.closest) == null ? void 0 : T.call(n, "[data-tooltip]")) || null;
18
+ if (t === e) return;
19
+ const i = t && l(t, "data-tooltip") || "", s = t && l(t, "data-tooltip-position") || window.getComputedStyle(t || document.body).getPropertyValue(_) || "top";
20
+ (!i || i === "false" || i === "true" || s === "none") && (t = null), t && (o.textContent = i);
21
+ const f = e && l(e, d) === u, I = !!(t != null && t.innerText.trim()) || (t == null ? void 0 : t.hasAttribute(d)) || (t == null ? void 0 : t.hasAttribute("aria-label"));
22
+ e == null || e.removeAttribute(f ? d : r), p(o, !1), e = t, e && l(e, I ? r : d, u), o.togglePopover(!!t), p(o, t, s);
17
23
  }
18
- f && !document.getElementById(u) && (e = document.body.appendChild(document.createElement("div")), e.classList.add(...S), e.id = u, w(e, "popover", "manual"), d(document, "blur,focus,mouseout,mouseover", T, m), d(window, "keydown", T, m), d(window, "blur", T, m));
24
+ O && !document.getElementById(u) && (o = document.body.appendChild(document.createElement("div")), o.classList.add(...S), o.id = u, l(o, "popover", "manual"), a(document, "blur,focus,mouseout,mouseover", m, c), a(window, "keydown", m, c), a(window, "blur", m, c));
19
25
  //# sourceMappingURL=tooltip-observer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip-observer.js","sources":["../../designsystem/tooltip/tooltip-observer.ts"],"sourcesContent":["import styles from '../styles.module.css';\nimport { IS_BROWSER, QUICK_EVENT, anchorPosition, attr, on } from \"../utils\";\n\nconst CSS_TOOLTIP = styles._tooltip.split(' ');\nconst DESCRIBEDBY = 'aria-describedby';\nconst ESC = 'Escape';\nconst LABELLEDBY = 'aria-labelledby';\nconst POSITION_CSS_PROPERTY = '--mtds-tooltip-position';\nconst THROTTLE_DELAY = 100;\nconst TOOLTIP_ID = 'mtds-tooltip';\n\nlet ANCHOR: HTMLElement | null = null;\nlet LAST_CALL = Number.NEGATIVE_INFINITY;\nlet THROTTLE: number | ReturnType<typeof setTimeout> = 0;\nlet TOOLTIP: HTMLElement | null = null;\n\nfunction handleMove({ target, type, key }: Event & { key?: string }) {\n if (type === 'keydown' && key !== ESC) return; // Allow ESC dismiss to follow https://www.w3.org/WAI/ARIA/apg/patterns/tooltip/\n const wait = LAST_CALL + THROTTLE_DELAY - Date.now();\n clearTimeout(THROTTLE);\n THROTTLE = setTimeout(handleMoveThrottled, Math.max(wait, 0), key === ESC ? null : target);\n}\n\n// Using a throttled function to avoid performance issues\nfunction handleMoveThrottled(target: Element | null) {\n LAST_CALL = Date.now();\n\n if (!TOOLTIP || target === TOOLTIP) return; // Allow tooltip to be hovered, following https://www.w3.org/TR/WCAG21/#content-on-hover-or-focus\n let anchor = target?.closest?.<HTMLElement>('[data-tooltip]') || null;\n \n // No need to update\n if (anchor === ANCHOR) return;\n\n const content = anchor?.getAttribute('data-tooltip') || '';\n const position = anchor?.getAttribute('data-tooltip-position') || window.getComputedStyle(anchor || document.body).getPropertyValue(POSITION_CSS_PROPERTY) || 'top';\n const hasLabel = Boolean(anchor?.innerText.trim()) || anchor?.hasAttribute(LABELLEDBY) || anchor?.hasAttribute('aria-label');\n\n if (!content || content === 'false' || content === 'true' || position === 'none') anchor = null; // Do not show tooltip if boolish value\n if (anchor) TOOLTIP.textContent = content; // Only update content if new anchor\n\n ANCHOR?.removeAttribute(ANCHOR.getAttribute(LABELLEDBY) === TOOLTIP_ID ? LABELLEDBY : DESCRIBEDBY); // Unlink previous anchor\n anchorPosition(TOOLTIP, false); // Reset anchor position\n\n ANCHOR = anchor; // Store new anchor - might be null if no new anchor\n ANCHOR?.setAttribute(hasLabel ? DESCRIBEDBY : LABELLEDBY, TOOLTIP_ID); // Use tooltip as description if allready has label\n TOOLTIP.togglePopover(!!anchor);\n anchorPosition(TOOLTIP, anchor, position);\n}\n\n// Initialize if in browser and not already initialized\nif (IS_BROWSER && !document.getElementById(TOOLTIP_ID)) {\n TOOLTIP = document.body.appendChild(document.createElement('div'));\n TOOLTIP.classList.add(...CSS_TOOLTIP);\n TOOLTIP.id = TOOLTIP_ID;\n attr(TOOLTIP, 'popover', 'manual');\n on(document, 'blur,focus,mouseout,mouseover', handleMove, QUICK_EVENT);\n on(window, 'keydown', handleMove, QUICK_EVENT);\n on(window, 'blur', handleMove, QUICK_EVENT);\n}"],"names":["CSS_TOOLTIP","styles","DESCRIBEDBY","ESC","LABELLEDBY","POSITION_CSS_PROPERTY","THROTTLE_DELAY","TOOLTIP_ID","ANCHOR","LAST_CALL","THROTTLE","TOOLTIP","handleMove","target","type","key","wait","handleMoveThrottled","anchor","_a","content","position","hasLabel","anchorPosition","IS_BROWSER","attr","on","QUICK_EVENT"],"mappings":";;AAGA,MAAMA,IAAcC,EAAO,SAAS,MAAM,GAAG,GACvCC,IAAc,oBACdC,IAAM,UACNC,IAAa,mBACbC,IAAwB,2BACxBC,IAAiB,KACjBC,IAAa;AAEnB,IAAIC,IAA6B,MAC7BC,IAAY,OAAO,mBACnBC,IAAmD,GACnDC,IAA8B;AAElC,SAASC,EAAW,EAAE,QAAAC,GAAQ,MAAAC,GAAM,KAAAC,KAAiC;AAC/D,MAAAD,MAAS,aAAaC,MAAQZ,EAAK;AACvC,QAAMa,IAAOP,IAAYH,IAAiB,KAAK,IAAI;AACnD,eAAaI,CAAQ,GACVA,IAAA,WAAWO,GAAqB,KAAK,IAAID,GAAM,CAAC,GAAGD,MAAQZ,IAAM,OAAOU,CAAM;AAC3F;AAGA,SAASI,EAAoBJ,GAAwB;;AAG/C,MAFJJ,IAAY,KAAK,IAAI,GAEjB,CAACE,KAAWE,MAAWF,EAAS;AACpC,MAAIO,MAASC,IAAAN,KAAA,gBAAAA,EAAQ,YAAR,gBAAAM,EAAA,KAAAN,GAA+B,sBAAqB;AAGjE,MAAIK,MAAWV,EAAQ;AAEvB,QAAMY,KAAUF,KAAA,gBAAAA,EAAQ,aAAa,oBAAmB,IAClDG,KAAWH,KAAA,gBAAAA,EAAQ,aAAa,6BAA4B,OAAO,iBAAiBA,KAAU,SAAS,IAAI,EAAE,iBAAiBb,CAAqB,KAAK,OACxJiB,IAAW,GAAQJ,KAAA,QAAAA,EAAQ,UAAU,YAAWA,KAAA,gBAAAA,EAAQ,aAAad,QAAec,KAAA,gBAAAA,EAAQ,aAAa;AAE3G,GAAA,CAACE,KAAWA,MAAY,WAAWA,MAAY,UAAUC,MAAa,YAAiBH,IAAA,OACvFA,QAAgB,cAAcE,IAElCZ,KAAA,QAAAA,EAAQ,gBAAgBA,EAAO,aAAaJ,CAAU,MAAMG,IAAaH,IAAaF,IACtFqB,EAAeZ,GAAS,EAAK,GAEpBH,IAAAU,GACTV,KAAA,QAAAA,EAAQ,aAAac,IAAWpB,IAAcE,GAAYG,IAClDI,EAAA,cAAc,CAAC,CAACO,CAAM,GACfK,EAAAZ,GAASO,GAAQG,CAAQ;AAC1C;AAGIG,KAAc,CAAC,SAAS,eAAejB,CAAU,MACnDI,IAAU,SAAS,KAAK,YAAY,SAAS,cAAc,KAAK,CAAC,GACzDA,EAAA,UAAU,IAAI,GAAGX,CAAW,GACpCW,EAAQ,KAAKJ,GACRkB,EAAAd,GAAS,WAAW,QAAQ,GAC9Be,EAAA,UAAU,iCAAiCd,GAAYe,CAAW,GAClED,EAAA,QAAQ,WAAWd,GAAYe,CAAW,GAC1CD,EAAA,QAAQ,QAAQd,GAAYe,CAAW;"}
1
+ {"version":3,"file":"tooltip-observer.js","sources":["../../designsystem/tooltip/tooltip-observer.ts"],"sourcesContent":["import styles from \"../styles.module.css\";\nimport { IS_BROWSER, QUICK_EVENT, anchorPosition, attr, on } from \"../utils\";\n\nconst CSS_TOOLTIP = styles._tooltip.split(\" \");\nconst DESCRIBEDBY = \"aria-describedby\";\nconst ESC = \"Escape\";\nconst LABELLEDBY = \"aria-labelledby\";\nconst POSITION_CSS_PROPERTY = \"--mtds-tooltip-position\";\nconst THROTTLE_DELAY = 300;\nconst TOOLTIP_ID = \"mtds-tooltip\";\n\nlet ANCHOR: HTMLElement | null = null;\nlet LAST_CALL = Number.NEGATIVE_INFINITY;\nlet THROTTLE: number | ReturnType<typeof setTimeout> = 0;\nlet TOOLTIP: HTMLElement | null = null;\n\nfunction handleMove({ target, type, key }: Event & { key?: string }) {\n if (type === \"keydown\" && key !== ESC) return; // Allow ESC dismiss to follow https://www.w3.org/WAI/ARIA/apg/patterns/tooltip/\n const wait = LAST_CALL + THROTTLE_DELAY - Date.now();\n clearTimeout(THROTTLE);\n THROTTLE = setTimeout(\n handleMoveThrottled,\n Math.max(wait, 0),\n key === ESC ? null : target\n );\n}\n\n// Using a throttled function to avoid performance issues\nfunction handleMoveThrottled(target: Element | null) {\n LAST_CALL = Date.now();\n\n if (!TOOLTIP || target === TOOLTIP) return; // Allow tooltip to be hovered, following https://www.w3.org/TR/WCAG21/#content-on-hover-or-focus\n let anchor = target?.closest?.<HTMLElement>(\"[data-tooltip]\") || null;\n\n // No need to update\n if (anchor === ANCHOR) return;\n\n const content = (anchor && attr(anchor, \"data-tooltip\")) || \"\";\n const position =\n (anchor && attr(anchor, \"data-tooltip-position\")) ||\n window\n .getComputedStyle(anchor || document.body)\n .getPropertyValue(POSITION_CSS_PROPERTY) ||\n \"top\";\n\n const isHidden =\n !content ||\n content === \"false\" ||\n content === \"true\" ||\n position === \"none\";\n\n if (isHidden) anchor = null; // Do not show tooltip if boolish value\n if (anchor) TOOLTIP.textContent = content; // Only update content if new anchor\n\n const hadLabel = ANCHOR && attr(ANCHOR, LABELLEDBY) === TOOLTIP_ID;\n const hasLabel =\n Boolean(anchor?.innerText.trim()) ||\n anchor?.hasAttribute(LABELLEDBY) ||\n anchor?.hasAttribute(\"aria-label\");\n\n ANCHOR?.removeAttribute(hadLabel ? LABELLEDBY : DESCRIBEDBY); // Unlink previous anchor\n anchorPosition(TOOLTIP, false); // Reset anchor position\n\n ANCHOR = anchor; // Store new anchor - might be null if no new anchor\n if (ANCHOR) attr(ANCHOR, hasLabel ? DESCRIBEDBY : LABELLEDBY, TOOLTIP_ID); // Use tooltip as description if allready has label\n TOOLTIP.togglePopover(!!anchor);\n anchorPosition(TOOLTIP, anchor, position);\n}\n\n// Initialize if in browser and not already initialized\nif (IS_BROWSER && !document.getElementById(TOOLTIP_ID)) {\n TOOLTIP = document.body.appendChild(document.createElement(\"div\"));\n TOOLTIP.classList.add(...CSS_TOOLTIP);\n TOOLTIP.id = TOOLTIP_ID;\n attr(TOOLTIP, \"popover\", \"manual\");\n on(document, \"blur,focus,mouseout,mouseover\", handleMove, QUICK_EVENT);\n on(window, \"keydown\", handleMove, QUICK_EVENT);\n on(window, \"blur\", handleMove, QUICK_EVENT);\n}\n"],"names":["CSS_TOOLTIP","styles","DESCRIBEDBY","ESC","LABELLEDBY","POSITION_CSS_PROPERTY","THROTTLE_DELAY","TOOLTIP_ID","ANCHOR","LAST_CALL","THROTTLE","TOOLTIP","handleMove","target","type","key","wait","handleMoveThrottled","anchor","_a","content","attr","position","hadLabel","hasLabel","anchorPosition","IS_BROWSER","on","QUICK_EVENT"],"mappings":";;AAGA,MAAMA,IAAcC,EAAO,SAAS,MAAM,GAAG,GACvCC,IAAc,oBACdC,IAAM,UACNC,IAAa,mBACbC,IAAwB,2BACxBC,IAAiB,KACjBC,IAAa;AAEnB,IAAIC,IAA6B,MAC7BC,IAAY,OAAO,mBACnBC,IAAmD,GACnDC,IAA8B;AAElC,SAASC,EAAW,EAAE,QAAAC,GAAQ,MAAAC,GAAM,KAAAC,KAAiC;AAC/D,MAAAD,MAAS,aAAaC,MAAQZ,EAAK;AACvC,QAAMa,IAAOP,IAAYH,IAAiB,KAAK,IAAI;AACnD,eAAaI,CAAQ,GACVA,IAAA;AAAA,IACTO;AAAA,IACA,KAAK,IAAID,GAAM,CAAC;AAAA,IAChBD,MAAQZ,IAAM,OAAOU;AAAA,EACvB;AACF;AAGA,SAASI,EAAoBJ,GAAwB;;AAG/C,MAFJJ,IAAY,KAAK,IAAI,GAEjB,CAACE,KAAWE,MAAWF,EAAS;AACpC,MAAIO,MAASC,IAAAN,KAAA,gBAAAA,EAAQ,YAAR,gBAAAM,EAAA,KAAAN,GAA+B,sBAAqB;AAGjE,MAAIK,MAAWV,EAAQ;AAEvB,QAAMY,IAAWF,KAAUG,EAAKH,GAAQ,cAAc,KAAM,IACtDI,IACHJ,KAAUG,EAAKH,GAAQ,uBAAuB,KAC/C,OACG,iBAAiBA,KAAU,SAAS,IAAI,EACxC,iBAAiBb,CAAqB,KACzC;AAQF,GALE,CAACe,KACDA,MAAY,WACZA,MAAY,UACZE,MAAa,YAEQJ,IAAA,OACnBA,QAAgB,cAAcE;AAElC,QAAMG,IAAWf,KAAUa,EAAKb,GAAQJ,CAAU,MAAMG,GAClDiB,IACJ,GAAQN,KAAA,QAAAA,EAAQ,UAAU,YAC1BA,KAAA,gBAAAA,EAAQ,aAAad,QACrBc,KAAA,gBAAAA,EAAQ,aAAa;AAEf,EAAAV,KAAA,QAAAA,EAAA,gBAAgBe,IAAWnB,IAAaF,IAChDuB,EAAed,GAAS,EAAK,GAEpBH,IAAAU,GACLV,KAAaa,EAAAb,GAAQgB,IAAWtB,IAAcE,GAAYG,CAAU,GAChEI,EAAA,cAAc,CAAC,CAACO,CAAM,GACfO,EAAAd,GAASO,GAAQI,CAAQ;AAC1C;AAGII,KAAc,CAAC,SAAS,eAAenB,CAAU,MACnDI,IAAU,SAAS,KAAK,YAAY,SAAS,cAAc,KAAK,CAAC,GACzDA,EAAA,UAAU,IAAI,GAAGX,CAAW,GACpCW,EAAQ,KAAKJ,GACRc,EAAAV,GAAS,WAAW,QAAQ,GAC9BgB,EAAA,UAAU,iCAAiCf,GAAYgB,CAAW,GAClED,EAAA,QAAQ,WAAWf,GAAYgB,CAAW,GAC1CD,EAAA,QAAQ,QAAQf,GAAYgB,CAAW;"}
@@ -0,0 +1,11 @@
1
+ import { StoryObj } from '@storybook/react';
2
+ declare const meta: {
3
+ title: string;
4
+ decorators: ((Story: import('@storybook/core/csf').PartialStoryFn<import('@storybook/react').ReactRenderer, {
5
+ [x: string]: any;
6
+ }>) => import("react/jsx-runtime").JSX.Element)[];
7
+ };
8
+ export default meta;
9
+ type Story = StoryObj<typeof meta>;
10
+ export declare const Default: Story;
11
+ export declare const React: Story;
package/mtds/utils.js CHANGED
@@ -1,50 +1,50 @@
1
1
  const w = typeof window < "u" && typeof document < "u", U = { capture: !0, passive: !0 };
2
- function C(t, e, n) {
3
- return n === void 0 ? t.getAttribute(e) ?? null : (n === null ? t.removeAttribute(e) : t.getAttribute(e) !== n && t.setAttribute(e, n), null);
2
+ function C(t, e, o) {
3
+ return o === void 0 ? t.getAttribute(e) ?? null : (o === null ? t.removeAttribute(e) : t.getAttribute(e) !== o && t.setAttribute(e, o), null);
4
4
  }
5
5
  let E = 0;
6
6
  const O = `${Date.now().toString(36)}${Math.random().toString(36).slice(2, 5)}`;
7
7
  function X(t) {
8
8
  return t.id || (t.id = `${O}${++E}`), t.id;
9
9
  }
10
- const b = (t, e, n) => {
11
- for (const i of n[0].split(","))
12
- n[0] = i, e[`${t}EventListener`](...n);
10
+ const b = (t, e, o) => {
11
+ for (const i of o[0].split(","))
12
+ o[0] = i, e[`${t}EventListener`](...o);
13
13
  }, B = (t, ...e) => b("add", t, e), Y = (t, ...e) => b("remove", t, e), a = /* @__PURE__ */ new Map(), s = w ? document.createElement("div") : null;
14
14
  s && C(s, "style", "position:absolute;padding:1px;top:0;left:0px");
15
15
  w && B(window, "load,resize,scroll", () => {
16
16
  for (const [t, e] of a) e();
17
17
  }, U);
18
18
  const d = { top: 0, right: 1, bottom: 2, left: 3 };
19
- function _(t, e, n) {
19
+ function _(t, e, o) {
20
20
  var p;
21
21
  if (!e || !e.isConnected || !t.isConnected) return a.delete(t);
22
22
  if (s != null && s.isConnected || document.body.append(s || ""), !a.has(t)) {
23
- const I = d[n] ?? d.bottom;
23
+ const I = d[o] ?? d.bottom;
24
24
  return (p = a.set(t, () => _(t, e, I)).get(t)) == null ? void 0 : p();
25
25
  }
26
- const { offsetWidth: i, offsetHeight: o } = t, { offsetWidth: c, offsetHeight: u } = e, { width: M, height: m, left: g, top: v } = e.getBoundingClientRect(), f = Math.round(g - (c - M) / 2), r = Math.round(v - (u - m) / 2), T = f - i > 0, y = c + c + i < window.innerWidth, A = r - o > 0, S = r + u + o < window.innerHeight, $ = n === d.bottom && y || !T, x = n === d.bottom && S || !A, H = Math.min(Math.max(10, f - (i - c) / 2), window.innerWidth - i - 10), W = Math.min(Math.max(10, r - (o - u) / 2), window.innerHeight - o - 10), h = n === d.top || n === d.bottom;
27
- t.style.left = `${Math.round(h ? H : $ ? f + c : f - i)}px`, t.style.top = `${Math.round(h ? x ? r + u : r - o : W)}px`, s == null || s.style.setProperty("translate", `${Math.round(window.scrollX + f + c + i + 30)} ${Math.round(window.scrollY + r + u + o + 30)}px`);
26
+ const { offsetWidth: i, offsetHeight: n } = t, { offsetWidth: c, offsetHeight: u } = e, { width: M, height: m, left: g, top: v } = e.getBoundingClientRect(), f = Math.round(g - (c - M) / 2), r = Math.round(v - (u - m) / 2), T = f - i > 0, y = c + c + i < window.innerWidth, A = r - n > 0, S = r + u + n < window.innerHeight, $ = o === d.bottom && y || !T, x = o === d.bottom && S || !A, H = Math.min(Math.max(10, f - (i - c) / 2), window.innerWidth - i - 10), W = Math.min(Math.max(10, r - (n - u) / 2), window.innerHeight - n - 10), h = o === d.top || o === d.bottom;
27
+ t.style.left = `${Math.round(h ? H : $ ? f + c : f - i)}px`, t.style.top = `${Math.round(h ? x ? r + u : r - n : W)}px`, s == null || s.style.setProperty("translate", `${Math.round(window.scrollX + f + c + i + 30)} ${Math.round(window.scrollY + r + u + n + 30)}px`);
28
28
  }
29
29
  function F(t) {
30
30
  let e = 0;
31
- const n = () => setTimeout(i, 200), i = () => {
32
- t([], o), e = 0;
33
- }, o = new MutationObserver(() => {
34
- e || (e = requestAnimationFrame(n));
31
+ const o = () => setTimeout(i, 200), i = () => {
32
+ t([], n), e = 0;
33
+ }, n = new MutationObserver(() => {
34
+ e || (e = requestAnimationFrame(o));
35
35
  });
36
- return o;
36
+ return n;
37
37
  }
38
38
  const l = /* @__PURE__ */ new WeakMap(), P = (t) => {
39
- var n;
39
+ var o;
40
40
  const e = l.get(t);
41
41
  if (!e || !t.isConnected)
42
- (n = e == null ? void 0 : e.observer) == null || n.disconnect(), l.delete(t);
42
+ (o = e == null ? void 0 : e.observer) == null || o.disconnect(), l.delete(t);
43
43
  else for (const [, i] of e.collections) i();
44
- }, k = (t, e, n) => {
44
+ }, k = (t, e, o) => {
45
45
  const i = t.getElementsByClassName(e);
46
- let o = l.get(t);
47
- o || (o = { collections: /* @__PURE__ */ new Map(), observer: F(() => P(t)) }, o.observer.observe(t, { childList: !0, subtree: !0, attributes: !0, attributeFilter: ["class"] }), l.set(t, o)), n ? o.collections.set(e, () => n(i)) : o.collections.delete(e);
46
+ let n = l.get(t);
47
+ n || (n = { collections: /* @__PURE__ */ new Map(), observer: F(() => P(t)) }, n.observer.observe(t, { childList: !0, subtree: !0, attributes: !0, attributeFilter: ["class"] }), l.set(t, n)), o ? n.collections.set(e, () => o(i)) : n.collections.delete(e);
48
48
  }, q = (t) => t instanceof HTMLElement && "validity" in t && !(t instanceof HTMLButtonElement);
49
49
  export {
50
50
  w as IS_BROWSER,
@@ -0,0 +1,2 @@
1
+ export type ValidationProps = React.ComponentPropsWithoutRef<"div">;
2
+ export declare const Validation: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;