cr-ui-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.
Binary file
package/dist/index.d.mts CHANGED
@@ -1,3 +1,405 @@
1
+ import React$1, { ChangeEvent } from 'react';
2
+
3
+ interface PlainButtonProps extends React.HTMLAttributes<HTMLDivElement> {
4
+ className?: string;
5
+ children?: React.ReactNode;
6
+ }
7
+ declare const PlainButton: ({ className, children, ...rest }: PlainButtonProps) => JSX.Element;
8
+
9
+ interface Props$1 extends React.HTMLAttributes<HTMLDivElement> {
10
+ isOpen: boolean;
11
+ mainClass?: string;
12
+ paragraphClass?: string;
13
+ paragraphContent: string;
14
+ title: string;
15
+ titleClass?: string;
16
+ }
17
+ declare const CollapseButton: ({ isOpen, mainClass, paragraphClass, paragraphContent, title, titleClass, ...rest }: Props$1) => JSX.Element;
18
+
19
+ interface ButtonProps extends React.HTMLAttributes<HTMLDivElement> {
20
+ className?: string;
21
+ children?: React.ReactNode;
22
+ }
23
+ declare const Button: ({ className, children, ...rest }: ButtonProps) => JSX.Element;
24
+
25
+ interface GraphedCardProps {
26
+ className?: string;
27
+ title: string;
28
+ tooltip_text: string;
29
+ subText?: string;
30
+ value: string;
31
+ unit?: string;
32
+ image?: React.ReactNode;
33
+ lineData: number[];
34
+ lineLabel: string[];
35
+ gradientColor0?: string;
36
+ gradientColor1?: string;
37
+ pointLabelColor?: string;
38
+ labelPopupTitle?: string;
39
+ isCustomTitle?: boolean;
40
+ customTitle?: React.ReactNode;
41
+ lineColor?: string;
42
+ isLoading: boolean;
43
+ isError: boolean;
44
+ handleRefresh?: () => void;
45
+ }
46
+ declare const GraphedCard: ({ className, title, value, subText, unit, tooltip_text, image, gradientColor0, gradientColor1, pointLabelColor, labelPopupTitle, lineData, lineLabel, isCustomTitle, customTitle, lineColor, isLoading, isError, handleRefresh, }: GraphedCardProps) => JSX.Element;
47
+
48
+ interface SimpleCardProps {
49
+ title: string;
50
+ value: string;
51
+ unit?: string;
52
+ tooltip_text: string;
53
+ subText?: string;
54
+ footerText?: string;
55
+ hasDaysOption?: boolean;
56
+ hasTillDateDayOption?: boolean;
57
+ onDayChange?: (days: string) => void;
58
+ image?: React$1.ReactNode;
59
+ hasfooterDesign?: boolean;
60
+ footerDesign?: React$1.ReactNode;
61
+ className?: string;
62
+ isLoading: boolean;
63
+ isError: boolean;
64
+ handleRefresh?: () => void;
65
+ isCustomTitle?: boolean;
66
+ customTitle?: React$1.ReactNode;
67
+ }
68
+ declare const SimpleCard: ({ title, value, image, unit, tooltip_text, subText, footerText, hasfooterDesign, footerDesign, hasDaysOption, hasTillDateDayOption, onDayChange, className, handleRefresh, isLoading, isError, isCustomTitle, customTitle, }: SimpleCardProps) => JSX.Element;
69
+
70
+ interface Props {
71
+ title: string;
72
+ classNames?: string;
73
+ }
74
+ declare const Label: ({ title, classNames }: Props) => JSX.Element;
75
+
76
+ interface DataSet {
77
+ data: number[];
78
+ label: string;
79
+ lineColor?: string;
80
+ pointLabelColor?: string;
81
+ }
82
+ interface MultiLineGraphProps {
83
+ datasets: DataSet[];
84
+ xAxisLabels: string[];
85
+ className?: string;
86
+ }
87
+ declare const MultiLineGraph: ({ datasets, xAxisLabels, className, }: MultiLineGraphProps) => JSX.Element;
88
+
89
+ interface SingleLineGraphProps {
90
+ data: number[];
91
+ label: string[];
92
+ gradientColor0?: string;
93
+ gradientColor1?: string;
94
+ pointLabelColor?: string;
95
+ labelPopupTitle?: string;
96
+ lineColor?: string;
97
+ className?: string;
98
+ }
99
+ declare const SingleLineGraph: ({ data, label, lineColor, gradientColor1, gradientColor0, pointLabelColor, labelPopupTitle, className, }: SingleLineGraphProps) => JSX.Element;
100
+
101
+ interface CommonInputProps extends React$1.HTMLAttributes<HTMLInputElement | HTMLTextAreaElement> {
102
+ label?: string;
103
+ hasDollar?: boolean;
104
+ value: string;
105
+ onChange: (e: React$1.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
106
+ placeholder?: string;
107
+ type?: string;
108
+ height?: string;
109
+ isTextarea?: boolean;
110
+ className?: string;
111
+ maxLength?: number;
112
+ hasIcon?: boolean;
113
+ icon?: React$1.ReactNode;
114
+ labelColor?: string;
115
+ borderWeight?: string;
116
+ error?: string;
117
+ dollarClass?: string;
118
+ }
119
+ declare const CommonInput: React$1.FC<CommonInputProps>;
120
+
121
+ interface DateRangePickerProps {
122
+ bgColor?: string;
123
+ dateFunc: (startDate: string, endDate: string) => void;
124
+ start_date?: string;
125
+ end_date?: string;
126
+ yearsBack?: number;
127
+ title?: string;
128
+ titleClass?: string;
129
+ autoOpen?: boolean;
130
+ isDateRangeOnly?: boolean;
131
+ dateRangeClass?: string;
132
+ setIsShowDateRange?: () => void;
133
+ datePopupOnly?: boolean;
134
+ handleExport?: (start_date: string, end_date: string) => Promise<void>;
135
+ setIsExporting?: (value: boolean) => void;
136
+ isExporting?: boolean;
137
+ className?: string;
138
+ }
139
+ declare const DateRangePicker: React$1.FC<DateRangePickerProps>;
140
+
141
+ interface MultipleAutoSuggestionInputProps {
142
+ label?: string;
143
+ options: {
144
+ key: string;
145
+ name: string;
146
+ }[];
147
+ selectedItems: string[] | string;
148
+ isMulti?: boolean;
149
+ enableTypingSingle?: boolean;
150
+ onSelect: (key: string) => void;
151
+ onRemove?: (key: string) => void;
152
+ onChange: (e: ChangeEvent<HTMLInputElement>) => void;
153
+ keyDown: (e: React$1.KeyboardEvent<HTMLInputElement>) => void;
154
+ inputValue: string;
155
+ setInputValue: (value: string) => void;
156
+ isDropdownAutoOpen?: boolean;
157
+ labelClass?: string;
158
+ buttonClass?: string;
159
+ dropdownOpenClass?: string;
160
+ selectedItemsClass?: string;
161
+ removeIconClass?: string;
162
+ }
163
+ declare const MultipleAutoSuggestionInput: React$1.FC<MultipleAutoSuggestionInputProps>;
164
+
165
+ interface SingleListInputProps {
166
+ formValues: string[];
167
+ handleRemove: (value: string) => void;
168
+ inputValue: string;
169
+ onChange: (e: ChangeEvent<HTMLInputElement>) => void;
170
+ keyDown: (e: React$1.KeyboardEvent<HTMLInputElement>) => void;
171
+ label?: string;
172
+ buttonClass?: string;
173
+ labelClass?: string;
174
+ }
175
+ declare const SingleListInput: React$1.FC<SingleListInputProps>;
176
+
177
+ type Option = {
178
+ id: string;
179
+ name: string;
180
+ };
181
+ type SingleSelectDropdownProps = {
182
+ label?: string;
183
+ value: string | null;
184
+ onChange: (value: string) => void;
185
+ options: Option[];
186
+ placeholder?: string;
187
+ onScrollToEnd?: () => void;
188
+ onSearch?: (searchTerm: string) => void;
189
+ hasMore?: boolean;
190
+ isLoading?: boolean;
191
+ searchable?: boolean;
192
+ searchDebounceMs?: number;
193
+ requiresSearch?: boolean;
194
+ minSearchLength?: number;
195
+ emptyMessage?: string;
196
+ loadingMessage?: string;
197
+ searchPlaceholder?: string;
198
+ disabled?: boolean;
199
+ allOptions?: Option[];
200
+ hasIcon?: boolean;
201
+ buttonClass?: string;
202
+ labelClass?: string;
203
+ displayMainClass?: string;
204
+ displayItemClass?: string;
205
+ hasSearchIcon?: boolean;
206
+ searchInputClass?: string;
207
+ placeholderSearchClass?: string;
208
+ };
209
+ declare function SingleSelectDropdown({ label, value, onChange, options, placeholder, onScrollToEnd, onSearch, hasMore, isLoading, searchable, searchDebounceMs, requiresSearch, minSearchLength, emptyMessage, loadingMessage, searchPlaceholder, disabled, hasIcon, buttonClass, labelClass, displayItemClass, displayMainClass, hasSearchIcon, searchInputClass, placeholderSearchClass, }: SingleSelectDropdownProps): JSX.Element;
210
+
211
+ interface SelectionButton {
212
+ data: string[];
213
+ className?: string;
214
+ buttonClass?: string;
215
+ currentValue: string;
216
+ onClick: (value: string) => void;
217
+ }
218
+ declare const SelectionButton: ({ data, currentValue, className, buttonClass, onClick, }: SelectionButton) => JSX.Element;
219
+
220
+ interface DynamicDateProps {
221
+ label?: string;
222
+ hasCalendarIcon?: boolean;
223
+ value: string;
224
+ onChange: (e: string) => void;
225
+ placeholder?: string;
226
+ disableFuture?: boolean;
227
+ labelColor?: string;
228
+ borderWeight?: string;
229
+ bgColor?: string;
230
+ height?: string;
231
+ placeholderColor?: string;
232
+ labelClass?: string;
233
+ className?: string;
234
+ customIcon?: string;
235
+ iconSize?: number;
236
+ iconClass?: string;
237
+ }
238
+ declare const SingleDateInput: ({ label, hasCalendarIcon, value, onChange, placeholder, disableFuture, labelColor, borderWeight, bgColor, height, placeholderColor, labelClass, className, customIcon, iconSize, iconClass, }: DynamicDateProps) => JSX.Element;
239
+
240
+ interface TimeInputProps {
241
+ label?: string;
242
+ hasTimeIcon?: boolean;
243
+ value: string;
244
+ onChange: (e: string) => void;
245
+ placeholder?: string;
246
+ disableFuture?: boolean;
247
+ selectedDate?: string;
248
+ className?: string;
249
+ labelClassName?: string;
250
+ customIcon?: React$1.ReactNode;
251
+ iconSize?: number;
252
+ iconClass?: string;
253
+ }
254
+ declare const TimeInput: ({ label, hasTimeIcon, value, onChange, placeholder, disableFuture, selectedDate, className, labelClassName, customIcon, iconSize, iconClass, }: TimeInputProps) => JSX.Element;
255
+
256
+ interface Column {
257
+ name: string;
258
+ selector: string;
259
+ width: string;
260
+ sortable?: boolean;
261
+ isJustifyBetween?: boolean;
262
+ isLineHeight?: boolean;
263
+ isCenteredText?: boolean;
264
+ className?: string;
265
+ iconClassName?: string;
266
+ tableHeaderFontSize?: string;
267
+ }
268
+ interface TableHeaderProps {
269
+ toggleFilterPanel?: () => void;
270
+ isFilterPanelVisible?: boolean;
271
+ iconHeader?: React$1.ReactNode;
272
+ title?: string;
273
+ isExport?: boolean;
274
+ handleExport?: () => void;
275
+ isExporting?: boolean | undefined;
276
+ hasTooltip?: boolean;
277
+ tooltipMessage?: string;
278
+ isSimpleMode?: boolean;
279
+ isButtonAvailable?: boolean;
280
+ isFilterVisible?: boolean;
281
+ isUseDateRange?: boolean;
282
+ isShowDateRange?: boolean;
283
+ setIsShowDateRange?: () => void;
284
+ dateRangeApplyFunc?: (start_date: string, end_date: string) => void;
285
+ exportTooltipMessage?: string;
286
+ exportTooltipClass?: string;
287
+ hasMiddleHeaderCustomComponent?: boolean;
288
+ middleHeaderCustomComponent?: React$1.ReactElement;
289
+ rightHeaderClass?: string;
290
+ dateRangeClass?: string;
291
+ customClass?: string;
292
+ }
293
+ interface TableHeaderCustom$1 {
294
+ tableHeaderHeight?: string;
295
+ }
296
+ interface TableData$1 {
297
+ id?: string | number;
298
+ [key: string]: any;
299
+ }
300
+ interface PaginationProps$2 {
301
+ totalPage: number;
302
+ currentPage: number;
303
+ handlePageChange: (page: number) => void;
304
+ handleRowsPerPageChange: (page: number) => void;
305
+ page: number;
306
+ per_page: number;
307
+ totalItems: number;
308
+ }
309
+ interface DynamicTableProps {
310
+ columns: Column[];
311
+ tableData: TableData$1[];
312
+ handleSort: (selector: string) => void;
313
+ pagination: PaginationProps$2;
314
+ mainTableHeader: TableHeaderProps;
315
+ tableHeaderCustom?: TableHeaderCustom$1;
316
+ isLoading: boolean;
317
+ isError: boolean;
318
+ tableHeader?: (column: Column, columnIndex: number, sortData: (selector: string) => void) => React$1.ReactNode;
319
+ tableBody?: (item: TableData$1, column: Column, columnIndex: number) => any;
320
+ noDataMessage?: string;
321
+ }
322
+ declare const DynamicTable: React$1.FC<DynamicTableProps>;
323
+
324
+ interface TableBodyDesign {
325
+ className?: string;
326
+ }
327
+ interface TableHeaderCustom {
328
+ tableHeaderHeight?: string;
329
+ px?: string;
330
+ toggleAll?: () => void;
331
+ isIndeterminate?: boolean;
332
+ isAllSelected?: boolean;
333
+ }
334
+ interface TableData {
335
+ id?: string | number;
336
+ [key: string]: any;
337
+ }
338
+ interface PaginationProps$1 {
339
+ totalPage: number;
340
+ currentPage: number;
341
+ handlePageChange: (page: number) => void;
342
+ handleRowsPerPageChange: (page: number) => void;
343
+ page: number;
344
+ per_page: number;
345
+ totalItems: number;
346
+ pageRangeDisplayed?: number;
347
+ }
348
+ interface DynamicTableV2Props {
349
+ columns: Column[];
350
+ tableData: TableData[];
351
+ handleSort: (selector: string) => void;
352
+ pagination: PaginationProps$1;
353
+ mainTableHeader: TableHeaderProps;
354
+ tableHeaderCustom?: TableHeaderCustom;
355
+ isLoading: boolean;
356
+ isError: boolean;
357
+ tableHeader?: (column: Column, columnIndex: number, sortData: (selector: string) => void) => React$1.ReactNode;
358
+ tableBody?: (item: TableData, column: Column, columnIndex: number) => any;
359
+ tableRow?: (item: TableData, index: number) => React$1.HTMLAttributes<HTMLTableRowElement>;
360
+ noDataMessage?: string;
361
+ noDataMessageHeader?: string;
362
+ noDataMessageImage?: React$1.ReactNode;
363
+ noDataMessageImageSize?: number;
364
+ tableBodyDesign?: TableBodyDesign;
365
+ hasAnotherScreen?: boolean;
366
+ anotherScreenComponent?: any;
367
+ isSimpleMode?: boolean;
368
+ loadAndErrorHeight?: string;
369
+ isDisableTableHeader?: boolean;
370
+ isShowDateRange?: boolean;
371
+ tableClass?: string;
372
+ }
373
+ declare const DynamicTableV2: React$1.FC<DynamicTableV2Props>;
374
+
375
+ interface PaginationProps {
376
+ totalPages: number;
377
+ currentPage: number;
378
+ onPageChange: (selectedPage: number) => void;
379
+ pageRangeDisplayed?: number;
380
+ }
381
+ declare const Pagination: React$1.FC<PaginationProps>;
382
+
383
+ declare const TableHeader: React.FC<TableHeaderProps>;
384
+
385
+ interface ErrorToastProps {
386
+ message?: string;
387
+ onClose?: () => void;
388
+ autoClose?: boolean;
389
+ autoCloseDelay?: number;
390
+ isVisible?: boolean;
391
+ }
392
+ declare const ErrorToast: ({ message, onClose, autoClose, autoCloseDelay, isVisible: externalIsVisible, }: ErrorToastProps) => JSX.Element | null;
393
+
394
+ interface SuccessToastProps {
395
+ message?: string;
396
+ onClose?: () => void;
397
+ autoClose?: boolean;
398
+ autoCloseDelay?: number;
399
+ isVisible?: boolean;
400
+ }
401
+ declare const SuccessToast: ({ message, onClose, autoClose, autoCloseDelay, isVisible: externalIsVisible, }: SuccessToastProps) => JSX.Element | null;
402
+
1
403
  type NavBarProps = {
2
404
  children?: React.ReactNode;
3
405
  wrapperClassName?: string;
@@ -22,8 +424,8 @@ type PopupWrapperProps = {
22
424
  className?: string;
23
425
  isOpen: boolean;
24
426
  stayMounted?: boolean;
25
- };
26
- declare const PopupWrapper: ({ children, className, isOpen, stayMounted, }: PopupWrapperProps) => JSX.Element | null;
427
+ } & React.HTMLAttributes<HTMLElement>;
428
+ declare const PopupWrapper: ({ children, className, isOpen, stayMounted, ...rest }: PopupWrapperProps) => JSX.Element | null;
27
429
 
28
430
  type LayoutProps = {
29
431
  children: React.ReactNode;
@@ -33,4 +435,39 @@ type LayoutProps = {
33
435
  } & React.HTMLAttributes<HTMLDivElement>;
34
436
  declare const SideNav: ({ children, wrapperClassName, navClassName, navProps, ...rest }: LayoutProps) => JSX.Element;
35
437
 
36
- export { Modal, NavBar, type NavBarProps, PopupWrapper, SideNav, type LayoutProps as SideNavProps };
438
+ interface BoxProps extends React$1.HTMLAttributes<HTMLDivElement> {
439
+ className?: string;
440
+ children?: React$1.ReactNode;
441
+ }
442
+ declare const Box: React$1.FC<BoxProps>;
443
+
444
+ interface BoxHeaderProps extends React$1.HTMLAttributes<HTMLDivElement> {
445
+ className?: string;
446
+ children?: React$1.ReactNode;
447
+ }
448
+ declare const BoxHeader: React$1.FC<BoxHeaderProps>;
449
+
450
+ interface BoxBodyProps extends React$1.HTMLAttributes<HTMLDivElement> {
451
+ className?: string;
452
+ children?: React$1.ReactNode;
453
+ }
454
+ declare const BoxBody: React$1.FC<BoxBodyProps>;
455
+
456
+ interface DateValidationOptions {
457
+ enableYearRange?: boolean;
458
+ yearsBack?: number;
459
+ allowFutureDates?: boolean;
460
+ }
461
+ declare const validateAndFormatInput: (rawInput: string, options?: DateValidationOptions) => string;
462
+ declare const validateDate: (dateString: string, allowFutureDates?: boolean) => boolean;
463
+ declare const validateDateRange: (dateString: string, options?: {
464
+ allowFutureDates?: boolean;
465
+ minDate?: Date;
466
+ maxDate?: Date;
467
+ yearsBack?: number;
468
+ }) => boolean;
469
+ declare function toEndOfDay(date: Date): Date;
470
+ declare function toMidnight(date: Date): Date;
471
+ declare function isSameDateMDY(date1: Date, date2: Date): boolean;
472
+
473
+ export { Box, BoxBody, BoxHeader, Button, CollapseButton, CommonInput, DateRangePicker, DynamicTable, DynamicTableV2, ErrorToast, GraphedCard, Label, Modal, MultiLineGraph, MultipleAutoSuggestionInput, NavBar, type NavBarProps, Pagination, PlainButton, PopupWrapper, SelectionButton, SideNav, type LayoutProps as SideNavProps, SimpleCard, SingleDateInput, SingleLineGraph, SingleListInput, SingleSelectDropdown, SuccessToast, TableHeader, TimeInput, isSameDateMDY, toEndOfDay, toMidnight, validateAndFormatInput, validateDate, validateDateRange };