highsoft-ui 1.0.78 → 1.0.80

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,234 @@
1
+ import * as i from "react";
2
+ import { e as H, c as V, b as R, u as _, P as p, d as g, g as h, i as q, R as K, a as U, j as Y, k as Z, F as z, D as J, l as Q } from "./index-CMU31gjG.js";
3
+ import { jsx as s, jsxs as N, Fragment as O } from "react/jsx-runtime";
4
+ var v = "Dialog", [I] = V(v), [X, u] = I(v), x = (e) => {
5
+ const {
6
+ __scopeDialog: o,
7
+ children: r,
8
+ open: a,
9
+ defaultOpen: n,
10
+ onOpenChange: t,
11
+ modal: l = !0
12
+ } = e, c = i.useRef(null), f = i.useRef(null), [m, C] = H({
13
+ prop: a,
14
+ defaultProp: n ?? !1,
15
+ onChange: t,
16
+ caller: v
17
+ });
18
+ return /* @__PURE__ */ s(
19
+ X,
20
+ {
21
+ scope: o,
22
+ triggerRef: c,
23
+ contentRef: f,
24
+ contentId: R(),
25
+ titleId: R(),
26
+ descriptionId: R(),
27
+ open: m,
28
+ onOpenChange: C,
29
+ onOpenToggle: i.useCallback(() => C((B) => !B), [C]),
30
+ modal: l,
31
+ children: r
32
+ }
33
+ );
34
+ };
35
+ x.displayName = v;
36
+ var A = "DialogTrigger", T = i.forwardRef(
37
+ (e, o) => {
38
+ const { __scopeDialog: r, ...a } = e, n = u(A, r), t = _(o, n.triggerRef);
39
+ return /* @__PURE__ */ s(
40
+ p.button,
41
+ {
42
+ type: "button",
43
+ "aria-haspopup": "dialog",
44
+ "aria-expanded": n.open,
45
+ "aria-controls": n.contentId,
46
+ "data-state": y(n.open),
47
+ ...a,
48
+ ref: t,
49
+ onClick: g(e.onClick, n.onOpenToggle)
50
+ }
51
+ );
52
+ }
53
+ );
54
+ T.displayName = A;
55
+ var E = "DialogPortal", [ee, b] = I(E, {
56
+ forceMount: void 0
57
+ }), M = (e) => {
58
+ const { __scopeDialog: o, forceMount: r, children: a, container: n } = e, t = u(E, o);
59
+ return /* @__PURE__ */ s(ee, { scope: o, forceMount: r, children: i.Children.map(a, (l) => /* @__PURE__ */ s(h, { present: r || t.open, children: /* @__PURE__ */ s(q, { asChild: !0, container: n, children: l }) })) });
60
+ };
61
+ M.displayName = E;
62
+ var D = "DialogOverlay", w = i.forwardRef(
63
+ (e, o) => {
64
+ const r = b(D, e.__scopeDialog), { forceMount: a = r.forceMount, ...n } = e, t = u(D, e.__scopeDialog);
65
+ return t.modal ? /* @__PURE__ */ s(h, { present: a || t.open, children: /* @__PURE__ */ s(oe, { ...n, ref: o }) }) : null;
66
+ }
67
+ );
68
+ w.displayName = D;
69
+ var te = U("DialogOverlay.RemoveScroll"), oe = i.forwardRef(
70
+ (e, o) => {
71
+ const { __scopeDialog: r, ...a } = e, n = u(D, r);
72
+ return (
73
+ // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
74
+ // ie. when `Overlay` and `Content` are siblings
75
+ /* @__PURE__ */ s(K, { as: te, allowPinchZoom: !0, shards: [n.contentRef], children: /* @__PURE__ */ s(
76
+ p.div,
77
+ {
78
+ "data-state": y(n.open),
79
+ ...a,
80
+ ref: o,
81
+ style: { pointerEvents: "auto", ...a.style }
82
+ }
83
+ ) })
84
+ );
85
+ }
86
+ ), d = "DialogContent", F = i.forwardRef(
87
+ (e, o) => {
88
+ const r = b(d, e.__scopeDialog), { forceMount: a = r.forceMount, ...n } = e, t = u(d, e.__scopeDialog);
89
+ return /* @__PURE__ */ s(h, { present: a || t.open, children: t.modal ? /* @__PURE__ */ s(ne, { ...n, ref: o }) : /* @__PURE__ */ s(re, { ...n, ref: o }) });
90
+ }
91
+ );
92
+ F.displayName = d;
93
+ var ne = i.forwardRef(
94
+ (e, o) => {
95
+ const r = u(d, e.__scopeDialog), a = i.useRef(null), n = _(o, r.contentRef, a);
96
+ return i.useEffect(() => {
97
+ const t = a.current;
98
+ if (t) return Y(t);
99
+ }, []), /* @__PURE__ */ s(
100
+ S,
101
+ {
102
+ ...e,
103
+ ref: n,
104
+ trapFocus: r.open,
105
+ disableOutsidePointerEvents: !0,
106
+ onCloseAutoFocus: g(e.onCloseAutoFocus, (t) => {
107
+ t.preventDefault(), r.triggerRef.current?.focus();
108
+ }),
109
+ onPointerDownOutside: g(e.onPointerDownOutside, (t) => {
110
+ const l = t.detail.originalEvent, c = l.button === 0 && l.ctrlKey === !0;
111
+ (l.button === 2 || c) && t.preventDefault();
112
+ }),
113
+ onFocusOutside: g(
114
+ e.onFocusOutside,
115
+ (t) => t.preventDefault()
116
+ )
117
+ }
118
+ );
119
+ }
120
+ ), re = i.forwardRef(
121
+ (e, o) => {
122
+ const r = u(d, e.__scopeDialog), a = i.useRef(!1), n = i.useRef(!1);
123
+ return /* @__PURE__ */ s(
124
+ S,
125
+ {
126
+ ...e,
127
+ ref: o,
128
+ trapFocus: !1,
129
+ disableOutsidePointerEvents: !1,
130
+ onCloseAutoFocus: (t) => {
131
+ e.onCloseAutoFocus?.(t), t.defaultPrevented || (a.current || r.triggerRef.current?.focus(), t.preventDefault()), a.current = !1, n.current = !1;
132
+ },
133
+ onInteractOutside: (t) => {
134
+ e.onInteractOutside?.(t), t.defaultPrevented || (a.current = !0, t.detail.originalEvent.type === "pointerdown" && (n.current = !0));
135
+ const l = t.target;
136
+ r.triggerRef.current?.contains(l) && t.preventDefault(), t.detail.originalEvent.type === "focusin" && n.current && t.preventDefault();
137
+ }
138
+ }
139
+ );
140
+ }
141
+ ), S = i.forwardRef(
142
+ (e, o) => {
143
+ const { __scopeDialog: r, trapFocus: a, onOpenAutoFocus: n, onCloseAutoFocus: t, ...l } = e, c = u(d, r), f = i.useRef(null), m = _(o, f);
144
+ return Z(), /* @__PURE__ */ N(O, { children: [
145
+ /* @__PURE__ */ s(
146
+ z,
147
+ {
148
+ asChild: !0,
149
+ loop: !0,
150
+ trapped: a,
151
+ onMountAutoFocus: n,
152
+ onUnmountAutoFocus: t,
153
+ children: /* @__PURE__ */ s(
154
+ J,
155
+ {
156
+ role: "dialog",
157
+ id: c.contentId,
158
+ "aria-describedby": c.descriptionId,
159
+ "aria-labelledby": c.titleId,
160
+ "data-state": y(c.open),
161
+ ...l,
162
+ ref: m,
163
+ onDismiss: () => c.onOpenChange(!1)
164
+ }
165
+ )
166
+ }
167
+ ),
168
+ /* @__PURE__ */ N(O, { children: [
169
+ /* @__PURE__ */ s(se, { titleId: c.titleId }),
170
+ /* @__PURE__ */ s(ce, { contentRef: f, descriptionId: c.descriptionId })
171
+ ] })
172
+ ] });
173
+ }
174
+ ), P = "DialogTitle", W = i.forwardRef(
175
+ (e, o) => {
176
+ const { __scopeDialog: r, ...a } = e, n = u(P, r);
177
+ return /* @__PURE__ */ s(p.h2, { id: n.titleId, ...a, ref: o });
178
+ }
179
+ );
180
+ W.displayName = P;
181
+ var k = "DialogDescription", ae = i.forwardRef(
182
+ (e, o) => {
183
+ const { __scopeDialog: r, ...a } = e, n = u(k, r);
184
+ return /* @__PURE__ */ s(p.p, { id: n.descriptionId, ...a, ref: o });
185
+ }
186
+ );
187
+ ae.displayName = k;
188
+ var G = "DialogClose", L = i.forwardRef(
189
+ (e, o) => {
190
+ const { __scopeDialog: r, ...a } = e, n = u(G, r);
191
+ return /* @__PURE__ */ s(
192
+ p.button,
193
+ {
194
+ type: "button",
195
+ ...a,
196
+ ref: o,
197
+ onClick: g(e.onClick, () => n.onOpenChange(!1))
198
+ }
199
+ );
200
+ }
201
+ );
202
+ L.displayName = G;
203
+ function y(e) {
204
+ return e ? "open" : "closed";
205
+ }
206
+ var $ = "DialogTitleWarning", [de, j] = Q($, {
207
+ contentName: d,
208
+ titleName: P,
209
+ docsSlug: "dialog"
210
+ }), se = ({ titleId: e }) => {
211
+ const o = j($), r = `\`${o.contentName}\` requires a \`${o.titleName}\` for the component to be accessible for screen reader users.
212
+
213
+ If you want to hide the \`${o.titleName}\`, you can wrap it with our VisuallyHidden component.
214
+
215
+ For more information, see https://radix-ui.com/primitives/docs/components/${o.docsSlug}`;
216
+ return i.useEffect(() => {
217
+ e && (document.getElementById(e) || console.error(r));
218
+ }, [r, e]), null;
219
+ }, ie = "DialogDescriptionWarning", ce = ({ contentRef: e, descriptionId: o }) => {
220
+ const a = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${j(ie).contentName}}.`;
221
+ return i.useEffect(() => {
222
+ const n = e.current?.getAttribute("aria-describedby");
223
+ o && n && (document.getElementById(o) || console.warn(a));
224
+ }, [a, e, o]), null;
225
+ }, fe = x, ge = T, pe = M, De = w, ve = F, me = W, Ce = L;
226
+ export {
227
+ ve as C,
228
+ De as O,
229
+ pe as P,
230
+ fe as R,
231
+ ge as T,
232
+ me as a,
233
+ Ce as b
234
+ };