playbook_ui 12.14.0 → 12.16.0.pre.alpha.PLAY693tooltipwrongbg532

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_avatar/_avatar.tsx +1 -1
  3. data/app/pb_kits/playbook/pb_avatar/avatar.html.erb +1 -1
  4. data/app/pb_kits/playbook/pb_avatar/avatar.rb +4 -0
  5. data/app/pb_kits/playbook/pb_avatar/avatar.test.js +14 -0
  6. data/app/pb_kits/playbook/pb_avatar/docs/_avatar_default.html.erb +0 -1
  7. data/app/pb_kits/playbook/pb_background/_background.tsx +1 -1
  8. data/app/pb_kits/playbook/pb_background/background.rb +1 -1
  9. data/app/pb_kits/playbook/pb_badge/_badge.scss +1 -0
  10. data/app/pb_kits/playbook/pb_badge/_badge.tsx +1 -1
  11. data/app/pb_kits/playbook/pb_badge/badge.rb +5 -1
  12. data/app/pb_kits/playbook/pb_badge/badge.test.js +16 -1
  13. data/app/pb_kits/playbook/pb_body/_body_mixins.scss +3 -3
  14. data/app/pb_kits/playbook/pb_caption/_caption_mixin.scss +2 -2
  15. data/app/pb_kits/playbook/pb_card/_card.scss +13 -0
  16. data/app/pb_kits/playbook/pb_card/_card.tsx +3 -2
  17. data/app/pb_kits/playbook/pb_card/card_header.rb +9 -1
  18. data/app/pb_kits/playbook/pb_card/docs/_card_header.html.erb +11 -0
  19. data/app/pb_kits/playbook/pb_card/docs/_card_header.jsx +169 -139
  20. data/app/pb_kits/playbook/pb_docs/kit_api.html.erb +295 -8
  21. data/app/pb_kits/playbook/pb_docs/kit_api.rb +42 -0
  22. data/app/pb_kits/playbook/pb_docs/kit_example.html.erb +33 -0
  23. data/app/pb_kits/playbook/pb_docs/kit_example.rb +14 -1
  24. data/app/pb_kits/playbook/pb_enhanced_element/index.ts +1 -1
  25. data/app/pb_kits/playbook/pb_icon_stat_value/_icon_stat_value.tsx +5 -5
  26. data/app/pb_kits/playbook/pb_icon_stat_value/icon_stat_value.html.erb +1 -1
  27. data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.scss +0 -5
  28. data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.rb +0 -4
  29. data/app/pb_kits/playbook/pb_star_rating/{_star_rating.jsx → _star_rating.tsx} +18 -22
  30. data/app/pb_kits/playbook/pb_star_rating/star_rating.test.js +71 -0
  31. data/app/pb_kits/playbook/pb_table/{_table.jsx → _table.tsx} +9 -11
  32. data/app/pb_kits/playbook/pb_table/{_table_row.jsx → _table_row.tsx} +7 -8
  33. data/app/pb_kits/playbook/pb_table/docs/_table_with_background_kit.html.erb +41 -0
  34. data/app/pb_kits/playbook/pb_table/docs/_table_with_background_kit.jsx +62 -0
  35. data/app/pb_kits/playbook/pb_table/docs/example.yml +2 -0
  36. data/app/pb_kits/playbook/pb_table/docs/index.js +1 -0
  37. data/app/pb_kits/playbook/pb_table/{index.js → index.ts} +4 -4
  38. data/app/pb_kits/playbook/pb_textarea/_textarea.tsx +129 -0
  39. data/app/pb_kits/playbook/pb_textarea/{index.js → index.tsx} +2 -0
  40. data/app/pb_kits/playbook/pb_textarea/textarea.test.js +213 -0
  41. data/app/pb_kits/playbook/pb_tooltip/_tooltip.scss +11 -6
  42. data/app/pb_kits/playbook/pb_tooltip/docs/example.yml +0 -1
  43. data/app/pb_kits/playbook/tokens/_colors.scss +16 -1
  44. data/app/pb_kits/playbook/utilities/_cursor.scss +141 -1
  45. data/app/pb_kits/playbook/utilities/globalProps.ts +5 -2
  46. data/lib/playbook/cursor.rb +2 -2
  47. data/lib/playbook/version.rb +2 -2
  48. metadata +17 -15
  49. data/app/pb_kits/playbook/pb_flex/_flex_item.jsx +0 -41
  50. data/app/pb_kits/playbook/pb_textarea/_textarea.jsx +0 -135
  51. data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_white.html.erb +0 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a42d45fa9c0cb3563d9253c5c676edcd535e813873bca8f31162258372554bb9
