@versini/ui-panel 1.1.1 → 1.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.
@@ -0,0 +1,272 @@
1
+ import { jsx as c, jsxs as E, Fragment as T } from "react/jsx-runtime";
2
+ import I from "clsx";
3
+ import * as i from "react";
4
+ import { useRef as _, useReducer as M, useEffect as D, useId as A } from "react";
5
+ import { useFloating as x, useClick as S, useDismiss as P, useRole as $, useInteractions as F, useMergeRefs as O, FloatingPortal as k, FloatingOverlay as L, FloatingFocusManager as U } from "@floating-ui/react";
6
+ const w = "SET_ANNOUNCEMENT", C = "CLEAR_ANNOUNCEMENT", V = {
7
+ alert: null,
8
+ alertdialog: null,
9
+ log: "polite",
10
+ marquee: null,
11
+ progressbar: null,
12
+ status: "polite",
13
+ timer: "assertive"
14
+ }, B = (e, n) => {
15
+ switch (n == null ? void 0 : n.type) {
16
+ case w:
17
+ return {
18
+ ...e,
19
+ announcement: n.payload
20
+ };
21
+ case C:
22
+ return {
23
+ ...e,
24
+ announcement: null
25
+ };
26
+ default:
27
+ return e;
28
+ }
29
+ }, j = ({
30
+ onAnnouncementClear: e,
31
+ dispatch: n
32
+ }) => {
33
+ n({
34
+ type: C
35
+ }), typeof e == "function" && e();
36
+ }, b = ({
37
+ children: e,
38
+ clearAnnouncementDelay: n,
39
+ clearAnnouncementTimeoutRef: t,
40
+ onAnnouncementClear: o,
41
+ dispatch: l
42
+ }) => {
43
+ clearTimeout(t.current), e !== null && l({
44
+ type: w,
45
+ payload: e
46
+ }), n && (t.current = setTimeout(
47
+ () => j({
48
+ onAnnouncementClear: o,
49
+ dispatch: l
50
+ }),
51
+ n
52
+ ));
53
+ }, G = ({
54
+ children: e,
55
+ announcementTimeoutRef: n,
56
+ announcementDelay: t,
57
+ clearAnnouncementDelay: o,
58
+ clearAnnouncementTimeoutRef: l,
59
+ onAnnouncementClear: r,
60
+ dispatch: a
61
+ }) => {
62
+ clearTimeout(n.current), t ? n.current = setTimeout(b, t, {
63
+ children: e,
64
+ clearAnnouncementDelay: o,
65
+ clearAnnouncementTimeoutRef: l,
66
+ onAnnouncementClear: r,
67
+ dispatch: a
68
+ }) : b({
69
+ children: e,
70
+ clearAnnouncementDelay: o,
71
+ clearAnnouncementTimeoutRef: l,
72
+ onAnnouncementClear: r,
73
+ dispatch: a
74
+ });
75
+ };
76
+ function W({
77
+ children: e,
78
+ className: n,
79
+ politeness: t,
80
+ role: o = null,
81
+ announcementDelay: l,
82
+ clearAnnouncementDelay: r,
83
+ onAnnouncementClear: a,
84
+ visible: s,
85
+ ...p
86
+ }) {
87
+ const u = _(null), d = _(null), [m, f] = M(B, {
88
+ announcement: null
89
+ });
90
+ let h = t;
91
+ typeof h > "u" && (h = o ? V[o] : "assertive"), D(() => {
92
+ G({
93
+ announcementTimeoutRef: u,
94
+ announcementDelay: l,
95
+ children: e,
96
+ clearAnnouncementDelay: r,
97
+ clearAnnouncementTimeoutRef: d,
98
+ onAnnouncementClear: a,
99
+ dispatch: f
100
+ });
101
+ }, [
102
+ e,
103
+ l,
104
+ r,
105
+ a
106
+ ]);
107
+ const g = I(n, {
108
+ "sr-only": !s
109
+ });
110
+ return /* @__PURE__ */ c(
111
+ "div",
112
+ {
113
+ "aria-live": h,
114
+ ...o && { role: o },
115
+ className: g,
116
+ ...p,
117
+ children: m.announcement
118
+ }
119
+ );
120
+ }
121
+ const N = i.createContext(null);
122
+ function q({
123
+ initialOpen: e = !1,
124
+ open: n,
125
+ onOpenChange: t
126
+ } = {}) {
127
+ const [o, l] = i.useState(e), [r, a] = i.useState(), [s, p] = i.useState(), u = n ?? o, d = t ?? l, m = x({
128
+ open: u,
129
+ onOpenChange: d
130
+ }), f = m.context, h = S(f, {
131
+ enabled: n == null
132
+ }), g = P(f, {
133
+ outsidePress: !1,
134
+ outsidePressEvent: "mousedown"
135
+ }), R = $(f), y = F([h, g, R]);
136
+ return i.useMemo(
137
+ () => ({
138
+ open: u,
139
+ setOpen: d,
140
+ ...y,
141
+ ...m,
142
+ labelId: r,
143
+ descriptionId: s,
144
+ setLabelId: a,
145
+ setDescriptionId: p
146
+ }),
147
+ [u, d, y, m, r, s]
148
+ );
149
+ }
150
+ const v = () => {
151
+ const e = i.useContext(N);
152
+ if (e == null)
153
+ throw new Error("Modal components must be wrapped in <Modal />");
154
+ return e;
155
+ };
156
+ function X({
157
+ children: e,
158
+ ...n
159
+ }) {
160
+ const t = q(n);
161
+ return /* @__PURE__ */ c(N.Provider, { value: t, children: e });
162
+ }
163
+ const Y = i.forwardRef(function(e, n) {
164
+ const { context: t, ...o } = v(), l = O([o.refs.setFloating, n]);
165
+ if (!t.open)
166
+ return null;
167
+ const { overlayBackground: r, ...a } = e, s = I("grid place-items-center", {
168
+ [`${r}`]: r,
169
+ "bg-black sm:bg-black/[.8]": !r
170
+ });
171
+ return /* @__PURE__ */ c(k, { children: /* @__PURE__ */ c(L, { className: s, lockScroll: !0, children: /* @__PURE__ */ c(U, { context: t, children: /* @__PURE__ */ c(
172
+ "div",
173
+ {
174
+ ref: l,
175
+ "aria-labelledby": o.labelId,
176
+ "aria-describedby": o.descriptionId,
177
+ ...o.getFloatingProps(a),
178
+ children: a.children
179
+ }
180
+ ) }) }) });
181
+ }), Z = i.forwardRef(function({ children: e, ...n }, t) {
182
+ const { setLabelId: o } = v(), l = A();
183
+ return i.useLayoutEffect(() => (o(l), () => o(void 0)), [l, o]), /* @__PURE__ */ c("h1", { ...n, ref: t, id: l, children: e });
184
+ }), ee = i.forwardRef(function({ children: e, ...n }, t) {
185
+ const { setDescriptionId: o } = v(), l = A();
186
+ return i.useLayoutEffect(() => (o(l), () => o(void 0)), [l, o]), /* @__PURE__ */ c("div", { ...n, ref: t, id: l, children: e });
187
+ }), ne = i.forwardRef(function(e, n) {
188
+ const { setOpen: t } = v(), { trigger: o, className: l, ...r } = e, a = i.useCallback(() => t(!1), [t]);
189
+ return /* @__PURE__ */ c("div", { className: l, children: i.cloneElement(o, {
190
+ ref: n,
191
+ onClick: a,
192
+ ...r
193
+ }) });
194
+ });
195
+ /*!
196
+ @versini/ui-spacing v1.0.0
197
+ © 2024 gizmette.com
198
+ */
199
+ try {
200
+ window.__VERSINI_UI_SPACING__ || (window.__VERSINI_UI_SPACING__ = {
201
+ version: "1.0.0",
202
+ buildTime: "12/24/2024 06:47 PM EST",
203
+ homepage: "https://github.com/aversini/ui-components",
204
+ license: "MIT"
205
+ });
206
+ } catch {
207
+ }
208
+ const H = (e) => {
209
+ let n = "";
210
+ if (typeof e == "number" || typeof e == "string")
211
+ n = "m-" + e;
212
+ else {
213
+ const t = [];
214
+ (e == null ? void 0 : e.t) !== void 0 && t.push(`mt-${e.t}`), (e == null ? void 0 : e.r) !== void 0 && t.push(`mr-${e.r}`), (e == null ? void 0 : e.b) !== void 0 && t.push(`mb-${e.b}`), (e == null ? void 0 : e.l) !== void 0 && t.push(`ml-${e.l}`), n = t.join(" ");
215
+ }
216
+ return n;
217
+ }, te = ({
218
+ children: e,
219
+ fill: n,
220
+ viewBox: t,
221
+ className: o,
222
+ defaultViewBox: l,
223
+ defaultClassName: r,
224
+ spacing: a,
225
+ title: s,
226
+ semantic: p = !1,
227
+ ...u
228
+ }) => {
229
+ const d = H(a), m = I(
230
+ d,
231
+ o || r
232
+ );
233
+ return /* @__PURE__ */ E(T, { children: [
234
+ /* @__PURE__ */ c(
235
+ "svg",
236
+ {
237
+ xmlns: "http://www.w3.org/2000/svg",
238
+ className: m,
239
+ viewBox: t || l,
240
+ fill: n || "currentColor",
241
+ role: "img",
242
+ "aria-hidden": !p,
243
+ focusable: !1,
244
+ ...u,
245
+ children: e
246
+ }
247
+ ),
248
+ s && p && /* @__PURE__ */ c("span", { className: "sr-only", children: s })
249
+ ] });
250
+ };
251
+ /*!
252
+ @versini/ui-private v1.6.0
253
+ © 2024 gizmette.com
254
+ */
255
+ try {
256
+ window.__VERSINI_UI_PRIVATE__ || (window.__VERSINI_UI_PRIVATE__ = {
257
+ version: "1.6.0",
258
+ buildTime: "12/24/2024 06:47 PM EST",
259
+ homepage: "https://github.com/aversini/ui-components",
260
+ license: "MIT"
261
+ });
262
+ } catch {
263
+ }
264
+ export {
265
+ W as LiveRegion,
266
+ X as Modal,
267
+ ne as ModalClose,
268
+ Y as ModalContent,
269
+ ee as ModalDescription,
270
+ Z as ModalHeading,
271
+ te as SvgIcon
272
+ };
package/dist/index.js CHANGED
@@ -1,73 +1,87 @@
1
- import { jsx as l, jsxs as y, Fragment as V } from "react/jsx-runtime";
1
+ import { jsx as n, jsxs as y, Fragment as V } from "react/jsx-runtime";
2
2
  import o from "clsx";
