@eldrajs/ui 0.3.8 → 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 +2 -0
- package/LICENSE-country-flag-icons +1 -1
- package/README.md +45 -1
- package/dist/CountryFlag-DOa8lOHp.js +71 -0
- package/dist/{PhoneInput-CYGpERg4.js → PhoneInput-CX83wgD0.js} +8 -62
- package/dist/{VariantPicker-D_Gg80So.js → VariantPicker-BqLbiONX.js} +36 -2
- package/dist/components/chip/Chip.vue.d.ts +1 -0
- package/dist/components/dialog/Dialog.vue.d.ts +1 -0
- package/dist/components/drawer/Drawer.vue.d.ts +1 -0
- package/dist/components/filter-panel/FilterGroup.vue.d.ts +1 -0
- package/dist/components/filter-panel/FilterPanel.vue.d.ts +1 -0
- package/dist/components/filter-panel/facets/ColourFacet.vue.d.ts +1 -0
- package/dist/components/filter-panel/facets/ListFacet.vue.d.ts +1 -0
- package/dist/components/filter-panel/facets/RangeFacet.vue.d.ts +1 -0
- package/dist/components/filter-panel/facets/SizeFacet.vue.d.ts +1 -0
- package/dist/components/filter-panel/facets/ToggleFacet.vue.d.ts +1 -0
- package/dist/components/lightbox/Lightbox.vue.d.ts +1 -0
- package/dist/components/nav-menu/NavMenu.vue.d.ts +1 -0
- package/dist/components/pagination/Pagination.vue.d.ts +1 -0
- package/dist/components/range-slider/RangeSlider.vue.d.ts +1 -0
- package/dist/components/search-bar/SearchBar.vue.d.ts +1 -0
- package/dist/components/search-modal/SearchModal.vue.d.ts +1 -0
- package/dist/components/select/MultiSelect.vue.d.ts +2 -0
- package/dist/components/select/Select.vue.d.ts +1 -0
- package/dist/components/select/types.d.ts +7 -1
- package/dist/components/site-form/SiteForm.vue.d.ts +1 -0
- package/dist/components/toast/Toast.vue.d.ts +1 -0
- package/dist/components/toast/Toaster.vue.d.ts +1 -0
- package/dist/{phone/PhoneFlag.vue.d.ts → flag/CountryFlag.vue.d.ts} +3 -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 -3
- package/dist/messages/en-US.d.ts +2 -0
- package/dist/messages/is-IS.js +1 -0
- package/dist/phone/PhoneInput.vue.d.ts +1 -0
- package/dist/phone/index.d.ts +1 -1
- package/dist/phone/vee-validate.js +4 -4
- package/dist/phone.js +3 -1
- package/dist/resolver.d.ts +8 -2
- package/dist/resolver.js +13 -2
- package/dist/useEldraScope-BDbGzt7R.js +32 -0
- package/dist/{useFieldControl-D_b9SC9s.js → useFieldControl-D1j54YON.js} +1 -1
- package/dist/{useMessages-DQQPh1P_.js → useMessages-CkhrRmu7.js} +2 -0
- package/dist/{usePopover-4CQR2hB5.js → usePopover-ECHpsSRF.js} +3 -32
- package/dist/vee-validate.js +5 -4
- package/dist/vue-i18n.js +1 -1
- package/package.json +5 -1
- package/dist/phone/flags.d.ts +0 -8
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,8 @@ Release-please writes the generated notes from commit messages and does not repl
|
|
|
7
7
|
|
|
8
8
|
### Added
|
|
9
9
|
|
|
10
|
+
- **`MultiSelect` `selectAll`** adds a "Select all" button to the footer, before Clear. It adds every enabled option the list is showing to the selection, so with a search typed it selects the matches only, and it is disabled once they are all selected. New part `footerSelectAll` and message `selectAll` ("Select all" / "Velja allt"). On by default: an existing `MultiSelect` gains the button; `:select-all="false"` leaves it out.
|
|
11
|
+
- **`@eldrajs/ui/flag`** — `CountryFlag`, the flag `PhoneInput` draws, for use on its own: `<CountryFlag country="NO" />` beside a country's name in a select, an address or a language switch (decorative), or with `label` as a named image. No peer dependency. The artwork is the same lazy chunk `@eldrajs/ui/phone` loads, fetched when the first flag mounts; `preloadCountryFlags()` fetches it sooner. `<EldraCountryFlag>` resolves from this entry (`flagComponentNames` in `@eldrajs/ui/resolver`). `preloadPhoneFlags` stays in `@eldrajs/ui/phone`, as the same function.
|
|
10
12
|
- **`@eldrajs/ui/phone`** — `PhoneInput`, a phone number field with its country inside it: a country button (flag, dialling code) that opens a searchable country list under the field (`preferredCountries` first, then A to Z; found by name, dialling code or ISO code), and a number spaced the way the country writes it as it is typed, with the caret kept in place. `modelValue` is the number in E.164; `v-model:country`, `defaultCountry`, `countries`, `locale`, `size`, `name` (posts the E.164 value), `placeholder` (an example number by default), a `flag` slot and a `change` event (`{ e164, country, callingCode, nationalNumber, valid }`). Typing or pasting a number that starts with `+` picks the country. Also exported: `isValidPhone`, `parsePhone`, `phoneRule`, `phoneCountries`, `phoneCallingCode`, `phoneCountryName`, `phoneExample`, `preloadPhoneFlags`. `libphonenumber-js ^1.13` is a new optional peer, imported by this entry only; the flags (country-flag-icons, MIT) are one lazy chunk. `<EldraPhoneInput>` through the resolver, from `@eldrajs/ui/phone` (`phoneComponentNames`).
|
|
11
13
|
- **`@eldrajs/ui/phone/vee-validate`** — `FieldPhoneInput`, `PhoneInput` bound to a vee-validate field with the typed-control validation defaults; with no `rules` it checks the number against the country the field is on. `phoneRule({ country, locale, messages })` returns `true` or a message naming the country.
|
|
12
14
|
- **Messages** `phoneCountry`, `phoneCountryList`, `phoneSearch`, `phoneSuggested`, `phoneAllCountries`, `phoneNoMatch`, `phoneInvalid` and `phoneInvalidNumber`, in English and Icelandic and through `@eldrajs/ui/vue-i18n`.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
The country flags drawn by PhoneInput (dist/phoneFlagData-*.js) are copied from
|
|
1
|
+
The country flags drawn by CountryFlag and PhoneInput (dist/phoneFlagData-*.js) are copied from
|
|
2
2
|
country-flag-icons 1.6.20 (https://gitlab.com/catamphetamine/country-flag-icons), under:
|
|
3
3
|
|
|
4
4
|
(The MIT License)
|
package/README.md
CHANGED
|
@@ -1274,6 +1274,40 @@ status region are the ones documented above. It adds:
|
|
|
1274
1274
|
|
|
1275
1275
|
<a id="phone"></a>
|
|
1276
1276
|
|
|
1277
|
+
## `./flag`
|
|
1278
|
+
|
|
1279
|
+
`@eldrajs/ui/flag` is a country's flag by its ISO 3166-1 alpha-2 code, for a country select, an
|
|
1280
|
+
address or a language switch. It needs no peer. It is an entry of its own because of its artwork,
|
|
1281
|
+
which the root entry never reaches.
|
|
1282
|
+
|
|
1283
|
+
```vue
|
|
1284
|
+
<script setup lang="ts">
|
|
1285
|
+
import { CountryFlag } from '@eldrajs/ui/flag';
|
|
1286
|
+
</script>
|
|
1287
|
+
|
|
1288
|
+
<template>
|
|
1289
|
+
<!-- Beside the country's name: decorative, the name says it. -->
|
|
1290
|
+
<span class="flex items-center gap-2"><CountryFlag country="NO" /> Norway</span>
|
|
1291
|
+
<!-- On its own: give it a name. -->
|
|
1292
|
+
<CountryFlag country="NO" label="Norway" />
|
|
1293
|
+
</template>
|
|
1294
|
+
```
|
|
1295
|
+
|
|
1296
|
+
| Prop | Type | What it does |
|
|
1297
|
+
| --------- | -------- | -------------------------------------------------------------------------------- |
|
|
1298
|
+
| `country` | `string` | The two-letter code, in either case. A code with no flag keeps the empty box |
|
|
1299
|
+
| `label` | `string` | Makes the flag an image with this name (`role="img"`). Without it, `aria-hidden` |
|
|
1300
|
+
|
|
1301
|
+
The flag is 1.25 × 0.875rem (3:2); a `class` of your own sizes it differently. Its corner, hairline
|
|
1302
|
+
and loading fill are the `--eldra-phone-flag-*` variables under Customisation, the ones
|
|
1303
|
+
`PhoneInput`'s flags use. The artwork is
|
|
1304
|
+
[country-flag-icons](https://gitlab.com/catamphetamine/country-flag-icons) (MIT;
|
|
1305
|
+
`LICENSE-country-flag-icons` ships in the package), one lazy chunk of about 46 kB gzipped that is
|
|
1306
|
+
fetched when the first flag mounts in a browser and shared with `@eldrajs/ui/phone`. Until it
|
|
1307
|
+
arrives, and in server-rendered HTML, a flag is an empty box of the same size, so nothing moves.
|
|
1308
|
+
`preloadCountryFlags()` fetches it sooner. With the resolver, `<EldraCountryFlag>` imports from
|
|
1309
|
+
this entry.
|
|
1310
|
+
|
|
1277
1311
|
## `./phone`
|
|
1278
1312
|
|
|
1279
1313
|
`@eldrajs/ui/phone` is a phone number field with its country inside it. It is an entry of its own
|
|
@@ -1381,7 +1415,8 @@ the code are always in text, so the country is never told by a flag alone.
|
|
|
1381
1415
|
(MIT; `LICENSE-country-flag-icons` ships in the package), copied into the package by
|
|
1382
1416
|
`pnpm --filter @eldrajs/ui build-phone-flags`. It is one lazy chunk (about 46 kB gzipped), fetched
|
|
1383
1417
|
when the first `PhoneInput` mounts in a browser; until then a flag is an empty box of the same
|
|
1384
|
-
size, so nothing moves. `preloadPhoneFlags()` fetches it sooner.
|
|
1418
|
+
size, so nothing moves. `preloadPhoneFlags()` fetches it sooner. The flag itself is `CountryFlag`
|
|
1419
|
+
from [`./flag`](#flag), for use outside the field.
|
|
1385
1420
|
|
|
1386
1421
|
**Helpers**, from the same entry: `isValidPhone(value, country?)`, `parsePhone(value, country?)`
|
|
1387
1422
|
(`{ e164, country, callingCode, nationalNumber, national, valid } | null`), `phoneCountries()`,
|
|
@@ -2681,6 +2716,15 @@ aria-busy aria-label="Loading product"`, `ContentCard`'s loading root now matche
|
|
|
2681
2716
|
consumer owns the remove control then: render it only while `removable` (false when `disabled` or
|
|
2682
2717
|
`readonly`), as a real `<button type="button">` named `removeLabel` ("Remove <label>"), calling
|
|
2683
2718
|
`remove`, which deselects and returns focus to the trigger.
|
|
2719
|
+
- **`MultiSelect` can offer "Select all" (`selectAll`).** Not in the spec's footer ("live count ·
|
|
2720
|
+
Clear · Done"), and on by default: a multi-select without it makes a long list a chore, and
|
|
2721
|
+
`:select-all="false"` leaves it out. A link button before Clear adds every enabled
|
|
2722
|
+
option the list is showing to the selection: all of them, or only a search's matches, whatever
|
|
2723
|
+
the render batch has drawn so far. Values already chosen keep their place and the new ones
|
|
2724
|
+
follow in list order; disabled options are never touched. It is the footer's first tab stop, so
|
|
2725
|
+
the `Tab` walk the spec describes runs Select all, Clear, Done. It fires `change` once, keeps the
|
|
2726
|
+
popover open and returns focus as Clear does, and is disabled when there is nothing left to
|
|
2727
|
+
add. Part `footerSelectAll`, message `selectAll`.
|
|
2684
2728
|
- **`MultiSelect`'s tags can sit inside the field (`tagPlacement: 'inside'`).** The field then
|
|
2685
2729
|
draws the trigger box (the `field` part) and wraps the tags and the trigger, growing a row at a
|
|
2686
2730
|
time; the trigger is the rest of the last row, or a row of its own, and the panel matches the
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { r as useEldraScope } from "./useEldraScope-BDbGzt7R.js";
|
|
2
|
+
import { computed, createElementBlock, defineComponent, mergeProps, onMounted, openBlock, shallowRef, unref } from "vue";
|
|
3
|
+
// src/flag/flags.ts
|
|
4
|
+
/**
|
|
5
|
+
* The flag artwork is 46 kB gzipped, so it is one lazy chunk, fetched when the first `CountryFlag`
|
|
6
|
+
* (or `PhoneInput`, which draws them) mounts in a browser and shared by every one after it. Until
|
|
7
|
+
* it arrives a flag is an empty box of the same size, so nothing moves when it does. A server
|
|
8
|
+
* render never loads it: the server and the client's first render both draw the empty box, and
|
|
9
|
+
* agree.
|
|
10
|
+
*/
|
|
11
|
+
var flags = shallowRef(null);
|
|
12
|
+
var loading;
|
|
13
|
+
/** Loads the flags. Safe to call more than once, and ahead of a flag to draw it sooner. */
|
|
14
|
+
function preloadCountryFlags() {
|
|
15
|
+
loading ??= import("./phoneFlagData-D9dDT2uC.js").then((module) => {
|
|
16
|
+
flags.value = module.default;
|
|
17
|
+
}, () => {
|
|
18
|
+
loading = void 0;
|
|
19
|
+
});
|
|
20
|
+
return loading;
|
|
21
|
+
}
|
|
22
|
+
/** A country's flag once the chunk is in; reactive, so a flag drawn before then fills in. */
|
|
23
|
+
function countryFlag(country) {
|
|
24
|
+
const entry = flags.value?.[country.toUpperCase()];
|
|
25
|
+
if (entry === void 0) return void 0;
|
|
26
|
+
const cut = entry.indexOf("|");
|
|
27
|
+
return {
|
|
28
|
+
viewBox: entry.slice(0, cut),
|
|
29
|
+
body: entry.slice(cut + 1)
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
// src/flag/CountryFlag.vue?vue&type=script&setup=true&lang.ts
|
|
33
|
+
var _hoisted_1 = ["data-eldra-scope"];
|
|
34
|
+
// src/flag/CountryFlag.vue
|
|
35
|
+
var CountryFlag_default = /* @__PURE__ */ defineComponent({
|
|
36
|
+
__name: "CountryFlag",
|
|
37
|
+
props: {
|
|
38
|
+
country: {},
|
|
39
|
+
label: {}
|
|
40
|
+
},
|
|
41
|
+
setup(__props) {
|
|
42
|
+
const props = __props;
|
|
43
|
+
const eldra = useEldraScope();
|
|
44
|
+
onMounted(() => {
|
|
45
|
+
preloadCountryFlags();
|
|
46
|
+
});
|
|
47
|
+
const art = computed(() => countryFlag(props.country));
|
|
48
|
+
const drawn = computed(() => art.value === void 0 ? {} : {
|
|
49
|
+
viewBox: art.value.viewBox,
|
|
50
|
+
innerHTML: art.value.body
|
|
51
|
+
});
|
|
52
|
+
const named = computed(() => props.label === void 0 || props.label === "" ? { "aria-hidden": "true" } : {
|
|
53
|
+
role: "img",
|
|
54
|
+
"aria-label": props.label
|
|
55
|
+
});
|
|
56
|
+
return (_ctx, _cache) => {
|
|
57
|
+
return openBlock(), createElementBlock("svg", mergeProps({
|
|
58
|
+
"data-eldra-ui": "",
|
|
59
|
+
"data-eldra-scope": unref(eldra).scope,
|
|
60
|
+
"data-part": "flag",
|
|
61
|
+
class: "eldra:h-3.5 eldra:w-5 eldra:shrink-0 eldra:eldra-phone-flag",
|
|
62
|
+
preserveAspectRatio: "none",
|
|
63
|
+
focusable: "false"
|
|
64
|
+
}, {
|
|
65
|
+
...named.value,
|
|
66
|
+
...drawn.value
|
|
67
|
+
}), null, 16, _hoisted_1);
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
export { preloadCountryFlags as n, CountryFlag_default as t };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { G as FIELD_KEY, P as FIELD_TEXT, Q as useUiId, W as useEldraUiLocale, X as useControllableModel, Z as joinIds, c as useOptionList, d as SelectPanel_default, k as FIELD_RADIUS, t as usePopover, u as useListbox } from "./usePopover-ECHpsSRF.js";
|
|
2
|
+
import { r as useEldraScope } from "./useEldraScope-BDbGzt7R.js";
|
|
3
|
+
import { i as enUS, r as useMessages } from "./useMessages-CkhrRmu7.js";
|
|
4
|
+
import { t as CountryFlag_default } from "./CountryFlag-DOa8lOHp.js";
|
|
5
|
+
import { Fragment, Teleport, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, inject, mergeProps, nextTick, normalizeClass, onMounted, openBlock, ref, renderSlot, toDisplayString, toValue, unref, watch, withCtx } from "vue";
|
|
4
6
|
import { comparator } from "@eldrajs/sdk/format";
|
|
5
7
|
import { AsYouType, Metadata, getCountries, getCountryCallingCode, getExampleNumber, isSupportedCountry, parseIncompletePhoneNumber, parsePhoneNumberFromString } from "libphonenumber-js/min";
|
|
6
8
|
import examples from "libphonenumber-js/mobile/examples";
|
|
@@ -46,34 +48,6 @@ function phoneExample(country) {
|
|
|
46
48
|
if (!isSupportedCountry(country)) return void 0;
|
|
47
49
|
return getExampleNumber(country, examples)?.formatNational();
|
|
48
50
|
}
|
|
49
|
-
// src/phone/flags.ts
|
|
50
|
-
/**
|
|
51
|
-
* The flag artwork is 46 kB gzipped, so it is one lazy chunk, fetched when the first `PhoneInput`
|
|
52
|
-
* mounts in a browser and shared by every one after it. Until it arrives a flag is an empty box of
|
|
53
|
-
* the same size, so nothing moves when it does. A server render never loads it: the server and the
|
|
54
|
-
* client's first render both draw the empty box, and agree.
|
|
55
|
-
*/
|
|
56
|
-
var flags = shallowRef(null);
|
|
57
|
-
var loading;
|
|
58
|
-
/** Loads the flags. Safe to call more than once, and ahead of a `PhoneInput` to draw them sooner. */
|
|
59
|
-
function preloadPhoneFlags() {
|
|
60
|
-
loading ??= import("./phoneFlagData-D9dDT2uC.js").then((module) => {
|
|
61
|
-
flags.value = module.default;
|
|
62
|
-
}, () => {
|
|
63
|
-
loading = void 0;
|
|
64
|
-
});
|
|
65
|
-
return loading;
|
|
66
|
-
}
|
|
67
|
-
/** A country's flag once the chunk is in; reactive, so a flag drawn before then fills in. */
|
|
68
|
-
function phoneFlag(country) {
|
|
69
|
-
const entry = flags.value?.[country];
|
|
70
|
-
if (entry === void 0) return void 0;
|
|
71
|
-
const cut = entry.indexOf("|");
|
|
72
|
-
return {
|
|
73
|
-
viewBox: entry.slice(0, cut),
|
|
74
|
-
body: entry.slice(cut + 1)
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
51
|
// src/phone/phone.ts
|
|
78
52
|
/**
|
|
79
53
|
* Everything `@eldrajs/ui/phone` knows about phone numbers, with no Vue in it. This file and
|
|
@@ -196,33 +170,6 @@ function readPhone(value, country, allowed = () => true) {
|
|
|
196
170
|
};
|
|
197
171
|
return state;
|
|
198
172
|
}
|
|
199
|
-
// src/phone/PhoneFlag.vue?vue&type=script&setup=true&lang.ts
|
|
200
|
-
var _hoisted_1$1 = ["data-eldra-scope"];
|
|
201
|
-
// src/phone/PhoneFlag.vue
|
|
202
|
-
var PhoneFlag_default = /* @__PURE__ */ defineComponent({
|
|
203
|
-
__name: "PhoneFlag",
|
|
204
|
-
props: { country: {} },
|
|
205
|
-
setup(__props) {
|
|
206
|
-
const props = __props;
|
|
207
|
-
const eldra = useEldraScope();
|
|
208
|
-
const art = computed(() => phoneFlag(props.country));
|
|
209
|
-
const drawn = computed(() => art.value === void 0 ? {} : {
|
|
210
|
-
viewBox: art.value.viewBox,
|
|
211
|
-
innerHTML: art.value.body
|
|
212
|
-
});
|
|
213
|
-
return (_ctx, _cache) => {
|
|
214
|
-
return openBlock(), createElementBlock("svg", mergeProps({
|
|
215
|
-
"data-eldra-ui": "",
|
|
216
|
-
"data-eldra-scope": unref(eldra).scope,
|
|
217
|
-
"data-part": "flag",
|
|
218
|
-
class: "eldra:h-3.5 eldra:w-5 eldra:shrink-0 eldra:eldra-phone-flag",
|
|
219
|
-
preserveAspectRatio: "none",
|
|
220
|
-
"aria-hidden": "true",
|
|
221
|
-
focusable: "false"
|
|
222
|
-
}, drawn.value), null, 16, _hoisted_1$1);
|
|
223
|
-
};
|
|
224
|
-
}
|
|
225
|
-
});
|
|
226
173
|
// src/phone/rule.ts
|
|
227
174
|
/** A country's name in `locale` (`IS`, `is-IS` → `Ísland`); the code itself when it has none. */
|
|
228
175
|
function phoneCountryName(country, locale) {
|
|
@@ -429,7 +376,6 @@ var PhoneInput_default = /* @__PURE__ */ defineComponent({
|
|
|
429
376
|
});
|
|
430
377
|
onMounted(() => {
|
|
431
378
|
if (props.country !== void 0 && props.country !== country.value) emit("update:country", country.value);
|
|
432
|
-
preloadPhoneFlags();
|
|
433
379
|
});
|
|
434
380
|
const controlRef = ref(null);
|
|
435
381
|
function onInput(event) {
|
|
@@ -620,7 +566,7 @@ var PhoneInput_default = /* @__PURE__ */ defineComponent({
|
|
|
620
566
|
createElementVNode("span", {
|
|
621
567
|
"data-eldra-slot": unref(eldra).slotHost("flag"),
|
|
622
568
|
class: "eldra:flex eldra:shrink-0"
|
|
623
|
-
}, [renderSlot(_ctx.$slots, "flag", { country: country.value }, () => [createVNode(
|
|
569
|
+
}, [renderSlot(_ctx.$slots, "flag", { country: country.value }, () => [createVNode(CountryFlag_default, {
|
|
624
570
|
country: country.value,
|
|
625
571
|
class: normalizeClass(__props.classes?.flag)
|
|
626
572
|
}, null, 8, ["country", "class"])])], 8, _hoisted_3),
|
|
@@ -705,7 +651,7 @@ var PhoneInput_default = /* @__PURE__ */ defineComponent({
|
|
|
705
651
|
onKeydown: unref(listbox).onKeydown
|
|
706
652
|
}, {
|
|
707
653
|
optionContent: withCtx(({ option, match }) => [
|
|
708
|
-
renderSlot(_ctx.$slots, "flag", { country: option.value }, () => [createVNode(
|
|
654
|
+
renderSlot(_ctx.$slots, "flag", { country: option.value }, () => [createVNode(CountryFlag_default, {
|
|
709
655
|
country: option.value,
|
|
710
656
|
class: normalizeClass(__props.classes?.flag)
|
|
711
657
|
}, null, 8, ["country", "class"])]),
|
|
@@ -746,4 +692,4 @@ var PhoneInput_default = /* @__PURE__ */ defineComponent({
|
|
|
746
692
|
};
|
|
747
693
|
}
|
|
748
694
|
});
|
|
749
|
-
export { parsePhone as a,
|
|
695
|
+
export { parsePhone as a, phoneExample as c, isValidPhone as i, phoneCountryName as n, phoneCallingCode as o, phoneRule as r, phoneCountries as s, PhoneInput_default as t };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { r as
|
|
1
|
+
import { A as FIELD_SEARCH_APPEARANCE, D as FIELD_PREFIX_PAD, E as FIELD_LIVE, F as FIELD_TRAILING_PAD, G as FIELD_KEY, I as FIELD_TRAILING_PAD_PAIR, J as ICON_STROKE_WIDTH$1, K as Spinner_default, L as fieldState, M as FIELD_SUFFIX_ROW, N as FIELD_SUFFIX_ROW_BASE, O as FIELD_PREFIX_ROW, P as FIELD_TEXT, Q as useUiId, S as FIELD_CLEAR_SIZE, W as useEldraUiLocale, X as useControllableModel, Y as mergeClass, Z as joinIds, _ as FIELD_ACTION_ROOM_REM, b as FIELD_CLEAR_BUTTON, c as useOptionList, d as SelectPanel_default, f as TRIGGER_VALUE_CELL, g as FIELD_ACTION_PAIR_SIZE, h as optionSwatchClass, j as FIELD_SIZE, k as FIELD_RADIUS, m as optionIconClass, p as TRIGGER_VALUE_STACK, q as ICON_SIZE_CLASS, s as matchRange, t as usePopover, u as useListbox, v as FIELD_BASE, w as FIELD_LEADING_ICON, x as FIELD_CLEAR_BUTTON_BOX, y as FIELD_BOX } from "./usePopover-ECHpsSRF.js";
|
|
2
|
+
import { r as useEldraScope } from "./useEldraScope-BDbGzt7R.js";
|
|
3
|
+
import { r as useMessages } from "./useMessages-CkhrRmu7.js";
|
|
3
4
|
import { Comment, Fragment, Teleport, Text, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createStaticVNode, createTextVNode, createVNode, defineComponent, getCurrentInstance, guardReactiveProps, h, inject, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onBeforeUnmount, onBeforeUpdate, onMounted, onUpdated, openBlock, provide, ref, renderList, renderSlot, resolveDynamicComponent, shallowRef, toDisplayString, toHandlers, toValue, unref, useAttrs, useSlots, watch, watchPostEffect, withCtx, withModifiers } from "vue";
|
|
4
5
|
import { numberFormat } from "@eldrajs/sdk/format";
|
|
5
6
|
// src/components/form-layout/context.ts
|
|
@@ -3849,6 +3850,10 @@ var MultiSelect_default = /* @__PURE__ */ defineComponent({
|
|
|
3849
3850
|
tagPlacement: { default: "below" },
|
|
3850
3851
|
maxTagRows: { default: 2 },
|
|
3851
3852
|
maxSummary: { default: "fit" },
|
|
3853
|
+
selectAll: {
|
|
3854
|
+
type: Boolean,
|
|
3855
|
+
default: true
|
|
3856
|
+
},
|
|
3852
3857
|
classes: { default: void 0 },
|
|
3853
3858
|
options: {},
|
|
3854
3859
|
name: { default: void 0 },
|
|
@@ -4174,6 +4179,21 @@ var MultiSelect_default = /* @__PURE__ */ defineComponent({
|
|
|
4174
4179
|
return true;
|
|
4175
4180
|
}
|
|
4176
4181
|
/**
|
|
4182
|
+
* What "Select all" would add: every enabled option the list is showing (all of them, or a
|
|
4183
|
+
* search's matches; the render batch does not limit it) that is not selected yet.
|
|
4184
|
+
*/
|
|
4185
|
+
const selectableValues = computed(() => {
|
|
4186
|
+
const chosen = new Set(model.value);
|
|
4187
|
+
return listOptions.value.filter((option) => option.value !== "\0eldra-create" && option.disabled !== true && !chosen.has(option.value)).map((option) => option.value);
|
|
4188
|
+
});
|
|
4189
|
+
const canSelectAll = computed(() => !props.disabled && !props.readonly && selectableValues.value.length > 0);
|
|
4190
|
+
/** Adds them after what is already chosen, in list order; focus follows the footer Clear's rule. */
|
|
4191
|
+
function onSelectAll() {
|
|
4192
|
+
if (canSelectAll.value) commit([...model.value, ...selectableValues.value]);
|
|
4193
|
+
if (searchable.value) searchRef.value?.focus();
|
|
4194
|
+
else triggerRef.value?.focus();
|
|
4195
|
+
}
|
|
4196
|
+
/**
|
|
4177
4197
|
* The trigger's clear button. Focus goes back to the trigger — except while the panel is open with a
|
|
4178
4198
|
* search field, where focus belongs in that field: it is the element carrying
|
|
4179
4199
|
* `aria-activedescendant` (the trigger drops it the moment the search field takes focus), so
|
|
@@ -4316,6 +4336,7 @@ var MultiSelect_default = /* @__PURE__ */ defineComponent({
|
|
|
4316
4336
|
const footerCountClass = computed(() => ["eldra:text-caption eldra:me-auto eldra:tabular-nums eldra:text-[color:var(--eldra-select-panel-muted,var(--eldra-color-muted))]", props.classes?.footerCount]);
|
|
4317
4337
|
/** Spec: "Clear = Button link sm (0.5rem side padding), Done = Button primary sm." */
|
|
4318
4338
|
const footerClearClass = computed(() => ["eldra:px-2", props.classes?.footerClear]);
|
|
4339
|
+
const footerSelectAllClass = computed(() => ["eldra:px-2", props.classes?.footerSelectAll]);
|
|
4319
4340
|
const footerDoneClass = computed(() => props.classes?.footerDone);
|
|
4320
4341
|
const emptyText = computed(() => query.value.trim() === "" ? m.value.noResults : m.value.noMatchesFor(query.value.trim()));
|
|
4321
4342
|
return (_ctx, _cache) => {
|
|
@@ -4563,6 +4584,19 @@ var MultiSelect_default = /* @__PURE__ */ defineComponent({
|
|
|
4563
4584
|
class: normalizeClass(footerCountClass.value),
|
|
4564
4585
|
"aria-live": "polite"
|
|
4565
4586
|
}, toDisplayString(countText.value), 3),
|
|
4587
|
+
props.selectAll ? (openBlock(), createBlock(Button_default, {
|
|
4588
|
+
key: 0,
|
|
4589
|
+
variant: "link",
|
|
4590
|
+
size: "sm",
|
|
4591
|
+
type: "button",
|
|
4592
|
+
"data-part": "footerSelectAll",
|
|
4593
|
+
class: normalizeClass(footerSelectAllClass.value),
|
|
4594
|
+
disabled: !canSelectAll.value,
|
|
4595
|
+
onClick: onSelectAll
|
|
4596
|
+
}, {
|
|
4597
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(m).selectAll), 1)]),
|
|
4598
|
+
_: 1
|
|
4599
|
+
}, 8, ["class", "disabled"])) : createCommentVNode("", true),
|
|
4566
4600
|
createVNode(Button_default, {
|
|
4567
4601
|
variant: "link",
|
|
4568
4602
|
size: "sm",
|
|
@@ -82,6 +82,7 @@ declare const __VLS_base: import('vue').DefineComponent<MultiSelectProps, {}, {}
|
|
|
82
82
|
required: boolean;
|
|
83
83
|
placeholder: string;
|
|
84
84
|
loading: boolean;
|
|
85
|
+
selectAll: boolean;
|
|
85
86
|
id: string;
|
|
86
87
|
leadingIcon: import('../../index.js').IconComponent;
|
|
87
88
|
disabled: boolean;
|
|
@@ -112,6 +113,7 @@ declare const __VLS_base: import('vue').DefineComponent<MultiSelectProps, {}, {}
|
|
|
112
113
|
selectedCount: (n: number) => string;
|
|
113
114
|
noneSelected: string;
|
|
114
115
|
done: string;
|
|
116
|
+
selectAll: string;
|
|
115
117
|
decrease: string;
|
|
116
118
|
increase: string;
|
|
117
119
|
quantity: string;
|
|
@@ -135,7 +135,7 @@ export interface SelectProps {
|
|
|
135
135
|
* none either. Both are kept in the union rather than subtracted from it, so that one `classes`
|
|
136
136
|
* object can be handed to either control.
|
|
137
137
|
*/
|
|
138
|
-
export type MultiSelectPart = SelectPart | 'summary' | 'summaryMore' | 'tags' | 'tag' | 'tagRemove' | 'tagMore' | 'field' | 'footer' | 'footerCount' | 'footerClear' | 'footerDone';
|
|
138
|
+
export type MultiSelectPart = SelectPart | 'summary' | 'summaryMore' | 'tags' | 'tag' | 'tagRemove' | 'tagMore' | 'field' | 'footer' | 'footerCount' | 'footerSelectAll' | 'footerClear' | 'footerDone';
|
|
139
139
|
/**
|
|
140
140
|
* Everything a `Select` takes except the three the spec redefines: the value is a list, the
|
|
141
141
|
* placeholder's default is `"Any"` rather than `"Select"`, and there is no `clearable` — "the clear
|
|
@@ -165,6 +165,12 @@ export interface MultiSelectProps extends Omit<SelectProps, 'modelValue' | 'plac
|
|
|
165
165
|
* exactly that many.
|
|
166
166
|
*/
|
|
167
167
|
maxSummary?: number | 'fit';
|
|
168
|
+
/**
|
|
169
|
+
* A "Select all" button in the footer, before Clear. It adds every option the list is showing,
|
|
170
|
+
* so with a search typed it selects the matches only; disabled options are left as they are.
|
|
171
|
+
* It is disabled once all of them are selected. On by default; `false` leaves it out.
|
|
172
|
+
*/
|
|
173
|
+
selectAll?: boolean;
|
|
168
174
|
/**
|
|
169
175
|
* Per-part classes, appended to the part's own (they win by cascade layer). Style the root with
|
|
170
176
|
* `class`.
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
|
+
/** ISO 3166-1 alpha-2 code, in either case (`IS`, `no`). */
|
|
2
3
|
country: string;
|
|
4
|
+
/** Names the flag for assistive technology. Leave it out where the country is named in text. */
|
|
5
|
+
label?: string;
|
|
3
6
|
};
|
|
4
7
|
declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
5
8
|
declare const _default: typeof __VLS_export;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Loads the flags. Safe to call more than once, and ahead of a flag to draw it sooner. */
|
|
2
|
+
export declare function preloadCountryFlags(): Promise<void>;
|
|
3
|
+
export interface CountryFlagArt {
|
|
4
|
+
viewBox: string;
|
|
5
|
+
body: string;
|
|
6
|
+
}
|
|
7
|
+
/** A country's flag once the chunk is in; reactive, so a flag drawn before then fills in. */
|
|
8
|
+
export declare function countryFlag(country: string): CountryFlagArt | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@eldrajs/ui/flag`: a country's flag, for a country select, an address or a language switch.
|
|
3
|
+
*
|
|
4
|
+
* Its own entry because of its artwork: one lazy chunk of about 46 kB gzipped that the root entry
|
|
5
|
+
* must never reach. It needs no peer; `@eldrajs/ui/phone` draws its flags with the same component
|
|
6
|
+
* and shares the chunk.
|
|
7
|
+
*/
|
|
8
|
+
export { default as CountryFlag } from './CountryFlag.vue.js';
|
|
9
|
+
export { preloadCountryFlags } from './flags.js';
|
package/dist/flag.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as CountryFlag, n as preloadCountryFlags } from "./CountryFlag-DOa8lOHp.js";
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { A as FIELD_SEARCH_APPEARANCE, B as LOCALE_KEY, C as FIELD_DISABLED, E as FIELD_LIVE, G as FIELD_KEY, H as provideEldraUiLocale, J as ICON_STROKE_WIDTH$6, K as Spinner_default, Q as useUiId, R as CURRENCY_KEY, U as useEldraUiCurrency, V as provideEldraUiCurrency, W as useEldraUiLocale, X as useControllableModel, Y as mergeClass, Z as joinIds, a as useFloating, i as useTeleportTarget, j as FIELD_SIZE, l as normalizeText, n as useOverlay, q as ICON_SIZE_CLASS, r as topLayerDialog, s as matchRange, t as usePopover, u as useListbox, v as FIELD_BASE, x as FIELD_CLEAR_BUTTON_BOX, z as DEFAULT_UI_LOCALE } from "./usePopover-ECHpsSRF.js";
|
|
2
|
+
import { n as provideEldraScope, r as useEldraScope, t as ELDRA_SCOPE_KEY } from "./useEldraScope-BDbGzt7R.js";
|
|
3
|
+
import { i as enUS, n as provideEldraUiMessages, r as useMessages, t as MESSAGES_KEY } from "./useMessages-CkhrRmu7.js";
|
|
4
|
+
import { $ as FORM_SUBMITTING_KEY, A as UnitInput_default, B as useSlotPresence, C as Switch_default, D as defaultCharacterMeaning, E as applyMask, F as formatCurrency, G as CheckboxGroup_default, H as TAG_FILL, I as formatNumber, J as RequiredMark_default, K as Checkbox_default, L as formatUnit, M as currencyFractionDigits, N as currencySymbol, O as stripMask, P as defaultUnitFormat, Q as FORM_LAYOUT_KEY, R as localeSeparators, S as focusInvalid, T as Input_default, U as TAG_SHAPE, V as useHeadingTag, W as tagPadding, X as Button_default, Y as FieldError_default, Z as Icon_default, _ as optionCursor, a as claimShortcut, b as MultiSelect_default, c as SearchResultsPanel_default, d as INPUT, f as PLAIN_BOX_ONLY, g as labelRecipe, h as dotRecipe, i as SearchBar_default, j as createNumberFormat, k as CurrencyInput_default, l as RadioGroup_default, m as PLAIN_OPTION, n as Textarea_default, o as ownsShortcut, p as PLAIN_COLUMNS, q as VisuallyHidden_default, r as Select_default, s as releaseShortcut, t as VariantPicker_default, u as HINT, v as radioRecipe, w as filterNumericBeforeInput, x as FormLayout_default, y as QuantityStepper_default, z as parseLocaleNumber } from "./VariantPicker-BqLbiONX.js";
|
|
4
5
|
import { Comment, Fragment, Teleport, Text, Transition, cloneVNode, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, guardReactiveProps, h, inject, isRef, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onBeforeUnmount, onMounted, onServerPrefetch, onUnmounted, onUpdated, openBlock, provide, reactive, ref, renderList, renderSlot, resolveDynamicComponent, shallowRef, toDisplayString, toRef, toValue, unref, useAttrs, useId, useSlots, useTemplateRef, vModelText, vShow, watch, withCtx, withDirectives, withKeys, withModifiers } from "vue";
|
|
5
6
|
import { dateTimeFormat } from "@eldrajs/sdk/format/date";
|
|
6
7
|
// src/components/accordion/context.ts
|
package/dist/messages/en-US.d.ts
CHANGED
|
@@ -82,6 +82,8 @@ export declare const enUS: {
|
|
|
82
82
|
noneSelected: string;
|
|
83
83
|
/** Closes a `MultiSelect`'s popover. It commits nothing: every toggle already applied. */
|
|
84
84
|
done: string;
|
|
85
|
+
/** A `MultiSelect` footer's button that selects every option shown (`selectAll`). */
|
|
86
|
+
selectAll: string;
|
|
85
87
|
/** The accessible name of a `QuantityStepper`'s minus button. */
|
|
86
88
|
decrease: string;
|
|
87
89
|
/** The accessible name of a `QuantityStepper`'s plus button. */
|
package/dist/messages/is-IS.js
CHANGED
package/dist/phone/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export { default as PhoneInput } from './PhoneInput.vue.js';
|
|
9
9
|
export { phoneExample } from './examples.js';
|
|
10
|
-
export { preloadPhoneFlags } from '
|
|
10
|
+
export { preloadCountryFlags as preloadPhoneFlags } from '../flag/flags.js';
|
|
11
11
|
export { isValidPhone, parsePhone, phoneCallingCode, phoneCountries, type PhoneParts, } from './phone.js';
|
|
12
12
|
export { phoneCountryName, phoneRule, type PhoneRuleOptions } from './rule.js';
|
|
13
13
|
export type { PhoneInputChange, PhoneInputPart, PhoneInputProps, PhoneInputSize } from './types.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { W as useEldraUiLocale } from "../usePopover-
|
|
2
|
-
import { r as useMessages } from "../useMessages-
|
|
3
|
-
import { a as useControlProps, n as FIELD_ONLY, o as useFieldControl, r as FIELD_VALIDATION_DEFAULTS } from "../useFieldControl-
|
|
4
|
-
import { r as phoneRule, t as PhoneInput_default } from "../PhoneInput-
|
|
1
|
+
import { W as useEldraUiLocale } from "../usePopover-ECHpsSRF.js";
|
|
2
|
+
import { r as useMessages } from "../useMessages-CkhrRmu7.js";
|
|
3
|
+
import { a as useControlProps, n as FIELD_ONLY, o as useFieldControl, r as FIELD_VALIDATION_DEFAULTS } from "../useFieldControl-D1j54YON.js";
|
|
4
|
+
import { r as phoneRule, t as PhoneInput_default } from "../PhoneInput-CX83wgD0.js";
|
|
5
5
|
import { computed, createBlock, createSlots, defineComponent, guardReactiveProps, isRef, mergeDefaults, mergeProps, normalizeProps, openBlock, reactive, ref, renderList, renderSlot, toRefs, unref, withCtx } from "vue";
|
|
6
6
|
// src/phone/vee-validate/FieldPhoneInput.vue
|
|
7
7
|
var FieldPhoneInput_default = /* @__PURE__ */ defineComponent({
|
package/dist/phone.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import { a as parsePhone, c as phoneExample, i as isValidPhone, n as phoneCountryName, o as phoneCallingCode, r as phoneRule, s as phoneCountries, t as PhoneInput_default } from "./PhoneInput-CX83wgD0.js";
|
|
2
|
+
import { n as preloadCountryFlags } from "./CountryFlag-DOa8lOHp.js";
|
|
3
|
+
export { PhoneInput_default as PhoneInput, isValidPhone, parsePhone, phoneCallingCode, phoneCountries, phoneCountryName, phoneExample, phoneRule, preloadCountryFlags as preloadPhoneFlags };
|
package/dist/resolver.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export interface EldraUiResolverOptions {
|
|
|
4
4
|
}
|
|
5
5
|
interface ResolvedComponent {
|
|
6
6
|
name: string;
|
|
7
|
-
from: '@eldrajs/ui' | '@eldrajs/ui/phone';
|
|
7
|
+
from: '@eldrajs/ui' | '@eldrajs/ui/phone' | '@eldrajs/ui/flag';
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
10
|
* The components of `@eldrajs/ui/phone`, which the root entry does not export: that entry needs
|
|
@@ -12,6 +12,11 @@ interface ResolvedComponent {
|
|
|
12
12
|
* the phone one.
|
|
13
13
|
*/
|
|
14
14
|
export declare const phoneComponentNames: readonly ["PhoneInput"];
|
|
15
|
+
/**
|
|
16
|
+
* The components of `@eldrajs/ui/flag`, which the root entry does not export either: its artwork
|
|
17
|
+
* is a chunk the root entry must never reach.
|
|
18
|
+
*/
|
|
19
|
+
export declare const flagComponentNames: readonly ["CountryFlag"];
|
|
15
20
|
/**
|
|
16
21
|
* Resolver for [`unplugin-vue-components`](https://github.com/unplugin/unplugin-vue-components):
|
|
17
22
|
*
|
|
@@ -27,7 +32,8 @@ export declare const phoneComponentNames: readonly ["PhoneInput"];
|
|
|
27
32
|
* A template can then use `<EldraButton>`, `<EldraSelect>`, and so on, with no explicit import —
|
|
28
33
|
* the plugin rewrites the tag into `import { Button } from '@eldrajs/ui'` (auto-imported, not
|
|
29
34
|
* globally registered) the first time it sees it. `<EldraPhoneInput>` resolves the same way from
|
|
30
|
-
* `@eldrajs/ui/phone` (`phoneComponentNames`), the entry that needs `libphonenumber-js
|
|
35
|
+
* `@eldrajs/ui/phone` (`phoneComponentNames`), the entry that needs `libphonenumber-js`, and
|
|
36
|
+
* `<EldraCountryFlag>` from `@eldrajs/ui/flag` (`flagComponentNames`). `EldraUiResolver` resolves against exactly the
|
|
31
37
|
* names in `componentNames` (`src/index.ts`'s component exports — see
|
|
32
38
|
* `src/__tests__/componentNames.spec.ts` for the guard that keeps the two in sync); anything else,
|
|
33
39
|
* including the private library's own `Ui*` names, resolves to `undefined` and is left for another
|
package/dist/resolver.js
CHANGED
|
@@ -92,6 +92,12 @@ var componentNameSet = new Set(componentNames);
|
|
|
92
92
|
var phoneComponentNames = ["PhoneInput"];
|
|
93
93
|
var phoneComponentNameSet = new Set(phoneComponentNames);
|
|
94
94
|
/**
|
|
95
|
+
* The components of `@eldrajs/ui/flag`, which the root entry does not export either: its artwork
|
|
96
|
+
* is a chunk the root entry must never reach.
|
|
97
|
+
*/
|
|
98
|
+
var flagComponentNames = ["CountryFlag"];
|
|
99
|
+
var flagComponentNameSet = new Set(flagComponentNames);
|
|
100
|
+
/**
|
|
95
101
|
* Resolver for [`unplugin-vue-components`](https://github.com/unplugin/unplugin-vue-components):
|
|
96
102
|
*
|
|
97
103
|
* ```ts
|
|
@@ -106,7 +112,8 @@ var phoneComponentNameSet = new Set(phoneComponentNames);
|
|
|
106
112
|
* A template can then use `<EldraButton>`, `<EldraSelect>`, and so on, with no explicit import —
|
|
107
113
|
* the plugin rewrites the tag into `import { Button } from '@eldrajs/ui'` (auto-imported, not
|
|
108
114
|
* globally registered) the first time it sees it. `<EldraPhoneInput>` resolves the same way from
|
|
109
|
-
* `@eldrajs/ui/phone` (`phoneComponentNames`), the entry that needs `libphonenumber-js
|
|
115
|
+
* `@eldrajs/ui/phone` (`phoneComponentNames`), the entry that needs `libphonenumber-js`, and
|
|
116
|
+
* `<EldraCountryFlag>` from `@eldrajs/ui/flag` (`flagComponentNames`). `EldraUiResolver` resolves against exactly the
|
|
110
117
|
* names in `componentNames` (`src/index.ts`'s component exports — see
|
|
111
118
|
* `src/__tests__/componentNames.spec.ts` for the guard that keeps the two in sync); anything else,
|
|
112
119
|
* including the private library's own `Ui*` names, resolves to `undefined` and is left for another
|
|
@@ -131,7 +138,11 @@ function EldraUiResolver(options = {}) {
|
|
|
131
138
|
name: componentName,
|
|
132
139
|
from: "@eldrajs/ui/phone"
|
|
133
140
|
};
|
|
141
|
+
if (flagComponentNameSet.has(componentName)) return {
|
|
142
|
+
name: componentName,
|
|
143
|
+
from: "@eldrajs/ui/flag"
|
|
144
|
+
};
|
|
134
145
|
}
|
|
135
146
|
};
|
|
136
147
|
}
|
|
137
|
-
export { EldraUiResolver, componentNames, phoneComponentNames };
|
|
148
|
+
export { EldraUiResolver, componentNames, flagComponentNames, phoneComponentNames };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { inject, provide, useSlots } from "vue";
|
|
2
|
+
// src/composables/useEldraScope.ts
|
|
3
|
+
/** The injection key `provideEldraScope` provides under. */
|
|
4
|
+
var ELDRA_SCOPE_KEY = Symbol("eldra-scope");
|
|
5
|
+
/**
|
|
6
|
+
* Names a theming scope for every component of this package rendered below the caller (see the
|
|
7
|
+
* README, "Theming a subtree"). Call it in `setup()` of a wrapper or an app root.
|
|
8
|
+
*
|
|
9
|
+
* Each component then renders `data-eldra-scope="<name>"` on its root and on every part it
|
|
10
|
+
* teleports (panels, dialogs, toasts). The name is free; the consumer's own variable overrides
|
|
11
|
+
* target it (`[data-eldra-scope='studio'] { --eldra-color-primary: … }`). Without a provider the
|
|
12
|
+
* attribute is not rendered, so the output is unchanged.
|
|
13
|
+
*/
|
|
14
|
+
function provideEldraScope(name = "default") {
|
|
15
|
+
provide(ELDRA_SCOPE_KEY, name || "default");
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Internal: the theming hooks a component of this package binds. `scope` goes on every root,
|
|
19
|
+
* teleported root and kit-owned element sitting directly in a slot host, so a scope's variables
|
|
20
|
+
* reach it; it is `undefined` without a provider. `slotHost(...names)` is `data-eldra-slot`, on
|
|
21
|
+
* the element holding those slots, a hook for consumer CSS. It renders whenever one of the slots
|
|
22
|
+
* has content, provider or not, and never for a fallback, which is the kit's own markup.
|
|
23
|
+
*/
|
|
24
|
+
function useEldraScope() {
|
|
25
|
+
const scope = inject(ELDRA_SCOPE_KEY, void 0);
|
|
26
|
+
const slots = useSlots();
|
|
27
|
+
return {
|
|
28
|
+
scope,
|
|
29
|
+
slotHost: (...names) => names.some((name) => slots[name] !== void 0) ? "" : void 0
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export { provideEldraScope as n, useEldraScope as r, ELDRA_SCOPE_KEY as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as FIELD_KEY,
|
|
1
|
+
import { G as FIELD_KEY, Q as useUiId } from "./usePopover-ECHpsSRF.js";
|
|
2
2
|
import { computed, inject, onMounted, onScopeDispose, shallowRef, watch } from "vue";
|
|
3
3
|
import { FormContextKey, useField } from "vee-validate";
|
|
4
4
|
// src/vee-validate/context.ts
|
|
@@ -105,6 +105,8 @@ var enUS = {
|
|
|
105
105
|
noneSelected: "None selected",
|
|
106
106
|
/** Closes a `MultiSelect`'s popover. It commits nothing: every toggle already applied. */
|
|
107
107
|
done: "Done",
|
|
108
|
+
/** A `MultiSelect` footer's button that selects every option shown (`selectAll`). */
|
|
109
|
+
selectAll: "Select all",
|
|
108
110
|
/** The accessible name of a `QuantityStepper`'s minus button. */
|
|
109
111
|
decrease: "Decrease",
|
|
110
112
|
/** The accessible name of a `QuantityStepper`'s plus button. */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as useEldraScope } from "./useEldraScope-BDbGzt7R.js";
|
|
2
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, inject, mergeProps, nextTick, normalizeClass, normalizeStyle, onBeforeUnmount, onMounted, onScopeDispose, openBlock, provide, ref, renderList, renderSlot, resolveDynamicComponent, toDisplayString, toValue, unref, useAttrs, useId, watch } from "vue";
|
|
2
3
|
import { extendTailwindMerge } from "tailwind-merge";
|
|
3
4
|
import { autoUpdate, flip, offset, shift, size, useFloating } from "@floating-ui/vue";
|
|
4
5
|
// src/utils/id.ts
|
|
@@ -47,36 +48,6 @@ function joinIds(...ids) {
|
|
|
47
48
|
}
|
|
48
49
|
return seen.size > 0 ? [...seen].join(" ") : void 0;
|
|
49
50
|
}
|
|
50
|
-
// src/composables/useEldraScope.ts
|
|
51
|
-
/** The injection key `provideEldraScope` provides under. */
|
|
52
|
-
var ELDRA_SCOPE_KEY = Symbol("eldra-scope");
|
|
53
|
-
/**
|
|
54
|
-
* Names a theming scope for every component of this package rendered below the caller (see the
|
|
55
|
-
* README, "Theming a subtree"). Call it in `setup()` of a wrapper or an app root.
|
|
56
|
-
*
|
|
57
|
-
* Each component then renders `data-eldra-scope="<name>"` on its root and on every part it
|
|
58
|
-
* teleports (panels, dialogs, toasts). The name is free; the consumer's own variable overrides
|
|
59
|
-
* target it (`[data-eldra-scope='studio'] { --eldra-color-primary: … }`). Without a provider the
|
|
60
|
-
* attribute is not rendered, so the output is unchanged.
|
|
61
|
-
*/
|
|
62
|
-
function provideEldraScope(name = "default") {
|
|
63
|
-
provide(ELDRA_SCOPE_KEY, name || "default");
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Internal: the theming hooks a component of this package binds. `scope` goes on every root,
|
|
67
|
-
* teleported root and kit-owned element sitting directly in a slot host, so a scope's variables
|
|
68
|
-
* reach it; it is `undefined` without a provider. `slotHost(...names)` is `data-eldra-slot`, on
|
|
69
|
-
* the element holding those slots, a hook for consumer CSS. It renders whenever one of the slots
|
|
70
|
-
* has content, provider or not, and never for a fallback, which is the kit's own markup.
|
|
71
|
-
*/
|
|
72
|
-
function useEldraScope() {
|
|
73
|
-
const scope = inject(ELDRA_SCOPE_KEY, void 0);
|
|
74
|
-
const slots = useSlots();
|
|
75
|
-
return {
|
|
76
|
-
scope,
|
|
77
|
-
slotHost: (...names) => names.some((name) => slots[name] !== void 0) ? "" : void 0
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
51
|
// src/composables/useControllableModel.ts
|
|
81
52
|
/**
|
|
82
53
|
* A model that works both ways round: controlled when the parent passes
|
|
@@ -2225,4 +2196,4 @@ function usePopover(options) {
|
|
|
2225
2196
|
update
|
|
2226
2197
|
};
|
|
2227
2198
|
}
|
|
2228
|
-
export {
|
|
2199
|
+
export { FIELD_SEARCH_APPEARANCE as A, LOCALE_KEY as B, FIELD_DISABLED as C, FIELD_PREFIX_PAD as D, FIELD_LIVE as E, FIELD_TRAILING_PAD as F, FIELD_KEY as G, provideEldraUiLocale as H, FIELD_TRAILING_PAD_PAIR as I, ICON_STROKE_WIDTH as J, Spinner_default as K, fieldState as L, FIELD_SUFFIX_ROW as M, FIELD_SUFFIX_ROW_BASE as N, FIELD_PREFIX_ROW as O, FIELD_TEXT as P, useUiId as Q, CURRENCY_KEY as R, FIELD_CLEAR_SIZE as S, FIELD_LEADING_PAD as T, useEldraUiCurrency as U, provideEldraUiCurrency as V, useEldraUiLocale as W, useControllableModel as X, mergeClass as Y, joinIds as Z, FIELD_ACTION_ROOM_REM as _, useFloating$1 as a, FIELD_CLEAR_BUTTON as b, useOptionList as c, SelectPanel_default as d, TRIGGER_VALUE_CELL as f, FIELD_ACTION_PAIR_SIZE as g, optionSwatchClass as h, useTeleportTarget as i, FIELD_SIZE as j, FIELD_RADIUS as k, normalizeText as l, optionIconClass as m, useOverlay as n, CREATE_VALUE as o, TRIGGER_VALUE_STACK as p, ICON_SIZE_CLASS as q, topLayerDialog as r, matchRange as s, usePopover as t, useListbox as u, FIELD_BASE as v, FIELD_LEADING_ICON as w, FIELD_CLEAR_BUTTON_BOX as x, FIELD_BOX as y, DEFAULT_UI_LOCALE as z };
|
package/dist/vee-validate.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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-
|
|
2
|
-
import { r as useMessages } from "./useMessages-
|
|
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-
|
|
4
|
-
import {
|
|
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
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
6
|
import { useForm } from "vee-validate";
|
|
7
7
|
// src/vee-validate/Form.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -520,6 +520,7 @@ var FieldMultiSelect_default = /* @__PURE__ */ defineComponent({
|
|
|
520
520
|
tagPlacement: {},
|
|
521
521
|
maxTagRows: {},
|
|
522
522
|
maxSummary: {},
|
|
523
|
+
selectAll: { type: Boolean },
|
|
523
524
|
classes: {},
|
|
524
525
|
options: {},
|
|
525
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";
|
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",
|
|
@@ -46,6 +46,10 @@
|
|
|
46
46
|
"types": "./dist/vue-i18n/index.d.ts",
|
|
47
47
|
"import": "./dist/vue-i18n.js"
|
|
48
48
|
},
|
|
49
|
+
"./flag": {
|
|
50
|
+
"types": "./dist/flag/index.d.ts",
|
|
51
|
+
"import": "./dist/flag.js"
|
|
52
|
+
},
|
|
49
53
|
"./phone": {
|
|
50
54
|
"types": "./dist/phone/index.d.ts",
|
|
51
55
|
"import": "./dist/phone.js"
|
package/dist/phone/flags.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/** Loads the flags. Safe to call more than once, and ahead of a `PhoneInput` to draw them sooner. */
|
|
2
|
-
export declare function preloadPhoneFlags(): Promise<void>;
|
|
3
|
-
export interface PhoneFlagArt {
|
|
4
|
-
viewBox: string;
|
|
5
|
-
body: string;
|
|
6
|
-
}
|
|
7
|
-
/** A country's flag once the chunk is in; reactive, so a flag drawn before then fills in. */
|
|
8
|
-
export declare function phoneFlag(country: string): PhoneFlagArt | undefined;
|