@versini/ui-panel 2.2.10 → 3.0.1
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 +231 -64
- package/dist/index.js +3 -3
- package/package.json +7 -7
|
@@ -1,102 +1,269 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ButtonIcon as
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import B from "
|
|
7
|
-
const
|
|
1
|
+
import { jsxs as v, jsx as n, Fragment as L } from "react/jsx-runtime";
|
|
2
|
+
import { ButtonIcon as O } from "@versini/ui-button";
|
|
3
|
+
import * as l from "react";
|
|
4
|
+
import { useId as A, useRef as $, useState as R, useEffect as S } from "react";
|
|
5
|
+
import E 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 k } from "@floating-ui/react";
|
|
7
|
+
const C = "av-messagebox", I = "av-panel", z = ({
|
|
8
|
+
children: e,
|
|
9
|
+
fill: t,
|
|
10
|
+
viewBox: r,
|
|
11
|
+
className: o,
|
|
12
|
+
defaultViewBox: s,
|
|
13
|
+
size: c,
|
|
14
|
+
title: i,
|
|
15
|
+
semantic: u = !1,
|
|
16
|
+
...a
|
|
17
|
+
}) => {
|
|
18
|
+
const d = E(c, o);
|
|
19
|
+
return /* @__PURE__ */ v(
|
|
20
|
+
"svg",
|
|
21
|
+
{
|
|
22
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
23
|
+
className: d,
|
|
24
|
+
viewBox: r || s,
|
|
25
|
+
fill: t || "currentColor",
|
|
26
|
+
role: "img",
|
|
27
|
+
"aria-hidden": !u,
|
|
28
|
+
focusable: !1,
|
|
29
|
+
...a,
|
|
30
|
+
children: [
|
|
31
|
+
i && u && /* @__PURE__ */ n("title", { children: i }),
|
|
32
|
+
e
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
/*!
|
|
38
|
+
@versini/ui-svgicon v4.2.1
|
|
39
|
+
© 2025 gizmette.com
|
|
40
|
+
*/
|
|
41
|
+
try {
|
|
42
|
+
window.__VERSINI_UI_SVGICON__ || (window.__VERSINI_UI_SVGICON__ = {
|
|
43
|
+
version: "4.2.1",
|
|
44
|
+
buildTime: "08/27/2025 08:27 AM EDT",
|
|
45
|
+
homepage: "https://github.com/aversini/ui-components",
|
|
46
|
+
license: "MIT"
|
|
47
|
+
});
|
|
48
|
+
} catch {
|
|
49
|
+
}
|
|
50
|
+
const G = ({
|
|
51
|
+
className: e,
|
|
52
|
+
viewBox: t,
|
|
53
|
+
title: r,
|
|
54
|
+
monotone: o,
|
|
55
|
+
...s
|
|
56
|
+
}) => /* @__PURE__ */ n(
|
|
57
|
+
z,
|
|
58
|
+
{
|
|
59
|
+
defaultViewBox: "0 0 384 512",
|
|
60
|
+
size: "size-5",
|
|
61
|
+
viewBox: t,
|
|
62
|
+
className: e,
|
|
63
|
+
title: r || "Close",
|
|
64
|
+
...s,
|
|
65
|
+
children: /* @__PURE__ */ n(
|
|
66
|
+
"path",
|
|
67
|
+
{
|
|
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: o ? "1" : "0.4"
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
/*!
|
|
75
|
+
@versini/ui-icons v4.11.0
|
|
76
|
+
© 2025 gizmette.com
|
|
77
|
+
*/
|
|
78
|
+
try {
|
|
79
|
+
window.__VERSINI_UI_ICONS__ || (window.__VERSINI_UI_ICONS__ = {
|
|
80
|
+
version: "4.11.0",
|
|
81
|
+
buildTime: "08/27/2025 08:28 AM EDT",
|
|
82
|
+
homepage: "https://github.com/aversini/ui-components",
|
|
83
|
+
license: "MIT"
|
|
84
|
+
});
|
|
85
|
+
} catch {
|
|
86
|
+
}
|
|
87
|
+
const y = l.createContext(null);
|
|
88
|
+
function j({
|
|
89
|
+
initialOpen: e = !1,
|
|
90
|
+
open: t,
|
|
91
|
+
onOpenChange: r
|
|
92
|
+
} = {}) {
|
|
93
|
+
const [o, s] = l.useState(e), [c, i] = l.useState(), [u, a] = l.useState(), d = t ?? o, w = r ?? s, m = T({
|
|
94
|
+
open: d,
|
|
95
|
+
onOpenChange: w
|
|
96
|
+
}), p = m.context, g = D(p, {
|
|
97
|
+
enabled: t == null
|
|
98
|
+
}), f = P(p, {
|
|
99
|
+
outsidePress: !1,
|
|
100
|
+
outsidePressEvent: "mousedown"
|
|
101
|
+
}), b = B(p), N = V([g, f, b]);
|
|
102
|
+
return l.useMemo(
|
|
103
|
+
() => ({
|
|
104
|
+
open: d,
|
|
105
|
+
setOpen: w,
|
|
106
|
+
...N,
|
|
107
|
+
...m,
|
|
108
|
+
labelId: c,
|
|
109
|
+
descriptionId: u,
|
|
110
|
+
setLabelId: i,
|
|
111
|
+
setDescriptionId: a
|
|
112
|
+
}),
|
|
113
|
+
[d, w, N, m, c, u]
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
const x = () => {
|
|
117
|
+
const e = l.useContext(y);
|
|
118
|
+
if (e == null)
|
|
119
|
+
throw new Error("Modal components must be wrapped in <Modal />");
|
|
120
|
+
return e;
|
|
121
|
+
};
|
|
122
|
+
function X({
|
|
123
|
+
children: e,
|
|
124
|
+
...t
|
|
125
|
+
}) {
|
|
126
|
+
const r = j(t);
|
|
127
|
+
return /* @__PURE__ */ n(y.Provider, { value: r, children: e });
|
|
128
|
+
}
|
|
129
|
+
const q = l.forwardRef(function(e, t) {
|
|
130
|
+
const { context: r, ...o } = x(), s = F([o.refs.setFloating, t]);
|
|
131
|
+
if (!r.open)
|
|
132
|
+
return null;
|
|
133
|
+
const { overlayBackground: c, ...i } = e, u = E("grid place-items-center", {
|
|
134
|
+
[`${c}`]: c,
|
|
135
|
+
"bg-black sm:bg-black/[.8]": !c
|
|
136
|
+
});
|
|
137
|
+
return /* @__PURE__ */ n(U, { children: /* @__PURE__ */ n(Y, { className: u, lockScroll: !0, children: /* @__PURE__ */ n(k, { context: r, children: /* @__PURE__ */ n(
|
|
138
|
+
"div",
|
|
139
|
+
{
|
|
140
|
+
ref: s,
|
|
141
|
+
"aria-labelledby": o.labelId,
|
|
142
|
+
"aria-describedby": o.descriptionId,
|
|
143
|
+
...o.getFloatingProps(i),
|
|
144
|
+
children: i.children
|
|
145
|
+
}
|
|
146
|
+
) }) }) });
|
|
147
|
+
}), H = l.forwardRef(function({ children: e, ...t }, r) {
|
|
148
|
+
const { setLabelId: o } = x(), s = A();
|
|
149
|
+
return l.useLayoutEffect(() => (o(s), () => o(void 0)), [s, o]), /* @__PURE__ */ n("h1", { ...t, ref: r, id: s, children: e });
|
|
150
|
+
}), J = l.forwardRef(function({ children: e, ...t }, r) {
|
|
151
|
+
const { setDescriptionId: o } = x(), s = A();
|
|
152
|
+
return l.useLayoutEffect(() => (o(s), () => o(void 0)), [s, o]), /* @__PURE__ */ n("div", { ...t, ref: r, id: s, children: e });
|
|
153
|
+
}), K = l.forwardRef(function(e, t) {
|
|
154
|
+
const { setOpen: r } = x(), { trigger: o, className: s, ...c } = e, i = l.useCallback(() => r(!1), [r]);
|
|
155
|
+
return /* @__PURE__ */ n("div", { className: s, children: l.cloneElement(o, {
|
|
156
|
+
ref: t,
|
|
157
|
+
onClick: i,
|
|
158
|
+
...c
|
|
159
|
+
}) });
|
|
160
|
+
});
|
|
161
|
+
/*!
|
|
162
|
+
@versini/ui-modal v3.0.1
|
|
163
|
+
© 2025 gizmette.com
|
|
164
|
+
*/
|
|
165
|
+
try {
|
|
166
|
+
window.__VERSINI_UI_MODAL__ || (window.__VERSINI_UI_MODAL__ = {
|
|
167
|
+
version: "3.0.1",
|
|
168
|
+
buildTime: "09/01/2025 04:01 PM EDT",
|
|
169
|
+
homepage: "https://github.com/aversini/ui-components",
|
|
170
|
+
license: "MIT"
|
|
171
|
+
});
|
|
172
|
+
} catch {
|
|
173
|
+
}
|
|
174
|
+
const h = "panel", _ = "messagebox", Q = ({
|
|
8
175
|
className: e,
|
|
9
|
-
kind:
|
|
10
|
-
borderMode:
|
|
11
|
-
animation:
|
|
176
|
+
kind: t,
|
|
177
|
+
borderMode: r,
|
|
178
|
+
animation: o,
|
|
12
179
|
maxWidth: s = "medium"
|
|
13
180
|
}) => ({
|
|
14
|
-
main:
|
|
15
|
-
"duration-200 ease-out":
|
|
16
|
-
[`${
|
|
17
|
-
[`${
|
|
18
|
-
[`${
|
|
19
|
-
[`${
|
|
20
|
-
[`${
|
|
21
|
-
[`${
|
|
181
|
+
main: E("prose prose-lighter flex flex-col bg-surface-dark", {
|
|
182
|
+
"duration-200 ease-out": o,
|
|
183
|
+
[`${I} max-h-full sm:max-h-[95%] min-h-full sm:min-h-[10rem] sm:rounded-lg sm:border-2`]: t === h,
|
|
184
|
+
[`${I} w-full sm:w-[95%] md:max-w-2xl`]: t === h && !e && s === "small",
|
|
185
|
+
[`${I} w-full sm:w-[95%] md:max-w-3xl`]: t === h && !e && s === "medium",
|
|
186
|
+
[`${I} w-full sm:w-[95%] md:max-w-4xl`]: t === h && !e && s === "large",
|
|
187
|
+
[`${C} rounded-lg border-2`]: t === _,
|
|
188
|
+
[`${C} w-[95%] sm:w-[50%] md:max-w-2xl`]: t === _ && !e,
|
|
22
189
|
[`${e}`]: !!e,
|
|
23
|
-
"sm:border-border-dark":
|
|
24
|
-
"sm:border-border-accent":
|
|
25
|
-
"border-border-dark":
|
|
26
|
-
"border-border-accent":
|
|
190
|
+
"sm:border-border-dark": r === "dark" && t === h,
|
|
191
|
+
"sm:border-border-accent": r === "light" && t === h,
|
|
192
|
+
"border-border-dark": r === "dark" && t === _,
|
|
193
|
+
"border-border-accent": r === "light" && t === _
|
|
27
194
|
}),
|
|
28
195
|
content: "flex flex-col py-2 sm:py-4 sm:px-4 px-2 overflow-y-auto",
|
|
29
196
|
footer: "flex grow flex-col sm:p-4 p-2",
|
|
30
197
|
header: "sm:p-4 mb-0 p-2",
|
|
31
198
|
close: "sm:p-4 p-2"
|
|
32
|
-
}),
|
|
199
|
+
}), Z = "slide", M = "fade", se = ({
|
|
33
200
|
open: e,
|
|
34
|
-
onOpenChange:
|
|
35
|
-
title:
|
|
36
|
-
children:
|
|
201
|
+
onOpenChange: t,
|
|
202
|
+
title: r,
|
|
203
|
+
children: o,
|
|
37
204
|
footer: s,
|
|
38
|
-
borderMode:
|
|
39
|
-
kind:
|
|
40
|
-
className:
|
|
41
|
-
animation:
|
|
42
|
-
animationType:
|
|
43
|
-
maxWidth:
|
|
205
|
+
borderMode: c = "light",
|
|
206
|
+
kind: i = h,
|
|
207
|
+
className: u,
|
|
208
|
+
animation: a = !1,
|
|
209
|
+
animationType: d = Z,
|
|
210
|
+
maxWidth: w = "medium"
|
|
44
211
|
}) => {
|
|
45
|
-
const
|
|
46
|
-
|
|
212
|
+
const m = $(""), [p, g] = R(
|
|
213
|
+
a ? d === M ? { opacity: 0 } : {
|
|
47
214
|
transform: "translateY(-100vh)"
|
|
48
215
|
} : {}
|
|
49
|
-
),
|
|
50
|
-
className:
|
|
51
|
-
kind:
|
|
52
|
-
borderMode:
|
|
53
|
-
animation:
|
|
54
|
-
maxWidth:
|
|
216
|
+
), f = Q({
|
|
217
|
+
className: u,
|
|
218
|
+
kind: i,
|
|
219
|
+
borderMode: c,
|
|
220
|
+
animation: a,
|
|
221
|
+
maxWidth: w
|
|
55
222
|
});
|
|
56
|
-
return
|
|
57
|
-
e && (document.title =
|
|
58
|
-
}), [
|
|
59
|
-
if (
|
|
60
|
-
|
|
61
|
-
|
|
223
|
+
return S(() => (e && (m.current = document.title, document.title = `${r} | ${m.current}`), () => {
|
|
224
|
+
e && (document.title = m.current);
|
|
225
|
+
}), [r, e]), S(() => {
|
|
226
|
+
if (a && e) {
|
|
227
|
+
g(
|
|
228
|
+
a ? d === M ? { opacity: 0 } : {
|
|
62
229
|
transform: "translateY(-666vh)"
|
|
63
230
|
} : {}
|
|
64
231
|
);
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
232
|
+
const b = setTimeout(() => {
|
|
233
|
+
g(
|
|
234
|
+
a ? d === "fade" ? { opacity: 1 } : {
|
|
68
235
|
transform: "translateY(0)"
|
|
69
236
|
} : {}
|
|
70
237
|
);
|
|
71
238
|
}, 100);
|
|
72
|
-
return () => clearTimeout(
|
|
239
|
+
return () => clearTimeout(b);
|
|
73
240
|
}
|
|
74
|
-
}, [e,
|
|
75
|
-
/* @__PURE__ */
|
|
76
|
-
/* @__PURE__ */
|
|
77
|
-
|
|
241
|
+
}, [e, a, d]), /* @__PURE__ */ n(L, { children: e && /* @__PURE__ */ n(X, { open: e, onOpenChange: t, children: /* @__PURE__ */ v(q, { className: f.main, style: p, children: [
|
|
242
|
+
/* @__PURE__ */ v("div", { className: "flex flex-row-reverse items-center justify-between", children: [
|
|
243
|
+
/* @__PURE__ */ n(
|
|
244
|
+
K,
|
|
78
245
|
{
|
|
79
|
-
className:
|
|
80
|
-
trigger: /* @__PURE__ */
|
|
81
|
-
|
|
246
|
+
className: f.close,
|
|
247
|
+
trigger: /* @__PURE__ */ n(
|
|
248
|
+
O,
|
|
82
249
|
{
|
|
83
250
|
mode: "dark",
|
|
84
251
|
focusMode: "light",
|
|
85
252
|
noBorder: !0,
|
|
86
253
|
label: "Close",
|
|
87
|
-
children: /* @__PURE__ */
|
|
254
|
+
children: /* @__PURE__ */ n(G, { monotone: !0 })
|
|
88
255
|
}
|
|
89
256
|
)
|
|
90
257
|
}
|
|
91
258
|
),
|
|
92
|
-
/* @__PURE__ */
|
|
259
|
+
/* @__PURE__ */ n(H, { className: f.header, children: r })
|
|
93
260
|
] }),
|
|
94
|
-
/* @__PURE__ */
|
|
95
|
-
s && /* @__PURE__ */
|
|
261
|
+
/* @__PURE__ */ n(J, { className: f.content, children: o }),
|
|
262
|
+
s && /* @__PURE__ */ n("div", { className: f.footer, children: s })
|
|
96
263
|
] }) }) });
|
|
97
264
|
};
|
|
98
265
|
export {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
266
|
+
C as MESSAGEBOX_CLASSNAME,
|
|
267
|
+
I as PANEL_CLASSNAME,
|
|
268
|
+
se as Panel
|
|
102
269
|
};
|
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
|
|
3
|
+
@versini/ui-panel v3.0.1
|
|
4
4
|
© 2025 gizmette.com
|
|
5
5
|
*/
|
|
6
6
|
try {
|
|
7
7
|
window.__VERSINI_UI_PANEL__ || (window.__VERSINI_UI_PANEL__ = {
|
|
8
|
-
version: "
|
|
9
|
-
buildTime: "09/01/2025
|
|
8
|
+
version: "3.0.1",
|
|
9
|
+
buildTime: "09/01/2025 04:01 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
|
+
"version": "3.0.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Arno Versini",
|
|
6
6
|
"publishConfig": {
|
|
@@ -37,22 +37,22 @@
|
|
|
37
37
|
"test": "vitest run"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"react": "^
|
|
41
|
-
"react-dom": "^
|
|
40
|
+
"react": "^19.1.0",
|
|
41
|
+
"react-dom": "^19.1.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@testing-library/jest-dom": "6.8.0"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@tailwindcss/typography": "0.5.16",
|
|
48
|
-
"@versini/ui-button": "
|
|
49
|
-
"@versini/ui-icons": "4.
|
|
50
|
-
"@versini/ui-modal": "
|
|
48
|
+
"@versini/ui-button": "8.0.1",
|
|
49
|
+
"@versini/ui-icons": "4.11.0",
|
|
50
|
+
"@versini/ui-modal": "3.0.1",
|
|
51
51
|
"clsx": "2.1.1",
|
|
52
52
|
"tailwindcss": "4.1.12"
|
|
53
53
|
},
|
|
54
54
|
"sideEffects": [
|
|
55
55
|
"**/*.css"
|
|
56
56
|
],
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "dcc216644c8c3e7d43a49ea655a22aed21fa4b83"
|
|
58
58
|
}
|