@pdf-viewer/react 0.4.0-beta.2 → 0.5.0-beta.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/Container-337e1b18.js +37 -0
- package/dist/{RPLayout-608b83dd.js → RPLayout-88110444.js} +942 -941
- package/dist/assets/Container.css +1 -1
- package/dist/assets/RPLayout.css +1 -1
- package/dist/assets/RPTooltip.css +1 -0
- package/dist/components/RPController.js +1 -1
- package/dist/components/RPViewer.js +1 -1
- package/dist/components/layout/Container.js +1 -1
- package/dist/components/layout/RPLayout.js +2 -2
- package/dist/components/layout/sidebar/RPSidebar.js +3 -2
- package/dist/components/layout/sidebar/Thumbnail.js +1 -1
- package/dist/components/layout/sidebar/Thumbnails.js +1 -1
- package/dist/components/layout/toolbar/DarkModeTool.js +13 -12
- package/dist/components/layout/toolbar/DocumentDialog.js +1 -1
- package/dist/components/layout/toolbar/DocumentProperties.js +7 -6
- package/dist/components/layout/toolbar/FileDownloadTool.js +3 -2
- package/dist/components/layout/toolbar/FileUploadTool.js +16 -15
- package/dist/components/layout/toolbar/FullScreenTool.js +30 -32
- package/dist/components/layout/toolbar/MostPageTool.js +3 -2
- package/dist/components/layout/toolbar/OtherTool.js +3 -2
- package/dist/components/layout/toolbar/Paginate.js +3 -2
- package/dist/components/layout/toolbar/PrintTool.js +3 -2
- package/dist/components/layout/toolbar/RPToolbar.js +1 -1
- package/dist/components/layout/toolbar/RPToolbarEnd.js +1 -1
- package/dist/components/layout/toolbar/RotateTool.js +24 -23
- package/dist/components/layout/toolbar/ScrollModeTool.js +34 -33
- package/dist/components/layout/toolbar/SearchTool.js +3 -2
- package/dist/components/layout/toolbar/SelectionModeTool.js +27 -26
- package/dist/components/layout/toolbar/ZoomTool.js +3 -2
- package/dist/components/page/AnnotationLayer.js +1 -1
- package/dist/components/page/CanvasLayer.js +1 -1
- package/dist/components/page/DualPage.js +1 -1
- package/dist/components/page/RPPage.js +1 -1
- package/dist/components/page/SinglePage.js +1 -1
- package/dist/components/page/TextLayer.js +1 -1
- package/dist/components/ui/Checkbox.js +130 -242
- package/dist/components/ui/LoadingIndicator.js +1 -1
- package/dist/components/ui/RPTooltip.js +2397 -0
- package/dist/contexts/PaginateContext.js +1 -1
- package/dist/contexts/PrintContext.js +1 -1
- package/dist/contexts/SearchContext.js +1 -1
- package/dist/contexts/ThumbnailsContext.js +1 -1
- package/dist/index-2b077daa.js +122 -0
- package/dist/main.js +1 -1
- package/dist/types/components/ui/RPTooltip.d.ts +8 -0
- package/dist/utils/hooks/useFileDownload.js +1 -1
- package/dist/utils/hooks/useLicense.js +1 -1
- package/dist/utils/hooks/usePaginate.js +1 -1
- package/dist/utils/hooks/usePrint.js +1 -1
- package/dist/utils/hooks/useScrollToPage.js +1 -1
- package/dist/utils/hooks/useSearch.js +1 -1
- package/dist/utils/hooks/useThumbnail.js +1 -1
- package/dist/utils/hooks/useVirtualReactWindow.js +1 -1
- package/package.json +2 -1
- package/dist/Container-cea98fc1.js +0 -37
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as f, Fragment as q, jsxs as M } from "react/jsx-runtime";
|
|
2
2
|
import * as i from "react";
|
|
3
|
+
import { u as A, c as B, a as K, b as z } from "../../index-2b077daa.js";
|
|
3
4
|
import "react-dom";
|
|
4
|
-
import { CheckIcon as
|
|
5
|
-
import '../../assets/Checkbox.css';function
|
|
5
|
+
import { CheckIcon as X } from "../icons/CheckIcon.js";
|
|
6
|
+
import '../../assets/Checkbox.css';function S(e, t) {
|
|
6
7
|
if (typeof e == "function")
|
|
7
8
|
return e(t);
|
|
8
9
|
e != null && (e.current = t);
|
|
@@ -11,154 +12,41 @@ function I(...e) {
|
|
|
11
12
|
return (t) => {
|
|
12
13
|
let n = !1;
|
|
13
14
|
const r = e.map((o) => {
|
|
14
|
-
const
|
|
15
|
-
return !n && typeof
|
|
15
|
+
const c = S(o, t);
|
|
16
|
+
return !n && typeof c == "function" && (n = !0), c;
|
|
16
17
|
});
|
|
17
18
|
if (n)
|
|
18
19
|
return () => {
|
|
19
20
|
for (let o = 0; o < r.length; o++) {
|
|
20
|
-
const
|
|
21
|
-
typeof
|
|
21
|
+
const c = r[o];
|
|
22
|
+
typeof c == "function" ? c() : S(e[o], null);
|
|
22
23
|
}
|
|
23
24
|
};
|
|
24
25
|
};
|
|
25
26
|
}
|
|
26
|
-
function
|
|
27
|
+
function T(...e) {
|
|
27
28
|
return i.useCallback(I(...e), e);
|
|
28
29
|
}
|
|
29
|
-
function q(e, t = []) {
|
|
30
|
-
let n = [];
|
|
31
|
-
function r(s, u) {
|
|
32
|
-
const c = i.createContext(u), a = n.length;
|
|
33
|
-
n = [...n, u];
|
|
34
|
-
const l = (d) => {
|
|
35
|
-
var y;
|
|
36
|
-
const { scope: f, children: m, ...b } = d, v = ((y = f == null ? void 0 : f[e]) == null ? void 0 : y[a]) || c, k = i.useMemo(() => b, Object.values(b));
|
|
37
|
-
return /* @__PURE__ */ h(v.Provider, { value: k, children: m });
|
|
38
|
-
};
|
|
39
|
-
l.displayName = s + "Provider";
|
|
40
|
-
function p(d, f) {
|
|
41
|
-
var v;
|
|
42
|
-
const m = ((v = f == null ? void 0 : f[e]) == null ? void 0 : v[a]) || c, b = i.useContext(m);
|
|
43
|
-
if (b)
|
|
44
|
-
return b;
|
|
45
|
-
if (u !== void 0)
|
|
46
|
-
return u;
|
|
47
|
-
throw new Error(`\`${d}\` must be used within \`${s}\``);
|
|
48
|
-
}
|
|
49
|
-
return [l, p];
|
|
50
|
-
}
|
|
51
|
-
const o = () => {
|
|
52
|
-
const s = n.map((u) => i.createContext(u));
|
|
53
|
-
return function(c) {
|
|
54
|
-
const a = (c == null ? void 0 : c[e]) || s;
|
|
55
|
-
return i.useMemo(
|
|
56
|
-
() => ({ [`__scope${e}`]: { ...c, [e]: a } }),
|
|
57
|
-
[c, a]
|
|
58
|
-
);
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
return o.scopeName = e, [r, K(o, ...t)];
|
|
62
|
-
}
|
|
63
|
-
function K(...e) {
|
|
64
|
-
const t = e[0];
|
|
65
|
-
if (e.length === 1)
|
|
66
|
-
return t;
|
|
67
|
-
const n = () => {
|
|
68
|
-
const r = e.map((o) => ({
|
|
69
|
-
useScope: o(),
|
|
70
|
-
scopeName: o.scopeName
|
|
71
|
-
}));
|
|
72
|
-
return function(s) {
|
|
73
|
-
const u = r.reduce((c, { useScope: a, scopeName: l }) => {
|
|
74
|
-
const d = a(s)[`__scope${l}`];
|
|
75
|
-
return { ...c, ...d };
|
|
76
|
-
}, {});
|
|
77
|
-
return i.useMemo(() => ({ [`__scope${t.scopeName}`]: u }), [u]);
|
|
78
|
-
};
|
|
79
|
-
};
|
|
80
|
-
return n.scopeName = t.scopeName, n;
|
|
81
|
-
}
|
|
82
30
|
function O(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
|
|
83
31
|
return function(o) {
|
|
84
32
|
if (e == null || e(o), n === !1 || !o.defaultPrevented)
|
|
85
33
|
return t == null ? void 0 : t(o);
|
|
86
34
|
};
|
|
87
35
|
}
|
|
88
|
-
function
|
|
89
|
-
const t = i.useRef(e);
|
|
90
|
-
return i.useEffect(() => {
|
|
91
|
-
t.current = e;
|
|
92
|
-
}), i.useMemo(() => (...n) => {
|
|
93
|
-
var r;
|
|
94
|
-
return (r = t.current) == null ? void 0 : r.call(t, ...n);
|
|
95
|
-
}, []);
|
|
96
|
-
}
|
|
97
|
-
function X({
|
|
98
|
-
prop: e,
|
|
99
|
-
defaultProp: t,
|
|
100
|
-
onChange: n = () => {
|
|
101
|
-
}
|
|
102
|
-
}) {
|
|
103
|
-
const [r, o] = Z({ defaultProp: t, onChange: n }), s = e !== void 0, u = s ? e : r, c = T(n), a = i.useCallback(
|
|
104
|
-
(l) => {
|
|
105
|
-
if (s) {
|
|
106
|
-
const d = typeof l == "function" ? l(e) : l;
|
|
107
|
-
d !== e && c(d);
|
|
108
|
-
} else
|
|
109
|
-
o(l);
|
|
110
|
-
},
|
|
111
|
-
[s, e, o, c]
|
|
112
|
-
);
|
|
113
|
-
return [u, a];
|
|
114
|
-
}
|
|
115
|
-
function Z({
|
|
116
|
-
defaultProp: e,
|
|
117
|
-
onChange: t
|
|
118
|
-
}) {
|
|
119
|
-
const n = i.useState(e), [r] = n, o = i.useRef(r), s = T(t);
|
|
120
|
-
return i.useEffect(() => {
|
|
121
|
-
o.current !== r && (s(r), o.current = r);
|
|
122
|
-
}, [r, o, s]), n;
|
|
123
|
-
}
|
|
124
|
-
function G(e) {
|
|
36
|
+
function $(e) {
|
|
125
37
|
const t = i.useRef({ value: e, previous: e });
|
|
126
38
|
return i.useMemo(() => (t.current.value !== e && (t.current.previous = t.current.value, t.current.value = e), t.current.previous), [e]);
|
|
127
39
|
}
|
|
128
|
-
|
|
129
|
-
};
|
|
130
|
-
function H(e) {
|
|
131
|
-
const [t, n] = i.useState(void 0);
|
|
132
|
-
return R(() => {
|
|
133
|
-
if (e) {
|
|
134
|
-
n({ width: e.offsetWidth, height: e.offsetHeight });
|
|
135
|
-
const r = new ResizeObserver((o) => {
|
|
136
|
-
if (!Array.isArray(o) || !o.length)
|
|
137
|
-
return;
|
|
138
|
-
const s = o[0];
|
|
139
|
-
let u, c;
|
|
140
|
-
if ("borderBoxSize" in s) {
|
|
141
|
-
const a = s.borderBoxSize, l = Array.isArray(a) ? a[0] : a;
|
|
142
|
-
u = l.inlineSize, c = l.blockSize;
|
|
143
|
-
} else
|
|
144
|
-
u = e.offsetWidth, c = e.offsetHeight;
|
|
145
|
-
n({ width: u, height: c });
|
|
146
|
-
});
|
|
147
|
-
return r.observe(e, { box: "border-box" }), () => r.unobserve(e);
|
|
148
|
-
} else
|
|
149
|
-
n(void 0);
|
|
150
|
-
}, [e]), t;
|
|
151
|
-
}
|
|
152
|
-
function J(e, t) {
|
|
40
|
+
function Z(e, t) {
|
|
153
41
|
return i.useReducer((n, r) => t[n][r] ?? n, e);
|
|
154
42
|
}
|
|
155
|
-
var
|
|
156
|
-
const { present: t, children: n } = e, r =
|
|
157
|
-
return typeof n == "function" || r.isPresent ? i.cloneElement(o, { ref:
|
|
43
|
+
var _ = (e) => {
|
|
44
|
+
const { present: t, children: n } = e, r = G(t), o = typeof n == "function" ? n({ present: r.isPresent }) : i.Children.only(n), c = T(r.ref, J(o));
|
|
45
|
+
return typeof n == "function" || r.isPresent ? i.cloneElement(o, { ref: c }) : null;
|
|
158
46
|
};
|
|
159
|
-
|
|
160
|
-
function
|
|
161
|
-
const [t, n] = i.useState(), r = i.useRef({}), o = i.useRef(e),
|
|
47
|
+
_.displayName = "Presence";
|
|
48
|
+
function G(e) {
|
|
49
|
+
const [t, n] = i.useState(), r = i.useRef({}), o = i.useRef(e), c = i.useRef("none"), a = e ? "mounted" : "unmounted", [s, l] = Z(a, {
|
|
162
50
|
mounted: {
|
|
163
51
|
UNMOUNT: "unmounted",
|
|
164
52
|
ANIMATION_OUT: "unmountSuspended"
|
|
@@ -172,63 +60,63 @@ function Q(e) {
|
|
|
172
60
|
}
|
|
173
61
|
});
|
|
174
62
|
return i.useEffect(() => {
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
}, [
|
|
178
|
-
const
|
|
63
|
+
const u = R(r.current);
|
|
64
|
+
c.current = s === "mounted" ? u : "none";
|
|
65
|
+
}, [s]), A(() => {
|
|
66
|
+
const u = r.current, p = o.current;
|
|
179
67
|
if (p !== e) {
|
|
180
|
-
const
|
|
181
|
-
e ?
|
|
68
|
+
const d = c.current, m = R(u);
|
|
69
|
+
e ? l("MOUNT") : m === "none" || (u == null ? void 0 : u.display) === "none" ? l("UNMOUNT") : l(p && d !== m ? "ANIMATION_OUT" : "UNMOUNT"), o.current = e;
|
|
182
70
|
}
|
|
183
|
-
}, [e,
|
|
71
|
+
}, [e, l]), A(() => {
|
|
184
72
|
if (t) {
|
|
185
|
-
let
|
|
186
|
-
const p = t.ownerDocument.defaultView ?? window,
|
|
187
|
-
const
|
|
188
|
-
if (m.target === t &&
|
|
189
|
-
const
|
|
190
|
-
t.style.animationFillMode = "forwards",
|
|
191
|
-
t.style.animationFillMode === "forwards" && (t.style.animationFillMode =
|
|
73
|
+
let u;
|
|
74
|
+
const p = t.ownerDocument.defaultView ?? window, C = (m) => {
|
|
75
|
+
const y = R(r.current).includes(m.animationName);
|
|
76
|
+
if (m.target === t && y && (l("ANIMATION_END"), !o.current)) {
|
|
77
|
+
const g = t.style.animationFillMode;
|
|
78
|
+
t.style.animationFillMode = "forwards", u = p.setTimeout(() => {
|
|
79
|
+
t.style.animationFillMode === "forwards" && (t.style.animationFillMode = g);
|
|
192
80
|
});
|
|
193
81
|
}
|
|
194
|
-
},
|
|
195
|
-
m.target === t && (
|
|
82
|
+
}, d = (m) => {
|
|
83
|
+
m.target === t && (c.current = R(r.current));
|
|
196
84
|
};
|
|
197
|
-
return t.addEventListener("animationstart",
|
|
198
|
-
p.clearTimeout(
|
|
85
|
+
return t.addEventListener("animationstart", d), t.addEventListener("animationcancel", C), t.addEventListener("animationend", C), () => {
|
|
86
|
+
p.clearTimeout(u), t.removeEventListener("animationstart", d), t.removeEventListener("animationcancel", C), t.removeEventListener("animationend", C);
|
|
199
87
|
};
|
|
200
88
|
} else
|
|
201
|
-
|
|
202
|
-
}, [t,
|
|
203
|
-
isPresent: ["mounted", "unmountSuspended"].includes(
|
|
204
|
-
ref: i.useCallback((
|
|
205
|
-
|
|
89
|
+
l("ANIMATION_END");
|
|
90
|
+
}, [t, l]), {
|
|
91
|
+
isPresent: ["mounted", "unmountSuspended"].includes(s),
|
|
92
|
+
ref: i.useCallback((u) => {
|
|
93
|
+
u && (r.current = getComputedStyle(u)), n(u);
|
|
206
94
|
}, [])
|
|
207
95
|
};
|
|
208
96
|
}
|
|
209
|
-
function
|
|
97
|
+
function R(e) {
|
|
210
98
|
return (e == null ? void 0 : e.animationName) || "none";
|
|
211
99
|
}
|
|
212
|
-
function
|
|
100
|
+
function J(e) {
|
|
213
101
|
var r, o;
|
|
214
102
|
let t = (r = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : r.get, n = t && "isReactWarning" in t && t.isReactWarning;
|
|
215
103
|
return n ? e.ref : (t = (o = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : o.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
|
|
216
104
|
}
|
|
217
|
-
var
|
|
218
|
-
const { children: n, ...r } = e, o = i.Children.toArray(n),
|
|
219
|
-
if (
|
|
220
|
-
const
|
|
221
|
-
return /* @__PURE__ */
|
|
105
|
+
var D = i.forwardRef((e, t) => {
|
|
106
|
+
const { children: n, ...r } = e, o = i.Children.toArray(n), c = o.find(Y);
|
|
107
|
+
if (c) {
|
|
108
|
+
const a = c.props.children, s = o.map((l) => l === c ? i.Children.count(a) > 1 ? i.Children.only(null) : i.isValidElement(a) ? a.props.children : null : l);
|
|
109
|
+
return /* @__PURE__ */ f(E, { ...r, ref: t, children: i.isValidElement(a) ? i.cloneElement(a, void 0, s) : null });
|
|
222
110
|
}
|
|
223
|
-
return /* @__PURE__ */
|
|
111
|
+
return /* @__PURE__ */ f(E, { ...r, ref: t, children: n });
|
|
224
112
|
});
|
|
225
|
-
|
|
113
|
+
D.displayName = "Slot";
|
|
226
114
|
var E = i.forwardRef((e, t) => {
|
|
227
115
|
const { children: n, ...r } = e;
|
|
228
116
|
if (i.isValidElement(n)) {
|
|
229
|
-
const o =
|
|
117
|
+
const o = ee(n);
|
|
230
118
|
return i.cloneElement(n, {
|
|
231
|
-
...
|
|
119
|
+
...H(r, n.props),
|
|
232
120
|
// @ts-ignore
|
|
233
121
|
ref: t ? I(t, o) : o
|
|
234
122
|
});
|
|
@@ -236,26 +124,26 @@ var E = i.forwardRef((e, t) => {
|
|
|
236
124
|
return i.Children.count(n) > 1 ? i.Children.only(null) : null;
|
|
237
125
|
});
|
|
238
126
|
E.displayName = "SlotClone";
|
|
239
|
-
var
|
|
240
|
-
function
|
|
241
|
-
return i.isValidElement(e) && e.type ===
|
|
127
|
+
var Q = ({ children: e }) => /* @__PURE__ */ f(q, { children: e });
|
|
128
|
+
function Y(e) {
|
|
129
|
+
return i.isValidElement(e) && e.type === Q;
|
|
242
130
|
}
|
|
243
|
-
function
|
|
131
|
+
function H(e, t) {
|
|
244
132
|
const n = { ...t };
|
|
245
133
|
for (const r in t) {
|
|
246
|
-
const o = e[r],
|
|
247
|
-
/^on[A-Z]/.test(r) ? o &&
|
|
248
|
-
|
|
249
|
-
} : o && (n[r] = o) : r === "style" ? n[r] = { ...o, ...
|
|
134
|
+
const o = e[r], c = t[r];
|
|
135
|
+
/^on[A-Z]/.test(r) ? o && c ? n[r] = (...s) => {
|
|
136
|
+
c(...s), o(...s);
|
|
137
|
+
} : o && (n[r] = o) : r === "style" ? n[r] = { ...o, ...c } : r === "className" && (n[r] = [o, c].filter(Boolean).join(" "));
|
|
250
138
|
}
|
|
251
139
|
return { ...e, ...n };
|
|
252
140
|
}
|
|
253
|
-
function
|
|
141
|
+
function ee(e) {
|
|
254
142
|
var r, o;
|
|
255
143
|
let t = (r = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : r.get, n = t && "isReactWarning" in t && t.isReactWarning;
|
|
256
144
|
return n ? e.ref : (t = (o = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : o.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
|
|
257
145
|
}
|
|
258
|
-
var
|
|
146
|
+
var te = [
|
|
259
147
|
"a",
|
|
260
148
|
"button",
|
|
261
149
|
"div",
|
|
@@ -272,85 +160,85 @@ var oe = [
|
|
|
272
160
|
"span",
|
|
273
161
|
"svg",
|
|
274
162
|
"ul"
|
|
275
|
-
],
|
|
163
|
+
], U = te.reduce((e, t) => {
|
|
276
164
|
const n = i.forwardRef((r, o) => {
|
|
277
|
-
const { asChild:
|
|
278
|
-
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */
|
|
165
|
+
const { asChild: c, ...a } = r, s = c ? D : t;
|
|
166
|
+
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ f(s, { ...a, ref: o });
|
|
279
167
|
});
|
|
280
168
|
return n.displayName = `Primitive.${t}`, { ...e, [t]: n };
|
|
281
|
-
}, {}), w = "Checkbox", [
|
|
169
|
+
}, {}), w = "Checkbox", [ne, fe] = B(w), [re, oe] = ne(w), W = i.forwardRef(
|
|
282
170
|
(e, t) => {
|
|
283
171
|
const {
|
|
284
172
|
__scopeCheckbox: n,
|
|
285
173
|
name: r,
|
|
286
174
|
checked: o,
|
|
287
|
-
defaultChecked:
|
|
288
|
-
required:
|
|
289
|
-
disabled:
|
|
290
|
-
value:
|
|
291
|
-
onCheckedChange:
|
|
175
|
+
defaultChecked: c,
|
|
176
|
+
required: a,
|
|
177
|
+
disabled: s,
|
|
178
|
+
value: l = "on",
|
|
179
|
+
onCheckedChange: u,
|
|
292
180
|
form: p,
|
|
293
|
-
...
|
|
294
|
-
} = e, [
|
|
181
|
+
...C
|
|
182
|
+
} = e, [d, m] = i.useState(null), k = T(t, (h) => m(h)), y = i.useRef(!1), g = d ? p || !!d.closest("form") : !0, [N = !1, x] = K({
|
|
295
183
|
prop: o,
|
|
296
|
-
defaultProp:
|
|
297
|
-
onChange:
|
|
298
|
-
}),
|
|
184
|
+
defaultProp: c,
|
|
185
|
+
onChange: u
|
|
186
|
+
}), V = i.useRef(N);
|
|
299
187
|
return i.useEffect(() => {
|
|
300
|
-
const
|
|
301
|
-
if (
|
|
302
|
-
const
|
|
303
|
-
return
|
|
188
|
+
const h = d == null ? void 0 : d.form;
|
|
189
|
+
if (h) {
|
|
190
|
+
const v = () => x(V.current);
|
|
191
|
+
return h.addEventListener("reset", v), () => h.removeEventListener("reset", v);
|
|
304
192
|
}
|
|
305
|
-
}, [
|
|
306
|
-
/* @__PURE__ */
|
|
307
|
-
|
|
193
|
+
}, [d, x]), /* @__PURE__ */ M(re, { scope: n, state: N, disabled: s, children: [
|
|
194
|
+
/* @__PURE__ */ f(
|
|
195
|
+
U.button,
|
|
308
196
|
{
|
|
309
197
|
type: "button",
|
|
310
198
|
role: "checkbox",
|
|
311
|
-
"aria-checked": N
|
|
312
|
-
"aria-required":
|
|
313
|
-
"data-state":
|
|
314
|
-
"data-disabled":
|
|
315
|
-
disabled:
|
|
316
|
-
value:
|
|
317
|
-
...
|
|
318
|
-
ref:
|
|
319
|
-
onKeyDown: O(e.onKeyDown, (
|
|
320
|
-
|
|
199
|
+
"aria-checked": b(N) ? "mixed" : N,
|
|
200
|
+
"aria-required": a,
|
|
201
|
+
"data-state": F(N),
|
|
202
|
+
"data-disabled": s ? "" : void 0,
|
|
203
|
+
disabled: s,
|
|
204
|
+
value: l,
|
|
205
|
+
...C,
|
|
206
|
+
ref: k,
|
|
207
|
+
onKeyDown: O(e.onKeyDown, (h) => {
|
|
208
|
+
h.key === "Enter" && h.preventDefault();
|
|
321
209
|
}),
|
|
322
|
-
onClick: O(e.onClick, (
|
|
323
|
-
|
|
210
|
+
onClick: O(e.onClick, (h) => {
|
|
211
|
+
x((v) => b(v) ? !0 : !v), g && (y.current = h.isPropagationStopped(), y.current || h.stopPropagation());
|
|
324
212
|
})
|
|
325
213
|
}
|
|
326
214
|
),
|
|
327
|
-
|
|
328
|
-
|
|
215
|
+
g && /* @__PURE__ */ f(
|
|
216
|
+
ie,
|
|
329
217
|
{
|
|
330
|
-
control:
|
|
331
|
-
bubbles: !
|
|
218
|
+
control: d,
|
|
219
|
+
bubbles: !y.current,
|
|
332
220
|
name: r,
|
|
333
|
-
value:
|
|
334
|
-
checked:
|
|
335
|
-
required:
|
|
336
|
-
disabled:
|
|
221
|
+
value: l,
|
|
222
|
+
checked: N,
|
|
223
|
+
required: a,
|
|
224
|
+
disabled: s,
|
|
337
225
|
form: p,
|
|
338
226
|
style: { transform: "translateX(-100%)" },
|
|
339
|
-
defaultChecked:
|
|
227
|
+
defaultChecked: b(c) ? !1 : c
|
|
340
228
|
}
|
|
341
229
|
)
|
|
342
230
|
] });
|
|
343
231
|
}
|
|
344
232
|
);
|
|
345
|
-
|
|
233
|
+
W.displayName = w;
|
|
346
234
|
var L = "CheckboxIndicator", j = i.forwardRef(
|
|
347
235
|
(e, t) => {
|
|
348
|
-
const { __scopeCheckbox: n, forceMount: r, ...o } = e,
|
|
349
|
-
return /* @__PURE__ */
|
|
350
|
-
|
|
236
|
+
const { __scopeCheckbox: n, forceMount: r, ...o } = e, c = oe(L, n);
|
|
237
|
+
return /* @__PURE__ */ f(_, { present: r || b(c.state) || c.state === !0, children: /* @__PURE__ */ f(
|
|
238
|
+
U.span,
|
|
351
239
|
{
|
|
352
|
-
"data-state":
|
|
353
|
-
"data-disabled":
|
|
240
|
+
"data-state": F(c.state),
|
|
241
|
+
"data-disabled": c.disabled ? "" : void 0,
|
|
354
242
|
...o,
|
|
355
243
|
ref: t,
|
|
356
244
|
style: { pointerEvents: "none", ...e.style }
|
|
@@ -359,28 +247,28 @@ var L = "CheckboxIndicator", j = i.forwardRef(
|
|
|
359
247
|
}
|
|
360
248
|
);
|
|
361
249
|
j.displayName = L;
|
|
362
|
-
var
|
|
363
|
-
const { control: t, checked: n, bubbles: r = !0, defaultChecked: o, ...
|
|
250
|
+
var ie = (e) => {
|
|
251
|
+
const { control: t, checked: n, bubbles: r = !0, defaultChecked: o, ...c } = e, a = i.useRef(null), s = $(n), l = z(t);
|
|
364
252
|
i.useEffect(() => {
|
|
365
|
-
const p =
|
|
366
|
-
if (
|
|
367
|
-
const
|
|
368
|
-
p.indeterminate =
|
|
253
|
+
const p = a.current, C = window.HTMLInputElement.prototype, m = Object.getOwnPropertyDescriptor(C, "checked").set;
|
|
254
|
+
if (s !== n && m) {
|
|
255
|
+
const k = new Event("click", { bubbles: r });
|
|
256
|
+
p.indeterminate = b(n), m.call(p, b(n) ? !1 : n), p.dispatchEvent(k);
|
|
369
257
|
}
|
|
370
|
-
}, [
|
|
371
|
-
const
|
|
372
|
-
return /* @__PURE__ */
|
|
258
|
+
}, [s, n, r]);
|
|
259
|
+
const u = i.useRef(b(n) ? !1 : n);
|
|
260
|
+
return /* @__PURE__ */ f(
|
|
373
261
|
"input",
|
|
374
262
|
{
|
|
375
263
|
type: "checkbox",
|
|
376
264
|
"aria-hidden": !0,
|
|
377
|
-
defaultChecked: o ??
|
|
378
|
-
...
|
|
265
|
+
defaultChecked: o ?? u.current,
|
|
266
|
+
...c,
|
|
379
267
|
tabIndex: -1,
|
|
380
|
-
ref:
|
|
268
|
+
ref: a,
|
|
381
269
|
style: {
|
|
382
270
|
...e.style,
|
|
383
|
-
...
|
|
271
|
+
...l,
|
|
384
272
|
position: "absolute",
|
|
385
273
|
pointerEvents: "none",
|
|
386
274
|
opacity: 0,
|
|
@@ -389,25 +277,25 @@ var ue = (e) => {
|
|
|
389
277
|
}
|
|
390
278
|
);
|
|
391
279
|
};
|
|
392
|
-
function
|
|
280
|
+
function b(e) {
|
|
393
281
|
return e === "indeterminate";
|
|
394
282
|
}
|
|
395
|
-
function
|
|
396
|
-
return
|
|
283
|
+
function F(e) {
|
|
284
|
+
return b(e) ? "indeterminate" : e ? "checked" : "unchecked";
|
|
397
285
|
}
|
|
398
|
-
var
|
|
286
|
+
var ce = W, se = j;
|
|
399
287
|
const P = {
|
|
400
288
|
"rp-checkbox": "_rp-checkbox_11dq0_1",
|
|
401
289
|
"rp-checkbox-indicator": "_rp-checkbox-indicator_11dq0_18"
|
|
402
|
-
},
|
|
290
|
+
}, pe = ({
|
|
403
291
|
children: e,
|
|
404
292
|
value: t,
|
|
405
293
|
name: n,
|
|
406
294
|
onChange: r
|
|
407
295
|
}) => /* @__PURE__ */ M("div", { style: { display: "flex", alignItems: "center", position: "relative" }, children: [
|
|
408
|
-
/* @__PURE__ */
|
|
409
|
-
/* @__PURE__ */
|
|
296
|
+
/* @__PURE__ */ f(ce, { className: P["rp-checkbox"], checked: t, id: n, onCheckedChange: r, children: /* @__PURE__ */ f(se, { className: P["rp-checkbox-indicator"], children: /* @__PURE__ */ f(X, {}) }) }),
|
|
297
|
+
/* @__PURE__ */ f("label", { className: P["rp-checkbox-label"], htmlFor: n, children: e })
|
|
410
298
|
] });
|
|
411
299
|
export {
|
|
412
|
-
|
|
300
|
+
pe as UICheckbox
|
|
413
301
|
};
|