@react-devtools-plus/ui 0.2.0

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.
@@ -0,0 +1,664 @@
1
+ import { ButtonHTMLAttributes } from 'react';
2
+ import { CSSProperties } from 'react';
3
+ import { FC } from 'react';
4
+ import { ForwardRefExoticComponent } from 'react';
5
+ import { InputHTMLAttributes } from 'react';
6
+ import { ReactNode } from 'react';
7
+ import { RefAttributes } from 'react';
8
+ import { SelectHTMLAttributes } from 'react';
9
+
10
+ /**
11
+ * Apply theme to DOM
12
+ * 将主题应用到DOM
13
+ */
14
+ export declare function applyTheme(theme: Theme): void;
15
+
16
+ export declare const Badge: FC<BadgeProps>;
17
+
18
+ export declare interface BadgeProps {
19
+ /**
20
+ * Badge content
21
+ */
22
+ children?: ReactNode;
23
+ /**
24
+ * Badge count or text
25
+ */
26
+ count?: number | string;
27
+ /**
28
+ * Show dot instead of count
29
+ * @default false
30
+ */
31
+ dot?: boolean;
32
+ /**
33
+ * Max count to display
34
+ * @default 99
35
+ */
36
+ max?: number;
37
+ /**
38
+ * Badge color
39
+ * @default 'primary'
40
+ */
41
+ color?: 'primary' | 'success' | 'warning' | 'error' | 'info' | 'neutral';
42
+ /**
43
+ * Badge size
44
+ * @default 'md'
45
+ */
46
+ size?: 'sm' | 'md' | 'lg';
47
+ /**
48
+ * Show zero count
49
+ * @default false
50
+ */
51
+ showZero?: boolean;
52
+ /**
53
+ * Additional CSS class
54
+ */
55
+ className?: string;
56
+ /**
57
+ * Custom styles
58
+ */
59
+ style?: CSSProperties;
60
+ }
61
+
62
+ /**
63
+ * Design tokens for border radius
64
+ * 圆角设计令牌
65
+ */
66
+ export declare const borderRadius: {
67
+ none: string;
68
+ sm: string;
69
+ base: string;
70
+ md: string;
71
+ lg: string;
72
+ xl: string;
73
+ '2xl': string;
74
+ '3xl': string;
75
+ full: string;
76
+ };
77
+
78
+ export declare const Button: FC<ButtonProps>;
79
+
80
+ export declare interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'type'> {
81
+ /**
82
+ * Button content
83
+ */
84
+ children?: ReactNode;
85
+ /**
86
+ * Button type
87
+ * @default 'button'
88
+ */
89
+ htmlType?: 'button' | 'submit' | 'reset';
90
+ /**
91
+ * Button variant
92
+ * @default 'default'
93
+ */
94
+ variant?: 'default' | 'primary' | 'success' | 'warning' | 'error' | 'ghost' | 'text';
95
+ /**
96
+ * Button size
97
+ * @default 'md'
98
+ */
99
+ size?: 'sm' | 'md' | 'lg';
100
+ /**
101
+ * Disabled state
102
+ * @default false
103
+ */
104
+ disabled?: boolean;
105
+ /**
106
+ * Loading state
107
+ * @default false
108
+ */
109
+ loading?: boolean;
110
+ /**
111
+ * Block level button
112
+ * @default false
113
+ */
114
+ block?: boolean;
115
+ /**
116
+ * Icon before content
117
+ */
118
+ icon?: ReactNode;
119
+ /**
120
+ * Additional CSS class
121
+ */
122
+ className?: string;
123
+ /**
124
+ * Custom styles
125
+ */
126
+ style?: CSSProperties;
127
+ }
128
+
129
+ export declare const Card: FC<CardProps>;
130
+
131
+ export declare interface CardProps {
132
+ /**
133
+ * Card title
134
+ */
135
+ title?: string;
136
+ /**
137
+ * Card content
138
+ */
139
+ children?: ReactNode;
140
+ /**
141
+ * Additional CSS class
142
+ */
143
+ className?: string;
144
+ /**
145
+ * Show border
146
+ * @default true
147
+ */
148
+ bordered?: boolean;
149
+ /**
150
+ * Hoverable effect
151
+ * @default false
152
+ */
153
+ hoverable?: boolean;
154
+ /**
155
+ * Card padding size
156
+ * @default 'md'
157
+ */
158
+ padding?: 'none' | 'sm' | 'md' | 'lg';
159
+ /**
160
+ * Custom styles
161
+ */
162
+ style?: CSSProperties;
163
+ /**
164
+ * Click handler
165
+ */
166
+ onClick?: () => void;
167
+ }
168
+
169
+ export declare const Checkbox: ForwardRefExoticComponent<CheckboxProps & RefAttributes<HTMLInputElement>>;
170
+
171
+ export declare interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange'> {
172
+ checked?: boolean;
173
+ onChange?: (checked: boolean) => void;
174
+ label?: string;
175
+ }
176
+
177
+ /**
178
+ * Color palette with shades from 50 to 950
179
+ */
180
+ export declare interface ColorPalette {
181
+ 50: string;
182
+ 100: string;
183
+ 200: string;
184
+ 300: string;
185
+ 400: string;
186
+ 500: string;
187
+ 600: string;
188
+ 700: string;
189
+ 800: string;
190
+ 900: string;
191
+ 950: string;
192
+ }
193
+
194
+ /**
195
+ * Create theme from configuration
196
+ * 根据配置创建完整主题
197
+ */
198
+ export declare function createTheme(config?: ThemeConfig): Theme;
199
+
200
+ /**
201
+ * Detect system dark mode preference
202
+ * 检测系统暗黑模式偏好
203
+ */
204
+ export declare function detectSystemDarkMode(): boolean;
205
+
206
+ /**
207
+ * Generate a color palette from a base color
208
+ * 基于基础色生成完整的色板(50-950)
209
+ */
210
+ export declare function generateColorPalette(baseColor: string): {
211
+ 50: string;
212
+ 100: string;
213
+ 200: string;
214
+ 300: string;
215
+ 400: string;
216
+ 500: string;
217
+ 600: string;
218
+ 700: string;
219
+ 800: string;
220
+ 900: string;
221
+ 950: string;
222
+ };
223
+
224
+ /**
225
+ * Generate CSS variables from color palette
226
+ * 从色板生成CSS变量
227
+ */
228
+ export declare function generateCSSVariables(colors: Record<string, ColorPalette>, neutral: ColorPalette, mode: 'light' | 'dark'): Record<string, string>;
229
+
230
+ /**
231
+ * Generate neutral colors (gray scale)
232
+ * 生成中性色(灰阶)
233
+ */
234
+ export declare function generateNeutralColors(isDark?: boolean): {
235
+ 50: string;
236
+ 100: string;
237
+ 200: string;
238
+ 300: string;
239
+ 400: string;
240
+ 500: string;
241
+ 600: string;
242
+ 700: string;
243
+ 800: string;
244
+ 900: string;
245
+ 950: string;
246
+ };
247
+
248
+ /**
249
+ * Generate semantic colors from primary color
250
+ * 基于主题色生成语义化颜色
251
+ */
252
+ export declare function generateSemanticColors(primaryColor: string): {
253
+ primary: {
254
+ 50: string;
255
+ 100: string;
256
+ 200: string;
257
+ 300: string;
258
+ 400: string;
259
+ 500: string;
260
+ 600: string;
261
+ 700: string;
262
+ 800: string;
263
+ 900: string;
264
+ 950: string;
265
+ };
266
+ success: {
267
+ 50: string;
268
+ 100: string;
269
+ 200: string;
270
+ 300: string;
271
+ 400: string;
272
+ 500: string;
273
+ 600: string;
274
+ 700: string;
275
+ 800: string;
276
+ 900: string;
277
+ 950: string;
278
+ };
279
+ warning: {
280
+ 50: string;
281
+ 100: string;
282
+ 200: string;
283
+ 300: string;
284
+ 400: string;
285
+ 500: string;
286
+ 600: string;
287
+ 700: string;
288
+ 800: string;
289
+ 900: string;
290
+ 950: string;
291
+ };
292
+ error: {
293
+ 50: string;
294
+ 100: string;
295
+ 200: string;
296
+ 300: string;
297
+ 400: string;
298
+ 500: string;
299
+ 600: string;
300
+ 700: string;
301
+ 800: string;
302
+ 900: string;
303
+ 950: string;
304
+ };
305
+ info: {
306
+ 50: string;
307
+ 100: string;
308
+ 200: string;
309
+ 300: string;
310
+ 400: string;
311
+ 500: string;
312
+ 600: string;
313
+ 700: string;
314
+ 800: string;
315
+ 900: string;
316
+ 950: string;
317
+ };
318
+ };
319
+
320
+ export declare const Input: ForwardRefExoticComponent<InputProps & RefAttributes<HTMLInputElement>>;
321
+
322
+ export declare interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix'> {
323
+ /**
324
+ * Input size
325
+ * @default 'md'
326
+ */
327
+ size?: 'sm' | 'md' | 'lg';
328
+ /**
329
+ * Input status
330
+ */
331
+ status?: 'error' | 'warning' | 'success';
332
+ /**
333
+ * Prefix icon or text
334
+ */
335
+ prefix?: ReactNode;
336
+ /**
337
+ * Suffix icon or text
338
+ */
339
+ suffix?: ReactNode;
340
+ /**
341
+ * Allow clear
342
+ * @default false
343
+ */
344
+ allowClear?: boolean;
345
+ /**
346
+ * Clear callback
347
+ */
348
+ onClear?: () => void;
349
+ /**
350
+ * Full width
351
+ * @default false
352
+ */
353
+ block?: boolean;
354
+ }
355
+
356
+ /**
357
+ * Preset color themes
358
+ * 预设的主题色
359
+ */
360
+ export declare const PRESET_COLORS: {
361
+ react: string;
362
+ blue: string;
363
+ green: string;
364
+ purple: string;
365
+ pink: string;
366
+ orange: string;
367
+ red: string;
368
+ yellow: string;
369
+ teal: string;
370
+ indigo: string;
371
+ };
372
+
373
+ /**
374
+ * Get preset color or custom color
375
+ * 获取预设颜色或自定义颜色
376
+ */
377
+ export declare function resolveThemeColor(color: string): string;
378
+
379
+ /**
380
+ * Resolve theme mode (auto -> light/dark)
381
+ * 解析主题模式
382
+ */
383
+ export declare function resolveThemeMode(mode: ThemeMode): 'light' | 'dark';
384
+
385
+ export declare const Select: ForwardRefExoticComponent<SelectProps & RefAttributes<HTMLSelectElement>>;
386
+
387
+ export declare interface SelectOption {
388
+ label: string;
389
+ value: string | number;
390
+ }
391
+
392
+ export declare interface SelectProps extends Omit<SelectHTMLAttributes<HTMLSelectElement>, 'onChange' | 'size'> {
393
+ options?: SelectOption[];
394
+ onChange?: (value: string) => void;
395
+ value?: string | number;
396
+ size?: SelectSize;
397
+ }
398
+
399
+ export declare type SelectSize = 'sm' | 'md' | 'lg';
400
+
401
+ /**
402
+ * Design tokens for shadows
403
+ * 阴影设计令牌
404
+ */
405
+ export declare const shadows: {
406
+ none: string;
407
+ sm: string;
408
+ base: string;
409
+ md: string;
410
+ lg: string;
411
+ xl: string;
412
+ '2xl': string;
413
+ inner: string;
414
+ };
415
+
416
+ /**
417
+ * Design tokens for spacing
418
+ * 间距设计令牌
419
+ */
420
+ export declare const spacing: {
421
+ 0: string;
422
+ 1: string;
423
+ 2: string;
424
+ 3: string;
425
+ 4: string;
426
+ 5: string;
427
+ 6: string;
428
+ 7: string;
429
+ 8: string;
430
+ 10: string;
431
+ 12: string;
432
+ 16: string;
433
+ 20: string;
434
+ 24: string;
435
+ };
436
+
437
+ export declare const Switch: FC<SwitchProps>;
438
+
439
+ export declare interface SwitchProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'size'> {
440
+ checked?: boolean;
441
+ onChange?: (checked: boolean) => void;
442
+ label?: string;
443
+ size?: SwitchSize;
444
+ }
445
+
446
+ export declare type SwitchSize = 'sm' | 'md' | 'lg';
447
+
448
+ export declare const Tag: FC<TagProps>;
449
+
450
+ export declare type TagColor = 'primary' | 'success' | 'warning' | 'error' | 'info' | 'neutral';
451
+
452
+ export declare interface TagProps {
453
+ children?: ReactNode;
454
+ color?: TagColor;
455
+ variant?: TagVariant;
456
+ size?: TagSize;
457
+ closable?: boolean;
458
+ onClose?: (event: React.MouseEvent<HTMLButtonElement>) => void;
459
+ onClick?: (event: React.MouseEvent<HTMLSpanElement | HTMLButtonElement>) => void;
460
+ className?: string;
461
+ style?: CSSProperties;
462
+ }
463
+
464
+ export declare type TagSize = 'sm' | 'md';
465
+
466
+ export declare type TagVariant = 'solid' | 'outline';
467
+
468
+ /**
469
+ * Complete theme object
470
+ */
471
+ export declare interface Theme {
472
+ mode: 'light' | 'dark';
473
+ colors: {
474
+ primary: ColorPalette;
475
+ success: ColorPalette;
476
+ warning: ColorPalette;
477
+ error: ColorPalette;
478
+ info: ColorPalette;
479
+ neutral: ColorPalette;
480
+ };
481
+ spacing: Record<string, string>;
482
+ borderRadius: Record<string, string>;
483
+ shadows: Record<string, string>;
484
+ typography: {
485
+ fontFamily: Record<string, string>;
486
+ fontSize: Record<string, string>;
487
+ fontWeight: Record<string, string>;
488
+ lineHeight: Record<string, string>;
489
+ };
490
+ transitions: {
491
+ duration: Record<string, string>;
492
+ timing: Record<string, string>;
493
+ };
494
+ zIndex: Record<string, number>;
495
+ cssVars: Record<string, string>;
496
+ }
497
+
498
+ /**
499
+ * Theme configuration
500
+ */
501
+ export declare interface ThemeConfig {
502
+ /**
503
+ * Theme mode
504
+ * @default 'auto'
505
+ */
506
+ mode?: ThemeMode;
507
+ /**
508
+ * Primary color (preset name or hex color)
509
+ * @default 'react' (#61dafb)
510
+ */
511
+ primaryColor?: string;
512
+ /**
513
+ * Custom color palettes
514
+ */
515
+ colors?: {
516
+ primary?: Partial<ColorPalette>;
517
+ success?: Partial<ColorPalette>;
518
+ warning?: Partial<ColorPalette>;
519
+ error?: Partial<ColorPalette>;
520
+ info?: Partial<ColorPalette>;
521
+ };
522
+ }
523
+
524
+ /**
525
+ * Theme context
526
+ */
527
+ declare interface ThemeContextValue {
528
+ theme: Theme;
529
+ config: ThemeConfig;
530
+ setMode: (mode: ThemeMode) => void;
531
+ setPrimaryColor: (color: string) => void;
532
+ toggleMode: (event?: React.MouseEvent) => void;
533
+ }
534
+
535
+ /**
536
+ * Theme mode
537
+ */
538
+ export declare type ThemeMode = 'light' | 'dark' | 'auto';
539
+
540
+ /**
541
+ * Theme Provider Component
542
+ */
543
+ export declare const ThemeProvider: FC<ThemeProviderProps>;
544
+
545
+ /**
546
+ * Theme Provider Props
547
+ */
548
+ export declare interface ThemeProviderProps {
549
+ children: ReactNode;
550
+ config?: ThemeConfig;
551
+ /**
552
+ * Storage key for persisting theme config
553
+ * @default 'react-devtools-theme'
554
+ */
555
+ storageKey?: string;
556
+ }
557
+
558
+ /**
559
+ * Design tokens for transitions
560
+ * 过渡动画设计令牌
561
+ */
562
+ export declare const transitions: {
563
+ duration: {
564
+ fast: string;
565
+ base: string;
566
+ slow: string;
567
+ slower: string;
568
+ };
569
+ timing: {
570
+ linear: string;
571
+ ease: string;
572
+ easeIn: string;
573
+ easeOut: string;
574
+ easeInOut: string;
575
+ smoothSpring: string;
576
+ softExit: string;
577
+ };
578
+ };
579
+
580
+ /**
581
+ * Design tokens for typography
582
+ * 字体设计令牌
583
+ */
584
+ export declare const typography: {
585
+ fontFamily: {
586
+ sans: string;
587
+ mono: string;
588
+ };
589
+ fontSize: {
590
+ xs: string;
591
+ sm: string;
592
+ base: string;
593
+ lg: string;
594
+ xl: string;
595
+ '2xl': string;
596
+ '3xl': string;
597
+ '4xl': string;
598
+ };
599
+ fontWeight: {
600
+ thin: string;
601
+ light: string;
602
+ normal: string;
603
+ medium: string;
604
+ semibold: string;
605
+ bold: string;
606
+ extrabold: string;
607
+ };
608
+ lineHeight: {
609
+ tight: string;
610
+ snug: string;
611
+ normal: string;
612
+ relaxed: string;
613
+ loose: string;
614
+ };
615
+ };
616
+
617
+ /**
618
+ * Use theme hook
619
+ */
620
+ export declare function useTheme(): ThemeContextValue;
621
+
622
+ /**
623
+ * Use theme colors hook
624
+ */
625
+ export declare function useThemeColors(): {
626
+ primary: ColorPalette;
627
+ success: ColorPalette;
628
+ warning: ColorPalette;
629
+ error: ColorPalette;
630
+ info: ColorPalette;
631
+ neutral: ColorPalette;
632
+ };
633
+
634
+ /**
635
+ * Use theme mode hook
636
+ */
637
+ export declare function useThemeMode(): {
638
+ mode: "light" | "dark";
639
+ setMode: (mode: ThemeMode) => void;
640
+ toggleMode: (event?: React.MouseEvent) => void;
641
+ };
642
+
643
+ /**
644
+ * Watch system dark mode changes
645
+ * 监听系统暗黑模式变化
646
+ */
647
+ export declare function watchSystemDarkMode(callback: (isDark: boolean) => void): () => void;
648
+
649
+ /**
650
+ * Design tokens for z-index
651
+ * 层级设计令牌
652
+ */
653
+ export declare const zIndex: {
654
+ base: number;
655
+ dropdown: number;
656
+ sticky: number;
657
+ fixed: number;
658
+ modalBackdrop: number;
659
+ modal: number;
660
+ popover: number;
661
+ tooltip: number;
662
+ };
663
+
664
+ export { }