@clickhouse/click-ui 0.0.193 → 0.0.194

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.
@@ -38422,9 +38422,9 @@ const InternalSelect = ({
38422
38422
  if (e.key === "Enter") {
38423
38423
  e.preventDefault();
38424
38424
  if (highlighted) {
38425
- onSelect(highlighted);
38425
+ onSelect(highlighted, void 0, e);
38426
38426
  } else if (visibleList.current.length === 0 && allowCreateOption) {
38427
- onSelect(search, "custom");
38427
+ onSelect(search, "custom", e);
38428
38428
  }
38429
38429
  } else if (["ArrowUp", "ArrowDown", "Home", "End"].includes(e.key)) {
38430
38430
  e.preventDefault();
@@ -38471,7 +38471,7 @@ const InternalSelect = ({
38471
38471
  e.preventDefault();
38472
38472
  e.stopPropagation();
38473
38473
  if (allowCreateOption) {
38474
- onSelect(search, "custom");
38474
+ onSelect(search, "custom", e);
38475
38475
  }
38476
38476
  };
38477
38477
  return /* @__PURE__ */ jsxs(FormRoot, { $orientation: orientation, $dir: dir, $addLabelPadding: true, ...props, children: [
@@ -38569,11 +38569,11 @@ const SelectItem = forwardRef(({
38569
38569
  selectedValues,
38570
38570
  onSelect
38571
38571
  } = useOption();
38572
- const onSelectValue = () => {
38572
+ const onSelectValue = (evt) => {
38573
38573
  if (!disabled) {
38574
- onSelect(value);
38574
+ onSelect(value, void 0, evt);
38575
38575
  if (typeof onSelectProp == "function") {
38576
- onSelectProp(value);
38576
+ onSelectProp(value, void 0, evt);
38577
38577
  }
38578
38578
  }
38579
38579
  };
@@ -38618,11 +38618,11 @@ const MultiSelectCheckboxItem = forwardRef(({
38618
38618
  selectedValues,
38619
38619
  onSelect
38620
38620
  } = useOption();
38621
- const onSelectValue = () => {
38621
+ const onSelectValue = (evt) => {
38622
38622
  if (!disabled) {
38623
- onSelect(value);
38623
+ onSelect(value, void 0, evt);
38624
38624
  if (typeof onSelectProp == "function") {
38625
- onSelectProp(value);
38625
+ onSelectProp(value, void 0, evt);
38626
38626
  }
38627
38627
  }
38628
38628
  };
@@ -38680,7 +38680,7 @@ const Select = ({
38680
38680
  onOpenChangeProp(open22);
38681
38681
  }
38682
38682
  }, [onOpenChangeProp]);
38683
- const onSelect = useCallback((value, type) => {
38683
+ const onSelect = useCallback((value, type, evt) => {
38684
38684
  setSelectedValues((values) => {
38685
38685
  if (values[0] !== value) {
38686
38686
  return [value];
@@ -38689,7 +38689,7 @@ const Select = ({
38689
38689
  });
38690
38690
  onOpenChange(false);
38691
38691
  if (typeof onSelectProp === "function") {
38692
- onSelectProp(value, type);
38692
+ onSelectProp(value, type, evt);
38693
38693
  }
38694
38694
  }, [onSelectProp, onOpenChange]);
38695
38695
  const onChange = useCallback((values) => {
@@ -38730,10 +38730,10 @@ const MultiSelect = ({
38730
38730
  useUpdateEffect(() => {
38731
38731
  setSelectedValues(valueProp ?? []);
38732
38732
  }, [valueProp]);
38733
- const onChange = useCallback((values, type) => {
38733
+ const onChange = useCallback((values, type, evt) => {
38734
38734
  setSelectedValues(values);
38735
38735
  if (typeof onSelectProp === "function") {
38736
- onSelectProp(values, type);
38736
+ onSelectProp(values, type, evt);
38737
38737
  }
38738
38738
  }, [onSelectProp]);
38739
38739
  const onSelect = useCallback((value, type) => {
@@ -38437,9 +38437,9 @@ Please read the updated README.md at https://github.com/SortableJS/react-sortabl
38437
38437
  if (e.key === "Enter") {
38438
38438
  e.preventDefault();
38439
38439
  if (highlighted) {
38440
- onSelect(highlighted);
38440
+ onSelect(highlighted, void 0, e);
38441
38441
  } else if (visibleList.current.length === 0 && allowCreateOption) {
38442
- onSelect(search, "custom");
38442
+ onSelect(search, "custom", e);
38443
38443
  }
38444
38444
  } else if (["ArrowUp", "ArrowDown", "Home", "End"].includes(e.key)) {
38445
38445
  e.preventDefault();
@@ -38486,7 +38486,7 @@ Please read the updated README.md at https://github.com/SortableJS/react-sortabl
38486
38486
  e.preventDefault();
38487
38487
  e.stopPropagation();
38488
38488
  if (allowCreateOption) {
38489
- onSelect(search, "custom");
38489
+ onSelect(search, "custom", e);
38490
38490
  }
38491
38491
  };
38492
38492
  return /* @__PURE__ */ jsxRuntime.jsxs(FormRoot, { $orientation: orientation, $dir: dir, $addLabelPadding: true, ...props, children: [
@@ -38584,11 +38584,11 @@ Please read the updated README.md at https://github.com/SortableJS/react-sortabl
38584
38584
  selectedValues,
38585
38585
  onSelect
38586
38586
  } = useOption();
38587
- const onSelectValue = () => {
38587
+ const onSelectValue = (evt) => {
38588
38588
  if (!disabled) {
38589
- onSelect(value);
38589
+ onSelect(value, void 0, evt);
38590
38590
  if (typeof onSelectProp == "function") {
38591
- onSelectProp(value);
38591
+ onSelectProp(value, void 0, evt);
38592
38592
  }
38593
38593
  }
38594
38594
  };
@@ -38633,11 +38633,11 @@ Please read the updated README.md at https://github.com/SortableJS/react-sortabl
38633
38633
  selectedValues,
38634
38634
  onSelect
38635
38635
  } = useOption();
38636
- const onSelectValue = () => {
38636
+ const onSelectValue = (evt) => {
38637
38637
  if (!disabled) {
38638
- onSelect(value);
38638
+ onSelect(value, void 0, evt);
38639
38639
  if (typeof onSelectProp == "function") {
38640
- onSelectProp(value);
38640
+ onSelectProp(value, void 0, evt);
38641
38641
  }
38642
38642
  }
38643
38643
  };
@@ -38695,7 +38695,7 @@ Please read the updated README.md at https://github.com/SortableJS/react-sortabl
38695
38695
  onOpenChangeProp(open22);
38696
38696
  }
38697
38697
  }, [onOpenChangeProp]);
38698
- const onSelect = React.useCallback((value, type) => {
38698
+ const onSelect = React.useCallback((value, type, evt) => {
38699
38699
  setSelectedValues((values) => {
38700
38700
  if (values[0] !== value) {
38701
38701
  return [value];
@@ -38704,7 +38704,7 @@ Please read the updated README.md at https://github.com/SortableJS/react-sortabl
38704
38704
  });
38705
38705
  onOpenChange(false);
38706
38706
  if (typeof onSelectProp === "function") {
38707
- onSelectProp(value, type);
38707
+ onSelectProp(value, type, evt);
38708
38708
  }
38709
38709
  }, [onSelectProp, onOpenChange]);
38710
38710
  const onChange = React.useCallback((values) => {
@@ -38745,10 +38745,10 @@ Please read the updated README.md at https://github.com/SortableJS/react-sortabl
38745
38745
  useUpdateEffect(() => {
38746
38746
  setSelectedValues(valueProp ?? []);
38747
38747
  }, [valueProp]);
38748
- const onChange = React.useCallback((values, type) => {
38748
+ const onChange = React.useCallback((values, type, evt) => {
38749
38749
  setSelectedValues(values);
38750
38750
  if (typeof onSelectProp === "function") {
38751
- onSelectProp(values, type);
38751
+ onSelectProp(values, type, evt);
38752
38752
  }
38753
38753
  }, [onSelectProp]);
38754
38754
  const onSelect = React.useCallback((value, type) => {
@@ -1,8 +1,9 @@
1
+ import { KeyboardEvent, MouseEvent } from 'react';
1
2
  import { SelectContainerProps, SelectionType } from './common/types';
2
3
 
3
4
  export interface MultiSelectProps extends Omit<SelectContainerProps, "onChange" | "value" | "open" | "onOpenChange" | "onSelect"> {
4
5
  defaultValue?: Array<string>;
5
- onSelect?: (value: Array<string>, type?: SelectionType) => void;
6
+ onSelect?: (value: Array<string>, type?: SelectionType, evt?: KeyboardEvent<HTMLElement> | MouseEvent<HTMLElement>) => void;
6
7
  value?: Array<string>;
7
8
  defaultOpen?: boolean;
8
9
  onOpenChange?: (open: boolean) => void;
@@ -1,8 +1,9 @@
1
+ import { KeyboardEvent, MouseEvent } from 'react';
1
2
  import { SelectContainerProps, SelectionType } from './common/types';
2
3
 
3
4
  export interface SelectProps extends Omit<SelectContainerProps, "onChange" | "value" | "sortable" | "open" | "onOpenChange" | "onSelect"> {
4
5
  defaultValue?: string;
5
- onSelect?: (value: string, type?: SelectionType) => void;
6
+ onSelect?: (value: string, type?: SelectionType, evt?: KeyboardEvent<HTMLElement> | MouseEvent<HTMLElement>) => void;
6
7
  value?: string;
7
8
  placeholder?: string;
8
9
  onOpenChange?: (open: boolean) => void;
@@ -1,10 +1,13 @@
1
+ import { KeyboardEvent, MouseEvent } from 'react';
2
+ import { SelectionType } from './types';
3
+
1
4
  type OptionContextProps = {
2
5
  search: string;
3
6
  highlighted?: string;
4
7
  updateHighlighted: (value: string) => void;
5
8
  isHidden: (value?: string) => boolean;
6
9
  selectedValues: Array<string>;
7
- onSelect: (value: string) => void;
10
+ onSelect: (value: string, type?: SelectionType, evt?: KeyboardEvent<HTMLElement> | MouseEvent<HTMLElement>) => void;
8
11
  showCheck?: boolean;
9
12
  };
10
13
  export declare const OptionContext: import('react').Context<OptionContextProps>;
@@ -1,4 +1,4 @@
1
- import { HTMLAttributes, ReactNode } from 'react';
1
+ import { HTMLAttributes, KeyboardEvent, MouseEvent, ReactNode } from 'react';
2
2
  import { HorizontalDirection, IconName } from '../..';
3
3
  import { PopoverProps } from '@radix-ui/react-popover';
4
4
 
@@ -6,7 +6,7 @@ declare type DivProps = HTMLAttributes<HTMLDivElement>;
6
6
  interface SelectItemComponentProps extends Omit<DivProps, "disabled" | "onSelect" | "value" | "children"> {
7
7
  separator?: boolean;
8
8
  disabled?: boolean;
9
- onSelect?: (value: string) => void;
9
+ onSelect?: (value: string, type?: SelectionType, evt?: KeyboardEvent<HTMLElement> | MouseEvent<HTMLElement>) => void;
10
10
  value: string;
11
11
  icon?: IconName;
12
12
  iconDir?: HorizontalDirection;
@@ -59,7 +59,7 @@ interface InternalSelectProps extends PopoverProps, Omit<HTMLAttributes<HTMLDivE
59
59
  onOpenChange: (open: boolean) => void;
60
60
  value: Array<string>;
61
61
  sortable?: boolean;
62
- onSelect: (value: string, type?: SelectionType) => void;
62
+ onSelect: (value: string, type?: SelectionType, evt?: KeyboardEvent<HTMLElement> | MouseEvent<HTMLElement>) => void;
63
63
  multiple?: boolean;
64
64
  checkbox?: boolean;
65
65
  selectLabel?: string;
@@ -4,7 +4,7 @@ export declare const useOption: () => {
4
4
  updateHighlighted: (value: string) => void;
5
5
  isHidden: (value?: string) => boolean;
6
6
  selectedValues: Array<string>;
7
- onSelect: (value: string) => void;
7
+ onSelect: (value: string, type?: import('./types').SelectionType, evt?: import('react').KeyboardEvent<HTMLElement> | import('react').MouseEvent<HTMLElement>) => void;
8
8
  showCheck?: boolean;
9
9
  };
10
10
  export declare const useSearch: () => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clickhouse/click-ui",
3
- "version": "0.0.193",
3
+ "version": "0.0.194",
4
4
  "description": "Official ClickHouse design system react library",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",