@snack-uikit/list 0.2.1-preview-a0815a00.0 → 0.2.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 +12 -0
- package/dist/components/Items/BaseItem/BaseItem.d.ts +1 -2
- package/dist/components/Items/BaseItem/BaseItem.js +2 -6
- package/dist/components/Items/types.d.ts +0 -1
- package/package.json +6 -6
- package/src/components/Items/BaseItem/BaseItem.tsx +1 -8
- package/src/components/Items/types.ts +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
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.2.1 (2024-02-05)
|
|
7
|
+
|
|
8
|
+
### Only dependencies have been changed
|
|
9
|
+
* [@snack-uikit/icons@0.20.1](https://github.com/cloud-ru-tech/snack-uikit/blob/master/packages/icons/CHANGELOG.md)
|
|
10
|
+
* [@snack-uikit/search-private@0.1.3](https://github.com/cloud-ru-tech/snack-uikit/blob/master/packages/search-private/CHANGELOG.md)
|
|
11
|
+
* [@snack-uikit/toggles@0.9.5](https://github.com/cloud-ru-tech/snack-uikit/blob/master/packages/toggles/CHANGELOG.md)
|
|
12
|
+
* [@snack-uikit/truncate-string@0.4.7](https://github.com/cloud-ru-tech/snack-uikit/blob/master/packages/truncate-string/CHANGELOG.md)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
6
18
|
# 0.2.0 (2024-02-02)
|
|
7
19
|
|
|
8
20
|
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { BaseItemPrivateProps, BaseItemProps } from '../types';
|
|
3
2
|
type AllBaseItemProps = BaseItemProps & BaseItemPrivateProps & {
|
|
4
3
|
indeterminate?: boolean;
|
|
5
4
|
onSelect?(): void;
|
|
6
5
|
isParentNode?: boolean;
|
|
7
6
|
};
|
|
8
|
-
export declare function BaseItem({ beforeContent, afterContent, content, onClick, id, expandIcon, disabled, open, itemRef, switch: switchProp, onKeyDown, onFocus, indeterminate, onSelect, isParentNode, className, inactive,
|
|
7
|
+
export declare function BaseItem({ beforeContent, afterContent, content, onClick, id, expandIcon, disabled, open, itemRef, switch: switchProp, onKeyDown, onFocus, indeterminate, onSelect, isParentNode, className, inactive, ...rest }: AllBaseItemProps): import("react/jsx-runtime").JSX.Element;
|
|
9
8
|
export {};
|
|
@@ -19,7 +19,7 @@ import commonStyles from '../styles.module.css';
|
|
|
19
19
|
import { CHECKBOX_SIZE_MAP } from './constants';
|
|
20
20
|
import styles from './styles.module.css';
|
|
21
21
|
export function BaseItem(_a) {
|
|
22
|
-
var { beforeContent, afterContent, content, onClick, id, expandIcon, disabled, open, itemRef, switch: switchProp, onKeyDown, onFocus, indeterminate, onSelect, isParentNode, className, inactive
|
|
22
|
+
var { beforeContent, afterContent, content, onClick, id, expandIcon, disabled, open, itemRef, switch: switchProp, onKeyDown, onFocus, indeterminate, onSelect, isParentNode, className, inactive } = _a, rest = __rest(_a, ["beforeContent", "afterContent", "content", "onClick", "id", "expandIcon", "disabled", "open", "itemRef", "switch", "onKeyDown", "onFocus", "indeterminate", "onSelect", "isParentNode", "className", "inactive"]);
|
|
23
23
|
const { option, caption, description } = content || {};
|
|
24
24
|
const interactive = !inactive;
|
|
25
25
|
const { parentResetActiveFocusIndex } = useParentListContext();
|
|
@@ -68,9 +68,5 @@ export function BaseItem(_a) {
|
|
|
68
68
|
e.stopPropagation();
|
|
69
69
|
};
|
|
70
70
|
const props = extractSupportProps(rest);
|
|
71
|
-
|
|
72
|
-
if (!itemWrapRender) {
|
|
73
|
-
return item;
|
|
74
|
-
}
|
|
75
|
-
return itemWrapRender(item);
|
|
71
|
+
return (_jsx("li", { role: 'menuitem', "data-test-id": props['data-test-id'] || 'list__base-item_' + id, children: _jsxs("button", { ref: itemRef, className: cn(commonStyles.listItem, styles.droplistItem, className), "data-size": size, onClick: handleItemClick, tabIndex: -1, "data-non-pointer": inactive && !onClick, "data-inactive": inactive || undefined, "data-checked": (isParentNode && (indeterminate || isChecked)) || (isChecked && !switchProp) || undefined, "data-variant": mode || undefined, "data-open": open || undefined, disabled: disabled, onKeyDown: handleItemKeyDown, onFocus: handleItemFocus, style: { '--level': level }, children: [!switchProp && isSelectionSingle && marker && !isParentNode && interactive && (_jsx("div", { className: styles.markerContainer, "data-test-id": 'list__base-item-marker' })), !switchProp && isSelectionMultiple && interactive && (_jsx("div", { className: styles.checkbox, children: _jsx(Checkbox, { size: CHECKBOX_SIZE_MAP[size !== null && size !== void 0 ? size : 's'], disabled: disabled, tabIndex: -1, onChange: handleCheckboxChange, checked: isChecked, "data-test-id": 'list__base-item-checkbox', onClick: handleCheckboxClick, indeterminate: indeterminate }) })), beforeContent && _jsx("div", { className: styles.beforeContent, children: beforeContent }), _jsxs("div", { className: styles.content, children: [_jsxs("div", { className: styles.headline, children: [_jsx("span", { className: styles.option, children: _jsx(TruncateString, { text: option, maxLines: 1 }) }), caption && _jsx("span", { className: styles.caption, children: caption })] }), description && (_jsx("div", { className: styles.description, children: _jsx(TruncateString, { text: description, maxLines: 2 }) }))] }), afterContent, switchProp && interactive && (_jsx(Switch, { disabled: disabled, checked: isChecked, "data-test-id": 'list__base-item-switch' })), !switchProp && expandIcon && _jsx("span", { className: styles.expandableIcon, children: expandIcon })] }) }));
|
|
76
72
|
}
|
|
@@ -48,7 +48,6 @@ export type BaseItemProps = WithSupportProps<{
|
|
|
48
48
|
* Флаг отображения состояния выбранного элемента через switch
|
|
49
49
|
*/
|
|
50
50
|
switch?: boolean;
|
|
51
|
-
itemWrapRender?(item: ReactNode): ReactNode;
|
|
52
51
|
}>;
|
|
53
52
|
type BaseItemsWithoutNonGroupProps = Omit<BaseItemProps, 'switch' | 'inactive'>;
|
|
54
53
|
export type ItemProps = BaseItemProps | AccordionItemProps | NextListItemProps | GroupItemProps;
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"title": "List",
|
|
7
|
-
"version": "0.2.1
|
|
7
|
+
"version": "0.2.1",
|
|
8
8
|
"sideEffects": [
|
|
9
9
|
"*.css",
|
|
10
10
|
"*.woff",
|
|
@@ -34,16 +34,16 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@snack-uikit/divider": "3.0.1",
|
|
36
36
|
"@snack-uikit/dropdown": "0.2.0",
|
|
37
|
-
"@snack-uikit/icons": "0.20.
|
|
37
|
+
"@snack-uikit/icons": "0.20.1",
|
|
38
38
|
"@snack-uikit/loaders": "0.5.0",
|
|
39
39
|
"@snack-uikit/scroll": "0.5.0",
|
|
40
|
-
"@snack-uikit/search-private": "0.1.
|
|
41
|
-
"@snack-uikit/toggles": "0.9.
|
|
42
|
-
"@snack-uikit/truncate-string": "0.4.
|
|
40
|
+
"@snack-uikit/search-private": "0.1.3",
|
|
41
|
+
"@snack-uikit/toggles": "0.9.5",
|
|
42
|
+
"@snack-uikit/truncate-string": "0.4.7",
|
|
43
43
|
"@snack-uikit/utils": "3.2.0",
|
|
44
44
|
"classnames": "2.5.1",
|
|
45
45
|
"merge-refs": "1.2.2",
|
|
46
46
|
"uncontrollable": "8.0.4"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "b1acc8128bdab6f23b534d7c464208069e59ed8c"
|
|
49
49
|
}
|
|
@@ -32,7 +32,6 @@ export function BaseItem({
|
|
|
32
32
|
isParentNode,
|
|
33
33
|
className,
|
|
34
34
|
inactive,
|
|
35
|
-
itemWrapRender,
|
|
36
35
|
...rest
|
|
37
36
|
}: AllBaseItemProps) {
|
|
38
37
|
const { option, caption, description } = content || {};
|
|
@@ -97,7 +96,7 @@ export function BaseItem({
|
|
|
97
96
|
|
|
98
97
|
const props = extractSupportProps(rest);
|
|
99
98
|
|
|
100
|
-
|
|
99
|
+
return (
|
|
101
100
|
<li role={'menuitem'} data-test-id={props['data-test-id'] || 'list__base-item_' + id}>
|
|
102
101
|
<button
|
|
103
102
|
ref={itemRef}
|
|
@@ -159,10 +158,4 @@ export function BaseItem({
|
|
|
159
158
|
</button>
|
|
160
159
|
</li>
|
|
161
160
|
);
|
|
162
|
-
|
|
163
|
-
if (!itemWrapRender) {
|
|
164
|
-
return item;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
return itemWrapRender(item);
|
|
168
161
|
}
|
|
@@ -58,8 +58,6 @@ export type BaseItemProps = WithSupportProps<{
|
|
|
58
58
|
* Флаг отображения состояния выбранного элемента через switch
|
|
59
59
|
*/
|
|
60
60
|
switch?: boolean;
|
|
61
|
-
|
|
62
|
-
itemWrapRender?(item: ReactNode): ReactNode;
|
|
63
61
|
}>;
|
|
64
62
|
|
|
65
63
|
type BaseItemsWithoutNonGroupProps = Omit<BaseItemProps, 'switch' | 'inactive'>;
|