@6thbridge/hexa 0.0.56 → 0.0.58

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.
@@ -1,5 +1,5 @@
1
1
   WARN  Issue while reading "/Users/joachim/.nvm/versions/node/v20.17.0/lib/node_modules/npmrc". EISDIR: illegal operation on a directory, read
2
2
 
3
- > @6thbridge/hexa@0.0.56 lint /Users/joachim/Documents/dev/payfusion/payfusion-component-library/packages/6thbridge-hexa
3
+ > @6thbridge/hexa@0.0.58 lint /Users/joachim/Documents/dev/payfusion/payfusion-component-library/packages/6thbridge-hexa
4
4
  > eslint . --max-warnings 0
5
5
 
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 * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
15
16
  import dayjs from 'dayjs';
16
17
  import { ClassValue } from 'clsx';
17
18
 
@@ -402,6 +403,34 @@ type PaginationProps = {
402
403
  */
403
404
  declare const Pagination: ({ currentPage, totalPages, onPageChange, itemsPerPage, totalItems, }: PaginationProps) => react_jsx_runtime.JSX.Element;
404
405
 
406
+ type SelectOption = {
407
+ value: string;
408
+ label: string;
409
+ };
410
+ type Base = {
411
+ type: "input" | "drop-down" | "date-range" | "multi" | "date" | "radio";
412
+ key: string;
413
+ label: string;
414
+ placeholder?: string;
415
+ };
416
+ type FilterListOption = {
417
+ type: "input";
418
+ } & Exclude<InputProps, "value" | "onChange">;
419
+ type FilterListDate = {
420
+ type: "date";
421
+ date?: string | Date;
422
+ };
423
+ type FilterListInputDropDown = {
424
+ type: "drop-down" | "multi" | "radio";
425
+ options: SelectOption[];
426
+ };
427
+ type FilterListItem = Base & (FilterListOption | FilterListInputDropDown | FilterListDate);
428
+ type FilterContentProps = {
429
+ filters: FilterListItem[];
430
+ values?: Record<string, any>;
431
+ setAppliedFilters?: (values: Record<string, any>) => void;
432
+ };
433
+
405
434
  type TableSearchProps = {
406
435
  enabled: boolean;
407
436
  debounceRate?: number;
@@ -418,7 +447,18 @@ type TablePaginationProps = {
418
447
  } & PaginationProps;
419
448
  type TableProps<T extends RowData> = {
420
449
  ExtraNode?: ReactNode;
450
+ /**
451
+ * @deprecated Use the `filterListOptions` prop instead.
452
+ *
453
+ * The `FilterMenu` prop is deprecated in favor of `filterListOptions`, which provides a more flexible and structured way to define filter options for the table.
454
+ *
455
+ * To manage the state of applied filters, use the `setAppliedFilters` callback. This function can be used to collect and update the current filter state based on user interactions with the filter list options.
456
+ *
457
+ * The `filterListOptions` prop accepts an array of filter configuration objects, allowing you to define available filters, their types, and possible values. This approach enables dynamic filter rendering and better state management compared to the static `FilterMenu` node.
458
+ */
421
459
  FilterMenu?: ReactNode;
460
+ setAppliedFilters?: () => void;
461
+ filterListOptions?: FilterListItem[];
422
462
  buttonClassName?: string;
423
463
  download?: TableDownloadProps;
424
464
  id?: string;
@@ -432,7 +472,7 @@ type TableProps<T extends RowData> = {
432
472
  search?: TableSearchProps;
433
473
  table: Table$1<T>;
434
474
  };
435
- declare const Table: <T extends RowData>({ table, isMobile, onRowClick, id, onRefetch, isRefetching, FilterMenu, ExtraNode, onExport, search, download, isLoading, pagination, }: TableProps<T>) => react_jsx_runtime.JSX.Element;
475
+ 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;
436
476
 
437
477
  type PageDataToolbarProps = {
438
478
  onRefetch?: () => void;
@@ -442,8 +482,10 @@ type PageDataToolbarProps = {
442
482
  onExport?: () => void;
443
483
  download?: TableDownloadProps;
444
484
  isRefetching?: boolean;
485
+ setAppliedFilters?: () => void;
486
+ filterListOptions?: FilterListItem[];
445
487
  };
446
- declare const PageDataToolbar: ({ onRefetch, search, FilterMenu, ExtraNode, onExport, download, isRefetching, }: PageDataToolbarProps) => react_jsx_runtime.JSX.Element;
488
+ declare const PageDataToolbar: ({ onRefetch, search, FilterMenu, ExtraNode, onExport, download, isRefetching, filterListOptions, setAppliedFilters, }: PageDataToolbarProps) => react_jsx_runtime.JSX.Element;
447
489
 
448
490
  type ResourcePermission = {
449
491
  resource: string;
@@ -478,6 +520,29 @@ declare const useHasPermission: (permission: {
478
520
 
479
521
  declare const HasResourcePermission: ({ permission, children, }: ResourcePermissionProps) => react_jsx_runtime.JSX.Element;
480
522
 
523
+ type FilterPopoverProps = FilterContentProps & {
524
+ isOpen?: boolean;
525
+ trigger?: ReactNode;
526
+ };
527
+ declare const FilterPopover: ({ filters, setAppliedFilters, isOpen, }: FilterPopoverProps) => react_jsx_runtime.JSX.Element | null;
528
+
529
+ type CalendarInputProps = {
530
+ label?: string;
531
+ helpText?: string | React$1.ReactNode;
532
+ error?: string;
533
+ optional?: boolean;
534
+ onChange: (value: string | null) => void;
535
+ value?: string;
536
+ };
537
+ declare const CalendarInput: ({ label, optional, onChange, error, helpText, value, }: CalendarInputProps) => react_jsx_runtime.JSX.Element;
538
+
539
+ declare const RadioGroup: React$1.ForwardRefExoticComponent<Omit<RadioGroupPrimitive.RadioGroupProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & {
540
+ className?: string;
541
+ } & React$1.RefAttributes<HTMLDivElement>>;
542
+ declare const RadioGroupItem: React$1.ForwardRefExoticComponent<Omit<RadioGroupPrimitive.RadioGroupItemProps & React$1.RefAttributes<HTMLButtonElement>, "ref"> & {
543
+ className?: string;
544
+ } & React$1.RefAttributes<HTMLButtonElement>>;
545
+
481
546
  declare const CurrencySymbolMap: Record<string, string>;
482
547
  interface FormatCurrencyOptions {
483
548
  convertToMajorCurrency?: boolean;
@@ -499,4 +564,4 @@ declare class DateAction {
499
564
 
500
565
  declare function cn(...inputs: ClassValue[]): string;
501
566
 
502
- export { AmountAction, Banner, Button, CopyableLabel, Country, CurrencySymbolMap, DateAction, DebouncedInput, DevBanner, Dialog, Drawer, DrawerClose, type DrawerPropsType, DrawerRoot, FlagComponent, FormLabel, type FormatCurrencyOptions, HasResourcePermission, Input, Loader, LocaleSelector, OTPInput, PageDataToolbar, Pagination, PasswordInput, PermissionsContext, PermissionsProvider, PhoneInput, Popover, PopoverContent, PopoverRoot, PopoverTrigger, type ResourcePermission, type ResourcePermissionProps, type ResourcePermissions, Select, Sidebar, Status, Table, type TablePaginationProps, Textarea, Tooltip, TooltipContent, TooltipProvider, TooltipRoot, TooltipTrigger, buttonVariants, cn, useHasPermission, usePermissions };
567
+ export { AmountAction, Banner, Button, CalendarInput, CopyableLabel, Country, CurrencySymbolMap, DateAction, DebouncedInput, DevBanner, Dialog, Drawer, DrawerClose, type DrawerPropsType, DrawerRoot, 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, Select, Sidebar, Status, Table, type TablePaginationProps, Textarea, Tooltip, TooltipContent, TooltipProvider, TooltipRoot, TooltipTrigger, buttonVariants, cn, 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 * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
15
16
  import dayjs from 'dayjs';
16
17
  import { ClassValue } from 'clsx';
17
18
 
@@ -402,6 +403,34 @@ type PaginationProps = {
402
403
  */
403
404
  declare const Pagination: ({ currentPage, totalPages, onPageChange, itemsPerPage, totalItems, }: PaginationProps) => react_jsx_runtime.JSX.Element;
404
405
 
406
+ type SelectOption = {
407
+ value: string;
408
+ label: string;
409
+ };
410
+ type Base = {
411
+ type: "input" | "drop-down" | "date-range" | "multi" | "date" | "radio";
412
+ key: string;
413
+ label: string;
414
+ placeholder?: string;
415
+ };
416
+ type FilterListOption = {
417
+ type: "input";
418
+ } & Exclude<InputProps, "value" | "onChange">;
419
+ type FilterListDate = {
420
+ type: "date";
421
+ date?: string | Date;
422
+ };
423
+ type FilterListInputDropDown = {
424
+ type: "drop-down" | "multi" | "radio";
425
+ options: SelectOption[];
426
+ };
427
+ type FilterListItem = Base & (FilterListOption | FilterListInputDropDown | FilterListDate);
428
+ type FilterContentProps = {
429
+ filters: FilterListItem[];
430
+ values?: Record<string, any>;
431
+ setAppliedFilters?: (values: Record<string, any>) => void;
432
+ };
433
+
405
434
  type TableSearchProps = {
406
435
  enabled: boolean;
407
436
  debounceRate?: number;
@@ -418,7 +447,18 @@ type TablePaginationProps = {
418
447
  } & PaginationProps;
419
448
  type TableProps<T extends RowData> = {
420
449
  ExtraNode?: ReactNode;
450
+ /**
451
+ * @deprecated Use the `filterListOptions` prop instead.
452
+ *
453
+ * The `FilterMenu` prop is deprecated in favor of `filterListOptions`, which provides a more flexible and structured way to define filter options for the table.
454
+ *
455
+ * To manage the state of applied filters, use the `setAppliedFilters` callback. This function can be used to collect and update the current filter state based on user interactions with the filter list options.
456
+ *
457
+ * The `filterListOptions` prop accepts an array of filter configuration objects, allowing you to define available filters, their types, and possible values. This approach enables dynamic filter rendering and better state management compared to the static `FilterMenu` node.
458
+ */
421
459
  FilterMenu?: ReactNode;
460
+ setAppliedFilters?: () => void;
461
+ filterListOptions?: FilterListItem[];
422
462
  buttonClassName?: string;
423
463
  download?: TableDownloadProps;
424
464
  id?: string;
@@ -432,7 +472,7 @@ type TableProps<T extends RowData> = {
432
472
  search?: TableSearchProps;
433
473
  table: Table$1<T>;
434
474
  };
435
- declare const Table: <T extends RowData>({ table, isMobile, onRowClick, id, onRefetch, isRefetching, FilterMenu, ExtraNode, onExport, search, download, isLoading, pagination, }: TableProps<T>) => react_jsx_runtime.JSX.Element;
475
+ 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;
436
476
 
437
477
  type PageDataToolbarProps = {
438
478
  onRefetch?: () => void;
@@ -442,8 +482,10 @@ type PageDataToolbarProps = {
442
482
  onExport?: () => void;
443
483
  download?: TableDownloadProps;
444
484
  isRefetching?: boolean;
485
+ setAppliedFilters?: () => void;
486
+ filterListOptions?: FilterListItem[];
445
487
  };
446
- declare const PageDataToolbar: ({ onRefetch, search, FilterMenu, ExtraNode, onExport, download, isRefetching, }: PageDataToolbarProps) => react_jsx_runtime.JSX.Element;
488
+ declare const PageDataToolbar: ({ onRefetch, search, FilterMenu, ExtraNode, onExport, download, isRefetching, filterListOptions, setAppliedFilters, }: PageDataToolbarProps) => react_jsx_runtime.JSX.Element;
447
489
 
448
490
  type ResourcePermission = {
449
491
  resource: string;
@@ -478,6 +520,29 @@ declare const useHasPermission: (permission: {
478
520
 
479
521
  declare const HasResourcePermission: ({ permission, children, }: ResourcePermissionProps) => react_jsx_runtime.JSX.Element;
480
522
 
523
+ type FilterPopoverProps = FilterContentProps & {
524
+ isOpen?: boolean;
525
+ trigger?: ReactNode;
526
+ };
527
+ declare const FilterPopover: ({ filters, setAppliedFilters, isOpen, }: FilterPopoverProps) => react_jsx_runtime.JSX.Element | null;
528
+
529
+ type CalendarInputProps = {
530
+ label?: string;
531
+ helpText?: string | React$1.ReactNode;
532
+ error?: string;
533
+ optional?: boolean;
534
+ onChange: (value: string | null) => void;
535
+ value?: string;
536
+ };
537
+ declare const CalendarInput: ({ label, optional, onChange, error, helpText, value, }: CalendarInputProps) => react_jsx_runtime.JSX.Element;
538
+
539
+ declare const RadioGroup: React$1.ForwardRefExoticComponent<Omit<RadioGroupPrimitive.RadioGroupProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & {
540
+ className?: string;
541
+ } & React$1.RefAttributes<HTMLDivElement>>;
542
+ declare const RadioGroupItem: React$1.ForwardRefExoticComponent<Omit<RadioGroupPrimitive.RadioGroupItemProps & React$1.RefAttributes<HTMLButtonElement>, "ref"> & {
543
+ className?: string;
544
+ } & React$1.RefAttributes<HTMLButtonElement>>;
545
+
481
546
  declare const CurrencySymbolMap: Record<string, string>;
482
547
  interface FormatCurrencyOptions {
483
548
  convertToMajorCurrency?: boolean;
@@ -499,4 +564,4 @@ declare class DateAction {
499
564
 
500
565
  declare function cn(...inputs: ClassValue[]): string;
501
566
 
502
- export { AmountAction, Banner, Button, CopyableLabel, Country, CurrencySymbolMap, DateAction, DebouncedInput, DevBanner, Dialog, Drawer, DrawerClose, type DrawerPropsType, DrawerRoot, FlagComponent, FormLabel, type FormatCurrencyOptions, HasResourcePermission, Input, Loader, LocaleSelector, OTPInput, PageDataToolbar, Pagination, PasswordInput, PermissionsContext, PermissionsProvider, PhoneInput, Popover, PopoverContent, PopoverRoot, PopoverTrigger, type ResourcePermission, type ResourcePermissionProps, type ResourcePermissions, Select, Sidebar, Status, Table, type TablePaginationProps, Textarea, Tooltip, TooltipContent, TooltipProvider, TooltipRoot, TooltipTrigger, buttonVariants, cn, useHasPermission, usePermissions };
567
+ export { AmountAction, Banner, Button, CalendarInput, CopyableLabel, Country, CurrencySymbolMap, DateAction, DebouncedInput, DevBanner, Dialog, Drawer, DrawerClose, type DrawerPropsType, DrawerRoot, 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, Select, Sidebar, Status, Table, type TablePaginationProps, Textarea, Tooltip, TooltipContent, TooltipProvider, TooltipRoot, TooltipTrigger, buttonVariants, cn, useHasPermission, usePermissions };