@clickhouse/click-ui 0.0.156 → 0.0.158

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.
@@ -2291,10 +2291,19 @@ const FormElementContainer = styled.div.withConfig({
2291
2291
  styled.span.withConfig({
2292
2292
  componentId: "sc-1sddmxu-8"
2293
2293
  })(["display:flex;white-space:nowrap;overflow:hidden;justify-content:flex-end;gap:inherit;& > *:not(button){overflow:hidden;text-overflow:ellipsis;}"]);
2294
+ const Switzerland = (props) => /* @__PURE__ */ jsxRuntimeExports.jsxs("svg", { width: "30", height: "20", viewBox: "0 0 30 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
2295
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("g", { "clip-path": "url(#clip0_8668_6183)", children: [
2296
+ /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M30 0H0V20H30V0Z", fill: "#D52B1E" }),
2297
+ /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M21.6663 7.77783H8.33301V12.2223H21.6663V7.77783Z", fill: "white" }),
2298
+ /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M17.2218 3.3335H12.7773V16.6668H17.2218V3.3335Z", fill: "white" })
2299
+ ] }),
2300
+ /* @__PURE__ */ jsxRuntimeExports.jsx("defs", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("clipPath", { id: "clip0_8668_6183", children: /* @__PURE__ */ jsxRuntimeExports.jsx("rect", { width: "30", height: "20", fill: "white" }) }) })
2301
+ ] });
2294
2302
  const FlagList = {
2295
2303
  au: Australia,
2296
2304
  br: Brazil,
2297
2305
  ca: Canada,
2306
+ ch: Switzerland,
2298
2307
  de: Germany,
2299
2308
  eu: EuropeanUnion,
2300
2309
  gb: GreatBritain,
@@ -16909,11 +16918,16 @@ var throttle_1 = throttle$1;
16909
16918
  const throttle$2 = /* @__PURE__ */ getDefaultExportFromCjs(throttle_1);
16910
16919
  const ResizeSpan = styled.div.withConfig({
16911
16920
  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;}"], ({
16921
+ })(["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
16922
  $height
16914
16923
  }) => $height, ({
16915
16924
  theme: theme2
16916
- }) => theme2.click.grid.header.cell.color.stroke.selectDirect);
16925
+ }) => theme2.click.grid.header.cell.color.stroke.selectDirect, ({
16926
+ $isPressed
16927
+ }) => $isPressed && `
16928
+ height: 100%;
16929
+ position: fixed;
16930
+ `);
16917
16931
  const ColumnResizer = ({
16918
16932
  height,
16919
16933
  onColumnResize: onColumnResizeProp,
@@ -16922,14 +16936,20 @@ const ColumnResizer = ({
16922
16936
  }) => {
16923
16937
  const resizeRef = useRef(null);
16924
16938
  const pointerRef = useRef(null);
16939
+ const [isPressed, setIsPressed] = useState(false);
16925
16940
  const onColumnResize = throttle$2(onColumnResizeProp, 1e3);
16926
16941
  const onMouseDown = useCallback((e) => {
16927
16942
  e.preventDefault();
16928
16943
  e.stopPropagation();
16944
+ setIsPressed(true);
16929
16945
  if (e.detail > 1) {
16930
16946
  onColumnResize(columnIndex, 0, "auto");
16931
16947
  }
16932
- }, [columnIndex, onColumnResize]);
16948
+ }, [columnIndex, onColumnResize, setIsPressed]);
16949
+ const onMouseUp = useCallback((e) => {
16950
+ e.stopPropagation();
16951
+ setIsPressed(false);
16952
+ }, [setIsPressed]);
16933
16953
  const onPointerDown = useCallback((e) => {
16934
16954
  e.stopPropagation();
16935
16955
  if (resizeRef.current) {
@@ -16951,17 +16971,18 @@ const ColumnResizer = ({
16951
16971
  const header = resizeRef.current.closest(`[data-header="${columnIndex}"]`);
16952
16972
  if (header) {
16953
16973
  resizeRef.current.setPointerCapture(pointerRef.current.pointerId);
16954
- const width = header.scrollWidth + (e.clientX - pointerRef.current.initialClientX);
16974
+ const width = header.clientWidth + (e.clientX - pointerRef.current.initialClientX);
16955
16975
  setResizeCursorPosition(resizeRef.current, e.clientX, width, columnIndex);
16956
16976
  pointerRef.current.width = Math.max(width, 50);
16957
16977
  }
16958
16978
  }
16959
16979
  }, [columnIndex, setResizeCursorPosition]);
16960
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizeSpan, { ref: resizeRef, $height: height, onPointerDown, onPointerUp: (e) => {
16961
- var _a;
16980
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizeSpan, { ref: resizeRef, $height: height, $isPressed: isPressed, onPointerDown, onPointerUp: (e) => {
16981
+ var _a, _b;
16962
16982
  e.preventDefault();
16963
16983
  e.stopPropagation();
16964
- if (resizeRef.current && ((_a = pointerRef.current) == null ? void 0 : _a.pointerId)) {
16984
+ if (resizeRef.current && // 0 is a valid pointerId in Firefox
16985
+ (((_a = pointerRef.current) == null ? void 0 : _a.pointerId) || ((_b = pointerRef.current) == null ? void 0 : _b.pointerId) === 0)) {
16965
16986
  resizeRef.current.releasePointerCapture(pointerRef.current.pointerId);
16966
16987
  const shouldCallResize = e.clientX !== pointerRef.current.initialClientX;
16967
16988
  if (shouldCallResize) {
@@ -16971,7 +16992,7 @@ const ColumnResizer = ({
16971
16992
  resizeRef.current.style.left = "calc(100% - 4px)";
16972
16993
  pointerRef.current = null;
16973
16994
  }
16974
- }, onMouseMove, onMouseDown, onClick: (e) => e.stopPropagation(), onMouseUp: (e) => e.stopPropagation(), "data-resize": true });
16995
+ }, onMouseMove, onMouseDown, onClick: (e) => e.stopPropagation(), onMouseUp, "data-resize": true });
16975
16996
  };
16976
16997
  const HeaderContainer = styled.div.withConfig({
16977
16998
  componentId: "sc-1oadqc8-0"
@@ -31628,7 +31649,7 @@ const ContextMenuTrigger = styled.div.withConfig({
31628
31649
  $showBorder,
31629
31650
  theme: theme2
31630
31651
  }) => $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 }));
31652
+ const OuterElementType = forwardRef((props, ref) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref, "data-testid": "grid-outer-element", tabIndex: 0, ...props }));
31632
31653
  const Grid = forwardRef(({
31633
31654
  autoFocus,
31634
31655
  autoHeight = false,
@@ -2308,10 +2308,19 @@ var __publicField = (obj, key, value) => {
2308
2308
  styled.span.withConfig({
2309
2309
  componentId: "sc-1sddmxu-8"
2310
2310
  })(["display:flex;white-space:nowrap;overflow:hidden;justify-content:flex-end;gap:inherit;& > *:not(button){overflow:hidden;text-overflow:ellipsis;}"]);
2311
+ const Switzerland = (props) => /* @__PURE__ */ jsxRuntimeExports.jsxs("svg", { width: "30", height: "20", viewBox: "0 0 30 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
2312
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("g", { "clip-path": "url(#clip0_8668_6183)", children: [
2313
+ /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M30 0H0V20H30V0Z", fill: "#D52B1E" }),
2314
+ /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M21.6663 7.77783H8.33301V12.2223H21.6663V7.77783Z", fill: "white" }),
2315
+ /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M17.2218 3.3335H12.7773V16.6668H17.2218V3.3335Z", fill: "white" })
2316
+ ] }),
2317
+ /* @__PURE__ */ jsxRuntimeExports.jsx("defs", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("clipPath", { id: "clip0_8668_6183", children: /* @__PURE__ */ jsxRuntimeExports.jsx("rect", { width: "30", height: "20", fill: "white" }) }) })
2318
+ ] });
2311
2319
  const FlagList = {
2312
2320
  au: Australia,
2313
2321
  br: Brazil,
2314
2322
  ca: Canada,
2323
+ ch: Switzerland,
2315
2324
  de: Germany,
2316
2325
  eu: EuropeanUnion,
2317
2326
  gb: GreatBritain,
@@ -16926,11 +16935,16 @@ var __publicField = (obj, key, value) => {
16926
16935
  const throttle$2 = /* @__PURE__ */ getDefaultExportFromCjs(throttle_1);
16927
16936
  const ResizeSpan = styled.div.withConfig({
16928
16937
  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;}"], ({
16938
+ })(["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
16939
  $height
16931
16940
  }) => $height, ({
16932
16941
  theme: theme2
16933
- }) => theme2.click.grid.header.cell.color.stroke.selectDirect);
16942
+ }) => theme2.click.grid.header.cell.color.stroke.selectDirect, ({
16943
+ $isPressed
16944
+ }) => $isPressed && `
16945
+ height: 100%;
16946
+ position: fixed;
16947
+ `);
16934
16948
  const ColumnResizer = ({
16935
16949
  height,
16936
16950
  onColumnResize: onColumnResizeProp,
@@ -16939,14 +16953,20 @@ var __publicField = (obj, key, value) => {
16939
16953
  }) => {
16940
16954
  const resizeRef = React.useRef(null);
16941
16955
  const pointerRef = React.useRef(null);
16956
+ const [isPressed, setIsPressed] = React.useState(false);
16942
16957
  const onColumnResize = throttle$2(onColumnResizeProp, 1e3);
16943
16958
  const onMouseDown = React.useCallback((e) => {
16944
16959
  e.preventDefault();
16945
16960
  e.stopPropagation();
16961
+ setIsPressed(true);
16946
16962
  if (e.detail > 1) {
16947
16963
  onColumnResize(columnIndex, 0, "auto");
16948
16964
  }
16949
- }, [columnIndex, onColumnResize]);
16965
+ }, [columnIndex, onColumnResize, setIsPressed]);
16966
+ const onMouseUp = React.useCallback((e) => {
16967
+ e.stopPropagation();
16968
+ setIsPressed(false);
16969
+ }, [setIsPressed]);
16950
16970
  const onPointerDown = React.useCallback((e) => {
16951
16971
  e.stopPropagation();
16952
16972
  if (resizeRef.current) {
@@ -16968,17 +16988,18 @@ var __publicField = (obj, key, value) => {
16968
16988
  const header = resizeRef.current.closest(`[data-header="${columnIndex}"]`);
16969
16989
  if (header) {
16970
16990
  resizeRef.current.setPointerCapture(pointerRef.current.pointerId);
16971
- const width = header.scrollWidth + (e.clientX - pointerRef.current.initialClientX);
16991
+ const width = header.clientWidth + (e.clientX - pointerRef.current.initialClientX);
16972
16992
  setResizeCursorPosition(resizeRef.current, e.clientX, width, columnIndex);
16973
16993
  pointerRef.current.width = Math.max(width, 50);
16974
16994
  }
16975
16995
  }
16976
16996
  }, [columnIndex, setResizeCursorPosition]);
16977
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizeSpan, { ref: resizeRef, $height: height, onPointerDown, onPointerUp: (e) => {
16978
- var _a;
16997
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizeSpan, { ref: resizeRef, $height: height, $isPressed: isPressed, onPointerDown, onPointerUp: (e) => {
16998
+ var _a, _b;
16979
16999
  e.preventDefault();
16980
17000
  e.stopPropagation();
16981
- if (resizeRef.current && ((_a = pointerRef.current) == null ? void 0 : _a.pointerId)) {
17001
+ if (resizeRef.current && // 0 is a valid pointerId in Firefox
17002
+ (((_a = pointerRef.current) == null ? void 0 : _a.pointerId) || ((_b = pointerRef.current) == null ? void 0 : _b.pointerId) === 0)) {
16982
17003
  resizeRef.current.releasePointerCapture(pointerRef.current.pointerId);
16983
17004
  const shouldCallResize = e.clientX !== pointerRef.current.initialClientX;
16984
17005
  if (shouldCallResize) {
@@ -16988,7 +17009,7 @@ var __publicField = (obj, key, value) => {
16988
17009
  resizeRef.current.style.left = "calc(100% - 4px)";
16989
17010
  pointerRef.current = null;
16990
17011
  }
16991
- }, onMouseMove, onMouseDown, onClick: (e) => e.stopPropagation(), onMouseUp: (e) => e.stopPropagation(), "data-resize": true });
17012
+ }, onMouseMove, onMouseDown, onClick: (e) => e.stopPropagation(), onMouseUp, "data-resize": true });
16992
17013
  };
16993
17014
  const HeaderContainer = styled.div.withConfig({
16994
17015
  componentId: "sc-1oadqc8-0"
@@ -31645,7 +31666,7 @@ var __publicField = (obj, key, value) => {
31645
31666
  $showBorder,
31646
31667
  theme: theme2
31647
31668
  }) => $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 }));
