prometeo-design-system 4.6.5 → 4.7.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.
- package/dist/Header.es.js +22 -22
- package/dist/IconButton.es.js +124 -77
- package/dist/Icons/AccountCircle.es.js +1 -1
- package/dist/Icons/Add.es.js +1 -1
- package/dist/Icons/ArrowDownward.es.js +1 -1
- package/dist/Icons/ArrowLeft.es.js +1 -1
- package/dist/Icons/ArrowUpDown.es.js +1 -1
- package/dist/Icons/ArrowUpward.es.js +1 -1
- package/dist/Icons/AttachFile.es.js +1 -1
- package/dist/Icons/Boards.es.js +1 -1
- package/dist/Icons/Calendar.es.js +1 -1
- package/dist/Icons/Cancel.es.js +1 -1
- package/dist/Icons/Check.es.js +1 -1
- package/dist/Icons/CheckCircle.es.js +1 -1
- package/dist/Icons/CheckList.es.js +1 -1
- package/dist/Icons/ChevronDown.es.js +1 -1
- package/dist/Icons/Clock.es.js +1 -1
- package/dist/Icons/Close.es.js +1 -1
- package/dist/Icons/CloseNavBarDesktop.es.js +1 -1
- package/dist/Icons/Collapse.es.js +1 -1
- package/dist/Icons/Company.es.js +1 -1
- package/dist/Icons/Copy.es.js +1 -1
- package/dist/Icons/CrevronLeft.es.js +1 -1
- package/dist/Icons/CrevronRight.es.js +1 -1
- package/dist/Icons/DocumentFill.es.js +1 -1
- package/dist/Icons/Download.es.js +1 -1
- package/dist/Icons/DragIndicator.es.js +1 -1
- package/dist/Icons/Edit.es.js +1 -1
- package/dist/Icons/EditFill.es.js +1 -1
- package/dist/Icons/Email.es.js +1 -1
- package/dist/Icons/Error.es.js +1 -1
- package/dist/Icons/EyeVisibility.es.js +1 -1
- package/dist/Icons/EyeVisibilityOff.es.js +1 -1
- package/dist/Icons/FaLock.es.js +1 -1
- package/dist/Icons/FastForward.es.js +1 -1
- package/dist/Icons/File.es.js +1 -1
- package/dist/Icons/Filter.es.js +1 -1
- package/dist/Icons/FormatColorText.es.js +1 -1
- package/dist/Icons/Help.es.js +1 -1
- package/dist/Icons/HistoryActivity.es.js +1 -1
- package/dist/Icons/Home.es.js +1 -1
- package/dist/Icons/Image.es.js +1 -1
- package/dist/Icons/Info.es.js +1 -1
- package/dist/Icons/Logout.es.js +1 -1
- package/dist/Icons/MessageSquare.es.js +1 -1
- package/dist/Icons/MessageSquareFill.es.js +1 -1
- package/dist/Icons/MoreVert.es.js +1 -1
- package/dist/Icons/Notifications.es.js +1 -1
- package/dist/Icons/Pause.es.js +1 -1
- package/dist/Icons/Reassignment.es.js +1 -1
- package/dist/Icons/ReassignmentFill.es.js +1 -1
- package/dist/Icons/Reload.es.js +1 -1
- package/dist/Icons/Search.es.js +1 -1
- package/dist/Icons/Send.es.js +1 -1
- package/dist/Icons/Settings.es.js +1 -1
- package/dist/Icons/Shared.es.js +1 -1
- package/dist/Icons/Sort.es.js +1 -1
- package/dist/Icons/StarFill.es.js +1 -1
- package/dist/Icons/Stars.es.js +1 -1
- package/dist/Icons/Ticket.es.js +1 -1
- package/dist/Icons/TicketFilled.es.js +1 -1
- package/dist/Icons/Trash.es.js +1 -1
- package/dist/Icons/TrashFill.es.js +1 -1
- package/dist/Icons/Upload.es.js +1 -1
- package/dist/Icons/UploadCloud.es.js +1 -1
- package/dist/Icons/UserAdd.es.js +1 -1
- package/dist/Icons/UserAddFill.es.js +1 -1
- package/dist/Icons/UserAvatar.es.js +1 -1
- package/dist/Icons/UserPerson.es.js +1 -1
- package/dist/Icons/WhatsApp.es.js +1 -1
- package/dist/Icons/iconUtils.d.ts +2 -0
- package/dist/PyrionLayout.es.js +764 -745
- package/dist/Scrollable.es.js +136 -133
- package/dist/Skeleton.es.js +1 -1
- package/dist/assets/DialogModal.png +0 -0
- package/dist/assets/Header.png +0 -0
- package/dist/components/Header/Header.d.ts +2 -1
- package/dist/components/IconButton/IconButton.d.ts +1 -1
- package/dist/components/PyrionNavigationDrawer/PLNotificationsList.d.ts +4 -1
- package/dist/components/PyrionNavigationDrawer/PLNotificationsLoader.d.ts +6 -0
- package/dist/components/PyrionNavigationDrawer/PyrionLayout.d.ts +3 -1
- package/dist/components/Scrollable/Scrollable.d.ts +2 -0
- package/dist/iconUtils-rTOfKDxE.js +9 -0
- package/package.json +1 -1
- package/dist/iconUtils-D0lVAgGT.js +0 -5
package/dist/Scrollable.es.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { j as y } from "./jsx-runtime-DKDX3adD.js";
|
|
2
|
-
import { u as
|
|
3
|
-
import { g as
|
|
2
|
+
import { u as Rt } from "./useDevice-vwn4GLwK.js";
|
|
3
|
+
import { g as vt, r as q } from "./useLabelBackground-D5SzHhl_.js";
|
|
4
4
|
import { c as M } from "./cn-B6yFEsav.js";
|
|
5
|
-
import { c as
|
|
6
|
-
import
|
|
7
|
-
import { CrevronLeft as
|
|
8
|
-
const
|
|
5
|
+
import { c as X } from "./index-BOQuZ0gG.js";
|
|
6
|
+
import yt, { useRef as i, useState as Bt, useCallback as C, useImperativeHandle as $t, useLayoutEffect as Ot, useEffect as Wt } from "react";
|
|
7
|
+
import { CrevronLeft as Tt } from "./Icons/CrevronLeft.es.js";
|
|
8
|
+
const wt = X(
|
|
9
9
|
"",
|
|
10
10
|
{
|
|
11
11
|
variants: {
|
|
@@ -16,7 +16,7 @@ const vt = K(
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
),
|
|
19
|
+
), xt = X("", {
|
|
20
20
|
variants: {
|
|
21
21
|
position: {
|
|
22
22
|
top: "",
|
|
@@ -39,7 +39,7 @@ const vt = K(
|
|
|
39
39
|
{ type: "shadow", position: "left", className: "left-0 top-0 h-full w-5" },
|
|
40
40
|
{ type: "shadow", position: "right", className: "right-0 top-0 h-full w-5 rotate-180" }
|
|
41
41
|
]
|
|
42
|
-
}),
|
|
42
|
+
}), Vt = X("", {
|
|
43
43
|
variants: {
|
|
44
44
|
hide: {
|
|
45
45
|
true: " prometeo-scrollbar-none",
|
|
@@ -50,27 +50,28 @@ const vt = K(
|
|
|
50
50
|
medium: ""
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
}),
|
|
54
|
-
const { defaultBehavior:
|
|
55
|
-
top: { show: !0, type: "shadow", behavior:
|
|
56
|
-
bottom: { show: !0, type: "shadow", behavior:
|
|
57
|
-
left: { show: !0, type: "icon", behavior:
|
|
58
|
-
right: { show: !0, type: "icon", behavior:
|
|
59
|
-
},
|
|
53
|
+
}), Gt = (Y) => {
|
|
54
|
+
const { defaultBehavior: A = "scroll-on-click" } = Y, St = Rt(), G = {
|
|
55
|
+
top: { show: !0, type: "shadow", behavior: A },
|
|
56
|
+
bottom: { show: !0, type: "shadow", behavior: A },
|
|
57
|
+
left: { show: !0, type: "icon", behavior: A },
|
|
58
|
+
right: { show: !0, type: "icon", behavior: A }
|
|
59
|
+
}, Q = {
|
|
60
60
|
hide: !1,
|
|
61
61
|
size: "medium"
|
|
62
62
|
}, {
|
|
63
|
-
debugMode:
|
|
64
|
-
className:
|
|
63
|
+
debugMode: Lt = !1,
|
|
64
|
+
className: Z,
|
|
65
65
|
axis: v = "both",
|
|
66
|
-
children:
|
|
67
|
-
indicators:
|
|
68
|
-
scrollbarProps:
|
|
69
|
-
disableMouseScroll:
|
|
70
|
-
persistScroll:
|
|
71
|
-
controls:
|
|
72
|
-
scrollTopButton: w
|
|
73
|
-
|
|
66
|
+
children: Mt,
|
|
67
|
+
indicators: Nt = G,
|
|
68
|
+
scrollbarProps: Et = Q,
|
|
69
|
+
disableMouseScroll: tt = !1,
|
|
70
|
+
persistScroll: j = !1,
|
|
71
|
+
controls: It,
|
|
72
|
+
scrollTopButton: w,
|
|
73
|
+
scrollMetadata: R
|
|
74
|
+
} = Y, c = i({}), n = i(null), u = i(null), N = i(null), a = i(null), f = i(5), d = i({}), D = i(null), g = i(!1), et = i(!1), B = i(null), P = i(null), [kt, Ct] = Bt(!1), H = { ...G, ...Nt }, rt = { ...Q, ...Et }, z = i([]), ot = i(/* @__PURE__ */ new Map()), nt = i({ scrollTop: 0, scrollLeft: 0 }), F = (t) => {
|
|
74
75
|
if (!n.current) return 0;
|
|
75
76
|
const { scrollTop: r, scrollLeft: e, scrollHeight: o, clientHeight: s, scrollWidth: l, clientWidth: h } = n.current;
|
|
76
77
|
switch (t) {
|
|
@@ -85,7 +86,7 @@ const vt = K(
|
|
|
85
86
|
default:
|
|
86
87
|
return 0;
|
|
87
88
|
}
|
|
88
|
-
},
|
|
89
|
+
}, st = C((t) => {
|
|
89
90
|
if (!t || !n.current) return 0;
|
|
90
91
|
const { clientHeight: r, scrollHeight: e } = n.current;
|
|
91
92
|
if (t.includes("%")) {
|
|
@@ -98,21 +99,21 @@ const vt = K(
|
|
|
98
99
|
return parseFloat(t.replace("vh", "")) / 100 * window.innerHeight;
|
|
99
100
|
}
|
|
100
101
|
return 0;
|
|
101
|
-
}, []),
|
|
102
|
+
}, []), lt = C(() => {
|
|
102
103
|
if (!n.current || !w) return;
|
|
103
|
-
const { scrollTop: t } = n.current, r =
|
|
104
|
-
|
|
105
|
-
}, [w,
|
|
104
|
+
const { scrollTop: t } = n.current, r = st(w.target || "40vh");
|
|
105
|
+
Ct(t >= r);
|
|
106
|
+
}, [w, st]), ct = C(() => {
|
|
106
107
|
if (!n.current) return { x: 0, y: 0 };
|
|
107
108
|
const { scrollTop: t, scrollLeft: r, scrollHeight: e, scrollWidth: o, clientHeight: s, clientWidth: l } = n.current, h = Math.max(0, e - s), m = Math.max(0, o - l), T = h > 0 ? t / h * 100 : 0;
|
|
108
109
|
return { x: m > 0 ? r / m * 100 : 0, y: T };
|
|
109
|
-
}, []),
|
|
110
|
-
const r =
|
|
110
|
+
}, []), at = C((t) => {
|
|
111
|
+
const r = nt.current;
|
|
111
112
|
let e = null;
|
|
112
|
-
return t.scrollTop > r.scrollTop ? e = "down" : t.scrollTop < r.scrollTop ? e = "up" : t.scrollLeft > r.scrollLeft ? e = "right" : t.scrollLeft < r.scrollLeft && (e = "left"),
|
|
113
|
-
}, []),
|
|
113
|
+
return t.scrollTop > r.scrollTop ? e = "down" : t.scrollTop < r.scrollTop ? e = "up" : t.scrollLeft > r.scrollLeft ? e = "right" : t.scrollLeft < r.scrollLeft && (e = "left"), nt.current = t, e;
|
|
114
|
+
}, []), it = C((t) => {
|
|
114
115
|
if (!n.current) return;
|
|
115
|
-
const { scrollTop: r, scrollLeft: e, scrollHeight: o, scrollWidth: s, clientHeight: l, clientWidth: h } = n.current, m =
|
|
116
|
+
const { scrollTop: r, scrollLeft: e, scrollHeight: o, scrollWidth: s, clientHeight: l, clientWidth: h } = n.current, m = at(t), { x: T, y: S } = ct(), L = {
|
|
116
117
|
percentage: S,
|
|
117
118
|
direction: m,
|
|
118
119
|
scrollTop: r,
|
|
@@ -120,8 +121,9 @@ const vt = K(
|
|
|
120
121
|
scrollHeight: o,
|
|
121
122
|
scrollWidth: s,
|
|
122
123
|
clientHeight: l,
|
|
123
|
-
clientWidth: h
|
|
124
|
-
|
|
124
|
+
clientWidth: h,
|
|
125
|
+
metadata: R
|
|
126
|
+
}, J = {
|
|
125
127
|
percentage: T,
|
|
126
128
|
direction: m,
|
|
127
129
|
scrollTop: r,
|
|
@@ -129,51 +131,52 @@ const vt = K(
|
|
|
129
131
|
scrollHeight: o,
|
|
130
132
|
scrollWidth: s,
|
|
131
133
|
clientHeight: l,
|
|
132
|
-
clientWidth: h
|
|
134
|
+
clientWidth: h,
|
|
135
|
+
metadata: R
|
|
133
136
|
};
|
|
134
|
-
|
|
135
|
-
const { config: b, triggered:
|
|
137
|
+
z.current.forEach((p) => {
|
|
138
|
+
const { config: b, triggered: O } = p;
|
|
136
139
|
if (!b) {
|
|
137
|
-
(v === "y" || v === "both") && p.callback(L), (v === "x" || v === "both") && p.callback(
|
|
140
|
+
(v === "y" || v === "both") && p.callback(L), (v === "x" || v === "both") && p.callback(J);
|
|
138
141
|
return;
|
|
139
142
|
}
|
|
140
|
-
const
|
|
141
|
-
if (!
|
|
142
|
-
const E = (
|
|
143
|
+
const K = (b.direction === "y" || b.direction === "both") && (v === "y" || v === "both"), bt = (b.direction === "x" || b.direction === "both") && (v === "x" || v === "both");
|
|
144
|
+
if (!K && !bt) return;
|
|
145
|
+
const E = (K ? L : J).percentage, I = b.target * 100;
|
|
143
146
|
let k = !1;
|
|
144
147
|
if (b.trip === "forth")
|
|
145
|
-
k =
|
|
148
|
+
k = !O && E >= I, k && (p.triggered = !0), O && E < I && (p.triggered = !1);
|
|
146
149
|
else if (b.trip === "back")
|
|
147
|
-
k =
|
|
150
|
+
k = O && E < I, k && (p.triggered = !1), !O && E >= I && (p.triggered = !0);
|
|
148
151
|
else if (b.trip === "round-trip") {
|
|
149
|
-
const
|
|
150
|
-
k = p.triggered !==
|
|
152
|
+
const W = E >= I;
|
|
153
|
+
k = p.triggered !== W;
|
|
151
154
|
}
|
|
152
155
|
if (k) {
|
|
153
|
-
const
|
|
154
|
-
if (
|
|
156
|
+
const W = `${z.current.indexOf(p)}-${b?.target || 0}-${b?.direction || "y"}`, V = Date.now(), At = ot.current.get(W) || 0;
|
|
157
|
+
if (V - At < 500)
|
|
155
158
|
return;
|
|
156
|
-
b.trip === "round-trip" && (p.triggered = E >= I, p.lastDirection = m || void 0),
|
|
159
|
+
b.trip === "round-trip" && (p.triggered = E >= I, p.lastDirection = m || void 0), ot.current.set(W, V), p.lastTriggerTime = V, K ? p.callback(L) : bt && p.callback(J);
|
|
157
160
|
}
|
|
158
161
|
});
|
|
159
|
-
}, [v,
|
|
162
|
+
}, [v, at, ct, R]), ut = C((t, r) => {
|
|
160
163
|
const e = {
|
|
161
164
|
callback: t,
|
|
162
165
|
config: r,
|
|
163
166
|
triggered: !1,
|
|
164
167
|
lastDirection: void 0
|
|
165
168
|
};
|
|
166
|
-
return
|
|
167
|
-
const o =
|
|
168
|
-
o > -1 &&
|
|
169
|
+
return z.current.push(e), () => {
|
|
170
|
+
const o = z.current.indexOf(e);
|
|
171
|
+
o > -1 && z.current.splice(o, 1);
|
|
169
172
|
};
|
|
170
173
|
}, []);
|
|
171
|
-
|
|
172
|
-
subscribeToScrollTarget:
|
|
173
|
-
}), [
|
|
174
|
-
const
|
|
174
|
+
$t(It, () => ({
|
|
175
|
+
subscribeToScrollTarget: ut
|
|
176
|
+
}), [ut]);
|
|
177
|
+
const $ = (t, r = 100, e = !0) => {
|
|
175
178
|
if (!n.current) return;
|
|
176
|
-
const o =
|
|
179
|
+
const o = F(t), s = Math.min(Math.abs(r), o);
|
|
177
180
|
if (s === 0) return;
|
|
178
181
|
const l = t === "top" || t === "left" ? -s : s, h = {
|
|
179
182
|
top: { top: l, left: 0 },
|
|
@@ -182,7 +185,7 @@ const vt = K(
|
|
|
182
185
|
right: { top: 0, left: l }
|
|
183
186
|
};
|
|
184
187
|
n.current.scrollBy({ ...h[t], behavior: e ? "smooth" : "auto" });
|
|
185
|
-
},
|
|
188
|
+
}, jt = (t) => {
|
|
186
189
|
if (!n.current) return;
|
|
187
190
|
const r = n.current, e = {
|
|
188
191
|
top: { top: 0, left: r.scrollLeft },
|
|
@@ -191,17 +194,17 @@ const vt = K(
|
|
|
191
194
|
right: { top: r.scrollTop, left: r.scrollWidth }
|
|
192
195
|
};
|
|
193
196
|
r.scrollTo({ ...e[t], behavior: "smooth" });
|
|
194
|
-
},
|
|
197
|
+
}, Dt = () => {
|
|
195
198
|
n.current && n.current.scrollTo({ top: 0, behavior: "smooth" });
|
|
196
|
-
},
|
|
199
|
+
}, Pt = (t, r) => {
|
|
197
200
|
const e = c.current[t];
|
|
198
201
|
if (e) {
|
|
199
202
|
if (e.style.cursor = "pointer", r === "icon") {
|
|
200
203
|
const o = e.querySelector("svg");
|
|
201
204
|
o && (o.style.transition = "all 0.3s ease-in-out", o.style.transform = "scale(1.3)", o.style.backgroundColor = "rgba(255, 255, 255, 0.2)", o.style.borderRadius = "100%");
|
|
202
205
|
} else if (r === "shadow") {
|
|
203
|
-
const o = e.querySelector("span"), s =
|
|
204
|
-
o && (t === "top" || t === "bottom" ? (o.style.height = "110px", o.style.background = `linear-gradient(to bottom, ${s} 5%, ${
|
|
206
|
+
const o = e.querySelector("span"), s = vt(n.current);
|
|
207
|
+
o && (t === "top" || t === "bottom" ? (o.style.height = "110px", o.style.background = `linear-gradient(to bottom, ${s} 5%, ${q(s, -2)} 10%, ${q(s, -5, 30)} 70%, transparent)`, o.style.animation = "scrollToEndPulse 3.5s ease-out", setTimeout(() => {
|
|
205
208
|
o.style.animation = "";
|
|
206
209
|
}, 3500)) : (o.style.width = "40px", o.style.animation = "scrollToEndPulseVertical 1.5s ease-out", setTimeout(() => {
|
|
207
210
|
o.style.animation = "";
|
|
@@ -216,87 +219,87 @@ const vt = K(
|
|
|
216
219
|
e && (e.style.transform = "", e.style.backgroundColor = "", e.style.borderRadius = "");
|
|
217
220
|
const o = r.querySelector("span");
|
|
218
221
|
o && (o.style.height = "", o.style.width = "");
|
|
219
|
-
},
|
|
222
|
+
}, ft = (t, r) => {
|
|
220
223
|
if (r === "scroll-on-click" && g.current) {
|
|
221
224
|
g.current = !1;
|
|
222
225
|
return;
|
|
223
226
|
}
|
|
224
227
|
if (d.current[t]) {
|
|
225
|
-
a.current && (clearTimeout(a.current), a.current = null), u.current && (clearInterval(u.current), u.current = null), x(t), d.current[t] = !1,
|
|
228
|
+
a.current && (clearTimeout(a.current), a.current = null), u.current && (clearInterval(u.current), u.current = null), x(t), d.current[t] = !1, jt(t);
|
|
226
229
|
return;
|
|
227
230
|
}
|
|
228
231
|
if (r === "scroll-on-click") {
|
|
229
232
|
if (!n.current) return;
|
|
230
233
|
const { clientHeight: e, clientWidth: o } = n.current, s = t === "top" || t === "bottom" ? e * 0.8 : o * 0.8;
|
|
231
|
-
|
|
234
|
+
$(t, s);
|
|
232
235
|
}
|
|
233
|
-
},
|
|
236
|
+
}, dt = (t, r) => {
|
|
234
237
|
a.current && (clearTimeout(a.current), a.current = null), g.current = !0, f.current = 3;
|
|
235
238
|
let e = 0;
|
|
236
|
-
|
|
239
|
+
D.current = t, d.current[t] = !1, $(t, f.current, !1), u.current = setInterval(() => {
|
|
237
240
|
e += 16;
|
|
238
241
|
const o = e / 1e3;
|
|
239
|
-
if (
|
|
240
|
-
|
|
242
|
+
if (F(t) === 0) {
|
|
243
|
+
U(t);
|
|
241
244
|
return;
|
|
242
245
|
}
|
|
243
|
-
if (o >= 2 && !d.current[t] && (d.current[t] = !0,
|
|
246
|
+
if (o >= 2 && !d.current[t] && (d.current[t] = !0, Pt(t, r)), o <= 2)
|
|
244
247
|
f.current = 5 + o * 0.4;
|
|
245
248
|
else {
|
|
246
249
|
const l = o - 2;
|
|
247
250
|
f.current += Math.pow(l, 1.1) * 2;
|
|
248
251
|
}
|
|
249
|
-
f.current = Math.min(f.current, 100),
|
|
252
|
+
f.current = Math.min(f.current, 100), $(t, f.current, !1);
|
|
250
253
|
}, 16);
|
|
251
|
-
},
|
|
254
|
+
}, U = (t, r = !1) => {
|
|
252
255
|
N.current && (clearTimeout(N.current), N.current = null);
|
|
253
|
-
const e = t ||
|
|
256
|
+
const e = t || D.current;
|
|
254
257
|
if (!r && e && u.current) {
|
|
255
258
|
let o = 0;
|
|
256
259
|
const s = f.current, l = 800, h = setInterval(() => {
|
|
257
260
|
o += 16;
|
|
258
261
|
const m = o / l, T = 1 - Math.pow(1 - m, 3);
|
|
259
|
-
if (f.current = s * (1 - T),
|
|
262
|
+
if (f.current = s * (1 - T), F(e) === 0 || f.current <= 0.5) {
|
|
260
263
|
clearInterval(h), u.current && (clearInterval(u.current), u.current = null), f.current = 5, e ? d.current[e] ? (a.current && clearTimeout(a.current), a.current = setTimeout(() => {
|
|
261
264
|
x(e), d.current[e] = !1, g.current = !1;
|
|
262
|
-
}, 1e3)) : (x(e), d.current[e] = !1, g.current = !1) : g.current = !1,
|
|
265
|
+
}, 1e3)) : (x(e), d.current[e] = !1, g.current = !1) : g.current = !1, D.current = null;
|
|
263
266
|
return;
|
|
264
267
|
}
|
|
265
|
-
|
|
268
|
+
$(e, f.current, !1);
|
|
266
269
|
}, 16);
|
|
267
270
|
N.current = setTimeout(() => {
|
|
268
271
|
clearInterval(h), u.current && (clearInterval(u.current), u.current = null), f.current = 5, e ? d.current[e] ? (a.current && clearTimeout(a.current), a.current = setTimeout(() => {
|
|
269
272
|
x(e), d.current[e] = !1, g.current = !1;
|
|
270
|
-
}, 1e3)) : (x(e), d.current[e] = !1, g.current = !1) : g.current = !1,
|
|
273
|
+
}, 1e3)) : (x(e), d.current[e] = !1, g.current = !1) : g.current = !1, D.current = null;
|
|
271
274
|
}, l);
|
|
272
275
|
} else
|
|
273
276
|
u.current && (clearInterval(u.current), u.current = null), f.current = 5, e ? d.current[e] ? (a.current && clearTimeout(a.current), a.current = setTimeout(() => {
|
|
274
277
|
x(e), d.current[e] = !1, g.current = !1;
|
|
275
|
-
}, 1e3)) : (x(e), d.current[e] = !1, g.current = !1) : g.current = !1,
|
|
276
|
-
},
|
|
277
|
-
|
|
278
|
-
|
|
278
|
+
}, 1e3)) : (x(e), d.current[e] = !1, g.current = !1) : g.current = !1, D.current = null;
|
|
279
|
+
}, ht = (t, r, e) => {
|
|
280
|
+
St || r === "scroll-on-hover" && (N.current = setTimeout(() => {
|
|
281
|
+
dt(t, e);
|
|
279
282
|
}, 200));
|
|
280
|
-
},
|
|
281
|
-
r === "scroll-on-hover" &&
|
|
282
|
-
},
|
|
283
|
+
}, pt = (t, r) => {
|
|
284
|
+
r === "scroll-on-hover" && U(t, !0);
|
|
285
|
+
}, gt = (t, r, e) => {
|
|
283
286
|
r === "scroll-on-click" && (g.current = !1, N.current = setTimeout(() => {
|
|
284
|
-
|
|
287
|
+
dt(t, e);
|
|
285
288
|
}, 200));
|
|
286
|
-
},
|
|
287
|
-
r === "scroll-on-click" &&
|
|
288
|
-
},
|
|
289
|
+
}, mt = (t, r) => {
|
|
290
|
+
r === "scroll-on-click" && U(t, !1);
|
|
291
|
+
}, _ = () => {
|
|
289
292
|
if (!n.current) return;
|
|
290
293
|
const t = n.current, { scrollTop: r, scrollLeft: e, scrollHeight: o, scrollWidth: s, clientHeight: l, clientWidth: h } = t, m = r <= 10, T = r + l >= o - 10, S = e <= 10, L = e + h >= s - 10;
|
|
291
294
|
c.current.top?.classList.toggle("opacity-0", m), c.current.top?.classList.toggle("pointer-events-none", m), c.current.top?.classList.toggle("pointer-events-auto", !m), c.current.bottom?.classList.toggle("opacity-0", T), c.current.bottom?.classList.toggle("pointer-events-none", T), c.current.bottom?.classList.toggle("pointer-events-auto", !T), c.current.left?.classList.toggle("opacity-0", S), c.current.left?.classList.toggle("pointer-events-none", S), c.current.left?.classList.toggle("pointer-events-auto", !S), c.current.right?.classList.toggle("opacity-0", L), c.current.right?.classList.toggle("pointer-events-none", L), c.current.right?.classList.toggle("pointer-events-auto", !L);
|
|
292
295
|
};
|
|
293
|
-
|
|
296
|
+
Ot(() => {
|
|
294
297
|
if (!n.current) return;
|
|
295
298
|
const t = n.current;
|
|
296
|
-
if (
|
|
297
|
-
|
|
299
|
+
if (j) {
|
|
300
|
+
B.current = typeof j == "string" ? `scrollable-${j}` : `scrollable-${Math.random().toString(36).substr(2, 9)}`;
|
|
298
301
|
try {
|
|
299
|
-
const o = sessionStorage.getItem(
|
|
302
|
+
const o = sessionStorage.getItem(B.current);
|
|
300
303
|
if (o) {
|
|
301
304
|
const { scrollTop: s, scrollLeft: l } = JSON.parse(o);
|
|
302
305
|
t.scrollTop = s, t.scrollLeft = l;
|
|
@@ -304,71 +307,71 @@ const vt = K(
|
|
|
304
307
|
} catch {
|
|
305
308
|
}
|
|
306
309
|
}
|
|
307
|
-
|
|
310
|
+
_(), et.current || (et.current = !0, requestAnimationFrame(() => {
|
|
308
311
|
Object.values(c.current).forEach((o) => {
|
|
309
312
|
o?.classList.add("transition-all", "duration-300");
|
|
310
313
|
}), setTimeout(() => {
|
|
311
|
-
|
|
314
|
+
_();
|
|
312
315
|
}, 0);
|
|
313
316
|
}));
|
|
314
317
|
const r = () => {
|
|
315
|
-
if (
|
|
318
|
+
if (_(), lt(), n.current) {
|
|
316
319
|
const o = {
|
|
317
320
|
scrollTop: n.current.scrollTop,
|
|
318
321
|
scrollLeft: n.current.scrollLeft
|
|
319
322
|
};
|
|
320
|
-
|
|
323
|
+
it(o);
|
|
321
324
|
}
|
|
322
|
-
|
|
325
|
+
j && B.current && (P.current && clearTimeout(P.current), P.current = setTimeout(() => {
|
|
323
326
|
try {
|
|
324
327
|
const o = {
|
|
325
328
|
scrollTop: t.scrollTop,
|
|
326
329
|
scrollLeft: t.scrollLeft
|
|
327
330
|
};
|
|
328
|
-
sessionStorage.setItem(
|
|
331
|
+
sessionStorage.setItem(B.current, JSON.stringify(o));
|
|
329
332
|
} catch {
|
|
330
333
|
}
|
|
331
334
|
}, 150));
|
|
332
335
|
};
|
|
333
336
|
t.addEventListener("scroll", r);
|
|
334
337
|
const e = (o) => {
|
|
335
|
-
|
|
338
|
+
tt && o.preventDefault();
|
|
336
339
|
};
|
|
337
340
|
return t.addEventListener("wheel", e, { passive: !1 }), () => {
|
|
338
|
-
t.removeEventListener("scroll", r), t.removeEventListener("wheel", e),
|
|
341
|
+
t.removeEventListener("scroll", r), t.removeEventListener("wheel", e), P.current && clearTimeout(P.current);
|
|
339
342
|
};
|
|
340
|
-
}, [
|
|
343
|
+
}, [tt, j, R, lt, it]), Wt(() => {
|
|
341
344
|
if (!n.current) return;
|
|
342
|
-
let t =
|
|
343
|
-
Object.entries(
|
|
345
|
+
let t = vt(n.current);
|
|
346
|
+
Object.entries(H).forEach(([r, e]) => {
|
|
344
347
|
if (e?.show && e.type === "shadow") {
|
|
345
348
|
const s = c.current[r]?.querySelector("span");
|
|
346
349
|
if (s) {
|
|
347
350
|
s.dataset.bgColor = t;
|
|
348
351
|
const l = r === "left" || r === "right" ? "to right" : "to bottom";
|
|
349
|
-
s.style.background = `linear-gradient(${l}, ${t} 5%, ${
|
|
352
|
+
s.style.background = `linear-gradient(${l}, ${t} 5%, ${q(t, 0)} 10%, ${q(t, -2, 30)} 70%, transparent)`;
|
|
350
353
|
}
|
|
351
354
|
}
|
|
352
355
|
});
|
|
353
|
-
}, [
|
|
354
|
-
const
|
|
355
|
-
return /* @__PURE__ */ y.jsxs("div", { className: M("relative p-0",
|
|
356
|
+
}, [H]);
|
|
357
|
+
const Ht = yt.Children.toArray(Mt), zt = Object.values(H).some((t) => t?.show && t?.type === "icon");
|
|
358
|
+
return /* @__PURE__ */ y.jsxs("div", { className: M("relative p-0", Z, wt({ axis: v }), "scrolleable", zt ? "overflow-visible" : "overflow-hidden!"), children: [
|
|
356
359
|
/* @__PURE__ */ y.jsx(
|
|
357
360
|
"div",
|
|
358
361
|
{
|
|
359
362
|
ref: n,
|
|
360
363
|
className: M(
|
|
361
|
-
|
|
362
|
-
|
|
364
|
+
Lt && "border border-red-900 border-dashed",
|
|
365
|
+
Z,
|
|
363
366
|
"py-2 relative w-full h-full min-h-full",
|
|
364
|
-
|
|
365
|
-
|
|
367
|
+
wt({ axis: v }),
|
|
368
|
+
Vt({ hide: rt?.hide, size: rt?.size }),
|
|
366
369
|
""
|
|
367
370
|
),
|
|
368
|
-
children:
|
|
371
|
+
children: Ht?.map((t) => yt.cloneElement(t, { className: M(t?.props?.className, "shrink-0! pointer-events-auto") }))
|
|
369
372
|
}
|
|
370
373
|
),
|
|
371
|
-
/* @__PURE__ */ y.jsx("div", { className: "h-full w-full z-10 absolute inset-0 pointer-events-none overflow-hidden rounded-[inherit]", children: Object.entries(
|
|
374
|
+
/* @__PURE__ */ y.jsx("div", { className: "h-full w-full z-10 absolute inset-0 pointer-events-none overflow-hidden rounded-[inherit]", children: Object.entries(H).map(([t, r]) => {
|
|
372
375
|
if (!r?.show || r.type !== "shadow") return null;
|
|
373
376
|
const e = t;
|
|
374
377
|
return /* @__PURE__ */ y.jsx(
|
|
@@ -381,17 +384,17 @@ const vt = K(
|
|
|
381
384
|
"cursor-default ease-in-out z-100",
|
|
382
385
|
"opacity-0 pointer-events-none"
|
|
383
386
|
),
|
|
384
|
-
onClick: () =>
|
|
385
|
-
onMouseEnter: () =>
|
|
386
|
-
onMouseLeave: () =>
|
|
387
|
-
onMouseDown: () =>
|
|
388
|
-
onMouseUp: () =>
|
|
389
|
-
children: /* @__PURE__ */ y.jsx("span", { className: M(
|
|
387
|
+
onClick: () => ft(e, r.behavior),
|
|
388
|
+
onMouseEnter: () => ht(e, r.behavior, r.type),
|
|
389
|
+
onMouseLeave: () => pt(e, r.behavior),
|
|
390
|
+
onMouseDown: () => gt(e, r.behavior, r.type),
|
|
391
|
+
onMouseUp: () => mt(e, r.behavior),
|
|
392
|
+
children: /* @__PURE__ */ y.jsx("span", { className: M(xt({ position: e, type: "shadow" }), r.className) })
|
|
390
393
|
},
|
|
391
394
|
t
|
|
392
395
|
);
|
|
393
396
|
}) }),
|
|
394
|
-
/* @__PURE__ */ y.jsx("div", { className: "h-full w-full z-20 absolute inset-0 pointer-events-none", children: Object.entries(
|
|
397
|
+
/* @__PURE__ */ y.jsx("div", { className: "h-full w-full z-20 absolute inset-0 pointer-events-none", children: Object.entries(H).map(([t, r]) => {
|
|
395
398
|
if (!r?.show || r.type !== "icon") return null;
|
|
396
399
|
const e = t;
|
|
397
400
|
return /* @__PURE__ */ y.jsx(
|
|
@@ -401,12 +404,12 @@ const vt = K(
|
|
|
401
404
|
c.current[t] = o;
|
|
402
405
|
},
|
|
403
406
|
className: "pointer-events-auto cursor-default transition-all duration-300 opacity-0",
|
|
404
|
-
onClick: () =>
|
|
405
|
-
onMouseEnter: () =>
|
|
406
|
-
onMouseLeave: () =>
|
|
407
|
-
onMouseDown: () =>
|
|
408
|
-
onMouseUp: () =>
|
|
409
|
-
children: /* @__PURE__ */ y.jsx(
|
|
407
|
+
onClick: () => ft(e, r.behavior),
|
|
408
|
+
onMouseEnter: () => ht(e, r.behavior, r.type),
|
|
409
|
+
onMouseLeave: () => pt(e, r.behavior),
|
|
410
|
+
onMouseDown: () => gt(e, r.behavior, r.type),
|
|
411
|
+
onMouseUp: () => mt(e, r.behavior),
|
|
412
|
+
children: /* @__PURE__ */ y.jsx(Tt, { size: 20, className: M(xt({ position: e, type: "icon" }), r.className) })
|
|
410
413
|
},
|
|
411
414
|
t
|
|
412
415
|
);
|
|
@@ -414,24 +417,24 @@ const vt = K(
|
|
|
414
417
|
w && /* @__PURE__ */ y.jsx(
|
|
415
418
|
"button",
|
|
416
419
|
{
|
|
417
|
-
onClick:
|
|
420
|
+
onClick: Dt,
|
|
418
421
|
className: M(
|
|
419
422
|
"absolute bottom-6 right-6 z-50 p-3 rounded-full shadow-lg transition-all duration-300 hover:scale-110 pointer-events-auto cursor-pointer",
|
|
420
423
|
"bg-primary-default-default hover:bg-primary-default-hover text-white",
|
|
421
424
|
// Transiciones de aparición/desaparición
|
|
422
425
|
"transform translate-y-0 opacity-70",
|
|
423
|
-
!
|
|
426
|
+
!kt && "translate-y-4 opacity-0 pointer-events-none",
|
|
424
427
|
w.className
|
|
425
428
|
),
|
|
426
429
|
"aria-label": "Scroll to top",
|
|
427
430
|
style: {
|
|
428
431
|
transition: "all 0.3s ease-in-out"
|
|
429
432
|
},
|
|
430
|
-
children: w.icon ? /* @__PURE__ */ y.jsx(w.icon, { size: 20, className: "text-white" }) : /* @__PURE__ */ y.jsx(
|
|
433
|
+
children: w.icon ? /* @__PURE__ */ y.jsx(w.icon, { size: 20, className: "text-white" }) : /* @__PURE__ */ y.jsx(Tt, { size: 20, className: "text-white rotate-90" })
|
|
431
434
|
}
|
|
432
435
|
)
|
|
433
436
|
] });
|
|
434
437
|
};
|
|
435
438
|
export {
|
|
436
|
-
|
|
439
|
+
Gt as Scrollable
|
|
437
440
|
};
|
package/dist/Skeleton.es.js
CHANGED
|
Binary file
|
|
Binary file
|
|
@@ -7,6 +7,7 @@ export interface IHeader {
|
|
|
7
7
|
subtitleClassName?: string;
|
|
8
8
|
titleClassName?: string;
|
|
9
9
|
mainActionSlot?: ReactNode | (() => ReactNode);
|
|
10
|
+
secondarySlot?: ReactNode | (() => ReactNode);
|
|
10
11
|
}
|
|
11
|
-
declare const Header: import('react').MemoExoticComponent<({ title, subtitle, children, className, subtitleClassName, titleClassName, mainActionSlot }: IHeader) => import("react/jsx-runtime").JSX.Element>;
|
|
12
|
+
declare const Header: import('react').MemoExoticComponent<({ title, subtitle, children, className, subtitleClassName, titleClassName, mainActionSlot, secondarySlot }: IHeader) => import("react/jsx-runtime").JSX.Element>;
|
|
12
13
|
export default Header;
|
|
@@ -7,7 +7,7 @@ export interface IconButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLBut
|
|
|
7
7
|
animate?: boolean;
|
|
8
8
|
animateIcon?: boolean;
|
|
9
9
|
isLoading?: boolean;
|
|
10
|
-
children?:
|
|
10
|
+
children?: React.ReactNode | (() => React.ReactNode);
|
|
11
11
|
spinner?: React.ReactNode;
|
|
12
12
|
type?: 'button' | "submit" | "reset";
|
|
13
13
|
className?: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { NotificationCardProps } from '../NotificationCard/NotificationCard';
|
|
2
|
+
import { default as React } from 'react';
|
|
2
3
|
import { ScrollableControlsHandler } from '../Scrollable/Scrollable';
|
|
3
4
|
interface PLNotificationsDrawerProps<NotificationMetadata> {
|
|
4
5
|
onCloseClick?: VoidFunction;
|
|
@@ -6,13 +7,15 @@ interface PLNotificationsDrawerProps<NotificationMetadata> {
|
|
|
6
7
|
notificationsListControls?: React.RefObject<NotificationsListControlsHandler<NotificationMetadata> | null>;
|
|
7
8
|
scrollableControls?: React.RefObject<ScrollableControlsHandler | null>;
|
|
8
9
|
}
|
|
10
|
+
export type NotificationLoaderType = 'skeletons' | 'load_more';
|
|
9
11
|
export interface NotificationsListControlsHandler<NotificationMetadata> {
|
|
10
12
|
addNewNotification: (notification: NotificationCardProps<NotificationMetadata> | NotificationCardProps<NotificationMetadata>[], position?: 'top' | 'bottom') => void;
|
|
11
13
|
subscribeToUpdates: (callback: (notifications: NotificationCardProps<NotificationMetadata>[], count: number) => void) => () => void;
|
|
12
14
|
removeNotification: (id: string | string[]) => void;
|
|
13
15
|
removeAllNotifications: () => void;
|
|
14
16
|
setNotifications: (notifications: NotificationCardProps<NotificationMetadata>[]) => void;
|
|
15
|
-
setLoading: (loading: boolean) => void;
|
|
17
|
+
setLoading: (loading: boolean, type: NotificationLoaderType) => void;
|
|
18
|
+
setError: (hasError: boolean, children?: React.ReactNode | (() => React.ReactNode)) => void;
|
|
16
19
|
}
|
|
17
20
|
declare const PLNotificationsList: <NotificationMetadata = unknown>({ onCloseClick, onMarkAllAsRead, notificationsListControls, scrollableControls }: PLNotificationsDrawerProps<NotificationMetadata>) => import("react/jsx-runtime").JSX.Element;
|
|
18
21
|
export default PLNotificationsList;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { NotificationLoaderType } from './PLNotificationsList';
|
|
2
|
+
export interface PLNotificationsLoaderProps {
|
|
3
|
+
type: NotificationLoaderType;
|
|
4
|
+
}
|
|
5
|
+
declare const PLNotificationsLoader: ({ type }: PLNotificationsLoaderProps) => import("react/jsx-runtime").JSX.Element | undefined;
|
|
6
|
+
export default PLNotificationsLoader;
|
|
@@ -6,6 +6,7 @@ import { NotificationCardProps } from '../NotificationCard/NotificationCard';
|
|
|
6
6
|
import { ScrollTargetData, ScrollTargetConfig } from '../Scrollable/Scrollable';
|
|
7
7
|
import { AllOptionAccessor } from '../Shared/types';
|
|
8
8
|
import { TabSwitchElement } from '../TabSwitch/TabSwitch';
|
|
9
|
+
import { NotificationLoaderType } from './PLNotificationsList';
|
|
9
10
|
import { subImageUrlAccessor } from './PLSystemSessions';
|
|
10
11
|
type TProduct = {
|
|
11
12
|
name: string;
|
|
@@ -141,7 +142,8 @@ export type PyrionNavigationControls<TNotificationMetadata = unknown> = {
|
|
|
141
142
|
setNotifications?: (notifications: NotificationCardProps<TNotificationMetadata>[]) => void;
|
|
142
143
|
removeAllNotifications?: () => void;
|
|
143
144
|
removeNotification?: (id: string | string[]) => void;
|
|
144
|
-
setNotificationsLoading?: (loading: boolean) => void;
|
|
145
|
+
setNotificationsLoading?: (loading: boolean, type?: NotificationLoaderType) => void;
|
|
146
|
+
setNotificationsError?: (hasError: boolean, children?: React.ReactNode | (() => React.ReactNode)) => void;
|
|
145
147
|
subscribeToNotificationsScroll?: (callback: (data: ScrollTargetData) => void, config?: ScrollTargetConfig) => () => void;
|
|
146
148
|
};
|
|
147
149
|
export declare const usePyrionLayout: <TNotificationMetadata = unknown>() => PyrionNavigationControls<TNotificationMetadata>;
|
|
@@ -26,6 +26,7 @@ export interface ScrollTargetData {
|
|
|
26
26
|
scrollWidth: number;
|
|
27
27
|
clientHeight: number;
|
|
28
28
|
clientWidth: number;
|
|
29
|
+
metadata?: Record<string, any>;
|
|
29
30
|
}
|
|
30
31
|
export interface ScrollTargetConfig {
|
|
31
32
|
target: number;
|
|
@@ -56,6 +57,7 @@ export interface ScrollableProps {
|
|
|
56
57
|
persistScroll?: boolean | string;
|
|
57
58
|
controls?: React.RefObject<ScrollableControlsHandler | null>;
|
|
58
59
|
scrollTopButton?: ScrollTopButtonProps;
|
|
60
|
+
scrollMetadata?: Record<string, any>;
|
|
59
61
|
}
|
|
60
62
|
declare const Scrollable: (props: ScrollableProps) => import("react/jsx-runtime").JSX.Element;
|
|
61
63
|
export default Scrollable;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { memo as n } from "react";
|
|
2
|
+
const t = "__isPrometeoIcon", r = (o) => {
|
|
3
|
+
const s = n(o, (e, m) => e.size === m.size && e.className === m.className && e.props === m.props);
|
|
4
|
+
return s[t] = !0, s;
|
|
5
|
+
}, i = (o) => o && o[t] === !0;
|
|
6
|
+
export {
|
|
7
|
+
i,
|
|
8
|
+
r as m
|
|
9
|
+
};
|