@snack-uikit/chips 0.14.0 → 0.14.1
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/CHANGELOG.md +11 -0
- package/dist/components/ChipChoice/components/ChipChoiceMultiple.js +7 -2
- package/dist/components/ChipChoice/components/ChipChoiceSingle.js +1 -1
- package/package.json +3 -3
- package/src/components/ChipChoice/components/ChipChoiceMultiple.tsx +6 -2
- package/src/components/ChipChoice/components/ChipChoiceSingle.tsx +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 0.14.1 (2024-05-13)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **FF-0000:** fix keyboard control ([4fabf88](https://github.com/cloud-ru-tech/snack-uikit/commit/4fabf886d367c8f83648eccae36a7e2d500192da))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# 0.14.0 (2024-05-08)
|
|
7
18
|
|
|
8
19
|
|
|
@@ -59,12 +59,17 @@ export function ChipChoiceMultiple(_a) {
|
|
|
59
59
|
const items = useMemo(() => transformOptionsToItems(result, contentRender), [contentRender, result]);
|
|
60
60
|
const clearValue = () => setValue([]);
|
|
61
61
|
const chipRef = useRef(null);
|
|
62
|
+
const listRef = useRef(null);
|
|
62
63
|
const handleSelectionChange = useCallback((newValue) => {
|
|
64
|
+
var _a;
|
|
63
65
|
if (newValue !== undefined) {
|
|
64
66
|
setValue(newValue);
|
|
67
|
+
if (searchValue) {
|
|
68
|
+
(_a = listRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
69
|
+
}
|
|
65
70
|
setSearchValue('');
|
|
66
71
|
}
|
|
67
|
-
}, [setValue]);
|
|
72
|
+
}, [searchValue, setValue]);
|
|
68
73
|
useEffect(() => {
|
|
69
74
|
if (searchValue && !open) {
|
|
70
75
|
setSearchValue('');
|
|
@@ -74,7 +79,7 @@ export function ChipChoiceMultiple(_a) {
|
|
|
74
79
|
value,
|
|
75
80
|
onChange: handleSelectionChange,
|
|
76
81
|
mode: 'multiple',
|
|
77
|
-
}, trigger: 'clickAndFocusVisible', placement: 'bottom-start', widthStrategy: 'gte', size: DROPLIST_SIZE_MAP[size], "data-test-id": CHIP_CHOICE_TEST_IDS.droplist, open: open,
|
|
82
|
+
}, trigger: 'clickAndFocusVisible', placement: 'bottom-start', widthStrategy: 'gte', listRef: listRef, size: DROPLIST_SIZE_MAP[size], "data-test-id": CHIP_CHOICE_TEST_IDS.droplist, open: open, onOpenChange: open => {
|
|
78
83
|
if (!open) {
|
|
79
84
|
setSearchValue('');
|
|
80
85
|
}
|
|
@@ -66,7 +66,7 @@ export function ChipChoiceSingle(_a) {
|
|
|
66
66
|
value,
|
|
67
67
|
onChange: handleSelectionChange,
|
|
68
68
|
mode: 'single',
|
|
69
|
-
}, "data-test-id": CHIP_CHOICE_TEST_IDS.droplist, size: DROPLIST_SIZE_MAP[size], trigger: 'click', placement: 'bottom-start', className: dropDownClassName, widthStrategy: 'gte', open: open,
|
|
69
|
+
}, "data-test-id": CHIP_CHOICE_TEST_IDS.droplist, size: DROPLIST_SIZE_MAP[size], trigger: 'click', placement: 'bottom-start', className: dropDownClassName, widthStrategy: 'gte', open: open, onOpenChange: open => {
|
|
70
70
|
if (!open) {
|
|
71
71
|
setSearchValue('');
|
|
72
72
|
}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"title": "Chips",
|
|
7
|
-
"version": "0.14.
|
|
7
|
+
"version": "0.14.1",
|
|
8
8
|
"sideEffects": [
|
|
9
9
|
"*.css",
|
|
10
10
|
"*.woff",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@snack-uikit/calendar": "0.7.9",
|
|
37
37
|
"@snack-uikit/dropdown": "0.2.2",
|
|
38
38
|
"@snack-uikit/icons": "0.21.0",
|
|
39
|
-
"@snack-uikit/list": "0.
|
|
39
|
+
"@snack-uikit/list": "0.13.0",
|
|
40
40
|
"@snack-uikit/loaders": "0.5.2",
|
|
41
41
|
"@snack-uikit/utils": "3.3.0",
|
|
42
42
|
"classnames": "2.3.2",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"@snack-uikit/locale": "*"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "d36fe553ce72b92deafee581e70090458827f8ac"
|
|
54
54
|
}
|
|
@@ -90,15 +90,19 @@ export function ChipChoiceMultiple<T extends ContentRenderProps = ContentRenderP
|
|
|
90
90
|
|
|
91
91
|
const clearValue = () => setValue([]);
|
|
92
92
|
const chipRef = useRef<HTMLDivElement>(null);
|
|
93
|
+
const listRef = useRef<HTMLElement>(null);
|
|
93
94
|
|
|
94
95
|
const handleSelectionChange = useCallback(
|
|
95
96
|
(newValue?: SelectionSingleValueType) => {
|
|
96
97
|
if (newValue !== undefined) {
|
|
97
98
|
setValue(newValue);
|
|
99
|
+
if (searchValue) {
|
|
100
|
+
listRef.current?.focus();
|
|
101
|
+
}
|
|
98
102
|
setSearchValue('');
|
|
99
103
|
}
|
|
100
104
|
},
|
|
101
|
-
[setValue],
|
|
105
|
+
[searchValue, setValue],
|
|
102
106
|
);
|
|
103
107
|
|
|
104
108
|
useEffect(() => {
|
|
@@ -119,10 +123,10 @@ export function ChipChoiceMultiple<T extends ContentRenderProps = ContentRenderP
|
|
|
119
123
|
trigger='clickAndFocusVisible'
|
|
120
124
|
placement='bottom-start'
|
|
121
125
|
widthStrategy='gte'
|
|
126
|
+
listRef={listRef}
|
|
122
127
|
size={DROPLIST_SIZE_MAP[size]}
|
|
123
128
|
data-test-id={CHIP_CHOICE_TEST_IDS.droplist}
|
|
124
129
|
open={open}
|
|
125
|
-
triggerElemRef={chipRef}
|
|
126
130
|
onOpenChange={open => {
|
|
127
131
|
if (!open) {
|
|
128
132
|
setSearchValue('');
|