import { t as TableContainers } from "../define-table-dT1Rll2-.js"; import { ContainerRenderProps } from "@portabletext/editor"; import { JSX, ReactNode } from "react"; /** * The pre-wired container definitions: canonical type names and array * fields with the reference renders. Pass to `defineTable` for the * reference UI: * * ```tsx * import {defineTable} from '@portabletext/plugin-table' * import {referenceContainers} from '@portabletext/plugin-table/ui' * * export const table = defineTable({containers: referenceContainers}) * ``` * * @public */ declare const referenceContainers: TableContainers; /** * The strings the chrome renders: aria-labels and tooltips for the * handles, lanes, dots, trash chips, and the menu trigger, plus the * built-in menu's item labels. The `menu-*` keys only render when the * built-in menu does; a `renderMenu` widget carries its own strings. * * @public */ type TableLabels = { 'add-column': string; 'add-row': string; 'column-handle': string; 'delete-column': string; 'delete-row': string; 'insert-here': string; 'menu-delete-table': string; 'menu-header-row': string; 'menu-select-table': string; 'row-handle': string; 'table-options': string; }; type TableMenuHandlers = { hasHeader: boolean; onToggleHeader: () => void; onSelectTable: () => void; onDeleteTable: () => void; }; /** * What the `renderMenu` slot receives: the menu's state and actions. The * widget itself (trigger, popover, items) is entirely consumer-rendered. * * @public */ type TableMenuProps = TableMenuHandlers & { /** Report the widget's open state so the anchor stays visible while open. */ onOpenChange: (open: boolean) => void; }; /** * Per-instance values for the theming custom properties, applied inline to * the plugin's own roots: the in-tree chrome wrapper and the portal * layers. The keys are the same `--pt-plugin-table-*` names the stylesheet * declares defaults for; inline values win over those defaults. Hosts * whose theme is a runtime object (not static CSS) resolve values and pass * them here. * * @public */ type TableTokens = { [key in '--pt-plugin-table-accent' | '--pt-plugin-table-accent-fg' | '--pt-plugin-table-bg' | '--pt-plugin-table-border' | '--pt-plugin-table-boundary-dot' | '--pt-plugin-table-cell-padding' | '--pt-plugin-table-danger' | '--pt-plugin-table-fg' | '--pt-plugin-table-font-family' | '--pt-plugin-table-handle-bg' | '--pt-plugin-table-handle-dots' | '--pt-plugin-table-handle-rest' | '--pt-plugin-table-handle-ring' | '--pt-plugin-table-header-bg' | '--pt-plugin-table-header-weight' | '--pt-plugin-table-lane-bg' | '--pt-plugin-table-lane-bg-hover' | '--pt-plugin-table-lane-icon' | '--pt-plugin-table-lane-icon-hover' | '--pt-plugin-table-menu-bg' | '--pt-plugin-table-menu-border' | '--pt-plugin-table-menu-hover' | '--pt-plugin-table-radius' | '--pt-plugin-table-scrollbar' | '--pt-plugin-table-scrollbar-hover' | '--pt-plugin-table-selected-bg' | '--pt-plugin-table-toggle-knob' | '--pt-plugin-table-toggle-track' | '--pt-plugin-table-toggle-track-on' | '--pt-plugin-table-trash-bg' | '--pt-plugin-table-trash-fg']?: string; }; /** * The reference render for the table container: chrome (handles, lanes, * menu, trash, drag ghost), scroll handling, and selection visuals around the * editable ``. Wire it into the container definition: * * ```tsx * defineContainer({ * type: 'table', * arrayField: 'rows', * render: (props) =>
, * }) * ``` * * The component resolves its table definition (type names, array fields) * from the node it renders, so it works under renamed types without extra * wiring. * * @public */ declare function Table({ attributes, children, node, path, portalElement, renderMenu, icons, labels, tokens }: ContainerRenderProps & { /** * Where the menu and trash layer portal (default `document.body`). Hosts * with their own portal/layer system pass their element so the chrome * joins the host's stacking context and inherits its styling scope. */ portalElement?: HTMLElement | null; /** * Replaces the built-in table menu with a consumer-rendered widget (for * example a host design system's menu button). The plugin keeps ownership * of the anchor position and hover reveal; report the widget's open state * through `onOpenChange` so the anchor stays visible while open. */ renderMenu?: (props: TableMenuProps) => ReactNode; /** * Replaces the built-in drawn icons with the host design system's * (currently the row/column trash chip; the menu's icons travel with * `renderMenu`). */ icons?: { trash?: ReactNode; }; /** * Overrides for the chrome's rendered strings, merged over the English * defaults. Hosts with their own i18n resolve translations and pass the * final strings. */ labels?: Partial; /** * Theming values applied to the plugin's roots, including the portal * layers. See {@link TableTokens}. */ tokens?: TableTokens; }): JSX.Element; /** * The reference render for the `row` container. * * @public */ declare function TableRow({ attributes, children, selected }: ContainerRenderProps): JSX.Element; /** * The reference render for the `cell` container. Cells read the derived * `getTableSelection` (a rectangle) and draw the grey grid + selection * outline + overlay per cell. Position and header state come from resolving * the cell -> row -> table by path. * * @public */ declare function TableCell({ attributes, children, node, path }: ContainerRenderProps): JSX.Element; export { Table, TableCell, type TableLabels, type TableMenuProps, TableRow, type TableTokens, referenceContainers }; //# sourceMappingURL=index.d.ts.map