@snack-uikit/list 0.14.1 → 0.14.3-preview-8898cdde.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 +9 -0
- package/README.md +1 -1
- package/dist/components/Items/BaseItem/styles.module.css +3 -3
- package/dist/components/Items/styles.module.css +9 -3
- package/dist/components/Lists/List/List.d.ts +9 -9
- package/dist/components/Lists/ListPrivate/ListPrivate.d.ts +9 -10
- package/dist/components/Lists/contexts/CollapseProvider.d.ts +0 -1
- package/dist/components/Lists/contexts/OpenListProvider.d.ts +0 -1
- package/dist/helperComponents/ItemContent/ItemContent.d.ts +8 -6
- package/dist/helperComponents/ItemContent/ItemContent.js +10 -3
- package/dist/helperComponents/ItemContent/styles.module.css +10 -5
- package/dist/helperComponents/ListEmptyState/ListEmptyState.js +3 -3
- package/dist/helperComponents/Separator/styles.module.css +1 -1
- package/package.json +6 -6
- package/src/components/Items/styles.module.scss +10 -2
- package/src/helperComponents/ItemContent/ItemContent.tsx +25 -9
- package/src/helperComponents/ItemContent/styles.module.scss +5 -1
- package/src/helperComponents/ListEmptyState/ListEmptyState.tsx +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,15 @@
|
|
|
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.2 (2024-07-29)
|
|
7
|
+
|
|
8
|
+
### Only dependencies have been changed
|
|
9
|
+
* [@snack-uikit/toggles@0.10.2](https://github.com/cloud-ru-tech/snack-uikit/blob/master/packages/toggles/CHANGELOG.md)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
6
15
|
## 0.14.1 (2024-07-19)
|
|
7
16
|
|
|
8
17
|
### Only dependencies have been changed
|
package/README.md
CHANGED
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
| option* | `string \| number` | - | |
|
|
123
123
|
| caption | `string` | - | |
|
|
124
124
|
| description | `string` | - | |
|
|
125
|
-
| truncate | `
|
|
125
|
+
| truncate | `TruncateProps` | - | |
|
|
126
126
|
| disabled | `boolean` | - | |
|
|
127
127
|
| className | `string` | - | CSS-класс |
|
|
128
128
|
|
|
@@ -57,21 +57,21 @@
|
|
|
57
57
|
}
|
|
58
58
|
.droplistItem[data-size=s] .headline{
|
|
59
59
|
gap:var(--space-drop-list-item-s-container-headline-gap, 8px);
|
|
60
|
-
height:var(--size-drop-list-item-headline, 24px);
|
|
60
|
+
min-height:var(--size-drop-list-item-headline, 24px);
|
|
61
61
|
}
|
|
62
62
|
.droplistItem[data-size=m]{
|
|
63
63
|
padding-left:calc(var(--level, 0) * var(--dimension-050m, 4px) + var(--space-drop-list-item-m-container-horizontal-padding, 10px));
|
|
64
64
|
}
|
|
65
65
|
.droplistItem[data-size=m] .headline{
|
|
66
66
|
gap:var(--space-drop-list-item-m-container-headline-gap, 8px);
|
|
67
|
-
height:var(--size-drop-list-item-headline, 24px);
|
|
67
|
+
min-height:var(--size-drop-list-item-headline, 24px);
|
|
68
68
|
}
|
|
69
69
|
.droplistItem[data-size=l]{
|
|
70
70
|
padding-left:calc(var(--level, 0) * var(--dimension-050m, 4px) + var(--space-drop-list-item-l-container-horizontal-padding, 12px));
|
|
71
71
|
}
|
|
72
72
|
.droplistItem[data-size=l] .headline{
|
|
73
73
|
gap:var(--space-drop-list-item-l-container-headline-gap, 8px);
|
|
74
|
-
height:var(--size-drop-list-item-headline, 24px);
|
|
74
|
+
min-height:var(--size-drop-list-item-headline, 24px);
|
|
75
75
|
}
|
|
76
76
|
.droplistItem[data-non-pointer]{
|
|
77
77
|
cursor:inherit;
|
|
@@ -26,24 +26,30 @@
|
|
|
26
26
|
cursor:not-allowed;
|
|
27
27
|
background-color:transparent;
|
|
28
28
|
}
|
|
29
|
-
.itemWrapper:not([data-inactive], [data-disabled])[data-open]::before, .itemWrapper:not([data-inactive], [data-disabled])[data-focused]::before, .itemWrapper:not([data-inactive], [data-disabled]):
|
|
29
|
+
.itemWrapper:not([data-inactive], [data-disabled])[data-open]::before, .itemWrapper:not([data-inactive], [data-disabled])[data-focused]::before, .itemWrapper:not([data-inactive], [data-disabled]):focus-visible::before{
|
|
30
30
|
opacity:var(--opacity-a008, 0.08);
|
|
31
31
|
background-color:var(--sys-neutral-accent-default, #787b8a);
|
|
32
32
|
}
|
|
33
|
+
@media (hover: hover){
|
|
34
|
+
.itemWrapper:not([data-inactive], [data-disabled]):hover::before{
|
|
35
|
+
opacity:var(--opacity-a008, 0.08);
|
|
36
|
+
background-color:var(--sys-neutral-accent-default, #787b8a);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
33
39
|
|
|
34
40
|
.listItem{
|
|
35
41
|
cursor:pointer;
|
|
36
42
|
position:relative;
|
|
37
43
|
display:flex;
|
|
38
44
|
flex-direction:row;
|
|
39
|
-
align-items:
|
|
45
|
+
align-items:flex-start;
|
|
40
46
|
box-sizing:border-box;
|
|
41
47
|
width:-moz-max-content;
|
|
42
48
|
width:max-content;
|
|
43
49
|
min-width:100%;
|
|
44
50
|
margin:0;
|
|
45
51
|
padding:0;
|
|
46
|
-
color:var(--sys-neutral-text-main, #
|
|
52
|
+
color:var(--sys-neutral-text-main, #41424e);
|
|
47
53
|
text-align:start;
|
|
48
54
|
-webkit-appearance:unset;
|
|
49
55
|
-moz-appearance:unset;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { KeyboardEvent } from 'react';
|
|
2
2
|
export declare const List: import("react").ForwardRefExoticComponent<{
|
|
3
|
-
'data-test-id'?: string
|
|
3
|
+
'data-test-id'?: string;
|
|
4
4
|
} & import("react").AriaAttributes & {
|
|
5
5
|
items: import("../../Items").Item[];
|
|
6
|
-
pinTop?: import("../../Items").Item[]
|
|
7
|
-
pinBottom?: import("../../Items").Item[]
|
|
6
|
+
pinTop?: import("../../Items").Item[];
|
|
7
|
+
pinBottom?: import("../../Items").Item[];
|
|
8
8
|
footer?: import("react").ReactNode;
|
|
9
|
-
footerActiveElementsRefs?: import("react").RefObject<HTMLElement>[]
|
|
10
|
-
search?: import("../../..").SearchState
|
|
11
|
-
tabIndex?: number
|
|
12
|
-
collapse?: import("../contexts").CollapseState
|
|
13
|
-
className?: string
|
|
9
|
+
footerActiveElementsRefs?: import("react").RefObject<HTMLElement>[];
|
|
10
|
+
search?: import("../../..").SearchState;
|
|
11
|
+
tabIndex?: number;
|
|
12
|
+
collapse?: import("../contexts").CollapseState;
|
|
13
|
+
className?: string;
|
|
14
14
|
onKeyDown?(e: KeyboardEvent<HTMLElement>): void;
|
|
15
|
-
loading?: boolean
|
|
15
|
+
loading?: boolean;
|
|
16
16
|
} & import("../contexts").SelectionState & import("../contexts").PublicListContextType & import("../../../types").ScrollProps & import("../types").EmptyState & import("react").RefAttributes<HTMLElement>>;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
export declare const ListPrivate: import("react").ForwardRefExoticComponent<Omit<import("../types").ListProps, "items" | "pinTop" | "pinBottom"> & {
|
|
3
|
-
nested?: boolean
|
|
4
|
-
active?: boolean
|
|
5
|
-
tabIndex?: number
|
|
6
|
-
onFocus?(e: import("react").FocusEvent<HTMLElement
|
|
7
|
-
onBlur?(e: import("react").FocusEvent<HTMLElement
|
|
2
|
+
nested?: boolean;
|
|
3
|
+
active?: boolean;
|
|
4
|
+
tabIndex?: number;
|
|
5
|
+
onFocus?(e: import("react").FocusEvent<HTMLElement>): void;
|
|
6
|
+
onBlur?(e: import("react").FocusEvent<HTMLElement>): void;
|
|
8
7
|
onKeyDown?(e: import("react").KeyboardEvent<HTMLElement>): void;
|
|
9
|
-
limitedScrollHeight?: boolean
|
|
10
|
-
searchItem?: import("../../Items").FlattenBaseItem
|
|
11
|
-
pinTop?: import("../../Items").ItemId[]
|
|
8
|
+
limitedScrollHeight?: boolean;
|
|
9
|
+
searchItem?: import("../../Items").FlattenBaseItem;
|
|
10
|
+
pinTop?: import("../../Items").ItemId[];
|
|
12
11
|
items: import("../../Items").ItemId[];
|
|
13
|
-
pinBottom?: import("../../Items").ItemId[]
|
|
12
|
+
pinBottom?: import("../../Items").ItemId[];
|
|
14
13
|
} & import("react").RefAttributes<HTMLElement>>;
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { TruncateStringProps } from '@snack-uikit/truncate-string';
|
|
2
2
|
import { WithSupportProps } from '@snack-uikit/utils';
|
|
3
|
+
type TruncateProps = {
|
|
4
|
+
option?: number | null;
|
|
5
|
+
description?: number | null;
|
|
6
|
+
variant?: TruncateStringProps['variant'];
|
|
7
|
+
};
|
|
3
8
|
export type ItemContentProps = WithSupportProps<{
|
|
4
9
|
option: string | number;
|
|
5
10
|
caption?: string;
|
|
6
11
|
description?: string;
|
|
7
|
-
truncate?:
|
|
8
|
-
option?: number;
|
|
9
|
-
description?: number;
|
|
10
|
-
variant?: TruncateStringProps['variant'];
|
|
11
|
-
};
|
|
12
|
+
truncate?: TruncateProps;
|
|
12
13
|
disabled?: boolean;
|
|
13
14
|
className?: string;
|
|
14
15
|
}>;
|
|
15
|
-
export declare function ItemContent({ truncate, caption, description, option, className, disabled, ...rest }: ItemContentProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare function ItemContent({ truncate: truncateProp, caption, description, option, className, disabled, ...rest }: ItemContentProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -11,13 +11,20 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import cn from 'classnames';
|
|
14
|
+
import { useMemo } from 'react';
|
|
14
15
|
import { TruncateString } from '@snack-uikit/truncate-string';
|
|
15
16
|
import { extractSupportProps } from '@snack-uikit/utils';
|
|
16
17
|
import { useNewListContext } from '../../components/Lists/contexts';
|
|
17
18
|
import styles from './styles.module.css';
|
|
19
|
+
const DEFAULT_TRUNCATE = {
|
|
20
|
+
option: 1,
|
|
21
|
+
description: 2,
|
|
22
|
+
variant: 'end',
|
|
23
|
+
};
|
|
18
24
|
export function ItemContent(_a) {
|
|
19
|
-
var _b
|
|
20
|
-
var { truncate, caption, description, option, className, disabled } = _a, rest = __rest(_a, ["truncate", "caption", "description", "option", "className", "disabled"]);
|
|
25
|
+
var _b;
|
|
26
|
+
var { truncate: truncateProp, caption, description, option, className, disabled } = _a, rest = __rest(_a, ["truncate", "caption", "description", "option", "className", "disabled"]);
|
|
21
27
|
const { size = 's' } = useNewListContext();
|
|
22
|
-
|
|
28
|
+
const truncate = useMemo(() => (Object.assign(Object.assign({}, DEFAULT_TRUNCATE), truncateProp)), [truncateProp]);
|
|
29
|
+
return (_jsxs("div", Object.assign({ className: cn(styles.content, className) }, extractSupportProps(rest), { "data-size": size !== null && size !== void 0 ? size : 's', "data-disabled": disabled || undefined, children: [_jsxs("div", { className: styles.headline, children: [_jsx("div", { className: styles.label, children: _jsx(TruncateString, { variant: truncate === null || truncate === void 0 ? void 0 : truncate.variant, text: String(option), maxLines: truncate === null || truncate === void 0 ? void 0 : truncate.option, "data-test-id": 'list__base-item-option' }) }), caption && _jsx("span", { className: styles.caption, children: caption })] }), description && (_jsx("div", { className: styles.description, children: _jsx(TruncateString, { text: description, maxLines: (_b = truncate === null || truncate === void 0 ? void 0 : truncate.description) !== null && _b !== void 0 ? _b : 2, "data-test-id": 'list__base-item-description' }) }))] })));
|
|
23
30
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
.headline{
|
|
2
2
|
display:flex;
|
|
3
|
-
align-items:center;
|
|
4
3
|
}
|
|
5
4
|
|
|
6
5
|
.label{
|
|
7
6
|
overflow:hidden;
|
|
8
7
|
flex:1;
|
|
9
|
-
color:var(--sys-neutral-text-main, #
|
|
8
|
+
color:var(--sys-neutral-text-main, #41424e);
|
|
10
9
|
}
|
|
11
10
|
|
|
12
11
|
.caption{
|
|
@@ -28,7 +27,7 @@
|
|
|
28
27
|
}
|
|
29
28
|
.content[data-size=s] .headline{
|
|
30
29
|
gap:var(--space-drop-list-item-s-container-headline-gap, 8px);
|
|
31
|
-
height:var(--size-drop-list-item-headline, 24px);
|
|
30
|
+
min-height:var(--size-drop-list-item-headline, 24px);
|
|
32
31
|
}
|
|
33
32
|
.content[data-size=s] .label{
|
|
34
33
|
font-family:var(--sans-body-s-font-family, SB Sans Interface);
|
|
@@ -37,6 +36,8 @@
|
|
|
37
36
|
font-size:var(--sans-body-s-font-size, 12px);
|
|
38
37
|
letter-spacing:var(--sans-body-s-letter-spacing, 0.1px);
|
|
39
38
|
paragraph-spacing:var(--sans-body-s-paragraph-spacing, 6.6px);
|
|
39
|
+
display:flex;
|
|
40
|
+
align-items:center;
|
|
40
41
|
}
|
|
41
42
|
.content[data-size=s] .caption{
|
|
42
43
|
font-family:var(--sans-body-s-font-family, SB Sans Interface);
|
|
@@ -56,7 +57,7 @@
|
|
|
56
57
|
}
|
|
57
58
|
.content[data-size=m] .headline{
|
|
58
59
|
gap:var(--space-drop-list-item-m-container-headline-gap, 8px);
|
|
59
|
-
height:var(--size-drop-list-item-headline, 24px);
|
|
60
|
+
min-height:var(--size-drop-list-item-headline, 24px);
|
|
60
61
|
}
|
|
61
62
|
.content[data-size=m] .label{
|
|
62
63
|
font-family:var(--sans-body-m-font-family, SB Sans Interface);
|
|
@@ -65,6 +66,8 @@
|
|
|
65
66
|
font-size:var(--sans-body-m-font-size, 14px);
|
|
66
67
|
letter-spacing:var(--sans-body-m-letter-spacing, 0.1px);
|
|
67
68
|
paragraph-spacing:var(--sans-body-m-paragraph-spacing, 7.7px);
|
|
69
|
+
display:flex;
|
|
70
|
+
align-items:center;
|
|
68
71
|
}
|
|
69
72
|
.content[data-size=m] .caption{
|
|
70
73
|
font-family:var(--sans-body-s-font-family, SB Sans Interface);
|
|
@@ -84,7 +87,7 @@
|
|
|
84
87
|
}
|
|
85
88
|
.content[data-size=l] .headline{
|
|
86
89
|
gap:var(--space-drop-list-item-l-container-headline-gap, 8px);
|
|
87
|
-
height:var(--size-drop-list-item-headline, 24px);
|
|
90
|
+
min-height:var(--size-drop-list-item-headline, 24px);
|
|
88
91
|
}
|
|
89
92
|
.content[data-size=l] .label{
|
|
90
93
|
font-family:var(--sans-body-l-font-family, SB Sans Interface);
|
|
@@ -93,6 +96,8 @@
|
|
|
93
96
|
font-size:var(--sans-body-l-font-size, 16px);
|
|
94
97
|
letter-spacing:var(--sans-body-l-letter-spacing, 0.1px);
|
|
95
98
|
paragraph-spacing:var(--sans-body-l-paragraph-spacing, 8.8px);
|
|
99
|
+
display:flex;
|
|
100
|
+
align-items:center;
|
|
96
101
|
}
|
|
97
102
|
.content[data-size=l] .caption{
|
|
98
103
|
font-family:var(--sans-body-m-font-family, SB Sans Interface);
|
|
@@ -6,13 +6,13 @@ export function ListEmptyState({ dataError, dataFiltered, hasNoItems, emptyState
|
|
|
6
6
|
return null;
|
|
7
7
|
}
|
|
8
8
|
if (dataError) {
|
|
9
|
-
return (_jsx("div", { className: styles.listEmptyStateWrapper, children: _jsx(InfoBlock, Object.assign({}, emptyStates.errorDataState, { size: '
|
|
9
|
+
return (_jsx("div", { className: styles.listEmptyStateWrapper, children: _jsx(InfoBlock, Object.assign({}, emptyStates.errorDataState, { size: 'm', align: 'vertical' })) }));
|
|
10
10
|
}
|
|
11
11
|
if (dataFiltered && hasNoItems) {
|
|
12
|
-
return (_jsx("div", { className: styles.listEmptyStateWrapper, children: _jsx(InfoBlock, Object.assign({}, emptyStates.noResultsState, { size: '
|
|
12
|
+
return (_jsx("div", { className: styles.listEmptyStateWrapper, children: _jsx(InfoBlock, Object.assign({}, emptyStates.noResultsState, { size: 'm', align: 'vertical', "data-test-id": 'list__no-results' })) }));
|
|
13
13
|
}
|
|
14
14
|
if (!dataFiltered && hasNoItems) {
|
|
15
|
-
return (_jsx("div", { className: styles.listEmptyStateWrapper, children: _jsx(InfoBlock, Object.assign({}, emptyStates.noDataState, { size: '
|
|
15
|
+
return (_jsx("div", { className: styles.listEmptyStateWrapper, children: _jsx(InfoBlock, Object.assign({}, emptyStates.noDataState, { size: 'm', align: 'vertical', "data-test-id": 'list__no-data' })) }));
|
|
16
16
|
}
|
|
17
17
|
return null;
|
|
18
18
|
}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"title": "List",
|
|
7
|
-
"version": "0.14.
|
|
7
|
+
"version": "0.14.3-preview-8898cdde.0",
|
|
8
8
|
"sideEffects": [
|
|
9
9
|
"*.css",
|
|
10
10
|
"*.woff",
|
|
@@ -32,16 +32,16 @@
|
|
|
32
32
|
"license": "Apache-2.0",
|
|
33
33
|
"scripts": {},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@snack-uikit/button": "0.17.
|
|
35
|
+
"@snack-uikit/button": "0.17.3-preview-8898cdde.0",
|
|
36
36
|
"@snack-uikit/divider": "3.0.3",
|
|
37
37
|
"@snack-uikit/dropdown": "0.2.4",
|
|
38
38
|
"@snack-uikit/icons": "0.22.0",
|
|
39
|
-
"@snack-uikit/info-block": "0.4.
|
|
39
|
+
"@snack-uikit/info-block": "0.4.5-preview-8898cdde.0",
|
|
40
40
|
"@snack-uikit/loaders": "0.5.2",
|
|
41
41
|
"@snack-uikit/scroll": "0.6.0",
|
|
42
42
|
"@snack-uikit/search-private": "0.2.2",
|
|
43
|
-
"@snack-uikit/toggles": "0.10.
|
|
44
|
-
"@snack-uikit/truncate-string": "0.4.
|
|
43
|
+
"@snack-uikit/toggles": "0.10.2",
|
|
44
|
+
"@snack-uikit/truncate-string": "0.4.21-preview-8898cdde.0",
|
|
45
45
|
"@snack-uikit/utils": "3.3.0",
|
|
46
46
|
"classnames": "2.5.1",
|
|
47
47
|
"merge-refs": "1.2.2"
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"@snack-uikit/locale": "*"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "a0351f376ac28462b847d1bf99ad3f7ba7a1d0cd"
|
|
53
53
|
}
|
|
@@ -43,13 +43,21 @@ $sizes: 's', 'm', 'l';
|
|
|
43
43
|
&:not([data-inactive], [data-disabled]) {
|
|
44
44
|
&[data-open],
|
|
45
45
|
&[data-focused],
|
|
46
|
-
&:hover,
|
|
47
46
|
&:focus-visible {
|
|
48
47
|
&::before {
|
|
49
48
|
opacity: $opacity-a008;
|
|
50
49
|
background-color: $sys-neutral-accent-default;
|
|
51
50
|
}
|
|
52
51
|
}
|
|
52
|
+
|
|
53
|
+
@media (hover: hover) {
|
|
54
|
+
&:hover {
|
|
55
|
+
&::before {
|
|
56
|
+
opacity: $opacity-a008;
|
|
57
|
+
background-color: $sys-neutral-accent-default;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
53
61
|
}
|
|
54
62
|
}
|
|
55
63
|
|
|
@@ -60,7 +68,7 @@ $sizes: 's', 'm', 'l';
|
|
|
60
68
|
|
|
61
69
|
display: flex;
|
|
62
70
|
flex-direction: row;
|
|
63
|
-
align-items:
|
|
71
|
+
align-items: flex-start;
|
|
64
72
|
|
|
65
73
|
box-sizing: border-box;
|
|
66
74
|
width: max-content;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import cn from 'classnames';
|
|
2
|
+
import { useMemo } from 'react';
|
|
2
3
|
|
|
3
4
|
import { TruncateString, TruncateStringProps } from '@snack-uikit/truncate-string';
|
|
4
5
|
import { extractSupportProps, WithSupportProps } from '@snack-uikit/utils';
|
|
@@ -6,21 +7,29 @@ import { extractSupportProps, WithSupportProps } from '@snack-uikit/utils';
|
|
|
6
7
|
import { useNewListContext } from '../../components/Lists/contexts';
|
|
7
8
|
import styles from './styles.module.scss';
|
|
8
9
|
|
|
10
|
+
type TruncateProps = {
|
|
11
|
+
option?: number | null;
|
|
12
|
+
description?: number | null;
|
|
13
|
+
variant?: TruncateStringProps['variant'];
|
|
14
|
+
};
|
|
15
|
+
|
|
9
16
|
export type ItemContentProps = WithSupportProps<{
|
|
10
17
|
option: string | number;
|
|
11
18
|
caption?: string;
|
|
12
19
|
description?: string;
|
|
13
|
-
truncate?:
|
|
14
|
-
option?: number;
|
|
15
|
-
description?: number;
|
|
16
|
-
variant?: TruncateStringProps['variant'];
|
|
17
|
-
};
|
|
20
|
+
truncate?: TruncateProps;
|
|
18
21
|
disabled?: boolean;
|
|
19
22
|
className?: string;
|
|
20
23
|
}>;
|
|
21
24
|
|
|
25
|
+
const DEFAULT_TRUNCATE: TruncateProps = {
|
|
26
|
+
option: 1,
|
|
27
|
+
description: 2,
|
|
28
|
+
variant: 'end',
|
|
29
|
+
};
|
|
30
|
+
|
|
22
31
|
export function ItemContent({
|
|
23
|
-
truncate,
|
|
32
|
+
truncate: truncateProp,
|
|
24
33
|
caption,
|
|
25
34
|
description,
|
|
26
35
|
option,
|
|
@@ -29,6 +38,13 @@ export function ItemContent({
|
|
|
29
38
|
...rest
|
|
30
39
|
}: ItemContentProps) {
|
|
31
40
|
const { size = 's' } = useNewListContext();
|
|
41
|
+
const truncate = useMemo(
|
|
42
|
+
() => ({
|
|
43
|
+
...DEFAULT_TRUNCATE,
|
|
44
|
+
...truncateProp,
|
|
45
|
+
}),
|
|
46
|
+
[truncateProp],
|
|
47
|
+
);
|
|
32
48
|
|
|
33
49
|
return (
|
|
34
50
|
<div
|
|
@@ -38,14 +54,14 @@ export function ItemContent({
|
|
|
38
54
|
data-disabled={disabled || undefined}
|
|
39
55
|
>
|
|
40
56
|
<div className={styles.headline}>
|
|
41
|
-
<
|
|
57
|
+
<div className={styles.label}>
|
|
42
58
|
<TruncateString
|
|
43
59
|
variant={truncate?.variant}
|
|
44
60
|
text={String(option)}
|
|
45
|
-
maxLines={truncate?.option
|
|
61
|
+
maxLines={truncate?.option}
|
|
46
62
|
data-test-id='list__base-item-option'
|
|
47
63
|
/>
|
|
48
|
-
</
|
|
64
|
+
</div>
|
|
49
65
|
{caption && <span className={styles.caption}>{caption}</span>}
|
|
50
66
|
</div>
|
|
51
67
|
|
|
@@ -25,7 +25,7 @@ $typography: (
|
|
|
25
25
|
|
|
26
26
|
.headline {
|
|
27
27
|
display: flex;
|
|
28
|
-
align-items:
|
|
28
|
+
// align-items: flex-start;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
.label {
|
|
@@ -58,6 +58,10 @@ $typography: (
|
|
|
58
58
|
}
|
|
59
59
|
.label {
|
|
60
60
|
@include composite-var($typography, $size, 'label');
|
|
61
|
+
|
|
62
|
+
display: flex;
|
|
63
|
+
align-items: center;
|
|
64
|
+
// height: 100%;
|
|
61
65
|
}
|
|
62
66
|
.caption {
|
|
63
67
|
@include composite-var($typography, $size, 'caption');
|
|
@@ -24,7 +24,7 @@ export function ListEmptyState({ dataError, dataFiltered, hasNoItems, emptyState
|
|
|
24
24
|
if (dataError) {
|
|
25
25
|
return (
|
|
26
26
|
<div className={styles.listEmptyStateWrapper}>
|
|
27
|
-
<InfoBlock {...emptyStates.errorDataState} size='
|
|
27
|
+
<InfoBlock {...emptyStates.errorDataState} size='m' align='vertical' />
|
|
28
28
|
</div>
|
|
29
29
|
);
|
|
30
30
|
}
|
|
@@ -32,7 +32,7 @@ export function ListEmptyState({ dataError, dataFiltered, hasNoItems, emptyState
|
|
|
32
32
|
if (dataFiltered && hasNoItems) {
|
|
33
33
|
return (
|
|
34
34
|
<div className={styles.listEmptyStateWrapper}>
|
|
35
|
-
<InfoBlock {...emptyStates.noResultsState} size='
|
|
35
|
+
<InfoBlock {...emptyStates.noResultsState} size='m' align='vertical' data-test-id='list__no-results' />
|
|
36
36
|
</div>
|
|
37
37
|
);
|
|
38
38
|
}
|
|
@@ -40,7 +40,7 @@ export function ListEmptyState({ dataError, dataFiltered, hasNoItems, emptyState
|
|
|
40
40
|
if (!dataFiltered && hasNoItems) {
|
|
41
41
|
return (
|
|
42
42
|
<div className={styles.listEmptyStateWrapper}>
|
|
43
|
-
<InfoBlock {...emptyStates.noDataState} size='
|
|
43
|
+
<InfoBlock {...emptyStates.noDataState} size='m' align='vertical' data-test-id='list__no-data' />
|
|
44
44
|
</div>
|
|
45
45
|
);
|
|
46
46
|
}
|