@skirbi/sugar 0.0.18 → 0.0.19

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/Changes CHANGED
@@ -1,5 +1,9 @@
1
1
  Revision history for @skirbi/sugar
2
2
 
3
+ 0.0.19 2026-04-24 18:31:29Z
4
+
5
+ * Fix nuking placeholder for select
6
+
3
7
  0.0.18 2026-04-20 06:11:32Z
4
8
 
5
9
  * Move renderGuardSelector and hasRenderedShape from with-connected-sugar to
@@ -112,9 +112,6 @@ export class HTMLElementSugarSelect extends HTMLElementSugarInput {
112
112
  searchEl?.remove();
113
113
  }
114
114
 
115
- // Placeholder option (optional).
116
- if (cfg.placeholder) this._addPlaceholder(select, cfg.placeholder);
117
-
118
115
  if (hasStatic) {
119
116
  this._setOptionsFromOptions(select, rawOptions, cfg);
120
117
  if (searchEl) this._setupLocalSearch(select, searchEl);
@@ -133,7 +130,9 @@ export class HTMLElementSugarSelect extends HTMLElementSugarInput {
133
130
  opt.value = '';
134
131
  opt.textContent = text;
135
132
  opt.disabled = true;
136
- opt.selected = true;
133
+
134
+ if (!select.value) opt.selected = true;
135
+
137
136
  select.appendChild(opt);
138
137
  }
139
138
 
@@ -141,8 +140,11 @@ export class HTMLElementSugarSelect extends HTMLElementSugarInput {
141
140
  while (select.firstChild) select.removeChild(select.firstChild);
142
141
  }
143
142
 
144
- _setOptions(select, opts) {
143
+ _setOptions(select, opts, cfg) {
145
144
  this._clearOptions(select);
145
+
146
+ if (cfg.placeholder) this._addPlaceholder(select, cfg.placeholder);
147
+
146
148
  for (const o of opts) {
147
149
  const opt = document.createElement('option');
148
150
  opt.value = o.value == null ? '' : String(o.value);
@@ -189,7 +191,7 @@ export class HTMLElementSugarSelect extends HTMLElementSugarInput {
189
191
 
190
192
  const items = Array.isArray(data) ? data : [];
191
193
  const opts = items.map((it) => this._mapItemToOption(it, cfg));
192
- this._setOptions(select, opts);
194
+ this._setOptions(select, opts, cfg);
193
195
  }
194
196
 
195
197
  _setupLocalSearch(select, searchEl) {
package/lib/index.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
  //
3
3
  // SPDX-License-Identifier: MIT
4
4
 
5
- const VERSION = "0.0.18";
5
+ const VERSION = "0.0.19";
6
6
 
7
7
  export { HTMLElementSugar } from './htmlelement.mjs';
8
8
  export { HTMLElementSugarInput } from './htmlelement-input.mjs';
@@ -1,3 +1,7 @@
1
+ // SPDX-FileCopyrightText: 2026 Wesley Schwengle <wesleys@opperschaap.net>
2
+ //
3
+ // SPDX-License-Identifier: MIT
4
+
1
5
  export const withConnectedSugar = (Base) =>
2
6
  class extends Base {
3
7
  static morphTriggerSelector = '';
package/package.json CHANGED
@@ -38,6 +38,7 @@
38
38
  ],
39
39
  "license": "MIT",
40
40
  "name": "@skirbi/sugar",
41
+ "private": false,
41
42
  "repository": {
42
43
  "type": "git",
43
44
  "url": "git+https://gitlab.com/skirbi/skirbi.git"
@@ -51,5 +52,5 @@
51
52
  },
52
53
  "sideEffects": false,
53
54
  "type": "module",
54
- "version": "0.0.18"
55
+ "version": "0.0.19"
55
56
  }