playbook_ui 14.13.0.pre.rc.10 → 14.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +63 -1
  3. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +3 -0
  4. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.jsx +1 -0
  5. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_react.md +3 -1
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header.jsx +55 -0
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_react.md +3 -0
  8. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +1 -0
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +2 -1
  10. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers_rails.html.erb +99 -0
  11. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers_rails.md +1 -0
  12. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table.html.erb +61 -0
  13. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table.md +1 -0
  14. data/app/pb_kits/playbook/pb_draggable/docs/example.yml +2 -5
  15. data/app/pb_kits/playbook/pb_draggable/draggable_container.html.erb +2 -2
  16. data/app/pb_kits/playbook/pb_draggable/draggable_container.rb +5 -0
  17. data/app/pb_kits/playbook/pb_draggable/draggable_item.html.erb +1 -1
  18. data/app/pb_kits/playbook/pb_draggable/draggable_item.rb +4 -0
  19. data/app/pb_kits/playbook/pb_draggable/index.js +151 -15
  20. data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.tsx +11 -7
  21. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_formatting.html.erb +11 -0
  22. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_formatting.jsx +22 -0
  23. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_formatting_rails.md +1 -0
  24. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_formatting_react.md +1 -0
  25. data/app/pb_kits/playbook/pb_home_address_street/docs/example.yml +2 -0
  26. data/app/pb_kits/playbook/pb_home_address_street/docs/index.js +1 -0
  27. data/app/pb_kits/playbook/pb_home_address_street/home_address_street.rb +13 -2
  28. data/app/pb_kits/playbook/pb_icon/icon.html.erb +2 -6
  29. data/app/pb_kits/playbook/pb_layout/body.html.erb +1 -5
  30. data/app/pb_kits/playbook/pb_layout/footer.html.erb +1 -5
  31. data/app/pb_kits/playbook/pb_layout/header.html.erb +1 -5
  32. data/app/pb_kits/playbook/pb_layout/item.html.erb +1 -5
  33. data/app/pb_kits/playbook/pb_layout/layout.html.erb +1 -5
  34. data/app/pb_kits/playbook/pb_layout/sidebar.html.erb +1 -5
  35. data/app/pb_kits/playbook/pb_legend/legend.html.erb +1 -6
  36. data/app/pb_kits/playbook/pb_message/message.html.erb +1 -6
  37. data/app/pb_kits/playbook/pb_message/message_mention.html.erb +1 -6
  38. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_mask.html.erb +1 -1
  39. data/app/pb_kits/playbook/pb_text_input/index.js +52 -83
  40. data/dist/chunks/{_typeahead-CkemExmL.js → _typeahead-btjo1UN5.js} +2 -2
  41. data/dist/chunks/_weekday_stacked-DeYS_l8v.js +45 -0
  42. data/dist/chunks/lazysizes-DHz07jlL.js +1 -0
  43. data/dist/chunks/vendor.js +1 -1
  44. data/dist/playbook-doc.js +1 -1
  45. data/dist/playbook-rails-react-bindings.js +1 -1
  46. data/dist/playbook-rails.js +1 -1
  47. data/dist/playbook.css +1 -1
  48. data/lib/playbook/version.rb +1 -1
  49. metadata +15 -5
  50. data/dist/chunks/_weekday_stacked-CtSzPEH0.js +0 -45
  51. data/dist/chunks/lazysizes-B7xYodB-.js +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b51f1c881060167e01a088b476babf5ef1f7945d615a11b2ab42232ed523be31
4
- data.tar.gz: e96163707d912e393e33c9d8df1d137eae66bd293cedb7bcfbffe99ffb79b322
3
+ metadata.gz: 9102ccc4628ffdcfe66481149e1d6bc36ae57b8c5eaab1186e3281f7ec462029
4
+ data.tar.gz: 647c9ed65a7182ba1592f97349f36dd263300ad9d6443830e9691921db4fb6f8
5
5
  SHA512:
