import { SvelteComponentTyped } from "svelte"; import type { SvelteHTMLElements } from "svelte/elements"; export type StructuredListCellTranslationId = "columnSortAscending" | "columnSortDescending"; type $RestProps = SvelteHTMLElements["div"]; type $Props = { /** * Set to `true` to use as a header * @default false */ head?: boolean; /** * Set to `true` to prevent wrapping * @default false */ noWrap?: boolean; /** * Set to `true` to render the header cell as a sortable column button. * Only applies when `head` is `true`. * @default false */ sortable?: boolean; /** * Specify the sort direction. * Only used when `sortable` is `true`. * @default "none" */ sortDirection?: "none" | "ascending" | "descending"; /** * Set to `true` when this column is the active sort key * @default false */ active?: boolean; /** * Set to `true` to only toggle between "ascending" and "descending" * sort directions, skipping "none", when computing the `sort` event. * Only used when `sortable` is `true`. * @default false */ sortAlways?: boolean; /** * Override the default translation ids. * Only used when `sortable` is `true`. * @default (id) => defaultTranslations[id] */ translateWithId?: (id: StructuredListCellTranslationId) => string; children?: (this: void) => void; [key: `data-${string}`]: unknown; }; export type StructuredListCellProps = Omit<$RestProps, keyof $Props> & $Props; export default class StructuredListCell extends SvelteComponentTyped< StructuredListCellProps, { click: WindowEventMap["click"]; mouseenter: WindowEventMap["mouseenter"]; mouseleave: WindowEventMap["mouseleave"]; mouseover: WindowEventMap["mouseover"]; /** Dispatched when the sortable header button is clicked, with the next direction in the sort cycle. */ sort: CustomEvent<{ direction: "none" | "ascending" | "descending" }>; }, { default: Record } > { /** * Default translation ids */ translationIds: { columnSortAscending: "columnSortAscending"; columnSortDescending: "columnSortDescending" }; }