fix: migrate select to Base UI items API (#4655)
This commit is contained in:
+43
-20
@@ -18,6 +18,7 @@ import { Input } from '@/components/ui/input'
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectGroup,
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
@@ -237,6 +238,10 @@ export function SubscriptionsMutateDrawer({
|
||||
<FormItem>
|
||||
<FormLabel>{t('Upgrade Group')}</FormLabel>
|
||||
<Select
|
||||
items={[
|
||||
{ value: '__none__', label: t('No Upgrade') },
|
||||
...groupOptions.map((g) => ({ value: g, label: g })),
|
||||
]}
|
||||
onValueChange={(v) =>
|
||||
field.onChange(v === '__none__' ? '' : v)
|
||||
}
|
||||
@@ -247,15 +252,17 @@ export function SubscriptionsMutateDrawer({
|
||||
<SelectValue placeholder={t('No Upgrade')} />
|
||||
</SelectTrigger>
|
||||
</FormControl>
|
||||
<SelectContent>
|
||||
<SelectItem value='__none__'>
|
||||
{t('No Upgrade')}
|
||||
</SelectItem>
|
||||
{groupOptions.map((g) => (
|
||||
<SelectItem key={g} value={g}>
|
||||
{g}
|
||||
<SelectContent alignItemWithTrigger={false}>
|
||||
<SelectGroup>
|
||||
<SelectItem value='__none__'>
|
||||
{t('No Upgrade')}
|
||||
</SelectItem>
|
||||
))}
|
||||
{groupOptions.map((g) => (
|
||||
<SelectItem key={g} value={g}>
|
||||
{g}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectGroup>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<FormMessage />
|
||||
@@ -344,6 +351,12 @@ export function SubscriptionsMutateDrawer({
|
||||
<FormItem>
|
||||
<FormLabel>{t('Duration Unit')}</FormLabel>
|
||||
<Select
|
||||
items={[
|
||||
...durationUnitOpts.map((o) => ({
|
||||
value: o.value,
|
||||
label: o.label,
|
||||
})),
|
||||
]}
|
||||
onValueChange={field.onChange}
|
||||
value={field.value}
|
||||
>
|
||||
@@ -352,12 +365,14 @@ export function SubscriptionsMutateDrawer({
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
</FormControl>
|
||||
<SelectContent>
|
||||
{durationUnitOpts.map((o) => (
|
||||
<SelectItem key={o.value} value={o.value}>
|
||||
{o.label}
|
||||
</SelectItem>
|
||||
))}
|
||||
<SelectContent alignItemWithTrigger={false}>
|
||||
<SelectGroup>
|
||||
{durationUnitOpts.map((o) => (
|
||||
<SelectItem key={o.value} value={o.value}>
|
||||
{o.label}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectGroup>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<FormMessage />
|
||||
@@ -426,6 +441,12 @@ export function SubscriptionsMutateDrawer({
|
||||
<FormItem>
|
||||
<FormLabel>{t('Reset Cycle')}</FormLabel>
|
||||
<Select
|
||||
items={[
|
||||
...resetPeriodOpts.map((o) => ({
|
||||
value: o.value,
|
||||
label: o.label,
|
||||
})),
|
||||
]}
|
||||
onValueChange={field.onChange}
|
||||
value={field.value}
|
||||
>
|
||||
@@ -434,12 +455,14 @@ export function SubscriptionsMutateDrawer({
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
</FormControl>
|
||||
<SelectContent>
|
||||
{resetPeriodOpts.map((o) => (
|
||||
<SelectItem key={o.value} value={o.value}>
|
||||
{o.label}
|
||||
</SelectItem>
|
||||
))}
|
||||
<SelectContent alignItemWithTrigger={false}>
|
||||
<SelectGroup>
|
||||
{resetPeriodOpts.map((o) => (
|
||||
<SelectItem key={o.value} value={o.value}>
|
||||
{o.label}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectGroup>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<FormMessage />
|
||||
|
||||
Reference in New Issue
Block a user