@ck-ui/component-library 1.0.1 → 1.0.2

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.
Files changed (97) hide show
  1. package/dist/DropdownFooter-CsDll1Tj.js +96 -0
  2. package/dist/{Grow-D08Iq1uH.js → Grow-wzNsNKt2.js} +41 -41
  3. package/dist/IconSlot-DvUwY6Do.js +33 -0
  4. package/dist/{OptionList-DN1xZbnV.js → OptionList-BM4AleXV.js} +361 -290
  5. package/dist/{Select-Cw96VEHD.js → Select-CiuwMSD7.js} +2366 -2427
  6. package/dist/assets/DropdownFooter-JrU15UnN.css +1 -0
  7. package/dist/assets/IconSlot-BWv5PQN_.css +1 -0
  8. package/dist/assets/ReactToastify-GNLSjkBZ.css +1 -0
  9. package/dist/assets/{ToastContent-PGkBxPUW.css → ToastContent-DpF5zCks.css} +1 -1
  10. package/dist/assets/index-0R9p-l95.css +1 -0
  11. package/dist/assets/index-B3yBTtVQ.css +1 -0
  12. package/dist/assets/index-BbJZjGLb.css +1 -0
  13. package/dist/assets/{main-Dv8QUU_o.css → main-3OqLSdPm.css} +1 -1
  14. package/dist/assets/{styles-Chhklrps.css → styles-C5uYY4fL.css} +1 -1
  15. package/dist/assets/styles-CEyiQgVQ.css +1 -0
  16. package/dist/components/CKButton/_helper/ComboLayout.js +1 -1
  17. package/dist/components/CKButton/_helper/IconSlot.js +1 -1
  18. package/dist/components/CKButton/_helper/StandardLayout.js +1 -1
  19. package/dist/components/CKButton/index.js +1 -1
  20. package/dist/components/DateRangePicker/DateRangePicker.js +703 -680
  21. package/dist/components/EmptyState/index.js +7 -7
  22. package/dist/components/FusionChart/_config/builders.d.ts.map +1 -1
  23. package/dist/components/FusionChart/_config/builders.js +207 -192
  24. package/dist/components/FusionChart/_config/helpers.d.ts +3 -0
  25. package/dist/components/FusionChart/_config/helpers.d.ts.map +1 -1
  26. package/dist/components/FusionChart/_config/helpers.js +61 -45
  27. package/dist/components/FusionChart/_types/fusionChart.types.d.ts +2 -0
  28. package/dist/components/FusionChart/_types/fusionChart.types.d.ts.map +1 -1
  29. package/dist/components/FusionChart/_utils/chartHelpers.js +1 -1
  30. package/dist/components/FusionChart/index.d.ts.map +1 -1
  31. package/dist/components/FusionChart/index.js +163 -130
  32. package/dist/components/MenuOptions/_utils/computeMenuPosition.js +1 -1
  33. package/dist/components/MenuOptions/_utils/computeSubmenuPosition.js +1 -1
  34. package/dist/components/MetricCards/Component/CardWithIconAndForecast/index.js +30 -30
  35. package/dist/components/MultiSelect/SimpleMultiSelect.d.ts +3 -1
  36. package/dist/components/MultiSelect/SimpleMultiSelect.d.ts.map +1 -1
  37. package/dist/components/MultiSelect/SimpleMultiSelect.js +150 -136
  38. package/dist/components/MultiSelect/_helpers/DropdownFooter.js +1 -1
  39. package/dist/components/MultiSelect/_helpers/OptionRow.js +1 -1
  40. package/dist/components/MultiSelect/_helpers/OverflowMenu.js +1 -1
  41. package/dist/components/MultiSelect/_helpers/OverflowMenuItem.js +1 -1
  42. package/dist/components/MultiSelect/_helpers/SearchResult.d.ts +1 -1
  43. package/dist/components/MultiSelect/_helpers/SearchResult.d.ts.map +1 -1
  44. package/dist/components/MultiSelect/_helpers/SearchResult.js +31 -21
  45. package/dist/components/MultiSelect/_helpers/TagContent.js +1 -1
  46. package/dist/components/MultiSelect/_helpers/TriggerButton.d.ts.map +1 -1
  47. package/dist/components/MultiSelect/_helpers/TriggerButton.js +95 -74
  48. package/dist/components/MultiSelect/_types/type.d.ts +6 -2
  49. package/dist/components/MultiSelect/_types/type.d.ts.map +1 -1
  50. package/dist/components/MultiSelect/_utils/useDropdownDirection.d.ts +18 -0
  51. package/dist/components/MultiSelect/_utils/useDropdownDirection.d.ts.map +1 -0
  52. package/dist/components/MultiSelect/_utils/useDropdownDirection.js +23 -0
  53. package/dist/components/MultiSelect/index.d.ts +1 -1
  54. package/dist/components/MultiSelect/index.d.ts.map +1 -1
  55. package/dist/components/MultiSelect/index.js +162 -151
  56. package/dist/components/PopupAndDialogBox/components/DialogContent.js +1 -1
  57. package/dist/components/PopupAndDialogBox/components/DialogFooter.js +1 -1
  58. package/dist/components/PopupAndDialogBox/components/DialogHeader.js +1 -1
  59. package/dist/components/PopupAndDialogBox/index.js +1 -1
  60. package/dist/components/Search/index.d.ts.map +1 -1
  61. package/dist/components/Search/index.js +63 -61
  62. package/dist/components/SingleSelectDropdown/_helpers/DropdownFooter.js +3 -3
  63. package/dist/components/SingleSelectDropdown/index.d.ts.map +1 -1
  64. package/dist/components/SingleSelectDropdown/index.js +83 -78
  65. package/dist/components/Table/_helpers/ColumnManager/index.js +3 -3
  66. package/dist/components/Table/_helpers/GroupedHeader/index.js +1 -1
  67. package/dist/components/Table/_helpers/TableFilterModal/OptionList.js +1 -1
  68. package/dist/components/Table/_helpers/TableFilterModal/RangeSelector.js +133 -142
  69. package/dist/components/Table/_helpers/TableFilterModal/index.js +1 -1
  70. package/dist/components/Table/_helpers/TableRows.js +1 -1
  71. package/dist/components/Table/index.js +2 -2
  72. package/dist/components/TextField/index.js +331 -328
  73. package/dist/components/Toast/_helper/ToastContent.js +25 -25
  74. package/dist/components/Toast/_helper/ToastProvider.js +9 -9
  75. package/dist/components/Toast/_hooks/useToast.js +1 -1
  76. package/dist/components/Tooltip/index.js +772 -697
  77. package/dist/createSimplePaletteValueFilter-BqxST_wX.js +24 -0
  78. package/dist/index-BR6M9zUI.js +382 -0
  79. package/dist/{index-f7TB87Mf.js → index-Bcvmezbu.js} +23 -3
  80. package/dist/main.js +1 -1
  81. package/dist/styles.module-yIHBMSTk.js +53 -0
  82. package/dist/styles.module-yNDMDNO-.js +14 -0
  83. package/dist/{useSlot-ylt7_lTY.js → useSlot-BiMlGawc.js} +656 -623
  84. package/package.json +3 -3
  85. package/dist/DropdownFooter-Dm6aLDx8.js +0 -89
  86. package/dist/IconSlot-CPQsGPB-.js +0 -33
  87. package/dist/assets/DropdownFooter-DjdPf69A.css +0 -1
  88. package/dist/assets/IconSlot-D8WWEHKb.css +0 -1
  89. package/dist/assets/ReactToastify-tlSLHgLC.css +0 -1
  90. package/dist/assets/index-B81zpOpq.css +0 -1
  91. package/dist/assets/index-DNhNBxL9.css +0 -1
  92. package/dist/assets/index-YHUWVH17.css +0 -1
  93. package/dist/assets/styles-Bj-7zn37.css +0 -1
  94. package/dist/contains-kLLEGdNH.js +0 -41
  95. package/dist/index-C8cPPHJD.js +0 -1196
  96. package/dist/styles.module-BZaUJMlf.js +0 -14
  97. package/dist/styles.module-DakCndIP.js +0 -42
