asterui 0.12.7 → 0.12.8
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/Container.d.ts +7 -1
- package/dist/components/Fieldset.d.ts +6 -0
- package/dist/components/Filter.d.ts +27 -0
- package/dist/components/Grid.d.ts +1 -1
- package/dist/components/Modal.d.ts +7 -2
- package/dist/components/ThemeController.d.ts +12 -4
- package/dist/index.d.ts +4 -2
- package/dist/index.js +167 -165
- package/dist/index.js.map +1 -1
- package/dist/index100.js +44 -11
- package/dist/index100.js.map +1 -1
- package/dist/index101.js +10 -12
- package/dist/index101.js.map +1 -1
- package/dist/index102.js +14 -7
- package/dist/index102.js.map +1 -1
- package/dist/index103.js +7 -12
- package/dist/index103.js.map +1 -1
- package/dist/index104.js +11 -29
- package/dist/index104.js.map +1 -1
- package/dist/index105.js +29 -16
- package/dist/index105.js.map +1 -1
- package/dist/index106.js +21 -0
- package/dist/index106.js.map +1 -0
- package/dist/index18.js +23 -15
- package/dist/index18.js.map +1 -1
- package/dist/index2.js +41 -34
- package/dist/index2.js.map +1 -1
- package/dist/index21.js +1 -1
- package/dist/index25.js +8 -8
- package/dist/index25.js.map +1 -1
- package/dist/index27.js +13 -8
- package/dist/index27.js.map +1 -1
- package/dist/index29.js +50 -61
- package/dist/index29.js.map +1 -1
- package/dist/index30.js +60 -181
- package/dist/index30.js.map +1 -1
- package/dist/index31.js +184 -18
- package/dist/index31.js.map +1 -1
- package/dist/index32.js +15 -217
- package/dist/index32.js.map +1 -1
- package/dist/index33.js +216 -1078
- package/dist/index33.js.map +1 -1
- package/dist/index34.js +1086 -17
- package/dist/index34.js.map +1 -1
- package/dist/index35.js +17 -121
- package/dist/index35.js.map +1 -1
- package/dist/index36.js +119 -37
- package/dist/index36.js.map +1 -1
- package/dist/index37.js +34 -208
- package/dist/index37.js.map +1 -1
- package/dist/index38.js +214 -97
- package/dist/index38.js.map +1 -1
- package/dist/index39.js +93 -158
- package/dist/index39.js.map +1 -1
- package/dist/index40.js +155 -139
- package/dist/index40.js.map +1 -1
- package/dist/index41.js +146 -15
- package/dist/index41.js.map +1 -1
- package/dist/index42.js +15 -17
- package/dist/index42.js.map +1 -1
- package/dist/index43.js +17 -21
- package/dist/index43.js.map +1 -1
- package/dist/index44.js +18 -116
- package/dist/index44.js.map +1 -1
- package/dist/index45.js +116 -10
- package/dist/index45.js.map +1 -1
- package/dist/index46.js +13 -35
- package/dist/index46.js.map +1 -1
- package/dist/index47.js +35 -34
- package/dist/index47.js.map +1 -1
- package/dist/index48.js +34 -116
- package/dist/index48.js.map +1 -1
- package/dist/index49.js +114 -174
- package/dist/index49.js.map +1 -1
- package/dist/index50.js +165 -136
- package/dist/index50.js.map +1 -1
- package/dist/index51.js +146 -11
- package/dist/index51.js.map +1 -1
- package/dist/index52.js +10 -20
- package/dist/index52.js.map +1 -1
- package/dist/index53.js +22 -14
- package/dist/index53.js.map +1 -1
- package/dist/index54.js +14 -7
- package/dist/index54.js.map +1 -1
- package/dist/index55.js +6 -268
- package/dist/index55.js.map +1 -1
- package/dist/index56.js +311 -17
- package/dist/index56.js.map +1 -1
- package/dist/index57.js +17 -122
- package/dist/index57.js.map +1 -1
- package/dist/index58.js +120 -108
- package/dist/index58.js.map +1 -1
- package/dist/index59.js +107 -167
- package/dist/index59.js.map +1 -1
- package/dist/index60.js +167 -29
- package/dist/index60.js.map +1 -1
- package/dist/index61.js +30 -120
- package/dist/index61.js.map +1 -1
- package/dist/index62.js +116 -80
- package/dist/index62.js.map +1 -1
- package/dist/index63.js +85 -19
- package/dist/index63.js.map +1 -1
- package/dist/index64.js +19 -73
- package/dist/index64.js.map +1 -1
- package/dist/index65.js +71 -54
- package/dist/index65.js.map +1 -1
- package/dist/index66.js +56 -44
- package/dist/index66.js.map +1 -1
- package/dist/index67.js +42 -49
- package/dist/index67.js.map +1 -1
- package/dist/index68.js +52 -62
- package/dist/index68.js.map +1 -1
- package/dist/index69.js +56 -101
- package/dist/index69.js.map +1 -1
- package/dist/index70.js +107 -41
- package/dist/index70.js.map +1 -1
- package/dist/index71.js +41 -68
- package/dist/index71.js.map +1 -1
- package/dist/index72.js +66 -19
- package/dist/index72.js.map +1 -1
- package/dist/index73.js +18 -43
- package/dist/index73.js.map +1 -1
- package/dist/index74.js +44 -132
- package/dist/index74.js.map +1 -1
- package/dist/index75.js +132 -50
- package/dist/index75.js.map +1 -1
- package/dist/index76.js +51 -21
- package/dist/index76.js.map +1 -1
- package/dist/index77.js +22 -31
- package/dist/index77.js.map +1 -1
- package/dist/index78.js +31 -22
- package/dist/index78.js.map +1 -1
- package/dist/index79.js +20 -327
- package/dist/index79.js.map +1 -1
- package/dist/index80.js +323 -50
- package/dist/index80.js.map +1 -1
- package/dist/index81.js +56 -40
- package/dist/index81.js.map +1 -1
- package/dist/index82.js +40 -23
- package/dist/index82.js.map +1 -1
- package/dist/index83.js +21 -93
- package/dist/index83.js.map +1 -1
- package/dist/index84.js +88 -123
- package/dist/index84.js.map +1 -1
- package/dist/index85.js +147 -152
- package/dist/index85.js.map +1 -1
- package/dist/index86.js +159 -63
- package/dist/index86.js.map +1 -1
- package/dist/index87.js +65 -35
- package/dist/index87.js.map +1 -1
- package/dist/index88.js +35 -234
- package/dist/index88.js.map +1 -1
- package/dist/index89.js +231 -31
- package/dist/index89.js.map +1 -1
- package/dist/index90.js +34 -210
- package/dist/index90.js.map +1 -1
- package/dist/index91.js +195 -198
- package/dist/index91.js.map +1 -1
- package/dist/index92.js +159 -241
- package/dist/index92.js.map +1 -1
- package/dist/index93.js +283 -166
- package/dist/index93.js.map +1 -1
- package/dist/index94.js +173 -253
- package/dist/index94.js.map +1 -1
- package/dist/index95.js +258 -14
- package/dist/index95.js.map +1 -1
- package/dist/index96.js +12 -31
- package/dist/index96.js.map +1 -1
- package/dist/index97.js +32 -5
- package/dist/index97.js.map +1 -1
- package/dist/index98.js +5 -13
- package/dist/index98.js.map +1 -1
- package/dist/index99.js +11 -43
- package/dist/index99.js.map +1 -1
- package/package.json +1 -1
package/dist/index74.js
CHANGED
|
@@ -1,137 +1,49 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { jsx as y } from "react/jsx-runtime";
|
|
2
|
+
const g = {
|
|
3
|
+
xs: "gap-1",
|
|
4
|
+
sm: "gap-2",
|
|
5
|
+
md: "gap-4",
|
|
6
|
+
lg: "gap-6",
|
|
7
|
+
xl: "gap-8"
|
|
8
|
+
}, C = {
|
|
9
|
+
start: "items-start",
|
|
10
|
+
end: "items-end",
|
|
11
|
+
center: "items-center",
|
|
12
|
+
baseline: "items-baseline",
|
|
13
|
+
stretch: "items-stretch"
|
|
14
|
+
}, j = {
|
|
15
|
+
start: "justify-start",
|
|
16
|
+
end: "justify-end",
|
|
17
|
+
center: "justify-center",
|
|
18
|
+
between: "justify-between",
|
|
19
|
+
around: "justify-around",
|
|
20
|
+
evenly: "justify-evenly"
|
|
21
|
+
}, h = ({
|
|
22
|
+
direction: n = "horizontal",
|
|
23
|
+
size: s = "md",
|
|
24
|
+
align: e,
|
|
25
|
+
justify: t,
|
|
26
|
+
wrap: l = !1,
|
|
27
|
+
className: o = "",
|
|
28
|
+
style: r,
|
|
29
|
+
children: i,
|
|
30
|
+
...c
|
|
12
31
|
}) => {
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
g || j(n), I?.(n);
|
|
27
|
-
},
|
|
28
|
-
[g, I]
|
|
29
|
-
), V = x(
|
|
30
|
-
(n, e) => {
|
|
31
|
-
e.preventDefault();
|
|
32
|
-
const a = c === "horizontal" ? e.clientX : e.clientY;
|
|
33
|
-
b.current = {
|
|
34
|
-
index: n,
|
|
35
|
-
startPos: a,
|
|
36
|
-
startSizes: [...p]
|
|
37
|
-
};
|
|
38
|
-
const r = (w) => {
|
|
39
|
-
if (!b.current || !$.current) return;
|
|
40
|
-
const { index: t, startPos: P, startSizes: s } = b.current, K = $.current.getBoundingClientRect(), O = c === "horizontal" ? K.width : K.height, Q = c === "horizontal" ? w.clientX : w.clientY, T = (l - 1) * z, v = O - T, F = (Q - P) / v * 100, U = h[t]?.props || {}, X = h[t + 1]?.props || {}, W = U.minSize ?? R, Z = X.minSize ?? R, A = W / v * 100, L = Z / v * 100;
|
|
41
|
-
let i = s[t] + F, u = s[t + 1] - F;
|
|
42
|
-
i < A && (i = A, u = s[t] + s[t + 1] - A), u < L && (u = L, i = s[t] + s[t + 1] - L);
|
|
43
|
-
const Y = U.maxSize, q = X.maxSize;
|
|
44
|
-
if (Y) {
|
|
45
|
-
const m = Y / v * 100;
|
|
46
|
-
i > m && (i = m, u = s[t] + s[t + 1] - m);
|
|
47
|
-
}
|
|
48
|
-
if (q) {
|
|
49
|
-
const m = q / v * 100;
|
|
50
|
-
u > m && (u = m, i = s[t] + s[t + 1] - m);
|
|
51
|
-
}
|
|
52
|
-
const M = [...s];
|
|
53
|
-
M[t] = i, M[t + 1] = u, S(M);
|
|
54
|
-
}, o = () => {
|
|
55
|
-
b.current = null, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", o), document.body.style.cursor = "", document.body.style.userSelect = "";
|
|
56
|
-
};
|
|
57
|
-
document.addEventListener("mousemove", r), document.addEventListener("mouseup", o), document.body.style.cursor = c === "horizontal" ? "col-resize" : "row-resize", document.body.style.userSelect = "none";
|
|
58
|
-
},
|
|
59
|
-
[c, p, l, z, h, R, S]
|
|
60
|
-
), J = x(
|
|
61
|
-
(n, e) => {
|
|
62
|
-
const a = e.shiftKey ? 10 : 1;
|
|
63
|
-
let r = 0;
|
|
64
|
-
if (c === "horizontal" ? e.key === "ArrowLeft" ? r = -a : e.key === "ArrowRight" && (r = a) : e.key === "ArrowUp" ? r = -a : e.key === "ArrowDown" && (r = a), r !== 0) {
|
|
65
|
-
e.preventDefault();
|
|
66
|
-
const o = [...p], w = 5;
|
|
67
|
-
let t = o[n] + r, P = o[n + 1] - r;
|
|
68
|
-
t >= w && P >= w && (o[n] = t, o[n + 1] = P, S(o));
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
[c, p, S]
|
|
72
|
-
), d = c === "horizontal";
|
|
73
|
-
return /* @__PURE__ */ f(
|
|
74
|
-
"div",
|
|
75
|
-
{
|
|
76
|
-
ref: $,
|
|
77
|
-
className: `flex ${d ? "flex-row" : "flex-col"} h-full w-full ${G}`,
|
|
78
|
-
children: h.map((n, e) => {
|
|
79
|
-
const a = n.props, r = e === h.length - 1;
|
|
80
|
-
return /* @__PURE__ */ B(C.Fragment, { children: [
|
|
81
|
-
/* @__PURE__ */ f(
|
|
82
|
-
"div",
|
|
83
|
-
{
|
|
84
|
-
ref: (o) => {
|
|
85
|
-
H.current[e] = o;
|
|
86
|
-
},
|
|
87
|
-
className: `overflow-auto ${a.className || ""}`,
|
|
88
|
-
style: {
|
|
89
|
-
[d ? "width" : "height"]: `calc(${p[e]}% - ${(l - 1) * z / l}px)`,
|
|
90
|
-
flexShrink: 0
|
|
91
|
-
},
|
|
92
|
-
children: a.children
|
|
93
|
-
}
|
|
94
|
-
),
|
|
95
|
-
!r && /* @__PURE__ */ f(
|
|
96
|
-
"div",
|
|
97
|
-
{
|
|
98
|
-
role: "separator",
|
|
99
|
-
"aria-orientation": d ? "vertical" : "horizontal",
|
|
100
|
-
"aria-valuenow": Math.round(p[e]),
|
|
101
|
-
tabIndex: 0,
|
|
102
|
-
className: `
|
|
103
|
-
flex-shrink-0 bg-base-300 hover:bg-primary/30 active:bg-primary/50
|
|
104
|
-
transition-colors duration-150 relative group
|
|
105
|
-
${d ? "cursor-col-resize" : "cursor-row-resize"}
|
|
106
|
-
`,
|
|
107
|
-
style: {
|
|
108
|
-
[d ? "width" : "height"]: `${z}px`
|
|
109
|
-
},
|
|
110
|
-
onMouseDown: (o) => V(e, o),
|
|
111
|
-
onKeyDown: (o) => J(e, o),
|
|
112
|
-
children: /* @__PURE__ */ B(
|
|
113
|
-
"div",
|
|
114
|
-
{
|
|
115
|
-
className: `
|
|
116
|
-
absolute inset-0 flex items-center justify-center
|
|
117
|
-
${d ? "flex-col gap-0.5" : "flex-row gap-0.5"}
|
|
118
|
-
`,
|
|
119
|
-
children: [
|
|
120
|
-
/* @__PURE__ */ f("div", { className: "w-1 h-1 rounded-full bg-base-content/30 group-hover:bg-primary/60" }),
|
|
121
|
-
/* @__PURE__ */ f("div", { className: "w-1 h-1 rounded-full bg-base-content/30 group-hover:bg-primary/60" }),
|
|
122
|
-
/* @__PURE__ */ f("div", { className: "w-1 h-1 rounded-full bg-base-content/30 group-hover:bg-primary/60" })
|
|
123
|
-
]
|
|
124
|
-
}
|
|
125
|
-
)
|
|
126
|
-
}
|
|
127
|
-
)
|
|
128
|
-
] }, e);
|
|
129
|
-
})
|
|
130
|
-
}
|
|
131
|
-
);
|
|
32
|
+
const a = typeof s == "number", p = a ? "" : g[s], f = e ? C[e] : "", m = t ? j[t] : "", d = [
|
|
33
|
+
"flex",
|
|
34
|
+
n === "horizontal" ? "flex-row" : "flex-col",
|
|
35
|
+
p,
|
|
36
|
+
f,
|
|
37
|
+
m,
|
|
38
|
+
l ? "flex-wrap" : "",
|
|
39
|
+
o
|
|
40
|
+
].filter(Boolean).join(" "), u = {
|
|
41
|
+
...r,
|
|
42
|
+
...a ? { gap: `${s}px` } : {}
|
|
43
|
+
};
|
|
44
|
+
return /* @__PURE__ */ y("div", { className: d, style: u, ...c, children: i });
|
|
132
45
|
};
|
|
133
|
-
oe.Panel = ne;
|
|
134
46
|
export {
|
|
135
|
-
|
|
47
|
+
h as Space
|
|
136
48
|
};
|
|
137
49
|
//# sourceMappingURL=index74.js.map
|
package/dist/index74.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index74.js","sources":["../src/components/Splitter.tsx"],"sourcesContent":["import React, { useState, useRef, useCallback, useEffect } from 'react'\n\nexport interface SplitterPanelProps {\n children: React.ReactNode\n defaultSize?: number\n size?: number\n minSize?: number\n maxSize?: number\n collapsible?: boolean\n collapsed?: boolean\n onCollapse?: (collapsed: boolean) => void\n className?: string\n}\n\nexport interface SplitterProps {\n children: React.ReactNode\n direction?: 'horizontal' | 'vertical'\n sizes?: number[]\n defaultSizes?: number[]\n onSizesChange?: (sizes: number[]) => void\n gutterSize?: number\n minSize?: number\n className?: string\n}\n\nconst Panel: React.FC<SplitterPanelProps> = ({ children }) => {\n return <>{children}</>\n}\n\nexport const Splitter: React.FC<SplitterProps> & { Panel: typeof Panel } = ({\n children,\n direction = 'horizontal',\n sizes,\n defaultSizes,\n onSizesChange,\n gutterSize = 8,\n minSize = 50,\n className = '',\n}) => {\n const containerRef = useRef<HTMLDivElement>(null)\n const panelsRef = useRef<(HTMLDivElement | null)[]>([])\n const draggingRef = useRef<{ index: number; startPos: number; startSizes: number[] } | null>(null)\n\n // Extract panel props from children\n const panels = React.Children.toArray(children).filter(\n (child): child is React.ReactElement<SplitterPanelProps> =>\n React.isValidElement(child)\n )\n\n const panelCount = panels.length\n\n // Initialize sizes\n const getInitialSizes = useCallback(() => {\n if (defaultSizes && defaultSizes.length === panelCount) {\n return defaultSizes\n }\n // Equal distribution\n const equalSize = 100 / panelCount\n return Array(panelCount).fill(equalSize)\n }, [defaultSizes, panelCount])\n\n const [internalSizes, setInternalSizes] = useState<number[]>(getInitialSizes)\n const currentSizes = sizes || internalSizes\n\n // Update internal sizes when panel count changes\n useEffect(() => {\n if (!sizes && internalSizes.length !== panelCount) {\n setInternalSizes(getInitialSizes())\n }\n }, [panelCount, sizes, internalSizes.length, getInitialSizes])\n\n const updateSizes = useCallback(\n (newSizes: number[]) => {\n if (!sizes) {\n setInternalSizes(newSizes)\n }\n onSizesChange?.(newSizes)\n },\n [sizes, onSizesChange]\n )\n\n const handleMouseDown = useCallback(\n (index: number, e: React.MouseEvent) => {\n e.preventDefault()\n const startPos = direction === 'horizontal' ? e.clientX : e.clientY\n draggingRef.current = {\n index,\n startPos,\n startSizes: [...currentSizes],\n }\n\n const handleMouseMove = (moveEvent: MouseEvent) => {\n if (!draggingRef.current || !containerRef.current) return\n\n const { index: dragIndex, startPos: dragStartPos, startSizes } = draggingRef.current\n const containerRect = containerRef.current.getBoundingClientRect()\n const containerSize = direction === 'horizontal' ? containerRect.width : containerRect.height\n const currentPos = direction === 'horizontal' ? moveEvent.clientX : moveEvent.clientY\n\n // Calculate delta as percentage\n const gutterCount = panelCount - 1\n const totalGutterSize = gutterCount * gutterSize\n const availableSize = containerSize - totalGutterSize\n const deltaPixels = currentPos - dragStartPos\n const deltaPercent = (deltaPixels / availableSize) * 100\n\n // Get min sizes for panels\n const panel1Props = panels[dragIndex]?.props || {}\n const panel2Props = panels[dragIndex + 1]?.props || {}\n const minSize1 = panel1Props.minSize ?? minSize\n const minSize2 = panel2Props.minSize ?? minSize\n const minPercent1 = (minSize1 / availableSize) * 100\n const minPercent2 = (minSize2 / availableSize) * 100\n\n // Calculate new sizes\n let newSize1 = startSizes[dragIndex] + deltaPercent\n let newSize2 = startSizes[dragIndex + 1] - deltaPercent\n\n // Apply min constraints\n if (newSize1 < minPercent1) {\n newSize1 = minPercent1\n newSize2 = startSizes[dragIndex] + startSizes[dragIndex + 1] - minPercent1\n }\n if (newSize2 < minPercent2) {\n newSize2 = minPercent2\n newSize1 = startSizes[dragIndex] + startSizes[dragIndex + 1] - minPercent2\n }\n\n // Apply max constraints\n const maxSize1 = panel1Props.maxSize\n const maxSize2 = panel2Props.maxSize\n if (maxSize1) {\n const maxPercent1 = (maxSize1 / availableSize) * 100\n if (newSize1 > maxPercent1) {\n newSize1 = maxPercent1\n newSize2 = startSizes[dragIndex] + startSizes[dragIndex + 1] - maxPercent1\n }\n }\n if (maxSize2) {\n const maxPercent2 = (maxSize2 / availableSize) * 100\n if (newSize2 > maxPercent2) {\n newSize2 = maxPercent2\n newSize1 = startSizes[dragIndex] + startSizes[dragIndex + 1] - maxPercent2\n }\n }\n\n const newSizes = [...startSizes]\n newSizes[dragIndex] = newSize1\n newSizes[dragIndex + 1] = newSize2\n updateSizes(newSizes)\n }\n\n const handleMouseUp = () => {\n draggingRef.current = null\n document.removeEventListener('mousemove', handleMouseMove)\n document.removeEventListener('mouseup', handleMouseUp)\n document.body.style.cursor = ''\n document.body.style.userSelect = ''\n }\n\n document.addEventListener('mousemove', handleMouseMove)\n document.addEventListener('mouseup', handleMouseUp)\n document.body.style.cursor = direction === 'horizontal' ? 'col-resize' : 'row-resize'\n document.body.style.userSelect = 'none'\n },\n [direction, currentSizes, panelCount, gutterSize, panels, minSize, updateSizes]\n )\n\n const handleKeyDown = useCallback(\n (index: number, e: React.KeyboardEvent) => {\n const step = e.shiftKey ? 10 : 1\n let delta = 0\n\n if (direction === 'horizontal') {\n if (e.key === 'ArrowLeft') delta = -step\n else if (e.key === 'ArrowRight') delta = step\n } else {\n if (e.key === 'ArrowUp') delta = -step\n else if (e.key === 'ArrowDown') delta = step\n }\n\n if (delta !== 0) {\n e.preventDefault()\n const newSizes = [...currentSizes]\n const minPercent = 5 // Minimum 5% when using keyboard\n\n let newSize1 = newSizes[index] + delta\n let newSize2 = newSizes[index + 1] - delta\n\n if (newSize1 >= minPercent && newSize2 >= minPercent) {\n newSizes[index] = newSize1\n newSizes[index + 1] = newSize2\n updateSizes(newSizes)\n }\n }\n },\n [direction, currentSizes, updateSizes]\n )\n\n const isHorizontal = direction === 'horizontal'\n\n return (\n <div\n ref={containerRef}\n className={`flex ${isHorizontal ? 'flex-row' : 'flex-col'} h-full w-full ${className}`}\n >\n {panels.map((panel, index) => {\n const panelProps = panel.props\n const isLast = index === panels.length - 1\n\n return (\n <React.Fragment key={index}>\n <div\n ref={(el) => {\n panelsRef.current[index] = el\n }}\n className={`overflow-auto ${panelProps.className || ''}`}\n style={{\n [isHorizontal ? 'width' : 'height']: `calc(${currentSizes[index]}% - ${\n ((panelCount - 1) * gutterSize) / panelCount\n }px)`,\n flexShrink: 0,\n }}\n >\n {panelProps.children}\n </div>\n {!isLast && (\n <div\n role=\"separator\"\n aria-orientation={isHorizontal ? 'vertical' : 'horizontal'}\n aria-valuenow={Math.round(currentSizes[index])}\n tabIndex={0}\n className={`\n flex-shrink-0 bg-base-300 hover:bg-primary/30 active:bg-primary/50\n transition-colors duration-150 relative group\n ${isHorizontal ? 'cursor-col-resize' : 'cursor-row-resize'}\n `}\n style={{\n [isHorizontal ? 'width' : 'height']: `${gutterSize}px`,\n }}\n onMouseDown={(e) => handleMouseDown(index, e)}\n onKeyDown={(e) => handleKeyDown(index, e)}\n >\n {/* Grip indicator */}\n <div\n className={`\n absolute inset-0 flex items-center justify-center\n ${isHorizontal ? 'flex-col gap-0.5' : 'flex-row gap-0.5'}\n `}\n >\n <div className=\"w-1 h-1 rounded-full bg-base-content/30 group-hover:bg-primary/60\" />\n <div className=\"w-1 h-1 rounded-full bg-base-content/30 group-hover:bg-primary/60\" />\n <div className=\"w-1 h-1 rounded-full bg-base-content/30 group-hover:bg-primary/60\" />\n </div>\n </div>\n )}\n </React.Fragment>\n )\n })}\n </div>\n )\n}\n\nSplitter.Panel = Panel\n"],"names":["Panel","children","Splitter","direction","sizes","defaultSizes","onSizesChange","gutterSize","minSize","className","containerRef","useRef","panelsRef","draggingRef","panels","React","child","panelCount","getInitialSizes","useCallback","equalSize","internalSizes","setInternalSizes","useState","currentSizes","useEffect","updateSizes","newSizes","handleMouseDown","index","startPos","handleMouseMove","moveEvent","dragIndex","dragStartPos","startSizes","containerRect","containerSize","currentPos","totalGutterSize","availableSize","deltaPercent","panel1Props","panel2Props","minSize1","minSize2","minPercent1","minPercent2","newSize1","newSize2","maxSize1","maxSize2","maxPercent1","maxPercent2","handleMouseUp","handleKeyDown","step","delta","minPercent","isHorizontal","jsx","panel","panelProps","isLast","jsxs","el","e"],"mapp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1B,GAAOqC,CAAC;AAAA,cAGxC,UAAA,gBAAAF;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBACC,WAAW;AAAA;AAAA,sBAEPL,IAAe,qBAAqB,kBAAkB;AAAA;AAAA,kBAG1D,UAAA;AAAA,oBAAA,gBAAAC,EAAC,OAAA,EAAI,WAAU,oEAAA,CAAoE;AAAA,oBACnF,gBAAAA,EAAC,OAAA,EAAI,WAAU,oEAAA,CAAoE;AAAA,oBACnF,gBAAAA,EAAC,OAAA,EAAI,WAAU,oEAAA,CAAoE;AAAA,kBAAA;AAAA,gBAAA;AAAA,cAAA;AAAA,YACrF;AAAA,UAAA;AAAA,QACF,EAAA,GA3CiB/B,CA6CrB;AAAA,MAEJ,CAAC;AAAA,IAAA;AAAA,EAAA;AAGP;AAEA3B,GAAS,QAAQF;"}
|
|
1
|
+
{"version":3,"file":"index74.js","sources":["../src/components/Space.tsx"],"sourcesContent":["import React from 'react'\n\nexport interface SpaceProps extends React.HTMLAttributes<HTMLDivElement> {\n direction?: 'horizontal' | 'vertical'\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | number\n align?: 'start' | 'end' | 'center' | 'baseline' | 'stretch'\n justify?: 'start' | 'end' | 'center' | 'between' | 'around' | 'evenly'\n wrap?: boolean\n children: React.ReactNode\n}\n\nconst gapClasses = {\n xs: 'gap-1',\n sm: 'gap-2',\n md: 'gap-4',\n lg: 'gap-6',\n xl: 'gap-8',\n} as const\n\nconst alignClasses = {\n start: 'items-start',\n end: 'items-end',\n center: 'items-center',\n baseline: 'items-baseline',\n stretch: 'items-stretch',\n} as const\n\nconst justifyClasses = {\n start: 'justify-start',\n end: 'justify-end',\n center: 'justify-center',\n between: 'justify-between',\n around: 'justify-around',\n evenly: 'justify-evenly',\n} as const\n\nexport const Space: React.FC<SpaceProps> = ({\n direction = 'horizontal',\n size = 'md',\n align,\n justify,\n wrap = false,\n className = '',\n style,\n children,\n ...rest\n}) => {\n const isNumericSize = typeof size === 'number'\n const gapClass = isNumericSize ? '' : gapClasses[size]\n const alignClass = align ? alignClasses[align] : ''\n const justifyClass = justify ? justifyClasses[justify] : ''\n const wrapClass = wrap ? 'flex-wrap' : ''\n const directionClass = direction === 'horizontal' ? 'flex-row' : 'flex-col'\n\n const classes = [\n 'flex',\n directionClass,\n gapClass,\n alignClass,\n justifyClass,\n wrapClass,\n className\n ].filter(Boolean).join(' ')\n\n const combinedStyle: React.CSSProperties = {\n ...style,\n ...(isNumericSize ? { gap: `${size}px` } : {}),\n }\n\n return <div className={classes} style={combinedStyle} {...rest}>{children}</div>\n}\n"],"names":["gapClasses","alignClasses","justifyClasses","Space","direction","size","align","justify","wrap","className","style","children","rest","isNumericSize","gapClass","alignClass","justifyClass","classes","combinedStyle","jsx"],"mappings":";AAWA,MAAMA,IAAa;AAAA,EACjB,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN,GAEMC,IAAe;AAAA,EACnB,OAAO;AAAA,EACP,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,SAAS;AACX,GAEMC,IAAiB;AAAA,EACrB,OAAO;AAAA,EACP,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,QAAQ;AACV,GAEaC,IAA8B,CAAC;AAAA,EAC1C,WAAAC,IAAY;AAAA,EACZ,MAAAC,IAAO;AAAA,EACP,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,WAAAC,IAAY;AAAA,EACZ,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,GAAGC;AACL,MAAM;AACJ,QAAMC,IAAgB,OAAOR,KAAS,UAChCS,IAAWD,IAAgB,KAAKb,EAAWK,CAAI,GAC/CU,IAAaT,IAAQL,EAAaK,CAAK,IAAI,IAC3CU,IAAeT,IAAUL,EAAeK,CAAO,IAAI,IAInDU,IAAU;AAAA,IACd;AAAA,IAHqBb,MAAc,eAAe,aAAa;AAAA,IAK/DU;AAAA,IACAC;AAAA,IACAC;AAAA,IARgBR,IAAO,cAAc;AAAA,IAUrCC;AAAA,EAAA,EACA,OAAO,OAAO,EAAE,KAAK,GAAG,GAEpBS,IAAqC;AAAA,IACzC,GAAGR;AAAA,IACH,GAAIG,IAAgB,EAAE,KAAK,GAAGR,CAAI,SAAS,CAAA;AAAA,EAAC;AAG9C,SAAO,gBAAAc,EAAC,SAAI,WAAWF,GAAS,OAAOC,GAAgB,GAAGN,GAAO,UAAAD,GAAS;AAC5E;"}
|
package/dist/index75.js
CHANGED
|
@@ -1,55 +1,137 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { jsx as f, jsxs as B, Fragment as _ } from "react/jsx-runtime";
|
|
2
|
+
import C, { useRef as E, useCallback as x, useState as ee, useEffect as te } from "react";
|
|
3
|
+
const ne = ({ children: N }) => /* @__PURE__ */ f(_, { children: N }), oe = ({
|
|
4
|
+
children: N,
|
|
5
|
+
direction: c = "horizontal",
|
|
6
|
+
sizes: g,
|
|
7
|
+
defaultSizes: y,
|
|
8
|
+
onSizesChange: I,
|
|
9
|
+
gutterSize: z = 8,
|
|
10
|
+
minSize: R = 50,
|
|
11
|
+
className: G = ""
|
|
11
12
|
}) => {
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
13
|
+
const $ = E(null), H = E([]), b = E(null), h = C.Children.toArray(N).filter(
|
|
14
|
+
(n) => C.isValidElement(n)
|
|
15
|
+
), l = h.length, k = x(() => {
|
|
16
|
+
if (y && y.length === l)
|
|
17
|
+
return y;
|
|
18
|
+
const n = 100 / l;
|
|
19
|
+
return Array(l).fill(n);
|
|
20
|
+
}, [y, l]), [D, j] = ee(k), p = g || D;
|
|
21
|
+
te(() => {
|
|
22
|
+
!g && D.length !== l && j(k());
|
|
23
|
+
}, [l, g, D.length, k]);
|
|
24
|
+
const S = x(
|
|
25
|
+
(n) => {
|
|
26
|
+
g || j(n), I?.(n);
|
|
27
|
+
},
|
|
28
|
+
[g, I]
|
|
29
|
+
), V = x(
|
|
30
|
+
(n, e) => {
|
|
31
|
+
e.preventDefault();
|
|
32
|
+
const a = c === "horizontal" ? e.clientX : e.clientY;
|
|
33
|
+
b.current = {
|
|
34
|
+
index: n,
|
|
35
|
+
startPos: a,
|
|
36
|
+
startSizes: [...p]
|
|
37
|
+
};
|
|
38
|
+
const r = (w) => {
|
|
39
|
+
if (!b.current || !$.current) return;
|
|
40
|
+
const { index: t, startPos: P, startSizes: s } = b.current, K = $.current.getBoundingClientRect(), O = c === "horizontal" ? K.width : K.height, Q = c === "horizontal" ? w.clientX : w.clientY, T = (l - 1) * z, v = O - T, F = (Q - P) / v * 100, U = h[t]?.props || {}, X = h[t + 1]?.props || {}, W = U.minSize ?? R, Z = X.minSize ?? R, A = W / v * 100, L = Z / v * 100;
|
|
41
|
+
let i = s[t] + F, u = s[t + 1] - F;
|
|
42
|
+
i < A && (i = A, u = s[t] + s[t + 1] - A), u < L && (u = L, i = s[t] + s[t + 1] - L);
|
|
43
|
+
const Y = U.maxSize, q = X.maxSize;
|
|
44
|
+
if (Y) {
|
|
45
|
+
const m = Y / v * 100;
|
|
46
|
+
i > m && (i = m, u = s[t] + s[t + 1] - m);
|
|
47
|
+
}
|
|
48
|
+
if (q) {
|
|
49
|
+
const m = q / v * 100;
|
|
50
|
+
u > m && (u = m, i = s[t] + s[t + 1] - m);
|
|
51
|
+
}
|
|
52
|
+
const M = [...s];
|
|
53
|
+
M[t] = i, M[t + 1] = u, S(M);
|
|
54
|
+
}, o = () => {
|
|
55
|
+
b.current = null, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", o), document.body.style.cursor = "", document.body.style.userSelect = "";
|
|
56
|
+
};
|
|
57
|
+
document.addEventListener("mousemove", r), document.addEventListener("mouseup", o), document.body.style.cursor = c === "horizontal" ? "col-resize" : "row-resize", document.body.style.userSelect = "none";
|
|
58
|
+
},
|
|
59
|
+
[c, p, l, z, h, R, S]
|
|
60
|
+
), J = x(
|
|
61
|
+
(n, e) => {
|
|
62
|
+
const a = e.shiftKey ? 10 : 1;
|
|
63
|
+
let r = 0;
|
|
64
|
+
if (c === "horizontal" ? e.key === "ArrowLeft" ? r = -a : e.key === "ArrowRight" && (r = a) : e.key === "ArrowUp" ? r = -a : e.key === "ArrowDown" && (r = a), r !== 0) {
|
|
65
|
+
e.preventDefault();
|
|
66
|
+
const o = [...p], w = 5;
|
|
67
|
+
let t = o[n] + r, P = o[n + 1] - r;
|
|
68
|
+
t >= w && P >= w && (o[n] = t, o[n + 1] = P, S(o));
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
[c, p, S]
|
|
72
|
+
), d = c === "horizontal";
|
|
73
|
+
return /* @__PURE__ */ f(
|
|
74
|
+
"div",
|
|
75
|
+
{
|
|
76
|
+
ref: $,
|
|
77
|
+
className: `flex ${d ? "flex-row" : "flex-col"} h-full w-full ${G}`,
|
|
78
|
+
children: h.map((n, e) => {
|
|
79
|
+
const a = n.props, r = e === h.length - 1;
|
|
80
|
+
return /* @__PURE__ */ B(C.Fragment, { children: [
|
|
81
|
+
/* @__PURE__ */ f(
|
|
82
|
+
"div",
|
|
83
|
+
{
|
|
84
|
+
ref: (o) => {
|
|
85
|
+
H.current[e] = o;
|
|
86
|
+
},
|
|
87
|
+
className: `overflow-auto ${a.className || ""}`,
|
|
88
|
+
style: {
|
|
89
|
+
[d ? "width" : "height"]: `calc(${p[e]}% - ${(l - 1) * z / l}px)`,
|
|
90
|
+
flexShrink: 0
|
|
91
|
+
},
|
|
92
|
+
children: a.children
|
|
93
|
+
}
|
|
94
|
+
),
|
|
95
|
+
!r && /* @__PURE__ */ f(
|
|
96
|
+
"div",
|
|
97
|
+
{
|
|
98
|
+
role: "separator",
|
|
99
|
+
"aria-orientation": d ? "vertical" : "horizontal",
|
|
100
|
+
"aria-valuenow": Math.round(p[e]),
|
|
101
|
+
tabIndex: 0,
|
|
102
|
+
className: `
|
|
103
|
+
flex-shrink-0 bg-base-300 hover:bg-primary/30 active:bg-primary/50
|
|
104
|
+
transition-colors duration-150 relative group
|
|
105
|
+
${d ? "cursor-col-resize" : "cursor-row-resize"}
|
|
106
|
+
`,
|
|
107
|
+
style: {
|
|
108
|
+
[d ? "width" : "height"]: `${z}px`
|
|
109
|
+
},
|
|
110
|
+
onMouseDown: (o) => V(e, o),
|
|
111
|
+
onKeyDown: (o) => J(e, o),
|
|
112
|
+
children: /* @__PURE__ */ B(
|
|
113
|
+
"div",
|
|
114
|
+
{
|
|
115
|
+
className: `
|
|
116
|
+
absolute inset-0 flex items-center justify-center
|
|
117
|
+
${d ? "flex-col gap-0.5" : "flex-row gap-0.5"}
|
|
118
|
+
`,
|
|
119
|
+
children: [
|
|
120
|
+
/* @__PURE__ */ f("div", { className: "w-1 h-1 rounded-full bg-base-content/30 group-hover:bg-primary/60" }),
|
|
121
|
+
/* @__PURE__ */ f("div", { className: "w-1 h-1 rounded-full bg-base-content/30 group-hover:bg-primary/60" }),
|
|
122
|
+
/* @__PURE__ */ f("div", { className: "w-1 h-1 rounded-full bg-base-content/30 group-hover:bg-primary/60" })
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
)
|
|
126
|
+
}
|
|
127
|
+
)
|
|
128
|
+
] }, e);
|
|
129
|
+
})
|
|
130
|
+
}
|
|
131
|
+
);
|
|
51
132
|
};
|
|
133
|
+
oe.Panel = ne;
|
|
52
134
|
export {
|
|
53
|
-
|
|
135
|
+
oe as Splitter
|
|
54
136
|
};
|
|
55
137
|
//# sourceMappingURL=index75.js.map
|
package/dist/index75.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index75.js","sources":["../src/components/Stack.tsx"],"sourcesContent":["import React from 'react'\n\nexport interface StackProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode\n direction?: 'vertical' | 'horizontal'\n spacing?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 8 | 10 | 12 | 16 | 20 | 24\n align?: 'start' | 'center' | 'end' | 'stretch'\n justify?: 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly'\n wrap?: boolean\n}\n\nexport const Stack: React.FC<StackProps> = ({\n children,\n direction = 'vertical',\n spacing = 4,\n align,\n justify,\n wrap = false,\n className = '',\n ...rest\n}) => {\n const directionClasses = {\n vertical: 'flex-col',\n horizontal: 'flex-row',\n }\n\n const spacingClasses = {\n 0: 'gap-0',\n 1: 'gap-1',\n 2: 'gap-2',\n 3: 'gap-3',\n 4: 'gap-4',\n 5: 'gap-5',\n 6: 'gap-6',\n 8: 'gap-8',\n 10: 'gap-10',\n 12: 'gap-12',\n 16: 'gap-16',\n 20: 'gap-20',\n 24: 'gap-24',\n }\n\n const alignClasses = align && {\n start: 'items-start',\n center: 'items-center',\n end: 'items-end',\n stretch: 'items-stretch',\n }[align]\n\n const justifyClasses = justify && {\n start: 'justify-start',\n center: 'justify-center',\n end: 'justify-end',\n between: 'justify-between',\n around: 'justify-around',\n evenly: 'justify-evenly',\n }[justify]\n\n const classes = [\n 'flex',\n directionClasses[direction],\n spacingClasses[spacing],\n alignClasses,\n justifyClasses,\n wrap && 'flex-wrap',\n className,\n ]\n .filter(Boolean)\n .join(' ')\n\n return <div className={classes} {...rest}>{children}</div>\n}\n"],"names":["Stack","children","direction","spacing","align","justify","wrap","className","rest","directionClasses","spacingClasses","alignClasses","justifyClasses","classes"],"mappings":";AAWO,MAAMA,IAA8B,CAAC;AAAA,EAC1C,UAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,SAAAC,IAAU;AAAA,EACV,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,WAAAC,IAAY;AAAA,EACZ,GAAGC;AACL,MAAM;AACJ,QAAMC,IAAmB;AAAA,IACvB,UAAU;AAAA,IACV,YAAY;AAAA,EAAA,GAGRC,IAAiB;AAAA,IACrB,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,EAAA,GAGAC,IAAeP,KAAS;AAAA,IAC5B,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,KAAK;AAAA,IACL,SAAS;AAAA,EAAA,EACTA,CAAK,GAEDQ,IAAiBP,KAAW;AAAA,IAChC,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,KAAK;AAAA,IACL,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,QAAQ;AAAA,EAAA,EACRA,CAAO,GAEHQ,IAAU;AAAA,IACd;AAAA,IACAJ,EAAiBP,CAAS;AAAA,IAC1BQ,EAAeP,CAAO;AAAA,IACtBQ;AAAA,IACAC;AAAA,IACAN,KAAQ;AAAA,IACRC;AAAA,EAAA,EAEC,OAAO,OAAO,EACd,KAAK,GAAG;AAEX,2BAAQ,OAAA,EAAI,WAAWM,GAAU,GAAGL,GAAO,UAAAP,GAAS;AACtD;"}
|
|
1
|
+
{"version":3,"file":"index75.js","sources":["../src/components/Splitter.tsx"],"sourcesContent":["import React, { useState, useRef, useCallback, useEffect } from 'react'\n\nexport interface SplitterPanelProps {\n children: React.ReactNode\n defaultSize?: number\n size?: number\n minSize?: number\n maxSize?: number\n collapsible?: boolean\n collapsed?: boolean\n onCollapse?: (collapsed: boolean) => void\n className?: string\n}\n\nexport interface SplitterProps {\n children: React.ReactNode\n direction?: 'horizontal' | 'vertical'\n sizes?: number[]\n defaultSizes?: number[]\n onSizesChange?: (sizes: number[]) => void\n gutterSize?: number\n minSize?: number\n className?: string\n}\n\nconst Panel: React.FC<SplitterPanelProps> = ({ children }) => {\n return <>{children}</>\n}\n\nexport const Splitter: React.FC<SplitterProps> & { Panel: typeof Panel } = ({\n children,\n direction = 'horizontal',\n sizes,\n defaultSizes,\n onSizesChange,\n gutterSize = 8,\n minSize = 50,\n className = '',\n}) => {\n const containerRef = useRef<HTMLDivElement>(null)\n const panelsRef = useRef<(HTMLDivElement | null)[]>([])\n const draggingRef = useRef<{ index: number; startPos: number; startSizes: number[] } | null>(null)\n\n // Extract panel props from children\n const panels = React.Children.toArray(children).filter(\n (child): child is React.ReactElement<SplitterPanelProps> =>\n React.isValidElement(child)\n )\n\n const panelCount = panels.length\n\n // Initialize sizes\n const getInitialSizes = useCallback(() => {\n if (defaultSizes && defaultSizes.length === panelCount) {\n return defaultSizes\n }\n // Equal distribution\n const equalSize = 100 / panelCount\n return Array(panelCount).fill(equalSize)\n }, [defaultSizes, panelCount])\n\n const [internalSizes, setInternalSizes] = useState<number[]>(getInitialSizes)\n const currentSizes = sizes || internalSizes\n\n // Update internal sizes when panel count changes\n useEffect(() => {\n if (!sizes && internalSizes.length !== panelCount) {\n setInternalSizes(getInitialSizes())\n }\n }, [panelCount, sizes, internalSizes.length, getInitialSizes])\n\n const updateSizes = useCallback(\n (newSizes: number[]) => {\n if (!sizes) {\n setInternalSizes(newSizes)\n }\n onSizesChange?.(newSizes)\n },\n [sizes, onSizesChange]\n )\n\n const handleMouseDown = useCallback(\n (index: number, e: React.MouseEvent) => {\n e.preventDefault()\n const startPos = direction === 'horizontal' ? e.clientX : e.clientY\n draggingRef.current = {\n index,\n startPos,\n startSizes: [...currentSizes],\n }\n\n const handleMouseMove = (moveEvent: MouseEvent) => {\n if (!draggingRef.current || !containerRef.current) return\n\n const { index: dragIndex, startPos: dragStartPos, startSizes } = draggingRef.current\n const containerRect = containerRef.current.getBoundingClientRect()\n const containerSize = direction === 'horizontal' ? containerRect.width : containerRect.height\n const currentPos = direction === 'horizontal' ? moveEvent.clientX : moveEvent.clientY\n\n // Calculate delta as percentage\n const gutterCount = panelCount - 1\n const totalGutterSize = gutterCount * gutterSize\n const availableSize = containerSize - totalGutterSize\n const deltaPixels = currentPos - dragStartPos\n const deltaPercent = (deltaPixels / availableSize) * 100\n\n // Get min sizes for panels\n const panel1Props = panels[dragIndex]?.props || {}\n const panel2Props = panels[dragIndex + 1]?.props || {}\n const minSize1 = panel1Props.minSize ?? minSize\n const minSize2 = panel2Props.minSize ?? minSize\n const minPercent1 = (minSize1 / availableSize) * 100\n const minPercent2 = (minSize2 / availableSize) * 100\n\n // Calculate new sizes\n let newSize1 = startSizes[dragIndex] + deltaPercent\n let newSize2 = startSizes[dragIndex + 1] - deltaPercent\n\n // Apply min constraints\n if (newSize1 < minPercent1) {\n newSize1 = minPercent1\n newSize2 = startSizes[dragIndex] + startSizes[dragIndex + 1] - minPercent1\n }\n if (newSize2 < minPercent2) {\n newSize2 = minPercent2\n newSize1 = startSizes[dragIndex] + startSizes[dragIndex + 1] - minPercent2\n }\n\n // Apply max constraints\n const maxSize1 = panel1Props.maxSize\n const maxSize2 = panel2Props.maxSize\n if (maxSize1) {\n const maxPercent1 = (maxSize1 / availableSize) * 100\n if (newSize1 > maxPercent1) {\n newSize1 = maxPercent1\n newSize2 = startSizes[dragIndex] + startSizes[dragIndex + 1] - maxPercent1\n }\n }\n if (maxSize2) {\n const maxPercent2 = (maxSize2 / availableSize) * 100\n if (newSize2 > maxPercent2) {\n newSize2 = maxPercent2\n newSize1 = startSizes[dragIndex] + startSizes[dragIndex + 1] - maxPercent2\n }\n }\n\n const newSizes = [...startSizes]\n newSizes[dragIndex] = newSize1\n newSizes[dragIndex + 1] = newSize2\n updateSizes(newSizes)\n }\n\n const handleMouseUp = () => {\n draggingRef.current = null\n document.removeEventListener('mousemove', handleMouseMove)\n document.removeEventListener('mouseup', handleMouseUp)\n document.body.style.cursor = ''\n document.body.style.userSelect = ''\n }\n\n document.addEventListener('mousemove', handleMouseMove)\n document.addEventListener('mouseup', handleMouseUp)\n document.body.style.cursor = direction === 'horizontal' ? 'col-resize' : 'row-resize'\n document.body.style.userSelect = 'none'\n },\n [direction, currentSizes, panelCount, gutterSize, panels, minSize, updateSizes]\n )\n\n const handleKeyDown = useCallback(\n (index: number, e: React.KeyboardEvent) => {\n const step = e.shiftKey ? 10 : 1\n let delta = 0\n\n if (direction === 'horizontal') {\n if (e.key === 'ArrowLeft') delta = -step\n else if (e.key === 'ArrowRight') delta = step\n } else {\n if (e.key === 'ArrowUp') delta = -step\n else if (e.key === 'ArrowDown') delta = step\n }\n\n if (delta !== 0) {\n e.preventDefault()\n const newSizes = [...currentSizes]\n const minPercent = 5 // Minimum 5% when using keyboard\n\n let newSize1 = newSizes[index] + delta\n let newSize2 = newSizes[index + 1] - delta\n\n if (newSize1 >= minPercent && newSize2 >= minPercent) {\n newSizes[index] = newSize1\n newSizes[index + 1] = newSize2\n updateSizes(newSizes)\n }\n }\n },\n [direction, currentSizes, updateSizes]\n )\n\n const isHorizontal = direction === 'horizontal'\n\n return (\n <div\n ref={containerRef}\n className={`flex ${isHorizontal ? 'flex-row' : 'flex-col'} h-full w-full ${className}`}\n >\n {panels.map((panel, index) => {\n const panelProps = panel.props\n const isLast = index === panels.length - 1\n\n return (\n <React.Fragment key={index}>\n <div\n ref={(el) => {\n panelsRef.current[index] = el\n }}\n className={`overflow-auto ${panelProps.className || ''}`}\n style={{\n [isHorizontal ? 'width' : 'height']: `calc(${currentSizes[index]}% - ${\n ((panelCount - 1) * gutterSize) / panelCount\n }px)`,\n flexShrink: 0,\n }}\n >\n {panelProps.children}\n </div>\n {!isLast && (\n <div\n role=\"separator\"\n aria-orientation={isHorizontal ? 'vertical' : 'horizontal'}\n aria-valuenow={Math.round(currentSizes[index])}\n tabIndex={0}\n className={`\n flex-shrink-0 bg-base-300 hover:bg-primary/30 active:bg-primary/50\n transition-colors duration-150 relative group\n ${isHorizontal ? 'cursor-col-resize' : 'cursor-row-resize'}\n `}\n style={{\n [isHorizontal ? 'width' : 'height']: `${gutterSize}px`,\n }}\n onMouseDown={(e) => handleMouseDown(index, e)}\n onKeyDown={(e) => handleKeyDown(index, e)}\n >\n {/* Grip indicator */}\n <div\n className={`\n absolute inset-0 flex items-center justify-center\n ${isHorizontal ? 'flex-col gap-0.5' : 'flex-row gap-0.5'}\n `}\n >\n <div className=\"w-1 h-1 rounded-full bg-base-content/30 group-hover:bg-primary/60\" />\n <div className=\"w-1 h-1 rounded-full bg-base-content/30 group-hover:bg-primary/60\" />\n <div className=\"w-1 h-1 rounded-full bg-base-content/30 group-hover:bg-primary/60\" />\n </div>\n </div>\n )}\n </React.Fragment>\n )\n })}\n </div>\n )\n}\n\nSplitter.Panel = Panel\n"],"names":["Panel","children","Splitter","direction","sizes","defaultSizes","onSizesChange","gutterSize","minSize","className","containerRef","useRef","panelsRef","draggingRef","panels","React","child","panelCount","getInitialSizes","useCallback","equalSize","internalSizes","setInternalSizes","useState","currentSizes","useEffect","updateSizes","newSizes","handleMouseDown","index","startPos","handleMouseMove","moveEvent","dragIndex","dragStartPos","startSizes","containerRect","containerSize","currentPos","totalGutterSize","availableSize","deltaPercent","panel1Props","panel2Props","minSize1","minSize2","minPercent1","minPercent2","newSize1","newSize2","maxSize1","maxSize2","maxPercent1","maxPercent2","handleMouseUp","handleKeyDown","step","delta","minPercent","isHorizontal","jsx","panel","panelProps","isLast","jsxs","el","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X,EAAc1B,GAAOqC,CAAC;AAAA,cAGxC,UAAA,gBAAAF;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBACC,WAAW;AAAA;AAAA,sBAEPL,IAAe,qBAAqB,kBAAkB;AAAA;AAAA,kBAG1D,UAAA;AAAA,oBAAA,gBAAAC,EAAC,OAAA,EAAI,WAAU,oEAAA,CAAoE;AAAA,oBACnF,gBAAAA,EAAC,OAAA,EAAI,WAAU,oEAAA,CAAoE;AAAA,oBACnF,gBAAAA,EAAC,OAAA,EAAI,WAAU,oEAAA,CAAoE;AAAA,kBAAA;AAAA,gBAAA;AAAA,cAAA;AAAA,YACrF;AAAA,UAAA;AAAA,QACF,EAAA,GA3CiB/B,CA6CrB;AAAA,MAEJ,CAAC;AAAA,IAAA;AAAA,EAAA;AAGP;AAEA3B,GAAS,QAAQF;"}
|
package/dist/index76.js
CHANGED
|
@@ -1,25 +1,55 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
+
const j = ({
|
|
3
|
+
children: s,
|
|
4
|
+
direction: a = "vertical",
|
|
5
|
+
spacing: n = 4,
|
|
6
|
+
align: e,
|
|
7
|
+
justify: t,
|
|
8
|
+
wrap: r = !1,
|
|
9
|
+
className: c = "",
|
|
10
|
+
...i
|
|
11
|
+
}) => {
|
|
12
|
+
const l = {
|
|
13
|
+
vertical: "flex-col",
|
|
14
|
+
horizontal: "flex-row"
|
|
15
|
+
}, o = {
|
|
16
|
+
0: "gap-0",
|
|
17
|
+
1: "gap-1",
|
|
18
|
+
2: "gap-2",
|
|
19
|
+
3: "gap-3",
|
|
20
|
+
4: "gap-4",
|
|
21
|
+
5: "gap-5",
|
|
22
|
+
6: "gap-6",
|
|
23
|
+
8: "gap-8",
|
|
24
|
+
10: "gap-10",
|
|
25
|
+
12: "gap-12",
|
|
26
|
+
16: "gap-16",
|
|
27
|
+
20: "gap-20",
|
|
28
|
+
24: "gap-24"
|
|
29
|
+
}, p = e && {
|
|
30
|
+
start: "items-start",
|
|
31
|
+
center: "items-center",
|
|
32
|
+
end: "items-end",
|
|
33
|
+
stretch: "items-stretch"
|
|
34
|
+
}[e], g = t && {
|
|
35
|
+
start: "justify-start",
|
|
36
|
+
center: "justify-center",
|
|
37
|
+
end: "justify-end",
|
|
38
|
+
between: "justify-between",
|
|
39
|
+
around: "justify-around",
|
|
40
|
+
evenly: "justify-evenly"
|
|
41
|
+
}[t], f = [
|
|
42
|
+
"flex",
|
|
43
|
+
l[a],
|
|
44
|
+
o[n],
|
|
45
|
+
p,
|
|
46
|
+
g,
|
|
47
|
+
r && "flex-wrap",
|
|
48
|
+
c
|
|
7
49
|
].filter(Boolean).join(" ");
|
|
8
|
-
return /* @__PURE__ */
|
|
9
|
-
}
|
|
10
|
-
function d({ title: s, value: a, desc: e, figure: i, actions: c, className: l = "", ...n }) {
|
|
11
|
-
return /* @__PURE__ */ r("div", { className: `stat ${l}`, ...n, children: [
|
|
12
|
-
i && /* @__PURE__ */ t("div", { className: "stat-figure", children: i }),
|
|
13
|
-
s && /* @__PURE__ */ t("div", { className: "stat-title", children: s }),
|
|
14
|
-
a && /* @__PURE__ */ t("div", { className: "stat-value", children: a }),
|
|
15
|
-
e && /* @__PURE__ */ t("div", { className: "stat-desc", children: e }),
|
|
16
|
-
c && /* @__PURE__ */ t("div", { className: "stat-actions", children: c })
|
|
17
|
-
] });
|
|
18
|
-
}
|
|
19
|
-
const v = Object.assign(o, {
|
|
20
|
-
Stat: d
|
|
21
|
-
});
|
|
50
|
+
return /* @__PURE__ */ u("div", { className: f, ...i, children: s });
|
|
51
|
+
};
|
|
22
52
|
export {
|
|
23
|
-
|
|
53
|
+
j as Stack
|
|
24
54
|
};
|
|
25
55
|
//# sourceMappingURL=index76.js.map
|
package/dist/index76.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index76.js","sources":["../src/components/
|
|
1
|
+
{"version":3,"file":"index76.js","sources":["../src/components/Stack.tsx"],"sourcesContent":["import React from 'react'\n\nexport interface StackProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode\n direction?: 'vertical' | 'horizontal'\n spacing?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 8 | 10 | 12 | 16 | 20 | 24\n align?: 'start' | 'center' | 'end' | 'stretch'\n justify?: 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly'\n wrap?: boolean\n}\n\nexport const Stack: React.FC<StackProps> = ({\n children,\n direction = 'vertical',\n spacing = 4,\n align,\n justify,\n wrap = false,\n className = '',\n ...rest\n}) => {\n const directionClasses = {\n vertical: 'flex-col',\n horizontal: 'flex-row',\n }\n\n const spacingClasses = {\n 0: 'gap-0',\n 1: 'gap-1',\n 2: 'gap-2',\n 3: 'gap-3',\n 4: 'gap-4',\n 5: 'gap-5',\n 6: 'gap-6',\n 8: 'gap-8',\n 10: 'gap-10',\n 12: 'gap-12',\n 16: 'gap-16',\n 20: 'gap-20',\n 24: 'gap-24',\n }\n\n const alignClasses = align && {\n start: 'items-start',\n center: 'items-center',\n end: 'items-end',\n stretch: 'items-stretch',\n }[align]\n\n const justifyClasses = justify && {\n start: 'justify-start',\n center: 'justify-center',\n end: 'justify-end',\n between: 'justify-between',\n around: 'justify-around',\n evenly: 'justify-evenly',\n }[justify]\n\n const classes = [\n 'flex',\n directionClasses[direction],\n spacingClasses[spacing],\n alignClasses,\n justifyClasses,\n wrap && 'flex-wrap',\n className,\n ]\n .filter(Boolean)\n .join(' ')\n\n return <div className={classes} {...rest}>{children}</div>\n}\n"],"names":["Stack","children","direction","spacing","align","justify","wrap","className","rest","directionClasses","spacingClasses","alignClasses","justifyClasses","classes"],"mappings":";AAWO,MAAMA,IAA8B,CAAC;AAAA,EAC1C,UAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,SAAAC,IAAU;AAAA,EACV,OAAAC;AAAA,EACA,SAAA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-
|
|
22
|
-
label: t,
|
|
23
|
-
className: u = ""
|
|
24
|
-
}) => {
|
|
25
|
-
const s = `status ${l[e]} ${m[r]} ${i ? "animate-bounce" : ""} ${u}`.trim();
|
|
26
|
-
return n ? /* @__PURE__ */ c("div", { className: "inline-grid *:[grid-area:1/1]", "aria-label": t, children: [
|
|
27
|
-
/* @__PURE__ */ a("div", { className: `${s} animate-ping` }),
|
|
28
|
-
/* @__PURE__ */ a("div", { className: s })
|
|
29
|
-
] }) : /* @__PURE__ */ a("div", { className: s, "aria-label": t });
|
|
30
|
-
};
|
|
1
|
+
import { jsx as t, jsxs as r } from "react/jsx-runtime";
|
|
2
|
+
function o({ children: s, className: a = "", vertical: e = !1, ...i }) {
|
|
3
|
+
const c = [
|
|
4
|
+
"stats",
|
|
5
|
+
e ? "stats-vertical" : "stats-horizontal",
|
|
6
|
+
a
|
|
7
|
+
].filter(Boolean).join(" ");
|
|
8
|
+
return /* @__PURE__ */ t("div", { className: c, ...i, children: s });
|
|
9
|
+
}
|
|
10
|
+
function d({ title: s, value: a, desc: e, figure: i, actions: c, className: l = "", ...n }) {
|
|
11
|
+
return /* @__PURE__ */ r("div", { className: `stat ${l}`, ...n, children: [
|
|
12
|
+
i && /* @__PURE__ */ t("div", { className: "stat-figure", children: i }),
|
|
13
|
+
s && /* @__PURE__ */ t("div", { className: "stat-title", children: s }),
|
|
14
|
+
a && /* @__PURE__ */ t("div", { className: "stat-value", children: a }),
|
|
15
|
+
e && /* @__PURE__ */ t("div", { className: "stat-desc", children: e }),
|
|
16
|
+
c && /* @__PURE__ */ t("div", { className: "stat-actions", children: c })
|
|
17
|
+
] });
|
|
18
|
+
}
|
|
19
|
+
const v = Object.assign(o, {
|
|
20
|
+
Stat: d
|
|
21
|
+
});
|
|
31
22
|
export {
|
|
32
|
-
|
|
23
|
+
v as Stats
|
|
33
24
|
};
|
|
34
25
|
//# sourceMappingURL=index77.js.map
|