@ldkj/web-ui 0.3.0 → 0.4.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/data-display/card/Card.d.ts +41 -0
- package/components/data-display/card/index.d.ts +1 -0
- package/components/{ui → data-display}/chip/Chip.d.ts +3 -2
- package/components/{ui → data-display}/chip/variants.d.ts +5 -1
- package/components/{ui → interact}/button/Button.d.ts +3 -2
- package/components/{ui → interact}/button/variants.d.ts +5 -1
- package/components/layout/box/Box.d.ts +29 -0
- package/components/layout/box/index.d.ts +1 -0
- package/components/layout/flex/Flex.d.ts +2 -3
- package/components/layout/grid/Grid.d.ts +2 -3
- package/components/layout/safe-area/SafeArea.d.ts +5 -11
- package/components/shared/shadow.d.ts +16 -0
- package/index.cjs +6 -6
- package/index.d.ts +5 -3
- package/index.js +2066 -1752
- package/package.json +1 -1
- package/style.css +1 -1
- /package/components/{ui → data-display}/chip/index.d.ts +0 -0
- /package/components/{ui → data-display}/qrcodes/QRCode.d.ts +0 -0
- /package/components/{ui → data-display}/qrcodes/QRCodeBase.d.ts +0 -0
- /package/components/{ui → data-display}/qrcodes/QRCodeCanvas.d.ts +0 -0
- /package/components/{ui → data-display}/qrcodes/QRCodeSizable.d.ts +0 -0
- /package/components/{ui → data-display}/qrcodes/index.d.ts +0 -0
- /package/components/{ui → interact}/button/index.d.ts +0 -0
- /package/components/{ui/shared → shared}/rounded.d.ts +0 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type BoxProps } from "@/components/layout/box";
|
|
3
|
+
export type CardVariant = "outlined" | "elevated" | "filled" | "ghost";
|
|
4
|
+
export type CardPadding = "none" | "sm" | "md" | "lg";
|
|
5
|
+
export type CardDivided = boolean | "x" | "y";
|
|
6
|
+
export type CardSlotProps = BoxProps<React.ElementType>;
|
|
7
|
+
type CardSlotComponent = React.FC<CardSlotProps>;
|
|
8
|
+
export type CardProps = BoxProps<React.ElementType> & {
|
|
9
|
+
variant?: CardVariant;
|
|
10
|
+
padding?: CardPadding;
|
|
11
|
+
divided?: CardDivided;
|
|
12
|
+
hoverable?: boolean;
|
|
13
|
+
selected?: boolean;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
header?: React.ReactNode;
|
|
16
|
+
footer?: React.ReactNode;
|
|
17
|
+
left?: React.ReactNode;
|
|
18
|
+
right?: React.ReactNode;
|
|
19
|
+
start?: React.ReactNode;
|
|
20
|
+
end?: React.ReactNode;
|
|
21
|
+
contentLoading?: boolean;
|
|
22
|
+
headerProps?: CardSlotProps;
|
|
23
|
+
footerProps?: CardSlotProps;
|
|
24
|
+
leftProps?: CardSlotProps;
|
|
25
|
+
rightProps?: CardSlotProps;
|
|
26
|
+
startProps?: CardSlotProps;
|
|
27
|
+
endProps?: CardSlotProps;
|
|
28
|
+
contentProps?: CardSlotProps;
|
|
29
|
+
};
|
|
30
|
+
type CardCompound = {
|
|
31
|
+
Header: CardSlotComponent;
|
|
32
|
+
Content: CardSlotComponent;
|
|
33
|
+
Footer: CardSlotComponent;
|
|
34
|
+
Left: CardSlotComponent;
|
|
35
|
+
Right: CardSlotComponent;
|
|
36
|
+
Start: CardSlotComponent;
|
|
37
|
+
End: CardSlotComponent;
|
|
38
|
+
};
|
|
39
|
+
type CardComponent = React.FC<CardProps> & CardCompound;
|
|
40
|
+
export declare const Card: CardComponent;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Card";
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { ElementType } from "react";
|
|
3
|
-
import { type ChipRounded, type ChipVariants } from "./variants";
|
|
3
|
+
import { type ChipRounded, type ChipShadow, type ChipVariants } from "./variants";
|
|
4
4
|
import { type SxProps } from "@/styling";
|
|
5
5
|
type PolymorphicProps<T extends ElementType> = {
|
|
6
6
|
component?: T;
|
|
7
7
|
className?: string;
|
|
8
8
|
class?: string;
|
|
9
9
|
} & Omit<React.ComponentPropsWithoutRef<T>, "as" | "className">;
|
|
10
|
-
type ChipOwnProps = Omit<ChipVariants, "rounded"> & {
|
|
10
|
+
type ChipOwnProps = Omit<ChipVariants, "rounded" | "shadow"> & {
|
|
11
11
|
rounded?: ChipRounded;
|
|
12
|
+
shadow?: ChipShadow;
|
|
12
13
|
sx?: SxProps;
|
|
13
14
|
};
|
|
14
15
|
export type ChipProps<T extends ElementType = "span"> = PolymorphicProps<T> & ChipOwnProps;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { type VariantProps } from "class-variance-authority";
|
|
2
|
-
import { type Rounded, type RoundedPreset } from "
|
|
2
|
+
import { type Rounded, type RoundedPreset } from "../../shared/rounded";
|
|
3
|
+
import { type Shadow, type ShadowPreset } from "../../shared/shadow";
|
|
3
4
|
export declare const chipVariants: (props?: ({
|
|
4
5
|
variant?: "dark" | "primary" | "minor" | "success" | "warning" | "danger" | "text" | "light" | null | undefined;
|
|
5
6
|
outline?: boolean | null | undefined;
|
|
6
7
|
size?: "xs" | "sm" | "md" | "lg" | "xl" | null | undefined;
|
|
7
8
|
rounded?: "xs" | "sm" | "md" | "lg" | "xl" | "full" | null | undefined;
|
|
9
|
+
shadow?: "xs" | "sm" | "md" | "lg" | "xl" | "none" | "inner" | null | undefined;
|
|
8
10
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
9
11
|
export type ChipVariants = VariantProps<typeof chipVariants>;
|
|
10
12
|
export type ChipRoundedPreset = RoundedPreset;
|
|
11
13
|
export type ChipRounded = Rounded;
|
|
14
|
+
export type ChipShadowPreset = ShadowPreset;
|
|
15
|
+
export type ChipShadow = Shadow;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { ElementType } from "react";
|
|
3
|
-
import { type ButtonRounded, type ButtonVariants } from "./variants";
|
|
3
|
+
import { type ButtonRounded, type ButtonShadow, type ButtonVariants } from "./variants";
|
|
4
4
|
import { type SxProps } from "@/styling";
|
|
5
5
|
type PolymorphicProps<T extends ElementType> = {
|
|
6
6
|
component?: T;
|
|
7
7
|
className?: string;
|
|
8
8
|
class?: string;
|
|
9
9
|
} & Omit<React.ComponentPropsWithoutRef<T>, "as" | "className">;
|
|
10
|
-
type ButtonOwnProps = Omit<ButtonVariants, "rounded"> & {
|
|
10
|
+
type ButtonOwnProps = Omit<ButtonVariants, "rounded" | "shadow"> & {
|
|
11
11
|
rounded?: ButtonRounded;
|
|
12
|
+
shadow?: ButtonShadow;
|
|
12
13
|
sx?: SxProps;
|
|
13
14
|
};
|
|
14
15
|
export type ButtonProps<T extends ElementType = "button"> = PolymorphicProps<T> & ButtonOwnProps;
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { type VariantProps } from "class-variance-authority";
|
|
2
|
-
import { type Rounded, type RoundedPreset } from "
|
|
2
|
+
import { type Rounded, type RoundedPreset } from "../../shared/rounded";
|
|
3
|
+
import { type Shadow, type ShadowPreset } from "../../shared/shadow";
|
|
3
4
|
export declare const buttonVariants: (props?: ({
|
|
4
5
|
variant?: "dark" | "primary" | "secondary" | "minor" | "success" | "warning" | "danger" | "outline" | "ghost" | "link" | "text" | null | undefined;
|
|
5
6
|
size?: "xs" | "sm" | "md" | "lg" | "xl" | "icon" | null | undefined;
|
|
6
7
|
rounded?: "xs" | "sm" | "md" | "lg" | "xl" | "full" | null | undefined;
|
|
8
|
+
shadow?: "xs" | "sm" | "md" | "lg" | "xl" | "none" | "inner" | null | undefined;
|
|
7
9
|
bounce?: boolean | null | undefined;
|
|
8
10
|
splash?: boolean | null | undefined;
|
|
9
11
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
10
12
|
export type ButtonVariants = VariantProps<typeof buttonVariants>;
|
|
11
13
|
export type ButtonRoundedPreset = RoundedPreset;
|
|
12
14
|
export type ButtonRounded = Rounded;
|
|
15
|
+
export type ButtonShadowPreset = ShadowPreset;
|
|
16
|
+
export type ButtonShadow = Shadow;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { ElementType } from "react";
|
|
3
|
+
import { type Rounded } from "@/components/shared/rounded";
|
|
4
|
+
import { type Shadow } from "@/components/shared/shadow";
|
|
5
|
+
import { type SxProps } from "@/styling";
|
|
6
|
+
type PolymorphicProps<T extends ElementType> = {
|
|
7
|
+
component?: T;
|
|
8
|
+
className?: string;
|
|
9
|
+
class?: string;
|
|
10
|
+
} & Omit<React.ComponentPropsWithoutRef<T>, "as" | "className">;
|
|
11
|
+
type BoxOwnProps = {
|
|
12
|
+
sx?: SxProps;
|
|
13
|
+
rounded?: Rounded;
|
|
14
|
+
shadow?: Shadow;
|
|
15
|
+
loading?: boolean;
|
|
16
|
+
loadingContent?: React.ReactNode;
|
|
17
|
+
modal?: boolean;
|
|
18
|
+
modalContent?: React.ReactNode;
|
|
19
|
+
onModalMaskClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Box 是通用基础容器组件,支持多态渲染、sx 样式入口,以及元素范围内的 loading/modal 遮罩层。
|
|
23
|
+
*/
|
|
24
|
+
export type BoxProps<T extends ElementType = "div"> = PolymorphicProps<T> & BoxOwnProps;
|
|
25
|
+
export declare function Box<T extends ElementType = "div">(props: BoxProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
export declare namespace Box {
|
|
27
|
+
var displayName: string;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Box";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { type
|
|
2
|
+
import { type BoxProps } from "../box";
|
|
3
3
|
export type FlexDirection = "row" | "row-reverse" | "col" | "col-reverse";
|
|
4
4
|
export type FlexWrap = boolean | React.CSSProperties["flexWrap"];
|
|
5
5
|
export type FlexGapPreset = "xs" | "sm" | "md" | "lg" | "xl";
|
|
@@ -8,7 +8,7 @@ export type FlexSize = number | string;
|
|
|
8
8
|
/**
|
|
9
9
|
* Flex 容器属性。
|
|
10
10
|
*/
|
|
11
|
-
export type FlexProps = React.
|
|
11
|
+
export type FlexProps = BoxProps<React.ElementType> & {
|
|
12
12
|
direction?: FlexDirection;
|
|
13
13
|
justify?: React.CSSProperties["justifyContent"];
|
|
14
14
|
items?: React.CSSProperties["alignItems"];
|
|
@@ -17,7 +17,6 @@ export type FlexProps = React.ComponentPropsWithoutRef<"div"> & {
|
|
|
17
17
|
gap?: FlexGap;
|
|
18
18
|
width?: FlexSize;
|
|
19
19
|
height?: FlexSize;
|
|
20
|
-
sx?: SxProps;
|
|
21
20
|
};
|
|
22
21
|
/**
|
|
23
22
|
* Flex 是基于 CSS Flexbox 的对齐布局容器。
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { type
|
|
2
|
+
import { type BoxProps } from "../box";
|
|
3
3
|
export type GridSize = number | "grow";
|
|
4
4
|
export type GridOffset = number | "auto";
|
|
5
5
|
export type GridSpacing = number | string;
|
|
6
6
|
export type GridDirection = "row" | "row-reverse";
|
|
7
7
|
export type GridWrap = boolean | React.CSSProperties["flexWrap"];
|
|
8
|
-
export type GridProps = React.
|
|
8
|
+
export type GridProps = BoxProps<React.ElementType> & {
|
|
9
9
|
container?: boolean;
|
|
10
10
|
size?: GridSize;
|
|
11
11
|
offset?: GridOffset;
|
|
@@ -15,7 +15,6 @@ export type GridProps = React.ComponentPropsWithoutRef<"div"> & {
|
|
|
15
15
|
columnSpacing?: GridSpacing;
|
|
16
16
|
wrap?: GridWrap;
|
|
17
17
|
direction?: GridDirection;
|
|
18
|
-
sx?: SxProps;
|
|
19
18
|
};
|
|
20
19
|
/**
|
|
21
20
|
* Grid 是基于 Flexbox 的 12 列布局容器。
|
|
@@ -1,26 +1,20 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
1
|
import type { ElementType } from "react";
|
|
3
|
-
import { type
|
|
2
|
+
import { type BoxProps } from "../box";
|
|
4
3
|
export type SafeAreaPosition = "top" | "bottom" | "both" | "none";
|
|
5
|
-
type PolymorphicProps<T extends ElementType> = {
|
|
6
|
-
component?: T;
|
|
7
|
-
className?: string;
|
|
8
|
-
} & Omit<React.ComponentPropsWithoutRef<T>, "as" | "className">;
|
|
9
4
|
type SafeAreaOwnProps = {
|
|
10
5
|
position?: SafeAreaPosition;
|
|
11
6
|
horizontal?: boolean;
|
|
12
|
-
sx?: SxProps;
|
|
13
7
|
};
|
|
14
|
-
export type SafeAreaProps
|
|
8
|
+
export type SafeAreaProps = BoxProps<ElementType> & SafeAreaOwnProps;
|
|
15
9
|
/**
|
|
16
10
|
* SafeArea 用于适配移动端刘海屏,灵动岛和手势区域等的安全区容器。
|
|
17
11
|
*/
|
|
18
|
-
export declare function SafeArea
|
|
12
|
+
export declare function SafeArea(props: SafeAreaProps): import("react/jsx-runtime").JSX.Element;
|
|
19
13
|
export declare namespace SafeArea {
|
|
20
14
|
var displayName: string;
|
|
21
15
|
}
|
|
22
|
-
export type SafeAreaTopProps = Omit<SafeAreaProps
|
|
23
|
-
export type SafeAreaBottomProps = Omit<SafeAreaProps
|
|
16
|
+
export type SafeAreaTopProps = Omit<SafeAreaProps, "position">;
|
|
17
|
+
export type SafeAreaBottomProps = Omit<SafeAreaProps, "position">;
|
|
24
18
|
/**
|
|
25
19
|
* SafeAreaTop 仅应用顶部安全区内边距。
|
|
26
20
|
*/
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CSSProperties } from "react";
|
|
2
|
+
export declare const shadowPresetClasses: {
|
|
3
|
+
readonly none: "shadow-none";
|
|
4
|
+
readonly xs: "shadow-[0_1px_2px_rgba(15,23,42,0.08)]";
|
|
5
|
+
readonly sm: "shadow-sm";
|
|
6
|
+
readonly md: "shadow-md";
|
|
7
|
+
readonly lg: "shadow-lg";
|
|
8
|
+
readonly xl: "shadow-xl";
|
|
9
|
+
readonly inner: "shadow-inner";
|
|
10
|
+
};
|
|
11
|
+
export type ShadowPreset = keyof typeof shadowPresetClasses;
|
|
12
|
+
export type Shadow = ShadowPreset | string;
|
|
13
|
+
export declare function resolveShadow(shadow?: Shadow): {
|
|
14
|
+
shadowPreset?: ShadowPreset;
|
|
15
|
+
shadowStyle?: CSSProperties;
|
|
16
|
+
};
|