@6thbridge/hexa 0.0.0-pr80-149 → 0.0.0-pr80-151

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';
@@ -474,37 +475,83 @@ type TableBulkRowActionsProps = {
474
475
  id?: string;
475
476
  };
476
477
 
477
- type SelectOption = {
478
+ type FilterSelectOption = {
478
479
  value: string;
479
480
  label: string;
480
481
  };
481
- type Base = {
482
- 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 {
483
487
  key: string;
484
488
  label: string;
489
+ type: FilterType;
485
490
  placeholder?: string;
486
- };
487
- type FilterListOption = {
491
+ }
492
+ /**
493
+ * Input-specific filter properties.
494
+ */
495
+ interface FilterInput extends FilterBase, Omit<InputProps, "value" | "onChange" | "type" | "label"> {
488
496
  type: "input";
489
- } & Exclude<InputProps, "value" | "onChange">;
490
- 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 {
491
517
  type: "date";
492
518
  date?: string | Date;
493
- };
494
- type FilterListInputDropDown = {
495
- type: "drop-down" | "multi" | "radio";
496
- options: SelectOption[];
519
+ }
520
+ /**
521
+ * Multi-select specific filter properties.
522
+ */
523
+ interface FilterMultiSelect extends FilterBase {
524
+ type: "multi";
525
+ options: FilterSelectOption[];
497
526
  hideSearch?: boolean;
498
- };
499
- type FilterListItem = Base & (FilterListOption | FilterListInputDropDown | FilterListDate);
500
- type FilterContentProps = {
501
- filters: FilterListItem[];
502
- values?: Record<string, any>;
503
- setAppliedFilters?: (values: Record<string, any>) => void;
504
- onChange?: (values: Record<string, any>) => void;
505
- id?: string;
506
- };
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
+ */
507
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
+ };
508
555
 
509
556
  type PaginationProps = {
510
557
  currentPage?: number;
@@ -633,11 +680,19 @@ declare const RadioGroupItem: React$1.ForwardRefExoticComponent<Omit<RadioGroupP
633
680
  className?: string;
634
681
  } & React$1.RefAttributes<HTMLButtonElement>>;
635
682
 
636
- type FilterPopoverProps = FilterContentProps & {
683
+ type FilterContentProps = {
684
+ filters: FilterListItem[];
685
+ values?: FilterValues;
686
+ onChange?: (values: FilterValues) => void;
687
+ onApply?: (values: FilterValues) => void;
688
+ id?: string;
689
+ setAppliedFilters?: (values: FilterValues) => void;
690
+ };
691
+
692
+ type FilterPopoverProps = Omit<FilterContentProps, "onApply"> & {
637
693
  isOpen?: boolean;
638
694
  trigger?: ReactNode;
639
695
  id?: string;
640
- onChange?: (values: Record<string, any>) => void;
641
696
  };
642
697
  declare const FilterPopover: ({ filters, setAppliedFilters, isOpen, onChange, values, id, }: FilterPopoverProps) => React$1.JSX.Element | null;
643
698
 
@@ -867,4 +922,4 @@ declare const TagsInput: ({ value, onChange, options, label, error, placeholder,
867
922
 
868
923
  declare function cn(...inputs: ClassValue[]): string;
869
924
 
870
- 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 };
925
+ 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';
@@ -474,37 +475,83 @@ type TableBulkRowActionsProps = {
474
475
  id?: string;
475
476
  };
476
477
 
477
- type SelectOption = {
478
+ type FilterSelectOption = {
478
479
  value: string;
479
480
  label: string;
480
481
  };
481
- type Base = {
482
- 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 {
483
487
  key: string;
484
488
  label: string;
489
+ type: FilterType;
485
490
  placeholder?: string;
486
- };
487
- type FilterListOption = {
491
+ }
492
+ /**
493
+ * Input-specific filter properties.
494
+ */
495
+ interface FilterInput extends FilterBase, Omit<InputProps, "value" | "onChange" | "type" | "label"> {
488
496
  type: "input";
489
- } & Exclude<InputProps, "value" | "onChange">;
490
- 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 {
491
517
  type: "date";
492
518
  date?: string | Date;
493
- };
494
- type FilterListInputDropDown = {
495
- type: "drop-down" | "multi" | "radio";
496
- options: SelectOption[];
519
+ }
520
+ /**
521
+ * Multi-select specific filter properties.
522
+ */
523
+ interface FilterMultiSelect extends FilterBase {
524
+ type: "multi";
525
+ options: FilterSelectOption[];
497
526
  hideSearch?: boolean;
498
- };
499
- type FilterListItem = Base & (FilterListOption | FilterListInputDropDown | FilterListDate);
500
- type FilterContentProps = {
501
- filters: FilterListItem[];
502
- values?: Record<string, any>;
503
- setAppliedFilters?: (values: Record<string, any>) => void;
504
- onChange?: (values: Record<string, any>) => void;
505
- id?: string;
506
- };
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
+ */
507
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
+ };
508
555
 
509
556
  type PaginationProps = {
510
557
  currentPage?: number;
@@ -633,11 +680,19 @@ declare const RadioGroupItem: React$1.ForwardRefExoticComponent<Omit<RadioGroupP
633
680
  className?: string;
634
681
  } & React$1.RefAttributes<HTMLButtonElement>>;
635
682
 
636
- type FilterPopoverProps = FilterContentProps & {
683
+ type FilterContentProps = {
684
+ filters: FilterListItem[];
685
+ values?: FilterValues;
686
+ onChange?: (values: FilterValues) => void;
687
+ onApply?: (values: FilterValues) => void;
688
+ id?: string;
689
+ setAppliedFilters?: (values: FilterValues) => void;
690
+ };
691
+
692
+ type FilterPopoverProps = Omit<FilterContentProps, "onApply"> & {
637
693
  isOpen?: boolean;
638
694
  trigger?: ReactNode;
639
695
  id?: string;
640
- onChange?: (values: Record<string, any>) => void;
641
696
  };
642
697
  declare const FilterPopover: ({ filters, setAppliedFilters, isOpen, onChange, values, id, }: FilterPopoverProps) => React$1.JSX.Element | null;
643
698
 
@@ -867,4 +922,4 @@ declare const TagsInput: ({ value, onChange, options, label, error, placeholder,
867
922
 
868
923
  declare function cn(...inputs: ClassValue[]): string;
869
924
 
870
- 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 };
925
+ 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 };