@brumaombra/ui-vintage 0.5.0 → 0.5.1

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.
@@ -0,0 +1,18 @@
1
+ import { openBlock, createElementBlock, createStaticVNode } from "vue";
2
+ import { _ as _export_sfc } from "./_plugin-vue_export-helper-1tPrXgE0.js";
3
+ const _sfc_main = {};
4
+ const _hoisted_1 = {
5
+ xmlns: "http://www.w3.org/2000/svg",
6
+ viewBox: "0 0 640 480",
7
+ "aria-hidden": "true",
8
+ focusable: "false"
9
+ };
10
+ function _sfc_render(_ctx, _cache) {
11
+ return openBlock(), createElementBlock("svg", _hoisted_1, _cache[0] || (_cache[0] = [
12
+ createStaticVNode('<path fill="#ee1c25" d="M0 0h640v480H0z"></path><path fill="#ff0" d="M76.8 177.6 120 48l43.2 129.6H48z" transform="matrix(.55555 0 0 .55555 53.333 53.333)"></path><path fill="#ff0" d="M76.8 177.6 120 48l43.2 129.6H48z" transform="matrix(-.0955 -.15916 .15916 -.0955 240.3 48)"></path><path fill="#ff0" d="M76.8 177.6 120 48l43.2 129.6H48z" transform="matrix(-.0262 -.18395 .18395 -.0262 288 95.8)"></path><path fill="#ff0" d="M76.8 177.6 120 48l43.2 129.6H48z" transform="matrix(.0511 -.17849 .17849 .0511 288 168)"></path><path fill="#ff0" d="M76.8 177.6 120 48l43.2 129.6H48z" transform="matrix(.1161 -.14497 .14497 .1161 240 216)"></path>', 6)
13
+ ]));
14
+ }
15
+ const ChineseFlag = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
16
+ export {
17
+ ChineseFlag as default
18
+ };
@@ -0,0 +1,18 @@
1
+ import { openBlock, createElementBlock, createStaticVNode } from "vue";
2
+ import { _ as _export_sfc } from "./_plugin-vue_export-helper-1tPrXgE0.js";
3
+ const _sfc_main = {};
4
+ const _hoisted_1 = {
5
+ xmlns: "http://www.w3.org/2000/svg",
6
+ viewBox: "0 0 640 480",
7
+ "aria-hidden": "true",
8
+ focusable: "false"
9
+ };
10
+ function _sfc_render(_ctx, _cache) {
11
+ return openBlock(), createElementBlock("svg", _hoisted_1, _cache[0] || (_cache[0] = [
12
+ createStaticVNode('<path fill="#012169" d="M0 0h640v480H0z"></path><path fill="#FFF" d="m75 0 244 181L562 0h78v62L400 241l240 178v61h-80L320 301 81 480H0v-60l239-178L0 64V0z"></path><path fill="#C8102E" d="m424 281 216 159v40L369 281zm-184 20 6 35L54 480H0zM640 0v3L391 191l2-44L590 0zM0 0l239 176h-60L0 42z"></path><path fill="#FFF" d="M241 0v480h160V0zM0 160v160h640V160z"></path><path fill="#C8102E" d="M0 193v96h640v-96zM273 0v480h96V0z"></path>', 5)
13
+ ]));
14
+ }
15
+ const EnglishFlag = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
16
+ export {
17
+ EnglishFlag as default
18
+ };
@@ -0,0 +1,35 @@
1
+ import { openBlock, createElementBlock, createElementVNode } from "vue";
2
+ import { _ as _export_sfc } from "./_plugin-vue_export-helper-1tPrXgE0.js";
3
+ const _sfc_main = {};
4
+ const _hoisted_1 = {
5
+ xmlns: "http://www.w3.org/2000/svg",
6
+ viewBox: "0 0 3 2",
7
+ "aria-hidden": "true",
8
+ focusable: "false"
9
+ };
10
+ function _sfc_render(_ctx, _cache) {
11
+ return openBlock(), createElementBlock("svg", _hoisted_1, _cache[0] || (_cache[0] = [
12
+ createElementVNode("rect", {
13
+ width: "1",
14
+ height: "2",
15
+ x: "0",
16
+ fill: "#002654"
17
+ }, null, -1),
18
+ createElementVNode("rect", {
19
+ width: "1",
20
+ height: "2",
21
+ x: "1",
22
+ fill: "#ffffff"
23
+ }, null, -1),
24
+ createElementVNode("rect", {
25
+ width: "1",
26
+ height: "2",
27
+ x: "2",
28
+ fill: "#ce1126"
29
+ }, null, -1)
30
+ ]));
31
+ }
32
+ const FrenchFlag = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
33
+ export {
34
+ FrenchFlag as default
35
+ };
@@ -0,0 +1,35 @@
1
+ import { openBlock, createElementBlock, createElementVNode } from "vue";
2
+ import { _ as _export_sfc } from "./_plugin-vue_export-helper-1tPrXgE0.js";
3
+ const _sfc_main = {};
4
+ const _hoisted_1 = {
5
+ xmlns: "http://www.w3.org/2000/svg",
6
+ viewBox: "0 0 5 3",
7
+ "aria-hidden": "true",
8
+ focusable: "false"
9
+ };
10
+ function _sfc_render(_ctx, _cache) {
11
+ return openBlock(), createElementBlock("svg", _hoisted_1, _cache[0] || (_cache[0] = [
12
+ createElementVNode("rect", {
13
+ width: "5",
14
+ height: "1",
15
+ y: "0",
16
+ fill: "#000000"
17
+ }, null, -1),
18
+ createElementVNode("rect", {
19
+ width: "5",
20
+ height: "1",
21
+ y: "1",
22
+ fill: "#dd0000"
23
+ }, null, -1),
24
+ createElementVNode("rect", {
25
+ width: "5",
26
+ height: "1",
27
+ y: "2",
28
+ fill: "#ffce00"
29
+ }, null, -1)
30
+ ]));
31
+ }
32
+ const GermanFlag = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
33
+ export {
34
+ GermanFlag as default
35
+ };
@@ -0,0 +1,34 @@
1
+ import { openBlock, createElementBlock, createElementVNode } from "vue";
2
+ import { _ as _export_sfc } from "./_plugin-vue_export-helper-1tPrXgE0.js";
3
+ const _sfc_main = {};
4
+ const _hoisted_1 = {
5
+ xmlns: "http://www.w3.org/2000/svg",
6
+ viewBox: "0 0 640 480",
7
+ "aria-hidden": "true",
8
+ focusable: "false"
9
+ };
10
+ function _sfc_render(_ctx, _cache) {
11
+ return openBlock(), createElementBlock("svg", _hoisted_1, _cache[0] || (_cache[0] = [
12
+ createElementVNode("g", {
13
+ "fill-rule": "evenodd",
14
+ "stroke-width": "1pt"
15
+ }, [
16
+ createElementVNode("path", {
17
+ fill: "#fff",
18
+ d: "M0 0h640v480H0z"
19
+ }),
20
+ createElementVNode("path", {
21
+ fill: "#009246",
22
+ d: "M0 0h213.3v480H0z"
23
+ }),
24
+ createElementVNode("path", {
25
+ fill: "#ce2b37",
26
+ d: "M426.7 0H640v480H426.7z"
27
+ })
28
+ ], -1)
29
+ ]));
30
+ }
31
+ const ItalianFlag = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
32
+ export {
33
+ ItalianFlag as default
34
+ };
@@ -0,0 +1,27 @@
1
+ import { openBlock, createElementBlock, createElementVNode } from "vue";
2
+ import { _ as _export_sfc } from "./_plugin-vue_export-helper-1tPrXgE0.js";
3
+ const _sfc_main = {};
4
+ const _hoisted_1 = {
5
+ xmlns: "http://www.w3.org/2000/svg",
6
+ viewBox: "0 0 640 480",
7
+ "aria-hidden": "true",
8
+ focusable: "false"
9
+ };
10
+ function _sfc_render(_ctx, _cache) {
11
+ return openBlock(), createElementBlock("svg", _hoisted_1, _cache[0] || (_cache[0] = [
12
+ createElementVNode("path", {
13
+ fill: "#fff",
14
+ d: "M0 0h640v480H0z"
15
+ }, null, -1),
16
+ createElementVNode("circle", {
17
+ cx: "320",
18
+ cy: "240",
19
+ r: "112",
20
+ fill: "#bc002d"
21
+ }, null, -1)
22
+ ]));
23
+ }
24
+ const JapaneseFlag = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
25
+ export {
26
+ JapaneseFlag as default
27
+ };
@@ -0,0 +1,29 @@
1
+ import { openBlock, createElementBlock, createElementVNode } from "vue";
2
+ import { _ as _export_sfc } from "./_plugin-vue_export-helper-1tPrXgE0.js";
3
+ const _sfc_main = {};
4
+ const _hoisted_1 = {
5
+ xmlns: "http://www.w3.org/2000/svg",
6
+ viewBox: "0 0 640 480",
7
+ "aria-hidden": "true",
8
+ focusable: "false"
9
+ };
10
+ function _sfc_render(_ctx, _cache) {
11
+ return openBlock(), createElementBlock("svg", _hoisted_1, _cache[0] || (_cache[0] = [
12
+ createElementVNode("path", {
13
+ fill: "#fff",
14
+ d: "M0 0h640v160H0z"
15
+ }, null, -1),
16
+ createElementVNode("path", {
17
+ fill: "#0039a6",
18
+ d: "M0 160h640v160H0z"
19
+ }, null, -1),
20
+ createElementVNode("path", {
21
+ fill: "#d52b1e",
22
+ d: "M0 320h640v160H0z"
23
+ }, null, -1)
24
+ ]));
25
+ }
26
+ const RussianFlag = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
27
+ export {
28
+ RussianFlag as default
29
+ };
@@ -0,0 +1,28 @@
1
+ import { openBlock, createElementBlock, createElementVNode } from "vue";
2
+ import { _ as _export_sfc } from "./_plugin-vue_export-helper-1tPrXgE0.js";
3
+ const _sfc_main = {};
4
+ const _hoisted_1 = {
5
+ xmlns: "http://www.w3.org/2000/svg",
6
+ viewBox: "0 0 750 500",
7
+ "aria-hidden": "true",
8
+ focusable: "false"
9
+ };
10
+ function _sfc_render(_ctx, _cache) {
11
+ return openBlock(), createElementBlock("svg", _hoisted_1, _cache[0] || (_cache[0] = [
12
+ createElementVNode("rect", {
13
+ width: "750",
14
+ height: "500",
15
+ fill: "#c60b1e"
16
+ }, null, -1),
17
+ createElementVNode("rect", {
18
+ y: "125",
19
+ width: "750",
20
+ height: "250",
21
+ fill: "#ffc400"
22
+ }, null, -1)
23
+ ]));
24
+ }
25
+ const SpanishFlag = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
26
+ export {
27
+ SpanishFlag as default
28
+ };
@@ -10,5 +10,5 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
10
10
  };
