@pienter/ui 0.19.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,30 @@
|
|
|
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
|
+
|
|
17
|
+
## 0.20.0 - 2026-09-16
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
|
|
21
|
+
- `BlockEditor` takes `hint`, `emptyText` and `addLabel(typeLabel)`, the
|
|
22
|
+
three visible strings it used to hard-code in English: the reorder hint
|
|
23
|
+
above the list, the edit-mode empty message under the `empty` slot, and the
|
|
24
|
+
add-button label built from each block type's `label`. The English defaults
|
|
25
|
+
are unchanged, so a Dutch consumer can pass `Tekst toevoegen` and a Dutch
|
|
26
|
+
hint without CSS overrides or replacing the add row. The aria-only labels
|
|
27
|
+
and announcements are still English.
|
|
28
|
+
|
|
5
29
|
## 0.19.0 - 2026-09-16
|
|
6
30
|
|
|
7
31
|
### Added
|
|
@@ -24,6 +24,12 @@ const props = withDefaults(
|
|
|
24
24
|
/** Heading level of each block title: `3` sits under a level-2 `Panel` title. */
|
|
25
25
|
level?: 2 | 3 | 4 | 5 | 6;
|
|
26
26
|
blockLabel?: (block: T, index: number) => string;
|
|
27
|
+
/** Label of each add button, given the block type's `label`. */
|
|
28
|
+
addLabel?: (typeLabel: string) => string;
|
|
29
|
+
/** Reorder hint shown above the list in edit mode. */
|
|
30
|
+
hint?: string;
|
|
31
|
+
/** Empty-list message in edit mode; the `empty` slot replaces it entirely. */
|
|
32
|
+
emptyText?: string;
|
|
27
33
|
}>(),
|
|
28
34
|
{
|
|
29
35
|
disabled: false,
|
|
@@ -32,6 +38,9 @@ const props = withDefaults(
|
|
|
32
38
|
label: 'Content blocks',
|
|
33
39
|
level: 3,
|
|
34
40
|
blockLabel: undefined,
|
|
41
|
+
addLabel: (typeLabel: string) => `Add ${typeLabel}`,
|
|
42
|
+
hint: 'Use the move buttons to reorder, or drag with a pointer.',
|
|
43
|
+
emptyText: 'No blocks yet. Add a block to start writing.',
|
|
35
44
|
},
|
|
36
45
|
);
|
|
37
46
|
|
|
@@ -317,7 +326,7 @@ onBeforeUnmount(stopDrag);
|
|
|
317
326
|
:data-readonly="readonly ? 'true' : undefined"
|
|
318
327
|
>
|
|
319
328
|
<p v-if="!readonly" :id="`${id}-hint`" class="pui-block-editor__hint">
|
|
320
|
-
|
|
329
|
+
{{ hint }}
|
|
321
330
|
</p>
|
|
322
331
|
<ol
|
|
323
332
|
v-if="modelValue.length"
|
|
@@ -448,9 +457,7 @@ onBeforeUnmount(stopDrag);
|
|
|
448
457
|
</ol>
|
|
449
458
|
<div v-else class="pui-block-editor__empty">
|
|
450
459
|
<slot name="empty">{{
|
|
451
|
-
readonly
|
|
452
|
-
? 'No content blocks.'
|
|
453
|
-
: 'No blocks yet. Add a block to start writing.'
|
|
460
|
+
readonly ? 'No content blocks.' : emptyText
|
|
454
461
|
}}</slot>
|
|
455
462
|
</div>
|
|
456
463
|
<div v-if="!readonly" :id="`${id}-add`" class="pui-block-editor__add">
|
|
@@ -461,7 +468,7 @@ onBeforeUnmount(stopDrag);
|
|
|
461
468
|
size="sm"
|
|
462
469
|
:disabled="disabled"
|
|
463
470
|
@click="add(type)"
|
|
464
|
-
>
|
|
471
|
+
>{{ addLabel(type.label) }}</Button
|
|
465
472
|
>
|
|
466
473
|
</div>
|
|
467
474
|
</div>
|
|
@@ -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(() => {
|