@juspay/blend-design-system 0.0.22 → 0.0.23-beta

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.
@@ -0,0 +1,5 @@
1
+ import { default as React } from 'react';
2
+ import { ChatInputProps, AttachedFile } from './types';
3
+ export declare const getDocIcon: (fileType: AttachedFile["type"]) => React.ReactNode;
4
+ declare const ChatInput: React.ForwardRefExoticComponent<ChatInputProps & React.RefAttributes<HTMLTextAreaElement>>;
5
+ export default ChatInput;
@@ -0,0 +1,147 @@
1
+ import { CSSObject } from 'styled-components';
2
+ import { BreakpointType } from '../../breakpoints/breakPoints';
3
+ import { FoundationTokenType } from '../../tokens/theme.token';
4
+ /**
5
+ * ChatInput Tokens following the pattern: [target].property.[state]
6
+ *
7
+ * Structure:
8
+ * - container: Main chat input container
9
+ * - textarea: Text input area
10
+ * - filesContainer: File attachment display area
11
+ * - bottomActions: Action buttons container
12
+ * - overflowTag: "+X more" files button
13
+ * - topQueries: Top queries section with header and items
14
+ */
15
+ export type ChatInputTokensType = Readonly<{
16
+ container: {
17
+ backgroundColor: {
18
+ default: CSSObject['backgroundColor'];
19
+ hover: CSSObject['backgroundColor'];
20
+ disabled: CSSObject['backgroundColor'];
21
+ };
22
+ border: {
23
+ default: CSSObject['border'];
24
+ focus: CSSObject['border'];
25
+ };
26
+ borderRadius: CSSObject['borderRadius'];
27
+ paddingTop: CSSObject['paddingTop'];
28
+ paddingRight: CSSObject['paddingRight'];
29
+ paddingBottom: CSSObject['paddingBottom'];
30
+ paddingLeft: CSSObject['paddingLeft'];
31
+ gap: CSSObject['gap'];
32
+ minHeight: CSSObject['minHeight'];
33
+ transition: CSSObject['transition'];
34
+ boxShadow: {
35
+ default: CSSObject['boxShadow'];
36
+ hover: CSSObject['boxShadow'];
37
+ focus: CSSObject['boxShadow'];
38
+ };
39
+ };
40
+ attachmentContainer: {
41
+ backgroundColor: CSSObject['backgroundColor'];
42
+ borderRadius: CSSObject['borderRadius'];
43
+ padding: CSSObject['padding'];
44
+ };
45
+ textarea: {
46
+ backgroundColor: CSSObject['backgroundColor'];
47
+ color: CSSObject['color'];
48
+ fontSize: CSSObject['fontSize'];
49
+ lineHeight: CSSObject['lineHeight'];
50
+ paddingX: CSSObject['padding'];
51
+ paddingY: CSSObject['padding'];
52
+ border: CSSObject['border'];
53
+ borderRadius: CSSObject['borderRadius'];
54
+ placeholder: {
55
+ color: CSSObject['color'];
56
+ };
57
+ resize: CSSObject['resize'];
58
+ fontFamily: CSSObject['fontFamily'];
59
+ minHeight: CSSObject['minHeight'];
60
+ maxHeight: CSSObject['maxHeight'];
61
+ overflowY: CSSObject['overflowY'];
62
+ };
63
+ filesContainer: {
64
+ gap: CSSObject['gap'];
65
+ paddingX: CSSObject['padding'];
66
+ paddingY: CSSObject['padding'];
67
+ maxHeight: CSSObject['maxHeight'];
68
+ overflowY: CSSObject['overflowY'];
69
+ };
70
+ bottomActions: {
71
+ paddingX: CSSObject['padding'];
72
+ paddingY: CSSObject['padding'];
73
+ gap: CSSObject['gap'];
74
+ justifyContent: CSSObject['justifyContent'];
75
+ };
76
+ overflowTag: {
77
+ backgroundColor: {
78
+ default: CSSObject['backgroundColor'];
79
+ hover: CSSObject['backgroundColor'];
80
+ active: CSSObject['backgroundColor'];
81
+ };
82
+ color: {
83
+ default: CSSObject['color'];
84
+ hover: CSSObject['color'];
85
+ active: CSSObject['color'];
86
+ };
87
+ border: CSSObject['border'];
88
+ borderRadius: CSSObject['borderRadius'];
89
+ paddingX: CSSObject['padding'];
90
+ paddingY: CSSObject['padding'];
91
+ fontSize: CSSObject['fontSize'];
92
+ fontWeight: CSSObject['fontWeight'];
93
+ gap: CSSObject['gap'];
94
+ transition: CSSObject['transition'];
95
+ cursor: CSSObject['cursor'];
96
+ };
97
+ topQueries: {
98
+ container: {
99
+ borderTop: CSSObject['borderTop'];
100
+ paddingTop: CSSObject['paddingTop'];
101
+ };
102
+ header: {
103
+ color: CSSObject['color'];
104
+ fontSize: CSSObject['fontSize'];
105
+ fontWeight: CSSObject['fontWeight'];
106
+ paddingX: CSSObject['padding'];
107
+ paddingY: CSSObject['padding'];
108
+ textTransform: CSSObject['textTransform'];
109
+ backgroundColor: CSSObject['backgroundColor'];
110
+ flexShrink: CSSObject['flexShrink'];
111
+ };
112
+ scrollContainer: {
113
+ overflowY: CSSObject['overflowY'];
114
+ maxHeightOffset: number;
115
+ };
116
+ item: {
117
+ backgroundColor: {
118
+ default: CSSObject['backgroundColor'];
119
+ hover: CSSObject['backgroundColor'];
120
+ active: CSSObject['backgroundColor'];
121
+ disabled: CSSObject['backgroundColor'];
122
+ };
123
+ color: {
124
+ default: CSSObject['color'];
125
+ hover: CSSObject['color'];
126
+ active: CSSObject['color'];
127
+ disabled: CSSObject['color'];
128
+ };
129
+ fontSize: CSSObject['fontSize'];
130
+ fontWeight: CSSObject['fontWeight'];
131
+ paddingX: CSSObject['padding'];
132
+ paddingY: CSSObject['padding'];
133
+ border: CSSObject['border'];
134
+ transition: CSSObject['transition'];
135
+ cursor: CSSObject['cursor'];
136
+ opacity: {
137
+ default: CSSObject['opacity'];
138
+ disabled: CSSObject['opacity'];
139
+ };
140
+ };
141
+ };
142
+ }>;
143
+ export type ResponsiveChatInputTokensType = {
144
+ [key in keyof BreakpointType]: ChatInputTokensType;
145
+ };
146
+ export declare const getChatInputTokens: (foundationToken: FoundationTokenType) => ResponsiveChatInputTokensType;
147
+ export default getChatInputTokens;
@@ -0,0 +1,2 @@
1
+ export { default as ChatInput } from './ChatInput';
2
+ export * from './types';
@@ -0,0 +1,101 @@
1
+ import { ReactNode } from 'react';
2
+ import { MenuProps } from '../Menu/types';
3
+ export type AttachedFile = {
4
+ id: string;
5
+ name: string;
6
+ type: 'image' | 'pdf' | 'csv' | 'text' | 'other';
7
+ size?: number;
8
+ url?: string;
9
+ preview?: string;
10
+ };
11
+ export type TopQuery = {
12
+ id: string;
13
+ text: string;
14
+ };
15
+ export type ChatInputProps = {
16
+ value?: string;
17
+ onChange?: (value: string) => void;
18
+ onSend?: (message: string, files: AttachedFile[]) => void;
19
+ onAttachFiles?: (files: File[]) => void;
20
+ onVoiceRecord?: () => void;
21
+ onFileRemove?: (fileId: string) => void;
22
+ onFileClick?: (file: AttachedFile) => void;
23
+ placeholder?: string;
24
+ disabled?: boolean;
25
+ maxLength?: number;
26
+ autoResize?: boolean;
27
+ attachedFiles?: AttachedFile[];
28
+ topQueries?: TopQuery[];
29
+ onTopQuerySelect?: (query: TopQuery) => void;
30
+ topQueriesMaxHeight?: number;
31
+ attachButtonIcon?: ReactNode;
32
+ voiceButtonIcon?: ReactNode;
33
+ sendButtonIcon?: ReactNode;
34
+ overflowMenuProps?: Partial<MenuProps>;
35
+ 'aria-label'?: string;
36
+ 'aria-describedby'?: string;
37
+ };
38
+ export type ChatInputTokens = {
39
+ container: {
40
+ backgroundColor: string;
41
+ border: string;
42
+ borderRadius: string;
43
+ padding: string;
44
+ gap: string;
45
+ minHeight: string;
46
+ maxHeight: string;
47
+ };
48
+ textarea: {
49
+ backgroundColor: string;
50
+ color: string;
51
+ fontSize: string;
52
+ lineHeight: string;
53
+ padding: string;
54
+ border: string;
55
+ borderRadius: string;
56
+ placeholder: {
57
+ color: string;
58
+ };
59
+ resize: string;
60
+ fontFamily: string;
61
+ };
62
+ filesContainer: {
63
+ gap: string;
64
+ padding: string;
65
+ maxHeight: string;
66
+ overflowBehavior: string;
67
+ };
68
+ bottomActions: {
69
+ padding: string;
70
+ gap: string;
71
+ justifyContent: string;
72
+ };
73
+ actionButton: {
74
+ size: string;
75
+ padding: string;
76
+ borderRadius: string;
77
+ backgroundColor: {
78
+ default: string;
79
+ hover: string;
80
+ active: string;
81
+ disabled: string;
82
+ };
83
+ color: {
84
+ default: string;
85
+ hover: string;
86
+ active: string;
87
+ disabled: string;
88
+ };
89
+ border: string;
90
+ };
91
+ overflowTag: {
92
+ backgroundColor: string;
93
+ color: string;
94
+ border: string;
95
+ borderRadius: string;
96
+ padding: string;
97
+ fontSize: string;
98
+ fontWeight: string;
99
+ cursor: string;
100
+ };
101
+ };
@@ -0,0 +1,26 @@
1
+ import { AttachedFile } from './types';
2
+ import { MenuItemType } from '../Menu/types';
3
+ /**
4
+ * Determine the file type from a File object
5
+ */
6
+ export declare const getFileType: (file: File) => AttachedFile["type"];
7
+ /**
8
+ * Create menu items for overflow files
9
+ */
10
+ export declare const createOverflowMenuItems: (hiddenFiles: AttachedFile[], onFileRemove: (fileId: string) => void, onFileClick: (file: AttachedFile) => void) => MenuItemType[];
11
+ /**
12
+ * Handle textarea auto-resize functionality
13
+ */
14
+ export declare const handleAutoResize: (element: HTMLTextAreaElement | null, autoResize: boolean) => void;
15
+ /**
16
+ * Check if Enter key should trigger send
17
+ */
18
+ export declare const shouldSendOnEnter: (key: string, shiftKey: boolean, metaKey: boolean, ctrlKey: boolean) => boolean;
19
+ /**
20
+ * Validate message length against maxLength
21
+ */
22
+ export declare const isValidMessageLength: (message: string, maxLength?: number) => boolean;
23
+ /**
24
+ * Convert File objects to AttachedFile objects
25
+ */
26
+ export declare const convertFilesToAttachedFiles: (files: File[]) => AttachedFile[];
@@ -62,6 +62,11 @@ export type SidebarTokenType = {
62
62
  };
63
63
  };
64
64
  };
65
+ directory: {
66
+ gap: CSSObject['gap'];
67
+ paddingX: CSSObject['padding'];
68
+ paddingY: CSSObject['padding'];
69
+ };
65
70
  footer: {
66
71
  backgroundColor: CSSObject['backgroundColor'];
67
72
  padding: {
@@ -1 +1,2 @@
1
1
  export declare const toPixels: (value: string | number | undefined) => number;
2
+ export declare const capitalizeFirstLetter: (string: string) => string;