@itenthusiasm/custom-elements 1.0.1 → 1.0.2

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.
@@ -132,11 +132,19 @@ class ComboboxOption extends HTMLElement {
132
132
  if (!this.#combobox) return;
133
133
  const combobox = this.#combobox;
134
134
 
135
- if (this.selected && combobox.value !== this.value) combobox.value = this.value;
136
- else if (!this.selected && combobox.value === this.value) {
137
- if (combobox.text.data && combobox.acceptsValue(combobox.text.data)) return;
138
- if (combobox.acceptsValue("")) return combobox.forceEmptyValue();
139
- combobox.formResetCallback();
135
+ // Selection
136
+ if (this.selected) {
137
+ if (combobox.value !== this.value) combobox.value = this.value;
138
+ else if (this.value === "" && combobox.text.data !== this.label) combobox.text.data = this.label;
139
+ }
140
+ // Deslection
141
+ else {
142
+ if (combobox.value !== this.value) return;
143
+
144
+ if (combobox.text.data && combobox.acceptsValue(combobox.text.data)) {
145
+ if (combobox.value !== combobox.text.data) combobox.value = combobox.text.data;
146
+ } else if (combobox.acceptsValue("")) combobox.forceEmptyValue();
147
+ else combobox.formResetCallback();
140
148
  }
141
149
  }
142
150
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@itenthusiasm/custom-elements",
3
3
  "type": "module",
4
- "version": "1.0.1",
4
+ "version": "1.0.2",
5
5
  "sideEffects": false,
6
6
  "license": "MIT",
7
7
  "description": "Robust, accessible, and progressively-enhanceable Web Components for common developer needs",