@@ -1,30 +1,30 @@
1
- import { jsxs as w, jsx as b } from "react/jsx-runtime";
2
- import * as T from "react";
3
- import { useState as j, useRef as F, useEffect as V, useMemo as K } from "react";
4
- import { flushSync as P } from "react-dom";
5
- import { CKCheckbox as B } from "./components/CKCheckbox/index.js";
6
- import H from "./components/Table/_helpers/TableFilterModal/OptionListItems.js";
7
- import { S as J } from "./search-B_cup-NN.js";
8
- import { Typography as z } from "./components/Typography/index.js";
1
+ import { jsxs as x, jsx as y } from "react/jsx-runtime";
2
+ import * as M from "react";
3
+ import { useState as W, useRef as j, useEffect as F, useMemo as V } from "react";
4
+ import { flushSync as K } from "react-dom";
5
+ import { CKCheckbox as P } from "./components/CKCheckbox/index.js";
6
+ import B from "./components/Table/_helpers/TableFilterModal/OptionListItems.js";
7
+ import { S as H } from "./search-B_cup-NN.js";
8
+ import { Typography as T } from "./components/Typography/index.js";
9
9
  import { Switch as $ } from "./components/Switch/index.js";
10
- function q(l, c, t) {
10
+ function J(l, u, t) {
11
11
  const e = new Array(l);
12
12
  return new Proxy(e, {
13
- get(s, n, i) {
13
+ get(s, n, o) {
14
14
  if (typeof n == "string") {
15
- const o = n.charCodeAt(0);
16
- if (o >= 48 && o <= 57) {
15
+ const i = n.charCodeAt(0);
16
+ if (i >= 48 && i <= 57) {
17
17
  const r = +n;
18
18
  if (Number.isInteger(r) && r >= 0 && r < l) {
19
19
  let a = s[r];
20
20
  if (!a) {
21
- const h = c[r * 2];
21
+ const h = u[r * 2];
22
22
  a = s[r] = {
23
23
  index: r,
24
24
  key: t(r),
25
25
  start: h,
26
- size: c[r * 2 + 1],
27
- end: h + c[r * 2 + 1],
26
+ size: u[r * 2 + 1],
27
+ end: h + u[r * 2 + 1],
28
28
  lane: 0
29
29
  };
30
30
  }
@@ -33,30 +33,30 @@ function q(l, c, t) {
33
33
  }
34
34
  if (n === "length") return l;
35
35
  }
36
- return Reflect.get(s, n, i);
36
+ return Reflect.get(s, n, o);
37
37
  }
38
38
  });
39
39
  }
40
- function x(l, c, t) {
40
+ function z(l, u, t) {
41
41
  let e = t.initialDeps ?? [], s, n = !0;
42
- function i() {
43
- var o;
44
- const r = process.env.NODE_ENV !== "production" && !!t.key && !!((o = t.debug) != null && o.call(t));
42
+ function o() {
43
+ var i;
44
+ const r = process.env.NODE_ENV !== "production" && !!t.key && !!((i = t.debug) != null && i.call(t));
45
45
  let a = 0;
46
46
  r && (a = Date.now());
47
47
  const h = l();
48
- if (!(h.length !== e.length || h.some((S, u) => e[u] !== S)))
48
+ if (!(h.length !== e.length || h.some((v, d) => e[d] !== v)))
49
49
  return s;
50
50
  e = h;
51
- let d = 0;
52
- if (r && (d = Date.now()), s = c(...h), r) {
53
- const S = Math.round((Date.now() - a) * 100) / 100, u = Math.round((Date.now() - d) * 100) / 100, f = u / 16, g = (m, E) => {
54
- for (m = String(m); m.length < E; )
55
- m = " " + m;
56
- return m;
51
+ let c = 0;
52
+ if (r && (c = Date.now()), s = u(...h), r) {
53
+ const v = Math.round((Date.now() - a) * 100) / 100, d = Math.round((Date.now() - c) * 100) / 100, f = d / 16, S = (g, b) => {
54
+ for (g = String(g); g.length < b; )
55
+ g = " " + g;
56
+ return g;
57
57
  };
58
58
  console.info(
59
- `%c⏱ ${g(u, 5)} /${g(S, 5)} ms`,
59
+ `%c⏱ ${S(d, 5)} /${S(v, 5)} ms`,
60
60
  `
61
61
  font-size: .6rem;
62
62
  font-weight: bold;
@@ -69,53 +69,53 @@ function x(l, c, t) {
69
69
  }
70
70
  return t?.onChange && !(n && t.skipInitialOnChange) && t.onChange(s), n = !1, s;
71
71
  }
72
- return i.updateDeps = (o) => {
73
- e = o;
74
- }, i;
72
+ return o.updateDeps = (i) => {
73
+ e = i;
74
+ }, o;
75
75
  }
76
- function k(l, c) {
76
+ function D(l, u) {
77
77
  if (l === void 0)
78
78
  throw new Error("Unexpected undefined");
79
79
  return l;
80
80
  }
81
- const R = (l, c) => Math.abs(l - c) < 1.01, U = (l, c, t) => {
81
+ const q = (l, u) => Math.abs(l - u) < 1.01, U = (l, u, t) => {
82
82
  let e;
83
83
  return function(...s) {
84
- l.clearTimeout(e), e = l.setTimeout(() => c.apply(this, s), t);
84
+ l.clearTimeout(e), e = l.setTimeout(() => u.apply(this, s), t);
85
85
  };
86
86
  };
87
- let _;
88
- const D = () => {
89
- if (_ !== void 0) return _;
90
- if (typeof navigator > "u") return _ = !1;
91
- if (/iP(hone|od|ad)/.test(navigator.userAgent)) return _ = !0;
87
+ let I;
88
+ const A = () => {
89
+ if (I !== void 0) return I;
90
+ if (typeof navigator > "u") return I = !1;
91
+ if (/iP(hone|od|ad)/.test(navigator.userAgent)) return I = !0;
92
92
  const l = navigator.maxTouchPoints;
93
- return _ = navigator.platform === "MacIntel" && l !== void 0 && l > 0;
93
+ return I = navigator.platform === "MacIntel" && l !== void 0 && l > 0;
94
94
  }, L = (l) => {
95
- const { offsetWidth: c, offsetHeight: t } = l;
96
- return { width: c, height: t };
95
+ const { offsetWidth: u, offsetHeight: t } = l;
96
+ return { width: u, height: t };
97
97
  }, X = (l) => l, G = (l) => {
98
- const c = Math.max(l.startIndex - l.overscan, 0), e = Math.min(l.endIndex + l.overscan, l.count - 1) - c + 1, s = new Array(e);
98
+ const u = Math.max(l.startIndex - l.overscan, 0), e = Math.min(l.endIndex + l.overscan, l.count - 1) - u + 1, s = new Array(e);
99
99
  for (let n = 0; n < e; n++)
100
- s[n] = c + n;
100
+ s[n] = u + n;
101
101
  return s;
102
- }, Q = (l, c) => {
102
+ }, Q = (l, u) => {
103
103
  const t = l.scrollElement;
104
104
  if (!t)
105
105
  return;
106
106
  const e = l.targetWindow;
107
107
  if (!e)
108
108
  return;
109
- const s = (i) => {
110
- const { width: o, height: r } = i;
111
- c({ width: Math.round(o), height: Math.round(r) });
109
+ const s = (o) => {
110
+ const { width: i, height: r } = o;
111
+ u({ width: Math.round(i), height: Math.round(r) });
112
112
  };
113
113
  if (s(L(t)), !e.ResizeObserver)
114
114
  return () => {
115
115
  };
116
- const n = new e.ResizeObserver((i) => {
117
- const o = () => {
118
- const r = i[0];
116
+ const n = new e.ResizeObserver((o) => {
117
+ const i = () => {
118
+ const r = o[0];
119
119
  if (r?.borderBoxSize) {
120
120
  const a = r.borderBoxSize[0];
121
121
  if (a) {
@@ -125,14 +125,14 @@ const D = () => {
125
125
  }
126
126
  s(L(t));
127
127
  };
128
- l.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(o) : o();
128
+ l.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(i) : i();
129
129
  });
130
130
  return n.observe(t, { box: "border-box" }), () => {
131
131
  n.unobserve(t);
132
132
  };
133
133
  }, C = {
134
134
  passive: !0
135
- }, Y = typeof window > "u" ? !0 : "onscrollend" in window, Z = (l, c, t) => {
135
+ }, Y = typeof window > "u" ? !0 : "onscrollend" in window, Z = (l, u, t) => {
136
136
  const e = l.scrollElement;
137
137
  if (!e)
138
138
  return;
@@ -140,41 +140,50 @@ const D = () => {
140
140
  if (!s)
141
141
  return;
142
142
  const n = l.options.useScrollendEvent && Y;
143
- let i = 0;
144
- const o = n ? null : U(
143
+ let o = 0;
144
+ const i = n ? null : U(
145
145
  s,
146
- () => c(i, !1),
146
+ () => u(o, !1),
147
147
  l.options.isScrollingResetDelay
148
148
  ), r = (p) => () => {
149
- i = t(e), o?.(), c(i, p);
149
+ o = t(e), i?.(), u(o, p);
150
150
  }, a = r(!0), h = r(!1);
151
151
  return e.addEventListener("scroll", a, C), n && e.addEventListener("scrollend", h, C), () => {
152
152
  e.removeEventListener("scroll", a), n && e.removeEventListener("scrollend", h);
153
153
  };
154
- }, tt = (l, c) => Z(l, c, (t) => {
154
+ }, tt = (l, u) => Z(l, u, (t) => {
155
155
  const { horizontal: e, isRtl: s } = l.options;
156
156
  return e ? t.scrollLeft * (s && -1 || 1) : t.scrollTop;
157
- }), et = (l, c, t) => {
158
- if (c?.borderBoxSize) {
159
- const e = c.borderBoxSize[0];
157
+ }), et = (l, u, t) => {
158
+ if (t.options.useCachedMeasurements) {
159
+ const e = t.indexFromElement(l), s = t.options.getItemKey(e);
160
+ return t.itemSizeCache.get(s) ?? t.options.estimateSize(e);
161
+ }
162
+ if (u?.borderBoxSize) {
163
+ const e = u.borderBoxSize[0];
160
164
  if (e)
161
165
  return Math.round(
162
166
  e[t.options.horizontal ? "inlineSize" : "blockSize"]
163
167
  );
164
168
  }
169
+ if (!u) {
170
+ const e = t.indexFromElement(l), s = t.options.getItemKey(e), n = t.itemSizeCache.get(s);
171
+ if (n !== void 0)
172
+ return n;
173
+ }
165
174
  return l[t.options.horizontal ? "offsetWidth" : "offsetHeight"];
166
175
  }, st = (l, {
167
- adjustments: c = 0,
176
+ adjustments: u = 0,
168
177
  behavior: t
169
178
  }, e) => {
170
179
  var s, n;
171
180
  (n = (s = e.scrollElement) == null ? void 0 : s.scrollTo) == null || n.call(s, {
172
- [e.options.horizontal ? "left" : "top"]: l + c,
181
+ [e.options.horizontal ? "left" : "top"]: l + u,
173
182
  behavior: t
174
183
  });
175
184
  }, nt = st;
176
185
  class it {
177
- constructor(c) {
186
+ constructor(u) {
178
187
  this.unsubs = [], this.scrollElement = null, this.targetWindow = null, this.isScrolling = !1, this.scrollState = null, this.measurementsCache = [], this._flatMeasurements = null, this.itemSizeCache = /* @__PURE__ */ new Map(), this.itemSizeCacheVersion = 0, this.laneAssignments = /* @__PURE__ */ new Map(), this.pendingMin = null, this.prevLanes = void 0, this.lanesChangedFlag = !1, this.lanesSettling = !1, this.pendingScrollAnchor = null, this.scrollRect = null, this.scrollOffset = null, this.scrollDirection = null, this.scrollAdjustments = 0, this._iosDeferredAdjustment = 0, this._iosTouching = !1, this._iosJustTouchEnded = !1, this._iosTouchEndTimerId = null, this._intendedScrollOffset = null, this.elementsCache = /* @__PURE__ */ new Map(), this.now = () => {
179
188
  var t, e, s;
180
189
  return ((s = (e = (t = this.targetWindow) == null ? void 0 : t.performance) == null ? void 0 : e.now) == null ? void 0 : s.call(e)) ?? Date.now();
@@ -182,12 +191,12 @@ class it {
182
191
  let t = null;
183
192
  const e = () => t || (!this.targetWindow || !this.targetWindow.ResizeObserver ? null : t = new this.targetWindow.ResizeObserver((s) => {
184
193
  s.forEach((n) => {
185
- const i = () => {
186
- const o = n.target, r = this.indexFromElement(o);
187
- if (!o.isConnected) {
188
- this.observer.unobserve(o);
194
+ const o = () => {
195
+ const i = n.target, r = this.indexFromElement(i);
196
+ if (!i.isConnected) {
197
+ this.observer.unobserve(i);
189
198
  for (const [a, h] of this.elementsCache)
190
- if (h === o) {
199
+ if (h === i) {
191
200
  this.elementsCache.delete(a);
192
201
  break;
193
202
  }
@@ -195,10 +204,10 @@ class it {
195
204
  }
196
205
  this.shouldMeasureDuringScroll(r) && this.resizeItem(
197
206
  r,
198
- this.options.measureElement(o, n, this)
207
+ this.options.measureElement(i, n, this)
199
208
  );
200
209
  };
201
- this.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(i) : i();
210
+ this.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(o) : o();
202
211
  });
203
212
  }));
204
213
  return {
@@ -245,32 +254,50 @@ class it {
245
254
  isRtl: !1,
246
255
  useScrollendEvent: !1,
247
256
  useAnimationFrameWithResizeObserver: !1,
248
- laneAssignmentMode: "estimate"
257
+ laneAssignmentMode: "estimate",
258
+ useCachedMeasurements: !1
249
259
  };
250
- for (const a in t) {
251
- const h = t[a];
252
- h !== void 0 && (n[a] = h);
260
+ for (const c in t) {
261
+ const v = t[c];
262
+ v !== void 0 && (n[c] = v);
253
263
  }
254
- const i = this.options;
255
- let o = null, r = null;
256
- if (i !== void 0 && i.enabled && n.enabled && n.anchorTo === "end" && this.scrollElement !== null) {
257
- const a = i.count, h = n.count, p = this.getMeasurements(), d = a > 0 ? ((e = p[0]) == null ? void 0 : e.key) ?? i.getItemKey(0) : null, S = a > 0 ? ((s = p[a - 1]) == null ? void 0 : s.key) ?? i.getItemKey(a - 1) : null;
258
- if (h !== a || a > 0 && h > 0 && (n.getItemKey(0) !== d || n.getItemKey(h - 1) !== S)) {
259
- const g = a > 0 ? this.getVirtualItemForOffset(this.getScrollOffset()) ?? p[0] : null;
260
- g && (o = [g.key, this.getScrollOffset() - g.start]);
261
- const m = n.followOnAppend === !0 ? "auto" : n.followOnAppend || null;
262
- m && h > a && this.isAtEnd(i.scrollEndThreshold) && (a === 0 || n.getItemKey(h - 1) !== S) && (r = m);
264
+ const o = this.options;
265
+ let i = null, r = null, a = !1;
266
+ if (o !== void 0 && o.enabled && n.enabled && n.anchorTo === "end" && this.scrollElement !== null) {
267
+ const c = o.count, v = n.count, d = this.getMeasurements(), f = c > 0 ? ((e = d[0]) == null ? void 0 : e.key) ?? o.getItemKey(0) : null, S = c > 0 ? ((s = d[c - 1]) == null ? void 0 : s.key) ?? o.getItemKey(c - 1) : null;
268
+ if (v !== c || c > 0 && v > 0 && (n.getItemKey(0) !== f || n.getItemKey(v - 1) !== S)) {
269
+ a = !0;
270
+ const m = c > 0 ? this.getVirtualItemForOffset(this.getScrollOffset()) ?? d[0] : null;
271
+ m && (i = [m.key, this.getScrollOffset() - m.start]);
272
+ const E = n.followOnAppend === !0 ? "auto" : n.followOnAppend || null;
273
+ E && v > c && this.isAtEnd(o.scrollEndThreshold) && (c === 0 || n.getItemKey(v - 1) !== S) && (r = E);
274
+ }
275
+ }
276
+ this.options = n, a && (this.pendingMin = 0, this.itemSizeCacheVersion++);
277
+ let h = !1, p = 0;
278
+ if (i && this.scrollOffset !== null) {
279
+ const [c, v] = i, d = this.getMeasurements(), { count: f, getItemKey: S } = this.options;
280
+ let g = 0;
281
+ for (; g < f && S(g) !== c; )
282
+ g++;
283
+ if (g < f) {
284
+ const b = d[g];
285
+ if (b) {
286
+ const m = b.start + v;
287
+ m !== this.scrollOffset && (p = m - this.scrollOffset, this.scrollOffset = m, h = !0);
288
+ }
263
289
  }
264
290
  }
265
- this.options = n, (o || r) && (this.pendingScrollAnchor = [
266
- o?.[0] ?? null,
267
- o?.[1] ?? 0,
268
- r
291
+ (h || r) && (this.pendingScrollAnchor = [
292
+ h ? i[0] : null,
293
+ h ? i[1] : 0,
294
+ r,
295
+ p
269
296
  ]);
270
297
  }, this.notify = (t) => {
271
298
  var e, s;
272
299
  (s = (e = this.options).onChange) == null || s.call(e, this, t);
273
- }, this.maybeNotify = x(
300
+ }, this.maybeNotify = z(
274
301
  () => (this.calculateRange(), [
275
302
  this.isScrolling,
276
303
  this.range ? this.range.startIndex : null,
@@ -307,27 +334,27 @@ class it {
307
334
  this.scrollRect = n, this.maybeNotify();
308
335
  })
309
336
  ), this.unsubs.push(
310
- this.options.observeElementOffset(this, (n, i) => {
311
- this._intendedScrollOffset !== null && Math.abs(n - this._intendedScrollOffset) < 1.5 && (n = this._intendedScrollOffset), this._intendedScrollOffset = null, this.scrollAdjustments = 0, this.scrollDirection = i ? this.getScrollOffset() < n ? "forward" : "backward" : null, this.scrollOffset = n, this.isScrolling = i, this._flushIosDeferredIfReady(), this.scrollState && this.scheduleScrollReconcile(), this.maybeNotify();
337
+ this.options.observeElementOffset(this, (n, o) => {
338
+ this._intendedScrollOffset !== null && Math.abs(n - this._intendedScrollOffset) < 1.5 && (n = this._intendedScrollOffset), this._intendedScrollOffset = null, this.scrollAdjustments = 0, this.scrollDirection = o ? this.getScrollOffset() < n ? "forward" : "backward" : null, this.scrollOffset = n, this.isScrolling = o, this._flushIosDeferredIfReady(), this.scrollState && this.scheduleScrollReconcile(), this.maybeNotify();
312
339
  })
313
340
  ), "addEventListener" in this.scrollElement) {
314
- const n = this.scrollElement, i = () => {
341
+ const n = this.scrollElement, o = () => {
315
342
  this._iosTouching = !0, this._iosJustTouchEnded = !1, this._iosTouchEndTimerId !== null && this.targetWindow != null && (this.targetWindow.clearTimeout(this._iosTouchEndTimerId), this._iosTouchEndTimerId = null);
316
- }, o = () => {
317
- this._iosTouching = !1, !(!D() || this.targetWindow == null) && (this._iosJustTouchEnded = !0, this._iosTouchEndTimerId = this.targetWindow.setTimeout(() => {
343
+ }, i = () => {
344
+ this._iosTouching = !1, !(!A() || this.targetWindow == null) && (this._iosJustTouchEnded = !0, this._iosTouchEndTimerId = this.targetWindow.setTimeout(() => {
318
345
  this._iosJustTouchEnded = !1, this._iosTouchEndTimerId = null, this._flushIosDeferredIfReady();
319
346
  }, 150));
320
347
  };
321
348
  n.addEventListener(
322
349
  "touchstart",
323
- i,
350
+ o,
324
351
  C
325
352
  ), n.addEventListener(
326
353
  "touchend",
327
- o,
354
+ i,
328
355
  C
329
356
  ), this.unsubs.push(() => {
330
- n.removeEventListener("touchstart", i), n.removeEventListener("touchend", o), this._iosTouchEndTimerId !== null && this.targetWindow != null && (this.targetWindow.clearTimeout(this._iosTouchEndTimerId), this._iosTouchEndTimerId = null);
357
+ n.removeEventListener("touchstart", o), n.removeEventListener("touchend", i), this._iosTouchEndTimerId !== null && this.targetWindow != null && (this.targetWindow.clearTimeout(this._iosTouchEndTimerId), this._iosTouchEndTimerId = null);
331
358
  });
332
359
  }
333
360
  this._scrollToOffset(this.getScrollOffset(), {
@@ -337,19 +364,11 @@ class it {
337
364
  }
338
365
  const s = this.pendingScrollAnchor;
339
366
  if (this.pendingScrollAnchor = null, s && this.scrollElement && this.options.enabled) {
340
- const [n, i, o] = s;
341
- if (n !== null) {
342
- const { count: r, getItemKey: a } = this.options;
343
- let h = 0;
344
- for (; h < r && a(h) !== n; )
345
- h++;
346
- const p = h < r ? this.getMeasurements()[h] : void 0;
347
- if (p) {
348
- const d = p.start + i - this.getScrollOffset();
349
- R(d, 0) || this.applyScrollAdjustment(d);
350
- }
351
- }
352
- o && this.scrollToEnd({ behavior: o });
367
+ const [n, o, i, r] = s;
368
+ n !== null && !i && (A() && (this.isScrolling || this._iosTouching || this._iosJustTouchEnded) ? r !== 0 && (this._iosDeferredAdjustment += r) : this._scrollToOffset(this.getScrollOffset(), {
369
+ adjustments: void 0,
370
+ behavior: void 0
371
+ })), i && this.scrollToEnd({ behavior: i });
353
372
  }
354
373
  }, this._flushIosDeferredIfReady = () => {
355
374
  if (this._iosDeferredAdjustment === 0 || this.isScrolling || this._iosTouching || this._iosJustTouchEnded) return;
@@ -362,18 +381,18 @@ class it {
362
381
  });
363
382
  }, 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 = (t, e) => {
364
383
  const s = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
365
- for (let i = e - 1; i >= 0; i--) {
366
- const o = t[i];
367
- if (s.has(o.lane))
384
+ for (let o = e - 1; o >= 0; o--) {
385
+ const i = t[o];
386
+ if (s.has(i.lane))
368
387
  continue;
369
388
  const r = n.get(
370
- o.lane
389
+ i.lane
371
390
  );
372
- if (r == null || o.end > r.end ? n.set(o.lane, o) : o.end < r.end && s.set(o.lane, !0), s.size === this.options.lanes)
391
+ if (r == null || i.end > r.end ? n.set(i.lane, i) : i.end < r.end && s.set(i.lane, !0), s.size === this.options.lanes)
373
392
  break;
374
393
  }
375
- return n.size === this.options.lanes ? Array.from(n.values()).sort((i, o) => i.end === o.end ? i.index - o.index : i.end - o.end)[0] : void 0;
376
- }, this.getMeasurementOptions = x(
394
+ 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;
395
+ }, this.getMeasurementOptions = z(
377
396
  () => [
378
397
  this.options.count,
379
398
  this.options.paddingStart,
@@ -383,96 +402,96 @@ class it {
383
402
  this.options.lanes,
384
403
  this.options.laneAssignmentMode
385
404
  ],
386
- (t, e, s, n, i, o, r) => (this.prevLanes !== void 0 && this.prevLanes !== o && (this.lanesChangedFlag = !0), this.prevLanes = o, this.pendingMin = null, {
405
+ (t, e, s, n, o, i, r) => (this.prevLanes !== void 0 && this.prevLanes !== i && (this.lanesChangedFlag = !0), this.prevLanes = i, this.pendingMin = null, {
387
406
  count: t,
388
407
  paddingStart: e,
389
408
  scrollMargin: s,
390
409
  getItemKey: n,
391
- enabled: i,
392
- lanes: o,
410
+ enabled: o,
411
+ lanes: i,
393
412
  laneAssignmentMode: r
394
413
  }),
395
414
  {
396
415
  key: !1
397
416
  }
398
- ), this.getMeasurements = x(
417
+ ), this.getMeasurements = z(
399
418
  () => [this.getMeasurementOptions(), this.itemSizeCacheVersion],
400
419
  ({
401
420
  count: t,
402
421
  paddingStart: e,
403
422
  scrollMargin: s,
404
423
  getItemKey: n,
405
- enabled: i,
406
- lanes: o,
424
+ enabled: o,
425
+ lanes: i,
407
426
  laneAssignmentMode: r
408
427
  }, a) => {
409
428
  const h = this.itemSizeCache;
410
- if (!i)
429
+ if (!o)
411
430
  return this.measurementsCache = [], this.itemSizeCache.clear(), this.laneAssignments.clear(), [];
412
431
  if (this.laneAssignments.size > t)
413
- for (const u of this.laneAssignments.keys())
414
- u >= t && this.laneAssignments.delete(u);
415
- this.lanesChangedFlag && (this.lanesChangedFlag = !1, this.lanesSettling = !0, this.measurementsCache = [], this.itemSizeCache.clear(), this.laneAssignments.clear(), this.pendingMin = null), this.measurementsCache.length === 0 && !this.lanesSettling && (this.measurementsCache = this.options.initialMeasurementsCache, this.measurementsCache.forEach((u) => {
416
- this.itemSizeCache.set(u.key, u.size);
432
+ for (const d of this.laneAssignments.keys())
433
+ d >= t && this.laneAssignments.delete(d);
434
+ this.lanesChangedFlag && (this.lanesChangedFlag = !1, this.lanesSettling = !0, this.measurementsCache = [], this.itemSizeCache.clear(), this.laneAssignments.clear(), this.pendingMin = null), this.measurementsCache.length === 0 && !this.lanesSettling && (this.measurementsCache = this.options.initialMeasurementsCache, this.measurementsCache.forEach((d) => {
435
+ this.itemSizeCache.set(d.key, d.size);
417
436
  }));
418
437
  const p = this.lanesSettling ? 0 : this.pendingMin ?? 0;
419
- if (this.pendingMin = null, this.lanesSettling && this.measurementsCache.length === t && (this.lanesSettling = !1), o === 1) {
420
- const u = this.options.gap, f = t * 2;
421
- let g = this._flatMeasurements;
422
- if (!g || g.length < f) {
423
- const v = new Float64Array(f);
424
- g && p > 0 && v.set(g.subarray(0, p * 2)), g = v, this._flatMeasurements = g;
438
+ if (this.pendingMin = null, this.lanesSettling && this.measurementsCache.length === t && (this.lanesSettling = !1), i === 1) {
439
+ const d = this.options.gap, f = t * 2;
440
+ let S = this._flatMeasurements;
441
+ if (!S || S.length < f) {
442
+ const m = new Float64Array(f);
443
+ S && p > 0 && m.set(S.subarray(0, p * 2)), S = m, this._flatMeasurements = S;
425
444
  }
426
- let m;
445
+ let g;
427
446
  if (p === 0)
428
- m = e + s;
447
+ g = e + s;
429
448
  else {
430
- const v = p - 1;
431
- m = g[v * 2] + g[v * 2 + 1] + u;
449
+ const m = p - 1;
450
+ g = S[m * 2] + S[m * 2 + 1] + d;
432
451
  }
433
- for (let v = p; v < t; v++) {
434
- const O = n(v), M = h.get(O), I = typeof M == "number" ? M : this.options.estimateSize(v);
435
- g[v * 2] = m, g[v * 2 + 1] = I, m += I + u;
452
+ for (let m = p; m < t; m++) {
453
+ const E = n(m), w = h.get(E), _ = typeof w == "number" ? w : this.options.estimateSize(m);
454
+ S[m * 2] = g, S[m * 2 + 1] = _, g += _ + d;
436
455
  }
437
- const E = q(t, g, n);
438
- return this.measurementsCache = E, E;
456
+ const b = J(t, S, n);
457
+ return this.measurementsCache = b, b;
439
458
  }
440
- const d = this.measurementsCache.slice(0, p), S = new Array(o).fill(
459
+ const c = this.measurementsCache.slice(0, p), v = new Array(i).fill(
441
460
  void 0
442
461
  );
443
- for (let u = 0; u < p; u++) {
444
- const f = d[u];
445
- f && (S[f.lane] = u);
462
+ for (let d = 0; d < p; d++) {
463
+ const f = c[d];
464
+ f && (v[f.lane] = d);
446
465
  }
447
- for (let u = p; u < t; u++) {
448
- const f = n(u), g = this.laneAssignments.get(u);
449
- let m, E;
450
- const v = r === "estimate" || h.has(f);
451
- if (g !== void 0 && this.options.lanes > 1) {
452
- m = g;
453
- const y = S[m], A = y !== void 0 ? d[y] : void 0;
454
- E = A ? A.end + this.options.gap : e + s;
466
+ for (let d = p; d < t; d++) {
467
+ const f = n(d), S = this.laneAssignments.get(d);
468
+ let g, b;
469
+ const m = r === "estimate" || h.has(f);
470
+ if (S !== void 0 && this.options.lanes > 1) {
471
+ g = S;
472
+ const O = v[g], R = O !== void 0 ? c[O] : void 0;
473
+ b = R ? R.end + this.options.gap : e + s;
455
474
  } else {
456
- const y = this.options.lanes === 1 ? d[u - 1] : this.getFurthestMeasurement(d, u);
457
- E = y ? y.end + this.options.gap : e + s, m = y ? y.lane : u % this.options.lanes, this.options.lanes > 1 && v && this.laneAssignments.set(u, m);
475
+ const O = this.options.lanes === 1 ? c[d - 1] : this.getFurthestMeasurement(c, d);
476
+ b = O ? O.end + this.options.gap : e + s, g = O ? O.lane : d % this.options.lanes, this.options.lanes > 1 && m && this.laneAssignments.set(d, g);
458
477
  }
459
- const O = h.get(f), M = typeof O == "number" ? O : this.options.estimateSize(u), I = E + M;
460
- d[u] = {
461
- index: u,
462
- start: E,
463
- size: M,
464
- end: I,
478
+ const E = h.get(f), w = typeof E == "number" ? E : this.options.estimateSize(d), _ = b + w;
479
+ c[d] = {
480
+ index: d,
481
+ start: b,
482
+ size: w,
483
+ end: _,
465
484
  key: f,
466
- lane: m
467
- }, S[m] = u;
485
+ lane: g
486
+ }, v[g] = d;
468
487
  }
469
- return this.measurementsCache = d, d;
488
+ return this.measurementsCache = c, c;
470
489
  },
471
490
  {
472
491
  key: process.env.NODE_ENV !== "production" && "getMeasurements",
473
492
  debug: () => this.options.debug
474
493
  }
475
- ), this.calculateRange = x(
494
+ ), this.calculateRange = z(
476
495
  () => [
477
496
  this.getMeasurements(),
478
497
  this.getSize(),
@@ -493,7 +512,7 @@ class it {
493
512
  key: process.env.NODE_ENV !== "production" && "calculateRange",
494
513
  debug: () => this.options.debug
495
514
  }
496
- ), this.getVirtualIndexes = x(
515
+ ), this.getVirtualIndexes = z(
497
516
  () => {
498
517
  let t = null, e = null;
499
518
  const s = this.calculateRange();
@@ -505,9 +524,9 @@ class it {
505
524
  e
506
525
  ];
507
526
  },
508
- (t, e, s, n, i) => n === null || i === null ? [] : t({
527
+ (t, e, s, n, o) => n === null || o === null ? [] : t({
509
528
  startIndex: n,
510
- endIndex: i,
529
+ endIndex: o,
511
530
  overscan: e,
512
531
  count: s
513
532
  }),
@@ -529,17 +548,17 @@ class it {
529
548
  const n = Math.max(
530
549
  this.options.overscan,
531
550
  Math.ceil((this.range.endIndex - this.range.startIndex) / 2)
532
- ), i = Math.max(0, s - n), o = Math.min(
551
+ ), o = Math.max(0, s - n), i = Math.min(
533
552
  this.options.count - 1,
534
553
  s + n
535
554
  );
536
- return t >= i && t <= o;
555
+ return t >= o && t <= i;
537
556
  }
538
557
  return !0;
539
558
  }, this.measureElement = (t) => {
540
559
  if (!t) {
541
- this.elementsCache.forEach((i, o) => {
542
- i.isConnected || (this.observer.unobserve(i), this.elementsCache.delete(o));
560
+ this.elementsCache.forEach((o, i) => {
561
+ o.isConnected || (this.observer.unobserve(o), this.elementsCache.delete(i));
543
562
  });
544
563
  return;
545
564
  }
@@ -548,26 +567,26 @@ class it {
548
567
  }, this.resizeItem = (t, e) => {
549
568
  var s, n;
550
569
  if (t < 0 || t >= this.options.count) return;
551
- let i, o, r;
570
+ let o, i, r;
552
571
  const a = this._flatMeasurements;
553
572
  if (this.options.lanes === 1 && a !== null)
554
- r = this.options.getItemKey(t), o = a[t * 2], i = a[t * 2 + 1];
573
+ r = this.options.getItemKey(t), i = a[t * 2], o = a[t * 2 + 1];
555
574
  else {
556
- const d = this.measurementsCache[t];
557
- if (!d) return;
558
- r = d.key, o = d.start, i = d.size;
575
+ const c = this.measurementsCache[t];
576
+ if (!c) return;
577
+ r = c.key, i = c.start, o = c.size;
559
578
  }
560
- const h = this.itemSizeCache.get(r) ?? i, p = e - h;
579
+ const h = this.itemSizeCache.get(r) ?? o, p = e - h;
561
580
  if (p !== 0) {
562
- const d = this.options.anchorTo === "end" && ((s = this.scrollState) == null ? void 0 : s.behavior) !== "smooth" && this.getVirtualDistanceFromEnd() <= this.options.scrollEndThreshold, S = d ? this.getTotalSize() : 0, u = ((n = this.scrollState) == null ? void 0 : n.behavior) !== "smooth" && (this.shouldAdjustScrollPositionOnItemSizeChange !== void 0 ? this.shouldAdjustScrollPositionOnItemSizeChange(
581
+ const c = this.options.anchorTo === "end" && ((s = this.scrollState) == null ? void 0 : s.behavior) !== "smooth" && this.getVirtualDistanceFromEnd() <= this.options.scrollEndThreshold, v = c ? this.getTotalSize() : 0, d = ((n = this.scrollState) == null ? void 0 : n.behavior) !== "smooth" && (this.shouldAdjustScrollPositionOnItemSizeChange !== void 0 ? this.shouldAdjustScrollPositionOnItemSizeChange(
563
582
  // The callback expects a VirtualItem; build one lazily only
564
583
  // when the consumer actually supplied a custom predicate.
565
584
  this.measurementsCache[t] ?? {
566
585
  index: t,
567
586
  key: r,
568
- start: o,
569
- size: i,
570
- end: o + i,
587
+ start: i,
588
+ size: o,
589
+ end: i + o,
571
590
  lane: 0
572
591
  },
573
592
  p,
@@ -579,16 +598,16 @@ class it {
579
598
  // direction and produces the "items jump while scrolling up"
580
599
  // jank reported across many issues. Users who want the old
581
600
  // behavior can pass shouldAdjustScrollPositionOnItemSizeChange.
582
- o < this.getScrollOffset() + this.scrollAdjustments && this.scrollDirection !== "backward"
601
+ i < this.getScrollOffset() + this.scrollAdjustments && this.scrollDirection !== "backward"
583
602
  ));
584
- (this.pendingMin === null || t < this.pendingMin) && (this.pendingMin = t), this.itemSizeCache.set(r, e), this.itemSizeCacheVersion++, d ? this.applyScrollAdjustment(this.getTotalSize() - S) : u && this.applyScrollAdjustment(p), this.notify(!1);
603
+ (this.pendingMin === null || t < this.pendingMin) && (this.pendingMin = t), this.itemSizeCache.set(r, e), this.itemSizeCacheVersion++, c ? this.applyScrollAdjustment(this.getTotalSize() - v) : d && this.applyScrollAdjustment(p), this.notify(!1);
585
604
  }
586
- }, this.getVirtualItems = x(
605
+ }, this.getVirtualItems = z(
587
606
  () => [this.getVirtualIndexes(), this.getMeasurements()],
588
607
  (t, e) => {
589
608
  const s = [];
590
- for (let n = 0, i = t.length; n < i; n++) {
591
- const o = t[n], r = e[o];
609
+ for (let n = 0, o = t.length; n < o; n++) {
610
+ const i = t[n], r = e[i];
592
611
  s.push(r);
593
612
  }
594
613
  return s;
@@ -601,13 +620,13 @@ class it {
601
620
  const e = this.getMeasurements();
602
621
  if (e.length === 0)
603
622
  return;
604
- const s = this._flatMeasurements, n = this.options.lanes === 1 && s != null, i = W(
623
+ const s = this._flatMeasurements, n = this.options.lanes === 1 && s != null, o = N(
605
624
  0,
606
625
  e.length - 1,
607
- n ? (o) => s[o * 2] : (o) => k(e[o]).start,
626
+ n ? (i) => s[i * 2] : (i) => D(e[i]).start,
608
627
  t
609
628
  );
610
- return k(e[i]);
629
+ return D(e[o]);
611
630
  }, this.getMaxScrollOffset = () => {
612
631
  if (!this.scrollElement) return 0;
613
632
  if ("scrollHeight" in this.scrollElement)
@@ -621,35 +640,35 @@ class it {
621
640
  0
622
641
  ), this.getDistanceFromEnd = () => Math.max(this.getMaxScrollOffset() - this.getScrollOffset(), 0), this.isAtEnd = (t = this.options.scrollEndThreshold) => this.getDistanceFromEnd() <= t, this.getOffsetForAlignment = (t, e, s = 0) => {
623
642
  if (!this.scrollElement) return 0;
624
- const n = this.getSize(), i = this.getScrollOffset();
625
- e === "auto" && (e = t >= i + n ? "end" : "start"), e === "center" ? t += (s - n) / 2 : e === "end" && (t -= n);
626
- const o = this.getMaxScrollOffset();
627
- return Math.max(Math.min(o, t), 0);
643
+ const n = this.getSize(), o = this.getScrollOffset();
644
+ e === "auto" && (e = t >= o + n ? "end" : "start"), e === "center" ? t += (s - n) / 2 : e === "end" && (t -= n);
645
+ const i = this.getMaxScrollOffset();
646
+ return Math.max(Math.min(i, t), 0);
628
647
  }, this.getOffsetForIndex = (t, e = "auto") => {
629
648
  t = Math.max(0, Math.min(t, this.options.count - 1));
630
- const s = this.getSize(), n = this.getScrollOffset(), i = this.measurementsCache[t];
631
- if (!i) return;
649
+ const s = this.getSize(), n = this.getScrollOffset(), o = this.measurementsCache[t];
650
+ if (!o) return;
632
651
  if (e === "auto")
633
- if (i.end >= n + s - this.options.scrollPaddingEnd)
652
+ if (o.end >= n + s - this.options.scrollPaddingEnd)
634
653
  e = "end";
635
- else if (i.start <= n + this.options.scrollPaddingStart)
654
+ else if (o.start <= n + this.options.scrollPaddingStart)
636
655
  e = "start";
637
656
  else
638
657
  return [n, e];
639
658
  if (e === "end" && t === this.options.count - 1)
640
659
  return [this.getMaxScrollOffset(), e];
641
- const o = e === "end" ? i.end + this.options.scrollPaddingEnd : i.start - this.options.scrollPaddingStart;
660
+ const i = e === "end" ? o.end + this.options.scrollPaddingEnd : o.start - this.options.scrollPaddingStart;
642
661
  return [
643
- this.getOffsetForAlignment(o, e, i.size),
662
+ this.getOffsetForAlignment(i, e, o.size),
644
663
  e
645
664
  ];
646
665
  }, this.scrollToOffset = (t, { align: e = "start", behavior: s = "auto" } = {}) => {
647
- const n = this.getOffsetForAlignment(t, e), i = this.now();
666
+ const n = this.getOffsetForAlignment(t, e), o = this.now();
648
667
  this.scrollState = {
649
668
  index: null,
650
669
  align: e,
651
670
  behavior: s,
652
- startedAt: i,
671
+ startedAt: o,
653
672
  lastTargetOffset: n,
654
673
  stableFrames: 0
655
674
  }, this._scrollToOffset(n, { adjustments: void 0, behavior: s }), this.scheduleScrollReconcile();
@@ -661,15 +680,15 @@ class it {
661
680
  const n = this.getOffsetForIndex(t, e);
662
681
  if (!n)
663
682
  return;
664
- const [i, o] = n, r = this.now();
683
+ const [o, i] = n, r = this.now();
665
684
  this.scrollState = {
666
685
  index: t,
667
- align: o,
686
+ align: i,
668
687
  behavior: s,
669
688
  startedAt: r,
670
- lastTargetOffset: i,
689
+ lastTargetOffset: o,
671
690
  stableFrames: 0
672
- }, this._scrollToOffset(i, { adjustments: void 0, behavior: s }), this.scheduleScrollReconcile();
691
+ }, this._scrollToOffset(o, { adjustments: void 0, behavior: s }), this.scheduleScrollReconcile();
673
692
  }, this.scrollBy = (t, { behavior: e = "auto" } = {}) => {
674
693
  const s = this.getScrollOffset() + t, n = this.now();
675
694
  this.scrollState = {
@@ -698,16 +717,16 @@ class it {
698
717
  if (e.length === 0)
699
718
  s = this.options.paddingStart;
700
719
  else if (this.options.lanes === 1) {
701
- const n = e.length - 1, i = this._flatMeasurements;
702
- i != null ? s = i[n * 2] + i[n * 2 + 1] : s = ((t = e[n]) == null ? void 0 : t.end) ?? 0;
720
+ const n = e.length - 1, o = this._flatMeasurements;
721
+ o != null ? s = o[n * 2] + o[n * 2 + 1] : s = ((t = e[n]) == null ? void 0 : t.end) ?? 0;
703
722
  } else {
704
723
  const n = Array(this.options.lanes).fill(null);
705
- let i = e.length - 1;
706
- for (; i >= 0 && n.some((o) => o === null); ) {
707
- const o = e[i];
708
- n[o.lane] === null && (n[o.lane] = o.end), i--;
724
+ let o = e.length - 1;
725
+ for (; o >= 0 && n.some((i) => i === null); ) {
726
+ const i = e[o];
727
+ n[i.lane] === null && (n[i.lane] = i.end), o--;
709
728
  }
710
- s = Math.max(...n.filter((o) => o !== null));
729
+ s = Math.max(...n.filter((i) => i !== null));
711
730
  }
712
731
  return Math.max(
713
732
  s - this.options.scrollMargin + this.options.paddingEnd,
@@ -734,11 +753,11 @@ class it {
734
753
  this._intendedScrollOffset = t + (e ?? 0), this.options.scrollToFn(t, { behavior: s, adjustments: e }, this);
735
754
  }, this.measure = () => {
736
755
  this.pendingMin = null, this.itemSizeCache.clear(), this.laneAssignments.clear(), this.itemSizeCacheVersion++, this.notify(!1);
737
- }, this.setOptions(c);
756
+ }, this.setOptions(u);
738
757
  }
739
- applyScrollAdjustment(c, t) {
740
- c !== 0 && (process.env.NODE_ENV !== "production" && this.options.debug && console.info("correction", c), D() && (this.isScrolling || this._iosTouching || this._iosJustTouchEnded) ? this._iosDeferredAdjustment += c : this._scrollToOffset(this.getScrollOffset(), {
741
- adjustments: this.scrollAdjustments += c,
758
+ applyScrollAdjustment(u, t) {
759
+ u !== 0 && (process.env.NODE_ENV !== "production" && this.options.debug && console.info("correction", u), A() && (this.isScrolling || this._iosTouching || this._iosJustTouchEnded) ? this._iosDeferredAdjustment += u : this._scrollToOffset(this.getScrollOffset(), {
760
+ adjustments: this.scrollAdjustments += u,
742
761
  behavior: t
743
762
  }));
744
763
  }
@@ -757,8 +776,8 @@ class it {
757
776
  this.scrollState = null;
758
777
  return;
759
778
  }
760
- const e = this.scrollState.index != null ? this.getOffsetForIndex(this.scrollState.index, this.scrollState.align) : void 0, s = e ? e[0] : this.scrollState.lastTargetOffset, n = 1, i = s !== this.scrollState.lastTargetOffset;
761
- if (!i && R(s, this.getScrollOffset())) {
779
+ const e = this.scrollState.index != null ? this.getOffsetForIndex(this.scrollState.index, this.scrollState.align) : void 0, s = e ? e[0] : this.scrollState.lastTargetOffset, n = 1, o = s !== this.scrollState.lastTargetOffset;
780
+ if (!o && q(s, this.getScrollOffset())) {
762
781
  if (this.scrollState.stableFrames++, this.scrollState.stableFrames >= n) {
763
782
  this.getScrollOffset() !== s && this._scrollToOffset(s, {
764
783
  adjustments: void 0,
@@ -766,8 +785,8 @@ class it {
766
785
  }), this.scrollState = null;
767
786
  return;
768
787
  }
769
- } else if (this.scrollState.stableFrames = 0, i) {
770
- const o = this.getSize() || 600, r = Math.abs(s - this.getScrollOffset()), a = this.scrollState.behavior === "smooth" && r > o;
788
+ } else if (this.scrollState.stableFrames = 0, o) {
789
+ const i = this.getSize() || 600, r = Math.abs(s - this.getScrollOffset()), a = this.scrollState.behavior === "smooth" && r > i;
771
790
  this.scrollState.lastTargetOffset = s, a || (this.scrollState.behavior = "auto"), this._scrollToOffset(s, {
772
791
  adjustments: void 0,
773
792
  behavior: a ? "smooth" : "auto"
@@ -776,13 +795,13 @@ class it {
776
795
  this.scheduleScrollReconcile();
777
796
  }
778
797
  }
779
- const W = (l, c, t, e) => {
780
- for (; l <= c; ) {
781
- const s = (l + c) / 2 | 0, n = t(s);
798
+ const N = (l, u, t, e) => {
799
+ for (; l <= u; ) {
800
+ const s = (l + u) / 2 | 0, n = t(s);
782
801
  if (n < e)
783
802
  l = s + 1;
784
803
  else if (n > e)
785
- c = s - 1;
804
+ u = s - 1;
786
805
  else
787
806
  return s;
788
807
  }
@@ -790,51 +809,103 @@ const W = (l, c, t, e) => {
790
809
  };
791
810
  function ot({
792
811
  measurements: l,
793
- outerSize: c,
812
+ outerSize: u,
794
813
  scrollOffset: t,
795
814
  lanes: e,
796
815
  flat: s
797
816
  }) {
798
- const n = l.length - 1, i = s ? (h) => s[h * 2] : (h) => l[h].start, o = s ? (h) => s[h * 2] + s[h * 2 + 1] : (h) => l[h].end;
817
+ const n = l.length - 1, o = s ? (h) => s[h * 2] : (h) => l[h].start, i = s ? (h) => s[h * 2] + s[h * 2 + 1] : (h) => l[h].end;
799
818
  if (l.length <= e)
800
819
  return {
801
820
  startIndex: 0,
802
821
  endIndex: n
803
822
  };
804
- let r = W(0, n, i, t), a = r;
823
+ let r = N(0, n, o, t), a = r;
805
824
  if (e === 1)
806
- for (; a < n && o(a) < t + c; )
825
+ for (; a < n && i(a) < t + u; )
807
826
  a++;
808
827
  else if (e > 1) {
809
828
  const h = Array(e).fill(0);
810
- for (; a < n && h.some((d) => d < t + c); ) {
811
- const d = l[a];
812
- h[d.lane] = d.end, a++;
829
+ for (; a < n && h.some((c) => c < t + u); ) {
830
+ const c = l[a];
831
+ h[c.lane] = c.end, a++;
813
832
  }
814
- const p = Array(e).fill(t + c);
815
- for (; r >= 0 && p.some((d) => d >= t); ) {
816
- const d = l[r];
817
- p[d.lane] = d.start, r--;
833
+ const p = Array(e).fill(t + u);
834
+ for (; r >= 0 && p.some((c) => c >= t); ) {
835
+ const c = l[r];
836
+ p[c.lane] = c.start, r--;
818
837
  }
819
838
  r = Math.max(0, r - r % e), a = Math.min(n, a + (e - 1 - a % e));
820
839
  }
821
840
  return { startIndex: r, endIndex: a };
822
841
  }
823
- const N = typeof document < "u" ? T.useLayoutEffect : T.useEffect;
842
+ const k = typeof document < "u" ? M.useLayoutEffect : M.useEffect;
824
843
  function lt({
825
844
  useFlushSync: l = !0,
826
- ...c
845
+ directDomUpdates: u = !1,
846
+ directDomUpdatesMode: t = "transform",
847
+ ...e
827
848
  }) {
828
- const t = T.useReducer((n) => n + 1, 0)[1], e = {
829
- ...c,
830
- onChange: (n, i) => {
831
- var o;
832
- l && i ? P(t) : t(), (o = c.onChange) == null || o.call(c, n, i);
849
+ const s = M.useReducer((a) => a + 1, 0)[1], n = M.useRef({
850
+ enabled: u,
851
+ mode: t,
852
+ container: null,
853
+ lastSize: null,
854
+ // Keyed by the element itself so a remounted node (same key, new DOM
855
+ // node — e.g. when `enabled` is toggled off then on) is treated as fresh
856
+ // and gets its style written.
857
+ lastPositions: /* @__PURE__ */ new WeakMap(),
858
+ prevRange: null
859
+ });
860
+ n.current.enabled = u, n.current.mode = t;
861
+ const o = (a) => {
862
+ const h = n.current;
863
+ if (!h.enabled) return;
864
+ const p = a.getTotalSize();
865
+ if (h.container && p !== h.lastSize) {
866
+ h.lastSize = p;
867
+ const g = a.options.horizontal ? "width" : "height";
868
+ h.container.style[g] = `${p}px`;
869
+ }
870
+ const c = !!a.options.horizontal, v = h.mode === "transform", d = c ? "left" : "top", f = a.options.scrollMargin, S = a.getVirtualItems();
871
+ for (const g of S) {
872
+ const b = g.start - f, m = a.elementsCache.get(g.key);
873
+ m && h.lastPositions.get(m) !== b && (h.lastPositions.set(m, b), v ? m.style.transform = c ? `translate3d(${b}px, 0, 0)` : `translate3d(0, ${b}px, 0)` : m.style[d] = `${b}px`);
833
874
  }
834
- }, [s] = T.useState(
835
- () => new it(e)
836
- );
837
- return s.setOptions(e), N(() => s._didMount(), []), N(() => s._willUpdate()), s;
875
+ }, i = {
876
+ ...e,
877
+ onChange: (a, h) => {
878
+ var p;
879
+ const c = n.current;
880
+ let v = !0;
881
+ if (c.enabled) {
882
+ o(a);
883
+ const d = a.range, f = c.prevRange;
884
+ v = !f || f.isScrolling !== a.isScrolling || f.startIndex !== d?.startIndex || f.endIndex !== d?.endIndex, v && (c.prevRange = d ? {
885
+ startIndex: d.startIndex,
886
+ endIndex: d.endIndex,
887
+ isScrolling: a.isScrolling
888
+ } : null);
889
+ }
890
+ v && (l && h ? K(s) : s()), (p = e.onChange) == null || p.call(e, a, h);
891
+ }
892
+ }, [r] = M.useState(() => {
893
+ const a = new it(i);
894
+ return Object.assign(a, {
895
+ containerRef: (h) => {
896
+ const p = n.current;
897
+ if (p.container = h, p.lastSize = null, h && p.enabled) {
898
+ const c = a.getTotalSize();
899
+ p.lastSize = c;
900
+ const v = a.options.horizontal ? "width" : "height";
901
+ h.style[v] = `${c}px`;
902
+ }
903
+ }
904
+ });
905
+ });
906
+ return r.setOptions(i), k(() => r._didMount(), []), k(() => r._willUpdate()), k(() => {
907
+ o(r);
908
+ }), r;
838
909
  }
839
910
  function rt(l) {
840
911
  return lt({
@@ -846,100 +917,100 @@ function rt(l) {
846
917
  }
847
918
  function pt({
848
919
  selectedFilter: l,
849
- currentVal: c,
920
+ currentVal: u,
850
921
  exclude: t,
851
922
  setDraftColumnFilters: e,
852
923
  virtualization: s
853
924
  }) {
854
- const [n, i] = j(""), o = F(null), r = 32;
855
- V(() => {
856
- i("");
925
+ const [n, o] = W(""), i = j(null), r = 32;
926
+ F(() => {
927
+ o("");
857
928
  }, [l?.key]);
858
- const a = c || [], h = K(
929
+ const a = u || [], h = V(
859
930
  () => (l?.type === "checkbox" ? l.options : []).filter(
860
931
  (f) => f.toLowerCase().includes(n.toLowerCase())
861
932
  ),
862
933
  [l, n]
863
934
  ), p = rt({
864
935
  count: h.length,
865
- getScrollElement: () => o.current,
936
+ getScrollElement: () => i.current,
866
937
  estimateSize: () => r,
867
938
  overscan: 5
868
- }), d = (f, g) => {
939
+ }), c = (f, S) => {
869
940
  if (!l) return;
870
- const m = c || [], E = g ? [...m, f] : m.filter((v) => v !== f);
871
- e((v) => [
872
- ...v.filter((O) => O.id !== l.accessorKey),
873
- { id: l.accessorKey, value: { values: E, exclude: !!t } }
941
+ const g = u || [], b = S ? [...g, f] : g.filter((m) => m !== f);
942
+ e((m) => [
943
+ ...m.filter((E) => E.id !== l.accessorKey),
944
+ { id: l.accessorKey, value: { values: b, exclude: !!t } }
874
945
  ]);
875
- }, S = (f) => {
946
+ }, v = (f) => {
876
947
  if (!l || l.type !== "checkbox") return;
877
- const g = l.options.filter(
878
- (v) => v.toLowerCase().includes(n.toLowerCase())
879
- ), m = c || [], E = f ? [...m, ...g.filter((v) => !m.includes(v))] : m.filter((v) => !g.includes(v));
880
- e((v) => [
881
- ...v.filter((O) => O.id !== l.accessorKey),
882
- { id: l.accessorKey, value: { values: E, exclude: !!t } }
948
+ const S = l.options.filter(
949
+ (m) => m.toLowerCase().includes(n.toLowerCase())
950
+ ), g = u || [], b = f ? [...g, ...S.filter((m) => !g.includes(m))] : g.filter((m) => !S.includes(m));
951
+ e((m) => [
952
+ ...m.filter((E) => E.id !== l.accessorKey),
953
+ { id: l.accessorKey, value: { values: b, exclude: !!t } }
883
954
  ]);
884
- }, u = () => {
955
+ }, d = () => {
885
956
  if (!l) return;
886
957
  const f = !t;
887
- e((g) => [
888
- ...g.filter((m) => m.id !== l.accessorKey),
958
+ e((S) => [
959
+ ...S.filter((g) => g.id !== l.accessorKey),
889
960
  { id: l.accessorKey, value: { values: a, exclude: f } }
890
961
  ]);
891
962
  };
892
- return /* @__PURE__ */ w("div", { children: [
893
- /* @__PURE__ */ b("div", { children: /* @__PURE__ */ w("div", { className: "ckds-filter-search-wrapper", children: [
894
- /* @__PURE__ */ b(J, {}),
895
- /* @__PURE__ */ b(
963
+ return /* @__PURE__ */ x("div", { children: [
964
+ /* @__PURE__ */ y("div", { children: /* @__PURE__ */ x("div", { className: "ckds-filter-search-wrapper", children: [
965
+ /* @__PURE__ */ y(H, {}),
966
+ /* @__PURE__ */ y(
896
967
  "input",
897
968
  {
898
969
  placeholder: "Search here",
899
970
  className: "ckds-table-search-input",
900
971
  value: n,
901
- onChange: (f) => i(f.target.value)
972
+ onChange: (f) => o(f.target.value)
902
973
  }
903
974
  )
904
975
  ] }) }),
905
- /* @__PURE__ */ w("div", { className: "ckds-filter-results-bar", children: [
906
- /* @__PURE__ */ w(z, { variant: "caption", color: "secondary", children: [
976
+ /* @__PURE__ */ x("div", { className: "ckds-filter-results-bar", children: [
977
+ /* @__PURE__ */ x(T, { variant: "caption", color: "secondary", children: [
907
978
  h.length,
908
979
  " ",
909
980
  h.length === 1 ? "Result" : "Results"
910
981
  ] }),
911
- /* @__PURE__ */ w("label", { className: "ckds-filter-exclude-label", children: [
912
- /* @__PURE__ */ b(z, { variant: "caption", children: "Exclude" }),
913
- /* @__PURE__ */ b(
982
+ /* @__PURE__ */ x("label", { className: "ckds-filter-exclude-label", children: [
983
+ /* @__PURE__ */ y(T, { variant: "caption", children: "Exclude" }),
984
+ /* @__PURE__ */ y(
914
985
  $,
915
986
  {
916
987
  checked: !!t,
917
- onChange: u
988
+ onChange: d
918
989
  }
919
990
  )
920
991
  ] })
921
992
  ] }),
922
- h.length === 0 ? /* @__PURE__ */ b("div", { className: "ckds-filter-empty-state", children: /* @__PURE__ */ b(z, { variant: "caption", children: l?.type === "checkbox" && l.options.length === 0 ? "There are no values available for this filter." : "No matching results found for your search." }) }) : /* @__PURE__ */ w("div", { ref: o, className: "ckds-filter-multiselect-wr ckds-custom-scrollbar", children: [
923
- /* @__PURE__ */ w("label", { className: "ckds-filter-option-label", children: [
924
- /* @__PURE__ */ b(
925
- B,
993
+ h.length === 0 ? /* @__PURE__ */ y("div", { className: "ckds-filter-empty-state", children: /* @__PURE__ */ y(T, { variant: "caption", children: l?.type === "checkbox" && l.options.length === 0 ? "There are no values available for this filter." : "No matching results found for your search." }) }) : /* @__PURE__ */ x("div", { ref: i, className: "ckds-filter-multiselect-wr ckds-custom-scrollbar", children: [
994
+ /* @__PURE__ */ x("label", { className: "ckds-filter-option-label", children: [
995
+ /* @__PURE__ */ y(
996
+ P,
926
997
  {
927
998
  checked: h.length > 0 && h.every((f) => a.includes(f)),
928
999
  indeterminate: h.some((f) => a.includes(f)) && !h.every((f) => a.includes(f)),
929
- onChange: (f) => S(f)
1000
+ onChange: (f) => v(f)
930
1001
  }
931
1002
  ),
932
- /* @__PURE__ */ b(z, { variant: "body-sm", children: "Select All" })
1003
+ /* @__PURE__ */ y(T, { variant: "body-sm", children: "Select All" })
933
1004
  ] }),
934
- /* @__PURE__ */ b(
935
- H,
1005
+ /* @__PURE__ */ y(
1006
+ B,
936
1007
  {
937
1008
  virtualization: s,
938
1009
  rowVirtualizer: p,
939
1010
  filteredOptions: h,
940
1011
  checkboxState: a,
941
1012
  rowHeight: r,
942
- handleCheckboxChange: d
1013
+ handleCheckboxChange: c
943
1014
  }
944
1015
  )
945
1016
  ] })