playbook_ui 14.17.0.pre.alpha.PLAY20267223 → 14.17.0.pre.alpha.PLAY20547327

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 (94) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +56 -2
  3. data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableActions.ts +1 -2
  4. data/app/pb_kits/playbook/pb_advanced_table/Utilities/ExpansionControlHelpers.tsx +29 -19
  5. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +7 -0
  6. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +6 -0
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expand_by_depth.jsx +66 -0
  8. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expand_by_depth.md +10 -0
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_columns.jsx +1 -1
  10. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_columns_and_header.jsx +64 -0
  11. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_columns_and_header.md +8 -0
  12. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header.jsx +55 -0
  13. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header.md +3 -0
  14. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header_rails.html.erb +33 -0
  15. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header_rails.md +3 -0
  16. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.html.erb +1 -1
  17. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.jsx +1 -2
  18. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_rails.md +2 -2
  19. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_react.md +1 -1
  20. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_rails.md +6 -2
  21. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_react.md +6 -2
  22. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +6 -2
  23. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +4 -1
  24. data/app/pb_kits/playbook/pb_background/_background.scss +26 -0
  25. data/app/pb_kits/playbook/pb_background/_background.tsx +5 -3
  26. data/app/pb_kits/playbook/pb_background/background.test.js +5 -0
  27. data/app/pb_kits/playbook/pb_background/docs/_background_overlay.jsx +35 -0
  28. data/app/pb_kits/playbook/pb_background/docs/_background_overlay.md +1 -0
  29. data/app/pb_kits/playbook/pb_background/docs/example.yml +1 -0
  30. data/app/pb_kits/playbook/pb_background/docs/index.js +1 -0
  31. data/app/pb_kits/playbook/pb_copy_button/_copy_button.tsx +19 -45
  32. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_hook.jsx +54 -0
  33. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_hook.md +3 -0
  34. data/app/pb_kits/playbook/pb_copy_button/docs/example.yml +1 -0
  35. data/app/pb_kits/playbook/pb_copy_button/docs/index.js +2 -1
  36. data/app/pb_kits/playbook/pb_copy_button/usePBCopy.ts +45 -0
  37. data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +1 -1
  38. data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownOption.tsx +1 -1
  39. data/app/pb_kits/playbook/pb_form_group/_form_group.scss +23 -3
  40. data/app/pb_kits/playbook/pb_form_group/docs/_form_group_select.html.erb +15 -5
  41. data/app/pb_kits/playbook/pb_form_group/docs/_form_group_select.jsx +39 -6
  42. data/app/pb_kits/playbook/pb_layout/_layout.scss +70 -1
  43. data/app/pb_kits/playbook/pb_layout/_layout.tsx +29 -2
  44. data/app/pb_kits/playbook/pb_layout/docs/_layout_bracket.jsx +322 -118
  45. data/app/pb_kits/playbook/pb_layout/docs/_layout_bracket.md +1 -1
  46. data/app/pb_kits/playbook/pb_layout/subcomponents/_game.tsx +74 -43
  47. data/app/pb_kits/playbook/pb_layout/subcomponents/_participant.tsx +79 -0
  48. data/app/pb_kits/playbook/pb_layout/subcomponents/_round.tsx +21 -4
  49. data/app/pb_kits/playbook/pb_overlay/_overlay.scss +49 -22
  50. data/app/pb_kits/playbook/pb_overlay/_overlay.tsx +15 -4
  51. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_color.jsx +63 -0
  52. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_color.md +3 -0
  53. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_default.md +1 -7
  54. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_gradient_opacity.jsx +39 -0
  55. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_gradient_opacity.md +1 -0
  56. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_layout.jsx +40 -0
  57. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_layout.md +5 -0
  58. data/app/pb_kits/playbook/pb_overlay/docs/example.yml +3 -0
  59. data/app/pb_kits/playbook/pb_overlay/docs/index.js +3 -0
  60. data/app/pb_kits/playbook/pb_overlay/overlay.test.jsx +39 -1
  61. data/app/pb_kits/playbook/pb_table/_table.tsx +2 -2
  62. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows.md +3 -1
  63. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows_rails.md +3 -1
  64. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table.md +3 -1
  65. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table_rails.md +3 -1
  66. data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless.html.erb +34 -0
  67. data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless_rails.md +1 -0
  68. data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating.html.erb +36 -0
  69. data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating_rails.md +1 -0
  70. data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating_react.md +1 -1
  71. data/app/pb_kits/playbook/pb_table/docs/example.yml +2 -0
  72. data/app/pb_kits/playbook/pb_table/styles/_collapsible.scss +1 -1
  73. data/app/pb_kits/playbook/pb_table/table.rb +13 -1
  74. data/app/pb_kits/playbook/pb_table/table_header.rb +13 -1
  75. data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +13 -5
  76. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_sanitize.jsx +94 -0
  77. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_sanitize.md +1 -0
  78. data/app/pb_kits/playbook/pb_text_input/docs/example.yml +2 -0
  79. data/app/pb_kits/playbook/pb_text_input/docs/index.js +1 -0
  80. data/app/pb_kits/playbook/pb_text_input/inputMask.ts +8 -1
  81. data/dist/chunks/_typeahead-aRwivA3u.js +22 -0
  82. data/dist/chunks/_weekday_stacked-Bm5175-u.js +45 -0
  83. data/dist/chunks/lib-Cj4H6j1c.js +29 -0
  84. data/dist/chunks/{pb_form_validation-BvNy9Bd6.js → pb_form_validation-Bx1OK6xs.js} +1 -1
  85. data/dist/chunks/vendor.js +1 -1
  86. data/dist/playbook-doc.js +1 -1
  87. data/dist/playbook-rails-react-bindings.js +1 -1
  88. data/dist/playbook-rails.js +1 -1
  89. data/dist/playbook.css +1 -1
  90. data/lib/playbook/version.rb +1 -1
  91. metadata +32 -6
  92. data/dist/chunks/_typeahead-HqfDnjRe.js +0 -22
  93. data/dist/chunks/_weekday_stacked-CPNaHtxQ.js +0 -45
  94. data/dist/chunks/lib-BGzBzFZX.js +0 -29
