playbook_ui 10.16.0 → 10.19.0.pre.popover.alpha1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/_playbook.scss +4 -0
- data/app/pb_kits/playbook/pb_background/background.test.js +22 -0
- data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx +3 -0
- data/app/pb_kits/playbook/pb_bar_graph/bar_graph.rb +3 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_colors.html.erb +26 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_colors.jsx +37 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_colors.md +2 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_body/_body.jsx +1 -1
- data/app/pb_kits/playbook/pb_body/_body_mixins.scss +2 -1
- data/app/pb_kits/playbook/pb_body/body.rb +1 -1
- data/app/pb_kits/playbook/pb_body/body.test.js +29 -0
- data/app/pb_kits/playbook/pb_body/docs/_body_light.html.erb +5 -0
- data/app/pb_kits/playbook/pb_body/docs/_body_light.jsx +5 -0
- data/app/pb_kits/playbook/pb_body/docs/_body_light.md +6 -0
- data/app/pb_kits/playbook/pb_button/_button.jsx +3 -3
- data/app/pb_kits/playbook/pb_button/_button.scss +17 -0
- data/app/pb_kits/playbook/pb_button/button.rb +6 -3
- data/app/pb_kits/playbook/pb_button/button.test.js +13 -0
- data/app/pb_kits/playbook/pb_button/docs/_button_size.html.erb +3 -0
- data/app/pb_kits/playbook/pb_button/docs/_button_size.jsx +26 -0
- data/app/pb_kits/playbook/pb_button/docs/_button_size.md +1 -0
- data/app/pb_kits/playbook/pb_button/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_button/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_caption/_caption.jsx +21 -8
- data/app/pb_kits/playbook/pb_caption/_caption.scss +14 -8
- data/app/pb_kits/playbook/pb_caption/_caption_mixin.scss +27 -0
- data/app/pb_kits/playbook/pb_caption/caption.rb +6 -4
- data/app/pb_kits/playbook/pb_caption/caption.test.js +29 -0
- data/app/pb_kits/playbook/pb_caption/docs/_caption_colors.html.erb +3 -0
- data/app/pb_kits/playbook/pb_caption/docs/_caption_colors.jsx +25 -0
- data/app/pb_kits/playbook/pb_caption/docs/_caption_colors.md +6 -0
- data/app/pb_kits/playbook/pb_caption/docs/example.yml +7 -4
- data/app/pb_kits/playbook/pb_caption/docs/index.js +1 -1
- data/app/pb_kits/playbook/pb_card/_card.jsx +1 -3
- data/app/pb_kits/playbook/pb_card/_card.scss +0 -6
- data/app/pb_kits/playbook/pb_card/_card_mixin.scss +1 -8
- data/app/pb_kits/playbook/pb_card/card.html.erb +2 -0
- data/app/pb_kits/playbook/pb_card/card.rb +0 -8
- data/app/pb_kits/playbook/pb_card/docs/_card_background.html.erb +1 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_content.html.erb +3 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_content.jsx +9 -2
- data/app/pb_kits/playbook/pb_circle_chart/circle_chart.rb +4 -0
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_colors.md +2 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_default_date.md +3 -1
- data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js +13 -4
- data/app/pb_kits/playbook/pb_docs/kit_example.rb +4 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb +4 -0
- data/app/pb_kits/playbook/pb_flex/_flex.jsx +4 -0
- data/app/pb_kits/playbook/pb_flex/_flex.scss +17 -1
- data/app/pb_kits/playbook/pb_flex/_flex_item.jsx +6 -2
- data/app/pb_kits/playbook/pb_flex/_flex_item.scss +22 -0
- data/app/pb_kits/playbook/pb_flex/docs/_flex_item.html.erb +12 -1
- data/app/pb_kits/playbook/pb_flex/docs/_flex_item.md +2 -0
- data/app/pb_kits/playbook/pb_flex/docs/_flex_item_align_self.html.erb +89 -0
- data/app/pb_kits/playbook/pb_flex/docs/_flex_item_align_self.jsx +210 -0
- data/app/pb_kits/playbook/pb_flex/docs/_flex_item_align_self.md +5 -0
- data/app/pb_kits/playbook/pb_flex/docs/_flex_item_example.jsx +27 -0
- data/app/pb_kits/playbook/pb_flex/docs/_flex_item_example.md +2 -0
- data/app/pb_kits/playbook/pb_flex/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_flex/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_flex/flex.rb +14 -1
- data/app/pb_kits/playbook/pb_flex/flex_item.rb +16 -1
- data/app/pb_kits/playbook/pb_gauge/_gauge.jsx +3 -0
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_colors.html.erb +12 -0
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_colors.jsx +19 -0
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_colors.md +2 -0
- data/app/pb_kits/playbook/pb_gauge/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_gauge/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_gauge/gauge.rb +2 -0
- data/app/pb_kits/playbook/pb_icon/icon.rb +4 -0
- data/app/pb_kits/playbook/pb_icon_circle/_icon_circle.scss +2 -2
- data/app/pb_kits/playbook/pb_icon_circle/docs/_icon_circle_color.html.erb +1 -1
- data/app/pb_kits/playbook/pb_icon_circle/docs/_icon_circle_color.jsx +1 -1
- data/app/pb_kits/playbook/pb_icon_circle/docs/_icon_circle_color.md +1 -0
- data/app/pb_kits/playbook/pb_icon_circle/icon_circle.rb +1 -1
- data/app/pb_kits/playbook/pb_icon_stat_value/icon_stat_value.rb +2 -0
- data/app/pb_kits/playbook/pb_image/_image.jsx +4 -1
- data/app/pb_kits/playbook/pb_image/_image.scss +24 -8
- data/app/pb_kits/playbook/pb_image/docs/_transition_image.html.erb +54 -0
- data/app/pb_kits/playbook/pb_image/docs/_transition_image.jsx +77 -0
- data/app/pb_kits/playbook/pb_image/docs/_transition_image.md +1 -0
- data/app/pb_kits/playbook/pb_image/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_image/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_image/image.html.erb +1 -1
- data/app/pb_kits/playbook/pb_image/image.rb +8 -1
- data/app/pb_kits/playbook/pb_image/image.test.js +9 -4
- data/app/pb_kits/playbook/pb_line_graph/_line_graph.jsx +4 -1
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_colors.html.erb +26 -0
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_colors.jsx +37 -0
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_colors.md +2 -0
- data/app/pb_kits/playbook/pb_line_graph/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_line_graph/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_line_graph/line_graph.rb +3 -0
- data/app/pb_kits/playbook/pb_list/list.rb +2 -0
- data/app/pb_kits/playbook/pb_nav/_bold_mixin.scss +22 -0
- data/app/pb_kits/playbook/pb_nav/_horizontal_nav.scss +17 -1
- data/app/pb_kits/playbook/pb_nav/_vertical_nav.scss +9 -2
- data/app/pb_kits/playbook/pb_nav/docs/_bold_horizontal_nav.html.erb +6 -0
- data/app/pb_kits/playbook/pb_nav/docs/_bold_horizontal_nav.jsx +39 -0
- data/app/pb_kits/playbook/pb_nav/docs/_bold_vertical_nav.html.erb +6 -0
- data/app/pb_kits/playbook/pb_nav/docs/_bold_vertical_nav.jsx +39 -0
- data/app/pb_kits/playbook/pb_nav/docs/_horizontal_nav.html.erb +1 -1
- data/app/pb_kits/playbook/pb_nav/docs/_subtle_nav.html.erb +1 -1
- data/app/pb_kits/playbook/pb_nav/docs/example.yml +4 -0
- data/app/pb_kits/playbook/pb_nav/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_nav/nav.rb +1 -1
- data/app/pb_kits/playbook/pb_popover/_popover.jsx +2 -4
- data/app/pb_kits/playbook/pb_popover/docs/_popover_close.html.erb +7 -7
- data/app/pb_kits/playbook/pb_popover/docs/_popover_scroll_height.jsx +3 -0
- data/app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx +1 -0
- data/app/pb_kits/playbook/pb_popover/index.js +4 -9
- data/app/pb_kits/playbook/pb_popover/popover.html.erb +1 -1
- data/app/pb_kits/playbook/pb_select/select.rb +3 -0
- data/app/pb_kits/playbook/pb_source/source.rb +3 -0
- data/app/pb_kits/playbook/pb_text_input/_text_input.scss +63 -14
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_error.html.erb +21 -2
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_error.jsx +12 -3
- data/app/pb_kits/playbook/pb_text_input/text_input.rb +2 -0
- data/app/pb_kits/playbook/pb_title/_title.jsx +6 -4
- data/app/pb_kits/playbook/pb_title/_title.scss +5 -5
- data/app/pb_kits/playbook/pb_title/_title_mixin.scss +17 -0
- data/app/pb_kits/playbook/pb_title/docs/_title_colors.html.erb +4 -0
- data/app/pb_kits/playbook/pb_title/docs/_title_colors.jsx +37 -0
- data/app/pb_kits/playbook/pb_title/docs/_title_colors.md +6 -0
- data/app/pb_kits/playbook/pb_title/docs/_title_light.html.erb +4 -1
- data/app/pb_kits/playbook/pb_title/docs/_title_light.md +3 -0
- data/app/pb_kits/playbook/pb_title/docs/example.yml +2 -2
- data/app/pb_kits/playbook/pb_title/docs/index.js +1 -1
- data/app/pb_kits/playbook/pb_title/title.html.erb +4 -2
- data/app/pb_kits/playbook/pb_title/title.rb +5 -4
- data/app/pb_kits/playbook/pb_title/title.test.js +29 -0
- data/app/pb_kits/playbook/plugins/pb_chart.js +16 -24
- data/app/pb_kits/playbook/tokens/_colors.scss +3 -1
- data/app/pb_kits/playbook/utilities/_cursor.scss +3 -0
- data/app/pb_kits/playbook/utilities/_display.scss +23 -0
- data/app/pb_kits/playbook/utilities/_line_height.scss +11 -0
- data/app/pb_kits/playbook/utilities/_shadow.scss +11 -0
- data/app/pb_kits/playbook/utilities/globalProps.js +25 -1
- data/lib/playbook/classnames.rb +4 -0
- data/lib/playbook/cursor.rb +29 -0
- data/lib/playbook/display.rb +29 -0
- data/lib/playbook/engine.rb +0 -1
- data/lib/playbook/kit_base.rb +8 -0
- data/lib/playbook/line_height.rb +29 -0
- data/lib/playbook/markdown/helper.rb +2 -2
- data/lib/playbook/pb_doc_helper.rb +4 -0
- data/lib/playbook/props/base.rb +2 -2
- data/lib/playbook/shadow.rb +29 -0
- data/lib/playbook/version.rb +2 -2
- data/lib/playbook.rb +3 -0
- metadata +62 -23
- data/app/pb_kits/playbook/pb_caption/docs/_caption_variants.html.erb +0 -1
- data/app/pb_kits/playbook/pb_caption/docs/_caption_variants.jsx +0 -17
- data/app/pb_kits/playbook/pb_caption/docs/_caption_variants.md +0 -3
- data/app/pb_kits/playbook/pb_title/docs/_title_variants.html.erb +0 -1
- data/app/pb_kits/playbook/pb_title/docs/_title_variants.jsx +0 -19
- data/app/pb_kits/playbook/pb_title/docs/_title_variants.md +0 -3
@@ -36,15 +36,14 @@ export default class PbPopover extends PbEnhancedElement {
|
|
36
36
|
}
|
37
37
|
|
38
38
|
setTimeout(() => {
|
39
|
-
this.popper.update()
|
40
39
|
this.toggleTooltip()
|
40
|
+
this.popper.update()
|
41
41
|
}, 0)
|
42
42
|
})
|
43
43
|
}
|
44
44
|
|
45
45
|
checkCloseTooltip() {
|
46
46
|
document.querySelector('body').addEventListener('click', ({ target }) => {
|
47
|
-
const isTriggerElement = target.closest(`#${this.triggerElementId}`) !== null
|
48
47
|
const isTooltipElement = target.closest(`#${this.tooltipId}`) !== null
|
49
48
|
|
50
49
|
switch (this.closeOnClick) {
|
@@ -52,21 +51,17 @@ export default class PbPopover extends PbEnhancedElement {
|
|
52
51
|
this.hideTooltip()
|
53
52
|
break
|
54
53
|
case 'outside':
|
55
|
-
if (isTooltipElement) {
|
56
|
-
this.checkCloseTooltip()
|
57
|
-
} else {
|
54
|
+
if (!isTooltipElement) {
|
58
55
|
this.hideTooltip()
|
59
56
|
}
|
60
57
|
break
|
61
58
|
case 'inside':
|
62
|
-
if (isTooltipElement
|
59
|
+
if (isTooltipElement) {
|
63
60
|
this.hideTooltip()
|
64
|
-
} else {
|
65
|
-
this.checkCloseTooltip()
|
66
61
|
}
|
67
62
|
break
|
68
63
|
}
|
69
|
-
}, { once: true })
|
64
|
+
}, { once: true, capture: true })
|
70
65
|
}
|
71
66
|
|
72
67
|
hideTooltip() {
|
@@ -3,7 +3,7 @@
|
|
3
3
|
class: object.classname,
|
4
4
|
data: object.data,
|
5
5
|
id: object.id) do %>
|
6
|
-
<div class="pb_popover_tooltip" id="<%= object.tooltip_id %>" role="tooltip" style="<%= object.z_index_helper %>">
|
6
|
+
<div class="pb_popover_tooltip hide" id="<%= object.tooltip_id %>" role="tooltip" style="<%= object.z_index_helper %>">
|
7
7
|
<div class="pb_popover_body <%= object.width_height_class_helper %> <%= object.popover_spacing_helper %>" style="<%= object.width_height_helper %>">
|
8
8
|
<%= content.presence %>
|
9
9
|
</div>
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# rubocop:disable Style/SingleArgumentDig, Style/HashLikeCase
|
3
4
|
module Playbook
|
4
5
|
module PbSource
|
5
6
|
class Source < Playbook::KitBase
|
@@ -59,3 +60,5 @@ module Playbook
|
|
59
60
|
end
|
60
61
|
end
|
61
62
|
end
|
63
|
+
|
64
|
+
# rubocop:enable Style/SingleArgumentDig, Style/HashLikeCase
|
@@ -88,6 +88,56 @@
|
|
88
88
|
border-color: $error;
|
89
89
|
}
|
90
90
|
}
|
91
|
+
.text_input_wrapper_add_on {
|
92
|
+
.add-on {
|
93
|
+
&-right {
|
94
|
+
.add-on-card {
|
95
|
+
border: 1px solid red;
|
96
|
+
border-left: 0;
|
97
|
+
}
|
98
|
+
}
|
99
|
+
&-left {
|
100
|
+
.add-on-card {
|
101
|
+
border: 1px solid red;
|
102
|
+
border-right: 0;
|
103
|
+
}
|
104
|
+
}
|
105
|
+
}
|
106
|
+
.border {
|
107
|
+
&_left {
|
108
|
+
&_on {
|
109
|
+
.card-right-aligned {
|
110
|
+
border-left: 0;
|
111
|
+
}
|
112
|
+
}
|
113
|
+
&_off {
|
114
|
+
.card-right-aligned {
|
115
|
+
border-left: 0;
|
116
|
+
}
|
117
|
+
.text_input {
|
118
|
+
border-right: 0;
|
119
|
+
padding-right: 0;
|
120
|
+
}
|
121
|
+
}
|
122
|
+
}
|
123
|
+
&_right {
|
124
|
+
&_on {
|
125
|
+
.card-left-aligned {
|
126
|
+
border-right: 0;
|
127
|
+
}
|
128
|
+
}
|
129
|
+
&_off {
|
130
|
+
.card-left-aligned {
|
131
|
+
border-right: 0;
|
132
|
+
}
|
133
|
+
.text_input {
|
134
|
+
border-left: 0;
|
135
|
+
padding-left: 0;
|
136
|
+
}
|
137
|
+
}
|
138
|
+
}
|
139
|
+
}
|
140
|
+
}
|
91
141
|
}
|
92
142
|
&.inline {
|
93
143
|
.text_input_wrapper input::placeholder,
|
@@ -119,7 +169,7 @@
|
|
119
169
|
&-card {
|
120
170
|
height: 45px;
|
121
171
|
margin: 0;
|
122
|
-
padding: 0
|
172
|
+
padding: 0;
|
123
173
|
align-items: center;
|
124
174
|
justify-content: center;
|
125
175
|
width: 45px;
|
@@ -132,15 +182,15 @@
|
|
132
182
|
}
|
133
183
|
&-left {
|
134
184
|
.text_input {
|
135
|
-
border-top-left-radius: 0
|
136
|
-
border-bottom-left-radius: 0
|
185
|
+
border-top-left-radius: 0;
|
186
|
+
border-bottom-left-radius: 0;
|
137
187
|
}
|
138
188
|
}
|
139
189
|
|
140
190
|
&-right {
|
141
191
|
.text_input{
|
142
|
-
border-top-right-radius: 0
|
143
|
-
border-bottom-right-radius: 0
|
192
|
+
border-top-right-radius: 0;
|
193
|
+
border-bottom-right-radius: 0;
|
144
194
|
}
|
145
195
|
}
|
146
196
|
}
|
@@ -148,15 +198,14 @@
|
|
148
198
|
background-color: $focus_input_dark;
|
149
199
|
border-width: 0px;
|
150
200
|
}
|
151
|
-
|
152
201
|
.card-left-aligned {
|
153
|
-
border-top-right-radius: 0
|
154
|
-
border-bottom-right-radius: 0
|
202
|
+
border-top-right-radius: 0;
|
203
|
+
border-bottom-right-radius: 0;
|
155
204
|
}
|
156
205
|
|
157
206
|
.card-right-aligned {
|
158
|
-
border-top-left-radius: 0
|
159
|
-
border-bottom-left-radius: 0
|
207
|
+
border-top-left-radius: 0;
|
208
|
+
border-bottom-left-radius: 0;
|
160
209
|
}
|
161
210
|
|
162
211
|
.border {
|
@@ -165,8 +214,8 @@
|
|
165
214
|
border-right: 0;
|
166
215
|
}
|
167
216
|
.text_input {
|
168
|
-
border-left: 0
|
169
|
-
padding-left: 0
|
217
|
+
border-left: 0;
|
218
|
+
padding-left: 0;
|
170
219
|
}
|
171
220
|
}
|
172
221
|
&_left_on {
|
@@ -184,8 +233,8 @@
|
|
184
233
|
border-left: 0;
|
185
234
|
}
|
186
235
|
.text_input {
|
187
|
-
border-right: 0
|
188
|
-
padding-right: 0
|
236
|
+
border-right: 0;
|
237
|
+
padding-right: 0;
|
189
238
|
}
|
190
239
|
}
|
191
240
|
}
|
@@ -1,2 +1,21 @@
|
|
1
|
-
<%= pb_rails("text_input", props: {
|
2
|
-
|
1
|
+
<%= pb_rails("text_input", props: {
|
2
|
+
add_on: {
|
3
|
+
alignment: "left",
|
4
|
+
border: true,
|
5
|
+
icon: "user"
|
6
|
+
},
|
7
|
+
error: "Please enter a valid email address",
|
8
|
+
label: "Email Address",
|
9
|
+
placeholder: "Enter email address",
|
10
|
+
type: "email"
|
11
|
+
}) %>
|
12
|
+
<%= pb_rails("text_input", props: {
|
13
|
+
add_on: {
|
14
|
+
alignment: "left",
|
15
|
+
border: true,
|
16
|
+
icon: "user"
|
17
|
+
},
|
18
|
+
label: "Confirm Email Address",
|
19
|
+
placeholder: "Confirm email address",
|
20
|
+
type: "email"
|
21
|
+
}) %>
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import React, { useState } from 'react'
|
2
|
-
|
3
|
-
|
4
|
-
} from '../..'
|
2
|
+
|
3
|
+
import TextInput from '../_text_input'
|
5
4
|
|
6
5
|
const TextInputError = (props) => {
|
7
6
|
const [email, setEmail] = useState('')
|
@@ -12,6 +11,7 @@ const TextInputError = (props) => {
|
|
12
11
|
return (
|
13
12
|
<div>
|
14
13
|
<TextInput
|
14
|
+
addOn={{ icon: 'user', alignment: 'left', border: true }}
|
15
15
|
error="Please enter a valid email address"
|
16
16
|
label="Email Address"
|
17
17
|
onChange={handleUpdateEmail}
|
@@ -20,6 +20,15 @@ const TextInputError = (props) => {
|
|
20
20
|
value={email}
|
21
21
|
{...props}
|
22
22
|
/>
|
23
|
+
<TextInput
|
24
|
+
addOn={{ icon: 'user', alignment: 'left', border: true }}
|
25
|
+
label="Confirm Email Address"
|
26
|
+
onChange={handleUpdateEmail}
|
27
|
+
placeholder="Confirm email address"
|
28
|
+
type="email"
|
29
|
+
value={email}
|
30
|
+
{...props}
|
31
|
+
/>
|
23
32
|
</div>
|
24
33
|
)
|
25
34
|
}
|
@@ -3,12 +3,13 @@
|
|
3
3
|
import React from 'react'
|
4
4
|
import classnames from 'classnames'
|
5
5
|
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
6
|
-
import { globalProps } from '../utilities/globalProps.js'
|
6
|
+
import { deprecatedProps, globalProps } from '../utilities/globalProps.js'
|
7
7
|
|
8
8
|
type TitleProps = {
|
9
9
|
aria?: object,
|
10
10
|
children?: array<React.ReactNode> | React.ReactNode,
|
11
11
|
className?: string,
|
12
|
+
color?: "default" | "light" | "lighter" | "success" | "error" | "link",
|
12
13
|
data?: object,
|
13
14
|
id?: string,
|
14
15
|
size?: 1 | 2 | 3 | 4,
|
@@ -18,24 +19,25 @@ type TitleProps = {
|
|
18
19
|
}
|
19
20
|
|
20
21
|
const Title = (props: TitleProps) => {
|
22
|
+
if (props.variant) deprecatedProps('Title', ['variant']) //variant prop is deprecated, use color instead
|
21
23
|
const {
|
22
24
|
aria = {},
|
23
25
|
children,
|
24
26
|
className,
|
27
|
+
color,
|
25
28
|
data = {},
|
26
29
|
id,
|
27
30
|
size = 3,
|
28
31
|
tag = 'h3',
|
29
32
|
text,
|
30
|
-
variant = null,
|
31
33
|
} = props
|
32
34
|
|
33
35
|
const ariaProps = buildAriaProps(aria)
|
34
36
|
const dataProps = buildDataProps(data)
|
35
37
|
const classes = classnames(
|
36
|
-
buildCss('pb_title_kit', size,
|
38
|
+
buildCss('pb_title_kit', size, color),
|
37
39
|
globalProps(props),
|
38
|
-
className
|
40
|
+
className,
|
39
41
|
)
|
40
42
|
const Tag = `${tag}`
|
41
43
|
|
@@ -1,26 +1,26 @@
|
|
1
1
|
@import "../tokens/titles";
|
2
2
|
@import "../tokens/colors";
|
3
|
+
@import './title_mixin';
|
3
4
|
|
4
5
|
[class^=pb_title_kit]{
|
5
6
|
&[class*=_1] {
|
6
7
|
@include pb_title_1;
|
8
|
+
@include title_colors;
|
7
9
|
}
|
8
10
|
|
9
11
|
&[class*=_2] {
|
10
12
|
@include pb_title_2;
|
13
|
+
@include title_colors;
|
11
14
|
}
|
12
15
|
|
13
16
|
&[class*=_3] {
|
14
17
|
@include pb_title_3;
|
18
|
+
@include title_colors;
|
15
19
|
}
|
16
20
|
|
17
21
|
&[class*=_4] {
|
18
22
|
@include pb_title_4;
|
19
|
-
|
20
|
-
&[class*=_link] {
|
21
|
-
color: $primary;
|
22
|
-
}
|
23
|
-
|
23
|
+
@include title_colors;
|
24
24
|
}
|
25
25
|
|
26
26
|
&.dark {
|
@@ -1 +1,18 @@
|
|
1
1
|
@import "../tokens/titles";
|
2
|
+
|
3
|
+
$pb_title_colors: (
|
4
|
+
default: $text_lt_default,
|
5
|
+
light: $text_lt_light,
|
6
|
+
lighter: $text_lt_lighter,
|
7
|
+
success: $success,
|
8
|
+
error: $error,
|
9
|
+
link: $primary
|
10
|
+
);
|
11
|
+
|
12
|
+
@mixin title_colors {
|
13
|
+
@each $name, $color in $pb_title_colors {
|
14
|
+
&[class*=_#{$name}] {
|
15
|
+
color: $color
|
16
|
+
}
|
17
|
+
}
|
18
|
+
}
|
@@ -0,0 +1,4 @@
|
|
1
|
+
<%= pb_rails("title", props: { text: "Default Color", tag: "h1", size: 3 }) %>
|
2
|
+
<%= pb_rails("title", props: { text: "Title Color", tag: "h1", size: 3, color: "link" }) %>
|
3
|
+
<%= pb_rails("title", props: { text: "Title Color", tag: "h1", size: 3, color: "success" }) %>
|
4
|
+
<%= pb_rails("title", props: { text: "Title Color", tag: "h1", size: 3, color: "error" }) %>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
|
3
|
+
import Title from '../_title'
|
4
|
+
|
5
|
+
const TitleColors = (props) => {
|
6
|
+
return (
|
7
|
+
<div>
|
8
|
+
<Title
|
9
|
+
text="Default Color"
|
10
|
+
{...props}
|
11
|
+
/>
|
12
|
+
<Title
|
13
|
+
color="link"
|
14
|
+
size={3}
|
15
|
+
tag="h1"
|
16
|
+
text="Title Color"
|
17
|
+
{...props}
|
18
|
+
/>
|
19
|
+
<Title
|
20
|
+
color="success"
|
21
|
+
size={3}
|
22
|
+
tag="h1"
|
23
|
+
text="Title Color"
|
24
|
+
{...props}
|
25
|
+
/>
|
26
|
+
<Title
|
27
|
+
color="error"
|
28
|
+
size={3}
|
29
|
+
tag="h1"
|
30
|
+
text="Title Color"
|
31
|
+
{...props}
|
32
|
+
/>
|
33
|
+
</div>
|
34
|
+
)
|
35
|
+
}
|
36
|
+
|
37
|
+
export default TitleColors
|
@@ -0,0 +1,6 @@
|
|
1
|
+
##### Prop
|
2
|
+
Title kit will use `default` color by default. Other available colors are:
|
3
|
+
|
4
|
+
*`light` `lighter` `success` `error` `link`
|
5
|
+
|
6
|
+
- These colors are not for standard usage. You can use the color prop to make fixes if colors are not appearing properly, but consult your UX team members if you are deciding to implement it
|
@@ -1,2 +1,2 @@
|
|
1
1
|
export { default as TitleLight } from './_title_light.jsx'
|
2
|
-
export { default as
|
2
|
+
export { default as TitleColors } from './_title_colors.jsx'
|
@@ -3,6 +3,9 @@
|
|
3
3
|
module Playbook
|
4
4
|
module PbTitle
|
5
5
|
class Title < Playbook::KitBase
|
6
|
+
prop :color, type: Playbook::Props::Enum,
|
7
|
+
values: [nil, "default", "light", "lighter", "success", "error", "link"],
|
8
|
+
default: nil
|
6
9
|
prop :size, type: Playbook::Props::Enum,
|
7
10
|
values: [1, 2, 3, 4],
|
8
11
|
default: 3
|
@@ -10,12 +13,10 @@ module Playbook
|
|
10
13
|
values: %w[h1 h2 h3 h4 h5 h6 p div span],
|
11
14
|
default: "h3"
|
12
15
|
prop :text
|
13
|
-
prop :variant,
|
14
|
-
values: [nil, "link"],
|
15
|
-
default: nil
|
16
|
+
prop :variant, deprecated: true
|
16
17
|
|
17
18
|
def classname
|
18
|
-
generate_classname("pb_title_kit", size,
|
19
|
+
generate_classname("pb_title_kit", size, color)
|
19
20
|
end
|
20
21
|
end
|
21
22
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { render, screen } from '../utilities/test-utils'
|
3
|
+
|
4
|
+
import Title from './_title'
|
5
|
+
|
6
|
+
test('returns namespaced class name', () => {
|
7
|
+
render(
|
8
|
+
<Title
|
9
|
+
data={{ testid: 'primary-test' }}
|
10
|
+
text="Test colors"
|
11
|
+
/>
|
12
|
+
)
|
13
|
+
|
14
|
+
const kit = screen.getByTestId('primary-test')
|
15
|
+
expect(kit).toHaveClass('pb_title_kit_3')
|
16
|
+
})
|
17
|
+
|
18
|
+
test('with colors', () => {
|
19
|
+
render(
|
20
|
+
<Title
|
21
|
+
color="success"
|
22
|
+
data={{ testid: 'primary-test' }}
|
23
|
+
text="Test colors"
|
24
|
+
/>
|
25
|
+
)
|
26
|
+
|
27
|
+
const kit = screen.getByTestId('primary-test')
|
28
|
+
expect(kit).toHaveClass('pb_title_kit_3_success')
|
29
|
+
})
|
@@ -10,25 +10,14 @@ import solidGauge from 'highcharts/modules/solid-gauge'
|
|
10
10
|
pie(Highcharts)
|
11
11
|
|
12
12
|
// Map Data Color String Props to our SCSS Variables
|
13
|
+
|
13
14
|
const mapColors = (array) => {
|
15
|
+
const regex = /(data)\-[1-8]/ //eslint-disable-line
|
16
|
+
|
14
17
|
const newArray = array.map((item) => {
|
15
|
-
return item
|
16
|
-
? `${colors.
|
17
|
-
: item
|
18
|
-
? `${colors.data_2}`
|
19
|
-
: item == 'data-3'
|
20
|
-
? `${colors.data_3}`
|
21
|
-
: item == 'data-4'
|
22
|
-
? `${colors.data_4}`
|
23
|
-
: item == 'data-5'
|
24
|
-
? `${colors.data_5}`
|
25
|
-
: item == 'data-6'
|
26
|
-
? `${colors.data_6}`
|
27
|
-
: item == 'data-7'
|
28
|
-
? `${colors.data_7}`
|
29
|
-
: item == 'data-8'
|
30
|
-
? `${colors.data_8}`
|
31
|
-
: ''
|
18
|
+
return regex.test(item)
|
19
|
+
? `${colors[`data_${item[item.length - 1]}`]}`
|
20
|
+
: item
|
32
21
|
})
|
33
22
|
return newArray
|
34
23
|
}
|
@@ -72,13 +61,13 @@ class pbChart {
|
|
72
61
|
if (this.options.type == 'variablepie' || this.options.type == 'pie'){
|
73
62
|
this.setupPieChart(options)
|
74
63
|
} else if (this.options.type == 'gauge') {
|
75
|
-
this.setupGauge()
|
64
|
+
this.setupGauge(options)
|
76
65
|
} else {
|
77
|
-
this.setupChart()
|
66
|
+
this.setupChart(options)
|
78
67
|
}
|
79
68
|
}
|
80
69
|
|
81
|
-
setupGauge() {
|
70
|
+
setupGauge(options) {
|
82
71
|
highchartsMore(Highcharts)
|
83
72
|
solidGauge(Highcharts)
|
84
73
|
Highcharts.setOptions(highchartsTheme)
|
@@ -128,19 +117,21 @@ class pbChart {
|
|
128
117
|
pointFormat: this.defaults.tooltipHtml,
|
129
118
|
followPointer: true,
|
130
119
|
},
|
120
|
+
colors: options.colors !== undefined && options.colors.length > 0 ? mapColors(options.colors) : highchartsTheme.colors,
|
131
121
|
plotOptions: {
|
132
122
|
series: {
|
133
123
|
animation: !this.defaults.disableAnimation,
|
134
124
|
},
|
135
125
|
solidgauge: {
|
126
|
+
borderColor: options.colors !== undefined && options.colors.length === 1 ? mapColors(options.colors).join() : highchartsTheme.colors[0],
|
136
127
|
dataLabels: {
|
137
128
|
format: `<span class="prefix">${this.defaults.prefix}</span>` +
|
138
129
|
'<span class="fix">{y:,f}</span>' +
|
139
130
|
`<span class="suffix">${this.defaults.suffix}</span>`,
|
140
|
-
},
|
141
|
-
},
|
131
|
+
} },
|
142
132
|
},
|
143
|
-
}
|
133
|
+
},
|
134
|
+
)
|
144
135
|
document.querySelectorAll('.gauge-pane').forEach((pane) => pane.setAttribute('stroke-linejoin', 'round'))
|
145
136
|
if (document.querySelector('.prefix')) {
|
146
137
|
document.querySelectorAll('.prefix').forEach((prefix) => prefix.setAttribute('y', '28'))
|
@@ -195,7 +186,7 @@ class pbChart {
|
|
195
186
|
})
|
196
187
|
}
|
197
188
|
|
198
|
-
setupChart() {
|
189
|
+
setupChart(options) {
|
199
190
|
Highcharts.setOptions(highchartsTheme)
|
200
191
|
|
201
192
|
const configOptions = {
|
@@ -222,6 +213,7 @@ class pbChart {
|
|
222
213
|
legend: {
|
223
214
|
enabled: this.defaults.legend,
|
224
215
|
},
|
216
|
+
colors: options.colors !== undefined && options.colors.length > 0 ? mapColors(options.colors) : highchartsTheme.colors,
|
225
217
|
plotOptions: {
|
226
218
|
series: {
|
227
219
|
pointStart: this.defaults.pointStart,
|
@@ -12,6 +12,7 @@ $red: #FF2229;
|
|
12
12
|
$yellow: #F9BB00;
|
13
13
|
$green: #00CA74;
|
14
14
|
$orange: #FD804C;
|
15
|
+
$default: #93a8b8;
|
15
16
|
$colors: (
|
16
17
|
royal: $royal,
|
17
18
|
purple: $purple,
|
@@ -19,7 +20,8 @@ $colors: (
|
|
19
20
|
red: $red,
|
20
21
|
yellow: $yellow,
|
21
22
|
green: $green,
|
22
|
-
orange: $orange
|
23
|
+
orange: $orange,
|
24
|
+
default: $default,
|
23
25
|
);
|
24
26
|
|
25
27
|
/* Specialty Gradient -----------------*/
|
@@ -0,0 +1,23 @@
|
|
1
|
+
.display_block {
|
2
|
+
display: block;
|
3
|
+
}
|
4
|
+
|
5
|
+
.display_inline_block {
|
6
|
+
display: inline-block;
|
7
|
+
}
|
8
|
+
|
9
|
+
.display_inline {
|
10
|
+
display: inline;
|
11
|
+
}
|
12
|
+
|
13
|
+
.display_flex {
|
14
|
+
display: flex;
|
15
|
+
}
|
16
|
+
|
17
|
+
.display_inline_flex {
|
18
|
+
display: inline-flex;
|
19
|
+
}
|
20
|
+
|
21
|
+
.display_hidden {
|
22
|
+
display: none;
|
23
|
+
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
@import "../tokens/exports/line_height";
|
2
|
+
|
3
|
+
@mixin line-height-classes($line-height-list) {
|
4
|
+
@each $name, $line-height in $line-height-list {
|
5
|
+
[class*=pb_] .line_height_#{$name} {
|
6
|
+
line-height: $line-height;
|
7
|
+
}
|
8
|
+
}
|
9
|
+
}
|
10
|
+
@include line-height-classes($line_height);
|
11
|
+
|