@prediktif/ui 0.1.19 → 0.1.20

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.mts CHANGED
@@ -41,12 +41,6 @@ interface AppSidebarProps {
41
41
  }
42
42
  declare const AppSidebar: react.NamedExoticComponent<AppSidebarProps>;
43
43
 
44
- declare const buttonVariants: (props?: ({
45
- variant?: "default" | "outline" | "secondary" | "ghost" | "destructive" | "link" | null | undefined;
46
- size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
47
- } & class_variance_authority_types.ClassProp) | undefined) => string;
48
- declare function Button({ className, variant, size, ...props }: Button$1.Props & VariantProps<typeof buttonVariants>): react.JSX.Element;
49
-
50
44
  /**
51
45
  * Configure TanStack Table features used by DataTable.
52
46
  * Enables column/global filtering, visibility toggling, pagination, row selection, and sorting.
@@ -131,16 +125,19 @@ declare function exportToXLSX(rows: ExportRow[], filename?: string): void;
131
125
  */
132
126
  declare function exportToCSV(rows: ExportRow[], filename?: string): void;
133
127
  /**
134
- * Print or export as PDF by opening a styled print window.
128
+ * Directly generate and download a PDF file of the table data using jsPDF and jspdf-autotable.
129
+ */
130
+ declare function exportToPDF(headers: string[], rows: string[][], filename?: string, title?: string): Promise<void>;
131
+ /**
132
+ * Print table by opening a styled print popup window.
135
133
  */
136
134
  declare function printTable(headers: string[], rows: string[][], title?: string): void;
137
135
 
138
136
  interface DataTableContentBodyProps<TData extends RowData> {
139
137
  table: Table<DataTableFeatures, TData>;
140
138
  columns: ColumnDef<DataTableFeatures, TData>[];
141
- isLoading?: boolean;
142
139
  }
143
- declare function DataTableContentBody<TData extends RowData>({ table, columns, isLoading, }: DataTableContentBodyProps<TData>): react.JSX.Element;
140
+ declare function DataTableContentBody<TData extends RowData>({ table, columns, }: DataTableContentBodyProps<TData>): react.JSX.Element;
144
141
 
