laif-ds 0.1.5 → 0.1.6

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 (42) hide show
  1. package/dist/components/ui/data-table.js +122 -0
  2. package/dist/components/ui/toaster.js +26 -0
  3. package/dist/dist/_virtual/jsx-runtime.js +6 -0
  4. package/dist/dist/_virtual/jsx-runtime2.js +5 -0
  5. package/dist/dist/_virtual/react-jsx-runtime.development.js +5 -0
  6. package/dist/dist/_virtual/react-jsx-runtime.production.js +5 -0
  7. package/dist/dist/components/ui/checkbox.js +32 -0
  8. package/dist/dist/components/ui/scroll-area.js +61 -0
  9. package/dist/dist/components/ui/table.js +87 -0
  10. package/dist/dist/lib/utils.js +9 -0
  11. package/dist/dist/node_modules/@radix-ui/number/dist/index.js +7 -0
  12. package/dist/dist/node_modules/@radix-ui/primitive/dist/index.js +10 -0
  13. package/dist/dist/node_modules/@radix-ui/react-checkbox/dist/index.js +136 -0
  14. package/dist/dist/node_modules/@radix-ui/react-compose-refs/dist/index.js +30 -0
  15. package/dist/dist/node_modules/@radix-ui/react-context/dist/index.js +56 -0
  16. package/dist/dist/node_modules/@radix-ui/react-direction/dist/index.js +10 -0
  17. package/dist/dist/node_modules/@radix-ui/react-presence/dist/index.js +72 -0
  18. package/dist/dist/node_modules/@radix-ui/react-primitive/dist/index.js +32 -0
  19. package/dist/dist/node_modules/@radix-ui/react-scroll-area/dist/index.js +534 -0
  20. package/dist/dist/node_modules/@radix-ui/react-slot/dist/index.js +50 -0
  21. package/dist/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +14 -0
  22. package/dist/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +33 -0
  23. package/dist/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +7 -0
  24. package/dist/dist/node_modules/@radix-ui/react-use-previous/dist/index.js +9 -0
  25. package/dist/dist/node_modules/@radix-ui/react-use-size/dist/index.js +28 -0
  26. package/dist/dist/node_modules/clsx/dist/clsx.js +18 -0
  27. package/dist/dist/node_modules/lucide-react/dist/esm/Icon.js +41 -0
  28. package/dist/dist/node_modules/lucide-react/dist/esm/createLucideIcon.js +28 -0
  29. package/dist/dist/node_modules/lucide-react/dist/esm/defaultAttributes.js +21 -0
  30. package/dist/dist/node_modules/lucide-react/dist/esm/icons/check.js +13 -0
  31. package/dist/dist/node_modules/lucide-react/dist/esm/shared/src/utils.js +20 -0
  32. package/dist/dist/node_modules/react/cjs/react-jsx-runtime.development.js +248 -0
  33. package/dist/dist/node_modules/react/cjs/react-jsx-runtime.production.js +36 -0
  34. package/dist/dist/node_modules/react/jsx-runtime.js +11 -0
  35. package/dist/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +2732 -0
  36. package/dist/index.d.ts +23 -1
  37. package/dist/index.js +164 -162
  38. package/dist/node_modules/@tanstack/react-table/build/lib/index.js +103 -0
  39. package/dist/node_modules/@tanstack/table-core/build/lib/index.js +1896 -0
  40. package/dist/styles.css +1 -1
  41. package/package.json +9 -7
  42. package/dist/components/ui/sonner.js +0 -23
