@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.
@@ -1,35 +1,35 @@
1
- import { jsxs as v, jsx as n, Fragment as L } from "react/jsx-runtime";
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 l from "react";
3
+ import * as c from "react";
4
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,
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: o,
12
- defaultViewBox: s,
13
- size: c,
14
- title: i,
15
- semantic: u = !1,
16
- ...a
11
+ className: s,
12
+ defaultViewBox: o,
13
+ size: a,
14
+ title: n,
15
+ semantic: d = !1,
16
+ ...m
17
17
  }) => {
18
- const d = E(c, o);
19
- return /* @__PURE__ */ v(
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: d,
24
- viewBox: r || s,
25
- fill: t || "currentColor",
23
+ className: u,
24
+ viewBox: r || o,
25
+ fill: e || "currentColor",
26
26
  role: "img",
27
- "aria-hidden": !u,
27
+ "aria-hidden": !d,
28
28
  focusable: !1,
29
- ...a,
29
+ ...m,
30
30
  children: [
31
- i && u && /* @__PURE__ */ n("title", { children: i }),
32
- e
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 G = ({
51
- className: e,
52
- viewBox: t,
50
+ const j = ({
51
+ className: t,
52
+ viewBox: e,
53
53
  title: r,
54
- monotone: o,
55
- ...s
56
- }) => /* @__PURE__ */ n(
57
- z,
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: t,
62
- className: e,
61
+ viewBox: e,
62
+ className: t,
63
63
  title: r || "Close",
64
- ...s,
65
- children: /* @__PURE__ */ n(
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: o ? "1" : "0.4"
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 = l.createContext(null);
88
- function j({
89
- initialOpen: e = !1,
90
- open: t,
87
+ const y = c.createContext(null);
88
+ function X({
89
+ initialOpen: t = !1,
90
+ open: e,
91
91
  onOpenChange: r
92
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,
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
- }), p = m.context, g = D(p, {
97
- enabled: t == null
98
- }), f = P(p, {
96
+ }), f = p.context, v = D(f, {
97
+ enabled: e == null
98
+ }), x = P(f, {
99
99
  outsidePress: !1,
100
100
  outsidePressEvent: "mousedown"
101
- }), b = B(p), N = V([g, f, b]);
102
- return l.useMemo(
101
+ }), h = B(f), I = V([v, x, h]);
102
+ return c.useMemo(
103
103
  () => ({
104
- open: d,
104
+ open: u,
105
105
  setOpen: w,
106
- ...N,
107
- ...m,
108
- labelId: c,
109
- descriptionId: u,
110
- setLabelId: i,
111
- setDescriptionId: a
106
+ ...I,
107
+ ...p,
108
+ labelId: a,
109
+ descriptionId: d,
110
+ setLabelId: n,
111
+ setDescriptionId: m
112
112
  }),
113
- [d, w, N, m, c, u]
113
+ [u, w, I, p, a, d]
114
114
  );
115
115
  }
116
- const x = () => {
117
- const e = l.useContext(y);
118
- if (e == null)
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 e;
120
+ return t;
121
121
  };
122
- function X({
123
- children: e,
124
- ...t
122
+ function H({
123
+ children: t,
124
+ ...e
125
125
  }) {
126
- const r = j(t);
127
- return /* @__PURE__ */ n(y.Provider, { value: r, children: e });
126
+ const r = X(e);
127
+ return /* @__PURE__ */ l(y.Provider, { value: r, children: t });
128
128
  }
129
- const q = l.forwardRef(function(e, t) {
130
- const { context: r, ...o } = x(), s = F([o.refs.setFloating, t]);
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: c, ...i } = e, u = E("grid place-items-center", {
134
- [`${c}`]: c,
135
- "bg-black sm:bg-black/[.8]": !c
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__ */ n(U, { children: /* @__PURE__ */ n(Y, { className: u, lockScroll: !0, children: /* @__PURE__ */ n(k, { context: r, children: /* @__PURE__ */ n(
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: s,
141
- "aria-labelledby": o.labelId,
142
- "aria-describedby": o.descriptionId,
143
- ...o.getFloatingProps(i),
144
- children: i.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
- }), 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
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: "09/01/2025 04:01 PM EDT",
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 h = "panel", _ = "messagebox", Q = ({
175
- className: e,
176
- kind: t,
174
+ const i = "panel", g = "messagebox", Z = ({
175
+ className: t,
176
+ kind: e,
177
177
  borderMode: r,
178
- animation: o,
179
- maxWidth: s = "medium"
180
- }) => ({
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,
189
- [`${e}`]: !!e,
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 === _
194
- }),
195
- content: "flex flex-col py-2 sm:py-4 sm:px-4 px-2 overflow-y-auto",
196
- footer: "flex grow flex-col sm:p-4 p-2",
197
- header: "sm:p-4 mb-0 p-2",
198
- close: "sm:p-4 p-2"
199
- }), Z = "slide", M = "fade", se = ({
200
- open: e,
201
- onOpenChange: t,
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: o,
204
- footer: s,
205
- borderMode: c = "light",
206
- kind: i = h,
207
- className: u,
208
- animation: a = !1,
209
- animationType: d = Z,
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 m = $(""), [p, g] = R(
213
- a ? d === M ? { opacity: 0 } : {
229
+ const f = $(""), [v, x] = R(
230
+ m ? u === C ? { opacity: 0 } : {
214
231
  transform: "translateY(-100vh)"
215
232
  } : {}
216
- ), f = Q({
217
- className: u,
218
- kind: i,
219
- borderMode: c,
220
- animation: a,
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(() => (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 } : {
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 b = setTimeout(() => {
233
- g(
234
- a ? d === "fade" ? { opacity: 1 } : {
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(b);
257
+ return () => clearTimeout(I);
240
258
  }
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,
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: f.close,
247
- trigger: /* @__PURE__ */ n(
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__ */ n(G, { monotone: !0 })
272
+ children: /* @__PURE__ */ l(j, { monotone: !0 })
255
273
  }
256
274
  )
257
275
  }
258
276
  ),
259
- /* @__PURE__ */ n(H, { className: f.header, children: r })
277
+ /* @__PURE__ */ l(J, { className: h.header, children: r })
260
278
  ] }),
261
- /* @__PURE__ */ n(J, { className: f.content, children: o }),
262
- s && /* @__PURE__ */ n("div", { className: f.footer, children: s })
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
- C as MESSAGEBOX_CLASSNAME,
267
- I as PANEL_CLASSNAME,
268
- se as Panel
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 only applies to panels, not messageboxes.
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.1
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.1",
9
- buildTime: "09/01/2025 04:01 PM EDT",
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.1",
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": "dcc216644c8c3e7d43a49ea655a22aed21fa4b83"
57
+ "gitHead": "731554d2c2fc2ae1c3c62ffbe09eba2b77308a70"
58
58
  }