File tree 5 files changed +15
-6
lines changed
5 files changed +15
-6
lines changed Original file line number Diff line number Diff line change 1
1
import React , { ReactNode , useState } from "react" ;
2
2
import AccordionItem from "./accordion-item" ;
3
- import { cn } from "../../utils" ;
3
+ import { cn , isUndefined } from "../../utils" ;
4
4
5
5
interface AccordionItem {
6
6
title : ReactNode ;
@@ -10,14 +10,18 @@ interface AccordionItem {
10
10
interface AccordionProps {
11
11
items : AccordionItem [ ] ;
12
12
className ?: string ;
13
+ defaultExpanded ?: number ;
13
14
}
14
15
15
16
const CustomAccordion : React . FC < AccordionProps > = ( {
16
17
items,
17
18
className,
19
+ defaultExpanded,
18
20
...props
19
21
} ) => {
20
- const [ expanded , setExpanded ] = useState ( - 1 ) ;
22
+ const [ expanded , setExpanded ] = useState (
23
+ ! isUndefined ( defaultExpanded ) ? defaultExpanded : - 1 ,
24
+ ) ;
21
25
return (
22
26
< div
23
27
className = { cn ( "box-border flex w-[1000px] flex-col" , className ) }
Original file line number Diff line number Diff line change 1
1
import React , { ReactNode , useState } from "react" ;
2
2
import AccordionItem from "./accordion-item" ;
3
- import { cn } from "../../utils" ;
3
+ import { cn , isUndefined } from "../../utils" ;
4
4
5
5
interface AccordionItem {
6
6
title : string ;
@@ -28,7 +28,9 @@ const Accordion: React.FC<AccordionProps> = ({
28
28
className,
29
29
...props
30
30
} ) => {
31
- const [ expanded , setExpanded ] = useState ( defaultExpanded ?? - 1 ) ;
31
+ const [ expanded , setExpanded ] = useState (
32
+ ! isUndefined ( defaultExpanded ) ? defaultExpanded : - 1 ,
33
+ ) ;
32
34
return (
33
35
< div
34
36
className = { cn ( "box-border flex w-[1000px] flex-col" , className ) }
Original file line number Diff line number Diff line change @@ -15,6 +15,8 @@ interface BigNumberFieldComponentProps extends BigNumberFieldProps {
15
15
message ?: string ;
16
16
Icon ?: React . FC < React . SVGAttributes < SVGElement > > ;
17
17
className ?: string ;
18
+ /** The name of the input element, used when submitting an HTML form.*/
19
+ name ?: string ;
18
20
}
19
21
20
22
/** A number field that handles big numbers.
@@ -29,6 +31,7 @@ function BigNumberField({
29
31
isDisabled,
30
32
id : propId ,
31
33
isReadOnly,
34
+ name,
32
35
...props
33
36
} : Readonly < BigNumberFieldComponentProps > ) {
34
37
// Generate an ID if one is not provided
@@ -65,6 +68,7 @@ function BigNumberField({
65
68
< >
66
69
< Input
67
70
{ ...inputProps }
71
+ name = { name }
68
72
className = { cn (
69
73
"hover-short-transition bg-klerosUIComponentsWhiteBackground size-full" ,
70
74
"rounded-base border-klerosUIComponentsStroke text-klerosUIComponentsPrimaryText border text-base" ,
Original file line number Diff line number Diff line change @@ -566,7 +566,6 @@ export function useBigNumberField(props: BigNumberFieldProps) {
566
566
type : "button" as const ,
567
567
"aria-label" : "Increment" ,
568
568
"aria-controls" : id ,
569
- slot : "increment" ,
570
569
isDisabled : ! canIncrement ( ) ,
571
570
onPress : increment ,
572
571
} ) ;
@@ -576,7 +575,6 @@ export function useBigNumberField(props: BigNumberFieldProps) {
576
575
type : "button" as const ,
577
576
"aria-label" : "Decrement" ,
578
577
"aria-controls" : id ,
579
- slot : "decrement" ,
580
578
isDisabled : ! canDecrement ( ) ,
581
579
onPress : decrement ,
582
580
} ) ;
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ export { default as DisplaySmall } from "./display/small";
15
15
export { default as DropdownSelect } from "./dropdown/select" ;
16
16
export { default as DropdownCascader } from "./dropdown/cascader" ;
17
17
18
+ export { default as Form } from "./form/index" ;
18
19
export { default as NumberField } from "./form/number-field" ;
19
20
export { default as BigNumberField } from "./form/bignumber-field" ;
20
21
export { default as TextField } from "./form/text-field" ;
You can’t perform that action at this time.
0 commit comments