@sustaina/shared-ui 1.7.1 → 1.7.3
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 +38 -45
- package/dist/index.d.ts +38 -45
- package/dist/index.js +112 -106
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +110 -103
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -302,16 +302,6 @@ type UsePreventPageLeaveOptions = {
|
|
|
302
302
|
};
|
|
303
303
|
declare const usePreventPageLeave: ({ isPrevening }: UsePreventPageLeaveOptions) => void;
|
|
304
304
|
|
|
305
|
-
declare const buttonVariants: (props?: ({
|
|
306
|
-
variant?: "link" | "default" | "outline" | "cancel" | "destructive" | "secondary" | "ghost" | "defaultSelect" | "defaultOutline" | null | undefined;
|
|
307
|
-
size?: "default" | "option" | "icon" | "sm" | "lg" | "icon-xs" | "icon-sm" | "icon-md" | "icon-lg" | null | undefined;
|
|
308
|
-
active?: boolean | null | undefined;
|
|
309
|
-
} & class_variance_authority_dist_types.ClassProp) | undefined) => string;
|
|
310
|
-
declare function Button({ className, variant, size, active, asChild, ...props }: React$1.ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
|
|
311
|
-
asChild?: boolean;
|
|
312
|
-
active?: boolean;
|
|
313
|
-
}): react_jsx_runtime.JSX.Element;
|
|
314
|
-
|
|
315
305
|
type Column = {
|
|
316
306
|
id: string;
|
|
317
307
|
label?: string;
|
|
@@ -336,10 +326,46 @@ type GridSettingsModalProps = {
|
|
|
336
326
|
currentColumns: Column[];
|
|
337
327
|
limit?: number;
|
|
338
328
|
onClose: () => void;
|
|
339
|
-
onSaveColumns?: (payload: GridPayload) => void;
|
|
329
|
+
onSaveColumns?: (payload: GridPayload, currentColumns: Column[]) => void;
|
|
340
330
|
};
|
|
341
331
|
declare const GridSettingsModal: ({ isOpen, headerClassname, descriptionClassname, addButtonClassname, saveButtonClassname, availableColumns, currentColumns, limit, onClose, onSaveColumns }: GridSettingsModalProps) => react_jsx_runtime.JSX.Element;
|
|
342
332
|
|
|
333
|
+
type KeyOrString<T> = keyof T | (string & {});
|
|
334
|
+
type TanstackTableInstance = {
|
|
335
|
+
getAllColumns(): any[];
|
|
336
|
+
getVisibleLeafColumns(): any[];
|
|
337
|
+
};
|
|
338
|
+
type UseGridSettingsStoreActions = {
|
|
339
|
+
setAvailableColumns: (cols: Column[]) => void;
|
|
340
|
+
setCurrentColumns: (cols: Column[]) => void;
|
|
341
|
+
setPayload: (payload: GridPayload) => void;
|
|
342
|
+
reset: () => void;
|
|
343
|
+
extractColumns: (table: TanstackTableInstance) => {
|
|
344
|
+
availableColumns: Column[];
|
|
345
|
+
currentColumns: Column[];
|
|
346
|
+
};
|
|
347
|
+
syncColumnsState: <TData = RowData$1>(table: Table$1<TData>, options?: {
|
|
348
|
+
excludeColumns: KeyOrString<TData>[];
|
|
349
|
+
labelMap?: Partial<Record<KeyOrString<TData>, string>>;
|
|
350
|
+
}) => void;
|
|
351
|
+
};
|
|
352
|
+
type UseGridSettingsStoreState = {
|
|
353
|
+
availableColumns: Column[];
|
|
354
|
+
currentColumns: Column[];
|
|
355
|
+
payload: GridPayload;
|
|
356
|
+
};
|
|
357
|
+
declare const useGridSettingsStore: zustand.UseBoundStore<zustand.StoreApi<UseGridSettingsStoreState & UseGridSettingsStoreActions>>;
|
|
358
|
+
|
|
359
|
+
declare const buttonVariants: (props?: ({
|
|
360
|
+
variant?: "link" | "default" | "outline" | "cancel" | "destructive" | "secondary" | "ghost" | "defaultSelect" | "defaultOutline" | null | undefined;
|
|
361
|
+
size?: "default" | "option" | "icon" | "sm" | "lg" | "icon-xs" | "icon-sm" | "icon-md" | "icon-lg" | null | undefined;
|
|
362
|
+
active?: boolean | null | undefined;
|
|
363
|
+
} & class_variance_authority_dist_types.ClassProp) | undefined) => string;
|
|
364
|
+
declare function Button({ className, variant, size, active, asChild, ...props }: React$1.ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
|
|
365
|
+
asChild?: boolean;
|
|
366
|
+
active?: boolean;
|
|
367
|
+
}): react_jsx_runtime.JSX.Element;
|
|
368
|
+
|
|
343
369
|
type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
|
|
344
370
|
[K in Keys]: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;
|
|
345
371
|
}[Keys];
|
|
@@ -454,39 +480,6 @@ declare function stripNullishObject<T extends Record<string, any>>(value: Partia
|
|
|
454
480
|
*/
|
|
455
481
|
declare function cn(...args: ClassValue[]): string;
|
|
456
482
|
|
|
457
|
-
type TanstackTableInstance$1 = {
|
|
458
|
-
getAllColumns(): any[];
|
|
459
|
-
};
|
|
460
|
-
declare function getColumnIdFromTable<T extends TanstackTableInstance$1>(table: T): {
|
|
461
|
-
availableColumns: {
|
|
462
|
-
id: any;
|
|
463
|
-
}[];
|
|
464
|
-
currentColumns: {
|
|
465
|
-
id: any;
|
|
466
|
-
}[];
|
|
467
|
-
};
|
|
468
|
-
|
|
469
|
-
type TanstackTableInstance = {
|
|
470
|
-
getAllColumns(): any[];
|
|
471
|
-
getVisibleLeafColumns(): any[];
|
|
472
|
-
};
|
|
473
|
-
type UseGridSettingsStoreActions = {
|
|
474
|
-
setAvailableColumns: (cols: Column[]) => void;
|
|
475
|
-
setCurrentColumns: (cols: Column[]) => void;
|
|
476
|
-
setPayload: (payload: GridPayload) => void;
|
|
477
|
-
reset: () => void;
|
|
478
|
-
extractColumns: (table: TanstackTableInstance) => {
|
|
479
|
-
availableColumns: Column[];
|
|
480
|
-
currentColumns: Column[];
|
|
481
|
-
};
|
|
482
|
-
};
|
|
483
|
-
type UseGridSettingsStoreState = {
|
|
484
|
-
availableColumns: Column[];
|
|
485
|
-
currentColumns: Column[];
|
|
486
|
-
payload: GridPayload;
|
|
487
|
-
};
|
|
488
|
-
declare const useGridSettingsStore: zustand.UseBoundStore<zustand.StoreApi<UseGridSettingsStoreState & UseGridSettingsStoreActions>>;
|
|
489
|
-
|
|
490
483
|
type UseHoverResult = {
|
|
491
484
|
ref: React__default.RefCallback<HTMLElement>;
|
|
492
485
|
hovering: boolean;
|
|
@@ -538,4 +531,4 @@ type UseTruncatedOptions<T> = {
|
|
|
538
531
|
type UseTruncatedResult = boolean;
|
|
539
532
|
declare const useTruncated: <T extends HTMLElement = any>({ elementRef, onChange, resizeDetectDelay }: UseTruncatedOptions<T>) => UseTruncatedResult;
|
|
540
533
|
|
|
541
|
-
export { AdvanceSearch, type Breakpoints, Button, type Column, type ContentSlot, DataTable, type DataTableChildrenKeyHandler, type DataTableColumnFilter, type DataTableColumnFilterProps, type DataTableColumnGrouping, type DataTableColumnOrdering, type DataTableColumnPinning, type DataTableColumnSorting, type DataTableColumnVisibility, type DataTableComponentProps, type DataTableFilterConfig, type DataTableFilters, type DataTableGlobalFilter, type DataTableHeaderCell, type DataTableProps, type DataTableRenderHeaderHandler, type DataTableRenderHeaderProps, type DataTableRenderRowHandler, type DataTableRenderRowProps, type DataTableRowCell, type DataTableRowClickHandler, type DataTableRowClickMode, type DataTableRowExpansion, type DataTableRowIdKeyHandler, type DataTableRowSelection, type DataTableScrollFetch, type DataTableStatusContent, type DatatableColumnResizing, DialogAlert, type DialogAlertProps, type DialogVariant, type FieldSchema, FormErrorMessage, type FormErrorMessageProps, FormField, FormFieldContext, type FormFieldContextValue, type FormFieldProps, FormItem, FormItemContext, type FormItemContextValue, type FormItemProps, FormLabel, type FormLabelProps, type GridPayload, GridSettingsModal, type GridSettingsModalProps, HeaderCell, type HeaderCellProps, _default as Navbar, type NavbarProps, NumberInput, type NumberInputProps, PreventPageLeave, type RowClickType, type ScrollInfo, type SorterProps, TextInput, type TextInputProps, type UseFormFieldOptions, type UseFormFieldReturn, type UseHoverResult, type UseMediaQueryOptions, type UseMediaQueryResult, type UsePreventPageLeaveOptions, type UseScreenSizeResult, type UseTruncatedOptions, type UseTruncatedResult, booleanToSelectValue, buttonVariants, cn, compareAlphanumeric, debounce,
|
|
534
|
+
export { AdvanceSearch, type Breakpoints, Button, type Column, type ContentSlot, DataTable, type DataTableChildrenKeyHandler, type DataTableColumnFilter, type DataTableColumnFilterProps, type DataTableColumnGrouping, type DataTableColumnOrdering, type DataTableColumnPinning, type DataTableColumnSorting, type DataTableColumnVisibility, type DataTableComponentProps, type DataTableFilterConfig, type DataTableFilters, type DataTableGlobalFilter, type DataTableHeaderCell, type DataTableProps, type DataTableRenderHeaderHandler, type DataTableRenderHeaderProps, type DataTableRenderRowHandler, type DataTableRenderRowProps, type DataTableRowCell, type DataTableRowClickHandler, type DataTableRowClickMode, type DataTableRowExpansion, type DataTableRowIdKeyHandler, type DataTableRowSelection, type DataTableScrollFetch, type DataTableStatusContent, type DatatableColumnResizing, DialogAlert, type DialogAlertProps, type DialogVariant, type FieldSchema, FormErrorMessage, type FormErrorMessageProps, FormField, FormFieldContext, type FormFieldContextValue, type FormFieldProps, FormItem, FormItemContext, type FormItemContextValue, type FormItemProps, FormLabel, type FormLabelProps, type GridPayload, GridSettingsModal, type GridSettingsModalProps, HeaderCell, type HeaderCellProps, _default as Navbar, type NavbarProps, NumberInput, type NumberInputProps, PreventPageLeave, type RowClickType, type ScrollInfo, type SorterProps, TextInput, type TextInputProps, type UseFormFieldOptions, type UseFormFieldReturn, type UseHoverResult, type UseMediaQueryOptions, type UseMediaQueryResult, type UsePreventPageLeaveOptions, type UseScreenSizeResult, type UseTruncatedOptions, type UseTruncatedResult, booleanToSelectValue, buttonVariants, cn, compareAlphanumeric, debounce, isDefined, isEmptyObject, renderContentSlot, selectValueToBoolean, stripNullishObject, useFormField, useGridSettingsStore, useHover, useIntersectionObserver, useMediaQuery, usePreventPageLeave, usePreventPageLeaveStore, useScreenSize, useTruncated };
|
package/dist/index.d.ts
CHANGED
|
@@ -302,16 +302,6 @@ type UsePreventPageLeaveOptions = {
|
|
|
302
302
|
};
|
|
303
303
|
declare const usePreventPageLeave: ({ isPrevening }: UsePreventPageLeaveOptions) => void;
|
|
304
304
|
|
|
305
|
-
declare const buttonVariants: (props?: ({
|
|
306
|
-
variant?: "link" | "default" | "outline" | "cancel" | "destructive" | "secondary" | "ghost" | "defaultSelect" | "defaultOutline" | null | undefined;
|
|
307
|
-
size?: "default" | "option" | "icon" | "sm" | "lg" | "icon-xs" | "icon-sm" | "icon-md" | "icon-lg" | null | undefined;
|
|
308
|
-
active?: boolean | null | undefined;
|
|
309
|
-
} & class_variance_authority_dist_types.ClassProp) | undefined) => string;
|
|
310
|
-
declare function Button({ className, variant, size, active, asChild, ...props }: React$1.ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
|
|
311
|
-
asChild?: boolean;
|
|
312
|
-
active?: boolean;
|
|
313
|
-
}): react_jsx_runtime.JSX.Element;
|
|
314
|
-
|
|
315
305
|
type Column = {
|
|
316
306
|
id: string;
|
|
317
307
|
label?: string;
|
|
@@ -336,10 +326,46 @@ type GridSettingsModalProps = {
|
|
|
336
326
|
currentColumns: Column[];
|
|
337
327
|
limit?: number;
|
|
338
328
|
onClose: () => void;
|
|
339
|
-
onSaveColumns?: (payload: GridPayload) => void;
|
|
329
|
+
onSaveColumns?: (payload: GridPayload, currentColumns: Column[]) => void;
|
|
340
330
|
};
|
|
341
331
|
declare const GridSettingsModal: ({ isOpen, headerClassname, descriptionClassname, addButtonClassname, saveButtonClassname, availableColumns, currentColumns, limit, onClose, onSaveColumns }: GridSettingsModalProps) => react_jsx_runtime.JSX.Element;
|
|
342
332
|
|
|
333
|
+
type KeyOrString<T> = keyof T | (string & {});
|
|
334
|
+
type TanstackTableInstance = {
|
|
335
|
+
getAllColumns(): any[];
|
|
336
|
+
getVisibleLeafColumns(): any[];
|
|
337
|
+
};
|
|
338
|
+
type UseGridSettingsStoreActions = {
|
|
339
|
+
setAvailableColumns: (cols: Column[]) => void;
|
|
340
|
+
setCurrentColumns: (cols: Column[]) => void;
|
|
341
|
+
setPayload: (payload: GridPayload) => void;
|
|
342
|
+
reset: () => void;
|
|
343
|
+
extractColumns: (table: TanstackTableInstance) => {
|
|
344
|
+
availableColumns: Column[];
|
|
345
|
+
currentColumns: Column[];
|
|
346
|
+
};
|
|
347
|
+
syncColumnsState: <TData = RowData$1>(table: Table$1<TData>, options?: {
|
|
348
|
+
excludeColumns: KeyOrString<TData>[];
|
|
349
|
+
labelMap?: Partial<Record<KeyOrString<TData>, string>>;
|
|
350
|
+
}) => void;
|
|
351
|
+
};
|
|
352
|
+
type UseGridSettingsStoreState = {
|
|
353
|
+
availableColumns: Column[];
|
|
354
|
+
currentColumns: Column[];
|
|
355
|
+
payload: GridPayload;
|
|
356
|
+
};
|
|
357
|
+
declare const useGridSettingsStore: zustand.UseBoundStore<zustand.StoreApi<UseGridSettingsStoreState & UseGridSettingsStoreActions>>;
|
|
358
|
+
|
|
359
|
+
declare const buttonVariants: (props?: ({
|
|
360
|
+
variant?: "link" | "default" | "outline" | "cancel" | "destructive" | "secondary" | "ghost" | "defaultSelect" | "defaultOutline" | null | undefined;
|
|
361
|
+
size?: "default" | "option" | "icon" | "sm" | "lg" | "icon-xs" | "icon-sm" | "icon-md" | "icon-lg" | null | undefined;
|
|
362
|
+
active?: boolean | null | undefined;
|
|
363
|
+
} & class_variance_authority_dist_types.ClassProp) | undefined) => string;
|
|
364
|
+
declare function Button({ className, variant, size, active, asChild, ...props }: React$1.ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
|
|
365
|
+
asChild?: boolean;
|
|
366
|
+
active?: boolean;
|
|
367
|
+
}): react_jsx_runtime.JSX.Element;
|
|
368
|
+
|
|
343
369
|
type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
|
|
344
370
|
[K in Keys]: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;
|
|
345
371
|
}[Keys];
|
|
@@ -454,39 +480,6 @@ declare function stripNullishObject<T extends Record<string, any>>(value: Partia
|
|
|
454
480
|
*/
|
|
455
481
|
declare function cn(...args: ClassValue[]): string;
|
|
456
482
|
|
|
457
|
-
type TanstackTableInstance$1 = {
|
|
458
|
-
getAllColumns(): any[];
|
|
459
|
-
};
|
|
460
|
-
declare function getColumnIdFromTable<T extends TanstackTableInstance$1>(table: T): {
|
|
461
|
-
availableColumns: {
|
|
462
|
-
id: any;
|
|
463
|
-
}[];
|
|
464
|
-
currentColumns: {
|
|
465
|
-
id: any;
|
|
466
|
-
}[];
|
|
467
|
-
};
|
|
468
|
-
|
|
469
|
-
type TanstackTableInstance = {
|
|
470
|
-
getAllColumns(): any[];
|
|
471
|
-
getVisibleLeafColumns(): any[];
|
|
472
|
-
};
|
|
473
|
-
type UseGridSettingsStoreActions = {
|
|
474
|
-
setAvailableColumns: (cols: Column[]) => void;
|
|
475
|
-
setCurrentColumns: (cols: Column[]) => void;
|
|
476
|
-
setPayload: (payload: GridPayload) => void;
|
|
477
|
-
reset: () => void;
|
|
478
|
-
extractColumns: (table: TanstackTableInstance) => {
|
|
479
|
-
availableColumns: Column[];
|
|
480
|
-
currentColumns: Column[];
|
|
481
|
-
};
|
|
482
|
-
};
|
|
483
|
-
type UseGridSettingsStoreState = {
|
|
484
|
-
availableColumns: Column[];
|
|
485
|
-
currentColumns: Column[];
|
|
486
|
-
payload: GridPayload;
|
|
487
|
-
};
|
|
488
|
-
declare const useGridSettingsStore: zustand.UseBoundStore<zustand.StoreApi<UseGridSettingsStoreState & UseGridSettingsStoreActions>>;
|
|
489
|
-
|
|
490
483
|
type UseHoverResult = {
|
|
491
484
|
ref: React__default.RefCallback<HTMLElement>;
|
|
492
485
|
hovering: boolean;
|
|
@@ -538,4 +531,4 @@ type UseTruncatedOptions<T> = {
|
|
|
538
531
|
type UseTruncatedResult = boolean;
|
|
539
532
|
declare const useTruncated: <T extends HTMLElement = any>({ elementRef, onChange, resizeDetectDelay }: UseTruncatedOptions<T>) => UseTruncatedResult;
|
|
540
533
|
|
|
541
|
-
export { AdvanceSearch, type Breakpoints, Button, type Column, type ContentSlot, DataTable, type DataTableChildrenKeyHandler, type DataTableColumnFilter, type DataTableColumnFilterProps, type DataTableColumnGrouping, type DataTableColumnOrdering, type DataTableColumnPinning, type DataTableColumnSorting, type DataTableColumnVisibility, type DataTableComponentProps, type DataTableFilterConfig, type DataTableFilters, type DataTableGlobalFilter, type DataTableHeaderCell, type DataTableProps, type DataTableRenderHeaderHandler, type DataTableRenderHeaderProps, type DataTableRenderRowHandler, type DataTableRenderRowProps, type DataTableRowCell, type DataTableRowClickHandler, type DataTableRowClickMode, type DataTableRowExpansion, type DataTableRowIdKeyHandler, type DataTableRowSelection, type DataTableScrollFetch, type DataTableStatusContent, type DatatableColumnResizing, DialogAlert, type DialogAlertProps, type DialogVariant, type FieldSchema, FormErrorMessage, type FormErrorMessageProps, FormField, FormFieldContext, type FormFieldContextValue, type FormFieldProps, FormItem, FormItemContext, type FormItemContextValue, type FormItemProps, FormLabel, type FormLabelProps, type GridPayload, GridSettingsModal, type GridSettingsModalProps, HeaderCell, type HeaderCellProps, _default as Navbar, type NavbarProps, NumberInput, type NumberInputProps, PreventPageLeave, type RowClickType, type ScrollInfo, type SorterProps, TextInput, type TextInputProps, type UseFormFieldOptions, type UseFormFieldReturn, type UseHoverResult, type UseMediaQueryOptions, type UseMediaQueryResult, type UsePreventPageLeaveOptions, type UseScreenSizeResult, type UseTruncatedOptions, type UseTruncatedResult, booleanToSelectValue, buttonVariants, cn, compareAlphanumeric, debounce,
|
|
534
|
+
export { AdvanceSearch, type Breakpoints, Button, type Column, type ContentSlot, DataTable, type DataTableChildrenKeyHandler, type DataTableColumnFilter, type DataTableColumnFilterProps, type DataTableColumnGrouping, type DataTableColumnOrdering, type DataTableColumnPinning, type DataTableColumnSorting, type DataTableColumnVisibility, type DataTableComponentProps, type DataTableFilterConfig, type DataTableFilters, type DataTableGlobalFilter, type DataTableHeaderCell, type DataTableProps, type DataTableRenderHeaderHandler, type DataTableRenderHeaderProps, type DataTableRenderRowHandler, type DataTableRenderRowProps, type DataTableRowCell, type DataTableRowClickHandler, type DataTableRowClickMode, type DataTableRowExpansion, type DataTableRowIdKeyHandler, type DataTableRowSelection, type DataTableScrollFetch, type DataTableStatusContent, type DatatableColumnResizing, DialogAlert, type DialogAlertProps, type DialogVariant, type FieldSchema, FormErrorMessage, type FormErrorMessageProps, FormField, FormFieldContext, type FormFieldContextValue, type FormFieldProps, FormItem, FormItemContext, type FormItemContextValue, type FormItemProps, FormLabel, type FormLabelProps, type GridPayload, GridSettingsModal, type GridSettingsModalProps, HeaderCell, type HeaderCellProps, _default as Navbar, type NavbarProps, NumberInput, type NumberInputProps, PreventPageLeave, type RowClickType, type ScrollInfo, type SorterProps, TextInput, type TextInputProps, type UseFormFieldOptions, type UseFormFieldReturn, type UseHoverResult, type UseMediaQueryOptions, type UseMediaQueryResult, type UsePreventPageLeaveOptions, type UseScreenSizeResult, type UseTruncatedOptions, type UseTruncatedResult, booleanToSelectValue, buttonVariants, cn, compareAlphanumeric, debounce, isDefined, isEmptyObject, renderContentSlot, selectValueToBoolean, stripNullishObject, useFormField, useGridSettingsStore, useHover, useIntersectionObserver, useMediaQuery, usePreventPageLeave, usePreventPageLeaveStore, useScreenSize, useTruncated };
|
package/dist/index.js
CHANGED
|
@@ -5,11 +5,10 @@ var reactHookForm = require('react-hook-form');
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var clsx3 = require('clsx');
|
|
7
7
|
var tailwindMerge = require('tailwind-merge');
|
|
8
|
-
var zustand = require('zustand');
|
|
9
8
|
var reactTable = require('@tanstack/react-table');
|
|
10
9
|
var lucideReact = require('lucide-react');
|
|
10
|
+
var zustand = require('zustand');
|
|
11
11
|
var reactSlot = require('@radix-ui/react-slot');
|
|
12
|
-
var classVarianceAuthority = require('class-variance-authority');
|
|
13
12
|
var LabelPrimitive2 = require('@radix-ui/react-label');
|
|
14
13
|
var DialogPrimitive = require('@radix-ui/react-dialog');
|
|
15
14
|
var sortable = require('@dnd-kit/sortable');
|
|
@@ -18,6 +17,7 @@ var SelectPrimitive = require('@radix-ui/react-select');
|
|
|
18
17
|
var TooltipPrimitive = require('@radix-ui/react-tooltip');
|
|
19
18
|
var core = require('@dnd-kit/core');
|
|
20
19
|
var modifiers = require('@dnd-kit/modifiers');
|
|
20
|
+
var classVarianceAuthority = require('class-variance-authority');
|
|
21
21
|
var zod = require('zod');
|
|
22
22
|
var reactDom = require('react-dom');
|
|
23
23
|
var PopoverPrimitive = require('@radix-ui/react-popover');
|
|
@@ -181,38 +181,6 @@ function stripNullishObject(value) {
|
|
|
181
181
|
return {};
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
|
-
|
|
185
|
-
// src/utils/getColumnIdFromTable.ts
|
|
186
|
-
function getColumnIdFromTable(table) {
|
|
187
|
-
const allColumns = table.getAllColumns();
|
|
188
|
-
const availableColumns = allColumns.map((col) => ({ id: col.id }));
|
|
189
|
-
const currentColumns = allColumns.filter((col) => col.getIsVisible()).map((col) => ({ id: col.id }));
|
|
190
|
-
return { availableColumns, currentColumns };
|
|
191
|
-
}
|
|
192
|
-
var useGridSettingsStore = zustand.create(
|
|
193
|
-
(set) => ({
|
|
194
|
-
availableColumns: [],
|
|
195
|
-
currentColumns: [],
|
|
196
|
-
payload: {
|
|
197
|
-
ordering: [],
|
|
198
|
-
visibility: {},
|
|
199
|
-
pinning: { left: [] }
|
|
200
|
-
},
|
|
201
|
-
setAvailableColumns: (cols) => set({ availableColumns: cols }),
|
|
202
|
-
setCurrentColumns: (cols) => set({ currentColumns: cols }),
|
|
203
|
-
setPayload: (payload) => set({ payload }),
|
|
204
|
-
reset: () => set({
|
|
205
|
-
availableColumns: [],
|
|
206
|
-
currentColumns: [],
|
|
207
|
-
payload: { ordering: [], visibility: {}, pinning: { left: [] } }
|
|
208
|
-
}),
|
|
209
|
-
extractColumns: (table) => {
|
|
210
|
-
const availableColumns = table.getAllColumns().map((col) => ({ id: col.id }));
|
|
211
|
-
const currentColumns = table.getVisibleLeafColumns().map((col) => ({ id: col.id }));
|
|
212
|
-
return { availableColumns, currentColumns };
|
|
213
|
-
}
|
|
214
|
-
})
|
|
215
|
-
);
|
|
216
184
|
function TextInput({ className, ...props }) {
|
|
217
185
|
return /* @__PURE__ */ jsxRuntime.jsx("input", { type: "text", className: cn("input", className), ...props });
|
|
218
186
|
}
|
|
@@ -1127,61 +1095,6 @@ var usePreventPageLeave = ({ isPrevening }) => {
|
|
|
1127
1095
|
}, [isPrevening, setPreventing]);
|
|
1128
1096
|
};
|
|
1129
1097
|
var usePreventPageLeave_default = usePreventPageLeave;
|
|
1130
|
-
var buttonVariants = classVarianceAuthority.cva(
|
|
1131
|
-
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive cursor-pointer",
|
|
1132
|
-
{
|
|
1133
|
-
variants: {
|
|
1134
|
-
variant: {
|
|
1135
|
-
default: "bg-sus-primary-1 text-primary-foreground shadow-xs hover:bg-sus-primary/90",
|
|
1136
|
-
destructive: "bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
1137
|
-
outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
1138
|
-
secondary: "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
|
|
1139
|
-
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
1140
|
-
link: "text-primary underline-offset-4 hover:underline",
|
|
1141
|
-
cancel: "border bg-[#8B8B8B] text-white shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
1142
|
-
defaultSelect: "bg-primary text-primary-foreground shadow-xs hover:bg-sus-primary/90 py-2",
|
|
1143
|
-
defaultOutline: "border bg-background py-2 shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50"
|
|
1144
|
-
},
|
|
1145
|
-
size: {
|
|
1146
|
-
default: "h-9 px-4 has-[>svg]:px-3",
|
|
1147
|
-
option: "py-5 h-9 px-4 has-[>svg]:px-3",
|
|
1148
|
-
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
1149
|
-
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
1150
|
-
icon: "size-9",
|
|
1151
|
-
"icon-xs": "size-5",
|
|
1152
|
-
"icon-sm": "size-[22px]",
|
|
1153
|
-
"icon-md": "size-7",
|
|
1154
|
-
"icon-lg": "size-10"
|
|
1155
|
-
},
|
|
1156
|
-
active: {
|
|
1157
|
-
true: "bg-sus-primary-1 text-white",
|
|
1158
|
-
false: ""
|
|
1159
|
-
}
|
|
1160
|
-
},
|
|
1161
|
-
defaultVariants: {
|
|
1162
|
-
variant: "default",
|
|
1163
|
-
size: "default"
|
|
1164
|
-
}
|
|
1165
|
-
}
|
|
1166
|
-
);
|
|
1167
|
-
function Button({
|
|
1168
|
-
className,
|
|
1169
|
-
variant,
|
|
1170
|
-
size,
|
|
1171
|
-
active,
|
|
1172
|
-
asChild = false,
|
|
1173
|
-
...props
|
|
1174
|
-
}) {
|
|
1175
|
-
const Comp = asChild ? reactSlot.Slot : "button";
|
|
1176
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1177
|
-
Comp,
|
|
1178
|
-
{
|
|
1179
|
-
"data-slot": "button",
|
|
1180
|
-
className: cn(buttonVariants({ variant, size, className, active })),
|
|
1181
|
-
...props
|
|
1182
|
-
}
|
|
1183
|
-
);
|
|
1184
|
-
}
|
|
1185
1098
|
var s = (e2, s2, o3) => {
|
|
1186
1099
|
if (e2 && "reportValidity" in e2) {
|
|
1187
1100
|
const r2 = reactHookForm.get(o3, s2);
|
|
@@ -1672,7 +1585,7 @@ function SortableRow({
|
|
|
1672
1585
|
}
|
|
1673
1586
|
) });
|
|
1674
1587
|
}
|
|
1675
|
-
var
|
|
1588
|
+
var buttonVariants = classVarianceAuthority.cva(
|
|
1676
1589
|
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive cursor-pointer",
|
|
1677
1590
|
{
|
|
1678
1591
|
variants: {
|
|
@@ -1706,7 +1619,7 @@ var buttonVariants2 = classVarianceAuthority.cva(
|
|
|
1706
1619
|
}
|
|
1707
1620
|
}
|
|
1708
1621
|
);
|
|
1709
|
-
function
|
|
1622
|
+
function Button({
|
|
1710
1623
|
className,
|
|
1711
1624
|
variant,
|
|
1712
1625
|
size,
|
|
@@ -1719,13 +1632,14 @@ function Button2({
|
|
|
1719
1632
|
Comp,
|
|
1720
1633
|
{
|
|
1721
1634
|
"data-slot": "button",
|
|
1722
|
-
className: cn(
|
|
1635
|
+
className: cn(buttonVariants({ variant, size, className, active })),
|
|
1723
1636
|
...props
|
|
1724
1637
|
}
|
|
1725
1638
|
);
|
|
1726
1639
|
}
|
|
1727
1640
|
var ColumnSchema = zod.z.object({
|
|
1728
|
-
id: zod.z.string().nonempty("This field is required")
|
|
1641
|
+
id: zod.z.string().nonempty("This field is required"),
|
|
1642
|
+
label: zod.z.string().optional()
|
|
1729
1643
|
});
|
|
1730
1644
|
var GridSettingsSchema = zod.z.object({
|
|
1731
1645
|
columns: zod.z.array(ColumnSchema).min(1, "At least one column is required")
|
|
@@ -1774,7 +1688,7 @@ var GridSettingsModal = ({
|
|
|
1774
1688
|
);
|
|
1775
1689
|
const pinning = { left: [data.columns[0].id] };
|
|
1776
1690
|
if (onSaveColumns) {
|
|
1777
|
-
onSaveColumns({ ordering, visibility, pinning });
|
|
1691
|
+
onSaveColumns({ ordering, visibility, pinning }, data.columns);
|
|
1778
1692
|
}
|
|
1779
1693
|
};
|
|
1780
1694
|
const sensors = core.useSensors(core.useSensor(core.PointerSensor, { activationConstraint: { distance: 5 } }));
|
|
@@ -1803,12 +1717,12 @@ var GridSettingsModal = ({
|
|
|
1803
1717
|
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "w-6 h-6 text-white" })
|
|
1804
1718
|
}
|
|
1805
1719
|
) }),
|
|
1806
|
-
/* @__PURE__ */ jsxRuntime.jsxs(DialogHeader, { className: cn("bg-[#
|
|
1807
|
-
/* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { className: "text-
|
|
1720
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DialogHeader, { className: cn("bg-[#41875C] text-white h-20 rounded-t-lg", headerClassname), children: [
|
|
1721
|
+
/* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { className: "text-xl p-2 px-4", children: "Grid Settings" }),
|
|
1808
1722
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1809
1723
|
DialogDescription,
|
|
1810
1724
|
{
|
|
1811
|
-
className: cn("bg-[#
|
|
1725
|
+
className: cn("bg-[#A7ADB8] text-white px-4 py-2.5", descriptionClassname),
|
|
1812
1726
|
children: "Add or remove columns. To change the column order, drag and drop a field."
|
|
1813
1727
|
}
|
|
1814
1728
|
)
|
|
@@ -1859,7 +1773,7 @@ var GridSettingsModal = ({
|
|
|
1859
1773
|
}
|
|
1860
1774
|
) }),
|
|
1861
1775
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-6", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1862
|
-
|
|
1776
|
+
Button,
|
|
1863
1777
|
{
|
|
1864
1778
|
type: "button",
|
|
1865
1779
|
className: cn("bg-[#41875C99] text-white w-full rounded-t-lg", addButtonClassname),
|
|
@@ -1874,7 +1788,7 @@ var GridSettingsModal = ({
|
|
|
1874
1788
|
] }) }),
|
|
1875
1789
|
/* @__PURE__ */ jsxRuntime.jsx(DialogFooter, { className: "w-full px-6", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between w-full py-4 border-t-1 border-[#B9B9B9]", children: [
|
|
1876
1790
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1877
|
-
|
|
1791
|
+
Button,
|
|
1878
1792
|
{
|
|
1879
1793
|
type: "button",
|
|
1880
1794
|
variant: "outline",
|
|
@@ -1884,7 +1798,7 @@ var GridSettingsModal = ({
|
|
|
1884
1798
|
}
|
|
1885
1799
|
),
|
|
1886
1800
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1887
|
-
|
|
1801
|
+
Button,
|
|
1888
1802
|
{
|
|
1889
1803
|
type: "submit",
|
|
1890
1804
|
className: cn("w-18 bg-[#379A2A] text-white", saveButtonClassname),
|
|
@@ -1896,6 +1810,99 @@ var GridSettingsModal = ({
|
|
|
1896
1810
|
] }) }) });
|
|
1897
1811
|
};
|
|
1898
1812
|
var GridSettingsModal_default = GridSettingsModal;
|
|
1813
|
+
var useGridSettingsStore = zustand.create(
|
|
1814
|
+
(set, get) => ({
|
|
1815
|
+
availableColumns: [],
|
|
1816
|
+
currentColumns: [],
|
|
1817
|
+
payload: {
|
|
1818
|
+
ordering: [],
|
|
1819
|
+
visibility: {},
|
|
1820
|
+
pinning: { left: [] }
|
|
1821
|
+
},
|
|
1822
|
+
setAvailableColumns: (cols) => set({ availableColumns: cols }),
|
|
1823
|
+
setCurrentColumns: (cols) => set({ currentColumns: cols }),
|
|
1824
|
+
setPayload: (payload) => set({ payload }),
|
|
1825
|
+
reset: () => set({
|
|
1826
|
+
availableColumns: [],
|
|
1827
|
+
currentColumns: [],
|
|
1828
|
+
payload: { ordering: [], visibility: {}, pinning: { left: [] } }
|
|
1829
|
+
}),
|
|
1830
|
+
extractColumns: (table) => {
|
|
1831
|
+
const availableColumns = table.getAllColumns().map((col) => ({ id: col.id }));
|
|
1832
|
+
const currentColumns = table.getVisibleLeafColumns().map((col) => ({ id: col.id }));
|
|
1833
|
+
return { availableColumns, currentColumns };
|
|
1834
|
+
},
|
|
1835
|
+
syncColumnsState: (table, options) => {
|
|
1836
|
+
const { availableColumns, currentColumns } = get().extractColumns(table);
|
|
1837
|
+
const { excludeColumns = [], labelMap = {} } = options || {};
|
|
1838
|
+
const filteredExcludeColumnFn = (column) => !excludeColumns.includes(column.id);
|
|
1839
|
+
const mapLabel = (col) => ({
|
|
1840
|
+
id: col.id,
|
|
1841
|
+
label: labelMap?.[col.id] ?? col.label ?? col.id
|
|
1842
|
+
});
|
|
1843
|
+
set({
|
|
1844
|
+
availableColumns: availableColumns.filter(filteredExcludeColumnFn).map(mapLabel),
|
|
1845
|
+
currentColumns: currentColumns.filter(filteredExcludeColumnFn).map(mapLabel)
|
|
1846
|
+
});
|
|
1847
|
+
}
|
|
1848
|
+
})
|
|
1849
|
+
);
|
|
1850
|
+
var useGridSettingsStore_default = useGridSettingsStore;
|
|
1851
|
+
var buttonVariants2 = classVarianceAuthority.cva(
|
|
1852
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive cursor-pointer",
|
|
1853
|
+
{
|
|
1854
|
+
variants: {
|
|
1855
|
+
variant: {
|
|
1856
|
+
default: "bg-sus-primary-1 text-primary-foreground shadow-xs hover:bg-sus-primary/90",
|
|
1857
|
+
destructive: "bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
1858
|
+
outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
1859
|
+
secondary: "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
|
|
1860
|
+
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
1861
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
1862
|
+
cancel: "border bg-[#8B8B8B] text-white shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
1863
|
+
defaultSelect: "bg-primary text-primary-foreground shadow-xs hover:bg-sus-primary/90 py-2",
|
|
1864
|
+
defaultOutline: "border bg-background py-2 shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50"
|
|
1865
|
+
},
|
|
1866
|
+
size: {
|
|
1867
|
+
default: "h-9 px-4 has-[>svg]:px-3",
|
|
1868
|
+
option: "py-5 h-9 px-4 has-[>svg]:px-3",
|
|
1869
|
+
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
1870
|
+
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
1871
|
+
icon: "size-9",
|
|
1872
|
+
"icon-xs": "size-5",
|
|
1873
|
+
"icon-sm": "size-[22px]",
|
|
1874
|
+
"icon-md": "size-7",
|
|
1875
|
+
"icon-lg": "size-10"
|
|
1876
|
+
},
|
|
1877
|
+
active: {
|
|
1878
|
+
true: "bg-sus-primary-1 text-white",
|
|
1879
|
+
false: ""
|
|
1880
|
+
}
|
|
1881
|
+
},
|
|
1882
|
+
defaultVariants: {
|
|
1883
|
+
variant: "default",
|
|
1884
|
+
size: "default"
|
|
1885
|
+
}
|
|
1886
|
+
}
|
|
1887
|
+
);
|
|
1888
|
+
function Button2({
|
|
1889
|
+
className,
|
|
1890
|
+
variant,
|
|
1891
|
+
size,
|
|
1892
|
+
active,
|
|
1893
|
+
asChild = false,
|
|
1894
|
+
...props
|
|
1895
|
+
}) {
|
|
1896
|
+
const Comp = asChild ? reactSlot.Slot : "button";
|
|
1897
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1898
|
+
Comp,
|
|
1899
|
+
{
|
|
1900
|
+
"data-slot": "button",
|
|
1901
|
+
className: cn(buttonVariants2({ variant, size, className, active })),
|
|
1902
|
+
...props
|
|
1903
|
+
}
|
|
1904
|
+
);
|
|
1905
|
+
}
|
|
1899
1906
|
var InfoIcon = (props) => {
|
|
1900
1907
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1901
1908
|
"svg",
|
|
@@ -2070,7 +2077,7 @@ var Navbar = ({
|
|
|
2070
2077
|
] }),
|
|
2071
2078
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
2072
2079
|
mainButtonText && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2073
|
-
|
|
2080
|
+
Button2,
|
|
2074
2081
|
{
|
|
2075
2082
|
disabled: mainButtonDisable,
|
|
2076
2083
|
className: cn("bg-sus-secondary-1 hover:bg-sus-secondary-hover", mainButtonClassName),
|
|
@@ -2080,7 +2087,7 @@ var Navbar = ({
|
|
|
2080
2087
|
}
|
|
2081
2088
|
),
|
|
2082
2089
|
subButtonText && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2083
|
-
|
|
2090
|
+
Button2,
|
|
2084
2091
|
{
|
|
2085
2092
|
disabled: subButtonDisable,
|
|
2086
2093
|
className: cn("bg-sus-primary-2 hover:bg-sus-primary-2-hover", subButtonClassName),
|
|
@@ -5300,7 +5307,7 @@ function variantClass(variant) {
|
|
|
5300
5307
|
}
|
|
5301
5308
|
|
|
5302
5309
|
exports.AdvanceSearch = AdvanceSearch_default;
|
|
5303
|
-
exports.Button =
|
|
5310
|
+
exports.Button = Button2;
|
|
5304
5311
|
exports.DataTable = DataTable_default;
|
|
5305
5312
|
exports.DialogAlert = DialogAlert;
|
|
5306
5313
|
exports.FormErrorMessage = FormErrorMessage;
|
|
@@ -5316,18 +5323,17 @@ exports.NumberInput = NumberInput;
|
|
|
5316
5323
|
exports.PreventPageLeave = PreventPageLeave_default;
|
|
5317
5324
|
exports.TextInput = TextInput;
|
|
5318
5325
|
exports.booleanToSelectValue = booleanToSelectValue;
|
|
5319
|
-
exports.buttonVariants =
|
|
5326
|
+
exports.buttonVariants = buttonVariants2;
|
|
5320
5327
|
exports.cn = cn;
|
|
5321
5328
|
exports.compareAlphanumeric = compareAlphanumeric;
|
|
5322
5329
|
exports.debounce = debounce;
|
|
5323
|
-
exports.getColumnIdFromTable = getColumnIdFromTable;
|
|
5324
5330
|
exports.isDefined = isDefined;
|
|
5325
5331
|
exports.isEmptyObject = isEmptyObject;
|
|
5326
5332
|
exports.renderContentSlot = renderContentSlot;
|
|
5327
5333
|
exports.selectValueToBoolean = selectValueToBoolean;
|
|
5328
5334
|
exports.stripNullishObject = stripNullishObject;
|
|
5329
5335
|
exports.useFormField = useFormField;
|
|
5330
|
-
exports.useGridSettingsStore =
|
|
5336
|
+
exports.useGridSettingsStore = useGridSettingsStore_default;
|
|
5331
5337
|
exports.useHover = useHover_default;
|
|
5332
5338
|
exports.useIntersectionObserver = useIntersectionObserver_default;
|
|
5333
5339
|
exports.useMediaQuery = useMediaQuery_default;
|