etudes 32.7.0 → 32.8.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/build/etudes.js +60 -29
- package/build/etudes.umd.cjs +1 -1
- package/build/primitives/TextArea.d.ts +6 -2
- package/build/primitives/TextField.d.ts +7 -3
- package/package.json +13 -13
package/build/etudes.js
CHANGED
|
@@ -6580,9 +6580,12 @@ function An({ className: e, ref: t, style: n, children: r, ItemComponent: i, ite
|
|
|
6580
6580
|
break;
|
|
6581
6581
|
default: return;
|
|
6582
6582
|
}
|
|
6583
|
-
|
|
6583
|
+
let n = x, r = t(x);
|
|
6584
|
+
A(n, r);
|
|
6584
6585
|
}, D = (e) => {
|
|
6585
|
-
C(e)
|
|
6586
|
+
if (!C(e)) return;
|
|
6587
|
+
let t = (t) => t.filter((t) => t !== e), n = x, r = t(x);
|
|
6588
|
+
A(n, r);
|
|
6586
6589
|
}, k = (e) => {
|
|
6587
6590
|
h?.(e), p !== "none" && (m ? T(e) : E(e));
|
|
6588
6591
|
}, A = (e, t) => {
|
|
@@ -6724,12 +6727,15 @@ function Fn({ ref: e, style: t, children: n, expandedSectionIndices: r, HeaderCo
|
|
|
6724
6727
|
break;
|
|
6725
6728
|
default: return;
|
|
6726
6729
|
}
|
|
6727
|
-
|
|
6730
|
+
let r = n(C);
|
|
6731
|
+
z(C, r);
|
|
6728
6732
|
}, L = (e, t) => {
|
|
6729
|
-
A(e, t)
|
|
6733
|
+
if (!A(e, t)) return;
|
|
6734
|
+
let n = ((n) => ({
|
|
6730
6735
|
...n,
|
|
6731
6736
|
[t]: (n[t] ?? []).filter((t) => t !== e)
|
|
6732
|
-
}))(C)
|
|
6737
|
+
}))(C);
|
|
6738
|
+
z(C, n);
|
|
6733
6739
|
}, R = (e, t) => {
|
|
6734
6740
|
if ((0, kn.default)(e, t)) return;
|
|
6735
6741
|
let n = e?.filter((e) => t.indexOf(e) === -1) ?? [], r = t.filter((t) => e?.indexOf(t) === -1);
|
|
@@ -7058,8 +7064,8 @@ function $n({ dragSpeed: e, index: t, itemCount: n, orientation: r, shouldTrackE
|
|
|
7058
7064
|
}
|
|
7059
7065
|
F(), d.current = 0, r.gesture = "axis", r.startTranslation = ir(c.current, n.minTranslation, n.maxTranslation, Kn), r.startAxial = i, e.setPointerCapture(t.pointerId), C(!0);
|
|
7060
7066
|
}
|
|
7061
|
-
let a = (i - r.startAxial) * n.dragSpeed;
|
|
7062
|
-
c.current = rr(
|
|
7067
|
+
let a = (i - r.startAxial) * n.dragSpeed, o = r.startTranslation + a;
|
|
7068
|
+
c.current = rr(o, n.minTranslation, n.maxTranslation, Kn), N(), Math.abs(a) >= Gn && (r.didDrag = !0), g.current.add(i);
|
|
7063
7069
|
}, r = (t) => {
|
|
7064
7070
|
if (_.current.activeId !== t.pointerId) return;
|
|
7065
7071
|
e.hasPointerCapture(t.pointerId) && e.releasePointerCapture(t.pointerId), _.current.activeId = void 0;
|
|
@@ -7231,7 +7237,9 @@ function ur({ ref: e, style: t, autoComplete: n = "one-time-code", autoFocus: r
|
|
|
7231
7237
|
e < 0 ? g.current[0]?.focus() : e >= s ? g.current[s - 1]?.focus() : g.current[e]?.focus();
|
|
7232
7238
|
}, b = (e) => (t) => {
|
|
7233
7239
|
let n = h[e], r = mr(t.target.value, n);
|
|
7234
|
-
p(pr(h.slice(), r.split("").slice(0, s), e))
|
|
7240
|
+
p(pr(h.slice(), r.split("").slice(0, s), e));
|
|
7241
|
+
let i = Math.min(e + r.length, s - 1);
|
|
7242
|
+
y(i);
|
|
7235
7243
|
}, x = (e) => (t) => {
|
|
7236
7244
|
switch (t.key) {
|
|
7237
7245
|
case "ArrowLeft":
|
|
@@ -7251,7 +7259,9 @@ function ur({ ref: e, style: t, autoComplete: n = "one-time-code", autoFocus: r
|
|
|
7251
7259
|
}, S = (e) => (t) => {
|
|
7252
7260
|
t.preventDefault();
|
|
7253
7261
|
let n = t.clipboardData.getData("text").trim();
|
|
7254
|
-
p(pr(h.slice(), n.split("").slice(0, s), e))
|
|
7262
|
+
p(pr(h.slice(), n.split("").slice(0, s), e));
|
|
7263
|
+
let r = Math.min(e + n.length, s - 1);
|
|
7264
|
+
y(r);
|
|
7255
7265
|
};
|
|
7256
7266
|
return l(() => {
|
|
7257
7267
|
if (!r) return;
|
|
@@ -7321,26 +7331,35 @@ function mr(e, t) {
|
|
|
7321
7331
|
process.env.NODE_ENV === "development" && (ur.displayName = "CodeInput", ur.Field.displayName = "CodeInput.Field");
|
|
7322
7332
|
//#endregion
|
|
7323
7333
|
//#region src/primitives/TextField.tsx
|
|
7324
|
-
function hr({ className: e, ref: t,
|
|
7325
|
-
let
|
|
7326
|
-
let t = (
|
|
7327
|
-
|
|
7328
|
-
}, [
|
|
7329
|
-
return
|
|
7330
|
-
|
|
7334
|
+
function hr({ className: e, ref: t, autoFocus: n = !1, emptyValue: r = "", placeholder: i, type: a = "text", value: o, isDisabled: s = !1, isRequired: u = !1, formatValue: d, onChange: p, onFocus: m, onUnfocus: h, ...g }) {
|
|
7335
|
+
let _ = t ?? f(null), v = c((e) => {
|
|
7336
|
+
let t = (d?.(e) ?? e) || r;
|
|
7337
|
+
p?.(t);
|
|
7338
|
+
}, [p, d]);
|
|
7339
|
+
return l(() => {
|
|
7340
|
+
if (!n) return;
|
|
7341
|
+
let e = _.current;
|
|
7342
|
+
if (!e) return;
|
|
7343
|
+
let t = setTimeout(() => {
|
|
7344
|
+
let t = e.value.length;
|
|
7345
|
+
e.focus({ preventScroll: !0 }), e.setSelectionRange(t, t);
|
|
7346
|
+
}, 0);
|
|
7347
|
+
return () => clearTimeout(t);
|
|
7348
|
+
}, [n]), /* @__PURE__ */ (0, O.jsx)("input", {
|
|
7349
|
+
...g,
|
|
7331
7350
|
...s ? { "aria-disabled": !0 } : {},
|
|
7332
7351
|
className: w(e, { disabled: s }),
|
|
7333
|
-
ref:
|
|
7352
|
+
ref: _,
|
|
7334
7353
|
"aria-placeholder": i,
|
|
7335
|
-
"aria-required":
|
|
7354
|
+
"aria-required": u,
|
|
7336
7355
|
disabled: s,
|
|
7337
7356
|
placeholder: i,
|
|
7338
|
-
required:
|
|
7357
|
+
required: u,
|
|
7339
7358
|
type: a,
|
|
7340
|
-
value: o ||
|
|
7341
|
-
onBlur: ({ target: e }) =>
|
|
7342
|
-
onChange: ({ target: e }) =>
|
|
7343
|
-
onFocus: ({ target: e }) =>
|
|
7359
|
+
value: o || r,
|
|
7360
|
+
onBlur: ({ target: e }) => h?.(e.value),
|
|
7361
|
+
onChange: ({ target: e }) => v(e.value),
|
|
7362
|
+
onFocus: ({ target: e }) => m?.(e.value)
|
|
7344
7363
|
});
|
|
7345
7364
|
}
|
|
7346
7365
|
process.env.NODE_ENV === "development" && (hr.displayName = "TextField");
|
|
@@ -7364,7 +7383,9 @@ function gr({ ref: e, style: t, allowsInput: n = !0, children: r, max: i = NaN,
|
|
|
7364
7383
|
return isNaN(a) || (t = Math.max(a, t)), isNaN(i) || (t = Math.min(i, t)), t;
|
|
7365
7384
|
}, [v, y] = p(h(o)), b = dn(o), x = !isNaN(i) && o + 1 > i, S = !isNaN(a) && o - 1 < a;
|
|
7366
7385
|
l(() => {
|
|
7367
|
-
b === void 0 || b === o
|
|
7386
|
+
if (b === void 0 || b === o) return;
|
|
7387
|
+
let e = _(o);
|
|
7388
|
+
y(h(e));
|
|
7368
7389
|
}, [
|
|
7369
7390
|
o,
|
|
7370
7391
|
a,
|
|
@@ -8887,11 +8908,21 @@ function fi({ ref: e, children: t, threshold: n = .5, isEnabled: r = !0, onSwipe
|
|
|
8887
8908
|
process.env.NODE_ENV === "development" && (fi.displayName = "SwipeRegion");
|
|
8888
8909
|
//#endregion
|
|
8889
8910
|
//#region src/primitives/TextArea.tsx
|
|
8890
|
-
function pi({ ref: e,
|
|
8891
|
-
|
|
8892
|
-
|
|
8893
|
-
|
|
8894
|
-
|
|
8911
|
+
function pi({ ref: e, autoFocus: t = !1, onChange: n, ...r }) {
|
|
8912
|
+
let i = e ?? f(null);
|
|
8913
|
+
return l(() => {
|
|
8914
|
+
if (!t) return;
|
|
8915
|
+
let e = i.current;
|
|
8916
|
+
if (!e) return;
|
|
8917
|
+
let n = setTimeout(() => {
|
|
8918
|
+
let t = e.value.length;
|
|
8919
|
+
e.focus({ preventScroll: !0 }), e.setSelectionRange(t, t);
|
|
8920
|
+
}, 0);
|
|
8921
|
+
return () => clearTimeout(n);
|
|
8922
|
+
}, [t]), /* @__PURE__ */ (0, O.jsx)("textarea", {
|
|
8923
|
+
...r,
|
|
8924
|
+
ref: i,
|
|
8925
|
+
onChange: (e) => n(e.target.value)
|
|
8895
8926
|
});
|
|
8896
8927
|
}
|
|
8897
8928
|
process.env.NODE_ENV === "development" && (pi.displayName = "TextArea");
|