@snack-uikit/list 0.16.4 → 0.17.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/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.17.0 (2024-09-27)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### BREAKING CHANGES
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
* **PDS-199:** move change selection from mouse down to click ([7357ca2](https://github.com/cloud-ru-tech/snack-uikit/commit/7357ca2f65f8d5f539c9e11135319110d1447c6b))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## 0.16.4 (2024-09-26)
|
|
7
18
|
|
|
8
19
|
### Only dependencies have been changed
|
|
@@ -14,7 +14,7 @@ import cn from 'classnames';
|
|
|
14
14
|
import { Checkbox, Switch } from '@snack-uikit/toggles';
|
|
15
15
|
import { extractSupportProps } from '@snack-uikit/utils';
|
|
16
16
|
import { ItemContent } from '../../../helperComponents';
|
|
17
|
-
import { useCollapseLevelContext,
|
|
17
|
+
import { useCollapseLevelContext, useNewListContext, useOpenListContext, useSelectionContext, } from '../../Lists/contexts';
|
|
18
18
|
import commonStyles from '../styles.module.css';
|
|
19
19
|
import { isContentItem } from '../utils';
|
|
20
20
|
import { CHECKBOX_SIZE_MAP } from './constants';
|
|
@@ -25,7 +25,6 @@ export function BaseItem(_a) {
|
|
|
25
25
|
const interactive = !inactive;
|
|
26
26
|
const { size = 's', marker, contentRender } = useNewListContext();
|
|
27
27
|
const { level = 0 } = useCollapseLevelContext();
|
|
28
|
-
const { forceUpdateActiveItemId } = useFocusListContext();
|
|
29
28
|
const { closeDroplist, closeDroplistOnItemClick } = useOpenListContext();
|
|
30
29
|
const { value, onChange, mode, isSelectionSingle, isSelectionMultiple } = useSelectionContext();
|
|
31
30
|
const isChecked = isSelectionSingle ? checkedProp !== null && checkedProp !== void 0 ? checkedProp : value === id : checkedProp !== null && checkedProp !== void 0 ? checkedProp : value === null || value === void 0 ? void 0 : value.includes(id !== null && id !== void 0 ? id : '');
|
|
@@ -35,13 +34,7 @@ export function BaseItem(_a) {
|
|
|
35
34
|
const handleItemMouseDown = (e) => {
|
|
36
35
|
if (disabled)
|
|
37
36
|
return;
|
|
38
|
-
if (interactive) {
|
|
39
|
-
if (!isParentNode) {
|
|
40
|
-
handleChange();
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
37
|
onMouseDown === null || onMouseDown === void 0 ? void 0 : onMouseDown(e);
|
|
44
|
-
forceUpdateActiveItemId === null || forceUpdateActiveItemId === void 0 ? void 0 : forceUpdateActiveItemId('~drop-focus');
|
|
45
38
|
};
|
|
46
39
|
const handleItemFocus = (e) => {
|
|
47
40
|
onFocus === null || onFocus === void 0 ? void 0 : onFocus(e);
|
|
@@ -58,6 +51,11 @@ export function BaseItem(_a) {
|
|
|
58
51
|
const handleItemClick = (e) => {
|
|
59
52
|
if (!disabled) {
|
|
60
53
|
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
54
|
+
if (interactive) {
|
|
55
|
+
if (!isParentNode) {
|
|
56
|
+
handleChange();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
61
59
|
if (!isSelectionMultiple && closeDroplistOnItemClick) {
|
|
62
60
|
closeDroplist();
|
|
63
61
|
}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"title": "List",
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.17.0",
|
|
8
8
|
"sideEffects": [
|
|
9
9
|
"*.css",
|
|
10
10
|
"*.woff",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@snack-uikit/info-block": "0.4.9",
|
|
40
40
|
"@snack-uikit/loaders": "0.5.3",
|
|
41
41
|
"@snack-uikit/scroll": "0.6.2",
|
|
42
|
-
"@snack-uikit/search-private": "0.2.
|
|
42
|
+
"@snack-uikit/search-private": "0.2.5",
|
|
43
43
|
"@snack-uikit/toggles": "0.10.4",
|
|
44
44
|
"@snack-uikit/truncate-string": "0.4.24",
|
|
45
45
|
"@snack-uikit/utils": "3.4.0",
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"@snack-uikit/locale": "*"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "36a86f3bf30c115e8c6b49f6c8d7a2d2ffb86ff1"
|
|
53
53
|
}
|
|
@@ -7,7 +7,6 @@ import { extractSupportProps } from '@snack-uikit/utils';
|
|
|
7
7
|
import { ItemContent } from '../../../helperComponents';
|
|
8
8
|
import {
|
|
9
9
|
useCollapseLevelContext,
|
|
10
|
-
useFocusListContext,
|
|
11
10
|
useNewListContext,
|
|
12
11
|
useOpenListContext,
|
|
13
12
|
useSelectionContext,
|
|
@@ -55,7 +54,6 @@ export function BaseItem({
|
|
|
55
54
|
|
|
56
55
|
const { size = 's', marker, contentRender } = useNewListContext();
|
|
57
56
|
const { level = 0 } = useCollapseLevelContext();
|
|
58
|
-
const { forceUpdateActiveItemId } = useFocusListContext();
|
|
59
57
|
const { closeDroplist, closeDroplistOnItemClick } = useOpenListContext();
|
|
60
58
|
const { value, onChange, mode, isSelectionSingle, isSelectionMultiple } = useSelectionContext();
|
|
61
59
|
|
|
@@ -68,15 +66,7 @@ export function BaseItem({
|
|
|
68
66
|
const handleItemMouseDown = (e: MouseEvent<HTMLElement>) => {
|
|
69
67
|
if (disabled) return;
|
|
70
68
|
|
|
71
|
-
if (interactive) {
|
|
72
|
-
if (!isParentNode) {
|
|
73
|
-
handleChange();
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
69
|
onMouseDown?.(e);
|
|
78
|
-
|
|
79
|
-
forceUpdateActiveItemId?.('~drop-focus');
|
|
80
70
|
};
|
|
81
71
|
|
|
82
72
|
const handleItemFocus = (e: FocusEvent<HTMLElement>) => {
|
|
@@ -96,6 +86,12 @@ export function BaseItem({
|
|
|
96
86
|
if (!disabled) {
|
|
97
87
|
onClick?.(e);
|
|
98
88
|
|
|
89
|
+
if (interactive) {
|
|
90
|
+
if (!isParentNode) {
|
|
91
|
+
handleChange();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
99
95
|
if (!isSelectionMultiple && closeDroplistOnItemClick) {
|
|
100
96
|
closeDroplist();
|
|
101
97
|
}
|