@ldkj/web-ui 0.12.0 → 0.14.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 +21 -21
- package/README.md +27 -27
- package/components/data-display/avatar/Avatar.d.ts +42 -0
- package/components/data-display/avatar/index.d.ts +1 -0
- package/components/data-display/skeleton/Skeleton.d.ts +72 -0
- package/components/data-display/skeleton/index.d.ts +2 -0
- package/components/form/checkbox/CheckboxGroup.d.ts +2 -2
- package/components/form/checkbox/context.d.ts +12 -0
- package/components/form/label/Label.d.ts +41 -0
- package/components/form/label/index.d.ts +1 -0
- package/components/form/radio/Radio.d.ts +15 -0
- package/components/form/radio/RadioGroup.d.ts +38 -0
- package/components/form/radio/index.d.ts +2 -0
- package/components/form/select/Select.d.ts +107 -0
- package/components/form/select/index.d.ts +1 -0
- package/components/form/switch/Switch.d.ts +37 -0
- package/components/form/switch/index.d.ts +1 -0
- package/components/interact/button/Button.d.ts +3 -3
- package/components/interact/dialog/Dialog.d.ts +121 -0
- package/components/interact/dialog/index.d.ts +2 -0
- package/components/interact/modal/Modal.d.ts +32 -0
- package/components/interact/modal/index.d.ts +2 -0
- package/components/interact/popover/Popover.d.ts +119 -0
- package/components/interact/popover/index.d.ts +1 -0
- package/components/interact/tooltip/Tooltip.d.ts +93 -0
- package/components/interact/tooltip/index.d.ts +1 -0
- package/index.cjs +47 -7
- package/index.d.ts +10 -0
- package/index.js +9748 -3868
- package/package.json +9 -1
- package/style.css +1 -1
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,27 +1,27 @@
|
|
|
1
|
-
# @ldkj/web-ui
|
|
2
|
-
|
|
3
|
-
由 shadcn-ui, Tailwind CSS 和 VitePress 构建的 React 组件库.
|
|
4
|
-
|
|
5
|
-
## 立即开始
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
pnpm add @ldkj/web-ui
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## 使用示例
|
|
12
|
-
|
|
13
|
-
```tsx
|
|
14
|
-
import "@ldkj/web-ui/style.css";
|
|
15
|
-
import { Button, Chip } from "@ldkj/web-ui";
|
|
16
|
-
|
|
17
|
-
export default function App() {
|
|
18
|
-
return (
|
|
19
|
-
<div className="p-4">
|
|
20
|
-
<Button variant="primary">Hello World</Button>
|
|
21
|
-
<Chip variant="success" size="sm">
|
|
22
|
-
Ready
|
|
23
|
-
</Chip>
|
|
24
|
-
</div>
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
```
|
|
1
|
+
# @ldkj/web-ui
|
|
2
|
+
|
|
3
|
+
由 shadcn-ui, Tailwind CSS 和 VitePress 构建的 React 组件库.
|
|
4
|
+
|
|
5
|
+
## 立即开始
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @ldkj/web-ui
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 使用示例
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import "@ldkj/web-ui/style.css";
|
|
15
|
+
import { Button, Chip } from "@ldkj/web-ui";
|
|
16
|
+
|
|
17
|
+
export default function App() {
|
|
18
|
+
return (
|
|
19
|
+
<div className="p-4">
|
|
20
|
+
<Button variant="primary">Hello World</Button>
|
|
21
|
+
<Chip variant="success" size="sm">
|
|
22
|
+
Ready
|
|
23
|
+
</Chip>
|
|
24
|
+
</div>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
```
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as AvatarPrimitive from "@radix-ui/react-avatar";
|
|
3
|
+
import { type SxProps } from "@/styling";
|
|
4
|
+
import { type Rounded } from "@/components/shared/rounded";
|
|
5
|
+
import { type Shadow } from "@/components/shared/shadow";
|
|
6
|
+
export type AvatarSize = "xs" | "sm" | "md" | "lg" | "xl" | number | string;
|
|
7
|
+
export type AvatarProps = React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root> & {
|
|
8
|
+
class?: string;
|
|
9
|
+
sx?: SxProps;
|
|
10
|
+
size?: AvatarSize;
|
|
11
|
+
rounded?: Rounded;
|
|
12
|
+
shadow?: Shadow;
|
|
13
|
+
};
|
|
14
|
+
export type AvatarImageProps = React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image> & {
|
|
15
|
+
class?: string;
|
|
16
|
+
sx?: SxProps;
|
|
17
|
+
};
|
|
18
|
+
export type AvatarFallbackProps = React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback> & {
|
|
19
|
+
class?: string;
|
|
20
|
+
sx?: SxProps;
|
|
21
|
+
};
|
|
22
|
+
declare const AvatarRoot: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarProps & React.RefAttributes<HTMLSpanElement>, "ref"> & {
|
|
23
|
+
class?: string;
|
|
24
|
+
sx?: SxProps;
|
|
25
|
+
size?: AvatarSize;
|
|
26
|
+
rounded?: Rounded;
|
|
27
|
+
shadow?: Shadow;
|
|
28
|
+
} & React.RefAttributes<HTMLSpanElement>>;
|
|
29
|
+
declare const AvatarImage: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarImageProps & React.RefAttributes<HTMLImageElement>, "ref"> & {
|
|
30
|
+
class?: string;
|
|
31
|
+
sx?: SxProps;
|
|
32
|
+
} & React.RefAttributes<HTMLImageElement>>;
|
|
33
|
+
declare const AvatarFallback: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarFallbackProps & React.RefAttributes<HTMLSpanElement>, "ref"> & {
|
|
34
|
+
class?: string;
|
|
35
|
+
sx?: SxProps;
|
|
36
|
+
} & React.RefAttributes<HTMLSpanElement>>;
|
|
37
|
+
type AvatarComponent = typeof AvatarRoot & {
|
|
38
|
+
Image: typeof AvatarImage;
|
|
39
|
+
Fallback: typeof AvatarFallback;
|
|
40
|
+
};
|
|
41
|
+
export declare const Avatar: AvatarComponent;
|
|
42
|
+
export { AvatarImage, AvatarFallback };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Avatar";
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type Rounded } from "@/components/shared/rounded";
|
|
3
|
+
import { type SxProps } from "@/styling";
|
|
4
|
+
export type SkeletonVariant = "text" | "rect" | "circle";
|
|
5
|
+
export type SkeletonSize = number | string;
|
|
6
|
+
export type SkeletonProps = Omit<React.HTMLAttributes<HTMLDivElement>, "className"> & {
|
|
7
|
+
className?: string;
|
|
8
|
+
class?: string;
|
|
9
|
+
sx?: SxProps;
|
|
10
|
+
rounded?: Rounded;
|
|
11
|
+
width?: SkeletonSize;
|
|
12
|
+
height?: SkeletonSize;
|
|
13
|
+
inline?: boolean;
|
|
14
|
+
animated?: boolean;
|
|
15
|
+
variant?: SkeletonVariant;
|
|
16
|
+
};
|
|
17
|
+
export type SkeletonTextProps = Omit<React.HTMLAttributes<HTMLDivElement>, "className"> & {
|
|
18
|
+
className?: string;
|
|
19
|
+
class?: string;
|
|
20
|
+
sx?: SxProps;
|
|
21
|
+
rounded?: Rounded;
|
|
22
|
+
width?: SkeletonSize;
|
|
23
|
+
inline?: boolean;
|
|
24
|
+
animated?: boolean;
|
|
25
|
+
rows?: number;
|
|
26
|
+
rowHeight?: SkeletonSize;
|
|
27
|
+
gap?: SkeletonSize;
|
|
28
|
+
widths?: SkeletonSize[];
|
|
29
|
+
};
|
|
30
|
+
export type SkeletonAvatarProps = Omit<SkeletonProps, "children" | "variant" | "width" | "height"> & {
|
|
31
|
+
size?: SkeletonSize;
|
|
32
|
+
};
|
|
33
|
+
export type SkeletonButtonProps = Omit<SkeletonProps, "children" | "variant">;
|
|
34
|
+
export type SkeletonCardProps = Omit<SkeletonProps, "children" | "variant" | "height"> & {
|
|
35
|
+
showAvatar?: boolean;
|
|
36
|
+
rows?: number;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Skeleton renders a neutral placeholder block for content that is still loading.
|
|
40
|
+
*/
|
|
41
|
+
export declare function Skeleton(props: SkeletonProps): import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
export declare namespace Skeleton {
|
|
43
|
+
var displayName: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* SkeletonText renders one or more text-like loading rows.
|
|
47
|
+
*/
|
|
48
|
+
export declare function SkeletonText(props: SkeletonTextProps): import("react/jsx-runtime").JSX.Element;
|
|
49
|
+
export declare namespace SkeletonText {
|
|
50
|
+
var displayName: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* SkeletonAvatar renders a circular placeholder for user or object avatars.
|
|
54
|
+
*/
|
|
55
|
+
export declare function SkeletonAvatar(props: SkeletonAvatarProps): import("react/jsx-runtime").JSX.Element;
|
|
56
|
+
export declare namespace SkeletonAvatar {
|
|
57
|
+
var displayName: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* SkeletonButton renders a rounded placeholder sized like a common button.
|
|
61
|
+
*/
|
|
62
|
+
export declare function SkeletonButton(props: SkeletonButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
63
|
+
export declare namespace SkeletonButton {
|
|
64
|
+
var displayName: string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* SkeletonCard renders a compact card loading layout composed from Skeleton parts.
|
|
68
|
+
*/
|
|
69
|
+
export declare function SkeletonCard(props: SkeletonCardProps): import("react/jsx-runtime").JSX.Element;
|
|
70
|
+
export declare namespace SkeletonCard {
|
|
71
|
+
var displayName: string;
|
|
72
|
+
}
|
|
@@ -11,13 +11,13 @@ export type CheckboxGroupOption = {
|
|
|
11
11
|
className?: string;
|
|
12
12
|
checkboxProps?: Omit<CheckboxProps, "checked" | "defaultChecked" | "disabled" | "name" | "onCheckedChange" | "value">;
|
|
13
13
|
};
|
|
14
|
-
type CheckboxGroupBaseProps = Omit<React.ComponentPropsWithoutRef<"div">, "
|
|
14
|
+
type CheckboxGroupBaseProps = Omit<React.ComponentPropsWithoutRef<"div">, "defaultValue" | "onChange"> & {
|
|
15
15
|
class?: string;
|
|
16
16
|
disabled?: boolean;
|
|
17
17
|
direction?: "horizontal" | "vertical";
|
|
18
18
|
gap?: CheckboxGroupGap;
|
|
19
19
|
name?: string;
|
|
20
|
-
options
|
|
20
|
+
options?: CheckboxGroupOption[];
|
|
21
21
|
sx?: SxProps;
|
|
22
22
|
};
|
|
23
23
|
export type CheckboxGroupMultipleProps = CheckboxGroupBaseProps & {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export type CheckboxGroupContextValue = {
|
|
3
|
+
disabled: boolean;
|
|
4
|
+
name?: string;
|
|
5
|
+
selectedValues: ReadonlySet<string>;
|
|
6
|
+
toggleValue: (value: string, checked: boolean) => void;
|
|
7
|
+
};
|
|
8
|
+
export declare function CheckboxGroupProvider(props: {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
value: CheckboxGroupContextValue;
|
|
11
|
+
}): React.FunctionComponentElement<React.ProviderProps<CheckboxGroupContextValue | null>>;
|
|
12
|
+
export declare function useCheckboxGroupContext(): CheckboxGroupContextValue | null;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
3
|
+
import { type SxProps } from "@/styling";
|
|
4
|
+
type LabelAlign = "left" | "center" | "right";
|
|
5
|
+
type LabelPosition = "left" | "top";
|
|
6
|
+
export type LabelProps = Omit<React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>, "className" | "style"> & {
|
|
7
|
+
className?: string;
|
|
8
|
+
class?: string;
|
|
9
|
+
colon?: boolean | React.ReactNode;
|
|
10
|
+
containerClass?: string;
|
|
11
|
+
containerClassName?: string;
|
|
12
|
+
containerStyle?: React.CSSProperties;
|
|
13
|
+
containerSx?: SxProps;
|
|
14
|
+
label?: React.ReactNode;
|
|
15
|
+
labelAlign?: LabelAlign;
|
|
16
|
+
labelWidth?: number | string;
|
|
17
|
+
position?: LabelPosition;
|
|
18
|
+
required?: boolean;
|
|
19
|
+
sx?: SxProps;
|
|
20
|
+
style?: React.CSSProperties;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Label 用于表单字段标注,支持原生 label 语义、必填标记、冒号、宽度对齐和本库 `sx` 样式系统。
|
|
24
|
+
*/
|
|
25
|
+
declare const Label: React.ForwardRefExoticComponent<Omit<Omit<LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref">, "className" | "style"> & {
|
|
26
|
+
className?: string;
|
|
27
|
+
class?: string;
|
|
28
|
+
colon?: boolean | React.ReactNode;
|
|
29
|
+
containerClass?: string;
|
|
30
|
+
containerClassName?: string;
|
|
31
|
+
containerStyle?: React.CSSProperties;
|
|
32
|
+
containerSx?: SxProps;
|
|
33
|
+
label?: React.ReactNode;
|
|
34
|
+
labelAlign?: LabelAlign;
|
|
35
|
+
labelWidth?: number | string;
|
|
36
|
+
position?: LabelPosition;
|
|
37
|
+
required?: boolean;
|
|
38
|
+
sx?: SxProps;
|
|
39
|
+
style?: React.CSSProperties;
|
|
40
|
+
} & React.RefAttributes<HTMLLabelElement>>;
|
|
41
|
+
export { Label };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Label";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
|
|
3
|
+
import { type SxProps } from "@/styling";
|
|
4
|
+
export type RadioProps = React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item> & {
|
|
5
|
+
class?: string;
|
|
6
|
+
sx?: SxProps;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Radio 是基于 Radix RadioGroup Item 的单选按钮,需放在 RadioGroup 中使用。
|
|
10
|
+
*/
|
|
11
|
+
declare const Radio: React.ForwardRefExoticComponent<Omit<RadioGroupPrimitive.RadioGroupItemProps & React.RefAttributes<HTMLButtonElement>, "ref"> & {
|
|
12
|
+
class?: string;
|
|
13
|
+
sx?: SxProps;
|
|
14
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
15
|
+
export { Radio };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
|
|
3
|
+
import { type SxProps } from "@/styling";
|
|
4
|
+
import { type RadioProps } from "./Radio";
|
|
5
|
+
type RadioGroupGapPreset = "xs" | "sm" | "md" | "lg";
|
|
6
|
+
type RadioGroupGap = RadioGroupGapPreset | number | string;
|
|
7
|
+
export type RadioGroupOption = {
|
|
8
|
+
label: React.ReactNode;
|
|
9
|
+
value: string;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
description?: React.ReactNode;
|
|
12
|
+
className?: string;
|
|
13
|
+
radioProps?: Omit<RadioProps, "checked" | "defaultChecked" | "disabled" | "name" | "value">;
|
|
14
|
+
};
|
|
15
|
+
export type RadioGroupProps = Omit<React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>, "children" | "className" | "style"> & {
|
|
16
|
+
children?: React.ReactNode;
|
|
17
|
+
className?: string;
|
|
18
|
+
class?: string;
|
|
19
|
+
direction?: "horizontal" | "vertical";
|
|
20
|
+
gap?: RadioGroupGap;
|
|
21
|
+
options?: RadioGroupOption[];
|
|
22
|
+
sx?: SxProps;
|
|
23
|
+
style?: React.CSSProperties;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* RadioGroup 管理一组互斥选项,支持受控/非受控、原生表单提交和本库 `sx` 样式系统。
|
|
27
|
+
*/
|
|
28
|
+
declare const RadioGroup: React.ForwardRefExoticComponent<Omit<Omit<RadioGroupPrimitive.RadioGroupProps & React.RefAttributes<HTMLDivElement>, "ref">, "className" | "children" | "style"> & {
|
|
29
|
+
children?: React.ReactNode;
|
|
30
|
+
className?: string;
|
|
31
|
+
class?: string;
|
|
32
|
+
direction?: "horizontal" | "vertical";
|
|
33
|
+
gap?: RadioGroupGap;
|
|
34
|
+
options?: RadioGroupOption[];
|
|
35
|
+
sx?: SxProps;
|
|
36
|
+
style?: React.CSSProperties;
|
|
37
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
38
|
+
export { RadioGroup };
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
3
|
+
import { type SxProps } from "@/styling";
|
|
4
|
+
type StyledPrimitiveProps<TProps> = Omit<TProps, "className" | "style"> & {
|
|
5
|
+
className?: string;
|
|
6
|
+
class?: string;
|
|
7
|
+
style?: React.CSSProperties;
|
|
8
|
+
sx?: SxProps;
|
|
9
|
+
};
|
|
10
|
+
export type SelectOption = {
|
|
11
|
+
label: React.ReactNode;
|
|
12
|
+
value: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
textValue?: string;
|
|
15
|
+
className?: string;
|
|
16
|
+
class?: string;
|
|
17
|
+
style?: React.CSSProperties;
|
|
18
|
+
sx?: SxProps;
|
|
19
|
+
};
|
|
20
|
+
export type SelectOptionGroup = {
|
|
21
|
+
label?: React.ReactNode;
|
|
22
|
+
options: SelectOption[];
|
|
23
|
+
separator?: boolean;
|
|
24
|
+
};
|
|
25
|
+
export type SelectItemsProps = {
|
|
26
|
+
options: Array<SelectOption | SelectOptionGroup>;
|
|
27
|
+
itemProps?: Omit<SelectItemProps, "children" | "value" | "disabled" | "textValue">;
|
|
28
|
+
labelProps?: Omit<SelectLabelProps, "children">;
|
|
29
|
+
separatorProps?: SelectSeparatorProps;
|
|
30
|
+
};
|
|
31
|
+
export type SelectTriggerProps = StyledPrimitiveProps<React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>>;
|
|
32
|
+
export type SelectScrollButtonProps = StyledPrimitiveProps<React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>>;
|
|
33
|
+
export type SelectContentProps = StyledPrimitiveProps<React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>>;
|
|
34
|
+
export type SelectLabelProps = StyledPrimitiveProps<React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>>;
|
|
35
|
+
export type SelectItemProps = StyledPrimitiveProps<React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>>;
|
|
36
|
+
export type SelectSeparatorProps = StyledPrimitiveProps<React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>>;
|
|
37
|
+
declare const Select: React.FC<SelectPrimitive.SelectProps>;
|
|
38
|
+
declare const SelectGroup: React.ForwardRefExoticComponent<SelectPrimitive.SelectGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
39
|
+
declare const SelectValue: React.ForwardRefExoticComponent<SelectPrimitive.SelectValueProps & React.RefAttributes<HTMLSpanElement>>;
|
|
40
|
+
/**
|
|
41
|
+
* SelectTrigger 是 Select 的触发按钮,支持原生 Radix Trigger 属性与本库 `sx` 样式系统。
|
|
42
|
+
*/
|
|
43
|
+
declare const SelectTrigger: React.ForwardRefExoticComponent<Omit<Omit<SelectPrimitive.SelectTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref">, "className" | "style"> & {
|
|
44
|
+
className?: string;
|
|
45
|
+
class?: string;
|
|
46
|
+
style?: React.CSSProperties;
|
|
47
|
+
sx?: SxProps;
|
|
48
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
49
|
+
/**
|
|
50
|
+
* SelectScrollUpButton 用于长列表弹层的向上滚动控制。
|
|
51
|
+
*/
|
|
52
|
+
declare const SelectScrollUpButton: React.ForwardRefExoticComponent<Omit<Omit<SelectPrimitive.SelectScrollUpButtonProps & React.RefAttributes<HTMLDivElement>, "ref">, "className" | "style"> & {
|
|
53
|
+
className?: string;
|
|
54
|
+
class?: string;
|
|
55
|
+
style?: React.CSSProperties;
|
|
56
|
+
sx?: SxProps;
|
|
57
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
58
|
+
/**
|
|
59
|
+
* SelectScrollDownButton 用于长列表弹层的向下滚动控制。
|
|
60
|
+
*/
|
|
61
|
+
declare const SelectScrollDownButton: React.ForwardRefExoticComponent<Omit<Omit<SelectPrimitive.SelectScrollUpButtonProps & React.RefAttributes<HTMLDivElement>, "ref">, "className" | "style"> & {
|
|
62
|
+
className?: string;
|
|
63
|
+
class?: string;
|
|
64
|
+
style?: React.CSSProperties;
|
|
65
|
+
sx?: SxProps;
|
|
66
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
67
|
+
/**
|
|
68
|
+
* SelectContent 渲染下拉弹层,默认使用 Radix Portal 与 popper 定位。
|
|
69
|
+
*/
|
|
70
|
+
declare const SelectContent: React.ForwardRefExoticComponent<Omit<Omit<SelectPrimitive.SelectContentProps & React.RefAttributes<HTMLDivElement>, "ref">, "className" | "style"> & {
|
|
71
|
+
className?: string;
|
|
72
|
+
class?: string;
|
|
73
|
+
style?: React.CSSProperties;
|
|
74
|
+
sx?: SxProps;
|
|
75
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
76
|
+
/**
|
|
77
|
+
* SelectLabel 用于在分组选项中显示不可选择的分组标题。
|
|
78
|
+
*/
|
|
79
|
+
declare const SelectLabel: React.ForwardRefExoticComponent<Omit<Omit<SelectPrimitive.SelectLabelProps & React.RefAttributes<HTMLDivElement>, "ref">, "className" | "style"> & {
|
|
80
|
+
className?: string;
|
|
81
|
+
class?: string;
|
|
82
|
+
style?: React.CSSProperties;
|
|
83
|
+
sx?: SxProps;
|
|
84
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
85
|
+
/**
|
|
86
|
+
* SelectItem 是 Select 的可选项,需放在 SelectContent 内使用。
|
|
87
|
+
*/
|
|
88
|
+
declare const SelectItem: React.ForwardRefExoticComponent<Omit<Omit<SelectPrimitive.SelectItemProps & React.RefAttributes<HTMLDivElement>, "ref">, "className" | "style"> & {
|
|
89
|
+
className?: string;
|
|
90
|
+
class?: string;
|
|
91
|
+
style?: React.CSSProperties;
|
|
92
|
+
sx?: SxProps;
|
|
93
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
94
|
+
/**
|
|
95
|
+
* SelectSeparator 用于在 SelectContent 内分隔选项区域。
|
|
96
|
+
*/
|
|
97
|
+
declare const SelectSeparator: React.ForwardRefExoticComponent<Omit<Omit<SelectPrimitive.SelectSeparatorProps & React.RefAttributes<HTMLDivElement>, "ref">, "className" | "style"> & {
|
|
98
|
+
className?: string;
|
|
99
|
+
class?: string;
|
|
100
|
+
style?: React.CSSProperties;
|
|
101
|
+
sx?: SxProps;
|
|
102
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
103
|
+
/**
|
|
104
|
+
* SelectItems 按配置快速渲染 SelectItem,同时保留 Select 的原始组合式能力。
|
|
105
|
+
*/
|
|
106
|
+
declare function SelectItems(props: SelectItemsProps): import("react/jsx-runtime").JSX.Element;
|
|
107
|
+
export { Select, SelectGroup, SelectValue, SelectTrigger, SelectContent, SelectLabel, SelectItem, SelectSeparator, SelectScrollUpButton, SelectScrollDownButton, SelectItems, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Select";
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as SwitchPrimitive from "@radix-ui/react-switch";
|
|
3
|
+
import { type SxProps } from "@/styling";
|
|
4
|
+
export type SwitchSize = "sm" | "md" | "lg";
|
|
5
|
+
export type SwitchLabelPosition = "left" | "right";
|
|
6
|
+
export type SwitchProps = Omit<React.ComponentPropsWithoutRef<typeof SwitchPrimitive.Root>, "className" | "style"> & {
|
|
7
|
+
className?: string;
|
|
8
|
+
class?: string;
|
|
9
|
+
containerClass?: string;
|
|
10
|
+
containerClassName?: string;
|
|
11
|
+
containerStyle?: React.CSSProperties;
|
|
12
|
+
containerSx?: SxProps;
|
|
13
|
+
description?: React.ReactNode;
|
|
14
|
+
label?: React.ReactNode;
|
|
15
|
+
labelPosition?: SwitchLabelPosition;
|
|
16
|
+
size?: SwitchSize;
|
|
17
|
+
sx?: SxProps;
|
|
18
|
+
style?: React.CSSProperties;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* 基于 Radix Switch 的开关组件,支持受控/非受控状态、标签说明与本库 `sx` 样式系统。
|
|
22
|
+
*/
|
|
23
|
+
declare const Switch: React.ForwardRefExoticComponent<Omit<Omit<SwitchPrimitive.SwitchProps & React.RefAttributes<HTMLButtonElement>, "ref">, "className" | "style"> & {
|
|
24
|
+
className?: string;
|
|
25
|
+
class?: string;
|
|
26
|
+
containerClass?: string;
|
|
27
|
+
containerClassName?: string;
|
|
28
|
+
containerStyle?: React.CSSProperties;
|
|
29
|
+
containerSx?: SxProps;
|
|
30
|
+
description?: React.ReactNode;
|
|
31
|
+
label?: React.ReactNode;
|
|
32
|
+
labelPosition?: SwitchLabelPosition;
|
|
33
|
+
size?: SwitchSize;
|
|
34
|
+
sx?: SxProps;
|
|
35
|
+
style?: React.CSSProperties;
|
|
36
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
37
|
+
export { Switch };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Switch";
|
|
@@ -13,8 +13,8 @@ type ButtonOwnProps = Omit<ButtonVariants, "rounded" | "shadow"> & {
|
|
|
13
13
|
sx?: SxProps;
|
|
14
14
|
};
|
|
15
15
|
export type ButtonProps<T extends ElementType = "button"> = PolymorphicProps<T> & ButtonOwnProps;
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
declare function Button<T extends ElementType = "button">(props: ButtonProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
declare namespace Button {
|
|
18
18
|
var displayName: string;
|
|
19
19
|
}
|
|
20
|
-
export {};
|
|
20
|
+
export { Button };
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type SxProps } from "@/styling";
|
|
3
|
+
type StyledDomProps<T extends React.ElementType> = Omit<React.ComponentPropsWithoutRef<T>, "className" | "style"> & {
|
|
4
|
+
className?: string;
|
|
5
|
+
class?: string;
|
|
6
|
+
style?: React.CSSProperties;
|
|
7
|
+
sx?: SxProps;
|
|
8
|
+
};
|
|
9
|
+
type AsChildProps = {
|
|
10
|
+
asChild?: boolean;
|
|
11
|
+
asChildWrapper?: React.ElementType;
|
|
12
|
+
};
|
|
13
|
+
export type DialogProps = {
|
|
14
|
+
open?: boolean;
|
|
15
|
+
defaultOpen?: boolean;
|
|
16
|
+
onOpenChange?: (open: boolean) => void;
|
|
17
|
+
modal?: boolean;
|
|
18
|
+
lockScroll?: boolean;
|
|
19
|
+
destroyOnClose?: boolean;
|
|
20
|
+
closeOnMaskClick?: boolean;
|
|
21
|
+
scrollable?: boolean;
|
|
22
|
+
children?: React.ReactNode;
|
|
23
|
+
};
|
|
24
|
+
export type DialogTriggerProps = StyledDomProps<"button"> & AsChildProps;
|
|
25
|
+
export type DialogCloseProps = StyledDomProps<"button"> & AsChildProps;
|
|
26
|
+
export type DialogOverlayProps = StyledDomProps<"div"> & {
|
|
27
|
+
blur?: boolean;
|
|
28
|
+
};
|
|
29
|
+
export type DialogContentProps = StyledDomProps<"div"> & {
|
|
30
|
+
showClose?: boolean;
|
|
31
|
+
overlayClassName?: string;
|
|
32
|
+
overlaySx?: SxProps;
|
|
33
|
+
overlayBlur?: boolean;
|
|
34
|
+
onEscapeKeyDown?: (event: KeyboardEvent) => void;
|
|
35
|
+
onPointerDownOutside?: (event: PointerEvent) => void;
|
|
36
|
+
onOpenAutoFocus?: (event: Event) => void;
|
|
37
|
+
onCloseAutoFocus?: (event: Event) => void;
|
|
38
|
+
};
|
|
39
|
+
export type DialogHeaderProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
40
|
+
class?: string;
|
|
41
|
+
sx?: SxProps;
|
|
42
|
+
};
|
|
43
|
+
export type DialogFooterProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
44
|
+
class?: string;
|
|
45
|
+
sx?: SxProps;
|
|
46
|
+
};
|
|
47
|
+
export type DialogTitleProps = StyledDomProps<"h2">;
|
|
48
|
+
export type DialogDescriptionProps = StyledDomProps<"p">;
|
|
49
|
+
declare const DialogTrigger: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "className" | "style"> & {
|
|
50
|
+
className?: string;
|
|
51
|
+
class?: string;
|
|
52
|
+
style?: React.CSSProperties;
|
|
53
|
+
sx?: SxProps;
|
|
54
|
+
} & AsChildProps & React.RefAttributes<HTMLButtonElement>>;
|
|
55
|
+
declare const DialogClose: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "className" | "style"> & {
|
|
56
|
+
className?: string;
|
|
57
|
+
class?: string;
|
|
58
|
+
style?: React.CSSProperties;
|
|
59
|
+
sx?: SxProps;
|
|
60
|
+
} & AsChildProps & React.RefAttributes<HTMLButtonElement>>;
|
|
61
|
+
type DialogPortalProps = {
|
|
62
|
+
children?: React.ReactNode;
|
|
63
|
+
container?: Element | DocumentFragment | null;
|
|
64
|
+
};
|
|
65
|
+
declare const DialogPortal: (props: DialogPortalProps) => React.ReactPortal | null;
|
|
66
|
+
declare const DialogOverlay: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "className" | "style"> & {
|
|
67
|
+
className?: string;
|
|
68
|
+
class?: string;
|
|
69
|
+
style?: React.CSSProperties;
|
|
70
|
+
sx?: SxProps;
|
|
71
|
+
} & {
|
|
72
|
+
blur?: boolean;
|
|
73
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
74
|
+
declare const DialogContent: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "className" | "style"> & {
|
|
75
|
+
className?: string;
|
|
76
|
+
class?: string;
|
|
77
|
+
style?: React.CSSProperties;
|
|
78
|
+
sx?: SxProps;
|
|
79
|
+
} & {
|
|
80
|
+
showClose?: boolean;
|
|
81
|
+
overlayClassName?: string;
|
|
82
|
+
overlaySx?: SxProps;
|
|
83
|
+
overlayBlur?: boolean;
|
|
84
|
+
onEscapeKeyDown?: (event: KeyboardEvent) => void;
|
|
85
|
+
onPointerDownOutside?: (event: PointerEvent) => void;
|
|
86
|
+
onOpenAutoFocus?: (event: Event) => void;
|
|
87
|
+
onCloseAutoFocus?: (event: Event) => void;
|
|
88
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
89
|
+
declare const DialogHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
|
|
90
|
+
class?: string;
|
|
91
|
+
sx?: SxProps;
|
|
92
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
93
|
+
declare const DialogFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
|
|
94
|
+
class?: string;
|
|
95
|
+
sx?: SxProps;
|
|
96
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
97
|
+
declare const DialogTitle: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "ref">, "className" | "style"> & {
|
|
98
|
+
className?: string;
|
|
99
|
+
class?: string;
|
|
100
|
+
style?: React.CSSProperties;
|
|
101
|
+
sx?: SxProps;
|
|
102
|
+
} & React.RefAttributes<HTMLHeadingElement>>;
|
|
103
|
+
declare const DialogDescription: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "ref">, "className" | "style"> & {
|
|
104
|
+
className?: string;
|
|
105
|
+
class?: string;
|
|
106
|
+
style?: React.CSSProperties;
|
|
107
|
+
sx?: SxProps;
|
|
108
|
+
} & React.RefAttributes<HTMLParagraphElement>>;
|
|
109
|
+
type DialogCompound = ((props: DialogProps) => React.ReactElement) & {
|
|
110
|
+
Trigger: typeof DialogTrigger;
|
|
111
|
+
Portal: typeof DialogPortal;
|
|
112
|
+
Close: typeof DialogClose;
|
|
113
|
+
Overlay: typeof DialogOverlay;
|
|
114
|
+
Content: typeof DialogContent;
|
|
115
|
+
Header: typeof DialogHeader;
|
|
116
|
+
Footer: typeof DialogFooter;
|
|
117
|
+
Title: typeof DialogTitle;
|
|
118
|
+
Description: typeof DialogDescription;
|
|
119
|
+
};
|
|
120
|
+
declare const Dialog: DialogCompound;
|
|
121
|
+
export { Dialog, DialogPortal, DialogOverlay, DialogClose, DialogTrigger, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription, };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { Dialog, DialogPortal, DialogOverlay, DialogClose, DialogTrigger, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription, } from "./Dialog";
|
|
2
|
+
export type { DialogProps, DialogTriggerProps, DialogCloseProps, DialogOverlayProps, DialogContentProps, DialogHeaderProps, DialogFooterProps, DialogTitleProps, DialogDescriptionProps, } from "./Dialog";
|