dfh-ui-library 1.3.12 → 1.3.13

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,8 +1,14 @@
1
1
  import React from "react";
2
- import { ColumnDef, OnChangeFn, SortingState } from "@tanstack/react-table";
3
- export declare function Table({ data, columns, sorting, setSorting, }: {
2
+ import { ColumnDef, OnChangeFn, SortingState, PaginationState } from "@tanstack/react-table";
3
+ import { PaginationProps } from "../../shared/models/components/common.model";
4
+ export declare function Table({ data, columns, sorting, onSortingChange, pagination, onPaginationChange, totalRecords, isManualPagination, isManualSorting, }: {
4
5
  data: any[];
5
6
  columns: ColumnDef<any>[];
6
7
  sorting?: any;
7
- setSorting?: OnChangeFn<SortingState> | undefined;
8
+ onSortingChange?: OnChangeFn<SortingState> | undefined;
9
+ pagination?: PaginationProps;
10
+ onPaginationChange?: OnChangeFn<PaginationState> | undefined;
11
+ totalRecords?: number;
12
+ isManualPagination?: boolean;
13
+ isManualSorting?: boolean;
8
14
  }): React.JSX.Element;
@@ -0,0 +1,23 @@
1
+ export declare function mockAPI({ pagination: { limit, skip }, sort: { field, order }, }?: {
2
+ pagination?: {
3
+ limit?: number | undefined;
4
+ skip?: number | undefined;
5
+ } | undefined;
6
+ sort?: {
7
+ field?: string | undefined;
8
+ order?: string | undefined;
9
+ } | undefined;
10
+ }): {
11
+ res: Promise<unknown>;
12
+ abort: () => void;
13
+ };
14
+ export declare function useMockAPI(query?: string, { pagination: { limit, skip }, sort: { field, order }, }?: {
15
+ pagination?: {
16
+ limit?: number | undefined;
17
+ skip?: number | undefined;
18
+ } | undefined;
19
+ sort?: {
20
+ field?: string | undefined;
21
+ order?: string | undefined;
22
+ } | undefined;
23
+ }): (number | boolean | never[])[];
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ export declare function usePagination(): {
3
+ limit: number;
4
+ onPaginationChange: import("react").Dispatch<import("react").SetStateAction<{
5
+ pageSize: number;
6
+ pageIndex: number;
7
+ }>>;
8
+ pagination: {
9
+ pageSize: number;
10
+ pageIndex: number;
11
+ };
12
+ skip: number;
13
+ };
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ export declare function useSorting(initialField?: string, initialOrder?: string): {
3
+ sorting: {
4
+ id: string;
5
+ desc: boolean;
6
+ }[];
7
+ onSortingChange: import("react").Dispatch<import("react").SetStateAction<{
8
+ id: string;
9
+ desc: boolean;
10
+ }[]>>;
11
+ order: string;
12
+ field: string;
13
+ };
@@ -9,3 +9,5 @@ export { DropdownSearchProps } from "./shared/models/components/common.model";
9
9
  export { BtnOptionDropdown } from "./shared/models/components/common.model";
10
10
  export { OptionProps } from "./shared/models/components/common.model";
11
11
  export { ColumnDef, SortingState } from "@tanstack/react-table";
12
+ export { usePagination } from "./hooks/usePagination";
13
+ export { useSorting } from "./hooks/useSorting";
@@ -304,3 +304,7 @@ export interface ButtonGroupProps {
304
304
  isAdditionalErrorInput?: boolean;
305
305
  additionalErrorClasses?: string;
306
306
  }
307
+ export interface PaginationProps {
308
+ pageSize: number;
309
+ pageIndex: number;
310
+ }
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
- import React$1, { InputHTMLAttributes, SelectHTMLAttributes, TextareaHTMLAttributes, FC, ReactNode } from 'react';
2
- import { ColumnDef, OnChangeFn, SortingState } from '@tanstack/react-table';
1
+ /// <reference types="react" />
2
+ import * as React$1 from 'react';
3
+ import React__default, { InputHTMLAttributes, SelectHTMLAttributes, TextareaHTMLAttributes, FC, ReactNode } from 'react';
4
+ import { ColumnDef, OnChangeFn, SortingState, PaginationState } from '@tanstack/react-table';
3
5
  export { ColumnDef, SortingState } from '@tanstack/react-table';
4
6
 
5
7
  type AlignmentType = "center" | "left" | "right";
@@ -266,6 +268,10 @@ interface ButtonGroupProps {
266
268
  isAdditionalErrorInput?: boolean;
267
269
  additionalErrorClasses?: string;
268
270
  }
271
+ interface PaginationProps {
272
+ pageSize: number;
273
+ pageIndex: number;
274
+ }
269
275
 
270
276
  type VariantTypes = "large" | "small" | "extraSmall" | "largeOutlined" | "smallOutlined" | "extraSmallOutlined" | "default" | "defaultOutlined" | "primaryBlue" | "primaryWhite" | "primaryWhiteSelected" | "primaryWhiteNoBoader" | undefined;
271
277
  interface IButtonProps extends IChildrenProp, IAdditionalClassesProp, IIconTypeProp, IOnClickEventProps {
@@ -622,19 +628,19 @@ interface TooltipProps {
622
628
  showTooltip?: boolean;
623
629
  }
624
630
 
625
- declare const Button: ({ type, isDisabled, buttonLabel, iconType, iconColor, iconAlignment, isIconEnabled, variants, additionalClasses, iconClass, onClick, }: IButtonProps) => React$1.JSX.Element;
631
+ declare const Button: ({ type, isDisabled, buttonLabel, iconType, iconColor, iconAlignment, isIconEnabled, variants, additionalClasses, iconClass, onClick, }: IButtonProps) => React__default.JSX.Element;
626
632
 
627
633
  /**
628
634
  * Primary UI component
629
635
  */
630
- declare const Typhography: ({ type, component, color, additionalClasses, children, onClick, ...rest }: ITyphographyProps) => React$1.JSX.Element;
636
+ declare const Typhography: ({ type, component, color, additionalClasses, children, onClick, ...rest }: ITyphographyProps) => React__default.JSX.Element;
631
637
 
632
- declare const Checkbox: React$1.FC<ICheckboxProps>;
638
+ declare const Checkbox: React__default.FC<ICheckboxProps>;
633
639
 
634
640
  /**
635
641
  * Primary UI component for user interaction
636
642
  */
637
- declare const InputValidation: React$1.FC<IInputValidationProps>;
643
+ declare const InputValidation: React__default.FC<IInputValidationProps>;
638
644
 
639
645
  /**
640
646
  * Primary UI component for user interaction
@@ -644,79 +650,79 @@ declare const Input: FC<IHookFormsInputProps>;
644
650
  /**
645
651
  * Primary UI component for user interaction
646
652
  */
647
- declare const Label: React$1.FC<ILabelProps>;
653
+ declare const Label: React__default.FC<ILabelProps>;
648
654
 
649
655
  /**
650
656
  * Primary UI component for user interaction
651
657
  */
652
- declare const Select: React$1.FC<ISelectProps>;
658
+ declare const Select: React__default.FC<ISelectProps>;
653
659
 
654
660
  /**
655
661
  * Primary UI component for user interaction
656
662
  */
657
- declare const RadioButton: React$1.FC<IRadioProps>;
663
+ declare const RadioButton: React__default.FC<IRadioProps>;
658
664
 
659
665
  /**
660
666
  * Primary UI component for user interaction
661
667
  */
662
- declare const Textarea: React$1.FC<IInputProps>;
668
+ declare const Textarea: React__default.FC<IInputProps>;
663
669
 
664
670
  /**
665
671
  * Primary UI component for user interaction
666
672
  */
667
673
  declare const IconInput: FC<IHookFormsInputProps>;
668
674
 
669
- declare const ImageInput: React$1.FC<ImageInputProps>;
675
+ declare const ImageInput: React__default.FC<ImageInputProps>;
670
676
 
671
677
  /**
672
678
  * Primary UI component for user interaction
673
679
  */
674
- declare const Card: React$1.FC<ICardProps>;
680
+ declare const Card: React__default.FC<ICardProps>;
675
681
 
676
682
  interface IComponentProps {
677
683
  schema: ISchema[];
678
684
  children: ReactNode;
679
685
  setComponents: (data: IComponent[]) => void;
680
686
  }
681
- declare function DFHFormProvider({ schema, children, setComponents }: IComponentProps): React$1.JSX.Element;
687
+ declare function DFHFormProvider({ schema, children, setComponents }: IComponentProps): React__default.JSX.Element;
682
688
 
683
689
  /**
684
690
  * Primary UI component for user interaction
685
691
  *
686
692
  * Use SVG for Logo
687
693
  */
688
- declare const Logo: React$1.FC<LogoProps>;
694
+ declare const Logo: React__default.FC<LogoProps>;
689
695
 
690
- declare const LoadingSpinner: React$1.FC<AdditionalClassesProp$1>;
696
+ declare const LoadingSpinner: React__default.FC<AdditionalClassesProp$1>;
691
697
 
692
- declare const NavBar: ({ navigationData, additionalClasses, navItemClick, isEnableLogout, handleLogout, userImage, }: TabNavigationProps) => React$1.JSX.Element;
698
+ declare const NavBar: ({ navigationData, additionalClasses, navItemClick, isEnableLogout, handleLogout, userImage, }: TabNavigationProps) => React__default.JSX.Element;
693
699
 
694
- declare const Message: ({ type, text }: MessageProps) => React$1.JSX.Element | undefined;
700
+ declare const Message: ({ type, text }: MessageProps) => React__default.JSX.Element | undefined;
695
701
 
696
- declare const Breadcrumb: React$1.FC<BreadcrumbProps>;
702
+ declare const Breadcrumb: React__default.FC<BreadcrumbProps>;
697
703
 
698
- declare const ImagePreview: React$1.FC<ImagePreviewProps>;
704
+ declare const ImagePreview: React__default.FC<ImagePreviewProps>;
699
705
 
700
- declare const CustomDatePicker: React$1.FC<CustomDatePickerProps>;
706
+ declare const CustomDatePicker: React__default.FC<CustomDatePickerProps>;
701
707
 
702
708
  interface RowProps {
703
- children: React$1.ReactNode;
709
+ children: React__default.ReactNode;
704
710
  additionalClasses?: string;
705
711
  }
706
- declare const Row: React$1.FC<RowProps>;
712
+ declare const Row: React__default.FC<RowProps>;
707
713
 
708
- declare const PhoneNumberInput: React$1.FC<PhoneNumberInputProps>;
714
+ declare const PhoneNumberInput: React__default.FC<PhoneNumberInputProps>;
709
715
 
710
716
  /**
711
717
  * Primary UI component for Tooltip
712
718
  */
713
- declare const Tooltip: React$1.FC<TooltipProps>;
719
+ declare const Tooltip: React__default.FC<TooltipProps>;
714
720
 
715
- declare const DialogBox: React$1.FC<DialogBoxProps>;
721
+ declare const DialogBox: React__default.FC<DialogBoxProps>;
716
722
 
717
- declare const Modal: React$1.FC<ModalProps>;
723
+ declare const Modal: React__default.FC<ModalProps>;
718
724
 
719
- declare const CustomFileInput: React$1.FC<CustomFileInputProps>;
725
+ declare const CustomFileInput: React__default.FC<CustomFileInputProps>;
720
726
 
721
727
  interface HeadingProps {
722
728
  /**
@@ -739,13 +745,13 @@ interface HeadingProps {
739
745
  /**
740
746
  * Primary UI component for user interaction
741
747
  */
742
- declare const Heading: React$1.FC<HeadingProps>;
748
+ declare const Heading: React__default.FC<HeadingProps>;
743
749
 
744
- declare const TagSelect: React$1.FC<DropdownMultiselectProps>;
750
+ declare const TagSelect: React__default.FC<DropdownMultiselectProps>;
745
751
 
746
- declare const SearchDropdownWithButton: React$1.FC<DropdownSearchProps>;
752
+ declare const SearchDropdownWithButton: React__default.FC<DropdownSearchProps>;
747
753
 
748
- declare const ButtonGroup: React$1.FC<ButtonGroupProps>;
754
+ declare const ButtonGroup: React__default.FC<ButtonGroupProps>;
749
755
 
750
756
  /**
751
757
  * Primary UI component for user interaction
@@ -754,14 +760,19 @@ declare const ButtonGroup: React$1.FC<ButtonGroupProps>;
754
760
  *
755
761
  * File Path : "src/components/core/Media/Icons/Icons.tsx"
756
762
  */
757
- declare const Icon: React$1.FC<IIconProps>;
763
+ declare const Icon: React__default.FC<IIconProps>;
758
764
 
759
- declare function Table({ data, columns, sorting, setSorting, }: {
765
+ declare function Table({ data, columns, sorting, onSortingChange, pagination, onPaginationChange, totalRecords, isManualPagination, isManualSorting, }: {
760
766
  data: any[];
761
767
  columns: ColumnDef<any>[];
762
768
  sorting?: any;
763
- setSorting?: OnChangeFn<SortingState> | undefined;
764
- }): React$1.JSX.Element;
769
+ onSortingChange?: OnChangeFn<SortingState> | undefined;
770
+ pagination?: PaginationProps;
771
+ onPaginationChange?: OnChangeFn<PaginationState> | undefined;
772
+ totalRecords?: number;
773
+ isManualPagination?: boolean;
774
+ isManualSorting?: boolean;
775
+ }): React__default.JSX.Element;
765
776
 
766
777
  interface UseSchemaProcessorProps {
767
778
  schema: ISchema[];
@@ -771,4 +782,30 @@ declare const useSchemaProcessor: ({ schema, externalSetComponents, }: UseSchema
771
782
  componentsRtn: IComponent[] | undefined;
772
783
  };
773
784
 
774
- export { Breadcrumb, type BtnOptionDropdown, Button, ButtonGroup, Card, Checkbox as CheckBox, DFHFormProvider as ComponentProvider, CustomFileInput, CustomDatePicker as DatePicker, DialogBox, type DropdownSearchProps, Heading, Icon, IconInput, ImageInput, ImagePreview, Input, type InputType, InputValidation, Label, LoadingSpinner, Logo, type LogoProps, Message, type MessageProps, Modal, NavBar, type OptionProps, PhoneNumberInput, RadioButton, Row, SearchDropdownWithButton, Select, Table, TagSelect as TagDropdown, TagSelect, Textarea, Tooltip, Typhography, useSchemaProcessor as UseSchemaProcessor, type VariantTypes };
785
+ declare function usePagination(): {
786
+ limit: number;
787
+ onPaginationChange: React$1.Dispatch<React$1.SetStateAction<{
788
+ pageSize: number;
789
+ pageIndex: number;
790
+ }>>;
791
+ pagination: {
792
+ pageSize: number;
793
+ pageIndex: number;
794
+ };
795
+ skip: number;
796
+ };
797
+
798
+ declare function useSorting(initialField?: string, initialOrder?: string): {
799
+ sorting: {
800
+ id: string;
801
+ desc: boolean;
802
+ }[];
803
+ onSortingChange: React$1.Dispatch<React$1.SetStateAction<{
804
+ id: string;
805
+ desc: boolean;
806
+ }[]>>;
807
+ order: string;
808
+ field: string;
809
+ };
810
+
811
+ export { Breadcrumb, type BtnOptionDropdown, Button, ButtonGroup, Card, Checkbox as CheckBox, DFHFormProvider as ComponentProvider, CustomFileInput, CustomDatePicker as DatePicker, DialogBox, type DropdownSearchProps, Heading, Icon, IconInput, ImageInput, ImagePreview, Input, type InputType, InputValidation, Label, LoadingSpinner, Logo, type LogoProps, Message, type MessageProps, Modal, NavBar, type OptionProps, PhoneNumberInput, RadioButton, Row, SearchDropdownWithButton, Select, Table, TagSelect as TagDropdown, TagSelect, Textarea, Tooltip, Typhography, useSchemaProcessor as UseSchemaProcessor, type VariantTypes, usePagination, useSorting };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dfh-ui-library",
3
- "version": "1.3.12",
3
+ "version": "1.3.13",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "rollup": "rollup -c --bundleConfigAsCjs --environment NODE_ENV:production",