@snack-uikit/list 0.31.7 → 0.32.1-preview-805e5f0d.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 +11 -0
- package/dist/cjs/components/Items/SearchItem/SearchItem.js +2 -0
- package/dist/cjs/types.d.ts +3 -2
- package/dist/esm/components/Items/SearchItem/SearchItem.js +2 -0
- package/dist/esm/types.d.ts +3 -2
- package/package.json +3 -3
- package/src/components/Items/SearchItem/SearchItem.tsx +3 -1
- package/src/types.ts +3 -2
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.32.0 (2025-07-17)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **PDS-2615:** add search prop handlers ([f47a528](https://github.com/cloud-ru-tech/snack-uikit/commit/f47a52835b18b7169b3d932a84dea2df8638335e))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## 0.31.7 (2025-07-17)
|
|
7
18
|
|
|
8
19
|
### Only dependencies have been changed
|
|
@@ -27,9 +27,11 @@ function SearchItem(_ref) {
|
|
|
27
27
|
firstItemId
|
|
28
28
|
} = (0, contexts_1.useNewListContext)();
|
|
29
29
|
const handleKeyDown = e => {
|
|
30
|
+
var _a;
|
|
30
31
|
if (['ArrowDown', 'ArrowUp'].includes(e.key)) {
|
|
31
32
|
e.preventDefault();
|
|
32
33
|
}
|
|
34
|
+
(_a = search === null || search === void 0 ? void 0 : search.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(search, e);
|
|
33
35
|
};
|
|
34
36
|
if (!search) {
|
|
35
37
|
return null;
|
package/dist/cjs/types.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { RefObject } from 'react';
|
|
1
|
+
import { ChangeEvent, KeyboardEvent, RefObject } from 'react';
|
|
2
2
|
import { ScrollProps as OriginalScrollProps } from '@snack-uikit/scroll';
|
|
3
3
|
export type SearchState = {
|
|
4
4
|
placeholder?: string;
|
|
5
5
|
loading?: boolean;
|
|
6
6
|
value?: string;
|
|
7
|
-
onChange(value: string): void;
|
|
7
|
+
onChange(value: string, e?: ChangeEvent<HTMLInputElement>): void;
|
|
8
|
+
onKeyDown?(e: KeyboardEvent<HTMLElement>): void;
|
|
8
9
|
};
|
|
9
10
|
export type ScrollProps = {
|
|
10
11
|
/** Включить ли скролл для основной части списка */
|
|
@@ -9,9 +9,11 @@ import styles from './styles.module.css';
|
|
|
9
9
|
export function SearchItem({ search, itemRef }) {
|
|
10
10
|
const { size = 's', firstItemId } = useNewListContext();
|
|
11
11
|
const handleKeyDown = (e) => {
|
|
12
|
+
var _a;
|
|
12
13
|
if (['ArrowDown', 'ArrowUp'].includes(e.key)) {
|
|
13
14
|
e.preventDefault();
|
|
14
15
|
}
|
|
16
|
+
(_a = search === null || search === void 0 ? void 0 : search.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(search, e);
|
|
15
17
|
};
|
|
16
18
|
if (!search) {
|
|
17
19
|
return null;
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { RefObject } from 'react';
|
|
1
|
+
import { ChangeEvent, KeyboardEvent, RefObject } from 'react';
|
|
2
2
|
import { ScrollProps as OriginalScrollProps } from '@snack-uikit/scroll';
|
|
3
3
|
export type SearchState = {
|
|
4
4
|
placeholder?: string;
|
|
5
5
|
loading?: boolean;
|
|
6
6
|
value?: string;
|
|
7
|
-
onChange(value: string): void;
|
|
7
|
+
onChange(value: string, e?: ChangeEvent<HTMLInputElement>): void;
|
|
8
|
+
onKeyDown?(e: KeyboardEvent<HTMLElement>): void;
|
|
8
9
|
};
|
|
9
10
|
export type ScrollProps = {
|
|
10
11
|
/** Включить ли скролл для основной части списка */
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"title": "List",
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.32.1-preview-805e5f0d.0",
|
|
8
8
|
"sideEffects": [
|
|
9
9
|
"*.css",
|
|
10
10
|
"*.woff",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@snack-uikit/info-block": "0.6.31",
|
|
44
44
|
"@snack-uikit/loaders": "0.9.8",
|
|
45
45
|
"@snack-uikit/scroll": "0.10.4",
|
|
46
|
-
"@snack-uikit/search-private": "0.4.
|
|
46
|
+
"@snack-uikit/search-private": "0.4.27-preview-805e5f0d.0",
|
|
47
47
|
"@snack-uikit/toggles": "0.13.20",
|
|
48
48
|
"@snack-uikit/truncate-string": "0.7.0",
|
|
49
49
|
"@snack-uikit/utils": "3.10.1",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@snack-uikit/locale": "*"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "66be1c70bfc2d90474dff3652e0f6ddd67510d78"
|
|
58
58
|
}
|
|
@@ -18,10 +18,12 @@ export type SearchItemProps = {
|
|
|
18
18
|
export function SearchItem({ search, itemRef }: SearchItemProps) {
|
|
19
19
|
const { size = 's', firstItemId } = useNewListContext();
|
|
20
20
|
|
|
21
|
-
const handleKeyDown = (e: KeyboardEvent) => {
|
|
21
|
+
const handleKeyDown = (e: KeyboardEvent<HTMLInputElement>) => {
|
|
22
22
|
if (['ArrowDown', 'ArrowUp'].includes(e.key)) {
|
|
23
23
|
e.preventDefault();
|
|
24
24
|
}
|
|
25
|
+
|
|
26
|
+
search?.onKeyDown?.(e);
|
|
25
27
|
};
|
|
26
28
|
|
|
27
29
|
if (!search) {
|
package/src/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RefObject } from 'react';
|
|
1
|
+
import { ChangeEvent, KeyboardEvent, RefObject } from 'react';
|
|
2
2
|
|
|
3
3
|
import { ScrollProps as OriginalScrollProps } from '@snack-uikit/scroll';
|
|
4
4
|
|
|
@@ -6,7 +6,8 @@ export type SearchState = {
|
|
|
6
6
|
placeholder?: string;
|
|
7
7
|
loading?: boolean;
|
|
8
8
|
value?: string;
|
|
9
|
-
onChange(value: string): void;
|
|
9
|
+
onChange(value: string, e?: ChangeEvent<HTMLInputElement>): void;
|
|
10
|
+
onKeyDown?(e: KeyboardEvent<HTMLElement>): void;
|
|
10
11
|
};
|
|
11
12
|
|
|
12
13
|
export type ScrollProps = {
|