playbook_ui_docs 14.16.0.pre.rc.6 → 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_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/_advanced_table_pagination.jsx +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows.html.erb +39 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_no_subrows.html.erb +33 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_no_subrows_rails.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_rails.md +6 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +4 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_inline.html.erb +0 -11
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_inline.jsx +0 -7
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones.jsx +181 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones.md +5 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors.jsx +99 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors.md +1 -0
- 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_drawer/docs/_drawer_breakpoints.html.erb +3 -0
- data/app/pb_kits/playbook/pb_drawer/docs/example.yml +1 -0
- 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_form/docs/_form_form_with.html.erb +67 -0
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +67 -0
- data/app/pb_kits/playbook/pb_icon/docs/_icon_color.html.erb +10 -4
- data/app/pb_kits/playbook/pb_icon/docs/_icon_color.jsx +49 -24
- data/app/pb_kits/playbook/pb_icon_button/docs/_icon_button_click.jsx +13 -0
- data/app/pb_kits/playbook/pb_icon_button/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_icon_button/docs/index.js +1 -0
- 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_multi_level_select/docs/_multi_level_select_error.html.erb +72 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_error.jsx +97 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_label.html.erb +71 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_label.jsx +91 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/example.yml +4 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +3 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default.html.erb +1 -1
- 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.jsx +50 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless_react.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating.jsx +59 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating_react.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_table/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_disabled.html.erb +19 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_disabled.jsx +23 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_highlight.jsx +4 -4
- data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_user/docs/_user_font_options.html.erb +22 -0
- data/app/pb_kits/playbook/pb_user/docs/_user_font_options.jsx +40 -0
- data/app/pb_kits/playbook/pb_user/docs/_user_font_options_rails.md +5 -0
- data/app/pb_kits/playbook/pb_user/docs/_user_font_options_react.md +5 -0
- data/app/pb_kits/playbook/pb_user/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_user/docs/index.js +1 -0
- data/dist/playbook-doc.js +1 -1
- metadata +46 -16
- /data/app/pb_kits/playbook/pb_advanced_table/docs/{_advanced_table_selectable_rows_no_subrows.md → _advanced_table_selectable_rows_no_subrows_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_advanced_table/docs/{_advanced_table_selectable_rows.md → _advanced_table_selectable_rows_react.md} +0 -0
- /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: 812d52324274150f272111494fbd9b2f5e9885235c949b0ae7352e00f8d2b3ef
|
4
|
+
data.tar.gz: 8d1496d8828359b57158693c91f788a905600f42de4c47da98ab8764b23a2a5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 542d0ae1814624cd8fb9b5c64488dc3141e05ca7adfa917ae4a1fed35f504c985e172a42ea194168623db52554d03c3dd5706f5d09b272a098890474c60a9c44
|
7
|
+
data.tar.gz: 529f05e4859528b59a4a8ad471c07889c752cbaa838a8b6f75a71a186087c2800bbdad4208941824320eed91b213daee891e13151521533bb9c09bb94436f997
|
@@ -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.
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<% column_definitions = [
|
2
|
+
{
|
3
|
+
accessor: "year",
|
4
|
+
label: "Year",
|
5
|
+
cellAccessors: ["quarter", "month", "day"],
|
6
|
+
},
|
7
|
+
{
|
8
|
+
accessor: "newEnrollments",
|
9
|
+
label: "New Enrollments",
|
10
|
+
},
|
11
|
+
{
|
12
|
+
accessor: "scheduledMeetings",
|
13
|
+
label: "Scheduled Meetings",
|
14
|
+
},
|
15
|
+
{
|
16
|
+
accessor: "attendanceRate",
|
17
|
+
label: "Attendance Rate",
|
18
|
+
},
|
19
|
+
{
|
20
|
+
accessor: "completedClasses",
|
21
|
+
label: "Completed Classes",
|
22
|
+
},
|
23
|
+
{
|
24
|
+
accessor: "classCompletionRate",
|
25
|
+
label: "Class Completion Rate",
|
26
|
+
},
|
27
|
+
{
|
28
|
+
accessor: "graduatedStudents",
|
29
|
+
label: "Graduated Students",
|
30
|
+
}
|
31
|
+
]
|
32
|
+
|
33
|
+
subrow_headers = ["Quarter", "Month", "Day"]
|
34
|
+
%>
|
35
|
+
|
36
|
+
<%= pb_rails("advanced_table", props: { id: "selectable_rows", table_data: @table_data_with_id, column_definitions: column_definitions, selectable_rows: true }) do %>
|
37
|
+
<%= pb_rails("advanced_table/table_header", props: { column_definitions: column_definitions, selectable_rows: true }) %>
|
38
|
+
<%= pb_rails("advanced_table/table_body", props: { id: "selectable_rows", table_data: @table_data_with_id, column_definitions: column_definitions, subrow_headers: subrow_headers, enable_toggle_expansion: "all", selectable_rows: true }) %>
|
39
|
+
<% end %>
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_no_subrows.html.erb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
<% column_definitions = [
|
2
|
+
{
|
3
|
+
accessor: "year",
|
4
|
+
label: "Year",
|
5
|
+
cellAccessors: ["quarter", "month", "day"],
|
6
|
+
},
|
7
|
+
{
|
8
|
+
accessor: "newEnrollments",
|
9
|
+
label: "New Enrollments",
|
10
|
+
},
|
11
|
+
{
|
12
|
+
accessor: "scheduledMeetings",
|
13
|
+
label: "Scheduled Meetings",
|
14
|
+
},
|
15
|
+
{
|
16
|
+
accessor: "attendanceRate",
|
17
|
+
label: "Attendance Rate",
|
18
|
+
},
|
19
|
+
{
|
20
|
+
accessor: "completedClasses",
|
21
|
+
label: "Completed Classes",
|
22
|
+
},
|
23
|
+
{
|
24
|
+
accessor: "classCompletionRate",
|
25
|
+
label: "Class Completion Rate",
|
26
|
+
},
|
27
|
+
{
|
28
|
+
accessor: "graduatedStudents",
|
29
|
+
label: "Graduated Students",
|
30
|
+
}
|
31
|
+
] %>
|
32
|
+
|
33
|
+
<%= pb_rails("advanced_table", props: { id: "selectable_rows_no_subrows", table_data: @table_data_no_subrows, column_definitions: column_definitions, selectable_rows: true, enable_toggle_expansion: "none", }) %>
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_no_subrows_rails.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
`selectable_rows` can also be used with tables without nested row data. Set `enable_toggle_expansion: none` to adjust the Advanced Table styling to fit a table without subrows.
|
@@ -0,0 +1,6 @@
|
|
1
|
+
`selectable_rows` is a boolean prop that if present will add checkboxes to all rows that will allow for selecting rows.
|
2
|
+
|
3
|
+
When a parent row is clicked, it will check all nested children rows, Children rows can be manually checked or unchecked as well.
|
4
|
+
|
5
|
+
__ALERT TO DEVS__: UPDATE THIS PARAGRAPH IN THE FOLLOW UP STORY WHEN CHECKBOX FUNCTIONALITY IS SET PLEASE
|
6
|
+
The `onRowSelectionChange` prop returns an array of ids of all Rows that have been selected. Open the console on this example and check and uncheck checkboxes to see this is action! __NOTE__: Each object within the `tableData`Array must contain a unique id in order to attach an id to all Rows for this to function.
|
@@ -11,6 +11,8 @@ examples:
|
|
11
11
|
- advanced_table_custom_cell_rails: Custom Components for Cells
|
12
12
|
- advanced_table_column_headers: Multi-Header Columns
|
13
13
|
- advanced_table_column_headers_multiple: Multi-Header Columns (Multiple Levels)
|
14
|
+
# - advanced_table_selectable_rows: Selectable Rows
|
15
|
+
# - advanced_table_selectable_rows_no_subrows: Selectable Rows (No Subrows)
|
14
16
|
|
15
17
|
|
16
18
|
react:
|
@@ -37,4 +39,5 @@ examples:
|
|
37
39
|
- advanced_table_selectable_rows_no_subrows: Selectable Rows (No Subrows)
|
38
40
|
- advanced_table_selectable_rows_actions: Selectable Rows (With Actions)
|
39
41
|
- advanced_table_selectable_rows_header: Selectable Rows (No Actions Bar)
|
40
|
-
- 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'
|
@@ -4,14 +4,3 @@
|
|
4
4
|
inline: true,
|
5
5
|
picker_id: "date-picker-inline"
|
6
6
|
}) %>
|
7
|
-
|
8
|
-
<%= javascript_tag do %>
|
9
|
-
window.addEventListener("DOMContentLoaded", (event) => {
|
10
|
-
const fpInline = document.querySelector("#date-picker-inline")._flatpickr
|
11
|
-
<!-- Display the angle-down icon when a date has been selected -->
|
12
|
-
const showAngleDownHandler = () => {
|
13
|
-
document.querySelector('.inline-date-picker').classList.add('show-angle-down-icon')
|
14
|
-
}
|
15
|
-
fpInline.config.onChange.push(showAngleDownHandler)
|
16
|
-
})
|
17
|
-
<% end %>
|
@@ -3,19 +3,12 @@ import React from 'react'
|
|
3
3
|
import DatePicker from '../_date_picker'
|
4
4
|
|
5
5
|
const DatePickerInline = (props) => {
|
6
|
-
const showAngleDownHandler = (dateSelected) => {
|
7
|
-
if (dateSelected) {
|
8
|
-
document.querySelector('.inline-date-picker').classList.add('show-angle-down-icon')
|
9
|
-
}
|
10
|
-
}
|
11
|
-
|
12
6
|
return (
|
13
7
|
<div>
|
14
8
|
<DatePicker
|
15
9
|
className="inline-date-picker"
|
16
10
|
hideIcon
|
17
11
|
inLine
|
18
|
-
onChange={showAngleDownHandler}
|
19
12
|
pickerId="date-picker-inline"
|
20
13
|
{...props}
|
21
14
|
/>
|
@@ -0,0 +1,181 @@
|
|
1
|
+
import React, { useState } from "react";
|
2
|
+
import Body from '../../pb_body/_body'
|
3
|
+
import Flex from '../../pb_flex/_flex'
|
4
|
+
import FlexItem from '../../pb_flex/_flex_item'
|
5
|
+
import Card from '../../pb_card/_card'
|
6
|
+
import Caption from '../../pb_caption/_caption'
|
7
|
+
import Draggable from '../../pb_draggable/_draggable'
|
8
|
+
import { DraggableProvider } from '../../pb_draggable/context'
|
9
|
+
|
10
|
+
// Initial items to be dragged
|
11
|
+
const dataShadow = [
|
12
|
+
{
|
13
|
+
id: "51",
|
14
|
+
text: "Task 1",
|
15
|
+
},
|
16
|
+
{
|
17
|
+
id: "52",
|
18
|
+
text: "Task 2",
|
19
|
+
},
|
20
|
+
{
|
21
|
+
id: "53",
|
22
|
+
text: "Task 3",
|
23
|
+
},
|
24
|
+
];
|
25
|
+
|
26
|
+
const dataOutline = [
|
27
|
+
{
|
28
|
+
id: "61",
|
29
|
+
text: "Task 1",
|
30
|
+
},
|
31
|
+
{
|
32
|
+
id: "62",
|
33
|
+
text: "Task 2",
|
34
|
+
},
|
35
|
+
{
|
36
|
+
id: "63",
|
37
|
+
text: "Task 3",
|
38
|
+
},
|
39
|
+
];
|
40
|
+
|
41
|
+
const dataLine = [
|
42
|
+
{
|
43
|
+
id: "71",
|
44
|
+
text: "Task 1",
|
45
|
+
},
|
46
|
+
{
|
47
|
+
id: "72",
|
48
|
+
text: "Task 2",
|
49
|
+
},
|
50
|
+
{
|
51
|
+
id: "73",
|
52
|
+
text: "Task 3",
|
53
|
+
},
|
54
|
+
];
|
55
|
+
|
56
|
+
const DraggableDropZones = (props) => {
|
57
|
+
const [initialShadowState, setInitialShadowState] = useState(dataShadow);
|
58
|
+
const [initialOutlineState, setInitialOutlineState] = useState(dataOutline);
|
59
|
+
const [initialLineState, setInitialLineState] = useState(dataLine);
|
60
|
+
|
61
|
+
return (
|
62
|
+
<>
|
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
|
+
text="Shadow"
|
75
|
+
textAlign="center"
|
76
|
+
/>
|
77
|
+
<Draggable.Container
|
78
|
+
htmlOptions={{style:{ width: "200px"}}}
|
79
|
+
{...props}
|
80
|
+
>
|
81
|
+
{initialShadowState.map(({ id, text }) => (
|
82
|
+
<Card dragId={id}
|
83
|
+
draggableItem
|
84
|
+
key={id}
|
85
|
+
marginBottom="xs"
|
86
|
+
padding="xs"
|
87
|
+
{...props}
|
88
|
+
>
|
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
|
109
|
+
marginBottom="xs"
|
110
|
+
text="Outline"
|
111
|
+
textAlign="center"
|
112
|
+
/>
|
113
|
+
<Draggable.Container
|
114
|
+
htmlOptions={{style:{ width: "200px"}}}
|
115
|
+
{...props}
|
116
|
+
>
|
117
|
+
{initialOutlineState.map(({ id, text }) => (
|
118
|
+
<Card
|
119
|
+
dragId={id}
|
120
|
+
draggableItem
|
121
|
+
key={id}
|
122
|
+
marginBottom="xs"
|
123
|
+
padding="xs"
|
124
|
+
{...props}
|
125
|
+
>
|
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
|
147
|
+
marginBottom="xs"
|
148
|
+
text="Line"
|
149
|
+
textAlign="center"
|
150
|
+
/>
|
151
|
+
<Draggable.Container
|
152
|
+
htmlOptions={{style:{ width: "200px"}}}
|
153
|
+
{...props}
|
154
|
+
>
|
155
|
+
{initialLineState.map(({ id, text }) => (
|
156
|
+
<Card dragId={id}
|
157
|
+
draggableItem
|
158
|
+
key={id}
|
159
|
+
marginBottom="xs"
|
160
|
+
padding="xs"
|
161
|
+
{...props}
|
162
|
+
>
|
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>
|
177
|
+
</>
|
178
|
+
);
|
179
|
+
};
|
180
|
+
|
181
|
+
export default DraggableDropZones;
|
@@ -0,0 +1,5 @@
|
|
1
|
+
The Draggable kit lets you customize the style of drop zones that appear when dragging an item.
|
2
|
+
|
3
|
+
By default, drop zones are in the "ghost" style, but you can also choose from "shadow," "outline," and "line."
|
4
|
+
|
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).
|
@@ -0,0 +1,99 @@
|
|
1
|
+
import React, { useState } from "react";
|
2
|
+
|
3
|
+
import Flex from '../../pb_flex/_flex'
|
4
|
+
import Image from '../../pb_image/_image'
|
5
|
+
import Caption from '../../pb_caption/_caption'
|
6
|
+
import Draggable from '../../pb_draggable/_draggable'
|
7
|
+
import { DraggableProvider } from '../../pb_draggable/context'
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
// Initial items to be dragged
|
12
|
+
const dataPrimary = [
|
13
|
+
{
|
14
|
+
id: "81",
|
15
|
+
url: "https://unsplash.it/500/400/?image=633",
|
16
|
+
},
|
17
|
+
{
|
18
|
+
id: "82",
|
19
|
+
url: "https://unsplash.it/500/400/?image=634",
|
20
|
+
},
|
21
|
+
{
|
22
|
+
id: "83",
|
23
|
+
url: "https://unsplash.it/500/400/?image=637",
|
24
|
+
},
|
25
|
+
];
|
26
|
+
const dataPurple = [
|
27
|
+
{
|
28
|
+
id: "91",
|
29
|
+
url: "https://unsplash.it/500/400/?image=633",
|
30
|
+
},
|
31
|
+
{
|
32
|
+
id: "92",
|
33
|
+
url: "https://unsplash.it/500/400/?image=634",
|
34
|
+
},
|
35
|
+
{
|
36
|
+
id: "93",
|
37
|
+
url: "https://unsplash.it/500/400/?image=637",
|
38
|
+
},
|
39
|
+
];
|
40
|
+
|
41
|
+
const DraggableDropZonesColors = (props) => {
|
42
|
+
const [initialPrimaryState, setInitialPrimaryState] = useState(dataPrimary);
|
43
|
+
const [initialPurpleState, setInitialPurpleState] = useState(dataPurple);
|
44
|
+
|
45
|
+
return (
|
46
|
+
<>
|
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>
|
95
|
+
</>
|
96
|
+
);
|
97
|
+
};
|
98
|
+
|
99
|
+
export default DraggableDropZonesColors;
|
@@ -0,0 +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.
|