@pdf-viewer/react 1.9.0-beta.4 → 1.9.0-beta.6
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/Checkbox.module-3edaacbb.js +7 -0
- package/dist/Combination-9a0a3e65.js +693 -0
- package/dist/Container.module-f8b5c306.js +6 -0
- package/dist/DropDown.module-a78567cb.js +11 -0
- package/dist/MenuItem.module-bc11d0d3.js +6 -0
- package/dist/MenuSeparator.module-89b2ff7f.js +6 -0
- package/dist/PropertyItem.module-db0150cc.js +8 -0
- package/dist/RPSplitter.module-13d612c4.js +7 -0
- package/dist/RPTheme.module-bd9038da.js +8 -0
- package/dist/RotateTool.module-03987eba.js +6 -0
- package/dist/SearchTool.module-016f3a8d.js +16 -0
- package/dist/ToolbarLayout.module-88476995.js +2464 -0
- package/dist/WrapperLayout.module-147bc943.js +6 -0
- package/dist/assets/ToolbarLayout.css +1 -0
- package/dist/components/RPConfig.js +673 -691
- package/dist/components/RPController.js +34 -34
- package/dist/components/RPDropFileZone.js +21 -23
- package/dist/components/RPPages.js +21 -18
- package/dist/components/RPProvider.js +19 -15
- package/dist/components/layout/Container.js +10 -11
- package/dist/components/layout/LayoutContainer.js +19 -16
- package/dist/components/layout/RPDefaultLayout.js +76 -14
- package/dist/components/layout/RPLayout.js +74 -24
- package/dist/components/layout/WrapperLayout.js +7 -8
- package/dist/components/layout/sidebar/RPSidebar.js +51 -12
- package/dist/components/layout/sidebar/RPSplitter.js +7 -9
- package/dist/components/layout/sidebar/Thumbnail.js +49 -2
- package/dist/components/layout/sidebar/Thumbnails.js +1 -1
- package/dist/components/layout/toolbar/DocumentDialog.js +307 -24
- package/dist/components/layout/toolbar/FileDownloadTool.js +23 -13
- package/dist/components/layout/toolbar/MenuItem.js +6 -7
- package/dist/components/layout/toolbar/MenuSeparator.js +4 -5
- package/dist/components/layout/toolbar/MostPageTool.js +50 -23
- package/dist/components/layout/toolbar/OtherTool.js +115 -22
- package/dist/components/layout/toolbar/Paginate.js +99 -17
- package/dist/components/layout/toolbar/PrintTool.js +43 -13
- package/dist/components/layout/toolbar/PropertyItem.js +5 -8
- package/dist/components/layout/toolbar/RPToolbar.js +28 -7
- package/dist/components/layout/toolbar/RPToolbarEnd.js +22 -7
- package/dist/components/layout/toolbar/RotateTool.js +20 -21
- package/dist/components/layout/toolbar/ScrollModeTool.js +1 -1
- package/dist/components/layout/toolbar/SearchCloseButton.js +19 -7
- package/dist/components/layout/toolbar/SearchResultNavigator.js +42 -8
- package/dist/components/layout/toolbar/SearchTool.js +198 -29
- package/dist/components/layout/toolbar/SelectionModeTool.js +1 -1
- package/dist/components/layout/toolbar/ThumbnailTool.js +3 -3
- package/dist/components/layout/toolbar/ToolbarCustom.js +48 -20
- package/dist/components/layout/toolbar/ToolbarDefault.js +82 -0
- package/dist/components/layout/toolbar/ToolbarLayout.js +10 -0
- package/dist/components/layout/toolbar/ViewModeTool.js +1 -1
- package/dist/components/layout/toolbar/ZoomTool.js +140 -28
- package/dist/components/layout/toolbar/tools/FileDownloadTool.js +3 -3
- package/dist/components/layout/toolbar/tools/InputPageTool.js +11 -11
- package/dist/components/layout/toolbar/tools/NextPageTool.js +21 -18
- package/dist/components/layout/toolbar/tools/PreviousPageTool.js +1 -1
- package/dist/components/layout/toolbar/tools/PrintTool.js +3 -3
- package/dist/components/layout/toolbar/tools/ThumbnailTool.js +1 -1
- package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +10 -10
- package/dist/components/layout/toolbar/tools/defaults/{TopbarDefaultTools.js → RPHorizontalBar.js} +29 -20
- package/dist/components/layout/toolbar/tools/defaults/RPVerticalBar.js +16 -0
- package/dist/components/page/AnnotationLayer.js +20 -17
- package/dist/components/page/CanvasLayer.js +20 -18
- package/dist/components/page/DualPage.js +1 -1
- package/dist/components/page/RPPage.js +20 -17
- package/dist/components/page/SinglePage.js +1 -1
- package/dist/components/page/TextHighlightLayer.js +20 -17
- package/dist/components/page/TextLayer.js +20 -17
- package/dist/components/ui/Checkbox.js +125 -239
- package/dist/components/ui/DropDown.js +13 -19
- package/dist/components/ui/LoadingIndicator.js +22 -5
- package/dist/components/ui/RPTooltip.js +133 -133
- package/dist/contexts/ElementPageContext.js +37 -37
- package/dist/contexts/FileInputContext.js +18 -20
- package/dist/contexts/PaginationContext.js +4 -4
- package/dist/contexts/PrintContext.js +1 -1
- package/dist/contexts/RenderQueueProvider.js +10 -0
- package/dist/contexts/SearchContext.js +3 -3
- package/dist/contexts/ThumbnailsContext.js +1 -1
- package/dist/contexts/ViewportContext.js +42 -35
- package/dist/index-2160dd99.js +307 -0
- package/dist/{index-5f66a29f.js → index-492f99d0.js} +491 -515
- package/dist/index-49b9a615.js +978 -0
- package/dist/main.js +76 -73
- package/dist/types/components/layout/RPDefaultLayout.d.ts +2 -1
- package/dist/types/components/layout/RPLayout.d.ts +2 -1
- package/dist/types/components/layout/sidebar/Thumbnail.d.ts +0 -1
- package/dist/types/components/layout/toolbar/RPToolbar.d.ts +2 -3
- package/dist/types/components/layout/toolbar/ToolbarCustom.d.ts +2 -2
- package/dist/types/components/layout/toolbar/ToolbarDefault.d.ts +4 -0
- package/dist/types/components/layout/toolbar/ToolbarLayout.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/defaults/RPHorizontalBar.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/defaults/RPVerticalBar.d.ts +3 -0
- package/dist/types/contexts/RenderQueueProvider.d.ts +16 -0
- package/dist/types/main.d.ts +3 -3
- package/dist/types/utils/Queue.d.ts +18 -0
- package/dist/types/utils/renderPage.d.ts +1 -6
- package/dist/types/utils/types.d.ts +22 -17
- package/dist/utils/Queue.js +47 -0
- package/dist/utils/hooks/useFileDownload.js +20 -17
- package/dist/utils/hooks/useLicense.js +1 -1
- package/dist/utils/hooks/usePageRotateContext.js +14 -14
- package/dist/utils/hooks/usePaginate.js +20 -17
- package/dist/utils/hooks/usePresentPage.js +20 -17
- package/dist/utils/hooks/usePrint.js +20 -17
- package/dist/utils/hooks/useScrollToPage.js +20 -17
- package/dist/utils/hooks/useSearch.js +20 -17
- package/dist/utils/hooks/useThumbnail.js +20 -18
- package/dist/utils/hooks/useVirtualReactWindow.js +20 -17
- package/package.json +1 -1
- package/dist/RPLayout-5892502c.js +0 -3494
- package/dist/SearchCloseButton-cbf182aa.js +0 -33
- package/dist/assets/RPLayout.css +0 -1
- package/dist/components/layout/toolbar/tools/defaults/LeftSidebarDefaultTools.js +0 -16
- package/dist/index-00f8683a.js +0 -1672
- package/dist/index-6b37f504.js +0 -332
- package/dist/types/components/layout/toolbar/tools/defaults/LeftSidebarDefaultTools.d.ts +0 -3
- package/dist/types/components/layout/toolbar/tools/defaults/TopbarDefaultTools.d.ts +0 -3
- /package/dist/assets/{RPDropFileZone.css → RPTheme.css} +0 -0
- /package/dist/assets/{SearchCloseButton.css → SearchTool.css} +0 -0
package/dist/index-6b37f504.js
DELETED
|
@@ -1,332 +0,0 @@
|
|
|
1
|
-
import * as s from "react";
|
|
2
|
-
import { jsx as v, Fragment as A } from "react/jsx-runtime";
|
|
3
|
-
import * as E from "react-dom";
|
|
4
|
-
function k(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
|
|
5
|
-
return function(r) {
|
|
6
|
-
if (e == null || e(r), n === !1 || !r.defaultPrevented)
|
|
7
|
-
return t == null ? void 0 : t(r);
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
function C(e, t) {
|
|
11
|
-
if (typeof e == "function")
|
|
12
|
-
return e(t);
|
|
13
|
-
e != null && (e.current = t);
|
|
14
|
-
}
|
|
15
|
-
function P(...e) {
|
|
16
|
-
return (t) => {
|
|
17
|
-
let n = !1;
|
|
18
|
-
const o = e.map((r) => {
|
|
19
|
-
const i = C(r, t);
|
|
20
|
-
return !n && typeof i == "function" && (n = !0), i;
|
|
21
|
-
});
|
|
22
|
-
if (n)
|
|
23
|
-
return () => {
|
|
24
|
-
for (let r = 0; r < o.length; r++) {
|
|
25
|
-
const i = o[r];
|
|
26
|
-
typeof i == "function" ? i() : C(e[r], null);
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
function x(...e) {
|
|
32
|
-
return s.useCallback(P(...e), e);
|
|
33
|
-
}
|
|
34
|
-
function B(e, t) {
|
|
35
|
-
const n = s.createContext(t), o = (i) => {
|
|
36
|
-
const { children: u, ...c } = i, a = s.useMemo(() => c, Object.values(c));
|
|
37
|
-
return /* @__PURE__ */ v(n.Provider, { value: a, children: u });
|
|
38
|
-
};
|
|
39
|
-
o.displayName = e + "Provider";
|
|
40
|
-
function r(i) {
|
|
41
|
-
const u = s.useContext(n);
|
|
42
|
-
if (u)
|
|
43
|
-
return u;
|
|
44
|
-
if (t !== void 0)
|
|
45
|
-
return t;
|
|
46
|
-
throw new Error(`\`${i}\` must be used within \`${e}\``);
|
|
47
|
-
}
|
|
48
|
-
return [o, r];
|
|
49
|
-
}
|
|
50
|
-
function Z(e, t = []) {
|
|
51
|
-
let n = [];
|
|
52
|
-
function o(i, u) {
|
|
53
|
-
const c = s.createContext(u), a = n.length;
|
|
54
|
-
n = [...n, u];
|
|
55
|
-
const l = (f) => {
|
|
56
|
-
var g;
|
|
57
|
-
const { scope: m, children: p, ...h } = f, S = ((g = m == null ? void 0 : m[e]) == null ? void 0 : g[a]) || c, b = s.useMemo(() => h, Object.values(h));
|
|
58
|
-
return /* @__PURE__ */ v(S.Provider, { value: b, children: p });
|
|
59
|
-
};
|
|
60
|
-
l.displayName = i + "Provider";
|
|
61
|
-
function d(f, m) {
|
|
62
|
-
var S;
|
|
63
|
-
const p = ((S = m == null ? void 0 : m[e]) == null ? void 0 : S[a]) || c, h = s.useContext(p);
|
|
64
|
-
if (h)
|
|
65
|
-
return h;
|
|
66
|
-
if (u !== void 0)
|
|
67
|
-
return u;
|
|
68
|
-
throw new Error(`\`${f}\` must be used within \`${i}\``);
|
|
69
|
-
}
|
|
70
|
-
return [l, d];
|
|
71
|
-
}
|
|
72
|
-
const r = () => {
|
|
73
|
-
const i = n.map((u) => s.createContext(u));
|
|
74
|
-
return function(c) {
|
|
75
|
-
const a = (c == null ? void 0 : c[e]) || i;
|
|
76
|
-
return s.useMemo(
|
|
77
|
-
() => ({ [`__scope${e}`]: { ...c, [e]: a } }),
|
|
78
|
-
[c, a]
|
|
79
|
-
);
|
|
80
|
-
};
|
|
81
|
-
};
|
|
82
|
-
return r.scopeName = e, [o, R(r, ...t)];
|
|
83
|
-
}
|
|
84
|
-
function R(...e) {
|
|
85
|
-
const t = e[0];
|
|
86
|
-
if (e.length === 1)
|
|
87
|
-
return t;
|
|
88
|
-
const n = () => {
|
|
89
|
-
const o = e.map((r) => ({
|
|
90
|
-
useScope: r(),
|
|
91
|
-
scopeName: r.scopeName
|
|
92
|
-
}));
|
|
93
|
-
return function(i) {
|
|
94
|
-
const u = o.reduce((c, { useScope: a, scopeName: l }) => {
|
|
95
|
-
const f = a(i)[`__scope${l}`];
|
|
96
|
-
return { ...c, ...f };
|
|
97
|
-
}, {});
|
|
98
|
-
return s.useMemo(() => ({ [`__scope${t.scopeName}`]: u }), [u]);
|
|
99
|
-
};
|
|
100
|
-
};
|
|
101
|
-
return n.scopeName = t.scopeName, n;
|
|
102
|
-
}
|
|
103
|
-
// @__NO_SIDE_EFFECTS__
|
|
104
|
-
function O(e) {
|
|
105
|
-
const t = /* @__PURE__ */ M(e), n = s.forwardRef((o, r) => {
|
|
106
|
-
const { children: i, ...u } = o, c = s.Children.toArray(i), a = c.find(I);
|
|
107
|
-
if (a) {
|
|
108
|
-
const l = a.props.children, d = c.map((f) => f === a ? s.Children.count(l) > 1 ? s.Children.only(null) : s.isValidElement(l) ? l.props.children : null : f);
|
|
109
|
-
return /* @__PURE__ */ v(t, { ...u, ref: r, children: s.isValidElement(l) ? s.cloneElement(l, void 0, d) : null });
|
|
110
|
-
}
|
|
111
|
-
return /* @__PURE__ */ v(t, { ...u, ref: r, children: i });
|
|
112
|
-
});
|
|
113
|
-
return n.displayName = `${e}.Slot`, n;
|
|
114
|
-
}
|
|
115
|
-
// @__NO_SIDE_EFFECTS__
|
|
116
|
-
function M(e) {
|
|
117
|
-
const t = s.forwardRef((n, o) => {
|
|
118
|
-
const { children: r, ...i } = n;
|
|
119
|
-
if (s.isValidElement(r)) {
|
|
120
|
-
const u = _(r), c = T(i, r.props);
|
|
121
|
-
return r.type !== s.Fragment && (c.ref = o ? P(o, u) : u), s.cloneElement(r, c);
|
|
122
|
-
}
|
|
123
|
-
return s.Children.count(r) > 1 ? s.Children.only(null) : null;
|
|
124
|
-
});
|
|
125
|
-
return t.displayName = `${e}.SlotClone`, t;
|
|
126
|
-
}
|
|
127
|
-
var w = Symbol("radix.slottable");
|
|
128
|
-
// @__NO_SIDE_EFFECTS__
|
|
129
|
-
function q(e) {
|
|
130
|
-
const t = ({ children: n }) => /* @__PURE__ */ v(A, { children: n });
|
|
131
|
-
return t.displayName = `${e}.Slottable`, t.__radixId = w, t;
|
|
132
|
-
}
|
|
133
|
-
function I(e) {
|
|
134
|
-
return s.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === w;
|
|
135
|
-
}
|
|
136
|
-
function T(e, t) {
|
|
137
|
-
const n = { ...t };
|
|
138
|
-
for (const o in t) {
|
|
139
|
-
const r = e[o], i = t[o];
|
|
140
|
-
/^on[A-Z]/.test(o) ? r && i ? n[o] = (...c) => {
|
|
141
|
-
const a = i(...c);
|
|
142
|
-
return r(...c), a;
|
|
143
|
-
} : r && (n[o] = r) : o === "style" ? n[o] = { ...r, ...i } : o === "className" && (n[o] = [r, i].filter(Boolean).join(" "));
|
|
144
|
-
}
|
|
145
|
-
return { ...e, ...n };
|
|
146
|
-
}
|
|
147
|
-
function _(e) {
|
|
148
|
-
var o, r;
|
|
149
|
-
let t = (o = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : o.get, n = t && "isReactWarning" in t && t.isReactWarning;
|
|
150
|
-
return n ? e.ref : (t = (r = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : r.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
|
|
151
|
-
}
|
|
152
|
-
var $ = [
|
|
153
|
-
"a",
|
|
154
|
-
"button",
|
|
155
|
-
"div",
|
|
156
|
-
"form",
|
|
157
|
-
"h2",
|
|
158
|
-
"h3",
|
|
159
|
-
"img",
|
|
160
|
-
"input",
|
|
161
|
-
"label",
|
|
162
|
-
"li",
|
|
163
|
-
"nav",
|
|
164
|
-
"ol",
|
|
165
|
-
"p",
|
|
166
|
-
"select",
|
|
167
|
-
"span",
|
|
168
|
-
"svg",
|
|
169
|
-
"ul"
|
|
170
|
-
], G = $.reduce((e, t) => {
|
|
171
|
-
const n = /* @__PURE__ */ O(`Primitive.${t}`), o = s.forwardRef((r, i) => {
|
|
172
|
-
const { asChild: u, ...c } = r, a = u ? n : t;
|
|
173
|
-
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ v(a, { ...c, ref: i });
|
|
174
|
-
});
|
|
175
|
-
return o.displayName = `Primitive.${t}`, { ...e, [t]: o };
|
|
176
|
-
}, {});
|
|
177
|
-
function J(e, t) {
|
|
178
|
-
e && E.flushSync(() => e.dispatchEvent(t));
|
|
179
|
-
}
|
|
180
|
-
var N = globalThis != null && globalThis.document ? s.useLayoutEffect : () => {
|
|
181
|
-
};
|
|
182
|
-
function K(e) {
|
|
183
|
-
const [t, n] = s.useState(void 0);
|
|
184
|
-
return N(() => {
|
|
185
|
-
if (e) {
|
|
186
|
-
n({ width: e.offsetWidth, height: e.offsetHeight });
|
|
187
|
-
const o = new ResizeObserver((r) => {
|
|
188
|
-
if (!Array.isArray(r) || !r.length)
|
|
189
|
-
return;
|
|
190
|
-
const i = r[0];
|
|
191
|
-
let u, c;
|
|
192
|
-
if ("borderBoxSize" in i) {
|
|
193
|
-
const a = i.borderBoxSize, l = Array.isArray(a) ? a[0] : a;
|
|
194
|
-
u = l.inlineSize, c = l.blockSize;
|
|
195
|
-
} else
|
|
196
|
-
u = e.offsetWidth, c = e.offsetHeight;
|
|
197
|
-
n({ width: u, height: c });
|
|
198
|
-
});
|
|
199
|
-
return o.observe(e, { box: "border-box" }), () => o.unobserve(e);
|
|
200
|
-
} else
|
|
201
|
-
n(void 0);
|
|
202
|
-
}, [e]), t;
|
|
203
|
-
}
|
|
204
|
-
function D(e, t) {
|
|
205
|
-
return s.useReducer((n, o) => t[n][o] ?? n, e);
|
|
206
|
-
}
|
|
207
|
-
var U = (e) => {
|
|
208
|
-
const { present: t, children: n } = e, o = W(t), r = typeof n == "function" ? n({ present: o.isPresent }) : s.Children.only(n), i = x(o.ref, z(r));
|
|
209
|
-
return typeof n == "function" || o.isPresent ? s.cloneElement(r, { ref: i }) : null;
|
|
210
|
-
};
|
|
211
|
-
U.displayName = "Presence";
|
|
212
|
-
function W(e) {
|
|
213
|
-
const [t, n] = s.useState(), o = s.useRef(null), r = s.useRef(e), i = s.useRef("none"), u = e ? "mounted" : "unmounted", [c, a] = D(u, {
|
|
214
|
-
mounted: {
|
|
215
|
-
UNMOUNT: "unmounted",
|
|
216
|
-
ANIMATION_OUT: "unmountSuspended"
|
|
217
|
-
},
|
|
218
|
-
unmountSuspended: {
|
|
219
|
-
MOUNT: "mounted",
|
|
220
|
-
ANIMATION_END: "unmounted"
|
|
221
|
-
},
|
|
222
|
-
unmounted: {
|
|
223
|
-
MOUNT: "mounted"
|
|
224
|
-
}
|
|
225
|
-
});
|
|
226
|
-
return s.useEffect(() => {
|
|
227
|
-
const l = y(o.current);
|
|
228
|
-
i.current = c === "mounted" ? l : "none";
|
|
229
|
-
}, [c]), N(() => {
|
|
230
|
-
const l = o.current, d = r.current;
|
|
231
|
-
if (d !== e) {
|
|
232
|
-
const m = i.current, p = y(l);
|
|
233
|
-
e ? a("MOUNT") : p === "none" || (l == null ? void 0 : l.display) === "none" ? a("UNMOUNT") : a(d && m !== p ? "ANIMATION_OUT" : "UNMOUNT"), r.current = e;
|
|
234
|
-
}
|
|
235
|
-
}, [e, a]), N(() => {
|
|
236
|
-
if (t) {
|
|
237
|
-
let l;
|
|
238
|
-
const d = t.ownerDocument.defaultView ?? window, f = (p) => {
|
|
239
|
-
const S = y(o.current).includes(p.animationName);
|
|
240
|
-
if (p.target === t && S && (a("ANIMATION_END"), !r.current)) {
|
|
241
|
-
const b = t.style.animationFillMode;
|
|
242
|
-
t.style.animationFillMode = "forwards", l = d.setTimeout(() => {
|
|
243
|
-
t.style.animationFillMode === "forwards" && (t.style.animationFillMode = b);
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
}, m = (p) => {
|
|
247
|
-
p.target === t && (i.current = y(o.current));
|
|
248
|
-
};
|
|
249
|
-
return t.addEventListener("animationstart", m), t.addEventListener("animationcancel", f), t.addEventListener("animationend", f), () => {
|
|
250
|
-
d.clearTimeout(l), t.removeEventListener("animationstart", m), t.removeEventListener("animationcancel", f), t.removeEventListener("animationend", f);
|
|
251
|
-
};
|
|
252
|
-
} else
|
|
253
|
-
a("ANIMATION_END");
|
|
254
|
-
}, [t, a]), {
|
|
255
|
-
isPresent: ["mounted", "unmountSuspended"].includes(c),
|
|
256
|
-
ref: s.useCallback((l) => {
|
|
257
|
-
o.current = l ? getComputedStyle(l) : null, n(l);
|
|
258
|
-
}, [])
|
|
259
|
-
};
|
|
260
|
-
}
|
|
261
|
-
function y(e) {
|
|
262
|
-
return (e == null ? void 0 : e.animationName) || "none";
|
|
263
|
-
}
|
|
264
|
-
function z(e) {
|
|
265
|
-
var o, r;
|
|
266
|
-
let t = (o = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : o.get, n = t && "isReactWarning" in t && t.isReactWarning;
|
|
267
|
-
return n ? e.ref : (t = (r = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : r.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
|
|
268
|
-
}
|
|
269
|
-
var L = s[" useInsertionEffect ".trim().toString()] || N;
|
|
270
|
-
function Q({
|
|
271
|
-
prop: e,
|
|
272
|
-
defaultProp: t,
|
|
273
|
-
onChange: n = () => {
|
|
274
|
-
},
|
|
275
|
-
caller: o
|
|
276
|
-
}) {
|
|
277
|
-
const [r, i, u] = j({
|
|
278
|
-
defaultProp: t,
|
|
279
|
-
onChange: n
|
|
280
|
-
}), c = e !== void 0, a = c ? e : r;
|
|
281
|
-
{
|
|
282
|
-
const d = s.useRef(e !== void 0);
|
|
283
|
-
s.useEffect(() => {
|
|
284
|
-
const f = d.current;
|
|
285
|
-
f !== c && console.warn(
|
|
286
|
-
`${o} is changing from ${f ? "controlled" : "uncontrolled"} to ${c ? "controlled" : "uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
|
|
287
|
-
), d.current = c;
|
|
288
|
-
}, [c, o]);
|
|
289
|
-
}
|
|
290
|
-
const l = s.useCallback(
|
|
291
|
-
(d) => {
|
|
292
|
-
var f;
|
|
293
|
-
if (c) {
|
|
294
|
-
const m = F(d) ? d(e) : d;
|
|
295
|
-
m !== e && ((f = u.current) == null || f.call(u, m));
|
|
296
|
-
} else
|
|
297
|
-
i(d);
|
|
298
|
-
},
|
|
299
|
-
[c, e, i, u]
|
|
300
|
-
);
|
|
301
|
-
return [a, l];
|
|
302
|
-
}
|
|
303
|
-
function j({
|
|
304
|
-
defaultProp: e,
|
|
305
|
-
onChange: t
|
|
306
|
-
}) {
|
|
307
|
-
const [n, o] = s.useState(e), r = s.useRef(n), i = s.useRef(t);
|
|
308
|
-
return L(() => {
|
|
309
|
-
i.current = t;
|
|
310
|
-
}, [t]), s.useEffect(() => {
|
|
311
|
-
var u;
|
|
312
|
-
r.current !== n && ((u = i.current) == null || u.call(i, n), r.current = n);
|
|
313
|
-
}, [n, r]), [n, o, i];
|
|
314
|
-
}
|
|
315
|
-
function F(e) {
|
|
316
|
-
return typeof e == "function";
|
|
317
|
-
}
|
|
318
|
-
export {
|
|
319
|
-
G as P,
|
|
320
|
-
k as a,
|
|
321
|
-
U as b,
|
|
322
|
-
Z as c,
|
|
323
|
-
K as d,
|
|
324
|
-
Q as e,
|
|
325
|
-
q as f,
|
|
326
|
-
J as g,
|
|
327
|
-
N as h,
|
|
328
|
-
O as i,
|
|
329
|
-
P as j,
|
|
330
|
-
B as k,
|
|
331
|
-
x as u
|
|
332
|
-
};
|
|
File without changes
|
|
File without changes
|