playbook_ui_docs 14.17.0.pre.rc.1 → 14.18.0.pre.rc.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.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_fullscreen.jsx +90 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_fullscreen.md +3 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +2 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_background/docs/_background_overlay.jsx +35 -0
- data/app/pb_kits/playbook/pb_background/docs/_background_overlay.md +1 -0
- data/app/pb_kits/playbook/pb_background/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_background/docs/index.js +1 -0
- 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 +110 -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_dropdown/docs/_dropdown_with_autocomplete.jsx +6 -6
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete_and_custom_display.jsx +6 -6
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.jsx +6 -6
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display_rails.html.erb +8 -8
- data/app/pb_kits/playbook/pb_layout/docs/_layout_bracket.jsx +190 -0
- data/app/pb_kits/playbook/pb_layout/docs/_layout_bracket.md +5 -0
- data/app/pb_kits/playbook/pb_layout/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_layout/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_vertical.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless.html.erb +34 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless_rails.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating.html.erb +36 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating_rails.md +1 -0
- 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 +2 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_highlight.jsx +4 -4
- data/dist/playbook-doc.js +1 -1
- metadata +27 -14
- /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: 507cb2728035a82fda1d39c3d6375e87b2d2ed3e0f8069a4983477fbaa5ea22d
|
4
|
+
data.tar.gz: d686c06944bc4863389652e0e8143303ff06019068deed4734ef0a31772c5e80
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6944fa6e3e21af46532cc0f1a8dfc08235de36bcb855a2b376171d3a72cf267c84609b393a417a921b3099739d70351edf461a74a0bfabec2fd1674e03d29898
|
7
|
+
data.tar.gz: 793e942c63a534bfa7efe02166ec25807f661666e2bfbd114a55e3cde052912a323acf7acaec34abf44affec067ac4fa80d8f488657c15b93f98fd1986bdd88f
|
@@ -0,0 +1,90 @@
|
|
1
|
+
import React, { useState } from "react"
|
2
|
+
import { AdvancedTable, Button, Flex } from "playbook-ui"
|
3
|
+
import MOCK_DATA from "./advanced_table_mock_data.json"
|
4
|
+
import PAGINATION_MOCK_DATA from "./advanced_table_pagination_mock_data.json"
|
5
|
+
|
6
|
+
const AdvancedTableFullscreen = (props) => {
|
7
|
+
const [fullscreenToggleSmall, setFullscreenToggleSmall] = useState(null)
|
8
|
+
const [fullscreenToggleLarge, setFullscreenToggleLarge] = useState(null)
|
9
|
+
|
10
|
+
const columnDefinitions = [
|
11
|
+
{
|
12
|
+
accessor: "year",
|
13
|
+
label: "Year",
|
14
|
+
cellAccessors: ["quarter", "month", "day"],
|
15
|
+
},
|
16
|
+
{
|
17
|
+
accessor: "newEnrollments",
|
18
|
+
label: "New Enrollments",
|
19
|
+
},
|
20
|
+
{
|
21
|
+
accessor: "scheduledMeetings",
|
22
|
+
label: "Scheduled Meetings",
|
23
|
+
},
|
24
|
+
{
|
25
|
+
accessor: "attendanceRate",
|
26
|
+
label: "Attendance Rate",
|
27
|
+
},
|
28
|
+
{
|
29
|
+
accessor: "completedClasses",
|
30
|
+
label: "Completed Classes",
|
31
|
+
},
|
32
|
+
{
|
33
|
+
accessor: "classCompletionRate",
|
34
|
+
label: "Class Completion Rate",
|
35
|
+
},
|
36
|
+
{
|
37
|
+
accessor: "graduatedStudents",
|
38
|
+
label: "Graduated Students",
|
39
|
+
},
|
40
|
+
]
|
41
|
+
|
42
|
+
const tableProps = {
|
43
|
+
sticky: true
|
44
|
+
}
|
45
|
+
|
46
|
+
return (
|
47
|
+
<div>
|
48
|
+
<Flex justify="end">
|
49
|
+
<Button
|
50
|
+
marginBottom="sm"
|
51
|
+
onClick={() => fullscreenToggleSmall?.()}
|
52
|
+
text="Fullscreen Small Table"
|
53
|
+
variant="secondary"
|
54
|
+
/>
|
55
|
+
</Flex>
|
56
|
+
<AdvancedTable
|
57
|
+
allowFullScreen
|
58
|
+
columnDefinitions={columnDefinitions}
|
59
|
+
fullScreenControl={({ toggleFullscreen }) => setFullscreenToggleSmall(() => toggleFullscreen)}
|
60
|
+
tableData={MOCK_DATA}
|
61
|
+
{...props}
|
62
|
+
>
|
63
|
+
<AdvancedTable.Header enableSorting />
|
64
|
+
<AdvancedTable.Body />
|
65
|
+
</AdvancedTable>
|
66
|
+
<Flex justify="end">
|
67
|
+
<Button
|
68
|
+
marginY="sm"
|
69
|
+
onClick={() => fullscreenToggleLarge?.()}
|
70
|
+
text="Fullscreen Large Table"
|
71
|
+
variant="secondary"
|
72
|
+
/>
|
73
|
+
</Flex>
|
74
|
+
<AdvancedTable
|
75
|
+
allowFullScreen
|
76
|
+
columnDefinitions={columnDefinitions}
|
77
|
+
fullScreenControl={({ toggleFullscreen }) => setFullscreenToggleLarge(() => toggleFullscreen)}
|
78
|
+
responsive="none"
|
79
|
+
tableData={PAGINATION_MOCK_DATA}
|
80
|
+
tableProps={tableProps}
|
81
|
+
{...props}
|
82
|
+
>
|
83
|
+
<AdvancedTable.Header enableSorting />
|
84
|
+
<AdvancedTable.Body />
|
85
|
+
</AdvancedTable>
|
86
|
+
</div>
|
87
|
+
)
|
88
|
+
}
|
89
|
+
|
90
|
+
export default AdvancedTableFullscreen
|
@@ -0,0 +1,3 @@
|
|
1
|
+
Trigger Fullscreen mode with the `allowFullScreen`and `fullScreenControl` props. `allowFullScreen` is a boolean that enables Fullscreen functionality for an Advanced Table. `fullScreenControl` is a callback function that receives an object containing the table's internal `toggleFullscreen` function, allowing you to store and trigger Fullscreen from the parent component. An external trigger (like a button) must be used to activate Fullscreen mode.
|
2
|
+
|
3
|
+
Exit Fullscreen mode by clicking the minimize top-right-corner icon or by pressing the "Escape" keyboard key.
|
@@ -39,4 +39,5 @@ examples:
|
|
39
39
|
- advanced_table_selectable_rows_no_subrows: Selectable Rows (No Subrows)
|
40
40
|
- advanced_table_selectable_rows_actions: Selectable Rows (With Actions)
|
41
41
|
- advanced_table_selectable_rows_header: Selectable Rows (No Actions Bar)
|
42
|
-
- advanced_table_inline_editing: Inline Cell Editing
|
42
|
+
- advanced_table_inline_editing: Inline Cell Editing
|
43
|
+
- advanced_table_fullscreen: Fullscreen
|
@@ -21,4 +21,5 @@ export { default as AdvancedTableSelectableRowsHeader } from './_advanced_table_
|
|
21
21
|
export { default as AdvancedTableSelectableRowsActions } from './_advanced_table_selectable_rows_actions.jsx'
|
22
22
|
export { default as AdvancedTableTablePropsStickyHeader } from './_advanced_table_table_props_sticky_header.jsx'
|
23
23
|
export { default as AdvancedTableColumnHeadersCustomCell } from './_advanced_table_column_headers_custom_cell.jsx'
|
24
|
-
export { default as AdvancedTableInlineEditing } from './_advanced_table_inline_editing.jsx'
|
24
|
+
export { default as AdvancedTableInlineEditing } from './_advanced_table_inline_editing.jsx'
|
25
|
+
export { default as AdvancedTableFullscreen } from './_advanced_table_fullscreen.jsx'
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import Background from "../../pb_background/_background"
|
3
|
+
import Flex from "../../pb_flex/_flex"
|
4
|
+
import FlexItem from "../../pb_flex/_flex_item"
|
5
|
+
import Title from "../../pb_title/_title"
|
6
|
+
|
7
|
+
const BackgroundOverlay = (props) => {
|
8
|
+
return (
|
9
|
+
<Background
|
10
|
+
alt="colorful background"
|
11
|
+
backgroundColor="category_21"
|
12
|
+
className="background lazyload"
|
13
|
+
imageOverlay="opacity_2"
|
14
|
+
imageUrl="https://unsplash.it/500/400/?image=633"
|
15
|
+
{...props}
|
16
|
+
>
|
17
|
+
<Flex
|
18
|
+
orientation="column"
|
19
|
+
vertical="center"
|
20
|
+
{...props}
|
21
|
+
>
|
22
|
+
<FlexItem>
|
23
|
+
<Title
|
24
|
+
dark
|
25
|
+
padding="lg"
|
26
|
+
size={1}
|
27
|
+
text="Background Kit Image"
|
28
|
+
/>
|
29
|
+
</FlexItem>
|
30
|
+
</Flex>
|
31
|
+
</Background>
|
32
|
+
)
|
33
|
+
}
|
34
|
+
|
35
|
+
export default BackgroundOverlay
|
@@ -0,0 +1 @@
|
|
1
|
+
An overlay can be added to the background image by setting the `imageOverlay` prop and adding a `backgroundColor`. The `imageOverlay` prop can be set to any opacity ranging from `opacity_1` to `opacity_10`.
|
@@ -6,3 +6,4 @@ export { default as BackgroundStatus } from './_background_status.jsx'
|
|
6
6
|
export { default as BackgroundStatusSubtle } from './_background_status_subtle.jsx'
|
7
7
|
export { default as BackgroundCategory } from './_background_category.jsx'
|
8
8
|
export { default as BackgroundSize } from './_background_size.jsx'
|
9
|
+
export { default as BackgroundOverlay } from './_background_overlay.jsx'
|
@@ -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,110 @@
|
|
1
|
+
import React, { useState } from "react";
|
2
|
+
import Flex from '../../pb_flex/_flex'
|
3
|
+
import Caption from '../../pb_caption/_caption'
|
4
|
+
import Draggable from '../_draggable'
|
5
|
+
import { DraggableProvider } from '../context'
|
6
|
+
import Image from '../../pb_image/_image'
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
const dataLineVertical = [
|
11
|
+
{
|
12
|
+
id: "211",
|
13
|
+
url: "https://unsplash.it/500/400/?image=633",
|
14
|
+
},
|
15
|
+
{
|
16
|
+
id: "212",
|
17
|
+
url: "https://unsplash.it/500/400/?image=634",
|
18
|
+
},
|
19
|
+
{
|
20
|
+
id: "213",
|
21
|
+
url: "https://unsplash.it/500/400/?image=637",
|
22
|
+
},
|
23
|
+
];
|
24
|
+
|
25
|
+
const dataLineHorizontal = [
|
26
|
+
{
|
27
|
+
id: "2111",
|
28
|
+
url: "https://unsplash.it/500/400/?image=633",
|
29
|
+
},
|
30
|
+
{
|
31
|
+
id: "2122",
|
32
|
+
url: "https://unsplash.it/500/400/?image=634",
|
33
|
+
},
|
34
|
+
{
|
35
|
+
id: "2133",
|
36
|
+
url: "https://unsplash.it/500/400/?image=637",
|
37
|
+
},
|
38
|
+
];
|
39
|
+
|
40
|
+
const DraggableDropZones = (props) => {
|
41
|
+
const [initialLineVerticalState, setInitialLineVerticalState] = useState(dataLineVertical);
|
42
|
+
const [initialLineHorizontalState, setInitialLineHorizontalState] = useState(dataLineHorizontal);
|
43
|
+
|
44
|
+
return (
|
45
|
+
<>
|
46
|
+
<Caption marginBottom="xs"
|
47
|
+
marginTop="xl"
|
48
|
+
text="Vertical"
|
49
|
+
/>
|
50
|
+
<DraggableProvider
|
51
|
+
dropZone={{ type: "line", color: "purple" }}
|
52
|
+
initialItems={dataLineVertical}
|
53
|
+
onReorder={(items) => setInitialLineVerticalState(items)}
|
54
|
+
>
|
55
|
+
<Draggable.Container {...props}>
|
56
|
+
<Flex flexDirection="column"
|
57
|
+
height="367px"
|
58
|
+
>
|
59
|
+
{initialLineVerticalState.map(({ id, url }) => (
|
60
|
+
<Draggable.Item dragId={id}
|
61
|
+
key={id}
|
62
|
+
marginBottom="sm"
|
63
|
+
>
|
64
|
+
<Image alt={id}
|
65
|
+
size="md"
|
66
|
+
url={url}
|
67
|
+
/>
|
68
|
+
</Draggable.Item>
|
69
|
+
))}
|
70
|
+
</Flex>
|
71
|
+
</Draggable.Container>
|
72
|
+
</DraggableProvider>
|
73
|
+
<Caption marginBottom="xs"
|
74
|
+
marginTop="xl"
|
75
|
+
text="Horizontal"
|
76
|
+
/>
|
77
|
+
<Flex>
|
78
|
+
<DraggableProvider
|
79
|
+
dropZone={{ type: "line", direction: "horizontal" }}
|
80
|
+
initialItems={dataLineHorizontal}
|
81
|
+
onReorder={(items) => setInitialLineHorizontalState(items)}
|
82
|
+
>
|
83
|
+
<Draggable.Container
|
84
|
+
htmlOptions={{style:{ width: "285px"}}}
|
85
|
+
{...props}
|
86
|
+
>
|
87
|
+
<Flex alignItems="stretch"
|
88
|
+
flexDirection="row"
|
89
|
+
height="110px"
|
90
|
+
>
|
91
|
+
{initialLineHorizontalState.map(({ id, url }) => (
|
92
|
+
<Draggable.Item dragId={id}
|
93
|
+
key={id}
|
94
|
+
marginRight="sm"
|
95
|
+
>
|
96
|
+
<Image alt={id}
|
97
|
+
size="md"
|
98
|
+
url={url}
|
99
|
+
/>
|
100
|
+
</Draggable.Item>
|
101
|
+
))}
|
102
|
+
</Flex>
|
103
|
+
</Draggable.Container>
|
104
|
+
</DraggableProvider>
|
105
|
+
</Flex>
|
106
|
+
</>
|
107
|
+
);
|
108
|
+
};
|
109
|
+
|
110
|
+
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'
|