@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
@@ -17,8 +17,10 @@ export type ErrorComponentMessages = {
17
17
  versionLabel: string;
18
18
  referenceLabel: string;
19
19
  };
20
+ export type ErrorComponentMessageTranslations = Partial<Record<string, Partial<ErrorComponentMessages>>>;
20
21
  export type ErrorComponentProps = RouterErrorComponentProps & {
21
- messages?: Partial<ErrorComponentMessages>;
22
+ locale?: string;
23
+ messages?: ErrorComponentMessageTranslations;
22
24
  retryable?: boolean;
23
25
  className?: string;
24
26
  diagnostics?: {
@@ -27,4 +29,4 @@ export type ErrorComponentProps = RouterErrorComponentProps & {
27
29
  reference?: string;
28
30
  };
29
31
  };
30
- export declare const ErrorComponent: ({ error, messages, retryable, className, diagnostics, }: ErrorComponentProps) => import("react").JSX.Element;
32
+ export declare const ErrorComponent: ({ error, locale: localeOverride, messages, retryable, className, diagnostics, }: ErrorComponentProps) => import("react").JSX.Element;
@@ -59,12 +59,23 @@ function Button({
59
59
  // ../../src/components/ui/copy-button.tsx
60
60
  import { Check, Copy, TriangleAlert } from "lucide-react";
61
61
  import { useEffect, useRef, useState } from "react";
62
+ import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider";
62
63
  import { jsx as jsx2, jsxs } from "react/jsx-runtime";
64
+ var messages = {
65
+ en: { copy: "Copy", copied: "Copied", copyFailed: "Copy failed" },
66
+ fr: { copy: "Copier", copied: "Copié", copyFailed: "Échec de la copie" }
67
+ };
68
+ var copyButtonMessages = (locale = "en", translations) => ({
69
+ ...locale.startsWith("fr") ? messages.fr : messages.en,
70
+ ...translations?.[locale.split("-")[0] ?? locale],
71
+ ...translations?.[locale]
72
+ });
63
73
  function CopyButton({
64
74
  value,
65
75
  valueDescription,
66
76
  copyVariant = "default",
67
- messages,
77
+ locale: localeOverride,
78
+ messages: messages2,
68
79
  onCopied,
69
80
  onCopyError,
70
81
  resetDelay = 1500,
@@ -73,13 +84,10 @@ function CopyButton({
73
84
  "aria-label": ariaLabel,
74
85
  ...props
75
86
  }) {
87
+ const locale = useKrakstackLocale(localeOverride);
76
88
  const [copyState, setCopyState] = useState("idle");
77
89
  const copyTimeout = useRef(undefined);
78
- const labels = {
79
- copy: messages?.copy ?? "Copy",
80
- copied: messages?.copied ?? "Copied",
81
- copyFailed: messages?.copyFailed ?? "Copy failed"
82
- };
90
+ const labels = copyButtonMessages(locale, messages2);
83
91
  const accessibleLabel = ariaLabel ?? (valueDescription ? `${labels.copy} ${valueDescription}` : labels.copy);
84
92
  const isLarge = copyVariant === "large";
85
93
  const defaultSize = copyVariant === "sm" ? "icon-xs" : isLarge ? "sm" : "icon-sm";
@@ -101,7 +109,7 @@ function CopyButton({
101
109
  onCopied?.();
102
110
  } catch (error) {
103
111
  setCopyState("failed");
104
- onCopyError?.(error instanceof Error ? error : new Error("Copy failed", { cause: error }));
112
+ onCopyError?.(error instanceof Error ? error : new Error(labels.copyFailed, { cause: error }));
105
113
  }
106
114
  resetCopyState();
107
115
  };
@@ -207,443 +215,8 @@ function EmptyContent({ className, ...props }) {
207
215
  });
208
216
  }
209
217
 
210
- // ../../src/paraglide/runtime.js
211
- import"@inlang/paraglide-js/urlpattern-polyfill";
212
- var baseLocale = "en";
213
- var locales = ["en", "fr"];
214
- var cookieName = "locale";
215
- var cookieMaxAge = 34560000;
216
- var cookieDomain = "";
217
- var localStorageKey = "PARAGLIDE_LOCALE";
218
- var strategy = [
219
- "url",
220
- "cookie",
221
- "preferredLanguage",
222
- "baseLocale"
223
- ];
224
- var routeStrategies = [
225
- {
226
- match: "/api/:path(.*)?",
227
- exclude: true
228
- },
229
- {
230
- match: "/sitemap.xml",
231
- exclude: true
232
- },
233
- {
234
- match: "/llms.txt",
235
- exclude: true
236
- }
237
- ];
238
- var urlPatterns = [
239
- {
240
- pattern: "/:path(.*)?",
241
- localized: [
242
- [
243
- "en",
244
- "/en/:path(.*)?"
245
- ],
246
- [
247
- "fr",
248
- "/fr/:path(.*)?"
249
- ]
250
- ]
251
- }
252
- ];
253
- var cachedRouteStrategyUrl;
254
- var cachedRouteStrategy;
255
- function findMatchingRouteStrategy(url) {
256
- if (routeStrategies.length === 0) {
257
- return;
258
- }
259
- const urlString = typeof url === "string" ? url : url.href;
260
- if (cachedRouteStrategyUrl === urlString) {
261
- return cachedRouteStrategy;
262
- }
263
- const urlObject = new URL(urlString, "http://dummy.com");
264
- let match;
265
- for (const routeStrategy of routeStrategies) {
266
- const pattern = new URLPattern(routeStrategy.match, urlObject.href);
267
- if (pattern.exec(urlObject.href)) {
268
- match = routeStrategy;
269
- break;
270
- }
271
- }
272
- cachedRouteStrategyUrl = urlString;
273
- cachedRouteStrategy = match;
274
- return match;
275
- }
276
- function getStrategyForUrl(url) {
277
- const routeStrategy = findMatchingRouteStrategy(url);
278
- if (routeStrategy && routeStrategy.exclude !== true && Array.isArray(routeStrategy.strategy)) {
279
- return routeStrategy.strategy;
280
- }
281
- return strategy;
282
- }
283
- var serverAsyncLocalStorage = undefined;
284
- var isServer = import.meta.env?.SSR ?? typeof window === "undefined";
285
- var experimentalStaticLocale = undefined;
286
- var TREE_SHAKE_COOKIE_STRATEGY_USED = true;
287
- var TREE_SHAKE_URL_STRATEGY_USED = true;
288
- var TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED = false;
289
- var TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED = true;
290
- var TREE_SHAKE_DEFAULT_URL_PATTERN_USED = false;
291
- var TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED = false;
292
- globalThis.__paraglide = globalThis.__paraglide ?? {};
293
- globalThis.__paraglide.ssr = globalThis.__paraglide.ssr ?? {};
294
- var _locale;
295
- var localeInitiallySet = false;
296
- var getLocale = () => {
297
- if (experimentalStaticLocale !== undefined) {
298
- return experimentalStaticLocale;
299
- }
300
- if (serverAsyncLocalStorage) {
301
- const locale = serverAsyncLocalStorage?.getStore()?.locale;
302
- if (locale) {
303
- return locale;
304
- }
305
- }
306
- let strategyToUse = strategy;
307
- if (!isServer && typeof window !== "undefined" && window.location?.href) {
308
- strategyToUse = getStrategyForUrl(window.location.href);
309
- }
310
- const resolved = resolveLocaleWithStrategies(strategyToUse, typeof window !== "undefined" ? window.location?.href : undefined);
311
- if (resolved) {
312
- if (!localeInitiallySet) {
313
- _locale = resolved;
314
- localeInitiallySet = true;
315
- setLocale(resolved, { reload: false });
316
- }
317
- return resolved;
318
- }
319
- throw new Error("No locale found. Read the docs https://paraglidejs.com/errors#no-locale-found");
320
- };
321
- function resolveLocaleWithStrategies(strategyToUse, urlForUrlStrategy) {
322
- let locale;
323
- for (const strat of strategyToUse) {
324
- if (TREE_SHAKE_COOKIE_STRATEGY_USED && strat === "cookie") {
325
- locale = extractLocaleFromCookie();
326
- } else if (strat === "baseLocale") {
327
- locale = baseLocale;
328
- } else if (TREE_SHAKE_URL_STRATEGY_USED && strat === "url" && !isServer && typeof urlForUrlStrategy === "string") {
329
- locale = extractLocaleFromUrl(urlForUrlStrategy);
330
- } else if (TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED && strat === "globalVariable" && _locale !== undefined) {
331
- locale = _locale;
332
- } else if (TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED && strat === "preferredLanguage" && !isServer) {
333
- locale = extractLocaleFromNavigator();
334
- } else if (TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED && strat === "localStorage" && !isServer) {
335
- locale = localStorage.getItem(localStorageKey) ?? undefined;
336
- } else if (isCustomStrategy(strat) && customClientStrategies.has(strat)) {
337
- const handler = customClientStrategies.get(strat);
338
- if (handler) {
339
- const result = handler.getLocale();
340
- if (result instanceof Promise) {
341
- continue;
342
- }
343
- if (result !== undefined) {
344
- return assertIsLocale(result);
345
- }
346
- }
347
- }
348
- const matchedLocale = toLocale(locale);
349
- if (matchedLocale) {
350
- return matchedLocale;
351
- }
352
- }
353
- return;
354
- }
355
- var rtlLanguages = new Set([
356
- "ar",
357
- "dv",
358
- "fa",
359
- "he",
360
- "ks",
361
- "ku",
362
- "ps",
363
- "sd",
364
- "ug",
365
- "ur",
366
- "yi"
367
- ]);
368
- var navigateOrReload = (newLocation) => {
369
- if (newLocation) {
370
- window.location.href = newLocation;
371
- } else {
372
- window.location.reload();
373
- }
374
- };
375
- var setLocale = (newLocale, options) => {
376
- const optionsWithDefaults = {
377
- reload: true,
378
- ...options
379
- };
380
- let currentLocale;
381
- try {
382
- currentLocale = getLocale();
383
- } catch {}
384
- const customSetLocalePromises = [];
385
- let newLocation = undefined;
386
- let strategyToUse = strategy;
387
- if (!isServer && typeof window !== "undefined" && window.location?.href) {
388
- strategyToUse = getStrategyForUrl(window.location.href);
389
- }
390
- for (const strat of strategyToUse) {
391
- if (TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED && strat === "globalVariable") {
392
- _locale = newLocale;
393
- } else if (TREE_SHAKE_COOKIE_STRATEGY_USED && strat === "cookie") {
394
- if (isServer || typeof document === "undefined" || typeof window === "undefined") {
395
- continue;
396
- }
397
- const cookieString = `${cookieName}=${newLocale}; path=/; max-age=${cookieMaxAge}`;
398
- document.cookie = cookieDomain ? `${cookieString}; domain=${cookieDomain}` : cookieString;
399
- } else if (strat === "baseLocale") {
400
- continue;
401
- } else if (TREE_SHAKE_URL_STRATEGY_USED && strat === "url" && typeof window !== "undefined") {
402
- newLocation = localizeUrl(window.location.href, {
403
- locale: newLocale
404
- }).href;
405
- } else if (TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED && strat === "localStorage" && typeof window !== "undefined") {
406
- localStorage.setItem(localStorageKey, newLocale);
407
- } else if (isCustomStrategy(strat) && customClientStrategies.has(strat)) {
408
- const handler = customClientStrategies.get(strat);
409
- if (handler) {
410
- let result = handler.setLocale(newLocale);
411
- if (result instanceof Promise) {
412
- result = result.catch((error) => {
413
- throw new Error(`Custom strategy "${strat}" setLocale failed.`, {
414
- cause: error
415
- });
416
- });
417
- customSetLocalePromises.push(result);
418
- }
419
- }
420
- }
421
- }
422
- const runReload = () => {
423
- if (!isServer && optionsWithDefaults.reload && window.location && newLocale !== currentLocale) {
424
- navigateOrReload(newLocation);
425
- }
426
- };
427
- if (customSetLocalePromises.length) {
428
- return Promise.all(customSetLocalePromises).then(() => {
429
- runReload();
430
- });
431
- }
432
- runReload();
433
- return;
434
- };
435
- var getUrlOrigin = () => {
436
- if (serverAsyncLocalStorage) {
437
- return serverAsyncLocalStorage.getStore()?.origin ?? "http://fallback.com";
438
- } else if (typeof window !== "undefined") {
439
- return window.location.origin;
440
- }
441
- return "http://fallback.com";
442
- };
443
- function toLocale(value) {
444
- if (typeof value !== "string") {
445
- return;
446
- }
447
- const lowerValue = value.toLowerCase();
448
- for (const locale of locales) {
449
- if (locale.toLowerCase() === lowerValue) {
450
- return locale;
451
- }
452
- }
453
- return;
454
- }
455
- function assertIsLocale(input) {
456
- const locale = toLocale(input);
457
- if (locale)
458
- return locale;
459
- throw new Error(`Invalid locale: ${input}. Expected one of: ${locales.join(", ")}`);
460
- }
461
- function extractLocaleFromCookie() {
462
- if (typeof document === "undefined" || !document.cookie) {
463
- return;
464
- }
465
- const match = document.cookie.match(new RegExp(`(^| )${cookieName}=([^;]+)`));
466
- const locale = match?.[2];
467
- return toLocale(locale);
468
- }
469
- function extractLocaleFromNavigator() {
470
- if (!navigator?.languages?.length) {
471
- return;
472
- }
473
- const languages = navigator.languages.map((lang) => ({
474
- fullTag: lang,
475
- baseTag: lang.split("-")[0]
476
- }));
477
- for (const lang of languages) {
478
- const fullLocale = toLocale(lang.fullTag);
479
- if (fullLocale) {
480
- return fullLocale;
481
- }
482
- const baseLocale2 = toLocale(lang.baseTag);
483
- if (baseLocale2) {
484
- return baseLocale2;
485
- }
486
- }
487
- return;
488
- }
489
- var cachedUrl;
490
- var cachedLocale;
491
- function extractLocaleFromUrl(url) {
492
- const urlString = typeof url === "string" ? url : url.href;
493
- if (cachedUrl === urlString) {
494
- return cachedLocale;
495
- }
496
- let result;
497
- if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {
498
- result = defaultUrlPatternExtractLocale(url);
499
- } else {
500
- const urlObj = typeof url === "string" ? new URL(url) : url;
501
- for (const element of urlPatterns) {
502
- for (const [locale, localizedPattern] of element.localized) {
503
- const match = new URLPattern(localizedPattern, urlObj.href).exec(urlObj.href);
504
- if (match) {
505
- result = locale;
506
- break;
507
- }
508
- }
509
- if (result)
510
- break;
511
- }
512
- }
513
- cachedUrl = urlString;
514
- cachedLocale = result;
515
- return result;
516
- }
517
- function defaultUrlPatternExtractLocale(url) {
518
- const urlObj = new URL(url, "http://dummy.com");
519
- const pathSegments = urlObj.pathname.split("/").filter(Boolean);
520
- return toLocale(pathSegments[0]) || baseLocale;
521
- }
522
- function localizeUrl(url, options) {
523
- const targetLocale = options?.locale ? assertIsLocale(options?.locale) : getLocale();
524
- if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {
525
- return localizeUrlDefaultPattern(url, targetLocale);
526
- }
527
- const urlObj = typeof url === "string" ? new URL(url) : url;
528
- for (const element of urlPatterns) {
529
- for (const [, localizedPattern] of element.localized) {
530
- const match = new URLPattern(localizedPattern, urlObj.href).exec(urlObj.href);
531
- if (!match) {
532
- continue;
533
- }
534
- const targetPattern = element.localized.find(([locale]) => locale === targetLocale)?.[1];
535
- if (!targetPattern) {
536
- continue;
537
- }
538
- const localizedUrl = fillPattern(targetPattern, aggregateGroups(match), urlObj.origin);
539
- return fillMissingUrlParts(localizedUrl, match);
540
- }
541
- const unlocalizedMatch = new URLPattern(element.pattern, urlObj.href).exec(urlObj.href);
542
- if (unlocalizedMatch) {
543
- const targetPattern = element.localized.find(([locale]) => locale === targetLocale)?.[1];
544
- if (targetPattern) {
545
- const localizedUrl = fillPattern(targetPattern, aggregateGroups(unlocalizedMatch), urlObj.origin);
546
- return fillMissingUrlParts(localizedUrl, unlocalizedMatch);
547
- }
548
- }
549
- }
550
- return urlObj;
551
- }
552
- function localizeUrlDefaultPattern(url, locale) {
553
- const urlObj = typeof url === "string" ? new URL(url, getUrlOrigin()) : new URL(url);
554
- const currentLocale = extractLocaleFromUrl(urlObj);
555
- if (currentLocale === locale) {
556
- return urlObj;
557
- }
558
- const pathSegments = urlObj.pathname.split("/").filter(Boolean);
559
- if (pathSegments.length > 0 && toLocale(pathSegments[0])) {
560
- pathSegments.shift();
561
- }
562
- if (locale === baseLocale) {
563
- urlObj.pathname = "/" + pathSegments.join("/");
564
- } else {
565
- urlObj.pathname = "/" + locale + "/" + pathSegments.join("/");
566
- }
567
- return urlObj;
568
- }
569
- function fillMissingUrlParts(url, match) {
570
- if (match.protocol.groups["0"]) {
571
- url.protocol = match.protocol.groups["0"] ?? "";
572
- }
573
- if (match.hostname.groups["0"]) {
574
- url.hostname = match.hostname.groups["0"] ?? "";
575
- }
576
- if (match.username.groups["0"]) {
577
- url.username = match.username.groups["0"] ?? "";
578
- }
579
- if (match.password.groups["0"]) {
580
- url.password = match.password.groups["0"] ?? "";
581
- }
582
- if (match.port.groups["0"]) {
583
- url.port = match.port.groups["0"] ?? "";
584
- }
585
- if (match.pathname.groups["0"]) {
586
- url.pathname = match.pathname.groups["0"] ?? "";
587
- }
588
- if (match.search.groups["0"]) {
589
- url.search = match.search.groups["0"] ?? "";
590
- }
591
- if (match.hash.groups["0"]) {
592
- url.hash = match.hash.groups["0"] ?? "";
593
- }
594
- return url;
595
- }
596
- function fillPattern(pattern, values, origin) {
597
- let processedPattern = pattern.replace(/(https?:\/\/[^:/]+):(\d+)(\/|$)/g, (_, protocol, port, slash) => {
598
- return `${protocol}#PORT-${port}#${slash}`;
599
- });
600
- let processedGroupDelimiters = processedPattern.replace(/\{([^{}]*)\}([?+*]?)/g, (_, content, modifier) => {
601
- if (modifier === "?") {
602
- return content;
603
- }
604
- return content;
605
- });
606
- let filled = processedGroupDelimiters.replace(/(\/?):([a-zA-Z0-9_]+)(\([^)]*\))?([?+*]?)/g, (_, slash, name, __, modifier) => {
607
- const value = values[name];
608
- if (value === null) {
609
- return "";
610
- }
611
- if (modifier === "?") {
612
- return value !== undefined ? `${slash}${value}` : "";
613
- }
614
- if (modifier === "+" || modifier === "*") {
615
- if (value === undefined && modifier === "+") {
616
- throw new Error(`Missing value for "${name}" (one or more required)`);
617
- }
618
- return value ? `${slash}${value}` : "";
619
- }
620
- if (value === undefined) {
621
- throw new Error(`Missing value for "${name}"`);
622
- }
623
- return `${slash}${value}`;
624
- });
625
- filled = filled.replace(/#PORT-(\d+)#/g, ":$1");
626
- return new URL(filled, origin);
627
- }
628
- function aggregateGroups(match) {
629
- return {
630
- ...match.hash.groups,
631
- ...match.hostname.groups,
632
- ...match.password.groups,
633
- ...match.pathname.groups,
634
- ...match.port.groups,
635
- ...match.protocol.groups,
636
- ...match.search.groups,
637
- ...match.username.groups
638
- };
639
- }
640
- var customServerStrategies = new Map;
641
- var customClientStrategies = new Map;
642
- function isCustomStrategy(strategy2) {
643
- return typeof strategy2 === "string" && /^custom-[A-Za-z0-9_-]+$/.test(strategy2);
644
- }
645
-
646
218
  // ../../src/components/ui/error-component.tsx
219
+ import { useKrakstackLocale as useKrakstackLocale2 } from "@krak-stack/registry/krakstack-provider";
647
220
  import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
648
221
  var TraceId = Schema.String.check(Schema.isPattern(/^(?!0+$)(?:[a-f0-9]{16}|[a-f0-9]{32})$/i)).annotate({ identifier: "ErrorTraceId" });
649
222
  var decodeTraceId = Schema.decodeUnknownOption(TraceId);
@@ -701,19 +274,21 @@ var defaultMessages = {
701
274
  };
702
275
  var ErrorComponent = ({
703
276
  error,
704
- messages,
277
+ locale: localeOverride,
278
+ messages: messages2,
705
279
  retryable = true,
706
280
  className,
707
281
  diagnostics
708
282
  }) => {
709
- const locale = getLocale();
283
+ const locale = useKrakstackLocale2(localeOverride);
710
284
  const pathname = useRouterState({
711
285
  select: (state) => state.location.pathname
712
286
  });
713
287
  const labels = useMemo(() => ({
714
288
  ...defaultMessages[locale.startsWith("fr") ? "fr" : "en"],
715
- ...messages
716
- }), [locale, messages]);
289
+ ...messages2?.[locale.split("-")[0] ?? locale],
290
+ ...messages2?.[locale]
291
+ }), [locale, messages2]);
717
292
  const reference = diagnostics?.reference ?? getErrorTraceId(error);
718
293
  const report = useMemo(() => [
719
294
  `${labels.errorLabel}: ${error.name}`,
@@ -781,11 +356,14 @@ var ErrorComponent = ({
781
356
  /* @__PURE__ */ jsx5(CopyButton, {
782
357
  value: report,
783
358
  copyVariant: "large",
359
+ locale,
784
360
  variant: "link",
785
361
  messages: {
786
- copy: labels.copy,
787
- copied: labels.copied,
788
- copyFailed: labels.copyFailed
362
+ [locale]: {
363
+ copy: labels.copy,
364
+ copied: labels.copied,
365
+ copyFailed: labels.copyFailed
366
+ }
789
367
  },
790
368
  onCopied: () => setCopyResult({ report, status: "copied" }),
791
369
  onCopyError: () => setCopyResult({ report, status: "failed" })
@@ -9,6 +9,7 @@ export type FilePickerMessages = {
9
9
  replaceFile: string;
10
10
  };
11
11
  export type FilePickerMessageOverrides = Partial<FilePickerMessages>;
12
+ export type FilePickerMessageTranslations = Partial<Record<string, FilePickerMessageOverrides>>;
12
13
  export type FilePickerProps = {
13
14
  accept?: string;
14
15
  canClear?: boolean;
@@ -22,7 +23,8 @@ export type FilePickerProps = {
22
23
  width: number;
23
24
  };
24
25
  invalid?: boolean;
25
- messages?: FilePickerMessageOverrides;
26
+ locale?: string;
27
+ messages?: FilePickerMessageTranslations;
26
28
  multiple?: boolean;
27
29
  name: string;
28
30
  onBlur?: () => void;
@@ -32,4 +34,4 @@ export type FilePickerProps = {
32
34
  required?: boolean;
33
35
  title: ReactNode;
34
36
  };
35
- export declare const FilePicker: ({ accept, canClear, file, files, id, image, invalid, messages, multiple, name, onBlur, onChange, onClear, onFilesChange, required, title, }: FilePickerProps) => import("react").JSX.Element;
37
+ export declare const FilePicker: ({ accept, canClear, file, files, id, image, invalid, locale: localeOverride, messages, multiple, name, onBlur, onChange, onClear, onFilesChange, required, title, }: FilePickerProps) => import("react").JSX.Element;