@hanzo/ui 3.4.3 → 3.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/primitives/accordion.tsx +9 -4
package/package.json
CHANGED
package/primitives/accordion.tsx
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import * as React from "react"
|
|
5
5
|
import * as AccordionPrimitive from "@radix-ui/react-accordion"
|
|
6
|
-
import {
|
|
6
|
+
import { ChevronUp } from "lucide-react"
|
|
7
7
|
|
|
8
8
|
import { cn } from "../util"
|
|
9
9
|
|
|
@@ -21,20 +21,25 @@ const AccordionItem = React.forwardRef<
|
|
|
21
21
|
))
|
|
22
22
|
AccordionItem.displayName = "AccordionItem"
|
|
23
23
|
|
|
24
|
+
type AccordionTriggerProps = React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger> & {
|
|
25
|
+
showChevron?: boolean;
|
|
26
|
+
}
|
|
27
|
+
|
|
24
28
|
const AccordionTrigger = React.forwardRef<
|
|
25
29
|
React.ElementRef<typeof AccordionPrimitive.Trigger>,
|
|
26
|
-
|
|
27
|
-
>(({ className, children, ...props }, ref) => (
|
|
30
|
+
AccordionTriggerProps
|
|
31
|
+
>(({ showChevron, className, children, ...props }, ref) => (
|
|
28
32
|
<AccordionPrimitive.Header className="flex">
|
|
29
33
|
<AccordionPrimitive.Trigger
|
|
30
34
|
ref={ref}
|
|
31
35
|
className={cn(
|
|
32
|
-
"flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline ",
|
|
36
|
+
"flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:-rotate-180",
|
|
33
37
|
className
|
|
34
38
|
)}
|
|
35
39
|
{...props}
|
|
36
40
|
>
|
|
37
41
|
{children}
|
|
42
|
+
{showChevron && <ChevronUp className="shrink-0 transition-transform duration-200" />}
|
|
38
43
|
</AccordionPrimitive.Trigger>
|
|
39
44
|
</AccordionPrimitive.Header>
|
|
40
45
|
))
|