@6thbridge/hexa 0.0.95 → 0.0.97

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
@@ -12,6 +12,7 @@ import { OTPInputProps as OTPInputProps$1 } from 'react-otp-input';
12
12
  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
+ import { UseFormReturn } from 'react-hook-form';
15
16
  import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
16
17
  import * as zustand from 'zustand';
17
18
  import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
@@ -153,6 +154,10 @@ type CountryPropsStatus = VariantProps<typeof inputContainerVariants>["status"];
153
154
  type CountrySelectOption$1 = {
154
155
  label: string;
155
156
  value: string;
157
+ currencyCode?: string;
158
+ countryCode?: string;
159
+ internetCountryCode?: string;
160
+ countryName?: string;
156
161
  };
157
162
  interface CountryProps {
158
163
  modal?: boolean;
@@ -470,37 +475,83 @@ type TableBulkRowActionsProps = {
470
475
  id?: string;
471
476
  };
472
477
 
473
- type SelectOption = {
478
+ type FilterSelectOption = {
474
479
  value: string;
475
480
  label: string;
476
481
  };
477
- type Base = {
478
- type: "input" | "drop-down" | "date-range" | "multi" | "date" | "radio";
482
+ type FilterType = "input" | "drop-down" | "date-range" | "multi" | "date" | "radio";
483
+ /**
484
+ * Base properties shared by all filter types.
485
+ */
486
+ interface FilterBase {
479
487
  key: string;
480
488
  label: string;
489
+ type: FilterType;
481
490
  placeholder?: string;
482
- };
483
- type FilterListOption = {
491
+ }
492
+ /**
493
+ * Input-specific filter properties.
494
+ */
495
+ interface FilterInput extends FilterBase, Omit<InputProps, "value" | "onChange" | "type" | "label"> {
484
496
  type: "input";
485
- } & Exclude<InputProps, "value" | "onChange">;
486
- type FilterListDate = {
497
+ }
498
+ /**
499
+ * Drop-down (Select) specific filter properties.
500
+ */
501
+ interface FilterDropDown extends FilterBase {
502
+ type: "drop-down";
503
+ options: FilterSelectOption[];
504
+ hideSearch?: boolean;
505
+ }
506
+ /**
507
+ * Radio specific filter properties.
508
+ */
509
+ interface FilterRadio extends FilterBase {
510
+ type: "radio";
511
+ options: FilterSelectOption[];
512
+ }
513
+ /**
514
+ * Date specific filter properties.
515
+ */
516
+ interface FilterDate extends FilterBase {
487
517
  type: "date";
488
518
  date?: string | Date;
489
- };
490
- type FilterListInputDropDown = {
491
- type: "drop-down" | "multi" | "radio";
492
- options: SelectOption[];
519
+ }
520
+ /**
521
+ * Multi-select specific filter properties.
522
+ */
523
+ interface FilterMultiSelect extends FilterBase {
524
+ type: "multi";
525
+ options: FilterSelectOption[];
493
526
  hideSearch?: boolean;
494
- };
495
- type FilterListItem = Base & (FilterListOption | FilterListInputDropDown | FilterListDate);
496
- type FilterContentProps = {
497
- filters: FilterListItem[];
498
- values?: Record<string, any>;
499
- setAppliedFilters?: (values: Record<string, any>) => void;
500
- onChange?: (values: Record<string, any>) => void;
501
- id?: string;
502
- };
527
+ }
528
+ /**
529
+ * Date range specific filter properties.
530
+ */
531
+ interface FilterDateRange extends FilterBase {
532
+ type: "date-range";
533
+ }
534
+ /**
535
+ * Discriminated union of all supported filter item configurations.
536
+ */
537
+ type FilterListItem = FilterInput | FilterDropDown | FilterRadio | FilterDate | FilterMultiSelect | FilterDateRange;
538
+ /**
539
+ * Alias for backward compatibility.
540
+ */
503
541
  type FilterListOptions = FilterListItem[];
542
+ /**
543
+ * Type alias for filter values, used to avoid 'any' in filter state management.
544
+ */
545
+ type FilterValues = Record<string, string>;
546
+ /**
547
+ * Shared props for individual filter fields to eliminate 'any'.
548
+ */
549
+ type FilterFieldProps<T extends FilterListItem = FilterListItem> = {
550
+ filter: T;
551
+ id: string;
552
+ form: UseFormReturn<FilterValues>;
553
+ onClear?: (fieldKey: string) => void;
554
+ };
504
555
 
505
556
  type PaginationProps = {
506
557
  currentPage?: number;
@@ -548,6 +599,7 @@ type TableProps<T extends RowData> = {
548
599
  FilterMenu?: ReactNode;
549
600
  setAppliedFilters?: (values: Record<string, any>) => void;
550
601
  filterListOptions?: FilterListItem[];
602
+ filterValues?: Record<string, any>;
551
603
  buttonClassName?: string;
552
604
  download?: TableDownloadProps;
553
605
  id?: string;
@@ -567,7 +619,7 @@ type TableProps<T extends RowData> = {
567
619
  };
568
620
  emptyDataMessage?: ReactNode;
569
621
  };
570
- declare const Table: <T extends RowData>({ table, isMobile, onRowClick, id, onRefetch, isRefetching, FilterMenu, ExtraNode, onExport, search, download, isLoading, pagination, filterListOptions, setAppliedFilters, onFilterChange, tableBulkActions, emptyDataMessage, }: TableProps<T>) => React$1.JSX.Element;
622
+ declare const Table: <T extends RowData>({ table, isMobile, onRowClick, id, onRefetch, isRefetching, FilterMenu, ExtraNode, onExport, search, download, isLoading, pagination, filterListOptions, filterValues, setAppliedFilters, onFilterChange, tableBulkActions, emptyDataMessage, }: TableProps<T>) => React$1.JSX.Element;
571
623
 
572
624
  type PageDataToolbarProps = {
573
625
  onRefetch?: () => void;
@@ -579,10 +631,11 @@ type PageDataToolbarProps = {
579
631
  isRefetching?: boolean;
580
632
  setAppliedFilters?: (values: Record<string, any>) => void;
581
633
  onFilterChange?: (values: Record<string, any>) => void;
634
+ filterValues?: Record<string, any>;
582
635
  filterListOptions?: FilterListItem[];
583
636
  id?: string;
584
637
  };
585
- declare const PageDataToolbar: ({ onRefetch, search, FilterMenu, ExtraNode, onExport, download, isRefetching, filterListOptions, setAppliedFilters, onFilterChange, id, }: PageDataToolbarProps) => React$1.JSX.Element;
638
+ declare const PageDataToolbar: ({ onRefetch, search, FilterMenu, ExtraNode, onExport, download, isRefetching, filterListOptions, filterValues, setAppliedFilters, onFilterChange, id, }: PageDataToolbarProps) => React$1.JSX.Element;
586
639
 
587
640
  declare const PermissionsContext: React$1.Context<ResourcePermissions | undefined>;
588
641
  declare const PermissionsProvider: ({ permissions, children, }: {
@@ -627,13 +680,24 @@ declare const RadioGroupItem: React$1.ForwardRefExoticComponent<Omit<RadioGroupP
627
680
  className?: string;
628
681
  } & React$1.RefAttributes<HTMLButtonElement>>;
629
682
 
630
- type FilterPopoverProps = FilterContentProps & {
683
+ type FilterContentProps = {
684
+ filters: FilterListItem[];
685
+ values?: FilterValues;
686
+ onChange?: (values: FilterValues) => void;
687
+ onApply?: (values: FilterValues) => void;
688
+ onReset?: () => void;
689
+ /** Called when a single field is cleared, so the parent can update applied state + URL for that key only. */
690
+ onClearApplied?: (fieldKey: string) => void;
691
+ id?: string;
692
+ setAppliedFilters?: (values: FilterValues) => void;
693
+ };
694
+
695
+ type FilterPopoverProps = Omit<FilterContentProps, "onApply"> & {
631
696
  isOpen?: boolean;
632
697
  trigger?: ReactNode;
633
698
  id?: string;
634
- onChange?: (values: Record<string, any>) => void;
635
699
  };
636
- declare const FilterPopover: ({ filters, setAppliedFilters, isOpen, onChange, id, }: FilterPopoverProps) => React$1.JSX.Element | null;
700
+ declare const FilterPopover: ({ filters, setAppliedFilters, isOpen, onChange, values, id, }: FilterPopoverProps) => React$1.JSX.Element | null;
637
701
 
638
702
  interface FilterSliceType {
639
703
  filters: Record<string, any> | null;
@@ -861,4 +925,4 @@ declare const TagsInput: ({ value, onChange, options, label, error, placeholder,
861
925
 
862
926
  declare function cn(...inputs: ClassValue[]): string;
863
927
 
864
- export { AmountAction, Banner, Button, CalendarInput, CopyableLabel, Country, CurrencySymbolMap, DateAction, DebouncedInput, DevBanner, Dialog, Drawer, DrawerClose, type DrawerPropsType, DrawerRoot, FeatureBanner, type FilterListItem, type FilterListOptions, FilterPopover, FlagComponent, FormLabel, type FormatCurrencyOptions, HasResourcePermission, Input, Loader, LocaleSelector, MultiSelect, type MultiSelectDataType, MultiSelectTrigger, OTPInput, PageDataToolbar, Pagination, PasswordInput, PermissionsContext, PermissionsProvider, PhoneInput, Popover, PopoverContent, PopoverRoot, PopoverTrigger, RadioGroup, RadioGroupItem, type ResourcePermission, type ResourcePermissionProps, type ResourcePermissions, RichTextEditor, ScrollArea, Select, Sidebar, Status, StringAction, Table, type TableBulkRowActionsProps, type TablePaginationProps, Tabs, type TagOption, TagsInput, type TagsInputProps, TextOverflow, type TextOverflowProps, Textarea, Tooltip, TooltipContent, TooltipProvider, TooltipRoot, TooltipTrigger, buttonVariants, cn, useFilterStore, useHasPermission, usePermissions };
928
+ export { AmountAction, Banner, Button, CalendarInput, CopyableLabel, Country, CurrencySymbolMap, DateAction, DebouncedInput, DevBanner, Dialog, Drawer, DrawerClose, type DrawerPropsType, DrawerRoot, FeatureBanner, type FilterFieldProps, type FilterListItem, type FilterListOptions, FilterPopover, FlagComponent, FormLabel, type FormatCurrencyOptions, HasResourcePermission, Input, Loader, LocaleSelector, MultiSelect, type MultiSelectDataType, MultiSelectTrigger, OTPInput, PageDataToolbar, Pagination, PasswordInput, PermissionsContext, PermissionsProvider, PhoneInput, Popover, PopoverContent, PopoverRoot, PopoverTrigger, RadioGroup, RadioGroupItem, type ResourcePermission, type ResourcePermissionProps, type ResourcePermissions, RichTextEditor, ScrollArea, Select, Sidebar, Status, StringAction, Table, type TableBulkRowActionsProps, type TablePaginationProps, Tabs, type TagOption, TagsInput, type TagsInputProps, TextOverflow, type TextOverflowProps, Textarea, Tooltip, TooltipContent, TooltipProvider, TooltipRoot, TooltipTrigger, buttonVariants, cn, useFilterStore, useHasPermission, usePermissions };
package/dist/index.d.ts CHANGED
@@ -12,6 +12,7 @@ import { OTPInputProps as OTPInputProps$1 } from 'react-otp-input';
12
12
  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
+ import { UseFormReturn } from 'react-hook-form';
15
16
  import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
16
17
  import * as zustand from 'zustand';
17
18
  import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
@@ -153,6 +154,10 @@ type CountryPropsStatus = VariantProps<typeof inputContainerVariants>["status"];
153
154
  type CountrySelectOption$1 = {
154
155
  label: string;
155
156
  value: string;
157
+ currencyCode?: string;
158
+ countryCode?: string;
159
+ internetCountryCode?: string;
160
+ countryName?: string;
156
161
  };
157
162
  interface CountryProps {
158
163
  modal?: boolean;
@@ -470,37 +475,83 @@ type TableBulkRowActionsProps = {
470
475
  id?: string;
471
476
  };
472
477
 
473
- type SelectOption = {
478
+ type FilterSelectOption = {
474
479
  value: string;
475
480
  label: string;
476
481
  };
477
- type Base = {
478
- type: "input" | "drop-down" | "date-range" | "multi" | "date" | "radio";
482
+ type FilterType = "input" | "drop-down" | "date-range" | "multi" | "date" | "radio";
483
+ /**
484
+ * Base properties shared by all filter types.
485
+ */
486
+ interface FilterBase {
479
487
  key: string;
480
488
  label: string;
489
+ type: FilterType;
481
490
  placeholder?: string;
482
- };
483
- type FilterListOption = {
491
+ }
492
+ /**
493
+ * Input-specific filter properties.
494
+ */
495
+ interface FilterInput extends FilterBase, Omit<InputProps, "value" | "onChange" | "type" | "label"> {
484
496
  type: "input";
485
- } & Exclude<InputProps, "value" | "onChange">;
486
- type FilterListDate = {
497
+ }
498
+ /**
499
+ * Drop-down (Select) specific filter properties.
500
+ */
501
+ interface FilterDropDown extends FilterBase {
502
+ type: "drop-down";
503
+ options: FilterSelectOption[];
504
+ hideSearch?: boolean;
505
+ }
506
+ /**
507
+ * Radio specific filter properties.
508
+ */
509
+ interface FilterRadio extends FilterBase {
510
+ type: "radio";
511
+ options: FilterSelectOption[];
512
+ }
513
+ /**
514
+ * Date specific filter properties.
515
+ */
516
+ interface FilterDate extends FilterBase {
487
517
  type: "date";
488
518
  date?: string | Date;
489
- };
490
- type FilterListInputDropDown = {
491
- type: "drop-down" | "multi" | "radio";
492
- options: SelectOption[];
519
+ }
520
+ /**
521
+ * Multi-select specific filter properties.
522
+ */
523
+ interface FilterMultiSelect extends FilterBase {
524
+ type: "multi";
525
+ options: FilterSelectOption[];
493
526
  hideSearch?: boolean;
494
- };
495
- type FilterListItem = Base & (FilterListOption | FilterListInputDropDown | FilterListDate);
496
- type FilterContentProps = {
497
- filters: FilterListItem[];
498
- values?: Record<string, any>;
499
- setAppliedFilters?: (values: Record<string, any>) => void;
500
- onChange?: (values: Record<string, any>) => void;
501
- id?: string;
502
- };
527
+ }
528
+ /**
529
+ * Date range specific filter properties.
530
+ */
531
+ interface FilterDateRange extends FilterBase {
532
+ type: "date-range";
533
+ }
534
+ /**
535
+ * Discriminated union of all supported filter item configurations.
536
+ */
537
+ type FilterListItem = FilterInput | FilterDropDown | FilterRadio | FilterDate | FilterMultiSelect | FilterDateRange;
538
+ /**
539
+ * Alias for backward compatibility.
540
+ */
503
541
  type FilterListOptions = FilterListItem[];
542
+ /**
543
+ * Type alias for filter values, used to avoid 'any' in filter state management.
544
+ */
545
+ type FilterValues = Record<string, string>;
546
+ /**
547
+ * Shared props for individual filter fields to eliminate 'any'.
548
+ */
549
+ type FilterFieldProps<T extends FilterListItem = FilterListItem> = {
550
+ filter: T;
551
+ id: string;
552
+ form: UseFormReturn<FilterValues>;
553
+ onClear?: (fieldKey: string) => void;
554
+ };
504
555
 
505
556
  type PaginationProps = {
506
557
  currentPage?: number;
@@ -548,6 +599,7 @@ type TableProps<T extends RowData> = {
548
599
  FilterMenu?: ReactNode;
549
600
  setAppliedFilters?: (values: Record<string, any>) => void;
550
601
  filterListOptions?: FilterListItem[];
602
+ filterValues?: Record<string, any>;
551
603
  buttonClassName?: string;
552
604
  download?: TableDownloadProps;
553
605
  id?: string;
@@ -567,7 +619,7 @@ type TableProps<T extends RowData> = {
567
619
  };
568
620
  emptyDataMessage?: ReactNode;
569
621
  };
570
- declare const Table: <T extends RowData>({ table, isMobile, onRowClick, id, onRefetch, isRefetching, FilterMenu, ExtraNode, onExport, search, download, isLoading, pagination, filterListOptions, setAppliedFilters, onFilterChange, tableBulkActions, emptyDataMessage, }: TableProps<T>) => React$1.JSX.Element;
622
+ declare const Table: <T extends RowData>({ table, isMobile, onRowClick, id, onRefetch, isRefetching, FilterMenu, ExtraNode, onExport, search, download, isLoading, pagination, filterListOptions, filterValues, setAppliedFilters, onFilterChange, tableBulkActions, emptyDataMessage, }: TableProps<T>) => React$1.JSX.Element;
571
623
 
572
624
  type PageDataToolbarProps = {
573
625
  onRefetch?: () => void;
@@ -579,10 +631,11 @@ type PageDataToolbarProps = {
579
631
  isRefetching?: boolean;
580
632
  setAppliedFilters?: (values: Record<string, any>) => void;
581
633
  onFilterChange?: (values: Record<string, any>) => void;
634
+ filterValues?: Record<string, any>;
582
635
  filterListOptions?: FilterListItem[];
583
636
  id?: string;
584
637
  };
585
- declare const PageDataToolbar: ({ onRefetch, search, FilterMenu, ExtraNode, onExport, download, isRefetching, filterListOptions, setAppliedFilters, onFilterChange, id, }: PageDataToolbarProps) => React$1.JSX.Element;
638
+ declare const PageDataToolbar: ({ onRefetch, search, FilterMenu, ExtraNode, onExport, download, isRefetching, filterListOptions, filterValues, setAppliedFilters, onFilterChange, id, }: PageDataToolbarProps) => React$1.JSX.Element;
586
639
 
587
640
  declare const PermissionsContext: React$1.Context<ResourcePermissions | undefined>;
588
641
  declare const PermissionsProvider: ({ permissions, children, }: {
@@ -627,13 +680,24 @@ declare const RadioGroupItem: React$1.ForwardRefExoticComponent<Omit<RadioGroupP
627
680
  className?: string;
628
681
  } & React$1.RefAttributes<HTMLButtonElement>>;
629
682
 
630
- type FilterPopoverProps = FilterContentProps & {
683
+ type FilterContentProps = {
684
+ filters: FilterListItem[];
685
+ values?: FilterValues;
686
+ onChange?: (values: FilterValues) => void;
687
+ onApply?: (values: FilterValues) => void;
688
+ onReset?: () => void;
689
+ /** Called when a single field is cleared, so the parent can update applied state + URL for that key only. */
690
+ onClearApplied?: (fieldKey: string) => void;
691
+ id?: string;
692
+ setAppliedFilters?: (values: FilterValues) => void;
693
+ };
694
+
695
+ type FilterPopoverProps = Omit<FilterContentProps, "onApply"> & {
631
696
  isOpen?: boolean;
632
697
  trigger?: ReactNode;
633
698
  id?: string;
634
- onChange?: (values: Record<string, any>) => void;
635
699
  };
636
- declare const FilterPopover: ({ filters, setAppliedFilters, isOpen, onChange, id, }: FilterPopoverProps) => React$1.JSX.Element | null;
700
+ declare const FilterPopover: ({ filters, setAppliedFilters, isOpen, onChange, values, id, }: FilterPopoverProps) => React$1.JSX.Element | null;
637
701
 
638
702
  interface FilterSliceType {
639
703
  filters: Record<string, any> | null;
@@ -861,4 +925,4 @@ declare const TagsInput: ({ value, onChange, options, label, error, placeholder,
861
925
 
862
926
  declare function cn(...inputs: ClassValue[]): string;
863
927
 
864
- export { AmountAction, Banner, Button, CalendarInput, CopyableLabel, Country, CurrencySymbolMap, DateAction, DebouncedInput, DevBanner, Dialog, Drawer, DrawerClose, type DrawerPropsType, DrawerRoot, FeatureBanner, type FilterListItem, type FilterListOptions, FilterPopover, FlagComponent, FormLabel, type FormatCurrencyOptions, HasResourcePermission, Input, Loader, LocaleSelector, MultiSelect, type MultiSelectDataType, MultiSelectTrigger, OTPInput, PageDataToolbar, Pagination, PasswordInput, PermissionsContext, PermissionsProvider, PhoneInput, Popover, PopoverContent, PopoverRoot, PopoverTrigger, RadioGroup, RadioGroupItem, type ResourcePermission, type ResourcePermissionProps, type ResourcePermissions, RichTextEditor, ScrollArea, Select, Sidebar, Status, StringAction, Table, type TableBulkRowActionsProps, type TablePaginationProps, Tabs, type TagOption, TagsInput, type TagsInputProps, TextOverflow, type TextOverflowProps, Textarea, Tooltip, TooltipContent, TooltipProvider, TooltipRoot, TooltipTrigger, buttonVariants, cn, useFilterStore, useHasPermission, usePermissions };
928
+ export { AmountAction, Banner, Button, CalendarInput, CopyableLabel, Country, CurrencySymbolMap, DateAction, DebouncedInput, DevBanner, Dialog, Drawer, DrawerClose, type DrawerPropsType, DrawerRoot, FeatureBanner, type FilterFieldProps, type FilterListItem, type FilterListOptions, FilterPopover, FlagComponent, FormLabel, type FormatCurrencyOptions, HasResourcePermission, Input, Loader, LocaleSelector, MultiSelect, type MultiSelectDataType, MultiSelectTrigger, OTPInput, PageDataToolbar, Pagination, PasswordInput, PermissionsContext, PermissionsProvider, PhoneInput, Popover, PopoverContent, PopoverRoot, PopoverTrigger, RadioGroup, RadioGroupItem, type ResourcePermission, type ResourcePermissionProps, type ResourcePermissions, RichTextEditor, ScrollArea, Select, Sidebar, Status, StringAction, Table, type TableBulkRowActionsProps, type TablePaginationProps, Tabs, type TagOption, TagsInput, type TagsInputProps, TextOverflow, type TextOverflowProps, Textarea, Tooltip, TooltipContent, TooltipProvider, TooltipRoot, TooltipTrigger, buttonVariants, cn, useFilterStore, useHasPermission, usePermissions };