@sebgroup/green-core 1.15.1 → 1.17.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 (124) hide show
  1. package/README.md +101 -7
  2. package/chunks/chunk.2LQSDOD4.js +29 -0
  3. package/chunks/chunk.2ND5EWHE.js +65 -0
  4. package/chunks/chunk.2OOTOCUG.js +420 -0
  5. package/chunks/chunk.2WO4NHJ2.js +34 -0
  6. package/chunks/chunk.2Y3BHFKO.js +154 -0
  7. package/chunks/chunk.375BWME4.js +29 -0
  8. package/chunks/chunk.5VURDMKE.js +75 -0
  9. package/chunks/chunk.63RKNI5K.js +244 -0
  10. package/chunks/chunk.6NM7ENKA.js +31 -0
  11. package/chunks/chunk.6UA66KQU.js +153 -0
  12. package/chunks/chunk.7TCXY7BP.js +0 -0
  13. package/chunks/chunk.AQGTMWG4.js +101 -0
  14. package/chunks/chunk.D7H7CUS4.js +55 -0
  15. package/chunks/chunk.DFYMYEGD.js +78 -0
  16. package/chunks/chunk.EUQ5DOQM.js +560 -0
  17. package/chunks/chunk.HS7ICQNA.js +0 -0
  18. package/chunks/chunk.IYCENQZG.js +28 -0
  19. package/chunks/chunk.KC32OWZE.js +274 -0
  20. package/chunks/chunk.LUHCF4BJ.js +64 -0
  21. package/chunks/chunk.MAD5DQMN.js +161 -0
  22. package/chunks/chunk.MI4A2C2A.js +0 -0
  23. package/chunks/chunk.Q2T57HE7.js +0 -0
  24. package/chunks/chunk.QONSFT2N.js +4653 -0
  25. package/chunks/chunk.TMBQL2RO.js +0 -0
  26. package/chunks/chunk.TN6ZYAH3.js +74 -0
  27. package/chunks/chunk.TSDZQZBY.js +0 -0
  28. package/chunks/chunk.TX64TTBN.js +0 -0
  29. package/chunks/chunk.U4DPJ4QU.js +96 -0
  30. package/chunks/chunk.UF6IEONX.js +0 -0
  31. package/chunks/chunk.VOYMQ322.js +61 -0
  32. package/chunks/chunk.VYK7D6QO.js +64 -0
  33. package/chunks/chunk.WDZ2JTCP.js +360 -0
  34. package/chunks/chunk.WJDR7FTS.js +193 -0
  35. package/chunks/chunk.WM7HBMMV.js +54 -0
  36. package/chunks/chunk.XD5R3ZU3.js +460 -0
  37. package/chunks/chunk.XHTJVQUJ.js +140 -0
  38. package/chunks/chunk.XI4H54TV.js +39 -0
  39. package/chunks/chunk.XMPBXAGB.js +80 -0
  40. package/chunks/chunk.XU4HZLJL.js +0 -0
  41. package/chunks/chunk.YIQIH4RW.js +139 -0
  42. package/chunks/chunk.YJHAKLGR.js +54 -0
  43. package/chunks/chunk.YO24ZYAD.js +0 -0
  44. package/chunks/chunk.ZTE73BY2.js +655 -0
  45. package/chunks/chunk.ZYQWZMVY.js +467 -0
  46. package/components/badge/badge.js +245 -0
  47. package/components/button/button.d.ts +5 -5
  48. package/components/button/button.js +18 -0
  49. package/components/button/button.trans.styles.d.ts +2 -0
  50. package/components/button/index.d.ts +1 -0
  51. package/components/button/index.js +18 -0
  52. package/components/checkbox/checkbox.js +219 -0
  53. package/components/context-menu/context-menu.d.ts +2 -1
  54. package/components/context-menu/context-menu.js +22 -0
  55. package/components/context-menu/index.d.ts +3 -0
  56. package/components/context-menu/index.js +29 -0
  57. package/components/datepicker/date-part-spinner.js +10 -0
  58. package/components/datepicker/datepicker.d.ts +3 -2
  59. package/components/datepicker/datepicker.js +29 -0
  60. package/components/datepicker/index.d.ts +1 -0
  61. package/components/datepicker/index.js +29 -0
  62. package/components/dropdown/dropdown.d.ts +2 -2
  63. package/components/dropdown/dropdown.js +22 -0
  64. package/components/dropdown/index.d.ts +3 -0
  65. package/components/dropdown/index.js +30 -0
  66. package/components/form-control.js +12 -0
  67. package/components/grid/grid.d.ts +2 -2
  68. package/components/grid/grid.js +11 -0
  69. package/components/grid/grid.style.css.js +7 -0
  70. package/components/grid/index.d.ts +1 -0
  71. package/components/grid/index.js +11 -0
  72. package/components/grouped-list/grouped-list.js +14 -0
  73. package/components/grouped-list/index.d.ts +2 -0
  74. package/components/grouped-list/index.js +17 -0
  75. package/components/grouped-list/list-item.js +10 -0
  76. package/components/icon/icon.d.ts +2 -2
  77. package/components/icon/icon.js +10 -0
  78. package/components/icon/index.d.ts +1 -0
  79. package/components/icon/index.js +10 -0
  80. package/components/index.d.ts +4 -3
  81. package/components/index.js +81 -0
  82. package/components/input/input.js +682 -0
  83. package/components/radio/radio-group.js +9 -0
  84. package/components/radio/radio.js +240 -0
  85. package/components/segmented-control/index.d.ts +1 -0
  86. package/components/segmented-control/index.js +15 -0
  87. package/components/segmented-control/segment/index.d.ts +1 -0
  88. package/components/segmented-control/segment/index.js +13 -0
  89. package/components/segmented-control/segment/segment.js +12 -0
  90. package/components/segmented-control/segmented-control.d.ts +1 -1
  91. package/components/segmented-control/segmented-control.js +15 -0
  92. package/components/switch/switch.js +164 -0
  93. package/components/theme/index.d.ts +1 -0
  94. package/components/theme/index.js +11 -0
  95. package/components/theme/theme.js +11 -0
  96. package/components/tooltip/tooltip.js +252 -0
  97. package/index.js +72 -4291
  98. package/localization.js +3 -5
  99. package/package.json +7 -16
  100. package/primitives/calendar/calendar.js +13 -0
  101. package/primitives/calendar/functions.js +7 -0
  102. package/primitives/calendar/index.d.ts +1 -0
  103. package/primitives/calendar/index.js +14 -0
  104. package/primitives/listbox/index.d.ts +0 -1
  105. package/primitives/listbox/index.js +17 -0
  106. package/primitives/listbox/listbox.d.ts +2 -1
  107. package/primitives/listbox/listbox.js +16 -0
  108. package/primitives/listbox/option.js +14 -0
  109. package/primitives/menu/index.d.ts +1 -0
  110. package/primitives/menu/index.js +15 -0
  111. package/primitives/menu/menu-heading.js +11 -0
  112. package/primitives/menu/menu-item.d.ts +1 -2
  113. package/primitives/menu/menu-item.js +12 -0
  114. package/primitives/menu/menu.d.ts +2 -1
  115. package/primitives/menu/menu.js +14 -0
  116. package/primitives/popover/index.js +14 -0
  117. package/primitives/popover/popover.js +13 -0
  118. package/primitives/ripple/index.d.ts +1 -0
  119. package/primitives/ripple/index.js +11 -0
  120. package/primitives/ripple/ripple.d.ts +1 -1
  121. package/primitives/ripple/ripple.js +10 -0
  122. package/scoping.d.ts +1 -0
  123. package/scoping.js +18 -0
  124. package/transitional-styles.js +6 -4275
