@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.
Files changed (46) hide show
  1. package/dist/components/ui/code-block.d.ts +8 -6
  2. package/dist/components/ui/code-block.js +44 -19
  3. package/dist/components/ui/copy-button.d.ts +9 -6
  4. package/dist/components/ui/copy-button.js +17 -8
  5. package/dist/components/ui/data-table.d.ts +9 -5
  6. package/dist/components/ui/data-table.js +90 -486
  7. package/dist/components/ui/editing-locale-switcher.d.ts +8 -4
  8. package/dist/components/ui/editing-locale-switcher.js +26 -448
  9. package/dist/components/ui/effect-form.d.ts +39 -10
  10. package/dist/components/ui/effect-form.js +171 -541
  11. package/dist/components/ui/error-component.d.ts +4 -2
  12. package/dist/components/ui/error-component.js +28 -450
  13. package/dist/components/ui/file-picker.d.ts +4 -2
  14. package/dist/components/ui/file-picker.js +27 -452
  15. package/dist/components/ui/form.d.ts +123 -71
  16. package/dist/components/ui/form.js +95 -476
  17. package/dist/components/ui/google-map.d.ts +3 -2
  18. package/dist/components/ui/google-map.js +6 -439
  19. package/dist/components/ui/icon-input.d.ts +50 -1
  20. package/dist/components/ui/icon-input.js +38 -448
  21. package/dist/components/ui/krakstack-provider.d.ts +9 -0
  22. package/dist/components/ui/krakstack-provider.js +28 -0
  23. package/dist/components/ui/loading.d.ts +7 -1
  24. package/dist/components/ui/loading.js +6 -438
  25. package/dist/components/ui/locale-switcher.d.ts +8 -4
  26. package/dist/components/ui/locale-switcher.js +35 -453
  27. package/dist/components/ui/pagination.d.ts +5 -3
  28. package/dist/components/ui/pagination.js +7 -439
  29. package/dist/components/ui/search-menu.d.ts +4 -2
  30. package/dist/components/ui/search-menu.js +8 -440
  31. package/dist/components/ui/theme-switcher.d.ts +5 -3
  32. package/dist/components/ui/theme-switcher.js +8 -440
  33. package/dist/components/ui/virtualized-combobox.d.ts +4 -2
  34. package/dist/components/ui/virtualized-combobox.js +17 -445
  35. package/dist/lib/docs.d.ts +2 -0
  36. package/dist/lib/docs.js +92 -481
  37. package/dist/lib/docs.server.js +4 -20
  38. package/dist/lib/documentation-toolkit.js +4 -20
  39. package/dist/lib/markdown/content.d.ts +4 -5
  40. package/dist/services/agent/client/index.js +81 -463
  41. package/dist/services/agent/client/widget.d.ts +6 -3
  42. package/dist/services/notification/client/index.js +11 -440
  43. package/dist/services/notification/client/notification-menu.d.ts +7 -4
  44. package/dist/services/notification/public.js +11 -440
  45. package/package.json +5 -1
  46. package/dist/paraglide/runtime.d.ts +0 -978
@@ -450,443 +450,8 @@ function AttachmentGroup({ className, ...props }) {
450
450
  });
451
451
  }
452
452
 
