@ldkj/web-ui 0.17.0 → 0.19.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.
@@ -5,5 +5,19 @@ export type AlertProps = React.HTMLAttributes<HTMLDivElement> & {
5
5
  variant?: AlertVariant;
6
6
  title?: React.ReactNode;
7
7
  description?: React.ReactNode;
8
+ /** Custom leading icon. Pass showIcon to use the built-in tone marker. */
9
+ icon?: React.ReactNode;
10
+ /** Whether to render the leading icon area. */
11
+ showIcon?: boolean;
12
+ /** Optional trailing action, such as a retry button or detail link. */
13
+ action?: React.ReactNode;
14
+ /** Render a close button. */
15
+ closable?: boolean;
16
+ /** Controlled visibility. */
17
+ open?: boolean;
18
+ /** Fired after the close button is clicked. */
19
+ onClose?: () => void;
20
+ /** Controlled visibility callback. */
21
+ onOpenChange?: (open: boolean) => void;
8
22
  };
9
- export declare function Alert(props: AlertProps): import("react/jsx-runtime").JSX.Element;
23
+ export declare function Alert(props: AlertProps): import("react/jsx-runtime").JSX.Element | null;
@@ -1,11 +1,29 @@
1
1
  import * as React from "react";
2
- export type DrawerProps = {
2
+ export type DrawerPlacement = "left" | "right" | "top" | "bottom";
3
+ export type DrawerProps = React.HTMLAttributes<HTMLDivElement> & {
3
4
  open: boolean;
4
5
  title?: React.ReactNode;
5
6
  width?: number | string;
7
+ height?: number | string;
8
+ placement?: DrawerPlacement;
6
9
  className?: string;
7
10
  class?: string;
11
+ overlayClassName?: string;
12
+ bodyClassName?: string;
13
+ footer?: React.ReactNode;
8
14
  children?: React.ReactNode;
9
15
  onOpenChange?: (open: boolean) => void;
16
+ /** Enables slide/fade transitions. Set false when a test or host app needs instant state changes. */
17
+ animated?: boolean;
18
+ /** Transition duration in ms. */
19
+ animationDuration?: number;
20
+ /** Locks document scrolling while the drawer is open. */
21
+ lockScroll?: boolean;
22
+ /** Close when clicking the mask. */
23
+ maskClosable?: boolean;
24
+ /** Close when pressing Escape. */
25
+ closeOnEsc?: boolean;
26
+ /** Keep content mounted after close. */
27
+ destroyOnClose?: boolean;
10
28
  };
11
29
  export declare function Drawer(props: DrawerProps): import("react/jsx-runtime").JSX.Element | null;
@@ -1,3 +1,19 @@
1
- export declare function Loading({ text }: {
2
- text?: string;
3
- }): import("react/jsx-runtime").JSX.Element;
1
+ import * as React from "react";
2
+ import { type SpinProps } from "@/components/interact/spin";
3
+ export type LoadingVariant = "inline" | "block" | "overlay" | "fullscreen";
4
+ export type LoadingProps = React.HTMLAttributes<HTMLDivElement> & {
5
+ /** Loading text. Set to null to hide text while keeping the spinner. */
6
+ text?: React.ReactNode;
7
+ /** Layout mode for inline hints, blocks, overlays, or full-screen masks. */
8
+ variant?: LoadingVariant;
9
+ /** Spinner size. Numbers are treated as px. */
10
+ size?: SpinProps["size"];
11
+ /** Spinner tone. */
12
+ tone?: SpinProps["tone"];
13
+ /** Set to false to hide loading state without unmounting wrapped children. */
14
+ spinning?: boolean;
15
+ /** Delay in ms before showing the loading indicator. */
16
+ delay?: number;
17
+ class?: string;
18
+ };
19
+ export declare function Loading(props: LoadingProps): import("react/jsx-runtime").JSX.Element | null;
@@ -1,6 +1,21 @@
1
+ import type { NotificationOffset, NotificationOptions, NotificationPlacement } from "./types";
2
+ export interface NotificationFacadeConfig {
3
+ placement?: NotificationPlacement;
4
+ duration?: number;
5
+ closable?: boolean;
6
+ offset?: NotificationOffset;
7
+ }
8
+ /**
9
+ * 全局 notification facade。请先挂载 NotificationProvider,再在任意业务模块调用。
10
+ */
1
11
  export declare const notification: {
2
- info(message: string): string;
3
- success(message: string): string;
4
- warn(message: string): string;
5
- error(message: string): string;
12
+ open(options: NotificationOptions): string;
13
+ info(options: NotificationOptions | string): string;
14
+ success(options: NotificationOptions | string): string;
15
+ warn(options: NotificationOptions | string): string;
16
+ error(options: NotificationOptions | string): string;
17
+ dismiss(id: string): void;
18
+ clear(): void;
19
+ config(config: NotificationFacadeConfig): void;
20
+ resetConfig(): void;
6
21
  };
@@ -0,0 +1,27 @@
1
+ import * as React from "react";
2
+ import type { NotificationOffset, NotificationOptions, NotificationPlacement } from "./types";
3
+ import "./notification.css";
4
+ export interface NotificationProviderProps {
5
+ children?: React.ReactNode;
6
+ placement?: NotificationPlacement;
7
+ duration?: number;
8
+ queueLimit?: number;
9
+ offset?: NotificationOffset;
10
+ closable?: boolean;
11
+ }
12
+ export declare function NotificationProvider(props: NotificationProviderProps): import("react/jsx-runtime").JSX.Element;
13
+ export declare namespace NotificationProvider {
14
+ var displayName: string;
15
+ }
16
+ /**
17
+ * 获取当前 NotificationProvider 提供的通知 API。
18
+ */
19
+ export declare function useNotification(): {
20
+ open: (options: NotificationOptions) => string;
21
+ info: (options: NotificationOptions | string) => string;
22
+ success: (options: NotificationOptions | string) => string;
23
+ warn: (options: NotificationOptions | string) => string;
24
+ error: (options: NotificationOptions | string) => string;
25
+ dismiss: (id: string) => void;
26
+ clear: () => void;
27
+ };
@@ -0,0 +1,3 @@
1
+ import type { NotificationContextValue } from "./types";
2
+ export declare function setNotificationBridge(next: NotificationContextValue | null): void;
3
+ export declare function getNotificationBridge(): NotificationContextValue | null;
@@ -1 +1,3 @@
1
- export * from './Notification';
1
+ export * from "./Notification";
2
+ export * from "./NotificationProvider";
3
+ export * from "./types";
@@ -0,0 +1,39 @@
1
+ import type * as React from "react";
2
+ export type NotificationType = "info" | "success" | "warn" | "error";
3
+ export type NotificationPlacement = "rightTop" | "rightBottom" | "leftTop" | "leftBottom" | "center";
4
+ export type NotificationOffset = number | {
5
+ top?: number;
6
+ right?: number;
7
+ bottom?: number;
8
+ left?: number;
9
+ };
10
+ export type NotificationCustomSvg = React.ComponentType<React.SVGProps<SVGSVGElement> & {
11
+ title?: string;
12
+ }>;
13
+ export type NotificationIconOption = string | {
14
+ svg?: NotificationCustomSvg;
15
+ src?: string;
16
+ };
17
+ export interface NotificationOptions {
18
+ id?: string;
19
+ message: React.ReactNode;
20
+ description?: React.ReactNode;
21
+ content?: React.ReactNode;
22
+ actions?: React.ReactNode;
23
+ duration?: number;
24
+ placement?: NotificationPlacement;
25
+ offset?: NotificationOffset;
26
+ closable?: boolean;
27
+ icon?: NotificationIconOption;
28
+ iconColor?: string;
29
+ onClose?: () => void;
30
+ }
31
+ export interface NotificationCreateInput extends NotificationOptions {
32
+ type?: NotificationType;
33
+ }
34
+ export type NotificationShortcutInput = string | NotificationOptions;
35
+ export interface NotificationContextValue {
36
+ push: (input: NotificationCreateInput) => string;
37
+ dismiss: (id: string) => void;
38
+ clear: () => void;
39
+ }
@@ -1,8 +1,17 @@
1
1
  import * as React from "react";
2
+ export type ProgressType = "line" | "circle";
3
+ export type ProgressStatus = "normal" | "success" | "warning" | "exception";
2
4
  export type ProgressProps = React.HTMLAttributes<HTMLDivElement> & {
3
5
  value?: number;
4
6
  max?: number;
5
7
  showInfo?: boolean;
8
+ type?: ProgressType;
9
+ status?: ProgressStatus;
10
+ size?: number;
11
+ strokeWidth?: number;
12
+ strokeColor?: string;
13
+ trailColor?: string;
14
+ format?: (percent: number, value: number, max: number) => React.ReactNode;
6
15
  class?: string;
7
16
  };
8
17
  export declare function Progress(props: ProgressProps): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,16 @@
1
1
  import * as React from "react";
2
+ export type SpinTone = "primary" | "muted" | "success" | "warning" | "danger";
2
3
  export type SpinProps = React.HTMLAttributes<HTMLSpanElement> & {
3
- size?: number;
4
+ /** Spinner size. Numbers are treated as px. */
5
+ size?: number | string;
6
+ /** Ring stroke width. Numbers are treated as px. */
7
+ strokeWidth?: number | string;
8
+ /** Color tone for the active ring segment. */
9
+ tone?: SpinTone;
10
+ /** Accessible label announced by screen readers. */
11
+ label?: string;
12
+ /** Set to false to suppress the spinner without branching in user code. */
13
+ spinning?: boolean;
4
14
  class?: string;
5
15
  };
6
- export declare function Spin(props: SpinProps): import("react/jsx-runtime").JSX.Element;
16
+ export declare function Spin(props: SpinProps): import("react/jsx-runtime").JSX.Element | null;