playbook_ui_docs 14.13.0.pre.alpha.PBNTR5596084 → 14.13.0.pre.alpha.PLAY1873rails86087
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/docs/_draggable_with_table.html.erb +2 -2
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table.md +1 -4
- data/app/pb_kits/playbook/pb_draggable/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_draggable/docs/index.js +1 -2
- data/dist/playbook-doc.js +1 -1
- metadata +1 -3
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table_react.jsx +0 -90
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table_react.md +0 -5
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: playbook_ui_docs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 14.13.0.pre.alpha.
|
4
|
+
version: 14.13.0.pre.alpha.PLAY1873rails86087
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Power UX
|
@@ -716,8 +716,6 @@ files:
|
|
716
716
|
- app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list_rails.md
|
717
717
|
- app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table.html.erb
|
718
718
|
- app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table.md
|
719
|
-
- app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table_react.jsx
|
720
|
-
- app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table_react.md
|
721
719
|
- app/pb_kits/playbook/pb_draggable/docs/example.yml
|
722
720
|
- app/pb_kits/playbook/pb_draggable/docs/index.js
|
723
721
|
- app/pb_kits/playbook/pb_drawer/docs/_drawer_behavior.jsx
|
@@ -1,90 +0,0 @@
|
|
1
|
-
import React, { useState } from "react";
|
2
|
-
import { Flex, Table, Body, Avatar, DraggableProvider } from "playbook-ui";
|
3
|
-
|
4
|
-
// Initial items to be dragged
|
5
|
-
const data = [
|
6
|
-
{
|
7
|
-
id: "1",
|
8
|
-
task: "Task 1",
|
9
|
-
assignee_name: "Terry Miles",
|
10
|
-
assignee_img: "https://randomuser.me/api/portraits/men/44.jpg",
|
11
|
-
},
|
12
|
-
{
|
13
|
-
id: "2",
|
14
|
-
task: "Task 2",
|
15
|
-
assignee_name: "Sophia Miles",
|
16
|
-
assignee_img: "https://randomuser.me/api/portraits/women/8.jpg",
|
17
|
-
},
|
18
|
-
{
|
19
|
-
id: "3",
|
20
|
-
task: "Task 3",
|
21
|
-
assignee_name: "Alice Jones",
|
22
|
-
assignee_img: "https://randomuser.me/api/portraits/women/10.jpg",
|
23
|
-
},
|
24
|
-
{
|
25
|
-
id: "4",
|
26
|
-
task: "Task 4",
|
27
|
-
assignee_name: "Mike James",
|
28
|
-
assignee_img: "https://randomuser.me/api/portraits/men/8.jpg",
|
29
|
-
},
|
30
|
-
{
|
31
|
-
id: "5",
|
32
|
-
task: "Task 5",
|
33
|
-
assignee_name: "James Guy",
|
34
|
-
assignee_img: "https://randomuser.me/api/portraits/men/18.jpg",
|
35
|
-
}
|
36
|
-
];
|
37
|
-
|
38
|
-
const DraggableWithTableReact = (props) => {
|
39
|
-
const [initialState, setInitialState] = useState(data);
|
40
|
-
|
41
|
-
return (
|
42
|
-
<>
|
43
|
-
<DraggableProvider initialItems={data}
|
44
|
-
onReorder={(items) => setInitialState(items)}
|
45
|
-
>
|
46
|
-
<Table
|
47
|
-
responsive="none"
|
48
|
-
size="sm"
|
49
|
-
{...props}
|
50
|
-
>
|
51
|
-
<Table.Head>
|
52
|
-
<Table.Row>
|
53
|
-
<Table.Header>{"id"}</Table.Header>
|
54
|
-
<Table.Header>{"name"}</Table.Header>
|
55
|
-
<Table.Header>{"task number"}</Table.Header>
|
56
|
-
</Table.Row>
|
57
|
-
</Table.Head>
|
58
|
-
<Table.Body draggableContainer>
|
59
|
-
{initialState.map(({ id, task, assignee_name, assignee_img }) => (
|
60
|
-
<Table.Row
|
61
|
-
dragId={id}
|
62
|
-
draggableItem
|
63
|
-
key={id}
|
64
|
-
>
|
65
|
-
<Table.Cell>{id}</Table.Cell>
|
66
|
-
<Table.Cell>
|
67
|
-
<Flex align="center">
|
68
|
-
<Avatar
|
69
|
-
imageUrl={assignee_img}
|
70
|
-
size="xs"
|
71
|
-
/>
|
72
|
-
<Body
|
73
|
-
paddingLeft="xxs"
|
74
|
-
text={assignee_name}
|
75
|
-
{...props}
|
76
|
-
/>
|
77
|
-
</Flex>
|
78
|
-
</Table.Cell>
|
79
|
-
<Table.Cell>{task}</Table.Cell>
|
80
|
-
</Table.Row>
|
81
|
-
))}
|
82
|
-
</Table.Body>
|
83
|
-
</Table>
|
84
|
-
</DraggableProvider>
|
85
|
-
</>
|
86
|
-
|
87
|
-
);
|
88
|
-
};
|
89
|
-
|
90
|
-
export default DraggableWithTableReact;
|
@@ -1,5 +0,0 @@
|
|
1
|
-
The draggable kit can also be used in conjunction with the table kit to create draggable table rows. To do this:
|
2
|
-
|
3
|
-
- Wrap the Table with the `DraggableProvider` and manage state as shown.
|
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.
|