Skip to content

Commit

Permalink
fix(Input,types): extend InputProps from HtmlAttributes of div element
Browse files Browse the repository at this point in the history
Additional props are passed down to the Container, not the input element,
so the extension was declaring types different from the runtime ones.

Refs: CDS-203 (#262)
  • Loading branch information
beawar authored Jan 30, 2024
1 parent 91651cd commit 43be2c0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/inputs/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/

import React, { InputHTMLAttributes, useCallback, useMemo, useState } from 'react';
import React, { useCallback, useMemo, useState } from 'react';

import styled, { DefaultTheme } from 'styled-components';

Expand All @@ -15,7 +15,7 @@ import { useCombinedRefs } from '../../hooks/useCombinedRefs';
import { KeyboardPresetObj, useKeyboard } from '../../hooks/useKeyboard';
import { getColor } from '../../theme/theme-utils';
import { INPUT_BACKGROUND_COLOR, INPUT_DIVIDER_COLOR } from '../constants';
import { Container } from '../layout/Container';
import { Container, ContainerProps } from '../layout/Container';
import { Divider, DividerProps } from '../layout/Divider';

const InputEl = styled.input<{ color: keyof DefaultTheme['palette'] }>`
Expand Down Expand Up @@ -57,7 +57,7 @@ const CustomIconContainer = styled.span`
align-self: center;
`;

interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
interface InputProps extends ContainerProps {
/** Input's background color */
backgroundColor?: keyof DefaultTheme['palette'];
/** whether to disable the Input or not */
Expand Down

0 comments on commit 43be2c0

Please sign in to comment.