UNPKG

@dvcol/neo-svelte

Version:

Neomorphic ui library for svelte 5

59 lines (58 loc) 2.24 kB
import type { MouseEventHandler } from 'svelte/elements'; import type { NeoConfirmProps } from '../common/neo-confirm.model.js'; import type { NeoTooltipProps } from './neo-tooltip.model.js'; export type NeoPopConfirmProps = { /** * Element(s) to render inside the trigger. */ children?: NeoTooltipProps['children']; /** * Element(s) to render inside the tooltip once open. */ tooltip?: NeoTooltipProps['children'] | string; /** * Element(s) to render inside the header once open. */ header?: NeoTooltipProps['children'] | string; /** * The loading state of the confirm & cancel buttons. */ loading?: { confirm?: boolean; cancel?: boolean; }; /** * The disabled state of the confirm & cancel buttons. */ disabled?: boolean | { confirm?: boolean; cancel?: boolean; }; /** * Optional ref to the tooltip. */ tooltipRef?: NeoTooltipProps['ref']; /** * Whether the tooltip can be dismissed and a close button shown. * * @default true */ closable?: NeoTooltipProps['closeOnDismiss']; /** * Event Handlers that fires on cancel. * If a promise is returned, the loading state will be set to true until the promise resolves. * If the function rejects, the tooltip will not close. */ onCancel?: MouseEventHandler<HTMLButtonElement>; /** * Event Handlers that fires on confirm. * If a promise is returned, the loading state will be set to true until the promise resolves. * If the promise rejects, the tooltip will not close. * @param e */ onConfirm?: MouseEventHandler<HTMLButtonElement>; /** * Optional props to pass to the tooltip. */ tooltipProps?: Omit<NeoTooltipProps, 'ref' | 'triggerRef' | 'open' | 'children'>; } & Pick<NeoTooltipProps, 'triggerRef' | 'open' | 'position' | 'target' | 'openDelay' | 'hoverDelay' | 'openOnFocus' | 'openOnHover' | 'openOnClick' | 'color' | 'filled' | 'tinted' | 'rounded' | 'elevation' | 'flex' | 'align' | 'justify' | 'width' | 'height' | 'padding' | 'in' | 'out' | 'transition' | 'use' | 'onOpen' | 'onClose'> & Omit<NeoConfirmProps, 'children' | 'header'>;