@kcndigitals/lib 1.0.0 → 1.0.2
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 +63 -63
- package/dist/index.d.ts +331 -0
- package/dist/index.js +3109 -3120
- package/package.json +16 -19
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
|
+
import { ButtonProps } from '@mui/material';
|
|
3
|
+
import { CheckboxProps } from '@mui/material';
|
|
4
|
+
import { default as default_2 } from 'react';
|
|
5
|
+
import { DetailedHTMLProps } from 'react';
|
|
6
|
+
import { DialogProps } from '@mui/material';
|
|
7
|
+
import { Dispatch } from 'react';
|
|
8
|
+
import { HTMLAttributes } from 'react';
|
|
9
|
+
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
10
|
+
import { MUIStyledCommonProps } from '@mui/system';
|
|
11
|
+
import * as React_2 from 'react';
|
|
12
|
+
import { ReactNode } from 'react';
|
|
13
|
+
import { SelectChangeEvent } from '@mui/material';
|
|
14
|
+
import { SelectProps } from '@mui/material';
|
|
15
|
+
import { SetStateAction } from 'react';
|
|
16
|
+
import { StyledComponent } from '@emotion/styled';
|
|
17
|
+
import { TextFieldProps } from '@mui/material';
|
|
18
|
+
import { Theme } from '@mui/system';
|
|
19
|
+
import { TypographyProps } from '@mui/material';
|
|
20
|
+
|
|
21
|
+
export declare const addDaysToDate: (dateStr: string | Date, daysToAdd: number) => Date;
|
|
22
|
+
|
|
23
|
+
declare interface AuthContextType {
|
|
24
|
+
username: string | null;
|
|
25
|
+
fullname: string | null;
|
|
26
|
+
token: string | null;
|
|
27
|
+
refreshToken: string | null;
|
|
28
|
+
isLoading: boolean;
|
|
29
|
+
login: (user: string, fullname: string, token: string, refreshToken: string) => void;
|
|
30
|
+
logout: () => void;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export declare const AuthProvider: default_2.FC<{
|
|
34
|
+
children: ReactNode;
|
|
35
|
+
}>;
|
|
36
|
+
|
|
37
|
+
export declare const AutoLogin: ({ onComplete }: {
|
|
38
|
+
onComplete: () => void;
|
|
39
|
+
}) => null;
|
|
40
|
+
|
|
41
|
+
declare type ButtonType = 'Save' | 'AddNew' | 'Edit' | 'Delete' | 'Refresh' | 'Display' | '';
|
|
42
|
+
|
|
43
|
+
export declare function clearAllCheckboxes(setters: React.Dispatch<React.SetStateAction<boolean>>[]): void;
|
|
44
|
+
|
|
45
|
+
export declare const clearAllTextFields: () => void;
|
|
46
|
+
|
|
47
|
+
export declare const clearSingleTextField: (id: string) => void;
|
|
48
|
+
|
|
49
|
+
declare interface Column<T> {
|
|
50
|
+
label: string;
|
|
51
|
+
valueAccessor: (item: T) => string | number;
|
|
52
|
+
align?: 'left' | 'center' | 'right';
|
|
53
|
+
width?: string;
|
|
54
|
+
summaryKey?: keyof T;
|
|
55
|
+
backgroundColor?: string | ((item: T) => string);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export declare const compareTwoDates: (firstDate: string, secondDate: string) => boolean;
|
|
59
|
+
|
|
60
|
+
export declare const ConfirmDialogBox: ({ title, children, open, setOpen, onConfirm, onReject }: ConfirmDialogBoxProps) => JSX_2.Element;
|
|
61
|
+
|
|
62
|
+
declare interface ConfirmDialogBoxProps {
|
|
63
|
+
title: string;
|
|
64
|
+
children?: default_2.ReactNode;
|
|
65
|
+
open: boolean;
|
|
66
|
+
setOpen: (open: boolean) => void;
|
|
67
|
+
onConfirm: () => void;
|
|
68
|
+
onReject: () => void;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export declare const ContactUs: ({ companyName, website, contactPerson, phoneNumber, backgroundColor, }: ContactUsProps) => JSX_2.Element;
|
|
72
|
+
|
|
73
|
+
declare interface ContactUsProps {
|
|
74
|
+
companyName: string;
|
|
75
|
+
website: string;
|
|
76
|
+
contactPerson: string;
|
|
77
|
+
phoneNumber: string;
|
|
78
|
+
backgroundColor?: string;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export declare function convertToProperCase(str: string): string;
|
|
82
|
+
|
|
83
|
+
export declare const DELETE_MSG_TITLE = "Delete Information";
|
|
84
|
+
|
|
85
|
+
export declare const ERROR_MSG_TITLE = "Error Information";
|
|
86
|
+
|
|
87
|
+
export declare const ForgotPassword: () => JSX_2.Element;
|
|
88
|
+
|
|
89
|
+
export declare const formatDate: (isoDateString: string, type: formatType) => string;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Formats a number to Indian number format with comma separators.
|
|
93
|
+
* E.g. 105621.64 => "1,05,621.64"
|
|
94
|
+
*
|
|
95
|
+
* @param value - number to format
|
|
96
|
+
* @returns formatted string with commas
|
|
97
|
+
*/
|
|
98
|
+
export declare function formatNumberWithCommas(value: number | string): string;
|
|
99
|
+
|
|
100
|
+
export declare type formatType = 'dd-mm-yyyy' | 'yyyy-mm-dd' | 'mm-dd-yyyy' | 'MMMM yyyy';
|
|
101
|
+
|
|
102
|
+
export declare const FormTemplate: ({ heading, onClose, children, width, backTo }: FormTemplateProps) => JSX_2.Element;
|
|
103
|
+
|
|
104
|
+
declare type FormTemplateProps = {
|
|
105
|
+
heading: string;
|
|
106
|
+
onClose?: () => void;
|
|
107
|
+
children: default_2.ReactNode;
|
|
108
|
+
width?: string | number;
|
|
109
|
+
backTo?: string;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export declare const getDateFromString: (dateString: string) => Date;
|
|
113
|
+
|
|
114
|
+
export declare const getFormattedDate: () => string;
|
|
115
|
+
|
|
116
|
+
export declare const getFormattedTime: () => string;
|
|
117
|
+
|
|
118
|
+
export declare const getInputValue: (id: string, type: InputValueType) => string | number | boolean;
|
|
119
|
+
|
|
120
|
+
export declare const getMonthName: (month: number) => string;
|
|
121
|
+
|
|
122
|
+
export declare const getRequestOptions: () => {
|
|
123
|
+
crossDomain: boolean;
|
|
124
|
+
method: string;
|
|
125
|
+
headers: {
|
|
126
|
+
'Content-Type': string;
|
|
127
|
+
Authorization: string;
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export declare const getResetPasswordURL: () => string;
|
|
132
|
+
|
|
133
|
+
export declare const getServerIP: () => string;
|
|
134
|
+
|
|
135
|
+
export declare const HS_TAG = "Housing_Society";
|
|
136
|
+
|
|
137
|
+
declare type InputType = 'text' | 'number' | 'date' | 'email' | 'password' | 'multiline';
|
|
138
|
+
|
|
139
|
+
export declare type InputValueType = 'string' | 'number' | 'boolean';
|
|
140
|
+
|
|
141
|
+
export declare const INVENTORY_TAG = "Inventory";
|
|
142
|
+
|
|
143
|
+
export declare const InventoryLogin: () => JSX_2.Element;
|
|
144
|
+
|
|
145
|
+
export declare const isValidDate: (dateStr: string) => boolean;
|
|
146
|
+
|
|
147
|
+
export declare function isValidDateForYearMonth(date: Date, year: number, month: number): boolean;
|
|
148
|
+
|
|
149
|
+
export declare function isValidTime(time: string): boolean;
|
|
150
|
+
|
|
151
|
+
export declare function ListRecords<T>({ showList, data, columns, onEdit, onDelete, showEditColumn, showDeleteColumn, noRecordsMessage, summaryOptions, tableHeight, }: ListRecordsProps<T>): JSX_2.Element | null;
|
|
152
|
+
|
|
153
|
+
export declare const ListRecordsDiv: StyledComponent<MUIStyledCommonProps<Theme> & {
|
|
154
|
+
maxHeight?: string;
|
|
155
|
+
}, DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
156
|
+
|
|
157
|
+
declare interface ListRecordsProps<T> {
|
|
158
|
+
showList?: boolean;
|
|
159
|
+
data: T[];
|
|
160
|
+
columns: Column<T>[];
|
|
161
|
+
onEdit?: (item: T) => void;
|
|
162
|
+
onDelete?: (item: T) => void;
|
|
163
|
+
showEditColumn?: boolean;
|
|
164
|
+
showDeleteColumn?: boolean;
|
|
165
|
+
noRecordsMessage?: string;
|
|
166
|
+
summaryOptions?: SummaryOption<T>[];
|
|
167
|
+
tableHeight?: string;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export declare const Login: ({ tag }: LoginProps) => JSX_2.Element;
|
|
171
|
+
|
|
172
|
+
declare interface LoginProps {
|
|
173
|
+
tag: LoginTag;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export declare enum LoginTag {
|
|
177
|
+
Inventory = "Inventory",
|
|
178
|
+
Stock = "Stock",
|
|
179
|
+
Housing_Society = "Housing_Society"
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export declare const MAIN_MENU_ROUTE = "/mainmenu";
|
|
183
|
+
|
|
184
|
+
export declare interface MainMenuItem {
|
|
185
|
+
label: string;
|
|
186
|
+
icon: ReactNode;
|
|
187
|
+
type: 'link' | 'submenu' | 'logout';
|
|
188
|
+
path?: string;
|
|
189
|
+
submenuItems?: SubMenuItem[];
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export declare function MessageBox({ open, onClose, children, title }: MessageBoxProps): JSX_2.Element;
|
|
193
|
+
|
|
194
|
+
declare interface MessageBoxProps {
|
|
195
|
+
open: boolean;
|
|
196
|
+
onClose: () => void;
|
|
197
|
+
children: default_2.ReactNode;
|
|
198
|
+
title: string;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export declare const ModalTemplate: ({ open, heading, onClose, children, width, maxWidth, }: ModalTemplateProps) => JSX_2.Element;
|
|
202
|
+
|
|
203
|
+
declare type ModalTemplateProps = {
|
|
204
|
+
open: boolean;
|
|
205
|
+
heading: string;
|
|
206
|
+
onClose: () => void;
|
|
207
|
+
children: default_2.ReactNode;
|
|
208
|
+
width?: string | number;
|
|
209
|
+
maxWidth?: DialogProps['maxWidth'];
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
export declare const monthList: {
|
|
213
|
+
monthId: number;
|
|
214
|
+
monthName: string;
|
|
215
|
+
}[];
|
|
216
|
+
|
|
217
|
+
export declare const postRequestOptions: () => {
|
|
218
|
+
crossDomain: boolean;
|
|
219
|
+
method: string;
|
|
220
|
+
headers: {
|
|
221
|
+
'Content-Type': string;
|
|
222
|
+
Authorization: string;
|
|
223
|
+
};
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
export declare const printToExcel: (Heading: any[], dataToPopulate: any[], sheetName: string, fileName: string) => void;
|
|
227
|
+
|
|
228
|
+
export declare const ProtectedRoute: ({ children }: ProtectedRouteProps) => JSX_2.Element;
|
|
229
|
+
|
|
230
|
+
declare interface ProtectedRouteProps {
|
|
231
|
+
children: React_2.ReactNode;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export declare const ReButton: default_2.FC<ReButtonProps>;
|
|
235
|
+
|
|
236
|
+
declare interface ReButtonProps extends ButtonProps {
|
|
237
|
+
id: string;
|
|
238
|
+
label: string;
|
|
239
|
+
buttonType: ButtonType;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Reusable Checkbox component
|
|
244
|
+
* Fully controlled and parameterized
|
|
245
|
+
*/
|
|
246
|
+
export declare const ReCheckbox: default_2.FC<ReCheckboxProps>;
|
|
247
|
+
|
|
248
|
+
declare interface ReCheckboxProps extends Omit<CheckboxProps, "onChange"> {
|
|
249
|
+
/** Label text shown beside the checkbox */
|
|
250
|
+
label: string;
|
|
251
|
+
/** Checkbox state - controlled from parent */
|
|
252
|
+
checked: boolean;
|
|
253
|
+
/** Callback when checkbox value changes */
|
|
254
|
+
onChange: (event: default_2.ChangeEvent<HTMLInputElement>, checked: boolean) => void;
|
|
255
|
+
/** Optional unique id for accessibility */
|
|
256
|
+
id?: string;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
export declare const ReInputLabel: ({ labelValue, variant, bold, italic }: ReInputLabelProps) => JSX_2.Element;
|
|
260
|
+
|
|
261
|
+
declare interface ReInputLabelProps {
|
|
262
|
+
labelValue: string;
|
|
263
|
+
variant?: TypographyProps['variant'];
|
|
264
|
+
bold?: boolean;
|
|
265
|
+
italic?: boolean;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
export declare function ReSelect<T>({ id, value, options, getOptionLabel, getOptionValue, onChange, width, disabled, sx, ...rest }: ReSelectProps<T>): JSX_2.Element;
|
|
269
|
+
|
|
270
|
+
declare interface ReSelectProps<T> extends Omit<SelectProps, 'value' | 'onChange' | 'children'> {
|
|
271
|
+
id: string;
|
|
272
|
+
value: string | number;
|
|
273
|
+
options: T[];
|
|
274
|
+
getOptionLabel: (option: T) => string;
|
|
275
|
+
getOptionValue: (option: T) => string | number;
|
|
276
|
+
onChange?: (event: SelectChangeEvent<any>) => void;
|
|
277
|
+
width?: number | string;
|
|
278
|
+
disabled?: boolean;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
export declare const ResetPassword: default_2.FC;
|
|
282
|
+
|
|
283
|
+
export declare const ReTextField: ({ id, value, onChange, type, label, placeholder, format, width, size, sx, ...rest }: ReTextFieldProps) => JSX_2.Element;
|
|
284
|
+
|
|
285
|
+
declare interface ReTextFieldProps extends Omit<TextFieldProps, 'type'> {
|
|
286
|
+
id: string;
|
|
287
|
+
value?: string | number;
|
|
288
|
+
type: InputType;
|
|
289
|
+
format?: string;
|
|
290
|
+
width?: string | number;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
export declare const SAVE_MSG_TITLE = "Save Information";
|
|
294
|
+
|
|
295
|
+
export declare const setFocus: (controlId: string) => void;
|
|
296
|
+
|
|
297
|
+
export declare const setInputValue: (id: string, value: number | string | Date) => void;
|
|
298
|
+
|
|
299
|
+
export declare const setLoginTag: (tag: string) => void;
|
|
300
|
+
|
|
301
|
+
export declare const SignupForm: default_2.FC;
|
|
302
|
+
|
|
303
|
+
export declare const STOCK_TAG = "Stock";
|
|
304
|
+
|
|
305
|
+
export declare const StockLogin: () => JSX_2.Element;
|
|
306
|
+
|
|
307
|
+
export declare interface SubMenuItem {
|
|
308
|
+
label: string;
|
|
309
|
+
path: string;
|
|
310
|
+
icon: ReactNode;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
declare interface SummaryOption<T> {
|
|
314
|
+
key: keyof T;
|
|
315
|
+
type: 'sum' | 'average';
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
export declare const useAdminApi: () => AxiosInstance;
|
|
319
|
+
|
|
320
|
+
export declare const useAuth: () => AuthContextType;
|
|
321
|
+
|
|
322
|
+
export declare function useMessageHandler(): {
|
|
323
|
+
showMessageBox: boolean;
|
|
324
|
+
title: string;
|
|
325
|
+
displayMessage: string;
|
|
326
|
+
showMessage: (isShow: boolean, messageTitle: string, message: string, controlId?: string) => void;
|
|
327
|
+
setShowMessageBox: Dispatch<SetStateAction<boolean>>;
|
|
328
|
+
handleCloseMessageBox: () => void;
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
export { }
|