playbook_ui 14.17.0.pre.alpha.PBNTR925railstablecustomheaders7163 → 14.17.0.pre.alpha.PBNTR935draggablelinedesign7118
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 +43 -20
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones.jsx +102 -105
- 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 +50 -48
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors.md +1 -1
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_line.jsx +115 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_line.md +5 -0
- data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_table_react.jsx → _draggable_with_table.jsx} +1 -1
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table_react.md +3 -1
- data/app/pb_kits/playbook/pb_draggable/docs/example.yml +9 -6
- data/app/pb_kits/playbook/pb_draggable/docs/index.js +4 -1
- data/app/pb_kits/playbook/pb_draggable/draggable.test.jsx +68 -0
- data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableContainer.tsx +4 -3
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating_react.md +1 -1
- data/app/pb_kits/playbook/pb_table/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_table/table.rb +1 -13
- data/app/pb_kits/playbook/pb_table/table_header.rb +1 -13
- data/dist/chunks/{_typeahead-7W5Ha5Td.js → _typeahead-HqfDnjRe.js} +1 -1
- data/dist/chunks/{_weekday_stacked-DSKatW3m.js → _weekday_stacked-DVQITtQ9.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 +18 -20
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless.html.erb +0 -34
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless_rails.md +0 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating.html.erb +0 -36
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating_rails.md +0 -1
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_default_rails.html.erb → _draggable_default.html.erb} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_default.md → _draggable_default_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_multiple_containers_rails.html.erb → _draggable_multiple_containers.html.erb} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_multiple_containers.md → _draggable_multiple_containers_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_cards_rails.html.erb → _draggable_with_cards.html.erb} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_cards.md → _draggable_with_cards_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_list_rails.html.erb → _draggable_with_list.html.erb} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_list.md → _draggable_with_list_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_selectable_list_rails.html.erb → _draggable_with_selectable_list.html.erb} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_selectable_list.md → _draggable_with_selectable_list_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_table.md → _draggable_with_table_rails.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: ee5a8f7236c5915641d49888d1b31358596a366e9e22a281b560dcaa31bb8936
|
4
|
+
data.tar.gz: ad235c43f83f72d5d31a9a99e02d662cb7db5b5b5c270d9c1bbe3c9392e9d9ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 198ec85648866bcbcb816b91bc9a54e8ea126596c036bc5af0d8fb9ddad100b1cfca65a032a24cc65211f0679495cbbc5ab0f0708cf2751c9e75d1f19fac35bd
|
7
|
+
data.tar.gz: 9ca8b30bda370751ff399531e4e22879a39beae908d79dedac31dfe5f30159aa501b1a3ed620d80f44e74d1c619ac1517e31c304d8583c9d86862a74a157ba99
|
@@ -1,5 +1,6 @@
|
|
1
1
|
@import "../tokens/colors";
|
2
2
|
@import "../tokens/opacity";
|
3
|
+
@import "../tokens/border_radius";
|
3
4
|
|
4
5
|
.pb_draggable_container {
|
5
6
|
.pb_draggable_item {
|
@@ -34,7 +35,7 @@
|
|
34
35
|
width: 100%;
|
35
36
|
height: 100%;
|
36
37
|
border: 2px dashed $neutral;
|
37
|
-
border-radius: $
|
38
|
+
border-radius: $border_radius_sm;
|
38
39
|
box-sizing: border-box;
|
39
40
|
z-index: 10;
|
40
41
|
pointer-events: none;
|
@@ -64,7 +65,7 @@
|
|
64
65
|
width: 100%;
|
65
66
|
height: 100%;
|
66
67
|
background-color: rgba($neutral, $opacity_5);
|
67
|
-
border-radius: $
|
68
|
+
border-radius: $border_radius_sm;
|
68
69
|
z-index: 10;
|
69
70
|
pointer-events: none;
|
70
71
|
}
|
@@ -73,48 +74,70 @@
|
|
73
74
|
&.drop_zone_color_primary::before { background-color: rgba($primary, $opacity_5); }
|
74
75
|
&.drop_zone_color_purple::before { background-color: rgba($purple, $opacity_5); }
|
75
76
|
}
|
76
|
-
|
77
|
-
|
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;
|
78
83
|
&.drop_zone_line {
|
79
|
-
// Hide the original content to show the line
|
84
|
+
// Hide the original content to show the line only (held draggable item should not take up space in drop zone)
|
85
|
+
position: relative;
|
86
|
+
z-index: 2;
|
80
87
|
& > * {
|
81
88
|
opacity: 0;
|
82
89
|
}
|
83
|
-
|
90
|
+
height: 4px;
|
84
91
|
// Style for horizontal line (default)
|
85
92
|
&::before {
|
86
93
|
content: '';
|
87
94
|
position: absolute;
|
88
95
|
left: 0;
|
89
96
|
top: 0;
|
90
|
-
width:
|
91
|
-
height:
|
97
|
+
width: 100%;
|
98
|
+
height: 4px;
|
92
99
|
background-color: $neutral;
|
93
|
-
border-radius:
|
100
|
+
border-radius: $border_radius_rounded;
|
94
101
|
z-index: 10;
|
95
102
|
pointer-events: none;
|
103
|
+
transform: translateY(-50%);
|
96
104
|
}
|
97
|
-
|
98
|
-
// Apply color variants
|
105
|
+
// Apply color variants to the ::before element
|
99
106
|
&.drop_zone_color_primary::before { background-color: $primary; }
|
100
107
|
&.drop_zone_color_purple::before { background-color: $purple; }
|
101
108
|
}
|
102
109
|
}
|
103
110
|
}
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
.pb_draggable_item {
|
109
|
-
&.is_dragging {
|
110
|
-
// Line variant for vertical layouts (horizontal line)
|
111
|
+
// Line variant - Horizontal orientation (vertical line for draggable items in horizontal layout)
|
112
|
+
&.line_horizontal {
|
113
|
+
.pb_draggable_item {
|
114
|
+
position: relative;
|
111
115
|
&.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
|
112
124
|
&::before {
|
113
|
-
|
114
|
-
|
125
|
+
content: '';
|
126
|
+
position: absolute;
|
115
127
|
left: 0;
|
116
128
|
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%);
|
117
136
|
}
|
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; }
|
118
141
|
}
|
119
142
|
}
|
120
143
|
}
|
@@ -60,123 +60,120 @@ const DraggableDropZones = (props) => {
|
|
60
60
|
|
61
61
|
return (
|
62
62
|
<>
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
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}
|
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
|
86
73
|
marginBottom="xs"
|
87
|
-
|
74
|
+
text="Shadow"
|
75
|
+
textAlign="center"
|
76
|
+
/>
|
77
|
+
<Draggable.Container
|
78
|
+
htmlOptions={{style:{ width: "200px"}}}
|
88
79
|
{...props}
|
89
80
|
>
|
90
|
-
|
91
|
-
|
81
|
+
{initialShadowState.map(({ id, text }) => (
|
82
|
+
<Card dragId={id}
|
83
|
+
draggableItem
|
84
|
+
key={id}
|
85
|
+
marginBottom="xs"
|
86
|
+
padding="xs"
|
87
|
+
{...props}
|
92
88
|
>
|
93
|
-
<
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
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}
|
89
|
+
<Flex alignItems="stretch"
|
90
|
+
flexDirection="column"
|
91
|
+
>
|
92
|
+
<Body
|
93
|
+
text={text}
|
94
|
+
{...props}
|
95
|
+
/>
|
96
|
+
</Flex>
|
97
|
+
</Card>
|
98
|
+
))}
|
99
|
+
</Draggable.Container>
|
100
|
+
</DraggableProvider>
|
101
|
+
</FlexItem>
|
102
|
+
<FlexItem marginRight="xl">
|
103
|
+
<DraggableProvider
|
104
|
+
dropZone={{type: "outline"}}
|
105
|
+
initialItems={dataOutline}
|
106
|
+
onReorder={(items) => setInitialOutlineState(items)}
|
107
|
+
>
|
108
|
+
<Caption
|
124
109
|
marginBottom="xs"
|
125
|
-
|
110
|
+
text="Outline"
|
111
|
+
textAlign="center"
|
112
|
+
/>
|
113
|
+
<Draggable.Container
|
114
|
+
htmlOptions={{style:{ width: "200px"}}}
|
126
115
|
{...props}
|
127
116
|
>
|
128
|
-
|
129
|
-
|
130
|
-
|
117
|
+
{initialOutlineState.map(({ id, text }) => (
|
118
|
+
<Card
|
119
|
+
dragId={id}
|
120
|
+
draggableItem
|
121
|
+
key={id}
|
122
|
+
marginBottom="xs"
|
123
|
+
padding="xs"
|
124
|
+
{...props}
|
131
125
|
>
|
132
|
-
<
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
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}
|
126
|
+
<Flex
|
127
|
+
alignItems="stretch"
|
128
|
+
flexDirection="column"
|
129
|
+
>
|
130
|
+
<Body
|
131
|
+
text={text}
|
132
|
+
{...props}
|
133
|
+
/>
|
134
|
+
</Flex>
|
135
|
+
</Card>
|
136
|
+
))}
|
137
|
+
</Draggable.Container>
|
138
|
+
</DraggableProvider>
|
139
|
+
</FlexItem>
|
140
|
+
<FlexItem>
|
141
|
+
<DraggableProvider
|
142
|
+
dropZone={{type: "line"}}
|
143
|
+
initialItems={dataLine}
|
144
|
+
onReorder={(items) => setInitialLineState(items)}
|
145
|
+
>
|
146
|
+
<Caption
|
162
147
|
marginBottom="xs"
|
163
|
-
|
148
|
+
text="Line"
|
149
|
+
textAlign="center"
|
150
|
+
/>
|
151
|
+
<Draggable.Container
|
152
|
+
htmlOptions={{style:{ width: "200px"}}}
|
164
153
|
{...props}
|
165
154
|
>
|
166
|
-
|
167
|
-
|
155
|
+
{initialLineState.map(({ id, text }) => (
|
156
|
+
<Card dragId={id}
|
157
|
+
draggableItem
|
158
|
+
key={id}
|
159
|
+
marginBottom="xs"
|
160
|
+
padding="xs"
|
161
|
+
{...props}
|
168
162
|
>
|
169
|
-
<
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
163
|
+
<Flex alignItems="stretch"
|
164
|
+
flexDirection="column"
|
165
|
+
>
|
166
|
+
<Body
|
167
|
+
text={text}
|
168
|
+
{...props}
|
169
|
+
/>
|
170
|
+
</Flex>
|
171
|
+
</Card>
|
172
|
+
))}
|
173
|
+
</Draggable.Container>
|
174
|
+
</DraggableProvider>
|
175
|
+
</FlexItem>
|
176
|
+
</Flex>
|
180
177
|
</>
|
181
178
|
);
|
182
179
|
};
|
@@ -1,5 +1,5 @@
|
|
1
|
-
The Draggable kit
|
1
|
+
The Draggable kit lets you customize the style of drop zones that appear when dragging an item.
|
2
2
|
|
3
|
-
By default,
|
3
|
+
By default, drop zones are in the "ghost" style, but you can also choose from "shadow," "outline," and "line."
|
4
4
|
|
5
|
-
|
5
|
+
When using the "line" type, make sure to set the appropriate `direction` attribute within the `dropZone` prop based on the orientation of your draggable view. By default, this is set to "vertical," but it can also be adjusted to "horizontal." Note that the direction attribute only applies to the "line" type and does not affect other drop zone styles. For more on the "line" style in particular, check out the [Draggable Drop Zones Line doc example](https://playbook.powerapp.cloud/kits/draggable/react#draggable-drop-zones-line).
|
@@ -6,6 +6,8 @@ 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
|
+
|
9
11
|
// Initial items to be dragged
|
10
12
|
const dataPrimary = [
|
11
13
|
{
|
@@ -42,54 +44,54 @@ const DraggableDropZonesColors = (props) => {
|
|
42
44
|
|
43
45
|
return (
|
44
46
|
<>
|
45
|
-
|
46
|
-
|
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
|
-
|
47
|
+
<Caption marginBottom="xs"
|
48
|
+
text="Primary"
|
49
|
+
/>
|
50
|
+
<DraggableProvider
|
51
|
+
dropZone={{type: "shadow", color: "primary"}}
|
52
|
+
initialItems={dataPrimary}
|
53
|
+
onReorder={(items) => setInitialPrimaryState(items)}
|
54
|
+
>
|
55
|
+
<Draggable.Container {...props}>
|
56
|
+
<Flex>
|
57
|
+
{initialPrimaryState.map(({ id, url }) => (
|
58
|
+
<Draggable.Item dragId={id}
|
59
|
+
key={id}
|
60
|
+
marginRight="sm"
|
61
|
+
>
|
62
|
+
<Image alt={id}
|
63
|
+
size="md"
|
64
|
+
url={url}
|
65
|
+
/>
|
66
|
+
</Draggable.Item>
|
67
|
+
))}
|
68
|
+
</Flex>
|
69
|
+
</Draggable.Container>
|
70
|
+
</DraggableProvider>
|
71
|
+
<Caption marginBottom="xs"
|
72
|
+
text="Purple"
|
73
|
+
/>
|
74
|
+
<DraggableProvider
|
75
|
+
dropZone={{type: "outline", color: "purple"}}
|
76
|
+
initialItems={dataPurple}
|
77
|
+
onReorder={(items) => setInitialPurpleState(items)}
|
78
|
+
>
|
79
|
+
<Draggable.Container {...props}>
|
80
|
+
<Flex>
|
81
|
+
{initialPurpleState.map(({ id, url }) => (
|
82
|
+
<Draggable.Item dragId={id}
|
83
|
+
key={id}
|
84
|
+
marginRight="sm"
|
85
|
+
>
|
86
|
+
<Image alt={id}
|
87
|
+
size="md"
|
88
|
+
url={url}
|
89
|
+
/>
|
90
|
+
</Draggable.Item>
|
91
|
+
))}
|
92
|
+
</Flex>
|
93
|
+
</Draggable.Container>
|
94
|
+
</DraggableProvider>
|
93
95
|
</>
|
94
96
|
);
|
95
97
|
};
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
The default `color` for Draggable kit drop zones is "neutral", with "primary" or "purple" as additional options. When `type` is set to "line", the default color is "primary" and "purple" is the only other option.
|
@@ -0,0 +1,115 @@
|
|
1
|
+
import React, { useState } from "react";
|
2
|
+
import Body from '../../pb_body/_body'
|
3
|
+
import Flex from '../../pb_flex/_flex'
|
4
|
+
import Card from '../../pb_card/_card'
|
5
|
+
import Caption from '../../pb_caption/_caption'
|
6
|
+
import Draggable from '../_draggable'
|
7
|
+
import { DraggableProvider } from '../context'
|
8
|
+
import Image from '../../pb_image/_image'
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
const dataLineVertical = [
|
13
|
+
{
|
14
|
+
id: "211",
|
15
|
+
url: "https://unsplash.it/500/400/?image=633",
|
16
|
+
},
|
17
|
+
{
|
18
|
+
id: "212",
|
19
|
+
url: "https://unsplash.it/500/400/?image=634",
|
20
|
+
},
|
21
|
+
{
|
22
|
+
id: "213",
|
23
|
+
url: "https://unsplash.it/500/400/?image=637",
|
24
|
+
},
|
25
|
+
];
|
26
|
+
|
27
|
+
const dataLineHorizontal = [
|
28
|
+
{
|
29
|
+
id: "221",
|
30
|
+
text: "Task 1",
|
31
|
+
},
|
32
|
+
{
|
33
|
+
id: "222",
|
34
|
+
text: "Task 2",
|
35
|
+
},
|
36
|
+
{
|
37
|
+
id: "223",
|
38
|
+
text: "Task 3",
|
39
|
+
},
|
40
|
+
];
|
41
|
+
|
42
|
+
const DraggableDropZones = (props) => {
|
43
|
+
const [initialLineVerticalState, setInitialLineVerticalState] = useState(dataLineVertical);
|
44
|
+
const [initialLineHorizontalState, setInitialLineHorizontalState] = useState(dataLineHorizontal);
|
45
|
+
|
46
|
+
return (
|
47
|
+
<>
|
48
|
+
<Caption marginBottom="xs"
|
49
|
+
marginTop="xl"
|
50
|
+
text="Vertical"
|
51
|
+
/>
|
52
|
+
<DraggableProvider
|
53
|
+
dropZone={{ type: "line", color: "purple" }}
|
54
|
+
initialItems={dataLineVertical}
|
55
|
+
onReorder={(items) => setInitialLineVerticalState(items)}
|
56
|
+
>
|
57
|
+
<Draggable.Container {...props}>
|
58
|
+
<Flex flexDirection="column"
|
59
|
+
height="367px"
|
60
|
+
>
|
61
|
+
{initialLineVerticalState.map(({ id, url }) => (
|
62
|
+
<Draggable.Item dragId={id}
|
63
|
+
key={id}
|
64
|
+
marginBottom="sm"
|
65
|
+
>
|
66
|
+
<Image alt={id}
|
67
|
+
size="md"
|
68
|
+
url={url}
|
69
|
+
/>
|
70
|
+
</Draggable.Item>
|
71
|
+
))}
|
72
|
+
</Flex>
|
73
|
+
</Draggable.Container>
|
74
|
+
</DraggableProvider>
|
75
|
+
<Caption marginBottom="xs"
|
76
|
+
marginTop="xl"
|
77
|
+
text="Horizontal"
|
78
|
+
/>
|
79
|
+
<Flex>
|
80
|
+
<DraggableProvider
|
81
|
+
dropZone={{ type: "line", direction: "horizontal" }}
|
82
|
+
initialItems={dataLineHorizontal}
|
83
|
+
onReorder={(items) => setInitialLineHorizontalState(items)}
|
84
|
+
>
|
85
|
+
<Draggable.Container
|
86
|
+
htmlOptions={{style:{ width: "285px"}}}
|
87
|
+
{...props}
|
88
|
+
>
|
89
|
+
<Flex alignItems="stretch"
|
90
|
+
flexDirection="row"
|
91
|
+
height="42px"
|
92
|
+
>
|
93
|
+
{initialLineHorizontalState.map(({ id, text }) => (
|
94
|
+
<Card dragId={id}
|
95
|
+
draggableItem
|
96
|
+
key={id}
|
97
|
+
marginRight="xs"
|
98
|
+
padding="xs"
|
99
|
+
{...props}
|
100
|
+
>
|
101
|
+
<Body
|
102
|
+
text={text}
|
103
|
+
{...props}
|
104
|
+
/>
|
105
|
+
</Card>
|
106
|
+
))}
|
107
|
+
</Flex>
|
108
|
+
</Draggable.Container>
|
109
|
+
</DraggableProvider>
|
110
|
+
</Flex>
|
111
|
+
</>
|
112
|
+
);
|
113
|
+
};
|
114
|
+
|
115
|
+
export default DraggableDropZones;
|
@@ -0,0 +1,5 @@
|
|
1
|
+
When using the "line" style, make sure to set the appropriate `direction` attribute within the `dropZone` prop based on the orientation of your draggable view. By default, this is set to "vertical," but it can also be adjusted to "horizontal." Note that the direction attribute only applies to the "line" style and does not affect other drop zone styles. The default `color` for "line" is "primary" and "purple" is the only alternative color option.
|
2
|
+
|
3
|
+
The length of the line is calculated based off of the width (for "vertical") or height (for "horizontal") of the parent container holding the draggable items.
|
4
|
+
|
5
|
+
Additionally, if the parent container of the `DraggableProvider`/`DraggableContainer` (or a subcontainer within) does not have a set height (for "vertical") or width (for "horizontal"), like the [Draggable Drop Zones doc example](https://playbook.powerapp.cloud/kits/draggable/react#draggable-drop-zones) does, elements on the page may jump up (for "vertical") or to the left (for "horizontal") when an item is actively being dragged. To prevent this, give a parent element a fixed height (for "vertical") or width (for "horizontal") as demonstrated in this doc example.
|
@@ -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 '../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,4 +2,6 @@ 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.
|
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.
|
@@ -4,14 +4,17 @@ 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: 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
|
9
12
|
|
10
13
|
rails:
|
11
|
-
-
|
12
|
-
-
|
13
|
-
-
|
14
|
-
-
|
14
|
+
- draggable_default: Default
|
15
|
+
- draggable_with_list: Draggable with List Kit
|
16
|
+
- draggable_with_selectable_list: Draggable with SelectableList Kit
|
17
|
+
- draggable_with_cards: Draggable with Cards
|
15
18
|
- draggable_with_table: Draggable with Table
|
16
|
-
-
|
19
|
+
- draggable_multiple_containers: Dragging Across Multiple Containers
|
17
20
|
|
@@ -3,4 +3,7 @@ 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
|
6
|
+
export { default as DraggableWithTable } from './_draggable_with_table.jsx'
|
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'
|