From 555c8575bc701a119a331cc8e1d93d570cf44616 Mon Sep 17 00:00:00 2001 From: Navin Date: Fri, 6 Nov 2020 20:40:54 +0530 Subject: [PATCH] =?UTF-8?q?refactor(progress):=20=E2=99=BB=EF=B8=8F=20=20r?= =?UTF-8?q?emove=20sealed=20state?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/progress/ProgressState.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/progress/ProgressState.ts b/src/progress/ProgressState.ts index 866556c1f..bc285b892 100644 --- a/src/progress/ProgressState.ts +++ b/src/progress/ProgressState.ts @@ -5,9 +5,8 @@ * to work with Reakit System */ import * as React from "react"; -import { SealedInitialState, useSealedState } from "reakit-utils"; -import { valueToPercent, isFunction, isNull } from "../utils"; +import { valueToPercent, isNull } from "../utils"; export interface ProgressState { /** @@ -52,12 +51,10 @@ export type ProgressInitialState = Pick< export type ProgressStateReturn = ProgressState & ProgressAction; export function useProgressState( - initialState: SealedInitialState = {}, + props: ProgressInitialState = {}, ): ProgressStateReturn { - const { value: initialValue = 0, min = 0, max = 100 } = useSealedState( - initialState, - ); - const [value, setValue] = React.useState(clampValue(initialValue, min, max)); + const { value: defaultValue = 0, min = 0, max = 100 } = props; + const [value, setValue] = React.useState(clampValue(defaultValue, min, max)); const percent = isNull(value) ? null : valueToPercent(value, min, max); return {