6
- metadata.gz: 1de0cccfcbfbb4a1d5af31b364825a6c7cd436e1b844591c20b0c354d8ed309b1f663c3baa2005fc36f557439f0811d3f9b150934f4caeb32d87e32b50e0db54
7
- data.tar.gz: e46b2e0e84024f530fa3e94879fd7799e5b52ea9ddb00a95531e69bd054674c40fc506769b664180a0f14186b68ae03123c65d97eebd25683b654b5fd8629e0b
6
+ metadata.gz: cb571ceb68a7a1301e0c500729836e014c022a55b90f10beade65779f0eff9f3fc5351f19291a29f80c5b489da9fc2e75dacc7d3dca8cfcb4e68760dc5958776
7
+ data.tar.gz: 9803d6b09280ddf9bc7f53fe460fdf8c5135d4cfa0d89bcaa31d578f2ef49cffb800744b544ddef01e24854c94fc45b7efa5e282c8f9398151c65b9f961c6177
@@ -93,6 +93,43 @@
93
93
  color: $primary !important;
94
94
  }
95
95
 
96
+ // Sticky Header
97
+ .sticky-header {
98
+ thead {
99
+ z-index: 3 !important;
100
+ }
101
+ }
102
+
103
+ // Max height overflow - the below prevents expansion from overflowing container at full screen for responsive and nonresponsive tables
104
+ &.advanced-table-max-height-xs {
105
+ max-height: 320px;
106
+ overflow-y: auto;
107
+ }
108
+ &.advanced-table-max-height-sm {
109
+ max-height: 480px;
110
+ overflow-y: auto;
111
+ }
112
+ &.advanced-table-max-height-md {
113
+ max-height: 768px;
114
+ overflow-y: auto;
115
+ }
116
+ &.advanced-table-max-height-lg {
117
+ max-height: 1024px;
118
+ overflow-y: auto;
119
+ }
120
+ &.advanced-table-max-height-xl {
121
+ max-height: 1280px;
122
+ overflow-y: auto;
123
+ }
124
+ &.advanced-table-max-height-xxl {
125
+ max-height: 1440px;
126
+ overflow-y: auto;
127
+ }
128
+ &.advanced-table-max-height-xxxl {
129
+ max-height: 1920px;
130
+ overflow-y: auto;
131
+ }
132
+
96
133
  // Icons
97
134
  .button-icon {
98
135
  display: flex;
@@ -214,7 +251,24 @@
214
251
  .bg-white td:first-child {
215
252
  background-color: $white;
216
253
  }
217
-
254
+ .row-selection-actions-card {
255
+ border-right-width: 0px;
256
+ border-left-width: 0px;
257
+ position: sticky;
258
+ top: 0;
259
+ left: 0;
260
+ border-radius: unset;
261
+ }
262
+ .checkbox-cell {
263
+ display: table-cell !important;
264
+ }
265
+ .sticky-header {
266
+ thead {
267
+ th:first-child {
268
+ box-shadow: 1px 0 10px -2px $border_light !important;
269
+ }
270
+ }
271
+ }
218
272
  }
219
273
  }
220
274
  @media only screen and (min-width: $screen-xl-min) {
@@ -302,6 +356,14 @@
302
356
  .bg-white td:first-child {
303
357
  background-color: $bg_dark_card;
304
358
  }
359
+ .sticky-header {
360
+ thead {
361
+ th:first-child {
362
+ background: $bg_dark;
363
+ box-shadow: 1px 0 10px -2px $border_dark !important;
364
+ }
365
+ }
366
+ }
305
367
  }
306
368
  }
307
369
  }
