Files
web/apps/scandic-web/components/TempDesignSystem/Form/Select/index.tsx
Anton Gunnarsson 9e1cc66f95 Merged in chore/sw-3145-move-deprecated-select (pull request #2518)
chore(SW-3145): Move DeprecatedSelect to design-system

* Move DeprecatedSelect to design-system


Approved-by: Linus Flood
2025-07-04 06:34:18 +00:00

41 lines
884 B
TypeScript

"use client"
import { useController, useFormContext } from "react-hook-form"
import DeprecatedSelect from "@scandic-hotels/design-system/DeprecatedSelect"
import type { SelectProps } from "./select"
export default function Select({
className,
items,
label,
disabled,
name,
isNestedInModal = false,
registerOptions = {},
}: SelectProps) {
const { control } = useFormContext()
const { field } = useController({
control,
name,
rules: registerOptions,
})
return (
<DeprecatedSelect
className={className}
defaultSelectedKey={field.value}
disabled={disabled || field.disabled}
items={items}
label={label}
aria-label={label}
name={field.name}
onBlur={field.onBlur}
onSelect={field.onChange}
value={field.value}
data-testid={name}
isNestedInModal={isNestedInModal}
/>
)
}