@mattilsynet/design 3.3.9 → 3.4.1
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/_virtual/_rolldown/runtime.js +17 -0
- package/mtds/ai/card.stories.tsx +54 -77
- package/mtds/ai/layout.mdx +37 -1
- package/mtds/ai/layout.stories.tsx +126 -1
- package/mtds/ai/print.mdx +1 -1
- package/mtds/ai/print.stories.tsx +1 -2
- package/mtds/alert/alert.js +16 -11
- package/mtds/alert/alert.js.map +1 -1
- package/mtds/analytics/analytics.js +118 -118
- package/mtds/analytics/analytics.js.map +1 -1
- package/mtds/app/app-observer.js +31 -36
- package/mtds/app/app-observer.js.map +1 -1
- package/mtds/app/app-toggle.js +12 -26
- package/mtds/app/app-toggle.js.map +1 -1
- package/mtds/app/app-toggle2.js +6 -11
- package/mtds/app/app-toggle2.js.map +1 -1
- package/mtds/app/app.js +66 -60
- package/mtds/app/app.js.map +1 -1
- package/mtds/atlas/atlas-element.js +83 -93
- package/mtds/atlas/atlas-element.js.map +1 -1
- package/mtds/atlas/atlas-marker.js +63 -52
- package/mtds/atlas/atlas-marker.js.map +1 -1
- package/mtds/atlas/atlas-matgeo.js +67 -61
- package/mtds/atlas/atlas-matgeo.js.map +1 -1
- package/mtds/atlas/atlas-wms.js +33 -28
- package/mtds/atlas/atlas-wms.js.map +1 -1
- package/mtds/atlas/atlas.js +6 -38
- package/mtds/atlas/atlas.js.map +1 -1
- package/mtds/atlas/atlas2.js +39 -0
- package/mtds/atlas/atlas2.js.map +1 -0
- package/mtds/atlas/cluster.js +759 -1149
- package/mtds/atlas/cluster.js.map +1 -1
- package/mtds/atlas.iife.js +3 -4
- package/mtds/atlas.js +6 -14
- package/mtds/avatar/avatar.js +14 -10
- package/mtds/avatar/avatar.js.map +1 -1
- package/mtds/badge/badge.js +15 -10
- package/mtds/badge/badge.js.map +1 -1
- package/mtds/breadcrumbs/breadcrumbs.js +15 -19
- package/mtds/breadcrumbs/breadcrumbs.js.map +1 -1
- package/mtds/button/button.js +18 -20
- package/mtds/button/button.js.map +1 -1
- package/mtds/card/card.js +22 -15
- package/mtds/card/card.js.map +1 -1
- package/mtds/chart/chart-axis.js +33 -21
- package/mtds/chart/chart-axis.js.map +1 -1
- package/mtds/chart/chart-bars.js +23 -21
- package/mtds/chart/chart-bars.js.map +1 -1
- package/mtds/chart/chart-element.js +94 -88
- package/mtds/chart/chart-element.js.map +1 -1
- package/mtds/chart/chart-lines.js +35 -37
- package/mtds/chart/chart-lines.js.map +1 -1
- package/mtds/chart/chart-pies.js +17 -17
- package/mtds/chart/chart-pies.js.map +1 -1
- package/mtds/chart/chart.js +6 -52
- package/mtds/chart/chart.js.map +1 -1
- package/mtds/chart/chart2.js +21 -0
- package/mtds/chart/chart2.js.map +1 -0
- package/mtds/chip/chip.js +15 -11
- package/mtds/chip/chip.js.map +1 -1
- package/mtds/deprecations.js +76 -158
- package/mtds/deprecations.js.map +1 -1
- package/mtds/details/details.js +21 -24
- package/mtds/details/details.js.map +1 -1
- package/mtds/dialog/dialog.js +17 -21
- package/mtds/dialog/dialog.js.map +1 -1
- package/mtds/divider/divider.js +15 -20
- package/mtds/divider/divider.js.map +1 -1
- package/mtds/errorsummary/errorsummary.js +14 -16
- package/mtds/errorsummary/errorsummary.js.map +1 -1
- package/mtds/external/@turf/boolean-point-in-polygon/dist/esm/index.js +22 -25
- package/mtds/external/@turf/boolean-point-in-polygon/dist/esm/index.js.map +1 -1
- package/mtds/external/@turf/helpers/dist/esm/index.js +21 -24
- package/mtds/external/@turf/helpers/dist/esm/index.js.map +1 -1
- package/mtds/external/@turf/invariant/dist/esm/index.js +15 -19
- package/mtds/external/@turf/invariant/dist/esm/index.js.map +1 -1
- package/mtds/external/@u-elements/u-combobox/dist/u-combobox.js +270 -297
- package/mtds/external/@u-elements/u-combobox/dist/u-combobox.js.map +1 -1
- package/mtds/external/@u-elements/u-details/dist/u-details.js +75 -101
- package/mtds/external/@u-elements/u-details/dist/u-details.js.map +1 -1
- package/mtds/external/leaflet/dist/leaflet-src.js +4257 -6151
- package/mtds/external/leaflet/dist/leaflet-src.js.map +1 -1
- package/mtds/external/leaflet/dist/leaflet.css.js +5 -606
- package/mtds/external/leaflet/dist/leaflet.css.js.map +1 -1
- package/mtds/external/point-in-polygon-hao/dist/esm/index.js +24 -25
- package/mtds/external/point-in-polygon-hao/dist/esm/index.js.map +1 -1
- package/mtds/external/robust-predicates/esm/incircle.js +5 -0
- package/mtds/external/robust-predicates/esm/incircle.js.map +1 -0
- package/mtds/external/robust-predicates/esm/insphere.js +5 -0
- package/mtds/external/robust-predicates/esm/insphere.js.map +1 -0
- package/mtds/external/robust-predicates/esm/orient2d.js +20 -22
- package/mtds/external/robust-predicates/esm/orient2d.js.map +1 -1
- package/mtds/external/robust-predicates/esm/orient3d.js +5 -0
- package/mtds/external/robust-predicates/esm/orient3d.js.map +1 -0
- package/mtds/external/robust-predicates/esm/util.js +20 -28
- package/mtds/external/robust-predicates/esm/util.js.map +1 -1
- package/mtds/external/robust-predicates/index.js +5 -0
- package/mtds/field/field.js +167 -214
- package/mtds/field/field.js.map +1 -1
- package/mtds/fieldset/fieldset.js +32 -30
- package/mtds/fieldset/fieldset.js.map +1 -1
- package/mtds/fileupload/fileupload.js +16 -13
- package/mtds/fileupload/fileupload.js.map +1 -1
- package/mtds/helptext/helptext.js +25 -27
- package/mtds/helptext/helptext.js.map +1 -1
- package/mtds/identitet/illustrasjons-generator/illustrasjons-generator.d.ts +1 -0
- package/mtds/identitet/illustrasjons-generator/index-old-1.d.ts +1 -0
- package/mtds/identitet/infografikk-generator/infografikk-generator.d.ts +1 -0
- package/mtds/illustrations/index.json +1 -1
- package/mtds/index.iife.js +21 -21
- package/mtds/index.js +38 -31
- package/mtds/index.js.map +1 -1
- package/mtds/input/input.js +33 -47
- package/mtds/input/input.js.map +1 -1
- package/mtds/law/law-helper.js +106 -95
- package/mtds/law/law-helper.js.map +1 -1
- package/mtds/law/law.js +15 -10
- package/mtds/law/law.js.map +1 -1
- package/mtds/layout/layout.js +21 -13
- package/mtds/layout/layout.js.map +1 -1
- package/mtds/layout/layout.stories.d.ts +1 -0
- package/mtds/link/link.js +15 -10
- package/mtds/link/link.js.map +1 -1
- package/mtds/logo/logo-observer.js +18 -18
- package/mtds/logo/logo-observer.js.map +1 -1
- package/mtds/logo/logo.js +18 -18
- package/mtds/logo/logo.js.map +1 -1
- package/mtds/package.js +6 -0
- package/mtds/package.js.map +1 -0
- package/mtds/package.json.d.ts +112 -0
- package/mtds/pagination/pagination.js +46 -60
- package/mtds/pagination/pagination.js.map +1 -1
- package/mtds/popover/popover-observer.js +15 -15
- package/mtds/popover/popover-observer.js.map +1 -1
- package/mtds/popover/popover.js +18 -20
- package/mtds/popover/popover.js.map +1 -1
- package/mtds/print/print.js +15 -10
- package/mtds/print/print.js.map +1 -1
- package/mtds/print/print.stories.d.ts +0 -1
- package/mtds/profilering/epost.d.ts +1 -0
- package/mtds/progress/progress.js +15 -13
- package/mtds/progress/progress.js.map +1 -1
- package/mtds/react-atlas.js +7 -16
- package/mtds/react.js +36 -84
- package/mtds/skeleton/skeleton.js +15 -11
- package/mtds/skeleton/skeleton.js.map +1 -1
- package/mtds/spinner/spinner.js +16 -13
- package/mtds/spinner/spinner.js.map +1 -1
- package/mtds/steps/steps.js +15 -10
- package/mtds/steps/steps.js.map +1 -1
- package/mtds/styles.css +2 -1
- package/mtds/styles.module.js +122 -0
- package/mtds/styles.module.js.map +1 -0
- package/mtds/table/table-observer.js +23 -28
- package/mtds/table/table-observer.js.map +1 -1
- package/mtds/table/table.js +88 -60
- package/mtds/table/table.js.map +1 -1
- package/mtds/tabs/tabs.js +32 -27
- package/mtds/tabs/tabs.js.map +1 -1
- package/mtds/tag/tag.js +16 -19
- package/mtds/tag/tag.js.map +1 -1
- package/mtds/tailwind.css +0 -4
- package/mtds/toast/toast-helper.js +45 -25
- package/mtds/toast/toast-helper.js.map +1 -1
- package/mtds/toast/toast-observer.js +18 -18
- package/mtds/toast/toast-observer.js.map +1 -1
- package/mtds/toast/toast.js +67 -54
- package/mtds/toast/toast.js.map +1 -1
- package/mtds/togglegroup/togglegroup.js +31 -40
- package/mtds/togglegroup/togglegroup.js.map +1 -1
- package/mtds/tooltip/tooltip-element.js +12 -25
- package/mtds/tooltip/tooltip-element.js.map +1 -1
- package/mtds/typography/typography.js +38 -21
- package/mtds/typography/typography.js.map +1 -1
- package/mtds/utils.js +53 -70
- package/mtds/utils.js.map +1 -1
- package/mtds/validation/validation-observer.js +40 -47
- package/mtds/validation/validation-observer.js.map +1 -1
- package/mtds/validation/validation.js +17 -21
- package/mtds/validation/validation.js.map +1 -1
- package/package.json +9 -9
- package/mtds/atlas/atlas.css.js +0 -138
- package/mtds/atlas/atlas.css.js.map +0 -1
- package/mtds/atlas.js.map +0 -1
- package/mtds/chart/chart.css.js +0 -187
- package/mtds/chart/chart.css.js.map +0 -1
- package/mtds/package.json.js +0 -5
- package/mtds/package.json.js.map +0 -1
- package/mtds/react-atlas.js.map +0 -1
- package/mtds/react.js.map +0 -1
- package/mtds/styles.module.css.js +0 -118
- package/mtds/styles.module.css.js.map +0 -1
package/mtds/deprecations.js
CHANGED
|
@@ -1,160 +1,78 @@
|
|
|
1
|
-
import "
|
|
2
|
-
import {
|
|
3
|
-
import "./
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
),
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
'<dialog data-variant="drawer">',
|
|
58
|
-
'<dialog data-placement="center|left|right|top|bottom">',
|
|
59
|
-
t
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
t.isConnected && t.showModal && t.close && (t.matches('[open][data-modal]:not([data-modal="false"]):not(:modal)') ? (o(
|
|
63
|
-
'<dialog data-modal="true">',
|
|
64
|
-
'.showModal() or <button command="show-modal" commandfor="DIALOG-ID"></button>',
|
|
65
|
-
t
|
|
66
|
-
), s(t, "open", null), t.showModal()) : t.matches(":modal:not([open])") && (s(t, "open", ""), t.close()));
|
|
67
|
-
}
|
|
68
|
-
}, R = () => {
|
|
69
|
-
for (const t of document.querySelectorAll("[data-count]"))
|
|
70
|
-
if (a(t)) {
|
|
71
|
-
const e = s(t, "data-count");
|
|
72
|
-
t.classList.add(...c.validation.split(" ")), s(t, "data-limit", e), o(
|
|
73
|
-
`data-count="${e}"`,
|
|
74
|
-
`class="styles.validation" data-field="counter" data-limit="${e}"`,
|
|
75
|
-
t
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
}, w = () => {
|
|
79
|
-
for (const t of document.querySelectorAll("[data-command]"))
|
|
80
|
-
if (a(t)) {
|
|
81
|
-
const e = s(t, "data-command");
|
|
82
|
-
e === "row" ? o(
|
|
83
|
-
`<${t.nodeName.toLowerCase()} data-command="${e}">`,
|
|
84
|
-
`<tr data-clickdelegatefor="${t.nodeName}-ID">`,
|
|
85
|
-
t
|
|
86
|
-
) : o(
|
|
87
|
-
`<button data-command="${e}">`,
|
|
88
|
-
`<button command="${e?.replace("toggle-app-expanded", "show-modal")}" commandfor="TARGET-ID">`,
|
|
89
|
-
t
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
}, I = n() ? document.getElementsByTagName("u-tabs") : [], h = () => {
|
|
93
|
-
for (const t of I) a(t) && o("u-tabs", "ds-tabs", t);
|
|
94
|
-
}, v = n() ? document.getElementsByTagName("u-details") : [], U = () => {
|
|
95
|
-
for (const t of v) a(t) && o("u-details", "details", t);
|
|
96
|
-
}, i = c.suggestion.split(" "), $ = n() ? document.getElementsByTagName("u-combobox") : [], M = n() ? document.getElementsByTagName("ds-suggestion") : [], k = () => {
|
|
97
|
-
for (const t of $)
|
|
98
|
-
a(t) && (t.classList.add(...i), o("<u-combobox>", '<ds-suggestion class="styles.suggestion">', t));
|
|
99
|
-
for (const t of M)
|
|
100
|
-
a(t) && !t.classList.contains(i[0]) && (t.classList.add(...i), o(
|
|
101
|
-
"Only using <ds-suggestion>",
|
|
102
|
-
'<ds-suggestion class="styles.suggestion">',
|
|
103
|
-
t
|
|
104
|
-
));
|
|
105
|
-
}, F = ({ target: t }) => {
|
|
106
|
-
if (!(t instanceof Element)) return;
|
|
107
|
-
const e = t?.closest("tr")?.querySelector('[data-command="row"]');
|
|
108
|
-
e && !t?.closest('a,button,label,input,select,textarea,[role="button"]') && e.click();
|
|
109
|
-
const m = t?.closest("dialog");
|
|
110
|
-
m && t?.closest('[data-command="close"]') && m.close();
|
|
111
|
-
}, G = l("field"), d = /* @__PURE__ */ new Set(), x = () => {
|
|
112
|
-
for (const t of G)
|
|
113
|
-
t.nodeName !== "DS-FIELD" && (a(t) || o(
|
|
114
|
-
'Only setting class="styles.field"',
|
|
115
|
-
'<ds-field class="styles.field">',
|
|
116
|
-
t
|
|
117
|
-
), !d.has(t) && d.add(t) && g.prototype.connectedCallback.call(t));
|
|
118
|
-
}, q = () => {
|
|
119
|
-
for (const t of d)
|
|
120
|
-
g.prototype.disconnectedCallback.call(t), d.delete(t);
|
|
121
|
-
}, P = `[data-description], .${c.field.split(" ")[0]} label + p`, _ = () => {
|
|
122
|
-
for (const t of document.querySelectorAll(P))
|
|
123
|
-
a(t) && t.getAttribute("data-field") !== "description" && (s(t, "data-field", "description"), o(
|
|
124
|
-
"Descriptions created by data-description of <p> only",
|
|
125
|
-
'data-field="data-description"',
|
|
126
|
-
t
|
|
127
|
-
));
|
|
128
|
-
}, V = l("validation"), W = () => {
|
|
129
|
-
for (const t of V)
|
|
130
|
-
a(t) && !t.hasAttribute("data-field") && (s(t, "data-field", "validation"), o(
|
|
131
|
-
'Only setting class="styles.validation"',
|
|
132
|
-
'class="styles.validation" data-field="validation"',
|
|
133
|
-
t
|
|
134
|
-
));
|
|
135
|
-
}, H = () => {
|
|
136
|
-
for (const t of document.querySelectorAll("[popover][data-position]"))
|
|
137
|
-
a(t) && (s(t, "data-placement", s(t, "data-position")), o("data-position", "data-placement", t));
|
|
138
|
-
}, Y = D(() => {
|
|
139
|
-
n() && (R(), w(), O(), b(), B(), _(), W(), H(), x(), L(), k(), h(), U());
|
|
1
|
+
import e from "./styles.module.js";
|
|
2
|
+
import { QUICK_EVENT as t, attr as n, debounce as r, getByCSSModule as i, isBrowser as a, on as o, onHotReload as s, onMutation as c } from "./utils.js";
|
|
3
|
+
import { designsystem_exports as l } from "./index.js";
|
|
4
|
+
//#region designsystem/deprecations.ts
|
|
5
|
+
var u = /* @__PURE__ */ new WeakSet(), d = (e) => !u.has(e) && u.add(e), f = (e, t, n) => window.dsWarnings === !1 || console.warn(`\x1B[1m@mattilsynet/design:\x1B[m ${e} is deprecated, please use ${t}:`, n), p = i("togglegroup"), m = e.button.split(" "), h = () => {
|
|
6
|
+
for (let e of p) {
|
|
7
|
+
d(e) && !e.hasAttribute("data-toggle-group") && (n(e, "data-toggle-group", "Valgknapper"), f("Only setting class=\"styles.togglegroup\"", "data-toggle-group=\"LABEL-HERE\" attribute also for better accessibility", e));
|
|
8
|
+
for (let t of e.getElementsByTagName("label")) d(t) && !t.classList.contains(m[0]) && (t.classList.add(...m), f("Only setting class=\"styles.button\"", "<label class=\"styles.button\">", t));
|
|
9
|
+
}
|
|
10
|
+
}, g = i("breadcrumbs"), _ = () => {
|
|
11
|
+
for (let t of g) d(t) && t.nodeName !== "DS-BREADCRUMBS" && (t.classList.add(...e.breadcrumbs.split(" ")), f("Only setting class=\"styles.breadcrumbs\"", "<ds-breadcrumbs class=\"styles.breadcrumbs\">", t));
|
|
12
|
+
}, v = i("errorsummary"), y = () => {
|
|
13
|
+
for (let e of v) d(e) && e.nodeName !== "DS-ERROR-SUMMARY" && f("Only setting class=\"styles.errorsummary\"", "<ds-error-summary class=\"styles.errorsummary\">", e);
|
|
14
|
+
}, b = i("dialog"), x = () => {
|
|
15
|
+
for (let e of b) {
|
|
16
|
+
if (d(e)) {
|
|
17
|
+
let t = n(e, "data-closedby");
|
|
18
|
+
t && (n(e, "closedby", t), f(`<dialog data-closedby="${t}">`, `<dialog closedby="${t}">`, e)), e.hasAttribute("data-variant") && f("<dialog data-variant=\"drawer\">", "<dialog data-placement=\"center|left|right|top|bottom\">", e);
|
|
19
|
+
}
|
|
20
|
+
e.isConnected && e.showModal && e.close && (e.matches("[open][data-modal]:not([data-modal=\"false\"]):not(:modal)") ? (f("<dialog data-modal=\"true\">", ".showModal() or <button command=\"show-modal\" commandfor=\"DIALOG-ID\"></button>", e), n(e, "open", null), e.showModal()) : e.matches(":modal:not([open])") && (n(e, "open", ""), e.close()));
|
|
21
|
+
}
|
|
22
|
+
}, S = () => {
|
|
23
|
+
for (let t of document.querySelectorAll("[data-count]")) if (d(t)) {
|
|
24
|
+
let r = n(t, "data-count");
|
|
25
|
+
t.classList.add(...e.validation.split(" ")), n(t, "data-limit", r), f(`data-count="${r}"`, `class="styles.validation" data-field="counter" data-limit="${r}"`, t);
|
|
26
|
+
}
|
|
27
|
+
}, C = () => {
|
|
28
|
+
for (let e of document.querySelectorAll("[data-command]")) if (d(e)) {
|
|
29
|
+
let t = n(e, "data-command");
|
|
30
|
+
t === "row" ? f(`<${e.nodeName.toLowerCase()} data-command="${t}">`, `<tr data-clickdelegatefor="${e.nodeName}-ID">`, e) : f(`<button data-command="${t}">`, `<button command="${t?.replace("toggle-app-expanded", "show-modal")}" commandfor="TARGET-ID">`, e);
|
|
31
|
+
}
|
|
32
|
+
}, w = a() ? document.getElementsByTagName("u-tabs") : [], T = () => {
|
|
33
|
+
for (let e of w) d(e) && f("u-tabs", "ds-tabs", e);
|
|
34
|
+
}, E = a() ? document.getElementsByTagName("u-details") : [], D = () => {
|
|
35
|
+
for (let e of E) d(e) && f("u-details", "details", e);
|
|
36
|
+
}, O = e.suggestion.split(" "), k = a() ? document.getElementsByTagName("u-combobox") : [], A = a() ? document.getElementsByTagName("ds-suggestion") : [], j = () => {
|
|
37
|
+
for (let e of k) d(e) && (e.classList.add(...O), f("<u-combobox>", "<ds-suggestion class=\"styles.suggestion\">", e));
|
|
38
|
+
for (let e of A) d(e) && !e.classList.contains(O[0]) && (e.classList.add(...O), f("Only using <ds-suggestion>", "<ds-suggestion class=\"styles.suggestion\">", e));
|
|
39
|
+
}, M = ({ target: e }) => {
|
|
40
|
+
if (!(e instanceof Element)) return;
|
|
41
|
+
let t = e?.closest("tr")?.querySelector("[data-command=\"row\"]");
|
|
42
|
+
t && !e?.closest("a,button,label,input,select,textarea,[role=\"button\"]") && t.click();
|
|
43
|
+
let n = e?.closest("dialog");
|
|
44
|
+
n && e?.closest("[data-command=\"close\"]") && n.close();
|
|
45
|
+
}, N = i("field"), P = /* @__PURE__ */ new Set(), F = () => {
|
|
46
|
+
for (let e of N) e.nodeName !== "DS-FIELD" && (d(e) || f("Only setting class=\"styles.field\"", "<ds-field class=\"styles.field\">", e), !P.has(e) && P.add(e) && l.DSFieldElement.prototype.connectedCallback.call(e));
|
|
47
|
+
}, I = () => {
|
|
48
|
+
for (let e of P) l.DSFieldElement.prototype.disconnectedCallback.call(e), P.delete(e);
|
|
49
|
+
}, L = `[data-description], .${e.field.split(" ")[0]} label + p`, R = () => {
|
|
50
|
+
for (let e of document.querySelectorAll(L)) d(e) && e.getAttribute("data-field") !== "description" && (n(e, "data-field", "description"), f("Descriptions created by data-description of <p> only", "data-field=\"data-description\"", e));
|
|
51
|
+
}, z = i("validation"), B = () => {
|
|
52
|
+
for (let e of z) d(e) && !e.hasAttribute("data-field") && (n(e, "data-field", "validation"), f("Only setting class=\"styles.validation\"", "class=\"styles.validation\" data-field=\"validation\"", e));
|
|
53
|
+
}, V = () => {
|
|
54
|
+
for (let e of document.querySelectorAll("[popover][data-position]")) d(e) && (n(e, "data-placement", n(e, "data-position")), f("data-position", "data-placement", e));
|
|
55
|
+
}, H = r(() => {
|
|
56
|
+
a() && (S(), C(), _(), x(), y(), R(), B(), V(), F(), h(), j(), T(), D());
|
|
140
57
|
}, 200);
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
})
|
|
58
|
+
s("deprecations", () => [
|
|
59
|
+
I,
|
|
60
|
+
o(document, "click", M, t),
|
|
61
|
+
o(document, "toggle", x, !0),
|
|
62
|
+
c(document, H, {
|
|
63
|
+
attributeFilter: [
|
|
64
|
+
"class",
|
|
65
|
+
"data-command",
|
|
66
|
+
"data-count",
|
|
67
|
+
"data-description",
|
|
68
|
+
"data-variant",
|
|
69
|
+
"open"
|
|
70
|
+
],
|
|
71
|
+
attributes: !0,
|
|
72
|
+
childList: !0,
|
|
73
|
+
subtree: !0
|
|
74
|
+
})
|
|
159
75
|
]);
|
|
160
|
-
//#
|
|
76
|
+
//#endregion
|
|
77
|
+
|
|
78
|
+
//# sourceMappingURL=deprecations.js.map
|
package/mtds/deprecations.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deprecations.js","sources":["../designsystem/deprecations.ts"],"sourcesContent":["import { DSFieldElement } from \".\";\nimport styles from \"./styles.module.css\";\nimport {\n\tattr,\n\tdebounce,\n\tgetByCSSModule,\n\tisBrowser,\n\ton,\n\tonHotReload,\n\tonMutation,\n\tQUICK_EVENT,\n} from \"./utils\";\n\nconst DEPRECATIONS = new WeakSet<Element>();\nconst deprecate = (el: Element) =>\n\t!DEPRECATIONS.has(el) && DEPRECATIONS.add(el);\n\nconst warn = (from: string, to: string, el: Element) =>\n\twindow.dsWarnings === false ||\n\tconsole.warn(\n\t\t`\\x1B[1m@mattilsynet/design:\\x1B[m ${from} is deprecated, please use ${to}:`,\n\t\tel,\n\t);\n\n// Deprecate togglegroup without data-toggle-group attribute\nconst TOGGLEGROUPS = getByCSSModule(\"togglegroup\");\nconst CSS_BUTTON = styles.button.split(\" \");\nconst deprecateToggleGroup = () => {\n\tfor (const el of TOGGLEGROUPS) {\n\t\tif (deprecate(el) && !el.hasAttribute(\"data-toggle-group\")) {\n\t\t\tattr(el, \"data-toggle-group\", \"Valgknapper\");\n\t\t\twarn(\n\t\t\t\t'Only setting class=\"styles.togglegroup\"',\n\t\t\t\t'data-toggle-group=\"LABEL-HERE\" attribute also for better accessibility',\n\t\t\t\tel,\n\t\t\t);\n\t\t}\n\t\tfor (const label of el.getElementsByTagName(\"label\")) {\n\t\t\tif (deprecate(label) && !label.classList.contains(CSS_BUTTON[0])) {\n\t\t\t\tlabel.classList.add(...CSS_BUTTON);\n\t\t\t\twarn(\n\t\t\t\t\t'Only setting class=\"styles.button\"',\n\t\t\t\t\t`<label class=\"styles.button\">`,\n\t\t\t\t\tlabel,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n};\n\n// Deprecate errorsummary without ds-error-summary element\nconst BREADCRUMBS = getByCSSModule(\"breadcrumbs\");\nconst deprecateBreadcrumbs = () => {\n\tfor (const el of BREADCRUMBS)\n\t\tif (deprecate(el) && el.nodeName !== \"DS-BREADCRUMBS\") {\n\t\t\tel.classList.add(...styles.breadcrumbs.split(\" \"));\n\t\t\twarn(\n\t\t\t\t'Only setting class=\"styles.breadcrumbs\"',\n\t\t\t\t'<ds-breadcrumbs class=\"styles.breadcrumbs\">',\n\t\t\t\tel,\n\t\t\t);\n\t\t}\n};\n\n// Deprecate errorsummary without ds-error-summary element\nconst ERRORSUMMARYS = getByCSSModule(\"errorsummary\");\nconst deprecateErrorSummary = () => {\n\tfor (const el of ERRORSUMMARYS)\n\t\tif (deprecate(el) && el.nodeName !== \"DS-ERROR-SUMMARY\") {\n\t\t\twarn(\n\t\t\t\t'Only setting class=\"styles.errorsummary\"',\n\t\t\t\t'<ds-error-summary class=\"styles.errorsummary\">',\n\t\t\t\tel,\n\t\t\t);\n\t\t}\n};\n\n// Deprecate data-variant and data-modal and data-closedby on dialogs\nconst DIALOGS = getByCSSModule(\"dialog\") as HTMLCollectionOf<HTMLDialogElement>;\nconst deprecateDialog = () => {\n\tfor (const el of DIALOGS) {\n\t\tif (deprecate(el)) {\n\t\t\tconst closedby = attr(el, \"data-closedby\");\n\t\t\tif (closedby) {\n\t\t\t\tattr(el, \"closedby\", closedby);\n\t\t\t\twarn(\n\t\t\t\t\t`<dialog data-closedby=\"${closedby}\">`,\n\t\t\t\t\t`<dialog closedby=\"${closedby}\">`,\n\t\t\t\t\tel,\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (el.hasAttribute(\"data-variant\")) {\n\t\t\t\twarn(\n\t\t\t\t\t'<dialog data-variant=\"drawer\">',\n\t\t\t\t\t'<dialog data-placement=\"center|left|right|top|bottom\">',\n\t\t\t\t\tel,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tif (el.isConnected && el.showModal && el.close) {\n\t\t\tif (\n\t\t\t\tel.matches('[open][data-modal]:not([data-modal=\"false\"]):not(:modal)')\n\t\t\t) {\n\t\t\t\twarn(\n\t\t\t\t\t'<dialog data-modal=\"true\">',\n\t\t\t\t\t'.showModal() or <button command=\"show-modal\" commandfor=\"DIALOG-ID\"></button>',\n\t\t\t\t\tel,\n\t\t\t\t);\n\t\t\t\tattr(el, \"open\", null); // Using attribute instead of .close to avoid `close` event\n\t\t\t\tel.showModal();\n\t\t\t} else if (el.matches(\":modal:not([open])\")) {\n\t\t\t\tattr(el, \"open\", \"\"); // Set as open\n\t\t\t\tel.close(); // So we correctly can call .close, removing <dialog> from #top-layer\n\t\t\t}\n\t\t}\n\t}\n};\n\n// Deprecate data-count in favor of data-limit\nconst deprecateCounter = () => {\n\tfor (const el of document.querySelectorAll(\"[data-count]\"))\n\t\tif (deprecate(el)) {\n\t\t\tconst count = attr(el, \"data-count\");\n\t\t\tel.classList.add(...styles.validation.split(\" \"));\n\t\t\tattr(el, \"data-limit\", count);\n\t\t\twarn(\n\t\t\t\t`data-count=\"${count}\"`,\n\t\t\t\t`class=\"styles.validation\" data-field=\"counter\" data-limit=\"${count}\"`,\n\t\t\t\tel,\n\t\t\t);\n\t\t}\n};\n\n// Deprecate data-command on buttons and other elements\nconst deprecateDataCommand = () => {\n\tfor (const el of document.querySelectorAll(\"[data-command]\"))\n\t\tif (deprecate(el)) {\n\t\t\tconst command = attr(el, \"data-command\");\n\n\t\t\tif (command === \"row\")\n\t\t\t\twarn(\n\t\t\t\t\t`<${el.nodeName.toLowerCase()} data-command=\"${command}\">`,\n\t\t\t\t\t`<tr data-clickdelegatefor=\"${el.nodeName}-ID\">`,\n\t\t\t\t\tel,\n\t\t\t\t);\n\t\t\telse\n\t\t\t\twarn(\n\t\t\t\t\t`<button data-command=\"${command}\">`,\n\t\t\t\t\t`<button command=\"${command?.replace(\"toggle-app-expanded\", \"show-modal\")}\" commandfor=\"TARGET-ID\">`,\n\t\t\t\t\tel,\n\t\t\t\t);\n\t\t}\n};\n\n// Deprecate u-tabs\nconst TABS = isBrowser() ? document.getElementsByTagName(\"u-tabs\") : [];\nconst deprecateUTabs = () => {\n\tfor (const el of TABS) if (deprecate(el)) warn(\"u-tabs\", \"ds-tabs\", el);\n};\n\n// Deprecate u-details\nconst DETAILS = isBrowser() ? document.getElementsByTagName(\"u-details\") : [];\nconst deprecateUDetails = () => {\n\tfor (const el of DETAILS) if (deprecate(el)) warn(\"u-details\", \"details\", el);\n};\n\n// Deprecate u-combobox and add class to ds-suggestion\nconst CSS_SUGGESTION = styles.suggestion.split(\" \");\nconst OLD = isBrowser() ? document.getElementsByTagName(\"u-combobox\") : [];\nconst NEW = isBrowser() ? document.getElementsByTagName(\"ds-suggestion\") : [];\nconst deprecateUCombobox = () => {\n\tfor (const el of OLD)\n\t\tif (deprecate(el)) {\n\t\t\tel.classList.add(...CSS_SUGGESTION);\n\t\t\twarn(\"<u-combobox>\", `<ds-suggestion class=\"styles.suggestion\">`, el);\n\t\t}\n\tfor (const el of NEW)\n\t\tif (deprecate(el) && !el.classList.contains(CSS_SUGGESTION[0])) {\n\t\t\tel.classList.add(...CSS_SUGGESTION);\n\t\t\twarn(\n\t\t\t\t\"Only using <ds-suggestion>\",\n\t\t\t\t`<ds-suggestion class=\"styles.suggestion\">`,\n\t\t\t\tel,\n\t\t\t);\n\t\t}\n};\n\nconst handleCommandClick = ({ target: el }: Event) => {\n\tif (el instanceof Element === false) return;\n\tconst row = el?.closest(\"tr\")?.querySelector('[data-command=\"row\"]');\n\tconst click =\n\t\trow && !el?.closest('a,button,label,input,select,textarea,[role=\"button\"]');\n\tif (click) (row as HTMLElement).click(); // Forward click to data-command=\"row\" element\n\n\tconst dialog = el?.closest(\"dialog\");\n\tconst close = dialog && el?.closest('[data-command=\"close\"]');\n\tif (close) dialog.close();\n};\n\n// Deprecate fields without ds-field element\nconst FIELDS = getByCSSModule(\"field\");\nconst FIELD_UNBIND = new Set<Element>();\nconst deprecateField = () => {\n\tfor (const el of FIELDS)\n\t\tif (el.nodeName !== \"DS-FIELD\") {\n\t\t\tif (!deprecate(el))\n\t\t\t\twarn(\n\t\t\t\t\t'Only setting class=\"styles.field\"',\n\t\t\t\t\t'<ds-field class=\"styles.field\">',\n\t\t\t\t\tel,\n\t\t\t\t);\n\t\t\tif (!FIELD_UNBIND.has(el) && FIELD_UNBIND.add(el)) {\n\t\t\t\tDSFieldElement.prototype.connectedCallback.call(el as DSFieldElement);\n\t\t\t}\n\t\t}\n};\nconst unbindFields = () => {\n\tfor (const el of FIELD_UNBIND) {\n\t\tDSFieldElement.prototype.disconnectedCallback.call(el as DSFieldElement);\n\t\tFIELD_UNBIND.delete(el);\n\t}\n};\n\n// Deprecate validation without data-field=\"validation\"\nconst CSS_DESCRIPTIONS = `[data-description], .${styles.field.split(\" \")[0]} label + p`;\nconst deprecateFeildDescription = () => {\n\tfor (const el of document.querySelectorAll(CSS_DESCRIPTIONS))\n\t\tif (deprecate(el) && el.getAttribute(\"data-field\") !== \"description\") {\n\t\t\tattr(el, \"data-field\", \"description\");\n\t\t\twarn(\n\t\t\t\t\"Descriptions created by data-description of <p> only\",\n\t\t\t\t'data-field=\"data-description\"',\n\t\t\t\tel,\n\t\t\t);\n\t\t}\n};\n\n// Deprecate validation without data-field=\"validation\"\nconst VALIDATIONS = getByCSSModule(\"validation\");\nconst deprecateFieldValidation = () => {\n\tfor (const el of VALIDATIONS)\n\t\tif (deprecate(el) && !el.hasAttribute(\"data-field\")) {\n\t\t\tattr(el, \"data-field\", \"validation\");\n\t\t\twarn(\n\t\t\t\t'Only setting class=\"styles.validation\"',\n\t\t\t\t'class=\"styles.validation\" data-field=\"validation\"',\n\t\t\t\tel,\n\t\t\t);\n\t\t}\n};\n\nconst deprecatePopoverPosition = () => {\n\tfor (const el of document.querySelectorAll(\"[popover][data-position]\"))\n\t\tif (deprecate(el)) {\n\t\t\tattr(el, \"data-placement\", attr(el, \"data-position\"));\n\t\t\twarn(\"data-position\", \"data-placement\", el);\n\t\t}\n};\n\nconst handleDeprecations = debounce(() => {\n\tif (!isBrowser()) return; // Check if document is still available, since this can run in test environments after document is destroyed\n\tdeprecateCounter();\n\tdeprecateDataCommand();\n\tdeprecateBreadcrumbs();\n\tdeprecateDialog();\n\tdeprecateErrorSummary();\n\tdeprecateFeildDescription();\n\tdeprecateFieldValidation();\n\tdeprecatePopoverPosition();\n\tdeprecateField(); // Should run after other field deprecations to access correct data-attributes\n\tdeprecateToggleGroup();\n\tdeprecateUCombobox();\n\tdeprecateUTabs();\n\tdeprecateUDetails();\n}, 200);\n\nonHotReload(\"deprecations\", () => [\n\tunbindFields, // Return as cleanup function\n\ton(document, \"click\", handleCommandClick, QUICK_EVENT),\n\ton(document, \"toggle\", deprecateDialog, true),\n\tonMutation(document, handleDeprecations, {\n\t\tattributeFilter: [\n\t\t\t\"class\",\n\t\t\t\"data-command\",\n\t\t\t\"data-count\",\n\t\t\t\"data-description\",\n\t\t\t\"data-variant\",\n\t\t\t\"open\",\n\t\t],\n\t\tattributes: true,\n\t\tchildList: true,\n\t\tsubtree: true,\n\t}),\n]);\n"],"names":["DEPRECATIONS","deprecate","el","warn","from","to","TOGGLEGROUPS","getByCSSModule","CSS_BUTTON","styles","deprecateToggleGroup","attr","label","BREADCRUMBS","deprecateBreadcrumbs","ERRORSUMMARYS","deprecateErrorSummary","DIALOGS","deprecateDialog","closedby","deprecateCounter","count","deprecateDataCommand","command","TABS","isBrowser","deprecateUTabs","DETAILS","deprecateUDetails","CSS_SUGGESTION","OLD","NEW","deprecateUCombobox","handleCommandClick","row","dialog","FIELDS","FIELD_UNBIND","deprecateField","DSFieldElement","unbindFields","CSS_DESCRIPTIONS","deprecateFeildDescription","VALIDATIONS","deprecateFieldValidation","deprecatePopoverPosition","handleDeprecations","debounce","onHotReload","on","QUICK_EVENT","onMutation"],"mappings":";;;;;;;;;;;;;;;;AAaA,MAAMA,wBAAmB,QAAA,GACnBC,IAAY,CAACC,MAClB,CAACF,EAAa,IAAIE,CAAE,KAAKF,EAAa,IAAIE,CAAE,GAEvCC,IAAO,CAACC,GAAcC,GAAYH,MACvC,OAAO,eAAe,MACtB,QAAQ;AAAA,EACP,qCAAqCE,CAAI,8BAA8BC,CAAE;AAAA,EACzEH;AACD,GAGKI,IAAeC,EAAe,aAAa,GAC3CC,IAAaC,EAAO,OAAO,MAAM,G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U/B,GAAiB,EAAI;AAAA,EAC5CiC,EAAW,UAAUL,GAAoB;AAAA,IACxC,iBAAiB;AAAA,MAChB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,IAED,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,SAAS;AAAA,EAAA,CACT;AACF,CAAC;"}
|
|
1
|
+
{"version":3,"file":"deprecations.js","names":[],"sources":["../designsystem/deprecations.ts"],"sourcesContent":["import { DSFieldElement } from \".\";\nimport styles from \"./styles.module.css\";\nimport {\n\tattr,\n\tdebounce,\n\tgetByCSSModule,\n\tisBrowser,\n\ton,\n\tonHotReload,\n\tonMutation,\n\tQUICK_EVENT,\n} from \"./utils\";\n\nconst DEPRECATIONS = new WeakSet<Element>();\nconst deprecate = (el: Element) =>\n\t!DEPRECATIONS.has(el) && DEPRECATIONS.add(el);\n\nconst warn = (from: string, to: string, el: Element) =>\n\twindow.dsWarnings === false ||\n\tconsole.warn(\n\t\t`\\x1B[1m@mattilsynet/design:\\x1B[m ${from} is deprecated, please use ${to}:`,\n\t\tel,\n\t);\n\n// Deprecate togglegroup without data-toggle-group attribute\nconst TOGGLEGROUPS = getByCSSModule(\"togglegroup\");\nconst CSS_BUTTON = styles.button.split(\" \");\nconst deprecateToggleGroup = () => {\n\tfor (const el of TOGGLEGROUPS) {\n\t\tif (deprecate(el) && !el.hasAttribute(\"data-toggle-group\")) {\n\t\t\tattr(el, \"data-toggle-group\", \"Valgknapper\");\n\t\t\twarn(\n\t\t\t\t'Only setting class=\"styles.togglegroup\"',\n\t\t\t\t'data-toggle-group=\"LABEL-HERE\" attribute also for better accessibility',\n\t\t\t\tel,\n\t\t\t);\n\t\t}\n\t\tfor (const label of el.getElementsByTagName(\"label\")) {\n\t\t\tif (deprecate(label) && !label.classList.contains(CSS_BUTTON[0])) {\n\t\t\t\tlabel.classList.add(...CSS_BUTTON);\n\t\t\t\twarn(\n\t\t\t\t\t'Only setting class=\"styles.button\"',\n\t\t\t\t\t`<label class=\"styles.button\">`,\n\t\t\t\t\tlabel,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n};\n\n// Deprecate errorsummary without ds-error-summary element\nconst BREADCRUMBS = getByCSSModule(\"breadcrumbs\");\nconst deprecateBreadcrumbs = () => {\n\tfor (const el of BREADCRUMBS)\n\t\tif (deprecate(el) && el.nodeName !== \"DS-BREADCRUMBS\") {\n\t\t\tel.classList.add(...styles.breadcrumbs.split(\" \"));\n\t\t\twarn(\n\t\t\t\t'Only setting class=\"styles.breadcrumbs\"',\n\t\t\t\t'<ds-breadcrumbs class=\"styles.breadcrumbs\">',\n\t\t\t\tel,\n\t\t\t);\n\t\t}\n};\n\n// Deprecate errorsummary without ds-error-summary element\nconst ERRORSUMMARYS = getByCSSModule(\"errorsummary\");\nconst deprecateErrorSummary = () => {\n\tfor (const el of ERRORSUMMARYS)\n\t\tif (deprecate(el) && el.nodeName !== \"DS-ERROR-SUMMARY\") {\n\t\t\twarn(\n\t\t\t\t'Only setting class=\"styles.errorsummary\"',\n\t\t\t\t'<ds-error-summary class=\"styles.errorsummary\">',\n\t\t\t\tel,\n\t\t\t);\n\t\t}\n};\n\n// Deprecate data-variant and data-modal and data-closedby on dialogs\nconst DIALOGS = getByCSSModule(\"dialog\") as HTMLCollectionOf<HTMLDialogElement>;\nconst deprecateDialog = () => {\n\tfor (const el of DIALOGS) {\n\t\tif (deprecate(el)) {\n\t\t\tconst closedby = attr(el, \"data-closedby\");\n\t\t\tif (closedby) {\n\t\t\t\tattr(el, \"closedby\", closedby);\n\t\t\t\twarn(\n\t\t\t\t\t`<dialog data-closedby=\"${closedby}\">`,\n\t\t\t\t\t`<dialog closedby=\"${closedby}\">`,\n\t\t\t\t\tel,\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (el.hasAttribute(\"data-variant\")) {\n\t\t\t\twarn(\n\t\t\t\t\t'<dialog data-variant=\"drawer\">',\n\t\t\t\t\t'<dialog data-placement=\"center|left|right|top|bottom\">',\n\t\t\t\t\tel,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tif (el.isConnected && el.showModal && el.close) {\n\t\t\tif (\n\t\t\t\tel.matches('[open][data-modal]:not([data-modal=\"false\"]):not(:modal)')\n\t\t\t) {\n\t\t\t\twarn(\n\t\t\t\t\t'<dialog data-modal=\"true\">',\n\t\t\t\t\t'.showModal() or <button command=\"show-modal\" commandfor=\"DIALOG-ID\"></button>',\n\t\t\t\t\tel,\n\t\t\t\t);\n\t\t\t\tattr(el, \"open\", null); // Using attribute instead of .close to avoid `close` event\n\t\t\t\tel.showModal();\n\t\t\t} else if (el.matches(\":modal:not([open])\")) {\n\t\t\t\tattr(el, \"open\", \"\"); // Set as open\n\t\t\t\tel.close(); // So we correctly can call .close, removing <dialog> from #top-layer\n\t\t\t}\n\t\t}\n\t}\n};\n\n// Deprecate data-count in favor of data-limit\nconst deprecateCounter = () => {\n\tfor (const el of document.querySelectorAll(\"[data-count]\"))\n\t\tif (deprecate(el)) {\n\t\t\tconst count = attr(el, \"data-count\");\n\t\t\tel.classList.add(...styles.validation.split(\" \"));\n\t\t\tattr(el, \"data-limit\", count);\n\t\t\twarn(\n\t\t\t\t`data-count=\"${count}\"`,\n\t\t\t\t`class=\"styles.validation\" data-field=\"counter\" data-limit=\"${count}\"`,\n\t\t\t\tel,\n\t\t\t);\n\t\t}\n};\n\n// Deprecate data-command on buttons and other elements\nconst deprecateDataCommand = () => {\n\tfor (const el of document.querySelectorAll(\"[data-command]\"))\n\t\tif (deprecate(el)) {\n\t\t\tconst command = attr(el, \"data-command\");\n\n\t\t\tif (command === \"row\")\n\t\t\t\twarn(\n\t\t\t\t\t`<${el.nodeName.toLowerCase()} data-command=\"${command}\">`,\n\t\t\t\t\t`<tr data-clickdelegatefor=\"${el.nodeName}-ID\">`,\n\t\t\t\t\tel,\n\t\t\t\t);\n\t\t\telse\n\t\t\t\twarn(\n\t\t\t\t\t`<button data-command=\"${command}\">`,\n\t\t\t\t\t`<button command=\"${command?.replace(\"toggle-app-expanded\", \"show-modal\")}\" commandfor=\"TARGET-ID\">`,\n\t\t\t\t\tel,\n\t\t\t\t);\n\t\t}\n};\n\n// Deprecate u-tabs\nconst TABS = isBrowser() ? document.getElementsByTagName(\"u-tabs\") : [];\nconst deprecateUTabs = () => {\n\tfor (const el of TABS) if (deprecate(el)) warn(\"u-tabs\", \"ds-tabs\", el);\n};\n\n// Deprecate u-details\nconst DETAILS = isBrowser() ? document.getElementsByTagName(\"u-details\") : [];\nconst deprecateUDetails = () => {\n\tfor (const el of DETAILS) if (deprecate(el)) warn(\"u-details\", \"details\", el);\n};\n\n// Deprecate u-combobox and add class to ds-suggestion\nconst CSS_SUGGESTION = styles.suggestion.split(\" \");\nconst OLD = isBrowser() ? document.getElementsByTagName(\"u-combobox\") : [];\nconst NEW = isBrowser() ? document.getElementsByTagName(\"ds-suggestion\") : [];\nconst deprecateUCombobox = () => {\n\tfor (const el of OLD)\n\t\tif (deprecate(el)) {\n\t\t\tel.classList.add(...CSS_SUGGESTION);\n\t\t\twarn(\"<u-combobox>\", `<ds-suggestion class=\"styles.suggestion\">`, el);\n\t\t}\n\tfor (const el of NEW)\n\t\tif (deprecate(el) && !el.classList.contains(CSS_SUGGESTION[0])) {\n\t\t\tel.classList.add(...CSS_SUGGESTION);\n\t\t\twarn(\n\t\t\t\t\"Only using <ds-suggestion>\",\n\t\t\t\t`<ds-suggestion class=\"styles.suggestion\">`,\n\t\t\t\tel,\n\t\t\t);\n\t\t}\n};\n\nconst handleCommandClick = ({ target: el }: Event) => {\n\tif (el instanceof Element === false) return;\n\tconst row = el?.closest(\"tr\")?.querySelector('[data-command=\"row\"]');\n\tconst click =\n\t\trow && !el?.closest('a,button,label,input,select,textarea,[role=\"button\"]');\n\tif (click) (row as HTMLElement).click(); // Forward click to data-command=\"row\" element\n\n\tconst dialog = el?.closest(\"dialog\");\n\tconst close = dialog && el?.closest('[data-command=\"close\"]');\n\tif (close) dialog.close();\n};\n\n// Deprecate fields without ds-field element\nconst FIELDS = getByCSSModule(\"field\");\nconst FIELD_UNBIND = new Set<Element>();\nconst deprecateField = () => {\n\tfor (const el of FIELDS)\n\t\tif (el.nodeName !== \"DS-FIELD\") {\n\t\t\tif (!deprecate(el))\n\t\t\t\twarn(\n\t\t\t\t\t'Only setting class=\"styles.field\"',\n\t\t\t\t\t'<ds-field class=\"styles.field\">',\n\t\t\t\t\tel,\n\t\t\t\t);\n\t\t\tif (!FIELD_UNBIND.has(el) && FIELD_UNBIND.add(el)) {\n\t\t\t\tDSFieldElement.prototype.connectedCallback.call(el as DSFieldElement);\n\t\t\t}\n\t\t}\n};\nconst unbindFields = () => {\n\tfor (const el of FIELD_UNBIND) {\n\t\tDSFieldElement.prototype.disconnectedCallback.call(el as DSFieldElement);\n\t\tFIELD_UNBIND.delete(el);\n\t}\n};\n\n// Deprecate validation without data-field=\"validation\"\nconst CSS_DESCRIPTIONS = `[data-description], .${styles.field.split(\" \")[0]} label + p`;\nconst deprecateFeildDescription = () => {\n\tfor (const el of document.querySelectorAll(CSS_DESCRIPTIONS))\n\t\tif (deprecate(el) && el.getAttribute(\"data-field\") !== \"description\") {\n\t\t\tattr(el, \"data-field\", \"description\");\n\t\t\twarn(\n\t\t\t\t\"Descriptions created by data-description of <p> only\",\n\t\t\t\t'data-field=\"data-description\"',\n\t\t\t\tel,\n\t\t\t);\n\t\t}\n};\n\n// Deprecate validation without data-field=\"validation\"\nconst VALIDATIONS = getByCSSModule(\"validation\");\nconst deprecateFieldValidation = () => {\n\tfor (const el of VALIDATIONS)\n\t\tif (deprecate(el) && !el.hasAttribute(\"data-field\")) {\n\t\t\tattr(el, \"data-field\", \"validation\");\n\t\t\twarn(\n\t\t\t\t'Only setting class=\"styles.validation\"',\n\t\t\t\t'class=\"styles.validation\" data-field=\"validation\"',\n\t\t\t\tel,\n\t\t\t);\n\t\t}\n};\n\nconst deprecatePopoverPosition = () => {\n\tfor (const el of document.querySelectorAll(\"[popover][data-position]\"))\n\t\tif (deprecate(el)) {\n\t\t\tattr(el, \"data-placement\", attr(el, \"data-position\"));\n\t\t\twarn(\"data-position\", \"data-placement\", el);\n\t\t}\n};\n\nconst handleDeprecations = debounce(() => {\n\tif (!isBrowser()) return; // Check if document is still available, since this can run in test environments after document is destroyed\n\tdeprecateCounter();\n\tdeprecateDataCommand();\n\tdeprecateBreadcrumbs();\n\tdeprecateDialog();\n\tdeprecateErrorSummary();\n\tdeprecateFeildDescription();\n\tdeprecateFieldValidation();\n\tdeprecatePopoverPosition();\n\tdeprecateField(); // Should run after other field deprecations to access correct data-attributes\n\tdeprecateToggleGroup();\n\tdeprecateUCombobox();\n\tdeprecateUTabs();\n\tdeprecateUDetails();\n}, 200);\n\nonHotReload(\"deprecations\", () => [\n\tunbindFields, // Return as cleanup function\n\ton(document, \"click\", handleCommandClick, QUICK_EVENT),\n\ton(document, \"toggle\", deprecateDialog, true),\n\tonMutation(document, handleDeprecations, {\n\t\tattributeFilter: [\n\t\t\t\"class\",\n\t\t\t\"data-command\",\n\t\t\t\"data-count\",\n\t\t\t\"data-description\",\n\t\t\t\"data-variant\",\n\t\t\t\"open\",\n\t\t],\n\t\tattributes: true,\n\t\tchildList: true,\n\t\tsubtree: true,\n\t}),\n]);\n"],"mappings":";;;;AAaA,IAAM,oBAAe,IAAI,QAAiB,GACpC,KAAa,MAClB,CAAC,EAAa,IAAI,CAAE,KAAK,EAAa,IAAI,CAAE,GAEvC,KAAQ,GAAc,GAAY,MACvC,OAAO,eAAe,MACtB,QAAQ,KACP,qCAAqC,EAAK,6BAA6B,EAAG,IAC1E,CACD,GAGK,IAAe,EAAe,aAAa,GAC3C,IAAa,EAAO,OAAO,MAAM,GAAG,GACpC,UAA6B;CAClC,KAAK,IAAM,KAAM,GAAc;EAC9B,AAAI,EAAU,CAAE,KAAK,CAAC,EAAG,aAAa,mBAAmB,MACxD,EAAK,GAAI,qBAAqB,aAAa,GAC3C,EACC,6CACA,4EACA,CACD;EAED,KAAK,IAAM,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EM,IAAqB,QAAe;CACpC,EAAU,MACf,EAAiB,GACjB,EAAqB,GACrB,EAAqB,GACrB,EAAgB,GAChB,EAAsB,GACtB,EAA0B,GAC1B,EAAyB,GACzB,EAAyB,GACzB,EAAe,GACf,EAAqB,GACrB,EAAmB,GACnB,EAAe,GACf,EAAkB;AACnB,GAAG,GAAG;AAEN,EAAY,sBAAsB;CACjC;CACA,EAAG,UAAU,SAAS,GAAoB,CAAW;CACrD,EAAG,UAAU,UAAU,GAAiB,EAAI;CAC5C,EAAW,UAAU,GAAoB;EACxC,iBAAiB;GAChB;GACA;GACA;GACA;GACA;GACA;EACD;EACA,YAAY;EACZ,WAAW;EACX,SAAS;CACV,CAAC;AACF,CAAC"}
|
package/mtds/details/details.js
CHANGED
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
y as Details
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=details.js.map
|
|
1
|
+
import e from "../styles.module.js";
|
|
2
|
+
import t from "clsx";
|
|
3
|
+
import { forwardRef as n } from "react";
|
|
4
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
5
|
+
//#region designsystem/details/details.tsx
|
|
6
|
+
var i = n(function({ className: n, ...i }, a) {
|
|
7
|
+
return /* @__PURE__ */ r("details", {
|
|
8
|
+
ref: a,
|
|
9
|
+
className: t(e.details, n),
|
|
10
|
+
...i
|
|
11
|
+
});
|
|
12
|
+
}), a = n(function(e, t) {
|
|
13
|
+
return /* @__PURE__ */ r("summary", {
|
|
14
|
+
ref: t,
|
|
15
|
+
...e
|
|
16
|
+
});
|
|
17
|
+
}), o = Object.assign(i, { Summary: a });
|
|
18
|
+
//#endregion
|
|
19
|
+
export { o as Details };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=details.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"details.js","sources":["../../designsystem/details/details.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef } from \"react\";\nimport styles from \"../styles.module.css\";\n\nexport type DetailsProps = React.ComponentPropsWithoutRef<\"details\"> & {\n\t\"data-align\"?: \"start\" | \"center\";\n\t\"data-variant\"?: \"default\" | \"card\";\n};\nconst DetailsComp = forwardRef<HTMLDetailsElement, DetailsProps>(\n\tfunction Details({ className, ...rest }, ref) {\n\t\treturn (\n\t\t\t<details\n\t\t\t\tref={ref}\n\t\t\t\tclassName={clsx(styles.details, className)}\n\t\t\t\t{...rest}\n\t\t\t/>\n\t\t);\n\t},\n);\n\nexport type SummaryProps = React.ComponentPropsWithoutRef<\"summary\">;\nconst DetailsSummary = forwardRef<HTMLElement, SummaryProps>(\n\tfunction DetailsSummary(rest, ref) {\n\t\treturn <summary ref={ref} {...rest} />;\n\t},\n);\n\nexport const Details = Object.assign(DetailsComp, { Summary: DetailsSummary });\n"],"
|
|
1
|
+
{"version":3,"file":"details.js","names":[],"sources":["../../designsystem/details/details.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef } from \"react\";\nimport styles from \"../styles.module.css\";\n\nexport type DetailsProps = React.ComponentPropsWithoutRef<\"details\"> & {\n\t\"data-align\"?: \"start\" | \"center\";\n\t\"data-variant\"?: \"default\" | \"card\";\n};\nconst DetailsComp = forwardRef<HTMLDetailsElement, DetailsProps>(\n\tfunction Details({ className, ...rest }, ref) {\n\t\treturn (\n\t\t\t<details\n\t\t\t\tref={ref}\n\t\t\t\tclassName={clsx(styles.details, className)}\n\t\t\t\t{...rest}\n\t\t\t/>\n\t\t);\n\t},\n);\n\nexport type SummaryProps = React.ComponentPropsWithoutRef<\"summary\">;\nconst DetailsSummary = forwardRef<HTMLElement, SummaryProps>(\n\tfunction DetailsSummary(rest, ref) {\n\t\treturn <summary ref={ref} {...rest} />;\n\t},\n);\n\nexport const Details = Object.assign(DetailsComp, { Summary: DetailsSummary });\n"],"mappings":";;;;;AAQA,IAAM,IAAc,EACnB,SAAiB,EAAE,cAAW,GAAG,KAAQ,GAAK;CAC7C,OACC,kBAAC,WAAD;EACM;EACL,WAAW,EAAK,EAAO,SAAS,CAAS;EACzC,GAAI;CACJ,CAAA;AAEH,CACD,GAGM,IAAiB,EACtB,SAAwB,GAAM,GAAK;CAClC,OAAO,kBAAC,WAAD;EAAc;EAAK,GAAI;CAAO,CAAA;AACtC,CACD,GAEa,IAAU,OAAO,OAAO,GAAa,EAAE,SAAS,EAAe,CAAC"}
|
package/mtds/dialog/dialog.js
CHANGED
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
export {
|
|
19
|
-
g as Dialog
|
|
20
|
-
};
|
|
21
|
-
//# sourceMappingURL=dialog.js.map
|
|
1
|
+
import e from "../styles.module.js";
|
|
2
|
+
import t from "clsx";
|
|
3
|
+
import { forwardRef as n } from "react";
|
|
4
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
5
|
+
//#region designsystem/dialog/dialog.tsx
|
|
6
|
+
var i = n(function({ className: n, modal: i = !0, ...a }, o) {
|
|
7
|
+
return /* @__PURE__ */ r("dialog", {
|
|
8
|
+
className: t(e.dialog, n),
|
|
9
|
+
"data-modal": a["data-modal"] ?? i,
|
|
10
|
+
ref: o,
|
|
11
|
+
...a
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
//#endregion
|
|
15
|
+
export { i as Dialog };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=dialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.js","sources":["../../designsystem/dialog/dialog.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef } from \"react\";\nimport styles from \"../styles.module.css\";\n\nexport type DialogProps = React.ComponentPropsWithoutRef<\"dialog\"> & {\n\t\"data-placement\"?: \"center\" | \"top\" | \"bottom\" | \"left\" | \"right\";\n\t/**\n\t * @deprecated Use 'closedby' instead\n\t */\n\t\"data-closedby\"?: \"any\" | \"closerequest\";\n\t/**\n\t * @deprecated Use '<button command=\"show-modal\" commandfor=\"DIALOG-ID\">' instead\n\t */\n\t\"data-modal\"?: boolean | \"true\" | \"false\";\n\t/**\n\t * @deprecated Use '<button command=\"show-modal\" commandfor=\"DIALOG-ID\">' instead\n\t */\n\tmodal?: boolean;\n};\n\nexport const Dialog = forwardRef<HTMLDialogElement, DialogProps>(\n\tfunction Dialog({ className, modal = true, ...rest }, ref) {\n\t\treturn (\n\t\t\t<dialog\n\t\t\t\tclassName={clsx(styles.dialog, className)}\n\t\t\t\tdata-modal={rest[\"data-modal\"] ?? modal}\n\t\t\t\tref={ref}\n\t\t\t\t{...rest}\n\t\t\t/>\n\t\t);\n\t},\n);\n"],"
|
|
1
|
+
{"version":3,"file":"dialog.js","names":[],"sources":["../../designsystem/dialog/dialog.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef } from \"react\";\nimport styles from \"../styles.module.css\";\n\nexport type DialogProps = React.ComponentPropsWithoutRef<\"dialog\"> & {\n\t\"data-placement\"?: \"center\" | \"top\" | \"bottom\" | \"left\" | \"right\";\n\t/**\n\t * @deprecated Use 'closedby' instead\n\t */\n\t\"data-closedby\"?: \"any\" | \"closerequest\";\n\t/**\n\t * @deprecated Use '<button command=\"show-modal\" commandfor=\"DIALOG-ID\">' instead\n\t */\n\t\"data-modal\"?: boolean | \"true\" | \"false\";\n\t/**\n\t * @deprecated Use '<button command=\"show-modal\" commandfor=\"DIALOG-ID\">' instead\n\t */\n\tmodal?: boolean;\n};\n\nexport const Dialog = forwardRef<HTMLDialogElement, DialogProps>(\n\tfunction Dialog({ className, modal = true, ...rest }, ref) {\n\t\treturn (\n\t\t\t<dialog\n\t\t\t\tclassName={clsx(styles.dialog, className)}\n\t\t\t\tdata-modal={rest[\"data-modal\"] ?? modal}\n\t\t\t\tref={ref}\n\t\t\t\t{...rest}\n\t\t\t/>\n\t\t);\n\t},\n);\n"],"mappings":";;;;;AAoBA,IAAa,IAAS,EACrB,SAAgB,EAAE,cAAW,WAAQ,IAAM,GAAG,KAAQ,GAAK;CAC1D,OACC,kBAAC,UAAD;EACC,WAAW,EAAK,EAAO,QAAQ,CAAS;EACxC,cAAY,EAAK,iBAAiB;EAC7B;EACL,GAAI;CACJ,CAAA;AAEH,CACD"}
|
package/mtds/divider/divider.js
CHANGED
|
@@ -1,22 +1,17 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from "../styles.module.js";
|
|
2
2
|
import t from "clsx";
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
ref: o,
|
|
14
|
-
...i
|
|
15
|
-
}
|
|
16
|
-
)
|
|
17
|
-
);
|
|
3
|
+
import { forwardRef as n } from "react";
|
|
4
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
5
|
+
//#region designsystem/divider/divider.tsx
|
|
6
|
+
var i = n(function({ className: n, ...i }, a) {
|
|
7
|
+
return /* @__PURE__ */ r("hr", {
|
|
8
|
+
"aria-hidden": "true",
|
|
9
|
+
className: t(e.divider, n),
|
|
10
|
+
ref: a,
|
|
11
|
+
...i
|
|
12
|
+
});
|
|
18
13
|
});
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
//# sourceMappingURL=divider.js.map
|
|
14
|
+
//#endregion
|
|
15
|
+
export { i as Divider };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=divider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"divider.js","sources":["../../designsystem/divider/divider.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef } from \"react\";\nimport styles from \"../styles.module.css\";\n\nexport type DividerProps = React.ComponentPropsWithoutRef<\"hr\"> & {\n\t\"data-gap\"?:\n\t\t| \"0\"\n\t\t| \"1\"\n\t\t| \"2\"\n\t\t| \"3\"\n\t\t| \"4\"\n\t\t| \"5\"\n\t\t| \"6\"\n\t\t| \"7\"\n\t\t| \"8\"\n\t\t| \"9\"\n\t\t| \"10\"\n\t\t| \"11\"\n\t\t| \"12\"\n\t\t| \"13\"\n\t\t| \"14\"\n\t\t| \"15\"\n\t\t| \"18\"\n\t\t| \"22\"\n\t\t| \"26\"\n\t\t| \"30\"\n\t\t| 0\n\t\t| 1\n\t\t| 2\n\t\t| 3\n\t\t| 4\n\t\t| 5\n\t\t| 6\n\t\t| 7\n\t\t| 8\n\t\t| 9\n\t\t| 10\n\t\t| 11\n\t\t| 12\n\t\t| 13\n\t\t| 14\n\t\t| 15\n\t\t| 18\n\t\t| 22\n\t\t| 26\n\t\t| 30\n\t\t// Backwards compatibility:\n\t\t| \"none\"\n\t\t| \"xs\"\n\t\t| \"sm\"\n\t\t| \"md\"\n\t\t| \"lg\"\n\t\t| \"xl\";\n};\n\nexport const Divider = forwardRef<HTMLHRElement, DividerProps>(function Divider(\n\t{ className, ...rest },\n\tref,\n) {\n\treturn (\n\t\t// biome-ignore lint/a11y/noAriaHiddenOnFocusable: This is a decorative element\n\t\t<hr\n\t\t\taria-hidden=\"true\"\n\t\t\tclassName={clsx(styles.divider, className)}\n\t\t\tref={ref}\n\t\t\t{...rest}\n\t\t/>\n\t);\n});\n"],"
|
|
1
|
+
{"version":3,"file":"divider.js","names":[],"sources":["../../designsystem/divider/divider.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef } from \"react\";\nimport styles from \"../styles.module.css\";\n\nexport type DividerProps = React.ComponentPropsWithoutRef<\"hr\"> & {\n\t\"data-gap\"?:\n\t\t| \"0\"\n\t\t| \"1\"\n\t\t| \"2\"\n\t\t| \"3\"\n\t\t| \"4\"\n\t\t| \"5\"\n\t\t| \"6\"\n\t\t| \"7\"\n\t\t| \"8\"\n\t\t| \"9\"\n\t\t| \"10\"\n\t\t| \"11\"\n\t\t| \"12\"\n\t\t| \"13\"\n\t\t| \"14\"\n\t\t| \"15\"\n\t\t| \"18\"\n\t\t| \"22\"\n\t\t| \"26\"\n\t\t| \"30\"\n\t\t| 0\n\t\t| 1\n\t\t| 2\n\t\t| 3\n\t\t| 4\n\t\t| 5\n\t\t| 6\n\t\t| 7\n\t\t| 8\n\t\t| 9\n\t\t| 10\n\t\t| 11\n\t\t| 12\n\t\t| 13\n\t\t| 14\n\t\t| 15\n\t\t| 18\n\t\t| 22\n\t\t| 26\n\t\t| 30\n\t\t// Backwards compatibility:\n\t\t| \"none\"\n\t\t| \"xs\"\n\t\t| \"sm\"\n\t\t| \"md\"\n\t\t| \"lg\"\n\t\t| \"xl\";\n};\n\nexport const Divider = forwardRef<HTMLHRElement, DividerProps>(function Divider(\n\t{ className, ...rest },\n\tref,\n) {\n\treturn (\n\t\t// biome-ignore lint/a11y/noAriaHiddenOnFocusable: This is a decorative element\n\t\t<hr\n\t\t\taria-hidden=\"true\"\n\t\t\tclassName={clsx(styles.divider, className)}\n\t\t\tref={ref}\n\t\t\t{...rest}\n\t\t/>\n\t);\n});\n"],"mappings":";;;;;AAuDA,IAAa,IAAU,EAAwC,SAC9D,EAAE,cAAW,GAAG,KAChB,GACC;CACD,OAEC,kBAAC,MAAD;EACC,eAAY;EACZ,WAAW,EAAK,EAAO,SAAS,CAAS;EACpC;EACL,GAAI;CACJ,CAAA;AAEH,CAAC"}
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
);
|
|
1
|
+
import e from "../styles.module.js";
|
|
2
|
+
import { toCustomElementProps as t } from "../utils.js";
|
|
3
|
+
import { forwardRef as n } from "react";
|
|
4
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
5
|
+
//#region designsystem/errorsummary/errorsummary.tsx
|
|
6
|
+
var i = n(function(n, i) {
|
|
7
|
+
return /* @__PURE__ */ r("ds-error-summary", {
|
|
8
|
+
ref: i,
|
|
9
|
+
...t(n, e.errorsummary)
|
|
10
|
+
});
|
|
13
11
|
});
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
//# sourceMappingURL=errorsummary.js.map
|
|
12
|
+
//#endregion
|
|
13
|
+
export { i as Errorsummary };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=errorsummary.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errorsummary.js","sources":["../../designsystem/errorsummary/errorsummary.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { DSErrorSummaryElement } from \"../\";\nimport type { CustomReactElementProps } from \"../react-types\";\nimport styles from \"../styles.module.css\";\nimport { toCustomElementProps } from \"../utils\";\n\nexport type ErrorsummaryProps = CustomReactElementProps<DSErrorSummaryElement>;\n\nexport const Errorsummary = forwardRef<\n\tDSErrorSummaryElement,\n\tErrorsummaryProps\n>(function Errorsummary(rest, ref) {\n\treturn (\n\t\t<ds-error-summary\n\t\t\tref={ref}\n\t\t\t{...toCustomElementProps(rest, styles.errorsummary)}\n\t\t/>\n\t);\n});\n"],"
|
|
1
|
+
{"version":3,"file":"errorsummary.js","names":[],"sources":["../../designsystem/errorsummary/errorsummary.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { DSErrorSummaryElement } from \"../\";\nimport type { CustomReactElementProps } from \"../react-types\";\nimport styles from \"../styles.module.css\";\nimport { toCustomElementProps } from \"../utils\";\n\nexport type ErrorsummaryProps = CustomReactElementProps<DSErrorSummaryElement>;\n\nexport const Errorsummary = forwardRef<\n\tDSErrorSummaryElement,\n\tErrorsummaryProps\n>(function Errorsummary(rest, ref) {\n\treturn (\n\t\t<ds-error-summary\n\t\t\tref={ref}\n\t\t\t{...toCustomElementProps(rest, styles.errorsummary)}\n\t\t/>\n\t);\n});\n"],"mappings":";;;;;AAQA,IAAa,IAAe,EAG1B,SAAsB,GAAM,GAAK;CAClC,OACC,kBAAC,oBAAD;EACM;EACL,GAAI,EAAqB,GAAM,EAAO,YAAY;CAClD,CAAA;AAEH,CAAC"}
|
|
@@ -1,27 +1,24 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { getCoord as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
l && (f = !0);
|
|
18
|
-
}
|
|
19
|
-
return f;
|
|
1
|
+
import e from "../../../../point-in-polygon-hao/dist/esm/index.js";
|
|
2
|
+
import { getCoord as t, getGeom as n } from "../../../invariant/dist/esm/index.js";
|
|
3
|
+
//#region node_modules/@turf/boolean-point-in-polygon/dist/esm/index.js
|
|
4
|
+
function r(r, a, o = {}) {
|
|
5
|
+
if (!r) throw Error("point is required");
|
|
6
|
+
if (!a) throw Error("polygon is required");
|
|
7
|
+
let s = t(r), c = n(a), l = c.type, u = a.bbox, d = c.coordinates;
|
|
8
|
+
if (u && i(s, u) === !1) return !1;
|
|
9
|
+
l === "Polygon" && (d = [d]);
|
|
10
|
+
let f = !1;
|
|
11
|
+
for (var p = 0; p < d.length; ++p) {
|
|
12
|
+
let t = e(s, d[p]);
|
|
13
|
+
if (t === 0) return !o.ignoreBoundary;
|
|
14
|
+
t && (f = !0);
|
|
15
|
+
}
|
|
16
|
+
return f;
|
|
20
17
|
}
|
|
21
|
-
function
|
|
22
|
-
|
|
18
|
+
function i(e, t) {
|
|
19
|
+
return t[0] <= e[0] && t[1] <= e[1] && t[2] >= e[0] && t[3] >= e[1];
|
|
23
20
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
//# sourceMappingURL=index.js.map
|
|
21
|
+
//#endregion
|
|
22
|
+
export { r as booleanPointInPolygon };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../../node_modules/@turf/boolean-point-in-polygon/dist/esm/index.js"],"sourcesContent":["// index.ts\nimport pip from \"point-in-polygon-hao\";\nimport { getCoord, getGeom } from \"@turf/invariant\";\nfunction booleanPointInPolygon(point, polygon, options = {}) {\n if (!point) {\n throw new Error(\"point is required\");\n }\n if (!polygon) {\n throw new Error(\"polygon is required\");\n }\n const pt = getCoord(point);\n const geom = getGeom(polygon);\n const type = geom.type;\n const bbox = polygon.bbox;\n let polys = geom.coordinates;\n if (bbox && inBBox(pt, bbox) === false) {\n return false;\n }\n if (type === \"Polygon\") {\n polys = [polys];\n }\n let result = false;\n for (var i = 0; i < polys.length; ++i) {\n const polyResult = pip(pt, polys[i]);\n if (polyResult === 0) return options.ignoreBoundary ? false : true;\n else if (polyResult) result = true;\n }\n return result;\n}\nfunction inBBox(pt, bbox) {\n return bbox[0] <= pt[0] && bbox[1] <= pt[1] && bbox[2] >= pt[0] && bbox[3] >= pt[1];\n}\nvar index_default = booleanPointInPolygon;\nexport {\n booleanPointInPolygon,\n index_default as default\n};\n//# sourceMappingURL=index.js.map"],"
|
|
1
|
+
{"version":3,"file":"index.js","names":["pip"],"sources":["../../../../../../node_modules/@turf/boolean-point-in-polygon/dist/esm/index.js"],"sourcesContent":["// index.ts\nimport pip from \"point-in-polygon-hao\";\nimport { getCoord, getGeom } from \"@turf/invariant\";\nfunction booleanPointInPolygon(point, polygon, options = {}) {\n if (!point) {\n throw new Error(\"point is required\");\n }\n if (!polygon) {\n throw new Error(\"polygon is required\");\n }\n const pt = getCoord(point);\n const geom = getGeom(polygon);\n const type = geom.type;\n const bbox = polygon.bbox;\n let polys = geom.coordinates;\n if (bbox && inBBox(pt, bbox) === false) {\n return false;\n }\n if (type === \"Polygon\") {\n polys = [polys];\n }\n let result = false;\n for (var i = 0; i < polys.length; ++i) {\n const polyResult = pip(pt, polys[i]);\n if (polyResult === 0) return options.ignoreBoundary ? false : true;\n else if (polyResult) result = true;\n }\n return result;\n}\nfunction inBBox(pt, bbox) {\n return bbox[0] <= pt[0] && bbox[1] <= pt[1] && bbox[2] >= pt[0] && bbox[3] >= pt[1];\n}\nvar index_default = booleanPointInPolygon;\nexport {\n booleanPointInPolygon,\n index_default as default\n};\n//# sourceMappingURL=index.js.map"],"x_google_ignoreList":[0],"mappings":";;;AAGA,SAAS,EAAsB,GAAO,GAAS,IAAU,CAAC,GAAG;CAC3D,IAAI,CAAC,GACH,MAAU,MAAM,mBAAmB;CAErC,IAAI,CAAC,GACH,MAAU,MAAM,qBAAqB;CAEvC,IAAM,IAAK,EAAS,CAAK,GACnB,IAAO,EAAQ,CAAO,GACtB,IAAO,EAAK,MACZ,IAAO,EAAQ,MACjB,IAAQ,EAAK;CACjB,IAAI,KAAQ,EAAO,GAAI,CAAI,MAAM,IAC/B,OAAO;CAET,AAAI,MAAS,cACX,IAAQ,CAAC,CAAK;CAEhB,IAAI,IAAS;CACb,KAAK,IAAI,IAAI,GAAG,IAAI,EAAM,QAAQ,EAAE,GAAG;EACrC,IAAM,IAAaA,EAAI,GAAI,EAAM,EAAE;EACnC,IAAI,MAAe,GAAG,OAAO,GAAQ;EAChC,AAAI,MAAY,IAAS;CAChC;CACA,OAAO;AACT;AACA,SAAS,EAAO,GAAI,GAAM;CACxB,OAAO,EAAK,MAAM,EAAG,MAAM,EAAK,MAAM,EAAG,MAAM,EAAK,MAAM,EAAG,MAAM,EAAK,MAAM,EAAG;AACnF"}
|