@eldrajs/ui 0.3.6 → 0.3.7
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 +6 -0
- package/README.md +153 -16
- package/dist/{VariantPicker-BB-2Cj32.js → VariantPicker-Cr_AkX47.js} +113 -43
- package/dist/componentNames.d.ts +1 -1
- package/dist/components/badge/StockBadge.vue.d.ts +1 -1
- package/dist/components/chip/Chip.vue.d.ts +2 -0
- package/dist/components/dialog/Dialog.vue.d.ts +2 -0
- package/dist/components/drawer/Drawer.vue.d.ts +2 -0
- package/dist/components/filter-panel/FilterGroup.vue.d.ts +2 -0
- package/dist/components/filter-panel/FilterPanel.vue.d.ts +2 -0
- package/dist/components/filter-panel/facets/ColourFacet.vue.d.ts +2 -0
- package/dist/components/filter-panel/facets/ListFacet.vue.d.ts +2 -0
- package/dist/components/filter-panel/facets/RangeFacet.vue.d.ts +2 -0
- package/dist/components/filter-panel/facets/SizeFacet.vue.d.ts +2 -0
- package/dist/components/filter-panel/facets/ToggleFacet.vue.d.ts +2 -0
- package/dist/components/lightbox/Lightbox.vue.d.ts +2 -0
- package/dist/components/nav-menu/NavMenu.vue.d.ts +2 -0
- package/dist/components/notice/Notice.vue.d.ts +28 -0
- package/dist/components/notice/types.d.ts +38 -0
- package/dist/components/pagination/Pagination.vue.d.ts +2 -0
- package/dist/components/price/Price.vue.d.ts +1 -1
- package/dist/components/product-card/ProductCard.vue.d.ts +1 -1
- package/dist/components/radio/RadioGroup.vue.d.ts +4 -0
- package/dist/components/radio/recipes.d.ts +4 -2
- package/dist/components/radio/types.d.ts +8 -1
- package/dist/components/range-slider/RangeSlider.vue.d.ts +2 -0
- package/dist/components/search-bar/SearchBar.vue.d.ts +2 -0
- package/dist/components/search-modal/SearchModal.vue.d.ts +2 -0
- package/dist/components/select/MultiSelect.vue.d.ts +2 -0
- package/dist/components/select/Select.vue.d.ts +2 -0
- package/dist/components/site-form/SiteForm.vue.d.ts +2 -0
- package/dist/components/spinner/Spinner.vue.d.ts +4 -1
- package/dist/components/spinner/types.d.ts +9 -0
- package/dist/components/step-indicator/StepIndicator.vue.d.ts +7 -0
- package/dist/components/step-indicator/types.d.ts +30 -0
- package/dist/components/toast/Toast.vue.d.ts +2 -0
- package/dist/components/toast/Toaster.vue.d.ts +2 -0
- package/dist/components.css +89 -0
- package/dist/icons/paths.d.ts +8 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +620 -302
- package/dist/messages/en-US.d.ts +8 -0
- package/dist/messages/is-IS.js +3 -1
- package/dist/resolver.js +3 -0
- package/dist/style.css +89 -0
- package/dist/{useMessages-B5nzZghs.js → useMessages-DOHGfip_.js} +9 -1
- package/dist/vee-validate/FieldCheckbox.vue.d.ts +5 -1
- package/dist/vee-validate/FieldCheckboxGroup.vue.d.ts +5 -1
- package/dist/vee-validate/FieldCurrencyInput.vue.d.ts +5 -1
- package/dist/vee-validate/FieldInput.vue.d.ts +5 -1
- package/dist/vee-validate/FieldMultiSelect.vue.d.ts +5 -1
- package/dist/vee-validate/FieldQuantityStepper.vue.d.ts +5 -1
- package/dist/vee-validate/FieldRadioGroup.vue.d.ts +5 -1
- package/dist/vee-validate/FieldSearchBar.vue.d.ts +5 -1
- package/dist/vee-validate/FieldSelect.vue.d.ts +5 -1
- package/dist/vee-validate/FieldSwitch.vue.d.ts +5 -1
- package/dist/vee-validate/FieldTextarea.vue.d.ts +5 -1
- package/dist/vee-validate/FieldUnitInput.vue.d.ts +5 -1
- package/dist/vee-validate/FieldVariantPicker.vue.d.ts +5 -1
- package/dist/vee-validate/context.d.ts +32 -7
- package/dist/vee-validate/index.d.ts +8 -5
- package/dist/vee-validate/types.d.ts +26 -0
- package/dist/vee-validate/useFieldControl.d.ts +59 -10
- package/dist/vee-validate.js +258 -74
- package/dist/vue-i18n.js +1 -1
- package/package.json +2 -2
package/dist/vee-validate.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as focusInvalid, L as CurrencyInput_default, N as Input_default, R as UnitInput_default, _t as FIELD_KEY, b as MultiSelect_default, ft as CheckboxGroup_default, i as SearchBar_default, j as Switch_default, jt as useUiId, k as FormLayout_default, kt as useEldraScope, l as RadioGroup_default, n as Textarea_default, pt as Checkbox_default, r as Select_default, t as VariantPicker_default, y as QuantityStepper_default } from "./VariantPicker-
|
|
2
|
-
import { r as useMessages } from "./useMessages-
|
|
3
|
-
import { Fragment, computed, createBlock, createElementBlock, createElementVNode, createSlots, createTextVNode, defineComponent, guardReactiveProps, inject, isRef, mergeProps, nextTick, normalizeClass, normalizeProps, onMounted, onScopeDispose, openBlock, provide, ref, renderList, renderSlot, toDisplayString, unref, watch, withCtx } from "vue";
|
|
1
|
+
import { A as focusInvalid, L as CurrencyInput_default, N as Input_default, R as UnitInput_default, _t as FIELD_KEY, b as MultiSelect_default, ft as CheckboxGroup_default, i as SearchBar_default, j as Switch_default, jt as useUiId, k as FormLayout_default, kt as useEldraScope, l as RadioGroup_default, n as Textarea_default, pt as Checkbox_default, r as Select_default, t as VariantPicker_default, y as QuantityStepper_default } from "./VariantPicker-Cr_AkX47.js";
|
|
2
|
+
import { r as useMessages } from "./useMessages-DOHGfip_.js";
|
|
3
|
+
import { Fragment, computed, createBlock, createElementBlock, createElementVNode, createSlots, createTextVNode, defineComponent, guardReactiveProps, inject, isRef, mergeDefaults, mergeProps, nextTick, normalizeClass, normalizeProps, onMounted, onScopeDispose, openBlock, provide, ref, renderList, renderSlot, shallowRef, toDisplayString, unref, watch, withCtx } from "vue";
|
|
4
4
|
import { FormContextKey, useField, useForm } from "vee-validate";
|
|
5
5
|
// src/vee-validate/context.ts
|
|
6
6
|
/**
|
|
@@ -14,13 +14,13 @@ import { FormContextKey, useField, useForm } from "vee-validate";
|
|
|
14
14
|
* true as soon as the customer edits it, and nothing else would reliably clear it (a rule that
|
|
15
15
|
* already passes has no new message to overwrite it with).
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* `validationSchema`,
|
|
21
|
-
* (`validated-only`), and a field that now passes has its manually
|
|
22
|
-
*
|
|
23
|
-
* than treating one as sticky
|
|
17
|
+
* A server error on a *different* field stays on screen while this one is edited: each `Field*`
|
|
18
|
+
* holds the message it shows and changes it only at its own moments (its blur, a submit, its own
|
|
19
|
+
* edit of a server error — see `useFieldControl`). Underneath, vee-validate may already have
|
|
20
|
+
* dropped it: with a form-level `validationSchema`, validating one field revalidates every field
|
|
21
|
+
* that has been validated before (`validated-only`), and a field that now passes has its manually
|
|
22
|
+
* set error replaced by that pass. So the entry is gone for good at that field's next blur or the
|
|
23
|
+
* next submit; send the current map with each response rather than treating one as sticky.
|
|
24
24
|
*
|
|
25
25
|
* It is a plain `Ref`, so a consumer can provide one itself and drive server errors from outside a
|
|
26
26
|
* `Form`:
|
|
@@ -33,27 +33,83 @@ import { FormContextKey, useField, useForm } from "vee-validate";
|
|
|
33
33
|
var API_ERRORS_KEY = Symbol("eldra-ui:api-errors");
|
|
34
34
|
/** The key a `Form` provides its {@link FieldAnchorRegistry} on. Internal to this entry. */
|
|
35
35
|
var FIELD_ANCHORS_KEY = Symbol("eldra-ui:field-anchors");
|
|
36
|
+
/** The key a `Form` provides its {@link FieldMessageRegistry} on. Internal to this entry. */
|
|
37
|
+
var FIELD_MESSAGES_KEY = Symbol("eldra-ui:field-messages");
|
|
36
38
|
// src/vee-validate/useFieldControl.ts
|
|
39
|
+
/** The three props that decide when a field validates. Never forwarded to the wrapped control. */
|
|
40
|
+
var FIELD_VALIDATION_PROPS = [
|
|
41
|
+
"validateOnMount",
|
|
42
|
+
"validateOnBlur",
|
|
43
|
+
"validateOnValueUpdate"
|
|
44
|
+
];
|
|
45
|
+
/**
|
|
46
|
+
* Their defaults for a **typed** control — `FieldInput`, `FieldTextarea`, `FieldCurrencyInput`,
|
|
47
|
+
* `FieldUnitInput`, `FieldSearchBar` — handed to `withDefaults(defineProps<…>(), …)`. A value
|
|
48
|
+
* there is built up one keystroke at a time, so validating each change would judge a half-typed
|
|
49
|
+
* value; the field validates when it is left instead.
|
|
50
|
+
*
|
|
51
|
+
* They have to be real defaults: Vue casts an absent boolean prop to `false`, never `undefined`,
|
|
52
|
+
* so without one `validateOnBlur` could not default to `true`.
|
|
53
|
+
*/
|
|
54
|
+
var FIELD_VALIDATION_DEFAULTS = {
|
|
55
|
+
validateOnMount: false,
|
|
56
|
+
validateOnBlur: true,
|
|
57
|
+
validateOnValueUpdate: false
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Their defaults for a **choice** control — `FieldCheckbox`, `FieldCheckboxGroup`,
|
|
61
|
+
* `FieldRadioGroup`, `FieldSwitch`, `FieldSelect`, `FieldMultiSelect`, `FieldVariantPicker`,
|
|
62
|
+
* `FieldQuantityStepper`. One click or selection is the whole value there — there is no typing in
|
|
63
|
+
* between, and often no blur afterwards — so a box that only validated on blur would go on saying
|
|
64
|
+
* "required" after it had been ticked. These validate on each change as well as on blur.
|
|
65
|
+
*
|
|
66
|
+
* `FieldQuantityStepper` belongs here although it has a text field: a `QuantityStepper` writes its
|
|
67
|
+
* value only when a typed number is committed (on blur or `Enter`) or a button is pressed, never
|
|
68
|
+
* per keystroke, so every change it reports is a complete quantity.
|
|
69
|
+
*/
|
|
70
|
+
var FIELD_CHOICE_VALIDATION_DEFAULTS = {
|
|
71
|
+
validateOnMount: false,
|
|
72
|
+
validateOnBlur: true,
|
|
73
|
+
validateOnValueUpdate: true
|
|
74
|
+
};
|
|
37
75
|
/** The props a `Field*` keeps for itself and never forwards to the component it wraps. */
|
|
38
76
|
var FIELD_ONLY = [
|
|
39
77
|
"path",
|
|
40
78
|
"rules",
|
|
41
79
|
"label",
|
|
42
|
-
"id"
|
|
80
|
+
"id",
|
|
81
|
+
...FIELD_VALIDATION_PROPS
|
|
43
82
|
];
|
|
44
83
|
/**
|
|
45
84
|
* The whole of what a `Field*` does, minus the one component it renders.
|
|
46
85
|
*
|
|
47
86
|
* Each `Field*` is a thin SFC over this: `useField(name, rules, { label })` for the value and the
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
87
|
+
* validation, the message the field **shows**, the `id` the form's error summary links to, and the
|
|
88
|
+
* server error that stops being true as soon as the value changes. Keeping it here is what makes
|
|
89
|
+
* the thirteen components agree on all of that rather than thirteen files drifting apart.
|
|
90
|
+
*
|
|
91
|
+
* **When a field validates, and when its message changes.** The spec's rule (Form layout →
|
|
92
|
+
* Behaviour & motion) is "Validate on submit, then on blur for fields that were invalid after the
|
|
93
|
+
* first submit"; three props per field say which moments apply, and the message on screen changes
|
|
94
|
+
* at those moments and at no other:
|
|
95
|
+
*
|
|
96
|
+
* - **submit**, always: the form validates every field, and each one then shows its result;
|
|
97
|
+
* - **blur**, unless `validateOnBlur` is `false` (default `true`): the field is validated and
|
|
98
|
+
* shows its result. A blur always marks the field touched;
|
|
99
|
+
* - **a value change**, only with `validateOnValueUpdate`: the message follows every change once
|
|
100
|
+
* the field has been touched or the form submitted. Default `false` for a typed control, `true`
|
|
101
|
+
* for a choice control (see the two defaults objects above);
|
|
102
|
+
* - **mount**, only with `validateOnMount` (default `false`): validated and shown at once.
|
|
52
103
|
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
104
|
+
* So in a typed control, typing changes nothing the customer sees: no message appears, and one
|
|
105
|
+
* already showing stays until the next blur or submit. A choice control answers a click at once.
|
|
106
|
+
*
|
|
107
|
+
* **Why the shown message is held here** rather than read from vee-validate's `errorMessage`. That
|
|
108
|
+
* value can move at moments that are not this field's: with a `validationSchema` on the form,
|
|
109
|
+
* validating one field revalidates every field already validated (`validated-only`), so another
|
|
110
|
+
* field's blur would otherwise clear or change this field's message while it is being typed in.
|
|
111
|
+
* `shown` is a copy taken only at the moments listed above, which is what makes the props true in
|
|
112
|
+
* both setups, per-field `rules` and a form-level schema alike.
|
|
57
113
|
*/
|
|
58
114
|
function useFieldControl(props, options) {
|
|
59
115
|
/**
|
|
@@ -63,9 +119,15 @@ function useFieldControl(props, options) {
|
|
|
63
119
|
*/
|
|
64
120
|
const path = computed(() => props.path ?? props.name);
|
|
65
121
|
const rules = computed(() => props.rules);
|
|
66
|
-
|
|
122
|
+
/**
|
|
123
|
+
* `validateOnValueUpdate` is vee-validate's own option and is read once, here. `validateOnMount`
|
|
124
|
+
* is not handed over: the mount-time validation is run below instead, so its result can be shown
|
|
125
|
+
* when it settles (vee-validate's own run reports to nobody).
|
|
126
|
+
*/
|
|
127
|
+
const { value, errorMessage, handleBlur, meta, validate } = useField(path, rules, {
|
|
67
128
|
label: () => props.label,
|
|
68
|
-
initialValue: options.initialValue
|
|
129
|
+
initialValue: options.initialValue,
|
|
130
|
+
validateOnValueUpdate: props.validateOnValueUpdate === true
|
|
69
131
|
});
|
|
70
132
|
const model = computed({
|
|
71
133
|
get: () => value.value ?? options.empty,
|
|
@@ -81,12 +143,58 @@ function useFieldControl(props, options) {
|
|
|
81
143
|
const submitted = computed(() => (form?.submitCount.value ?? 0) > 0);
|
|
82
144
|
const apiErrors = inject(API_ERRORS_KEY, null);
|
|
83
145
|
const hasApiError = computed(() => apiErrors !== null && apiErrors.value[path.value] !== void 0);
|
|
146
|
+
/** The message on screen. See the doc comment above for the only moments it changes. */
|
|
147
|
+
const shown = shallowRef(void 0);
|
|
148
|
+
const messages = inject(FIELD_MESSAGES_KEY, null);
|
|
149
|
+
function show(message) {
|
|
150
|
+
shown.value = message;
|
|
151
|
+
messages?.report(path.value, message);
|
|
152
|
+
}
|
|
153
|
+
/** Take the field's current validation result as the message to show. */
|
|
154
|
+
function reveal() {
|
|
155
|
+
show(errorMessage.value);
|
|
156
|
+
}
|
|
157
|
+
/** Whether a live (`validateOnValueUpdate`) field has earned a message yet. */
|
|
158
|
+
const earned = computed(() => meta.touched || submitted.value);
|
|
159
|
+
watch([
|
|
160
|
+
errorMessage,
|
|
161
|
+
earned,
|
|
162
|
+
hasApiError
|
|
163
|
+
], ([message, isEarned, isApi], [, , wasApi]) => {
|
|
164
|
+
/**
|
|
165
|
+
* A server error is never held back: it is the answer to a submit the customer has already
|
|
166
|
+
* made, so there is nothing left to wait for — which also covers a form rendered with errors
|
|
167
|
+
* from a round trip that happened before this page existed.
|
|
168
|
+
*/
|
|
169
|
+
if (isApi) {
|
|
170
|
+
show(message);
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
/** The server error went (the field was edited, or a new response left it out). */
|
|
174
|
+
if (wasApi) {
|
|
175
|
+
show(props.validateOnValueUpdate && isEarned ? message : void 0);
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
if (props.validateOnValueUpdate && isEarned) {
|
|
179
|
+
show(message);
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
/** A reset form: nothing touched, nothing submitted, nothing wrong — so nothing to show. */
|
|
183
|
+
if (message === void 0 && !isEarned && !props.validateOnMount) show(void 0);
|
|
184
|
+
});
|
|
84
185
|
/**
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
186
|
+
* Submit. Inside a `Form` the form says when its validation has finished (`settled`). Inside
|
|
187
|
+
* another vee-validate form there is no such signal, so the field validates itself when
|
|
188
|
+
* `submitCount` rises and shows that result.
|
|
88
189
|
*/
|
|
89
|
-
|
|
190
|
+
if (messages !== null) watch(messages.settled, reveal);
|
|
191
|
+
else if (form !== null) watch(() => form.submitCount.value, (count) => {
|
|
192
|
+
if (count > 0) validate().then(reveal);
|
|
193
|
+
});
|
|
194
|
+
onMounted(() => {
|
|
195
|
+
if (props.validateOnMount) validate().then(reveal);
|
|
196
|
+
});
|
|
197
|
+
const error = computed(() => shown.value);
|
|
90
198
|
const invalid = computed(() => error.value !== void 0);
|
|
91
199
|
const wrapper = inject(FIELD_KEY, null);
|
|
92
200
|
const ownError = computed(() => wrapper === null ? error.value : void 0);
|
|
@@ -108,11 +216,18 @@ function useFieldControl(props, options) {
|
|
|
108
216
|
}, { immediate: true });
|
|
109
217
|
onScopeDispose(() => anchors.unregister(path.value));
|
|
110
218
|
}
|
|
219
|
+
if (messages !== null) {
|
|
220
|
+
watch(path, (current, previous) => {
|
|
221
|
+
if (previous !== void 0 && previous !== current) messages.forget(previous);
|
|
222
|
+
messages.report(current, shown.value);
|
|
223
|
+
}, { immediate: true });
|
|
224
|
+
onScopeDispose(() => messages.forget(path.value));
|
|
225
|
+
}
|
|
111
226
|
/**
|
|
112
227
|
* A server error is a statement about the value that was sent, so it stops being true the moment
|
|
113
228
|
* the customer edits the field — and nothing else would clear it, because a rule that already
|
|
114
229
|
* passes produces no new message to overwrite it with. Dropping the entry is what tells the
|
|
115
|
-
* `Form` to unset it (see `context.ts`).
|
|
230
|
+
* `Form` to unset it (see `context.ts`), and the watcher above takes it off the screen.
|
|
116
231
|
*/
|
|
117
232
|
if (apiErrors !== null) watch(value, () => {
|
|
118
233
|
if (!(path.value in apiErrors.value)) return;
|
|
@@ -120,13 +235,21 @@ function useFieldControl(props, options) {
|
|
|
120
235
|
delete next[path.value];
|
|
121
236
|
apiErrors.value = next;
|
|
122
237
|
});
|
|
238
|
+
/**
|
|
239
|
+
* A blur always marks the field touched (`handleBlur`, told not to validate), and validates it
|
|
240
|
+
* unless `validateOnBlur` is `false`. The message changes when that validation has settled.
|
|
241
|
+
*/
|
|
242
|
+
function onBlur(event) {
|
|
243
|
+
handleBlur(event, false);
|
|
244
|
+
if (props.validateOnBlur !== false) validate().then(reveal);
|
|
245
|
+
}
|
|
123
246
|
return {
|
|
124
247
|
model,
|
|
125
248
|
error,
|
|
126
249
|
invalid,
|
|
127
250
|
ownError,
|
|
128
251
|
id,
|
|
129
|
-
onBlur
|
|
252
|
+
onBlur
|
|
130
253
|
};
|
|
131
254
|
}
|
|
132
255
|
/**
|
|
@@ -202,17 +325,36 @@ var Form_default = /* @__PURE__ */ defineComponent({
|
|
|
202
325
|
const apiErrors = ref({ ...props.apiErrors });
|
|
203
326
|
provide(API_ERRORS_KEY, apiErrors);
|
|
204
327
|
/**
|
|
328
|
+
* What each `Field*` below is showing, keyed by its path. A field holds its own displayed message
|
|
329
|
+
* and changes it only at its own moments (its blur, a submit, a value change when it asks for
|
|
330
|
+
* that — see `useFieldControl`), and reports it here, so the summary and the `errors` slot prop
|
|
331
|
+
* say what the fields say and change when they change. `known` is every path a `Field*` has
|
|
332
|
+
* registered, with or without a message.
|
|
333
|
+
*/
|
|
334
|
+
const reported = ref({});
|
|
335
|
+
/** Rises once a submit's validation has finished; every `Field*` reads its message again then. */
|
|
336
|
+
const settled = ref(0);
|
|
337
|
+
provide(FIELD_MESSAGES_KEY, {
|
|
338
|
+
report(path, message) {
|
|
339
|
+
reported.value[path] = message;
|
|
340
|
+
},
|
|
341
|
+
forget(path) {
|
|
342
|
+
delete reported.value[path];
|
|
343
|
+
},
|
|
344
|
+
settled
|
|
345
|
+
});
|
|
346
|
+
/**
|
|
205
347
|
* The errors that should currently be **shown**, which is not the same set as the errors that
|
|
206
|
-
* exist.
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
* `FieldWrapper` shows and what the control marks itself as cannot disagree.
|
|
348
|
+
* exist. For a path a `Field*` owns it is exactly what that field shows. Any other path — a
|
|
349
|
+
* consumer's own `useField`, or an error set on a path with no field — keeps the plain gate: its
|
|
350
|
+
* message surfaces once its field has been touched, the form has been submitted, or the server
|
|
351
|
+
* sent one.
|
|
211
352
|
*/
|
|
212
353
|
const visibleErrors = computed(() => {
|
|
213
354
|
const shown = {};
|
|
355
|
+
for (const [path, message] of Object.entries(reported.value)) if (message !== void 0) shown[path] = message;
|
|
214
356
|
for (const [path, message] of Object.entries(errors.value)) {
|
|
215
|
-
if (message === void 0) continue;
|
|
357
|
+
if (message === void 0 || path in reported.value) continue;
|
|
216
358
|
if (submitCount.value > 0 || form.isFieldTouched(path) || path in apiErrors.value) shown[path] = message;
|
|
217
359
|
}
|
|
218
360
|
return shown;
|
|
@@ -297,9 +439,11 @@ var Form_default = /* @__PURE__ */ defineComponent({
|
|
|
297
439
|
/** Set by a submit that validated, and cleared by the next attempt. Drives `successMessage`. */
|
|
298
440
|
const submitted = ref(false);
|
|
299
441
|
const runSubmit = handleSubmit((submitValues, ctx) => {
|
|
442
|
+
settled.value += 1;
|
|
300
443
|
submitted.value = true;
|
|
301
444
|
emit("submit", submitValues, ctx);
|
|
302
445
|
}, ({ errors: failed }) => {
|
|
446
|
+
settled.value += 1;
|
|
303
447
|
emit("invalid", failed);
|
|
304
448
|
nextTick(focusFirstInvalid);
|
|
305
449
|
});
|
|
@@ -391,7 +535,7 @@ var Form_default = /* @__PURE__ */ defineComponent({
|
|
|
391
535
|
// src/vee-validate/FieldCheckbox.vue
|
|
392
536
|
var FieldCheckbox_default = /* @__PURE__ */ defineComponent({
|
|
393
537
|
__name: "FieldCheckbox",
|
|
394
|
-
props: {
|
|
538
|
+
props: /*@__PURE__*/ mergeDefaults({
|
|
395
539
|
indeterminate: { type: Boolean },
|
|
396
540
|
value: {},
|
|
397
541
|
name: {},
|
|
@@ -412,8 +556,11 @@ var FieldCheckbox_default = /* @__PURE__ */ defineComponent({
|
|
|
412
556
|
Function,
|
|
413
557
|
Array
|
|
414
558
|
] },
|
|
415
|
-
label: {}
|
|
416
|
-
|
|
559
|
+
label: {},
|
|
560
|
+
validateOnMount: { type: Boolean },
|
|
561
|
+
validateOnBlur: { type: Boolean },
|
|
562
|
+
validateOnValueUpdate: { type: Boolean }
|
|
563
|
+
}, FIELD_CHOICE_VALIDATION_DEFAULTS),
|
|
417
564
|
setup(__props) {
|
|
418
565
|
/**
|
|
419
566
|
* A single `Checkbox` — a consent box, "Billing address is the same" — bound to a **boolean**
|
|
@@ -450,7 +597,7 @@ var FieldCheckbox_default = /* @__PURE__ */ defineComponent({
|
|
|
450
597
|
// src/vee-validate/FieldCheckboxGroup.vue
|
|
451
598
|
var FieldCheckboxGroup_default = /* @__PURE__ */ defineComponent({
|
|
452
599
|
__name: "FieldCheckboxGroup",
|
|
453
|
-
props: {
|
|
600
|
+
props: /*@__PURE__*/ mergeDefaults({
|
|
454
601
|
legend: {},
|
|
455
602
|
options: {},
|
|
456
603
|
layout: {},
|
|
@@ -463,8 +610,11 @@ var FieldCheckboxGroup_default = /* @__PURE__ */ defineComponent({
|
|
|
463
610
|
Function,
|
|
464
611
|
Array
|
|
465
612
|
] },
|
|
466
|
-
label: {}
|
|
467
|
-
|
|
613
|
+
label: {},
|
|
614
|
+
validateOnMount: { type: Boolean },
|
|
615
|
+
validateOnBlur: { type: Boolean },
|
|
616
|
+
validateOnValueUpdate: { type: Boolean }
|
|
617
|
+
}, FIELD_CHOICE_VALIDATION_DEFAULTS),
|
|
468
618
|
setup(__props) {
|
|
469
619
|
/**
|
|
470
620
|
* `CheckboxGroup` bound to a **string array** field — one question, several answers ("Material").
|
|
@@ -502,7 +652,7 @@ var FieldCheckboxGroup_default = /* @__PURE__ */ defineComponent({
|
|
|
502
652
|
// src/vee-validate/FieldCurrencyInput.vue
|
|
503
653
|
var FieldCurrencyInput_default = /* @__PURE__ */ defineComponent({
|
|
504
654
|
__name: "FieldCurrencyInput",
|
|
505
|
-
props: {
|
|
655
|
+
props: /*@__PURE__*/ mergeDefaults({
|
|
506
656
|
locale: {},
|
|
507
657
|
label: {},
|
|
508
658
|
maxFraction: {},
|
|
@@ -528,8 +678,11 @@ var FieldCurrencyInput_default = /* @__PURE__ */ defineComponent({
|
|
|
528
678
|
Object,
|
|
529
679
|
Function,
|
|
530
680
|
Array
|
|
531
|
-
] }
|
|
532
|
-
|
|
681
|
+
] },
|
|
682
|
+
validateOnMount: { type: Boolean },
|
|
683
|
+
validateOnBlur: { type: Boolean },
|
|
684
|
+
validateOnValueUpdate: { type: Boolean }
|
|
685
|
+
}, FIELD_VALIDATION_DEFAULTS),
|
|
533
686
|
setup(__props) {
|
|
534
687
|
/**
|
|
535
688
|
* `CurrencyInput` bound to a vee-validate field — `FieldUnitInput` for money, with the same
|
|
@@ -562,7 +715,7 @@ var FieldCurrencyInput_default = /* @__PURE__ */ defineComponent({
|
|
|
562
715
|
// src/vee-validate/FieldInput.vue
|
|
563
716
|
var FieldInput_default = /* @__PURE__ */ defineComponent({
|
|
564
717
|
__name: "FieldInput",
|
|
565
|
-
props: {
|
|
718
|
+
props: /*@__PURE__*/ mergeDefaults({
|
|
566
719
|
type: {},
|
|
567
720
|
size: {},
|
|
568
721
|
id: {},
|
|
@@ -588,8 +741,11 @@ var FieldInput_default = /* @__PURE__ */ defineComponent({
|
|
|
588
741
|
Function,
|
|
589
742
|
Array
|
|
590
743
|
] },
|
|
591
|
-
label: {}
|
|
592
|
-
|
|
744
|
+
label: {},
|
|
745
|
+
validateOnMount: { type: Boolean },
|
|
746
|
+
validateOnBlur: { type: Boolean },
|
|
747
|
+
validateOnValueUpdate: { type: Boolean }
|
|
748
|
+
}, FIELD_VALIDATION_DEFAULTS),
|
|
593
749
|
setup(__props) {
|
|
594
750
|
/**
|
|
595
751
|
* `Input` bound to a vee-validate field.
|
|
@@ -625,7 +781,7 @@ var FieldInput_default = /* @__PURE__ */ defineComponent({
|
|
|
625
781
|
// src/vee-validate/FieldMultiSelect.vue
|
|
626
782
|
var FieldMultiSelect_default = /* @__PURE__ */ defineComponent({
|
|
627
783
|
__name: "FieldMultiSelect",
|
|
628
|
-
props: {
|
|
784
|
+
props: /*@__PURE__*/ mergeDefaults({
|
|
629
785
|
placeholder: {},
|
|
630
786
|
showTags: { type: Boolean },
|
|
631
787
|
tagPlacement: {},
|
|
@@ -656,8 +812,11 @@ var FieldMultiSelect_default = /* @__PURE__ */ defineComponent({
|
|
|
656
812
|
Function,
|
|
657
813
|
Array
|
|
658
814
|
] },
|
|
659
|
-
label: {}
|
|
660
|
-
|
|
815
|
+
label: {},
|
|
816
|
+
validateOnMount: { type: Boolean },
|
|
817
|
+
validateOnBlur: { type: Boolean },
|
|
818
|
+
validateOnValueUpdate: { type: Boolean }
|
|
819
|
+
}, FIELD_CHOICE_VALIDATION_DEFAULTS),
|
|
661
820
|
setup(__props) {
|
|
662
821
|
/**
|
|
663
822
|
* `MultiSelect` bound to a **string array** field.
|
|
@@ -693,7 +852,7 @@ var FieldMultiSelect_default = /* @__PURE__ */ defineComponent({
|
|
|
693
852
|
// src/vee-validate/FieldQuantityStepper.vue
|
|
694
853
|
var FieldQuantityStepper_default = /* @__PURE__ */ defineComponent({
|
|
695
854
|
__name: "FieldQuantityStepper",
|
|
696
|
-
props: {
|
|
855
|
+
props: /*@__PURE__*/ mergeDefaults({
|
|
697
856
|
min: {},
|
|
698
857
|
max: {},
|
|
699
858
|
size: {},
|
|
@@ -710,8 +869,11 @@ var FieldQuantityStepper_default = /* @__PURE__ */ defineComponent({
|
|
|
710
869
|
Function,
|
|
711
870
|
Array
|
|
712
871
|
] },
|
|
713
|
-
label: {}
|
|
714
|
-
|
|
872
|
+
label: {},
|
|
873
|
+
validateOnMount: { type: Boolean },
|
|
874
|
+
validateOnBlur: { type: Boolean },
|
|
875
|
+
validateOnValueUpdate: { type: Boolean }
|
|
876
|
+
}, FIELD_CHOICE_VALIDATION_DEFAULTS),
|
|
715
877
|
setup(__props) {
|
|
716
878
|
/**
|
|
717
879
|
* `QuantityStepper` bound to a **number** field.
|
|
@@ -753,7 +915,7 @@ var FieldQuantityStepper_default = /* @__PURE__ */ defineComponent({
|
|
|
753
915
|
// src/vee-validate/FieldRadioGroup.vue
|
|
754
916
|
var FieldRadioGroup_default = /* @__PURE__ */ defineComponent({
|
|
755
917
|
__name: "FieldRadioGroup",
|
|
756
|
-
props: {
|
|
918
|
+
props: /*@__PURE__*/ mergeDefaults({
|
|
757
919
|
name: {},
|
|
758
920
|
legend: {},
|
|
759
921
|
options: {},
|
|
@@ -771,8 +933,11 @@ var FieldRadioGroup_default = /* @__PURE__ */ defineComponent({
|
|
|
771
933
|
Function,
|
|
772
934
|
Array
|
|
773
935
|
] },
|
|
774
|
-
label: {}
|
|
775
|
-
|
|
936
|
+
label: {},
|
|
937
|
+
validateOnMount: { type: Boolean },
|
|
938
|
+
validateOnBlur: { type: Boolean },
|
|
939
|
+
validateOnValueUpdate: { type: Boolean }
|
|
940
|
+
}, FIELD_CHOICE_VALIDATION_DEFAULTS),
|
|
776
941
|
setup(__props) {
|
|
777
942
|
/**
|
|
778
943
|
* `RadioGroup` bound to a vee-validate field. Like every fieldset control here it is touched by
|
|
@@ -807,7 +972,7 @@ var FieldRadioGroup_default = /* @__PURE__ */ defineComponent({
|
|
|
807
972
|
// src/vee-validate/FieldSearchBar.vue
|
|
808
973
|
var FieldSearchBar_default = /* @__PURE__ */ defineComponent({
|
|
809
974
|
__name: "FieldSearchBar",
|
|
810
|
-
props: {
|
|
975
|
+
props: /*@__PURE__*/ mergeDefaults({
|
|
811
976
|
size: {},
|
|
812
977
|
pill: { type: Boolean },
|
|
813
978
|
action: {},
|
|
@@ -831,8 +996,11 @@ var FieldSearchBar_default = /* @__PURE__ */ defineComponent({
|
|
|
831
996
|
Object,
|
|
832
997
|
Function,
|
|
833
998
|
Array
|
|
834
|
-
] }
|
|
835
|
-
|
|
999
|
+
] },
|
|
1000
|
+
validateOnMount: { type: Boolean },
|
|
1001
|
+
validateOnBlur: { type: Boolean },
|
|
1002
|
+
validateOnValueUpdate: { type: Boolean }
|
|
1003
|
+
}, FIELD_VALIDATION_DEFAULTS),
|
|
836
1004
|
setup(__props) {
|
|
837
1005
|
/**
|
|
838
1006
|
* `SearchBar` bound to a vee-validate field, for a Search page whose query is validated before it
|
|
@@ -857,7 +1025,8 @@ var FieldSearchBar_default = /* @__PURE__ */ defineComponent({
|
|
|
857
1025
|
"path",
|
|
858
1026
|
"rules",
|
|
859
1027
|
"id",
|
|
860
|
-
"name"
|
|
1028
|
+
"name",
|
|
1029
|
+
...FIELD_VALIDATION_PROPS
|
|
861
1030
|
]);
|
|
862
1031
|
return (_ctx, _cache) => {
|
|
863
1032
|
return openBlock(), createBlock(SearchBar_default, mergeProps(unref(control), {
|
|
@@ -876,7 +1045,7 @@ var FieldSearchBar_default = /* @__PURE__ */ defineComponent({
|
|
|
876
1045
|
// src/vee-validate/FieldSelect.vue
|
|
877
1046
|
var FieldSelect_default = /* @__PURE__ */ defineComponent({
|
|
878
1047
|
__name: "FieldSelect",
|
|
879
|
-
props: {
|
|
1048
|
+
props: /*@__PURE__*/ mergeDefaults({
|
|
880
1049
|
options: {},
|
|
881
1050
|
name: {},
|
|
882
1051
|
id: {},
|
|
@@ -904,8 +1073,11 @@ var FieldSelect_default = /* @__PURE__ */ defineComponent({
|
|
|
904
1073
|
Function,
|
|
905
1074
|
Array
|
|
906
1075
|
] },
|
|
907
|
-
label: {}
|
|
908
|
-
|
|
1076
|
+
label: {},
|
|
1077
|
+
validateOnMount: { type: Boolean },
|
|
1078
|
+
validateOnBlur: { type: Boolean },
|
|
1079
|
+
validateOnValueUpdate: { type: Boolean }
|
|
1080
|
+
}, FIELD_CHOICE_VALIDATION_DEFAULTS),
|
|
909
1081
|
setup(__props) {
|
|
910
1082
|
/**
|
|
911
1083
|
* `Select` bound to a vee-validate field. The hidden native `<select>` still carries `name`, so the
|
|
@@ -938,7 +1110,7 @@ var FieldSelect_default = /* @__PURE__ */ defineComponent({
|
|
|
938
1110
|
// src/vee-validate/FieldSwitch.vue
|
|
939
1111
|
var FieldSwitch_default = /* @__PURE__ */ defineComponent({
|
|
940
1112
|
__name: "FieldSwitch",
|
|
941
|
-
props: {
|
|
1113
|
+
props: /*@__PURE__*/ mergeDefaults({
|
|
942
1114
|
size: {},
|
|
943
1115
|
description: {},
|
|
944
1116
|
disabled: { type: Boolean },
|
|
@@ -955,8 +1127,11 @@ var FieldSwitch_default = /* @__PURE__ */ defineComponent({
|
|
|
955
1127
|
Function,
|
|
956
1128
|
Array
|
|
957
1129
|
] },
|
|
958
|
-
label: {}
|
|
959
|
-
|
|
1130
|
+
label: {},
|
|
1131
|
+
validateOnMount: { type: Boolean },
|
|
1132
|
+
validateOnBlur: { type: Boolean },
|
|
1133
|
+
validateOnValueUpdate: { type: Boolean }
|
|
1134
|
+
}, FIELD_CHOICE_VALIDATION_DEFAULTS),
|
|
960
1135
|
setup(__props) {
|
|
961
1136
|
/**
|
|
962
1137
|
* `Switch` bound to a boolean field.
|
|
@@ -989,7 +1164,7 @@ var FieldSwitch_default = /* @__PURE__ */ defineComponent({
|
|
|
989
1164
|
// src/vee-validate/FieldTextarea.vue
|
|
990
1165
|
var FieldTextarea_default = /* @__PURE__ */ defineComponent({
|
|
991
1166
|
__name: "FieldTextarea",
|
|
992
|
-
props: {
|
|
1167
|
+
props: /*@__PURE__*/ mergeDefaults({
|
|
993
1168
|
placeholder: {},
|
|
994
1169
|
maxLength: {},
|
|
995
1170
|
counter: { type: Boolean },
|
|
@@ -1010,8 +1185,11 @@ var FieldTextarea_default = /* @__PURE__ */ defineComponent({
|
|
|
1010
1185
|
Function,
|
|
1011
1186
|
Array
|
|
1012
1187
|
] },
|
|
1013
|
-
label: {}
|
|
1014
|
-
|
|
1188
|
+
label: {},
|
|
1189
|
+
validateOnMount: { type: Boolean },
|
|
1190
|
+
validateOnBlur: { type: Boolean },
|
|
1191
|
+
validateOnValueUpdate: { type: Boolean }
|
|
1192
|
+
}, FIELD_VALIDATION_DEFAULTS),
|
|
1015
1193
|
setup(__props) {
|
|
1016
1194
|
/**
|
|
1017
1195
|
* `Textarea` bound to a vee-validate field. The counter, `maxLength`, `hardLimit` and `minHeight`
|
|
@@ -1044,7 +1222,7 @@ var FieldTextarea_default = /* @__PURE__ */ defineComponent({
|
|
|
1044
1222
|
// src/vee-validate/FieldUnitInput.vue
|
|
1045
1223
|
var FieldUnitInput_default = /* @__PURE__ */ defineComponent({
|
|
1046
1224
|
__name: "FieldUnitInput",
|
|
1047
|
-
props: {
|
|
1225
|
+
props: /*@__PURE__*/ mergeDefaults({
|
|
1048
1226
|
unit: {},
|
|
1049
1227
|
locale: {},
|
|
1050
1228
|
label: {},
|
|
@@ -1072,8 +1250,11 @@ var FieldUnitInput_default = /* @__PURE__ */ defineComponent({
|
|
|
1072
1250
|
Object,
|
|
1073
1251
|
Function,
|
|
1074
1252
|
Array
|
|
1075
|
-
] }
|
|
1076
|
-
|
|
1253
|
+
] },
|
|
1254
|
+
validateOnMount: { type: Boolean },
|
|
1255
|
+
validateOnBlur: { type: Boolean },
|
|
1256
|
+
validateOnValueUpdate: { type: Boolean }
|
|
1257
|
+
}, FIELD_VALIDATION_DEFAULTS),
|
|
1077
1258
|
setup(__props) {
|
|
1078
1259
|
/**
|
|
1079
1260
|
* `UnitInput` bound to a vee-validate field.
|
|
@@ -1113,7 +1294,7 @@ var FieldUnitInput_default = /* @__PURE__ */ defineComponent({
|
|
|
1113
1294
|
// src/vee-validate/FieldVariantPicker.vue
|
|
1114
1295
|
var FieldVariantPicker_default = /* @__PURE__ */ defineComponent({
|
|
1115
1296
|
__name: "FieldVariantPicker",
|
|
1116
|
-
props: {
|
|
1297
|
+
props: /*@__PURE__*/ mergeDefaults({
|
|
1117
1298
|
name: {},
|
|
1118
1299
|
legend: {},
|
|
1119
1300
|
type: {},
|
|
@@ -1126,8 +1307,11 @@ var FieldVariantPicker_default = /* @__PURE__ */ defineComponent({
|
|
|
1126
1307
|
Function,
|
|
1127
1308
|
Array
|
|
1128
1309
|
] },
|
|
1129
|
-
label: {}
|
|
1130
|
-
|
|
1310
|
+
label: {},
|
|
1311
|
+
validateOnMount: { type: Boolean },
|
|
1312
|
+
validateOnBlur: { type: Boolean },
|
|
1313
|
+
validateOnValueUpdate: { type: Boolean }
|
|
1314
|
+
}, FIELD_CHOICE_VALIDATION_DEFAULTS),
|
|
1131
1315
|
setup(__props) {
|
|
1132
1316
|
/**
|
|
1133
1317
|
* `VariantPicker` bound to a vee-validate field.
|
|
@@ -1170,4 +1354,4 @@ var FieldVariantPicker_default = /* @__PURE__ */ defineComponent({
|
|
|
1170
1354
|
};
|
|
1171
1355
|
}
|
|
1172
1356
|
});
|
|
1173
|
-
export { API_ERRORS_KEY, FIELD_ONLY, FieldCheckbox_default as FieldCheckbox, FieldCheckboxGroup_default as FieldCheckboxGroup, FieldCurrencyInput_default as FieldCurrencyInput, FieldInput_default as FieldInput, FieldMultiSelect_default as FieldMultiSelect, FieldQuantityStepper_default as FieldQuantityStepper, FieldRadioGroup_default as FieldRadioGroup, FieldSearchBar_default as FieldSearchBar, FieldSelect_default as FieldSelect, FieldSwitch_default as FieldSwitch, FieldTextarea_default as FieldTextarea, FieldUnitInput_default as FieldUnitInput, FieldVariantPicker_default as FieldVariantPicker, Form_default as Form, useFieldControl };
|
|
1357
|
+
export { API_ERRORS_KEY, FIELD_CHOICE_VALIDATION_DEFAULTS, FIELD_ONLY, FIELD_VALIDATION_DEFAULTS, FIELD_VALIDATION_PROPS, FieldCheckbox_default as FieldCheckbox, FieldCheckboxGroup_default as FieldCheckboxGroup, FieldCurrencyInput_default as FieldCurrencyInput, FieldInput_default as FieldInput, FieldMultiSelect_default as FieldMultiSelect, FieldQuantityStepper_default as FieldQuantityStepper, FieldRadioGroup_default as FieldRadioGroup, FieldSearchBar_default as FieldSearchBar, FieldSelect_default as FieldSelect, FieldSwitch_default as FieldSwitch, FieldTextarea_default as FieldTextarea, FieldUnitInput_default as FieldUnitInput, FieldVariantPicker_default as FieldVariantPicker, Form_default as Form, useFieldControl };
|
package/dist/vue-i18n.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as enUS, n as provideEldraUiMessages } from "./useMessages-
|
|
1
|
+
import { i as enUS, n as provideEldraUiMessages } from "./useMessages-DOHGfip_.js";
|
|
2
2
|
import { t as formatConjunctionList } from "./listFormat-D9ecpDMT.js";
|
|
3
3
|
import { numberFormat } from "@eldrajs/sdk/format";
|
|
4
4
|
import { useI18n } from "vue-i18n";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eldrajs/ui",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.7",
|
|
4
4
|
"description": "Accessible Vue 3 core components for Eldra storefronts: buttons, forms, selects, cards, overlays and navigation, themed through CSS design tokens.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"accessible",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"dependencies": {
|
|
65
65
|
"@floating-ui/vue": "^1.1.5",
|
|
66
66
|
"tailwind-merge": "^3.0.0",
|
|
67
|
-
"@eldrajs/sdk": "^0.4.
|
|
67
|
+
"@eldrajs/sdk": "^0.4.3"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@playwright/test": "1.62.1",
|