prometeo-design-system 5.1.0 → 5.2.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/DialogModal.es.js +1 -2
- package/dist/DrawerMobile.es.js +149 -134
- package/dist/PyrionLayout.es.js +227 -227
- package/dist/components/Drawer/DrawerMobile.d.ts +2 -2
- package/dist/components/PyrionNavigationDrawer/PLNotificationsList.d.ts +4 -1
- package/dist/components/PyrionNavigationDrawer/PyrionLayout.d.ts +4 -1
- package/package.json +1 -1
package/dist/DialogModal.es.js
CHANGED
|
@@ -97,7 +97,6 @@ const oe = he(
|
|
|
97
97
|
key: Math.random(),
|
|
98
98
|
...l,
|
|
99
99
|
className: x(l?.className, "contents")
|
|
100
|
-
// display: contents
|
|
101
100
|
}, ...O);
|
|
102
101
|
}
|
|
103
102
|
if (l?.children) {
|
|
@@ -221,7 +220,7 @@ const b = D(({ children: r, className: d, debugMode: i, expandX: s, expandY: f,
|
|
|
221
220
|
), E = f ? { flexGrow: t ?? 1, flexBasis: 0 } : void 0;
|
|
222
221
|
return /* @__PURE__ */ a.jsx("div", { style: E, className: x(
|
|
223
222
|
i && "border-2 border-dashed border-red-600 bg-red-200/40! relative after:content-['FOOTER'] after:absolute after:top-1 after:left-1/2 after:w-max after:h-full after:text-red-500",
|
|
224
|
-
"border-t border-neutral-strong-default p-4 w-full flex flex-row justify-end",
|
|
223
|
+
"border-t border-neutral-strong-default p-4 w-full flex flex-row justify-end gap-4",
|
|
225
224
|
m,
|
|
226
225
|
d
|
|
227
226
|
), children: r });
|
package/dist/DrawerMobile.es.js
CHANGED
|
@@ -1,77 +1,92 @@
|
|
|
1
|
-
import { j as
|
|
1
|
+
import { j as w } from "./jsx-runtime-GkKLlHH4.js";
|
|
2
2
|
import { c as _ } from "./cn-B6yFEsav.js";
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { createPortal as
|
|
5
|
-
const
|
|
6
|
-
const { children:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}, [
|
|
10
|
-
O.current =
|
|
11
|
-
}, [
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
}, []),
|
|
15
|
-
|
|
16
|
-
}, [
|
|
17
|
-
|
|
18
|
-
|
|
3
|
+
import { forwardRef as P, useState as $, useRef as p, useEffect as H, useCallback as l, useMemo as X, useImperativeHandle as ee } from "react";
|
|
4
|
+
import { createPortal as te } from "react-dom";
|
|
5
|
+
const J = 44, ne = "height 0.5s cubic-bezier(0.32, 0.72, 0, 1)", ce = P((u, s) => {
|
|
6
|
+
const { children: M, defaultOpen: o = !1, onClose: h, snapPoints: d = ["auto"], setSnap: g, snap: a, attachToParent: m = !1 } = u, [j, S] = $(a || "0%"), [L, r] = $(null), D = p(h), O = p(g), f = p(L), b = p(/* @__PURE__ */ new Set());
|
|
7
|
+
D.current = h, f.current = L, H(() => {
|
|
8
|
+
o && R();
|
|
9
|
+
}, [o]), H(() => {
|
|
10
|
+
O.current = g;
|
|
11
|
+
}, [g]);
|
|
12
|
+
const F = l(() => {
|
|
13
|
+
S("0%"), D.current?.(f.current), setTimeout(() => r(null), 300);
|
|
14
|
+
}, []), R = l((y, T) => {
|
|
15
|
+
S(y || d[0] || "60%"), r(T ?? null);
|
|
16
|
+
}, [d]), E = X(() => j !== "0%", [j]);
|
|
17
|
+
H(() => {
|
|
18
|
+
b.current.forEach((y) => {
|
|
19
19
|
try {
|
|
20
|
-
|
|
20
|
+
y(E);
|
|
21
21
|
} catch {
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
-
}, [
|
|
25
|
-
open:
|
|
26
|
-
close:
|
|
27
|
-
isOpen:
|
|
28
|
-
subscribeOpenChange: (
|
|
29
|
-
|
|
24
|
+
}, [E]), ee(s, () => ({
|
|
25
|
+
open: R,
|
|
26
|
+
close: F,
|
|
27
|
+
isOpen: E,
|
|
28
|
+
subscribeOpenChange: (y) => (b.current.add(y), () => {
|
|
29
|
+
b.current.delete(y);
|
|
30
30
|
}),
|
|
31
31
|
getContext: () => f.current
|
|
32
|
-
}), [
|
|
33
|
-
const
|
|
34
|
-
return
|
|
35
|
-
}),
|
|
36
|
-
const r =
|
|
32
|
+
}), [R, F, E]);
|
|
33
|
+
const N = a || j;
|
|
34
|
+
return m ? /* @__PURE__ */ w.jsx(V, { ...u, snap: N, setSnap: S, context: L, children: M }) : te(/* @__PURE__ */ w.jsx(V, { ...u, snap: N, setSnap: S, context: L, children: M }), document.body);
|
|
35
|
+
}), V = ({ children: u, attachToParent: s = !1, className: M, snap: o, snapPoints: h = ["60%"], setSnap: d, hideOnClose: g = !1, unmountChildrenOnClose: a = !1, header: m, modal: j = !1, closeOnOverlayClick: S = !1, context: L }) => {
|
|
36
|
+
const r = p(null), D = p(null), O = p(null), f = p(null), b = p(null), F = l(() => {
|
|
37
37
|
if (!r.current) return [];
|
|
38
|
-
const e =
|
|
39
|
-
return
|
|
40
|
-
}, [
|
|
41
|
-
const n =
|
|
38
|
+
const e = s && r.current.parentElement?.offsetHeight || window.innerHeight;
|
|
39
|
+
return h?.filter((t) => t !== "auto").map((t) => typeof t == "string" && t.endsWith("%") ? parseFloat(t) > 100 ? e : parseFloat(t) / 100 * e : typeof t == "string" && t.endsWith("px") ? parseFloat(t) : typeof t == "number" && t >= 0 && t <= 1 ? t * e : typeof t == "number" ? t : 0) || [];
|
|
40
|
+
}, [h, s]), R = l(() => (m ? 88 : 44) + 16, [m]), E = l(() => D.current?.scrollHeight ?? 0, []), N = l((e, t, n) => {
|
|
41
|
+
const v = n + t, i = Math.min(100, v / e * 100);
|
|
42
|
+
return `${Math.round(i)}%`;
|
|
43
|
+
}, []), z = l((e, t) => {
|
|
44
|
+
const n = F();
|
|
42
45
|
if (n.length === 0) return e;
|
|
43
46
|
if (Math.abs(t) > 0.05)
|
|
44
47
|
if (t > 0) {
|
|
45
|
-
const
|
|
46
|
-
return
|
|
48
|
+
const i = n.filter((c) => c < e);
|
|
49
|
+
return i.length > 0 ? Math.max(...i) : g ? 0 : J;
|
|
47
50
|
} else {
|
|
48
|
-
const
|
|
49
|
-
if (
|
|
50
|
-
return Math.min(...
|
|
51
|
+
const i = n.filter((c) => c > e);
|
|
52
|
+
if (i.length > 0)
|
|
53
|
+
return Math.min(...i);
|
|
51
54
|
}
|
|
52
|
-
return n.reduce((
|
|
53
|
-
}, [
|
|
54
|
-
if (
|
|
55
|
-
const t =
|
|
56
|
-
|
|
55
|
+
return n.reduce((i, c) => Math.abs(c - e) < Math.abs(i - e) ? c : i);
|
|
56
|
+
}, [F]), y = l((e) => {
|
|
57
|
+
if (d && h) {
|
|
58
|
+
const t = s && r.current?.parentElement?.offsetHeight || window.innerHeight, n = e <= J ? "0%" : `${Math.round(e / t * 100)}%`;
|
|
59
|
+
d(n);
|
|
57
60
|
}
|
|
58
|
-
}, [
|
|
59
|
-
r.current && (r.current.style.transition =
|
|
60
|
-
}, [
|
|
61
|
-
if (
|
|
62
|
-
const { scrollY: e } =
|
|
63
|
-
document.body.style.position = "", document.body.style.top = "", document.body.style.width = "", window.scrollTo(0, e),
|
|
61
|
+
}, [d, h, s]), T = l((e) => {
|
|
62
|
+
r.current && (r.current.style.transition = ne, r.current.style.height = `${e}px`);
|
|
63
|
+
}, [d, h, s]), k = l(() => {
|
|
64
|
+
if (b.current && s) {
|
|
65
|
+
const { scrollY: e } = b.current;
|
|
66
|
+
document.body.style.position = "", document.body.style.top = "", document.body.style.width = "", window.scrollTo(0, e), b.current = null;
|
|
67
|
+
}
|
|
68
|
+
}, [s]);
|
|
69
|
+
H(() => () => {
|
|
70
|
+
k();
|
|
71
|
+
}, [k]), H(() => {
|
|
72
|
+
if (!r.current || !o) return;
|
|
73
|
+
const e = s && r.current.parentElement?.offsetHeight || window.innerHeight;
|
|
74
|
+
if (o === "auto") {
|
|
75
|
+
T(e), requestAnimationFrame(() => {
|
|
76
|
+
requestAnimationFrame(() => {
|
|
77
|
+
if (D.current && D.current.children.length > 0) {
|
|
78
|
+
const n = E(), v = R(), i = N(e, n, v);
|
|
79
|
+
d(i);
|
|
80
|
+
} else
|
|
81
|
+
d("100%");
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
return;
|
|
64
85
|
}
|
|
65
|
-
}, [o]);
|
|
66
|
-
y(() => () => {
|
|
67
|
-
N();
|
|
68
|
-
}, [N]), y(() => {
|
|
69
|
-
if (!r.current || !s) return;
|
|
70
|
-
const e = o && r.current.parentElement?.offsetHeight || window.innerHeight;
|
|
71
86
|
let t = 0;
|
|
72
|
-
typeof
|
|
73
|
-
}, [s,
|
|
74
|
-
const
|
|
87
|
+
typeof o == "string" && o.endsWith("%") ? parseFloat(o) <= 0 ? t = g ? 0 : J : t = parseFloat(o) / 100 * e : typeof o == "string" && o.endsWith("px") ? t = parseFloat(o) : typeof o == "number" && (o >= 0 && o <= 1 ? t = o * e : t = o), T(t);
|
|
88
|
+
}, [o, s, E, R, N, d]);
|
|
89
|
+
const A = l((e) => {
|
|
75
90
|
if (!r.current) return;
|
|
76
91
|
const t = e.touches[0], n = r.current.offsetHeight;
|
|
77
92
|
f.current = {
|
|
@@ -82,7 +97,7 @@ const B = 44, P = "height 0.5s cubic-bezier(0.32, 0.72, 0, 1)", se = V((l, o) =>
|
|
|
82
97
|
lastTime: Date.now(),
|
|
83
98
|
velocity: 0
|
|
84
99
|
};
|
|
85
|
-
}, []),
|
|
100
|
+
}, []), K = l((e) => {
|
|
86
101
|
if (!r.current) return;
|
|
87
102
|
const t = e, n = r.current.offsetHeight;
|
|
88
103
|
f.current = {
|
|
@@ -93,152 +108,152 @@ const B = 44, P = "height 0.5s cubic-bezier(0.32, 0.72, 0, 1)", se = V((l, o) =>
|
|
|
93
108
|
lastTime: Date.now(),
|
|
94
109
|
velocity: 0
|
|
95
110
|
};
|
|
96
|
-
}, []),
|
|
111
|
+
}, []), C = l((e) => {
|
|
97
112
|
if (!f.current || !r.current) return;
|
|
98
|
-
const t = e.touches[0], n = f.current,
|
|
99
|
-
if (!n.isDragging &&
|
|
100
|
-
const
|
|
101
|
-
|
|
113
|
+
const t = e.touches[0], n = f.current, v = n.startY - t.clientY, i = n.isDragging || Math.abs(v) > 5;
|
|
114
|
+
if (!n.isDragging && i && (n.isDragging = !0, s)) {
|
|
115
|
+
const c = window.scrollY;
|
|
116
|
+
b.current = { scrollY: c }, document.body.style.position = "fixed", document.body.style.top = `-${c}px`, document.body.style.width = "100%";
|
|
102
117
|
}
|
|
103
|
-
if (
|
|
118
|
+
if (i) {
|
|
104
119
|
e.preventDefault();
|
|
105
|
-
const
|
|
120
|
+
const c = Date.now(), I = c - n.lastTime;
|
|
106
121
|
if (I > 0) {
|
|
107
|
-
const
|
|
108
|
-
n.velocity = n.velocity * 0.8 +
|
|
122
|
+
const q = (t.clientY - n.lastY) / I;
|
|
123
|
+
n.velocity = n.velocity * 0.8 + q * 0.2;
|
|
109
124
|
}
|
|
110
|
-
n.lastY = t.clientY, n.lastTime =
|
|
111
|
-
const
|
|
112
|
-
r.current.style.transition = "none", r.current.style.height = `${
|
|
125
|
+
n.lastY = t.clientY, n.lastTime = c;
|
|
126
|
+
const G = n.startHeight + v, W = s && r.current.parentElement?.offsetHeight || window.innerHeight, B = Math.max(0, Math.min(G, W));
|
|
127
|
+
r.current.style.transition = "none", r.current.style.height = `${B}px`;
|
|
113
128
|
}
|
|
114
|
-
}, [
|
|
129
|
+
}, [s]), Q = l((e) => {
|
|
115
130
|
if (!f.current || !r.current) return;
|
|
116
|
-
const t = e, n = f.current,
|
|
117
|
-
if (!n.isDragging &&
|
|
118
|
-
const
|
|
119
|
-
|
|
131
|
+
const t = e, n = f.current, v = n.startY - t.clientY, i = n.isDragging || Math.abs(v) > 5;
|
|
132
|
+
if (!n.isDragging && i && (n.isDragging = !0, s)) {
|
|
133
|
+
const c = window.scrollY;
|
|
134
|
+
b.current = { scrollY: c }, document.body.style.position = "fixed", document.body.style.top = `-${c}px`, document.body.style.width = "100%";
|
|
120
135
|
}
|
|
121
|
-
if (
|
|
136
|
+
if (i) {
|
|
122
137
|
e.preventDefault();
|
|
123
|
-
const
|
|
138
|
+
const c = Date.now(), I = c - n.lastTime;
|
|
124
139
|
if (I > 0) {
|
|
125
|
-
const
|
|
126
|
-
n.velocity = n.velocity * 0.8 +
|
|
140
|
+
const q = (t.clientY - n.lastY) / I;
|
|
141
|
+
n.velocity = n.velocity * 0.8 + q * 0.2;
|
|
127
142
|
}
|
|
128
|
-
n.lastY = t.clientY, n.lastTime =
|
|
129
|
-
const
|
|
130
|
-
r.current.style.transition = "none", r.current.style.height = `${
|
|
143
|
+
n.lastY = t.clientY, n.lastTime = c;
|
|
144
|
+
const G = n.startHeight + v, W = s && r.current.parentElement?.offsetHeight || window.innerHeight, B = Math.max(0, Math.min(G, W));
|
|
145
|
+
r.current.style.transition = "none", r.current.style.height = `${B}px`;
|
|
131
146
|
}
|
|
132
|
-
}, [
|
|
147
|
+
}, [s]), x = l(() => {
|
|
133
148
|
if (!f.current || !r.current) return;
|
|
134
149
|
const e = f.current;
|
|
135
150
|
if (e.isDragging) {
|
|
136
|
-
|
|
137
|
-
const t = r.current.offsetHeight, n =
|
|
138
|
-
|
|
151
|
+
k();
|
|
152
|
+
const t = r.current.offsetHeight, n = z(t, e.velocity);
|
|
153
|
+
y(n);
|
|
139
154
|
}
|
|
140
155
|
f.current = null;
|
|
141
|
-
}, [
|
|
142
|
-
|
|
156
|
+
}, [z, T, k]);
|
|
157
|
+
H(() => {
|
|
143
158
|
const e = O.current;
|
|
144
159
|
if (e)
|
|
145
|
-
return e.addEventListener("touchstart",
|
|
146
|
-
e.removeEventListener("touchstart",
|
|
160
|
+
return e.addEventListener("touchstart", A, { passive: !1 }), e.addEventListener("touchmove", C, { passive: !1 }), e.addEventListener("touchend", x), e.addEventListener("touchcancel", x), e.addEventListener("mousedown", K, { passive: !1 }), e.addEventListener("mousemove", Q, { passive: !1 }), e.addEventListener("mouseup", x), e.addEventListener("mouseleave", x), () => {
|
|
161
|
+
e.removeEventListener("touchstart", A), e.removeEventListener("touchmove", C), e.removeEventListener("touchend", x), e.removeEventListener("touchcancel", x), e.removeEventListener("mousedown", K), e.removeEventListener("mousemove", Q), e.removeEventListener("mouseup", x), e.removeEventListener("mouseleave", x);
|
|
147
162
|
};
|
|
148
|
-
}, [
|
|
149
|
-
const
|
|
150
|
-
return
|
|
151
|
-
|
|
152
|
-
}, [
|
|
153
|
-
if (!
|
|
163
|
+
}, [A, C, x]);
|
|
164
|
+
const Y = X(() => o !== "0%", [o]), [Z, U] = $(() => a ? o !== "0%" : !0);
|
|
165
|
+
return H(() => {
|
|
166
|
+
a && Y && U(!0);
|
|
167
|
+
}, [Y, a]), H(() => {
|
|
168
|
+
if (!a) return;
|
|
154
169
|
const e = r.current;
|
|
155
170
|
if (!e) return;
|
|
156
171
|
const t = (n) => {
|
|
157
|
-
n.propertyName === "height" && !
|
|
172
|
+
n.propertyName === "height" && !Y && o === "0%" && U(!1);
|
|
158
173
|
};
|
|
159
174
|
return e.addEventListener("transitionend", t), () => {
|
|
160
175
|
e.removeEventListener("transitionend", t);
|
|
161
176
|
};
|
|
162
|
-
}, [
|
|
163
|
-
|
|
177
|
+
}, [Y, o, a]), /* @__PURE__ */ w.jsxs(w.Fragment, { children: [
|
|
178
|
+
j && /* @__PURE__ */ w.jsx(
|
|
164
179
|
"div",
|
|
165
180
|
{
|
|
166
|
-
className: _(
|
|
181
|
+
className: _(Y ? "fixed inset-0 bg-black/40 z-55 cursor-default" : "hidden"),
|
|
167
182
|
onClick: (e) => {
|
|
168
|
-
e.preventDefault(), e.stopPropagation(),
|
|
183
|
+
e.preventDefault(), e.stopPropagation(), S && y(0);
|
|
169
184
|
},
|
|
170
185
|
"aria-hidden": "true"
|
|
171
186
|
}
|
|
172
187
|
),
|
|
173
|
-
/* @__PURE__ */
|
|
188
|
+
/* @__PURE__ */ w.jsxs(
|
|
174
189
|
"div",
|
|
175
190
|
{
|
|
176
191
|
ref: r,
|
|
177
192
|
className: _(
|
|
178
193
|
"h-0",
|
|
179
|
-
|
|
194
|
+
s ? "absolute" : "fixed",
|
|
180
195
|
"z-60 bottom-0 w-full overflow-hidden",
|
|
181
196
|
"bg-neutral-default-default",
|
|
182
197
|
"border-t border-neutral-strong-default rounded-t-[12px]",
|
|
183
|
-
|
|
184
|
-
|
|
198
|
+
Y ? "" : "border-neutral-weak",
|
|
199
|
+
M,
|
|
185
200
|
"flex flex-col items-center",
|
|
186
201
|
"touch-none select-none"
|
|
187
202
|
),
|
|
188
203
|
children: [
|
|
189
|
-
/* @__PURE__ */
|
|
204
|
+
/* @__PURE__ */ w.jsx(
|
|
190
205
|
"div",
|
|
191
206
|
{
|
|
192
207
|
ref: O,
|
|
193
208
|
className: "w-full absolute top-0 h-11 flex items-center justify-center cursor-grab active:cursor-grabbing z-50 bg-inherit!",
|
|
194
|
-
children: /* @__PURE__ */
|
|
209
|
+
children: /* @__PURE__ */ w.jsx("span", { className: "w-12 h-1 rounded-full bg-neutral-weak-default" })
|
|
195
210
|
}
|
|
196
211
|
),
|
|
197
|
-
typeof
|
|
198
|
-
/* @__PURE__ */
|
|
212
|
+
typeof m == "string" ? /* @__PURE__ */ w.jsx("p", { className: " prometeo-fonts-headline-small text-neutral-default-default w-full h-11 bg-inherit absolute top-11 z-50 px-4", children: m }) : m,
|
|
213
|
+
/* @__PURE__ */ w.jsx(
|
|
199
214
|
"div",
|
|
200
215
|
{
|
|
201
|
-
ref:
|
|
216
|
+
ref: D,
|
|
202
217
|
className: _(
|
|
203
218
|
"drawer-mobile-content prometeo-scrollbar-thin-weak",
|
|
204
|
-
|
|
219
|
+
Y ? "drawer-mobile-content--open" : "drawer-mobile-content--closed",
|
|
205
220
|
"w-full h-full px-4 pb-4 ",
|
|
206
|
-
|
|
221
|
+
m ? "mt-22" : "mt-11"
|
|
207
222
|
),
|
|
208
223
|
style: {
|
|
209
224
|
overscrollBehavior: "contain"
|
|
210
225
|
},
|
|
211
|
-
children: (!
|
|
226
|
+
children: (!a || Z) && (typeof u == "function" ? u(L) : u)
|
|
212
227
|
}
|
|
213
228
|
)
|
|
214
229
|
]
|
|
215
230
|
}
|
|
216
231
|
)
|
|
217
232
|
] });
|
|
218
|
-
},
|
|
219
|
-
const
|
|
220
|
-
|
|
221
|
-
}, []),
|
|
222
|
-
|
|
223
|
-
}, []),
|
|
224
|
-
return
|
|
225
|
-
const
|
|
226
|
-
if (!
|
|
227
|
-
const
|
|
228
|
-
|
|
233
|
+
}, le = () => {
|
|
234
|
+
const u = p(null), [s, M] = $(!1), o = l((g, a) => {
|
|
235
|
+
u.current?.open(g, a);
|
|
236
|
+
}, []), h = l(() => {
|
|
237
|
+
u.current?.close();
|
|
238
|
+
}, []), d = l(() => u.current?.getContext() ?? null, []);
|
|
239
|
+
return H(() => {
|
|
240
|
+
const g = u.current?.subscribeOpenChange;
|
|
241
|
+
if (!g) return;
|
|
242
|
+
const a = g((m) => {
|
|
243
|
+
M(m);
|
|
229
244
|
});
|
|
230
245
|
return () => {
|
|
231
|
-
|
|
246
|
+
a && a();
|
|
232
247
|
};
|
|
233
|
-
}, [
|
|
234
|
-
isOpen:
|
|
235
|
-
open:
|
|
236
|
-
close:
|
|
237
|
-
drawerRef:
|
|
238
|
-
getContext:
|
|
248
|
+
}, [u.current?.subscribeOpenChange]), {
|
|
249
|
+
isOpen: s,
|
|
250
|
+
open: o,
|
|
251
|
+
close: h,
|
|
252
|
+
drawerRef: u,
|
|
253
|
+
getContext: d
|
|
239
254
|
};
|
|
240
255
|
};
|
|
241
256
|
export {
|
|
242
|
-
|
|
243
|
-
|
|
257
|
+
ce as default,
|
|
258
|
+
le as useDrawerMobile
|
|
244
259
|
};
|