playbook_ui 14.17.0.pre.alpha.PBNTR935draggablelinedesign7118 → 14.17.0.pre.alpha.alphaforaudiences7167
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.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_draggable/_draggable.scss +20 -43
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones.jsx +105 -102
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones.md +3 -3
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors.jsx +48 -50
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors.md +1 -1
- data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_table.jsx → _draggable_with_table_react.jsx} +1 -1
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table_react.md +1 -3
- data/app/pb_kits/playbook/pb_draggable/docs/example.yml +6 -9
- data/app/pb_kits/playbook/pb_draggable/docs/index.js +1 -4
- data/app/pb_kits/playbook/pb_draggable/draggable.test.jsx +0 -68
- data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableContainer.tsx +3 -4
- data/dist/chunks/{_typeahead-HqfDnjRe.js → _typeahead-7W5Ha5Td.js} +1 -1
- data/dist/chunks/{_weekday_stacked-DVQITtQ9.js → _weekday_stacked-DSKatW3m.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +1 -1
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +16 -18
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_line.jsx +0 -115
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_line.md +0 -5
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_default_react.md → _draggable_default.md} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_default.html.erb → _draggable_default_rails.html.erb} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_multiple_containers_react.md → _draggable_multiple_containers.md} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_multiple_containers.html.erb → _draggable_multiple_containers_rails.html.erb} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_cards_react.md → _draggable_with_cards.md} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_cards.html.erb → _draggable_with_cards_rails.html.erb} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_list_react.md → _draggable_with_list.md} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_list.html.erb → _draggable_with_list_rails.html.erb} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_selectable_list_react.md → _draggable_with_selectable_list.md} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_selectable_list.html.erb → _draggable_with_selectable_list_rails.html.erb} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_table_rails.md → _draggable_with_table.md} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d4e1505953fc9d8679af10f4517e1db1910b806f2540bcba412afbaca8eb912
|
4
|
+
data.tar.gz: e1ec597e443b273d2037e5e0a572a9ca8f52ce25fb3754ccbc24edebd969377b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5e5f58405349fa05f6942b377efee9d7c845c74dfbbe1009fe28e9c50459871f1dcc0e23f9a4bc2e190493ef648fce14e3b06bd0e697fa8a07114c95068c219
|
7
|
+
data.tar.gz: 84723e76ae32724c3926bf9ac0a7b9b048ae640635f982ca9126ae99fdbd97528215d7c7dd563e739d9a3718787a98f31ce31729a725080466de72ffb50cbf61
|
@@ -1,6 +1,5 @@
|
|
1
1
|
@import "../tokens/colors";
|
2
2
|
@import "../tokens/opacity";
|
3
|
-
@import "../tokens/border_radius";
|
4
3
|
|
5
4
|
.pb_draggable_container {
|
6
5
|
.pb_draggable_item {
|
@@ -35,7 +34,7 @@
|
|
35
34
|
width: 100%;
|
36
35
|
height: 100%;
|
37
36
|
border: 2px dashed $neutral;
|
38
|
-
border-radius: $
|
37
|
+
border-radius: $border-radius-sm;
|
39
38
|
box-sizing: border-box;
|
40
39
|
z-index: 10;
|
41
40
|
pointer-events: none;
|
@@ -65,7 +64,7 @@
|
|
65
64
|
width: 100%;
|
66
65
|
height: 100%;
|
67
66
|
background-color: rgba($neutral, $opacity_5);
|
68
|
-
border-radius: $
|
67
|
+
border-radius: $border-radius-sm;
|
69
68
|
z-index: 10;
|
70
69
|
pointer-events: none;
|
71
70
|
}
|
@@ -74,70 +73,48 @@
|
|
74
73
|
&.drop_zone_color_primary::before { background-color: rgba($primary, $opacity_5); }
|
75
74
|
&.drop_zone_color_purple::before { background-color: rgba($purple, $opacity_5); }
|
76
75
|
}
|
77
|
-
|
78
|
-
|
79
|
-
// Line default - Vertical orientation (horizontal line for draggable items in vertical layout)
|
80
|
-
&.line_vertical {
|
81
|
-
.pb_draggable_item {
|
82
|
-
position: relative;
|
76
|
+
|
77
|
+
// Line variant
|
83
78
|
&.drop_zone_line {
|
84
|
-
// Hide the original content to show the line
|
85
|
-
position: relative;
|
86
|
-
z-index: 2;
|
79
|
+
// Hide the original content to show the line
|
87
80
|
& > * {
|
88
81
|
opacity: 0;
|
89
82
|
}
|
90
|
-
|
83
|
+
|
91
84
|
// Style for horizontal line (default)
|
92
85
|
&::before {
|
93
86
|
content: '';
|
94
87
|
position: absolute;
|
95
88
|
left: 0;
|
96
89
|
top: 0;
|
97
|
-
width:
|
98
|
-
height:
|
90
|
+
width: 4px;
|
91
|
+
height: 100%;
|
99
92
|
background-color: $neutral;
|
100
|
-
border-radius:
|
93
|
+
border-radius: 1000px;
|
101
94
|
z-index: 10;
|
102
95
|
pointer-events: none;
|
103
|
-
transform: translateY(-50%);
|
104
96
|
}
|
105
|
-
|
97
|
+
|
98
|
+
// Apply color variants
|
106
99
|
&.drop_zone_color_primary::before { background-color: $primary; }
|
107
100
|
&.drop_zone_color_purple::before { background-color: $purple; }
|
108
101
|
}
|
109
102
|
}
|
110
103
|
}
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
104
|
+
}
|
105
|
+
|
106
|
+
// Support for vertical layouts (horizontal line)
|
107
|
+
.pb_draggable_container.vertical {
|
108
|
+
.pb_draggable_item {
|
109
|
+
&.is_dragging {
|
110
|
+
// Line variant for vertical layouts (horizontal line)
|
115
111
|
&.drop_zone_line {
|
116
|
-
position: relative;
|
117
|
-
z-index: 2;
|
118
|
-
& > * {
|
119
|
-
opacity: 0;
|
120
|
-
}
|
121
|
-
width: 4px;
|
122
|
-
height: auto;
|
123
|
-
// Style for vertical line
|
124
112
|
&::before {
|
125
|
-
|
126
|
-
|
113
|
+
width: 100%;
|
114
|
+
height: 4px;
|
127
115
|
left: 0;
|
128
116
|
top: 0;
|
129
|
-
width: 4px;
|
130
|
-
height: 100%;
|
131
|
-
background-color: $neutral;
|
132
|
-
border-radius: $border_radius_rounded;
|
133
|
-
z-index: 10;
|
134
|
-
pointer-events: none;
|
135
|
-
transform: translateX(-50%);
|
136
117
|
}
|
137
|
-
|
138
|
-
// Apply color variants to the ::before element
|
139
|
-
&.drop_zone_color_primary::before { background-color: $primary; }
|
140
|
-
&.drop_zone_color_purple::before { background-color: $purple; }
|
141
118
|
}
|
142
119
|
}
|
143
120
|
}
|
@@ -60,120 +60,123 @@ const DraggableDropZones = (props) => {
|
|
60
60
|
|
61
61
|
return (
|
62
62
|
<>
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
63
|
+
<Flex justify="between"
|
64
|
+
{...props}
|
65
|
+
>
|
66
|
+
<FlexItem marginRight="xl">
|
67
|
+
<DraggableProvider
|
68
|
+
dropZone={{type: "shadow"}}
|
69
|
+
initialItems={dataShadow}
|
70
|
+
onReorder={(items) => setInitialShadowState(items)}
|
71
|
+
>
|
72
|
+
<Caption
|
73
|
+
marginBottom="xs"
|
74
|
+
textAlign="center"
|
75
|
+
>
|
76
|
+
{"Shadow"}
|
77
|
+
</Caption>
|
78
|
+
<Draggable.Container
|
79
|
+
htmlOptions={{style:{ width: "200px"}}}
|
80
|
+
{...props}
|
81
|
+
>
|
82
|
+
{initialShadowState.map(({ id, text }) => (
|
83
|
+
<Card dragId={id}
|
84
|
+
draggableItem
|
85
|
+
key={id}
|
73
86
|
marginBottom="xs"
|
74
|
-
|
75
|
-
textAlign="center"
|
76
|
-
/>
|
77
|
-
<Draggable.Container
|
78
|
-
htmlOptions={{style:{ width: "200px"}}}
|
87
|
+
padding="xs"
|
79
88
|
{...props}
|
80
89
|
>
|
81
|
-
|
82
|
-
|
83
|
-
draggableItem
|
84
|
-
key={id}
|
85
|
-
marginBottom="xs"
|
86
|
-
padding="xs"
|
87
|
-
{...props}
|
90
|
+
<Flex alignItems="stretch"
|
91
|
+
flexDirection="column"
|
88
92
|
>
|
89
|
-
<
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
93
|
+
<Body
|
94
|
+
text={text}
|
95
|
+
{...props}
|
96
|
+
/>
|
97
|
+
</Flex>
|
98
|
+
</Card>
|
99
|
+
))}
|
100
|
+
</Draggable.Container>
|
101
|
+
</DraggableProvider>
|
102
|
+
</FlexItem>
|
103
|
+
<FlexItem marginRight="xl">
|
104
|
+
<DraggableProvider
|
105
|
+
dropZone={{type: "outline"}}
|
106
|
+
initialItems={dataOutline}
|
107
|
+
onReorder={(items) => setInitialOutlineState(items)}
|
108
|
+
>
|
109
|
+
<Caption
|
110
|
+
marginBottom="xs"
|
111
|
+
textAlign="center"
|
112
|
+
>
|
113
|
+
{"Outline"}
|
114
|
+
</Caption>
|
115
|
+
<Draggable.Container
|
116
|
+
htmlOptions={{style:{ width: "200px"}}}
|
117
|
+
{...props}
|
118
|
+
>
|
119
|
+
{initialOutlineState.map(({ id, text }) => (
|
120
|
+
<Card
|
121
|
+
dragId={id}
|
122
|
+
draggableItem
|
123
|
+
key={id}
|
109
124
|
marginBottom="xs"
|
110
|
-
|
111
|
-
textAlign="center"
|
112
|
-
/>
|
113
|
-
<Draggable.Container
|
114
|
-
htmlOptions={{style:{ width: "200px"}}}
|
125
|
+
padding="xs"
|
115
126
|
{...props}
|
116
127
|
>
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
draggableItem
|
121
|
-
key={id}
|
122
|
-
marginBottom="xs"
|
123
|
-
padding="xs"
|
124
|
-
{...props}
|
128
|
+
<Flex
|
129
|
+
alignItems="stretch"
|
130
|
+
flexDirection="column"
|
125
131
|
>
|
126
|
-
<
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
132
|
+
<Body
|
133
|
+
text={text}
|
134
|
+
{...props}
|
135
|
+
/>
|
136
|
+
</Flex>
|
137
|
+
</Card>
|
138
|
+
))}
|
139
|
+
</Draggable.Container>
|
140
|
+
</DraggableProvider>
|
141
|
+
</FlexItem>
|
142
|
+
<FlexItem>
|
143
|
+
<DraggableProvider
|
144
|
+
dropZone={{type: "line"}}
|
145
|
+
initialItems={dataLine}
|
146
|
+
onReorder={(items) => setInitialLineState(items)}
|
147
|
+
>
|
148
|
+
<Caption
|
149
|
+
marginBottom="xs"
|
150
|
+
textAlign="center"
|
151
|
+
>
|
152
|
+
{"Line"}
|
153
|
+
</Caption>
|
154
|
+
<Draggable.Container
|
155
|
+
htmlOptions={{style:{ width: "200px"}}}
|
156
|
+
{...props}
|
157
|
+
>
|
158
|
+
{initialLineState.map(({ id, text }) => (
|
159
|
+
<Card dragId={id}
|
160
|
+
draggableItem
|
161
|
+
key={id}
|
147
162
|
marginBottom="xs"
|
148
|
-
|
149
|
-
textAlign="center"
|
150
|
-
/>
|
151
|
-
<Draggable.Container
|
152
|
-
htmlOptions={{style:{ width: "200px"}}}
|
163
|
+
padding="xs"
|
153
164
|
{...props}
|
154
165
|
>
|
155
|
-
|
156
|
-
|
157
|
-
draggableItem
|
158
|
-
key={id}
|
159
|
-
marginBottom="xs"
|
160
|
-
padding="xs"
|
161
|
-
{...props}
|
166
|
+
<Flex alignItems="stretch"
|
167
|
+
flexDirection="column"
|
162
168
|
>
|
163
|
-
<
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
</DraggableProvider>
|
175
|
-
</FlexItem>
|
176
|
-
</Flex>
|
169
|
+
<Body
|
170
|
+
text={text}
|
171
|
+
{...props}
|
172
|
+
/>
|
173
|
+
</Flex>
|
174
|
+
</Card>
|
175
|
+
))}
|
176
|
+
</Draggable.Container>
|
177
|
+
</DraggableProvider>
|
178
|
+
</FlexItem>
|
179
|
+
</Flex>
|
177
180
|
</>
|
178
181
|
);
|
179
182
|
};
|
@@ -1,5 +1,5 @@
|
|
1
|
-
|
1
|
+
The Draggable kit allows you to choose the style of drop zones that appear when dragging an item.
|
2
2
|
|
3
|
-
By default,
|
3
|
+
By default, the Draggable kit utilizes the "ghost" style for drop zones, but you can also choose between "shadow", "outline", and "line".
|
4
4
|
|
5
|
-
|
5
|
+
Additionally, when using the "line" style, be sure to set the proper `direction` attribute within the `dropZone` prop depending on the orentation of your draggable view. By default, this attribute is set to "vertical", but can also be used with a "horizontal" direction. The `direction` attribute only applies to the "line" style and will not affect other drop zone styles.
|
@@ -6,8 +6,6 @@ import Caption from '../../pb_caption/_caption'
|
|
6
6
|
import Draggable from '../../pb_draggable/_draggable'
|
7
7
|
import { DraggableProvider } from '../../pb_draggable/context'
|
8
8
|
|
9
|
-
|
10
|
-
|
11
9
|
// Initial items to be dragged
|
12
10
|
const dataPrimary = [
|
13
11
|
{
|
@@ -44,54 +42,54 @@ const DraggableDropZonesColors = (props) => {
|
|
44
42
|
|
45
43
|
return (
|
46
44
|
<>
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
45
|
+
<Caption marginBottom="xs">
|
46
|
+
Primary
|
47
|
+
</Caption>
|
48
|
+
<DraggableProvider
|
49
|
+
dropZone={{type: "shadow", color: "primary"}}
|
50
|
+
initialItems={dataPrimary}
|
51
|
+
onReorder={(items) => setInitialPrimaryState(items)}
|
52
|
+
>
|
53
|
+
<Draggable.Container {...props}>
|
54
|
+
<Flex>
|
55
|
+
{initialPrimaryState.map(({ id, url }) => (
|
56
|
+
<Draggable.Item dragId={id}
|
57
|
+
key={id}
|
58
|
+
marginRight="sm"
|
59
|
+
>
|
60
|
+
<Image alt={id}
|
61
|
+
size="md"
|
62
|
+
url={url}
|
63
|
+
/>
|
64
|
+
</Draggable.Item>
|
65
|
+
))}
|
66
|
+
</Flex>
|
67
|
+
</Draggable.Container>
|
68
|
+
</DraggableProvider>
|
69
|
+
<Caption marginBottom="xs">
|
70
|
+
Purple
|
71
|
+
</Caption>
|
72
|
+
<DraggableProvider
|
73
|
+
dropZone={{type: "outline", color: "purple"}}
|
74
|
+
initialItems={dataPurple}
|
75
|
+
onReorder={(items) => setInitialPurpleState(items)}
|
76
|
+
>
|
77
|
+
<Draggable.Container {...props}>
|
78
|
+
<Flex>
|
79
|
+
{initialPurpleState.map(({ id, url }) => (
|
80
|
+
<Draggable.Item dragId={id}
|
81
|
+
key={id}
|
82
|
+
marginRight="sm"
|
83
|
+
>
|
84
|
+
<Image alt={id}
|
85
|
+
size="md"
|
86
|
+
url={url}
|
87
|
+
/>
|
88
|
+
</Draggable.Item>
|
89
|
+
))}
|
90
|
+
</Flex>
|
91
|
+
</Draggable.Container>
|
92
|
+
</DraggableProvider>
|
95
93
|
</>
|
96
94
|
);
|
97
95
|
};
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
By default, the Draggable kit sets the default color of drop zones to "neutral" (or "primary" if using the "line" style.)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React, { useState } from "react";
|
2
2
|
|
3
3
|
import Flex from '../../pb_flex/_flex'
|
4
|
-
import { DraggableProvider } from '
|
4
|
+
import { DraggableProvider } from '../../pb_draggable/context'
|
5
5
|
import Avatar from '../../pb_avatar/_avatar'
|
6
6
|
import Body from '../../pb_body/_body'
|
7
7
|
import Table from '../../pb_table/_table'
|
@@ -2,6 +2,4 @@ The draggable kit can also be used in conjunction with the table kit to create d
|
|
2
2
|
|
3
3
|
- Wrap the Table with the `DraggableProvider` and manage state as shown.
|
4
4
|
- use the `draggableContainer` prop on the Table.Body to designate it as the Draggable Container
|
5
|
-
- use the `draggableItem` prop on the Table.Row to designate it as the Draggable Item. Make sure to also pass id to the `dragId` prop here.
|
6
|
-
|
7
|
-
We recommending using the default `dropZone type` with the Table kit.
|
5
|
+
- use the `draggableItem` prop on the Table.Row to designate it as the Draggable Item. Make sure to also pass id to the `dragId` prop here.
|
@@ -4,17 +4,14 @@ examples:
|
|
4
4
|
- draggable_with_list: Draggable with List Kit
|
5
5
|
- draggable_with_selectable_list: Draggable with SelectableList Kit
|
6
6
|
- draggable_with_cards: Draggable with Cards
|
7
|
-
-
|
7
|
+
- draggable_with_table_react: Draggable with Table
|
8
8
|
- draggable_multiple_containers: Dragging Across Multiple Containers
|
9
|
-
- draggable_drop_zones: Draggable Drop Zones
|
10
|
-
- draggable_drop_zones_colors: Draggable Drop Zones Colors
|
11
|
-
- draggable_drop_zones_line: Draggable Drop Zones Line
|
12
9
|
|
13
10
|
rails:
|
14
|
-
-
|
15
|
-
-
|
16
|
-
-
|
17
|
-
-
|
11
|
+
- draggable_default_rails: Default
|
12
|
+
- draggable_with_list_rails: Draggable with List Kit
|
13
|
+
- draggable_with_selectable_list_rails: Draggable with SelectableList Kit
|
14
|
+
- draggable_with_cards_rails: Draggable with Cards
|
18
15
|
- draggable_with_table: Draggable with Table
|
19
|
-
-
|
16
|
+
- draggable_multiple_containers_rails: Dragging Across Multiple Containers
|
20
17
|
|
@@ -3,7 +3,4 @@ export { default as DraggableWithCards } from './_draggable_with_cards.jsx'
|
|
3
3
|
export { default as DraggableWithList } from './_draggable_with_list.jsx'
|
4
4
|
export { default as DraggableWithSelectableList } from './_draggable_with_selectable_list.jsx'
|
5
5
|
export { default as DraggableMultipleContainers } from './_draggable_multiple_containers.jsx'
|
6
|
-
export { default as
|
7
|
-
export { default as DraggableDropZones } from './_draggable_drop_zones.jsx'
|
8
|
-
export { default as DraggableDropZonesColors } from './_draggable_drop_zones_colors.jsx'
|
9
|
-
export { default as DraggableDropZonesLine } from './_draggable_drop_zones_line.jsx'
|
6
|
+
export { default as DraggableWithTableReact } from './_draggable_with_table_react.jsx'
|
@@ -128,58 +128,6 @@ const DraggableKitWithCard = () => {
|
|
128
128
|
);
|
129
129
|
};
|
130
130
|
|
131
|
-
const DraggableWithLineVertical = () => {
|
132
|
-
const [initialState, setInitialState] = useState(data);
|
133
|
-
return (
|
134
|
-
<div data-testid={testId}>
|
135
|
-
<DraggableProvider
|
136
|
-
dropZone={{ type: "line" }}
|
137
|
-
initialItems={data}
|
138
|
-
onReorder={(items) => setInitialState(items)}
|
139
|
-
>
|
140
|
-
<Draggable>
|
141
|
-
<Draggable.Container>
|
142
|
-
{initialState.map(({ id, text }) => (
|
143
|
-
<Draggable.Item
|
144
|
-
dragId={id}
|
145
|
-
key={id}
|
146
|
-
>
|
147
|
-
{text}
|
148
|
-
</Draggable.Item>
|
149
|
-
))}
|
150
|
-
</Draggable.Container>
|
151
|
-
</Draggable>
|
152
|
-
</DraggableProvider>
|
153
|
-
</div>
|
154
|
-
);
|
155
|
-
};
|
156
|
-
|
157
|
-
const DraggableWithLineHorizontal = () => {
|
158
|
-
const [initialState, setInitialState] = useState(data);
|
159
|
-
return (
|
160
|
-
<div data-testid={testId}>
|
161
|
-
<DraggableProvider
|
162
|
-
dropZone={{ type: "line", direction: "horizontal" }}
|
163
|
-
initialItems={data}
|
164
|
-
onReorder={(items) => setInitialState(items)}
|
165
|
-
>
|
166
|
-
<Draggable>
|
167
|
-
<Draggable.Container>
|
168
|
-
{initialState.map(({ id, text }) => (
|
169
|
-
<Draggable.Item
|
170
|
-
dragId={id}
|
171
|
-
key={id}
|
172
|
-
>
|
173
|
-
{text}
|
174
|
-
</Draggable.Item>
|
175
|
-
))}
|
176
|
-
</Draggable.Container>
|
177
|
-
</Draggable>
|
178
|
-
</DraggableProvider>
|
179
|
-
</div>
|
180
|
-
);
|
181
|
-
};
|
182
|
-
|
183
131
|
test("generated default kit and classname", () => {
|
184
132
|
render(<DefaultDraggableKit />);
|
185
133
|
const kit = screen.getByTestId(testId);
|
@@ -240,19 +188,3 @@ test("generated dragHandle with Card", () => {
|
|
240
188
|
const dragHandle = card.querySelector(".pb_custom_icon");
|
241
189
|
expect(dragHandle).toBeInTheDocument();
|
242
190
|
});
|
243
|
-
|
244
|
-
test("line dropZone with default direction applies 'line_vertical' class to container", () => {
|
245
|
-
render(<DraggableWithLineVertical />);
|
246
|
-
const kit = screen.getByTestId(testId);
|
247
|
-
const container = kit.querySelector(".pb_draggable_container");
|
248
|
-
|
249
|
-
expect(container).toHaveClass("line_vertical");
|
250
|
-
});
|
251
|
-
|
252
|
-
test("line dropZone with horizontal direction applies 'line_horizontal' class to container", () => {
|
253
|
-
render(<DraggableWithLineHorizontal />);
|
254
|
-
const kit = screen.getByTestId(testId);
|
255
|
-
const container = kit.querySelector(".pb_draggable_container");
|
256
|
-
|
257
|
-
expect(container).toHaveClass("line_horizontal");
|
258
|
-
});
|
@@ -31,7 +31,7 @@ const DraggableContainer = (props: DraggableContainerProps) => {
|
|
31
31
|
} = contextValues;
|
32
32
|
|
33
33
|
// Only get direction if dropZone is 'line'
|
34
|
-
const direction = dropZone === 'line' ? (contextValues.direction || 'vertical') :
|
34
|
+
const direction = dropZone === 'line' ? (contextValues.direction || 'vertical') : 'vertical';
|
35
35
|
|
36
36
|
const ariaProps = buildAriaProps(aria);
|
37
37
|
const dataProps = buildDataProps(data);
|
@@ -41,9 +41,8 @@ const DraggableContainer = (props: DraggableContainerProps) => {
|
|
41
41
|
const classes = classnames(
|
42
42
|
buildCss("pb_draggable_container"),
|
43
43
|
`${activeContainer === container ? "active" : ""}`,
|
44
|
-
//
|
45
|
-
dropZone === 'line' && direction === 'vertical' ? '
|
46
|
-
dropZone === 'line' && direction === 'horizontal' ? 'line_horizontal' : '',
|
44
|
+
// Only add vertical class if dropZone is 'line' and direction is 'vertical'
|
45
|
+
(dropZone === 'line' && direction === 'vertical') ? 'vertical' : '',
|
47
46
|
globalProps(props),
|
48
47
|
className
|
49
48
|
);
|