@ldkj/web-ui 0.12.0 → 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 +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/ui/label.d.ts +2 -0
- package/components/ui/radio-group.d.ts +2 -0
- package/index.cjs +7 -7
- package/index.d.ts +2 -0
- package/index.js +3411 -2878
- package/package.json +1 -1
- package/style.css +1 -1
|
@@ -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 };
|