@bigbinary/neeto-time-zones 0.8.20 → 0.8.21
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/README.md +63 -1
- package/dist/ar-8aec2c6f.cjs +1 -0
- package/dist/ar-b72637bc-8aec2c6f.cjs +1 -0
- package/dist/ar-b72637bc-b72637bc.js +427 -0
- package/dist/ar-b72637bc.js +427 -0
- package/dist/bg-5fa1a2c5-5fa1a2c5.js +427 -0
- package/dist/bg-5fa1a2c5-808354d9.cjs +1 -0
- package/dist/bg-5fa1a2c5.js +427 -0
- package/dist/bg-808354d9.cjs +1 -0
- package/dist/ca-9b565171.cjs +1 -0
- package/dist/ca-c0eab213-9b565171.cjs +1 -0
- package/dist/ca-c0eab213-c0eab213.js +427 -0
- package/dist/ca-c0eab213.js +427 -0
- package/dist/cs-8c92c102-8c92c102.js +427 -0
- package/dist/cs-8c92c102-9b565171.cjs +1 -0
- package/dist/cs-8c92c102.js +427 -0
- package/dist/cs-9b565171.cjs +1 -0
- package/dist/da-9b565171.cjs +1 -0
- package/dist/da-be8e5ef1-9b565171.cjs +1 -0
- package/dist/da-be8e5ef1-be8e5ef1.js +427 -0
- package/dist/da-be8e5ef1.js +427 -0
- package/dist/de-9b565171.cjs +1 -0
- package/dist/de-baf5ce96-9b565171.cjs +1 -0
- package/dist/de-baf5ce96-baf5ce96.js +427 -0
- package/dist/de-baf5ce96.js +427 -0
- package/dist/es-188a0bb9-188a0bb9.js +427 -0
- package/dist/es-188a0bb9-9b565171.cjs +1 -0
- package/dist/es-188a0bb9.js +427 -0
- package/dist/es-9b565171.cjs +1 -0
- package/dist/es-MX-9b565171.cjs +1 -0
- package/dist/es-MX-c4ac39c4-9b565171.cjs +1 -0
- package/dist/es-MX-c4ac39c4-c4ac39c4.js +427 -0
- package/dist/es-MX-c4ac39c4.js +427 -0
- package/dist/et-8c590cf4-8c590cf4.js +427 -0
- package/dist/et-8c590cf4-9b565171.cjs +1 -0
- package/dist/et-8c590cf4.js +427 -0
- package/dist/et-9b565171.cjs +1 -0
- package/dist/fi-9b565171.cjs +1 -0
- package/dist/fi-ff798599-9b565171.cjs +1 -0
- package/dist/fi-ff798599-ff798599.js +427 -0
- package/dist/fi-ff798599.js +427 -0
- package/dist/fil-9b565171.cjs +1 -0
- package/dist/fil-a1ecb634-9b565171.cjs +1 -0
- package/dist/fil-a1ecb634-a1ecb634.js +427 -0
- package/dist/fil-a1ecb634.js +427 -0
- package/dist/fr-9b565171.cjs +1 -0
- package/dist/fr-ef848be0-9b565171.cjs +1 -0
- package/dist/fr-ef848be0-ef848be0.js +427 -0
- package/dist/fr-ef848be0.js +427 -0
- package/dist/he-4fe98e48.cjs +1 -0
- package/dist/he-a682875c-4fe98e48.cjs +1 -0
- package/dist/he-a682875c-a682875c.js +427 -0
- package/dist/he-a682875c.js +427 -0
- package/dist/hi-33fe103b-33fe103b.js +427 -0
- package/dist/hi-33fe103b-a3d23365.cjs +1 -0
- package/dist/hi-33fe103b.js +427 -0
- package/dist/hi-a3d23365.cjs +1 -0
- package/dist/hr-9b565171.cjs +1 -0
- package/dist/hr-a43e9805-9b565171.cjs +1 -0
- package/dist/hr-a43e9805-a43e9805.js +427 -0
- package/dist/hr-a43e9805.js +427 -0
- package/dist/hu-9b565171.cjs +1 -0
- package/dist/hu-de39fb94-9b565171.cjs +1 -0
- package/dist/hu-de39fb94-de39fb94.js +427 -0
- package/dist/hu-de39fb94.js +427 -0
- package/dist/id-9b565171.cjs +1 -0
- package/dist/id-d7d5e3e0-9b565171.cjs +1 -0
- package/dist/id-d7d5e3e0-d7d5e3e0.js +427 -0
- package/dist/id-d7d5e3e0.js +427 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +205 -20
- package/dist/it-9b565171.cjs +1 -0
- package/dist/it-ba612edd-9b565171.cjs +1 -0
- package/dist/it-ba612edd-ba612edd.js +427 -0
- package/dist/it-ba612edd.js +427 -0
- package/dist/ja-312d08e8.cjs +1 -0
- package/dist/ja-bb50b22e-312d08e8.cjs +1 -0
- package/dist/ja-bb50b22e-bb50b22e.js +427 -0
- package/dist/ja-bb50b22e.js +427 -0
- package/dist/ko-0f61241a.cjs +1 -0
- package/dist/ko-96882818-0f61241a.cjs +1 -0
- package/dist/ko-96882818-96882818.js +427 -0
- package/dist/ko-96882818.js +427 -0
- package/dist/nl-9b565171.cjs +1 -0
- package/dist/nl-d9264781-9b565171.cjs +1 -0
- package/dist/nl-d9264781-d9264781.js +427 -0
- package/dist/nl-d9264781.js +427 -0
- package/dist/pl-9b565171.cjs +1 -0
- package/dist/pl-a4f71f7a-9b565171.cjs +1 -0
- package/dist/pl-a4f71f7a-a4f71f7a.js +427 -0
- package/dist/pl-a4f71f7a.js +427 -0
- package/dist/pt-9b565171.cjs +1 -0
- package/dist/pt-BR-9b565171.cjs +1 -0
- package/dist/pt-BR-a8f4cb53-9b565171.cjs +1 -0
- package/dist/pt-BR-a8f4cb53-a8f4cb53.js +427 -0
- package/dist/pt-BR-a8f4cb53.js +427 -0
- package/dist/pt-df68bb8a-9b565171.cjs +1 -0
- package/dist/pt-df68bb8a-df68bb8a.js +427 -0
- package/dist/pt-df68bb8a.js +427 -0
- package/dist/react.cjs.js +2 -2
- package/dist/react.es.js +199 -19
- package/dist/ro-48dec29d-48dec29d.js +427 -0
- package/dist/ro-48dec29d-9b565171.cjs +1 -0
- package/dist/ro-48dec29d.js +427 -0
- package/dist/ro-9b565171.cjs +1 -0
- package/dist/ru-ab8ea97f-ab8ea97f.js +427 -0
- package/dist/ru-ab8ea97f-f384db14.cjs +1 -0
- package/dist/ru-ab8ea97f.js +427 -0
- package/dist/ru-f384db14.cjs +1 -0
- package/dist/sk-4a3cce24-4a3cce24.js +427 -0
- package/dist/sk-4a3cce24-9b565171.cjs +1 -0
- package/dist/sk-4a3cce24.js +427 -0
- package/dist/sk-9b565171.cjs +1 -0
- package/dist/sl-9b565171.cjs +1 -0
- package/dist/sl-b377a006-9b565171.cjs +1 -0
- package/dist/sl-b377a006-b377a006.js +427 -0
- package/dist/sl-b377a006.js +427 -0
- package/dist/sv-8b6d858b-8b6d858b.js +427 -0
- package/dist/sv-8b6d858b-9b565171.cjs +1 -0
- package/dist/sv-8b6d858b.js +427 -0
- package/dist/sv-9b565171.cjs +1 -0
- package/dist/th-04966cae-04966cae.js +427 -0
- package/dist/th-04966cae-aa2b34f0.cjs +1 -0
- package/dist/th-04966cae.js +427 -0
- package/dist/th-aa2b34f0.cjs +1 -0
- package/dist/tr-6fa455e1-6fa455e1.js +427 -0
- package/dist/tr-6fa455e1-9b565171.cjs +1 -0
- package/dist/tr-6fa455e1.js +427 -0
- package/dist/tr-9b565171.cjs +1 -0
- package/dist/uk-3ea3d94e-3ea3d94e.js +427 -0
- package/dist/uk-3ea3d94e-68e6e9d5.cjs +1 -0
- package/dist/uk-3ea3d94e.js +427 -0
- package/dist/uk-68e6e9d5.cjs +1 -0
- package/dist/vi-9b565171.cjs +1 -0
- package/dist/vi-a8bf337b-9b565171.cjs +1 -0
- package/dist/vi-a8bf337b-a8bf337b.js +427 -0
- package/dist/vi-a8bf337b.js +427 -0
- package/dist/zh-CN-8f06cb7e-8f06cb7e.js +427 -0
- package/dist/zh-CN-8f06cb7e-bb4c91a4.cjs +1 -0
- package/dist/zh-CN-8f06cb7e.js +427 -0
- package/dist/zh-CN-bb4c91a4.cjs +1 -0
- package/dist/zh-TW-6f426a06.cjs +1 -0
- package/dist/zh-TW-86aec94a-6f426a06.cjs +1 -0
- package/dist/zh-TW-86aec94a-86aec94a.js +427 -0
- package/dist/zh-TW-86aec94a.js +427 -0
- package/index.d.ts +2 -0
- package/package.json +1 -1
package/dist/react.es.js
CHANGED
|
@@ -2357,6 +2357,159 @@ const UsCanada = [
|
|
|
2357
2357
|
cities: "Honolulu, Johnston, Lahaina, Rarotonga, Tahiti"
|
|
2358
2358
|
}
|
|
2359
2359
|
];
|
|
2360
|
+
let cachedLocale = null;
|
|
2361
|
+
let cachedTranslations = null;
|
|
2362
|
+
const REGION_LOCALES = ["es-MX", "pt-BR", "zh-CN", "zh-TW"];
|
|
2363
|
+
const resolveChineseLocale = (normalized) => {
|
|
2364
|
+
if (/^zh-(Hans|CN|SG)/i.test(normalized) || normalized === "zh") {
|
|
2365
|
+
return "zh-CN";
|
|
2366
|
+
}
|
|
2367
|
+
if (/^zh-(Hant|TW|HK|MO)/i.test(normalized)) {
|
|
2368
|
+
return "zh-TW";
|
|
2369
|
+
}
|
|
2370
|
+
return "zh-CN";
|
|
2371
|
+
};
|
|
2372
|
+
const getLocaleCode = () => {
|
|
2373
|
+
try {
|
|
2374
|
+
const lang = navigator.language;
|
|
2375
|
+
const normalized = lang.replace("_", "-");
|
|
2376
|
+
if (normalized.startsWith("zh")) {
|
|
2377
|
+
return resolveChineseLocale(normalized);
|
|
2378
|
+
}
|
|
2379
|
+
if (REGION_LOCALES.includes(normalized)) {
|
|
2380
|
+
return normalized;
|
|
2381
|
+
}
|
|
2382
|
+
return normalized.split("-")[0];
|
|
2383
|
+
} catch {
|
|
2384
|
+
return "en";
|
|
2385
|
+
}
|
|
2386
|
+
};
|
|
2387
|
+
const getImporter = (locale) => {
|
|
2388
|
+
switch (locale) {
|
|
2389
|
+
case "ar":
|
|
2390
|
+
return () => import("./ar-b72637bc-b72637bc.js");
|
|
2391
|
+
case "bg":
|
|
2392
|
+
return () => import("./bg-5fa1a2c5-5fa1a2c5.js");
|
|
2393
|
+
case "ca":
|
|
2394
|
+
return () => import("./ca-c0eab213-c0eab213.js");
|
|
2395
|
+
case "cs":
|
|
2396
|
+
return () => import("./cs-8c92c102-8c92c102.js");
|
|
2397
|
+
case "da":
|
|
2398
|
+
return () => import("./da-be8e5ef1-be8e5ef1.js");
|
|
2399
|
+
case "de":
|
|
2400
|
+
return () => import("./de-baf5ce96-baf5ce96.js");
|
|
2401
|
+
case "es":
|
|
2402
|
+
return () => import("./es-188a0bb9-188a0bb9.js");
|
|
2403
|
+
case "es-MX":
|
|
2404
|
+
return () => import("./es-MX-c4ac39c4-c4ac39c4.js");
|
|
2405
|
+
case "et":
|
|
2406
|
+
return () => import("./et-8c590cf4-8c590cf4.js");
|
|
2407
|
+
case "fi":
|
|
2408
|
+
return () => import("./fi-ff798599-ff798599.js");
|
|
2409
|
+
case "fil":
|
|
2410
|
+
return () => import("./fil-a1ecb634-a1ecb634.js");
|
|
2411
|
+
case "fr":
|
|
2412
|
+
return () => import("./fr-ef848be0-ef848be0.js");
|
|
2413
|
+
case "he":
|
|
2414
|
+
return () => import("./he-a682875c-a682875c.js");
|
|
2415
|
+
case "hi":
|
|
2416
|
+
return () => import("./hi-33fe103b-33fe103b.js");
|
|
2417
|
+
case "hr":
|
|
2418
|
+
return () => import("./hr-a43e9805-a43e9805.js");
|
|
2419
|
+
case "hu":
|
|
2420
|
+
return () => import("./hu-de39fb94-de39fb94.js");
|
|
2421
|
+
case "id":
|
|
2422
|
+
return () => import("./id-d7d5e3e0-d7d5e3e0.js");
|
|
2423
|
+
case "it":
|
|
2424
|
+
return () => import("./it-ba612edd-ba612edd.js");
|
|
2425
|
+
case "ja":
|
|
2426
|
+
return () => import("./ja-bb50b22e-bb50b22e.js");
|
|
2427
|
+
case "ko":
|
|
2428
|
+
return () => import("./ko-96882818-96882818.js");
|
|
2429
|
+
case "nl":
|
|
2430
|
+
return () => import("./nl-d9264781-d9264781.js");
|
|
2431
|
+
case "pl":
|
|
2432
|
+
return () => import("./pl-a4f71f7a-a4f71f7a.js");
|
|
2433
|
+
case "pt":
|
|
2434
|
+
return () => import("./pt-df68bb8a-df68bb8a.js");
|
|
2435
|
+
case "pt-BR":
|
|
2436
|
+
return () => import("./pt-BR-a8f4cb53-a8f4cb53.js");
|
|
2437
|
+
case "ro":
|
|
2438
|
+
return () => import("./ro-48dec29d-48dec29d.js");
|
|
2439
|
+
case "ru":
|
|
2440
|
+
return () => import("./ru-ab8ea97f-ab8ea97f.js");
|
|
2441
|
+
case "sk":
|
|
2442
|
+
return () => import("./sk-4a3cce24-4a3cce24.js");
|
|
2443
|
+
case "sl":
|
|
2444
|
+
return () => import("./sl-b377a006-b377a006.js");
|
|
2445
|
+
case "sv":
|
|
2446
|
+
return () => import("./sv-8b6d858b-8b6d858b.js");
|
|
2447
|
+
case "th":
|
|
2448
|
+
return () => import("./th-04966cae-04966cae.js");
|
|
2449
|
+
case "tr":
|
|
2450
|
+
return () => import("./tr-6fa455e1-6fa455e1.js");
|
|
2451
|
+
case "uk":
|
|
2452
|
+
return () => import("./uk-3ea3d94e-3ea3d94e.js");
|
|
2453
|
+
case "vi":
|
|
2454
|
+
return () => import("./vi-a8bf337b-a8bf337b.js");
|
|
2455
|
+
case "zh-CN":
|
|
2456
|
+
return () => import("./zh-CN-8f06cb7e-8f06cb7e.js");
|
|
2457
|
+
case "zh-TW":
|
|
2458
|
+
return () => import("./zh-TW-86aec94a-86aec94a.js");
|
|
2459
|
+
default:
|
|
2460
|
+
return null;
|
|
2461
|
+
}
|
|
2462
|
+
};
|
|
2463
|
+
const loadTranslations = async () => {
|
|
2464
|
+
const locale = getLocaleCode();
|
|
2465
|
+
if (locale === "en")
|
|
2466
|
+
return null;
|
|
2467
|
+
if (cachedLocale === locale)
|
|
2468
|
+
return cachedTranslations;
|
|
2469
|
+
try {
|
|
2470
|
+
let importer = getImporter(locale);
|
|
2471
|
+
if (!importer) {
|
|
2472
|
+
const baseLang = locale.split("-")[0];
|
|
2473
|
+
importer = getImporter(baseLang);
|
|
2474
|
+
}
|
|
2475
|
+
if (!importer) {
|
|
2476
|
+
cachedLocale = locale;
|
|
2477
|
+
cachedTranslations = null;
|
|
2478
|
+
return null;
|
|
2479
|
+
}
|
|
2480
|
+
const module = await importer();
|
|
2481
|
+
cachedLocale = locale;
|
|
2482
|
+
cachedTranslations = module.default || module;
|
|
2483
|
+
return cachedTranslations;
|
|
2484
|
+
} catch {
|
|
2485
|
+
cachedLocale = locale;
|
|
2486
|
+
cachedTranslations = null;
|
|
2487
|
+
return null;
|
|
2488
|
+
}
|
|
2489
|
+
};
|
|
2490
|
+
const getTranslatedTimezoneLabel = (englishLabel, translations) => {
|
|
2491
|
+
var _a, _b;
|
|
2492
|
+
if (!translations)
|
|
2493
|
+
return englishLabel;
|
|
2494
|
+
return ((_b = (_a = translations.timezones) == null ? void 0 : _a[englishLabel]) == null ? void 0 : _b.label) || englishLabel;
|
|
2495
|
+
};
|
|
2496
|
+
const getTranslatedRegion = (englishRegion, translations) => {
|
|
2497
|
+
var _a;
|
|
2498
|
+
if (!translations)
|
|
2499
|
+
return englishRegion;
|
|
2500
|
+
return ((_a = translations.regions) == null ? void 0 : _a[englishRegion]) || englishRegion;
|
|
2501
|
+
};
|
|
2502
|
+
const getTranslatedKeywords = (englishLabel, translations) => {
|
|
2503
|
+
var _a, _b;
|
|
2504
|
+
if (!translations)
|
|
2505
|
+
return "";
|
|
2506
|
+
return ((_b = (_a = translations.timezones) == null ? void 0 : _a[englishLabel]) == null ? void 0 : _b.keywords) || "";
|
|
2507
|
+
};
|
|
2508
|
+
const getTranslatedTime = (timeString, translations) => {
|
|
2509
|
+
if (!(translations == null ? void 0 : translations.ampm))
|
|
2510
|
+
return timeString;
|
|
2511
|
+
return timeString.replace(/\bAM\b/i, translations.ampm.am).replace(/\bPM\b/i, translations.ampm.pm);
|
|
2512
|
+
};
|
|
2360
2513
|
const groupedOptions$1 = [
|
|
2361
2514
|
{ "US/Canada": UsCanada },
|
|
2362
2515
|
{ America },
|
|
@@ -2371,6 +2524,15 @@ groupedOptions$1.reduce((accumulator, currentValue) => {
|
|
|
2371
2524
|
const key = Object.keys(currentValue)[0];
|
|
2372
2525
|
return [...accumulator, ...currentValue[key]];
|
|
2373
2526
|
}, []);
|
|
2527
|
+
let translationsPromise = null;
|
|
2528
|
+
const initTranslations = async () => {
|
|
2529
|
+
if (translationsPromise)
|
|
2530
|
+
return translationsPromise;
|
|
2531
|
+
translationsPromise = loadTranslations().then((result) => {
|
|
2532
|
+
return result;
|
|
2533
|
+
});
|
|
2534
|
+
return translationsPromise;
|
|
2535
|
+
};
|
|
2374
2536
|
var n$1, l$1, u$1, i$1, o$1, r$1, f$1, c$1 = {}, s$1 = [], a$1 = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, v$1 = Array.isArray;
|
|
2375
2537
|
function h$1(n2, l2) {
|
|
2376
2538
|
for (var u2 in l2)
|
|
@@ -2795,7 +2957,8 @@ function Button({
|
|
|
2795
2957
|
onClick,
|
|
2796
2958
|
is24H,
|
|
2797
2959
|
dataTestid,
|
|
2798
|
-
disabled = false
|
|
2960
|
+
disabled = false,
|
|
2961
|
+
translations = null
|
|
2799
2962
|
}) {
|
|
2800
2963
|
const { label, keywords: value, cities } = timezone;
|
|
2801
2964
|
const getCurrentTimeInTimezone = (timeZone) => {
|
|
@@ -2810,7 +2973,7 @@ function Button({
|
|
|
2810
2973
|
"en-US",
|
|
2811
2974
|
options
|
|
2812
2975
|
);
|
|
2813
|
-
return currentTimeInTimezone;
|
|
2976
|
+
return getTranslatedTime(currentTimeInTimezone, translations);
|
|
2814
2977
|
};
|
|
2815
2978
|
return /* @__PURE__ */ y(
|
|
2816
2979
|
"button",
|
|
@@ -2820,7 +2983,7 @@ function Button({
|
|
|
2820
2983
|
"data-testid": dataTestid,
|
|
2821
2984
|
type: "button"
|
|
2822
2985
|
},
|
|
2823
|
-
/* @__PURE__ */ y("div", { className: "neeto-time-zones-button--label relative", key: label }, hideCitiesTooltip ? label : /* @__PURE__ */ y("span", { ...{ value }, title: cities }, label)),
|
|
2986
|
+
/* @__PURE__ */ y("div", { className: "neeto-time-zones-button--label relative", key: label }, hideCitiesTooltip ? getTranslatedTimezoneLabel(label, translations) : /* @__PURE__ */ y("span", { ...{ value }, title: cities }, getTranslatedTimezoneLabel(label, translations))),
|
|
2824
2987
|
/* @__PURE__ */ y("span", { className: "neeto-time-zones-button--time" }, getCurrentTimeInTimezone((timezone == null ? void 0 : timezone.main) || (timezone == null ? void 0 : timezone.utc[0]))),
|
|
2825
2988
|
children
|
|
2826
2989
|
);
|
|
@@ -2831,7 +2994,8 @@ function Dropdown({
|
|
|
2831
2994
|
elementId,
|
|
2832
2995
|
is24H,
|
|
2833
2996
|
setIsOverlayVisible,
|
|
2834
|
-
disabled
|
|
2997
|
+
disabled,
|
|
2998
|
+
translations
|
|
2835
2999
|
}) {
|
|
2836
3000
|
const handleClick = () => {
|
|
2837
3001
|
setIsOverlayVisible(
|
|
@@ -2848,7 +3012,7 @@ function Dropdown({
|
|
|
2848
3012
|
return /* @__PURE__ */ y(
|
|
2849
3013
|
Button,
|
|
2850
3014
|
{
|
|
2851
|
-
...{ is24H, disabled },
|
|
3015
|
+
...{ is24H, disabled, translations },
|
|
2852
3016
|
onClick: handleClick,
|
|
2853
3017
|
className: "neeto-time-zones-dropdown",
|
|
2854
3018
|
timezone: selectedValue,
|
|
@@ -2945,7 +3109,7 @@ const getDataTestid = (timezone) => {
|
|
|
2945
3109
|
}
|
|
2946
3110
|
return `${hyphenize(label)}-select-option`;
|
|
2947
3111
|
};
|
|
2948
|
-
const createGroupedOptionButton = (group, selectedValue, handleSelect, is24H) => /* @__PURE__ */ y("div", null, group.map((groupItem) => {
|
|
3112
|
+
const createGroupedOptionButton = (group, selectedValue, handleSelect, is24H, translations) => /* @__PURE__ */ y("div", null, group.map((groupItem) => {
|
|
2949
3113
|
const key = Object.keys(groupItem)[0];
|
|
2950
3114
|
const element = groupItem[key];
|
|
2951
3115
|
return /* @__PURE__ */ y(
|
|
@@ -2954,11 +3118,11 @@ const createGroupedOptionButton = (group, selectedValue, handleSelect, is24H) =>
|
|
|
2954
3118
|
className: "neeto-time-zones-list__container",
|
|
2955
3119
|
key: key.toLowerCase()
|
|
2956
3120
|
},
|
|
2957
|
-
/* @__PURE__ */ y("span", { className: "neeto-time-zones-list--title" }, key),
|
|
3121
|
+
/* @__PURE__ */ y("span", { className: "neeto-time-zones-list--title" }, getTranslatedRegion(key, translations)),
|
|
2958
3122
|
element.map((timezone) => /* @__PURE__ */ y(
|
|
2959
3123
|
Button,
|
|
2960
3124
|
{
|
|
2961
|
-
...{ is24H, timezone },
|
|
3125
|
+
...{ is24H, timezone, translations },
|
|
2962
3126
|
id: valueToId(timezone.keywords),
|
|
2963
3127
|
onClick: handleSelect,
|
|
2964
3128
|
className: `neeto-time-zones-list-item ${selectedValue.keywords === timezone.keywords && "neeto-time-zones-list-item--active"}`,
|
|
@@ -2968,15 +3132,21 @@ const createGroupedOptionButton = (group, selectedValue, handleSelect, is24H) =>
|
|
|
2968
3132
|
))
|
|
2969
3133
|
);
|
|
2970
3134
|
}));
|
|
2971
|
-
const filterTimezones = (inputValue) => {
|
|
3135
|
+
const filterTimezones = (inputValue, translations) => {
|
|
2972
3136
|
if (inputValue === "") {
|
|
2973
3137
|
return groupedOptions;
|
|
2974
3138
|
}
|
|
3139
|
+
const lowerInput = inputValue.toLowerCase();
|
|
2975
3140
|
const filteredOptions = groupedOptions.map((group) => {
|
|
2976
3141
|
const key = Object.keys(group)[0];
|
|
2977
|
-
const element = group[key].filter(
|
|
2978
|
-
|
|
2979
|
-
|
|
3142
|
+
const element = group[key].filter((timezone) => {
|
|
3143
|
+
const matchesEnglish = timezone.label.toLowerCase().includes(lowerInput) || timezone.keywords.toLowerCase().includes(lowerInput);
|
|
3144
|
+
if (matchesEnglish)
|
|
3145
|
+
return true;
|
|
3146
|
+
const translatedLabel = getTranslatedTimezoneLabel(timezone.label, translations);
|
|
3147
|
+
const translatedKeywords = getTranslatedKeywords(timezone.label, translations);
|
|
3148
|
+
return translatedLabel.toLowerCase().includes(lowerInput) || translatedKeywords.toLowerCase().includes(lowerInput);
|
|
3149
|
+
});
|
|
2980
3150
|
return isNotEmpty(element) ? { [key]: element } : null;
|
|
2981
3151
|
});
|
|
2982
3152
|
return filteredOptions.filter(isNot(null));
|
|
@@ -2987,7 +3157,8 @@ function Options({
|
|
|
2987
3157
|
searchInput,
|
|
2988
3158
|
selectedValue,
|
|
2989
3159
|
setSelectedValue,
|
|
2990
|
-
setIsOverlayVisible
|
|
3160
|
+
setIsOverlayVisible,
|
|
3161
|
+
translations
|
|
2991
3162
|
}) {
|
|
2992
3163
|
const handleSelect = (e2) => {
|
|
2993
3164
|
const parentButton = e2.target.closest("button");
|
|
@@ -3021,10 +3192,11 @@ function Options({
|
|
|
3021
3192
|
id: `${elementId}-ntsp-overflow-container`
|
|
3022
3193
|
},
|
|
3023
3194
|
createGroupedOptionButton(
|
|
3024
|
-
filterTimezones(searchInput),
|
|
3195
|
+
filterTimezones(searchInput, translations),
|
|
3025
3196
|
selectedValue,
|
|
3026
3197
|
handleSelect,
|
|
3027
|
-
is24H
|
|
3198
|
+
is24H,
|
|
3199
|
+
translations
|
|
3028
3200
|
)
|
|
3029
3201
|
);
|
|
3030
3202
|
}
|
|
@@ -3070,7 +3242,8 @@ function OptionsContainer({
|
|
|
3070
3242
|
setIsOverlayVisible,
|
|
3071
3243
|
setIs24H,
|
|
3072
3244
|
position,
|
|
3073
|
-
isTimeFormatSwitchVisible
|
|
3245
|
+
isTimeFormatSwitchVisible,
|
|
3246
|
+
translations
|
|
3074
3247
|
}) {
|
|
3075
3248
|
const [searchInput, setSearchInput] = h("");
|
|
3076
3249
|
const handleTimeFormatChange = (value) => {
|
|
@@ -3100,7 +3273,8 @@ function OptionsContainer({
|
|
|
3100
3273
|
searchInput,
|
|
3101
3274
|
selectedValue,
|
|
3102
3275
|
setIsOverlayVisible,
|
|
3103
|
-
setSelectedValue
|
|
3276
|
+
setSelectedValue,
|
|
3277
|
+
translations
|
|
3104
3278
|
}
|
|
3105
3279
|
}
|
|
3106
3280
|
)
|
|
@@ -3128,6 +3302,7 @@ function Selector({
|
|
|
3128
3302
|
const [is24H, setIs24H] = h(
|
|
3129
3303
|
getFromLocalStorage("ntsp-24-hr-time-format") || false
|
|
3130
3304
|
);
|
|
3305
|
+
const [translations, setTranslations] = h(null);
|
|
3131
3306
|
p(() => {
|
|
3132
3307
|
const handleOutsideClick = (e2) => {
|
|
3133
3308
|
const element = document.getElementById(elementId);
|
|
@@ -3154,6 +3329,9 @@ function Selector({
|
|
|
3154
3329
|
const timeZone = getTimezoneObject(initialValue) || getDefaultValue;
|
|
3155
3330
|
setSelectedValue(timeZone);
|
|
3156
3331
|
}, [initialValue]);
|
|
3332
|
+
p(() => {
|
|
3333
|
+
initTranslations().then(setTranslations);
|
|
3334
|
+
}, []);
|
|
3157
3335
|
return /* @__PURE__ */ y("div", { className: "neeto-time-zones__wrapper", id: elementId }, /* @__PURE__ */ y("div", { className: `neeto-time-zones__container ${className}` }, /* @__PURE__ */ y(
|
|
3158
3336
|
Dropdown,
|
|
3159
3337
|
{
|
|
@@ -3163,7 +3341,8 @@ function Selector({
|
|
|
3163
3341
|
is24H,
|
|
3164
3342
|
isOverlayVisible,
|
|
3165
3343
|
selectedValue,
|
|
3166
|
-
setIsOverlayVisible
|
|
3344
|
+
setIsOverlayVisible,
|
|
3345
|
+
translations
|
|
3167
3346
|
}
|
|
3168
3347
|
}
|
|
3169
3348
|
), isOverlayVisible === true && /* @__PURE__ */ y(
|
|
@@ -3177,7 +3356,8 @@ function Selector({
|
|
|
3177
3356
|
setIs24H,
|
|
3178
3357
|
setIsOverlayVisible,
|
|
3179
3358
|
setSelectedValue,
|
|
3180
|
-
isTimeFormatSwitchVisible
|
|
3359
|
+
isTimeFormatSwitchVisible,
|
|
3360
|
+
translations
|
|
3181
3361
|
}
|
|
3182
3362
|
}
|
|
3183
3363
|
)));
|