@nice2dev/ui 1.4.19 → 1.4.21
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.
- package/CHANGELOG.md +57 -0
- package/dist/NiceGantt-Drl4gvw9.cjs +1 -0
- package/dist/{NiceGantt.doc-B6YZcJvG.cjs → NiceGantt.doc-DTv0r7bP.cjs} +2 -2
- package/dist/NiceModuleLifecyclePanel-jckyVqqt.cjs +1 -0
- package/dist/NiceWindow-DQyf5wat.cjs +1 -0
- package/dist/{core-lazy-BhQxFuLf.cjs → core-lazy-DirbU7jp.cjs} +1 -1
- package/dist/display/NiceDocumentApprovalFlow.mjs +67 -89
- package/dist/display/NiceLeaderboard.mjs +47 -40
- package/dist/display/NiceQuestCard.mjs +93 -76
- package/dist/docs/NiceGantt.doc.json.mjs +9 -9
- package/dist/documentation/utils.mjs +1 -1
- package/dist/index.cjs +94 -94
- package/dist/index.d.ts +58 -2
- package/dist/index.mjs +778 -776
- package/dist/navigation/NiceMenu.mjs +249 -248
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.d.ts +6 -0
- package/dist/overlays/NiceResponsiveBox.mjs +51 -24
- package/dist/overlays/NiceTutorial.mjs +136 -127
- package/dist/overlays.cjs +1 -1
- package/dist/overlays.d.ts +25 -2
- package/dist/planning/NiceGantt.mjs +130 -121
- package/dist/planning/NiceStepper.mjs +36 -35
- package/dist/style.css +2 -2
- package/dist/tools/NiceDraggable.mjs +44 -29
- package/dist/tools/NiceSortable.mjs +66 -48
- package/dist/tools/NiceSpeechToText.mjs +67 -52
- package/dist/tools/NiceValidationBuilder.mjs +210 -119
- package/dist/tools/NiceViewRegistry.mjs +67 -34
- package/package.json +4 -4
- package/dist/NiceBottomSheet.doc-keq-Fzlz.cjs +0 -8
- package/dist/NiceGantt-BygumlaY.cjs +0 -1
- package/dist/NiceModuleLifecyclePanel-DAIbzfZd.cjs +0 -1
- package/dist/NiceWindow-BklnkBpu.cjs +0 -1
- package/dist/docs/NiceBottomSheet.doc.json.mjs +0 -32
|
@@ -1,46 +1,59 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
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__ */
|
|
15
|
+
/* @__PURE__ */ y(
|
|
5
16
|
({
|
|
6
|
-
data:
|
|
7
|
-
group:
|
|
8
|
-
handle:
|
|
9
|
-
disabled:
|
|
17
|
+
data: r,
|
|
18
|
+
group: a,
|
|
19
|
+
handle: s,
|
|
20
|
+
disabled: e,
|
|
10
21
|
onDragStart: c,
|
|
11
|
-
onDragEnd:
|
|
12
|
-
children:
|
|
13
|
-
className:
|
|
14
|
-
style:
|
|
15
|
-
"data-testid":
|
|
16
|
-
},
|
|
17
|
-
const
|
|
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 (
|
|
30
|
+
if (e) {
|
|
20
31
|
t.preventDefault();
|
|
21
32
|
return;
|
|
22
33
|
}
|
|
23
|
-
if (
|
|
34
|
+
if (s && i.current && !t.target.closest(s)) {
|
|
24
35
|
t.preventDefault();
|
|
25
36
|
return;
|
|
26
37
|
}
|
|
27
|
-
t.dataTransfer.setData(
|
|
38
|
+
t.dataTransfer.setData(o, JSON.stringify({ data: r, group: a })), t.dataTransfer.effectAllowed = "move", f(!0), c?.(r);
|
|
28
39
|
},
|
|
29
|
-
[
|
|
30
|
-
)
|
|
31
|
-
|
|
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
|
-
|
|
48
|
+
i.current = t, typeof n == "function" ? n(t) : n && (n.current = t);
|
|
36
49
|
},
|
|
37
|
-
draggable: !
|
|
38
|
-
onDragStart:
|
|
39
|
-
onDragEnd:
|
|
40
|
-
className: `nice-draggable ${
|
|
41
|
-
style:
|
|
42
|
-
"data-testid":
|
|
43
|
-
children:
|
|
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
|
-
|
|
64
|
+
o as NICE_DRAG_MIME,
|
|
65
|
+
j as NiceDraggable,
|
|
66
|
+
$ as readNiceDrag
|
|
52
67
|
};
|
|
@@ -1,62 +1,80 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
const
|
|
4
|
-
function
|
|
5
|
-
items:
|
|
6
|
-
keyField:
|
|
7
|
-
onReorder:
|
|
8
|
-
renderItem:
|
|
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:
|
|
11
|
-
group:
|
|
12
|
-
disabled:
|
|
13
|
-
className:
|
|
14
|
-
style:
|
|
15
|
-
"data-testid":
|
|
10
|
+
handle: g,
|
|
11
|
+
group: L,
|
|
12
|
+
disabled: d,
|
|
13
|
+
className: S,
|
|
14
|
+
style: E,
|
|
15
|
+
"data-testid": I
|
|
16
16
|
}) {
|
|
17
|
-
const [
|
|
18
|
-
if (
|
|
19
|
-
|
|
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 (
|
|
23
|
-
|
|
22
|
+
if (g && !n.target.closest(g)) {
|
|
23
|
+
n.preventDefault();
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
},
|
|
28
|
-
t.
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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" && (
|
|
77
|
+
process.env.NODE_ENV !== "production" && (j.displayName = "NiceSortable");
|
|
60
78
|
export {
|
|
61
|
-
|
|
79
|
+
j as NiceSortable
|
|
62
80
|
};
|
|
@@ -1,92 +1,107 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useNiceTranslation as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
const
|
|
5
|
-
|
|
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:
|
|
8
|
-
onInterim:
|
|
9
|
-
language:
|
|
10
|
-
continuous:
|
|
11
|
-
disabled:
|
|
12
|
-
label:
|
|
13
|
-
activeLabel:
|
|
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
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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 (
|
|
23
|
-
|
|
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 =
|
|
28
|
-
let
|
|
29
|
-
for (let i =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}, e.onerror = (
|
|
33
|
-
|
|
34
|
-
|
|
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 (!
|
|
37
|
-
return /* @__PURE__ */
|
|
51
|
+
if (!k)
|
|
52
|
+
return /* @__PURE__ */ l(
|
|
38
53
|
"div",
|
|
39
54
|
{
|
|
40
|
-
ref:
|
|
41
|
-
className: `nice-speechtotext nice-speechtotext--unsupported ${
|
|
42
|
-
style:
|
|
43
|
-
"data-testid":
|
|
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:
|
|
50
|
-
"aria-label":
|
|
64
|
+
title: t("speechToText.notSupported", "Speech recognition not supported"),
|
|
65
|
+
"aria-label": t("speechToText.notSupported", "Speech recognition not supported"),
|
|
51
66
|
children: [
|
|
52
|
-
/* @__PURE__ */
|
|
67
|
+
/* @__PURE__ */ l(R, { name: "mic", size: "sm" }),
|
|
53
68
|
f && /* @__PURE__ */ s("span", { children: [
|
|
54
69
|
" ",
|
|
55
|
-
|
|
70
|
+
t("speechToText.notSupportedShort", "Not Supported")
|
|
56
71
|
] })
|
|
57
72
|
]
|
|
58
73
|
}
|
|
59
74
|
)
|
|
60
75
|
}
|
|
61
76
|
);
|
|
62
|
-
const
|
|
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:
|
|
67
|
-
className: `nice-speechtotext ${
|
|
68
|
-
style:
|
|
69
|
-
"data-testid":
|
|
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 ${
|
|
75
|
-
onClick:
|
|
76
|
-
disabled:
|
|
77
|
-
"aria-label":
|
|
78
|
-
"aria-pressed":
|
|
79
|
-
title:
|
|
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__ */
|
|
96
|
+
/* @__PURE__ */ l(R, { name: "mic", size: "sm" }),
|
|
82
97
|
f && /* @__PURE__ */ s("span", { children: [
|
|
83
98
|
" ",
|
|
84
|
-
|
|
99
|
+
d
|
|
85
100
|
] })
|
|
86
101
|
]
|
|
87
102
|
}
|
|
88
103
|
),
|
|
89
|
-
|
|
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
|
);
|