145
142
  interface DataTableContentHeaderProps<TData extends RowData> {
146
143
  table: Table<DataTableFeatures, TData>;
@@ -230,11 +227,10 @@ interface DataTableHeaderRefreshProps {
230
227
  declare function DataTableHeaderRefresh({ onRefresh, }: DataTableHeaderRefreshProps): react.JSX.Element;
231
228
 
232
229
  interface DataTableHeaderSearchProps {
233
- value: string;
230
+ value?: string;
234
231
  onChange: (value: string) => void;
235
- placeholder?: string;
236
232
  }
237
- declare function DataTableHeaderSearch({ value, onChange, placeholder, }: DataTableHeaderSearchProps): react.JSX.Element;
233
+ declare function DataTableHeaderSearch({ value, onChange, }: DataTableHeaderSearchProps): react.JSX.Element;
238
234
 
239
235
  interface DataTableHeaderSortProps<TData extends RowData> {
240
236
  table: Table<DataTableFeatures, TData>;
@@ -264,10 +260,6 @@ interface DataTableProps<TData extends RowData> {
264
260
  onDownload?: () => void;
265
261
  /** Base filename used when exporting data (defaults to "data-export") */
266
262
  exportFilename?: string;
267
- /** Loading state indicator */
268
- isLoading?: boolean;
269
- /** Placeholder text for search bar (defaults to "Search...") */
270
- searchPlaceholder?: string;
271
263
  /** Toggle visibility of search input (default: true) */
272
264
  showSearchInput?: boolean;
273
265
  /** Toggle visibility of refresh button (default: true) */
@@ -282,31 +274,15 @@ interface DataTableProps<TData extends RowData> {
282
274
  showColumnToggleButton?: boolean;
283
275
  /** Toggle visibility of add/create button (default: true) */
284
276
  showAddButton?: boolean;
285
- /** Custom icon for empty state */
286
- emptyIcon?: React.ComponentType<{
287
- className?: string;
288
- }> | ReactNode;
289
- /** Custom title for empty state */
290
- emptyTitle?: ReactNode;
291
- /** Custom description for empty state */
292
- emptyDescription?: ReactNode;
293
- /** Custom button text for empty state action */
294
- emptyButtonText?: string;
295
- /** Custom render prop for empty state action button */
296
- emptyRender?: ComponentProps<typeof Button>["render"];
297
- /** Callback for empty state action button click */
298
- onEmptyAction?: () => void;
299
- /** Custom render function to completely override the empty state */
300
- renderEmptyState?: () => ReactNode;
301
277
  }
302
278
  /**
303
279
  * Universal Data Table component built with TanStack Table and Shadcn UI.
304
280
  * Provides out-of-the-box features: global search, smart multi-type column filtering,
305
281
  * column sorting, column visibility toggle, data export (PDF, Excel, CSV, Print),
306
282
  * data refresh, pagination, row actions, add/create modal dialog binding,
307
- * loading skeletons, and integrated empty states via StateEmpty.
283
+ * and standard hardcoded global empty state via StateEmpty.
308
284
  */
309
- declare function DataTable<TData extends RowData>({ columns, data, initialColumnVisibility, renderCreateDialog, addLabel, onRefresh, onDownload, exportFilename, isLoading, searchPlaceholder, showSearchInput, showRefreshButton, showSortButton, showFilterButton, showDownloadButton, showColumnToggleButton, showAddButton, emptyIcon, emptyTitle, emptyDescription, emptyButtonText, emptyRender, onEmptyAction, renderEmptyState, }: DataTableProps<TData>): react.JSX.Element;
285
+ declare function DataTable<TData extends RowData>({ columns, data, initialColumnVisibility, renderCreateDialog, addLabel, onRefresh, onDownload, exportFilename, showSearchInput, showRefreshButton, showSortButton, showFilterButton, showDownloadButton, showColumnToggleButton, showAddButton, }: DataTableProps<TData>): react.JSX.Element;
310
286
 
311
287
  interface HeaderTabItem {
312
288
  title: string;
@@ -331,6 +307,12 @@ interface HeaderTitleProps {
331
307
  }
332
308
  declare const HeaderTitle: react.NamedExoticComponent<HeaderTitleProps>;
333
309
 
310
+ declare const buttonVariants: (props?: ({
311
+ variant?: "default" | "outline" | "secondary" | "ghost" | "destructive" | "link" | null | undefined;
312
+ size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
313
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
314
+ declare function Button({ className, variant, size, ...props }: Button$1.Props & VariantProps<typeof buttonVariants>): react.JSX.Element;
315
+
334
316
  interface StateEmptyProps {
335
317
  icon: React.ComponentType<{
336
318
  className?: string;
@@ -339,8 +321,9 @@ interface StateEmptyProps {
339
321
  description: ReactNode;
340
322
  buttonText?: string;
341
323
  onClick?: () => void;
342
- render?: ComponentProps<typeof Button>["render"];
324
+ render?: (() => void) | ComponentProps<typeof Button>["render"];
325
+ state?: "default" | "outline";
343
326
  }
344
327
  declare const StateEmpty: react.NamedExoticComponent<StateEmptyProps>;
345
328
 
346
- export { AppSidebar, type AppSidebarProps, type ColumnMetaCustom, DataTable, DataTableContentBody, type DataTableContentBodyProps, DataTableContentHeader, type DataTableContentHeaderProps, type DataTableFeatures, DataTableFooterEntries, type DataTableFooterEntriesProps, DataTableFooterPagination, type DataTableFooterPaginationProps, DataTableHeaderAdd, type DataTableHeaderAddProps, DataTableHeaderDownload, type DataTableHeaderDownloadProps, DataTableHeaderFilter, type DataTableHeaderFilterProps, DataTableHeaderRefresh, type DataTableHeaderRefreshProps, DataTableHeaderSearch, type DataTableHeaderSearchProps, DataTableHeaderSort, type DataTableHeaderSortProps, DataTableHeaderToggle, type DataTableHeaderToggleProps, type DataTableProps, type FilterSelectOption, type FilterVariant, type HeaderTabItem, HeaderTabs, type HeaderTabsProps, HeaderTitle, type HeaderTitleProps, type NavItem, type OrganizationItem, type RowActionItem, RowActions, type RowActionsProps, StateEmpty, type StateEmptyProps, exportToCSV, exportToXLSX, features, getTableExportData, printTable, smartFilterFn };
329
+ export { AppSidebar, type AppSidebarProps, type ColumnMetaCustom, DataTable, DataTableContentBody, type DataTableContentBodyProps, DataTableContentHeader, type DataTableContentHeaderProps, type DataTableFeatures, DataTableFooterEntries, type DataTableFooterEntriesProps, DataTableFooterPagination, type DataTableFooterPaginationProps, DataTableHeaderAdd, type DataTableHeaderAddProps, DataTableHeaderDownload, type DataTableHeaderDownloadProps, DataTableHeaderFilter, type DataTableHeaderFilterProps, DataTableHeaderRefresh, type DataTableHeaderRefreshProps, DataTableHeaderSearch, type DataTableHeaderSearchProps, DataTableHeaderSort, type DataTableHeaderSortProps, DataTableHeaderToggle, type DataTableHeaderToggleProps, type DataTableProps, type FilterSelectOption, type FilterVariant, type HeaderTabItem, HeaderTabs, type HeaderTabsProps, HeaderTitle, type HeaderTitleProps, type NavItem, type OrganizationItem, type RowActionItem, RowActions, type RowActionsProps, StateEmpty, type StateEmptyProps, exportToCSV, exportToPDF, exportToXLSX, features, getTableExportData, printTable, smartFilterFn };
package/dist/index.d.ts CHANGED
@@ -41,12 +41,6 @@ interface AppSidebarProps {
41
41
  }
42
42
  declare const AppSidebar: react.NamedExoticComponent<AppSidebarProps>;
43
43
 
44
- declare const buttonVariants: (props?: ({
45
- variant?: "default" | "outline" | "secondary" | "ghost" | "destructive" | "link" | null | undefined;
46
- size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
47
- } & class_variance_authority_types.ClassProp) | undefined) => string;
48
- declare function Button({ className, variant, size, ...props }: Button$1.Props & VariantProps<typeof buttonVariants>): react.JSX.Element;
49
-
50
44
  /**
51
45
  * Configure TanStack Table features used by DataTable.
52
46
  * Enables column/global filtering, visibility toggling, pagination, row selection, and sorting.
@@ -131,16 +125,19 @@ declare function exportToXLSX(rows: ExportRow[], filename?: string): void;
131
125
  */
132
126
  declare function exportToCSV(rows: ExportRow[], filename?: string): void;
133
127
  /**
134
- * Print or export as PDF by opening a styled print window.
128
+ * Directly generate and download a PDF file of the table data using jsPDF and jspdf-autotable.
129
+ */
130
+ declare function exportToPDF(headers: string[], rows: string[][], filename?: string, title?: string): Promise<void>;
131
+ /**
132
+ * Print table by opening a styled print popup window.
135
133
  */
136
134
  declare function printTable(headers: string[], rows: string[][], title?: string): void;
137
135
 
138
136
  interface DataTableContentBodyProps<TData extends RowData> {
139
137
  table: Table<DataTableFeatures, TData>;
140
138
  columns: ColumnDef<DataTableFeatures, TData>[];
141
- isLoading?: boolean;
142
139
  }
143
- declare function DataTableContentBody<TData extends RowData>({ table, columns, isLoading, }: DataTableContentBodyProps<TData>): react.JSX.Element;
140
+ declare function DataTableContentBody<TData extends RowData>({ table, columns, }: DataTableContentBodyProps<TData>): react.JSX.Element;
144
141
 
145
142
  interface DataTableContentHeaderProps<TData extends RowData> {
146
143
  table: Table<DataTableFeatures, TData>;
@@ -230,11 +227,10 @@ interface DataTableHeaderRefreshProps {
230
227
  declare function DataTableHeaderRefresh({ onRefresh, }: DataTableHeaderRefreshProps): react.JSX.Element;
231
228
 
232
229
  interface DataTableHeaderSearchProps {
233
- value: string;
230
+ value?: string;
234
231
  onChange: (value: string) => void;
235
- placeholder?: string;
236
232
  }
237
- declare function DataTableHeaderSearch({ value, onChange, placeholder, }: DataTableHeaderSearchProps): react.JSX.Element;
233
+ declare function DataTableHeaderSearch({ value, onChange, }: DataTableHeaderSearchProps): react.JSX.Element;
238
234
 
239
235
  interface DataTableHeaderSortProps<TData extends RowData> {
240
236
  table: Table<DataTableFeatures, TData>;
@@ -264,10 +260,6 @@ interface DataTableProps<TData extends RowData> {
264
260
  onDownload?: () => void;
265
261
  /** Base filename used when exporting data (defaults to "data-export") */
266
262
  exportFilename?: string;
267
- /** Loading state indicator */
268
- isLoading?: boolean;
269
- /** Placeholder text for search bar (defaults to "Search...") */
270
- searchPlaceholder?: string;
271
263
  /** Toggle visibility of search input (default: true) */
272
264
  showSearchInput?: boolean;
273
265
  /** Toggle visibility of refresh button (default: true) */
@@ -282,31 +274,15 @@ interface DataTableProps<TData extends RowData> {
282
274
  showColumnToggleButton?: boolean;
283
275
  /** Toggle visibility of add/create button (default: true) */
284
276
  showAddButton?: boolean;
285
- /** Custom icon for empty state */
286
- emptyIcon?: React.ComponentType<{
287
- className?: string;
288
- }> | ReactNode;
289
- /** Custom title for empty state */
290
- emptyTitle?: ReactNode;
291
- /** Custom description for empty state */
292
- emptyDescription?: ReactNode;
293
- /** Custom button text for empty state action */
294
- emptyButtonText?: string;
295
- /** Custom render prop for empty state action button */
296
- emptyRender?: ComponentProps<typeof Button>["render"];
297
- /** Callback for empty state action button click */
298
- onEmptyAction?: () => void;
299
- /** Custom render function to completely override the empty state */
300
- renderEmptyState?: () => ReactNode;
301
277
  }
302
278
  /**
303
279
  * Universal Data Table component built with TanStack Table and Shadcn UI.
304
280
  * Provides out-of-the-box features: global search, smart multi-type column filtering,
305
281
  * column sorting, column visibility toggle, data export (PDF, Excel, CSV, Print),
306
282
  * data refresh, pagination, row actions, add/create modal dialog binding,
307
- * loading skeletons, and integrated empty states via StateEmpty.
283
+ * and standard hardcoded global empty state via StateEmpty.
308
284
  */
309
- declare function DataTable<TData extends RowData>({ columns, data, initialColumnVisibility, renderCreateDialog, addLabel, onRefresh, onDownload, exportFilename, isLoading, searchPlaceholder, showSearchInput, showRefreshButton, showSortButton, showFilterButton, showDownloadButton, showColumnToggleButton, showAddButton, emptyIcon, emptyTitle, emptyDescription, emptyButtonText, emptyRender, onEmptyAction, renderEmptyState, }: DataTableProps<TData>): react.JSX.Element;
285
+ declare function DataTable<TData extends RowData>({ columns, data, initialColumnVisibility, renderCreateDialog, addLabel, onRefresh, onDownload, exportFilename, showSearchInput, showRefreshButton, showSortButton, showFilterButton, showDownloadButton, showColumnToggleButton, showAddButton, }: DataTableProps<TData>): react.JSX.Element;
310
286
 
311
287
  interface HeaderTabItem {
312
288
  title: string;
@@ -331,6 +307,12 @@ interface HeaderTitleProps {
331
307
  }
332
308
  declare const HeaderTitle: react.NamedExoticComponent<HeaderTitleProps>;
333
309
 
310
+ declare const buttonVariants: (props?: ({
311
+ variant?: "default" | "outline" | "secondary" | "ghost" | "destructive" | "link" | null | undefined;
312
+ size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
313
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
314
+ declare function Button({ className, variant, size, ...props }: Button$1.Props & VariantProps<typeof buttonVariants>): react.JSX.Element;
315
+
334
316
  interface StateEmptyProps {
335
317
  icon: React.ComponentType<{
336
318
  className?: string;
@@ -339,8 +321,9 @@ interface StateEmptyProps {
339
321
  description: ReactNode;
340
322
  buttonText?: string;
341
323
  onClick?: () => void;
342
- render?: ComponentProps<typeof Button>["render"];
324
+ render?: (() => void) | ComponentProps<typeof Button>["render"];
325
+ state?: "default" | "outline";
343
326
  }
344
327
  declare const StateEmpty: react.NamedExoticComponent<StateEmptyProps>;
345
328
 
346
- export { AppSidebar, type AppSidebarProps, type ColumnMetaCustom, DataTable, DataTableContentBody, type DataTableContentBodyProps, DataTableContentHeader, type DataTableContentHeaderProps, type DataTableFeatures, DataTableFooterEntries, type DataTableFooterEntriesProps, DataTableFooterPagination, type DataTableFooterPaginationProps, DataTableHeaderAdd, type DataTableHeaderAddProps, DataTableHeaderDownload, type DataTableHeaderDownloadProps, DataTableHeaderFilter, type DataTableHeaderFilterProps, DataTableHeaderRefresh, type DataTableHeaderRefreshProps, DataTableHeaderSearch, type DataTableHeaderSearchProps, DataTableHeaderSort, type DataTableHeaderSortProps, DataTableHeaderToggle, type DataTableHeaderToggleProps, type DataTableProps, type FilterSelectOption, type FilterVariant, type HeaderTabItem, HeaderTabs, type HeaderTabsProps, HeaderTitle, type HeaderTitleProps, type NavItem, type OrganizationItem, type RowActionItem, RowActions, type RowActionsProps, StateEmpty, type StateEmptyProps, exportToCSV, exportToXLSX, features, getTableExportData, printTable, smartFilterFn };
329
+ export { AppSidebar, type AppSidebarProps, type ColumnMetaCustom, DataTable, DataTableContentBody, type DataTableContentBodyProps, DataTableContentHeader, type DataTableContentHeaderProps, type DataTableFeatures, DataTableFooterEntries, type DataTableFooterEntriesProps, DataTableFooterPagination, type DataTableFooterPaginationProps, DataTableHeaderAdd, type DataTableHeaderAddProps, DataTableHeaderDownload, type DataTableHeaderDownloadProps, DataTableHeaderFilter, type DataTableHeaderFilterProps, DataTableHeaderRefresh, type DataTableHeaderRefreshProps, DataTableHeaderSearch, type DataTableHeaderSearchProps, DataTableHeaderSort, type DataTableHeaderSortProps, DataTableHeaderToggle, type DataTableHeaderToggleProps, type DataTableProps, type FilterSelectOption, type FilterVariant, type HeaderTabItem, HeaderTabs, type HeaderTabsProps, HeaderTitle, type HeaderTitleProps, type NavItem, type OrganizationItem, type RowActionItem, RowActions, type RowActionsProps, StateEmpty, type StateEmptyProps, exportToCSV, exportToPDF, exportToXLSX, features, getTableExportData, printTable, smartFilterFn };