playbook_ui 7.9.0 → 7.10.0

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/helpers/playbook/pb_doc_helper.rb +30 -0
  3. data/app/pb_kits/playbook/pb_nav/_horizontal_nav.scss +22 -0
  4. data/app/pb_kits/playbook/pb_nav/_subtle_mixin.scss +47 -0
  5. data/app/pb_kits/playbook/pb_nav/_vertical_nav.scss +2 -46
  6. data/app/pb_kits/playbook/pb_nav/docs/_subtle_horizontal_nav.html.erb +6 -0
  7. data/app/pb_kits/playbook/pb_nav/docs/_subtle_horizontal_nav.jsx +33 -0
  8. data/app/pb_kits/playbook/pb_nav/docs/example.yml +2 -0
  9. data/app/pb_kits/playbook/pb_nav/docs/index.js +1 -0
  10. data/app/pb_kits/playbook/pb_stat_change/_stat_change.html.erb +1 -1
  11. data/app/pb_kits/playbook/pb_stat_change/_stat_change.jsx +8 -4
  12. data/app/pb_kits/playbook/pb_stat_change/docs/_stat_change_default.html.erb +1 -1
  13. data/app/pb_kits/playbook/pb_stat_change/docs/_stat_change_unit.html.erb +17 -0
  14. data/app/pb_kits/playbook/pb_stat_change/docs/_stat_change_unit.jsx +28 -0
  15. data/app/pb_kits/playbook/pb_stat_change/docs/_stat_change_unit_two.html.erb +20 -0
  16. data/app/pb_kits/playbook/pb_stat_change/docs/_stat_change_unit_two.jsx +31 -0
  17. data/app/pb_kits/playbook/pb_stat_change/docs/_stat_change_unit_two.md +1 -0
  18. data/app/pb_kits/playbook/pb_stat_change/docs/example.yml +6 -4
  19. data/app/pb_kits/playbook/pb_stat_change/docs/index.js +2 -0
  20. data/app/pb_kits/playbook/pb_stat_change/stat_change.rb +12 -7
  21. data/app/pb_kits/playbook/pb_table/_table.scss +1 -57
  22. data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_row.html.erb +1 -1
  23. data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_row.jsx +1 -1
  24. data/app/pb_kits/playbook/pb_table/styles/_alignment.scss +32 -0
  25. data/app/pb_kits/playbook/pb_table/styles/_all.scss +4 -3
  26. data/app/pb_kits/playbook/pb_table/styles/_side_highlight.scss +24 -0
  27. data/app/pb_kits/playbook/pb_typeahead/_typeahead.jsx +5 -1
  28. data/app/pb_kits/playbook/pb_typeahead/components/Option.jsx +2 -3
  29. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async.html.erb +19 -3
  30. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async.jsx +4 -2
  31. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async.md +10 -2
  32. data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +5 -0
  33. data/app/pb_kits/playbook/react_rails_kits.js +1 -0
  34. data/lib/playbook.rb +1 -0
  35. data/{app/pb_kits → lib}/playbook/props.rb +0 -0
  36. data/{app/pb_kits → lib}/playbook/props/array.rb +0 -0
  37. data/{app/pb_kits → lib}/playbook/props/base.rb +0 -0
  38. data/{app/pb_kits → lib}/playbook/props/boolean.rb +0 -0
  39. data/{app/pb_kits → lib}/playbook/props/date.rb +0 -0
  40. data/{app/pb_kits → lib}/playbook/props/enum.rb +0 -0
  41. data/{app/pb_kits → lib}/playbook/props/hash.rb +0 -0
  42. data/{app/pb_kits → lib}/playbook/props/hash_array.rb +0 -0
  43. data/{app/pb_kits → lib}/playbook/props/number.rb +0 -0
  44. data/{app/pb_kits → lib}/playbook/props/number_array.rb +0 -0
  45. data/{app/pb_kits → lib}/playbook/props/numeric.rb +0 -0
  46. data/{app/pb_kits → lib}/playbook/props/percentage.rb +0 -0
  47. data/{app/pb_kits → lib}/playbook/props/proc.rb +0 -0
  48. data/{app/pb_kits → lib}/playbook/props/string.rb +0 -0
  49. data/lib/playbook/version.rb +1 -1
  50. metadata +30 -22
  51. data/app/pb_kits/playbook/pb_table/styles/_mixins.scss +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cc6561ca5bb803c60af1b1e5b182b704c5c95e2407ad70794a87e98c00e2f419
4
- data.tar.gz: 2415f722f6019ebb3fe19875c18413a06791ef6b8684b36800412872f8fad33f
3
+ metadata.gz: 2dded8961e6cc6308b1d07c4ddc00b8be69244d92b120ab3d1a370f566a7cd37
4
+ data.tar.gz: ac06d5ca306f7ba1103a2d68c7e179a8cabd2984e56c73d9a358a25ebb65213f
5
5
  SHA512:
