@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.
Files changed (49) hide show
  1. package/README.md +21 -0
  2. package/dist/components/ui/code-block.d.ts +8 -6
  3. package/dist/components/ui/code-block.js +40 -19
  4. package/dist/components/ui/copy-button.d.ts +9 -6
  5. package/dist/components/ui/copy-button.js +15 -8
  6. package/dist/components/ui/data-table.d.ts +9 -5
  7. package/dist/components/ui/data-table.js +74 -479
  8. package/dist/components/ui/editing-locale-switcher.d.ts +8 -4
  9. package/dist/components/ui/editing-locale-switcher.js +20 -448
  10. package/dist/components/ui/effect-form.d.ts +39 -10
  11. package/dist/components/ui/effect-form.js +141 -527
  12. package/dist/components/ui/error-component.d.ts +4 -2
  13. package/dist/components/ui/error-component.js +24 -450
  14. package/dist/components/ui/file-picker.d.ts +4 -2
  15. package/dist/components/ui/file-picker.js +25 -452
  16. package/dist/components/ui/form.d.ts +123 -71
  17. package/dist/components/ui/form.js +81 -474
  18. package/dist/components/ui/google-map.d.ts +2 -1
  19. package/dist/components/ui/google-map.js +4 -439
  20. package/dist/components/ui/icon-input.d.ts +50 -1
  21. package/dist/components/ui/icon-input.js +30 -446
  22. package/dist/components/ui/loading.d.ts +7 -1
  23. package/dist/components/ui/loading.js +4 -438
  24. package/dist/components/ui/locale-switcher.d.ts +8 -4
  25. package/dist/components/ui/locale-switcher.js +29 -453
  26. package/dist/components/ui/pagination.d.ts +5 -3
  27. package/dist/components/ui/pagination.js +5 -439
  28. package/dist/components/ui/search-menu.d.ts +4 -2
  29. package/dist/components/ui/search-menu.js +6 -440
  30. package/dist/components/ui/theme-switcher.d.ts +5 -3
  31. package/dist/components/ui/theme-switcher.js +6 -440
  32. package/dist/components/ui/virtualized-combobox.d.ts +4 -2
  33. package/dist/components/ui/virtualized-combobox.js +11 -443
  34. package/dist/lib/docs.d.ts +2 -0
  35. package/dist/lib/docs.js +86 -481
  36. package/dist/lib/docs.server.js +0 -21
  37. package/dist/lib/documentation-toolkit.js +0 -21
  38. package/dist/lib/markdown/content.d.ts +4 -5
  39. package/dist/services/agent/client/index.js +75 -463
  40. package/dist/services/agent/client/widget.d.ts +6 -3
  41. package/dist/services/notification/client/index.js +8 -440
  42. package/dist/services/notification/client/notification-menu.d.ts +6 -3
  43. package/dist/services/notification/public.js +8 -440
  44. package/dist/services/opentelemetry/api.d.ts +5 -0
  45. package/dist/services/opentelemetry/api.js +44 -0
  46. package/dist/services/opentelemetry/browser.d.ts +10 -0
  47. package/dist/services/opentelemetry/browser.js +59 -0
  48. package/package.json +9 -1
  49. package/dist/paraglide/runtime.d.ts +0 -978
