react-proportion-slider 0.9.3 → 0.9.4
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/README.md +45 -23
- package/dist/ProportionSlider.d.ts +37 -0
- package/dist/components/DynamicChildPositioner.d.ts +10 -0
- package/dist/components/HiddenSpaceTaker.d.ts +6 -0
- package/dist/components/SliderKnob.d.ts +10 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/types.d.ts +22 -0
- package/dist/index.d.ts +3 -0
- package/dist/react-proportion-slider.es.js +847 -0
- package/dist/react-proportion-slider.es.js.map +1 -0
- package/dist/react-proportion-slider.umd.js +31 -0
- package/dist/react-proportion-slider.umd.js.map +1 -0
- package/dist/utilities/getClientX.d.ts +3 -0
- package/dist/utilities/index.d.ts +3 -0
- package/dist/utilities/isTouchEvent.d.ts +1 -0
- package/dist/utilities/maths.d.ts +1 -0
- package/package.json +5 -7
@@ -0,0 +1,847 @@
|
|
1
|
+
import He, { useRef as G, useState as _r, useMemo as Be, useEffect as Je, useCallback as se } from "react";
|
2
|
+
var ue = { exports: {} }, ee = {};
|
3
|
+
/**
|
4
|
+
* @license React
|
5
|
+
* react-jsx-runtime.production.min.js
|
6
|
+
*
|
7
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
8
|
+
*
|
9
|
+
* This source code is licensed under the MIT license found in the
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
11
|
+
*/
|
12
|
+
var Ne;
|
13
|
+
function wr() {
|
14
|
+
if (Ne) return ee;
|
15
|
+
Ne = 1;
|
16
|
+
var i = He, _ = Symbol.for("react.element"), l = Symbol.for("react.fragment"), S = Object.prototype.hasOwnProperty, x = i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, O = { key: !0, ref: !0, __self: !0, __source: !0 };
|
17
|
+
function k(j, p, F) {
|
18
|
+
var f, h = {}, g = null, E = null;
|
19
|
+
F !== void 0 && (g = "" + F), p.key !== void 0 && (g = "" + p.key), p.ref !== void 0 && (E = p.ref);
|
20
|
+
for (f in p) S.call(p, f) && !O.hasOwnProperty(f) && (h[f] = p[f]);
|
21
|
+
if (j && j.defaultProps) for (f in p = j.defaultProps, p) h[f] === void 0 && (h[f] = p[f]);
|
22
|
+
return { $$typeof: _, type: j, key: g, ref: E, props: h, _owner: x.current };
|
23
|
+
}
|
24
|
+
return ee.Fragment = l, ee.jsx = k, ee.jsxs = k, ee;
|
25
|
+
}
|
26
|
+
var re = {};
|
27
|
+
/**
|
28
|
+
* @license React
|
29
|
+
* react-jsx-runtime.development.js
|
30
|
+
*
|
31
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
32
|
+
*
|
33
|
+
* This source code is licensed under the MIT license found in the
|
34
|
+
* LICENSE file in the root directory of this source tree.
|
35
|
+
*/
|
36
|
+
var Ve;
|
37
|
+
function Tr() {
|
38
|
+
return Ve || (Ve = 1, process.env.NODE_ENV !== "production" && function() {
|
39
|
+
var i = He, _ = Symbol.for("react.element"), l = Symbol.for("react.portal"), S = Symbol.for("react.fragment"), x = Symbol.for("react.strict_mode"), O = Symbol.for("react.profiler"), k = Symbol.for("react.provider"), j = Symbol.for("react.context"), p = Symbol.for("react.forward_ref"), F = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), h = Symbol.for("react.memo"), g = Symbol.for("react.lazy"), E = Symbol.for("react.offscreen"), M = Symbol.iterator, K = "@@iterator";
|
40
|
+
function A(e) {
|
41
|
+
if (e === null || typeof e != "object")
|
42
|
+
return null;
|
43
|
+
var r = M && e[M] || e[K];
|
44
|
+
return typeof r == "function" ? r : null;
|
45
|
+
}
|
46
|
+
var m = i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
47
|
+
function c(e) {
|
48
|
+
{
|
49
|
+
for (var r = arguments.length, t = new Array(r > 1 ? r - 1 : 0), n = 1; n < r; n++)
|
50
|
+
t[n - 1] = arguments[n];
|
51
|
+
D("error", e, t);
|
52
|
+
}
|
53
|
+
}
|
54
|
+
function D(e, r, t) {
|
55
|
+
{
|
56
|
+
var n = m.ReactDebugCurrentFrame, s = n.getStackAddendum();
|
57
|
+
s !== "" && (r += "%s", t = t.concat([s]));
|
58
|
+
var u = t.map(function(o) {
|
59
|
+
return String(o);
|
60
|
+
});
|
61
|
+
u.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, u);
|
62
|
+
}
|
63
|
+
}
|
64
|
+
var L = !1, y = !1, C = !1, b = !1, I = !1, B;
|
65
|
+
B = Symbol.for("react.module.reference");
|
66
|
+
function z(e) {
|
67
|
+
return !!(typeof e == "string" || typeof e == "function" || e === S || e === O || I || e === x || e === F || e === f || b || e === E || L || y || C || typeof e == "object" && e !== null && (e.$$typeof === g || e.$$typeof === h || e.$$typeof === k || e.$$typeof === j || e.$$typeof === p || // This needs to include all possible module reference object
|
68
|
+
// types supported by any Flight configuration anywhere since
|
69
|
+
// we don't know which Flight build this will end up being used
|
70
|
+
// with.
|
71
|
+
e.$$typeof === B || e.getModuleId !== void 0));
|
72
|
+
}
|
73
|
+
function N(e, r, t) {
|
74
|
+
var n = e.displayName;
|
75
|
+
if (n)
|
76
|
+
return n;
|
77
|
+
var s = r.displayName || r.name || "";
|
78
|
+
return s !== "" ? t + "(" + s + ")" : t;
|
79
|
+
}
|
80
|
+
function H(e) {
|
81
|
+
return e.displayName || "Context";
|
82
|
+
}
|
83
|
+
function W(e) {
|
84
|
+
if (e == null)
|
85
|
+
return null;
|
86
|
+
if (typeof e.tag == "number" && c("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
|
87
|
+
return e.displayName || e.name || null;
|
88
|
+
if (typeof e == "string")
|
89
|
+
return e;
|
90
|
+
switch (e) {
|
91
|
+
case S:
|
92
|
+
return "Fragment";
|
93
|
+
case l:
|
94
|
+
return "Portal";
|
95
|
+
case O:
|
96
|
+
return "Profiler";
|
97
|
+
case x:
|
98
|
+
return "StrictMode";
|
99
|
+
case F:
|
100
|
+
return "Suspense";
|
101
|
+
case f:
|
102
|
+
return "SuspenseList";
|
103
|
+
}
|
104
|
+
if (typeof e == "object")
|
105
|
+
switch (e.$$typeof) {
|
106
|
+
case j:
|
107
|
+
var r = e;
|
108
|
+
return H(r) + ".Consumer";
|
109
|
+
case k:
|
110
|
+
var t = e;
|
111
|
+
return H(t._context) + ".Provider";
|
112
|
+
case p:
|
113
|
+
return N(e, e.render, "ForwardRef");
|
114
|
+
case h:
|
115
|
+
var n = e.displayName || null;
|
116
|
+
return n !== null ? n : W(e.type) || "Memo";
|
117
|
+
case g: {
|
118
|
+
var s = e, u = s._payload, o = s._init;
|
119
|
+
try {
|
120
|
+
return W(o(u));
|
121
|
+
} catch {
|
122
|
+
return null;
|
123
|
+
}
|
124
|
+
}
|
125
|
+
}
|
126
|
+
return null;
|
127
|
+
}
|
128
|
+
var V = Object.assign, Z = 0, Ee, be, ye, Re, _e, we, Te;
|
129
|
+
function Se() {
|
130
|
+
}
|
131
|
+
Se.__reactDisabledLog = !0;
|
132
|
+
function qe() {
|
133
|
+
{
|
134
|
+
if (Z === 0) {
|
135
|
+
Ee = console.log, be = console.info, ye = console.warn, Re = console.error, _e = console.group, we = console.groupCollapsed, Te = console.groupEnd;
|
136
|
+
var e = {
|
137
|
+
configurable: !0,
|
138
|
+
enumerable: !0,
|
139
|
+
value: Se,
|
140
|
+
writable: !0
|
141
|
+
};
|
142
|
+
Object.defineProperties(console, {
|
143
|
+
info: e,
|
144
|
+
log: e,
|
145
|
+
warn: e,
|
146
|
+
error: e,
|
147
|
+
group: e,
|
148
|
+
groupCollapsed: e,
|
149
|
+
groupEnd: e
|
150
|
+
});
|
151
|
+
}
|
152
|
+
Z++;
|
153
|
+
}
|
154
|
+
}
|
155
|
+
function Xe() {
|
156
|
+
{
|
157
|
+
if (Z--, Z === 0) {
|
158
|
+
var e = {
|
159
|
+
configurable: !0,
|
160
|
+
enumerable: !0,
|
161
|
+
writable: !0
|
162
|
+
};
|
163
|
+
Object.defineProperties(console, {
|
164
|
+
log: V({}, e, {
|
165
|
+
value: Ee
|
166
|
+
}),
|
167
|
+
info: V({}, e, {
|
168
|
+
value: be
|
169
|
+
}),
|
170
|
+
warn: V({}, e, {
|
171
|
+
value: ye
|
172
|
+
}),
|
173
|
+
error: V({}, e, {
|
174
|
+
value: Re
|
175
|
+
}),
|
176
|
+
group: V({}, e, {
|
177
|
+
value: _e
|
178
|
+
}),
|
179
|
+
groupCollapsed: V({}, e, {
|
180
|
+
value: we
|
181
|
+
}),
|
182
|
+
groupEnd: V({}, e, {
|
183
|
+
value: Te
|
184
|
+
})
|
185
|
+
});
|
186
|
+
}
|
187
|
+
Z < 0 && c("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
188
|
+
}
|
189
|
+
}
|
190
|
+
var le = m.ReactCurrentDispatcher, ce;
|
191
|
+
function ne(e, r, t) {
|
192
|
+
{
|
193
|
+
if (ce === void 0)
|
194
|
+
try {
|
195
|
+
throw Error();
|
196
|
+
} catch (s) {
|
197
|
+
var n = s.stack.trim().match(/\n( *(at )?)/);
|
198
|
+
ce = n && n[1] || "";
|
199
|
+
}
|
200
|
+
return `
|
201
|
+
` + ce + e;
|
202
|
+
}
|
203
|
+
}
|
204
|
+
var fe = !1, ae;
|
205
|
+
{
|
206
|
+
var ze = typeof WeakMap == "function" ? WeakMap : Map;
|
207
|
+
ae = new ze();
|
208
|
+
}
|
209
|
+
function xe(e, r) {
|
210
|
+
if (!e || fe)
|
211
|
+
return "";
|
212
|
+
{
|
213
|
+
var t = ae.get(e);
|
214
|
+
if (t !== void 0)
|
215
|
+
return t;
|
216
|
+
}
|
217
|
+
var n;
|
218
|
+
fe = !0;
|
219
|
+
var s = Error.prepareStackTrace;
|
220
|
+
Error.prepareStackTrace = void 0;
|
221
|
+
var u;
|
222
|
+
u = le.current, le.current = null, qe();
|
223
|
+
try {
|
224
|
+
if (r) {
|
225
|
+
var o = function() {
|
226
|
+
throw Error();
|
227
|
+
};
|
228
|
+
if (Object.defineProperty(o.prototype, "props", {
|
229
|
+
set: function() {
|
230
|
+
throw Error();
|
231
|
+
}
|
232
|
+
}), typeof Reflect == "object" && Reflect.construct) {
|
233
|
+
try {
|
234
|
+
Reflect.construct(o, []);
|
235
|
+
} catch (w) {
|
236
|
+
n = w;
|
237
|
+
}
|
238
|
+
Reflect.construct(e, [], o);
|
239
|
+
} else {
|
240
|
+
try {
|
241
|
+
o.call();
|
242
|
+
} catch (w) {
|
243
|
+
n = w;
|
244
|
+
}
|
245
|
+
e.call(o.prototype);
|
246
|
+
}
|
247
|
+
} else {
|
248
|
+
try {
|
249
|
+
throw Error();
|
250
|
+
} catch (w) {
|
251
|
+
n = w;
|
252
|
+
}
|
253
|
+
e();
|
254
|
+
}
|
255
|
+
} catch (w) {
|
256
|
+
if (w && n && typeof w.stack == "string") {
|
257
|
+
for (var a = w.stack.split(`
|
258
|
+
`), R = n.stack.split(`
|
259
|
+
`), d = a.length - 1, v = R.length - 1; d >= 1 && v >= 0 && a[d] !== R[v]; )
|
260
|
+
v--;
|
261
|
+
for (; d >= 1 && v >= 0; d--, v--)
|
262
|
+
if (a[d] !== R[v]) {
|
263
|
+
if (d !== 1 || v !== 1)
|
264
|
+
do
|
265
|
+
if (d--, v--, v < 0 || a[d] !== R[v]) {
|
266
|
+
var P = `
|
267
|
+
` + a[d].replace(" at new ", " at ");
|
268
|
+
return e.displayName && P.includes("<anonymous>") && (P = P.replace("<anonymous>", e.displayName)), typeof e == "function" && ae.set(e, P), P;
|
269
|
+
}
|
270
|
+
while (d >= 1 && v >= 0);
|
271
|
+
break;
|
272
|
+
}
|
273
|
+
}
|
274
|
+
} finally {
|
275
|
+
fe = !1, le.current = u, Xe(), Error.prepareStackTrace = s;
|
276
|
+
}
|
277
|
+
var q = e ? e.displayName || e.name : "", U = q ? ne(q) : "";
|
278
|
+
return typeof e == "function" && ae.set(e, U), U;
|
279
|
+
}
|
280
|
+
function Ze(e, r, t) {
|
281
|
+
return xe(e, !1);
|
282
|
+
}
|
283
|
+
function Qe(e) {
|
284
|
+
var r = e.prototype;
|
285
|
+
return !!(r && r.isReactComponent);
|
286
|
+
}
|
287
|
+
function oe(e, r, t) {
|
288
|
+
if (e == null)
|
289
|
+
return "";
|
290
|
+
if (typeof e == "function")
|
291
|
+
return xe(e, Qe(e));
|
292
|
+
if (typeof e == "string")
|
293
|
+
return ne(e);
|
294
|
+
switch (e) {
|
295
|
+
case F:
|
296
|
+
return ne("Suspense");
|
297
|
+
case f:
|
298
|
+
return ne("SuspenseList");
|
299
|
+
}
|
300
|
+
if (typeof e == "object")
|
301
|
+
switch (e.$$typeof) {
|
302
|
+
case p:
|
303
|
+
return Ze(e.render);
|
304
|
+
case h:
|
305
|
+
return oe(e.type, r, t);
|
306
|
+
case g: {
|
307
|
+
var n = e, s = n._payload, u = n._init;
|
308
|
+
try {
|
309
|
+
return oe(u(s), r, t);
|
310
|
+
} catch {
|
311
|
+
}
|
312
|
+
}
|
313
|
+
}
|
314
|
+
return "";
|
315
|
+
}
|
316
|
+
var Q = Object.prototype.hasOwnProperty, Oe = {}, Ce = m.ReactDebugCurrentFrame;
|
317
|
+
function ie(e) {
|
318
|
+
if (e) {
|
319
|
+
var r = e._owner, t = oe(e.type, e._source, r ? r.type : null);
|
320
|
+
Ce.setExtraStackFrame(t);
|
321
|
+
} else
|
322
|
+
Ce.setExtraStackFrame(null);
|
323
|
+
}
|
324
|
+
function er(e, r, t, n, s) {
|
325
|
+
{
|
326
|
+
var u = Function.call.bind(Q);
|
327
|
+
for (var o in e)
|
328
|
+
if (u(e, o)) {
|
329
|
+
var a = void 0;
|
330
|
+
try {
|
331
|
+
if (typeof e[o] != "function") {
|
332
|
+
var R = Error((n || "React class") + ": " + t + " type `" + o + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[o] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
333
|
+
throw R.name = "Invariant Violation", R;
|
334
|
+
}
|
335
|
+
a = e[o](r, o, n, t, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
336
|
+
} catch (d) {
|
337
|
+
a = d;
|
338
|
+
}
|
339
|
+
a && !(a instanceof Error) && (ie(s), c("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", n || "React class", t, o, typeof a), ie(null)), a instanceof Error && !(a.message in Oe) && (Oe[a.message] = !0, ie(s), c("Failed %s type: %s", t, a.message), ie(null));
|
340
|
+
}
|
341
|
+
}
|
342
|
+
}
|
343
|
+
var rr = Array.isArray;
|
344
|
+
function de(e) {
|
345
|
+
return rr(e);
|
346
|
+
}
|
347
|
+
function tr(e) {
|
348
|
+
{
|
349
|
+
var r = typeof Symbol == "function" && Symbol.toStringTag, t = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
350
|
+
return t;
|
351
|
+
}
|
352
|
+
}
|
353
|
+
function nr(e) {
|
354
|
+
try {
|
355
|
+
return Pe(e), !1;
|
356
|
+
} catch {
|
357
|
+
return !0;
|
358
|
+
}
|
359
|
+
}
|
360
|
+
function Pe(e) {
|
361
|
+
return "" + e;
|
362
|
+
}
|
363
|
+
function je(e) {
|
364
|
+
if (nr(e))
|
365
|
+
return c("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", tr(e)), Pe(e);
|
366
|
+
}
|
367
|
+
var ke = m.ReactCurrentOwner, ar = {
|
368
|
+
key: !0,
|
369
|
+
ref: !0,
|
370
|
+
__self: !0,
|
371
|
+
__source: !0
|
372
|
+
}, Fe, De;
|
373
|
+
function or(e) {
|
374
|
+
if (Q.call(e, "ref")) {
|
375
|
+
var r = Object.getOwnPropertyDescriptor(e, "ref").get;
|
376
|
+
if (r && r.isReactWarning)
|
377
|
+
return !1;
|
378
|
+
}
|
379
|
+
return e.ref !== void 0;
|
380
|
+
}
|
381
|
+
function ir(e) {
|
382
|
+
if (Q.call(e, "key")) {
|
383
|
+
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
384
|
+
if (r && r.isReactWarning)
|
385
|
+
return !1;
|
386
|
+
}
|
387
|
+
return e.key !== void 0;
|
388
|
+
}
|
389
|
+
function sr(e, r) {
|
390
|
+
typeof e.ref == "string" && ke.current;
|
391
|
+
}
|
392
|
+
function ur(e, r) {
|
393
|
+
{
|
394
|
+
var t = function() {
|
395
|
+
Fe || (Fe = !0, c("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
|
396
|
+
};
|
397
|
+
t.isReactWarning = !0, Object.defineProperty(e, "key", {
|
398
|
+
get: t,
|
399
|
+
configurable: !0
|
400
|
+
});
|
401
|
+
}
|
402
|
+
}
|
403
|
+
function lr(e, r) {
|
404
|
+
{
|
405
|
+
var t = function() {
|
406
|
+
De || (De = !0, c("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
|
407
|
+
};
|
408
|
+
t.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
409
|
+
get: t,
|
410
|
+
configurable: !0
|
411
|
+
});
|
412
|
+
}
|
413
|
+
}
|
414
|
+
var cr = function(e, r, t, n, s, u, o) {
|
415
|
+
var a = {
|
416
|
+
// This tag allows us to uniquely identify this as a React Element
|
417
|
+
$$typeof: _,
|
418
|
+
// Built-in properties that belong on the element
|
419
|
+
type: e,
|
420
|
+
key: r,
|
421
|
+
ref: t,
|
422
|
+
props: o,
|
423
|
+
// Record the component responsible for creating this element.
|
424
|
+
_owner: u
|
425
|
+
};
|
426
|
+
return a._store = {}, Object.defineProperty(a._store, "validated", {
|
427
|
+
configurable: !1,
|
428
|
+
enumerable: !1,
|
429
|
+
writable: !0,
|
430
|
+
value: !1
|
431
|
+
}), Object.defineProperty(a, "_self", {
|
432
|
+
configurable: !1,
|
433
|
+
enumerable: !1,
|
434
|
+
writable: !1,
|
435
|
+
value: n
|
436
|
+
}), Object.defineProperty(a, "_source", {
|
437
|
+
configurable: !1,
|
438
|
+
enumerable: !1,
|
439
|
+
writable: !1,
|
440
|
+
value: s
|
441
|
+
}), Object.freeze && (Object.freeze(a.props), Object.freeze(a)), a;
|
442
|
+
};
|
443
|
+
function fr(e, r, t, n, s) {
|
444
|
+
{
|
445
|
+
var u, o = {}, a = null, R = null;
|
446
|
+
t !== void 0 && (je(t), a = "" + t), ir(r) && (je(r.key), a = "" + r.key), or(r) && (R = r.ref, sr(r, s));
|
447
|
+
for (u in r)
|
448
|
+
Q.call(r, u) && !ar.hasOwnProperty(u) && (o[u] = r[u]);
|
449
|
+
if (e && e.defaultProps) {
|
450
|
+
var d = e.defaultProps;
|
451
|
+
for (u in d)
|
452
|
+
o[u] === void 0 && (o[u] = d[u]);
|
453
|
+
}
|
454
|
+
if (a || R) {
|
455
|
+
var v = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
456
|
+
a && ur(o, v), R && lr(o, v);
|
457
|
+
}
|
458
|
+
return cr(e, a, R, s, n, ke.current, o);
|
459
|
+
}
|
460
|
+
}
|
461
|
+
var ve = m.ReactCurrentOwner, Le = m.ReactDebugCurrentFrame;
|
462
|
+
function J(e) {
|
463
|
+
if (e) {
|
464
|
+
var r = e._owner, t = oe(e.type, e._source, r ? r.type : null);
|
465
|
+
Le.setExtraStackFrame(t);
|
466
|
+
} else
|
467
|
+
Le.setExtraStackFrame(null);
|
468
|
+
}
|
469
|
+
var pe;
|
470
|
+
pe = !1;
|
471
|
+
function he(e) {
|
472
|
+
return typeof e == "object" && e !== null && e.$$typeof === _;
|
473
|
+
}
|
474
|
+
function Ie() {
|
475
|
+
{
|
476
|
+
if (ve.current) {
|
477
|
+
var e = W(ve.current.type);
|
478
|
+
if (e)
|
479
|
+
return `
|
480
|
+
|
481
|
+
Check the render method of \`` + e + "`.";
|
482
|
+
}
|
483
|
+
return "";
|
484
|
+
}
|
485
|
+
}
|
486
|
+
function dr(e) {
|
487
|
+
return "";
|
488
|
+
}
|
489
|
+
var Ae = {};
|
490
|
+
function vr(e) {
|
491
|
+
{
|
492
|
+
var r = Ie();
|
493
|
+
if (!r) {
|
494
|
+
var t = typeof e == "string" ? e : e.displayName || e.name;
|
495
|
+
t && (r = `
|
496
|
+
|
497
|
+
Check the top-level render call using <` + t + ">.");
|
498
|
+
}
|
499
|
+
return r;
|
500
|
+
}
|
501
|
+
}
|
502
|
+
function We(e, r) {
|
503
|
+
{
|
504
|
+
if (!e._store || e._store.validated || e.key != null)
|
505
|
+
return;
|
506
|
+
e._store.validated = !0;
|
507
|
+
var t = vr(r);
|
508
|
+
if (Ae[t])
|
509
|
+
return;
|
510
|
+
Ae[t] = !0;
|
511
|
+
var n = "";
|
512
|
+
e && e._owner && e._owner !== ve.current && (n = " It was passed a child from " + W(e._owner.type) + "."), J(e), c('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', t, n), J(null);
|
513
|
+
}
|
514
|
+
}
|
515
|
+
function $e(e, r) {
|
516
|
+
{
|
517
|
+
if (typeof e != "object")
|
518
|
+
return;
|
519
|
+
if (de(e))
|
520
|
+
for (var t = 0; t < e.length; t++) {
|
521
|
+
var n = e[t];
|
522
|
+
he(n) && We(n, r);
|
523
|
+
}
|
524
|
+
else if (he(e))
|
525
|
+
e._store && (e._store.validated = !0);
|
526
|
+
else if (e) {
|
527
|
+
var s = A(e);
|
528
|
+
if (typeof s == "function" && s !== e.entries)
|
529
|
+
for (var u = s.call(e), o; !(o = u.next()).done; )
|
530
|
+
he(o.value) && We(o.value, r);
|
531
|
+
}
|
532
|
+
}
|
533
|
+
}
|
534
|
+
function pr(e) {
|
535
|
+
{
|
536
|
+
var r = e.type;
|
537
|
+
if (r == null || typeof r == "string")
|
538
|
+
return;
|
539
|
+
var t;
|
540
|
+
if (typeof r == "function")
|
541
|
+
t = r.propTypes;
|
542
|
+
else if (typeof r == "object" && (r.$$typeof === p || // Note: Memo only checks outer props here.
|
543
|
+
// Inner props are checked in the reconciler.
|
544
|
+
r.$$typeof === h))
|
545
|
+
t = r.propTypes;
|
546
|
+
else
|
547
|
+
return;
|
548
|
+
if (t) {
|
549
|
+
var n = W(r);
|
550
|
+
er(t, e.props, "prop", n, e);
|
551
|
+
} else if (r.PropTypes !== void 0 && !pe) {
|
552
|
+
pe = !0;
|
553
|
+
var s = W(r);
|
554
|
+
c("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", s || "Unknown");
|
555
|
+
}
|
556
|
+
typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && c("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
557
|
+
}
|
558
|
+
}
|
559
|
+
function hr(e) {
|
560
|
+
{
|
561
|
+
for (var r = Object.keys(e.props), t = 0; t < r.length; t++) {
|
562
|
+
var n = r[t];
|
563
|
+
if (n !== "children" && n !== "key") {
|
564
|
+
J(e), c("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", n), J(null);
|
565
|
+
break;
|
566
|
+
}
|
567
|
+
}
|
568
|
+
e.ref !== null && (J(e), c("Invalid attribute `ref` supplied to `React.Fragment`."), J(null));
|
569
|
+
}
|
570
|
+
}
|
571
|
+
var Ye = {};
|
572
|
+
function Me(e, r, t, n, s, u) {
|
573
|
+
{
|
574
|
+
var o = z(e);
|
575
|
+
if (!o) {
|
576
|
+
var a = "";
|
577
|
+
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (a += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
578
|
+
var R = dr();
|
579
|
+
R ? a += R : a += Ie();
|
580
|
+
var d;
|
581
|
+
e === null ? d = "null" : de(e) ? d = "array" : e !== void 0 && e.$$typeof === _ ? (d = "<" + (W(e.type) || "Unknown") + " />", a = " Did you accidentally export a JSX literal instead of a component?") : d = typeof e, c("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", d, a);
|
582
|
+
}
|
583
|
+
var v = fr(e, r, t, s, u);
|
584
|
+
if (v == null)
|
585
|
+
return v;
|
586
|
+
if (o) {
|
587
|
+
var P = r.children;
|
588
|
+
if (P !== void 0)
|
589
|
+
if (n)
|
590
|
+
if (de(P)) {
|
591
|
+
for (var q = 0; q < P.length; q++)
|
592
|
+
$e(P[q], e);
|
593
|
+
Object.freeze && Object.freeze(P);
|
594
|
+
} else
|
595
|
+
c("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
596
|
+
else
|
597
|
+
$e(P, e);
|
598
|
+
}
|
599
|
+
if (Q.call(r, "key")) {
|
600
|
+
var U = W(e), w = Object.keys(r).filter(function(Rr) {
|
601
|
+
return Rr !== "key";
|
602
|
+
}), ge = w.length > 0 ? "{key: someKey, " + w.join(": ..., ") + ": ...}" : "{key: someKey}";
|
603
|
+
if (!Ye[U + ge]) {
|
604
|
+
var yr = w.length > 0 ? "{" + w.join(": ..., ") + ": ...}" : "{}";
|
605
|
+
c(`A props object containing a "key" prop is being spread into JSX:
|
606
|
+
let props = %s;
|
607
|
+
<%s {...props} />
|
608
|
+
React keys must be passed directly to JSX without using spread:
|
609
|
+
let props = %s;
|
610
|
+
<%s key={someKey} {...props} />`, ge, U, yr, U), Ye[U + ge] = !0;
|
611
|
+
}
|
612
|
+
}
|
613
|
+
return e === S ? hr(v) : pr(v), v;
|
614
|
+
}
|
615
|
+
}
|
616
|
+
function gr(e, r, t) {
|
617
|
+
return Me(e, r, t, !0);
|
618
|
+
}
|
619
|
+
function mr(e, r, t) {
|
620
|
+
return Me(e, r, t, !1);
|
621
|
+
}
|
622
|
+
var Er = mr, br = gr;
|
623
|
+
re.Fragment = S, re.jsx = Er, re.jsxs = br;
|
624
|
+
}()), re;
|
625
|
+
}
|
626
|
+
var Ue;
|
627
|
+
function Sr() {
|
628
|
+
return Ue || (Ue = 1, process.env.NODE_ENV === "production" ? ue.exports = wr() : ue.exports = Tr()), ue.exports;
|
629
|
+
}
|
630
|
+
var T = Sr();
|
631
|
+
const Ge = ({ children: i }) => /* @__PURE__ */ T.jsx("span", { "aria-hidden": "true", style: { visibility: "hidden" }, children: i }), Ke = ({
|
632
|
+
detail: i,
|
633
|
+
valueLabel: _,
|
634
|
+
primaryNode: l,
|
635
|
+
width: S,
|
636
|
+
ariaLabel: x
|
637
|
+
}) => {
|
638
|
+
const O = /* @__PURE__ */ T.jsx("div", { style: me, children: i.label }), k = /* @__PURE__ */ T.jsx("div", { style: me, children: _ }), j = /* @__PURE__ */ T.jsx("div", { style: me, children: "100%" }), p = l === "right" ? O : k, F = l === "left" ? O : k, f = G(null), h = G(null), g = G(null), [E, M] = _r(
|
639
|
+
"both"
|
640
|
+
), K = Be(() => {
|
641
|
+
const m = E === "none" || E === "primary" && l === "left";
|
642
|
+
return l === "right" ? m ? $.BOTTOM_RIGHT : $.RIGHT : m ? $.TOP_LEFT : $.RIGHT;
|
643
|
+
}, [E, l]), A = Be(() => {
|
644
|
+
const m = E === "none" || E === "primary" && l === "right";
|
645
|
+
return l === "left" ? m ? $.BOTTOM_LEFT : $.LEFT : m ? $.TOP_RIGHT : $.LEFT;
|
646
|
+
}, [E, l]);
|
647
|
+
return Je(() => {
|
648
|
+
const m = setInterval(() => {
|
649
|
+
const c = h.current, D = g.current, L = f.current;
|
650
|
+
if (!L || !c || !D)
|
651
|
+
return;
|
652
|
+
const y = L.getBoundingClientRect().width, C = c.getBoundingClientRect().width, b = D.getBoundingClientRect().width, { primaryWidth: I, secondaryWidth: B } = l === "left" ? { primaryWidth: b, secondaryWidth: C } : { primaryWidth: C, secondaryWidth: b }, z = I + 2 * Y <= y, N = B + I + 3 * Y <= y;
|
653
|
+
M(z ? N ? "both" : "primary" : "none");
|
654
|
+
}, 33.333333333333336);
|
655
|
+
return () => clearInterval(m);
|
656
|
+
}, [f, h, g, l]), /* @__PURE__ */ T.jsxs(
|
657
|
+
"div",
|
658
|
+
{
|
659
|
+
ref: f,
|
660
|
+
"aria-label": x,
|
661
|
+
style: {
|
662
|
+
position: "relative",
|
663
|
+
width: S,
|
664
|
+
backgroundColor: i.backgroundColor,
|
665
|
+
borderRadius: "5px",
|
666
|
+
color: "white"
|
667
|
+
},
|
668
|
+
children: [
|
669
|
+
/* @__PURE__ */ T.jsx("div", { ref: g, style: A, children: F }),
|
670
|
+
/* @__PURE__ */ T.jsx("div", { ref: h, style: K, children: p }),
|
671
|
+
/* @__PURE__ */ T.jsx(Ge, { children: j }),
|
672
|
+
/* @__PURE__ */ T.jsx(Ge, { children: O })
|
673
|
+
]
|
674
|
+
}
|
675
|
+
);
|
676
|
+
}, Y = 5, X = {
|
677
|
+
position: "absolute",
|
678
|
+
transition: "all 200ms cubic-bezier(.47,1.64,.41,.8)",
|
679
|
+
transitionProperty: "transform, top, left, bottom, right"
|
680
|
+
}, $ = {
|
681
|
+
TOP_LEFT: {
|
682
|
+
...X,
|
683
|
+
left: Y,
|
684
|
+
top: -5,
|
685
|
+
transform: "translateY(-100%)"
|
686
|
+
},
|
687
|
+
LEFT: {
|
688
|
+
...X,
|
689
|
+
left: Y,
|
690
|
+
top: "50%",
|
691
|
+
transform: "translateY(-50%)"
|
692
|
+
},
|
693
|
+
BOTTOM_LEFT: {
|
694
|
+
...X,
|
695
|
+
left: Y,
|
696
|
+
bottom: -5,
|
697
|
+
transform: "translateY(100%)"
|
698
|
+
},
|
699
|
+
TOP_RIGHT: {
|
700
|
+
...X,
|
701
|
+
right: Y,
|
702
|
+
top: -5,
|
703
|
+
transform: "translateY(-100%)"
|
704
|
+
},
|
705
|
+
RIGHT: {
|
706
|
+
...X,
|
707
|
+
right: Y,
|
708
|
+
top: "50%",
|
709
|
+
transform: "translateY(-50%)"
|
710
|
+
},
|
711
|
+
BOTTOM_RIGHT: {
|
712
|
+
...X,
|
713
|
+
right: Y,
|
714
|
+
bottom: -5,
|
715
|
+
transform: "translateY(100%)"
|
716
|
+
}
|
717
|
+
}, me = {
|
718
|
+
whiteSpace: "nowrap",
|
719
|
+
userSelect: "none"
|
720
|
+
}, xr = ({
|
721
|
+
className: i,
|
722
|
+
width: _,
|
723
|
+
gap: l,
|
724
|
+
backgroundColor: S = "red",
|
725
|
+
style: x,
|
726
|
+
disabled: O
|
727
|
+
}) => /* @__PURE__ */ T.jsx(
|
728
|
+
"div",
|
729
|
+
{
|
730
|
+
role: "button",
|
731
|
+
className: i,
|
732
|
+
style: {
|
733
|
+
alignSelf: "stretch",
|
734
|
+
borderRadius: "2px",
|
735
|
+
cursor: O ? "not-allowed" : "ew-resize",
|
736
|
+
...x,
|
737
|
+
width: `${_}px`,
|
738
|
+
margin: `${l}px ${l}px`,
|
739
|
+
background: S
|
740
|
+
}
|
741
|
+
}
|
742
|
+
);
|
743
|
+
function Or(i) {
|
744
|
+
return "touches" in i;
|
745
|
+
}
|
746
|
+
const Cr = (i) => Or(i) ? i.touches[0].clientX : i.clientX, Pr = (i, _, l) => Math.min(Math.max(i, _), l), Fr = ({
|
747
|
+
value: i,
|
748
|
+
proportions: _,
|
749
|
+
onChange: l,
|
750
|
+
knobOptions: S,
|
751
|
+
disabled: x,
|
752
|
+
height: O,
|
753
|
+
ariaLabel: k,
|
754
|
+
className: j,
|
755
|
+
style: p,
|
756
|
+
width: F
|
757
|
+
}) => {
|
758
|
+
const f = jr(S), h = G(null), g = i[0] + i[1], E = f.width + f.gap * 2, M = G(g), K = G(E);
|
759
|
+
M.current = g, K.current = E;
|
760
|
+
const A = G(!1), m = se(
|
761
|
+
(y, { width: C, left: b }) => {
|
762
|
+
const I = Cr(y), B = K.current, z = (I - b - B / 2) / (C - B), N = M.current, H = Pr(N * z, 0, N);
|
763
|
+
l == null || l([H, N - H]);
|
764
|
+
},
|
765
|
+
[l]
|
766
|
+
), c = se(
|
767
|
+
(y) => {
|
768
|
+
var I;
|
769
|
+
const C = y.target, b = (I = h.current) == null ? void 0 : I.getBoundingClientRect();
|
770
|
+
if (h.current && !h.current.contains(C) || !b || b.width === 0) {
|
771
|
+
console.log("returning because of rect width", b == null ? void 0 : b.width);
|
772
|
+
return;
|
773
|
+
}
|
774
|
+
return y.preventDefault(), A.current = !0, m(y, b), !0;
|
775
|
+
},
|
776
|
+
[m]
|
777
|
+
), D = se(
|
778
|
+
(y) => {
|
779
|
+
var b;
|
780
|
+
const C = (b = h.current) == null ? void 0 : b.getBoundingClientRect();
|
781
|
+
return !A.current || !C || C.width === 0 ? !1 : (y.preventDefault(), m(y, C), !0);
|
782
|
+
},
|
783
|
+
[m]
|
784
|
+
), L = se((y) => A.current ? (A.current = !1, y.preventDefault(), !0) : !1, []);
|
785
|
+
return Je(() => (window.addEventListener("mousedown", c), window.addEventListener("mousemove", D), window.addEventListener("mouseup", L), window.addEventListener("touchstart", c), window.addEventListener("touchmove", D), window.addEventListener("touchend", L), () => {
|
786
|
+
window.removeEventListener("mousedown", c), window.removeEventListener("mousemove", D), window.removeEventListener("mouseup", L), window.removeEventListener("touchstart", c), window.removeEventListener("touchmove", D), window.removeEventListener("touchend", L);
|
787
|
+
}), [c, D, L]), /* @__PURE__ */ T.jsxs(
|
788
|
+
"div",
|
789
|
+
{
|
790
|
+
ref: h,
|
791
|
+
role: "slider",
|
792
|
+
"aria-label": k,
|
793
|
+
"aria-valuenow": Math.round(i[0] / g * 100),
|
794
|
+
style: {
|
795
|
+
display: "flex",
|
796
|
+
flexDirection: "row",
|
797
|
+
height: O,
|
798
|
+
width: F,
|
799
|
+
opacity: x ? 0.6 : 1,
|
800
|
+
cursor: x ? "not-allowed" : "pointer",
|
801
|
+
...p
|
802
|
+
},
|
803
|
+
className: j,
|
804
|
+
children: [
|
805
|
+
/* @__PURE__ */ T.jsx(
|
806
|
+
Ke,
|
807
|
+
{
|
808
|
+
detail: _[0],
|
809
|
+
valueLabel: `${Math.round(i[0] * 100 / g)}%`,
|
810
|
+
width: `calc(${i[0] * 100 / g}% - ${E / 2}px)`,
|
811
|
+
primaryNode: "left"
|
812
|
+
}
|
813
|
+
),
|
814
|
+
/* @__PURE__ */ T.jsx(xr, { disabled: x, ...f }),
|
815
|
+
/* @__PURE__ */ T.jsx(
|
816
|
+
Ke,
|
817
|
+
{
|
818
|
+
detail: _[1],
|
819
|
+
valueLabel: `${Math.round(i[1] * 100 / g)}%`,
|
820
|
+
width: `calc(${i[1] * 100 / g}% - ${E / 2}px)`,
|
821
|
+
primaryNode: "right"
|
822
|
+
}
|
823
|
+
)
|
824
|
+
]
|
825
|
+
}
|
826
|
+
);
|
827
|
+
}, te = {
|
828
|
+
width: 5,
|
829
|
+
gap: 2,
|
830
|
+
backgroundColor: "red",
|
831
|
+
className: "slider-knob",
|
832
|
+
style: {}
|
833
|
+
};
|
834
|
+
function jr(i = {}) {
|
835
|
+
return {
|
836
|
+
width: i.width ?? te.width,
|
837
|
+
gap: i.gap ?? te.gap,
|
838
|
+
backgroundColor: i.backgroundColor ?? te.backgroundColor,
|
839
|
+
className: i.className ?? te.className,
|
840
|
+
style: i.style ?? te.style
|
841
|
+
};
|
842
|
+
}
|
843
|
+
export {
|
844
|
+
Fr as ProportionSlider,
|
845
|
+
Fr as default
|
846
|
+
};
|
847
|
+
//# sourceMappingURL=react-proportion-slider.es.js.map
|