playbook_ui_docs 14.12.0.pre.rc.11 → 14.13.0.pre.alpha.PBNTR5596029

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.
Files changed (109) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_loading.html.erb +33 -0
  3. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_loading_rails.md +1 -0
  4. data/app/pb_kits/playbook/pb_advanced_table/docs/{_advanced_table_loading.md → _advanced_table_loading_react.md} +2 -2
  5. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_no_subrows.jsx +50 -0
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination.jsx +1 -0
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_with_props.jsx +1 -0
  8. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_responsive.html.erb +38 -0
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows.jsx +60 -0
  10. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows.md +5 -0
  11. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions.jsx +78 -0
  12. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions.md +1 -0
  13. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_header.jsx +53 -0
  14. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_header.md +1 -0
  15. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_no_subrows.jsx +52 -0
  16. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_no_subrows.md +1 -0
  17. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_control.md +2 -2
  18. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.jsx +1 -0
  19. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_react.md +3 -1
  20. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header.jsx +55 -0
  21. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_react.md +3 -0
  22. data/app/pb_kits/playbook/pb_advanced_table/docs/advanced_table_mock_data_no_subrows.json +42 -0
  23. data/app/pb_kits/playbook/pb_advanced_table/docs/advanced_table_mock_data_with_id.json +299 -0
  24. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +8 -0
  25. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +7 -1
  26. data/app/pb_kits/playbook/pb_avatar/docs/_avatar_badge_component_overlay.jsx +9 -3
  27. data/app/pb_kits/playbook/pb_avatar/docs/_avatar_circle_icon_component_overlay.jsx +6 -2
  28. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_default.html.erb +2 -0
  29. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_default.jsx +21 -0
  30. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_from.html.erb +5 -0
  31. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_from.jsx +45 -0
  32. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_from.md +1 -0
  33. data/app/pb_kits/playbook/pb_copy_button/docs/example.yml +8 -0
  34. data/app/pb_kits/playbook/pb_copy_button/docs/index.js +2 -0
  35. data/app/pb_kits/playbook/pb_date/docs/_date_default.jsx +2 -1
  36. data/app/pb_kits/playbook/pb_date/docs/_date_unstyled.jsx +13 -5
  37. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_turbo_frames.html.erb +13 -0
  38. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_turbo_frames_rails.md +3 -0
  39. data/app/pb_kits/playbook/pb_date_picker/docs/example.yml +1 -0
  40. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers_rails.html.erb +99 -0
  41. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers_rails.md +1 -0
  42. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards_rails.html.erb +1 -3
  43. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards_rails.md +7 -0
  44. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table.html.erb +61 -0
  45. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table.md +1 -0
  46. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table_react.jsx +89 -0
  47. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table_react.md +5 -0
  48. data/app/pb_kits/playbook/pb_draggable/docs/example.yml +4 -5
  49. data/app/pb_kits/playbook/pb_draggable/docs/index.js +2 -1
  50. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_behavior.jsx +38 -0
  51. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_borders.jsx +3 -45
  52. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_breakpoints.jsx +0 -1
  53. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_default.jsx +9 -16
  54. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.jsx +44 -19
  55. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.md +21 -3
  56. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_overlay.jsx +16 -21
  57. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_sizes.jsx +2 -19
  58. data/app/pb_kits/playbook/pb_drawer/docs/example.yml +2 -1
  59. data/app/pb_kits/playbook/pb_drawer/docs/index.js +1 -0
  60. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subtle_variant.md +1 -1
  61. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_auto_close.html.erb +58 -0
  62. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_auto_close_rails.md +3 -0
  63. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/example.yml +1 -0
  64. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_formatting.html.erb +11 -0
  65. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_formatting.jsx +22 -0
  66. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_formatting_rails.md +1 -0
  67. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_formatting_react.md +1 -0
  68. data/app/pb_kits/playbook/pb_home_address_street/docs/example.yml +2 -0
  69. data/app/pb_kits/playbook/pb_home_address_street/docs/index.js +1 -0
  70. data/app/pb_kits/playbook/pb_icon_button/docs/_icon_button_default.html.erb +3 -0
  71. data/app/pb_kits/playbook/pb_icon_button/docs/example.yml +7 -0
  72. data/app/pb_kits/playbook/pb_link/docs/_link_target.html.erb +15 -0
  73. data/app/pb_kits/playbook/pb_link/docs/_link_target.jsx +29 -0
  74. data/app/pb_kits/playbook/pb_link/docs/example.yml +5 -3
  75. data/app/pb_kits/playbook/pb_link/docs/index.js +2 -1
  76. data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_tooltip.html.erb +6 -6
  77. data/app/pb_kits/playbook/pb_radio/docs/_radio_custom_children.jsx +8 -3
  78. data/app/pb_kits/playbook/pb_selectable_icon/docs/_selectable_icon_default.jsx +4 -1
  79. data/app/pb_kits/playbook/pb_selectable_icon/docs/_selectable_icon_single_select.jsx +4 -1
  80. data/app/pb_kits/playbook/pb_table/docs/_table_with_background_kit.html.erb +6 -9
  81. data/app/pb_kits/playbook/pb_table/docs/_table_with_background_kit.jsx +6 -9
  82. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible.html.erb +47 -0
  83. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_rails.md +2 -0
  84. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_content.jsx +12 -8
  85. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_content_rails.html.erb +52 -0
  86. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_content_rails.md +0 -0
  87. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows_rails.html.erb +52 -0
  88. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows_rails.md +3 -0
  89. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table_rails.html.erb +80 -0
  90. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table_rails.md +1 -0
  91. data/app/pb_kits/playbook/pb_table/docs/example.yml +4 -0
  92. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_mask.html.erb +46 -0
  93. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_mask_rails.md +3 -0
  94. data/app/pb_kits/playbook/pb_text_input/docs/example.yml +2 -1
  95. data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_default.html.erb +1 -1
  96. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_truncated_text.html.erb +19 -0
  97. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_truncated_text.jsx +27 -0
  98. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_truncated_text.md +1 -0
  99. data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +2 -0
  100. data/app/pb_kits/playbook/pb_typeahead/docs/index.js +1 -0
  101. data/app/pb_kits/playbook/pb_user/docs/_user_light_weight.html.erb +42 -0
  102. data/app/pb_kits/playbook/pb_user/docs/_user_light_weight.jsx +59 -0
  103. data/app/pb_kits/playbook/pb_user/docs/_user_light_weight.md +2 -0
  104. data/app/pb_kits/playbook/pb_user/docs/example.yml +2 -0
  105. data/app/pb_kits/playbook/pb_user/docs/index.js +1 -0
  106. data/dist/playbook-doc.js +1 -1
  107. metadata +63 -5
  108. /data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/{_fixed_confirmation_toast_auto_close.md → _fixed_confirmation_toast_auto_close_react.md} +0 -0
  109. /data/app/pb_kits/playbook/pb_table/docs/{_table_with_collapsible.md → _table_with_collapsible_react.md} +0 -0