453
- // ../../src/paraglide/runtime.js
454
- import"@inlang/paraglide-js/urlpattern-polyfill";
455
- var baseLocale = "en";
456
- var locales = ["en", "fr"];
457
- var cookieName = "locale";
458
- var cookieMaxAge = 34560000;
459
- var cookieDomain = "";
460
- var localStorageKey = "PARAGLIDE_LOCALE";
461
- var strategy = [
462
- "url",
463
- "cookie",
464
- "preferredLanguage",
465
- "baseLocale"
466
- ];
467
- var routeStrategies = [
468
- {
469
- match: "/api/:path(.*)?",
470
- exclude: true
471
- },
472
- {
473
- match: "/sitemap.xml",
474
- exclude: true
475
- },
476
- {
477
- match: "/llms.txt",
478
- exclude: true
479
- }
480
- ];
481
- var urlPatterns = [
482
- {
483
- pattern: "/:path(.*)?",
484
- localized: [
485
- [
486
- "en",
487
- "/en/:path(.*)?"
488
- ],
489
- [
490
- "fr",
491
- "/fr/:path(.*)?"
492
- ]
493
- ]
494
- }
495
- ];
496
- var cachedRouteStrategyUrl;
497
- var cachedRouteStrategy;
498
- function findMatchingRouteStrategy(url) {
499
- if (routeStrategies.length === 0) {
500
- return;
501
- }
502
- const urlString = typeof url === "string" ? url : url.href;
503
- if (cachedRouteStrategyUrl === urlString) {
504
- return cachedRouteStrategy;
505
- }
506
- const urlObject = new URL(urlString, "http://dummy.com");
507
- let match;
508
- for (const routeStrategy of routeStrategies) {
509
- const pattern = new URLPattern(routeStrategy.match, urlObject.href);
510
- if (pattern.exec(urlObject.href)) {
511
- match = routeStrategy;
512
- break;
513
- }
514
- }
515
- cachedRouteStrategyUrl = urlString;
516
- cachedRouteStrategy = match;
517
- return match;
518
- }
519
- function getStrategyForUrl(url) {
520
- const routeStrategy = findMatchingRouteStrategy(url);
521
- if (routeStrategy && routeStrategy.exclude !== true && Array.isArray(routeStrategy.strategy)) {
522
- return routeStrategy.strategy;
523
- }
524
- return strategy;
525
- }
526
- var serverAsyncLocalStorage = undefined;
527
- var isServer = import.meta.env?.SSR ?? typeof window === "undefined";
528
- var experimentalStaticLocale = undefined;
529
- var TREE_SHAKE_COOKIE_STRATEGY_USED = true;
530
- var TREE_SHAKE_URL_STRATEGY_USED = true;
531
- var TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED = false;
532
- var TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED = true;
533
- var TREE_SHAKE_DEFAULT_URL_PATTERN_USED = false;
534
- var TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED = false;
535
- globalThis.__paraglide = globalThis.__paraglide ?? {};
536
- globalThis.__paraglide.ssr = globalThis.__paraglide.ssr ?? {};
537
- var _locale;
538
- var localeInitiallySet = false;
539
- var getLocale = () => {
540
- if (experimentalStaticLocale !== undefined) {
541
- return experimentalStaticLocale;
542
- }
543
- if (serverAsyncLocalStorage) {
544
- const locale = serverAsyncLocalStorage?.getStore()?.locale;
545
- if (locale) {
546
- return locale;
547
- }
548
- }
549
- let strategyToUse = strategy;
550
- if (!isServer && typeof window !== "undefined" && window.location?.href) {
551
- strategyToUse = getStrategyForUrl(window.location.href);
552
- }
553
- const resolved = resolveLocaleWithStrategies(strategyToUse, typeof window !== "undefined" ? window.location?.href : undefined);
554
- if (resolved) {
555
- if (!localeInitiallySet) {
556
- _locale = resolved;
557
- localeInitiallySet = true;
558
- setLocale(resolved, { reload: false });
559
- }
560
- return resolved;
561
- }
562
- throw new Error("No locale found. Read the docs https://paraglidejs.com/errors#no-locale-found");
563
- };
564
- function resolveLocaleWithStrategies(strategyToUse, urlForUrlStrategy) {
565
- let locale;
566
- for (const strat of strategyToUse) {
567
- if (TREE_SHAKE_COOKIE_STRATEGY_USED && strat === "cookie") {
568
- locale = extractLocaleFromCookie();
569
- } else if (strat === "baseLocale") {
570
- locale = baseLocale;
571
- } else if (TREE_SHAKE_URL_STRATEGY_USED && strat === "url" && !isServer && typeof urlForUrlStrategy === "string") {
572
- locale = extractLocaleFromUrl(urlForUrlStrategy);
573
- } else if (TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED && strat === "globalVariable" && _locale !== undefined) {
574
- locale = _locale;
575
- } else if (TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED && strat === "preferredLanguage" && !isServer) {
576
- locale = extractLocaleFromNavigator();
577
- } else if (TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED && strat === "localStorage" && !isServer) {
578
- locale = localStorage.getItem(localStorageKey) ?? undefined;
579
- } else if (isCustomStrategy(strat) && customClientStrategies.has(strat)) {
580
- const handler = customClientStrategies.get(strat);
581
- if (handler) {
582
- const result = handler.getLocale();
583
- if (result instanceof Promise) {
584
- continue;
585
- }
586
- if (result !== undefined) {
587
- return assertIsLocale(result);
588
- }
589
- }
590
- }
591
- const matchedLocale = toLocale(locale);
592
- if (matchedLocale) {
593
- return matchedLocale;
594
- }
595
- }
596
- return;
597
- }
598
- var rtlLanguages = new Set([
599
- "ar",
600
- "dv",
601
- "fa",
602
- "he",
603
- "ks",
604
- "ku",
605
- "ps",
606
- "sd",
607
- "ug",
608
- "ur",
609
- "yi"
610
- ]);
611
- var navigateOrReload = (newLocation) => {
612
- if (newLocation) {
613
- window.location.href = newLocation;
614
- } else {
615
- window.location.reload();
616
- }
617
- };
618
- var setLocale = (newLocale, options) => {
619
- const optionsWithDefaults = {
620
- reload: true,
621
- ...options
622
- };
623
- let currentLocale;
624
- try {
625
- currentLocale = getLocale();
626
- } catch {}
627
- const customSetLocalePromises = [];
628
- let newLocation = undefined;
629
- let strategyToUse = strategy;
630
- if (!isServer && typeof window !== "undefined" && window.location?.href) {
631
- strategyToUse = getStrategyForUrl(window.location.href);
632
- }
633
- for (const strat of strategyToUse) {
634
- if (TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED && strat === "globalVariable") {
635
- _locale = newLocale;
636
- } else if (TREE_SHAKE_COOKIE_STRATEGY_USED && strat === "cookie") {
637
- if (isServer || typeof document === "undefined" || typeof window === "undefined") {
638
- continue;
639
- }
640
- const cookieString = `${cookieName}=${newLocale}; path=/; max-age=${cookieMaxAge}`;
641
- document.cookie = cookieDomain ? `${cookieString}; domain=${cookieDomain}` : cookieString;
642
- } else if (strat === "baseLocale") {
643
- continue;
644
- } else if (TREE_SHAKE_URL_STRATEGY_USED && strat === "url" && typeof window !== "undefined") {
645
- newLocation = localizeUrl(window.location.href, {
646
- locale: newLocale
647
- }).href;
648
- } else if (TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED && strat === "localStorage" && typeof window !== "undefined") {
649
- localStorage.setItem(localStorageKey, newLocale);
650
- } else if (isCustomStrategy(strat) && customClientStrategies.has(strat)) {
651
- const handler = customClientStrategies.get(strat);
652
- if (handler) {
653
- let result = handler.setLocale(newLocale);
654
- if (result instanceof Promise) {
655
- result = result.catch((error) => {
656
- throw new Error(`Custom strategy "${strat}" setLocale failed.`, {
657
- cause: error
658
- });
659
- });
660
- customSetLocalePromises.push(result);
661
- }
662
- }
663
- }
664
- }
665
- const runReload = () => {
666
- if (!isServer && optionsWithDefaults.reload && window.location && newLocale !== currentLocale) {
667
- navigateOrReload(newLocation);
668
- }
669
- };
670
- if (customSetLocalePromises.length) {
671
- return Promise.all(customSetLocalePromises).then(() => {
672
- runReload();
673
- });
674
- }
675
- runReload();
676
- return;
677
- };
678
- var getUrlOrigin = () => {
679
- if (serverAsyncLocalStorage) {
680
- return serverAsyncLocalStorage.getStore()?.origin ?? "http://fallback.com";
681
- } else if (typeof window !== "undefined") {
682
- return window.location.origin;
683
- }
684
- return "http://fallback.com";
685
- };
686
- function toLocale(value) {
687
- if (typeof value !== "string") {
688
- return;
689
- }
690
- const lowerValue = value.toLowerCase();
691
- for (const locale of locales) {
692
- if (locale.toLowerCase() === lowerValue) {
693
- return locale;
694
- }
695
- }
696
- return;
697
- }
698
- function assertIsLocale(input) {
699
- const locale = toLocale(input);
700
- if (locale)
701
- return locale;
702
- throw new Error(`Invalid locale: ${input}. Expected one of: ${locales.join(", ")}`);
703
- }
704
- function extractLocaleFromCookie() {
705
- if (typeof document === "undefined" || !document.cookie) {
706
- return;
707
- }
708
- const match = document.cookie.match(new RegExp(`(^| )${cookieName}=([^;]+)`));
709
- const locale = match?.[2];
710
- return toLocale(locale);
711
- }
712
- function extractLocaleFromNavigator() {
713
- if (!navigator?.languages?.length) {
714
- return;
715
- }
716
- const languages = navigator.languages.map((lang) => ({
717
- fullTag: lang,
718
- baseTag: lang.split("-")[0]
719
- }));
720
- for (const lang of languages) {
721
- const fullLocale = toLocale(lang.fullTag);
722
- if (fullLocale) {
723
- return fullLocale;
724
- }
725
- const baseLocale2 = toLocale(lang.baseTag);
726
- if (baseLocale2) {
727
- return baseLocale2;
728
- }
729
- }
730
- return;
731
- }
732
- var cachedUrl;
733
- var cachedLocale;
734
- function extractLocaleFromUrl(url) {
735
- const urlString = typeof url === "string" ? url : url.href;
736
- if (cachedUrl === urlString) {
737
- return cachedLocale;
738
- }
739
- let result;
740
- if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {
741
- result = defaultUrlPatternExtractLocale(url);
742
- } else {
743
- const urlObj = typeof url === "string" ? new URL(url) : url;
744
- for (const element of urlPatterns) {
745
- for (const [locale, localizedPattern] of element.localized) {
746
- const match = new URLPattern(localizedPattern, urlObj.href).exec(urlObj.href);
747
- if (match) {
748
- result = locale;
749
- break;
750
- }
751
- }
752
- if (result)
753
- break;
754
- }
755
- }
756
- cachedUrl = urlString;
757
- cachedLocale = result;
758
- return result;
759
- }
760
- function defaultUrlPatternExtractLocale(url) {
761
- const urlObj = new URL(url, "http://dummy.com");
762
- const pathSegments = urlObj.pathname.split("/").filter(Boolean);
763
- return toLocale(pathSegments[0]) || baseLocale;
764
- }
765
- function localizeUrl(url, options) {
766
- const targetLocale = options?.locale ? assertIsLocale(options?.locale) : getLocale();
767
- if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {
768
- return localizeUrlDefaultPattern(url, targetLocale);
769
- }
770
- const urlObj = typeof url === "string" ? new URL(url) : url;
771
- for (const element of urlPatterns) {
772
- for (const [, localizedPattern] of element.localized) {
773
- const match = new URLPattern(localizedPattern, urlObj.href).exec(urlObj.href);
774
- if (!match) {
775
- continue;
776
- }
777
- const targetPattern = element.localized.find(([locale]) => locale === targetLocale)?.[1];
778
- if (!targetPattern) {
779
- continue;
780
- }
781
- const localizedUrl = fillPattern(targetPattern, aggregateGroups(match), urlObj.origin);
782
- return fillMissingUrlParts(localizedUrl, match);
783
- }
784
- const unlocalizedMatch = new URLPattern(element.pattern, urlObj.href).exec(urlObj.href);
785
- if (unlocalizedMatch) {
786
- const targetPattern = element.localized.find(([locale]) => locale === targetLocale)?.[1];
787
- if (targetPattern) {
788
- const localizedUrl = fillPattern(targetPattern, aggregateGroups(unlocalizedMatch), urlObj.origin);
789
- return fillMissingUrlParts(localizedUrl, unlocalizedMatch);
790
- }
791
- }
792
- }
793
- return urlObj;
794
- }
795
- function localizeUrlDefaultPattern(url, locale) {
796
- const urlObj = typeof url === "string" ? new URL(url, getUrlOrigin()) : new URL(url);
797
- const currentLocale = extractLocaleFromUrl(urlObj);
798
- if (currentLocale === locale) {
799
- return urlObj;
800
- }
801
- const pathSegments = urlObj.pathname.split("/").filter(Boolean);
802
- if (pathSegments.length > 0 && toLocale(pathSegments[0])) {
803
- pathSegments.shift();
804
- }
805
- if (locale === baseLocale) {
806
- urlObj.pathname = "/" + pathSegments.join("/");
807
- } else {
808
- urlObj.pathname = "/" + locale + "/" + pathSegments.join("/");
809
- }
810
- return urlObj;
811
- }
812
- function fillMissingUrlParts(url, match) {
813
- if (match.protocol.groups["0"]) {
814
- url.protocol = match.protocol.groups["0"] ?? "";
815
- }
816
- if (match.hostname.groups["0"]) {
817
- url.hostname = match.hostname.groups["0"] ?? "";
818
- }
819
- if (match.username.groups["0"]) {
820
- url.username = match.username.groups["0"] ?? "";
821
- }
822
- if (match.password.groups["0"]) {
823
- url.password = match.password.groups["0"] ?? "";
824
- }
825
- if (match.port.groups["0"]) {
826
- url.port = match.port.groups["0"] ?? "";
827
- }
828
- if (match.pathname.groups["0"]) {
829
- url.pathname = match.pathname.groups["0"] ?? "";
830
- }
831
- if (match.search.groups["0"]) {
832
- url.search = match.search.groups["0"] ?? "";
833
- }
834
- if (match.hash.groups["0"]) {
835
- url.hash = match.hash.groups["0"] ?? "";
836
- }
837
- return url;
838
- }
839
- function fillPattern(pattern, values, origin) {
840
- let processedPattern = pattern.replace(/(https?:\/\/[^:/]+):(\d+)(\/|$)/g, (_, protocol, port, slash) => {
841
- return `${protocol}#PORT-${port}#${slash}`;
842
- });
843
- let processedGroupDelimiters = processedPattern.replace(/\{([^{}]*)\}([?+*]?)/g, (_, content, modifier) => {
844
- if (modifier === "?") {
845
- return content;
846
- }
847
- return content;
848
- });
849
- let filled = processedGroupDelimiters.replace(/(\/?):([a-zA-Z0-9_]+)(\([^)]*\))?([?+*]?)/g, (_, slash, name, __, modifier) => {
850
- const value = values[name];
851
- if (value === null) {
852
- return "";
853
- }
854
- if (modifier === "?") {
855
- return value !== undefined ? `${slash}${value}` : "";
856
- }
857
- if (modifier === "+" || modifier === "*") {
858
- if (value === undefined && modifier === "+") {
859
- throw new Error(`Missing value for "${name}" (one or more required)`);
860
- }
861
- return value ? `${slash}${value}` : "";
862
- }
863
- if (value === undefined) {
864
- throw new Error(`Missing value for "${name}"`);
865
- }
866
- return `${slash}${value}`;
867
- });
868
- filled = filled.replace(/#PORT-(\d+)#/g, ":$1");
869
- return new URL(filled, origin);
870
- }
871
- function aggregateGroups(match) {
872
- return {
873
- ...match.hash.groups,
874
- ...match.hostname.groups,
875
- ...match.password.groups,
876
- ...match.pathname.groups,
877
- ...match.port.groups,
878
- ...match.protocol.groups,
879
- ...match.search.groups,
880
- ...match.username.groups
881
- };
882
- }
883
- var customServerStrategies = new Map;
884
- var customClientStrategies = new Map;
885
- function isCustomStrategy(strategy2) {
886
- return typeof strategy2 === "string" && /^custom-[A-Za-z0-9_-]+$/.test(strategy2);
887
- }
888
-
889
453
  // ../../src/components/ui/file-picker.tsx
