@nice2dev/ui 1.4.24 → 1.4.26
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 +51 -0
- package/README.md +2 -4
- package/dist/NiceModuleLifecyclePanel-bsHwj1pO.cjs +1 -0
- package/dist/{NiceStreamDashboard.doc-74KUXya1.cjs → NiceStreamDashboard.doc-CdkHFf4Y.cjs} +2 -2
- package/dist/demo/docs/docPreviews.mjs +347 -373
- package/dist/demo/docs/docRegistry.mjs +4 -59
- package/dist/docs/NiceStreamDashboard.doc.json.mjs +1 -1
- package/dist/documentation/utils.mjs +1 -1
- package/dist/index.cjs +94 -113
- package/dist/index.d.ts +5 -45
- package/dist/index.mjs +778 -780
- package/dist/navigation/NiceDock.mjs +55 -48
- package/dist/navigation/NiceMenuTypes.mjs +197 -251
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.d.ts +5 -16
- package/dist/navigation.mjs +53 -54
- package/dist/style.css +2 -2
- package/dist/tools/NiceShowcase.mjs +1 -2
- package/package.json +4 -4
- package/dist/NiceDiagram.doc-CASS0Tnj.cjs +0 -8
- package/dist/NiceModuleLifecyclePanel-jckyVqqt.cjs +0 -1
- package/dist/docs/NiceDiagram.doc.json.mjs +0 -32
- package/dist/tools/NiceChat.mjs +0 -98
|
@@ -1,76 +1,83 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useControlId as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
const
|
|
5
|
-
/* @__PURE__ */
|
|
1
|
+
import { jsx as s, jsxs as y } from "react/jsx-runtime";
|
|
2
|
+
import { useControlId as C, useNiceTranslation as w, useRovingFocus as z } from "@nice2dev/ui-core";
|
|
3
|
+
import { forwardRef as B, useState as i, useCallback as L, useRef as O } from "react";
|
|
4
|
+
const W = [], Y = /* @__PURE__ */ Object.assign(
|
|
5
|
+
/* @__PURE__ */ B(
|
|
6
6
|
({
|
|
7
|
-
items:
|
|
8
|
-
position:
|
|
9
|
-
size:
|
|
10
|
-
magnify:
|
|
11
|
-
magnifyScale:
|
|
12
|
-
activeKey:
|
|
13
|
-
onItemClick:
|
|
14
|
-
contained:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
7
|
+
items: k = W,
|
|
8
|
+
position: n = "bottom",
|
|
9
|
+
size: h = "md",
|
|
10
|
+
magnify: d = !0,
|
|
11
|
+
magnifyScale: r = 1.5,
|
|
12
|
+
activeKey: v,
|
|
13
|
+
onItemClick: _,
|
|
14
|
+
contained: m = !1,
|
|
15
|
+
autoHide: t = !1,
|
|
16
|
+
className: N,
|
|
17
|
+
style: g,
|
|
18
|
+
id: $,
|
|
19
|
+
...M
|
|
20
|
+
}, p) => {
|
|
21
|
+
const I = C($), { t: T } = w(), [l, c] = i(null), [x, u] = i(!1), [D, b] = i(!1), E = t && !x && !D, F = L(
|
|
21
22
|
(e) => {
|
|
22
|
-
if (!
|
|
23
|
+
if (!d || l === null)
|
|
23
24
|
return 1;
|
|
24
25
|
const o = Math.abs(e - l);
|
|
25
|
-
return o === 0 ?
|
|
26
|
+
return o === 0 ? r : o === 1 ? 1 + (r - 1) * 0.5 : o === 2 ? 1 + (r - 1) * 0.2 : 1;
|
|
26
27
|
},
|
|
27
|
-
[
|
|
28
|
-
), a =
|
|
29
|
-
|
|
28
|
+
[d, l, r]
|
|
29
|
+
), a = n === "left" || n === "right", f = O(null);
|
|
30
|
+
z(f, {
|
|
30
31
|
orientation: a ? "vertical" : "horizontal",
|
|
31
32
|
itemSelector: "button"
|
|
32
33
|
});
|
|
33
|
-
const
|
|
34
|
-
return /* @__PURE__ */
|
|
34
|
+
const R = n === "left" ? "left center" : n === "right" ? "right center" : "bottom center";
|
|
35
|
+
return /* @__PURE__ */ s(
|
|
35
36
|
"div",
|
|
36
37
|
{
|
|
37
|
-
ref:
|
|
38
|
-
id:
|
|
39
|
-
className: `nice-dock nice-dock--${
|
|
40
|
-
style:
|
|
38
|
+
ref: p,
|
|
39
|
+
id: I,
|
|
40
|
+
className: `nice-dock nice-dock--${n} nice-dock--${h}${m ? " nice-dock--contained" : ""}${E ? " nice-dock--hidden" : ""} ${N ?? ""}`,
|
|
41
|
+
style: g,
|
|
42
|
+
onMouseEnter: t ? () => u(!0) : void 0,
|
|
43
|
+
onMouseLeave: t ? () => u(!1) : void 0,
|
|
44
|
+
onFocus: t ? () => b(!0) : void 0,
|
|
45
|
+
onBlur: t ? (e) => {
|
|
46
|
+
e.currentTarget.contains(e.relatedTarget) || b(!1);
|
|
47
|
+
} : void 0,
|
|
41
48
|
role: "toolbar",
|
|
42
|
-
"aria-label":
|
|
49
|
+
"aria-label": T("dock.label", "Dock"),
|
|
43
50
|
"aria-orientation": a ? "vertical" : "horizontal",
|
|
44
|
-
...
|
|
45
|
-
children: /* @__PURE__ */
|
|
51
|
+
...M,
|
|
52
|
+
children: /* @__PURE__ */ s(
|
|
46
53
|
"div",
|
|
47
54
|
{
|
|
48
|
-
ref:
|
|
55
|
+
ref: f,
|
|
49
56
|
className: "nice-dock__bar",
|
|
50
57
|
style: { flexDirection: a ? "column" : "row" },
|
|
51
|
-
children:
|
|
52
|
-
const
|
|
53
|
-
return /* @__PURE__ */
|
|
58
|
+
children: k.map((e, o) => {
|
|
59
|
+
const j = F(o);
|
|
60
|
+
return /* @__PURE__ */ y(
|
|
54
61
|
"button",
|
|
55
62
|
{
|
|
56
63
|
type: "button",
|
|
57
|
-
className: `nice-dock__item ${
|
|
64
|
+
className: `nice-dock__item ${v === e.key ? "nice-dock__item--active" : ""} ${e.disabled ? "nice-dock__item--disabled" : ""}`,
|
|
58
65
|
style: {
|
|
59
|
-
transform: `scale(${
|
|
60
|
-
transformOrigin:
|
|
66
|
+
transform: `scale(${j})`,
|
|
67
|
+
transformOrigin: R,
|
|
61
68
|
transition: "transform 0.15s ease-out"
|
|
62
69
|
},
|
|
63
70
|
disabled: e.disabled,
|
|
64
|
-
onClick: () =>
|
|
65
|
-
onMouseEnter: () =>
|
|
66
|
-
onMouseLeave: () =>
|
|
67
|
-
onFocus: () =>
|
|
68
|
-
onBlur: () =>
|
|
71
|
+
onClick: () => _?.(e.key),
|
|
72
|
+
onMouseEnter: () => c(o),
|
|
73
|
+
onMouseLeave: () => c(null),
|
|
74
|
+
onFocus: () => c(o),
|
|
75
|
+
onBlur: () => c(null),
|
|
69
76
|
"aria-label": e.label,
|
|
70
77
|
title: e.label,
|
|
71
78
|
children: [
|
|
72
|
-
/* @__PURE__ */
|
|
73
|
-
e.badge !== void 0 && /* @__PURE__ */
|
|
79
|
+
/* @__PURE__ */ s("span", { className: "nice-dock__icon", children: e.icon }),
|
|
80
|
+
e.badge !== void 0 && /* @__PURE__ */ s("span", { className: "nice-dock__badge", children: e.badge })
|
|
74
81
|
]
|
|
75
82
|
},
|
|
76
83
|
e.key
|
|
@@ -85,5 +92,5 @@ const w = [], B = /* @__PURE__ */ Object.assign(
|
|
|
85
92
|
{ displayName: "NiceDock" }
|
|
86
93
|
);
|
|
87
94
|
export {
|
|
88
|
-
|
|
95
|
+
Y as NiceDock
|
|
89
96
|
};
|