@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,272 @@
1
+ import { scorePassword as e } from "./util/password-strength.util.js";
2
+ import { PasswordStrengthBar as t } from "./PasswordStrengthBar.js";
3
+ import { DEFAULT_CHECK_COLORS as n, DEFAULT_METER_COLORS as r, DEFAULT_PASSWORD_TRANSLATIONS as i } from "./PasswordStrengthMeter.types.js";
4
+ import { useId as a, useMemo as o, useState as s } from "react";
5
+ import { Box as c, Button as l, FormControl as u, FormHelperText as d, IconButton as f, InputAdornment as p, InputLabel as m, OutlinedInput as h, Stack as g, Tooltip as _, Typography as v } from "@mui/material";
6
+ import { jsx as y, jsxs as b } from "react/jsx-runtime";
7
+ import ee from "@mui/icons-material/AutoFixHigh";
8
+ import x from "@mui/icons-material/CheckCircleOutlined";
9
+ import S from "@mui/icons-material/ErrorOutlined";
10
+ import te from "@mui/icons-material/CheckCircle";
11
+ import ne from "@mui/icons-material/Cancel";
12
+ import C from "@mui/icons-material/Visibility";
13
+ import w from "@mui/icons-material/VisibilityOff";
14
+ //#region src/components/password-strength-meter/PasswordStrengthMeter.tsx
15
+ function re(e) {
16
+ let t = [];
17
+ e.upper && t.push("ABCDEFGHIJKLMNOPQRSTUVWXYZ"), e.lower && t.push("abcdefghijklmnopqrstuvwxyz"), e.numbers && t.push("0123456789"), e.symbols && t.push("!@#$%^&*()-_=+[]{}|;:,.<>?"), t.length === 0 && t.push("abcdefghijklmnopqrstuvwxyz");
18
+ let n = t.join(""), r = new Uint32Array(e.length);
19
+ crypto.getRandomValues(r);
20
+ let i = t.map((e) => e[crypto.getRandomValues(new Uint32Array(1))[0] % e.length]), a = Array.from(r.slice(i.length)).map((e) => n[e % n.length]), o = [...i, ...a];
21
+ for (let e = o.length - 1; e > 0; e--) {
22
+ let t = crypto.getRandomValues(new Uint32Array(1))[0] % (e + 1);
23
+ [o[e], o[t]] = [o[t], o[e]];
24
+ }
25
+ return o.join("");
26
+ }
27
+ function T({ label: e, fulfilled: t, checkColors: n }) {
28
+ return /* @__PURE__ */ b(g, {
29
+ direction: "row",
30
+ sx: {
31
+ alignItems: "center",
32
+ mb: .25
33
+ },
34
+ spacing: .5,
35
+ children: [/* @__PURE__ */ y(v, {
36
+ variant: "caption",
37
+ children: e
38
+ }), t ? /* @__PURE__ */ y(x, {
39
+ "data-testid": "psm-req-success",
40
+ style: {
41
+ fontSize: 16,
42
+ color: n.success
43
+ }
44
+ }) : /* @__PURE__ */ y(S, {
45
+ "data-testid": "psm-req-failure",
46
+ style: {
47
+ fontSize: 16,
48
+ color: n.failure
49
+ }
50
+ })]
51
+ });
52
+ }
53
+ function E({ value: x, confirmValue: S, name: E, inputRef: D, disabled: O = !1, error: k = !1, helperText: A, autoComplete: j, customRequirements: ie, generatorOptions: M, showConfirmField: N = !1, showPasswordAdornment: ae = !0, showMeter: oe = !0, showPasswordGenerator: se = !1, showSegmentedBar: ce = !1, showSummary: le = !0, inputSize: P = "medium", translation: ue, meterColors: de, passwordMinLength: F = 8, checkColors: I = n, onPasswordChange: L, onConfirmChange: R, onPasswordGenerated: z }) {
54
+ let B = {
55
+ ...i,
56
+ ...ue
57
+ }, V = {
58
+ ...r,
59
+ ...de
60
+ }, H = a(), U = `${H}-password`, [W, G] = s(!1), [K, fe] = s(!1), [pe, q] = s(""), [me, J] = s(""), Y = x === void 0 ? pe : x, X = S === void 0 ? me : S, Z = N && X.length > 0, Q = Z && Y === X, $ = o(() => e(Y, F), [Y, F]);
61
+ return /* @__PURE__ */ b(g, { children: [
62
+ /* @__PURE__ */ b(u, {
63
+ variant: "outlined",
64
+ fullWidth: !0,
65
+ error: k,
66
+ children: [
67
+ /* @__PURE__ */ y(m, {
68
+ htmlFor: U,
69
+ size: P,
70
+ children: B.label
71
+ }),
72
+ /* @__PURE__ */ y(h, {
73
+ id: U,
74
+ type: W ? "text" : "password",
75
+ fullWidth: !0,
76
+ size: P,
77
+ value: Y,
78
+ onChange: (t) => {
79
+ let n = t.target.value;
80
+ x === void 0 && q(n), L && L(n, e(n, F));
81
+ },
82
+ disabled: O,
83
+ inputRef: D,
84
+ inputProps: {
85
+ "data-testid": "psm-input",
86
+ name: E,
87
+ autoComplete: j
88
+ },
89
+ endAdornment: ae ? /* @__PURE__ */ y(p, {
90
+ position: "end",
91
+ children: /* @__PURE__ */ y(f, {
92
+ "data-testid": "psm-toggle",
93
+ disabled: O,
94
+ "aria-label": W ? B.hidePasswordLabel : B.showPasswordLabel,
95
+ onClick: () => {
96
+ G((e) => !e);
97
+ },
98
+ onMouseDown: (e) => {
99
+ e.preventDefault();
100
+ },
101
+ onMouseUp: (e) => {
102
+ e.preventDefault();
103
+ },
104
+ edge: "end",
105
+ children: y(W ? w : C, {})
106
+ })
107
+ }) : null,
108
+ label: B.label
109
+ }),
110
+ A && /* @__PURE__ */ y(d, { children: A })
111
+ ]
112
+ }),
113
+ se && /* @__PURE__ */ y(_, {
114
+ title: B.generatePasswordLabel,
115
+ arrow: !0,
116
+ children: /* @__PURE__ */ y("span", { children: /* @__PURE__ */ y(l, {
117
+ "data-testid": "psm-generate",
118
+ size: "small",
119
+ variant: "text",
120
+ startIcon: /* @__PURE__ */ y(ee, { fontSize: "small" }),
121
+ disabled: O,
122
+ onClick: () => {
123
+ let t = re({
124
+ length: M?.length ?? Math.max(16, F),
125
+ upper: M?.upper ?? !0,
126
+ lower: M?.lower ?? !0,
127
+ numbers: M?.numbers ?? !0,
128
+ symbols: M?.symbols ?? !0
129
+ });
130
+ x === void 0 && q(t), S === void 0 && J(""), L?.(t, e(t, F)), z?.(t), G(!0);
131
+ },
132
+ sx: {
133
+ mt: .5,
134
+ alignSelf: "flex-start",
135
+ textTransform: "none"
136
+ },
137
+ children: B.generatePasswordLabel
138
+ }) })
139
+ }),
140
+ N && /* @__PURE__ */ b(u, {
141
+ variant: "outlined",
142
+ fullWidth: !0,
143
+ error: Z && !Q,
144
+ sx: { mt: 1 },
145
+ children: [
146
+ /* @__PURE__ */ y(m, {
147
+ htmlFor: `${H}-confirm`,
148
+ size: P,
149
+ children: B.confirmLabel
150
+ }),
151
+ /* @__PURE__ */ y(h, {
152
+ id: `${H}-confirm`,
153
+ type: K ? "text" : "password",
154
+ fullWidth: !0,
155
+ size: P,
156
+ value: X,
157
+ onChange: (e) => {
158
+ let t = e.target.value;
159
+ S === void 0 && J(t), R?.(t, t === Y);
160
+ },
161
+ disabled: O,
162
+ inputProps: { "data-testid": "psm-confirm-input" },
163
+ endAdornment: /* @__PURE__ */ b(p, {
164
+ position: "end",
165
+ children: [Z && (Q ? /* @__PURE__ */ y(te, {
166
+ "data-testid": "psm-confirm-match",
167
+ sx: {
168
+ color: I.success,
169
+ mr: .5
170
+ },
171
+ fontSize: "small"
172
+ }) : /* @__PURE__ */ y(ne, {
173
+ "data-testid": "psm-confirm-mismatch",
174
+ sx: {
175
+ color: I.failure,
176
+ mr: .5
177
+ },
178
+ fontSize: "small"
179
+ })), /* @__PURE__ */ y(f, {
180
+ size: "small",
181
+ disabled: O,
182
+ onClick: () => fe((e) => !e),
183
+ onMouseDown: (e) => e.preventDefault(),
184
+ edge: "end",
185
+ "aria-label": K ? B.hidePasswordLabel : B.showPasswordLabel,
186
+ children: y(K ? w : C, {})
187
+ })]
188
+ }),
189
+ label: B.confirmLabel
190
+ }),
191
+ Z && /* @__PURE__ */ y(d, {
192
+ sx: { color: Q ? I.success : I.failure },
193
+ children: Q ? B.confirmMatchLabel : B.confirmMismatchLabel
194
+ })
195
+ ]
196
+ }),
197
+ oe && /* @__PURE__ */ y(t, {
198
+ percent: $.percent,
199
+ color: ((e) => {
200
+ switch (e.meterStatus) {
201
+ case "weak": return V.weak;
202
+ case "ok": return V.ok;
203
+ case "good": return V.good;
204
+ case "very good": return V.veryGood;
205
+ default: return "transparent";
206
+ }
207
+ })($),
208
+ ariaLabel: B.meterAriaLabel,
209
+ segments: ce
210
+ }),
211
+ le && /* @__PURE__ */ b(c, {
212
+ "data-testid": "psm-summary",
213
+ sx: {
214
+ mt: .5,
215
+ p: .5
216
+ },
217
+ children: [/* @__PURE__ */ y(v, {
218
+ variant: "caption",
219
+ gutterBottom: !0,
220
+ sx: {
221
+ display: "block",
222
+ fontSize: 14
223
+ },
224
+ children: B.summaryHeaderLabel
225
+ }), /* @__PURE__ */ b(g, {
226
+ direction: "row",
227
+ spacing: 6,
228
+ children: [/* @__PURE__ */ b(g, {
229
+ direction: "column",
230
+ children: [
231
+ /* @__PURE__ */ y(T, {
232
+ label: B.summaryMinChars.replace("{n}", String(F)),
233
+ fulfilled: $.length >= F,
234
+ checkColors: I
235
+ }),
236
+ /* @__PURE__ */ y(T, {
237
+ label: B.summaryCapitalLetter,
238
+ fulfilled: $.hasUpper,
239
+ checkColors: I
240
+ }),
241
+ /* @__PURE__ */ y(T, {
242
+ label: B.summaryLowerCaseLetter,
243
+ fulfilled: $.hasLower,
244
+ checkColors: I
245
+ })
246
+ ]
247
+ }), /* @__PURE__ */ b(g, {
248
+ direction: "column",
249
+ children: [
250
+ /* @__PURE__ */ y(T, {
251
+ label: B.summaryNumber,
252
+ fulfilled: $.hasDigit,
253
+ checkColors: I
254
+ }),
255
+ /* @__PURE__ */ y(T, {
256
+ label: B.summarySpecialChar,
257
+ fulfilled: $.hasSymbol,
258
+ checkColors: I
259
+ }),
260
+ ie?.map((e, t) => /* @__PURE__ */ y(T, {
261
+ label: e.label,
262
+ fulfilled: typeof e.fulfilled == "function" ? e.fulfilled(Y) : e.fulfilled,
263
+ checkColors: I
264
+ }, t))
265
+ ]
266
+ })]
267
+ })]
268
+ })
269
+ ] });
270
+ }
271
+ //#endregion
272
+ export { E as PasswordStrengthMeter };
@@ -0,0 +1,27 @@
1
+ //#region src/components/password-strength-meter/PasswordStrengthMeter.types.ts
2
+ var e = {
3
+ label: "Password",
4
+ summaryHeaderLabel: "Requirements for your password",
5
+ summaryMinChars: "At least {n} characters",
6
+ summaryCapitalLetter: "At least 1 capital letter",
7
+ summaryLowerCaseLetter: "At least 1 lowercase letter",
8
+ summaryNumber: "At least 1 number",
9
+ summarySpecialChar: "At least 1 special character",
10
+ showPasswordLabel: "Show password",
11
+ hidePasswordLabel: "Hide password",
12
+ meterAriaLabel: "Password strength",
13
+ generatePasswordLabel: "Generate secure password",
14
+ confirmLabel: "Confirm password",
15
+ confirmMatchLabel: "Passwords match",
16
+ confirmMismatchLabel: "Passwords do not match"
17
+ }, t = {
18
+ weak: "#cc0000",
19
+ ok: "#fdc010",
20
+ good: "#8bc34a",
21
+ veryGood: "#43a047"
22
+ }, n = {
23
+ failure: "#cc0000",
24
+ success: "#43a047"
25
+ };
26
+ //#endregion
27
+ export { n as DEFAULT_CHECK_COLORS, t as DEFAULT_METER_COLORS, e as DEFAULT_PASSWORD_TRANSLATIONS };
@@ -0,0 +1,38 @@
1
+ //#region src/components/password-strength-meter/util/password-strength.util.ts
2
+ var e = (e) => Math.max(0, Math.min(4, Math.round(e)));
3
+ function t(t, n) {
4
+ let r = t ?? "", i = r.length, a = /[a-z]/.test(r), o = /[A-Z]/.test(r), s = /\d/.test(r), c = /[^A-Za-z0-9]/.test(r), l = [
5
+ a,
6
+ o,
7
+ s,
8
+ c
9
+ ].filter(Boolean).length;
10
+ if (i < n) {
11
+ let e = i === 0 ? 0 : 1;
12
+ return {
13
+ score: e,
14
+ percent: e * 25,
15
+ meterStatus: "weak",
16
+ length: i,
17
+ hasLower: a,
18
+ hasUpper: o,
19
+ hasDigit: s,
20
+ hasSymbol: c
21
+ };
22
+ }
23
+ let u = 0;
24
+ u += 1, i >= n + 4 && (u += 1), l >= 2 && (u += 1), l >= 3 && (u += 1), /^(.)\1+$/.test(r) && (u -= 2), /1234|abcd|qwer|password|passwort|admin/i.test(r) && (u -= 2);
25
+ let d = e(u), f = d <= 1 ? "weak" : d === 2 ? "ok" : d === 3 ? "good" : "very good";
26
+ return {
27
+ score: d,
28
+ percent: d * 25,
29
+ meterStatus: f,
30
+ length: i,
31
+ hasLower: a,
32
+ hasUpper: o,
33
+ hasDigit: s,
34
+ hasSymbol: c
35
+ };
36
+ }
37
+ //#endregion
38
+ export { t as scorePassword };