@officesdk/design 0.1.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.
- package/README.md +54 -0
- package/dist/components/index.d.mts +936 -0
- package/dist/components/index.d.ts +936 -0
- package/dist/components/index.js +2320 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/index.mjs +2293 -0
- package/dist/components/index.mjs.map +1 -0
- package/dist/icons/index.d.mts +93 -0
- package/dist/icons/index.d.ts +93 -0
- package/dist/icons/index.js +293 -0
- package/dist/icons/index.js.map +1 -0
- package/dist/icons/index.mjs +224 -0
- package/dist/icons/index.mjs.map +1 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.mjs +2 -0
- package/dist/theme/index.d.mts +9 -0
- package/dist/theme/index.d.ts +9 -0
- package/dist/theme/index.js +1264 -0
- package/dist/theme/index.js.map +1 -0
- package/dist/theme/index.mjs +1261 -0
- package/dist/theme/index.mjs.map +1 -0
- package/dist/utils/index.d.mts +18 -0
- package/dist/utils/index.d.ts +18 -0
- package/dist/utils/index.js +54 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/index.mjs +49 -0
- package/dist/utils/index.mjs.map +1 -0
- package/package.json +75 -0
|
@@ -0,0 +1,936 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TooltipProps as TooltipProps$1 } from 'rc-tooltip/lib/Tooltip';
|
|
3
|
+
|
|
4
|
+
interface ButtonProps {
|
|
5
|
+
/**
|
|
6
|
+
* Button variant type
|
|
7
|
+
*/
|
|
8
|
+
variant?: 'solid' | 'outlined' | 'text' | 'icon';
|
|
9
|
+
/**
|
|
10
|
+
* Button color type
|
|
11
|
+
* - 'status' is only available for 'text' variant
|
|
12
|
+
*/
|
|
13
|
+
colorType?: 'default' | 'guidance' | 'alert' | 'status';
|
|
14
|
+
/**
|
|
15
|
+
* Button size
|
|
16
|
+
*/
|
|
17
|
+
size?: 'small' | 'medium' | 'large' | 'extraLarge';
|
|
18
|
+
/**
|
|
19
|
+
* Whether the button is disabled
|
|
20
|
+
*/
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Whether the button is in loading state
|
|
24
|
+
*/
|
|
25
|
+
loading?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Whether the button should take full width of its container
|
|
28
|
+
*/
|
|
29
|
+
fullWidth?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Icon to display before the button text
|
|
32
|
+
*/
|
|
33
|
+
iconBefore?: React.ReactNode;
|
|
34
|
+
/**
|
|
35
|
+
* Icon to display after the button text
|
|
36
|
+
*/
|
|
37
|
+
iconAfter?: React.ReactNode;
|
|
38
|
+
/**
|
|
39
|
+
* Whether the icon button should have a border (only for variant='icon')
|
|
40
|
+
*/
|
|
41
|
+
iconBordered?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Click event handler
|
|
44
|
+
*/
|
|
45
|
+
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
46
|
+
/**
|
|
47
|
+
* Button content
|
|
48
|
+
*/
|
|
49
|
+
children?: React.ReactNode;
|
|
50
|
+
/**
|
|
51
|
+
* Custom className
|
|
52
|
+
*/
|
|
53
|
+
className?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Custom inline styles
|
|
56
|
+
*/
|
|
57
|
+
style?: React.CSSProperties;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Button Component
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* // Basic button
|
|
64
|
+
* <Button>button</Button>
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* // Button with icons
|
|
68
|
+
* <Button iconBefore={<Icon />}>button</Button>
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* // Icon-only button
|
|
72
|
+
* <Button variant="icon" iconBordered><Icon /></Button>
|
|
73
|
+
*/
|
|
74
|
+
declare const Button: React.FC<ButtonProps>;
|
|
75
|
+
|
|
76
|
+
interface SpinButtonProps {
|
|
77
|
+
/**
|
|
78
|
+
* Current value
|
|
79
|
+
*/
|
|
80
|
+
value?: number;
|
|
81
|
+
/**
|
|
82
|
+
* Default value
|
|
83
|
+
*/
|
|
84
|
+
defaultValue?: number;
|
|
85
|
+
/**
|
|
86
|
+
* Minimum value
|
|
87
|
+
*/
|
|
88
|
+
min?: number;
|
|
89
|
+
/**
|
|
90
|
+
* Maximum value
|
|
91
|
+
*/
|
|
92
|
+
max?: number;
|
|
93
|
+
/**
|
|
94
|
+
* Step increment/decrement
|
|
95
|
+
*/
|
|
96
|
+
step?: number;
|
|
97
|
+
/**
|
|
98
|
+
* Size variant
|
|
99
|
+
*/
|
|
100
|
+
size?: 'small' | 'large';
|
|
101
|
+
/**
|
|
102
|
+
* Whether the input is disabled
|
|
103
|
+
*/
|
|
104
|
+
disabled?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Whether to show alert state (red border)
|
|
107
|
+
*/
|
|
108
|
+
alert?: boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Whether to show the slider
|
|
111
|
+
*/
|
|
112
|
+
showSlider?: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Number of decimal places
|
|
115
|
+
*/
|
|
116
|
+
precision?: number;
|
|
117
|
+
/**
|
|
118
|
+
* Format the display value
|
|
119
|
+
*/
|
|
120
|
+
formatter?: (value: number) => string;
|
|
121
|
+
/**
|
|
122
|
+
* Parse the input value
|
|
123
|
+
*/
|
|
124
|
+
parser?: (displayValue: string) => number;
|
|
125
|
+
/**
|
|
126
|
+
* Callback when value changes
|
|
127
|
+
*/
|
|
128
|
+
onChange?: (value: number | null) => void;
|
|
129
|
+
/**
|
|
130
|
+
* Custom className
|
|
131
|
+
*/
|
|
132
|
+
className?: string;
|
|
133
|
+
/**
|
|
134
|
+
* Custom style
|
|
135
|
+
*/
|
|
136
|
+
style?: React.CSSProperties;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* SpinButton Component - Spin Button
|
|
140
|
+
*
|
|
141
|
+
* A numeric input with increment/decrement buttons
|
|
142
|
+
*
|
|
143
|
+
* @example
|
|
144
|
+
* <SpinButton value={35} onChange={(val) => console.log(val)} />
|
|
145
|
+
*/
|
|
146
|
+
declare const SpinButton: React.FC<SpinButtonProps>;
|
|
147
|
+
|
|
148
|
+
interface SwitchProps {
|
|
149
|
+
/**
|
|
150
|
+
* Whether the switch is checked
|
|
151
|
+
*/
|
|
152
|
+
checked?: boolean;
|
|
153
|
+
/**
|
|
154
|
+
* Default checked state
|
|
155
|
+
*/
|
|
156
|
+
defaultChecked?: boolean;
|
|
157
|
+
/**
|
|
158
|
+
* Size variant
|
|
159
|
+
*/
|
|
160
|
+
size?: 'small' | 'medium' | 'large';
|
|
161
|
+
/**
|
|
162
|
+
* Whether the switch is disabled
|
|
163
|
+
*/
|
|
164
|
+
disabled?: boolean;
|
|
165
|
+
/**
|
|
166
|
+
* Callback when checked state changes
|
|
167
|
+
*/
|
|
168
|
+
onChange?: (checked: boolean) => void;
|
|
169
|
+
/**
|
|
170
|
+
* Custom className
|
|
171
|
+
*/
|
|
172
|
+
className?: string;
|
|
173
|
+
/**
|
|
174
|
+
* Custom style
|
|
175
|
+
*/
|
|
176
|
+
style?: React.CSSProperties;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Switch Component
|
|
180
|
+
*
|
|
181
|
+
* A toggle switch for binary states
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* <Switch checked={true} onChange={(checked) => console.log(checked)} />
|
|
185
|
+
*/
|
|
186
|
+
declare const Switch: React.FC<SwitchProps>;
|
|
187
|
+
|
|
188
|
+
interface RadioProps {
|
|
189
|
+
/**
|
|
190
|
+
* Whether the radio is checked
|
|
191
|
+
*/
|
|
192
|
+
checked?: boolean;
|
|
193
|
+
/**
|
|
194
|
+
* Default checked state
|
|
195
|
+
*/
|
|
196
|
+
defaultChecked?: boolean;
|
|
197
|
+
/**
|
|
198
|
+
* Whether the radio is disabled
|
|
199
|
+
*/
|
|
200
|
+
disabled?: boolean;
|
|
201
|
+
/**
|
|
202
|
+
* Value of the radio
|
|
203
|
+
*/
|
|
204
|
+
value?: string | number;
|
|
205
|
+
/**
|
|
206
|
+
* Name attribute for grouping radios
|
|
207
|
+
*/
|
|
208
|
+
name?: string;
|
|
209
|
+
/**
|
|
210
|
+
* ID attribute for the radio (used with htmlFor in labels)
|
|
211
|
+
*/
|
|
212
|
+
id?: string;
|
|
213
|
+
/**
|
|
214
|
+
* Callback when checked state changes
|
|
215
|
+
*/
|
|
216
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
217
|
+
/**
|
|
218
|
+
* Custom className
|
|
219
|
+
*/
|
|
220
|
+
className?: string;
|
|
221
|
+
/**
|
|
222
|
+
* Custom style
|
|
223
|
+
*/
|
|
224
|
+
style?: React.CSSProperties;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Radio Component
|
|
228
|
+
*
|
|
229
|
+
* A radio button for selecting one option from a group
|
|
230
|
+
*
|
|
231
|
+
* @example
|
|
232
|
+
* <Radio checked={true} onChange={(e) => console.log(e.target.checked)} />
|
|
233
|
+
*/
|
|
234
|
+
declare const Radio: React.FC<RadioProps>;
|
|
235
|
+
|
|
236
|
+
interface CheckboxProps {
|
|
237
|
+
/**
|
|
238
|
+
* Whether the checkbox is checked
|
|
239
|
+
*/
|
|
240
|
+
checked?: boolean;
|
|
241
|
+
/**
|
|
242
|
+
* Default checked state
|
|
243
|
+
*/
|
|
244
|
+
defaultChecked?: boolean;
|
|
245
|
+
/**
|
|
246
|
+
* Whether the checkbox is in indeterminate state
|
|
247
|
+
*/
|
|
248
|
+
indeterminate?: boolean;
|
|
249
|
+
/**
|
|
250
|
+
* Whether the checkbox is disabled
|
|
251
|
+
*/
|
|
252
|
+
disabled?: boolean;
|
|
253
|
+
/**
|
|
254
|
+
* Value of the checkbox
|
|
255
|
+
*/
|
|
256
|
+
value?: string | number;
|
|
257
|
+
/**
|
|
258
|
+
* Name attribute for the checkbox
|
|
259
|
+
*/
|
|
260
|
+
name?: string;
|
|
261
|
+
/**
|
|
262
|
+
* ID attribute for the checkbox (used with htmlFor in labels)
|
|
263
|
+
*/
|
|
264
|
+
id?: string;
|
|
265
|
+
/**
|
|
266
|
+
* Callback when checked state changes
|
|
267
|
+
*/
|
|
268
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
269
|
+
/**
|
|
270
|
+
* Custom className
|
|
271
|
+
*/
|
|
272
|
+
className?: string;
|
|
273
|
+
/**
|
|
274
|
+
* Custom style
|
|
275
|
+
*/
|
|
276
|
+
style?: React.CSSProperties;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Checkbox Component
|
|
280
|
+
*
|
|
281
|
+
* A checkbox for selecting multiple options
|
|
282
|
+
*
|
|
283
|
+
* @example
|
|
284
|
+
* <Checkbox checked={true} onChange={(e) => console.log(e.target.checked)} />
|
|
285
|
+
*
|
|
286
|
+
* @example
|
|
287
|
+
* // Indeterminate state
|
|
288
|
+
* <Checkbox indeterminate={true} />
|
|
289
|
+
*/
|
|
290
|
+
declare const Checkbox: React.FC<CheckboxProps>;
|
|
291
|
+
|
|
292
|
+
interface SliderProps {
|
|
293
|
+
/**
|
|
294
|
+
* Current value (0-100)
|
|
295
|
+
*/
|
|
296
|
+
value?: number;
|
|
297
|
+
/**
|
|
298
|
+
* Default value
|
|
299
|
+
*/
|
|
300
|
+
defaultValue?: number;
|
|
301
|
+
/**
|
|
302
|
+
* Minimum value
|
|
303
|
+
*/
|
|
304
|
+
min?: number;
|
|
305
|
+
/**
|
|
306
|
+
* Maximum value
|
|
307
|
+
*/
|
|
308
|
+
max?: number;
|
|
309
|
+
/**
|
|
310
|
+
* Step increment
|
|
311
|
+
*/
|
|
312
|
+
step?: number;
|
|
313
|
+
/**
|
|
314
|
+
* Whether the slider is disabled
|
|
315
|
+
*/
|
|
316
|
+
disabled?: boolean;
|
|
317
|
+
/**
|
|
318
|
+
* Callback when value changes
|
|
319
|
+
*/
|
|
320
|
+
onChange?: (value: number) => void;
|
|
321
|
+
/**
|
|
322
|
+
* Callback when dragging starts
|
|
323
|
+
*/
|
|
324
|
+
onDragStart?: () => void;
|
|
325
|
+
/**
|
|
326
|
+
* Callback when dragging ends
|
|
327
|
+
*/
|
|
328
|
+
onDragEnd?: () => void;
|
|
329
|
+
/**
|
|
330
|
+
* Custom className
|
|
331
|
+
*/
|
|
332
|
+
className?: string;
|
|
333
|
+
/**
|
|
334
|
+
* Custom style
|
|
335
|
+
*/
|
|
336
|
+
style?: React.CSSProperties;
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Slider Component
|
|
340
|
+
*
|
|
341
|
+
* A slider for selecting a value from a range
|
|
342
|
+
*
|
|
343
|
+
* @example
|
|
344
|
+
* <Slider value={35} onChange={(val) => console.log(val)} />
|
|
345
|
+
*/
|
|
346
|
+
declare const Slider: React.FC<SliderProps>;
|
|
347
|
+
|
|
348
|
+
type InputSize = 'small' | 'medium' | 'large' | 'extraLarge';
|
|
349
|
+
interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix'> {
|
|
350
|
+
/**
|
|
351
|
+
* Input size
|
|
352
|
+
*/
|
|
353
|
+
size?: InputSize;
|
|
354
|
+
/**
|
|
355
|
+
* Whether the input has an error state
|
|
356
|
+
*/
|
|
357
|
+
error?: boolean;
|
|
358
|
+
/**
|
|
359
|
+
* Whether the input is in readonly mode
|
|
360
|
+
*/
|
|
361
|
+
readOnly?: boolean;
|
|
362
|
+
/**
|
|
363
|
+
* Node to display before the input
|
|
364
|
+
*/
|
|
365
|
+
prefixNode?: React.ReactNode;
|
|
366
|
+
/**
|
|
367
|
+
* Node to display after the input
|
|
368
|
+
*/
|
|
369
|
+
suffixNode?: React.ReactNode;
|
|
370
|
+
/**
|
|
371
|
+
* Custom className
|
|
372
|
+
*/
|
|
373
|
+
className?: string;
|
|
374
|
+
/**
|
|
375
|
+
* Custom inline styles
|
|
376
|
+
*/
|
|
377
|
+
style?: React.CSSProperties;
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Input Component
|
|
381
|
+
*
|
|
382
|
+
* @example
|
|
383
|
+
* // Basic input
|
|
384
|
+
* <Input placeholder="Enter text" />
|
|
385
|
+
*
|
|
386
|
+
* @example
|
|
387
|
+
* // Input with prefix and suffix
|
|
388
|
+
* <Input prefixNode={<SearchIcon />} suffixNode={<CloseIcon />} />
|
|
389
|
+
*
|
|
390
|
+
* @example
|
|
391
|
+
* // Input with error state
|
|
392
|
+
* <Input error placeholder="Enter text" />
|
|
393
|
+
*/
|
|
394
|
+
declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
395
|
+
|
|
396
|
+
interface SearchInputProps extends Omit<InputProps, 'size' | 'prefixNode'> {
|
|
397
|
+
/**
|
|
398
|
+
* SearchInput size (only medium and large)
|
|
399
|
+
*/
|
|
400
|
+
size?: 'extraLarge' | 'large';
|
|
401
|
+
/**
|
|
402
|
+
* Whether to show the clear button when input has value
|
|
403
|
+
*/
|
|
404
|
+
clearable?: boolean;
|
|
405
|
+
/**
|
|
406
|
+
* Callback when clear button is clicked
|
|
407
|
+
*/
|
|
408
|
+
onClear?: () => void;
|
|
409
|
+
/**
|
|
410
|
+
* Custom search icon
|
|
411
|
+
*/
|
|
412
|
+
searchIcon?: React.ReactNode;
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* SearchInput Component
|
|
416
|
+
*
|
|
417
|
+
* @example
|
|
418
|
+
* // Basic search input
|
|
419
|
+
* <SearchInput placeholder="Search..." />
|
|
420
|
+
*
|
|
421
|
+
* @example
|
|
422
|
+
* // Search input with clearable
|
|
423
|
+
* <SearchInput clearable onClear={() => console.log('cleared')} />
|
|
424
|
+
*
|
|
425
|
+
* @example
|
|
426
|
+
* // Large search input
|
|
427
|
+
* <SearchInput size="large" placeholder="Search..." />
|
|
428
|
+
*/
|
|
429
|
+
declare const SearchInput: React.ForwardRefExoticComponent<SearchInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
430
|
+
|
|
431
|
+
interface IconProps {
|
|
432
|
+
/**
|
|
433
|
+
* Icon name from registry (requires IconProvider)
|
|
434
|
+
*/
|
|
435
|
+
name?: string;
|
|
436
|
+
/**
|
|
437
|
+
* Image URL for icon (e.g., PNG, JPG, or external SVG)
|
|
438
|
+
*/
|
|
439
|
+
src?: string;
|
|
440
|
+
/**
|
|
441
|
+
* Custom icon element (takes precedence over name and src)
|
|
442
|
+
*/
|
|
443
|
+
children?: React.ReactNode;
|
|
444
|
+
/**
|
|
445
|
+
* Size of the icon (px)
|
|
446
|
+
*/
|
|
447
|
+
size?: number | string;
|
|
448
|
+
/**
|
|
449
|
+
* Color of the icon (only works with SVG icons, not image src)
|
|
450
|
+
*/
|
|
451
|
+
color?: string;
|
|
452
|
+
/**
|
|
453
|
+
* Alt text for image icons
|
|
454
|
+
*/
|
|
455
|
+
alt?: string;
|
|
456
|
+
/**
|
|
457
|
+
* Custom className
|
|
458
|
+
*/
|
|
459
|
+
className?: string;
|
|
460
|
+
/**
|
|
461
|
+
* Custom style
|
|
462
|
+
*/
|
|
463
|
+
style?: React.CSSProperties;
|
|
464
|
+
/**
|
|
465
|
+
* Click handler
|
|
466
|
+
*/
|
|
467
|
+
onClick?: (e: React.MouseEvent) => void;
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Icon Component
|
|
471
|
+
*
|
|
472
|
+
* Renders icons from multiple sources with priority: children > src > name
|
|
473
|
+
*
|
|
474
|
+
* @example
|
|
475
|
+
* // Using with IconProvider and registry
|
|
476
|
+
* <Icon name="close" size={16} />
|
|
477
|
+
*
|
|
478
|
+
* @example
|
|
479
|
+
* // Using with image URL
|
|
480
|
+
* <Icon src="/icons/custom-icon.svg" size={24} />
|
|
481
|
+
*
|
|
482
|
+
* @example
|
|
483
|
+
* // Using with custom icon element
|
|
484
|
+
* <Icon><CustomSvg /></Icon>
|
|
485
|
+
*
|
|
486
|
+
* @example
|
|
487
|
+
* // Using with imported icon component
|
|
488
|
+
* import { CloseIcon } from '@officesdk/design/icons';
|
|
489
|
+
* <Icon><CloseIcon /></Icon>
|
|
490
|
+
*/
|
|
491
|
+
declare const Icon: React.FC<IconProps>;
|
|
492
|
+
|
|
493
|
+
type IconComponent = React.ComponentType<React.SVGProps<SVGSVGElement>>;
|
|
494
|
+
type IconRegistry = Record<string, IconComponent>;
|
|
495
|
+
interface IconProviderProps {
|
|
496
|
+
/**
|
|
497
|
+
* Icon registry mapping icon names to React components
|
|
498
|
+
* Import from @officesdk/design/icons
|
|
499
|
+
*/
|
|
500
|
+
icons: IconRegistry;
|
|
501
|
+
/**
|
|
502
|
+
* Children components
|
|
503
|
+
*/
|
|
504
|
+
children: React.ReactNode;
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* IconProvider Component
|
|
508
|
+
*
|
|
509
|
+
* Provides icon registry to child components via Context
|
|
510
|
+
*
|
|
511
|
+
* @example
|
|
512
|
+
* import { IconProvider } from '@officesdk/design';
|
|
513
|
+
* import { iconRegistry } from '@officesdk/design/icons';
|
|
514
|
+
*
|
|
515
|
+
* <IconProvider icons={iconRegistry}>
|
|
516
|
+
* <App />
|
|
517
|
+
* </IconProvider>
|
|
518
|
+
*/
|
|
519
|
+
declare const IconProvider: React.FC<IconProviderProps>;
|
|
520
|
+
/**
|
|
521
|
+
* Hook to access icon registry from context
|
|
522
|
+
*/
|
|
523
|
+
declare const useIconRegistry: () => IconRegistry | null;
|
|
524
|
+
|
|
525
|
+
interface ToastProps {
|
|
526
|
+
/**
|
|
527
|
+
* Toast variant type
|
|
528
|
+
*/
|
|
529
|
+
variant?: 'success' | 'info' | 'error' | 'warn';
|
|
530
|
+
/**
|
|
531
|
+
* Toast message content
|
|
532
|
+
*/
|
|
533
|
+
message: string;
|
|
534
|
+
/**
|
|
535
|
+
* Optional action button text
|
|
536
|
+
*/
|
|
537
|
+
actionText?: string;
|
|
538
|
+
/**
|
|
539
|
+
* Action button click handler
|
|
540
|
+
*/
|
|
541
|
+
onAction?: () => void;
|
|
542
|
+
/**
|
|
543
|
+
* Whether to show close button
|
|
544
|
+
*/
|
|
545
|
+
closable?: boolean;
|
|
546
|
+
/**
|
|
547
|
+
* Close button click handler
|
|
548
|
+
*/
|
|
549
|
+
onClose?: () => void;
|
|
550
|
+
/**
|
|
551
|
+
* Auto close duration in milliseconds (0 to disable)
|
|
552
|
+
*/
|
|
553
|
+
duration?: number;
|
|
554
|
+
/**
|
|
555
|
+
* Custom icon (overrides default variant icon)
|
|
556
|
+
*/
|
|
557
|
+
icon?: React.ReactNode;
|
|
558
|
+
/**
|
|
559
|
+
* Whether to show icon
|
|
560
|
+
*/
|
|
561
|
+
showIcon?: boolean;
|
|
562
|
+
/**
|
|
563
|
+
* Custom className
|
|
564
|
+
*/
|
|
565
|
+
className?: string;
|
|
566
|
+
/**
|
|
567
|
+
* Custom style
|
|
568
|
+
*/
|
|
569
|
+
style?: React.CSSProperties;
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* Toast Component
|
|
573
|
+
*
|
|
574
|
+
* A notification message component with different variants
|
|
575
|
+
*
|
|
576
|
+
* @example
|
|
577
|
+
* <Toast variant="success" message="Operation successful!" />
|
|
578
|
+
*
|
|
579
|
+
* @example
|
|
580
|
+
* <Toast
|
|
581
|
+
* variant="info"
|
|
582
|
+
* message="New update available"
|
|
583
|
+
* actionText="Update"
|
|
584
|
+
* onAction={() => console.log('Update clicked')}
|
|
585
|
+
* closable
|
|
586
|
+
* />
|
|
587
|
+
*/
|
|
588
|
+
declare const Toast: React.FC<ToastProps>;
|
|
589
|
+
|
|
590
|
+
interface ToastContextValue {
|
|
591
|
+
showToast: (props: Omit<ToastProps, 'onClose'>) => string;
|
|
592
|
+
hideToast: (id: string) => void;
|
|
593
|
+
success: (message: string, options?: Partial<ToastProps>) => string;
|
|
594
|
+
info: (message: string, options?: Partial<ToastProps>) => string;
|
|
595
|
+
error: (message: string, options?: Partial<ToastProps>) => string;
|
|
596
|
+
warn: (message: string, options?: Partial<ToastProps>) => string;
|
|
597
|
+
}
|
|
598
|
+
interface ToastContainerProps {
|
|
599
|
+
/**
|
|
600
|
+
* Maximum number of toasts to show at once
|
|
601
|
+
*/
|
|
602
|
+
maxCount?: number;
|
|
603
|
+
/**
|
|
604
|
+
* Default duration for auto-close (ms)
|
|
605
|
+
*/
|
|
606
|
+
defaultDuration?: number;
|
|
607
|
+
/**
|
|
608
|
+
* Children components
|
|
609
|
+
*/
|
|
610
|
+
children: React.ReactNode;
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* ToastContainer Component
|
|
614
|
+
*
|
|
615
|
+
* Provides toast context and manages toast display
|
|
616
|
+
*
|
|
617
|
+
* @example
|
|
618
|
+
* <ToastContainer>
|
|
619
|
+
* <App />
|
|
620
|
+
* </ToastContainer>
|
|
621
|
+
*/
|
|
622
|
+
declare const ToastContainer: React.FC<ToastContainerProps>;
|
|
623
|
+
/**
|
|
624
|
+
* Hook to access toast methods
|
|
625
|
+
*
|
|
626
|
+
* @example
|
|
627
|
+
* const toast = useToast();
|
|
628
|
+
* toast.success('Operation successful!');
|
|
629
|
+
* toast.error('Something went wrong');
|
|
630
|
+
*/
|
|
631
|
+
declare const useToast: () => ToastContextValue;
|
|
632
|
+
|
|
633
|
+
interface TabItem {
|
|
634
|
+
/**
|
|
635
|
+
* Unique key for the tab
|
|
636
|
+
*/
|
|
637
|
+
key: string;
|
|
638
|
+
/**
|
|
639
|
+
* Tab label
|
|
640
|
+
*/
|
|
641
|
+
label: string;
|
|
642
|
+
/**
|
|
643
|
+
* Whether the tab is disabled
|
|
644
|
+
*/
|
|
645
|
+
disabled?: boolean;
|
|
646
|
+
/**
|
|
647
|
+
* Custom icon
|
|
648
|
+
*/
|
|
649
|
+
icon?: React.ReactNode;
|
|
650
|
+
}
|
|
651
|
+
interface TabsProps {
|
|
652
|
+
/**
|
|
653
|
+
* Tab items
|
|
654
|
+
*/
|
|
655
|
+
items: TabItem[];
|
|
656
|
+
/**
|
|
657
|
+
* Active tab key
|
|
658
|
+
*/
|
|
659
|
+
activeKey?: string;
|
|
660
|
+
/**
|
|
661
|
+
* Default active tab key
|
|
662
|
+
*/
|
|
663
|
+
defaultActiveKey?: string;
|
|
664
|
+
/**
|
|
665
|
+
* Tab variant
|
|
666
|
+
*/
|
|
667
|
+
variant?: 'line' | 'card';
|
|
668
|
+
/**
|
|
669
|
+
* Tab size
|
|
670
|
+
*/
|
|
671
|
+
size?: 'large';
|
|
672
|
+
/**
|
|
673
|
+
* Callback when tab changes
|
|
674
|
+
*/
|
|
675
|
+
onChange?: (key: string) => void;
|
|
676
|
+
/**
|
|
677
|
+
* Custom className
|
|
678
|
+
*/
|
|
679
|
+
className?: string;
|
|
680
|
+
/**
|
|
681
|
+
* Custom style
|
|
682
|
+
*/
|
|
683
|
+
style?: React.CSSProperties;
|
|
684
|
+
}
|
|
685
|
+
/**
|
|
686
|
+
* Tab Component
|
|
687
|
+
*
|
|
688
|
+
* A tab component with line and card variants
|
|
689
|
+
*
|
|
690
|
+
* @example
|
|
691
|
+
* <Tab
|
|
692
|
+
* items={[
|
|
693
|
+
* { key: '1', label: 'Tab 1' },
|
|
694
|
+
* { key: '2', label: 'Tab 2' },
|
|
695
|
+
* ]}
|
|
696
|
+
* defaultActiveKey="1"
|
|
697
|
+
* />
|
|
698
|
+
*/
|
|
699
|
+
declare const Tabs: React.FC<TabsProps>;
|
|
700
|
+
|
|
701
|
+
interface TooltipProps extends Omit<TooltipProps$1, 'overlay'> {
|
|
702
|
+
/**
|
|
703
|
+
* Tooltip content
|
|
704
|
+
*/
|
|
705
|
+
content: React.ReactNode;
|
|
706
|
+
/**
|
|
707
|
+
* Tooltip variant
|
|
708
|
+
*/
|
|
709
|
+
variant?: 'black' | 'white';
|
|
710
|
+
/**
|
|
711
|
+
* Tooltip size (only for white variant)
|
|
712
|
+
*/
|
|
713
|
+
size?: 'small' | 'large';
|
|
714
|
+
/**
|
|
715
|
+
* Children element that triggers the tooltip
|
|
716
|
+
*/
|
|
717
|
+
children: React.ReactElement;
|
|
718
|
+
}
|
|
719
|
+
/**
|
|
720
|
+
* Tooltip Component
|
|
721
|
+
*
|
|
722
|
+
* Note: Coverage for this component may appear lower than expected due to
|
|
723
|
+
* styled-components CSS-in-JS template literals (lines 68-200+) which are
|
|
724
|
+
* not properly tracked by V8 coverage. The actual component logic is fully tested.
|
|
725
|
+
*
|
|
726
|
+
* @example
|
|
727
|
+
* // Basic black tooltip
|
|
728
|
+
* <Tooltip content="Tooltip text">
|
|
729
|
+
* <button>Hover me</button>
|
|
730
|
+
* </Tooltip>
|
|
731
|
+
*
|
|
732
|
+
* @example
|
|
733
|
+
* // White tooltip with small size
|
|
734
|
+
* <Tooltip content="Tooltip text" variant="white" size="small">
|
|
735
|
+
* <button>Hover me</button>
|
|
736
|
+
* </Tooltip>
|
|
737
|
+
*
|
|
738
|
+
* @example
|
|
739
|
+
* // White tooltip with large size
|
|
740
|
+
* <Tooltip content="Complex content" variant="white" size="large">
|
|
741
|
+
* <button>Hover me</button>
|
|
742
|
+
* </Tooltip>
|
|
743
|
+
*/
|
|
744
|
+
declare const Tooltip: React.FC<TooltipProps>;
|
|
745
|
+
|
|
746
|
+
type ToastPosition = 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' | 'top-center' | 'bottom-center';
|
|
747
|
+
interface ToastConfig {
|
|
748
|
+
/**
|
|
749
|
+
* Maximum number of toasts to show at once
|
|
750
|
+
*/
|
|
751
|
+
maxCount?: number;
|
|
752
|
+
/**
|
|
753
|
+
* Default duration for auto-close (ms)
|
|
754
|
+
*/
|
|
755
|
+
defaultDuration?: number;
|
|
756
|
+
/**
|
|
757
|
+
* Toast position on screen
|
|
758
|
+
*/
|
|
759
|
+
position?: ToastPosition;
|
|
760
|
+
/**
|
|
761
|
+
* Offset from edge (px)
|
|
762
|
+
*/
|
|
763
|
+
offset?: {
|
|
764
|
+
x?: number;
|
|
765
|
+
y?: number;
|
|
766
|
+
};
|
|
767
|
+
}
|
|
768
|
+
interface ZIndexConfig {
|
|
769
|
+
/**
|
|
770
|
+
* Z-index for toast notifications
|
|
771
|
+
*/
|
|
772
|
+
toast?: number;
|
|
773
|
+
/**
|
|
774
|
+
* Z-index for modals
|
|
775
|
+
*/
|
|
776
|
+
modal?: number;
|
|
777
|
+
/**
|
|
778
|
+
* Z-index for dropdowns
|
|
779
|
+
*/
|
|
780
|
+
dropdown?: number;
|
|
781
|
+
/**
|
|
782
|
+
* Z-index for tooltips
|
|
783
|
+
*/
|
|
784
|
+
tooltip?: number;
|
|
785
|
+
}
|
|
786
|
+
interface AnimationConfig {
|
|
787
|
+
/**
|
|
788
|
+
* Default animation duration (ms)
|
|
789
|
+
*/
|
|
790
|
+
duration?: number;
|
|
791
|
+
/**
|
|
792
|
+
* Default easing function
|
|
793
|
+
*/
|
|
794
|
+
easing?: string;
|
|
795
|
+
/**
|
|
796
|
+
* Disable all animations
|
|
797
|
+
*/
|
|
798
|
+
disabled?: boolean;
|
|
799
|
+
}
|
|
800
|
+
interface A11yConfig {
|
|
801
|
+
/**
|
|
802
|
+
* Announce messages to screen readers
|
|
803
|
+
*/
|
|
804
|
+
announceMessages?: boolean;
|
|
805
|
+
/**
|
|
806
|
+
* Show focus visible indicators
|
|
807
|
+
*/
|
|
808
|
+
focusVisible?: boolean;
|
|
809
|
+
/**
|
|
810
|
+
* Reduce motion for users who prefer it
|
|
811
|
+
*/
|
|
812
|
+
reduceMotion?: boolean;
|
|
813
|
+
}
|
|
814
|
+
interface I18nConfig {
|
|
815
|
+
/**
|
|
816
|
+
* Toast messages
|
|
817
|
+
*/
|
|
818
|
+
toast?: {
|
|
819
|
+
closeLabel?: string;
|
|
820
|
+
};
|
|
821
|
+
/**
|
|
822
|
+
* Button messages
|
|
823
|
+
*/
|
|
824
|
+
button?: {
|
|
825
|
+
loadingText?: string;
|
|
826
|
+
};
|
|
827
|
+
/**
|
|
828
|
+
* Common messages
|
|
829
|
+
*/
|
|
830
|
+
common?: {
|
|
831
|
+
confirm?: string;
|
|
832
|
+
cancel?: string;
|
|
833
|
+
ok?: string;
|
|
834
|
+
};
|
|
835
|
+
}
|
|
836
|
+
interface UIConfig {
|
|
837
|
+
/**
|
|
838
|
+
* Theme configuration (required)
|
|
839
|
+
*/
|
|
840
|
+
theme: any;
|
|
841
|
+
/**
|
|
842
|
+
* Icon registry (optional)
|
|
843
|
+
*/
|
|
844
|
+
icons?: IconRegistry;
|
|
845
|
+
/**
|
|
846
|
+
* Toast configuration
|
|
847
|
+
*/
|
|
848
|
+
toast?: ToastConfig;
|
|
849
|
+
/**
|
|
850
|
+
* Locale code (e.g., 'zh-CN', 'en-US')
|
|
851
|
+
*/
|
|
852
|
+
locale?: string;
|
|
853
|
+
/**
|
|
854
|
+
* Internationalization configuration
|
|
855
|
+
*/
|
|
856
|
+
i18n?: I18nConfig;
|
|
857
|
+
/**
|
|
858
|
+
* Z-index layer management
|
|
859
|
+
*/
|
|
860
|
+
zIndex?: ZIndexConfig;
|
|
861
|
+
/**
|
|
862
|
+
* Animation configuration
|
|
863
|
+
*/
|
|
864
|
+
animation?: AnimationConfig;
|
|
865
|
+
/**
|
|
866
|
+
* Accessibility configuration
|
|
867
|
+
*/
|
|
868
|
+
a11y?: A11yConfig;
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
interface UIConfigProviderProps {
|
|
872
|
+
/**
|
|
873
|
+
* UI configuration
|
|
874
|
+
*/
|
|
875
|
+
config: UIConfig;
|
|
876
|
+
/**
|
|
877
|
+
* Children components
|
|
878
|
+
*/
|
|
879
|
+
children: React.ReactNode;
|
|
880
|
+
}
|
|
881
|
+
/**
|
|
882
|
+
* UIConfigProvider Component
|
|
883
|
+
*
|
|
884
|
+
* Unified provider for all UI components and global configurations
|
|
885
|
+
* Includes ThemeProvider, IconProvider, ToastContainer, and other settings
|
|
886
|
+
*
|
|
887
|
+
* @example
|
|
888
|
+
* import { UIConfigProvider } from '@officesdk/design';
|
|
889
|
+
* import { lightTheme } from '@officesdk/design/theme';
|
|
890
|
+
* import { iconRegistry } from '@officesdk/design/icons';
|
|
891
|
+
*
|
|
892
|
+
* <UIConfigProvider config={{
|
|
893
|
+
* theme: lightTheme,
|
|
894
|
+
* icons: iconRegistry,
|
|
895
|
+
* toast: {
|
|
896
|
+
* defaultDuration: 3000,
|
|
897
|
+
* maxCount: 5,
|
|
898
|
+
* },
|
|
899
|
+
* }}>
|
|
900
|
+
* <App />
|
|
901
|
+
* </UIConfigProvider>
|
|
902
|
+
*/
|
|
903
|
+
declare const UIConfigProvider: React.FC<UIConfigProviderProps>;
|
|
904
|
+
/**
|
|
905
|
+
* Hook to access UI configuration
|
|
906
|
+
*
|
|
907
|
+
* @example
|
|
908
|
+
* const config = useUIConfig();
|
|
909
|
+
* console.log(config.theme);
|
|
910
|
+
* console.log(config.locale);
|
|
911
|
+
*/
|
|
912
|
+
declare const useUIConfig: () => UIConfig;
|
|
913
|
+
|
|
914
|
+
/**
|
|
915
|
+
* Create UI configuration with default values
|
|
916
|
+
*
|
|
917
|
+
* @example
|
|
918
|
+
* import { createUIConfig } from '@officesdk/design';
|
|
919
|
+
* import { lightTheme } from '@officesdk/design/theme';
|
|
920
|
+
* import { iconRegistry } from '@officesdk/design/icons';
|
|
921
|
+
*
|
|
922
|
+
* const config = createUIConfig({
|
|
923
|
+
* theme: lightTheme,
|
|
924
|
+
* icons: iconRegistry,
|
|
925
|
+
* toast: {
|
|
926
|
+
* defaultDuration: 3000,
|
|
927
|
+
* },
|
|
928
|
+
* });
|
|
929
|
+
*/
|
|
930
|
+
declare const createUIConfig: (config: UIConfig) => UIConfig;
|
|
931
|
+
/**
|
|
932
|
+
* Merge multiple configs (useful for extending base configs)
|
|
933
|
+
*/
|
|
934
|
+
declare const mergeUIConfig: (baseConfig: UIConfig, ...configs: Partial<UIConfig>[]) => UIConfig;
|
|
935
|
+
|
|
936
|
+
export { type A11yConfig, type AnimationConfig, Button, type ButtonProps, Checkbox, type CheckboxProps, type I18nConfig, Icon, type IconComponent, type IconProps, IconProvider, type IconProviderProps, type IconRegistry, Input, type InputProps, Radio, type RadioProps, SearchInput, type SearchInputProps, Slider, type SliderProps, SpinButton, type SpinButtonProps, Switch, type SwitchProps, type TabItem, Tabs, type TabsProps, Toast, type ToastConfig, ToastContainer, type ToastContainerProps, type ToastPosition, type ToastProps, Tooltip, type TooltipProps, type UIConfig, UIConfigProvider, type UIConfigProviderProps, type ZIndexConfig, createUIConfig, mergeUIConfig, useIconRegistry, useToast, useUIConfig };
|