Skip to content

Commit

Permalink
fix: NO-JIRA add id and defaultValue to inputPropsKeys (#118)
Browse files Browse the repository at this point in the history
* fix: NO-JIRA add id and defaultValue to inputPropsKeys

* fix: NO-JIRA add defaultValue prop to TextInput component
  • Loading branch information
mwleklinski committed Feb 7, 2024
1 parent 9f6ccc1 commit f67c0d5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/components/TextInput/TextInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const TextInput = forwardRef<
state,
hasClearButton,
value,
defaultValue,
...restProps
},
inputRef,
Expand All @@ -39,6 +40,7 @@ export const TextInput = forwardRef<
} = useTextInput({
beforeComponent,
afterComponent,
defaultValue,
...restProps,
});

Expand Down
3 changes: 2 additions & 1 deletion src/components/TextInput/useTextInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ export const useTextInput = ({
beforeComponent,
afterComponent,
onChange,
defaultValue,
...restProps
}: Omit<TextInputProps, 'type' | 'state' | 'value' | 'hasClearButton'>) => {
const [innerValue, setInnerValue] = useState('');
const [innerValue, setInnerValue] = useState(defaultValue ?? '');
const styles = useMemo(
() => stylesBuilder(custom, beforeComponent?.type, afterComponent?.type),
[afterComponent?.type, beforeComponent?.type, custom],
Expand Down
3 changes: 2 additions & 1 deletion src/services/extractInputProps/extractInputProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ const inputPropsKeys = [
'src',
'step',
'value',

'id',
'defaultValue',
'onClick',
'onChange',
'onKeyDown',
Expand Down

0 comments on commit f67c0d5

Please sign in to comment.