@component-hook/picker 1.2.0-alpha.0 → 1.2.1-alpha.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.
@@ -1,26 +1,26 @@
1
- import be, { forwardRef as Re, useState as U, useRef as D, useMemo as F, useImperativeHandle as G, useEffect as J } from "react";
2
- var B = { exports: {} }, H = {};
1
+ import Re, { forwardRef as be, useState as W, useRef as j, useMemo as F, useImperativeHandle as Z, useEffect as G } from "react";
2
+ var q = { exports: {} }, H = {};
3
3
  var ae;
4
4
  function xe() {
5
5
  if (ae) return H;
6
6
  ae = 1;
7
7
  var e = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
8
- function o(s, r, a) {
9
- var d = null;
10
- if (a !== void 0 && (d = "" + a), r.key !== void 0 && (d = "" + r.key), "key" in r) {
8
+ function r(o, s, a) {
9
+ var f = null;
10
+ if (a !== void 0 && (f = "" + a), s.key !== void 0 && (f = "" + s.key), "key" in s) {
11
11
  a = {};
12
- for (var c in r)
13
- c !== "key" && (a[c] = r[c]);
14
- } else a = r;
15
- return r = a.ref, {
12
+ for (var c in s)
13
+ c !== "key" && (a[c] = s[c]);
14
+ } else a = s;
15
+ return s = a.ref, {
16
16
  $$typeof: e,
17
- type: s,
18
- key: d,
19
- ref: r !== void 0 ? r : null,
17
+ type: o,
18
+ key: f,
19
+ ref: s !== void 0 ? s : null,
20
20
  props: a
21
21
  };
22
22
  }
23
- return H.Fragment = n, H.jsx = o, H.jsxs = o, H;
23
+ return H.Fragment = n, H.jsx = r, H.jsxs = r, H;
24
24
  }
25
25
  var z = {};
26
26
  var ue;
@@ -29,36 +29,36 @@ function Oe() {
29
29
  function e(t) {
30
30
  if (t == null) return null;
31
31
  if (typeof t == "function")
32
- return t.$$typeof === O ? null : t.displayName || t.name || null;
32
+ return t.$$typeof === E ? null : t.displayName || t.name || null;
33
33
  if (typeof t == "string") return t;
34
34
  switch (t) {
35
35
  case M:
36
36
  return "Fragment";
37
- case x:
37
+ case O:
38
38
  return "Profiler";
39
39
  case v:
40
40
  return "StrictMode";
41
41
  case m:
42
42
  return "Suspense";
43
- case P:
43
+ case w:
44
44
  return "SuspenseList";
45
- case T:
45
+ case I:
46
46
  return "Activity";
47
47
  }
48
48
  if (typeof t == "object")
49
49
  switch (typeof t.tag == "number" && console.error(
50
50
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
51
51
  ), t.$$typeof) {
52
- case R:
52
+ case x:
53
53
  return "Portal";
54
- case E:
54
+ case T:
55
55
  return t.displayName || "Context";
56
56
  case l:
57
57
  return (t._context.displayName || "Context") + ".Consumer";
58
58
  case g:
59
59
  var i = t.render;
60
60
  return t = t.displayName, t || (t = i.displayName || i.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
61
- case y:
61
+ case A:
62
62
  return i = t.displayName || null, i !== null ? i : e(t.type) || "Memo";
63
63
  case Y:
64
64
  i = t._payload, t = t._init;
@@ -72,7 +72,7 @@ function Oe() {
72
72
  function n(t) {
73
73
  return "" + t;
74
74
  }
75
- function o(t) {
75
+ function r(t) {
76
76
  try {
77
77
  n(t);
78
78
  var i = !1;
@@ -81,15 +81,15 @@ function Oe() {
81
81
  }
82
82
  if (i) {
83
83
  i = console;
84
- var k = i.error, w = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
85
- return k.call(
84
+ var R = i.error, y = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
85
+ return R.call(
86
86
  i,
87
87
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
88
- w
88
+ y
89
89
  ), n(t);
90
90
  }
91
91
  }
92
- function s(t) {
92
+ function o(t) {
93
93
  if (t === M) return "<>";
94
94
  if (typeof t == "object" && t !== null && t.$$typeof === Y)
95
95
  return "<...>";
@@ -100,47 +100,47 @@ function Oe() {
100
100
  return "<...>";
101
101
  }
102
102
  }
103
- function r() {
104
- var t = C.A;
103
+ function s() {
104
+ var t = k.A;
105
105
  return t === null ? null : t.getOwner();
106
106
  }
107
107
  function a() {
108
108
  return Error("react-stack-top-frame");
109
109
  }
110
- function d(t) {
111
- if (I.call(t, "key")) {
110
+ function f(t) {
111
+ if (P.call(t, "key")) {
112
112
  var i = Object.getOwnPropertyDescriptor(t, "key").get;
113
113
  if (i && i.isReactWarning) return !1;
114
114
  }
115
115
  return t.key !== void 0;
116
116
  }
117
117
  function c(t, i) {
118
- function k() {
119
- L || (L = !0, console.error(
118
+ function R() {
119
+ U || (U = !0, console.error(
120
120
  "%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://react.dev/link/special-props)",
121
121
  i
122
122
  ));
123
123
  }
124
- k.isReactWarning = !0, Object.defineProperty(t, "key", {
125
- get: k,
124
+ R.isReactWarning = !0, Object.defineProperty(t, "key", {
125
+ get: R,
126
126
  configurable: !0
127
127
  });
128
128
  }
129
129
  function S() {
130
130
  var t = e(this.type);
131
- return re[t] || (re[t] = !0, console.error(
131
+ return L[t] || (L[t] = !0, console.error(
132
132
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
133
133
  )), t = this.props.ref, t !== void 0 ? t : null;
134
134
  }
135
- function f(t, i, k, w, W, Q) {
136
- var A = k.ref;
135
+ function d(t, i, R, y, B, K) {
136
+ var C = R.ref;
137
137
  return t = {
138
138
  $$typeof: b,
139
139
  type: t,
140
140
  key: i,
141
- props: k,
142
- _owner: w
143
- }, (A !== void 0 ? A : null) !== null ? Object.defineProperty(t, "ref", {
141
+ props: R,
142
+ _owner: y
143
+ }, (C !== void 0 ? C : null) !== null ? Object.defineProperty(t, "ref", {
144
144
  enumerable: !1,
145
145
  get: S
146
146
  }) : Object.defineProperty(t, "ref", { enumerable: !1, value: null }), t._store = {}, Object.defineProperty(t._store, "validated", {
@@ -157,60 +157,60 @@ function Oe() {
157
157
  configurable: !1,
158
158
  enumerable: !1,
159
159
  writable: !0,
160
- value: W
160
+ value: B
161
161
  }), Object.defineProperty(t, "_debugTask", {
162
162
  configurable: !1,
163
163
  enumerable: !1,
164
164
  writable: !0,
165
- value: Q
165
+ value: K
166
166
  }), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
167
167
  }
168
- function _(t, i, k, w, W, Q) {
169
- var A = i.children;
170
- if (A !== void 0)
171
- if (w)
172
- if (V(A)) {
173
- for (w = 0; w < A.length; w++)
174
- p(A[w]);
175
- Object.freeze && Object.freeze(A);
168
+ function _(t, i, R, y, B, K) {
169
+ var C = i.children;
170
+ if (C !== void 0)
171
+ if (y)
172
+ if (V(C)) {
173
+ for (y = 0; y < C.length; y++)
174
+ p(C[y]);
175
+ Object.freeze && Object.freeze(C);
176
176
  } else
177
177
  console.error(
178
178
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
179
179
  );
180
- else p(A);
181
- if (I.call(i, "key")) {
182
- A = e(t);
183
- var X = Object.keys(i).filter(function(ke) {
180
+ else p(C);
181
+ if (P.call(i, "key")) {
182
+ C = e(t);
183
+ var $ = Object.keys(i).filter(function(ke) {
184
184
  return ke !== "key";
185
185
  });
186
- w = 0 < X.length ? "{key: someKey, " + X.join(": ..., ") + ": ...}" : "{key: someKey}", ce[A + w] || (X = 0 < X.length ? "{" + X.join(": ..., ") + ": ...}" : "{}", console.error(
186
+ y = 0 < $.length ? "{key: someKey, " + $.join(": ..., ") + ": ...}" : "{key: someKey}", ce[C + y] || ($ = 0 < $.length ? "{" + $.join(": ..., ") + ": ...}" : "{}", console.error(
187
187
  `A props object containing a "key" prop is being spread into JSX:
188
188
  let props = %s;
189
189
  <%s {...props} />
190
190
  React keys must be passed directly to JSX without using spread:
191
191
  let props = %s;
192
192
  <%s key={someKey} {...props} />`,
193
- w,
194
- A,
195
- X,
196
- A
197
- ), ce[A + w] = !0);
193
+ y,
194
+ C,
195
+ $,
196
+ C
197
+ ), ce[C + y] = !0);
198
198
  }
199
- if (A = null, k !== void 0 && (o(k), A = "" + k), d(i) && (o(i.key), A = "" + i.key), "key" in i) {
200
- k = {};
201
- for (var K in i)
202
- K !== "key" && (k[K] = i[K]);
203
- } else k = i;
204
- return A && c(
205
- k,
199
+ if (C = null, R !== void 0 && (r(R), C = "" + R), f(i) && (r(i.key), C = "" + i.key), "key" in i) {
200
+ R = {};
201
+ for (var ee in i)
202
+ ee !== "key" && (R[ee] = i[ee]);
203
+ } else R = i;
204
+ return C && c(
205
+ R,
206
206
  typeof t == "function" ? t.displayName || t.name || "Unknown" : t
207
- ), f(
207
+ ), d(
208
208
  t,
209
- A,
210
- k,
211
- r(),
212
- W,
213
- Q
209
+ C,
210
+ R,
211
+ s(),
212
+ B,
213
+ K
214
214
  );
215
215
  }
216
216
  function p(t) {
@@ -219,7 +219,7 @@ React keys must be passed directly to JSX without using spread:
219
219
  function u(t) {
220
220
  return typeof t == "object" && t !== null && t.$$typeof === b;
221
221
  }
222
- var h = be, b = Symbol.for("react.transitional.element"), R = Symbol.for("react.portal"), M = Symbol.for("react.fragment"), v = Symbol.for("react.strict_mode"), x = Symbol.for("react.profiler"), l = Symbol.for("react.consumer"), E = Symbol.for("react.context"), g = Symbol.for("react.forward_ref"), m = Symbol.for("react.suspense"), P = Symbol.for("react.suspense_list"), y = Symbol.for("react.memo"), Y = Symbol.for("react.lazy"), T = Symbol.for("react.activity"), O = Symbol.for("react.client.reference"), C = h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, I = Object.prototype.hasOwnProperty, V = Array.isArray, j = console.createTask ? console.createTask : function() {
222
+ var h = Re, b = Symbol.for("react.transitional.element"), x = Symbol.for("react.portal"), M = Symbol.for("react.fragment"), v = Symbol.for("react.strict_mode"), O = Symbol.for("react.profiler"), l = Symbol.for("react.consumer"), T = Symbol.for("react.context"), g = Symbol.for("react.forward_ref"), m = Symbol.for("react.suspense"), w = Symbol.for("react.suspense_list"), A = Symbol.for("react.memo"), Y = Symbol.for("react.lazy"), I = Symbol.for("react.activity"), E = Symbol.for("react.client.reference"), k = h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, P = Object.prototype.hasOwnProperty, V = Array.isArray, D = console.createTask ? console.createTask : function() {
223
223
  return null;
224
224
  };
225
225
  h = {
@@ -227,88 +227,88 @@ React keys must be passed directly to JSX without using spread:
227
227
  return t();
228
228
  }
229
229
  };
230
- var L, re = {}, oe = h.react_stack_bottom_frame.bind(
230
+ var U, L = {}, oe = h.react_stack_bottom_frame.bind(
231
231
  h,
232
232
  a
233
- )(), se = j(s(a)), ce = {};
234
- z.Fragment = M, z.jsx = function(t, i, k) {
235
- var w = 1e4 > C.recentlyCreatedOwnerStacks++;
233
+ )(), se = D(o(a)), ce = {};
234
+ z.Fragment = M, z.jsx = function(t, i, R) {
235
+ var y = 1e4 > k.recentlyCreatedOwnerStacks++;
236
236
  return _(
237
237
  t,
238
238
  i,
239
- k,
239
+ R,
240
240
  !1,
241
- w ? Error("react-stack-top-frame") : oe,
242
- w ? j(s(t)) : se
241
+ y ? Error("react-stack-top-frame") : oe,
242
+ y ? D(o(t)) : se
243
243
  );
244
- }, z.jsxs = function(t, i, k) {
245
- var w = 1e4 > C.recentlyCreatedOwnerStacks++;
244
+ }, z.jsxs = function(t, i, R) {
245
+ var y = 1e4 > k.recentlyCreatedOwnerStacks++;
246
246
  return _(
247
247
  t,
248
248
  i,
249
- k,
249
+ R,
250
250
  !0,
251
- w ? Error("react-stack-top-frame") : oe,
252
- w ? j(s(t)) : se
251
+ y ? Error("react-stack-top-frame") : oe,
252
+ y ? D(o(t)) : se
253
253
  );
254
254
  };
255
255
  })()), z;
256
256
  }
257
257
  var ie;
258
258
  function Me() {
259
- return ie || (ie = 1, process.env.NODE_ENV === "production" ? B.exports = xe() : B.exports = Oe()), B.exports;
259
+ return ie || (ie = 1, process.env.NODE_ENV === "production" ? q.exports = xe() : q.exports = Oe()), q.exports;
260
260
  }
261
261
  var N = Me();
262
- const Ce = Array.isArray;
263
- function we(e, n) {
262
+ const ye = Array.isArray;
263
+ function Ce(e, n) {
264
264
  if (Ee(e)) return "multiple";
265
- const [o] = e;
266
- return o?.[n.children] ? "cascade" : "single";
265
+ const [r] = e;
266
+ return r?.[n.children] ? "cascade" : "single";
267
267
  }
268
- function Ae(e) {
268
+ function we(e) {
269
269
  return {
270
270
  children: e?.children || "children",
271
271
  label: e?.label || "label",
272
272
  value: e?.value || "value"
273
273
  };
274
274
  }
275
- function Pe(e, n, o) {
275
+ function Ae(e, n, r) {
276
276
  if (Ee(e)) return [];
277
- const s = [];
278
- let r = e, a = 0;
279
- for (; r; ) {
280
- const d = n[a];
281
- let c = Te(r, d, o);
282
- c === -1 && (c = 0), s.push(r), a += 1, r = r[c]?.[o.children];
277
+ const o = [];
278
+ let s = e, a = 0;
279
+ for (; s; ) {
280
+ const f = n[a];
281
+ let c = Te(s, f, r);
282
+ c === -1 && (c = 0), o.push(s), a += 1, s = s[c]?.[r.children];
283
+ }
284
+ return o;
285
+ }
286
+ function Pe(e, n, r, o) {
287
+ const s = [...r];
288
+ let a = e, f = n + 1;
289
+ for (; a?.[o.children]; ) {
290
+ const c = a[o.children][0];
291
+ s[f] = c.value, a = c, f += 1;
283
292
  }
284
293
  return s;
285
294
  }
286
- function ye(e, n, o, s) {
287
- const r = [...o];
288
- let a = e, d = n + 1;
289
- for (; a?.[s.children]; ) {
290
- const c = a[s.children][0];
291
- r[d] = c.value, a = c, d += 1;
292
- }
293
- return r;
294
- }
295
- function Te(e, n, o) {
296
- return e.findIndex((s) => s?.[o.value] === n);
295
+ function Te(e, n, r) {
296
+ return e.findIndex((o) => o?.[r.value] === n);
297
297
  }
298
298
  function Ee(e) {
299
299
  const [n] = e;
300
- return Ce(n);
300
+ return ye(n);
301
301
  }
302
302
  function Ne(e, n) {
303
303
  return e > n ? "horizontal" : n > e ? "vertical" : "";
304
304
  }
305
- function $(e, n, o) {
306
- const s = [];
307
- for (let r = e; r <= n; r++) {
308
- const a = o(`${r}`);
309
- s.push({ label: a, value: r });
305
+ function X(e, n, r) {
306
+ const o = [];
307
+ for (let s = e; s <= n; s++) {
308
+ const a = r(`${s}`);
309
+ o.push({ label: a, value: s });
310
310
  }
311
- return s;
311
+ return o;
312
312
  }
313
313
  function le(e, n) {
314
314
  return e === n.getFullYear();
@@ -325,11 +325,11 @@ function Ie(e, n) {
325
325
  function je(e, n) {
326
326
  return new Date(e, n, 0).getDate();
327
327
  }
328
- function de(e, n, o) {
329
- const s = /* @__PURE__ */ new Date(), r = Date.now(), a = e.getTime(), d = n.getTime(), c = r >= a && r <= d;
330
- return o === "year" ? c ? s.getFullYear() : e.getFullYear() : o === "month" ? c ? s.getMonth() + 1 : e.getMonth() + 1 : c ? s.getDate() : e.getDate();
328
+ function de(e, n, r) {
329
+ const o = /* @__PURE__ */ new Date(), s = Date.now(), a = e.getTime(), f = n.getTime(), c = s >= a && s <= f;
330
+ return r === "year" ? c ? o.getFullYear() : e.getFullYear() : r === "month" ? c ? o.getMonth() + 1 : e.getMonth() + 1 : c ? o.getDate() : e.getDate();
331
331
  }
332
- function ee(e) {
332
+ function te(e) {
333
333
  return e;
334
334
  }
335
335
  function De(e) {
@@ -337,20 +337,20 @@ function De(e) {
337
337
  }
338
338
  function me(e) {
339
339
  if (!De(e)) return null;
340
- const [n, o, s] = e.split(":");
341
- return { hour: Number(n), minute: Number(o), second: Number(s) };
340
+ const [n, r, o] = e.split(":");
341
+ return { hour: Number(n), minute: Number(r), second: Number(o) };
342
342
  }
343
- function te(e) {
343
+ function ne(e) {
344
344
  return e.padStart(2, "0");
345
345
  }
346
- function he(e, n, o) {
347
- const s = Date.now(), { hour: r, minute: a, second: d } = e, { hour: c, minute: S, second: f } = n, _ = (/* @__PURE__ */ new Date()).setHours(r, a, d), p = (/* @__PURE__ */ new Date()).setHours(c, S, f), u = s >= _ && s <= p;
348
- return o === "hour" ? u ? (/* @__PURE__ */ new Date()).getHours() : r : o === "minute" ? u ? (/* @__PURE__ */ new Date()).getMinutes() : a : u ? (/* @__PURE__ */ new Date()).getSeconds() : d;
346
+ function he(e, n, r) {
347
+ const o = Date.now(), { hour: s, minute: a, second: f } = e, { hour: c, minute: S, second: d } = n, _ = (/* @__PURE__ */ new Date()).setHours(s, a, f), p = (/* @__PURE__ */ new Date()).setHours(c, S, d), u = o >= _ && o <= p;
348
+ return r === "hour" ? u ? (/* @__PURE__ */ new Date()).getHours() : s : r === "minute" ? u ? (/* @__PURE__ */ new Date()).getMinutes() : a : u ? (/* @__PURE__ */ new Date()).getSeconds() : f;
349
349
  }
350
- function Z(e) {
351
- return Re(e);
350
+ function Q(e) {
351
+ return be(e);
352
352
  }
353
- const Fe = 16, q = 48, Ve = 0.52, pe = 150, ne = 300, Xe = 15, $e = 8e-3, ge = 5, Ue = ["year", "month", "day"], Le = ["hour", "minute", "second"];
353
+ const Fe = 16, J = 48, Ve = 0.52, pe = 150, re = 300, $e = 15, Xe = 8e-3, ge = 5, Ue = ["year", "month", "day"], Le = ["hour", "minute", "second"];
354
354
  function He() {
355
355
  const e = {
356
356
  startX: 0,
@@ -360,21 +360,21 @@ function He() {
360
360
  offsetX: 0,
361
361
  offsetY: 0
362
362
  };
363
- let n = "", o = !0;
364
- const s = () => n === "vertical", r = () => n === "horizontal";
363
+ let n = "", r = !0;
364
+ const o = () => n === "vertical", s = () => n === "horizontal";
365
365
  function a() {
366
- e.deltaX = 0, e.deltaY = 0, e.offsetX = 0, e.offsetY = 0, n = "", o = !0;
366
+ e.deltaX = 0, e.deltaY = 0, e.offsetX = 0, e.offsetY = 0, n = "", r = !0;
367
367
  }
368
- function d(f) {
369
- const _ = "touches" in f ? f.touches[0] : f;
368
+ function f(d) {
369
+ const _ = "touches" in d ? d.touches[0] : d;
370
370
  a(), e.startX = _.clientX, e.startY = _.clientY;
371
371
  }
372
- function c(f) {
372
+ function c(d) {
373
373
  if (!e.startX || !e.startY) return !0;
374
- const _ = "touches" in f ? f.touches[0] : f;
374
+ const _ = "touches" in d ? d.touches[0] : d;
375
375
  e.deltaX = Math.max(_.clientX, 0) - e.startX, e.deltaY = _.clientY - e.startY, e.offsetX = Math.abs(e.deltaX), e.offsetY = Math.abs(e.deltaY);
376
376
  const p = 10;
377
- (!n || e.offsetX < p && e.offsetY < p) && (n = Ne(e.offsetX, e.offsetY)), o && (e.offsetX > ge || e.offsetY > ge) && (o = !1);
377
+ (!n || e.offsetX < p && e.offsetY < p) && (n = Ne(e.offsetX, e.offsetY)), r && (e.offsetX > ge || e.offsetY > ge) && (r = !1);
378
378
  }
379
379
  function S() {
380
380
  e.startX = 0, e.startY = 0;
@@ -382,79 +382,90 @@ function He() {
382
382
  return {
383
383
  pointer: e,
384
384
  move: c,
385
- start: d,
385
+ start: f,
386
386
  stop: S,
387
387
  reset: a,
388
- isVertical: s,
389
- isHorizontal: r
388
+ isVertical: o,
389
+ isHorizontal: s
390
390
  };
391
391
  }
392
392
  function ze({ column: e, onChange: n }) {
393
- const s = Number.parseFloat(getComputedStyle(document.documentElement).fontSize) / Fe, [r, a] = U(0), [d, c] = U(0), S = D(0), f = D(0), _ = D(0), p = D(!1), u = D(null), { pointer: h, start: b, move: R, stop: M } = F(() => He(), []);
394
- function v(T) {
395
- return T * s;
393
+ const o = Number.parseFloat(getComputedStyle(document.documentElement).fontSize) / Fe, [s, a] = W(0), f = j(null), c = j(0), S = j(0), d = j(0), _ = j(0), p = j(!1), u = j(null), { pointer: h, start: b, move: x, stop: M } = F(() => He(), []);
394
+ function v(E) {
395
+ return E * o;
396
+ }
397
+ function O(E) {
398
+ const k = e.length, P = Math.round(-E / v(J));
399
+ return P < 0 ? 0 : P >= k ? k - 1 : P;
396
400
  }
397
- function x(T) {
398
- const O = e.length, C = Math.round(-T / v(q));
399
- return C < 0 ? 0 : C >= O ? O - 1 : C;
401
+ function l(E) {
402
+ const k = -E * v(J), P = () => n?.(E);
403
+ p.current && k !== c.current ? u.current = P : P(), m(k);
400
404
  }
401
- function l(T) {
402
- const O = -T * v(q), C = () => n?.(T);
403
- p.current && O !== r ? u.current = C : C(), a(O);
405
+ function T(E) {
406
+ b(E), p.current = !0, a(0), d.current = Date.now(), S.current = c.current, _.current = S.current, u.current = null;
404
407
  }
405
- function E(T) {
406
- b(T), p.current = !0, c(0), f.current = Date.now(), S.current = r, _.current = S.current, u.current = null;
408
+ function g(E) {
409
+ if (x(E)) return;
410
+ const P = e.length, V = S.current + h.deltaY, D = v((P - 1) * -J), U = Math.min(Math.max(V, D), 0), L = Date.now();
411
+ m(U), !(L - d.current <= re) && (d.current = L, _.current = U);
407
412
  }
408
- function g(T) {
409
- if (R(T)) return;
410
- const C = e.length, I = S.current + h.deltaY, V = v((C - 1) * -q), j = Math.min(Math.max(I, V), 0), L = Date.now();
411
- a(j), !(L - f.current <= ne) && (f.current = L, _.current = j);
413
+ function m(E) {
414
+ c.current = E, f.current && f.current.style.setProperty("--offset-y", `${E}`);
412
415
  }
413
- function m() {
416
+ function w() {
414
417
  M();
415
- const T = r - _.current, O = Date.now() - f.current;
416
- if (O < ne && Math.abs(T) > Xe) {
417
- P(T, O);
418
+ const E = c.current - _.current, k = Date.now() - d.current;
419
+ if (k < re && Math.abs(E) > $e) {
420
+ A(E, k);
418
421
  return;
419
422
  }
420
- const C = x(r);
421
- c(pe), l(C), p.current = !1;
423
+ const P = O(c.current);
424
+ a(pe), l(P), p.current = !1;
422
425
  }
423
- function P(T, O) {
424
- const C = Math.abs(T / O), I = r + C / $e * (T < 0 ? -1 : 1), V = x(I);
425
- c(ne), l(V);
426
+ function A(E, k) {
427
+ const P = Math.abs(E / k), V = c.current + P / Xe * (E < 0 ? -1 : 1), D = O(V);
428
+ a(re), l(D);
426
429
  }
427
- function y() {
428
- c(0), p.current = !1, u.current && (u.current(), u.current = null);
430
+ function Y() {
431
+ a(0), p.current = !1, u.current && (u.current(), u.current = null);
429
432
  }
430
- function Y(T, O = "auto") {
431
- p.current && O === "smooth" || (u.current = null, p.current = O === "smooth", c(O === "smooth" ? pe : 0), l(T));
433
+ function I(E, k = "auto") {
434
+ p.current && k === "smooth" || (u.current = null, p.current = k === "smooth", a(k === "smooth" ? pe : 0), l(E));
432
435
  }
433
436
  return {
434
- offsetY: r,
435
- transitionDuration: d,
436
- onPointerDown: E,
437
+ columnRef: f,
438
+ transitionDuration: s,
439
+ onPointerDown: T,
437
440
  onPointerMove: g,
438
- onPointerUp: m,
439
- stopInertialSliding: y,
440
- scrollToIndex: Y
441
+ onPointerUp: w,
442
+ stopInertialSliding: Y,
443
+ scrollToIndex: I
441
444
  };
442
445
  }
443
- function We({ column: e, fields: n, selectedIndex: o = 0, onChange: s }, r) {
444
- const { offsetY: a, transitionDuration: d, onPointerDown: c, onPointerMove: S, onPointerUp: f, stopInertialSliding: _, scrollToIndex: p } = ze({
446
+ function We({ column: e, fields: n, selectedIndex: r = 0, onChange: o }, s) {
447
+ const {
448
+ columnRef: a,
449
+ transitionDuration: f,
450
+ onPointerDown: c,
451
+ onPointerMove: S,
452
+ onPointerUp: d,
453
+ stopInertialSliding: _,
454
+ scrollToIndex: p
455
+ } = ze({
445
456
  column: e,
446
457
  onChange: u
447
458
  });
448
- function u(R) {
449
- R !== o && s(R);
459
+ function u(x) {
460
+ x !== r && o(x);
450
461
  }
451
- function h(R = o, M) {
452
- p(R, M);
462
+ function h(x = r, M) {
463
+ p(x, M);
453
464
  }
454
- function b(R) {
455
- R !== o && h(R, "smooth");
465
+ function b(x) {
466
+ x !== r && h(x, "smooth");
456
467
  }
457
- return G(r, () => ({
468
+ return Z(s, () => ({
458
469
  scrollToSelected: h
459
470
  })), /* @__PURE__ */ N.jsx(
460
471
  "div",
@@ -464,12 +475,12 @@ function We({ column: e, fields: n, selectedIndex: o = 0, onChange: s }, r) {
464
475
  className: "chook-picker-column",
465
476
  onTouchStart: c,
466
477
  onTouchMove: S,
467
- onTouchEnd: f,
468
- onTouchCancel: f,
478
+ onTouchEnd: d,
479
+ onTouchCancel: d,
469
480
  onMouseDown: c,
470
481
  onMouseMove: S,
471
- onMouseUp: f,
472
- onMouseLeave: f,
482
+ onMouseUp: d,
483
+ onMouseLeave: d,
473
484
  style: {
474
485
  overflowY: "hidden",
475
486
  touchAction: "none"
@@ -477,15 +488,16 @@ function We({ column: e, fields: n, selectedIndex: o = 0, onChange: s }, r) {
477
488
  children: /* @__PURE__ */ N.jsx(
478
489
  "ul",
479
490
  {
491
+ ref: a,
480
492
  style: {
481
493
  overflowY: "hidden",
482
- transform: `translate3d(0, ${a}px, 0)`,
483
- transitionDuration: `${d}ms`,
484
- transitionProperty: d ? "all" : "none",
494
+ transform: "translate3d(0, calc(var(--offset-y) * 1px), 0)",
495
+ transitionDuration: `${f}ms`,
496
+ transitionProperty: f ? "all" : "none",
485
497
  touchAction: "none"
486
498
  },
487
499
  onTransitionEnd: _,
488
- children: e.map((R, M) => /* @__PURE__ */ N.jsx(
500
+ children: e.map((x, M) => /* @__PURE__ */ N.jsx(
489
501
  "div",
490
502
  {
491
503
  tabIndex: 0,
@@ -501,47 +513,47 @@ function We({ column: e, fields: n, selectedIndex: o = 0, onChange: s }, r) {
501
513
  {
502
514
  className: "chook-picker-column-label",
503
515
  style: {
504
- transform: `rotate3d(1, 0, 0, ${(M * q + a) * Ve}deg)`
516
+ transform: `rotate3d(1, 0, 0, calc((${M * J} + var(--offset-y)) * ${Ve}deg)`
505
517
  },
506
- children: R?.[n.label]
518
+ children: x?.[n.label]
507
519
  }
508
520
  )
509
521
  },
510
- R?.[n.value]
522
+ x?.[n.value]
511
523
  ))
512
524
  }
513
525
  )
514
526
  }
515
527
  );
516
528
  }
517
- const _e = Z(We);
529
+ const _e = Q(We);
518
530
  _e.displayName = "Column";
519
531
  function Be(e, n) {
520
532
  const {
521
- loading: o,
522
- loadingSlot: s,
523
- columns: r,
533
+ loading: r,
534
+ loadingSlot: o,
535
+ columns: s,
524
536
  emptySlot: a,
525
- currentColumns: d,
537
+ currentColumns: f,
526
538
  fields: c,
527
539
  selectedIndices: S,
528
- updateSelectedValueByIndex: f
529
- } = e, _ = D([]);
540
+ updateSelectedValueByIndex: d
541
+ } = e, _ = j([]);
530
542
  function p(u, h) {
531
543
  _.current[u]?.scrollToSelected(h);
532
544
  }
533
- return G(n, () => ({
545
+ return Z(n, () => ({
534
546
  scrollColumnToSelected: p
535
- })), o ? /* @__PURE__ */ N.jsxs(N.Fragment, { children: [
536
- /* @__PURE__ */ N.jsx("div", { className: "chook-picker-loading", children: s }),
547
+ })), r ? /* @__PURE__ */ N.jsxs(N.Fragment, { children: [
548
+ /* @__PURE__ */ N.jsx("div", { className: "chook-picker-loading", children: o }),
537
549
  /* @__PURE__ */ N.jsx("div", { className: "chook-picker-columns" })
538
- ] }) : r.length ? /* @__PURE__ */ N.jsxs(
550
+ ] }) : s.length ? /* @__PURE__ */ N.jsxs(
539
551
  "div",
540
552
  {
541
553
  className: "chook-picker-columns chook-picker-columns-backdrop",
542
554
  onTouchMove: (u) => u.stopPropagation(),
543
555
  children: [
544
- d.map((u, h) => /* @__PURE__ */ N.jsx(
556
+ f.map((u, h) => /* @__PURE__ */ N.jsx(
545
557
  _e,
546
558
  {
547
559
  ref: (b) => {
@@ -550,7 +562,7 @@ function Be(e, n) {
550
562
  column: u,
551
563
  fields: c,
552
564
  selectedIndex: S[h],
553
- onChange: (b) => f(h, b)
565
+ onChange: (b) => d(h, b)
554
566
  },
555
567
  h
556
568
  )),
@@ -559,46 +571,46 @@ function Be(e, n) {
559
571
  }
560
572
  ) : /* @__PURE__ */ N.jsx("div", { className: "chook-picker-columns", children: a });
561
573
  }
562
- const Se = Z(Be);
574
+ const Se = Q(Be);
563
575
  Se.displayName = "Columns";
564
576
  function ve({
565
577
  values: e,
566
578
  columns: n,
567
- loading: o = !1,
568
- loadingSlot: s,
569
- emptySlot: r,
579
+ loading: r = !1,
580
+ loadingSlot: o,
581
+ emptySlot: s,
570
582
  columnsFieldNames: a,
571
- onChange: d
583
+ onChange: f
572
584
  }) {
573
- const [c, S] = U(e ?? []), [f, _] = U([]), p = D(null), u = Ae(a), h = we(n, u), b = F(() => h === "single" ? [n] : h === "multiple" ? n : Pe(n, c, u), [n, h, c, u]);
574
- function R(v, x) {
575
- const l = b[v], E = l[x]?.[u.value], g = c[v];
576
- if (E === g) return;
585
+ const [c, S] = W(e ?? []), [d, _] = W([]), p = j(null), u = we(a), h = Ce(n, u), b = F(() => h === "single" ? [n] : h === "multiple" ? n : Ae(n, c, u), [n, h, c, u]);
586
+ function x(v, O) {
587
+ const l = b[v], T = l[O]?.[u.value], g = c[v];
588
+ if (T === g) return;
577
589
  const m = [...c];
578
- if (m[v] = E, h === "cascade") {
579
- const P = l[x], y = ye(P, v, m, u);
580
- S(y), d?.(y);
590
+ if (m[v] = T, h === "cascade") {
591
+ const w = l[O], A = Pe(w, v, m, u);
592
+ S(A), f?.(A);
581
593
  } else
582
- S(m), d?.(m);
594
+ S(m), f?.(m);
583
595
  }
584
596
  function M(v) {
585
- return v.some((x, l) => x !== c[l]);
597
+ return v.some((O, l) => O !== c[l]);
586
598
  }
587
- return J(() => {
599
+ return G(() => {
588
600
  !e || !M(e) || S([...e]);
589
- }, [e]), J(() => {
590
- const v = b.length, x = [], l = [...c];
591
- let E = !1;
601
+ }, [e]), G(() => {
602
+ const v = b.length, O = [], l = [...c];
603
+ let T = !1;
592
604
  for (let g = 0; g < v; g++) {
593
- const m = b[g], P = c[g], y = Te(m, P, u);
594
- if (y === -1) {
595
- const T = (f[g] ?? 0) >= m.length ? Math.max(m.length - 1, 0) : 0;
596
- l[g] = m[T]?.[u.value], x[g] = T;
605
+ const m = b[g], w = c[g], A = Te(m, w, u);
606
+ if (A === -1) {
607
+ const I = (d[g] ?? 0) >= m.length ? Math.max(m.length - 1, 0) : 0;
608
+ l[g] = m[I]?.[u.value], O[g] = I;
597
609
  } else
598
- x[g] = y;
599
- x[g] !== f[g] && (p.current?.scrollColumnToSelected(g, x[g]), E = !0);
610
+ O[g] = A;
611
+ O[g] !== d[g] && (p.current?.scrollColumnToSelected(g, O[g]), T = !0);
600
612
  }
601
- E && (S(l), _(x));
613
+ T && (S(l), _(O));
602
614
  }, [c, b, u]), /* @__PURE__ */ N.jsx(
603
615
  "div",
604
616
  {
@@ -608,14 +620,14 @@ function ve({
608
620
  Se,
609
621
  {
610
622
  ref: p,
611
- loading: o,
612
- loadingSlot: s,
623
+ loading: r,
624
+ loadingSlot: o,
613
625
  columns: n,
614
- emptySlot: r,
626
+ emptySlot: s,
615
627
  currentColumns: b,
616
628
  fields: u,
617
- selectedIndices: f,
618
- updateSelectedValueByIndex: R
629
+ selectedIndices: d,
630
+ updateSelectedValueByIndex: x
619
631
  }
620
632
  )
621
633
  }
@@ -624,48 +636,48 @@ function ve({
624
636
  function qe({
625
637
  values: e,
626
638
  columnsType: n = Ue,
627
- minDate: o = new Date((/* @__PURE__ */ new Date()).getFullYear() - 10, 0, 1),
628
- maxDate: s = new Date((/* @__PURE__ */ new Date()).getFullYear() + 10, 11, 31),
629
- formatYearLabel: r = ee,
630
- formatMonthLabel: a = ee,
631
- formatDayLabel: d = ee,
639
+ minDate: r = new Date((/* @__PURE__ */ new Date()).getFullYear() - 10, 0, 1),
640
+ maxDate: o = new Date((/* @__PURE__ */ new Date()).getFullYear() + 10, 11, 31),
641
+ formatYearLabel: s = te,
642
+ formatMonthLabel: a = te,
643
+ formatDayLabel: f = te,
632
644
  onChange: c
633
645
  }, S) {
634
- const [f, _] = U([]), p = F(() => e ?? f, [e, f]), u = F(() => {
646
+ const [d, _] = W([]), p = F(() => e ?? d, [e, d]), u = F(() => {
635
647
  const l = {
636
648
  year: h,
637
649
  month: b,
638
- day: R
650
+ day: x
639
651
  };
640
- return n.map((E) => l[E]());
641
- }, [n, o, s, p, r, a, d]);
652
+ return n.map((T) => l[T]());
653
+ }, [n, r, o, p, s, a, f]);
642
654
  function h() {
643
- const l = o.getFullYear(), E = s.getFullYear();
644
- return $(l, E, r);
655
+ const l = r.getFullYear(), T = o.getFullYear();
656
+ return X(l, T, s);
645
657
  }
646
658
  function b() {
647
- const l = M("year"), E = le(l, o) ? o.getMonth() + 1 : 1, g = fe(l, s) ? s.getMonth() + 1 : 12;
648
- return $(E, g, a);
659
+ const l = M("year"), T = le(l, r) ? r.getMonth() + 1 : 1, g = fe(l, o) ? o.getMonth() + 1 : 12;
660
+ return X(T, g, a);
649
661
  }
650
- function R() {
651
- const l = M("year"), E = M("month"), g = le(l, o) && Ye(E, o), m = fe(l, s) && Ie(E, s), P = g ? o.getDate() : 1, y = m ? s.getDate() : je(l, E);
652
- return $(P, y, d);
662
+ function x() {
663
+ const l = M("year"), T = M("month"), g = le(l, r) && Ye(T, r), m = fe(l, o) && Ie(T, o), w = g ? r.getDate() : 1, A = m ? o.getDate() : je(l, T);
664
+ return X(w, A, f);
653
665
  }
654
666
  function M(l) {
655
- const E = n.indexOf(l), g = p?.[E];
656
- return g ? Number(g) : de(o, s, l);
667
+ const T = n.indexOf(l), g = p?.[T];
668
+ return g ? Number(g) : de(r, o, l);
657
669
  }
658
670
  function v(l) {
659
671
  e || _(l), c?.(l);
660
672
  }
661
- function x() {
662
- const l = n.map((E) => de(o, s, E));
673
+ function O() {
674
+ const l = n.map((T) => de(r, o, T));
663
675
  v(l);
664
676
  }
665
- return J(() => {
666
- (!e || !e.length) && x();
667
- }, []), G(S, () => ({
668
- setCurrentDate: x
677
+ return G(() => {
678
+ (!e || !e.length) && O();
679
+ }, []), Z(S, () => ({
680
+ setCurrentDate: O
669
681
  })), /* @__PURE__ */ N.jsx(
670
682
  ve,
671
683
  {
@@ -675,59 +687,59 @@ function qe({
675
687
  }
676
688
  );
677
689
  }
678
- const Je = Z(qe);
690
+ const Je = Q(qe);
679
691
  Je.displayName = "DatePicker";
680
692
  function Ge({
681
693
  values: e,
682
694
  columnsType: n = Le,
683
- minTime: o,
684
- maxTime: s,
685
- formatHourLabel: r = te,
686
- formatMinuteLabel: a = te,
687
- formatSecondLabel: d = te,
695
+ minTime: r,
696
+ maxTime: o,
697
+ formatHourLabel: s = ne,
698
+ formatMinuteLabel: a = ne,
699
+ formatSecondLabel: f = ne,
688
700
  onChange: c
689
701
  }, S) {
690
- const [f, _] = U([]), p = F(() => e ?? f, [e, f]), u = F(() => me(o ?? "") ?? { hour: 0, minute: 0, second: 0 }, [o]), h = F(() => me(s ?? "") ?? { hour: 23, minute: 59, second: 59 }, [s]), b = {
702
+ const [d, _] = W([]), p = F(() => e ?? d, [e, d]), u = F(() => me(r ?? "") ?? { hour: 0, minute: 0, second: 0 }, [r]), h = F(() => me(o ?? "") ?? { hour: 23, minute: 59, second: 59 }, [o]), b = {
691
703
  hour: M,
692
704
  minute: v,
693
- second: x
694
- }, R = n.map((m) => b[m]());
705
+ second: O
706
+ }, x = n.map((m) => b[m]());
695
707
  function M() {
696
- return $(u.hour, h.hour, r);
708
+ return X(u.hour, h.hour, s);
697
709
  }
698
710
  function v() {
699
- const m = l("hour"), { hour: P, minute: y } = u, { hour: Y, minute: T } = h;
700
- return $(m === P ? y : 0, m === Y ? T : 59, a);
711
+ const m = l("hour"), { hour: w, minute: A } = u, { hour: Y, minute: I } = h;
712
+ return X(m === w ? A : 0, m === Y ? I : 59, a);
701
713
  }
702
- function x() {
703
- const m = l("hour"), P = l("minute"), { hour: y, minute: Y, second: T } = u, { hour: O, minute: C, second: I } = h;
704
- return $(m === y && P === Y ? T : 0, m === O && P === C ? I : 59, d);
714
+ function O() {
715
+ const m = l("hour"), w = l("minute"), { hour: A, minute: Y, second: I } = u, { hour: E, minute: k, second: P } = h;
716
+ return X(m === A && w === Y ? I : 0, m === E && w === k ? P : 59, f);
705
717
  }
706
718
  function l(m) {
707
- const P = n.indexOf(m), y = p?.[P];
708
- return y !== void 0 ? Number(y) : he(u, h, m);
719
+ const w = n.indexOf(m), A = p?.[w];
720
+ return A !== void 0 ? Number(A) : he(u, h, m);
709
721
  }
710
- function E(m) {
722
+ function T(m) {
711
723
  e || _(m), c?.(m);
712
724
  }
713
725
  function g() {
714
- const m = n.map((P) => he(u, h, P));
715
- E(m);
726
+ const m = n.map((w) => he(u, h, w));
727
+ T(m);
716
728
  }
717
- return J(() => {
729
+ return G(() => {
718
730
  (!e || !e.length) && g();
719
- }, []), G(S, () => ({
731
+ }, []), Z(S, () => ({
720
732
  setCurrentTime: g
721
733
  })), /* @__PURE__ */ N.jsx(
722
734
  ve,
723
735
  {
724
736
  values: p,
725
- columns: R,
726
- onChange: E
737
+ columns: x,
738
+ onChange: T
727
739
  }
728
740
  );
729
741
  }
730
- const Ze = Z(Ge);
742
+ const Ze = Q(Ge);
731
743
  Ze.displayName = "TimePicker";
732
744
  export {
733
745
  Je as DatePicker,