@clickhouse/click-ui 0.0.156 → 0.0.157

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.
@@ -16909,11 +16909,16 @@ var throttle_1 = throttle$1;
16909
16909
  const throttle$2 = /* @__PURE__ */ getDefaultExportFromCjs(throttle_1);
16910
16910
  const ResizeSpan = styled.div.withConfig({
16911
16911
  componentId: "sc-1r6e5v3-0"
16912
- })(["top:0;left:calc(100% - 4px);z-index:1;position:absolute;height:", "px;cursor:col-resize;width:4px;overflow:auto;&:hover,&:active,&:hover{background:", ";}&:active{height:100%;position:fixed;}"], ({
16912
+ })(["top:0;left:calc(100% - 4px);z-index:1;position:absolute;height:", "px;cursor:col-resize;width:4px;overflow:auto;&:hover,&:active,&:hover{background:", ";}", ""], ({
16913
16913
  $height
16914
16914
  }) => $height, ({
16915
16915
  theme: theme2
16916
- }) => theme2.click.grid.header.cell.color.stroke.selectDirect);
16916
+ }) => theme2.click.grid.header.cell.color.stroke.selectDirect, ({
16917
+ $isPressed
16918
+ }) => $isPressed && `
16919
+ height: 100%;
16920
+ position: fixed;
16921
+ `);
16917
16922
  const ColumnResizer = ({
16918
16923
  height,
16919
16924
  onColumnResize: onColumnResizeProp,
@@ -16922,14 +16927,20 @@ const ColumnResizer = ({
16922
16927
  }) => {
16923
16928
  const resizeRef = useRef(null);
16924
16929
  const pointerRef = useRef(null);
16930
+ const [isPressed, setIsPressed] = useState(false);
16925
16931
  const onColumnResize = throttle$2(onColumnResizeProp, 1e3);
16926
16932
  const onMouseDown = useCallback((e) => {
16927
16933
  e.preventDefault();
16928
16934
  e.stopPropagation();
16935
+ setIsPressed(true);
16929
16936
  if (e.detail > 1) {
16930
16937
  onColumnResize(columnIndex, 0, "auto");
16931
16938
  }
16932
- }, [columnIndex, onColumnResize]);
16939
+ }, [columnIndex, onColumnResize, setIsPressed]);
16940
+ const onMouseUp = useCallback((e) => {
16941
+ e.stopPropagation();
16942
+ setIsPressed(false);
16943
+ }, [setIsPressed]);
16933
16944
  const onPointerDown = useCallback((e) => {
16934
16945
  e.stopPropagation();
16935
16946
  if (resizeRef.current) {
@@ -16951,17 +16962,18 @@ const ColumnResizer = ({
16951
16962
  const header = resizeRef.current.closest(`[data-header="${columnIndex}"]`);
16952
16963
  if (header) {
16953
16964
  resizeRef.current.setPointerCapture(pointerRef.current.pointerId);
16954
- const width = header.scrollWidth + (e.clientX - pointerRef.current.initialClientX);
16965
+ const width = header.clientWidth + (e.clientX - pointerRef.current.initialClientX);
16955
16966
  setResizeCursorPosition(resizeRef.current, e.clientX, width, columnIndex);
16956
16967
  pointerRef.current.width = Math.max(width, 50);
16957
16968
  }
16958
16969
  }
16959
16970
  }, [columnIndex, setResizeCursorPosition]);
16960
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizeSpan, { ref: resizeRef, $height: height, onPointerDown, onPointerUp: (e) => {
16961
- var _a;
16971
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizeSpan, { ref: resizeRef, $height: height, $isPressed: isPressed, onPointerDown, onPointerUp: (e) => {
16972
+ var _a, _b;
16962
16973
  e.preventDefault();
16963
16974
  e.stopPropagation();
16964
- if (resizeRef.current && ((_a = pointerRef.current) == null ? void 0 : _a.pointerId)) {
16975
+ if (resizeRef.current && // 0 is a valid pointerId in Firefox
16976
+ (((_a = pointerRef.current) == null ? void 0 : _a.pointerId) || ((_b = pointerRef.current) == null ? void 0 : _b.pointerId) === 0)) {
16965
16977
  resizeRef.current.releasePointerCapture(pointerRef.current.pointerId);
16966
16978
  const shouldCallResize = e.clientX !== pointerRef.current.initialClientX;
16967
16979
  if (shouldCallResize) {
@@ -16971,7 +16983,7 @@ const ColumnResizer = ({
16971
16983
  resizeRef.current.style.left = "calc(100% - 4px)";
16972
16984
  pointerRef.current = null;
16973
16985
  }
16974
- }, onMouseMove, onMouseDown, onClick: (e) => e.stopPropagation(), onMouseUp: (e) => e.stopPropagation(), "data-resize": true });
16986
+ }, onMouseMove, onMouseDown, onClick: (e) => e.stopPropagation(), onMouseUp, "data-resize": true });
16975
16987
  };
16976
16988
  const HeaderContainer = styled.div.withConfig({
16977
16989
  componentId: "sc-1oadqc8-0"
@@ -31628,7 +31640,7 @@ const ContextMenuTrigger = styled.div.withConfig({
31628
31640
  $showBorder,
31629
31641
  theme: theme2
31630
31642
  }) => $showBorder && `border: 1px solid ${theme2.click.grid.header.cell.color.stroke.default}`);
31631
- const OuterElementType = forwardRef((props, ref) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref, "data-testid": "grid-outer-element", ...props }));
31643
+ const OuterElementType = forwardRef((props, ref) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref, "data-testid": "grid-outer-element", tabIndex: 0, ...props }));
31632
31644
  const Grid = forwardRef(({
31633
31645
  autoFocus,
31634
31646
  autoHeight = false,
@@ -16926,11 +16926,16 @@ var __publicField = (obj, key, value) => {
16926
16926
  const throttle$2 = /* @__PURE__ */ getDefaultExportFromCjs(throttle_1);
16927
16927
  const ResizeSpan = styled.div.withConfig({
16928
16928
  componentId: "sc-1r6e5v3-0"
16929
- })(["top:0;left:calc(100% - 4px);z-index:1;position:absolute;height:", "px;cursor:col-resize;width:4px;overflow:auto;&:hover,&:active,&:hover{background:", ";}&:active{height:100%;position:fixed;}"], ({
16929
+ })(["top:0;left:calc(100% - 4px);z-index:1;position:absolute;height:", "px;cursor:col-resize;width:4px;overflow:auto;&:hover,&:active,&:hover{background:", ";}", ""], ({
16930
16930
  $height
16931
16931
  }) => $height, ({
16932
16932
  theme: theme2
16933
- }) => theme2.click.grid.header.cell.color.stroke.selectDirect);
16933
+ }) => theme2.click.grid.header.cell.color.stroke.selectDirect, ({
16934
+ $isPressed
16935
+ }) => $isPressed && `
16936
+ height: 100%;
16937
+ position: fixed;
16938
+ `);
16934
16939
  const ColumnResizer = ({
16935
16940
  height,
16936
16941
  onColumnResize: onColumnResizeProp,
@@ -16939,14 +16944,20 @@ var __publicField = (obj, key, value) => {
16939
16944
  }) => {
16940
16945
  const resizeRef = React.useRef(null);
16941
16946
  const pointerRef = React.useRef(null);
16947
+ const [isPressed, setIsPressed] = React.useState(false);
16942
16948
  const onColumnResize = throttle$2(onColumnResizeProp, 1e3);
16943
16949
  const onMouseDown = React.useCallback((e) => {
16944
16950
  e.preventDefault();
16945
16951
  e.stopPropagation();
16952
+ setIsPressed(true);
16946
16953
  if (e.detail > 1) {
16947
16954
  onColumnResize(columnIndex, 0, "auto");
16948
16955
  }
16949
- }, [columnIndex, onColumnResize]);
16956
+ }, [columnIndex, onColumnResize, setIsPressed]);
16957
+ const onMouseUp = React.useCallback((e) => {
16958
+ e.stopPropagation();
16959
+ setIsPressed(false);
16960
+ }, [setIsPressed]);
16950
16961
  const onPointerDown = React.useCallback((e) => {
16951
16962
  e.stopPropagation();
16952
16963
  if (resizeRef.current) {
@@ -16968,17 +16979,18 @@ var __publicField = (obj, key, value) => {
16968
16979
  const header = resizeRef.current.closest(`[data-header="${columnIndex}"]`);
16969
16980
  if (header) {
16970
16981
  resizeRef.current.setPointerCapture(pointerRef.current.pointerId);
16971
- const width = header.scrollWidth + (e.clientX - pointerRef.current.initialClientX);
16982
+ const width = header.clientWidth + (e.clientX - pointerRef.current.initialClientX);
16972
16983
  setResizeCursorPosition(resizeRef.current, e.clientX, width, columnIndex);
16973
16984
  pointerRef.current.width = Math.max(width, 50);
16974
16985
  }
16975
16986
  }
16976
16987
  }, [columnIndex, setResizeCursorPosition]);
16977
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizeSpan, { ref: resizeRef, $height: height, onPointerDown, onPointerUp: (e) => {
16978
- var _a;
16988
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizeSpan, { ref: resizeRef, $height: height, $isPressed: isPressed, onPointerDown, onPointerUp: (e) => {
16989
+ var _a, _b;
16979
16990
  e.preventDefault();
16980
16991
  e.stopPropagation();
16981
- if (resizeRef.current && ((_a = pointerRef.current) == null ? void 0 : _a.pointerId)) {
16992
+ if (resizeRef.current && // 0 is a valid pointerId in Firefox
16993
+ (((_a = pointerRef.current) == null ? void 0 : _a.pointerId) || ((_b = pointerRef.current) == null ? void 0 : _b.pointerId) === 0)) {
16982
16994
  resizeRef.current.releasePointerCapture(pointerRef.current.pointerId);
16983
16995
  const shouldCallResize = e.clientX !== pointerRef.current.initialClientX;
16984
16996
  if (shouldCallResize) {
@@ -16988,7 +17000,7 @@ var __publicField = (obj, key, value) => {
16988
17000
  resizeRef.current.style.left = "calc(100% - 4px)";
16989
17001
  pointerRef.current = null;
16990
17002
  }
16991
- }, onMouseMove, onMouseDown, onClick: (e) => e.stopPropagation(), onMouseUp: (e) => e.stopPropagation(), "data-resize": true });
17003
+ }, onMouseMove, onMouseDown, onClick: (e) => e.stopPropagation(), onMouseUp, "data-resize": true });
16992
17004
  };
16993
17005
  const HeaderContainer = styled.div.withConfig({
16994
17006
  componentId: "sc-1oadqc8-0"
@@ -31645,7 +31657,7 @@ var __publicField = (obj, key, value) => {
31645
31657
  $showBorder,
31646
31658
  theme: theme2
31647
31659
  }) => $showBorder && `border: 1px solid ${theme2.click.grid.header.cell.color.stroke.default}`);
31648
- const OuterElementType = React.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref, "data-testid": "grid-outer-element", ...props }));
31660
+ const OuterElementType = React.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref, "data-testid": "grid-outer-element", tabIndex: 0, ...props }));
31649
31661
  const Grid = React.forwardRef(({
31650
31662
  autoFocus,
31651
31663
  autoHeight = false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clickhouse/click-ui",
3
- "version": "0.0.156",
3
+ "version": "0.0.157",
4
4
  "description": "Official ClickHouse design system react library",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",