impact-nova 1.7.31 → 1.7.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ui/date-picker/date-range-picker.js +182 -165
- package/dist/components/ui/date-picker/month-range-picker.js +221 -166
- package/dist/components/ui/horizontal-scroller/horizontal-scroller.js +98 -93
- package/dist/components/ui/types/horizontal-scroller.types.d.ts +4 -0
- package/dist/impact-nova.css +1 -1
- package/package.json +1 -1
|
@@ -1,156 +1,160 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import { ChevronRight as
|
|
4
|
-
import { useVirtualizer as
|
|
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
|
|
7
|
-
import { useImpactNovaI18n as
|
|
8
|
-
const
|
|
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:
|
|
12
|
-
renderItem:
|
|
13
|
-
scrollStep:
|
|
14
|
-
hideScrollbar:
|
|
15
|
-
controlsPosition:
|
|
16
|
-
renderPrevious:
|
|
17
|
-
renderNext:
|
|
18
|
-
maxWidth:
|
|
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:
|
|
21
|
-
...
|
|
22
|
-
},
|
|
23
|
-
const { t:
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
count:
|
|
27
|
-
getScrollElement: () =>
|
|
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:
|
|
31
|
-
}),
|
|
32
|
-
const e =
|
|
33
|
-
e && (
|
|
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
|
-
|
|
36
|
-
const e =
|
|
35
|
+
o.useEffect(() => {
|
|
36
|
+
const e = r.current;
|
|
37
37
|
if (!e) return;
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
e.addEventListener("scroll",
|
|
41
|
-
const
|
|
42
|
-
|
|
38
|
+
f();
|
|
39
|
+
const l = () => f();
|
|
40
|
+
e.addEventListener("scroll", l);
|
|
41
|
+
const i = new ResizeObserver(() => {
|
|
42
|
+
f();
|
|
43
43
|
});
|
|
44
|
-
return
|
|
45
|
-
e.removeEventListener("scroll",
|
|
44
|
+
return i.observe(e), () => {
|
|
45
|
+
e.removeEventListener("scroll", l), i.disconnect();
|
|
46
46
|
};
|
|
47
|
-
}, [
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
},
|
|
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:
|
|
55
|
-
disabled:
|
|
54
|
+
onClick: l,
|
|
55
|
+
disabled: i
|
|
56
56
|
}) => {
|
|
57
|
-
if (
|
|
58
|
-
const
|
|
59
|
-
return /* @__PURE__ */
|
|
60
|
-
|
|
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:
|
|
68
|
-
disabled:
|
|
69
|
-
"aria-label":
|
|
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
|
-
|
|
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:
|
|
78
|
+
/* @__PURE__ */ t("span", { className: "sr-only", children: k })
|
|
79
79
|
]
|
|
80
80
|
}
|
|
81
81
|
);
|
|
82
|
-
},
|
|
83
|
-
const e =
|
|
84
|
-
|
|
82
|
+
}, S = (() => {
|
|
83
|
+
const e = x ? x({ onClick: w, disabled: !n }) : /* @__PURE__ */ t(
|
|
84
|
+
y,
|
|
85
85
|
{
|
|
86
86
|
direction: "left",
|
|
87
|
-
onClick:
|
|
87
|
+
onClick: w,
|
|
88
88
|
disabled: !n
|
|
89
89
|
}
|
|
90
|
-
),
|
|
91
|
-
|
|
90
|
+
), l = g ? g({ onClick: z, disabled: !s }) : /* @__PURE__ */ t(
|
|
91
|
+
y,
|
|
92
92
|
{
|
|
93
93
|
direction: "right",
|
|
94
|
-
onClick:
|
|
95
|
-
disabled: !
|
|
94
|
+
onClick: z,
|
|
95
|
+
disabled: !s
|
|
96
96
|
}
|
|
97
97
|
);
|
|
98
|
-
return
|
|
99
|
-
/* @__PURE__ */ t("div", { className: "
|
|
100
|
-
/* @__PURE__ */ t("div", { className: "
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
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
|
-
"
|
|
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:
|
|
122
|
+
style: { maxWidth: R },
|
|
119
123
|
"data-component": "horizontal-scroller",
|
|
120
|
-
...
|
|
124
|
+
...B,
|
|
121
125
|
children: [
|
|
122
|
-
|
|
126
|
+
S.left,
|
|
123
127
|
/* @__PURE__ */ t(
|
|
124
128
|
"div",
|
|
125
129
|
{
|
|
126
|
-
ref:
|
|
130
|
+
ref: r,
|
|
127
131
|
className: h(
|
|
128
|
-
"flex w-
|
|
129
|
-
|
|
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:
|
|
134
|
-
msOverflowStyle:
|
|
137
|
+
scrollbarWidth: u ? "none" : "auto",
|
|
138
|
+
msOverflowStyle: u ? "none" : "auto"
|
|
135
139
|
},
|
|
136
140
|
"data-component": "horizontal-scroller-viewport",
|
|
137
|
-
children: /* @__PURE__ */
|
|
141
|
+
children: /* @__PURE__ */ a(
|
|
138
142
|
"div",
|
|
139
143
|
{
|
|
140
144
|
style: {
|
|
141
|
-
width: `${
|
|
145
|
+
width: `${c.getTotalSize()}px`,
|
|
142
146
|
display: "flex",
|
|
143
147
|
position: "relative"
|
|
144
148
|
},
|
|
145
149
|
children: [
|
|
146
|
-
/* @__PURE__ */ t("div", { style: { width: `${
|
|
147
|
-
|
|
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:
|
|
154
|
+
ref: c.measureElement,
|
|
151
155
|
"data-index": e.index,
|
|
152
156
|
className: "flex-shrink-0",
|
|
153
|
-
children:
|
|
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
|
-
|
|
172
|
+
$.displayName = "HorizontalScroller";
|
|
168
173
|
export {
|
|
169
|
-
|
|
174
|
+
$ as default
|
|
170
175
|
};
|
|
@@ -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
|
}
|