3
- import E, { lazy as z, useRef as U, useEffect as j, Suspense as O } from "react";
3
+ import T, { lazy as U, useRef as z, useEffect as j, Suspense as O } from "react";
4
4
  /*!
5
- @versini/ui-panel v1.1.1
5
+ @versini/ui-panel v1.1.2
6
6
  © 2024 gizmette.com
7
7
  */
8
8
  try {
9
9
  window.__VERSINI_UI_PANEL__ || (window.__VERSINI_UI_PANEL__ = {
10
- version: "1.1.1",
11
- buildTime: "12/18/2024 01:22 PM EST",
10
+ version: "1.1.2",
11
+ buildTime: "12/24/2024 06:47 PM EST",
12
12
  homepage: "https://github.com/aversini/ui-components",
13
13
  license: "MIT"
14
14
  });
15
15
  } catch {
16
16
  }
17
- const S = "av-messagebox", R = "av-panel", C = "av-button", W = (e) => {
18
- let t = "";
17
+ const M = "av-messagebox", R = "av-panel", C = "av-button";
18
+ /*!
19
+ @versini/ui-spacing v1.0.0
20
+ © 2024 gizmette.com
21
+ */
22
+ try {
23
+ window.__VERSINI_UI_SPACING__ || (window.__VERSINI_UI_SPACING__ = {
24
+ version: "1.0.0",
25
+ buildTime: "12/24/2024 06:47 PM EST",
26
+ homepage: "https://github.com/aversini/ui-components",
27
+ license: "MIT"
28
+ });
29
+ } catch {
30
+ }
31
+ const G = (e) => {
32
+ let r = "";
19
33
  if (typeof e == "number" || typeof e == "string")
20
- t = "m-" + e;
34
+ r = "m-" + e;
21
35
  else {
22
- const r = [];
23
- (e == null ? void 0 : e.t) !== void 0 && r.push(`mt-${e.t}`), (e == null ? void 0 : e.r) !== void 0 && r.push(`mr-${e.r}`), (e == null ? void 0 : e.b) !== void 0 && r.push(`mb-${e.b}`), (e == null ? void 0 : e.l) !== void 0 && r.push(`ml-${e.l}`), t = r.join(" ");
36
+ const t = [];
37
+ (e == null ? void 0 : e.t) !== void 0 && t.push(`mt-${e.t}`), (e == null ? void 0 : e.r) !== void 0 && t.push(`mr-${e.r}`), (e == null ? void 0 : e.b) !== void 0 && t.push(`mb-${e.b}`), (e == null ? void 0 : e.l) !== void 0 && t.push(`ml-${e.l}`), r = t.join(" ");
24
38
  }
25
- return t;
26
- }, T = "icon", D = "button", G = "link", H = ({
39
+ return r;
40
+ }, S = "icon", W = "button", D = "link", H = ({
27
41
  type: e,
28
- size: t,
29
- labelRight: r,
42
+ size: r,
43
+ labelRight: t,
30
44
  labelLeft: a,
31
- align: n
45
+ align: d
32
46
  }) => {
33
- const d = "text-sm font-medium max-h-8 py-0", g = "text-base font-medium max-h-9 py-1", i = "text-lg font-medium max-h-12 py-2";
47
+ const l = "text-sm font-medium max-h-8 py-0", g = "text-base font-medium max-h-9 py-1", i = "text-lg font-medium max-h-12 py-2";
34
48
  switch (e) {
35
- case D:
49
+ case W:
36
50
  return o("px-4", {
37
- [d]: t === "small",
38
- [g]: t === "medium",
39
- [i]: t === "large"
51
+ [l]: r === "small",
52
+ [g]: r === "medium",
53
+ [i]: r === "large"
40
54
  });
41
- case G:
55
+ case D:
42
56
  return o("px-4 text-center", {
43
- [d]: t === "small",
44
- [g]: t === "medium",
45
- [i]: t === "large"
57
+ [l]: r === "small",
58
+ [g]: r === "medium",
59
+ [i]: r === "large"
46
60
  });
47
- case T:
61
+ case S:
48
62
  return o("inline-flex items-center", {
49
- "justify-center": n === "center",
50
- "justify-start": n === "left",
51
- "justify-end": n === "right",
52
- "h-6 w-6 p-0": t === "small" && !(r || a),
53
- "h-6 px-4 text-sm font-medium": t === "small" && (r || a),
54
- "h-8 w-8 p-1": t === "medium" && !(r || a),
55
- "h-8 px-4 text-base font-medium": t === "medium" && (r || a),
56
- "h-12 w-12 p-2": t === "large" && !(r || a),
57
- "h-12 px-4 text-lg font-medium": t === "large" && (r || a)
63
+ "justify-center": d === "center",
64
+ "justify-start": d === "left",
65
+ "justify-end": d === "right",
66
+ "h-6 w-6 p-0": r === "small" && !(t || a),
67
+ "h-6 px-4 text-sm font-medium": r === "small" && (t || a),
68
+ "h-8 w-8 p-1": r === "medium" && !(t || a),
69
+ "h-8 px-4 text-base font-medium": r === "medium" && (t || a),
70
+ "h-12 w-12 p-2": r === "large" && !(t || a),
71
+ "h-12 px-4 text-lg font-medium": r === "large" && (t || a)
58
72
  });
59
73
  }
60
74
  }, X = ({
61
75
  mode: e,
62
- noBackground: t,
63
- noTruncate: r,
76
+ noBackground: r,
77
+ noTruncate: t,
64
78
  variant: a
65
79
  }) => {
66
- if (t)
80
+ if (r)
67
81
  return "not-prose rounded-full";
68
82
  if (a === "primary")
69
83
  return o("not-prose rounded-full", {
70
- truncate: !r,
84
+ truncate: !t,
71
85
  "bg-action-dark text-copy-light": e === "dark",
72
86
  "bg-action-light text-copy-lighter": e === "light",
73
87
  "bg-action-dark text-copy-light dark:bg-action-light dark:text-copy-lighter": e === "system",
@@ -75,7 +89,7 @@ const S = "av-messagebox", R = "av-panel", C = "av-button", W = (e) => {
75
89
  });
76
90
  if (a === "secondary")
77
91
  return o("not-prose rounded-full", {
78
- truncate: !r,
92
+ truncate: !t,
79
93
  "bg-action-dark text-copy-light": e === "light",
80
94
  "bg-action-light text-copy-lighter": e === "dark",
81
95
  "bg-action-dark text-copy-light dark:bg-action-light dark:text-copy-lighter": e === "alt-system",
@@ -83,7 +97,7 @@ const S = "av-messagebox", R = "av-panel", C = "av-button", W = (e) => {
83
97
  });
84
98
  if (a === "danger")
85
99
  return o("not-prose rounded-full", {
86
- truncate: !r,
100
+ truncate: !t,
87
101
  "bg-action-danger-dark text-copy-light": e === "dark",
88
102
  "bg-action-danger-light text-copy-lighter": e === "light",
89
103
  "bg-action-danger-dark text-copy-light dark:bg-action-danger-light dark:text-copy-lighter": e === "system",
@@ -91,26 +105,26 @@ const S = "av-messagebox", R = "av-panel", C = "av-button", W = (e) => {
91
105
  });
92
106
  }, Y = ({
93
107
  mode: e,
94
- disabled: t,
95
- variant: r
108
+ disabled: r,
109
+ variant: t
96
110
  }) => {
97
- if (t)
111
+ if (r)
98
112
  return "";
99
- if (r === "primary")
113
+ if (t === "primary")
100
114
  return o("hover:text-copy-light-hover", {
101
115
  "hover:bg-action-dark-hover": e === "dark",
102
116
  "hover:bg-action-light-hover": e === "light",
103
117
  "hover:bg-action-dark-hover dark:hover:bg-action-light-hover": e === "system",
104
118
  "hover:bg-action-light-hover dark:hover:bg-action-dark-hover": e === "alt-system"
105
119
  });
106
- if (r === "secondary")
120
+ if (t === "secondary")
107
121
  return o("hover:text-copy-light-hover", {
108
122
  "hover:bg-action-dark-hover": e === "light",
109
123
  "hover:bg-action-light-hover": e === "dark",
110
124
  "hover:bg-action-dark-hover dark:hover:bg-action-light-hover": e === "alt-system",
111
125
  "hover:bg-action-light-hover dark:hover:bg-action-dark-hover": e === "system"
112
126
  });
113
- if (r === "danger")
127
+ if (t === "danger")
114
128
  return o("hover:text-copy-light-hover", {
115
129
  "hover:bg-action-danger-dark-hover": e === "dark",
116
130
  "hover:bg-action-danger-light-hover": e === "light",
@@ -119,26 +133,26 @@ const S = "av-messagebox", R = "av-panel", C = "av-button", W = (e) => {
119
133
  });
120
134
  }, F = ({
121
135
  mode: e,
122
- disabled: t,
123
- variant: r
136
+ disabled: r,
137
+ variant: t
124
138
  }) => {
125
- if (t)
139
+ if (r)
126
140
  return "";
127
- if (r === "primary")
141
+ if (t === "primary")
128
142
  return o("active:text-copy-light-active", {
129
143
  "active:bg-action-dark-active": e === "dark",
130
144
  "active:bg-action-light-active": e === "light",
131
145
  "active:bg-action-dark-active dark:active:bg-action-light-active": e === "system",
132
146
  "active:bg-action-light-active dark:active:bg-action-dark-active": e === "alt-system"
133
147
  });
134
- if (r === "secondary")
148
+ if (t === "secondary")
135
149
  return o("active:text-copy-light-active", {
136
150
  "active:bg-action-dark-active": e === "light",
137
151
  "active:bg-action-light-active": e === "dark",
138
152
  "active:bg-action-dark-active dark:active:bg-action-light-active": e === "alt-system",
139
153
  "active:bg-action-light-active dark:active:bg-action-dark-active": e === "system"
140
154
  });
141
- if (r === "danger")
155
+ if (t === "danger")
142
156
  return o("active:text-copy-lighter-active", {
143
157
  "active:bg-action-danger-dark-active": e === "dark",
144
158
  "active:bg-action-danger-light-active": e === "light",
@@ -147,26 +161,26 @@ const S = "av-messagebox", R = "av-panel", C = "av-button", W = (e) => {
147
161
  });
148
162
  }, q = ({
149
163
  mode: e,
150
- noBorder: t,
151
- variant: r
164
+ noBorder: r,
165
+ variant: t
152
166
  }) => {
153
- if (t)
167
+ if (r)
154
168
  return "border border-transparent";
155
- if (r === "primary")
169
+ if (t === "primary")
156
170
  return o("border", {
157
171
  "border-border-dark": e === "dark",
158
172
  "border-border-accent": e === "light",
159
173
  "border-border-dark dark:border-border-accent": e === "system",
160
174
  "border-border-accent dark:border-border-dark": e === "alt-system"
161
175
  });
162
- if (r === "secondary")
176
+ if (t === "secondary")
163
177
  return o("border", {
164
178
  "border-border-dark": e === "light",
165
179
  "border-border-accent": e === "dark",
166
180
  "border-border-dark dark:border-border-accent": e === "alt-system",
167
181
  "border-border-accent dark:border-border-dark": e === "system"
168
182
  });
169
- if (r === "danger")
183
+ if (t === "danger")
170
184
  return o("border", {
171
185
  "border-border-danger-dark": e === "dark",
172
186
  "border-border-danger-medium": e === "light",
@@ -178,13 +192,13 @@ const S = "av-messagebox", R = "av-panel", C = "av-button", W = (e) => {
178
192
  "focus:outline-focus-light": e === "light",
179
193
  "focus:outline-focus-light dark:focus:outline-focus-dark": e === "alt-system",
180
194
  "focus:outline-focus-dark dark:focus:outline-focus-light": e === "system"
181
- }), L = ({
195
+ }), P = ({
182
196
  type: e,
183
- className: t,
184
- raw: r,
197
+ className: r,
198
+ raw: t,
185
199
  mode: a,
186
- focusMode: n,
187
- disabled: d,
200
+ focusMode: d,
201
+ disabled: l,
188
202
  fullWidth: g,
189
203
  size: i,
190
204
  noBorder: h,
@@ -195,45 +209,45 @@ const S = "av-messagebox", R = "av-panel", C = "av-button", W = (e) => {
195
209
  variant: c,
196
210
  noTruncate: f,
197
211
  align: v
198
- }) => (c || (c = "primary"), r ? o(C, t) : o(
212
+ }) => (c || (c = "primary"), t ? o(C, r) : o(
199
213
  C,
200
- t,
201
- W(b),
214
+ r,
215
+ G(b),
202
216
  X({ mode: a, variant: c, noBackground: m, noTruncate: f }),
203
217
  H({ type: e, size: i, labelRight: s, labelLeft: u, align: v }),
204
218
  q({ mode: a, variant: c, noBorder: h }),
205
- J({ focusMode: n }),
206
- Y({ mode: a, variant: c, disabled: d }),
207
- F({ mode: a, variant: c, disabled: d }),
219
+ J({ focusMode: d }),
220
+ Y({ mode: a, variant: c, disabled: l }),
221
+ F({ mode: a, variant: c, disabled: l }),
208
222
  {
209
223
  "w-full": g,
210
- "disabled:cursor-not-allowed disabled:opacity-50": d
224
+ "disabled:cursor-not-allowed disabled:opacity-50": l
211
225
  }
212
- )), K = (e, t, r) => {
226
+ )), K = (e, r, t) => {
213
227
  var a;
214
- !t && (!document.activeElement || document.activeElement !== e.currentTarget) && typeof ((a = e == null ? void 0 : e.currentTarget) == null ? void 0 : a.focus) == "function" && e.currentTarget.focus(), typeof r == "function" && r(e);
215
- }, M = E.forwardRef((e, t) => {
216
- const { onClick: r, noInternalClick: a = !1, ...n } = e;
217
- return /* @__PURE__ */ l(
228
+ !r && (!document.activeElement || document.activeElement !== e.currentTarget) && typeof ((a = e == null ? void 0 : e.currentTarget) == null ? void 0 : a.focus) == "function" && e.currentTarget.focus(), typeof t == "function" && t(e);
229
+ }, B = T.forwardRef((e, r) => {
230
+ const { onClick: t, noInternalClick: a = !1, ...d } = e;
231
+ return /* @__PURE__ */ n(
218
232
  "button",
219
233
  {
220
- ref: t,
221
- onClick: (d) => {
222
- K(d, a, r);
234
+ ref: r,
235
+ onClick: (l) => {
236
+ K(l, a, t);
223
237
  },
224
- ...n
238
+ ...d
225
239
  }
226
240
  );
227
241
  });
228
- M.displayName = "BaseButton";
229
- const $ = E.forwardRef(
242
+ B.displayName = "BaseButton";
243
+ const $ = T.forwardRef(
230
244
  ({
231
245
  children: e,
232
- disabled: t = !1,
233
- mode: r = "system",
246
+ disabled: r = !1,
247
+ mode: t = "system",
234
248
  focusMode: a = "system",
235
- fullWidth: n = !1,
236
- className: d,
249
+ fullWidth: d = !1,
250
+ className: l,
237
251
  type: g = "button",
238
252
  raw: i = !1,
239
253
  noBorder: h = !1,
@@ -247,14 +261,14 @@ const $ = E.forwardRef(
247
261
  align: _ = "center",
248
262
  ...w
249
263
  }, N) => {
250
- const I = L({
251
- type: T,
252
- mode: r,
264
+ const I = P({
265
+ type: S,
266
+ mode: t,
253
267
  focusMode: a,
254
- fullWidth: n,
255
- disabled: t,
268
+ fullWidth: d,
269
+ disabled: r,
256
270
  raw: i,
257
- className: d,
271
+ className: l,
258
272
  noBorder: h,
259
273
  size: b,
260
274
  labelRight: m,
@@ -262,25 +276,25 @@ const $ = E.forwardRef(
262
276
  spacing: f,
263
277
  noBackground: v,
264
278
  align: _
265
- }), B = o({
266
- "text-copy-accent-dark": r === "light" && !i,
267
- "text-copy-light": r === "dark" && !i,
268
- "text-copy-accent-dark dark:text-copy-light": r === "alt-system" && !i,
269
- "text-copy-light dark:text-copy-accent-dark": r === "system" && !i
279
+ }), E = o({
280
+ "text-copy-accent-dark": t === "light" && !i,
281
+ "text-copy-light": t === "dark" && !i,
282
+ "text-copy-accent-dark dark:text-copy-light": t === "alt-system" && !i,
283
+ "text-copy-light dark:text-copy-accent-dark": t === "system" && !i
270
284
  });
271
285
  return /* @__PURE__ */ y(
272
- M,
286
+ B,
273
287
  {
274
288
  ref: N,
275
289
  className: I,
276
- disabled: t,
290
+ disabled: r,
277
291
  type: g,
278
292
  "aria-label": s || u,
279
293
  ...w,
280
294
  children: [
281
- c && /* @__PURE__ */ l("span", { className: "pr-2", children: c }),
282
- /* @__PURE__ */ l("div", { className: B, children: e }),
283
- m && /* @__PURE__ */ l("span", { className: "pl-2", children: m })
295
+ c && /* @__PURE__ */ n("span", { className: "pr-2", children: c }),
296
+ /* @__PURE__ */ n("div", { className: E, children: e }),
297
+ m && /* @__PURE__ */ n("span", { className: "pl-2", children: m })
284
298
  ]
285
299
  }
286
300
  );
@@ -288,26 +302,26 @@ const $ = E.forwardRef(
288
302
  );
289
303
  $.displayName = "ButtonIcon";
290
304
  /*!
291
- @versini/ui-button v1.2.1
305
+ @versini/ui-button v1.3.0
292
306
  © 2024 gizmette.com
293
307
  */
294
308
  try {
295
309
  window.__VERSINI_UI_BUTTON__ || (window.__VERSINI_UI_BUTTON__ = {
296
- version: "1.2.1",
297
- buildTime: "12/18/2024 01:22 PM EST",
310
+ version: "1.3.0",
311
+ buildTime: "12/24/2024 06:47 PM EST",
298
312
  homepage: "https://github.com/aversini/ui-components",
299
313
  license: "MIT"
300
314
  });
301
315
  } catch {
302
316
  }
303
- const Q = E.forwardRef(
317
+ const Q = T.forwardRef(
304
318
  ({
305
319
  children: e,
306
- disabled: t = !1,
307
- mode: r = "system",
320
+ disabled: r = !1,
321
+ mode: t = "system",
308
322
  focusMode: a = "system",
309
- fullWidth: n = !1,
310
- className: d,
323
+ fullWidth: d = !1,
324
+ className: l,
311
325
  type: g = "button",
312
326
  raw: i = !1,
313
327
  noBorder: h = !1,
@@ -322,14 +336,14 @@ const Q = E.forwardRef(
322
336
  active: w = !1,
323
337
  ...N
324
338
  }, I) => {
325
- const B = L({
326
- type: T,
327
- mode: r,
339
+ const E = P({
340
+ type: S,
341
+ mode: t,
328
342
  focusMode: a,
329
- fullWidth: n,
330
- disabled: t,
343
+ fullWidth: d,
344
+ disabled: r,
331
345
  raw: i,
332
- className: d,
346
+ className: l,
333
347
  noBorder: h,
334
348
  size: b,
335
349
  labelRight: m,
@@ -337,11 +351,11 @@ const Q = E.forwardRef(
337
351
  spacing: f,
338
352
  noBackground: v,
339
353
  align: _
340
- }), P = o({
341
- "text-copy-accent-dark": r === "light" && !i,
342
- "text-copy-light": r === "dark" && !i,
343
- "text-copy-accent-dark dark:text-copy-light": r === "alt-system" && !i,
344
- "text-copy-light dark:text-copy-accent-dark": r === "system" && !i
354
+ }), L = o({
355
+ "text-copy-accent-dark": t === "light" && !i,
356
+ "text-copy-light": t === "dark" && !i,
357
+ "text-copy-accent-dark dark:text-copy-light": t === "alt-system" && !i,
358
+ "text-copy-light dark:text-copy-accent-dark": t === "system" && !i
345
359
  }), A = w ? o(
346
360
  "relative",
347
361
  "focus-within:static",
@@ -353,47 +367,60 @@ const Q = E.forwardRef(
353
367
  "after:left-0",
354
368
  "after:right-0",
355
369
  {
356
- "after:border-table-dark": r === "dark",
357
- "after:border-table-light": r === "light",
358
- "after:border-table-dark dark:after:border-table-light": r === "system",
359
- "after:border-table-light dark:after:border-table-dark": r === "alt-system"
370
+ "after:border-table-dark": t === "dark",
371
+ "after:border-table-light": t === "light",
372
+ "after:border-table-dark dark:after:border-table-light": t === "system",
373
+ "after:border-table-light dark:after:border-table-dark": t === "alt-system"
360
374
  }
361
375
  ) : "";
362
- return /* @__PURE__ */ l("div", { className: A, children: /* @__PURE__ */ y(
363
- M,
376
+ return /* @__PURE__ */ n("div", { className: A, children: /* @__PURE__ */ y(
377
+ B,
364
378
  {
365
379
  ref: I,
366
- className: B,
367
- disabled: t,
380
+ className: E,
381
+ disabled: r,
368
382
  type: g,
369
383
  "aria-label": s || u,
370
384
  ...N,
371
385
  children: [
372
- c && /* @__PURE__ */ l("span", { className: "pr-2", children: c }),
373
- /* @__PURE__ */ l("div", { className: P, children: e }),
374
- m && /* @__PURE__ */ l("span", { className: "pl-2", children: m })
386
+ c && /* @__PURE__ */ n("span", { className: "pr-2", children: c }),
387
+ /* @__PURE__ */ n("div", { className: L, children: e }),
388
+ m && /* @__PURE__ */ n("span", { className: "pl-2", children: m })
375
389
  ]
376
390
  }
377
391
  ) });
378
392
  }
379
393
  );
380
394
  Q.displayName = "ButtonSort";
395
+ /*!
396
+ @versini/ui-spacing v1.0.0
397
+ © 2024 gizmette.com
398
+ */
399
+ try {
400
+ window.__VERSINI_UI_SPACING__ || (window.__VERSINI_UI_SPACING__ = {
401
+ version: "1.0.0",
402
+ buildTime: "12/24/2024 06:47 PM EST",
403
+ homepage: "https://github.com/aversini/ui-components",
404
+ license: "MIT"
405
+ });
406
+ } catch {
407
+ }
381
408
  const Z = (e) => {
382
- let t = "";
409
+ let r = "";
383
410
  if (typeof e == "number" || typeof e == "string")
384
- t = "m-" + e;
411
+ r = "m-" + e;
385
412
  else {
386
- const r = [];
387
- (e == null ? void 0 : e.t) !== void 0 && r.push(`mt-${e.t}`), (e == null ? void 0 : e.r) !== void 0 && r.push(`mr-${e.r}`), (e == null ? void 0 : e.b) !== void 0 && r.push(`mb-${e.b}`), (e == null ? void 0 : e.l) !== void 0 && r.push(`ml-${e.l}`), t = r.join(" ");
413
+ const t = [];
414
+ (e == null ? void 0 : e.t) !== void 0 && t.push(`mt-${e.t}`), (e == null ? void 0 : e.r) !== void 0 && t.push(`mr-${e.r}`), (e == null ? void 0 : e.b) !== void 0 && t.push(`mb-${e.b}`), (e == null ? void 0 : e.l) !== void 0 && t.push(`ml-${e.l}`), r = t.join(" ");
388
415
  }
389
- return t;
416
+ return r;
390
417
  }, ee = ({
391
418
  children: e,
392
- fill: t,
393
- viewBox: r,
419
+ fill: r,
420
+ viewBox: t,
394
421
  className: a,
395
- defaultViewBox: n,
396
- defaultClassName: d,
422
+ defaultViewBox: d,
423
+ defaultClassName: l,
397
424
  spacing: g,
398
425
  title: i,
399
426
  semantic: h = !1,
@@ -401,16 +428,16 @@ const Z = (e) => {
401
428
  }) => {
402
429
  const u = Z(g), b = o(
403
430
  u,
404
- a || d
431
+ a || l
405
432
  );
406
433
  return /* @__PURE__ */ y(V, { children: [
407
- /* @__PURE__ */ l(
434
+ /* @__PURE__ */ n(
408
435
  "svg",
409
436
  {
410
437
  xmlns: "http://www.w3.org/2000/svg",
411
438
  className: b,
412
- viewBox: r || n,
413
- fill: t || "currentColor",
439
+ viewBox: t || d,
440
+ fill: r || "currentColor",
414
441
  role: "img",
415
442
  "aria-hidden": !h,
416
443
  focusable: !1,
@@ -418,118 +445,118 @@ const Z = (e) => {
418
445
  children: e
419
446
  }
420
447
  ),
421
- i && h && /* @__PURE__ */ l("span", { className: "sr-only", children: i })
448
+ i && h && /* @__PURE__ */ n("span", { className: "sr-only", children: i })
422
449
  ] });
423
450
  };
424
451
  /*!
425
- @versini/ui-private v1.5.1
452
+ @versini/ui-private v1.6.0
426
453
  © 2024 gizmette.com
427
454
  */
428
455
  try {
429
456
  window.__VERSINI_UI_PRIVATE__ || (window.__VERSINI_UI_PRIVATE__ = {
430
- version: "1.5.1",
431
- buildTime: "12/18/2024 01:22 PM EST",
457
+ version: "1.6.0",
458
+ buildTime: "12/24/2024 06:47 PM EST",
432
459
  homepage: "https://github.com/aversini/ui-components",
433
460
  license: "MIT"
434
461
  });
435
462
  } catch {
436
463
  }
437
- const re = ({
464
+ const te = ({
438
465
  className: e,
439
- viewBox: t,
440
- spacing: r,
466
+ viewBox: r,
467
+ spacing: t,
441
468
  title: a,
442
- monotone: n,
443
- ...d
444
- }) => /* @__PURE__ */ l(
469
+ monotone: d,
470
+ ...l
471
+ }) => /* @__PURE__ */ n(
445
472
  ee,
446
473
  {
447
474
  defaultViewBox: "0 0 384 512",
448
475
  defaultClassName: "size-5",
449
- viewBox: t,
476
+ viewBox: r,
450
477
  className: e,
451
- spacing: r,
478
+ spacing: t,
452
479
  title: a || "Close",
453
- ...d,
454
- children: /* @__PURE__ */ l("path", { d: "M342.6 150.6c12.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.3l105.4 105.3c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256l105.3-105.4z" })
480
+ ...l,
481
+ children: /* @__PURE__ */ n("path", { d: "M342.6 150.6c12.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.3l105.4 105.3c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256l105.3-105.4z" })
455
482
  }
456
483
  );
457
484
  /*!
458
- @versini/ui-icons v1.16.1
485
+ @versini/ui-icons v1.17.0
459
486
  © 2024 gizmette.com
460
487
  */
461
488
  try {
462
489
  window.__VERSINI_UI_ICONS__ || (window.__VERSINI_UI_ICONS__ = {
463
- version: "1.16.1",
464
- buildTime: "12/18/2024 01:22 PM EST",
490
+ version: "1.17.0",
491
+ buildTime: "12/24/2024 06:47 PM EST",
465
492
  homepage: "https://github.com/aversini/ui-components",
466
493
  license: "MIT"
467
494
  });
468
495
  } catch {
469
496
  }
470
- const p = "panel", x = "messagebox", te = ({
497
+ const p = "panel", x = "messagebox", re = ({
471
498
  className: e,
472
- kind: t,
473
- borderMode: r
499
+ kind: r,
500
+ borderMode: t
474
501
  }) => ({
475
502
  main: o("prose prose-lighter flex flex-col bg-surface-medium", {
476
- [`${R} max-h-full sm:max-h-[95%] min-h-full sm:min-h-[10rem] sm:rounded-lg sm:border-2`]: t === p,
477
- [`${R} w-full sm:w-[95%] md:max-w-2xl`]: t === p && !e,
478
- [`${S} rounded-lg border-2`]: t === x,
479
- [`${S} w-[95%] sm:w-[50%] md:max-w-2xl`]: t === x && !e,
503
+ [`${R} max-h-full sm:max-h-[95%] min-h-full sm:min-h-[10rem] sm:rounded-lg sm:border-2`]: r === p,
504
+ [`${R} w-full sm:w-[95%] md:max-w-2xl`]: r === p && !e,
505
+ [`${M} rounded-lg border-2`]: r === x,
506
+ [`${M} w-[95%] sm:w-[50%] md:max-w-2xl`]: r === x && !e,
480
507
  [`${e}`]: !!e,
481
- "sm:border-border-dark": r === "dark" && t === p,
482
- "sm:border-border-accent": r === "light" && t === p,
483
- "border-border-dark": r === "dark" && t === x,
484
- "border-border-accent": r === "light" && t === x
508
+ "sm:border-border-dark": t === "dark" && r === p,
509
+ "sm:border-border-accent": t === "light" && r === p,
510
+ "border-border-dark": t === "dark" && r === x,
511
+ "border-border-accent": t === "light" && r === x
485
512
  }),
486
513
  content: "flex flex-col py-2 sm:py-4 sm:px-4 px-2 overflow-y-auto",
487
514
  footer: "flex flex-grow flex-col sm:p-4 p-2",
488
515
  header: "sm:p-4 mb-0 p-2",
489
516
  close: "sm:p-4 p-2"
490
- }), k = (e) => z(
491
- () => import("./chunks/index.MEUopFRx.js").then((t) => ({
492
- default: t[e]
517
+ }), k = (e) => U(
518
+ () => import("./chunks/index.CYbntI7I.js").then((r) => ({
519
+ default: r[e]
493
520
  }))
494
- ), ae = k("Modal"), oe = k("ModalClose"), ie = k("ModalContent"), le = k("ModalDescription"), de = k("ModalHeading"), ge = ({
521
+ ), ae = k("Modal"), oe = k("ModalClose"), ie = k("ModalContent"), ne = k("ModalDescription"), le = k("ModalHeading"), ge = ({
495
522
  open: e,
496
- onOpenChange: t,
497
- title: r,
523
+ onOpenChange: r,
524
+ title: t,
498
525
  children: a,
499
- footer: n,
500
- borderMode: d = "light",
526
+ footer: d,
527
+ borderMode: l = "light",
501
528
  kind: g = p,
502
529
  className: i
503
530
  }) => {
504
- const h = U(""), s = te({ className: i, kind: g, borderMode: d });
505
- return j(() => (e && (h.current = document.title, document.title = `${r} | ${h.current}`), () => {
531
+ const h = z(""), s = re({ className: i, kind: g, borderMode: l });
532
+ return j(() => (e && (h.current = document.title, document.title = `${t} | ${h.current}`), () => {
506
533
  e && (document.title = h.current);
507
- }), [r, e]), /* @__PURE__ */ l(O, { fallback: /* @__PURE__ */ l("div", {}), children: e && /* @__PURE__ */ l(ae, { open: e, onOpenChange: t, children: /* @__PURE__ */ y(ie, { className: s.main, children: [
534
+ }), [t, e]), /* @__PURE__ */ n(O, { fallback: /* @__PURE__ */ n("div", {}), children: e && /* @__PURE__ */ n(ae, { open: e, onOpenChange: r, children: /* @__PURE__ */ y(ie, { className: s.main, children: [
508
535
  /* @__PURE__ */ y("div", { className: "flex flex-row-reverse items-center justify-between", children: [
509
- /* @__PURE__ */ l(
536
+ /* @__PURE__ */ n(
510
537
  oe,
511
538
  {
512
539
  className: s.close,
513
- trigger: /* @__PURE__ */ l(
540
+ trigger: /* @__PURE__ */ n(
514
541
  $,
515
542
  {
516
543
  mode: "dark",
517
544
  focusMode: "light",
518
545
  noBorder: !0,
519
546
  label: "Close",
520
- children: /* @__PURE__ */ l(re, {})
547
+ children: /* @__PURE__ */ n(te, {})
521
548
  }
522
549
  )
523
550
  }
524
551
  ),
525
- /* @__PURE__ */ l(de, { className: s.header, children: r })
552
+ /* @__PURE__ */ n(le, { className: s.header, children: t })
526
553
  ] }),
527
- /* @__PURE__ */ l(le, { className: s.content, children: a }),
528
- n && /* @__PURE__ */ l("div", { className: s.footer, children: n })
554
+ /* @__PURE__ */ n(ne, { className: s.content, children: a }),
555
+ d && /* @__PURE__ */ n("div", { className: s.footer, children: d })
529
556
  ] }) }) });
530
557
  };
531
558
  export {
532
- S as MESSAGEBOX_CLASSNAME,
559
+ M as MESSAGEBOX_CLASSNAME,
533
560
  R as PANEL_CLASSNAME,
534
561
  ge as Panel
535
562
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@versini/ui-panel",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "license": "MIT",
5
5
  "author": "Arno Versini",
6
6
  "publishConfig": {
@@ -39,14 +39,14 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@tailwindcss/typography": "0.5.15",
42
- "@versini/ui-button": "1.2.1",
43
- "@versini/ui-icons": "1.16.1",
44
- "@versini/ui-private": "1.5.1",
42
+ "@versini/ui-button": "1.3.0",
43
+ "@versini/ui-icons": "1.17.0",
44
+ "@versini/ui-private": "1.6.0",
45
45
  "clsx": "2.1.1",
46
46
  "tailwindcss": "3.4.17"
47
47
  },
48
48
  "sideEffects": [
49
49
  "**/*.css"
50
50
  ],
51
- "gitHead": "123c2555b25210da73697c4fdd3b6a5f67a3b993"
51
+ "gitHead": "cb948414a675c01f3328ed6470ccf4b58f73534f"
52
52
  }
@@ -1,258 +0,0 @@
1
- import { jsx as i, jsxs as T, Fragment as D } from "react/jsx-runtime";
2
- import y from "clsx";
3
- import * as c from "react";
4
- import { useRef as A, useReducer as M, useEffect as _, useId as R } from "react";
5
- import { useFloating as x, useClick as S, useDismiss as $, useRole as F, useInteractions as O, useMergeRefs as P, FloatingPortal as k, FloatingOverlay as L, FloatingFocusManager as U } from "@floating-ui/react";
6
- const w = "SET_ANNOUNCEMENT", I = "CLEAR_ANNOUNCEMENT", V = {
7
- alert: null,
8
- alertdialog: null,
9
- log: "polite",
10
- marquee: null,
11
- progressbar: null,
12
- status: "polite",
13
- timer: "assertive"
14
- }, B = (e, n) => {
15
- switch (n == null ? void 0 : n.type) {
16
- case w:
17
- return {
18
- ...e,
19
- announcement: n.payload
20
- };
21
- case I:
22
- return {
23
- ...e,
24
- announcement: null
25
- };
26
- default:
27
- return e;
28
- }
29
- }, j = ({
30
- onAnnouncementClear: e,
31
- dispatch: n
32
- }) => {
33
- n({
34
- type: I
35
- }), typeof e == "function" && e();
36
- }, C = ({
37
- children: e,
38
- clearAnnouncementDelay: n,
39
- clearAnnouncementTimeoutRef: o,
40
- onAnnouncementClear: l,
41
- dispatch: t
42
- }) => {
43
- clearTimeout(o.current), e !== null && t({
44
- type: w,
45
- payload: e
46
- }), n && (o.current = setTimeout(
47
- () => j({
48
- onAnnouncementClear: l,
49
- dispatch: t
50
- }),
51
- n
52
- ));
53
- }, q = ({
54
- children: e,
55
- announcementTimeoutRef: n,
56
- announcementDelay: o,
57
- clearAnnouncementDelay: l,
58
- clearAnnouncementTimeoutRef: t,
59
- onAnnouncementClear: r,
60
- dispatch: a
61
- }) => {
62
- clearTimeout(n.current), o ? n.current = setTimeout(C, o, {
63
- children: e,
64
- clearAnnouncementDelay: l,
65
- clearAnnouncementTimeoutRef: t,
66
- onAnnouncementClear: r,
67
- dispatch: a
68
- }) : C({
69
- children: e,
70
- clearAnnouncementDelay: l,
71
- clearAnnouncementTimeoutRef: t,
72
- onAnnouncementClear: r,
73
- dispatch: a
74
- });
75
- };
76
- function W({
77
- children: e,
78
- className: n,
79
- politeness: o,
80
- role: l = null,
81
- announcementDelay: t,
82
- clearAnnouncementDelay: r,
83
- onAnnouncementClear: a,
84
- visible: s,
85
- ...p
86
- }) {
87
- const u = A(null), d = A(null), [m, f] = M(B, {
88
- announcement: null
89
- });
90
- let h = o;
91
- typeof h > "u" && (h = l ? V[l] : "assertive"), _(() => {
92
- q({
93
- announcementTimeoutRef: u,
94
- announcementDelay: t,
95
- children: e,
96
- clearAnnouncementDelay: r,
97
- clearAnnouncementTimeoutRef: d,
98
- onAnnouncementClear: a,
99
- dispatch: f
100
- });
101
- }, [
102
- e,
103
- t,
104
- r,
105
- a
106
- ]);
107
- const g = y(n, {
108
- "sr-only": !s
109
- });
110
- return /* @__PURE__ */ i(
111
- "div",
112
- {
113
- "aria-live": h,
114
- ...l && { role: l },
115
- className: g,
116
- ...p,
117
- children: m.announcement
118
- }
119
- );
120
- }
121
- const E = c.createContext(null);
122
- function H({
123
- initialOpen: e = !1,
124
- open: n,
125
- onOpenChange: o
126
- } = {}) {
127
- const [l, t] = c.useState(e), [r, a] = c.useState(), [s, p] = c.useState(), u = n ?? l, d = o ?? t, m = x({
128
- open: u,
129
- onOpenChange: d
130
- }), f = m.context, h = S(f, {
131
- enabled: n == null
132
- }), g = $(f, {
133
- outsidePress: !1,
134
- outsidePressEvent: "mousedown"
135
- }), N = F(f), b = O([h, g, N]);
136
- return c.useMemo(
137
- () => ({
138
- open: u,
139
- setOpen: d,
140
- ...b,
141
- ...m,
142
- labelId: r,
143
- descriptionId: s,
144
- setLabelId: a,
145
- setDescriptionId: p
146
- }),
147
- [u, d, b, m, r, s]
148
- );
149
- }
150
- const v = () => {
151
- const e = c.useContext(E);
152
- if (e == null)
153
- throw new Error("Modal components must be wrapped in <Modal />");
154
- return e;
155
- };
156
- function X({
157
- children: e,
158
- ...n
159
- }) {
160
- const o = H(n);
161
- return /* @__PURE__ */ i(E.Provider, { value: o, children: e });
162
- }
163
- const Y = c.forwardRef(function(e, n) {
164
- const { context: o, ...l } = v(), t = P([l.refs.setFloating, n]);
165
- if (!o.open)
166
- return null;
167
- const { overlayBackground: r, ...a } = e, s = y("grid place-items-center", {
168
- [`${r}`]: r,
169
- "bg-black sm:bg-black/[.8]": !r
170
- });
171
- return /* @__PURE__ */ i(k, { children: /* @__PURE__ */ i(L, { className: s, lockScroll: !0, children: /* @__PURE__ */ i(U, { context: o, children: /* @__PURE__ */ i(
172
- "div",
173
- {
174
- ref: t,
175
- "aria-labelledby": l.labelId,
176
- "aria-describedby": l.descriptionId,
177
- ...l.getFloatingProps(a),
178
- children: a.children
179
- }
180
- ) }) }) });
181
- }), Z = c.forwardRef(function({ children: e, ...n }, o) {
182
- const { setLabelId: l } = v(), t = R();
183
- return c.useLayoutEffect(() => (l(t), () => l(void 0)), [t, l]), /* @__PURE__ */ i("h1", { ...n, ref: o, id: t, children: e });
184
- }), ee = c.forwardRef(function({ children: e, ...n }, o) {
185
- const { setDescriptionId: l } = v(), t = R();
186
- return c.useLayoutEffect(() => (l(t), () => l(void 0)), [t, l]), /* @__PURE__ */ i("div", { ...n, ref: o, id: t, children: e });
187
- }), ne = c.forwardRef(function(e, n) {
188
- const { setOpen: o } = v(), { trigger: l, className: t, ...r } = e, a = c.useCallback(() => o(!1), [o]);
189
- return /* @__PURE__ */ i("div", { className: t, children: c.cloneElement(l, {
190
- ref: n,
191
- onClick: a,
192
- ...r
193
- }) });
194
- }), z = (e) => {
195
- let n = "";
196
- if (typeof e == "number" || typeof e == "string")
197
- n = "m-" + e;
198
- else {
199
- const o = [];
200
- (e == null ? void 0 : e.t) !== void 0 && o.push(`mt-${e.t}`), (e == null ? void 0 : e.r) !== void 0 && o.push(`mr-${e.r}`), (e == null ? void 0 : e.b) !== void 0 && o.push(`mb-${e.b}`), (e == null ? void 0 : e.l) !== void 0 && o.push(`ml-${e.l}`), n = o.join(" ");
201
- }
202
- return n;
203
- }, oe = ({
204
- children: e,
205
- fill: n,
206
- viewBox: o,
207
- className: l,
208
- defaultViewBox: t,
209
- defaultClassName: r,
210
- spacing: a,
211
- title: s,
212
- semantic: p = !1,
213
- ...u
214
- }) => {
215
- const d = z(a), m = y(
216
- d,
217
- l || r
218
- );
219
- return /* @__PURE__ */ T(D, { children: [
220
- /* @__PURE__ */ i(
221
- "svg",
222
- {
223
- xmlns: "http://www.w3.org/2000/svg",
224
- className: m,
225
- viewBox: o || t,
226
- fill: n || "currentColor",
227
- role: "img",
228
- "aria-hidden": !p,
229
- focusable: !1,
230
- ...u,
231
- children: e
232
- }
233
- ),
234
- s && p && /* @__PURE__ */ i("span", { className: "sr-only", children: s })
235
- ] });
236
- };
237
- /*!
238
- @versini/ui-private v1.5.1
239
- © 2024 gizmette.com
240
- */
241
- try {
242
- window.__VERSINI_UI_PRIVATE__ || (window.__VERSINI_UI_PRIVATE__ = {
243
- version: "1.5.1",
244
- buildTime: "12/18/2024 01:22 PM EST",
245
- homepage: "https://github.com/aversini/ui-components",
246
- license: "MIT"
247
- });
248
- } catch {
249
- }
250
- export {
251
- W as LiveRegion,
252
- X as Modal,
253
- ne as ModalClose,
254
- Y as ModalContent,
255
- ee as ModalDescription,
256
- Z as ModalHeading,
257
- oe as SvgIcon
258
- };