ptechcore_ui 1.0.13 → 1.0.15

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.d.cts CHANGED
@@ -1,13 +1,14 @@
1
- import React, { ReactNode } from 'react';
1
+ import React$1, { ReactNode } from 'react';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
3
 
4
- interface PrimaryButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
4
+ interface PrimaryButtonProps extends React$1.ButtonHTMLAttributes<HTMLButtonElement> {
5
+ variant?: 'full' | 'outline' | 'text';
5
6
  loading?: boolean;
6
- children?: React.ReactNode;
7
+ children?: React$1.ReactNode;
7
8
  classname?: string;
8
9
  }
9
- declare const PrimaryButton: React.FC<PrimaryButtonProps>;
10
- declare const SecondaryButton: React.FC<PrimaryButtonProps>;
10
+ declare const PrimaryButton: React$1.FC<PrimaryButtonProps>;
11
+ declare const SecondaryButton: React$1.FC<PrimaryButtonProps>;
11
12
 
12
13
  interface ModalProps {
13
14
  title: string;
@@ -15,9 +16,9 @@ interface ModalProps {
15
16
  width?: string;
16
17
  open: boolean;
17
18
  onClose: () => void;
18
- children: React.ReactNode;
19
+ children: React$1.ReactNode;
19
20
  }
20
- declare const Modal: React.FC<ModalProps>;
21
+ declare const Modal: React$1.FC<ModalProps>;
21
22
 
22
23
  type InputProps = {
23
24
  label?: string;
@@ -28,14 +29,14 @@ type InputProps = {
28
29
  required?: boolean;
29
30
  disabled?: boolean;
30
31
  error?: string;
31
- onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
32
- onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;
32
+ onChange: (e: React$1.ChangeEvent<HTMLInputElement>) => void;
33
+ onBlur?: (e: React$1.FocusEvent<HTMLInputElement>) => void;
33
34
  };
34
- declare const InputField: React.FC<InputProps>;
35
+ declare const InputField: React$1.FC<InputProps>;
35
36
  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>;
37
+ declare const TextInput: React$1.FC<TextInputProps>;
38
+ declare const NumberInput: React$1.FC<TextInputProps>;
39
+ declare const DateInput: React$1.FC<TextInputProps>;
39
40
  type Option = {
40
41
  label: string;
41
42
  value: string | number;
@@ -50,10 +51,10 @@ type SelectInputProps = {
50
51
  disabled?: boolean;
51
52
  error?: string;
52
53
  className?: string;
53
- onChange: (e: React.ChangeEvent<HTMLSelectElement>) => void;
54
- onBlur?: (e: React.FocusEvent<HTMLSelectElement>) => void;
54
+ onChange: (e: React$1.ChangeEvent<HTMLSelectElement>) => void;
55
+ onBlur?: (e: React$1.FocusEvent<HTMLSelectElement>) => void;
55
56
  };
56
- declare const SelectInput: React.FC<SelectInputProps>;
57
+ declare const SelectInput: React$1.FC<SelectInputProps>;
57
58
  type FileInputProps = {
58
59
  label?: string;
59
60
  name: string;
@@ -62,29 +63,29 @@ type FileInputProps = {
62
63
  disabled?: boolean;
63
64
  readOnly?: boolean;
64
65
  error?: string;
65
- onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
66
+ onChange: (e: React$1.ChangeEvent<HTMLInputElement>) => void;
66
67
  };
67
- declare const FileInput: React.FC<FileInputProps>;
68
+ declare const FileInput: React$1.FC<FileInputProps>;
68
69
 
69
70
  interface MenuItem {
70
71
  id: string;
71
72
  label: string;
72
- icon: React.ReactNode;
73
+ icon: React$1.ReactNode;
73
74
  path?: string;
74
75
  badge?: string | number;
75
76
  submenu?: MenuItem[];
76
77
  ariaLabel?: string;
77
78
  }
78
79
  interface PrivateLayoutProps {
79
- children: React.ReactNode;
80
+ children: React$1.ReactNode;
80
81
  module_name: string;
81
82
  module_description?: string;
82
83
  primaryMenuItems: MenuItem[];
83
84
  secondaryMenuItems: Record<string, MenuItem[]>;
84
85
  }
85
- declare const RewiseLayout: React.FC<PrivateLayoutProps>;
86
+ declare const RewiseLayout: React$1.FC<PrivateLayoutProps>;
86
87
 
87
- declare const ToastContainer: React.FC;
88
+ declare const ToastContainer: React$1.FC;
88
89
 
89
90
  interface Entity {
90
91
  id: number;
@@ -152,9 +153,9 @@ declare const SessionProvider: ({ children }: {
152
153
  }) => react_jsx_runtime.JSX.Element;
153
154
 
154
155
  interface ThemeProviderProps {
155
- children: React.ReactNode;
156
+ children: React$1.ReactNode;
156
157
  }
157
- declare const ThemeProvider: React.FC<ThemeProviderProps>;
158
+ declare const ThemeProvider: React$1.FC<ThemeProviderProps>;
158
159
 
159
160
  interface Toast {
160
161
  id: string;
@@ -175,17 +176,17 @@ declare const useToast: () => ToastContextType;
175
176
  interface ToastProviderProps {
176
177
  children: ReactNode;
177
178
  }
178
- declare const ToastProvider: React.FC<ToastProviderProps>;
179
+ declare const ToastProvider: React$1.FC<ToastProviderProps>;
179
180
 
180
181
  interface PagesProps {
181
182
  title?: string;
182
183
  description?: string;
183
- sideAction?: React.ReactNode;
184
- sidebar?: React.ReactNode;
185
- tabs: React.ReactNode;
186
- children?: React.ReactNode;
184
+ sideAction?: React$1.ReactNode;
185
+ sidebar?: React$1.ReactNode;
186
+ tabs?: React$1.ReactNode;
187
+ children?: React$1.ReactNode;
187
188
  }
188
- declare const Pages: React.FC<PagesProps>;
189
+ declare const Pages: React$1.FC<PagesProps>;
189
190
 
190
191
  declare const UserServices: {
191
192
  addUser: (data: Partial<User>, token: string) => Promise<unknown>;
@@ -220,22 +221,25 @@ type FDrawerLineAction = {
220
221
  onclick?: (item: any) => any;
221
222
  };
222
223
  interface FDrawerProps {
223
- children?: React.ReactNode;
224
+ children?: React$1.ReactNode;
224
225
  apiEndpoint: string;
225
226
  columns: FDrawerColumn[];
226
227
  actions: FDrawerLineAction[];
227
228
  ordering: string;
228
229
  toggle?: boolean;
229
230
  }
230
- declare const FDrawer: React.FC<FDrawerProps>;
231
+ declare const FDrawer: React$1.FC<FDrawerProps>;
231
232
 
232
233
  interface ApprovalWorkflowProps {
233
234
  process: number;
234
235
  object_id: number;
235
236
  title?: string;
236
237
  readOnly?: boolean;
238
+ CustomBtn?: React$1.ComponentType<{
239
+ onClick?: () => void;
240
+ }>;
237
241
  }
238
- declare const ApprovalWorkflow: React.FC<ApprovalWorkflowProps>;
242
+ declare const ApprovalWorkflow: React$1.FC<ApprovalWorkflowProps>;
239
243
 
240
244
  declare enum ApprovalStatus {
241
245
  CANCEL = "cancel",
@@ -292,12 +296,66 @@ interface ApprovalAnswerModalProps {
292
296
  link_token?: string;
293
297
  object_detail: ApprovalCase;
294
298
  }
295
- declare const ApprovalAnswerModal: React.FC<ApprovalAnswerModalProps>;
296
- declare const ApprovalAnswerPage: React.FC;
297
- declare const ApprovalPreviewAnswer: React.FC<{
299
+ declare const ApprovalAnswerModal: React$1.FC<ApprovalAnswerModalProps>;
300
+ declare const ApprovalAnswerPage: React$1.FC;
301
+ declare const ApprovalPreviewAnswer: React$1.FC<{
298
302
  loadCase: () => void;
299
303
  answerId: number | null;
300
304
  caseData: ApprovalCase | null;
301
305
  }>;
302
306
 
303
- export { ApprovalAnswerModal, ApprovalAnswerPage, ApprovalPreviewAnswer, ApprovalWorkflow, DateInput, FDrawer, FileInput, InputField, type MenuItem, Modal, NumberInput, Pages, PrimaryButton, RewiseLayout, SecondaryButton, SelectInput, SessionProvider, TextInput, ThemeProvider, ToastContainer, ToastProvider, type User, UserServices, useSession, useToast };
307
+ declare class FetchApi {
308
+ static post<T>(url: string, payload?: any, token?: string): Promise<T>;
309
+ static get<T>(url: string, token?: string): Promise<T>;
310
+ static put<T>(url: string, payload?: any, token?: string): Promise<T>;
311
+ static delete<T>(url: string, token?: string): Promise<T>;
312
+ }
313
+
314
+ type AlertVariant = 'danger' | 'warning' | 'info' | 'success';
315
+ interface AlertProps {
316
+ title: string;
317
+ description?: string;
318
+ variant?: AlertVariant;
319
+ open: boolean;
320
+ onConfirm: () => void;
321
+ onCancel: () => void;
322
+ confirmText?: string;
323
+ cancelText?: string;
324
+ confirmButtonVariant?: 'danger' | 'primary' | 'success';
325
+ }
326
+ declare const Alert: React$1.FC<AlertProps>;
327
+
328
+ interface AlertOptions {
329
+ title: string;
330
+ description?: string;
331
+ variant?: AlertVariant;
332
+ confirmText?: string;
333
+ cancelText?: string;
334
+ confirmButtonVariant?: 'danger' | 'primary' | 'success';
335
+ }
336
+ interface AlertContextType {
337
+ showConfirmation: (options: AlertOptions) => Promise<boolean>;
338
+ showAlert: (title: string, confirmText?: string, cancelText?: string, description?: string, variant?: AlertVariant) => Promise<boolean>;
339
+ }
340
+ declare const AlertProvider: React$1.FC<{
341
+ children: ReactNode;
342
+ }>;
343
+ declare const useAlert: () => AlertContextType;
344
+
345
+ interface SearchableSelectOption {
346
+ value: string | number;
347
+ label: string;
348
+ content?: React$1.ReactNode;
349
+ image?: string;
350
+ }
351
+
352
+ interface SelectProps {
353
+ value?: any;
354
+ onSelect: (option: SearchableSelectOption) => void;
355
+ }
356
+ declare const SelectVendor: React.FC<SelectProps>;
357
+ declare const SelectUser: React.FC<SelectProps>;
358
+ declare const SelectDepartment: React.FC<SelectProps>;
359
+ declare const SelectCostCenter: React.FC<SelectProps>;
360
+
361
+ export { Alert, AlertProvider, ApprovalAnswerModal, ApprovalAnswerPage, ApprovalPreviewAnswer, ApprovalWorkflow, DateInput, FDrawer, FetchApi, FileInput, InputField, type MenuItem, Modal, NumberInput, Pages, PrimaryButton, RewiseLayout, SecondaryButton, SelectCostCenter, SelectDepartment, SelectInput, SelectUser, SelectVendor, SessionProvider, TextInput, ThemeProvider, ToastContainer, ToastProvider, type User, UserServices, useAlert, useSession, useToast };
package/dist/index.d.ts CHANGED
@@ -1,13 +1,14 @@
1
- import React, { ReactNode } from 'react';
1
+ import React$1, { ReactNode } from 'react';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
3
 
4
- interface PrimaryButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
4
+ interface PrimaryButtonProps extends React$1.ButtonHTMLAttributes<HTMLButtonElement> {
5
+ variant?: 'full' | 'outline' | 'text';
5
6
  loading?: boolean;
6
- children?: React.ReactNode;
7
+ children?: React$1.ReactNode;
7
8
  classname?: string;
8
9
  }
9
- declare const PrimaryButton: React.FC<PrimaryButtonProps>;
10
- declare const SecondaryButton: React.FC<PrimaryButtonProps>;
10
+ declare const PrimaryButton: React$1.FC<PrimaryButtonProps>;
11
+ declare const SecondaryButton: React$1.FC<PrimaryButtonProps>;
11
12
 
12
13
  interface ModalProps {
13
14
  title: string;
@@ -15,9 +16,9 @@ interface ModalProps {
15
16
  width?: string;
16
17
  open: boolean;
17
18
  onClose: () => void;
18
- children: React.ReactNode;
19
+ children: React$1.ReactNode;
19
20
  }
20
- declare const Modal: React.FC<ModalProps>;
21
+ declare const Modal: React$1.FC<ModalProps>;
21
22
 
22
23
  type InputProps = {
23
24
  label?: string;
@@ -28,14 +29,14 @@ type InputProps = {
28
29
  required?: boolean;
29
30
  disabled?: boolean;
30
31
  error?: string;
31
- onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
32
- onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;
32
+ onChange: (e: React$1.ChangeEvent<HTMLInputElement>) => void;
33
+ onBlur?: (e: React$1.FocusEvent<HTMLInputElement>) => void;
33
34
  };
34
- declare const InputField: React.FC<InputProps>;
35
+ declare const InputField: React$1.FC<InputProps>;
35
36
  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>;
37
+ declare const TextInput: React$1.FC<TextInputProps>;
38
+ declare const NumberInput: React$1.FC<TextInputProps>;
39
+ declare const DateInput: React$1.FC<TextInputProps>;
39
40
  type Option = {
40
41
  label: string;
41
42
  value: string | number;
@@ -50,10 +51,10 @@ type SelectInputProps = {
50
51
  disabled?: boolean;
51
52
  error?: string;
52
53
  className?: string;
53
- onChange: (e: React.ChangeEvent<HTMLSelectElement>) => void;
54
- onBlur?: (e: React.FocusEvent<HTMLSelectElement>) => void;
54
+ onChange: (e: React$1.ChangeEvent<HTMLSelectElement>) => void;
55
+ onBlur?: (e: React$1.FocusEvent<HTMLSelectElement>) => void;
55
56
  };
56
- declare const SelectInput: React.FC<SelectInputProps>;
57
+ declare const SelectInput: React$1.FC<SelectInputProps>;
57
58
  type FileInputProps = {
58
59
  label?: string;
59
60
  name: string;
@@ -62,29 +63,29 @@ type FileInputProps = {
62
63
  disabled?: boolean;
63
64
  readOnly?: boolean;
64
65
  error?: string;
65
- onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
66
+ onChange: (e: React$1.ChangeEvent<HTMLInputElement>) => void;
66
67
  };
67
- declare const FileInput: React.FC<FileInputProps>;
68
+ declare const FileInput: React$1.FC<FileInputProps>;
68
69
 
69
70
  interface MenuItem {
70
71
  id: string;
71
72
  label: string;
72
- icon: React.ReactNode;
73
+ icon: React$1.ReactNode;
73
74
  path?: string;
74
75
  badge?: string | number;
75
76
  submenu?: MenuItem[];
76
77
  ariaLabel?: string;
77
78
  }
78
79
  interface PrivateLayoutProps {
79
- children: React.ReactNode;
80
+ children: React$1.ReactNode;
80
81
  module_name: string;
81
82
  module_description?: string;
82
83
  primaryMenuItems: MenuItem[];
83
84
  secondaryMenuItems: Record<string, MenuItem[]>;
84
85
  }
85
- declare const RewiseLayout: React.FC<PrivateLayoutProps>;
86
+ declare const RewiseLayout: React$1.FC<PrivateLayoutProps>;
86
87
 
87
- declare const ToastContainer: React.FC;
88
+ declare const ToastContainer: React$1.FC;
88
89
 
89
90
  interface Entity {
90
91
  id: number;
@@ -152,9 +153,9 @@ declare const SessionProvider: ({ children }: {
152
153
  }) => react_jsx_runtime.JSX.Element;
153
154
 
154
155
  interface ThemeProviderProps {
155
- children: React.ReactNode;
156
+ children: React$1.ReactNode;
156
157
  }
157
- declare const ThemeProvider: React.FC<ThemeProviderProps>;
158
+ declare const ThemeProvider: React$1.FC<ThemeProviderProps>;
158
159
 
159
160
  interface Toast {
160
161
  id: string;
@@ -175,17 +176,17 @@ declare const useToast: () => ToastContextType;
175
176
  interface ToastProviderProps {
176
177
  children: ReactNode;
177
178
  }
178
- declare const ToastProvider: React.FC<ToastProviderProps>;
179
+ declare const ToastProvider: React$1.FC<ToastProviderProps>;
179
180
 
180
181
  interface PagesProps {
181
182
  title?: string;
182
183
  description?: string;
183
- sideAction?: React.ReactNode;
184
- sidebar?: React.ReactNode;
185
- tabs: React.ReactNode;
186
- children?: React.ReactNode;
184
+ sideAction?: React$1.ReactNode;
185
+ sidebar?: React$1.ReactNode;
186
+ tabs?: React$1.ReactNode;
187
+ children?: React$1.ReactNode;
187
188
  }
188
- declare const Pages: React.FC<PagesProps>;
189
+ declare const Pages: React$1.FC<PagesProps>;
189
190
 
190
191
  declare const UserServices: {
191
192
  addUser: (data: Partial<User>, token: string) => Promise<unknown>;
@@ -220,22 +221,25 @@ type FDrawerLineAction = {
220
221
  onclick?: (item: any) => any;
221
222
  };
222
223
  interface FDrawerProps {
223
- children?: React.ReactNode;
224
+ children?: React$1.ReactNode;
224
225
  apiEndpoint: string;
225
226
  columns: FDrawerColumn[];
226
227
  actions: FDrawerLineAction[];
227
228
  ordering: string;
228
229
  toggle?: boolean;
229
230
  }
230
- declare const FDrawer: React.FC<FDrawerProps>;
231
+ declare const FDrawer: React$1.FC<FDrawerProps>;
231
232
 
232
233
  interface ApprovalWorkflowProps {
233
234
  process: number;
234
235
  object_id: number;
235
236
  title?: string;
236
237
  readOnly?: boolean;
238
+ CustomBtn?: React$1.ComponentType<{
239
+ onClick?: () => void;
240
+ }>;
237
241
  }
238
- declare const ApprovalWorkflow: React.FC<ApprovalWorkflowProps>;
242
+ declare const ApprovalWorkflow: React$1.FC<ApprovalWorkflowProps>;
239
243
 
240
244
  declare enum ApprovalStatus {
241
245
  CANCEL = "cancel",
@@ -292,12 +296,66 @@ interface ApprovalAnswerModalProps {
292
296
  link_token?: string;
293
297
  object_detail: ApprovalCase;
294
298
  }
295
- declare const ApprovalAnswerModal: React.FC<ApprovalAnswerModalProps>;
296
- declare const ApprovalAnswerPage: React.FC;
297
- declare const ApprovalPreviewAnswer: React.FC<{
299
+ declare const ApprovalAnswerModal: React$1.FC<ApprovalAnswerModalProps>;
300
+ declare const ApprovalAnswerPage: React$1.FC;
301
+ declare const ApprovalPreviewAnswer: React$1.FC<{
298
302
  loadCase: () => void;
299
303
  answerId: number | null;
300
304
  caseData: ApprovalCase | null;
301
305
  }>;
302
306
 
303
- export { ApprovalAnswerModal, ApprovalAnswerPage, ApprovalPreviewAnswer, ApprovalWorkflow, DateInput, FDrawer, FileInput, InputField, type MenuItem, Modal, NumberInput, Pages, PrimaryButton, RewiseLayout, SecondaryButton, SelectInput, SessionProvider, TextInput, ThemeProvider, ToastContainer, ToastProvider, type User, UserServices, useSession, useToast };
307
+ declare class FetchApi {
308
+ static post<T>(url: string, payload?: any, token?: string): Promise<T>;
309
+ static get<T>(url: string, token?: string): Promise<T>;
310
+ static put<T>(url: string, payload?: any, token?: string): Promise<T>;
311
+ static delete<T>(url: string, token?: string): Promise<T>;
312
+ }
313
+
314
+ type AlertVariant = 'danger' | 'warning' | 'info' | 'success';
315
+ interface AlertProps {
316
+ title: string;
317
+ description?: string;
318
+ variant?: AlertVariant;
319
+ open: boolean;
320
+ onConfirm: () => void;
321
+ onCancel: () => void;
322
+ confirmText?: string;
323
+ cancelText?: string;
324
+ confirmButtonVariant?: 'danger' | 'primary' | 'success';
325
+ }
326
+ declare const Alert: React$1.FC<AlertProps>;
327
+
328
+ interface AlertOptions {
329
+ title: string;
330
+ description?: string;
331
+ variant?: AlertVariant;
332
+ confirmText?: string;
333
+ cancelText?: string;
334
+ confirmButtonVariant?: 'danger' | 'primary' | 'success';
335
+ }
336
+ interface AlertContextType {
337
+ showConfirmation: (options: AlertOptions) => Promise<boolean>;
338
+ showAlert: (title: string, confirmText?: string, cancelText?: string, description?: string, variant?: AlertVariant) => Promise<boolean>;
339
+ }
340
+ declare const AlertProvider: React$1.FC<{
341
+ children: ReactNode;
342
+ }>;
343
+ declare const useAlert: () => AlertContextType;
344
+
345
+ interface SearchableSelectOption {
346
+ value: string | number;
347
+ label: string;
348
+ content?: React$1.ReactNode;
349
+ image?: string;
350
+ }
351
+
352
+ interface SelectProps {
353
+ value?: any;
354
+ onSelect: (option: SearchableSelectOption) => void;
355
+ }
356
+ declare const SelectVendor: React.FC<SelectProps>;
357
+ declare const SelectUser: React.FC<SelectProps>;
358
+ declare const SelectDepartment: React.FC<SelectProps>;
359
+ declare const SelectCostCenter: React.FC<SelectProps>;
360
+
361
+ export { Alert, AlertProvider, ApprovalAnswerModal, ApprovalAnswerPage, ApprovalPreviewAnswer, ApprovalWorkflow, DateInput, FDrawer, FetchApi, FileInput, InputField, type MenuItem, Modal, NumberInput, Pages, PrimaryButton, RewiseLayout, SecondaryButton, SelectCostCenter, SelectDepartment, SelectInput, SelectUser, SelectVendor, SessionProvider, TextInput, ThemeProvider, ToastContainer, ToastProvider, type User, UserServices, useAlert, useSession, useToast };