diff --git a/.changeset/light-things-see.md b/.changeset/light-things-see.md new file mode 100644 index 00000000..e617f1fd --- /dev/null +++ b/.changeset/light-things-see.md @@ -0,0 +1,5 @@ +--- +'@devup-ui/components': patch +--- + +Fix component warning diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index ddf662f9..10b540a9 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -70,8 +70,8 @@ jobs: node-version: 22 cache: 'pnpm' - run: pnpm i + - run: pnpm build - run: | - pnpm build pnpm lint # rust coverage issue echo 'max_width = 100000' > .rustfmt.toml @@ -83,8 +83,8 @@ jobs: echo 'merge_derives = true' >> .rustfmt.toml echo 'use_small_heuristics = "Default"' >> .rustfmt.toml cargo fmt - pnpm test rm -rf .rustfmt.toml + - run: pnpm test - name: Build Landing run: | pnpm -F components build-storybook diff --git a/packages/components/src/components/Stepper/__tests__/index.browser.test.tsx b/packages/components/src/components/Stepper/__tests__/index.browser.test.tsx index 3e9335b0..7d5aff73 100644 --- a/packages/components/src/components/Stepper/__tests__/index.browser.test.tsx +++ b/packages/components/src/components/Stepper/__tests__/index.browser.test.tsx @@ -14,7 +14,7 @@ describe('Stepper', () => { - + , @@ -24,7 +24,7 @@ describe('Stepper', () => { it('should throw error if children are used outside of StepperProvider', () => { expect(() => { - render() + render() }).toThrow('useStepper must be used within a StepperProvider') }) diff --git a/packages/components/src/components/Stepper/index.tsx b/packages/components/src/components/Stepper/index.tsx index 4a5e0f62..17960088 100644 --- a/packages/components/src/components/Stepper/index.tsx +++ b/packages/components/src/components/Stepper/index.tsx @@ -131,9 +131,7 @@ function StepperIncreaseButton({ ...props }: ComponentProps) { ) } -interface StepperInputProps extends ComponentProps { - editable?: boolean -} +type StepperInputProps = ComponentProps function StepperInput({ className, ...props }: StepperInputProps) { const { value, setValue, type } = useStepper() @@ -144,12 +142,15 @@ function StepperInput({ className, ...props }: StepperInputProps) { h: 'fit-content', styleOrder: 3, }) - const editable = type === 'input' - const Comp = editable ? Input : 'div' + const isInput = type === 'input' + const Comp = isInput ? Input : 'div' + if (isInput) { + // div tag doesn't support allowClear prop + Object.assign(props, { allowClear: false }) + } return ( setValue(Number(e.target.value))} - readOnly={!editable} + onChange={(e) => { + setValue(Number(e.target.value)) + }} + readOnly={!isInput} type="number" - value={value} + // Fix prefix 0 issue + value={value.toString()} {...props} /> )