@mattilsynet/design 1.0.6 → 1.0.7

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 (79) hide show
  1. package/mtds/avatar/avatar.stories.d.ts +1 -0
  2. package/mtds/badge/badge.d.ts +2 -2
  3. package/mtds/badge/badge.js.map +1 -1
  4. package/mtds/breadcrumbs/breadcrumbs-observer.d.ts +1 -0
  5. package/mtds/breadcrumbs/breadcrumbs-observer.js +12 -0
  6. package/mtds/breadcrumbs/breadcrumbs-observer.js.map +1 -0
  7. package/mtds/breadcrumbs/breadcrumbs.js +13 -21
  8. package/mtds/breadcrumbs/breadcrumbs.js.map +1 -1
  9. package/mtds/button/button.d.ts +1 -1
  10. package/mtds/button/button.js.map +1 -1
  11. package/mtds/card/card.d.ts +9 -1
  12. package/mtds/card/card.js +22 -8
  13. package/mtds/card/card.js.map +1 -1
  14. package/mtds/card/card.stories.d.ts +1 -1
  15. package/mtds/dialog/dialog-observer.d.ts +1 -2
  16. package/mtds/dialog/dialog-observer.js +19 -17
  17. package/mtds/dialog/dialog-observer.js.map +1 -1
  18. package/mtds/dialog/dialog.d.ts +4 -2
  19. package/mtds/dialog/dialog.js +11 -15
  20. package/mtds/dialog/dialog.js.map +1 -1
  21. package/mtds/dialog/dialog.stories.d.ts +1 -0
  22. package/mtds/divider/divider.d.ts +2 -2
  23. package/mtds/divider/divider.js.map +1 -1
  24. package/mtds/errorsummary/errorsummary-observer.d.ts +1 -0
  25. package/mtds/errorsummary/errorsummary-observer.js +10 -0
  26. package/mtds/errorsummary/errorsummary-observer.js.map +1 -0
  27. package/mtds/errorsummary/errorsummary.js +11 -17
  28. package/mtds/errorsummary/errorsummary.js.map +1 -1
  29. package/mtds/external/@u-elements/u-datalist/dist/u-datalist.js +47 -48
  30. package/mtds/external/@u-elements/u-datalist/dist/u-datalist.js.map +1 -1
  31. package/mtds/external/@u-elements/u-details/dist/u-details.js +9 -8
  32. package/mtds/external/@u-elements/u-details/dist/u-details.js.map +1 -1
  33. package/mtds/external/@u-elements/u-tags/dist/u-tags.js +160 -162
  34. package/mtds/external/@u-elements/u-tags/dist/u-tags.js.map +1 -1
  35. package/mtds/field/field-helper.d.ts +1 -0
  36. package/mtds/field/field-observer.d.ts +1 -2
  37. package/mtds/field/field-observer.js +32 -41
  38. package/mtds/field/field-observer.js.map +1 -1
  39. package/mtds/field/field.d.ts +7 -0
  40. package/mtds/field/field.js +49 -34
  41. package/mtds/field/field.js.map +1 -1
  42. package/mtds/field/field.stories.d.ts +4 -2
  43. package/mtds/fieldset/fieldset-observer.d.ts +1 -2
  44. package/mtds/fieldset/fieldset-observer.js +12 -16
  45. package/mtds/fieldset/fieldset-observer.js.map +1 -1
  46. package/mtds/index.d.ts +3 -3
  47. package/mtds/index.iife.js +6 -5
  48. package/mtds/index.iife.js.map +1 -1
  49. package/mtds/index.js +13 -24
  50. package/mtds/index.js.map +1 -1
  51. package/mtds/layout/app-observer.d.ts +1 -2
  52. package/mtds/layout/app-observer.js +11 -16
  53. package/mtds/layout/app-observer.js.map +1 -1
  54. package/mtds/layout/layout.d.ts +17 -6
  55. package/mtds/layout/layout.js +12 -9
  56. package/mtds/layout/layout.js.map +1 -1
  57. package/mtds/logo/logo-observer.d.ts +1 -2
  58. package/mtds/logo/logo-observer.js +14 -18
  59. package/mtds/logo/logo-observer.js.map +1 -1
  60. package/mtds/popover/popover-observer.d.ts +1 -2
  61. package/mtds/popover/popover-observer.js +12 -21
  62. package/mtds/popover/popover-observer.js.map +1 -1
  63. package/mtds/react-types.d.ts +11 -0
  64. package/mtds/react.js +42 -40
  65. package/mtds/styles.css +1 -1
  66. package/mtds/styles.json +34 -34
  67. package/mtds/styles.module.css.js +58 -56
  68. package/mtds/styles.module.css.js.map +1 -1
  69. package/mtds/table/table-observer.d.ts +1 -2
  70. package/mtds/table/table-observer.js +10 -14
  71. package/mtds/table/table-observer.js.map +1 -1
  72. package/mtds/tag/tag.d.ts +2 -6
  73. package/mtds/tag/tag.js.map +1 -1
  74. package/mtds/tooltip/tooltip-observer.js +27 -20
  75. package/mtds/tooltip/tooltip-observer.js.map +1 -1
  76. package/mtds/utils.d.ts +2 -19
  77. package/mtds/utils.js +32 -26
  78. package/mtds/utils.js.map +1 -1
  79. package/package.json +18 -18
