@snack-uikit/list 0.9.2-preview-c8f85f20.0 → 0.10.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/components/Items/NextListItem/NextListItem.d.ts +1 -1
- package/dist/components/Items/NextListItem/NextListItem.js +2 -2
- package/dist/components/Items/types.d.ts +1 -0
- package/dist/components/Lists/ListPrivate/styles.module.css +3 -0
- package/package.json +2 -2
- package/src/components/Items/NextListItem/NextListItem.tsx +2 -0
- package/src/components/Items/types.ts +1 -0
- package/src/components/Lists/ListPrivate/styles.module.scss +4 -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.10.0 (2024-04-08)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **FF-4649:** improve api ([4932e19](https://github.com/cloud-ru-tech/snack-uikit/commit/4932e192c9c2a1f324b7baeb9d7759e4fcc64c90))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## 0.9.1 (2024-03-26)
|
|
7
18
|
|
|
8
19
|
### Only dependencies have been changed
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { NextListItemProps } from '../types';
|
|
2
|
-
export declare function NextListItem({ items: itemsProp, placement, id, search, scroll, scrollRef, disabled, onSublistOpenChanged, ...option }: NextListItemProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function NextListItem({ items: itemsProp, placement, id, search, scroll, scrollRef, disabled, onSublistOpenChanged, loading, ...option }: NextListItemProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -28,7 +28,7 @@ const FALLBACK_PLACEMENTS = [
|
|
|
28
28
|
'left-end',
|
|
29
29
|
];
|
|
30
30
|
export function NextListItem(_a) {
|
|
31
|
-
var { items: itemsProp, placement = 'right-start', id, search, scroll, scrollRef, disabled, onSublistOpenChanged } = _a, option = __rest(_a, ["items", "placement", "id", "search", "scroll", "scrollRef", "disabled", "onSublistOpenChanged"]);
|
|
31
|
+
var { items: itemsProp, placement = 'right-start', id, search, scroll, scrollRef, disabled, onSublistOpenChanged, loading = false } = _a, option = __rest(_a, ["items", "placement", "id", "search", "scroll", "scrollRef", "disabled", "onSublistOpenChanged", "loading"]);
|
|
32
32
|
const listRef = useRef(null);
|
|
33
33
|
const [openCollapsedItems, setOpenCollapsedItems] = useState([]);
|
|
34
34
|
const { items, itemRefs, ids, expandedIds } = useMemo(() => withCollapsedItems({
|
|
@@ -63,5 +63,5 @@ export function NextListItem(_a) {
|
|
|
63
63
|
parentResetNestedIndex: resetNestedIndex,
|
|
64
64
|
parentResetActiveFocusIndex: resetActiveFocusIndex,
|
|
65
65
|
toggleOpenCollapsedItems: id => setOpenCollapsedItems(items => items.includes(id) ? items.filter(item => item !== id) : items.concat([id])),
|
|
66
|
-
}, children: _jsx(ListPrivate, { onKeyDown: handleListKeyDown, items: items, nested: true, search: search, scroll: scroll, scrollRef: scrollRef, limitedScrollHeight: true }) }), trigger: 'hover', open: (open || parentIds[parentOpenNestedIndex] === id) && !disabled, onOpenChange: handleOpenChange, placement: placement, widthStrategy: 'auto', children: _jsx(BaseItem, Object.assign({}, option, { disabled: disabled, open: open, expandIcon: _jsx(ChevronRightSVG, {}), id: id, isParentNode: true, indeterminate: isIndeterminate && !checked, onSelect: handleOnSelect })) }));
|
|
66
|
+
}, children: _jsx(ListPrivate, { onKeyDown: handleListKeyDown, items: items, nested: true, search: search, scroll: scroll, scrollRef: scrollRef, limitedScrollHeight: true, loading: loading }) }), trigger: 'hover', open: (open || parentIds[parentOpenNestedIndex] === id) && !disabled, onOpenChange: handleOpenChange, placement: placement, widthStrategy: 'auto', children: _jsx(BaseItem, Object.assign({}, option, { disabled: disabled, open: open, expandIcon: _jsx(ChevronRightSVG, {}), id: id, isParentNode: true, indeterminate: isIndeterminate && !checked, onSelect: handleOnSelect })) }));
|
|
67
67
|
}
|
|
@@ -71,6 +71,7 @@ export type NextListItemProps = BaseItemsWithoutNonGroupProps & {
|
|
|
71
71
|
placement?: 'right-start' | 'left-start' | 'left' | 'right' | 'left-end' | 'right-end';
|
|
72
72
|
search?: SearchState;
|
|
73
73
|
onSublistOpenChanged?(open: boolean, id?: string | number): void;
|
|
74
|
+
loading?: boolean;
|
|
74
75
|
} & ScrollProps;
|
|
75
76
|
export type GroupItemProps = Omit<SeparatorProps, 'size'> & {
|
|
76
77
|
items: ItemProps[];
|
|
@@ -7,18 +7,21 @@
|
|
|
7
7
|
height:var(--dimension-3m, 24px);
|
|
8
8
|
}
|
|
9
9
|
.loader[data-size=s][data-no-items]{
|
|
10
|
+
min-width:calc(2 * 3 * var(--dimension-3m, 24px));
|
|
10
11
|
height:calc(3 * var(--dimension-3m, 24px));
|
|
11
12
|
}
|
|
12
13
|
.loader[data-size=m]{
|
|
13
14
|
height:var(--dimension-4m, 32px);
|
|
14
15
|
}
|
|
15
16
|
.loader[data-size=m][data-no-items]{
|
|
17
|
+
min-width:calc(2 * 3 * var(--dimension-4m, 32px));
|
|
16
18
|
height:calc(3 * var(--dimension-4m, 32px));
|
|
17
19
|
}
|
|
18
20
|
.loader[data-size=l]{
|
|
19
21
|
height:var(--dimension-5m, 40px);
|
|
20
22
|
}
|
|
21
23
|
.loader[data-size=l][data-no-items]{
|
|
24
|
+
min-width:calc(2 * 3 * var(--dimension-5m, 40px));
|
|
22
25
|
height:calc(3 * var(--dimension-5m, 40px));
|
|
23
26
|
}
|
|
24
27
|
.loader:focus-visible{
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"title": "List",
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.10.0",
|
|
8
8
|
"sideEffects": [
|
|
9
9
|
"*.css",
|
|
10
10
|
"*.woff",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@snack-uikit/locale": "*"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "381565b14f3e08082b29add05be8f982fa8f4c2f"
|
|
58
58
|
}
|
|
@@ -29,6 +29,7 @@ export function NextListItem({
|
|
|
29
29
|
scrollRef,
|
|
30
30
|
disabled,
|
|
31
31
|
onSublistOpenChanged,
|
|
32
|
+
loading = false,
|
|
32
33
|
...option
|
|
33
34
|
}: NextListItemProps) {
|
|
34
35
|
const listRef = useRef<HTMLUListElement>(null);
|
|
@@ -109,6 +110,7 @@ export function NextListItem({
|
|
|
109
110
|
scroll={scroll}
|
|
110
111
|
scrollRef={scrollRef}
|
|
111
112
|
limitedScrollHeight
|
|
113
|
+
loading={loading}
|
|
112
114
|
/>
|
|
113
115
|
</ParentListContext.Provider>
|
|
114
116
|
}
|
|
@@ -88,6 +88,7 @@ export type NextListItemProps = BaseItemsWithoutNonGroupProps & {
|
|
|
88
88
|
placement?: 'right-start' | 'left-start' | 'left' | 'right' | 'left-end' | 'right-end';
|
|
89
89
|
search?: SearchState;
|
|
90
90
|
onSublistOpenChanged?(open: boolean, id?: string | number): void;
|
|
91
|
+
loading?: boolean;
|
|
91
92
|
} & ScrollProps;
|
|
92
93
|
|
|
93
94
|
export type GroupItemProps = Omit<SeparatorProps, 'size'> & {
|
|
@@ -18,7 +18,10 @@ $loader-height: (
|
|
|
18
18
|
height: simple-var($loader-height, $size);
|
|
19
19
|
|
|
20
20
|
&[data-no-items] {
|
|
21
|
-
height: calc(3 * simple-var($loader-height, $size));
|
|
21
|
+
$no-items-loading-height: calc(3 * simple-var($loader-height, $size));
|
|
22
|
+
|
|
23
|
+
min-width: calc(2 * $no-items-loading-height);
|
|
24
|
+
height: $no-items-loading-height;
|
|
22
25
|
}
|
|
23
26
|
}
|
|
24
27
|
}
|