11
11
  }>> & Readonly<{}>, {
12
12
  code: string;
13
- }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, SVGSVGElement>;
13
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
14
14
  export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, SVGSVGElement>;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, SVGSVGElement>;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, SVGSVGElement>;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, SVGSVGElement>;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, SVGSVGElement>;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, SVGSVGElement>;
2
+ export default _default;
@@ -1,4 +1,10 @@
1
1
  export { default } from './LanguageFlag.vue';
2
2
  export { default as LanguageFlag } from './LanguageFlag.vue';
3
3
  export { default as EnglishFlag } from './flags/EnglishFlag.vue';
4
+ export { default as FrenchFlag } from './flags/FrenchFlag.vue';
5
+ export { default as GermanFlag } from './flags/GermanFlag.vue';
4
6
  export { default as ItalianFlag } from './flags/ItalianFlag.vue';
7
+ export { default as ChineseFlag } from './flags/ChineseFlag.vue';
8
+ export { default as JapaneseFlag } from './flags/JapaneseFlag.vue';
9
+ export { default as RussianFlag } from './flags/RussianFlag.vue';
10
+ export { default as SpanishFlag } from './flags/SpanishFlag.vue';
@@ -1,17 +1,13 @@
1
1
  import { PropType } from 'vue';
2
- export interface LanguageSelectorOption {
3
- code: string;
4
- label: string;
5
- flagCode?: string;
6
- }
2
+ export type LanguageSelectorCode = string;
7
3
  declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
