* chore(deps): update dependency eslint to v9 * chore: migrate eslint to v9 * fix: dependency issues * fix: unit tests not working * chore: disable lint check for Image component that does not work in ci * fix: lint issue --------- Co-authored-by: homarr-renovate[bot] <158783068+homarr-renovate[bot]@users.noreply.github.com> Co-authored-by: Meier Lukas <meierschlumpf@gmail.com>
32 lines
956 B
TypeScript
32 lines
956 B
TypeScript
"use client";
|
|
|
|
import { MultiSelect } from "@mantine/core";
|
|
|
|
import { translateIfNecessary } from "@homarr/translation";
|
|
|
|
import type { CommonWidgetInputProps } from "./common";
|
|
import { useWidgetInputTranslation } from "./common";
|
|
import { useFormContext } from "./form";
|
|
|
|
export const WidgetMultiSelectInput = ({ property, kind, options }: CommonWidgetInputProps<"multiSelect">) => {
|
|
const t = useWidgetInputTranslation(kind, property);
|
|
const form = useFormContext();
|
|
|
|
return (
|
|
<MultiSelect
|
|
label={t("label")}
|
|
data={options.options.map((option) =>
|
|
typeof option === "string"
|
|
? option
|
|
: {
|
|
value: option.value,
|
|
label: translateIfNecessary(t, option.label) ?? option.value,
|
|
},
|
|
)}
|
|
description={options.withDescription ? t("description") : undefined}
|
|
searchable={options.searchable}
|
|
{...form.getInputProps(`options.${property}`)}
|
|
/>
|
|
);
|
|
};
|