tp-react-elements 3.0.3 → 3.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/_virtual/index.esm10.js +2 -2
- package/dist/_virtual/index.esm13.js +2 -2
- package/dist/_virtual/index.esm14.js +2 -2
- package/dist/_virtual/index.esm9.js +2 -2
- package/dist/components/Form/FormRender.esm.js +6 -6
- package/dist/components/FormComponents/index.esm.js +27 -10
- package/dist/components/PaginatedGrid/GenericPaginatedGrid.d.ts +69 -2
- package/dist/components/PaginatedGrid/GenericPaginatedGrid.esm.js +97 -16
- package/dist/node_modules/prop-types/index.esm.js +1 -1
- package/dist/node_modules/react-date-range/dist/accessibility/index.esm.js +1 -1
- package/dist/node_modules/react-date-range/dist/components/DateInput/index.esm.js +1 -1
- package/dist/node_modules/react-date-range/dist/components/Month/index.esm.js +1 -1
- package/package.json +211 -211
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
1
|
+
var accessibility = {};
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export { accessibility as __exports };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
1
|
+
var DateInput = {};
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export { DateInput as __exports };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Month = {};
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export { Month as __exports };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
1
|
+
var propTypes = {exports: {}};
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export { propTypes as __module };
|
|
@@ -2,6 +2,12 @@ import { jsx, Fragment } from 'react/jsx-runtime';
|
|
|
2
2
|
import require$$0__default, { lazy, Suspense } from 'react';
|
|
3
3
|
import FormCheckBox from '../FormComponents/FormCheckBox/FormCheckBox.esm.js';
|
|
4
4
|
import FormCheckBoxGroup from '../FormComponents/FormCheckBoxGroup/FormCheckBoxGroup.esm.js';
|
|
5
|
+
import FormNumberField from '../FormComponents/FormNumberField/FormNumberField.esm.js';
|
|
6
|
+
import FormNumberFieldDecimal from '../FormComponents/FormNumberField/FormNumberFieldDecimal.esm.js';
|
|
7
|
+
import FormRadioGroup from '../FormComponents/FormRadioGroup/FormRadioGroup.esm.js';
|
|
8
|
+
import FormTextAreaField from '../FormComponents/FormTextAreaField/FormTextAreaField.esm.js';
|
|
9
|
+
import FormTextField from '../FormComponents/FormTextField/FormTextField.esm.js';
|
|
10
|
+
import PasswordField from '../FormComponents/PasswordField/PasswordField.esm.js';
|
|
5
11
|
import SingleSelect from '../FormComponents/Select/SingleSelect.esm.js';
|
|
6
12
|
import MultiSelectAutocomplete from '../FormComponents/Select/MultiSelectAutocomplete.esm.js';
|
|
7
13
|
import SingleSelectNonAutoComplete from '../FormComponents/Select/SingleSelectNonAutoComplete.esm.js';
|
|
@@ -12,12 +18,6 @@ import DateRangePickerComponent from '../DateRangePicker/DateRangePicker.esm.js'
|
|
|
12
18
|
import RichTextEditorWrapper from '../FormComponents/RichTextEditor/RichTextEditorWrapper.esm.js';
|
|
13
19
|
import SingleSelectSearchApi from '../FormComponents/Select/SingleSelectSearchApi.esm.js';
|
|
14
20
|
import DatetimepickerWrapper from '../FormComponents/DatePicker/DatetimepickerWrapper.esm.js';
|
|
15
|
-
import FormTextAreaField from '../FormComponents/FormTextAreaField/FormTextAreaField.esm.js';
|
|
16
|
-
import FormRadioGroup from '../FormComponents/FormRadioGroup/FormRadioGroup.esm.js';
|
|
17
|
-
import FormNumberFieldDecimal from '../FormComponents/FormNumberField/FormNumberFieldDecimal.esm.js';
|
|
18
|
-
import FormNumberField from '../FormComponents/FormNumberField/FormNumberField.esm.js';
|
|
19
|
-
import PasswordField from '../FormComponents/PasswordField/PasswordField.esm.js';
|
|
20
|
-
import FormTextField from '../FormComponents/FormTextField/FormTextField.esm.js';
|
|
21
21
|
|
|
22
22
|
// Lazy-loaded heavy components
|
|
23
23
|
// const RichTextEditorWrapper = lazy(() =>
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
export { default as FormNumberField } from './FormNumberField/FormNumberField.esm.js';
|
|
2
|
+
export { default as FormNumberFieldDecimal } from './FormNumberField/FormNumberFieldDecimal.esm.js';
|
|
3
|
+
export { default as FormTextAreaField } from './FormTextAreaField/FormTextAreaField.esm.js';
|
|
4
|
+
export { default as FormTextField } from './FormTextField/FormTextField.esm.js';
|
|
5
|
+
export { default as PasswordField } from './PasswordField/PasswordField.esm.js';
|
|
1
6
|
export { default as FormCheckBox } from './FormCheckBox/FormCheckBox.esm.js';
|
|
2
7
|
export { default as SingleSelect } from './Select/SingleSelect.esm.js';
|
|
3
8
|
export { default as SingleSelectNonAutoComplete } from './Select/SingleSelectNonAutoComplete.esm.js';
|
|
@@ -6,20 +11,32 @@ export { default as MultiSelectV1 } from './Select/MultiSelectv1.esm.js';
|
|
|
6
11
|
export { default as MultiSelectTable } from './Select/MultiSelectTable.esm.js';
|
|
7
12
|
export { default as SearchableSelect } from './Select/SearchableSelect.esm.js';
|
|
8
13
|
export { default as FormCheckBoxGroup } from './FormCheckBoxGroup/FormCheckBoxGroup.esm.js';
|
|
14
|
+
export { default as FormRadioGroup } from './FormRadioGroup/FormRadioGroup.esm.js';
|
|
9
15
|
export { default as DatepickerWrapperV2 } from './DatePicker/DatepickerWrapperV2.esm.js';
|
|
16
|
+
export { default as Monthpickerrender } from './DatePicker/Monthpickerrender.esm.js';
|
|
17
|
+
import 'react/jsx-runtime';
|
|
18
|
+
import 'react';
|
|
19
|
+
import '@mui/material';
|
|
20
|
+
import '@mui/icons-material/CalendarToday';
|
|
21
|
+
import '@mui/icons-material/ChevronLeft';
|
|
22
|
+
import '@mui/icons-material/ChevronRight';
|
|
23
|
+
import 'react-hook-form';
|
|
10
24
|
export { default as FormBottomField } from './FormBottomField/FormBottomField.esm.js';
|
|
11
|
-
|
|
12
|
-
export { default as
|
|
13
|
-
export { default as
|
|
14
|
-
export { default as FormRadioGroup } from './FormRadioGroup/FormRadioGroup.esm.js';
|
|
25
|
+
import 'dayjs';
|
|
26
|
+
export { default as YearPickerField } from './YearPickerField/YearPickerField.esm.js';
|
|
27
|
+
export { default as TimePicker } from './TimePicker/TimePicker.esm.js';
|
|
15
28
|
export { default as FormRenderFileUpload } from './FileUpload/FormRenderFileUpload.esm.js';
|
|
16
29
|
export { default as FormRenderMultiFileUpload } from './FileUpload/FormRenderMultiFileUpload.esm.js';
|
|
17
|
-
|
|
18
|
-
|
|
30
|
+
import '@mui/icons-material/Visibility';
|
|
31
|
+
import '@mui/icons-material/Close';
|
|
32
|
+
import '@mui/icons-material/NavigateBefore';
|
|
33
|
+
import '@mui/icons-material/NavigateNext';
|
|
34
|
+
import '@mui/icons-material/Delete';
|
|
35
|
+
import '@mui/icons-material/UploadFile';
|
|
36
|
+
import '@mui/icons-material/PictureAsPdf';
|
|
37
|
+
import '@mui/icons-material/TableChart';
|
|
38
|
+
import '@mui/icons-material/Description';
|
|
39
|
+
export { default as FormErrorField } from './FormErrorField/FormErrorField.esm.js';
|
|
19
40
|
export { default as HelperText } from './HelperText/HelperText.esm.js';
|
|
20
|
-
export { default as Monthpickerrender } from './DatePicker/Monthpickerrender.esm.js';
|
|
21
|
-
export { default as PasswordField } from './PasswordField/PasswordField.esm.js';
|
|
22
41
|
export { default as RichTextEditor } from './RichTextEditor/RichTextEditor.esm.js';
|
|
23
42
|
export { default as RichTextEditorWrapper } from './RichTextEditor/RichTextEditorWrapper.esm.js';
|
|
24
|
-
export { default as TimePicker } from './TimePicker/TimePicker.esm.js';
|
|
25
|
-
export { default as YearPickerField } from './YearPickerField/YearPickerField.esm.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TPColumnDef } from './types';
|
|
2
|
-
import { type TableCellProps } from '@mui/material';
|
|
2
|
+
import { type SxProps, type TableCellProps, type Theme } from '@mui/material';
|
|
3
3
|
import { type ServerFilterDef } from './DynamicFilterBar';
|
|
4
4
|
export type { ServerFilterDef };
|
|
5
5
|
export type { TPColumnDef } from './types';
|
|
@@ -217,6 +217,73 @@ export interface GenericPaginatedGridProps<TData extends object> {
|
|
|
217
217
|
column: any;
|
|
218
218
|
table: any;
|
|
219
219
|
}) => TableCellProps);
|
|
220
|
+
/**
|
|
221
|
+
* Per-row conditional styling — e.g. highlighting a row's background based
|
|
222
|
+
* on a status field. Called once per row with that row's **original data**
|
|
223
|
+
* (not the MRT `row` wrapper), so the condition logic reads naturally:
|
|
224
|
+
*
|
|
225
|
+
* ```tsx
|
|
226
|
+
* const STATUS_COLORS: Record<string, string> = {
|
|
227
|
+
* Pending: '#ffe0b2', // orange
|
|
228
|
+
* Acknowledged: '#fff9c4', // yellow
|
|
229
|
+
* Completed: '#bbdefb', // blue
|
|
230
|
+
* Released: '#c8e6c9', // green
|
|
231
|
+
* Overdue: '#f8bbd0', // pink
|
|
232
|
+
* };
|
|
233
|
+
*
|
|
234
|
+
* <GenericPaginatedGrid
|
|
235
|
+
* getRowSx={(row) => ({ backgroundColor: STATUS_COLORS[row.status] })}
|
|
236
|
+
* // ...
|
|
237
|
+
* />
|
|
238
|
+
* ```
|
|
239
|
+
*
|
|
240
|
+
* Return `undefined` (or omit a case) for rows that shouldn't be
|
|
241
|
+
* highlighted. Combines safely with row hover/selection styling — this
|
|
242
|
+
* only sets the base background, `sx` arrays layer on top.
|
|
243
|
+
*
|
|
244
|
+
* The same `backgroundColor` (a plain hex string, as in the example above)
|
|
245
|
+
* is also applied as a cell fill in the **Excel export**, so downloaded
|
|
246
|
+
* rows carry the same highlight seen on screen. A `color` (text colour) in
|
|
247
|
+
* the same object is likewise carried over as the exported cell's font
|
|
248
|
+
* colour — note that `color` only affects the Excel export; on screen,
|
|
249
|
+
* MUI's table cells already set their own text colour per cell, so a
|
|
250
|
+
* row-level `color` here has no visible effect in the grid itself (only
|
|
251
|
+
* `backgroundColor` is visible on screen). A theme-function `sx` (e.g.
|
|
252
|
+
* `(theme) => ({...})`) can't be resolved for the export without a live
|
|
253
|
+
* theme, so only plain `{ backgroundColor: '#RRGGBB', color: '#RRGGBB' }`
|
|
254
|
+
* objects (or arrays of them) are reflected there.
|
|
255
|
+
*/
|
|
256
|
+
getRowSx?: (row: TData) => SxProps<Theme> | undefined;
|
|
257
|
+
/**
|
|
258
|
+
* Per-column conditional header styling — e.g. drawing attention to a
|
|
259
|
+
* specific column's header with its own background/text colour. Called
|
|
260
|
+
* once per header cell with that column's `id` (its `accessorKey`) and
|
|
261
|
+
* resolved `header` label:
|
|
262
|
+
*
|
|
263
|
+
* ```tsx
|
|
264
|
+
* <GenericPaginatedGrid
|
|
265
|
+
* getHeaderSx={(col) =>
|
|
266
|
+
* col.id === 'priority' ? { backgroundColor: '#c62828', color: '#ffffff' } : undefined
|
|
267
|
+
* }
|
|
268
|
+
* // ...
|
|
269
|
+
* />
|
|
270
|
+
* ```
|
|
271
|
+
*
|
|
272
|
+
* Return `undefined` (or omit a case) for columns whose header should use
|
|
273
|
+
* the grid's normal `headerBgColor` styling. Merged on top of
|
|
274
|
+
* `headerBgColor`/column-level `muiTableHeadCellProps`, so it only needs to
|
|
275
|
+
* describe the override, not the whole header cell style.
|
|
276
|
+
*
|
|
277
|
+
* The same `backgroundColor`/`color` (plain hex strings) are also applied
|
|
278
|
+
* to that column's header cell in the **Excel export**, overriding
|
|
279
|
+
* `exportHeaderBgColor`/`exportHeaderTextColor` for just that column. Same
|
|
280
|
+
* theme-function limitation as `getRowSx` — only plain colour objects are
|
|
281
|
+
* reflected in the export.
|
|
282
|
+
*/
|
|
283
|
+
getHeaderSx?: (column: {
|
|
284
|
+
id: string;
|
|
285
|
+
header: string;
|
|
286
|
+
}) => SxProps<Theme> | undefined;
|
|
220
287
|
/**
|
|
221
288
|
* Optional render function for expanded row detail panels.
|
|
222
289
|
* When provided, enables row expansion and renders custom content for each expanded row.
|
|
@@ -239,5 +306,5 @@ export interface GenericPaginatedGridProps<TData extends object> {
|
|
|
239
306
|
*/
|
|
240
307
|
enableExpanding?: boolean;
|
|
241
308
|
}
|
|
242
|
-
declare function GenericPaginatedGrid<TData extends object>({ columns, fetchPage, queryKey, serverFilterDefs, defaultFilters, defaultVisibleFilterIds, batchSize, exportFilename, gridId, tableHeight, tableMinHeight, tableMaxHeight, autoFillViewport, layoutMode, uiDensity, uiDensityOptions, responsiveBreakpoints, disableResponsive, pageSizeOptions, showGlobalSearchByDefault, showDensityToggle, headerBgColor, exportHeaderBgColor, exportHeaderTextColor, headerMinHeight, headerMaxHeight, headerMaxLines, headerFontSize, bodyFontSize, maxVisibleFilters, muiTableBodyCellProps: gridBodyCellProps, muiTableHeadCellProps: gridHeadCellProps, renderDetailPanel, enableExpanding, }: GenericPaginatedGridProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
309
|
+
declare function GenericPaginatedGrid<TData extends object>({ columns, fetchPage, queryKey, serverFilterDefs, defaultFilters, defaultVisibleFilterIds, batchSize, exportFilename, gridId, tableHeight, tableMinHeight, tableMaxHeight, autoFillViewport, layoutMode, uiDensity, uiDensityOptions, responsiveBreakpoints, disableResponsive, pageSizeOptions, showGlobalSearchByDefault, showDensityToggle, headerBgColor, exportHeaderBgColor, exportHeaderTextColor, headerMinHeight, headerMaxHeight, headerMaxLines, headerFontSize, bodyFontSize, maxVisibleFilters, muiTableBodyCellProps: gridBodyCellProps, muiTableHeadCellProps: gridHeadCellProps, getRowSx, getHeaderSx, renderDetailPanel, enableExpanding, }: GenericPaginatedGridProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
243
310
|
export default GenericPaginatedGrid;
|
|
@@ -50,6 +50,34 @@ const toCssSize = (value, fallback) => {
|
|
|
50
50
|
return fallback;
|
|
51
51
|
return typeof value === 'number' ? `${value}px` : value;
|
|
52
52
|
};
|
|
53
|
+
/**
|
|
54
|
+
* Pulls `backgroundColor`/`bgcolor` and `color` out of an `SxProps` value
|
|
55
|
+
* returned by `getRowSx`/`getHeaderSx`, for reuse in the Excel export
|
|
56
|
+
* (matching the on-screen highlight). Only plain objects/arrays of plain
|
|
57
|
+
* objects are supported — a theme-function `sx` (e.g. `(theme) => ({...})`)
|
|
58
|
+
* can't be resolved without a live theme, so it's skipped (export proceeds
|
|
59
|
+
* with no override for that cell, exactly as if the callback had returned
|
|
60
|
+
* `undefined`).
|
|
61
|
+
*/
|
|
62
|
+
const extractSxColors = (sx) => {
|
|
63
|
+
const items = Array.isArray(sx) ? sx : [sx];
|
|
64
|
+
let background;
|
|
65
|
+
let text;
|
|
66
|
+
for (const item of items) {
|
|
67
|
+
if (item && typeof item === 'object') {
|
|
68
|
+
const obj = item;
|
|
69
|
+
if (typeof obj.backgroundColor === 'string')
|
|
70
|
+
background = obj.backgroundColor;
|
|
71
|
+
else if (typeof obj.bgcolor === 'string')
|
|
72
|
+
background = obj.bgcolor;
|
|
73
|
+
if (typeof obj.color === 'string')
|
|
74
|
+
text = obj.color;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return { background, text };
|
|
78
|
+
};
|
|
79
|
+
/** Converts a `#RRGGBB` hex string to the 8-char ARGB xlsx-js-style expects. Returns `undefined` for anything else. */
|
|
80
|
+
const hexToArgb = (hex) => hex?.startsWith('#') ? 'FF' + hex.slice(1).toUpperCase().padEnd(6, '0') : undefined;
|
|
53
81
|
/**
|
|
54
82
|
* Header overrides applied via GlobalStyles (literal prop values).
|
|
55
83
|
* MRT sets `backgroundColor: 'inherit'` and fixed density padding — must use !important.
|
|
@@ -141,7 +169,7 @@ const buildHeaderGlobalStyles = (headerMin, headerMax, headerFont, headerBgColor
|
|
|
141
169
|
};
|
|
142
170
|
};
|
|
143
171
|
/** Per-cell sx merged into MRT (via muiTableHeadCellProps). */
|
|
144
|
-
const buildHeaderCellSx = (align, headerMin, headerMax, headerFont, headerBgColor, headerMaxLines) => {
|
|
172
|
+
const buildHeaderCellSx = (align, headerMin, headerMax, headerFont, headerBgColor, headerMaxLines, headerTextColor) => {
|
|
145
173
|
const textAlign = align;
|
|
146
174
|
const flexJustify = align === 'right' ? 'flex-end' : align === 'center' ? 'center' : 'flex-start';
|
|
147
175
|
const wrapperClamp = headerMaxLines != null && headerMaxLines > 0
|
|
@@ -160,6 +188,7 @@ const buildHeaderCellSx = (align, headerMin, headerMax, headerFont, headerBgColo
|
|
|
160
188
|
...(headerBgColor
|
|
161
189
|
? { backgroundColor: `${headerBgColor} !important`, backgroundImage: 'none' }
|
|
162
190
|
: {}),
|
|
191
|
+
...(headerTextColor ? { color: `${headerTextColor} !important` } : {}),
|
|
163
192
|
height: `${headerMax} !important`,
|
|
164
193
|
minHeight: `${headerMin} !important`,
|
|
165
194
|
maxHeight: `${headerMax} !important`,
|
|
@@ -273,7 +302,7 @@ const PaginationFooter = ({ pageIndex, pageSize, totalRecords, isFetching, isLoa
|
|
|
273
302
|
}, children: pageIndex + 1 }), jsx(Tooltip, { title: "Next page", children: jsx("span", { children: jsx(IconButton, { id: `${gridId}_next_page_icon`, size: "small", onClick: onNext, disabled: !canNext, sx: { p: 0.5 }, children: jsx(ChevronRightIcon, { sx: { fontSize: density.footerIconSize } }) }) }) }), jsx(Tooltip, { title: "Last page", children: jsx("span", { children: jsx(IconButton, { id: `${gridId}_last_page_icon`, size: "small", onClick: onLast, disabled: !canNext, sx: { p: 0.5 }, children: jsx(LastPageIcon, { sx: { fontSize: density.footerIconSize } }) }) }) })] })] }));
|
|
274
303
|
};
|
|
275
304
|
// ─── GenericPaginatedGrid ─────────────────────────────────────────────────────
|
|
276
|
-
function GenericPaginatedGrid({ columns, fetchPage, queryKey, serverFilterDefs, defaultFilters, defaultVisibleFilterIds, batchSize = 10000, exportFilename = 'export', gridId, tableHeight, tableMinHeight = '300px', tableMaxHeight, autoFillViewport = true, layoutMode = 'grid', uiDensity, uiDensityOptions, responsiveBreakpoints, disableResponsive = false, pageSizeOptions = [1000, 5000, 10000], showGlobalSearchByDefault = false, showDensityToggle = false, headerBgColor, exportHeaderBgColor, exportHeaderTextColor, headerMinHeight, headerMaxHeight, headerMaxLines, headerFontSize, bodyFontSize, maxVisibleFilters = 4, muiTableBodyCellProps: gridBodyCellProps, muiTableHeadCellProps: gridHeadCellProps, renderDetailPanel, enableExpanding = !!renderDetailPanel, }) {
|
|
305
|
+
function GenericPaginatedGrid({ columns, fetchPage, queryKey, serverFilterDefs, defaultFilters, defaultVisibleFilterIds, batchSize = 10000, exportFilename = 'export', gridId, tableHeight, tableMinHeight = '300px', tableMaxHeight, autoFillViewport = true, layoutMode = 'grid', uiDensity, uiDensityOptions, responsiveBreakpoints, disableResponsive = false, pageSizeOptions = [1000, 5000, 10000], showGlobalSearchByDefault = false, showDensityToggle = false, headerBgColor, exportHeaderBgColor, exportHeaderTextColor, headerMinHeight, headerMaxHeight, headerMaxLines, headerFontSize, bodyFontSize, maxVisibleFilters = 4, muiTableBodyCellProps: gridBodyCellProps, muiTableHeadCellProps: gridHeadCellProps, getRowSx, getHeaderSx, renderDetailPanel, enableExpanding = !!renderDetailPanel, }) {
|
|
277
306
|
// ── Responsive tier detection ────────────────────────────────────────────────
|
|
278
307
|
// Three tiers (desktop / tablet / mobile) drive auto density, a progressively
|
|
279
308
|
// lower filter-chip cap, toolbar wrapping, and a stacked pagination footer —
|
|
@@ -559,20 +588,24 @@ function GenericPaginatedGrid({ columns, fetchPage, queryKey, serverFilterDefs,
|
|
|
559
588
|
? tableRef.current.getFilteredRowModel().rows.map((r) => r.original)
|
|
560
589
|
: rows;
|
|
561
590
|
const dataCols = columns.filter((c) => 'accessorKey' in c && c.accessorKey);
|
|
562
|
-
|
|
563
|
-
const
|
|
564
|
-
const headerArgb = toArgb(exportHeaderBgColor ?? headerBgColor);
|
|
565
|
-
const textArgb = toArgb(exportHeaderTextColor, 'FFFFFFFF');
|
|
591
|
+
const headerArgb = hexToArgb(exportHeaderBgColor ?? headerBgColor) ?? 'FF1565C0';
|
|
592
|
+
const textArgb = hexToArgb(exportHeaderTextColor) ?? 'FFFFFFFF';
|
|
566
593
|
const headerRow = dataCols.map((c) => c.header ?? '');
|
|
567
594
|
const dataRows = exportRows.map((row) => dataCols.map((c) => String(row[c.accessorKey] ?? '')));
|
|
568
595
|
const ws = XLSX.utils.aoa_to_sheet([headerRow, ...dataRows]);
|
|
569
|
-
// Style header row
|
|
570
|
-
|
|
596
|
+
// Style header row — `getHeaderSx` (per-column) overrides the grid-wide
|
|
597
|
+
// headerArgb/textArgb defaults for just that column, when it returns one.
|
|
598
|
+
dataCols.forEach((c, colIdx) => {
|
|
571
599
|
const cellRef = XLSX.utils.encode_cell({ r: 0, c: colIdx });
|
|
572
600
|
if (ws[cellRef]) {
|
|
601
|
+
const condSx = getHeaderSx?.({
|
|
602
|
+
id: c.accessorKey,
|
|
603
|
+
header: c.header ?? '',
|
|
604
|
+
});
|
|
605
|
+
const { background: condBg, text: condText } = extractSxColors(condSx);
|
|
573
606
|
ws[cellRef].s = {
|
|
574
|
-
fill: { patternType: 'solid', fgColor: { rgb: headerArgb } },
|
|
575
|
-
font: { bold: true, color: { rgb: textArgb }, sz: 10 },
|
|
607
|
+
fill: { patternType: 'solid', fgColor: { rgb: hexToArgb(condBg) ?? headerArgb } },
|
|
608
|
+
font: { bold: true, color: { rgb: hexToArgb(condText) ?? textArgb }, sz: 10 },
|
|
576
609
|
alignment: { horizontal: 'center', vertical: 'center', wrapText: true },
|
|
577
610
|
border: {
|
|
578
611
|
bottom: { style: 'thin', color: { rgb: 'FFCCCCCC' } },
|
|
@@ -581,6 +614,29 @@ function GenericPaginatedGrid({ columns, fetchPage, queryKey, serverFilterDefs,
|
|
|
581
614
|
};
|
|
582
615
|
}
|
|
583
616
|
});
|
|
617
|
+
// Apply each row's on-screen `getRowSx` highlight to the exported cells too.
|
|
618
|
+
// Unlike the header (which always has a colour), a row may resolve to no
|
|
619
|
+
// colour at all — skip whichever of background/text isn't set, rather
|
|
620
|
+
// than falling back to anything.
|
|
621
|
+
if (getRowSx) {
|
|
622
|
+
exportRows.forEach((row, rowIdx) => {
|
|
623
|
+
const { background: bgColor, text: textColor } = extractSxColors(getRowSx(row));
|
|
624
|
+
const bgArgb = hexToArgb(bgColor);
|
|
625
|
+
const fontArgb = hexToArgb(textColor);
|
|
626
|
+
if (!bgArgb && !fontArgb)
|
|
627
|
+
return;
|
|
628
|
+
dataCols.forEach((_, colIdx) => {
|
|
629
|
+
const cellRef = XLSX.utils.encode_cell({ r: rowIdx + 1, c: colIdx }); // +1: row 0 is the header
|
|
630
|
+
if (ws[cellRef]) {
|
|
631
|
+
ws[cellRef].s = {
|
|
632
|
+
...ws[cellRef].s,
|
|
633
|
+
...(bgArgb ? { fill: { patternType: 'solid', fgColor: { rgb: bgArgb } } } : {}),
|
|
634
|
+
...(fontArgb ? { font: { ...ws[cellRef].s?.font, color: { rgb: fontArgb } } } : {}),
|
|
635
|
+
};
|
|
636
|
+
}
|
|
637
|
+
});
|
|
638
|
+
});
|
|
639
|
+
}
|
|
584
640
|
// Auto-fit column widths — single O(n) pass accumulates max length per column
|
|
585
641
|
// instead of one reduce() per column (was O(n × cols)).
|
|
586
642
|
const colWidths = dataCols.map((c) => (c.header ?? '').length);
|
|
@@ -597,7 +653,7 @@ function GenericPaginatedGrid({ columns, fetchPage, queryKey, serverFilterDefs,
|
|
|
597
653
|
XLSX.utils.book_append_sheet(wb, ws, 'Data');
|
|
598
654
|
const suffix = scope === 'filtered' ? '-filtered' : '';
|
|
599
655
|
XLSX.writeFile(wb, `${exportFilename}${suffix}-page${pagination.pageIndex + 1}.xlsx`);
|
|
600
|
-
}, [columns, rows, exportFilename, pagination.pageIndex, headerBgColor, exportHeaderBgColor, exportHeaderTextColor]);
|
|
656
|
+
}, [columns, rows, exportFilename, pagination.pageIndex, headerBgColor, exportHeaderBgColor, exportHeaderTextColor, getRowSx, getHeaderSx]);
|
|
601
657
|
// ── Memoized cell-prop builders ───────────────────────────────────────────
|
|
602
658
|
// These are functions passed to MRT per-cell. Without useCallback they get
|
|
603
659
|
// new references on every render, forcing MRT to rebuild every cell's sx.
|
|
@@ -611,15 +667,31 @@ function GenericPaginatedGrid({ columns, fetchPage, queryKey, serverFilterDefs,
|
|
|
611
667
|
const align = (colResolved.align ?? gridResolved.align ?? 'left');
|
|
612
668
|
const { sx: gridSx, align: _ga, ...gridRest } = gridResolved;
|
|
613
669
|
const { sx: colSx, align: _ca, ...colRest } = colResolved;
|
|
670
|
+
const headerCondSx = getHeaderSx?.({
|
|
671
|
+
id: column.id,
|
|
672
|
+
header: column.columnDef.header ?? '',
|
|
673
|
+
});
|
|
674
|
+
const { background: headerCondBg, text: headerCondText } = extractSxColors(headerCondSx);
|
|
614
675
|
return {
|
|
615
676
|
...gridRest,
|
|
616
677
|
...colRest,
|
|
617
678
|
align,
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
679
|
+
// NOTE: MRT reads this `sx` via `parseFromValuesOrFunc(tableCellProps?.sx, theme)`
|
|
680
|
+
// internally (see material-react-table's `getCommonMRTCellStyles`), which only
|
|
681
|
+
// special-cases *functions* — an array (MUI's own normal multi-entry `sx` form)
|
|
682
|
+
// is returned as-is and then spread by numeric index, silently discarding every
|
|
683
|
+
// style in it. A single theme-aware function is the only form MRT actually merges
|
|
684
|
+
// in at this integration point, so all layers are combined manually below instead
|
|
685
|
+
// of relying on array-based sx composition.
|
|
686
|
+
sx: (theme) => {
|
|
687
|
+
const resolve = (s) => (typeof s === 'function' ? s(theme) : s) ?? {};
|
|
688
|
+
return {
|
|
689
|
+
...buildHeaderCellSx(align, resolvedHeaderMinHeight, resolvedHeaderMaxHeight, resolvedHeaderFontSize, headerCondBg ?? headerBgColor, headerMaxLines, headerCondText),
|
|
690
|
+
...resolve(gridSx),
|
|
691
|
+
...resolve(colSx),
|
|
692
|
+
...resolve(headerCondSx),
|
|
693
|
+
};
|
|
694
|
+
},
|
|
623
695
|
};
|
|
624
696
|
}, [
|
|
625
697
|
resolvedHeaderMinHeight,
|
|
@@ -628,6 +700,7 @@ function GenericPaginatedGrid({ columns, fetchPage, queryKey, serverFilterDefs,
|
|
|
628
700
|
headerBgColor,
|
|
629
701
|
headerMaxLines,
|
|
630
702
|
gridHeadCellProps,
|
|
703
|
+
getHeaderSx,
|
|
631
704
|
]);
|
|
632
705
|
const memoizedBodyCellProps = useCallback((params) => {
|
|
633
706
|
const { cell, column, row, table } = params;
|
|
@@ -653,6 +726,13 @@ function GenericPaginatedGrid({ columns, fetchPage, queryKey, serverFilterDefs,
|
|
|
653
726
|
],
|
|
654
727
|
};
|
|
655
728
|
}, [resolvedBodyFontSize, gridBodyCellProps]);
|
|
729
|
+
// Row-level conditional highlighting (see `getRowSx` prop doc). Only wired
|
|
730
|
+
// up when the consumer actually supplies it, so grids that don't use this
|
|
731
|
+
// feature pay zero extra cost (MRT falls back to no muiTableBodyRowProps).
|
|
732
|
+
const memoizedBodyRowProps = useCallback(({ row }) => {
|
|
733
|
+
const sx = getRowSx?.(row.original);
|
|
734
|
+
return sx ? { sx } : {};
|
|
735
|
+
}, [getRowSx]);
|
|
656
736
|
// ── Memoized toolbar render functions ─────────────────────────────────────
|
|
657
737
|
// Defined with useCallback so MRT receives stable references and does not
|
|
658
738
|
// re-render the toolbar on every isFetching / data update cycle.
|
|
@@ -859,6 +939,7 @@ function GenericPaginatedGrid({ columns, fetchPage, queryKey, serverFilterDefs,
|
|
|
859
939
|
},
|
|
860
940
|
muiTableHeadCellProps: memoizedHeadCellProps,
|
|
861
941
|
muiTableBodyCellProps: memoizedBodyCellProps,
|
|
942
|
+
muiTableBodyRowProps: memoizedBodyRowProps,
|
|
862
943
|
muiToolbarAlertBannerProps: isError
|
|
863
944
|
? { color: 'error', children: 'Failed to load data. Please try again.' }
|
|
864
945
|
: undefined,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __module as propTypes } from '../../_virtual/index.
|
|
1
|
+
import { __module as propTypes } from '../../_virtual/index.esm9.js';
|
|
2
2
|
import { __require as requireReactIs } from './node_modules/react-is/index.esm.js';
|
|
3
3
|
import { __require as requireFactoryWithTypeCheckers } from './factoryWithTypeCheckers.esm.js';
|
|
4
4
|
import { __require as requireFactoryWithThrowingShims } from './factoryWithThrowingShims.esm.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exports as accessibility } from '../../../../_virtual/index.
|
|
1
|
+
import { __exports as accessibility } from '../../../../_virtual/index.esm10.js';
|
|
2
2
|
import { __require as requirePropTypes } from '../../../prop-types/index.esm.js';
|
|
3
3
|
|
|
4
4
|
var hasRequiredAccessibility;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exports as DateInput } from '../../../../../_virtual/index.
|
|
1
|
+
import { __exports as DateInput } from '../../../../../_virtual/index.esm13.js';
|
|
2
2
|
import require$$0__default from 'react';
|
|
3
3
|
import { __require as requirePropTypes } from '../../../../prop-types/index.esm.js';
|
|
4
4
|
import { __require as requireClassnames } from '../../../../classnames/index.esm.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exports as Month } from '../../../../../_virtual/index.
|
|
1
|
+
import { __exports as Month } from '../../../../../_virtual/index.esm14.js';
|
|
2
2
|
import require$$0__default from 'react';
|
|
3
3
|
import { __require as requirePropTypes } from '../../../../prop-types/index.esm.js';
|
|
4
4
|
import { __require as requireDayCell } from '../DayCell/index.esm.js';
|
package/package.json
CHANGED
|
@@ -1,211 +1,211 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "tp-react-elements",
|
|
3
|
-
"version": "3.0.
|
|
4
|
-
"private": false,
|
|
5
|
-
"type": "module",
|
|
6
|
-
"description": "React form components library built with React Hook Form and Yup",
|
|
7
|
-
"main": "dist/index.esm.js",
|
|
8
|
-
"module": "dist/index.esm.js",
|
|
9
|
-
"types": "dist/index.d.ts",
|
|
10
|
-
"exports": {
|
|
11
|
-
".": {
|
|
12
|
-
"import": "./dist/index.esm.js",
|
|
13
|
-
"types": "./dist/index.d.ts"
|
|
14
|
-
},
|
|
15
|
-
"./form": {
|
|
16
|
-
"import": "./dist/components/Form/index.esm.js",
|
|
17
|
-
"types": "./dist/components/Form/index.d.ts"
|
|
18
|
-
},
|
|
19
|
-
"./utils": {
|
|
20
|
-
"import": "./dist/utils/index.esm.js",
|
|
21
|
-
"types": "./dist/utils/index.d.ts"
|
|
22
|
-
},
|
|
23
|
-
"./validation": {
|
|
24
|
-
"import": "./dist/validation/index.esm.js",
|
|
25
|
-
"types": "./dist/validation/index.d.ts"
|
|
26
|
-
},
|
|
27
|
-
"./components/*": {
|
|
28
|
-
"import": "./dist/components/*/index.esm.js",
|
|
29
|
-
"types": "./dist/components/*/index.d.ts"
|
|
30
|
-
},
|
|
31
|
-
"./theme": {
|
|
32
|
-
"import": "./dist/theme/index.esm.js",
|
|
33
|
-
"types": "./dist/theme/index.d.ts"
|
|
34
|
-
},
|
|
35
|
-
"./package.json": "./package.json"
|
|
36
|
-
},
|
|
37
|
-
"bin": {
|
|
38
|
-
"install-tp-form-deps": "./scripts/install-deps.js"
|
|
39
|
-
},
|
|
40
|
-
"files": [
|
|
41
|
-
"dist",
|
|
42
|
-
"scripts"
|
|
43
|
-
],
|
|
44
|
-
"sideEffects": [
|
|
45
|
-
"*.css",
|
|
46
|
-
"*.scss"
|
|
47
|
-
],
|
|
48
|
-
"scripts": {
|
|
49
|
-
"dev": "vite",
|
|
50
|
-
"preview": "vite preview",
|
|
51
|
-
"clean": "rimraf dist dist-dev",
|
|
52
|
-
"type-check": "tsc --noEmit",
|
|
53
|
-
"build:types": "tsc --project tsconfig.build.json --emitDeclarationOnly && tsc-alias -p tsconfig.build.json && echo \"✅ TypeScript declaration files generated successfully!\"",
|
|
54
|
-
"build:types:qa": "tsc --project tsconfig.build.qa.json --emitDeclarationOnly && tsc-alias -p tsconfig.build.qa.json && echo \"✅ QA declaration files (with maps) generated!\"",
|
|
55
|
-
"build:esm": "npm run clean && rollup -c rollup.config.js",
|
|
56
|
-
"build:lib": "npm run clean && rollup -c rollup.config.js && npm run build:types && echo \"✅ Complete library build finished! ESM build completed successfully!\"",
|
|
57
|
-
"build:lib:qa": "npm run clean && rollup -c rollup.config.js && npm run build:types:qa && echo \"✅ QA build finished (includes .d.ts.map)\"",
|
|
58
|
-
"analyze": "npm run clean && cross-env BUNDLE_ANALYZE=true rollup -c rollup.config.js",
|
|
59
|
-
"analyze:dev": "cross-env ANALYZE_BUNDLE=true vite build",
|
|
60
|
-
"test": "vitest",
|
|
61
|
-
"test:ui": "vitest --ui",
|
|
62
|
-
"test:coverage": "vitest --coverage",
|
|
63
|
-
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
64
|
-
"lint:fix": "eslint . --ext ts,tsx --fix",
|
|
65
|
-
"format": "prettier --write \"src/**/*.{js,jsx,ts,tsx,css,scss,md,json}\"",
|
|
66
|
-
"format:check": "prettier --check \"src/**/*.{js,jsx,ts,tsx,css,scss,md,json}\"",
|
|
67
|
-
"storybook": "storybook dev -p 6006",
|
|
68
|
-
"build-storybook": "storybook build",
|
|
69
|
-
"version:patch": "npm version patch",
|
|
70
|
-
"version:minor": "npm version minor",
|
|
71
|
-
"version:major": "npm version major",
|
|
72
|
-
"publish:prepare": "npm run build:lib && npm run type-check",
|
|
73
|
-
"publish:npm": "npm publish",
|
|
74
|
-
"publish:beta": "npm publish --tag beta",
|
|
75
|
-
"publish:patch": "npm version patch --no-git-tag-version && npm publish",
|
|
76
|
-
"publish:minor": "npm version minor --no-git-tag-version && npm publish",
|
|
77
|
-
"publish:major": "npm version major --no-git-tag-version && npm publish",
|
|
78
|
-
"publish:auto": "npm run publish:prepare && npm publish",
|
|
79
|
-
"install-peers": "install-tp-form-deps",
|
|
80
|
-
"package-build": "rollup -c --bundleConfigAsCjs",
|
|
81
|
-
"prepublishOnly": "npm run build:lib"
|
|
82
|
-
},
|
|
83
|
-
"peerDependencies": {
|
|
84
|
-
"@emotion/react": ">=11.14.0 <13.0.0",
|
|
85
|
-
"@emotion/styled": ">=11.14.1 <13.0.0",
|
|
86
|
-
"@hookform/error-message": ">=2.0.1 <3.0.0",
|
|
87
|
-
"@hookform/resolvers": ">=5.2.1 <6.0.0",
|
|
88
|
-
"@mui/icons-material": ">=7.3.1 <8.0.0",
|
|
89
|
-
"@mui/material": ">=7.3.1 <8.0.0",
|
|
90
|
-
"@mui/x-date-pickers": ">=8.10.2 <9.0.0",
|
|
91
|
-
"@tanstack/react-query": ">=5.0.0 <6.0.0",
|
|
92
|
-
"crypto-js": ">=4.2.0 <5.0.0",
|
|
93
|
-
"dayjs": ">=1.11.13 <2.0.0",
|
|
94
|
-
"file-saver": ">=2.0.5 <3.0.0",
|
|
95
|
-
"jodit": ">=4.6.2 <5.0.0",
|
|
96
|
-
"jodit-react": ">=5.2.19 <6.0.0",
|
|
97
|
-
"material-react-table": ">=3.0.0 <4.0.0",
|
|
98
|
-
"react": ">=18 <20",
|
|
99
|
-
"react-dom": ">=18 <20",
|
|
100
|
-
"react-hook-form": ">=7.62.0 <8.0.0",
|
|
101
|
-
"react-idle-timer": ">=5.7.2 <6.0.0",
|
|
102
|
-
"xlsx-js-style": ">=1.2.0 <2.0.0",
|
|
103
|
-
"yup": ">=1.7.0 <2.0.0"
|
|
104
|
-
},
|
|
105
|
-
"peerDependenciesMeta": {
|
|
106
|
-
"@tanstack/react-query": {
|
|
107
|
-
"optional": true
|
|
108
|
-
},
|
|
109
|
-
"react-idle-timer": {
|
|
110
|
-
"optional": true
|
|
111
|
-
},
|
|
112
|
-
"jodit": {
|
|
113
|
-
"optional": true
|
|
114
|
-
},
|
|
115
|
-
"jodit-react": {
|
|
116
|
-
"optional": true
|
|
117
|
-
},
|
|
118
|
-
"material-react-table": {
|
|
119
|
-
"optional": true
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
"devDependencies": {
|
|
123
|
-
"@emotion/react": "^11.14.0",
|
|
124
|
-
"@emotion/styled": "^11.14.1",
|
|
125
|
-
"@hookform/error-message": "^2.0.1",
|
|
126
|
-
"@hookform/resolvers": "^5.2.1",
|
|
127
|
-
"@mui/icons-material": "^7.3.1",
|
|
128
|
-
"@mui/material": "^7.3.1",
|
|
129
|
-
"@mui/x-date-pickers": "^8.10.2",
|
|
130
|
-
"@rollup/plugin-commonjs": "^28.0.6",
|
|
131
|
-
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
132
|
-
"@rollup/plugin-typescript": "^12.1.4",
|
|
133
|
-
"@storybook/addon-docs": "^10.4.2",
|
|
134
|
-
"@storybook/addon-links": "^10.4.2",
|
|
135
|
-
"@storybook/react-vite": "^10.4.2",
|
|
136
|
-
"@tanstack/react-query": "^5.100.14",
|
|
137
|
-
"@testing-library/jest-dom": "^6.5.0",
|
|
138
|
-
"@testing-library/react": "^16.0.1",
|
|
139
|
-
"@testing-library/user-event": "^14.5.2",
|
|
140
|
-
"@types/crypto-js": "^4.2.2",
|
|
141
|
-
"@types/file-saver": "^2.0.7",
|
|
142
|
-
"@types/node": "^22.11.0",
|
|
143
|
-
"@types/react": "^19.0.0",
|
|
144
|
-
"@types/react-dom": "^19.0.0",
|
|
145
|
-
"@typescript-eslint/eslint-plugin": "^8.8.0",
|
|
146
|
-
"@typescript-eslint/parser": "^8.8.0",
|
|
147
|
-
"@vitejs/plugin-react": "^4.3.1",
|
|
148
|
-
"@vitest/coverage-v8": "^3.0.0",
|
|
149
|
-
"@vitest/ui": "^3.0.0",
|
|
150
|
-
"cross-env": "^10.0.0",
|
|
151
|
-
"crypto-js": "^4.2.0",
|
|
152
|
-
"dayjs": "^1.11.13",
|
|
153
|
-
"eslint": "^9.12.0",
|
|
154
|
-
"eslint-config-prettier": "^9.1.0",
|
|
155
|
-
"eslint-plugin-react": "^7.37.1",
|
|
156
|
-
"eslint-plugin-react-hooks": "^5.0.0",
|
|
157
|
-
"eslint-plugin-react-refresh": "^0.4.12",
|
|
158
|
-
"eslint-plugin-storybook": "10.4.2",
|
|
159
|
-
"file-saver": "^2.0.5",
|
|
160
|
-
"glob": "^10.4.5",
|
|
161
|
-
"jodit": "^4.6.2",
|
|
162
|
-
"jodit-react": "^5.2.19",
|
|
163
|
-
"jsdom": "^25.0.0",
|
|
164
|
-
"material-react-table": "^3.2.1",
|
|
165
|
-
"prettier": "^3.6.2",
|
|
166
|
-
"react": "^19.1.1",
|
|
167
|
-
"react-dom": "^19.1.1",
|
|
168
|
-
"react-hook-form": "^7.62.0",
|
|
169
|
-
"react-idle-timer": "^5.7.2",
|
|
170
|
-
"rimraf": "^5.0.7",
|
|
171
|
-
"rollup": "^4.22.4",
|
|
172
|
-
"rollup-plugin-analyzer": "^4.0.0",
|
|
173
|
-
"rollup-plugin-bundle-size": "^1.0.3",
|
|
174
|
-
"rollup-plugin-copy": "^3.5.0",
|
|
175
|
-
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
176
|
-
"rollup-plugin-postcss": "^4.0.2",
|
|
177
|
-
"rollup-plugin-visualizer": "^5.14.0",
|
|
178
|
-
"sass-embedded": "^1.90.0",
|
|
179
|
-
"storybook": "^10.4.2",
|
|
180
|
-
"tsc-alias": "^1.8.16",
|
|
181
|
-
"typescript": "^5.5.4",
|
|
182
|
-
"vite": "^6.0.0",
|
|
183
|
-
"vitest": "^3.0.0",
|
|
184
|
-
"xlsx-js-style": "^1.2.0",
|
|
185
|
-
"yup": "^1.7.0"
|
|
186
|
-
},
|
|
187
|
-
"keywords": [
|
|
188
|
-
"react",
|
|
189
|
-
"forms",
|
|
190
|
-
"components",
|
|
191
|
-
"react-hook-form",
|
|
192
|
-
"yup",
|
|
193
|
-
"typescript"
|
|
194
|
-
],
|
|
195
|
-
"author": "Mohammad Asheesh",
|
|
196
|
-
"contributors": [
|
|
197
|
-
"Karthik Mayandi",
|
|
198
|
-
"Other Dev"
|
|
199
|
-
],
|
|
200
|
-
"license": "MIT",
|
|
201
|
-
"engines": {
|
|
202
|
-
"node": ">=18.17.0 || >=20.11.0",
|
|
203
|
-
"npm": ">=10.9.0"
|
|
204
|
-
},
|
|
205
|
-
"dependencies": {
|
|
206
|
-
"@types/react-date-range": "^1.4.10",
|
|
207
|
-
"axios": "^1.13.2",
|
|
208
|
-
"date-fns": "^4.1.0",
|
|
209
|
-
"react-date-range": "^2.0.1"
|
|
210
|
-
}
|
|
211
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "tp-react-elements",
|
|
3
|
+
"version": "3.0.5",
|
|
4
|
+
"private": false,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"description": "React form components library built with React Hook Form and Yup",
|
|
7
|
+
"main": "dist/index.esm.js",
|
|
8
|
+
"module": "dist/index.esm.js",
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": "./dist/index.esm.js",
|
|
13
|
+
"types": "./dist/index.d.ts"
|
|
14
|
+
},
|
|
15
|
+
"./form": {
|
|
16
|
+
"import": "./dist/components/Form/index.esm.js",
|
|
17
|
+
"types": "./dist/components/Form/index.d.ts"
|
|
18
|
+
},
|
|
19
|
+
"./utils": {
|
|
20
|
+
"import": "./dist/utils/index.esm.js",
|
|
21
|
+
"types": "./dist/utils/index.d.ts"
|
|
22
|
+
},
|
|
23
|
+
"./validation": {
|
|
24
|
+
"import": "./dist/validation/index.esm.js",
|
|
25
|
+
"types": "./dist/validation/index.d.ts"
|
|
26
|
+
},
|
|
27
|
+
"./components/*": {
|
|
28
|
+
"import": "./dist/components/*/index.esm.js",
|
|
29
|
+
"types": "./dist/components/*/index.d.ts"
|
|
30
|
+
},
|
|
31
|
+
"./theme": {
|
|
32
|
+
"import": "./dist/theme/index.esm.js",
|
|
33
|
+
"types": "./dist/theme/index.d.ts"
|
|
34
|
+
},
|
|
35
|
+
"./package.json": "./package.json"
|
|
36
|
+
},
|
|
37
|
+
"bin": {
|
|
38
|
+
"install-tp-form-deps": "./scripts/install-deps.js"
|
|
39
|
+
},
|
|
40
|
+
"files": [
|
|
41
|
+
"dist",
|
|
42
|
+
"scripts"
|
|
43
|
+
],
|
|
44
|
+
"sideEffects": [
|
|
45
|
+
"*.css",
|
|
46
|
+
"*.scss"
|
|
47
|
+
],
|
|
48
|
+
"scripts": {
|
|
49
|
+
"dev": "vite",
|
|
50
|
+
"preview": "vite preview",
|
|
51
|
+
"clean": "rimraf dist dist-dev",
|
|
52
|
+
"type-check": "tsc --noEmit",
|
|
53
|
+
"build:types": "tsc --project tsconfig.build.json --emitDeclarationOnly && tsc-alias -p tsconfig.build.json && echo \"✅ TypeScript declaration files generated successfully!\"",
|
|
54
|
+
"build:types:qa": "tsc --project tsconfig.build.qa.json --emitDeclarationOnly && tsc-alias -p tsconfig.build.qa.json && echo \"✅ QA declaration files (with maps) generated!\"",
|
|
55
|
+
"build:esm": "npm run clean && rollup -c rollup.config.js",
|
|
56
|
+
"build:lib": "npm run clean && rollup -c rollup.config.js && npm run build:types && echo \"✅ Complete library build finished! ESM build completed successfully!\"",
|
|
57
|
+
"build:lib:qa": "npm run clean && rollup -c rollup.config.js && npm run build:types:qa && echo \"✅ QA build finished (includes .d.ts.map)\"",
|
|
58
|
+
"analyze": "npm run clean && cross-env BUNDLE_ANALYZE=true rollup -c rollup.config.js",
|
|
59
|
+
"analyze:dev": "cross-env ANALYZE_BUNDLE=true vite build",
|
|
60
|
+
"test": "vitest",
|
|
61
|
+
"test:ui": "vitest --ui",
|
|
62
|
+
"test:coverage": "vitest --coverage",
|
|
63
|
+
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
64
|
+
"lint:fix": "eslint . --ext ts,tsx --fix",
|
|
65
|
+
"format": "prettier --write \"src/**/*.{js,jsx,ts,tsx,css,scss,md,json}\"",
|
|
66
|
+
"format:check": "prettier --check \"src/**/*.{js,jsx,ts,tsx,css,scss,md,json}\"",
|
|
67
|
+
"storybook": "storybook dev -p 6006",
|
|
68
|
+
"build-storybook": "storybook build",
|
|
69
|
+
"version:patch": "npm version patch",
|
|
70
|
+
"version:minor": "npm version minor",
|
|
71
|
+
"version:major": "npm version major",
|
|
72
|
+
"publish:prepare": "npm run build:lib && npm run type-check",
|
|
73
|
+
"publish:npm": "npm publish",
|
|
74
|
+
"publish:beta": "npm publish --tag beta",
|
|
75
|
+
"publish:patch": "npm version patch --no-git-tag-version && npm publish",
|
|
76
|
+
"publish:minor": "npm version minor --no-git-tag-version && npm publish",
|
|
77
|
+
"publish:major": "npm version major --no-git-tag-version && npm publish",
|
|
78
|
+
"publish:auto": "npm run publish:prepare && npm publish",
|
|
79
|
+
"install-peers": "install-tp-form-deps",
|
|
80
|
+
"package-build": "rollup -c --bundleConfigAsCjs",
|
|
81
|
+
"prepublishOnly": "npm run build:lib"
|
|
82
|
+
},
|
|
83
|
+
"peerDependencies": {
|
|
84
|
+
"@emotion/react": ">=11.14.0 <13.0.0",
|
|
85
|
+
"@emotion/styled": ">=11.14.1 <13.0.0",
|
|
86
|
+
"@hookform/error-message": ">=2.0.1 <3.0.0",
|
|
87
|
+
"@hookform/resolvers": ">=5.2.1 <6.0.0",
|
|
88
|
+
"@mui/icons-material": ">=7.3.1 <8.0.0",
|
|
89
|
+
"@mui/material": ">=7.3.1 <8.0.0",
|
|
90
|
+
"@mui/x-date-pickers": ">=8.10.2 <9.0.0",
|
|
91
|
+
"@tanstack/react-query": ">=5.0.0 <6.0.0",
|
|
92
|
+
"crypto-js": ">=4.2.0 <5.0.0",
|
|
93
|
+
"dayjs": ">=1.11.13 <2.0.0",
|
|
94
|
+
"file-saver": ">=2.0.5 <3.0.0",
|
|
95
|
+
"jodit": ">=4.6.2 <5.0.0",
|
|
96
|
+
"jodit-react": ">=5.2.19 <6.0.0",
|
|
97
|
+
"material-react-table": ">=3.0.0 <4.0.0",
|
|
98
|
+
"react": ">=18 <20",
|
|
99
|
+
"react-dom": ">=18 <20",
|
|
100
|
+
"react-hook-form": ">=7.62.0 <8.0.0",
|
|
101
|
+
"react-idle-timer": ">=5.7.2 <6.0.0",
|
|
102
|
+
"xlsx-js-style": ">=1.2.0 <2.0.0",
|
|
103
|
+
"yup": ">=1.7.0 <2.0.0"
|
|
104
|
+
},
|
|
105
|
+
"peerDependenciesMeta": {
|
|
106
|
+
"@tanstack/react-query": {
|
|
107
|
+
"optional": true
|
|
108
|
+
},
|
|
109
|
+
"react-idle-timer": {
|
|
110
|
+
"optional": true
|
|
111
|
+
},
|
|
112
|
+
"jodit": {
|
|
113
|
+
"optional": true
|
|
114
|
+
},
|
|
115
|
+
"jodit-react": {
|
|
116
|
+
"optional": true
|
|
117
|
+
},
|
|
118
|
+
"material-react-table": {
|
|
119
|
+
"optional": true
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
"devDependencies": {
|
|
123
|
+
"@emotion/react": "^11.14.0",
|
|
124
|
+
"@emotion/styled": "^11.14.1",
|
|
125
|
+
"@hookform/error-message": "^2.0.1",
|
|
126
|
+
"@hookform/resolvers": "^5.2.1",
|
|
127
|
+
"@mui/icons-material": "^7.3.1",
|
|
128
|
+
"@mui/material": "^7.3.1",
|
|
129
|
+
"@mui/x-date-pickers": "^8.10.2",
|
|
130
|
+
"@rollup/plugin-commonjs": "^28.0.6",
|
|
131
|
+
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
132
|
+
"@rollup/plugin-typescript": "^12.1.4",
|
|
133
|
+
"@storybook/addon-docs": "^10.4.2",
|
|
134
|
+
"@storybook/addon-links": "^10.4.2",
|
|
135
|
+
"@storybook/react-vite": "^10.4.2",
|
|
136
|
+
"@tanstack/react-query": "^5.100.14",
|
|
137
|
+
"@testing-library/jest-dom": "^6.5.0",
|
|
138
|
+
"@testing-library/react": "^16.0.1",
|
|
139
|
+
"@testing-library/user-event": "^14.5.2",
|
|
140
|
+
"@types/crypto-js": "^4.2.2",
|
|
141
|
+
"@types/file-saver": "^2.0.7",
|
|
142
|
+
"@types/node": "^22.11.0",
|
|
143
|
+
"@types/react": "^19.0.0",
|
|
144
|
+
"@types/react-dom": "^19.0.0",
|
|
145
|
+
"@typescript-eslint/eslint-plugin": "^8.8.0",
|
|
146
|
+
"@typescript-eslint/parser": "^8.8.0",
|
|
147
|
+
"@vitejs/plugin-react": "^4.3.1",
|
|
148
|
+
"@vitest/coverage-v8": "^3.0.0",
|
|
149
|
+
"@vitest/ui": "^3.0.0",
|
|
150
|
+
"cross-env": "^10.0.0",
|
|
151
|
+
"crypto-js": "^4.2.0",
|
|
152
|
+
"dayjs": "^1.11.13",
|
|
153
|
+
"eslint": "^9.12.0",
|
|
154
|
+
"eslint-config-prettier": "^9.1.0",
|
|
155
|
+
"eslint-plugin-react": "^7.37.1",
|
|
156
|
+
"eslint-plugin-react-hooks": "^5.0.0",
|
|
157
|
+
"eslint-plugin-react-refresh": "^0.4.12",
|
|
158
|
+
"eslint-plugin-storybook": "10.4.2",
|
|
159
|
+
"file-saver": "^2.0.5",
|
|
160
|
+
"glob": "^10.4.5",
|
|
161
|
+
"jodit": "^4.6.2",
|
|
162
|
+
"jodit-react": "^5.2.19",
|
|
163
|
+
"jsdom": "^25.0.0",
|
|
164
|
+
"material-react-table": "^3.2.1",
|
|
165
|
+
"prettier": "^3.6.2",
|
|
166
|
+
"react": "^19.1.1",
|
|
167
|
+
"react-dom": "^19.1.1",
|
|
168
|
+
"react-hook-form": "^7.62.0",
|
|
169
|
+
"react-idle-timer": "^5.7.2",
|
|
170
|
+
"rimraf": "^5.0.7",
|
|
171
|
+
"rollup": "^4.22.4",
|
|
172
|
+
"rollup-plugin-analyzer": "^4.0.0",
|
|
173
|
+
"rollup-plugin-bundle-size": "^1.0.3",
|
|
174
|
+
"rollup-plugin-copy": "^3.5.0",
|
|
175
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
176
|
+
"rollup-plugin-postcss": "^4.0.2",
|
|
177
|
+
"rollup-plugin-visualizer": "^5.14.0",
|
|
178
|
+
"sass-embedded": "^1.90.0",
|
|
179
|
+
"storybook": "^10.4.2",
|
|
180
|
+
"tsc-alias": "^1.8.16",
|
|
181
|
+
"typescript": "^5.5.4",
|
|
182
|
+
"vite": "^6.0.0",
|
|
183
|
+
"vitest": "^3.0.0",
|
|
184
|
+
"xlsx-js-style": "^1.2.0",
|
|
185
|
+
"yup": "^1.7.0"
|
|
186
|
+
},
|
|
187
|
+
"keywords": [
|
|
188
|
+
"react",
|
|
189
|
+
"forms",
|
|
190
|
+
"components",
|
|
191
|
+
"react-hook-form",
|
|
192
|
+
"yup",
|
|
193
|
+
"typescript"
|
|
194
|
+
],
|
|
195
|
+
"author": "Mohammad Asheesh",
|
|
196
|
+
"contributors": [
|
|
197
|
+
"Karthik Mayandi",
|
|
198
|
+
"Other Dev"
|
|
199
|
+
],
|
|
200
|
+
"license": "MIT",
|
|
201
|
+
"engines": {
|
|
202
|
+
"node": ">=18.17.0 || >=20.11.0",
|
|
203
|
+
"npm": ">=10.9.0"
|
|
204
|
+
},
|
|
205
|
+
"dependencies": {
|
|
206
|
+
"@types/react-date-range": "^1.4.10",
|
|
207
|
+
"axios": "^1.13.2",
|
|
208
|
+
"date-fns": "^4.1.0",
|
|
209
|
+
"react-date-range": "^2.0.1"
|
|
210
|
+
}
|
|
211
|
+
}
|