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
package/dist/core.cjs
CHANGED
package/dist/core.mjs
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -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
|
*
|
|
@@ -2056,6 +2056,14 @@ function displayNative(name = "", native = "") {
|
|
|
2056
2056
|
return name !== native && TRAILING_PAREN.test(name) && TRAILING_PAREN.test(native) ? native.replace(TRAILING_PAREN, "") : native;
|
|
2057
2057
|
}
|
|
2058
2058
|
|
|
2059
|
+
// src/utils/languageLabel.ts
|
|
2060
|
+
function languageLabel(lang) {
|
|
2061
|
+
const primary = lang.search_alias || lang.name || "";
|
|
2062
|
+
const native = lang.native_name || "";
|
|
2063
|
+
if (!native || native === primary) return { primary, native: "" };
|
|
2064
|
+
return { primary, native: displayNative(primary, native) };
|
|
2065
|
+
}
|
|
2066
|
+
|
|
2059
2067
|
// src/utils/flagUrl.ts
|
|
2060
2068
|
var isReadyFlagUrl = (flagCode) => flagCode.startsWith("/") || /^https?:\/\//i.test(flagCode);
|
|
2061
2069
|
var flagImageUrl = (flagCode) => isReadyFlagUrl(flagCode) ? flagCode : `/flags/${flagCode}.svg`;
|
|
@@ -2225,7 +2233,7 @@ var LanguageSelect_default = /* @__PURE__ */ (0, import_vue3.defineComponent)({
|
|
|
2225
2233
|
"5b09cc17-COLORS.text.secondary": (0, import_vue4.unref)(COLORS).text.secondary,
|
|
2226
2234
|
"5b09cc17-COLORS.neutral.gray400": (0, import_vue4.unref)(COLORS).neutral.gray400
|
|
2227
2235
|
}));
|
|
2228
|
-
const COMBOBOX_ARIA = { "aria-multiselectable": void 0 };
|
|
2236
|
+
const COMBOBOX_ARIA = { "aria-multiselectable": void 0, "aria-placeholder": void 0 };
|
|
2229
2237
|
const multiselectId = (0, import_vue5.useId)();
|
|
2230
2238
|
const getFlagCode = (lang) => {
|
|
2231
2239
|
const flagCode = lang.flag_country || lang.code;
|
|
@@ -2240,6 +2248,7 @@ var LanguageSelect_default = /* @__PURE__ */ (0, import_vue3.defineComponent)({
|
|
|
2240
2248
|
});
|
|
2241
2249
|
const searchQuery = (0, import_vue5.ref)("");
|
|
2242
2250
|
const transliterate = (0, import_vue5.shallowRef)(null);
|
|
2251
|
+
const searchInputAttrs = (0, import_vue5.computed)(() => ({ placeholder: props.placeholder }));
|
|
2243
2252
|
const validLanguages = (0, import_vue5.computed)(() => {
|
|
2244
2253
|
return props.languages.filter((lang) => lang && lang.code && lang.name && lang.native_name);
|
|
2245
2254
|
});
|
|
@@ -2408,6 +2417,7 @@ var LanguageSelect_default = /* @__PURE__ */ (0, import_vue3.defineComponent)({
|
|
|
2408
2417
|
"filter-results": false,
|
|
2409
2418
|
id: (0, import_vue4.unref)(multiselectId),
|
|
2410
2419
|
aria: COMBOBOX_ARIA,
|
|
2420
|
+
attrs: searchInputAttrs.value,
|
|
2411
2421
|
onKeydown: handleKeydown
|
|
2412
2422
|
}, {
|
|
2413
2423
|
singlelabel: (0, import_vue4.withCtx)(({ value }) => [
|
|
@@ -2416,20 +2426,20 @@ var LanguageSelect_default = /* @__PURE__ */ (0, import_vue3.defineComponent)({
|
|
|
2416
2426
|
key: selectedLanguageKey.value,
|
|
2417
2427
|
src: getFlagImageUrl(value),
|
|
2418
2428
|
class: "lang-flag",
|
|
2419
|
-
alt: `${
|
|
2429
|
+
alt: `${(0, import_vue4.unref)(languageLabel)(value).primary} flag`,
|
|
2420
2430
|
"data-custom-flag": (0, import_vue4.unref)(isReadyFlagUrl)(getFlagCode(value)) || void 0,
|
|
2421
2431
|
onError: onFlagError
|
|
2422
2432
|
}, null, 40, _hoisted_2)) : (0, import_vue4.createCommentVNode)("v-if", true),
|
|
2423
2433
|
(0, import_vue4.createElementVNode)("span", _hoisted_3, [
|
|
2424
2434
|
(0, import_vue4.createTextVNode)(
|
|
2425
|
-
(0, import_vue4.toDisplayString)(value.
|
|
2435
|
+
(0, import_vue4.toDisplayString)((0, import_vue4.unref)(languageLabel)(value).primary) + " ",
|
|
2426
2436
|
1
|
|
2427
2437
|
/* TEXT */
|
|
2428
2438
|
),
|
|
2429
|
-
|
|
2439
|
+
(0, import_vue4.unref)(languageLabel)(value).native ? ((0, import_vue4.openBlock)(), (0, import_vue4.createElementBlock)(
|
|
2430
2440
|
"span",
|
|
2431
2441
|
_hoisted_4,
|
|
2432
|
-
"(" + (0, import_vue4.toDisplayString)((0, import_vue4.unref)(
|
|
2442
|
+
"(" + (0, import_vue4.toDisplayString)((0, import_vue4.unref)(languageLabel)(value).native) + ")",
|
|
2433
2443
|
1
|
|
2434
2444
|
/* TEXT */
|
|
2435
2445
|
)) : (0, import_vue4.createCommentVNode)("v-if", true)
|
|
@@ -2445,20 +2455,20 @@ var LanguageSelect_default = /* @__PURE__ */ (0, import_vue3.defineComponent)({
|
|
|
2445
2455
|
key: `${option.code}-${option.flag_country || "fallback"}`,
|
|
2446
2456
|
src: getFlagImageUrl(option),
|
|
2447
2457
|
class: "lang-flag",
|
|
2448
|
-
alt: `${option.
|
|
2458
|
+
alt: `${(0, import_vue4.unref)(languageLabel)(option).primary} flag`,
|
|
2449
2459
|
"data-custom-flag": (0, import_vue4.unref)(isReadyFlagUrl)(getFlagCode(option)) || void 0,
|
|
2450
2460
|
onError: onFlagError
|
|
2451
2461
|
}, null, 40, _hoisted_6)),
|
|
2452
2462
|
(0, import_vue4.createElementVNode)("span", _hoisted_7, [
|
|
2453
2463
|
(0, import_vue4.createTextVNode)(
|
|
2454
|
-
(0, import_vue4.toDisplayString)(option.
|
|
2464
|
+
(0, import_vue4.toDisplayString)((0, import_vue4.unref)(languageLabel)(option).primary) + " ",
|
|
2455
2465
|
1
|
|
2456
2466
|
/* TEXT */
|
|
2457
2467
|
),
|
|
2458
|
-
|
|
2468
|
+
(0, import_vue4.unref)(languageLabel)(option).native ? ((0, import_vue4.openBlock)(), (0, import_vue4.createElementBlock)(
|
|
2459
2469
|
"span",
|
|
2460
2470
|
_hoisted_8,
|
|
2461
|
-
"(" + (0, import_vue4.toDisplayString)((0, import_vue4.unref)(
|
|
2471
|
+
"(" + (0, import_vue4.toDisplayString)((0, import_vue4.unref)(languageLabel)(option).native) + ")",
|
|
2462
2472
|
1
|
|
2463
2473
|
/* TEXT */
|
|
2464
2474
|
)) : (0, import_vue4.createCommentVNode)("v-if", true)
|
|
@@ -2485,7 +2495,7 @@ var LanguageSelect_default = /* @__PURE__ */ (0, import_vue3.defineComponent)({
|
|
|
2485
2495
|
]),
|
|
2486
2496
|
_: 1
|
|
2487
2497
|
/* STABLE */
|
|
2488
|
-
}, 8, ["modelValue", "options", "placeholder", "disabled", "loading", "id"])) : isLoading.value && validLanguages.value.length === 0 ? ((0, import_vue4.openBlock)(), (0, import_vue4.createElementBlock)(
|
|
2498
|
+
}, 8, ["modelValue", "options", "placeholder", "disabled", "loading", "id", "attrs"])) : isLoading.value && validLanguages.value.length === 0 ? ((0, import_vue4.openBlock)(), (0, import_vue4.createElementBlock)(
|
|
2489
2499
|
import_vue4.Fragment,
|
|
2490
2500
|
{ key: 1 },
|
|
2491
2501
|
[
|