@@ -0,0 +1,99 @@
1
+ <% containers = [
2
+ "To Do",
3
+ "In Progress",
4
+ "Done"
5
+ ] %>
6
+
7
+ <% items_data = [
8
+ {
9
+ id: "11",
10
+ container: "To Do",
11
+ title: "Task 1",
12
+ description: "Bug fixes",
13
+ assignee_name: "Terry Miles",
14
+ assignee_img: "https://randomuser.me/api/portraits/men/44.jpg",
15
+ },
16
+ {
17
+ id: "12",
18
+ container: "To Do",
19
+ title: "Task 2",
20
+ description: "Documentation",
21
+ assignee_name: "Sophia Miles",
22
+ assignee_img: "https://randomuser.me/api/portraits/women/8.jpg",
23
+ },
24
+ {
25
+ id: "13",
26
+ container: "In Progress",
27
+ title: "Task 3",
28
+ description: "Add a variant",
29
+ assignee_name: "Alice Jones",
30
+ assignee_img: "https://randomuser.me/api/portraits/women/10.jpg",
31
+ },
32
+ {
33
+ id: "14",
34
+ container: "To Do",
35
+ title: "Task 4",
36
+ description: "Add jest tests",
37
+ assignee_name: "Mike James",
38
+ assignee_img: "https://randomuser.me/api/portraits/men/8.jpg",
39
+ },
40
+ {
41
+ id: "15",
42
+ container: "Done",
43
+ title: "Task 5",
44
+ description: "Alpha testing",
45
+ assignee_name: "James Guy",
46
+ assignee_img: "https://randomuser.me/api/portraits/men/18.jpg",
47
+ },
48
+ {
49
+ id: "16",
50
+ container: "In Progress",
51
+ title: "Task 6",
52
+ description: "Release",
53
+ assignee_name: "Sally Jones",
54
+ assignee_img: "https://randomuser.me/api/portraits/women/28.jpg",
55
+ },
56
+ ] %>
57
+
58
+ <%= pb_rails("draggable", props: { initial_items: items_data }) do %>
59
+ <%= pb_rails("flex", props: { justify_content: "center" }) do %>
60
+ <% containers.each do |container| %>
61
+ <%= pb_rails("draggable/draggable_container", props: {
62
+ container: container,
63
+ width: "xs",
64
+ padding: "sm",
65
+ data: { container: container }
66
+ }) do %>
67
+ <%= pb_rails("caption", props: { text_align: "center" }) do %><%= container %><% end %>
68
+ <%= pb_rails("flex", props: {align_items: "stretch", orientation: "column"}) do %>
69
+ <% items_data.select { |item| item[:container] == container }.each do |item| %>
70
+ <%= pb_rails("draggable/draggable_item", props: {
71
+ container: container,
72
+ drag_id: item[:id]
73
+ }) do %>
74
+ <%= pb_rails("card", props: { margin_bottom: "sm", padding: "sm"}) do %>
75
+ <%= pb_rails("flex", props: { justify: "between" }) do %>
76
+ <%= pb_rails("flex/flex_item") do %>
77
+ <%= pb_rails("flex") do %>
78
+ <%= pb_rails("avatar", props: {
79
+ image_url: item[:assignee_img],
80
+ name: item[:assignee_name],
81
+ size: "xxs"
82
+ }) %>
83
+ <%= pb_rails("title", props: {
84
+ padding_left: "xs",
85
+ size: 4,
86
+ text: item[:title]
87
+ }) %>
88
+ <% end %>
89
+ <% end %>
90
+ <% end %>
91
+ <%= pb_rails("body", props: { padding_top: "xs", text: item[:description] }) %>
92
+ <% end %>
93
+ <% end %>
94
+ <% end %>
95
+ <% end %>
96
+ <% end %>
97
+ <% end %>
98
+ <% end %>
99
+ <% end %>
@@ -0,0 +1 @@
1
+ The Draggable kit can also be used to achieve more complex, multiple container functionality as shown here. This complex usage requires the full subcomponent structure.
@@ -7,8 +7,7 @@
7
7
  <%= pb_rails("draggable", props: {initial_items: initial_items}) do %>
