@extend-ai/react-xlsx 0.20.10 → 0.20.12

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 (50) hide show
  1. package/README.md +27 -3
  2. package/dist/{chunk-OGZ6ROZC.cjs → chunk-A3S3QKJN.cjs} +445 -3
  3. package/dist/chunk-A3S3QKJN.cjs.map +1 -0
  4. package/dist/chunk-IRC7BQ6E.js +538 -0
  5. package/dist/chunk-IRC7BQ6E.js.map +1 -0
  6. package/dist/{chunk-DWBPSBJ5.cjs → chunk-NIN5D556.cjs} +1387 -1322
  7. package/dist/chunk-NIN5D556.cjs.map +1 -0
  8. package/dist/{chunk-2QENCJUT.js → chunk-O4S5CRDM.js} +192 -127
  9. package/dist/chunk-O4S5CRDM.js.map +1 -0
  10. package/dist/{chunk-CVMHJO5H.js → chunk-WHTV6N6S.js} +443 -1
  11. package/dist/chunk-WHTV6N6S.js.map +1 -0
  12. package/dist/chunk-ZPDHTVL6.cjs +538 -0
  13. package/dist/chunk-ZPDHTVL6.cjs.map +1 -0
  14. package/dist/index.cjs +183 -154
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.cts +60 -2
  17. package/dist/index.d.ts +60 -2
  18. package/dist/index.js +52 -23
  19. package/dist/index.js.map +1 -1
  20. package/dist/{internal-BBaC9yCh.d.cts → internal-D_np3R-w.d.cts} +60 -2
  21. package/dist/{internal-BBaC9yCh.d.ts → internal-D_np3R-w.d.ts} +60 -2
  22. package/dist/internal.cjs +3 -3
  23. package/dist/internal.d.cts +1 -1
  24. package/dist/internal.d.ts +1 -1
  25. package/dist/internal.js +2 -2
  26. package/dist/{shared-chart-XOCTF7KQ.js → shared-chart-7RUN5IKZ.js} +6 -4
  27. package/dist/shared-chart-7RUN5IKZ.js.map +1 -0
  28. package/dist/{shared-chart-CIRSCWTO.cjs → shared-chart-P3KU6TQR.cjs} +15 -13
  29. package/dist/shared-chart-P3KU6TQR.cjs.map +1 -0
  30. package/dist/{shared-chart-BLOOGI7S.js → shared-chart-UTUK46E4.js} +6 -4
  31. package/dist/shared-chart-UTUK46E4.js.map +1 -0
  32. package/dist/{shared-chart-4LUQQI2B.cjs → shared-chart-VRXD57MU.cjs} +6 -4
  33. package/dist/shared-chart-VRXD57MU.cjs.map +1 -0
  34. package/dist/vanilla.cjs +3 -3
  35. package/dist/vanilla.d.cts +2 -2
  36. package/dist/vanilla.d.ts +2 -2
  37. package/dist/vanilla.js +2 -2
  38. package/package.json +1 -1
  39. package/dist/chunk-2QENCJUT.js.map +0 -1
  40. package/dist/chunk-7GBCRNGO.js +0 -94
  41. package/dist/chunk-7GBCRNGO.js.map +0 -1
  42. package/dist/chunk-CVMHJO5H.js.map +0 -1
  43. package/dist/chunk-DWBPSBJ5.cjs.map +0 -1
  44. package/dist/chunk-MFOGLSFJ.cjs +0 -94
  45. package/dist/chunk-MFOGLSFJ.cjs.map +0 -1
  46. package/dist/chunk-OGZ6ROZC.cjs.map +0 -1
  47. package/dist/shared-chart-4LUQQI2B.cjs.map +0 -1
  48. package/dist/shared-chart-BLOOGI7S.js.map +0 -1
  49. package/dist/shared-chart-CIRSCWTO.cjs.map +0 -1
  50. package/dist/shared-chart-XOCTF7KQ.js.map +0 -1
@@ -7,20 +7,25 @@ import {
7
7
  S,
8
8
  T,
9
9
  X,
10
+ XlsxMessagesContext,
10
11
  _,
11
12
  bn,
12
13
  d,
14
+ formatMessage,
13
15
  h,
14
16
  k,
15
17
  loadOfficeFonts,
18
+ mergeMessages,
16
19
  nn,
17
20
  pn,
18
21
  q,
22
+ resolveMessages,
19
23
  u,
24
+ useXlsxMessages,
20
25
  w,
21
26
  x,
22
27
  y
23
- } from "./chunk-CVMHJO5H.js";
28
+ } from "./chunk-WHTV6N6S.js";
24
29
 
25
30
  // src/range-reference.ts
26
31
  var XLSX_MAX_ROWS = 1048576;
