@nice2dev/ui 1.4.20 → 1.4.22

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 (42) hide show
  1. package/CHANGELOG.md +90 -0
  2. package/dist/NiceCodeEditor-CBgbzwjx.cjs +297 -0
  3. package/dist/NiceGantt-Drl4gvw9.cjs +1 -0
  4. package/dist/{NiceGantt.doc-B6YZcJvG.cjs → NiceGantt.doc-DTv0r7bP.cjs} +2 -2
  5. package/dist/{NiceMention-DhaTUqvR.cjs → NiceMention-D330ovOt.cjs} +1 -1
  6. package/dist/NiceModuleLifecyclePanel-jckyVqqt.cjs +1 -0
  7. package/dist/NiceWindow-DQyf5wat.cjs +1 -0
  8. package/dist/{core-lazy-BhQxFuLf.cjs → core-lazy-CUnBYI-T.cjs} +1 -1
  9. package/dist/display/NiceDocumentApprovalFlow.mjs +67 -89
  10. package/dist/display/NiceLeaderboard.mjs +47 -40
  11. package/dist/display/NiceQuestCard.mjs +93 -76
  12. package/dist/docs/NiceGantt.doc.json.mjs +9 -9
  13. package/dist/documentation/utils.mjs +1 -1
  14. package/dist/editors/rich/NiceCodeEditor.mjs +525 -504
  15. package/dist/editors.cjs +1 -1
  16. package/dist/index.cjs +99 -94
  17. package/dist/index.d.ts +63 -2
  18. package/dist/index.mjs +778 -776
  19. package/dist/navigation/NiceMenu.mjs +249 -248
  20. package/dist/navigation.cjs +1 -1
  21. package/dist/navigation.d.ts +6 -0
  22. package/dist/overlays/NiceResponsiveBox.mjs +51 -24
  23. package/dist/overlays/NiceTutorial.mjs +136 -127
  24. package/dist/overlays.cjs +1 -1
  25. package/dist/overlays.d.ts +25 -2
  26. package/dist/planning/NiceGantt.mjs +130 -121
  27. package/dist/planning/NiceStepper.mjs +36 -35
  28. package/dist/style.css +2 -2
  29. package/dist/tools/NiceDraggable.mjs +44 -29
  30. package/dist/tools/NiceGitManager.mjs +5 -0
  31. package/dist/tools/NiceSortable.mjs +66 -48
  32. package/dist/tools/NiceSpeechToText.mjs +67 -52
  33. package/dist/tools/NiceValidationBuilder.mjs +210 -119
  34. package/dist/tools/NiceViewRegistry.mjs +67 -34
  35. package/dist/workflow/NiceTaskInbox.mjs +14 -12
  36. package/package.json +4 -4
  37. package/dist/NiceBottomSheet.doc-keq-Fzlz.cjs +0 -8
  38. package/dist/NiceCodeEditor-DhdjnDLV.cjs +0 -289
  39. package/dist/NiceGantt-BygumlaY.cjs +0 -1
  40. package/dist/NiceModuleLifecyclePanel-DAIbzfZd.cjs +0 -1
  41. package/dist/NiceWindow-BklnkBpu.cjs +0 -1
  42. package/dist/docs/NiceBottomSheet.doc.json.mjs +0 -32
