playbook_ui 12.23.0 → 12.24.0.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown756
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/pb_avatar/docs/_avatar_swift.md +1 -0
- data/app/pb_kits/playbook/pb_avatar/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_card/_card.tsx +1 -0
- data/app/pb_kits/playbook/pb_date/_date.tsx +96 -42
- data/app/pb_kits/playbook/pb_date/date.html.erb +22 -2
- data/app/pb_kits/playbook/pb_date/date.rb +2 -0
- data/app/pb_kits/playbook/pb_date/docs/_date_unstyled.html.erb +30 -0
- data/app/pb_kits/playbook/pb_date/docs/_date_unstyled.jsx +47 -0
- data/app/pb_kits/playbook/pb_date/docs/_date_unstyled.md +1 -0
- data/app/pb_kits/playbook/pb_date/docs/example.yml +4 -4
- data/app/pb_kits/playbook/pb_date/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.scss +26 -0
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +99 -95
- data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +3 -2
- data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +1 -1
- data/app/pb_kits/playbook/pb_date_picker/date_picker.test.js +44 -1
- data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +34 -2
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick.html.erb +8 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick.jsx +18 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_date_picker/plugins/quickPick.tsx +164 -0
- data/app/pb_kits/playbook/pb_date_picker/sass_partials/_calendar_input_icon.scss +3 -2
- data/app/pb_kits/playbook/pb_date_picker/sass_partials/_quick_pick_styles.scss +75 -0
- data/app/pb_kits/playbook/pb_docs/kit_example.html.erb +6 -1
- data/app/pb_kits/playbook/pb_docs/kit_example.rb +13 -4
- data/app/pb_kits/playbook/pb_nav/_item.tsx +1 -1
- data/app/pb_kits/playbook/pb_nav/_subtle_mixin.scss +1 -1
- data/app/pb_kits/playbook/pb_time/_time.tsx +71 -35
- data/app/pb_kits/playbook/pb_time/docs/_time_unstyled.html.erb +37 -0
- data/app/pb_kits/playbook/pb_time/docs/_time_unstyled.jsx +58 -0
- data/app/pb_kits/playbook/pb_time/docs/_time_unstyled.md +1 -0
- data/app/pb_kits/playbook/pb_time/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_time/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_time/time.html.erb +26 -7
- data/app/pb_kits/playbook/pb_time/time.rb +2 -0
- data/app/pb_kits/playbook/pb_title/_title.scss +3 -1
- data/app/pb_kits/playbook/pb_title/_title.tsx +3 -2
- data/app/pb_kits/playbook/pb_title/docs/_title_light_weight.html.erb +1 -0
- data/app/pb_kits/playbook/pb_title/docs/_title_light_weight.jsx +11 -6
- data/app/pb_kits/playbook/pb_title/docs/_title_light_weight.md +2 -2
- data/app/pb_kits/playbook/pb_title/title.rb +10 -3
- data/app/pb_kits/playbook/pb_title/title.test.js +3 -3
- data/app/pb_kits/playbook/tokens/_screen_sizes.scss +19 -0
- data/app/pb_kits/playbook/utilities/_spacing.scss +27 -1
- data/app/pb_kits/playbook/utilities/globalProps.ts +61 -16
- data/dist/playbook-rails.js +323 -0
- data/lib/playbook/pb_doc_helper.rb +4 -1
- data/lib/playbook/spacing.rb +20 -5
- data/lib/playbook/version.rb +2 -2
- data/lib/playbook.rb +1 -2
- metadata +23 -41
- data/app/pb_kits/playbook/pb_docs/kit_api.html.erb +0 -311
- data/app/pb_kits/playbook/pb_docs/kit_api.rb +0 -149
- data/lib/playbook/markdown/helper.rb +0 -132
- data/lib/playbook/markdown.rb +0 -3
@@ -0,0 +1,37 @@
|
|
1
|
+
<%= pb_rails("caption", props: { size: "xs", text: "Example with no year" }) %>
|
2
|
+
|
3
|
+
<%= pb_rails("time", props: {
|
4
|
+
show_icon: true,
|
5
|
+
show_timezone: true,
|
6
|
+
time: DateTime.now,
|
7
|
+
timezone: "America/New_York",
|
8
|
+
unstyled: true
|
9
|
+
}) %>
|
10
|
+
|
11
|
+
<br />
|
12
|
+
|
13
|
+
<%= pb_rails("caption", props: { size: "xs", text: "Example with wrapping typography kit" }) %>
|
14
|
+
|
15
|
+
<%= pb_rails("title", props: { size: 1 }) do %>
|
16
|
+
<%= pb_rails("time", props: {
|
17
|
+
show_icon: true,
|
18
|
+
show_timezone: true,
|
19
|
+
time: DateTime.now,
|
20
|
+
timezone: "America/New_York",
|
21
|
+
unstyled: true
|
22
|
+
}) %>
|
23
|
+
<% end %>
|
24
|
+
|
25
|
+
<br />
|
26
|
+
|
27
|
+
<%= pb_rails("caption", props: { size: "xs", text: "Example with icon + subcaption" }) %>
|
28
|
+
|
29
|
+
<%= pb_rails("caption", props: { size: "xs" }) do %>
|
30
|
+
<%= pb_rails("time", props: {
|
31
|
+
show_icon: true,
|
32
|
+
show_timezone: true,
|
33
|
+
time: DateTime.now,
|
34
|
+
timezone: "America/New_York",
|
35
|
+
unstyled: true
|
36
|
+
}) %>
|
37
|
+
<% end %>
|
@@ -0,0 +1,58 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import Time from '../_time'
|
3
|
+
import Caption from '../../pb_caption/_caption'
|
4
|
+
import Title from '../../pb_title/_title'
|
5
|
+
|
6
|
+
const TimeUnstyled = (props) => {
|
7
|
+
return (
|
8
|
+
<>
|
9
|
+
<Caption size="xs"
|
10
|
+
text="Basic unstyled example"
|
11
|
+
/>
|
12
|
+
<Time
|
13
|
+
date={new Date()}
|
14
|
+
showIcon
|
15
|
+
showTimezone
|
16
|
+
timeZone="America/New_York"
|
17
|
+
unstyled
|
18
|
+
{...props}
|
19
|
+
/>
|
20
|
+
|
21
|
+
<br />
|
22
|
+
|
23
|
+
<Caption size="xs"
|
24
|
+
text="Example with wrapping typography kit"
|
25
|
+
/>
|
26
|
+
<Title size={1}>
|
27
|
+
<Time
|
28
|
+
date={new Date()}
|
29
|
+
showIcon
|
30
|
+
showTimezone
|
31
|
+
timeZone="America/New_York"
|
32
|
+
unstyled
|
33
|
+
{...props}
|
34
|
+
/>
|
35
|
+
</Title>
|
36
|
+
|
37
|
+
<br />
|
38
|
+
|
39
|
+
<Caption size="xs"
|
40
|
+
text="Example with icon + subcaption"
|
41
|
+
/>
|
42
|
+
<Caption size="xs">
|
43
|
+
<Time
|
44
|
+
date={new Date()}
|
45
|
+
showIcon
|
46
|
+
showTimezone
|
47
|
+
timeZone="America/New_York"
|
48
|
+
unstyled
|
49
|
+
{...props}
|
50
|
+
/>
|
51
|
+
</Caption>
|
52
|
+
|
53
|
+
<br />
|
54
|
+
</>
|
55
|
+
)
|
56
|
+
}
|
57
|
+
|
58
|
+
export default TimeUnstyled
|
@@ -0,0 +1 @@
|
|
1
|
+
For alternative typography styles, you can pass a boolean prop called `unstyled` to the `Time` kit and wrap it in any of our typography kits (`Title`, `Body`, `Caption`, etc.). This will allow the `Time` kit to inherit any of our typography styles.
|
@@ -6,6 +6,7 @@ examples:
|
|
6
6
|
- time_timestamp: Timestamp Values
|
7
7
|
- time_timezone: Handling Timezones
|
8
8
|
- time_align: Alignment
|
9
|
+
- time_unstyled: Unstyled
|
9
10
|
|
10
11
|
react:
|
11
12
|
- time_default: Default
|
@@ -13,3 +14,4 @@ examples:
|
|
13
14
|
- time_timestamp: Timestamp Values
|
14
15
|
- time_timezone: Handling Timezones
|
15
16
|
- time_align: Alignment
|
17
|
+
- time_unstyled: Unstyled
|
@@ -3,3 +3,4 @@ export { default as TimeSizes } from './_time_sizes.jsx'
|
|
3
3
|
export { default as TimeTimestamp } from './_time_timestamp.jsx'
|
4
4
|
export { default as TimeAlign } from './_time_align.jsx'
|
5
5
|
export { default as TimeTimezone } from './_time_timezone.jsx'
|
6
|
+
export { default as TimeUnstyled } from './_time_unstyled.jsx'
|
@@ -8,25 +8,44 @@
|
|
8
8
|
size = "sm" if object.size == "xs"
|
9
9
|
size = "md" if object.size == "lg"
|
10
10
|
%>
|
11
|
-
|
11
|
+
|
12
|
+
<% if object.unstyled %>
|
13
|
+
<% if object.show_icon %>
|
14
|
+
<span>
|
15
|
+
<%= pb_rails("icon", props: { icon: "clock", fixed_width: true }) %>
|
16
|
+
</span>
|
17
|
+
<% end %>
|
18
|
+
|
19
|
+
<%= content_tag(:time, datetime: object.pb_date_time.to_iso) do %>
|
20
|
+
<span><%= object.format_time_string %></span>
|
21
|
+
<% if object.show_timezone %>
|
22
|
+
<span><%= object.pb_date_time.to_timezone.upcase %></span>
|
23
|
+
<% end %>
|
24
|
+
<% end %>
|
25
|
+
|
26
|
+
<% elsif size == "md" %>
|
12
27
|
<% if object.show_icon %>
|
13
28
|
<%= pb_rails("body", props: { color: "light", tag: "span"}) do %>
|
14
29
|
<%= pb_rails("icon", props: { icon: "clock", fixed_width: true }) %>
|
15
30
|
<% end %>
|
16
31
|
<% end %>
|
17
|
-
|
18
|
-
|
19
|
-
<%= pb_rails("body", props: {
|
32
|
+
|
33
|
+
<%= content_tag(:time, datetime: object.pb_date_time.to_iso) do %>
|
34
|
+
<%= pb_rails("body", props: { tag: "span", text: object.format_time_string, classname: "pb_time" }) %>
|
35
|
+
<% if object.show_timezone %>
|
36
|
+
<%= pb_rails("body", props: { color: "light", tag: "span", text: object.pb_date_time.to_timezone.upcase }) %>
|
37
|
+
<% end %>
|
20
38
|
<% end %>
|
39
|
+
|
21
40
|
<% else %>
|
22
41
|
<% if object.show_icon %>
|
23
42
|
<%= pb_rails("body", props: { color: "light", tag: "span"}) do %>
|
24
43
|
<%= pb_rails("icon", props: { icon: "clock", fixed_width: true, size: "sm" }) %>
|
25
44
|
<% end %>
|
26
45
|
<% end %>
|
27
|
-
|
28
|
-
<%=
|
29
|
-
<%=
|
46
|
+
|
47
|
+
<%= content_tag(:time, datetime: object.pb_date_time.to_iso) do %>
|
48
|
+
<%= pb_rails("caption", props: { color: "light", tag: "span", text: object.format_time_string }) do %>
|
30
49
|
<%= object.format_time_string %>
|
31
50
|
<% if object.show_timezone %>
|
32
51
|
<span class="pb_time_timezone">
|
@@ -12,11 +12,13 @@
|
|
12
12
|
&[class*=_2] {
|
13
13
|
@include pb_title_2;
|
14
14
|
@include title_colors;
|
15
|
+
@include pb_title_bold;
|
15
16
|
}
|
16
17
|
|
17
18
|
&[class*=_3] {
|
18
19
|
@include pb_title_3;
|
19
20
|
@include title_colors;
|
21
|
+
@include pb_title_bold;
|
20
22
|
}
|
21
23
|
|
22
24
|
&[class*=_4] {
|
@@ -28,7 +30,7 @@
|
|
28
30
|
@include pb_title_dark;
|
29
31
|
}
|
30
32
|
|
31
|
-
&[class*=
|
33
|
+
&[class*=thin] {
|
32
34
|
@include pb_title_thin;
|
33
35
|
}
|
34
36
|
}
|
@@ -21,13 +21,13 @@ const Title = (props: TitleProps): React.ReactElement => {
|
|
21
21
|
if (props.variant) deprecatedProps('Title', ['variant']) //variant prop is deprecated, use color instead
|
22
22
|
const {
|
23
23
|
aria = {},
|
24
|
-
bold = true,
|
25
24
|
children,
|
26
25
|
className,
|
27
26
|
color,
|
28
27
|
data = {},
|
29
28
|
id,
|
30
29
|
size = 3,
|
30
|
+
bold = size === 3 ? false : true,
|
31
31
|
tag = 'h3',
|
32
32
|
text,
|
33
33
|
variant = null,
|
@@ -35,9 +35,10 @@ const Title = (props: TitleProps): React.ReactElement => {
|
|
35
35
|
|
36
36
|
const ariaProps: {[key: string]: string | number} = buildAriaProps(aria)
|
37
37
|
const dataProps: {[key: string]: string | number} = buildDataProps(data)
|
38
|
+
|
38
39
|
const getBold = bold ? '' : 'thin'
|
39
40
|
const classes = classnames(
|
40
|
-
buildCss(
|
41
|
+
buildCss("pb_title_kit", `size_${size}`, variant, color) + ` ${getBold}`,
|
41
42
|
globalProps(props),
|
42
43
|
className
|
43
44
|
)
|
@@ -1,15 +1,20 @@
|
|
1
|
-
import React from
|
1
|
+
import React from "react"
|
2
2
|
|
3
|
-
import Title from
|
3
|
+
import Title from "../_title"
|
4
4
|
|
5
5
|
const TitleLightWeight = (props) => {
|
6
6
|
return (
|
7
7
|
<div>
|
8
|
-
<Title
|
9
|
-
bold={false}
|
8
|
+
<Title bold={false}
|
10
9
|
size={1}
|
11
|
-
tag=
|
12
|
-
text=
|
10
|
+
tag='h1'
|
11
|
+
text='Title 1'
|
12
|
+
{...props}
|
13
|
+
/>
|
14
|
+
<Title bold={false}
|
15
|
+
size={2}
|
16
|
+
tag='h2'
|
17
|
+
text='Title 2'
|
13
18
|
{...props}
|
14
19
|
/>
|
15
20
|
</div>
|
@@ -1,4 +1,4 @@
|
|
1
1
|
##### Prop
|
2
|
-
Title `size 1` will use `font-weight: 700` by default, if you want a lighter font weight, use the `bold` prop set to `false`.
|
3
|
-
Title `size
|
2
|
+
Title `size 1` & `size 2` will use `font-weight: 700` by default, if you want a lighter font weight, use the `bold` prop set to `false`.
|
3
|
+
Title `size 3` uses a light font weight by default and will not accept a bold font weight.
|
4
4
|
Title `size 4` uses a heavy font weight by default and will not accept a lighter font weight.
|
@@ -17,14 +17,21 @@ module Playbook
|
|
17
17
|
values: [nil, "link"],
|
18
18
|
default: nil,
|
19
19
|
deprecated: true
|
20
|
-
|
20
|
+
|
21
|
+
def initialize(props)
|
22
|
+
props[:bold] = [1, 2, 4].include?(props[:size]) unless props.key?(:bold)
|
23
|
+
props[:bold] = false if props[:size].nil? && !props.key?(:bold)
|
24
|
+
super(props)
|
25
|
+
end
|
26
|
+
|
27
|
+
prop :bold, type: Playbook::Props::Boolean
|
21
28
|
|
22
29
|
def classname
|
23
|
-
generate_classname("pb_title_kit", size, variant, color
|
30
|
+
generate_classname("pb_title_kit", size, variant, color) + is_bold
|
24
31
|
end
|
25
32
|
|
26
33
|
def is_bold
|
27
|
-
bold ?
|
34
|
+
bold ? "" : " thin"
|
28
35
|
end
|
29
36
|
end
|
30
37
|
end
|
@@ -12,7 +12,7 @@ test('returns namespaced class name', () => {
|
|
12
12
|
)
|
13
13
|
|
14
14
|
const kit = screen.getByTestId('primary-test')
|
15
|
-
expect(kit).toHaveClass('pb_title_kit_size_3')
|
15
|
+
expect(kit).toHaveClass('pb_title_kit_size_3 thin')
|
16
16
|
})
|
17
17
|
|
18
18
|
test('with thin font weight', () => {
|
@@ -25,7 +25,7 @@ test('with thin font weight', () => {
|
|
25
25
|
)
|
26
26
|
|
27
27
|
const kit = screen.getByTestId('primary-test')
|
28
|
-
expect(kit).toHaveClass('
|
28
|
+
expect(kit).toHaveClass('pb_title_kit_size_3 thin')
|
29
29
|
})
|
30
30
|
|
31
31
|
test('with colors', () => {
|
@@ -38,5 +38,5 @@ test('with colors', () => {
|
|
38
38
|
)
|
39
39
|
|
40
40
|
const kit = screen.getByTestId('primary-test')
|
41
|
-
expect(kit).toHaveClass('pb_title_kit_size_3_success')
|
41
|
+
expect(kit).toHaveClass('pb_title_kit_size_3_success thin')
|
42
42
|
})
|
@@ -38,6 +38,25 @@ $breakpoints_grid: (
|
|
38
38
|
)
|
39
39
|
);
|
40
40
|
|
41
|
+
$breakpoints_max_only: (
|
42
|
+
xl: (
|
43
|
+
max: $screen-xl-max
|
44
|
+
),
|
45
|
+
lg: (
|
46
|
+
max: $screen-lg-max
|
47
|
+
),
|
48
|
+
md: (
|
49
|
+
max: $screen-md-max
|
50
|
+
),
|
51
|
+
sm: (
|
52
|
+
max: $screen-sm-max
|
53
|
+
),
|
54
|
+
xs: (
|
55
|
+
max: $screen-xs-max,
|
56
|
+
)
|
57
|
+
);
|
58
|
+
|
59
|
+
|
41
60
|
@function breakpoint($breakpoint_name) {
|
42
61
|
@return map-get($breakpoints, $breakpoint_name);
|
43
62
|
}
|
@@ -7,7 +7,10 @@ $space_classes: (
|
|
7
7
|
md: $space_md,
|
8
8
|
lg: $space_lg,
|
9
9
|
xl: $space_xl,
|
10
|
-
none: 0
|
10
|
+
none: 0,
|
11
|
+
auto: auto,
|
12
|
+
initial: initial,
|
13
|
+
inherit: inherit
|
11
14
|
);
|
12
15
|
|
13
16
|
$positions: (
|
@@ -41,3 +44,26 @@ $positions: (
|
|
41
44
|
}
|
42
45
|
}
|
43
46
|
}
|
47
|
+
|
48
|
+
@each $size, $size_value in $breakpoints_max_only {
|
49
|
+
@each $position_name, $position in $positions {
|
50
|
+
@each $space_name, $space in $space_classes {
|
51
|
+
$min_size: map-get($size_value, "min");
|
52
|
+
$max_size: map-get($size_value, "max");
|
53
|
+
.#{$position_name}_#{$size}_#{$space_name} {
|
54
|
+
@if type-of($position)=="list" {
|
55
|
+
@each $coordinate in $position {
|
56
|
+
@include break_at( $max_size) {
|
57
|
+
#{$coordinate}: #{$space} !important;
|
58
|
+
}
|
59
|
+
}
|
60
|
+
}
|
61
|
+
@else {
|
62
|
+
@include break_at( $max_size) {
|
63
|
+
#{$position}: #{$space} !important;
|
64
|
+
}
|
65
|
+
}
|
66
|
+
}
|
67
|
+
}
|
68
|
+
}
|
69
|
+
}
|
@@ -22,7 +22,7 @@ type AlignItems = {
|
|
22
22
|
type AlignSelf = {
|
23
23
|
alignSelf?: Alignment & ("auto" | "stretch" | "baseline")
|
24
24
|
}
|
25
|
-
type AllSizes = None | Sizes
|
25
|
+
type AllSizes = None | Sizes | "auto" | "initial" | "inherit"
|
26
26
|
|
27
27
|
type BorderRadius = {
|
28
28
|
borderRadius?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "rounded",
|
@@ -153,22 +153,67 @@ const PROP_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => string} =
|
|
153
153
|
padding,
|
154
154
|
}: Margin & Padding) => {
|
155
155
|
let css = ''
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
156
|
+
const spacingProps = {
|
157
|
+
marginRight,
|
158
|
+
marginLeft,
|
159
|
+
marginTop,
|
160
|
+
marginBottom,
|
161
|
+
marginX,
|
162
|
+
marginY,
|
163
|
+
margin,
|
164
|
+
paddingRight,
|
165
|
+
paddingLeft,
|
166
|
+
paddingTop,
|
167
|
+
paddingBottom,
|
168
|
+
paddingX,
|
169
|
+
paddingY,
|
170
|
+
padding,
|
171
|
+
};
|
172
|
+
|
173
|
+
function handleObjectValue(properties: Margin | Padding, prefix: string) {
|
174
|
+
let classResult = '';
|
175
|
+
|
176
|
+
Object.entries(properties).forEach(([key, value]) => {
|
177
|
+
classResult += `${prefix}_${key}_${value} `;
|
178
|
+
});
|
179
|
+
|
180
|
+
return classResult;
|
181
|
+
}
|
182
|
+
|
183
|
+
function getPrefix(key: string) {
|
184
|
+
const prefixes: Record<string, string> = {
|
185
|
+
marginRight: 'mr',
|
186
|
+
marginLeft: 'ml',
|
187
|
+
marginTop: 'mt',
|
188
|
+
marginBottom: 'mb',
|
189
|
+
marginX: 'mx',
|
190
|
+
marginY: 'my',
|
191
|
+
margin: 'm',
|
192
|
+
paddingRight: 'pr',
|
193
|
+
paddingLeft: 'pl',
|
194
|
+
paddingTop: 'pt',
|
195
|
+
paddingBottom: 'pb',
|
196
|
+
paddingX: 'px',
|
197
|
+
paddingY: 'py',
|
198
|
+
padding: 'p',
|
199
|
+
};
|
200
|
+
|
201
|
+
return prefixes[key];
|
202
|
+
}
|
203
|
+
|
204
|
+
Object.entries(spacingProps).forEach(([key, value]) => {
|
205
|
+
if (value) {
|
206
|
+
if (typeof value === 'object') {
|
207
|
+
css += handleObjectValue(value, getPrefix(key));
|
208
|
+
} else {
|
209
|
+
const prefix = getPrefix(key);
|
210
|
+
css += `${prefix}_${value} `;
|
211
|
+
}
|
212
|
+
}
|
213
|
+
});
|
214
|
+
return css.trim();
|
171
215
|
},
|
216
|
+
|
172
217
|
darkProps: ({ dark }: Dark) => dark ? 'dark' : '',
|
173
218
|
numberSpacingProps: ({ numberSpacing }: NumberSpacing) => {
|
174
219
|
let css = ''
|