@snack-uikit/chips 0.23.3 → 0.23.4-preview-0ee176c6.0
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/cjs/components/ChipChoice/components/ChipChoiceMultiple.d.ts +1 -1
- package/dist/cjs/components/ChipChoice/components/ChipChoiceMultiple.js +3 -2
- package/dist/cjs/components/ChipChoice/components/ChipChoiceSingle.d.ts +1 -1
- package/dist/cjs/components/ChipChoice/components/ChipChoiceSingle.js +3 -2
- package/dist/cjs/components/ChipChoice/types.d.ts +3 -0
- package/dist/esm/components/ChipChoice/components/ChipChoiceMultiple.d.ts +1 -1
- package/dist/esm/components/ChipChoice/components/ChipChoiceMultiple.js +2 -2
- package/dist/esm/components/ChipChoice/components/ChipChoiceSingle.d.ts +1 -1
- package/dist/esm/components/ChipChoice/components/ChipChoiceSingle.js +2 -2
- package/dist/esm/components/ChipChoice/types.d.ts +3 -0
- package/package.json +4 -4
- package/src/components/ChipChoice/components/ChipChoiceMultiple.tsx +3 -2
- package/src/components/ChipChoice/components/ChipChoiceSingle.tsx +3 -2
- package/src/components/ChipChoice/types.ts +3 -0
|
@@ -5,4 +5,4 @@ export type ChipChoiceMultipleValueFormatterProps<T extends ContentRenderProps =
|
|
|
5
5
|
total: number;
|
|
6
6
|
allLabel: string;
|
|
7
7
|
};
|
|
8
|
-
export declare function ChipChoiceMultiple<T extends ContentRenderProps = ContentRenderProps>({ value: valueProp, defaultValue, options, onChange: onChangeProp, valueRender, size, label, searchable, contentRender, dropDownClassName, showClearButton, autoApply, onApprove, onCancel, ...rest }: ChipChoiceMultipleProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function ChipChoiceMultiple<T extends ContentRenderProps = ContentRenderProps>({ value: valueProp, defaultValue, options, onChange: onChangeProp, valueRender, size, label, searchable, contentRender, dropDownClassName, showClearButton, autoApply, disableFuzzySearch, onApprove, onCancel, ...rest }: ChipChoiceMultipleProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -52,10 +52,11 @@ function ChipChoiceMultiple(_a) {
|
|
|
52
52
|
dropDownClassName,
|
|
53
53
|
showClearButton = true,
|
|
54
54
|
autoApply = true,
|
|
55
|
+
disableFuzzySearch = false,
|
|
55
56
|
onApprove,
|
|
56
57
|
onCancel
|
|
57
58
|
} = _a,
|
|
58
|
-
rest = __rest(_a, ["value", "defaultValue", "options", "onChange", "valueRender", "size", "label", "searchable", "contentRender", "dropDownClassName", "showClearButton", "autoApply", "onApprove", "onCancel"]);
|
|
59
|
+
rest = __rest(_a, ["value", "defaultValue", "options", "onChange", "valueRender", "size", "label", "searchable", "contentRender", "dropDownClassName", "showClearButton", "autoApply", "disableFuzzySearch", "onApprove", "onCancel"]);
|
|
59
60
|
const [value, setValue] = (0, utils_1.useValueControl)({
|
|
60
61
|
value: valueProp,
|
|
61
62
|
defaultValue,
|
|
@@ -89,7 +90,7 @@ function ChipChoiceMultiple(_a) {
|
|
|
89
90
|
allLabel: t('allLabel')
|
|
90
91
|
});
|
|
91
92
|
const fuzzySearch = (0, hooks_1.useFuzzySearch)(options, flatMapOptions);
|
|
92
|
-
const result = (0, react_1.useMemo)(() => !searchable || valueToRender === searchValue ? options : fuzzySearch(searchValue), [fuzzySearch, options, searchValue, searchable, valueToRender]);
|
|
93
|
+
const result = (0, react_1.useMemo)(() => (!searchable || valueToRender === searchValue) && !disableFuzzySearch ? options : fuzzySearch(searchValue), [fuzzySearch, options, searchValue, searchable, valueToRender, disableFuzzySearch]);
|
|
93
94
|
const items = (0, react_1.useMemo)(() => (0, options_1.transformOptionsToItems)(result, contentRender), [contentRender, result]);
|
|
94
95
|
const clearValue = () => {
|
|
95
96
|
setValue([]);
|
|
@@ -5,4 +5,4 @@ export type ChipChoiceSingleValueFormatterProps = {
|
|
|
5
5
|
allLabel?: string;
|
|
6
6
|
};
|
|
7
7
|
export declare function defaultSingleValueFormatter({ label, allLabel }: ChipChoiceSingleValueFormatterProps): ItemId | undefined;
|
|
8
|
-
export declare function ChipChoiceSingle<T extends ContentRenderProps = ContentRenderProps>({ value: valueProp, defaultValue, options, onChange: onChangeProp, valueRender, size, label, searchable, contentRender, dropDownClassName, autoApply, onApprove, onCancel, ...rest }: ChipChoiceSingleProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function ChipChoiceSingle<T extends ContentRenderProps = ContentRenderProps>({ value: valueProp, defaultValue, options, onChange: onChangeProp, valueRender, size, label, searchable, contentRender, dropDownClassName, disableFuzzySearch, autoApply, onApprove, onCancel, ...rest }: ChipChoiceSingleProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -43,11 +43,12 @@ function ChipChoiceSingle(_a) {
|
|
|
43
43
|
searchable,
|
|
44
44
|
contentRender,
|
|
45
45
|
dropDownClassName,
|
|
46
|
+
disableFuzzySearch,
|
|
46
47
|
autoApply = true,
|
|
47
48
|
onApprove,
|
|
48
49
|
onCancel
|
|
49
50
|
} = _a,
|
|
50
|
-
rest = __rest(_a, ["value", "defaultValue", "options", "onChange", "valueRender", "size", "label", "searchable", "contentRender", "dropDownClassName", "autoApply", "onApprove", "onCancel"]);
|
|
51
|
+
rest = __rest(_a, ["value", "defaultValue", "options", "onChange", "valueRender", "size", "label", "searchable", "contentRender", "dropDownClassName", "disableFuzzySearch", "autoApply", "onApprove", "onCancel"]);
|
|
51
52
|
const [value, setValue] = (0, utils_1.useValueControl)({
|
|
52
53
|
value: valueProp,
|
|
53
54
|
defaultValue,
|
|
@@ -80,7 +81,7 @@ function ChipChoiceSingle(_a) {
|
|
|
80
81
|
allLabel: t('allLabel')
|
|
81
82
|
});
|
|
82
83
|
const fuzzySearch = (0, hooks_1.useFuzzySearch)(options, flatMapOptions);
|
|
83
|
-
const result = (0, react_1.useMemo)(() => !searchable || valueToRender === searchValue ? options : fuzzySearch(searchValue), [fuzzySearch, options, searchValue, searchable, valueToRender]);
|
|
84
|
+
const result = (0, react_1.useMemo)(() => (!searchable || valueToRender === searchValue) && !disableFuzzySearch ? options : fuzzySearch(searchValue), [disableFuzzySearch, fuzzySearch, options, searchValue, searchable, valueToRender]);
|
|
84
85
|
const items = (0, react_1.useMemo)(() => (0, options_1.transformOptionsToItems)(result, contentRender), [contentRender, result]);
|
|
85
86
|
const clearValue = () => {
|
|
86
87
|
setValue(undefined);
|
|
@@ -59,6 +59,9 @@ export type ChipChoiceSelectCommonProps<T extends ContentRenderProps = ContentRe
|
|
|
59
59
|
contentRenderProps?: T;
|
|
60
60
|
}): boolean;
|
|
61
61
|
searchable?: boolean;
|
|
62
|
+
/** Иногда в дроплисте могут быть различные айдишники - нам важно искать их без Fuzzy Search */
|
|
63
|
+
/** @default false */
|
|
64
|
+
disableFuzzySearch?: boolean;
|
|
62
65
|
/** Флаг, отвечающий за применение выбранного значения по умолчанию */
|
|
63
66
|
autoApply?: boolean;
|
|
64
67
|
/** Колбек основной кнопки */
|
|
@@ -5,4 +5,4 @@ export type ChipChoiceMultipleValueFormatterProps<T extends ContentRenderProps =
|
|
|
5
5
|
total: number;
|
|
6
6
|
allLabel: string;
|
|
7
7
|
};
|
|
8
|
-
export declare function ChipChoiceMultiple<T extends ContentRenderProps = ContentRenderProps>({ value: valueProp, defaultValue, options, onChange: onChangeProp, valueRender, size, label, searchable, contentRender, dropDownClassName, showClearButton, autoApply, onApprove, onCancel, ...rest }: ChipChoiceMultipleProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function ChipChoiceMultiple<T extends ContentRenderProps = ContentRenderProps>({ value: valueProp, defaultValue, options, onChange: onChangeProp, valueRender, size, label, searchable, contentRender, dropDownClassName, showClearButton, autoApply, disableFuzzySearch, onApprove, onCancel, ...rest }: ChipChoiceMultipleProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -31,7 +31,7 @@ const defaultMultiValueLabelFormatter = ({ value, total, allLabel }) => {
|
|
|
31
31
|
return `${len.toString()}/${total}`;
|
|
32
32
|
};
|
|
33
33
|
export function ChipChoiceMultiple(_a) {
|
|
34
|
-
var { value: valueProp, defaultValue, options, onChange: onChangeProp, valueRender, size = SIZE.S, label, searchable, contentRender, dropDownClassName, showClearButton = true, autoApply = true, onApprove, onCancel } = _a, rest = __rest(_a, ["value", "defaultValue", "options", "onChange", "valueRender", "size", "label", "searchable", "contentRender", "dropDownClassName", "showClearButton", "autoApply", "onApprove", "onCancel"]);
|
|
34
|
+
var { value: valueProp, defaultValue, options, onChange: onChangeProp, valueRender, size = SIZE.S, label, searchable, contentRender, dropDownClassName, showClearButton = true, autoApply = true, disableFuzzySearch = false, onApprove, onCancel } = _a, rest = __rest(_a, ["value", "defaultValue", "options", "onChange", "valueRender", "size", "label", "searchable", "contentRender", "dropDownClassName", "showClearButton", "autoApply", "disableFuzzySearch", "onApprove", "onCancel"]);
|
|
35
35
|
const [value, setValue] = useValueControl({
|
|
36
36
|
value: valueProp,
|
|
37
37
|
defaultValue,
|
|
@@ -59,7 +59,7 @@ export function ChipChoiceMultiple(_a) {
|
|
|
59
59
|
allLabel: t('allLabel'),
|
|
60
60
|
});
|
|
61
61
|
const fuzzySearch = useFuzzySearch(options, flatMapOptions);
|
|
62
|
-
const result = useMemo(() => (!searchable || valueToRender === searchValue ? options : fuzzySearch(searchValue)), [fuzzySearch, options, searchValue, searchable, valueToRender]);
|
|
62
|
+
const result = useMemo(() => ((!searchable || valueToRender === searchValue) && !disableFuzzySearch ? options : fuzzySearch(searchValue)), [fuzzySearch, options, searchValue, searchable, valueToRender, disableFuzzySearch]);
|
|
63
63
|
const items = useMemo(() => transformOptionsToItems(result, contentRender), [contentRender, result]);
|
|
64
64
|
const clearValue = () => {
|
|
65
65
|
setValue([]);
|
|
@@ -5,4 +5,4 @@ export type ChipChoiceSingleValueFormatterProps = {
|
|
|
5
5
|
allLabel?: string;
|
|
6
6
|
};
|
|
7
7
|
export declare function defaultSingleValueFormatter({ label, allLabel }: ChipChoiceSingleValueFormatterProps): ItemId | undefined;
|
|
8
|
-
export declare function ChipChoiceSingle<T extends ContentRenderProps = ContentRenderProps>({ value: valueProp, defaultValue, options, onChange: onChangeProp, valueRender, size, label, searchable, contentRender, dropDownClassName, autoApply, onApprove, onCancel, ...rest }: ChipChoiceSingleProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function ChipChoiceSingle<T extends ContentRenderProps = ContentRenderProps>({ value: valueProp, defaultValue, options, onChange: onChangeProp, valueRender, size, label, searchable, contentRender, dropDownClassName, disableFuzzySearch, autoApply, onApprove, onCancel, ...rest }: ChipChoiceSingleProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -24,7 +24,7 @@ export function defaultSingleValueFormatter({ label, allLabel }) {
|
|
|
24
24
|
return label !== null && label !== void 0 ? label : allLabel;
|
|
25
25
|
}
|
|
26
26
|
export function ChipChoiceSingle(_a) {
|
|
27
|
-
var { value: valueProp, defaultValue, options, onChange: onChangeProp, valueRender, size = SIZE.S, label, searchable, contentRender, dropDownClassName, autoApply = true, onApprove, onCancel } = _a, rest = __rest(_a, ["value", "defaultValue", "options", "onChange", "valueRender", "size", "label", "searchable", "contentRender", "dropDownClassName", "autoApply", "onApprove", "onCancel"]);
|
|
27
|
+
var { value: valueProp, defaultValue, options, onChange: onChangeProp, valueRender, size = SIZE.S, label, searchable, contentRender, dropDownClassName, disableFuzzySearch, autoApply = true, onApprove, onCancel } = _a, rest = __rest(_a, ["value", "defaultValue", "options", "onChange", "valueRender", "size", "label", "searchable", "contentRender", "dropDownClassName", "disableFuzzySearch", "autoApply", "onApprove", "onCancel"]);
|
|
28
28
|
const [value, setValue] = useValueControl({
|
|
29
29
|
value: valueProp,
|
|
30
30
|
defaultValue,
|
|
@@ -48,7 +48,7 @@ export function ChipChoiceSingle(_a) {
|
|
|
48
48
|
? valueRender(selectedOption)
|
|
49
49
|
: defaultSingleValueFormatter({ label: selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label, allLabel: t('allLabel') });
|
|
50
50
|
const fuzzySearch = useFuzzySearch(options, flatMapOptions);
|
|
51
|
-
const result = useMemo(() => (!searchable || valueToRender === searchValue ? options : fuzzySearch(searchValue)), [fuzzySearch, options, searchValue, searchable, valueToRender]);
|
|
51
|
+
const result = useMemo(() => ((!searchable || valueToRender === searchValue) && !disableFuzzySearch ? options : fuzzySearch(searchValue)), [disableFuzzySearch, fuzzySearch, options, searchValue, searchable, valueToRender]);
|
|
52
52
|
const items = useMemo(() => transformOptionsToItems(result, contentRender), [contentRender, result]);
|
|
53
53
|
const clearValue = () => {
|
|
54
54
|
setValue(undefined);
|
|
@@ -59,6 +59,9 @@ export type ChipChoiceSelectCommonProps<T extends ContentRenderProps = ContentRe
|
|
|
59
59
|
contentRenderProps?: T;
|
|
60
60
|
}): boolean;
|
|
61
61
|
searchable?: boolean;
|
|
62
|
+
/** Иногда в дроплисте могут быть различные айдишники - нам важно искать их без Fuzzy Search */
|
|
63
|
+
/** @default false */
|
|
64
|
+
disableFuzzySearch?: boolean;
|
|
62
65
|
/** Флаг, отвечающий за применение выбранного значения по умолчанию */
|
|
63
66
|
autoApply?: boolean;
|
|
64
67
|
/** Колбек основной кнопки */
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"title": "Chips",
|
|
7
|
-
"version": "0.23.
|
|
7
|
+
"version": "0.23.4-preview-0ee176c6.0",
|
|
8
8
|
"sideEffects": [
|
|
9
9
|
"*.css",
|
|
10
10
|
"*.woff",
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
"scripts": {},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@snack-uikit/button": "0.19.5",
|
|
40
|
-
"@snack-uikit/calendar": "0.11.
|
|
40
|
+
"@snack-uikit/calendar": "0.11.15-preview-0ee176c6.0",
|
|
41
41
|
"@snack-uikit/dropdown": "0.4.2",
|
|
42
42
|
"@snack-uikit/icons": "0.24.1",
|
|
43
|
-
"@snack-uikit/list": "0.22.
|
|
43
|
+
"@snack-uikit/list": "0.22.3-preview-0ee176c6.0",
|
|
44
44
|
"@snack-uikit/loaders": "0.9.0",
|
|
45
45
|
"@snack-uikit/utils": "3.6.0",
|
|
46
46
|
"classnames": "2.5.1",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@snack-uikit/locale": "*"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "cea4c91459901820b30d140dba4383987fe86583"
|
|
58
58
|
}
|
|
@@ -45,6 +45,7 @@ export function ChipChoiceMultiple<T extends ContentRenderProps = ContentRenderP
|
|
|
45
45
|
dropDownClassName,
|
|
46
46
|
showClearButton = true,
|
|
47
47
|
autoApply = true,
|
|
48
|
+
disableFuzzySearch = false,
|
|
48
49
|
onApprove,
|
|
49
50
|
onCancel,
|
|
50
51
|
...rest
|
|
@@ -92,8 +93,8 @@ export function ChipChoiceMultiple<T extends ContentRenderProps = ContentRenderP
|
|
|
92
93
|
const fuzzySearch = useFuzzySearch(options, flatMapOptions);
|
|
93
94
|
|
|
94
95
|
const result = useMemo(
|
|
95
|
-
() => (!searchable || valueToRender === searchValue ? options : fuzzySearch(searchValue)),
|
|
96
|
-
[fuzzySearch, options, searchValue, searchable, valueToRender],
|
|
96
|
+
() => ((!searchable || valueToRender === searchValue) && !disableFuzzySearch ? options : fuzzySearch(searchValue)),
|
|
97
|
+
[fuzzySearch, options, searchValue, searchable, valueToRender, disableFuzzySearch],
|
|
97
98
|
);
|
|
98
99
|
const items = useMemo(() => transformOptionsToItems<T>(result, contentRender), [contentRender, result]);
|
|
99
100
|
|
|
@@ -32,6 +32,7 @@ export function ChipChoiceSingle<T extends ContentRenderProps = ContentRenderPro
|
|
|
32
32
|
searchable,
|
|
33
33
|
contentRender,
|
|
34
34
|
dropDownClassName,
|
|
35
|
+
disableFuzzySearch,
|
|
35
36
|
autoApply = true,
|
|
36
37
|
onApprove,
|
|
37
38
|
onCancel,
|
|
@@ -76,8 +77,8 @@ export function ChipChoiceSingle<T extends ContentRenderProps = ContentRenderPro
|
|
|
76
77
|
const fuzzySearch = useFuzzySearch(options, flatMapOptions);
|
|
77
78
|
|
|
78
79
|
const result = useMemo(
|
|
79
|
-
() => (!searchable || valueToRender === searchValue ? options : fuzzySearch(searchValue)),
|
|
80
|
-
[fuzzySearch, options, searchValue, searchable, valueToRender],
|
|
80
|
+
() => ((!searchable || valueToRender === searchValue) && !disableFuzzySearch ? options : fuzzySearch(searchValue)),
|
|
81
|
+
[disableFuzzySearch, fuzzySearch, options, searchValue, searchable, valueToRender],
|
|
81
82
|
);
|
|
82
83
|
const items = useMemo(() => transformOptionsToItems<T>(result, contentRender), [contentRender, result]);
|
|
83
84
|
|
|
@@ -98,6 +98,9 @@ export type ChipChoiceSelectCommonProps<T extends ContentRenderProps = ContentRe
|
|
|
98
98
|
|
|
99
99
|
searchable?: boolean;
|
|
100
100
|
|
|
101
|
+
/** Иногда в дроплисте могут быть различные айдишники - нам важно искать их без Fuzzy Search */
|
|
102
|
+
/** @default false */
|
|
103
|
+
disableFuzzySearch?: boolean;
|
|
101
104
|
/** Флаг, отвечающий за применение выбранного значения по умолчанию */
|
|
102
105
|
autoApply?: boolean;
|
|
103
106
|
/** Колбек основной кнопки */
|