prometeo-design-system 7.1.0 → 7.1.2
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 +2 -2
- package/dist/Drawer.es.js +50 -50
- package/dist/DrawerMobile-CZ7EoU0P.js +566 -0
- package/dist/DrawerMobile.es.js +1 -1
- package/dist/Menu.es.js +1 -1
- package/dist/Modal.es.js +195 -234
- package/dist/TabSwitch.es.js +1 -1
- package/dist/components/Drawer/Drawer.d.ts +2 -2
- package/dist/components/Drawer/DrawerMobile.d.ts +1 -1
- package/dist/components/Drawer/DrawerPanel.d.ts +4 -30
- package/dist/components/Drawer/DrawerSlotContext.d.ts +10 -0
- package/dist/components/Modal/Modal.d.ts +30 -26
- package/dist/components/Modal/ModalContext.d.ts +6 -0
- package/dist/index.d.ts +3 -3
- package/dist/prometeo-design-system.es.js +167 -167
- package/dist/styles.css +1 -1
- package/dist/useModalControl-D5oehVFf.js +375 -0
- package/package.json +2 -1
- package/src/styles/base.css +7 -0
- package/dist/DrawerMobile-VjhsKiXN.js +0 -563
- package/dist/useModalControl-D4bzCoM8.js +0 -365
package/dist/DialogModal.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { u as o, a as t } from "./useModalControl-
|
|
2
|
-
import { D as u } from "./useModalControl-
|
|
1
|
+
import { u as o, a as t } from "./useModalControl-D5oehVFf.js";
|
|
2
|
+
import { D as u } from "./useModalControl-D5oehVFf.js";
|
|
3
3
|
const s = o, e = t;
|
|
4
4
|
export {
|
|
5
5
|
u as default,
|
package/dist/Drawer.es.js
CHANGED
|
@@ -3,10 +3,10 @@ import { j as s } from "./jsx-runtime-GkKLlHH4.js";
|
|
|
3
3
|
import { c as m } from "./cn-B6yFEsav.js";
|
|
4
4
|
import { c as E } from "./index-BOQuZ0gG.js";
|
|
5
5
|
import { createPortal as re } from "react-dom";
|
|
6
|
-
import { forwardRef as M, memo as
|
|
6
|
+
import { forwardRef as M, memo as x, useRef as N, useState as z, useEffect as F, useCallback as T, useImperativeHandle as ne, Children as Y, isValidElement as A, useContext as oe, createContext as se, useMemo as _, Fragment as ae, createElement as le } from "react";
|
|
7
7
|
import ie from "./IconButton.es.js";
|
|
8
8
|
import { Close as ce } from "./Icons/Close.es.js";
|
|
9
|
-
const
|
|
9
|
+
const be = 300, $ = se(
|
|
10
10
|
null
|
|
11
11
|
);
|
|
12
12
|
function W() {
|
|
@@ -44,7 +44,7 @@ const de = E(
|
|
|
44
44
|
right: "grid grid-cols-[auto_1fr_auto] grid-rows-1"
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
}), Z =
|
|
47
|
+
}), Z = x(function({
|
|
48
48
|
className: r
|
|
49
49
|
}) {
|
|
50
50
|
const t = W();
|
|
@@ -68,20 +68,20 @@ const de = E(
|
|
|
68
68
|
);
|
|
69
69
|
});
|
|
70
70
|
Z.displayName = "Drawer.CloseButton";
|
|
71
|
-
const
|
|
71
|
+
const b = x(function({
|
|
72
72
|
children: r,
|
|
73
73
|
className: t,
|
|
74
74
|
showCloseButton: d = !0,
|
|
75
75
|
actionsSlot: o,
|
|
76
|
-
title:
|
|
76
|
+
title: i
|
|
77
77
|
}) {
|
|
78
|
-
const n = W(), u = d && n !== null && !n.hideCloseButton,
|
|
78
|
+
const n = W(), u = d && n !== null && !n.hideCloseButton, l = i ?? n?.panelTitle;
|
|
79
79
|
let a = o ?? n?.panelActionsSlot, e = r;
|
|
80
80
|
if (!a && r) {
|
|
81
|
-
const f = Y.toArray(r),
|
|
81
|
+
const f = Y.toArray(r), y = f.find(
|
|
82
82
|
(p) => A(p) && p.type === D
|
|
83
83
|
);
|
|
84
|
-
|
|
84
|
+
y && (a = y, e = f.filter(
|
|
85
85
|
(p) => !(A(p) && p.type === D)
|
|
86
86
|
));
|
|
87
87
|
}
|
|
@@ -97,12 +97,12 @@ const v = y(function({
|
|
|
97
97
|
/* @__PURE__ */ s.jsx(
|
|
98
98
|
"h2",
|
|
99
99
|
{
|
|
100
|
-
title:
|
|
100
|
+
title: typeof l == "string" ? l : void 0,
|
|
101
101
|
className: m(
|
|
102
102
|
"flex-1 truncate pyrion-fonts-title-medium text-neutral-primary-default",
|
|
103
103
|
n?.direction === "right" && "col-start-2"
|
|
104
104
|
),
|
|
105
|
-
children:
|
|
105
|
+
children: l
|
|
106
106
|
}
|
|
107
107
|
),
|
|
108
108
|
/* @__PURE__ */ s.jsx("div", { className: m(n?.direction === "right" && "col-start-3"), children: typeof a == "function" ? a() : a }),
|
|
@@ -113,15 +113,15 @@ const v = y(function({
|
|
|
113
113
|
}
|
|
114
114
|
);
|
|
115
115
|
});
|
|
116
|
-
|
|
117
|
-
const D =
|
|
116
|
+
b.displayName = "Drawer.Header";
|
|
117
|
+
const D = x(function({
|
|
118
118
|
children: r,
|
|
119
119
|
className: t
|
|
120
120
|
}) {
|
|
121
121
|
return /* @__PURE__ */ s.jsx("div", { className: m("flex justify-end items-center gap-2 ", t), children: r });
|
|
122
122
|
});
|
|
123
123
|
D.displayName = "Drawer.HeaderActions";
|
|
124
|
-
const
|
|
124
|
+
const v = x(function({
|
|
125
125
|
children: r,
|
|
126
126
|
className: t
|
|
127
127
|
}) {
|
|
@@ -136,8 +136,8 @@ const b = y(function({
|
|
|
136
136
|
}
|
|
137
137
|
);
|
|
138
138
|
});
|
|
139
|
-
|
|
140
|
-
const k =
|
|
139
|
+
v.displayName = "Drawer.Content";
|
|
140
|
+
const k = x(function({
|
|
141
141
|
children: r,
|
|
142
142
|
className: t
|
|
143
143
|
}) {
|
|
@@ -165,38 +165,38 @@ function pe(c) {
|
|
|
165
165
|
const r = q(c);
|
|
166
166
|
let t = !1;
|
|
167
167
|
for (const e of r)
|
|
168
|
-
if (A(e) && (e.type ===
|
|
168
|
+
if (A(e) && (e.type === b || e.type === v || e.type === k || e.type === D)) {
|
|
169
169
|
t = !0;
|
|
170
170
|
break;
|
|
171
171
|
}
|
|
172
172
|
let d = null, o = null;
|
|
173
|
-
const
|
|
173
|
+
const i = [], n = [];
|
|
174
174
|
let u = null;
|
|
175
|
-
const
|
|
176
|
-
n.length !== 0 && (
|
|
177
|
-
le(
|
|
175
|
+
const l = [], a = () => {
|
|
176
|
+
n.length !== 0 && (i.push(
|
|
177
|
+
le(v, { key: `drawer-loose-content-${i.length}` }, ...n)
|
|
178
178
|
), n.length = 0);
|
|
179
179
|
};
|
|
180
180
|
for (const e of r) {
|
|
181
181
|
if (!A(e)) {
|
|
182
|
-
t ? n.push(e) :
|
|
182
|
+
t ? n.push(e) : l.push(e);
|
|
183
183
|
continue;
|
|
184
184
|
}
|
|
185
|
-
e.type ===
|
|
185
|
+
e.type === b ? d ??= e : e.type === D ? o ??= e : e.type === v ? (a(), i.push(e)) : e.type === k ? u ??= e : t ? n.push(e) : l.push(e);
|
|
186
186
|
}
|
|
187
|
-
return a(), { usesCompound: t, header: d, headerActions: o, content:
|
|
187
|
+
return a(), { usesCompound: t, header: d, headerActions: o, content: i, footer: u, legacy: l };
|
|
188
188
|
}
|
|
189
|
-
const G =
|
|
189
|
+
const G = x(function({
|
|
190
190
|
isOpen: r,
|
|
191
191
|
modal: t,
|
|
192
192
|
attachToParent: d,
|
|
193
193
|
closeOnOverlayClick: o,
|
|
194
|
-
zIndex:
|
|
194
|
+
zIndex: i,
|
|
195
195
|
onClose: n
|
|
196
196
|
}) {
|
|
197
197
|
const u = T(
|
|
198
|
-
(
|
|
199
|
-
|
|
198
|
+
(l) => {
|
|
199
|
+
l.preventDefault(), l.stopPropagation(), o && n();
|
|
200
200
|
},
|
|
201
201
|
[o, n]
|
|
202
202
|
);
|
|
@@ -207,27 +207,27 @@ const G = y(function({
|
|
|
207
207
|
ue({ isOpen: r, attachToParent: d }),
|
|
208
208
|
t ? "bg-black/60" : "bg-transparent"
|
|
209
209
|
),
|
|
210
|
-
style: { zIndex:
|
|
210
|
+
style: { zIndex: i },
|
|
211
211
|
onClick: u,
|
|
212
212
|
"aria-hidden": "true"
|
|
213
213
|
}
|
|
214
214
|
);
|
|
215
215
|
});
|
|
216
216
|
G.displayName = "Drawer.DismissOverlay";
|
|
217
|
-
const J =
|
|
217
|
+
const J = x(
|
|
218
218
|
M(function({
|
|
219
219
|
children: r,
|
|
220
220
|
direction: t = "left",
|
|
221
221
|
isOpen: d,
|
|
222
222
|
close: o,
|
|
223
|
-
modal:
|
|
223
|
+
modal: i = !1,
|
|
224
224
|
className: n,
|
|
225
225
|
attachToParent: u = !1,
|
|
226
|
-
closeOnOverlayClick:
|
|
226
|
+
closeOnOverlayClick: l = !1,
|
|
227
227
|
hideCloseButton: a = !1,
|
|
228
228
|
title: e,
|
|
229
229
|
zIndex: f,
|
|
230
|
-
ariaLabel:
|
|
230
|
+
ariaLabel: y
|
|
231
231
|
}, p) {
|
|
232
232
|
const I = _(() => pe(r), [r]), { usesCompound: R, header: w, content: O, footer: H, legacy: C, headerActions: g } = I, j = !w && (!a || e || g), S = _(
|
|
233
233
|
() => ({
|
|
@@ -245,9 +245,9 @@ const J = y(
|
|
|
245
245
|
G,
|
|
246
246
|
{
|
|
247
247
|
isOpen: d,
|
|
248
|
-
modal:
|
|
248
|
+
modal: i,
|
|
249
249
|
attachToParent: u,
|
|
250
|
-
closeOnOverlayClick:
|
|
250
|
+
closeOnOverlayClick: l,
|
|
251
251
|
zIndex: f,
|
|
252
252
|
onClose: o
|
|
253
253
|
}
|
|
@@ -264,16 +264,16 @@ const J = y(
|
|
|
264
264
|
n
|
|
265
265
|
),
|
|
266
266
|
role: "dialog",
|
|
267
|
-
"aria-modal":
|
|
268
|
-
"aria-label":
|
|
267
|
+
"aria-modal": i,
|
|
268
|
+
"aria-label": y,
|
|
269
269
|
style: { zIndex: f + 1 },
|
|
270
270
|
children: R ? /* @__PURE__ */ s.jsxs(s.Fragment, { children: [
|
|
271
|
-
w || j && /* @__PURE__ */ s.jsx(
|
|
271
|
+
w || j && /* @__PURE__ */ s.jsx(b, { title: e }),
|
|
272
272
|
O,
|
|
273
273
|
H
|
|
274
274
|
] }) : /* @__PURE__ */ s.jsxs(s.Fragment, { children: [
|
|
275
|
-
j && /* @__PURE__ */ s.jsx(
|
|
276
|
-
/* @__PURE__ */ s.jsx(
|
|
275
|
+
j && /* @__PURE__ */ s.jsx(b, { variant: "closeOnly", title: e }),
|
|
276
|
+
/* @__PURE__ */ s.jsx(v, { children: C })
|
|
277
277
|
] })
|
|
278
278
|
}
|
|
279
279
|
)
|
|
@@ -282,8 +282,8 @@ const J = y(
|
|
|
282
282
|
);
|
|
283
283
|
J.displayName = "Drawer.Panel";
|
|
284
284
|
const K = M(function(r, t) {
|
|
285
|
-
const d = N(null), [o,
|
|
286
|
-
modal:
|
|
285
|
+
const d = N(null), [o, i] = z(r.defaultOpen ?? !1), [n, u] = z(null), l = N(r.onClose), a = N(n), e = N(o), f = N(/* @__PURE__ */ new Set()), {
|
|
286
|
+
modal: y = !1,
|
|
287
287
|
children: p,
|
|
288
288
|
className: I,
|
|
289
289
|
direction: R = "left",
|
|
@@ -296,23 +296,23 @@ const K = M(function(r, t) {
|
|
|
296
296
|
zindex: S,
|
|
297
297
|
title: Q
|
|
298
298
|
} = r, U = j ?? S ?? 35;
|
|
299
|
-
e.current = o, a.current = n,
|
|
299
|
+
e.current = o, a.current = n, l.current = r.onClose;
|
|
300
300
|
const [X, ee] = z(() => !C);
|
|
301
301
|
F(() => {
|
|
302
302
|
C && o && ee(!0);
|
|
303
303
|
}, [o, C]), F(() => {
|
|
304
|
-
if (o &&
|
|
304
|
+
if (o && y) {
|
|
305
305
|
const h = window.scrollY;
|
|
306
306
|
return document.body.style.position = "fixed", document.body.style.top = `-${h}px`, document.body.style.width = "100%", () => {
|
|
307
307
|
document.body.style.position = "", document.body.style.top = "", document.body.style.width = "", window.scrollTo(0, h);
|
|
308
308
|
};
|
|
309
309
|
}
|
|
310
|
-
}, [o,
|
|
310
|
+
}, [o, y]);
|
|
311
311
|
const P = T(() => {
|
|
312
|
-
e.current = !1,
|
|
312
|
+
e.current = !1, i(!1), l.current?.(a.current ?? void 0);
|
|
313
313
|
}, []), B = T((h) => {
|
|
314
314
|
const V = h ?? null;
|
|
315
|
-
a.current = V, e.current = !0, u(V),
|
|
315
|
+
a.current = V, e.current = !0, u(V), i(!0);
|
|
316
316
|
}, []);
|
|
317
317
|
F(() => {
|
|
318
318
|
f.current.forEach((h) => {
|
|
@@ -343,7 +343,7 @@ const K = M(function(r, t) {
|
|
|
343
343
|
isOpen: o,
|
|
344
344
|
close: P,
|
|
345
345
|
direction: R,
|
|
346
|
-
modal:
|
|
346
|
+
modal: y,
|
|
347
347
|
className: I,
|
|
348
348
|
attachToParent: w,
|
|
349
349
|
closeOnOverlayClick: O,
|
|
@@ -358,13 +358,13 @@ const K = M(function(r, t) {
|
|
|
358
358
|
});
|
|
359
359
|
K.displayName = "Drawer";
|
|
360
360
|
const De = Object.assign(K, {
|
|
361
|
-
Header:
|
|
362
|
-
Content:
|
|
361
|
+
Header: b,
|
|
362
|
+
Content: v,
|
|
363
363
|
Footer: k,
|
|
364
364
|
HeaderActions: D
|
|
365
365
|
});
|
|
366
366
|
export {
|
|
367
|
-
|
|
367
|
+
be as DRAWER_TRANSITION_MS,
|
|
368
368
|
De as default,
|
|
369
369
|
Ne as useDrawerControl,
|
|
370
370
|
Ae as useDrawerState
|