@mattilsynet/design 3.3.7 → 3.3.9
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/ai/avatar.stories.tsx +3 -0
- package/mtds/ai/field.stories.tsx +1 -1
- package/mtds/ai/typography.stories.tsx +25 -3
- package/mtds/atlas/atlas-element.js +1 -1
- package/mtds/external/@u-elements/u-combobox/dist/u-combobox.js +153 -132
- package/mtds/external/@u-elements/u-combobox/dist/u-combobox.js.map +1 -1
- package/mtds/illustrations/books.svg +1 -0
- package/mtds/illustrations/carrot.svg +1 -0
- package/mtds/illustrations/cloud-white-sunshine.svg +1 -0
- package/mtds/illustrations/collaboration-and-culture.svg +1 -0
- package/mtds/illustrations/emergency-vehicle.svg +1 -0
- package/mtds/illustrations/eu-flags.svg +1 -0
- package/mtds/illustrations/eu-work-1.svg +1 -0
- package/mtds/illustrations/eu-work-2.svg +1 -0
- package/mtds/illustrations/fishing-boat-and-fish-health-biologist.svg +1 -0
- package/mtds/illustrations/fishing-boat.svg +1 -0
- package/mtds/illustrations/index.json +147 -7
- package/mtds/illustrations/it-and-security.svg +1 -0
- package/mtds/illustrations/kompass.svg +1 -1
- package/mtds/illustrations/lab-work.svg +1 -0
- package/mtds/illustrations/law-books.svg +1 -0
- package/mtds/illustrations/law.svg +1 -0
- package/mtds/illustrations/letter-in-mailbox.svg +1 -0
- package/mtds/illustrations/man-with-magnifying-glass.svg +1 -0
- package/mtds/illustrations/milk-carton.svg +1 -0
- package/mtds/illustrations/norwegian-parliament.svg +1 -0
- package/mtds/illustrations/pen.svg +1 -0
- package/mtds/illustrations/pencil.svg +1 -0
- package/mtds/illustrations/person-and-infographic.svg +1 -0
- package/mtds/illustrations/person-with-tie.svg +1 -0
- package/mtds/illustrations/screen-with-content.svg +1 -0
- package/mtds/illustrations/shopping-cart-large.svg +1 -0
- package/mtds/illustrations/study.svg +1 -0
- package/mtds/illustrations/telescope.svg +1 -0
- package/mtds/illustrations/trailer.svg +1 -0
- package/mtds/illustrations/user-dialogue.svg +1 -0
- package/mtds/illustrations/user-interface.svg +1 -0
- package/mtds/illustrations/waterworks.svg +1 -0
- package/mtds/index.iife.js +89 -21
- package/mtds/package.json.js +1 -1
- package/mtds/styles.css +1 -1
- package/mtds/styles.json +23 -23
- package/mtds/styles.module.css.js +40 -40
- package/package.json +10 -10
|
@@ -550,7 +550,7 @@ export const WithSuggestionAPI: Story = {
|
|
|
550
550
|
|
|
551
551
|
const getCountries = async (value: string) => {
|
|
552
552
|
if (!value) return setOptions("Name a country");
|
|
553
|
-
const api = `https://dummyjson.com/recipes/search?q=${value}`;
|
|
553
|
+
const api = `https://dummyjson.com/recipes/search?q=${value}`; // TODO FIX
|
|
554
554
|
const data = await (await fetch(api)).json();
|
|
555
555
|
|
|
556
556
|
setOptions(
|
|
@@ -182,11 +182,9 @@ const proseDecorator: Story["decorators"] = (Story) => {
|
|
|
182
182
|
body:has(input[role="switch"]:checked) { --checked: "" }
|
|
183
183
|
body:has(input[role="switch"]:checked) .${CSS_PROSE} > :hover { --background: #88bbff4d }
|
|
184
184
|
body:not(:has(.sbdocs-content)) {
|
|
185
|
-
.${CSS_PROSE} { overflow: clip }
|
|
186
185
|
.${CSS_PROSE} > * {
|
|
187
186
|
position: relative;
|
|
188
|
-
background: var(--background, transparent);
|
|
189
|
-
box-shadow: 100px 0 var(--background, transparent), -100px 0 var(--background, transparent);
|
|
187
|
+
background: linear-gradient(to right, var(--background, transparent), transparent);
|
|
190
188
|
}
|
|
191
189
|
.${CSS_PROSE} > [data-before]::before,
|
|
192
190
|
.${CSS_PROSE} > [data-after]::after {
|
|
@@ -683,6 +681,30 @@ export const Prose: Story = {
|
|
|
683
681
|
forpakningsenheter mindre enn 25 L, dersom de går til en «approved
|
|
684
682
|
arrangement class 4.1» for foredling i Australia.
|
|
685
683
|
</p>
|
|
684
|
+
<ul>
|
|
685
|
+
<li>
|
|
686
|
+
Matliste
|
|
687
|
+
<ul>
|
|
688
|
+
<li>
|
|
689
|
+
Pølse
|
|
690
|
+
<ul>
|
|
691
|
+
<li>Grill</li>
|
|
692
|
+
<li>Wiener</li>
|
|
693
|
+
</ul>
|
|
694
|
+
</li>
|
|
695
|
+
<li>
|
|
696
|
+
Brød
|
|
697
|
+
<ul>
|
|
698
|
+
<li>Rug</li>
|
|
699
|
+
<li>Knekk</li>
|
|
700
|
+
<li>Loff</li>
|
|
701
|
+
<li>Gull</li>
|
|
702
|
+
<li>Hue</li>
|
|
703
|
+
</ul>
|
|
704
|
+
</li>
|
|
705
|
+
</ul>
|
|
706
|
+
</li>
|
|
707
|
+
</ul>
|
|
686
708
|
</div>
|
|
687
709
|
),
|
|
688
710
|
};
|
|
@@ -19,7 +19,7 @@ class r extends g {
|
|
|
19
19
|
}
|
|
20
20
|
constructor() {
|
|
21
21
|
super(), this.attachShadow({ mode: "open" }).append(m("figure")), C(this, `@layer leaflet{${h}}
|
|
22
|
-
@layer mt.v3-3-
|
|
22
|
+
@layer mt.v3-3-9design{${b}`);
|
|
23
23
|
}
|
|
24
24
|
connectedCallback() {
|
|
25
25
|
const t = this.shadowRoot?.lastElementChild, e = a(this, "data-cluster") ?? "false", o = new i.TileLayer(k, {
|
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Z = Object.defineProperty, N = Object.getOwnPropertySymbols, tt = Object.prototype.hasOwnProperty, et = Object.prototype.propertyIsEnumerable, P = (t, e, o) => e in t ? Z(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o, ot = (t, e) => {
|
|
2
2
|
for (var o in e || (e = {}))
|
|
3
|
-
|
|
4
|
-
if (
|
|
5
|
-
for (var o of
|
|
6
|
-
|
|
3
|
+
tt.call(e, o) && P(t, o, e[o]);
|
|
4
|
+
if (N)
|
|
5
|
+
for (var o of N(e))
|
|
6
|
+
et.call(e, o) && P(t, o, e[o]);
|
|
7
7
|
return t;
|
|
8
|
-
},
|
|
9
|
-
/^Mac/i.test(((
|
|
10
|
-
} : HTMLElement,
|
|
8
|
+
}, D = () => typeof window < "u" && typeof window.document < "u" && typeof window.navigator < "u", C = D(), $ = C ? navigator.userAgent : "", L = /android/i.test($), nt = /firefox/i.test($), O = /iPad|iPhone|iPod/.test($), H, it = C && // @ts-expect-error Typescript has not implemented userAgentData yet https://stackoverflow.com/a/71392474
|
|
9
|
+
/^Mac/i.test(((H = navigator.userAgentData) == null ? void 0 : H.platform) || navigator.platform), rt = C && window.CSSStyleSheet && document.adoptedStyleSheets, U = { once: !0, capture: !0, passive: !0 }, at = ":host(:not([hidden])) { display: block }", lt = "outline: 1px dotted; outline: 5px auto Highlight; outline: 5px auto -webkit-focus-ring-color", st = `${L ? "data" : "aria"}-multiselectable`, ut = typeof HTMLElement > "u" ? class {
|
|
10
|
+
} : HTMLElement, a = (t, e, o) => o === void 0 ? t.getAttribute(e) : (o === null ? t.removeAttribute(e) : t.getAttribute(e) !== o && t.setAttribute(e, o), null), R = (t, ...e) => {
|
|
11
11
|
const [o, ...n] = e;
|
|
12
12
|
for (const i of o.split(" ")) t.addEventListener(i, ...n);
|
|
13
|
-
return () =>
|
|
14
|
-
},
|
|
13
|
+
return () => j(t, ...e);
|
|
14
|
+
}, j = (t, ...e) => {
|
|
15
15
|
const [o, ...n] = e;
|
|
16
16
|
for (const i of o.split(" ")) t.removeEventListener(i, ...n);
|
|
17
|
-
},
|
|
17
|
+
}, dt = (t, e) => {
|
|
18
18
|
const o = t.shadowRoot || t.attachShadow({ mode: "open" });
|
|
19
|
-
if (o.querySelector("slot") || o.append(
|
|
20
|
-
if (!
|
|
19
|
+
if (o.querySelector("slot") || o.append(g("slot")), !o.querySelector("style"))
|
|
20
|
+
if (!rt) o.append(g("style", null, e));
|
|
21
21
|
else {
|
|
22
22
|
const n = new CSSStyleSheet();
|
|
23
23
|
n.replaceSync(e), o.adoptedStyleSheets = [n];
|
|
24
24
|
}
|
|
25
25
|
return o;
|
|
26
|
-
},
|
|
26
|
+
}, ct = (t, e, o) => {
|
|
27
27
|
const n = new MutationObserver((r) => {
|
|
28
|
-
if (!
|
|
28
|
+
if (!D() || !t.isConnected) return i();
|
|
29
29
|
e(t, r);
|
|
30
30
|
}), i = Object.assign(() => n.disconnect(), {
|
|
31
31
|
takeRecords: () => n.takeRecords()
|
|
32
32
|
// Expose takeRecords - useful if mutating a attribute that is observed
|
|
33
33
|
});
|
|
34
34
|
return e(t), n.observe(t, o), i;
|
|
35
|
-
},
|
|
35
|
+
}, vt = (t) => {
|
|
36
36
|
var e;
|
|
37
37
|
const o = ((e = t.getRootNode) == null ? void 0 : e.call(t)) || t.ownerDocument;
|
|
38
38
|
return o instanceof Document || o instanceof ShadowRoot ? o : document;
|
|
39
|
-
},
|
|
39
|
+
}, B = (t) => vt(t).activeElement, pt = (t) => {
|
|
40
40
|
var e;
|
|
41
|
-
const o =
|
|
41
|
+
const o = a(t, "aria-label") || "";
|
|
42
42
|
return [
|
|
43
|
-
...(((e =
|
|
43
|
+
...(((e = a(t, "aria-labelledby")) == null ? void 0 : e.split(" ")) || []).map((i) => document.getElementById(i.trim() || "-")),
|
|
44
44
|
// Get all labelledby elements
|
|
45
45
|
...Array.from(t.labels || [])
|
|
46
46
|
// Get all <label> elements
|
|
@@ -48,39 +48,45 @@ var Y = Object.defineProperty, R = Object.getOwnPropertySymbols, z = Object.prot
|
|
|
48
48
|
var l;
|
|
49
49
|
return i || ((l = r?.innerText) == null ? void 0 : l.trim()) || "";
|
|
50
50
|
}, o).trim();
|
|
51
|
-
},
|
|
52
|
-
if (!t || !
|
|
51
|
+
}, mt = (t) => {
|
|
52
|
+
if (!t || !C) return null;
|
|
53
53
|
if (window.uElementsId || (window.uElementsId = {}), !t.id) {
|
|
54
54
|
const e = t.nodeName.toLowerCase();
|
|
55
55
|
window.uElementsId[e] || (window.uElementsId[e] = 1), t.id = `:${e}${window.uElementsId[e]++}`;
|
|
56
56
|
}
|
|
57
57
|
return t.id;
|
|
58
|
-
},
|
|
58
|
+
}, g = (t, e, o) => {
|
|
59
59
|
const n = document.createElement(t);
|
|
60
|
-
if (o && (n.textContent = o), e) for (const [i, r] of Object.entries(e))
|
|
60
|
+
if (o && (n.textContent = o), e) for (const [i, r] of Object.entries(e)) a(n, i, r);
|
|
61
61
|
return n;
|
|
62
|
-
},
|
|
63
|
-
define: (t, e) => !
|
|
64
|
-
},
|
|
62
|
+
}, ft = {
|
|
63
|
+
define: (t, e) => !D() || window.customElements.get(t) || window.customElements.define(t, e)
|
|
64
|
+
}, F = (t, e, o = "") => {
|
|
65
65
|
var n, i;
|
|
66
66
|
const r = { bubbles: !0, composed: !0, data: e, inputType: o }, l = HTMLInputElement.prototype;
|
|
67
67
|
t.dispatchEvent(new InputEvent("beforeinput", r)), (i = (n = Object.getOwnPropertyDescriptor(l, "value")) == null ? void 0 : n.set) == null || i.call(t, e), t.dispatchEvent(new InputEvent("input", r)), t.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
68
|
-
},
|
|
69
|
-
const e =
|
|
70
|
-
|
|
71
|
-
},
|
|
68
|
+
}, k = /* @__PURE__ */ new WeakSet(), W = (t, e) => (e?.type === "pointerdown" && (k.add(t), R(document, "pointerup", () => k.delete(t), U)), k.has(t)), ht = (t, e = "<slot></slot>") => `<template shadowrootmode="open">${e}<style>${t}</style></template>`, _t = (t) => {
|
|
69
|
+
const e = a(t, "form");
|
|
70
|
+
a(t, "form", "#"), setTimeout(bt, 0, t, e);
|
|
71
|
+
}, bt = (t, e) => a(t, "form", e), b = (t) => {
|
|
72
72
|
var e;
|
|
73
73
|
return ((e = t?.textContent) == null ? void 0 : e.trim()) || "";
|
|
74
|
-
},
|
|
75
|
-
clearTimeout(
|
|
76
|
-
},
|
|
74
|
+
}, p, yt = 0, V = 0, I = (t) => {
|
|
75
|
+
clearTimeout(V), p || (p = g("div", { "aria-live": "assertive" }), p.style.overflow = "hidden", p.style.position = "fixed", p.style.whiteSpace = "nowrap", p.style.width = "1px"), p.isConnected || document.body.append(p), t === "" && (p.textContent = ""), t && (p.textContent = `${t}${yt++ % 2 ? " " : ""}`, V = setTimeout(I, !it && nt ? 2e3 : 300, ""));
|
|
76
|
+
}, X = `${at}
|
|
77
77
|
:is(:host(:not([data-multiple])), :host([data-multiple="false"])) [part="items"] { display: none }
|
|
78
|
-
[role="listbox"] { display: contents
|
|
79
|
-
::slotted(button[type="reset"])
|
|
78
|
+
[role="listbox"] { display: inline-flex } /* Can not be "contents" as this confuses VoiceOver */
|
|
79
|
+
::slotted(button[type="reset"]),
|
|
80
|
+
::slotted(button[aria-expanded]),
|
|
81
|
+
::slotted(del) { font: inherit; border: 0; padding: 0; background: none; color: inherit; cursor: pointer; text-decoration: none }
|
|
80
82
|
::slotted(data) { cursor: pointer; pointer-events: none }
|
|
81
83
|
::slotted(data)::after { padding-inline: .5ch; pointer-events: auto }
|
|
82
|
-
::slotted(data)::after
|
|
83
|
-
::slotted(
|
|
84
|
+
::slotted(data)::after,
|
|
85
|
+
::slotted(del:empty)::before,
|
|
86
|
+
::slotted(button[type="reset"]:empty)::before { content: '\\00D7'; content: '\\00D7' / '' }
|
|
87
|
+
::slotted(button[aria-expanded="false"]:empty)::before { content: '\\25BC'; content: '\\25BC' / '' }
|
|
88
|
+
::slotted(button[aria-expanded="true"]:empty)::before { content: '\\25B2'; content: '\\25B2' / '' }
|
|
89
|
+
::slotted(data:focus),::slotted(del:focus),::slotted(button[type="reset"]:focus) { ${lt} }`, Mt = ht(X), A = !1, m = "aria-label", gt = 'button[type="reset"],del', St = "button[aria-expanded]", wt = 'datalist,u-datalist,[role="listbox"]', Et = 'option,u-option,[role="option"]', q = "blur focus click input keydown pointerdown", w = "false", E = {
|
|
84
90
|
added: "Added",
|
|
85
91
|
clear: "Clear input",
|
|
86
92
|
empty: "No selected",
|
|
@@ -90,53 +96,54 @@ var Y = Object.defineProperty, R = Object.getOwnPropertySymbols, z = Object.prot
|
|
|
90
96
|
// Note: Not announced by NVDA
|
|
91
97
|
of: "of",
|
|
92
98
|
remove: "Press to remove",
|
|
93
|
-
removed: "Removed"
|
|
94
|
-
|
|
99
|
+
removed: "Removed",
|
|
100
|
+
toggle: "Options"
|
|
101
|
+
}, xt = class extends ut {
|
|
95
102
|
constructor() {
|
|
96
|
-
super(), this._focusMoved = !1, this._itemSingleVale = "", this._speak = "", this._texts =
|
|
97
|
-
const t =
|
|
98
|
-
this._listbox = t.querySelector('[role="listbox"]') ||
|
|
103
|
+
super(), this._focusMoved = !1, this._itemSingleVale = "", this._speak = "", this._texts = ot({}, E), this._value = "";
|
|
104
|
+
const t = dt(this, X);
|
|
105
|
+
this._listbox = t.querySelector('[role="listbox"]') || g("div"), this._listbox.innerHTML = '<slot name="items"></slot>', a(this._listbox, "aria-orientation", "horizontal"), a(this._listbox, "role", "listbox"), a(this._listbox, "part", "items"), a(this._listbox, "tabindex", "-1"), t.prepend(this._listbox);
|
|
99
106
|
}
|
|
100
107
|
// Locally store value to store value before input-click
|
|
101
108
|
static get observedAttributes() {
|
|
102
|
-
return Object.keys(
|
|
109
|
+
return Object.keys(E).map((t) => `data-sr-${t}`);
|
|
103
110
|
}
|
|
104
111
|
connectedCallback() {
|
|
105
|
-
|
|
106
|
-
attributeFilter: ["id", "value", "role"],
|
|
112
|
+
R(this, q, this, !0), this._umutate = ct(this, Dt, {
|
|
113
|
+
attributeFilter: ["id", "value", "role", "aria-expanded"],
|
|
107
114
|
// Respond to changes in <data> value or id or role of <datalist>
|
|
108
115
|
attributes: !0,
|
|
109
116
|
characterData: !0,
|
|
110
117
|
// Respond to changes in <data> textContent
|
|
111
118
|
childList: !0,
|
|
112
119
|
subtree: !0
|
|
113
|
-
}),
|
|
120
|
+
}), x(this), M(this);
|
|
114
121
|
}
|
|
115
122
|
attributeChangedCallback(t, e, o) {
|
|
116
123
|
const n = t.split("data-sr-")[1];
|
|
117
|
-
|
|
124
|
+
E[n] && (this._texts[n] = o || E[n]), n === "clear" && this.clear && a(this.clear, m, this._texts.clear);
|
|
118
125
|
}
|
|
119
126
|
disconnectedCallback() {
|
|
120
127
|
var t;
|
|
121
|
-
|
|
128
|
+
j(this, q, this, !0), (t = this._umutate) == null || t.call(this), this._umutate = this._clear = this._toggle = void 0, this._control = this._match = this._select = void 0, this._options = this._items = this._list = void 0;
|
|
122
129
|
}
|
|
123
130
|
handleEvent(t) {
|
|
124
|
-
var e, o;
|
|
125
|
-
(e = this.control) != null && e.disabled || (o = this.control) != null && o.readOnly || (t.type === "blur" &&
|
|
131
|
+
var e, o, n;
|
|
132
|
+
(e = this.control) != null && e.disabled || (o = this.control) != null && o.readOnly || (t.type === "blur" && Ct(this), t.type === "click" && Tt(this, t), t.type === "focus" && I(), t.type === "input" && kt(this, t), t.type === "keydown" && Lt(this, t), t.type === "pointerdown" && (A = !!((n = this.list) != null && n.hidden), W(this, t)));
|
|
126
133
|
}
|
|
127
134
|
get multiple() {
|
|
128
135
|
var t;
|
|
129
|
-
return ((t =
|
|
136
|
+
return ((t = a(this, "data-multiple")) != null ? t : w) !== w;
|
|
130
137
|
}
|
|
131
138
|
set multiple(t) {
|
|
132
|
-
|
|
139
|
+
a(this, "data-multiple", t ? "" : null);
|
|
133
140
|
}
|
|
134
141
|
get creatable() {
|
|
135
142
|
var t;
|
|
136
|
-
return ((t =
|
|
143
|
+
return ((t = a(this, "data-creatable")) != null ? t : w) !== w;
|
|
137
144
|
}
|
|
138
145
|
set creatable(t) {
|
|
139
|
-
|
|
146
|
+
a(this, "data-creatable", t ? "" : null);
|
|
140
147
|
}
|
|
141
148
|
get control() {
|
|
142
149
|
var t;
|
|
@@ -144,117 +151,123 @@ var Y = Object.defineProperty, R = Object.getOwnPropertySymbols, z = Object.prot
|
|
|
144
151
|
}
|
|
145
152
|
get list() {
|
|
146
153
|
var t;
|
|
147
|
-
return (t = this._list) != null && t.isConnected || (this._list = this.querySelector(
|
|
154
|
+
return (t = this._list) != null && t.isConnected || (this._list = this.querySelector(wt), this._options = void 0), this._list;
|
|
148
155
|
}
|
|
149
156
|
get clear() {
|
|
150
157
|
var t;
|
|
151
|
-
return (t = this._clear) != null && t.isConnected || (this._clear = this.querySelector(
|
|
158
|
+
return (t = this._clear) != null && t.isConnected || (this._clear = this.querySelector(gt)), this._clear;
|
|
159
|
+
}
|
|
160
|
+
get toggle() {
|
|
161
|
+
var t;
|
|
162
|
+
return (t = this._toggle) != null && t.isConnected || (this._toggle = this.querySelector(St)), this._toggle;
|
|
152
163
|
}
|
|
153
164
|
get items() {
|
|
154
165
|
return this._items || (this._items = this.getElementsByTagName("data")), this._items;
|
|
155
166
|
}
|
|
156
167
|
get options() {
|
|
157
168
|
var t, e, o;
|
|
158
|
-
const n = !this._options && ((e = (t = this.list) == null ? void 0 : t.querySelector(
|
|
169
|
+
const n = !this._options && ((e = (t = this.list) == null ? void 0 : t.querySelector(Et)) == null ? void 0 : e.nodeName);
|
|
159
170
|
return n && (this._options = (o = this.list) == null ? void 0 : o.getElementsByTagName(n)), this._options || this.getElementsByTagName("-");
|
|
160
171
|
}
|
|
161
172
|
get values() {
|
|
162
173
|
return Array.from(this.items, ({ value: t }) => t);
|
|
163
174
|
}
|
|
164
|
-
},
|
|
175
|
+
}, G = (t) => {
|
|
165
176
|
var e;
|
|
166
177
|
const { creatable: o, control: n, options: i, multiple: r } = t, l = ((e = n?.value) == null ? void 0 : e.trim()) || "", u = l.toLowerCase() || null;
|
|
167
|
-
let
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
178
|
+
let s = [...i].find(
|
|
179
|
+
(c) => K(c).trim().toLowerCase() === u
|
|
180
|
+
);
|
|
181
|
+
const d = { bubbles: !0, cancelable: !0, detail: s };
|
|
182
|
+
if (t.dispatchEvent(new CustomEvent("comboboxbeforematch", d)) || (s = [...i].find(Bt)), r) z(t);
|
|
183
|
+
else for (const c of i) J(c, c === s);
|
|
184
|
+
return !s && o && l ? { value: l, label: l } : s && { value: S(s), label: K(s) };
|
|
185
|
+
}, y = (t, e, o = !0) => {
|
|
173
186
|
const { _texts: n, control: i, items: r, multiple: l } = t;
|
|
174
187
|
if (!e)
|
|
175
|
-
return l ?
|
|
176
|
-
const u = [...r].findIndex((
|
|
177
|
-
if (
|
|
188
|
+
return l ? I(n.invalid) : !i?.value && r[0] ? y(t, r[0]) : x(t);
|
|
189
|
+
const u = [...r].findIndex((f) => f.value === e.value), s = r[u], d = s === B(t) && (l && (r[u - 1] || r[u + 1]) || i);
|
|
190
|
+
if (s && !o) return x(t);
|
|
178
191
|
d && d.focus(), t._focusMoved = !!d;
|
|
179
|
-
const c =
|
|
192
|
+
const c = g("data", { value: e.value }, e.label || e.value), v = { bubbles: !0, cancelable: !0, detail: s || c };
|
|
180
193
|
if (t.dispatchEvent(new CustomEvent("comboboxbeforeselect", v))) {
|
|
181
|
-
if (!l) for (const
|
|
182
|
-
|
|
194
|
+
if (!l) for (const f of [...r]) f.remove();
|
|
195
|
+
s ? s.remove() : i?.insertAdjacentElement("beforebegin", c), t.dispatchEvent(new CustomEvent("comboboxafterselect", v));
|
|
183
196
|
}
|
|
184
|
-
},
|
|
185
|
-
const { clientX: o, clientY: n, target: i } = e, { clear: r, control: l, items: u } = t;
|
|
186
|
-
if (l && r?.contains(i))
|
|
187
|
-
return e.preventDefault(),
|
|
188
|
-
for (const
|
|
189
|
-
if (
|
|
190
|
-
const
|
|
191
|
-
if (
|
|
197
|
+
}, Ct = (t) => W(t) || setTimeout(It, 0, t), It = (t) => t.multiple || t.contains(B(t)) || y(t, t._match, !1), Tt = (t, e) => {
|
|
198
|
+
const { clientX: o, clientY: n, target: i } = e, { clear: r, control: l, items: u, toggle: s } = t;
|
|
199
|
+
if (s?.contains(i) && (l?.focus(), A && l?.click()), l && r?.contains(i))
|
|
200
|
+
return e.preventDefault(), F(l, "", "deleteContentBackward"), l.focus(), A || l.click();
|
|
201
|
+
for (const d of u) {
|
|
202
|
+
if (d.contains(i)) return y(t, d);
|
|
203
|
+
const c = d.getBoundingClientRect(), { top: v, right: f, bottom: h, left: T, width: _, height: Q } = c;
|
|
204
|
+
if (_ && Q && n >= v && n <= h && o >= T && o <= f) return d.focus();
|
|
192
205
|
}
|
|
193
206
|
i === t && l?.focus();
|
|
194
|
-
},
|
|
207
|
+
}, kt = (t, e) => {
|
|
195
208
|
var o;
|
|
196
209
|
const { control: n, options: i, multiple: r } = t, l = n?.value || null, u = e instanceof InputEvent ? !e.inputType || e.inputType === "insertReplacementText" : !!n?.value;
|
|
197
210
|
if (u || (t._value = n?.value || ""), u) {
|
|
198
211
|
(o = e.stopImmediatePropagation) == null || o.call(e);
|
|
199
|
-
const
|
|
200
|
-
if (n && (n.value = t._value),
|
|
201
|
-
} else r || (t._match =
|
|
202
|
-
|
|
203
|
-
},
|
|
204
|
-
e.ctrlKey || e.metaKey || e.shiftKey || e.key === "Alt" || (t.control === e.target ?
|
|
205
|
-
},
|
|
212
|
+
const s = [...i].find((d) => S(d) === l);
|
|
213
|
+
if (n && (n.value = t._value), s) return y(t, s, r);
|
|
214
|
+
} else r || (t._match = G(t));
|
|
215
|
+
M(t);
|
|
216
|
+
}, Lt = (t, e) => {
|
|
217
|
+
e.ctrlKey || e.metaKey || e.shiftKey || e.key === "Alt" || (t.control === e.target ? Ot(t, e) : At(t, e));
|
|
218
|
+
}, Ot = (t, e) => {
|
|
206
219
|
var o;
|
|
207
220
|
const { _match: n, clear: i, control: r, items: l, multiple: u } = t;
|
|
208
|
-
(e.key === "ArrowLeft" || e.key === "Backspace") && !r?.selectionEnd && ((o = l[l.length - 1]) == null || o.focus()), e.key === "Enter" && r && (
|
|
209
|
-
},
|
|
221
|
+
(e.key === "ArrowLeft" || e.key === "Backspace") && !r?.selectionEnd && ((o = l[l.length - 1]) == null || o.focus(), e.preventDefault()), e.key === "Enter" && r && (_t(r), y(t, u ? G(t) : n, u)), e.key === "Tab" && !e.shiftKey && i && !i.hidden && (e.preventDefault(), a(i, "aria-hidden", "false"), a(i, "tabindex", "0"), i.focus(), R(i, "blur", () => M(t), U));
|
|
222
|
+
}, At = (t, e) => {
|
|
210
223
|
var o, n, i;
|
|
211
|
-
const { clear: r, control: l, items: u } = t, { key:
|
|
212
|
-
if ((
|
|
224
|
+
const { clear: r, control: l, items: u } = t, { key: s, repeat: d, target: c } = e, v = [...u].indexOf(c);
|
|
225
|
+
if ((s === " " || s === "Enter") && (u[v] || c === r))
|
|
213
226
|
return (o = u[v] || r) == null || o.click(), e.preventDefault();
|
|
214
227
|
if (u[v]) {
|
|
215
|
-
if (
|
|
216
|
-
if (
|
|
217
|
-
if (
|
|
218
|
-
return e.preventDefault(), d ||
|
|
228
|
+
if (s.startsWith("Arrow") && e.preventDefault(), s === "ArrowLeft") return (n = u[v - 1]) == null ? void 0 : n.focus();
|
|
229
|
+
if (s === "ArrowRight") return (i = u[v + 1] || l) == null ? void 0 : i.focus();
|
|
230
|
+
if (s === "Backspace")
|
|
231
|
+
return e.preventDefault(), d || y(t, u[v]);
|
|
219
232
|
l?.focus();
|
|
220
233
|
}
|
|
221
|
-
},
|
|
234
|
+
}, Dt = (t, e) => {
|
|
222
235
|
var o;
|
|
223
236
|
if (!t.control) return;
|
|
224
|
-
const { _texts: n, control: i, items: r, list: l, multiple: u } = t,
|
|
225
|
-
for (const { addedNodes:
|
|
226
|
-
for (const
|
|
227
|
-
for (const
|
|
237
|
+
const { _texts: n, control: i, items: r, list: l, multiple: u, toggle: s } = t, d = [];
|
|
238
|
+
for (const { addedNodes: h, removedNodes: T } of e || []) {
|
|
239
|
+
for (const _ of h) _ instanceof HTMLDataElement && d.unshift(_);
|
|
240
|
+
for (const _ of T) _ instanceof HTMLDataElement && d.push(_);
|
|
228
241
|
}
|
|
229
|
-
const
|
|
230
|
-
if ((u ?
|
|
231
|
-
const
|
|
232
|
-
t._speak = `${n[
|
|
242
|
+
const c = B(t);
|
|
243
|
+
if ((u ? d.length === 1 : d[0] === c) && t.contains(c)) {
|
|
244
|
+
const h = i ? a(i, m) : null;
|
|
245
|
+
t._speak = `${n[d[0].isConnected ? "added" : "removed"]} ${b(d[0])}, `, a(i, m, `${t._speak}${pt(i)}`), t._focusMoved || setTimeout(() => I(t._speak.slice(0, -2))), setTimeout($t, 300, t, h);
|
|
233
246
|
}
|
|
234
247
|
if (!u) {
|
|
235
|
-
const
|
|
236
|
-
|
|
248
|
+
const h = b(r[0]);
|
|
249
|
+
h !== t._itemSingleVale && x(t), t._itemSingleVale = h;
|
|
237
250
|
}
|
|
238
|
-
|
|
239
|
-
const
|
|
240
|
-
|
|
241
|
-
},
|
|
242
|
-
t._speak = "", t.control &&
|
|
243
|
-
},
|
|
251
|
+
Y(t), z(t), Rt(t), s && a(s, "aria-expanded", `${!l?.hidden}`);
|
|
252
|
+
const f = `${r.length ? n.found.replace("%d", `${r.length}`) : n.empty}`;
|
|
253
|
+
a(i, "aria-description", u ? f : null), a(i, "list", mt(l)), a(t._listbox, m, n.items), (o = t._umutate) == null || o.takeRecords();
|
|
254
|
+
}, $t = (t, e) => {
|
|
255
|
+
t._speak = "", t.control && a(t.control, m, e), Y(t);
|
|
256
|
+
}, Y = (t) => {
|
|
244
257
|
const { _texts: e, _speak: o, items: n } = t;
|
|
245
258
|
let i = 0;
|
|
246
259
|
for (const r of n) {
|
|
247
|
-
const l = `${o}${
|
|
248
|
-
|
|
260
|
+
const l = `${o}${b(r)}, ${e.remove}${O ? `, ${++i} ${e.of} ${n.length}` : ""}`;
|
|
261
|
+
a(r, m, l), a(r, "role", "option"), a(r, "slot", "items"), a(r, "tabindex", "-1"), a(r, "value", S(r));
|
|
249
262
|
}
|
|
250
|
-
},
|
|
263
|
+
}, Rt = (t) => {
|
|
251
264
|
var e, o;
|
|
252
265
|
if ((e = t._select) != null && e.isConnected || (t._select = t.querySelector("select")), !t._select) return;
|
|
253
266
|
const { _select: n, items: i, multiple: r } = t, l = [];
|
|
254
267
|
let u = 0;
|
|
255
|
-
|
|
256
|
-
for (const
|
|
257
|
-
const d = n?.options[u++], c =
|
|
268
|
+
a(n, "multiple", r ? "" : null);
|
|
269
|
+
for (const s of i) {
|
|
270
|
+
const d = n?.options[u++], c = b(s), v = S(s);
|
|
258
271
|
d ? Object.assign(d, {
|
|
259
272
|
defaultSelected: !0,
|
|
260
273
|
selected: !0,
|
|
@@ -263,26 +276,34 @@ var Y = Object.defineProperty, R = Object.getOwnPropertySymbols, z = Object.prot
|
|
|
263
276
|
}) : l.push(new Option(c, v, !0, !0));
|
|
264
277
|
}
|
|
265
278
|
if (l.length) n.append(...l);
|
|
266
|
-
else for (const
|
|
279
|
+
else for (const s of [...n.options].slice(u)) s.remove();
|
|
267
280
|
(o = t._umutate) == null || o.takeRecords();
|
|
268
|
-
},
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
}, W = (t) => {
|
|
281
|
+
}, M = (t) => {
|
|
282
|
+
const { clear: e, control: o, toggle: n } = t, i = !o?.value || o?.disabled || o?.readOnly;
|
|
283
|
+
e?.nodeName === "DEL" && a(e, "role", "button"), e && (a(e, m) || a(e, m, t._texts.clear), a(e, "aria-hidden", `${O || L}`), a(e, "hidden", i ? "" : null), a(e, "tabindex", "-1")), n && (a(n, m) || a(n, m, t._texts.toggle), a(n, "aria-hidden", `${O || L}`), a(n, "hidden", i ? null : ""), a(n, "tabindex", "-1"), a(n, "type", "button"));
|
|
284
|
+
}, z = (t) => {
|
|
273
285
|
if (!t.list) return;
|
|
274
286
|
const { _texts: e, list: o, multiple: n, options: i, values: r } = t;
|
|
275
|
-
|
|
276
|
-
for (const l of i) l
|
|
277
|
-
},
|
|
287
|
+
a(o, "data-sr-of", e.of), a(o, st, `${n}`);
|
|
288
|
+
for (const l of i) J(l, r.includes(S(l)));
|
|
289
|
+
}, x = (t) => {
|
|
278
290
|
if (!t.control || t.multiple) return;
|
|
279
|
-
const { control: e, items: o } = t, n =
|
|
280
|
-
n !== e.value &&
|
|
291
|
+
const { control: e, items: o } = t, n = b(o[0]), i = n ? "insertText" : "deleteContentBackward";
|
|
292
|
+
n !== e.value && F(e, n, i);
|
|
293
|
+
}, K = (t) => {
|
|
294
|
+
var e;
|
|
295
|
+
return (e = a(t, "label")) != null ? e : b(t);
|
|
296
|
+
}, S = (t) => {
|
|
297
|
+
var e;
|
|
298
|
+
return (e = a(t, "value")) != null ? e : b(t);
|
|
299
|
+
}, J = (t, e) => a(t, "selected", e ? "" : null), Bt = (t) => {
|
|
300
|
+
var e;
|
|
301
|
+
return (e = t.selected) != null ? e : t.hasAttribute("selected");
|
|
281
302
|
};
|
|
282
|
-
|
|
303
|
+
ft.define("u-combobox", xt);
|
|
283
304
|
export {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
305
|
+
xt as UHTMLComboboxElement,
|
|
306
|
+
Mt as UHTMLComboboxShadowRoot,
|
|
307
|
+
X as UHTMLComboboxStyle
|
|
287
308
|
};
|
|
288
309
|
//# sourceMappingURL=u-combobox.js.map
|