playbook_ui 14.17.0.pre.alpha.PLAY1967bracketlayoutphase27240 → 14.17.0.pre.alpha.PLAY2035dialogkitturbocustomprop7297

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 (71) 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 +11 -1
  4. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +60 -128
  5. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +3 -0
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_columns.jsx +58 -0
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_columns.md +6 -0
  8. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_columns_and_header.jsx +64 -0
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_columns_and_header.md +8 -0
  10. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header.jsx +55 -0
  11. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header.md +3 -0
  12. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header_rails.html.erb +33 -0
  13. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header_rails.md +3 -0
  14. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.html.erb +1 -1
  15. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.jsx +1 -2
  16. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_rails.md +2 -2
  17. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_react.md +1 -1
  18. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_rails.md +6 -2
  19. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_react.md +6 -2
  20. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +6 -2
  21. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +4 -1
  22. data/app/pb_kits/playbook/pb_advanced_table/scss_partials/advanced_table_sticky_mixin.scss +97 -0
  23. data/app/pb_kits/playbook/pb_copy_button/_copy_button.tsx +19 -45
  24. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_hook.jsx +54 -0
  25. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_hook.md +3 -0
  26. data/app/pb_kits/playbook/pb_copy_button/docs/example.yml +1 -0
  27. data/app/pb_kits/playbook/pb_copy_button/docs/index.js +2 -1
  28. data/app/pb_kits/playbook/pb_copy_button/usePBCopy.ts +45 -0
  29. data/app/pb_kits/playbook/pb_dialog/dialog.html.erb +10 -1
  30. data/app/pb_kits/playbook/pb_dialog/dialog.rb +2 -0
  31. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_turbo_frames.html.erb +117 -0
  32. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_turbo_frames_rails.md +9 -0
  33. data/app/pb_kits/playbook/pb_dialog/docs/example.yml +1 -0
  34. data/app/pb_kits/playbook/pb_dialog/index.js +106 -14
  35. data/app/pb_kits/playbook/pb_form_group/_form_group.scss +18 -2
  36. data/app/pb_kits/playbook/pb_form_group/docs/_form_group_select.html.erb +15 -5
  37. data/app/pb_kits/playbook/pb_form_group/docs/_form_group_select.jsx +20 -5
  38. data/app/pb_kits/playbook/pb_layout/_layout.scss +3 -1
  39. data/app/pb_kits/playbook/pb_layout/docs/_layout_bracket.jsx +14 -14
  40. data/app/pb_kits/playbook/pb_layout/subcomponents/_game.tsx +6 -3
  41. data/app/pb_kits/playbook/pb_layout/subcomponents/_participant.tsx +6 -1
  42. data/app/pb_kits/playbook/pb_overlay/_overlay.scss +49 -22
  43. data/app/pb_kits/playbook/pb_overlay/_overlay.tsx +15 -4
  44. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_color.jsx +63 -0
  45. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_color.md +3 -0
  46. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_default.md +1 -7
  47. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_gradient_opacity.jsx +39 -0
  48. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_gradient_opacity.md +1 -0
  49. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_layout.jsx +40 -0
  50. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_layout.md +5 -0
  51. data/app/pb_kits/playbook/pb_overlay/docs/example.yml +3 -0
  52. data/app/pb_kits/playbook/pb_overlay/docs/index.js +3 -0
  53. data/app/pb_kits/playbook/pb_overlay/overlay.test.jsx +39 -1
  54. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows.md +3 -1
  55. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows_rails.md +3 -1
  56. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table.md +3 -1
  57. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table_rails.md +3 -1
  58. data/app/pb_kits/playbook/pb_table/styles/_collapsible.scss +1 -1
  59. data/dist/chunks/{_typeahead-BY6AFq1l.js → _typeahead-CHd0V9EL.js} +1 -1
  60. data/dist/chunks/_weekday_stacked-BatiLk3-.js +45 -0
  61. data/dist/chunks/{lib-BGzBzFZX.js → lib-BV_AF_eh.js} +3 -3
  62. data/dist/chunks/{pb_form_validation-BvNy9Bd6.js → pb_form_validation-nsvkJU2J.js} +1 -1
  63. data/dist/chunks/vendor.js +1 -1
  64. data/dist/menu.yml +1 -1
  65. data/dist/playbook-doc.js +1 -1
  66. data/dist/playbook-rails-react-bindings.js +1 -1
  67. data/dist/playbook-rails.js +1 -1
  68. data/dist/playbook.css +1 -1
  69. data/lib/playbook/version.rb +1 -1
  70. metadata +26 -6
  71. data/dist/chunks/_weekday_stacked-CQqRUTO3.js +0 -45
