@versini/sassysaint 0.0.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.
@@ -0,0 +1,253 @@
1
+ import { jsx as i, jsxs as E, Fragment as D } from "react/jsx-runtime";
2
+ import A from "clsx";
3
+ import * as c from "react";
4
+ import { useRef as C, useReducer as M, useEffect as _, useId as x } from "react";
5
+ import { useMergeRefs as S, FloatingPortal as F, FloatingOverlay as O, FloatingFocusManager as k, useFloating as P, useClick as L, useDismiss as V, useRole as B, useInteractions as U } from "@floating-ui/react";
6
+ import { S as j } from "./index.C5AWMLF4.js";
7
+ const b = "SET_ANNOUNCEMENT", w = "CLEAR_ANNOUNCEMENT", q = {
8
+ alert: null,
9
+ alertdialog: null,
10
+ log: "polite",
11
+ marquee: null,
12
+ progressbar: null,
13
+ status: "polite",
14
+ timer: "assertive"
15
+ }, H = (e, n) => {
16
+ switch (n == null ? void 0 : n.type) {
17
+ case b:
18
+ return {
19
+ ...e,
20
+ announcement: n.payload
21
+ };
22
+ case w:
23
+ return {
24
+ ...e,
25
+ announcement: null
26
+ };
27
+ default:
28
+ return e;
29
+ }
30
+ }, z = ({
31
+ onAnnouncementClear: e,
32
+ dispatch: n
33
+ }) => {
34
+ n({
35
+ type: w
36
+ }), typeof e == "function" && e();
37
+ }, R = ({
38
+ children: e,
39
+ clearAnnouncementDelay: n,
40
+ clearAnnouncementTimeoutRef: o,
41
+ onAnnouncementClear: t,
42
+ dispatch: l
43
+ }) => {
44
+ (o == null ? void 0 : o.current) !== null && clearTimeout(o.current), e !== null && l({
45
+ type: b,
46
+ payload: e
47
+ }), n && (o.current = setTimeout(
48
+ () => z({
49
+ onAnnouncementClear: t,
50
+ dispatch: l
51
+ }),
52
+ n
53
+ ));
54
+ }, G = ({
55
+ children: e,
56
+ announcementTimeoutRef: n,
57
+ announcementDelay: o,
58
+ clearAnnouncementDelay: t,
59
+ clearAnnouncementTimeoutRef: l,
60
+ onAnnouncementClear: r,
61
+ dispatch: a
62
+ }) => {
63
+ clearTimeout(n.current), o ? n.current = setTimeout(R, o, {
64
+ children: e,
65
+ clearAnnouncementDelay: t,
66
+ clearAnnouncementTimeoutRef: l,
67
+ onAnnouncementClear: r,
68
+ dispatch: a
69
+ }) : R({
70
+ children: e,
71
+ clearAnnouncementDelay: t,
72
+ clearAnnouncementTimeoutRef: l,
73
+ onAnnouncementClear: r,
74
+ dispatch: a
75
+ });
76
+ };
77
+ function W({
78
+ children: e,
79
+ className: n,
80
+ politeness: o,
81
+ role: t = null,
82
+ announcementDelay: l,
83
+ clearAnnouncementDelay: r,
84
+ onAnnouncementClear: a,
85
+ visible: s,
86
+ ...f
87
+ }) {
88
+ const u = C(), d = C(), [m, p] = M(H, {
89
+ announcement: null
90
+ });
91
+ let h = o;
92
+ typeof h > "u" && (h = t ? q[t] : "assertive"), _(() => {
93
+ G({
94
+ announcementTimeoutRef: u,
95
+ announcementDelay: l,
96
+ children: e,
97
+ clearAnnouncementDelay: r,
98
+ clearAnnouncementTimeoutRef: d,
99
+ onAnnouncementClear: a,
100
+ dispatch: p
101
+ });
102
+ }, [
103
+ e,
104
+ l,
105
+ r,
106
+ a
107
+ ]);
108
+ const v = A(n, {
109
+ "sr-only": !s
110
+ });
111
+ return /* @__PURE__ */ i(
112
+ "div",
113
+ {
114
+ "aria-live": h,
115
+ ...t && { role: t },
116
+ className: v,
117
+ ...f,
118
+ children: m.announcement
119
+ }
120
+ );
121
+ }
122
+ const I = c.createContext(null);
123
+ function Y({
124
+ initialOpen: e = !1,
125
+ open: n,
126
+ onOpenChange: o
127
+ } = {}) {
128
+ const [t, l] = c.useState(e), [r, a] = c.useState(), [s, f] = c.useState(), u = n ?? t, d = o ?? l, m = P({
129
+ open: u,
130
+ onOpenChange: d
131
+ }), p = m.context, h = L(p, {
132
+ enabled: n == null
133
+ }), v = V(p, {
134
+ outsidePress: !1,
135
+ outsidePressEvent: "mousedown"
136
+ }), N = B(p), y = U([h, v, N]);
137
+ return c.useMemo(
138
+ () => ({
139
+ open: u,
140
+ setOpen: d,
141
+ ...y,
142
+ ...m,
143
+ labelId: r,
144
+ descriptionId: s,
145
+ setLabelId: a,
146
+ setDescriptionId: f
147
+ }),
148
+ [u, d, y, m, r, s]
149
+ );
150
+ }
151
+ const g = () => {
152
+ const e = c.useContext(I);
153
+ if (e == null)
154
+ throw new Error("Modal components must be wrapped in <Modal />");
155
+ return e;
156
+ };
157
+ function T(e) {
158
+ return x();
159
+ }
160
+ function X({
161
+ children: e,
162
+ ...n
163
+ }) {
164
+ const o = Y(n);
165
+ return /* @__PURE__ */ i(I.Provider, { value: o, children: e });
166
+ }
167
+ const ee = c.forwardRef(function(e, n) {
168
+ const { context: o, ...t } = g(), l = S([t.refs.setFloating, n]);
169
+ if (!o.open)
170
+ return null;
171
+ const { overlayBackground: r, ...a } = e, s = A("grid place-items-center", {
172
+ [`${r}`]: r,
173
+ "bg-black sm:bg-black/[.8]": !r
174
+ });
175
+ return /* @__PURE__ */ i(F, { children: /* @__PURE__ */ i(O, { className: s, lockScroll: !0, children: /* @__PURE__ */ i(k, { context: o, children: /* @__PURE__ */ i(
176
+ "div",
177
+ {
178
+ ref: l,
179
+ "aria-labelledby": t.labelId,
180
+ "aria-describedby": t.descriptionId,
181
+ ...t.getFloatingProps(a),
182
+ children: a.children
183
+ }
184
+ ) }) }) });
185
+ }), ne = c.forwardRef(function({ children: e, ...n }, o) {
186
+ const { setLabelId: t } = g(), l = T();
187
+ return c.useLayoutEffect(() => (t(l), () => t(void 0)), [l, t]), /* @__PURE__ */ i("h1", { ...n, ref: o, id: l, children: e });
188
+ }), te = c.forwardRef(function({ children: e, ...n }, o) {
189
+ const { setDescriptionId: t } = g(), l = T();
190
+ return c.useLayoutEffect(() => (t(l), () => t(void 0)), [l, t]), /* @__PURE__ */ i("div", { ...n, ref: o, id: l, children: e });
191
+ }), oe = c.forwardRef(function(e, n) {
192
+ const { setOpen: o } = g(), { trigger: t, className: l, ...r } = e, a = c.useCallback(() => o(!1), [o]);
193
+ return /* @__PURE__ */ i("div", { className: l, children: c.cloneElement(t, {
194
+ ref: n,
195
+ onClick: a,
196
+ ...r
197
+ }) });
198
+ }), le = ({
199
+ children: e,
200
+ fill: n,
201
+ viewBox: o,
202
+ className: t,
203
+ defaultViewBox: l,
204
+ defaultClassName: r,
205
+ spacing: a,
206
+ title: s,
207
+ semantic: f = !1,
208
+ ...u
209
+ }) => {
210
+ const d = j(a), m = A(
211
+ d,
212
+ t || r
213
+ );
214
+ return /* @__PURE__ */ E(D, { children: [
215
+ /* @__PURE__ */ i(
216
+ "svg",
217
+ {
218
+ xmlns: "http://www.w3.org/2000/svg",
219
+ className: m,
220
+ viewBox: o || l,
221
+ fill: n || "currentColor",
222
+ role: "img",
223
+ "aria-hidden": !f,
224
+ focusable: !1,
225
+ ...u,
226
+ children: e
227
+ }
228
+ ),
229
+ s && f && /* @__PURE__ */ i("span", { className: "sr-only", children: s })
230
+ ] });
231
+ };
232
+ /*!
233
+ @versini/ui-private v1.4.6
234
+ © 2024 gizmette.com
235
+ */
236
+ try {
237
+ window.__VERSINI_UI_PRIVATE__ || (window.__VERSINI_UI_PRIVATE__ = {
238
+ version: "1.4.6",
239
+ buildTime: "07/06/2024 10:24 AM EDT",
240
+ homepage: "https://github.com/aversini/ui-components",
241
+ license: "MIT"
242
+ });
243
+ } catch {
244
+ }
245
+ export {
246
+ W as LiveRegion,
247
+ X as Modal,
248
+ oe as ModalClose,
249
+ ee as ModalContent,
250
+ te as ModalDescription,
251
+ ne as ModalHeading,
252
+ le as SvgIcon
253
+ };