@@ -1,46 +1,59 @@
1
- import { jsx as m } from "react/jsx-runtime";
2
- import { forwardRef as d, useRef as b, useCallback as D } from "react";
1
+ import { jsx as v } from "react/jsx-runtime";
2
+ import { forwardRef as y, useRef as S, useState as w, useCallback as l } from "react";
3
+ const o = "application/nice-drag";
4
+ function $(r) {
5
+ const a = r.dataTransfer?.getData(o);
6
+ if (!a)
7
+ return null;
8
+ try {
9
+ return JSON.parse(a);
10
+ } catch {
11
+ return null;
12
+ }
13
+ }
3
14
  const j = /* @__PURE__ */ Object.assign(
4
- /* @__PURE__ */ d(
15
+ /* @__PURE__ */ y(
5
16
  ({
6
- data: a,
7
- group: i,
8
- handle: n,
9
- disabled: r,
17
+ data: r,
18
+ group: a,
19
+ handle: s,
20
+ disabled: e,
10
21
  onDragStart: c,
11
- onDragEnd: f,
12
- children: g,
13
- className: o,
14
- style: l,
15
- "data-testid": p
16
- }, e) => {
17
- const s = b(null), u = D(
22
+ onDragEnd: g,
23
+ children: u,
24
+ className: d,
25
+ style: p,
26
+ "data-testid": D
27
+ }, n) => {
28
+ const i = S(null), [N, f] = w(!1), m = l(
18
29
  (t) => {
19
- if (r) {
30
+ if (e) {
20
31
  t.preventDefault();
21
32
  return;
22
33
  }
23
- if (n && s.current && !t.target.closest(n)) {
34
+ if (s && i.current && !t.target.closest(s)) {
24
35
  t.preventDefault();
25
36
  return;
26
37
  }
27
- t.dataTransfer.setData("application/nice-drag", JSON.stringify({ data: a, group: i })), t.dataTransfer.effectAllowed = "move", c?.(a);
38
+ t.dataTransfer.setData(o, JSON.stringify({ data: r, group: a })), t.dataTransfer.effectAllowed = "move", f(!0), c?.(r);
28
39
  },
29
- [a, i, n, r, c]
30
- );
31
- return /* @__PURE__ */ m(
40
+ [r, a, s, e, c]
41
+ ), b = l(() => {
42
+ f(!1), g?.();
43
+ }, [g]);
44
+ return /* @__PURE__ */ v(
32
45
  "div",
33
46
  {
34
47
  ref: (t) => {
35
- s.current = t, typeof e == "function" ? e(t) : e && (e.current = t);
48
+ i.current = t, typeof n == "function" ? n(t) : n && (n.current = t);
36
49
  },
37
- draggable: !r,
38
- onDragStart: u,
39
- onDragEnd: f,
40
- className: `nice-draggable ${r ? "nice-draggable--disabled" : ""} ${o || ""}`,
41
- style: l,
42
- "data-testid": p,
43
- children: g
50
+ draggable: !e,
51
+ onDragStart: m,
52
+ onDragEnd: b,
53
+ className: `nice-draggable ${e ? "nice-draggable--disabled" : ""} ${N ? "nice-draggable--dragging" : ""} ${d || ""}`,
54
+ style: p,
55
+ "data-testid": D,
56
+ children: u
44
57
  }
45
58
  );
46
59
  }
@@ -48,5 +61,7 @@ const j = /* @__PURE__ */ Object.assign(
48
61
  { displayName: "NiceDraggable" }
49
62
  );
50
63
  export {
51
- j as NiceDraggable
64
+ o as NICE_DRAG_MIME,
65
+ j as NiceDraggable,
66
+ $ as readNiceDrag
52
67
  };
@@ -65,6 +65,11 @@ const Oi = {
65
65
 
66
66
  display: flex;
67
67
  flex-direction: column;
68
+ /* 1.4.22 ("Kontrolka zmienia szerokość jak przechodzę po tabsach"): it fills its container instead of
69
+ shrinking to whatever the current tab holds. */
70
+ width: 100%;
71
+ min-width: 0;
72
+ box-sizing: border-box;
68
73
  background: var(--nice-git-bg);
69
74
  border: 1px solid var(--nice-git-border);
70
75
  border-radius: var(--nice-git-radius);
@@ -1,62 +1,80 @@
1
- import { jsx as i } from "react/jsx-runtime";
2
- import { useState as d } from "react";
3
- const h = [];
4
- function x({
5
- items: o = h,
6
- keyField: u,
7
- onReorder: g,
8
- renderItem: p,
1
+ import { jsxs as O, jsx as _ } from "react/jsx-runtime";
2
+ import { useState as a, useRef as x } from "react";
3
+ const $ = [];
4
+ function j({
5
+ items: u = $,
6
+ keyField: N,
7
+ onReorder: w,
8
+ renderItem: R,
9
9
  direction: f = "vertical",
10
- handle: s,
11
- group: O,
12
- disabled: c,
13
- className: v,
14
- style: D,
15
- "data-testid": m
10
+ handle: g,
11
+ group: L,
12
+ disabled: d,
13
+ className: S,
14
+ style: E,
15
+ "data-testid": I
16
16
  }) {
17
- const [n, a] = d(null), [_, l] = d(null), b = (t, e) => {
18
- if (c) {
19
- t.preventDefault();
17
+ const [l, p] = a(null), [c, h] = a(null), [m, v] = a(null), D = x(null), s = x([]), b = f === "vertical", y = (n, e) => {
18
+ if (d) {
19
+ n.preventDefault();
20
20
  return;
21
21
  }
22
- if (s && !t.target.closest(s)) {
23
- t.preventDefault();
22
+ if (g && !n.target.closest(g)) {
23
+ n.preventDefault();
24
24
  return;
25
25
  }
26
- t.dataTransfer.effectAllowed = "move", a(e);
27
- }, N = (t, e) => {
28
- t.preventDefault(), l(e);
29
- }, S = (t, e) => {
30
- if (t.preventDefault(), n == null || n === e)
26
+ n.dataTransfer.effectAllowed = "move", p(e);
27
+ }, A = (n) => {
28
+ const e = D.current?.getBoundingClientRect(), t = s.current[n - 1]?.getBoundingClientRect(), r = s.current[n]?.getBoundingClientRect(), o = r ?? t;
29
+ return !e || !o ? null : b ? { top: (t && r ? (t.bottom + r.top) / 2 : r ? r.top - 2 : t.bottom + 2) - e.top - 1, left: o.left - e.left, width: o.width, height: 2 } : { left: (t && r ? (t.right + r.left) / 2 : r ? r.left - 2 : t.right + 2) - e.left - 1, top: o.top - e.top, height: o.height, width: 2 };
30
+ }, B = (n, e) => {
31
+ n.preventDefault();
32
+ const t = n.currentTarget.getBoundingClientRect(), o = (b ? n.clientY < t.top + t.height / 2 : n.clientX < t.left + t.width / 2) ? e : e + 1;
33
+ o !== c && (h(o), v(A(o)));
34
+ }, i = () => {
35
+ p(null), h(null), v(null);
36
+ }, C = (n) => {
37
+ if (n.preventDefault(), l == null || c == null) {
38
+ i();
31
39
  return;
32
- const r = [...o], [I] = r.splice(n, 1);
33
- r.splice(e, 0, I), g(r), a(null), l(null);
34
- }, E = () => {
35
- a(null), l(null);
36
- };
37
- return /* @__PURE__ */ i(
40
+ }
41
+ const e = c > l ? c - 1 : c;
42
+ if (e !== l) {
43
+ const t = [...u], [r] = t.splice(l, 1);
44
+ t.splice(e, 0, r), w(t);
45
+ }
46
+ i();
47
+ }, T = m && l != null && c != null && c !== l && c !== l + 1;
48
+ return /* @__PURE__ */ O(
38
49
  "div",
39
50
  {
40
- className: `nice-sortable nice-sortable--${f} ${v || ""}`,
41
- style: D,
42
- "data-testid": m,
43
- children: o.map((t, e) => /* @__PURE__ */ i(
44
- "div",
45
- {
46
- className: `nice-sortable__item ${n === e ? "nice-sortable__item--dragging" : ""} ${_ === e ? "nice-sortable__item--over" : ""}`,
47
- draggable: !c,
48
- onDragStart: (r) => b(r, e),
49
- onDragOver: (r) => N(r, e),
50
- onDrop: (r) => S(r, e),
51
- onDragEnd: E,
52
- children: p(t, e)
53
- },
54
- String(t[u])
55
- ))
51
+ ref: D,
52
+ className: `nice-sortable nice-sortable--${f} ${S || ""}`,
53
+ style: E,
54
+ "data-testid": I,
55
+ children: [
56
+ u.map((n, e) => /* @__PURE__ */ _(
57
+ "div",
58
+ {
59
+ ref: (t) => {
60
+ s.current[e] = t;
61
+ },
62
+ className: `nice-sortable__item ${l === e ? "nice-sortable__item--dragging" : ""}`,
63
+ draggable: !d,
64
+ onDragStart: (t) => y(t, e),
65
+ onDragOver: (t) => B(t, e),
66
+ onDrop: C,
67
+ onDragEnd: i,
68
+ children: R(n, e)
69
+ },
70
+ String(n[N])
71
+ )),
72
+ T && /* @__PURE__ */ _("div", { className: "nice-sortable__indicator", style: m, "aria-hidden": "true" })
73
+ ]
56
74
  }
57
75
  );
58
76
  }
59
- process.env.NODE_ENV !== "production" && (x.displayName = "NiceSortable");
77
+ process.env.NODE_ENV !== "production" && (j.displayName = "NiceSortable");
60
78
  export {
61
- x as NiceSortable
79
+ j as NiceSortable
62
80
  };
@@ -1,92 +1,107 @@
1
- import { jsx as c, jsxs as s } from "react/jsx-runtime";
2
- import { useNiceTranslation as _, NiceIcon as R } from "@nice2dev/ui-core";
3
- import { forwardRef as A, useState as k, useRef as C } from "react";
4
- const P = /* @__PURE__ */ Object.assign(
5
- /* @__PURE__ */ A(
1
+ import { jsx as l, jsxs as s } from "react/jsx-runtime";
2
+ import { useNiceTranslation as I, NiceIcon as R } from "@nice2dev/ui-core";
3
+ import { forwardRef as L, useState as A, useRef as O } from "react";
4
+ const h = {
5
+ "not-allowed": [
6
+ "speechToText.error.notAllowed",
7
+ "Microphone access is blocked — allow it in the browser."
8
+ ],
9
+ "service-not-allowed": [
10
+ "speechToText.error.notAllowed",
11
+ "Microphone access is blocked — allow it in the browser."
12
+ ],
13
+ "audio-capture": ["speechToText.error.noMicrophone", "No microphone found."],
14
+ "no-speech": ["speechToText.error.noSpeech", "No speech was heard — try again."],
15
+ network: ["speechToText.error.network", "Speech recognition needs a network connection."],
16
+ "language-not-supported": ["speechToText.error.language", "This language is not supported."]
17
+ }, P = /* @__PURE__ */ Object.assign(
18
+ /* @__PURE__ */ L(
6
19
  ({
7
- onResult: j,
8
- onInterim: d,
9
- language: $ = "en-US",
10
- continuous: y = !1,
11
- disabled: h,
12
- label: z,
13
- activeLabel: I,
20
+ onResult: E,
21
+ onInterim: T,
22
+ language: M = "en-US",
23
+ continuous: j = !1,
24
+ disabled: g,
25
+ label: y,
26
+ activeLabel: _,
14
27
  showLabel: f = !1,
15
- className: m,
16
- style: g,
17
- "data-testid": x
18
- }, S) => {
19
- const { t: n } = _(), [r, o] = k(!1), [T, b] = k(null), l = C(null), N = typeof window < "u" ? window.SpeechRecognition ?? window.webkitSpeechRecognition : void 0, w = !!N, L = () => {
20
- if (!w || h)
28
+ onError: $,
29
+ className: x,
30
+ style: S,
31
+ "data-testid": m
32
+ }, w) => {
33
+ const { t } = I(), [c, a] = A(!1), [r, b] = A(null), p = O(null), N = typeof window < "u" ? window.SpeechRecognition ?? window.webkitSpeechRecognition : void 0, k = !!N, z = () => {
34
+ if (!k || g)
21
35
  return;
22
- if (r && l.current) {
23
- l.current.stop(), o(!1);
36
+ if (c && p.current) {
37
+ p.current.stop(), a(!1);
24
38
  return;
25
39
  }
26
40
  const e = new N();
27
- e.lang = $, e.continuous = y, e.interimResults = !!d, e.onresult = (t) => {
28
- let p = "", u = "";
29
- for (let i = t.resultIndex; i < t.results.length; i++)
30
- t.results[i].isFinal ? p += t.results[i][0].transcript : u += t.results[i][0].transcript;
31
- p && j(p), u && d?.(u);
32
- }, e.onerror = (t) => {
33
- b(t.error), o(!1);
34
- }, e.onend = () => o(!1), l.current = e, e.start(), o(!0), b(null);
41
+ e.lang = M, e.continuous = j, e.interimResults = !!T, e.onresult = (o) => {
42
+ let n = "", u = "";
43
+ for (let i = o.resultIndex; i < o.results.length; i++)
44
+ o.results[i].isFinal ? n += o.results[i][0].transcript : u += o.results[i][0].transcript;
45
+ n && E(n), u && T?.(u);
46
+ }, e.onerror = (o) => {
47
+ const n = String(o.error ?? "unknown");
48
+ a(!1), n !== "aborted" && (b(n), $?.(n));
49
+ }, e.onend = () => a(!1), p.current = e, e.start(), a(!0), b(null);
35
50
  };
36
- if (!w)
37
- return /* @__PURE__ */ c(
51
+ if (!k)
52
+ return /* @__PURE__ */ l(
38
53
  "div",
39
54
  {
40
- ref: S,
41
- className: `nice-speechtotext nice-speechtotext--unsupported ${m || ""}`,
42
- style: g,
43
- "data-testid": x,
55
+ ref: w,
56
+ className: `nice-speechtotext nice-speechtotext--unsupported ${x || ""}`,
57
+ style: S,
58
+ "data-testid": m,
44
59
  children: /* @__PURE__ */ s(
45
60
  "button",
46
61
  {
47
62
  className: "nice-btn nice-btn--sm",
48
63
  disabled: !0,
49
- title: n("speechToText.notSupported", "Speech recognition not supported"),
50
- "aria-label": n("speechToText.notSupported", "Speech recognition not supported"),
64
+ title: t("speechToText.notSupported", "Speech recognition not supported"),
65
+ "aria-label": t("speechToText.notSupported", "Speech recognition not supported"),
51
66
  children: [
52
- /* @__PURE__ */ c(R, { name: "mic", size: "sm" }),
67
+ /* @__PURE__ */ l(R, { name: "mic", size: "sm" }),
53
68
  f && /* @__PURE__ */ s("span", { children: [
54
69
  " ",
55
- n("speechToText.notSupportedShort", "Not Supported")
70
+ t("speechToText.notSupportedShort", "Not Supported")
56
71
  ] })
57
72
  ]
58
73
  }
59
74
  )
60
75
  }
61
76
  );
62
- const a = r ? I || n("speechToText.listening", "Listening...") : z || n("speechToText.speak", "Speak");
77
+ const d = c ? _ || t("speechToText.listening", "Listening...") : y || t("speechToText.speak", "Speak");
63
78
  return /* @__PURE__ */ s(
64
79
  "div",
65
80
  {
66
- ref: S,
67
- className: `nice-speechtotext ${m || ""}`,
68
- style: g,
69
- "data-testid": x,
81
+ ref: w,
82
+ className: `nice-speechtotext ${x || ""}`,
83
+ style: S,
84
+ "data-testid": m,
70
85
  children: [
71
86
  /* @__PURE__ */ s(
72
87
  "button",
73
88
  {
74
- className: `nice-btn nice-btn--sm ${r ? "nice-btn--danger" : "nice-btn--primary"}`,
75
- onClick: L,
76
- disabled: h,
77
- "aria-label": a,
78
- "aria-pressed": r,
79
- title: a,
89
+ className: `nice-btn nice-btn--sm ${c ? "nice-btn--danger" : "nice-btn--primary"}`,
90
+ onClick: z,
91
+ disabled: g,
92
+ "aria-label": d,
93
+ "aria-pressed": c,
94
+ title: d,
80
95
  children: [
81
- /* @__PURE__ */ c(R, { name: "mic", size: "sm" }),
96
+ /* @__PURE__ */ l(R, { name: "mic", size: "sm" }),
82
97
  f && /* @__PURE__ */ s("span", { children: [
83
98
  " ",
84
- a
99
+ d
85
100
  ] })
86
101
  ]
87
102
  }
88
103
  ),
89
- T && /* @__PURE__ */ c("span", { className: "nice-speechtotext__error", children: T })
104
+ r && /* @__PURE__ */ l("span", { className: "nice-speechtotext__error", role: "alert", "data-code": r, children: h[r] ? t(h[r][0], h[r][1]) : t("speechToText.error.generic", "Speech recognition failed.") })
90
105
  ]
91
106
  }
92
107
  );