Skip to content

Commit

Permalink
fix(fuselage): onChange prop on PaginatedSelectFiltered (#659)
Browse files Browse the repository at this point in the history
  • Loading branch information
tassoevan authored Mar 7, 2022
1 parent 945da0a commit 9e170ff
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const optionsEllipses = [
];

export default {
title: 'Inputs/SelectPaginated',
title: 'Inputs/PaginatedSelect',
component: PaginatedSelect,
parameters: {
docs: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ import { InputBox } from '../InputBox';

type PaginatedSelectFilteredProps = PaginatedSelectProps;

type PaginatedSelectFilteredAnchorProps = Omit<
PaginatedSelectProps,
'onChange'
>;

export const PaginatedSelectFiltered = ({
// filter,
// setFilter,
Expand All @@ -16,15 +21,19 @@ export const PaginatedSelectFiltered = ({
...props
}: PaginatedSelectFilteredProps) => {
const [filter, setFilter] = useState('');

const handleChange = useMutableCallback((e: FormEvent<HTMLInputElement>) => {
setFilter(e.currentTarget.value);
});

const anchor = useCallback(
forwardRef(
(
{
children: _children,
filter,
onChange: _onChange,
...props
}: PaginatedSelectFilteredProps,
}: PaginatedSelectFilteredAnchorProps,
ref: Ref<HTMLInputElement>
) => (
<InputBox.Input
Expand All @@ -34,9 +43,7 @@ export const PaginatedSelectFiltered = ({
ref={ref}
placeholder={placeholder}
value={filter}
onChange={useMutableCallback((e: FormEvent<HTMLInputElement>) => {
setFilter(e.currentTarget.value);
})}
onChange={handleChange}
{...props}
rcx-input-box--undecorated
/>
Expand Down

0 comments on commit 9e170ff

Please sign in to comment.