@thebuoyant-tsdev/mui-ts-library 3.2.1 → 3.6.0

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 (74) hide show
  1. package/README.de.md +31 -0
  2. package/README.md +31 -0
  3. package/dist/components/chord-chart/ChordChart.js +284 -0
  4. package/dist/components/chord-chart/ChordChart.types.js +4 -0
  5. package/dist/components/circle-packing-chart/CirclePackingChart.js +382 -0
  6. package/dist/components/circle-packing-chart/CirclePackingChart.types.js +4 -0
  7. package/dist/components/gantt-chart/GanttBarRow.js +202 -0
  8. package/dist/components/gantt-chart/GanttChart.constants.js +14 -0
  9. package/dist/components/gantt-chart/GanttChart.js +258 -0
  10. package/dist/components/gantt-chart/GanttChart.store.js +119 -0
  11. package/dist/components/gantt-chart/GanttChart.types.js +47 -0
  12. package/dist/components/gantt-chart/GanttDeleteDialog.js +30 -0
  13. package/dist/components/gantt-chart/GanttDependencyArrows.js +54 -0
  14. package/dist/components/gantt-chart/GanttStatusContextMenu.js +36 -0
  15. package/dist/components/gantt-chart/GanttTaskDialog.js +324 -0
  16. package/dist/components/gantt-chart/GanttTaskPanel.js +415 -0
  17. package/dist/components/gantt-chart/GanttTimeline.js +223 -0
  18. package/dist/components/gantt-chart/GanttTimelineHeader.js +90 -0
  19. package/dist/components/gantt-chart/GanttToolbar.js +157 -0
  20. package/dist/components/gantt-chart/GanttWeekendStrips.js +29 -0
  21. package/dist/components/gantt-chart/hooks/useGanttDrag.js +104 -0
  22. package/dist/components/gantt-chart/util/gantt-chart.util.js +150 -0
  23. package/dist/components/horizontal-tree-chart/HorizontalTreeChart.js +488 -0
  24. package/dist/components/horizontal-tree-chart/HorizontalTreeChart.types.js +8 -0
  25. package/dist/components/json-editor/JsonEditor.js +102 -0
  26. package/dist/components/json-editor/JsonEditor.types.js +21 -0
  27. package/dist/components/json-editor/JsonEditorContent.js +185 -0
  28. package/dist/components/json-editor/JsonEditorFooter.js +55 -0
  29. package/dist/components/json-editor/JsonEditorToolbar.js +148 -0
  30. package/dist/components/password-strength-meter/PasswordStrengthBar.js +66 -0
  31. package/dist/components/password-strength-meter/PasswordStrengthMeter.js +272 -0
  32. package/dist/components/password-strength-meter/PasswordStrengthMeter.types.js +27 -0
  33. package/dist/components/password-strength-meter/util/password-strength.util.js +38 -0
  34. package/dist/components/radial-tree-chart/RadialTreeChart.js +447 -0
  35. package/dist/components/radial-tree-chart/RadialTreeChart.types.js +8 -0
  36. package/dist/components/rich-text-editor/RichTextEditor.js +135 -0
  37. package/dist/components/rich-text-editor/RichTextEditor.types.js +74 -0
  38. package/dist/components/rich-text-editor/RichTextEditorColorPicker.js +185 -0
  39. package/dist/components/rich-text-editor/RichTextEditorContent.js +129 -0
  40. package/dist/components/rich-text-editor/RichTextEditorEmojiPicker.js +110 -0
  41. package/dist/components/rich-text-editor/RichTextEditorFooter.js +33 -0
  42. package/dist/components/rich-text-editor/RichTextEditorImageDialog.js +74 -0
  43. package/dist/components/rich-text-editor/RichTextEditorLinkDialog.js +70 -0
  44. package/dist/components/rich-text-editor/RichTextEditorTableMenu.js +97 -0
  45. package/dist/components/rich-text-editor/RichTextEditorToolbar.js +362 -0
  46. package/dist/components/rich-text-editor/util/emojis.js +739 -0
  47. package/dist/components/shared/ToolbarButton.js +22 -0
  48. package/dist/components/shared/normalizeSize.js +6 -0
  49. package/dist/components/sql-editor/SqlEditor.d.ts +1 -1
  50. package/dist/components/sql-editor/SqlEditor.js +113 -0
  51. package/dist/components/sql-editor/SqlEditor.types.d.ts +9 -0
  52. package/dist/components/sql-editor/SqlEditor.types.js +24 -0
  53. package/dist/components/sql-editor/SqlEditorContent.js +248 -0
  54. package/dist/components/sql-editor/SqlEditorFooter.js +45 -0
  55. package/dist/components/sql-editor/SqlEditorHistoryMenu.d.ts +11 -0
  56. package/dist/components/sql-editor/SqlEditorHistoryMenu.js +75 -0
  57. package/dist/components/sql-editor/SqlEditorToolbar.d.ts +5 -1
  58. package/dist/components/sql-editor/SqlEditorToolbar.js +163 -0
  59. package/dist/components/sql-editor/useSqlQueryHistory.d.ts +6 -0
  60. package/dist/components/sql-editor/useSqlQueryHistory.js +20 -0
  61. package/dist/components/sql-editor/util/sqlQueryHistory.util.d.ts +12 -0
  62. package/dist/components/sql-editor/util/sqlQueryHistory.util.js +28 -0
  63. package/dist/components/sunburst-chart/SunburstChart.js +292 -0
  64. package/dist/components/sunburst-chart/SunburstChart.types.js +4 -0
  65. package/dist/components/tag-selection/TagSelection.js +102 -0
  66. package/dist/components/tag-selection/TagSelection.store.js +40 -0
  67. package/dist/components/tag-selection/TagSelection.types.d.ts +2 -0
  68. package/dist/components/tag-selection/TagSelection.types.js +18 -0
  69. package/dist/components/tag-selection/TagSelectionAutocomplete.js +382 -0
  70. package/dist/components/tag-selection/TagSelectionChip.js +30 -0
  71. package/dist/components/tag-selection/TagSelectionSelectedTags.js +73 -0
  72. package/dist/index.cjs +2 -2
  73. package/dist/index.js +23 -8035
  74. package/package.json +1 -1