@@ -9590,6 +9595,7 @@ function useXlsxViewerController(options) {
9590
9595
  file,
9591
9596
  fileName,
9592
9597
  locale = "en-US",
9598
+ messages: messageOverrides,
9593
9599
  maxFileSizeBytes = DEFAULT_MAX_FILE_SIZE_BYTES,
9594
9600
  readOnly: requestedReadOnly = false,
9595
9601
  readOnlyAboveBytes = 0,
@@ -9598,6 +9604,7 @@ function useXlsxViewerController(options) {
9598
9604
  src,
9599
9605
  useWorker = true
9600
9606
  } = options;
9607
+ const messages = T(() => resolveMessages(locale, messageOverrides), [locale, messageOverrides]);
9601
9608
  const [isLoading, setIsLoading] = d(Boolean(file ?? src));
9602
9609
  const [error, setError] = d(null);
9603
9610
  const [workbook, setWorkbook] = d(null);
@@ -10855,9 +10862,10 @@ function useXlsxViewerController(options) {
10855
10862
  activeCell,
10856
10863
  activeSheetIndex,
10857
10864
  bytes: createSavedWorkbookBytes(workbook),
10858
- selection
10865
+ selection,
10866
+ sortState
10859
10867
  };
10860
- }, [activeCell, activeSheetIndex, createSavedWorkbookBytes, selection, workbook]);
10868
+ }, [activeCell, activeSheetIndex, createSavedWorkbookBytes, selection, sortState, workbook]);
10861
10869
  const captureCellMutationState = q((cell) => {
10862
10870
  const worksheet = getActiveWorksheet();
10863
10871
  if (!worksheet) {
@@ -10897,6 +10905,7 @@ function useXlsxViewerController(options) {
10897
10905
  }
10898
10906
  setActiveCell(entry.activeCell);
10899
10907
  setSelection(entry.selection);
10908
+ setSortState(entry.sortState);
10900
10909
  selectionAnchorRef.current = entry.selection ? normalizeRange(entry.selection).start : entry.activeCell;
10901
10910
  setRevision((current) => current + 1);
10902
10911
  }, [setChartAssets, setImageAssets]);
@@ -10931,6 +10940,7 @@ function useXlsxViewerController(options) {
10931
10940
  for (const mutation of entry.mutations) {
10932
10941
  applyCellMutationState(worksheet, mutation.cell, direction === "undo" ? mutation.before : mutation.after);
10933
10942
  }
10943
+ setSortState(direction === "undo" ? entry.sortStateBefore : entry.sortStateAfter);
10934
10944
  maybeRecalculateWorkbook(workbook);
10935
10945
  refreshWorkbookState(workbook);
10936
10946
  const nextActiveCell = direction === "undo" ? entry.activeCellBefore : entry.activeCellAfter;
@@ -11068,8 +11078,8 @@ function useXlsxViewerController(options) {
11068
11078
  redoStackRef.current = [];
11069
11079
  setHistoryRevision((current) => current + 1);
11070
11080
  }, [activeCell, activeSheet, selection]);
11071
- const recordRangeEditHistory = q((mutations, selectionAfter, activeCellAfter) => {
11072
- if (!activeSheet || isApplyingHistoryRef.current || mutations.length === 0) {
11081
+ const recordRangeEditHistory = q((mutations, selectionAfter, activeCellAfter, sortStateAfter = sortState) => {
11082
+ if (!activeSheet || isApplyingHistoryRef.current || mutations.length === 0 && sortStateAfter === sortState) {
11073
11083
  return;
11074
11084
  }
11075
11085
  pushHistoryEntry(undoStackRef.current, {
@@ -11079,11 +11089,13 @@ function useXlsxViewerController(options) {
11079
11089
  mutations,
11080
11090
  selectionAfter,
11081
11091
  selectionBefore: selection,
11082
- sheetIndex: activeSheet.workbookSheetIndex
11092
+ sheetIndex: activeSheet.workbookSheetIndex,
11093
+ sortStateAfter,
11094
+ sortStateBefore: sortState
11083
11095
  });
11084
11096
  redoStackRef.current = [];
11085
11097
  setHistoryRevision((current) => current + 1);
11086
- }, [activeCell, activeSheet, selection]);
11098
+ }, [activeCell, activeSheet, selection, sortState]);
11087
11099
  const sortTable = q((tableName, columnIndex, direction) => {
11088
11100
  const worksheet = getActiveWorksheet();
11089
11101
  const targetTable = tables.find((table) => table.name === tableName || table.displayName === tableName);
@@ -11135,8 +11147,13 @@ function useXlsxViewerController(options) {
11135
11147
  const comparedText = left.sortText.localeCompare(right.sortText, void 0, { numeric: true, sensitivity: "base" });
11136
11148
  return direction === "ascending" ? comparedText : -comparedText;
11137
11149
  });
11150
+ const nextSortState = { columnIndex, direction, tableName: targetTable.name };
11138
11151
  if (sortedRows.every((row, index) => row.index === rows[index]?.index)) {
11139
- setSortState({ columnIndex, direction, tableName: targetTable.name });
11152
+ if (sortState?.tableName === targetTable.name && sortState.columnIndex === columnIndex && sortState.direction === direction) {
11153
+ return;
11154
+ }
11155
+ setSortState(nextSortState);
11156
+ recordRangeEditHistory([], selection, activeCell, nextSortState);
11140
11157
  return;
11141
11158
  }
11142
11159
  const mutations = [];
@@ -11164,8 +11181,8 @@ function useXlsxViewerController(options) {
11164
11181
  }
11165
11182
  maybeRecalculateWorkbook(workbook);
11166
11183
  refreshWorkbookState(workbook);
11167
- setSortState({ columnIndex, direction, tableName: targetTable.name });
11168
- recordRangeEditHistory(mutations, selection, activeCell);
11184
+ setSortState(nextSortState);
11185
+ recordRangeEditHistory(mutations, selection, activeCell, nextSortState);
11169
11186
  }, [
11170
11187
  activeCell,
11171
11188
  activeSheet,
@@ -11175,6 +11192,7 @@ function useXlsxViewerController(options) {
11175
11192
  recordRangeEditHistory,
11176
11193
  refreshWorkbookState,
11177
11194
  selection,
11195
+ sortState,
11178
11196
  tables,
11179
11197
  workbook
11180
11198
  ]);
@@ -12329,6 +12347,7 @@ function useXlsxViewerController(options) {
12329
12347
  defineNamedRange,
12330
12348
  displayFileName,
12331
12349
  locale,
12350
+ messages,
12332
12351
  download,
12333
12352
  exportCsv,
12334
12353
  exportXlsx,
@@ -12453,6 +12472,7 @@ function useXlsxViewerController(options) {
12453
12472
  defineNamedRange,
12454
12473
  displayFileName,
12455
12474
  locale,
12475
+ messages,
12456
12476
  download,
12457
12477
  error,
12458
12478
  exportCsv,
@@ -14124,6 +14144,7 @@ function CellEditor({
14124
14144
  onNavigate
14125
14145
  }) {
14126
14146
  const rootRef = A(null);
14147
+ const messages = useXlsxMessages();
14127
14148
  const mirrorRef = A(null);
14128
14149
  const textRef = A(null);
14129
14150
  const baselineRef = A(null);
@@ -14309,7 +14330,7 @@ function CellEditor({
14309
14330
  if (typeof inputRef === "function") inputRef(element);
14310
14331
  else if (inputRef) inputRef.current = element;
14311
14332
  },
14312
- "aria-label": "Edit cell",
14333
+ "aria-label": messages.editCell,
14313
14334
  autoFocus: true,
14314
14335
  autoComplete: "off",
14315
14336
  spellCheck: false,
@@ -14494,6 +14515,13 @@ function resolveViewerPalette(isDark = false, headerBackgroundColor, headerTextC
14494
14515
  }
14495
14516
 
14496
14517
  // src/context-menu.tsx
14518
+ var MenuActionError = class extends Error {
14519
+ key;
14520
+ constructor(key) {
14521
+ super(key);
14522
+ this.key = key;
14523
+ }
14524
+ };
14497
14525
  var menuStyles = `
14498
14526
  :where(.react-xlsx-context-menu) {
14499
14527
  background: var(--xlsx-context-menu-background);
@@ -14531,39 +14559,41 @@ function XlsxContextMenu({
14531
14559
  contextMenuClassName,
14532
14560
  contextMenuStyle
14533
14561
  }) {
14562
+ const { messages } = controller;
14534
14563
  const rootRef = A(null);
14535
14564
  const controllerRef = A(controller);
14536
14565
  controllerRef.current = controller;
14537
14566
  const aliveRef = A(true);
14538
14567
  const runningRef = A(false);
14539
14568
  const [busy, setBusy] = d(false);
14540
- const [error, setError] = d(null);
14569
+ const [errorKey, setErrorKey] = d(null);
14570
+ const error = errorKey ? messages[errorKey] : null;
14541
14571
  const [location, setLocation] = d(position);
14542
14572
  const modifier = typeof navigator !== "undefined" && /Mac|iPhone|iPad/.test(navigator.platform) ? "\u2318" : "Ctrl+";
14543
14573
  const table = controller.tables.find(({ start, end }) => context.cell.row >= start.row && context.cell.row <= end.row && context.cell.col >= start.col && context.cell.col <= end.col);
14544
14574
  const range = expandHighlightedRange(context.selection, controller.activeSheet?.mergedRanges ?? []);
14545
14575
  const multiple = range.start.row !== range.end.row || range.start.col !== range.end.col;
14546
14576
  const actions = [
14547
- ...!controller.readOnly ? [{ id: "cut", label: "Cut" }] : [],
14548
- { id: "copy", label: "Copy", shortcut: `${modifier}C` },
14577
+ ...!controller.readOnly ? [{ id: "cut", label: messages.cut }] : [],
14578
+ { id: "copy", label: messages.copy, shortcut: `${modifier}C` },
14549
14579
  ...!controller.readOnly ? [
14550
- { id: "paste", label: "Paste", shortcut: `${modifier}V` },
14551
- { id: "editCell", label: "Edit cell", shortcut: "F2", separatorBefore: true },
14552
- { id: "clearContents", label: "Clear contents", destructive: true },
14553
- { id: "undo", label: "Undo", shortcut: `${modifier}Z`, separatorBefore: true, disabled: !controller.canUndo },
14554
- { id: "redo", label: "Redo", shortcut: `${modifier}\u21E7Z`, disabled: !controller.canRedo },
14555
- { id: "mergeAndCenter", label: "Merge & Center", separatorBefore: true, disabled: !multiple },
14556
- { id: "mergeAcross", label: "Merge Across", disabled: range.start.col === range.end.col },
14557
- { id: "mergeCells", label: "Merge Cells", disabled: !multiple },
14558
- { id: "unmergeCells", label: "Unmerge Cells" },
14580
+ { id: "paste", label: messages.paste, shortcut: `${modifier}V` },
14581
+ { id: "editCell", label: messages.editCell, shortcut: "F2", separatorBefore: true },
14582
+ { id: "clearContents", label: messages.clearContents, destructive: true },
14583
+ { id: "undo", label: messages.undo, shortcut: `${modifier}Z`, separatorBefore: true, disabled: !controller.canUndo },
14584
+ { id: "redo", label: messages.redo, shortcut: `${modifier}\u21E7Z`, disabled: !controller.canRedo },
14585
+ { id: "mergeAndCenter", label: messages.mergeAndCenter, separatorBefore: true, disabled: !multiple },
14586
+ { id: "mergeAcross", label: messages.mergeAcross, disabled: range.start.col === range.end.col },
14587
+ { id: "mergeCells", label: messages.mergeCells, disabled: !multiple },
14588
+ { id: "unmergeCells", label: messages.unmergeCells },
14559
14589
  ...table ? [
14560
- { id: "sortAscending", label: "Sort A to Z", separatorBefore: true },
14561
- { id: "sortDescending", label: "Sort Z to A" }
14590
+ { id: "sortAscending", label: messages.sortAscending, separatorBefore: true },
14591
+ { id: "sortDescending", label: messages.sortDescending }
14562
14592
  ] : []
14563
14593
  ] : [],
14564
- { id: "selectRow", label: "Select row", separatorBefore: true },
14565
- { id: "selectColumn", label: "Select column" },
14566
- { id: "selectAll", label: "Select all", shortcut: `${modifier}A` }
14594
+ { id: "selectRow", label: messages.selectRow, separatorBefore: true },
14595
+ { id: "selectColumn", label: messages.selectColumn },
14596
+ { id: "selectAll", label: messages.selectAll, shortcut: `${modifier}A` }
14567
14597
  ];
14568
14598
  _(() => {
14569
14599
  const root = rootRef.current;
@@ -14609,20 +14639,20 @@ function XlsxContextMenu({
14609
14639
  if (!isCurrent()) return false;
14610
14640
  runningRef.current = true;
14611
14641
  setBusy(true);
14612
- setError(null);
14642
+ setErrorKey(null);
14613
14643
  try {
14614
14644
  switch (id) {
14615
14645
  case "copy":
14616
14646
  case "cut": {
14617
14647
  const copied = await controller.copySelectionToClipboard();
14618
- if (!copied) throw new Error("Clipboard access is unavailable. Use the keyboard shortcut to copy.");
14648
+ if (!copied) throw new MenuActionError("clipboardCopyUnavailable");
14619
14649
  if (!isCurrent()) return false;
14620
14650
  if (id === "cut") controller.clearSelectedCells();
14621
14651
  break;
14622
14652
  }
14623
14653
  case "paste": {
14624
14654
  const clipboard = navigator.clipboard;
14625
- if (!clipboard) throw new Error("Clipboard access is unavailable. Use the keyboard shortcut to paste.");
14655
+ if (!clipboard) throw new MenuActionError("clipboardPasteUnavailable");
14626
14656
  let structured;
14627
14657
  let text;
14628
14658
  if (clipboard.read) {
@@ -14640,7 +14670,7 @@ function XlsxContextMenu({
14640
14670
  }
14641
14671
  if (!isCurrent()) return false;
14642
14672
  const pasted = structured !== void 0 ? controller.pasteStructuredClipboardData(structured) : text !== void 0 && controller.pasteText(text);
14643
- if (!pasted) throw new Error("No spreadsheet cells or text are available to paste.");
14673
+ if (!pasted) throw new MenuActionError("nothingToPaste");
14644
14674
  break;
14645
14675
  }
14646
14676
  case "clearContents":
@@ -14685,7 +14715,7 @@ function XlsxContextMenu({
14685
14715
  closeMenu();
14686
14716
  return true;
14687
14717
  } catch (cause) {
14688
- if (aliveRef.current) setError(cause instanceof Error ? cause.message : "The action could not be completed.");
14718
+ if (aliveRef.current) setErrorKey(cause instanceof MenuActionError ? cause.key : "actionFailed");
14689
14719
  return false;
14690
14720
  } finally {
14691
14721
  runningRef.current = false;
@@ -14719,7 +14749,8 @@ function XlsxContextMenu({
14719
14749
  /* @__PURE__ */ u(
14720
14750
  "div",
14721
14751
  {
14722
- "aria-label": "Spreadsheet context menu",
14752
+ lang: controller.locale,
14753
+ "aria-label": messages.contextMenu,
14723
14754
  "aria-busy": busy,
14724
14755
  className: ["react-xlsx-context-menu", contextMenuClassName].filter(Boolean).join(" "),
14725
14756
  "data-dark": isDarkViewerPalette(palette) ? "true" : "false",
@@ -14806,18 +14837,18 @@ function createChartModule(importModule) {
14806
14837
  var officeChartRenderer = createChartModule(async () => {
14807
14838
  const [{ loadOfficeCharts }, { SharedChartSvg }] = await Promise.all([
14808
14839
  import("./browser-AWFV5QM2.js"),
14809
- import("./shared-chart-XOCTF7KQ.js")
14840
+ import("./shared-chart-7RUN5IKZ.js")
14810
14841
  ]);
14811
14842
  return { renderer: await loadOfficeCharts(), SharedChartSvg };
14812
14843
  });
14813
14844
  var suppliedOfficeChartRenderer = createChartModule(async () => {
14814
- const { SharedChartSvg } = await import("./shared-chart-XOCTF7KQ.js");
14845
+ const { SharedChartSvg } = await import("./shared-chart-7RUN5IKZ.js");
14815
14846
  return { renderer: null, SharedChartSvg };
14816
14847
  });
14817
14848
  var officeExtendedChartRenderer = createChartModule(async () => {
14818
14849
  const [{ loadOfficeCharts }, { SharedChartSvg }] = await Promise.all([
14819
14850
  import("./full-ERXNU2LF.js"),
14820
- import("./shared-chart-XOCTF7KQ.js")
14851
+ import("./shared-chart-7RUN5IKZ.js")
14821
14852
  ]);
14822
14853
  return { renderer: await loadOfficeCharts(typeof DecompressionStream === "function" ? void 0 : new URL("./office_charts_full_bg.wasm", import.meta.url)), SharedChartSvg };
14823
14854
  });
@@ -14858,13 +14889,14 @@ var ChartLoadBoundary = class extends C {
14858
14889
  }
14859
14890
  render() {
14860
14891
  if (this.state.failed) {
14861
- return /* @__PURE__ */ u("div", { role: "status", children: "Unable to load chart." });
14892
+ return /* @__PURE__ */ u("div", { role: "status", children: this.props.errorMessage });
14862
14893
  }
14863
14894
  return this.props.children;
14864
14895
  }
14865
14896
  };
14866
14897
  function UnsupportedChart({ chart }) {
14867
- return /* @__PURE__ */ u("div", { role: "status", "data-xlsx-chart-fallback": "unsupported", children: chart.chartType === "RegionMap" ? "Map data is unavailable." : "This chart cannot be rendered." });
14898
+ const messages = useXlsxMessages();
14899
+ return /* @__PURE__ */ u("div", { role: "status", "data-xlsx-chart-fallback": "unsupported", children: chart.chartType === "RegionMap" ? messages.mapUnavailable : messages.chartUnavailable });
14868
14900
  }
14869
14901
  function SharedChart(props) {
14870
14902
  const module = useChartModule(props.experimentalOfficeCharts ? suppliedOfficeChartRenderer : props.source.experimental ? officeExtendedChartRenderer : officeChartRenderer);
@@ -14874,7 +14906,8 @@ function SharedChart(props) {
14874
14906
  return renderer && module.SharedChartSvg ? /* @__PURE__ */ u(module.SharedChartSvg, { ...props, renderer, fallback }) : fallback;
14875
14907
  }
14876
14908
  function MemoChartSvg(props) {
14877
- return /* @__PURE__ */ u(ChartLoadBoundary, { children: props.chart.renderSource ? /* @__PURE__ */ u(SharedChart, { ...props, source: props.chart.renderSource }) : /* @__PURE__ */ u(UnsupportedChart, { chart: props.chart }) }, props.chart.id);
14909
+ const messages = useXlsxMessages();
14910
+ return /* @__PURE__ */ u(ChartLoadBoundary, { errorMessage: messages.loadChartFailed, children: props.chart.renderSource ? /* @__PURE__ */ u(SharedChart, { ...props, source: props.chart.renderSource }) : /* @__PURE__ */ u(UnsupportedChart, { chart: props.chart }) }, props.chart.id);
14878
14911
  }
14879
14912
 
14880
14913
  // src/picture-paint.ts
@@ -15643,8 +15676,8 @@ function drawCanvasConditionalIcon(context, icon, centerX, centerY, size) {
15643
15676
  context.fill();
15644
15677
  context.restore();
15645
15678
  }
15646
- function formatZoomScale(zoomScale) {
15647
- return `${Math.round(zoomScale)}%`;
15679
+ function formatZoomScale(zoomScale, locale) {
15680
+ return new Intl.NumberFormat(locale, { style: "percent", maximumFractionDigits: 0 }).format(zoomScale / 100);
15648
15681
  }
15649
15682
  function clampValue(value, min, max) {
15650
15683
  return Math.min(max, Math.max(min, value));
@@ -18258,6 +18291,7 @@ function DefaultTableHeaderMenu({
18258
18291
  sortAscending,
18259
18292
  sortDescending
18260
18293
  }) {
18294
+ const messages = useXlsxMessages();
18261
18295
  return /* @__PURE__ */ u(
18262
18296
  "div",
18263
18297
  {
@@ -18287,7 +18321,7 @@ function DefaultTableHeaderMenu({
18287
18321
  textAlign: "left"
18288
18322
  },
18289
18323
  type: "button",
18290
- children: "Sort A to Z"
18324
+ children: messages.sortAscending
18291
18325
  }
18292
18326
  ),
18293
18327
  /* @__PURE__ */ u(
@@ -18305,7 +18339,7 @@ function DefaultTableHeaderMenu({
18305
18339
  textAlign: "left"
18306
18340
  },
18307
18341
  type: "button",
18308
- children: "Sort Z to A"
18342
+ children: messages.sortDescending
18309
18343
  }
18310
18344
  )
18311
18345
  ]
@@ -18368,6 +18402,7 @@ function drawCanvasTableHeaderTrigger(context, rect, direction, palette, zoomFac
18368
18402
  }
18369
18403
  function SegmentedControl({
18370
18404
  items,
18405
+ messages,
18371
18406
  onValueChange,
18372
18407
  palette,
18373
18408
  value
@@ -18375,7 +18410,7 @@ function SegmentedControl({
18375
18410
  return /* @__PURE__ */ u(
18376
18411
  "div",
18377
18412
  {
18378
- "aria-label": "Workbook sheets",
18413
+ "aria-label": messages.workbookSheets,
18379
18414
  role: "tablist",
18380
18415
  style: {
18381
18416
  alignItems: "center",
@@ -18427,6 +18462,8 @@ function DefaultToolbar({ controller, palette }) {
18427
18462
  canZoomIn,
18428
18463
  canZoomOut,
18429
18464
  defaultZoomScale,
18465
+ locale,
18466
+ messages,
18430
18467
  displayFileName,
18431
18468
  download,
18432
18469
  resetZoom,
@@ -18482,6 +18519,7 @@ function DefaultToolbar({ controller, palette }) {
18482
18519
  /* @__PURE__ */ u(
18483
18520
  "button",
18484
18521
  {
18522
+ "aria-label": messages.zoomOut,
18485
18523
  disabled: !canZoomOut,
18486
18524
  onClick: zoomOut,
18487
18525
  style: {
@@ -18500,6 +18538,7 @@ function DefaultToolbar({ controller, palette }) {
18500
18538
  /* @__PURE__ */ u(
18501
18539
  "button",
18502
18540
  {
18541
+ "aria-label": messages.resetZoom,
18503
18542
  onClick: resetZoom,
18504
18543
  style: {
18505
18544
  background: Math.round(zoomScale) === Math.round(defaultZoomScale) ? "transparent" : palette.subtleSurface,
@@ -18514,12 +18553,13 @@ function DefaultToolbar({ controller, palette }) {
18514
18553
  padding: "6px 10px"
18515
18554
  },
18516
18555
  type: "button",
18517
- children: formatZoomScale(zoomScale)
18556
+ children: formatZoomScale(zoomScale, locale)
18518
18557
  }
18519
18558
  ),
18520
18559
  /* @__PURE__ */ u(
18521
18560
  "button",
18522
18561
  {
18562
+ "aria-label": messages.zoomIn,
18523
18563
  disabled: !canZoomIn,
18524
18564
  onClick: zoomIn,
18525
18565
  style: {
@@ -18541,7 +18581,7 @@ function DefaultToolbar({ controller, palette }) {
18541
18581
  canDownload ? /* @__PURE__ */ u(
18542
18582
  "button",
18543
18583
  {
18544
- "aria-label": "Download workbook",
18584
+ "aria-label": messages.downloadWorkbook,
18545
18585
  onClick: download,
18546
18586
  style: {
18547
18587
  alignItems: "center",
@@ -18558,7 +18598,7 @@ function DefaultToolbar({ controller, palette }) {
18558
18598
  padding: 0,
18559
18599
  width: 32
18560
18600
  },
18561
- title: "Download workbook",
18601
+ title: messages.downloadWorkbook,
18562
18602
  type: "button",
18563
18603
  children: "\u2193"
18564
18604
  }
@@ -18579,10 +18619,11 @@ function DefaultToolbar({ controller, palette }) {
18579
18619
  children: /* @__PURE__ */ u(
18580
18620
  SegmentedControl,
18581
18621
  {
18622
+ messages,
18582
18623
  items: tabs.map((tab, index) => ({
18583
18624
  id: String(index),
18584
18625
  label: tab.name,
18585
- title: tab.visibility === "hidden" ? `${tab.name} (hidden)` : tab.visibility === "veryHidden" ? `${tab.name} (very hidden)` : tab.name,
18626
+ title: tab.visibility === "hidden" ? formatMessage(messages.hiddenSheet, { sheet: tab.name }) : tab.visibility === "veryHidden" ? formatMessage(messages.veryHiddenSheet, { sheet: tab.name }) : tab.name,
18586
18627
  visibility: tab.visibility
18587
18628
  })),
18588
18629
  onValueChange: (value) => setActiveTabIndex(Number(value)),
@@ -18606,7 +18647,7 @@ function resolveToolbar(toolbar, showDefaultToolbar, controller, palette) {
18606
18647
  }
18607
18648
  return /* @__PURE__ */ u(DefaultToolbar, { controller, palette });
18608
18649
  }
18609
- function renderError(errorState, error, palette) {
18650
+ function renderError(errorState, error, palette, messages) {
18610
18651
  if (typeof errorState === "function") {
18611
18652
  return errorState(error);
18612
18653
  }
@@ -18626,11 +18667,11 @@ function renderError(errorState, error, palette) {
18626
18667
  padding: 16,
18627
18668
  textAlign: "center"
18628
18669
  },
18629
- children: error.message
18670
+ children: messages.loadWorkbookFailed
18630
18671
  }
18631
18672
  );
18632
18673
  }
18633
- function renderLoading(loadingComponent, loadingState, palette) {
18674
+ function renderLoading(loadingComponent, loadingState, palette, messages) {
18634
18675
  if (loadingComponent !== void 0) {
18635
18676
  return loadingComponent;
18636
18677
  }
@@ -18648,11 +18689,11 @@ function renderLoading(loadingComponent, loadingState, palette) {
18648
18689
  height: "100%",
18649
18690
  justifyContent: "center"
18650
18691
  },
18651
- children: "Loading workbook..."
18692
+ children: messages.loadingWorkbook
18652
18693
  }
18653
18694
  );
18654
18695
  }
18655
- function renderEmpty(emptyState, palette) {
18696
+ function renderEmpty(emptyState, palette, messages) {
18656
18697
  if (emptyState !== void 0) {
18657
18698
  return emptyState;
18658
18699
  }
@@ -18669,24 +18710,26 @@ function renderEmpty(emptyState, palette) {
18669
18710
  padding: 16,
18670
18711
  textAlign: "center"
18671
18712
  },
18672
- children: "No workbook loaded."
18713
+ children: messages.emptyWorkbook
18673
18714
  }
18674
18715
  );
18675
18716
  }
18676
- function formatBinaryBytes2(bytes) {
18677
- if (!Number.isFinite(bytes) || bytes <= 0) {
18678
- return "0 B";
18679
- }
18680
- const units = ["B", "KB", "MB", "GB"];
18681
- let value = bytes;
18717
+ function formatBinaryBytes2(bytes, locale) {
18718
+ const units = ["byte", "kilobyte", "megabyte", "gigabyte"];
18719
+ let value = Number.isFinite(bytes) && bytes > 0 ? bytes : 0;
18682
18720
  let unitIndex = 0;
18683
18721
  while (value >= 1024 && unitIndex < units.length - 1) {
18684
18722
  value /= 1024;
18685
18723
  unitIndex += 1;
18686
18724
  }
18687
- return `${value >= 10 || unitIndex === 0 ? value.toFixed(0) : value.toFixed(1)} ${units[unitIndex]}`;
18725
+ return new Intl.NumberFormat(locale, {
18726
+ style: "unit",
18727
+ unit: units[unitIndex],
18728
+ unitDisplay: "short",
18729
+ maximumFractionDigits: value >= 10 || unitIndex === 0 ? 0 : 1
18730
+ }).format(value);
18688
18731
  }
18689
- function renderFileTooLarge(fileTooLargeState, renderProps, palette) {
18732
+ function renderFileTooLarge(fileTooLargeState, renderProps, palette, messages, locale) {
18690
18733
  const defaultNode = /* @__PURE__ */ u(
18691
18734
  "div",
18692
18735
  {
@@ -18704,14 +18747,10 @@ function renderFileTooLarge(fileTooLargeState, renderProps, palette) {
18704
18747
  },
18705
18748
  children: [
18706
18749
  /* @__PURE__ */ u("div", { style: { color: palette.text, fontWeight: 600 }, children: renderProps.displayFileName }),
18707
- /* @__PURE__ */ u("div", { children: [
18708
- "File size ",
18709
- formatBinaryBytes2(renderProps.fileSizeBytes),
18710
- " exceeds the configured limit of",
18711
- " ",
18712
- formatBinaryBytes2(renderProps.maxFileSizeBytes),
18713
- "."
18714
- ] })
18750
+ /* @__PURE__ */ u("div", { children: formatMessage(messages.fileTooLarge, {
18751
+ size: formatBinaryBytes2(renderProps.fileSizeBytes, locale),
18752
+ limit: formatBinaryBytes2(renderProps.maxFileSizeBytes, locale)
18753
+ }) })
18715
18754
  ]
18716
18755
  }
18717
18756
  );
@@ -18728,19 +18767,21 @@ function renderFileTooLarge(fileTooLargeState, renderProps, palette) {
18728
18767
  }
18729
18768
  return defaultNode;
18730
18769
  }
18731
- function renderCustomFileTooLarge(fileTooLargeState, renderProps, palette) {
18770
+ function renderCustomFileTooLarge(fileTooLargeState, renderProps, palette, messages, locale) {
18732
18771
  if (fileTooLargeState === void 0) {
18733
18772
  return void 0;
18734
18773
  }
18735
- return renderFileTooLarge(fileTooLargeState, renderProps, palette);
18774
+ return renderFileTooLarge(fileTooLargeState, renderProps, palette, messages, locale);
18736
18775
  }
18737
- function renderDefaultChartLoadingCard(rect) {
18776
+ function renderDefaultChartLoadingCard(rect, messages) {
18738
18777
  const bars = [18, 32, 24];
18739
18778
  const barWidth = Math.max(8, Math.min(12, Math.round(rect.width * 0.018)));
18740
18779
  const barGap = 8;
18741
18780
  return /* @__PURE__ */ u(
18742
18781
  "div",
18743
18782
  {
18783
+ role: "status",
18784
+ "aria-label": messages.loadingChart,
18744
18785
  style: {
18745
18786
  backgroundColor: "#ffffff",
18746
18787
  border: "1px solid #e5e7eb",
@@ -18778,8 +18819,8 @@ function renderDefaultChartLoadingCard(rect) {
18778
18819
  }
18779
18820
  );
18780
18821
  }
18781
- function renderChartLoadingNode(renderChartLoading, chart, rect, stage = "metadata") {
18782
- const defaultNode = renderDefaultChartLoadingCard(rect);
18822
+ function renderChartLoadingNode(renderChartLoading, chart, rect, messages, stage = "metadata") {
18823
+ const defaultNode = renderDefaultChartLoadingCard(rect, messages);
18783
18824
  if (!renderChartLoading) {
18784
18825
  return defaultNode;
18785
18826
  }
@@ -18790,19 +18831,6 @@ function renderChartLoadingNode(renderChartLoading, chart, rect, stage = "metada
18790
18831
  stage
18791
18832
  });
18792
18833
  }
18793
- function formatBytes(value) {
18794
- if (!Number.isFinite(value) || value <= 0) {
18795
- return "0 B";
18796
- }
18797
- const units = ["B", "KB", "MB", "GB"];
18798
- let size = value;
18799
- let unitIndex = 0;
18800
- while (size >= 1024 && unitIndex < units.length - 1) {
18801
- size /= 1024;
18802
- unitIndex += 1;
18803
- }
18804
- return `${size >= 10 || unitIndex === 0 ? size.toFixed(0) : size.toFixed(1)} ${units[unitIndex]}`;
18805
- }
18806
18834
  function renderDeferredLoad(controller, palette) {
18807
18835
  return /* @__PURE__ */ u(
18808
18836
  "div",
@@ -18828,13 +18856,8 @@ function renderDeferredLoad(controller, palette) {
18828
18856
  width: "100%"
18829
18857
  },
18830
18858
  children: [
18831
- /* @__PURE__ */ u("div", { style: { fontSize: 16, fontWeight: 600 }, children: "Large workbook detected" }),
18832
- /* @__PURE__ */ u("div", { style: { color: palette.mutedText, fontSize: 13, lineHeight: 1.5, marginTop: 8 }, children: [
18833
- "This workbook is ",
18834
- formatBytes(controller.deferredLoadFileSize ?? 0),
18835
- ". Loading it immediately can block the main thread and freeze the page."
18836
- ] }),
18837
- /* @__PURE__ */ u("div", { style: { color: palette.mutedText, fontSize: 13, lineHeight: 1.5, marginTop: 8 }, children: "Best practice is to gate large files or move parsing into a worker. You can still load it manually below." }),
18859
+ /* @__PURE__ */ u("div", { style: { fontSize: 16, fontWeight: 600 }, children: controller.messages.largeWorkbook }),
18860
+ /* @__PURE__ */ u("div", { style: { color: palette.mutedText, fontSize: 13, lineHeight: 1.5, marginTop: 8 }, children: formatMessage(controller.messages.deferredLoadDescription, { size: formatBinaryBytes2(controller.deferredLoadFileSize ?? 0, controller.locale) }) }),
18838
18861
  /* @__PURE__ */ u("div", { style: { display: "flex", gap: 10, marginTop: 16 }, children: /* @__PURE__ */ u(
18839
18862
  "button",
18840
18863
  {
@@ -18851,7 +18874,7 @@ function renderDeferredLoad(controller, palette) {
18851
18874
  padding: "8px 12px"
18852
18875
  },
18853
18876
  type: "button",
18854
- children: "Load Anyway"
18877
+ children: controller.messages.loadAnyway
18855
18878
  }
18856
18879
  ) })
18857
18880
  ]
@@ -20134,6 +20157,7 @@ function XlsxGrid({
20134
20157
  getCellDisplayValue: getControllerCellDisplayValue,
20135
20158
  getCellFormula,
20136
20159
  locale,
20160
+ messages,
20137
20161
  getFormControlItems,
20138
20162
  highlightedRanges,
20139
20163
  images,
@@ -24006,6 +24030,10 @@ function XlsxGrid({
24006
24030
  }
24007
24031
  const direction = sortState && sortState.tableName === table.name && sortState.columnIndex === tableColumn.index ? sortState.direction : null;
24008
24032
  const triggerIcon = direction === "ascending" ? "\u25B2" : direction === "descending" ? "\u25BC" : "\u25BE";
24033
+ const triggerStyle = {
24034
+ ...resolveTableHeaderTriggerStyle(palette, zoomFactor),
24035
+ ...experimentalCanvas ? { bottom: zoomFactor, right: zoomFactor, top: void 0, maxHeight: "100%", maxWidth: "100%" } : {}
24036
+ };
24009
24037
  if (renderTableHeaderMenu) {
24010
24038
  return renderTableHeaderMenu({
24011
24039
  cell,
@@ -24017,14 +24045,14 @@ function XlsxGrid({
24017
24045
  triggerIcon,
24018
24046
  triggerProps: {
24019
24047
  "aria-haspopup": "menu",
24020
- "aria-label": `Open menu for ${tableColumn.name}`,
24048
+ "aria-label": formatMessage(messages.openMenuForColumn, { column: tableColumn.name }),
24021
24049
  onClick: (event) => {
24022
24050
  event.stopPropagation();
24023
24051
  },
24024
24052
  onPointerDown: (event) => {
24025
24053
  event.stopPropagation();
24026
24054
  },
24027
- style: resolveTableHeaderTriggerStyle(palette, zoomFactor),
24055
+ style: { ...triggerStyle, pointerEvents: "auto" },
24028
24056
  type: "button"
24029
24057
  }
24030
24058
  });
@@ -24033,7 +24061,7 @@ function XlsxGrid({
24033
24061
  "button",
24034
24062
  {
24035
24063
  "aria-haspopup": "menu",
24036
- "aria-label": `Open menu for ${tableColumn.name}`,
24064
+ "aria-label": formatMessage(messages.openMenuForColumn, { column: tableColumn.name }),
24037
24065
  "aria-expanded": openTableMenu?.tableName === table.name && openTableMenu.col === cell.col && openTableMenu.row === cell.row,
24038
24066
  onPointerDown: (event) => {
24039
24067
  event.preventDefault();
@@ -24046,15 +24074,12 @@ function XlsxGrid({
24046
24074
  (current) => current && current.tableName === table.name && current.row === cell.row && current.col === cell.col ? null : { col: cell.col, row: cell.row, tableName: table.name }
24047
24075
  );
24048
24076
  },
24049
- style: {
24050
- ...resolveTableHeaderTriggerStyle(palette, zoomFactor),
24051
- ...experimentalCanvas ? { bottom: zoomFactor, right: zoomFactor, top: void 0, maxHeight: "100%", maxWidth: "100%" } : {}
24052
- },
24077
+ style: triggerStyle,
24053
24078
  type: "button",
24054
24079
  children: experimentalCanvas ? null : triggerIcon
24055
24080
  }
24056
24081
  );
24057
- }, [effectiveTables, experimentalCanvas, openTableMenu, palette, renderTableHeaderMenu, sortState, sortTable, zoomFactor]);
24082
+ }, [effectiveTables, experimentalCanvas, messages, openTableMenu, palette, renderTableHeaderMenu, sortState, sortTable, zoomFactor]);
24058
24083
  const resolveCanvasColumnHeaderRect = q((actualCol) => {
24059
24084
  const colIndex = colIndexByActual.get(actualCol);
24060
24085
  if (colIndex === void 0) {
@@ -24263,7 +24288,6 @@ function XlsxGrid({
24263
24288
  if (editingCellRef.current) {
24264
24289
  commitEditingRef.current();
24265
24290
  }
24266
- commitSelectionRange({ start: cell, end: cell });
24267
24291
  setOpenTableMenu({ col: cell.col, row: cell.row, tableName: table.name });
24268
24292
  return;
24269
24293
  }
@@ -25310,7 +25334,7 @@ function XlsxGrid({
25310
25334
  drawCanvasConditionalIcon(paneContext, cellData.conditionalIcon, iconX + iconSize / 2, iconY, iconSize);
25311
25335
  }
25312
25336
  paneContext.restore();
25313
- if (cellData.isTableHeader && !(renderTableHeaderMenu && isSameCell(activeCell, drawCell))) {
25337
+ if (cellData.isTableHeader && !renderTableHeaderMenu) {
25314
25338
  const table = getTableAtCell(effectiveTables, drawCell.row, drawCell.col);
25315
25339
  const column = getTableHeaderColumn(table, drawCell.row, drawCell.col);
25316
25340
  const direction = table && column && sortState?.tableName === table.name && sortState.columnIndex === column.index ? sortState.direction : null;
@@ -25717,7 +25741,7 @@ function XlsxGrid({
25717
25741
  selectChartElement(selection2);
25718
25742
  }, [selectChartElement]);
25719
25743
  if (isLoading) {
25720
- return /* @__PURE__ */ u(S, { children: renderLoading(loadingComponent, loadingState, palette) });
25744
+ return /* @__PURE__ */ u(S, { children: renderLoading(loadingComponent, loadingState, palette, messages) });
25721
25745
  }
25722
25746
  if (isLoadDeferred) {
25723
25747
  return /* @__PURE__ */ u(S, { children: renderDeferredLoad({ ...controller, canLoadDeferred, continueDeferredLoad, deferredLoadFileSize, isLoadDeferred }, palette) });
@@ -25731,10 +25755,12 @@ function XlsxGrid({
25731
25755
  fileSizeBytes: error.fileSizeBytes,
25732
25756
  maxFileSizeBytes: error.maxFileSizeBytes
25733
25757
  },
25734
- palette
25758
+ palette,
25759
+ messages,
25760
+ locale
25735
25761
  ) });
25736
25762
  }
25737
- return /* @__PURE__ */ u(S, { children: renderError(errorState, error, palette) });
25763
+ return /* @__PURE__ */ u(S, { children: renderError(errorState, error, palette, messages) });
25738
25764
  }
25739
25765
  if (!activeSheet && activeTab?.kind === "chartsheet") {
25740
25766
  return /* @__PURE__ */ u(
@@ -25777,12 +25803,12 @@ function XlsxGrid({
25777
25803
  maxWidth: "100%",
25778
25804
  aspectRatio: sourceSize ? `${chartsheetRect.width}/${chartsheetRect.height}` : void 0,
25779
25805
  position: "relative"
25780
- }, children: isChartsLoading ? renderChartLoadingNode(renderChartLoading, chart, chartsheetRect) : /* @__PURE__ */ u(
25806
+ }, children: isChartsLoading ? renderChartLoadingNode(renderChartLoading, chart, chartsheetRect, messages) : /* @__PURE__ */ u(
25781
25807
  MemoChartSvg,
25782
25808
  {
25783
25809
  experimentalOfficeCharts,
25784
25810
  chart,
25785
- loadingFallback: (stage) => renderChartLoadingNode(renderChartLoading, chart, chartsheetRect, stage),
25811
+ loadingFallback: (stage) => renderChartLoadingNode(renderChartLoading, chart, chartsheetRect, messages, stage),
25786
25812
  onChartElementDoubleClick: handleChartElementDoubleClick,
25787
25813
  onChartElementPointerDown: handleChartElementPointerDown,
25788
25814
  palette,
@@ -25801,7 +25827,7 @@ function XlsxGrid({
25801
25827
  justifyContent: "center",
25802
25828
  minHeight: 320
25803
25829
  },
25804
- children: "Chartsheet metadata is present, but no embedded chart payload was exposed for this tab."
25830
+ children: messages.chartsheetUnavailable
25805
25831
  }
25806
25832
  )
25807
25833
  }
@@ -25810,7 +25836,7 @@ function XlsxGrid({
25810
25836
  );
25811
25837
  }
25812
25838
  if (!activeSheet) {
25813
- return /* @__PURE__ */ u(S, { children: renderEmpty(emptyState, palette) });
25839
+ return /* @__PURE__ */ u(S, { children: renderEmpty(emptyState, palette, messages) });
25814
25840
  }
25815
25841
  const virtualRows = domExpandedWindow.rowIndices.map((index) => {
25816
25842
  const virtualRow = rowVirtualItemByIndex.get(index);
@@ -25977,8 +26003,22 @@ function XlsxGrid({
25977
26003
  zIndex: cornerHeaderOverlayZIndex
25978
26004
  };
25979
26005
  const editingOverlayRect = experimentalCanvas && editingCell ? resolveCellDisplayRect(editingCell) : null;
25980
- const activeCellAdornment = experimentalCanvas && activeCell ? renderCellAdornment(activeCell) : null;
26006
+ const activeCellAdornment = experimentalCanvas && !renderTableHeaderMenu && activeCell ? renderCellAdornment(activeCell) : null;
25981
26007
  const activeCellAdornmentRect = activeCell && activeCellAdornment ? resolveCellDisplayRect(activeCell) : null;
26008
+ const canvasTableHeaderAdornments = experimentalCanvas && renderTableHeaderMenu ? effectiveTables.flatMap((table) => {
26009
+ if (!canvasVisibleRowItems.some((row) => row.actualRow === table.start.row)) {
26010
+ return [];
26011
+ }
26012
+ return canvasVisibleColItems.flatMap((column) => {
26013
+ const cell = { row: table.start.row, col: column.actualCol };
26014
+ if (!getTableHeaderColumn(table, cell.row, cell.col)) {
26015
+ return [];
26016
+ }
26017
+ const rect = resolveCellDisplayRect(cell);
26018
+ const adornment = renderCellAdornment(cell);
26019
+ return rect && adornment ? [{ cell, rect, adornment }] : [];
26020
+ });
26021
+ }) : [];
25982
26022
  const activeCellOverlayCell = renderActiveCellOverlay && activeCell ? resolveMergeAnchorCell(activeCell) : null;
25983
26023
  const activeCellOverlayRect = activeCellOverlayCell ? resolveCellDisplayRect(activeCellOverlayCell) : null;
25984
26024
  const activeCellOverlay = activeCellOverlayCell && activeCellOverlayRect ? renderActiveCellOverlay?.({ cell: activeCellOverlayCell, rect: activeCellOverlayRect }) : null;
@@ -26409,7 +26449,7 @@ function XlsxGrid({
26409
26449
  "select",
26410
26450
  {
26411
26451
  "aria-disabled": readOnly || control.controlIndex === void 0 || controlItems.length === 0,
26412
- "aria-label": controlLabel || control.name || "Dropdown form control",
26452
+ "aria-label": controlLabel || control.name || messages.dropdownControl,
26413
26453
  disabled: !readOnly && (control.controlIndex === void 0 || controlItems.length === 0),
26414
26454
  onChange: (event) => {
26415
26455
  event.stopPropagation();
@@ -26443,7 +26483,7 @@ function XlsxGrid({
26443
26483
  "select",
26444
26484
  {
26445
26485
  "aria-disabled": readOnly || control.controlIndex === void 0 || controlItems.length === 0,
26446
- "aria-label": controlLabel || control.name || "List box form control",
26486
+ "aria-label": controlLabel || control.name || messages.listBoxControl,
26447
26487
  disabled: !readOnly && (control.controlIndex === void 0 || controlItems.length === 0),
26448
26488
  multiple: allowsMultipleSelection,
26449
26489
  onChange: (event) => {
@@ -26478,7 +26518,7 @@ function XlsxGrid({
26478
26518
  "input",
26479
26519
  {
26480
26520
  "aria-disabled": readOnly || control.controlIndex === void 0,
26481
- "aria-label": controlLabel || control.name || "Scrollbar form control",
26521
+ "aria-label": controlLabel || control.name || messages.scrollbarControl,
26482
26522
  disabled: !readOnly && control.controlIndex === void 0,
26483
26523
  max,
26484
26524
  min,
@@ -26510,7 +26550,7 @@ function XlsxGrid({
26510
26550
  "input",
26511
26551
  {
26512
26552
  "aria-disabled": readOnly || control.controlIndex === void 0,
26513
- "aria-label": controlLabel || control.name || "Spinner form control",
26553
+ "aria-label": controlLabel || control.name || messages.spinnerControl,
26514
26554
  disabled: !readOnly && control.controlIndex === void 0,
26515
26555
  max,
26516
26556
  min,
@@ -26752,12 +26792,12 @@ function XlsxGrid({
26752
26792
  cursor: canEditChart && selectedChartId === chart.id ? "move" : "cell",
26753
26793
  pointerEvents: "auto"
26754
26794
  },
26755
- children: isChartsLoading ? renderChartLoadingNode(renderChartLoading, chart, rect) : /* @__PURE__ */ u(
26795
+ children: isChartsLoading ? renderChartLoadingNode(renderChartLoading, chart, rect, messages) : /* @__PURE__ */ u(
26756
26796
  MemoChartSvg,
26757
26797
  {
26758
26798
  experimentalOfficeCharts,
26759
26799
  chart,
26760
- loadingFallback: (stage) => renderChartLoadingNode(renderChartLoading, chart, rect, stage),
26800
+ loadingFallback: (stage) => renderChartLoadingNode(renderChartLoading, chart, rect, messages, stage),
26761
26801
  onChartElementDoubleClick: handleChartElementDoubleClick,
26762
26802
  onChartElementPointerDown: handleChartElementPointerDown,
26763
26803
  palette,
@@ -27501,7 +27541,7 @@ function XlsxGrid({
27501
27541
  ref: scrollRef,
27502
27542
  "aria-colcount": Math.max(activeSheet?.colCount ?? 0, displayColLimit),
27503
27543
  "aria-keyshortcuts": "ArrowUp ArrowDown ArrowLeft ArrowRight Home End PageUp PageDown Control+Home Control+End",
27504
- "aria-label": activeSheet ? `${activeSheet.name} worksheet grid` : "Workbook grid",
27544
+ "aria-label": activeSheet ? formatMessage(messages.worksheetGrid, { sheet: activeSheet.name }) : messages.workbookGrid,
27505
27545
  "aria-readonly": readOnly,
27506
27546
  "aria-rowcount": Math.max(activeSheet?.rowCount ?? 0, displayRowLimit),
27507
27547
  role: "grid",
@@ -27741,6 +27781,21 @@ function XlsxGrid({
27741
27781
  { pane: "left", style: canvasLeftOverlayPaneStyle, ref: canvasLeftOverlayContentRef, left: -displayRowHeaderWidth, top: -drawingViewport.top - frozenPaneBottom },
27742
27782
  { pane: "corner", style: canvasCornerOverlayPaneStyle, ref: canvasCornerOverlayContentRef, left: -displayRowHeaderWidth, top: -displayHeaderHeight }
27743
27783
  ];
27784
+ const tableHeaderOverlayPanes = canvasTableHeaderAdornments.length > 0 ? /* @__PURE__ */ u("div", { style: { ...canvasBodyViewportLayerStyle, zIndex: 27 }, children: overlayPanes.map(({ pane, style, left, top }) => /* @__PURE__ */ u("div", { style, children: canvasTableHeaderAdornments.map(({ cell, rect, adornment }) => drawingIntersectsPane(rect, pane) ? /* @__PURE__ */ u(
27785
+ "div",
27786
+ {
27787
+ style: {
27788
+ height: rect.height,
27789
+ left: rect.left + left,
27790
+ pointerEvents: "none",
27791
+ position: "absolute",
27792
+ top: rect.top + top,
27793
+ width: rect.width
27794
+ },
27795
+ children: adornment
27796
+ },
27797
+ `${cell.row}:${cell.col}`
27798
+ ) : null) }, pane)) }) : null;
27744
27799
  const selectionOverlayPanes = experimentalCanvas ? /* @__PURE__ */ u("div", { style: { ...canvasBodyViewportLayerStyle, zIndex: 40 }, children: overlayPanes.map(({ pane, style, left, top }) => /* @__PURE__ */ u("div", { style, children: /* @__PURE__ */ u(
27745
27800
  "div",
27746
27801
  {
@@ -27820,6 +27875,7 @@ function XlsxGrid({
27820
27875
  ] }) : null,
27821
27876
  drawingOverlayPanes,
27822
27877
  selectionOverlayPanes,
27878
+ tableHeaderOverlayPanes,
27823
27879
  experimentalCanvas ? /* @__PURE__ */ u(S, { children: [
27824
27880
  /* @__PURE__ */ u("div", { style: canvasBodyViewportLayerStyle, children: [
27825
27881
  /* @__PURE__ */ u(
@@ -28296,7 +28352,8 @@ function XlsxViewerInner({
28296
28352
  allowResizeInReadOnly = false,
28297
28353
  autoScrollToHighlightedRanges = true,
28298
28354
  className,
28299
- controller,
28355
+ controller: sourceController,
28356
+ messages: messageOverrides,
28300
28357
  emptyState,
28301
28358
  enableCanvasSelectionAnimation = true,
28302
28359
  enableGestureZoom = true,
@@ -28334,6 +28391,11 @@ function XlsxViewerInner({
28334
28391
  showDefaultToolbar = true,
28335
28392
  toolbar
28336
28393
  }) {
28394
+ const messages = T(
28395
+ () => mergeMessages(sourceController.messages, messageOverrides),
28396
+ [sourceController.messages, messageOverrides]
28397
+ );
28398
+ const controller = T(() => ({ ...sourceController, messages }), [sourceController, messages]);
28337
28399
  const palette = useViewerPalette(isDark, headerBackgroundColor, headerTextColor);
28338
28400
  const { displayFileName, error } = controller;
28339
28401
  const appliedHighlightRef = A(null);
@@ -28363,11 +28425,14 @@ function XlsxViewerInner({
28363
28425
  fileSizeBytes: error.fileSizeBytes,
28364
28426
  maxFileSizeBytes: error.maxFileSizeBytes
28365
28427
  },
28366
- palette
28428
+ palette,
28429
+ messages,
28430
+ controller.locale
28367
28431
  ) : void 0;
28368
- return /* @__PURE__ */ u(ViewerAppearanceContext.Provider, { value: { headerBackgroundColor, headerTextColor, isDark }, children: /* @__PURE__ */ u(ViewerContext.Provider, { value: controller, children: customFileTooLarge !== void 0 ? customFileTooLarge : /* @__PURE__ */ u(
28432
+ return /* @__PURE__ */ u(XlsxMessagesContext.Provider, { value: messages, children: /* @__PURE__ */ u(ViewerAppearanceContext.Provider, { value: { headerBackgroundColor, headerTextColor, isDark }, children: /* @__PURE__ */ u(ViewerContext.Provider, { value: controller, children: customFileTooLarge !== void 0 ? customFileTooLarge : /* @__PURE__ */ u(
28369
28433
  "div",
28370
28434
  {
28435
+ lang: controller.locale,
28371
28436
  className: classNames("react-xlsx-viewer", className),
28372
28437
  style: {
28373
28438
  blockSize: height,
@@ -28428,7 +28493,7 @@ function XlsxViewerInner({
28428
28493
  ) })
28429
28494
  ]
28430
28495
  }
28431
- ) }) });
28496
+ ) }) }) });
28432
28497
  }
28433
28498
  function XlsxViewerWithInlineController(props) {
28434
28499
  const controller = useXlsxViewerController(props);
@@ -28647,4 +28712,4 @@ export {
28647
28712
  __createContentNode,
28648
28713
  __createContentRoot
28649
28714
  };
28650
- //# sourceMappingURL=chunk-2QENCJUT.js.map
28715
+ //# sourceMappingURL=chunk-O4S5CRDM.js.map