@clickhouse/click-ui 0.0.192 → 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.
- package/dist/click-ui.es.js +19 -19
- package/dist/click-ui.umd.js +19 -19
- package/dist/components/Select/MultiSelect.d.ts +2 -1
- package/dist/components/Select/SingleSelect.d.ts +2 -1
- package/dist/components/Select/common/OptionContext.d.ts +4 -1
- package/dist/components/Select/common/types.d.ts +3 -3
- package/dist/components/Select/common/useOption.d.ts +1 -1
- package/package.json +1 -1
package/dist/click-ui.es.js
CHANGED
|
@@ -38232,15 +38232,15 @@ const SingleSelectValue = ({
|
|
|
38232
38232
|
valueNode,
|
|
38233
38233
|
value
|
|
38234
38234
|
}) => {
|
|
38235
|
+
if (value === void 0 || value === null) {
|
|
38236
|
+
return null;
|
|
38237
|
+
}
|
|
38235
38238
|
const {
|
|
38236
38239
|
icon,
|
|
38237
38240
|
iconDir,
|
|
38238
38241
|
children,
|
|
38239
38242
|
label
|
|
38240
38243
|
} = valueNode ?? {};
|
|
38241
|
-
if (!value) {
|
|
38242
|
-
return null;
|
|
38243
|
-
}
|
|
38244
38244
|
return /* @__PURE__ */ jsx(SelectValueContainer, { children: /* @__PURE__ */ jsx(IconWrapper$3, { icon, iconDir, children: label ?? children ?? value }) });
|
|
38245
38245
|
};
|
|
38246
38246
|
const useOption = () => {
|
|
@@ -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
|
};
|
|
@@ -38672,7 +38672,7 @@ const Select = ({
|
|
|
38672
38672
|
onOpenChange: onOpenChangeProp,
|
|
38673
38673
|
...props
|
|
38674
38674
|
}) => {
|
|
38675
|
-
const [selectedValues, setSelectedValues] = useState(valueProp ? [valueProp] : defaultValue ? [defaultValue] : []);
|
|
38675
|
+
const [selectedValues, setSelectedValues] = useState(typeof valueProp === "string" ? [valueProp] : typeof defaultValue === "string" ? [defaultValue] : []);
|
|
38676
38676
|
const [open2, setOpen] = useState(false);
|
|
38677
38677
|
const onOpenChange = useCallback((open22) => {
|
|
38678
38678
|
setOpen(open22);
|
|
@@ -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) => {
|
|
@@ -38698,7 +38698,7 @@ const Select = ({
|
|
|
38698
38698
|
}
|
|
38699
38699
|
}, [selectedValues, onSelect]);
|
|
38700
38700
|
useUpdateEffect(() => {
|
|
38701
|
-
setSelectedValues(valueProp ? [valueProp] : []);
|
|
38701
|
+
setSelectedValues(typeof valueProp === "string" ? [valueProp] : []);
|
|
38702
38702
|
}, [valueProp]);
|
|
38703
38703
|
const conditionalProps = {};
|
|
38704
38704
|
if (options) {
|
|
@@ -38706,7 +38706,7 @@ const Select = ({
|
|
|
38706
38706
|
} else {
|
|
38707
38707
|
conditionalProps.children = children;
|
|
38708
38708
|
}
|
|
38709
|
-
return /* @__PURE__ */ jsx(InternalSelect, { onChange, value: valueProp ? [valueProp] : selectedValues, open: open2, onOpenChange, onSelect, ...conditionalProps, ...props });
|
|
38709
|
+
return /* @__PURE__ */ jsx(InternalSelect, { onChange, value: typeof valueProp === "string" ? [valueProp] : selectedValues, open: open2, onOpenChange, onSelect, ...conditionalProps, ...props });
|
|
38710
38710
|
};
|
|
38711
38711
|
Select.Group = SelectGroup;
|
|
38712
38712
|
Select.Item = SelectItem;
|
|
@@ -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) => {
|
package/dist/click-ui.umd.js
CHANGED
|
@@ -38247,15 +38247,15 @@ Please read the updated README.md at https://github.com/SortableJS/react-sortabl
|
|
|
38247
38247
|
valueNode,
|
|
38248
38248
|
value
|
|
38249
38249
|
}) => {
|
|
38250
|
+
if (value === void 0 || value === null) {
|
|
38251
|
+
return null;
|
|
38252
|
+
}
|
|
38250
38253
|
const {
|
|
38251
38254
|
icon,
|
|
38252
38255
|
iconDir,
|
|
38253
38256
|
children,
|
|
38254
38257
|
label
|
|
38255
38258
|
} = valueNode ?? {};
|
|
38256
|
-
if (!value) {
|
|
38257
|
-
return null;
|
|
38258
|
-
}
|
|
38259
38259
|
return /* @__PURE__ */ jsxRuntime.jsx(SelectValueContainer, { children: /* @__PURE__ */ jsxRuntime.jsx(IconWrapper$3, { icon, iconDir, children: label ?? children ?? value }) });
|
|
38260
38260
|
};
|
|
38261
38261
|
const useOption = () => {
|
|
@@ -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
|
};
|
|
@@ -38687,7 +38687,7 @@ Please read the updated README.md at https://github.com/SortableJS/react-sortabl
|
|
|
38687
38687
|
onOpenChange: onOpenChangeProp,
|
|
38688
38688
|
...props
|
|
38689
38689
|
}) => {
|
|
38690
|
-
const [selectedValues, setSelectedValues] = React.useState(valueProp ? [valueProp] : defaultValue ? [defaultValue] : []);
|
|
38690
|
+
const [selectedValues, setSelectedValues] = React.useState(typeof valueProp === "string" ? [valueProp] : typeof defaultValue === "string" ? [defaultValue] : []);
|
|
38691
38691
|
const [open2, setOpen] = React.useState(false);
|
|
38692
38692
|
const onOpenChange = React.useCallback((open22) => {
|
|
38693
38693
|
setOpen(open22);
|
|
@@ -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) => {
|
|
@@ -38713,7 +38713,7 @@ Please read the updated README.md at https://github.com/SortableJS/react-sortabl
|
|
|
38713
38713
|
}
|
|
38714
38714
|
}, [selectedValues, onSelect]);
|
|
38715
38715
|
useUpdateEffect(() => {
|
|
38716
|
-
setSelectedValues(valueProp ? [valueProp] : []);
|
|
38716
|
+
setSelectedValues(typeof valueProp === "string" ? [valueProp] : []);
|
|
38717
38717
|
}, [valueProp]);
|
|
38718
38718
|
const conditionalProps = {};
|
|
38719
38719
|
if (options2) {
|
|
@@ -38721,7 +38721,7 @@ Please read the updated README.md at https://github.com/SortableJS/react-sortabl
|
|
|
38721
38721
|
} else {
|
|
38722
38722
|
conditionalProps.children = children;
|
|
38723
38723
|
}
|
|
38724
|
-
return /* @__PURE__ */ jsxRuntime.jsx(InternalSelect, { onChange, value: valueProp ? [valueProp] : selectedValues, open: open2, onOpenChange, onSelect, ...conditionalProps, ...props });
|
|
38724
|
+
return /* @__PURE__ */ jsxRuntime.jsx(InternalSelect, { onChange, value: typeof valueProp === "string" ? [valueProp] : selectedValues, open: open2, onOpenChange, onSelect, ...conditionalProps, ...props });
|
|
38725
38725
|
};
|
|
38726
38726
|
Select.Group = SelectGroup;
|
|
38727
38727
|
Select.Item = SelectItem;
|
|
@@ -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;
|