@versini/ui-panel 3.3.1 → 3.4.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/index.d.ts CHANGED
@@ -1,68 +1,69 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
-
3
- declare const MESSAGEBOX_CLASSNAME = "av-messagebox";
4
- declare const PANEL_CLASSNAME = "av-panel";
5
-
6
- type PanelProps = {
7
- /**
8
- * Class name to apply to the Panel - this will ONLY override the default width styles.
9
- */
10
- className?: string;
11
- /**
12
- * The children to render.
13
- */
14
- children: React.ReactNode;
15
- /**
16
- * Callback fired when the component is opened or closed.
17
- * @param open whether or not the menu is open
18
- */
19
- onOpenChange: (open: boolean) => void;
20
- /**
21
- * Whether or not to open the component..
22
- * @default false
23
- */
24
- open: boolean;
25
- /**
26
- * The title to use for the panel.
27
- */
28
- title: string;
29
- /**
30
- * The type of Panel border.
31
- */
32
- borderMode?: "dark" | "light";
33
- /**
34
- * The content to render in the footer.
35
- */
36
- footer?: React.ReactNode;
37
- /**
38
- * The type of Panel. This will change the layout of the Panel.
39
- */
40
- kind?: "panel" | "messagebox";
41
- /**
42
- * Whether or not to animate the opening and closing of the Panel.
43
- */
44
- animation?: boolean;
45
- /**
46
- * The type of animation to use when opening and closing the Panel.
47
- * NOTE: This is only used when `animation` is set to `true`.
48
- * @default "slide"
49
- */
50
- animationType?: "slide" | "fade";
51
- /**
52
- * The maximum width of the Panel when kind is "panel".
53
- * NOTE: This does not affect messageboxes, which have a fixed width.
54
- * @default "medium"
55
- */
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";
64
- };
65
-
66
- declare const Panel: ({ open, onOpenChange, title, children, footer, borderMode, kind, className, animation, animationType, maxWidth, maxHeight, }: PanelProps) => react_jsx_runtime.JSX.Element;
67
-
68
- export { MESSAGEBOX_CLASSNAME, PANEL_CLASSNAME, Panel };
1
+ import { JSX } from 'react/jsx-runtime';
2
+
3
+ export declare const MESSAGEBOX_CLASSNAME = "av-messagebox";
4
+
5
+ export declare const Panel: ({ open, onOpenChange, title, children, footer, borderMode, kind, className, animation, animationType, maxWidth, maxHeight, }: PanelProps) => JSX.Element;
6
+
7
+ export declare const PANEL_CLASSNAME = "av-panel";
8
+
9
+ declare type PanelProps = {
10
+ /**
11
+ * Class name to apply to the Panel - this will ONLY override the default width styles.
12
+ */
13
+ className?: string;
14
+ /**
15
+ * The children to render.
16
+ */
17
+ children: React.ReactNode;
18
+ /**
19
+ * Callback fired when the component is opened or closed.
20
+ * @param open whether or not the menu is open
21
+ */
22
+ onOpenChange: (open: boolean) => void;
23
+ /**
24
+ * Whether or not to open the component..
25
+ * @default false
26
+ */
27
+ open: boolean;
28
+ /**
29
+ * The title to use for the panel.
30
+ */
31
+ title: string;
32
+ /**
33
+ * The type of Panel border.
34
+ */
35
+ borderMode?: "dark" | "light";
36
+ /**
37
+ * The content to render in the footer.
38
+ */
39
+ footer?: React.ReactNode;
40
+ /**
41
+ * The type of Panel. This will change the layout of the Panel.
42
+ */
43
+ kind?: "panel" | "messagebox";
44
+ /**
45
+ * Whether or not to animate the opening and closing of the Panel.
46
+ */
47
+ animation?: boolean;
48
+ /**
49
+ * The type of animation to use when opening and closing the Panel.
50
+ * NOTE: This is only used when `animation` is set to `true`.
51
+ * @default "slide"
52
+ */
53
+ animationType?: "slide" | "fade";
54
+ /**
55
+ * The maximum width of the Panel when kind is "panel".
56
+ * NOTE: This does not affect messageboxes, which have a fixed width.
57
+ * @default "medium"
58
+ */
59
+ maxWidth?: "small" | "medium" | "large";
60
+ /**
61
+ * The maximum height of the Panel or Messagebox.
62
+ * For panels: defaults to "large" (95%) if not specified.
63
+ * For messageboxes: no max-height is applied unless explicitly set.
64
+ * @default "large" (for panels only)
65
+ */
66
+ maxHeight?: "small" | "medium" | "large";
67
+ };
68
+
69
+ export { }
package/dist/index.js CHANGED
@@ -1,19 +1,198 @@
1
- import { MESSAGEBOX_CLASSNAME as o, PANEL_CLASSNAME as E, Panel as A } from "./components/Panel/Panel.js";
2
1
  /*!
3
- @versini/ui-panel v3.3.1
2
+ @versini/ui-panel v3.4.0
4
3
  © 2025 gizmette.com
5
4
  */
