erp-pos-ecommerce-shared 0.0.15 → 0.1.0

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.
@@ -0,0 +1,11 @@
1
+ /* src/components/table/TableHeader.module.css */
2
+ .tableHeader {
3
+ display: flex;
4
+ align-items: center;
5
+ border-radius: var(--mantine-radius-lg);
6
+ transition: background-color 0.1s ease;
7
+ &:hover {
8
+ background-color: light-dark(var(--mantine-color-gray-2), var(--mantine-color-dark-2));
9
+ }
10
+ }
11
+ /*# sourceMappingURL=components.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/table/TableHeader.module.css"],"sourcesContent":[".tableHeader {\ndisplay: flex;\nalign-items: center;\nborder-radius: var(--mantine-radius-lg);\ntransition: background-color 0.1s ease;\n &:hover {\n background-color: light-dark(var(--mantine-color-gray-2), var(--mantine-color-dark-2));\n }\n}"],"mappings":";AAAA,CAAC;AACD,WAAS;AACT,eAAa;AACb,iBAAe,IAAI;AACnB,cAAY,iBAAiB,KAAK;AAChC,GAAC;AACC,sBAAkB,WAAW,IAAI,uBAAuB,EAAE,IAAI;AAChE;AACF;","names":[]}
@@ -1,12 +1,12 @@
1
1
  import React$1, { ReactNode } from 'react';
2
- import { e as IField, b as IButton } from './form.interface-BX2xeC3W.js';
2
+ import { e as IField, b as IButton } from './form.interface-CqnTdmc8.js';
3
3
  import { ReactFormExtendedApi, FormValidateOrFn, FormAsyncValidateOrFn } from '@tanstack/react-form';
4
4
  import { UseMutationResult } from '@tanstack/react-query';
5
- import { p as TblProductsImage } from './batch.interface-BUls7CK_.js';
5
+ import { s as TblProductsImage, o as ITableFilterConfig, g as IFilterSelectOption } from './filters.interface-Cx-AXMPz.js';
6
6
  import * as z from 'zod';
7
7
  import * as react_jsx_runtime from 'react/jsx-runtime';
8
- import { ColumnDef } from '@tanstack/react-table';
9
- import { D as DataTableConfig } from './datatable.interface-C28hhMoI.js';
8
+ import { ColumnDef, Row, useReactTable } from '@tanstack/react-table';
9
+ import { D as DataTableConfig, S as ServerTableState } from './datatable.interface-BObLVL2e.js';
10
10
 
11
11
  interface CreateEditFormProps<T> {
12
12
  fields: IField[];
@@ -31,8 +31,7 @@ interface CreateEditFormProps<T> {
31
31
  onGoBack?: () => void;
32
32
  /**
33
33
  * Optional icon for the back button. Pass your own icon component so the lib stays router/UI-agnostic.
34
- * @example Tabler: <IconArrowLeft /> from @tabler/icons-react
35
- * @example Lucide: <ArrowLeft /> from lucide-react
34
+ * @example <ArrowLeft /> from lucide-react
36
35
  */
37
36
  backButtonIcon?: ReactNode;
38
37
  }
