@golemui/gui-lit 1.0.3 → 1.1.1-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/{button.element-3a7rRHbA.js → button.element-CJay43iR.js} +16 -13
  3. package/calendar-D31xNsxx.js +267 -0
  4. package/{range-calendar.element-_1bHW_c1.js → calendar.element-BhFrCsns.js} +16 -16
  5. package/{checkbox.element-CVskoXEc.js → checkbox.element-DAAVB651.js} +49 -49
  6. package/{currency.element-5GSakkxF.js → currency.element-D8A2ObpM.js} +15 -11
  7. package/{date-CDUlLuYy.js → date-DBuYpvcO.js} +88 -29
  8. package/date-input-DLiMreSS.js +204 -0
  9. package/date-picker.element-DeUQtbLg.js +357 -0
  10. package/date-time-calendar-DzU-FtVl.js +374 -0
  11. package/date-time-calendar.element-BLBcVsFu.js +95 -0
  12. package/date-time-input-DZaz2heD.js +246 -0
  13. package/date-time-picker.element-BUbLdV6i.js +440 -0
  14. package/date-time.element-B5onfSBG.js +93 -0
  15. package/{date.element-BZO0UQez.js → date.element-BsKhLrEc.js} +27 -19
  16. package/day-status-CsWStVQV.js +554 -0
  17. package/{dropdown.element-CyJbVAA5.js → dropdown.element-CXpMwJsU.js} +53 -37
  18. package/{errors-QjKhr6mA.js → errors-Byb2dIhK.js} +3 -2
  19. package/focus-leave.controller-2gV0pQd5.js +73 -0
  20. package/index.js +1635 -948
  21. package/index.umd.cjs +2046 -601
  22. package/lib/components/date-picker.element.d.ts +0 -11
  23. package/lib/components/date-time-calendar.element.d.ts +18 -0
  24. package/lib/components/date-time-picker.element.d.ts +18 -0
  25. package/lib/components/date-time.element.d.ts +18 -0
  26. package/lib/components/dropdown.element.d.ts +2 -0
  27. package/lib/components/range-calendar.element.d.ts +2 -1
  28. package/lib/components/range-date-picker.element.d.ts +0 -15
  29. package/lib/components/range-date-time-calendar.element.d.ts +18 -0
  30. package/lib/components/range-date-time-input.element.d.ts +18 -0
  31. package/lib/components/range-date-time-picker.element.d.ts +18 -0
  32. package/lib/components/range-time-input.element.d.ts +18 -0
  33. package/lib/components/range-time-picker.element.d.ts +18 -0
  34. package/lib/components/time-picker.element.d.ts +18 -0
  35. package/lib/components/time.element.d.ts +18 -0
  36. package/list-D730tmGN.js +297 -0
  37. package/{list.element-Co3V3Cn5.js → list.element-eo3DIOrp.js} +23 -23
  38. package/{markdown.element-p-kC47D7.js → markdown.element-FbtwdnAv.js} +310 -218
  39. package/{number.element-CBr47IiY.js → number.element-BEpOCzXy.js} +76 -61
  40. package/package.json +6 -6
  41. package/part-templates-VORbpgs2.js +691 -0
  42. package/{password.element-n-R9RbkB.js → password.element-CBaB8h5b.js} +19 -17
  43. package/pill-ranges-DpvWwP-3.js +48 -0
  44. package/{pills-B66qz_KX.js → pills-BDMO2NiR.js} +84 -59
  45. package/popup.controller-B33OvX_y.js +86 -0
  46. package/{radiogroup.element-CeQn623u.js → radiogroup.element-KWzBx8mx.js} +55 -51
  47. package/range-calendar-DO_woqcF.js +466 -0
  48. package/{calendar.element-DcnTyvfg.js → range-calendar.element-DHLZhpnj.js} +37 -29
  49. package/range-commit-8-MmYUyo.js +14 -0
  50. package/range-date-input-Br7XqQPK.js +311 -0
  51. package/{range-date-input.element-BqzAF0O3.js → range-date-input.element-BdD4SlB4.js} +12 -8
  52. package/range-date-picker.element-DWRHiAoC.js +434 -0
  53. package/range-date-time-calendar-B3EMgN1E.js +734 -0
  54. package/range-date-time-calendar.element-Coea6RF4.js +97 -0
  55. package/range-date-time-input-Cu-T_nuC.js +353 -0
  56. package/range-date-time-input.element-Cti44iuW.js +87 -0
  57. package/range-date-time-picker.element-CDN2RL1y.js +472 -0
  58. package/range-selection-CU3hxLJE.js +25 -0
  59. package/range-time-input-BP9ZL9O8.js +348 -0
  60. package/range-time-input.element-B7wtHJoQ.js +84 -0
  61. package/range-time-picker.element-CPIAiQPC.js +470 -0
  62. package/{repeater.element-CtNgB4F5.js → repeater.element-BM1Keckd.js} +1 -1
  63. package/{select.element-jcDF1h-g.js → select.element-eepcXTpL.js} +117 -107
  64. package/{tabs.element-BvAyI71N.js → tabs.element-CvcIA8P3.js} +1 -0
  65. package/{tags.element-CX3vQL8L.js → tags.element-CPHgotb0.js} +21 -14
  66. package/templates-Dmr34nwp.js +88 -0
  67. package/{textarea.element-HThYqdR_.js → textarea.element-CiNEy9uq.js} +8 -7
  68. package/{textinput.element-CkXNzMUg.js → textinput.element-AL2Nr768.js} +10 -9
  69. package/time-input-5dkSm8UW.js +201 -0
  70. package/time-list-DLcq8BAp.js +217 -0
  71. package/time-picker-g337F8d0.js +299 -0
  72. package/time-picker.element-DLihegjg.js +89 -0
  73. package/time.element-BneqgMlQ.js +85 -0
  74. package/{toggle.element-C1kCw5H8.js → toggle.element-Cz91CRdp.js} +44 -43
  75. package/abstract-calendar-D0-077XJ.js +0 -545
  76. package/calendar-BclCC9VJ.js +0 -96
  77. package/date-input-DCdGWRio.js +0 -268
  78. package/date-picker.element-k7AJFQ5W.js +0 -168
  79. package/list-D1oKnH89.js +0 -283
  80. package/range-calendar-CBINu84w.js +0 -255
  81. package/range-date-input-BYXzqnr1.js +0 -395
  82. package/range-date-picker.element-BCBefgvY.js +0 -182
  83. package/templates-Dk1jxLwS.js +0 -75