8
8
  <%= pb_rails("draggable/draggable_container") do %>
9
9
  <% initial_items.each do |item| %>
10
- <%= pb_rails("draggable/draggable_item", props:{drag_id: item[:id]}) do %>
11
- <%= pb_rails("card", props: {highlight: {position: "side", color:"primary"}, margin_bottom: "xs", padding: "xs"}) do %>
10
+ <%= pb_rails("card", props: {highlight: {position: "side", color:"primary"}, margin_bottom: "xs", padding: "xs", drag_id: item[:id], draggable_item: true }) do %>
12
11
  <%= pb_rails("flex", props:{align_items: "stretch", flex_direction:"column"}) do %>
13
12
  <%= pb_rails("flex", props:{gap: "xs"}) do %>
14
13
  <%= pb_rails("title", props: { text: item[:name], tag: "h4", size: 4 }) %>
@@ -32,7 +31,6 @@
32
31
  <% end %>
33
32
  <% end %>
34
33
  <% end %>
35
- <% end %>
36
34
  <% end %>
37
35
  <% end %>
38
36
  <% end %>
@@ -0,0 +1,7 @@
1
+ For a simplified version of the Draggable API for the Card kit, you can do the following:
2
+
3
+ Use the `draggable` kit and manage state as shown.
4
+
5
+ `draggable/draggable_container` kit creates the container within which the cards can be dragged and dropped.
6
+
7
+ The Card kit is optimized to work with the draggable kit. To enable drag, use the `draggable_item` and `drag_id` props on the Card kit as shown. An additional optional boolean prop (set to true by default) of `drag_handle` is also available to show the drag handle icon.
@@ -0,0 +1,61 @@
1
+ <% initial_items = [
2
+ {
3
+ id: "1",
4
+ title: "Task 1",
5
+ assignee_name: "Terry Miles",
6
+ assignee_img: "https://randomuser.me/api/portraits/men/44.jpg",
7
+ },
8
+ {
9
+ id: "2",
10
+ title: "Task 2",
11
+ assignee_name: "Sophia Miles",
12
+ assignee_img: "https://randomuser.me/api/portraits/women/8.jpg",
13
+ },
14
+ {
15
+ id: "3",
16
+ title: "Task 3",
17
+ assignee_name: "Alice Jones",
18
+ assignee_img: "https://randomuser.me/api/portraits/women/10.jpg",
19
+ },
20
+ {
21
+ id: "4",
22
+ title: "Task 4",
23
+ assignee_name: "Mike James",
24
+ assignee_img: "https://randomuser.me/api/portraits/men/8.jpg",
25
+ },
26
+ {
27
+ id: "5",
28
+ title: "Task 5",
29
+ assignee_name: "James Guy",
30
+ assignee_img: "https://randomuser.me/api/portraits/men/18.jpg",
31
+ }
32
+ ] %>
33
+
34
+
35
+
36
+ <%= pb_rails("draggable", props: {initial_items: initial_items}) do %>
37
+ <%= pb_rails("table", props: { size: "sm", responsive:"none" }) do %>
38
+ <%= pb_rails("table/table_head") do %>
39
+ <%= pb_rails("table/table_row") do %>
40
+ <%= pb_rails("table/table_header", props: { text: "id"}) %>
41
+ <%= pb_rails("table/table_header", props: { text: "name"}) %>
42
+ <%= pb_rails("table/table_header", props: { text: "task number"}) %>
43
+ <% end %>
44
+ <% end %>
45
+
46
+ <%= pb_rails("draggable/draggable_container", props: {tag:"tbody"}) do %>
47
+ <% initial_items.each do |item| %>
48
+ <%= pb_rails("draggable/draggable_item", props:{drag_id: item[:id], tag:"tr"}) do %>
49
+ <%= pb_rails("table/table_cell", props: { text: item[:id]}) %>
50
+ <%= pb_rails("table/table_cell") do %>
51
+ <%= pb_rails("flex", props:{align:"center"}) do %>
52
+ <%= pb_rails("avatar", props: {size: "xs", image_url: item[:assignee_img]}) %>
53
+ <%= pb_rails("body", props: {text: item[:assignee_name], padding_left:"sm"}) %>
54
+ <% end %>
55
+ <% end %>
56
+ <%= pb_rails("table/table_cell", props: { text: item[:title]}) %>
57
+ <% end %>
58
+ <% end %>
59
+ <% end %>
60
+ <% end %>
61
+ <% end %>
@@ -0,0 +1 @@
1
+ The draggable kit can also be used in conjunction with the table kit to create draggable table rows. To do this, make use of the `tag` prop on the draggable_container to set it to 'tbody' and the same prop on the draggable_item to set that to 'tr'. This will create the functionality seen here.
@@ -0,0 +1,89 @@
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
+ />
76
+ </Flex>
77
+ </Table.Cell>
78
+ <Table.Cell>{task}</Table.Cell>
79
+ </Table.Row>
80
+ ))}
81
+ </Table.Body>
82
+ </Table>
83
+ </DraggableProvider>
84
+ </>
85
+
86
+ );
87
+ };
88
+
89
+ export default DraggableWithTableReact;
@@ -0,0 +1,5 @@
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.
@@ -1,18 +1,17 @@
1
1
  examples:
