@golemui/gui-lit 1.2.1 → 1.3.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,25 @@
1
+ ## 1.3.0-rc.0 (2026-08-14)
2
+
3
+ ### 🩹 Fixes
4
+
5
+ - **gui-components:** show errors inside pickers ([#282](https://github.com/golemui/golemui/pull/282))
6
+
7
+ ### ❤️ Thank You
8
+
9
+ - Raúl Jiménez @Elecash
10
+
11
+ ## 1.2.1 (2026-08-11)
12
+
13
+ ### 🩹 Fixes
14
+
15
+ - **gui-components:** consistent arrow key navigation in widgets with pills ([#280](https://github.com/golemui/golemui/pull/280))
16
+ - avoid double registration warnings via shared safeDefine ([#278](https://github.com/golemui/golemui/pull/278))
17
+ - date time intermediate states and commit on blur ([#265](https://github.com/golemui/golemui/pull/265))
18
+
19
+ ### ❤️ Thank You
20
+
21
+ - Raúl Jiménez @Elecash
22
+
1
23
  ## 1.2.1-rc.0 (2026-08-11)
2
24
 
3
25
  ### 🩹 Fixes
@@ -1,23 +1,23 @@
1
1
  import { InputWidgetAdapter as y, formContext as F, inputContext as x } from "@golemui/lit";
2
2
  import { consume as C, provide as D } from "@lit/context";
3
- import { LitElement as L, nothing as _, html as b } from "lit";
4
- import { property as R, state as d, query as v } from "lit/decorators.js";
3
+ import { LitElement as R, nothing as p, html as f } from "lit";
4
+ import { property as L, state as d, query as $ } from "lit/decorators.js";
5
5
  import { safeDefine as k } from "@golemui/lit/internals";
6
6
  import { Subject as V, debounceTime as j } from "rxjs";
7
- import { d as S } from "./default-list-item-renderer-CuPJ9jUD.js";
7
+ import { d as P } from "./default-list-item-renderer-CuPJ9jUD.js";
8
8
  import "@golemui/gui-components/label";
9
9
  import "@golemui/gui-components/list";
10
10
  import "@golemui/gui-components/errors";
11
- var q = Object.defineProperty, l = (f, e, t, s) => {
12
- for (var i = void 0, h = f.length - 1, u; h >= 0; h--)
13
- (u = f[h]) && (i = u(e, t, i) || i);
14
- return i && q(e, t, i), i;
11
+ var S = Object.defineProperty, l = (m, e, t, s) => {
12
+ for (var i = void 0, u = m.length - 1, h; u >= 0; u--)
13
+ (h = m[u]) && (i = h(e, t, i) || i);
14
+ return i && S(e, t, i), i;
15
15
  };
16
- class a extends L {
16
+ class a extends R {
17
17
  constructor() {
18
18
  super(...arguments), this.adapter = new y(), this.debouncer = new V(), this.subscriptions = [], this._range = { start: 0, end: 10 }, this._filteredItems = [], this._listItems = [], this._focusedIndex = -1, this._isFiltering = !1, this._isListVisible = !1, this._selectedItem = void 0, this._ignoreNextFocus = !1, this.onDocumentClick = (e) => {
19
19
  if (!this._isListVisible) return;
20
- const t = e.composedPath(), s = this._inputRef && t.includes(this._inputRef), i = this._listRef && t.includes(this._listRef);
20
+ const t = e.composedPath(), s = this._inputRef && t.includes(this._inputRef), i = this._panelRef && t.includes(this._panelRef);
21
21
  !s && !i && (this._isListVisible = !1);
22
22
  };
23
23
  }
@@ -87,13 +87,13 @@ class a extends L {
87
87
  this._isFiltering = !0, this._isListVisible = !0;
88
88
  const i = t.searchFields ?? [t.labelField, t.valueField].filter(
89
89
  (r) => !!r
90
- ), h = i.length > 0, m = (t.items || []).filter((r) => {
90
+ ), u = i.length > 0, g = (t.items || []).filter((r) => {
91
91
  if (r === null || typeof r != "object")
92
92
  return r != null && r.toString().toLowerCase().includes(e.toLowerCase());
93
- const p = Object.keys(r), o = (c, g) => c || r[g].toString().toLowerCase().includes(e.toLowerCase());
94
- return h ? p.filter((c) => i.includes(c)).reduce(o, !1) : p.reduce(o, !1);
93
+ const _ = Object.keys(r), o = (c, b) => c || r[b].toString().toLowerCase().includes(e.toLowerCase());
94
+ return u ? _.filter((c) => i.includes(c)).reduce(o, !1) : _.reduce(o, !1);
95
95
  });
96
- this._filteredItems = [...m];
96
+ this._filteredItems = [...g];
97
97
  } else
98
98
  this._isFiltering = !1, this._filteredItems = [...t.items];
99
99
  }
@@ -105,6 +105,10 @@ class a extends L {
105
105
  async _onFocus() {
106
106
  this._ignoreNextFocus || (this._isListVisible = !0, await this.updateComplete, this._listRef.scrollToSelectedIndex());
107
107
  }
108
+ _onPanelMouseDown(e) {
109
+ const t = e.target;
110
+ this._listRef && this._listRef.contains(t) || e.preventDefault();
111
+ }
108
112
  _onFocusOutInput(e) {
109
113
  const t = e.relatedTarget;
110
114
  t && this.contains(t) || (this.adapter.onBlur(), this._isListVisible = !1, this._isFiltering = !1);
@@ -115,9 +119,9 @@ class a extends L {
115
119
  render() {
116
120
  const e = this.adapter.templateData, t = e.touched && e.errors && e.errors.length > 0, s = this._listItems.slice(this._range.start, this._range.end), i = this.adapter.getItemRenderer(
117
121
  e.itemRenderer,
118
- S
119
- ), u = this._selectedItem?.template !== null && typeof this._selectedItem?.template == "object" ? e.labelField ?? "label" : null, m = u ? this._selectedItem?.template[u] : this._selectedItem?.template, r = !!this.widget.on?.filter;
120
- return b`
122
+ P
123
+ ), h = this._selectedItem?.template !== null && typeof this._selectedItem?.template == "object" ? e.labelField ?? "label" : null, g = h ? this._selectedItem?.template[h] : this._selectedItem?.template, r = !!this.widget.on?.filter;
124
+ return f`
121
125
  <gui-label
122
126
  .targetElement=${[this._listRef, this._inputRef]}
123
127
  .uid=${this.widget.uid}
@@ -136,12 +140,12 @@ class a extends L {
136
140
  id=${this.widget.uid}
137
141
  data-cy=${`${this.widget.uid}_textinput`}
138
142
  class="gui-widget-input"
139
- .value=${m ?? e.value ?? ""}
143
+ .value=${g ?? e.value ?? ""}
140
144
  ?required=${e.validator?.required}
141
145
  ?disabled=${e.disabled}
142
146
  ?readonly=${e.readonly}
143
147
  placeholder=${e.placeholder ?? ""}
144
- autocomplete=${e.autocomplete || _}
148
+ autocomplete=${e.autocomplete || p}
145
149
  @keydown=${this._onKeyDown}
146
150
  @input=${this._onInput}
147
151
  @focusout=${this._onFocusOutInput}
@@ -149,8 +153,8 @@ class a extends L {
149
153
  aria-expanded=${this._isListVisible ? "true" : "false"}
150
154
  aria-controls=${`${this.widget.uid}-list`}
151
155
  aria-autocomplete="list"
152
- aria-labelledby=${e.label ? `${this.widget.uid}_label` : _}
153
- aria-describedby=${e.hint ? `${this.widget.uid}_hint` : _}
156
+ aria-labelledby=${e.label ? `${this.widget.uid}_label` : p}
157
+ aria-describedby=${e.hint ? `${this.widget.uid}_hint` : p}
154
158
  />
155
159
  <span class="gui-dropdown__arrow"
156
160
  ><svg
@@ -165,64 +169,76 @@ class a extends L {
165
169
  ></path></svg
166
170
  ></span>
167
171
 
168
- <gui-list
169
- id=${`${this.widget.uid}-list`}
170
- .uid=${this.widget.uid}
171
- .value=${e.value ?? ""}
172
- .valueField=${e.valueField}
173
- .items=${this._isFiltering && !r ? this._filteredItems : e.items}
174
- .itemHeight=${e.itemHeight}
175
- .height=${e.height}
176
- ?required=${e.validator?.required}
177
- ?touched=${e.touched}
178
- ?disabled=${e.disabled}
179
- ?readonly=${e.readonly}
172
+ <div
173
+ class="gui-picker__panel"
180
174
  ?hidden=${!this._isListVisible}
181
- @gui-range-change=${this._onRangeChange}
182
- @gui-update-items=${this._onUpdateItems}
183
- @gui-focus-change=${this._onFocusChange}
184
- @focus=${this._onFocus}
185
- @blur=${this._onBlur}
186
- @change=${this._onValueChange}
175
+ @mousedown=${this._onPanelMouseDown}
187
176
  >
188
- ${s.map((n, p) => {
189
- const o = this._range.start + p, c = e.value === n.value, g = this._focusedIndex === o, $ = !!e.disabled || !!n.disabled, I = e.labelField ?? "label", w = n.template !== null && typeof n.template == "object" && I && !e.itemRenderer ? n.template[I] : n.template;
190
- return b`
191
- <div
192
- role="option"
193
- tabindex="-1"
194
- class="gui-list__item-wrapper"
195
- id="${this.widget.uid}-item-${o}"
196
- style="height: ${e.itemHeight || 40}px"
197
- aria-selected=${c ? "true" : "false"}
198
- aria-disabled=${$ ? "true" : "false"}
199
- @click=${() => this._onClickItem(n, o)}
200
- >
201
- ${i({
177
+ <gui-list
178
+ id=${`${this.widget.uid}-list`}
179
+ .uid=${this.widget.uid}
180
+ .value=${e.value ?? ""}
181
+ .valueField=${e.valueField}
182
+ .items=${this._isFiltering && !r ? this._filteredItems : e.items}
183
+ .itemHeight=${e.itemHeight}
184
+ .height=${e.height}
185
+ ?required=${e.validator?.required}
186
+ ?touched=${e.touched}
187
+ ?disabled=${e.disabled}
188
+ ?readonly=${e.readonly}
189
+ ?hidden=${!this._isListVisible}
190
+ @gui-range-change=${this._onRangeChange}
191
+ @gui-update-items=${this._onUpdateItems}
192
+ @gui-focus-change=${this._onFocusChange}
193
+ @focus=${this._onFocus}
194
+ @blur=${this._onBlur}
195
+ @change=${this._onValueChange}
196
+ >
197
+ ${s.map((n, _) => {
198
+ const o = this._range.start + _, c = e.value === n.value, b = this._focusedIndex === o, I = !!e.disabled || !!n.disabled, v = e.labelField ?? "label", w = n.template !== null && typeof n.template == "object" && v && !e.itemRenderer ? n.template[v] : n.template;
199
+ return f`
200
+ <div
201
+ role="option"
202
+ tabindex="-1"
203
+ class="gui-list__item-wrapper"
204
+ id="${this.widget.uid}-item-${o}"
205
+ style="height: ${e.itemHeight || 40}px"
206
+ aria-selected=${c ? "true" : "false"}
207
+ aria-disabled=${I ? "true" : "false"}
208
+ @click=${() => this._onClickItem(n, o)}
209
+ >
210
+ ${i({
202
211
  template: w,
203
212
  value: n.value,
204
213
  index: o,
205
214
  selected: c,
206
- disabled: $,
207
- focused: g
215
+ disabled: I,
216
+ focused: b
208
217
  })}
209
- </div>
210
- `;
218
+ </div>
219
+ `;
211
220
  })}
212
- </gui-list>
221
+ </gui-list>
222
+ ${t ? f`<gui-errors
223
+ panel
224
+ .uid=${this.widget.uid}
225
+ .errors=${e.errors}
226
+ .touched=${e.touched}
227
+ ></gui-errors>` : p}
228
+ </div>
213
229
  </div>
214
230
 
215
- ${t ? b`<gui-errors
231
+ ${t ? f`<gui-errors
216
232
  .uid=${this.widget.uid}
217
233
  .errors=${e.errors}
218
234
  .touched=${e.touched}
219
- ></gui-errors>` : _}
235
+ ></gui-errors>` : p}
220
236
  `;
221
237
  }
222
238
  }
223
239
  l([
224
240
  C({ context: F }),
225
- R({ attribute: !1 })
241
+ L({ attribute: !1 })
226
242
  ], a.prototype, "formContext");
227
243
  l([
228
244
  D({ context: x })
@@ -249,11 +265,14 @@ l([
249
265
  d()
250
266
  ], a.prototype, "_selectedItem");
251
267
  l([
252
- v("input")
268
+ $("input")
253
269
  ], a.prototype, "_inputRef");
254
270
  l([
255
- v("gui-list")
271
+ $("gui-list")
256
272
  ], a.prototype, "_listRef");
273
+ l([
274
+ $(".gui-picker__panel")
275
+ ], a.prototype, "_panelRef");
257
276
  k("gui-dropdown-input", a);
258
277
  export {
259
278
  a as DropdownElement
package/index.js CHANGED
@@ -2257,7 +2257,7 @@ const Mo = {
2257
2257
  dateInput: async () => (await import("./date.element-BEHGxRFF.js")).DateElement,
2258
2258
  datePicker: async () => (await import("./date-picker.element-Bg3rF95F.js")).DatePickerElement,
2259
2259
  dateTimePicker: async () => (await import("./date-time-picker.element-HHpwjWTQ.js")).DateTimePickerElement,
2260
- dropdown: async () => (await import("./dropdown.element-DUqG_p1x.js")).DropdownElement,
2260
+ dropdown: async () => (await import("./dropdown.element-Dg80G2PL.js")).DropdownElement,
2261
2261
  list: async () => (await import("./list.element-ZtEMKE2x.js")).ListElement,
2262
2262
  markdown: async () => (await import("./markdown.element-DWz3U9rG.js")).MarkdownElement,
2263
2263
  password: async () => (await import("./password.element-C5vQHq5P.js")).PasswordElement,