@sheetxl/studio-mui 0.4.20 → 0.4.21

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 (98) hide show
  1. package/browser/cjs/B1KlR2XYFpYbKjYS.cjs +20 -0
  2. package/browser/cjs/{DItuuqkIamMzp7Im.cjs → B1RMsexbz4bNlty_.cjs} +1 -1
  3. package/browser/cjs/B32faQpVaX1tkPuc.cjs +6 -0
  4. package/browser/cjs/B3XiHrRxW1LxML7F.cjs +6 -0
  5. package/browser/cjs/BGikYpeNpjwvXUdQ.cjs +18 -0
  6. package/browser/cjs/BY5l7DteiFtb2AKy.cjs +6 -0
  7. package/browser/cjs/Bb0Hd2RE7iVWVbm8.cjs +6 -0
  8. package/browser/cjs/C3EZkRIKfQURg9hX.cjs +6 -0
  9. package/browser/cjs/C7r573AdygYrVVEJ.cjs +7 -0
  10. package/browser/cjs/DEEknE8ARp0mc7fk.cjs +6 -0
  11. package/browser/cjs/DZwzUUHda3jr5jo4.cjs +6 -0
  12. package/browser/cjs/index.cjs +2 -2
  13. package/browser/cjs/veQZSq7ekc6G1FZT.cjs +42 -0
  14. package/browser/esm/B84RbTkXZiq6XIdH.mjs +49 -0
  15. package/browser/esm/{C5xUbwpUPDeNua-i.mjs → BLy-hRTZkVfaGrcr.mjs} +1 -1
  16. package/browser/esm/Bapmv0WdnDq3Jl_q.mjs +53 -0
  17. package/browser/esm/C0OuiugFYjsjbY8q.mjs +46 -0
  18. package/browser/esm/{5u-JEG1IfQBstjq0.mjs → CGVN-NJF8ZTm9apo.mjs} +11 -10
  19. package/browser/esm/CcLpUDzJOdfqQ8Kf.mjs +25 -0
  20. package/browser/esm/Csg-hJrzm9r4vJrm.mjs +2156 -0
  21. package/browser/esm/{C60ZnLCvtztDLuoT.mjs → DHf2N2UY78nZFge3.mjs} +100 -98
  22. package/browser/esm/Dlc8L0qha0mZFIkY.mjs +62 -0
  23. package/browser/esm/{BW3_mz5_8i9VLBYB.mjs → Dv-0R5pQwEnowzoO.mjs} +87 -85
  24. package/browser/esm/index.mjs +29 -29
  25. package/browser/esm/mVKwmIdSj4ua1Qce.mjs +4443 -0
  26. package/browser/esm/{CxXpPYi4eOFhBNt2.mjs → sHK4zKkWLGt2hVmW.mjs} +27 -26
  27. package/licenses/dependencies.txt +71 -342
  28. package/node/esm/{CrDbLKJh9omVo_TF.mjs → 49Eux5a_I5wZ-jfq.mjs} +29 -28
  29. package/node/esm/{Bn5TJPQAEMY-lGpF.mjs → B00pGeZ7sj6QOFgF.mjs} +4 -3
  30. package/node/esm/{D6A_o47zvz5ITIJK.mjs → BEtxwx_Ji4aFNg8V.mjs} +79 -78
  31. package/node/esm/{Ds5dinNcyNdC8ta6.mjs → BTcBIT144Lil18l-.mjs} +13 -11
  32. package/node/esm/{Bv12-Yyv0C86Iquy.mjs → Bw_f4uhXHpg1RA6Z.mjs} +7 -6
  33. package/node/esm/CGrG-gsnGd-Pn_T2.mjs +88 -0
  34. package/node/esm/CiUfb3MQCUC2McDP.mjs +46 -0
  35. package/node/esm/D1bjybdBQ28bumrW.mjs +63 -0
  36. package/node/esm/{CH6p2H0CMCoz4NgJ.mjs → Dcnd4LiYyGf2eaNl.mjs} +23 -22
  37. package/node/esm/{rlqvGCJlj4a2UcSM.mjs → DiLUM75s3D56Y6Fx.mjs} +11 -10
  38. package/node/esm/index.mjs +2381 -18514
  39. package/package.json +8 -8
  40. package/browser/cjs/-Z37a-mzY5SKXy--.cjs +0 -6
  41. package/browser/cjs/B384kb1_rsiCsdZG.cjs +0 -6
  42. package/browser/cjs/B8nWvy4zDv1CZsr_.cjs +0 -110
  43. package/browser/cjs/BBnMJiXp9lru0Rcq.cjs +0 -6
  44. package/browser/cjs/BFbHTu65n1oE-l0N.cjs +0 -6
  45. package/browser/cjs/BQMSHnQdWtqeakER.cjs +0 -6
  46. package/browser/cjs/BvjA0ybox6653eb5.cjs +0 -6
  47. package/browser/cjs/Cocgl4ghzWE9yVYS.cjs +0 -161
  48. package/browser/cjs/D21Q1NdM1zQ7uFlH.cjs +0 -6
  49. package/browser/cjs/D4LmaKqYiwjxp0Hs.cjs +0 -15
  50. package/browser/cjs/D6egUillMqBwTaEq.cjs +0 -6
  51. package/browser/cjs/D9lY6pd9tRxPeLKs.cjs +0 -18
  52. package/browser/cjs/DNqIYSqRYZkUpFxW.cjs +0 -7
  53. package/browser/cjs/DUImSlPsM-OipgBZ.cjs +0 -6
  54. package/browser/cjs/DUVLcBcwkTsuLb6q.cjs +0 -6
  55. package/browser/cjs/Db7IyKXFzo8IocDa.cjs +0 -145
  56. package/browser/cjs/DsHPj69dMFG09uD_.cjs +0 -16
  57. package/browser/cjs/DypblOPNMRx5Twgx.cjs +0 -12
  58. package/browser/cjs/QK7YNBstmN86K-xL.cjs +0 -6
  59. package/browser/cjs/VNWvn2kP6ZF0Snzw.cjs +0 -11
  60. package/browser/cjs/dc1YAArM3bSHvRcF.cjs +0 -7
  61. package/browser/cjs/mInXvB8P6r6q7pRY.cjs +0 -11
  62. package/browser/cjs/nop6N-Oi_LKy1Bpc.cjs +0 -42
  63. package/browser/cjs/s45oNHeIvJVeRjn5.cjs +0 -6
  64. package/browser/esm/1y10o01h14oGJtKG.mjs +0 -43
  65. package/browser/esm/BFpc8KBa-fb0nLSt.mjs +0 -46
  66. package/browser/esm/Bmjhrc6YMmfx_1Yi.mjs +0 -1703
  67. package/browser/esm/BnlJVFlQeWerd3KW.mjs +0 -3803
  68. package/browser/esm/BpuH_QvBidPOXgAR.mjs +0 -392
  69. package/browser/esm/CAiWSkkPRgUjk8CN.mjs +0 -424
  70. package/browser/esm/CW8taieVozHhyBOC.mjs +0 -1467
  71. package/browser/esm/CzyEerZmfWrW3i3U.mjs +0 -59
  72. package/browser/esm/D0FBHwm0Oz_wf0tR.mjs +0 -12
  73. package/browser/esm/DM9GPrZpbCcKOnyU.mjs +0 -1352
  74. package/browser/esm/DO1doKZhwYiL7vbF.mjs +0 -1672
  75. package/browser/esm/DS3anstzAV3EJBRw.mjs +0 -84
  76. package/browser/esm/DuEmdSQsXlkCWZIB.mjs +0 -1366
  77. package/browser/esm/FvK-pQsicRjtrKoS.mjs +0 -48
  78. package/browser/esm/KCTJzQeDChqf1yBO.mjs +0 -52
  79. package/browser/esm/P-3pIbidOtRCNsw3.mjs +0 -23
  80. package/browser/esm/W3EFMOPLR1aNXWvF.mjs +0 -2250
  81. package/browser/esm/Z_Sh-N3xHHWLCbEw.mjs +0 -23412
  82. package/browser/esm/mOmzoYDWAtgYndCA.mjs +0 -13391
  83. package/browser/esm/tnJECoiQzUzgUQZE.mjs +0 -44
  84. package/node/esm/54SjtcD6mOreKcCy.mjs +0 -1719
  85. package/node/esm/B2BlMiDOVpIp1FDQ.mjs +0 -1706
  86. package/node/esm/BNEvR1srnnwBgnrF.mjs +0 -1479
  87. package/node/esm/BZ20_F64yjZgn-_G.mjs +0 -1246
  88. package/node/esm/BfzRLuswtxg9uDsX.mjs +0 -78
  89. package/node/esm/C0ZBbkFa-24tJTnw.mjs +0 -60
  90. package/node/esm/CEVO60fX3MAPG0Hg.mjs +0 -1378
  91. package/node/esm/CdFmhVFplZFgBvTo.mjs +0 -44
  92. package/node/esm/Cx4mn0YEVkG-M1VL.mjs +0 -553
  93. package/node/esm/DDWek3aquTe_okr_.mjs +0 -392
  94. package/node/esm/DSLWcwr4qgHARs36.mjs +0 -13464
  95. package/node/esm/iXG86MN0JrtJkpqe.mjs +0 -44
  96. package/node/esm/m2teXjBzZLfLDFPx.mjs +0 -46
  97. package/node/esm/oykDy4erHC0NNHHq.mjs +0 -3776
  98. package/node/esm/sVOd1y3oNBREsKJ7.mjs +0 -86
