UNPKG

@zag-js/preact

Version:

The preact wrapper for zag

27 lines (22 loc) 1.08 kB
import { MachineSchema, Machine, Service } from '@zag-js/core'; export { mergeProps } from '@zag-js/core'; import * as _zag_js_types from '@zag-js/types'; import { JSX, DOMAttributes, CSSProperties } from 'preact'; import { RefObject, PropsWithChildren } from 'preact/compat'; declare function useMachine<T extends MachineSchema>(machine: Machine<T>, userProps?: Partial<T["props"]>): Service<T>; type WithoutRef<T> = Omit<T, "ref">; type ElementsWithoutRef = { [K in keyof JSX.IntrinsicElements]: WithoutRef<JSX.IntrinsicElements[K]>; }; type PropTypes = ElementsWithoutRef & { element: WithoutRef<DOMAttributes<HTMLElement>>; style: CSSProperties; }; declare const normalizeProps: _zag_js_types.NormalizeProps<PropTypes>; interface PortalProps { disabled?: boolean | undefined; container?: RefObject<HTMLElement> | undefined; getRootNode?: (() => ShadowRoot | Document | Node) | undefined; } declare const Portal: (props: PropsWithChildren<PortalProps>) => JSX.Element; export { Portal, type PortalProps, type PropTypes, normalizeProps, useMachine };