Skip to content

Commit 8d61616

Browse files
committed
Replace Select component with NativeSelect component
Fixes #26 Replace the `Select` component with the `NativeSelect` component in `SelectWidget.tsx`. * **Import Statement** - Update import statement to import `NativeSelect` from `@mantine/core`. * **Component Replacement** - Replace `Select` component with `NativeSelect` component. - Adjust the `handleChange` function to handle the `NativeSelect` value. * **Remove Unnecessary Props** - Remove `searchable`, `onDropdownClose`, and `onDropdownOpen` props from `NativeSelect`. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/AokiApp/rjsf-mantine-theme/issues/26?shareId=XXXX-XXXX-XXXX-XXXX).
1 parent 3abfb11 commit 8d61616

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

packages/mantine/src/widgets/SelectWidget.tsx

+3-9
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
StrictRJSFSchema,
1010
WidgetProps,
1111
} from '@rjsf/utils';
12-
import { MultiSelect, Select } from '@mantine/core';
12+
import { MultiSelect, NativeSelect } from '@mantine/core';
1313
import { createErrors } from '../utils/createErrors';
1414
import { useFieldContext } from '../templates/FieldTemplate';
1515

@@ -84,10 +84,7 @@ function SelectWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extend
8484
);
8585
} else {
8686
return (
87-
<Select
88-
allowDeselect
89-
checkIconPosition='right'
90-
clearable={!required}
87+
<NativeSelect
9188
data={(enumOptions || []).map(({ value, label }, i) => {
9289
const disabled = enumDisabled && enumDisabled.indexOf(value) !== -1;
9390
return { value: String(i), label, disabled };
@@ -98,11 +95,8 @@ function SelectWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extend
9895
label={labelValue(label, hideLabel, false)}
9996
autoFocus={autofocus}
10097
required={required}
101-
searchable
10298
value={selectedIndices as string | null}
103-
onChange={handleChange}
104-
onDropdownClose={handleBlur}
105-
onDropdownOpen={handleFocus}
99+
onChange={(event) => handleChange(event.currentTarget.value)}
106100
aria-describedby={ariaDescribedByIds<T>(id)}
107101
placeholder={placeholder}
108102
className='armt-widget-select armt-widget-select-single'

0 commit comments

Comments
 (0)