UNPKG

@kvaser/canking-api

Version:

CanKing API to communicate with the CanKing service using Node.js.

35 lines (34 loc) 1.99 kB
import { type RefCallback } from 'react'; /** * Interface representing a column item that can be used to share width information between different components. * Each ColumnItem contains a resizeRef callback that will be called with the DOM element of the control, allowing * the ColumnItem to manage the width of this control and any other controls that share the same ColumnItem. * The width property can be used to store the current width of the control, which can be used by other components * to ensure they have the same width. */ export interface ColumnItem { /** * A callback function that will be called with the DOM element of the control. This allows the ColumnItem to manage * the width of this control and any other controls that share the same ColumnItem. The callback will be called with * null when the control is unmounted or when the ColumnItemControl using this ColumnItem is unmounted, allowing for cleanup. */ resizeRef: RefCallback<HTMLDivElement>; /** * The current width of the control. This can be used by other components to ensure they have the same width. * The width is managed by the ColumnItemControl that uses this ColumnItem, and will be updated whenever the size * of the control changes. If the width is undefined, it means that the width has not been determined yet, * which can happen when the control is first rendered or if there are issues with measuring the control's size. */ width?: number; } /** * Gets a ColumnItem object that can be used in calls to useColumnItems and as props to ColumnItemControl. * @returns A ColumnItem object */ export declare const useColumnItem: () => ColumnItem; /** * Calculate max width from all specified column items once all items have width values. * @param columnItems - All column items to set width for. * @returns The max width, the width to use */ export declare const useColumnItems: (...columnItems: ColumnItem[]) => number | undefined;