Skip to content

Commit

Permalink
refactor: code refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
PKulkoRaccoonGang committed Apr 12, 2023
1 parent de201e9 commit aae4443
Show file tree
Hide file tree
Showing 109 changed files with 652 additions and 682 deletions.
9 changes: 3 additions & 6 deletions src/Carousel/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@ import { CarouselProps as BaseCarouselProps } from 'react-bootstrap/Carousel';
import { CarouselItemProps as BaseCarouselItemProps } from 'react-bootstrap/CarouselItem';
import { BsPrefixProps } from 'react-bootstrap/helpers';

export const CAROUSEL_NEXT_LABEL_TEXT: string;
export const CAROUSEL_PREV_LABEL_TEXT: string;
export interface CarouselProps extends BaseCarouselProps {}

declare interface CarouselProps extends BaseCarouselProps {}
export interface CarouselItemProps extends BaseCarouselItemProps {}

declare interface CarouselItemProps extends BaseCarouselItemProps {}

declare interface CarouselCaptionProps extends BsPrefixProps {}
export interface CarouselCaptionProps extends BsPrefixProps {}

declare const Carousel: React.ForwardRefExoticComponent<CarouselProps> & {
Item: React.ForwardRefExoticComponent<CarouselItemProps>;
Expand Down
3 changes: 2 additions & 1 deletion src/Collapsible/CollapsibleTrigger.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ import React from 'react';

export interface CollapsibleTriggerProps {
children?: React.ReactNode;
tag?: React.ElementType | string;
tag?: keyof JSX.IntrinsicElements | string;
openOnly?: boolean;
closeOnly?: boolean;
onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;
onKeyDown?: (e: React.KeyboardEvent<HTMLDivElement>) => void;
}

declare const CollapsibleTrigger: React.FC<CollapsibleTriggerProps>;

export default CollapsibleTrigger;
1 change: 1 addition & 0 deletions src/Collapsible/CollapsibleVisible.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ export interface CollapsibleVisibleProps {
}

declare const CollapsibleVisible: React.FC<CollapsibleVisibleProps>;

export default CollapsibleVisible;
2 changes: 1 addition & 1 deletion src/Collapsible/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export interface CollapsibleProps {
unmountOnExit?: boolean;
}

declare const Collapsible: React.ForwardRefExoticComponent<CollapsibleProps & React.RefAttributes<HTMLDivElement>> & {
declare const Collapsible: React.ForwardRefExoticComponent<CollapsibleProps> & {
Advanced: React.FC<CollapsibleAdvancedProps>;
Body: React.FC<CollapsibleBodyProps>;
Trigger: React.FC<CollapsibleTriggerProps>;
Expand Down
4 changes: 2 additions & 2 deletions src/Container/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import { ContainerProps as BaseContainerProps } from 'react-bootstrap/Container';
import { BsPrefixProps } from 'react-bootstrap/helpers';

export interface ContainerProps extends BaseContainerProps {
as?: keyof JSX.IntrinsicElements;
export interface ContainerProps extends BsPrefixProps, BaseContainerProps {
children?: React.ReactNode;
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
}
Expand Down
16 changes: 3 additions & 13 deletions src/DataTable/CardView.d.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
import React from 'react';
import PropTypes from "prop-types";

// export interface CardItemProps<T> {
// row: T,
// prepareRow: (row: T) => void;
// isSelectable: boolean;
// CardComponent: React.FC<{ row: T }>ж
// SelectionComponent?: PropTypes.func,
// selectionPlacement: 'right' | 'left',
// }

export interface CardViewProps<T> {
export interface CardViewProps {
className?: string;
columnSizes?: {
xs?: number;
Expand All @@ -19,13 +9,13 @@ export interface CardViewProps<T> {
lg?: number;
xl?: number;
};
CardComponent: React.FC<T>;
CardComponent: React.FC;
selectionPlacement?: 'left' | 'right';
SkeletonCardComponent?: React.FC;
skeletonCardCount?: number;
}

declare function CardView<T>(props: CardViewProps<T>): JSX.Element;
declare function CardView<T>(props: CardViewProps): JSX.Element;

export default CardView;

4 changes: 1 addition & 3 deletions src/DataTable/CollapsibleButtonGroup.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';

export interface CollapsibleButtonGroupProps {
className?: string | null;
className?: string;
actions: {
component: React.ReactNode;
args?: Record<string, any>;
Expand All @@ -11,5 +11,3 @@ export interface CollapsibleButtonGroupProps {
declare const CollapsibleButtonGroup: React.FC<CollapsibleButtonGroupProps>;

export default CollapsibleButtonGroup;


2 changes: 0 additions & 2 deletions src/DataTable/DataTableLayout.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,3 @@ export interface DataTableLayoutProps {
declare const DataTableLayout: React.FC<DataTableLayoutProps>;

export default DataTableLayout;


2 changes: 0 additions & 2 deletions src/DataTable/EmptyTable.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,3 @@ export interface EmptyTableProps {
declare const EmptyTable: React.FC<EmptyTableProps>;

export default EmptyTable;


1 change: 0 additions & 1 deletion src/DataTable/ExplandRow.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ export interface ExpandRowProps {
declare function ExpandRow(props: ExpandRowProps): JSX.Element;

export default ExpandRow;

1 change: 0 additions & 1 deletion src/DataTable/FilterStatus.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ export interface FilterStatusProps {
declare function FilterStatus(props: FilterStatusProps): JSX.Element;

export default FilterStatus;

1 change: 0 additions & 1 deletion src/DataTable/RowStatus.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ export interface RowStatusProps {
declare function RowStatus(props: RowStatusProps): JSX.Element;

export default RowStatus;

1 change: 0 additions & 1 deletion src/DataTable/Table.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ export interface TableProps {
declare function Table(props: TableProps): JSX.Element;

export default Table;

1 change: 0 additions & 1 deletion src/DataTable/TableCell.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ export interface TableCellProps {
declare function TableCell(props: TableCellProps): JSX.Element;

export default TableCell;

1 change: 0 additions & 1 deletion src/DataTable/TableControlBar.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ export interface TableControlBarProps {
declare const TableControlBar: React.FC<TableControlBarProps>;

export default TableControlBar;

4 changes: 1 addition & 3 deletions src/DataTable/TableRow.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
interface TableRowProps {
export interface TableRowProps {
row: {
getRowProps: (props?: any) => any;
cells: object[];
Expand All @@ -11,5 +11,3 @@ interface TableRowProps {
declare function TableRow({ row }: TableRowProps): JSX.Element;

export default TableRow;


1 change: 1 addition & 0 deletions src/DataTable/filters/CheckboxFilters.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ export interface CheckboxFiltersProps {
}

declare const CheckboxFilter: React.FC<CheckboxFiltersProps>;

export default CheckboxFilter;
10 changes: 4 additions & 6 deletions src/DataTable/selection/SelectionStatus.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import React from 'react';
import { ControlledSelectionStatusProps } from './ControlledSelectionStatus';

export interface ControlledSelectionStatusProps {
className?: string;
clearSelectionText?: string | JSX.Element;
}
export interface SelectionStatusProps extends ControlledSelectionStatusProps {}

declare const ControlledSelectionStatus: React.FC<ControlledSelectionStatusProps>;
declare const SelectionStatus: React.FC<SelectionStatusProps>;

export default ControlledSelectionStatus;
export default SelectionStatus;
15 changes: 8 additions & 7 deletions src/Dropdown/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { BsPrefixProps, BsPrefixRefForwardingComponent } from 'react-bootstrap/helpers';
import { BsPrefixProps } from 'react-bootstrap/helpers';
import BaseDropdown, { DropdownProps as BaseDropdownProps } from 'react-bootstrap/Dropdown';
import { DropdownToggleProps as BaseDropdownToggleProps } from 'react-bootstrap/DropdownToggle';
import { DropdownMenuProps } from 'react-bootstrap/DropdownMenu';
Expand All @@ -14,15 +14,13 @@ interface DropdownToggleProps extends BsPrefixProps, BaseDropdownToggleProps {
id: string | number;
}

interface DropdownItemProps extends React.LinkHTMLAttributes<string>{
className?: string;
}
interface DropdownItemProps extends React.HTMLAttributes, React.LinkHTMLAttributes<string>{}

declare const DropdownToggle: BsPrefixRefForwardingComponent<'button', DropdownToggleProps>;
declare const DropdownToggle: React.ForwardRefExoticComponent<DropdownToggleProps>;

declare const DropdownItem: BsPrefixRefForwardingComponent<'button', DropdownItemProps>;
declare const DropdownItem: React.ForwardRefExoticComponent<DropdownItemProps>;

declare const Dropdown: BsPrefixRefForwardingComponent<'div', DropdownProps> & {
declare const Dropdown: React.ForwardRefExoticComponent<DropdownProps> & {
Toggle: React.FC<DropdownToggleProps>;
Item: React.FC<DropdownItemProps>
Menu: React.FC<DropdownMenuProps>;
Expand All @@ -32,3 +30,6 @@ declare const Dropdown: BsPrefixRefForwardingComponent<'div', DropdownProps> & {

export default Dropdown;
export { DropdownToggle, DropdownItem };

export { default as DropdownButton } from 'react-bootstrap/DropdownButton';
export { default as SplitButton } from 'react-bootstrap/SplitButton';
2 changes: 1 addition & 1 deletion src/Dropzone/DefaultContent.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';

export interface DefaultContentProps {
accept?: string[],
accept?: { [key: string]: string[] };
maxSize?: number;
minSize?: number;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Dropzone/GenericError.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';

export interface GenericErrorProps {
errorMsgs: string[];
errorMsgs: { [key: string]: string[] };
}

declare const GenericError: React.FC<GenericErrorProps>;
Expand Down
2 changes: 1 addition & 1 deletion src/Form/FormAutosuggest.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ export interface FormAutosuggestProps {
onSelected?: (selectedValue: string) => void;
}

declare const FormAutosuggest = React.FC<FormAutosuggestProps>;
declare const FormAutosuggest: React.FC<FormAutosuggestProps>;

export default FormAutosuggest;
2 changes: 1 addition & 1 deletion src/Form/FormAutosuggestOption.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ export interface FormAutosuggestOptionProps {
onClick?: (event: React.MouseEvent<HTMLLIElement>) => void;
}

declare const FormAutosuggestOption = React.FC<FormAutosuggestOptionProps>;
declare const FormAutosuggestOption: React.FC<FormAutosuggestOptionProps>;

export default FormAutosuggestOption;
5 changes: 3 additions & 2 deletions src/Form/FormCheckbox.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ export interface CheckboxControlProps {
className?: string;
}

declare const FormCheckbox = React.FC<FormCheckboxProps>;
declare const CheckboxControl = React.FC<CheckboxControlProps>;
declare const FormCheckbox: React.FC<FormCheckboxProps>;

declare const CheckboxControl: React.FC<CheckboxControlProps>;

export { CheckboxControl };

Expand Down
2 changes: 1 addition & 1 deletion src/Form/FormCheckboxSet.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ export interface FormCheckboxSetProps {
onBlur?: React.FocusEventHandler<HTMLInputElement>;
}

declare const FormCheckboxSet = React.FC<FormCheckboxSetProps>;
declare const FormCheckboxSet: React.FC<FormCheckboxSetProps>;

export default FormCheckboxSet;
43 changes: 22 additions & 21 deletions src/Form/FormCheckboxSetContext.d.ts
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
import { ReactNode } from 'react';
import React from 'react';

type CheckboxSetControlProps = {
onBlur?: (...args: any[]) => any;
onFocus?: (...args: any[]) => any;
onChange?: (...args: any[]) => any;
checked?: boolean;
defaultChecked?: boolean;
value?: string;
export type CheckboxProps = {
value: string;
onBlur?: React.FocusEventHandler<HTMLInputElement>;
onFocus?: React.FocusEventHandler<HTMLInputElement>;
onChange?: React.ChangeEventHandler<HTMLInputElement>;
};

type CheckboxSetContextValue = {
export type FormCheckboxSetContextValue = {
name?: string;
value?: string[];
defaultValue?: string[];
getCheckboxControlProps: (props: CheckboxSetControlProps) => CheckboxSetControlProps;
onBlur?: (...args: any[]) => any;
onFocus?: (...args: any[]) => any;
onChange?: (...args: any[]) => any;
hasCheckboxSetProvider?: boolean;
onBlur?: React.FocusEventHandler<HTMLInputElement>;
onFocus?: React.FocusEventHandler<HTMLInputElement>;
onChange?: React.ChangeEventHandler<HTMLInputElement>;
getCheckboxControlProps: (checkboxProps: CheckboxProps) => CheckboxProps;
hasCheckboxSetProvider: boolean;
};

type FormCheckboxSetContextProviderProps = {
children: ReactNode;
export declare const FormCheckboxSetContext: React.Context<FormCheckboxSetContextValue>;

export declare const useCheckboxSetContext: () => FormCheckboxSetContextValue;

export type FormCheckboxSetContextProviderProps = {
children: React.ReactNode;
name?: string;
onBlur?: (...args: any[]) => any;
onFocus?: (...args: any[]) => any;
onChange?: (...args: any[]) => any;
onBlur?: React.FocusEventHandler<HTMLInputElement>;
onFocus?: React.FocusEventHandler<HTMLInputElement>;
onChange?: React.ChangeEventHandler<HTMLInputElement>;
value?: string[];
defaultValue?: string[];
};

export function useCheckboxSetContext(): CheckboxSetContextValue;
export function FormCheckboxSetContextProvider(props: FormCheckboxSetContextProviderProps): JSX.Element;
export declare const FormCheckboxSetContextProvider: React.FC<FormCheckboxSetContextProviderProps>;
4 changes: 2 additions & 2 deletions src/Form/FormControl.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react';
import { FormControlProps as BaseFormControlProps } from 'react-bootstrap/FormControl';
import { FormControlFeedbackProps } from './FormControlFeedback';
import { BsPrefixProps } from 'react-bootstrap/helpers';

export interface FormControlProps extends BaseFormControlProps {
export interface FormControlProps extends BsPrefixProps, BaseFormControlProps {
className?: string;
as?: keyof JSX.IntrinsicElements;
defaultValue?: string | number,
controlClassName?: string;
leadingElement?: React.ReactNode;
Expand Down
2 changes: 1 addition & 1 deletion src/Form/FormControlDecorator.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ export interface FormControlDecoratorProps {
location?: 'leading' | 'trailing';
}

declare const FormControlDecorator = React.FC<FormControlDecoratorProps>;
declare const FormControlDecorator: React.FC<FormControlDecoratorProps>;

export default FormControlDecorator;
2 changes: 1 addition & 1 deletion src/Form/FormControlDecoratorGroup.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ export interface FormControlDecoratorGroupProps {
size?: FORM_CONTROL_SIZES.SMALL | FORM_CONTROL_SIZES.LARGE;
}

declare const FormControlDecoratorGroup = React.FC<FormControlDecoratorGroupProps>;
declare const FormControlDecoratorGroup: React.FC<FormControlDecoratorGroupProps>;

export default FormControlDecoratorGroup;
6 changes: 3 additions & 3 deletions src/Form/FormControlFeedback.d.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import React from 'react';

export type FeedbackTypes = 'default' | 'valid' | 'invalid' | 'warning' | 'criteria-empty' | 'criteria-valid' | 'criteria-invalid';
export type FeedbackVariants = 'default' | 'valid' | 'invalid' | 'warning' | 'criteria-empty' | 'criteria-valid' | 'criteria-invalid';

export interface FormControlFeedbackProps {
children: React.ReactNode;
className?: string;
hasIcon?: boolean;
type?: FeedbackTypes,
type?: FeedbackVariants,
icon?: React.ReactNode;
muted?: boolean;
}

declare const FormControlFeedback = React.FC<FormControlFeedbackProps>;
declare const FormControlFeedback: React.FC<FormControlFeedbackProps>;

export default FormControlFeedback;
2 changes: 1 addition & 1 deletion src/Form/FormControlFloatingLabel.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ export interface FormControlFloatingLabelProps {
children: React.ReactNode;
}

declare const FormControlFloatingLabel = React.FC<FormControlFloatingLabelProps>;
declare const FormControlFloatingLabel: React.FC<FormControlFloatingLabelProps>;

export default FormControlFloatingLabel;
Loading

0 comments on commit aae4443

Please sign in to comment.