playbook_ui 14.17.0 → 14.18.0.pre.alpha.PLAY20787400

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 (189) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +23 -3
  3. data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +67 -3
  4. data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableActions.ts +1 -2
  5. data/app/pb_kits/playbook/pb_advanced_table/Utilities/ExpansionControlHelpers.tsx +29 -19
  6. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +67 -128
  7. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +9 -0
  8. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expand_by_depth.jsx +66 -0
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expand_by_depth.md +10 -0
  10. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_columns.jsx +58 -0
  11. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_columns.md +6 -0
  12. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_columns_and_header.jsx +64 -0
  13. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_columns_and_header.md +8 -0
  14. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header.jsx +55 -0
  15. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header.md +3 -0
  16. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header_rails.html.erb +33 -0
  17. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header_rails.md +3 -0
  18. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.html.erb +1 -1
  19. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.jsx +1 -2
  20. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_rails.md +2 -2
  21. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_react.md +1 -1
  22. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_rails.md +6 -2
  23. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_react.md +6 -2
  24. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +7 -2
  25. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +5 -1
  26. data/app/pb_kits/playbook/pb_advanced_table/index.js +7 -0
  27. data/app/pb_kits/playbook/pb_advanced_table/scss_partials/advanced_table_sticky_mixin.scss +97 -0
  28. data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +1 -1
  29. data/app/pb_kits/playbook/pb_background/_background.scss +26 -0
  30. data/app/pb_kits/playbook/pb_background/_background.tsx +5 -3
  31. data/app/pb_kits/playbook/pb_background/background.test.js +5 -0
  32. data/app/pb_kits/playbook/pb_background/docs/_background_overlay.jsx +35 -0
  33. data/app/pb_kits/playbook/pb_background/docs/_background_overlay.md +1 -0
  34. data/app/pb_kits/playbook/pb_background/docs/example.yml +1 -0
  35. data/app/pb_kits/playbook/pb_background/docs/index.js +1 -0
  36. data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx +1 -1
  37. data/app/pb_kits/playbook/pb_circle_chart/circleChart.test.js +2 -2
  38. data/app/pb_kits/playbook/pb_circle_chart/circleChartTheme.ts +53 -0
  39. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_block.html.erb +2 -2
  40. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_block.jsx +1 -1
  41. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_colors.html.erb +1 -1
  42. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_colors.jsx +1 -1
  43. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_custom_tooltip.html.erb +1 -1
  44. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_custom_tooltip.jsx +1 -1
  45. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_default.html.erb +1 -1
  46. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_default.jsx +1 -1
  47. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_legend_position.html.erb +1 -1
  48. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_legend_position.jsx +1 -1
  49. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_live_data.jsx +2 -2
  50. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_pb_styles.jsx +38 -0
  51. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_pb_styles.md +1 -0
  52. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_rounded.html.erb +1 -1
  53. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_rounded.jsx +1 -1
  54. data/app/pb_kits/playbook/pb_circle_chart/docs/example.yml +2 -3
  55. data/app/pb_kits/playbook/pb_circle_chart/docs/index.js +2 -1
  56. data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.scss +39 -1
  57. data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.tsx +4 -0
  58. data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.rb +9 -1
  59. data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.test.js +14 -0
  60. data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_size.html.erb +28 -0
  61. data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_size.jsx +42 -0
  62. data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_size.md +1 -0
  63. data/app/pb_kits/playbook/pb_circle_icon_button/docs/example.yml +2 -0
  64. data/app/pb_kits/playbook/pb_circle_icon_button/docs/index.js +1 -0
  65. data/app/pb_kits/playbook/pb_copy_button/_copy_button.tsx +19 -45
  66. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_hook.jsx +54 -0
  67. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_hook.md +3 -0
  68. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_hook_rails.html.erb +14 -0
  69. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_hook_rails.md +3 -0
  70. data/app/pb_kits/playbook/pb_copy_button/docs/example.yml +2 -0
  71. data/app/pb_kits/playbook/pb_copy_button/docs/index.js +2 -1
  72. data/app/pb_kits/playbook/pb_copy_button/index.js +46 -20
  73. data/app/pb_kits/playbook/pb_copy_button/usePBCopy.ts +45 -0
  74. data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +12 -0
  75. data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +12 -0
  76. data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +50 -1
  77. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_rails.md +4 -0
  78. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_range_limit.md +1 -1
  79. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_react.md +5 -1
  80. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range_pattern.jsx +34 -0
  81. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range_pattern.md +14 -0
  82. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range_pattern_rails.html.erb +20 -0
  83. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range_pattern_rails.md +14 -0
  84. data/app/pb_kits/playbook/pb_date_picker/docs/example.yml +2 -0
  85. data/app/pb_kits/playbook/pb_date_picker/docs/index.js +1 -0
  86. data/app/pb_kits/playbook/pb_date_picker/plugins/quickPick.tsx +10 -0
  87. data/app/pb_kits/playbook/pb_dialog/dialog.html.erb +10 -1
  88. data/app/pb_kits/playbook/pb_dialog/dialog.rb +2 -0
  89. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_turbo_frames.html.erb +117 -0
  90. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_turbo_frames_rails.md +9 -0
  91. data/app/pb_kits/playbook/pb_dialog/docs/example.yml +1 -0
  92. data/app/pb_kits/playbook/pb_dialog/index.js +106 -14
  93. data/app/pb_kits/playbook/pb_draggable/_draggable.scss +43 -20
  94. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones.jsx +102 -105
  95. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones.md +3 -3
  96. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors.jsx +50 -48
  97. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors.md +1 -1
  98. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_line.jsx +110 -0
  99. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_line.md +5 -0
  100. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_event_listeners.html.erb +42 -0
  101. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_event_listeners.md +1 -0
  102. data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_table_react.jsx → _draggable_with_table.jsx} +1 -1
  103. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table_react.md +3 -1
  104. data/app/pb_kits/playbook/pb_draggable/docs/example.yml +10 -6
  105. data/app/pb_kits/playbook/pb_draggable/docs/index.js +4 -1
  106. data/app/pb_kits/playbook/pb_draggable/draggable.test.jsx +68 -0
  107. data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableContainer.tsx +4 -3
  108. data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +1 -1
  109. data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownOption.tsx +1 -1
  110. data/app/pb_kits/playbook/pb_form_group/_form_group.scss +23 -3
  111. data/app/pb_kits/playbook/pb_form_group/docs/_form_group_select.html.erb +15 -5
  112. data/app/pb_kits/playbook/pb_form_group/docs/_form_group_select.jsx +39 -6
  113. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_pb_styles.jsx +30 -0
  114. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_pb_styles.md +1 -0
  115. data/app/pb_kits/playbook/pb_gauge/docs/example.yml +1 -0
  116. data/app/pb_kits/playbook/pb_gauge/docs/index.js +1 -0
  117. data/app/pb_kits/playbook/pb_gauge/gaugeTheme.ts +85 -0
  118. data/app/pb_kits/playbook/pb_layout/_layout.scss +70 -1
  119. data/app/pb_kits/playbook/pb_layout/_layout.tsx +29 -2
  120. data/app/pb_kits/playbook/pb_layout/docs/_layout_bracket.jsx +322 -118
  121. data/app/pb_kits/playbook/pb_layout/docs/_layout_bracket.md +1 -1
  122. data/app/pb_kits/playbook/pb_layout/subcomponents/_game.tsx +74 -43
  123. data/app/pb_kits/playbook/pb_layout/subcomponents/_participant.tsx +79 -0
  124. data/app/pb_kits/playbook/pb_layout/subcomponents/_round.tsx +21 -4
  125. data/app/pb_kits/playbook/pb_overlay/_overlay.scss +83 -22
  126. data/app/pb_kits/playbook/pb_overlay/_overlay.tsx +39 -7
  127. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_color.jsx +63 -0
  128. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_color.md +3 -0
  129. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_default.md +1 -7
  130. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_fullscreen_background.jsx +49 -0
  131. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_fullscreen_background.md +1 -0
  132. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_fullscreen_opacity.jsx +81 -0
  133. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_fullscreen_opacity.md +1 -0
  134. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_gradient_opacity.jsx +39 -0
  135. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_gradient_opacity.md +1 -0
  136. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_layout.jsx +40 -0
  137. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_layout.md +5 -0
  138. data/app/pb_kits/playbook/pb_overlay/docs/example.yml +5 -0
  139. data/app/pb_kits/playbook/pb_overlay/docs/index.js +5 -0
  140. data/app/pb_kits/playbook/pb_overlay/overlay.test.jsx +39 -1
  141. data/app/pb_kits/playbook/pb_table/_table.tsx +2 -2
  142. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows.md +3 -1
  143. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows_rails.md +3 -1
  144. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table.md +3 -1
  145. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table_rails.md +3 -1
  146. data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless.html.erb +34 -0
  147. data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless_rails.md +1 -0
  148. data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating.html.erb +36 -0
  149. data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating_rails.md +1 -0
  150. data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating_react.md +1 -1
  151. data/app/pb_kits/playbook/pb_table/docs/example.yml +2 -0
  152. data/app/pb_kits/playbook/pb_table/styles/_collapsible.scss +1 -1
  153. data/app/pb_kits/playbook/pb_table/styles/_headers.scss +19 -7
  154. data/app/pb_kits/playbook/pb_table/table.rb +13 -1
  155. data/app/pb_kits/playbook/pb_table/table_header.rb +13 -1
  156. data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +13 -5
  157. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_sanitize.jsx +94 -0
  158. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_sanitize.md +1 -0
  159. data/app/pb_kits/playbook/pb_text_input/docs/example.yml +2 -0
  160. data/app/pb_kits/playbook/pb_text_input/docs/index.js +1 -0
  161. data/app/pb_kits/playbook/pb_text_input/inputMask.ts +8 -1
  162. data/dist/chunks/_typeahead-BX8IifKY.js +22 -0
  163. data/dist/chunks/_weekday_stacked-DfMD7HJz.js +45 -0
  164. data/dist/chunks/lazysizes-B7xYodB-.js +1 -0
  165. data/dist/chunks/lib-96_ZmvAo.js +29 -0
  166. data/dist/chunks/{pb_form_validation-BiHyZedy.js → pb_form_validation-Vv2TqXVC.js} +1 -1
  167. data/dist/chunks/vendor.js +1 -1
  168. data/dist/menu.yml +2 -2
  169. data/dist/playbook-doc.js +19 -1
  170. data/dist/playbook-rails-react-bindings.js +1 -1
  171. data/dist/playbook-rails.js +1 -1
  172. data/dist/playbook.css +1 -1
  173. data/lib/playbook/version.rb +2 -2
  174. metadata +73 -19
  175. data/dist/chunks/_typeahead-CPM091Hj.js +0 -22
  176. data/dist/chunks/_weekday_stacked-BzIANIYX.js +0 -45
  177. data/dist/chunks/lazysizes-DHz07jlL.js +0 -1
  178. data/dist/chunks/lib-Bg2KFzpz.js +0 -29
  179. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_default_rails.html.erb → _draggable_default.html.erb} +0 -0
  180. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_default.md → _draggable_default_react.md} +0 -0
  181. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_multiple_containers_rails.html.erb → _draggable_multiple_containers.html.erb} +0 -0
  182. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_multiple_containers.md → _draggable_multiple_containers_react.md} +0 -0
  183. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_cards_rails.html.erb → _draggable_with_cards.html.erb} +0 -0
  184. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_cards.md → _draggable_with_cards_react.md} +0 -0
  185. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_list_rails.html.erb → _draggable_with_list.html.erb} +0 -0
  186. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_list.md → _draggable_with_list_react.md} +0 -0
  187. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_selectable_list_rails.html.erb → _draggable_with_selectable_list.html.erb} +0 -0
  188. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_selectable_list.md → _draggable_with_selectable_list_react.md} +0 -0
  189. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_table.md → _draggable_with_table_rails.md} +0 -0
