datocms-react-ui 2.0.12 → 2.0.14
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/cjs/SplitView/SplitViewPane/index.js +14 -0
- package/dist/cjs/SplitView/SplitViewPane/index.js.map +1 -0
- package/dist/cjs/SplitView/SplitViewPane/styles.module.css.json +1 -0
- package/dist/cjs/SplitView/SplitViewSash/index.js +76 -0
- package/dist/cjs/SplitView/SplitViewSash/index.js.map +1 -0
- package/dist/cjs/SplitView/SplitViewSash/styles.module.css.json +1 -0
- package/dist/cjs/SplitView/index.js +206 -0
- package/dist/cjs/SplitView/index.js.map +1 -0
- package/dist/cjs/SplitView/styles.module.css.json +1 -0
- package/dist/cjs/SplitView/types.js +3 -0
- package/dist/cjs/SplitView/types.js.map +1 -0
- package/dist/cjs/VerticalSplit/index.js +337 -0
- package/dist/cjs/VerticalSplit/index.js.map +1 -0
- package/dist/cjs/VerticalSplit/styles.module.css.json +1 -0
- package/dist/cjs/icons.js +19 -1
- package/dist/cjs/icons.js.map +1 -1
- package/dist/cjs/index.js +5 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/SplitView/SplitViewPane/index.d.ts +7 -0
- package/dist/esm/SplitView/SplitViewPane/index.js +7 -0
- package/dist/esm/SplitView/SplitViewPane/index.js.map +1 -0
- package/dist/esm/SplitView/SplitViewPane/styles.module.css.json +1 -0
- package/dist/esm/SplitView/SplitViewSash/index.d.ts +17 -0
- package/dist/esm/SplitView/SplitViewSash/index.js +46 -0
- package/dist/esm/SplitView/SplitViewSash/index.js.map +1 -0
- package/dist/esm/SplitView/SplitViewSash/styles.module.css.json +1 -0
- package/dist/esm/SplitView/index.d.ts +16 -0
- package/dist/esm/SplitView/index.js +176 -0
- package/dist/esm/SplitView/index.js.map +1 -0
- package/dist/esm/SplitView/styles.module.css.json +1 -0
- package/dist/esm/SplitView/types.d.ts +8 -0
- package/dist/esm/SplitView/types.js +2 -0
- package/dist/esm/SplitView/types.js.map +1 -0
- package/dist/esm/VerticalSplit/index.d.ts +238 -0
- package/dist/esm/VerticalSplit/index.js +307 -0
- package/dist/esm/VerticalSplit/index.js.map +1 -0
- package/dist/esm/VerticalSplit/styles.module.css.json +1 -0
- package/dist/esm/icons.d.ts +3 -0
- package/dist/esm/icons.js +15 -0
- package/dist/esm/icons.js.map +1 -1
- package/dist/esm/index.d.ts +5 -3
- package/dist/esm/index.js +5 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/types/SplitView/SplitViewPane/index.d.ts +7 -0
- package/dist/types/SplitView/SplitViewSash/index.d.ts +17 -0
- package/dist/types/SplitView/index.d.ts +16 -0
- package/dist/types/SplitView/types.d.ts +8 -0
- package/dist/types/VerticalSplit/index.d.ts +238 -0
- package/dist/types/icons.d.ts +3 -0
- package/dist/types/index.d.ts +5 -3
- package/package.json +3 -3
- package/src/SplitView/SplitViewPane/index.tsx +19 -0
- package/src/SplitView/SplitViewPane/styles.module.css +6 -0
- package/src/SplitView/SplitViewPane/styles.module.css.json +1 -0
- package/src/SplitView/SplitViewSash/index.tsx +99 -0
- package/src/SplitView/SplitViewSash/styles.module.css +68 -0
- package/src/SplitView/SplitViewSash/styles.module.css.json +1 -0
- package/src/SplitView/index.tsx +256 -0
- package/src/SplitView/styles.module.css +22 -0
- package/src/SplitView/styles.module.css.json +1 -0
- package/src/SplitView/types.ts +9 -0
- package/src/VerticalSplit/index.tsx +402 -0
- package/src/VerticalSplit/styles.module.css +103 -0
- package/src/VerticalSplit/styles.module.css.json +1 -0
- package/src/global.css +29 -25
- package/src/icons.tsx +60 -0
- package/src/index.ts +5 -3
- package/styles.css +1 -1
- package/types.json +2721 -1848
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare type VerticalSplitProps = {
|
|
3
|
+
mode?: 'overlay' | 'split';
|
|
4
|
+
minSize?: number | string;
|
|
5
|
+
maxSize?: number | string;
|
|
6
|
+
size?: number | string;
|
|
7
|
+
primaryPane: 'left' | 'right';
|
|
8
|
+
isSecondaryCollapsed?: boolean;
|
|
9
|
+
allowResize?: boolean;
|
|
10
|
+
children: [React.ReactNode, React.ReactNode];
|
|
11
|
+
onDragFinished?: (newSize: number) => void;
|
|
12
|
+
onSecondaryToggle?: (secondaryExpanded: boolean) => void;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* @example Resizable, left primary panel
|
|
16
|
+
*
|
|
17
|
+
* ```js
|
|
18
|
+
* <Canvas ctx={ctx}>
|
|
19
|
+
* <div style={{ height: 500, position: 'relative' }}>
|
|
20
|
+
* <VerticalSplit primaryPane="left" size="25%" minSize={220}>
|
|
21
|
+
* <div style={{ display: 'flex', flexDirection: 'column', height: '100%' }}>
|
|
22
|
+
* <Toolbar>
|
|
23
|
+
* <ToolbarStack stackSize="l">
|
|
24
|
+
* <ToolbarTitle>Primary</ToolbarTitle>
|
|
25
|
+
* </ToolbarStack>
|
|
26
|
+
* </Toolbar>
|
|
27
|
+
* <div
|
|
28
|
+
* style={{
|
|
29
|
+
* flex: '1',
|
|
30
|
+
* display: 'flex',
|
|
31
|
+
* justifyContent: 'center',
|
|
32
|
+
* alignItems: 'center',
|
|
33
|
+
* height: '150px',
|
|
34
|
+
* }}
|
|
35
|
+
* >
|
|
36
|
+
* Main content
|
|
37
|
+
* </div>
|
|
38
|
+
* </div>
|
|
39
|
+
* <div style={{ display: 'flex', flexDirection: 'column', height: '100%', borderLeft: '1px solid var(--border-color)' }}>
|
|
40
|
+
* <Toolbar>
|
|
41
|
+
* <ToolbarStack stackSize="l">
|
|
42
|
+
* <ToolbarTitle>Secondary</ToolbarTitle>
|
|
43
|
+
* </ToolbarStack>
|
|
44
|
+
* </Toolbar>
|
|
45
|
+
* <div
|
|
46
|
+
* style={{
|
|
47
|
+
* flex: '1',
|
|
48
|
+
* display: 'flex',
|
|
49
|
+
* justifyContent: 'center',
|
|
50
|
+
* alignItems: 'center',
|
|
51
|
+
* height: '150px',
|
|
52
|
+
* }}
|
|
53
|
+
* >
|
|
54
|
+
* Sidebar
|
|
55
|
+
* </div>
|
|
56
|
+
* </div>
|
|
57
|
+
* </VerticalSplit>
|
|
58
|
+
* </div>
|
|
59
|
+
* </Canvas>;
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* @example Resizable, right primary panel
|
|
63
|
+
*
|
|
64
|
+
* ```js
|
|
65
|
+
* <Canvas ctx={ctx}>
|
|
66
|
+
* <div style={{ height: 500, position: 'relative' }}>
|
|
67
|
+
* <VerticalSplit primaryPane="right" size="25%" minSize={220}>
|
|
68
|
+
* <div style={{ display: 'flex', flexDirection: 'column', height: '100%' }}>
|
|
69
|
+
* <Toolbar>
|
|
70
|
+
* <ToolbarStack stackSize="l">
|
|
71
|
+
* <ToolbarTitle>Secondary</ToolbarTitle>
|
|
72
|
+
* </ToolbarStack>
|
|
73
|
+
* </Toolbar>
|
|
74
|
+
* <div
|
|
75
|
+
* style={{
|
|
76
|
+
* flex: '1',
|
|
77
|
+
* display: 'flex',
|
|
78
|
+
* justifyContent: 'center',
|
|
79
|
+
* alignItems: 'center',
|
|
80
|
+
* height: '150px',
|
|
81
|
+
* }}
|
|
82
|
+
* >
|
|
83
|
+
* Sidebar
|
|
84
|
+
* </div>
|
|
85
|
+
* </div>
|
|
86
|
+
* <div style={{ display: 'flex', flexDirection: 'column', height: '100%', borderLeft: '1px solid var(--border-color)' }}>
|
|
87
|
+
* <Toolbar>
|
|
88
|
+
* <ToolbarStack stackSize="l">
|
|
89
|
+
* <ToolbarTitle>Primary</ToolbarTitle>
|
|
90
|
+
* </ToolbarStack>
|
|
91
|
+
* </Toolbar>
|
|
92
|
+
* <div
|
|
93
|
+
* style={{
|
|
94
|
+
* flex: '1',
|
|
95
|
+
* display: 'flex',
|
|
96
|
+
* justifyContent: 'center',
|
|
97
|
+
* alignItems: 'center',
|
|
98
|
+
* height: '150px',
|
|
99
|
+
* }}
|
|
100
|
+
* >
|
|
101
|
+
* Main content
|
|
102
|
+
* </div>
|
|
103
|
+
* </div>
|
|
104
|
+
* </VerticalSplit>
|
|
105
|
+
* </div>
|
|
106
|
+
* </Canvas>;
|
|
107
|
+
* ```
|
|
108
|
+
*
|
|
109
|
+
* @example Collapsible
|
|
110
|
+
*
|
|
111
|
+
* ```js
|
|
112
|
+
* <Canvas ctx={ctx}>
|
|
113
|
+
* <div style={{ height: 500, position: 'relative' }}>
|
|
114
|
+
* <StateManager initial={true}>
|
|
115
|
+
* {(isCollapsed, setCollapsed) => (
|
|
116
|
+
* <VerticalSplit
|
|
117
|
+
* primaryPane="left"
|
|
118
|
+
* size="25%"
|
|
119
|
+
* minSize={220}
|
|
120
|
+
* isSecondaryCollapsed={isCollapsed}
|
|
121
|
+
* onSecondaryToggle={setCollapsed}
|
|
122
|
+
* >
|
|
123
|
+
* <div style={{ display: 'flex', flexDirection: 'column', height: '100%' }}>
|
|
124
|
+
* <Toolbar>
|
|
125
|
+
* <ToolbarStack stackSize="l">
|
|
126
|
+
* <ToolbarTitle>Primary</ToolbarTitle>
|
|
127
|
+
* </ToolbarStack>
|
|
128
|
+
* </Toolbar>
|
|
129
|
+
* <div
|
|
130
|
+
* style={{
|
|
131
|
+
* flex: '1',
|
|
132
|
+
* display: 'flex',
|
|
133
|
+
* justifyContent: 'center',
|
|
134
|
+
* alignItems: 'center',
|
|
135
|
+
* height: '150px',
|
|
136
|
+
* }}
|
|
137
|
+
* >
|
|
138
|
+
* Main content
|
|
139
|
+
* </div>
|
|
140
|
+
* </div>
|
|
141
|
+
* <div
|
|
142
|
+
* style={{
|
|
143
|
+
* display: 'flex',
|
|
144
|
+
* flexDirection: 'column',
|
|
145
|
+
* height: '100%',
|
|
146
|
+
* borderLeft: '1px solid var(--border-color)',
|
|
147
|
+
* }}
|
|
148
|
+
* >
|
|
149
|
+
* <Toolbar>
|
|
150
|
+
* <ToolbarStack stackSize="l">
|
|
151
|
+
* <ToolbarTitle>Secondary</ToolbarTitle>
|
|
152
|
+
* </ToolbarStack>
|
|
153
|
+
* </Toolbar>
|
|
154
|
+
* <div
|
|
155
|
+
* style={{
|
|
156
|
+
* flex: '1',
|
|
157
|
+
* display: 'flex',
|
|
158
|
+
* justifyContent: 'center',
|
|
159
|
+
* alignItems: 'center',
|
|
160
|
+
* height: '150px',
|
|
161
|
+
* }}
|
|
162
|
+
* >
|
|
163
|
+
* Sidebar
|
|
164
|
+
* </div>
|
|
165
|
+
* </div>
|
|
166
|
+
* </VerticalSplit>
|
|
167
|
+
* )}
|
|
168
|
+
* </StateManager>
|
|
169
|
+
* </div>
|
|
170
|
+
* </Canvas>;
|
|
171
|
+
* ```
|
|
172
|
+
*
|
|
173
|
+
* @example Overlay mode
|
|
174
|
+
*
|
|
175
|
+
* ```js
|
|
176
|
+
* <Canvas ctx={ctx}>
|
|
177
|
+
* <div style={{ height: 500, position: 'relative' }}>
|
|
178
|
+
* <StateManager initial={true}>
|
|
179
|
+
* {(isCollapsed, setCollapsed) => (
|
|
180
|
+
* <VerticalSplit
|
|
181
|
+
* mode="overlay"
|
|
182
|
+
* primaryPane="left"
|
|
183
|
+
* size="25%"
|
|
184
|
+
* minSize={220}
|
|
185
|
+
* isSecondaryCollapsed={isCollapsed}
|
|
186
|
+
* onSecondaryToggle={setCollapsed}
|
|
187
|
+
* >
|
|
188
|
+
* <div style={{ display: 'flex', flexDirection: 'column', height: '100%' }}>
|
|
189
|
+
* <Toolbar>
|
|
190
|
+
* <ToolbarStack stackSize="l">
|
|
191
|
+
* <ToolbarTitle>Primary</ToolbarTitle>
|
|
192
|
+
* </ToolbarStack>
|
|
193
|
+
* </Toolbar>
|
|
194
|
+
* <div
|
|
195
|
+
* style={{
|
|
196
|
+
* flex: '1',
|
|
197
|
+
* display: 'flex',
|
|
198
|
+
* justifyContent: 'center',
|
|
199
|
+
* alignItems: 'center',
|
|
200
|
+
* height: '150px',
|
|
201
|
+
* }}
|
|
202
|
+
* >
|
|
203
|
+
* Main content
|
|
204
|
+
* </div>
|
|
205
|
+
* </div>
|
|
206
|
+
* <div
|
|
207
|
+
* style={{
|
|
208
|
+
* display: 'flex',
|
|
209
|
+
* flexDirection: 'column',
|
|
210
|
+
* height: '100%',
|
|
211
|
+
* borderLeft: '1px solid var(--border-color)',
|
|
212
|
+
* }}
|
|
213
|
+
* >
|
|
214
|
+
* <Toolbar>
|
|
215
|
+
* <ToolbarStack stackSize="l">
|
|
216
|
+
* <ToolbarTitle>Secondary</ToolbarTitle>
|
|
217
|
+
* </ToolbarStack>
|
|
218
|
+
* </Toolbar>
|
|
219
|
+
* <div
|
|
220
|
+
* style={{
|
|
221
|
+
* flex: '1',
|
|
222
|
+
* display: 'flex',
|
|
223
|
+
* justifyContent: 'center',
|
|
224
|
+
* alignItems: 'center',
|
|
225
|
+
* height: '150px',
|
|
226
|
+
* }}
|
|
227
|
+
* >
|
|
228
|
+
* Sidebar
|
|
229
|
+
* </div>
|
|
230
|
+
* </div>
|
|
231
|
+
* </VerticalSplit>
|
|
232
|
+
* )}
|
|
233
|
+
* </StateManager>
|
|
234
|
+
* </div>
|
|
235
|
+
* </Canvas>;
|
|
236
|
+
* ```
|
|
237
|
+
*/
|
|
238
|
+
export declare function VerticalSplit({ mode, minSize, maxSize, size, primaryPane, children, allowResize, onDragFinished, onSecondaryToggle, isSecondaryCollapsed, }: VerticalSplitProps): JSX.Element;
|
package/dist/types/icons.d.ts
CHANGED
|
@@ -10,3 +10,6 @@ export declare function SidebarLeftArrowIcon({ width, height, style, className,
|
|
|
10
10
|
export declare function SidebarRightArrowIcon({ width, height, style, className, }: IconProps): JSX.Element;
|
|
11
11
|
export declare function CaretDownIcon({ width, height, style, className, }: IconProps): JSX.Element;
|
|
12
12
|
export declare function CaretUpIcon({ width, height, style, className, }: IconProps): JSX.Element;
|
|
13
|
+
export declare function ChevronsLeftIcon({ width, height, style, className, }: IconProps): JSX.Element;
|
|
14
|
+
export declare function ChevronsRightIcon({ width, height, style, className, }: IconProps): JSX.Element;
|
|
15
|
+
export declare function SidebarFlipIcon({ width, height, style, className, }: IconProps): JSX.Element;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ export * from './Dropdown';
|
|
|
6
6
|
export * from './FieldError';
|
|
7
7
|
export * from './FieldGroup';
|
|
8
8
|
export * from './FieldHint';
|
|
9
|
-
export * from './Form';
|
|
10
9
|
export * from './FieldWrapper';
|
|
10
|
+
export * from './Form';
|
|
11
11
|
export * from './FormLabel';
|
|
12
12
|
export * from './icons';
|
|
13
13
|
export * from './Section';
|
|
@@ -15,12 +15,14 @@ export * from './SelectField';
|
|
|
15
15
|
export * from './SelectInput';
|
|
16
16
|
export * from './SidebarPanel';
|
|
17
17
|
export * from './Spinner';
|
|
18
|
+
export * from './SplitView';
|
|
18
19
|
export * from './SwitchField';
|
|
19
20
|
export * from './SwitchInput';
|
|
20
|
-
export * from './TextField';
|
|
21
|
-
export * from './TextInput';
|
|
22
21
|
export * from './TextareaField';
|
|
23
22
|
export * from './TextareaInput';
|
|
23
|
+
export * from './TextField';
|
|
24
|
+
export * from './TextInput';
|
|
24
25
|
export * from './Toolbar';
|
|
25
26
|
export * from './useClickOutside';
|
|
26
27
|
export * from './useMediaQuery';
|
|
28
|
+
export * from './VerticalSplit';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "datocms-react-ui",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.14",
|
|
4
4
|
"description": "React components to use inside DatoCMS plugins",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"datocms",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"classnames": "^2.3.1",
|
|
44
|
-
"datocms-plugin-sdk": "^2.0.
|
|
44
|
+
"datocms-plugin-sdk": "^2.0.13",
|
|
45
45
|
"react-intersection-observer": "^8.31.0",
|
|
46
46
|
"react-select": "^5.2.1",
|
|
47
47
|
"scroll-into-view-if-needed": "^2.2.20"
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"postcss-nested": "^5.0.6",
|
|
58
58
|
"typedoc": "^0.26.7"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "c5d75e63e19512c2f5a1cf317890351ee0b7b267"
|
|
61
61
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from 'react';
|
|
2
|
+
import s from './styles.module.css.json';
|
|
3
|
+
|
|
4
|
+
export type SplitViewPaneProps = {
|
|
5
|
+
maxSize?: number | string;
|
|
6
|
+
minSize?: number | string;
|
|
7
|
+
style?: React.CSSProperties;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export function SplitViewPane({
|
|
11
|
+
style,
|
|
12
|
+
children,
|
|
13
|
+
}: PropsWithChildren<SplitViewPaneProps>) {
|
|
14
|
+
return (
|
|
15
|
+
<div className={s.SplitViewPane} style={style}>
|
|
16
|
+
{children}
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"SplitViewPane":"_SplitViewPane_1cl1f_1"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
import React, { ReactNode, useState } from 'react';
|
|
3
|
+
import s from './styles.module.css.json';
|
|
4
|
+
|
|
5
|
+
export type SashAction = {
|
|
6
|
+
icon: ReactNode;
|
|
7
|
+
onClick: () => void;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
type SplitViewSashProps = {
|
|
11
|
+
className?: string;
|
|
12
|
+
style: React.CSSProperties;
|
|
13
|
+
split: 'vertical' | 'horizontal';
|
|
14
|
+
allowResize?: boolean;
|
|
15
|
+
action?: SashAction;
|
|
16
|
+
onMouseDown: (x: number, y: number) => void;
|
|
17
|
+
onMouseMove: (x: number, y: number) => void;
|
|
18
|
+
onMouseUp: () => void;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export function SplitViewSash({
|
|
22
|
+
onMouseDown,
|
|
23
|
+
onMouseMove,
|
|
24
|
+
onMouseUp,
|
|
25
|
+
style,
|
|
26
|
+
split,
|
|
27
|
+
allowResize,
|
|
28
|
+
action,
|
|
29
|
+
}: SplitViewSashProps) {
|
|
30
|
+
const [dragging, setDrag] = useState(false);
|
|
31
|
+
|
|
32
|
+
function handleMouseMove(e: MouseEvent) {
|
|
33
|
+
onMouseMove(e.pageX, e.pageY);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function handleMouseUp() {
|
|
37
|
+
setDrag(false);
|
|
38
|
+
onMouseUp();
|
|
39
|
+
window.removeEventListener('mousemove', handleMouseMove);
|
|
40
|
+
window.removeEventListener('mouseup', handleMouseUp);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function handleTouchMove(e: TouchEvent) {
|
|
44
|
+
onMouseMove(e.touches[0].pageX, e.touches[0].pageY);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function handleTouchEnd() {
|
|
48
|
+
setDrag(false);
|
|
49
|
+
onMouseUp();
|
|
50
|
+
window.removeEventListener('touchmove', handleTouchMove);
|
|
51
|
+
window.removeEventListener('touchend', handleTouchEnd);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const actionEl = action?.icon && (
|
|
55
|
+
<div
|
|
56
|
+
className={s.SplitViewSash__content}
|
|
57
|
+
onMouseDown={(e) => {
|
|
58
|
+
e.stopPropagation();
|
|
59
|
+
}}
|
|
60
|
+
onClick={() => {
|
|
61
|
+
action.onClick();
|
|
62
|
+
}}
|
|
63
|
+
>
|
|
64
|
+
<div className={s.SplitViewSash__content__button}>{action?.icon}</div>
|
|
65
|
+
</div>
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<div
|
|
70
|
+
role="Resizer"
|
|
71
|
+
className={classNames(
|
|
72
|
+
s.SplitViewSash,
|
|
73
|
+
split === 'vertical'
|
|
74
|
+
? s['SplitViewSash--vertical']
|
|
75
|
+
: s['SplitViewSash--horizontal'],
|
|
76
|
+
!allowResize && s['SplitViewSash--no-resize'],
|
|
77
|
+
dragging && s['SplitViewSash--dragging'],
|
|
78
|
+
)}
|
|
79
|
+
onMouseDown={(e) => {
|
|
80
|
+
setDrag(true);
|
|
81
|
+
onMouseDown(e.pageX, e.pageY);
|
|
82
|
+
|
|
83
|
+
window.addEventListener('mousemove', handleMouseMove);
|
|
84
|
+
window.addEventListener('mouseup', handleMouseUp);
|
|
85
|
+
}}
|
|
86
|
+
onTouchStart={(e) => {
|
|
87
|
+
e.preventDefault();
|
|
88
|
+
setDrag(true);
|
|
89
|
+
onMouseDown(e.touches[0].pageX, e.touches[0].pageY);
|
|
90
|
+
|
|
91
|
+
window.addEventListener('touchmove', handleTouchMove);
|
|
92
|
+
window.addEventListener('touchend', handleTouchEnd);
|
|
93
|
+
}}
|
|
94
|
+
style={style}
|
|
95
|
+
>
|
|
96
|
+
{actionEl}
|
|
97
|
+
</div>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
.SplitViewSash {
|
|
2
|
+
height: 100%;
|
|
3
|
+
position: absolute;
|
|
4
|
+
top: 0;
|
|
5
|
+
transition: background-color 0.2s 0.15s;
|
|
6
|
+
background-color: rgba(var(--light-color-components), 0);
|
|
7
|
+
width: 100%;
|
|
8
|
+
z-index: 2;
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.SplitViewSash:hover,
|
|
15
|
+
.SplitViewSash--dragging {
|
|
16
|
+
background-color: var(--light-color);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.SplitViewSash:hover:has(.SplitViewSash__content:hover),
|
|
20
|
+
.SplitViewSash--dragging:has(.SplitViewSash__content:hover) {
|
|
21
|
+
background-color: transparent;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.SplitViewSash--no-resize {
|
|
25
|
+
pointer-events: none;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.SplitViewSash--vertical {
|
|
29
|
+
cursor: col-resize;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.SplitViewSash--horizontal {
|
|
33
|
+
cursor: row-resize;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.SplitViewSash__content {
|
|
37
|
+
position: absolute;
|
|
38
|
+
top: 50%;
|
|
39
|
+
left: 50%;
|
|
40
|
+
transform: translate(-50%, -50%);
|
|
41
|
+
padding: 15px 0;
|
|
42
|
+
cursor: pointer;
|
|
43
|
+
pointer-events: auto;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.SplitViewSash__content__button {
|
|
47
|
+
width: 20px;
|
|
48
|
+
height: 20px;
|
|
49
|
+
border-radius: 6px;
|
|
50
|
+
border: 1px solid var(--border-color);
|
|
51
|
+
background: white;
|
|
52
|
+
z-index: 2;
|
|
53
|
+
display: flex;
|
|
54
|
+
align-items: center;
|
|
55
|
+
justify-content: center;
|
|
56
|
+
font-size: 10px;
|
|
57
|
+
color: var(--light-body-color);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.SplitViewSash__content__button svg {
|
|
61
|
+
display: block;
|
|
62
|
+
fill: currentColor;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.SplitViewSash__content:hover .SplitViewSash__content__button {
|
|
66
|
+
background: var(--light-bg-color);
|
|
67
|
+
color: var(--base-body-color);
|
|
68
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"SplitViewSash":"_SplitViewSash_tds51_1","SplitViewSash--dragging":"_SplitViewSash--dragging_tds51_15","SplitViewSash__content":"_SplitViewSash__content_tds51_19","SplitViewSash--no-resize":"_SplitViewSash--no-resize_tds51_24","SplitViewSash--vertical":"_SplitViewSash--vertical_tds51_28","SplitViewSash--horizontal":"_SplitViewSash--horizontal_tds51_32","SplitViewSash__content__button":"_SplitViewSash__content__button_tds51_46"}
|