6
- metadata.gz: c9db1e69e91e3bb2d9fa51227aee7f7268e2eddfc54c40590718b2259140e74c09516cc285ef159fc8d700dc2c2dac8a5e7c36aa8ad154e9082619280654debb
7
- data.tar.gz: a18d76a0c7e2e11eae5e2149e3823af3a2ad497812e4d0073f21ea03fb6ff77b4aa587eb0b87beeb09a7771b97b8bbc131e61e7ac03ea30eaa417e41c16ffb81
6
+ metadata.gz: d726cb9073d2bf80830ed397990203f1faf674b7f2e04e8da01d70a7ac3ad590a111a373904d4b756ff964eb55ef7829454a10313f370f0310f690298c15a85a
7
+ data.tar.gz: d18d68afbb27818521cc240f52d6f05c025f0c23745bf3095a7ec1c848c97e73a784049e4db873ad51f874320b32e5d6dc93e441ce6df62025d23031cf1de5a4
@@ -25,6 +25,10 @@ module Playbook
25
25
  end
26
26
  end
27
27
 
28
+ def delete_dark_mode_cookie
29
+ cookies.delete :dark_mode
30
+ end
31
+
28
32
  def get_samples(kit)
29
33
  sample_yaml = YAML.load_file("#{Playbook::Engine.root}/app/pb_kits/playbook/data/samples.yml")
30
34
  all_samples = []
@@ -167,6 +171,32 @@ module Playbook
167
171
  (!kit.nil? && @kit == link)
168
172
  end
169
173
 
174
+ def format_search_hash(kit)
175
+ label_value_hash = {
176
+ label: kit.to_s.titleize,
177
+ value: @type == "react" || @type.nil? ? "/kits/#{kit}/react" : "/kits/#{kit}",
178
+ }
179
+ label_value_hash
180
+ end
181
+
182
+ def search_list
183
+ all_kits = []
184
+ formatted_kits = []
185
+ MENU["kits"].each do |kit|
186
+ if kit.is_a? Hash
187
+ kit.values[0].each do |sub_kit|
188
+ all_kits.push(sub_kit)
189
+ end
190
+ else
191
+ all_kits.push(kit)
192
+ end
193
+ end
194
+ all_kits.sort!.each do |sorted_kit|
195
+ formatted_kits.push(format_search_hash(sorted_kit))
196
+ end
197
+ formatted_kits
198
+ end
199
+
170
200
  private
171
201
 
172
202
  def get_kit_examples(kit, type)
@@ -2,6 +2,7 @@
2
2
  @import "../tokens/colors";
3
3
  @import "../tokens/animation-curves";
4
4
  @import "../tokens/typography";
5
+ @import "./subtle_mixin";
5
6
 
6
7
  $selector: ".pb_nav_list";
7
8
 
@@ -71,6 +72,27 @@ $selector: ".pb_nav_list";
71
72
  }
72
73
  }
73
74
  }