@@ -2,12 +2,12 @@ import { InputWidgetAdapter as m, formContext as y, inputContext as P } from "@g
2
2
  import { LitElement as w, nothing as n, html as u } from "lit";
3
3
  import { property as o, state as g, customElement as b } from "lit/decorators.js";
4
4
  import { classMap as v } from "lit/directives/class-map.js";
5
- import { G as $, a as f, b as I, c as C } from "./templates-Dk1jxLwS.js";
5
+ import { G as $, a as f, b as I, c as C } from "./templates-Dmr34nwp.js";
6
6
  import { consume as D, provide as L } from "@lit/context";
7
7
  import "rxjs";
8
8
  var S = Object.defineProperty, _ = Object.getOwnPropertyDescriptor, s = (t, a, i, d) => {
9
- for (var r = d > 1 ? void 0 : d ? _(a, i) : a, l = t.length - 1, p; l >= 0; l--)
10
- (p = t[l]) && (r = (d ? p(a, i, r) : p(r)) || r);
9
+ for (var r = d > 1 ? void 0 : d ? _(a, i) : a, l = t.length - 1, h; l >= 0; l--)
10
+ (h = t[l]) && (r = (d ? h(a, i, r) : h(r)) || r);
11
11
  return d && r && S(a, i, r), r;
12
12
  };
13
13
  let e = class extends w {
@@ -21,7 +21,8 @@ let e = class extends w {
21
21
  errors: this.errors,
22
22
  readonly: this.readOnly,
23
23
  disabled: this.disabled,
24
- touched: this.touched
24
+ touched: this.touched,
25
+ required: this.required
25
26
  }
26
27
  })
27
28
  });
