@eldrajs/ui 0.3.7 → 0.3.9
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/LICENSE-country-flag-icons +25 -0
- package/README.md +274 -66
- package/dist/CountryFlag-DOa8lOHp.js +71 -0
- package/dist/PhoneInput-CX83wgD0.js +695 -0
- package/dist/{VariantPicker-Cr_AkX47.js → VariantPicker-BqLbiONX.js} +122 -2302
- package/dist/components/chip/Chip.vue.d.ts +9 -0
- package/dist/components/dialog/Dialog.vue.d.ts +9 -0
- package/dist/components/drawer/Drawer.vue.d.ts +9 -0
- package/dist/components/filter-panel/FilterGroup.vue.d.ts +9 -0
- package/dist/components/filter-panel/FilterPanel.vue.d.ts +9 -0
- package/dist/components/filter-panel/facets/ColourFacet.vue.d.ts +9 -0
- package/dist/components/filter-panel/facets/ListFacet.vue.d.ts +9 -0
- package/dist/components/filter-panel/facets/RangeFacet.vue.d.ts +9 -0
- package/dist/components/filter-panel/facets/SizeFacet.vue.d.ts +9 -0
- package/dist/components/filter-panel/facets/ToggleFacet.vue.d.ts +9 -0
- package/dist/components/lightbox/Lightbox.vue.d.ts +9 -0
- package/dist/components/nav-menu/NavMenu.vue.d.ts +9 -0
- package/dist/components/pagination/Pagination.vue.d.ts +9 -0
- package/dist/components/range-slider/RangeSlider.vue.d.ts +9 -0
- package/dist/components/search-bar/SearchBar.vue.d.ts +9 -0
- package/dist/components/search-modal/SearchModal.vue.d.ts +9 -0
- package/dist/components/select/MultiSelect.vue.d.ts +10 -0
- package/dist/components/select/Select.vue.d.ts +9 -0
- package/dist/components/select/types.d.ts +7 -1
- package/dist/components/site-form/SiteForm.vue.d.ts +9 -0
- package/dist/components/toast/Toast.vue.d.ts +9 -0
- package/dist/components/toast/Toaster.vue.d.ts +9 -0
- package/dist/components.css +64 -0
- package/dist/flag/CountryFlag.vue.d.ts +9 -0
- package/dist/flag/flags.d.ts +8 -0
- package/dist/flag/index.d.ts +9 -0
- package/dist/flag.js +1 -0
- package/dist/index.js +4 -2
- package/dist/messages/en-US.d.ts +21 -0
- package/dist/messages/is-IS.js +10 -1
- package/dist/phone/PhoneInput.vue.d.ts +221 -0
- package/dist/phone/caret.d.ts +14 -0
- package/dist/phone/examples.d.ts +2 -0
- package/dist/phone/index.d.ts +13 -0
- package/dist/phone/phone.d.ts +62 -0
- package/dist/phone/phoneFlagData.d.ts +2 -0
- package/dist/phone/rule.d.ts +22 -0
- package/dist/phone/types.d.ts +63 -0
- package/dist/phone/vee-validate/FieldPhoneInput.vue.d.ts +24 -0
- package/dist/phone/vee-validate/index.d.ts +3 -0
- package/dist/phone/vee-validate/types.d.ts +3 -0
- package/dist/phone/vee-validate.js +96 -0
- package/dist/phone.js +3 -0
- package/dist/phoneFlagData-D9dDT2uC.js +261 -0
- package/dist/resolver.d.ts +15 -2
- package/dist/resolver.js +26 -4
- package/dist/style.css +64 -0
- package/dist/useEldraScope-BDbGzt7R.js +32 -0
- package/dist/useFieldControl-D1j54YON.js +273 -0
- package/dist/{useMessages-DOHGfip_.js → useMessages-CkhrRmu7.js} +22 -1
- package/dist/usePopover-ECHpsSRF.js +2199 -0
- package/dist/utilities.css +37 -0
- package/dist/vee-validate.js +7 -273
- package/dist/vue-i18n.js +4 -1
- package/package.json +23 -2
package/dist/utilities.css
CHANGED
|
@@ -844,6 +844,32 @@
|
|
|
844
844
|
}
|
|
845
845
|
}
|
|
846
846
|
}
|
|
847
|
+
/* The ring while a popup opened from *inside* the element is open: `eldra-focus-open` for a box
|
|
848
|
+
that is not itself the trigger. `PhoneInput`'s field is a box around a country button and a
|
|
849
|
+
number input; the list opens from the button, focus moves into the list's search field (which is
|
|
850
|
+
teleported away), and the field would otherwise lose its ring while its own popup hangs off it.
|
|
851
|
+
A modifier of the same shape as `eldra-focus-open` and `eldra-focus-proxy`: it carries no ring
|
|
852
|
+
of its own and only turns on the one `eldra-focus` put on the element. */
|
|
853
|
+
@utility eldra-focus-has-open {
|
|
854
|
+
&:has([aria-expanded='true']) {
|
|
855
|
+
--eldra-focus-alpha: 1;
|
|
856
|
+
@supports not (color: color-mix(in srgb, red, red)) {
|
|
857
|
+
--tw-ring-offset-shadow:
|
|
858
|
+
0 0 0 var(--eldra-focus-offset) var(--eldra-color-focus-inner),
|
|
859
|
+
0 0 0 var(--eldra-focus-offset) var(--eldra-color-focus-inner),
|
|
860
|
+
0 0 0 var(--eldra-focus-offset) var(--eldra-color-focus-inner);
|
|
861
|
+
--tw-ring-shadow: 0 0 0 calc(var(--eldra-focus-offset) + var(--eldra-focus-width))
|
|
862
|
+
var(--eldra-color-focus);
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
@media (forced-colors: active) {
|
|
866
|
+
&:has([aria-expanded='true']) {
|
|
867
|
+
outline-width: var(--eldra-focus-width);
|
|
868
|
+
outline-offset: var(--eldra-focus-offset);
|
|
869
|
+
outline-color: Highlight;
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
}
|
|
847
873
|
/* Proxy focus (spec 1 "Focus ring" → Proxy focus): "When the focusable element is visually hidden
|
|
848
874
|
(the radio inside a size pill, the stretched link of a card), draw the ring on the visible shape
|
|
849
875
|
(the pill, the whole card), not on the hidden element."
|
|
@@ -1160,6 +1186,17 @@
|
|
|
1160
1186
|
max-width: min(var(--eldra-select-panel-max-width, 22rem), 90vw);
|
|
1161
1187
|
}
|
|
1162
1188
|
|
|
1189
|
+
/* A `PhoneInput` flag's edge. The artwork is 1.25 × 0.875rem; neither its corner nor its hairline
|
|
1190
|
+
is a token (the radius scale starts at 0.375rem, more than a third of the flag's height), so
|
|
1191
|
+
both are per-component variables with literal defaults, the same shape as `eldra-link-radius`.
|
|
1192
|
+
The hairline keeps a white flag visible on a white field, and its fill shows until the artwork
|
|
1193
|
+
has loaded. */
|
|
1194
|
+
@utility eldra-phone-flag {
|
|
1195
|
+
border-radius: var(--eldra-phone-flag-radius, 2px);
|
|
1196
|
+
box-shadow: 0 0 0 1px var(--eldra-phone-flag-border, var(--eldra-color-border));
|
|
1197
|
+
background-color: var(--eldra-phone-flag-fill, var(--eldra-color-surface-strong));
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1163
1200
|
/* The matched run of a filtered option (spec "Select" -> States, "Option filtered match"):
|
|
1164
1201
|
"matched characters weight 700, 2px underline at 0.15em offset". None of the three is a token —
|
|
1165
1202
|
the type styles stop at 600 and no underline offset exists anywhere else — so all three are
|
package/dist/vee-validate.js
CHANGED
|
@@ -1,276 +1,9 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { r as useMessages } from "./useMessages-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* The server's field errors, keyed by the path a `Field*` validates under (its `path`, or its
|
|
8
|
-
* `name` when there is none).
|
|
9
|
-
*
|
|
10
|
-
* `Form` provides it from its `apiErrors` prop and applies it to the form with vee-validate's own
|
|
11
|
-
* `setErrors`, so a 422 from the shop's API lands on the field it belongs to rather than in a
|
|
12
|
-
* banner above the form. Every `Field*` injects it and removes **its own** entry the moment its
|
|
13
|
-
* value changes — a server error is a statement about the value that was sent, so it stops being
|
|
14
|
-
* true as soon as the customer edits it, and nothing else would reliably clear it (a rule that
|
|
15
|
-
* already passes has no new message to overwrite it with).
|
|
16
|
-
*
|
|
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
|
-
*
|
|
25
|
-
* It is a plain `Ref`, so a consumer can provide one itself and drive server errors from outside a
|
|
26
|
-
* `Form`:
|
|
27
|
-
*
|
|
28
|
-
* ```ts
|
|
29
|
-
* import { API_ERRORS_KEY } from '@eldrajs/ui/vee-validate';
|
|
30
|
-
* provide(API_ERRORS_KEY, ref({ email: 'That address is already subscribed.' }));
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
var API_ERRORS_KEY = Symbol("eldra-ui:api-errors");
|
|
34
|
-
/** The key a `Form` provides its {@link FieldAnchorRegistry} on. Internal to this entry. */
|
|
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");
|
|
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
|
-
};
|
|
75
|
-
/** The props a `Field*` keeps for itself and never forwards to the component it wraps. */
|
|
76
|
-
var FIELD_ONLY = [
|
|
77
|
-
"path",
|
|
78
|
-
"rules",
|
|
79
|
-
"label",
|
|
80
|
-
"id",
|
|
81
|
-
...FIELD_VALIDATION_PROPS
|
|
82
|
-
];
|
|
83
|
-
/**
|
|
84
|
-
* The whole of what a `Field*` does, minus the one component it renders.
|
|
85
|
-
*
|
|
86
|
-
* Each `Field*` is a thin SFC over this: `useField(name, rules, { label })` for the value and the
|
|
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.
|
|
103
|
-
*
|
|
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.
|
|
113
|
-
*/
|
|
114
|
-
function useFieldControl(props, options) {
|
|
115
|
-
/**
|
|
116
|
-
* Where the value lives. `name` for every control whose `name` is the native form field name;
|
|
117
|
-
* `path` for the one whose is not — a `VariantPicker`'s `name` is the visible option name, so it
|
|
118
|
-
* would otherwise be both the legend and the key in `values`, and one of the two would be wrong.
|
|
119
|
-
*/
|
|
120
|
-
const path = computed(() => props.path ?? props.name);
|
|
121
|
-
const rules = computed(() => props.rules);
|
|
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, {
|
|
128
|
-
label: () => props.label,
|
|
129
|
-
initialValue: options.initialValue,
|
|
130
|
-
validateOnValueUpdate: props.validateOnValueUpdate === true
|
|
131
|
-
});
|
|
132
|
-
const model = computed({
|
|
133
|
-
get: () => value.value ?? options.empty,
|
|
134
|
-
set: (next) => {
|
|
135
|
-
value.value = next;
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
/**
|
|
139
|
-
* The form above, for `submitCount`. Injected rather than taken from `useFormContext()` so a
|
|
140
|
-
* `Field*` used on its own — a single validated search box, say — works with no form at all.
|
|
141
|
-
*/
|
|
142
|
-
const form = inject(FormContextKey, null);
|
|
143
|
-
const submitted = computed(() => (form?.submitCount.value ?? 0) > 0);
|
|
144
|
-
const apiErrors = inject(API_ERRORS_KEY, null);
|
|
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
|
-
});
|
|
185
|
-
/**
|
|
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.
|
|
189
|
-
*/
|
|
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);
|
|
198
|
-
const invalid = computed(() => error.value !== void 0);
|
|
199
|
-
const wrapper = inject(FIELD_KEY, null);
|
|
200
|
-
const ownError = computed(() => wrapper === null ? error.value : void 0);
|
|
201
|
-
/**
|
|
202
|
-
* The id. A `FieldWrapper` already owns one and has tied its `<label for>` to it, so nothing is
|
|
203
|
-
* forwarded there — handing a `Checkbox` or a `Switch` an explicit `id` is what tells it the
|
|
204
|
-
* wrapper is *not* naming it, and it would draw a second label. Standing on its own, the field
|
|
205
|
-
* generates one so the error summary has something to link to.
|
|
206
|
-
*/
|
|
207
|
-
const ownId = useUiId("field");
|
|
208
|
-
const id = computed(() => props.id ?? (wrapper === null && options.hasIdProp !== false ? ownId.value : void 0));
|
|
209
|
-
const anchorId = computed(() => props.id ?? wrapper?.value.id ?? (options.hasIdProp !== false ? ownId.value : void 0));
|
|
210
|
-
const anchors = inject(FIELD_ANCHORS_KEY, null);
|
|
211
|
-
if (anchors !== null) {
|
|
212
|
-
watch([path, anchorId], ([current, target], previous) => {
|
|
213
|
-
const previousPath = previous?.[0];
|
|
214
|
-
if (previousPath !== void 0 && previousPath !== current) anchors.unregister(previousPath);
|
|
215
|
-
anchors.register(current, target);
|
|
216
|
-
}, { immediate: true });
|
|
217
|
-
onScopeDispose(() => anchors.unregister(path.value));
|
|
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
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* A server error is a statement about the value that was sent, so it stops being true the moment
|
|
228
|
-
* the customer edits the field — and nothing else would clear it, because a rule that already
|
|
229
|
-
* passes produces no new message to overwrite it with. Dropping the entry is what tells the
|
|
230
|
-
* `Form` to unset it (see `context.ts`), and the watcher above takes it off the screen.
|
|
231
|
-
*/
|
|
232
|
-
if (apiErrors !== null) watch(value, () => {
|
|
233
|
-
if (!(path.value in apiErrors.value)) return;
|
|
234
|
-
const next = { ...apiErrors.value };
|
|
235
|
-
delete next[path.value];
|
|
236
|
-
apiErrors.value = next;
|
|
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
|
-
}
|
|
246
|
-
return {
|
|
247
|
-
model,
|
|
248
|
-
error,
|
|
249
|
-
invalid,
|
|
250
|
-
ownError,
|
|
251
|
-
id,
|
|
252
|
-
onBlur
|
|
253
|
-
};
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* Everything the `Field*` was given, minus what it keeps for itself — the props it forwards to the
|
|
257
|
-
* agnostic component underneath, typed as exactly that `Omit`.
|
|
258
|
-
*
|
|
259
|
-
* Built by walking the props object rather than by destructuring, so a prop added to any of the
|
|
260
|
-
* eleven components is forwarded the day it is added and nothing here has to be told about it.
|
|
261
|
-
* `undefined` values are forwarded too, which is exactly right: Vue applies a component's own
|
|
262
|
-
* `withDefaults` value for a prop that is `undefined`, so an unset prop still lands on its default.
|
|
263
|
-
*/
|
|
264
|
-
function useControlProps(props, omit) {
|
|
265
|
-
return computed(() => {
|
|
266
|
-
const forwarded = {};
|
|
267
|
-
for (const [key, value] of Object.entries(props)) {
|
|
268
|
-
if (omit.includes(key)) continue;
|
|
269
|
-
forwarded[key] = value;
|
|
270
|
-
}
|
|
271
|
-
return forwarded;
|
|
272
|
-
});
|
|
273
|
-
}
|
|
1
|
+
import { A as UnitInput_default, C as Switch_default, G as CheckboxGroup_default, K as Checkbox_default, S as focusInvalid, T as Input_default, b as MultiSelect_default, i as SearchBar_default, k as CurrencyInput_default, l as RadioGroup_default, n as Textarea_default, r as Select_default, t as VariantPicker_default, x as FormLayout_default, y as QuantityStepper_default } from "./VariantPicker-BqLbiONX.js";
|
|
2
|
+
import { r as useMessages } from "./useMessages-CkhrRmu7.js";
|
|
3
|
+
import { a as useControlProps, c as FIELD_ANCHORS_KEY, i as FIELD_VALIDATION_PROPS, l as FIELD_MESSAGES_KEY, n as FIELD_ONLY, o as useFieldControl, r as FIELD_VALIDATION_DEFAULTS, s as API_ERRORS_KEY, t as FIELD_CHOICE_VALIDATION_DEFAULTS } from "./useFieldControl-D1j54YON.js";
|
|
4
|
+
import { r as useEldraScope } from "./useEldraScope-BDbGzt7R.js";
|
|
5
|
+
import { Fragment, computed, createBlock, createElementBlock, createElementVNode, createSlots, createTextVNode, defineComponent, guardReactiveProps, isRef, mergeDefaults, mergeProps, nextTick, normalizeClass, normalizeProps, onMounted, openBlock, provide, ref, renderList, renderSlot, toDisplayString, unref, watch, withCtx } from "vue";
|
|
6
|
+
import { useForm } from "vee-validate";
|
|
274
7
|
// src/vee-validate/Form.vue?vue&type=script&setup=true&lang.ts
|
|
275
8
|
var _hoisted_1 = ["data-eldra-scope"];
|
|
276
9
|
var _hoisted_2 = ["data-eldra-scope"];
|
|
@@ -787,6 +520,7 @@ var FieldMultiSelect_default = /* @__PURE__ */ defineComponent({
|
|
|
787
520
|
tagPlacement: {},
|
|
788
521
|
maxTagRows: {},
|
|
789
522
|
maxSummary: {},
|
|
523
|
+
selectAll: { type: Boolean },
|
|
790
524
|
classes: {},
|
|
791
525
|
options: {},
|
|
792
526
|
name: {},
|
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-CkhrRmu7.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";
|
|
@@ -21,6 +21,9 @@ var SHAPES = {
|
|
|
21
21
|
closeDrawer: text("name"),
|
|
22
22
|
noResultsFor: text("query"),
|
|
23
23
|
noMatchesFor: text("query"),
|
|
24
|
+
phoneCountry: text("name", "code"),
|
|
25
|
+
phoneNoMatch: text("query"),
|
|
26
|
+
phoneInvalid: text("country"),
|
|
24
27
|
createOption: text("query"),
|
|
25
28
|
moreSelected: counted(),
|
|
26
29
|
removeTag: text("label"),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eldrajs/ui",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.9",
|
|
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",
|
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
"dist",
|
|
23
23
|
"CHANGELOG.md",
|
|
24
24
|
"LICENSE",
|
|
25
|
-
"LICENSE-tabler-icons"
|
|
25
|
+
"LICENSE-tabler-icons",
|
|
26
|
+
"LICENSE-country-flag-icons"
|
|
26
27
|
],
|
|
27
28
|
"type": "module",
|
|
28
29
|
"sideEffects": [
|
|
@@ -45,6 +46,18 @@
|
|
|
45
46
|
"types": "./dist/vue-i18n/index.d.ts",
|
|
46
47
|
"import": "./dist/vue-i18n.js"
|
|
47
48
|
},
|
|
49
|
+
"./flag": {
|
|
50
|
+
"types": "./dist/flag/index.d.ts",
|
|
51
|
+
"import": "./dist/flag.js"
|
|
52
|
+
},
|
|
53
|
+
"./phone": {
|
|
54
|
+
"types": "./dist/phone/index.d.ts",
|
|
55
|
+
"import": "./dist/phone.js"
|
|
56
|
+
},
|
|
57
|
+
"./phone/vee-validate": {
|
|
58
|
+
"types": "./dist/phone/vee-validate/index.d.ts",
|
|
59
|
+
"import": "./dist/phone/vee-validate.js"
|
|
60
|
+
},
|
|
48
61
|
"./messages/is-IS": {
|
|
49
62
|
"types": "./dist/messages/is-IS.d.ts",
|
|
50
63
|
"import": "./dist/messages/is-IS.js"
|
|
@@ -77,7 +90,9 @@
|
|
|
77
90
|
"@tailwindcss/vite": "^4.1.14",
|
|
78
91
|
"@vitejs/plugin-vue": "^6.0.5",
|
|
79
92
|
"@vue/test-utils": "^2.4.6",
|
|
93
|
+
"country-flag-icons": "1.6.20",
|
|
80
94
|
"happy-dom": "^21.0.4",
|
|
95
|
+
"libphonenumber-js": "^1.13.16",
|
|
81
96
|
"pixelmatch": "^7.1.0",
|
|
82
97
|
"pngjs": "^7.0.0",
|
|
83
98
|
"postcss": "^8.5.32",
|
|
@@ -94,11 +109,15 @@
|
|
|
94
109
|
"vue-tsc": "^3.3.11"
|
|
95
110
|
},
|
|
96
111
|
"peerDependencies": {
|
|
112
|
+
"libphonenumber-js": "^1.13.0",
|
|
97
113
|
"vee-validate": "^4.12.0",
|
|
98
114
|
"vue": "^3.5.0",
|
|
99
115
|
"vue-i18n": "^11.0.0"
|
|
100
116
|
},
|
|
101
117
|
"peerDependenciesMeta": {
|
|
118
|
+
"libphonenumber-js": {
|
|
119
|
+
"optional": true
|
|
120
|
+
},
|
|
102
121
|
"vee-validate": {
|
|
103
122
|
"optional": true
|
|
104
123
|
},
|
|
@@ -115,6 +134,8 @@
|
|
|
115
134
|
"check:tokens": "node scripts/build-tokens.mjs --check",
|
|
116
135
|
"build-tabler-icons": "node scripts/build-tabler-icons.mjs",
|
|
117
136
|
"check:tabler-icons": "node scripts/build-tabler-icons.mjs --check",
|
|
137
|
+
"build-phone-flags": "node scripts/build-phone-flags.mjs",
|
|
138
|
+
"check:phone-flags": "node scripts/build-phone-flags.mjs --check",
|
|
118
139
|
"typecheck": "vue-tsc --noEmit -p tsconfig.json",
|
|
119
140
|
"lint": "oxlint src scripts",
|
|
120
141
|
"test": "vitest run",
|