langie 2.0.1 → 2.0.3
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/dist/components/index.cjs +21 -11
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.css.map +1 -1
- package/dist/components/index.mjs +21 -11
- package/dist/components/index.mjs.map +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.mjs +1 -1
- package/dist/index.cjs +21 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.mjs +21 -11
- package/dist/index.mjs.map +1 -1
- package/dist/types.d.ts +5 -1
- package/dist/utils/languageLabel.d.ts +13 -0
- package/package.json +5 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* langie v2.0.
|
|
2
|
+
* langie v2.0.3
|
|
3
3
|
* (c) 2026 nlit
|
|
4
4
|
* @license Apache-2.0
|
|
5
5
|
*
|
|
@@ -603,6 +603,14 @@ function displayNative(name = "", native = "") {
|
|
|
603
603
|
return name !== native && TRAILING_PAREN.test(name) && TRAILING_PAREN.test(native) ? native.replace(TRAILING_PAREN, "") : native;
|
|
604
604
|
}
|
|
605
605
|
|
|
606
|
+
// src/utils/languageLabel.ts
|
|
607
|
+
function languageLabel(lang) {
|
|
608
|
+
const primary = lang.search_alias || lang.name || "";
|
|
609
|
+
const native = lang.native_name || "";
|
|
610
|
+
if (!native || native === primary) return { primary, native: "" };
|
|
611
|
+
return { primary, native: displayNative(primary, native) };
|
|
612
|
+
}
|
|
613
|
+
|
|
606
614
|
// src/utils/flagUrl.ts
|
|
607
615
|
var isReadyFlagUrl = (flagCode) => flagCode.startsWith("/") || /^https?:\/\//i.test(flagCode);
|
|
608
616
|
var flagImageUrl = (flagCode) => isReadyFlagUrl(flagCode) ? flagCode : `/flags/${flagCode}.svg`;
|
|
@@ -754,7 +762,7 @@ var LanguageSelect_default = /* @__PURE__ */ (0, import_vue.defineComponent)({
|
|
|
754
762
|
"5b09cc17-COLORS.text.secondary": (0, import_vue2.unref)(COLORS).text.secondary,
|
|
755
763
|
"5b09cc17-COLORS.neutral.gray400": (0, import_vue2.unref)(COLORS).neutral.gray400
|
|
756
764
|
}));
|
|
757
|
-
const COMBOBOX_ARIA = { "aria-multiselectable": void 0 };
|
|
765
|
+
const COMBOBOX_ARIA = { "aria-multiselectable": void 0, "aria-placeholder": void 0 };
|
|
758
766
|
const multiselectId = (0, import_vue3.useId)();
|
|
759
767
|
const getFlagCode = (lang) => {
|
|
760
768
|
const flagCode = lang.flag_country || lang.code;
|
|
@@ -769,6 +777,7 @@ var LanguageSelect_default = /* @__PURE__ */ (0, import_vue.defineComponent)({
|
|
|
769
777
|
});
|
|
770
778
|
const searchQuery = (0, import_vue3.ref)("");
|
|
771
779
|
const transliterate = (0, import_vue3.shallowRef)(null);
|
|
780
|
+
const searchInputAttrs = (0, import_vue3.computed)(() => ({ placeholder: props.placeholder }));
|
|
772
781
|
const validLanguages = (0, import_vue3.computed)(() => {
|
|
773
782
|
return props.languages.filter((lang) => lang && lang.code && lang.name && lang.native_name);
|
|
774
783
|
});
|
|
@@ -937,6 +946,7 @@ var LanguageSelect_default = /* @__PURE__ */ (0, import_vue.defineComponent)({
|
|
|
937
946
|
"filter-results": false,
|
|
938
947
|
id: (0, import_vue2.unref)(multiselectId),
|
|
939
948
|
aria: COMBOBOX_ARIA,
|
|
949
|
+
attrs: searchInputAttrs.value,
|
|
940
950
|
onKeydown: handleKeydown
|
|
941
951
|
}, {
|
|
942
952
|
singlelabel: (0, import_vue2.withCtx)(({ value }) => [
|
|
@@ -945,20 +955,20 @@ var LanguageSelect_default = /* @__PURE__ */ (0, import_vue.defineComponent)({
|
|
|
945
955
|
key: selectedLanguageKey.value,
|
|
946
956
|
src: getFlagImageUrl(value),
|
|
947
957
|
class: "lang-flag",
|
|
948
|
-
alt: `${
|
|
958
|
+
alt: `${(0, import_vue2.unref)(languageLabel)(value).primary} flag`,
|
|
949
959
|
"data-custom-flag": (0, import_vue2.unref)(isReadyFlagUrl)(getFlagCode(value)) || void 0,
|
|
950
960
|
onError: onFlagError
|
|
951
961
|
}, null, 40, _hoisted_2)) : (0, import_vue2.createCommentVNode)("v-if", true),
|
|
952
962
|
(0, import_vue2.createElementVNode)("span", _hoisted_3, [
|
|
953
963
|
(0, import_vue2.createTextVNode)(
|
|
954
|
-
(0, import_vue2.toDisplayString)(value.
|
|
964
|
+
(0, import_vue2.toDisplayString)((0, import_vue2.unref)(languageLabel)(value).primary) + " ",
|
|
955
965
|
1
|
|
956
966
|
/* TEXT */
|
|
957
967
|
),
|
|
958
|
-
|
|
968
|
+
(0, import_vue2.unref)(languageLabel)(value).native ? ((0, import_vue2.openBlock)(), (0, import_vue2.createElementBlock)(
|
|
959
969
|
"span",
|
|
960
970
|
_hoisted_4,
|
|
961
|
-
"(" + (0, import_vue2.toDisplayString)((0, import_vue2.unref)(
|
|
971
|
+
"(" + (0, import_vue2.toDisplayString)((0, import_vue2.unref)(languageLabel)(value).native) + ")",
|
|
962
972
|
1
|
|
963
973
|
/* TEXT */
|
|
964
974
|
)) : (0, import_vue2.createCommentVNode)("v-if", true)
|
|
@@ -974,20 +984,20 @@ var LanguageSelect_default = /* @__PURE__ */ (0, import_vue.defineComponent)({
|
|
|
974
984
|
key: `${option.code}-${option.flag_country || "fallback"}`,
|
|
975
985
|
src: getFlagImageUrl(option),
|
|
976
986
|
class: "lang-flag",
|
|
977
|
-
alt: `${option.
|
|
987
|
+
alt: `${(0, import_vue2.unref)(languageLabel)(option).primary} flag`,
|
|
978
988
|
"data-custom-flag": (0, import_vue2.unref)(isReadyFlagUrl)(getFlagCode(option)) || void 0,
|
|
979
989
|
onError: onFlagError
|
|
980
990
|
}, null, 40, _hoisted_6)),
|
|
981
991
|
(0, import_vue2.createElementVNode)("span", _hoisted_7, [
|
|
982
992
|
(0, import_vue2.createTextVNode)(
|
|
983
|
-
(0, import_vue2.toDisplayString)(option.
|
|
993
|
+
(0, import_vue2.toDisplayString)((0, import_vue2.unref)(languageLabel)(option).primary) + " ",
|
|
984
994
|
1
|
|
985
995
|
/* TEXT */
|
|
986
996
|
),
|
|
987
|
-
|
|
997
|
+
(0, import_vue2.unref)(languageLabel)(option).native ? ((0, import_vue2.openBlock)(), (0, import_vue2.createElementBlock)(
|
|
988
998
|
"span",
|
|
989
999
|
_hoisted_8,
|
|
990
|
-
"(" + (0, import_vue2.toDisplayString)((0, import_vue2.unref)(
|
|
1000
|
+
"(" + (0, import_vue2.toDisplayString)((0, import_vue2.unref)(languageLabel)(option).native) + ")",
|
|
991
1001
|
1
|
|
992
1002
|
/* TEXT */
|
|
993
1003
|
)) : (0, import_vue2.createCommentVNode)("v-if", true)
|
|
@@ -1014,7 +1024,7 @@ var LanguageSelect_default = /* @__PURE__ */ (0, import_vue.defineComponent)({
|
|
|
1014
1024
|
]),
|
|
1015
1025
|
_: 1
|
|
1016
1026
|
/* STABLE */
|
|
1017
|
-
}, 8, ["modelValue", "options", "placeholder", "disabled", "loading", "id"])) : isLoading.value && validLanguages.value.length === 0 ? ((0, import_vue2.openBlock)(), (0, import_vue2.createElementBlock)(
|
|
1027
|
+
}, 8, ["modelValue", "options", "placeholder", "disabled", "loading", "id", "attrs"])) : isLoading.value && validLanguages.value.length === 0 ? ((0, import_vue2.openBlock)(), (0, import_vue2.createElementBlock)(
|
|
1018
1028
|
import_vue2.Fragment,
|
|
1019
1029
|
{ key: 1 },
|
|
1020
1030
|
[
|