@ldkj/web-ui 0.21.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 ldkj
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ldkj
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @ldkj/web-ui
2
2
 
3
- 由 shadcn-ui, Tailwind CSS 和 VitePress 构建的 React 组件库.
3
+ 由 shadcn-ui, Tailwind CSS 和 VitePress 构建的企业级 React 组件库.
4
4
 
5
5
  ## 立即开始
6
6
 
@@ -0,0 +1,145 @@
1
+ import * as React from "react";
2
+ import { type SxProps } from "@/styling";
3
+ export type CollapseKey = string | number;
4
+ export type CollapseActiveKey = CollapseKey | CollapseKey[] | null;
5
+ export type CollapseSize = "sm" | "md" | "lg";
6
+ export type CollapseVariant = "outlined" | "filled" | "plain" | "ghost";
7
+ export type CollapseExpandIconPosition = "start" | "end";
8
+ type StyledDivProps = Omit<React.HTMLAttributes<HTMLDivElement>, "className"> & {
9
+ className?: string;
10
+ class?: string;
11
+ sx?: SxProps;
12
+ };
13
+ export type CollapseExpandIconRenderProps = {
14
+ active: boolean;
15
+ disabled: boolean;
16
+ value: CollapseKey;
17
+ };
18
+ export type CollapseItemConfig = {
19
+ key: CollapseKey;
20
+ label: React.ReactNode;
21
+ children?: React.ReactNode;
22
+ disabled?: boolean;
23
+ collapsible?: boolean;
24
+ extra?: React.ReactNode;
25
+ forceRender?: boolean;
26
+ lazyMount?: boolean;
27
+ destroyOnHidden?: boolean;
28
+ showArrow?: boolean;
29
+ itemProps?: Omit<CollapseItemProps, "children" | "value" | "disabled">;
30
+ headerProps?: Omit<CollapseHeaderProps, "children">;
31
+ triggerProps?: Omit<CollapseTriggerProps, "children" | "disabled" | "showArrow">;
32
+ contentProps?: Omit<CollapseContentProps, "children" | "forceRender">;
33
+ bodyProps?: StyledDivProps;
34
+ };
35
+ export type CollapseProps = Omit<StyledDivProps, "onChange"> & {
36
+ /**
37
+ * 数据式面板配置。传入后组件会自动渲染 Item / Header / Trigger / Content。
38
+ */
39
+ items?: CollapseItemConfig[];
40
+ /**
41
+ * 当前展开项。`accordion` 模式下通常传单个 key,多开模式可传 key 数组。
42
+ */
43
+ activeKey?: CollapseActiveKey;
44
+ /**
45
+ * 非受控默认展开项。
46
+ */
47
+ defaultActiveKey?: CollapseActiveKey;
48
+ /**
49
+ * 展开项变化回调。`accordion` 模式返回单个 key 或 null,多开模式返回 key 数组。
50
+ */
51
+ onChange?: (activeKey: CollapseActiveKey) => void;
52
+ /**
53
+ * 手风琴模式,同一时间只允许展开一个面板。
54
+ */
55
+ accordion?: boolean;
56
+ /**
57
+ * 是否允许多个面板同时展开。`accordion` 为 true 时该配置会被忽略。
58
+ */
59
+ multiple?: boolean;
60
+ /**
61
+ * 单开模式下,已展开面板是否允许再次点击关闭。
62
+ */
63
+ collapsible?: boolean;
64
+ disabled?: boolean;
65
+ bordered?: boolean;
66
+ size?: CollapseSize;
67
+ variant?: CollapseVariant;
68
+ expandIconPosition?: CollapseExpandIconPosition;
69
+ expandIcon?: (props: CollapseExpandIconRenderProps) => React.ReactNode;
70
+ lazyMount?: boolean;
71
+ destroyOnHidden?: boolean;
72
+ forceRender?: boolean;
73
+ itemProps?: Omit<CollapseItemProps, "children" | "value" | "disabled">;
74
+ headerProps?: Omit<CollapseHeaderProps, "children">;
75
+ triggerProps?: Omit<CollapseTriggerProps, "children" | "disabled" | "showArrow">;
76
+ contentProps?: Omit<CollapseContentProps, "children" | "forceRender">;
77
+ bodyProps?: StyledDivProps;
78
+ };
79
+ export type CollapseItemProps = StyledDivProps & {
80
+ value: CollapseKey;
81
+ disabled?: boolean;
82
+ collapsible?: boolean;
83
+ forceRender?: boolean;
84
+ lazyMount?: boolean;
85
+ destroyOnHidden?: boolean;
86
+ };
87
+ export type CollapseHeaderProps = StyledDivProps & {
88
+ headingLevel?: 2 | 3 | 4 | 5 | 6;
89
+ };
90
+ export type CollapseTriggerProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "className"> & {
91
+ className?: string;
92
+ class?: string;
93
+ sx?: SxProps;
94
+ showArrow?: boolean;
95
+ };
96
+ export type CollapseContentProps = StyledDivProps & {
97
+ forceRender?: boolean;
98
+ };
99
+ export type CollapseActionsProps = StyledDivProps;
100
+ type CollapseComponent = React.ForwardRefExoticComponent<CollapseProps & React.RefAttributes<HTMLDivElement>> & {
101
+ Item: typeof CollapseItem;
102
+ Header: typeof CollapseHeader;
103
+ Trigger: typeof CollapseTrigger;
104
+ Content: typeof CollapseContent;
105
+ Actions: typeof CollapseActions;
106
+ };
107
+ declare const CollapseItem: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<HTMLDivElement>, "className"> & {
108
+ className?: string;
109
+ class?: string;
110
+ sx?: SxProps;
111
+ } & {
112
+ value: CollapseKey;
113
+ disabled?: boolean;
114
+ collapsible?: boolean;
115
+ forceRender?: boolean;
116
+ lazyMount?: boolean;
117
+ destroyOnHidden?: boolean;
118
+ } & React.RefAttributes<HTMLDivElement>>;
119
+ declare const CollapseHeader: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<HTMLDivElement>, "className"> & {
120
+ className?: string;
121
+ class?: string;
122
+ sx?: SxProps;
123
+ } & {
124
+ headingLevel?: 2 | 3 | 4 | 5 | 6;
125
+ } & React.RefAttributes<HTMLDivElement>>;
126
+ declare const CollapseTrigger: React.ForwardRefExoticComponent<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "className"> & {
127
+ className?: string;
128
+ class?: string;
129
+ sx?: SxProps;
130
+ showArrow?: boolean;
131
+ } & React.RefAttributes<HTMLButtonElement>>;
132
+ declare const CollapseContent: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<HTMLDivElement>, "className"> & {
133
+ className?: string;
134
+ class?: string;
135
+ sx?: SxProps;
136
+ } & {
137
+ forceRender?: boolean;
138
+ } & React.RefAttributes<HTMLDivElement>>;
139
+ declare const CollapseActions: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<HTMLDivElement>, "className"> & {
140
+ className?: string;
141
+ class?: string;
142
+ sx?: SxProps;
143
+ } & React.RefAttributes<HTMLDivElement>>;
144
+ export declare const Collapse: CollapseComponent;
145
+ export {};
@@ -0,0 +1 @@
1
+ export * from "./Collapse";
@@ -116,7 +116,7 @@ export type UploaderProviderProps = UploaderProviderConfig & {
116
116
  children?: React.ReactNode;
117
117
  };
