@classytic/fluid 0.4.2 → 0.5.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.
- package/README.md +21 -1
- package/dist/client/calendar.d.mts +1 -2
- package/dist/client/calendar.mjs +4 -4
- package/dist/client/color-picker.d.mts +41 -25
- package/dist/client/color-picker.mjs +121 -73
- package/dist/client/core.d.mts +243 -557
- package/dist/client/core.mjs +351 -1462
- package/dist/client/error.d.mts +41 -41
- package/dist/client/error.mjs +35 -35
- package/dist/client/gallery.d.mts +33 -33
- package/dist/client/gallery.mjs +128 -127
- package/dist/client/hooks.d.mts +57 -39
- package/dist/client/hooks.mjs +29 -7
- package/dist/client/spreadsheet.d.mts +28 -28
- package/dist/client/spreadsheet.mjs +77 -77
- package/dist/client/table.d.mts +66 -33
- package/dist/client/table.mjs +87 -54
- package/dist/client/theme.mjs +1 -1
- package/dist/command.d.mts +6 -4
- package/dist/command.mjs +3 -3
- package/dist/compact.d.mts +97 -95
- package/dist/compact.mjs +336 -322
- package/dist/dashboard.d.mts +614 -422
- package/dist/dashboard.mjs +1051 -762
- package/dist/{dropdown-wrapper-B86u9Fri.mjs → dropdown-wrapper-B9nRDUlz.mjs} +25 -35
- package/dist/forms.d.mts +1037 -972
- package/dist/forms.mjs +2849 -2721
- package/dist/index.d.mts +218 -152
- package/dist/index.mjs +357 -264
- package/dist/layouts.d.mts +94 -94
- package/dist/layouts.mjs +115 -110
- package/dist/phone-input-B9_XPNvv.mjs +429 -0
- package/dist/phone-input-CLH_UjQZ.d.mts +31 -0
- package/dist/{search-context-DR7DBs7S.mjs → search-context-1g3ZmOvx.mjs} +1 -1
- package/dist/search.d.mts +168 -164
- package/dist/search.mjs +305 -301
- package/dist/{sheet-wrapper-C13Y-Q6w.mjs → sheet-wrapper-B2uxookb.mjs} +1 -1
- package/dist/timeline-Bgu1mIe9.d.mts +373 -0
- package/dist/timeline-HJtWf4Op.mjs +804 -0
- package/dist/{use-base-search-BGgWnWaF.d.mts → use-base-search-DFC4QKYU.d.mts} +1 -1
- package/dist/{use-media-query-BnVNIKT4.mjs → use-media-query-ChLfFChU.mjs} +6 -7
- package/package.json +2 -2
- /package/dist/{api-pagination-CJ0vR_w6.d.mts → api-pagination-C30ser2L.d.mts} +0 -0
- /package/dist/{filter-utils-DqMmy_v-.mjs → filter-utils-BGIvtq1R.mjs} +0 -0
- /package/dist/{filter-utils-IZ0GtuPo.d.mts → filter-utils-DOFTBWm1.d.mts} +0 -0
- /package/dist/{use-debounce-xmZucz5e.mjs → use-debounce-BNoNiEon.mjs} +0 -0
- /package/dist/{use-keyboard-shortcut-Bl6YM5Q7.mjs → use-keyboard-shortcut-C_Vk-36P.mjs} +0 -0
- /package/dist/{use-keyboard-shortcut-_mRCh3QO.d.mts → use-keyboard-shortcut-Q4CSPzSI.d.mts} +0 -0
- /package/dist/{use-mobile-BX3SQVo2.mjs → use-mobile-CnEmFiQx.mjs} +0 -0
- /package/dist/{use-scroll-detection-CsgsQYvy.mjs → use-scroll-detection-BKfqkmEC.mjs} +0 -0
- /package/dist/{utils-CDue7cEt.d.mts → utils-rqvYP1by.d.mts} +0 -0
package/dist/client/hooks.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { a as getApiParams, i as clearSearchAndFilterParams, r as buildSearchParams, t as buildFilterParams } from "../filter-utils-
|
|
4
|
-
import { t as
|
|
5
|
-
import { t as
|
|
6
|
-
import { t as
|
|
7
|
-
import {
|
|
8
|
-
import { t as
|
|
3
|
+
import { a as getApiParams, i as clearSearchAndFilterParams, r as buildSearchParams, t as buildFilterParams } from "../filter-utils-BGIvtq1R.mjs";
|
|
4
|
+
import { n as useDebouncedCallback, t as useDebounce } from "../use-debounce-BNoNiEon.mjs";
|
|
5
|
+
import { t as useKeyboardShortcut } from "../use-keyboard-shortcut-C_Vk-36P.mjs";
|
|
6
|
+
import { t as useMediaQuery } from "../use-media-query-ChLfFChU.mjs";
|
|
7
|
+
import { t as useIsMobile } from "../use-mobile-CnEmFiQx.mjs";
|
|
8
|
+
import { t as useScrollDetection } from "../use-scroll-detection-BKfqkmEC.mjs";
|
|
9
9
|
import { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
10
10
|
import { useRouter, useSearchParams } from "next/navigation";
|
|
11
11
|
|
|
@@ -210,6 +210,28 @@ function useBaseSearch(config) {
|
|
|
210
210
|
};
|
|
211
211
|
}
|
|
212
212
|
|
|
213
|
+
//#endregion
|
|
214
|
+
//#region src/hooks/create-search-hook.ts
|
|
215
|
+
/**
|
|
216
|
+
* Factory that pre-configures useBaseSearch with typed defaults.
|
|
217
|
+
*
|
|
218
|
+
* @example
|
|
219
|
+
* ```ts
|
|
220
|
+
* const useOrderSearch = createSearchHook({
|
|
221
|
+
* basePath: "/dashboard/orders",
|
|
222
|
+
* searchFields: { name: "Name", sku: "SKU", barcode: "Barcode" },
|
|
223
|
+
* });
|
|
224
|
+
*
|
|
225
|
+
* // In component:
|
|
226
|
+
* const search = useOrderSearch();
|
|
227
|
+
* ```
|
|
228
|
+
*/
|
|
229
|
+
function createSearchHook(config) {
|
|
230
|
+
return function useConfiguredSearch() {
|
|
231
|
+
return useBaseSearch(config);
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
|
|
213
235
|
//#endregion
|
|
214
236
|
//#region src/hooks/use-copy-to-clipboard.ts
|
|
215
237
|
/**
|
|
@@ -484,4 +506,4 @@ function useLocalStorage(key, initialValue, ttl) {
|
|
|
484
506
|
}
|
|
485
507
|
|
|
486
508
|
//#endregion
|
|
487
|
-
export { TTL, clearStorage, generateUUID, getStorageItem, isStorageEmpty, removeStorageItem, setStorageItem, storage, useBaseSearch, useCopyToClipboard, useDebounce, useDebouncedCallback, useIsMobile, useKeyboardShortcut, useLocalStorage, useMediaQuery, useScrollDetection };
|
|
509
|
+
export { TTL, clearStorage, createSearchHook, generateUUID, getStorageItem, isStorageEmpty, removeStorageItem, setStorageItem, storage, useBaseSearch, useCopyToClipboard, useDebounce, useDebouncedCallback, useIsMobile, useKeyboardShortcut, useLocalStorage, useMediaQuery, useScrollDetection };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
1
|
import * as react from "react";
|
|
3
2
|
import { ComponentType, ReactNode } from "react";
|
|
3
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/components/spreadsheet/types.d.ts
|
|
6
6
|
interface SpreadsheetColumn<TData = unknown> {
|
|
@@ -115,24 +115,6 @@ type SpreadsheetAction<TData = unknown> = {
|
|
|
115
115
|
actions: SpreadsheetAction<TData>[];
|
|
116
116
|
};
|
|
117
117
|
//#endregion
|
|
118
|
-
//#region src/components/spreadsheet/spreadsheet-table.d.ts
|
|
119
|
-
declare function SpreadsheetTable<TData = unknown>({
|
|
120
|
-
columns,
|
|
121
|
-
items,
|
|
122
|
-
orderedIds,
|
|
123
|
-
dispatch,
|
|
124
|
-
isReadOnly,
|
|
125
|
-
footer,
|
|
126
|
-
mobileFooter,
|
|
127
|
-
rowActions,
|
|
128
|
-
className,
|
|
129
|
-
headerClassName,
|
|
130
|
-
ariaLabel,
|
|
131
|
-
onAddRow,
|
|
132
|
-
virtualize,
|
|
133
|
-
estimateRowHeight
|
|
134
|
-
}: SpreadsheetTableProps<TData>): react_jsx_runtime0.JSX.Element;
|
|
135
|
-
//#endregion
|
|
136
118
|
//#region src/components/spreadsheet/spreadsheet-row.d.ts
|
|
137
119
|
interface SpreadsheetRowProps<TData = unknown> {
|
|
138
120
|
rowId: string;
|
|
@@ -169,15 +151,23 @@ declare function SpreadsheetRowInner<TData>({
|
|
|
169
151
|
}: SpreadsheetRowProps<TData>): react_jsx_runtime0.JSX.Element;
|
|
170
152
|
declare const SpreadsheetRow: typeof SpreadsheetRowInner;
|
|
171
153
|
//#endregion
|
|
172
|
-
//#region src/components/spreadsheet/
|
|
173
|
-
declare function
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
154
|
+
//#region src/components/spreadsheet/spreadsheet-table.d.ts
|
|
155
|
+
declare function SpreadsheetTable<TData = unknown>({
|
|
156
|
+
columns,
|
|
157
|
+
items,
|
|
158
|
+
orderedIds,
|
|
159
|
+
dispatch,
|
|
160
|
+
isReadOnly,
|
|
161
|
+
footer,
|
|
162
|
+
mobileFooter,
|
|
163
|
+
rowActions,
|
|
164
|
+
className,
|
|
165
|
+
headerClassName,
|
|
166
|
+
ariaLabel,
|
|
167
|
+
onAddRow,
|
|
168
|
+
virtualize,
|
|
169
|
+
estimateRowHeight
|
|
170
|
+
}: SpreadsheetTableProps<TData>): react_jsx_runtime0.JSX.Element;
|
|
181
171
|
//#endregion
|
|
182
172
|
//#region src/components/spreadsheet/use-spreadsheet-keyboard.d.ts
|
|
183
173
|
interface UseSpreadsheetKeyboardOptions {
|
|
@@ -207,4 +197,14 @@ declare function useSpreadsheetKeyboard({
|
|
|
207
197
|
CELL_ATTR: string;
|
|
208
198
|
};
|
|
209
199
|
//#endregion
|
|
200
|
+
//#region src/components/spreadsheet/use-spreadsheet-store.d.ts
|
|
201
|
+
declare function useSpreadsheetStore<TData>(initialItems?: TData[], getId?: (item: TData) => string): {
|
|
202
|
+
items: Map<string, TData>;
|
|
203
|
+
orderedIds: string[];
|
|
204
|
+
dispatch: react.ActionDispatch<[action: SpreadsheetAction<TData>]>;
|
|
205
|
+
getOrderedItems: () => TData[];
|
|
206
|
+
rowCount: number;
|
|
207
|
+
};
|
|
208
|
+
type SpreadsheetStore<TData> = ReturnType<typeof useSpreadsheetStore<TData>>;
|
|
209
|
+
//#endregion
|
|
210
210
|
export { type CellRenderProps, type SpreadsheetAction, type SpreadsheetColumn, SpreadsheetRow, type SpreadsheetState, type SpreadsheetStore, SpreadsheetTable, type SpreadsheetTableProps, useSpreadsheetKeyboard, useSpreadsheetStore };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
3
|
import { memo, useCallback, useEffect, useMemo, useReducer, useRef } from "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
6
6
|
|
|
7
7
|
//#region src/components/spreadsheet/spreadsheet-row.tsx
|
|
@@ -100,6 +100,82 @@ function rowPropsAreEqual(prev, next) {
|
|
|
100
100
|
}
|
|
101
101
|
const SpreadsheetRow = memo(SpreadsheetRowInner, rowPropsAreEqual);
|
|
102
102
|
|
|
103
|
+
//#endregion
|
|
104
|
+
//#region src/components/spreadsheet/use-spreadsheet-clipboard.ts
|
|
105
|
+
/**
|
|
106
|
+
* Handles copy/pasting from Excel or other spreadsheets natively.
|
|
107
|
+
* Supports matrix pasting (multiple rows and columns at once) via BATCH updates.
|
|
108
|
+
*/
|
|
109
|
+
function useSpreadsheetClipboard({ containerRef, orderedIds, columns, dispatch, isReadOnly = false }) {
|
|
110
|
+
const orderedIdsRef = useRef(orderedIds);
|
|
111
|
+
const columnsRef = useRef(columns);
|
|
112
|
+
const isReadOnlyRef = useRef(isReadOnly);
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
orderedIdsRef.current = orderedIds;
|
|
115
|
+
columnsRef.current = columns;
|
|
116
|
+
isReadOnlyRef.current = isReadOnly;
|
|
117
|
+
}, [
|
|
118
|
+
orderedIds,
|
|
119
|
+
columns,
|
|
120
|
+
isReadOnly
|
|
121
|
+
]);
|
|
122
|
+
useEffect(() => {
|
|
123
|
+
const container = containerRef.current;
|
|
124
|
+
if (!container) return;
|
|
125
|
+
function handlePaste(e) {
|
|
126
|
+
if (isReadOnlyRef.current) return;
|
|
127
|
+
const activeElement = document.activeElement;
|
|
128
|
+
if (!activeElement || !container?.contains(activeElement)) return;
|
|
129
|
+
const cellElement = activeElement.closest("[data-cell]");
|
|
130
|
+
if (!cellElement) return;
|
|
131
|
+
const cellCoord = cellElement.getAttribute("data-cell");
|
|
132
|
+
if (!cellCoord) return;
|
|
133
|
+
const [startRowId, startColId] = cellCoord.split(":");
|
|
134
|
+
const clipboardData = e.clipboardData;
|
|
135
|
+
if (!clipboardData) return;
|
|
136
|
+
const pastedText = clipboardData.getData("text/plain");
|
|
137
|
+
if (!pastedText) return;
|
|
138
|
+
if (!(pastedText.includes(" ") || pastedText.includes("\n"))) return;
|
|
139
|
+
e.preventDefault();
|
|
140
|
+
const currentOrderedIds = orderedIdsRef.current;
|
|
141
|
+
const visibleCols = columnsRef.current.filter((c) => !c.hiddenWhen?.({ isReadOnly: isReadOnlyRef.current }));
|
|
142
|
+
const startRowIdx = currentOrderedIds.indexOf(startRowId);
|
|
143
|
+
const startColIdx = visibleCols.findIndex((c) => c.id === startColId);
|
|
144
|
+
if (startRowIdx === -1 || startColIdx === -1) return;
|
|
145
|
+
const rows = pastedText.replace(/\r?\n$/, "").split(/\r?\n/);
|
|
146
|
+
const batchActions = [];
|
|
147
|
+
rows.forEach((row, rIdx) => {
|
|
148
|
+
const targetRowIdx = startRowIdx + rIdx;
|
|
149
|
+
if (targetRowIdx >= currentOrderedIds.length) return;
|
|
150
|
+
const targetRowId = currentOrderedIds[targetRowIdx];
|
|
151
|
+
row.split(" ").forEach((cellValue, cIdx) => {
|
|
152
|
+
const targetColIdx = startColIdx + cIdx;
|
|
153
|
+
if (targetColIdx >= visibleCols.length) return;
|
|
154
|
+
const col = visibleCols[targetColIdx];
|
|
155
|
+
const field = col.field ?? col.id;
|
|
156
|
+
let value = cellValue;
|
|
157
|
+
if (col.dataType === "number") {
|
|
158
|
+
const num = Number(cellValue);
|
|
159
|
+
value = isNaN(num) ? 0 : num;
|
|
160
|
+
}
|
|
161
|
+
batchActions.push({
|
|
162
|
+
type: "UPDATE_CELL",
|
|
163
|
+
rowId: targetRowId,
|
|
164
|
+
field,
|
|
165
|
+
value
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
if (batchActions.length > 0) dispatch({
|
|
170
|
+
type: "BATCH",
|
|
171
|
+
actions: batchActions
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
container.addEventListener("paste", handlePaste);
|
|
175
|
+
return () => container.removeEventListener("paste", handlePaste);
|
|
176
|
+
}, [containerRef, dispatch]);
|
|
177
|
+
}
|
|
178
|
+
|
|
103
179
|
//#endregion
|
|
104
180
|
//#region src/components/spreadsheet/use-spreadsheet-keyboard.ts
|
|
105
181
|
/**
|
|
@@ -202,82 +278,6 @@ function useSpreadsheetKeyboard({ orderedIds, columnIds, containerRef, onAddRow
|
|
|
202
278
|
};
|
|
203
279
|
}
|
|
204
280
|
|
|
205
|
-
//#endregion
|
|
206
|
-
//#region src/components/spreadsheet/use-spreadsheet-clipboard.ts
|
|
207
|
-
/**
|
|
208
|
-
* Handles copy/pasting from Excel or other spreadsheets natively.
|
|
209
|
-
* Supports matrix pasting (multiple rows and columns at once) via BATCH updates.
|
|
210
|
-
*/
|
|
211
|
-
function useSpreadsheetClipboard({ containerRef, orderedIds, columns, dispatch, isReadOnly = false }) {
|
|
212
|
-
const orderedIdsRef = useRef(orderedIds);
|
|
213
|
-
const columnsRef = useRef(columns);
|
|
214
|
-
const isReadOnlyRef = useRef(isReadOnly);
|
|
215
|
-
useEffect(() => {
|
|
216
|
-
orderedIdsRef.current = orderedIds;
|
|
217
|
-
columnsRef.current = columns;
|
|
218
|
-
isReadOnlyRef.current = isReadOnly;
|
|
219
|
-
}, [
|
|
220
|
-
orderedIds,
|
|
221
|
-
columns,
|
|
222
|
-
isReadOnly
|
|
223
|
-
]);
|
|
224
|
-
useEffect(() => {
|
|
225
|
-
const container = containerRef.current;
|
|
226
|
-
if (!container) return;
|
|
227
|
-
function handlePaste(e) {
|
|
228
|
-
if (isReadOnlyRef.current) return;
|
|
229
|
-
const activeElement = document.activeElement;
|
|
230
|
-
if (!activeElement || !container?.contains(activeElement)) return;
|
|
231
|
-
const cellElement = activeElement.closest("[data-cell]");
|
|
232
|
-
if (!cellElement) return;
|
|
233
|
-
const cellCoord = cellElement.getAttribute("data-cell");
|
|
234
|
-
if (!cellCoord) return;
|
|
235
|
-
const [startRowId, startColId] = cellCoord.split(":");
|
|
236
|
-
const clipboardData = e.clipboardData;
|
|
237
|
-
if (!clipboardData) return;
|
|
238
|
-
const pastedText = clipboardData.getData("text/plain");
|
|
239
|
-
if (!pastedText) return;
|
|
240
|
-
if (!(pastedText.includes(" ") || pastedText.includes("\n"))) return;
|
|
241
|
-
e.preventDefault();
|
|
242
|
-
const currentOrderedIds = orderedIdsRef.current;
|
|
243
|
-
const visibleCols = columnsRef.current.filter((c) => !c.hiddenWhen?.({ isReadOnly: isReadOnlyRef.current }));
|
|
244
|
-
const startRowIdx = currentOrderedIds.indexOf(startRowId);
|
|
245
|
-
const startColIdx = visibleCols.findIndex((c) => c.id === startColId);
|
|
246
|
-
if (startRowIdx === -1 || startColIdx === -1) return;
|
|
247
|
-
const rows = pastedText.replace(/\r?\n$/, "").split(/\r?\n/);
|
|
248
|
-
const batchActions = [];
|
|
249
|
-
rows.forEach((row, rIdx) => {
|
|
250
|
-
const targetRowIdx = startRowIdx + rIdx;
|
|
251
|
-
if (targetRowIdx >= currentOrderedIds.length) return;
|
|
252
|
-
const targetRowId = currentOrderedIds[targetRowIdx];
|
|
253
|
-
row.split(" ").forEach((cellValue, cIdx) => {
|
|
254
|
-
const targetColIdx = startColIdx + cIdx;
|
|
255
|
-
if (targetColIdx >= visibleCols.length) return;
|
|
256
|
-
const col = visibleCols[targetColIdx];
|
|
257
|
-
const field = col.field ?? col.id;
|
|
258
|
-
let value = cellValue;
|
|
259
|
-
if (col.dataType === "number") {
|
|
260
|
-
const num = Number(cellValue);
|
|
261
|
-
value = isNaN(num) ? 0 : num;
|
|
262
|
-
}
|
|
263
|
-
batchActions.push({
|
|
264
|
-
type: "UPDATE_CELL",
|
|
265
|
-
rowId: targetRowId,
|
|
266
|
-
field,
|
|
267
|
-
value
|
|
268
|
-
});
|
|
269
|
-
});
|
|
270
|
-
});
|
|
271
|
-
if (batchActions.length > 0) dispatch({
|
|
272
|
-
type: "BATCH",
|
|
273
|
-
actions: batchActions
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
|
-
container.addEventListener("paste", handlePaste);
|
|
277
|
-
return () => container.removeEventListener("paste", handlePaste);
|
|
278
|
-
}, [containerRef, dispatch]);
|
|
279
|
-
}
|
|
280
|
-
|
|
281
281
|
//#endregion
|
|
282
282
|
//#region src/components/spreadsheet/spreadsheet-table.tsx
|
|
283
283
|
const VIRTUAL_ROW_BASE = {
|
package/dist/client/table.d.mts
CHANGED
|
@@ -1,8 +1,41 @@
|
|
|
1
|
-
import { n as ApiPaginationData } from "../api-pagination-
|
|
2
|
-
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
1
|
+
import { n as ApiPaginationData } from "../api-pagination-C30ser2L.mjs";
|
|
3
2
|
import React$1, { ReactNode } from "react";
|
|
3
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
4
|
import { ColumnDef, Table as TanstackTable, VisibilityState, VisibilityState as VisibilityState$1 } from "@tanstack/react-table";
|
|
5
5
|
|
|
6
|
+
//#region src/components/bulk-action-bar.d.ts
|
|
7
|
+
interface BulkActionBarProps {
|
|
8
|
+
/** Number of selected items */
|
|
9
|
+
count: number;
|
|
10
|
+
/** Callback to clear selection */
|
|
11
|
+
onClear?: () => void;
|
|
12
|
+
/** Label template. Default: "{count} selected" */
|
|
13
|
+
label?: string | ((count: number) => string);
|
|
14
|
+
/** Action buttons (children slot) */
|
|
15
|
+
children?: React.ReactNode;
|
|
16
|
+
/** Position variant */
|
|
17
|
+
position?: "inline" | "sticky" | "fixed";
|
|
18
|
+
/** Additional className for the root container */
|
|
19
|
+
className?: string;
|
|
20
|
+
/** Additional className for the label text */
|
|
21
|
+
labelClassName?: string;
|
|
22
|
+
/** Additional className for the actions wrapper */
|
|
23
|
+
actionsClassName?: string;
|
|
24
|
+
/** Disable entrance animation */
|
|
25
|
+
animated?: boolean;
|
|
26
|
+
}
|
|
27
|
+
declare function BulkActionBar({
|
|
28
|
+
count,
|
|
29
|
+
onClear,
|
|
30
|
+
label,
|
|
31
|
+
children,
|
|
32
|
+
position,
|
|
33
|
+
className,
|
|
34
|
+
labelClassName,
|
|
35
|
+
actionsClassName,
|
|
36
|
+
animated
|
|
37
|
+
}: BulkActionBarProps): react_jsx_runtime0.JSX.Element | null;
|
|
38
|
+
//#endregion
|
|
6
39
|
//#region src/components/data-table.d.ts
|
|
7
40
|
interface DataTablePaginationProps extends Partial<ApiPaginationData> {
|
|
8
41
|
onPageChange?: (page: number) => void;
|
|
@@ -40,6 +73,36 @@ declare function DataTable<TData, TValue>({
|
|
|
40
73
|
emptyState: customEmptyState
|
|
41
74
|
}: DataTableProps<TData, TValue>): react_jsx_runtime0.JSX.Element;
|
|
42
75
|
//#endregion
|
|
76
|
+
//#region src/components/data-table-column-toggle.d.ts
|
|
77
|
+
interface ToggleableColumn {
|
|
78
|
+
/** Column ID (must match the column key used in VisibilityState) */
|
|
79
|
+
id: string;
|
|
80
|
+
/** Display name shown in the toggle list */
|
|
81
|
+
header: string;
|
|
82
|
+
}
|
|
83
|
+
interface DataTableColumnToggleProps {
|
|
84
|
+
/** List of columns that can be toggled. Derive from your ColumnDef array. */
|
|
85
|
+
columns: ToggleableColumn[];
|
|
86
|
+
/** Controlled visibility state. Keys are column IDs, values are booleans. */
|
|
87
|
+
columnVisibility: VisibilityState$1;
|
|
88
|
+
/** Callback when visibility changes. */
|
|
89
|
+
onColumnVisibilityChange: (visibility: VisibilityState$1) => void;
|
|
90
|
+
/** Custom trigger element. Defaults to a Settings2 icon button. */
|
|
91
|
+
trigger?: React.ReactNode;
|
|
92
|
+
/** Label shown at the top of the dropdown */
|
|
93
|
+
label?: string;
|
|
94
|
+
/** Additional className for the trigger button */
|
|
95
|
+
className?: string;
|
|
96
|
+
}
|
|
97
|
+
declare function DataTableColumnToggle({
|
|
98
|
+
columns,
|
|
99
|
+
columnVisibility,
|
|
100
|
+
onColumnVisibilityChange,
|
|
101
|
+
trigger,
|
|
102
|
+
label,
|
|
103
|
+
className
|
|
104
|
+
}: DataTableColumnToggleProps): react_jsx_runtime0.JSX.Element;
|
|
105
|
+
//#endregion
|
|
43
106
|
//#region src/components/data-table-toolbar.d.ts
|
|
44
107
|
interface DataTableToolbarProps {
|
|
45
108
|
children?: ReactNode;
|
|
@@ -87,34 +150,4 @@ declare function DataTableToolbar({
|
|
|
87
150
|
showResultCount
|
|
88
151
|
}: DataTableToolbarProps): react_jsx_runtime0.JSX.Element;
|
|
89
152
|
//#endregion
|
|
90
|
-
|
|
91
|
-
interface ToggleableColumn {
|
|
92
|
-
/** Column ID (must match the column key used in VisibilityState) */
|
|
93
|
-
id: string;
|
|
94
|
-
/** Display name shown in the toggle list */
|
|
95
|
-
header: string;
|
|
96
|
-
}
|
|
97
|
-
interface DataTableColumnToggleProps {
|
|
98
|
-
/** List of columns that can be toggled. Derive from your ColumnDef array. */
|
|
99
|
-
columns: ToggleableColumn[];
|
|
100
|
-
/** Controlled visibility state. Keys are column IDs, values are booleans. */
|
|
101
|
-
columnVisibility: VisibilityState$1;
|
|
102
|
-
/** Callback when visibility changes. */
|
|
103
|
-
onColumnVisibilityChange: (visibility: VisibilityState$1) => void;
|
|
104
|
-
/** Custom trigger element. Defaults to a Settings2 icon button. */
|
|
105
|
-
trigger?: React.ReactNode;
|
|
106
|
-
/** Label shown at the top of the dropdown */
|
|
107
|
-
label?: string;
|
|
108
|
-
/** Additional className for the trigger button */
|
|
109
|
-
className?: string;
|
|
110
|
-
}
|
|
111
|
-
declare function DataTableColumnToggle({
|
|
112
|
-
columns,
|
|
113
|
-
columnVisibility,
|
|
114
|
-
onColumnVisibilityChange,
|
|
115
|
-
trigger,
|
|
116
|
-
label,
|
|
117
|
-
className
|
|
118
|
-
}: DataTableColumnToggleProps): react_jsx_runtime0.JSX.Element;
|
|
119
|
-
//#endregion
|
|
120
|
-
export { DataTable, DataTableColumnToggle, type DataTableColumnToggleProps, type DataTablePaginationProps, type DataTableProps, DataTableToolbar, type DataTableToolbarProps, type TanstackTable, type ToggleableColumn, type VisibilityState };
|
|
153
|
+
export { BulkActionBar, type BulkActionBarProps, DataTable, DataTableColumnToggle, type DataTableColumnToggleProps, type DataTablePaginationProps, type DataTableProps, DataTableToolbar, type DataTableToolbarProps, type TanstackTable, type ToggleableColumn, type VisibilityState };
|
package/dist/client/table.mjs
CHANGED
|
@@ -1,23 +1,56 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { t as cn } from "../utils-DQ5SCVoW.mjs";
|
|
4
|
-
import { t as useIsMobile } from "../use-mobile-
|
|
5
|
-
import { t as useScrollDetection } from "../use-scroll-detection-
|
|
6
|
-
import { o as ApiPagination, r as DropdownWrapper } from "../dropdown-wrapper-
|
|
7
|
-
import { n as useSearch } from "../search-context-
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
4
|
+
import { t as useIsMobile } from "../use-mobile-CnEmFiQx.mjs";
|
|
5
|
+
import { t as useScrollDetection } from "../use-scroll-detection-BKfqkmEC.mjs";
|
|
6
|
+
import { o as ApiPagination, r as DropdownWrapper } from "../dropdown-wrapper-B9nRDUlz.mjs";
|
|
7
|
+
import { n as useSearch } from "../search-context-1g3ZmOvx.mjs";
|
|
8
|
+
import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
9
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
11
10
|
import { ArrowDown, ArrowUp, ArrowUpDown, ChevronLeft, ChevronRight, Search, Settings2, SlidersHorizontal, X } from "lucide-react";
|
|
12
11
|
import { Button } from "@/components/ui/button";
|
|
12
|
+
import { Badge } from "@/components/ui/badge";
|
|
13
|
+
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
|
|
13
14
|
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
|
|
14
15
|
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
|
|
15
|
-
import { Badge } from "@/components/ui/badge";
|
|
16
16
|
import { Sheet, SheetContent, SheetHeader, SheetTitle } from "@/components/ui/sheet";
|
|
17
17
|
import { flexRender, getCoreRowModel, getSortedRowModel, useReactTable } from "@tanstack/react-table";
|
|
18
|
-
import { Input } from "@/components/ui/input";
|
|
19
18
|
import { Checkbox } from "@/components/ui/checkbox";
|
|
19
|
+
import { Input } from "@/components/ui/input";
|
|
20
|
+
|
|
21
|
+
//#region src/components/bulk-action-bar.tsx
|
|
22
|
+
function BulkActionBar({ count, onClear, label, children, position = "inline", className, labelClassName, actionsClassName, animated = true }) {
|
|
23
|
+
if (count <= 0) return null;
|
|
24
|
+
const displayLabel = typeof label === "function" ? label(count) : label ?? `${count} selected`;
|
|
25
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
26
|
+
className: cn("flex items-center gap-3 rounded-lg border bg-muted/50 px-4 py-2", animated && "animate-in fade-in slide-in-from-bottom-2 duration-200", position === "sticky" && "sticky bottom-4 z-40 shadow-lg", position === "fixed" && "fixed bottom-4 left-1/2 -translate-x-1/2 z-50 shadow-lg", className),
|
|
27
|
+
role: "toolbar",
|
|
28
|
+
"aria-label": "Bulk actions",
|
|
29
|
+
children: [
|
|
30
|
+
/* @__PURE__ */ jsx("span", {
|
|
31
|
+
className: cn("text-sm font-medium text-foreground", labelClassName),
|
|
32
|
+
children: displayLabel
|
|
33
|
+
}),
|
|
34
|
+
onClear && /* @__PURE__ */ jsx(Button, {
|
|
35
|
+
variant: "ghost",
|
|
36
|
+
size: "icon",
|
|
37
|
+
className: "h-7 w-7 shrink-0",
|
|
38
|
+
onClick: onClear,
|
|
39
|
+
"aria-label": "Clear selection",
|
|
40
|
+
children: /* @__PURE__ */ jsx(X, { className: "h-3.5 w-3.5" })
|
|
41
|
+
}),
|
|
42
|
+
children && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", {
|
|
43
|
+
"aria-hidden": "true",
|
|
44
|
+
className: "h-4 w-px bg-border"
|
|
45
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
46
|
+
className: cn("flex items-center gap-2", actionsClassName),
|
|
47
|
+
children
|
|
48
|
+
})] })
|
|
49
|
+
]
|
|
50
|
+
});
|
|
51
|
+
}
|
|
20
52
|
|
|
53
|
+
//#endregion
|
|
21
54
|
//#region src/components/data-table.tsx
|
|
22
55
|
const ScrollButton = React.memo(function ScrollButton({ direction, onClick, visible, className }) {
|
|
23
56
|
if (!visible) return null;
|
|
@@ -104,7 +137,7 @@ function DataTable({ columns, data, isLoading = false, pagination, enableSorting
|
|
|
104
137
|
const timer = setTimeout(checkScroll, 150);
|
|
105
138
|
return () => clearTimeout(timer);
|
|
106
139
|
}, [data, checkScroll]);
|
|
107
|
-
const defaultLoadingState =
|
|
140
|
+
const defaultLoadingState = /* @__PURE__ */ jsx("div", {
|
|
108
141
|
className: "w-full h-full min-h-[24rem] flex items-center justify-center bg-background/50 rounded-lg border border-border",
|
|
109
142
|
children: /* @__PURE__ */ jsxs("div", {
|
|
110
143
|
className: "flex flex-col items-center gap-3",
|
|
@@ -113,9 +146,9 @@ function DataTable({ columns, data, isLoading = false, pagination, enableSorting
|
|
|
113
146
|
children: "Loading data..."
|
|
114
147
|
})]
|
|
115
148
|
})
|
|
116
|
-
})
|
|
149
|
+
});
|
|
117
150
|
const visibleColumnCount = table.getVisibleLeafColumns().length;
|
|
118
|
-
const defaultEmptyState =
|
|
151
|
+
const defaultEmptyState = /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(TableCell, {
|
|
119
152
|
colSpan: visibleColumnCount,
|
|
120
153
|
className: "h-32 text-center",
|
|
121
154
|
children: /* @__PURE__ */ jsxs("div", {
|
|
@@ -135,8 +168,8 @@ function DataTable({ columns, data, isLoading = false, pagination, enableSorting
|
|
|
135
168
|
})
|
|
136
169
|
]
|
|
137
170
|
})
|
|
138
|
-
}) })
|
|
139
|
-
if (isLoading) return /* @__PURE__ */ jsx(Fragment, { children: customLoadingState || defaultLoadingState });
|
|
171
|
+
}) });
|
|
172
|
+
if (isLoading) return /* @__PURE__ */ jsx(Fragment$1, { children: customLoadingState || defaultLoadingState });
|
|
140
173
|
return /* @__PURE__ */ jsxs("div", {
|
|
141
174
|
className: cn("flex flex-col h-full gap-4", className),
|
|
142
175
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
@@ -197,6 +230,44 @@ function DataTable({ columns, data, isLoading = false, pagination, enableSorting
|
|
|
197
230
|
});
|
|
198
231
|
}
|
|
199
232
|
|
|
233
|
+
//#endregion
|
|
234
|
+
//#region src/components/data-table-column-toggle.tsx
|
|
235
|
+
function DataTableColumnToggle({ columns, columnVisibility, onColumnVisibilityChange, trigger, label = "Columns", className }) {
|
|
236
|
+
const defaultTrigger = /* @__PURE__ */ jsxs(Button, {
|
|
237
|
+
variant: "outline",
|
|
238
|
+
size: "sm",
|
|
239
|
+
className: cn("shrink-0", className),
|
|
240
|
+
children: [/* @__PURE__ */ jsx(Settings2, { className: "mr-2 h-4 w-4" }), label]
|
|
241
|
+
});
|
|
242
|
+
return /* @__PURE__ */ jsxs(DropdownWrapper, {
|
|
243
|
+
trigger: trigger ?? defaultTrigger,
|
|
244
|
+
contentClassName: "min-w-[150px]",
|
|
245
|
+
children: [
|
|
246
|
+
/* @__PURE__ */ jsx("div", {
|
|
247
|
+
className: "px-1.5 py-1 text-xs font-medium text-muted-foreground",
|
|
248
|
+
children: label
|
|
249
|
+
}),
|
|
250
|
+
/* @__PURE__ */ jsx("div", { className: "bg-border -mx-1 my-1 h-px" }),
|
|
251
|
+
columns.map((col) => {
|
|
252
|
+
const isVisible = columnVisibility[col.id] !== false;
|
|
253
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
254
|
+
role: "menuitemcheckbox",
|
|
255
|
+
"aria-checked": isVisible,
|
|
256
|
+
className: "flex items-center gap-2 rounded-md px-2 py-1.5 text-sm cursor-pointer hover:bg-accent select-none",
|
|
257
|
+
onClick: () => onColumnVisibilityChange({
|
|
258
|
+
...columnVisibility,
|
|
259
|
+
[col.id]: !isVisible
|
|
260
|
+
}),
|
|
261
|
+
children: [/* @__PURE__ */ jsx(Checkbox, {
|
|
262
|
+
checked: isVisible,
|
|
263
|
+
className: "pointer-events-none"
|
|
264
|
+
}), col.header]
|
|
265
|
+
}, col.id);
|
|
266
|
+
})
|
|
267
|
+
]
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
|
|
200
271
|
//#endregion
|
|
201
272
|
//#region src/components/data-table-toolbar.tsx
|
|
202
273
|
/**
|
|
@@ -243,7 +314,7 @@ function DataTableToolbar({ children, className, showSearch = true, searchPlaceh
|
|
|
243
314
|
children
|
|
244
315
|
]
|
|
245
316
|
});
|
|
246
|
-
const filterElement = showFilters && filterContent && /* @__PURE__ */ jsx(Fragment, { children: isMobile ? /* @__PURE__ */ jsxs(Sheet, {
|
|
317
|
+
const filterElement = showFilters && filterContent && /* @__PURE__ */ jsx(Fragment$1, { children: isMobile ? /* @__PURE__ */ jsxs(Sheet, {
|
|
247
318
|
open: filterOpen,
|
|
248
319
|
onOpenChange: setFilterOpen,
|
|
249
320
|
children: [/* @__PURE__ */ jsxs(Button, {
|
|
@@ -379,42 +450,4 @@ function DataTableToolbar({ children, className, showSearch = true, searchPlaceh
|
|
|
379
450
|
}
|
|
380
451
|
|
|
381
452
|
//#endregion
|
|
382
|
-
|
|
383
|
-
function DataTableColumnToggle({ columns, columnVisibility, onColumnVisibilityChange, trigger, label = "Columns", className }) {
|
|
384
|
-
const defaultTrigger = /* @__PURE__ */ jsxs(Button, {
|
|
385
|
-
variant: "outline",
|
|
386
|
-
size: "sm",
|
|
387
|
-
className: cn("shrink-0", className),
|
|
388
|
-
children: [/* @__PURE__ */ jsx(Settings2, { className: "mr-2 h-4 w-4" }), label]
|
|
389
|
-
});
|
|
390
|
-
return /* @__PURE__ */ jsxs(DropdownWrapper, {
|
|
391
|
-
trigger: trigger ?? defaultTrigger,
|
|
392
|
-
contentClassName: "min-w-[150px]",
|
|
393
|
-
children: [
|
|
394
|
-
/* @__PURE__ */ jsx("div", {
|
|
395
|
-
className: "px-1.5 py-1 text-xs font-medium text-muted-foreground",
|
|
396
|
-
children: label
|
|
397
|
-
}),
|
|
398
|
-
/* @__PURE__ */ jsx("div", { className: "bg-border -mx-1 my-1 h-px" }),
|
|
399
|
-
columns.map((col) => {
|
|
400
|
-
const isVisible = columnVisibility[col.id] !== false;
|
|
401
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
402
|
-
role: "menuitemcheckbox",
|
|
403
|
-
"aria-checked": isVisible,
|
|
404
|
-
className: "flex items-center gap-2 rounded-md px-2 py-1.5 text-sm cursor-pointer hover:bg-accent select-none",
|
|
405
|
-
onClick: () => onColumnVisibilityChange({
|
|
406
|
-
...columnVisibility,
|
|
407
|
-
[col.id]: !isVisible
|
|
408
|
-
}),
|
|
409
|
-
children: [/* @__PURE__ */ jsx(Checkbox, {
|
|
410
|
-
checked: isVisible,
|
|
411
|
-
className: "pointer-events-none"
|
|
412
|
-
}), col.header]
|
|
413
|
-
}, col.id);
|
|
414
|
-
})
|
|
415
|
-
]
|
|
416
|
-
});
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
//#endregion
|
|
420
|
-
export { DataTable, DataTableColumnToggle, DataTableToolbar };
|
|
453
|
+
export { BulkActionBar, DataTable, DataTableColumnToggle, DataTableToolbar };
|
package/dist/client/theme.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
3
|
import * as React$1 from "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { Moon, Sun } from "lucide-react";
|
|
6
6
|
import { Button } from "@/components/ui/button";
|
|
7
7
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
|
package/dist/command.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as useKeyboardShortcut } from "./use-keyboard-shortcut-
|
|
1
|
+
import { n as useKeyboardShortcut } from "./use-keyboard-shortcut-Q4CSPzSI.mjs";
|
|
2
|
+
import React, { ReactNode } from "react";
|
|
2
3
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
-
import { ReactNode } from "react";
|
|
4
4
|
|
|
5
5
|
//#region src/components/command/command-search.d.ts
|
|
6
6
|
interface CommandSearchContextValue {
|
|
@@ -43,8 +43,10 @@ interface CommandSearchGroupProps {
|
|
|
43
43
|
}
|
|
44
44
|
interface CommandSearchItemProps {
|
|
45
45
|
children: ReactNode;
|
|
46
|
-
/** Icon
|
|
47
|
-
icon?: ReactNode
|
|
46
|
+
/** Icon — accepts a rendered element (`<Home />`) or a component (`Home`). */
|
|
47
|
+
icon?: ReactNode | React.ComponentType<{
|
|
48
|
+
className?: string;
|
|
49
|
+
}>;
|
|
48
50
|
/** Keyboard shortcut displayed via Kbd component */
|
|
49
51
|
shortcut?: string;
|
|
50
52
|
/** Called when the item is selected */
|
package/dist/command.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { t as cn } from "./utils-DQ5SCVoW.mjs";
|
|
4
|
-
import { t as useKeyboardShortcut } from "./use-keyboard-shortcut-
|
|
4
|
+
import { t as useKeyboardShortcut } from "./use-keyboard-shortcut-C_Vk-36P.mjs";
|
|
5
|
+
import React, { createContext, useCallback, useContext, useState } from "react";
|
|
5
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
import { createContext, useCallback, useContext, useState } from "react";
|
|
7
7
|
import { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator } from "@/components/ui/command";
|
|
8
8
|
import { Kbd } from "@/components/ui/kbd";
|
|
9
9
|
|
|
@@ -100,7 +100,7 @@ function CommandSearchItemComponent({ children, icon, shortcut: shortcutDisplay,
|
|
|
100
100
|
children: [
|
|
101
101
|
icon && /* @__PURE__ */ jsx("span", {
|
|
102
102
|
className: "shrink-0",
|
|
103
|
-
children: icon
|
|
103
|
+
children: typeof icon === "function" ? React.createElement(icon, { className: "h-4 w-4" }) : icon
|
|
104
104
|
}),
|
|
105
105
|
/* @__PURE__ */ jsx("span", {
|
|
106
106
|
className: "flex-1",
|