@clickhouse/click-ui 0.0.147 → 0.0.148

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16987,7 +16987,7 @@ const Column = ({
16987
16987
  const isSelected = selectionType === "selectDirect";
16988
16988
  const isSelectedLeft = (leftSelectionType === "selectDirect" || isSelected) && leftSelectionType !== selectionType;
16989
16989
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(HeaderCellContainer, { $width: columnWidth(columnIndex), $columnPosition: columnPosition, $height: height, "data-header": columnIndex, children: [
16990
- /* @__PURE__ */ jsxRuntimeExports.jsx(StyledCell, { $type: "header", as: cell, columnIndex, type: "header-cell", $isFirstColumn: isFirstColumn, $selectionType: selectionType, $isLastColumn: isLastColumn, $isFocused: false, $isSelectedLeft: isSelectedLeft, $isSelectedTop: isSelected, $isLastRow: false, $isFirstRow: true, $height: height, "data-grid-row": -1, "data-grid-column": columnIndex, "data-selected": isSelected, $showBorder: showBorder }),
16990
+ /* @__PURE__ */ jsxRuntimeExports.jsx(StyledCell, { $type: "header", as: cell, columnIndex, type: "header-cell", $isFirstColumn: isFirstColumn, $selectionType: selectionType, $isLastColumn: isLastColumn, $isFocused: false, $isSelectedLeft: isSelectedLeft, $isSelectedTop: isSelected, $isLastRow: false, $isFirstRow: true, $height: height, "data-grid-row": -1, "data-grid-column": columnIndex, "data-selected": isSelected, $showBorder: showBorder, width: columnWidth(columnIndex) }),
16991
16991
  /* @__PURE__ */ jsxRuntimeExports.jsx(ColumnResizer, { height, onColumnResize, columnIndex, setResizeCursorPosition })
16992
16992
  ] });
16993
16993
  };
@@ -31359,6 +31359,7 @@ const addCellToRow = (row, cell, rowIndex, columnIndex) => {
31359
31359
  const html = renderToStaticMarkup(createElement$1(cell, {
31360
31360
  rowIndex,
31361
31361
  columnIndex,
31362
+ width: 1e3,
31362
31363
  type: "row-cell"
31363
31364
  }));
31364
31365
  td.innerHTML = html;
@@ -32072,11 +32073,15 @@ const Grid = forwardRef(({
32072
32073
  lastRowStart.current = rowStart;
32073
32074
  }
32074
32075
  }, [rowStart, onItemsRendered]);
32076
+ const CellWithWidth = (args) => {
32077
+ const width = columnWidth(args.columnIndex);
32078
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Cell, { ...args, width });
32079
+ };
32075
32080
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(ContextMenu, { modal: false, onOpenChange: setContextMenuOpen, children: [
32076
32081
  /* @__PURE__ */ jsxRuntimeExports.jsx(ContextMenuTrigger, { as: ContextMenu.Trigger, ref: mergeRefs([forwardedRef, containerRef]), tabIndex: 0, onMouseDown, onMouseMove, onKeyDown, onPointerDown, onPointerUp, onPointerLeave: setPointerCapture, onPointerEnter: setPointerCapture, onContextMenu, $rounded: rounded, $height: autoHeight ? rowCount * rowHeight + (showHeader ? headerHeight : 0) + elementBorderRef.current.scrollBarHeight : void 0, $showBorder: showBorder, children: /* @__PURE__ */ jsxRuntimeExports.jsx(AutoSizer, { onResize, children: ({
32077
32082
  height,
32078
32083
  width
32079
- }) => /* @__PURE__ */ jsxRuntimeExports.jsx(VariableSizeGrid, { ref: forwardedGridRef ? mergeRefs([forwardedGridRef, gridRef]) : gridRef, height, width, columnCount, rowHeight: () => rowHeight, useIsScrolling, innerElementType: InnerElementType, itemData: data, initialScrollTop: focus.row < rowStart ? focus.row * rowHeight : (focus.row - rowStart) * rowHeight, initialScrollLeft: getColumnHorizontalPosition(focus.column), columnWidth, rowCount, onScroll, outerRef, outerElementType: OuterElementType, onItemsRendered, ...props, children: Cell }) }) }),
32084
+ }) => /* @__PURE__ */ jsxRuntimeExports.jsx(VariableSizeGrid, { ref: forwardedGridRef ? mergeRefs([forwardedGridRef, gridRef]) : gridRef, height, width, columnCount, rowHeight: () => rowHeight, useIsScrolling, innerElementType: InnerElementType, itemData: data, initialScrollTop: focus.row < rowStart ? focus.row * rowHeight : (focus.row - rowStart) * rowHeight, initialScrollLeft: getColumnHorizontalPosition(focus.column), columnWidth, rowCount, onScroll, outerRef, outerElementType: OuterElementType, onItemsRendered, ...props, children: CellWithWidth }) }) }),
32080
32085
  /* @__PURE__ */ jsxRuntimeExports.jsx(ContextMenu.Content, { children: menuOptions.map((option2, index2) => /* @__PURE__ */ jsxRuntimeExports.jsx(ContextMenu.Item, { onSelect: option2.onSelect, children: option2.label }, `grid-${index2}`)) })
