playbook_ui 14.6.2.pre.alpha.PLAY1607dependencydisplayymlupdate4271 → 14.6.2.pre.alpha.PLAY15814384
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 -1
- data/app/pb_kits/playbook/pb_card/_card.tsx +11 -4
- data/app/pb_kits/playbook/pb_card/_card_mixin.scss +1 -2
- data/app/pb_kits/playbook/pb_currency/_currency.tsx +16 -6
- data/app/pb_kits/playbook/pb_currency/currency.rb +38 -11
- data/app/pb_kits/playbook/pb_currency/currency.test.js +35 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_comma_separator.html.erb +7 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_comma_separator.jsx +18 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_comma_separator.md +3 -0
- data/app/pb_kits/playbook/pb_currency/docs/example.yml +3 -1
- data/app/pb_kits/playbook/pb_currency/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_dialog/_dialog.tsx +5 -1
- data/app/pb_kits/playbook/pb_flex/_flex.tsx +3 -1
- data/app/pb_kits/playbook/pb_flex/_flex_item.tsx +8 -2
- data/app/pb_kits/playbook/pb_flex/flex_item.html.erb +3 -6
- data/app/pb_kits/playbook/pb_flex/flex_item.rb +7 -2
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.scss +6 -2
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +30 -26
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.html.erb +24 -1
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.jsx +25 -2
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text_rails.md +3 -0
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text_react.md +1 -0
- data/app/pb_kits/playbook/pb_form_pill/form_pill.html.erb +46 -8
- data/app/pb_kits/playbook/pb_link/_link.scss +66 -0
- data/app/pb_kits/playbook/pb_link/_link.tsx +107 -0
- data/app/pb_kits/playbook/pb_link/docs/_link_color.html.erb +30 -0
- data/app/pb_kits/playbook/pb_link/docs/_link_color.jsx +40 -0
- data/app/pb_kits/playbook/pb_link/docs/_link_disabled.html.erb +5 -0
- data/app/pb_kits/playbook/pb_link/docs/_link_disabled.jsx +15 -0
- data/app/pb_kits/playbook/pb_link/docs/_link_icon.html.erb +15 -0
- data/app/pb_kits/playbook/pb_link/docs/_link_icon.jsx +25 -0
- data/app/pb_kits/playbook/pb_link/docs/_link_tag.html.erb +35 -0
- data/app/pb_kits/playbook/pb_link/docs/_link_tag.jsx +45 -0
- data/app/pb_kits/playbook/pb_link/docs/_link_underline.html.erb +5 -0
- data/app/pb_kits/playbook/pb_link/docs/_link_underline.jsx +15 -0
- data/app/pb_kits/playbook/pb_link/docs/example.yml +16 -0
- data/app/pb_kits/playbook/pb_link/docs/index.js +5 -0
- data/app/pb_kits/playbook/pb_link/link.html.erb +21 -0
- data/app/pb_kits/playbook/pb_link/link.rb +44 -0
- data/app/pb_kits/playbook/pb_link/link.test.jsx +92 -0
- data/app/pb_kits/playbook/pb_popover/_popover.tsx +1 -1
- data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.scss +67 -1
- data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.tsx +1 -0
- data/app/pb_kits/playbook/pb_selectable_card/selectable_card.html.erb +1 -1
- data/app/pb_kits/playbook/pb_selectable_card/selectable_card.rb +5 -1
- data/app/pb_kits/playbook/pb_timeline/_item.tsx +59 -23
- data/app/pb_kits/playbook/pb_timeline/_timeline.tsx +8 -0
- data/app/pb_kits/playbook/pb_timeline/detail.html.erb +3 -0
- data/app/pb_kits/playbook/pb_timeline/detail.rb +11 -0
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_children.html.erb +43 -0
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_children.jsx +68 -0
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_children.md +2 -0
- data/app/pb_kits/playbook/pb_timeline/docs/example.yml +2 -1
- data/app/pb_kits/playbook/pb_timeline/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_timeline/item.html.erb +17 -21
- data/app/pb_kits/playbook/pb_timeline/item.rb +4 -0
- data/app/pb_kits/playbook/pb_timeline/label.html.erb +12 -0
- data/app/pb_kits/playbook/pb_timeline/label.rb +13 -0
- data/app/pb_kits/playbook/pb_timeline/step.html.erb +14 -0
- data/app/pb_kits/playbook/pb_timeline/step.rb +16 -0
- data/app/pb_kits/playbook/pb_timeline/subcomponents/Detail.tsx +29 -0
- data/app/pb_kits/playbook/pb_timeline/subcomponents/Label.tsx +38 -0
- data/app/pb_kits/playbook/pb_timeline/subcomponents/Step.tsx +42 -0
- data/app/pb_kits/playbook/pb_timeline/subcomponents/index.tsx +3 -0
- data/app/pb_kits/playbook/pb_timeline/timeline.test.js +84 -0
- data/app/pb_kits/playbook/tokens/_typography.scss +35 -0
- data/app/pb_kits/playbook/utilities/globalPropNames.mjs +3 -0
- data/app/pb_kits/playbook/utilities/globalProps.ts +39 -2
- data/dist/chunks/_typeahead-C-6MLSyC.js +22 -0
- data/dist/chunks/_weekday_stacked-CFhGhr9V.js +45 -0
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +4 -316
- data/dist/playbook-doc.js +1 -1
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/kit_base.rb +43 -5
- data/lib/playbook/version.rb +1 -1
- metadata +39 -5
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.md +0 -1
- data/dist/chunks/_typeahead-BV_n6U5W.js +0 -22
- data/dist/chunks/_weekday_stacked-Dh3OU4s8.js +0 -45
@@ -10,6 +10,24 @@
|
|
10
10
|
$pb_selectable_card_indicator_size: 22px;
|
11
11
|
$pb_selectable_card_border: 2px;
|
12
12
|
|
13
|
+
$pb_selectable_space_classes: (
|
14
|
+
xxs: $space_xxs,
|
15
|
+
xs: $space_xs,
|
16
|
+
sm: $space_sm,
|
17
|
+
md: $space_md,
|
18
|
+
lg: $space_lg,
|
19
|
+
xl: $space_xl,
|
20
|
+
);
|
21
|
+
$pb_selectable_paddings: (
|
22
|
+
p: "padding",
|
23
|
+
pr: "padding-right",
|
24
|
+
pl: "padding-left",
|
25
|
+
pt: "padding-top",
|
26
|
+
pb: "padding-bottom",
|
27
|
+
px: ("padding-left", "padding-right"),
|
28
|
+
py: ("padding-top", "padding-bottom")
|
29
|
+
);
|
30
|
+
|
13
31
|
[class^=pb_selectable_card_kit] {
|
14
32
|
display: block;
|
15
33
|
margin-bottom: 0;
|
@@ -28,7 +46,6 @@ $pb_selectable_card_border: 2px;
|
|
28
46
|
padding: $space_sm;
|
29
47
|
margin-bottom: $space_sm;
|
30
48
|
cursor: pointer;
|
31
|
-
outline: 1px solid transparent;
|
32
49
|
|
33
50
|
@media (hover:hover) {
|
34
51
|
&:hover {
|
@@ -74,6 +91,7 @@ $pb_selectable_card_border: 2px;
|
|
74
91
|
|
75
92
|
position: relative;
|
76
93
|
@include pb_card_selected;
|
94
|
+
padding: calc(#{$space_sm} - 1px);
|
77
95
|
transition-property: none;
|
78
96
|
transition-duration: 0s;
|
79
97
|
|
@@ -88,6 +106,54 @@ $pb_selectable_card_border: 2px;
|
|
88
106
|
background-color: $royal;
|
89
107
|
}
|
90
108
|
}
|
109
|
+
|
110
|
+
// Selected card has 1px more border
|
111
|
+
// Remove 1px so content does not "jump"
|
112
|
+
@each $position_name,
|
113
|
+
$position in $pb_selectable_paddings {
|
114
|
+
@each $space_name,
|
115
|
+
$space in $pb_selectable_space_classes {
|
116
|
+
~ label.#{$position_name}_#{$space_name} {
|
117
|
+
@if type-of($position)=="list" {
|
118
|
+
@each $coordinate in $position {
|
119
|
+
#{$coordinate}: calc(#{$space} - 1px) !important;
|
120
|
+
}
|
121
|
+
}
|
122
|
+
|
123
|
+
@else {
|
124
|
+
#{$position}: calc(#{$space} - 1px) !important;
|
125
|
+
}
|
126
|
+
}
|
127
|
+
}
|
128
|
+
}
|
129
|
+
}
|
130
|
+
}
|
131
|
+
|
132
|
+
&.display_input {
|
133
|
+
input[type="checkbox"],
|
134
|
+
input[type="radio"] {
|
135
|
+
&:checked {
|
136
|
+
~label {
|
137
|
+
border-width: $pb_card_border_width;
|
138
|
+
outline: 1px solid $primary;
|
139
|
+
}
|
140
|
+
|
141
|
+
}
|
142
|
+
}
|
143
|
+
|
144
|
+
> label {
|
145
|
+
outline: 1px solid transparent;
|
146
|
+
padding: $space_sm;
|
147
|
+
}
|
148
|
+
|
149
|
+
&.dark {
|
150
|
+
input[type="checkbox"],
|
151
|
+
input[type="radio"] {
|
152
|
+
&:checked ~ label {
|
153
|
+
border-width: $pb_card_border_width;
|
154
|
+
outline: 1px solid $primary;
|
155
|
+
}
|
156
|
+
}
|
91
157
|
}
|
92
158
|
}
|
93
159
|
|
@@ -25,7 +25,7 @@
|
|
25
25
|
<% end %>
|
26
26
|
<div class="separator"></div>
|
27
27
|
<div class="psuedo_separator"></div>
|
28
|
-
<%= pb_rails("card", props: { padding: "sm", status: object.status, border_none: true }) do %>
|
28
|
+
<%= pb_rails("card", props: { padding: "sm", status: object.status, border_none: true, dark: object.dark }) do %>
|
29
29
|
<% if content.nil? %>
|
30
30
|
<%= pb_rails("body", props: { text: object.text }) %>
|
31
31
|
<% else %>
|
@@ -25,7 +25,7 @@ module Playbook
|
|
25
25
|
|
26
26
|
def classname
|
27
27
|
[
|
28
|
-
generate_classname_without_spacing("pb_selectable_card_kit", checked_class, enable_disabled_class),
|
28
|
+
generate_classname_without_spacing("pb_selectable_card_kit", checked_class, enable_disabled_class) + display_input_class,
|
29
29
|
error_class,
|
30
30
|
dark_props,
|
31
31
|
].compact.join(" ")
|
@@ -79,6 +79,10 @@ module Playbook
|
|
79
79
|
def error_class
|
80
80
|
error ? "error" : nil
|
81
81
|
end
|
82
|
+
|
83
|
+
def display_input_class
|
84
|
+
variant == "display_input" ? " display_input" : ""
|
85
|
+
end
|
82
86
|
end
|
83
87
|
end
|
84
88
|
end
|
@@ -1,12 +1,15 @@
|
|
1
1
|
import React from 'react'
|
2
2
|
import classnames from 'classnames'
|
3
|
-
|
4
3
|
import { buildCss, buildHtmlProps } from '../utilities/props'
|
5
|
-
import { globalProps, GlobalProps } from "../utilities/globalProps"
|
4
|
+
import { globalProps, GlobalProps } from "../utilities/globalProps"
|
6
5
|
|
7
6
|
import DateStacked from '../pb_date_stacked/_date_stacked'
|
8
7
|
import IconCircle from '../pb_icon_circle/_icon_circle'
|
9
8
|
|
9
|
+
import TimelineLabel from './subcomponents/Label'
|
10
|
+
import TimelineStep from './subcomponents/Step'
|
11
|
+
import TimelineDetail from './subcomponents/Detail'
|
12
|
+
|
10
13
|
type ItemProps = {
|
11
14
|
className?: string,
|
12
15
|
children?: React.ReactNode[] | React.ReactNode,
|
@@ -17,6 +20,13 @@ type ItemProps = {
|
|
17
20
|
lineStyle?: 'solid' | 'dotted',
|
18
21
|
} & GlobalProps
|
19
22
|
|
23
|
+
function isElementOfType<P>(
|
24
|
+
element: React.ReactNode,
|
25
|
+
component: React.ComponentType<P>
|
26
|
+
): element is React.ReactElement<P> {
|
27
|
+
return React.isValidElement<P>(element) && element.type === component
|
28
|
+
}
|
29
|
+
|
20
30
|
const TimelineItem = ({
|
21
31
|
className,
|
22
32
|
children,
|
@@ -31,31 +41,57 @@ const TimelineItem = ({
|
|
31
41
|
|
32
42
|
const htmlProps = buildHtmlProps(htmlOptions)
|
33
43
|
|
44
|
+
const childrenArray = React.Children.toArray(children)
|
45
|
+
|
46
|
+
const labelChild = childrenArray.find(
|
47
|
+
(child): child is React.ReactElement => isElementOfType(child, TimelineLabel)
|
48
|
+
)
|
49
|
+
|
50
|
+
const stepChild = childrenArray.find(
|
51
|
+
(child): child is React.ReactElement => isElementOfType(child, TimelineStep)
|
52
|
+
)
|
53
|
+
|
54
|
+
const detailChild = childrenArray.find(
|
55
|
+
(child): child is React.ReactElement => isElementOfType(child, TimelineDetail)
|
56
|
+
)
|
57
|
+
|
58
|
+
const otherChildren = childrenArray.filter(
|
59
|
+
(child) =>
|
60
|
+
!isElementOfType(child, TimelineLabel) &&
|
61
|
+
!isElementOfType(child, TimelineStep) &&
|
62
|
+
!isElementOfType(child, TimelineDetail)
|
63
|
+
)
|
64
|
+
|
34
65
|
return (
|
35
|
-
<div
|
66
|
+
<div
|
36
67
|
{...htmlProps}
|
37
68
|
className={classnames(timelineItemCss, globalProps(props), className)}
|
38
69
|
>
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
70
|
+
{labelChild || (
|
71
|
+
<div className="pb_timeline_item_left_block">
|
72
|
+
{date && (
|
73
|
+
<DateStacked
|
74
|
+
align="center"
|
75
|
+
date={date}
|
76
|
+
size="sm"
|
77
|
+
/>
|
78
|
+
)}
|
79
|
+
</div>
|
80
|
+
)}
|
81
|
+
{stepChild || (
|
82
|
+
<div className="pb_timeline_item_step">
|
83
|
+
<IconCircle icon={icon}
|
84
|
+
size="xs"
|
85
|
+
variant={iconColor}
|
86
|
+
/>
|
87
|
+
<div className="pb_timeline_item_connector" />
|
88
|
+
</div>
|
89
|
+
)}
|
90
|
+
{detailChild || (
|
91
|
+
<div className="pb_timeline_item_right_block">
|
92
|
+
{ otherChildren }
|
93
|
+
</div>
|
94
|
+
)}
|
59
95
|
</div>
|
60
96
|
)
|
61
97
|
}
|
@@ -5,6 +5,11 @@ import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../uti
|
|
5
5
|
import { GlobalProps, globalProps } from '../utilities/globalProps'
|
6
6
|
|
7
7
|
import TimelineItem from './_item'
|
8
|
+
import {
|
9
|
+
TimelineStep,
|
10
|
+
TimelineLabel,
|
11
|
+
TimelineDetail,
|
12
|
+
} from './subcomponents'
|
8
13
|
|
9
14
|
type TimelineProps = {
|
10
15
|
aria?: { [key: string]: string },
|
@@ -47,5 +52,8 @@ const Timeline = ({
|
|
47
52
|
}
|
48
53
|
|
49
54
|
Timeline.Item = TimelineItem
|
55
|
+
Timeline.Step = TimelineStep
|
56
|
+
Timeline.Label = TimelineLabel
|
57
|
+
Timeline.Detail = TimelineDetail
|
50
58
|
|
51
59
|
export default Timeline
|
@@ -0,0 +1,43 @@
|
|
1
|
+
<%= pb_rails("timeline", props: {orientation: "horizontal", show_date: true}) do %>
|
2
|
+
<%= pb_rails("timeline/item", props: { line_style: "solid"}) do |item| %>
|
3
|
+
|
4
|
+
<% item.label do %>
|
5
|
+
<%= pb_rails("timeline/label") do %>
|
6
|
+
<%= pb_rails("title", props: { text: "Any Kit Here", size: 2 }) %>
|
7
|
+
<% end %>
|
8
|
+
<% end %>
|
9
|
+
|
10
|
+
<% item.step do %>
|
11
|
+
<%= pb_rails("timeline/step", props: { icon: 'check', icon_color: 'teal' }) %>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<% item.detail do %>
|
15
|
+
<%= pb_rails("title_detail", props: {
|
16
|
+
title: "Jackson Heights",
|
17
|
+
detail: "37-27 74th Street"
|
18
|
+
}) %>
|
19
|
+
<% end %>
|
20
|
+
<% end %>
|
21
|
+
<%= pb_rails("timeline/item", props: { line_style: "dotted"}) do |item| %>
|
22
|
+
|
23
|
+
<% item.step do %>
|
24
|
+
<%= pb_rails("timeline/step") do %>
|
25
|
+
<%= pb_rails("pill", props: { text: "Any Kit" , variant: "success" }) %>
|
26
|
+
<% end %>
|
27
|
+
<% end %>
|
28
|
+
|
29
|
+
<% item.detail do %>
|
30
|
+
<%= pb_rails("title_detail", props: {
|
31
|
+
title: "Greenpoint",
|
32
|
+
detail: "81 Gate St Brooklyn"
|
33
|
+
}) %>
|
34
|
+
<% end %>
|
35
|
+
<% end %>
|
36
|
+
|
37
|
+
<%= pb_rails("timeline/item", props: {icon: "map-marker-alt", icon_color: "purple", date: Date.today+1 }) do |item| %>
|
38
|
+
<%= pb_rails("title_detail", props: {
|
39
|
+
title: "Society Hill",
|
40
|
+
detail: "72 E St Astoria"
|
41
|
+
}) %>
|
42
|
+
<% end %>
|
43
|
+
<% end %>
|
@@ -0,0 +1,68 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
|
3
|
+
import Timeline from '../_timeline'
|
4
|
+
import Title from '../../pb_title/_title'
|
5
|
+
import Pill from '../../pb_pill/_pill'
|
6
|
+
|
7
|
+
import TitleDetail from '../../pb_title_detail/_title_detail'
|
8
|
+
|
9
|
+
const TimelineWithChildren = (props) => (
|
10
|
+
<div>
|
11
|
+
<Timeline orientation="horizontal"
|
12
|
+
showDate
|
13
|
+
{...props}
|
14
|
+
>
|
15
|
+
<Timeline.Item lineStyle="solid"
|
16
|
+
{...props}
|
17
|
+
>
|
18
|
+
<Timeline.Label>
|
19
|
+
<Title size={2}
|
20
|
+
text='Any Kit Here'
|
21
|
+
/>
|
22
|
+
</Timeline.Label>
|
23
|
+
<Timeline.Step icon="user"
|
24
|
+
iconColor="royal"
|
25
|
+
/>
|
26
|
+
<Timeline.Detail>
|
27
|
+
<TitleDetail detail="37-27 74th Street"
|
28
|
+
title="Jackson Heights"
|
29
|
+
{...props}
|
30
|
+
/>
|
31
|
+
</Timeline.Detail>
|
32
|
+
</Timeline.Item>
|
33
|
+
|
34
|
+
<Timeline.Item lineStyle="dotted"
|
35
|
+
{...props}
|
36
|
+
>
|
37
|
+
<Timeline.Step>
|
38
|
+
<Pill text="Any Kit"
|
39
|
+
variant="success"
|
40
|
+
/>
|
41
|
+
</Timeline.Step>
|
42
|
+
<Timeline.Detail>
|
43
|
+
<TitleDetail detail="81 Gate St Brooklyn"
|
44
|
+
title="Greenpoint"
|
45
|
+
{...props}
|
46
|
+
/>
|
47
|
+
</Timeline.Detail>
|
48
|
+
</Timeline.Item>
|
49
|
+
|
50
|
+
<Timeline.Item lineStyle="solid"
|
51
|
+
{...props}
|
52
|
+
>
|
53
|
+
<Timeline.Label date={new Date(new Date().setDate(new Date().getDate() + 1))} />
|
54
|
+
<Timeline.Step icon="map-marker-alt"
|
55
|
+
iconColor="purple"
|
56
|
+
/>
|
57
|
+
<Timeline.Detail>
|
58
|
+
<TitleDetail detail="72 E St Astoria"
|
59
|
+
title="Society Hill"
|
60
|
+
{...props}
|
61
|
+
/>
|
62
|
+
</Timeline.Detail>
|
63
|
+
</Timeline.Item>
|
64
|
+
</Timeline>
|
65
|
+
</div>
|
66
|
+
)
|
67
|
+
|
68
|
+
export default TimelineWithChildren
|
@@ -4,10 +4,11 @@ examples:
|
|
4
4
|
- timeline_default: Default
|
5
5
|
- timeline_vertical: Vertical
|
6
6
|
- timeline_with_date: With Date
|
7
|
+
- timeline_with_children: With Children
|
7
8
|
|
8
9
|
|
9
10
|
react:
|
10
11
|
- timeline_default: Default
|
11
12
|
- timeline_vertical: Vertical
|
12
13
|
- timeline_with_date: With Date
|
13
|
-
|
14
|
+
- timeline_with_children: With Children
|
@@ -1,3 +1,4 @@
|
|
1
1
|
export { default as TimelineDefault } from './_timeline_default.jsx'
|
2
2
|
export { default as TimelineVertical } from './_timeline_vertical.jsx'
|
3
3
|
export { default as TimelineWithDate } from './_timeline_with_date.jsx'
|
4
|
+
export { default as TimelineWithChildren } from './_timeline_with_children.jsx'
|
@@ -1,25 +1,21 @@
|
|
1
1
|
<%= pb_content_tag do %>
|
2
|
+
<% if label %>
|
3
|
+
<%= label %>
|
4
|
+
<% else %>
|
5
|
+
<%= pb_rails("timeline/label", props: { date: date }) %>
|
6
|
+
<% end %>
|
2
7
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
align: "center"
|
9
|
-
}) %>
|
10
|
-
<% end %>
|
11
|
-
</div>
|
12
|
-
|
13
|
-
<div class="pb_timeline_item_step">
|
14
|
-
<%= pb_rails("icon_circle", props: {
|
15
|
-
icon: object.icon,
|
16
|
-
variant: object.icon_color,
|
17
|
-
size: "xs"
|
18
|
-
}) %>
|
19
|
-
<div class="pb_timeline_item_connector"></div>
|
20
|
-
</div>
|
8
|
+
<% if step %>
|
9
|
+
<%= step %>
|
10
|
+
<% else %>
|
11
|
+
<%= pb_rails("timeline/step", props: { icon: icon, icon_color: icon_color }) %>
|
12
|
+
<% end %>
|
21
13
|
|
22
|
-
|
23
|
-
<%=
|
24
|
-
|
14
|
+
<% if detail%>
|
15
|
+
<%= detail%>
|
16
|
+
<% else %>
|
17
|
+
<%= pb_rails("timeline/detail") do %>
|
18
|
+
<%= content %>
|
19
|
+
<% end %>
|
20
|
+
<% end %>
|
25
21
|
<% end %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<%= pb_content_tag do %>
|
2
|
+
<% if object.icon.present? %>
|
3
|
+
<%= pb_rails("icon_circle", props: {
|
4
|
+
icon: object.icon,
|
5
|
+
variant: object.icon_color,
|
6
|
+
size: "xs"
|
7
|
+
}) %>
|
8
|
+
<% else %>
|
9
|
+
<%= content.presence %>
|
10
|
+
<% end %>
|
11
|
+
<div class="pb_timeline_item_connector"></div>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Playbook
|
4
|
+
module PbTimeline
|
5
|
+
class Step < Playbook::KitBase
|
6
|
+
prop :icon, type: Playbook::Props::String
|
7
|
+
prop :icon_color, type: Playbook::Props::Enum,
|
8
|
+
values: %w[default royal blue purple teal red yellow green],
|
9
|
+
default: "default"
|
10
|
+
|
11
|
+
def classname
|
12
|
+
generate_classname("pb_timeline_item_step")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import classnames from 'classnames'
|
3
|
+
import { buildHtmlProps } from '../../utilities/props'
|
4
|
+
import { globalProps, GlobalProps } from "../../utilities/globalProps"
|
5
|
+
|
6
|
+
type TimelineDetailProps = {
|
7
|
+
children?: React.ReactNode,
|
8
|
+
className?: string,
|
9
|
+
htmlOptions?: { [key: string]: any },
|
10
|
+
} & GlobalProps
|
11
|
+
|
12
|
+
const TimelineDetail: React.FC<TimelineDetailProps> = ({
|
13
|
+
children,
|
14
|
+
className,
|
15
|
+
htmlOptions = {},
|
16
|
+
...props
|
17
|
+
}) => {
|
18
|
+
const htmlProps = buildHtmlProps(htmlOptions)
|
19
|
+
return (
|
20
|
+
<div
|
21
|
+
{...htmlProps}
|
22
|
+
className={classnames('pb_timeline_item_right_block', globalProps(props), className)}
|
23
|
+
>
|
24
|
+
{children}
|
25
|
+
</div>
|
26
|
+
)
|
27
|
+
}
|
28
|
+
|
29
|
+
export default TimelineDetail
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import classnames from 'classnames'
|
3
|
+
import { buildHtmlProps } from '../../utilities/props'
|
4
|
+
import { globalProps, GlobalProps } from "../../utilities/globalProps"
|
5
|
+
import DateStacked from '../../pb_date_stacked/_date_stacked'
|
6
|
+
|
7
|
+
type TimelineLabelProps = {
|
8
|
+
date?: Date,
|
9
|
+
children?: React.ReactNode,
|
10
|
+
className?: string,
|
11
|
+
htmlOptions?: { [key: string]: any },
|
12
|
+
} & GlobalProps
|
13
|
+
|
14
|
+
const TimelineLabel: React.FC<TimelineLabelProps> = ({
|
15
|
+
date,
|
16
|
+
children,
|
17
|
+
className,
|
18
|
+
htmlOptions = {},
|
19
|
+
...props
|
20
|
+
}) => {
|
21
|
+
const htmlProps = buildHtmlProps(htmlOptions)
|
22
|
+
return (
|
23
|
+
<div
|
24
|
+
{...htmlProps}
|
25
|
+
className={classnames('pb_timeline_item_left_block', globalProps(props), className)}
|
26
|
+
>
|
27
|
+
{children}
|
28
|
+
{date && (
|
29
|
+
<DateStacked align="center"
|
30
|
+
date={date}
|
31
|
+
size="sm"
|
32
|
+
/>
|
33
|
+
)}
|
34
|
+
</div>
|
35
|
+
)
|
36
|
+
}
|
37
|
+
|
38
|
+
export default TimelineLabel
|
@@ -0,0 +1,42 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import classnames from 'classnames'
|
3
|
+
import { buildHtmlProps } from '../../utilities/props'
|
4
|
+
import { globalProps, GlobalProps } from "../../utilities/globalProps"
|
5
|
+
import IconCircle from '../../pb_icon_circle/_icon_circle'
|
6
|
+
|
7
|
+
type TimelineStepProps = {
|
8
|
+
icon?: string,
|
9
|
+
iconColor?: 'default' | 'royal' | 'blue' | 'purple' | 'teal' | 'red' | 'yellow' | 'green',
|
10
|
+
children?: React.ReactNode,
|
11
|
+
className?: string,
|
12
|
+
htmlOptions?: { [key: string]: any },
|
13
|
+
} & GlobalProps
|
14
|
+
|
15
|
+
const TimelineStep: React.FC<TimelineStepProps> = ({
|
16
|
+
icon = 'user',
|
17
|
+
iconColor = 'default',
|
18
|
+
children,
|
19
|
+
className,
|
20
|
+
htmlOptions = {},
|
21
|
+
...props
|
22
|
+
}) => {
|
23
|
+
const htmlProps = buildHtmlProps(htmlOptions)
|
24
|
+
return (
|
25
|
+
<div
|
26
|
+
{...htmlProps}
|
27
|
+
className={classnames('pb_timeline_item_step', globalProps(props), className)}
|
28
|
+
>
|
29
|
+
{children ? (
|
30
|
+
children
|
31
|
+
) : (
|
32
|
+
<IconCircle icon={icon}
|
33
|
+
size="xs"
|
34
|
+
variant={iconColor}
|
35
|
+
/>
|
36
|
+
)}
|
37
|
+
<div className="pb_timeline_item_connector" />
|
38
|
+
</div>
|
39
|
+
)
|
40
|
+
}
|
41
|
+
|
42
|
+
export default TimelineStep
|