playbook_ui 14.17.0.pre.rc.1 → 14.17.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.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/Utilities/types.ts +1 -1
  3. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +70 -0
  4. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +83 -2
  5. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +20 -7
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_fullscreen.jsx +90 -0
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_fullscreen.md +3 -0
  8. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +2 -1
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +2 -1
  10. data/app/pb_kits/playbook/pb_collapsible/__snapshots__/collapsible.test.js.snap +14 -7
  11. data/app/pb_kits/playbook/pb_contact/contact.test.js +7 -7
  12. data/app/pb_kits/playbook/pb_date_range_inline/date_range_inline.test.js +2 -2
  13. data/app/pb_kits/playbook/pb_date_range_stacked/date_range_stacked.test.js +1 -1
  14. data/app/pb_kits/playbook/pb_draggable/context/index.tsx +58 -17
  15. data/app/pb_kits/playbook/pb_draggable/draggable.test.jsx +3 -3
  16. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete.jsx +6 -6
  17. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete_and_custom_display.jsx +6 -6
  18. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.jsx +6 -6
  19. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display_rails.html.erb +8 -8
  20. data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +3 -3
  21. data/app/pb_kits/playbook/pb_form_group/_form_group.scss +22 -0
  22. data/app/pb_kits/playbook/pb_icon/icon.test.js +9 -9
  23. data/app/pb_kits/playbook/pb_icon_circle/icon_circle.test.js +1 -1
  24. data/app/pb_kits/playbook/pb_icon_stat_value/icon_stat_value.test.js +1 -1
  25. data/app/pb_kits/playbook/pb_icon_value/icon_value.test.js +1 -1
  26. data/app/pb_kits/playbook/pb_label_value/label_value.test.js +1 -1
  27. data/app/pb_kits/playbook/pb_layout/_layout.scss +58 -0
  28. data/app/pb_kits/playbook/pb_layout/_layout.tsx +20 -7
  29. data/app/pb_kits/playbook/pb_layout/docs/_layout_bracket.jsx +190 -0
  30. data/app/pb_kits/playbook/pb_layout/docs/_layout_bracket.md +5 -0
  31. data/app/pb_kits/playbook/pb_layout/docs/example.yml +1 -0
  32. data/app/pb_kits/playbook/pb_layout/docs/index.js +1 -0
  33. data/app/pb_kits/playbook/pb_layout/layout.test.js +4 -0
  34. data/app/pb_kits/playbook/pb_layout/subcomponents/_game.tsx +90 -0
  35. data/app/pb_kits/playbook/pb_layout/subcomponents/_round.tsx +57 -0
  36. data/app/pb_kits/playbook/pb_link/link.test.jsx +2 -2
  37. data/app/pb_kits/playbook/pb_nav/_nav_item.test.js +5 -3
  38. data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_vertical.md +1 -0
  39. data/app/pb_kits/playbook/pb_stat_change/stat_change.test.js +8 -4
  40. data/app/pb_kits/playbook/pb_table/styles/_striped.scss +3 -3
  41. data/app/pb_kits/playbook/pb_tooltip/tooltip.html.erb +2 -5
  42. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_highlight.jsx +4 -4
  43. data/app/pb_kits/playbook/pb_typeahead/typeahead.html.erb +2 -5
  44. data/app/pb_kits/playbook/pb_user/user.html.erb +1 -6
  45. data/app/pb_kits/playbook/pb_user_badge/user_badge.html.erb +1 -6
  46. data/dist/chunks/{_typeahead-Djo6qCne.js → _typeahead-CPM091Hj.js} +2 -2
  47. data/dist/chunks/_weekday_stacked-BzIANIYX.js +45 -0
  48. data/dist/chunks/lazysizes-DHz07jlL.js +1 -0
  49. data/dist/chunks/lib-Bg2KFzpz.js +29 -0
  50. data/dist/chunks/{pb_form_validation-BvNy9Bd6.js → pb_form_validation-BiHyZedy.js} +1 -1
  51. data/dist/chunks/vendor.js +1 -1
  52. data/dist/playbook-doc.js +1 -1
  53. data/dist/playbook-rails-react-bindings.js +1 -1
  54. data/dist/playbook-rails.js +1 -1
  55. data/dist/playbook.css +1 -1
  56. data/lib/playbook/kit_base.rb +4 -4
  57. data/lib/playbook/version.rb +1 -1
  58. metadata +14 -7
  59. data/dist/chunks/_weekday_stacked-DIIHW0OV.js +0 -45
  60. data/dist/chunks/lazysizes-B7xYodB-.js +0 -1
  61. data/dist/chunks/lib-BGzBzFZX.js +0 -29
