@sheetxl/studio-mui 0.4.19 → 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/{afHzhXTMVhLQJ6uC.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/{C4lgCnqxoHUTMKx0.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/{6nabbOchsfGHTDbJ.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/{DwyDpojQzn8Yb0Z3.mjs → DHf2N2UY78nZFge3.mjs} +100 -98
  22. package/browser/esm/Dlc8L0qha0mZFIkY.mjs +62 -0
  23. package/browser/esm/{Duk7LVR9m02nk_H1.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/{aeeg2i5lmw2EnSq8.mjs → sHK4zKkWLGt2hVmW.mjs} +27 -26
  27. package/licenses/dependencies.txt +71 -342
  28. package/node/esm/{C1qlFAMFUg7JxINj.mjs → 49Eux5a_I5wZ-jfq.mjs} +29 -28
  29. package/node/esm/{Svd1DLPJnYKhJsxn.mjs → B00pGeZ7sj6QOFgF.mjs} +4 -3
  30. package/node/esm/{Cqh-VwF8iLFUBQG2.mjs → BEtxwx_Ji4aFNg8V.mjs} +79 -78
  31. package/node/esm/{BOlA6nKvsuwJ8-qE.mjs → BTcBIT144Lil18l-.mjs} +13 -11
  32. package/node/esm/{SdVxzy9D4jvK5ILt.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/{wuBONOGgEy1w5A3Q.mjs → Dcnd4LiYyGf2eaNl.mjs} +23 -22
  37. package/node/esm/{BbLVlH-VHXBiyGbB.mjs → DiLUM75s3D56Y6Fx.mjs} +11 -10
  38. package/node/esm/index.mjs +2378 -18426
  39. package/package.json +8 -8
  40. package/browser/cjs/9JbHyHSHGCO4uFHn.cjs +0 -7
  41. package/browser/cjs/B17ClH6YVt0_UP8s.cjs +0 -6
  42. package/browser/cjs/B9LTfguTHj9uQv3h.cjs +0 -6
  43. package/browser/cjs/BYWh4kkrXJKKl2Ju.cjs +0 -145
  44. package/browser/cjs/BYrNOLTwEhs6LHAw.cjs +0 -6
  45. package/browser/cjs/Bh8xJY_qVp_q9NdJ.cjs +0 -6
  46. package/browser/cjs/Bl5l1B_eznDfB_7v.cjs +0 -18
  47. package/browser/cjs/C1LBzI2ntslIKFn5.cjs +0 -6
  48. package/browser/cjs/CGWf__jrNH3xfu2y.cjs +0 -161
  49. package/browser/cjs/CGlk1dj000Bm5cqP.cjs +0 -7
  50. package/browser/cjs/CX_y7y31Q5qi020q.cjs +0 -6
  51. package/browser/cjs/Cby5RVhO-aNkuWsV.cjs +0 -11
  52. package/browser/cjs/D2CoaVzteKVTLz2u.cjs +0 -42
  53. package/browser/cjs/D4ge-OwnSGkzaQnk.cjs +0 -15
  54. package/browser/cjs/D54KO7Qf1gFYpUYh.cjs +0 -11
  55. package/browser/cjs/D5Hr7ebLiJgvcT0k.cjs +0 -6
  56. package/browser/cjs/D6qxm65mk30iMCfQ.cjs +0 -6
  57. package/browser/cjs/DIR6Yr7FCZPYWi4-.cjs +0 -6
  58. package/browser/cjs/DeklxocxxZiZyZ5u.cjs +0 -6
  59. package/browser/cjs/Dh2Z7N-jImJZemiw.cjs +0 -6
  60. package/browser/cjs/Dngll9GyDqkTUUmu.cjs +0 -6
  61. package/browser/cjs/KmAkK4F7kLQEM3IN.cjs +0 -12
  62. package/browser/cjs/n8wDl6JTlhLU6ZAW.cjs +0 -16
  63. package/browser/cjs/zr0HW2FkaHX7brxh.cjs +0 -110
  64. package/browser/esm/B8eNugj_qKnbe7K9.mjs +0 -59
  65. package/browser/esm/BPRkMu1MFxUWK930.mjs +0 -3803
  66. package/browser/esm/BQtrstD4gTIutZpE.mjs +0 -1467
  67. package/browser/esm/BeT_3zf80WoubGnC.mjs +0 -1352
  68. package/browser/esm/C226zpF9x3cqGDep.mjs +0 -44
  69. package/browser/esm/C52hEZh6H2W5Zw5u.mjs +0 -2250
  70. package/browser/esm/CJi45DDPGy79h3Hk.mjs +0 -1366
  71. package/browser/esm/CSAsCpXnzBKwTizz.mjs +0 -23326
  72. package/browser/esm/ChetmIXTvR3tA23A.mjs +0 -48
  73. package/browser/esm/CtAFduFwOuqSdkvi.mjs +0 -23
  74. package/browser/esm/D1mFp2w9djJ0V4vm.mjs +0 -52
  75. package/browser/esm/DA83VkmtEXnqG2ye.mjs +0 -43
  76. package/browser/esm/Dy_zBluT96wehR25.mjs +0 -46
  77. package/browser/esm/NwT_h_qyOIJUd95T.mjs +0 -392
  78. package/browser/esm/eNfgzWFw915mA1DM.mjs +0 -84
  79. package/browser/esm/i07lQ5p_zaWwjifI.mjs +0 -12
  80. package/browser/esm/mWKbTdOrhJijxGkQ.mjs +0 -13391
  81. package/browser/esm/qTwpcY21ZDbsJF8q.mjs +0 -424
  82. package/browser/esm/rOu2mn5CpwGjRPMt.mjs +0 -1672
  83. package/browser/esm/xBoO8UGcKLTEtu2_.mjs +0 -1703
  84. package/node/esm/8IRz_tiw9gL3CiTm.mjs +0 -46
  85. package/node/esm/BGuyZxOceFDiCkHS.mjs +0 -553
  86. package/node/esm/BRc35RfDs9NeSBil.mjs +0 -78
  87. package/node/esm/BWNYjBRxl8-kaqWc.mjs +0 -1706
  88. package/node/esm/Bdk5FW-41aJV-x0f.mjs +0 -392
  89. package/node/esm/C2KYv5fsjkP4dceu.mjs +0 -86
  90. package/node/esm/C7eBwbZmMMcQeZ5y.mjs +0 -1479
  91. package/node/esm/CCmhTOlFNku7bidD.mjs +0 -44
  92. package/node/esm/COWuJnOkG4AgfLpx.mjs +0 -3776
  93. package/node/esm/CcxYuxLYIW_z4w-n.mjs +0 -1378
  94. package/node/esm/DO-FR-M-Iy43f7rk.mjs +0 -60
  95. package/node/esm/DOa-YBJSa8QO8ypH.mjs +0 -1246
  96. package/node/esm/DXgMMPZD2XcdNWPg.mjs +0 -44
  97. package/node/esm/DXlF9nEg2kAr3Ykp.mjs +0 -13464
  98. package/node/esm/FcospSz9-0aW4gFs.mjs +0 -1719
@@ -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.19
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.19
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
  });