From 364e4cdcaa2a3e4c100317ac11d646ec40eae22e Mon Sep 17 00:00:00 2001 From: Matheus Verissimo Date: Tue, 9 Jul 2024 23:45:30 -0300 Subject: [PATCH] feat(react): add missing exports --- .../floating-panel/examples/basic.tsx | 90 ++++++++----------- .../floating-panel/examples/controlled.tsx | 76 +++++++--------- .../floating-panel/examples/lazy-mount.tsx | 73 ++++++--------- .../floating-panel/examples/render-fn.tsx | 81 +++++++---------- .../floating-panel-root-provider.tsx | 6 +- .../floating-panel/floating-panel-title.tsx | 4 +- .../floating-panel/floating-panel.ts | 4 + .../components/floating-panel/tests/basic.tsx | 52 +++++------ 8 files changed, 167 insertions(+), 219 deletions(-) diff --git a/packages/react/src/components/floating-panel/examples/basic.tsx b/packages/react/src/components/floating-panel/examples/basic.tsx index de8cb1c560..86d477f4ff 100644 --- a/packages/react/src/components/floating-panel/examples/basic.tsx +++ b/packages/react/src/components/floating-panel/examples/basic.tsx @@ -1,59 +1,45 @@ -import { - FloatingPanel, - FloatingPanelBody, - FloatingPanelCloseTrigger, - FloatingPanelContent, - FloatingPanelDragTrigger, - FloatingPanelHeader, - FloatingPanelMaximizeTrigger, - FloatingPanelMinimizeTrigger, - FloatingPanelPositioner, - FloatingPanelResizeTrigger, - FloatingPanelRestoreTrigger, - FloatingPanelTitle, - FloatingPanelTrigger, - Portal, -} from '../..' - import { ArrowDownLeft, Maximize2, Minus, XIcon } from 'lucide-react' +import { FloatingPanel, Portal } from '../..' export const Basic = () => ( - Toggle Panel - - - - - Floating Panel -
- - - - - - - - - - - - -
-
-
- -

Some content

-
+ Toggle Panel + + + + + + Floating Panel +
+ + + + + + + + + + + + +
+
+
+ +

Some content

+
- - - - - - - - -
-
+ + + + + + + + + + +
) diff --git a/packages/react/src/components/floating-panel/examples/controlled.tsx b/packages/react/src/components/floating-panel/examples/controlled.tsx index e36994996f..b116c61348 100644 --- a/packages/react/src/components/floating-panel/examples/controlled.tsx +++ b/packages/react/src/components/floating-panel/examples/controlled.tsx @@ -1,65 +1,49 @@ -import { useState } from 'react' -import { - FloatingPanel, - FloatingPanelBody, - FloatingPanelCloseTrigger, - FloatingPanelContent, - FloatingPanelDragTrigger, - FloatingPanelHeader, - FloatingPanelMaximizeTrigger, - FloatingPanelMinimizeTrigger, - FloatingPanelPositioner, - FloatingPanelResizeTrigger, - FloatingPanelRestoreTrigger, - FloatingPanelTitle, - FloatingPanelTrigger, - Portal, -} from '../..' - import { ArrowDownLeft, Maximize2, Minus, XIcon } from 'lucide-react' +import { useState } from 'react' +import { FloatingPanel, Portal } from '../..' export const Controlled = () => { const [isOpen, setIsOpen] = useState(false) return ( setIsOpen(e.open)}> - setIsOpen(true)}>Toggle Panel + setIsOpen(true)}>Toggle Panel - - - - - Floating Panel + + + + + Floating Panel
- + - - + + - - + + - - + + - +
-
-
- + + +

Some content

-
+ - - - - - - - - -
-
+ + + + + + + + + +
) diff --git a/packages/react/src/components/floating-panel/examples/lazy-mount.tsx b/packages/react/src/components/floating-panel/examples/lazy-mount.tsx index 9163ee63c2..fcb2752183 100644 --- a/packages/react/src/components/floating-panel/examples/lazy-mount.tsx +++ b/packages/react/src/components/floating-panel/examples/lazy-mount.tsx @@ -1,61 +1,46 @@ -import { - FloatingPanel, - FloatingPanelBody, - FloatingPanelCloseTrigger, - FloatingPanelContent, - FloatingPanelDragTrigger, - FloatingPanelHeader, - FloatingPanelMaximizeTrigger, - FloatingPanelMinimizeTrigger, - FloatingPanelPositioner, - FloatingPanelResizeTrigger, - FloatingPanelRestoreTrigger, - FloatingPanelTitle, - FloatingPanelTrigger, - Portal, -} from '../..' +import { FloatingPanel, Portal } from '../..' import { ArrowDownLeft, Maximize2, Minus, XIcon } from 'lucide-react' export const LazyMount = () => ( console.log('onExitComplete invoked')}> - Toggle Panel + Toggle Panel - - - - - Floating Panel + + + + + Floating Panel
- + - - + + - - + + - - + + - +
-
-
- + + +

Some content

