@6thbridge/hexa 0.0.66 → 0.0.68

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
@@ -13,6 +13,7 @@ import * as PopoverPrimitive from '@radix-ui/react-popover';
13
13
  import { Drawer as Drawer$1 } from 'vaul';
14
14
  import { RowData, Row, Table as Table$1 } from '@tanstack/react-table';
15
15
  import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
16
+ import * as zustand from 'zustand';
16
17
  import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
17
18
  import dayjs from 'dayjs';
18
19
  import { ClassValue } from 'clsx';
@@ -56,6 +57,7 @@ declare const buttonVariants: (props?: ({
56
57
  variant?: "primary" | "danger" | "neutral" | "outlined" | "danger-outlined" | "light-outlined" | "dark-text" | "light" | null | undefined;
57
58
  size?: "default" | "sm" | "lg" | "md" | "icon-sm" | "icon" | "icon-lg" | null | undefined;
58
59
  } & class_variance_authority_dist_types.ClassProp) | undefined) => string;
60
+ type ButtonVariant = VariantProps<typeof buttonVariants>["variant"];
59
61
  interface ButtonProps extends DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, VariantProps<typeof buttonVariants> {
60
62
  asChild?: boolean;
61
63
  isLoading?: boolean;
@@ -438,10 +440,26 @@ type FilterContentProps = {
438
440
  filters: FilterListItem[];
439
441
  values?: Record<string, any>;
440
442
  setAppliedFilters?: (values: Record<string, any>) => void;
443
+ onChange?: (values: Record<string, any>) => void;
441
444
  id?: string;
442
445
  };
443
446
  type FilterListOptions = FilterListItem[];
444
447
 
448
+ type RowAction = {
449
+ icon: React__default.ReactNode;
450
+ label: React__default.ReactNode;
451
+ onClick: (rowIds: string[]) => void;
452
+ className?: string;
453
+ variant?: ButtonVariant;
454
+ disabled?: boolean;
455
+ showCount?: boolean;
456
+ };
457
+ type TableBulkRowActionsProps = {
458
+ tableBulkActions: RowAction[];
459
+ selectedRows: string[];
460
+ isMobile?: boolean;
461
+ };
462
+
445
463
  type TableSearchProps = {
446
464
  enabled: boolean;
447
465
  debounceRate?: number;
@@ -482,8 +500,13 @@ type TableProps<T extends RowData> = {
482
500
  pagination?: TablePaginationProps;
483
501
  search?: TableSearchProps;
484
502
  table: Table$1<T>;
503
+ onFilterChange?: (values: Record<string, any>) => void;
504
+ tableBulkActions?: {
505
+ actions: TableBulkRowActionsProps["tableBulkActions"];
506
+ selectedRows?: TableBulkRowActionsProps["selectedRows"];
507
+ };
485
508
  };
486
- declare const Table: <T extends RowData>({ table, isMobile, onRowClick, id, onRefetch, isRefetching, FilterMenu, ExtraNode, onExport, search, download, isLoading, pagination, filterListOptions, setAppliedFilters, }: TableProps<T>) => react_jsx_runtime.JSX.Element;
509
+ declare const Table: <T extends RowData>({ table, isMobile, onRowClick, id, onRefetch, isRefetching, FilterMenu, ExtraNode, onExport, search, download, isLoading, pagination, filterListOptions, setAppliedFilters, onFilterChange, tableBulkActions, }: TableProps<T>) => react_jsx_runtime.JSX.Element;
487
510
 
488
511
  type PageDataToolbarProps = {
489
512
  onRefetch?: () => void;
@@ -494,10 +517,11 @@ type PageDataToolbarProps = {
494
517
  download?: TableDownloadProps;
495
518
  isRefetching?: boolean;
496
519
  setAppliedFilters?: (values: Record<string, any>) => void;
520
+ onFilterChange?: (values: Record<string, any>) => void;
497
521
  filterListOptions?: FilterListItem[];
498
522
  id?: string;
499
523
  };
500
- declare const PageDataToolbar: ({ onRefetch, search, FilterMenu, ExtraNode, onExport, download, isRefetching, filterListOptions, setAppliedFilters, id, }: PageDataToolbarProps) => react_jsx_runtime.JSX.Element;
524
+ declare const PageDataToolbar: ({ onRefetch, search, FilterMenu, ExtraNode, onExport, download, isRefetching, filterListOptions, setAppliedFilters, onFilterChange, id, }: PageDataToolbarProps) => react_jsx_runtime.JSX.Element;
501
525
 
502
526
  type ResourcePermission = {
503
527
  resource: string;
@@ -553,8 +577,16 @@ type FilterPopoverProps = FilterContentProps & {
553
577
  isOpen?: boolean;
554
578
  trigger?: ReactNode;
555
579
  id?: string;
580
+ onChange?: (values: Record<string, any>) => void;
556
581
  };
557
- declare const FilterPopover: ({ filters, setAppliedFilters, isOpen, id, }: FilterPopoverProps) => react_jsx_runtime.JSX.Element | null;
582
+ declare const FilterPopover: ({ filters, setAppliedFilters, isOpen, onChange, id, }: FilterPopoverProps) => react_jsx_runtime.JSX.Element | null;
583
+
584
+ interface FilterSliceType {
585
+ filters: Record<string, any> | null;
586
+ upDateFilter: (items: Record<string, any> | ((prev: Record<string, any> | null) => Record<string, any> | null) | null) => void;
587
+ resetFilters: () => void;
588
+ }
589
+ declare const useFilterStore: () => zustand.UseBoundStore<zustand.StoreApi<FilterSliceType>>;
558
590
 
559
591
  interface TextOverflowProps extends React__default.HTMLAttributes<HTMLElement> {
560
592
  children: React__default.ReactNode;
@@ -603,4 +635,4 @@ declare class DateAction {
603
635
 
604
636
  declare function cn(...inputs: ClassValue[]): string;
605
637
 
606
- export { AmountAction, Banner, Button, CalendarInput, CopyableLabel, Country, CurrencySymbolMap, DateAction, DebouncedInput, DevBanner, Dialog, Drawer, DrawerClose, type DrawerPropsType, DrawerRoot, type FilterListItem, type FilterListOptions, FilterPopover, FlagComponent, FormLabel, type FormatCurrencyOptions, HasResourcePermission, Input, Loader, LocaleSelector, OTPInput, PageDataToolbar, Pagination, PasswordInput, PermissionsContext, PermissionsProvider, PhoneInput, Popover, PopoverContent, PopoverRoot, PopoverTrigger, RadioGroup, RadioGroupItem, type ResourcePermission, type ResourcePermissionProps, type ResourcePermissions, ScrollArea, Select, Sidebar, Status, Table, type TablePaginationProps, TextOverflow, type TextOverflowProps, Textarea, Tooltip, TooltipContent, TooltipProvider, TooltipRoot, TooltipTrigger, buttonVariants, cn, useHasPermission, usePermissions };
638
+ export { AmountAction, Banner, Button, CalendarInput, CopyableLabel, Country, CurrencySymbolMap, DateAction, DebouncedInput, DevBanner, Dialog, Drawer, DrawerClose, type DrawerPropsType, DrawerRoot, type FilterListItem, type FilterListOptions, FilterPopover, FlagComponent, FormLabel, type FormatCurrencyOptions, HasResourcePermission, Input, Loader, LocaleSelector, OTPInput, PageDataToolbar, Pagination, PasswordInput, PermissionsContext, PermissionsProvider, PhoneInput, Popover, PopoverContent, PopoverRoot, PopoverTrigger, RadioGroup, RadioGroupItem, type ResourcePermission, type ResourcePermissionProps, type ResourcePermissions, ScrollArea, Select, Sidebar, Status, Table, type TableBulkRowActionsProps, type TablePaginationProps, TextOverflow, type TextOverflowProps, Textarea, Tooltip, TooltipContent, TooltipProvider, TooltipRoot, TooltipTrigger, buttonVariants, cn, useFilterStore, useHasPermission, usePermissions };
package/dist/index.d.ts CHANGED
@@ -13,6 +13,7 @@ import * as PopoverPrimitive from '@radix-ui/react-popover';
13
13
  import { Drawer as Drawer$1 } from 'vaul';
14
14
  import { RowData, Row, Table as Table$1 } from '@tanstack/react-table';
15
15
  import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
16
+ import * as zustand from 'zustand';
16
17
  import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
17
18
  import dayjs from 'dayjs';
18
19
  import { ClassValue } from 'clsx';
@@ -56,6 +57,7 @@ declare const buttonVariants: (props?: ({
56
57
  variant?: "primary" | "danger" | "neutral" | "outlined" | "danger-outlined" | "light-outlined" | "dark-text" | "light" | null | undefined;
57
58
  size?: "default" | "sm" | "lg" | "md" | "icon-sm" | "icon" | "icon-lg" | null | undefined;
58
59
  } & class_variance_authority_dist_types.ClassProp) | undefined) => string;
60
+ type ButtonVariant = VariantProps<typeof buttonVariants>["variant"];
59
61
  interface ButtonProps extends DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, VariantProps<typeof buttonVariants> {
60
62
  asChild?: boolean;
61
63
  isLoading?: boolean;
@@ -438,10 +440,26 @@ type FilterContentProps = {
438
440
  filters: FilterListItem[];
439
441
  values?: Record<string, any>;
440
442
  setAppliedFilters?: (values: Record<string, any>) => void;
443
+ onChange?: (values: Record<string, any>) => void;
441
444
  id?: string;
442
445
  };
443
446
  type FilterListOptions = FilterListItem[];
444
447
 
448
+ type RowAction = {
449
+ icon: React__default.ReactNode;
450
+ label: React__default.ReactNode;
451
+ onClick: (rowIds: string[]) => void;
452
+ className?: string;
453
+ variant?: ButtonVariant;
454
+ disabled?: boolean;
455
+ showCount?: boolean;
456
+ };
457
+ type TableBulkRowActionsProps = {
458
+ tableBulkActions: RowAction[];
459
+ selectedRows: string[];
460
+ isMobile?: boolean;
461
+ };
462
+
445
463
  type TableSearchProps = {
446
464
  enabled: boolean;
447
465
  debounceRate?: number;
@@ -482,8 +500,13 @@ type TableProps<T extends RowData> = {
482
500
  pagination?: TablePaginationProps;
483
501
  search?: TableSearchProps;
484
502
  table: Table$1<T>;
503
+ onFilterChange?: (values: Record<string, any>) => void;
504
+ tableBulkActions?: {
505
+ actions: TableBulkRowActionsProps["tableBulkActions"];
506
+ selectedRows?: TableBulkRowActionsProps["selectedRows"];
507
+ };
485
508
  };
486
- declare const Table: <T extends RowData>({ table, isMobile, onRowClick, id, onRefetch, isRefetching, FilterMenu, ExtraNode, onExport, search, download, isLoading, pagination, filterListOptions, setAppliedFilters, }: TableProps<T>) => react_jsx_runtime.JSX.Element;
509
+ declare const Table: <T extends RowData>({ table, isMobile, onRowClick, id, onRefetch, isRefetching, FilterMenu, ExtraNode, onExport, search, download, isLoading, pagination, filterListOptions, setAppliedFilters, onFilterChange, tableBulkActions, }: TableProps<T>) => react_jsx_runtime.JSX.Element;
487
510
 
488
511
  type PageDataToolbarProps = {
489
512
  onRefetch?: () => void;
@@ -494,10 +517,11 @@ type PageDataToolbarProps = {
494
517
  download?: TableDownloadProps;
495
518
  isRefetching?: boolean;
496
519
  setAppliedFilters?: (values: Record<string, any>) => void;
520
+ onFilterChange?: (values: Record<string, any>) => void;
497
521
  filterListOptions?: FilterListItem[];
498
522
  id?: string;
499
523
  };
500
- declare const PageDataToolbar: ({ onRefetch, search, FilterMenu, ExtraNode, onExport, download, isRefetching, filterListOptions, setAppliedFilters, id, }: PageDataToolbarProps) => react_jsx_runtime.JSX.Element;
524
+ declare const PageDataToolbar: ({ onRefetch, search, FilterMenu, ExtraNode, onExport, download, isRefetching, filterListOptions, setAppliedFilters, onFilterChange, id, }: PageDataToolbarProps) => react_jsx_runtime.JSX.Element;
501
525
 
502
526
  type ResourcePermission = {
503
527
  resource: string;
@@ -553,8 +577,16 @@ type FilterPopoverProps = FilterContentProps & {
553
577
  isOpen?: boolean;
554
578
  trigger?: ReactNode;
555
579
  id?: string;
580
+ onChange?: (values: Record<string, any>) => void;
556
581
  };
557
- declare const FilterPopover: ({ filters, setAppliedFilters, isOpen, id, }: FilterPopoverProps) => react_jsx_runtime.JSX.Element | null;
582
+ declare const FilterPopover: ({ filters, setAppliedFilters, isOpen, onChange, id, }: FilterPopoverProps) => react_jsx_runtime.JSX.Element | null;
583
+
584
+ interface FilterSliceType {
585
+ filters: Record<string, any> | null;
586
+ upDateFilter: (items: Record<string, any> | ((prev: Record<string, any> | null) => Record<string, any> | null) | null) => void;
587
+ resetFilters: () => void;
588
+ }
589
+ declare const useFilterStore: () => zustand.UseBoundStore<zustand.StoreApi<FilterSliceType>>;
558
590
 
559
591
  interface TextOverflowProps extends React__default.HTMLAttributes<HTMLElement> {
560
592
  children: React__default.ReactNode;
@@ -603,4 +635,4 @@ declare class DateAction {
603
635
 
604
636
  declare function cn(...inputs: ClassValue[]): string;
605
637
 
606
- export { AmountAction, Banner, Button, CalendarInput, CopyableLabel, Country, CurrencySymbolMap, DateAction, DebouncedInput, DevBanner, Dialog, Drawer, DrawerClose, type DrawerPropsType, DrawerRoot, type FilterListItem, type FilterListOptions, FilterPopover, FlagComponent, FormLabel, type FormatCurrencyOptions, HasResourcePermission, Input, Loader, LocaleSelector, OTPInput, PageDataToolbar, Pagination, PasswordInput, PermissionsContext, PermissionsProvider, PhoneInput, Popover, PopoverContent, PopoverRoot, PopoverTrigger, RadioGroup, RadioGroupItem, type ResourcePermission, type ResourcePermissionProps, type ResourcePermissions, ScrollArea, Select, Sidebar, Status, Table, type TablePaginationProps, TextOverflow, type TextOverflowProps, Textarea, Tooltip, TooltipContent, TooltipProvider, TooltipRoot, TooltipTrigger, buttonVariants, cn, useHasPermission, usePermissions };
638
+ export { AmountAction, Banner, Button, CalendarInput, CopyableLabel, Country, CurrencySymbolMap, DateAction, DebouncedInput, DevBanner, Dialog, Drawer, DrawerClose, type DrawerPropsType, DrawerRoot, type FilterListItem, type FilterListOptions, FilterPopover, FlagComponent, FormLabel, type FormatCurrencyOptions, HasResourcePermission, Input, Loader, LocaleSelector, OTPInput, PageDataToolbar, Pagination, PasswordInput, PermissionsContext, PermissionsProvider, PhoneInput, Popover, PopoverContent, PopoverRoot, PopoverTrigger, RadioGroup, RadioGroupItem, type ResourcePermission, type ResourcePermissionProps, type ResourcePermissions, ScrollArea, Select, Sidebar, Status, Table, type TableBulkRowActionsProps, type TablePaginationProps, TextOverflow, type TextOverflowProps, Textarea, Tooltip, TooltipContent, TooltipProvider, TooltipRoot, TooltipTrigger, buttonVariants, cn, useFilterStore, useHasPermission, usePermissions };