@ldkj/web-ui 0.15.0 → 0.16.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/LICENSE +21 -21
- package/components/form/auto-complete/AutoComplete.d.ts +100 -3
- package/components/form/cascader/Cascader.d.ts +128 -7
- package/components/form/form/Form.d.ts +67 -0
- package/components/form/form/index.d.ts +2 -0
- package/components/form/form/useForm.d.ts +157 -0
- package/components/form/input/index.d.ts +1 -0
- package/components/form/input/useInputValue.d.ts +27 -0
- package/components/form/input-number/InputNumber.d.ts +45 -1
- package/components/form/input-opt/InputOPT.d.ts +98 -4
- package/components/form/rate/Rate.d.ts +68 -3
- package/components/form/slider/Slider.d.ts +30 -0
- package/components/form/slider/index.d.ts +1 -0
- package/components/form/uploader/Uploader.d.ts +4 -0
- package/components/interact/popover/Popover.d.ts +3 -0
- package/components/mobile/index.d.ts +2 -0
- package/components/mobile/mobile-cascader/MobileCascader.d.ts +85 -0
- package/components/mobile/mobile-cascader/index.d.ts +1 -0
- package/components/mobile/mobile-select/MobileSelect.d.ts +86 -0
- package/components/mobile/mobile-select/index.d.ts +1 -0
- package/components/mobile/shared.d.ts +62 -0
- package/index.cjs +17 -17
- package/index.d.ts +3 -2
- package/index.js +8289 -5535
- package/package.json +1 -1
- package/style.css +1 -1
- package/components/form/form-v2/FormV2.d.ts +0 -5
- package/components/form/form-v2/index.d.ts +0 -1
- package/components/form/slider-v2/SliderV2.d.ts +0 -7
- package/components/form/slider-v2/index.d.ts +0 -1
|
@@ -1,9 +1,103 @@
|
|
|
1
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type SxProps } from "@/styling";
|
|
3
|
+
export type InputOPTValueType = "numeric" | "alphabetic" | "alphanumeric";
|
|
4
|
+
export type InputOPTSize = "sm" | "md" | "lg";
|
|
5
|
+
export type InputOPTVariant = "outline" | "filled" | "underline";
|
|
6
|
+
type NativeInputProps = Omit<React.ComponentPropsWithoutRef<"input">, "autoFocus" | "children" | "className" | "defaultValue" | "maxLength" | "onChange" | "pattern" | "placeholder" | "size" | "style" | "type" | "value">;
|
|
7
|
+
export type InputOPTProps = NativeInputProps & {
|
|
8
|
+
/** 受控验证码值。 */
|
|
2
9
|
value?: string;
|
|
10
|
+
/** 非受控默认验证码值。 */
|
|
11
|
+
defaultValue?: string;
|
|
12
|
+
/** 验证码位数。 */
|
|
3
13
|
length?: number;
|
|
4
|
-
|
|
14
|
+
/** 值变化回调,返回过滤后的完整验证码字符串。 */
|
|
15
|
+
onChange?: (value: string) => void;
|
|
16
|
+
/** 填满所有位后触发。 */
|
|
17
|
+
onComplete?: (value: string) => void;
|
|
18
|
+
/** 字符类型过滤规则。 */
|
|
19
|
+
type?: InputOPTValueType;
|
|
20
|
+
/** 自定义单字符过滤规则。 */
|
|
21
|
+
pattern?: RegExp | string;
|
|
22
|
+
/** 粘贴内容进入过滤前的转换函数。 */
|
|
23
|
+
pasteTransformer?: (value: string) => string;
|
|
24
|
+
/** 是否视觉掩码展示,传入字符串可自定义掩码字符。 */
|
|
25
|
+
mask?: boolean | string;
|
|
26
|
+
/** 空槽位占位字符。 */
|
|
27
|
+
placeholder?: string;
|
|
28
|
+
/** 首次挂载时是否自动聚焦输入。 */
|
|
29
|
+
autoFocus?: boolean;
|
|
30
|
+
/** 是否启用一次性验证码自动填充语义。 */
|
|
31
|
+
oneTimeCode?: boolean;
|
|
32
|
+
/** 槽位尺寸。 */
|
|
33
|
+
size?: InputOPTSize;
|
|
34
|
+
/** 槽位视觉风格。 */
|
|
35
|
+
variant?: InputOPTVariant;
|
|
36
|
+
/** 是否展示错误态。 */
|
|
37
|
+
invalid?: boolean;
|
|
38
|
+
/** 根节点类名。 */
|
|
5
39
|
className?: string;
|
|
40
|
+
/** 兼容旧写法的根节点类名。 */
|
|
6
41
|
class?: string;
|
|
7
|
-
|
|
42
|
+
/** 真实 input 的类名。 */
|
|
43
|
+
inputClassName?: string;
|
|
44
|
+
/** 单个槽位类名。 */
|
|
45
|
+
slotClassName?: string;
|
|
46
|
+
/** 槽位之间的分隔内容。 */
|
|
47
|
+
separator?: React.ReactNode | ((index: number) => React.ReactNode);
|
|
48
|
+
/** 根节点样式。 */
|
|
49
|
+
style?: React.CSSProperties;
|
|
50
|
+
/** CSS-in-JS 样式入口。 */
|
|
51
|
+
sx?: SxProps;
|
|
8
52
|
};
|
|
9
|
-
|
|
53
|
+
/**
|
|
54
|
+
* InputOPT 是一次性验证码输入组件。它使用一个真实 input 承接输入、自动填充和表单提交,
|
|
55
|
+
* 再用槽位展示验证码字符,确保线性输入、连续删除和粘贴分发行为稳定一致。
|
|
56
|
+
*/
|
|
57
|
+
export declare const InputOPT: React.ForwardRefExoticComponent<NativeInputProps & {
|
|
58
|
+
/** 受控验证码值。 */
|
|
59
|
+
value?: string;
|
|
60
|
+
/** 非受控默认验证码值。 */
|
|
61
|
+
defaultValue?: string;
|
|
62
|
+
/** 验证码位数。 */
|
|
63
|
+
length?: number;
|
|
64
|
+
/** 值变化回调,返回过滤后的完整验证码字符串。 */
|
|
65
|
+
onChange?: (value: string) => void;
|
|
66
|
+
/** 填满所有位后触发。 */
|
|
67
|
+
onComplete?: (value: string) => void;
|
|
68
|
+
/** 字符类型过滤规则。 */
|
|
69
|
+
type?: InputOPTValueType;
|
|
70
|
+
/** 自定义单字符过滤规则。 */
|
|
71
|
+
pattern?: RegExp | string;
|
|
72
|
+
/** 粘贴内容进入过滤前的转换函数。 */
|
|
73
|
+
pasteTransformer?: (value: string) => string;
|
|
74
|
+
/** 是否视觉掩码展示,传入字符串可自定义掩码字符。 */
|
|
75
|
+
mask?: boolean | string;
|
|
76
|
+
/** 空槽位占位字符。 */
|
|
77
|
+
placeholder?: string;
|
|
78
|
+
/** 首次挂载时是否自动聚焦输入。 */
|
|
79
|
+
autoFocus?: boolean;
|
|
80
|
+
/** 是否启用一次性验证码自动填充语义。 */
|
|
81
|
+
oneTimeCode?: boolean;
|
|
82
|
+
/** 槽位尺寸。 */
|
|
83
|
+
size?: InputOPTSize;
|
|
84
|
+
/** 槽位视觉风格。 */
|
|
85
|
+
variant?: InputOPTVariant;
|
|
86
|
+
/** 是否展示错误态。 */
|
|
87
|
+
invalid?: boolean;
|
|
88
|
+
/** 根节点类名。 */
|
|
89
|
+
className?: string;
|
|
90
|
+
/** 兼容旧写法的根节点类名。 */
|
|
91
|
+
class?: string;
|
|
92
|
+
/** 真实 input 的类名。 */
|
|
93
|
+
inputClassName?: string;
|
|
94
|
+
/** 单个槽位类名。 */
|
|
95
|
+
slotClassName?: string;
|
|
96
|
+
/** 槽位之间的分隔内容。 */
|
|
97
|
+
separator?: React.ReactNode | ((index: number) => React.ReactNode);
|
|
98
|
+
/** 根节点样式。 */
|
|
99
|
+
style?: React.CSSProperties;
|
|
100
|
+
/** CSS-in-JS 样式入口。 */
|
|
101
|
+
sx?: SxProps;
|
|
102
|
+
} & React.RefAttributes<HTMLInputElement>>;
|
|
103
|
+
export {};
|
|
@@ -1,9 +1,74 @@
|
|
|
1
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type SxProps } from "@/styling";
|
|
3
|
+
export type RateSize = "sm" | "md" | "lg";
|
|
4
|
+
export type RateProps = Omit<React.ComponentPropsWithoutRef<"div">, "children" | "onChange"> & {
|
|
5
|
+
/** 受控评分值。 */
|
|
2
6
|
value?: number;
|
|
7
|
+
/** 非受控默认评分值。 */
|
|
8
|
+
defaultValue?: number;
|
|
9
|
+
/** 星级总数,最小为 `1`。 */
|
|
3
10
|
count?: number;
|
|
11
|
+
/** 是否允许再次点击当前值后清空。 */
|
|
12
|
+
allowClear?: boolean;
|
|
13
|
+
/** 是否移除外层边框与背景。 */
|
|
14
|
+
borderless?: boolean;
|
|
15
|
+
/** 是否禁用。 */
|
|
4
16
|
disabled?: boolean;
|
|
17
|
+
/** 是否只读。只读时保留展示,不响应交互。 */
|
|
18
|
+
readOnly?: boolean;
|
|
19
|
+
/** 与原生表单联动的字段名。 */
|
|
20
|
+
name?: string;
|
|
21
|
+
/** 评分变更回调。 */
|
|
22
|
+
onChange?: (value: number) => void;
|
|
23
|
+
/** 鼠标悬停预览值变更回调。 */
|
|
24
|
+
onHoverChange?: (value: number | null) => void;
|
|
25
|
+
/** 星星尺寸。 */
|
|
26
|
+
size?: RateSize;
|
|
27
|
+
/** 评分图标。 */
|
|
28
|
+
character?: React.ReactNode;
|
|
29
|
+
/** 根节点类名。 */
|
|
5
30
|
className?: string;
|
|
31
|
+
/** 兼容旧写法的类名。 */
|
|
6
32
|
class?: string;
|
|
7
|
-
|
|
33
|
+
/** 根节点样式。 */
|
|
34
|
+
style?: React.CSSProperties;
|
|
35
|
+
/** CSS-in-JS 样式入口。 */
|
|
36
|
+
sx?: SxProps;
|
|
8
37
|
};
|
|
9
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Rate 用于星级评分、满意度打分和快速反馈场景,支持受控/非受控、悬停预览、键盘操作与表单提交。
|
|
40
|
+
*/
|
|
41
|
+
export declare const Rate: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "children" | "onChange"> & {
|
|
42
|
+
/** 受控评分值。 */
|
|
43
|
+
value?: number;
|
|
44
|
+
/** 非受控默认评分值。 */
|
|
45
|
+
defaultValue?: number;
|
|
46
|
+
/** 星级总数,最小为 `1`。 */
|
|
47
|
+
count?: number;
|
|
48
|
+
/** 是否允许再次点击当前值后清空。 */
|
|
49
|
+
allowClear?: boolean;
|
|
50
|
+
/** 是否移除外层边框与背景。 */
|
|
51
|
+
borderless?: boolean;
|
|
52
|
+
/** 是否禁用。 */
|
|
53
|
+
disabled?: boolean;
|
|
54
|
+
/** 是否只读。只读时保留展示,不响应交互。 */
|
|
55
|
+
readOnly?: boolean;
|
|
56
|
+
/** 与原生表单联动的字段名。 */
|
|
57
|
+
name?: string;
|
|
58
|
+
/** 评分变更回调。 */
|
|
59
|
+
onChange?: (value: number) => void;
|
|
60
|
+
/** 鼠标悬停预览值变更回调。 */
|
|
61
|
+
onHoverChange?: (value: number | null) => void;
|
|
62
|
+
/** 星星尺寸。 */
|
|
63
|
+
size?: RateSize;
|
|
64
|
+
/** 评分图标。 */
|
|
65
|
+
character?: React.ReactNode;
|
|
66
|
+
/** 根节点类名。 */
|
|
67
|
+
className?: string;
|
|
68
|
+
/** 兼容旧写法的类名。 */
|
|
69
|
+
class?: string;
|
|
70
|
+
/** 根节点样式。 */
|
|
71
|
+
style?: React.CSSProperties;
|
|
72
|
+
/** CSS-in-JS 样式入口。 */
|
|
73
|
+
sx?: SxProps;
|
|
74
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type SxProps } from "@/styling";
|
|
3
|
+
export type SliderProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, "type" | "value" | "onChange"> & {
|
|
4
|
+
value?: number;
|
|
5
|
+
class?: string;
|
|
6
|
+
/**
|
|
7
|
+
* 视觉变体。
|
|
8
|
+
* - `"solid"`:纯色风格,与组件库整体风格统一(默认)
|
|
9
|
+
* - `"gradient"`:渐变色风格,提供更丰富的视觉效果
|
|
10
|
+
*/
|
|
11
|
+
variant?: "solid" | "gradient";
|
|
12
|
+
/**
|
|
13
|
+
* 轨道粗细。数字会自动转换为 px,字符串会作为 CSS 长度值透传。
|
|
14
|
+
*/
|
|
15
|
+
trackSize?: number | string;
|
|
16
|
+
/**
|
|
17
|
+
* 滑块头尺寸。数字会自动转换为 px,字符串会作为 CSS 长度值透传。
|
|
18
|
+
*/
|
|
19
|
+
thumbSize?: number | string;
|
|
20
|
+
sx?: SxProps;
|
|
21
|
+
onValueChange?: (value: number) => void;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Slider 是原生 range 输入的封装,保留浏览器原生交互语义,
|
|
25
|
+
* 同时提供更符合本库风格的视觉样式与数值回调。
|
|
26
|
+
*/
|
|
27
|
+
export declare function Slider(props: SliderProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export declare namespace Slider {
|
|
29
|
+
var displayName: string;
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Slider";
|
|
@@ -11,6 +11,7 @@ type PopoverWrapperProps<TProps> = Omit<TProps, "className" | "style"> & {
|
|
|
11
11
|
class?: string;
|
|
12
12
|
style?: React.CSSProperties;
|
|
13
13
|
sx?: SxProps;
|
|
14
|
+
asChildWrapper?: React.ElementType;
|
|
14
15
|
};
|
|
15
16
|
export type PopoverTriggerProps = PopoverWrapperProps<RadixPopoverTriggerProps>;
|
|
16
17
|
export type PopoverCloseProps = PopoverWrapperProps<RadixPopoverCloseProps>;
|
|
@@ -30,6 +31,7 @@ declare const PopoverTrigger: React.ForwardRefExoticComponent<Omit<Omit<PopoverP
|
|
|
30
31
|
class?: string;
|
|
31
32
|
style?: React.CSSProperties;
|
|
32
33
|
sx?: SxProps;
|
|
34
|
+
asChildWrapper?: React.ElementType;
|
|
33
35
|
} & React.RefAttributes<HTMLElement>>;
|
|
34
36
|
/**
|
|
35
37
|
* Popover 锚点。
|
|
@@ -47,6 +49,7 @@ declare const PopoverClose: React.ForwardRefExoticComponent<Omit<Omit<PopoverPri
|
|
|
47
49
|
class?: string;
|
|
48
50
|
style?: React.CSSProperties;
|
|
49
51
|
sx?: SxProps;
|
|
52
|
+
asChildWrapper?: React.ElementType;
|
|
50
53
|
} & React.RefAttributes<HTMLElement>>;
|
|
51
54
|
/**
|
|
52
55
|
* PopoverContent 的属性。
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { CascaderFieldNames, CascaderLoadDataMeta, CascaderOption, CascaderRenderOptionState, CascaderValue, CascaderValueChangeMeta } from "@/components/form/cascader";
|
|
3
|
+
import { type SxProps } from "@/styling";
|
|
4
|
+
import { type MobileOptionAlign } from "../shared";
|
|
5
|
+
export type MobileCascaderRef = {
|
|
6
|
+
focus: () => void;
|
|
7
|
+
blur: () => void;
|
|
8
|
+
open: () => void;
|
|
9
|
+
close: () => void;
|
|
10
|
+
clear: () => void;
|
|
11
|
+
getValue: () => CascaderValue;
|
|
12
|
+
};
|
|
13
|
+
export type MobileCascaderProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "children" | "value" | "defaultValue" | "onChange"> & {
|
|
14
|
+
class?: string;
|
|
15
|
+
sx?: SxProps;
|
|
16
|
+
options?: CascaderOption[];
|
|
17
|
+
value?: CascaderValue;
|
|
18
|
+
defaultValue?: CascaderValue;
|
|
19
|
+
onValueChange?: (value: CascaderValue, meta: CascaderValueChangeMeta) => void;
|
|
20
|
+
open?: boolean;
|
|
21
|
+
defaultOpen?: boolean;
|
|
22
|
+
onOpenChange?: (open: boolean) => void;
|
|
23
|
+
placeholder?: React.ReactNode;
|
|
24
|
+
title?: React.ReactNode;
|
|
25
|
+
cancelText?: React.ReactNode;
|
|
26
|
+
confirmText?: React.ReactNode;
|
|
27
|
+
separator?: React.ReactNode;
|
|
28
|
+
displayRender?: (labels: React.ReactNode[], options: CascaderOption[]) => React.ReactNode;
|
|
29
|
+
renderOption?: (option: CascaderOption, state: CascaderRenderOptionState) => React.ReactNode;
|
|
30
|
+
fieldNames?: CascaderFieldNames;
|
|
31
|
+
changeOnSelect?: boolean;
|
|
32
|
+
clearable?: boolean;
|
|
33
|
+
readOnly?: boolean;
|
|
34
|
+
required?: boolean;
|
|
35
|
+
loadData?: (selectedOptions: CascaderOption[], meta: CascaderLoadDataMeta) => void | Promise<void>;
|
|
36
|
+
align?: MobileOptionAlign;
|
|
37
|
+
levelLabels?: React.ReactNode[];
|
|
38
|
+
drawerClassName?: string;
|
|
39
|
+
drawerClass?: string;
|
|
40
|
+
drawerStyle?: React.CSSProperties;
|
|
41
|
+
drawerSx?: SxProps;
|
|
42
|
+
maxDrawerHeight?: number | string;
|
|
43
|
+
optionClassName?: string;
|
|
44
|
+
optionClass?: string;
|
|
45
|
+
optionStyle?: React.CSSProperties;
|
|
46
|
+
optionSx?: SxProps;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* MobileCascader 是移动端级联抽屉,沿用 Cascader 的路径数组值模型。
|
|
50
|
+
*/
|
|
51
|
+
export declare const MobileCascader: React.ForwardRefExoticComponent<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "value" | "children" | "defaultValue" | "onChange"> & {
|
|
52
|
+
class?: string;
|
|
53
|
+
sx?: SxProps;
|
|
54
|
+
options?: CascaderOption[];
|
|
55
|
+
value?: CascaderValue;
|
|
56
|
+
defaultValue?: CascaderValue;
|
|
57
|
+
onValueChange?: (value: CascaderValue, meta: CascaderValueChangeMeta) => void;
|
|
58
|
+
open?: boolean;
|
|
59
|
+
defaultOpen?: boolean;
|
|
60
|
+
onOpenChange?: (open: boolean) => void;
|
|
61
|
+
placeholder?: React.ReactNode;
|
|
62
|
+
title?: React.ReactNode;
|
|
63
|
+
cancelText?: React.ReactNode;
|
|
64
|
+
confirmText?: React.ReactNode;
|
|
65
|
+
separator?: React.ReactNode;
|
|
66
|
+
displayRender?: (labels: React.ReactNode[], options: CascaderOption[]) => React.ReactNode;
|
|
67
|
+
renderOption?: (option: CascaderOption, state: CascaderRenderOptionState) => React.ReactNode;
|
|
68
|
+
fieldNames?: CascaderFieldNames;
|
|
69
|
+
changeOnSelect?: boolean;
|
|
70
|
+
clearable?: boolean;
|
|
71
|
+
readOnly?: boolean;
|
|
72
|
+
required?: boolean;
|
|
73
|
+
loadData?: (selectedOptions: CascaderOption[], meta: CascaderLoadDataMeta) => void | Promise<void>;
|
|
74
|
+
align?: MobileOptionAlign;
|
|
75
|
+
levelLabels?: React.ReactNode[];
|
|
76
|
+
drawerClassName?: string;
|
|
77
|
+
drawerClass?: string;
|
|
78
|
+
drawerStyle?: React.CSSProperties;
|
|
79
|
+
drawerSx?: SxProps;
|
|
80
|
+
maxDrawerHeight?: number | string;
|
|
81
|
+
optionClassName?: string;
|
|
82
|
+
optionClass?: string;
|
|
83
|
+
optionStyle?: React.CSSProperties;
|
|
84
|
+
optionSx?: SxProps;
|
|
85
|
+
} & React.RefAttributes<MobileCascaderRef>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./MobileCascader";
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { SelectOption, SelectOptionGroup } from "@/components/form/select";
|
|
3
|
+
import { type SxProps } from "@/styling";
|
|
4
|
+
import { type MobileOptionAlign } from "../shared";
|
|
5
|
+
export type MobileSelectValueChangeReason = "select" | "clear";
|
|
6
|
+
export type MobileSelectValueChangeMeta = {
|
|
7
|
+
reason: MobileSelectValueChangeReason;
|
|
8
|
+
option?: SelectOption;
|
|
9
|
+
event?: React.SyntheticEvent;
|
|
10
|
+
};
|
|
11
|
+
export type MobileSelectRenderOptionState = {
|
|
12
|
+
active: boolean;
|
|
13
|
+
checked: boolean;
|
|
14
|
+
disabled: boolean;
|
|
15
|
+
};
|
|
16
|
+
export type MobileSelectRef = {
|
|
17
|
+
focus: () => void;
|
|
18
|
+
blur: () => void;
|
|
19
|
+
open: () => void;
|
|
20
|
+
close: () => void;
|
|
21
|
+
clear: () => void;
|
|
22
|
+
getValue: () => string;
|
|
23
|
+
};
|
|
24
|
+
export type MobileSelectProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "children" | "value" | "defaultValue" | "onChange"> & {
|
|
25
|
+
class?: string;
|
|
26
|
+
sx?: SxProps;
|
|
27
|
+
options?: Array<SelectOption | SelectOptionGroup>;
|
|
28
|
+
value?: string;
|
|
29
|
+
defaultValue?: string;
|
|
30
|
+
onValueChange?: (value: string, meta: MobileSelectValueChangeMeta) => void;
|
|
31
|
+
open?: boolean;
|
|
32
|
+
defaultOpen?: boolean;
|
|
33
|
+
onOpenChange?: (open: boolean) => void;
|
|
34
|
+
placeholder?: React.ReactNode;
|
|
35
|
+
title?: React.ReactNode;
|
|
36
|
+
cancelText?: React.ReactNode;
|
|
37
|
+
confirmText?: React.ReactNode;
|
|
38
|
+
clearable?: boolean;
|
|
39
|
+
readOnly?: boolean;
|
|
40
|
+
required?: boolean;
|
|
41
|
+
align?: MobileOptionAlign;
|
|
42
|
+
displayRender?: (option: SelectOption | undefined) => React.ReactNode;
|
|
43
|
+
renderOption?: (option: SelectOption, state: MobileSelectRenderOptionState) => React.ReactNode;
|
|
44
|
+
drawerClassName?: string;
|
|
45
|
+
drawerClass?: string;
|
|
46
|
+
drawerStyle?: React.CSSProperties;
|
|
47
|
+
drawerSx?: SxProps;
|
|
48
|
+
maxDrawerHeight?: number | string;
|
|
49
|
+
optionClassName?: string;
|
|
50
|
+
optionClass?: string;
|
|
51
|
+
optionStyle?: React.CSSProperties;
|
|
52
|
+
optionSx?: SxProps;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* MobileSelect 是面向移动端的单选抽屉,沿用 Select 的 option 数据模型。
|
|
56
|
+
*/
|
|
57
|
+
export declare const MobileSelect: React.ForwardRefExoticComponent<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "value" | "children" | "defaultValue" | "onChange"> & {
|
|
58
|
+
class?: string;
|
|
59
|
+
sx?: SxProps;
|
|
60
|
+
options?: Array<SelectOption | SelectOptionGroup>;
|
|
61
|
+
value?: string;
|
|
62
|
+
defaultValue?: string;
|
|
63
|
+
onValueChange?: (value: string, meta: MobileSelectValueChangeMeta) => void;
|
|
64
|
+
open?: boolean;
|
|
65
|
+
defaultOpen?: boolean;
|
|
66
|
+
onOpenChange?: (open: boolean) => void;
|
|
67
|
+
placeholder?: React.ReactNode;
|
|
68
|
+
title?: React.ReactNode;
|
|
69
|
+
cancelText?: React.ReactNode;
|
|
70
|
+
confirmText?: React.ReactNode;
|
|
71
|
+
clearable?: boolean;
|
|
72
|
+
readOnly?: boolean;
|
|
73
|
+
required?: boolean;
|
|
74
|
+
align?: MobileOptionAlign;
|
|
75
|
+
displayRender?: (option: SelectOption | undefined) => React.ReactNode;
|
|
76
|
+
renderOption?: (option: SelectOption, state: MobileSelectRenderOptionState) => React.ReactNode;
|
|
77
|
+
drawerClassName?: string;
|
|
78
|
+
drawerClass?: string;
|
|
79
|
+
drawerStyle?: React.CSSProperties;
|
|
80
|
+
drawerSx?: SxProps;
|
|
81
|
+
maxDrawerHeight?: number | string;
|
|
82
|
+
optionClassName?: string;
|
|
83
|
+
optionClass?: string;
|
|
84
|
+
optionStyle?: React.CSSProperties;
|
|
85
|
+
optionSx?: SxProps;
|
|
86
|
+
} & React.RefAttributes<MobileSelectRef>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./MobileSelect";
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type SxProps } from "@/styling";
|
|
3
|
+
export type MobileOptionAlign = "left" | "center" | "right";
|
|
4
|
+
export type MobileDrawerProps = {
|
|
5
|
+
open: boolean;
|
|
6
|
+
title?: React.ReactNode;
|
|
7
|
+
cancelText?: React.ReactNode;
|
|
8
|
+
confirmText?: React.ReactNode;
|
|
9
|
+
confirmDisabled?: boolean;
|
|
10
|
+
maxHeight?: number | string;
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
className?: string;
|
|
13
|
+
class?: string;
|
|
14
|
+
style?: React.CSSProperties;
|
|
15
|
+
sx?: SxProps;
|
|
16
|
+
onCancel?: () => void;
|
|
17
|
+
onConfirm?: () => void;
|
|
18
|
+
onOpenChange?: (open: boolean) => void;
|
|
19
|
+
};
|
|
20
|
+
export type MobileTriggerProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "children"> & {
|
|
21
|
+
open?: boolean;
|
|
22
|
+
clearable?: boolean;
|
|
23
|
+
hasValue?: boolean;
|
|
24
|
+
readOnly?: boolean;
|
|
25
|
+
placeholder?: React.ReactNode;
|
|
26
|
+
display?: React.ReactNode;
|
|
27
|
+
class?: string;
|
|
28
|
+
sx?: SxProps;
|
|
29
|
+
onClear?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
30
|
+
};
|
|
31
|
+
type ControllableOptions<T> = {
|
|
32
|
+
value?: T;
|
|
33
|
+
defaultValue: T;
|
|
34
|
+
onChange?: (value: T) => void;
|
|
35
|
+
};
|
|
36
|
+
export declare function useControllableValue<T>(options: ControllableOptions<T>): readonly [T, (nextValue: T) => void, boolean];
|
|
37
|
+
export declare function useResolvedSx(sx: SxProps | undefined): {
|
|
38
|
+
sxClassName: undefined;
|
|
39
|
+
sxInlineStyle: undefined;
|
|
40
|
+
} | {
|
|
41
|
+
sxClassName: string;
|
|
42
|
+
sxInlineStyle: React.CSSProperties;
|
|
43
|
+
};
|
|
44
|
+
export declare function resolveLength(value: number | string | undefined): string | undefined;
|
|
45
|
+
export declare function getAlignClass(align: MobileOptionAlign | undefined): "justify-center text-center" | "justify-end text-right" | "justify-start text-left";
|
|
46
|
+
export declare function ChevronDownIcon(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
|
|
47
|
+
export declare function ChevronRightIcon(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
|
|
48
|
+
export declare function ClearIcon(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
|
|
49
|
+
export declare function LoadingSpinner(): import("react/jsx-runtime").JSX.Element;
|
|
50
|
+
export declare function MobileDrawer(props: MobileDrawerProps): import("react/jsx-runtime").JSX.Element | null;
|
|
51
|
+
export declare const MobileTrigger: React.ForwardRefExoticComponent<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "children"> & {
|
|
52
|
+
open?: boolean;
|
|
53
|
+
clearable?: boolean;
|
|
54
|
+
hasValue?: boolean;
|
|
55
|
+
readOnly?: boolean;
|
|
56
|
+
placeholder?: React.ReactNode;
|
|
57
|
+
display?: React.ReactNode;
|
|
58
|
+
class?: string;
|
|
59
|
+
sx?: SxProps;
|
|
60
|
+
onClear?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
61
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
62
|
+
export {};
|