@konstructio/ui 0.1.2-alpha.76 → 0.1.2-alpha.78

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,18 +1,18 @@
1
1
  import { jsx as m, jsxs as N } from "react/jsx-runtime";
2
2
  import * as w from "react";
3
- import { useRef as T, useMemo as k, useEffect as L } from "react";
4
- import { flushSync as D } from "react-dom";
3
+ import { useRef as T, useMemo as k, useEffect as D } from "react";
4
+ import { flushSync as L } from "react-dom";
5
5
  import { Typography as y } from "../../../Typography/Typography.js";
6
- import { cn as C } from "../../../../utils/index.js";
6
+ import { cn as I } from "../../../../utils/index.js";
7
7
  import { TruncateText as W } from "../TruncateText/TruncateText.js";
8
8
  import { usePhoneNumberContext as V } from "../../contexts/phone-number.hook.js";
9
- function x(o, r, e) {
9
+ function x(l, r, e) {
10
10
  let t = e.initialDeps ?? [], s, n = !0;
11
- function i() {
12
- var l, a, u;
11
+ function o() {
12
+ var i, a, u;
13
13
  let c;
14
- e.key && ((l = e.debug) != null && l.call(e)) && (c = Date.now());
15
- const d = o();
14
+ e.key && ((i = e.debug) != null && i.call(e)) && (c = Date.now());
15
+ const d = l();
16
16
  if (!(d.length !== t.length || d.some((S, f) => t[f] !== S)))
17
17
  return s;
18
18
  t = d;
@@ -37,45 +37,45 @@ function x(o, r, e) {
37
37
  }
38
38
  return e?.onChange && !(n && e.skipInitialOnChange) && e.onChange(s), n = !1, s;
39
39
  }
40
- return i.updateDeps = (l) => {
41
- t = l;
42
- }, i;
40
+ return o.updateDeps = (i) => {
41
+ t = i;
42
+ }, o;
43
43
  }
44
- function I(o, r) {
45
- if (o === void 0)
44
+ function C(l, r) {
45
+ if (l === void 0)
46
46
  throw new Error("Unexpected undefined");
47
- return o;
47
+ return l;
48
48
  }
49
- const j = (o, r) => Math.abs(o - r) < 1.01, P = (o, r, e) => {
49
+ const j = (l, r) => Math.abs(l - r) < 1.01, P = (l, r, e) => {
50
50
  let t;
51
51
  return function(...s) {
52
- o.clearTimeout(t), t = o.setTimeout(() => r.apply(this, s), e);
52
+ l.clearTimeout(t), t = l.setTimeout(() => r.apply(this, s), e);
53
53
  };
54
- }, z = (o) => {
55
- const { offsetWidth: r, offsetHeight: e } = o;
54
+ }, z = (l) => {
55
+ const { offsetWidth: r, offsetHeight: e } = l;
56
56
  return { width: r, height: e };
57
- }, B = (o) => o, H = (o) => {
58
- const r = Math.max(o.startIndex - o.overscan, 0), e = Math.min(o.endIndex + o.overscan, o.count - 1), t = [];
57
+ }, B = (l) => l, H = (l) => {
58
+ const r = Math.max(l.startIndex - l.overscan, 0), e = Math.min(l.endIndex + l.overscan, l.count - 1), t = [];
59
59
  for (let s = r; s <= e; s++)
60
60
  t.push(s);
61
61
  return t;
62
- }, $ = (o, r) => {
63
- const e = o.scrollElement;
62
+ }, $ = (l, r) => {
63
+ const e = l.scrollElement;
64
64
  if (!e)
65
65
  return;
66
- const t = o.targetWindow;
66
+ const t = l.targetWindow;
67
67
  if (!t)
68
68
  return;
69
- const s = (i) => {
70
- const { width: l, height: a } = i;
71
- r({ width: Math.round(l), height: Math.round(a) });
69
+ const s = (o) => {
70
+ const { width: i, height: a } = o;
71
+ r({ width: Math.round(i), height: Math.round(a) });
72
72
  };
73
73
  if (s(z(e)), !t.ResizeObserver)
74
74
  return () => {
75
75
  };
76
- const n = new t.ResizeObserver((i) => {
77
- const l = () => {
78
- const a = i[0];
76
+ const n = new t.ResizeObserver((o) => {
77
+ const i = () => {
78
+ const a = o[0];
79
79
  if (a?.borderBoxSize) {
80
80
  const u = a.borderBoxSize[0];
81
81
  if (u) {
@@ -85,38 +85,38 @@ const j = (o, r) => Math.abs(o - r) < 1.01, P = (o, r, e) => {
85
85
  }
86
86
  s(z(e));
87
87
  };
88
- o.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(l) : l();
88
+ l.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(i) : i();
89
89
  });
90
90
  return n.observe(e, { box: "border-box" }), () => {
91
91
  n.unobserve(e);
92
92
  };
93
- }, _ = {
93
+ }, A = {
94
94
  passive: !0
95
- }, A = typeof window > "u" ? !0 : "onscrollend" in window, q = (o, r) => {
96
- const e = o.scrollElement;
95
+ }, R = typeof window > "u" ? !0 : "onscrollend" in window, q = (l, r) => {
96
+ const e = l.scrollElement;
97
97
  if (!e)
98
98
  return;
99
- const t = o.targetWindow;
99
+ const t = l.targetWindow;
100
100
  if (!t)
101
101
  return;
102
102
  let s = 0;
103
- const n = o.options.useScrollendEvent && A ? () => {
103
+ const n = l.options.useScrollendEvent && R ? () => {
104
104
  } : P(
105
105
  t,
106
106
  () => {
107
107
  r(s, !1);
108
108
  },
109
- o.options.isScrollingResetDelay
110
- ), i = (c) => () => {
111
- const { horizontal: d, isRtl: h } = o.options;
109
+ l.options.isScrollingResetDelay
110
+ ), o = (c) => () => {
111
+ const { horizontal: d, isRtl: h } = l.options;
112
112
  s = d ? e.scrollLeft * (h && -1 || 1) : e.scrollTop, n(), r(s, c);
113
- }, l = i(!0), a = i(!1);
114
- e.addEventListener("scroll", l, _);
115
- const u = o.options.useScrollendEvent && A;
116
- return u && e.addEventListener("scrollend", a, _), () => {
117
- e.removeEventListener("scroll", l), u && e.removeEventListener("scrollend", a);
113
+ }, i = o(!0), a = o(!1);
114
+ e.addEventListener("scroll", i, A);
115
+ const u = l.options.useScrollendEvent && R;
116
+ return u && e.addEventListener("scrollend", a, A), () => {
117
+ e.removeEventListener("scroll", i), u && e.removeEventListener("scrollend", a);
118
118
  };
119
- }, U = (o, r, e) => {
119
+ }, K = (l, r, e) => {
120
120
  if (r?.borderBoxSize) {
121
121
  const t = r.borderBoxSize[0];
122
122
  if (t)
@@ -124,15 +124,15 @@ const j = (o, r) => Math.abs(o - r) < 1.01, P = (o, r, e) => {
124
124
  t[e.options.horizontal ? "inlineSize" : "blockSize"]
125
125
  );
126
126
  }
127
- return o[e.options.horizontal ? "offsetWidth" : "offsetHeight"];
128
- }, K = (o, {
127
+ return l[e.options.horizontal ? "offsetWidth" : "offsetHeight"];
128
+ }, U = (l, {
129
129
  adjustments: r = 0,
130
130
  behavior: e
131
131
  }, t) => {
132
132
  var s, n;
133
- const i = o + r;
133
+ const o = l + r;
134
134
  (n = (s = t.scrollElement) == null ? void 0 : s.scrollTo) == null || n.call(s, {
135
- [t.options.horizontal ? "left" : "top"]: i,
135
+ [t.options.horizontal ? "left" : "top"]: o,
136
136
  behavior: e
137
137
  });
138
138
  };
@@ -145,10 +145,18 @@ class X {
145
145
  let e = null;
146
146
  const t = () => e || (!this.targetWindow || !this.targetWindow.ResizeObserver ? null : e = new this.targetWindow.ResizeObserver((s) => {
147
147
  s.forEach((n) => {
148
- const i = () => {
149
- this._measureElement(n.target, n);
148
+ const o = () => {
149
+ const i = n.target, a = this.indexFromElement(i);
150
+ if (!i.isConnected) {
151
+ this.observer.unobserve(i);
152
+ return;
153
+ }
154
+ this.shouldMeasureDuringScroll(a) && this.resizeItem(
155
+ a,
156
+ this.options.measureElement(i, n, this)
157
+ );
150
158
  };
151
- this.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(i) : i();
159
+ this.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(o) : o();
152
160
  });
153
161
  }));
154
162
  return {
@@ -181,7 +189,7 @@ class X {
181
189
  rangeExtractor: H,
182
190
  onChange: () => {
183
191
  },
184
- measureElement: U,
192
+ measureElement: K,
185
193
  initialRect: { width: 0, height: 0 },
186
194
  scrollMargin: 0,
187
195
  gap: 0,
@@ -245,17 +253,17 @@ class X {
245
253
  }
246
254
  }, this.rafId = null, this.getSize = () => this.options.enabled ? (this.scrollRect = this.scrollRect ?? this.options.initialRect, this.scrollRect[this.options.horizontal ? "width" : "height"]) : (this.scrollRect = null, 0), this.getScrollOffset = () => this.options.enabled ? (this.scrollOffset = this.scrollOffset ?? (typeof this.options.initialOffset == "function" ? this.options.initialOffset() : this.options.initialOffset), this.scrollOffset) : (this.scrollOffset = null, 0), this.getFurthestMeasurement = (e, t) => {
247
255
  const s = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
248
- for (let i = t - 1; i >= 0; i--) {
249
- const l = e[i];
250
- if (s.has(l.lane))
256
+ for (let o = t - 1; o >= 0; o--) {
257
+ const i = e[o];
258
+ if (s.has(i.lane))
251
259
  continue;
252
260
  const a = n.get(
253
- l.lane
261
+ i.lane
254
262
  );
255
- if (a == null || l.end > a.end ? n.set(l.lane, l) : l.end < a.end && s.set(l.lane, !0), s.size === this.options.lanes)
263
+ if (a == null || i.end > a.end ? n.set(i.lane, i) : i.end < a.end && s.set(i.lane, !0), s.size === this.options.lanes)
256
264
  break;
257
265
  }
258
- return n.size === this.options.lanes ? Array.from(n.values()).sort((i, l) => i.end === l.end ? i.index - l.index : i.end - l.end)[0] : void 0;
266
+ return n.size === this.options.lanes ? Array.from(n.values()).sort((o, i) => o.end === i.end ? o.index - i.index : o.end - i.end)[0] : void 0;
259
267
  }, this.getMeasurementOptions = x(
260
268
  () => [
261
269
  this.options.count,
@@ -265,21 +273,21 @@ class X {
265
273
  this.options.enabled,
266
274
  this.options.lanes
267
275
  ],
268
- (e, t, s, n, i, l) => (this.prevLanes !== void 0 && this.prevLanes !== l && (this.lanesChangedFlag = !0), this.prevLanes = l, this.pendingMeasuredCacheIndexes = [], {
276
+ (e, t, s, n, o, i) => (this.prevLanes !== void 0 && this.prevLanes !== i && (this.lanesChangedFlag = !0), this.prevLanes = i, this.pendingMeasuredCacheIndexes = [], {
269
277
  count: e,
270
278
  paddingStart: t,
271
279
  scrollMargin: s,
272
280
  getItemKey: n,
273
- enabled: i,
274
- lanes: l
281
+ enabled: o,
282
+ lanes: i
275
283
  }),
276
284
  {
277
285
  key: !1
278
286
  }
279
287
  ), this.getMeasurements = x(
280
288
  () => [this.getMeasurementOptions(), this.itemSizeCache],
281
- ({ count: e, paddingStart: t, scrollMargin: s, getItemKey: n, enabled: i, lanes: l }, a) => {
282
- if (!i)
289
+ ({ count: e, paddingStart: t, scrollMargin: s, getItemKey: n, enabled: o, lanes: i }, a) => {
290
+ if (!o)
283
291
  return this.measurementsCache = [], this.itemSizeCache.clear(), this.laneAssignments.clear(), [];
284
292
  if (this.laneAssignments.size > e)
285
293
  for (const h of this.laneAssignments.keys())
@@ -289,7 +297,7 @@ class X {
289
297
  }));
290
298
  const u = this.lanesSettling ? 0 : this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
291
299
  this.pendingMeasuredCacheIndexes = [], this.lanesSettling && this.measurementsCache.length === e && (this.lanesSettling = !1);
292
- const c = this.measurementsCache.slice(0, u), d = new Array(l).fill(
300
+ const c = this.measurementsCache.slice(0, u), d = new Array(i).fill(
293
301
  void 0
294
302
  );
295
303
  for (let h = 0; h < u; h++) {
@@ -352,9 +360,9 @@ class X {
352
360
  t
353
361
  ];
354
362
  },
355
- (e, t, s, n, i) => n === null || i === null ? [] : e({
363
+ (e, t, s, n, o) => n === null || o === null ? [] : e({
356
364
  startIndex: n,
357
- endIndex: i,
365
+ endIndex: o,
358
366
  overscan: t,
359
367
  count: s
360
368
  }),
@@ -376,47 +384,37 @@ class X {
376
384
  const n = Math.max(
377
385
  this.options.overscan,
378
386
  Math.ceil((this.range.endIndex - this.range.startIndex) / 2)
379
- ), i = Math.max(0, s - n), l = Math.min(
387
+ ), o = Math.max(0, s - n), i = Math.min(
380
388
  this.options.count - 1,
381
389
  s + n
382
390
  );
383
- return e >= i && e <= l;
391
+ return e >= o && e <= i;
384
392
  }
385
393
  return !0;
386
- }, this._measureElement = (e, t) => {
387
- if (!e.isConnected) {
388
- this.observer.unobserve(e);
394
+ }, this.measureElement = (e) => {
395
+ if (!e) {
396
+ this.elementsCache.forEach((o, i) => {
397
+ o.isConnected || (this.observer.unobserve(o), this.elementsCache.delete(i));
398
+ });
389
399
  return;
390
400
  }
391
- const s = this.indexFromElement(e), n = this.measurementsCache[s];
392
- if (!n)
393
- return;
394
- const i = n.key, l = this.elementsCache.get(i);
395
- l !== e && (l && this.observer.unobserve(l), this.observer.observe(e), this.elementsCache.set(i, e)), this.shouldMeasureDuringScroll(s) && this.resizeItem(s, this.options.measureElement(e, t, this));
401
+ const t = this.indexFromElement(e), s = this.options.getItemKey(t), n = this.elementsCache.get(s);
402
+ n !== e && (n && this.observer.unobserve(n), this.observer.observe(e), this.elementsCache.set(s, e)), (!this.isScrolling || this.scrollState) && this.shouldMeasureDuringScroll(t) && this.resizeItem(t, this.options.measureElement(e, void 0, this));
396
403
  }, this.resizeItem = (e, t) => {
397
404
  var s;
398
405
  const n = this.measurementsCache[e];
399
- if (!n)
400
- return;
401
- const i = this.itemSizeCache.get(n.key) ?? n.size, l = t - i;
402
- l !== 0 && (((s = this.scrollState) == null ? void 0 : s.behavior) !== "smooth" && (this.shouldAdjustScrollPositionOnItemSizeChange !== void 0 ? this.shouldAdjustScrollPositionOnItemSizeChange(n, l, this) : n.start < this.getScrollOffset() + this.scrollAdjustments) && (process.env.NODE_ENV !== "production" && this.options.debug && console.info("correction", l), this._scrollToOffset(this.getScrollOffset(), {
403
- adjustments: this.scrollAdjustments += l,
406
+ if (!n) return;
407
+ const o = this.itemSizeCache.get(n.key) ?? n.size, i = t - o;
408
+ i !== 0 && (((s = this.scrollState) == null ? void 0 : s.behavior) !== "smooth" && (this.shouldAdjustScrollPositionOnItemSizeChange !== void 0 ? this.shouldAdjustScrollPositionOnItemSizeChange(n, i, this) : n.start < this.getScrollOffset() + this.scrollAdjustments) && (process.env.NODE_ENV !== "production" && this.options.debug && console.info("correction", i), this._scrollToOffset(this.getScrollOffset(), {
409
+ adjustments: this.scrollAdjustments += i,
404
410
  behavior: void 0
405
411
  })), this.pendingMeasuredCacheIndexes.push(n.index), this.itemSizeCache = new Map(this.itemSizeCache.set(n.key, t)), this.notify(!1));
406
- }, this.measureElement = (e) => {
407
- if (!e) {
408
- this.elementsCache.forEach((t, s) => {
409
- t.isConnected || (this.observer.unobserve(t), this.elementsCache.delete(s));
410
- });
411
- return;
412
- }
413
- this._measureElement(e, void 0);
414
412
  }, this.getVirtualItems = x(
415
413
  () => [this.getVirtualIndexes(), this.getMeasurements()],
416
414
  (e, t) => {
417
415
  const s = [];
418
- for (let n = 0, i = e.length; n < i; n++) {
419
- const l = e[n], a = t[l];
416
+ for (let n = 0, o = e.length; n < o; n++) {
417
+ const i = e[n], a = t[i];
420
418
  s.push(a);
421
419
  }
422
420
  return s;
@@ -428,11 +426,11 @@ class X {
428
426
  ), this.getVirtualItemForOffset = (e) => {
429
427
  const t = this.getMeasurements();
430
428
  if (t.length !== 0)
431
- return I(
429
+ return C(
432
430
  t[F(
433
431
  0,
434
432
  t.length - 1,
435
- (s) => I(t[s]).start,
433
+ (s) => C(t[s]).start,
436
434
  e
437
435
  )]
438
436
  );
@@ -446,35 +444,35 @@ class X {
446
444
  }
447
445
  }, this.getOffsetForAlignment = (e, t, s = 0) => {
448
446
  if (!this.scrollElement) return 0;
449
- const n = this.getSize(), i = this.getScrollOffset();
450
- t === "auto" && (t = e >= i + n ? "end" : "start"), t === "center" ? e += (s - n) / 2 : t === "end" && (e -= n);
451
- const l = this.getMaxScrollOffset();
452
- return Math.max(Math.min(l, e), 0);
447
+ const n = this.getSize(), o = this.getScrollOffset();
448
+ t === "auto" && (t = e >= o + n ? "end" : "start"), t === "center" ? e += (s - n) / 2 : t === "end" && (e -= n);
449
+ const i = this.getMaxScrollOffset();
450
+ return Math.max(Math.min(i, e), 0);
453
451
  }, this.getOffsetForIndex = (e, t = "auto") => {
454
452
  e = Math.max(0, Math.min(e, this.options.count - 1));
455
- const s = this.getSize(), n = this.getScrollOffset(), i = this.measurementsCache[e];
456
- if (!i) return;
453
+ const s = this.getSize(), n = this.getScrollOffset(), o = this.measurementsCache[e];
454
+ if (!o) return;
457
455
  if (t === "auto")
458
- if (i.end >= n + s - this.options.scrollPaddingEnd)
456
+ if (o.end >= n + s - this.options.scrollPaddingEnd)
459
457
  t = "end";
460
- else if (i.start <= n + this.options.scrollPaddingStart)
458
+ else if (o.start <= n + this.options.scrollPaddingStart)
461
459
  t = "start";
462
460
  else
463
461
  return [n, t];
464
462
  if (t === "end" && e === this.options.count - 1)
465
463
  return [this.getMaxScrollOffset(), t];
466
- const l = t === "end" ? i.end + this.options.scrollPaddingEnd : i.start - this.options.scrollPaddingStart;
464
+ const i = t === "end" ? o.end + this.options.scrollPaddingEnd : o.start - this.options.scrollPaddingStart;
467
465
  return [
468
- this.getOffsetForAlignment(l, t, i.size),
466
+ this.getOffsetForAlignment(i, t, o.size),
469
467
  t
470
468
  ];
471
469
  }, this.scrollToOffset = (e, { align: t = "start", behavior: s = "auto" } = {}) => {
472
- const n = this.getOffsetForAlignment(e, t), i = this.now();
470
+ const n = this.getOffsetForAlignment(e, t), o = this.now();
473
471
  this.scrollState = {
474
472
  index: null,
475
473
  align: t,
476
474
  behavior: s,
477
- startedAt: i,
475
+ startedAt: o,
478
476
  lastTargetOffset: n,
479
477
  stableFrames: 0
480
478
  }, this._scrollToOffset(n, { adjustments: void 0, behavior: s }), this.scheduleScrollReconcile();
@@ -486,15 +484,15 @@ class X {
486
484
  const n = this.getOffsetForIndex(e, t);
487
485
  if (!n)
488
486
  return;
489
- const [i, l] = n, a = this.now();
487
+ const [o, i] = n, a = this.now();
490
488
  this.scrollState = {
491
489
  index: e,
492
- align: l,
490
+ align: i,
493
491
  behavior: s,
494
492
  startedAt: a,
495
- lastTargetOffset: i,
493
+ lastTargetOffset: o,
496
494
  stableFrames: 0
497
- }, this._scrollToOffset(i, { adjustments: void 0, behavior: s }), this.scheduleScrollReconcile();
495
+ }, this._scrollToOffset(o, { adjustments: void 0, behavior: s }), this.scheduleScrollReconcile();
498
496
  }, this.scrollBy = (e, { behavior: t = "auto" } = {}) => {
499
497
  const s = this.getScrollOffset() + e, n = this.now();
500
498
  this.scrollState = {
@@ -515,12 +513,12 @@ class X {
515
513
  s = ((e = t[t.length - 1]) == null ? void 0 : e.end) ?? 0;
516
514
  else {
517
515
  const n = Array(this.options.lanes).fill(null);
518
- let i = t.length - 1;
519
- for (; i >= 0 && n.some((l) => l === null); ) {
520
- const l = t[i];
521
- n[l.lane] === null && (n[l.lane] = l.end), i--;
516
+ let o = t.length - 1;
517
+ for (; o >= 0 && n.some((i) => i === null); ) {
518
+ const i = t[o];
519
+ n[i.lane] === null && (n[i.lane] = i.end), o--;
522
520
  }
523
- s = Math.max(...n.filter((l) => l !== null));
521
+ s = Math.max(...n.filter((i) => i !== null));
524
522
  }
525
523
  return Math.max(
526
524
  s - this.options.scrollMargin + this.options.paddingEnd,
@@ -550,107 +548,107 @@ class X {
550
548
  this.scrollState = null;
551
549
  return;
552
550
  }
553
- const t = this.scrollState.index != null ? this.getOffsetForIndex(this.scrollState.index, this.scrollState.align) : void 0, s = t ? t[0] : this.scrollState.lastTargetOffset, n = 1, i = s !== this.scrollState.lastTargetOffset;
554
- if (!i && j(s, this.getScrollOffset())) {
551
+ const t = this.scrollState.index != null ? this.getOffsetForIndex(this.scrollState.index, this.scrollState.align) : void 0, s = t ? t[0] : this.scrollState.lastTargetOffset, n = 1, o = s !== this.scrollState.lastTargetOffset;
552
+ if (!o && j(s, this.getScrollOffset())) {
555
553
  if (this.scrollState.stableFrames++, this.scrollState.stableFrames >= n) {
556
554
  this.scrollState = null;
557
555
  return;
558
556
  }
559
557
  } else
560
- this.scrollState.stableFrames = 0, i && (this.scrollState.lastTargetOffset = s, this.scrollState.behavior = "auto", this._scrollToOffset(s, {
558
+ this.scrollState.stableFrames = 0, o && (this.scrollState.lastTargetOffset = s, this.scrollState.behavior = "auto", this._scrollToOffset(s, {
561
559
  adjustments: void 0,
562
560
  behavior: "auto"
563
561
  }));
564
562
  this.scheduleScrollReconcile();
565
563
  }
566
564
  }
567
- const F = (o, r, e, t) => {
568
- for (; o <= r; ) {
569
- const s = (o + r) / 2 | 0, n = e(s);
565
+ const F = (l, r, e, t) => {
566
+ for (; l <= r; ) {
567
+ const s = (l + r) / 2 | 0, n = e(s);
570
568
  if (n < t)
571
- o = s + 1;
569
+ l = s + 1;
572
570
  else if (n > t)
573
571
  r = s - 1;
574
572
  else
575
573
  return s;
576
574
  }
577
- return o > 0 ? o - 1 : 0;
575
+ return l > 0 ? l - 1 : 0;
578
576
  };
579
577
  function G({
580
- measurements: o,
578
+ measurements: l,
581
579
  outerSize: r,
582
580
  scrollOffset: e,
583
581
  lanes: t
584
582
  }) {
585
- const s = o.length - 1, n = (a) => o[a].start;
586
- if (o.length <= t)
583
+ const s = l.length - 1, n = (a) => l[a].start;
584
+ if (l.length <= t)
587
585
  return {
588
586
  startIndex: 0,
589
587
  endIndex: s
590
588
  };
591
- let i = F(
589
+ let o = F(
592
590
  0,
593
591
  s,
594
592
  n,
595
593
  e
596
- ), l = i;
594
+ ), i = o;
597
595
  if (t === 1)
598
- for (; l < s && o[l].end < e + r; )
599
- l++;
596
+ for (; i < s && l[i].end < e + r; )
597
+ i++;
600
598
  else if (t > 1) {
601
599
  const a = Array(t).fill(0);
602
- for (; l < s && a.some((c) => c < e + r); ) {
603
- const c = o[l];
604
- a[c.lane] = c.end, l++;
600
+ for (; i < s && a.some((c) => c < e + r); ) {
601
+ const c = l[i];
602
+ a[c.lane] = c.end, i++;
605
603
  }
606
604
  const u = Array(t).fill(e + r);
607
- for (; i >= 0 && u.some((c) => c >= e); ) {
608
- const c = o[i];
609
- u[c.lane] = c.start, i--;
605
+ for (; o >= 0 && u.some((c) => c >= e); ) {
606
+ const c = l[o];
607
+ u[c.lane] = c.start, o--;
610
608
  }
611
- i = Math.max(0, i - i % t), l = Math.min(s, l + (t - 1 - l % t));
609
+ o = Math.max(0, o - o % t), i = Math.min(s, i + (t - 1 - i % t));
612
610
  }
613
- return { startIndex: i, endIndex: l };
611
+ return { startIndex: o, endIndex: i };
614
612
  }
615
- const R = typeof document < "u" ? w.useLayoutEffect : w.useEffect;
613
+ const _ = typeof document < "u" ? w.useLayoutEffect : w.useEffect;
616
614
  function J({
617
- useFlushSync: o = !0,
615
+ useFlushSync: l = !0,
618
616
  ...r
619
617
  }) {
620
618
  const e = w.useReducer(() => ({}), {})[1], t = {
621
619
  ...r,
622
- onChange: (n, i) => {
623
- var l;
624
- o && i ? D(e) : e(), (l = r.onChange) == null || l.call(r, n, i);
620
+ onChange: (n, o) => {
621
+ var i;
622
+ l && o ? L(e) : e(), (i = r.onChange) == null || i.call(r, n, o);
625
623
  }
626
624
  }, [s] = w.useState(
627
625
  () => new X(t)
628
626
  );
629
- return s.setOptions(t), R(() => s._didMount(), []), R(() => s._willUpdate()), s;
627
+ return s.setOptions(t), _(() => s._didMount(), []), _(() => s._willUpdate()), s;
630
628
  }
631
- function Q(o) {
629
+ function Q(l) {
632
630
  return J({
633
631
  observeElementRect: $,
634
632
  observeElementOffset: q,
635
- scrollToFn: K,
636
- ...o
633
+ scrollToFn: U,
634
+ ...l
637
635
  });
638
636
  }
639
- const le = ({
640
- showFlagOnSearch: o,
637
+ const oe = ({
638
+ showFlagOnSearch: l,
641
639
  showNameOnSearch: r
642
640
  }) => {
643
- const e = T(null), { termOfSearch: t, countries: s, handleSelectCountry: n } = V(), i = k(() => s.filter(
641
+ const e = T(null), { termOfSearch: t, countries: s, handleSelectCountry: n } = V(), o = k(() => s.filter(
644
642
  (a) => a.name.toLocaleLowerCase().includes(t.toLowerCase())
645
- ), [t]), l = Q({
646
- count: i.length,
643
+ ), [t]), i = Q({
644
+ count: o.length,
647
645
  overscan: 5,
648
646
  getScrollElement: () => e.current,
649
647
  estimateSize: () => 40
650
648
  });
651
- return L(() => {
652
- i.length > 0 && l.scrollToIndex(0);
653
- }, [t, l]), i.length === 0 ? /* @__PURE__ */ m("div", { className: "overflow-y-auto max-h-60 snap-y snap-mandatory", children: /* @__PURE__ */ m("ul", { className: "relative", children: /* @__PURE__ */ m("li", { className: "w-full flex items-center h-10 select-none px-6", children: /* @__PURE__ */ m(
649
+ return D(() => {
650
+ o.length > 0 && i.scrollToIndex(0);
651
+ }, [t, i]), o.length === 0 ? /* @__PURE__ */ m("div", { className: "overflow-y-auto max-h-60 snap-y snap-mandatory", children: /* @__PURE__ */ m("ul", { className: "relative", children: /* @__PURE__ */ m("li", { className: "w-full flex items-center h-10 select-none px-6", children: /* @__PURE__ */ m(
654
652
  y,
655
653
  {
656
654
  variant: "body2",
@@ -667,13 +665,13 @@ const le = ({
667
665
  "ul",
668
666
  {
669
667
  className: "relative",
670
- style: { height: l.getTotalSize() },
671
- children: l.getVirtualItems().map((a) => {
672
- const u = i[a.index], { flag: c, name: d, prefix: h } = u;
668
+ style: { height: i.getTotalSize() },
669
+ children: i.getVirtualItems().map((a) => {
670
+ const u = o[a.index], { flag: c, name: d, prefix: h } = u;
673
671
  return /* @__PURE__ */ m(
674
672
  "li",
675
673
  {
676
- className: C(
674
+ className: I(
677
675
  "absolute",
678
676
  "w-full",
679
677
  "snap-start",
@@ -690,7 +688,7 @@ const le = ({
690
688
  children: /* @__PURE__ */ m(
691
689
  "button",
692
690
  {
693
- className: C(
691
+ className: I(
694
692
  "w-full",
695
693
  "h-full",
696
694
  "cursor-pointer",
@@ -711,7 +709,7 @@ const le = ({
711
709
  component: "span",
712
710
  className: "flex gap-2 items-center text-left",
713
711
  children: [
714
- o && /* @__PURE__ */ m(c, {}),
712
+ l && /* @__PURE__ */ m(c, {}),
715
713
  r && /* @__PURE__ */ m(W, { text: d, prefix: h })
716
714
  ]
717
715
  }
@@ -728,5 +726,5 @@ const le = ({
728
726
  );
729
727
  };
730
728
  export {
731
- le as FlagSelectorList
729
+ oe as FlagSelectorList
732
730
  };
@@ -18,7 +18,7 @@ import { ImageUpload as k } from "./ImageUpload/ImageUpload.js";
18
18
  import { Input as G } from "./Input/Input.js";
19
19
  import { LineChart as y } from "./LineChart/LineChart.js";
20
20
  import { Loading as U } from "./Loading/Loading.js";
21
- import { M as j } from "../Modal-BTOXCb0Y.js";
21
+ import { M as j } from "../Modal-DAWdufZ_.js";
22
22
  import { MultiSelectDropdown as H } from "./MultiSelectDropdown/MultiSelectDropdown.js";
23
23
  import { PhoneNumberInput as K } from "./PhoneNumberInput/PhoneNumberInput.js";
24
24
  import { PieChart as X } from "./PieChart/PieChart.js";
package/dist/index.js CHANGED
@@ -27,7 +27,7 @@ import { LineChart as or } from "./components/LineChart/LineChart.js";
27
27
  import { List as tr } from "./components/Tabs/components/List.js";
28
28
  import { Loading as mr } from "./components/Loading/Loading.js";
29
29
  import { Logo as xr } from "./components/Sidebar/components/Logo/Logo.js";
30
- import { M as nr } from "./Modal-BTOXCb0Y.js";
30
+ import { M as nr } from "./Modal-DAWdufZ_.js";
31
31
  import { MultiSelectDropdown as sr } from "./components/MultiSelectDropdown/MultiSelectDropdown.js";
32
32
  import { Navigation as dr } from "./components/Sidebar/components/Navigation/Navigation.js";
33
33
  import { NavigationGroup as gr } from "./components/Sidebar/components/NavigationGroup/NavigationGroup.js";