@clickhouse/click-ui 0.0.170 → 0.0.172

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.
@@ -217,6 +217,7 @@ const FolderOpen = (props) => /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w
217
217
  ] });
218
218
  const FolderClosed = (props) => /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", ...props, children: /* @__PURE__ */ jsx("path", { stroke: "#161517", strokeWidth: 1.5, d: "M19 19H3C2.44772 19 2 18.5523 2 18V6C2 5.44772 2.44772 5 3 5H6.62869C6.98835 5 7.32032 5.19315 7.49805 5.50583L8.34405 6.99417C8.52179 7.30685 8.85375 7.5 9.21342 7.5H19C19.5523 7.5 20 7.94772 20 8.5V9.5V18C20 18.5523 19.5523 19 19 19Z" }) });
219
219
  const Gift = (props) => /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", ...props, children: /* @__PURE__ */ jsx("path", { fill: "#161517", stroke: "#161517", strokeWidth: 0.6, d: "M19.306 6.276h-3.704a2.52 2.52 0 0 0 .752-1.805C16.354 3.11 15.296 2 13.997 2c-.937 0-1.745.578-2.125 1.41-.386-.56-1.013-.928-1.722-.928-1.172 0-2.126 1-2.126 2.23 0 .61.234 1.161.612 1.564H4.694C3.76 6.276 3 7.073 3 8.053v1.285c0 .919.67 1.677 1.523 1.767v8.64c0 1.244.964 2.255 2.15 2.255h10.655c1.185 0 2.149-1.011 2.149-2.254v-8.641c.854-.09 1.523-.848 1.523-1.767V8.052c0-.979-.76-1.776-1.694-1.776Zm-7.03-1.805c0-.995.772-1.804 1.721-1.804.949 0 1.72.81 1.72 1.804 0 .996-.771 1.805-1.72 1.805h-1.72V4.471Zm-3.617.242c0-.862.669-1.564 1.49-1.564.823 0 1.492.702 1.492 1.564v1.563H10.15c-.822 0-1.49-.701-1.49-1.563ZM3.635 9.338V8.052c0-.611.475-1.11 1.058-1.11h5.457l1.532.001v3.504H4.693c-.583 0-1.058-.498-1.058-1.11ZM5.16 19.746v-8.632h6.523v10.22h-5.01c-.834 0-1.513-.713-1.513-1.588Zm13.682 0c0 .875-.679 1.588-1.514 1.588h-5.01v-10.22h6.525v8.632Zm1.523-10.408c0 .612-.474 1.11-1.057 1.11h-6.99V6.942h6.99c.583 0 1.058.498 1.058 1.11v1.285Z" }) });