4
- data.tar.gz: 162a8abeed8d622e81d218e90c6a1d693a17d068d489234cbd0fb39f2c50ac7e
3
+ metadata.gz: f44b91f87a4f93de80836093a1dd1eb7ffe5d77e243727e8d82391ffbb4e5abe
4
+ data.tar.gz: 42e9db818fa3e7f685be9f15f137828a6648e1a1f50ca1ce4fb6d23aa453c095
5
5
  SHA512:
6
- metadata.gz: de1b0f03c8ca91aedae5581617fab0920bde4bfbaa034137021a0f3fe87932a6cb963231f9add0470a606046341d3c5a0b8d3819803ae7eb34af9415f4c340b6
7
- data.tar.gz: e5f9702e6a3f812e3ae0080cc604406fbc7f115f2b1fcf7f83e2537e9502a833d93436abe3f3c9c0795d013791f62ba43631be32298891143a8fbf58728f2ef4
6
+ metadata.gz: f733a9628bb2c9b5a0d56ec89c1e1abd84255ef26489e4ed82fb471b78658e1b3f364402f509981dbd6b96bd538733c14193e12f366b0c70db2c2d518e757cf5
7
+ data.tar.gz: 0d41813f51a41bff2c43f60f18db4b1fcae18e243614783ea680ae817bb9470135cf87c334856a4c97433921549415fa08461dfa7a2ed2008d1b2b1e846859a1
@@ -67,7 +67,7 @@ const Avatar = (props: AvatarProps): React.ReactElement => {
67
67
  >
68
68
  { canShowImage && (
69
69
  <Image
70
- alt={imageAlt}
70
+ alt={imageAlt ? imageAlt : name}
71
71
  onError={handleError}
72
72
  url={imageUrl}
73
73
  />
@@ -4,7 +4,7 @@
4
4
  class: object.classname,
5
5
  aria: object.aria) do %>
6
6
  <%= content_tag(:div, data: { initials: object.initials }, class: "avatar_wrapper") do %>
7
- <%= pb_rails("image", props: { alt: object.image_alt, url: object.image_url, on_error: object.handle_img_error }) if object.image_url.present? %>
7
+ <%= pb_rails("image", props: { alt: object.alt_text, url: object.image_url, on_error: object.handle_img_error }) if object.image_url.present? %>
8
8
  <% end %>
9
9
  <%= pb_rails("online_status", props: object.online_status_props) if object.status %>
10
10
  <% end %>
@@ -25,6 +25,10 @@ module Playbook
25
25
  { status: status, classname: "size_#{size}" }
26
26
  end
27
27
 
28
+ def alt_text
29
+ image_alt.present? ? image_alt : name
30
+ end
31
+
28
32
  def handle_img_error
29
33
  "this.style.display = 'none'"
30
34
  end
@@ -28,3 +28,17 @@ test('loads the given image url and name', () => {
28
28
  expect(image).toHaveAttribute('src', imageUrl)
29
29
  expect(image).toHaveAttribute('alt', imageAlt)
30
30
  })
31
+
32
+ test('uses the name prop as the alt property if no imageAlt prop is passed in', () => {
33
+ render(
34
+ <Avatar
35
+ data={{ testid: testId }}
36
+ imageUrl={imageUrl}
37
+ name={name}
38
+ />
39
+ )
40
+
41
+ const image = screen.getByAltText(name)
42
+
43
+ expect(image).toHaveAttribute('alt', name)
44
+ })
@@ -1,7 +1,6 @@
1
1
  <%= pb_rails("avatar", props: {
2
2
  name: "Terry Johnson",
3
3
  size: "xxs",
4
- image_alt: "Terry Johnson Standing",
5
4
  image_url: "https://randomuser.me/api/portraits/men/44.jpg",
6
5
  status: "away"
7
6
  }) %>
@@ -24,7 +24,7 @@ type BackgroundProps = {
24
24
  id?: string,
25
25
  imageUrl?: string,
26
26
  padding?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl',
27
- tag?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span' | 'div',
27
+ tag?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span' | 'div' | 'tr' | 'th' | 'td',
28
28
  transition?: 'fade' | 'blur' | 'scale',
29
29
  } & GlobalProps
30
30
 
@@ -91,7 +91,7 @@ module Playbook
91
91
  prop :image_url
92
92
 
93
93
  prop :tag, type: Playbook::Props::Enum,
94
- values: %w[h1 h2 h3 h4 h5 h6 p div span],
94
+ values: %w[h1 h2 h3 h4 h5 h6 p div span tr th td],
95
95
  default: "div"
96
96
 
97
97
  prop :transition, type: Playbook::Props::Enum,
@@ -43,6 +43,7 @@
43
43
  @each $color_name, $color_value in $status_colors {
44
44
  &[class*=_#{$color_name}] {
45
45
  background: rgba(mix($bg_dark, $color_value, 10%), $opacity_2);
46
+ color: map-get($status_color_text_dark, $color_name);
46
47
  }
47
48
  }
48
49
  }
@@ -42,7 +42,7 @@ const Badge = (props: BadgeProps) => {
42
42
  const ariaProps = buildAriaProps(aria)
43
43
  const dataProps = buildDataProps(data)
44
44
  const css = classnames(
45
- buildCss('pb_badge_kit', variant, rounded ? 'rounded' : null),
45
+ buildCss('pb_badge_kit', variant === "success" ? "success_sm" : variant, rounded ? 'rounded' : null),
46
46
  globalProps(props),
47
47
  className
48
48
  )
@@ -10,11 +10,15 @@ module Playbook
10
10
  default: "neutral"
11
11
 
12
12
  def classname
13
- generate_classname("pb_badge_kit", variant, rounded_class)
13
+ generate_classname("pb_badge_kit", variant_class, rounded_class)
14
14
  end
15
15
 
16
16
  private
17
17
 
18
+ def variant_class
19
+ variant === "success" ? "success_sm" : variant
20
+ end
21
+
18
22
  def rounded_class
19
23
  rounded ? "rounded" : nil
20
24
  end
@@ -60,7 +60,6 @@ test('displays rounded corners', () => {
60
60
 
61
61
  test('displays color variants', () => {
62
62
  [
63
- "success",
64
63
  "warning",
65
64
  "error",
66
65
  "info"
@@ -78,3 +77,19 @@ test('displays color variants', () => {
78
77
  cleanup()
79
78
  })
80
79
  })
80
+
81
+ test('displays success variant', () => {
82
+ render(
83
+ <Badge
84
+ data={{ testid: testId }}
85
+ text={"success"}
86
+ variant={"success"}
87
+ />
88
+ )
89
+ const kit = screen.getByTestId(testId)
90
+ expect(kit).toHaveClass(`pb_badge_kit_success_sm
91
+ `)
92
+
93
+ cleanup()
94
+
95
+ })
@@ -8,7 +8,7 @@ $pb_body_colors: (
8
8
  lighter: $text_lt_lighter,
9
9
  link: $primary,
10
10
  error: $error,
11
- success: $success,
11
+ success: $text_lt_success_sm,
12
12
  );
13
13
 
14
14
  $pb_dark_body_colors: (
@@ -16,7 +16,7 @@ $pb_dark_body_colors: (
16
16
  light: $text_dk_light,
17
17
  lighter: $text_dk_lighter,
18
18
  error: $error,
19
- success: $success,
19
+ success: $text_dk_success_sm,
20
20
  );
21
21
 
22
22
  // Order is important here!
@@ -24,7 +24,7 @@ $pb_body_status: (
24
24
  default: $text_lt_default,
25
25
  negative: $error,
26
26
  dark_error: $error_dark_body,
27
- positive: $success,
27
+ positive: $text_lt_success_sm,
28
28
  );
29
29
 
30
30
  @mixin pb_body($color: $text_lt_default) {
@@ -6,7 +6,7 @@ $pb_caption_colors: (
6
6
  light: $text_lt_light,
7
7
  link: $primary,
8
8
  lighter: $text_lt_lighter,
9
- success: $success,
9
+ success: $text_lt_success_sm,
10
10
  error: $error,
11
11
  );
12
12
 
@@ -14,7 +14,7 @@ $pb_dark_caption_colors: (
14
14
  default: $text_dk_default,
15
15
  light: $text_dk_light,
16
16
  link: $primary,
17
- success: $success,
17
+ success: $text_dk_success_sm,
18
18
  error: $error,
19
19
  );
20
20
 
@@ -33,6 +33,19 @@
33
33
  color: lightenText($color_value);
34
34
  }
35
35
  }
36
+ @each $color_name, $color_value in $pb_card_header_colors {
37
+ &[class*=_#{$color_name}_striped] {
38
+ @if ((type-of($color_value) == color)) {
39
+ background: repeating-linear-gradient(
40
+ 45deg,
41
+ $color_value,
42
+ $color_value 10px,
43
+ lighten( $color_value, 5% ) 10px,
44
+ lighten( $color_value, 5% ) 20px
45
+ );
46
+ }
47
+ }
48
+ }
36
49
  &[class*=_white] {
37
50
  border-bottom: 1px solid $border_light;
38
51
  }
@@ -28,6 +28,7 @@ type CardPropTypes = {
28
28
 
29
29
  type CardHeaderProps = {
30
30
  headerColor?: BackgroundColors | ProductColors | CategoryColors | "none",
31
+ headerColorStriped?: boolean,
31
32
  children: React.ReactChild[] | React.ReactChild,
32
33
  className?: string,
33
34
  padding?: string,
@@ -41,8 +42,8 @@ type CardBodyProps = {
41
42
 
42
43
  // Header component
43
44
  const Header = (props: CardHeaderProps) => {
44
- const { children, className, headerColor = 'category_1', padding = 'sm' } = props
45
- const headerCSS = buildCss('pb_card_header_kit', `${headerColor}`)
45
+ const { children, className, headerColor = 'category_1', headerColorStriped = false, padding = 'sm' } = props
46
+ const headerCSS = buildCss('pb_card_header_kit', `${headerColor}`, headerColorStriped ? 'striped' : '')
46
47
 
47
48
  const headerSpacing = globalProps(props, { padding })
48
49
 
@@ -5,9 +5,17 @@ module Playbook
5
5
  class CardHeader < Playbook::KitBase
6
6
  prop :header_color, type: Playbook::Props::String,
7
7
  default: "category_1"
8
+ prop :header_color_striped, type: Playbook::Props::Boolean,
9
+ default: false
8
10
 
9
11
  def classname
10
- generate_classname("pb_card_header_kit", header_color)
12
+ generate_classname("pb_card_header_kit", header_color, color_striped_classname)
13
+ end
14
+
15
+ private
16
+
17
+ def color_striped_classname
18
+ header_color_striped ? "striped" : nil
11
19
  end
12
20
  end
13
21
  end
@@ -57,3 +57,14 @@
57
57
  Body
58
58
  <% end %>
59
59
  <% end %>
60
+
61
+ <%= pb_rails("title", props: { text: "Striped Colors", tag: "h4", size: 4, margin_bottom: "sm" }) %>
62
+
63
+ <%= pb_rails("card", props: { padding: "none", header: true, margin_bottom: "sm"}) do %>
64
+ <%= pb_rails("card/card_header", props: { padding: "sm", header_color: "category_1", header_color_striped: true }) do %>
65
+ <%= pb_rails("body", props: { text: "Striped Category 1", dark: true }) %>
66
+ <% end %>
67
+ <%= pb_rails("card/card_body", props: { padding: "md", }) do %>
68
+ Body
69
+ <% end %>
70
+ <% end %>
@@ -1,158 +1,188 @@
1
1
  import React from 'react'
2
-
3
2
  import Card from '../_card'
4
3
  import Title from '../../pb_title/_title'
5
4
  import Body from '../../pb_body/_body'
6
5
 
7
6
  const CardHeader = (props) => {
8
- return (
9
- <div>
10
- <Title
11
- {...props}
12
- marginBottom='sm'
13
- size={4}
14
- tag="h4"
15
- text="Category Colors"
16
- />
7
+ return (
8
+ <>
9
+ <Title
10
+ {...props}
11
+ marginBottom='sm'
12
+ size={4}
13
+ tag="h4"
14
+ text="Category Colors"
15
+ />
16
+
17
+ <Card
18
+ {...props}
19
+ marginBottom='sm'
20
+ padding="none"
21
+ >
22
+ <Card.Header headerColor="category_1" >
23
+ <Body
24
+ dark
25
+ text="Category 1"
26
+ />
27
+ </Card.Header>
28
+ <Card.Body>
29
+ <Body
30
+ {...props}
31
+ text="Body"
32
+ />
33
+ </Card.Body>
34
+ </Card>
35
+
36
+ <Card
37
+ {...props}
38
+ marginBottom='sm'
39
+ padding="none"
40
+ >
41
+ <Card.Header
42
+ headerColor="category_3"
43
+ >
44
+ <Body text="Category 3" />
45
+ </Card.Header>
46
+ <Card.Body
47
+ padding="md"
48
+ >
49
+ <Body
50
+ {...props}
51
+ text="Body"
52
+ />
53
+ </Card.Body>
54
+ </Card>
17
55
 
18
- <Card
19
- {...props}
20
- marginBottom='sm'
21
- padding="none"
22
- >
23
- <Card.Header headerColor="category_1" >
24
- <Body
25
- dark
26
- text="Category 1"
27
- />
28
- </Card.Header>
29
- <Card.Body>
30
- <Body
31
- {...props}
32
- text="Body"
33
- />
34
- </Card.Body>
35
- </Card>
36
56
 
37
- <Card
38
- {...props}
39
- marginBottom='sm'
40
- padding="none"
41
- >
42
- <Card.Header
43
- headerColor="category_3"
44
- >
45
- <Body text="Category 3" />
46
- </Card.Header>
47
- <Card.Body
48
- padding="md"
49
- >
50
- <Body
51
- {...props}
52
- text="Body"
53
- />
54
- </Card.Body>
55
- </Card>
57
+ <Title
58
+ {...props}
59
+ marginBottom='sm'
60
+ size={4}
61
+ tag="h4"
62
+ text="Product Colors"
63
+ />
56
64
 
65
+ <Card
66
+ {...props}
67
+ marginBottom='sm'
68
+ padding="none"
69
+ >
70
+ <Card.Header
71
+ headerColor="product_2_background"
72
+ >
73
+ <Body
74
+ {...props}
75
+ dark
76
+ text="Product 2 Background"
77
+ />
78
+ </Card.Header>
79
+ <Card.Body>
80
+ <Body
81
+ {...props}
82
+ text="Body"
83
+ />
84
+ </Card.Body>
85
+ </Card>
57
86
 
58
- <Title
59
- {...props}
60
- marginBottom='sm'
61
- size={4}
62
- tag="h4"
63
- text="Product Colors"
64
- />
87
+ <Card
88
+ {...props}
89
+ marginBottom='sm'
90
+ padding="none"
91
+ >
92
+ <Card.Header headerColor="product_6_background" >
93
+ <Body
94
+ {...props}
95
+ dark
96
+ text="Product 6 Background"
97
+ />
98
+ </Card.Header>
99
+ <Card.Body>
100
+ <Body
101
+ {...props}
102
+ text="Body"
103
+ />
104
+ </Card.Body>
105
+ </Card>
65
106
 
66
- <Card
67
- {...props}
68
- marginBottom='sm'
69
- padding="none"
70
- >
71
- <Card.Header
72
- headerColor="product_2_background"
73
- >
74
- <Body
75
- {...props}
76
- dark
77
- text="Product 2 Background"
78
- />
79
- </Card.Header>
80
- <Card.Body>
81
- <Body
82
- {...props}
83
- text="Body"
84
- />
85
- </Card.Body>
86
- </Card>
87
107
 
88
- <Card
89
- {...props}
90
- marginBottom='sm'
91
- padding="none"
92
- >
93
- <Card.Header headerColor="product_6_background" >
94
- <Body
95
- {...props}
96
- dark
97
- text="Product 6 Background"
98
- />
99
- </Card.Header>
100
- <Card.Body>
101
- <Body
102
- {...props}
103
- text="Body"
104
- />
105
- </Card.Body>
106
- </Card>
108
+ <Title
109
+ {...props}
110
+ marginBottom='sm'
111
+ size={4}
112
+ tag="h4"
113
+ text="Background Colors"
114
+ />
107
115
 
116
+ <Card
117
+ {...props}
118
+ marginBottom='sm'
119
+ padding="none"
120
+ >
121
+ <Card.Header
122
+ headerColor="white"
123
+ >
124
+ <Body text="White" />
125
+ </Card.Header>
126
+ <Card.Body>
127
+ <Body
128
+ {...props}
129
+ text="Body"
130
+ />
131
+ </Card.Body>
132
+ </Card>
108
133
 
109
- <Title
110
- {...props}
111
- marginBottom='sm'
112
- size={4}
113
- tag="h4"
114
- text="Background Colors"
115
- />
134
+ <Card
135
+ {...props}
136
+ marginBottom='sm'
137
+ padding="none"
138
+ >
139
+ <Card.Header
140
+ headerColor="dark"
141
+ >
142
+ <Body
143
+ dark
144
+ text="Dark"
145
+ />
146
+ </Card.Header>
147
+ <Card.Body>
148
+ <Body
149
+ {...props}
150
+ text="Body"
151
+ />
152
+ </Card.Body>
153
+ </Card>
116
154
 
117
- <Card
118
- {...props}
119
- marginBottom='sm'
120
- padding="none"
121
- >
122
- <Card.Header
123
- headerColor="white"
124
- >
125
- <Body text="White" />
126
- </Card.Header>
127
- <Card.Body>
128
- <Body
129
- {...props}
130
- text="Body"
131
- />
132
- </Card.Body>
133
- </Card>
155
+ <Title
156
+ {...props}
157
+ marginBottom='sm'
158
+ size={4}
159
+ tag="h4"
160
+ text="Striped Colors"
161
+ />
134
162
 
135
- <Card
136
- {...props}
137
- padding="none"
138
- >
139
- <Card.Header
140
- headerColor="dark"
141
- >
142
- <Body
143
- dark
144
- text="Dark"
145
- />
146
- </Card.Header>
147
- <Card.Body>
148
- <Body
149
- {...props}
150
- text="Body"
151
- />
152
- </Card.Body>
153
- </Card>
154
- </div>
155
- )
163
+ <Card
164
+ {...props}
165
+ marginBottom='sm'
166
+ padding="none"
167
+ >
168
+ <Card.Header
169
+ headerColor="category_1"
170
+ headerColorStriped
171
+ >
172
+ <Body
173
+ dark
174
+ text="Striped Category 1"
175
+ />
176
+ </Card.Header>
177
+ <Card.Body>
178
+ <Body
179
+ {...props}
180
+ text="Body"
181
+ />
182
+ </Card.Body>
183
+ </Card>
184
+ </>
185
+ )
156
186
  }
157
187
 
158
188
  export default CardHeader