@@ -5,79 +5,110 @@ import { GlobalProps, globalProps, globalInlineProps } from '../../utilities/glo
5
5
 
6
6
  import Card from '../../pb_card/_card'
7
7
  import SectionSeparator from '../../pb_section_separator/_section_separator'
8
+ import Body from '../../pb_body/_body'
9
+ import Flex from '../../pb_flex/_flex'
8
10
 
9
11
  type LayoutGameProps = {
10
12
  children: React.ReactNode[] | React.ReactNode,
11
13
  className?: string,
12
14
  numberOfRounds: number,
13
15
  numberOfGames: number,
16
+ lastRoundWithSelf?: number,
14
17
  isOdd: boolean,
15
18
  } & GlobalProps
16
19
 
17
20
  // Game component (modeled after Item)
18
21
  const Game = (props: LayoutGameProps) => {
19
- const { children, className, numberOfRounds, numberOfGames, isOdd } = props
22
+ const { children, className, numberOfRounds, numberOfGames, isOdd, lastRoundWithSelf } = props
20
23
  const dynamicInlineProps = globalInlineProps(props)
21
-
24
+
22
25
  const numberOfChildren = Array.isArray(children) ? children.length : 0
23
-
26
+
24
27
  const isMultiple = Array.isArray(children)
25
-
28
+
26
29
  let ratio = 0
27
30
  let exponent
31
+ let currentRound = numberOfRounds
28
32
  if (numberOfGames > 1) {
29
33
  exponent = (numberOfRounds) - Math.log2(numberOfGames) - 1
30
34
  ratio = 2 ** exponent
35
+
36
+ currentRound = exponent + 1
31
37
  }
32
-
38
+
39
+ let hasWinner = false
40
+ const hasLastWinnerAndSelf = lastRoundWithSelf === currentRound
33
41
  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"
42
+ const [firstChildWithoutProps, secondChildWithoutProps] = React.Children.toArray(children)
43
+
44
+ const firstChild = React.isValidElement(firstChildWithoutProps) ? React.cloneElement(firstChildWithoutProps, { hasLastWinnerAndSelf }) : firstChildWithoutProps
45
+ const secondChild = React.isValidElement(secondChildWithoutProps) ? React.cloneElement(secondChildWithoutProps, { hasLastWinnerAndSelf }) : secondChildWithoutProps
46
+
47
+ if (React.isValidElement(firstChild) && React.isValidElement(secondChild)) {
48
+ if (
49
+ firstChild?.props && typeof firstChild.props === 'object' && 'winner' in firstChild.props ||
50
+ secondChild?.props && typeof secondChild.props === 'object' && 'winner' in secondChild.props
51
+ ) {
52
+ hasWinner = true
53
+ }
54
+ return (
55
+ <div
56
+ className={classnames('layout_game', globalProps(props), className)}
57
+ style={dynamicInlineProps}
46
58
  >
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>
59
+ <Card
60
+ marginY="xs"
61
+ overflow="hidden"
62
+ padding="none"
63
+ shadow="deep"
64
+ >
65
+ <Card.Body padding="none">{firstChild}</Card.Body>
66
+ <SectionSeparator className="game_separator"/>
67
+ <Card.Body padding="none">{secondChild}</Card.Body>
68
+ </Card>
69
+ {isOdd && numberOfGames > 1 &&
70
+ <div
71
+ className="half_box"
72
+ style={{ height: `calc(${ratio} * 100% + 4px)` }}
73
+ />
74
+ }
75
+ {numberOfGames > 1 && hasWinner &&
76
+ <div className="polygon_node" />
77
+ }
78
+ </div>
58
79
  )
59
80
  }
60
81
  }
