import { SvelteComponentTyped } from "svelte"; import type { SvelteHTMLElements } from "svelte/elements"; type $RestProps = SvelteHTMLElements["li"]; type $Props = { /** * Specify the kind of option. * @default "default" */ kind?: "default" | "danger"; /** * Set to `true` to enable the disabled state * @default false */ disabled?: boolean; /** * Set to `true` to indent the label. * Rendered indented regardless when `icon` is set, or when the option is selectable or part of a radio group. * @default false */ indented?: boolean; /** * Specify the icon to render. * Icon is rendered to the left of the label text. * Overridden with a checkmark icon when the option is selectable or part of a radio group. */ icon?: Icon | undefined; /** * Specify the label text. * Alternatively, use the "labelChildren" slot. * @example * ```svelte * * Custom Label * * ``` * @default "" */ labelText?: string; /** * Set to `true` to use the selected variant. * @default false */ selected?: boolean; /** * Set to `true` to enable the selectable variant. * Automatically set to `true` if `selected` is `true`. * @default false */ selectable?: boolean; /** * Specify the shortcut text. * Alternatively, use the "shortcutChildren" slot. * @example * ```svelte * * Ctrl+K * * ``` * @default "" */ shortcutText?: string; /** * Specify a keyboard shortcut to show, such as `"mod+s"`. `mod` is * Command on Apple platforms and Ctrl elsewhere. The keys show where * `shortcutText` goes, and the item gets `aria-keyshortcuts`. Display only: * bind the command itself with `onShortcut`, since the menu is usually * closed. `shortcutText` and its slot take precedence. A value that isn't * a shortcut, such as `"Ctrl C"`, shows as written. * @default "" */ shortcut?: string; /** * Specify the id. * It's recommended to provide an id as a value to bind to within a selectable/radio menu group. * @default uniqueId() */ id?: string; /** * Obtain a reference to the list item HTML element. * @default null */ ref?: null | HTMLLIElement; labelChildren?: (this: void) => void; /** Custom shortcut content. Replaces `shortcutText` and `shortcut`. */ shortcutChildren?: (this: void) => void; children?: (this: void) => void; [key: `data-${string}`]: unknown; }; export type ContextMenuOptionProps = Omit<$RestProps, keyof $Props> & $Props; export default class ContextMenuOption extends SvelteComponentTyped< ContextMenuOptionProps, { /** * Dispatched on selection. Cancelable: call `preventDefault()` to keep * this menu level open. A selectable or radio option's selection still * updates. */ click: CustomEvent; keydown: WindowEventMap["keydown"]; mouseenter: WindowEventMap["mouseenter"]; mouseleave: WindowEventMap["mouseleave"]; }, { default: Record; icon: Record; labelChildren: Record; /** Custom shortcut content. Replaces `shortcutText` and `shortcut`. */ shortcutChildren: Record; /** * @deprecated use the `shortcutChildren` slot */ shortcutText: Record; } > {}