@@ -0,0 +1,5 @@
1
+ Use `<Layout.RoundLabel>`, `<Layout.Round>`, and `<Layout.Game>` to make a bracket layout.
2
+
3
+ On mobile devices, `<Layout.RoundLabel>` will display (on desktop these components are hidden) and the bracket will be in one column.
4
+
5
+ Ensure that each `<Layout.Game>` maintains a consistent height for the bracket lines to lay out properly.
@@ -18,4 +18,5 @@ examples:
18
18
  - layout_kanban: Kanban Layout
19
19
  - layout_content: Content Layout
20
20
  - layout_masonry: Masonry Layout
21
+ - layout_bracket: Bracket Layout
21
22
 
@@ -7,4 +7,5 @@ export { default as LayoutKanbanResponsive } from './_layout_kanban_responsive.j
7
7
  export { default as LayoutCollectionDetail } from './_layout_collection_detail.jsx'
8
8
  export { default as LayoutContent } from './_layout_content.jsx'
9
9
  export { default as LayoutMasonry } from './_layout_masonry.jsx'
10
+ export { default as LayoutBracket } from './_layout_bracket.jsx'
10
11
 
@@ -82,6 +82,10 @@ test("render all layout variants", () => {
82
82
  layout: "masonry",
83
83
  expected: "pb_layout_kit_masonry_size_md_left_light",
84
84
  },
85
+ {
86
+ layout: "bracket",
87
+ expected: "pb_layout_kit_bracket",
88
+ },
85
89
  ]
86
90
 