@@ -1,24 +1,24 @@
1
- var vt = Object.defineProperty, X = Object.getOwnPropertySymbols, mt = Object.prototype.hasOwnProperty, _t = Object.prototype.propertyIsEnumerable, W = (t, e, n) => e in t ? vt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, Z = (t, e) => {
2
- for (var n in e || (e = {}))
3
- mt.call(e, n) && W(t, n, e[n]);
4
- if (X)
5
- for (var n of X(e))
6
- _t.call(e, n) && W(t, n, e[n]);
1
+ var ht = Object.defineProperty, j = Object.getOwnPropertySymbols, ft = Object.prototype.hasOwnProperty, mt = Object.prototype.propertyIsEnumerable, X = (t, e, i) => e in t ? ht(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i, Q = (t, e) => {
2
+ for (var i in e || (e = {}))
3
+ ft.call(e, i) && X(t, i, e[i]);
4
+ if (j)
5
+ for (var i of j(e))
6
+ mt.call(e, i) && X(t, i, e[i]);
7
7
  return t;
8
- }, h = typeof window < "u" && typeof window.document < "u" && typeof window.navigator < "u", tt = h && /android/i.test(navigator.userAgent), bt = h && /firefox/i.test(navigator.userAgent), L = h && /iPad|iPhone|iPod/.test(navigator.userAgent), et = h && /^((?!chrome|android).)*safari/i.test(navigator.userAgent), q, gt = h && // @ts-expect-error Typescript has not implemented userAgentData yet https://stackoverflow.com/a/71392474
9
- /^Mac/i.test(((q = navigator.userAgentData) == null ? void 0 : q.platform) || navigator.platform), Et = `${tt ? "data" : "aria"}-labelledby`, N = `${et ? "aria" : "data"}-multiselectable`, nt = ":host(:not([hidden])) { display: block }", it = "outline: 1px dotted; outline: 5px auto Highlight; outline: 5px auto -webkit-focus-ring-color", H = typeof HTMLElement > "u" ? class {
8
+ }, h = typeof window < "u" && typeof window.document < "u" && typeof window.navigator < "u", Z = h && /android/i.test(navigator.userAgent), _t = h && /firefox/i.test(navigator.userAgent), L = h && /iPad|iPhone|iPod/.test(navigator.userAgent), tt = h && /^((?!chrome|android).)*safari/i.test(navigator.userAgent), W, bt = h && // @ts-expect-error Typescript has not implemented userAgentData yet https://stackoverflow.com/a/71392474
9
+ /^Mac/i.test(((W = navigator.userAgentData) == null ? void 0 : W.platform) || navigator.platform), gt = `${Z ? "data" : "aria"}-labelledby`, N = `${tt ? "aria" : "data"}-multiselectable`, et = ":host(:not([hidden])) { display: block }", it = "outline: 1px dotted; outline: 5px auto Highlight; outline: 5px auto -webkit-focus-ring-color", H = typeof HTMLElement > "u" ? class {
10
10
  } : HTMLElement;
11
- function a(t, e, n) {
12
- var i;
13
- return n === void 0 ? (i = t.getAttribute(e)) != null ? i : null : (n === null ? t.removeAttribute(e) : t.getAttribute(e) !== n && t.setAttribute(e, n), null);
11
+ function a(t, e, i) {
12
+ var n;
13
+ return i === void 0 ? (n = t.getAttribute(e)) != null ? n : null : (i === null ? t.removeAttribute(e) : t.getAttribute(e) !== i && t.setAttribute(e, i), null);
14
14
  }
15
- var ot = (t, e, n) => {
16
- for (const i of n[0].split(","))
17
- n[0] = i, Element.prototype[`${t}EventListener`].apply(e, n);
18
- }, I = (t, ...e) => ot("add", t, e), x = (t, ...e) => ot("remove", t, e), rt = (t, e) => t.attachShadow({ mode: "open" }).append(
19
- _("slot"),
15
+ var nt = (t, e, i) => {
16
+ for (const n of i[0].split(","))
17
+ i[0] = n, Element.prototype[`${t}EventListener`].apply(e, i);
18
+ }, I = (t, ...e) => nt("add", t, e), x = (t, ...e) => nt("remove", t, e), ot = (t, e) => t.attachShadow({ mode: "open" }).append(
19
+ g("slot"),
20
20
  // Unnamed slot does automatically render all top element nodes
21
- _("style", e)
21
+ g("style", e)
22
22
  ), T = /* @__PURE__ */ new WeakMap(), w = (t, e) => {
23
23
  if (e === void 0) return T.get(t);
24
24
  try {
@@ -26,43 +26,42 @@ var ot = (t, e, n) => {
26
26
  } catch {
27
27
  }
28
28
  if (e) {
29
- const n = new MutationObserver(
30
- (i) => t.handleEvent({ type: "mutation", detail: i })
29
+ const i = new MutationObserver(
30
+ (n) => t.handleEvent({ type: "mutation", detail: n })
31
31
  );
32
- n.observe(t, e), T.set(t, n);
32
+ i.observe(t, e), T.set(t, i);
33
33
  }
34
- }, yt = (t) => {
34
+ }, Et = (t) => {
35
35
  const e = "key" in t && (t.key === " " || t.key === "Enter");
36
36
  return e && t.preventDefault(), e && t.target instanceof HTMLElement && t.target.click(), e;
37
37
  }, O = (t) => {
38
38
  var e;
39
- const n = ((e = t.getRootNode) == null ? void 0 : e.call(t)) || t.ownerDocument;
40
- return n instanceof Document || n instanceof ShadowRoot ? n : document;
41
- }, It = 0, M = (t) => t ? (t.id || (t.id = `:${t.nodeName.toLowerCase()}${(++It).toString(32)}`), t.id) : "", _ = (t, e, n) => {
42
- const i = document.createElement(t);
43
- if (e && (i.textContent = e), n) for (const [o, l] of Object.entries(n)) a(i, o, l);
44
- return i;
39
+ const i = ((e = t.getRootNode) == null ? void 0 : e.call(t)) || t.ownerDocument;
40
+ return i instanceof Document || i instanceof ShadowRoot ? i : document;
41
+ }, yt = 0, M = (t) => t ? (t.id || (t.id = `:${t.nodeName.toLowerCase()}${(++yt).toString(32)}`), t.id) : "", g = (t, e, i) => {
42
+ const n = document.createElement(t);
43
+ if (e && (n.textContent = e), i) for (const [o, l] of Object.entries(i)) a(n, o, l);
44
+ return n;
45
45
  }, B = {
46
46
  define: (t, e) => !h || window.customElements.get(t) || window.customElements.define(t, e)
47
- }, at = (t) => {
48
- if (!h) return null;
49
- const e = _("div");
50
- return e.style.cssText = "position:fixed;overflow:hidden;width:1px;white-space:nowrap", a(e, "aria-live", t), document.body.appendChild(e);
47
+ }, rt = (t) => {
48
+ const e = g("div");
49
+ return e.style.cssText = "position:fixed;overflow:hidden;width:1px;white-space:nowrap", a(e, "aria-live", t), e;
51
50
  };
52
- function A(t, e, n) {
51
+ function A(t, e, i) {
53
52
  if (!e) return Object.keys(t).map((o) => `data-sr-${o}`);
54
- const i = (e == null ? void 0 : e.startsWith("data-sr-")) && e.slice(8);
55
- return i && n && t[i] && (t[i] = n), [];
53
+ const n = (e == null ? void 0 : e.startsWith("data-sr-")) && e.slice(8);
54
+ return n && i && t[n] && (t[n] = i), [];
56
55
  }
57
- var R = "disabled", g = "selected", xt = class extends H {
56
+ var R = "disabled", y = "selected", It = class extends H {
58
57
  // Using ES2015 syntax for backwards compatibility
59
58
  static get observedAttributes() {
60
- return [R, g];
59
+ return [R, y];
61
60
  }
62
61
  constructor() {
63
- super(), rt(
62
+ super(), ot(
64
63
  this,
65
- `${nt}:host(:focus){${it}}:host{ cursor: pointer }`
64
+ `${et}:host(:focus){${it}}:host{ cursor: pointer }`
66
65
  );
67
66
  }
68
67
  connectedCallback() {
@@ -73,10 +72,10 @@ var R = "disabled", g = "selected", xt = class extends H {
73
72
  }
74
73
  /** Sets or retrieves whether the option in the list box is the default item. */
75
74
  get defaultSelected() {
76
- return this[g];
75
+ return this[y];
77
76
  }
78
77
  set defaultSelected(t) {
79
- this[g] = t;
78
+ this[y] = t;
80
79
  }
81
80
  get disabled() {
82
81
  return a(this, R) !== null;
@@ -102,10 +101,10 @@ var R = "disabled", g = "selected", xt = class extends H {
102
101
  a(this, "label", t);
103
102
  }
104
103
  get selected() {
105
- return a(this, g) !== null;
104
+ return a(this, y) !== null;
106
105
  }
107
106
  set selected(t) {
108
- a(this, g, t ? "" : null);
107
+ a(this, y, t ? "" : null);
109
108
  }
110
109
  /** Sets or retrieves the text string specified by the option tag. */
111
110
  get text() {
@@ -123,106 +122,106 @@ var R = "disabled", g = "selected", xt = class extends H {
123
122
  a(this, "value", t);
124
123
  }
125
124
  };
126
- B.define("u-option", xt);
127
- var P = !1, Y, Ct = 0, E = at("assertive"), Tt = et && !L, ut = "click,focusout,input,keydown,mousedown,mouseup", z = {
125
+ B.define("u-option", It);
126
+ var P = !1, q, xt = 0, _, Ct = tt && !L, at = "click,focusout,input,keydown,mousedown,mouseup", Y = {
128
127
  singular: "%d hit",
129
128
  plural: "%d hits"
130
- }, wt = class extends H {
129
+ }, Tt = class extends H {
131
130
  constructor() {
132
- super(), this._blurTimer = 0, this._input = null, this._root = null, this._value = "", this._texts = Z({}, z), rt(
131
+ super(), this._blurTimer = 0, this._input = null, this._root = null, this._value = "", this._texts = Q({}, Y), ot(
133
132
  this,
134
- `${nt}::slotted(u-option[disabled]) { display: none !important }`
133
+ `${et}::slotted(u-option[disabled]) { display: none !important }`
135
134
  // Hide disabled options
136
135
  );
137
136
  }
138
137
  // Speed up translated texts
139
138
  // Using ES2015 syntax for backwards compatibility
140
139
  static get observedAttributes() {
141
- return ["id", ...A(z)];
140
+ return ["id", ...A(Y)];
142
141
  }
143
142
  connectedCallback() {
144
- this.hidden = !0, this._root = O(this), E && !E.isConnected && document.body.append(E), a(this, "role", "listbox"), I(this._root, "focusin", this), I(this._root, "focus", this, !0), setTimeout(() => this.attributeChangedCallback());
143
+ this.hidden = !0, this._root = O(this), _ || (_ = rt("assertive")), _.isConnected || document.body.appendChild(_), a(this, "role", "listbox"), I(this._root, "focusin", this), I(this._root, "focus", this, !0), setTimeout(() => this.attributeChangedCallback());
145
144
  }
146
145
  disconnectedCallback() {
147
146
  x(this._root || this, "focus", this, !0), x(this._root || this, "focusin", this), U(this), this._root = null;
148
147
  }
149
- attributeChangedCallback(t, e, n) {
150
- var i;
151
- A(this._texts, t, n);
152
- const o = (i = this._root) == null ? void 0 : i.querySelectorAll(`input[list="${this.id}"]`);
153
- for (const l of o || []) lt(this, l);
148
+ attributeChangedCallback(t, e, i) {
149
+ var n;
150
+ A(this._texts, t, i);
151
+ const o = (n = this._root) == null ? void 0 : n.querySelectorAll(`input[list="${this.id}"]`);
152
+ for (const l of o || []) ut(this, l);
154
153
  }
155
154
  handleEvent(t) {
156
155
  const { type: e } = t;
157
- t.defaultPrevented || (e === "click" && kt(this, t), (e === "focus" || e === "focusin") && At(this, t), e === "focusout" && St(this), e === "keydown" && Lt(this, t), (e === "mutation" || e === "input") && dt(this, t), e === "mouseup" && (P = !1), e === "mousedown" && (P = this.contains(t.target)));
156
+ t.defaultPrevented || (e === "click" && St(this, t), (e === "focus" || e === "focusin") && wt(this, t), e === "focusout" && At(this), e === "keydown" && kt(this, t), (e === "mutation" || e === "input") && lt(this, t), e === "mouseup" && (P = !1), e === "mousedown" && (P = this.contains(t.target)));
158
157
  }
159
158
  get options() {
160
159
  return this.getElementsByTagName("u-option");
161
160
  }
162
- }, At = (t, { target: e }) => {
163
- var n;
164
- const i = t._input === e;
165
- if (i || t.contains(e)) return clearTimeout(t._blurTimer);
166
- !i && e instanceof HTMLInputElement && a(e, "list") === t.id && (t._input && U(t), t._input = e, a(t, Et, M((n = t._input.labels) == null ? void 0 : n[0])), I(t._root || t, ut, t), w(t, {
161
+ }, wt = (t, { target: e }) => {
162
+ var i;
163
+ const n = t._input === e;
164
+ if (n || t.contains(e)) return clearTimeout(t._blurTimer);
165
+ !n && e instanceof HTMLInputElement && a(e, "list") === t.id && (t._input && U(t), t._input = e, a(t, gt, M((i = t._input.labels) == null ? void 0 : i[0])), I(t._root || t, at, t), w(t, {
167
166
  attributeFilter: ["value"],
168
167
  // Listen for value changes to show u-options
169
168
  attributes: !0,
170
169
  childList: !0,
171
170
  subtree: !0
172
- }), b(t, !0));
173
- }, St = (t) => {
171
+ }), E(t, !0));
172
+ }, At = (t) => {
174
173
  P || (t._blurTimer = setTimeout(() => U(t)));
175
- }, kt = (t, { target: e }) => {
176
- var n, i, o, l, d;
177
- const u = a(t, N) !== "true", s = [...t.options].find((r) => r.contains(e));
174
+ }, St = (t, { target: e }) => {
175
+ var i, n, o, l, c;
176
+ const s = a(t, N) !== "true", u = [...t.options].find((r) => r.contains(e));
178
177
  if (t._input === e)
179
- b(t, !0);
180
- else if (s && S(s)) {
178
+ E(t, !0);
179
+ else if (u && S(u)) {
181
180
  for (const r of t.options)
182
- r === s ? r.selected = !0 : u && (r.selected = !1);
183
- (i = (n = Object.getOwnPropertyDescriptor(
181
+ r === u ? r.selected = !0 : s && (r.selected = !1);
182
+ (n = (i = Object.getOwnPropertyDescriptor(
184
183
  HTMLInputElement.prototype,
185
184
  "value"
186
- )) == null ? void 0 : n.set) == null || i.call(t._input, s.value), u && ((o = t._input) == null || o.focus(), b(t, !1)), (l = t._input) == null || l.dispatchEvent(
185
+ )) == null ? void 0 : i.set) == null || n.call(t._input, u.value), s && ((o = t._input) == null || o.focus(), E(t, !1)), (l = t._input) == null || l.dispatchEvent(
187
186
  new Event("input", { bubbles: !0, composed: !0 })
188
- ), (d = t._input) == null || d.dispatchEvent(new Event("change", { bubbles: !0 }));
187
+ ), (c = t._input) == null || c.dispatchEvent(new Event("change", { bubbles: !0 }));
189
188
  }
190
- }, Lt = (t, e) => {
191
- var n, i;
189
+ }, kt = (t, e) => {
190
+ var i, n;
192
191
  if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) return;
193
- e.key !== "Escape" && b(t, !0);
194
- const { key: o } = e, l = (n = t._root) == null ? void 0 : n.activeElement, d = st(t), u = d.indexOf(l);
195
- let s = -1;
196
- if (o === "ArrowDown" && (s = (u + 1) % d.length), o === "ArrowUp" && (s = (~u ? u : d.length) - 1), ~u && ((o === "Home" || o === "PageUp") && (s = 0), (o === "End" || o === "PageDown") && (s = d.length - 1), o === "Enter"))
197
- return d[u].click(), e.preventDefault();
198
- if (d[s]) for (const r of d) r.tabIndex = -1;
199
- d[s] && e.preventDefault(), (i = d[s] || t._input) == null || i.focus(), o === "Escape" && b(t, !1);
200
- }, b = (t, e) => {
201
- t.hidden = !e, t.popover && t.togglePopover(e), t._input && lt(t, t._input, e), e && dt(t);
192
+ e.key !== "Escape" && E(t, !0);
193
+ const { key: o } = e, l = (i = t._root) == null ? void 0 : i.activeElement, c = st(t), s = c.indexOf(l);
194
+ let u = -1;
195
+ if (o === "ArrowDown" && (u = (s + 1) % c.length), o === "ArrowUp" && (u = (~s ? s : c.length) - 1), ~s && ((o === "Home" || o === "PageUp") && (u = 0), (o === "End" || o === "PageDown") && (u = c.length - 1), o === "Enter"))
196
+ return c[s].click(), e.preventDefault();
197
+ if (c[u]) for (const r of c) r.tabIndex = -1;
198
+ c[u] && e.preventDefault(), (n = c[u] || t._input) == null || n.focus(), o === "Escape" && E(t, !1);
199
+ }, E = (t, e) => {
200
+ t.hidden = !e, t.popover && t.togglePopover(e), t._input && ut(t, t._input, e), e && lt(t);
202
201
  }, U = (t) => {
203
- x(t._root || t, ut, t), w(t, !1), b(t, !1), t._input = null;
202
+ x(t._root || t, at, t), w(t, !1), E(t, !1), t._input = null;
204
203
  }, st = (t) => [...t.options].filter(
205
204
  (e) => !e.disabled && e.offsetWidth && e.offsetHeight
206
205
  // Checks disabled or visibility (since hidden attribute can be overwritten by display: block)
207
- ), S = (t) => t instanceof HTMLOptionElement || t.getAttribute("role") === "option", lt = (t, e, n = !1) => {
208
- a(e, "popovertarget", M(t)), a(e, "aria-autocomplete", "list"), a(e, "aria-controls", M(t)), a(e, "aria-expanded", `${Tt || n}`), a(e, "autocomplete", "off"), a(e, "role", "combobox");
209
- }, G = (t) => (t == null ? void 0 : t.toLowerCase().trim()) || "", dt = (t, e) => {
210
- var n;
211
- const i = G((n = t._input) == null ? void 0 : n.value);
212
- if (!((e == null ? void 0 : e.type) === "mutation" || t._value !== i)) return;
213
- const l = t.hidden, d = a(t, N) !== "true", u = e instanceof InputEvent && !ft(e);
214
- t.hidden = !0, t._value = i;
206
+ ), S = (t) => t instanceof HTMLOptionElement || t.getAttribute("role") === "option", ut = (t, e, i = !1) => {
207
+ a(e, "popovertarget", M(t)), a(e, "aria-autocomplete", "list"), a(e, "aria-controls", M(t)), a(e, "aria-expanded", `${Ct || i}`), a(e, "autocomplete", "off"), a(e, "role", "combobox");
208
+ }, z = (t) => (t == null ? void 0 : t.toLowerCase().trim()) || "", lt = (t, e) => {
209
+ var i;
210
+ const n = z((i = t._input) == null ? void 0 : i.value);
211
+ if (!((e == null ? void 0 : e.type) === "mutation" || t._value !== n)) return;
212
+ const l = t.hidden, c = a(t, N) !== "true", s = e instanceof InputEvent && !dt(e);
213
+ t.hidden = !0, t._value = n;
215
214
  for (const r of t.options) {
216
- const c = [r.value, r.label, r.text].map(G);
217
- r.hidden = !c.some((p) => p.includes(i)), d && u && S(r) && (r.selected = c.includes(i));
215
+ const d = [r.value, r.label, r.text].map(z);
216
+ r.hidden = !d.some((v) => v.includes(n)), c && s && S(r) && (r.selected = d.includes(n));
218
217
  }
219
218
  t.hidden = l;
220
- const s = st(t);
221
- clearTimeout(Y), Y = setTimeout(() => {
222
- const { length: r } = s.filter(S), c = ++Ct % 2 ? " " : "", p = `${`${t._texts[r === 1 ? "singular" : "plural"]}`.replace("%d", `${r}`)}`;
223
- E && (E.textContent = `${!r && t.innerText.trim() || p}${c}`);
224
- }, 1e3), L && s.map((r, c, p) => {
225
- r.title = `${c + 1}/${p}`;
219
+ const u = st(t);
220
+ clearTimeout(q), q = setTimeout(() => {
221
+ const { length: r } = u.filter(S), d = ++xt % 2 ? " " : "", v = `${`${t._texts[r === 1 ? "singular" : "plural"]}`.replace("%d", `${r}`)}`;
222
+ _ && (_.textContent = `${!r && t.innerText.trim() || v}${d}`);
223
+ }, 1e3), L && u.map((r, d, v) => {
224
+ r.title = `${d + 1}/${v}`;
226
225
  });
227
226
  };
228
227
  h && Object.defineProperty(HTMLInputElement.prototype, "list", {
@@ -232,34 +231,34 @@ h && Object.defineProperty(HTMLInputElement.prototype, "list", {
232
231
  return O(this).getElementById(a(this, "list") || "");
233
232
  }
234
233
  });
235
- B.define("u-datalist", wt);
236
- var ct = " ".repeat(100), Ot = "insertReplacementText", F = ({
234
+ B.define("u-datalist", Tt);
235
+ var ct = " ".repeat(100), Lt = "insertReplacementText", F = ({
237
236
  value: t
238
237
  }) => t.split(ct)[0];
239
- function ft(t) {
238
+ function dt(t) {
240
239
  var e;
241
- const n = t instanceof Event && t.type === "input" && t.target instanceof HTMLInputElement && (!t.inputType || t.inputType === Ot);
242
- if (n) {
243
- const i = t.target.value, o = Array.from(((e = t.target.list) == null ? void 0 : e.options) || []).some(
244
- (l) => l.value === i && !S(l)
240
+ const i = t instanceof Event && t.type === "input" && t.target instanceof HTMLInputElement && (!t.inputType || t.inputType === Lt);
241
+ if (i) {
242
+ const n = t.target.value, o = Array.from(((e = t.target.list) == null ? void 0 : e.options) || []).some(
243
+ (l) => l.value === n && !S(l)
245
244
  );
246
- t.target.value = i.split(ct)[o ? 1 : 0];
245
+ t.target.value = n.split(ct)[o ? 1 : 0];
247
246
  }
248
- return n;
247
+ return i;
249
248
  }
250
- var $t = tt || L, Dt = bt || gt, y = at("polite"), J = "input,focusin,focusout,keydown", Q = {
249
+ var b, Ot = Z || L, $t = _t || bt, G = "input,focusin,focusout,keydown", J = {
251
250
  added: "Added",
252
251
  remove: "Press to remove",
253
252
  removed: "Removed",
254
253
  empty: "No selected",
255
254
  found: "Navigate left to find %d selected",
256
255
  of: "of"
257
- }, Rt = class extends H {
256
+ }, Dt = class extends H {
258
257
  constructor() {
259
- super(), this._blurAnnounceReset = !1, this._blurTimer = 0, this._focusIndex = null, this._root = null, this._texts = Z({}, Q), this.attachShadow({ mode: "open" }).append(
260
- _("slot"),
258
+ super(), this._blurAnnounceReset = !1, this._blurTimer = 0, this._focusIndex = null, this._root = null, this._texts = Q({}, J), this.attachShadow({ mode: "open" }).append(
259
+ g("slot"),
261
260
  // Content slot
262
- _(
261
+ g(
263
262
  "style",
264
263
  `:host(:not([hidden])){ display: inline-block }
265
264
  ::slotted(data) { cursor: pointer; display: inline-block; outline: none; pointer-events: none }
@@ -271,19 +270,19 @@ var $t = tt || L, Dt = bt || gt, y = at("polite"), J = "input,focusin,focusout,k
271
270
  }
272
271
  // Using ES2015 syntax for backwards compatibility
273
272
  static get observedAttributes() {
274
- return A(Q);
273
+ return A(J);
275
274
  }
276
275
  connectedCallback() {
277
- this._root = O(this), y && !y.isConnected && document.body.append(y), w(this, { childList: !0 }), I(this._root, "click", this), I(this, J, this), setTimeout(() => k(this));
276
+ this._root = O(this), b || (b = rt("polite")), b.isConnected || document.body.appendChild(b), w(this, { childList: !0 }), I(this._root, "click", this), I(this, G, this), setTimeout(() => k(this));
278
277
  }
279
- attributeChangedCallback(t, e, n) {
280
- A(this._texts, t, n);
278
+ attributeChangedCallback(t, e, i) {
279
+ A(this._texts, t, i);
281
280
  }
282
281
  disconnectedCallback() {
283
- w(this, !1), x(this._root || this, "click", this), x(this, J, this), this._root = null;
282
+ w(this, !1), x(this._root || this, "click", this), x(this, G, this), this._root = null;
284
283
  }
285
284
  handleEvent(t) {
286
- t.defaultPrevented || (t.type === "click" && Ft(this, t), t.type === "focusin" && Mt(this, t), t.type === "focusout" && Pt(this), t.type === "input" && Nt(this, t), t.type === "keydown" && Ht(this, t), t.type === "mutation" && k(this, t));
285
+ t.defaultPrevented || (t.type === "click" && Pt(this, t), t.type === "focusin" && Rt(this, t), t.type === "focusout" && Mt(this), t.type === "input" && Ft(this, t), t.type === "keydown" && Nt(this, t), t.type === "mutation" && k(this, t));
287
286
  }
288
287
  get items() {
289
288
  return this.querySelectorAll("data");
@@ -298,70 +297,69 @@ var $t = tt || L, Dt = bt || gt, y = at("polite"), J = "input,focusin,focusout,k
298
297
  detail: { item: e, action: e.isConnected ? "remove" : "add" }
299
298
  })
300
299
  ), k = (t, e) => {
301
- var n, i, o, l, d;
302
- const u = t._texts, s = Number.isNaN(t._focusIndex) ? null : e == null ? void 0 : e.detail[0], r = (s == null ? void 0 : s.addedNodes[0]) || (s == null ? void 0 : s.removedNodes[0]), c = `${r ? `${r.isConnected ? u.added : u.removed} ${r.textContent}, ` : ""}`, p = ((o = (i = (n = t.control) == null ? void 0 : n.labels) == null ? void 0 : i[0]) == null ? void 0 : o.textContent) || "", v = [];
303
- a(t, "role", "group"), a(t, "aria-label", p), t.items.forEach((f, $, { length: D }) => {
304
- var j;
305
- const ht = `${c}${f.textContent}, ${u.remove}, ${$ + 1} ${u.of} ${D}`;
306
- a(f, "aria-label", ht), a(f, "role", "button"), f.tabIndex = -1, f.value = f.value || ((j = f.textContent) == null ? void 0 : j.trim()) || "", v.push(f.value);
300
+ var i, n, o, l, c;
301
+ const s = t._texts, u = Number.isNaN(t._focusIndex) ? null : e == null ? void 0 : e.detail[0], r = (u == null ? void 0 : u.addedNodes[0]) || (u == null ? void 0 : u.removedNodes[0]), d = `${r ? `${r.isConnected ? s.added : s.removed} ${r.textContent}, ` : ""}`, v = ((o = (n = (i = t.control) == null ? void 0 : i.labels) == null ? void 0 : n[0]) == null ? void 0 : o.textContent) || "", f = [];
302
+ a(t, "role", "group"), a(t, "aria-label", v), t.items.forEach((p, $, { length: D }) => {
303
+ const vt = `${d}${p.textContent}, ${s.remove}, ${$ + 1} ${s.of} ${D}`;
304
+ a(p, "aria-label", vt), a(p, "role", "button"), p.tabIndex = -1, p.value = (p.value || p.textContent || "").trim(), f.push(p.value);
307
305
  });
308
- const m = t.control, pt = `${c}${p}, ${v.length ? u.found.replace("%d", `${v.length}`) : u.empty}`, C = m && document.getElementById(a(m, "list") || ""), K = C == null ? void 0 : C.children;
306
+ const m = t.control, pt = `${d}${v}, ${f.length ? s.found.replace("%d", `${f.length}`) : s.empty}`, C = m && document.getElementById(a(m, "list") || ""), K = C == null ? void 0 : C.children;
309
307
  m && a(m, "aria-label", pt), C && a(C, N, "true");
310
- for (const f of K || [])
311
- f.selected = v.includes(F(f));
312
- if (c) {
313
- const f = t.items[(t._focusIndex || 1) - 1] || m, $ = f === ((l = O(t)) == null ? void 0 : l.activeElement), D = K || t.items;
314
- t._blurAnnounceReset = !1, f === m ? ($ && ($t && y ? y.textContent = c : (d = D[0]) == null || d.focus()), setTimeout(() => f == null ? void 0 : f.focus(), 100)) : f == null || f.focus(), setTimeout(() => {
315
- if (!Dt) return k(t);
308
+ for (const p of K || [])
309
+ p.selected = f.includes(F(p));
310
+ if (d) {
311
+ const p = t.items[(t._focusIndex || 1) - 1] || m, $ = p === ((l = O(t)) == null ? void 0 : l.activeElement), D = K || t.items;
312
+ t._blurAnnounceReset = !1, p === m ? ($ && (Ot && b ? b.textContent = d : (c = D[0]) == null || c.focus()), setTimeout(() => p == null ? void 0 : p.focus(), 100)) : p == null || p.focus(), setTimeout(() => {
313
+ if (!$t) return k(t);
316
314
  t._blurAnnounceReset = !0;
317
315
  }, 500);
318
316
  }
319
- }, Mt = (t, { target: e }) => {
317
+ }, Rt = (t, { target: e }) => {
320
318
  clearTimeout(t._blurTimer), t._focusIndex = [...t.items].indexOf(e);
321
- }, Pt = (t) => {
319
+ }, Mt = (t) => {
322
320
  t._blurAnnounceReset && k(t), t._blurTimer = setTimeout(() => {
323
321
  t._focusIndex = null;
324
322
  });
325
- }, Ft = (t, { target: e, clientX: n, clientY: i }) => {
323
+ }, Pt = (t, { target: e, clientX: i, clientY: n }) => {
326
324
  var o;
327
- const l = t.contains(e) ? [...t.items] : null, d = l == null ? void 0 : l.find((s) => s.contains(e)), u = l == null ? void 0 : l.find((s) => {
328
- const { top: r, right: c, bottom: p, left: v } = s.getBoundingClientRect();
329
- return i >= r && i <= p && n >= v && n <= c;
325
+ const l = t.contains(e) ? [...t.items] : null, c = l == null ? void 0 : l.find((u) => u.contains(e)), s = l == null ? void 0 : l.find((u) => {
326
+ const { top: r, right: d, bottom: v, left: f } = u.getBoundingClientRect();
327
+ return n >= r && n <= v && i >= f && i <= d;
330
328
  });
331
- d ? V(t, d) && d.remove() : u ? u.focus() : e === t && ((o = t.control) == null || o.focus());
332
- }, Nt = (t, e) => {
333
- var n;
334
- const i = e.target;
335
- if (!ft(e) || !(i != null && i.value.trim())) return;
336
- const o = F(i), l = [...t.items], u = [...((n = i == null ? void 0 : i.list) == null ? void 0 : n.children) || []].find((c) => F(c) === o), s = l.find((c) => c.value === o), r = _("data", (u == null ? void 0 : u.text) || o, {
329
+ c ? V(t, c) && c.remove() : s ? s.focus() : e === t && ((o = t.control) == null || o.focus());
330
+ }, Ft = (t, e) => {
331
+ var i;
332
+ const n = e.target;
333
+ if (!dt(e) || !(n != null && n.value.trim())) return;
334
+ const o = F(n), l = [...t.items], s = [...((i = n == null ? void 0 : n.list) == null ? void 0 : i.children) || []].find((d) => F(d) === o), u = l.find((d) => d.value === o), r = g("data", (s == null ? void 0 : s.text) || o, {
337
335
  value: o
338
336
  });
339
- if (i.value = "", !!V(t, s || r)) {
340
- if (s) return s.remove();
337
+ if (n.value = "", !!V(t, u || r)) {
338
+ if (u) return u.remove();
341
339
  if (!l[0]) return t.prepend(r);
342
340
  l[l.length - 1].insertAdjacentElement("afterend", r);
343
341
  }
344
- }, Ht = (t, e) => {
345
- var n, i;
346
- const { key: o, repeat: l, target: d } = e, u = t.control === d ? t.control : null, s = u == null ? void 0 : u.selectionEnd;
347
- let r = u ? t.items.length : (n = t._focusIndex) != null ? n : -1;
348
- if (!(r === -1 || !u && yt(e))) {
349
- if (o === "ArrowRight" && !u) r += 1;
350
- else if (o === "ArrowLeft" && !s) r -= 1;
342
+ }, Nt = (t, e) => {
343
+ var i, n;
344
+ const { key: o, repeat: l, target: c } = e, s = t.control === c ? t.control : null, u = s == null ? void 0 : s.selectionEnd;
345
+ let r = s ? t.items.length : (i = t._focusIndex) != null ? i : -1;
346
+ if (!(r === -1 || !s && Et(e))) {
347
+ if (o === "ArrowRight" && !s) r += 1;
348
+ else if (o === "ArrowLeft" && !u) r -= 1;
351
349
  else {
352
- if (o === "Enter" && u)
353
- return e.preventDefault(), u.dispatchEvent(new Event("input", { bubbles: !0 }));
354
- if ((o === "Backspace" || o === "Delete") && !s) {
355
- const c = !l && t.items[r];
356
- if (e.preventDefault(), c) return V(t, c) && c.remove();
357
- u && (r -= 1);
350
+ if (o === "Enter" && s)
351
+ return e.preventDefault(), s.dispatchEvent(new Event("input", { bubbles: !0 }));
352
+ if ((o === "Backspace" || o === "Delete") && !u) {
353
+ const d = !l && t.items[r];
354
+ if (e.preventDefault(), d) return V(t, d) && d.remove();
355
+ s && (r -= 1);
358
356
  } else return;
359
357
  }
360
- e.preventDefault(), (i = t.items[Math.max(0, r)] || t.control) == null || i.focus();
358
+ e.preventDefault(), (n = t.items[Math.max(0, r)] || t.control) == null || n.focus();
361
359
  }
362
360
  };
363
- B.define("u-tags", Rt);
361
+ B.define("u-tags", Dt);
364
362
  export {
365
- Rt as UHTMLTagsElement
363
+ Dt as UHTMLTagsElement
366
364
  };
367
365
  //# sourceMappingURL=u-tags.js.map