@prediktif/ui 0.1.19 → 0.1.21

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/README.md CHANGED
@@ -139,7 +139,7 @@ Open [http://localhost:3000](http://localhost:3000) in your browser.
139
139
 
140
140
  ### 2. Adding a New Composed Component
141
141
 
142
- 1. Create your component in `src/components/composed/my-component.tsx`:
142
+ 1. **Create the component** in `src/components/composed/my-component.tsx`:
143
143
  ```tsx
144
144
  export interface MyComponentProps {
145
145
  label: string;
@@ -149,12 +149,30 @@ Open [http://localhost:3000](http://localhost:3000) in your browser.
149
149
  return <div className="p-4 rounded-md border">{label}</div>;
150
150
  }
151
151
  ```
152
- 2. Export the component in `src/components/composed/index.ts`:
152
+
153
+ 2. **Export the component** in `src/components/composed/index.ts`:
153
154
  ```ts
154
155
  export * from "./header-title";
155
156
  export * from "./my-component";
156
157
  ```
157
- 3. (Optional) Create a documentation page in `src/app/(docs)/components/my-component/page.tsx` for visual testing.
158
+
159
+ 3. **Register in navigation** (`src/lib/docs-config.ts`):
160
+ ```ts
161
+ {
162
+ title: "Components",
163
+ url: "/components",
164
+ items: [
165
+ // ...
166
+ { title: "My Component", url: "/components/my-component" },
167
+ ]
168
+ }
169
+ ```
170
+
171
+ 4. **Create the documentation detail page** in `src/app/(docs)/components/my-component/page.tsx`:
172
+ - Include `<ComponentHeader>`, `<ComponentSection title="Preview">`, `<ComponentCodeExample>`, `<ComponentPropsTable>`, and `<ComponentPagination />`.
173
+
174
+ 5. **Add a preview card** to `src/app/(docs)/components/page.tsx`:
175
+ - Add `<Card>` with `<CardHeader>`, `<CardTitle>`, `<CardDescription className="truncate">`, and `<CardContent className="max-h-32 overflow-y-scroll">` wrapping `<ComponentPreview>`.
158
176
 
159
177
  ---
160
178
 
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>;
@@ -224,17 +221,13 @@ interface DataTableHeaderFilterProps<TData extends RowData> {
224
221
  declare function smartFilterFn<TData extends RowData>(row: Row<DataTableFeatures, TData>, columnId: string, filterValue: unknown): boolean;
225
222
  declare function DataTableHeaderFilter<TData extends RowData>({ table, columnFilters, }: DataTableHeaderFilterProps<TData>): react.JSX.Element | null;
226
223
 
227
- interface DataTableHeaderRefreshProps {
228
- onRefresh?: () => void;
229
- }
230
- declare function DataTableHeaderRefresh({ onRefresh, }: DataTableHeaderRefreshProps): react.JSX.Element;
224
+ declare function DataTableHeaderRefresh(): react.JSX.Element;
231
225
 
232
226
  interface DataTableHeaderSearchProps {
233
- value: string;
227
+ value?: string;
234
228
  onChange: (value: string) => void;
235
- placeholder?: string;
236
229
  }
237
- declare function DataTableHeaderSearch({ value, onChange, placeholder, }: DataTableHeaderSearchProps): react.JSX.Element;
230
+ declare function DataTableHeaderSearch({ value, onChange, }: DataTableHeaderSearchProps): react.JSX.Element;
238
231
 
239
232
  interface DataTableHeaderSortProps<TData extends RowData> {
240
233
  table: Table<DataTableFeatures, TData>;
@@ -258,16 +251,10 @@ interface DataTableProps<TData extends RowData> {
258
251
  renderCreateDialog?: (open: boolean, onOpenChange: (open: boolean) => void) => ReactNode;
259
252
  /** Label text for the add button (defaults to "Add") */
260
253
  addLabel?: string;
261
- /** Callback triggered when user clicks the refresh button */
262
- onRefresh?: () => void;
263
254
  /** Callback triggered when user downloads data */
264
255
  onDownload?: () => void;
265
256
  /** Base filename used when exporting data (defaults to "data-export") */
266
257
  exportFilename?: string;
267
- /** Loading state indicator */
268
- isLoading?: boolean;
269
- /** Placeholder text for search bar (defaults to "Search...") */
270
- searchPlaceholder?: string;
271
258
  /** Toggle visibility of search input (default: true) */
272
259
  showSearchInput?: boolean;
273
260
  /** Toggle visibility of refresh button (default: true) */
@@ -282,31 +269,15 @@ interface DataTableProps<TData extends RowData> {
282
269
  showColumnToggleButton?: boolean;
283
270
  /** Toggle visibility of add/create button (default: true) */
284
271
  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
272
  }
302
273
  /**
303
274
  * Universal Data Table component built with TanStack Table and Shadcn UI.
304
275
  * Provides out-of-the-box features: global search, smart multi-type column filtering,
305
276
  * column sorting, column visibility toggle, data export (PDF, Excel, CSV, Print),
306
277
  * data refresh, pagination, row actions, add/create modal dialog binding,
307
- * loading skeletons, and integrated empty states via StateEmpty.
278
+ * and standard hardcoded global empty state via StateEmpty.
308
279
  */
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;
280
+ declare function DataTable<TData extends RowData>({ columns, data, initialColumnVisibility, renderCreateDialog, addLabel, onDownload, exportFilename, showSearchInput, showRefreshButton, showSortButton, showFilterButton, showDownloadButton, showColumnToggleButton, showAddButton, }: DataTableProps<TData>): react.JSX.Element;
310
281
 
311
282
  interface HeaderTabItem {
312
283
  title: string;
@@ -331,6 +302,12 @@ interface HeaderTitleProps {
331
302
  }
332
303
  declare const HeaderTitle: react.NamedExoticComponent<HeaderTitleProps>;
333
304
 
305
+ declare const buttonVariants: (props?: ({
306
+ variant?: "default" | "outline" | "secondary" | "ghost" | "destructive" | "link" | null | undefined;
307
+ size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
308
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
309
+ declare function Button({ className, variant, size, ...props }: Button$1.Props & VariantProps<typeof buttonVariants>): react.JSX.Element;
310
+
334
311
  interface StateEmptyProps {
335
312
  icon: React.ComponentType<{
336
313
  className?: string;
@@ -339,8 +316,9 @@ interface StateEmptyProps {
339
316
  description: ReactNode;
340
317
  buttonText?: string;
341
318
  onClick?: () => void;
342
- render?: ComponentProps<typeof Button>["render"];
319
+ render?: (() => void) | ComponentProps<typeof Button>["render"];
320
+ state?: "default" | "outline";
343
321
  }
344
322
  declare const StateEmpty: react.NamedExoticComponent<StateEmptyProps>;
345
323
 
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 };
324
+ 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, 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>;
@@ -224,17 +221,13 @@ interface DataTableHeaderFilterProps<TData extends RowData> {
224
221
  declare function smartFilterFn<TData extends RowData>(row: Row<DataTableFeatures, TData>, columnId: string, filterValue: unknown): boolean;
225
222
  declare function DataTableHeaderFilter<TData extends RowData>({ table, columnFilters, }: DataTableHeaderFilterProps<TData>): react.JSX.Element | null;
226
223
 
227
- interface DataTableHeaderRefreshProps {
228
- onRefresh?: () => void;
229
- }
230
- declare function DataTableHeaderRefresh({ onRefresh, }: DataTableHeaderRefreshProps): react.JSX.Element;
224
+ declare function DataTableHeaderRefresh(): react.JSX.Element;
231
225
 
232
226
  interface DataTableHeaderSearchProps {
233
- value: string;
227
+ value?: string;
234
228
  onChange: (value: string) => void;
235
- placeholder?: string;
236
229
  }
237
- declare function DataTableHeaderSearch({ value, onChange, placeholder, }: DataTableHeaderSearchProps): react.JSX.Element;
230
+ declare function DataTableHeaderSearch({ value, onChange, }: DataTableHeaderSearchProps): react.JSX.Element;
238
231
 
239
232
  interface DataTableHeaderSortProps<TData extends RowData> {
240
233
  table: Table<DataTableFeatures, TData>;
@@ -258,16 +251,10 @@ interface DataTableProps<TData extends RowData> {
258
251
  renderCreateDialog?: (open: boolean, onOpenChange: (open: boolean) => void) => ReactNode;
259
252
  /** Label text for the add button (defaults to "Add") */
260
253
  addLabel?: string;
261
- /** Callback triggered when user clicks the refresh button */
262
- onRefresh?: () => void;
263
254
  /** Callback triggered when user downloads data */
264
255
  onDownload?: () => void;
265
256
  /** Base filename used when exporting data (defaults to "data-export") */
266
257
  exportFilename?: string;
267
- /** Loading state indicator */
268
- isLoading?: boolean;
269
- /** Placeholder text for search bar (defaults to "Search...") */
270
- searchPlaceholder?: string;
271
258
  /** Toggle visibility of search input (default: true) */
272
259
  showSearchInput?: boolean;
273
260
  /** Toggle visibility of refresh button (default: true) */
@@ -282,31 +269,15 @@ interface DataTableProps<TData extends RowData> {
282
269
  showColumnToggleButton?: boolean;
283
270
  /** Toggle visibility of add/create button (default: true) */
284
271
  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
272
  }
302
273
  /**
303
274
  * Universal Data Table component built with TanStack Table and Shadcn UI.
304
275
  * Provides out-of-the-box features: global search, smart multi-type column filtering,
305
276
  * column sorting, column visibility toggle, data export (PDF, Excel, CSV, Print),
306
277
  * data refresh, pagination, row actions, add/create modal dialog binding,
307
- * loading skeletons, and integrated empty states via StateEmpty.
278
+ * and standard hardcoded global empty state via StateEmpty.
308
279
  */
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;
280
+ declare function DataTable<TData extends RowData>({ columns, data, initialColumnVisibility, renderCreateDialog, addLabel, onDownload, exportFilename, showSearchInput, showRefreshButton, showSortButton, showFilterButton, showDownloadButton, showColumnToggleButton, showAddButton, }: DataTableProps<TData>): react.JSX.Element;
310
281
 
311
282
  interface HeaderTabItem {
312
283
  title: string;
@@ -331,6 +302,12 @@ interface HeaderTitleProps {
331
302
  }
332
303
  declare const HeaderTitle: react.NamedExoticComponent<HeaderTitleProps>;
333
304
 
305
+ declare const buttonVariants: (props?: ({
306
+ variant?: "default" | "outline" | "secondary" | "ghost" | "destructive" | "link" | null | undefined;
307
+ size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
308
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
309
+ declare function Button({ className, variant, size, ...props }: Button$1.Props & VariantProps<typeof buttonVariants>): react.JSX.Element;
310
+
334
311
  interface StateEmptyProps {
335
312
  icon: React.ComponentType<{
336
313
  className?: string;
@@ -339,8 +316,9 @@ interface StateEmptyProps {
339
316
  description: ReactNode;
340
317
  buttonText?: string;
341
318
  onClick?: () => void;
342
- render?: ComponentProps<typeof Button>["render"];
319
+ render?: (() => void) | ComponentProps<typeof Button>["render"];
320
+ state?: "default" | "outline";
343
321
  }
344
322
  declare const StateEmpty: react.NamedExoticComponent<StateEmptyProps>;
345
323
 
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 };
324
+ 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, 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 };