playbook_ui 14.6.2.pre.alpha.PBNTR633dropdownavailablepropstable4305 → 14.6.2.pre.alpha.PBNTR633dropdownavailablepropstable4380
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_card/_card_mixin.scss +1 -2
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +8 -9
- 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_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/dist/chunks/{_typeahead-BV_n6U5W.js → _typeahead-BJrdFWHc.js} +2 -2
- data/dist/chunks/_weekday_stacked-DJWwxF-6.js +45 -0
- data/dist/chunks/vendor.js +1 -1
- 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/version.rb +1 -1
- metadata +19 -5
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.md +0 -1
- data/dist/chunks/_weekday_stacked-BCRN4gY0.js +0 -45
@@ -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
|
@@ -2,6 +2,10 @@ import React from 'react'
|
|
2
2
|
import { render, screen } from '../utilities/test-utils'
|
3
3
|
|
4
4
|
import Timeline from './_timeline'
|
5
|
+
import TimelineItem from './_item'
|
6
|
+
import TimelineLabel from './subcomponents/Label'
|
7
|
+
import TimelineStep from './subcomponents/Step'
|
8
|
+
import TimelineDetail from './subcomponents/Detail'
|
5
9
|
import TitleDetail from '../pb_title_detail/_title_detail'
|
6
10
|
|
7
11
|
const testId = 'timeline'
|
@@ -43,18 +47,91 @@ const TimelineDefault = (props) => (
|
|
43
47
|
</>
|
44
48
|
)
|
45
49
|
|
50
|
+
const TimelineWithChildren = (props) => (
|
51
|
+
<>
|
52
|
+
<Timeline
|
53
|
+
className={className}
|
54
|
+
data={{ testid: testId }}
|
55
|
+
orientation="horizontal"
|
56
|
+
showDate
|
57
|
+
{...props}
|
58
|
+
>
|
59
|
+
<TimelineItem lineStyle="solid"
|
60
|
+
{...props}
|
61
|
+
>
|
62
|
+
<TimelineLabel date={new Date()} />
|
63
|
+
<TimelineStep icon="user"
|
64
|
+
iconColor="royal"
|
65
|
+
/>
|
66
|
+
<TimelineDetail>
|
67
|
+
<TitleDetail
|
68
|
+
detail="37-27 74th Street"
|
69
|
+
title="Jackson Heights"
|
70
|
+
{...props}
|
71
|
+
/>
|
72
|
+
</TimelineDetail>
|
73
|
+
</TimelineItem>
|
74
|
+
|
75
|
+
<TimelineItem lineStyle="dotted"
|
76
|
+
{...props}
|
77
|
+
>
|
78
|
+
<TimelineStep icon="check"
|
79
|
+
iconColor="teal"
|
80
|
+
/>
|
81
|
+
<TimelineDetail>
|
82
|
+
<TitleDetail
|
83
|
+
detail="81 Gate St Brooklyn"
|
84
|
+
title="Greenpoint"
|
85
|
+
{...props}
|
86
|
+
/>
|
87
|
+
</TimelineDetail>
|
88
|
+
</TimelineItem>
|
89
|
+
|
90
|
+
<TimelineItem lineStyle="solid"
|
91
|
+
{...props}
|
92
|
+
>
|
93
|
+
<TimelineLabel
|
94
|
+
date={new Date(new Date().setDate(new Date().getDate() + 1))}
|
95
|
+
/>
|
96
|
+
<TimelineStep icon="map-marker-alt"
|
97
|
+
iconColor="purple"
|
98
|
+
/>
|
99
|
+
<TimelineDetail>
|
100
|
+
<TitleDetail
|
101
|
+
detail="72 E St Astoria"
|
102
|
+
title="Society Hill"
|
103
|
+
{...props}
|
104
|
+
/>
|
105
|
+
</TimelineDetail>
|
106
|
+
</TimelineItem>
|
107
|
+
</Timeline>
|
108
|
+
</>
|
109
|
+
)
|
110
|
+
|
46
111
|
test('should pass data prop', () => {
|
47
112
|
render(<TimelineDefault />)
|
48
113
|
const kit = screen.getByTestId(testId)
|
49
114
|
expect(kit).toBeInTheDocument()
|
50
115
|
})
|
51
116
|
|
117
|
+
test('should pass data prop using children', () => {
|
118
|
+
render(<TimelineWithChildren />)
|
119
|
+
const kit = screen.getByTestId(testId)
|
120
|
+
expect(kit).toBeInTheDocument()
|
121
|
+
})
|
122
|
+
|
52
123
|
test('should pass className prop', () => {
|
53
124
|
render(<TimelineDefault />)
|
54
125
|
const kit = screen.getByTestId(testId)
|
55
126
|
expect(kit).toHaveClass(className)
|
56
127
|
})
|
57
128
|
|
129
|
+
test('should pass className prop with children', () => {
|
130
|
+
render(<TimelineWithChildren />)
|
131
|
+
const kit = screen.getByTestId(testId)
|
132
|
+
expect(kit).toHaveClass(className)
|
133
|
+
})
|
134
|
+
|
58
135
|
test('should pass aria prop', () => {
|
59
136
|
render(<TimelineDefault />)
|
60
137
|
const kit = screen.getByTestId(testId)
|
@@ -86,3 +163,10 @@ test('should pass showDate prop', () => {
|
|
86
163
|
const kit = screen.getByTestId(testId)
|
87
164
|
expect(kit).toHaveClass('pb_timeline_kit__horizontal__with_date')
|
88
165
|
})
|
166
|
+
|
167
|
+
test('should pass showDate prop with Children', () => {
|
168
|
+
const props = { showDate: true }
|
169
|
+
render(<TimelineWithChildren {...props} />)
|
170
|
+
const kit = screen.getByTestId(testId)
|
171
|
+
expect(kit).toHaveClass('pb_timeline_kit__horizontal__with_date')
|
172
|
+
})
|