75
+
76
+ // Subtle Variant
77
+ &[class*=_subtle] {
78
+ @include subtle;
79
+ // Horizontal Overrides
80
+ [class*=pb_nav_list_kit_item] {
81
+ margin: 0;
82
+ }
83
+ [class*=_active] {
84
+ background-color: $active_light;
85
+ &[class*=dark] {
86
+ background-color: rgba($white, $opacity_1);
87
+ }
88
+ [class*=_item_link] {
89
+ [class*=_item_text]{
90
+ color: $primary;
91
+ }
92
+ }
93
+ }
94
+ }
95
+
74
96
  &[class*=dark]{
75
97
  [class*=pb_nav_list_kit_item]{
76
98
  [class*=_link]{
@@ -0,0 +1,47 @@
1
+ @mixin subtle {
2
+ [class*=pb_nav_list_kit_item] {
3
+ list-style: none;
4
+ border-radius: $border_rad_heavier;
5
+ border-bottom: 0;
6
+ margin: $space_xs ($space_sm - 2px);
7
+ [class*=_link] {
8
+ text-decoration: none;
9
+ display: flex;
10
+ align-items: center;
11
+ border: none;
12
+ padding: $space_xs ($space_sm - 2px);
13
+ transition-property: color, background-color;
14
+ transition-duration: 0.15s;
15
+ transition-timing-function: $bezier;
16
+ border-radius: $border_rad_heavier;
17
+ @include pb_body($text_lt_default);
18
+ [class*=_icon_left] {
19
+ margin-right: ($space_xs + 2px);
20
+ color: $text_lt_lighter;
21
+ }
22
+ [class*=_icon_right] {
23
+ margin-left: ($space_xs + 2px);
24
+ color: $text_lt_default;
25
+ }
26
+ [class*=_text] {
27
+ flex: 1;
28
+ font-weight: $regular;
29
+ }
30
+ @media (hover:hover) {
31
+ &:hover {
32
+ background-color: rgba($primary, 0.03);
33
+ [class*=_icon] {
34
+ color: $primary;
35
+ }
36
+ [class*=_text] {
37
+ color: $primary;
38
+ }
39
+ }
40
+ }
41
+ }
42
+ &[class*=_active] [class*=_link] {
43
+ @include pb_title_4;
44
+ color: $primary;
45
+ }
46
+ }
47
+ }
@@ -5,6 +5,7 @@
5
5
  @import "../tokens/typography";
6
6
  @import "../pb_body/body_mixins";
7
7
  @import "../pb_title/title_mixin";
8
+ @import "./subtle_mixin";
8
9
 
9
10
  $selector: ".pb_nav_list";
10
11
 
@@ -85,54 +86,9 @@ $selector: ".pb_nav_list";
85
86
 
86
87
  }
87
88
 
88
-
89
89
  // Subtle Variant
90
90
  &[class*=_subtle] {
91
- [class*=pb_nav_list_kit_item] {
92
- list-style: none;
93
- border-radius: $border_rad_heavier;
94
- border-bottom: 0;
95
- margin: $space_xs ($space_sm - 2px);
96
- [class*=_link] {
97
- text-decoration: none;
98
- display: flex;
99
- align-items: center;
100
- border: none;
101
- padding: $space_xs ($space_sm - 2px);
102
- transition-property: color, background-color;
103
- transition-duration: 0.15s;
104
- transition-timing-function: $bezier;
105
- border-radius: $border_rad_heavier;
106
- @include pb_body($text_lt_default);
107
- [class*=_icon_left] {
108
- margin-right: ($space_xs + 2px);
109
- color: $text_lt_lighter;
110
- }
111
- [class*=_icon_right] {
112
- margin-left: ($space_xs + 2px);
113
- color: $text_lt_default;
114
- }
115
- [class*=_text] {
116
- flex: 1;
117
- font-weight: $regular;
118
- }
119
- @media (hover:hover) {
120
- &:hover {
121
- background-color: rgba($primary, 0.03);
122
- [class*=_icon] {
123
- color: $primary;
124
- }
125
- [class*=_text] {
126
- color: $primary;
127
- }
128
- }
129
- }
130
- }
131
- &[class*=_active] [class*=_link] {
132
- @include pb_title_4;
133
- color: $primary;
134
- }
135
- }
91
+ @include subtle;
136
92
  }
137
93
 
138
94
  // Show Highlight
@@ -0,0 +1,6 @@
1
+ <%= pb_rails("nav", props: { orientation: "horizontal", variant: "subtle" }) do %>
2
+ <%= pb_rails("nav/item", props: { text: "About", link: "#" }) %>
3
+ <%= pb_rails("nav/item", props: { text: "Case Studies", link: "#", active: true }) %>
4
+ <%= pb_rails("nav/item", props: { text: "Service ", link: "#" }) %>
5
+ <%= pb_rails("nav/item", props: { text: "Contacts", link: "#" }) %>
6
+ <% end %>
@@ -0,0 +1,33 @@
1
+ import React from 'react'
2
+ import { Nav } from '../../'
3
+ import NavItem from '../_item.jsx'
4
+
5
+ const SubtleHorizontalNav = () => {
6
+ return (
7
+ <Nav
8
+ link="#"
9
+ orientation="horizontal"
10
+ variant="subtle"
11
+ >
12
+ <NavItem
13
+ link="#"
14
+ text="About"
15
+ />
16
+ <NavItem
17
+ active
18
+ link="#"
19
+ text="Case Studies"
20
+ />
21
+ <NavItem
22
+ link="#"
23
+ text="Service"
24
+ />
25
+ <NavItem
26
+ link="#"
27
+ text="Contacts"
28
+ />
29
+ </Nav>
30
+ )
31
+ }
32
+
33
+ export default SubtleHorizontalNav
@@ -9,6 +9,7 @@ examples:
9
9
  - subtle_with_icons_nav: Subtle With Icons
10
10
  - subtle_no_highlight_nav: Subtle No Highlight
11
11
  - horizontal_nav: Horizontal Nav
12
+ - subtle_horizontal_nav: Subtle Horizontal Nav
12
13
  - block_nav: Block
13
14
  - block_no_title_nav: Without Title
14
15
 
@@ -22,6 +23,7 @@ examples:
22
23
  - subtle_with_icons_nav: Subtle With Icons
23
24
  - subtle_no_highlight_nav: Subtle No Highlight
24
25
  - horizontal_nav: Horizontal Nav
26
+ - subtle_horizontal_nav: Subtle Horizontal Nav
25
27
  - block_nav: Block
26
28
  - block_no_title_nav: Without Title
27
29
 
@@ -1,5 +1,6 @@
1
1
  export { default as DefaultNav } from './_default_nav.jsx'
2
2
  export { default as HorizontalNav } from './_horizontal_nav.jsx'
3
+ export { default as SubtleHorizontalNav } from './_subtle_horizontal_nav.jsx'
3
4
  export { default as BlockNav } from './_block_nav.jsx'
4
5
  export { default as BlockNoTitleNav } from './_block_no_title_nav.jsx'
5
6
  export { default as NoHighlightNav } from './_no_highlight_nav.jsx'
@@ -3,7 +3,7 @@
3
3
  data: object.data,
4
4
  class: object.classname) do %>
5
5
  <%= pb_rails("body", props: { status: object.status }) do %>
6
- <%= pb_rails("icon", props: { fixed_width: true, icon: object.icon }) if object.icon %>
6
+ <%= pb_rails("icon", props: { fixed_width: true, icon: object.returned_icon }) if object.returned_icon %>
7
7
  <%= "#{object.value}%" if object.value %>
8
8
  <% end %>
9
9
  <% end %>
@@ -20,14 +20,18 @@ const iconMap = {
20
20
  type StatChangeProps = {
21
21
  change?: "increase" | "decrease" | "neutral",
22
22
  className?: string,
23
+ icon?: string,
23
24
  id?: string,
24
25
  value?: string | number,
25
26
  }
26
27
 
27
28
  const StatChange = (props: StatChangeProps) => {
28
- const { change = 'neutral', className, id, value } = props
29
+ const { change = 'neutral', className, icon, id, value } = props
29
30
  const status = statusMap[change] || 'neutral'
30
- const icon = iconMap[change]
31
+ let returnedIcon = iconMap[change]
32
+ if (icon) {
33
+ returnedIcon = icon
34
+ }
31
35
 
32
36
  return (
33
37
  <If condition={value}>
@@ -40,10 +44,10 @@ const StatChange = (props: StatChangeProps) => {
40
44
  id={id}
41
45
  >
42
46
  <Body status={status}>
43
- <If condition={icon}>
47
+ <If condition={returnedIcon}>
44
48
  <Icon
45
49
  fixed_width
46
- icon={icon}
50
+ icon={returnedIcon}
47
51
  />
48
52
  {' '}
49
53
  </If>
@@ -1,6 +1,6 @@
1
1
  <%= pb_rails("stat_change", props: {
2
2
  change: "increase",
3
- value: 28.4
3
+ value: 28.4,
4
4
  }) %>
5
5
 
6
6
  <br>
@@ -0,0 +1,17 @@
1
+ <%= pb_rails("stat_change", props: {
2
+ value: 28.4,
3
+ icon: "chart-line",
4
+ }) %>
5
+
6
+ <br>
7
+
8
+ <%= pb_rails("stat_change", props: {
9
+ value: 6.1,
10
+ icon: "chart-line-down",
11
+ }) %>
12
+
13
+ <br>
14
+
15
+ <%= pb_rails("stat_change", props: {
16
+ value: 102,
17
+ }) %>
@@ -0,0 +1,28 @@
1
+ import React from 'react'
2
+ import { StatChange } from '../../'
3
+
4
+ const StatChangeUnit = () => {
5
+ return (
6
+ <div>
7
+ <StatChange
8
+ icon="chart-line"
9
+ value="28.4"
10
+ />
11
+
12
+ <br />
13
+
14
+ <StatChange
15
+ icon="chart-line-down"
16
+ value={6.1}
17
+ />
18
+
19
+ <br />
20
+
21
+ <StatChange
22
+ value={102}
23
+ />
24
+ </div>
25
+ )
26
+ }
27
+
28
+ export default StatChangeUnit
@@ -0,0 +1,20 @@
1
+ <%= pb_rails("stat_change", props: {
2
+ change: "increase",
3
+ value: 28.4,
4
+ icon: "level-up",
5
+ }) %>
6
+
7
+ <br>
8
+
9
+ <%= pb_rails("stat_change", props: {
10
+ change: "decrease",
11
+ value: 6.1,
12
+ icon: "level-down",
13
+ }) %>
14
+
15
+ <br>
16
+
17
+ <%= pb_rails("stat_change", props: {
18
+ change: "neutral",
19
+ value: 102,
20
+ }) %>
@@ -0,0 +1,31 @@
1
+ import React from 'react'
2
+ import { StatChange } from '../../'
3
+
4
+ const StatChangeUnitTwo = () => {
5
+ return (
6
+ <div>
7
+ <StatChange
8
+ change="increase"
9
+ icon="level-up"
10
+ value="28.4"
11
+ />
12
+
13
+ <br />
14
+
15
+ <StatChange
16
+ change="decrease"
17
+ icon="level-down"
18
+ value={6.1}
19
+ />
20
+
21
+ <br />
22
+
23
+ <StatChange
24
+ change="neutral"
25
+ value={102}
26
+ />
27
+ </div>
28
+ )
29
+ }
30
+
31
+ export default StatChangeUnitTwo
@@ -0,0 +1 @@
1
+ Increase colors your icon GREEN & Decrease colors your icon RED.
@@ -1,9 +1,11 @@
1
1
  examples:
2
-
2
+
3
3
  rails:
4
4
  - stat_change_default: Default
5
-
6
-
5
+ - stat_change_unit: Icon
6
+ - stat_change_unit_two: Colors
7
+
7
8
  react:
8
9
  - stat_change_default: Default
9
-
10
+ - stat_change_unit: Icon
11
+ - stat_change_unit_two: Colors
@@ -1 +1,3 @@
1
1
  export { default as StatChangeDefault } from './_stat_change_default.jsx'
2
+ export { default as StatChangeUnit } from './_stat_change_unit.jsx'
3
+ export { default as StatChangeUnitTwo } from './_stat_change_unit_two.jsx'
@@ -10,6 +10,7 @@ module Playbook
10
10
  prop :change, type: Playbook::Props::Enum,
11
11
  values: %w[neutral increase decrease],
12
12
  default: "neutral"
13
+ prop :icon, type: Playbook::Props::String
13
14
  prop :value, type: Playbook::Props::Numeric
14
15
 
15
16
  def status
@@ -23,14 +24,18 @@ module Playbook
23
24
  end
24
25
  end
25
26
 
26
- def icon
27
- case change
28
- when "increase"
29
- "arrow-up"
30
- when "decrease"
31
- "arrow-down"
27
+ def returned_icon
28
+ if icon
29
+ icon
32
30
  else
33
- false
31
+ case change
32
+ when "increase"
33
+ "arrow-up"
34
+ when "decrease"
35
+ "arrow-down"
36
+ else
37
+ false
38
+ end
34
39
  end
35
40
  end
36
41
 
@@ -1,57 +1 @@
1
- @import "styles/all";
2
- @import "../tokens/colors";
3
-
4
- $pb_table_row_kit_side_highlight_colors: map-merge(map-merge($status_colors, $product_colors), $category_colors);
5
-
6
- @mixin pb_table_row_kit_side_highlight($background) {
7
- box-shadow: inset 4px 0 0 0 $background;
8
- border-top: 0px;
9
- }
10
-
11
- [class^=pb_table] {
12
- tbody {
13
- [class^=pb_table_row_kit] {
14
- @each $color_name, $color_value in $pb_table_row_kit_side_highlight_colors {
15
- &[class*=_side_highlight_#{$color_name}] {
16
- td {
17
- &:first-child {
18
- @include pb_table_row_kit_side_highlight($color_value);
19
- }
20
- }
21
- }
22
- }
23
- }
24
- }
25
- tr[align=center] th,
26
- tr th[align=center] {
27
- text-align: center !important;
28
- }
29
-
30
- tr[align=right] th,
31
- tr th[align=right] {
32
- text-align: right !important;
33
- }
34
-
35
- tr[shift=up] {
36
- vertical-align: top;
37
- }
38
- tr[shift=down] {
39
- vertical-align: bottom;
40
- }
41
-
42
- td[shift=up] {
43
- vertical-align: top;
44
- }
45
- td[shift=down] {
46
- vertical-align: bottom;
47
- }
48
-
49
- th[shift=up] {
50
- vertical-align: top;
51
- }
52
-
53
- th[shift=down] {
54
- vertical-align: bottom;
55
- }
56
- }
57
-
1
+ @import "styles/all";
@@ -22,7 +22,7 @@
22
22
  <td>Value 4a</td>
23
23
  <td>Value 5a</td>
24
24
  </tr>
25
- <tr shift="up">
25
+ <tr shift="middle">
26
26
  <td>
27
27
  Value 1b
28
28
  <br/>
@@ -27,7 +27,7 @@ const TableAlignmentShiftRow = () => {
27
27
  <td>{'Value 4a'}</td>
28
28
  <td>{'Value 5a'}</td>
29
29
  </tr>
30
- <tr shift="up">
30
+ <tr shift="middle">
31
31
  <td>
32
32
  {'Value 1b'}
33
33
  <br />
@@ -0,0 +1,32 @@
1
+ [class^=pb_table] {
2
+ tr {
3
+ vertical-align: top;
4
+ }
5
+
6
+ // Text Align
7
+ tr[align=center] th,
8
+ tr th[align=center] {
9
+ text-align: center !important;
10
+ }
11
+ tr[align=right] th,
12
+ tr th[align=right] {
13
+ text-align: right !important;
14
+ }
15
+
16
+ // Column Align
17
+ tr[shift=up],
18
+ td[shift=up],
19
+ th[shift=up] {
20
+ vertical-align: top;
21
+ }
22
+ tr[shift=middle],
23
+ td[shift=middle],
24
+ th[shift=middle] {
25
+ vertical-align: middle;
26
+ }
27
+ tr[shift=down],
28
+ td[shift=down],
29
+ th[shift=down] {
30
+ vertical-align: bottom;
31
+ }
32
+ }
@@ -1,12 +1,13 @@
1
- @import "variables";
2
- @import "mixins";
1
+ @import "../../tokens/colors";
3
2
 
3
+ @import "variables";
4
4
  @import "reset";
5
5
  @import "structure";
6
6
  @import "table-card";
7
7
  @import "content";
8
8
  @import "headers";
9
-
9
+ @import "side_highlight";
10
+ @import "alignment";
10
11
  @import "hover";
11
12
  @import "as-cards";
12
13
  @import "single-line";
@@ -0,0 +1,24 @@
1
+ @import "../../tokens/colors";
2
+
3
+ $pb_table_row_kit_side_highlight_colors: map-merge(map-merge($status_colors, $product_colors), $category_colors);
4
+
5
+ @mixin pb_table_row_kit_side_highlight($background) {
6
+ box-shadow: inset 4px 0 0 0 $background;
7
+ border-top: 0px;
8
+ }
9
+
10
+ [class^=pb_table] {
11
+ tbody {
12
+ [class^=pb_table_row_kit] {
13
+ @each $color_name, $color_value in $pb_table_row_kit_side_highlight_colors {
14
+ &[class*=_side_highlight_#{$color_name}] {
15
+ td {
16
+ &:first-child {
17
+ @include pb_table_row_kit_side_highlight($color_value);
18
+ }
19
+ }
20
+ }
21
+ }
22
+ }
23
+ }
24
+ }
@@ -27,6 +27,8 @@ type Props = {
27
27
  async?: boolean,
28
28
  label?: string,
29
29
  loadOptions?: noop | string,
30
+ getOptionLabel?: () => any,
31
+ getOptionValue?: () => any,
30
32
  name?: string,
31
33
  }
32
34
 
@@ -38,7 +40,6 @@ type Props = {
38
40
  const Typeahead = (props: Props) => {
39
41
  const selectProps = {
40
42
  cacheOptions: true,
41
- defaultOptions: true,
42
43
  components: {
43
44
  Control,
44
45
  ClearIndicator,
@@ -50,6 +51,7 @@ const Typeahead = (props: Props) => {
50
51
  Placeholder,
51
52
  ValueContainer,
52
53
  },
54
+ defaultOptions: true,
53
55
  id: 'react-select-input',
54
56
  isClearable: true,
55
57
  isSearchable: true,
@@ -58,6 +60,8 @@ const Typeahead = (props: Props) => {
58
60
  }
59
61
 
60
62
  if (typeof(props.loadOptions) === 'string') selectProps.loadOptions = get(window, props.loadOptions)
63
+ if (typeof(props.getOptionLabel) === 'string') selectProps.getOptionLabel = get(window, props.getOptionLabel)
64
+ if (typeof(props.getOptionValue) === 'string') selectProps.getOptionValue = get(window, props.getOptionValue)
61
65
 
62
66
  const Tag = props.async ? AsyncSelect : Select
63
67
 
@@ -10,7 +10,6 @@ import {
10
10
  const Option = (props: any) => {
11
11
  const {
12
12
  imageUrl,
13
- label,
14
13
  } = props.data
15
14
 
16
15
  return (
@@ -21,12 +20,12 @@ const Option = (props: any) => {
21
20
  <User
22
21
  align="left"
23
22
  avatarUrl={imageUrl}
24
- name={label}
23
+ name={props.label}
25
24
  orientation="horizontal"
26
25
  />
27
26
  </When>
28
27
  <When condition={!imageUrl}>
29
- {label}
28
+ {props.label}
30
29
  </When>
31
30
  </Choose>
32
31
  </div>
@@ -1,4 +1,13 @@
1
- <%= pb_rails("typeahead", props: { async: true, load_options: 'asyncPillsPromiseOptions', label: "Github Users", name: :foo, pills: true, placeholder: "type the name of a Github user" }) %>
1
+ <%= pb_rails("typeahead", props: {
2
+ async: true,
3
+ get_option_label: 'getOptionLabel',
4
+ get_option_value: 'getOptionValue',
5
+ load_options: 'asyncPillsPromiseOptions',
6
+ label: "Github Users",
7
+ name: :foo,
8
+ pills: true,
9
+ placeholder: "type the name of a Github user"
10
+ }) %>
2
11
 
3
12
  <!-- This section is an example of how to provide load_options prop for using dynamic options -->
4
13
  <%= javascript_tag defer: "defer" do %>
@@ -7,8 +16,8 @@
7
16
  const filterResults = function(results) {
8
17
  return results.items.map(function(result) {
9
18
  return {
10
- label: result.login,
11
- value: result.id,
19
+ name: result.login,
20
+ id: result.id,
12
21
  }
13
22
  })
14
23
  }
@@ -27,4 +36,11 @@
27
36
  }
28
37
  })
29
38
  }
39
+
40
+ window.getOptionLabel = function(option) {
41
+ return option.name;
42
+ }
43
+ window.getOptionValue = function(option) {
44
+ return option.id;
45
+ }
30
46
  <% end %>
@@ -20,8 +20,8 @@ import {
20
20
  const filterResults = (results) =>
21
21
  results.items.map((result) => {
22
22
  return {
23
- label: result.login,
24
- value: result.id,
23
+ name: result.login,
24
+ id: result.id,
25
25
  }
26
26
  })
27
27
 
@@ -71,6 +71,8 @@ const TypeaheadWithPillsAsync = () => {
71
71
  </If>
72
72
  <Typeahead
73
73
  async
74
+ getOptionLabel={(option) => option.name}
75
+ getOptionValue={(option) => option.id}
74
76
  isMulti
75
77
  label="Github Users"
76
78
  loadOptions={promiseOptions}
@@ -4,8 +4,16 @@
4
4
 
5
5
  The prop `load_options`, when used in conjunction with `async: true` and `pills: true`, points to a JavaScript function located within the global window namespace. This function should return a `Promise` which resolves with the list of formatted options as described in prior examples above. This function is identical to the function provided to the React version of this kit. See the code example for more details.
6
6
 
7
- #### React: `loadOptions`
7
+ #### React
8
+
9
+ ##### `loadOptions`
8
10
 
9
11
  **Additional required props: ** `async: true`
10
12
 
11
- [As outlined in the react-select Async docs](https://react-select.com/async), `loadOptions` expects to return a Promise that resolves resolves with the list of formatted options as described in prior examples above. See the code example for more details.
13
+ [As outlined in the react-select Async docs](https://react-select.com/async), `loadOptions` expects to return a Promise that resolves resolves with the list of formatted options as described in prior examples above. See the code example for more details.
14
+
15
+ ##### `getOptionLabel` + `getOptionValue`
16
+
17
+ If your server returns data that requires differing field names other than `label` and `value`
18
+
19
+ See `react-select` docs for more information: https://react-select.com/advanced#replacing-builtins
@@ -8,6 +8,8 @@ module Playbook
8
8
  prop :async, type: Playbook::Props::Boolean,
9
9
  default: false
10
10
  prop :default_options, type: Playbook::Props::HashArray, default: []
11
+ prop :get_option_label
12
+ prop :get_option_value
11
13
  prop :id
12
14
  prop :label
13
15
  prop :load_options
@@ -45,6 +47,9 @@ module Playbook
45
47
  placeholder: placeholder
46
48
  }
47
49
 
50
+ base_options.merge!({getOptionLabel: get_option_label}) if get_option_label.present?
51
+ base_options.merge!({getOptionValue: get_option_value}) if get_option_value.present?
52
+
48
53
  base_options.merge!({
49
54
  async: true,
50
55
  loadOptions: load_options,
@@ -5,3 +5,4 @@ export { default as Legend } from './pb_legend/_legend.jsx'
5
5
  export { default as LineGraph } from './pb_line_graph/_line_graph.jsx'
6
6
  export { default as Typeahead } from './pb_typeahead/_typeahead.jsx'
7
7
  export { default as RichTextEditor } from './pb_rich_text_editor/_rich_text_editor.jsx'
8
+ export { KitSearch, SnippetToggle, DarkModeToggle } from './docs_components'
@@ -2,6 +2,7 @@
2
2
 
3
3
  require "sassc-rails"
4
4
  require "webpacker"
5
+ require "playbook/props"
5
6
  require "playbook/engine"
6
7
 
7
8
  module Playbook
File without changes
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Playbook
4
- VERSION = "7.9.0"
4
+ VERSION = "7.10.0"
5
5
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: playbook_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.9.0
4
+ version: 7.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Power UX
8
8
  - Power Devs
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-12-04 00:00:00.000000000 Z
12
+ date: 2020-12-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -1289,6 +1289,7 @@ files:
1289
1289
  - app/pb_kits/playbook/pb_nav/_nav.html.erb
1290
1290
  - app/pb_kits/playbook/pb_nav/_nav.jsx
1291
1291
  - app/pb_kits/playbook/pb_nav/_nav.scss
1292
+ - app/pb_kits/playbook/pb_nav/_subtle_mixin.scss
1292
1293
  - app/pb_kits/playbook/pb_nav/_vertical_nav.scss
1293
1294
  - app/pb_kits/playbook/pb_nav/docs/_block_nav.html.erb
1294
1295
  - app/pb_kits/playbook/pb_nav/docs/_block_nav.jsx
@@ -1303,6 +1304,8 @@ files:
1303
1304
  - app/pb_kits/playbook/pb_nav/docs/_horizontal_nav.jsx
1304
1305
  - app/pb_kits/playbook/pb_nav/docs/_no_highlight_nav.html.erb
1305
1306
  - app/pb_kits/playbook/pb_nav/docs/_no_highlight_nav.jsx
1307
+ - app/pb_kits/playbook/pb_nav/docs/_subtle_horizontal_nav.html.erb
1308
+ - app/pb_kits/playbook/pb_nav/docs/_subtle_horizontal_nav.jsx
1306
1309
  - app/pb_kits/playbook/pb_nav/docs/_subtle_nav.html.erb
1307
1310
  - app/pb_kits/playbook/pb_nav/docs/_subtle_nav.jsx
1308
1311
  - app/pb_kits/playbook/pb_nav/docs/_subtle_no_highlight_nav.html.erb
@@ -1608,6 +1611,11 @@ files:
1608
1611
  - app/pb_kits/playbook/pb_stat_change/docs/_description.md
1609
1612
  - app/pb_kits/playbook/pb_stat_change/docs/_stat_change_default.html.erb
1610
1613
  - app/pb_kits/playbook/pb_stat_change/docs/_stat_change_default.jsx
1614
+ - app/pb_kits/playbook/pb_stat_change/docs/_stat_change_unit.html.erb
1615
+ - app/pb_kits/playbook/pb_stat_change/docs/_stat_change_unit.jsx
1616
+ - app/pb_kits/playbook/pb_stat_change/docs/_stat_change_unit_two.html.erb
1617
+ - app/pb_kits/playbook/pb_stat_change/docs/_stat_change_unit_two.jsx
1618
+ - app/pb_kits/playbook/pb_stat_change/docs/_stat_change_unit_two.md
1611
1619
  - app/pb_kits/playbook/pb_stat_change/docs/example.yml
1612
1620
  - app/pb_kits/playbook/pb_stat_change/docs/index.js
1613
1621
  - app/pb_kits/playbook/pb_stat_change/stat_change.rb
@@ -1683,14 +1691,15 @@ files:
1683
1691
  - app/pb_kits/playbook/pb_table/docs/example.yml
1684
1692
  - app/pb_kits/playbook/pb_table/docs/index.js
1685
1693
  - app/pb_kits/playbook/pb_table/index.js
1694
+ - app/pb_kits/playbook/pb_table/styles/_alignment.scss
1686
1695
  - app/pb_kits/playbook/pb_table/styles/_all.scss
1687
1696
  - app/pb_kits/playbook/pb_table/styles/_as-cards.scss
1688
1697
  - app/pb_kits/playbook/pb_table/styles/_content.scss
1689
1698
  - app/pb_kits/playbook/pb_table/styles/_headers.scss
1690
1699
  - app/pb_kits/playbook/pb_table/styles/_hover.scss
1691
- - app/pb_kits/playbook/pb_table/styles/_mixins.scss
1692
1700
  - app/pb_kits/playbook/pb_table/styles/_mobile.scss
1693
1701
  - app/pb_kits/playbook/pb_table/styles/_reset.scss
1702
+ - app/pb_kits/playbook/pb_table/styles/_side_highlight.scss
1694
1703
  - app/pb_kits/playbook/pb_table/styles/_single-line.scss
1695
1704
  - app/pb_kits/playbook/pb_table/styles/_structure.scss
1696
1705
  - app/pb_kits/playbook/pb_table/styles/_table-card.scss
@@ -1949,20 +1958,6 @@ files:
1949
1958
  - app/pb_kits/playbook/pb_weekday_stacked/docs/index.js
1950
1959
  - app/pb_kits/playbook/pb_weekday_stacked/weekday_stacked.rb
1951
1960
  - app/pb_kits/playbook/plugins/pb_chart.js
1952
- - app/pb_kits/playbook/props.rb
1953
- - app/pb_kits/playbook/props/array.rb
1954
- - app/pb_kits/playbook/props/base.rb
1955
- - app/pb_kits/playbook/props/boolean.rb
1956
- - app/pb_kits/playbook/props/date.rb
1957
- - app/pb_kits/playbook/props/enum.rb
1958
- - app/pb_kits/playbook/props/hash.rb
1959
- - app/pb_kits/playbook/props/hash_array.rb
1960
- - app/pb_kits/playbook/props/number.rb
1961
- - app/pb_kits/playbook/props/number_array.rb
1962
- - app/pb_kits/playbook/props/numeric.rb
1963
- - app/pb_kits/playbook/props/percentage.rb
1964
- - app/pb_kits/playbook/props/proc.rb
1965
- - app/pb_kits/playbook/props/string.rb
1966
1961
  - app/pb_kits/playbook/react_rails_kits.js
1967
1962
  - app/pb_kits/playbook/tokens/_animation-curves.scss
1968
1963
  - app/pb_kits/playbook/tokens/_border_radius.scss
@@ -1990,13 +1985,27 @@ files:
1990
1985
  - fonts/regular-min.js
1991
1986
  - lib/playbook.rb
1992
1987
  - lib/playbook/engine.rb
1988
+ - lib/playbook/props.rb
1989
+ - lib/playbook/props/array.rb
1990
+ - lib/playbook/props/base.rb
1991
+ - lib/playbook/props/boolean.rb
1992
+ - lib/playbook/props/date.rb
1993
+ - lib/playbook/props/enum.rb
1994
+ - lib/playbook/props/hash.rb
1995
+ - lib/playbook/props/hash_array.rb
1996
+ - lib/playbook/props/number.rb
1997
+ - lib/playbook/props/number_array.rb
1998
+ - lib/playbook/props/numeric.rb
1999
+ - lib/playbook/props/percentage.rb
2000
+ - lib/playbook/props/proc.rb
2001
+ - lib/playbook/props/string.rb
1993
2002
  - lib/playbook/version.rb
1994
2003
  - lib/playbook_ui.rb
1995
2004
  homepage: http://playbook.powerapp.cloud
1996
2005
  licenses:
1997
2006
  - MIT
1998
2007
  metadata: {}
1999
- post_install_message:
2008
+ post_install_message:
2000
2009
  rdoc_options: []
2001
2010
  require_paths:
2002
2011
  - lib
@@ -2011,9 +2020,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
2011
2020
  - !ruby/object:Gem::Version
2012
2021
  version: '0'
2013
2022
  requirements: []
2014
- rubyforge_project:
2015
- rubygems_version: 2.7.3
2016
- signing_key:
2023
+ rubygems_version: 3.1.4
2024
+ signing_key:
2017
2025
  specification_version: 4
2018
2026
  summary: Playbook Design System
2019
2027
  test_files: []