@krak-stack/registry 0.1.31 → 0.1.33
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 +21 -0
- package/dist/components/ui/code-block.d.ts +8 -6
- package/dist/components/ui/code-block.js +40 -19
- package/dist/components/ui/copy-button.d.ts +9 -6
- package/dist/components/ui/copy-button.js +15 -8
- package/dist/components/ui/data-table.d.ts +9 -5
- package/dist/components/ui/data-table.js +74 -479
- package/dist/components/ui/editing-locale-switcher.d.ts +8 -4
- package/dist/components/ui/editing-locale-switcher.js +20 -448
- package/dist/components/ui/effect-form.d.ts +39 -10
- package/dist/components/ui/effect-form.js +141 -527
- package/dist/components/ui/error-component.d.ts +4 -2
- package/dist/components/ui/error-component.js +24 -450
- package/dist/components/ui/file-picker.d.ts +4 -2
- package/dist/components/ui/file-picker.js +25 -452
- package/dist/components/ui/form.d.ts +123 -71
- package/dist/components/ui/form.js +81 -474
- package/dist/components/ui/google-map.d.ts +2 -1
- package/dist/components/ui/google-map.js +4 -439
- package/dist/components/ui/icon-input.d.ts +50 -1
- package/dist/components/ui/icon-input.js +30 -446
- package/dist/components/ui/loading.d.ts +7 -1
- package/dist/components/ui/loading.js +4 -438
- package/dist/components/ui/locale-switcher.d.ts +8 -4
- package/dist/components/ui/locale-switcher.js +29 -453
- package/dist/components/ui/pagination.d.ts +5 -3
- package/dist/components/ui/pagination.js +5 -439
- package/dist/components/ui/search-menu.d.ts +4 -2
- package/dist/components/ui/search-menu.js +6 -440
- package/dist/components/ui/theme-switcher.d.ts +5 -3
- package/dist/components/ui/theme-switcher.js +6 -440
- package/dist/components/ui/virtualized-combobox.d.ts +4 -2
- package/dist/components/ui/virtualized-combobox.js +11 -443
- package/dist/lib/docs.d.ts +2 -0
- package/dist/lib/docs.js +86 -481
- package/dist/lib/docs.server.js +0 -21
- package/dist/lib/documentation-toolkit.js +0 -21
- package/dist/lib/markdown/content.d.ts +4 -5
- package/dist/services/agent/client/index.js +75 -463
- package/dist/services/agent/client/widget.d.ts +6 -3
- package/dist/services/notification/client/index.js +8 -440
- package/dist/services/notification/client/notification-menu.d.ts +6 -3
- package/dist/services/notification/public.js +8 -440
- package/dist/services/opentelemetry/api.d.ts +5 -0
- package/dist/services/opentelemetry/api.js +44 -0
- package/dist/services/opentelemetry/browser.d.ts +10 -0
- package/dist/services/opentelemetry/browser.js +59 -0
- package/package.json +9 -1
- package/dist/paraglide/runtime.d.ts +0 -978
|
@@ -304,442 +304,6 @@ function Input({ className, type, ...props }) {
|
|
|
304
304
|
});
|
|
305
305
|
}
|
|
306
306
|
|
|
307
|
-
// ../../src/paraglide/runtime.js
|
|
308
|
-
import"@inlang/paraglide-js/urlpattern-polyfill";
|
|
309
|
-
var baseLocale = "en";
|
|
310
|
-
var locales = ["en", "fr"];
|
|
311
|
-
var cookieName = "locale";
|
|
312
|
-
var cookieMaxAge = 34560000;
|
|
313
|
-
var cookieDomain = "";
|
|
314
|
-
var localStorageKey = "PARAGLIDE_LOCALE";
|
|
315
|
-
var strategy = [
|
|
316
|
-
"url",
|
|
317
|
-
"cookie",
|
|
318
|
-
"preferredLanguage",
|
|
319
|
-
"baseLocale"
|
|
320
|
-
];
|
|
321
|
-
var routeStrategies = [
|
|
322
|
-
{
|
|
323
|
-
match: "/api/:path(.*)?",
|
|
324
|
-
exclude: true
|
|
325
|
-
},
|
|
326
|
-
{
|
|
327
|
-
match: "/sitemap.xml",
|
|
328
|
-
exclude: true
|
|
329
|
-
},
|
|
330
|
-
{
|
|
331
|
-
match: "/llms.txt",
|
|
332
|
-
exclude: true
|
|
333
|
-
}
|
|
334
|
-
];
|
|
335
|
-
var urlPatterns = [
|
|
336
|
-
{
|
|
337
|
-
pattern: "/:path(.*)?",
|
|
338
|
-
localized: [
|
|
339
|
-
[
|
|
340
|
-
"en",
|
|
341
|
-
"/en/:path(.*)?"
|
|
342
|
-
],
|
|
343
|
-
[
|
|
344
|
-
"fr",
|
|
345
|
-
"/fr/:path(.*)?"
|
|
346
|
-
]
|
|
347
|
-
]
|
|
348
|
-
}
|
|
349
|
-
];
|
|
350
|
-
var cachedRouteStrategyUrl;
|
|
351
|
-
var cachedRouteStrategy;
|
|
352
|
-
function findMatchingRouteStrategy(url) {
|
|
353
|
-
if (routeStrategies.length === 0) {
|
|
354
|
-
return;
|
|
355
|
-
}
|
|
356
|
-
const urlString = typeof url === "string" ? url : url.href;
|
|
357
|
-
if (cachedRouteStrategyUrl === urlString) {
|
|
358
|
-
return cachedRouteStrategy;
|
|
359
|
-
}
|
|
360
|
-
const urlObject = new URL(urlString, "http://dummy.com");
|
|
361
|
-
let match;
|
|
362
|
-
for (const routeStrategy of routeStrategies) {
|
|
363
|
-
const pattern = new URLPattern(routeStrategy.match, urlObject.href);
|
|
364
|
-
if (pattern.exec(urlObject.href)) {
|
|
365
|
-
match = routeStrategy;
|
|
366
|
-
break;
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
cachedRouteStrategyUrl = urlString;
|
|
370
|
-
cachedRouteStrategy = match;
|
|
371
|
-
return match;
|
|
372
|
-
}
|
|
373
|
-
function getStrategyForUrl(url) {
|
|
374
|
-
const routeStrategy = findMatchingRouteStrategy(url);
|
|
375
|
-
if (routeStrategy && routeStrategy.exclude !== true && Array.isArray(routeStrategy.strategy)) {
|
|
376
|
-
return routeStrategy.strategy;
|
|
377
|
-
}
|
|
378
|
-
return strategy;
|
|
379
|
-
}
|
|
380
|
-
var serverAsyncLocalStorage = undefined;
|
|
381
|
-
var isServer = import.meta.env?.SSR ?? typeof window === "undefined";
|
|
382
|
-
var experimentalStaticLocale = undefined;
|
|
383
|
-
var TREE_SHAKE_COOKIE_STRATEGY_USED = true;
|
|
384
|
-
var TREE_SHAKE_URL_STRATEGY_USED = true;
|
|
385
|
-
var TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED = false;
|
|
386
|
-
var TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED = true;
|
|
387
|
-
var TREE_SHAKE_DEFAULT_URL_PATTERN_USED = false;
|
|
388
|
-
var TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED = false;
|
|
389
|
-
globalThis.__paraglide = globalThis.__paraglide ?? {};
|
|
390
|
-
globalThis.__paraglide.ssr = globalThis.__paraglide.ssr ?? {};
|
|
391
|
-
var _locale;
|
|
392
|
-
var localeInitiallySet = false;
|
|
393
|
-
var getLocale = () => {
|
|
394
|
-
if (experimentalStaticLocale !== undefined) {
|
|
395
|
-
return experimentalStaticLocale;
|
|
396
|
-
}
|
|
397
|
-
if (serverAsyncLocalStorage) {
|
|
398
|
-
const locale = serverAsyncLocalStorage?.getStore()?.locale;
|
|
399
|
-
if (locale) {
|
|
400
|
-
return locale;
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
let strategyToUse = strategy;
|
|
404
|
-
if (!isServer && typeof window !== "undefined" && window.location?.href) {
|
|
405
|
-
strategyToUse = getStrategyForUrl(window.location.href);
|
|
406
|
-
}
|
|
407
|
-
const resolved = resolveLocaleWithStrategies(strategyToUse, typeof window !== "undefined" ? window.location?.href : undefined);
|
|
408
|
-
if (resolved) {
|
|
409
|
-
if (!localeInitiallySet) {
|
|
410
|
-
_locale = resolved;
|
|
411
|
-
localeInitiallySet = true;
|
|
412
|
-
setLocale(resolved, { reload: false });
|
|
413
|
-
}
|
|
414
|
-
return resolved;
|
|
415
|
-
}
|
|
416
|
-
throw new Error("No locale found. Read the docs https://paraglidejs.com/errors#no-locale-found");
|
|
417
|
-
};
|
|
418
|
-
function resolveLocaleWithStrategies(strategyToUse, urlForUrlStrategy) {
|
|
419
|
-
let locale;
|
|
420
|
-
for (const strat of strategyToUse) {
|
|
421
|
-
if (TREE_SHAKE_COOKIE_STRATEGY_USED && strat === "cookie") {
|
|
422
|
-
locale = extractLocaleFromCookie();
|
|
423
|
-
} else if (strat === "baseLocale") {
|
|
424
|
-
locale = baseLocale;
|
|
425
|
-
} else if (TREE_SHAKE_URL_STRATEGY_USED && strat === "url" && !isServer && typeof urlForUrlStrategy === "string") {
|
|
426
|
-
locale = extractLocaleFromUrl(urlForUrlStrategy);
|
|
427
|
-
} else if (TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED && strat === "globalVariable" && _locale !== undefined) {
|
|
428
|
-
locale = _locale;
|
|
429
|
-
} else if (TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED && strat === "preferredLanguage" && !isServer) {
|
|
430
|
-
locale = extractLocaleFromNavigator();
|
|
431
|
-
} else if (TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED && strat === "localStorage" && !isServer) {
|
|
432
|
-
locale = localStorage.getItem(localStorageKey) ?? undefined;
|
|
433
|
-
} else if (isCustomStrategy(strat) && customClientStrategies.has(strat)) {
|
|
434
|
-
const handler = customClientStrategies.get(strat);
|
|
435
|
-
if (handler) {
|
|
436
|
-
const result = handler.getLocale();
|
|
437
|
-
if (result instanceof Promise) {
|
|
438
|
-
continue;
|
|
439
|
-
}
|
|
440
|
-
if (result !== undefined) {
|
|
441
|
-
return assertIsLocale(result);
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
const matchedLocale = toLocale(locale);
|
|
446
|
-
if (matchedLocale) {
|
|
447
|
-
return matchedLocale;
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
return;
|
|
451
|
-
}
|
|
452
|
-
var rtlLanguages = new Set([
|
|
453
|
-
"ar",
|
|
454
|
-
"dv",
|
|
455
|
-
"fa",
|
|
456
|
-
"he",
|
|
457
|
-
"ks",
|
|
458
|
-
"ku",
|
|
459
|
-
"ps",
|
|
460
|
-
"sd",
|
|
461
|
-
"ug",
|
|
462
|
-
"ur",
|
|
463
|
-
"yi"
|
|
464
|
-
]);
|
|
465
|
-
var navigateOrReload = (newLocation) => {
|
|
466
|
-
if (newLocation) {
|
|
467
|
-
window.location.href = newLocation;
|
|
468
|
-
} else {
|
|
469
|
-
window.location.reload();
|
|
470
|
-
}
|
|
471
|
-
};
|
|
472
|
-
var setLocale = (newLocale, options) => {
|
|
473
|
-
const optionsWithDefaults = {
|
|
474
|
-
reload: true,
|
|
475
|
-
...options
|
|
476
|
-
};
|
|
477
|
-
let currentLocale;
|
|
478
|
-
try {
|
|
479
|
-
currentLocale = getLocale();
|
|
480
|
-
} catch {}
|
|
481
|
-
const customSetLocalePromises = [];
|
|
482
|
-
let newLocation = undefined;
|
|
483
|
-
let strategyToUse = strategy;
|
|
484
|
-
if (!isServer && typeof window !== "undefined" && window.location?.href) {
|
|
485
|
-
strategyToUse = getStrategyForUrl(window.location.href);
|
|
486
|
-
}
|
|
487
|
-
for (const strat of strategyToUse) {
|
|
488
|
-
if (TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED && strat === "globalVariable") {
|
|
489
|
-
_locale = newLocale;
|
|
490
|
-
} else if (TREE_SHAKE_COOKIE_STRATEGY_USED && strat === "cookie") {
|
|
491
|
-
if (isServer || typeof document === "undefined" || typeof window === "undefined") {
|
|
492
|
-
continue;
|
|
493
|
-
}
|
|
494
|
-
const cookieString = `${cookieName}=${newLocale}; path=/; max-age=${cookieMaxAge}`;
|
|
495
|
-
document.cookie = cookieDomain ? `${cookieString}; domain=${cookieDomain}` : cookieString;
|
|
496
|
-
} else if (strat === "baseLocale") {
|
|
497
|
-
continue;
|
|
498
|
-
} else if (TREE_SHAKE_URL_STRATEGY_USED && strat === "url" && typeof window !== "undefined") {
|
|
499
|
-
newLocation = localizeUrl(window.location.href, {
|
|
500
|
-
locale: newLocale
|
|
501
|
-
}).href;
|
|
502
|
-
} else if (TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED && strat === "localStorage" && typeof window !== "undefined") {
|
|
503
|
-
localStorage.setItem(localStorageKey, newLocale);
|
|
504
|
-
} else if (isCustomStrategy(strat) && customClientStrategies.has(strat)) {
|
|
505
|
-
const handler = customClientStrategies.get(strat);
|
|
506
|
-
if (handler) {
|
|
507
|
-
let result = handler.setLocale(newLocale);
|
|
508
|
-
if (result instanceof Promise) {
|
|
509
|
-
result = result.catch((error) => {
|
|
510
|
-
throw new Error(`Custom strategy "${strat}" setLocale failed.`, {
|
|
511
|
-
cause: error
|
|
512
|
-
});
|
|
513
|
-
});
|
|
514
|
-
customSetLocalePromises.push(result);
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
const runReload = () => {
|
|
520
|
-
if (!isServer && optionsWithDefaults.reload && window.location && newLocale !== currentLocale) {
|
|
521
|
-
navigateOrReload(newLocation);
|
|
522
|
-
}
|
|
523
|
-
};
|
|
524
|
-
if (customSetLocalePromises.length) {
|
|
525
|
-
return Promise.all(customSetLocalePromises).then(() => {
|
|
526
|
-
runReload();
|
|
527
|
-
});
|
|
528
|
-
}
|
|
529
|
-
runReload();
|
|
530
|
-
return;
|
|
531
|
-
};
|
|
532
|
-
var getUrlOrigin = () => {
|
|
533
|
-
if (serverAsyncLocalStorage) {
|
|
534
|
-
return serverAsyncLocalStorage.getStore()?.origin ?? "http://fallback.com";
|
|
535
|
-
} else if (typeof window !== "undefined") {
|
|
536
|
-
return window.location.origin;
|
|
537
|
-
}
|
|
538
|
-
return "http://fallback.com";
|
|
539
|
-
};
|
|
540
|
-
function toLocale(value) {
|
|
541
|
-
if (typeof value !== "string") {
|
|
542
|
-
return;
|
|
543
|
-
}
|
|
544
|
-
const lowerValue = value.toLowerCase();
|
|
545
|
-
for (const locale of locales) {
|
|
546
|
-
if (locale.toLowerCase() === lowerValue) {
|
|
547
|
-
return locale;
|
|
548
|
-
}
|
|
549
|
-
}
|
|
550
|
-
return;
|
|
551
|
-
}
|
|
552
|
-
function assertIsLocale(input) {
|
|
553
|
-
const locale = toLocale(input);
|
|
554
|
-
if (locale)
|
|
555
|
-
return locale;
|
|
556
|
-
throw new Error(`Invalid locale: ${input}. Expected one of: ${locales.join(", ")}`);
|
|
557
|
-
}
|
|
558
|
-
function extractLocaleFromCookie() {
|
|
559
|
-
if (typeof document === "undefined" || !document.cookie) {
|
|
560
|
-
return;
|
|
561
|
-
}
|
|
562
|
-
const match = document.cookie.match(new RegExp(`(^| )${cookieName}=([^;]+)`));
|
|
563
|
-
const locale = match?.[2];
|
|
564
|
-
return toLocale(locale);
|
|
565
|
-
}
|
|
566
|
-
function extractLocaleFromNavigator() {
|
|
567
|
-
if (!navigator?.languages?.length) {
|
|
568
|
-
return;
|
|
569
|
-
}
|
|
570
|
-
const languages = navigator.languages.map((lang) => ({
|
|
571
|
-
fullTag: lang,
|
|
572
|
-
baseTag: lang.split("-")[0]
|
|
573
|
-
}));
|
|
574
|
-
for (const lang of languages) {
|
|
575
|
-
const fullLocale = toLocale(lang.fullTag);
|
|
576
|
-
if (fullLocale) {
|
|
577
|
-
return fullLocale;
|
|
578
|
-
}
|
|
579
|
-
const baseLocale2 = toLocale(lang.baseTag);
|
|
580
|
-
if (baseLocale2) {
|
|
581
|
-
return baseLocale2;
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
return;
|
|
585
|
-
}
|
|
586
|
-
var cachedUrl;
|
|
587
|
-
var cachedLocale;
|
|
588
|
-
function extractLocaleFromUrl(url) {
|
|
589
|
-
const urlString = typeof url === "string" ? url : url.href;
|
|
590
|
-
if (cachedUrl === urlString) {
|
|
591
|
-
return cachedLocale;
|
|
592
|
-
}
|
|
593
|
-
let result;
|
|
594
|
-
if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {
|
|
595
|
-
result = defaultUrlPatternExtractLocale(url);
|
|
596
|
-
} else {
|
|
597
|
-
const urlObj = typeof url === "string" ? new URL(url) : url;
|
|
598
|
-
for (const element of urlPatterns) {
|
|
599
|
-
for (const [locale, localizedPattern] of element.localized) {
|
|
600
|
-
const match = new URLPattern(localizedPattern, urlObj.href).exec(urlObj.href);
|
|
601
|
-
if (match) {
|
|
602
|
-
result = locale;
|
|
603
|
-
break;
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
if (result)
|
|
607
|
-
break;
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
cachedUrl = urlString;
|
|
611
|
-
cachedLocale = result;
|
|
612
|
-
return result;
|
|
613
|
-
}
|
|
614
|
-
function defaultUrlPatternExtractLocale(url) {
|
|
615
|
-
const urlObj = new URL(url, "http://dummy.com");
|
|
616
|
-
const pathSegments = urlObj.pathname.split("/").filter(Boolean);
|
|
617
|
-
return toLocale(pathSegments[0]) || baseLocale;
|
|
618
|
-
}
|
|
619
|
-
function localizeUrl(url, options) {
|
|
620
|
-
const targetLocale = options?.locale ? assertIsLocale(options?.locale) : getLocale();
|
|
621
|
-
if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {
|
|
622
|
-
return localizeUrlDefaultPattern(url, targetLocale);
|
|
623
|
-
}
|
|
624
|
-
const urlObj = typeof url === "string" ? new URL(url) : url;
|
|
625
|
-
for (const element of urlPatterns) {
|
|
626
|
-
for (const [, localizedPattern] of element.localized) {
|
|
627
|
-
const match = new URLPattern(localizedPattern, urlObj.href).exec(urlObj.href);
|
|
628
|
-
if (!match) {
|
|
629
|
-
continue;
|
|
630
|
-
}
|
|
631
|
-
const targetPattern = element.localized.find(([locale]) => locale === targetLocale)?.[1];
|
|
632
|
-
if (!targetPattern) {
|
|
633
|
-
continue;
|
|
634
|
-
}
|
|
635
|
-
const localizedUrl = fillPattern(targetPattern, aggregateGroups(match), urlObj.origin);
|
|
636
|
-
return fillMissingUrlParts(localizedUrl, match);
|
|
637
|
-
}
|
|
638
|
-
const unlocalizedMatch = new URLPattern(element.pattern, urlObj.href).exec(urlObj.href);
|
|
639
|
-
if (unlocalizedMatch) {
|
|
640
|
-
const targetPattern = element.localized.find(([locale]) => locale === targetLocale)?.[1];
|
|
641
|
-
if (targetPattern) {
|
|
642
|
-
const localizedUrl = fillPattern(targetPattern, aggregateGroups(unlocalizedMatch), urlObj.origin);
|
|
643
|
-
return fillMissingUrlParts(localizedUrl, unlocalizedMatch);
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
return urlObj;
|
|
648
|
-
}
|
|
649
|
-
function localizeUrlDefaultPattern(url, locale) {
|
|
650
|
-
const urlObj = typeof url === "string" ? new URL(url, getUrlOrigin()) : new URL(url);
|
|
651
|
-
const currentLocale = extractLocaleFromUrl(urlObj);
|
|
652
|
-
if (currentLocale === locale) {
|
|
653
|
-
return urlObj;
|
|
654
|
-
}
|
|
655
|
-
const pathSegments = urlObj.pathname.split("/").filter(Boolean);
|
|
656
|
-
if (pathSegments.length > 0 && toLocale(pathSegments[0])) {
|
|
657
|
-
pathSegments.shift();
|
|
658
|
-
}
|
|
659
|
-
if (locale === baseLocale) {
|
|
660
|
-
urlObj.pathname = "/" + pathSegments.join("/");
|
|
661
|
-
} else {
|
|
662
|
-
urlObj.pathname = "/" + locale + "/" + pathSegments.join("/");
|
|
663
|
-
}
|
|
664
|
-
return urlObj;
|
|
665
|
-
}
|
|
666
|
-
function fillMissingUrlParts(url, match) {
|
|
667
|
-
if (match.protocol.groups["0"]) {
|
|
668
|
-
url.protocol = match.protocol.groups["0"] ?? "";
|
|
669
|
-
}
|
|
670
|
-
if (match.hostname.groups["0"]) {
|
|
671
|
-
url.hostname = match.hostname.groups["0"] ?? "";
|
|
672
|
-
}
|
|
673
|
-
if (match.username.groups["0"]) {
|
|
674
|
-
url.username = match.username.groups["0"] ?? "";
|
|
675
|
-
}
|
|
676
|
-
if (match.password.groups["0"]) {
|
|
677
|
-
url.password = match.password.groups["0"] ?? "";
|
|
678
|
-
}
|
|
679
|
-
if (match.port.groups["0"]) {
|
|
680
|
-
url.port = match.port.groups["0"] ?? "";
|
|
681
|
-
}
|
|
682
|
-
if (match.pathname.groups["0"]) {
|
|
683
|
-
url.pathname = match.pathname.groups["0"] ?? "";
|
|
684
|
-
}
|
|
685
|
-
if (match.search.groups["0"]) {
|
|
686
|
-
url.search = match.search.groups["0"] ?? "";
|
|
687
|
-
}
|
|
688
|
-
if (match.hash.groups["0"]) {
|
|
689
|
-
url.hash = match.hash.groups["0"] ?? "";
|
|
690
|
-
}
|
|
691
|
-
return url;
|
|
692
|
-
}
|
|
693
|
-
function fillPattern(pattern, values, origin) {
|
|
694
|
-
let processedPattern = pattern.replace(/(https?:\/\/[^:/]+):(\d+)(\/|$)/g, (_, protocol, port, slash) => {
|
|
695
|
-
return `${protocol}#PORT-${port}#${slash}`;
|
|
696
|
-
});
|
|
697
|
-
let processedGroupDelimiters = processedPattern.replace(/\{([^{}]*)\}([?+*]?)/g, (_, content, modifier) => {
|
|
698
|
-
if (modifier === "?") {
|
|
699
|
-
return content;
|
|
700
|
-
}
|
|
701
|
-
return content;
|
|
702
|
-
});
|
|
703
|
-
let filled = processedGroupDelimiters.replace(/(\/?):([a-zA-Z0-9_]+)(\([^)]*\))?([?+*]?)/g, (_, slash, name, __, modifier) => {
|
|
704
|
-
const value = values[name];
|
|
705
|
-
if (value === null) {
|
|
706
|
-
return "";
|
|
707
|
-
}
|
|
708
|
-
if (modifier === "?") {
|
|
709
|
-
return value !== undefined ? `${slash}${value}` : "";
|
|
710
|
-
}
|
|
711
|
-
if (modifier === "+" || modifier === "*") {
|
|
712
|
-
if (value === undefined && modifier === "+") {
|
|
713
|
-
throw new Error(`Missing value for "${name}" (one or more required)`);
|
|
714
|
-
}
|
|
715
|
-
return value ? `${slash}${value}` : "";
|
|
716
|
-
}
|
|
717
|
-
if (value === undefined) {
|
|
718
|
-
throw new Error(`Missing value for "${name}"`);
|
|
719
|
-
}
|
|
720
|
-
return `${slash}${value}`;
|
|
721
|
-
});
|
|
722
|
-
filled = filled.replace(/#PORT-(\d+)#/g, ":$1");
|
|
723
|
-
return new URL(filled, origin);
|
|
724
|
-
}
|
|
725
|
-
function aggregateGroups(match) {
|
|
726
|
-
return {
|
|
727
|
-
...match.hash.groups,
|
|
728
|
-
...match.hostname.groups,
|
|
729
|
-
...match.password.groups,
|
|
730
|
-
...match.pathname.groups,
|
|
731
|
-
...match.port.groups,
|
|
732
|
-
...match.protocol.groups,
|
|
733
|
-
...match.search.groups,
|
|
734
|
-
...match.username.groups
|
|
735
|
-
};
|
|
736
|
-
}
|
|
737
|
-
var customServerStrategies = new Map;
|
|
738
|
-
var customClientStrategies = new Map;
|
|
739
|
-
function isCustomStrategy(strategy2) {
|
|
740
|
-
return typeof strategy2 === "string" && /^custom-[A-Za-z0-9_-]+$/.test(strategy2);
|
|
741
|
-
}
|
|
742
|
-
|
|
743
307
|
// ../../src/components/ui/file-picker.tsx
|
|
744
308
|
import { jsx as jsx5, jsxs as jsxs2, Fragment } from "react/jsx-runtime";
|
|
745
309
|
"use client";
|
|
@@ -763,22 +327,30 @@ var messages = {
|
|
|
763
327
|
replaceFile: "Remplacer le fichier"
|
|
764
328
|
}
|
|
765
329
|
};
|
|
766
|
-
var filePickerMessages = (
|
|
767
|
-
...
|
|
768
|
-
...
|
|
330
|
+
var filePickerMessages = (locale, translations) => ({
|
|
331
|
+
...locale.startsWith("fr") ? messages.fr : messages.en,
|
|
332
|
+
...translations?.[locale.split("-")[0] ?? locale],
|
|
333
|
+
...translations?.[locale]
|
|
769
334
|
});
|
|
770
|
-
var formatBytes = (bytes) => {
|
|
771
|
-
const
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
335
|
+
var formatBytes = (bytes, locale) => {
|
|
336
|
+
const units = [
|
|
337
|
+
"byte",
|
|
338
|
+
"kilobyte",
|
|
339
|
+
"megabyte",
|
|
340
|
+
"gigabyte",
|
|
341
|
+
"terabyte"
|
|
342
|
+
];
|
|
343
|
+
const index = Math.min(bytes === 0 ? 0 : Math.floor(Math.log(bytes) / Math.log(1024)), units.length - 1);
|
|
344
|
+
const value = index === 0 ? bytes : Number((bytes / 1024 ** index).toFixed(1));
|
|
345
|
+
return new Intl.NumberFormat(locale, {
|
|
346
|
+
style: "unit",
|
|
347
|
+
unit: units[index],
|
|
348
|
+
unitDisplay: "short"
|
|
349
|
+
}).format(value);
|
|
778
350
|
};
|
|
779
|
-
var fileDescription = (file) => [
|
|
351
|
+
var fileDescription = (file, locale) => [
|
|
780
352
|
file.type || file.name.split(".").pop()?.toUpperCase(),
|
|
781
|
-
formatBytes(file.size)
|
|
353
|
+
formatBytes(file.size, locale)
|
|
782
354
|
].filter(Boolean).join(" · ");
|
|
783
355
|
var FilePicker = ({
|
|
784
356
|
accept = "",
|
|
@@ -788,6 +360,7 @@ var FilePicker = ({
|
|
|
788
360
|
id,
|
|
789
361
|
image,
|
|
790
362
|
invalid = false,
|
|
363
|
+
locale = "en",
|
|
791
364
|
messages: messages2,
|
|
792
365
|
multiple = false,
|
|
793
366
|
name,
|
|
@@ -798,7 +371,7 @@ var FilePicker = ({
|
|
|
798
371
|
required,
|
|
799
372
|
title
|
|
800
373
|
}) => {
|
|
801
|
-
const labels = filePickerMessages(messages2);
|
|
374
|
+
const labels = filePickerMessages(locale, messages2);
|
|
802
375
|
const inputRef = useRef(null);
|
|
803
376
|
const dragDepthRef = useRef(0);
|
|
804
377
|
const [dragging, setDragging] = useState(false);
|
|
@@ -918,7 +491,7 @@ var FilePicker = ({
|
|
|
918
491
|
children: selectedFile.name
|
|
919
492
|
}),
|
|
920
493
|
/* @__PURE__ */ jsx5(AttachmentDescription, {
|
|
921
|
-
children: fileDescription(selectedFile)
|
|
494
|
+
children: fileDescription(selectedFile, locale)
|
|
922
495
|
})
|
|
923
496
|
]
|
|
924
497
|
}),
|
|
@@ -1012,7 +585,7 @@ var FilePicker = ({
|
|
|
1012
585
|
children: title
|
|
1013
586
|
}),
|
|
1014
587
|
file ? /* @__PURE__ */ jsx5(AttachmentDescription, {
|
|
1015
|
-
children: fileDescription(file)
|
|
588
|
+
children: fileDescription(file, locale)
|
|
1016
589
|
}) : null
|
|
1017
590
|
]
|
|
1018
591
|
}),
|
|
@@ -1389,22 +962,24 @@ var messages2 = {
|
|
|
1389
962
|
selectMore: "Sélectionner davantage"
|
|
1390
963
|
}
|
|
1391
964
|
};
|
|
1392
|
-
var virtualizedComboboxMessages = (
|
|
1393
|
-
...
|
|
1394
|
-
...
|
|
965
|
+
var virtualizedComboboxMessages = (locale, translations) => ({
|
|
966
|
+
...locale.startsWith("fr") ? messages2.fr : messages2.en,
|
|
967
|
+
...translations?.[locale.split("-")[0] ?? locale],
|
|
968
|
+
...translations?.[locale]
|
|
1395
969
|
});
|
|
1396
970
|
var optionEquals = (item, selected) => item.value === selected.value;
|
|
1397
971
|
var VirtualizedComboboxList = ({
|
|
1398
972
|
emptyLabel,
|
|
1399
973
|
groupSelections,
|
|
1400
974
|
itemIndexRef,
|
|
975
|
+
locale = "en",
|
|
1401
976
|
messages: messageOverrides,
|
|
1402
977
|
renderItem,
|
|
1403
978
|
selectedValues,
|
|
1404
979
|
virtualizerRef
|
|
1405
980
|
}) => {
|
|
1406
981
|
const filteredItems = ComboboxPrimitive.useFilteredItems();
|
|
1407
|
-
const labels = virtualizedComboboxMessages(messageOverrides);
|
|
982
|
+
const labels = virtualizedComboboxMessages(locale, messageOverrides);
|
|
1408
983
|
const itemEntries = filteredItems.map((item, index) => ({
|
|
1409
984
|
kind: "item",
|
|
1410
985
|
item,
|
|
@@ -1514,12 +1089,13 @@ var VirtualizedComboboxContent = ({
|
|
|
1514
1089
|
emptyLabel,
|
|
1515
1090
|
groupSelections,
|
|
1516
1091
|
itemIndexRef,
|
|
1092
|
+
locale = "en",
|
|
1517
1093
|
messages: messageOverrides,
|
|
1518
1094
|
renderItem,
|
|
1519
1095
|
selectedValues,
|
|
1520
1096
|
virtualizerRef
|
|
1521
1097
|
}) => {
|
|
1522
|
-
const labels = virtualizedComboboxMessages(messageOverrides);
|
|
1098
|
+
const labels = virtualizedComboboxMessages(locale, messageOverrides);
|
|
1523
1099
|
return /* @__PURE__ */ jsx12(ComboboxPrimitive.Portal, {
|
|
1524
1100
|
children: /* @__PURE__ */ jsx12(ComboboxPrimitive.Positioner, {
|
|
1525
1101
|
align: "start",
|
|
@@ -1543,6 +1119,7 @@ var VirtualizedComboboxContent = ({
|
|
|
1543
1119
|
emptyLabel,
|
|
1544
1120
|
groupSelections,
|
|
1545
1121
|
itemIndexRef,
|
|
1122
|
+
locale,
|
|
1546
1123
|
messages: messageOverrides,
|
|
1547
1124
|
renderItem,
|
|
1548
1125
|
selectedValues,
|
|
@@ -1592,7 +1169,7 @@ var useComboboxVirtualizerRef = (providedRef) => {
|
|
|
1592
1169
|
var VirtualizedComboboxSingle = (props) => {
|
|
1593
1170
|
const virtualizerRef = useComboboxVirtualizerRef(props.virtualizerRef);
|
|
1594
1171
|
const itemIndexRef = useRef2(new Map);
|
|
1595
|
-
const labels = virtualizedComboboxMessages(props.messages);
|
|
1172
|
+
const labels = virtualizedComboboxMessages(props.locale ?? "en", props.messages);
|
|
1596
1173
|
return /* @__PURE__ */ jsxs5(ComboboxPrimitive.Root, {
|
|
1597
1174
|
disabled: props.disabled,
|
|
1598
1175
|
inputValue: props.searchValue,
|
|
@@ -1633,7 +1210,7 @@ var VirtualizedComboboxSingle = (props) => {
|
|
|
1633
1210
|
var VirtualizedComboboxMultiple = (props) => {
|
|
1634
1211
|
const virtualizerRef = useComboboxVirtualizerRef(props.virtualizerRef);
|
|
1635
1212
|
const itemIndexRef = useRef2(new Map);
|
|
1636
|
-
const labels = virtualizedComboboxMessages(props.messages);
|
|
1213
|
+
const labels = virtualizedComboboxMessages(props.locale ?? "en", props.messages);
|
|
1637
1214
|
return /* @__PURE__ */ jsxs5(ComboboxPrimitive.Root, {
|
|
1638
1215
|
disabled: props.disabled,
|
|
1639
1216
|
inputValue: props.searchValue,
|
|
@@ -1718,9 +1295,10 @@ var messages3 = {
|
|
|
1718
1295
|
value: "Valeur"
|
|
1719
1296
|
}
|
|
1720
1297
|
};
|
|
1721
|
-
var effectFormMessages = (
|
|
1722
|
-
...
|
|
1723
|
-
...
|
|
1298
|
+
var effectFormMessages = (locale = "en", translations) => ({
|
|
1299
|
+
...locale.startsWith("fr") ? messages3.fr : messages3.en,
|
|
1300
|
+
...translations?.[locale.split("-")[0] ?? locale],
|
|
1301
|
+
...translations?.[locale]
|
|
1724
1302
|
});
|
|
1725
1303
|
var getCauseErrorMessage = (cause) => {
|
|
1726
1304
|
const error = Cause.squash(cause);
|
|
@@ -1731,7 +1309,7 @@ var FieldWrapper = ({
|
|
|
1731
1309
|
description,
|
|
1732
1310
|
editingLocale,
|
|
1733
1311
|
legend,
|
|
1734
|
-
locales
|
|
1312
|
+
locales,
|
|
1735
1313
|
localized = true
|
|
1736
1314
|
}) => /* @__PURE__ */ jsxs6(FieldSet, {
|
|
1737
1315
|
children: [
|
|
@@ -1739,11 +1317,11 @@ var FieldWrapper = ({
|
|
|
1739
1317
|
className: "flex items-center gap-2",
|
|
1740
1318
|
children: [
|
|
1741
1319
|
legend,
|
|
1742
|
-
localized && editingLocale &&
|
|
1320
|
+
localized && editingLocale && locales && /* @__PURE__ */ jsxs6(Badge, {
|
|
1743
1321
|
variant: "outline",
|
|
1744
1322
|
children: [
|
|
1745
1323
|
/* @__PURE__ */ jsx13(Languages, {}),
|
|
1746
|
-
|
|
1324
|
+
locales.find(({ value }) => value === editingLocale)?.label
|
|
1747
1325
|
]
|
|
1748
1326
|
})
|
|
1749
1327
|
]
|
|
@@ -1772,6 +1350,8 @@ var SubmitError = ({
|
|
|
1772
1350
|
var SubmitButton = ({
|
|
1773
1351
|
children,
|
|
1774
1352
|
form,
|
|
1353
|
+
locale = "en",
|
|
1354
|
+
messages: messages4,
|
|
1775
1355
|
onSubmit
|
|
1776
1356
|
}) => {
|
|
1777
1357
|
const submit = useAtomSet(form.submit);
|
|
@@ -1793,7 +1373,7 @@ var SubmitButton = ({
|
|
|
1793
1373
|
"data-icon": "inline-start",
|
|
1794
1374
|
className: "animate-spin"
|
|
1795
1375
|
}),
|
|
1796
|
-
children ?? effectFormMessages().submit
|
|
1376
|
+
children ?? effectFormMessages(locale, messages4).submit
|
|
1797
1377
|
]
|
|
1798
1378
|
});
|
|
1799
1379
|
};
|
|
@@ -1846,14 +1426,18 @@ var TextField = ({
|
|
|
1846
1426
|
var NameField = ({
|
|
1847
1427
|
field,
|
|
1848
1428
|
props
|
|
1849
|
-
}) =>
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1429
|
+
}) => {
|
|
1430
|
+
const { locale = "en", messages: messages4, ...fieldProps } = props;
|
|
1431
|
+
const labels = effectFormMessages(locale, messages4);
|
|
1432
|
+
return /* @__PURE__ */ jsx13(TextField, {
|
|
1433
|
+
field,
|
|
1434
|
+
props: {
|
|
1435
|
+
...fieldProps,
|
|
1436
|
+
label: labels.name,
|
|
1437
|
+
errorMessage: props.errorMessage ?? labels.nameRequired
|
|
1438
|
+
}
|
|
1439
|
+
});
|
|
1440
|
+
};
|
|
1857
1441
|
var TextAreaField = ({ field, props }) => {
|
|
1858
1442
|
const { children, description, label, ...textareaProps } = props;
|
|
1859
1443
|
const nativeTextareaProps = { ...textareaProps };
|
|
@@ -1889,10 +1473,16 @@ var TextAreaField = ({ field, props }) => {
|
|
|
1889
1473
|
]
|
|
1890
1474
|
});
|
|
1891
1475
|
};
|
|
1892
|
-
var DescriptionField = ({ field, props }) =>
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1476
|
+
var DescriptionField = ({ field, props }) => {
|
|
1477
|
+
const { locale = "en", messages: messages4, ...fieldProps } = props;
|
|
1478
|
+
return /* @__PURE__ */ jsx13(TextAreaField, {
|
|
1479
|
+
field,
|
|
1480
|
+
props: {
|
|
1481
|
+
...fieldProps,
|
|
1482
|
+
label: effectFormMessages(locale, messages4).description
|
|
1483
|
+
}
|
|
1484
|
+
});
|
|
1485
|
+
};
|
|
1896
1486
|
var FileField = ({ field, props }) => {
|
|
1897
1487
|
const invalid = Option.isSome(field.error);
|
|
1898
1488
|
return /* @__PURE__ */ jsxs6(Field, {
|
|
@@ -1908,6 +1498,8 @@ var FileField = ({ field, props }) => {
|
|
|
1908
1498
|
...field.value ? { file: field.value } : {},
|
|
1909
1499
|
id: field.path,
|
|
1910
1500
|
invalid,
|
|
1501
|
+
locale: props.locale,
|
|
1502
|
+
messages: props.messages,
|
|
1911
1503
|
name: field.path,
|
|
1912
1504
|
onBlur: field.onBlur,
|
|
1913
1505
|
onChange: (file) => {
|
|
@@ -2045,7 +1637,10 @@ var FolderField = ({
|
|
|
2045
1637
|
props
|
|
2046
1638
|
}) => /* @__PURE__ */ jsx13(SelectField, {
|
|
2047
1639
|
field,
|
|
2048
|
-
props: {
|
|
1640
|
+
props: {
|
|
1641
|
+
...props,
|
|
1642
|
+
label: effectFormMessages(props.locale, props.messages).folder
|
|
1643
|
+
}
|
|
2049
1644
|
});
|
|
2050
1645
|
var MultiSelectField = ({
|
|
2051
1646
|
field,
|
|
@@ -2149,7 +1744,7 @@ var SearchableSelectField = ({
|
|
|
2149
1744
|
}) => {
|
|
2150
1745
|
const { selectedItems, mergedItems } = getSearchableSelectItems(field.value, props.initialItems ?? [], props.items);
|
|
2151
1746
|
const invalid = Option.isSome(field.error);
|
|
2152
|
-
const labels = virtualizedComboboxMessages(props.messages);
|
|
1747
|
+
const labels = virtualizedComboboxMessages(props.locale ?? "en", props.messages);
|
|
2153
1748
|
const ariaLabel = Schema2.is(Schema2.String)(props.label) ? props.label : labels.search;
|
|
2154
1749
|
return /* @__PURE__ */ jsxs6(Field, {
|
|
2155
1750
|
className: "min-w-0",
|
|
@@ -2164,6 +1759,7 @@ var SearchableSelectField = ({
|
|
|
2164
1759
|
ariaLabel,
|
|
2165
1760
|
emptyLabel: props.emptyLabel,
|
|
2166
1761
|
items: mergedItems,
|
|
1762
|
+
locale: props.locale,
|
|
2167
1763
|
...props.messages ? { messages: props.messages } : {},
|
|
2168
1764
|
multiple: true,
|
|
2169
1765
|
...props.onSearchValueChange ? { onSearchValueChange: props.onSearchValueChange } : {},
|
|
@@ -2189,7 +1785,7 @@ var SingleSearchableSelectField = ({
|
|
|
2189
1785
|
}) => {
|
|
2190
1786
|
const { selectedItems, mergedItems } = getSearchableSelectItems(field.value ? [field.value] : [], props.initialItems ?? [], props.items);
|
|
2191
1787
|
const invalid = Option.isSome(field.error);
|
|
2192
|
-
const labels = virtualizedComboboxMessages(props.messages);
|
|
1788
|
+
const labels = virtualizedComboboxMessages(props.locale ?? "en", props.messages);
|
|
2193
1789
|
const ariaLabel = Schema2.is(Schema2.String)(props.label) ? props.label : labels.search;
|
|
2194
1790
|
return /* @__PURE__ */ jsxs6(Field, {
|
|
2195
1791
|
className: "min-w-0",
|
|
@@ -2204,6 +1800,7 @@ var SingleSearchableSelectField = ({
|
|
|
2204
1800
|
ariaLabel,
|
|
2205
1801
|
emptyLabel: props.emptyLabel,
|
|
2206
1802
|
items: mergedItems,
|
|
1803
|
+
locale: props.locale,
|
|
2207
1804
|
...props.messages ? { messages: props.messages } : {},
|
|
2208
1805
|
...props.onSearchValueChange ? { onSearchValueChange: props.onSearchValueChange } : {},
|
|
2209
1806
|
onValueChange: (option) => field.onChange(option?.value ?? ""),
|
|
@@ -2226,6 +1823,7 @@ var NullableKeyValueField = ({
|
|
|
2226
1823
|
field,
|
|
2227
1824
|
props
|
|
2228
1825
|
}) => {
|
|
1826
|
+
const labels = effectFormMessages(props.locale, props.messages);
|
|
2229
1827
|
const entries = Object.entries(field.value ?? {});
|
|
2230
1828
|
const updateEntry = (index, key, value) => Object.fromEntries(entries.map(([currentKey, currentValue], currentIndex) => currentIndex === index ? [key, value] : [currentKey, currentValue]));
|
|
2231
1829
|
return /* @__PURE__ */ jsxs6(Field, {
|
|
@@ -2242,7 +1840,7 @@ var NullableKeyValueField = ({
|
|
|
2242
1840
|
name: `${field.path}.${index}.key`,
|
|
2243
1841
|
type: "text",
|
|
2244
1842
|
className: "w-auto",
|
|
2245
|
-
placeholder:
|
|
1843
|
+
placeholder: labels.key,
|
|
2246
1844
|
value: key,
|
|
2247
1845
|
onBlur: field.onBlur,
|
|
2248
1846
|
onChange: (event) => field.onChange(updateEntry(index, event.target.value, value)),
|
|
@@ -2253,7 +1851,7 @@ var NullableKeyValueField = ({
|
|
|
2253
1851
|
name: `${field.path}.${index}.value`,
|
|
2254
1852
|
type: "text",
|
|
2255
1853
|
className: "w-auto flex-1",
|
|
2256
|
-
placeholder:
|
|
1854
|
+
placeholder: labels.value,
|
|
2257
1855
|
value,
|
|
2258
1856
|
onBlur: field.onBlur,
|
|
2259
1857
|
onChange: (event) => field.onChange(updateEntry(index, key, event.target.value)),
|
|
@@ -2267,7 +1865,7 @@ var NullableKeyValueField = ({
|
|
|
2267
1865
|
/* @__PURE__ */ jsx13(Trash, {
|
|
2268
1866
|
"data-icon": "inline-start"
|
|
2269
1867
|
}),
|
|
2270
|
-
|
|
1868
|
+
labels.delete
|
|
2271
1869
|
]
|
|
2272
1870
|
})
|
|
2273
1871
|
]
|
|
@@ -2281,7 +1879,7 @@ var NullableKeyValueField = ({
|
|
|
2281
1879
|
/* @__PURE__ */ jsx13(Plus, {
|
|
2282
1880
|
"data-icon": "inline-start"
|
|
2283
1881
|
}),
|
|
2284
|
-
|
|
1882
|
+
labels.add
|
|
2285
1883
|
]
|
|
2286
1884
|
}),
|
|
2287
1885
|
props.description && /* @__PURE__ */ jsx13(FieldDescription, {
|
|
@@ -2297,6 +1895,7 @@ var KeyValueField = ({
|
|
|
2297
1895
|
field,
|
|
2298
1896
|
props
|
|
2299
1897
|
}) => {
|
|
1898
|
+
const labels = effectFormMessages(props.locale, props.messages);
|
|
2300
1899
|
const entries = Object.entries(field.value);
|
|
2301
1900
|
const updateEntry = (index, key, value) => Object.fromEntries(entries.map(([currentKey, currentValue], currentIndex) => currentIndex === index ? [key, value] : [currentKey, currentValue]));
|
|
2302
1901
|
return /* @__PURE__ */ jsxs6(Field, {
|
|
@@ -2313,7 +1912,7 @@ var KeyValueField = ({
|
|
|
2313
1912
|
name: `${field.path}.${index}.key`,
|
|
2314
1913
|
type: "text",
|
|
2315
1914
|
className: "w-auto",
|
|
2316
|
-
placeholder:
|
|
1915
|
+
placeholder: labels.key,
|
|
2317
1916
|
value: key,
|
|
2318
1917
|
onBlur: field.onBlur,
|
|
2319
1918
|
onChange: (event) => field.onChange(updateEntry(index, event.target.value, value)),
|
|
@@ -2324,7 +1923,7 @@ var KeyValueField = ({
|
|
|
2324
1923
|
name: `${field.path}.${index}.value`,
|
|
2325
1924
|
type: "text",
|
|
2326
1925
|
className: "w-auto flex-1",
|
|
2327
|
-
placeholder:
|
|
1926
|
+
placeholder: labels.value,
|
|
2328
1927
|
value,
|
|
2329
1928
|
onBlur: field.onBlur,
|
|
2330
1929
|
onChange: (event) => field.onChange(updateEntry(index, key, event.target.value)),
|
|
@@ -2338,7 +1937,7 @@ var KeyValueField = ({
|
|
|
2338
1937
|
/* @__PURE__ */ jsx13(Trash, {
|
|
2339
1938
|
"data-icon": "inline-start"
|
|
2340
1939
|
}),
|
|
2341
|
-
|
|
1940
|
+
labels.delete
|
|
2342
1941
|
]
|
|
2343
1942
|
})
|
|
2344
1943
|
]
|
|
@@ -2352,7 +1951,7 @@ var KeyValueField = ({
|
|
|
2352
1951
|
/* @__PURE__ */ jsx13(Plus, {
|
|
2353
1952
|
"data-icon": "inline-start"
|
|
2354
1953
|
}),
|
|
2355
|
-
|
|
1954
|
+
labels.add
|
|
2356
1955
|
]
|
|
2357
1956
|
}),
|
|
2358
1957
|
props.description && /* @__PURE__ */ jsx13(FieldDescription, {
|
|
@@ -2374,7 +1973,7 @@ var RevertButton = ({
|
|
|
2374
1973
|
variant: "link",
|
|
2375
1974
|
className: "-mr-4 h-auto py-0",
|
|
2376
1975
|
onClick: () => field.onChange(props.original),
|
|
2377
|
-
children: effectFormMessages().revert
|
|
1976
|
+
children: effectFormMessages(props.locale, props.messages).revert
|
|
2378
1977
|
})
|
|
2379
1978
|
});
|
|
2380
1979
|
var ImageField = ({ field, props }) => {
|
|
@@ -2402,13 +2001,15 @@ var ImageField = ({ field, props }) => {
|
|
|
2402
2001
|
} : {},
|
|
2403
2002
|
id: field.path,
|
|
2404
2003
|
invalid,
|
|
2004
|
+
locale: props.locale,
|
|
2005
|
+
messages: props.filePickerMessages,
|
|
2405
2006
|
name: field.path,
|
|
2406
2007
|
onChange: field.onChange,
|
|
2407
2008
|
onClear: () => field.onChange(null),
|
|
2408
2009
|
title: field.value instanceof File ? field.value.name : props.label
|
|
2409
2010
|
}),
|
|
2410
2011
|
props.size.suggestedWidth && props.size.suggestedHeight ? /* @__PURE__ */ jsx13(FieldDescription, {
|
|
2411
|
-
children: effectFormMessages().suggestedImageSize(String(props.size.suggestedWidth), String(props.size.suggestedHeight))
|
|
2012
|
+
children: effectFormMessages(props.locale, props.messages).suggestedImageSize(String(props.size.suggestedWidth), String(props.size.suggestedHeight))
|
|
2412
2013
|
}) : null,
|
|
2413
2014
|
/* @__PURE__ */ jsx13(FieldError, {
|
|
2414
2015
|
error: field.error
|
|
@@ -2416,52 +2017,65 @@ var ImageField = ({ field, props }) => {
|
|
|
2416
2017
|
]
|
|
2417
2018
|
});
|
|
2418
2019
|
};
|
|
2419
|
-
var NavigationBlock = ({
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2020
|
+
var NavigationBlock = ({
|
|
2021
|
+
locale = "en",
|
|
2022
|
+
messages: messages4,
|
|
2023
|
+
shouldBlock
|
|
2024
|
+
}) => {
|
|
2025
|
+
const labels = effectFormMessages(locale, messages4);
|
|
2026
|
+
return /* @__PURE__ */ jsx13(Block, {
|
|
2027
|
+
enableBeforeUnload: () => shouldBlock,
|
|
2028
|
+
shouldBlockFn: () => shouldBlock,
|
|
2029
|
+
withResolver: true,
|
|
2030
|
+
children: ({ status, proceed, reset }) => /* @__PURE__ */ jsx13(AlertDialog, {
|
|
2031
|
+
open: status === "blocked",
|
|
2032
|
+
children: /* @__PURE__ */ jsxs6(AlertDialogContent, {
|
|
2033
|
+
children: [
|
|
2034
|
+
/* @__PURE__ */ jsxs6(AlertDialogHeader, {
|
|
2035
|
+
children: [
|
|
2036
|
+
/* @__PURE__ */ jsx13(AlertDialogTitle, {
|
|
2037
|
+
children: labels.blockNavigationTitle
|
|
2038
|
+
}),
|
|
2039
|
+
/* @__PURE__ */ jsx13(AlertDialogDescription, {
|
|
2040
|
+
children: labels.blockNavigationDescription
|
|
2041
|
+
})
|
|
2042
|
+
]
|
|
2043
|
+
}),
|
|
2044
|
+
/* @__PURE__ */ jsxs6(AlertDialogFooter, {
|
|
2045
|
+
children: [
|
|
2046
|
+
/* @__PURE__ */ jsx13(AlertDialogCancel, {
|
|
2047
|
+
onClick: reset,
|
|
2048
|
+
children: labels.blockNavigationCancel
|
|
2049
|
+
}),
|
|
2050
|
+
/* @__PURE__ */ jsx13(AlertDialogAction, {
|
|
2051
|
+
onClick: proceed,
|
|
2052
|
+
children: labels.blockNavigationConfirm
|
|
2053
|
+
})
|
|
2054
|
+
]
|
|
2055
|
+
})
|
|
2056
|
+
]
|
|
2057
|
+
})
|
|
2450
2058
|
})
|
|
2451
|
-
})
|
|
2452
|
-
}
|
|
2453
|
-
var FormBlockNavigation = ({
|
|
2059
|
+
});
|
|
2060
|
+
};
|
|
2061
|
+
var FormBlockNavigation = ({
|
|
2062
|
+
form,
|
|
2063
|
+
locale,
|
|
2064
|
+
messages: messages4
|
|
2065
|
+
}) => {
|
|
2454
2066
|
const submitResult = useAtomValue(form.submit);
|
|
2455
2067
|
const isDirty = useAtomValue(form.isDirty);
|
|
2456
2068
|
const hasChangedSinceSubmit = useAtomValue(form.hasChangedSinceSubmit);
|
|
2457
2069
|
const lastSubmittedValues = useAtomValue(form.lastSubmittedValues);
|
|
2458
2070
|
const shouldBlock = !submitResult.waiting && (Option.isNone(lastSubmittedValues) ? isDirty : hasChangedSinceSubmit);
|
|
2459
2071
|
return /* @__PURE__ */ jsx13(NavigationBlock, {
|
|
2072
|
+
locale,
|
|
2073
|
+
messages: messages4,
|
|
2460
2074
|
shouldBlock
|
|
2461
2075
|
});
|
|
2462
2076
|
};
|
|
2463
|
-
var BlockNavigation = (
|
|
2464
|
-
|
|
2077
|
+
var BlockNavigation = (props) => /* @__PURE__ */ jsx13(FormBlockNavigation, {
|
|
2078
|
+
...props
|
|
2465
2079
|
});
|
|
2466
2080
|
export {
|
|
2467
2081
|
BlockNavigation,
|