32081
32086
  ] });
32082
32087
  });
@@ -17004,7 +17004,7 @@ var __publicField = (obj, key, value) => {
17004
17004
  const isSelected = selectionType === "selectDirect";
17005
17005
  const isSelectedLeft = (leftSelectionType === "selectDirect" || isSelected) && leftSelectionType !== selectionType;
17006
17006
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(HeaderCellContainer, { $width: columnWidth(columnIndex), $columnPosition: columnPosition, $height: height, "data-header": columnIndex, children: [
17007
- /* @__PURE__ */ jsxRuntimeExports.jsx(StyledCell, { $type: "header", as: cell, columnIndex, type: "header-cell", $isFirstColumn: isFirstColumn, $selectionType: selectionType, $isLastColumn: isLastColumn, $isFocused: false, $isSelectedLeft: isSelectedLeft, $isSelectedTop: isSelected, $isLastRow: false, $isFirstRow: true, $height: height, "data-grid-row": -1, "data-grid-column": columnIndex, "data-selected": isSelected, $showBorder: showBorder }),
17007
+ /* @__PURE__ */ jsxRuntimeExports.jsx(StyledCell, { $type: "header", as: cell, columnIndex, type: "header-cell", $isFirstColumn: isFirstColumn, $selectionType: selectionType, $isLastColumn: isLastColumn, $isFocused: false, $isSelectedLeft: isSelectedLeft, $isSelectedTop: isSelected, $isLastRow: false, $isFirstRow: true, $height: height, "data-grid-row": -1, "data-grid-column": columnIndex, "data-selected": isSelected, $showBorder: showBorder, width: columnWidth(columnIndex) }),
17008
17008
  /* @__PURE__ */ jsxRuntimeExports.jsx(ColumnResizer, { height, onColumnResize, columnIndex, setResizeCursorPosition })
17009
17009
  ] });
17010
17010
  };
@@ -31376,6 +31376,7 @@ var __publicField = (obj, key, value) => {
31376
31376
  const html = renderToStaticMarkup(React.createElement(cell, {
31377
31377
  rowIndex,
31378
31378
  columnIndex,
31379
+ width: 1e3,
31379
31380
  type: "row-cell"
31380
31381
  }));
31381
31382
  td.innerHTML = html;
@@ -32089,11 +32090,15 @@ var __publicField = (obj, key, value) => {
32089
32090
  lastRowStart.current = rowStart;
32090
32091
  }
32091
32092
  }, [rowStart, onItemsRendered]);
