@app-studio/web 0.9.81 → 0.9.83

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.
Files changed (33) hide show
  1. package/dist/components/ChatWidget/ChatWidget/ChatWidget.props.d.ts +58 -0
  2. package/dist/components/ChatWidget/ChatWidget/ChatWidget.state.d.ts +12 -0
  3. package/dist/components/ChatWidget/ChatWidget/ChatWidget.style.d.ts +87 -0
  4. package/dist/components/ChatWidget/ChatWidget/ChatWidget.type.d.ts +54 -0
  5. package/dist/components/ChatWidget/ChatWidget/ChatWidget.view.d.ts +8 -0
  6. package/dist/components/ChatWidget/ChatWidget.d.ts +20 -0
  7. package/dist/components/ChatWidget/Widget/ChatWidgetWidget.d.ts +14 -0
  8. package/dist/components/ChatWidget/Widget/index.d.ts +2 -0
  9. package/dist/components/ChatWidget/Widget/useContextSelector.d.ts +22 -0
  10. package/dist/components/EditComponent/EditComponent.d.ts +14 -0
  11. package/dist/components/EditComponent/EditPanel.d.ts +7 -0
  12. package/dist/components/EditComponent/EditToolbar.d.ts +16 -0
  13. package/dist/components/EditComponent/index.d.ts +3 -0
  14. package/dist/components/Form/Password/Password/Password.state.d.ts +1 -1
  15. package/dist/components/Icon/Icon.d.ts +4 -0
  16. package/dist/components/Tabs/Tabs/Tabs.props.d.ts +1 -1
  17. package/dist/components/Tabs/Tabs/Tabs.state.d.ts +2 -3
  18. package/dist/components/index.d.ts +3 -0
  19. package/dist/pages/chatwidget.page.d.ts +3 -0
  20. package/dist/pages/editComponent.page.d.ts +3 -0
  21. package/dist/web.cjs.development.js +953 -28
  22. package/dist/web.cjs.development.js.map +1 -1
  23. package/dist/web.cjs.production.min.js +1 -1
  24. package/dist/web.cjs.production.min.js.map +1 -1
  25. package/dist/web.esm.js +950 -29
  26. package/dist/web.esm.js.map +1 -1
  27. package/dist/web.umd.development.js +953 -28
  28. package/dist/web.umd.development.js.map +1 -1
  29. package/dist/web.umd.production.min.js +1 -1
  30. package/dist/web.umd.production.min.js.map +1 -1
  31. package/docs/components/ChatWidget.mdx +106 -0
  32. package/docs/components/EditComponent.mdx +76 -0
  33. package/package.json +1 -1
