Skip to content

Commit 05fc770

Browse files
committed
chore: bug-fixes
1 parent 14d2014 commit 05fc770

File tree

5 files changed

+15
-6
lines changed

5 files changed

+15
-6
lines changed

src/lib/accordion/custom.tsx

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { ReactNode, useState } from "react";
22
import AccordionItem from "./accordion-item";
3-
import { cn } from "../../utils";
3+
import { cn, isUndefined } from "../../utils";
44

55
interface AccordionItem {
66
title: ReactNode;
@@ -10,14 +10,18 @@ interface AccordionItem {
1010
interface AccordionProps {
1111
items: AccordionItem[];
1212
className?: string;
13+
defaultExpanded?: number;
1314
}
1415

1516
const CustomAccordion: React.FC<AccordionProps> = ({
1617
items,
1718
className,
19+
defaultExpanded,
1820
...props
1921
}) => {
20-
const [expanded, setExpanded] = useState(-1);
22+
const [expanded, setExpanded] = useState(
23+
!isUndefined(defaultExpanded) ? defaultExpanded : -1,
24+
);
2125
return (
2226
<div
2327
className={cn("box-border flex w-[1000px] flex-col", className)}

src/lib/accordion/index.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { ReactNode, useState } from "react";
22
import AccordionItem from "./accordion-item";
3-
import { cn } from "../../utils";
3+
import { cn, isUndefined } from "../../utils";
44

55
interface AccordionItem {
66
title: string;
@@ -28,7 +28,9 @@ const Accordion: React.FC<AccordionProps> = ({
2828
className,
2929
...props
3030
}) => {
31-
const [expanded, setExpanded] = useState(defaultExpanded ?? -1);
31+
const [expanded, setExpanded] = useState(
32+
!isUndefined(defaultExpanded) ? defaultExpanded : -1,
33+
);
3234
return (
3335
<div
3436
className={cn("box-border flex w-[1000px] flex-col", className)}

src/lib/form/bignumber-field/index.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ interface BigNumberFieldComponentProps extends BigNumberFieldProps {
1515
message?: string;
1616
Icon?: React.FC<React.SVGAttributes<SVGElement>>;
1717
className?: string;
18+
/** The name of the input element, used when submitting an HTML form.*/
19+
name?: string;
1820
}
1921

2022
/** A number field that handles big numbers.
@@ -29,6 +31,7 @@ function BigNumberField({
2931
isDisabled,
3032
id: propId,
3133
isReadOnly,
34+
name,
3235
...props
3336
}: Readonly<BigNumberFieldComponentProps>) {
3437
// Generate an ID if one is not provided
@@ -65,6 +68,7 @@ function BigNumberField({
6568
<>
6669
<Input
6770
{...inputProps}
71+
name={name}
6872
className={cn(
6973
"hover-short-transition bg-klerosUIComponentsWhiteBackground size-full",
7074
"rounded-base border-klerosUIComponentsStroke text-klerosUIComponentsPrimaryText border text-base",

src/lib/form/bignumber-field/useBigNumberField.tsx

-2
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,6 @@ export function useBigNumberField(props: BigNumberFieldProps) {
566566
type: "button" as const,
567567
"aria-label": "Increment",
568568
"aria-controls": id,
569-
slot: "increment",
570569
isDisabled: !canIncrement(),
571570
onPress: increment,
572571
});
@@ -576,7 +575,6 @@ export function useBigNumberField(props: BigNumberFieldProps) {
576575
type: "button" as const,
577576
"aria-label": "Decrement",
578577
"aria-controls": id,
579-
slot: "decrement",
580578
isDisabled: !canDecrement(),
581579
onPress: decrement,
582580
});

src/lib/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export { default as DisplaySmall } from "./display/small";
1515
export { default as DropdownSelect } from "./dropdown/select";
1616
export { default as DropdownCascader } from "./dropdown/cascader";
1717

18+
export { default as Form } from "./form/index";
1819
export { default as NumberField } from "./form/number-field";
1920
export { default as BigNumberField } from "./form/bignumber-field";
2021
export { default as TextField } from "./form/text-field";

0 commit comments

Comments
 (0)