@hsafa/ui-sdk 0.1.7 → 0.1.9
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/dist/index.cjs +19 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +67 -7
- package/dist/index.d.ts +67 -7
- package/dist/index.js +19 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -191,10 +191,6 @@ interface HsafaChatProps {
|
|
|
191
191
|
top?: number | string;
|
|
192
192
|
left?: number | string;
|
|
193
193
|
};
|
|
194
|
-
enableBorderAnimation?: boolean;
|
|
195
|
-
enableContentPadding?: boolean;
|
|
196
|
-
borderRadius?: number | string;
|
|
197
|
-
enableContentBorder?: boolean;
|
|
198
194
|
placeholder?: string;
|
|
199
195
|
title?: string;
|
|
200
196
|
className?: string;
|
|
@@ -354,6 +350,14 @@ interface HsafaContextValue extends HsafaConfig {
|
|
|
354
350
|
registerComponent: (name: string, component: react__default.ComponentType<any>) => () => void;
|
|
355
351
|
/** Unregister a custom component */
|
|
356
352
|
unregisterComponent: (name: string, component?: react__default.ComponentType<any>) => void;
|
|
353
|
+
/** Global streaming state - true if any chat is streaming */
|
|
354
|
+
isAnyStreaming: boolean;
|
|
355
|
+
/** Set streaming state for a specific chat instance */
|
|
356
|
+
setStreamingState: (chatId: string, isStreaming: boolean) => void;
|
|
357
|
+
/** Global chat open state - true if any chat is open */
|
|
358
|
+
isAnyChatOpen: boolean;
|
|
359
|
+
/** Set chat open state for a specific chat instance */
|
|
360
|
+
setChatOpenState: (chatId: string, isOpen: boolean) => void;
|
|
357
361
|
}
|
|
358
362
|
/**
|
|
359
363
|
* Props for the HsafaProvider component
|
|
@@ -578,8 +582,64 @@ declare function useAgentStreaming(): {
|
|
|
578
582
|
};
|
|
579
583
|
|
|
580
584
|
declare function HsafaChat(props: HsafaChatProps): react__default.ReactPortal | null;
|
|
581
|
-
|
|
582
|
-
|
|
585
|
+
|
|
586
|
+
interface ContentContainerProps {
|
|
587
|
+
children: react__default.ReactNode;
|
|
588
|
+
theme?: "dark" | "light";
|
|
589
|
+
primaryColor?: string;
|
|
590
|
+
backgroundColor?: string;
|
|
591
|
+
borderColor?: string;
|
|
592
|
+
textColor?: string;
|
|
593
|
+
mutedTextColor?: string;
|
|
594
|
+
enableBorderAnimation?: boolean;
|
|
595
|
+
borderRadius?: number | string;
|
|
596
|
+
enableContentBorder?: boolean;
|
|
597
|
+
className?: string;
|
|
598
|
+
enableMargin?: boolean;
|
|
599
|
+
chatWidth?: number | string;
|
|
600
|
+
dir?: "ltr" | "rtl";
|
|
583
601
|
}
|
|
602
|
+
/**
|
|
603
|
+
* ContentContainer component that wraps your content and applies animations
|
|
604
|
+
* based on HsafaChat state (streaming and open state).
|
|
605
|
+
*
|
|
606
|
+
* Features:
|
|
607
|
+
* - Detects if any chat under HsafaProvider is streaming and applies border animation
|
|
608
|
+
* - Detects if any HsafaChat is open and applies radius, border, and margin with animation
|
|
609
|
+
* - Automatically adjusts margin based on chat width and direction (RTL/LTR)
|
|
610
|
+
*
|
|
611
|
+
* @example
|
|
612
|
+
* ```tsx
|
|
613
|
+
* // Basic usage
|
|
614
|
+
* <HsafaProvider baseUrl="http://localhost:3000">
|
|
615
|
+
* <ContentContainer theme="dark" enableBorderAnimation>
|
|
616
|
+
* <YourApp />
|
|
617
|
+
* </ContentContainer>
|
|
618
|
+
* <HsafaChat agentId="agent-1" width={450} />
|
|
619
|
+
* </HsafaProvider>
|
|
620
|
+
*
|
|
621
|
+
* // With custom chat width and RTL support
|
|
622
|
+
* <HsafaProvider baseUrl="http://localhost:3000">
|
|
623
|
+
* <ContentContainer
|
|
624
|
+
* theme="dark"
|
|
625
|
+
* chatWidth={450}
|
|
626
|
+
* dir="rtl"
|
|
627
|
+
* enableMargin={true}
|
|
628
|
+
* >
|
|
629
|
+
* <YourApp />
|
|
630
|
+
* </ContentContainer>
|
|
631
|
+
* <HsafaChat agentId="agent-1" width={450} dir="rtl" />
|
|
632
|
+
* </HsafaProvider>
|
|
633
|
+
*
|
|
634
|
+
* // Disable margin (content stays full width)
|
|
635
|
+
* <HsafaProvider baseUrl="http://localhost:3000">
|
|
636
|
+
* <ContentContainer enableMargin={false}>
|
|
637
|
+
* <YourApp />
|
|
638
|
+
* </ContentContainer>
|
|
639
|
+
* <HsafaChat agentId="agent-1" />
|
|
640
|
+
* </HsafaProvider>
|
|
641
|
+
* ```
|
|
642
|
+
*/
|
|
643
|
+
declare function ContentContainer({ children, theme, primaryColor, backgroundColor, borderColor, textColor, mutedTextColor, enableBorderAnimation, borderRadius, enableContentBorder, className, enableMargin, chatWidth, dir, }: ContentContainerProps): react_jsx_runtime.JSX.Element;
|
|
584
644
|
|
|
585
|
-
export { type AgentStreamData, Button, type ButtonProps, type ChatData, type ChatMeta, type FirstAgentData, FloatingChatButton, HsafaChat, HsafaProvider, type MainAgentAction, MessageList, type UseToggleReturn, useAgentStreaming, useAutoScroll, useChatStorage, useFileUpload, useHsafa, useHsafaAction, useHsafaComponent, useStreaming, useToggle };
|
|
645
|
+
export { type AgentStreamData, Button, type ButtonProps, type ChatData, type ChatMeta, ContentContainer, type ContentContainerProps, type FirstAgentData, FloatingChatButton, HsafaChat, HsafaProvider, type MainAgentAction, MessageList, type UseToggleReturn, useAgentStreaming, useAutoScroll, useChatStorage, useFileUpload, useHsafa, useHsafaAction, useHsafaComponent, useStreaming, useToggle };
|
package/dist/index.d.ts
CHANGED
|
@@ -191,10 +191,6 @@ interface HsafaChatProps {
|
|
|
191
191
|
top?: number | string;
|
|
192
192
|
left?: number | string;
|
|
193
193
|
};
|
|
194
|
-
enableBorderAnimation?: boolean;
|
|
195
|
-
enableContentPadding?: boolean;
|
|
196
|
-
borderRadius?: number | string;
|
|
197
|
-
enableContentBorder?: boolean;
|
|
198
194
|
placeholder?: string;
|
|
199
195
|
title?: string;
|
|
200
196
|
className?: string;
|
|
@@ -354,6 +350,14 @@ interface HsafaContextValue extends HsafaConfig {
|
|
|
354
350
|
registerComponent: (name: string, component: react__default.ComponentType<any>) => () => void;
|
|
355
351
|
/** Unregister a custom component */
|
|
356
352
|
unregisterComponent: (name: string, component?: react__default.ComponentType<any>) => void;
|
|
353
|
+
/** Global streaming state - true if any chat is streaming */
|
|
354
|
+
isAnyStreaming: boolean;
|
|
355
|
+
/** Set streaming state for a specific chat instance */
|
|
356
|
+
setStreamingState: (chatId: string, isStreaming: boolean) => void;
|
|
357
|
+
/** Global chat open state - true if any chat is open */
|
|
358
|
+
isAnyChatOpen: boolean;
|
|
359
|
+
/** Set chat open state for a specific chat instance */
|
|
360
|
+
setChatOpenState: (chatId: string, isOpen: boolean) => void;
|
|
357
361
|
}
|
|
358
362
|
/**
|
|
359
363
|
* Props for the HsafaProvider component
|
|
@@ -578,8 +582,64 @@ declare function useAgentStreaming(): {
|
|
|
578
582
|
};
|
|
579
583
|
|
|
580
584
|
declare function HsafaChat(props: HsafaChatProps): react__default.ReactPortal | null;
|
|
581
|
-
|
|
582
|
-
|
|
585
|
+
|
|
586
|
+
interface ContentContainerProps {
|
|
587
|
+
children: react__default.ReactNode;
|
|
588
|
+
theme?: "dark" | "light";
|
|
589
|
+
primaryColor?: string;
|
|
590
|
+
backgroundColor?: string;
|
|
591
|
+
borderColor?: string;
|
|
592
|
+
textColor?: string;
|
|
593
|
+
mutedTextColor?: string;
|
|
594
|
+
enableBorderAnimation?: boolean;
|
|
595
|
+
borderRadius?: number | string;
|
|
596
|
+
enableContentBorder?: boolean;
|
|
597
|
+
className?: string;
|
|
598
|
+
enableMargin?: boolean;
|
|
599
|
+
chatWidth?: number | string;
|
|
600
|
+
dir?: "ltr" | "rtl";
|
|
583
601
|
}
|
|
602
|
+
/**
|
|
603
|
+
* ContentContainer component that wraps your content and applies animations
|
|
604
|
+
* based on HsafaChat state (streaming and open state).
|
|
605
|
+
*
|
|
606
|
+
* Features:
|
|
607
|
+
* - Detects if any chat under HsafaProvider is streaming and applies border animation
|
|
608
|
+
* - Detects if any HsafaChat is open and applies radius, border, and margin with animation
|
|
609
|
+
* - Automatically adjusts margin based on chat width and direction (RTL/LTR)
|
|
610
|
+
*
|
|
611
|
+
* @example
|
|
612
|
+
* ```tsx
|
|
613
|
+
* // Basic usage
|
|
614
|
+
* <HsafaProvider baseUrl="http://localhost:3000">
|
|
615
|
+
* <ContentContainer theme="dark" enableBorderAnimation>
|
|
616
|
+
* <YourApp />
|
|
617
|
+
* </ContentContainer>
|
|
618
|
+
* <HsafaChat agentId="agent-1" width={450} />
|
|
619
|
+
* </HsafaProvider>
|
|
620
|
+
*
|
|
621
|
+
* // With custom chat width and RTL support
|
|
622
|
+
* <HsafaProvider baseUrl="http://localhost:3000">
|
|
623
|
+
* <ContentContainer
|
|
624
|
+
* theme="dark"
|
|
625
|
+
* chatWidth={450}
|
|
626
|
+
* dir="rtl"
|
|
627
|
+
* enableMargin={true}
|
|
628
|
+
* >
|
|
629
|
+
* <YourApp />
|
|
630
|
+
* </ContentContainer>
|
|
631
|
+
* <HsafaChat agentId="agent-1" width={450} dir="rtl" />
|
|
632
|
+
* </HsafaProvider>
|
|
633
|
+
*
|
|
634
|
+
* // Disable margin (content stays full width)
|
|
635
|
+
* <HsafaProvider baseUrl="http://localhost:3000">
|
|
636
|
+
* <ContentContainer enableMargin={false}>
|
|
637
|
+
* <YourApp />
|
|
638
|
+
* </ContentContainer>
|
|
639
|
+
* <HsafaChat agentId="agent-1" />
|
|
640
|
+
* </HsafaProvider>
|
|
641
|
+
* ```
|
|
642
|
+
*/
|
|
643
|
+
declare function ContentContainer({ children, theme, primaryColor, backgroundColor, borderColor, textColor, mutedTextColor, enableBorderAnimation, borderRadius, enableContentBorder, className, enableMargin, chatWidth, dir, }: ContentContainerProps): react_jsx_runtime.JSX.Element;
|
|
584
644
|
|
|
585
|
-
export { type AgentStreamData, Button, type ButtonProps, type ChatData, type ChatMeta, type FirstAgentData, FloatingChatButton, HsafaChat, HsafaProvider, type MainAgentAction, MessageList, type UseToggleReturn, useAgentStreaming, useAutoScroll, useChatStorage, useFileUpload, useHsafa, useHsafaAction, useHsafaComponent, useStreaming, useToggle };
|
|
645
|
+
export { type AgentStreamData, Button, type ButtonProps, type ChatData, type ChatMeta, ContentContainer, type ContentContainerProps, type FirstAgentData, FloatingChatButton, HsafaChat, HsafaProvider, type MainAgentAction, MessageList, type UseToggleReturn, useAgentStreaming, useAutoScroll, useChatStorage, useFileUpload, useHsafa, useHsafaAction, useHsafaComponent, useStreaming, useToggle };
|