@college-africa/chat-ui 1.0.4 → 1.1.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.
@@ -13,9 +13,13 @@ export interface ChatHeaderProps {
13
13
  /** Show join button for admins not in group */
14
14
  showJoinButton?: boolean;
15
15
  /** Join button click handler */
16
- onJoin?: () => void;
16
+ onJoin: (role?: "member" | "moderator") => void;
17
17
  /** Join button loading state */
18
18
  joining?: boolean;
19
+ /** Role selection for joining group */
20
+ joinRole?: "member" | "moderator";
21
+ /** Join role change handler */
22
+ onJoinRoleChange?: (role: "member" | "moderator") => void;
19
23
  }
20
24
  /**
21
25
  * ChatHeader component
@@ -0,0 +1,9 @@
1
+ import { default as React } from 'react';
2
+ interface CreateGroupDialogProps {
3
+ open: boolean;
4
+ onClose: () => void;
5
+ onSuccess?: () => void;
6
+ orgId: number;
7
+ }
8
+ export declare const CreateGroupDialog: React.FC<CreateGroupDialogProps>;
9
+ export {};
@@ -0,0 +1,15 @@
1
+ import { ReactNode } from 'react';
2
+ import { TextInputProps } from './TextInput';
3
+ export interface SelectOption {
4
+ value: string | number;
5
+ label: string;
6
+ }
7
+ interface SelectInputProps extends TextInputProps {
8
+ multiple?: boolean;
9
+ /** Number of options required to render autocomplete */
10
+ autoCompleteThreshold?: number;
11
+ options?: SelectOption[];
12
+ children?: ReactNode;
13
+ }
14
+ declare const SelectInput: ({ multiple, slotProps, autoCompleteThreshold, options, children, formik, name, ...props }: SelectInputProps) => import("react/jsx-runtime").JSX.Element;
15
+ export default SelectInput;
@@ -0,0 +1,9 @@
1
+ import { StandardTextFieldProps } from '@mui/material';
2
+ import { FormikProps } from 'formik';
3
+ export interface TextInputProps extends StandardTextFieldProps {
4
+ errorText?: string;
5
+ formik?: FormikProps<any>;
6
+ autoGenerate?: boolean;
7
+ }
8
+ declare const TextInput: ({ helperText, errorText, formik, name, defaultValue, onChange, type, fullWidth, autoGenerate, ...props }: Partial<TextInputProps>) => import("react/jsx-runtime").JSX.Element;
9
+ export default TextInput;
@@ -0,0 +1,15 @@
1
+ import { default as React } from 'react';
2
+ import { User } from 'sdk';
3
+ interface UserAutocompleteProps {
4
+ multiple?: boolean;
5
+ formik?: any;
6
+ name?: string;
7
+ label?: string;
8
+ disabled?: boolean;
9
+ error?: boolean;
10
+ helperText?: string;
11
+ value?: User | User[] | null;
12
+ onChange?: (value: User | User[] | null) => void;
13
+ }
14
+ export declare const UserAutocomplete: React.FC<UserAutocompleteProps>;
15
+ export default UserAutocomplete;
@@ -0,0 +1,34 @@
1
+ import { ReactNode } from 'react';
2
+ import { FormikProps } from 'formik';
3
+ export interface PasswordAdornmentProps {
4
+ showPassword: boolean;
5
+ onToggleVisibility: () => void;
6
+ onGenerate?: () => void;
7
+ }
8
+ export interface UsePasswordOptions {
9
+ type?: string;
10
+ autoGenerate?: boolean;
11
+ formik?: FormikProps<any>;
12
+ name?: string;
13
+ }
14
+ /**
15
+ * Generates a cryptographically secure random password
16
+ * @param length - Length of the password (default: 16)
17
+ * @returns Generated password string
18
+ */
19
+ export declare const generatePassword: (length?: number) => string;
20
+ /**
21
+ * Creates the end adornment for password input fields with visibility toggle
22
+ * and optional password generation button
23
+ */
24
+ export declare const createPasswordAdornment: ({ showPassword, onToggleVisibility, onGenerate }: PasswordAdornmentProps) => ReactNode;
25
+ /**
26
+ * Hook to handle password input logic including visibility toggle,
27
+ * password generation, and input type management
28
+ */
29
+ export declare const usePassword: ({ type, autoGenerate, formik, name }: UsePasswordOptions) => {
30
+ inputType: string | undefined;
31
+ inputProps: {
32
+ endAdornment?: ReactNode;
33
+ };
34
+ };
package/dist/index.d.ts CHANGED
@@ -14,6 +14,7 @@ export { ConversationList } from './components/ConversationList';
14
14
  export type { ConversationListProps } from './components/ConversationList';
15
15
  export { ConversationItem } from './components/ConversationItem';
16
16
  export type { ConversationItemProps } from './components/ConversationItem';
17
+ export { CreateGroupDialog } from './components/CreateGroupDialog';
17
18
  export { MessageList } from './components/MessageList';
18
19
  export type { MessageListProps } from './components/MessageList';
19
20
  export { MessageBubble } from './components/MessageBubble';
@@ -39,4 +40,4 @@ export type { UseWebSocketMessagesParams } from './hooks/useWebSocketMessages';
39
40
  export { useSenderNames } from './hooks/useSenderNames';
40
41
  export { CACHE_TTL } from './hooks/constants';
41
42
  export type { User, Message, Group, ConversationSummary, ChatRole, Cursor, MessagePage, ConnectionState, Conversation } from './types';
42
- export { theme } from './utils/theme';
43
+ export { theme, getTheme } from './utils/theme';