@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
|
@@ -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 };
|