@officesdk/design 0.1.8 → 0.1.9
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/components/cjs/index.d.ts +339 -13
- package/dist/components/cjs/index.js +1260 -287
- package/dist/components/cjs/index.js.map +1 -1
- package/dist/components/esm/index.d.ts +339 -13
- package/dist/components/esm/index.js +1253 -289
- package/dist/components/esm/index.js.map +1 -1
- package/dist/theme/cjs/index.js +260 -155
- package/dist/theme/cjs/index.js.map +1 -1
- package/dist/theme/esm/index.js +260 -155
- package/dist/theme/esm/index.js.map +1 -1
- package/package.json +4 -2
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TooltipProps as TooltipProps$1 } from 'rc-tooltip/lib/Tooltip';
|
|
3
|
-
import {
|
|
3
|
+
import { DropdownProps as DropdownProps$1 } from 'rc-dropdown';
|
|
4
|
+
import * as styled_components from 'styled-components';
|
|
4
5
|
import { ThemedStyledInterface } from 'styled-components';
|
|
6
|
+
import { Theme } from '@officesdk/design-theme';
|
|
5
7
|
|
|
6
8
|
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
7
9
|
/**
|
|
@@ -342,8 +344,13 @@ interface SliderProps {
|
|
|
342
344
|
*/
|
|
343
345
|
declare const Slider: React.FC<SliderProps>;
|
|
344
346
|
|
|
345
|
-
type InputSize = '
|
|
347
|
+
type InputSize = 'mini' | 'small' | 'medium' | 'large';
|
|
348
|
+
type LineType = 'outlined' | 'underlined';
|
|
346
349
|
interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix'> {
|
|
350
|
+
/**
|
|
351
|
+
* Input line type
|
|
352
|
+
*/
|
|
353
|
+
lineType?: LineType;
|
|
347
354
|
/**
|
|
348
355
|
* Input size
|
|
349
356
|
*/
|
|
@@ -364,6 +371,18 @@ interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, '
|
|
|
364
371
|
* Node to display after the input
|
|
365
372
|
*/
|
|
366
373
|
suffixNode?: React.ReactNode;
|
|
374
|
+
/**
|
|
375
|
+
* Whether to show clear button when input has value
|
|
376
|
+
*/
|
|
377
|
+
clearable?: boolean;
|
|
378
|
+
/**
|
|
379
|
+
* Clear button click handler
|
|
380
|
+
*/
|
|
381
|
+
onClear?: () => void;
|
|
382
|
+
/**
|
|
383
|
+
* Custom clear icon
|
|
384
|
+
*/
|
|
385
|
+
clearIcon?: React.ReactNode;
|
|
367
386
|
/**
|
|
368
387
|
* Custom className
|
|
369
388
|
*/
|
|
@@ -377,12 +396,20 @@ interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, '
|
|
|
377
396
|
* Input Component
|
|
378
397
|
*
|
|
379
398
|
* @example
|
|
380
|
-
* // Basic input
|
|
399
|
+
* // Basic outlined input (default)
|
|
381
400
|
* <Input placeholder="Enter text" />
|
|
382
401
|
*
|
|
383
402
|
* @example
|
|
403
|
+
* // Underlined input
|
|
404
|
+
* <Input lineType="underlined" placeholder="Enter text" />
|
|
405
|
+
*
|
|
406
|
+
* @example
|
|
384
407
|
* // Input with prefix and suffix
|
|
385
|
-
* <Input prefixNode={<SearchIcon />} suffixNode={<
|
|
408
|
+
* <Input prefixNode={<SearchIcon />} suffixNode={<Icon />} />
|
|
409
|
+
*
|
|
410
|
+
* @example
|
|
411
|
+
* // Input with clearable
|
|
412
|
+
* <Input clearable onClear={() => console.log('cleared')} />
|
|
386
413
|
*
|
|
387
414
|
* @example
|
|
388
415
|
* // Input with error state
|
|
@@ -390,11 +417,15 @@ interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, '
|
|
|
390
417
|
*/
|
|
391
418
|
declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
392
419
|
|
|
393
|
-
interface SearchInputProps extends Omit<InputProps, '
|
|
420
|
+
interface SearchInputProps extends Omit<InputProps, 'prefixNode' | 'suffixNode'> {
|
|
394
421
|
/**
|
|
395
|
-
*
|
|
422
|
+
* Line type (outlined or underlined)
|
|
396
423
|
*/
|
|
397
|
-
|
|
424
|
+
lineType?: 'outlined' | 'underlined';
|
|
425
|
+
/**
|
|
426
|
+
* SearchInput size
|
|
427
|
+
*/
|
|
428
|
+
size?: 'mini' | 'small' | 'medium' | 'large';
|
|
398
429
|
/**
|
|
399
430
|
* Whether to show the clear button when input has value
|
|
400
431
|
*/
|
|
@@ -404,27 +435,52 @@ interface SearchInputProps extends Omit<InputProps, 'size' | 'prefixNode'> {
|
|
|
404
435
|
*/
|
|
405
436
|
onClear?: () => void;
|
|
406
437
|
/**
|
|
407
|
-
* Custom search icon
|
|
438
|
+
* Custom search icon (URL string or React node)
|
|
408
439
|
*/
|
|
409
|
-
searchIcon?: React.ReactNode;
|
|
440
|
+
searchIcon?: string | React.ReactNode;
|
|
410
441
|
}
|
|
411
442
|
/**
|
|
412
443
|
* SearchInput Component
|
|
413
444
|
*
|
|
445
|
+
* A wrapper around Input component with search icon and clear functionality
|
|
446
|
+
*
|
|
414
447
|
* @example
|
|
415
448
|
* // Basic search input
|
|
416
449
|
* <SearchInput placeholder="Search..." />
|
|
417
450
|
*
|
|
418
451
|
* @example
|
|
419
|
-
* //
|
|
420
|
-
* <SearchInput
|
|
452
|
+
* // Underlined search input
|
|
453
|
+
* <SearchInput lineType="underlined" placeholder="Search..." />
|
|
454
|
+
*
|
|
455
|
+
* @example
|
|
456
|
+
* // Search input without clearable
|
|
457
|
+
* <SearchInput clearable={false} placeholder="Search..." />
|
|
421
458
|
*
|
|
422
459
|
* @example
|
|
423
|
-
* //
|
|
460
|
+
* // Different sizes
|
|
461
|
+
* <SearchInput size="small" placeholder="Search..." />
|
|
462
|
+
* <SearchInput size="medium" placeholder="Search..." />
|
|
424
463
|
* <SearchInput size="large" placeholder="Search..." />
|
|
425
464
|
*/
|
|
426
465
|
declare const SearchInput: React.ForwardRefExoticComponent<SearchInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
427
466
|
|
|
467
|
+
/**
|
|
468
|
+
* UnderlinedInput Component
|
|
469
|
+
*
|
|
470
|
+
* @deprecated Use <Input lineType="underlined" /> instead
|
|
471
|
+
*
|
|
472
|
+
* This component is a simple alias for Input with lineType="underlined"
|
|
473
|
+
* and will be removed in a future version.
|
|
474
|
+
*
|
|
475
|
+
* @example
|
|
476
|
+
* // Old way (deprecated)
|
|
477
|
+
* <UnderlinedInput placeholder="Search..." />
|
|
478
|
+
*
|
|
479
|
+
* // New way (recommended)
|
|
480
|
+
* <Input lineType="underlined" placeholder="Search..." />
|
|
481
|
+
*/
|
|
482
|
+
declare const UnderlinedInput: React.ForwardRefExoticComponent<Omit<InputProps, "lineType"> & React.RefAttributes<HTMLInputElement>>;
|
|
483
|
+
|
|
428
484
|
interface NumberInputProps {
|
|
429
485
|
/**
|
|
430
486
|
* Current value
|
|
@@ -953,6 +1009,276 @@ interface ToolbarButtonProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
|
|
|
953
1009
|
*/
|
|
954
1010
|
declare const ToolbarButton: React.FC<ToolbarButtonProps>;
|
|
955
1011
|
|
|
1012
|
+
type DropdownButtonSize = 'large' | 'medium';
|
|
1013
|
+
type DropdownButtonVariant = 'framed' | 'frameless';
|
|
1014
|
+
interface DropdownButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'type'> {
|
|
1015
|
+
/**
|
|
1016
|
+
* Button variant
|
|
1017
|
+
* - framed: with border (40px large)
|
|
1018
|
+
* - frameless: without border (28px medium)
|
|
1019
|
+
*/
|
|
1020
|
+
variant?: DropdownButtonVariant;
|
|
1021
|
+
/**
|
|
1022
|
+
* Button size
|
|
1023
|
+
*/
|
|
1024
|
+
size?: DropdownButtonSize;
|
|
1025
|
+
/**
|
|
1026
|
+
* Display value/label
|
|
1027
|
+
*/
|
|
1028
|
+
value?: string;
|
|
1029
|
+
/**
|
|
1030
|
+
* Placeholder when no value
|
|
1031
|
+
*/
|
|
1032
|
+
placeholder?: string;
|
|
1033
|
+
/**
|
|
1034
|
+
* Optional icon (URL string or ReactNode)
|
|
1035
|
+
*/
|
|
1036
|
+
icon?: string | React.ReactNode;
|
|
1037
|
+
/**
|
|
1038
|
+
* Custom indicator/arrow icon
|
|
1039
|
+
*/
|
|
1040
|
+
indicatorIcon?: React.ReactNode;
|
|
1041
|
+
/**
|
|
1042
|
+
* Whether the dropdown is open (controls arrow rotation)
|
|
1043
|
+
*/
|
|
1044
|
+
open?: boolean;
|
|
1045
|
+
/**
|
|
1046
|
+
* Whether the button is disabled
|
|
1047
|
+
*/
|
|
1048
|
+
disabled?: boolean;
|
|
1049
|
+
/**
|
|
1050
|
+
* Error state
|
|
1051
|
+
*/
|
|
1052
|
+
error?: boolean;
|
|
1053
|
+
/**
|
|
1054
|
+
* Custom className
|
|
1055
|
+
*/
|
|
1056
|
+
className?: string;
|
|
1057
|
+
/**
|
|
1058
|
+
* Custom style
|
|
1059
|
+
*/
|
|
1060
|
+
style?: React.CSSProperties;
|
|
1061
|
+
/**
|
|
1062
|
+
* Custom text style
|
|
1063
|
+
*/
|
|
1064
|
+
textStyle?: React.CSSProperties;
|
|
1065
|
+
}
|
|
1066
|
+
/**
|
|
1067
|
+
* DropdownButton Component
|
|
1068
|
+
*
|
|
1069
|
+
* A button component for triggering dropdown menus
|
|
1070
|
+
*
|
|
1071
|
+
* @example
|
|
1072
|
+
* // Framed dropdown button (with border, 40px)
|
|
1073
|
+
* <DropdownButton variant="framed" value="Option 1" />
|
|
1074
|
+
*
|
|
1075
|
+
* @example
|
|
1076
|
+
* // Frameless dropdown button (no border, 28px)
|
|
1077
|
+
* <DropdownButton variant="frameless" value="Option 1" />
|
|
1078
|
+
*
|
|
1079
|
+
* @example
|
|
1080
|
+
* // With icon
|
|
1081
|
+
* <DropdownButton icon={<CustomIcon />} value="Option 1" />
|
|
1082
|
+
*
|
|
1083
|
+
* @example
|
|
1084
|
+
* // Open state (arrow rotated)
|
|
1085
|
+
* <DropdownButton open value="Option 1" />
|
|
1086
|
+
*/
|
|
1087
|
+
declare const DropdownButton: React.ForwardRefExoticComponent<DropdownButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
1088
|
+
|
|
1089
|
+
interface MenuItem {
|
|
1090
|
+
type?: 'item';
|
|
1091
|
+
key: string;
|
|
1092
|
+
label: string;
|
|
1093
|
+
description?: string;
|
|
1094
|
+
icon?: string | React.ReactNode;
|
|
1095
|
+
disabled?: boolean;
|
|
1096
|
+
selected?: boolean;
|
|
1097
|
+
selectable?: boolean;
|
|
1098
|
+
children?: MenuItem[];
|
|
1099
|
+
onClick?: (key: string) => void;
|
|
1100
|
+
}
|
|
1101
|
+
interface MenuGroup {
|
|
1102
|
+
type: 'group';
|
|
1103
|
+
key: string;
|
|
1104
|
+
label: string;
|
|
1105
|
+
children: MenuItem[];
|
|
1106
|
+
}
|
|
1107
|
+
interface MenuDivider {
|
|
1108
|
+
type: 'divider';
|
|
1109
|
+
key: string;
|
|
1110
|
+
}
|
|
1111
|
+
type MenuItemType = MenuItem | MenuGroup | MenuDivider;
|
|
1112
|
+
interface MenuProps {
|
|
1113
|
+
/**
|
|
1114
|
+
* Menu items
|
|
1115
|
+
*/
|
|
1116
|
+
items: MenuItemType[];
|
|
1117
|
+
/**
|
|
1118
|
+
* Currently selected key(s)
|
|
1119
|
+
*/
|
|
1120
|
+
selectedKeys?: string[];
|
|
1121
|
+
/**
|
|
1122
|
+
* Open submenu keys (controlled)
|
|
1123
|
+
*/
|
|
1124
|
+
openKeys?: string[];
|
|
1125
|
+
/**
|
|
1126
|
+
* Menu size
|
|
1127
|
+
*/
|
|
1128
|
+
size?: 'medium' | 'large';
|
|
1129
|
+
/**
|
|
1130
|
+
* Whether to show search box
|
|
1131
|
+
*/
|
|
1132
|
+
searchable?: boolean;
|
|
1133
|
+
/**
|
|
1134
|
+
* Search placeholder
|
|
1135
|
+
*/
|
|
1136
|
+
searchPlaceholder?: string;
|
|
1137
|
+
/**
|
|
1138
|
+
* Max height for scrolling
|
|
1139
|
+
*/
|
|
1140
|
+
maxHeight?: number;
|
|
1141
|
+
/**
|
|
1142
|
+
* Enable virtual scrolling
|
|
1143
|
+
*/
|
|
1144
|
+
virtual?: boolean;
|
|
1145
|
+
/**
|
|
1146
|
+
* Whether to always reserve space for active icon (for description alignment)
|
|
1147
|
+
*/
|
|
1148
|
+
reserveActiveIconSpace?: boolean;
|
|
1149
|
+
/**
|
|
1150
|
+
* Select handler
|
|
1151
|
+
*/
|
|
1152
|
+
onSelect?: (key: string) => void;
|
|
1153
|
+
/**
|
|
1154
|
+
* Search handler
|
|
1155
|
+
*/
|
|
1156
|
+
onSearch?: (value: string) => void;
|
|
1157
|
+
/**
|
|
1158
|
+
* Open keys change handler
|
|
1159
|
+
*/
|
|
1160
|
+
onOpenChange?: (keys: string[]) => void;
|
|
1161
|
+
/**
|
|
1162
|
+
* Custom className
|
|
1163
|
+
*/
|
|
1164
|
+
className?: string;
|
|
1165
|
+
/**
|
|
1166
|
+
* Custom style
|
|
1167
|
+
*/
|
|
1168
|
+
style?: React.CSSProperties;
|
|
1169
|
+
}
|
|
1170
|
+
/**
|
|
1171
|
+
* Menu Component
|
|
1172
|
+
*
|
|
1173
|
+
* A menu component based on rc-menu with virtual scrolling support
|
|
1174
|
+
*
|
|
1175
|
+
* @example
|
|
1176
|
+
* // Basic menu
|
|
1177
|
+
* <Menu
|
|
1178
|
+
* items={[
|
|
1179
|
+
* { key: '1', label: 'Option 1' },
|
|
1180
|
+
* { key: '2', label: 'Option 2' },
|
|
1181
|
+
* ]}
|
|
1182
|
+
* onSelect={(key) => console.log(key)}
|
|
1183
|
+
* />
|
|
1184
|
+
*
|
|
1185
|
+
* @example
|
|
1186
|
+
* // Menu with groups and dividers
|
|
1187
|
+
* <Menu
|
|
1188
|
+
* items={[
|
|
1189
|
+
* { type: 'group', key: 'g1', label: 'Group A', children: [...] },
|
|
1190
|
+
* { type: 'divider', key: 'd1' },
|
|
1191
|
+
* { key: '1', label: 'Option 1' },
|
|
1192
|
+
* ]}
|
|
1193
|
+
* />
|
|
1194
|
+
*
|
|
1195
|
+
* @example
|
|
1196
|
+
* // Menu with search
|
|
1197
|
+
* <Menu
|
|
1198
|
+
* searchable
|
|
1199
|
+
* items={items}
|
|
1200
|
+
* onSearch={(value) => console.log(value)}
|
|
1201
|
+
* />
|
|
1202
|
+
*/
|
|
1203
|
+
declare const Menu: React.FC<MenuProps>;
|
|
1204
|
+
|
|
1205
|
+
interface DropdownProps extends Omit<Partial<DropdownProps$1>, 'prefixCls' | 'placement'> {
|
|
1206
|
+
/**
|
|
1207
|
+
* Dropdown overlay content (usually a Menu component)
|
|
1208
|
+
*/
|
|
1209
|
+
overlay?: React.ReactElement | (() => React.ReactElement);
|
|
1210
|
+
/**
|
|
1211
|
+
* Trigger action (click, hover, contextMenu)
|
|
1212
|
+
*/
|
|
1213
|
+
trigger?: ('click' | 'hover' | 'contextMenu')[];
|
|
1214
|
+
/**
|
|
1215
|
+
* Placement of dropdown
|
|
1216
|
+
*/
|
|
1217
|
+
placement?: 'top' | 'topLeft' | 'topRight' | 'bottom' | 'bottomLeft' | 'bottomRight';
|
|
1218
|
+
/**
|
|
1219
|
+
* Whether dropdown is visible (controlled)
|
|
1220
|
+
*/
|
|
1221
|
+
visible?: boolean;
|
|
1222
|
+
/**
|
|
1223
|
+
* Default visibility (uncontrolled)
|
|
1224
|
+
*/
|
|
1225
|
+
defaultVisible?: boolean;
|
|
1226
|
+
/**
|
|
1227
|
+
* Callback when visibility changes
|
|
1228
|
+
*/
|
|
1229
|
+
onVisibleChange?: (visible: boolean) => void;
|
|
1230
|
+
/**
|
|
1231
|
+
* Children element that triggers the dropdown
|
|
1232
|
+
*/
|
|
1233
|
+
children: React.ReactElement;
|
|
1234
|
+
/**
|
|
1235
|
+
* Dropdown container class name
|
|
1236
|
+
*/
|
|
1237
|
+
overlayClassName?: string;
|
|
1238
|
+
/**
|
|
1239
|
+
* Function to get the container element for the dropdown
|
|
1240
|
+
*/
|
|
1241
|
+
getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;
|
|
1242
|
+
}
|
|
1243
|
+
/**
|
|
1244
|
+
* Dropdown Component
|
|
1245
|
+
*
|
|
1246
|
+
* A dropdown container component based on rc-dropdown
|
|
1247
|
+
*
|
|
1248
|
+
* @example
|
|
1249
|
+
* // Basic dropdown with menu
|
|
1250
|
+
* <Dropdown
|
|
1251
|
+
* overlay={<Menu items={items} />}
|
|
1252
|
+
* trigger={['click']}
|
|
1253
|
+
* >
|
|
1254
|
+
* <DropdownButton value="Select" />
|
|
1255
|
+
* </Dropdown>
|
|
1256
|
+
*
|
|
1257
|
+
* @example
|
|
1258
|
+
* // Controlled dropdown
|
|
1259
|
+
* <Dropdown
|
|
1260
|
+
* visible={open}
|
|
1261
|
+
* onVisibleChange={setOpen}
|
|
1262
|
+
* overlay={<Menu items={items} />}
|
|
1263
|
+
* >
|
|
1264
|
+
* <Button>Click me</Button>
|
|
1265
|
+
* </Dropdown>
|
|
1266
|
+
*
|
|
1267
|
+
* @example
|
|
1268
|
+
* // Custom trigger
|
|
1269
|
+
* <Dropdown
|
|
1270
|
+
* overlay={<Menu items={items} />}
|
|
1271
|
+
* trigger={['hover']}
|
|
1272
|
+
* placement="bottomLeft"
|
|
1273
|
+
* >
|
|
1274
|
+
* <span>Hover me</span>
|
|
1275
|
+
* </Dropdown>
|
|
1276
|
+
*/
|
|
1277
|
+
declare const Dropdown: React.FC<DropdownProps>;
|
|
1278
|
+
|
|
1279
|
+
declare const DropdownGlobalStyles: styled_components.GlobalStyleComponent<{}, styled_components.DefaultTheme>;
|
|
1280
|
+
declare const MenuGlobalStyles: styled_components.GlobalStyleComponent<{}, styled_components.DefaultTheme>;
|
|
1281
|
+
|
|
956
1282
|
type ToastPosition = 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' | 'top-center' | 'bottom-center';
|
|
957
1283
|
interface ToastConfig {
|
|
958
1284
|
/**
|
|
@@ -1147,4 +1473,4 @@ declare const styled: ThemedStyledInterface<Theme>;
|
|
|
1147
1473
|
|
|
1148
1474
|
declare const getGlobalTheme: () => Theme;
|
|
1149
1475
|
|
|
1150
|
-
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, NumberInput, type NumberInputProps, 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 ToastContainerConfig, type ToastContainerProps, type ToastPosition, type ToastProps, ToolbarButton, type ToolbarButtonProps, Tooltip, type TooltipProps, type UIConfig, UIConfigProvider, type UIConfigProviderProps, type ZIndexConfig, createUIConfig, getGlobalTheme, mergeUIConfig, styled, toast, useIconRegistry, useToast, useUIConfig };
|
|
1476
|
+
export { type A11yConfig, type AnimationConfig, Button, type ButtonProps, Checkbox, type CheckboxProps, Dropdown, DropdownButton, type DropdownButtonProps, DropdownGlobalStyles, type DropdownProps, type I18nConfig, Icon, type IconComponent, type IconProps, IconProvider, type IconProviderProps, type IconRegistry, Input, type InputProps, Menu, type MenuDivider, MenuGlobalStyles, type MenuGroup, type MenuItem, type MenuItemType, type MenuProps, NumberInput, type NumberInputProps, 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 ToastContainerConfig, type ToastContainerProps, type ToastPosition, type ToastProps, ToolbarButton, type ToolbarButtonProps, Tooltip, type TooltipProps, type UIConfig, UIConfigProvider, type UIConfigProviderProps, UnderlinedInput, type InputProps as UnderlinedInputProps, type ZIndexConfig, createUIConfig, getGlobalTheme, mergeUIConfig, styled, toast, useIconRegistry, useToast, useUIConfig };
|