playbook_ui 10.18.2 → 10.19.0.pre.lightbox
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 +2 -0
- data/app/pb_kits/playbook/data/menu.yml +1 -0
- data/app/pb_kits/playbook/index.js +2 -1
- 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_lightbox/Carousel/Slide.jsx +53 -0
- data/app/pb_kits/playbook/pb_lightbox/Carousel/Slides.jsx +54 -0
- data/app/pb_kits/playbook/pb_lightbox/Carousel/Thumbnail.jsx +39 -0
- data/app/pb_kits/playbook/pb_lightbox/Carousel/Thumbnails.jsx +82 -0
- data/app/pb_kits/playbook/pb_lightbox/Carousel/index.jsx +54 -0
- data/app/pb_kits/playbook/pb_lightbox/Carousel/styles.scss +110 -0
- data/app/pb_kits/playbook/pb_lightbox/Carousel/useSlides.js +66 -0
- data/app/pb_kits/playbook/pb_lightbox/Carousel/useUnscrollableBody.js +11 -0
- data/app/pb_kits/playbook/pb_lightbox/_lightbox.jsx +81 -0
- data/app/pb_kits/playbook/pb_lightbox/docs/_lightbox_default.jsx +65 -0
- data/app/pb_kits/playbook/pb_lightbox/docs/_lightbox_default.md +1 -0
- data/app/pb_kits/playbook/pb_lightbox/docs/_lightbox_multiple.jsx +65 -0
- data/app/pb_kits/playbook/pb_lightbox/docs/example.yml +6 -0
- data/app/pb_kits/playbook/pb_lightbox/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_lightbox/hooks/useToggler.js +10 -0
- data/app/pb_kits/playbook/pb_lightbox/hooks/useVisibility.js +21 -0
- data/app/pb_kits/playbook/pb_lightbox/hooks/useWindowSize.js +25 -0
- data/app/pb_kits/playbook/pb_lightbox/lightbox.scss +92 -0
- data/app/pb_kits/playbook/pb_lightbox/lightbox.test.jsx +30 -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/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_text_input/_text_input.scss +62 -13
- 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.html.erb +2 -3
- 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/playbook-doc.js +2 -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 +1 -1
- metadata +41 -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
@@ -0,0 +1,39 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
|
3
|
+
import Nav from '../_nav'
|
4
|
+
import NavItem from '../_item'
|
5
|
+
|
6
|
+
const BoldHorizontalNav = (props) => {
|
7
|
+
return (
|
8
|
+
<Nav
|
9
|
+
link="#"
|
10
|
+
orientation="horizontal"
|
11
|
+
variant="bold"
|
12
|
+
{...props}
|
13
|
+
>
|
14
|
+
<NavItem
|
15
|
+
link="#"
|
16
|
+
text="About"
|
17
|
+
{...props}
|
18
|
+
/>
|
19
|
+
<NavItem
|
20
|
+
active
|
21
|
+
link="#"
|
22
|
+
text="Case Studies"
|
23
|
+
{...props}
|
24
|
+
/>
|
25
|
+
<NavItem
|
26
|
+
link="#"
|
27
|
+
text="Service"
|
28
|
+
{...props}
|
29
|
+
/>
|
30
|
+
<NavItem
|
31
|
+
link="#"
|
32
|
+
text="Contacts"
|
33
|
+
{...props}
|
34
|
+
/>
|
35
|
+
</Nav>
|
36
|
+
)
|
37
|
+
}
|
38
|
+
|
39
|
+
export default BoldHorizontalNav
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<%= pb_rails("nav", props: { orientation: "vertical", variant: "bold" }) 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,39 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
|
3
|
+
import Nav from '../_nav'
|
4
|
+
import NavItem from '../_item'
|
5
|
+
|
6
|
+
const BoldVerticalNav = (props) => {
|
7
|
+
return (
|
8
|
+
<Nav
|
9
|
+
link="#"
|
10
|
+
orientation="vertical"
|
11
|
+
variant="bold"
|
12
|
+
{...props}
|
13
|
+
>
|
14
|
+
<NavItem
|
15
|
+
link="#"
|
16
|
+
text="About"
|
17
|
+
{...props}
|
18
|
+
/>
|
19
|
+
<NavItem
|
20
|
+
active
|
21
|
+
link="#"
|
22
|
+
text="Case Studies"
|
23
|
+
{...props}
|
24
|
+
/>
|
25
|
+
<NavItem
|
26
|
+
link="#"
|
27
|
+
text="Service"
|
28
|
+
{...props}
|
29
|
+
/>
|
30
|
+
<NavItem
|
31
|
+
link="#"
|
32
|
+
text="Contacts"
|
33
|
+
{...props}
|
34
|
+
/>
|
35
|
+
</Nav>
|
36
|
+
)
|
37
|
+
}
|
38
|
+
|
39
|
+
export default BoldVerticalNav
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= pb_rails("nav", props: { orientation: "horizontal"}) do %>
|
1
|
+
<%= pb_rails("nav", props: { orientation: "horizontal" }) do %>
|
2
2
|
<%= pb_rails("nav/item", props: { text: "About", link: "#" }) %>
|
3
3
|
<%= pb_rails("nav/item", props: { text: "Case Studies", link: "#", active: true }) %>
|
4
4
|
<%= pb_rails("nav/item", props: { text: "Service ", link: "#" }) %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= pb_rails("nav", props: {variant: "subtle"}) do %>
|
1
|
+
<%= pb_rails("nav", props: { variant: "subtle" }) do %>
|
2
2
|
<%= pb_rails("nav/item", props: { text: "Overview", link: "#" }) %>
|
3
3
|
<%= pb_rails("nav/item", props: { text: "Albums", link: "#", active: true }) %>
|
4
4
|
<%= pb_rails("nav/item", props: { text: "Similar Artists", link: "#" }) %>
|
@@ -8,8 +8,10 @@ examples:
|
|
8
8
|
- subtle_nav: Subtle Variant
|
9
9
|
- subtle_with_icons_nav: Subtle With Icons
|
10
10
|
- subtle_no_highlight_nav: Subtle No Highlight
|
11
|
+
- bold_vertical_nav: Bold Variant
|
11
12
|
- horizontal_nav: Horizontal Nav
|
12
13
|
- subtle_horizontal_nav: Subtle Horizontal Nav
|
14
|
+
- bold_horizontal_nav: Bold Horizontal Nav
|
13
15
|
- block_nav: Block
|
14
16
|
- block_no_title_nav: Without Title
|
15
17
|
- new_tab: Open in a New Tab
|
@@ -23,8 +25,10 @@ examples:
|
|
23
25
|
- subtle_nav: Subtle Variant
|
24
26
|
- subtle_with_icons_nav: Subtle With Icons
|
25
27
|
- subtle_no_highlight_nav: Subtle No Highlight
|
28
|
+
- bold_vertical_nav: Bold Variant
|
26
29
|
- horizontal_nav: Horizontal Nav
|
27
30
|
- subtle_horizontal_nav: Subtle Horizontal Nav
|
31
|
+
- bold_horizontal_nav: Bold Horizontal Nav
|
28
32
|
- block_nav: Block
|
29
33
|
- block_no_title_nav: Without Title
|
30
34
|
- new_tab: Open in a New Tab
|
@@ -11,3 +11,5 @@ export { default as WithIconsNav } from './_with_icons_nav.jsx'
|
|
11
11
|
export { default as SubtleWithIconsNav } from './_subtle_with_icons_nav.jsx'
|
12
12
|
export { default as WithImgNav } from './_with_img_nav.jsx'
|
13
13
|
export { default as NewTab } from './_new_tab.jsx'
|
14
|
+
export { default as BoldHorizontalNav } from './_bold_horizontal_nav.jsx'
|
15
|
+
export { default as BoldVerticalNav } from './_bold_vertical_nav.jsx'
|
@@ -9,7 +9,7 @@ module Playbook
|
|
9
9
|
values: %w[vertical horizontal],
|
10
10
|
default: "vertical"
|
11
11
|
prop :variant, type: Playbook::Props::Enum,
|
12
|
-
values: %w[normal subtle],
|
12
|
+
values: %w[normal subtle bold],
|
13
13
|
default: "normal"
|
14
14
|
prop :highlight, type: Playbook::Props::Boolean, default: true
|
15
15
|
prop :borderless, type: Playbook::Props::Boolean, default: false
|
@@ -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 $error;
|
96
|
+
border-left: 0;
|
97
|
+
}
|
98
|
+
}
|
99
|
+
&-left {
|
100
|
+
.add-on-card {
|
101
|
+
border: 1px solid $error;
|
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,
|
@@ -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
|
+
})
|
@@ -51,6 +51,7 @@ import * as LabelPill from 'pb_label_pill/docs'
|
|
51
51
|
import * as LabelValue from 'pb_label_value/docs'
|
52
52
|
import * as Layout from 'pb_layout/docs'
|
53
53
|
import * as LegendDocs from 'pb_legend/docs'
|
54
|
+
import * as Lightbox from 'pb_lightbox/docs'
|
54
55
|
import * as LineGraphDocs from 'pb_line_graph/docs'
|
55
56
|
import * as List from 'pb_list/docs'
|
56
57
|
import * as LoadingInline from 'pb_loading_inline/docs'
|
@@ -145,6 +146,7 @@ WebpackerReact.setup({
|
|
145
146
|
...LabelValue,
|
146
147
|
...Layout,
|
147
148
|
...LegendDocs,
|
149
|
+
...Lightbox,
|
148
150
|
...LineGraphDocs,
|
149
151
|
...List,
|
150
152
|
...LoadingInline,
|
@@ -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
|
|