@caseparts-org/caseblocks 0.0.96 → 0.0.97
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,49 +1,55 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { c as
|
|
4
|
-
import '../../assets/HorizontalScroll.css';const
|
|
5
|
-
container:
|
|
6
|
-
dragging:
|
|
1
|
+
import { jsx as x } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as c, useState as D, useEffect as L } from "react";
|
|
3
|
+
import { c as b } from "../../clsx-OuTLNxxd.js";
|
|
4
|
+
import '../../assets/HorizontalScroll.css';const P = "_container_aum2v_1", S = "_dragging_aum2v_14", s = {
|
|
5
|
+
container: P,
|
|
6
|
+
dragging: S,
|
|
7
7
|
"scrollVisibility--false": "_scrollVisibility--false_aum2v_19"
|
|
8
8
|
};
|
|
9
|
-
function
|
|
10
|
-
className:
|
|
11
|
-
showScrollbar:
|
|
12
|
-
children:
|
|
9
|
+
function M({
|
|
10
|
+
className: d,
|
|
11
|
+
showScrollbar: g = !1,
|
|
12
|
+
children: p
|
|
13
13
|
}) {
|
|
14
|
-
const r =
|
|
15
|
-
r.current && (
|
|
16
|
-
},
|
|
17
|
-
if (!
|
|
18
|
-
const
|
|
19
|
-
r.current.scrollLeft =
|
|
20
|
-
},
|
|
21
|
-
r.current &&
|
|
14
|
+
const r = c(null), [a, i] = D(!1), n = c({ x: 0, scroll: 0 }), l = c(!1), v = 5, m = (t) => {
|
|
15
|
+
r.current && (i(!0), n.current.x = t.clientX, n.current.scroll = r.current.scrollLeft, l.current = !1);
|
|
16
|
+
}, h = (t) => {
|
|
17
|
+
if (!a || !r.current) return;
|
|
18
|
+
const o = t.clientX - n.current.x;
|
|
19
|
+
r.current.scrollLeft = n.current.scroll - o, Math.abs(t.clientX - n.current.x) > v && (l.current = !0);
|
|
20
|
+
}, u = () => {
|
|
21
|
+
r.current && i(!1);
|
|
22
22
|
}, _ = (t) => {
|
|
23
|
-
|
|
24
|
-
if (!n || !(n.scrollWidth > n.clientWidth)) return;
|
|
25
|
-
const i = Math.abs(t.deltaY) >= Math.abs(t.deltaX) && t.deltaY !== 0 ? t.deltaY : t.deltaX;
|
|
26
|
-
i !== 0 ? (t.preventDefault(), n.scrollLeft += i) : t.preventDefault();
|
|
23
|
+
l.current && (t.preventDefault(), t.stopPropagation(), l.current = !1);
|
|
27
24
|
};
|
|
28
|
-
return
|
|
25
|
+
return L(() => {
|
|
26
|
+
const t = r.current;
|
|
27
|
+
if (!t) return;
|
|
28
|
+
const o = (e) => {
|
|
29
|
+
if (!(t.scrollWidth > t.clientWidth)) return;
|
|
30
|
+
const f = Math.abs(e.deltaY) >= Math.abs(e.deltaX) && e.deltaY !== 0 ? e.deltaY : e.deltaX;
|
|
31
|
+
f !== 0 ? (e.preventDefault(), t.scrollLeft += f) : e.preventDefault();
|
|
32
|
+
};
|
|
33
|
+
return t.addEventListener("wheel", o, { passive: !1 }), () => t.removeEventListener("wheel", o);
|
|
34
|
+
}, []), /* @__PURE__ */ x(
|
|
29
35
|
"div",
|
|
30
36
|
{
|
|
31
37
|
ref: r,
|
|
32
|
-
className:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
38
|
+
className: b(
|
|
39
|
+
d,
|
|
40
|
+
s.container,
|
|
41
|
+
s[`scrollVisibility--${g}`],
|
|
42
|
+
a ? s.dragging : ""
|
|
37
43
|
),
|
|
38
|
-
onPointerDown:
|
|
39
|
-
onPointerMove:
|
|
40
|
-
onPointerLeave:
|
|
41
|
-
onPointerUp:
|
|
42
|
-
|
|
43
|
-
children:
|
|
44
|
+
onPointerDown: m,
|
|
45
|
+
onPointerMove: h,
|
|
46
|
+
onPointerLeave: u,
|
|
47
|
+
onPointerUp: u,
|
|
48
|
+
onClickCapture: _,
|
|
49
|
+
children: p
|
|
44
50
|
}
|
|
45
51
|
);
|
|
46
52
|
}
|
|
47
53
|
export {
|
|
48
|
-
|
|
54
|
+
M as HorizontalScroll
|
|
49
55
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { HorizontalScroll as
|
|
3
|
-
const
|
|
1
|
+
import { jsxs as t, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { HorizontalScroll as r } from "./HorizontalScroll.js";
|
|
3
|
+
const S = {
|
|
4
4
|
title: "Case Parts/Atoms/HorizontalScroll",
|
|
5
|
-
component:
|
|
5
|
+
component: r,
|
|
6
6
|
tags: ["autodocs"],
|
|
7
7
|
parameters: {
|
|
8
8
|
layout: "fullscreen",
|
|
@@ -60,48 +60,59 @@ Use for carousels, chip lists, card rails, horizontally overflowing panels.
|
|
|
60
60
|
rounded: !0,
|
|
61
61
|
gradient: !0
|
|
62
62
|
}
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
}, l = /* @__PURE__ */ o("style", { children: `
|
|
64
|
+
.horizontalDemoScroll {
|
|
65
|
+
touch-action: none; /* ensure pointer events for horizontal drag */
|
|
66
|
+
}
|
|
67
|
+
.horizontalDemoScroll a {
|
|
68
|
+
-webkit-user-drag: none; /* Safari/Chrome: prevent ghost dragging of link */
|
|
69
|
+
}
|
|
70
|
+
` }), n = (e) => {
|
|
71
|
+
const { itemCount: s, itemWidth: c, itemHeight: i, gap: d, rounded: h, gradient: m } = e;
|
|
72
|
+
return Array.from({ length: s }, (p, g) => {
|
|
73
|
+
const a = g + 1;
|
|
74
|
+
return /* @__PURE__ */ o(
|
|
75
|
+
"a",
|
|
69
76
|
{
|
|
77
|
+
href: "/",
|
|
78
|
+
draggable: !1,
|
|
70
79
|
style: {
|
|
71
80
|
flex: "0 0 auto",
|
|
72
|
-
width:
|
|
73
|
-
height:
|
|
81
|
+
width: c,
|
|
82
|
+
height: i,
|
|
74
83
|
marginRight: d,
|
|
75
|
-
borderRadius:
|
|
76
|
-
background:
|
|
84
|
+
borderRadius: h ? 8 : 0,
|
|
85
|
+
background: m ? "linear-gradient(135deg,#4F46E5,#6366F1)" : "#4F46E5",
|
|
77
86
|
color: "#fff",
|
|
78
87
|
display: "flex",
|
|
79
88
|
alignItems: "center",
|
|
80
89
|
justifyContent: "center",
|
|
81
|
-
fontSize: Math.max(12, Math.min(24,
|
|
90
|
+
fontSize: Math.max(12, Math.min(24, i / 3)),
|
|
82
91
|
fontWeight: 600,
|
|
83
92
|
userSelect: "none",
|
|
84
93
|
boxShadow: "0 2px 6px rgba(0,0,0,0.25)"
|
|
85
94
|
},
|
|
86
|
-
children:
|
|
95
|
+
children: a
|
|
87
96
|
},
|
|
88
|
-
|
|
97
|
+
a
|
|
89
98
|
);
|
|
90
99
|
});
|
|
91
100
|
}, y = {
|
|
92
101
|
name: "Playground",
|
|
93
|
-
render: (e) => /* @__PURE__ */
|
|
94
|
-
|
|
95
|
-
/* @__PURE__ */
|
|
96
|
-
/* @__PURE__ */
|
|
102
|
+
render: (e) => /* @__PURE__ */ t("div", { style: { padding: 24 }, children: [
|
|
103
|
+
l,
|
|
104
|
+
/* @__PURE__ */ o("h3", { style: { margin: "0 0 12px" }, children: "HorizontalScroll Playground" }),
|
|
105
|
+
/* @__PURE__ */ o("p", { style: { margin: "0 0 16px", fontSize: 14, color: "#555" }, children: "Drag horizontally or use the mouse wheel. Tweak values in Controls." }),
|
|
106
|
+
/* @__PURE__ */ o(r, { className: "horizontalDemoScroll", showScrollbar: e.showScrollbar, children: n(e) })
|
|
97
107
|
] })
|
|
98
108
|
}, f = {
|
|
99
109
|
args: { showScrollbar: !0 },
|
|
100
|
-
render: (e) => /* @__PURE__ */
|
|
101
|
-
|
|
102
|
-
/* @__PURE__ */
|
|
110
|
+
render: (e) => /* @__PURE__ */ t("div", { style: { padding: 24 }, children: [
|
|
111
|
+
l,
|
|
112
|
+
/* @__PURE__ */ o("h3", { style: { margin: "0 0 12px" }, children: "Scrollbar Visible" }),
|
|
113
|
+
/* @__PURE__ */ o(r, { className: "horizontalDemoScroll", showScrollbar: !0, children: n(e) })
|
|
103
114
|
] })
|
|
104
|
-
},
|
|
115
|
+
}, w = {
|
|
105
116
|
args: {
|
|
106
117
|
itemCount: 40,
|
|
107
118
|
itemWidth: 90,
|
|
@@ -109,11 +120,12 @@ Use for carousels, chip lists, card rails, horizontally overflowing panels.
|
|
|
109
120
|
gap: 8,
|
|
110
121
|
showScrollbar: !1
|
|
111
122
|
},
|
|
112
|
-
render: (e) => /* @__PURE__ */
|
|
113
|
-
|
|
114
|
-
/* @__PURE__ */
|
|
123
|
+
render: (e) => /* @__PURE__ */ t("div", { style: { padding: 24 }, children: [
|
|
124
|
+
l,
|
|
125
|
+
/* @__PURE__ */ o("h3", { style: { margin: "0 0 12px" }, children: "Dense Small Items" }),
|
|
126
|
+
/* @__PURE__ */ o(r, { className: "horizontalDemoScroll", showScrollbar: e.showScrollbar, children: n(e) })
|
|
115
127
|
] })
|
|
116
|
-
},
|
|
128
|
+
}, x = {
|
|
117
129
|
args: {
|
|
118
130
|
itemCount: 12,
|
|
119
131
|
itemWidth: 260,
|
|
@@ -121,15 +133,16 @@ Use for carousels, chip lists, card rails, horizontally overflowing panels.
|
|
|
121
133
|
gap: 16,
|
|
122
134
|
gradient: !1
|
|
123
135
|
},
|
|
124
|
-
render: (e) => /* @__PURE__ */
|
|
125
|
-
|
|
126
|
-
/* @__PURE__ */
|
|
136
|
+
render: (e) => /* @__PURE__ */ t("div", { style: { padding: 24 }, children: [
|
|
137
|
+
l,
|
|
138
|
+
/* @__PURE__ */ o("h3", { style: { margin: "0 0 12px" }, children: "Large Cards" }),
|
|
139
|
+
/* @__PURE__ */ o(r, { className: "horizontalDemoScroll", showScrollbar: e.showScrollbar, children: n(e) })
|
|
127
140
|
] })
|
|
128
141
|
};
|
|
129
142
|
export {
|
|
130
|
-
|
|
131
|
-
|
|
143
|
+
w as DenseSmallItems,
|
|
144
|
+
x as LargeCards,
|
|
132
145
|
y as Playground,
|
|
133
146
|
f as WithScrollbar,
|
|
134
|
-
|
|
147
|
+
S as default
|
|
135
148
|
};
|