@ldkj/web-ui 0.16.2 → 0.18.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.
@@ -28,13 +28,28 @@ export type SelectItemsProps = {
28
28
  labelProps?: Omit<SelectLabelProps, "children">;
29
29
  separatorProps?: SelectSeparatorProps;
30
30
  };
31
+ type SelectRootPrimitiveProps = React.ComponentPropsWithoutRef<typeof SelectPrimitive.Root>;
32
+ export type SelectProps = SelectRootPrimitiveProps & {
33
+ /**
34
+ * 是否在弹层打开时锁定页面滚动。
35
+ *
36
+ * 默认允许页面继续滚动;如需恢复 Radix Select 的模态行为,可设置为 `true`。
37
+ */
38
+ lockScroll?: boolean;
39
+ };
31
40
  export type SelectTriggerProps = StyledPrimitiveProps<React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>>;
32
41
  export type SelectScrollButtonProps = StyledPrimitiveProps<React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>>;
33
42
  export type SelectContentProps = StyledPrimitiveProps<React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>>;
34
43
  export type SelectLabelProps = StyledPrimitiveProps<React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>>;
35
44
  export type SelectItemProps = StyledPrimitiveProps<React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>>;
36
45
  export type SelectSeparatorProps = StyledPrimitiveProps<React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>>;
37
- declare const Select: React.FC<SelectPrimitive.SelectProps>;
46
+ /**
47
+ * Select 根组件,默认不锁定页面滚动。
48
+ */
49
+ declare function Select(props: SelectProps): import("react/jsx-runtime").JSX.Element;
50
+ declare namespace Select {
51
+ var displayName: string;
52
+ }
38
53
  declare const SelectGroup: React.ForwardRefExoticComponent<SelectPrimitive.SelectGroupProps & React.RefAttributes<HTMLDivElement>>;
39
54
  declare const SelectValue: React.ForwardRefExoticComponent<SelectPrimitive.SelectValueProps & React.RefAttributes<HTMLSpanElement>>;
40
55
  /**
@@ -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
+ }