@@ -314,444 +314,6 @@ function Input({ className, type, ...props }) {
314
314
 
315
315
  // ../../src/components/ui/loading.tsx
316
316
  import { Loader2 } from "lucide-react";
317
-
318
- // ../../src/paraglide/runtime.js
319
- import"@inlang/paraglide-js/urlpattern-polyfill";
320
- var baseLocale = "en";
321
- var locales = ["en", "fr"];
322
- var cookieName = "locale";
323
- var cookieMaxAge = 34560000;
324
- var cookieDomain = "";
325
- var localStorageKey = "PARAGLIDE_LOCALE";
326
- var strategy = [
327
- "url",
328
- "cookie",
329
- "preferredLanguage",
330
- "baseLocale"
331
- ];
332
- var routeStrategies = [
333
- {
334
- match: "/api/:path(.*)?",
335
- exclude: true
336
- },
337
- {
338
- match: "/sitemap.xml",
339
- exclude: true
340
- },
341
- {
342
- match: "/llms.txt",
343
- exclude: true
344
- }
345
- ];
346
- var urlPatterns = [
347
- {
348
- pattern: "/:path(.*)?",
349
- localized: [
350
- [
351
- "en",
352
- "/en/:path(.*)?"
353
- ],
354
- [
355
- "fr",
356
- "/fr/:path(.*)?"
357
- ]
358
- ]
359
- }
360
- ];
361
- var cachedRouteStrategyUrl;
362
- var cachedRouteStrategy;
363
- function findMatchingRouteStrategy(url) {
364
- if (routeStrategies.length === 0) {
365
- return;
366
- }
367
- const urlString = typeof url === "string" ? url : url.href;
368
- if (cachedRouteStrategyUrl === urlString) {
369
- return cachedRouteStrategy;
370
- }
371
- const urlObject = new URL(urlString, "http://dummy.com");
372
- let match;
373
- for (const routeStrategy of routeStrategies) {
374
- const pattern = new URLPattern(routeStrategy.match, urlObject.href);
375
- if (pattern.exec(urlObject.href)) {
376
- match = routeStrategy;
377
- break;
378
- }
379
- }
380
- cachedRouteStrategyUrl = urlString;
381
- cachedRouteStrategy = match;
382
- return match;
383
- }
384
- function getStrategyForUrl(url) {
385
- const routeStrategy = findMatchingRouteStrategy(url);
386
- if (routeStrategy && routeStrategy.exclude !== true && Array.isArray(routeStrategy.strategy)) {
387
- return routeStrategy.strategy;
388
- }
389
- return strategy;
390
- }
391
- var serverAsyncLocalStorage = undefined;
392
- var isServer = import.meta.env?.SSR ?? typeof window === "undefined";
393
- var experimentalStaticLocale = undefined;
394
- var TREE_SHAKE_COOKIE_STRATEGY_USED = true;
395
- var TREE_SHAKE_URL_STRATEGY_USED = true;
396
- var TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED = false;
397
- var TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED = true;
398
- var TREE_SHAKE_DEFAULT_URL_PATTERN_USED = false;
399
- var TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED = false;
400
- globalThis.__paraglide = globalThis.__paraglide ?? {};
401
- globalThis.__paraglide.ssr = globalThis.__paraglide.ssr ?? {};
402
- var _locale;
403
- var localeInitiallySet = false;
404
- var getLocale = () => {
405
- if (experimentalStaticLocale !== undefined) {
406
- return experimentalStaticLocale;
407
- }
408
- if (serverAsyncLocalStorage) {
409
- const locale = serverAsyncLocalStorage?.getStore()?.locale;
410
- if (locale) {
411
- return locale;
412
- }
413
- }
414
- let strategyToUse = strategy;
415
- if (!isServer && typeof window !== "undefined" && window.location?.href) {
416
- strategyToUse = getStrategyForUrl(window.location.href);
417
- }
418
- const resolved = resolveLocaleWithStrategies(strategyToUse, typeof window !== "undefined" ? window.location?.href : undefined);
419
- if (resolved) {
420
- if (!localeInitiallySet) {
421
- _locale = resolved;
422
- localeInitiallySet = true;
423
- setLocale(resolved, { reload: false });
424
- }
425
- return resolved;
426
- }
427
- throw new Error("No locale found. Read the docs https://paraglidejs.com/errors#no-locale-found");
428
- };
429
- function resolveLocaleWithStrategies(strategyToUse, urlForUrlStrategy) {
430
- let locale;
431
- for (const strat of strategyToUse) {
432
- if (TREE_SHAKE_COOKIE_STRATEGY_USED && strat === "cookie") {
433
- locale = extractLocaleFromCookie();
434
- } else if (strat === "baseLocale") {
435
- locale = baseLocale;
436
- } else if (TREE_SHAKE_URL_STRATEGY_USED && strat === "url" && !isServer && typeof urlForUrlStrategy === "string") {
437
- locale = extractLocaleFromUrl(urlForUrlStrategy);
438
- } else if (TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED && strat === "globalVariable" && _locale !== undefined) {
439
- locale = _locale;
440
- } else if (TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED && strat === "preferredLanguage" && !isServer) {
441
- locale = extractLocaleFromNavigator();
442
- } else if (TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED && strat === "localStorage" && !isServer) {
443
- locale = localStorage.getItem(localStorageKey) ?? undefined;
444
- } else if (isCustomStrategy(strat) && customClientStrategies.has(strat)) {
445
- const handler = customClientStrategies.get(strat);
446
- if (handler) {
447
- const result = handler.getLocale();
448
- if (result instanceof Promise) {
449
- continue;
450
- }
451
- if (result !== undefined) {
452
- return assertIsLocale(result);
453
- }
454
- }
455
- }
456
- const matchedLocale = toLocale(locale);
457
- if (matchedLocale) {
458
- return matchedLocale;
459
- }
460
- }
461
- return;
462
- }
463
- var rtlLanguages = new Set([
464
- "ar",
465
- "dv",
466
- "fa",
467
- "he",
468
- "ks",
469
- "ku",
470
- "ps",
471
- "sd",
472
- "ug",
473
- "ur",
474
- "yi"
475
- ]);
476
- var navigateOrReload = (newLocation) => {
477
- if (newLocation) {
478
- window.location.href = newLocation;
479
- } else {
480
- window.location.reload();
481
- }
482
- };
483
- var setLocale = (newLocale, options) => {
484
- const optionsWithDefaults = {
485
- reload: true,
486
- ...options
487
- };
488
- let currentLocale;
489
- try {
490
- currentLocale = getLocale();
491
- } catch {}
492
- const customSetLocalePromises = [];
493
- let newLocation = undefined;
494
- let strategyToUse = strategy;
495
- if (!isServer && typeof window !== "undefined" && window.location?.href) {
496
- strategyToUse = getStrategyForUrl(window.location.href);
497
- }
498
- for (const strat of strategyToUse) {
499
- if (TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED && strat === "globalVariable") {
500
- _locale = newLocale;
501
- } else if (TREE_SHAKE_COOKIE_STRATEGY_USED && strat === "cookie") {
502
- if (isServer || typeof document === "undefined" || typeof window === "undefined") {
503
- continue;
504
- }
505
- const cookieString = `${cookieName}=${newLocale}; path=/; max-age=${cookieMaxAge}`;
506
- document.cookie = cookieDomain ? `${cookieString}; domain=${cookieDomain}` : cookieString;
507
- } else if (strat === "baseLocale") {
508
- continue;
509
- } else if (TREE_SHAKE_URL_STRATEGY_USED && strat === "url" && typeof window !== "undefined") {
510
- newLocation = localizeUrl(window.location.href, {
511
- locale: newLocale
512
- }).href;
513
- } else if (TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED && strat === "localStorage" && typeof window !== "undefined") {
514
- localStorage.setItem(localStorageKey, newLocale);
515
- } else if (isCustomStrategy(strat) && customClientStrategies.has(strat)) {
516
- const handler = customClientStrategies.get(strat);
517
- if (handler) {
518
- let result = handler.setLocale(newLocale);
519
- if (result instanceof Promise) {
520
- result = result.catch((error) => {
521
- throw new Error(`Custom strategy "${strat}" setLocale failed.`, {
522
- cause: error
523
- });
524
- });
525
- customSetLocalePromises.push(result);
526
- }
527
- }
528
- }
529
- }
530
- const runReload = () => {
531
- if (!isServer && optionsWithDefaults.reload && window.location && newLocale !== currentLocale) {
532
- navigateOrReload(newLocation);
533
- }
534
- };
535
- if (customSetLocalePromises.length) {
536
- return Promise.all(customSetLocalePromises).then(() => {
537
- runReload();
538
- });
539
- }
540
- runReload();
541
- return;
542
- };
543
- var getUrlOrigin = () => {
544
- if (serverAsyncLocalStorage) {
545
- return serverAsyncLocalStorage.getStore()?.origin ?? "http://fallback.com";
546
- } else if (typeof window !== "undefined") {
547
- return window.location.origin;
548
- }
549
- return "http://fallback.com";
550
- };
551
- function toLocale(value) {
552
- if (typeof value !== "string") {
553
- return;
554
- }
555
- const lowerValue = value.toLowerCase();
556
- for (const locale of locales) {
557
- if (locale.toLowerCase() === lowerValue) {
558
- return locale;
559
- }
560
- }
561
- return;
562
- }
563
- function assertIsLocale(input) {
564
- const locale = toLocale(input);
565
- if (locale)
566
- return locale;
567
- throw new Error(`Invalid locale: ${input}. Expected one of: ${locales.join(", ")}`);
568
- }
569
- function extractLocaleFromCookie() {
570
- if (typeof document === "undefined" || !document.cookie) {
571
- return;
572
- }
573
- const match = document.cookie.match(new RegExp(`(^| )${cookieName}=([^;]+)`));
574
- const locale = match?.[2];
575
- return toLocale(locale);
576
- }
577
- function extractLocaleFromNavigator() {
578
- if (!navigator?.languages?.length) {
579
- return;
580
- }
581
- const languages = navigator.languages.map((lang) => ({
582
- fullTag: lang,
583
- baseTag: lang.split("-")[0]
584
- }));
585
- for (const lang of languages) {
586
- const fullLocale = toLocale(lang.fullTag);
587
- if (fullLocale) {
588
- return fullLocale;
589
- }
590
- const baseLocale2 = toLocale(lang.baseTag);
591
- if (baseLocale2) {
592
- return baseLocale2;
593
- }
594
- }
595
- return;
596
- }
597
- var cachedUrl;
598
- var cachedLocale;
599
- function extractLocaleFromUrl(url) {
600
- const urlString = typeof url === "string" ? url : url.href;
601
- if (cachedUrl === urlString) {
602
- return cachedLocale;
603
- }
604
- let result;
605
- if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {
606
- result = defaultUrlPatternExtractLocale(url);
607
- } else {
608
- const urlObj = typeof url === "string" ? new URL(url) : url;
609
- for (const element of urlPatterns) {
610
- for (const [locale, localizedPattern] of element.localized) {
611
- const match = new URLPattern(localizedPattern, urlObj.href).exec(urlObj.href);
612
- if (match) {
613
- result = locale;
614
- break;
615
- }
616
- }
617
- if (result)
618
- break;
619
- }
620
- }
621
- cachedUrl = urlString;
622
- cachedLocale = result;
623
- return result;
624
- }
625
- function defaultUrlPatternExtractLocale(url) {
626
- const urlObj = new URL(url, "http://dummy.com");
627
- const pathSegments = urlObj.pathname.split("/").filter(Boolean);
628
- return toLocale(pathSegments[0]) || baseLocale;
629
- }
630
- function localizeUrl(url, options) {
631
- const targetLocale = options?.locale ? assertIsLocale(options?.locale) : getLocale();
632
- if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {
633
- return localizeUrlDefaultPattern(url, targetLocale);
634
- }
635
- const urlObj = typeof url === "string" ? new URL(url) : url;
636
- for (const element of urlPatterns) {
637
- for (const [, localizedPattern] of element.localized) {
638
- const match = new URLPattern(localizedPattern, urlObj.href).exec(urlObj.href);
639
- if (!match) {
640
- continue;
641
- }
642
- const targetPattern = element.localized.find(([locale]) => locale === targetLocale)?.[1];
643
- if (!targetPattern) {
644
- continue;
645
- }
646
- const localizedUrl = fillPattern(targetPattern, aggregateGroups(match), urlObj.origin);
647
- return fillMissingUrlParts(localizedUrl, match);
648
- }
649
- const unlocalizedMatch = new URLPattern(element.pattern, urlObj.href).exec(urlObj.href);
650
- if (unlocalizedMatch) {
651
- const targetPattern = element.localized.find(([locale]) => locale === targetLocale)?.[1];
652
- if (targetPattern) {
653
- const localizedUrl = fillPattern(targetPattern, aggregateGroups(unlocalizedMatch), urlObj.origin);
654
- return fillMissingUrlParts(localizedUrl, unlocalizedMatch);
655
- }
656
- }
657
- }
658
- return urlObj;
659
- }
660
- function localizeUrlDefaultPattern(url, locale) {
661
- const urlObj = typeof url === "string" ? new URL(url, getUrlOrigin()) : new URL(url);
662
- const currentLocale = extractLocaleFromUrl(urlObj);
663
- if (currentLocale === locale) {
664
- return urlObj;
665
- }
666
- const pathSegments = urlObj.pathname.split("/").filter(Boolean);
667
- if (pathSegments.length > 0 && toLocale(pathSegments[0])) {
668
- pathSegments.shift();
669
- }
670
- if (locale === baseLocale) {
671
- urlObj.pathname = "/" + pathSegments.join("/");
672
- } else {
673
- urlObj.pathname = "/" + locale + "/" + pathSegments.join("/");
674
- }
675
- return urlObj;
676
- }
677
- function fillMissingUrlParts(url, match) {
678
- if (match.protocol.groups["0"]) {
679
- url.protocol = match.protocol.groups["0"] ?? "";
680
- }
681
- if (match.hostname.groups["0"]) {
682
- url.hostname = match.hostname.groups["0"] ?? "";
683
- }
684
- if (match.username.groups["0"]) {
685
- url.username = match.username.groups["0"] ?? "";
686
- }
687
- if (match.password.groups["0"]) {
688
- url.password = match.password.groups["0"] ?? "";
689
- }
690
- if (match.port.groups["0"]) {
691
- url.port = match.port.groups["0"] ?? "";
692
- }
693
- if (match.pathname.groups["0"]) {
694
- url.pathname = match.pathname.groups["0"] ?? "";
695
- }
696
- if (match.search.groups["0"]) {
697
- url.search = match.search.groups["0"] ?? "";
698
- }
699
- if (match.hash.groups["0"]) {
700
- url.hash = match.hash.groups["0"] ?? "";
701
- }
702
- return url;
703
- }
704
- function fillPattern(pattern, values, origin) {
705
- let processedPattern = pattern.replace(/(https?:\/\/[^:/]+):(\d+)(\/|$)/g, (_, protocol, port, slash) => {
706
- return `${protocol}#PORT-${port}#${slash}`;
707
- });
708
- let processedGroupDelimiters = processedPattern.replace(/\{([^{}]*)\}([?+*]?)/g, (_, content, modifier) => {
709
- if (modifier === "?") {
710
- return content;
711
- }
712
- return content;
713
- });
714
- let filled = processedGroupDelimiters.replace(/(\/?):([a-zA-Z0-9_]+)(\([^)]*\))?([?+*]?)/g, (_, slash, name, __, modifier) => {
715
- const value = values[name];
716
- if (value === null) {
717
- return "";
718
- }
719
- if (modifier === "?") {
720
- return value !== undefined ? `${slash}${value}` : "";
721
- }
722
- if (modifier === "+" || modifier === "*") {
723
- if (value === undefined && modifier === "+") {
724
- throw new Error(`Missing value for "${name}" (one or more required)`);
725
- }
726
- return value ? `${slash}${value}` : "";
727
- }
728
- if (value === undefined) {
729
- throw new Error(`Missing value for "${name}"`);
730
- }
731
- return `${slash}${value}`;
732
- });
733
- filled = filled.replace(/#PORT-(\d+)#/g, ":$1");
734
- return new URL(filled, origin);
735
- }
736
- function aggregateGroups(match) {
737
- return {
738
- ...match.hash.groups,
739
- ...match.hostname.groups,
740
- ...match.password.groups,
741
- ...match.pathname.groups,
742
- ...match.port.groups,
743
- ...match.protocol.groups,
744
- ...match.search.groups,
745
- ...match.username.groups
746
- };
747
- }
748
- var customServerStrategies = new Map;
749
- var customClientStrategies = new Map;
750
- function isCustomStrategy(strategy2) {
751
- return typeof strategy2 === "string" && /^custom-[A-Za-z0-9_-]+$/.test(strategy2);
752
- }
753
-
754
- // ../../src/components/ui/loading.tsx
755
317
  import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
756
318
  var labels = {
757
319
  en: {
@@ -761,10 +323,12 @@ var labels = {
761
323
  loading: "Chargement..."
762
324
  }
763
325
  };
764
- var loadingLabel = () => getLocale().startsWith("fr") ? labels.fr.loading : labels.en.loading;
326
+ var loadingLabel = (locale, messages) => messages?.[locale]?.loading ?? messages?.[locale.split("-")[0] ?? locale]?.loading ?? (locale.startsWith("fr") ? labels.fr.loading : labels.en.loading);
765
327
  function Loading({
766
328
  className,
767
329
  label,
330
+ locale = "en",
331
+ messages,
768
332
  variant = "inline"
769
333
  }) {
770
334
  return /* @__PURE__ */ jsxs2("div", {
@@ -773,7 +337,7 @@ function Loading({
773
337
  /* @__PURE__ */ jsx6(Loader2, {
774
338
  className: "size-4 animate-spin"
775
339
  }),
776
- label ?? loadingLabel()
340
+ label ?? loadingLabel(locale, messages)
777
341
  ]
778
342
  });
779
343
  }
@@ -1112,12 +676,14 @@ var messages = {
1112
676
  goToLastPage: "Aller à la dernière page"
1113
677
  }
1114
678
  };
1115
- var paginationMessages = (locale = getLocale(), overrides) => ({
679
+ var paginationMessages = (locale = "en", translations) => ({
1116
680
  ...locale.startsWith("fr") ? messages.fr : messages.en,
1117
- ...overrides
681
+ ...translations?.[locale.split("-")[0] ?? locale],
682
+ ...translations?.[locale]
1118
683
  });
1119
684
  function Pagination({
1120
685
  compact = false,
686
+ locale = "en",
1121
687
  messages: messageOverrides,
1122
688
  onPageChange,
1123
689
  onPageSizeChange,
@@ -1129,7 +695,7 @@ function Pagination({
1129
695
  showResults = true,
1130
696
  totalRows
1131
697
  }) {
1132
- const labels2 = paginationMessages(getLocale(), messageOverrides);
698
+ const labels2 = paginationMessages(locale, messageOverrides);
1133
699
  const pageSizeId = useId();
1134
700
  const canGoBack = page > 0;
1135
701
  const canGoForward = page + 1 < pageCount;
@@ -1475,9 +1041,10 @@ var messages2 = {
1475
1041
  selected: "Sélectionnés"
1476
1042
  }
1477
1043
  };
1478
- var dataTableMessages = (overrides) => ({
1479
- ...getLocale().startsWith("fr") ? messages2.fr : messages2.en,
1480
- ...overrides
1044
+ var dataTableMessages = (locale = "en", translations) => ({
1045
+ ...locale.startsWith("fr") ? messages2.fr : messages2.en,
1046
+ ...translations?.[locale.split("-")[0] ?? locale],
1047
+ ...translations?.[locale]
1481
1048
  });
1482
1049
  var DEFAULT_MIN_WIDTH = 96;
1483
1050
  var DEFAULT_WIDTH = 208;
@@ -1561,8 +1128,8 @@ var resolveDate = (value, type) => Option.getOrUndefined(Option.flatMap(decodeDa
1561
1128
  calendarOnly
1562
1129
  }));
1563
1130
  }));
1564
- var formatDateValue = (date, column) => DateTime.format(date.instant, {
1565
- locale: column.typeOptions?.locale ?? getLocale(),
1131
+ var formatDateValue = (date, column, locale = "en") => DateTime.format(date.instant, {
1132
+ locale: column.typeOptions?.locale ?? locale,
1566
1133
  timeZone: date.calendarOnly ? "UTC" : column.typeOptions?.timeZone ?? "UTC",
1567
1134
  dateStyle: column.typeOptions?.dateStyle ?? "medium",
1568
1135
  timeStyle: column.type === "dateTime" ? column.typeOptions?.timeStyle ?? "short" : undefined,
@@ -1577,7 +1144,7 @@ var BooleanValue = Schema.Boolean.annotate({
1577
1144
  });
1578
1145
  var decodeNumberValue = Schema.decodeUnknownOption(NumberValue);
1579
1146
  var decodeBooleanValue = Schema.decodeUnknownOption(BooleanValue);
1580
- var formatNumberValue = (value, options = {}) => {
1147
+ var formatNumberValue = (value, options = {}, defaultLocale = "en") => {
1581
1148
  const {
1582
1149
  locale,
1583
1150
  emptyLabel: _emptyLabel,
@@ -1585,17 +1152,17 @@ var formatNumberValue = (value, options = {}) => {
1585
1152
  exportFormat: _exportFormat,
1586
1153
  ...format
1587
1154
  } = options;
1588
- return new Intl.NumberFormat(locale ?? getLocale(), format).format(value);
1155
+ return new Intl.NumberFormat(locale ?? defaultLocale, format).format(value);
1589
1156
  };
1590
1157
  var booleanLabel = (value, options) => value ? options?.trueLabel : options?.falseLabel;
1591
- var getDataTableExportValue = (row, column) => {
1158
+ var getDataTableExportValue = (row, column, locale = "en") => {
1592
1159
  const value = row.values.get(column.id);
1593
1160
  const colDef = column.colDef;
1594
1161
  if (colDef.type === "number") {
1595
1162
  const number = Option.getOrUndefined(decodeNumberValue(value));
1596
1163
  if (number === undefined)
1597
1164
  return null;
1598
- return colDef.typeOptions?.exportFormat === "formatted" ? formatNumberValue(number, colDef.typeOptions) : number;
1165
+ return colDef.typeOptions?.exportFormat === "formatted" ? formatNumberValue(number, colDef.typeOptions, locale) : number;
1599
1166
  }
1600
1167
  if (colDef.type === "boolean") {
1601
1168
  const boolean = Option.getOrUndefined(decodeBooleanValue(value));
@@ -1608,9 +1175,9 @@ var getDataTableExportValue = (row, column) => {
1608
1175
  const date = resolveDate(value, colDef.type);
1609
1176
  if (!date)
1610
1177
  return null;
1611
- return colDef.typeOptions?.exportFormat === "formatted" ? formatDateValue(date, colDef) : dateIsoValue(date);
1178
+ return colDef.typeOptions?.exportFormat === "formatted" ? formatDateValue(date, colDef, locale) : dateIsoValue(date);
1612
1179
  };
1613
- var filterDataTableRows = (rows, columns, globalFilter) => {
1180
+ var filterDataTableRows = (rows, columns, globalFilter, locale = "en") => {
1614
1181
  const query = globalFilter.trim().toLocaleLowerCase();
1615
1182
  if (!query)
1616
1183
  return [...rows];
@@ -1621,10 +1188,10 @@ var filterDataTableRows = (rows, columns, globalFilter) => {
1621
1188
  let text = String(value ?? "");
1622
1189
  if (colDef.type === "date" || colDef.type === "dateTime") {
1623
1190
  const date = resolveDate(value, colDef.type);
1624
- text = date ? `${formatDateValue(date, colDef)} ${dateIsoValue(date)}` : "";
1191
+ text = date ? `${formatDateValue(date, colDef, locale)} ${dateIsoValue(date)}` : "";
1625
1192
  } else if (colDef.type === "number") {
1626
1193
  const number = Option.getOrUndefined(decodeNumberValue(value));
1627
- text = number === undefined ? "" : `${formatNumberValue(number, colDef.typeOptions)} ${number}`;
1194
+ text = number === undefined ? "" : `${formatNumberValue(number, colDef.typeOptions, locale)} ${number}`;
1628
1195
  } else if (colDef.type === "boolean") {
1629
1196
  const boolean = Option.getOrUndefined(decodeBooleanValue(value));
1630
1197
  text = boolean === undefined ? "" : `${booleanLabel(boolean, colDef.typeOptions) ?? ""} ${boolean}`;
@@ -1744,7 +1311,8 @@ var resolveConfig = (props, onUiStateChange) => {
1744
1311
  status: props.status ?? {},
1745
1312
  features,
1746
1313
  onRowClicked: props.onRowClicked,
1747
- labels: dataTableMessages(props.messages)
1314
+ labels: dataTableMessages(props.locale, props.messages),
1315
+ locale: props.locale ?? "en"
1748
1316
  };
1749
1317
  };
1750
1318
  var queryFromState = (state) => ({
@@ -1776,7 +1344,7 @@ var buildDataTableModel = (store) => {
1776
1344
  const rows = buildDataTableRows(store.rowData, columns, rowId);
1777
1345
  const pagination = store.config.features.pagination ?? { mode: "client" };
1778
1346
  const server = pagination !== false && pagination.mode === "server";
1779
- const filteredRows = server ? [...rows] : filterDataTableRows(rows, columns, store.state.globalFilter ?? "");
1347
+ const filteredRows = server ? [...rows] : filterDataTableRows(rows, columns, store.state.globalFilter ?? "", store.config.locale);
1780
1348
  const sortedRows = server ? filteredRows : sortDataTableRows(filteredRows, columns, store.state.sort ?? []);
1781
1349
  const pageRows = pagination === false || server ? sortedRows : paginateDataTableRows(sortedRows, store.state);
1782
1350
  const totalRows = server ? pagination.rowCount : sortedRows.length;
@@ -1854,7 +1422,7 @@ var canMoveRowsToGroups = (store) => getActiveGrouping(store).some((field) => !!
1854
1422
  var canDragRows = (store) => getActiveGrouping(store).length ? canMoveRowsToGroups(store) : canReorderRows(store);
1855
1423
  var hasRowActionMenu = (store) => !!store.config.features.rowActions || canReorderRows(store);
1856
1424
  var getSelectedRows = (store, model) => model.rows.filter((row) => store.state.rowSelection[row.id]).map((row) => row.data);
1857
- var renderCell = (row, column) => {
1425
+ var renderCell = (row, column, locale = "en", labels2 = dataTableMessages(locale)) => {
1858
1426
  const value = row.values.get(column.id);
1859
1427
  const params = {
1860
1428
  data: row.data,
@@ -1875,7 +1443,7 @@ var renderCell = (row, column) => {
1875
1443
  const number = Option.getOrUndefined(decodeNumberValue(value));
1876
1444
  return /* @__PURE__ */ jsx14("span", {
1877
1445
  className: "block text-left tabular-nums",
1878
- children: number === undefined ? colDef.typeOptions?.emptyLabel ?? "—" : formatNumberValue(number, colDef.typeOptions)
1446
+ children: number === undefined ? colDef.typeOptions?.emptyLabel ?? "—" : formatNumberValue(number, colDef.typeOptions, locale)
1879
1447
  });
1880
1448
  }
1881
1449
  if (colDef.type === "boolean") {
@@ -1906,7 +1474,7 @@ var renderCell = (row, column) => {
1906
1474
  const date = resolveDate(value, colDef.type);
1907
1475
  return date ? /* @__PURE__ */ jsx14("time", {
1908
1476
  dateTime: dateIsoValue(date),
1909
- children: formatDateValue(date, colDef)
1477
+ children: formatDateValue(date, colDef, locale)
1910
1478
  }) : colDef.typeOptions?.emptyLabel ?? "—";
1911
1479
  }
1912
1480
  if (colDef.type === "list") {
@@ -1922,6 +1490,8 @@ var renderCell = (row, column) => {
1922
1490
  ...config,
1923
1491
  itemActions,
1924
1492
  items: config.getItems(row.data),
1493
+ locale,
1494
+ messages: { [locale]: labels2 },
1925
1495
  options: config.getOptions(row.data),
1926
1496
  totalCount: config.getTotalCount?.(row.data),
1927
1497
  onAdd: config.onAdd ? (value2) => config.onAdd?.({ value: value2, row: row.data }) : undefined,
@@ -1932,6 +1502,8 @@ var renderCell = (row, column) => {
1932
1502
  ...config,
1933
1503
  itemActions,
1934
1504
  items: config.getItems(row.data),
1505
+ locale,
1506
+ messages: { [locale]: labels2 },
1935
1507
  totalCount: config.getTotalCount?.(row.data)
1936
1508
  });
1937
1509
  }
@@ -2227,7 +1799,7 @@ var DataTableToolbar = ({
2227
1799
  }),
2228
1800
  /* @__PURE__ */ jsx14(MenubarSeparator, {}),
2229
1801
  /* @__PURE__ */ jsxs8(MenubarItem, {
2230
- onClick: () => downloadCsv(model.visibleColumns.map(columnLabel), exportRows.map((row) => model.visibleColumns.map((column) => String(getDataTableExportValue(row, column) ?? ""))), features.export ? features.export.baseName : "table"),
1802
+ onClick: () => downloadCsv(model.visibleColumns.map(columnLabel), exportRows.map((row) => model.visibleColumns.map((column) => String(getDataTableExportValue(row, column, store.config.locale) ?? ""))), features.export ? features.export.baseName : "table"),
2231
1803
  children: [
2232
1804
  /* @__PURE__ */ jsx14(FileText, {}),
2233
1805
  labels2.exportCsv
@@ -2236,7 +1808,7 @@ var DataTableToolbar = ({
2236
1808
  /* @__PURE__ */ jsxs8(MenubarItem, {
2237
1809
  onClick: () => downloadJson(exportRows.map((row) => Object.fromEntries(model.visibleColumns.map((column) => [
2238
1810
  column.id,
2239
- getDataTableExportValue(row, column)
1811
+ getDataTableExportValue(row, column, store.config.locale)
2240
1812
  ]))), features.export ? features.export.baseName : "table"),
2241
1813
  children: [
2242
1814
  /* @__PURE__ */ jsx14(FileJson, {}),
@@ -2671,7 +2243,7 @@ var TableDataRow = ({
2671
2243
  style: { width: column.width },
2672
2244
  children: /* @__PURE__ */ jsx14("div", {
2673
2245
  className: cn("min-w-0", column.colDef.truncate && "truncate"),
2674
- children: renderCell(row, column)
2246
+ children: renderCell(row, column, store.config.locale, store.config.labels)
2675
2247
  })
2676
2248
  }, column.id)),
2677
2249
  hasRowActionMenu(store) ? /* @__PURE__ */ jsx14(TableCell, {
@@ -3050,17 +2622,17 @@ var GalleryCard = ({
3050
2622
  variant: "secondary",
3051
2623
  children: [
3052
2624
  gallery.tagIcon,
3053
- renderCell(row, tag)
2625
+ renderCell(row, tag, store.config.locale, store.config.labels)
3054
2626
  ]
3055
2627
  }) : null
3056
2628
  ]
3057
2629
  }),
3058
2630
  /* @__PURE__ */ jsx14(CardTitle, {
3059
- children: name ? renderCell(row, name) : row.id
2631
+ children: name ? renderCell(row, name, store.config.locale, store.config.labels) : row.id
3060
2632
  }),
3061
2633
  description ? /* @__PURE__ */ jsx14("div", {
3062
2634
  className: "text-muted-foreground line-clamp-3 text-sm",
3063
- children: renderCell(row, description)
2635
+ children: renderCell(row, description, store.config.locale, store.config.labels)
3064
2636
  }) : null,
3065
2637
  hasRowActionMenu(store) ? /* @__PURE__ */ jsx14("div", {
3066
2638
  className: "absolute top-4 right-4",
@@ -3201,7 +2773,8 @@ var DataTablePagination = ({
3201
2773
  return /* @__PURE__ */ jsx14("div", {
3202
2774
  className: "pt-4",
3203
2775
  children: /* @__PURE__ */ jsx14(Pagination, {
3204
- messages: store.config.labels,
2776
+ locale: store.config.locale,
2777
+ messages: { [store.config.locale]: store.config.labels },
3205
2778
  onPageChange: (page) => setPagination({ page, pageSize: store.state.pageSize }),
3206
2779
  onPageSizeChange: (pageSize) => setPagination({ page: 0, pageSize }),
3207
2780
  page: Math.min(store.state.page, model.pageCount - 1),
@@ -3260,7 +2833,8 @@ var HydratedDataTable = ({
3260
2833
  status: props.status ?? {},
3261
2834
  features,
3262
2835
  onRowClicked: props.onRowClicked,
3263
- labels: dataTableMessages(props.messages)
2836
+ labels: dataTableMessages(props.locale, props.messages),
2837
+ locale: props.locale ?? "en"
3264
2838
  };
3265
2839
  const state = { ...store.state, ...uiState, ...props.state };
3266
2840
  const modelChanged = store.rowData !== props.rowData || store.columnDefs !== props.columnDefs || !sameDataTableState(store.state, state) || store.config.getRowId !== config.getRowId || store.config.features.pagination !== config.features.pagination;
@@ -3278,6 +2852,7 @@ var HydratedDataTable = ({
3278
2852
  props.columnDefs,
3279
2853
  props.features,
3280
2854
  props.getRowId,
2855
+ props.locale,
3281
2856
  props.messages,
3282
2857
  props.onRowClicked,
3283
2858
  props.onStateChange,
@@ -3371,6 +2946,7 @@ var DataTableListCell = (props) => {
3371
2946
  });
3372
2947
  }
3373
2948
  const { actionsLabel, itemActions, ...summaryProps } = props;
2949
+ const labels2 = dataTableMessages(props.locale, props.messages);
3374
2950
  const totalCount = props.totalCount ?? props.items.length;
3375
2951
  const overflow = totalCount > Math.min(props.items.length, props.visibleCount ?? 3);
3376
2952
  if (!itemActions?.length && !overflow) {
@@ -3378,7 +2954,7 @@ var DataTableListCell = (props) => {
3378
2954
  ...summaryProps
3379
2955
  });
3380
2956
  }
3381
- const menuLabel = actionsLabel ?? (itemActions?.length ? dataTableMessages().actions : dataTableMessages().listDetails);
2957
+ const menuLabel = actionsLabel ?? (itemActions?.length ? labels2.actions : labels2.listDetails);
3382
2958
  return /* @__PURE__ */ jsx14("div", {
3383
2959
  className: "grid min-h-16 in-[[data-slot=table-cell]]:absolute in-[[data-slot=table-cell]]:inset-0 in-[[data-slot=table-cell]]:min-h-0",
3384
2960
  "data-slot": "data-table-list-cell",
@@ -3390,6 +2966,8 @@ var DataTableListCell = (props) => {
3390
2966
  force: overflow,
3391
2967
  label: menuLabel,
3392
2968
  items: props.items,
2969
+ locale: props.locale,
2970
+ messages: props.messages,
3393
2971
  trigger: /* @__PURE__ */ jsxs8(Button, {
3394
2972
  "aria-label": menuLabel,
3395
2973
  className: "h-full w-full min-w-0 justify-between rounded-none px-2 focus-visible:ring-inset",
@@ -3416,7 +2994,9 @@ var EditableDataTableListCell = ({
3416
2994
  visibleCount,
3417
2995
  totalCount,
3418
2996
  actionsLabel,
3419
- itemActions
2997
+ itemActions,
2998
+ locale = "en",
2999
+ messages: messages3
3420
3000
  }) => {
3421
3001
  const [selected, setSelected] = useState([...items]);
3422
3002
  useLayoutEffect(() => setSelected([...items]), [items]);
@@ -3424,7 +3004,7 @@ var EditableDataTableListCell = ({
3424
3004
  const available = options.filter((item) => !selectedValues.has(item.value));
3425
3005
  const canAdd = !!onAdd && available.length > 0;
3426
3006
  const selectedTotal = totalCount === undefined ? selected.length : totalCount + selected.length - items.length;
3427
- const labels2 = dataTableMessages();
3007
+ const labels2 = dataTableMessages(locale, messages3);
3428
3008
  const actions = [
3429
3009
  ...itemActions ?? [],
3430
3010
  ...onRemove ? [
@@ -3458,6 +3038,8 @@ var EditableDataTableListCell = ({
3458
3038
  force: true,
3459
3039
  items: selected,
3460
3040
  label: actionsLabel ?? manageLabel,
3041
+ locale,
3042
+ messages: messages3,
3461
3043
  onAdd: canAdd ? (item) => {
3462
3044
  onAdd(item.value);
3463
3045
  setSelected((current) => [...current, item]);
@@ -3492,6 +3074,8 @@ var DataTableListMenu = ({
3492
3074
  force = false,
3493
3075
  items,
3494
3076
  label,
3077
+ locale = "en",
3078
+ messages: messages3,
3495
3079
  onAdd,
3496
3080
  trigger
3497
3081
  }) => {
@@ -3503,7 +3087,8 @@ var DataTableListMenu = ({
3503
3087
  const hasActions = entries.some(({ visibleActions }) => visibleActions.length);
3504
3088
  if (!force && !hasActions && !onAdd)
3505
3089
  return null;
3506
- const resolvedLabel = label ?? (hasActions ? dataTableMessages().actions : dataTableMessages().listDetails);
3090
+ const labels2 = dataTableMessages(locale, messages3);
3091
+ const resolvedLabel = label ?? (hasActions ? labels2.actions : labels2.listDetails);
3507
3092
  return /* @__PURE__ */ jsxs8(DropdownMenu, {
3508
3093
  children: [
3509
3094
  /* @__PURE__ */ jsx14(DropdownMenuTrigger, {
@@ -3565,10 +3150,12 @@ var DataTableListMenu = ({
3565
3150
  entries.length ? /* @__PURE__ */ jsx14(DropdownMenuSeparator, {}) : null,
3566
3151
  /* @__PURE__ */ jsx14(DataTableListAddMenu, {
3567
3152
  emptyLabel: addEmptyLabel,
3568
- label: addLabel ?? dataTableMessages().addItem,
3153
+ label: addLabel ?? labels2.addItem,
3154
+ locale,
3155
+ messages: messages3,
3569
3156
  onAdd,
3570
3157
  options: addOptions,
3571
- searchLabel: addSearchLabel ?? dataTableMessages().filter,
3158
+ searchLabel: addSearchLabel ?? labels2.filter,
3572
3159
  display
3573
3160
  })
3574
3161
  ]
@@ -3583,6 +3170,8 @@ var DataTableListAddMenu = ({
3583
3170
  emptyLabel,
3584
3171
  display,
3585
3172
  label,
3173
+ locale = "en",
3174
+ messages: messages3,
3586
3175
  onAdd,
3587
3176
  options,
3588
3177
  searchLabel
@@ -3591,7 +3180,7 @@ var DataTableListAddMenu = ({
3591
3180
  const focusSearch = useCallback((input) => {
3592
3181
  input?.focus({ preventScroll: true });
3593
3182
  }, []);
3594
- const locale = getLocale();
3183
+ const labels2 = dataTableMessages(locale, messages3);
3595
3184
  const normalizedSearch = search.trim().toLocaleLowerCase(locale);
3596
3185
  const filtered = normalizedSearch ? options.filter((item) => item.label.toLocaleLowerCase(locale).includes(normalizedSearch)) : options;
3597
3186
  return /* @__PURE__ */ jsxs8(DropdownMenuSub, {
@@ -3623,7 +3212,7 @@ var DataTableListAddMenu = ({
3623
3212
  if (event.key !== "Escape")
3624
3213
  event.stopPropagation();
3625
3214
  },
3626
- placeholder: dataTableMessages().filter,
3215
+ placeholder: labels2.filter,
3627
3216
  ref: focusSearch,
3628
3217
  value: search
3629
3218
  })
@@ -3649,6 +3238,8 @@ var DataTableListAddMenu = ({
3649
3238
  var DataTableListSummaryContent = ({
3650
3239
  emptyLabel,
3651
3240
  items,
3241
+ locale,
3242
+ messages: messages3,
3652
3243
  totalCount = items.length,
3653
3244
  display = "list",
3654
3245
  showMenu,
@@ -3682,7 +3273,9 @@ var DataTableListSummaryContent = ({
3682
3273
  actions: [],
3683
3274
  display,
3684
3275
  force: true,
3685
- items: normalized
3276
+ items: normalized,
3277
+ locale,
3278
+ messages: messages3
3686
3279
  }) : null
3687
3280
  ]
3688
3281
  })
@@ -3702,7 +3295,9 @@ var DataTableListSummaryContent = ({
3702
3295
  actions: [],
3703
3296
  display,
3704
3297
  force: true,
3705
- items: normalized
3298
+ items: normalized,
3299
+ locale,
3300
+ messages: messages3
3706
3301
  }) : null
3707
3302
  ]
3708
3303
  });