diff --git a/libs/upload/src/DragZone.tsx b/libs/upload/src/DragZone.tsx index c9d8c20..4c51a7d 100644 --- a/libs/upload/src/DragZone.tsx +++ b/libs/upload/src/DragZone.tsx @@ -23,12 +23,12 @@ import UploadDropZone from "@rpldy/upload-drop-zone"; import { Field, FieldProps } from "@tiller-ds/form-elements"; import { LoadingIcon } from "@tiller-ds/icons"; import { ComponentTokens, cx, TokenProps, useIcon, useTokens } from "@tiller-ds/theme"; +import { usePrevious } from "@tiller-ds/util"; import UploadyWrapper, { UploadyWrapperProps } from "./UploadyWrapper"; import { UseFileUpload, File, defaultUploadResponseMapper } from "./useFileUpload"; import { BatchItem } from "@rpldy/shared"; -import { usePrevious } from "../../util/src/usePrevious"; export type DragZoneProps = { /** diff --git a/libs/util/src/index.tsx b/libs/util/src/index.tsx index 2e33003..ca5c4da 100644 --- a/libs/util/src/index.tsx +++ b/libs/util/src/index.tsx @@ -24,6 +24,7 @@ export type DisplayType = InternalDisplayType; export { default as useInterval } from "./useInterval"; export { default as useTimeout } from "./useTimeout"; export { default as useViewport } from "./useViewport"; +export { default as usePrevious } from "./usePrevious"; export { default as createNamedContext } from "./createNamedContext"; export { diff --git a/libs/util/src/usePrevious.tsx b/libs/util/src/usePrevious.tsx index e227b2f..dee968a 100644 --- a/libs/util/src/usePrevious.tsx +++ b/libs/util/src/usePrevious.tsx @@ -1,3 +1,20 @@ +/* + * Copyright 2023 CROZ d.o.o, the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + import { useEffect, useRef } from "react"; export const usePrevious = (value: T): T | undefined => { @@ -7,3 +24,5 @@ export const usePrevious = (value: T): T | undefined => { }); return ref.current; }; + +export default usePrevious;