454
+ import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider";
890
455
  import { jsx as jsx7, jsxs as jsxs3, Fragment } from "react/jsx-runtime";
891
456
  "use client";
892
457
  var messages = {
@@ -909,22 +474,30 @@ var messages = {
909
474
  replaceFile: "Remplacer le fichier"
910
475
  }
911
476
  };
912
- var filePickerMessages = (overrides) => ({
913
- ...getLocale().startsWith("fr") ? messages.fr : messages.en,
914
- ...overrides
477
+ var filePickerMessages = (locale, translations) => ({
478
+ ...locale.startsWith("fr") ? messages.fr : messages.en,
479
+ ...translations?.[locale.split("-")[0] ?? locale],
480
+ ...translations?.[locale]
915
481
  });
916
- var formatBytes = (bytes) => {
917
- const sizes = ["Bytes", "KB", "MB", "GB", "TB"];
918
- if (bytes === 0)
919
- return "0 Bytes";
920
- const index = Math.min(Math.floor(Math.log(bytes) / Math.log(1024)), sizes.length - 1);
921
- if (index === 0)
922
- return `${bytes} ${sizes[index]}`;
923
- return `${(bytes / 1024 ** index).toFixed(1)} ${sizes[index]}`;
482
+ var formatBytes = (bytes, locale) => {
483
+ const units = [
484
+ "byte",
485
+ "kilobyte",
486
+ "megabyte",
487
+ "gigabyte",
488
+ "terabyte"
489
+ ];
490
+ const index = Math.min(bytes === 0 ? 0 : Math.floor(Math.log(bytes) / Math.log(1024)), units.length - 1);
491
+ const value = index === 0 ? bytes : Number((bytes / 1024 ** index).toFixed(1));
492
+ return new Intl.NumberFormat(locale, {
493
+ style: "unit",
494
+ unit: units[index],
495
+ unitDisplay: "short"
496
+ }).format(value);
924
497
  };
925
- var fileDescription = (file) => [
498
+ var fileDescription = (file, locale) => [
926
499
  file.type || file.name.split(".").pop()?.toUpperCase(),
927
- formatBytes(file.size)
500
+ formatBytes(file.size, locale)
928
501
  ].filter(Boolean).join(" · ");
929
502
  var FilePicker = ({
930
503
  accept = "",
@@ -934,6 +507,7 @@ var FilePicker = ({
934
507
  id,
935
508
  image,
936
509
  invalid = false,
510
+ locale: localeOverride,
937
511
  messages: messages2,
938
512
  multiple = false,
939
513
  name,
@@ -944,7 +518,8 @@ var FilePicker = ({
944
518
  required,
945
519
  title
946
520
  }) => {
947
- const labels = filePickerMessages(messages2);
521
+ const locale = useKrakstackLocale(localeOverride);
522
+ const labels = filePickerMessages(locale, messages2);
948
523
  const inputRef = useRef(null);
949
524
  const dragDepthRef = useRef(0);
950
525
  const [dragging, setDragging] = useState(false);
@@ -1064,7 +639,7 @@ var FilePicker = ({
1064
639
  children: selectedFile.name
1065
640
  }),
1066
641
  /* @__PURE__ */ jsx7(AttachmentDescription, {
1067
- children: fileDescription(selectedFile)
642
+ children: fileDescription(selectedFile, locale)
1068
643
  })
1069
644
  ]
1070
645
  }),
@@ -1158,7 +733,7 @@ var FilePicker = ({
1158
733
  children: title
1159
734
  }),
1160
735
  file ? /* @__PURE__ */ jsx7(AttachmentDescription, {
1161
- children: fileDescription(file)
736
+ children: fileDescription(file, locale)
1162
737
  }) : null
1163
738
  ]
1164
739
  }),
@@ -1378,6 +953,7 @@ function InputGroupInput({
1378
953
  }
1379
954
 
1380
955
  // ../../src/components/ui/virtualized-combobox.tsx
956
+ import { useKrakstackLocale as useKrakstackLocale2 } from "@krak-stack/registry/krakstack-provider";
1381
957
  import { jsx as jsx12, jsxs as jsxs5 } from "react/jsx-runtime";
1382
958
  "use client";
1383
959
  var messages2 = {
@@ -1394,22 +970,24 @@ var messages2 = {
1394
970
  selectMore: "Sélectionner davantage"
1395
971
  }
1396
972
  };
1397
- var virtualizedComboboxMessages = (overrides) => ({
1398
- ...getLocale().startsWith("fr") ? messages2.fr : messages2.en,
1399
- ...overrides
973
+ var virtualizedComboboxMessages = (locale, translations) => ({
974
+ ...locale.startsWith("fr") ? messages2.fr : messages2.en,
975
+ ...translations?.[locale.split("-")[0] ?? locale],
976
+ ...translations?.[locale]
1400
977
  });
1401
978
  var optionEquals = (item, selected) => item.value === selected.value;
1402
979
  var VirtualizedComboboxList = ({
1403
980
  emptyLabel,
1404
981
  groupSelections,
1405
982
  itemIndexRef,
983
+ locale = "en",
1406
984
  messages: messageOverrides,
1407
985
  renderItem,
1408
986
  selectedValues,
1409
987
  virtualizerRef
1410
988
  }) => {
1411
989
  const filteredItems = ComboboxPrimitive.useFilteredItems();
1412
- const labels = virtualizedComboboxMessages(messageOverrides);
990
+ const labels = virtualizedComboboxMessages(locale, messageOverrides);
1413
991
  const itemEntries = filteredItems.map((item, index) => ({
1414
992
  kind: "item",
1415
993
  item,
@@ -1519,12 +1097,13 @@ var VirtualizedComboboxContent = ({
1519
1097
  emptyLabel,
1520
1098
  groupSelections,
1521
1099
  itemIndexRef,
1100
+ locale = "en",
1522
1101
  messages: messageOverrides,
1523
1102
  renderItem,
1524
1103
  selectedValues,
1525
1104
  virtualizerRef
1526
1105
  }) => {
1527
- const labels = virtualizedComboboxMessages(messageOverrides);
1106
+ const labels = virtualizedComboboxMessages(locale, messageOverrides);
1528
1107
  return /* @__PURE__ */ jsx12(ComboboxPrimitive.Portal, {
1529
1108
  children: /* @__PURE__ */ jsx12(ComboboxPrimitive.Positioner, {
1530
1109
  align: "start",
@@ -1548,6 +1127,7 @@ var VirtualizedComboboxContent = ({
1548
1127
  emptyLabel,
1549
1128
  groupSelections,
1550
1129
  itemIndexRef,
1130
+ locale,
1551
1131
  messages: messageOverrides,
1552
1132
  renderItem,
1553
1133
  selectedValues,
@@ -1597,7 +1177,7 @@ var useComboboxVirtualizerRef = (providedRef) => {
1597
1177
  var VirtualizedComboboxSingle = (props) => {
1598
1178
  const virtualizerRef = useComboboxVirtualizerRef(props.virtualizerRef);
1599
1179
  const itemIndexRef = useRef2(new Map);
1600
- const labels = virtualizedComboboxMessages(props.messages);
1180
+ const labels = virtualizedComboboxMessages(props.locale ?? "en", props.messages);
1601
1181
  return /* @__PURE__ */ jsxs5(ComboboxPrimitive.Root, {
1602
1182
  disabled: props.disabled,
1603
1183
  inputValue: props.searchValue,
@@ -1638,7 +1218,7 @@ var VirtualizedComboboxSingle = (props) => {
1638
1218
  var VirtualizedComboboxMultiple = (props) => {
1639
1219
  const virtualizerRef = useComboboxVirtualizerRef(props.virtualizerRef);
1640
1220
  const itemIndexRef = useRef2(new Map);
1641
- const labels = virtualizedComboboxMessages(props.messages);
1221
+ const labels = virtualizedComboboxMessages(props.locale ?? "en", props.messages);
1642
1222
  return /* @__PURE__ */ jsxs5(ComboboxPrimitive.Root, {
1643
1223
  disabled: props.disabled,
1644
1224
  inputValue: props.searchValue,
@@ -1678,14 +1258,18 @@ var VirtualizedComboboxMultiple = (props) => {
1678
1258
  });
1679
1259
  };
1680
1260
  function VirtualizedCombobox(props) {
1261
+ const locale = useKrakstackLocale2(props.locale);
1681
1262
  return props.multiple ? /* @__PURE__ */ jsx12(VirtualizedComboboxMultiple, {
1682
- ...props
1263
+ ...props,
1264
+ locale
1683
1265
  }) : /* @__PURE__ */ jsx12(VirtualizedComboboxSingle, {
1684
- ...props
1266
+ ...props,
1267
+ locale
1685
1268
  });
1686
1269
  }
1687
1270
 
1688
1271
  // ../../src/components/ui/form.tsx
1272
+ import { useKrakstackLocale as useKrakstackLocale3 } from "@krak-stack/registry/krakstack-provider";
1689
1273
  import { jsx as jsx13, jsxs as jsxs6 } from "react/jsx-runtime";
1690
1274
  var messages3 = {
1691
1275
  en: {
@@ -1719,10 +1303,12 @@ var messages3 = {
1719
1303
  revert: "Revenir aux paramètres par défaut"
1720
1304
  }
1721
1305
  };
1722
- var formMessages = (overrides) => ({
1723
- ...getLocale().startsWith("fr") ? messages3.fr : messages3.en,
1724
- ...overrides
1306
+ var formMessages = (locale = "en", translations) => ({
1307
+ ...locale.startsWith("fr") ? messages3.fr : messages3.en,
1308
+ ...translations?.[locale.split("-")[0] ?? locale],
1309
+ ...translations?.[locale]
1725
1310
  });
1311
+ var useFormMessages = (locale, translations) => formMessages(useKrakstackLocale3(locale), translations);
1726
1312
  var ErrorMessage = ({ text }) => {
1727
1313
  return /* @__PURE__ */ jsx13("em", {
1728
1314
  role: "alert",
@@ -1943,7 +1529,7 @@ var SelectField = ({
1943
1529
  });
1944
1530
  };
1945
1531
  var KeyValueField = (props) => {
1946
- const labels = formMessages(props.messages);
1532
+ const labels = useFormMessages(props.locale, props.messages);
1947
1533
  const field = useFieldContext();
1948
1534
  const invalid = !field.state.meta.isValid;
1949
1535
  const keyValues = Object.entries(field.state.value ?? {});
@@ -2058,6 +1644,7 @@ var SingleSearchableSelectControl = ({
2058
1644
  initialItems = [],
2059
1645
  invalid,
2060
1646
  items,
1647
+ locale,
2061
1648
  messages: messages4,
2062
1649
  name,
2063
1650
  onSearchValueChange,
@@ -2072,6 +1659,7 @@ var SingleSearchableSelectControl = ({
2072
1659
  ariaLabel,
2073
1660
  emptyLabel,
2074
1661
  items: mergedItems,
1662
+ locale,
2075
1663
  ...messages4 ? { messages: messages4 } : {},
2076
1664
  onValueChange: (option) => field.handleChange(option?.value ?? ""),
2077
1665
  placeholder,
@@ -2088,6 +1676,7 @@ var MultipleSearchableSelectControl = ({
2088
1676
  initialItems = [],
2089
1677
  invalid,
2090
1678
  items,
1679
+ locale,
2091
1680
  messages: messages4,
2092
1681
  name,
2093
1682
  onSearchValueChange,
@@ -2102,6 +1691,7 @@ var MultipleSearchableSelectControl = ({
2102
1691
  ariaLabel,
2103
1692
  emptyLabel,
2104
1693
  items: mergedItems,
1694
+ locale,
2105
1695
  ...messages4 ? { messages: messages4 } : {},
2106
1696
  multiple: true,
2107
1697
  onValueChange: (options) => field.handleChange(options.map(({ value }) => value)),
@@ -2119,12 +1709,14 @@ var SearchableSelectField = ({
2119
1709
  multiple,
2120
1710
  ...props
2121
1711
  }) => {
1712
+ const locale = useKrakstackLocale3(props.locale);
2122
1713
  const field = useFieldContext();
2123
- const labels = virtualizedComboboxMessages(props.messages);
1714
+ const labels = virtualizedComboboxMessages(locale, props.messages);
2124
1715
  const invalid = !field.state.meta.isValid;
2125
1716
  const ariaLabel = Schema2.is(Schema2.String)(label) ? label : labels.search;
2126
1717
  const controlProps = {
2127
1718
  ...props,
1719
+ locale,
2128
1720
  ariaLabel,
2129
1721
  invalid,
2130
1722
  name: field.name
@@ -2154,11 +1746,14 @@ var SearchableSelectField = ({
2154
1746
  var FileField = ({
2155
1747
  label,
2156
1748
  accept,
1749
+ filePickerMessages: filePickerMessages2,
1750
+ locale: localeOverride,
2157
1751
  messages: messages4,
2158
1752
  onFileChange,
2159
1753
  required = false
2160
1754
  }) => {
2161
- const labels = formMessages(messages4);
1755
+ const locale = useKrakstackLocale3(localeOverride);
1756
+ const labels = formMessages(locale, messages4);
2162
1757
  const field = useFieldContext();
2163
1758
  const invalid = !field.state.meta.isValid;
2164
1759
  return /* @__PURE__ */ jsxs6(Field, {
@@ -2174,7 +1769,16 @@ var FileField = ({
2174
1769
  ...field.state.value instanceof File ? { file: field.state.value } : {},
2175
1770
  id: field.name,
2176
1771
  invalid,
2177
- messages: { accepts: labels.accepts, deleteFile: labels.delete },
1772
+ locale,
1773
+ messages: {
1774
+ ...filePickerMessages2,
1775
+ [locale]: {
1776
+ ...filePickerMessages2?.[locale.split("-")[0] ?? locale],
1777
+ ...filePickerMessages2?.[locale],
1778
+ accepts: labels.accepts,
1779
+ deleteFile: labels.delete
1780
+ }
1781
+ },
2178
1782
  name: field.name,
2179
1783
  onBlur: field.handleBlur,
2180
1784
  onChange: (file) => {
@@ -2195,11 +1799,14 @@ var FileField = ({
2195
1799
  });
2196
1800
  };
2197
1801
  var ImageField = ({
1802
+ filePickerMessages: filePickerMessages2,
2198
1803
  label,
1804
+ locale: localeOverride,
2199
1805
  messages: messages4,
2200
1806
  size
2201
1807
  }) => {
2202
- const labels = formMessages(messages4);
1808
+ const locale = useKrakstackLocale3(localeOverride);
1809
+ const labels = formMessages(locale, messages4);
2203
1810
  const field = useFieldContext();
2204
1811
  const invalid = !field.state.meta.isValid;
2205
1812
  const imageUrl = Schema2.is(Schema2.String)(field.state.value) ? field.state.value : undefined;
@@ -2223,7 +1830,16 @@ var ImageField = ({
2223
1830
  id: field.name,
2224
1831
  image,
2225
1832
  invalid,
2226
- messages: { accepts: labels.accepts, deleteFile: labels.delete },
1833
+ locale,
1834
+ messages: {
1835
+ ...filePickerMessages2,
1836
+ [locale]: {
1837
+ ...filePickerMessages2?.[locale.split("-")[0] ?? locale],
1838
+ ...filePickerMessages2?.[locale],
1839
+ accepts: labels.accepts,
1840
+ deleteFile: labels.delete
1841
+ }
1842
+ },
2227
1843
  name: field.name,
2228
1844
  onBlur: field.handleBlur,
2229
1845
  onChange: field.handleChange,
@@ -2240,9 +1856,10 @@ var ImageField = ({
2240
1856
  });
2241
1857
  };
2242
1858
  var BlockNavigation = ({
1859
+ locale,
2243
1860
  messages: messages4
2244
1861
  }) => {
2245
- const labels = formMessages(messages4);
1862
+ const labels = useFormMessages(locale, messages4);
2246
1863
  const form = useFormContext();
2247
1864
  const shouldBlock = useStore(form.store, (formState) => formState.isDirty && !(formState.isSubmitting || formState.isSubmitted));
2248
1865
  return /* @__PURE__ */ jsx13(Block, {
@@ -2282,9 +1899,10 @@ var BlockNavigation = ({
2282
1899
  };
2283
1900
  var SubmitButton = ({
2284
1901
  children,
1902
+ locale,
2285
1903
  messages: messages4
2286
1904
  }) => {
2287
- const labels = formMessages(messages4);
1905
+ const labels = useFormMessages(locale, messages4);
2288
1906
  const form = useFormContext();
2289
1907
  return /* @__PURE__ */ jsx13(form.Subscribe, {
2290
1908
  selector: (formState) => [formState.isSubmitting],
@@ -2323,7 +1941,7 @@ var FieldWrapper = ({
2323
1941
  legend,
2324
1942
  localized = true,
2325
1943
  description,
2326
- locales: locales2,
1944
+ locales,
2327
1945
  editingLocale
2328
1946
  }) => {
2329
1947
  return /* @__PURE__ */ jsxs6(FieldSet, {
@@ -2332,11 +1950,11 @@ var FieldWrapper = ({
2332
1950
  className: "flex items-center gap-2",
2333
1951
  children: [
2334
1952
  legend,
2335
- localized && editingLocale && locales2 && /* @__PURE__ */ jsxs6(Badge, {
1953
+ localized && editingLocale && locales && /* @__PURE__ */ jsxs6(Badge, {
2336
1954
  variant: "outline",
2337
1955
  children: [
2338
1956
  /* @__PURE__ */ jsx13(Languages, {}),
2339
- locales2.find((l) => l.value === editingLocale).label
1957
+ locales.find((l) => l.value === editingLocale).label
2340
1958
  ]
2341
1959
  })
2342
1960
  ]
@@ -2351,10 +1969,11 @@ var FieldWrapper = ({
2351
1969
  });
2352
1970
  };
2353
1971
  var RevertButton = ({
1972
+ locale,
2354
1973
  messages: messages4,
2355
1974
  original
2356
1975
  }) => {
2357
- const labels = formMessages(messages4);
1976
+ const labels = useFormMessages(locale, messages4);
2358
1977
  const field = useFieldContext();
2359
1978
  if (field.state.value !== original) {
2360
1979
  return /* @__PURE__ */ jsx13("div", {