@@ -0,0 +1,274 @@
1
+ import {
2
+ renderMonthGridView
3
+ } from "./chunk.375BWME4.js";
4
+ import {
5
+ TransitionalStyles
6
+ } from "./chunk.QONSFT2N.js";
7
+ import {
8
+ GdsElement
9
+ } from "./chunk.2LQSDOD4.js";
10
+ import {
11
+ watch
12
+ } from "./chunk.2WO4NHJ2.js";
13
+ import {
14
+ gdsCustomElement
15
+ } from "./chunk.VOYMQ322.js";
16
+ import {
17
+ __decorateClass,
18
+ __privateAdd,
19
+ __privateMethod
20
+ } from "./chunk.5VURDMKE.js";
21
+
22
+ // libs/core/src/primitives/calendar/calendar.ts
23
+ import { html } from "lit";
24
+ import { classMap } from "lit/directives/class-map.js";
25
+ import { when } from "lit/directives/when.js";
26
+ import { property, query, state } from "lit/decorators.js";
27
+ import { msg } from "@lit/localize";
28
+ import {
29
+ addDays,
30
+ isSameDay,
31
+ isSameMonth,
32
+ getWeek,
33
+ subMonths,
34
+ addMonths
35
+ } from "date-fns";
36
+
37
+ // libs/core/src/primitives/calendar/calendar.styles.ts
38
+ import { css } from "lit";
39
+ var style = css`
40
+ @layer base, reset, transitional-styles;
41
+ @layer base {
42
+ td.disabled {
43
+ color: #999;
44
+ cursor: default;
45
+ }
46
+ td.today {
47
+ background-color: #eee;
48
+ }
49
+ }
50
+ `;
51
+ var calendar_styles_default = style;
52
+
53
+ // libs/core/src/primitives/calendar/calendar.ts
54
+ var _setSelectedDate, setSelectedDate_fn, _handleKeyDown, handleKeyDown_fn;
55
+ var GdsCalendar = class extends GdsElement {
56
+ constructor() {
57
+ super(...arguments);
58
+ __privateAdd(this, _setSelectedDate);
59
+ __privateAdd(this, _handleKeyDown);
60
+ this.min = new Date((/* @__PURE__ */ new Date()).getFullYear() - 10, 0, 1);
61
+ this.max = new Date((/* @__PURE__ */ new Date()).getFullYear() + 10, 0, 1);
62
+ this.focusedDate = /* @__PURE__ */ new Date();
63
+ this.disabledWeekends = false;
64
+ this.showWeekNumbers = false;
65
+ }
66
+ get focusedMonth() {
67
+ return this.focusedDate.getMonth();
68
+ }
69
+ set focusedMonth(month) {
70
+ const newDate = new Date(this.focusedDate);
71
+ newDate.setMonth(month);
72
+ newDate.setHours(0, 0, 0, 0);
73
+ this.focusedDate = newDate;
74
+ }
75
+ get focusedYear() {
76
+ return this.focusedDate.getFullYear();
77
+ }
78
+ set focusedYear(year) {
79
+ this.focusedDate = new Date(this.focusedDate.setFullYear(year));
80
+ }
81
+ /**
82
+ * Returns the date cell element for the given day number.
83
+ */
84
+ getDateCell(dayNumber) {
85
+ var _a;
86
+ return (_a = this.shadowRoot) == null ? void 0 : _a.querySelector(`#dateCell-${dayNumber}`);
87
+ }
88
+ connectedCallback() {
89
+ super.connectedCallback();
90
+ TransitionalStyles.instance.apply(this, "gds-calendar");
91
+ this.addEventListener("keydown", __privateMethod(this, _handleKeyDown, handleKeyDown_fn));
92
+ }
93
+ focus() {
94
+ var _a;
95
+ super.focus();
96
+ (_a = this._elFocusedCell) == null ? void 0 : _a.focus();
97
+ }
98
+ render() {
99
+ const currentDate = /* @__PURE__ */ new Date();
100
+ return html`${this._tStyles}
101
+ <table>
102
+ <thead>
103
+ <tr>
104
+ ${when(this.showWeekNumbers, () => html`<th></th>`)}
105
+ <th>${msg("Mon")}</th>
106
+ <th>${msg("Tue")}</th>
107
+ <th>${msg("Wed")}</th>
108
+ <th>${msg("Thu")}</th>
109
+ <th>${msg("Fri")}</th>
110
+ <th>${msg("Sat")}</th>
111
+ <th>${msg("Sun")}</th>
112
+ </tr>
113
+ </thead>
114
+ <tbody>
115
+ ${renderMonthGridView(
116
+ this.focusedDate,
117
+ (weeks) => html`
118
+ ${weeks.map(
119
+ (week) => html`
120
+ <tr>
121
+ ${when(
122
+ this.showWeekNumbers,
123
+ () => html`<td class="week-number">
124
+ ${getWeek(week.days[0])}
125
+ </td>`
126
+ )}
127
+ ${week.days.map((day) => {
128
+ const isOutsideCurrentMonth = !isSameMonth(this.focusedDate, day) || day < this.min || day > this.max;
129
+ const isWeekend = day.getDay() === 0 || day.getDay() === 6;
130
+ const isDisabled = isOutsideCurrentMonth || this.disabledWeekends && isWeekend || this.disabledDates && this.disabledDates.some((d) => isSameDay(d, day));
131
+ return html`
132
+ <td
133
+ class="${classMap({
134
+ disabled: Boolean(isDisabled),
135
+ today: isSameDay(currentDate, day)
136
+ })}"
137
+ ?disabled=${isDisabled}
138
+ tabindex="${isSameDay(this.focusedDate, day) ? 0 : -1}"
139
+ aria-selected="${this.value && isSameDay(this.value, day)}"
140
+ aria-label="${day.toDateString()}"
141
+ @click=${() => isDisabled ? null : __privateMethod(this, _setSelectedDate, setSelectedDate_fn).call(this, day)}
142
+ id="dateCell-${day.getDate()}"
143
+ >
144
+ ${day.getDate()}
145
+ </td>
146
+ `;
147
+ })}
148
+ </tr>
149
+ `
150
+ )}
151
+ `
152
+ )}
153
+ </tbody>
154
+ </table>`;
155
+ }
156
+ _valueChanged() {
157
+ if (!this.value)
158
+ return;
159
+ this.focusedDate = this.value;
160
+ }
161
+ };
162
+ _setSelectedDate = new WeakSet();
163
+ setSelectedDate_fn = function(date) {
164
+ this.value = date;
165
+ this.dispatchEvent(
166
+ new CustomEvent("change", {
167
+ detail: date,
168
+ bubbles: false,
169
+ composed: false
170
+ })
171
+ );
172
+ };
173
+ _handleKeyDown = new WeakSet();
174
+ handleKeyDown_fn = function(e) {
175
+ var _a;
176
+ let handled = false;
177
+ let newFocusedDate = new Date(this.focusedDate);
178
+ if (e.key === "ArrowLeft") {
179
+ newFocusedDate = addDays(this.focusedDate, -1);
180
+ handled = true;
181
+ } else if (e.key === "ArrowRight") {
182
+ newFocusedDate = addDays(this.focusedDate, 1);
183
+ handled = true;
184
+ } else if (e.key === "ArrowUp") {
185
+ newFocusedDate = addDays(this.focusedDate, -7);
186
+ handled = true;
187
+ } else if (e.key === "ArrowDown") {
188
+ newFocusedDate = addDays(this.focusedDate, 7);
189
+ handled = true;
190
+ } else if (e.key === "Enter" || e.key === " ") {
191
+ if (!((_a = this._elFocusedCell) == null ? void 0 : _a.hasAttribute("disabled"))) {
192
+ __privateMethod(this, _setSelectedDate, setSelectedDate_fn).call(this, this.focusedDate);
193
+ }
194
+ handled = true;
195
+ } else if (e.key === "Home") {
196
+ newFocusedDate = new Date(this.focusedYear, this.focusedMonth, 1);
197
+ handled = true;
198
+ } else if (e.key === "End") {
199
+ newFocusedDate = new Date(this.focusedYear, this.focusedMonth + 1, 0);
200
+ handled = true;
201
+ } else if (e.key === "PageUp") {
202
+ newFocusedDate = subMonths(this.focusedDate, 1);
203
+ handled = true;
204
+ } else if (e.key === "PageDown") {
205
+ newFocusedDate = addMonths(this.focusedDate, 1);
206
+ handled = true;
207
+ }
208
+ if (newFocusedDate.getFullYear() >= this.min.getFullYear() && newFocusedDate.getFullYear() <= this.max.getFullYear()) {
209
+ this.focusedDate = newFocusedDate;
210
+ }
211
+ if (handled) {
212
+ e.preventDefault();
213
+ e.stopPropagation();
214
+ this.updateComplete.then(() => {
215
+ var _a2;
216
+ (_a2 = this._elFocusedCell) == null ? void 0 : _a2.focus();
217
+ this.dispatchEvent(
218
+ new CustomEvent("gds-date-focused", {
219
+ detail: this.focusedDate,
220
+ bubbles: false,
221
+ composed: false
222
+ })
223
+ );
224
+ });
225
+ }
226
+ };
227
+ GdsCalendar.styles = [calendar_styles_default];
228
+ GdsCalendar.shadowRootOptions = {
229
+ mode: "open",
230
+ delegatesFocus: true
231
+ };
232
+ __decorateClass([
233
+ property()
234
+ ], GdsCalendar.prototype, "value", 2);
235
+ __decorateClass([
236
+ property({ type: Date })
237
+ ], GdsCalendar.prototype, "min", 2);
238
+ __decorateClass([
239
+ property({ type: Date })
240
+ ], GdsCalendar.prototype, "max", 2);
241
+ __decorateClass([
242
+ property()
243
+ ], GdsCalendar.prototype, "focusedDate", 2);
244
+ __decorateClass([
245
+ property({ type: Boolean, attribute: "disabled-weekends" })
246
+ ], GdsCalendar.prototype, "disabledWeekends", 2);
247
+ __decorateClass([
248
+ property({ type: Array, attribute: "disabled-dates" })
249
+ ], GdsCalendar.prototype, "disabledDates", 2);
250
+ __decorateClass([
251
+ property({ type: Number })
252
+ ], GdsCalendar.prototype, "focusedMonth", 1);
253
+ __decorateClass([
254
+ property({ type: Number })
255
+ ], GdsCalendar.prototype, "focusedYear", 1);
256
+ __decorateClass([
257
+ property({ type: Boolean })
258
+ ], GdsCalendar.prototype, "showWeekNumbers", 2);
259
+ __decorateClass([
260
+ query('td[tabindex="0"]')
261
+ ], GdsCalendar.prototype, "_elFocusedCell", 2);
262
+ __decorateClass([
263
+ state()
264
+ ], GdsCalendar.prototype, "_tStyles", 2);
265
+ __decorateClass([
266
+ watch("value")
267
+ ], GdsCalendar.prototype, "_valueChanged", 1);
268
+ GdsCalendar = __decorateClass([
269
+ gdsCustomElement("gds-calendar")
270
+ ], GdsCalendar);
271
+
272
+ export {
273
+ GdsCalendar
274
+ };
@@ -0,0 +1,64 @@
1
+ import {
2
+ ListboxKbNavController,
3
+ unwrap
4
+ } from "./chunk.DFYMYEGD.js";
5
+ import {
6
+ TransitionalStyles
7
+ } from "./chunk.QONSFT2N.js";
8
+ import {
9
+ GdsElement
10
+ } from "./chunk.2LQSDOD4.js";
11
+ import {
12
+ gdsCustomElement,
13
+ html
14
+ } from "./chunk.VOYMQ322.js";
15
+ import {
16
+ __decorateClass,
17
+ __privateAdd,
18
+ __privateGet
19
+ } from "./chunk.5VURDMKE.js";
20
+
21
+ // libs/core/src/primitives/menu/menu.ts
22
+ import { createRef, ref } from "lit/directives/ref.js";
23
+ import { state } from "lit/decorators.js";
24
+ var _slotRef;
25
+ var GdsMenu = class extends GdsElement {
26
+ constructor() {
27
+ super();
28
+ __privateAdd(this, _slotRef, createRef());
29
+ new ListboxKbNavController(this);
30
+ }
31
+ connectedCallback() {
32
+ super.connectedCallback();
33
+ this.setAttribute("role", "menu");
34
+ TransitionalStyles.instance.apply(this, "gds-listbox");
35
+ }
36
+ get navigableItems() {
37
+ if (!__privateGet(this, _slotRef).value)
38
+ return [];
39
+ return unwrap(__privateGet(this, _slotRef).value).assignedElements().filter(
40
+ (o) => !o.hasAttribute("isplaceholder") && o.gdsElementName === "gds-menu-item"
41
+ ) || [];
42
+ }
43
+ /**
44
+ * Focuses the first item in the menu.
45
+ */
46
+ focus() {
47
+ var _a;
48
+ (_a = this.navigableItems[0]) == null ? void 0 : _a.focus();
49
+ }
50
+ render() {
51
+ return html`${this._tStyles}<slot ${ref(__privateGet(this, _slotRef))}></slot>`;
52
+ }
53
+ };
54
+ _slotRef = new WeakMap();
55
+ __decorateClass([
56
+ state()
57
+ ], GdsMenu.prototype, "_tStyles", 2);
58
+ GdsMenu = __decorateClass([
59
+ gdsCustomElement("gds-menu")
60
+ ], GdsMenu);
61
+
62
+ export {
63
+ GdsMenu
64
+ };
@@ -0,0 +1,161 @@
1
+ import {
2
+ ListboxKbNavController,
3
+ unwrap
4
+ } from "./chunk.DFYMYEGD.js";
5
+ import {
6
+ TransitionalStyles
7
+ } from "./chunk.QONSFT2N.js";
8
+ import {
9
+ GdsElement
10
+ } from "./chunk.2LQSDOD4.js";
11
+ import {
12
+ watch
13
+ } from "./chunk.2WO4NHJ2.js";
14
+ import {
15
+ gdsCustomElement,
16
+ html
17
+ } from "./chunk.VOYMQ322.js";
18
+ import {
19
+ __decorateClass,
20
+ __privateAdd,
21
+ __privateGet
22
+ } from "./chunk.5VURDMKE.js";
23
+
24
+ // libs/core/src/primitives/listbox/listbox.ts
25
+ import { property, state } from "lit/decorators.js";
26
+ import { createRef, ref } from "lit/directives/ref.js";
27
+ import "reflect-metadata";
28
+
29
+ // libs/core/src/primitives/listbox/listbox.styles.ts
30
+ import { css } from "lit";
31
+ var style = css`
32
+ @layer base, reset, transitional-styles;
33
+ @layer base {
34
+ :host {
35
+ display: flex;
36
+ flex-direction: column;
37
+ }
38
+ }
39
+ `;
40
+ var listbox_styles_default = style;
41
+
42
+ // libs/core/src/primitives/listbox/listbox.ts
43
+ var _slotRef, _handleSelect;
44
+ var GdsListbox = class extends GdsElement {
45
+ constructor() {
46
+ super();
47
+ this.multiple = false;
48
+ this.compareWith = (a, b) => a === b;
49
+ __privateAdd(this, _slotRef, createRef());
50
+ __privateAdd(this, _handleSelect, (e) => {
51
+ const option = e.target;
52
+ if (this.multiple)
53
+ option.selected = !option.selected;
54
+ else {
55
+ option.selected = true;
56
+ Array.from(this.options).forEach((el) => {
57
+ if (el !== option)
58
+ el.selected = false;
59
+ });
60
+ }
61
+ ;
62
+ this.ariaActiveDescendantElement = option;
63
+ this.dispatchEvent(
64
+ new CustomEvent("change", {
65
+ bubbles: false,
66
+ composed: false
67
+ })
68
+ );
69
+ });
70
+ new ListboxKbNavController(this);
71
+ }
72
+ get navigableItems() {
73
+ return this.visibleOptionElements;
74
+ }
75
+ /**
76
+ * Returns a list of all `gds-option` elements in the listbox.
77
+ */
78
+ get options() {
79
+ if (!__privateGet(this, _slotRef).value)
80
+ return [];
81
+ return unwrap(__privateGet(this, _slotRef).value).assignedElements().filter(
82
+ (o) => !o.hasAttribute("isplaceholder") && o.gdsElementName === "gds-option"
83
+ ) || [];
84
+ }
85
+ /**
86
+ * Returns a list of all visible `gds-option` elements in the listbox.
87
+ */
88
+ get visibleOptionElements() {
89
+ return this.options.filter((el) => !el.hidden);
90
+ }
91
+ /**
92
+ * Returns a list of all visible `gds-option` elements in the listbox.
93
+ */
94
+ get visibleSelectedOptionElements() {
95
+ return this.options.filter((el) => el.selected && !el.hidden);
96
+ }
97
+ /**
98
+ * Returns a list of all selected `gds-option` elements in the listbox.
99
+ */
100
+ get selection() {
101
+ return this.options.filter((el) => el.selected);
102
+ }
103
+ set selection(values) {
104
+ this.options.forEach((el) => {
105
+ el.selected = values.some((v) => this.compareWith(v, el.value));
106
+ });
107
+ }
108
+ connectedCallback() {
109
+ super.connectedCallback();
110
+ this.setAttribute("role", "listbox");
111
+ TransitionalStyles.instance.apply(this, "gds-listbox");
112
+ this.addEventListener("gds-select", __privateGet(this, _handleSelect));
113
+ }
114
+ /**
115
+ * Focuses the first selected option in the listbox.
116
+ * If no option is selected, the first visible option is focused.
117
+ */
118
+ focus() {
119
+ var _a;
120
+ ;
121
+ (_a = this.visibleSelectedOptionElements[0] || this.visibleOptionElements[0]) == null ? void 0 : _a.focus();
122
+ }
123
+ render() {
124
+ return html`${this._tStyles}<slot ${ref(__privateGet(this, _slotRef))}></slot>`;
125
+ }
126
+ _rerenderOptions() {
127
+ this.options.forEach((el) => {
128
+ el.requestUpdate();
129
+ });
130
+ }
131
+ };
132
+ _slotRef = new WeakMap();
133
+ _handleSelect = new WeakMap();
134
+ GdsListbox.styles = listbox_styles_default;
135
+ __decorateClass([
136
+ property({
137
+ type: Boolean,
138
+ reflect: true,
139
+ attribute: "aria-multiselectable",
140
+ converter: {
141
+ fromAttribute: Boolean,
142
+ toAttribute: (value) => value.toString()
143
+ }
144
+ })
145
+ ], GdsListbox.prototype, "multiple", 2);
146
+ __decorateClass([
147
+ property()
148
+ ], GdsListbox.prototype, "compareWith", 2);
149
+ __decorateClass([
150
+ state()
151
+ ], GdsListbox.prototype, "_tStyles", 2);
152
+ __decorateClass([
153
+ watch("multiple")
154
+ ], GdsListbox.prototype, "_rerenderOptions", 1);
155
+ GdsListbox = __decorateClass([
156
+ gdsCustomElement("gds-listbox")
157
+ ], GdsListbox);
158
+
159
+ export {
160
+ GdsListbox
161
+ };
File without changes
File without changes