ptechcore_ui 1.0.3 → 1.0.5
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 +375 -170
- package/dist/index.d.cts +104 -1
- package/dist/index.d.ts +104 -1
- package/dist/index.js +362 -166
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -9,6 +9,63 @@ interface PrimaryButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElemen
|
|
|
9
9
|
declare const PrimaryButton: React.FC<PrimaryButtonProps>;
|
|
10
10
|
declare const SecondaryButton: React.FC<PrimaryButtonProps>;
|
|
11
11
|
|
|
12
|
+
interface ModalProps {
|
|
13
|
+
title: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
width?: string;
|
|
16
|
+
open: boolean;
|
|
17
|
+
onClose: () => void;
|
|
18
|
+
children: React.ReactNode;
|
|
19
|
+
}
|
|
20
|
+
declare const Modal: React.FC<ModalProps>;
|
|
21
|
+
|
|
22
|
+
type InputProps = {
|
|
23
|
+
label?: string;
|
|
24
|
+
name: string;
|
|
25
|
+
type?: string;
|
|
26
|
+
value: string | number;
|
|
27
|
+
placeholder?: string;
|
|
28
|
+
required?: boolean;
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
error?: string;
|
|
31
|
+
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
32
|
+
onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
33
|
+
};
|
|
34
|
+
declare const InputField: React.FC<InputProps>;
|
|
35
|
+
type TextInputProps = Omit<InputProps, "type">;
|
|
36
|
+
declare const TextInput: React.FC<TextInputProps>;
|
|
37
|
+
declare const NumberInput: React.FC<TextInputProps>;
|
|
38
|
+
declare const DateInput: React.FC<TextInputProps>;
|
|
39
|
+
type Option = {
|
|
40
|
+
label: string;
|
|
41
|
+
value: string | number;
|
|
42
|
+
};
|
|
43
|
+
type SelectInputProps = {
|
|
44
|
+
label?: string;
|
|
45
|
+
name: string;
|
|
46
|
+
value: string | number;
|
|
47
|
+
options: Option[];
|
|
48
|
+
defaultValue?: string | number;
|
|
49
|
+
required?: boolean;
|
|
50
|
+
disabled?: boolean;
|
|
51
|
+
error?: string;
|
|
52
|
+
className?: string;
|
|
53
|
+
onChange: (e: React.ChangeEvent<HTMLSelectElement>) => void;
|
|
54
|
+
onBlur?: (e: React.FocusEvent<HTMLSelectElement>) => void;
|
|
55
|
+
};
|
|
56
|
+
declare const SelectInput: React.FC<SelectInputProps>;
|
|
57
|
+
type FileInputProps = {
|
|
58
|
+
label?: string;
|
|
59
|
+
name: string;
|
|
60
|
+
file?: string | File;
|
|
61
|
+
required?: boolean;
|
|
62
|
+
disabled?: boolean;
|
|
63
|
+
readOnly?: boolean;
|
|
64
|
+
error?: string;
|
|
65
|
+
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
66
|
+
};
|
|
67
|
+
declare const FileInput: React.FC<FileInputProps>;
|
|
68
|
+
|
|
12
69
|
interface MenuItem {
|
|
13
70
|
id: string;
|
|
14
71
|
label: string;
|
|
@@ -29,6 +86,36 @@ declare const RewiseLayout: React.FC<PrivateLayoutProps>;
|
|
|
29
86
|
|
|
30
87
|
declare const ToastContainer: React.FC;
|
|
31
88
|
|
|
89
|
+
interface User {
|
|
90
|
+
id: number;
|
|
91
|
+
last_login: string | null;
|
|
92
|
+
is_superuser: boolean;
|
|
93
|
+
username: string;
|
|
94
|
+
first_name: string;
|
|
95
|
+
last_name: string;
|
|
96
|
+
email: string;
|
|
97
|
+
is_staff: boolean;
|
|
98
|
+
is_active: boolean;
|
|
99
|
+
date_joined: string;
|
|
100
|
+
is_deleted: boolean;
|
|
101
|
+
deleted_at: string | null;
|
|
102
|
+
phonenumber: string | null;
|
|
103
|
+
groups: any[];
|
|
104
|
+
user_permissions: any[];
|
|
105
|
+
centers_access?: Array<{
|
|
106
|
+
id: number;
|
|
107
|
+
permissions?: number[];
|
|
108
|
+
}>;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
interface SessionContextType {
|
|
112
|
+
isAuthenticated: boolean;
|
|
113
|
+
token: string | null;
|
|
114
|
+
loggedUser: User | null;
|
|
115
|
+
login: (token: string) => void;
|
|
116
|
+
logout: () => void;
|
|
117
|
+
}
|
|
118
|
+
declare const useSession: () => SessionContextType;
|
|
32
119
|
declare const SessionProvider: ({ children }: {
|
|
33
120
|
children: ReactNode;
|
|
34
121
|
}) => react_jsx_runtime.JSX.Element;
|
|
@@ -38,6 +125,22 @@ interface ThemeProviderProps {
|
|
|
38
125
|
}
|
|
39
126
|
declare const ThemeProvider: React.FC<ThemeProviderProps>;
|
|
40
127
|
|
|
128
|
+
interface Toast {
|
|
129
|
+
id: string;
|
|
130
|
+
message: string;
|
|
131
|
+
type: 'success' | 'error' | 'warning' | 'info';
|
|
132
|
+
duration?: number;
|
|
133
|
+
}
|
|
134
|
+
interface ToastContextType {
|
|
135
|
+
toasts: Toast[];
|
|
136
|
+
addToast: (toast: Omit<Toast, 'id'>) => void;
|
|
137
|
+
removeToast: (id: string) => void;
|
|
138
|
+
success: (message: string, duration?: number) => void;
|
|
139
|
+
error: (message: string, duration?: number) => void;
|
|
140
|
+
warning: (message: string, duration?: number) => void;
|
|
141
|
+
info: (message: string, duration?: number) => void;
|
|
142
|
+
}
|
|
143
|
+
declare const useToast: () => ToastContextType;
|
|
41
144
|
interface ToastProviderProps {
|
|
42
145
|
children: ReactNode;
|
|
43
146
|
}
|
|
@@ -59,4 +162,4 @@ interface PagesProps {
|
|
|
59
162
|
}
|
|
60
163
|
declare const Pages: React.FC<PagesProps>;
|
|
61
164
|
|
|
62
|
-
export { type MenuItem, Pages, PrimaryButton, RewiseLayout, SecondaryButton, SessionProvider, ThemeProvider, ToastContainer, ToastProvider };
|
|
165
|
+
export { DateInput, FileInput, InputField, type MenuItem, Modal, NumberInput, Pages, PrimaryButton, RewiseLayout, SecondaryButton, SelectInput, SessionProvider, TextInput, ThemeProvider, ToastContainer, ToastProvider, useSession, useToast };
|
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,63 @@ interface PrimaryButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElemen
|
|
|
9
9
|
declare const PrimaryButton: React.FC<PrimaryButtonProps>;
|
|
10
10
|
declare const SecondaryButton: React.FC<PrimaryButtonProps>;
|
|
11
11
|
|
|
12
|
+
interface ModalProps {
|
|
13
|
+
title: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
width?: string;
|
|
16
|
+
open: boolean;
|
|
17
|
+
onClose: () => void;
|
|
18
|
+
children: React.ReactNode;
|
|
19
|
+
}
|
|
20
|
+
declare const Modal: React.FC<ModalProps>;
|
|
21
|
+
|
|
22
|
+
type InputProps = {
|
|
23
|
+
label?: string;
|
|
24
|
+
name: string;
|
|
25
|
+
type?: string;
|
|
26
|
+
value: string | number;
|
|
27
|
+
placeholder?: string;
|
|
28
|
+
required?: boolean;
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
error?: string;
|
|
31
|
+
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
32
|
+
onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
33
|
+
};
|
|
34
|
+
declare const InputField: React.FC<InputProps>;
|
|
35
|
+
type TextInputProps = Omit<InputProps, "type">;
|
|
36
|
+
declare const TextInput: React.FC<TextInputProps>;
|
|
37
|
+
declare const NumberInput: React.FC<TextInputProps>;
|
|
38
|
+
declare const DateInput: React.FC<TextInputProps>;
|
|
39
|
+
type Option = {
|
|
40
|
+
label: string;
|
|
41
|
+
value: string | number;
|
|
42
|
+
};
|
|
43
|
+
type SelectInputProps = {
|
|
44
|
+
label?: string;
|
|
45
|
+
name: string;
|
|
46
|
+
value: string | number;
|
|
47
|
+
options: Option[];
|
|
48
|
+
defaultValue?: string | number;
|
|
49
|
+
required?: boolean;
|
|
50
|
+
disabled?: boolean;
|
|
51
|
+
error?: string;
|
|
52
|
+
className?: string;
|
|
53
|
+
onChange: (e: React.ChangeEvent<HTMLSelectElement>) => void;
|
|
54
|
+
onBlur?: (e: React.FocusEvent<HTMLSelectElement>) => void;
|
|
55
|
+
};
|
|
56
|
+
declare const SelectInput: React.FC<SelectInputProps>;
|
|
57
|
+
type FileInputProps = {
|
|
58
|
+
label?: string;
|
|
59
|
+
name: string;
|
|
60
|
+
file?: string | File;
|
|
61
|
+
required?: boolean;
|
|
62
|
+
disabled?: boolean;
|
|
63
|
+
readOnly?: boolean;
|
|
64
|
+
error?: string;
|
|
65
|
+
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
66
|
+
};
|
|
67
|
+
declare const FileInput: React.FC<FileInputProps>;
|
|
68
|
+
|
|
12
69
|
interface MenuItem {
|
|
13
70
|
id: string;
|
|
14
71
|
label: string;
|
|
@@ -29,6 +86,36 @@ declare const RewiseLayout: React.FC<PrivateLayoutProps>;
|
|
|
29
86
|
|
|
30
87
|
declare const ToastContainer: React.FC;
|
|
31
88
|
|
|
89
|
+
interface User {
|
|
90
|
+
id: number;
|
|
91
|
+
last_login: string | null;
|
|
92
|
+
is_superuser: boolean;
|
|
93
|
+
username: string;
|
|
94
|
+
first_name: string;
|
|
95
|
+
last_name: string;
|
|
96
|
+
email: string;
|
|
97
|
+
is_staff: boolean;
|
|
98
|
+
is_active: boolean;
|
|
99
|
+
date_joined: string;
|
|
100
|
+
is_deleted: boolean;
|
|
101
|
+
deleted_at: string | null;
|
|
102
|
+
phonenumber: string | null;
|
|
103
|
+
groups: any[];
|
|
104
|
+
user_permissions: any[];
|
|
105
|
+
centers_access?: Array<{
|
|
106
|
+
id: number;
|
|
107
|
+
permissions?: number[];
|
|
108
|
+
}>;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
interface SessionContextType {
|
|
112
|
+
isAuthenticated: boolean;
|
|
113
|
+
token: string | null;
|
|
114
|
+
loggedUser: User | null;
|
|
115
|
+
login: (token: string) => void;
|
|
116
|
+
logout: () => void;
|
|
117
|
+
}
|
|
118
|
+
declare const useSession: () => SessionContextType;
|
|
32
119
|
declare const SessionProvider: ({ children }: {
|
|
33
120
|
children: ReactNode;
|
|
34
121
|
}) => react_jsx_runtime.JSX.Element;
|
|
@@ -38,6 +125,22 @@ interface ThemeProviderProps {
|
|
|
38
125
|
}
|
|
39
126
|
declare const ThemeProvider: React.FC<ThemeProviderProps>;
|
|
40
127
|
|
|
128
|
+
interface Toast {
|
|
129
|
+
id: string;
|
|
130
|
+
message: string;
|
|
131
|
+
type: 'success' | 'error' | 'warning' | 'info';
|
|
132
|
+
duration?: number;
|
|
133
|
+
}
|
|
134
|
+
interface ToastContextType {
|
|
135
|
+
toasts: Toast[];
|
|
136
|
+
addToast: (toast: Omit<Toast, 'id'>) => void;
|
|
137
|
+
removeToast: (id: string) => void;
|
|
138
|
+
success: (message: string, duration?: number) => void;
|
|
139
|
+
error: (message: string, duration?: number) => void;
|
|
140
|
+
warning: (message: string, duration?: number) => void;
|
|
141
|
+
info: (message: string, duration?: number) => void;
|
|
142
|
+
}
|
|
143
|
+
declare const useToast: () => ToastContextType;
|
|
41
144
|
interface ToastProviderProps {
|
|
42
145
|
children: ReactNode;
|
|
43
146
|
}
|
|
@@ -59,4 +162,4 @@ interface PagesProps {
|
|
|
59
162
|
}
|
|
60
163
|
declare const Pages: React.FC<PagesProps>;
|
|
61
164
|
|
|
62
|
-
export { type MenuItem, Pages, PrimaryButton, RewiseLayout, SecondaryButton, SessionProvider, ThemeProvider, ToastContainer, ToastProvider };
|
|
165
|
+
export { DateInput, FileInput, InputField, type MenuItem, Modal, NumberInput, Pages, PrimaryButton, RewiseLayout, SecondaryButton, SelectInput, SessionProvider, TextInput, ThemeProvider, ToastContainer, ToastProvider, useSession, useToast };
|