@rockshin/tao-ui 0.0.1
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/LICENSE +21 -0
- package/README.md +65 -0
- package/dist/components/button/button.css +1055 -0
- package/dist/components/button/button.d.ts +15 -0
- package/dist/components/button/button.js +93 -0
- package/dist/components/checkbox/checkbox.css +1035 -0
- package/dist/components/checkbox/checkbox.d.ts +33 -0
- package/dist/components/checkbox/checkbox.js +312 -0
- package/dist/components/date-picker/calendar/calendar-grid.d.ts +18 -0
- package/dist/components/date-picker/calendar/calendar-grid.js +173 -0
- package/dist/components/date-picker/calendar/calendar-header.d.ts +10 -0
- package/dist/components/date-picker/calendar/calendar-header.js +336 -0
- package/dist/components/date-picker/calendar/month-grid.d.ts +9 -0
- package/dist/components/date-picker/calendar/month-grid.js +61 -0
- package/dist/components/date-picker/calendar/time-panel.d.ts +12 -0
- package/dist/components/date-picker/calendar/time-panel.js +233 -0
- package/dist/components/date-picker/calendar/use-calendar.d.ts +15 -0
- package/dist/components/date-picker/calendar/use-calendar.js +24 -0
- package/dist/components/date-picker/calendar/year-grid.d.ts +9 -0
- package/dist/components/date-picker/calendar/year-grid.js +60 -0
- package/dist/components/date-picker/date-picker.css +1799 -0
- package/dist/components/date-picker/date-picker.d.ts +29 -0
- package/dist/components/date-picker/date-picker.js +663 -0
- package/dist/components/date-picker/presets.d.ts +9 -0
- package/dist/components/date-picker/presets.js +36 -0
- package/dist/components/date-picker/range-picker.d.ts +30 -0
- package/dist/components/date-picker/range-picker.js +432 -0
- package/dist/components/date-picker/types.d.ts +39 -0
- package/dist/components/date-picker/types.js +7 -0
- package/dist/components/drawer/drawer.css +1112 -0
- package/dist/components/drawer/drawer.d.ts +17 -0
- package/dist/components/drawer/drawer.js +184 -0
- package/dist/components/form-actions/form-actions.d.ts +12 -0
- package/dist/components/form-actions/form-actions.js +42 -0
- package/dist/components/form-field/form-field.d.ts +17 -0
- package/dist/components/form-field/form-field.js +101 -0
- package/dist/components/form-field/form.css +1036 -0
- package/dist/components/form-section/form-section.d.ts +14 -0
- package/dist/components/form-section/form-section.js +92 -0
- package/dist/components/input/input.css +1185 -0
- package/dist/components/input/input.d.ts +15 -0
- package/dist/components/input/input.js +143 -0
- package/dist/components/pagination/pagination.css +1099 -0
- package/dist/components/pagination/pagination.d.ts +22 -0
- package/dist/components/pagination/pagination.js +310 -0
- package/dist/components/radio/radio.css +1045 -0
- package/dist/components/radio/radio.d.ts +34 -0
- package/dist/components/radio/radio.js +215 -0
- package/dist/components/scroll-area/scroll-area.css +1099 -0
- package/dist/components/scroll-area/scroll-area.d.ts +33 -0
- package/dist/components/scroll-area/scroll-area.js +375 -0
- package/dist/components/select/mobile-select.css +1044 -0
- package/dist/components/select/mobile-select.d.ts +19 -0
- package/dist/components/select/mobile-select.js +224 -0
- package/dist/components/select/select.css +1327 -0
- package/dist/components/select/select.d.ts +32 -0
- package/dist/components/select/select.js +532 -0
- package/dist/components/select/use-is-mobile.d.ts +1 -0
- package/dist/components/select/use-is-mobile.js +30 -0
- package/dist/components/splitter/splitter.css +1104 -0
- package/dist/components/splitter/splitter.d.ts +33 -0
- package/dist/components/splitter/splitter.js +451 -0
- package/dist/components/switch/switch.css +1170 -0
- package/dist/components/switch/switch.d.ts +19 -0
- package/dist/components/switch/switch.js +143 -0
- package/dist/components/table/table.css +1255 -0
- package/dist/components/table/table.d.ts +73 -0
- package/dist/components/table/table.js +1022 -0
- package/dist/components/tabs/tabs.css +1076 -0
- package/dist/components/tabs/tabs.d.ts +24 -0
- package/dist/components/tabs/tabs.js +256 -0
- package/dist/components/tag/tag.css +1124 -0
- package/dist/components/tag/tag.d.ts +33 -0
- package/dist/components/tag/tag.js +237 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +23 -0
- package/dist/layouts/form-layout/form-layout.d.ts +6 -0
- package/dist/layouts/form-layout/form-layout.js +18 -0
- package/dist/layouts/stack/layout.css +1003 -0
- package/dist/layouts/stack/stack.d.ts +9 -0
- package/dist/layouts/stack/stack.js +27 -0
- package/dist/number-input/cursor.d.ts +9 -0
- package/dist/number-input/cursor.js +44 -0
- package/dist/number-input/format.d.ts +5 -0
- package/dist/number-input/format.js +50 -0
- package/dist/number-input/index.d.ts +5 -0
- package/dist/number-input/index.js +2 -0
- package/dist/number-input/number-input.d.ts +9 -0
- package/dist/number-input/number-input.js +101 -0
- package/dist/number-input/percentage.d.ts +3 -0
- package/dist/number-input/percentage.js +28 -0
- package/dist/number-input/types.d.ts +5 -0
- package/dist/number-input/types.js +0 -0
- package/dist/number-input/use-number-input.d.ts +30 -0
- package/dist/number-input/use-number-input.js +211 -0
- package/dist/number-input/validate.d.ts +3 -0
- package/dist/number-input/validate.js +17 -0
- package/dist/provider/tao-provider.d.ts +42 -0
- package/dist/provider/tao-provider.js +67 -0
- package/dist/theme/control.css +1061 -0
- package/dist/theme/theme.css +957 -0
- package/dist/utils/semantic.d.ts +10 -0
- package/dist/utils/semantic.js +5 -0
- package/llms.txt +67 -0
- package/package.json +97 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type CSSProperties, type ReactNode } from 'react';
|
|
2
|
+
import { type SemanticClassNames, type SemanticStyles } from '../../utils/semantic';
|
|
3
|
+
import './splitter.css';
|
|
4
|
+
export type SplitterSemanticPart = 'root' | 'panel' | 'dragger';
|
|
5
|
+
export interface SplitterPanelProps {
|
|
6
|
+
defaultSize?: number | string;
|
|
7
|
+
size?: number | string;
|
|
8
|
+
min?: number | string;
|
|
9
|
+
max?: number | string;
|
|
10
|
+
collapsible?: boolean | {
|
|
11
|
+
start?: boolean;
|
|
12
|
+
end?: boolean;
|
|
13
|
+
};
|
|
14
|
+
resizable?: boolean;
|
|
15
|
+
children?: ReactNode;
|
|
16
|
+
style?: CSSProperties;
|
|
17
|
+
className?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface SplitterProps {
|
|
20
|
+
orientation?: 'horizontal' | 'vertical';
|
|
21
|
+
onResize?: (sizes: number[]) => void;
|
|
22
|
+
onResizeEnd?: (sizes: number[]) => void;
|
|
23
|
+
onResizeStart?: (sizes: number[]) => void;
|
|
24
|
+
className?: string;
|
|
25
|
+
classNames?: SemanticClassNames<SplitterSemanticPart>;
|
|
26
|
+
styles?: SemanticStyles<SplitterSemanticPart>;
|
|
27
|
+
children: ReactNode;
|
|
28
|
+
}
|
|
29
|
+
export declare function Panel(_props: SplitterPanelProps): ReactNode;
|
|
30
|
+
export declare function Splitter({ orientation, onResize, onResizeEnd, onResizeStart, className, classNames, styles, children, }: SplitterProps): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export declare namespace Splitter {
|
|
32
|
+
var Panel: typeof import("./splitter").Panel;
|
|
33
|
+
}
|
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
4
|
+
import { cx } from "../../utils/semantic.js";
|
|
5
|
+
import "./splitter.css";
|
|
6
|
+
function parseSize(value, total) {
|
|
7
|
+
if (void 0 === value) return;
|
|
8
|
+
if ('number' == typeof value) return value;
|
|
9
|
+
if (value.endsWith('%')) return parseFloat(value) / 100 * total;
|
|
10
|
+
return parseFloat(value);
|
|
11
|
+
}
|
|
12
|
+
function CollapseIcon(t0) {
|
|
13
|
+
const $ = c(3);
|
|
14
|
+
const { direction } = t0;
|
|
15
|
+
let t1;
|
|
16
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
17
|
+
t1 = /*#__PURE__*/ jsx("path", {
|
|
18
|
+
d: "M7.5 2.5L4 6l3.5 3.5",
|
|
19
|
+
stroke: "currentColor",
|
|
20
|
+
strokeWidth: "1.5",
|
|
21
|
+
strokeLinecap: "round",
|
|
22
|
+
strokeLinejoin: "round"
|
|
23
|
+
});
|
|
24
|
+
$[0] = t1;
|
|
25
|
+
} else t1 = $[0];
|
|
26
|
+
let t2;
|
|
27
|
+
if ($[1] !== direction) {
|
|
28
|
+
t2 = /*#__PURE__*/ jsx("svg", {
|
|
29
|
+
width: "12",
|
|
30
|
+
height: "12",
|
|
31
|
+
viewBox: "0 0 12 12",
|
|
32
|
+
fill: "none",
|
|
33
|
+
"aria-hidden": true,
|
|
34
|
+
"data-tao-collapse-direction": direction,
|
|
35
|
+
children: t1
|
|
36
|
+
});
|
|
37
|
+
$[1] = direction;
|
|
38
|
+
$[2] = t2;
|
|
39
|
+
} else t2 = $[2];
|
|
40
|
+
return t2;
|
|
41
|
+
}
|
|
42
|
+
function Panel(_props) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
function Splitter(t0) {
|
|
46
|
+
const $ = c(66);
|
|
47
|
+
const { orientation: t1, onResize, onResizeEnd, onResizeStart, className, classNames, styles, children } = t0;
|
|
48
|
+
const orientation = void 0 === t1 ? "horizontal" : t1;
|
|
49
|
+
const containerRef = useRef(null);
|
|
50
|
+
let panelChildren;
|
|
51
|
+
let panels;
|
|
52
|
+
if ($[0] !== children) {
|
|
53
|
+
panels = [];
|
|
54
|
+
panelChildren = [];
|
|
55
|
+
const childArray = Array.isArray(children) ? children : [
|
|
56
|
+
children
|
|
57
|
+
];
|
|
58
|
+
for (const child of childArray)if (child && "object" == typeof child && "type" in child && child.type === Panel) {
|
|
59
|
+
panels.push(child.props);
|
|
60
|
+
panelChildren.push(child.props.children);
|
|
61
|
+
}
|
|
62
|
+
$[0] = children;
|
|
63
|
+
$[1] = panelChildren;
|
|
64
|
+
$[2] = panels;
|
|
65
|
+
} else {
|
|
66
|
+
panelChildren = $[1];
|
|
67
|
+
panels = $[2];
|
|
68
|
+
}
|
|
69
|
+
const panelCount = panels.length;
|
|
70
|
+
const isHorizontal = "horizontal" === orientation;
|
|
71
|
+
let t2;
|
|
72
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
73
|
+
t2 = [];
|
|
74
|
+
$[3] = t2;
|
|
75
|
+
} else t2 = $[3];
|
|
76
|
+
const [sizes, setSizes] = useState(t2);
|
|
77
|
+
const [containerSize, setContainerSize] = useState(0);
|
|
78
|
+
const initialized = useRef(false);
|
|
79
|
+
let t3;
|
|
80
|
+
let t4;
|
|
81
|
+
if ($[4] !== isHorizontal) {
|
|
82
|
+
t3 = ()=>{
|
|
83
|
+
const el = containerRef.current;
|
|
84
|
+
if (!el) return;
|
|
85
|
+
const observer = new ResizeObserver((entries)=>{
|
|
86
|
+
const entry = entries[0];
|
|
87
|
+
if (!entry) return;
|
|
88
|
+
const total = isHorizontal ? entry.contentRect.width : entry.contentRect.height;
|
|
89
|
+
setContainerSize(total);
|
|
90
|
+
});
|
|
91
|
+
observer.observe(el);
|
|
92
|
+
return ()=>observer.disconnect();
|
|
93
|
+
};
|
|
94
|
+
t4 = [
|
|
95
|
+
isHorizontal
|
|
96
|
+
];
|
|
97
|
+
$[4] = isHorizontal;
|
|
98
|
+
$[5] = t3;
|
|
99
|
+
$[6] = t4;
|
|
100
|
+
} else {
|
|
101
|
+
t3 = $[5];
|
|
102
|
+
t4 = $[6];
|
|
103
|
+
}
|
|
104
|
+
useEffect(t3, t4);
|
|
105
|
+
let t5;
|
|
106
|
+
if ($[7] !== containerSize || $[8] !== panelCount || $[9] !== panels || $[10] !== sizes.length) {
|
|
107
|
+
t5 = ()=>{
|
|
108
|
+
if (containerSize <= 0 || 0 === panelCount) return;
|
|
109
|
+
if (initialized.current && sizes.length === panelCount) return;
|
|
110
|
+
const draggerSpace = (panelCount - 1) * 1;
|
|
111
|
+
const available = containerSize - draggerSpace;
|
|
112
|
+
const newSizes = [];
|
|
113
|
+
let allocated = 0;
|
|
114
|
+
let unspecified = 0;
|
|
115
|
+
for(let i = 0; i < panelCount; i++){
|
|
116
|
+
const p = panels[i];
|
|
117
|
+
const controlled = void 0 !== p.size ? parseSize(p.size, available) : void 0;
|
|
118
|
+
const def = void 0 !== p.defaultSize ? parseSize(p.defaultSize, available) : void 0;
|
|
119
|
+
const s = controlled ?? def;
|
|
120
|
+
if (void 0 !== s) {
|
|
121
|
+
newSizes.push(s);
|
|
122
|
+
allocated += s;
|
|
123
|
+
} else {
|
|
124
|
+
newSizes.push(-1);
|
|
125
|
+
unspecified++;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
const remaining = Math.max(0, available - allocated);
|
|
129
|
+
const perUnspecified = unspecified > 0 ? remaining / unspecified : 0;
|
|
130
|
+
for(let i_0 = 0; i_0 < newSizes.length; i_0++)if (newSizes[i_0] < 0) newSizes[i_0] = perUnspecified;
|
|
131
|
+
setSizes(newSizes);
|
|
132
|
+
initialized.current = true;
|
|
133
|
+
};
|
|
134
|
+
$[7] = containerSize;
|
|
135
|
+
$[8] = panelCount;
|
|
136
|
+
$[9] = panels;
|
|
137
|
+
$[10] = sizes.length;
|
|
138
|
+
$[11] = t5;
|
|
139
|
+
} else t5 = $[11];
|
|
140
|
+
let t6;
|
|
141
|
+
if ($[12] !== containerSize || $[13] !== panelCount) {
|
|
142
|
+
t6 = [
|
|
143
|
+
containerSize,
|
|
144
|
+
panelCount
|
|
145
|
+
];
|
|
146
|
+
$[12] = containerSize;
|
|
147
|
+
$[13] = panelCount;
|
|
148
|
+
$[14] = t6;
|
|
149
|
+
} else t6 = $[14];
|
|
150
|
+
useEffect(t5, t6);
|
|
151
|
+
let t7;
|
|
152
|
+
if ($[15] !== containerSize || $[16] !== panelCount || $[17] !== panels || $[18] !== sizes) {
|
|
153
|
+
t7 = ()=>{
|
|
154
|
+
if (!initialized.current || sizes.length !== panelCount) return;
|
|
155
|
+
const draggerSpace_0 = (panelCount - 1) * 1;
|
|
156
|
+
const available_0 = containerSize - draggerSpace_0;
|
|
157
|
+
let changed = false;
|
|
158
|
+
const next = [
|
|
159
|
+
...sizes
|
|
160
|
+
];
|
|
161
|
+
for(let i_1 = 0; i_1 < panelCount; i_1++){
|
|
162
|
+
const controlled_0 = void 0 !== panels[i_1].size ? parseSize(panels[i_1].size, available_0) : void 0;
|
|
163
|
+
if (void 0 !== controlled_0 && Math.abs(controlled_0 - next[i_1]) > 0.5) {
|
|
164
|
+
next[i_1] = controlled_0;
|
|
165
|
+
changed = true;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
if (changed) setSizes(next);
|
|
169
|
+
};
|
|
170
|
+
$[15] = containerSize;
|
|
171
|
+
$[16] = panelCount;
|
|
172
|
+
$[17] = panels;
|
|
173
|
+
$[18] = sizes;
|
|
174
|
+
$[19] = t7;
|
|
175
|
+
} else t7 = $[19];
|
|
176
|
+
useEffect(t7);
|
|
177
|
+
const dragging = useRef(null);
|
|
178
|
+
let t8;
|
|
179
|
+
if ($[20] !== containerSize || $[21] !== isHorizontal || $[22] !== onResize || $[23] !== onResizeEnd || $[24] !== onResizeStart || $[25] !== panelCount || $[26] !== panels || $[27] !== sizes) {
|
|
180
|
+
t8 = (index, e)=>{
|
|
181
|
+
e.preventDefault();
|
|
182
|
+
const pos = isHorizontal ? e.clientX : e.clientY;
|
|
183
|
+
dragging.current = {
|
|
184
|
+
index,
|
|
185
|
+
startPos: pos,
|
|
186
|
+
startSizes: [
|
|
187
|
+
...sizes
|
|
188
|
+
]
|
|
189
|
+
};
|
|
190
|
+
onResizeStart?.(sizes);
|
|
191
|
+
const handleMove = (ev)=>{
|
|
192
|
+
if (!dragging.current) return;
|
|
193
|
+
const { index: idx, startPos, startSizes } = dragging.current;
|
|
194
|
+
const delta = (isHorizontal ? ev.clientX : ev.clientY) - startPos;
|
|
195
|
+
const draggerSpace_1 = (panelCount - 1) * 1;
|
|
196
|
+
const available_1 = containerSize - draggerSpace_1;
|
|
197
|
+
const leftIdx = idx;
|
|
198
|
+
const rightIdx = idx + 1;
|
|
199
|
+
const leftMin = parseSize(panels[leftIdx].min, available_1) ?? 0;
|
|
200
|
+
const leftMax = parseSize(panels[leftIdx].max, available_1);
|
|
201
|
+
const rightMin = parseSize(panels[rightIdx].min, available_1) ?? 0;
|
|
202
|
+
const rightMax = parseSize(panels[rightIdx].max, available_1);
|
|
203
|
+
let newLeft = startSizes[leftIdx] + delta;
|
|
204
|
+
let newRight;
|
|
205
|
+
const total_0 = startSizes[leftIdx] + startSizes[rightIdx];
|
|
206
|
+
if (void 0 !== leftMin) newLeft = Math.max(newLeft, leftMin);
|
|
207
|
+
if (void 0 !== leftMax) newLeft = Math.min(newLeft, leftMax);
|
|
208
|
+
newLeft = Math.max(0, newLeft);
|
|
209
|
+
if (void 0 !== rightMin) newLeft = Math.min(newLeft, total_0 - rightMin);
|
|
210
|
+
if (void 0 !== rightMax) newLeft = Math.max(newLeft, total_0 - rightMax);
|
|
211
|
+
newLeft = Math.max(0, Math.min(newLeft, total_0));
|
|
212
|
+
newRight = total_0 - newLeft;
|
|
213
|
+
const next_0 = [
|
|
214
|
+
...startSizes
|
|
215
|
+
];
|
|
216
|
+
next_0[leftIdx] = newLeft;
|
|
217
|
+
next_0[rightIdx] = newRight;
|
|
218
|
+
setSizes(next_0);
|
|
219
|
+
onResize?.(next_0);
|
|
220
|
+
};
|
|
221
|
+
const handleUp = ()=>{
|
|
222
|
+
if (dragging.current) {
|
|
223
|
+
dragging.current = null;
|
|
224
|
+
document.removeEventListener("pointermove", handleMove);
|
|
225
|
+
document.removeEventListener("pointerup", handleUp);
|
|
226
|
+
setSizes((cur)=>{
|
|
227
|
+
onResizeEnd?.(cur);
|
|
228
|
+
return cur;
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
document.addEventListener("pointermove", handleMove);
|
|
233
|
+
document.addEventListener("pointerup", handleUp);
|
|
234
|
+
};
|
|
235
|
+
$[20] = containerSize;
|
|
236
|
+
$[21] = isHorizontal;
|
|
237
|
+
$[22] = onResize;
|
|
238
|
+
$[23] = onResizeEnd;
|
|
239
|
+
$[24] = onResizeStart;
|
|
240
|
+
$[25] = panelCount;
|
|
241
|
+
$[26] = panels;
|
|
242
|
+
$[27] = sizes;
|
|
243
|
+
$[28] = t8;
|
|
244
|
+
} else t8 = $[28];
|
|
245
|
+
const handleDragStart = t8;
|
|
246
|
+
let t9;
|
|
247
|
+
if ($[29] !== containerSize || $[30] !== onResize || $[31] !== onResizeEnd || $[32] !== panelCount || $[33] !== panels) {
|
|
248
|
+
t9 = (index_0, direction)=>{
|
|
249
|
+
const draggerSpace_2 = (panelCount - 1) * 1;
|
|
250
|
+
const available_2 = containerSize - draggerSpace_2;
|
|
251
|
+
const targetIdx = "start" === direction ? index_0 : index_0 + 1;
|
|
252
|
+
const adjacentIdx = "start" === direction ? index_0 + 1 : index_0;
|
|
253
|
+
setSizes((prev)=>{
|
|
254
|
+
const next_1 = [
|
|
255
|
+
...prev
|
|
256
|
+
];
|
|
257
|
+
const isCollapsed = next_1[targetIdx] <= 0;
|
|
258
|
+
if (isCollapsed) {
|
|
259
|
+
const def_0 = parseSize(panels[targetIdx].defaultSize, available_2);
|
|
260
|
+
const expandTo = def_0 ?? available_2 / panelCount;
|
|
261
|
+
const take = Math.min(expandTo, next_1[adjacentIdx]);
|
|
262
|
+
next_1[targetIdx] = take;
|
|
263
|
+
next_1[adjacentIdx] = next_1[adjacentIdx] - take;
|
|
264
|
+
} else {
|
|
265
|
+
next_1[adjacentIdx] = next_1[adjacentIdx] + next_1[targetIdx];
|
|
266
|
+
next_1[targetIdx] = 0;
|
|
267
|
+
}
|
|
268
|
+
onResize?.(next_1);
|
|
269
|
+
onResizeEnd?.(next_1);
|
|
270
|
+
return next_1;
|
|
271
|
+
});
|
|
272
|
+
};
|
|
273
|
+
$[29] = containerSize;
|
|
274
|
+
$[30] = onResize;
|
|
275
|
+
$[31] = onResizeEnd;
|
|
276
|
+
$[32] = panelCount;
|
|
277
|
+
$[33] = panels;
|
|
278
|
+
$[34] = t9;
|
|
279
|
+
} else t9 = $[34];
|
|
280
|
+
const handleCollapse = t9;
|
|
281
|
+
let t10;
|
|
282
|
+
if ($[35] !== panels) {
|
|
283
|
+
t10 = function(index_1) {
|
|
284
|
+
const leftPanel = panels[index_1];
|
|
285
|
+
const rightPanel = panels[index_1 + 1];
|
|
286
|
+
let startCollapsible = false;
|
|
287
|
+
let endCollapsible = false;
|
|
288
|
+
if (true === leftPanel.collapsible) startCollapsible = true;
|
|
289
|
+
else if ("object" == typeof leftPanel.collapsible) {
|
|
290
|
+
if (leftPanel.collapsible.end) startCollapsible = true;
|
|
291
|
+
}
|
|
292
|
+
if (true === rightPanel.collapsible) endCollapsible = true;
|
|
293
|
+
else if ("object" == typeof rightPanel.collapsible) {
|
|
294
|
+
if (rightPanel.collapsible.start) endCollapsible = true;
|
|
295
|
+
}
|
|
296
|
+
return {
|
|
297
|
+
start: startCollapsible,
|
|
298
|
+
end: endCollapsible
|
|
299
|
+
};
|
|
300
|
+
};
|
|
301
|
+
$[35] = panels;
|
|
302
|
+
$[36] = t10;
|
|
303
|
+
} else t10 = $[36];
|
|
304
|
+
const getDraggerCollapse = t10;
|
|
305
|
+
if (sizes.length !== panelCount) {
|
|
306
|
+
const t11 = classNames?.root;
|
|
307
|
+
let t12;
|
|
308
|
+
if ($[37] !== className || $[38] !== t11) {
|
|
309
|
+
t12 = cx(t11, className);
|
|
310
|
+
$[37] = className;
|
|
311
|
+
$[38] = t11;
|
|
312
|
+
$[39] = t12;
|
|
313
|
+
} else t12 = $[39];
|
|
314
|
+
const t13 = styles?.root;
|
|
315
|
+
let t14;
|
|
316
|
+
if ($[40] !== orientation || $[41] !== t12 || $[42] !== t13) {
|
|
317
|
+
t14 = /*#__PURE__*/ jsx("div", {
|
|
318
|
+
ref: containerRef,
|
|
319
|
+
"data-tao-splitter": "",
|
|
320
|
+
"data-tao-orientation": orientation,
|
|
321
|
+
className: t12,
|
|
322
|
+
style: t13
|
|
323
|
+
});
|
|
324
|
+
$[40] = orientation;
|
|
325
|
+
$[41] = t12;
|
|
326
|
+
$[42] = t13;
|
|
327
|
+
$[43] = t14;
|
|
328
|
+
} else t14 = $[43];
|
|
329
|
+
return t14;
|
|
330
|
+
}
|
|
331
|
+
const t11 = classNames?.root;
|
|
332
|
+
let t12;
|
|
333
|
+
if ($[44] !== className || $[45] !== t11) {
|
|
334
|
+
t12 = cx(t11, className);
|
|
335
|
+
$[44] = className;
|
|
336
|
+
$[45] = t11;
|
|
337
|
+
$[46] = t12;
|
|
338
|
+
} else t12 = $[46];
|
|
339
|
+
const t13 = styles?.root;
|
|
340
|
+
let t14;
|
|
341
|
+
if ($[47] !== classNames?.dragger || $[48] !== classNames?.panel || $[49] !== getDraggerCollapse || $[50] !== handleCollapse || $[51] !== handleDragStart || $[52] !== isHorizontal || $[53] !== orientation || $[54] !== panelChildren || $[55] !== panelCount || $[56] !== panels || $[57] !== sizes || $[58] !== styles?.dragger || $[59] !== styles?.panel) {
|
|
342
|
+
t14 = panels.map((panel, i_2)=>{
|
|
343
|
+
const sizeStyle = isHorizontal ? {
|
|
344
|
+
width: sizes[i_2],
|
|
345
|
+
flexShrink: 0,
|
|
346
|
+
flexGrow: 0
|
|
347
|
+
} : {
|
|
348
|
+
height: sizes[i_2],
|
|
349
|
+
flexShrink: 0,
|
|
350
|
+
flexGrow: 0
|
|
351
|
+
};
|
|
352
|
+
const isCollapsed_0 = sizes[i_2] <= 0;
|
|
353
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
354
|
+
style: {
|
|
355
|
+
display: "contents"
|
|
356
|
+
},
|
|
357
|
+
children: [
|
|
358
|
+
/*#__PURE__*/ jsx("div", {
|
|
359
|
+
"data-tao-splitter-panel": "",
|
|
360
|
+
"data-tao-collapsed": isCollapsed_0 || void 0,
|
|
361
|
+
className: cx(classNames?.panel, panel.className),
|
|
362
|
+
style: {
|
|
363
|
+
...sizeStyle,
|
|
364
|
+
...styles?.panel,
|
|
365
|
+
...panel.style
|
|
366
|
+
},
|
|
367
|
+
children: panelChildren[i_2]
|
|
368
|
+
}),
|
|
369
|
+
i_2 < panelCount - 1 && /*#__PURE__*/ jsxs("div", {
|
|
370
|
+
"data-tao-splitter-dragger": "",
|
|
371
|
+
"data-tao-orientation": orientation,
|
|
372
|
+
className: cx(classNames?.dragger),
|
|
373
|
+
style: styles?.dragger,
|
|
374
|
+
onPointerDown: (e_0)=>{
|
|
375
|
+
if ((panel.resizable ?? true) && (panels[i_2 + 1]?.resizable ?? true)) handleDragStart(i_2, e_0);
|
|
376
|
+
},
|
|
377
|
+
children: [
|
|
378
|
+
/*#__PURE__*/ jsx("div", {
|
|
379
|
+
"data-tao-splitter-dragger-bar": ""
|
|
380
|
+
}),
|
|
381
|
+
(()=>{
|
|
382
|
+
const { start, end } = getDraggerCollapse(i_2);
|
|
383
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
384
|
+
children: [
|
|
385
|
+
start && /*#__PURE__*/ jsx("button", {
|
|
386
|
+
type: "button",
|
|
387
|
+
"data-tao-splitter-collapse": "",
|
|
388
|
+
"data-tao-collapse-direction": "start",
|
|
389
|
+
"data-tao-orientation": orientation,
|
|
390
|
+
"aria-label": "Collapse panel",
|
|
391
|
+
onClick: ()=>handleCollapse(i_2, "start"),
|
|
392
|
+
children: /*#__PURE__*/ jsx(CollapseIcon, {
|
|
393
|
+
direction: sizes[i_2] <= 0 ? "end" : "start",
|
|
394
|
+
orientation: orientation
|
|
395
|
+
})
|
|
396
|
+
}),
|
|
397
|
+
end && /*#__PURE__*/ jsx("button", {
|
|
398
|
+
type: "button",
|
|
399
|
+
"data-tao-splitter-collapse": "",
|
|
400
|
+
"data-tao-collapse-direction": "end",
|
|
401
|
+
"data-tao-orientation": orientation,
|
|
402
|
+
"aria-label": "Collapse panel",
|
|
403
|
+
onClick: ()=>handleCollapse(i_2, "end"),
|
|
404
|
+
children: /*#__PURE__*/ jsx(CollapseIcon, {
|
|
405
|
+
direction: sizes[i_2 + 1] <= 0 ? "start" : "end",
|
|
406
|
+
orientation: orientation
|
|
407
|
+
})
|
|
408
|
+
})
|
|
409
|
+
]
|
|
410
|
+
});
|
|
411
|
+
})()
|
|
412
|
+
]
|
|
413
|
+
})
|
|
414
|
+
]
|
|
415
|
+
}, i_2);
|
|
416
|
+
});
|
|
417
|
+
$[47] = classNames?.dragger;
|
|
418
|
+
$[48] = classNames?.panel;
|
|
419
|
+
$[49] = getDraggerCollapse;
|
|
420
|
+
$[50] = handleCollapse;
|
|
421
|
+
$[51] = handleDragStart;
|
|
422
|
+
$[52] = isHorizontal;
|
|
423
|
+
$[53] = orientation;
|
|
424
|
+
$[54] = panelChildren;
|
|
425
|
+
$[55] = panelCount;
|
|
426
|
+
$[56] = panels;
|
|
427
|
+
$[57] = sizes;
|
|
428
|
+
$[58] = styles?.dragger;
|
|
429
|
+
$[59] = styles?.panel;
|
|
430
|
+
$[60] = t14;
|
|
431
|
+
} else t14 = $[60];
|
|
432
|
+
let t15;
|
|
433
|
+
if ($[61] !== orientation || $[62] !== t12 || $[63] !== t13 || $[64] !== t14) {
|
|
434
|
+
t15 = /*#__PURE__*/ jsx("div", {
|
|
435
|
+
ref: containerRef,
|
|
436
|
+
"data-tao-splitter": "",
|
|
437
|
+
"data-tao-orientation": orientation,
|
|
438
|
+
className: t12,
|
|
439
|
+
style: t13,
|
|
440
|
+
children: t14
|
|
441
|
+
});
|
|
442
|
+
$[61] = orientation;
|
|
443
|
+
$[62] = t12;
|
|
444
|
+
$[63] = t13;
|
|
445
|
+
$[64] = t14;
|
|
446
|
+
$[65] = t15;
|
|
447
|
+
} else t15 = $[65];
|
|
448
|
+
return t15;
|
|
449
|
+
}
|
|
450
|
+
Splitter.Panel = Panel;
|
|
451
|
+
export { Panel, Splitter };
|