@skirbi/sugar 0.0.18 → 0.0.20

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,13 @@
1
1
  Revision history for @skirbi/sugar
2
2
 
3
+ 0.0.20 2026-04-24 18:34:26Z
4
+
5
+ * And do not disable it
6
+
7
+ 0.0.19 2026-04-24 18:31:29Z
8
+
9
+ * Fix nuking placeholder for select
10
+
3
11
  0.0.18 2026-04-20 06:11:32Z
4
12
 
5
13
  * 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);
@@ -132,8 +129,9 @@ export class HTMLElementSugarSelect extends HTMLElementSugarInput {
132
129
  const opt = document.createElement('option');
133
130
  opt.value = '';
134
131
  opt.textContent = text;
135
- opt.disabled = true;
136
- opt.selected = true;
132
+
133
+ if (!select.value) opt.selected = true;
134
+
137
135
  select.appendChild(opt);
138
136
  }
139
137
 
@@ -141,8 +139,11 @@ export class HTMLElementSugarSelect extends HTMLElementSugarInput {
141
139
  while (select.firstChild) select.removeChild(select.firstChild);
142
140
  }
143
141
 
144
- _setOptions(select, opts) {
142
+ _setOptions(select, opts, cfg) {
145
143
  this._clearOptions(select);
144
+
145
+ if (cfg.placeholder) this._addPlaceholder(select, cfg.placeholder);
146
+
146
147
  for (const o of opts) {
147
148
  const opt = document.createElement('option');
148
149
  opt.value = o.value == null ? '' : String(o.value);
@@ -189,7 +190,7 @@ export class HTMLElementSugarSelect extends HTMLElementSugarInput {
189
190
 
190
191
  const items = Array.isArray(data) ? data : [];
191
192
  const opts = items.map((it) => this._mapItemToOption(it, cfg));
192
- this._setOptions(select, opts);
193
+ this._setOptions(select, opts, cfg);
193
194
  }
194
195
 
195
196
  _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.20";
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.20"
55
56
  }