@calenderjs/react 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/README.md ADDED
@@ -0,0 +1,397 @@
1
+ # @calenderjs/react
2
+
3
+ React wrapper for `@calenderjs/calendar` Web Component.
4
+
5
+ ## 安装
6
+
7
+ ```bash
8
+ pnpm add @calenderjs/react @calenderjs/calendar @monaco-editor/react
9
+ ```
10
+
11
+ **注意**: `@monaco-editor/react` 是 peer dependency,如果使用 `EventEditor` 组件则需要安装。
12
+
13
+ ## 使用方式
14
+
15
+ ### 基础使用
16
+
17
+ ```tsx
18
+ import { Calendar } from '@calenderjs/react';
19
+
20
+ function App() {
21
+ return (
22
+ <Calendar
23
+ view="month"
24
+ date="2024-12-30"
25
+ />
26
+ );
27
+ }
28
+ ```
29
+
30
+ ### 使用事件回调
31
+
32
+ ```tsx
33
+ import { Calendar } from '@calenderjs/react';
34
+
35
+ function App() {
36
+ const handleDateChange = (e: CustomEvent<{ date: Date }>) => {
37
+ console.log('Date changed:', e.detail.date);
38
+ };
39
+
40
+ const handleViewChange = (e: CustomEvent<{ view: 'month' | 'week' | 'day' }>) => {
41
+ console.log('View changed:', e.detail.view);
42
+ };
43
+
44
+ return (
45
+ <Calendar
46
+ view="month"
47
+ date={new Date()}
48
+ onDateChange={handleDateChange}
49
+ onViewChange={handleViewChange}
50
+ />
51
+ );
52
+ }
53
+ ```
54
+
55
+ ### 使用 ref 控制组件
56
+
57
+ ```tsx
58
+ import { Calendar, CalendarRef } from '@calenderjs/react';
59
+ import { useRef } from 'react';
60
+
61
+ function App() {
62
+ const calendarRef = useRef<CalendarRef>(null);
63
+
64
+ const handleGoToToday = () => {
65
+ calendarRef.current?.goToToday();
66
+ };
67
+
68
+ const handleSetView = (view: 'month' | 'week' | 'day') => {
69
+ calendarRef.current?.setView(view);
70
+ };
71
+
72
+ return (
73
+ <div>
74
+ <button onClick={handleGoToToday}>今天</button>
75
+ <button onClick={() => handleSetView('week')}>周视图</button>
76
+ <Calendar ref={calendarRef} />
77
+ </div>
78
+ );
79
+ }
80
+ ```
81
+
82
+ ### 设置事件数据
83
+
84
+ ```tsx
85
+ import { Calendar } from '@calenderjs/react';
86
+ import type { Event } from '@calenderjs/event-model';
87
+
88
+ function App() {
89
+ const events: Event[] = [
90
+ {
91
+ id: '1',
92
+ type: 'meeting',
93
+ title: '团队会议',
94
+ startTime: new Date('2024-12-30T10:00:00'),
95
+ endTime: new Date('2024-12-30T11:00:00'),
96
+ data: {},
97
+ },
98
+ ];
99
+
100
+ return (
101
+ <Calendar
102
+ view="month"
103
+ events={events}
104
+ />
105
+ );
106
+ }
107
+ ```
108
+
109
+ ## EventEditor 组件
110
+
111
+ `EventEditor` 是一个基于 Monaco Editor 的 Event DSL 专用编辑器组件,提供语法高亮、自动完成等功能。
112
+
113
+ ### 基础使用
114
+
115
+ ```tsx
116
+ import { EventEditor } from '@calenderjs/react';
117
+ import { Editor } from '@monaco-editor/react';
118
+ import { useState } from 'react';
119
+
120
+ function App() {
121
+ const [dsl, setDsl] = useState('type: meeting\nname: "团队会议"');
122
+
123
+ return (
124
+ <EventEditor
125
+ EditorComponent={Editor}
126
+ value={dsl}
127
+ onChange={setDsl}
128
+ height="100%"
129
+ darkMode={false}
130
+ />
131
+ );
132
+ }
133
+ ```
134
+
135
+ **注意**: `EventEditor` 是一个标准 React 组件,需要用户自己导入 `Editor` 组件并传入 `EditorComponent` prop。
136
+
137
+ ### 与 Calendar 结合使用
138
+
139
+ ```tsx
140
+ import { EventEditor, Calendar, ResizableSplitter } from '@calenderjs/react';
141
+ import { Editor } from '@monaco-editor/react';
142
+ import { useState } from 'react';
143
+
144
+ function App() {
145
+ const [dsl, setDsl] = useState('type: meeting\nname: "会议"');
146
+
147
+ return (
148
+ <ResizableSplitter
149
+ left={
150
+ <div style={{ padding: '20px' }}>
151
+ <h2>Event DSL 编辑器</h2>
152
+ <EventEditor
153
+ EditorComponent={Editor}
154
+ value={dsl}
155
+ onChange={setDsl}
156
+ height="calc(100% - 60px)"
157
+ darkMode={false}
158
+ />
159
+ </div>
160
+ }
161
+ right={
162
+ <div style={{ padding: '20px' }}>
163
+ <h2>日历</h2>
164
+ <Calendar view="month" />
165
+ </div>
166
+ }
167
+ />
168
+ );
169
+ }
170
+ ```
171
+
172
+ ### EventEditor Props
173
+
174
+ | 属性 | 类型 | 默认值 | 说明 |
175
+ |------|------|--------|------|
176
+ | `EditorComponent` | `React.ComponentType<EditorProps>` | - | Monaco Editor 组件(必需,从 `@monaco-editor/react` 导入) |
177
+ | `value` | `string` | `""` | Event DSL 代码内容 |
178
+ | `onChange` | `(value: string \| undefined) => void` | - | 代码变化时的回调 |
179
+ | `height` | `string \| number` | `"100%"` | 编辑器高度 |
180
+ | `darkMode` | `boolean` | `false` | 是否使用暗色主题 |
181
+ | `className` | `string` | `""` | 自定义 CSS 类名 |
182
+ | `style` | `React.CSSProperties` | - | 自定义样式 |
183
+ | `options` | `editor.IStandaloneEditorConstructionOptions` | - | Monaco Editor 选项(会与默认选项合并) |
184
+ | `onMount` | `(editor, monaco) => void` | - | 编辑器挂载时的回调 |
185
+
186
+ ### 默认编辑器选项
187
+
188
+ EventEditor 提供以下默认配置:
189
+
190
+ - `minimap: { enabled: false }` - 禁用小地图
191
+ - `fontSize: 14` - 字体大小 14px
192
+ - `wordWrap: "on"` - 启用自动换行
193
+ - `lineNumbers: "on"` - 显示行号
194
+ - `scrollBeyondLastLine: false` - 不滚动到最后一行之后
195
+ - `suggestOnTriggerCharacters: true` - 触发字符时显示建议
196
+ - `quickSuggestions: true` - 快速建议
197
+ - `tabSize: 2` - Tab 大小为 2 个空格
198
+ - `autoIndent: "full"` - 完整自动缩进
199
+
200
+ 可以通过 `options` 属性覆盖这些默认值。
201
+
202
+ ### EventEditor CSS 变量
203
+
204
+ 组件使用 CSS 变量来支持主题定制,所有变量都使用 `--event-editor-` 前缀:
205
+
206
+ ```css
207
+ :root {
208
+ /* 编辑器容器 */
209
+ --event-editor-bg-color: #fff; /* 浅色模式背景色 */
210
+ --event-editor-bg-color-dark: #1e1e1e; /* 暗色模式背景色 */
211
+ }
212
+ ```
213
+
214
+ ### 暗色模式示例
215
+
216
+ ```css
217
+ .dark-mode {
218
+ --event-editor-bg-color-dark: #1e1e1e;
219
+ }
220
+ ```
221
+
222
+ ## ResizableSplitter 组件
223
+
224
+ `ResizableSplitter` 是一个通用的可调整大小的分割面板组件,可用于创建可拖拽调整的左右分栏布局。
225
+
226
+ ### 基础使用
227
+
228
+ ```tsx
229
+ import { ResizableSplitter } from '@calenderjs/react';
230
+
231
+ function App() {
232
+ return (
233
+ <ResizableSplitter
234
+ left={<div>左侧内容</div>}
235
+ right={<div>右侧内容</div>}
236
+ initialLeftWidth={40}
237
+ minLeftWidth={20}
238
+ maxLeftWidth={80}
239
+ />
240
+ );
241
+ }
242
+ ```
243
+
244
+ ### 与 Calendar 结合使用
245
+
246
+ ```tsx
247
+ import { ResizableSplitter, Calendar } from '@calenderjs/react';
248
+
249
+ function App() {
250
+ return (
251
+ <ResizableSplitter
252
+ left={
253
+ <div style={{ padding: '20px' }}>
254
+ <h2>编辑器</h2>
255
+ <textarea style={{ width: '100%', height: '100%' }} />
256
+ </div>
257
+ }
258
+ right={
259
+ <div style={{ padding: '20px' }}>
260
+ <h2>日历</h2>
261
+ <Calendar view="month" />
262
+ </div>
263
+ }
264
+ initialLeftWidth={50}
265
+ minLeftWidth={30}
266
+ maxLeftWidth={70}
267
+ />
268
+ );
269
+ }
270
+ ```
271
+
272
+ ## API
273
+
274
+ ### Calendar Props
275
+
276
+ | 属性 | 类型 | 默认值 | 说明 |
277
+ |------|------|--------|------|
278
+ | `view` | `'month' \| 'week' \| 'day'` | `'month'` | 初始视图 |
279
+ | `date` | `string \| Date` | 当前日期 | 初始日期 |
280
+ | `events` | `Event[]` | `[]` | 事件列表(数据模型) |
281
+ | `user` | `any` | `undefined` | 当前用户 |
282
+ | `onDateChange` | `(e: CustomEvent<{ date: Date }>) => void` | - | 日期变化回调 |
283
+ | `onViewChange` | `(e: CustomEvent<{ view: 'month' \| 'week' \| 'day' }>) => void` | - | 视图切换回调 |
284
+ | `className` | `string` | - | CSS 类名 |
285
+ | `style` | `React.CSSProperties` | - | 内联样式 |
286
+
287
+ ### CalendarRef
288
+
289
+ | 方法 | 说明 |
290
+ |------|------|
291
+ | `getElement()` | 获取底层的 Web Component 实例 |
292
+ | `setView(view)` | 设置当前视图 |
293
+ | `setDate(date)` | 设置当前日期 |
294
+ | `goToToday()` | 跳转到今天 |
295
+
296
+ ### ResizableSplitter Props
297
+
298
+ | 属性 | 类型 | 默认值 | 说明 |
299
+ |------|------|--------|------|
300
+ | `left` | `React.ReactNode` | - | 左侧面板内容(必需) |
301
+ | `right` | `React.ReactNode` | - | 右侧面板内容(必需) |
302
+ | `initialLeftWidth` | `number` | `40` | 初始左侧面板宽度(百分比,0-100) |
303
+ | `minLeftWidth` | `number` | `20` | 左侧面板最小宽度(百分比) |
304
+ | `maxLeftWidth` | `number` | `80` | 左侧面板最大宽度(百分比) |
305
+ | `className` | `string` | `""` | 自定义 CSS 类名 |
306
+
307
+ ## CSS 变量自定义
308
+
309
+ 所有组件都支持通过 CSS 变量进行自定义。Calendar 组件使用 `--calender-` 前缀,ResizableSplitter 组件使用 `--resizable-splitter-` 前缀。
310
+
311
+ ### Calendar CSS 变量
312
+
313
+ Calendar 组件支持大量 CSS 变量来自定义外观。主要变量包括:
314
+
315
+ ```css
316
+ :root {
317
+ /* 基础颜色 */
318
+ --calender-bg-color: #fff;
319
+ --calender-text-color: #202124;
320
+ --calender-primary-color: #1a73e8;
321
+
322
+ /* 状态颜色 */
323
+ --calender-today-bg-color: #e8f0fe;
324
+ --calender-selected-bg-color: #e8f0fe;
325
+ --calender-hover-bg-color: #f1f3f4;
326
+
327
+ /* 边框 */
328
+ --calender-border-color: #dadce0;
329
+ --calender-border-radius: 4px;
330
+
331
+ /* 字体 */
332
+ --calender-font-family: 'Google Sans', Roboto, Arial, sans-serif;
333
+ --calender-font-size: 14px;
334
+
335
+ /* 尺寸 */
336
+ --calender-month-cell-min-height: 100px;
337
+ --calender-hour-cell-height: 48px;
338
+
339
+ /* 过渡 */
340
+ --calender-transition-duration: 0.2s;
341
+ }
342
+ ```
343
+
344
+ 完整的 CSS 变量列表请参考 `@calenderjs/calendar` 包的 `CSS_VARIABLES.md` 文档。
345
+
346
+ ### ResizableSplitter CSS 变量
347
+
348
+ 组件使用 CSS 变量来支持主题定制,所有变量都使用 `--resizable-splitter-` 前缀:
349
+
350
+ ```css
351
+ :root {
352
+ /* 分割器主体 */
353
+ --resizable-splitter-width: 4px; /* 分割器宽度 */
354
+ --resizable-splitter-bg-color: #ddd; /* 分割器背景色 */
355
+ --resizable-splitter-hover-bg-color: #bbb; /* 分割器悬停背景色 */
356
+ --resizable-splitter-transition: background-color 0.2s; /* 过渡效果 */
357
+
358
+ /* 分割器手柄 */
359
+ --resizable-splitter-handle-width: 20px; /* 手柄宽度 */
360
+ --resizable-splitter-handle-height: 40px; /* 手柄高度 */
361
+ --resizable-splitter-handle-border-radius: 4px; /* 手柄圆角 */
362
+ --resizable-splitter-handle-bg-color: rgba(0,0,0,0.1); /* 手柄背景色 */
363
+
364
+ /* 分割器圆点 */
365
+ --resizable-splitter-dot-size: 3px; /* 圆点大小 */
366
+ --resizable-splitter-dot-color: #999; /* 圆点颜色 */
367
+ --resizable-splitter-dot-gap: 2px; /* 圆点间距 */
368
+ }
369
+ ```
370
+
371
+ ### 暗色模式示例
372
+
373
+ ```css
374
+ .dark-mode {
375
+ /* Calendar 暗色模式 */
376
+ --calender-bg-color: #1e1e1e;
377
+ --calender-text-color: #e0e0e0;
378
+ --calender-border-color: #3a3a3a;
379
+ --calender-primary-color: #4285f4;
380
+ --calender-today-bg-color: #1a3a5a;
381
+ --calender-hover-bg-color: #2a2a2a;
382
+
383
+ /* ResizableSplitter 暗色模式 */
384
+ --resizable-splitter-bg-color: #333;
385
+ --resizable-splitter-hover-bg-color: #555;
386
+ --resizable-splitter-handle-bg-color: rgba(255,255,255,0.1);
387
+ --resizable-splitter-dot-color: #ccc;
388
+ }
389
+ ```
390
+
391
+ ## 注意事项
392
+
393
+ 1. 确保已安装 `@calenderjs/calendar` 包
394
+ 2. Web Component 会自动注册,无需手动注册
395
+ 3. 组件是纯数据驱动的,只处理数据模型,不涉及 DSL
396
+ 4. `ResizableSplitter` 是一个纯 React 组件,不依赖 Web Components
397
+ 5. 所有组件都支持通过 CSS 变量进行主题自定义
@@ -0,0 +1,92 @@
1
+ import { default as React } from 'react';
2
+ import { Event } from '@calenderjs/event-model';
3
+ declare global {
4
+ namespace JSX {
5
+ interface IntrinsicElements {
6
+ "wsx-calendar": React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement> & {
7
+ view?: "month" | "week" | "day";
8
+ date?: string;
9
+ }, HTMLElement> & {
10
+ events?: Event[];
11
+ user?: any;
12
+ };
13
+ }
14
+ }
15
+ }
16
+ /**
17
+ * Calendar 组件的属性
18
+ */
19
+ export interface CalendarProps {
20
+ /**
21
+ * 初始视图(month | week | day)
22
+ */
23
+ view?: "month" | "week" | "day";
24
+ /**
25
+ * 初始日期(ISO 8601 字符串或 Date 对象)
26
+ */
27
+ date?: string | Date;
28
+ /**
29
+ * 事件列表(数据模型)
30
+ */
31
+ events?: Event[];
32
+ /**
33
+ * 当前用户
34
+ */
35
+ user?: any;
36
+ /**
37
+ * 日期变化时的回调
38
+ */
39
+ onDateChange?: (event: CustomEvent<{
40
+ date: Date;
41
+ }>) => void;
42
+ /**
43
+ * 视图切换时的回调
44
+ */
45
+ onViewChange?: (event: CustomEvent<{
46
+ view: "month" | "week" | "day";
47
+ }>) => void;
48
+ /**
49
+ * 事件点击时的回调
50
+ */
51
+ onEventClick?: (event: CustomEvent<{
52
+ event: Event;
53
+ }>) => void;
54
+ /**
55
+ * 日期双击时的回调
56
+ */
57
+ onDateDoubleClick?: (event: CustomEvent<{
58
+ date: Date;
59
+ }>) => void;
60
+ /**
61
+ * 其他 HTML 属性
62
+ */
63
+ className?: string;
64
+ style?: React.CSSProperties;
65
+ [key: string]: any;
66
+ }
67
+ /**
68
+ * Calendar 组件的引用类型
69
+ */
70
+ export interface CalendarRef {
71
+ /**
72
+ * 获取底层的 Web Component 实例
73
+ */
74
+ getElement: () => HTMLElement | null;
75
+ /**
76
+ * 设置当前视图
77
+ */
78
+ setView: (view: "month" | "week" | "day") => void;
79
+ /**
80
+ * 设置当前日期
81
+ */
82
+ setDate: (date: Date | string) => void;
83
+ /**
84
+ * 跳转到今天
85
+ */
86
+ goToToday: () => void;
87
+ }
88
+ /**
89
+ * Calendar React 组件
90
+ */
91
+ export declare const Calendar: React.ForwardRefExoticComponent<Omit<CalendarProps, "ref"> & React.RefAttributes<CalendarRef>>;
92
+ //# sourceMappingURL=Calendar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Calendar.d.ts","sourceRoot":"","sources":["../src/Calendar.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAMN,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAarD,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,GAAG,CAAC;QACV,UAAU,iBAAiB;YACvB,cAAc,EAAE,KAAK,CAAC,iBAAiB,CACnC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,GAAG;gBAChC,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC;gBAChC,IAAI,CAAC,EAAE,MAAM,CAAC;aACjB,EACD,WAAW,CACd,GAAG;gBACA,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;gBACjB,IAAI,CAAC,EAAE,GAAG,CAAC;aACd,CAAC;SACL;KACJ;CACJ;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC1B;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC;IAEhC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAErB;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;IAEjB;;OAEG;IACH,IAAI,CAAC,EAAE,GAAG,CAAC;IAEX;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC;QAAE,IAAI,EAAE,IAAI,CAAA;KAAE,CAAC,KAAK,IAAI,CAAC;IAE5D;;OAEG;IACH,YAAY,CAAC,EAAE,CACX,KAAK,EAAE,WAAW,CAAC;QAAE,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,KAAK,CAAA;KAAE,CAAC,KACrD,IAAI,CAAC;IAEV;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC;QAAE,KAAK,EAAE,KAAK,CAAA;KAAE,CAAC,KAAK,IAAI,CAAC;IAE9D;;OAEG;IACH,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC;QAAE,IAAI,EAAE,IAAI,CAAA;KAAE,CAAC,KAAK,IAAI,CAAC;IAEjE;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IACxB;;OAEG;IACH,UAAU,EAAE,MAAM,WAAW,GAAG,IAAI,CAAC;IAErC;;OAEG;IACH,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,KAAK,KAAK,IAAI,CAAC;IAElD;;OAEG;IACH,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,KAAK,IAAI,CAAC;IAEvC;;OAEG;IACH,SAAS,EAAE,MAAM,IAAI,CAAC;CACzB;AAED;;GAEG;AACH,eAAO,MAAM,QAAQ,gGAkJpB,CAAC"}
@@ -0,0 +1,52 @@
1
+ import { editor } from 'monaco-editor';
2
+ import { EditorProps } from '@monaco-editor/react';
3
+ export interface EventEditorProps {
4
+ /** Event DSL 代码内容 */
5
+ value?: string;
6
+ /** 代码变化时的回调 */
7
+ onChange?: (value: string | undefined) => void;
8
+ /** 编辑器高度 */
9
+ height?: string | number;
10
+ /** 是否使用暗色主题 */
11
+ darkMode?: boolean;
12
+ /** 自定义 CSS 类名 */
13
+ className?: string;
14
+ /** 自定义样式 */
15
+ style?: React.CSSProperties;
16
+ /** Monaco Editor 选项 */
17
+ options?: editor.IStandaloneEditorConstructionOptions;
18
+ /** 编辑器挂载时的回调 */
19
+ onMount?: (editor: editor.IStandaloneCodeEditor, monaco: typeof import("monaco-editor")) => void;
20
+ /** Monaco Editor 组件(由用户传入) */
21
+ EditorComponent: React.ComponentType<EditorProps>;
22
+ }
23
+ /**
24
+ * EventEditor - Event DSL 编辑器组件
25
+ *
26
+ * 基于 Monaco Editor 的 Event DSL 专用编辑器,提供语法高亮、自动完成等功能。
27
+ *
28
+ * **注意**: 这是一个标准 React 组件,需要用户自己导入并传入 `EditorComponent`。
29
+ *
30
+ * @example
31
+ * ```tsx
32
+ * import { EventEditor } from '@calenderjs/react';
33
+ * import { Editor } from '@monaco-editor/react';
34
+ * import { useState } from 'react';
35
+ *
36
+ * function App() {
37
+ * const [dsl, setDsl] = useState('type: meeting\nname: "会议"');
38
+ *
39
+ * return (
40
+ * <EventEditor
41
+ * EditorComponent={Editor}
42
+ * value={dsl}
43
+ * onChange={setDsl}
44
+ * height="100%"
45
+ * darkMode={false}
46
+ * />
47
+ * );
48
+ * }
49
+ * ```
50
+ */
51
+ export default function EventEditor({ value, onChange, height, darkMode, className, style, options, onMount, EditorComponent, }: EventEditorProps): import("react/jsx-runtime").JSX.Element;
52
+ //# sourceMappingURL=EventEditor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EventEditor.d.ts","sourceRoot":"","sources":["../../src/components/EventEditor.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,MAAM,WAAW,gBAAgB;IAC7B,qBAAqB;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe;IACf,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IAC/C,YAAY;IACZ,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,eAAe;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iBAAiB;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY;IACZ,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,uBAAuB;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC,oCAAoC,CAAC;IACtD,gBAAgB;IAChB,OAAO,CAAC,EAAE,CACN,MAAM,EAAE,MAAM,CAAC,qBAAqB,EACpC,MAAM,EAAE,cAAc,eAAe,CAAC,KACrC,IAAI,CAAC;IACV,8BAA8B;IAC9B,eAAe,EAAE,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;CACrD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAChC,KAAU,EACV,QAAQ,EACR,MAAe,EACf,QAAgB,EAChB,SAAc,EACd,KAAK,EACL,OAAO,EACP,OAAO,EACP,eAAe,GAClB,EAAE,gBAAgB,2CAqDlB"}
@@ -0,0 +1,38 @@
1
+ export interface ResizableSplitterProps {
2
+ /** 左侧面板内容 */
3
+ left: React.ReactNode;
4
+ /** 右侧面板内容 */
5
+ right: React.ReactNode;
6
+ /** 初始左侧面板宽度(百分比,0-100) */
7
+ initialLeftWidth?: number;
8
+ /** 左侧面板最小宽度(百分比) */
9
+ minLeftWidth?: number;
10
+ /** 左侧面板最大宽度(百分比) */
11
+ maxLeftWidth?: number;
12
+ /** 自定义 CSS 类名 */
13
+ className?: string;
14
+ }
15
+ /**
16
+ * ResizableSplitter - 可调整大小的分割面板组件
17
+ *
18
+ * 提供一个可拖拽的分割器,允许用户调整左右两个面板的宽度。
19
+ *
20
+ * @example
21
+ * ```tsx
22
+ * import { ResizableSplitter } from '@calenderjs/react';
23
+ *
24
+ * function App() {
25
+ * return (
26
+ * <ResizableSplitter
27
+ * left={<div>左侧内容</div>}
28
+ * right={<div>右侧内容</div>}
29
+ * initialLeftWidth={40}
30
+ * minLeftWidth={20}
31
+ * maxLeftWidth={80}
32
+ * />
33
+ * );
34
+ * }
35
+ * ```
36
+ */
37
+ export default function ResizableSplitter({ left, right, initialLeftWidth, minLeftWidth, maxLeftWidth, className, }: ResizableSplitterProps): import("react/jsx-runtime").JSX.Element;
38
+ //# sourceMappingURL=ResizableSplitter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResizableSplitter.d.ts","sourceRoot":"","sources":["../../src/components/ResizableSplitter.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,sBAAsB;IACnC,aAAa;IACb,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;IACtB,aAAa;IACb,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,0BAA0B;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,oBAAoB;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oBAAoB;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACtC,IAAI,EACJ,KAAK,EACL,gBAAqB,EACrB,YAAiB,EACjB,YAAiB,EACjB,SAAc,GACjB,EAAE,sBAAsB,2CA6KxB"}