6
5
  try {
7
- window.__VERSINI_UI_PANEL__ || (window.__VERSINI_UI_PANEL__ = {
8
- version: "3.3.1",
9
- buildTime: "11/04/2025 10:24 AM EST",
10
- homepage: "https://github.com/aversini/ui-components",
11
- license: "MIT"
12
- });
13
- } catch {
6
+ if (!window.__VERSINI_UI_PANEL__) {
7
+ window.__VERSINI_UI_PANEL__ = {
8
+ version: "3.4.0",
9
+ buildTime: "11/04/2025 03:43 PM EST",
10
+ homepage: "https://github.com/aversini/ui-components",
11
+ license: "MIT",
12
+ };
13
+ }
14
+ } catch (error) {
15
+ // nothing to declare officer
14
16
  }
15
- export {
16
- o as MESSAGEBOX_CLASSNAME,
17
- E as PANEL_CLASSNAME,
18
- A as Panel
17
+
18
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
19
+ import { ButtonIcon } from "@versini/ui-button";
20
+ import { IconClose } from "@versini/ui-icons";
21
+ import { Modal, ModalClose, ModalContent, ModalDescription, ModalHeading } from "@versini/ui-modal";
22
+ import { useEffect, useRef, useState } from "react";
23
+ import clsx from "clsx";
24
+
25
+ ;// CONCATENATED MODULE: ./src/common/constants.ts
26
+ const MESSAGEBOX_CLASSNAME = "av-messagebox";
27
+ const PANEL_CLASSNAME = "av-panel";
28
+
29
+ ;// CONCATENATED MODULE: external "react/jsx-runtime"
30
+
31
+ ;// CONCATENATED MODULE: external "@versini/ui-button"
32
+
33
+ ;// CONCATENATED MODULE: external "@versini/ui-icons"
34
+
35
+ ;// CONCATENATED MODULE: external "@versini/ui-modal"
36
+
37
+ ;// CONCATENATED MODULE: external "react"
38
+
39
+ ;// CONCATENATED MODULE: external "clsx"
40
+
41
+ ;// CONCATENATED MODULE: ./src/components/Panel/utilities.ts
42
+
43
+
44
+ const TYPE_PANEL = "panel";
45
+ const TYPE_MESSAGEBOX = "messagebox";
46
+ const getPanelClassName = ({ className, kind, borderMode, animation, maxWidth = "medium", maxHeight })=>{
47
+ // Apply default maxHeight only for TYPE_PANEL to maintain backward compatibility
48
+ const effectiveMaxHeight = maxHeight ?? (kind === TYPE_PANEL ? "large" : undefined);
49
+ return {
50
+ main: clsx("prose prose-lighter flex flex-col bg-surface-dark", {
51
+ "duration-200 ease-out": animation,
52
+ /**
53
+ * Panel styles
54
+ */ [`${PANEL_CLASSNAME} min-h-full sm:min-h-[10rem] sm:rounded-lg sm:border-2`]: kind === TYPE_PANEL,
55
+ ["w-full sm:w-[95%] md:max-w-2xl"]: kind === TYPE_PANEL && !className && maxWidth === "small",
56
+ ["w-full sm:w-[95%] md:max-w-3xl"]: kind === TYPE_PANEL && !className && maxWidth === "medium",
57
+ ["w-full sm:w-[95%] md:max-w-4xl"]: kind === TYPE_PANEL && !className && maxWidth === "large",
58
+ "max-h-full sm:max-h-[40%]": kind === TYPE_PANEL && effectiveMaxHeight === "small",
59
+ "max-h-full sm:max-h-[60%]": kind === TYPE_PANEL && effectiveMaxHeight === "medium",
60
+ "max-h-full sm:max-h-[95%]": kind === TYPE_PANEL && effectiveMaxHeight === "large",
61
+ "sm:border-border-dark": borderMode === "dark" && kind === TYPE_PANEL,
62
+ "sm:border-border-accent": borderMode === "light" && kind === TYPE_PANEL,
63
+ /**
64
+ * Messagebox styles
65
+ */ [`${MESSAGEBOX_CLASSNAME} rounded-lg border-2`]: kind === TYPE_MESSAGEBOX,
66
+ ["w-[95%] sm:w-[50%] md:max-w-2xl"]: kind === TYPE_MESSAGEBOX && !className,
67
+ "max-h-[20%]": kind === TYPE_MESSAGEBOX && effectiveMaxHeight === "small",
68
+ "max-h-[50%]": kind === TYPE_MESSAGEBOX && effectiveMaxHeight === "medium",
69
+ "max-h-[95%]": kind === TYPE_MESSAGEBOX && effectiveMaxHeight === "large",
70
+ "border-border-dark": borderMode === "dark" && kind === TYPE_MESSAGEBOX,
71
+ "border-border-accent": borderMode === "light" && kind === TYPE_MESSAGEBOX,
72
+ [`${className}`]: !!className
73
+ }),
74
+ content: "flex flex-col py-2 sm:py-4 sm:px-4 px-2 overflow-y-auto",
75
+ footer: "flex grow flex-col sm:p-4 p-2",
76
+ header: "sm:p-4 mb-0 p-2",
77
+ close: "sm:p-4 p-2"
78
+ };
19
79
  };
80
+
81
+ ;// CONCATENATED MODULE: ./src/components/Panel/Panel.tsx
82
+
83
+
84
+
85
+
86
+
87
+
88
+ const ANIMATION_SLIDE = "slide";
89
+ const ANIMATION_FADE = "fade";
90
+ const Panel = ({ open, onOpenChange, title, children, footer, borderMode = "light", kind = TYPE_PANEL, className, animation = false, animationType = ANIMATION_SLIDE, maxWidth = "medium", maxHeight })=>{
91
+ const originalTitleRef = useRef("");
92
+ /* v8 ignore next 9 */ const [animationStyles, setAnimationStyles] = useState(!animation ? {} : animationType === ANIMATION_FADE ? {
93
+ opacity: 0
94
+ } : {
95
+ transform: "translateY(-100vh)"
96
+ });
97
+ const panelClassName = getPanelClassName({
98
+ className,
99
+ kind,
100
+ borderMode,
101
+ animation,
102
+ maxWidth,
103
+ maxHeight
104
+ });
105
+ /**
106
+ * If the panel is opened, set the document
107
+ * title to the panel's title. If it's closed,
108
+ * restore the original document.title.
109
+ */ useEffect(()=>{
110
+ if (open) {
111
+ originalTitleRef.current = document.title;
112
+ document.title = `${title} | ${originalTitleRef.current}`;
113
+ }
114
+ return ()=>{
115
+ if (open) {
116
+ document.title = originalTitleRef.current;
117
+ }
118
+ };
119
+ }, [
120
+ title,
121
+ open
122
+ ]);
123
+ /**
124
+ * Effect to handle the opening and closing animations.
125
+ */ /* v8 ignore next 30 */ useEffect(()=>{
126
+ if (!animation) {
127
+ return;
128
+ }
129
+ if (open) {
130
+ setAnimationStyles(!animation ? {} : animationType === ANIMATION_FADE ? {
131
+ opacity: 0
132
+ } : {
133
+ transform: "translateY(-666vh)"
134
+ });
135
+ // Small delay to ensure the opening state is applied after
136
+ // the component is rendered.
137
+ const timer = setTimeout(()=>{
138
+ setAnimationStyles(!animation ? {} : animationType === "fade" ? {
139
+ opacity: 1
140
+ } : {
141
+ transform: "translateY(0)"
142
+ });
143
+ }, 100);
144
+ return ()=>clearTimeout(timer);
145
+ }
146
+ }, [
147
+ open,
148
+ animation,
149
+ animationType
150
+ ]);
151
+ return /*#__PURE__*/ jsx(Fragment, {
152
+ children: open && /*#__PURE__*/ jsx(Modal, {
153
+ open: open,
154
+ onOpenChange: onOpenChange,
155
+ children: /*#__PURE__*/ jsxs(ModalContent, {
156
+ className: panelClassName.main,
157
+ style: animationStyles,
158
+ children: [
159
+ /*#__PURE__*/ jsxs("div", {
160
+ className: "flex flex-row-reverse items-center justify-between",
161
+ children: [
162
+ /*#__PURE__*/ jsx(ModalClose, {
163
+ className: panelClassName.close,
164
+ trigger: /*#__PURE__*/ jsx(ButtonIcon, {
165
+ mode: "dark",
166
+ focusMode: "light",
167
+ noBorder: true,
168
+ label: "Close",
169
+ children: /*#__PURE__*/ jsx(IconClose, {
170
+ monotone: true
171
+ })
172
+ })
173
+ }),
174
+ /*#__PURE__*/ jsx(ModalHeading, {
175
+ className: panelClassName.header,
176
+ children: title
177
+ })
178
+ ]
179
+ }),
180
+ /*#__PURE__*/ jsx(ModalDescription, {
181
+ className: panelClassName.content,
182
+ children: children
183
+ }),
184
+ footer && /*#__PURE__*/ jsx("div", {
185
+ className: panelClassName.footer,
186
+ children: footer
187
+ })
188
+ ]
189
+ })
190
+ })
191
+ });
192
+ };
193
+
194
+ ;// CONCATENATED MODULE: ./src/components/index.ts
195
+
196
+
197
+
198
+ export { MESSAGEBOX_CLASSNAME, PANEL_CLASSNAME, Panel };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@versini/ui-panel",
3
- "version": "3.3.1",
3
+ "version": "3.4.0",
4
4
  "license": "MIT",
5
5
  "author": "Arno Versini",
6
6
  "publishConfig": {
@@ -20,13 +20,13 @@
20
20
  ],
21
21
  "scripts": {
22
22
  "build:check": "tsc",
23
- "build:js": "vite build",
24
- "build:types": "tsup",
25
- "build": "npm-run-all --serial clean build:check build:js build:types",
23
+ "build:js": "rslib build",
24
+ "build:types": "echo 'Types now built with rslib'",
25
+ "build": "npm-run-all --serial clean build:check build:js",
26
26
  "clean": "rimraf dist tmp",
27
- "dev:js": "vite build --watch --mode development",
28
- "dev:types": "tsup --watch src",
29
- "dev": "npm-run-all clean --parallel dev:js dev:types",
27
+ "dev:js": "rslib build --watch",
28
+ "dev:types": "echo 'Types now watched with rslib'",
29
+ "dev": "rslib build --watch",
30
30
  "lint": "biome lint src",
31
31
  "lint:fix": "biome check src --write --no-errors-on-unmatched",
32
32
  "prettier": "biome check --write --no-errors-on-unmatched",
@@ -41,14 +41,14 @@
41
41
  },
42
42
  "dependencies": {
43
43
  "@tailwindcss/typography": "0.5.19",
44
- "@versini/ui-button": "8.3.0",
44
+ "@versini/ui-button": "8.3.1",
45
45
  "@versini/ui-icons": "4.15.1",
46
- "@versini/ui-modal": "3.0.2",
46
+ "@versini/ui-modal": "3.1.0",
47
47
  "clsx": "2.1.1",
48
48
  "tailwindcss": "4.1.16"
49
49
  },
50
50
  "sideEffects": [
51
51
  "**/*.css"
52
52
  ],
53
- "gitHead": "2169d82d7a8199466642cad5b4cf01cc3b8a3128"
53
+ "gitHead": "7484ad443b77ef31e52ae3a7d88b8129bc6cdf1d"
54
54
  }