@@ -0,0 +1,185 @@
1
+ import { useEffect as e, useRef as t } from "react";
2
+ import { Box as n, useTheme as r } from "@mui/material";
3
+ import { EditorView as i, highlightActiveLine as a, highlightActiveLineGutter as o, keymap as s, lineNumbers as c, placeholder as l } from "@codemirror/view";
4
+ import { Compartment as u, EditorState as d } from "@codemirror/state";
5
+ import { json as f, jsonParseLinter as p } from "@codemirror/lang-json";
6
+ import { defaultKeymap as m, history as h, historyKeymap as g } from "@codemirror/commands";
7
+ import { HighlightStyle as _, syntaxHighlighting as v } from "@codemirror/language";
8
+ import { lintGutter as y, linter as b } from "@codemirror/lint";
9
+ import { tags as x } from "@lezer/highlight";
10
+ import { showMinimap as S } from "@replit/codemirror-minimap";
11
+ import { jsx as C } from "react/jsx-runtime";
12
+ //#region src/components/json-editor/JsonEditorContent.tsx
13
+ function w({ value: w, onChange: T, placeholder: E, disabled: D = !1, readonly: O = !1, showLineNumbers: k = !0, showMinimap: A = !1, highlightColors: j, onViewReady: M, onCursorChange: N, onBlur: P, onFocus: F }) {
14
+ let I = t(null), L = t(null), R = t(T), z = t(N), B = t(P), V = t(F), H = t(M), U = t(new u()), W = t(new u()), G = r(), K = G.palette.mode === "dark", q = j?.propertyName ?? G.palette.primary.main, J = j?.string ?? G.palette.success.main, Y = j?.number ?? G.palette.warning.main, X = j?.boolean ?? G.palette.info.main, Z = j?.null ?? G.palette.text.secondary;
15
+ return e(() => {
16
+ R.current = T;
17
+ }, [T]), e(() => {
18
+ z.current = N;
19
+ }, [N]), e(() => {
20
+ B.current = P;
21
+ }, [P]), e(() => {
22
+ V.current = F;
23
+ }, [F]), e(() => {
24
+ H.current = M;
25
+ }, [M]), e(() => {
26
+ if (!I.current) return;
27
+ let e = L.current?.state.doc.toString() ?? w ?? "", t = _.define([
28
+ {
29
+ tag: x.propertyName,
30
+ color: q,
31
+ fontWeight: "bold"
32
+ },
33
+ {
34
+ tag: x.string,
35
+ color: J
36
+ },
37
+ {
38
+ tag: x.number,
39
+ color: Y
40
+ },
41
+ {
42
+ tag: x.bool,
43
+ color: X,
44
+ fontWeight: "bold"
45
+ },
46
+ {
47
+ tag: x.null,
48
+ color: Z,
49
+ fontStyle: "italic"
50
+ },
51
+ {
52
+ tag: x.bracket,
53
+ color: G.palette.text.secondary
54
+ },
55
+ {
56
+ tag: x.punctuation,
57
+ color: G.palette.text.disabled
58
+ },
59
+ {
60
+ tag: x.invalid,
61
+ color: G.palette.error.main,
62
+ textDecoration: "underline wavy"
63
+ }
64
+ ]), n = i.theme({
65
+ "&": {
66
+ height: "100%",
67
+ fontFamily: "'Fira Code', 'JetBrains Mono', 'Consolas', monospace",
68
+ fontSize: "0.875rem"
69
+ },
70
+ ".cm-scroller": { overflow: "auto" },
71
+ ".cm-content": {
72
+ padding: "8px 4px",
73
+ caretColor: G.palette.text.primary
74
+ },
75
+ ".cm-gutters": {
76
+ backgroundColor: K ? G.palette.grey[900] : G.palette.grey[50],
77
+ color: G.palette.text.disabled,
78
+ border: "none",
79
+ borderRight: `1px solid ${G.palette.divider}`
80
+ },
81
+ ".cm-lineNumbers .cm-gutterElement": {
82
+ paddingLeft: "4px",
83
+ paddingRight: "8px"
84
+ },
85
+ ".cm-activeLineGutter": { backgroundColor: G.palette.action.selected },
86
+ ".cm-activeLine": { backgroundColor: G.palette.action.hover },
87
+ "&.cm-focused .cm-selectionBackground, .cm-selectionBackground": { backgroundColor: G.palette.primary.main + "40" },
88
+ ".cm-cursor, .cm-dropCursor": { borderLeftColor: G.palette.text.primary },
89
+ "&.cm-focused": { outline: "none" },
90
+ ".cm-placeholder": {
91
+ color: G.palette.text.disabled,
92
+ fontStyle: "italic"
93
+ },
94
+ ".cm-gutter-lint": { width: "16px" },
95
+ ".cm-lint-marker-error": { color: G.palette.error.main },
96
+ ".cm-lint-marker-warning": { color: G.palette.warning.main },
97
+ ".cm-tooltip.cm-tooltip-lint": {
98
+ backgroundColor: G.palette.background.paper,
99
+ border: `1px solid ${G.palette.divider}`,
100
+ borderRadius: "4px"
101
+ },
102
+ ".cm-diagnostic-error": { borderLeft: `3px solid ${G.palette.error.main}` },
103
+ ".cm-diagnostic-warning": { borderLeft: `3px solid ${G.palette.warning.main}` }
104
+ }, { dark: K }), r = A ? [S.of({
105
+ create: () => {
106
+ let e = document.createElement("div");
107
+ return e.style.width = "80px", e.style.overflow = "hidden", e.style.borderLeft = `1px solid ${G.palette.divider}`, e.style.backgroundColor = K ? G.palette.grey[900] : G.palette.grey[50], { dom: e };
108
+ },
109
+ displayText: "blocks",
110
+ showOverlay: "always"
111
+ })] : [], u = [
112
+ n,
113
+ v(t),
114
+ f(),
115
+ y(),
116
+ b(p()),
117
+ h(),
118
+ s.of([...m, ...g]),
119
+ U.current.of(i.editable.of(!D && !O)),
120
+ W.current.of(d.readOnly.of(O)),
121
+ a(),
122
+ ...k ? [c(), o()] : [],
123
+ ...E ? [l(E)] : [],
124
+ ...r,
125
+ i.updateListener.of((e) => {
126
+ e.docChanged && R.current?.(e.state.doc.toString());
127
+ let t = e.state.selection.main.head, n = e.state.doc.lineAt(t);
128
+ z.current(n.number, t - n.from + 1);
129
+ }),
130
+ i.domEventHandlers({
131
+ blur: () => {
132
+ B.current?.();
133
+ },
134
+ focus: () => {
135
+ V.current?.();
136
+ }
137
+ })
138
+ ], C = new i({
139
+ state: d.create({
140
+ doc: e,
141
+ extensions: u
142
+ }),
143
+ parent: I.current
144
+ });
145
+ return L.current = C, H.current(C), () => {
146
+ H.current(null), C.destroy(), L.current = null;
147
+ };
148
+ }, [
149
+ K,
150
+ q,
151
+ J,
152
+ Y,
153
+ X,
154
+ Z,
155
+ A
156
+ ]), e(() => {
157
+ let e = L.current;
158
+ if (!e) return;
159
+ let t = e.state.doc.toString();
160
+ t !== (w ?? "") && e.dispatch({ changes: {
161
+ from: 0,
162
+ to: t.length,
163
+ insert: w ?? ""
164
+ } });
165
+ }, [w]), e(() => {
166
+ L.current?.dispatch({ effects: [U.current.reconfigure(i.editable.of(!D && !O)), W.current.reconfigure(d.readOnly.of(O))] });
167
+ }, [D, O]), /* @__PURE__ */ C(n, {
168
+ ref: I,
169
+ sx: {
170
+ flex: 1,
171
+ overflow: "hidden",
172
+ display: "flex",
173
+ flexDirection: "column",
174
+ opacity: D ? .5 : 1,
175
+ backgroundColor: G.palette.background.paper,
176
+ "& .cm-editor": {
177
+ flex: 1,
178
+ display: "flex",
179
+ flexDirection: "column"
180
+ }
181
+ }
182
+ });
183
+ }
184
+ //#endregion
185
+ export { w as JsonEditorContent };
@@ -0,0 +1,55 @@
1
+ import { Box as e, FormHelperText as t } from "@mui/material";
2
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
3
+ import i from "@mui/icons-material/CheckCircleOutlined";
4
+ import a from "@mui/icons-material/ErrorOutlined";
5
+ //#region src/components/json-editor/JsonEditorFooter.tsx
6
+ function o({ helperText: o, error: s, showLineColumn: c, showValidation: l, isValid: u, cursorLine: d, cursorCol: f, translation: p }) {
7
+ let m = p.lineColumn.replace("{line}", String(d)).replace("{col}", String(f));
8
+ return /* @__PURE__ */ r(e, {
9
+ sx: {
10
+ display: "flex",
11
+ justifyContent: "space-between",
12
+ alignItems: "flex-start",
13
+ mt: .5,
14
+ px: .5
15
+ },
16
+ children: [/* @__PURE__ */ r(e, { children: [l && /* @__PURE__ */ r(e, {
17
+ sx: {
18
+ display: "flex",
19
+ alignItems: "center",
20
+ gap: .5
21
+ },
22
+ children: [u ? /* @__PURE__ */ n(i, {
23
+ sx: {
24
+ fontSize: "0.875rem",
25
+ color: "success.main"
26
+ },
27
+ "data-testid": "json-valid-icon"
28
+ }) : /* @__PURE__ */ n(a, {
29
+ sx: {
30
+ fontSize: "0.875rem",
31
+ color: "error.main"
32
+ },
33
+ "data-testid": "json-invalid-icon"
34
+ }), /* @__PURE__ */ n(t, {
35
+ sx: {
36
+ color: u ? "success.main" : "error.main",
37
+ m: 0
38
+ },
39
+ children: u ? p.validJson : p.invalidJson
40
+ })]
41
+ }), /* @__PURE__ */ n(t, {
42
+ error: s,
43
+ children: o ?? ""
44
+ })] }), c && /* @__PURE__ */ n(t, {
45
+ sx: {
46
+ color: "text.disabled",
47
+ fontFamily: "monospace",
48
+ whiteSpace: "nowrap"
49
+ },
50
+ children: m
51
+ })]
52
+ });
53
+ }
54
+ //#endregion
55
+ export { o as JsonEditorFooter };
@@ -0,0 +1,148 @@
1
+ import { ToolbarButton as e } from "../shared/ToolbarButton.js";
2
+ import { useState as t } from "react";
3
+ import { Box as n, Divider as r } from "@mui/material";
4
+ import { redo as i, undo as a } from "@codemirror/commands";
5
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
6
+ import c from "@mui/icons-material/ContentCopy";
7
+ import l from "@mui/icons-material/Check";
8
+ import u from "@mui/icons-material/Delete";
9
+ import d from "@mui/icons-material/Undo";
10
+ import f from "@mui/icons-material/Redo";
11
+ import p from "@mui/icons-material/AutoFixHigh";
12
+ import m from "@mui/icons-material/Compress";
13
+ //#region src/components/json-editor/JsonEditorToolbar.tsx
14
+ function h({ editorView: h, toolbarConfig: g, translation: _, indent: v, disabled: y }) {
15
+ let [b, x] = t(!1), S = y || !h;
16
+ function C() {
17
+ let e = h;
18
+ if (!e) return;
19
+ let t = e.state.doc.toString();
20
+ try {
21
+ let n = JSON.stringify(JSON.parse(t), null, v);
22
+ e.dispatch({ changes: {
23
+ from: 0,
24
+ to: e.state.doc.length,
25
+ insert: n
26
+ } });
27
+ } catch {}
28
+ e.focus();
29
+ }
30
+ function w() {
31
+ let e = h;
32
+ if (!e) return;
33
+ let t = e.state.doc.toString();
34
+ try {
35
+ let n = JSON.stringify(JSON.parse(t));
36
+ e.dispatch({ changes: {
37
+ from: 0,
38
+ to: e.state.doc.length,
39
+ insert: n
40
+ } });
41
+ } catch {}
42
+ e.focus();
43
+ }
44
+ function T() {
45
+ let e = h?.state.doc.toString() ?? "";
46
+ navigator.clipboard.writeText(e).then(() => {
47
+ x(!0), setTimeout(() => x(!1), 2e3);
48
+ });
49
+ }
50
+ function E() {
51
+ let e = h;
52
+ e && (e.dispatch({ changes: {
53
+ from: 0,
54
+ to: e.state.doc.length,
55
+ insert: ""
56
+ } }), e.focus());
57
+ }
58
+ function D() {
59
+ let e = h;
60
+ e && (a(e), e.focus());
61
+ }
62
+ function O() {
63
+ let e = h;
64
+ e && (i(e), e.focus());
65
+ }
66
+ let k = g.showFormat || g.showCompact, A = g.showCopy || g.showClear, j = g.showUndoRedo;
67
+ return /* @__PURE__ */ s(n, {
68
+ sx: {
69
+ display: "flex",
70
+ flexWrap: "wrap",
71
+ alignItems: "center",
72
+ gap: .25,
73
+ px: 1,
74
+ py: .5
75
+ },
76
+ role: "toolbar",
77
+ "aria-label": "JSON editor actions",
78
+ children: [
79
+ k && /* @__PURE__ */ s(n, {
80
+ sx: {
81
+ display: "flex",
82
+ gap: .25
83
+ },
84
+ children: [g.showFormat && /* @__PURE__ */ o(e, {
85
+ label: _.format,
86
+ icon: /* @__PURE__ */ o(p, { fontSize: "small" }),
87
+ onClick: C,
88
+ disabled: S
89
+ }), g.showCompact && /* @__PURE__ */ o(e, {
90
+ label: _.compact,
91
+ icon: /* @__PURE__ */ o(m, { fontSize: "small" }),
92
+ onClick: w,
93
+ disabled: S
94
+ })]
95
+ }),
96
+ k && (A || j) && /* @__PURE__ */ o(r, {
97
+ orientation: "vertical",
98
+ flexItem: !0,
99
+ sx: { mx: .5 }
100
+ }),
101
+ A && /* @__PURE__ */ s(n, {
102
+ sx: {
103
+ display: "flex",
104
+ gap: .25
105
+ },
106
+ children: [g.showCopy && /* @__PURE__ */ o(e, {
107
+ label: b ? _.copySuccess : _.copy,
108
+ icon: b ? /* @__PURE__ */ o(l, {
109
+ fontSize: "small",
110
+ color: "success"
111
+ }) : /* @__PURE__ */ o(c, { fontSize: "small" }),
112
+ onClick: T,
113
+ disabled: S
114
+ }), g.showClear && /* @__PURE__ */ o(e, {
115
+ label: _.clear,
116
+ icon: /* @__PURE__ */ o(u, { fontSize: "small" }),
117
+ onClick: E,
118
+ disabled: S
119
+ })]
120
+ }),
121
+ A && j && /* @__PURE__ */ o(r, {
122
+ orientation: "vertical",
123
+ flexItem: !0,
124
+ sx: { mx: .5 }
125
+ }),
126
+ j && /* @__PURE__ */ s(n, {
127
+ sx: {
128
+ display: "flex",
129
+ gap: .25
130
+ },
131
+ children: [/* @__PURE__ */ o(e, {
132
+ label: _.undo,
133
+ icon: /* @__PURE__ */ o(d, { fontSize: "small" }),
134
+ onClick: D,
135
+ disabled: S
136
+ }), /* @__PURE__ */ o(e, {
137
+ label: _.redo,
138
+ icon: /* @__PURE__ */ o(f, { fontSize: "small" }),
139
+ onClick: O,
140
+ disabled: S
141
+ })]
142
+ }),
143
+ !k && !A && !j && /* @__PURE__ */ o(n, { sx: { height: 32 } })
144
+ ]
145
+ });
146
+ }
147
+ //#endregion
148
+ export { h as JsonEditorToolbar };
@@ -0,0 +1,66 @@
1
+ import { Box as e } from "@mui/material";
2
+ import { jsx as t } from "react/jsx-runtime";
3
+ //#region src/components/password-strength-meter/PasswordStrengthBar.tsx
4
+ function n({ percent: n, color: r, ariaLabel: i, segments: a = !1 }) {
5
+ if (a) {
6
+ let a = Math.round(n / 25);
7
+ return /* @__PURE__ */ t(e, {
8
+ role: "progressbar",
9
+ "aria-label": i,
10
+ "aria-valuenow": n,
11
+ "aria-valuemin": 0,
12
+ "aria-valuemax": 100,
13
+ sx: {
14
+ width: "100%",
15
+ display: "flex",
16
+ gap: "3px",
17
+ mt: .5
18
+ },
19
+ children: [
20
+ 0,
21
+ 1,
22
+ 2,
23
+ 3
24
+ ].map((n) => /* @__PURE__ */ t(e, {
25
+ "data-testid": n < a ? "psm-meter-segment-active" : "psm-meter-segment",
26
+ sx: {
27
+ flex: 1,
28
+ height: "8px",
29
+ borderRadius: "3px",
30
+ border: "1px solid",
31
+ borderColor: "divider",
32
+ backgroundColor: n < a ? r : "transparent",
33
+ transition: "background-color 0.3s ease-in-out"
34
+ }
35
+ }, n))
36
+ });
37
+ }
38
+ return /* @__PURE__ */ t(e, {
39
+ role: "progressbar",
40
+ "aria-label": i,
41
+ "aria-valuenow": n,
42
+ "aria-valuemin": 0,
43
+ "aria-valuemax": 100,
44
+ sx: {
45
+ width: "100%",
46
+ height: "8px",
47
+ border: "1px solid",
48
+ borderColor: "divider",
49
+ borderRadius: "6px",
50
+ mt: .5,
51
+ display: "flex"
52
+ },
53
+ children: /* @__PURE__ */ t(e, {
54
+ "data-testid": "psm-meter",
55
+ sx: {
56
+ height: "100%",
57
+ width: `${n}%`,
58
+ backgroundColor: r,
59
+ borderRadius: "6px",
60
+ transition: "width 0.2s ease-in-out"
61
+ }
62
+ })
63
+ });
64
+ }
65
+ //#endregion
66
+ export { n as PasswordStrengthBar };