import { SvelteComponentTyped } from "svelte"; import type { SvelteHTMLElements } from "svelte/elements"; type $RestProps = SvelteHTMLElements["button"]; type $Props = { /** * Specify the type of tag. * @default "gray" */ type?: "red" | "magenta" | "purple" | "blue" | "cyan" | "teal" | "green" | "gray" | "cool-gray" | "warm-gray"; /** * Specify the size of the tag. * Defaults to `"default"`, or to the `size` of a parent `TagSet`. * Also accepts Carbon v11's `"md"` (`"default"`). */ size?: "xs" | "sm" | "default" | "lg" | "md" | undefined; /** * Set to `true` to disable the tag * @default false */ disabled?: boolean; /** * Specify the icon to render. */ icon?: Icon | undefined; /** * Set to `true` to open the popover. * @default false */ open?: boolean; /** * Set the alignment of the popover relative to the tag. * `start` and `end` name inline sides, so they swap under `dir="rtl"`. * @default "start" */ align?: "start" | "center" | "end"; /** * Set the direction of the popover relative to the tag. * @default "bottom" */ direction?: "top" | "bottom"; /** * Set to `true` to always render the popover in a portal, or `false` to * keep it in place. Left unset, the popover moves to a portal inside a * `Modal`, or when a box around it (`overflow` other than `visible`) would * cut it off. */ portalTooltip?: boolean | undefined; /** * Set an id for the tag. * The popover id derives from it as `{id}-content`. * @default uniqueId() */ id?: string; /** * Obtain a reference to the tag's button element. * @default null */ ref?: null | HTMLButtonElement; /** * Obtain a reference to the popover content element. * @default null */ contentRef?: null | HTMLDivElement; /** The popover content. */ content?: (this: void) => void; children?: (this: void) => void; [key: `data-${string}`]: unknown; }; export type OperationalTagProps = Omit<$RestProps, keyof $Props> & $Props; export default class OperationalTag extends SvelteComponentTyped< OperationalTagProps, { click: WindowEventMap["click"]; close: CustomEvent; mouseenter: WindowEventMap["mouseenter"]; mouseleave: WindowEventMap["mouseleave"]; mouseover: WindowEventMap["mouseover"]; /** * A tag that discloses related content, such as more tags, in a popover. * The whole tag is the trigger. Without `content`, it's a plain action * button; handle `on:click`. */ open: CustomEvent; }, { default: Record; /** The popover content. */ content: Record; /** Override the tag icon. */ icon: Record; } > {}