erp-pos-ecommerce-shared 0.0.15 → 0.1.1
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/components.css +11 -0
- package/dist/components.css.map +1 -0
- package/dist/components.d.ts +132 -27
- package/dist/components.js +700 -169
- package/dist/components.js.map +1 -1
- package/dist/datatable.interface-DFSQWdXd.d.ts +33 -0
- package/dist/{batch.interface-BUls7CK_.d.ts → filters.interface-Cx-AXMPz.d.ts} +31 -1
- package/dist/{form.interface-BX2xeC3W.d.ts → form.interface-CqnTdmc8.d.ts} +1 -1
- package/dist/hooks.d.ts +171 -260
- package/dist/hooks.js +2627 -929
- package/dist/hooks.js.map +1 -1
- package/dist/index.css +11 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.ts +10 -7
- package/dist/index.js +3350 -1232
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts +7 -6
- package/dist/interfaces.js +1 -2
- package/dist/interfaces.js.map +1 -1
- package/dist/queries.d.ts +2090 -0
- package/dist/queries.js +3574 -0
- package/dist/queries.js.map +1 -0
- package/dist/services.d.ts +7 -6
- package/dist/services.js +9 -2
- package/dist/services.js.map +1 -1
- package/dist/shift.queries-CYXL5F1D.d.ts +334 -0
- package/dist/{warehouse.interface-BOq07Pqn.d.ts → warehouse.interface-BRPPyPIC.d.ts} +2 -12
- package/dist/{warehouse.service-BOs3DU4G.d.ts → warehouse.service-geeduO1g.d.ts} +2 -2
- package/package.json +20 -9
- package/dist/datatable.interface-C28hhMoI.d.ts +0 -19
|
@@ -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":[]}
|
package/dist/components.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React$1, { ReactNode } from 'react';
|
|
2
|
-
import { e as IField, b as IButton } from './form.interface-
|
|
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 {
|
|
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-
|
|
8
|
+
import { ColumnDef, Row, useReactTable } from '@tanstack/react-table';
|
|
9
|
+
import { D as DataTableConfig, S as ServerTableState } from './datatable.interface-DFSQWdXd.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
|
|
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 {
|
|
85
|
+
* import { Camera, Check, Image, Upload, X } from "lucide-react";
|
|
87
86
|
* configureImageFormIcons({
|
|
88
|
-
* acceptIcon: <
|
|
89
|
-
* cameraIcon: <
|
|
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,38 @@ 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 (current page, already paginated by server) */
|
|
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, dates, etc.) */
|
|
133
|
+
filters?: ITableFilterConfig[];
|
|
134
|
+
/** Total row count from server (used for pagination) */
|
|
135
|
+
totalRowCount?: number;
|
|
136
|
+
/** Called when table state changes (page, search, filters, sort). Use to call your API. */
|
|
137
|
+
onStateChange?: (state: ServerTableState) => void;
|
|
138
|
+
/** Whether the table is loading (shows skeleton) */
|
|
139
|
+
loading?: boolean;
|
|
140
|
+
/** Whether to enable row selection */
|
|
141
|
+
enableRowCheck?: boolean;
|
|
142
|
+
/** Called when row selection changes */
|
|
143
|
+
onSelectionChange?: (selectedRows: TData[]) => void;
|
|
144
|
+
/** Header background color. Use light-dark(light, dark) for theme-aware colors */
|
|
145
|
+
headerBgColor?: string;
|
|
146
|
+
/** Column actions to display per row */
|
|
147
|
+
columnActions?: (row: TData) => React.ReactNode;
|
|
148
|
+
/** List menu actions to display per row */
|
|
149
|
+
listMenuActions?: (row: TData) => {
|
|
150
|
+
label: string;
|
|
151
|
+
onClick: () => void;
|
|
152
|
+
Icon?: React.ElementType;
|
|
153
|
+
}[];
|
|
154
|
+
}
|
|
155
|
+
declare const DataTable: <TData>({ data, columns, config, filters, totalRowCount, onStateChange, loading, enableRowCheck: canCheck, onSelectionChange, headerBgColor, columnActions, listMenuActions, }: DataTableProps$1<TData>) => react_jsx_runtime.JSX.Element;
|
|
156
|
+
|
|
143
157
|
interface EmptyStateProps {
|
|
144
158
|
title?: string;
|
|
145
159
|
description?: string;
|
|
@@ -155,4 +169,95 @@ interface EmptyStateProps {
|
|
|
155
169
|
}
|
|
156
170
|
declare const EmptyState: React$1.FC<EmptyStateProps>;
|
|
157
171
|
|
|
158
|
-
|
|
172
|
+
/**
|
|
173
|
+
* TanStack Table filterFn for date columns.
|
|
174
|
+
* Keeps rows where the cell value (YYYY-MM-DD) is >= the selected date.
|
|
175
|
+
* Usage: add `filterFn: dateGteFilterFn` to the column definition.
|
|
176
|
+
*/
|
|
177
|
+
declare const dateGteFilterFn: <TData>(row: Row<TData>, columnId: string, filterValue: string) => boolean;
|
|
178
|
+
interface FilterDateProps {
|
|
179
|
+
/** Column id to filter */
|
|
180
|
+
columnId: string;
|
|
181
|
+
/** Current filter value (ISO date string or null) */
|
|
182
|
+
value: string | null;
|
|
183
|
+
/** Called when filter changes */
|
|
184
|
+
onChange: (columnId: string, value: string | null) => void;
|
|
185
|
+
/** Placeholder when no date selected */
|
|
186
|
+
placeholder?: string;
|
|
187
|
+
}
|
|
188
|
+
declare const FilterDate: ({ columnId, value, onChange, placeholder, }: FilterDateProps) => react_jsx_runtime.JSX.Element;
|
|
189
|
+
|
|
190
|
+
interface FilterSelectProps {
|
|
191
|
+
/** Column id to filter */
|
|
192
|
+
columnId: string;
|
|
193
|
+
/** Select options (value, label pairs). Import FilterSelectOption from interfaces/filters */
|
|
194
|
+
options: IFilterSelectOption[];
|
|
195
|
+
/** Current filter value */
|
|
196
|
+
onChange: (columnId: string, value: string | null) => void;
|
|
197
|
+
/** Placeholder when no selection */
|
|
198
|
+
placeholder?: string;
|
|
199
|
+
/** Icon to show in the button */
|
|
200
|
+
Icon?: React.ElementType;
|
|
201
|
+
}
|
|
202
|
+
declare const FilterSelect: ({ columnId, options, onChange, placeholder, Icon, }: FilterSelectProps) => react_jsx_runtime.JSX.Element;
|
|
203
|
+
|
|
204
|
+
interface SearchInputProps {
|
|
205
|
+
value: string;
|
|
206
|
+
onChange: (value: string) => void;
|
|
207
|
+
placeholder?: string;
|
|
208
|
+
onClear?: () => void;
|
|
209
|
+
IconSearch?: React.ElementType;
|
|
210
|
+
IconX?: React.ElementType;
|
|
211
|
+
}
|
|
212
|
+
declare const SearchInput: ({ value, onChange, placeholder, onClear, IconSearch, IconX, }: SearchInputProps) => react_jsx_runtime.JSX.Element;
|
|
213
|
+
|
|
214
|
+
interface DataTableProps<TData> {
|
|
215
|
+
table: ReturnType<typeof useReactTable<TData>>;
|
|
216
|
+
/** Whether to show the border */
|
|
217
|
+
withBorder?: boolean;
|
|
218
|
+
/** Border radius */
|
|
219
|
+
borderRadius?: "xs" | "sm" | "md" | "lg" | "xl" | number;
|
|
220
|
+
/** Icon when column is unsorted */
|
|
221
|
+
SortIcon?: React$1.ElementType;
|
|
222
|
+
/** Icon when column is sorted ascending */
|
|
223
|
+
SortIconAsc?: React$1.ElementType;
|
|
224
|
+
/** Icon when column is sorted descending */
|
|
225
|
+
SortIconDesc?: React$1.ElementType;
|
|
226
|
+
/** Icon when empty state */
|
|
227
|
+
EmptyStateIcon?: React$1.ElementType;
|
|
228
|
+
/** Title when empty state */
|
|
229
|
+
EmptyStateTitle?: string;
|
|
230
|
+
/** Description when empty state */
|
|
231
|
+
EmptyStateDescription?: string;
|
|
232
|
+
/** Whether to show the checkboxes */
|
|
233
|
+
canCheck?: boolean;
|
|
234
|
+
/** Column actions */
|
|
235
|
+
columnActions?: (row: TData) => React$1.ReactNode;
|
|
236
|
+
/** List menu actions */
|
|
237
|
+
listMenuActions?: (row: TData) => {
|
|
238
|
+
label: string;
|
|
239
|
+
onClick: () => void;
|
|
240
|
+
Icon?: React$1.ElementType;
|
|
241
|
+
}[];
|
|
242
|
+
/** Header background color. Use light-dark(light, dark) for theme-aware colors */
|
|
243
|
+
headerBgColor?: string;
|
|
244
|
+
}
|
|
245
|
+
declare const SimpleDataTable: <TData>({ table, withBorder, borderRadius, SortIcon, SortIconAsc, SortIconDesc, EmptyStateIcon, EmptyStateTitle, EmptyStateDescription, canCheck, columnActions, listMenuActions, headerBgColor, }: DataTableProps<TData>) => react_jsx_runtime.JSX.Element;
|
|
246
|
+
|
|
247
|
+
interface TableSkeletonProps {
|
|
248
|
+
/** Number of skeleton rows to show */
|
|
249
|
+
rows?: number;
|
|
250
|
+
/** Number of columns (excluding checkbox column if canCheck) */
|
|
251
|
+
columns?: number;
|
|
252
|
+
/** Whether to show a checkbox column */
|
|
253
|
+
canCheck?: boolean;
|
|
254
|
+
/** Whether to show the border */
|
|
255
|
+
withBorder?: boolean;
|
|
256
|
+
/** Border radius */
|
|
257
|
+
borderRadius?: "xs" | "sm" | "md" | "lg" | "xl" | number;
|
|
258
|
+
/** Height of each skeleton row */
|
|
259
|
+
rowHeight?: number;
|
|
260
|
+
}
|
|
261
|
+
declare const TableSkeleton: ({ rows, columns, canCheck, withBorder, borderRadius, rowHeight, }: TableSkeletonProps) => react_jsx_runtime.JSX.Element;
|
|
262
|
+
|
|
263
|
+
export { BottomPagination, CreateEditForm, DataTable, EmptyState, FilterDate, type FilterDateProps, FilterSelect, type FilterSelectProps, FormGenerator, type FormInstance, type FormValues, ImageForm, SearchInput, SimpleDataTable, TableSkeleton, configureImageFormIcons, dateGteFilterFn, fieldGenerator, generateFormSchema };
|