@@ -0,0 +1,63 @@
1
+ /**
2
+ * @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.4.21
3
+ *
4
+ * (C) 2025-present SheetXL Inc. & Michael T. Ford
5
+ * License: The license can be found at https://www.sheetxl.com/license.
6
+ */
7
+ import { jsx as e, jsxs as t } from "react/jsx-runtime";
8
+ import { memo as o, useState as n, useRef as i, useReducer as a, useMemo as l } from "react";
9
+ import { useMeasure as r } from "react-use";
10
+ import { DialogContent as s, Box as c } from "@mui/material";
11
+ import { DefaultNotifier as d, useCommand as m, useCallbackRef as g, CommandButtonType as p } from "@sheetxl/utils-react";
12
+ import { InternalWindow as h, ExhibitDivider as u, CommandButton as x, themeIcon as f, InsertTableIcon as y } from "@sheetxl/utils-mui";
13
+ import { useModelListener as b } from "@sheetxl/react";
14
+ import { NamedInput as w, RangeInput as S, TableStyleOptionsPanel as C, TableStylePreview as N } from "./index.mjs";
15
+ const v = o((o2) => {
16
+ const { title: v2, onHide: R, autoFocusSel: T = ".range-input input", context: F, notifier: D = d, command: H, commands: B, ...I } = o2, [P, j] = n(false), [z, L] = n(false), O = i(null), [E, A] = a((e2) => e2 + 1, 0), [M, { width: V }] = r();
17
+ m(H);
18
+ const W = F ?? H.context(), k = W.table(), [q, G] = n(() => k ? W.getNames().getRanges(k.getRange()) : null), J = l(() => k?.getName() ?? "", [k]);
19
+ b(W.table(), { onAnchorCoordsChange(e2) {
20
+ G(W.getNames().getRanges(e2.getRange()));
21
+ }, onProtectedChange(e2) {
22
+ A();
23
+ } });
24
+ const K = g((e2) => {
25
+ W?.table().setName(e2);
26
+ }, [W]), Q = g((e2) => {
27
+ W?.table().resize(e2.at(0));
28
+ }, [W]);
29
+ let U = null;
30
+ return W.table() || (U = e("div", { style: { position: "absolute", top: "0", left: "0", width: "100%", height: "100%", opacity: 1, display: "flex", alignItems: "center", justifyItems: "center", justifyContent: "center", boxSizing: "border-box" }, children: e("div", { children: "No table selected" }) })), e(h, { ref: O, title: v2 ?? "Table Details", initialPosition: { y: "35" }, autoFocusSel: T, onHide: R, onFocus: () => j(true), onBlur: (e2) => {
31
+ O?.current?.contains(e2.relatedTarget) || j(false);
32
+ }, PaperProps: { elevation: P ? 3 : 1 }, ...I, children: t(s, { dividers: true, ref: M, sx: { display: "flex", flexDirection: "column", position: "relative", paddingLeft: (e2) => e2.spacing(1.5), paddingRight: (e2) => e2.spacing(1.5) }, children: [t(c, { sx: { display: "flex", flexDirection: "column", transition: "opacity 60ms", opacity: W.table() ? 1 : 0 }, children: [e(c, { sx: { display: "flex", flexDirection: "row", gap: (e2) => e2.spacing(1) }, children: e(c, { sx: { display: "flex", flexDirection: "column", maxWidth: "100%", boxSizing: "border-box", paddingLeft: (e2) => e2.spacing(2), paddingRight: (e2) => e2.spacing(2) }, children: t(c, { sx: { display: "flex", flexDirection: "column", alignItems: "center" }, children: [e(w, { formName: "name", defaultInput: J, value: k?.getName() ?? "No table", onChangeInput: K, onValidate: (e2) => {
33
+ k && k.getName().toLowerCase() === e2.toLowerCase() || W?.getNames().validateName(e2);
34
+ }, disabled: k?.isProtected() ?? true, onFocus: (e2) => {
35
+ z || e2.target?.select(), L(true);
36
+ } }), e(S, { formName: "range", value: q, onChangeInput: Q, resolvedAddress: W.getNames().getRanges.bind(W.getNames()), disabled: k?.isProtected() ?? true, onFocus: (e2) => {
37
+ z || e2.target?.select(), L(true);
38
+ } })] }) }) }), t(c, { sx: { minHeight: "10px", flex: "1 1 100%", display: "flex", flexDirection: "column", gap: (e2) => e2.spacing(0.5), marginTop: (e2) => e2.spacing(1) }, children: [e(u, { orientation: "horizontal", sx: { marginTop: (e2) => e2.spacing(1.5), marginBottom: (e2) => e2.spacing(0.75) } }), e(C, { disabled: k?.isProtected(), styleOptions: k?.getStyleOptions() ?? null, onStyleOptionsChange: (e2) => {
39
+ k.updateStyleOptions(e2);
40
+ }, showHeaderRow: k?.getShowHeaders(), onShowHeaderRowChange: (e2) => {
41
+ try {
42
+ k.setShowHeaders(e2);
43
+ } catch (e3) {
44
+ D.showError(e3);
45
+ }
46
+ }, showTotalRow: k?.getShowTotals(), onShowTotalRowChange: (e2) => {
47
+ try {
48
+ k.setShowTotals(e2);
49
+ } catch (e3) {
50
+ D.showError(e3);
51
+ }
52
+ }, showFilterButton: k?.getFilter() ? k.getShowFilterButton() : null, onShowFilterButtonChange: (e2) => {
53
+ try {
54
+ k.setShowFilterButton(e2);
55
+ } catch (e3) {
56
+ D.showError(e3);
57
+ }
58
+ } }), e(c, { sx: { display: "flex", alignItems: "center", justifyContent: "center", flexDirection: "column", marginTop: (e2) => e2.spacing(2), marginBottom: (e2) => e2.spacing(1) }, children: e(N, { table: k, styles: W.styles(), bodyStyle: W.bodyStyle(), cellHeight: 30, isLive: true }) }), e(u, { orientation: "horizontal" }), t(c, { sx: { display: "flex", flexDirection: "column", justifyContent: "center" }, children: [e(x, { variant: p.Menuitem, command: B.getCommand("convertTableToRange"), commandState: k, icon: f(e(y, {})) }), e(x, { variant: p.Menuitem, commandState: k, command: B.getCommand("deleteTable"), icon: f(e(y, {})) })] })] })] }), U] }) });
59
+ });
60
+ export {
61
+ v as TableDetailsWindow,
62
+ v as default
63
+ };
@@ -1,35 +1,36 @@
1
1
  /**
2
- * @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.4.20
2
+ * @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.4.21
3
3
  *
4
4
  * (C) 2025-present SheetXL Inc. & Michael T. Ford
5
5
  * License: The license can be found at https://www.sheetxl.com/license.
6
6
  */
