@versini/ui-panel 3.0.1 → 3.1.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/components/Panel/Panel.js +170 -152
- package/dist/index.d.ts +9 -4
- package/dist/index.js +3 -3
- package/package.json +2 -2
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as E, jsx as l, Fragment as L } from "react/jsx-runtime";
|
|
2
2
|
import { ButtonIcon as O } from "@versini/ui-button";
|
|
3
|
-
import * as
|
|
3
|
+
import * as c from "react";
|
|
4
4
|
import { useId as A, useRef as $, useState as R, useEffect as S } from "react";
|
|
5
|
-
import
|
|
6
|
-
import { useFloating as T, useClick as D, useDismiss as P, useRole as B, useInteractions as V, useMergeRefs as F, FloatingPortal as U, FloatingOverlay as Y, FloatingFocusManager as
|
|
7
|
-
const
|
|
8
|
-
children:
|
|
9
|
-
fill:
|
|
5
|
+
import N from "clsx";
|
|
6
|
+
import { useFloating as T, useClick as D, useDismiss as P, useRole as B, useInteractions as V, useMergeRefs as F, FloatingPortal as U, FloatingOverlay as Y, FloatingFocusManager as z } from "@floating-ui/react";
|
|
7
|
+
const M = "av-messagebox", _ = "av-panel", G = ({
|
|
8
|
+
children: t,
|
|
9
|
+
fill: e,
|
|
10
10
|
viewBox: r,
|
|
11
|
-
className:
|
|
12
|
-
defaultViewBox:
|
|
13
|
-
size:
|
|
14
|
-
title:
|
|
15
|
-
semantic:
|
|
16
|
-
...
|
|
11
|
+
className: s,
|
|
12
|
+
defaultViewBox: o,
|
|
13
|
+
size: a,
|
|
14
|
+
title: n,
|
|
15
|
+
semantic: d = !1,
|
|
16
|
+
...m
|
|
17
17
|
}) => {
|
|
18
|
-
const
|
|
19
|
-
return /* @__PURE__ */
|
|
18
|
+
const u = N(a, s);
|
|
19
|
+
return /* @__PURE__ */ E(
|
|
20
20
|
"svg",
|
|
21
21
|
{
|
|
22
22
|
xmlns: "http://www.w3.org/2000/svg",
|
|
23
|
-
className:
|
|
24
|
-
viewBox: r ||
|
|
25
|
-
fill:
|
|
23
|
+
className: u,
|
|
24
|
+
viewBox: r || o,
|
|
25
|
+
fill: e || "currentColor",
|
|
26
26
|
role: "img",
|
|
27
|
-
"aria-hidden": !
|
|
27
|
+
"aria-hidden": !d,
|
|
28
28
|
focusable: !1,
|
|
29
|
-
...
|
|
29
|
+
...m,
|
|
30
30
|
children: [
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
n && d && /* @__PURE__ */ l("title", { children: n }),
|
|
32
|
+
t
|
|
33
33
|
]
|
|
34
34
|
}
|
|
35
35
|
);
|
|
@@ -47,26 +47,26 @@ try {
|
|
|
47
47
|
});
|
|
48
48
|
} catch {
|
|
49
49
|
}
|
|
50
|
-
const
|
|
51
|
-
className:
|
|
52
|
-
viewBox:
|
|
50
|
+
const j = ({
|
|
51
|
+
className: t,
|
|
52
|
+
viewBox: e,
|
|
53
53
|
title: r,
|
|
54
|
-
monotone:
|
|
55
|
-
...
|
|
56
|
-
}) => /* @__PURE__ */
|
|
57
|
-
|
|
54
|
+
monotone: s,
|
|
55
|
+
...o
|
|
56
|
+
}) => /* @__PURE__ */ l(
|
|
57
|
+
G,
|
|
58
58
|
{
|
|
59
59
|
defaultViewBox: "0 0 384 512",
|
|
60
60
|
size: "size-5",
|
|
61
|
-
viewBox:
|
|
62
|
-
className:
|
|
61
|
+
viewBox: e,
|
|
62
|
+
className: t,
|
|
63
63
|
title: r || "Close",
|
|
64
|
-
...
|
|
65
|
-
children: /* @__PURE__ */
|
|
64
|
+
...o,
|
|
65
|
+
children: /* @__PURE__ */ l(
|
|
66
66
|
"path",
|
|
67
67
|
{
|
|
68
68
|
d: "M297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256l105.3-105.4c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3z",
|
|
69
|
-
opacity:
|
|
69
|
+
opacity: s ? "1" : "0.4"
|
|
70
70
|
}
|
|
71
71
|
)
|
|
72
72
|
}
|
|
@@ -84,78 +84,78 @@ try {
|
|
|
84
84
|
});
|
|
85
85
|
} catch {
|
|
86
86
|
}
|
|
87
|
-
const y =
|
|
88
|
-
function
|
|
89
|
-
initialOpen:
|
|
90
|
-
open:
|
|
87
|
+
const y = c.createContext(null);
|
|
88
|
+
function X({
|
|
89
|
+
initialOpen: t = !1,
|
|
90
|
+
open: e,
|
|
91
91
|
onOpenChange: r
|
|
92
92
|
} = {}) {
|
|
93
|
-
const [
|
|
94
|
-
open:
|
|
93
|
+
const [s, o] = c.useState(t), [a, n] = c.useState(), [d, m] = c.useState(), u = e ?? s, w = r ?? o, p = T({
|
|
94
|
+
open: u,
|
|
95
95
|
onOpenChange: w
|
|
96
|
-
}),
|
|
97
|
-
enabled:
|
|
98
|
-
}),
|
|
96
|
+
}), f = p.context, v = D(f, {
|
|
97
|
+
enabled: e == null
|
|
98
|
+
}), x = P(f, {
|
|
99
99
|
outsidePress: !1,
|
|
100
100
|
outsidePressEvent: "mousedown"
|
|
101
|
-
}),
|
|
102
|
-
return
|
|
101
|
+
}), h = B(f), I = V([v, x, h]);
|
|
102
|
+
return c.useMemo(
|
|
103
103
|
() => ({
|
|
104
|
-
open:
|
|
104
|
+
open: u,
|
|
105
105
|
setOpen: w,
|
|
106
|
-
...
|
|
107
|
-
...
|
|
108
|
-
labelId:
|
|
109
|
-
descriptionId:
|
|
110
|
-
setLabelId:
|
|
111
|
-
setDescriptionId:
|
|
106
|
+
...I,
|
|
107
|
+
...p,
|
|
108
|
+
labelId: a,
|
|
109
|
+
descriptionId: d,
|
|
110
|
+
setLabelId: n,
|
|
111
|
+
setDescriptionId: m
|
|
112
112
|
}),
|
|
113
|
-
[
|
|
113
|
+
[u, w, I, p, a, d]
|
|
114
114
|
);
|
|
115
115
|
}
|
|
116
|
-
const
|
|
117
|
-
const
|
|
118
|
-
if (
|
|
116
|
+
const b = () => {
|
|
117
|
+
const t = c.useContext(y);
|
|
118
|
+
if (t == null)
|
|
119
119
|
throw new Error("Modal components must be wrapped in <Modal />");
|
|
120
|
-
return
|
|
120
|
+
return t;
|
|
121
121
|
};
|
|
122
|
-
function
|
|
123
|
-
children:
|
|
124
|
-
...
|
|
122
|
+
function H({
|
|
123
|
+
children: t,
|
|
124
|
+
...e
|
|
125
125
|
}) {
|
|
126
|
-
const r =
|
|
127
|
-
return /* @__PURE__ */
|
|
126
|
+
const r = X(e);
|
|
127
|
+
return /* @__PURE__ */ l(y.Provider, { value: r, children: t });
|
|
128
128
|
}
|
|
129
|
-
const q =
|
|
130
|
-
const { context: r, ...
|
|
129
|
+
const q = c.forwardRef(function(t, e) {
|
|
130
|
+
const { context: r, ...s } = b(), o = F([s.refs.setFloating, e]);
|
|
131
131
|
if (!r.open)
|
|
132
132
|
return null;
|
|
133
|
-
const { overlayBackground:
|
|
134
|
-
[`${
|
|
135
|
-
"bg-black sm:bg-black/[.8]": !
|
|
133
|
+
const { overlayBackground: a, ...n } = t, d = N("grid place-items-center", {
|
|
134
|
+
[`${a}`]: a,
|
|
135
|
+
"bg-black sm:bg-black/[.8]": !a
|
|
136
136
|
});
|
|
137
|
-
return /* @__PURE__ */
|
|
137
|
+
return /* @__PURE__ */ l(U, { children: /* @__PURE__ */ l(Y, { className: d, lockScroll: !0, children: /* @__PURE__ */ l(z, { context: r, children: /* @__PURE__ */ l(
|
|
138
138
|
"div",
|
|
139
139
|
{
|
|
140
|
-
ref:
|
|
141
|
-
"aria-labelledby":
|
|
142
|
-
"aria-describedby":
|
|
143
|
-
...
|
|
144
|
-
children:
|
|
140
|
+
ref: o,
|
|
141
|
+
"aria-labelledby": s.labelId,
|
|
142
|
+
"aria-describedby": s.descriptionId,
|
|
143
|
+
...s.getFloatingProps(n),
|
|
144
|
+
children: n.children
|
|
145
145
|
}
|
|
146
146
|
) }) }) });
|
|
147
|
-
}),
|
|
148
|
-
const { setLabelId:
|
|
149
|
-
return
|
|
150
|
-
}),
|
|
151
|
-
const { setDescriptionId:
|
|
152
|
-
return
|
|
153
|
-
}),
|
|
154
|
-
const { setOpen: r } =
|
|
155
|
-
return /* @__PURE__ */
|
|
156
|
-
ref:
|
|
157
|
-
onClick:
|
|
158
|
-
...
|
|
147
|
+
}), J = c.forwardRef(function({ children: t, ...e }, r) {
|
|
148
|
+
const { setLabelId: s } = b(), o = A();
|
|
149
|
+
return c.useLayoutEffect(() => (s(o), () => s(void 0)), [o, s]), /* @__PURE__ */ l("h1", { ...e, ref: r, id: o, children: t });
|
|
150
|
+
}), K = c.forwardRef(function({ children: t, ...e }, r) {
|
|
151
|
+
const { setDescriptionId: s } = b(), o = A();
|
|
152
|
+
return c.useLayoutEffect(() => (s(o), () => s(void 0)), [o, s]), /* @__PURE__ */ l("div", { ...e, ref: r, id: o, children: t });
|
|
153
|
+
}), Q = c.forwardRef(function(t, e) {
|
|
154
|
+
const { setOpen: r } = b(), { trigger: s, className: o, ...a } = t, n = c.useCallback(() => r(!1), [r]);
|
|
155
|
+
return /* @__PURE__ */ l("div", { className: o, children: c.cloneElement(s, {
|
|
156
|
+
ref: e,
|
|
157
|
+
onClick: n,
|
|
158
|
+
...a
|
|
159
159
|
}) });
|
|
160
160
|
});
|
|
161
161
|
/*!
|
|
@@ -165,105 +165,123 @@ const q = l.forwardRef(function(e, t) {
|
|
|
165
165
|
try {
|
|
166
166
|
window.__VERSINI_UI_MODAL__ || (window.__VERSINI_UI_MODAL__ = {
|
|
167
167
|
version: "3.0.1",
|
|
168
|
-
buildTime: "
|
|
168
|
+
buildTime: "10/11/2025 12:41 PM EDT",
|
|
169
169
|
homepage: "https://github.com/aversini/ui-components",
|
|
170
170
|
license: "MIT"
|
|
171
171
|
});
|
|
172
172
|
} catch {
|
|
173
173
|
}
|
|
174
|
-
const
|
|
175
|
-
className:
|
|
176
|
-
kind:
|
|
174
|
+
const i = "panel", g = "messagebox", Z = ({
|
|
175
|
+
className: t,
|
|
176
|
+
kind: e,
|
|
177
177
|
borderMode: r,
|
|
178
|
-
animation:
|
|
179
|
-
maxWidth:
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
178
|
+
animation: s,
|
|
179
|
+
maxWidth: o = "medium",
|
|
180
|
+
maxHeight: a
|
|
181
|
+
}) => {
|
|
182
|
+
const n = a ?? (e === i ? "large" : void 0);
|
|
183
|
+
return {
|
|
184
|
+
main: N("prose prose-lighter flex flex-col bg-surface-dark", {
|
|
185
|
+
"duration-200 ease-out": s,
|
|
186
|
+
/**
|
|
187
|
+
* Panel styles
|
|
188
|
+
*/
|
|
189
|
+
[`${_} min-h-full sm:min-h-[10rem] sm:rounded-lg sm:border-2`]: e === i,
|
|
190
|
+
[`${_} w-full sm:w-[95%] md:max-w-2xl`]: e === i && !t && o === "small",
|
|
191
|
+
[`${_} w-full sm:w-[95%] md:max-w-3xl`]: e === i && !t && o === "medium",
|
|
192
|
+
[`${_} w-full sm:w-[95%] md:max-w-4xl`]: e === i && !t && o === "large",
|
|
193
|
+
"max-h-full sm:max-h-[75%]": e === i && n === "small",
|
|
194
|
+
"max-h-full sm:max-h-[85%]": e === i && n === "medium",
|
|
195
|
+
"max-h-full sm:max-h-[95%]": e === i && n === "large",
|
|
196
|
+
"sm:border-border-dark": r === "dark" && e === i,
|
|
197
|
+
"sm:border-border-accent": r === "light" && e === i,
|
|
198
|
+
/**
|
|
199
|
+
* Messagebox styles
|
|
200
|
+
*/
|
|
201
|
+
[`${M} rounded-lg border-2`]: e === g,
|
|
202
|
+
[`${M} w-[95%] sm:w-[50%] md:max-w-2xl`]: e === g && !t,
|
|
203
|
+
"max-h-[75%]": e === g && n === "small",
|
|
204
|
+
"max-h-[85%]": e === g && n === "medium",
|
|
205
|
+
"max-h-[95%]": e === g && n === "large",
|
|
206
|
+
"border-border-dark": r === "dark" && e === g,
|
|
207
|
+
"border-border-accent": r === "light" && e === g,
|
|
208
|
+
[`${t}`]: !!t
|
|
209
|
+
}),
|
|
210
|
+
content: "flex flex-col py-2 sm:py-4 sm:px-4 px-2 overflow-y-auto",
|
|
211
|
+
footer: "flex grow flex-col sm:p-4 p-2",
|
|
212
|
+
header: "sm:p-4 mb-0 p-2",
|
|
213
|
+
close: "sm:p-4 p-2"
|
|
214
|
+
};
|
|
215
|
+
}, W = "slide", C = "fade", oe = ({
|
|
216
|
+
open: t,
|
|
217
|
+
onOpenChange: e,
|
|
202
218
|
title: r,
|
|
203
|
-
children:
|
|
204
|
-
footer:
|
|
205
|
-
borderMode:
|
|
206
|
-
kind:
|
|
207
|
-
className:
|
|
208
|
-
animation:
|
|
209
|
-
animationType:
|
|
210
|
-
maxWidth: w = "medium"
|
|
219
|
+
children: s,
|
|
220
|
+
footer: o,
|
|
221
|
+
borderMode: a = "light",
|
|
222
|
+
kind: n = i,
|
|
223
|
+
className: d,
|
|
224
|
+
animation: m = !1,
|
|
225
|
+
animationType: u = W,
|
|
226
|
+
maxWidth: w = "medium",
|
|
227
|
+
maxHeight: p
|
|
211
228
|
}) => {
|
|
212
|
-
const
|
|
213
|
-
|
|
229
|
+
const f = $(""), [v, x] = R(
|
|
230
|
+
m ? u === C ? { opacity: 0 } : {
|
|
214
231
|
transform: "translateY(-100vh)"
|
|
215
232
|
} : {}
|
|
216
|
-
),
|
|
217
|
-
className:
|
|
218
|
-
kind:
|
|
219
|
-
borderMode:
|
|
220
|
-
animation:
|
|
221
|
-
maxWidth: w
|
|
233
|
+
), h = Z({
|
|
234
|
+
className: d,
|
|
235
|
+
kind: n,
|
|
236
|
+
borderMode: a,
|
|
237
|
+
animation: m,
|
|
238
|
+
maxWidth: w,
|
|
239
|
+
maxHeight: p
|
|
222
240
|
});
|
|
223
|
-
return S(() => (
|
|
224
|
-
|
|
225
|
-
}), [r,
|
|
226
|
-
if (
|
|
227
|
-
|
|
228
|
-
|
|
241
|
+
return S(() => (t && (f.current = document.title, document.title = `${r} | ${f.current}`), () => {
|
|
242
|
+
t && (document.title = f.current);
|
|
243
|
+
}), [r, t]), S(() => {
|
|
244
|
+
if (m && t) {
|
|
245
|
+
x(
|
|
246
|
+
m ? u === C ? { opacity: 0 } : {
|
|
229
247
|
transform: "translateY(-666vh)"
|
|
230
248
|
} : {}
|
|
231
249
|
);
|
|
232
|
-
const
|
|
233
|
-
|
|
234
|
-
|
|
250
|
+
const I = setTimeout(() => {
|
|
251
|
+
x(
|
|
252
|
+
m ? u === "fade" ? { opacity: 1 } : {
|
|
235
253
|
transform: "translateY(0)"
|
|
236
254
|
} : {}
|
|
237
255
|
);
|
|
238
256
|
}, 100);
|
|
239
|
-
return () => clearTimeout(
|
|
257
|
+
return () => clearTimeout(I);
|
|
240
258
|
}
|
|
241
|
-
}, [
|
|
242
|
-
/* @__PURE__ */
|
|
243
|
-
/* @__PURE__ */
|
|
244
|
-
|
|
259
|
+
}, [t, m, u]), /* @__PURE__ */ l(L, { children: t && /* @__PURE__ */ l(H, { open: t, onOpenChange: e, children: /* @__PURE__ */ E(q, { className: h.main, style: v, children: [
|
|
260
|
+
/* @__PURE__ */ E("div", { className: "flex flex-row-reverse items-center justify-between", children: [
|
|
261
|
+
/* @__PURE__ */ l(
|
|
262
|
+
Q,
|
|
245
263
|
{
|
|
246
|
-
className:
|
|
247
|
-
trigger: /* @__PURE__ */
|
|
264
|
+
className: h.close,
|
|
265
|
+
trigger: /* @__PURE__ */ l(
|
|
248
266
|
O,
|
|
249
267
|
{
|
|
250
268
|
mode: "dark",
|
|
251
269
|
focusMode: "light",
|
|
252
270
|
noBorder: !0,
|
|
253
271
|
label: "Close",
|
|
254
|
-
children: /* @__PURE__ */
|
|
272
|
+
children: /* @__PURE__ */ l(j, { monotone: !0 })
|
|
255
273
|
}
|
|
256
274
|
)
|
|
257
275
|
}
|
|
258
276
|
),
|
|
259
|
-
/* @__PURE__ */
|
|
277
|
+
/* @__PURE__ */ l(J, { className: h.header, children: r })
|
|
260
278
|
] }),
|
|
261
|
-
/* @__PURE__ */
|
|
262
|
-
|
|
279
|
+
/* @__PURE__ */ l(K, { className: h.content, children: s }),
|
|
280
|
+
o && /* @__PURE__ */ l("div", { className: h.footer, children: o })
|
|
263
281
|
] }) }) });
|
|
264
282
|
};
|
|
265
283
|
export {
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
284
|
+
M as MESSAGEBOX_CLASSNAME,
|
|
285
|
+
_ as PANEL_CLASSNAME,
|
|
286
|
+
oe as Panel
|
|
269
287
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -50,14 +50,19 @@ type PanelProps = {
|
|
|
50
50
|
animationType?: "slide" | "fade";
|
|
51
51
|
/**
|
|
52
52
|
* The maximum width of the Panel when kind is "panel".
|
|
53
|
-
* NOTE: This
|
|
54
|
-
* NOTE: The max-width only takes effect at the medium breakpoint and above (768px+).
|
|
55
|
-
* At smaller viewports, the panel will take the full screen width.
|
|
53
|
+
* NOTE: This does not affect messageboxes, which have a fixed width.
|
|
56
54
|
* @default "medium"
|
|
57
55
|
*/
|
|
58
56
|
maxWidth?: "small" | "medium" | "large";
|
|
57
|
+
/**
|
|
58
|
+
* The maximum height of the Panel or Messagebox.
|
|
59
|
+
* For panels: defaults to "large" (95%) if not specified.
|
|
60
|
+
* For messageboxes: no max-height is applied unless explicitly set.
|
|
61
|
+
* @default "large" (for panels only)
|
|
62
|
+
*/
|
|
63
|
+
maxHeight?: "small" | "medium" | "large";
|
|
59
64
|
};
|
|
60
65
|
|
|
61
|
-
declare const Panel: ({ open, onOpenChange, title, children, footer, borderMode, kind, className, animation, animationType, maxWidth, }: PanelProps) => react_jsx_runtime.JSX.Element;
|
|
66
|
+
declare const Panel: ({ open, onOpenChange, title, children, footer, borderMode, kind, className, animation, animationType, maxWidth, maxHeight, }: PanelProps) => react_jsx_runtime.JSX.Element;
|
|
62
67
|
|
|
63
68
|
export { MESSAGEBOX_CLASSNAME, PANEL_CLASSNAME, Panel };
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { MESSAGEBOX_CLASSNAME as o, PANEL_CLASSNAME as E, Panel as n } from "./components/Panel/Panel.js";
|
|
2
2
|
/*!
|
|
3
|
-
@versini/ui-panel v3.0
|
|
3
|
+
@versini/ui-panel v3.1.0
|
|
4
4
|
© 2025 gizmette.com
|
|
5
5
|
*/
|
|
6
6
|
try {
|
|
7
7
|
window.__VERSINI_UI_PANEL__ || (window.__VERSINI_UI_PANEL__ = {
|
|
8
|
-
version: "3.0
|
|
9
|
-
buildTime: "
|
|
8
|
+
version: "3.1.0",
|
|
9
|
+
buildTime: "10/11/2025 12:42 PM EDT",
|
|
10
10
|
homepage: "https://github.com/aversini/ui-components",
|
|
11
11
|
license: "MIT"
|
|
12
12
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versini/ui-panel",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Arno Versini",
|
|
6
6
|
"publishConfig": {
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"sideEffects": [
|
|
55
55
|
"**/*.css"
|
|
56
56
|
],
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "731554d2c2fc2ae1c3c62ffbe09eba2b77308a70"
|
|
58
58
|
}
|