@pienter/ui 0.20.0 → 0.20.1

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
@@ -2,6 +2,18 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.20.1 - 2026-09-16
6
+
7
+ ### Fixed
8
+
9
+ - `Select` shows its empty option again after the model clears from a value
10
+ no option carries. A single-value `FilterSelect` fed
11
+ `filter[status]=draft,published` selected nothing, and when Clear all set
12
+ the model to `''` the control stayed blank: a `<select>` with no selection
13
+ already reads `''`, so Vue saw nothing to write. The control now syncs the
14
+ native value itself after every model change. An unknown value still
15
+ selects nothing; only the way back is fixed.
16
+
5
17
  ## 0.20.0 - 2026-09-16
6
18
 
7
19
  ### Added
@@ -18,6 +18,7 @@
18
18
  <select
19
19
  v-bind="$attrs"
20
20
  :id="inputId"
21
+ ref="controlRef"
21
22
  class="pui-select__control"
22
23
  :name="name"
23
24
  :required="required"
@@ -58,7 +59,7 @@
58
59
  </template>
59
60
 
60
61
  <script setup lang="ts">
61
- import { computed } from 'vue';
62
+ import { computed, ref, watch } from 'vue';
62
63
  import { generateId } from '../../../utils/a11y/id.js';
63
64
  import Icon from '../../display/icon/Icon.vue';
64
65
 
@@ -106,6 +107,20 @@ const inputId = props.id ?? generateId('select');
106
107
  const hintId = `${inputId}-hint`;
107
108
  const errorsId = `${inputId}-errors`;
108
109
 
110
+ const controlRef = ref<HTMLSelectElement | null>(null);
111
+
112
+ // Vue skips the write when `el.value` already reads the new value, which it does for '' while nothing is selected.
113
+ watch(
114
+ () => props.modelValue,
115
+ (value) => {
116
+ const el = controlRef.value;
117
+ if (!el) return;
118
+ const next = value ?? '';
119
+ if (el.selectedIndex === -1 || el.value !== next) el.value = next;
120
+ },
121
+ { flush: 'post' },
122
+ );
123
+
109
124
  const hasErrors = computed(() => props.errors.length > 0);
110
125
 
111
126
  const computedStatus = computed(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pienter/ui",
3
- "version": "0.20.0",
3
+ "version": "0.20.1",
4
4
  "description": "Shared Pienter UI components, styles, icons, and browser utilities.",
5
5
  "type": "module",
6
6
  "license": "MIT",