@@ -0,0 +1,72 @@
1
+ "use client";
2
+ import * as u from "react";
3
+ import { useComposedRefs as M } from "../../react-compose-refs/dist/index.js";
4
+ import { useLayoutEffect as N } from "../../react-use-layout-effect/dist/index.js";
5
+ function y(n, e) {
6
+ return u.useReducer((r, t) => e[r][t] ?? r, n);
7
+ }
8
+ var g = (n) => {
9
+ const { present: e, children: r } = n, t = E(e), i = typeof r == "function" ? r({ present: t.isPresent }) : u.Children.only(r), c = M(t.ref, R(i));
10
+ return typeof r == "function" || t.isPresent ? u.cloneElement(i, { ref: c }) : null;
11
+ };
12
+ g.displayName = "Presence";
13
+ function E(n) {
14
+ const [e, r] = u.useState(), t = u.useRef({}), i = u.useRef(n), c = u.useRef("none"), O = n ? "mounted" : "unmounted", [p, s] = y(O, {
15
+ mounted: {
16
+ UNMOUNT: "unmounted",
17
+ ANIMATION_OUT: "unmountSuspended"
18
+ },
19
+ unmountSuspended: {
20
+ MOUNT: "mounted",
21
+ ANIMATION_END: "unmounted"
22
+ },
23
+ unmounted: {
24
+ MOUNT: "mounted"
25
+ }
26
+ });
27
+ return u.useEffect(() => {
28
+ const o = f(t.current);
29
+ c.current = p === "mounted" ? o : "none";
30
+ }, [p]), N(() => {
31
+ const o = t.current, d = i.current;
32
+ if (d !== n) {
33
+ const a = c.current, m = f(o);
34
+ n ? s("MOUNT") : m === "none" || (o == null ? void 0 : o.display) === "none" ? s("UNMOUNT") : s(d && a !== m ? "ANIMATION_OUT" : "UNMOUNT"), i.current = n;
35
+ }
36
+ }, [n, s]), N(() => {
37
+ if (e) {
38
+ let o;
39
+ const d = e.ownerDocument.defaultView ?? window, a = (l) => {
40
+ const v = f(t.current).includes(l.animationName);
41
+ if (l.target === e && v && (s("ANIMATION_END"), !i.current)) {
42
+ const T = e.style.animationFillMode;
43
+ e.style.animationFillMode = "forwards", o = d.setTimeout(() => {
44
+ e.style.animationFillMode === "forwards" && (e.style.animationFillMode = T);
45
+ });
46
+ }
47
+ }, m = (l) => {
48
+ l.target === e && (c.current = f(t.current));
49
+ };
50
+ return e.addEventListener("animationstart", m), e.addEventListener("animationcancel", a), e.addEventListener("animationend", a), () => {
51
+ d.clearTimeout(o), e.removeEventListener("animationstart", m), e.removeEventListener("animationcancel", a), e.removeEventListener("animationend", a);
52
+ };
53
+ } else
54
+ s("ANIMATION_END");
55
+ }, [e, s]), {
56
+ isPresent: ["mounted", "unmountSuspended"].includes(p),
57
+ ref: u.useCallback((o) => {
58
+ o && (t.current = getComputedStyle(o)), r(o);
59
+ }, [])
60
+ };
61
+ }
62
+ function f(n) {
63
+ return (n == null ? void 0 : n.animationName) || "none";
64
+ }
65
+ function R(n) {
66
+ var e, r;
67
+ let t = (e = Object.getOwnPropertyDescriptor(n.props, "ref")) == null ? void 0 : e.get, i = t && "isReactWarning" in t && t.isReactWarning;
68
+ return i ? n.ref : (t = (r = Object.getOwnPropertyDescriptor(n, "ref")) == null ? void 0 : r.get, i = t && "isReactWarning" in t && t.isReactWarning, i ? n.props.ref : n.props.ref || n.ref);
69
+ }
70
+ export {
71
+ g as Presence
72
+ };
@@ -0,0 +1,32 @@
1
+ "use client";
2
+ import * as l from "react";
3
+ import "react-dom";
4
+ import { createSlot as p } from "../../react-slot/dist/index.js";
5
+ import { j as u } from "../../../../_virtual/jsx-runtime.js";
6
+ var f = [
7
+ "a",
8
+ "button",
9
+ "div",
10
+ "form",
11
+ "h2",
12
+ "h3",
13
+ "img",
14
+ "input",
15
+ "label",
16
+ "li",
17
+ "nav",
18
+ "ol",
19
+ "p",
20
+ "span",
21
+ "svg",
22
+ "ul"
23
+ ], w = f.reduce((o, r) => {
24
+ const t = p(`Primitive.${r}`), i = l.forwardRef((e, a) => {
25
+ const { asChild: m, ...n } = e, s = m ? t : r;
26
+ return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ u.jsx(s, { ...n, ref: a });
27
+ });
28
+ return i.displayName = `Primitive.${r}`, { ...o, [r]: i };
29
+ }, {});
30
+ export {
31
+ w as Primitive
32
+ };
@@ -0,0 +1,534 @@
1
+ "use client";
2
+ import * as i from "react";
3
+ import { Primitive as _ } from "../../react-primitive/dist/index.js";
4
+ import { Presence as W } from "../../react-presence/dist/index.js";
5
+ import { createContextScope as te } from "../../react-context/dist/index.js";
6
+ import { useComposedRefs as x } from "../../react-compose-refs/dist/index.js";
7
+ import { useCallbackRef as E } from "../../react-use-callback-ref/dist/index.js";
8
+ import { useDirection as ne } from "../../react-direction/dist/index.js";
9
+ import { useLayoutEffect as le } from "../../react-use-layout-effect/dist/index.js";
10
+ import { clamp as ie } from "../../number/dist/index.js";
11
+ import { composeEventHandlers as C } from "../../primitive/dist/index.js";
12
+ import { j as h } from "../../../../_virtual/jsx-runtime.js";
13
+ function ae(e, t) {
14
+ return i.useReducer((r, l) => t[r][l] ?? r, e);
15
+ }
16
+ var O = "ScrollArea", [F, Le] = te(O), [se, b] = F(O), B = i.forwardRef(
17
+ (e, t) => {
18
+ const {
19
+ __scopeScrollArea: r,
20
+ type: l = "hover",
21
+ dir: o,
22
+ scrollHideDelay: n = 600,
23
+ ...a
24
+ } = e, [s, c] = i.useState(null), [f, d] = i.useState(null), [p, u] = i.useState(null), [w, m] = i.useState(null), [X, M] = i.useState(null), [y, A] = i.useState(0), [I, L] = i.useState(0), [D, R] = i.useState(!1), [j, z] = i.useState(!1), v = x(t, (P) => c(P)), S = ne(o);
25
+ return /* @__PURE__ */ h.jsx(
26
+ se,
27
+ {
28
+ scope: r,
29
+ type: l,
30
+ dir: S,
31
+ scrollHideDelay: n,
32
+ scrollArea: s,
33
+ viewport: f,
34
+ onViewportChange: d,
35
+ content: p,
36
+ onContentChange: u,
37
+ scrollbarX: w,
38
+ onScrollbarXChange: m,
39
+ scrollbarXEnabled: D,
40
+ onScrollbarXEnabledChange: R,
41
+ scrollbarY: X,
42
+ onScrollbarYChange: M,
43
+ scrollbarYEnabled: j,
44
+ onScrollbarYEnabledChange: z,
45
+ onCornerWidthChange: A,
46
+ onCornerHeightChange: L,
47
+ children: /* @__PURE__ */ h.jsx(
48
+ _.div,
49
+ {
50
+ dir: S,
51
+ ...a,
52
+ ref: v,
53
+ style: {
54
+ position: "relative",
55
+ // Pass corner sizes as CSS vars to reduce re-renders of context consumers
56
+ "--radix-scroll-area-corner-width": y + "px",
57
+ "--radix-scroll-area-corner-height": I + "px",
58
+ ...e.style
59
+ }
60
+ }
61
+ )
62
+ }
63
+ );
64
+ }
65
+ );
66
+ B.displayName = O;
67
+ var q = "ScrollAreaViewport", G = i.forwardRef(
68
+ (e, t) => {
69
+ const { __scopeScrollArea: r, children: l, nonce: o, ...n } = e, a = b(q, r), s = i.useRef(null), c = x(t, s, a.onViewportChange);
70
+ return /* @__PURE__ */ h.jsxs(h.Fragment, { children: [
71
+ /* @__PURE__ */ h.jsx(
72
+ "style",
73
+ {
74
+ dangerouslySetInnerHTML: {
75
+ __html: "[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"
76
+ },
77
+ nonce: o
78
+ }
79
+ ),
80
+ /* @__PURE__ */ h.jsx(
81
+ _.div,
82
+ {
83
+ "data-radix-scroll-area-viewport": "",
84
+ ...n,
85
+ ref: c,
86
+ style: {
87
+ /**
88
+ * We don't support `visible` because the intention is to have at least one scrollbar
89
+ * if this component is used and `visible` will behave like `auto` in that case
90
+ * https://developer.mozilla.org/en-US/docs/Web/CSS/overflow#description
91
+ *
92
+ * We don't handle `auto` because the intention is for the native implementation
93
+ * to be hidden if using this component. We just want to ensure the node is scrollable
94
+ * so could have used either `scroll` or `auto` here. We picked `scroll` to prevent
95
+ * the browser from having to work out whether to render native scrollbars or not,
96
+ * we tell it to with the intention of hiding them in CSS.
97
+ */
98
+ overflowX: a.scrollbarXEnabled ? "scroll" : "hidden",
99
+ overflowY: a.scrollbarYEnabled ? "scroll" : "hidden",
100
+ ...e.style
101
+ },
102
+ children: /* @__PURE__ */ h.jsx("div", { ref: a.onContentChange, style: { minWidth: "100%", display: "table" }, children: l })
103
+ }
104
+ )
105
+ ] });
106
+ }
107
+ );
108
+ G.displayName = q;
109
+ var g = "ScrollAreaScrollbar", ce = i.forwardRef(
110
+ (e, t) => {
111
+ const { forceMount: r, ...l } = e, o = b(g, e.__scopeScrollArea), { onScrollbarXEnabledChange: n, onScrollbarYEnabledChange: a } = o, s = e.orientation === "horizontal";
112
+ return i.useEffect(() => (s ? n(!0) : a(!0), () => {
113
+ s ? n(!1) : a(!1);
114
+ }), [s, n, a]), o.type === "hover" ? /* @__PURE__ */ h.jsx(de, { ...l, ref: t, forceMount: r }) : o.type === "scroll" ? /* @__PURE__ */ h.jsx(ue, { ...l, ref: t, forceMount: r }) : o.type === "auto" ? /* @__PURE__ */ h.jsx(J, { ...l, ref: t, forceMount: r }) : o.type === "always" ? /* @__PURE__ */ h.jsx(U, { ...l, ref: t }) : null;
115
+ }
116
+ );
117
+ ce.displayName = g;
118
+ var de = i.forwardRef((e, t) => {
119
+ const { forceMount: r, ...l } = e, o = b(g, e.__scopeScrollArea), [n, a] = i.useState(!1);
120
+ return i.useEffect(() => {
121
+ const s = o.scrollArea;
122
+ let c = 0;
123
+ if (s) {
124
+ const f = () => {
125
+ window.clearTimeout(c), a(!0);
126
+ }, d = () => {
127
+ c = window.setTimeout(() => a(!1), o.scrollHideDelay);
128
+ };
129
+ return s.addEventListener("pointerenter", f), s.addEventListener("pointerleave", d), () => {
130
+ window.clearTimeout(c), s.removeEventListener("pointerenter", f), s.removeEventListener("pointerleave", d);
131
+ };
132
+ }
133
+ }, [o.scrollArea, o.scrollHideDelay]), /* @__PURE__ */ h.jsx(W, { present: r || n, children: /* @__PURE__ */ h.jsx(
134
+ J,
135
+ {
136
+ "data-state": n ? "visible" : "hidden",
137
+ ...l,
138
+ ref: t
139
+ }
140
+ ) });
141
+ }), ue = i.forwardRef((e, t) => {
142
+ const { forceMount: r, ...l } = e, o = b(g, e.__scopeScrollArea), n = e.orientation === "horizontal", a = Y(() => c("SCROLL_END"), 100), [s, c] = ae("hidden", {
143
+ hidden: {
144
+ SCROLL: "scrolling"
145
+ },
146
+ scrolling: {
147
+ SCROLL_END: "idle",
148
+ POINTER_ENTER: "interacting"
149
+ },
150
+ interacting: {
151
+ SCROLL: "interacting",
152
+ POINTER_LEAVE: "idle"
153
+ },
154
+ idle: {
155
+ HIDE: "hidden",
156
+ SCROLL: "scrolling",
157
+ POINTER_ENTER: "interacting"
158
+ }
159
+ });
160
+ return i.useEffect(() => {
161
+ if (s === "idle") {
162
+ const f = window.setTimeout(() => c("HIDE"), o.scrollHideDelay);
163
+ return () => window.clearTimeout(f);
164
+ }
165
+ }, [s, o.scrollHideDelay, c]), i.useEffect(() => {
166
+ const f = o.viewport, d = n ? "scrollLeft" : "scrollTop";
167
+ if (f) {
168
+ let p = f[d];
169
+ const u = () => {
170
+ const w = f[d];
171
+ p !== w && (c("SCROLL"), a()), p = w;
172
+ };
173
+ return f.addEventListener("scroll", u), () => f.removeEventListener("scroll", u);
174
+ }
175
+ }, [o.viewport, n, c, a]), /* @__PURE__ */ h.jsx(W, { present: r || s !== "hidden", children: /* @__PURE__ */ h.jsx(
176
+ U,
177
+ {
178
+ "data-state": s === "hidden" ? "hidden" : "visible",
179
+ ...l,
180
+ ref: t,
181
+ onPointerEnter: C(e.onPointerEnter, () => c("POINTER_ENTER")),
182
+ onPointerLeave: C(e.onPointerLeave, () => c("POINTER_LEAVE"))
183
+ }
184
+ ) });
185
+ }), J = i.forwardRef((e, t) => {
186
+ const r = b(g, e.__scopeScrollArea), { forceMount: l, ...o } = e, [n, a] = i.useState(!1), s = e.orientation === "horizontal", c = Y(() => {
187
+ if (r.viewport) {
188
+ const f = r.viewport.offsetWidth < r.viewport.scrollWidth, d = r.viewport.offsetHeight < r.viewport.scrollHeight;
189
+ a(s ? f : d);
190
+ }
191
+ }, 10);
192
+ return T(r.viewport, c), T(r.content, c), /* @__PURE__ */ h.jsx(W, { present: l || n, children: /* @__PURE__ */ h.jsx(
193
+ U,
194
+ {
195
+ "data-state": n ? "visible" : "hidden",
196
+ ...o,
197
+ ref: t
198
+ }
199
+ ) });
200
+ }), U = i.forwardRef((e, t) => {
201
+ const { orientation: r = "vertical", ...l } = e, o = b(g, e.__scopeScrollArea), n = i.useRef(null), a = i.useRef(0), [s, c] = i.useState({
202
+ content: 0,
203
+ viewport: 0,
204
+ scrollbar: { size: 0, paddingStart: 0, paddingEnd: 0 }
205
+ }), f = ee(s.viewport, s.content), d = {
206
+ ...l,
207
+ sizes: s,
208
+ onSizesChange: c,
209
+ hasThumb: f > 0 && f < 1,
210
+ onThumbChange: (u) => n.current = u,
211
+ onThumbPointerUp: () => a.current = 0,
212
+ onThumbPointerDown: (u) => a.current = u
213
+ };
214
+ function p(u, w) {
215
+ return me(u, a.current, s, w);
216
+ }
217
+ return r === "horizontal" ? /* @__PURE__ */ h.jsx(
218
+ fe,
219
+ {
220
+ ...d,
221
+ ref: t,
222
+ onThumbPositionChange: () => {
223
+ if (o.viewport && n.current) {
224
+ const u = o.viewport.scrollLeft, w = V(u, s, o.dir);
225
+ n.current.style.transform = `translate3d(${w}px, 0, 0)`;
226
+ }
227
+ },
228
+ onWheelScroll: (u) => {
229
+ o.viewport && (o.viewport.scrollLeft = u);
230
+ },
231
+ onDragScroll: (u) => {
232
+ o.viewport && (o.viewport.scrollLeft = p(u, o.dir));
233
+ }
234
+ }
235
+ ) : r === "vertical" ? /* @__PURE__ */ h.jsx(
236
+ pe,
237
+ {
238
+ ...d,
239
+ ref: t,
240
+ onThumbPositionChange: () => {
241
+ if (o.viewport && n.current) {
242
+ const u = o.viewport.scrollTop, w = V(u, s);
243
+ n.current.style.transform = `translate3d(0, ${w}px, 0)`;
244
+ }
245
+ },
246
+ onWheelScroll: (u) => {
247
+ o.viewport && (o.viewport.scrollTop = u);
248
+ },
249
+ onDragScroll: (u) => {
250
+ o.viewport && (o.viewport.scrollTop = p(u));
251
+ }
252
+ }
253
+ ) : null;
254
+ }), fe = i.forwardRef((e, t) => {
255
+ const { sizes: r, onSizesChange: l, ...o } = e, n = b(g, e.__scopeScrollArea), [a, s] = i.useState(), c = i.useRef(null), f = x(t, c, n.onScrollbarXChange);
256
+ return i.useEffect(() => {
257
+ c.current && s(getComputedStyle(c.current));
258
+ }, [c]), /* @__PURE__ */ h.jsx(
259
+ Q,
260
+ {
261
+ "data-orientation": "horizontal",
262
+ ...o,
263
+ ref: f,
264
+ sizes: r,
265
+ style: {
266
+ bottom: 0,
267
+ left: n.dir === "rtl" ? "var(--radix-scroll-area-corner-width)" : 0,
268
+ right: n.dir === "ltr" ? "var(--radix-scroll-area-corner-width)" : 0,
269
+ "--radix-scroll-area-thumb-width": N(r) + "px",
270
+ ...e.style
271
+ },
272
+ onThumbPointerDown: (d) => e.onThumbPointerDown(d.x),
273
+ onDragScroll: (d) => e.onDragScroll(d.x),
274
+ onWheelScroll: (d, p) => {
275
+ if (n.viewport) {
276
+ const u = n.viewport.scrollLeft + d.deltaX;
277
+ e.onWheelScroll(u), oe(u, p) && d.preventDefault();
278
+ }
279
+ },
280
+ onResize: () => {
281
+ c.current && n.viewport && a && l({
282
+ content: n.viewport.scrollWidth,
283
+ viewport: n.viewport.offsetWidth,
284
+ scrollbar: {
285
+ size: c.current.clientWidth,
286
+ paddingStart: H(a.paddingLeft),
287
+ paddingEnd: H(a.paddingRight)
288
+ }
289
+ });
290
+ }
291
+ }
292
+ );
293
+ }), pe = i.forwardRef((e, t) => {
294
+ const { sizes: r, onSizesChange: l, ...o } = e, n = b(g, e.__scopeScrollArea), [a, s] = i.useState(), c = i.useRef(null), f = x(t, c, n.onScrollbarYChange);
295
+ return i.useEffect(() => {
296
+ c.current && s(getComputedStyle(c.current));
297
+ }, [c]), /* @__PURE__ */ h.jsx(
298
+ Q,
299
+ {
300
+ "data-orientation": "vertical",
301
+ ...o,
302
+ ref: f,
303
+ sizes: r,
304
+ style: {
305
+ top: 0,
306
+ right: n.dir === "ltr" ? 0 : void 0,
307
+ left: n.dir === "rtl" ? 0 : void 0,
308
+ bottom: "var(--radix-scroll-area-corner-height)",
309
+ "--radix-scroll-area-thumb-height": N(r) + "px",
310
+ ...e.style
311
+ },
312
+ onThumbPointerDown: (d) => e.onThumbPointerDown(d.y),
313
+ onDragScroll: (d) => e.onDragScroll(d.y),
314
+ onWheelScroll: (d, p) => {
315
+ if (n.viewport) {
316
+ const u = n.viewport.scrollTop + d.deltaY;
317
+ e.onWheelScroll(u), oe(u, p) && d.preventDefault();
318
+ }
319
+ },
320
+ onResize: () => {
321
+ c.current && n.viewport && a && l({
322
+ content: n.viewport.scrollHeight,
323
+ viewport: n.viewport.offsetHeight,
324
+ scrollbar: {
325
+ size: c.current.clientHeight,
326
+ paddingStart: H(a.paddingTop),
327
+ paddingEnd: H(a.paddingBottom)
328
+ }
329
+ });
330
+ }
331
+ }
332
+ );
333
+ }), [he, K] = F(g), Q = i.forwardRef((e, t) => {
334
+ const {
335
+ __scopeScrollArea: r,
336
+ sizes: l,
337
+ hasThumb: o,
338
+ onThumbChange: n,
339
+ onThumbPointerUp: a,
340
+ onThumbPointerDown: s,
341
+ onThumbPositionChange: c,
342
+ onDragScroll: f,
343
+ onWheelScroll: d,
344
+ onResize: p,
345
+ ...u
346
+ } = e, w = b(g, r), [m, X] = i.useState(null), M = x(t, (v) => X(v)), y = i.useRef(null), A = i.useRef(""), I = w.viewport, L = l.content - l.viewport, D = E(d), R = E(c), j = Y(p, 10);
347
+ function z(v) {
348
+ if (y.current) {
349
+ const S = v.clientX - y.current.left, P = v.clientY - y.current.top;
350
+ f({ x: S, y: P });
351
+ }
352
+ }
353
+ return i.useEffect(() => {
354
+ const v = (S) => {
355
+ const P = S.target;
356
+ m != null && m.contains(P) && D(S, L);
357
+ };
358
+ return document.addEventListener("wheel", v, { passive: !1 }), () => document.removeEventListener("wheel", v, { passive: !1 });
359
+ }, [I, m, L, D]), i.useEffect(R, [l, R]), T(m, j), T(w.content, j), /* @__PURE__ */ h.jsx(
360
+ he,
361
+ {
362
+ scope: r,
363
+ scrollbar: m,
364
+ hasThumb: o,
365
+ onThumbChange: E(n),
366
+ onThumbPointerUp: E(a),
367
+ onThumbPositionChange: R,
368
+ onThumbPointerDown: E(s),
369
+ children: /* @__PURE__ */ h.jsx(
370
+ _.div,
371
+ {
372
+ ...u,
373
+ ref: M,
374
+ style: { position: "absolute", ...u.style },
375
+ onPointerDown: C(e.onPointerDown, (v) => {
376
+ v.button === 0 && (v.target.setPointerCapture(v.pointerId), y.current = m.getBoundingClientRect(), A.current = document.body.style.webkitUserSelect, document.body.style.webkitUserSelect = "none", w.viewport && (w.viewport.style.scrollBehavior = "auto"), z(v));
377
+ }),
378
+ onPointerMove: C(e.onPointerMove, z),
379
+ onPointerUp: C(e.onPointerUp, (v) => {
380
+ const S = v.target;
381
+ S.hasPointerCapture(v.pointerId) && S.releasePointerCapture(v.pointerId), document.body.style.webkitUserSelect = A.current, w.viewport && (w.viewport.style.scrollBehavior = ""), y.current = null;
382
+ })
383
+ }
384
+ )
385
+ }
386
+ );
387
+ }), $ = "ScrollAreaThumb", we = i.forwardRef(
388
+ (e, t) => {
389
+ const { forceMount: r, ...l } = e, o = K($, e.__scopeScrollArea);
390
+ return /* @__PURE__ */ h.jsx(W, { present: r || o.hasThumb, children: /* @__PURE__ */ h.jsx(ve, { ref: t, ...l }) });
391
+ }
392
+ ), ve = i.forwardRef(
393
+ (e, t) => {
394
+ const { __scopeScrollArea: r, style: l, ...o } = e, n = b($, r), a = K($, r), { onThumbPositionChange: s } = a, c = x(
395
+ t,
396
+ (p) => a.onThumbChange(p)
397
+ ), f = i.useRef(void 0), d = Y(() => {
398
+ f.current && (f.current(), f.current = void 0);
399
+ }, 100);
400
+ return i.useEffect(() => {
401
+ const p = n.viewport;
402
+ if (p) {
403
+ const u = () => {
404
+ if (d(), !f.current) {
405
+ const w = Se(p, s);
406
+ f.current = w, s();
407
+ }
408
+ };
409
+ return s(), p.addEventListener("scroll", u), () => p.removeEventListener("scroll", u);
410
+ }
411
+ }, [n.viewport, d, s]), /* @__PURE__ */ h.jsx(
412
+ _.div,
413
+ {
414
+ "data-state": a.hasThumb ? "visible" : "hidden",
415
+ ...o,
416
+ ref: c,
417
+ style: {
418
+ width: "var(--radix-scroll-area-thumb-width)",
419
+ height: "var(--radix-scroll-area-thumb-height)",
420
+ ...l
421
+ },
422
+ onPointerDownCapture: C(e.onPointerDownCapture, (p) => {
423
+ const u = p.target.getBoundingClientRect(), w = p.clientX - u.left, m = p.clientY - u.top;
424
+ a.onThumbPointerDown({ x: w, y: m });
425
+ }),
426
+ onPointerUp: C(e.onPointerUp, a.onThumbPointerUp)
427
+ }
428
+ );
429
+ }
430
+ );
431
+ we.displayName = $;
432
+ var k = "ScrollAreaCorner", Z = i.forwardRef(
433
+ (e, t) => {
434
+ const r = b(k, e.__scopeScrollArea), l = !!(r.scrollbarX && r.scrollbarY);
435
+ return r.type !== "scroll" && l ? /* @__PURE__ */ h.jsx(be, { ...e, ref: t }) : null;
436
+ }
437
+ );
438
+ Z.displayName = k;
439
+ var be = i.forwardRef((e, t) => {
440
+ const { __scopeScrollArea: r, ...l } = e, o = b(k, r), [n, a] = i.useState(0), [s, c] = i.useState(0), f = !!(n && s);
441
+ return T(o.scrollbarX, () => {
442
+ var d;
443
+ const p = ((d = o.scrollbarX) == null ? void 0 : d.offsetHeight) || 0;
444
+ o.onCornerHeightChange(p), c(p);
445
+ }), T(o.scrollbarY, () => {
446
+ var d;
447
+ const p = ((d = o.scrollbarY) == null ? void 0 : d.offsetWidth) || 0;
448
+ o.onCornerWidthChange(p), a(p);
449
+ }), f ? /* @__PURE__ */ h.jsx(
450
+ _.div,
451
+ {
452
+ ...l,
453
+ ref: t,
454
+ style: {
455
+ width: n,
456
+ height: s,
457
+ position: "absolute",
458
+ right: o.dir === "ltr" ? 0 : void 0,
459
+ left: o.dir === "rtl" ? 0 : void 0,
460
+ bottom: 0,
461
+ ...e.style
462
+ }
463
+ }
464
+ ) : null;
465
+ });
466
+ function H(e) {
467
+ return e ? parseInt(e, 10) : 0;
468
+ }
469
+ function ee(e, t) {
470
+ const r = e / t;
471
+ return isNaN(r) ? 0 : r;
472
+ }
473
+ function N(e) {
474
+ const t = ee(e.viewport, e.content), r = e.scrollbar.paddingStart + e.scrollbar.paddingEnd, l = (e.scrollbar.size - r) * t;
475
+ return Math.max(l, 18);
476
+ }
477
+ function me(e, t, r, l = "ltr") {
478
+ const o = N(r), n = o / 2, a = t || n, s = o - a, c = r.scrollbar.paddingStart + a, f = r.scrollbar.size - r.scrollbar.paddingEnd - s, d = r.content - r.viewport, p = l === "ltr" ? [0, d] : [d * -1, 0];
479
+ return re([c, f], p)(e);
480
+ }
481
+ function V(e, t, r = "ltr") {
482
+ const l = N(t), o = t.scrollbar.paddingStart + t.scrollbar.paddingEnd, n = t.scrollbar.size - o, a = t.content - t.viewport, s = n - l, c = r === "ltr" ? [0, a] : [a * -1, 0], f = ie(e, c);
483
+ return re([0, a], [0, s])(f);
484
+ }
485
+ function re(e, t) {
486
+ return (r) => {
487
+ if (e[0] === e[1] || t[0] === t[1]) return t[0];
488
+ const l = (t[1] - t[0]) / (e[1] - e[0]);
489
+ return t[0] + l * (r - e[0]);
490
+ };
491
+ }
492
+ function oe(e, t) {
493
+ return e > 0 && e < t;
494
+ }
495
+ var Se = (e, t = () => {
496
+ }) => {
497
+ let r = { left: e.scrollLeft, top: e.scrollTop }, l = 0;
498
+ return function o() {
499
+ const n = { left: e.scrollLeft, top: e.scrollTop }, a = r.left !== n.left, s = r.top !== n.top;
500
+ (a || s) && t(), r = n, l = window.requestAnimationFrame(o);
501
+ }(), () => window.cancelAnimationFrame(l);
502
+ };
503
+ function Y(e, t) {
504
+ const r = E(e), l = i.useRef(0);
505
+ return i.useEffect(() => () => window.clearTimeout(l.current), []), i.useCallback(() => {
506
+ window.clearTimeout(l.current), l.current = window.setTimeout(r, t);
507
+ }, [r, t]);
508
+ }
509
+ function T(e, t) {
510
+ const r = E(t);
511
+ le(() => {
512
+ let l = 0;
513
+ if (e) {
514
+ const o = new ResizeObserver(() => {
515
+ cancelAnimationFrame(l), l = window.requestAnimationFrame(r);
516
+ });
517
+ return o.observe(e), () => {
518
+ window.cancelAnimationFrame(l), o.unobserve(e);
519
+ };
520
+ }
521
+ }, [e, r]);
522
+ }
523
+ var De = B, je = G, ze = Z;
524
+ export {
525
+ ze as Corner,
526
+ De as Root,
527
+ B as ScrollArea,
528
+ Z as ScrollAreaCorner,
529
+ ce as ScrollAreaScrollbar,
530
+ we as ScrollAreaThumb,
531
+ G as ScrollAreaViewport,
532
+ je as Viewport,
533
+ Le as createScrollAreaScope
534
+ };
@@ -0,0 +1,50 @@
1
+ "use client";
2
+ import * as t from "react";
3
+ import { composeRefs as m } from "../../react-compose-refs/dist/index.js";
4
+ import { j as f } from "../../../../_virtual/jsx-runtime.js";
5
+ // @__NO_SIDE_EFFECTS__
6
+ function C(e) {
7
+ const i = /* @__PURE__ */ y(e), o = t.forwardRef((n, r) => {
8
+ const { children: l, ...s } = n, c = t.Children.toArray(l), p = c.find(g);
9
+ if (p) {
10
+ const a = p.props.children, u = c.map((d) => d === p ? t.Children.count(a) > 1 ? t.Children.only(null) : t.isValidElement(a) ? a.props.children : null : d);
11
+ return /* @__PURE__ */ f.jsx(i, { ...s, ref: r, children: t.isValidElement(a) ? t.cloneElement(a, void 0, u) : null });
12
+ }
13
+ return /* @__PURE__ */ f.jsx(i, { ...s, ref: r, children: l });
14
+ });
15
+ return o.displayName = `${e}.Slot`, o;
16
+ }
17
+ // @__NO_SIDE_EFFECTS__
18
+ function y(e) {
19
+ const i = t.forwardRef((o, n) => {
20
+ const { children: r, ...l } = o;
21
+ if (t.isValidElement(r)) {
22
+ const s = x(r), c = R(l, r.props);
23
+ return r.type !== t.Fragment && (c.ref = n ? m(n, s) : s), t.cloneElement(r, c);
24
+ }
25
+ return t.Children.count(r) > 1 ? t.Children.only(null) : null;
26
+ });
27
+ return i.displayName = `${e}.SlotClone`, i;
28
+ }
29
+ var h = Symbol("radix.slottable");
30
+ function g(e) {
31
+ return t.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === h;
32
+ }
33
+ function R(e, i) {
34
+ const o = { ...i };
35
+ for (const n in i) {
36
+ const r = e[n], l = i[n];
37
+ /^on[A-Z]/.test(n) ? r && l ? o[n] = (...s) => {
38
+ l(...s), r(...s);
39
+ } : r && (o[n] = r) : n === "style" ? o[n] = { ...r, ...l } : n === "className" && (o[n] = [r, l].filter(Boolean).join(" "));
40
+ }
41
+ return { ...e, ...o };
42
+ }
43
+ function x(e) {
44
+ var i, o;
45
+ let n = (i = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : i.get, r = n && "isReactWarning" in n && n.isReactWarning;
46
+ return r ? e.ref : (n = (o = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : o.get, r = n && "isReactWarning" in n && n.isReactWarning, r ? e.props.ref : e.props.ref || e.ref);
47
+ }
48
+ export {
49
+ C as createSlot
50
+ };