7
7
  import { jsx as e, jsxs as t } from "react/jsx-runtime";
8
8
  import { memo as o, useState as a, useCallback as n, useEffect as i, useMemo as r } from "react";
9
- import { alpha as l, getOverlayAlpha as s } from "@mui/material/styles/index.js";
10
- import { Box as p, FormControl as c, InputLabel as d, Select as u, TextField as m, Typography as g, MenuItem as f } from "@mui/material";
9
+ import { alpha as l, getOverlayAlpha as s } from "@mui/material/styles";
10
+ import { Box as p, FormControl as c, InputLabel as u, Select as m, TextField as d, Typography as g, MenuItem as f } from "@mui/material";
11
11
  import { NumberFormat as y } from "@sheetxl/sdk";
12
- import { P as x, T as h, a as C } from "./index.mjs";
12
+ import { useCallbackRef as h, KeyCodes as x } from "@sheetxl/utils-react";
13
+ import { OptionsDialog as C } from "@sheetxl/utils-mui";
13
14
  const v = ["Ok", "Cancel"], b = o((o2) => {
14
- const { initialValue: b2, context: T, onOption: k, onValidateOption: O, onInputOption: w, onDone: F, options: P = v, defaultOption: S = P?.[0], cancelOption: $ = "Cancel", sx: D, ...I } = o2, [j, V] = a(b2), [N, z] = a(false), B = n(async (e2, t2) => true, []), L = x(async (e2) => {
15
- w?.(j, e2), k?.(e2, e2 === $, e2 === S), F?.();
16
- }, [j, w, F, k, $, S]), M = x(async (e2) => {
17
- if (e2.keyCode === h.Enter) {
18
- false !== await B?.(j, null) && L(S);
15
+ const { initialValue: b2, context: T, onOption: k, onValidateOption: O, onInputOption: w, onDone: F, options: P = v, defaultOption: S = P?.[0], cancelOption: $ = "Cancel", sx: D, ...I } = o2, [V, N] = a(b2), [j, z] = a(false), B = n(async (e2, t2) => true, []), L = h(async (e2) => {
16
+ w?.(V, e2), k?.(e2, e2 === $, e2 === S), F?.();
17
+ }, [V, w, F, k, $, S]), M = h(async (e2) => {
18
+ if (e2.keyCode === x.Enter) {
19
+ false !== await B?.(V, null) && L(S);
19
20
  }
20
- }, [j, L]), R = x((e2) => {
21
- V(e2.target.value), B?.(e2.target.value, null);
22
- }, [O]), W = x(async (e2) => {
21
+ }, [V, L]), R = h((e2) => {
22
+ N(e2.target.value), B?.(e2.target.value, null);
23
+ }, [O]), W = h(async (e2) => {
23
24
  let t2 = await Promise.resolve(O?.(e2));
24
25
  try {
25
- false !== t2 && (t2 = await Promise.resolve(B?.(j, e2)) ?? true);
26
+ false !== t2 && (t2 = await Promise.resolve(B?.(V, e2)) ?? true);
26
27
  } catch (e3) {
27
28
  }
28
29
  return t2 ?? true;
29
- }, [O]), [E, G] = a(y.Styles.lookupStyle(j).formatType ?? y.Type.Custom);
30
+ }, [O]), [E, G] = a(y.Styles.lookupStyle(V).formatType ?? y.Type.Custom);
30
31
  i(() => {
31
- G(y.Styles.lookupStyle(j).formatType ?? y.Type.Custom);
32
- }, [j]);
32
+ G(y.Styles.lookupStyle(V).formatType ?? y.Type.Custom);
33
+ }, [V]);
33
34
  const H = r(() => {
34
35
  const t2 = y.Styles.lookupPrimary(), o3 = (t3) => e(f, { value: t3, children: t3 }, t3), a2 = Object.keys(t2).map((e2) => o3(t2[e2].formatType));
35
36
  return a2.push(o3(y.Type.Custom)), a2;
@@ -37,14 +38,14 @@ const v = ["Ok", "Cancel"], b = o((o2) => {
37
38
  const t2 = e2.target.value;
38
39
  G(t2);
39
40
  const o3 = y.Styles.lookupDefault(t2);
40
- o3 && V(o3);
41
+ o3 && N(o3);
41
42
  }, []), q = r(() => {
42
43
  const e2 = T();
43
- return e2.createTemporaryCell({ value: e2.getValue() ?? 12345, style: { numberFormat: j } });
44
- }, [E, j, T]);
45
- return e(C, { title: "Number Format", options: P, onDone: F, onOption: (e2) => L(e2), onValidateOption: W, defaultOption: S, cancelOption: $, autoFocusSel: ".autoFocus", sx: { width: "580px", ...D }, ...I, children: t(p, { sx: { paddingTop: (e2) => e2.spacing(1), paddingBottom: (e2) => e2.spacing(0), rowGap: (e2) => e2.spacing(1), display: "flex", flexDirection: "column" }, children: [t(c, { sx: { minWidth: 135 }, size: "small", children: [e(d, { children: "Category" }), e(u, { value: E, label: "Category", onChange: K, sx: { backgroundImage: `linear-gradient(${l("#fff", s(5))}, ${l("#fff", s(5))})` }, children: H })] }), e(c, { sx: { paddingTop: (e2) => e2.spacing(1.5), minWidth: 135, width: "100%" }, size: "small", children: e(m, { label: "Code", onFocus: (e2) => {
46
- N || e2.target?.select(), z(true);
47
- }, sx: { "& .MuiFormHelperText-root": { marginTop: (e2) => e2.spacing(0.5) } }, InputLabelProps: { shrink: true }, InputProps: { inputProps: { className: "autoFocus", spellCheck: false, autoComplete: "off", sx: { paddingTop: (e2) => e2.spacing(1.25), paddingBottom: (e2) => e2.spacing(0.75), backgroundImage: `linear-gradient(${l("#fff", s(5))}, ${l("#fff", s(5))})` } } }, value: j, onChange: R, onKeyDown: M, onContextMenu: (e2) => {
44
+ return e2.createTemporaryCell({ value: e2.getValue() ?? 12345, style: { numberFormat: V } });
45
+ }, [E, V, T]);
46
+ return e(C, { title: "Number Format", options: P, onDone: F, onOption: (e2) => L(e2), onValidateOption: W, defaultOption: S, cancelOption: $, autoFocusSel: ".autoFocus", sx: { width: "580px", ...D }, ...I, children: t(p, { sx: { paddingTop: (e2) => e2.spacing(1), paddingBottom: (e2) => e2.spacing(0), rowGap: (e2) => e2.spacing(1), display: "flex", flexDirection: "column" }, children: [t(c, { sx: { minWidth: 135 }, size: "small", children: [e(u, { children: "Category" }), e(m, { value: E, label: "Category", onChange: K, sx: { backgroundImage: `linear-gradient(${l("#fff", s(5))}, ${l("#fff", s(5))})` }, children: H })] }), e(c, { sx: { paddingTop: (e2) => e2.spacing(1.5), minWidth: 135, width: "100%" }, size: "small", children: e(d, { label: "Code", onFocus: (e2) => {
47
+ j || e2.target?.select(), z(true);
48
+ }, sx: { "& .MuiFormHelperText-root": { marginTop: (e2) => e2.spacing(0.5) } }, InputLabelProps: { shrink: true }, InputProps: { inputProps: { className: "autoFocus", spellCheck: false, autoComplete: "off", sx: { paddingTop: (e2) => e2.spacing(1.25), paddingBottom: (e2) => e2.spacing(0.75), backgroundImage: `linear-gradient(${l("#fff", s(5))}, ${l("#fff", s(5))})` } } }, value: V, onChange: R, onKeyDown: M, onContextMenu: (e2) => {
48
49
  e2.stopPropagation();
49
50
  } }) }), t(p, { children: [e(g, { variant: "caption", component: "div", sx: { paddingLeft: (e2) => e2.spacing(2) }, children: "Preview" }), e(g, { variant: "body2", component: "div", sx: { borderRadius: (e2) => `${e2.shape.borderRadius}px`, padding: (e2) => e2.spacing(1), border: (e2) => `1px solid ${e2.palette.grey[400]}` }, children: q.getNumberFormat().displayText || "(empty)" })] })] }) });
50
51
  });
@@ -1,14 +1,15 @@
1
1
  /**
2
- * @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.4.20
2
+ * @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.4.21
3
3
  *
4
4
  * (C) 2025-present SheetXL Inc. & Michael T. Ford
5
5
  * License: The license can be found at https://www.sheetxl.com/license.
6
6
  */
7
7
  import { jsx as t } from "react/jsx-runtime";
8
8
  import { memo as n, useMemo as o, useState as e, useCallback as a } from "react";
9
- import { alpha as i, getOverlayAlpha as s } from "@mui/material/styles/index.js";
9
+ import { alpha as i, getOverlayAlpha as s } from "@mui/material/styles";
10
10
  import { Box as l, FormControl as r, TextField as p } from "@mui/material";
11
- import { P as c, a as m } from "./index.mjs";
11
+ import { useCallbackRef as c } from "@sheetxl/utils-react";
12
+ import { OptionsDialog as m } from "@sheetxl/utils-mui";
12
13
  const u = ["Ok", "Cancel"], d = n((n2) => {
13
14
  const { initialComments: d2 = null, onUpdateComments: g, context: f, onOption: x, onValidateOption: h, onDone: C, options: O = u, defaultOption: y = O?.[0], cancelOption: w = "Cancel", sx: F, ...P } = n2, T = o(() => {
14
15
  const t2 = d2 ?? f?.()?.getComments();
@@ -21,7 +22,7 @@ const u = ["Ok", "Cancel"], d = n((n2) => {
21
22
  }
22
23
  }
23
24
  return n3;
24
- }, []), [k, v] = e(T), [I, b] = e(false), j = a(async (t2, n3) => null, []), D = c(async (t2) => {
25
+ }, []), [k, v] = e(T), [I, b] = e(false), D = a(async (t2, n3) => null, []), B = c(async (t2) => {
25
26
  const n3 = "" === k ? [] : k.split("\n");
26
27
  if (t2 !== w) {
27
28
  const t3 = [];
@@ -30,19 +31,19 @@ const u = ["Ok", "Cancel"], d = n((n2) => {
30
31
  g?.(o2);
31
32
  }
32
33
  x?.(t2, t2 === w, t2 === y), C?.();
33
- }, [k, g, C, x, y, w]), B = c((t2) => {
34
- v(t2.target.value), j(t2.target.value, null);
35
- }, [h]), E = c(async (t2) => {
34
+ }, [k, g, C, x, y, w]), E = c((t2) => {
35
+ v(t2.target.value), D(t2.target.value, null);
36
+ }, [h]), M = c(async (t2) => {
36
37
  let n3 = await Promise.resolve(h?.(t2));
37
38
  try {
38
- false !== n3 && (n3 = await j(k, t2));
39
+ false !== n3 && (n3 = await D(k, t2));
39
40
  } catch (t3) {
40
41
  }
41
42
  return n3 ?? true;
42
43
  }, [h, k]);
43
- return t(m, { title: (T ? "Edit" : "Insert") + " Comments", options: O, onDone: C, onOption: (t2) => D(t2), onValidateOption: E, defaultOption: y, cancelOption: w, autoFocusSel: ".autoFocus", sx: { width: "480px", ...F }, ...P, children: t(l, { sx: { paddingTop: (t2) => t2.spacing(1), paddingBottom: (t2) => t2.spacing(0), rowGap: (t2) => t2.spacing(1), display: "flex", flexDirection: "column" }, children: t(r, { sx: { paddingTop: (t2) => t2.spacing(1.5), minWidth: 135, width: "100%" }, size: "small", children: t(p, { label: "Comments", placeholder: "Enter a comment.", onFocus: (t2) => {
44
+ return t(m, { title: (T ? "Edit" : "Insert") + " Comments", options: O, onDone: C, onOption: (t2) => B(t2), onValidateOption: M, defaultOption: y, cancelOption: w, autoFocusSel: ".autoFocus", sx: { width: "480px", ...F }, ...P, children: t(l, { sx: { paddingTop: (t2) => t2.spacing(1), paddingBottom: (t2) => t2.spacing(0), rowGap: (t2) => t2.spacing(1), display: "flex", flexDirection: "column" }, children: t(r, { sx: { paddingTop: (t2) => t2.spacing(1.5), minWidth: 135, width: "100%" }, size: "small", children: t(p, { label: "Comments", placeholder: "Enter a comment.", onFocus: (t2) => {
44
45
  I || t2.target?.select(), b(true);
45
- }, sx: { "& .MuiFormHelperText-root": { marginTop: (t2) => t2.spacing(0.5) } }, InputLabelProps: { shrink: true }, InputProps: { inputProps: { className: "autoFocus", spellCheck: false, autoComplete: "off", sx: { paddingTop: (t2) => t2.spacing(1.25), paddingBottom: (t2) => t2.spacing(0.75), backgroundImage: `linear-gradient(${i("#fff", s(5))}, ${i("#fff", s(5))})` } } }, value: k, onChange: B, onContextMenu: (t2) => {
46
+ }, sx: { "& .MuiFormHelperText-root": { marginTop: (t2) => t2.spacing(0.5) } }, InputLabelProps: { shrink: true }, InputProps: { inputProps: { className: "autoFocus", spellCheck: false, autoComplete: "off", sx: { paddingTop: (t2) => t2.spacing(1.25), paddingBottom: (t2) => t2.spacing(0.75), backgroundImage: `linear-gradient(${i("#fff", s(5))}, ${i("#fff", s(5))})` } } }, value: k, onChange: E, onContextMenu: (t2) => {
46
47
  t2.stopPropagation();
47
48
  } }) }) }) });
48
49
  });