@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.
Files changed (61) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/LICENSE-country-flag-icons +25 -0
  3. package/README.md +274 -66
  4. package/dist/CountryFlag-DOa8lOHp.js +71 -0
  5. package/dist/PhoneInput-CX83wgD0.js +695 -0
  6. package/dist/{VariantPicker-Cr_AkX47.js → VariantPicker-BqLbiONX.js} +122 -2302
  7. package/dist/components/chip/Chip.vue.d.ts +9 -0
  8. package/dist/components/dialog/Dialog.vue.d.ts +9 -0
  9. package/dist/components/drawer/Drawer.vue.d.ts +9 -0
  10. package/dist/components/filter-panel/FilterGroup.vue.d.ts +9 -0
  11. package/dist/components/filter-panel/FilterPanel.vue.d.ts +9 -0
  12. package/dist/components/filter-panel/facets/ColourFacet.vue.d.ts +9 -0
  13. package/dist/components/filter-panel/facets/ListFacet.vue.d.ts +9 -0
  14. package/dist/components/filter-panel/facets/RangeFacet.vue.d.ts +9 -0
  15. package/dist/components/filter-panel/facets/SizeFacet.vue.d.ts +9 -0
  16. package/dist/components/filter-panel/facets/ToggleFacet.vue.d.ts +9 -0
  17. package/dist/components/lightbox/Lightbox.vue.d.ts +9 -0
  18. package/dist/components/nav-menu/NavMenu.vue.d.ts +9 -0
  19. package/dist/components/pagination/Pagination.vue.d.ts +9 -0
  20. package/dist/components/range-slider/RangeSlider.vue.d.ts +9 -0
  21. package/dist/components/search-bar/SearchBar.vue.d.ts +9 -0
  22. package/dist/components/search-modal/SearchModal.vue.d.ts +9 -0
  23. package/dist/components/select/MultiSelect.vue.d.ts +10 -0
  24. package/dist/components/select/Select.vue.d.ts +9 -0
  25. package/dist/components/select/types.d.ts +7 -1
  26. package/dist/components/site-form/SiteForm.vue.d.ts +9 -0
  27. package/dist/components/toast/Toast.vue.d.ts +9 -0
  28. package/dist/components/toast/Toaster.vue.d.ts +9 -0
  29. package/dist/components.css +64 -0
  30. package/dist/flag/CountryFlag.vue.d.ts +9 -0
  31. package/dist/flag/flags.d.ts +8 -0
  32. package/dist/flag/index.d.ts +9 -0
  33. package/dist/flag.js +1 -0
  34. package/dist/index.js +4 -2
  35. package/dist/messages/en-US.d.ts +21 -0
  36. package/dist/messages/is-IS.js +10 -1
  37. package/dist/phone/PhoneInput.vue.d.ts +221 -0
  38. package/dist/phone/caret.d.ts +14 -0
  39. package/dist/phone/examples.d.ts +2 -0
  40. package/dist/phone/index.d.ts +13 -0
  41. package/dist/phone/phone.d.ts +62 -0
  42. package/dist/phone/phoneFlagData.d.ts +2 -0
  43. package/dist/phone/rule.d.ts +22 -0
  44. package/dist/phone/types.d.ts +63 -0
  45. package/dist/phone/vee-validate/FieldPhoneInput.vue.d.ts +24 -0
  46. package/dist/phone/vee-validate/index.d.ts +3 -0
  47. package/dist/phone/vee-validate/types.d.ts +3 -0
  48. package/dist/phone/vee-validate.js +96 -0
  49. package/dist/phone.js +3 -0
  50. package/dist/phoneFlagData-D9dDT2uC.js +261 -0
  51. package/dist/resolver.d.ts +15 -2
  52. package/dist/resolver.js +26 -4
  53. package/dist/style.css +64 -0
  54. package/dist/useEldraScope-BDbGzt7R.js +32 -0
  55. package/dist/useFieldControl-D1j54YON.js +273 -0
  56. package/dist/{useMessages-DOHGfip_.js → useMessages-CkhrRmu7.js} +22 -1
  57. package/dist/usePopover-ECHpsSRF.js +2199 -0
  58. package/dist/utilities.css +37 -0
  59. package/dist/vee-validate.js +7 -273
  60. package/dist/vue-i18n.js +4 -1
  61. 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 };