31669
+ const OuterElementType = React.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref, "data-testid": "grid-outer-element", tabIndex: 0, ...props }));
31649
31670
  const Grid = React.forwardRef(({
31650
31671
  autoFocus,
31651
31672
  autoHeight = false,
@@ -0,0 +1,3 @@
1
+ import * as React from "react";
2
+ declare const Switzerland: (props: React.SVGAttributes<SVGElement>) => React.ReactElement;
3
+ export default Switzerland;
@@ -1,7 +1,7 @@
1
1
  import { SVGAttributes } from 'react';
2
2
  import { IconSize } from '../../Icon/types';
3
3
 
4
- export type FlagName = "au" | "br" | "ca" | "de" | "eu" | "gb" | "in" | "ie" | "jp" | "nl" | "sg" | "sw" | "usa" | "uk" | "za";
4
+ export type FlagName = "au" | "br" | "ca" | "ch" | "de" | "eu" | "gb" | "in" | "ie" | "jp" | "nl" | "sg" | "sw" | "usa" | "uk" | "za";
5
5
  export interface FlagProps extends Omit<SVGAttributes<SVGElement>, "size"> {
6
6
  name: FlagName;
7
7
  size?: IconSize;
@@ -10,6 +10,7 @@ export declare const FlagList: {
10
10
  au: (props: SVGAttributes<SVGElement>) => import('react').ReactElement;
11
11
  br: (props: SVGAttributes<SVGElement>) => import('react').ReactElement;
12
12
  ca: (props: SVGAttributes<SVGElement>) => import('react').ReactElement;
13
+ ch: (props: SVGAttributes<SVGElement>) => import('react').ReactElement;
13
14
  de: (props: SVGAttributes<SVGElement>) => import('react').ReactElement;
14
15
  eu: (props: SVGAttributes<SVGElement>) => import('react').ReactElement;
15
16
  gb: (props: SVGAttributes<SVGElement>) => import('react').ReactElement;
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.158",
4
4
  "description": "Official ClickHouse design system react library",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",