220
+ const Globe = (props) => /* @__PURE__ */ jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsx("path", { d: "M21 12C21 16.9706 16.9706 21 12 21M21 12C21 7.02944 16.9706 3 12 3M21 12H3M12 21C7.02944 21 3 16.9706 3 12M12 21C14.2512 18.5355 15.5305 15.3372 15.6 12C15.5305 8.66283 14.2512 5.46452 12 3M12 21C9.74885 18.5355 8.46952 15.3372 8.4 12C8.46952 8.66283 9.74885 5.46452 12 3M3 12C3 7.02944 7.02944 3 12 3", stroke: "white", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
220
221
  const Home = (props) => /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", ...props, children: [
221
222
  /* @__PURE__ */ jsx("path", { stroke: "#161517", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M4 8.6V21h16V8.6" }),
222
223
  /* @__PURE__ */ jsx("path", { stroke: "#161517", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "m2 10 10-7 10 7M15 21v-6a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v6" })
@@ -389,8 +390,13 @@ const Speed = (props) => /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org
389
390
  /* @__PURE__ */ jsx("path", { stroke: "#161517", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M12.007 10.313A1.69 1.69 0 0 1 13.688 12v.008a1.689 1.689 0 1 1-1.681-1.695M10.807 13.194l-1.25 1.25M16.202 7.798 13.201 10.8" }),
390
391
  /* @__PURE__ */ jsx("path", { stroke: "#161517", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M18.367 5.634A9.004 9.004 0 1 1 12 2.997v3" })
391
392
  ] });
393
+ const Square = (props) => /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", ...props, children: /* @__PURE__ */ jsx("rect", { x: "3.75", y: "3.75", width: "16.5", height: "16.5", rx: "1.25", stroke: "white", strokeWidth: "1.5" }) });
392
394
  const Star = (props) => /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", ...props, children: /* @__PURE__ */ jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M12 2.896L14.935 8.889L21.5 9.856L16.75 14.518L17.871 21.104L12 17.993L6.129 21.104L7.25 14.518L2.5 9.856L9.064 8.889L12 2.896Z", stroke: "#161517", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
393
- const Stop = (props) => /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", ...props, children: /* @__PURE__ */ jsx("rect", { x: "3.75", y: "3.75", width: "16.5", height: "16.5", rx: "1.25", stroke: "white", strokeWidth: "1.5" }) });
395
+ const Stop = (props) => /* @__PURE__ */ jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
396
+ /* @__PURE__ */ jsx("mask", { id: "path-1-inside-1_9731_929", fill: "white", children: /* @__PURE__ */ jsx("rect", { x: "9", y: "9", width: "6", height: "6", rx: "0.4" }) }),
397
+ /* @__PURE__ */ jsx("rect", { x: "9", y: "9", width: "6", height: "6", rx: "0.4", fill: "white", stroke: "white", strokeWidth: "3", mask: "url(#path-1-inside-1_9731_929)" }),
398
+ /* @__PURE__ */ jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M12 21V21C7.029 21 3 16.971 3 12V12C3 7.029 7.029 3 12 3V3C16.971 3 21 7.029 21 12V12C21 16.971 16.971 21 12 21Z", stroke: "white", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
399
+ ] });
394
400
  const Support = (props) => /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", ...props, children: [
395
401
  /* @__PURE__ */ jsx("path", { stroke: "#161517", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M16 18H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2Z", clipRule: "evenodd" }),
396
402
  /* @__PURE__ */ jsx("path", { stroke: "#161517", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M10.467 11.504v-.207c0-.678.419-1.045.839-1.327.41-.276.82-.636.82-1.3a1.659 1.659 0 0 0-3.318 0M10.466 13.843a.148.148 0 0 0-.15.15.15.15 0 1 0 .15-.15" }),
@@ -738,6 +744,7 @@ const ICONS_MAP = {
738
744
  "folder-open": FolderOpen,
739
745
  gear: Gear,
740
746
  gift: Gift,
747
+ globe: Globe,
741
748
  "git-merge": GitMerge,
742
749
  history: HistoryIcon,
743
750
  home: Home,
@@ -791,6 +798,7 @@ const ICONS_MAP = {
791
798
  sparkle: Sparkle,
792
799
  speaker: Speaker,
793
800
  speed: Speed,
801
+ square: Square,
794
802
  star: Star,
795
803
  stop: Stop,
796
804
  support: Support,
@@ -16906,9 +16914,46 @@ function throttle$1(func, wait, options) {
16906
16914
  }
16907
16915
  var throttle_1 = throttle$1;
16908
16916
  const throttle$2 = /* @__PURE__ */ getDefaultExportFromCjs(throttle_1);
16917
+ const initialPosition = {
16918
+ left: "calc(100% - 4px)",
16919
+ top: "0"
16920
+ };
16921
+ const useResizingState = () => {
16922
+ const [pressedColumnIndex, setPressedColumnIndex] = useState(-1);
16923
+ const [pointer, setPointer] = useState(null);
16924
+ const [position, setPosition] = useState(initialPosition);
16925
+ const [lastPressedTimestamp, setLastPressedTimestamp] = useState(0);
16926
+ const getIsPressed = useCallback((columnIndex) => {
16927
+ return pressedColumnIndex === columnIndex;
16928
+ }, [pressedColumnIndex]);
16929
+ const setIsPressed = useCallback((columnIndex, pressed) => {
16930
+ if (pressed) {
16931
+ setPressedColumnIndex(columnIndex);
16932
+ setLastPressedTimestamp(Date.now());
16933
+ } else {
16934
+ setPressedColumnIndex(-1);
16935
+ }
16936
+ }, []);
16937
+ const getPosition = useCallback((columnIndex) => {
16938
+ if (pressedColumnIndex !== columnIndex) {
16939
+ return initialPosition;
16940
+ }
16941
+ return position;
16942
+ }, [position, pressedColumnIndex]);
16943
+ return {
16944
+ pointer,
16945
+ setPointer,
16946
+ getIsPressed,
16947
+ setIsPressed,
16948
+ getPosition,
16949
+ setPosition,
16950
+ lastPressedTimestamp
16951
+ };
16952
+ };
16953
+ const DOUBLE_CLICK_THRESHOLD_MSEC = 300;
16909
16954
  const ResizeSpan = styled.div.withConfig({
16910
16955
  componentId: "sc-1r6e5v3-0"
16911
- })(["top:0;left:calc(100% - 4px);z-index:1;position:absolute;height:", "px;cursor:col-resize;width:4px;overflow:auto;&:hover,&:active,&:hover{background:", ";}", ""], ({
16956
+ })(["top:", ";left:", ";z-index:1;position:absolute;height:", "px;cursor:col-resize;width:4px;overflow:auto;&:hover,&:active,&:hover{background:", ";}", ""], initialPosition.top, initialPosition.left, ({
16912
16957
  $height
16913
16958
  }) => $height, ({
16914
16959
  theme: theme2
@@ -16922,67 +16967,87 @@ const ColumnResizer = ({
16922
16967
  height,
16923
16968
  onColumnResize: onColumnResizeProp,
16924
16969
  columnIndex,
16925
- setResizeCursorPosition
16970
+ getResizerPosition,
16971
+ columnWidth,
16972
+ resizingState
16926
16973
  }) => {
16927
16974
  const resizeRef = useRef(null);
16928
- const pointerRef = useRef(null);
16929
- const [isPressed, setIsPressed] = useState(false);
16975
+ const {
16976
+ pointer,
16977
+ setPointer,
16978
+ getIsPressed,
16979
+ setIsPressed,
16980
+ getPosition,
16981
+ setPosition,
16982
+ lastPressedTimestamp
16983
+ } = resizingState;
16984
+ const isPressed = getIsPressed(columnIndex);
16985
+ const position = getPosition(columnIndex);
16930
16986
  const onColumnResize = throttle$2(onColumnResizeProp, 1e3);
16931
- const onMouseDown = useCallback((e) => {
16932
- e.preventDefault();
16933
- e.stopPropagation();
16934
- setIsPressed(true);
16935
- if (e.detail > 1) {
16936
- onColumnResize(columnIndex, 0, "auto");
16987
+ useEffect(() => {
16988
+ const control = resizeRef.current;
16989
+ if (!isPressed || !control || !pointer) {
16990
+ return;
16937
16991
  }
16938
- }, [columnIndex, onColumnResize, setIsPressed]);
16939
- const onMouseUp = useCallback((e) => {
16940
- e.stopPropagation();
16941
- setIsPressed(false);
16942
- }, [setIsPressed]);
16992
+ const pointerId = pointer.pointerId;
16993
+ try {
16994
+ control.setPointerCapture(pointerId);
16995
+ return () => {
16996
+ if (control.hasPointerCapture(pointerId)) {
16997
+ control.releasePointerCapture(pointerId);
16998
+ }
16999
+ };
17000
+ } catch (e) {
17001
+ console.error(e);
17002
+ }
17003
+ }, [pointer, isPressed, columnIndex]);
16943
17004
  const onPointerDown = useCallback((e) => {
16944
17005
  e.stopPropagation();
17006
+ e.preventDefault();
16945
17007
  if (resizeRef.current) {
16946
- resizeRef.current.setPointerCapture(e.pointerId);
16947
- const header = resizeRef.current.closest(`[data-header="${columnIndex}"]`);
16948
- if (header) {
16949
- pointerRef.current = {
16950
- pointerId: e.pointerId,
16951
- initialClientX: e.clientX,
16952
- width: header.clientWidth
16953
- };
16954
- setResizeCursorPosition(resizeRef.current, e.clientX, header.clientWidth, columnIndex);
17008
+ if (lastPressedTimestamp > Date.now() - DOUBLE_CLICK_THRESHOLD_MSEC) {
17009
+ onColumnResize(columnIndex, 0, "auto");
16955
17010
  }
17011
+ setPointer({
17012
+ pointerId: e.pointerId,
17013
+ initialClientX: e.clientX,
17014
+ width: columnWidth
17015
+ });
17016
+ setIsPressed(columnIndex, true);
17017
+ const pos = getResizerPosition(e.clientX, columnWidth, columnIndex);
17018
+ setPosition(pos);
16956
17019
  }
16957
- }, [columnIndex, setResizeCursorPosition]);
16958
- const onMouseMove = useCallback((e) => {
17020
+ }, [lastPressedTimestamp, setPointer, columnWidth, setIsPressed, columnIndex, getResizerPosition, setPosition, onColumnResize]);
17021
+ const onPointerMove = useCallback((e) => {
16959
17022
  e.stopPropagation();
16960
- if (resizeRef.current && pointerRef.current) {
16961
- const header = resizeRef.current.closest(`[data-header="${columnIndex}"]`);
16962
- if (header) {
16963
- resizeRef.current.setPointerCapture(pointerRef.current.pointerId);
16964
- const width = header.clientWidth + (e.clientX - pointerRef.current.initialClientX);
16965
- setResizeCursorPosition(resizeRef.current, e.clientX, width, columnIndex);
16966
- pointerRef.current.width = Math.max(width, 50);
16967
- }
17023
+ e.preventDefault();
17024
+ if (isPressed && pointer) {
17025
+ const width = columnWidth + (e.clientX - pointer.initialClientX);
17026
+ const pos = getResizerPosition(e.clientX, width, columnIndex);
17027
+ setPosition(pos);
17028
+ pointer.width = Math.max(width, 50);
16968
17029
  }
16969
- }, [columnIndex, setResizeCursorPosition]);
17030
+ }, [pointer, isPressed, columnWidth, getResizerPosition, columnIndex, setPosition]);
16970
17031
  return /* @__PURE__ */ jsx(ResizeSpan, { ref: resizeRef, $height: height, $isPressed: isPressed, onPointerDown, onPointerUp: (e) => {
16971
- var _a, _b;
16972
17032
  e.preventDefault();
16973
17033
  e.stopPropagation();
16974
17034
  if (resizeRef.current && // 0 is a valid pointerId in Firefox
16975
- (((_a = pointerRef.current) == null ? void 0 : _a.pointerId) || ((_b = pointerRef.current) == null ? void 0 : _b.pointerId) === 0)) {
16976
- resizeRef.current.releasePointerCapture(pointerRef.current.pointerId);
16977
- const shouldCallResize = e.clientX !== pointerRef.current.initialClientX;
17035
+ ((pointer == null ? void 0 : pointer.pointerId) || (pointer == null ? void 0 : pointer.pointerId) === 0)) {
17036
+ const shouldCallResize = e.clientX !== pointer.initialClientX;
16978
17037
  if (shouldCallResize) {
16979
- onColumnResize(columnIndex, pointerRef.current.width, "manual");
17038
+ onColumnResize(columnIndex, pointer.width, "manual");
16980
17039
  }
16981
- resizeRef.current.style.top = "0";
16982
- resizeRef.current.style.left = "calc(100% - 4px)";
16983
- pointerRef.current = null;
17040
+ setPosition(initialPosition);
17041
+ setPointer(null);
17042
+ setIsPressed(columnIndex, false);
16984
17043
  }
16985
- }, onMouseMove, onMouseDown, onClick: (e) => e.stopPropagation(), onMouseUp, "data-resize": true });
17044
+ }, onPointerMove, onPointerCancel: (e) => {
17045
+ e.preventDefault();
17046
+ e.stopPropagation();
17047
+ setPosition(initialPosition);
17048
+ setPointer(null);
17049
+ setIsPressed(columnIndex, false);
17050
+ }, onClick: (e) => e.stopPropagation(), "data-resize": true, style: position });
16986
17051
  };
16987
17052
  const HeaderContainer = styled.div.withConfig({
16988
17053
  componentId: "sc-1oadqc8-0"
@@ -17022,15 +17087,16 @@ const RowColumn = styled(StyledCell).withConfig({
17022
17087
  const Column = ({
17023
17088
  columnIndex,
17024
17089
  cell,
17025
- columnWidth,
17090
+ getColumnWidth: getColumnWidth2,
17026
17091
  getColumnHorizontalPosition,
17027
17092
  getSelectionType,
17028
17093
  isFirstColumn,
17029
17094
  isLastColumn,
17030
17095
  onColumnResize,
17031
17096
  height,
17032
- setResizeCursorPosition,
17033
- showBorder
17097
+ getResizerPosition,
17098
+ showBorder,
17099
+ resizingState
17034
17100
  }) => {
17035
17101
  const selectionType = getSelectionType({
17036
17102
  column: columnIndex,
@@ -17043,9 +17109,10 @@ const Column = ({
17043
17109
  const columnPosition = getColumnHorizontalPosition(columnIndex);
17044
17110
  const isSelected = selectionType === "selectDirect";
17045
17111
  const isSelectedLeft = (leftSelectionType === "selectDirect" || isSelected) && leftSelectionType !== selectionType;
17046
- return /* @__PURE__ */ jsxs(HeaderCellContainer, { $width: columnWidth(columnIndex), $columnPosition: columnPosition, $height: height, "data-header": columnIndex, children: [
17047
- /* @__PURE__ */ 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) }),
17048
- /* @__PURE__ */ jsx(ColumnResizer, { height, onColumnResize, columnIndex, setResizeCursorPosition })
17112
+ const columnWidth = getColumnWidth2(columnIndex);
17113
+ return /* @__PURE__ */ jsxs(HeaderCellContainer, { $width: columnWidth, $columnPosition: columnPosition, $height: height, "data-header": columnIndex, children: [
17114
+ /* @__PURE__ */ 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 }),
17115
+ /* @__PURE__ */ jsx(ColumnResizer, { height, onColumnResize, columnIndex, getResizerPosition, columnWidth, resizingState })
17049
17116
  ] });
17050
17117
  };
17051
17118
  const Header = ({
@@ -17056,14 +17123,15 @@ const Header = ({
17056
17123
  minColumn,
17057
17124
  maxColumn,
17058
17125
  height,
17059
- columnWidth,
17126
+ getColumnWidth: getColumnWidth2,
17060
17127
  cell,
17061
17128
  columnCount,
17062
17129
  getSelectionType,
17063
17130
  onColumnResize,
17064
17131
  getColumnHorizontalPosition,
17065
- setResizeCursorPosition,
17066
- showBorder
17132
+ getResizerPosition,
17133
+ showBorder,
17134
+ resizingState
17067
17135
  }) => {
17068
17136
  const selectedAllType = getSelectionType({
17069
17137
  type: "all"
@@ -17071,7 +17139,7 @@ const Header = ({
17071
17139
  return /* @__PURE__ */ jsxs(HeaderContainer, { $height: height, $scrolledVertical: scrolledVertical, children: [
17072
17140
  /* @__PURE__ */ jsx(ScrollableHeaderContainer, { $left: rowNumberWidth, children: Array.from({
17073
17141
  length: maxColumn - minColumn + 1
17074
- }, (_, index2) => minColumn + index2).map((columnIndex) => /* @__PURE__ */ jsx(Column, { getSelectionType, columnIndex, columnWidth, getColumnHorizontalPosition, cell, isFirstColumn: columnIndex === 0 && !showRowNumber, isLastColumn: columnIndex + 1 === columnCount, onColumnResize, height, setResizeCursorPosition, showBorder }, `header-${columnIndex}`)) }),
17142
+ }, (_, index2) => minColumn + index2).map((columnIndex) => /* @__PURE__ */ jsx(Column, { getSelectionType, columnIndex, getColumnWidth: getColumnWidth2, getColumnHorizontalPosition, cell, isFirstColumn: columnIndex === 0 && !showRowNumber, isLastColumn: columnIndex + 1 === columnCount, onColumnResize, height, getResizerPosition, showBorder, resizingState }, `header-${columnIndex}`)) }),
17075
17143
  showRowNumber && /* @__PURE__ */ jsx(RowColumnContainer, { $width: rowNumberWidth, $height: height, $columnPosition: 0, $scrolledHorizontal: scrolledHorizontal, children: /* @__PURE__ */ jsx(RowColumn, { "data-selected": selectedAllType === "selectDirect", $type: "header", $isFirstRow: true, $isFirstColumn: true, $selectionType: selectedAllType, $isLastRow: false, $isLastColumn: false, $height: height, $isFocused: false, $isSelectedLeft: false, $isSelectedTop: false, "data-grid-row": -1, "data-grid-column": -1, $showBorder: showBorder, children: "#" }) })
17076
17144
  ] });
17077
17145
  };
@@ -31750,6 +31818,7 @@ const Grid = forwardRef(({
31750
31818
  onSelectProp(action, selection2, focus2);
31751
31819
  }
31752
31820
  }, [onSelectProp]);
31821
+ const resizingState = useResizingState();
31753
31822
  const onFocusChange = useCallback((row, column) => {
31754
31823
  setFocus((focus2) => ({
31755
31824
  row: row ?? (focusProp == null ? void 0 : focusProp.row) ?? focus2.row,
@@ -31823,11 +31892,14 @@ const Grid = forwardRef(({
31823
31892
  }
31824
31893
  return columnLeft + rowNumberWidth - 4;
31825
31894
  }, [getColumnHorizontalPosition, rowNumberWidth]);
31826
- const setResizeCursorPosition = useCallback((element, clientX, width, columnIndex) => {
31827
- element.style.left = `${getFixedResizerLeftPosition(clientX, width, columnIndex)}px`;
31895
+ const getResizerPosition = useCallback((clientX, width, columnIndex) => {
31896
+ const result = {
31897
+ left: `${getFixedResizerLeftPosition(clientX, width, columnIndex)}px`
31898
+ };
31828
31899
  if (outerRef.current) {
31829
- element.style.top = `${outerRef.current.scrollTop}px`;
31900
+ result.top = `${outerRef.current.scrollTop}px`;
31830
31901
  }
31902
+ return result;
31831
31903
  }, [getFixedResizerLeftPosition]);
31832
31904
  const clearSelectionAndFocus = useCallback((force) => {
31833
31905
  setSelection((selection2) => {
@@ -31882,7 +31954,7 @@ const Grid = forwardRef(({
31882
31954
  return /* @__PURE__ */ jsxs(GridContainer, { ...containerProps, className: `sticky-grid__container grid-outer ${props.className ?? ""}`, children: [
31883
31955
  /* @__PURE__ */ jsx(GridDataContainer, { $top: showHeader ? headerHeight : 0, $left: showRowNumber ? rowNumberWidth : 0, ref, children }),
31884
31956
  showRowNumber && /* @__PURE__ */ jsx(RowNumberColumn, { scrolledHorizontal, minRow, maxRow, rowHeight, headerHeight, rowWidth: rowNumberWidth, rowCount, getSelectionType, showHeader, rowStart, showBorder }),
31885
- showHeader && /* @__PURE__ */ jsx(Header, { scrolledVertical, scrolledHorizontal, showRowNumber, minColumn, maxColumn, height: headerHeight, columnWidth, cell, rowNumberWidth, getSelectionType, columnCount, onColumnResize, getColumnHorizontalPosition, setResizeCursorPosition, showBorder })
31957
+ showHeader && /* @__PURE__ */ jsx(Header, { scrolledVertical, scrolledHorizontal, showRowNumber, minColumn, maxColumn, height: headerHeight, getColumnWidth: columnWidth, cell, rowNumberWidth, getSelectionType, columnCount, onColumnResize, getColumnHorizontalPosition, getResizerPosition, showBorder, resizingState })
31886
31958
  ] });
31887
31959
  });
31888
31960
  useEffect(() => {
@@ -233,6 +233,7 @@ var __publicField = (obj, key, value) => {
233
233
  ] });
234
234
  const FolderClosed = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", ...props, children: /* @__PURE__ */ jsxRuntime.jsx("path", { stroke: "#161517", strokeWidth: 1.5, d: "M19 19H3C2.44772 19 2 18.5523 2 18V6C2 5.44772 2.44772 5 3 5H6.62869C6.98835 5 7.32032 5.19315 7.49805 5.50583L8.34405 6.99417C8.52179 7.30685 8.85375 7.5 9.21342 7.5H19C19.5523 7.5 20 7.94772 20 8.5V9.5V18C20 18.5523 19.5523 19 19 19Z" }) });
235
235
  const Gift = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", ...props, children: /* @__PURE__ */ jsxRuntime.jsx("path", { fill: "#161517", stroke: "#161517", strokeWidth: 0.6, d: "M19.306 6.276h-3.704a2.52 2.52 0 0 0 .752-1.805C16.354 3.11 15.296 2 13.997 2c-.937 0-1.745.578-2.125 1.41-.386-.56-1.013-.928-1.722-.928-1.172 0-2.126 1-2.126 2.23 0 .61.234 1.161.612 1.564H4.694C3.76 6.276 3 7.073 3 8.053v1.285c0 .919.67 1.677 1.523 1.767v8.64c0 1.244.964 2.255 2.15 2.255h10.655c1.185 0 2.149-1.011 2.149-2.254v-8.641c.854-.09 1.523-.848 1.523-1.767V8.052c0-.979-.76-1.776-1.694-1.776Zm-7.03-1.805c0-.995.772-1.804 1.721-1.804.949 0 1.72.81 1.72 1.804 0 .996-.771 1.805-1.72 1.805h-1.72V4.471Zm-3.617.242c0-.862.669-1.564 1.49-1.564.823 0 1.492.702 1.492 1.564v1.563H10.15c-.822 0-1.49-.701-1.49-1.563ZM3.635 9.338V8.052c0-.611.475-1.11 1.058-1.11h5.457l1.532.001v3.504H4.693c-.583 0-1.058-.498-1.058-1.11ZM5.16 19.746v-8.632h6.523v10.22h-5.01c-.834 0-1.513-.713-1.513-1.588Zm13.682 0c0 .875-.679 1.588-1.514 1.588h-5.01v-10.22h6.525v8.632Zm1.523-10.408c0 .612-.474 1.11-1.057 1.11h-6.99V6.942h6.99c.583 0 1.058.498 1.058 1.11v1.285Z" }) });
236
+ const Globe = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M21 12C21 16.9706 16.9706 21 12 21M21 12C21 7.02944 16.9706 3 12 3M21 12H3M12 21C7.02944 21 3 16.9706 3 12M12 21C14.2512 18.5355 15.5305 15.3372 15.6 12C15.5305 8.66283 14.2512 5.46452 12 3M12 21C9.74885 18.5355 8.46952 15.3372 8.4 12C8.46952 8.66283 9.74885 5.46452 12 3M3 12C3 7.02944 7.02944 3 12 3", stroke: "white", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
236
237
  const Home = (props) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", ...props, children: [
237
238
  /* @__PURE__ */ jsxRuntime.jsx("path", { stroke: "#161517", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M4 8.6V21h16V8.6" }),
238
239
  /* @__PURE__ */ jsxRuntime.jsx("path", { stroke: "#161517", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "m2 10 10-7 10 7M15 21v-6a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v6" })
@@ -405,8 +406,13 @@ var __publicField = (obj, key, value) => {
405
406
  /* @__PURE__ */ jsxRuntime.jsx("path", { stroke: "#161517", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M12.007 10.313A1.69 1.69 0 0 1 13.688 12v.008a1.689 1.689 0 1 1-1.681-1.695M10.807 13.194l-1.25 1.25M16.202 7.798 13.201 10.8" }),
406
407
  /* @__PURE__ */ jsxRuntime.jsx("path", { stroke: "#161517", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M18.367 5.634A9.004 9.004 0 1 1 12 2.997v3" })
407
408
  ] });
409
+ const Square = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", ...props, children: /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "3.75", y: "3.75", width: "16.5", height: "16.5", rx: "1.25", stroke: "white", strokeWidth: "1.5" }) });
408
410
  const Star = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", ...props, children: /* @__PURE__ */ jsxRuntime.jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M12 2.896L14.935 8.889L21.5 9.856L16.75 14.518L17.871 21.104L12 17.993L6.129 21.104L7.25 14.518L2.5 9.856L9.064 8.889L12 2.896Z", stroke: "#161517", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
409
- const Stop = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", ...props, children: /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "3.75", y: "3.75", width: "16.5", height: "16.5", rx: "1.25", stroke: "white", strokeWidth: "1.5" }) });
411
+ const Stop = (props) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
412
+ /* @__PURE__ */ jsxRuntime.jsx("mask", { id: "path-1-inside-1_9731_929", fill: "white", children: /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "9", y: "9", width: "6", height: "6", rx: "0.4" }) }),
413
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "9", y: "9", width: "6", height: "6", rx: "0.4", fill: "white", stroke: "white", strokeWidth: "3", mask: "url(#path-1-inside-1_9731_929)" }),
414
+ /* @__PURE__ */ jsxRuntime.jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M12 21V21C7.029 21 3 16.971 3 12V12C3 7.029 7.029 3 12 3V3C16.971 3 21 7.029 21 12V12C21 16.971 16.971 21 12 21Z", stroke: "white", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
415
+ ] });
410
416
  const Support = (props) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", ...props, children: [
411
417
  /* @__PURE__ */ jsxRuntime.jsx("path", { stroke: "#161517", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M16 18H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2Z", clipRule: "evenodd" }),
412
418
  /* @__PURE__ */ jsxRuntime.jsx("path", { stroke: "#161517", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M10.467 11.504v-.207c0-.678.419-1.045.839-1.327.41-.276.82-.636.82-1.3a1.659 1.659 0 0 0-3.318 0M10.466 13.843a.148.148 0 0 0-.15.15.15.15 0 1 0 .15-.15" }),
@@ -754,6 +760,7 @@ var __publicField = (obj, key, value) => {
754
760
  "folder-open": FolderOpen,
755
761
  gear: Gear,
756
762
  gift: Gift,
763
+ globe: Globe,
757
764
  "git-merge": GitMerge,
758
765
  history: HistoryIcon,
759
766
  home: Home,
@@ -807,6 +814,7 @@ var __publicField = (obj, key, value) => {
807
814
  sparkle: Sparkle,
808
815
  speaker: Speaker,
809
816
  speed: Speed,
817
+ square: Square,
810
818
  star: Star,
811
819
  stop: Stop,
812
820
  support: Support,
@@ -16922,9 +16930,46 @@ var __publicField = (obj, key, value) => {
16922
16930
  }
16923
16931
  var throttle_1 = throttle$1;
16924
16932
  const throttle$2 = /* @__PURE__ */ getDefaultExportFromCjs(throttle_1);
16933
+ const initialPosition = {
16934
+ left: "calc(100% - 4px)",
16935
+ top: "0"
16936
+ };
16937
+ const useResizingState = () => {
16938
+ const [pressedColumnIndex, setPressedColumnIndex] = React.useState(-1);
16939
+ const [pointer, setPointer] = React.useState(null);
16940
+ const [position, setPosition] = React.useState(initialPosition);
16941
+ const [lastPressedTimestamp, setLastPressedTimestamp] = React.useState(0);
16942
+ const getIsPressed = React.useCallback((columnIndex) => {
16943
+ return pressedColumnIndex === columnIndex;
16944
+ }, [pressedColumnIndex]);
16945
+ const setIsPressed = React.useCallback((columnIndex, pressed) => {
16946
+ if (pressed) {
16947
+ setPressedColumnIndex(columnIndex);
16948
+ setLastPressedTimestamp(Date.now());
16949
+ } else {
16950
+ setPressedColumnIndex(-1);
16951
+ }
16952
+ }, []);
16953
+ const getPosition = React.useCallback((columnIndex) => {
16954
+ if (pressedColumnIndex !== columnIndex) {
16955
+ return initialPosition;
16956
+ }
16957
+ return position;
16958
+ }, [position, pressedColumnIndex]);
16959
+ return {
16960
+ pointer,
16961
+ setPointer,
16962
+ getIsPressed,
16963
+ setIsPressed,
16964
+ getPosition,
16965
+ setPosition,
16966
+ lastPressedTimestamp
16967
+ };
16968
+ };
16969
+ const DOUBLE_CLICK_THRESHOLD_MSEC = 300;
16925
16970
  const ResizeSpan = styled.styled.div.withConfig({
16926
16971
  componentId: "sc-1r6e5v3-0"
16927
- })(["top:0;left:calc(100% - 4px);z-index:1;position:absolute;height:", "px;cursor:col-resize;width:4px;overflow:auto;&:hover,&:active,&:hover{background:", ";}", ""], ({
16972
+ })(["top:", ";left:", ";z-index:1;position:absolute;height:", "px;cursor:col-resize;width:4px;overflow:auto;&:hover,&:active,&:hover{background:", ";}", ""], initialPosition.top, initialPosition.left, ({
16928
16973
  $height
16929
16974
  }) => $height, ({
16930
16975
  theme: theme2
@@ -16938,67 +16983,87 @@ var __publicField = (obj, key, value) => {
16938
16983
  height,
16939
16984
  onColumnResize: onColumnResizeProp,
16940
16985
  columnIndex,
16941
- setResizeCursorPosition
16986
+ getResizerPosition,
16987
+ columnWidth,
16988
+ resizingState
16942
16989
  }) => {
16943
16990
  const resizeRef = React.useRef(null);
16944
- const pointerRef = React.useRef(null);
16945
- const [isPressed, setIsPressed] = React.useState(false);
16991
+ const {
16992
+ pointer,
16993
+ setPointer,
16994
+ getIsPressed,
16995
+ setIsPressed,
16996
+ getPosition,
16997
+ setPosition,
16998
+ lastPressedTimestamp
16999
+ } = resizingState;
17000
+ const isPressed = getIsPressed(columnIndex);
17001
+ const position = getPosition(columnIndex);
16946
17002
  const onColumnResize = throttle$2(onColumnResizeProp, 1e3);
16947
- const onMouseDown = React.useCallback((e) => {
16948
- e.preventDefault();
16949
- e.stopPropagation();
16950
- setIsPressed(true);
16951
- if (e.detail > 1) {
16952
- onColumnResize(columnIndex, 0, "auto");
17003
+ React.useEffect(() => {
17004
+ const control = resizeRef.current;
17005
+ if (!isPressed || !control || !pointer) {
17006
+ return;
16953
17007
  }
16954
- }, [columnIndex, onColumnResize, setIsPressed]);
16955
- const onMouseUp = React.useCallback((e) => {
16956
- e.stopPropagation();
16957
- setIsPressed(false);
16958
- }, [setIsPressed]);
17008
+ const pointerId = pointer.pointerId;
17009
+ try {
17010
+ control.setPointerCapture(pointerId);
17011
+ return () => {
17012
+ if (control.hasPointerCapture(pointerId)) {
17013
+ control.releasePointerCapture(pointerId);
17014
+ }
17015
+ };
17016
+ } catch (e) {
17017
+ console.error(e);
17018
+ }
17019
+ }, [pointer, isPressed, columnIndex]);
16959
17020
  const onPointerDown = React.useCallback((e) => {
16960
17021
  e.stopPropagation();
17022
+ e.preventDefault();
16961
17023
  if (resizeRef.current) {
16962
- resizeRef.current.setPointerCapture(e.pointerId);
16963
- const header = resizeRef.current.closest(`[data-header="${columnIndex}"]`);
16964
- if (header) {
16965
- pointerRef.current = {
16966
- pointerId: e.pointerId,
16967
- initialClientX: e.clientX,
16968
- width: header.clientWidth
16969
- };
16970
- setResizeCursorPosition(resizeRef.current, e.clientX, header.clientWidth, columnIndex);
17024
+ if (lastPressedTimestamp > Date.now() - DOUBLE_CLICK_THRESHOLD_MSEC) {
17025
+ onColumnResize(columnIndex, 0, "auto");
16971
17026
  }
17027
+ setPointer({
17028
+ pointerId: e.pointerId,
17029
+ initialClientX: e.clientX,
17030
+ width: columnWidth
17031
+ });
17032
+ setIsPressed(columnIndex, true);
17033
+ const pos = getResizerPosition(e.clientX, columnWidth, columnIndex);
17034
+ setPosition(pos);
16972
17035
  }
16973
- }, [columnIndex, setResizeCursorPosition]);
16974
- const onMouseMove = React.useCallback((e) => {
17036
+ }, [lastPressedTimestamp, setPointer, columnWidth, setIsPressed, columnIndex, getResizerPosition, setPosition, onColumnResize]);
17037
+ const onPointerMove = React.useCallback((e) => {
16975
17038
  e.stopPropagation();
16976
- if (resizeRef.current && pointerRef.current) {
16977
- const header = resizeRef.current.closest(`[data-header="${columnIndex}"]`);
16978
- if (header) {
16979
- resizeRef.current.setPointerCapture(pointerRef.current.pointerId);
16980
- const width = header.clientWidth + (e.clientX - pointerRef.current.initialClientX);
16981
- setResizeCursorPosition(resizeRef.current, e.clientX, width, columnIndex);
16982
- pointerRef.current.width = Math.max(width, 50);
16983
- }
17039
+ e.preventDefault();
17040
+ if (isPressed && pointer) {
17041
+ const width = columnWidth + (e.clientX - pointer.initialClientX);
17042
+ const pos = getResizerPosition(e.clientX, width, columnIndex);
17043
+ setPosition(pos);
17044
+ pointer.width = Math.max(width, 50);
16984
17045
  }
16985
- }, [columnIndex, setResizeCursorPosition]);
17046
+ }, [pointer, isPressed, columnWidth, getResizerPosition, columnIndex, setPosition]);
16986
17047
  return /* @__PURE__ */ jsxRuntime.jsx(ResizeSpan, { ref: resizeRef, $height: height, $isPressed: isPressed, onPointerDown, onPointerUp: (e) => {
16987
- var _a, _b;
16988
17048
  e.preventDefault();
16989
17049
  e.stopPropagation();
16990
17050
  if (resizeRef.current && // 0 is a valid pointerId in Firefox
16991
- (((_a = pointerRef.current) == null ? void 0 : _a.pointerId) || ((_b = pointerRef.current) == null ? void 0 : _b.pointerId) === 0)) {
16992
- resizeRef.current.releasePointerCapture(pointerRef.current.pointerId);
16993
- const shouldCallResize = e.clientX !== pointerRef.current.initialClientX;
17051
+ ((pointer == null ? void 0 : pointer.pointerId) || (pointer == null ? void 0 : pointer.pointerId) === 0)) {
17052
+ const shouldCallResize = e.clientX !== pointer.initialClientX;
16994
17053
  if (shouldCallResize) {
16995
- onColumnResize(columnIndex, pointerRef.current.width, "manual");
17054
+ onColumnResize(columnIndex, pointer.width, "manual");
16996
17055
  }
16997
- resizeRef.current.style.top = "0";
16998
- resizeRef.current.style.left = "calc(100% - 4px)";
16999
- pointerRef.current = null;
17056
+ setPosition(initialPosition);
17057
+ setPointer(null);
17058
+ setIsPressed(columnIndex, false);
17000
17059
  }
17001
- }, onMouseMove, onMouseDown, onClick: (e) => e.stopPropagation(), onMouseUp, "data-resize": true });
17060
+ }, onPointerMove, onPointerCancel: (e) => {
17061
+ e.preventDefault();
17062
+ e.stopPropagation();
17063
+ setPosition(initialPosition);
17064
+ setPointer(null);
17065
+ setIsPressed(columnIndex, false);
17066
+ }, onClick: (e) => e.stopPropagation(), "data-resize": true, style: position });
17002
17067
  };
17003
17068
  const HeaderContainer = styled.styled.div.withConfig({
17004
17069
  componentId: "sc-1oadqc8-0"
@@ -17038,15 +17103,16 @@ var __publicField = (obj, key, value) => {
17038
17103
  const Column = ({
17039
17104
  columnIndex,
17040
17105
  cell,
17041
- columnWidth,
17106
+ getColumnWidth,
17042
17107
  getColumnHorizontalPosition,
17043
17108
  getSelectionType,
17044
17109
  isFirstColumn,
17045
17110
  isLastColumn,
17046
17111
  onColumnResize,
17047
17112
  height,
17048
- setResizeCursorPosition,
17049
- showBorder
17113
+ getResizerPosition,
17114
+ showBorder,
17115
+ resizingState
17050
17116
  }) => {
17051
17117
  const selectionType = getSelectionType({
17052
17118
  column: columnIndex,
@@ -17059,9 +17125,10 @@ var __publicField = (obj, key, value) => {
17059
17125
  const columnPosition = getColumnHorizontalPosition(columnIndex);
17060
17126
  const isSelected = selectionType === "selectDirect";
17061
17127
  const isSelectedLeft = (leftSelectionType === "selectDirect" || isSelected) && leftSelectionType !== selectionType;
17062
- return /* @__PURE__ */ jsxRuntime.jsxs(HeaderCellContainer, { $width: columnWidth(columnIndex), $columnPosition: columnPosition, $height: height, "data-header": columnIndex, children: [
17063
- /* @__PURE__ */ jsxRuntime.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) }),
17064
- /* @__PURE__ */ jsxRuntime.jsx(ColumnResizer, { height, onColumnResize, columnIndex, setResizeCursorPosition })
17128
+ const columnWidth = getColumnWidth(columnIndex);
17129
+ return /* @__PURE__ */ jsxRuntime.jsxs(HeaderCellContainer, { $width: columnWidth, $columnPosition: columnPosition, $height: height, "data-header": columnIndex, children: [
17130
+ /* @__PURE__ */ jsxRuntime.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 }),
17131
+ /* @__PURE__ */ jsxRuntime.jsx(ColumnResizer, { height, onColumnResize, columnIndex, getResizerPosition, columnWidth, resizingState })
17065
17132
  ] });
17066
17133
  };
17067
17134
  const Header = ({
@@ -17072,14 +17139,15 @@ var __publicField = (obj, key, value) => {
17072
17139
  minColumn,
17073
17140
  maxColumn,
17074
17141
  height,
17075
- columnWidth,
17142
+ getColumnWidth,
17076
17143
  cell,
17077
17144
  columnCount,
17078
17145
  getSelectionType,
17079
17146
  onColumnResize,
17080
17147
  getColumnHorizontalPosition,
17081
- setResizeCursorPosition,
17082
- showBorder
17148
+ getResizerPosition,
17149
+ showBorder,
17150
+ resizingState
17083
17151
  }) => {
17084
17152
  const selectedAllType = getSelectionType({
17085
17153
  type: "all"
@@ -17087,7 +17155,7 @@ var __publicField = (obj, key, value) => {
17087
17155
  return /* @__PURE__ */ jsxRuntime.jsxs(HeaderContainer, { $height: height, $scrolledVertical: scrolledVertical, children: [
17088
17156
  /* @__PURE__ */ jsxRuntime.jsx(ScrollableHeaderContainer, { $left: rowNumberWidth, children: Array.from({
17089
17157
  length: maxColumn - minColumn + 1
17090
- }, (_, index2) => minColumn + index2).map((columnIndex) => /* @__PURE__ */ jsxRuntime.jsx(Column, { getSelectionType, columnIndex, columnWidth, getColumnHorizontalPosition, cell, isFirstColumn: columnIndex === 0 && !showRowNumber, isLastColumn: columnIndex + 1 === columnCount, onColumnResize, height, setResizeCursorPosition, showBorder }, `header-${columnIndex}`)) }),
17158
+ }, (_, index2) => minColumn + index2).map((columnIndex) => /* @__PURE__ */ jsxRuntime.jsx(Column, { getSelectionType, columnIndex, getColumnWidth, getColumnHorizontalPosition, cell, isFirstColumn: columnIndex === 0 && !showRowNumber, isLastColumn: columnIndex + 1 === columnCount, onColumnResize, height, getResizerPosition, showBorder, resizingState }, `header-${columnIndex}`)) }),
17091
17159
  showRowNumber && /* @__PURE__ */ jsxRuntime.jsx(RowColumnContainer, { $width: rowNumberWidth, $height: height, $columnPosition: 0, $scrolledHorizontal: scrolledHorizontal, children: /* @__PURE__ */ jsxRuntime.jsx(RowColumn, { "data-selected": selectedAllType === "selectDirect", $type: "header", $isFirstRow: true, $isFirstColumn: true, $selectionType: selectedAllType, $isLastRow: false, $isLastColumn: false, $height: height, $isFocused: false, $isSelectedLeft: false, $isSelectedTop: false, "data-grid-row": -1, "data-grid-column": -1, $showBorder: showBorder, children: "#" }) })
17092
17160
  ] });
17093
17161
  };
@@ -31766,6 +31834,7 @@ var __publicField = (obj, key, value) => {
31766
31834
  onSelectProp(action, selection2, focus2);
31767
31835
  }
31768
31836
  }, [onSelectProp]);
31837
+ const resizingState = useResizingState();
31769
31838
  const onFocusChange = React.useCallback((row, column) => {
31770
31839
  setFocus((focus2) => ({
31771
31840
  row: row ?? (focusProp == null ? void 0 : focusProp.row) ?? focus2.row,
@@ -31839,11 +31908,14 @@ var __publicField = (obj, key, value) => {
31839
31908
  }
31840
31909
  return columnLeft + rowNumberWidth - 4;
31841
31910
  }, [getColumnHorizontalPosition, rowNumberWidth]);
31842
- const setResizeCursorPosition = React.useCallback((element, clientX, width, columnIndex) => {
31843
- element.style.left = `${getFixedResizerLeftPosition(clientX, width, columnIndex)}px`;
31911
+ const getResizerPosition = React.useCallback((clientX, width, columnIndex) => {
31912
+ const result = {
31913
+ left: `${getFixedResizerLeftPosition(clientX, width, columnIndex)}px`
31914
+ };
31844
31915
  if (outerRef.current) {
31845
- element.style.top = `${outerRef.current.scrollTop}px`;
31916
+ result.top = `${outerRef.current.scrollTop}px`;
31846
31917
  }
31918
+ return result;
31847
31919
  }, [getFixedResizerLeftPosition]);
31848
31920
  const clearSelectionAndFocus = React.useCallback((force) => {
31849
31921
  setSelection((selection2) => {
@@ -31898,7 +31970,7 @@ var __publicField = (obj, key, value) => {
31898
31970
  return /* @__PURE__ */ jsxRuntime.jsxs(GridContainer, { ...containerProps, className: `sticky-grid__container grid-outer ${props.className ?? ""}`, children: [
31899
31971
  /* @__PURE__ */ jsxRuntime.jsx(GridDataContainer, { $top: showHeader ? headerHeight : 0, $left: showRowNumber ? rowNumberWidth : 0, ref, children }),
31900
31972
  showRowNumber && /* @__PURE__ */ jsxRuntime.jsx(RowNumberColumn, { scrolledHorizontal, minRow, maxRow, rowHeight, headerHeight, rowWidth: rowNumberWidth, rowCount, getSelectionType, showHeader, rowStart, showBorder }),
31901
- showHeader && /* @__PURE__ */ jsxRuntime.jsx(Header, { scrolledVertical, scrolledHorizontal, showRowNumber, minColumn, maxColumn, height: headerHeight, columnWidth, cell, rowNumberWidth, getSelectionType, columnCount, onColumnResize, getColumnHorizontalPosition, setResizeCursorPosition, showBorder })
31973
+ showHeader && /* @__PURE__ */ jsxRuntime.jsx(Header, { scrolledVertical, scrolledHorizontal, showRowNumber, minColumn, maxColumn, height: headerHeight, getColumnWidth: columnWidth, cell, rowNumberWidth, getSelectionType, columnCount, onColumnResize, getColumnHorizontalPosition, getResizerPosition, showBorder, resizingState })
31902
31974
  ] });
31903
31975
  });
31904
31976
  React.useEffect(() => {
@@ -37,7 +37,7 @@ export declare const Flyout: {
37
37
  };
38
38
  CodeBlock: ({ statement, language, wrapLines, showLineNumbers, showWrapButton, onCopy, onCopyError, ...props }: FlyoutCodeBlockProps & ElementProps) => import("react/jsx-runtime").JSX.Element;
39
39
  };
40
- type FlyoutSizeType = "default" | "narrow" | "wide";
40
+ type FlyoutSizeType = "default" | "narrow" | "wide" | "widest";
41
41
  type Strategy = "relative" | "absolute" | "fixed";
42
42
  type FlyoutType = "default" | "inline";
43
43
  type DialogContentAlignmentType = "start" | "end";
@@ -1,10 +1,28 @@
1
- import { ColumnResizeFn, SetResizeCursorPositionFn } from './types';
1
+ import { ColumnResizeFn, GetResizerPositionFn } from './types';
2
+ import { ResizingState } from './useResizingState';
2
3
 
4
+ /**
5
+ * Properties for the ColumnResizer component.
6
+ * @typedef {Object} Props
7
+ * @property {number} height - Height of the resizer.
8
+ * @property {ColumnResizeFn} onColumnResize - Function to handle column resize.
9
+ * @property {number} columnIndex - Index of the column being resized.
10
+ * @property {GetResizerPositionFn} getResizerPosition - Function to get the position of the resizer.
11
+ * @property {number} columnWidth - Initial width of the column.
12
+ * @property {ResizingState} resizingState - State management object for resizing interactions.
13
+ */
3
14
  interface Props {
4
15
  height: number;
5
16
  onColumnResize: ColumnResizeFn;
6
17
  columnIndex: number;
7
- setResizeCursorPosition: SetResizeCursorPositionFn;
18
+ getResizerPosition: GetResizerPositionFn;
19
+ columnWidth: number;
20
+ resizingState: ResizingState;
8
21
  }
9
- declare const ColumnResizer: ({ height, onColumnResize: onColumnResizeProp, columnIndex, setResizeCursorPosition, }: Props) => import("react/jsx-runtime").JSX.Element;
22
+ /**
23
+ * Component for rendering a column resizer with pointer events and resizing state management.
24
+ * @param {Props} props - Properties passed to the component.
25
+ * @returns {JSX.Element} The ColumnResizer component.
26
+ */
27
+ declare const ColumnResizer: ({ height, onColumnResize: onColumnResizeProp, columnIndex, getResizerPosition, columnWidth, resizingState, }: Props) => import("react/jsx-runtime").JSX.Element;
10
28
  export default ColumnResizer;
@@ -1,4 +1,5 @@
1
- import { CellProps, ColumnResizeFn, SelectionTypeFn, SetResizeCursorPositionFn } from './types';
1
+ import { CellProps, ColumnResizeFn, GetResizerPositionFn, SelectionTypeFn } from './types';
2
+ import { ResizingState } from './useResizingState';
2
3
 
3
4
  interface HeaderProps {
4
5
  showRowNumber: boolean;
@@ -6,16 +7,17 @@ interface HeaderProps {
6
7
  minColumn: number;
7
8
  maxColumn: number;
8
9
  height: number;
9
- columnWidth: (index: number) => number;
10
+ getColumnWidth: (index: number) => number;
10
11
  cell: CellProps;
11
12
  getSelectionType: SelectionTypeFn;
12
13
  columnCount: number;
13
14
  onColumnResize: ColumnResizeFn;
14
15
  getColumnHorizontalPosition: (columnIndex: number) => number;
15
16
  scrolledVertical: boolean;
16
- setResizeCursorPosition: SetResizeCursorPositionFn;
17
+ getResizerPosition: GetResizerPositionFn;
17
18
  showBorder: boolean;
18
19
  scrolledHorizontal: boolean;
20
+ resizingState: ResizingState;
19
21
  }
20
- declare const Header: ({ scrolledVertical, scrolledHorizontal, showRowNumber, rowNumberWidth, minColumn, maxColumn, height, columnWidth, cell, columnCount, getSelectionType, onColumnResize, getColumnHorizontalPosition, setResizeCursorPosition, showBorder, }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
22
+ declare const Header: ({ scrolledVertical, scrolledHorizontal, showRowNumber, rowNumberWidth, minColumn, maxColumn, height, getColumnWidth, cell, columnCount, getSelectionType, onColumnResize, getColumnHorizontalPosition, getResizerPosition, showBorder, resizingState }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
21
23
  export default Header;
@@ -138,5 +138,9 @@ export interface GridProps extends Omit<VariableSizeGridProps, "height" | "width
138
138
  onContextMenu?: MouseEventHandler<HTMLDivElement>;
139
139
  forwardedGridRef?: MutableRefObject<VariableSizeGrid>;
140
140
  }
141
- export type SetResizeCursorPositionFn = (element: HTMLSpanElement, clientX: number, width: number, columnIndex: number) => void;
141
+ export type ResizerPosition = {
142
+ left: string;
143
+ top?: string;
144
+ };
145
+ export type GetResizerPositionFn = (clientX: number, width: number, columnIndex: number) => ResizerPosition;
142
146
  export {};
@@ -0,0 +1,48 @@
1
+ import { ResizerPosition } from './types';
2
+
3
+ /**
4
+ * Defines the type for pointer information used in resizing.
5
+ * @typedef {Object} PointerType
6
+ * @property {number} width - The width of the pointer component.
7
+ * @property {number} pointerId - Unique identifier for the pointer from a touch event.
8
+ * @property {number} initialClientX - The initial X coordinate of the pointer when resizing started.
9
+ */
10
+ export type PointerType = {
11
+ width: number;
12
+ pointerId: number;
13
+ initialClientX: number;
14
+ };
15
+ /**
16
+ * Defines the state and methods used for managing the column resizing.
17
+ * @typedef {Object} ResizingState
18
+ * @property {PointerType | null} pointer - The current pointer data, or null if no pointer is active.
19
+ * @property {(pointer: PointerType | null) => void} setPointer - Setter to update the pointer.
20
+ * @property {(columnIndex: number) => boolean} getIsPressed - Indicates if a resizer for the given column is currently pressed/dragged.
21
+ * @property {(columnIndex: number, pressed: boolean) => void} setIsPressed - Sets the pressed state for a given column.
22
+ * @property {(columnIndex: number) => ResizerPosition} getPosition - Gets the position of the resizer for the specified column.
23
+ * @property {(position: ResizerPosition) => void} setPosition - Updates the position of the resizer.
24
+ * @property {number} lastPressedTimestamp - Timestamp of the last time a column was pressed, used to detect double-clicks.
25
+ */
26
+ export interface ResizingState {
27
+ pointer: PointerType | null;
28
+ setPointer: (pointer: PointerType | null) => void;
29
+ getIsPressed: (columnIndex: number) => boolean;
30
+ setIsPressed: (columnIndex: number, pressed: boolean) => void;
31
+ getPosition: (columnIndex: number) => ResizerPosition;
32
+ setPosition: (position: ResizerPosition) => void;
33
+ lastPressedTimestamp: number;
34
+ }
35
+ /**
36
+ * The initial position of the resizer element.
37
+ * @type {ResizerPosition}
38
+ */
39
+ export declare const initialPosition: {
40
+ left: string;
41
+ top: string;
42
+ };
43
+ /**
44
+ * Custom hook that provides the state and methods needed to manage a resizing operation on columns.
45
+ * @returns {ResizingState} The resizing state and methods for controlling resizing behavior.
46
+ */
47
+ declare const useResizingState: () => ResizingState;
48
+ export default useResizingState;
@@ -69,6 +69,7 @@ export declare const ICONS_MAP: {
69
69
  "folder-open": (props: import('react').SVGAttributes<SVGElement>) => import("react/jsx-runtime").JSX.Element;
70
70
  gear: (props: import('react').SVGAttributes<SVGElement>) => import("react/jsx-runtime").JSX.Element;
71
71
  gift: (props: import('react').SVGAttributes<SVGElement>) => import("react/jsx-runtime").JSX.Element;
72
+ globe: (props: import('react').SVGAttributes<SVGElement>) => import("react/jsx-runtime").JSX.Element;
72
73
  "git-merge": (props: import('react').SVGAttributes<SVGElement>) => import("react/jsx-runtime").JSX.Element;
73
74
  history: (props: import('react').SVGAttributes<SVGElement>) => import("react/jsx-runtime").JSX.Element;
74
75
  home: (props: import('react').SVGAttributes<SVGElement>) => import("react/jsx-runtime").JSX.Element;
@@ -122,6 +123,7 @@ export declare const ICONS_MAP: {
122
123
  sparkle: (props: import('react').SVGAttributes<SVGElement>) => import("react/jsx-runtime").JSX.Element;
123
124
  speaker: (props: import('react').SVGAttributes<SVGElement>) => import("react/jsx-runtime").JSX.Element;
124
125
  speed: (props: import('react').SVGAttributes<SVGElement>) => import("react/jsx-runtime").JSX.Element;
126
+ square: (props: import('react').SVGAttributes<SVGElement>) => import("react/jsx-runtime").JSX.Element;
125
127
  star: (props: import('react').SVGAttributes<SVGElement>) => import("react/jsx-runtime").JSX.Element;
126
128
  stop: (props: import('react').SVGAttributes<SVGElement>) => import("react/jsx-runtime").JSX.Element;
127
129
  support: (props: import('react').SVGAttributes<SVGElement>) => import("react/jsx-runtime").JSX.Element;
@@ -6,7 +6,7 @@ import { PaymentName, PaymentProps } from '../icons/Payments';
6
6
 
7
7
  export type IconSize = "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
8
8
  export type IconState = "default" | "success" | "warning" | "danger" | "info";
9
- export declare const ICON_NAMES: readonly ["activity", "alarm", "arrow-down", "arrow-left", "arrow-right", "arrow-triangle", "arrow-directions", "arrow-up", "auth-app", "auth-sms", "backups", "bar-chart", "bell", "beta", "blog", "book", "brackets", "briefcase", "building", "burger-menu", "calendar", "calendar-with-time", "cards", "cell-tower", "chat", "check", "check-in-circle", "chevron-down", "chevron-left", "chevron-right", "chevron-up", "circle", "clock", "cloud", "cloud-keys", "code", "code-in-square", "connect", "connect-alt", "console", "copy", "cpu", "cross", "credit-card", "data", "database", "disk", "display", "document", "dot", "dots-horizontal", "dots-triangle", "dots-vertical", "dots-vertical-double", "double-check", "download", "download-in-circle", "email", "empty", "enter", "eye", "eye-closed", "filter", "fire", "flag", "flask", "folder-closed", "folder-open", "gear", "gift", "git-merge", "history", "horizontal-loading", "home", "http", "http-monitoring", "info-in-circle", "information", "insert-row", "integrations", "key", "keys", "lifebuoy", "light-bulb", "lightening", "line-in-circle", "loading", "loading-animated", "lock", "metrics", "metrics-alt", "minus", "no-cloud", "pause", "payment", "pencil", "pie-chart", "pipe", "play", "play-in-circle", "plus", "popout", "puzzle-piece", "query", "question", "refresh", "rocket", "sandglass", "search", "secure", "server", "services", "settings", "share", "share-arrow", "share-network", "slide-in", "slide-out", "sort-alt", "sort", "sparkle", "speaker", "speed", "star", "stop", "support", "table", "taxi", "trash", "tree-structure", "upload", "url", "user", "users", "warning", "waves"];
9
+ export declare const ICON_NAMES: readonly ["activity", "alarm", "arrow-down", "arrow-left", "arrow-right", "arrow-triangle", "arrow-directions", "arrow-up", "auth-app", "auth-sms", "backups", "bar-chart", "bell", "beta", "blog", "book", "brackets", "briefcase", "building", "burger-menu", "calendar", "calendar-with-time", "cards", "cell-tower", "chat", "check", "check-in-circle", "chevron-down", "chevron-left", "chevron-right", "chevron-up", "circle", "clock", "cloud", "cloud-keys", "code", "code-in-square", "connect", "connect-alt", "console", "copy", "cpu", "cross", "credit-card", "data", "database", "disk", "display", "document", "dot", "dots-horizontal", "dots-triangle", "dots-vertical", "dots-vertical-double", "double-check", "download", "download-in-circle", "email", "empty", "enter", "eye", "eye-closed", "filter", "fire", "flag", "flask", "folder-closed", "folder-open", "gear", "gift", "git-merge", "globe", "history", "horizontal-loading", "home", "http", "http-monitoring", "info-in-circle", "information", "insert-row", "integrations", "key", "keys", "lifebuoy", "light-bulb", "lightening", "line-in-circle", "loading", "loading-animated", "lock", "metrics", "metrics-alt", "minus", "no-cloud", "pause", "payment", "pencil", "pie-chart", "pipe", "play", "play-in-circle", "plus", "popout", "puzzle-piece", "query", "question", "refresh", "rocket", "sandglass", "search", "secure", "server", "services", "settings", "share", "share-arrow", "share-network", "slide-in", "slide-out", "sort-alt", "sort", "sparkle", "speaker", "speed", "square", "star", "stop", "support", "table", "taxi", "trash", "tree-structure", "upload", "url", "user", "users", "warning", "waves"];
10
10
  export type IconName = (typeof ICON_NAMES)[number];
11
11
  export interface IconProps extends SVGAttributes<HTMLOrSVGElement> {
12
12
  name: IconName;
@@ -0,0 +1,4 @@
1
+ import { SVGAttributes } from 'react';
2
+
3
+ declare const Globe: (props: SVGAttributes<SVGElement>) => import("react/jsx-runtime").JSX.Element;
4
+ export default Globe;
@@ -0,0 +1,4 @@
1
+ import { SVGAttributes } from 'react';
2
+
3
+ declare const Square: (props: SVGAttributes<SVGElement>) => import("react/jsx-runtime").JSX.Element;
4
+ export default Square;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clickhouse/click-ui",
3
- "version": "0.0.170",
3
+ "version": "0.0.172",
4
4
  "description": "Official ClickHouse design system react library",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",