@alifd/chat 0.1.9 → 0.1.10

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.
@@ -20,5 +20,13 @@
20
20
  import React from 'react';
21
21
  import type { ButtonProps } from './types';
22
22
  export * from './types';
23
- declare const _default: import("@alifd/next/types/config-provider/types").ConfiguredComponentClass<Pick<ButtonProps & React.RefAttributes<import("@alifd/next/types/config-provider/types").ConfiguredComponent<import("@alifd/next/types/button").ButtonProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, import("@alifd/next/types/button/view/button").default>>, keyof ButtonProps | "key"> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, import("@alifd/next/types/config-provider/types").ConfiguredComponent<import("@alifd/next/types/button").ButtonProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, import("@alifd/next/types/button/view/button").default>, {}>;
23
+ declare const _default: {
24
+ new (props: ButtonProps & React.RefAttributes<import("@alifd/next/types/config-provider/types").ConfiguredComponent<import("@alifd/next/types/button").ButtonProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, import("@alifd/next/types/button/view/button").default>> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, context?: unknown): import("@alifd/next/types/config-provider/types").ConfiguredComponent<ButtonProps & React.RefAttributes<import("@alifd/next/types/config-provider/types").ConfiguredComponent<import("@alifd/next/types/button").ButtonProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, import("@alifd/next/types/button/view/button").default>> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, import("@alifd/next/types/config-provider/types").ConfiguredComponent<import("@alifd/next/types/button").ButtonProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, import("@alifd/next/types/button/view/button").default>>;
25
+ contextType?: React.Context<any> | undefined;
26
+ } & {
27
+ displayName: string;
28
+ defaultProps: Partial<ButtonProps & React.RefAttributes<import("@alifd/next/types/config-provider/types").ConfiguredComponent<import("@alifd/next/types/button").ButtonProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, import("@alifd/next/types/button/view/button").default>>> | undefined;
29
+ propTypes: React.WeakValidationMap<ButtonProps & React.RefAttributes<import("@alifd/next/types/config-provider/types").ConfiguredComponent<import("@alifd/next/types/button").ButtonProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, import("@alifd/next/types/button/view/button").default>>> | undefined;
30
+ $$typeof: symbol;
31
+ };
24
32
  export default _default;
@@ -1,5 +1,9 @@
1
+ /// <reference types="react" />
1
2
  import Collapsable from './view/collapsable';