@@ -10,6 +10,81 @@ export default class PbDialog extends PbEnhancedElement {
10
10
  connect() {
11
11
  window.addEventListener("DOMContentLoaded", () => this.setupDialog())
12
12
  window.addEventListener("turbo:frame-load", () => this.setupDialog())
13
+
14
+ // Code for custom_event_type setup (can take multiple events in a string separated by commas)
15
+ const customEventTypeString = this.element.dataset.customEventType
16
+ if (customEventTypeString && !this.element.hasAttribute("data-custom-event-handled")) {
17
+ this.customEventTypes = customEventTypeString.split(",").map(e => e.trim()).filter(Boolean)
18
+ this.customEventTypes.forEach(eventType => {
19
+ window.addEventListener(eventType, this.handleCustomEvent)
20
+ })
21
+
22
+ this.element.setAttribute("data-custom-event-handled", "true")
23
+ }
24
+ }
25
+
26
+ disconnect() {
27
+ if (this.customEventTypes && Array.isArray(this.customEventTypes)) {
28
+ this.customEventTypes.forEach(eventType => {
29
+ window.removeEventListener(eventType, this.handleCustomEvent)
30
+ })
31
+ }
32
+ }
33
+
34
+ handleCustomEvent = (event) => {
35
+ const dialogId = event.detail?.dialogId || this.element.querySelector("dialog")?.id
36
+ const dialog = dialogId && document.getElementById(dialogId)
37
+
38
+ if (!dialog) {
39
+ console.warn(`[PbDialog] Could not find dialog with ID '${dialogId}'`)
40
+ return
41
+ }
42
+
43
+ this.setupDialog()
44
+
45
+ const action = event.detail?.action || 'open'
46
+
47
+ // Known Actions - four "standard" dialog actions that felt like things devs might want to do
48
+ const knownActions = ['open', 'close', 'clickConfirm', 'clickCancel'];
49
+
50
+ if (knownActions.includes(action)) {
51
+ switch (action) {
52
+ case 'open':
53
+ if (!dialog.open) dialog.showModal()
54
+ break
55
+ case 'close':
56
+ if (dialog.open) dialog.close(event.detail?.returnValue)
57
+ break
58
+ case 'clickConfirm':
59
+ this.triggerButtonClick(dialog, event, 'confirm')
60
+ break
61
+ case 'clickCancel':
62
+ this.triggerButtonClick(dialog, event, 'cancel')
63
+ break
64
+ }
65
+ }
66
+ // Custom Actions - flexible for Turbo or other integration
67
+ else if (typeof event.detail?.customAction === 'function') {
68
+ event.detail.customAction({ dialog, event })
69
+ } else if (window.pbDialogActions?.[action]) {
70
+ // Can register custom actions globally
71
+ window.pbDialogActions[action]({ dialog, event })
72
+ } else {
73
+ console.warn(`[PbDialog] Unknown action: ${action}`)
74
+ }
75
+ }
76
+
77
+ triggerButtonClick(dialog, event, type) {
78
+ const buttonId = event.detail?.[`${type}ButtonId`] ||
79
+ dialog.closest('[data-pb-dialog-wrapper]')?.dataset[`${type}ButtonId`]
80
+ const button = buttonId ? document.getElementById(buttonId) :
81
+ dialog.querySelector(`[data-${type}-button]`)
82
+
83
+ if (button) {
84
+ button.click()
85
+ } else {
86
+ console.warn(`[PbDialog] Could not find ${type} button for dialog`)
87
+ }
13
88
  }
14
89
 
15
90
  setupDialog() {
@@ -18,7 +93,7 @@ export default class PbDialog extends PbEnhancedElement {
18
93
  const dialogs = document.querySelectorAll(".pb_dialog_rails")
19
94
 
20
95
  const loadingButton = document.querySelector('[data-disable-with="Loading"]');
21
- if (loadingButton) {
96
+ if (loadingButton && !loadingButton.dataset.listenerAttached) {
22
97
  loadingButton.addEventListener("click", function () {
23
98
  const okayLoadingButton = document.querySelector('[data-disable-with="Loading"]');
24
99
  const cancelButton = document.querySelector('[data-disable-cancel-with="Loading"]');
@@ -35,27 +110,42 @@ export default class PbDialog extends PbEnhancedElement {
35
110
  okayLoadingButton.className = newClass;
36
111
  if (cancelButton) cancelButton.className = newCancelClass;
37
112
  });
113
+
114
+ // Prevent multiple registrations
115
+ loadingButton.dataset.listenerAttached = "true";
38
116
  }
39
-
117
+
40
118
  openTrigger.forEach((open) => {
41
- open.addEventListener("click", () => {
42
- var openTriggerData = open.dataset.openDialog;
43
- var targetDialog = document.getElementById(openTriggerData)
44
- if (targetDialog.open) return;
45
- targetDialog.showModal();
46
- });
119
+ const originalClickHandler = open._openDialogClickHandler
120
+ if (originalClickHandler) open.removeEventListener("click", originalClickHandler)
121
+
122
+ open._openDialogClickHandler = () => {
123
+ const openTriggerData = open.dataset.openDialog;
124
+ const targetDialogOpen = document.getElementById(openTriggerData)
125
+ if (targetDialogOpen && !targetDialogOpen.open) targetDialogOpen.showModal()
126
+ };
127
+
128
+ open.addEventListener("click", open._openDialogClickHandler)
47
129
  });
48
130
 
49
131
  closeTrigger.forEach((close) => {
50
- close.addEventListener("click", () => {
51
- var closeTriggerData = close.dataset.closeDialog;
52
- document.getElementById(closeTriggerData).close();
53
- });
132
+ const originalClickHandler = close._closeDialogClickHandler
133
+ if (originalClickHandler) close.removeEventListener("click", originalClickHandler)
134
+
135
+ close._closeDialogClickHandler = () => {
136
+ const closeTriggerData = close.dataset.closeDialog;
137
+ const targetDialogClose = document.getElementById(closeTriggerData)
138
+ if (targetDialogClose) targetDialogClose.close();
139
+ };
140
+
141
+ close.addEventListener("click", close._closeDialogClickHandler)
54
142
  });
55
143
 
56
144
  // Close dialog box on outside click
57
145
  dialogs.forEach((dialogElement) => {
58
- dialogElement.addEventListener("mousedown", (event) => {
146
+ const originalMousedownHandler = dialogElement._outsideClickHandler
147
+ if (originalMousedownHandler) dialogElement.removeEventListener("mousedown", originalMousedownHandler)
148
+ dialogElement._outsideClickHandler = (event) => {
59
149
  const dialogParentDataset = dialogElement.parentElement.dataset
60
150
  if (dialogParentDataset.overlayClick === "overlay_close") return
61
151
 
@@ -69,7 +159,9 @@ export default class PbDialog extends PbEnhancedElement {
69
159
  dialogElement.close()
70
160
  event.stopPropagation()
71
161
  }
72
- })
162
+ }
163
+
164
+ dialogElement.addEventListener("mousedown", dialogElement._outsideClickHandler);
73
165
  })
74
166
  }
75
167
  }
@@ -85,8 +85,16 @@
85
85
  .text_input_wrapper input, [class^=pb_text_input_kit] .text_input_wrapper .text_input {
86
86
  border-bottom-right-radius: 0;
87
87
  border-top-right-radius: 0;
88
- border-right-width: 0;
88
+ border-right-color: transparent;
89
89
  }
90
+ [class^=pb_text_input_kit] .text_input_wrapper input:focus,
91
+ [class^=pb_text_input_kit] .text_input_wrapper .text_input:focus {
92
+ border-right-color: $primary;
93
+ }
94
+ [class^=pb_text_input_kit].error .text_input_wrapper input,
95
+ [class^=pb_text_input_kit].error .text_input_wrapper .text_input {
96
+ border-right-color: $error;
97
+ }
90
98
  }
91
99
 
92
100
  & > [class^=pb_phone_number_input]:not(:first-child) {
@@ -107,8 +115,16 @@
107
115
  .text_input {
108
116
  border-bottom-right-radius: 0;
109
117
  border-top-right-radius: 0;
110
- border-right: none;
118
+ border-right-color: transparent;
111
119
  }
120
+ [class^=pb_text_input_kit] .text_input_wrapper input:focus,
121
+ [class^=pb_text_input_kit] .text_input_wrapper .text_input:focus {
122
+ border-right-color: $primary;
123
+ }
124
+ [class^=pb_text_input_kit].error .text_input_wrapper input,
125
+ [class^=pb_text_input_kit].error .text_input_wrapper .text_input {
126
+ border-right-color: $error;
127
+ }
112
128
  }
113
129
 
114
130
  &[class*=rails] > [class^=pb_date_picker_kit] {
@@ -1,5 +1,4 @@
1
- <div>
2
-
1
+ <%= pb_rails("flex", props: {orientation: "column", row_gap:"md"}) do %>
3
2
  <%= pb_rails("form_group") do %>
4
3
  <%= pb_rails("text_input", props: { placeholder: "Enter Artist Name" }) %>
5
4
  <%= pb_rails("select", props: {
@@ -17,8 +16,6 @@
17
16
  ]
18
17
  }) %>
19
18
  <% end %>
20
- <br>
21
- <br>
22
19
  <%= pb_rails("form_group") do %>
23
20
  <%= pb_rails("select", props: {
24
21
  blank_selection: "Phone",
@@ -32,4 +29,17 @@
32
29
  id: "phone"
33
30
  }) %>
34
31
  <% end %>
35
- </div>
32
+ <%= pb_rails("form_group") do %>
33
+ <%= pb_rails("phone_number_input", props: {
34
+ id: "phone2"
35
+ }) %>
36
+ <%= pb_rails("select", props: {
37
+ blank_selection: "Phone",
38
+ options: [
39
+ { value: "Cell" },
40
+ { value: "Work" },
41
+ { value: "Home" },
42
+ ]
43
+ }) %>
44
+ <% end %>
45
+ <% end %>
@@ -4,6 +4,7 @@ import FormGroup from '../_form_group'
4
4
  import PhoneNumberInput from '../../pb_phone_number_input/_phone_number_input'
5
5
  import Select from '../../pb_select/_select'
6
6
  import TextInput from '../../pb_text_input/_text_input'
7
+ import Flex from '../../pb_flex/_flex'
7
8
 
8
9
  const FormGroupSelect = (props) => {
9
10
  const options = [
@@ -25,7 +26,10 @@ const FormGroupSelect = (props) => {
25
26
  ]
26
27
 
27
28
  return (
28
- <div>
29
+ <Flex
30
+ orientation="column"
31
+ rowGap="md"
32
+ >
29
33
  <FormGroup>
30
34
  <TextInput
31
35
  placeholder="Enter Artist Name"
@@ -37,18 +41,29 @@ const FormGroupSelect = (props) => {
37
41
  {...props}
38
42
  />
39
43
  </FormGroup>
40
- <br />
41
- <br />
42
44
  <FormGroup>
43
45
  <Select
44
46
  blankSelection="Phone"
45
47
  options={phoneOptions}
46
- />
48
+ {...props}
49
+ />
47
50
  <PhoneNumberInput
48
51
  id='default'
52
+ {...props}
49
53
  />
50
54
  </FormGroup>
51
- </div>
55
+ <FormGroup>
56
+ <PhoneNumberInput
57
+ id='default-2'
58
+ {...props}
59
+ />
60
+ <Select
61
+ blankSelection="Phone"
62
+ options={phoneOptions}
63
+ {...props}
64
+ />
65
+ </FormGroup>
66
+ </Flex>
52
67
  )
53
68
  }
54
69
 
@@ -228,7 +228,9 @@ $bracket-border-width: 4px;
228
228
 
229
229
  .layout_participant,
230
230
  .layout_participant_winner,
231
- .layout_participant_self {
231
+ .layout_participant_self,
232
+ .layout_participant_winner_self,
233
+ .layout_participant_winner_self_last {
232
234
  height: 60px;
233
235
  }
234
236
 
@@ -6,85 +6,85 @@ import SectionSeparator from '../../pb_section_separator/_section_separator'
6
6
 
7
7
  const teamData = {
8
8
  eagles: {
9
- avatar:"https://upload.wikimedia.org/wikipedia/en/thumb/8/8e/Philadelphia_Eagles_logo.svg/1920px-Philadelphia_Eagles_logo.svg.png",
9
+ avatar:"https://images.unsplash.com/photo-1628703117067-fb7c9c20946e?w=500&auto=format&fit=crop&q=60&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8Mnx8ZWFnbGVzfGVufDB8fDB8fHww",
10
10
  name:"Eagles",
11
11
  rank:"#1 NFC East",
12
12
  territory:"PHI",
13
13
  },
14
14
  packers: {
15
- avatar:"https://upload.wikimedia.org/wikipedia/commons/thumb/5/50/Green_Bay_Packers_logo.svg/1920px-Green_Bay_Packers_logo.svg.png",
15
+ avatar:"https://images.unsplash.com/photo-1486297678162-eb2a19b0a32d?q=80&w=500&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
16
16
  name:"Packers",
17
17
  rank:"#3 NFC North",
18
18
  territory:"GB",
19
19
  },
20
20
  vikings: {
21
- avatar:"https://upload.wikimedia.org/wikipedia/en/thumb/4/48/Minnesota_Vikings_logo.svg/1024px-Minnesota_Vikings_logo.svg.png",
21
+ avatar:"https://images.unsplash.com/photo-1525540796810-55f9fbc5592f?w=500&auto=format&fit=crop&q=60&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8MTV8fHZpa2luZ3xlbnwwfHwwfHx8MA%3D%3D",
22
22
  name:"Vikings",
23
23
  rank:"#2 NFC North",
24
24
  territory:"MIN",
25
25
  },
26
26
  rams: {
27
- avatar:"https://upload.wikimedia.org/wikipedia/en/thumb/8/8a/Los_Angeles_Rams_logo.svg/1920px-Los_Angeles_Rams_logo.svg.png",
27
+ avatar:"https://images.unsplash.com/photo-1490739043913-239b6cdf4084?q=80&w=500&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
28
28
  name:"Rams",
29
29
  rank:"#1 NFC West",
30
30
  territory:"LAR",
31
31
  },
32
32
  lions: {
33
- avatar:"https://upload.wikimedia.org/wikipedia/en/thumb/7/71/Detroit_Lions_logo.svg/1920px-Detroit_Lions_logo.svg.png",
33
+ avatar:"https://images.unsplash.com/photo-1614027164847-1b28cfe1df60?q=80&w=500&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
34
34
  name:"Lions",
35
35
  rank:"#1 NFC North",
36
36
  territory:"DET",
37
37
  },
38
38
  commanders: {
39
- avatar:"https://upload.wikimedia.org/wikipedia/commons/thumb/0/0c/Washington_Commanders_logo.svg/2560px-Washington_Commanders_logo.svg.png",
39
+ avatar:"https://images.unsplash.com/photo-1501466044931-62695aada8e9?q=80&w=500&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
40
40
  name:"Commanders",
41
41
  rank:"#2 NFC East",
42
42
  territory:"WAS",
43
43
  },
44
44
  buccaneers: {
45
- avatar:"https://upload.wikimedia.org/wikipedia/en/thumb/a/a2/Tampa_Bay_Buccaneers_logo.svg/1920px-Tampa_Bay_Buccaneers_logo.svg.png",
45
+ avatar:"https://images.unsplash.com/photo-1584116843008-46d529f04145?q=80&w=500&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
46
46
  name:"Buccaneers",
47
47
  rank:"#1 NFC South",
48
48
  territory:"TB",
49
49
  },
50
50
  chiefs: {
51
- avatar:"https://upload.wikimedia.org/wikipedia/en/thumb/e/e1/Kansas_City_Chiefs_logo.svg/2560px-Kansas_City_Chiefs_logo.svg.png",
51
+ avatar:"https://plus.unsplash.com/premium_photo-1697729864667-57f5f29e946b?w=500&auto=format&fit=crop&q=60&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8MXx8a2Fuc2FzJTIwY2l0eXxlbnwwfHwwfHx8MA%3D%3D",
52
52
  name:"Chiefs",
53
53
  rank:"#1 AFC West",
54
54
  territory:"KC",
55
55
  },
56
56
  chargers: {
57
- avatar:"https://upload.wikimedia.org/wikipedia/commons/thumb/a/a6/Los_Angeles_Chargers_logo.svg/2560px-Los_Angeles_Chargers_logo.svg.png",
57
+ avatar:"https://images.unsplash.com/photo-1529310399831-ed472b81d589?q=80&w=500&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
58
58
  name:"Chargers",
59
59
  rank:"#2 AFC West",
60
60
  territory:"LAC",
61
61
  },
62
62
  texans: {
63
- avatar:"https://upload.wikimedia.org/wikipedia/en/thumb/2/28/Houston_Texans_logo.svg/1280px-Houston_Texans_logo.svg.png",
63
+ avatar:"https://images.unsplash.com/photo-1545345540-ea5d968030af?q=80&w=500&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
64
64
  name:"Texans",
65
65
  rank:"#1 AFC South",
66
66
  territory:"HOU",
67
67
  },
68
68
  broncos: {
69
- avatar:"https://upload.wikimedia.org/wikipedia/en/thumb/4/44/Denver_Broncos_logo.svg/2560px-Denver_Broncos_logo.svg.png",
69
+ avatar:"https://images.unsplash.com/photo-1553284965-83fd3e82fa5a?q=80&w=500&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
70
70
  name:"Broncos",
71
71
  rank:"#3 AFC West",
72
72
  territory:"DEN",
73
73
  },
74
74
  bills: {
75
- avatar:"https://upload.wikimedia.org/wikipedia/en/thumb/7/77/Buffalo_Bills_logo.svg/1920px-Buffalo_Bills_logo.svg.png",
75
+ avatar:"https://images.unsplash.com/photo-1575414914265-ebc9aa2637f4?q=80&w=500&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
76
76
  name:"Bills",
77
77
  rank:"#1 AFC East",
78
78
  territory:"BUF",
79
79
  },
80
80
  steelers: {
81
- avatar:"https://upload.wikimedia.org/wikipedia/commons/thumb/d/de/Pittsburgh_Steelers_logo.svg/1280px-Pittsburgh_Steelers_logo.svg.png",
81
+ avatar:"https://plus.unsplash.com/premium_photo-1697730155764-cc8ca8f78cbe?w=500&auto=format&fit=crop&q=60&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8MXx8cGl0dHNidXJnaHxlbnwwfHwwfHx8MA%3D%3D",
82
82
  name:"Steelers",
83
83
  rank:"#2 AFC North",
84
84
  territory:"PIT",
85
85
  },
86
86
  ravens: {
87
- avatar:"https://upload.wikimedia.org/wikipedia/en/thumb/1/16/Baltimore_Ravens_logo.svg/2560px-Baltimore_Ravens_logo.svg.png",
87
+ avatar:"https://images.unsplash.com/photo-1433888376991-1297486ba3f5?w=500&auto=format&fit=crop&q=60&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8Mnx8cmF2ZW58ZW58MHx8MHx8fDA%3D",
88
88
  name:"Ravens",
89
89
  rank:"#1 AFC North",
90
90
  territory:"BAL",
@@ -41,11 +41,14 @@ const Game = (props: LayoutGameProps) => {
41
41
  if (numberOfChildren === 2) {
42
42
  const [firstChildWithoutProps, secondChildWithoutProps] = React.Children.toArray(children)
43
43
 
44
- const firstChild = React.cloneElement(firstChildWithoutProps, { hasLastWinnerAndSelf })
45
- const secondChild = React.cloneElement(secondChildWithoutProps, { hasLastWinnerAndSelf })
44
+ const firstChild = React.isValidElement(firstChildWithoutProps) ? React.cloneElement(firstChildWithoutProps, { hasLastWinnerAndSelf }) : firstChildWithoutProps
45
+ const secondChild = React.isValidElement(secondChildWithoutProps) ? React.cloneElement(secondChildWithoutProps, { hasLastWinnerAndSelf }) : secondChildWithoutProps
46
46
 
47
47
  if (React.isValidElement(firstChild) && React.isValidElement(secondChild)) {
48
- if ('winner' in firstChild.props || 'winner' in secondChild.props) {
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
+ ) {
49
52
  hasWinner = true
50
53
  }
51
54
  return (
@@ -43,7 +43,12 @@ export const Participant = (props: LayoutParticipantProps) => {
43
43
  />
44
44
  <Body flexGrow={1}>
45
45
  <Flex justify="between">
46
- <Body color={winner && !isLastWinnerAndSelf ? "success" : "default"}>{winner ? <strong>{name}{self ? ' (You)' : ''}</strong> : name + (self && !isLastWinnerAndSelf ? ' (You)' : '')}</Body>
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>
47
52
  <Body
48
53
  color={winner && !isLastWinnerAndSelf ? "success" : "light"}
49
54
  display="flex"
@@ -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,31 @@ $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
+ &.no_gradient {
92
+ @each $color_name, $color in $overlay_colors {
93
+ .overlay_#{$color_name} {
94
+ @each $name, $size in $overlay_sizes {
95
+ @each $position in $overlay_positions {
96
+ &_#{$position}_#{$name} {
97
+ @include overlay($position, $size, $color, false);
98
+ }
99
+ }
100
+ }
101
+ }
102
+ }
103
+
104
+ @each $key, $value in $opacity {
105
+ &.#{$key} {
106
+ [class^=overlay] {
107
+ opacity: $value;
108
+ }
109
+ }
110
+ }
111
+ }
85
112
  }
@@ -7,7 +7,7 @@ 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
12
  position: string,
13
13
  size: string,
@@ -18,14 +18,16 @@ type OverlayProps = {
18
18
  aria?: { [key: string]: string },
19
19
  className?: string,
20
20
  children: React.ReactNode[] | React.ReactNode,
21
- color: "card_light" | "bg_light" | "card_dark" | "bg_dark",
21
+ color: "card_light" | "bg_light" | "card_dark" | "bg_dark" | "black" | "white" | "success" | "error",
22
22
  data?: { [key: string]: string },
23
23
  dynamic?: false,
24
+ gradient?: boolean,
24
25
  htmlOptions?: { [key: string]: string | number | boolean | (() => void) },
25
26
  id?: string,
26
27
  layout: { [key: string]: string },
28
+ opacity: 'opacity_1' | 'opacity_2' | 'opacity_3' | 'opacity_4' | 'opacity_5' | 'opacity_6' | 'opacity_7' | 'opacity_8' | 'opacity_9' | 'opacity_10',
27
29
  scrollBarNone?: boolean,
28
-
30
+
29
31
  }
30
32
 
31
33
  const Overlay = (props: OverlayProps) => {
@@ -36,15 +38,24 @@ const Overlay = (props: OverlayProps) => {
36
38
  color = "card_light",
37
39
  data = {},
38
40
  dynamic = false,
41
+ gradient = true,
39
42
  htmlOptions = {},
40
43
  id,
41
44
  layout = { "bottom": "full" },
45
+ opacity,
42
46
  scrollBarNone = false,
43
47
  } = props
44
48
 
45
49
  const ariaProps = buildAriaProps(aria)
46
50
  const dataProps = buildDataProps(data)
47
- const classes = classnames(buildCss('pb_overlay'), { 'overlay-hide-scrollbar': scrollBarNone }, globalProps(props), className )
51
+ const classes = classnames(
52
+ buildCss('pb_overlay'),
53
+ { 'overlay-hide-scrollbar': scrollBarNone },
54
+ globalProps(props),
55
+ gradient === false ? 'no_gradient' : '',
56
+ opacity,
57
+ className
58
+ )
48
59
  const htmlProps = buildHtmlProps(htmlOptions)
49
60
  const dynamicInlineProps = globalInlineProps(props)
50
61
 
@@ -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.