@@ -0,0 +1,58 @@
1
+ /// <reference types="react" />
2
+ import type { ViewProps } from 'app-studio';
3
+ import type { Variant, Size, Message, ChatWidgetStyles } from './ChatWidget.type';
4
+ /** Props for the ChatWidget component */
5
+ export interface ChatWidgetProps extends Omit<ViewProps, 'size'> {
6
+ /** Array of messages to display */
7
+ messages?: Message[];
8
+ /** Current input value (for controlled component) */
9
+ inputValue?: string;
10
+ /** Callback when input value changes */
11
+ onInputChange?: (value: string) => void;
12
+ /** Callback when a message is submitted */
13
+ onSubmit?: (message: string) => void;
14
+ /** Placeholder text for the input field */
15
+ inputPlaceholder?: string;
16
+ /** Disable the input field */
17
+ disableInput?: boolean;
18
+ /** Visual variant of the component */
19
+ variant?: Variant;
20
+ /** Size of the component */
21
+ size?: Size;
22
+ /** Show timestamps on messages */
23
+ showTimestamps?: boolean;
24
+ /** Enable attachment button (visual only) */
25
+ enableAttachments?: boolean;
26
+ /** Enable context picker button */
27
+ enableContextPicker?: boolean;
28
+ /** Selected context elements to display in input area */
29
+ selectedContextElements?: Array<{
30
+ id: string;
31
+ name: string;
32
+ }>;
33
+ /** Callback when context picker is requested */
34
+ onContextPickerClick?: () => void;
35
+ /** Callback when a context element is removed from input */
36
+ onRemoveContextElement?: (id: string) => void;
37
+ /** Loading state */
38
+ isLoading?: boolean;
39
+ /** Loading text to display */
40
+ loadingText?: string;
41
+ /** Custom styles for different parts of the component */
42
+ styles?: ChatWidgetStyles;
43
+ /** Maximum height for the messages container */
44
+ maxHeight?: string | number;
45
+ }
46
+ /** Props for the ChatWidget view component (includes state) */
47
+ export interface ChatWidgetViewProps extends ChatWidgetProps {
48
+ /** Internal input value from state */
49
+ internalInputValue: string;
50
+ /** Handler for input changes */
51
+ handleInputChange: (value: string) => void;
52
+ /** Handler for message submission */
53
+ handleSubmit: (e?: React.FormEvent) => void;
54
+ /** Ref for the input element */
55
+ inputRef: React.RefObject<HTMLTextAreaElement>;
56
+ /** Ref for the messages container */
57
+ messagesRef: React.RefObject<HTMLDivElement>;
58
+ }
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import type { ChatWidgetProps } from './ChatWidget.props';
3
+ /**
4
+ * Custom hook for managing ChatWidget component state
5
+ */
6
+ export declare function useChatWidgetState(props: ChatWidgetProps): {
7
+ internalInputValue: string;
8
+ handleInputChange: (value: string) => void;
9
+ handleSubmit: (e?: import("react").FormEvent<Element> | undefined) => void;
10
+ inputRef: import("react").RefObject<HTMLTextAreaElement>;
11
+ messagesRef: import("react").RefObject<HTMLDivElement>;
12
+ };
@@ -0,0 +1,87 @@
1
+ import type { CSSProperties } from 'react';
2
+ import type { Variant, Size } from './ChatWidget.type';
3
+ /** Size mappings for the ChatWidget component */
4
+ export declare const Sizes: Record<Size, CSSProperties>;
5
+ /** Variant mappings for the ChatWidget component */
6
+ export declare const Variants: Record<Variant, CSSProperties>;
7
+ /** Bubble size mappings */
8
+ export declare const BubbleSizes: Record<Size, CSSProperties>;
9
+ /** User bubble styles (blue, aligned right) */
10
+ export declare const UserBubbleStyles: CSSProperties;
11
+ /** Assistant bubble styles (gray, aligned left) */
12
+ export declare const AssistantBubbleStyles: CSSProperties;
13
+ /** Input container styles with glassmorphic effect */
14
+ export declare const InputContainerStyles: CSSProperties;
15
+ /** Default ChatWidget component styles */
16
+ export declare const DefaultChatWidgetStyles: {
17
+ container: {
18
+ display: string;
19
+ flexDirection: "column";
20
+ width: string;
21
+ height: string;
22
+ overflow: string;
23
+ };
24
+ messagesContainer: {
25
+ flex: number;
26
+ overflowY: "auto";
27
+ display: string;
28
+ flexDirection: "column";
29
+ gap: string;
30
+ padding: string;
31
+ };
32
+ inputContainer: CSSProperties;
33
+ bubble: {
34
+ maxWidth: string;
35
+ position: "relative";
36
+ wordWrap: "break-word";
37
+ animation: string;
38
+ };
39
+ timestamp: {
40
+ position: "absolute";
41
+ top: string;
42
+ fontSize: string;
43
+ color: string;
44
+ backgroundColor: string;
45
+ padding: string;
46
+ borderRadius: string;
47
+ opacity: number;
48
+ transition: string;
49
+ boxShadow: string;
50
+ };
51
+ input: {
52
+ flex: number;
53
+ border: string;
54
+ outline: string;
55
+ backgroundColor: string;
56
+ resize: "none";
57
+ fontFamily: string;
58
+ fontSize: string;
59
+ minHeight: string;
60
+ maxHeight: string;
61
+ };
62
+ sendButton: {
63
+ width: string;
64
+ height: string;
65
+ borderRadius: string;
66
+ border: string;
67
+ cursor: string;
68
+ display: string;
69
+ alignItems: string;
70
+ justifyContent: string;
71
+ transition: string;
72
+ flexShrink: number;
73
+ };
74
+ attachmentButton: {
75
+ width: string;
76
+ height: string;
77
+ borderRadius: string;
78
+ border: string;
79
+ cursor: string;
80
+ display: string;
81
+ alignItems: string;
82
+ justifyContent: string;
83
+ backgroundColor: string;
84
+ transition: string;
85
+ flexShrink: number;
86
+ };
87
+ };
@@ -0,0 +1,54 @@
1
+ /** Variant types for the ChatWidget component */
2
+ export declare type Variant = 'default' | 'glassy' | 'minimal';
3
+ /** Size options for the ChatWidget component */
4
+ export declare type Size = 'sm' | 'md' | 'lg';
5
+ /** Role of the message sender */
6
+ export declare type MessageRole = 'user' | 'assistant';
7
+ /** Attachment type for messages */
8
+ export interface Attachment {
9
+ id: string;
10
+ name: string;
11
+ size?: number;
12
+ type?: string;
13
+ url?: string;
14
+ }
15
+ /** Context element referenced in chat */
16
+ export interface ContextElement {
17
+ id: string;
18
+ name: string;
19
+ tagName: string;
20
+ rect?: DOMRect;
21
+ }
22
+ export declare type MessageType = 'text' | 'error' | 'system' | 'tool';
23
+ /** Message structure */
24
+ export interface Message {
25
+ id: string;
26
+ role: MessageRole;
27
+ content: string;
28
+ reasoning?: string;
29
+ messageType?: MessageType;
30
+ timestamp: Date;
31
+ attachments?: Attachment[];
32
+ contextElements?: ContextElement[];
33
+ }
34
+ /** Custom styles for different parts of the ChatWidget component */
35
+ export interface ChatWidgetStyles {
36
+ container?: any;
37
+ messagesContainer?: any;
38
+ inputContainer?: any;
39
+ bubble?: any;
40
+ userBubble?: any;
41
+ assistantBubble?: any;
42
+ timestamp?: any;
43
+ input?: any;
44
+ sendButton?: any;
45
+ attachmentButton?: any;
46
+ loadingIndicator?: any;
47
+ contextChipsContainer?: any;
48
+ contextPickerButton?: any;
49
+ reasoningContainer?: any;
50
+ reasoningContent?: any;
51
+ errorMessage?: any;
52
+ systemMessage?: any;
53
+ toolMessage?: any;
54
+ }
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import type { ChatWidgetViewProps } from './ChatWidget.props';
3
+ /**
4
+ * ChatWidget View Component
5
+ * Presentational component for the ChatWidget interface
6
+ */
7
+ declare const ChatWidgetView: React.FC<ChatWidgetViewProps>;
8
+ export default ChatWidgetView;
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import type { ChatWidgetProps } from './ChatWidget/ChatWidget.props';
3
+ /**
4
+ * ChatWidget Component
5
+ *
6
+ * A configurable chat interface component inspired by the ChatWidget toolbar design.
7
+ * This is a UI-only component without backend/LLM connections.
8
+ *
9
+ * @example
10
+ * ```tsx
11
+ * <ChatWidget
12
+ * messages={messages}
13
+ * onSubmit={(message) => console.log(message)}
14
+ * variant="glassy"
15
+ * size="md"
16
+ * />
17
+ * ```
18
+ */
19
+ export declare const ChatWidgetComponent: React.FC<ChatWidgetProps>;
20
+ export declare const ChatWidget: React.FC<ChatWidgetProps>;
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { ContextElement } from './useContextSelector';
3
+ import type { Message } from '../ChatWidget/ChatWidget.type';
4
+ interface ChatWidgetWidgetProps {
5
+ initialMessages?: Message[];
6
+ onSendMessage?: (message: string, contextElements: ContextElement[]) => void;
7
+ bubbleSize?: 'sm' | 'md' | 'lg';
8
+ }
9
+ /**
10
+ * ChatWidget Widget Component
11
+ * A floating chat widget with DOM element selection capabilities.
12
+ */
13
+ export declare const ChatWidgetWidget: React.FC<ChatWidgetWidgetProps>;
14
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from './useContextSelector';
2
+ export * from './ChatWidgetWidget';
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ export interface ContextElement {
3
+ id: string;
4
+ name: string;
5
+ tagName: string;
6
+ rect: DOMRect;
7
+ }
8
+ interface UseContextSelectorProps {
9
+ onSelect: (element: ContextElement) => void;
10
+ onCancel: () => void;
11
+ active: boolean;
12
+ }
13
+ export declare function useContextSelector({ onSelect, onCancel, active, }: UseContextSelectorProps): {
14
+ highlightedElement: ContextElement | null;
15
+ };
16
+ /**
17
+ * Overlay component to render the highlight box
18
+ */
19
+ export declare function ContextOverlay({ element, }: {
20
+ element: ContextElement | null;
21
+ }): React.JSX.Element | null;
22
+ export {};
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { ToolbarItem } from './EditToolbar';
3
+ interface EditComponentProps {
4
+ targetElement: HTMLElement | null;
5
+ defaultToolId?: string;
6
+ onClose?: () => void;
7
+ side?: 'top' | 'bottom' | 'left' | 'right';
8
+ sideOffset?: number;
9
+ variant?: 'floating' | 'overlay';
10
+ items?: ToolbarItem[];
11
+ onToolAction?: (id: string) => void;
12
+ }
13
+ export declare const EditComponent: React.FC<EditComponentProps>;
14
+ export {};
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ interface EditPanelProps {
3
+ onClose?: () => void;
4
+ activeToolId?: string;
5
+ }
6
+ export declare const EditPanel: React.FC<EditPanelProps>;
7
+ export {};
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ export interface ToolbarItem {
3
+ id: string;
4
+ icon: string;
5
+ label?: string;
6
+ special?: boolean;
7
+ actionOnly?: boolean;
8
+ }
9
+ interface EditToolbarProps {
10
+ items: ToolbarItem[];
11
+ activeToolId?: string;
12
+ onSelectTool: (id: string) => void;
13
+ orientation?: 'vertical' | 'horizontal';
14
+ }
15
+ export declare const EditToolbar: React.FC<EditToolbarProps>;
16
+ export {};
@@ -0,0 +1,3 @@
1
+ export * from './EditComponent';
2
+ export * from './EditToolbar';
3
+ export * from './EditPanel';
@@ -30,7 +30,7 @@ export declare const usePasswordState: (props: PasswordProps) => {
30
30
  onFocus?: (() => void) | undefined;
31
31
  size?: "xs" | "sm" | "md" | "lg" | "xl" | undefined;
32
32
  shadow?: import("app-studio").Shadow | import("../../../../utils/elevation").Elevation | import("app-studio").ViewProps | undefined;
33
- shape?: "default" | "sharp" | "rounded" | "pillShaped" | undefined;
33
+ shape?: "default" | "square" | "rounded" | "pill" | undefined;
34
34
  views?: import("../../TextField/TextField/TextField.type").TextFieldStyles | undefined;
35
35
  variant?: "outline" | "default" | "none" | undefined;
36
36
  isVisible: boolean;
@@ -387,3 +387,7 @@ export declare const DragHandleLinesIcon: {
387
387
  (props: IconProps): React.JSX.Element;
388
388
  displayName: string;
389
389
  };
390
+ export declare const MousePointerIcon: {
391
+ (props: IconProps): React.JSX.Element;
392
+ displayName: string;
393
+ };
@@ -28,7 +28,7 @@ export interface TabsProps {
28
28
  */
29
29
  renderContent?: (activeTab: Tab) => React.ReactNode;
30
30
  /** Current value for controlled compound component pattern */
31
- value?: string;
31
+ value?: string | number;
32
32
  /** Callback when tab value changes in compound component pattern */
33
33
  onValueChange?: (value: any) => void;
34
34
  /** Children for compound component pattern */
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { Tab } from './Tabs.type';
3
2
  /**
4
3
  * Custom hook to manage the state of the active tab.
@@ -6,9 +5,9 @@ import { Tab } from './Tabs.type';
6
5
  * @param defaultValue - The optional title of the tab to be initially active.
7
6
  * @returns An object containing the current activeTab and a function to update it.
8
7
  */
9
- export declare const useTabsState: (propTabs: Tab[], defaultValue?: string | number | undefined) => {
8
+ export declare const useTabsState: (propTabs: Tab[], defaultValue?: string | number | undefined, value?: string | number | undefined) => {
10
9
  activeTab: Tab | undefined;
11
- setActiveTab: import("react").Dispatch<import("react").SetStateAction<Tab | undefined>>;
10
+ setActiveTab: (tab: Tab) => void;
12
11
  };
13
12
  /**
14
13
  * Custom hook to manage the state for compound component pattern.
@@ -59,6 +59,8 @@ export * from './Command/Command';
59
59
  export * from './Tooltip/Tooltip';
60
60
  export * from './ChatInput/ChatInput';
61
61
  export * from './Background/Background';
62
+ export * from './ChatWidget/ChatWidget';
63
+ export * from './ChatWidget/Widget/ChatWidgetWidget';
62
64
  export * from './Accordion/Accordion/Accordion.props';
63
65
  export * from './Alert/Alert/Alert.props';
64
66
  export * from './AspectRatio/AspectRatio/AspectRatio.props';
@@ -111,3 +113,4 @@ export * from './Command/Command/Command.props';
111
113
  export * from './Tooltip/Tooltip/Tooltip.props';
112
114
  export * from './ChatInput/ChatInput/ChatInput.props';
113
115
  export * from './Background/Background/Background.props';
116
+ export * from './ChatWidget/ChatWidget/ChatWidget.props';
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ export declare function ChatWidgetPage(): React.JSX.Element;
3
+ export default ChatWidgetPage;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ export declare const EditComponentPage: () => React.JSX.Element;
3
+ export default EditComponentPage;