@@ -1,263 +0,0 @@
1
- import { jsx as l, jsxs as v, Fragment as y } from "react/jsx-runtime";
2
- import { ButtonIcon as A } from "@versini/ui-button";
3
- import S from "clsx";
4
- import * as a from "react";
5
- import { useId as C, useRef as L, useState as O, useEffect as E } from "react";
6
- import { useFloating as R, useClick as P, useDismiss as T, useRole as D, useInteractions as F, useMergeRefs as V, FloatingPortal as $, FloatingOverlay as B, FloatingFocusManager as U } from "@floating-ui/react";
7
- const Y = "av-messagebox", G = "av-panel";
8
- /*!
9
- @versini/ui-icons v4.15.1
10
- © 2025 gizmette.com
11
- */
12
- try {
13
- window.__VERSINI_UI_ICONS__ || (window.__VERSINI_UI_ICONS__ = {
14
- version: "4.15.1",
15
- buildTime: "11/03/2025 07:21 PM EST",
16
- homepage: "https://github.com/aversini/ui-icons",
17
- license: "MIT"
18
- });
19
- } catch {
20
- }
21
- /*!
22
- @versini/ui-svgicon v4.3.0
23
- © 2025 gizmette.com
24
- */
25
- try {
26
- window.__VERSINI_UI_SVGICON__ || (window.__VERSINI_UI_SVGICON__ = {
27
- version: "4.3.0",
28
- buildTime: "11/03/2025 07:21 PM EST",
29
- homepage: "https://github.com/aversini/ui-icons",
30
- license: "MIT"
31
- });
32
- } catch {
33
- }
34
- const j = ({ children: r, fill: e, viewBox: t, className: s, defaultViewBox: o, size: c, title: n, semantic: d = !1, ...m }) => {
35
- const u = S(c, s);
36
- return /* @__PURE__ */ v("svg", {
37
- xmlns: "http://www.w3.org/2000/svg",
38
- className: u,
39
- viewBox: t || o,
40
- fill: e || "currentColor",
41
- role: "img",
42
- "aria-hidden": !d,
43
- focusable: !1,
44
- ...m,
45
- children: [
46
- n && d && /* @__PURE__ */ l("title", {
47
- children: n
48
- }),
49
- r
50
- ]
51
- });
52
- }, z = ({ className: r, viewBox: e, title: t, monotone: s, ...o }) => /* @__PURE__ */ l(j, {
53
- defaultViewBox: "0 0 384 512",
54
- size: "size-5",
55
- viewBox: e,
56
- className: r,
57
- title: t || "Close",
58
- ...o,
59
- children: /* @__PURE__ */ l("path", {
60
- 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",
61
- opacity: s ? "1" : "0.4"
62
- })
63
- }), M = a.createContext(null);
64
- function X({
65
- initialOpen: r = !1,
66
- open: e,
67
- onOpenChange: t
68
- } = {}) {
69
- const [s, o] = a.useState(r), [c, n] = a.useState(), [d, m] = a.useState(), u = e ?? s, p = t ?? o, I = R({
70
- open: u,
71
- onOpenChange: p
72
- }), f = I.context, b = P(f, {
73
- enabled: e == null
74
- }), w = T(f, {
75
- outsidePress: !1,
76
- outsidePressEvent: "mousedown"
77
- }), h = D(f), _ = F([b, w, h]);
78
- return a.useMemo(
79
- () => ({
80
- open: u,
81
- setOpen: p,
82
- ..._,
83
- ...I,
84
- labelId: c,
85
- descriptionId: d,
86
- setLabelId: n,
87
- setDescriptionId: m
88
- }),
89
- [u, p, _, I, c, d]
90
- );
91
- }
92
- const x = () => {
93
- const r = a.useContext(M);
94
- if (r == null)
95
- throw new Error("Modal components must be wrapped in <Modal />");
96
- return r;
97
- };
98
- function H({
99
- children: r,
100
- ...e
101
- }) {
102
- const t = X(e);
103
- return /* @__PURE__ */ l(M.Provider, { value: t, children: r });
104
- }
105
- const q = a.forwardRef(function(r, e) {
106
- const { context: t, ...s } = x(), o = V([s.refs.setFloating, e]);
107
- if (!t.open)
108
- return null;
109
- const { overlayBackground: c, ...n } = r, d = S("grid place-items-center", {
110
- [`${c}`]: c,
111
- "bg-black sm:bg-black/[.8]": !c
112
- });
113
- return /* @__PURE__ */ l($, { children: /* @__PURE__ */ l(B, { className: d, lockScroll: !0, children: /* @__PURE__ */ l(U, { context: t, children: /* @__PURE__ */ l(
114
- "div",
115
- {
116
- ref: o,
117
- "aria-labelledby": s.labelId,
118
- "aria-describedby": s.descriptionId,
119
- ...s.getFloatingProps(n),
120
- children: n.children
121
- }
122
- ) }) }) });
123
- }), J = a.forwardRef(function({ children: r, ...e }, t) {
124
- const { setLabelId: s } = x(), o = C();
125
- return a.useLayoutEffect(() => (s(o), () => s(void 0)), [o, s]), /* @__PURE__ */ l("h1", { ...e, ref: t, id: o, children: r });
126
- }), K = a.forwardRef(function({ children: r, ...e }, t) {
127
- const { setDescriptionId: s } = x(), o = C();
128
- return a.useLayoutEffect(() => (s(o), () => s(void 0)), [o, s]), /* @__PURE__ */ l("div", { ...e, ref: t, id: o, children: r });
129
- }), Q = a.forwardRef(function(r, e) {
130
- const { setOpen: t } = x(), { trigger: s, className: o, ...c } = r, n = a.useCallback(() => t(!1), [t]);
131
- return /* @__PURE__ */ l("div", { className: o, children: a.cloneElement(s, {
132
- ref: e,
133
- onClick: n,
134
- ...c
135
- }) });
136
- });
137
- /*!
138
- @versini/ui-modal v3.0.2
139
- © 2025 gizmette.com
140
- */
141
- try {
142
- window.__VERSINI_UI_MODAL__ || (window.__VERSINI_UI_MODAL__ = {
143
- version: "3.0.2",
144
- buildTime: "11/04/2025 10:24 AM EST",
145
- homepage: "https://github.com/aversini/ui-components",
146
- license: "MIT"
147
- });
148
- } catch {
149
- }
150
- const i = "panel", g = "messagebox", Z = ({
151
- className: r,
152
- kind: e,
153
- borderMode: t,
154
- animation: s,
155
- maxWidth: o = "medium",
156
- maxHeight: c
157
- }) => {
158
- const n = c ?? (e === i ? "large" : void 0);
159
- return {
160
- main: S("prose prose-lighter flex flex-col bg-surface-dark", {
161
- "duration-200 ease-out": s,
162
- /**
163
- * Panel styles
164
- */
165
- [`${G} min-h-full sm:min-h-[10rem] sm:rounded-lg sm:border-2`]: e === i,
166
- "w-full sm:w-[95%] md:max-w-2xl": e === i && !r && o === "small",
167
- "w-full sm:w-[95%] md:max-w-3xl": e === i && !r && o === "medium",
168
- "w-full sm:w-[95%] md:max-w-4xl": e === i && !r && o === "large",
169
- "max-h-full sm:max-h-[40%]": e === i && n === "small",
170
- "max-h-full sm:max-h-[60%]": e === i && n === "medium",
171
- "max-h-full sm:max-h-[95%]": e === i && n === "large",
172
- "sm:border-border-dark": t === "dark" && e === i,
173
- "sm:border-border-accent": t === "light" && e === i,
174
- /**
175
- * Messagebox styles
176
- */
177
- [`${Y} rounded-lg border-2`]: e === g,
178
- "w-[95%] sm:w-[50%] md:max-w-2xl": e === g && !r,
179
- "max-h-[20%]": e === g && n === "small",
180
- "max-h-[50%]": e === g && n === "medium",
181
- "max-h-[95%]": e === g && n === "large",
182
- "border-border-dark": t === "dark" && e === g,
183
- "border-border-accent": t === "light" && e === g,
184
- [`${r}`]: !!r
185
- }),
186
- content: "flex flex-col py-2 sm:py-4 sm:px-4 px-2 overflow-y-auto",
187
- footer: "flex grow flex-col sm:p-4 p-2",
188
- header: "sm:p-4 mb-0 p-2",
189
- close: "sm:p-4 p-2"
190
- };
191
- }, W = "slide", N = "fade", oe = ({
192
- open: r,
193
- onOpenChange: e,
194
- title: t,
195
- children: s,
196
- footer: o,
197
- borderMode: c = "light",
198
- kind: n = i,
199
- className: d,
200
- animation: m = !1,
201
- animationType: u = W,
202
- maxWidth: p = "medium",
203
- maxHeight: I
204
- }) => {
205
- const f = L(""), [b, w] = O(
206
- m ? u === N ? { opacity: 0 } : {
207
- transform: "translateY(-100vh)"
208
- } : {}
209
- ), h = Z({
210
- className: d,
211
- kind: n,
212
- borderMode: c,
213
- animation: m,
214
- maxWidth: p,
215
- maxHeight: I
216
- });
217
- return E(() => (r && (f.current = document.title, document.title = `${t} | ${f.current}`), () => {
218
- r && (document.title = f.current);
219
- }), [t, r]), E(() => {
220
- if (m && r) {
221
- w(
222
- m ? u === N ? { opacity: 0 } : {
223
- transform: "translateY(-666vh)"
224
- } : {}
225
- );
226
- const _ = setTimeout(() => {
227
- w(
228
- m ? u === "fade" ? { opacity: 1 } : {
229
- transform: "translateY(0)"
230
- } : {}
231
- );
232
- }, 100);
233
- return () => clearTimeout(_);
234
- }
235
- }, [r, m, u]), /* @__PURE__ */ l(y, { children: r && /* @__PURE__ */ l(H, { open: r, onOpenChange: e, children: /* @__PURE__ */ v(q, { className: h.main, style: b, children: [
236
- /* @__PURE__ */ v("div", { className: "flex flex-row-reverse items-center justify-between", children: [
237
- /* @__PURE__ */ l(
238
- Q,
239
- {
240
- className: h.close,
241
- trigger: /* @__PURE__ */ l(
242
- A,
243
- {
244
- mode: "dark",
245
- focusMode: "light",
246
- noBorder: !0,
247
- label: "Close",
248
- children: /* @__PURE__ */ l(z, { monotone: !0 })
249
- }
250
- )
251
- }
252
- ),
253
- /* @__PURE__ */ l(J, { className: h.header, children: t })
254
- ] }),
255
- /* @__PURE__ */ l(K, { className: h.content, children: s }),
256
- o && /* @__PURE__ */ l("div", { className: h.footer, children: o })
257
- ] }) }) });
258
- };
259
- export {
260
- Y as MESSAGEBOX_CLASSNAME,
261
- G as PANEL_CLASSNAME,
262
- oe as Panel
263
- };