@clickhouse/click-ui 0.0.132 → 0.0.133

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.
@@ -10051,7 +10051,7 @@ const LinkArrow = styled(ArrowContainer).withConfig({
10051
10051
  })([""]);
10052
10052
  const Wrapper$a = styled.div.withConfig({
10053
10053
  componentId: "sc-1drx130-7"
10054
- })(["background-color:", ";border-radius:", ";border:", ";max-width:420px;min-width:320px;display:flex;flex-direction:column;padding:", ";gap:", ";box-shadow:", ";&:hover,:focus{background-color:", ";cursor:pointer;", ",", "{color:", ";}}&[disabled],&[disabled]:hover,&[disabled]:active{background-color:", ";color:", ";border:1px solid ", ";cursor:not-allowed;", ",", "{color:", ";}}"], ({
10054
+ })(["background-color:", ";border-radius:", ";border:", ";max-width:420px;min-width:320px;display:flex;flex-direction:column;padding:", ";gap:", ";box-shadow:", ";&:hover,:focus{background-color:", ";cursor:pointer;", ",", "{color:", ";}}", ""], ({
10055
10055
  theme: theme2
10056
10056
  }) => theme2.click.card.secondary.color.background.default, ({
10057
10057
  theme: theme2
@@ -10069,14 +10069,24 @@ const Wrapper$a = styled.div.withConfig({
10069
10069
  }) => theme2.click.card.secondary.color.background.hover, LinkText, LinkArrow, ({
10070
10070
  theme: theme2
10071
10071
  }) => theme2.click.card.secondary.color.link.hover, ({
10072
+ $disabled,
10072
10073
  theme: theme2
10073
- }) => theme2.click.card.secondary.color.background.disabled, ({
10074
- theme: theme2
10075
- }) => theme2.click.card.secondary.color.title.disabled, ({
10076
- theme: theme2
10077
- }) => theme2.click.card.secondary.color.stroke.disabled, LinkText, LinkArrow, ({
10078
- theme: theme2
10079
- }) => theme2.click.card.secondary.color.link.disabled);
10074
+ }) => $disabled && `
10075
+ &,
10076
+ &:hover,
10077
+ &:focus,
10078
+ &:active {
10079
+ background-color: ${theme2.click.card.secondary.color.background.disabled};
10080
+ color: ${theme2.click.card.secondary.color.title.disabled};
10081
+ border: 1px solid ${theme2.click.card.secondary.color.stroke.disabled};
10082
+ cursor: not-allowed;
10083
+
10084
+ ${LinkText},
10085
+ ${LinkArrow} {
10086
+ color: ${theme2.click.card.secondary.color.link.disabled};
10087
+ }
10088
+ }
10089
+ `);
10080
10090
  const CardSecondary = ({
10081
10091
  title,
10082
10092
  icon,
@@ -10106,7 +10116,7 @@ const CardSecondary = ({
10106
10116
  };
10107
10117
  const Wrapper$9 = styled.div.withConfig({
10108
10118
  componentId: "sc-2dguvi-0"
10109
- })(["background-color:", ";border-radius:", ";border:", ";display:flex;width:100%;max-width:100%;text-align:", ";flex-direction:column;padding:", ";gap:", ";box-shadow:", ";&:hover,&:focus{background-color:", ";cursor:pointer;button{background-color:", ";border-color:", ";&:active{background-color:", ";border-color:", ";}}}&:active{border-color:", ";}&[disabled],&[disabled]:hover,&[disabled]:active{background-color:", ";color:", ";border:1px solid ", ";cursor:not-allowed;button{background-color:", ";border-color:", ";&:active{background-color:", ";border-color:", ";}}}", ""], ({
10119
+ })(["background-color:", ";border-radius:", ";border:", ";display:flex;width:100%;max-width:100%;text-align:", ";flex-direction:column;padding:", ";gap:", ";box-shadow:", ";&:hover,&:focus{background-color:", ";cursor:pointer;button{background-color:", ";border-color:", ";&:active{background-color:", ";border-color:", ";}}}&:active{border-color:", ";}", " ", ""], ({
10110
10120
  theme: theme2
10111
10121
  }) => theme2.click.card.primary.color.background.default, ({
10112
10122
  theme: theme2
@@ -10136,20 +10146,28 @@ const Wrapper$9 = styled.div.withConfig({
10136
10146
  }) => theme2.click.button.basic.color.primary.stroke.active, ({
10137
10147
  theme: theme2
10138
10148
  }) => theme2.click.button.basic.color.primary.stroke.active, ({
10149
+ $disabled,
10139
10150
  theme: theme2
10140
- }) => theme2.click.card.primary.color.background.disabled, ({
10141
- theme: theme2
10142
- }) => theme2.click.card.primary.color.title.disabled, ({
10143
- theme: theme2
10144
- }) => theme2.click.card.primary.color.stroke.disabled, ({
10145
- theme: theme2
10146
- }) => theme2.click.button.basic.color.primary.background.disabled, ({
10147
- theme: theme2
10148
- }) => theme2.click.button.basic.color.primary.stroke.disabled, ({
10149
- theme: theme2
10150
- }) => theme2.click.button.basic.color.primary.background.disabled, ({
10151
- theme: theme2
10152
- }) => theme2.click.button.basic.color.primary.stroke.disabled, ({
10151
+ }) => $disabled && `
10152
+ &,
10153
+ &:hover,
10154
+ &:focus,
10155
+ &:active {
10156
+ background-color: ${theme2.click.card.primary.color.background.disabled};
10157
+ color: ${theme2.click.card.primary.color.title.disabled};
10158
+ border: 1px solid ${theme2.click.card.primary.color.stroke.disabled};
10159
+ cursor: not-allowed;
10160
+
10161
+ button {
10162
+ background-color: ${theme2.click.button.basic.color.primary.background.disabled};
10163
+ border-color: ${theme2.click.button.basic.color.primary.stroke.disabled};
10164
+ &:active {
10165
+ background-color: ${theme2.click.button.basic.color.primary.background.disabled};
10166
+ border-color: ${theme2.click.button.basic.color.primary.stroke.disabled};
10167
+ }
10168
+ }
10169
+ }
10170
+ `, ({
10153
10171
  $isSelected,
10154
10172
  theme: theme2
10155
10173
  }) => $isSelected ? `border-color: ${theme2.click.button.basic.color.primary.stroke.active};` : "");
@@ -31372,6 +31390,7 @@ const Grid = forwardRef(({
31372
31390
  onMouseMove: onMouseMoveProp,
31373
31391
  showBorder = false,
31374
31392
  onCopy: onCopyProp,
31393
+ onCopyCallback,
31375
31394
  onContextMenu: onContextMenuProp,
31376
31395
  forwardedGridRef,
31377
31396
  ...props
@@ -31383,8 +31402,7 @@ const Grid = forwardRef(({
31383
31402
  const [selection, setSelection] = useState(selectionProp ?? {
31384
31403
  type: "empty"
31385
31404
  });
31386
- const onCopy = useCallback(async () => {
31387
- let isCopied = false;
31405
+ const defaultOnCopy = useCallback(async () => {
31388
31406
  try {
31389
31407
  await copyGridElements({
31390
31408
  cell,
@@ -31394,7 +31412,9 @@ const Grid = forwardRef(({
31394
31412
  columnCount,
31395
31413
  outerRef
31396
31414
  });
31397
- isCopied = true;
31415
+ if (onCopyCallback) {
31416
+ onCopyCallback(true);
31417
+ }
31398
31418
  if (showToast) {
31399
31419
  createToast({
31400
31420
  title: "Copied successfully",
@@ -31404,6 +31424,9 @@ const Grid = forwardRef(({
31404
31424
  }
31405
31425
  } catch (e) {
31406
31426
  console.error(e);
31427
+ if (onCopyCallback) {
31428
+ onCopyCallback(false);
31429
+ }
31407
31430
  if (showToast) {
31408
31431
  createToast({
31409
31432
  title: "Failed to copy",
@@ -31411,11 +31434,17 @@ const Grid = forwardRef(({
31411
31434
  type: "danger"
31412
31435
  });
31413
31436
  }
31414
- if (typeof onCopyProp === "function") {
31415
- onCopyProp(isCopied);
31416
- }
31417
31437
  }
31418
- }, [cell, columnCount, focus, focusProp, onCopyProp, rowCount, selection, showToast]);
31438
+ }, [cell, columnCount, focus, focusProp, rowCount, selection, showToast, onCopyCallback]);
31439
+ const customOnCopy = useMemo(() => {
31440
+ const result = async () => {
31441
+ if (onCopyProp) {
31442
+ await onCopyProp(selection, focus);
31443
+ }
31444
+ };
31445
+ return result;
31446
+ }, [onCopyProp, selection, focus]);
31447
+ const onCopy = typeof onCopyProp === "function" ? customOnCopy : defaultOnCopy;
31419
31448
  const defaultMenuOptions = [{
31420
31449
  label: "Copy",
31421
31450
  onSelect: onCopy
@@ -10068,7 +10068,7 @@ var __publicField = (obj, key, value) => {
10068
10068
  })([""]);
10069
10069
  const Wrapper$a = styled.div.withConfig({
10070
10070
  componentId: "sc-1drx130-7"
10071
- })(["background-color:", ";border-radius:", ";border:", ";max-width:420px;min-width:320px;display:flex;flex-direction:column;padding:", ";gap:", ";box-shadow:", ";&:hover,:focus{background-color:", ";cursor:pointer;", ",", "{color:", ";}}&[disabled],&[disabled]:hover,&[disabled]:active{background-color:", ";color:", ";border:1px solid ", ";cursor:not-allowed;", ",", "{color:", ";}}"], ({
10071
+ })(["background-color:", ";border-radius:", ";border:", ";max-width:420px;min-width:320px;display:flex;flex-direction:column;padding:", ";gap:", ";box-shadow:", ";&:hover,:focus{background-color:", ";cursor:pointer;", ",", "{color:", ";}}", ""], ({
10072
10072
  theme: theme2
10073
10073
  }) => theme2.click.card.secondary.color.background.default, ({
10074
10074
  theme: theme2
@@ -10086,14 +10086,24 @@ var __publicField = (obj, key, value) => {
10086
10086
  }) => theme2.click.card.secondary.color.background.hover, LinkText, LinkArrow, ({
10087
10087
  theme: theme2
10088
10088
  }) => theme2.click.card.secondary.color.link.hover, ({
10089
+ $disabled,
10089
10090
  theme: theme2
10090
- }) => theme2.click.card.secondary.color.background.disabled, ({
10091
- theme: theme2
10092
- }) => theme2.click.card.secondary.color.title.disabled, ({
10093
- theme: theme2
10094
- }) => theme2.click.card.secondary.color.stroke.disabled, LinkText, LinkArrow, ({
10095
- theme: theme2
10096
- }) => theme2.click.card.secondary.color.link.disabled);
10091
+ }) => $disabled && `
10092
+ &,
10093
+ &:hover,
10094
+ &:focus,
10095
+ &:active {
10096
+ background-color: ${theme2.click.card.secondary.color.background.disabled};
10097
+ color: ${theme2.click.card.secondary.color.title.disabled};
10098
+ border: 1px solid ${theme2.click.card.secondary.color.stroke.disabled};
10099
+ cursor: not-allowed;
10100
+
10101
+ ${LinkText},
10102
+ ${LinkArrow} {
10103
+ color: ${theme2.click.card.secondary.color.link.disabled};
10104
+ }
10105
+ }
10106
+ `);
10097
10107
  const CardSecondary = ({
10098
10108
  title,
10099
10109
  icon,
@@ -10123,7 +10133,7 @@ var __publicField = (obj, key, value) => {
10123
10133
  };
10124
10134
  const Wrapper$9 = styled.div.withConfig({
10125
10135
  componentId: "sc-2dguvi-0"
10126
- })(["background-color:", ";border-radius:", ";border:", ";display:flex;width:100%;max-width:100%;text-align:", ";flex-direction:column;padding:", ";gap:", ";box-shadow:", ";&:hover,&:focus{background-color:", ";cursor:pointer;button{background-color:", ";border-color:", ";&:active{background-color:", ";border-color:", ";}}}&:active{border-color:", ";}&[disabled],&[disabled]:hover,&[disabled]:active{background-color:", ";color:", ";border:1px solid ", ";cursor:not-allowed;button{background-color:", ";border-color:", ";&:active{background-color:", ";border-color:", ";}}}", ""], ({
10136
+ })(["background-color:", ";border-radius:", ";border:", ";display:flex;width:100%;max-width:100%;text-align:", ";flex-direction:column;padding:", ";gap:", ";box-shadow:", ";&:hover,&:focus{background-color:", ";cursor:pointer;button{background-color:", ";border-color:", ";&:active{background-color:", ";border-color:", ";}}}&:active{border-color:", ";}", " ", ""], ({
10127
10137
  theme: theme2
10128
10138
  }) => theme2.click.card.primary.color.background.default, ({
10129
10139
  theme: theme2
@@ -10153,20 +10163,28 @@ var __publicField = (obj, key, value) => {
10153
10163
  }) => theme2.click.button.basic.color.primary.stroke.active, ({
10154
10164
  theme: theme2
10155
10165
  }) => theme2.click.button.basic.color.primary.stroke.active, ({
10166
+ $disabled,
10156
10167
  theme: theme2
10157
- }) => theme2.click.card.primary.color.background.disabled, ({
10158
- theme: theme2
10159
- }) => theme2.click.card.primary.color.title.disabled, ({
10160
- theme: theme2
10161
- }) => theme2.click.card.primary.color.stroke.disabled, ({
10162
- theme: theme2
10163
- }) => theme2.click.button.basic.color.primary.background.disabled, ({
10164
- theme: theme2
10165
- }) => theme2.click.button.basic.color.primary.stroke.disabled, ({
10166
- theme: theme2
10167
- }) => theme2.click.button.basic.color.primary.background.disabled, ({
10168
- theme: theme2
10169
- }) => theme2.click.button.basic.color.primary.stroke.disabled, ({
10168
+ }) => $disabled && `
10169
+ &,
10170
+ &:hover,
10171
+ &:focus,
10172
+ &:active {
10173
+ background-color: ${theme2.click.card.primary.color.background.disabled};
10174
+ color: ${theme2.click.card.primary.color.title.disabled};
10175
+ border: 1px solid ${theme2.click.card.primary.color.stroke.disabled};
10176
+ cursor: not-allowed;
10177
+
10178
+ button {
10179
+ background-color: ${theme2.click.button.basic.color.primary.background.disabled};
10180
+ border-color: ${theme2.click.button.basic.color.primary.stroke.disabled};
10181
+ &:active {
10182
+ background-color: ${theme2.click.button.basic.color.primary.background.disabled};
10183
+ border-color: ${theme2.click.button.basic.color.primary.stroke.disabled};
10184
+ }
10185
+ }
10186
+ }
10187
+ `, ({
10170
10188
  $isSelected,
10171
10189
  theme: theme2
10172
10190
  }) => $isSelected ? `border-color: ${theme2.click.button.basic.color.primary.stroke.active};` : "");
@@ -31389,6 +31407,7 @@ var __publicField = (obj, key, value) => {
31389
31407
  onMouseMove: onMouseMoveProp,
31390
31408
  showBorder = false,
31391
31409
  onCopy: onCopyProp,
31410
+ onCopyCallback,
31392
31411
  onContextMenu: onContextMenuProp,
31393
31412
  forwardedGridRef,
31394
31413
  ...props
@@ -31400,8 +31419,7 @@ var __publicField = (obj, key, value) => {
31400
31419
  const [selection, setSelection] = React.useState(selectionProp ?? {
31401
31420
  type: "empty"
31402
31421
  });
31403
- const onCopy = React.useCallback(async () => {
31404
- let isCopied = false;
31422
+ const defaultOnCopy = React.useCallback(async () => {
31405
31423
  try {
31406
31424
  await copyGridElements({
31407
31425
  cell,
@@ -31411,7 +31429,9 @@ var __publicField = (obj, key, value) => {
31411
31429
  columnCount,
31412
31430
  outerRef
31413
31431
  });
31414
- isCopied = true;
31432
+ if (onCopyCallback) {
31433
+ onCopyCallback(true);
31434
+ }
31415
31435
  if (showToast) {
31416
31436
  createToast({
31417
31437
  title: "Copied successfully",
@@ -31421,6 +31441,9 @@ var __publicField = (obj, key, value) => {
31421
31441
  }
31422
31442
  } catch (e) {
31423
31443
  console.error(e);
31444
+ if (onCopyCallback) {
31445
+ onCopyCallback(false);
31446
+ }
31424
31447
  if (showToast) {
31425
31448
  createToast({
31426
31449
  title: "Failed to copy",
@@ -31428,11 +31451,17 @@ var __publicField = (obj, key, value) => {
31428
31451
  type: "danger"
31429
31452
  });
31430
31453
  }
31431
- if (typeof onCopyProp === "function") {
31432
- onCopyProp(isCopied);
31433
- }
31434
31454
  }
31435
- }, [cell, columnCount, focus, focusProp, onCopyProp, rowCount, selection, showToast]);
31455
+ }, [cell, columnCount, focus, focusProp, rowCount, selection, showToast, onCopyCallback]);
31456
+ const customOnCopy = React.useMemo(() => {
31457
+ const result = async () => {
31458
+ if (onCopyProp) {
31459
+ await onCopyProp(selection, focus);
31460
+ }
31461
+ };
31462
+ return result;
31463
+ }, [onCopyProp, selection, focus]);
31464
+ const onCopy = typeof onCopyProp === "function" ? customOnCopy : defaultOnCopy;
31436
31465
  const defaultMenuOptions = [{
31437
31466
  label: "Copy",
31438
31467
  onSelect: onCopy
@@ -130,7 +130,8 @@ export interface GridProps extends Omit<VariableSizeGridProps, "height" | "width
130
130
  onMouseDown?: MouseEventHandler<HTMLDivElement>;
131
131
  onMouseMove?: MouseEventHandler<HTMLDivElement>;
132
132
  showBorder?: boolean;
133
- onCopy?: (isCopied: boolean) => void | Promise<void>;
133
+ onCopy?: (selection: SelectedRegion, focus: SelectionFocus) => void | Promise<void>;
134
+ onCopyCallback?: (copied: boolean) => void;
134
135
  onContextMenu?: MouseEventHandler<HTMLDivElement>;
135
136
  forwardedGridRef?: MutableRefObject<VariableSizeGrid>;
136
137
  }
@@ -46,7 +46,7 @@ export type { VerticalStepperProps, VerticalStepProps, } from "./VerticalStepper
46
46
  export type { CardHorizontalProps } from "./CardHorizontal/CardHorizontal";
47
47
  export type { CardPromotionProps } from "./CardPromotion/CardPromotion";
48
48
  export type { ProgressBarProps } from "./ProgressBar/ProgressBar";
49
- export type { GridProps, CellProps, SelectedRegion, SelectionFocus, SelectionAction, GridContextMenuItemProps, } from "./Grid/types";
49
+ export type { GridProps, CellProps, SelectedRegion, SelectionFocus, SelectionAction, GridContextMenuItemProps, Rectangle } from "./Grid/types";
50
50
  export type States = "default" | "active" | "disabled" | "error" | "hover";
51
51
  export type HorizontalDirection = "start" | "end";
52
52
  export type Orientation = "horizontal" | "vertical";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clickhouse/click-ui",
3
- "version": "0.0.132",
3
+ "version": "0.0.133",
4
4
  "description": "Official ClickHouse design system react library",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",