2
-
3
-
4
2
  react:
5
3
  - draggable_default: Default
6
4
  - draggable_with_list: Draggable with List Kit
7
5
  - draggable_with_selectable_list: Draggable with SelectableList Kit
8
6
  - draggable_with_cards: Draggable with Cards
9
7
  - draggable_multiple_containers: Dragging Across Multiple Containers
10
-
8
+ - draggable_with_table_react: Draggable with Table
9
+
11
10
  rails:
12
11
  - draggable_default_rails: Default
13
12
  - draggable_with_list_rails: Draggable with List Kit
14
13
  - draggable_with_selectable_list_rails: Draggable with SelectableList Kit
15
14
  - draggable_with_cards_rails: Draggable with Cards
15
+ - draggable_with_table: Draggable with Table
16
+ - draggable_multiple_containers_rails: Dragging Across Multiple Containers
16
17
 
17
-
18
-
@@ -2,4 +2,5 @@ export { default as DraggableDefault } from './_draggable_default.jsx'
2
2
  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
- export { default as DraggableMultipleContainers } from './_draggable_multiple_containers.jsx'
5
+ export { default as DraggableMultipleContainers } from './_draggable_multiple_containers.jsx'
6
+ export { default as DraggableWithTableReact } from './_draggable_with_table_react.jsx'
@@ -0,0 +1,38 @@
1
+ import React, { useState } from "react"
2
+ import { Button, Drawer, Flex } from "playbook-ui"
3
+
4
+ const useDrawer = (visible = false) => {
5
+ const [opened, setOpened] = useState(visible)
6
+ const toggle = () => setOpened(!opened)
7
+
8
+ return [opened, toggle]
9
+ }
10
+
11
+ const DrawerBehavior = () => {
12
+ const [drawerOpen, toggleDrawerOpen] = useDrawer()
13
+
14
+ return (
15
+ <>
16
+ <Flex wrap>
17
+ <Button id='sm'
18
+ marginRight='md'
19
+ onClick={toggleDrawerOpen}
20
+ >
21
+ {"Push Behavior"}
22
+ </Button>
23
+ </Flex>
24
+ <Flex>
25
+ <Drawer
26
+ behavior={"push"}
27
+ onClose={toggleDrawerOpen}
28
+ opened={drawerOpen}
29
+ size={"lg"}
30
+ >
31
+ Test me (Push Behavior)
32
+ </Drawer>
33
+ </Flex>
34
+ </>
35
+ )
36
+ }
37
+
38
+ export default DrawerBehavior
@@ -6,19 +6,15 @@ const DrawerBorders = () => {
6
6
  const [openedBRightDrawer, setOpenedBRightDrawer] = useState(false);
7
7
  const [openedBLeftDrawer, setOpenedBLeftDrawer] = useState(false);
8
8
  const [openedBFullDrawer, setOpenedBFullDrawer] = useState(false);
9
- const [openedBDefaultDrawer, setOpenedBDefaultDrawer] = useState(false);
10
- const [openedBRoundedDrawer, setOpenedBRoundedDrawer] = useState(false);
11
9
 
12
10
  // Toggle functions for each drawer
13
11
  const toggleBRightDrawer = () => setOpenedBRightDrawer(!openedBRightDrawer);
14
12
  const toggleBLeftDrawer = () => setOpenedBLeftDrawer(!openedBLeftDrawer);
15
13
  const toggleBFullDrawer = () => setOpenedBFullDrawer(!openedBFullDrawer);
16
- const toggleBDefaultDrawer = () => setOpenedBDefaultDrawer(!openedBDefaultDrawer);
17
- const toggleBRoundedDrawer = () => setOpenedBRoundedDrawer(!openedBRoundedDrawer);
18
14
 
19
15
  return (
20
16
  <>
21
- <Flex padding="md"
17
+ <Flex
22
18
  wrap
23
19
  >
24
20
  <Button marginRight="md"
@@ -36,23 +32,12 @@ const DrawerBorders = () => {
36
32
  >
37
33
  Drawer with border full
38
34
  </Button>
39
- <Button marginRight="md"
40
- onClick={toggleBDefaultDrawer}
41
- >
42
- Default Drawer
43
- </Button>
44
- <Button marginRight="md"
45
- onClick={toggleBRoundedDrawer}
46
- >
47
- Rounded Drawer
48
- </Button>
49
35
  </Flex>
50
36
 
51
37
  {/* Drawers for each size */}
52
38
  <Drawer
53
39
  behavior="float"
54
40
  border="right"
55
- fullHeight
56
41
  onClose={toggleBRightDrawer}
57
42
  opened={openedBRightDrawer}
58
43
  overlay={false}
@@ -64,11 +49,10 @@ const DrawerBorders = () => {
64
49
  <Drawer
65
50
  behavior="float"
66
51
  border="left"
67
- fullHeight
68
52
  onClose={toggleBLeftDrawer}
69
53
  opened={openedBLeftDrawer}
70
54
  overlay={false}
71
- placement="right"
55
+ placement="left"
72
56
  size="lg"
73
57
  >
74
58
  This is a Drawer with border left
@@ -76,40 +60,14 @@ const DrawerBorders = () => {
76
60
  <Drawer
77
61
  behavior="float"
78
62
  border="full"
79
- fullHeight
80
63
  onClose={toggleBFullDrawer}
81
64
  opened={openedBFullDrawer}
82
65
  overlay={false}
83
- placement="right"
66
+ placement="left"
84
67
  size="lg"
85
68
  >
86
69
  This is a Drawer with border full
87
70
  </Drawer>
88
- <Drawer
89
- behavior="float"
90
- fullHeight
91
- onClose={toggleBDefaultDrawer}
92
- opened={openedBDefaultDrawer}
93
- overlay={false}
94
- placement="right"
95
- size="lg"
96
- >
97
- This is a Default Drawer
98
- </Drawer>
99
- <Drawer
100
- behavior="float"
101
- borderRadius="rounded"
102
- fullHeight
103
- onClose={toggleBRoundedDrawer}
104
- opened={openedBRoundedDrawer}
105
- overlay={false}
106
- placement="right"
107
- size="lg"
108
- >
109
- <div style={{ paddingTop: '100px', paddingLeft: '12px' }}>
110
- This is a Rounded Drawer
111
- </div>
112
- </Drawer>
113
71
  </>
114
72
  );
115
73
  };
@@ -26,7 +26,6 @@ const DrawerBreakpoints = () => {
26
26
  <Drawer
27
27
  behavior={"push"}
28
28
  breakpoint="sm"
29
- fullHeight
30
29
  onClose={toggleSmallDrawer}
31
30
  opened={smallDrawerOpened}
32
31
  overlay={false}
@@ -9,8 +9,8 @@ const useDrawer = (visible = false) => {
9
9
  };
10
10
 
11
11
  const DrawerDefault = () => {
12
- const [headerSeparatorDrawerOpened, toggleHeaderSeparatorDrawer] = useDrawer();
13
- const [bothSeparatorsDrawerOpened, toggleBothSeparatorsDrawer] = useDrawer();
12
+ const [drawerLeftOpen, toggleDrawerLeftOpen] = useDrawer();
13
+ const [drawerRightOpen, toggleDrawerRightOpen ] = useDrawer();
14
14
 
15
15
  return (
16
16
  <>
@@ -18,13 +18,13 @@ const DrawerDefault = () => {
18
18
  <Button
19
19
  id="sm"
20
20
  marginRight="md"
21
- onClick={toggleHeaderSeparatorDrawer}
21
+ onClick={toggleDrawerLeftOpen}
22
22
  >
23
23
  {"Left Drawer"}
24
24
  </Button>
25
25
  <Button
26
26
  marginRight="xl"
27
- onClick={toggleBothSeparatorsDrawer}
27
+ onClick={toggleDrawerRightOpen}
28
28
  >
29
29
  {"Right Drawer"}
30
30
  </Button>
@@ -32,12 +32,8 @@ const DrawerDefault = () => {
32
32
  <Flex>
33
33
  {/* Left Drawer */}
34
34
  <Drawer
35
- behavior={"push"}
36
- fullHeight
37
- onClose={toggleHeaderSeparatorDrawer}
38
- opened={headerSeparatorDrawerOpened}
39
- overlay
40
- placement={"left"}
35
+ onClose={toggleDrawerLeftOpen}
36
+ opened={drawerLeftOpen}
41
37
  size={"lg"}
42
38
  >
43
39
  Test me (Left Drawer)
@@ -45,11 +41,8 @@ const DrawerDefault = () => {
45
41
 
46
42
  {/* Right Drawer */}
47
43
  <Drawer
48
- behavior={"push"}
49
- fullHeight
50
- onClose={toggleBothSeparatorsDrawer}
51
- opened={bothSeparatorsDrawerOpened}
52
- overlay
44
+ onClose={toggleDrawerRightOpen}
45
+ opened={drawerRightOpen}
53
46
  placement={"right"}
54
47
  size={"lg"}
55
48
  >
@@ -60,4 +53,4 @@ const DrawerDefault = () => {
60
53
  );
61
54
  };
62
55
 
63
- export default DrawerDefault;
56
+ export default DrawerDefault;
@@ -1,31 +1,56 @@
1
- import React from "react";
2
- import { Button, Drawer, Icon, Title } from "playbook-ui";
1
+ import React, { useState, useEffect } from "react"
2
+ import { Button, Drawer, Icon, Nav, NavItem } from "playbook-ui"
3
3
 
4
4
  const DrawerMenu = () => {
5
+ const [isSmallScreen, setIsSmallScreen] = useState(false)
6
+
7
+ useEffect(() => {
8
+ const mediaQuery = window.matchMedia("(max-width: 600px)")
9
+ setIsSmallScreen(mediaQuery.matches)
10
+ const handler = (e) => setIsSmallScreen(e.matches)
11
+ mediaQuery.addEventListener('change', handler)
12
+ return () => mediaQuery.removeEventListener('change', handler)
13
+ }, [])
5
14
 
6
15
  return (
7
- <>
8
- <Button id="menuButton"
9
- padding="sm"
16
+ <div>
17
+ <Button id='menuButton'
18
+ padding='xs'
10
19
  >
11
- <Icon icon="bars"
12
- size="3x"
20
+ <Icon icon='bars'
21
+ size='2x'
13
22
  />
14
23
  </Button>
15
24
  <Drawer
16
- behavior="push"
17
- closeBreakpoint="md"
18
- menuButtonID="menuButton"
19
- overlay={false}
20
- placement="left"
21
- size="lg"
25
+ breakpoint="md"
26
+ placement='bottom'
27
+ size='full'
28
+ triggerId='menuButton'
22
29
  withinElement
23
30
  >
24
- <Title paddingBottom="md">A really neat menu</Title>
25
- <Button text="This Button does nothing" />
31
+ <Nav
32
+ highlight={false}
33
+ link='#'
34
+ orientation={isSmallScreen ? 'vertical' : 'horizontal'}
35
+ padding={isSmallScreen ? 'none' : 'sm'}
36
+ >
37
+ <NavItem link='#'
38
+ text='About'
39
+ />
40
+ <NavItem active
41
+ link='#'
42
+ text='Case Studies'
43
+ />
44
+ <NavItem link='#'
45
+ text='Service'
46
+ />
47
+ <NavItem link='#'
48
+ text='Contacts'
49
+ />
50
+ </Nav>
26
51
  </Drawer>
27
- </>
28
- );
29
- };
52
+ </div>
53
+ )
54
+ }
30
55
 
31
- export default DrawerMenu;
56
+ export default DrawerMenu
@@ -1,6 +1,24 @@
1
- Our drawer kit can fulfill your responsive menu needs! Using the `closeBreakpoint` prop you can have the menu close on smaller screens like phones/tablets.
1
+ The Drawer component can be used to create responsive navigation menus and sidebars. It provides flexible options for controlling when and how the drawer appears based on screen size.
2
+
3
+ ### Within Element
4
+ The `withinElement` prop allows you to render the drawer within its parent container:
5
+ - The drawer will be positioned relative to its parent element
6
+ - Useful for creating nested navigation structures
7
+ - This must be used in conjunction with the `triggerId` prop
8
+
9
+ This provides a clean way to create responsive navigation patterns that adapt to different screen sizes while maintaining a consistent user experience.
10
+
11
+ ### Trigger Id
12
+ The `triggerId` prop allows you to connect an element to control the drawer:
13
+ - The specified element will toggle the drawer open/closed
14
+ - The element is automatically hidden when the drawer is opened via breakpoint
15
+ - The element reappears when the drawer is closed via breakpoint
16
+
17
+ ### Breakpoint
18
+ Use the `breakpoint` prop to control when the drawer automatically opens or closes based on screen size. For example, setting `breakpoint="md"` will:
19
+ - Close the drawer on screens smaller than the medium breakpoint (992px)
20
+ - Automatically open the drawer on screens larger than or equal to the medium breakpoint
21
+
2
22
 
3
- Set a menu button with the `menuButtonID` props. When the Drawer is open, the menu button will be hidden. But when your Brakpoint closes the drawer, you can toggle the Drawer open/close with your menu butotn.
4
23
 
5
- Also use the `withinElement` props to have the Drawer open within a specific element, instead of the default behavior of it taking up the entire screen size.
6
24