61
-
82
+
62
83
  return (
63
84
  <div
64
85
  className={classnames('layout_game', globalProps(props), className)}
65
86
  style={dynamicInlineProps}
66
87
  >
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 &&
88
+ {((!isMultiple && children) || numberOfChildren >= 1) ? (
89
+ children
90
+ ) : (
91
+ <div className="layout_tbd">
92
+ <Card
93
+ marginY="xs"
94
+ padding="none"
95
+ shadow="deep"
96
+ >
97
+ <Card.Body padding="xs">
98
+ <Body color="light">
99
+ To be determined...
100
+ </Body>
101
+ </Card.Body>
102
+ <SectionSeparator className="game_separator"/>
103
+ <Card.Body padding="xs">
104
+ <Body color="light">
105
+ To be determined...
106
+ </Body>
107
+ </Card.Body>
108
+ </Card>
109
+ </div>
110
+ )}
111
+ {isOdd && numberOfGames > 1 &&
81
112
  <div
82
113
  className="half_box"
83
114
  style={{ height: `calc(${ratio} * 100% + 4px)` }}
@@ -0,0 +1,79 @@
1
+ import React from 'react'
2
+ import classnames from 'classnames'
3
+
4
+ import { buildCss } from '../../utilities/props'
5
+ import { GlobalProps, globalProps, globalInlineProps } from '../../utilities/globalProps'
6
+
7
+ import Avatar from "../../pb_avatar/_avatar";
8
+ import Body from "../../pb_body/_body";
9
+ import Flex from "../../pb_flex/_flex";
10
+ import Badge from "../../pb_badge/_badge";
11
+ import Detail from "../../pb_detail/_detail";
12
+ import Background from "../../pb_background/_background";
13
+
14
+ type LayoutParticipantProps = {
15
+ className?: string,
16
+ name?: string,
17
+ territory?: string,
18
+ points?: string,
19
+ rank?: string,
20
+ avatar?: string,
21
+ winner?: boolean,
22
+ self?: boolean,
23
+ } & GlobalProps
24
+
25
+ export const Participant = (props: LayoutParticipantProps) => {
26
+ const { className, name = 'To be determined...', territory = '', points, rank, avatar, winner, self, hasLastWinnerAndSelf } = props
27
+ const dynamicInlineProps = globalInlineProps(props)
28
+ const isLastWinnerAndSelf = hasLastWinnerAndSelf && self && winner
29
+ const classes = classnames(buildCss('layout_participant', winner ? 'winner' : '', self ? 'self' : '', isLastWinnerAndSelf ? 'last' : ''), globalProps(props), className)
30
+ return (
31
+ <Background
32
+ backgroundColor={winner ? "success_subtle" : "white"}
33
+ className={classes}
34
+ padding="xs"
35
+ style={dynamicInlineProps}
36
+ >
37
+ <Flex justify="between">
38
+ <Avatar
39
+ imageUrl={avatar}
40
+ marginRight="sm"
41
+ name={name}
42
+ size="sm"
43
+ />
44
+ <Body flexGrow={1}>
45
+ <Flex justify="between">
46
+ <Body
47
+ color={winner && !isLastWinnerAndSelf ? "success" : "default"}
48
+ truncate={1}
49
+ >
50
+ {winner ? <strong>{name}{self ? ' (You)' : ''}</strong> : name + (self && !isLastWinnerAndSelf ? ' (You)' : '')}
51
+ </Body>
52
+ <Body
53
+ color={winner && !isLastWinnerAndSelf ? "success" : "light"}
54
+ display="flex"
55
+ >
56
+ {points && (<>
57
+ <strong>{points}</strong>
58
+ <Detail
59
+ color={winner && !isLastWinnerAndSelf ? "success" : "light"}
60
+ text="pts"
61
+ />
62
+ </>)}
63
+ </Body>
64
+ </Flex>
65
+ <Body color="light">
66
+ {territory}
67
+ &nbsp;
68
+ <Badge
69
+ text={rank}
70
+ variant={winner && !isLastWinnerAndSelf ? "success" : self ? "notification" : "neutral"}
71
+ />
72
+ </Body>
73
+ </Body>
74
+ </Flex>
75
+ </Background>
76
+ )
77
+ }
78
+
79
+ export default Participant
@@ -25,16 +25,33 @@ type LayoutRoundProps = {
25
25
  children: React.ReactNode[] | React.ReactNode,
26
26
  className?: string,
27
27
  numberOfRounds: number,
28
+ lastRoundWithSelf: number,
28
29
  } & GlobalProps
29
30
 
30
31
  export const Round = (props: LayoutRoundProps) => {
31
- const { children, className, numberOfRounds } = props
32
+ const { children, className, numberOfRounds, lastRoundWithSelf } = props
32
33
  const dynamicInlineProps = globalInlineProps(props)
33
34
  const numberOfChildren = Array.isArray(children) ? children.length : 0
34
35
 
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
36
+ const childrenWithProps = Array.isArray(children)
37
+ ? children.map((child, index) =>
38
+ React.isValidElement(child)
39
+ ? React.cloneElement(child, {
40
+ numberOfRounds,
41
+ numberOfGames: numberOfChildren,
42
+ isOdd: index % 2 === 0,
43
+ key: `child_${index}`,
44
+ lastRoundWithSelf
45
+ })
46
+ : child
47
+ )
48
+ : React.isValidElement(children)
49
+ ? React.cloneElement(children, {
50
+ numberOfRounds,
51
+ numberOfGames: numberOfChildren,
52
+ lastRoundWithSelf
53
+ })
54
+ : children
38
55
 
39
56
  const rightConnectors = Array.from({ length: numberOfChildren / 2 }, (_, index) => (
40
57
  <div
@@ -18,34 +18,39 @@ $overlay_colors: (
18
18
  card_dark: $card_dark,
19
19
  bg_dark: $bg_dark,
20
20
  bg_light: $bg_light,
21
+ black: $black,
22
+ white: $white,
23
+ success: $success,
24
+ error: $error
21
25
  );
22
26
 
23
- @mixin overlay($direction, $size, $color) {
27
+ @mixin overlay($direction, $size, $color, $apply_gradient: true) {
24
28
  display: block;
25
29
  position: absolute;
26
30
  pointer-events: none;
27
31
  z-index: 1;
28
32
  content: "";
29
33
 
30
- @if $direction == "left" {
31
- inset: 0 auto 0 0;
32
- background: linear-gradient(to right, $color 0%, transparent 100%);
33
- width: $size;
34
- }
35
- @if $direction == "right" {
36
- inset: 0 0 0 auto;
37
- background: linear-gradient(to left, $color 0%, transparent 100%);
38
- width: $size;
39
- }
40
- @if $direction == "top" {
41
- inset: 0 0 auto 0;
42
- background: linear-gradient(to bottom, $color 0%, transparent 100%);
43
- height: $size;
44
- }
45
- @if $direction == "bottom" {
46
- inset: auto 0 0 0;
47
- background: linear-gradient(to top, $color 0%, transparent 100%);
48
- height: $size;
34
+ @if $apply_gradient {
35
+ @if $direction == "left" {
36
+ inset: 0 auto 0 0;
37
+ background: linear-gradient(to right, $color 0%, transparent 100%);
38
+ width: $size;
39
+ } @else if $direction == "right" {
40
+ inset: 0 0 0 auto;
41
+ background: linear-gradient(to left, $color 0%, transparent 100%);
42
+ width: $size;
43
+ } @else if $direction == "top" {
44
+ inset: 0 0 auto 0;
45
+ background: linear-gradient(to bottom, $color 0%, transparent 100%);
46
+ height: $size;
47
+ } @else if $direction == "bottom" {
48
+ inset: auto 0 0 0;
49
+ background: linear-gradient(to top, $color 0%, transparent 100%);
50
+ height: $size;
51
+ }
52
+ } @else {
53
+ background: $color;
49
54
  }
50
55
  }
51
56
 
@@ -69,7 +74,7 @@ $overlay_colors: (
69
74
  pointer-events: none;
70
75
  z-index: 1;
71
76
  }
72
-
77
+
73
78
  &.overlay-hide-scrollbar {
74
79
  & [class*="overflow_x_auto"],
75
80
  & [class*="overflow_y_auto"],
@@ -77,9 +82,65 @@ $overlay_colors: (
77
82
  &::-webkit-scrollbar {
78
83
  display: none !important;
79
84
  }
80
-
85
+
81
86
  -ms-overflow-style: none !important;
82
87
  scrollbar-width: none !important;
83
88
  }
84
89
  }
90
+
91
+ &.overlay-full-screen {
92
+ position: fixed;
93
+ top: 0;
94
+ left: 0;
95
+ right: 0;
96
+ bottom: 0;
97
+ width: 100vw;
98
+ height: 100vh;
99
+ z-index: 9999;
100
+
101
+ &.no_gradient {
102
+ @each $color_name, $color in $overlay_colors {
103
+ &[data-overlay-color="#{$color_name}"] {
104
+ &::before {
105
+ content: "";
106
+ position: absolute;
107
+ top: 0;
108
+ left: 0;
109
+ right: 0;
110
+ bottom: 0;
111
+ background: $color;
112
+ pointer-events: none;
113
+ }
114
+ }
115
+ }
116
+ }
117
+
118
+ @each $key, $value in $opacity {
119
+ &.#{$key}::before {
120
+ opacity: $value;
121
+ }
122
+ }
123
+ }
124
+
125
+ &.no_gradient {
126
+ @each $color_name, $color in $overlay_colors {
127
+ .overlay_#{$color_name} {
128
+ @each $name, $size in $overlay_sizes {
129
+ @each $position in $overlay_positions {
130
+ &_#{$position}_#{$name} {
131
+ @include overlay($position, $size, $color, false);
132
+ }
133
+ }
134
+ }
135
+ }
136
+ }
137
+
138
+ @each $key, $value in $opacity {
139
+ &.#{$key} {
140
+ [class^=overlay] {
141
+ opacity: $value;
142
+ }
143
+ }
144
+ }
145
+ }
85
146
  }
@@ -7,8 +7,9 @@ import OverlayToken from './subcomponents/_overlay_token'
7
7
 
8
8
  export type OverlayChildrenProps = {
9
9
  children: React.ReactNode[] | React.ReactNode,
10
- color: "card_light" | "bg_light" | "card_dark" | "bg_dark",
10
+ color: "card_light" | "bg_light" | "card_dark" | "bg_dark" | "black" | "white" | "success" | "error",
11
11
  dynamic?: boolean,
12
+ gradient?: boolean,
12
13
  position: string,
13
14
  size: string,
14
15
  scrollBarNone?: boolean,
@@ -18,14 +19,17 @@ type OverlayProps = {
18
19
  aria?: { [key: string]: string },
19
20
  className?: string,
20
21
  children: React.ReactNode[] | React.ReactNode,
21
- color: "card_light" | "bg_light" | "card_dark" | "bg_dark",
22
+ color: "card_light" | "bg_light" | "card_dark" | "bg_dark" | "black" | "white" | "success" | "error",
22
23
  data?: { [key: string]: string },
23
24
  dynamic?: false,
25
+ fullScreen?: boolean,
26
+ gradient?: boolean,
24
27
  htmlOptions?: { [key: string]: string | number | boolean | (() => void) },
25
28
  id?: string,
26
29
  layout: { [key: string]: string },
30
+ opacity: 'opacity_1' | 'opacity_2' | 'opacity_3' | 'opacity_4' | 'opacity_5' | 'opacity_6' | 'opacity_7' | 'opacity_8' | 'opacity_9' | 'opacity_10',
27
31
  scrollBarNone?: boolean,
28
-
32
+
29
33
  }
30
34
 
31
35
  const Overlay = (props: OverlayProps) => {
@@ -36,15 +40,26 @@ const Overlay = (props: OverlayProps) => {
36
40
  color = "card_light",
37
41
  data = {},
38
42
  dynamic = false,
43
+ fullScreen = false,
44
+ gradient = true,
39
45
  htmlOptions = {},
40
46
  id,
41
47
  layout = { "bottom": "full" },
48
+ opacity,
42
49
  scrollBarNone = false,
43
50
  } = props
44
51
 
45
52
  const ariaProps = buildAriaProps(aria)
46
53
  const dataProps = buildDataProps(data)
47
- const classes = classnames(buildCss('pb_overlay'), { 'overlay-hide-scrollbar': scrollBarNone }, globalProps(props), className )
54
+ const classes = classnames(
55
+ buildCss('pb_overlay'),
56
+ { 'overlay-hide-scrollbar': scrollBarNone },
57
+ { 'overlay-full-screen': fullScreen },
58
+ { 'no_gradient': gradient === false },
59
+ globalProps(props),
60
+ opacity,
61
+ className
62
+ )
48
63
  const htmlProps = buildHtmlProps(htmlOptions)
49
64
  const dynamicInlineProps = globalInlineProps(props)
50
65
 
@@ -53,6 +68,9 @@ const Overlay = (props: OverlayProps) => {
53
68
  }
54
69
 
55
70
  const getSize = () => {
71
+ if (fullScreen) {
72
+ return "100%"
73
+ }
56
74
  return Object.values(layout)[0]
57
75
  }
58
76
 
@@ -64,23 +82,37 @@ const Overlay = (props: OverlayProps) => {
64
82
  {...dataProps}
65
83
  {...htmlProps}
66
84
  className={classes}
85
+ data-overlay-color={color}
67
86
  id={id}
68
- style={dynamicInlineProps}
87
+ style={{
88
+ ...(fullScreen ? {
89
+ position: 'fixed',
90
+ top: 0,
91
+ left: 0,
92
+ right: 0,
93
+ bottom: 0,
94
+ zIndex: 9999,
95
+ '--overlay-color': `var(--${color})`,
96
+ } : {}),
97
+ ...dynamicInlineProps
98
+ }}
69
99
  >
70
100
  {isSizePercentage ?
71
101
  OverlayPercentage({
72
102
  children,
73
103
  color,
104
+ gradient,
74
105
  position: getPosition(),
75
106
  scrollBarNone,
76
- size: getSize()
107
+ size: getSize(),
77
108
  }) : OverlayToken({
78
109
  children,
79
110
  color,
80
111
  dynamic: dynamic,
112
+ gradient,
81
113
  position: getPosition(),
82
114
  scrollBarNone,
83
- size: getSize()
115
+ size: getSize(),
84
116
  })
85
117
  }
86
118
  </div>
@@ -0,0 +1,63 @@
1
+ import React from 'react'
2
+
3
+ import Overlay from '../../pb_overlay/_overlay'
4
+ import Image from '../../pb_image/_image'
5
+ import Flex from '../../pb_flex/_flex'
6
+
7
+ const OverlayColor = () => (
8
+ <Flex
9
+ justify="around"
10
+ wrap
11
+ >
12
+ <Overlay
13
+ color="black"
14
+ marginBottom="xxs"
15
+ >
16
+ <Image
17
+ alt="picture of a misty forest"
18
+ display="block"
19
+ size="xl"
20
+ url="https://unsplash.it/500/400/?image=634"
21
+ />
22
+ </Overlay>
23
+ <Overlay
24
+ color="black"
25
+ gradient={false}
26
+ marginBottom="xxs"
27
+ opacity="opacity_4"
28
+ >
29
+ <Image
30
+ alt="picture of a misty forest"
31
+ display="block"
32
+ size="xl"
33
+ url="https://unsplash.it/500/400/?image=634"
34
+ />
35
+ </Overlay>
36
+ <Overlay
37
+ color="error"
38
+ marginBottom="xxs"
39
+ >
40
+ <Image
41
+ alt="picture of a misty forest"
42
+ display="block"
43
+ size="xl"
44
+ url="https://unsplash.it/500/400/?image=634"
45
+ />
46
+ </Overlay>
47
+ <Overlay
48
+ color="error"
49
+ gradient={false}
50
+ marginBottom="xxs"
51
+ opacity="opacity_4"
52
+ >
53
+ <Image
54
+ alt="picture of a misty forest"
55
+ display="block"
56
+ size="xl"
57
+ url="https://unsplash.it/500/400/?image=634"
58
+ />
59
+ </Overlay>
60
+ </Flex>
61
+ )
62
+
63
+ export default OverlayColor
@@ -0,0 +1,3 @@
1
+ The `color` prop is used to change the color of the solid or gradient mask. Gradient overlays always start opaque and fade to transparent.
2
+
3
+ NOTE: Images are set to `display: block` to remove the default inline spacing caused by line height. This ensures the image fully fills the container without unexpected gaps.
@@ -1,7 +1 @@
1
- Overlays optionally accept a `color`, which sets the "start" (opaque) color of a gradient mask. Because this overlay is intended to reveal underlying content, the "end" color is fixed to transparent.
2
-
3
- The optional `layout` prop accepts the `position` and `size` of the overlay as a key:value pair.
4
-
5
- The `position` key accepts `bottom` (default), `top`, `y` (for both top and bottom) `right`, `left`, or `x` (for both left and right), which sets the side(s) where the `color` overlay starts. The direction of the overlay is always toward the opposite side of the position. For example, the default position of `bottom` starts the overlay on the bottom edge of your container and extends it toward the opposite side: the top.
6
-
7
- The `size` value is `full` (100%) by default, but accepts our [spacing tokens](https://playbook.powerapp.cloud/visual_guidelines/spacing) or a percentage value as a string, and literally translates to how much of the container is covered by the overlay(s).
1
+ Overlays help shift focus by dimming or masking background content. This kit supports gradient and solid color modes, with adjustable opacity to suit the context.
@@ -0,0 +1,49 @@
1
+ import React, { useState } from 'react'
2
+ import Overlay from '../../pb_overlay/_overlay'
3
+ import Button from '../../pb_button/_button'
4
+ import FixedConfirmationToast from '../../pb_fixed_confirmation_toast/_fixed_confirmation_toast'
5
+
6
+ const OverlayFullscreenBackground = () => {
7
+ const [openBackground, setOpenBackground] = useState(false)
8
+
9
+ const handleClickBackground = () => {
10
+ setOpenBackground(true)
11
+ }
12
+
13
+ const handleCloseBackground = () => {
14
+ setOpenBackground(false)
15
+ }
16
+
17
+ return (
18
+ <>
19
+ <div>
20
+ <Button
21
+ onClick={handleClickBackground}
22
+ text="Background Dark"
23
+ variant="secondary"
24
+ />
25
+
26
+ {openBackground && (
27
+ <Overlay
28
+ color="bg_dark"
29
+ fullScreen
30
+ gradient={false}
31
+ opacity="opacity_4"
32
+ >
33
+ <FixedConfirmationToast
34
+ closeable
35
+ horizontal='center'
36
+ onClose={handleCloseBackground}
37
+ open={openBackground}
38
+ status="tip"
39
+ text='Fullscreen Overlay with color set to Background Dark.'
40
+ vertical='top'
41
+ />
42
+ </Overlay>
43
+ )}
44
+ </div>
45
+ </>
46
+ )
47
+ }
48
+
49
+ export default OverlayFullscreenBackground
@@ -0,0 +1 @@
1
+ The `fullScreen` prop also allows you to use `color` along with it.