UNPKG

@loke/ui

Version:
34 lines (33 loc) 1.46 kB
import { type Scope } from "@loke/ui/context"; import { type Slot } from "@loke/ui/slot"; import React from "react"; type SlotProps = React.ComponentPropsWithoutRef<typeof Slot>; type CollectionElement = HTMLElement; interface CollectionProps extends SlotProps { scope: any; } declare function createCollection<ItemElement extends HTMLElement, ItemData = {}>(name: string): readonly [{ readonly ItemSlot: React.ForwardRefExoticComponent<React.PropsWithoutRef<ItemData & { children: React.ReactNode; scope: Scope<{ collectionRef: React.RefObject<CollectionElement | null>; itemMap: Map<React.RefObject<ItemElement | null>, { ref: React.RefObject<ItemElement | null>; } & ItemData>; } | undefined>; }> & React.RefAttributes<ItemElement>>; readonly Provider: React.FC<{ children?: React.ReactNode; scope: Scope<{ collectionRef: React.RefObject<CollectionElement | null>; itemMap: Map<React.RefObject<ItemElement | null>, { ref: React.RefObject<ItemElement | null>; } & ItemData>; }>; }>; readonly Slot: React.ForwardRefExoticComponent<CollectionProps & React.RefAttributes<HTMLElement>>; }, (scope: any) => () => ({ ref: React.RefObject<ItemElement | null>; } & ItemData)[], import("@loke/ui/context").CreateScope]; export { createCollection }; export type { CollectionProps };