@sustaina/shared-ui 1.7.0 → 1.7.2

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 CHANGED
@@ -302,18 +302,9 @@ 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;
307
+ label?: string;
317
308
  };
318
309
  type GridPayload<TColumn extends {
319
310
  id: string;
@@ -335,10 +326,46 @@ type GridSettingsModalProps = {
335
326
  currentColumns: Column[];
336
327
  limit?: number;
337
328
  onClose: () => void;
338
- onSaveColumns?: (payload: GridPayload) => void;
329
+ onSaveColumns?: (payload: GridPayload, currentColumns: Column[]) => void;
339
330
  };
340
331
  declare const GridSettingsModal: ({ isOpen, headerClassname, descriptionClassname, addButtonClassname, saveButtonClassname, availableColumns, currentColumns, limit, onClose, onSaveColumns }: GridSettingsModalProps) => react_jsx_runtime.JSX.Element;
341
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
+
342
369
  type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
343
370
  [K in Keys]: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;
344
371
  }[Keys];
@@ -453,39 +480,6 @@ declare function stripNullishObject<T extends Record<string, any>>(value: Partia
453
480
  */
454
481
  declare function cn(...args: ClassValue[]): string;
455
482
 
456
- type TanstackTableInstance$1 = {
457
- getAllColumns(): any[];
458
- };
459
- declare function getColumnIdFromTable<T extends TanstackTableInstance$1>(table: T): {
460
- availableColumns: {
461
- id: any;
462
- }[];
463
- currentColumns: {
464
- id: any;
465
- }[];
466
- };
467
-
468
- type TanstackTableInstance = {
469
- getAllColumns(): any[];
470
- getVisibleLeafColumns(): any[];
471
- };
472
- type UseGridSettingsStoreActions = {
473
- setAvailableColumns: (cols: Column[]) => void;
474
- setCurrentColumns: (cols: Column[]) => void;
475
- setPayload: (payload: GridPayload) => void;
476
- reset: () => void;
477
- extractColumns: (table: TanstackTableInstance) => {
478
- availableColumns: Column[];
479
- currentColumns: Column[];
480
- };
481
- };
482
- type UseGridSettingsStoreState = {
483
- availableColumns: Column[];
484
- currentColumns: Column[];
485
- payload: GridPayload;
486
- };
487
- declare const useGridSettingsStore: zustand.UseBoundStore<zustand.StoreApi<UseGridSettingsStoreState & UseGridSettingsStoreActions>>;
488
-
489
483
  type UseHoverResult = {
490
484
  ref: React__default.RefCallback<HTMLElement>;
491
485
  hovering: boolean;
@@ -537,4 +531,4 @@ type UseTruncatedOptions<T> = {
537
531
  type UseTruncatedResult = boolean;
538
532
  declare const useTruncated: <T extends HTMLElement = any>({ elementRef, onChange, resizeDetectDelay }: UseTruncatedOptions<T>) => UseTruncatedResult;
539
533
 
540
- 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, getColumnIdFromTable, isDefined, isEmptyObject, renderContentSlot, selectValueToBoolean, stripNullishObject, useFormField, useGridSettingsStore, useHover, useIntersectionObserver, useMediaQuery, usePreventPageLeave, usePreventPageLeaveStore, useScreenSize, useTruncated };
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,18 +302,9 @@ 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;
307
+ label?: string;
317
308
  };
318
309
  type GridPayload<TColumn extends {
319
310
  id: string;
@@ -335,10 +326,46 @@ type GridSettingsModalProps = {
335
326
  currentColumns: Column[];
336
327
  limit?: number;
337
328
  onClose: () => void;
338
- onSaveColumns?: (payload: GridPayload) => void;
329
+ onSaveColumns?: (payload: GridPayload, currentColumns: Column[]) => void;
339
330
  };
340
331
  declare const GridSettingsModal: ({ isOpen, headerClassname, descriptionClassname, addButtonClassname, saveButtonClassname, availableColumns, currentColumns, limit, onClose, onSaveColumns }: GridSettingsModalProps) => react_jsx_runtime.JSX.Element;
341
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
+
342
369
  type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
343
370
  [K in Keys]: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;
344
371
  }[Keys];
@@ -453,39 +480,6 @@ declare function stripNullishObject<T extends Record<string, any>>(value: Partia
453
480
  */
454
481
  declare function cn(...args: ClassValue[]): string;
455
482
 
456
- type TanstackTableInstance$1 = {
457
- getAllColumns(): any[];
458
- };
459
- declare function getColumnIdFromTable<T extends TanstackTableInstance$1>(table: T): {
460
- availableColumns: {
461
- id: any;
462
- }[];
463
- currentColumns: {
464
- id: any;
465
- }[];
466
- };
467
-
468
- type TanstackTableInstance = {
469
- getAllColumns(): any[];
470
- getVisibleLeafColumns(): any[];
471
- };
472
- type UseGridSettingsStoreActions = {
473
- setAvailableColumns: (cols: Column[]) => void;
474
- setCurrentColumns: (cols: Column[]) => void;
475
- setPayload: (payload: GridPayload) => void;
476
- reset: () => void;
477
- extractColumns: (table: TanstackTableInstance) => {
478
- availableColumns: Column[];
479
- currentColumns: Column[];
480
- };
481
- };
482
- type UseGridSettingsStoreState = {
483
- availableColumns: Column[];
484
- currentColumns: Column[];
485
- payload: GridPayload;
486
- };
487
- declare const useGridSettingsStore: zustand.UseBoundStore<zustand.StoreApi<UseGridSettingsStoreState & UseGridSettingsStoreActions>>;
488
-
489
483
  type UseHoverResult = {
490
484
  ref: React__default.RefCallback<HTMLElement>;
491
485
  hovering: boolean;
@@ -537,4 +531,4 @@ type UseTruncatedOptions<T> = {
537
531
  type UseTruncatedResult = boolean;
538
532
  declare const useTruncated: <T extends HTMLElement = any>({ elementRef, onChange, resizeDetectDelay }: UseTruncatedOptions<T>) => UseTruncatedResult;
539
533
 
540
- 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, getColumnIdFromTable, isDefined, isEmptyObject, renderContentSlot, selectValueToBoolean, stripNullishObject, useFormField, useGridSettingsStore, useHover, useIntersectionObserver, useMediaQuery, usePreventPageLeave, usePreventPageLeaveStore, useScreenSize, useTruncated };
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);
@@ -1580,10 +1493,13 @@ function SortableRow({
1580
1493
  id: value,
1581
1494
  disabled: name == "columns.0.id"
1582
1495
  });
1583
- const style = {
1584
- transform: utilities.CSS.Transform.toString(transform),
1585
- transition
1586
- };
1496
+ const style = React4__namespace.useMemo(
1497
+ () => ({
1498
+ transform: utilities.CSS.Transform.toString(transform),
1499
+ transition
1500
+ }),
1501
+ [transform, transition]
1502
+ );
1587
1503
  const capitalize = (str) => str.charAt(0).toUpperCase() + str.slice(1);
1588
1504
  const currentFormColumns = reactHookForm.useWatch({ control, name: "columns" });
1589
1505
  return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: setNodeRef, style, className: "flex items-center rounded-md bg-white", children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -1592,7 +1508,7 @@ function SortableRow({
1592
1508
  control,
1593
1509
  name,
1594
1510
  render: ({ field }) => {
1595
- const options = availableColumns.filter((col) => col.id === field.value || !currentFormColumns?.some((c) => c.id === col.id)).map((col) => ({ id: col.id, label: capitalize(col.id) }));
1511
+ const options = availableColumns.filter((col) => col.id === field.value || !currentFormColumns?.some((c) => c.id === col.id)).map((col) => ({ id: col.id, label: col?.label ? col.label : capitalize(col.id) }));
1596
1512
  return /* @__PURE__ */ jsxRuntime.jsxs(FormItem2, { className: "flex-1", children: [
1597
1513
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
1598
1514
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -1669,7 +1585,7 @@ function SortableRow({
1669
1585
  }
1670
1586
  ) });
1671
1587
  }
1672
- var buttonVariants2 = classVarianceAuthority.cva(
1588
+ var buttonVariants = classVarianceAuthority.cva(
1673
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",
1674
1590
  {
1675
1591
  variants: {
@@ -1703,7 +1619,7 @@ var buttonVariants2 = classVarianceAuthority.cva(
1703
1619
  }
1704
1620
  }
1705
1621
  );
1706
- function Button2({
1622
+ function Button({
1707
1623
  className,
1708
1624
  variant,
1709
1625
  size,
@@ -1716,13 +1632,14 @@ function Button2({
1716
1632
  Comp,
1717
1633
  {
1718
1634
  "data-slot": "button",
1719
- className: cn(buttonVariants2({ variant, size, className, active })),
1635
+ className: cn(buttonVariants({ variant, size, className, active })),
1720
1636
  ...props
1721
1637
  }
1722
1638
  );
1723
1639
  }
1724
1640
  var ColumnSchema = zod.z.object({
1725
- 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()
1726
1643
  });
1727
1644
  var GridSettingsSchema = zod.z.object({
1728
1645
  columns: zod.z.array(ColumnSchema).min(1, "At least one column is required")
@@ -1771,7 +1688,7 @@ var GridSettingsModal = ({
1771
1688
  );
1772
1689
  const pinning = { left: [data.columns[0].id] };
1773
1690
  if (onSaveColumns) {
1774
- onSaveColumns({ ordering, visibility, pinning });
1691
+ onSaveColumns({ ordering, visibility, pinning }, data.columns);
1775
1692
  }
1776
1693
  };
1777
1694
  const sensors = core.useSensors(core.useSensor(core.PointerSensor, { activationConstraint: { distance: 5 } }));
@@ -1856,7 +1773,7 @@ var GridSettingsModal = ({
1856
1773
  }
1857
1774
  ) }),
1858
1775
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-6", children: /* @__PURE__ */ jsxRuntime.jsxs(
1859
- Button2,
1776
+ Button,
1860
1777
  {
1861
1778
  type: "button",
1862
1779
  className: cn("bg-[#41875C99] text-white w-full rounded-t-lg", addButtonClassname),
@@ -1871,7 +1788,7 @@ var GridSettingsModal = ({
1871
1788
  ] }) }),
1872
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: [
1873
1790
  /* @__PURE__ */ jsxRuntime.jsx(
1874
- Button2,
1791
+ Button,
1875
1792
  {
1876
1793
  type: "button",
1877
1794
  variant: "outline",
@@ -1881,7 +1798,7 @@ var GridSettingsModal = ({
1881
1798
  }
1882
1799
  ),
1883
1800
  /* @__PURE__ */ jsxRuntime.jsx(
1884
- Button2,
1801
+ Button,
1885
1802
  {
1886
1803
  type: "submit",
1887
1804
  className: cn("w-18 bg-[#379A2A] text-white", saveButtonClassname),
@@ -1893,6 +1810,99 @@ var GridSettingsModal = ({
1893
1810
  ] }) }) });
1894
1811
  };
1895
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
+ }
1896
1906
  var InfoIcon = (props) => {
1897
1907
  return /* @__PURE__ */ jsxRuntime.jsxs(
1898
1908
  "svg",
@@ -2067,7 +2077,7 @@ var Navbar = ({
2067
2077
  ] }),
2068
2078
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
2069
2079
  mainButtonText && /* @__PURE__ */ jsxRuntime.jsx(
2070
- Button,
2080
+ Button2,
2071
2081
  {
2072
2082
  disabled: mainButtonDisable,
2073
2083
  className: cn("bg-sus-secondary-1 hover:bg-sus-secondary-hover", mainButtonClassName),
@@ -2077,7 +2087,7 @@ var Navbar = ({
2077
2087
  }
2078
2088
  ),
2079
2089
  subButtonText && /* @__PURE__ */ jsxRuntime.jsx(
2080
- Button,
2090
+ Button2,
2081
2091
  {
2082
2092
  disabled: subButtonDisable,
2083
2093
  className: cn("bg-sus-primary-2 hover:bg-sus-primary-2-hover", subButtonClassName),
@@ -5297,7 +5307,7 @@ function variantClass(variant) {
5297
5307
  }
5298
5308
 
5299
5309
  exports.AdvanceSearch = AdvanceSearch_default;
5300
- exports.Button = Button;
5310
+ exports.Button = Button2;
5301
5311
  exports.DataTable = DataTable_default;
5302
5312
  exports.DialogAlert = DialogAlert;
5303
5313
  exports.FormErrorMessage = FormErrorMessage;
@@ -5313,18 +5323,17 @@ exports.NumberInput = NumberInput;
5313
5323
  exports.PreventPageLeave = PreventPageLeave_default;
5314
5324
  exports.TextInput = TextInput;
5315
5325
  exports.booleanToSelectValue = booleanToSelectValue;
5316
- exports.buttonVariants = buttonVariants;
5326
+ exports.buttonVariants = buttonVariants2;
5317
5327
  exports.cn = cn;
5318
5328
  exports.compareAlphanumeric = compareAlphanumeric;
5319
5329
  exports.debounce = debounce;
5320
- exports.getColumnIdFromTable = getColumnIdFromTable;
5321
5330
  exports.isDefined = isDefined;
5322
5331
  exports.isEmptyObject = isEmptyObject;
5323
5332
  exports.renderContentSlot = renderContentSlot;
5324
5333
  exports.selectValueToBoolean = selectValueToBoolean;
5325
5334
  exports.stripNullishObject = stripNullishObject;
5326
5335
  exports.useFormField = useFormField;
5327
- exports.useGridSettingsStore = useGridSettingsStore;
5336
+ exports.useGridSettingsStore = useGridSettingsStore_default;
5328
5337
  exports.useHover = useHover_default;
5329
5338
  exports.useIntersectionObserver = useIntersectionObserver_default;
5330
5339
  exports.useMediaQuery = useMediaQuery_default;