@@ -49,6 +49,7 @@ type AdvancedTableProps = {
49
49
  initialLoadingRowsCount?: number
50
50
  inlineRowLoading?: boolean
51
51
  loading?: boolean | string
52
+ maxHeight?: "auto" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl" | "xxxl"
52
53
  onRowToggleClick?: (arg: Row<GenericObject>) => void
53
54
  onToggleExpansionClick?: (arg: Row<GenericObject>) => void
54
55
  pagination?: boolean,
@@ -80,6 +81,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
80
81
  initialLoadingRowsCount = 10,
81
82
  inlineRowLoading = false,
82
83
  loading,
84
+ maxHeight,
83
85
  onRowToggleClick,
84
86
  onToggleExpansionClick,
85
87
  pagination = false,
@@ -289,6 +291,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
289
291
  const classes = classnames(
290
292
  buildCss("pb_advanced_table"),
291
293
  `advanced-table-responsive-${responsive}`,
294
+ maxHeight ? `advanced-table-max-height-${maxHeight}` : '', // max height as kit prop not global prop to control overflow-y
292
295
  globalProps(props),
293
296
  className
294
297
  )
@@ -44,6 +44,7 @@ const AdvancedTableTableProps = (props) => {
44
44
  <div>
45
45
  <AdvancedTable
46
46
  columnDefinitions={columnDefinitions}
47
+ responsive="none"
47
48
  tableData={MOCK_DATA}
48
49
  tableProps={tableProps}
49
50
  {...props}
@@ -1 +1,3 @@
1
- This kit uses the [Table kit](https://playbook.powerapp.cloud/kits/table/react) under the hood which comes with it's own set of props. If you want to apply certain Table props to that underlying kit, you can do so by using the optional `tableProps` prop. This prop must be an object that contains valid Table props. For a full list of Table props, see [here](https://playbook.powerapp.cloud/kits/table/react).
1
+ This kit uses the [Table kit](https://playbook.powerapp.cloud/kits/table/react) under the hood which comes with it's own set of props. If you want to apply certain Table props to that underlying kit, you can do so by using the optional `tableProps` prop. This prop must be an object that contains valid Table props. For a full list of Table props, see [here](https://playbook.powerapp.cloud/kits/table/react).
2
+
3
+ This doc example showcases how to set a sticky header for a nonresponsive table. To achieve sticky header AND responsive functionality, see the ["Table Props Sticky Header"](https://playbook.powerapp.cloud/kits/advanced_table/react#table-props-sticky-header) doc example below.
@@ -0,0 +1,55 @@
1
+ import React from "react"
2
+ import { AdvancedTable } from "playbook-ui"
3
+ import MOCK_DATA from "./advanced_table_mock_data.json"
4
+
5
+ const AdvancedTableTablePropsStickyHeader = (props) => {
6
+ const columnDefinitions = [
7
+ {
8
+ accessor: "year",
9
+ label: "Year",
10
+ cellAccessors: ["quarter", "month", "day"],
11
+ },
12
+ {
13
+ accessor: "newEnrollments",
14
+ label: "New Enrollments",
15
+ },
16
+ {
17
+ accessor: "scheduledMeetings",
18
+ label: "Scheduled Meetings",
19
+ },
20
+ {
21
+ accessor: "attendanceRate",
22
+ label: "Attendance Rate",
23
+ },
24
+ {
25
+ accessor: "completedClasses",
26
+ label: "Completed Classes",
27
+ },
28
+ {
29
+ accessor: "classCompletionRate",
30
+ label: "Class Completion Rate",
31
+ },
32
+ {
33
+ accessor: "graduatedStudents",
34
+ label: "Graduated Students",
35
+ },
36
+ ]
37
+
38
+ const tableProps = {
39
+ sticky: true
40
+ }
41
+
42
+ return (
43
+ <div>
44
+ <AdvancedTable
45
+ columnDefinitions={columnDefinitions}
46
+ maxHeight="xs"
47
+ tableData={MOCK_DATA}
48
+ tableProps={tableProps}
49
+ {...props}
50
+ />
51
+ </div>
52
+ )
53
+ }
54
+
55
+ export default AdvancedTableTablePropsStickyHeader
@@ -0,0 +1,3 @@
1
+ Create a sticky header that works for responsive Advanced Tables by setting `sticky: true` via `tableProps` and giving the AdvancedTable a `maxHeight` using our [Max Height](https://playbook.powerapp.cloud/visual_guidelines/max_height) global prop. This behavior requires a `maxHeight` to work. The header is sticky within the table container, allowing for it to work along with the first column stickiness of a responsive table on smaller screen sizes.
2
+
3
+ A sticky header on a nonresponsive table is demonstrated in the ["Table Props"](https://playbook.powerapp.cloud/kits/advanced_table/react#table-props) doc example above.
@@ -22,6 +22,7 @@ examples:
22
22
  - advanced_table_collapsible_trail: Collapsible Trail
23
23
  - advanced_table_table_options: Table Options
24
24
  - advanced_table_table_props: Table Props
25
+ - advanced_table_table_props_sticky_header: Table Props Sticky Header
25
26
  - advanced_table_inline_row_loading: Inline Row Loading
26
27
  - advanced_table_responsive: Responsive Tables
27
28
  - advanced_table_custom_cell: Custom Components for Cells
@@ -18,4 +18,5 @@ export { default as AdvancedTableSelectableRows } from './_advanced_table_select
18
18
  export { default as AdvancedTableSelectableRowsNoSubrows } from './_advanced_table_selectable_rows_no_subrows.jsx'
19
19
  export { default as AdvancedTableNoSubrows } from './_advanced_table_no_subrows.jsx'
20
20
  export { default as AdvancedTableSelectableRowsHeader } from './_advanced_table_selectable_rows_header.jsx'
21
- export { default as AdvancedTableSelectableRowsActions } from './_advanced_table_selectable_rows_actions.jsx'
21
+ export { default as AdvancedTableSelectableRowsActions } from './_advanced_table_selectable_rows_actions.jsx'
22
+ export { default as AdvancedTableTablePropsStickyHeader } from './_advanced_table_table_props_sticky_header.jsx'
@@ -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.
@@ -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.
@@ -1,18 +1,15 @@
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
-
11
8
  rails:
12
9
  - draggable_default_rails: Default
13
10
  - draggable_with_list_rails: Draggable with List Kit
14
11
  - draggable_with_selectable_list_rails: Draggable with SelectableList Kit
15
12
  - draggable_with_cards_rails: Draggable with Cards
13
+ - draggable_with_table: Draggable with Table
14
+ - draggable_multiple_containers_rails: Dragging Across Multiple Containers
16
15
 
17
-
18
-
@@ -1,3 +1,3 @@
1
- <%= pb_content_tag do %>
1
+ <%= pb_content_tag(object.tag) do %>
2
2
  <%= content.presence %>
3
- <% end %>
3
+ <% end %>
@@ -3,6 +3,11 @@
3
3
  module Playbook
4
4
  module PbDraggable
5
5
  class DraggableContainer < ::Playbook::KitBase
6
+ prop :tag, type: Playbook::Props::String,
7
+ default: "div"
8
+ prop :container, type: Playbook::Props::String,
9
+ default: ""
10
+
6
11
  def data
7
12
  Hash(prop(:data)).merge(pb_draggable_container: true)
8
13
  end
@@ -1,4 +1,4 @@
1
- <%= pb_content_tag(:div, {
1
+ <%= pb_content_tag(object.tag, {
2
2
  id: "item_#{object.drag_id}",
3
3
  draggable: true
4
4
  }) do %>
@@ -5,6 +5,10 @@ module Playbook
5
5
  class DraggableItem < ::Playbook::KitBase
6
6
  prop :drag_id, type: Playbook::Props::String,
7
7
  default: ""
8
+ prop :tag, type: Playbook::Props::String,
9
+ default: "div"
10
+ prop :container, type: Playbook::Props::String,
11
+ default: ""
8
12
 
9
13
  def data
10
14
  Hash(prop(:data)).merge(pb_draggable_item: true)