@@ -25,6 +25,7 @@ type BackgroundProps = {
25
25
  backgroundPosition?: ResponsiveProp<string> | string,
26
26
  backgroundRepeat?: ResponsiveProp<BackgroundRepeat> | BackgroundRepeat,
27
27
  imageUrl?: ResponsiveProp<string> | string,
28
+ imageOverlay?: 'opacity_1' | 'opacity_2' | 'opacity_3' | 'opacity_4' | 'opacity_5' | 'opacity_6' | 'opacity_7' | 'opacity_8' | 'opacity_9' | 'opacity_10',
28
29
  children?: React.ReactChild[] | React.ReactNode,
29
30
  className?: string,
30
31
  customColor?: string,
@@ -83,11 +84,12 @@ const Background = (props: BackgroundProps): React.ReactElement => {
83
84
  data = {},
84
85
  htmlOptions = {},
85
86
  id,
87
+ imageOverlay,
86
88
  imageUrl = '',
87
89
  tag = 'div',
88
90
  transition = '',
89
91
  } = props
90
-
92
+
91
93
  const [responsiveProps, setResponsiveProps] = useState({
92
94
  backgroundSize: getResponsiveValue(backgroundSize),
93
95
  backgroundPosition: getResponsiveValue(backgroundPosition),
@@ -132,6 +134,7 @@ const Background = (props: BackgroundProps): React.ReactElement => {
132
134
  [`pb_background_color_${resBackgroundColor}`]: resBackgroundColor && !customColor,
133
135
  [`pb_background_custom_color`]: !!customColor,
134
136
  },
137
+ imageOverlay ? `imageoverlay_${imageOverlay}` : "",
135
138
  className
136
139
  );
137
140
 
@@ -155,7 +158,7 @@ const Background = (props: BackgroundProps): React.ReactElement => {
155
158
  const ariaProps = buildAriaProps(aria);
156
159
  const dataProps = buildDataProps(data);
157
160
  const htmlProps = buildHtmlProps(htmlOptions);
158
-
161
+
159
162
  return (
160
163
  <Tag
161
164
  {...ariaProps}
@@ -168,7 +171,6 @@ const Background = (props: BackgroundProps): React.ReactElement => {
168
171
  >
169
172
  {children}
170
173
  </Tag>
171
-
172
174
  )
173
175
  }
174
176
 
@@ -37,3 +37,8 @@ test('backgroundSize = auto', () => {
37
37
  const kit = renderKit(Background, props, { classname: "background-image", imageUrl: "https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80", backgroundSize: 'auto' })
38
38
  expect(kit).toHaveStyle('background-size: auto')
39
39
  })
40
+
41
+ test('applies correct overlay class when imageOverlay prop is provided', () => {
42
+ const kit = renderKit(Background, props, { imageOverlay: 'opacity_6' });
43
+ expect(kit).toHaveClass('imageoverlay_opacity_6');
44
+ });
@@ -0,0 +1,35 @@
1
+ import React from 'react'
2
+ import Background from "../../pb_background/_background"
3
+ import Flex from "../../pb_flex/_flex"
4
+ import FlexItem from "../../pb_flex/_flex_item"
5
+ import Title from "../../pb_title/_title"
6
+
7
+ const BackgroundOverlay = (props) => {
8
+ return (
9
+ <Background
10
+ alt="colorful background"
11
+ backgroundColor="category_21"
12
+ className="background lazyload"
13
+ imageOverlay="opacity_2"
14
+ imageUrl="https://unsplash.it/500/400/?image=633"
15
+ {...props}
16
+ >
17
+ <Flex
18
+ orientation="column"
19
+ vertical="center"
20
+ {...props}
21
+ >
22
+ <FlexItem>
23
+ <Title
24
+ dark
25
+ padding="lg"
26
+ size={1}
27
+ text="Background Kit Image"
28
+ />
29
+ </FlexItem>
30
+ </Flex>
31
+ </Background>
32
+ )
33
+ }
34
+
35
+ export default BackgroundOverlay
@@ -0,0 +1 @@
1
+ An overlay can be added to the background image by setting the `imageOverlay` prop and adding a `backgroundColor`. The `imageOverlay` prop can be set to any opacity ranging from `opacity_1` to `opacity_10`.
@@ -19,3 +19,4 @@ examples:
19
19
  - background_status_subtle: Status Subtle
20
20
  - background_category: Category
21
21
  - background_size: Size
22
+ - background_overlay: Overlay
@@ -6,3 +6,4 @@ export { default as BackgroundStatus } from './_background_status.jsx'
6
6
  export { default as BackgroundStatusSubtle } from './_background_status_subtle.jsx'
7
7
  export { default as BackgroundCategory } from './_background_category.jsx'
8
8
  export { default as BackgroundSize } from './_background_size.jsx'
9
+ export { default as BackgroundOverlay } from './_background_overlay.jsx'
@@ -1,5 +1,4 @@
1
-
2
- import React, { useState } from 'react'
1
+ import React from 'react'
3
2
  import classnames from 'classnames'
4
3
  import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
5
4
  import { globalProps } from '../utilities/globalProps'
@@ -7,16 +6,19 @@ import { globalProps } from '../utilities/globalProps'
7
6
  import Button from '../pb_button/_button'
8
7
  import Tooltip from '../pb_tooltip/_tooltip'
9
8
 
9
+ import usePBCopy from './usePBCopy'
10
+
10
11
  type CopyButtonProps = {
11
- aria?: { [key: string]: string },
12
- className?: string,
13
- data?: { [key: string]: string },
14
- id?: string,
15
- from?: string,
16
- text?: string,
17
- tooltipPlacement?: "top" | "right" | "bottom" | "left",
18
- tooltipText?: string,
19
- value?: string,
12
+ aria?: { [key: string]: string }
13
+ className?: string
14
+ data?: { [key: string]: string }
15
+ id?: string
16
+ from?: string
17
+ text?: string
18
+ tooltipPlacement?: 'top' | 'right' | 'bottom' | 'left'
19
+ tooltipText?: string
20
+ value?: string
21
+ timeout?: number
20
22
  }
21
23
 
22
24
  const CopyButton = (props: CopyButtonProps) => {
@@ -27,62 +29,34 @@ const CopyButton = (props: CopyButtonProps) => {
27
29
  from = '',
28
30
  id,
29
31
  text= 'Copy',
32
+ timeout = 1000,
30
33
  tooltipPlacement= 'bottom',
31
34
  tooltipText = 'Copied!',
32
35
  value = '',
33
36
  } = props
34
37
 
35
- const [copied, setCopied] = useState(false)
38
+ const [copied, copy] = usePBCopy({ value, from, timeout })
36
39
 
37
40
  const ariaProps = buildAriaProps(aria)
38
41
  const dataProps = buildDataProps(data)
39
42
  const classes = classnames(buildCss('pb_copy_button_kit'), globalProps(props), className)
40
43
 
41
- const copy = () => {
42
- if (!from && !value) {
43
- return
44
- }
45
-
46
- if (value) {
47
- navigator.clipboard.writeText(value)
48
- } else if (from) {
49
- const copyElement = document.getElementById(from);
50
- let copyText = copyElement?.innerText
51
-
52
- if (copyElement instanceof HTMLTextAreaElement || copyElement instanceof HTMLInputElement) {
53
- copyText = copyElement.value;
54
- }
55
-
56
- if (copyText) {
57
- navigator.clipboard.writeText(copyText)
58
- }
59
- }
60
-
61
- setCopied(true)
62
-
63
- setTimeout(() => {
64
- setCopied(false)
65
- }, 1000);
66
- }
67
-
68
44
  return (
69
- <div
70
- {...ariaProps}
45
+ <div {...ariaProps}
71
46
  {...dataProps}
72
47
  className={classes}
73
48
  id={id}
74
49
  >
75
- <Tooltip
50
+ <Tooltip
76
51
  forceOpenTooltip={copied}
77
52
  placement={tooltipPlacement}
78
53
  showTooltip={false}
79
54
  text={tooltipText}
80
55
  >
81
- <Button
82
- icon='copy'
56
+ <Button icon="copy"
83
57
  onClick={copy}
84
58
  >
85
- { text }
59
+ {text}
86
60
  </Button>
87
61
  </Tooltip>
88
62
  </div>
@@ -0,0 +1,54 @@
1
+ import React, { useEffect, useState } from 'react'
2
+ import usePBCopy from '../../pb_copy_button/usePBCopy'
3
+ import Body from '../../pb_body/_body'
4
+ import Textarea from '../../pb_textarea/_textarea'
5
+ import Tooltip from '../../pb_tooltip/_tooltip'
6
+
7
+ const CopyButtonHook = ({...props}) => {
8
+ // This is how you can use the copy button hook to copy text to the clipboard
9
+ // eslint-disable-next-line no-unused-vars
10
+ const [copied, copyToClipboard] = usePBCopy({ from: 'hookbody' })
11
+ // I added a tooltip so it looks better in the ui
12
+ const [showTooltip, setShowTooltip] = useState(false)
13
+
14
+ const handleCopy = () => {
15
+ copyToClipboard()
16
+ setShowTooltip(true)
17
+ setTimeout(() => setShowTooltip(false), 1500)
18
+ }
19
+
20
+ useEffect(() => {
21
+ const el = document.getElementById('hookbody')
22
+ if (!el) return
23
+
24
+ el.addEventListener('click', handleCopy)
25
+ return () => {
26
+ el.removeEventListener('click', handleCopy)
27
+ }
28
+ }, [copyToClipboard])
29
+
30
+ return (
31
+ <div>
32
+ <Tooltip
33
+ delay={{ close: 1000 }}
34
+ forceOpenTooltip={showTooltip}
35
+ placement="top"
36
+ showTooltip={false}
37
+ text="Copied!"
38
+ >
39
+ <Body
40
+ cursor="pointer"
41
+ id="hookbody"
42
+ text="I'm a custom copy hook! Click this body to copy this text!"
43
+ />
44
+ </Tooltip>
45
+
46
+ <Textarea
47
+ {...props}
48
+ placeholder="Paste here"
49
+ />
50
+ </div>
51
+ )
52
+ }
53
+
54
+ export default CopyButtonHook
@@ -0,0 +1,3 @@
1
+ We provide a `usePBCopy` hook that you can import to your project. This hook will return a function that you can call to copy the text to the clipboard.
2
+
3
+ `usePBCopy({ from: 'your_id' })` will grab the `innerText` from `your_id` element, or `value` if it is an input element.
@@ -6,3 +6,4 @@ examples:
6
6
  react:
7
7
  - copy_button_default: Default
8
8
  - copy_button_from: Copy From
9
+ - copy_button_hook: Copy Hook
@@ -1,2 +1,3 @@
1
1
  export { default as CopyButtonDefault } from './_copy_button_default.jsx'
2
- export { default as CopyButtonFrom } from './_copy_button_from.jsx'
2
+ export { default as CopyButtonFrom } from './_copy_button_from.jsx'
3
+ export { default as CopyButtonHook } from './_copy_button_hook.jsx'
@@ -0,0 +1,45 @@
1
+ import { useState, useRef, useEffect } from 'react'
2
+
3
+ type UsePBCopyProps = {
4
+ value?: string
5
+ from?: string
6
+ timeout?: number
7
+ }
8
+
9
+ export default function usePBCopy({
10
+ value = '',
11
+ from = '',
12
+ timeout = 0,
13
+ }: UsePBCopyProps) {
14
+ const [copied, setCopied] = useState(false)
15
+ const timerRef = useRef<number>()
16
+
17
+ const copy = () => {
18
+ if (!value && !from) return
19
+
20
+ if (value) {
21
+ navigator.clipboard.writeText(value)
22
+ } else {
23
+ const el = document.getElementById(from)
24
+ let text = el?.innerText
25
+ if (el instanceof HTMLTextAreaElement || el instanceof HTMLInputElement) {
26
+ text = el.value
27
+ }
28
+ if (text) navigator.clipboard.writeText(text)
29
+ }
30
+
31
+ setCopied(true)
32
+ window.clearTimeout(timerRef.current)
33
+ timerRef.current = window.setTimeout(() => {
34
+ setCopied(false)
35
+ }, timeout)
36
+ }
37
+
38
+ useEffect(() => {
39
+ return () => {
40
+ window.clearTimeout(timerRef.current)
41
+ }
42
+ }, [])
43
+
44
+ return [copied, copy] as const
45
+ }
@@ -35,7 +35,7 @@ type DropdownProps = {
35
35
  label?: string;
36
36
  onSelect?: (arg: GenericObject) => null;
37
37
  options: GenericObject;
38
- separators: boolean;
38
+ separators?: boolean;
39
39
  triggerRef?: any;
40
40
  variant?: "default" | "subtle";
41
41
  };
@@ -22,7 +22,7 @@ type DropdownOptionProps = {
22
22
  data?: { [key: string]: string };
23
23
  htmlOptions?: { [key: string]: string | number | boolean | (() => void) };
24
24
  id?: string;
25
- key?: string;
25
+ key?: string | number;
26
26
  option?: GenericObject;
27
27
  padding?: string;
28
28
  } & GlobalProps;
@@ -85,11 +85,19 @@
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
- & > [class^=pb_phone_number_input]:not(:first-child) {
100
+ & > [class^=pb_phone_number_input]:not(:first-child), [class^=pb_passphrase]:not(:first-child) {
93
101
  .text_input_wrapper input, [class^=pb_text_input_kit] .text_input_wrapper .text_input {
94
102
  border-bottom-left-radius: 0;
95
103
  border-top-left-radius: 0;
@@ -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] {
@@ -227,4 +243,8 @@
227
243
  padding-left: calc(var(--iti-flag-width) + 1px);
228
244
  }
229
245
  }
246
+
247
+ &:has(> [class^="pb_select"]):has(> .pb_passphrase) [class^="pb_select"] {
248
+ align-self: baseline;
249
+ }
230
250
  }
@@ -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 %>
@@ -1,11 +1,16 @@
1
- import React from 'react'
1
+ import React, {useState} from 'react'
2
2
 
3
3
  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'
8
+ import Passphrase from '../../pb_passphrase/_passphrase'
7
9
 
8
10
  const FormGroupSelect = (props) => {
11
+ const [input, setInput] = useState("");
12
+ const handleChange = (e) => setInput(e.target.value);
13
+
9
14
  const options = [
10
15
  { value: 'Country' },
11
16
  { value: 'Pop' },
@@ -25,7 +30,10 @@ const FormGroupSelect = (props) => {
25
30
  ]
26
31
 
27
32
  return (
28
- <div>
33
+ <Flex
34
+ orientation="column"
35
+ rowGap="md"
36
+ >
29
37
  <FormGroup>
30
38
  <TextInput
31
39
  placeholder="Enter Artist Name"
@@ -37,18 +45,43 @@ const FormGroupSelect = (props) => {
37
45
  {...props}
38
46
  />
39
47
  </FormGroup>
40
- <br />
41
- <br />
42
48
  <FormGroup>
43
49
  <Select
44
50
  blankSelection="Phone"
45
51
  options={phoneOptions}
46
- />
52
+ {...props}
53
+ />
47
54
  <PhoneNumberInput
48
55
  id='default'
56
+ {...props}
49
57
  />
50
58
  </FormGroup>
51
- </div>
59
+ <FormGroup>
60
+ <PhoneNumberInput
61
+ id='default-2'
62
+ {...props}
63
+ />
64
+ <Select
65
+ blankSelection="Phone"
66
+ options={phoneOptions}
67
+ {...props}
68
+ />
69
+ </FormGroup>
70
+ <FormGroup>
71
+ <Select
72
+ blankSelection="Phone"
73
+ options={phoneOptions}
74
+ {...props}
75
+ />
76
+ <Passphrase
77
+ id="my-passphrase"
78
+ label=""
79
+ onChange={handleChange}
80
+ value={input}
81
+ {...props}
82
+ />
83
+ </FormGroup>
84
+ </Flex>
52
85
  )
53
86
  }
54
87
 
@@ -210,10 +210,78 @@ $bracket-border-width: 4px;
210
210
  border-right: $bracket-border-width solid $border_light;
211
211
  }
212
212
 
213
+ .polygon_node {
214
+ position: absolute;
215
+ top: calc(50% - 5px);
216
+ right: -10px;
217
+
218
+ width: 0;
219
+ height: 0;
220
+ border-top: 5px solid transparent;
221
+ border-bottom: 5px solid transparent;
222
+ border-left: 10px solid $border_light;
223
+ }
224
+
213
225
  .layout_round_label {
214
226
  display: none;
215
227
  }
216
228
 
229
+ .layout_participant,
230
+ .layout_participant_winner,
231
+ .layout_participant_self,
232
+ .layout_participant_winner_self,
233
+ .layout_participant_winner_self_last {
234
+ height: 60px;
235
+ }
236
+
237
+ .layout_tbd {
238
+ height: 140px;
239
+ display: flex;
240
+ flex-direction: column;
241
+ justify-content: center;
242
+ }
243
+
244
+ .layout_participant_winner,
245
+ .layout_participant_self,
246
+ .layout_participant_winner_self,
247
+ .layout_participant_winner_self_last {
248
+ position: relative;
249
+
250
+ &::after {
251
+ content: "";
252
+ position: absolute;
253
+ top: 0;
254
+ width: 4px;
255
+ height: 100%;
256
+ }
257
+ }
258
+
259
+ .layout_participant_winner::after {
260
+ right: 0;
261
+ background: $product_6_highlight;
262
+ }
263
+
264
+ .layout_participant_self::after {
265
+ left: 0;
266
+ background: $category_1;
267
+ }
268
+
269
+ .layout_participant_winner_self::after {
270
+ right: 0;
271
+ background: $product_6_highlight;
272
+ }
273
+
274
+ .layout_participant_winner_self_last::after {
275
+ left: 0;
276
+ background: $category_1;
277
+ }
278
+
279
+ .game_separator {
280
+ &::before, &::after {
281
+ height: 2px;
282
+ }
283
+ }
284
+
217
285
  @media (max-width: $screen-md-max) {
218
286
  flex-direction: column;
219
287
  .layout_round_label {
@@ -221,7 +289,8 @@ $bracket-border-width: 4px;
221
289
  }
222
290
  .layout_round .layout_game::after,
223
291
  .connector_container,
224
- .half_box {
292
+ .half_box,
293
+ .polygon_node {
225
294
  display: none !important;
226
295
  }
227
296
  }
@@ -6,6 +6,7 @@ import { GlobalProps, globalProps, globalInlineProps } from '../utilities/global
6
6
 
7
7
  import { Round, RoundLabel } from "./subcomponents/_round";
8
8
  import Game from "./subcomponents/_game";
9
+ import Participant from "./subcomponents/_participant";
9
10
 
10
11
  type LayoutPropTypes = {
11
12
  aria?: {[key: string]: string},
@@ -176,13 +177,38 @@ const Layout = (props: LayoutPropTypes) => {
176
177
  (child: React.ReactElement & {type: {displayName: string}}) => child.type?.displayName !== 'Side'
177
178
  )
178
179
 
179
- const numberOfRounds = Array.isArray(nonSideChildren) ? React.Children.toArray(children).filter(
180
+ const numberOfRounds = Array.isArray(children) ? React.Children.toArray(children).filter(
180
181
  (child) => {
181
182
  return (child as React.ReactElement).type === Layout.Round;
182
183
  }
183
184
  ).length : 0
185
+
186
+ const lastRoundWithSelf = React.Children.toArray(children).filter((child) => {
187
+ if ((child as React.ReactElement).type !== Layout.Round) {
188
+ return false
189
+ }
190
+
191
+ const roundElement = child as React.ReactElement
192
+
193
+ const gameChildren = React.Children.toArray(roundElement.props.children)
194
+
195
+ const hasWinningSelfParticipant = gameChildren.some((gameChild) => {
196
+ const gameElement = gameChild as React.ReactElement
197
+
198
+ const participantChildren = React.Children.toArray(gameElement.props.children)
199
+
200
+ return participantChildren.some((participantChild) => {
201
+ const participantElement = participantChild as React.ReactElement
202
+ const { self } = participantElement.props
203
+ return self === true
204
+ })
205
+ })
206
+
207
+ return hasWinningSelfParticipant
208
+ }).length
209
+
184
210
  const bracketChildren = nonSideChildren.map(child =>
185
- React.isValidElement(child) ? React.cloneElement(child, { numberOfRounds }) : child
211
+ React.isValidElement(child) ? React.cloneElement(child, { numberOfRounds, lastRoundWithSelf }) : child
186
212
  )
187
213
 
188
214
  const filteredProps = {...props}
@@ -219,5 +245,6 @@ Layout.Footer = Footer
219
245
  Layout.Round = Round
220
246
  Layout.Game = Game
221
247
  Layout.RoundLabel = RoundLabel
248
+ Layout.Participant = Participant
222
249
 
223
250
  export default Layout