@ldkj/web-ui 0.11.1 → 0.13.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/components/form/checkbox/CheckboxGroup.d.ts +43 -0
- package/components/form/checkbox/context.d.ts +12 -0
- package/components/form/checkbox/index.d.ts +1 -0
- package/components/form/input/index.d.ts +1 -0
- package/components/form/input/input.d.ts +14 -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/ui/label.d.ts +2 -0
- package/components/ui/radio-group.d.ts +2 -0
- package/index.cjs +7 -7
- package/index.d.ts +3 -0
- package/index.js +3601 -2929
- package/package.json +1 -1
- package/style.css +1 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type SxProps } from "@/styling";
|
|
3
|
+
import { type CheckboxProps } from "./Checkbox";
|
|
4
|
+
type CheckboxGroupGapPreset = "xs" | "sm" | "md" | "lg";
|
|
5
|
+
type CheckboxGroupGap = CheckboxGroupGapPreset | number | string;
|
|
6
|
+
export type CheckboxGroupOption = {
|
|
7
|
+
label: React.ReactNode;
|
|
8
|
+
value: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
description?: React.ReactNode;
|
|
11
|
+
className?: string;
|
|
12
|
+
checkboxProps?: Omit<CheckboxProps, "checked" | "defaultChecked" | "disabled" | "name" | "onCheckedChange" | "value">;
|
|
13
|
+
};
|
|
14
|
+
type CheckboxGroupBaseProps = Omit<React.ComponentPropsWithoutRef<"div">, "defaultValue" | "onChange"> & {
|
|
15
|
+
class?: string;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
direction?: "horizontal" | "vertical";
|
|
18
|
+
gap?: CheckboxGroupGap;
|
|
19
|
+
name?: string;
|
|
20
|
+
options?: CheckboxGroupOption[];
|
|
21
|
+
sx?: SxProps;
|
|
22
|
+
};
|
|
23
|
+
export type CheckboxGroupMultipleProps = CheckboxGroupBaseProps & {
|
|
24
|
+
type?: "multiple";
|
|
25
|
+
value?: string[];
|
|
26
|
+
defaultValue?: string[];
|
|
27
|
+
onChange?: (value: string[]) => void;
|
|
28
|
+
};
|
|
29
|
+
export type CheckboxGroupSingleProps = CheckboxGroupBaseProps & {
|
|
30
|
+
type: "single";
|
|
31
|
+
value?: string;
|
|
32
|
+
defaultValue?: string;
|
|
33
|
+
onChange?: (value: string | undefined) => void;
|
|
34
|
+
};
|
|
35
|
+
export type CheckboxGroupProps = CheckboxGroupMultipleProps | CheckboxGroupSingleProps;
|
|
36
|
+
/**
|
|
37
|
+
* CheckboxGroup 管理一组选项的选择状态,支持多选、单选和原生表单提交。
|
|
38
|
+
*/
|
|
39
|
+
export declare function CheckboxGroup(props: CheckboxGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
export declare namespace CheckboxGroup {
|
|
41
|
+
var displayName: string;
|
|
42
|
+
}
|
|
43
|
+
export {};
|
|
@@ -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 @@
|
|
|
1
|
+
export * from "./input";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type SxProps } from "@/styling";
|
|
3
|
+
export type InputProps = React.ComponentPropsWithoutRef<"input"> & {
|
|
4
|
+
class?: string;
|
|
5
|
+
sx?: SxProps;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Input 是基础文本输入框组件,支持原生 input 属性、`class` 别名与本库 `sx` 样式系统。
|
|
9
|
+
*/
|
|
10
|
+
declare const Input: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & {
|
|
11
|
+
class?: string;
|
|
12
|
+
sx?: SxProps;
|
|
13
|
+
} & React.RefAttributes<HTMLInputElement>>;
|
|
14
|
+
export { Input };
|
|
@@ -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 };
|