118
118
  export declare function UploaderProvider(props: UploaderProviderProps): import("react/jsx-runtime").JSX.Element;
119
- export declare function useUploaderProvider(): Partial<Pick<UploaderProps, "drag" | "multiple" | "disabled" | "data" | "directory" | "action" | "accept" | "headers" | "name" | "onError" | "onSelect" | "preview" | "method" | "maxSize" | "autoUpload" | "beforeRemove" | "beforeUpload" | "customRequest" | "getValueFromResult" | "listType" | "maxCount" | "openFileDialogOnClick" | "pastable" | "request" | "renderActions" | "renderItem" | "renderTrigger" | "showFileList" | "transformFile" | "withCredentials" | "onDownload" | "onExceed" | "onPreview" | "onReject" | "onRemove" | "onSuccess">> | null;
119
+ export declare function useUploaderProvider(): Partial<Pick<UploaderProps, "drag" | "multiple" | "disabled" | "data" | "directory" | "accept" | "action" | "headers" | "name" | "onError" | "onSelect" | "preview" | "method" | "maxSize" | "autoUpload" | "beforeRemove" | "beforeUpload" | "customRequest" | "getValueFromResult" | "listType" | "maxCount" | "openFileDialogOnClick" | "pastable" | "request" | "renderActions" | "renderItem" | "renderTrigger" | "showFileList" | "transformFile" | "withCredentials" | "onDownload" | "onExceed" | "onPreview" | "onReject" | "onRemove" | "onSuccess">> | null;
120
120
  export declare const Uploader: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<HTMLDivElement>, "children" | "onChange"> & {
121
121
  accept?: string;
122
122
  action?: string | ((file: File) => string | Promise<string>);