playbook_ui 10.18.1 → 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 +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_caption/_caption.jsx +6 -6
- data/app/pb_kits/playbook/pb_caption/_caption.scss +6 -17
- data/app/pb_kits/playbook/pb_caption/_caption_mixin.scss +13 -3
- data/app/pb_kits/playbook/pb_caption/caption.rb +3 -5
- 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 +2 -2
- data/app/pb_kits/playbook/pb_caption/docs/index.js +1 -2
- 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_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_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.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.rb +5 -4
- data/app/pb_kits/playbook/pb_title/title.test.js +29 -0
- data/app/pb_kits/playbook/utilities/_line_height.scss +11 -0
- data/app/pb_kits/playbook/utilities/globalProps.js +7 -1
- data/lib/playbook/classnames.rb +1 -0
- data/lib/playbook/kit_base.rb +2 -0
- data/lib/playbook/line_height.rb +29 -0
- data/lib/playbook/version.rb +2 -2
- metadata +22 -13
- data/app/pb_kits/playbook/pb_caption/docs/_caption_example.html.erb +0 -3
- data/app/pb_kits/playbook/pb_caption/docs/_caption_example.jsx +0 -27
- data/app/pb_kits/playbook/pb_caption/docs/_caption_example.md +0 -1
- 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>
|
@@ -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
|
+
})
|
@@ -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
|
+
|
@@ -63,6 +63,12 @@ const shadowProps = ({ shadow }) => {
|
|
63
63
|
return css
|
64
64
|
}
|
65
65
|
|
66
|
+
const lineHeightProps = ({ lineHeight }) => {
|
67
|
+
let css = ''
|
68
|
+
css += lineHeight ? `line_height_${lineHeight} ` : ''
|
69
|
+
return css
|
70
|
+
}
|
71
|
+
|
66
72
|
const displayProps = ({ display }) => {
|
67
73
|
let css = ''
|
68
74
|
css += display ? `display_${display} ` : ''
|
@@ -78,7 +84,7 @@ const cursorProps = ({ cursor }) => {
|
|
78
84
|
// All Exported as a single function
|
79
85
|
export const globalProps = (props, defaultProps = {}) => {
|
80
86
|
const allProps = { ...props, ...defaultProps }
|
81
|
-
return spacingProps(allProps) + darkProps(allProps) + maxWidthProps(allProps) + zIndexProps(allProps) + numberSpacingProps(allProps) + shadowProps(allProps) +
|
87
|
+
return spacingProps(allProps) + darkProps(allProps) + maxWidthProps(allProps) + zIndexProps(allProps) + numberSpacingProps(allProps) + shadowProps(allProps) + lineHeightProps(allProps) + cursorProps(allProps) + displayProps(allProps)
|
82
88
|
}
|
83
89
|
|
84
90
|
export const deprecatedProps = (kit, props = []) => {
|
data/lib/playbook/classnames.rb
CHANGED
data/lib/playbook/kit_base.rb
CHANGED
@@ -5,6 +5,7 @@ require "playbook/spacing"
|
|
5
5
|
require "playbook/z_index"
|
6
6
|
require "playbook/number_spacing"
|
7
7
|
require "playbook/shadow"
|
8
|
+
require "playbook/line_height"
|
8
9
|
require "playbook/display"
|
9
10
|
require "playbook/cursor"
|
10
11
|
|
@@ -17,6 +18,7 @@ module Playbook
|
|
17
18
|
include Playbook::ZIndex
|
18
19
|
include Playbook::NumberSpacing
|
19
20
|
include Playbook::Shadow
|
21
|
+
include Playbook::LineHeight
|
20
22
|
include Playbook::Display
|
21
23
|
include Playbook::Cursor
|
22
24
|
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Playbook
|
4
|
+
module LineHeight
|
5
|
+
def self.included(base)
|
6
|
+
base.prop :line_height
|
7
|
+
end
|
8
|
+
|
9
|
+
def line_height_props
|
10
|
+
selected_props = line_height_options.keys.select { |sk| try(sk) }
|
11
|
+
return nil unless selected_props.present?
|
12
|
+
|
13
|
+
selected_props.map do |k|
|
14
|
+
line_height_value = send(k)
|
15
|
+
"line_height_#{line_height_value}" if line_height_values.include? line_height_value
|
16
|
+
end.compact.join(" ")
|
17
|
+
end
|
18
|
+
|
19
|
+
def line_height_options
|
20
|
+
{
|
21
|
+
line_height: "line_height",
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
def line_height_values
|
26
|
+
%w[tightest tighter tight normal loose looser loosest]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/playbook/version.rb
CHANGED