x-ui-design 0.2.13 → 0.2.16

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.
Files changed (39) hide show
  1. package/dist/esm/types/components/Button/Button.client.d.ts +3 -0
  2. package/dist/esm/types/components/Button/Button.d.ts +8 -0
  3. package/dist/esm/types/components/Button/index.d.ts +1 -0
  4. package/dist/esm/types/components/Checkbox/Checkbox.client.d.ts +23 -0
  5. package/dist/esm/types/components/Checkbox/Checkbox.d.ts +7 -0
  6. package/dist/esm/types/components/Checkbox/index.d.ts +1 -0
  7. package/dist/esm/types/components/Empty/Empty.d.ts +4 -0
  8. package/dist/esm/types/components/Empty/index.d.ts +1 -0
  9. package/dist/esm/types/components/Form/Form.client.d.ts +4 -0
  10. package/dist/esm/types/components/Form/Form.d.ts +7 -0
  11. package/dist/esm/types/components/Form/Item/FormItem.client.d.ts +7 -0
  12. package/dist/esm/types/components/Form/Item/FormItem.d.ts +6 -0
  13. package/dist/esm/types/components/Form/Item/index.d.ts +1 -0
  14. package/dist/esm/types/components/Form/index.d.ts +1 -0
  15. package/dist/esm/types/helpers/index.d.ts +4 -0
  16. package/dist/esm/types/hooks/useForm.d.ts +4 -0
  17. package/dist/esm/types/hooks/useWatch.d.ts +9 -0
  18. package/dist/esm/types/index.d.ts +4 -0
  19. package/dist/esm/types/types/button.d.ts +42 -0
  20. package/dist/esm/types/types/checkbox.d.ts +22 -0
  21. package/dist/esm/types/types/datepicker.d.ts +119 -0
  22. package/dist/esm/types/types/empty.d.ts +7 -0
  23. package/dist/esm/types/types/form.d.ts +106 -0
  24. package/dist/esm/types/types/index.d.ts +25 -0
  25. package/dist/esm/types/types/input.d.ts +47 -0
  26. package/dist/esm/types/types/radio.d.ts +57 -0
  27. package/dist/esm/types/types/select.d.ts +97 -0
  28. package/dist/esm/types/types/skeleton.d.ts +50 -0
  29. package/dist/esm/types/types/upload.d.ts +54 -0
  30. package/dist/esm/types/utils/index.d.ts +14 -0
  31. package/dist/index.d.ts +98 -0
  32. package/dist/index.esm.js +291 -0
  33. package/dist/index.esm.js.map +1 -0
  34. package/dist/index.js +295 -0
  35. package/dist/index.js.map +1 -0
  36. package/lib/components/Empty/index.ts +1 -1
  37. package/lib/components/Form/Form.client.tsx +5 -1
  38. package/lib/types/form.ts +0 -1
  39. package/package.json +1 -1