-
+ - - - - - - - - -
-
+ + + + + + + + + +
) diff --git a/packages/react/src/components/floating-panel/examples/render-fn.tsx b/packages/react/src/components/floating-panel/examples/render-fn.tsx index c525e52d98..13020867a1 100644 --- a/packages/react/src/components/floating-panel/examples/render-fn.tsx +++ b/packages/react/src/components/floating-panel/examples/render-fn.tsx @@ -1,65 +1,48 @@ -import { - FloatingPanel, - FloatingPanelBody, - FloatingPanelCloseTrigger, - FloatingPanelContent, - FloatingPanelContext, - FloatingPanelDragTrigger, - FloatingPanelHeader, - FloatingPanelMaximizeTrigger, - FloatingPanelMinimizeTrigger, - FloatingPanelPositioner, - FloatingPanelResizeTrigger, - FloatingPanelRestoreTrigger, - FloatingPanelTitle, - FloatingPanelTrigger, - Portal, -} from '../..' - import { ArrowDownLeft, Maximize2, Minus, XIcon } from 'lucide-react' +import { FloatingPanel, Portal } from '../..' export const RenderFn = () => ( - Toggle Panel + Toggle Panel - - - - - Floating Panel + + + + + Floating Panel
- + - - + + - - + + - - + + - +
-
-
- + + +

Some content

-
+ - - - - - - - - -
-
+ + + + + + + + + +
- - {(floatingPanel) =>

floatingPanel is {floatingPanel.open ? 'open' : 'closed'}

} -
+ + {(floatingPanel) =>

floatingPanel. is {floatingPanel.open ? 'open' : 'closed'}

} +
) diff --git a/packages/react/src/components/floating-panel/floating-panel-root-provider.tsx b/packages/react/src/components/floating-panel/floating-panel-root-provider.tsx index 76d1a0a151..37437a5ef2 100644 --- a/packages/react/src/components/floating-panel/floating-panel-root-provider.tsx +++ b/packages/react/src/components/floating-panel/floating-panel-root-provider.tsx @@ -1,6 +1,7 @@ import { mergeProps } from '@zag-js/react' import type { ReactNode } from 'react' import { RenderStrategyPropsProvider, splitRenderStrategyProps } from '../../utils/render-strategy' +import type { PolymorphicProps } from '../factory' import type { UsePresenceProps } from '../presence' import { PresenceProvider, usePresence } from '../presence' import { splitPresenceProps } from '../presence/split-presence-props' @@ -11,7 +12,10 @@ interface RootProviderProps { value: UseFloatingPanelReturn } -export interface FloatingPanelRootProviderBaseProps extends RootProviderProps, UsePresenceProps {} +export interface FloatingPanelRootProviderBaseProps + extends RootProviderProps, + UsePresenceProps, + PolymorphicProps {} export interface FloatingPanelRootProviderProps extends FloatingPanelRootProviderBaseProps { children?: ReactNode } diff --git a/packages/react/src/components/floating-panel/floating-panel-title.tsx b/packages/react/src/components/floating-panel/floating-panel-title.tsx index 9e5af68646..f272d95edc 100644 --- a/packages/react/src/components/floating-panel/floating-panel-title.tsx +++ b/packages/react/src/components/floating-panel/floating-panel-title.tsx @@ -4,14 +4,14 @@ import { type HTMLProps, type PolymorphicProps, ark } from '../factory' import { useFloatingPanelContext } from './use-floating-panel-context' export interface FloatingPanelTitleBaseProps extends PolymorphicProps {} -export interface FloatingPanelTitleProps extends HTMLProps<'p'>, FloatingPanelTitleBaseProps {} +export interface FloatingPanelTitleProps extends HTMLProps<'h2'>, FloatingPanelTitleBaseProps {} export const FloatingPanelTitle = forwardRef( (props, ref) => { const floatingPanel = useFloatingPanelContext() const mergedProps = mergeProps(floatingPanel.getTitleProps(), props) - return + return }, ) diff --git a/packages/react/src/components/floating-panel/floating-panel.ts b/packages/react/src/components/floating-panel/floating-panel.ts index a7a9ba2b4e..55af52e8c0 100644 --- a/packages/react/src/components/floating-panel/floating-panel.ts +++ b/packages/react/src/components/floating-panel/floating-panel.ts @@ -14,6 +14,10 @@ export { type FloatingPanelContentProps as ContentProps, type FloatingPanelContentBaseProps as ContentBaseProps, } from './floating-panel-content' +export { + FloatingPanelContext as Context, + type FloatingPanelContextProps as ContextProps, +} from './floating-panel-context' export { FloatingPanelDock as Dock, type FloatingPanelDockProps as DockProps, diff --git a/packages/react/src/components/floating-panel/tests/basic.tsx b/packages/react/src/components/floating-panel/tests/basic.tsx index d6efc209e4..a93e1dec0a 100644 --- a/packages/react/src/components/floating-panel/tests/basic.tsx +++ b/packages/react/src/components/floating-panel/tests/basic.tsx @@ -1,32 +1,34 @@ -import { FloatingPanel, type FloatingPanelRootProps } from '../..' +import { FloatingPanel, type FloatingPanelRootProps, Portal } from '../..' export const ComponentUnderTest = (props: FloatingPanelRootProps) => ( Open FloatingPanel - - - - - FloatingPanel Title - minimize window - maximize window - restore window - close window - - - -

Some content

-
- - - - - - - - -
-
+ + + + + + FloatingPanel Title + minimize window + maximize window + restore window + close window + + + +

Some content

+
+ + + + + + + + +
+
+
)