@krak-stack/registry 0.1.32 → 0.1.34
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/ui/code-block.d.ts +8 -6
- package/dist/components/ui/code-block.js +44 -19
- package/dist/components/ui/copy-button.d.ts +9 -6
- package/dist/components/ui/copy-button.js +17 -8
- package/dist/components/ui/data-table.d.ts +9 -5
- package/dist/components/ui/data-table.js +90 -486
- package/dist/components/ui/editing-locale-switcher.d.ts +8 -4
- package/dist/components/ui/editing-locale-switcher.js +26 -448
- package/dist/components/ui/effect-form.d.ts +39 -10
- package/dist/components/ui/effect-form.js +171 -541
- package/dist/components/ui/error-component.d.ts +4 -2
- package/dist/components/ui/error-component.js +28 -450
- package/dist/components/ui/file-picker.d.ts +4 -2
- package/dist/components/ui/file-picker.js +27 -452
- package/dist/components/ui/form.d.ts +123 -71
- package/dist/components/ui/form.js +95 -476
- package/dist/components/ui/google-map.d.ts +3 -2
- package/dist/components/ui/google-map.js +6 -439
- package/dist/components/ui/icon-input.d.ts +50 -1
- package/dist/components/ui/icon-input.js +38 -448
- package/dist/components/ui/krakstack-provider.d.ts +9 -0
- package/dist/components/ui/krakstack-provider.js +28 -0
- package/dist/components/ui/loading.d.ts +7 -1
- package/dist/components/ui/loading.js +6 -438
- package/dist/components/ui/locale-switcher.d.ts +8 -4
- package/dist/components/ui/locale-switcher.js +35 -453
- package/dist/components/ui/pagination.d.ts +5 -3
- package/dist/components/ui/pagination.js +7 -439
- package/dist/components/ui/search-menu.d.ts +4 -2
- package/dist/components/ui/search-menu.js +8 -440
- package/dist/components/ui/theme-switcher.d.ts +5 -3
- package/dist/components/ui/theme-switcher.js +8 -440
- package/dist/components/ui/virtualized-combobox.d.ts +4 -2
- package/dist/components/ui/virtualized-combobox.js +17 -445
- package/dist/lib/docs.d.ts +2 -0
- package/dist/lib/docs.js +92 -481
- package/dist/lib/docs.server.js +4 -20
- package/dist/lib/documentation-toolkit.js +4 -20
- package/dist/lib/markdown/content.d.ts +4 -5
- package/dist/services/agent/client/index.js +81 -463
- package/dist/services/agent/client/widget.d.ts +6 -3
- package/dist/services/notification/client/index.js +11 -440
- package/dist/services/notification/client/notification-menu.d.ts +7 -4
- package/dist/services/notification/public.js +11 -440
- package/package.json +5 -1
- package/dist/paraglide/runtime.d.ts +0 -978
|
@@ -304,443 +304,8 @@ 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
|
|
308
|
+
import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider";
|
|
744
309
|
import { jsx as jsx5, jsxs as jsxs2, Fragment } from "react/jsx-runtime";
|
|
745
310
|
"use client";
|
|
746
311
|
var messages = {
|
|
@@ -763,22 +328,30 @@ var messages = {
|
|
|
763
328
|
replaceFile: "Remplacer le fichier"
|
|
764
329
|
}
|
|
765
330
|
};
|
|
766
|
-
var filePickerMessages = (
|
|
767
|
-
...
|
|
768
|
-
...
|
|
331
|
+
var filePickerMessages = (locale, translations) => ({
|
|
332
|
+
...locale.startsWith("fr") ? messages.fr : messages.en,
|
|
333
|
+
...translations?.[locale.split("-")[0] ?? locale],
|
|
334
|
+
...translations?.[locale]
|
|
769
335
|
});
|
|
770
|
-
var formatBytes = (bytes) => {
|
|
771
|
-
const
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
336
|
+
var formatBytes = (bytes, locale) => {
|
|
337
|
+
const units = [
|
|
338
|
+
"byte",
|
|
339
|
+
"kilobyte",
|
|
340
|
+
"megabyte",
|
|
341
|
+
"gigabyte",
|
|
342
|
+
"terabyte"
|
|
343
|
+
];
|
|
344
|
+
const index = Math.min(bytes === 0 ? 0 : Math.floor(Math.log(bytes) / Math.log(1024)), units.length - 1);
|
|
345
|
+
const value = index === 0 ? bytes : Number((bytes / 1024 ** index).toFixed(1));
|
|
346
|
+
return new Intl.NumberFormat(locale, {
|
|
347
|
+
style: "unit",
|
|
348
|
+
unit: units[index],
|
|
349
|
+
unitDisplay: "short"
|
|
350
|
+
}).format(value);
|
|
778
351
|
};
|
|
779
|
-
var fileDescription = (file) => [
|
|
352
|
+
var fileDescription = (file, locale) => [
|
|
780
353
|
file.type || file.name.split(".").pop()?.toUpperCase(),
|
|
781
|
-
formatBytes(file.size)
|
|
354
|
+
formatBytes(file.size, locale)
|
|
782
355
|
].filter(Boolean).join(" · ");
|
|
783
356
|
var FilePicker = ({
|
|
784
357
|
accept = "",
|
|
@@ -788,6 +361,7 @@ var FilePicker = ({
|
|
|
788
361
|
id,
|
|
789
362
|
image,
|
|
790
363
|
invalid = false,
|
|
364
|
+
locale: localeOverride,
|
|
791
365
|
messages: messages2,
|
|
792
366
|
multiple = false,
|
|
793
367
|
name,
|
|
@@ -798,7 +372,8 @@ var FilePicker = ({
|
|
|
798
372
|
required,
|
|
799
373
|
title
|
|
800
374
|
}) => {
|
|
801
|
-
const
|
|
375
|
+
const locale = useKrakstackLocale(localeOverride);
|
|
376
|
+
const labels = filePickerMessages(locale, messages2);
|
|
802
377
|
const inputRef = useRef(null);
|
|
803
378
|
const dragDepthRef = useRef(0);
|
|
804
379
|
const [dragging, setDragging] = useState(false);
|
|
@@ -918,7 +493,7 @@ var FilePicker = ({
|
|
|
918
493
|
children: selectedFile.name
|
|
919
494
|
}),
|
|
920
495
|
/* @__PURE__ */ jsx5(AttachmentDescription, {
|
|
921
|
-
children: fileDescription(selectedFile)
|
|
496
|
+
children: fileDescription(selectedFile, locale)
|
|
922
497
|
})
|
|
923
498
|
]
|
|
924
499
|
}),
|
|
@@ -1012,7 +587,7 @@ var FilePicker = ({
|
|
|
1012
587
|
children: title
|
|
1013
588
|
}),
|
|
1014
589
|
file ? /* @__PURE__ */ jsx5(AttachmentDescription, {
|
|
1015
|
-
children: fileDescription(file)
|
|
590
|
+
children: fileDescription(file, locale)
|
|
1016
591
|
}) : null
|
|
1017
592
|
]
|
|
1018
593
|
}),
|
|
@@ -1373,6 +948,7 @@ function InputGroupInput({
|
|
|
1373
948
|
}
|
|
1374
949
|
|
|
1375
950
|
// ../../src/components/ui/virtualized-combobox.tsx
|
|
951
|
+
import { useKrakstackLocale as useKrakstackLocale2 } from "@krak-stack/registry/krakstack-provider";
|
|
1376
952
|
import { jsx as jsx12, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1377
953
|
"use client";
|
|
1378
954
|
var messages2 = {
|
|
@@ -1389,22 +965,24 @@ var messages2 = {
|
|
|
1389
965
|
selectMore: "Sélectionner davantage"
|
|
1390
966
|
}
|
|
1391
967
|
};
|
|
1392
|
-
var virtualizedComboboxMessages = (
|
|
1393
|
-
...
|
|
1394
|
-
...
|
|
968
|
+
var virtualizedComboboxMessages = (locale, translations) => ({
|
|
969
|
+
...locale.startsWith("fr") ? messages2.fr : messages2.en,
|
|
970
|
+
...translations?.[locale.split("-")[0] ?? locale],
|
|
971
|
+
...translations?.[locale]
|
|
1395
972
|
});
|
|
1396
973
|
var optionEquals = (item, selected) => item.value === selected.value;
|
|
1397
974
|
var VirtualizedComboboxList = ({
|
|
1398
975
|
emptyLabel,
|
|
1399
976
|
groupSelections,
|
|
1400
977
|
itemIndexRef,
|
|
978
|
+
locale = "en",
|
|
1401
979
|
messages: messageOverrides,
|
|
1402
980
|
renderItem,
|
|
1403
981
|
selectedValues,
|
|
1404
982
|
virtualizerRef
|
|
1405
983
|
}) => {
|
|
1406
984
|
const filteredItems = ComboboxPrimitive.useFilteredItems();
|
|
1407
|
-
const labels = virtualizedComboboxMessages(messageOverrides);
|
|
985
|
+
const labels = virtualizedComboboxMessages(locale, messageOverrides);
|
|
1408
986
|
const itemEntries = filteredItems.map((item, index) => ({
|
|
1409
987
|
kind: "item",
|
|
1410
988
|
item,
|
|
@@ -1514,12 +1092,13 @@ var VirtualizedComboboxContent = ({
|
|
|
1514
1092
|
emptyLabel,
|
|
1515
1093
|
groupSelections,
|
|
1516
1094
|
itemIndexRef,
|
|
1095
|
+
locale = "en",
|
|
1517
1096
|
messages: messageOverrides,
|
|
1518
1097
|
renderItem,
|
|
1519
1098
|
selectedValues,
|
|
1520
1099
|
virtualizerRef
|
|
1521
1100
|
}) => {
|
|
1522
|
-
const labels = virtualizedComboboxMessages(messageOverrides);
|
|
1101
|
+
const labels = virtualizedComboboxMessages(locale, messageOverrides);
|
|
1523
1102
|
return /* @__PURE__ */ jsx12(ComboboxPrimitive.Portal, {
|
|
1524
1103
|
children: /* @__PURE__ */ jsx12(ComboboxPrimitive.Positioner, {
|
|
1525
1104
|
align: "start",
|
|
@@ -1543,6 +1122,7 @@ var VirtualizedComboboxContent = ({
|
|
|
1543
1122
|
emptyLabel,
|
|
1544
1123
|
groupSelections,
|
|
1545
1124
|
itemIndexRef,
|
|
1125
|
+
locale,
|
|
1546
1126
|
messages: messageOverrides,
|
|
1547
1127
|
renderItem,
|
|
1548
1128
|
selectedValues,
|
|
@@ -1592,7 +1172,7 @@ var useComboboxVirtualizerRef = (providedRef) => {
|
|
|
1592
1172
|
var VirtualizedComboboxSingle = (props) => {
|
|
1593
1173
|
const virtualizerRef = useComboboxVirtualizerRef(props.virtualizerRef);
|
|
1594
1174
|
const itemIndexRef = useRef2(new Map);
|
|
1595
|
-
const labels = virtualizedComboboxMessages(props.messages);
|
|
1175
|
+
const labels = virtualizedComboboxMessages(props.locale ?? "en", props.messages);
|
|
1596
1176
|
return /* @__PURE__ */ jsxs5(ComboboxPrimitive.Root, {
|
|
1597
1177
|
disabled: props.disabled,
|
|
1598
1178
|
inputValue: props.searchValue,
|
|
@@ -1633,7 +1213,7 @@ var VirtualizedComboboxSingle = (props) => {
|
|
|
1633
1213
|
var VirtualizedComboboxMultiple = (props) => {
|
|
1634
1214
|
const virtualizerRef = useComboboxVirtualizerRef(props.virtualizerRef);
|
|
1635
1215
|
const itemIndexRef = useRef2(new Map);
|
|
1636
|
-
const labels = virtualizedComboboxMessages(props.messages);
|
|
1216
|
+
const labels = virtualizedComboboxMessages(props.locale ?? "en", props.messages);
|
|
1637
1217
|
return /* @__PURE__ */ jsxs5(ComboboxPrimitive.Root, {
|
|
1638
1218
|
disabled: props.disabled,
|
|
1639
1219
|
inputValue: props.searchValue,
|
|
@@ -1673,14 +1253,18 @@ var VirtualizedComboboxMultiple = (props) => {
|
|
|
1673
1253
|
});
|
|
1674
1254
|
};
|
|
1675
1255
|
function VirtualizedCombobox(props) {
|
|
1256
|
+
const locale = useKrakstackLocale2(props.locale);
|
|
1676
1257
|
return props.multiple ? /* @__PURE__ */ jsx12(VirtualizedComboboxMultiple, {
|
|
1677
|
-
...props
|
|
1258
|
+
...props,
|
|
1259
|
+
locale
|
|
1678
1260
|
}) : /* @__PURE__ */ jsx12(VirtualizedComboboxSingle, {
|
|
1679
|
-
...props
|
|
1261
|
+
...props,
|
|
1262
|
+
locale
|
|
1680
1263
|
});
|
|
1681
1264
|
}
|
|
1682
1265
|
|
|
1683
1266
|
// ../../src/components/ui/effect-form.tsx
|
|
1267
|
+
import { useKrakstackLocale as useKrakstackLocale3 } from "@krak-stack/registry/krakstack-provider";
|
|
1684
1268
|
import { jsx as jsx13, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1685
1269
|
var messages3 = {
|
|
1686
1270
|
en: {
|
|
@@ -1718,10 +1302,12 @@ var messages3 = {
|
|
|
1718
1302
|
value: "Valeur"
|
|
1719
1303
|
}
|
|
1720
1304
|
};
|
|
1721
|
-
var effectFormMessages = (
|
|
1722
|
-
...
|
|
1723
|
-
...
|
|
1305
|
+
var effectFormMessages = (locale = "en", translations) => ({
|
|
1306
|
+
...locale.startsWith("fr") ? messages3.fr : messages3.en,
|
|
1307
|
+
...translations?.[locale.split("-")[0] ?? locale],
|
|
1308
|
+
...translations?.[locale]
|
|
1724
1309
|
});
|
|
1310
|
+
var useEffectFormMessages = (locale, translations) => effectFormMessages(useKrakstackLocale3(locale), translations);
|
|
1725
1311
|
var getCauseErrorMessage = (cause) => {
|
|
1726
1312
|
const error = Cause.squash(cause);
|
|
1727
1313
|
return error instanceof Error ? error.message : String(error);
|
|
@@ -1731,7 +1317,7 @@ var FieldWrapper = ({
|
|
|
1731
1317
|
description,
|
|
1732
1318
|
editingLocale,
|
|
1733
1319
|
legend,
|
|
1734
|
-
locales
|
|
1320
|
+
locales,
|
|
1735
1321
|
localized = true
|
|
1736
1322
|
}) => /* @__PURE__ */ jsxs6(FieldSet, {
|
|
1737
1323
|
children: [
|
|
@@ -1739,11 +1325,11 @@ var FieldWrapper = ({
|
|
|
1739
1325
|
className: "flex items-center gap-2",
|
|
1740
1326
|
children: [
|
|
1741
1327
|
legend,
|
|
1742
|
-
localized && editingLocale &&
|
|
1328
|
+
localized && editingLocale && locales && /* @__PURE__ */ jsxs6(Badge, {
|
|
1743
1329
|
variant: "outline",
|
|
1744
1330
|
children: [
|
|
1745
1331
|
/* @__PURE__ */ jsx13(Languages, {}),
|
|
1746
|
-
|
|
1332
|
+
locales.find(({ value }) => value === editingLocale)?.label
|
|
1747
1333
|
]
|
|
1748
1334
|
})
|
|
1749
1335
|
]
|
|
@@ -1772,6 +1358,8 @@ var SubmitError = ({
|
|
|
1772
1358
|
var SubmitButton = ({
|
|
1773
1359
|
children,
|
|
1774
1360
|
form,
|
|
1361
|
+
locale,
|
|
1362
|
+
messages: messages4,
|
|
1775
1363
|
onSubmit
|
|
1776
1364
|
}) => {
|
|
1777
1365
|
const submit = useAtomSet(form.submit);
|
|
@@ -1779,6 +1367,7 @@ var SubmitButton = ({
|
|
|
1779
1367
|
const isDirty = useAtomValue(form.isDirty);
|
|
1780
1368
|
const hasChangedSinceSubmit = useAtomValue(form.hasChangedSinceSubmit);
|
|
1781
1369
|
const lastSubmittedValues = useAtomValue(form.lastSubmittedValues);
|
|
1370
|
+
const labels = useEffectFormMessages(locale, messages4);
|
|
1782
1371
|
const hasPendingChanges = Option.isNone(lastSubmittedValues) ? isDirty : hasChangedSinceSubmit;
|
|
1783
1372
|
return /* @__PURE__ */ jsxs6(Button, {
|
|
1784
1373
|
type: "button",
|
|
@@ -1793,7 +1382,7 @@ var SubmitButton = ({
|
|
|
1793
1382
|
"data-icon": "inline-start",
|
|
1794
1383
|
className: "animate-spin"
|
|
1795
1384
|
}),
|
|
1796
|
-
children ??
|
|
1385
|
+
children ?? labels.submit
|
|
1797
1386
|
]
|
|
1798
1387
|
});
|
|
1799
1388
|
};
|
|
@@ -1846,14 +1435,18 @@ var TextField = ({
|
|
|
1846
1435
|
var NameField = ({
|
|
1847
1436
|
field,
|
|
1848
1437
|
props
|
|
1849
|
-
}) =>
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1438
|
+
}) => {
|
|
1439
|
+
const { locale, messages: messages4, ...fieldProps } = props;
|
|
1440
|
+
const labels = useEffectFormMessages(locale, messages4);
|
|
1441
|
+
return /* @__PURE__ */ jsx13(TextField, {
|
|
1442
|
+
field,
|
|
1443
|
+
props: {
|
|
1444
|
+
...fieldProps,
|
|
1445
|
+
label: labels.name,
|
|
1446
|
+
errorMessage: props.errorMessage ?? labels.nameRequired
|
|
1447
|
+
}
|
|
1448
|
+
});
|
|
1449
|
+
};
|
|
1857
1450
|
var TextAreaField = ({ field, props }) => {
|
|
1858
1451
|
const { children, description, label, ...textareaProps } = props;
|
|
1859
1452
|
const nativeTextareaProps = { ...textareaProps };
|
|
@@ -1889,10 +1482,17 @@ var TextAreaField = ({ field, props }) => {
|
|
|
1889
1482
|
]
|
|
1890
1483
|
});
|
|
1891
1484
|
};
|
|
1892
|
-
var DescriptionField = ({ field, props }) =>
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1485
|
+
var DescriptionField = ({ field, props }) => {
|
|
1486
|
+
const { locale, messages: messages4, ...fieldProps } = props;
|
|
1487
|
+
const labels = useEffectFormMessages(locale, messages4);
|
|
1488
|
+
return /* @__PURE__ */ jsx13(TextAreaField, {
|
|
1489
|
+
field,
|
|
1490
|
+
props: {
|
|
1491
|
+
...fieldProps,
|
|
1492
|
+
label: labels.description
|
|
1493
|
+
}
|
|
1494
|
+
});
|
|
1495
|
+
};
|
|
1896
1496
|
var FileField = ({ field, props }) => {
|
|
1897
1497
|
const invalid = Option.isSome(field.error);
|
|
1898
1498
|
return /* @__PURE__ */ jsxs6(Field, {
|
|
@@ -1908,6 +1508,8 @@ var FileField = ({ field, props }) => {
|
|
|
1908
1508
|
...field.value ? { file: field.value } : {},
|
|
1909
1509
|
id: field.path,
|
|
1910
1510
|
invalid,
|
|
1511
|
+
locale: props.locale,
|
|
1512
|
+
messages: props.messages,
|
|
1911
1513
|
name: field.path,
|
|
1912
1514
|
onBlur: field.onBlur,
|
|
1913
1515
|
onChange: (file) => {
|
|
@@ -2043,10 +1645,13 @@ var SelectField = ({
|
|
|
2043
1645
|
var FolderField = ({
|
|
2044
1646
|
field,
|
|
2045
1647
|
props
|
|
2046
|
-
}) =>
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
1648
|
+
}) => {
|
|
1649
|
+
const labels = useEffectFormMessages(props.locale, props.messages);
|
|
1650
|
+
return /* @__PURE__ */ jsx13(SelectField, {
|
|
1651
|
+
field,
|
|
1652
|
+
props: { ...props, label: labels.folder }
|
|
1653
|
+
});
|
|
1654
|
+
};
|
|
2050
1655
|
var MultiSelectField = ({
|
|
2051
1656
|
field,
|
|
2052
1657
|
props
|
|
@@ -2147,9 +1752,10 @@ var SearchableSelectField = ({
|
|
|
2147
1752
|
field,
|
|
2148
1753
|
props
|
|
2149
1754
|
}) => {
|
|
1755
|
+
const locale = useKrakstackLocale3(props.locale);
|
|
2150
1756
|
const { selectedItems, mergedItems } = getSearchableSelectItems(field.value, props.initialItems ?? [], props.items);
|
|
2151
1757
|
const invalid = Option.isSome(field.error);
|
|
2152
|
-
const labels = virtualizedComboboxMessages(props.messages);
|
|
1758
|
+
const labels = virtualizedComboboxMessages(locale, props.messages);
|
|
2153
1759
|
const ariaLabel = Schema2.is(Schema2.String)(props.label) ? props.label : labels.search;
|
|
2154
1760
|
return /* @__PURE__ */ jsxs6(Field, {
|
|
2155
1761
|
className: "min-w-0",
|
|
@@ -2164,6 +1770,7 @@ var SearchableSelectField = ({
|
|
|
2164
1770
|
ariaLabel,
|
|
2165
1771
|
emptyLabel: props.emptyLabel,
|
|
2166
1772
|
items: mergedItems,
|
|
1773
|
+
locale,
|
|
2167
1774
|
...props.messages ? { messages: props.messages } : {},
|
|
2168
1775
|
multiple: true,
|
|
2169
1776
|
...props.onSearchValueChange ? { onSearchValueChange: props.onSearchValueChange } : {},
|
|
@@ -2187,9 +1794,10 @@ var SingleSearchableSelectField = ({
|
|
|
2187
1794
|
field,
|
|
2188
1795
|
props
|
|
2189
1796
|
}) => {
|
|
1797
|
+
const locale = useKrakstackLocale3(props.locale);
|
|
2190
1798
|
const { selectedItems, mergedItems } = getSearchableSelectItems(field.value ? [field.value] : [], props.initialItems ?? [], props.items);
|
|
2191
1799
|
const invalid = Option.isSome(field.error);
|
|
2192
|
-
const labels = virtualizedComboboxMessages(props.messages);
|
|
1800
|
+
const labels = virtualizedComboboxMessages(locale, props.messages);
|
|
2193
1801
|
const ariaLabel = Schema2.is(Schema2.String)(props.label) ? props.label : labels.search;
|
|
2194
1802
|
return /* @__PURE__ */ jsxs6(Field, {
|
|
2195
1803
|
className: "min-w-0",
|
|
@@ -2204,6 +1812,7 @@ var SingleSearchableSelectField = ({
|
|
|
2204
1812
|
ariaLabel,
|
|
2205
1813
|
emptyLabel: props.emptyLabel,
|
|
2206
1814
|
items: mergedItems,
|
|
1815
|
+
locale,
|
|
2207
1816
|
...props.messages ? { messages: props.messages } : {},
|
|
2208
1817
|
...props.onSearchValueChange ? { onSearchValueChange: props.onSearchValueChange } : {},
|
|
2209
1818
|
onValueChange: (option) => field.onChange(option?.value ?? ""),
|
|
@@ -2226,6 +1835,7 @@ var NullableKeyValueField = ({
|
|
|
2226
1835
|
field,
|
|
2227
1836
|
props
|
|
2228
1837
|
}) => {
|
|
1838
|
+
const labels = useEffectFormMessages(props.locale, props.messages);
|
|
2229
1839
|
const entries = Object.entries(field.value ?? {});
|
|
2230
1840
|
const updateEntry = (index, key, value) => Object.fromEntries(entries.map(([currentKey, currentValue], currentIndex) => currentIndex === index ? [key, value] : [currentKey, currentValue]));
|
|
2231
1841
|
return /* @__PURE__ */ jsxs6(Field, {
|
|
@@ -2242,7 +1852,7 @@ var NullableKeyValueField = ({
|
|
|
2242
1852
|
name: `${field.path}.${index}.key`,
|
|
2243
1853
|
type: "text",
|
|
2244
1854
|
className: "w-auto",
|
|
2245
|
-
placeholder:
|
|
1855
|
+
placeholder: labels.key,
|
|
2246
1856
|
value: key,
|
|
2247
1857
|
onBlur: field.onBlur,
|
|
2248
1858
|
onChange: (event) => field.onChange(updateEntry(index, event.target.value, value)),
|
|
@@ -2253,7 +1863,7 @@ var NullableKeyValueField = ({
|
|
|
2253
1863
|
name: `${field.path}.${index}.value`,
|
|
2254
1864
|
type: "text",
|
|
2255
1865
|
className: "w-auto flex-1",
|
|
2256
|
-
placeholder:
|
|
1866
|
+
placeholder: labels.value,
|
|
2257
1867
|
value,
|
|
2258
1868
|
onBlur: field.onBlur,
|
|
2259
1869
|
onChange: (event) => field.onChange(updateEntry(index, key, event.target.value)),
|
|
@@ -2267,7 +1877,7 @@ var NullableKeyValueField = ({
|
|
|
2267
1877
|
/* @__PURE__ */ jsx13(Trash, {
|
|
2268
1878
|
"data-icon": "inline-start"
|
|
2269
1879
|
}),
|
|
2270
|
-
|
|
1880
|
+
labels.delete
|
|
2271
1881
|
]
|
|
2272
1882
|
})
|
|
2273
1883
|
]
|
|
@@ -2281,7 +1891,7 @@ var NullableKeyValueField = ({
|
|
|
2281
1891
|
/* @__PURE__ */ jsx13(Plus, {
|
|
2282
1892
|
"data-icon": "inline-start"
|
|
2283
1893
|
}),
|
|
2284
|
-
|
|
1894
|
+
labels.add
|
|
2285
1895
|
]
|
|
2286
1896
|
}),
|
|
2287
1897
|
props.description && /* @__PURE__ */ jsx13(FieldDescription, {
|
|
@@ -2297,6 +1907,7 @@ var KeyValueField = ({
|
|
|
2297
1907
|
field,
|
|
2298
1908
|
props
|
|
2299
1909
|
}) => {
|
|
1910
|
+
const labels = useEffectFormMessages(props.locale, props.messages);
|
|
2300
1911
|
const entries = Object.entries(field.value);
|
|
2301
1912
|
const updateEntry = (index, key, value) => Object.fromEntries(entries.map(([currentKey, currentValue], currentIndex) => currentIndex === index ? [key, value] : [currentKey, currentValue]));
|
|
2302
1913
|
return /* @__PURE__ */ jsxs6(Field, {
|
|
@@ -2313,7 +1924,7 @@ var KeyValueField = ({
|
|
|
2313
1924
|
name: `${field.path}.${index}.key`,
|
|
2314
1925
|
type: "text",
|
|
2315
1926
|
className: "w-auto",
|
|
2316
|
-
placeholder:
|
|
1927
|
+
placeholder: labels.key,
|
|
2317
1928
|
value: key,
|
|
2318
1929
|
onBlur: field.onBlur,
|
|
2319
1930
|
onChange: (event) => field.onChange(updateEntry(index, event.target.value, value)),
|
|
@@ -2324,7 +1935,7 @@ var KeyValueField = ({
|
|
|
2324
1935
|
name: `${field.path}.${index}.value`,
|
|
2325
1936
|
type: "text",
|
|
2326
1937
|
className: "w-auto flex-1",
|
|
2327
|
-
placeholder:
|
|
1938
|
+
placeholder: labels.value,
|
|
2328
1939
|
value,
|
|
2329
1940
|
onBlur: field.onBlur,
|
|
2330
1941
|
onChange: (event) => field.onChange(updateEntry(index, key, event.target.value)),
|
|
@@ -2338,7 +1949,7 @@ var KeyValueField = ({
|
|
|
2338
1949
|
/* @__PURE__ */ jsx13(Trash, {
|
|
2339
1950
|
"data-icon": "inline-start"
|
|
2340
1951
|
}),
|
|
2341
|
-
|
|
1952
|
+
labels.delete
|
|
2342
1953
|
]
|
|
2343
1954
|
})
|
|
2344
1955
|
]
|
|
@@ -2352,7 +1963,7 @@ var KeyValueField = ({
|
|
|
2352
1963
|
/* @__PURE__ */ jsx13(Plus, {
|
|
2353
1964
|
"data-icon": "inline-start"
|
|
2354
1965
|
}),
|
|
2355
|
-
|
|
1966
|
+
labels.add
|
|
2356
1967
|
]
|
|
2357
1968
|
}),
|
|
2358
1969
|
props.description && /* @__PURE__ */ jsx13(FieldDescription, {
|
|
@@ -2367,17 +1978,21 @@ var KeyValueField = ({
|
|
|
2367
1978
|
var RevertButton = ({
|
|
2368
1979
|
field,
|
|
2369
1980
|
props
|
|
2370
|
-
}) =>
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
1981
|
+
}) => {
|
|
1982
|
+
const labels = useEffectFormMessages(props.locale, props.messages);
|
|
1983
|
+
return field.value === props.original ? null : /* @__PURE__ */ jsx13("div", {
|
|
1984
|
+
className: "flex flex-1 justify-end",
|
|
1985
|
+
children: /* @__PURE__ */ jsx13(Button, {
|
|
1986
|
+
type: "button",
|
|
1987
|
+
variant: "link",
|
|
1988
|
+
className: "-mr-4 h-auto py-0",
|
|
1989
|
+
onClick: () => field.onChange(props.original),
|
|
1990
|
+
children: labels.revert
|
|
1991
|
+
})
|
|
1992
|
+
});
|
|
1993
|
+
};
|
|
2380
1994
|
var ImageField = ({ field, props }) => {
|
|
1995
|
+
const labels = useEffectFormMessages(props.locale, props.messages);
|
|
2381
1996
|
const imageUrl = Schema2.is(Schema2.String)(field.value) ? field.value : undefined;
|
|
2382
1997
|
const invalid = Option.isSome(field.error);
|
|
2383
1998
|
return /* @__PURE__ */ jsxs6(Field, {
|
|
@@ -2402,13 +2017,15 @@ var ImageField = ({ field, props }) => {
|
|
|
2402
2017
|
} : {},
|
|
2403
2018
|
id: field.path,
|
|
2404
2019
|
invalid,
|
|
2020
|
+
locale: props.locale,
|
|
2021
|
+
messages: props.filePickerMessages,
|
|
2405
2022
|
name: field.path,
|
|
2406
2023
|
onChange: field.onChange,
|
|
2407
2024
|
onClear: () => field.onChange(null),
|
|
2408
2025
|
title: field.value instanceof File ? field.value.name : props.label
|
|
2409
2026
|
}),
|
|
2410
2027
|
props.size.suggestedWidth && props.size.suggestedHeight ? /* @__PURE__ */ jsx13(FieldDescription, {
|
|
2411
|
-
children:
|
|
2028
|
+
children: labels.suggestedImageSize(String(props.size.suggestedWidth), String(props.size.suggestedHeight))
|
|
2412
2029
|
}) : null,
|
|
2413
2030
|
/* @__PURE__ */ jsx13(FieldError, {
|
|
2414
2031
|
error: field.error
|
|
@@ -2416,52 +2033,65 @@ var ImageField = ({ field, props }) => {
|
|
|
2416
2033
|
]
|
|
2417
2034
|
});
|
|
2418
2035
|
};
|
|
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
|
-
|
|
2036
|
+
var NavigationBlock = ({
|
|
2037
|
+
locale,
|
|
2038
|
+
messages: messages4,
|
|
2039
|
+
shouldBlock
|
|
2040
|
+
}) => {
|
|
2041
|
+
const labels = useEffectFormMessages(locale, messages4);
|
|
2042
|
+
return /* @__PURE__ */ jsx13(Block, {
|
|
2043
|
+
enableBeforeUnload: () => shouldBlock,
|
|
2044
|
+
shouldBlockFn: () => shouldBlock,
|
|
2045
|
+
withResolver: true,
|
|
2046
|
+
children: ({ status, proceed, reset }) => /* @__PURE__ */ jsx13(AlertDialog, {
|
|
2047
|
+
open: status === "blocked",
|
|
2048
|
+
children: /* @__PURE__ */ jsxs6(AlertDialogContent, {
|
|
2049
|
+
children: [
|
|
2050
|
+
/* @__PURE__ */ jsxs6(AlertDialogHeader, {
|
|
2051
|
+
children: [
|
|
2052
|
+
/* @__PURE__ */ jsx13(AlertDialogTitle, {
|
|
2053
|
+
children: labels.blockNavigationTitle
|
|
2054
|
+
}),
|
|
2055
|
+
/* @__PURE__ */ jsx13(AlertDialogDescription, {
|
|
2056
|
+
children: labels.blockNavigationDescription
|
|
2057
|
+
})
|
|
2058
|
+
]
|
|
2059
|
+
}),
|
|
2060
|
+
/* @__PURE__ */ jsxs6(AlertDialogFooter, {
|
|
2061
|
+
children: [
|
|
2062
|
+
/* @__PURE__ */ jsx13(AlertDialogCancel, {
|
|
2063
|
+
onClick: reset,
|
|
2064
|
+
children: labels.blockNavigationCancel
|
|
2065
|
+
}),
|
|
2066
|
+
/* @__PURE__ */ jsx13(AlertDialogAction, {
|
|
2067
|
+
onClick: proceed,
|
|
2068
|
+
children: labels.blockNavigationConfirm
|
|
2069
|
+
})
|
|
2070
|
+
]
|
|
2071
|
+
})
|
|
2072
|
+
]
|
|
2073
|
+
})
|
|
2450
2074
|
})
|
|
2451
|
-
})
|
|
2452
|
-
}
|
|
2453
|
-
var FormBlockNavigation = ({
|
|
2075
|
+
});
|
|
2076
|
+
};
|
|
2077
|
+
var FormBlockNavigation = ({
|
|
2078
|
+
form,
|
|
2079
|
+
locale,
|
|
2080
|
+
messages: messages4
|
|
2081
|
+
}) => {
|
|
2454
2082
|
const submitResult = useAtomValue(form.submit);
|
|
2455
2083
|
const isDirty = useAtomValue(form.isDirty);
|
|
2456
2084
|
const hasChangedSinceSubmit = useAtomValue(form.hasChangedSinceSubmit);
|
|
2457
2085
|
const lastSubmittedValues = useAtomValue(form.lastSubmittedValues);
|
|
2458
2086
|
const shouldBlock = !submitResult.waiting && (Option.isNone(lastSubmittedValues) ? isDirty : hasChangedSinceSubmit);
|
|
2459
2087
|
return /* @__PURE__ */ jsx13(NavigationBlock, {
|
|
2088
|
+
locale,
|
|
2089
|
+
messages: messages4,
|
|
2460
2090
|
shouldBlock
|
|
2461
2091
|
});
|
|
2462
2092
|
};
|
|
2463
|
-
var BlockNavigation = (
|
|
2464
|
-
|
|
2093
|
+
var BlockNavigation = (props) => /* @__PURE__ */ jsx13(FormBlockNavigation, {
|
|
2094
|
+
...props
|
|
2465
2095
|
});
|
|
2466
2096
|
export {
|
|
2467
2097
|
BlockNavigation,
|