@thebuoyant-tsdev/mui-ts-library 3.9.1 → 3.11.2

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 (32) hide show
  1. package/README.de.md +93 -0
  2. package/README.md +93 -0
  3. package/dist/components/chord-chart/ChordChart.d.ts +1 -1
  4. package/dist/components/chord-chart/ChordChart.js +155 -137
  5. package/dist/components/chord-chart/ChordChart.types.d.ts +1 -1
  6. package/dist/components/circle-packing-chart/CirclePackingChart.d.ts +1 -1
  7. package/dist/components/circle-packing-chart/CirclePackingChart.js +134 -121
  8. package/dist/components/gantt-chart/hooks/useGanttDrag.js +44 -38
  9. package/dist/components/horizontal-tree-chart/HorizontalTreeChart.d.ts +1 -1
  10. package/dist/components/horizontal-tree-chart/HorizontalTreeChart.js +319 -247
  11. package/dist/components/horizontal-tree-chart/HorizontalTreeChart.types.d.ts +3 -1
  12. package/dist/components/json-editor/JsonEditorContent.js +134 -119
  13. package/dist/components/json-editor/JsonEditorToolbar.js +3 -3
  14. package/dist/components/password-strength-meter/PasswordStrengthMeter.js +131 -130
  15. package/dist/components/radial-tree-chart/RadialTreeChart.d.ts +1 -1
  16. package/dist/components/radial-tree-chart/RadialTreeChart.js +207 -146
  17. package/dist/components/radial-tree-chart/RadialTreeChart.types.d.ts +2 -0
  18. package/dist/components/rich-text-editor/RichTextEditor.js +1 -1
  19. package/dist/components/rich-text-editor/RichTextEditorMarkdownDialog.js +40 -39
  20. package/dist/components/shared/useTimedFlag.d.ts +6 -0
  21. package/dist/components/shared/useTimedFlag.js +14 -0
  22. package/dist/components/sql-editor/SqlEditorHistoryMenu.js +1 -1
  23. package/dist/components/sql-editor/useSqlQueryHistory.js +14 -12
  24. package/dist/components/sql-editor/util/sqlQueryHistory.util.d.ts +1 -0
  25. package/dist/components/sql-editor/util/sqlQueryHistory.util.js +21 -13
  26. package/dist/components/sunburst-chart/SunburstChart.d.ts +1 -1
  27. package/dist/components/sunburst-chart/SunburstChart.js +193 -150
  28. package/dist/components/sunburst-chart/SunburstChart.types.d.ts +2 -0
  29. package/dist/components/tag-selection/TagSelectionAutocomplete.js +7 -5
  30. package/dist/index.cjs +2 -2
  31. package/dist/index.js +7 -7
  32. package/package.json +1 -1
@@ -1,48 +1,49 @@
1
- import { useEffect as e, useState as t } from "react";
2
- import { Box as n, Button as r, Dialog as i, DialogActions as a, DialogContent as o, DialogTitle as s, TextField as c, Typography as l } from "@mui/material";
3
- import { jsx as u, jsxs as d } from "react/jsx-runtime";
4
- import f from "@mui/icons-material/ContentCopy";
5
- import p from "@mui/icons-material/Check";
1
+ import { useTimedFlag as e } from "../shared/useTimedFlag.js";
2
+ import { useEffect as t, useState as n } from "react";
3
+ import { Box as r, Button as i, Dialog as a, DialogActions as o, DialogContent as s, DialogTitle as c, TextField as l, Typography as u } from "@mui/material";
4
+ import { jsx as d, jsxs as f } from "react/jsx-runtime";
5
+ import p from "@mui/icons-material/ContentCopy";
6
+ import m from "@mui/icons-material/Check";
6
7
  //#region src/components/rich-text-editor/RichTextEditorMarkdownDialog.tsx
