UNPKG

@crossed/ui

Version:

A universal & performant styling library for React Native, Next.js & React

34 lines (29 loc) 831 B
/** * Copyright (c) Paymium. * * This source code is licensed under the MIT license found in the * LICENSE file in the root of this projects source tree. */ import { createScope } from '@crossed/core'; export type FloatingContext = { open: boolean; onClose: () => void; onOpen: () => void; visibilityHidden?: boolean; closeOverlayPress?: boolean; wait?: number; removeScroll: boolean; }; export const [FloatingProvider, useFloatingContext] = createScope<FloatingContext>({} as FloatingContext); type TriggerType = 'onPress' | 'onPointerEnter'; export type FloatingConfig = { triggerStrategy: TriggerType; /** * If false, disable behavior */ enabled?: boolean; portal: boolean; }; export const [FloatingConfigProvider, useFloatingConfig] = createScope<FloatingConfig>({} as FloatingConfig);