@@ -0,0 +1,3 @@
1
+ import { ButtonProps } from '../../types/button';
2
+ declare const ButtonClient: (props: ButtonProps) => import("react").JSX.Element;
3
+ export default ButtonClient;
@@ -0,0 +1,8 @@
1
+ import { ReactElement, ReactNode } from 'react';
2
+ import { ButtonProps } from '../../types/button';
3
+ import './style.css';
4
+ declare const Button: ({ type, variant, color, shape, size, htmlType, className, rootClassName, classNames: customClassNames, styles, prefixCls, iconPosition, disabled, ghost, danger, block, children, href, iconNode, isLoading, ...restProps }: ButtonProps & {
5
+ iconNode?: ReactNode;
6
+ isLoading?: boolean;
7
+ }) => ReactElement;
8
+ export default Button;
@@ -0,0 +1 @@
1
+ export { default as Button } from './Button';
@@ -0,0 +1,23 @@
1
+ import { MouseEvent } from 'react';
2
+ import './style.css';
3
+ declare const CheckboxClient: import("react").ForwardRefExoticComponent<import("../../types").DefaultProps & {
4
+ disabled?: boolean;
5
+ onChange?: (e: MouseEvent<HTMLInputElement> & import("../../types").TargetProps) => void;
6
+ onClick?: import("react").MouseEventHandler<HTMLElement>;
7
+ onMouseEnter?: import("react").MouseEventHandler<HTMLElement>;
8
+ onMouseLeave?: import("react").MouseEventHandler<HTMLElement>;
9
+ onKeyPress?: import("react").KeyboardEventHandler<HTMLElement>;
10
+ onKeyDown?: import("react").KeyboardEventHandler<HTMLElement>;
11
+ value?: boolean;
12
+ tabIndex?: number;
13
+ name?: string;
14
+ children?: import("react").ReactNode;
15
+ id?: string;
16
+ autoFocus?: boolean;
17
+ type?: string;
18
+ skipGroup?: boolean;
19
+ required?: boolean;
20
+ defaultChecked?: boolean;
21
+ checked?: boolean;
22
+ } & import("react").RefAttributes<HTMLDivElement>>;
23
+ export default CheckboxClient;
@@ -0,0 +1,7 @@
1
+ import { ReactElement } from 'react';
2
+ import { CheckboxProps } from '../../types/checkbox';
3
+ declare const Checkbox: {
4
+ ({ prefixCls, className, defaultChecked, checked, style, disabled, onChange, onClick, onMouseEnter, onMouseLeave, onKeyPress, onKeyDown, tabIndex, name, children, id, autoFocus, type, value, required, noStyle }: CheckboxProps): ReactElement;
5
+ displayName: string;
6
+ };
7
+ export default Checkbox;
@@ -0,0 +1 @@
1
+ export { default as Checkbox } from './Checkbox';
@@ -0,0 +1,4 @@
1
+ import { EmptyContentProps } from '../../types/empty';
2
+ import './style.css';
3
+ declare const EmptyContent: ({ icon, style, className, title, description, prefixCls }: EmptyContentProps) => import("react").JSX.Element;
4
+ export default EmptyContent;
@@ -0,0 +1 @@
1
+ export { default as Empty } from './Empty';
@@ -0,0 +1,4 @@
1
+ import { FC } from 'react';
2
+ import { FormProps } from '../../types/form';
3
+ declare const FormClient: FC<FormProps>;
4
+ export default FormClient;
@@ -0,0 +1,7 @@
1
+ import { FormInstance, FormItemProps, FormProps } from '../../types/form';
2
+ import { FC } from 'react';
3
+ export declare const FormContext: import("react").Context<FormInstance | null>;
4
+ declare const Form: FC<FormProps> & {
5
+ Item: FC<FormItemProps>;
6
+ };
7
+ export default Form;
@@ -0,0 +1,7 @@
1
+ import { FormItemProps } from '../../../types/form';
2
+ import './style.css';
3
+ declare const FormItemClient: {
4
+ ({ prefixCls, name, label, rules, children, className, layout, style, valuePropName, dependencies, initialValue, feedbackIcons, ...props }: FormItemProps): import("react").JSX.Element;
5
+ displayName: string;
6
+ };
7
+ export default FormItemClient;
@@ -0,0 +1,6 @@
1
+ import { FormItemProps } from '../../../types/form';
2
+ declare const FormItem: {
3
+ ({ prefixCls, name, label, rules, children, className, layout, style, valuePropName, dependencies, initialValue, feedbackIcons, ...props }: FormItemProps): import("react").JSX.Element;
4
+ displayName: string;
5
+ };
6
+ export default FormItem;
@@ -0,0 +1 @@
1
+ export { default as Item } from './FormItem';
@@ -0,0 +1 @@
1
+ export { default as Form } from './Form';
@@ -0,0 +1,4 @@
1
+ import { RuleType } from '../types';
2
+ export declare const parseValue: (value: RuleType) => RuleType;
3
+ export declare function createArray(length: number): number[];
4
+ export declare function clsx(...args: RuleType[]): string;
@@ -0,0 +1,4 @@
1
+ import { RuleTypes } from '../types';
2
+ import type { FieldData, FormInstance } from '../types/form';
3
+ declare const useForm: (initialValues?: Record<string, RuleTypes>, onFieldsChange?: (changedFields: FieldData[]) => void, onValuesChange?: (changedValues: Record<string, RuleTypes>, allValues: Record<string, RuleTypes>) => void) => FormInstance;
4
+ export { useForm };
@@ -0,0 +1,9 @@
1
+ import { RuleType } from '../types';
2
+ import { FormInstance } from '../types/form';
3
+ type UseWatchProps = {
4
+ name?: string;
5
+ defaultValue?: RuleType;
6
+ form?: FormInstance;
7
+ };
8
+ export declare const useWatch: ({ name, defaultValue, form }: UseWatchProps) => any;
9
+ export {};
@@ -0,0 +1,4 @@
1
+ import './styles/global.css';
2
+ export { default as Empty } from "./components/Empty/Empty";
3
+ export { default as Button } from "./components/Button/Button";
4
+ export { default as Checkbox } from "./components/Checkbox/Checkbox";
@@ -0,0 +1,42 @@
1
+ import { ButtonHTMLAttributes, CSSProperties, ReactNode } from 'react';
2
+ export declare const ButtonTypes: readonly ["default", "primary", "dashed", "link", "text", "ghost"];
3
+ export declare const ButtonShapes: readonly ["default", "circle", "round"];
4
+ export declare const ButtonVariantTypes: readonly ["outlined", "dashed", "solid", "filled", "text", "link"];
5
+ export declare const ButtonColorTypes: readonly ["default", "primary", "danger", "blue", "purple", "cyan", "green", "magenta", "pink", "red", "orange", "yellow", "volcano", "geekblue", "lime", "gold"];
6
+ export type ButtonType = (typeof ButtonTypes)[number];
7
+ export type ButtonShape = (typeof ButtonShapes)[number];
8
+ export type ButtonVariantType = (typeof ButtonVariantTypes)[number];
9
+ export type ButtonColorType = (typeof ButtonColorTypes)[number];
10
+ export type SizeType = 'small' | 'middle' | 'large' | undefined;
11
+ export type ButtonHTMLType = 'button' | 'submit' | 'reset';
12
+ export interface BaseButtonProps {
13
+ type?: ButtonType;
14
+ color?: ButtonColorType;
15
+ variant?: ButtonVariantType;
16
+ icon?: ReactNode;
17
+ iconPosition?: 'start' | 'end';
18
+ shape?: ButtonShape;
19
+ size?: SizeType;
20
+ disabled?: boolean;
21
+ loading?: boolean | {
22
+ delay?: number;
23
+ icon?: ReactNode;
24
+ };
25
+ prefixCls?: string;
26
+ className?: string;
27
+ rootClassName?: string;
28
+ ghost?: boolean;
29
+ danger?: boolean;
30
+ block?: boolean;
31
+ children?: ReactNode;
32
+ classNames?: {
33
+ icon?: string;
34
+ };
35
+ styles?: {
36
+ icon?: CSSProperties;
37
+ };
38
+ }
39
+ export interface ButtonProps extends BaseButtonProps, Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'color' | 'type'> {
40
+ href?: string;
41
+ htmlType?: ButtonHTMLType;
42
+ }
@@ -0,0 +1,22 @@
1
+ import { KeyboardEventHandler, MouseEvent, MouseEventHandler, ReactNode } from 'react';
2
+ import { DefaultProps, TargetProps } from '.';
3
+ export type CheckboxProps = DefaultProps & {
4
+ disabled?: boolean;
5
+ onChange?: (e: MouseEvent<HTMLInputElement> & TargetProps) => void;
6
+ onClick?: MouseEventHandler<HTMLElement>;
7
+ onMouseEnter?: MouseEventHandler<HTMLElement>;
8
+ onMouseLeave?: MouseEventHandler<HTMLElement>;
9
+ onKeyPress?: KeyboardEventHandler<HTMLElement>;
10
+ onKeyDown?: KeyboardEventHandler<HTMLElement>;
11
+ value?: boolean;
12
+ tabIndex?: number;
13
+ name?: string;
14
+ children?: ReactNode;
15
+ id?: string;
16
+ autoFocus?: boolean;
17
+ type?: string;
18
+ skipGroup?: boolean;
19
+ required?: boolean;
20
+ defaultChecked?: boolean;
21
+ checked?: boolean;
22
+ };
@@ -0,0 +1,119 @@
1
+ import { FocusEvent, ReactNode } from 'react';
2
+ import { DefaultProps, RuleType, SizeType } from '.';
3
+ export interface BaseInfo {
4
+ range?: 'start' | 'end';
5
+ source?: string;
6
+ }
7
+ export type CustomFormat<RuleType> = (value: RuleType) => string;
8
+ export type FormatType<DateType = RuleType> = string | CustomFormat<DateType>;
9
+ export type PanelMode = 'time' | 'date' | 'week' | 'month' | 'quarter' | 'year' | 'decade';
10
+ export type TDatePickerProps = DefaultProps & {
11
+ value?: Date;
12
+ disabled?: boolean;
13
+ placeholder?: string;
14
+ error?: boolean;
15
+ feedbackIcons?: boolean;
16
+ locale?: Locale;
17
+ placement?: string;
18
+ defaultOpen?: boolean;
19
+ allowClear?: boolean | {
20
+ clearIcon?: ReactNode;
21
+ };
22
+ defaultValue?: Date;
23
+ disabledDate?: (date: RuleType, info: {
24
+ to: RuleType;
25
+ from?: RuleType;
26
+ }) => boolean;
27
+ suffixIcon?: ReactNode;
28
+ prefix?: ReactNode;
29
+ size?: SizeType;
30
+ format?: FormatType<RuleType> | FormatType<RuleType>[] | {
31
+ format: string;
32
+ type?: 'mask';
33
+ };
34
+ onChange?: (date: RuleType | RuleType[], dateString: string | string[]) => void;
35
+ onCalendarChange?: (date: RuleType | RuleType[], dateString: string | string[], info: BaseInfo) => void;
36
+ getPopupContainer?: (node: HTMLElement) => HTMLElement;
37
+ showToday?: boolean;
38
+ inputReadOnly?: boolean;
39
+ picker?: PanelMode;
40
+ bordered?: boolean;
41
+ };
42
+ export type TRangePickerProps = Omit<TDatePickerProps, 'placeholder' | 'value' | 'defaultValue'> & {
43
+ placeholder?: string[];
44
+ value?: Date[];
45
+ defaultValue?: Date[];
46
+ separator?: ReactNode;
47
+ };
48
+ export type Locale = {
49
+ locale: string;
50
+ dateFormat?: string;
51
+ dateTimeFormat?: string;
52
+ fieldDateTimeFormat?: string;
53
+ fieldDateFormat?: string;
54
+ fieldTimeFormat?: string;
55
+ fieldMonthFormat?: string;
56
+ fieldYearFormat?: string;
57
+ fieldWeekFormat?: string;
58
+ fieldQuarterFormat?: string;
59
+ monthBeforeYear?: boolean;
60
+ yearFormat?: string;
61
+ monthFormat?: string;
62
+ cellYearFormat?: string;
63
+ cellQuarterFormat?: string;
64
+ dayFormat?: string;
65
+ cellDateFormat?: string;
66
+ cellMeridiemFormat?: string;
67
+ today: string;
68
+ now: string;
69
+ backToToday: string;
70
+ ok: string;
71
+ timeSelect: string;
72
+ dateSelect: string;
73
+ weekSelect?: string;
74
+ clear: string;
75
+ week: string;
76
+ month: string;
77
+ year: string;
78
+ previousMonth: string;
79
+ nextMonth: string;
80
+ monthSelect: string;
81
+ yearSelect: string;
82
+ decadeSelect: string;
83
+ previousYear: string;
84
+ nextYear: string;
85
+ previousDecade: string;
86
+ nextDecade: string;
87
+ previousCentury: string;
88
+ nextCentury: string;
89
+ shortWeekDays?: string[];
90
+ shortMonths?: string[];
91
+ };
92
+ export interface DisabledTimes {
93
+ disabledHours?: () => number[];
94
+ disabledMinutes?: (hour: number) => number[];
95
+ disabledSeconds?: (hour: number, minute: number) => number[];
96
+ }
97
+ export type PickerFocusEventHandler = (e: FocusEvent<HTMLElement>, info: BaseInfo) => void;
98
+ export type DisabledDate<DateType = RuleType> = (date: DateType, info: {
99
+ type: PanelMode;
100
+ from?: DateType;
101
+ }) => boolean;
102
+ export type TimePickerProps = DefaultProps & {
103
+ disabledTime?: (date: RuleType) => DisabledTimes;
104
+ inputReadOnly?: boolean;
105
+ format?: FormatType<RuleType> | FormatType<RuleType>[] | {
106
+ format: string;
107
+ type?: 'mask';
108
+ };
109
+ defaultValue?: RuleType | null;
110
+ value?: RuleType | null;
111
+ onChange?: (date: RuleType, dateString: string | string[]) => void;
112
+ onBlur?: PickerFocusEventHandler;
113
+ onSelect?: ((value: Date | null) => void) | undefined;
114
+ showNow?: boolean;
115
+ clearIcon?: ReactNode;
116
+ getPopupContainer?: (node: HTMLElement) => HTMLElement;
117
+ suffixIcon?: ReactNode;
118
+ placeholder?: string;
119
+ };
@@ -0,0 +1,7 @@
1
+ import { ReactNode } from 'react';
2
+ import { DefaultProps } from '.';
3
+ export type EmptyContentProps = DefaultProps & {
4
+ title?: string;
5
+ description?: string;
6
+ icon?: ReactNode;
7
+ };
@@ -0,0 +1,106 @@
1
+ import { ComponentClass, FC, FormEvent, ReactElement, ReactNode } from 'react';
2
+ import { DefaultProps, RuleType, RuleTypes, SizeType, SyntheticBaseEvent } from '.';
3
+ import { OptionProps } from './select';
4
+ export type RuleRender = (form: FormInstance) => RuleObject;
5
+ export type RuleObject = RuleRender | {
6
+ required?: boolean;
7
+ message?: string;
8
+ pattern?: RegExp;
9
+ min?: number;
10
+ max?: number;
11
+ warningPattern?: RegExp;
12
+ warningMessage?: string;
13
+ validator?: (rule: RuleObject, value: RuleTypes, callback: (error?: string) => void) => Promise<void> | void;
14
+ };
15
+ export interface FieldData {
16
+ name: string | string[];
17
+ value?: RuleTypes;
18
+ errors?: string[];
19
+ }
20
+ export type FieldInstancesInputRef = HTMLInputElement | null;
21
+ export type FieldInstancesRef = {
22
+ input?: FieldInstancesInputRef;
23
+ };
24
+ export interface FieldError {
25
+ name: string;
26
+ errors: string[];
27
+ }
28
+ type FormLayoutTypes = 'horizontal' | 'vertical' | 'inline';
29
+ export type FormProps = DefaultProps & {
30
+ name?: string;
31
+ layout?: FormLayoutTypes;
32
+ form?: FormInstance;
33
+ size?: SizeType;
34
+ initialValues?: Record<string, RuleTypes>;
35
+ children?: ReactNode;
36
+ component?: false | string | FC<ReactNode> | ComponentClass<ReactNode>;
37
+ fields?: FieldData[];
38
+ onChange?: (e: FormEvent<HTMLFormElement>) => void;
39
+ onFieldsChange?: (changedFields: FieldData[]) => void;
40
+ onSubmitCapture?: (changedFields: FieldData[]) => void;
41
+ onValuesChange?: (changedValues: Record<string, RuleTypes>, allValues: Record<string, RuleTypes>) => void;
42
+ onFinish?: (values: Record<string, RuleTypes>) => void;
43
+ onFinishFailed?: (errorInfo: {
44
+ values: Record<string, RuleTypes>;
45
+ errorFields: Pick<FieldError, 'errors' | 'name'>[];
46
+ }) => void;
47
+ };
48
+ export type FormItemProps = DefaultProps & {
49
+ name: string;
50
+ label?: string | ReactNode;
51
+ rules?: RuleObject[];
52
+ initialValue?: RuleType;
53
+ children: (ReactElement & {
54
+ props: {
55
+ value: RuleTypes;
56
+ };
57
+ }) | (ReactElement & {
58
+ props: {
59
+ value: RuleTypes;
60
+ };
61
+ })[];
62
+ layout?: FormLayoutTypes;
63
+ valuePropName?: string;
64
+ dependencies?: string[];
65
+ normalize?: (value: RuleType, prevValue: RuleType, allValues: RuleType) => RuleType;
66
+ feedbackIcons?: boolean;
67
+ };
68
+ export interface FormItemChildComponentProps {
69
+ child: React.ReactElement;
70
+ name: string;
71
+ error: boolean;
72
+ fieldValue: RuleTypes;
73
+ value: RuleType;
74
+ setFieldValue: (name: string, value: RuleType) => void;
75
+ onChange?: (e: SyntheticBaseEvent, option?: OptionProps) => void;
76
+ valuePropName?: string;
77
+ size?: SizeType;
78
+ normalize?: (value: RuleType, prevValue: RuleType, allValues: RuleType) => RuleType;
79
+ noStyle?: boolean;
80
+ feedbackIcons?: boolean;
81
+ }
82
+ export interface FormInstance {
83
+ submit: () => Promise<Record<string, RuleTypes> | undefined>;
84
+ setFields: (fields: FieldData[]) => void;
85
+ resetFields: (nameList?: string[]) => void;
86
+ getFieldError: (name: string) => string[];
87
+ registerField: (name: string, rules?: RuleObject[]) => void;
88
+ setFieldValue: (name: string, value: RuleTypes) => void;
89
+ getFieldValue: (name: string) => RuleTypes;
90
+ validateFields: (nameList?: string[]) => Promise<boolean>;
91
+ setFieldsValue: (values: Partial<Record<string, RuleTypes>>) => void;
92
+ getFieldsValue: (nameList?: string[]) => Record<string, RuleTypes>;
93
+ isFieldTouched: (name: string) => boolean;
94
+ getFieldsError: () => Pick<FieldError, 'errors' | 'name'>[];
95
+ isFieldsTouched: (nameList?: string[], allFieldsTouched?: boolean) => boolean;
96
+ getFieldWarning: (name: string) => string[];
97
+ subscribeToField: (name: string, callback: (value: RuleTypes) => void) => () => void;
98
+ subscribeToForm: (callback: (values: Record<string, RuleTypes>) => void) => () => void;
99
+ subscribeToFields: (names: string[], callback: (values: Record<string, RuleTypes>) => void) => () => void;
100
+ isFieldValidating: (name: string) => boolean;
101
+ onFieldsChange?: (changedFields: FieldData[]) => void;
102
+ onValuesChange?: (changedValues: Record<string, RuleTypes>, allValues: Record<string, RuleTypes>) => void;
103
+ getFieldInstance: (fieldName: string) => FieldInstancesRef;
104
+ isReseting: boolean;
105
+ }
106
+ export {};
@@ -0,0 +1,25 @@
1
+ import { CSSProperties, MouseEvent } from 'react';
2
+ export type RuleType = any;
3
+ export type RuleTypes = RuleType | RuleType[];
4
+ export type SizeType = 'small' | 'middle' | 'large';
5
+ export type MouseEventHandlerSelect = MouseEvent<HTMLDivElement> & TargetProps;
6
+ export interface DefaultProps {
7
+ prefixCls?: string;
8
+ className?: string;
9
+ style?: CSSProperties;
10
+ noStyle?: boolean;
11
+ }
12
+ export type TargetProps = {
13
+ target: {
14
+ value: RuleType;
15
+ };
16
+ };
17
+ export type SyntheticBaseEvent = {
18
+ target: EventTarget & {
19
+ value: RuleType;
20
+ };
21
+ nativeEvent?: Event & {
22
+ data?: string | null;
23
+ };
24
+ currentTarget: EventTarget;
25
+ };
@@ -0,0 +1,47 @@
1
+ import { CSSProperties, InputHTMLAttributes, KeyboardEvent, KeyboardEventHandler, MouseEventHandler, ReactElement, ReactNode, TextareaHTMLAttributes } from 'react';
2
+ import { DefaultProps, SizeType, SyntheticBaseEvent } from '.';
3
+ export type InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix'> & DefaultProps & {
4
+ addonBefore?: ReactNode;
5
+ addonAfter?: ReactNode;
6
+ size?: SizeType;
7
+ prefix?: ReactNode;
8
+ suffix?: ReactNode;
9
+ disabled?: boolean;
10
+ allowClear?: boolean;
11
+ error?: boolean;
12
+ bordered?: boolean;
13
+ iconRender?: (visible: boolean) => ReactElement;
14
+ onChange?: (event: SyntheticBaseEvent) => void;
15
+ onClick?: MouseEventHandler<HTMLElement>;
16
+ onMouseEnter?: MouseEventHandler<HTMLElement>;
17
+ onMouseLeave?: MouseEventHandler<HTMLElement>;
18
+ onKeyPress?: KeyboardEventHandler<HTMLElement>;
19
+ onKeyDown?: KeyboardEventHandler<HTMLElement>;
20
+ onPressEnter?: (event: KeyboardEvent<HTMLInputElement>) => void;
21
+ feedbackIcons?: boolean;
22
+ };
23
+ export type TextareaProps = Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'onResize'> & DefaultProps & {
24
+ value?: string;
25
+ className?: string;
26
+ style?: CSSProperties;
27
+ autoSize?: boolean | {
28
+ minRows?: number;
29
+ maxRows?: number;
30
+ };
31
+ onPressEnter?: KeyboardEventHandler<HTMLTextAreaElement>;
32
+ onResize?: (size: {
33
+ width: number;
34
+ height: number;
35
+ }) => void;
36
+ styles?: {
37
+ textarea?: CSSProperties;
38
+ count?: CSSProperties;
39
+ };
40
+ bordered?: boolean;
41
+ size?: SizeType;
42
+ status?: 'success' | 'error';
43
+ rootClassName?: string;
44
+ variant?: 'outlined' | 'borderless' | 'filled' | 'underlined';
45
+ error?: boolean;
46
+ allowClear?: boolean;
47
+ };
@@ -0,0 +1,57 @@
1
+ import { CSSProperties, FocusEventHandler, KeyboardEventHandler, MouseEventHandler, ReactNode } from 'react';
2
+ import { DefaultProps, RuleType, SizeType, SyntheticBaseEvent } from '.';
3
+ export type RadioValueType = string | number | readonly string[] | undefined;
4
+ export interface RadioGroupProps {
5
+ defaultValue?: RuleType;
6
+ value?: RuleType;
7
+ onChange?: (e: SyntheticBaseEvent) => void;
8
+ size?: SizeType;
9
+ disabled?: boolean;
10
+ onMouseEnter?: MouseEventHandler<HTMLDivElement>;
11
+ onMouseLeave?: MouseEventHandler<HTMLDivElement>;
12
+ name?: string;
13
+ children?: ReactNode;
14
+ id?: string;
15
+ optionType?: 'default' | 'button';
16
+ buttonStyle?: 'outline' | 'solid';
17
+ onFocus?: FocusEventHandler<HTMLDivElement>;
18
+ onBlur?: FocusEventHandler<HTMLDivElement>;
19
+ block?: boolean;
20
+ prefixCls?: string;
21
+ className?: string;
22
+ options?: Array<{
23
+ label: ReactNode;
24
+ value: RuleType;
25
+ disabled?: boolean;
26
+ }> | string[] | number[];
27
+ style?: CSSProperties;
28
+ }
29
+ export type RadioProps = DefaultProps & {
30
+ defaultChecked?: boolean;
31
+ checked?: boolean;
32
+ disabled?: boolean;
33
+ title?: string;
34
+ onChange?: (e: SyntheticBaseEvent) => void;
35
+ onClick?: MouseEventHandler<HTMLElement>;
36
+ onMouseEnter?: MouseEventHandler<HTMLElement>;
37
+ onMouseLeave?: MouseEventHandler<HTMLElement>;
38
+ onKeyPress?: KeyboardEventHandler<HTMLElement>;
39
+ onKeyDown?: KeyboardEventHandler<HTMLElement>;
40
+ onFocus?: FocusEventHandler<HTMLInputElement>;
41
+ onBlur?: FocusEventHandler<HTMLInputElement>;
42
+ value?: RuleType;
43
+ tabIndex?: number;
44
+ name?: string;
45
+ children?: ReactNode;
46
+ id?: string;
47
+ autoFocus?: boolean;
48
+ type?: string;
49
+ skipGroup?: boolean;
50
+ required?: boolean;
51
+ button?: boolean;
52
+ error?: boolean;
53
+ };
54
+ export type RadioButtonProps = RadioProps & {
55
+ children?: ReactNode;
56
+ size?: SizeType;
57
+ };
@@ -0,0 +1,97 @@
1
+ import { ChangeEventHandler, CSSProperties, FocusEventHandler, Key, KeyboardEventHandler, MouseEvent, MouseEventHandler, ReactElement, ReactEventHandler, ReactNode } from 'react';
2
+ import { DefaultProps, RuleType, RuleTypes, TargetProps } from '.';
3
+ export type SelectProps = DefaultProps & {
4
+ id?: string;
5
+ searchValue?: string;
6
+ onSearch?: (value: string) => void;
7
+ autoClearSearchValue?: boolean;
8
+ onSelect?: (value: RuleTypes, option?: OptionType) => void;
9
+ onDeselect?: (value: string, option?: OptionType) => void;
10
+ filterOption?: boolean | ((input: string, option: OptionType) => boolean);
11
+ optionFilterProp?: string;
12
+ options?: OptionType[];
13
+ children?: ReactNode;
14
+ defaultActiveFirstOption?: boolean;
15
+ listHeight?: number;
16
+ menuItemSelectedIcon?: ReactNode;
17
+ mode?: 'default' | 'multiple' | 'tags';
18
+ value?: RuleTypes;
19
+ defaultValue?: RuleTypes;
20
+ maxCount?: number;
21
+ onChange?: (e: RuleTypes, option?: OptionType) => void;
22
+ disabled?: boolean;
23
+ loading?: boolean;
24
+ placeholder?: string;
25
+ allowClear?: boolean;
26
+ filterable?: boolean;
27
+ defaultOpen?: boolean;
28
+ size?: 'small' | 'middle' | 'large';
29
+ onClear?: () => void;
30
+ error?: boolean;
31
+ showSearch?: boolean;
32
+ tagRender?: ((props: CustomTagProps) => ReactElement) | undefined;
33
+ maxTagPlaceholder?: ReactNode | ((omittedValues: DisplayValueType[]) => ReactNode);
34
+ dropdownClassName?: string;
35
+ showArrow?: boolean;
36
+ onBlur?: FocusEventHandler<HTMLElement> | undefined;
37
+ onDropdownVisibleChange?: ((open: boolean) => void) | undefined;
38
+ showAction?: ('click' | 'focus')[] | undefined;
39
+ suffixIcon?: ReactNode;
40
+ open?: boolean;
41
+ notFoundContent?: ReactNode;
42
+ getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;
43
+ dropdownRender?: (menu: ReactNode) => ReactNode;
44
+ feedbackIcons?: boolean;
45
+ placement?: 'bottomLeft' | 'bottomRight' | 'topLeft' | 'topRight';
46
+ removeIcon?: ReactNode;
47
+ };
48
+ export interface OptionType {
49
+ value: RuleType;
50
+ disabled?: boolean;
51
+ children?: ReactNode;
52
+ className?: string;
53
+ style?: CSSProperties;
54
+ onClick?: MouseEventHandler<HTMLDivElement>;
55
+ render?: (label: string) => ReactNode;
56
+ prefixCls?: string;
57
+ label?: RuleType;
58
+ }
59
+ export type CustomTagProps = DefaultProps & {
60
+ label?: ReactNode;
61
+ value: string;
62
+ onClose: (e: MouseEvent<HTMLSpanElement> & TargetProps) => void;
63
+ onMouseDown?: MouseEventHandler | undefined;
64
+ onLoadCapture?: ReactEventHandler | undefined;
65
+ closable?: boolean;
66
+ isMaxTag?: boolean;
67
+ color?: string;
68
+ icon?: ReactNode;
69
+ };
70
+ export type TagProps = DefaultProps & {
71
+ values?: string[];
72
+ onClose: (e: MouseEvent<HTMLSpanElement> & TargetProps) => void;
73
+ icon?: ReactNode;
74
+ closable?: boolean;
75
+ onChange?: ChangeEventHandler<HTMLInputElement>;
76
+ onKeyDown?: KeyboardEventHandler<HTMLInputElement>;
77
+ };
78
+ export interface DisplayValueType {
79
+ key?: Key;
80
+ value?: RuleType;
81
+ label?: ReactNode;
82
+ title?: string | number;
83
+ disabled?: boolean;
84
+ }
85
+ export interface OptionProps {
86
+ value: RuleType;
87
+ disabled?: boolean;
88
+ children?: ReactNode;
89
+ className?: string;
90
+ style?: CSSProperties;
91
+ onClick?: MouseEventHandler<HTMLDivElement>;
92
+ render?: (label: string) => ReactNode;
93
+ onMouseEnter?: MouseEventHandler<HTMLDivElement>;
94
+ prefixCls?: string;
95
+ selected?: boolean;
96
+ title?: string;
97
+ }