@@ -65,7 +66,7 @@ let e = class extends w {
65
66
  data-cy=${`${this.uid}_password`}
66
67
  class=${v(i)}
67
68
  value=${this.value}
68
- ?required=${this.disabled}
69
+ ?required=${this.required}
69
70
  ?disabled=${this.disabled}
70
71
  ?readonly=${this.readOnly}
71
72
  placeholder=${this.placeholder || n}
@@ -78,10 +79,11 @@ let e = class extends w {
78
79
  class=${`gui-password__toggle gui-widget-icon ${this.showPassword && t.showPasswordIcon ? t.showPasswordIcon : ""} ${!this.showPassword && t.hidePasswordIcon ? t.hidePasswordIcon : ""}`}
79
80
  data-icon=${this.showPassword ? t.showPasswordIcon : t.hidePasswordIcon}
80
81
  type="button"
81
- tabindex="-1"
82
+ ?disabled=${this.disabled}
83
+ aria-label=${this.showPassword ? t.hidePasswordLabel ?? "Hide password" : t.showPasswordLabel ?? "Show password"}
82
84
  @click=${() => this.showPassword = !this.showPassword}
83
85
  >
84
- ${t.showPasswordIcon || t.hidePasswordIcon ? n : u`<span
86
+ ${t.showPasswordIcon || t.hidePasswordIcon ? n : u`<span aria-hidden="true"
85
87
  >${this.showPassword ? t.hidePasswordLabel ?? "Hide" : t.showPasswordLabel ?? "Show"}</span
86
88
  >`}
87
89
  </button>
@@ -169,12 +171,12 @@ e = s([
169
171
  b("gui-password")
170
172
  ], e);
171
173
  typeof customElements < "u" && !customElements.get("gui-password") && customElements.define("gui-password", e);
172
- var x = Object.defineProperty, O = Object.getOwnPropertyDescriptor, c = (t, a, i, d) => {
173
- for (var r = d > 1 ? void 0 : d ? O(a, i) : a, l = t.length - 1, p; l >= 0; l--)
174
- (p = t[l]) && (r = (d ? p(a, i, r) : p(r)) || r);
175
- return d && r && x(a, i, r), r;
174
+ var O = Object.defineProperty, x = Object.getOwnPropertyDescriptor, c = (t, a, i, d) => {
175
+ for (var r = d > 1 ? void 0 : d ? x(a, i) : a, l = t.length - 1, h; l >= 0; l--)
176
+ (h = t[l]) && (r = (d ? h(a, i, r) : h(r)) || r);
177
+ return d && r && O(a, i, r), r;
176
178
  };
177
- let h = class extends w {
179
+ let p = class extends w {
178
180
  constructor() {
179
181
  super(...arguments), this.adapter = new m(), this.subscriptions = [];
180
182
  }
@@ -226,13 +228,13 @@ let h = class extends w {
226
228
  c([
227
229
  D({ context: y }),
228
230
  o({ attribute: !1 })
229
- ], h.prototype, "formContext", 2);
231
+ ], p.prototype, "formContext", 2);
230
232
  c([
231
233
  L({ context: P })
232
- ], h.prototype, "adapter", 2);
233
- h = c([
234
+ ], p.prototype, "adapter", 2);
235
+ p = c([
234
236
  b("gui-password-input")
235
- ], h);
237
+ ], p);
236
238
  export {
237
- h as PasswordElement
239
+ p as PasswordElement
238
240
  };
@@ -0,0 +1,48 @@
1
+ import { p as o } from "./date-DBuYpvcO.js";
2
+ function s(t) {
3
+ return `${t.start}-${t.end ?? t.start}`;
4
+ }
5
+ function f(t, n) {
6
+ return !t || !Array.isArray(t) ? [] : [...t].sort((r, e) => n(r.start, e.start));
7
+ }
8
+ function u(t, n) {
9
+ return t.find((r) => s(r) === n);
10
+ }
11
+ function c(t, n) {
12
+ const r = t ?? [], e = u(r, n);
13
+ if (!e) return null;
14
+ const i = r.filter(
15
+ (a) => !(a.start === e.start && (a.end ?? null) === (e.end ?? null))
16
+ );
17
+ return { removed: e, next: i };
18
+ }
19
+ function d(t, n) {
20
+ const r = o(t);
21
+ return isNaN(r.getTime()) ? t : new Intl.DateTimeFormat(n ?? "en", {
22
+ year: "numeric",
23
+ month: "2-digit",
24
+ day: "2-digit"
25
+ }).format(r);
26
+ }
27
+ function m(t, n) {
28
+ const r = n(t.start), e = t.end ? n(t.end) : r;
29
+ return `${r} - ${e}`;
30
+ }
31
+ function y(t, n) {
32
+ return t.map((r) => {
33
+ const e = n(r);
34
+ return {
35
+ key: s(r),
36
+ label: e,
37
+ ariaLabel: e
38
+ };
39
+ });
40
+ }
41
+ export {
42
+ m as a,
43
+ y as b,
44
+ d as c,
45
+ u as f,
46
+ c as r,
47
+ f as s
48
+ };
@@ -1,16 +1,16 @@
1
- import { LitElement as m, nothing as p, html as d } from "lit";
1
+ import { LitElement as m, nothing as d, html as a } from "lit";
2
2
  import { property as l, state as u, customElement as w } from "lit/decorators.js";
3
3
  import { classMap as c } from "lit/directives/class-map.js";
4
4
  import { repeat as b } from "lit/directives/repeat.js";
5
5
  import { c as v } from "./tabs-DzSCq_98.js";
6
- var y = Object.defineProperty, _ = Object.getOwnPropertyDescriptor, o = (e, t, i, s) => {
7
- for (var n = s > 1 ? void 0 : s ? _(t, i) : t, a = e.length - 1, h; a >= 0; a--)
8
- (h = e[a]) && (n = (s ? h(t, i, n) : h(n)) || n);
9
- return s && n && y(t, i, n), n;
6
+ var y = Object.defineProperty, _ = Object.getOwnPropertyDescriptor, o = (e, t, i, r) => {
7
+ for (var n = r > 1 ? void 0 : r ? _(t, i) : t, p = e.length - 1, h; p >= 0; p--)
8
+ (h = e[p]) && (n = (r ? h(t, i, n) : h(n)) || n);
9
+ return r && n && y(t, i, n), n;
10
10
  };
11
- let r = class extends m {
11
+ let s = class extends m {
12
12
  constructor() {
13
- super(...arguments), this.items = [], this.clickable = !1, this.removable = !0, this.bubble = !0, this.tabbable = !0, this.disabled = !1, this.readOnly = !1, this.removeAriaLabel = "Remove", this._isStartVisible = !0, this._isEndVisible = !0, this._showDropdown = !1, this._pendingFocusIndex = null, this.handlePillFocus = (e) => {
13
+ super(...arguments), this.uid = void 0, this.items = [], this.clickable = !1, this.removable = !0, this.bubble = !0, this.tabbable = !0, this.disabled = !1, this.readOnly = !1, this.removeAriaLabel = "Remove", this.toolbarAriaLabel = "Selected items", this._isStartVisible = !0, this._isEndVisible = !0, this._showDropdown = !1, this._pendingFocusIndex = null, this.handlePillFocus = (e) => {
14
14
  e.target.scrollIntoView({
15
15
  behavior: "smooth",
16
16
  block: "nearest",
@@ -19,8 +19,8 @@ let r = class extends m {
19
19
  }, this.toggleDropdown = () => {
20
20
  this._showDropdown ? this.closeDropdown() : this.openDropdown();
21
21
  }, this.handleOutsideInteraction = (e) => {
22
- const t = this.querySelector(".gui-pills__compact"), i = this.querySelector(".gui-pills__dropdown"), s = e.composedPath()[0];
23
- !t?.contains(s) && !i?.contains(s) && this.closeDropdown();
22
+ const t = this.querySelector(".gui-pills__compact"), i = this.querySelector(".gui-pills__dropdown"), r = e.composedPath()[0];
23
+ !t?.contains(r) && !i?.contains(r) && this.closeDropdown();
24
24
  };
25
25
  }
26
26
  createRenderRoot() {
@@ -35,8 +35,8 @@ let r = class extends m {
35
35
  this._showDropdown && this.closeDropdown();
36
36
  return;
37
37
  }
38
- const s = Math.max(0, Math.min(t, i - 1));
39
- this.focusPillAt(s);
38
+ const r = Math.max(0, Math.min(t, i - 1));
39
+ this.focusPillAt(r);
40
40
  }
41
41
  }
42
42
  disconnectedCallback() {
@@ -44,13 +44,13 @@ let r = class extends m {
44
44
  }
45
45
  render() {
46
46
  const e = this.items.length;
47
- return e === 0 ? p : d`
48
- ${this.renderStrip()} ${this.bubble ? this.renderCompact(e) : p}
49
- ${this.bubble && this._showDropdown ? this.renderDropdown() : p}
47
+ return e === 0 ? d : a`
48
+ ${this.renderStrip()} ${this.bubble ? this.renderCompact(e) : d}
49
+ ${this.bubble && this._showDropdown ? this.renderDropdown() : d}
50
50
  `;
51
51
  }
52
52
  renderStrip() {
53
- return d`
53
+ return a`
54
54
  <div
55
55
  class=${c({
56
56
  "gui-pills__strip-wrapper": !0,
@@ -58,7 +58,12 @@ let r = class extends m {
58
58
  "gui-pills--end-shadow": !this._isEndVisible
59
59
  })}
60
60
  >
61
- <div class="gui-pills__strip" role="list" tabindex="-1">
61
+ <div
62
+ class="gui-pills__strip"
63
+ role="toolbar"
64
+ aria-label=${this.toolbarAriaLabel}
65
+ tabindex="-1"
66
+ >
62
67
  <span class="gui-sentinel gui-sentinel__start"></span>
63
68
  ${b(
64
69
  this.items,
@@ -70,14 +75,19 @@ let r = class extends m {
70
75
  </div>
71
76
  `;
72
77
  }
78
+ get dropdownId() {
79
+ return this.uid ? `${this.uid}_pills_dropdown` : void 0;
80
+ }
73
81
  renderCompact(e) {
74
- return d`
82
+ return a`
75
83
  <div class="gui-pills__compact">
76
84
  <button
77
85
  type="button"
78
86
  class="gui-pills__count"
79
87
  aria-label=${this.compactAriaLabel ?? `${e} items`}
88
+ aria-haspopup="true"
80
89
  aria-expanded=${this._showDropdown}
90
+ aria-controls=${this.dropdownId ?? d}
81
91
  ?disabled=${this.disabled || this.readOnly}
82
92
  @click=${(t) => {
83
93
  t.stopPropagation(), this.toggleDropdown();
@@ -89,8 +99,14 @@ let r = class extends m {
89
99
  `;
90
100
  }
91
101
  renderDropdown() {
92
- return d`
93
- <div class="gui-pills__dropdown" role="list">
102
+ return a`
103
+ <div
104
+ id=${this.dropdownId ?? d}
105
+ class="gui-pills__dropdown"
106
+ role="toolbar"
107
+ aria-orientation="vertical"
108
+ aria-label=${this.toolbarAriaLabel}
109
+ >
94
110
  ${b(
95
111
  this.items,
96
112
  (e) => `dd-${e.key}`,
@@ -100,44 +116,47 @@ let r = class extends m {
100
116
  `;
101
117
  }
102
118
  renderPill(e, t, i) {
103
- const s = e.ariaLabel ?? `${this.removeAriaLabel}: ${e.label}`, n = this.clickable && !this.disabled && !this.readOnly;
104
- return d`
105
- <div
119
+ const r = this.clickable && !this.disabled && !this.readOnly;
120
+ return a`
121
+ <button
122
+ type="button"
106
123
  class=${c({
107
124
  "gui-pills__pill": !0,
108
- "gui-pills__pill--clickable": n
125
+ "gui-pills__pill--clickable": r
109
126
  })}
110
- role="listitem"
111
127
  data-key=${e.key}
112
128
  data-index=${t}
113
129
  data-in-dropdown=${i}
114
130
  tabindex=${this.tabbable && !this.disabled && !this.readOnly ? 0 : -1}
115
- aria-label=${s}
116
- @click=${(a) => this.onPillClick(a, e)}
131
+ ?disabled=${this.disabled || this.readOnly}
132
+ aria-label=${e.ariaLabel ?? e.label}
133
+ aria-description=${this.removable && !this.disabled && !this.readOnly ? this.removeAriaLabel : d}
134
+ @click=${(n) => this.onPillClick(n, e)}
117
135
  @focus=${this.handlePillFocus}
118
- @keydown=${(a) => this.onPillKeydown(a, e, t)}
136
+ @keydown=${(n) => this.onPillKeydown(n, e, t)}
119
137
  >
120
138
  <span class="gui-pills__pill-text">${e.label}</span>
121
- ${this.removable ? this.renderRemoveButton(e) : p}
122
- </div>
139
+ ${this.removable ? this.renderRemoveButton(e) : d}
140
+ </button>
123
141
  `;
124
142
  }
125
143
  renderRemoveButton(e) {
126
- return d`
127
- <button
128
- type="button"
144
+ return a`
145
+ <span
129
146
  class="gui-pills__pill-remove"
130
- tabindex="-1"
131
147
  aria-hidden="true"
132
- ?disabled=${this.disabled || this.readOnly}
148
+ @mousedown=${(t) => {
149
+ t.stopPropagation(), t.preventDefault();
150
+ }}
133
151
  @click=${(t) => {
134
152
  t.stopPropagation(), this.emitRemove(e.key, this.items.indexOf(e));
135
153
  }}
136
154
  >
137
- ${this.removeIcon ? d`<span
155
+ ${this.removeIcon ? a`<span
138
156
  class=${`gui-widget-icon ${this.removeIcon}`}
139
157
  data-icon=${this.removeIcon}
140
- ></span>` : d`<svg
158
+ aria-hidden="true"
159
+ ></span>` : a`<svg
141
160
  xmlns="http://www.w3.org/2000/svg"
142
161
  width="16"
143
162
  height="16"
@@ -149,7 +168,7 @@ let r = class extends m {
149
168
  d="M165.66,101.66,139.31,128l26.35,26.34a8,8,0,0,1-11.32,11.32L128,139.31l-26.34,26.35a8,8,0,0,1-11.32-11.32L116.69,128,90.34,101.66a8,8,0,0,1,11.32-11.32L128,116.69l26.34-26.35a8,8,0,0,1,11.32,11.32ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"
150
169
  ></path>
151
170
  </svg>`}
152
- </button>
171
+ </span>
153
172
  `;
154
173
  }
155
174
  onPillClick(e, t) {
@@ -180,12 +199,12 @@ let r = class extends m {
180
199
  );
181
200
  return;
182
201
  }
183
- const s = this._showDropdown, n = s ? "ArrowUp" : "ArrowLeft", a = s ? "ArrowDown" : "ArrowRight";
202
+ const r = this._showDropdown, n = r ? "ArrowUp" : "ArrowLeft", p = r ? "ArrowDown" : "ArrowRight";
184
203
  if (e.key === n) {
185
204
  i > 0 ? (e.preventDefault(), this.focusPillAt(i - 1)) : this.emitKeydown(t.key, e);
186
205
  return;
187
206
  }
188
- if (e.key === a) {
207
+ if (e.key === p) {
189
208
  i < this.items.length - 1 ? (e.preventDefault(), this.focusPillAt(i + 1)) : this.emitKeydown(t.key, e);
190
209
  return;
191
210
  }
@@ -197,8 +216,8 @@ let r = class extends m {
197
216
  e.preventDefault(), this.focusPillAt(this.items.length - 1);
198
217
  return;
199
218
  }
200
- if (e.key === "Escape" && s) {
201
- e.preventDefault(), this.closeDropdown();
219
+ if (e.key === "Escape" && r) {
220
+ e.preventDefault(), e.stopPropagation(), this.closeDropdown();
202
221
  return;
203
222
  }
204
223
  this.emitKeydown(t.key, e);
@@ -232,8 +251,8 @@ let r = class extends m {
232
251
  requestAnimationFrame(() => {
233
252
  const t = this._showDropdown ? ".gui-pills__dropdown .gui-pills__pill" : ".gui-pills__strip .gui-pills__pill", i = this.querySelectorAll(t);
234
253
  if (i.length === 0) return;
235
- const s = Math.max(0, Math.min(e, i.length - 1));
236
- i[s].focus();
254
+ const r = Math.max(0, Math.min(e, i.length - 1));
255
+ i[r].focus();
237
256
  });
238
257
  }
239
258
  /** Open the dropdown and focus its first pill. No-op if `bubble` is false. */
@@ -278,46 +297,52 @@ let r = class extends m {
278
297
  this.startObserver?.disconnect(), this.endObserver?.disconnect(), this.startObserver = void 0, this.endObserver = void 0;
279
298
  }
280
299
  };
300
+ o([
301
+ l({ type: String })
302
+ ], s.prototype, "uid", 2);
281
303
  o([
282
304
  l({ type: Array })
283
- ], r.prototype, "items", 2);
305
+ ], s.prototype, "items", 2);
284
306
  o([
285
307
  l({ type: Boolean })
286
- ], r.prototype, "clickable", 2);
308
+ ], s.prototype, "clickable", 2);
287
309
  o([
288
310
  l({ type: Boolean })
289
- ], r.prototype, "removable", 2);
311
+ ], s.prototype, "removable", 2);
290
312
  o([
291
313
  l({ type: Boolean })
292
- ], r.prototype, "bubble", 2);
314
+ ], s.prototype, "bubble", 2);
293
315
  o([
294
316
  l({ type: Boolean })
295
- ], r.prototype, "tabbable", 2);
317
+ ], s.prototype, "tabbable", 2);
296
318
  o([
297
319
  l({ type: Boolean })
298
- ], r.prototype, "disabled", 2);
320
+ ], s.prototype, "disabled", 2);
299
321
  o([
300
322
  l({ type: Boolean, attribute: "readonly" })
301
- ], r.prototype, "readOnly", 2);
323
+ ], s.prototype, "readOnly", 2);
302
324
  o([
303
325
  l({ type: String, attribute: "remove-aria-label" })
304
- ], r.prototype, "removeAriaLabel", 2);
326
+ ], s.prototype, "removeAriaLabel", 2);
305
327
  o([
306
328
  l({ type: String, attribute: "remove-icon" })
307
- ], r.prototype, "removeIcon", 2);
329
+ ], s.prototype, "removeIcon", 2);
308
330
  o([
309
331
  l({ type: String, attribute: "compact-aria-label" })
310
- ], r.prototype, "compactAriaLabel", 2);
332
+ ], s.prototype, "compactAriaLabel", 2);
333
+ o([
334
+ l({ type: String, attribute: "toolbar-aria-label" })
335
+ ], s.prototype, "toolbarAriaLabel", 2);
311
336
  o([
312
337
  u()
313
- ], r.prototype, "_isStartVisible", 2);
338
+ ], s.prototype, "_isStartVisible", 2);
314
339
  o([
315
340
  u()
316
- ], r.prototype, "_isEndVisible", 2);
341
+ ], s.prototype, "_isEndVisible", 2);
317
342
  o([
318
343
  u()
319
- ], r.prototype, "_showDropdown", 2);
320
- r = o([
344
+ ], s.prototype, "_showDropdown", 2);
345
+ s = o([
321
346
  w("gui-pills")
322
- ], r);
323
- typeof customElements < "u" && !customElements.get("gui-pills") && customElements.define("gui-pills", r);
347
+ ], s);
348
+ typeof customElements < "u" && !customElements.get("gui-pills") && customElements.define("gui-pills", s);
@@ -0,0 +1,86 @@
1
+ import "lit";
2
+ import { G as n } from "./focus-leave.controller-2gV0pQd5.js";
3
+ class c {
4
+ constructor(e, i) {
5
+ this._open = !1, this._restoringFocus = !1, this._suppressNextFocusOut = !1, this._pointerDownInside = !1, this._pointerDownTarget = null, this.show = () => {
6
+ this.options.isDisabled() || this._restoringFocus || (this.options.beforeOpen?.(this), this.setOpen(!0));
7
+ }, this.close = () => {
8
+ this.setOpen(!1);
9
+ }, this.openAndFocus = () => {
10
+ this.show(), !(!this._open || !this.options.focusPopupSelector) && Promise.resolve(this.host.updateComplete).then(() => {
11
+ this.host.querySelector(this.options.focusPopupSelector)?.focus();
12
+ });
13
+ }, this.toggle = () => {
14
+ this.options.isDisabled() || (this.options.keyToggleMode === "toggle" ? this.setOpen(!this._open) : this._open ? this.close() : this.show());
15
+ }, this.onAnchorClick = (t) => {
16
+ if (this.options.isDisabled()) return;
17
+ const s = this._pointerDownTarget ?? t.target, o = this.options.clickIntent(s);
18
+ if (o !== "ignore") {
19
+ if (o === "open") {
20
+ this.show();
21
+ return;
22
+ }
23
+ this.toggle();
24
+ }
25
+ }, this.onAnchorKeyDown = (t) => this.options.isDisabled() ? !1 : t.key === "Escape" && this._open ? (t.preventDefault(), t.stopPropagation(), this.restoreFocusToInput(), this.close(), !0) : !1, this.onDocumentClick = (t) => {
26
+ if (!this._open) return;
27
+ !t.composedPath().includes(this.host) && !this._pointerDownInside && this.close();
28
+ }, this.onDocumentPointerDown = (t) => {
29
+ const s = t.composedPath();
30
+ this._pointerDownInside = s.includes(this.host), this._pointerDownTarget = s[0] ?? null;
31
+ }, this.onDocumentKeyDown = (t) => {
32
+ t.key !== "Tab" && t.key !== "Escape" || (this._pointerDownInside = !1, this._pointerDownTarget = null);
33
+ }, this.closeOnFocusLeave = () => {
34
+ this._pointerDownInside || this.close();
35
+ }, this.onHostFocusOut = (t) => {
36
+ if (this._suppressNextFocusOut) {
37
+ this._suppressNextFocusOut = !1;
38
+ return;
39
+ }
40
+ if (!this._open) return;
41
+ const s = t.relatedTarget;
42
+ this._pointerDownInside && (!s || s.contains(this.host)) || this.focusLeave.handleFocusOut(t);
43
+ }, this.host = e, this.options = i, this.focusLeave = new n(e, {
44
+ onLeave: () => {
45
+ this.close();
46
+ }
47
+ }), e.addController(this);
48
+ }
49
+ get open() {
50
+ return this._open;
51
+ }
52
+ /**
53
+ * Swallows exactly the next focusout pass — even one that arrives while
54
+ * the popup is closed — then re-arms normal behavior. Used around
55
+ * operations that transiently move focus (pills dropdown coordination).
56
+ */
57
+ suppressNextFocusOut() {
58
+ this._suppressNextFocusOut = !0;
59
+ }
60
+ setOpen(e) {
61
+ this._open !== e && (this._open = e, this.host.requestUpdate(), this.options.onOpenChanged?.(e));
62
+ }
63
+ /**
64
+ * Focuses the `focusRestoreSelector` element, arming the restoring-focus
65
+ * flag (reset via setTimeout(0)) so the resulting focus event does not
66
+ * re-open the popup through show().
67
+ */
68
+ restoreFocusToInput() {
69
+ const e = this.host.querySelector(this.options.focusRestoreSelector);
70
+ e && (this._restoringFocus = !0, e.focus(), setTimeout(() => {
71
+ this._restoringFocus = !1;
72
+ }));
73
+ }
74
+ hostUpdated() {
75
+ this._open && this.options.isDisabled() && this.close();
76
+ }
77
+ hostConnected() {
78
+ document.addEventListener("click", this.onDocumentClick), document.addEventListener("pointerdown", this.onDocumentPointerDown, !0), document.addEventListener("keydown", this.onDocumentKeyDown, !0), this.host.addEventListener("focusout", this.onHostFocusOut);
79
+ }
80
+ hostDisconnected() {
81
+ document.removeEventListener("click", this.onDocumentClick), document.removeEventListener("pointerdown", this.onDocumentPointerDown, !0), document.removeEventListener("keydown", this.onDocumentKeyDown, !0), this.host.removeEventListener("focusout", this.onHostFocusOut);
82
+ }
83
+ }
84
+ export {
85
+ c as G
86
+ };