87
91
  testValues.forEach(({ layout, expected }) => {
@@ -0,0 +1,90 @@
1
+ import React from 'react'
2
+ import classnames from 'classnames'
3
+
4
+ import { GlobalProps, globalProps, globalInlineProps } from '../../utilities/globalProps'
5
+
6
+ import Card from '../../pb_card/_card'
7
+ import SectionSeparator from '../../pb_section_separator/_section_separator'
8
+
9
+ type LayoutGameProps = {
10
+ children: React.ReactNode[] | React.ReactNode,
11
+ className?: string,
12
+ numberOfRounds: number,
13
+ numberOfGames: number,
14
+ isOdd: boolean,
15
+ } & GlobalProps
16
+
17
+ // Game component (modeled after Item)
18
+ const Game = (props: LayoutGameProps) => {
19
+ const { children, className, numberOfRounds, numberOfGames, isOdd } = props
20
+ const dynamicInlineProps = globalInlineProps(props)
21
+
22
+ const numberOfChildren = Array.isArray(children) ? children.length : 0
23
+
24
+ const isMultiple = Array.isArray(children)
25
+
26
+ let ratio = 0
27
+ let exponent
28
+ if (numberOfGames > 1) {
29
+ exponent = (numberOfRounds) - Math.log2(numberOfGames) - 1
30
+ ratio = 2 ** exponent
31
+ }
32
+
33
+ if (numberOfChildren === 2) {
34
+ const [firstChild, secondChild] = React.Children.toArray(children)
35
+
36
+ if (React.isValidElement(firstChild) && React.isValidElement(secondChild)) {
37
+ return (
38
+ <div
39
+ className={classnames('layout_game', globalProps(props), className)}
40
+ style={dynamicInlineProps}
41
+ >
42
+ <Card
43
+ marginY="xs"
44
+ padding="none"
45
+ shadow="deep"
46
+ >
47
+ <Card.Body padding="xs">{firstChild}</Card.Body>
48
+ <SectionSeparator />
49
+ <Card.Body padding="xs">{secondChild}</Card.Body>
50
+ </Card>
51
+ {isOdd && numberOfGames > 1 &&
52
+ <div
53
+ className="half_box"
54
+ style={{ height: `calc(${ratio} * 100% + 4px)` }}
55
+ />
56
+ }
57
+ </div>
58
+ )
59
+ }
60
+ }
61
+
62
+ return (
63
+ <div
64
+ className={classnames('layout_game', globalProps(props), className)}
65
+ style={dynamicInlineProps}
66
+ >
67
+ {((!isMultiple && children) || numberOfChildren >= 1 )? (
68
+ children
69
+ ) : (
70
+ <Card
71
+ marginY="xs"
72
+ padding="none"
73
+ shadow="deep"
74
+ >
75
+ <Card.Body padding="xs">To be determined...</Card.Body>
76
+ <SectionSeparator />
77
+ <Card.Body padding="xs">To be determined...</Card.Body>
78
+ </Card>
79
+ )}
80
+ {isOdd && numberOfGames > 1 &&
81
+ <div
82
+ className="half_box"
83
+ style={{ height: `calc(${ratio} * 100% + 4px)` }}
84
+ />
85
+ }
86
+ </div>
87
+ )
88
+ }
89
+
90
+ export default Game
@@ -0,0 +1,57 @@
1
+ import React from 'react'
2
+ import classnames from 'classnames'
3
+
4
+ import { GlobalProps, globalProps, globalInlineProps } from '../../utilities/globalProps'
5
+
6
+ type LayoutRoundLabelProps = {
7
+ children: React.ReactNode[] | React.ReactNode,
8
+ className?: string,
9
+ } & GlobalProps
10
+
11
+ export const RoundLabel = (props: LayoutRoundLabelProps) => {
12
+ const { children, className } = props
13
+ const dynamicInlineProps = globalInlineProps(props)
14
+ return (
15
+ <div
16
+ className={classnames('layout_round_label', className)}
17
+ style={dynamicInlineProps}
18
+ >
19
+ {children}
20
+ </div>
21
+ )
22
+ }
23
+
24
+ type LayoutRoundProps = {
25
+ children: React.ReactNode[] | React.ReactNode,
26
+ className?: string,
27
+ numberOfRounds: number,
28
+ } & GlobalProps
29
+
30
+ export const Round = (props: LayoutRoundProps) => {
31
+ const { children, className, numberOfRounds } = props
32
+ const dynamicInlineProps = globalInlineProps(props)
33
+ const numberOfChildren = Array.isArray(children) ? children.length : 0
34
+
35
+ const childrenWithProps = Array.isArray(children) ? children.map((child, index) =>
36
+ React.isValidElement(child) ? React.cloneElement(child, { numberOfRounds, numberOfGames: numberOfChildren, isOdd: index % 2 === 0, key: `child_${index}` }) : child
37
+ ) : children
38
+
39
+ const rightConnectors = Array.from({ length: numberOfChildren / 2 }, (_, index) => (
40
+ <div
41
+ className="right_connector"
42
+ key={`right_connector_${index}`}
43
+ />
44
+ ))
45
+
46
+ return (
47
+ <>
48
+ <div
49
+ className={classnames('layout_round', globalProps(props), className)}
50
+ style={dynamicInlineProps}
51
+ >
52
+ {childrenWithProps}
53
+ </div>
54
+ <div className="connector_container">{rightConnectors}</div>
55
+ </>
56
+ )
57
+ }
@@ -73,7 +73,7 @@ test('adds icon', () => {
73
73
 
74
74
  const kit = screen.getByTestId('icon-test')
75
75
 
76
- const icon = kit.querySelector('.pb_icon_kit')
76
+ const icon = kit.querySelector('.pb_custom_icon')
77
77
  expect(icon).toBeInTheDocument();
78
78
  })
79
79
 
@@ -87,7 +87,7 @@ test('adds icon right', () => {
87
87
 
88
88
  const kit = screen.getByTestId('icon-right-test')
89
89
 
90
- const icon = kit.querySelector('.pb_icon_kit')
90
+ const icon = kit.querySelector('.pb_custom_icon')
91
91
  expect(icon).toBeInTheDocument();
92
92
  })
93
93
 
@@ -95,11 +95,13 @@ test('should not have a left border', () => {
95
95
  test('should have a right icon', () => {
96
96
  render(<NavDefault iconRight="angle-down" />)
97
97
  const kit = screen.getByTestId(itemTestId)
98
- expect(kit).toContainHTML('<i class="pb_icon_kit far pb_nav_list_item_icon_right fa-fw fa-angle-down" />')
98
+ const icon = kit.querySelector(".pb_custom_icon.pb_nav_list_item_icon_right")
99
+ expect(icon).toBeInTheDocument()
99
100
  })
100
101
 
101
102
  test('should have a left icon', () => {
102
- render(<NavDefault iconLeft="users-class" />)
103
+ render(<NavDefault iconLeft="angle-up" />)
103
104
  const kit = screen.getByTestId(itemTestId)
104
- expect(kit).toContainHTML('<i class="pb_icon_kit far pb_nav_list_item_icon_left fa-fw fa-users-class" />')
105
+ const icon = kit.querySelector(".pb_custom_icon.pb_nav_list_item_icon_left")
106
+ expect(icon).toBeInTheDocument()
105
107
  })
@@ -0,0 +1 @@
1
+ To guarantee the vertical section separator displays properly, please add the `vertical: "stretch"`/`vertical="stretch"` property to the parent container (which is commonly a Flex container). This will stretch the container’s child elements vertically and ensure the section separator appears as expected.
@@ -19,23 +19,27 @@ test('it renders preset icon', () => {
19
19
  render(
20
20
  <StatChange
21
21
  change="increase"
22
+ id="preset-icon"
22
23
  value="28.4"
23
24
  />
24
25
  )
25
26
 
26
- const kit = screen.getByLabelText('arrow-up icon')
27
- expect(kit).toBeTruthy
27
+ const kit = document.querySelector('#preset-icon')
28
+ const icon = kit.querySelector(".pb_custom_icon")
29
+ expect(icon).toBeInTheDocument()
28
30
  })
29
31
 
30
32
  test('it renders custom icon', () => {
31
33
  render(
32
34
  <StatChange
33
35
  icon="chart-line-down"
36
+ id="custom-icon"
34
37
  value={6.1}
35
38
  />
36
39
 
37
40
  )
38
41
 
39
- const kit = screen.getByLabelText('chart-line-down icon')
40
- expect(kit).toBeTruthy
42
+ const kit = document.querySelector('#custom-icon')
43
+ const icon = kit.querySelector(".pb_custom_icon")
44
+ expect(icon).toBeInTheDocument()
41
45
  })
@@ -1,7 +1,7 @@
1
- [class^=pb_table] {
1
+ [class^=pb_table]:not(:has(colgroup)) {
2
2
  &.striped {
3
3
  tbody, .pb_table_tbody {
4
- tr:nth-child(odd), .pb_table_tr:nth-child(odd) {
4
+ tr:nth-child(odd):not(.pb_background_kit), .pb_table_tr:nth-child(odd):not(.pb_background_kit) {
5
5
  background-color: $bg_light;
6
6
  }
7
7
  }
@@ -10,7 +10,7 @@
10
10
  &.dark {
11
11
  &.striped {
12
12
  tbody, .pb_table_tbody {
13
- tr:nth-child(odd), .pb_table_tr:nth-child(odd) {
13
+ tr:nth-child(odd):not(.pb_background_kit), .pb_table_tr:nth-child(odd):not(.pb_background_kit) {
14
14
  background-color: $bg_dark;
15
15
  }
16
16
  }
@@ -1,11 +1,8 @@
1
- <%= content_tag(:div,
2
- id: object.id,
3
- data: object.data,
4
- class: object.classname,
1
+ <%= pb_content_tag(:div,
5
2
  style: remove_height_properties(combined_html_options[:style]) || "",
6
3
  **combined_html_options.except(:style)) do %>
7
4
  <div class="tooltip_tooltip" id="<%= object.tooltip_id %>" role="tooltip" style="<%= object.height_and_width_helper %>">
8
5
  <%= content.presence %>
9
6
  <div class="arrow" id="<%= object.tooltip_id %>-arrow"></div>
10
7
  </div>
11
- <% end %>
8
+ <% end %>
@@ -18,18 +18,18 @@ const USERS = [
18
18
  territory: "PHL",
19
19
  },
20
20
  {
21
- name: "Jason Cypret",
22
- title: "Vice President of User Experience",
21
+ name: "Carlos Lima",
22
+ title: "Nitro Developer",
23
23
  territory: "PHL",
24
24
  },
25
25
  {
26
26
  name: "Stephen Marshall",
27
- title: "Senior User Experience Engineer",
27
+ title: "Senior Nitro Developer",
28
28
  territory: "PHL",
29
29
  },
30
30
  {
31
31
  name: "Jasper Furniss",
32
- title: "Senior User Experience Engineer",
32
+ title: "Lead User Experience Engineer",
33
33
  territory: "PHL",
34
34
  },
35
35
  ];
@@ -1,11 +1,8 @@
1
1
  <% if object.is_react? %>
2
2
  <%= react_component('Typeahead', object.typeahead_react_options) %>
3
3
  <% else %>
4
- <%= content_tag(:div,
5
- id: object.id,
6
- data: object.data,
7
- class: object.classname + object.inline_class,
8
- **combined_html_options) do %>
4
+ <%= pb_content_tag(:div,
5
+ class: object.classname + object.inline_class) do %>
9
6
  <div class="pb_typeahead_wrapper">
10
7
  <div class="pb_typeahead_loading_indicator" data-pb-typeahead-kit-loading-indicator>
11
8
  <%= pb_rails("icon", props: {
@@ -1,9 +1,4 @@
1
- <%= content_tag(:div,
2
- aria: object.aria,
3
- class: object.classname,
4
- data: object.data,
5
- id: object.id,
6
- **combined_html_options) do %>
1
+ <%= pb_content_tag do %>
7
2
  <% if object.avatar_url.present? || object.avatar %>
8
3
  <%= pb_rails("avatar", props: {
9
4
  name: object.name,
@@ -1,8 +1,3 @@
1
- <%= content_tag(:div,
2
- aria: object.aria,
3
- class: object.classname,
4
- data: object.data,
5
- id: object.id,
6
- **combined_html_options) do %>
1
+ <%= pb_content_tag do %>
7
2
  <%= content_tag(:div, object.display_badge, class: "pb_user_badge_wrapper") %>
8
3
  <% end %>