@thebuoyant-tsdev/mui-ts-library 3.11.0 → 3.11.3

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