aha-components 1.7.12 → 1.8.2
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 +10 -0
- package/dist/Avatar.esm.js +2 -0
- package/dist/Avatar.esm.js.map +1 -0
- package/dist/Avatar.js +2 -0
- package/dist/Avatar.js.map +1 -0
- package/dist/Badge.esm.js +2 -0
- package/dist/Badge.esm.js.map +1 -0
- package/dist/Badge.js +2 -0
- package/dist/Badge.js.map +1 -0
- package/dist/Checkbox.esm.js +1 -1
- package/dist/Checkbox.esm.js.map +1 -1
- package/dist/Checkbox.js +1 -1
- package/dist/Checkbox.js.map +1 -1
- package/dist/Input.esm.js +1 -1
- package/dist/Input.esm.js.map +1 -1
- package/dist/Input.js +1 -1
- package/dist/Input.js.map +1 -1
- package/dist/Pagination.esm.js +1 -1
- package/dist/Pagination.esm.js.map +1 -1
- package/dist/Pagination.js +1 -1
- package/dist/Pagination.js.map +1 -1
- package/dist/Radio.esm.js +1 -1
- package/dist/Radio.esm.js.map +1 -1
- package/dist/Radio.js +1 -1
- package/dist/Radio.js.map +1 -1
- package/dist/Table.esm.js +1 -1
- package/dist/Table.esm.js.map +1 -1
- package/dist/Table.js +1 -1
- package/dist/Table.js.map +1 -1
- package/dist/Tag.esm.js +1 -1
- package/dist/Tag.esm.js.map +1 -1
- package/dist/Tag.js +1 -1
- package/dist/Tag.js.map +1 -1
- package/dist/Textarea.esm.js +1 -1
- package/dist/Textarea.esm.js.map +1 -1
- package/dist/Textarea.js +1 -1
- package/dist/Textarea.js.map +1 -1
- package/dist/components/Avatar/Avatar.stories.d.ts +12 -0
- package/dist/components/Avatar/index.d.ts +42 -0
- package/dist/components/Badge/Badge.stories.d.ts +15 -0
- package/dist/components/Badge/index.d.ts +71 -0
- package/dist/components/Checkbox/Checkbox.stories 2.d.ts +12 -0
- package/dist/components/Checkbox/Checkbox.stories.d.ts +5 -4
- package/dist/components/Checkbox/index 2.d.ts +12 -0
- package/dist/components/Checkbox/index.d.ts +6 -0
- package/dist/components/DatePicker/DatePicker.stories 2.d.ts +25 -0
- package/dist/components/DatePicker/index 2.d.ts +96 -0
- package/dist/components/Drawer/Drawer.stories 2.d.ts +9 -0
- package/dist/components/Drawer/index 2.d.ts +58 -0
- package/dist/components/Form/Form.stories 2.d.ts +15 -0
- package/dist/components/Form/FormContext 2.d.ts +41 -0
- package/dist/components/Form/FormItem 2.d.ts +58 -0
- package/dist/components/Form/index 2.d.ts +85 -0
- package/dist/components/Input/Input.stories 2.d.ts +16 -0
- package/dist/components/Input/Input.stories.d.ts +7 -4
- package/dist/components/Input/InputGroup.d.ts +25 -0
- package/dist/components/Input/InputTags.d.ts +17 -0
- package/dist/components/Input/index 2.d.ts +41 -0
- package/dist/components/Input/index.d.ts +7 -18
- package/dist/components/Loading/Loading.stories 2.d.ts +11 -0
- package/dist/components/Loading/index 2.d.ts +10 -0
- package/dist/components/MenuList/MenuList.stories 2.d.ts +17 -0
- package/dist/components/MenuList/MenuList.test 2.d.ts +1 -0
- package/dist/components/MenuList/index 2.d.ts +85 -0
- package/dist/components/Pagination/Pagination.stories 2.d.ts +16 -0
- package/dist/components/Pagination/index 2.d.ts +27 -0
- package/dist/components/Popover/Popover.stories 2.d.ts +11 -0
- package/dist/components/Popover/index 2.d.ts +31 -0
- package/dist/components/Progress/Progress.stories 2.d.ts +18 -0
- package/dist/components/Progress/Progress.test 2.d.ts +1 -0
- package/dist/components/Progress/index 2.d.ts +33 -0
- package/dist/components/Radio/Radio.stories 2.d.ts +10 -0
- package/dist/components/Radio/Radio.stories.d.ts +6 -4
- package/dist/components/Radio/index 2.d.ts +13 -0
- package/dist/components/Radio/index.d.ts +6 -0
- package/dist/components/Select/Select.stories 2.d.ts +17 -0
- package/dist/components/Select/index 2.d.ts +74 -0
- package/dist/components/Switch/Switch.stories 2.d.ts +14 -0
- package/dist/components/Switch/index 2.d.ts +27 -0
- package/dist/components/Tab/Tab.stories 2.d.ts +19 -0
- package/dist/components/Tab/index 2.d.ts +26 -0
- package/dist/components/Table/Table.stories 2.d.ts +21 -0
- package/dist/components/Table/index 2.d.ts +167 -0
- package/dist/components/Tag/Tag.stories.d.ts +5 -8
- package/dist/components/Tag/index.d.ts +24 -2
- package/dist/components/Textarea/Textarea.stories 2.d.ts +15 -0
- package/dist/components/Textarea/Textarea.stories.d.ts +3 -6
- package/dist/components/Textarea/TextareaTags.d.ts +8 -0
- package/dist/components/Textarea/index 2.d.ts +38 -0
- package/dist/components/Textarea/index.d.ts +6 -17
- package/dist/components/Tooltip/Tooltip.stories 2.d.ts +20 -0
- package/dist/components/Tooltip/index 2.d.ts +35 -0
- package/dist/design-tokens/theme.css +26 -0
- package/dist/design-tokens/theme.tailwind4.css +26 -0
- package/dist/icons/index 2.d.ts +33 -0
- package/dist/index.css +4810 -1
- package/dist/index.d.ts +195 -39
- package/dist/index.esm.css +4810 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/stories/DesignTokens.stories 2.d.ts +5 -0
- package/dist/theme/Theme.stories 2.d.ts +10 -0
- package/dist/theme/ThemeContext 2.d.ts +11 -0
- package/dist/theme/utils 2.d.ts +10 -0
- package/dist/theme.css +26 -0
- package/dist/tokens.d.ts +30 -0
- package/package.json +1 -1
- package/dist/AlertComponent.esm.js +0 -2
- package/dist/AlertComponent.esm.js.map +0 -1
- package/dist/AlertComponent.js +0 -2
- package/dist/AlertComponent.js.map +0 -1
- package/dist/Card.esm.js +0 -2
- package/dist/Card.esm.js.map +0 -1
- package/dist/Card.js +0 -2
- package/dist/Card.js.map +0 -1
- package/dist/TestComponent.esm.js +0 -2
- package/dist/TestComponent.esm.js.map +0 -1
- package/dist/TestComponent.js +0 -2
- package/dist/TestComponent.js.map +0 -1
- package/dist/Toast.css +0 -1
- package/dist/Toast.esm.css +0 -1
- package/dist/components/AlertComponent/index.d.ts +0 -9
- package/dist/components/Card/index.d.ts +0 -10
- package/dist/components/TestComponent/index.d.ts +0 -7
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type SortOrder = 'ascend' | 'descend' | null;
|
|
3
|
+
export type TableSize = 'small' | 'middle' | 'large';
|
|
4
|
+
export type TableLayout = 'auto' | 'fixed';
|
|
5
|
+
export interface SorterResult<T = any> {
|
|
6
|
+
column?: ColumnType<T>;
|
|
7
|
+
order?: SortOrder;
|
|
8
|
+
field?: string | string[];
|
|
9
|
+
columnKey?: string | string[];
|
|
10
|
+
}
|
|
11
|
+
export interface TableCurrentDataSource<T = any> {
|
|
12
|
+
currentDataSource: T[];
|
|
13
|
+
action: 'paginate' | 'sort';
|
|
14
|
+
}
|
|
15
|
+
export interface SelectionItem {
|
|
16
|
+
key: string | number;
|
|
17
|
+
text: React.ReactNode;
|
|
18
|
+
onSelect?: (changeableRowKeys: (string | number)[]) => void;
|
|
19
|
+
}
|
|
20
|
+
export interface TableRowSelection<T = any> {
|
|
21
|
+
type?: 'checkbox' | 'radio';
|
|
22
|
+
selectedRowKeys?: (string | number)[];
|
|
23
|
+
defaultSelectedRowKeys?: (string | number)[];
|
|
24
|
+
onChange?: (selectedRowKeys: (string | number)[], selectedRows: T[]) => void;
|
|
25
|
+
onSelect?: (record: T, selected: boolean, selectedRows: T[], nativeEvent: Event) => void;
|
|
26
|
+
onSelectAll?: (selected: boolean, selectedRows: T[], changeRows: T[]) => void;
|
|
27
|
+
onSelectInvert?: (selectedRowKeys: (string | number)[]) => void;
|
|
28
|
+
onSelectNone?: () => void;
|
|
29
|
+
getCheckboxProps?: (record: T) => {
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
name?: string;
|
|
32
|
+
};
|
|
33
|
+
hideSelectAll?: boolean;
|
|
34
|
+
fixed?: boolean | 'left' | 'right';
|
|
35
|
+
columnWidth?: string | number;
|
|
36
|
+
columnTitle?: string | React.ReactNode;
|
|
37
|
+
checkStrictly?: boolean;
|
|
38
|
+
preserveSelectedRowKeys?: boolean;
|
|
39
|
+
renderCell?: (checked: boolean, record: T, index: number, node: React.ReactNode) => React.ReactNode;
|
|
40
|
+
}
|
|
41
|
+
export interface ColumnType<T = any> {
|
|
42
|
+
title?: React.ReactNode | ((props: {
|
|
43
|
+
sortOrder?: SortOrder;
|
|
44
|
+
sortColumn?: ColumnType<T>;
|
|
45
|
+
}) => React.ReactNode);
|
|
46
|
+
key?: string;
|
|
47
|
+
dataIndex?: string | string[];
|
|
48
|
+
align?: 'left' | 'right' | 'center';
|
|
49
|
+
ellipsis?: boolean | {
|
|
50
|
+
showTitle?: boolean;
|
|
51
|
+
};
|
|
52
|
+
colSpan?: number;
|
|
53
|
+
width?: string | number;
|
|
54
|
+
minWidth?: string | number;
|
|
55
|
+
fixed?: boolean | 'left' | 'right';
|
|
56
|
+
render?: (value: any, record: T, index: number) => React.ReactNode;
|
|
57
|
+
sorter?: boolean | ((a: T, b: T) => number) | {
|
|
58
|
+
compare?: (a: T, b: T) => number;
|
|
59
|
+
multiple?: number;
|
|
60
|
+
};
|
|
61
|
+
sortOrder?: SortOrder | SortOrder[];
|
|
62
|
+
defaultSortOrder?: SortOrder;
|
|
63
|
+
onCell?: (record: T, index?: number) => React.HTMLAttributes<HTMLTableCellElement>;
|
|
64
|
+
onHeaderCell?: (column: ColumnType<T>) => React.HTMLAttributes<HTMLTableCellElement>;
|
|
65
|
+
className?: string;
|
|
66
|
+
children?: ColumnType<T>[];
|
|
67
|
+
onSorterChange?: (sorter: SorterResult<T>) => void;
|
|
68
|
+
rowSpan?: number;
|
|
69
|
+
rowScope?: 'row' | 'col' | 'rowgroup' | 'colgroup';
|
|
70
|
+
}
|
|
71
|
+
export interface TableProps<T = any> {
|
|
72
|
+
columns?: ColumnType<T>[];
|
|
73
|
+
dataSource?: T[];
|
|
74
|
+
rowKey?: string | ((record: T) => string | number);
|
|
75
|
+
rowSelection?: TableRowSelection<T>;
|
|
76
|
+
pagination?: false | {
|
|
77
|
+
current?: number;
|
|
78
|
+
pageSize?: number;
|
|
79
|
+
total?: number;
|
|
80
|
+
defaultCurrent?: number;
|
|
81
|
+
defaultPageSize?: number;
|
|
82
|
+
showSizeChanger?: boolean;
|
|
83
|
+
pageSizeOptions?: string[];
|
|
84
|
+
showQuickJumper?: boolean | {
|
|
85
|
+
goButton?: React.ReactNode;
|
|
86
|
+
};
|
|
87
|
+
showTotal?: (total: number, range: [number, number]) => React.ReactNode;
|
|
88
|
+
onChange?: (page: number, pageSize?: number) => void;
|
|
89
|
+
onShowSizeChange?: (current: number, size: number) => void;
|
|
90
|
+
position?: 'topLeft' | 'topCenter' | 'topRight' | 'bottomLeft' | 'bottomCenter' | 'bottomRight';
|
|
91
|
+
simple?: boolean;
|
|
92
|
+
responsive?: boolean;
|
|
93
|
+
};
|
|
94
|
+
size?: TableSize;
|
|
95
|
+
bordered?: boolean;
|
|
96
|
+
loading?: boolean | React.ReactNode;
|
|
97
|
+
locale?: {
|
|
98
|
+
emptyText?: React.ReactNode | (() => React.ReactNode);
|
|
99
|
+
selectAll?: React.ReactNode;
|
|
100
|
+
selectInvert?: React.ReactNode;
|
|
101
|
+
selectNone?: React.ReactNode;
|
|
102
|
+
selectionAll?: React.ReactNode;
|
|
103
|
+
sortTitle?: string;
|
|
104
|
+
expand?: string;
|
|
105
|
+
collapse?: string;
|
|
106
|
+
triggerDesc?: string;
|
|
107
|
+
triggerAsc?: string;
|
|
108
|
+
cancelSort?: string;
|
|
109
|
+
};
|
|
110
|
+
showHeader?: boolean;
|
|
111
|
+
title?: (currentData: T[]) => React.ReactNode;
|
|
112
|
+
footer?: (currentData: T[]) => React.ReactNode;
|
|
113
|
+
summary?: (currentData: T[]) => React.ReactNode;
|
|
114
|
+
scroll?: {
|
|
115
|
+
x?: number | string | true;
|
|
116
|
+
y?: number | string;
|
|
117
|
+
scrollToFirstRowOnChange?: boolean;
|
|
118
|
+
};
|
|
119
|
+
tableLayout?: TableLayout;
|
|
120
|
+
onChange?: (pagination: any, filters: Record<string, any>, sorter: SorterResult<T> | SorterResult<T>[], extra: TableCurrentDataSource<T>) => void;
|
|
121
|
+
onSorterChange?: (sorter: SorterResult<T> | SorterResult<T>[]) => void;
|
|
122
|
+
onPaginationChange?: (page: number, pageSize: number) => void;
|
|
123
|
+
onRow?: (record: T, index?: number) => React.HTMLAttributes<HTMLTableRowElement>;
|
|
124
|
+
getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;
|
|
125
|
+
className?: string;
|
|
126
|
+
innerClassName?: string;
|
|
127
|
+
style?: React.CSSProperties;
|
|
128
|
+
children?: React.ReactNode;
|
|
129
|
+
expandable?: {
|
|
130
|
+
expandedRowKeys?: (string | number)[];
|
|
131
|
+
defaultExpandedRowKeys?: (string | number)[];
|
|
132
|
+
expandedRowRender?: (record: T, index: number, indent: number, expanded: boolean) => React.ReactNode;
|
|
133
|
+
expandRowByClick?: boolean;
|
|
134
|
+
onExpand?: (expanded: boolean, record: T) => void;
|
|
135
|
+
onExpandedRowsChange?: (expandedKeys: (string | number)[]) => void;
|
|
136
|
+
defaultExpandAllRows?: boolean;
|
|
137
|
+
indentSize?: number;
|
|
138
|
+
expandIcon?: (props: {
|
|
139
|
+
expanded: boolean;
|
|
140
|
+
onExpand: (record: T, e: React.MouseEvent<HTMLElement>) => void;
|
|
141
|
+
record: T;
|
|
142
|
+
}) => React.ReactNode;
|
|
143
|
+
rowExpandable?: (record: T) => boolean;
|
|
144
|
+
};
|
|
145
|
+
indentSize?: number;
|
|
146
|
+
rowClassName?: string | ((record: T, index: number) => string);
|
|
147
|
+
onHeaderRow?: (columns: ColumnType<T>[], index?: number) => React.HTMLAttributes<HTMLTableRowElement>;
|
|
148
|
+
components?: {
|
|
149
|
+
header?: {
|
|
150
|
+
cell?: React.ComponentType<any>;
|
|
151
|
+
row?: React.ComponentType<any>;
|
|
152
|
+
wrapper?: React.ComponentType<any>;
|
|
153
|
+
};
|
|
154
|
+
body?: {
|
|
155
|
+
cell?: React.ComponentType<any>;
|
|
156
|
+
row?: React.ComponentType<any>;
|
|
157
|
+
wrapper?: React.ComponentType<any>;
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
sticky?: boolean | {
|
|
161
|
+
offsetHeader?: number;
|
|
162
|
+
offsetScroll?: number;
|
|
163
|
+
getContainer?: () => HTMLElement;
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
declare const Table: <T extends Record<string, any> = any>({ columns, dataSource, rowKey, rowSelection, pagination, size, bordered, loading, locale, showHeader, title, footer, summary, scroll, tableLayout, onChange, onSorterChange, onPaginationChange, onRow, className, innerClassName, style, expandable, rowClassName, onHeaderRow, sticky, ...rest }: TableProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
167
|
+
export default Table;
|
|
@@ -4,11 +4,8 @@ declare const meta: Meta<typeof Tag>;
|
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof meta>;
|
|
6
6
|
export declare const Default: Story;
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
12
|
-
export declare const Clickable: Story;
|
|
13
|
-
export declare const CustomColors: Story;
|
|
14
|
-
export declare const ComplexExample: Story;
|
|
7
|
+
export declare const Overview: Story;
|
|
8
|
+
export declare const Size: Story;
|
|
9
|
+
export declare const Icons: Story;
|
|
10
|
+
export declare const Actions: Story;
|
|
11
|
+
export declare const Checkbox: Story;
|
|
@@ -1,19 +1,41 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export type TagColor = 'Green' | 'Red' | 'Orange' | 'Cyan' | 'Violet' | 'Pink' | 'Gray' | 'Yellow' | 'Blue' | string;
|
|
3
3
|
export type TagVariant = 'light' | 'fill';
|
|
4
|
-
|
|
4
|
+
/** sm/md/lg are the canonical sizes; large/small are legacy aliases */
|
|
5
|
+
export type TagSize = 'sm' | 'md' | 'lg' | 'large' | 'small';
|
|
6
|
+
/** Leading icon variant */
|
|
7
|
+
export type TagIconType = 'none' | 'dot' | 'avatar' | 'icon';
|
|
8
|
+
/** Right-side action */
|
|
9
|
+
export type TagAction = 'none' | 'x-close' | 'count';
|
|
10
|
+
/** @deprecated Use iconType instead */
|
|
5
11
|
export type IconPosition = 'leading' | 'after' | 'none';
|
|
6
12
|
export interface TagProps {
|
|
7
13
|
children: React.ReactNode;
|
|
8
|
-
color
|
|
14
|
+
color?: TagColor;
|
|
9
15
|
variant?: TagVariant;
|
|
10
16
|
size?: TagSize;
|
|
11
17
|
stroke?: boolean;
|
|
18
|
+
iconType?: TagIconType;
|
|
12
19
|
icon?: React.ReactElement;
|
|
20
|
+
avatarSrc?: string;
|
|
21
|
+
dotColor?: string;
|
|
22
|
+
action?: TagAction;
|
|
23
|
+
count?: number;
|
|
24
|
+
onClose?: () => void;
|
|
25
|
+
checkbox?: boolean;
|
|
26
|
+
checked?: boolean;
|
|
27
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
28
|
+
/** @deprecated use iconType='icon' */
|
|
13
29
|
iconPosition?: IconPosition;
|
|
14
30
|
className?: string;
|
|
15
31
|
onClick?: () => void;
|
|
16
32
|
[key: string]: any;
|
|
17
33
|
}
|
|
34
|
+
export interface TagAvatarProps {
|
|
35
|
+
src?: string;
|
|
36
|
+
alt?: string;
|
|
37
|
+
size?: number;
|
|
38
|
+
}
|
|
39
|
+
export declare const TagAvatar: React.FC<TagAvatarProps>;
|
|
18
40
|
declare const Tag: React.FC<TagProps>;
|
|
19
41
|
export default Tag;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import Textarea from './index';
|
|
3
|
+
declare const meta: Meta<typeof Textarea>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Textarea>;
|
|
6
|
+
export declare const Basic: Story;
|
|
7
|
+
export declare const Sizes: Story;
|
|
8
|
+
export declare const Disabled: Story;
|
|
9
|
+
export declare const Error: Story;
|
|
10
|
+
export declare const ReadOnly: Story;
|
|
11
|
+
export declare const WithCount: Story;
|
|
12
|
+
export declare const WithMaxLength: Story;
|
|
13
|
+
export declare const AutoSize: Story;
|
|
14
|
+
export declare const Controlled: Story;
|
|
15
|
+
export declare const AllStates: Story;
|
|
@@ -4,14 +4,11 @@ declare const meta: Meta<typeof Textarea>;
|
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof Textarea>;
|
|
6
6
|
export declare const Basic: Story;
|
|
7
|
-
export declare const Sizes: Story;
|
|
8
7
|
export declare const Disabled: Story;
|
|
9
8
|
export declare const Error: Story;
|
|
10
9
|
export declare const ReadOnly: Story;
|
|
11
10
|
export declare const WithCount: Story;
|
|
12
|
-
export declare const WithMaxLength: Story;
|
|
13
11
|
export declare const AutoSize: Story;
|
|
14
|
-
export declare const
|
|
15
|
-
export declare const
|
|
16
|
-
export declare const
|
|
17
|
-
export declare const LinkifyControlled: Story;
|
|
12
|
+
export declare const Tags: Story;
|
|
13
|
+
export declare const Linkify: Story;
|
|
14
|
+
export declare const AllVariants: Story;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { InputTagsProps } from '../Input/InputTags';
|
|
3
|
+
export interface TextareaTagsProps extends Omit<InputTagsProps, 'size'> {
|
|
4
|
+
minHeight?: number;
|
|
5
|
+
helpIcon?: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
declare const TextareaTags: React.FC<TextareaTagsProps>;
|
|
8
|
+
export default TextareaTags;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface TextareaProps extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'size'> {
|
|
3
|
+
/** 是否禁用 */
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
/** 是否显示错误状态 */
|
|
6
|
+
error?: boolean;
|
|
7
|
+
/** 是否只读 */
|
|
8
|
+
readOnly?: boolean;
|
|
9
|
+
/** 是否显示字符计数 */
|
|
10
|
+
showCount?: boolean;
|
|
11
|
+
/** 最大字符数 */
|
|
12
|
+
maxLength?: number;
|
|
13
|
+
/** 自定义类名 */
|
|
14
|
+
className?: string;
|
|
15
|
+
/** 自定义样式 */
|
|
16
|
+
style?: React.CSSProperties;
|
|
17
|
+
/** 占位符 */
|
|
18
|
+
placeholder?: string;
|
|
19
|
+
/** 值 */
|
|
20
|
+
value?: string;
|
|
21
|
+
/** 默认值 */
|
|
22
|
+
defaultValue?: string;
|
|
23
|
+
/** 行数 */
|
|
24
|
+
rows?: number;
|
|
25
|
+
/** 是否自动调整高度 */
|
|
26
|
+
autoSize?: boolean | {
|
|
27
|
+
minRows?: number;
|
|
28
|
+
maxRows?: number;
|
|
29
|
+
};
|
|
30
|
+
/** 变化回调 */
|
|
31
|
+
onChange?: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
32
|
+
/** 聚焦回调 */
|
|
33
|
+
onFocus?: (e: React.FocusEvent<HTMLTextAreaElement>) => void;
|
|
34
|
+
/** 失焦回调 */
|
|
35
|
+
onBlur?: (e: React.FocusEvent<HTMLTextAreaElement>) => void;
|
|
36
|
+
}
|
|
37
|
+
declare const Textarea: React.ForwardRefExoticComponent<TextareaProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
38
|
+
export default Textarea;
|
|
@@ -7,44 +7,33 @@ interface LinkifyOptions {
|
|
|
7
7
|
allowedTlds?: string[];
|
|
8
8
|
}
|
|
9
9
|
export interface TextareaProps extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'size'> {
|
|
10
|
-
/** 是否禁用 */
|
|
11
10
|
disabled?: boolean;
|
|
12
|
-
/** 是否显示错误状态 */
|
|
13
11
|
error?: boolean;
|
|
14
|
-
/** 是否只读 */
|
|
15
12
|
readOnly?: boolean;
|
|
16
|
-
/** 是否显示字符计数 */
|
|
17
13
|
showCount?: boolean;
|
|
18
|
-
/** 最大字符数 */
|
|
19
14
|
maxLength?: number;
|
|
20
|
-
/** 自定义类名 */
|
|
21
15
|
className?: string;
|
|
22
|
-
/** 自定义样式 */
|
|
23
16
|
style?: React.CSSProperties;
|
|
24
|
-
/** 占位符 */
|
|
25
17
|
placeholder?: string;
|
|
26
|
-
/** 值 */
|
|
27
18
|
value?: string;
|
|
28
|
-
/** 默认值 */
|
|
29
19
|
defaultValue?: string;
|
|
30
|
-
/** 行数 */
|
|
31
20
|
rows?: number;
|
|
32
|
-
/** 是否自动调整高度 */
|
|
33
21
|
autoSize?: boolean | {
|
|
34
22
|
minRows?: number;
|
|
35
23
|
maxRows?: number;
|
|
36
24
|
};
|
|
37
|
-
/** 变化回调 */
|
|
38
25
|
onChange?: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
39
|
-
/** 聚焦回调 */
|
|
40
26
|
onFocus?: (e: React.FocusEvent<HTMLTextAreaElement>) => void;
|
|
41
|
-
/** 失焦回调 */
|
|
42
27
|
onBlur?: (e: React.FocusEvent<HTMLTextAreaElement>) => void;
|
|
43
|
-
/** 是否启用实时链接识别 */
|
|
44
28
|
linkify?: boolean;
|
|
45
|
-
/** 链接识别配置 */
|
|
46
29
|
linkifyOptions?: LinkifyOptions;
|
|
30
|
+
label?: string;
|
|
31
|
+
required?: boolean;
|
|
32
|
+
hintText?: string;
|
|
33
|
+
helpIcon?: React.ReactNode;
|
|
47
34
|
}
|
|
48
35
|
export declare const websiteValidator: (url: string, needProtocol?: boolean, needHost?: boolean, allowedTlds?: string[]) => boolean;
|
|
49
36
|
declare const Textarea: React.ForwardRefExoticComponent<TextareaProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
50
37
|
export default Textarea;
|
|
38
|
+
export { default as TextareaTags } from './TextareaTags';
|
|
39
|
+
export type { TextareaTagsProps } from './TextareaTags';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import Tooltip from './index';
|
|
3
|
+
import '../../index.css';
|
|
4
|
+
declare const meta: Meta<typeof Tooltip>;
|
|
5
|
+
export default meta;
|
|
6
|
+
type Story = StoryObj<typeof Tooltip>;
|
|
7
|
+
export declare const Default: Story;
|
|
8
|
+
export declare const Positions: Story;
|
|
9
|
+
export declare const LongText: Story;
|
|
10
|
+
export declare const MultiLine: Story;
|
|
11
|
+
export declare const CustomContent: Story;
|
|
12
|
+
export declare const DifferentTriggers: Story;
|
|
13
|
+
export declare const Disabled: Story;
|
|
14
|
+
export declare const Delayed: Story;
|
|
15
|
+
export declare const NoDelay: Story;
|
|
16
|
+
export declare const TriggerComparison: Story;
|
|
17
|
+
export declare const ClickPositions: Story;
|
|
18
|
+
export declare const ClickWithCustomContent: Story;
|
|
19
|
+
export declare const DefaultVisible: Story;
|
|
20
|
+
export declare const Controlled: Story;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export type TooltipPosition = "top" | "bottom" | "left" | "right" | "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
3
|
+
export type TooltipTrigger = "hover" | "click";
|
|
4
|
+
export interface TooltipProps {
|
|
5
|
+
/** Tooltip 内容 */
|
|
6
|
+
content: React.ReactNode;
|
|
7
|
+
/** 触发元素 */
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
/** 显示位置 */
|
|
10
|
+
position?: TooltipPosition;
|
|
11
|
+
/** 触发方式 */
|
|
12
|
+
trigger?: TooltipTrigger;
|
|
13
|
+
/** 延迟显示时间(毫秒) */
|
|
14
|
+
delay?: number;
|
|
15
|
+
/** 是否禁用 */
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
/** 自定义样式类名 */
|
|
18
|
+
className?: string;
|
|
19
|
+
/** 自定义 tooltip 样式类名 */
|
|
20
|
+
tooltipClassName?: string;
|
|
21
|
+
/** Tooltip 与触发元素的间距(像素) */
|
|
22
|
+
gap?: number;
|
|
23
|
+
/** 是否显示箭头 */
|
|
24
|
+
showArrow?: boolean;
|
|
25
|
+
/** Tooltip 内容宽度(如 "200px"、"50%" 等),不设置则使用自动计算 */
|
|
26
|
+
width?: string | number;
|
|
27
|
+
/** 是否默认显示(非受控) */
|
|
28
|
+
defaultVisible?: boolean;
|
|
29
|
+
/** 是否显示(受控) */
|
|
30
|
+
visible?: boolean;
|
|
31
|
+
/** 显示/隐藏时的回调 */
|
|
32
|
+
onVisibleChange?: (visible: boolean) => void;
|
|
33
|
+
}
|
|
34
|
+
declare const Tooltip: React.FC<TooltipProps>;
|
|
35
|
+
export default Tooltip;
|
|
@@ -85,6 +85,20 @@
|
|
|
85
85
|
--color-gray-900: #1c1917;
|
|
86
86
|
--color-gray-950: #171412;
|
|
87
87
|
|
|
88
|
+
/* gray-blue */
|
|
89
|
+
--color-gray-blue-25: #fcfcfd;
|
|
90
|
+
--color-gray-blue-50: #f8f9fc;
|
|
91
|
+
--color-gray-blue-100: #eaecf5;
|
|
92
|
+
--color-gray-blue-200: #d5d9eb;
|
|
93
|
+
--color-gray-blue-300: #b3b8db;
|
|
94
|
+
--color-gray-blue-400: #717bbc;
|
|
95
|
+
--color-gray-blue-500: #4e5ba6;
|
|
96
|
+
--color-gray-blue-600: #3e4784;
|
|
97
|
+
--color-gray-blue-700: #363f72;
|
|
98
|
+
--color-gray-blue-800: #293056;
|
|
99
|
+
--color-gray-blue-900: #101323;
|
|
100
|
+
--color-gray-blue-950: #0d0f1c;
|
|
101
|
+
|
|
88
102
|
/* moss */
|
|
89
103
|
--color-moss-25: #fafdf7;
|
|
90
104
|
--color-moss-50: #f5fbee;
|
|
@@ -580,6 +594,18 @@
|
|
|
580
594
|
--color-gray-800: var(--color-gray-800);
|
|
581
595
|
--color-gray-900: var(--color-gray-900);
|
|
582
596
|
--color-gray-950: var(--color-gray-950);
|
|
597
|
+
--color-gray-blue-25: var(--color-gray-blue-25);
|
|
598
|
+
--color-gray-blue-50: var(--color-gray-blue-50);
|
|
599
|
+
--color-gray-blue-100: var(--color-gray-blue-100);
|
|
600
|
+
--color-gray-blue-200: var(--color-gray-blue-200);
|
|
601
|
+
--color-gray-blue-300: var(--color-gray-blue-300);
|
|
602
|
+
--color-gray-blue-400: var(--color-gray-blue-400);
|
|
603
|
+
--color-gray-blue-500: var(--color-gray-blue-500);
|
|
604
|
+
--color-gray-blue-600: var(--color-gray-blue-600);
|
|
605
|
+
--color-gray-blue-700: var(--color-gray-blue-700);
|
|
606
|
+
--color-gray-blue-800: var(--color-gray-blue-800);
|
|
607
|
+
--color-gray-blue-900: var(--color-gray-blue-900);
|
|
608
|
+
--color-gray-blue-950: var(--color-gray-blue-950);
|
|
583
609
|
--color-moss-25: var(--color-moss-25);
|
|
584
610
|
--color-moss-50: var(--color-moss-50);
|
|
585
611
|
--color-moss-100: var(--color-moss-100);
|
|
@@ -85,6 +85,20 @@
|
|
|
85
85
|
--color-gray-900: #1c1917;
|
|
86
86
|
--color-gray-950: #171412;
|
|
87
87
|
|
|
88
|
+
/* gray-blue */
|
|
89
|
+
--color-gray-blue-25: #fcfcfd;
|
|
90
|
+
--color-gray-blue-50: #f8f9fc;
|
|
91
|
+
--color-gray-blue-100: #eaecf5;
|
|
92
|
+
--color-gray-blue-200: #d5d9eb;
|
|
93
|
+
--color-gray-blue-300: #b3b8db;
|
|
94
|
+
--color-gray-blue-400: #717bbc;
|
|
95
|
+
--color-gray-blue-500: #4e5ba6;
|
|
96
|
+
--color-gray-blue-600: #3e4784;
|
|
97
|
+
--color-gray-blue-700: #363f72;
|
|
98
|
+
--color-gray-blue-800: #293056;
|
|
99
|
+
--color-gray-blue-900: #101323;
|
|
100
|
+
--color-gray-blue-950: #0d0f1c;
|
|
101
|
+
|
|
88
102
|
/* moss */
|
|
89
103
|
--color-moss-25: #fafdf7;
|
|
90
104
|
--color-moss-50: #f5fbee;
|
|
@@ -580,6 +594,18 @@
|
|
|
580
594
|
--color-gray-800: var(--color-gray-800);
|
|
581
595
|
--color-gray-900: var(--color-gray-900);
|
|
582
596
|
--color-gray-950: var(--color-gray-950);
|
|
597
|
+
--color-gray-blue-25: var(--color-gray-blue-25);
|
|
598
|
+
--color-gray-blue-50: var(--color-gray-blue-50);
|
|
599
|
+
--color-gray-blue-100: var(--color-gray-blue-100);
|
|
600
|
+
--color-gray-blue-200: var(--color-gray-blue-200);
|
|
601
|
+
--color-gray-blue-300: var(--color-gray-blue-300);
|
|
602
|
+
--color-gray-blue-400: var(--color-gray-blue-400);
|
|
603
|
+
--color-gray-blue-500: var(--color-gray-blue-500);
|
|
604
|
+
--color-gray-blue-600: var(--color-gray-blue-600);
|
|
605
|
+
--color-gray-blue-700: var(--color-gray-blue-700);
|
|
606
|
+
--color-gray-blue-800: var(--color-gray-blue-800);
|
|
607
|
+
--color-gray-blue-900: var(--color-gray-blue-900);
|
|
608
|
+
--color-gray-blue-950: var(--color-gray-blue-950);
|
|
583
609
|
--color-moss-25: var(--color-moss-25);
|
|
584
610
|
--color-moss-50: var(--color-moss-50);
|
|
585
611
|
--color-moss-100: var(--color-moss-100);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export declare const CheckIcon: React.FC<{
|
|
3
|
+
className?: string;
|
|
4
|
+
style?: React.CSSProperties;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const MinusIcon: React.FC<{
|
|
7
|
+
className?: string;
|
|
8
|
+
style?: React.CSSProperties;
|
|
9
|
+
}>;
|
|
10
|
+
export declare const SortIcon: React.FC<{
|
|
11
|
+
className?: string;
|
|
12
|
+
style?: React.CSSProperties;
|
|
13
|
+
}>;
|
|
14
|
+
export declare const SortDescIcon: React.FC<{
|
|
15
|
+
className?: string;
|
|
16
|
+
style?: React.CSSProperties;
|
|
17
|
+
}>;
|
|
18
|
+
export declare const SortAscIcon: React.FC<{
|
|
19
|
+
className?: string;
|
|
20
|
+
style?: React.CSSProperties;
|
|
21
|
+
}>;
|
|
22
|
+
export declare const LeftArrowIcon: React.FC<{
|
|
23
|
+
className?: string;
|
|
24
|
+
style?: React.CSSProperties;
|
|
25
|
+
}>;
|
|
26
|
+
export declare const RightArrowIcon: React.FC<{
|
|
27
|
+
className?: string;
|
|
28
|
+
style?: React.CSSProperties;
|
|
29
|
+
}>;
|
|
30
|
+
export declare const TooltipIcon: React.FC<{
|
|
31
|
+
className?: string;
|
|
32
|
+
style?: React.CSSProperties;
|
|
33
|
+
}>;
|