8
4
  modelValue: {
9
5
  type: StringConstructor;
10
6
  default: string;
11
7
  };
12
8
  languages: {
13
- type: PropType<LanguageSelectorOption[]>;
14
- default: () => never[];
9
+ type: PropType<LanguageSelectorCode[]>;
10
+ default: () => string[];
15
11
  };
16
12
  }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
17
13
  select: (value: string) => any;
@@ -22,14 +18,14 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
22
18
  default: string;
23
19
  };
24
20
  languages: {
25
- type: PropType<LanguageSelectorOption[]>;
26
- default: () => never[];
21
+ type: PropType<LanguageSelectorCode[]>;
22
+ default: () => string[];
27
23
  };
28
24
  }>> & Readonly<{
29
25
  onSelect?: ((value: string) => any) | undefined;
30
26
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
31
27
  }>, {
32
28
  modelValue: string;
33
- languages: LanguageSelectorOption[];
29
+ languages: string[];
34
30
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
35
31
  export default _default;
@@ -1,3 +1,3 @@
1
1
  export { default } from './LanguageSelector.vue';
2
2
  export { default as LanguageSelector } from './LanguageSelector.vue';
3
- export type { LanguageSelectorOption } from './LanguageSelector.vue';
3
+ export type { LanguageSelectorCode } from './LanguageSelector.vue';
@@ -1,7 +1,60 @@
1
- import { E, I, _, _ as _2 } from "./LanguageFlag.vue_vue_type_script_setup_true_lang-CgszKeNv.js";
1
+ import { defineComponent, computed, openBlock, createBlock, resolveDynamicComponent, normalizeProps, guardReactiveProps, defineAsyncComponent } from "vue";
2
+ import { default as default2 } from "./EnglishFlag-BrpG8XMW.js";
3
+ import { default as default3 } from "./FrenchFlag-CUdQacS3.js";
4
+ import { default as default4 } from "./GermanFlag-Bc1CeEHw.js";
5
+ import { default as default5 } from "./ItalianFlag-BAdg13z7.js";
6
+ import { default as default6 } from "./ChineseFlag-CVrOCbRz.js";
7
+ import { default as default7 } from "./JapaneseFlag-Dnd2ITzZ.js";
8
+ import { default as default8 } from "./RussianFlag-Cnc4PHmq.js";
9
+ import { default as default9 } from "./SpanishFlag-Dy-C9kGk.js";
10
+ const _sfc_main = /* @__PURE__ */ defineComponent({
11
+ __name: "LanguageFlag",
12
+ props: {
13
+ code: { type: String, default: "en" }
14
+ },
15
+ setup(__props) {
16
+ const supportedFlagLoaders = {
17
+ en: () => import("./EnglishFlag-BrpG8XMW.js"),
18
+ it: () => import("./ItalianFlag-BAdg13z7.js"),
19
+ fr: () => import("./FrenchFlag-CUdQacS3.js"),
20
+ es: () => import("./SpanishFlag-Dy-C9kGk.js"),
21
+ de: () => import("./GermanFlag-Bc1CeEHw.js"),
22
+ zh: () => import("./ChineseFlag-CVrOCbRz.js"),
23
+ ja: () => import("./JapaneseFlag-Dnd2ITzZ.js"),
24
+ ru: () => import("./RussianFlag-Cnc4PHmq.js")
25
+ };
26
+ const asyncFlagComponentCache = /* @__PURE__ */ new Map();
27
+ const isSupportedLanguageCode = (code) => {
28
+ return code in supportedFlagLoaders;
29
+ };
30
+ const getAsyncFlagComponent = (code) => {
31
+ const cachedComponent = asyncFlagComponentCache.get(code);
32
+ if (cachedComponent) {
33
+ return cachedComponent;
34
+ }
35
+ const asyncComponent = defineAsyncComponent(supportedFlagLoaders[code]);
36
+ asyncFlagComponentCache.set(code, asyncComponent);
37
+ return asyncComponent;
38
+ };
39
+ const props = __props;
40
+ const flagComponent = computed(() => {
41
+ const resolvedCode = isSupportedLanguageCode(props.code) ? props.code : "en";
42
+ return getAsyncFlagComponent(resolvedCode);
43
+ });
44
+ return (_ctx, _cache) => {
45
+ return openBlock(), createBlock(resolveDynamicComponent(flagComponent.value), normalizeProps(guardReactiveProps(_ctx.$attrs)), null, 16);
46
+ };
47
+ }
48
+ });
2
49
  export {
3
- E as EnglishFlag,
4
- I as ItalianFlag,
5
- _ as LanguageFlag,
6
- _2 as default
50
+ default6 as ChineseFlag,
51
+ default2 as EnglishFlag,
52
+ default3 as FrenchFlag,
53
+ default4 as GermanFlag,
54
+ default5 as ItalianFlag,
55
+ default7 as JapaneseFlag,
56
+ _sfc_main as LanguageFlag,
57
+ default8 as RussianFlag,
58
+ default9 as SpanishFlag,
59
+ _sfc_main as default
7
60
  };
@@ -1,11 +1,10 @@
1
- import { defineComponent, ref, computed, openBlock, createBlock, unref, withCtx, createVNode, createCommentVNode, createElementBlock, Fragment, renderList, createElementVNode, toDisplayString, normalizeClass } from "vue";
1
+ import { defineComponent, ref, computed, openBlock, createBlock, unref, withCtx, createVNode, resolveDynamicComponent, createCommentVNode, createElementBlock, Fragment, renderList, createElementVNode, toDisplayString, normalizeClass, defineAsyncComponent } from "vue";
2
2
  import { useI18n } from "vue-i18n";
3
3
  import { T as TWr } from "./index.min-CZ9FIOXr.js";
4
4
  import { H as HugeiconsIcon } from "./HugeiconsIcon.vue-By2RXWWz.js";
5
5
  import { Button as _sfc_main$3 } from "./button.js";
6
- import { Command as _sfc_main$6, CommandList as _sfc_main$7, CommandGroup as _sfc_main$8, CommandItem as _sfc_main$9 } from "./command.js";
7
- import { _ as _sfc_main$1, a as _sfc_main$2, b as _sfc_main$5 } from "./PopoverTrigger.vue_vue_type_script_setup_true_lang-Cf33q_yT.js";
8
- import { _ as _sfc_main$4 } from "./LanguageFlag.vue_vue_type_script_setup_true_lang-CgszKeNv.js";
6
+ import { Command as _sfc_main$5, CommandList as _sfc_main$6, CommandGroup as _sfc_main$7, CommandItem as _sfc_main$8 } from "./command.js";
7
+ import { _ as _sfc_main$1, a as _sfc_main$2, b as _sfc_main$4 } from "./PopoverTrigger.vue_vue_type_script_setup_true_lang-Cf33q_yT.js";
9
8
  const _hoisted_1 = { class: "flex-1" };
10
9
  const _sfc_main = /* @__PURE__ */ defineComponent({
11
10
  __name: "LanguageSelector",
@@ -13,25 +12,75 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
13
12
  modelValue: { type: String, default: "" },
14
13
  languages: {
15
14
  type: Array,
16
- default: () => []
15
+ default: () => ["en", "it"]
17
16
  }
18
17
  },
19
18
  emits: ["update:modelValue", "select"],
20
19
  setup(__props, { emit: __emit }) {
20
+ const supportedLanguages = [
21
+ { code: "en", label: "English", loadFlag: () => import("./EnglishFlag-BrpG8XMW.js") },
22
+ { code: "it", label: "Italiano", loadFlag: () => import("./ItalianFlag-BAdg13z7.js") },
23
+ { code: "fr", label: "Francais", loadFlag: () => import("./FrenchFlag-CUdQacS3.js") },
24
+ { code: "es", label: "Espanol", loadFlag: () => import("./SpanishFlag-Dy-C9kGk.js") },
25
+ { code: "de", label: "Deutsch", loadFlag: () => import("./GermanFlag-Bc1CeEHw.js") },
26
+ { code: "zh", label: "中文", loadFlag: () => import("./ChineseFlag-CVrOCbRz.js") },
27
+ { code: "ja", label: "日本語", loadFlag: () => import("./JapaneseFlag-Dnd2ITzZ.js") },
28
+ { code: "ru", label: "Русский", loadFlag: () => import("./RussianFlag-Cnc4PHmq.js") }
29
+ ];
30
+ const asyncFlagComponentCache = /* @__PURE__ */ new Map();
31
+ const isSupportedLanguageCode = (code) => {
32
+ return supportedLanguages.some((language) => language.code === code);
33
+ };
34
+ const getSupportedLanguage = (code) => {
35
+ return supportedLanguages.find((language) => language.code === code);
36
+ };
37
+ const getAsyncFlagComponent = (code) => {
38
+ const cachedComponent = asyncFlagComponentCache.get(code);
39
+ if (cachedComponent) {
40
+ return cachedComponent;
41
+ }
42
+ const asyncComponent = defineAsyncComponent(getSupportedLanguage(code).loadFlag);
43
+ asyncFlagComponentCache.set(code, asyncComponent);
44
+ return asyncComponent;
45
+ };
21
46
  const props = __props;
22
47
  const emits = __emit;
23
- const { t } = useI18n();
48
+ const { locale, t } = useI18n();
24
49
  const isOpen = ref(false);
50
+ const languageDisplayNames = computed(() => {
51
+ return typeof Intl.DisplayNames === "function" ? new Intl.DisplayNames([locale.value], { type: "language" }) : null;
52
+ });
53
+ const getLanguageLabel = (code) => {
54
+ var _a;
55
+ const normalizedCode = code.toLowerCase();
56
+ const languageCode = normalizedCode.split("-")[0];
57
+ const supportedLanguage = isSupportedLanguageCode(languageCode) ? getSupportedLanguage(languageCode) : null;
58
+ return (supportedLanguage == null ? void 0 : supportedLanguage.label) || ((_a = languageDisplayNames.value) == null ? void 0 : _a.of(languageCode)) || code.toUpperCase();
59
+ };
25
60
  const normalizedLanguages = computed(() => {
26
- return props.languages.map((language) => ({
27
- code: language.code,
28
- label: language.label,
29
- flagCode: language.flagCode || language.code
61
+ return props.languages.map((code) => ({
62
+ code,
63
+ label: getLanguageLabel(code)
30
64
  }));
31
65
  });
66
+ const availableFlagCodes = computed(() => {
67
+ const supportedCodes = normalizedLanguages.value.map((language) => language.code).filter(isSupportedLanguageCode);
68
+ if (supportedCodes.length > 0) {
69
+ return [...new Set(supportedCodes)];
70
+ }
71
+ return ["en"];
72
+ });
73
+ const resolveFlagComponent = (code) => {
74
+ const isValid = code && isSupportedLanguageCode(code) && availableFlagCodes.value.includes(code);
75
+ const resolvedCode = isValid ? code : availableFlagCodes.value[0];
76
+ return getAsyncFlagComponent(resolvedCode);
77
+ };
32
78
  const currentLanguage = computed(() => {
33
79
  return normalizedLanguages.value.find((language) => language.code === props.modelValue) || normalizedLanguages.value[0] || null;
34
80
  });
81
+ const currentFlagComponent = computed(() => {
82
+ return currentLanguage.value ? resolveFlagComponent(currentLanguage.value.code) : null;
83
+ });
35
84
  const handleSelectLanguage = (language) => {
36
85
  emits("update:modelValue", language);
37
86
  emits("select", language);
@@ -51,45 +100,41 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
51
100
  "aria-label": unref(t)("ui.language.ariaLabel")
52
101
  }, {
53
102
  default: withCtx(() => [
54
- currentLanguage.value ? (openBlock(), createBlock(unref(_sfc_main$4), {
103
+ currentFlagComponent.value ? (openBlock(), createBlock(resolveDynamicComponent(currentFlagComponent.value), {
55
104
  key: 0,
56
- code: currentLanguage.value.flagCode,
57
105
  class: "h-4 w-[1.35rem] rounded-[2px]"
58
- }, null, 8, ["code"])) : createCommentVNode("", true)
106
+ })) : createCommentVNode("", true)
59
107
  ]),
60
108
  _: 1
61
109
  }, 8, ["aria-label"])
62
110
  ]),
63
111
  _: 1
64
112
  }),
65
- createVNode(unref(_sfc_main$5), {
113
+ createVNode(unref(_sfc_main$4), {
66
114
  side: "bottom",
67
115
  align: "end",
68
116
  "side-offset": 8,
69
117
  class: "w-44 !p-0"
70
118
  }, {
71
119
  default: withCtx(() => [
72
- createVNode(unref(_sfc_main$6), {
120
+ createVNode(unref(_sfc_main$5), {
73
121
  "model-value": props.modelValue
74
122
  }, {
75
123
  default: withCtx(() => [
76
- createVNode(unref(_sfc_main$7), null, {
124
+ createVNode(unref(_sfc_main$6), null, {
77
125
  default: withCtx(() => [
78
- createVNode(unref(_sfc_main$8), {
126
+ createVNode(unref(_sfc_main$7), {
79
127
  heading: unref(t)("ui.language.title")
80
128
  }, {
81
129
  default: withCtx(() => [
82
130
  (openBlock(true), createElementBlock(Fragment, null, renderList(normalizedLanguages.value, (option) => {
83
- return openBlock(), createBlock(unref(_sfc_main$9), {
131
+ return openBlock(), createBlock(unref(_sfc_main$8), {
84
132
  key: option.code,
85
133
  value: option.code,
86
134
  onSelect: ($event) => handleSelectLanguage(option.code)
87
135
  }, {
88
136
  default: withCtx(() => [
89
- createVNode(unref(_sfc_main$4), {
90
- code: option.flagCode,
91
- class: "h-4 w-[1.35rem] rounded-[2px]"
92
- }, null, 8, ["code"]),
137
+ (openBlock(), createBlock(resolveDynamicComponent(resolveFlagComponent(option.code)), { class: "h-4 w-[1.35rem] rounded-[2px]" })),
93
138
  createElementVNode("span", _hoisted_1, toDisplayString(option.label), 1),
94
139
  createVNode(unref(HugeiconsIcon), {
95
140
  icon: unref(TWr),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brumaombra/ui-vintage",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Vue 3 component library with shadcn-style primitives, app shells, dialogs, and shared theme tokens.",
5
5
  "private": false,
6
6
  "author": "Mauro Brambilla",
@@ -1,68 +0,0 @@
1
- import { openBlock, createElementBlock, createStaticVNode, createElementVNode, defineComponent, computed, createBlock, resolveDynamicComponent, normalizeProps, guardReactiveProps } from "vue";
2
- import { _ as _export_sfc } from "./_plugin-vue_export-helper-1tPrXgE0.js";
3
- const _sfc_main$2 = {};
4
- const _hoisted_1$1 = {
5
- xmlns: "http://www.w3.org/2000/svg",
6
- viewBox: "0 0 640 480",
7
- "aria-hidden": "true",
8
- focusable: "false"
9
- };
10
- function _sfc_render$1(_ctx, _cache) {
11
- return openBlock(), createElementBlock("svg", _hoisted_1$1, _cache[0] || (_cache[0] = [
12
- createStaticVNode('<path fill="#012169" d="M0 0h640v480H0z"></path><path fill="#FFF" d="m75 0 244 181L562 0h78v62L400 241l240 178v61h-80L320 301 81 480H0v-60l239-178L0 64V0z"></path><path fill="#C8102E" d="m424 281 216 159v40L369 281zm-184 20 6 35L54 480H0zM640 0v3L391 191l2-44L590 0zM0 0l239 176h-60L0 42z"></path><path fill="#FFF" d="M241 0v480h160V0zM0 160v160h640V160z"></path><path fill="#C8102E" d="M0 193v96h640v-96zM273 0v480h96V0z"></path>', 5)
13
- ]));
14
- }
15
- const EnglishFlag = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$1]]);
16
- const _sfc_main$1 = {};
17
- const _hoisted_1 = {
18
- xmlns: "http://www.w3.org/2000/svg",
19
- viewBox: "0 0 640 480",
20
- "aria-hidden": "true",
21
- focusable: "false"
22
- };
23
- function _sfc_render(_ctx, _cache) {
24
- return openBlock(), createElementBlock("svg", _hoisted_1, _cache[0] || (_cache[0] = [
25
- createElementVNode("g", {
26
- "fill-rule": "evenodd",
27
- "stroke-width": "1pt"
28
- }, [
29
- createElementVNode("path", {
30
- fill: "#fff",
31
- d: "M0 0h640v480H0z"
32
- }),
33
- createElementVNode("path", {
34
- fill: "#009246",
35
- d: "M0 0h213.3v480H0z"
36
- }),
37
- createElementVNode("path", {
38
- fill: "#ce2b37",
39
- d: "M426.7 0H640v480H426.7z"
40
- })
41
- ], -1)
42
- ]));
43
- }
44
- const ItalianFlag = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render]]);
45
- const _sfc_main = /* @__PURE__ */ defineComponent({
46
- __name: "LanguageFlag",
47
- props: {
48
- code: { type: String, default: "en" }
49
- },
50
- setup(__props) {
51
- const props = __props;
52
- const flagComponentMap = {
53
- en: EnglishFlag,
54
- it: ItalianFlag
55
- };
56
- const flagComponent = computed(() => {
57
- return flagComponentMap[props.code] || EnglishFlag;
58
- });
59
- return (_ctx, _cache) => {
60
- return openBlock(), createBlock(resolveDynamicComponent(flagComponent.value), normalizeProps(guardReactiveProps(_ctx.$attrs)), null, 16);
61
- };
62
- }
63
- });
64
- export {
65
- EnglishFlag as E,
66
- ItalianFlag as I,
67
- _sfc_main as _
68
- };