File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { useFormContext } from '@wpsocio/form' ;
2- import { FormField as FormFieldUI } from '@wpsocio/ui/wp/form' ;
2+ import {
3+ type ControllerProps ,
4+ type FieldPath ,
5+ type FieldValues ,
6+ FormField as FormFieldUI ,
7+ } from '@wpsocio/ui/wp/form' ;
38
4- export const FormField : React . FC < React . ComponentProps < typeof FormFieldUI > > = (
5- props ,
6- ) => {
7- const { control } = useFormContext ( ) ;
9+ export const FormField = <
10+ TFieldValues extends FieldValues = FieldValues ,
11+ TName extends FieldPath < TFieldValues > = FieldPath < TFieldValues > ,
12+ > ( {
13+ ...props
14+ } : ControllerProps < TFieldValues , TName > ) => {
15+ const { control } = useFormContext < TFieldValues > ( ) ;
816
917 return < FormFieldUI control = { control } { ...props } /> ;
1018} ;
Original file line number Diff line number Diff line change 66 check ,
77 cloud ,
88 trash ,
9+ edit ,
910} from '@wordpress/icons' ;
Original file line number Diff line number Diff line change @@ -190,3 +190,5 @@ export {
190190 FormMessage ,
191191 FormField ,
192192} ;
193+
194+ export type { ControllerProps , FieldPath , FieldValues } ;
Original file line number Diff line number Diff line change 11import * as React from 'react' ;
2-
3- import { cn } from '../lib/utils.js' ;
42import {
53 SelectContent ,
64 SelectGroup ,
@@ -10,6 +8,7 @@ import {
108 Select as SelectUI ,
119 SelectValue ,
1210} from '../components/select.js' ;
11+ import { cn } from '../lib/utils.js' ;
1312import { Spinner } from './spinner.js' ;
1413import type { OptionProps } from './types.js' ;
1514
@@ -75,7 +74,7 @@ const Select = React.forwardRef(
7574 portalContainer = { portalContainer || getPortalContainer ( ) }
7675 >
7776 { options . map ( ( option ) => (
78- < React . Fragment key = { option . label } >
77+ < React . Fragment key = { JSON . stringify ( option ) } >
7978 { ( ( ) => {
8079 if ( 'options' in option && Array . isArray ( option . options ) ) {
8180 return (
You can’t perform that action at this time.
0 commit comments