Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[@mantine/core] fix: ensure TagsInput dropdown reopens after clearing #6207

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions packages/@mantine/core/src/components/PillsInput/PillsInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import { InputBase } from '../InputBase';
import { PillsInputProvider } from './PillsInput.context';
import { PillsInputField } from './PillsInputField/PillsInputField';
import { ComboboxParsedItem } from '../Combobox';

export interface PillsInputProps
extends BoxProps,
Expand All @@ -13,6 +14,9 @@
__stylesApiProps?: Record<string, any>;
__staticSelector?: string;
multiline?: boolean;
openDropdown: () => void;
dropdownOpened: boolean;
parsedData: ComboboxParsedItem[];
}

export type PillsInputFactory = Factory<{
Expand All @@ -32,8 +36,11 @@
children,
onMouseDown,
onClick,
openDropdown,
size,
disabled,
dropdownOpened,
parsedData,
__staticSelector,
error,
variant,
Expand All @@ -44,7 +51,7 @@

return (
<PillsInputProvider value={{ fieldRef, size: size!, disabled, hasError: !!error, variant }}>
<InputBase

Check failure on line 54 in packages/@mantine/core/src/components/PillsInput/PillsInput.tsx

View workflow job for this annotation

GitHub Actions / test_pull_request

Type '{ children: string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | null | undefined; ... 351 more ...; onClick: (event: MouseEvent<...>) => void; }' is not assignable to type 'InputBaseProps'.
size={size}
error={error}
variant={variant}
Expand All @@ -59,6 +66,9 @@
event.preventDefault();
onClick?.(event);
fieldRef.current?.focus();
if(!dropdownOpened && parsedData.length > 0) {
openDropdown();
}
}}
{...others}
multiline
Expand Down
3 changes: 3 additions & 0 deletions packages/@mantine/core/src/components/TagsInput/TagsInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,9 @@ export const TagsInput = factory<TagsInputFactory>((_props, ref) => {
__stylesApiProps={{ ...props, multiline: true }}
id={_id}
mod={mod}
openDropdown={combobox.openDropdown}
dropdownOpened={combobox.dropdownOpened}
parsedData={parsedData}
>
<Pill.Group disabled={disabled} unstyled={unstyled} {...getStyles('pillsList')}>
{values}
Expand Down
Loading