2
- declare const CardWithSub: import("@alifd/next/types/config-provider/types").ConfiguredComponentClass<import("./types").CardProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, undefined, {}> & {
3
+ declare const CardWithSub: {
4
+ new (props: import("./types").CardProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, context?: unknown): import("@alifd/next/types/config-provider/types").ConfiguredComponent<import("./types").CardProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, unknown>;
5
+ contextType?: import("react").Context<any> | undefined;
6
+ } & {} & {
3
7
  Collapsable: typeof Collapsable;
4
8
  };
5
9
  export * from './types';
@@ -2,5 +2,8 @@ import React from 'react';
2
2
  import type { CardProps } from '../types';
3
3
  export declare function useCardInner({ prefix, innerClassName, title, titleAlign, titleLine, footer, footerAlign, footerLine, components, children, }: CardProps): React.JSX.Element;
4
4
  export declare function useCardOuter(props: CardProps): React.JSX.Element;
5
- declare const _default: import("@alifd/next/types/config-provider/types").ConfiguredComponentClass<CardProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, undefined, {}>;
5
+ declare const _default: {
6
+ new (props: CardProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, context?: unknown): import("@alifd/next/types/config-provider/types").ConfiguredComponent<CardProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, unknown>;
7
+ contextType?: React.Context<any> | undefined;
8
+ } & {};
6
9
  export default _default;
@@ -1,7 +1,12 @@
1
+ import React from 'react';
1
2
  import type { FeedbackProps } from './types';
2
3
  import Good from './view/good';
3
4
  export * from './types';
4
- declare const _default: import("@alifd/next/types/config-provider/types").ConfiguredComponentClass<FeedbackProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, undefined, {}> & {
5
+ declare const _default: {
6
+ new (props: FeedbackProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, context?: unknown): import("@alifd/next/types/config-provider/types").ConfiguredComponent<FeedbackProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, unknown>;
7
+ contextType?: React.Context<any> | undefined;
8
+ } & {
9
+ displayName: string;
5
10
  Good: typeof Good;
6
11
  };
7
12
  export default _default;
@@ -1,8 +1,30 @@
1
1
  /// <reference types="react" />
2
- declare const FloatButtonWithSub: import("@alifd/next/types/config-provider/types").ConfiguredComponentClass<Pick<import("./types").FloatButtonProps & import("react").RefAttributes<import("./types").FloatButtonRef>, "key" | keyof import("./types").FloatButtonProps> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, import("./types").FloatButtonRef, {}> & {
3
- Backtop: import("@alifd/next/types/config-provider/types").ConfiguredComponentClass<Pick<import("./types").BacktopProps & import("react").RefAttributes<import("./types").BacktopRef>, "key" | keyof import("./types").BacktopProps> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, import("./types").BacktopRef, {}>;
4
- Drawer: import("@alifd/next/types/config-provider/types").ConfiguredComponentClass<import("./types").FloatButtonDrawerProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, undefined, {}>;
5
- InnerDrawer: import("@alifd/next/types/config-provider/types").ConfiguredComponentClass<import("./types").FloatButtonInnerDrawerProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, undefined, {}>;
2
+ declare const FloatButtonWithSub: {
3
+ new (props: import("./types").FloatButtonProps & import("react").RefAttributes<import("./types").FloatButtonRef> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, context?: unknown): import("@alifd/next/types/config-provider/types").ConfiguredComponent<import("./types").FloatButtonProps & import("react").RefAttributes<import("./types").FloatButtonRef> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, import("./types").FloatButtonRef>;
4
+ contextType?: import("react").Context<any> | undefined;
5
+ } & {
6
+ displayName: string | undefined;
7
+ defaultProps: Partial<import("./types").FloatButtonProps & import("react").RefAttributes<import("./types").FloatButtonRef>> | undefined;
8
+ propTypes: import("react").WeakValidationMap<import("./types").FloatButtonProps & import("react").RefAttributes<import("./types").FloatButtonRef>> | undefined;
9
+ $$typeof: symbol;
10
+ } & {
11
+ Backtop: {
12
+ new (props: import("./types").BacktopProps & import("react").RefAttributes<import("./types").BacktopRef> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, context?: unknown): import("@alifd/next/types/config-provider/types").ConfiguredComponent<import("./types").BacktopProps & import("react").RefAttributes<import("./types").BacktopRef> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, import("./types").BacktopRef>;
13
+ contextType?: import("react").Context<any> | undefined;
14
+ } & {
15
+ displayName: string | undefined;
16
+ defaultProps: Partial<import("./types").BacktopProps & import("react").RefAttributes<import("./types").BacktopRef>> | undefined;
17
+ propTypes: import("react").WeakValidationMap<import("./types").BacktopProps & import("react").RefAttributes<import("./types").BacktopRef>> | undefined;
18
+ $$typeof: symbol;
19
+ };
20
+ Drawer: {
21
+ new (props: import("./types").FloatButtonDrawerProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, context?: unknown): import("@alifd/next/types/config-provider/types").ConfiguredComponent<import("./types").FloatButtonDrawerProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, unknown>;
22
+ contextType?: import("react").Context<any> | undefined;
23
+ } & {};
24
+ InnerDrawer: {
25
+ new (props: import("./types").FloatButtonInnerDrawerProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, context?: unknown): import("@alifd/next/types/config-provider/types").ConfiguredComponent<import("./types").FloatButtonInnerDrawerProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, unknown>;
26
+ contextType?: import("react").Context<any> | undefined;
27
+ } & {};
6
28
  };
7
29
  export type { BacktopRef, BacktopProps, FloatButtonRef, FloatButtonProps, FloatButtonDrawerProps, FloatButtonInnerDrawerProps, Edge, Margin, Position, RequiredParts, ScreenRatioPosition, Size, TriggerType, } from './types';
8
30
  export default FloatButtonWithSub;
@@ -1,4 +1,12 @@
1
1
  import React from 'react';
2
2
  import type { BacktopProps, BacktopRef } from '../types';
3
- declare const _default: import("@alifd/next/types/config-provider/types").ConfiguredComponentClass<Pick<BacktopProps & React.RefAttributes<BacktopRef>, "key" | keyof BacktopProps> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, BacktopRef, {}>;
3
+ declare const _default: {
4
+ new (props: BacktopProps & React.RefAttributes<BacktopRef> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, context?: unknown): import("@alifd/next/types/config-provider/types").ConfiguredComponent<BacktopProps & React.RefAttributes<BacktopRef> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, BacktopRef>;
5
+ contextType?: React.Context<any> | undefined;
6
+ } & {
7
+ displayName: string | undefined;
8
+ defaultProps: Partial<BacktopProps & React.RefAttributes<BacktopRef>> | undefined;
9
+ propTypes: React.WeakValidationMap<BacktopProps & React.RefAttributes<BacktopRef>> | undefined;
10
+ $$typeof: symbol;
11
+ };
4
12
  export default _default;
@@ -6,5 +6,8 @@ export interface DrawerProps extends Omit<NextDrawerProps, 'triggerType' | 'cont
6
6
  triggerType?: TriggerType | TriggerType[];
7
7
  }
8
8
  export declare function Drawer({ prefix, children, trigger, triggerType, visible, onVisibleChange, ...rests }: DrawerProps): React.JSX.Element;
9
- declare const _default: import("@alifd/next/types/config-provider/types").ConfiguredComponentClass<FloatButtonDrawerProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, undefined, {}>;
9
+ declare const _default: {
10
+ new (props: FloatButtonDrawerProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, context?: unknown): import("@alifd/next/types/config-provider/types").ConfiguredComponent<FloatButtonDrawerProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, unknown>;
11
+ contextType?: React.Context<any> | undefined;
12
+ } & {};
10
13
  export default _default;
@@ -1,4 +1,12 @@
1
1
  import React from 'react';
2
2
  import type { FloatButtonProps, FloatButtonRef } from '../types';
3
- declare const _default: import("@alifd/next/types/config-provider/types").ConfiguredComponentClass<Pick<FloatButtonProps & React.RefAttributes<FloatButtonRef>, "key" | keyof FloatButtonProps> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, FloatButtonRef, {}>;
3
+ declare const _default: {
4
+ new (props: FloatButtonProps & React.RefAttributes<FloatButtonRef> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, context?: unknown): import("@alifd/next/types/config-provider/types").ConfiguredComponent<FloatButtonProps & React.RefAttributes<FloatButtonRef> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, FloatButtonRef>;
5
+ contextType?: React.Context<any> | undefined;
6
+ } & {
7
+ displayName: string | undefined;
8
+ defaultProps: Partial<FloatButtonProps & React.RefAttributes<FloatButtonRef>> | undefined;
9
+ propTypes: React.WeakValidationMap<FloatButtonProps & React.RefAttributes<FloatButtonRef>> | undefined;
10
+ $$typeof: symbol;
11
+ };
4
12
  export default _default;
@@ -19,5 +19,8 @@ export interface InnerDrawerProps {
19
19
  afterClose?: () => void;
20
20
  }
21
21
  export declare function InnerDrawer({ className, prefix, target, children, trigger, triggerType, visible, onVisibleChange, closable, title, cache, width, beforeOpen, beforeClose, afterOpen, afterClose, }: InnerDrawerProps): React.JSX.Element;
22
- declare const _default: import("@alifd/next/types/config-provider/types").ConfiguredComponentClass<FloatButtonInnerDrawerProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, undefined, {}>;
22
+ declare const _default: {
23
+ new (props: FloatButtonInnerDrawerProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, context?: unknown): import("@alifd/next/types/config-provider/types").ConfiguredComponent<FloatButtonInnerDrawerProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, unknown>;
24
+ contextType?: React.Context<any> | undefined;
25
+ } & {};
23
26
  export default _default;
@@ -101,14 +101,23 @@ export function InnerDrawer({ className, prefix, target, children, trigger, trig
101
101
  const handlers = useTriggerType({ visible, onVisibleChange: handleVisibleChange, triggerType });
102
102
  const domRef = useRef(null);
103
103
  const triggerRef = useRef(null);
104
+ const timeoutRef = useRef(null);
105
+ const hasCallbackFired = useRef(false);
106
+ function handleAnimationEnd() {
107
+ if (!hasCallbackFired.current) {
108
+ const { visible, afterClose, afterOpen } = propsRef.current;
109
+ visible ? afterOpen === null || afterOpen === void 0 ? void 0 : afterOpen() : afterClose === null || afterClose === void 0 ? void 0 : afterClose();
110
+ hasCallbackFired.current = true;
111
+ }
112
+ }
104
113
  useEffect(() => {
105
114
  if (!mountTarget) {
106
115
  return;
107
116
  }
108
117
  const onEnd = (e) => {
109
118
  if (e.target === mountTarget && e.propertyName === 'width') {
110
- const { visible, afterClose, afterOpen } = propsRef.current;
111
- visible ? afterOpen === null || afterOpen === void 0 ? void 0 : afterOpen() : afterClose === null || afterClose === void 0 ? void 0 : afterClose();
119
+ clearTimeout(timeoutRef.current);
120
+ handleAnimationEnd();
112
121
  }
113
122
  };
114
123
  mountTarget.addEventListener('transitionend', onEnd);
@@ -120,23 +129,34 @@ export function InnerDrawer({ className, prefix, target, children, trigger, trig
120
129
  if (!mountTarget) {
121
130
  return;
122
131
  }
123
- if (visible) {
124
- beforeOpen === null || beforeOpen === void 0 ? void 0 : beforeOpen();
125
- const id = requestAnimationFrame(() => {
126
- mountTarget.style.transition = 'width 0.3s,opacity 0.3s';
127
- mountTarget.style.width = `${typeof width === 'number' ? `${width}px` : width}`;
128
- mountTarget.style.opacity = '1';
129
- });
130
- return () => {
131
- cancelAnimationFrame(id);
132
- };
133
- }
134
- else {
135
- beforeClose === null || beforeClose === void 0 ? void 0 : beforeClose();
136
- mountTarget.style.transition = 'width 0.3s,opacity 0.3s';
137
- mountTarget.style.width = `0px`;
138
- mountTarget.style.opacity = '0';
132
+ hasCallbackFired.current = false;
133
+ function applyAnimationStyles(target, width, opacity) {
134
+ target.style.transition = 'width 0.3s, opacity 0.3s';
135
+ target.style.width = `${typeof width === 'number' ? `${width}px` : width}`;
136
+ target.style.opacity = opacity;
139
137
  }
138
+ const animationFrameId = requestAnimationFrame(() => {
139
+ if (visible) {
140
+ beforeOpen === null || beforeOpen === void 0 ? void 0 : beforeOpen();
141
+ clearTimeout(timeoutRef.current);
142
+ timeoutRef.current = setTimeout(() => {
143
+ handleAnimationEnd();
144
+ }, 300);
145
+ applyAnimationStyles(mountTarget, width, '1');
146
+ }
147
+ else {
148
+ beforeClose === null || beforeClose === void 0 ? void 0 : beforeClose();
149
+ clearTimeout(timeoutRef.current);
150
+ timeoutRef.current = setTimeout(() => {
151
+ handleAnimationEnd();
152
+ }, 300);
153
+ applyAnimationStyles(mountTarget, 0, '0');
154
+ }
155
+ });
156
+ return () => {
157
+ cancelAnimationFrame(animationFrameId);
158
+ clearTimeout(timeoutRef.current);
159
+ };
140
160
  }, [visible, mountTarget]);
141
161
  useEffect(() => {
142
162
  if (!mountTarget || !className) {
package/es/tab/index.d.ts CHANGED
@@ -2,7 +2,14 @@ import React from 'react';
2
2
  import { Tab as NextTab } from '@alifd/next';
3
3
  import type { TabProps } from '@alifd/next/types/tab';
4
4
  export type { TabProps, ItemProps } from '@alifd/next/types/tab';
5
- declare const _default: import("@alifd/next/types/config-provider/types").ConfiguredComponentClass<Pick<TabProps & React.RefAttributes<NextTab>, "key" | keyof TabProps> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, NextTab, {}> & {
5
+ declare const _default: {
6
+ new (props: TabProps & React.RefAttributes<NextTab> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, context?: unknown): import("@alifd/next/types/config-provider/types").ConfiguredComponent<TabProps & React.RefAttributes<NextTab> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, NextTab>;
7
+ contextType?: React.Context<any> | undefined;
8
+ } & {
9
+ displayName: string;
10
+ defaultProps: Partial<TabProps & React.RefAttributes<NextTab>> | undefined;
11
+ propTypes: React.WeakValidationMap<TabProps & React.RefAttributes<NextTab>> | undefined;
12
+ $$typeof: symbol;
6
13
  Item: typeof import("@alifd/next/types/tab").Item;
7
14
  };
8
15
  export default _default;
package/es/tag/index.d.ts CHANGED
@@ -9,5 +9,13 @@ import React from 'react';
9
9
  import { Tag as NextTag } from '@alifd/next';
10
10
  import type { TagProps } from '@alifd/next/types/tag';
11
11
  export type { TagProps } from '@alifd/next/types/tag';
12
- declare const _default: import("@alifd/next/types/config-provider/types").ConfiguredComponentClass<Pick<TagProps & React.RefAttributes<NextTag>, "key" | keyof TagProps> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, NextTag, {}>;
12
+ declare const _default: {
13
+ new (props: TagProps & React.RefAttributes<NextTag> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, context?: unknown): import("@alifd/next/types/config-provider/types").ConfiguredComponent<TagProps & React.RefAttributes<NextTag> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, NextTag>;
14
+ contextType?: React.Context<any> | undefined;
15
+ } & {
16
+ displayName: string;
17
+ defaultProps: Partial<TagProps & React.RefAttributes<NextTag>> | undefined;
18
+ propTypes: React.WeakValidationMap<TagProps & React.RefAttributes<NextTag>> | undefined;
19
+ $$typeof: symbol;
20
+ };
13
21
  export default _default;
@@ -1,3 +1,9 @@
1
+ import React from 'react';
1
2
  import type { TextProps } from './types';
2
- declare const _default: import("@alifd/next/types/config-provider/types").ConfiguredComponentClass<TextProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, undefined, {}>;
3
+ declare const _default: {
4
+ new (props: TextProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, context?: unknown): import("@alifd/next/types/config-provider/types").ConfiguredComponent<TextProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, unknown>;
5
+ contextType?: React.Context<any> | undefined;
6
+ } & {
7
+ displayName: string;
8
+ };
3
9
  export default _default;
@@ -20,5 +20,13 @@
20
20
  import React from 'react';
21
21
  import type { ButtonProps } from './types';
22
22
  export * from './types';
23
- declare const _default: import("@alifd/next/types/config-provider/types").ConfiguredComponentClass<Pick<ButtonProps & React.RefAttributes<import("@alifd/next/types/config-provider/types").ConfiguredComponent<import("@alifd/next/types/button").ButtonProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, import("@alifd/next/types/button/view/button").default>>, keyof ButtonProps | "key"> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, import("@alifd/next/types/config-provider/types").ConfiguredComponent<import("@alifd/next/types/button").ButtonProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, import("@alifd/next/types/button/view/button").default>, {}>;
23
+ declare const _default: {
24
+ new (props: ButtonProps & React.RefAttributes<import("@alifd/next/types/config-provider/types").ConfiguredComponent<import("@alifd/next/types/button").ButtonProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, import("@alifd/next/types/button/view/button").default>> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, context?: unknown): import("@alifd/next/types/config-provider/types").ConfiguredComponent<ButtonProps & React.RefAttributes<import("@alifd/next/types/config-provider/types").ConfiguredComponent<import("@alifd/next/types/button").ButtonProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, import("@alifd/next/types/button/view/button").default>> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, import("@alifd/next/types/config-provider/types").ConfiguredComponent<import("@alifd/next/types/button").ButtonProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, import("@alifd/next/types/button/view/button").default>>;
25
+ contextType?: React.Context<any> | undefined;
26
+ } & {
27
+ displayName: string;
28
+ defaultProps: Partial<ButtonProps & React.RefAttributes<import("@alifd/next/types/config-provider/types").ConfiguredComponent<import("@alifd/next/types/button").ButtonProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, import("@alifd/next/types/button/view/button").default>>> | undefined;
29
+ propTypes: React.WeakValidationMap<ButtonProps & React.RefAttributes<import("@alifd/next/types/config-provider/types").ConfiguredComponent<import("@alifd/next/types/button").ButtonProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, import("@alifd/next/types/button/view/button").default>>> | undefined;
30
+ $$typeof: symbol;
31
+ };
24
32
  export default _default;
@@ -1,5 +1,9 @@
1
+ /// <reference types="react" />
1
2
  import Collapsable from './view/collapsable';
2
- declare const CardWithSub: import("@alifd/next/types/config-provider/types").ConfiguredComponentClass<import("./types").CardProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, undefined, {}> & {
3
+ declare const CardWithSub: {
4
+ new (props: import("./types").CardProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, context?: unknown): import("@alifd/next/types/config-provider/types").ConfiguredComponent<import("./types").CardProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, unknown>;
5
+ contextType?: import("react").Context<any> | undefined;
6
+ } & {} & {
3
7
  Collapsable: typeof Collapsable;
4
8
  };
5
9
  export * from './types';
@@ -2,5 +2,8 @@ import React from 'react';
2
2
  import type { CardProps } from '../types';
3
3
  export declare function useCardInner({ prefix, innerClassName, title, titleAlign, titleLine, footer, footerAlign, footerLine, components, children, }: CardProps): React.JSX.Element;
4
4
  export declare function useCardOuter(props: CardProps): React.JSX.Element;
5
- declare const _default: import("@alifd/next/types/config-provider/types").ConfiguredComponentClass<CardProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, undefined, {}>;
5
+ declare const _default: {
6
+ new (props: CardProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, context?: unknown): import("@alifd/next/types/config-provider/types").ConfiguredComponent<CardProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, unknown>;
7
+ contextType?: React.Context<any> | undefined;
8
+ } & {};
6
9
  export default _default;
@@ -1,7 +1,12 @@
1
+ import React from 'react';
1
2
  import type { FeedbackProps } from './types';
2
3
  import Good from './view/good';
3
4
  export * from './types';
4
- declare const _default: import("@alifd/next/types/config-provider/types").ConfiguredComponentClass<FeedbackProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, undefined, {}> & {
5
+ declare const _default: {
6
+ new (props: FeedbackProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, context?: unknown): import("@alifd/next/types/config-provider/types").ConfiguredComponent<FeedbackProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, unknown>;
7
+ contextType?: React.Context<any> | undefined;
8
+ } & {
9
+ displayName: string;
5
10
  Good: typeof Good;
6
11
  };
7
12
  export default _default;
@@ -1,8 +1,30 @@
1
1
  /// <reference types="react" />
2
- declare const FloatButtonWithSub: import("@alifd/next/types/config-provider/types").ConfiguredComponentClass<Pick<import("./types").FloatButtonProps & import("react").RefAttributes<import("./types").FloatButtonRef>, "key" | keyof import("./types").FloatButtonProps> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, import("./types").FloatButtonRef, {}> & {
3
- Backtop: import("@alifd/next/types/config-provider/types").ConfiguredComponentClass<Pick<import("./types").BacktopProps & import("react").RefAttributes<import("./types").BacktopRef>, "key" | keyof import("./types").BacktopProps> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, import("./types").BacktopRef, {}>;
4
- Drawer: import("@alifd/next/types/config-provider/types").ConfiguredComponentClass<import("./types").FloatButtonDrawerProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, undefined, {}>;
5
- InnerDrawer: import("@alifd/next/types/config-provider/types").ConfiguredComponentClass<import("./types").FloatButtonInnerDrawerProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, undefined, {}>;
2
+ declare const FloatButtonWithSub: {
3
+ new (props: import("./types").FloatButtonProps & import("react").RefAttributes<import("./types").FloatButtonRef> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, context?: unknown): import("@alifd/next/types/config-provider/types").ConfiguredComponent<import("./types").FloatButtonProps & import("react").RefAttributes<import("./types").FloatButtonRef> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, import("./types").FloatButtonRef>;
4
+ contextType?: import("react").Context<any> | undefined;
5
+ } & {
6
+ displayName: string | undefined;
7
+ defaultProps: Partial<import("./types").FloatButtonProps & import("react").RefAttributes<import("./types").FloatButtonRef>> | undefined;
8
+ propTypes: import("react").WeakValidationMap<import("./types").FloatButtonProps & import("react").RefAttributes<import("./types").FloatButtonRef>> | undefined;
9
+ $$typeof: symbol;
10
+ } & {
11
+ Backtop: {
12
+ new (props: import("./types").BacktopProps & import("react").RefAttributes<import("./types").BacktopRef> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, context?: unknown): import("@alifd/next/types/config-provider/types").ConfiguredComponent<import("./types").BacktopProps & import("react").RefAttributes<import("./types").BacktopRef> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, import("./types").BacktopRef>;
13
+ contextType?: import("react").Context<any> | undefined;
14
+ } & {
15
+ displayName: string | undefined;
16
+ defaultProps: Partial<import("./types").BacktopProps & import("react").RefAttributes<import("./types").BacktopRef>> | undefined;
17
+ propTypes: import("react").WeakValidationMap<import("./types").BacktopProps & import("react").RefAttributes<import("./types").BacktopRef>> | undefined;
18
+ $$typeof: symbol;
19
+ };
20
+ Drawer: {
21
+ new (props: import("./types").FloatButtonDrawerProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, context?: unknown): import("@alifd/next/types/config-provider/types").ConfiguredComponent<import("./types").FloatButtonDrawerProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, unknown>;
22
+ contextType?: import("react").Context<any> | undefined;
23
+ } & {};
24
+ InnerDrawer: {
25
+ new (props: import("./types").FloatButtonInnerDrawerProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, context?: unknown): import("@alifd/next/types/config-provider/types").ConfiguredComponent<import("./types").FloatButtonInnerDrawerProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, unknown>;
26
+ contextType?: import("react").Context<any> | undefined;
27
+ } & {};
6
28
  };
7
29
  export type { BacktopRef, BacktopProps, FloatButtonRef, FloatButtonProps, FloatButtonDrawerProps, FloatButtonInnerDrawerProps, Edge, Margin, Position, RequiredParts, ScreenRatioPosition, Size, TriggerType, } from './types';
8
30
  export default FloatButtonWithSub;
@@ -1,4 +1,12 @@
1
1
  import React from 'react';
2
2
  import type { BacktopProps, BacktopRef } from '../types';
3
- declare const _default: import("@alifd/next/types/config-provider/types").ConfiguredComponentClass<Pick<BacktopProps & React.RefAttributes<BacktopRef>, "key" | keyof BacktopProps> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, BacktopRef, {}>;
3
+ declare const _default: {
4
+ new (props: BacktopProps & React.RefAttributes<BacktopRef> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, context?: unknown): import("@alifd/next/types/config-provider/types").ConfiguredComponent<BacktopProps & React.RefAttributes<BacktopRef> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, BacktopRef>;
5
+ contextType?: React.Context<any> | undefined;
6
+ } & {
7
+ displayName: string | undefined;
8
+ defaultProps: Partial<BacktopProps & React.RefAttributes<BacktopRef>> | undefined;
9
+ propTypes: React.WeakValidationMap<BacktopProps & React.RefAttributes<BacktopRef>> | undefined;
10
+ $$typeof: symbol;
11
+ };
4
12
  export default _default;
@@ -6,5 +6,8 @@ export interface DrawerProps extends Omit<NextDrawerProps, 'triggerType' | 'cont
6
6
  triggerType?: TriggerType | TriggerType[];
7
7
  }
8
8
  export declare function Drawer({ prefix, children, trigger, triggerType, visible, onVisibleChange, ...rests }: DrawerProps): React.JSX.Element;
9
- declare const _default: import("@alifd/next/types/config-provider/types").ConfiguredComponentClass<FloatButtonDrawerProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, undefined, {}>;
9
+ declare const _default: {
10
+ new (props: FloatButtonDrawerProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, context?: unknown): import("@alifd/next/types/config-provider/types").ConfiguredComponent<FloatButtonDrawerProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, unknown>;
11
+ contextType?: React.Context<any> | undefined;
12
+ } & {};
10
13
  export default _default;
@@ -1,4 +1,12 @@
1
1
  import React from 'react';
2
2
  import type { FloatButtonProps, FloatButtonRef } from '../types';
3
- declare const _default: import("@alifd/next/types/config-provider/types").ConfiguredComponentClass<Pick<FloatButtonProps & React.RefAttributes<FloatButtonRef>, "key" | keyof FloatButtonProps> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, FloatButtonRef, {}>;
3
+ declare const _default: {
4
+ new (props: FloatButtonProps & React.RefAttributes<FloatButtonRef> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, context?: unknown): import("@alifd/next/types/config-provider/types").ConfiguredComponent<FloatButtonProps & React.RefAttributes<FloatButtonRef> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, FloatButtonRef>;
5
+ contextType?: React.Context<any> | undefined;
6
+ } & {
7
+ displayName: string | undefined;
8
+ defaultProps: Partial<FloatButtonProps & React.RefAttributes<FloatButtonRef>> | undefined;
9
+ propTypes: React.WeakValidationMap<FloatButtonProps & React.RefAttributes<FloatButtonRef>> | undefined;
10
+ $$typeof: symbol;
11
+ };
4
12
  export default _default;
@@ -19,5 +19,8 @@ export interface InnerDrawerProps {
19
19
  afterClose?: () => void;
20
20
  }
21
21
  export declare function InnerDrawer({ className, prefix, target, children, trigger, triggerType, visible, onVisibleChange, closable, title, cache, width, beforeOpen, beforeClose, afterOpen, afterClose, }: InnerDrawerProps): React.JSX.Element;
22
- declare const _default: import("@alifd/next/types/config-provider/types").ConfiguredComponentClass<FloatButtonInnerDrawerProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, undefined, {}>;
22
+ declare const _default: {
23
+ new (props: FloatButtonInnerDrawerProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, context?: unknown): import("@alifd/next/types/config-provider/types").ConfiguredComponent<FloatButtonInnerDrawerProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, unknown>;
24
+ contextType?: React.Context<any> | undefined;
25
+ } & {};
23
26
  export default _default;
@@ -104,14 +104,23 @@ function InnerDrawer({ className, prefix, target, children, trigger, triggerType
104
104
  const handlers = (0, useTriggerType_1.useTriggerType)({ visible, onVisibleChange: handleVisibleChange, triggerType });
105
105
  const domRef = (0, react_1.useRef)(null);
106
106
  const triggerRef = (0, react_1.useRef)(null);
107
+ const timeoutRef = (0, react_1.useRef)(null);
108
+ const hasCallbackFired = (0, react_1.useRef)(false);
109
+ function handleAnimationEnd() {
110
+ if (!hasCallbackFired.current) {
111
+ const { visible, afterClose, afterOpen } = propsRef.current;
112
+ visible ? afterOpen === null || afterOpen === void 0 ? void 0 : afterOpen() : afterClose === null || afterClose === void 0 ? void 0 : afterClose();
113
+ hasCallbackFired.current = true;
114
+ }
115
+ }
107
116
  (0, react_1.useEffect)(() => {
108
117
  if (!mountTarget) {
109
118
  return;
110
119
  }
111
120
  const onEnd = (e) => {
112
121
  if (e.target === mountTarget && e.propertyName === 'width') {
113
- const { visible, afterClose, afterOpen } = propsRef.current;
114
- visible ? afterOpen === null || afterOpen === void 0 ? void 0 : afterOpen() : afterClose === null || afterClose === void 0 ? void 0 : afterClose();
122
+ clearTimeout(timeoutRef.current);
123
+ handleAnimationEnd();
115
124
  }
116
125
  };
117
126
  mountTarget.addEventListener('transitionend', onEnd);
@@ -123,23 +132,34 @@ function InnerDrawer({ className, prefix, target, children, trigger, triggerType
123
132
  if (!mountTarget) {
124
133
  return;
125
134
  }
126
- if (visible) {
127
- beforeOpen === null || beforeOpen === void 0 ? void 0 : beforeOpen();
128
- const id = requestAnimationFrame(() => {
129
- mountTarget.style.transition = 'width 0.3s,opacity 0.3s';
130
- mountTarget.style.width = `${typeof width === 'number' ? `${width}px` : width}`;
131
- mountTarget.style.opacity = '1';
132
- });
133
- return () => {
134
- cancelAnimationFrame(id);
135
- };
136
- }
137
- else {
138
- beforeClose === null || beforeClose === void 0 ? void 0 : beforeClose();
139
- mountTarget.style.transition = 'width 0.3s,opacity 0.3s';
140
- mountTarget.style.width = `0px`;
141
- mountTarget.style.opacity = '0';
135
+ hasCallbackFired.current = false;
136
+ function applyAnimationStyles(target, width, opacity) {
137
+ target.style.transition = 'width 0.3s, opacity 0.3s';
138
+ target.style.width = `${typeof width === 'number' ? `${width}px` : width}`;
139
+ target.style.opacity = opacity;
142
140
  }
141
+ const animationFrameId = requestAnimationFrame(() => {
142
+ if (visible) {
143
+ beforeOpen === null || beforeOpen === void 0 ? void 0 : beforeOpen();
144
+ clearTimeout(timeoutRef.current);
145
+ timeoutRef.current = setTimeout(() => {
146
+ handleAnimationEnd();
147
+ }, 300);
148
+ applyAnimationStyles(mountTarget, width, '1');
149
+ }
150
+ else {
151
+ beforeClose === null || beforeClose === void 0 ? void 0 : beforeClose();
152
+ clearTimeout(timeoutRef.current);
153
+ timeoutRef.current = setTimeout(() => {
154
+ handleAnimationEnd();
155
+ }, 300);
156
+ applyAnimationStyles(mountTarget, 0, '0');
157
+ }
158
+ });
159
+ return () => {
160
+ cancelAnimationFrame(animationFrameId);
161
+ clearTimeout(timeoutRef.current);
162
+ };
143
163
  }, [visible, mountTarget]);
144
164
  (0, react_1.useEffect)(() => {
145
165
  if (!mountTarget || !className) {
@@ -2,7 +2,14 @@ import React from 'react';
2
2
  import { Tab as NextTab } from '@alifd/next';
3
3
  import type { TabProps } from '@alifd/next/types/tab';
4
4
  export type { TabProps, ItemProps } from '@alifd/next/types/tab';
5
- declare const _default: import("@alifd/next/types/config-provider/types").ConfiguredComponentClass<Pick<TabProps & React.RefAttributes<NextTab>, "key" | keyof TabProps> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, NextTab, {}> & {
5
+ declare const _default: {
6
+ new (props: TabProps & React.RefAttributes<NextTab> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, context?: unknown): import("@alifd/next/types/config-provider/types").ConfiguredComponent<TabProps & React.RefAttributes<NextTab> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, NextTab>;
7
+ contextType?: React.Context<any> | undefined;
8
+ } & {
9
+ displayName: string;
10
+ defaultProps: Partial<TabProps & React.RefAttributes<NextTab>> | undefined;
11
+ propTypes: React.WeakValidationMap<TabProps & React.RefAttributes<NextTab>> | undefined;
12
+ $$typeof: symbol;
6
13
  Item: typeof import("@alifd/next/types/tab").Item;
7
14
  };
8
15
  export default _default;
@@ -9,5 +9,13 @@ import React from 'react';
9
9
  import { Tag as NextTag } from '@alifd/next';
10
10
  import type { TagProps } from '@alifd/next/types/tag';
11
11
  export type { TagProps } from '@alifd/next/types/tag';
12
- declare const _default: import("@alifd/next/types/config-provider/types").ConfiguredComponentClass<Pick<TagProps & React.RefAttributes<NextTag>, "key" | keyof TagProps> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, NextTag, {}>;
12
+ declare const _default: {
13
+ new (props: TagProps & React.RefAttributes<NextTag> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, context?: unknown): import("@alifd/next/types/config-provider/types").ConfiguredComponent<TagProps & React.RefAttributes<NextTag> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, NextTag>;
14
+ contextType?: React.Context<any> | undefined;
15
+ } & {
16
+ displayName: string;
17
+ defaultProps: Partial<TagProps & React.RefAttributes<NextTag>> | undefined;
18
+ propTypes: React.WeakValidationMap<TagProps & React.RefAttributes<NextTag>> | undefined;
19
+ $$typeof: symbol;
20
+ };
13
21
  export default _default;
@@ -1,3 +1,9 @@
1
+ import React from 'react';
1
2
  import type { TextProps } from './types';
2
- declare const _default: import("@alifd/next/types/config-provider/types").ConfiguredComponentClass<TextProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, undefined, {}>;
3
+ declare const _default: {
4
+ new (props: TextProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, context?: unknown): import("@alifd/next/types/config-provider/types").ConfiguredComponent<TextProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, unknown>;
5
+ contextType?: React.Context<any> | undefined;
6
+ } & {
7
+ displayName: string;
8
+ };
3
9
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alifd/chat",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "A configurable component library for chat built on React.",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",