@cloud-ru/ds-list 3.1.5 → 3.1.6-preview-3a8acaec.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/README.md +31 -9
- package/dist/cjs/components/Lists/Droplist/DropList.d.ts +1 -1
- package/dist/cjs/components/Lists/Droplist/DropList.js +6 -4
- package/dist/cjs/components/Lists/types.d.ts +10 -4
- package/dist/esm/components/Lists/Droplist/DropList.d.ts +1 -1
- package/dist/esm/components/Lists/Droplist/DropList.js +7 -5
- package/dist/esm/components/Lists/types.d.ts +10 -4
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +18 -18
- package/src/components/Lists/Droplist/DropList.tsx +15 -6
- package/src/components/Lists/types.ts +12 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloud-ru/ds-list",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.6-preview-3a8acaec.0",
|
|
4
4
|
"description": "Списочный UI — компонент List для плоских/вложенных списков с выбором, группами и поиском и Droplist — тот же список в поповере.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -48,24 +48,24 @@
|
|
|
48
48
|
"@tanstack/react-virtual": "^3.14.8",
|
|
49
49
|
"classnames": "^2.5.1",
|
|
50
50
|
"merge-refs": "^2.0.0",
|
|
51
|
-
"@cloud-ru/ds-
|
|
52
|
-
"@cloud-ru/ds-
|
|
53
|
-
"@cloud-ru/ds-
|
|
54
|
-
"@cloud-ru/ds-drag-and-drop": "
|
|
55
|
-
"@cloud-ru/ds-divider": "
|
|
56
|
-
"@cloud-ru/ds-
|
|
57
|
-
"@cloud-ru/ds-
|
|
58
|
-
"@cloud-ru/ds-info-block": "
|
|
59
|
-
"@cloud-ru/ds-
|
|
60
|
-
"@cloud-ru/ds-
|
|
61
|
-
"@cloud-ru/ds-portal-context": "
|
|
62
|
-
"@cloud-ru/ds-scroll": "
|
|
63
|
-
"@cloud-ru/ds-search-private": "
|
|
64
|
-
"@cloud-ru/ds-
|
|
65
|
-
"@cloud-ru/ds-
|
|
66
|
-
"@cloud-ru/ds-
|
|
51
|
+
"@cloud-ru/ds-bottom-sheet": "2.3.2-preview-3a8acaec.0",
|
|
52
|
+
"@cloud-ru/ds-adaptive": "1.0.6",
|
|
53
|
+
"@cloud-ru/ds-button": "1.0.9-preview-3a8acaec.0",
|
|
54
|
+
"@cloud-ru/ds-drag-and-drop": "1.1.7",
|
|
55
|
+
"@cloud-ru/ds-divider": "1.0.6",
|
|
56
|
+
"@cloud-ru/ds-icons": "1.8.0",
|
|
57
|
+
"@cloud-ru/ds-dropdown": "1.2.6-preview-3a8acaec.0",
|
|
58
|
+
"@cloud-ru/ds-info-block": "1.0.7",
|
|
59
|
+
"@cloud-ru/ds-materials": "2.0.5",
|
|
60
|
+
"@cloud-ru/ds-loader": "1.0.7",
|
|
61
|
+
"@cloud-ru/ds-portal-context": "1.0.6",
|
|
62
|
+
"@cloud-ru/ds-scroll": "1.0.9",
|
|
63
|
+
"@cloud-ru/ds-search-private": "1.0.24-preview-3a8acaec.0",
|
|
64
|
+
"@cloud-ru/ds-toggles": "1.1.19",
|
|
65
|
+
"@cloud-ru/ds-utils": "1.4.2",
|
|
66
|
+
"@cloud-ru/ds-truncate-string": "1.0.23"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"@cloud-ru/ds-locale": "
|
|
69
|
+
"@cloud-ru/ds-locale": "1.0.0"
|
|
70
70
|
}
|
|
71
71
|
}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import { isMobileLayout, useAdaptiveLayout } from '@cloud-ru/ds-adaptive';
|
|
1
|
+
import { isMobileLayout, LayoutPresets, mergePresets, useAdaptiveLayout, useLayoutDefaults } from '@cloud-ru/ds-adaptive';
|
|
2
2
|
|
|
3
3
|
import { DesktopDroplist } from '../../../helperComponents/DesktopDroplist';
|
|
4
4
|
import { MobileDroplist } from '../../../helperComponents/MobileDroplist';
|
|
5
|
-
import { DroplistImplProps, DroplistProps, ReorderableDroplistProps } from '../types';
|
|
5
|
+
import { DroplistImplProps, DroplistLayoutDefaults, DroplistProps, ReorderableDroplistProps } from '../types';
|
|
6
|
+
|
|
7
|
+
const DROPLIST_LAYOUT_PRESETS: LayoutPresets<DroplistLayoutDefaults> = { mobile: { size: 'l' } };
|
|
6
8
|
|
|
7
9
|
/** @internal Общая реализация `Droplist`/`ReorderableDroplist`: свап поверхности по раскладке. */
|
|
8
10
|
function DroplistImpl({
|
|
9
11
|
children,
|
|
10
|
-
size
|
|
12
|
+
size,
|
|
13
|
+
layoutPresets,
|
|
11
14
|
label,
|
|
12
15
|
actionButton,
|
|
13
16
|
slotAfterTitle,
|
|
@@ -16,11 +19,17 @@ function DroplistImpl({
|
|
|
16
19
|
}: DroplistImplProps) {
|
|
17
20
|
const { layoutType } = useAdaptiveLayout();
|
|
18
21
|
|
|
22
|
+
const { size: resolvedSize } = useLayoutDefaults<DroplistLayoutDefaults>(
|
|
23
|
+
{ size: 'm' },
|
|
24
|
+
mergePresets(DROPLIST_LAYOUT_PRESETS, layoutPresets),
|
|
25
|
+
{ size },
|
|
26
|
+
);
|
|
27
|
+
|
|
19
28
|
if (isMobileLayout(layoutType)) {
|
|
20
29
|
return (
|
|
21
30
|
<MobileDroplist
|
|
22
31
|
{...rest}
|
|
23
|
-
size=
|
|
32
|
+
size={resolvedSize}
|
|
24
33
|
label={label}
|
|
25
34
|
actionButton={actionButton}
|
|
26
35
|
slotAfterTitle={slotAfterTitle}
|
|
@@ -32,7 +41,7 @@ function DroplistImpl({
|
|
|
32
41
|
}
|
|
33
42
|
|
|
34
43
|
return (
|
|
35
|
-
<DesktopDroplist {...rest} size={
|
|
44
|
+
<DesktopDroplist {...rest} size={resolvedSize}>
|
|
36
45
|
{children}
|
|
37
46
|
</DesktopDroplist>
|
|
38
47
|
);
|
|
@@ -40,7 +49,7 @@ function DroplistImpl({
|
|
|
40
49
|
|
|
41
50
|
/**
|
|
42
51
|
* Адаптивный `Droplist`: раскладку берёт из `AdaptiveProvider` (контекст). На `mobile` рендерит
|
|
43
|
-
* список (
|
|
52
|
+
* список (по умолчанию размера `l`) в `BottomSheet` (`MobileDroplist`), иначе — анкорный popover (`DesktopDroplist`).
|
|
44
53
|
* Слоты `label` / `actionButton` / `slotAfterTitle` / `onBackButtonClick` применяются только на mobile.
|
|
45
54
|
* Чтобы всегда был popover — `withLayoutType(Droplist, 'desktop')` либо вложенный
|
|
46
55
|
* `<AdaptiveProvider layoutType='desktop'>`. Пропа `layoutType` у компонента нет.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DragEndEvent } from '@dnd-kit/core';
|
|
2
|
+
import { LayoutPresets } from '@cloud-ru/ds-adaptive';
|
|
2
3
|
import { BottomSheetProps } from '@cloud-ru/ds-bottom-sheet';
|
|
3
4
|
import { DropdownProps } from '@cloud-ru/ds-dropdown';
|
|
4
5
|
import { WithSupportProps } from '@cloud-ru/ds-utils';
|
|
@@ -172,6 +173,13 @@ export type ReorderableBaseDroplistProps = DroplistOwnProps & DroplistListProps<
|
|
|
172
173
|
*/
|
|
173
174
|
export type DesktopDroplistProps = DroplistOwnProps & DroplistListProps<ListImplProps>;
|
|
174
175
|
|
|
176
|
+
export type DroplistLayoutDefaults = Pick<ListProps, 'size'>;
|
|
177
|
+
|
|
178
|
+
type DroplistAdaptiveProps = {
|
|
179
|
+
/** Переопределение размера списка по раскладке. На mobile по умолчанию `l`. */
|
|
180
|
+
layoutPresets?: LayoutPresets<DroplistLayoutDefaults>;
|
|
181
|
+
};
|
|
182
|
+
|
|
175
183
|
/** Только mobile (`BottomSheet`)-слоты адаптивного `Droplist`. */
|
|
176
184
|
type DroplistMobileSlots = {
|
|
177
185
|
/** Только mobile (`BottomSheet`): заголовок шапки. */
|
|
@@ -187,10 +195,11 @@ type DroplistMobileSlots = {
|
|
|
187
195
|
/**
|
|
188
196
|
* Props адаптивного `Droplist` (дефолтный droplist): базовые props + mobile-слоты `BottomSheet`.
|
|
189
197
|
* Раскладку берёт из `AdaptiveProvider` (контекст): на `mobile` рендерит `MobileDroplist`
|
|
190
|
-
* (список
|
|
198
|
+
* (список размера `l` по умолчанию в `BottomSheet`), иначе — `DesktopDroplist` (анкорный popover). Mobile-слоты
|
|
191
199
|
* применяются только на mobile.
|
|
192
200
|
*/
|
|
193
201
|
export type DroplistProps = BaseDroplistProps &
|
|
202
|
+
DroplistAdaptiveProps &
|
|
194
203
|
DroplistMobileSlots &
|
|
195
204
|
Pick<BottomSheetProps, 'snapPoints' | 'withDividers'>;
|
|
196
205
|
|
|
@@ -198,10 +207,10 @@ export type DroplistProps = BaseDroplistProps &
|
|
|
198
207
|
* Props адаптивного `ReorderableDroplist`: props `ReorderableList` + popover/mobile-обвязка
|
|
199
208
|
* `Droplist`. Отдельный компонент по той же причине, что и `ReorderableList`.
|
|
200
209
|
*/
|
|
201
|
-
export type ReorderableDroplistProps = ReorderableBaseDroplistProps & DroplistMobileSlots;
|
|
210
|
+
export type ReorderableDroplistProps = ReorderableBaseDroplistProps & DroplistMobileSlots & DroplistAdaptiveProps;
|
|
202
211
|
|
|
203
212
|
/** @internal Props общей реализации адаптивного дроплиста: реализация + mobile-слоты. */
|
|
204
|
-
export type DroplistImplProps = DesktopDroplistProps & DroplistMobileSlots;
|
|
213
|
+
export type DroplistImplProps = DesktopDroplistProps & DroplistMobileSlots & DroplistAdaptiveProps;
|
|
205
214
|
|
|
206
215
|
/**
|
|
207
216
|
* @internal Props mobile-реализации (`BottomSheet`): реализация дроплиста без popover-пропов
|