@cloud-ru/ds-drawer 1.0.6-preview-fd6730e3.0 → 1.0.6
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 +4 -0
- package/dist/cjs/components/DrawerCustom/DrawerCustom.js +1 -1
- package/dist/cjs/components/DrawerCustom/constants.js +2 -6
- package/dist/cjs/components/DrawerCustom/hooks/useDrawerResize.js +1 -5
- package/dist/cjs/components/DrawerCustom/styles.module.css +117 -123
- package/dist/cjs/style.css +117 -123
- package/dist/esm/components/DrawerCustom/DrawerCustom.js +1 -1
- package/dist/esm/components/DrawerCustom/constants.js +2 -3
- package/dist/esm/components/DrawerCustom/hooks/useDrawerResize.js +1 -2
- package/dist/esm/components/DrawerCustom/styles.module.css +117 -123
- package/dist/esm/style.css +117 -123
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +9 -9
- package/src/components/DrawerCustom/DrawerCustom.tsx +1 -1
- package/src/components/DrawerCustom/constants.ts +2 -4
- package/src/components/DrawerCustom/hooks/useDrawerResize.tsx +1 -2
- package/src/components/DrawerCustom/styles.module.scss +42 -60
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloud-ru/ds-drawer",
|
|
3
|
-
"version": "1.0.6
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Пакет выезжающих панелей — компоненты Drawer и DrawerCustom с едиными токенами позиции и ширины.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -40,13 +40,13 @@
|
|
|
40
40
|
"classnames": "^2.5.1",
|
|
41
41
|
"react-remove-scroll": "^2.7.2",
|
|
42
42
|
"tabbable": "^6.5.0",
|
|
43
|
-
"@cloud-ru/ds-adaptive": "1.0.1",
|
|
44
|
-
"@cloud-ru/ds-
|
|
45
|
-
"@cloud-ru/ds-
|
|
46
|
-
"@cloud-ru/ds-
|
|
47
|
-
"@cloud-ru/ds-
|
|
48
|
-
"@cloud-ru/ds-
|
|
49
|
-
"@cloud-ru/ds-
|
|
50
|
-
"@cloud-ru/ds-
|
|
43
|
+
"@cloud-ru/ds-adaptive": "^1.0.1",
|
|
44
|
+
"@cloud-ru/ds-popup-private": "^1.0.4",
|
|
45
|
+
"@cloud-ru/ds-portal-context": "^1.0.1",
|
|
46
|
+
"@cloud-ru/ds-tooltip": "^1.0.4",
|
|
47
|
+
"@cloud-ru/ds-scroll": "^1.0.2",
|
|
48
|
+
"@cloud-ru/ds-materials": "^1.0.1",
|
|
49
|
+
"@cloud-ru/ds-utils": "^1.1.0",
|
|
50
|
+
"@cloud-ru/ds-bottom-sheet": "^1.0.5"
|
|
51
51
|
}
|
|
52
52
|
}
|
|
@@ -118,7 +118,7 @@ function DrawerFrame(props: DrawerCustomProps) {
|
|
|
118
118
|
data-height-auto={heightAutoVertical ? true : undefined}
|
|
119
119
|
data-acrylic-appearance='neutral'
|
|
120
120
|
data-acrylic-level='1Level'
|
|
121
|
-
prefixCls=
|
|
121
|
+
prefixCls='snack-rc-drawer'
|
|
122
122
|
{...(disableMotions ? {} : motionProps)}
|
|
123
123
|
>
|
|
124
124
|
{/*
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { DrawerProps } from '@rc-component/drawer';
|
|
2
2
|
|
|
3
|
-
import styles from './styles.module.scss';
|
|
4
|
-
|
|
5
3
|
export const maskMotion: DrawerProps['maskMotion'] = {
|
|
6
4
|
motionAppear: true,
|
|
7
|
-
motionName:
|
|
5
|
+
motionName: 'maskMotion',
|
|
8
6
|
};
|
|
9
7
|
|
|
10
8
|
export const motion: DrawerProps['motion'] = placement => ({
|
|
11
9
|
motionAppear: true,
|
|
12
10
|
motionDeadline: 300,
|
|
13
|
-
motionName:
|
|
11
|
+
motionName: `panelMotion-${placement}`,
|
|
14
12
|
});
|
|
15
13
|
|
|
16
14
|
export const motionProps: Partial<DrawerProps> = {
|
|
@@ -3,10 +3,9 @@ import { isBrowser } from '@cloud-ru/ds-utils';
|
|
|
3
3
|
import { DrawerProps } from '@rc-component/drawer';
|
|
4
4
|
import { useCallback, useMemo, useRef, useState } from 'react';
|
|
5
5
|
|
|
6
|
-
import styles from '../styles.module.scss';
|
|
7
6
|
import { DrawerCustomProps } from '../types';
|
|
8
7
|
|
|
9
|
-
const DRAGGER_SELECTOR =
|
|
8
|
+
const DRAGGER_SELECTOR = '.snack-rc-drawer-resizable-dragger';
|
|
10
9
|
|
|
11
10
|
type UseDrawerResizeParams = Pick<DrawerCustomProps, 'position' | 'resizable'>;
|
|
12
11
|
|
|
@@ -10,20 +10,6 @@ $draggerWidth: base.$sn-primitive-dimension-4;
|
|
|
10
10
|
$draggerPosition: calc(drawer.$sn-drawer-anatomy-container-vertical-positionLeft-paddingRight - $draggerWidth - base.$sn-primitive-dimension-6);
|
|
11
11
|
$activeDraggerHeight: calc(base.$sn-primitive-dimension-32 + base.$sn-primitive-dimension-24);
|
|
12
12
|
|
|
13
|
-
// Классы rc-drawer/rc-motion глобальные (css-модуль их не хеширует), поэтому свои — с namespace и
|
|
14
|
-
// версией: у легаси-шелла консоли те же `.maskMotion-*` / `.panelMotion-*`, и его правила дёргают
|
|
15
|
-
// панель вбок. В JS имена уходят через `:export`. Версию бампать при сломе разметки или кадров.
|
|
16
|
-
$classVersion: 'v1';
|
|
17
|
-
$prefixCls: 'cloud-ru-ds-drawer-#{$classVersion}';
|
|
18
|
-
$maskMotionName: '#{$prefixCls}-mask-motion';
|
|
19
|
-
$panelMotionName: '#{$prefixCls}-panel-motion';
|
|
20
|
-
|
|
21
|
-
:export {
|
|
22
|
-
maskMotionName: #{$maskMotionName};
|
|
23
|
-
panelMotionName: #{$panelMotionName};
|
|
24
|
-
prefixCls: #{$prefixCls};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
13
|
// placement → offscreen transform для panelMotion-*
|
|
28
14
|
$panelMotions: (
|
|
29
15
|
'left': translateX(-100%),
|
|
@@ -32,18 +18,14 @@ $panelMotions: (
|
|
|
32
18
|
'bottom': translateY(100%),
|
|
33
19
|
);
|
|
34
20
|
|
|
35
|
-
.drawerRoot:global(
|
|
21
|
+
.drawerRoot:global(.snack-rc-drawer) {
|
|
36
22
|
pointer-events: none;
|
|
37
23
|
|
|
38
24
|
position: fixed;
|
|
39
25
|
z-index: initial;
|
|
40
26
|
inset: 0;
|
|
41
27
|
|
|
42
|
-
|
|
43
|
-
// пересчитывать её в главном потоке каждый кадр — на тяжёлом кадре движение дёргается.
|
|
44
|
-
// Корень — `position: fixed`, а фиксированные элементы не участвуют в прокрутке документа,
|
|
45
|
-
// поэтому выехавшая за экран панель полос прокрутки не создаёт.
|
|
46
|
-
overflow: visible;
|
|
28
|
+
overflow: hidden;
|
|
47
29
|
|
|
48
30
|
transition: width 0s ease 0.3s, height 0s ease 0.3s, transform 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86);
|
|
49
31
|
|
|
@@ -51,12 +33,12 @@ $panelMotions: (
|
|
|
51
33
|
transition: transform 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86), opacity 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86), box-shadow 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86);
|
|
52
34
|
}
|
|
53
35
|
|
|
54
|
-
&:global(
|
|
36
|
+
&:global(.snack-rc-drawer-open) {
|
|
55
37
|
transition: transform 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86);
|
|
56
38
|
}
|
|
57
39
|
|
|
58
40
|
:global {
|
|
59
|
-
|
|
41
|
+
.snack-rc-drawer-mask {
|
|
60
42
|
pointer-events: auto;
|
|
61
43
|
|
|
62
44
|
position: absolute;
|
|
@@ -70,27 +52,27 @@ $panelMotions: (
|
|
|
70
52
|
|
|
71
53
|
transition: opacity 0.2s;
|
|
72
54
|
|
|
73
|
-
|
|
74
|
-
|
|
55
|
+
&.maskMotion-enter,
|
|
56
|
+
&.maskMotion-appear {
|
|
75
57
|
opacity: 0;
|
|
76
58
|
}
|
|
77
59
|
|
|
78
|
-
|
|
79
|
-
|
|
60
|
+
&.maskMotion-enter-active,
|
|
61
|
+
&.maskMotion-appear-active {
|
|
80
62
|
opacity: 1;
|
|
81
63
|
}
|
|
82
64
|
|
|
83
|
-
|
|
65
|
+
&.maskMotion-leave {
|
|
84
66
|
opacity: 1;
|
|
85
67
|
transition: opacity 0.1s;
|
|
86
68
|
}
|
|
87
69
|
|
|
88
|
-
|
|
70
|
+
&.maskMotion-leave-active {
|
|
89
71
|
opacity: 0;
|
|
90
72
|
}
|
|
91
73
|
}
|
|
92
74
|
|
|
93
|
-
|
|
75
|
+
.snack-rc-drawer-section {
|
|
94
76
|
pointer-events: auto;
|
|
95
77
|
|
|
96
78
|
position: relative;
|
|
@@ -108,10 +90,10 @@ $panelMotions: (
|
|
|
108
90
|
box-shadow: base.$sn-boxShadow-elevation-level5;
|
|
109
91
|
}
|
|
110
92
|
|
|
111
|
-
|
|
93
|
+
.snack-rc-drawer-content-wrapper {
|
|
112
94
|
pointer-events: none;
|
|
113
95
|
will-change: transform;
|
|
114
|
-
|
|
96
|
+
|
|
115
97
|
position: absolute;
|
|
116
98
|
z-index: initial;
|
|
117
99
|
|
|
@@ -130,7 +112,7 @@ $panelMotions: (
|
|
|
130
112
|
&[data-position='top'] {
|
|
131
113
|
@include base.composite-var(drawer.$drawer, 'anatomy', 'container', 'horizontal', 'positionTop');
|
|
132
114
|
|
|
133
|
-
|
|
115
|
+
.snack-rc-drawer-section {
|
|
134
116
|
@include base.composite-var(drawer.$drawer, 'anatomy', 'container', 'horizontal', 'positionTop', 'container');
|
|
135
117
|
}
|
|
136
118
|
}
|
|
@@ -140,7 +122,7 @@ $panelMotions: (
|
|
|
140
122
|
|
|
141
123
|
@include base.composite-var(drawer.$drawer, 'anatomy', 'container', 'horizontal', 'positionBottom');
|
|
142
124
|
|
|
143
|
-
|
|
125
|
+
.snack-rc-drawer-section {
|
|
144
126
|
@include base.composite-var(drawer.$drawer, 'anatomy', 'container', 'horizontal', 'positionBottom', 'container');
|
|
145
127
|
}
|
|
146
128
|
}
|
|
@@ -152,7 +134,7 @@ $panelMotions: (
|
|
|
152
134
|
|
|
153
135
|
@include base.composite-var(drawer.$drawer, 'anatomy', 'container', 'vertical', 'positionLeft');
|
|
154
136
|
|
|
155
|
-
|
|
137
|
+
.snack-rc-drawer-section {
|
|
156
138
|
@include base.composite-var(drawer.$drawer, 'anatomy', 'container', 'vertical', 'positionLeft', 'container');
|
|
157
139
|
}
|
|
158
140
|
}
|
|
@@ -164,7 +146,7 @@ $panelMotions: (
|
|
|
164
146
|
|
|
165
147
|
@include base.composite-var(drawer.$drawer, 'anatomy', 'container', 'vertical', 'positionRight');
|
|
166
148
|
|
|
167
|
-
|
|
149
|
+
.snack-rc-drawer-section {
|
|
168
150
|
@include base.composite-var(drawer.$drawer, 'anatomy', 'container', 'vertical', 'positionRight', 'container');
|
|
169
151
|
}
|
|
170
152
|
}
|
|
@@ -207,32 +189,32 @@ $panelMotions: (
|
|
|
207
189
|
}
|
|
208
190
|
|
|
209
191
|
@each $placement, $offscreen in $panelMotions {
|
|
210
|
-
|
|
211
|
-
|
|
192
|
+
&.panelMotion-#{$placement}-enter,
|
|
193
|
+
&.panelMotion-#{$placement}-appear {
|
|
212
194
|
transform: $offscreen;
|
|
213
195
|
}
|
|
214
196
|
|
|
215
|
-
|
|
216
|
-
|
|
197
|
+
&.panelMotion-#{$placement}-enter-active,
|
|
198
|
+
&.panelMotion-#{$placement}-appear-active {
|
|
217
199
|
transform: translate(0);
|
|
218
200
|
}
|
|
219
201
|
|
|
220
|
-
|
|
202
|
+
&.panelMotion-#{$placement}-leave {
|
|
221
203
|
transform: translate(0);
|
|
222
204
|
}
|
|
223
205
|
|
|
224
|
-
|
|
206
|
+
&.panelMotion-#{$placement}-leave-active {
|
|
225
207
|
transform: $offscreen;
|
|
226
208
|
transition: transform 0.1s ease-out;
|
|
227
209
|
}
|
|
228
210
|
}
|
|
229
211
|
}
|
|
230
212
|
|
|
231
|
-
|
|
213
|
+
.snack-rc-drawer-content-wrapper-hidden {
|
|
232
214
|
display: none;
|
|
233
215
|
}
|
|
234
216
|
|
|
235
|
-
|
|
217
|
+
.snack-rc-drawer-resizable-dragger {
|
|
236
218
|
pointer-events: auto;
|
|
237
219
|
cursor: ew-resize;
|
|
238
220
|
|
|
@@ -266,66 +248,66 @@ $panelMotions: (
|
|
|
266
248
|
}
|
|
267
249
|
}
|
|
268
250
|
|
|
269
|
-
|
|
251
|
+
.snack-rc-drawer-resizable-dragger-left {
|
|
270
252
|
right: $draggerPosition;
|
|
271
253
|
}
|
|
272
254
|
|
|
273
|
-
|
|
255
|
+
.snack-rc-drawer-resizable-dragger-right {
|
|
274
256
|
left: $draggerPosition;
|
|
275
257
|
}
|
|
276
258
|
}
|
|
277
259
|
|
|
278
|
-
&:global(
|
|
279
|
-
&:global(
|
|
260
|
+
&:global(.snack-rc-drawer-left),
|
|
261
|
+
&:global(.snack-rc-drawer-right) {
|
|
280
262
|
top: 0;
|
|
281
263
|
width: 0%;
|
|
282
264
|
height: 100%;
|
|
283
265
|
}
|
|
284
266
|
|
|
285
|
-
&:global(
|
|
267
|
+
&:global(.snack-rc-drawer-left) {
|
|
286
268
|
left: 0;
|
|
287
269
|
}
|
|
288
270
|
|
|
289
|
-
&:global(
|
|
271
|
+
&:global(.snack-rc-drawer-right) {
|
|
290
272
|
right: 0;
|
|
291
273
|
}
|
|
292
274
|
|
|
293
|
-
&:global(
|
|
294
|
-
&:global(
|
|
275
|
+
&:global(.snack-rc-drawer-top),
|
|
276
|
+
&:global(.snack-rc-drawer-bottom) {
|
|
295
277
|
left: 0;
|
|
296
278
|
width: 100%;
|
|
297
279
|
height: 0%;
|
|
298
280
|
}
|
|
299
281
|
|
|
300
|
-
&:global(
|
|
282
|
+
&:global(.snack-rc-drawer-top) {
|
|
301
283
|
top: 0;
|
|
302
284
|
}
|
|
303
285
|
|
|
304
|
-
&:global(
|
|
286
|
+
&:global(.snack-rc-drawer-bottom) {
|
|
305
287
|
bottom: 0;
|
|
306
288
|
}
|
|
307
289
|
|
|
308
|
-
&:has(:global(
|
|
290
|
+
&:has(:global(.snack-rc-drawer-resizable-dragger-dragging)) {
|
|
309
291
|
cursor: ew-resize;
|
|
310
292
|
|
|
311
|
-
:global(
|
|
293
|
+
:global(.snack-rc-drawer-resizable-dragger) {
|
|
312
294
|
height: $activeDraggerHeight;
|
|
313
295
|
}
|
|
314
296
|
}
|
|
315
297
|
|
|
316
298
|
|
|
317
|
-
&:global(
|
|
318
|
-
&:global(
|
|
299
|
+
&:global(.snack-rc-drawer-left.snack-rc-drawer-open),
|
|
300
|
+
&:global(.snack-rc-drawer-right.snack-rc-drawer-open) {
|
|
319
301
|
width: 100%;
|
|
320
302
|
}
|
|
321
303
|
|
|
322
|
-
&:global(
|
|
323
|
-
&:global(
|
|
304
|
+
&:global(.snack-rc-drawer-top.snack-rc-drawer-open),
|
|
305
|
+
&:global(.snack-rc-drawer-bottom.snack-rc-drawer-open) {
|
|
324
306
|
height: 100%;
|
|
325
307
|
}
|
|
326
308
|
}
|
|
327
309
|
|
|
328
|
-
.drawerRoot:global(
|
|
310
|
+
.drawerRoot:global(.snack-rc-drawer .snack-rc-drawer-content-wrapper) {
|
|
329
311
|
@include m.with-material('acrylic', #{drawer});
|
|
330
312
|
}
|
|
331
313
|
|