Skip to content

Commit

Permalink
feat!: delete deprecated hooks (#1213)
Browse files Browse the repository at this point in the history
  • Loading branch information
NikitaCG authored and amje committed Feb 1, 2024
1 parent 74a4d80 commit c041f2e
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 112 deletions.
2 changes: 0 additions & 2 deletions src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,5 @@ export {getComponentName} from './utils/getComponentName';
export * from './utils/withEventBrokerDomHandlers';
export * from './utils/layer-manager';
export {Lang, configure} from './utils/configure';
/** @deprecated, drop on next major */
export {useOnFocusOutside} from './utils/useOnFocusOutside';
export * from './utils/xpath';
export {getUniqId} from './utils/common';
86 changes: 0 additions & 86 deletions src/components/utils/useOnFocusOutside.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/hooks/useFileInput/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export {useFileInput} from './useFileInput';
export type {UseFileInputProps, UseFileInputOutput, UseFileInputResult} from './useFileInput';
export type {UseFileInputProps, UseFileInputResult} from './useFileInput';
11 changes: 3 additions & 8 deletions src/hooks/useFileInput/useFileInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ export type UseFileInputProps = {
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
};

/**
* @deprecated use UseFileInputResult instead
*/
export type UseFileInputOutput = {
export type UseFileInputResult = {
controlProps: React.DetailedHTMLProps<
React.InputHTMLAttributes<HTMLInputElement>,
HTMLInputElement
Expand All @@ -19,8 +16,6 @@ export type UseFileInputOutput = {
};
};

export type UseFileInputResult = UseFileInputOutput;

/**
* Used to shape props for input with type "file".
*
Expand All @@ -42,7 +37,7 @@ export type UseFileInputResult = UseFileInputOutput;
};
```
*/
export function useFileInput({onUpdate, onChange}: UseFileInputProps): UseFileInputOutput {
export function useFileInput({onUpdate, onChange}: UseFileInputProps): UseFileInputResult {
const ref = React.useRef<HTMLInputElement>(null);

const handleChange = React.useCallback(
Expand All @@ -59,7 +54,7 @@ export function useFileInput({onUpdate, onChange}: UseFileInputProps): UseFileIn
ref.current?.click();
}, []);

const result: UseFileInputOutput = React.useMemo(
const result: UseFileInputResult = React.useMemo(
() => ({
controlProps: {
ref,
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useIntersection/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export {useIntersection} from './useIntersection';
export type {UseIntersection, UseIntersectionProps} from './useIntersection';
export type {UseIntersectionProps} from './useIntersection';
7 changes: 1 addition & 6 deletions src/hooks/useIntersection/useIntersection.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
import React from 'react';

/**
* @deprecated use UseIntersectionProps instead
*/
export type UseIntersection = {
export type UseIntersectionProps = {
element: Element | null;
options?: IntersectionObserverInit;
onIntersect?: () => void;
};

export type UseIntersectionProps = UseIntersection;

export const useIntersection = ({element, options, onIntersect}: UseIntersectionProps) => {
React.useEffect(() => {
const observer = new IntersectionObserver(([entry]) => {
Expand Down
4 changes: 0 additions & 4 deletions src/hooks/useSelect/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ export type UseSelectResult<T> = {
activeIndex: number | undefined;
handleSelection: (option: UseSelectOption<T>) => void;
handleClearValue: () => void;
/**
* @deprecated use toggleOpen
*/
setOpen: (val?: boolean | undefined) => void;
toggleOpen: (val?: boolean | undefined) => void;
setActiveIndex: React.Dispatch<React.SetStateAction<number | undefined>>;
};
4 changes: 0 additions & 4 deletions src/hooks/useSelect/useSelect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ export const useSelect = <T extends unknown>(props: UseSelectProps): UseSelectRe
activeIndex,
handleSelection,
handleClearValue,
/**
* @deprecated use toggleOpen
*/
setOpen: toggleOpen,
toggleOpen,
setActiveIndex,
...openState,
Expand Down

0 comments on commit c041f2e

Please sign in to comment.