32093
+ const CellWithWidth = (args) => {
32094
+ const width = columnWidth(args.columnIndex);
32095
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Cell, { ...args, width });
32096
+ };
32092
32097
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(ContextMenu, { modal: false, onOpenChange: setContextMenuOpen, children: [
32093
32098
  /* @__PURE__ */ jsxRuntimeExports.jsx(ContextMenuTrigger, { as: ContextMenu.Trigger, ref: mergeRefs([forwardedRef, containerRef]), tabIndex: 0, onMouseDown, onMouseMove, onKeyDown, onPointerDown, onPointerUp, onPointerLeave: setPointerCapture, onPointerEnter: setPointerCapture, onContextMenu, $rounded: rounded, $height: autoHeight ? rowCount * rowHeight + (showHeader ? headerHeight : 0) + elementBorderRef.current.scrollBarHeight : void 0, $showBorder: showBorder, children: /* @__PURE__ */ jsxRuntimeExports.jsx(AutoSizer, { onResize, children: ({
32094
32099
  height,
32095
32100
  width
32096
- }) => /* @__PURE__ */ jsxRuntimeExports.jsx(VariableSizeGrid, { ref: forwardedGridRef ? mergeRefs([forwardedGridRef, gridRef]) : gridRef, height, width, columnCount, rowHeight: () => rowHeight, useIsScrolling, innerElementType: InnerElementType, itemData: data, initialScrollTop: focus.row < rowStart ? focus.row * rowHeight : (focus.row - rowStart) * rowHeight, initialScrollLeft: getColumnHorizontalPosition(focus.column), columnWidth, rowCount, onScroll, outerRef, outerElementType: OuterElementType, onItemsRendered, ...props, children: Cell }) }) }),
32101
+ }) => /* @__PURE__ */ jsxRuntimeExports.jsx(VariableSizeGrid, { ref: forwardedGridRef ? mergeRefs([forwardedGridRef, gridRef]) : gridRef, height, width, columnCount, rowHeight: () => rowHeight, useIsScrolling, innerElementType: InnerElementType, itemData: data, initialScrollTop: focus.row < rowStart ? focus.row * rowHeight : (focus.row - rowStart) * rowHeight, initialScrollLeft: getColumnHorizontalPosition(focus.column), columnWidth, rowCount, onScroll, outerRef, outerElementType: OuterElementType, onItemsRendered, ...props, children: CellWithWidth }) }) }),
32097
32102
  /* @__PURE__ */ jsxRuntimeExports.jsx(ContextMenu.Content, { children: menuOptions.map((option, index2) => /* @__PURE__ */ jsxRuntimeExports.jsx(ContextMenu.Item, { onSelect: option.onSelect, children: option.label }, `grid-${index2}`)) })
32098
32103
  ] });
32099
32104
  });
@@ -1,4 +1,8 @@
1
1
  import { GridChildComponentProps } from 'react-window';
2
2
  import { ItemDataType } from './types';
3
3
 
4
- export declare const Cell: import('react').MemoExoticComponent<({ data, rowIndex, columnIndex, style, ...props }: GridChildComponentProps<ItemDataType>) => import("react/jsx-runtime").JSX.Element>;
4
+ type CellProps = GridChildComponentProps<ItemDataType> & {
5
+ width: number;
6
+ };
7
+ export declare const Cell: import('react').MemoExoticComponent<({ data, rowIndex, columnIndex, style, ...props }: CellProps) => import("react/jsx-runtime").JSX.Element>;
8
+ export {};
@@ -9,10 +9,12 @@ interface CellCommonProps extends HTMLAttributes<HTMLElement> {
9
9
  interface CellHeaderProps extends CellCommonProps {
10
10
  rowIndex?: never;
11
11
  type: "header-cell";
12
+ width: number;
12
13
  }
13
14
  interface CellBodyProps extends CellCommonProps {
14
15
  rowIndex: number;
15
16
  type: "row-cell";
17
+ width: number;
16
18
  }
17
19
  type CellComponentProps = CellHeaderProps | CellBodyProps;
18
20
  export type CellProps = ComponentType<CellComponentProps>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clickhouse/click-ui",
3
- "version": "0.0.147",
3
+ "version": "v0.0.148",
4
4
  "description": "Official ClickHouse design system react library",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -32,6 +32,7 @@
32
32
  "test": "vitest",
33
33
  "dev": "vite",
34
34
  "generate-tokens": "node build-tokens.js",
35
+ "typecheck": "tsc --noEmit",
35
36
  "build": "tsc && vite build",
36
37
  "build:watch": "watch 'npm run build' ./src",
37
38
  "lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",