From 87d970012d7a04fece0aa247cabdb6e50fad5bd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=A9o?= Date: Wed, 4 Dec 2024 14:34:42 +0100 Subject: [PATCH] Fixed "Collapsible: --radix-collapsible-content-height CSS variable missing when equal to 0" --- .../react/collapsible/src/Collapsible.tsx | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/react/collapsible/src/Collapsible.tsx b/packages/react/collapsible/src/Collapsible.tsx index 1ec9829692..1317e3d5aa 100644 --- a/packages/react/collapsible/src/Collapsible.tsx +++ b/packages/react/collapsible/src/Collapsible.tsx @@ -1,12 +1,12 @@ -import * as React from 'react'; import { composeEventHandlers } from '@radix-ui/primitive'; +import { useComposedRefs } from '@radix-ui/react-compose-refs'; import { createContextScope } from '@radix-ui/react-context'; +import { useId } from '@radix-ui/react-id'; +import { Presence } from '@radix-ui/react-presence'; +import { Primitive } from '@radix-ui/react-primitive'; import { useControllableState } from '@radix-ui/react-use-controllable-state'; import { useLayoutEffect } from '@radix-ui/react-use-layout-effect'; -import { useComposedRefs } from '@radix-ui/react-compose-refs'; -import { Primitive } from '@radix-ui/react-primitive'; -import { Presence } from '@radix-ui/react-presence'; -import { useId } from '@radix-ui/react-id'; +import * as React from 'react'; import type { Scope } from '@radix-ui/react-context'; @@ -211,8 +211,8 @@ const CollapsibleContentImpl = React.forwardRef< {...contentProps} ref={composedRefs} style={{ - [`--radix-collapsible-content-height` as any]: height ? `${height}px` : undefined, - [`--radix-collapsible-content-width` as any]: width ? `${width}px` : undefined, + [`--radix-collapsible-content-height` as any]: height ? `${height}px` : 0, + [`--radix-collapsible-content-width` as any]: width ? `${width}px` : 0, ...props.style, }} > @@ -232,14 +232,14 @@ const Trigger = CollapsibleTrigger; const Content = CollapsibleContent; export { - createCollapsibleScope, // Collapsible, - CollapsibleTrigger, CollapsibleContent, + CollapsibleTrigger, + Content, + createCollapsibleScope, // Root, Trigger, - Content, }; -export type { CollapsibleProps, CollapsibleTriggerProps, CollapsibleContentProps }; +export type { CollapsibleContentProps, CollapsibleProps, CollapsibleTriggerProps };