@ctlyst.id/internal-ui 3.4.6 → 3.5.1

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.d.mts CHANGED
@@ -18,6 +18,7 @@ import { CreatableProps } from 'react-select/creatable';
18
18
  import { ToastOptions } from 'react-toastify';
19
19
  export { ToastContainer } from 'react-toastify';
20
20
  import { Id, ToastIcon } from 'react-toastify/dist/types';
21
+ import { FileError, FileRejection } from 'react-dropzone';
21
22
  import * as axios from 'axios';
22
23
  import { AxiosRequestConfig, AxiosInstance, AxiosResponse } from 'axios';
23
24
  export { id } from 'date-fns/locale';
@@ -811,6 +812,8 @@ type UploaderProps = FlexProps & {
811
812
  helperText?: string[] | ReactNode;
812
813
  value?: File | string;
813
814
  /**
815
+ * @deprecated since version 3.4.6
816
+ * will be removed in version 4
814
817
  * validate width x height dimension
815
818
  */
816
819
  dimension?: {
@@ -844,10 +847,13 @@ type UploaderProps = FlexProps & {
844
847
  message?: string;
845
848
  };
846
849
  /**
850
+ * @deprecated since version 3.4.6
851
+ * will be removed in version 4
847
852
  * Custom validation
848
853
  * custom validation will run first
849
854
  */
850
855
  customValidation?: (file: File, image: HTMLImageElement) => string | null;
856
+ validatorExt?: ((file: File) => FileError | FileError[] | null)[];
851
857
  isShowCloseButton?: boolean;
852
858
  isClosableToast?: boolean;
853
859
  isError?: boolean;
@@ -860,8 +866,31 @@ type UploaderProps = FlexProps & {
860
866
  isShowReupload?: boolean;
861
867
  size?: 'sm' | 'lg';
862
868
  };
869
+
863
870
  declare const Uploader: React__default.FC<UploaderProps>;
864
871
 
872
+ /**
873
+ * @param file
874
+ * @param dimension [[width, height]]
875
+ */
876
+ declare const dimensionValidator: (dimension: [number, number], message?: string) => (file: File) => FileError | null;
877
+
878
+ declare enum ErrorCode {
879
+ FileInvalidType = "file-invalid-type",
880
+ FileTooLarge = "file-too-large",
881
+ FileTooSmall = "file-too-small",
882
+ TooManyFiles = "too-many-files",
883
+ FileInvalidDimension = "file-invalid-dimension"
884
+ }
885
+
886
+ declare const defaultOnHandleRejections: (fileRejection: FileRejection[], config: Pick<UploaderProps, 'acceptFormat' | 'maxFileSize'>, handleRejection: (message: string, file: File, image: HTMLImageElement | null) => void) => void;
887
+
888
+ interface ImageRes {
889
+ width: number;
890
+ height: number;
891
+ }
892
+ declare const isRatioEqual: (base: ImageRes, img: ImageRes) => boolean;
893
+
865
894
  declare const createExtendTheme: (theme: Record<string, any>) => (...extensions: Array<Record<string, any> | ((theme: Record<string, any>) => Record<string, any>)>) => Record<string, any>;
866
895
  declare const getTheme: (foundations: Record<string, any>) => Record<string, any>;
867
896
  declare const theme: Record<string, any>;
@@ -887,4 +916,4 @@ declare const ProviderContext: React__default.Context<ProviderContextObject>;
887
916
  declare const useInternalUI: () => ProviderContextObject;
888
917
  declare const Provider: FC<ProviderProps>;
889
918
 
890
- export { AccordionEye, AccordionIndicator, Alert, AlertAction, type AlertActionProps, AlertClose, type AlertCloseProps, AlertDescription, type AlertDescriptionProps, AlertIcon, type AlertIconProps, type AlertProps, type AlertStatus, AlertTitle, type AlertTitleProps, Anchor, type AnchorProps, Badge, type BadgeProps, BreadCrumb, type BreadCrumbParentProps, type BreadCrumbProps, Button, type ButtonProps, CHECKBOX_STATE, CardCustom as Card, type CardProps, CheckboxComponent as Checkbox, type CheckboxComponentProps, CheckboxGroupComponent as CheckboxGroup, type CheckboxGroupComponentProps, Chips, type ChipsProps, ClearIndicator, Counter, type CustomLoaderProps, _default as DataTable, type DataTableProps, type DataTableRefs, DatePickerMonth, type DatePickerMonthProps, Datepicker, type DatepickerProps, Dialog, type DisabledRowData, DropdownIndicator, EmptyState, type Environment, Field, type FieldProps, Header, type HeaderDataProps, type HeaderProps, InputAddonLeft, InputAddonRight, InputField, type InputFieldProps, Loader, type LoaderProps, Logo, type LogoProps, Navigation as MainMenu, ModalBackButton, MultiDatePickerMonth, type MultiDatePickerMonthProps, MultiValue, MultiValueRemove, NavItem, type NavItemProps, Navbar, type NavbarProps, NavigationBar, type NavigationBarProps, type NavigationProps, NoOptionsMessage, type OptionGroup, type OptionMultiGroup, type OptionsGroup, Pagination, PaginationDetail, type PaginationDetailProps, PaginationFilter, type PaginationFilterProps, type PaginationProps, Profile, type ProfileProps, type Props, Provider, ProviderContext, Radio, RadioGroup, type RadioGroupComponentProps, type RadioProps, Rating, type RatingProps, Select, SelectAsync, SelectAsyncCreatable, type SelectAsyncCreatableProps, type SelectAsyncProps, SelectCheckbox as SelectCheckBox, SelectCreatable, type SelectCreatableProps, type SelectProps, type SelectWithCheckboxBaseProps, Sidebar, SidebarHeader, type SidebarHeaderProps, SidebarMenu, type SidebarMenuProps, type SidebarProps, Switch, type SwitchProps, Tab, type TableStyleProps, type TextAreaProps, TextareaField, type Theme, Time, TimeInput, type TimeInputProps, type TimeOptions, Tooltip, type TooltipProps, Uploader, type UploaderProps, Version, type VersionProps, VoilaLogo, XMSLogo, createExtendTheme, getSelectAllCheckboxState, getTheme, isCellDisabled, selectStyles, theme, themeSelect, useAlertStyles, useDataTable, useFetcher, useInternalUI, useToast };
919
+ export { AccordionEye, AccordionIndicator, Alert, AlertAction, type AlertActionProps, AlertClose, type AlertCloseProps, AlertDescription, type AlertDescriptionProps, AlertIcon, type AlertIconProps, type AlertProps, type AlertStatus, AlertTitle, type AlertTitleProps, Anchor, type AnchorProps, Badge, type BadgeProps, BreadCrumb, type BreadCrumbParentProps, type BreadCrumbProps, Button, type ButtonProps, CHECKBOX_STATE, CardCustom as Card, type CardProps, CheckboxComponent as Checkbox, type CheckboxComponentProps, CheckboxGroupComponent as CheckboxGroup, type CheckboxGroupComponentProps, Chips, type ChipsProps, ClearIndicator, Counter, type CustomLoaderProps, _default as DataTable, type DataTableProps, type DataTableRefs, DatePickerMonth, type DatePickerMonthProps, Datepicker, type DatepickerProps, Dialog, type DisabledRowData, DropdownIndicator, EmptyState, type Environment, ErrorCode, Field, type FieldProps, Header, type HeaderDataProps, type HeaderProps, InputAddonLeft, InputAddonRight, InputField, type InputFieldProps, Loader, type LoaderProps, Logo, type LogoProps, Navigation as MainMenu, ModalBackButton, MultiDatePickerMonth, type MultiDatePickerMonthProps, MultiValue, MultiValueRemove, NavItem, type NavItemProps, Navbar, type NavbarProps, NavigationBar, type NavigationBarProps, type NavigationProps, NoOptionsMessage, type OptionGroup, type OptionMultiGroup, type OptionsGroup, Pagination, PaginationDetail, type PaginationDetailProps, PaginationFilter, type PaginationFilterProps, type PaginationProps, Profile, type ProfileProps, type Props, Provider, ProviderContext, Radio, RadioGroup, type RadioGroupComponentProps, type RadioProps, Rating, type RatingProps, Select, SelectAsync, SelectAsyncCreatable, type SelectAsyncCreatableProps, type SelectAsyncProps, SelectCheckbox as SelectCheckBox, SelectCreatable, type SelectCreatableProps, type SelectProps, type SelectWithCheckboxBaseProps, Sidebar, SidebarHeader, type SidebarHeaderProps, SidebarMenu, type SidebarMenuProps, type SidebarProps, Switch, type SwitchProps, Tab, type TableStyleProps, type TextAreaProps, TextareaField, type Theme, Time, TimeInput, type TimeInputProps, type TimeOptions, Tooltip, type TooltipProps, Uploader, type UploaderProps, Version, type VersionProps, VoilaLogo, XMSLogo, createExtendTheme, defaultOnHandleRejections, dimensionValidator, getSelectAllCheckboxState, getTheme, isCellDisabled, isRatioEqual, selectStyles, theme, themeSelect, useAlertStyles, useDataTable, useFetcher, useInternalUI, useToast };
package/dist/index.d.ts CHANGED
@@ -18,6 +18,7 @@ import { CreatableProps } from 'react-select/creatable';
18
18
  import { ToastOptions } from 'react-toastify';
19
19
  export { ToastContainer } from 'react-toastify';
20
20
  import { Id, ToastIcon } from 'react-toastify/dist/types';
21
+ import { FileError, FileRejection } from 'react-dropzone';
21
22
  import * as axios from 'axios';
22
23
  import { AxiosRequestConfig, AxiosInstance, AxiosResponse } from 'axios';
23
24
  export { id } from 'date-fns/locale';
@@ -811,6 +812,8 @@ type UploaderProps = FlexProps & {
811
812
  helperText?: string[] | ReactNode;
812
813
  value?: File | string;
813
814
  /**
815
+ * @deprecated since version 3.4.6
816
+ * will be removed in version 4
814
817
  * validate width x height dimension
815
818
  */
816
819
  dimension?: {
@@ -844,10 +847,13 @@ type UploaderProps = FlexProps & {
844
847
  message?: string;
845
848
  };
846
849
  /**
850
+ * @deprecated since version 3.4.6
851
+ * will be removed in version 4
847
852
  * Custom validation
848
853
  * custom validation will run first
849
854
  */
850
855
  customValidation?: (file: File, image: HTMLImageElement) => string | null;
856
+ validatorExt?: ((file: File) => FileError | FileError[] | null)[];
851
857
  isShowCloseButton?: boolean;
852
858
  isClosableToast?: boolean;
853
859
  isError?: boolean;
@@ -860,8 +866,31 @@ type UploaderProps = FlexProps & {
860
866
  isShowReupload?: boolean;
861
867
  size?: 'sm' | 'lg';
862
868
  };
869
+
863
870
  declare const Uploader: React__default.FC<UploaderProps>;
864
871
 
872
+ /**
873
+ * @param file
874
+ * @param dimension [[width, height]]
875
+ */
876
+ declare const dimensionValidator: (dimension: [number, number], message?: string) => (file: File) => FileError | null;
877
+
878
+ declare enum ErrorCode {
879
+ FileInvalidType = "file-invalid-type",
880
+ FileTooLarge = "file-too-large",
881
+ FileTooSmall = "file-too-small",
882
+ TooManyFiles = "too-many-files",
883
+ FileInvalidDimension = "file-invalid-dimension"
884
+ }
885
+
886
+ declare const defaultOnHandleRejections: (fileRejection: FileRejection[], config: Pick<UploaderProps, 'acceptFormat' | 'maxFileSize'>, handleRejection: (message: string, file: File, image: HTMLImageElement | null) => void) => void;
887
+
888
+ interface ImageRes {
889
+ width: number;
890
+ height: number;
891
+ }
892
+ declare const isRatioEqual: (base: ImageRes, img: ImageRes) => boolean;
893
+
865
894
  declare const createExtendTheme: (theme: Record<string, any>) => (...extensions: Array<Record<string, any> | ((theme: Record<string, any>) => Record<string, any>)>) => Record<string, any>;
866
895
  declare const getTheme: (foundations: Record<string, any>) => Record<string, any>;
867
896
  declare const theme: Record<string, any>;
@@ -887,4 +916,4 @@ declare const ProviderContext: React__default.Context<ProviderContextObject>;
887
916
  declare const useInternalUI: () => ProviderContextObject;
888
917
  declare const Provider: FC<ProviderProps>;
889
918
 
890
- export { AccordionEye, AccordionIndicator, Alert, AlertAction, type AlertActionProps, AlertClose, type AlertCloseProps, AlertDescription, type AlertDescriptionProps, AlertIcon, type AlertIconProps, type AlertProps, type AlertStatus, AlertTitle, type AlertTitleProps, Anchor, type AnchorProps, Badge, type BadgeProps, BreadCrumb, type BreadCrumbParentProps, type BreadCrumbProps, Button, type ButtonProps, CHECKBOX_STATE, CardCustom as Card, type CardProps, CheckboxComponent as Checkbox, type CheckboxComponentProps, CheckboxGroupComponent as CheckboxGroup, type CheckboxGroupComponentProps, Chips, type ChipsProps, ClearIndicator, Counter, type CustomLoaderProps, _default as DataTable, type DataTableProps, type DataTableRefs, DatePickerMonth, type DatePickerMonthProps, Datepicker, type DatepickerProps, Dialog, type DisabledRowData, DropdownIndicator, EmptyState, type Environment, Field, type FieldProps, Header, type HeaderDataProps, type HeaderProps, InputAddonLeft, InputAddonRight, InputField, type InputFieldProps, Loader, type LoaderProps, Logo, type LogoProps, Navigation as MainMenu, ModalBackButton, MultiDatePickerMonth, type MultiDatePickerMonthProps, MultiValue, MultiValueRemove, NavItem, type NavItemProps, Navbar, type NavbarProps, NavigationBar, type NavigationBarProps, type NavigationProps, NoOptionsMessage, type OptionGroup, type OptionMultiGroup, type OptionsGroup, Pagination, PaginationDetail, type PaginationDetailProps, PaginationFilter, type PaginationFilterProps, type PaginationProps, Profile, type ProfileProps, type Props, Provider, ProviderContext, Radio, RadioGroup, type RadioGroupComponentProps, type RadioProps, Rating, type RatingProps, Select, SelectAsync, SelectAsyncCreatable, type SelectAsyncCreatableProps, type SelectAsyncProps, SelectCheckbox as SelectCheckBox, SelectCreatable, type SelectCreatableProps, type SelectProps, type SelectWithCheckboxBaseProps, Sidebar, SidebarHeader, type SidebarHeaderProps, SidebarMenu, type SidebarMenuProps, type SidebarProps, Switch, type SwitchProps, Tab, type TableStyleProps, type TextAreaProps, TextareaField, type Theme, Time, TimeInput, type TimeInputProps, type TimeOptions, Tooltip, type TooltipProps, Uploader, type UploaderProps, Version, type VersionProps, VoilaLogo, XMSLogo, createExtendTheme, getSelectAllCheckboxState, getTheme, isCellDisabled, selectStyles, theme, themeSelect, useAlertStyles, useDataTable, useFetcher, useInternalUI, useToast };
919
+ export { AccordionEye, AccordionIndicator, Alert, AlertAction, type AlertActionProps, AlertClose, type AlertCloseProps, AlertDescription, type AlertDescriptionProps, AlertIcon, type AlertIconProps, type AlertProps, type AlertStatus, AlertTitle, type AlertTitleProps, Anchor, type AnchorProps, Badge, type BadgeProps, BreadCrumb, type BreadCrumbParentProps, type BreadCrumbProps, Button, type ButtonProps, CHECKBOX_STATE, CardCustom as Card, type CardProps, CheckboxComponent as Checkbox, type CheckboxComponentProps, CheckboxGroupComponent as CheckboxGroup, type CheckboxGroupComponentProps, Chips, type ChipsProps, ClearIndicator, Counter, type CustomLoaderProps, _default as DataTable, type DataTableProps, type DataTableRefs, DatePickerMonth, type DatePickerMonthProps, Datepicker, type DatepickerProps, Dialog, type DisabledRowData, DropdownIndicator, EmptyState, type Environment, ErrorCode, Field, type FieldProps, Header, type HeaderDataProps, type HeaderProps, InputAddonLeft, InputAddonRight, InputField, type InputFieldProps, Loader, type LoaderProps, Logo, type LogoProps, Navigation as MainMenu, ModalBackButton, MultiDatePickerMonth, type MultiDatePickerMonthProps, MultiValue, MultiValueRemove, NavItem, type NavItemProps, Navbar, type NavbarProps, NavigationBar, type NavigationBarProps, type NavigationProps, NoOptionsMessage, type OptionGroup, type OptionMultiGroup, type OptionsGroup, Pagination, PaginationDetail, type PaginationDetailProps, PaginationFilter, type PaginationFilterProps, type PaginationProps, Profile, type ProfileProps, type Props, Provider, ProviderContext, Radio, RadioGroup, type RadioGroupComponentProps, type RadioProps, Rating, type RatingProps, Select, SelectAsync, SelectAsyncCreatable, type SelectAsyncCreatableProps, type SelectAsyncProps, SelectCheckbox as SelectCheckBox, SelectCreatable, type SelectCreatableProps, type SelectProps, type SelectWithCheckboxBaseProps, Sidebar, SidebarHeader, type SidebarHeaderProps, SidebarMenu, type SidebarMenuProps, type SidebarProps, Switch, type SwitchProps, Tab, type TableStyleProps, type TextAreaProps, TextareaField, type Theme, Time, TimeInput, type TimeInputProps, type TimeOptions, Tooltip, type TooltipProps, Uploader, type UploaderProps, Version, type VersionProps, VoilaLogo, XMSLogo, createExtendTheme, defaultOnHandleRejections, dimensionValidator, getSelectAllCheckboxState, getTheme, isCellDisabled, isRatioEqual, selectStyles, theme, themeSelect, useAlertStyles, useDataTable, useFetcher, useInternalUI, useToast };