@@ -83,10 +82,10 @@ interface GenericFieldController<TValue> {
83
82
  * Configure icons for ImageForm (dropzone, camera button, notifications, delete).
84
83
  * Call once at app startup with your preferred icon library.
85
84
  * @example
86
- * import { IconCamera, IconCheck, IconPhoto, IconUpload, IconX } from "@tabler/icons-react";
85
+ * import { Camera, Check, Image, Upload, X } from "lucide-react";
87
86
  * configureImageFormIcons({
88
- * acceptIcon: <IconUpload />, rejectIcon: <IconX />, idleIcon: <IconPhoto />,
89
- * cameraIcon: <IconCamera />, successIcon: <IconCheck />, errorIcon: <IconX />,
87
+ * acceptIcon: <Upload />, rejectIcon: <X />, idleIcon: <Image />,
88
+ * cameraIcon: <Camera />, successIcon: <Check />, errorIcon: <X />,
90
89
  * });
91
90
  */
92
91
  declare const configureImageFormIcons: (config: {
@@ -114,23 +113,6 @@ declare const ImageForm: ({ field, label, required, multiple, maxSize, maxFiles,
114
113
 
115
114
  declare const generateFormSchema: (fields: IField[]) => z.ZodObject<z.ZodRawShape>;
116
115
 
117
- interface DataTableProps<TData> {
118
- data: TData[];
119
- columns: ColumnDef<TData, unknown>[];
120
- config?: Partial<DataTableConfig>;
121
- }
122
- declare const DataTable: <TData>({ data, columns, config, }: DataTableProps<TData>) => react_jsx_runtime.JSX.Element;
123
-
124
- interface SearchInputProps {
125
- value: string;
126
- onChange: (value: string) => void;
127
- placeholder?: string;
128
- onClear?: () => void;
129
- IconSearch?: React.ElementType;
130
- IconX?: React.ElementType;
131
- }
132
- declare const SearchInput: ({ value, onChange, placeholder, onClear, IconSearch, IconX, }: SearchInputProps) => react_jsx_runtime.JSX.Element;
133
-
134
116
  interface BottomPaginationProps {
135
117
  total: number;
136
118
  pageSize: number;
@@ -140,6 +122,40 @@ interface BottomPaginationProps {
140
122
  }
141
123
  declare const BottomPagination: ({ total, pageSize, pageIndex, onPageSizeChange, onPageIndexChange, }: BottomPaginationProps) => react_jsx_runtime.JSX.Element | null;
142
124
 
125
+ interface DataTableProps$1<TData> {
126
+ /** Data to display in the table */
127
+ data: TData[];
128
+ /** Columns to display in the table */
129
+ columns: ColumnDef<TData>[];
130
+ /** Configuration for the table */
131
+ config?: Partial<DataTableConfig>;
132
+ /** Dynamic filters (selects for category, role, etc.) */
133
+ filters?: ITableFilterConfig[];
134
+ /** Enable server-side mode: pagination, filters, search handled by backend */
135
+ serverSide?: boolean;
136
+ /** Total row count from server (required when serverSide) */
137
+ totalRowCount?: number;
138
+ /** Called when table state changes. Use for API calls. */
139
+ onStateChange?: (state: ServerTableState) => void;
140
+ /** Whether the table is loading (shows TableSkeleton) */
141
+ loading?: boolean;
142
+ /** Whether to enable row selection */
143
+ enableRowCheck?: boolean;
144
+ /** Called when row selection changes (only when canCheck is true) */
145
+ onSelectionChange?: (selectedRows: TData[]) => void;
146
+ /** Header background color. Use light-dark(light, dark) for theme-aware colors */
147
+ headerBgColor?: string;
148
+ /** Column actions to display in the table */
149
+ columnActions?: (row: TData) => React.ReactNode;
150
+ /** List menu actions to display in the table */
151
+ listMenuActions?: (row: TData) => {
152
+ label: string;
153
+ onClick: () => void;
154
+ Icon?: React.ElementType;
155
+ }[];
156
+ }
157
+ declare const DataTable: <TData>({ data, columns, config, filters, serverSide, totalRowCount, onStateChange, loading, enableRowCheck: canCheck, onSelectionChange, headerBgColor, columnActions, listMenuActions, }: DataTableProps$1<TData>) => react_jsx_runtime.JSX.Element;
158
+
143
159
  interface EmptyStateProps {
144
160
  title?: string;
145
161
  description?: string;
@@ -155,4 +171,95 @@ interface EmptyStateProps {
155
171
  }
156
172
  declare const EmptyState: React$1.FC<EmptyStateProps>;
157
173
 
158
- export { BottomPagination, CreateEditForm, DataTable, EmptyState, FormGenerator, type FormInstance, type FormValues, ImageForm, SearchInput, configureImageFormIcons, fieldGenerator, generateFormSchema };
174
+ /**
175
+ * TanStack Table filterFn for date columns.
176
+ * Keeps rows where the cell value (YYYY-MM-DD) is >= the selected date.
177
+ * Usage: add `filterFn: dateGteFilterFn` to the column definition.
178
+ */
179
+ declare const dateGteFilterFn: <TData>(row: Row<TData>, columnId: string, filterValue: string) => boolean;
180
+ interface FilterDateProps {
181
+ /** Column id to filter */
182
+ columnId: string;
183
+ /** Current filter value (ISO date string or null) */
184
+ value: string | null;
185
+ /** Called when filter changes */
186
+ onChange: (columnId: string, value: string | null) => void;
187
+ /** Placeholder when no date selected */
188
+ placeholder?: string;
189
+ }
190
+ declare const FilterDate: ({ columnId, value, onChange, placeholder, }: FilterDateProps) => react_jsx_runtime.JSX.Element;
191
+
192
+ interface FilterSelectProps {
193
+ /** Column id to filter */
194
+ columnId: string;
195
+ /** Select options (value, label pairs). Import FilterSelectOption from interfaces/filters */
196
+ options: IFilterSelectOption[];
197
+ /** Current filter value */
198
+ onChange: (columnId: string, value: string | null) => void;
199
+ /** Placeholder when no selection */
200
+ placeholder?: string;
201
+ /** Icon to show in the button */
202
+ Icon?: React.ElementType;
203
+ }
204
+ declare const FilterSelect: ({ columnId, options, onChange, placeholder, Icon, }: FilterSelectProps) => react_jsx_runtime.JSX.Element;
205
+
206
+ interface SearchInputProps {
207
+ value: string;
208
+ onChange: (value: string) => void;
209
+ placeholder?: string;
210
+ onClear?: () => void;
211
+ IconSearch?: React.ElementType;
212
+ IconX?: React.ElementType;
213
+ }
214
+ declare const SearchInput: ({ value, onChange, placeholder, onClear, IconSearch, IconX, }: SearchInputProps) => react_jsx_runtime.JSX.Element;
215
+
216
+ interface DataTableProps<TData> {
217
+ table: ReturnType<typeof useReactTable<TData>>;
218
+ /** Whether to show the border */
219
+ withBorder?: boolean;
220
+ /** Border radius */
221
+ borderRadius?: "xs" | "sm" | "md" | "lg" | "xl" | number;
222
+ /** Icon when column is unsorted */
223
+ SortIcon?: React$1.ElementType;
224
+ /** Icon when column is sorted ascending */
225
+ SortIconAsc?: React$1.ElementType;
226
+ /** Icon when column is sorted descending */
227
+ SortIconDesc?: React$1.ElementType;
228
+ /** Icon when empty state */
229
+ EmptyStateIcon?: React$1.ElementType;
230
+ /** Title when empty state */
231
+ EmptyStateTitle?: string;
232
+ /** Description when empty state */
233
+ EmptyStateDescription?: string;
234
+ /** Whether to show the checkboxes */
235
+ canCheck?: boolean;
236
+ /** Column actions */
237
+ columnActions?: (row: TData) => React$1.ReactNode;
238
+ /** List menu actions */
239
+ listMenuActions?: (row: TData) => {
240
+ label: string;
241
+ onClick: () => void;
242
+ Icon?: React$1.ElementType;
243
+ }[];
244
+ /** Header background color. Use light-dark(light, dark) for theme-aware colors */
245
+ headerBgColor?: string;
246
+ }
247
+ declare const SimpleDataTable: <TData>({ table, withBorder, borderRadius, SortIcon, SortIconAsc, SortIconDesc, EmptyStateIcon, EmptyStateTitle, EmptyStateDescription, canCheck, columnActions, listMenuActions, headerBgColor, }: DataTableProps<TData>) => react_jsx_runtime.JSX.Element;
248
+
249
+ interface TableSkeletonProps {
250
+ /** Number of skeleton rows to show */
251
+ rows?: number;
252
+ /** Number of columns (excluding checkbox column if canCheck) */
253
+ columns?: number;
254
+ /** Whether to show a checkbox column */
255
+ canCheck?: boolean;
256
+ /** Whether to show the border */
257
+ withBorder?: boolean;
258
+ /** Border radius */
259
+ borderRadius?: "xs" | "sm" | "md" | "lg" | "xl" | number;
260
+ /** Height of each skeleton row */
261
+ rowHeight?: number;
262
+ }
263
+ declare const TableSkeleton: ({ rows, columns, canCheck, withBorder, borderRadius, rowHeight, }: TableSkeletonProps) => react_jsx_runtime.JSX.Element;
264
+
265
+ export { BottomPagination, CreateEditForm, DataTable, EmptyState, FilterDate, type FilterDateProps, FilterSelect, type FilterSelectProps, FormGenerator, type FormInstance, type FormValues, ImageForm, SearchInput, SimpleDataTable, TableSkeleton, configureImageFormIcons, dateGteFilterFn, fieldGenerator, generateFormSchema };