7
- function m({ open: m, onClose: h, editor: g, translation: _ }) {
8
- let [v, y] = t(""), [b, x] = t(!1);
9
- e(() => {
10
- m && y(g.storage.markdown.getMarkdown());
11
- }, [m, g]);
12
- function S() {
13
- g.commands.setContent(v), h();
14
- }
8
+ function h({ open: h, onClose: g, editor: _, translation: v }) {
9
+ let [y, b] = n(""), [x, S] = e();
10
+ t(() => {
11
+ h && b(_.storage.markdown.getMarkdown());
12
+ }, [h, _]);
15
13
  function C() {
16
- navigator.clipboard.writeText(v).then(() => {
17
- x(!0), setTimeout(() => x(!1), 2e3);
14
+ _.commands.setContent(y), g();
15
+ }
16
+ function w() {
17
+ navigator.clipboard.writeText(y).then(() => {
18
+ S();
18
19
  });
19
20
  }
20
- return /* @__PURE__ */ d(i, {
21
- open: m,
22
- onClose: h,
21
+ return /* @__PURE__ */ f(a, {
22
+ open: h,
23
+ onClose: g,
23
24
  maxWidth: "sm",
24
25
  fullWidth: !0,
25
26
  children: [
26
- /* @__PURE__ */ u(s, { children: _.markdownDialogTitle }),
27
- /* @__PURE__ */ d(o, {
27
+ /* @__PURE__ */ d(c, { children: v.markdownDialogTitle }),
28
+ /* @__PURE__ */ f(s, {
28
29
  sx: {
29
30
  display: "flex",
30
31
  flexDirection: "column",
31
32
  gap: 1.5,
32
33
  pt: "16px !important"
33
34
  },
34
- children: [/* @__PURE__ */ u(l, {
35
+ children: [/* @__PURE__ */ d(u, {
35
36
  variant: "body2",
36
37
  color: "text.secondary",
37
- children: _.markdownDialogDescription
38
- }), /* @__PURE__ */ u(c, {
38
+ children: v.markdownDialogDescription
39
+ }), /* @__PURE__ */ d(l, {
39
40
  autoFocus: !0,
40
41
  fullWidth: !0,
41
42
  multiline: !0,
42
43
  minRows: 8,
43
44
  maxRows: 16,
44
- value: v,
45
- onChange: (e) => y(e.target.value),
45
+ value: y,
46
+ onChange: (e) => b(e.target.value),
46
47
  variant: "outlined",
47
48
  size: "small",
48
49
  sx: { fontFamily: "monospace" },
@@ -52,32 +53,32 @@ function m({ open: m, onClose: h, editor: g, translation: _ }) {
52
53
  } } }
53
54
  })]
54
55
  }),
55
- /* @__PURE__ */ d(a, {
56
+ /* @__PURE__ */ f(o, {
56
57
  sx: {
57
58
  px: 3,
58
59
  pb: 2,
59
60
  gap: 1
60
61
  },
61
62
  children: [
62
- /* @__PURE__ */ u(n, {
63
+ /* @__PURE__ */ d(r, {
63
64
  sx: { flex: 1 },
64
- children: /* @__PURE__ */ u(r, {
65
- onClick: C,
66
- startIcon: b ? /* @__PURE__ */ u(p, {
65
+ children: /* @__PURE__ */ d(i, {
66
+ onClick: w,
67
+ startIcon: x ? /* @__PURE__ */ d(m, {
67
68
  fontSize: "small",
68
69
  color: "success"
69
- }) : /* @__PURE__ */ u(f, { fontSize: "small" }),
70
- children: b ? _.markdownDialogCopied : _.markdownDialogCopy
70
+ }) : /* @__PURE__ */ d(p, { fontSize: "small" }),
71
+ children: x ? v.markdownDialogCopied : v.markdownDialogCopy
71
72
  })
72
73
  }),
73
- /* @__PURE__ */ u(r, {
74
- onClick: h,
75
- children: _.markdownDialogCancel
74
+ /* @__PURE__ */ d(i, {
75
+ onClick: g,
76
+ children: v.markdownDialogCancel
76
77
  }),
77
- /* @__PURE__ */ u(r, {
78
- onClick: S,
78
+ /* @__PURE__ */ d(i, {
79
+ onClick: C,
79
80
  variant: "contained",
80
- children: _.markdownDialogApply
81
+ children: v.markdownDialogApply
81
82
  })
82
83
  ]
83
84
  })
@@ -85,4 +86,4 @@ function m({ open: m, onClose: h, editor: g, translation: _ }) {
85
86
  });
86
87
  }
87
88
  //#endregion
88
- export { m as RichTextEditorMarkdownDialog };
89
+ export { h as RichTextEditorMarkdownDialog };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * A boolean that auto-resets to `false` after `duration` ms — for "Copied!"-style
3
+ * transient feedback. Re-triggering restarts the timer instead of stacking timers,
4
+ * and the pending timeout is cleared on unmount to avoid a state update after unmount.
5
+ */
6
+ export declare function useTimedFlag(duration?: number): [boolean, () => void];
@@ -0,0 +1,14 @@
1
+ import { useCallback as e, useEffect as t, useRef as n, useState as r } from "react";
2
+ //#region src/components/shared/useTimedFlag.ts
3
+ function i(i = 2e3) {
4
+ let [a, o] = r(!1), s = n(null), c = e(() => {
5
+ s.current && clearTimeout(s.current), o(!0), s.current = setTimeout(() => {
6
+ o(!1), s.current = null;
7
+ }, i);
8
+ }, [i]);
9
+ return t(() => () => {
10
+ s.current && clearTimeout(s.current);
11
+ }, []), [a, c];
12
+ }
13
+ //#endregion
14
+ export { i as useTimedFlag };
@@ -56,7 +56,7 @@ function h({ history: h, onSelect: g, onClear: _, translation: v, disabled: y })
56
56
  fontSize: "0.8125rem"
57
57
  } } }
58
58
  })
59
- }, e.timestamp)),
59
+ }, e.id)),
60
60
  h.length > 0 && /* @__PURE__ */ u(t, {}),
61
61
  h.length > 0 && /* @__PURE__ */ d(o, {
62
62
  onClick: w,
@@ -1,20 +1,22 @@
1
1
  import { addQueryToHistory as e, loadQueryHistory as t, saveQueryHistory as n } from "./util/sqlQueryHistory.util.js";
2
- import { useCallback as r, useState as i } from "react";
2
+ import { useCallback as r, useEffect as i, useState as a } from "react";
3
3
  //#region src/components/sql-editor/useSqlQueryHistory.ts
4
- function a(a, o) {
5
- let [s, c] = i(() => t(a));
6
- return {
7
- history: s,
4
+ function o(o, s) {
5
+ let [c, l] = a(() => t(o));
6
+ return i(() => {
7
+ l(t(o));
8
+ }, [o]), {
9
+ history: c,
8
10
  addEntry: r((t) => {
9
- c((r) => {
10
- let i = e(r, t, o);
11
- return n(a, i), i;
11
+ l((r) => {
12
+ let i = e(r, t, s);
13
+ return n(o, i), i;
12
14
  });
13
- }, [a, o]),
15
+ }, [o, s]),
14
16
  clearHistory: r(() => {
15
- c([]), n(a, []);
16
- }, [a])
17
+ l([]), n(o, []);
18
+ }, [o])
17
19
  };
18
20
  }
19
21
  //#endregion
20
- export { a as useSqlQueryHistory };
22
+ export { o as useSqlQueryHistory };
@@ -1,4 +1,5 @@
1
1
  export type SqlQueryHistoryEntry = {
2
+ id: string;
2
3
  sql: string;
3
4
  timestamp: number;
4
5
  };
@@ -1,28 +1,36 @@
1
1
  //#region src/components/sql-editor/util/sqlQueryHistory.util.ts
2
- function e(e) {
2
+ var e = 0;
3
+ function t() {
4
+ return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : (e += 1, `${Date.now()}-${e}`);
5
+ }
6
+ function n(e) {
3
7
  if (typeof window > "u") return [];
4
8
  try {
5
- let t = window.localStorage.getItem(e);
6
- if (!t) return [];
7
- let n = JSON.parse(t);
8
- return Array.isArray(n) ? n.filter((e) => typeof e?.sql == "string" && typeof e?.timestamp == "number") : [];
9
+ let n = window.localStorage.getItem(e);
10
+ if (!n) return [];
11
+ let r = JSON.parse(n);
12
+ return Array.isArray(r) ? r.filter((e) => typeof e?.sql == "string" && typeof e?.timestamp == "number").map((e) => ({
13
+ ...e,
14
+ id: typeof e.id == "string" ? e.id : t()
15
+ })) : [];
9
16
  } catch {
10
17
  return [];
11
18
  }
12
19
  }
13
- function t(e, t) {
20
+ function r(e, t) {
14
21
  if (!(typeof window > "u")) try {
15
22
  window.localStorage.setItem(e, JSON.stringify(t));
16
23
  } catch {}
17
24
  }
18
- function n(e, t, n) {
19
- let r = t.trim();
20
- if (!r) return e;
21
- let i = e.filter((e) => e.sql !== r);
25
+ function i(e, n, r) {
26
+ let i = n.trim();
27
+ if (!i) return e;
28
+ let a = e.filter((e) => e.sql !== i);
22
29
  return [{
23
- sql: r,
30
+ id: t(),
31
+ sql: i,
24
32
  timestamp: Date.now()
25
- }, ...i].slice(0, Math.max(0, n));
33
+ }, ...a].slice(0, Math.max(0, r));
26
34
  }
27
35
  //#endregion
28
- export { n as addQueryToHistory, e as loadQueryHistory, t as saveQueryHistory };
36
+ export { i as addQueryToHistory, n as loadQueryHistory, r as saveQueryHistory };
@@ -1,5 +1,5 @@
1
1
  import { type SunburstChartProps } from "./SunburstChart.types";
2
- export declare function SunburstChart({ data, size, showSegmentLabels, innerRadius, sortBy, chartColors, showRootLabel, onSegmentClick, onZoomChange, valueDecimalCount, valueDecimalSeparator, valueThousandsSeparator, zoomable, disabled, }: SunburstChartProps): import("react/jsx-runtime").JSX.Element;
2
+ export declare function SunburstChart({ data, size, showSegmentLabels, innerRadius, sortBy, chartColors, showRootLabel, onSegmentClick, onZoomChange, valueDecimalCount, valueDecimalSeparator, valueThousandsSeparator, zoomable, duration, disabled, translation, }: SunburstChartProps): import("react/jsx-runtime").JSX.Element;
3
3
  export declare namespace SunburstChart {
4
4
  var displayName: string;
5
5
  }