impact-nova 1.7.31 → 1.7.33

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,156 +1,160 @@
1
- import { jsxs as c, jsx as t, Fragment as O } from "react/jsx-runtime";
2
- import * as a from "react";
3
- import { ChevronRight as T } from "lucide-react";
4
- import { useVirtualizer as $ } from "@tanstack/react-virtual";
1
+ import { jsxs as a, jsx as t } from "react/jsx-runtime";
2
+ import * as o from "react";
3
+ import { ChevronRight as j } from "lucide-react";
4
+ import { useVirtualizer as I } from "@tanstack/react-virtual";
5
5
  import { cn as h } from "../../../lib/utils.js";
6
- import { Button as A } from "../button.js";
7
- import { useImpactNovaI18n as D } from "../../../i18n/ImpactNovaI18nContext.js";
8
- const F = a.forwardRef(
6
+ import { Button as O } from "../button.js";
7
+ import { useImpactNovaI18n as T } from "../../../i18n/ImpactNovaI18nContext.js";
8
+ const $ = o.forwardRef(
9
9
  ({
10
10
  className: N,
11
- items: u,
12
- renderItem: R,
13
- scrollStep: g = 200,
14
- hideScrollbar: p = !0,
15
- controlsPosition: s = "right",
16
- renderPrevious: v,
17
- renderNext: b,
18
- maxWidth: L = "100%",
11
+ items: d,
12
+ renderItem: C,
13
+ scrollStep: p = 200,
14
+ hideScrollbar: u = !0,
15
+ controlsPosition: v = "right",
16
+ renderPrevious: x,
17
+ renderNext: g,
18
+ maxWidth: R = "100%",
19
19
  estimateSize: m = 200,
20
- overscan: k = 5,
21
- ...C
22
- }, B) => {
23
- const { t: x } = D(), l = a.useRef(null), [n, E] = a.useState(!1), [o, H] = a.useState(!1);
24
- a.useImperativeHandle(B, () => l.current);
25
- const i = $({
26
- count: u.length,
27
- getScrollElement: () => l.current,
20
+ overscan: L = 5,
21
+ ...B
22
+ }, E) => {
23
+ const { t: b } = T(), r = o.useRef(null), [n, H] = o.useState(!1), [s, V] = o.useState(!1);
24
+ o.useImperativeHandle(E, () => r.current);
25
+ const c = I({
26
+ count: d.length,
27
+ getScrollElement: () => r.current,
28
28
  estimateSize: typeof m == "function" ? m : () => m,
29
29
  horizontal: !0,
30
- overscan: k
31
- }), V = i.getTotalSize(), d = a.useCallback(() => {
32
- const e = l.current;
33
- e && (E(e.scrollLeft > 0), H(Math.ceil(e.scrollLeft + e.clientWidth) < e.scrollWidth));
30
+ overscan: L
31
+ }), W = c.getTotalSize(), f = o.useCallback(() => {
32
+ const e = r.current;
33
+ e && (H(e.scrollLeft > 0), V(Math.ceil(e.scrollLeft + e.clientWidth) < e.scrollWidth));
34
34
  }, []);
35
- a.useEffect(() => {
36
- const e = l.current;
35
+ o.useEffect(() => {
36
+ const e = r.current;
37
37
  if (!e) return;
38
- d();
39
- const r = () => d();
40
- e.addEventListener("scroll", r);
41
- const f = new ResizeObserver(() => {
42
- d();
38
+ f();
39
+ const l = () => f();
40
+ e.addEventListener("scroll", l);
41
+ const i = new ResizeObserver(() => {
42
+ f();
43
43
  });
44
- return f.observe(e), () => {
45
- e.removeEventListener("scroll", r), f.disconnect();
44
+ return i.observe(e), () => {
45
+ e.removeEventListener("scroll", l), i.disconnect();
46
46
  };
47
- }, [d, u, V]);
48
- const z = () => {
49
- l.current?.scrollBy({ left: -g, behavior: "smooth" });
50
- }, y = () => {
51
- l.current?.scrollBy({ left: g, behavior: "smooth" });
52
- }, w = ({
47
+ }, [f, d, W]);
48
+ const w = () => {
49
+ r.current?.scrollBy({ left: -p, behavior: "smooth" });
50
+ }, z = () => {
51
+ r.current?.scrollBy({ left: p, behavior: "smooth" });
52
+ }, y = ({
53
53
  direction: e,
54
- onClick: r,
55
- disabled: f
54
+ onClick: l,
55
+ disabled: i
56
56
  }) => {
57
- if (f) return null;
58
- const S = x(e === "left" ? "horizontalScroller.scrollLeft" : "horizontalScroller.scrollRight");
59
- return /* @__PURE__ */ c(
60
- A,
57
+ if (i) return null;
58
+ const k = b(e === "left" ? "horizontalScroller.scrollLeft" : "horizontalScroller.scrollRight");
59
+ return /* @__PURE__ */ a(
60
+ O,
61
61
  {
62
62
  variant: "ghost",
63
63
  size: "icon",
64
64
  className: h(
65
65
  "h-8 w-8 rounded-md bg-canvas-muted text-content-tertiary hover:bg-brand-tint hover:text-brand"
66
66
  ),
67
- onClick: r,
68
- disabled: f,
69
- "aria-label": S,
67
+ onClick: l,
68
+ disabled: i,
69
+ "aria-label": k,
70
70
  "data-component": e === "left" ? "horizontal-scroller-prev" : "horizontal-scroller-next",
71
71
  children: [
72
72
  /* @__PURE__ */ t(
73
- T,
73
+ j,
74
74
  {
75
75
  className: h("h-4 w-4", e === "left" && "rotate-180")
76
76
  }
77
77
  ),
78
- /* @__PURE__ */ t("span", { className: "sr-only", children: S })
78
+ /* @__PURE__ */ t("span", { className: "sr-only", children: k })
79
79
  ]
80
80
  }
81
81
  );
82
- }, W = () => {
83
- const e = v ? v({ onClick: z, disabled: !n }) : /* @__PURE__ */ t(
84
- w,
82
+ }, S = (() => {
83
+ const e = x ? x({ onClick: w, disabled: !n }) : /* @__PURE__ */ t(
84
+ y,
85
85
  {
86
86
  direction: "left",
87
- onClick: z,
87
+ onClick: w,
88
88
  disabled: !n
89
89
  }
90
- ), r = b ? b({ onClick: y, disabled: !o }) : /* @__PURE__ */ t(
91
- w,
90
+ ), l = g ? g({ onClick: z, disabled: !s }) : /* @__PURE__ */ t(
91
+ y,
92
92
  {
93
93
  direction: "right",
94
- onClick: y,
95
- disabled: !o
94
+ onClick: z,
95
+ disabled: !s
96
96
  }
97
97
  );
98
- return s === "split" ? /* @__PURE__ */ c(O, { children: [
99
- /* @__PURE__ */ t("div", { className: "absolute left-0 top-1/2 z-20 -translate-y-1/2", children: e }),
100
- /* @__PURE__ */ t("div", { className: "absolute right-0 top-1/2 z-20 -translate-y-1/2", children: r })
101
- ] }) : s === "left" ? /* @__PURE__ */ c("div", { className: "absolute left-0 top-1/2 z-20 flex -translate-y-1/2 items-center gap-1", children: [
102
- e,
103
- r
104
- ] }) : /* @__PURE__ */ c("div", { className: "absolute right-0 top-1/2 z-20 flex -translate-y-1/2 items-center gap-1", children: [
105
- e,
106
- r
107
- ] });
108
- }, j = () => s === "left" ? n && o ? "pl-20" : n || o ? "pl-12" : "" : s === "split" && n ? "pl-12" : "", I = () => s === "right" ? n && o ? "pr-20" : n || o ? "pr-12" : "" : s === "split" && o ? "pr-12" : "";
109
- return /* @__PURE__ */ c(
98
+ return v === "split" ? {
99
+ left: n ? /* @__PURE__ */ t("div", { className: "flex-shrink-0", children: e }) : null,
100
+ right: s ? /* @__PURE__ */ t("div", { className: "flex-shrink-0", children: l }) : null
101
+ } : v === "left" ? {
102
+ left: n || s ? /* @__PURE__ */ a("div", { className: "flex-shrink-0 flex items-center gap-1", children: [
103
+ e,
104
+ l
105
+ ] }) : null,
106
+ right: null
107
+ } : {
108
+ left: null,
109
+ right: n || s ? /* @__PURE__ */ a("div", { className: "flex-shrink-0 flex items-center gap-1", children: [
110
+ e,
111
+ l
112
+ ] }) : null
113
+ };
114
+ })();
115
+ return /* @__PURE__ */ a(
110
116
  "div",
111
117
  {
112
118
  className: h(
113
- "relative group min-w-0 w-full bg-transparent",
114
- j(),
115
- I(),
119
+ "flex items-center gap-2 min-w-0 w-full bg-transparent",
116
120
  N
117
121
  ),
118
- style: { maxWidth: L },
122
+ style: { maxWidth: R },
119
123
  "data-component": "horizontal-scroller",
120
- ...C,
124
+ ...B,
121
125
  children: [
122
- W(),
126
+ S.left,
123
127
  /* @__PURE__ */ t(
124
128
  "div",
125
129
  {
126
- ref: l,
130
+ ref: r,
127
131
  className: h(
128
- "flex w-full overflow-x-auto overflow-y-hidden whitespace-nowrap",
129
- p && "scrollbar-hide",
132
+ "flex flex-1 min-w-0 overflow-x-auto overflow-y-hidden whitespace-nowrap",
133
+ u && "scrollbar-hide",
130
134
  "scroll-smooth"
131
135
  ),
132
136
  style: {
133
- scrollbarWidth: p ? "none" : "auto",
134
- msOverflowStyle: p ? "none" : "auto"
137
+ scrollbarWidth: u ? "none" : "auto",
138
+ msOverflowStyle: u ? "none" : "auto"
135
139
  },
136
140
  "data-component": "horizontal-scroller-viewport",
137
- children: /* @__PURE__ */ c(
141
+ children: /* @__PURE__ */ a(
138
142
  "div",
139
143
  {
140
144
  style: {
141
- width: `${i.getTotalSize()}px`,
145
+ width: `${c.getTotalSize()}px`,
142
146
  display: "flex",
143
147
  position: "relative"
144
148
  },
145
149
  children: [
146
- /* @__PURE__ */ t("div", { style: { width: `${i.getVirtualItems()[0]?.start ?? 0}px`, flexShrink: 0 } }),
147
- i.getVirtualItems().map((e) => /* @__PURE__ */ t(
150
+ /* @__PURE__ */ t("div", { style: { width: `${c.getVirtualItems()[0]?.start ?? 0}px`, flexShrink: 0 } }),
151
+ c.getVirtualItems().map((e) => /* @__PURE__ */ t(
148
152
  "div",
149
153
  {
150
- ref: i.measureElement,
154
+ ref: c.measureElement,
151
155
  "data-index": e.index,
152
156
  className: "flex-shrink-0",
153
- children: R(u[e.index], e.index)
157
+ children: C(d[e.index], e.index)
154
158
  },
155
159
  e.key
156
160
  ))
@@ -158,13 +162,14 @@ const F = a.forwardRef(
158
162
  }
159
163
  )
160
164
  }
161
- )
165
+ ),
166
+ S.right
162
167
  ]
163
168
  }
164
169
  );
165
170
  }
166
171
  );
167
- F.displayName = "HorizontalScroller";
172
+ $.displayName = "HorizontalScroller";
168
173
  export {
169
- F as default
174
+ $ as default
170
175
  };
@@ -1,6 +1,6 @@
1
1
  import { useCallback as S } from "react";
2
2
  import { useSensors as Z, useSensor as V, MouseSensor as $, TouchSensor as E, closestCenter as p } from "@dnd-kit/core";
3
- import { arrayMove as w } from "@dnd-kit/sortable";
3
+ import { arrayMove as A } from "@dnd-kit/sortable";
4
4
  const W = "droppable-", y = /* @__PURE__ */ new Set(["root-frozen", "root-scrollable"]);
5
5
  function X(h) {
6
6
  if (h.startsWith(W)) {
@@ -65,7 +65,7 @@ const rn = ({
65
65
  return null;
66
66
  },
67
67
  []
68
- ), A = S(
68
+ ), G = S(
69
69
  (t, e, o) => t.map((r) => {
70
70
  if (r.children && r.children.length > 0) {
71
71
  const n = r.children.findIndex(
@@ -74,7 +74,7 @@ const rn = ({
74
74
  (i) => i.id === o
75
75
  );
76
76
  if (n !== -1 && l !== -1) {
77
- const i = w(r.children, n, l);
77
+ const i = A(r.children, n, l);
78
78
  return {
79
79
  ...r,
80
80
  children: i
@@ -82,7 +82,7 @@ const rn = ({
82
82
  }
83
83
  return {
84
84
  ...r,
85
- children: A(r.children, e, o)
85
+ children: G(r.children, e, o)
86
86
  };
87
87
  }
88
88
  return r;
@@ -98,7 +98,7 @@ const rn = ({
98
98
  (i) => i.id === e
99
99
  );
100
100
  if (n !== -1 && l !== -1) {
101
- const i = w(
101
+ const i = A(
102
102
  t,
103
103
  l,
104
104
  n
@@ -112,7 +112,7 @@ const rn = ({
112
112
  (t, e, o) => {
113
113
  const r = t.findIndex((l) => l.id === e), n = t.findIndex((l) => l.id === o);
114
114
  if (r !== -1 && n !== -1) {
115
- const l = w(t, r, n);
115
+ const l = A(t, r, n);
116
116
  return u?.(e, o), l;
117
117
  }
118
118
  return null;
@@ -120,20 +120,20 @@ const rn = ({
120
120
  [u]
121
121
  ), z = S(
122
122
  (t, e, o) => {
123
- const r = A(t, e, o);
123
+ const r = G(t, e, o);
124
124
  return u?.(e, o), r;
125
125
  },
126
- [A, u]
127
- ), G = S(
126
+ [G, u]
127
+ ), N = S(
128
128
  (t, e, o, r = !1) => {
129
129
  const n = F(t, e);
130
130
  if (!n) return null;
131
131
  const l = (s) => s.filter((c) => c.id !== e).map(
132
132
  (c) => c.children ? { ...c, children: l(c.children) } : c
133
- ).filter((c) => !(c.children && c.children.length === 0 && c.category === "group")), i = F(t, o), f = !n.children || n.children.length === 0, R = i?.children && i.children.length > 0, M = d[o] === !0, _ = f && R && !M, g = (s) => {
133
+ ).filter((c) => !(c.children && c.children.length === 0 && c.category === "group")), i = F(t, o), f = !n.children || n.children.length === 0, R = i?.children && i.children.length > 0, M = d[o] === !0, w = f && R && !M && r, g = (s) => {
134
134
  for (let c = 0; c < s.length; c++) {
135
135
  if (s[c].id === o)
136
- if (_) {
136
+ if (w) {
137
137
  const L = {
138
138
  ...s[c],
139
139
  children: [n, ...s[c].children || []]
@@ -156,7 +156,7 @@ const rn = ({
156
156
  return Y ? (u?.(e, o), O) : null;
157
157
  },
158
158
  [u, d]
159
- ), N = S(
159
+ ), _ = S(
160
160
  (t, e, o) => {
161
161
  const r = F(t, e);
162
162
  if (!r) return t;
@@ -181,10 +181,10 @@ const rn = ({
181
181
  }
182
182
  const f = X(i);
183
183
  if (f)
184
- return N(n, l, f);
185
- const R = C(n, l), M = C(n, i), _ = T(n, l), g = T(n, i);
184
+ return _(n, l, f);
185
+ const R = C(n, l), M = C(n, i), w = T(n, l), g = T(n, i);
186
186
  if (y.has(i) && R !== null && R > 0)
187
- return N(n, l, i);
187
+ return _(n, l, i);
188
188
  if (R === 0 && M !== null && M > 0)
189
189
  return B(
190
190
  n,
@@ -193,7 +193,7 @@ const rn = ({
193
193
  ) || n;
194
194
  if (R === null || M === null)
195
195
  return n;
196
- if (R > 0 && M > 0 && _ !== g) {
196
+ if (R > 0 && M > 0 && w !== g) {
197
197
  const P = j(n, l), O = j(n, i);
198
198
  if (P && O && P !== O) {
199
199
  const a = o.rect.current.translated, b = r.rect;
@@ -202,7 +202,7 @@ const rn = ({
202
202
  const Q = a.top + a.height / 2, U = b.top + b.height / 2;
203
203
  H = Q > U;
204
204
  }
205
- return G(n, l, i, H) || n;
205
+ return N(n, l, i, H) || n;
206
206
  }
207
207
  const Y = o.rect.current.translated, s = r.rect;
208
208
  let c = !1;
@@ -210,7 +210,7 @@ const rn = ({
210
210
  const a = Y.top + Y.height / 2, b = s.top + s.height / 2;
211
211
  c = a > b;
212
212
  }
213
- return G(n, l, i, c) || n;
213
+ return N(n, l, i, c) || n;
214
214
  }
215
215
  return R === 0 ? k(n, l, i) || n : z(n, l, i);
216
216
  });
@@ -221,8 +221,8 @@ const rn = ({
221
221
  B,
222
222
  k,
223
223
  z,
224
- G,
225
224
  N,
225
+ _,
226
226
  x
227
227
  ]
228
228
  ), K = S(
@@ -46,4 +46,8 @@ export interface HorizontalScrollerProps<T = any> extends Omit<React.HTMLAttribu
46
46
  * Number of items to render outside visible area. Default 5.
47
47
  */
48
48
  overscan?: number;
49
+ /**
50
+ * Disable virtualization and render all items. Useful for small lists where keyboard navigation is important. Default false.
51
+ */
52
+ disableVirtualization?: boolean;
49
53
  }