playbook_ui 14.6.0.pre.alpha.PBNTR5554217 → 14.6.0.pre.alpha.play1586datearea4218
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_currency/_currency.tsx +6 -16
- data/app/pb_kits/playbook/pb_currency/currency.rb +11 -38
- data/app/pb_kits/playbook/pb_currency/currency.test.js +0 -35
- data/app/pb_kits/playbook/pb_currency/docs/example.yml +1 -3
- data/app/pb_kits/playbook/pb_currency/docs/index.js +0 -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/date_area.html.erb +12 -0
- data/app/pb_kits/playbook/pb_timeline/date_area.rb +13 -0
- data/app/pb_kits/playbook/pb_timeline/detail_area.html.erb +3 -0
- data/app/pb_kits/playbook/pb_timeline/detail_area.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 +4 -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/node_area.html.erb +14 -0
- data/app/pb_kits/playbook/pb_timeline/node_area.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/_weekday_stacked-C-VEa5Ar.js +45 -0
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +15 -4
- data/app/pb_kits/playbook/pb_currency/docs/_currency_comma_separator.html.erb +0 -7
- data/app/pb_kits/playbook/pb_currency/docs/_currency_comma_separator.jsx +0 -18
- data/dist/chunks/_weekday_stacked-C2icYweq.js +0 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d34cf484b073d589372720f766effb37be243a1e8c48a3b5eb90a9d683759929
|
4
|
+
data.tar.gz: ad599ad33f8f66e1057957ea957899f7d14e9215beaf342132e0f45b37906216
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55fcf62a39e9220df67563a41c5882544c643ed16c12c575fdb2c9a3f0e37023aa56e4ecb6eef3bd34b6467b2995fe0c2918e0deb8d85ed76a042c0b2bccd3e1
|
7
|
+
data.tar.gz: 132c841e4900a5612f18ea87831f6ccdea99c9557c3a505b7feb4a0f4e81b22cc2d6721f073b531ed7a99a68e43af2c23c4ef75289e7a2ea75bb5305add7ff22
|
@@ -26,7 +26,6 @@ type CurrencyProps = {
|
|
26
26
|
variant?: 'default' | 'light' | 'bold',
|
27
27
|
unit?: string,
|
28
28
|
unstyled?: boolean,
|
29
|
-
commaSeparator?: boolean,
|
30
29
|
}
|
31
30
|
|
32
31
|
const sizes: {lg: 1, md: 3, sm: 4} = {
|
@@ -54,7 +53,6 @@ const Currency = (props: CurrencyProps): React.ReactElement => {
|
|
54
53
|
variant = 'default',
|
55
54
|
dark = false,
|
56
55
|
unstyled = false,
|
57
|
-
commaSeparator = false,
|
58
56
|
} = props
|
59
57
|
|
60
58
|
const emphasizedClass = emphasized ? '' : '_deemphasized'
|
@@ -76,7 +74,7 @@ const Currency = (props: CurrencyProps): React.ReactElement => {
|
|
76
74
|
className
|
77
75
|
)
|
78
76
|
|
79
|
-
const getFormattedNumber = (input: number | any) => new Intl.NumberFormat('en-US', {
|
77
|
+
const getFormattedNumber = (input: number | any ) => new Intl.NumberFormat('en-US', {
|
80
78
|
notation: 'compact',
|
81
79
|
maximumFractionDigits: 1,
|
82
80
|
}).format(input)
|
@@ -90,20 +88,12 @@ const Currency = (props: CurrencyProps): React.ReactElement => {
|
|
90
88
|
return isAmount ? num.slice(0, -1) : isUnit ? num.slice(-1) : ''
|
91
89
|
}
|
92
90
|
|
93
|
-
const getMatchingDecimalAmount = decimals === "matching" ? amount : whole
|
94
|
-
|
91
|
+
const getMatchingDecimalAmount = decimals === "matching" ? amount : whole,
|
92
|
+
getMatchingDecimalValue = decimals === "matching" ? '' : `.${decimal}`
|
95
93
|
|
96
|
-
const
|
97
|
-
|
98
|
-
|
99
|
-
const [wholePart, decimalPart] = amount.split('.');
|
100
|
-
const formattedWhole = new Intl.NumberFormat('en-US').format(parseInt(wholePart));
|
101
|
-
return decimalPart ? `${formattedWhole}.${decimalPart}` : formattedWhole;
|
102
|
-
}
|
103
|
-
|
104
|
-
const getAmount = abbreviate ? getAbbreviatedValue('amount') : formatAmount(getMatchingDecimalAmount)
|
105
|
-
const getAbbreviation = abbreviate ? getAbbreviatedValue('unit') : null
|
106
|
-
const getDecimalValue = abbreviate ? '' : getMatchingDecimalValue
|
94
|
+
const getAmount = abbreviate ? getAbbreviatedValue('amount') : getMatchingDecimalAmount,
|
95
|
+
getAbbreviation = abbreviate ? getAbbreviatedValue('unit') : null,
|
96
|
+
getDecimalValue = abbreviate ? '' : getMatchingDecimalValue
|
107
97
|
|
108
98
|
return (
|
109
99
|
<div
|
@@ -43,9 +43,6 @@ module Playbook
|
|
43
43
|
prop :unstyled, type: Playbook::Props::Boolean,
|
44
44
|
default: false
|
45
45
|
|
46
|
-
prop :comma_separator, type: Playbook::Props::Boolean,
|
47
|
-
default: false
|
48
|
-
|
49
46
|
def classname
|
50
47
|
generate_classname("pb_currency_kit", align, size, dark_class)
|
51
48
|
end
|
@@ -68,7 +65,7 @@ module Playbook
|
|
68
65
|
def title_props
|
69
66
|
{
|
70
67
|
size: size_value,
|
71
|
-
text: abbreviate ? abbreviated_value :
|
68
|
+
text: abbreviate ? abbreviated_value : whole_value,
|
72
69
|
classname: "pb_currency_value",
|
73
70
|
dark: dark,
|
74
71
|
}
|
@@ -99,38 +96,28 @@ module Playbook
|
|
99
96
|
private
|
100
97
|
|
101
98
|
def whole_value
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
else
|
106
|
-
value
|
107
|
-
end
|
99
|
+
return amount if decimals == "matching"
|
100
|
+
|
101
|
+
amount.split(".").first.to_s
|
108
102
|
end
|
109
103
|
|
110
|
-
def
|
111
|
-
amount.split(".")
|
104
|
+
def abbreviated_value(index = 0..-2)
|
105
|
+
value = amount.split(".").first.split(",").join("")
|
106
|
+
abbreviated_num = number_to_human(value, units: { thousand: "K", million: "M", billion: "B", trillion: "T" }).gsub(/\s+/, "").to_s
|
107
|
+
abbreviated_num[index]
|
112
108
|
end
|
113
109
|
|
114
110
|
def units_element
|
115
111
|
return "" if decimals == "matching" && !abbreviate && !unit
|
116
112
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
else
|
121
|
-
".#{decimal_value}"
|
122
|
-
end
|
113
|
+
_, decimal_part = amount.split(".")
|
114
|
+
if unit.nil? && abbreviate == false
|
115
|
+
decimal_part.nil? ? ".00" : ".#{decimal_part}"
|
123
116
|
else
|
124
117
|
abbreviate ? "#{abbreviated_value(-1)}#{unit}" : unit
|
125
118
|
end
|
126
119
|
end
|
127
120
|
|
128
|
-
def abbreviated_value(index = 0..-2)
|
129
|
-
value = amount.split(".").first.gsub(",", "").to_i
|
130
|
-
abbreviated_num = number_to_human(value, units: { thousand: "K", million: "M", billion: "B", trillion: "T" }).gsub(/\s+/, "")
|
131
|
-
abbreviated_num[index]
|
132
|
-
end
|
133
|
-
|
134
121
|
def size_value
|
135
122
|
case size
|
136
123
|
when "lg"
|
@@ -145,20 +132,6 @@ module Playbook
|
|
145
132
|
def dark_class
|
146
133
|
dark ? "dark" : nil
|
147
134
|
end
|
148
|
-
|
149
|
-
def formatted_amount
|
150
|
-
return abbreviated_value if abbreviate
|
151
|
-
|
152
|
-
if decimals == "matching"
|
153
|
-
if comma_separator
|
154
|
-
number_with_delimiter(amount.gsub(",", ""))
|
155
|
-
else
|
156
|
-
amount
|
157
|
-
end
|
158
|
-
else
|
159
|
-
whole_value
|
160
|
-
end
|
161
|
-
end
|
162
135
|
end
|
163
136
|
end
|
164
137
|
end
|
@@ -61,38 +61,3 @@ test('decimals default prop returns decimals as body text', () => {
|
|
61
61
|
expect(currencyKit.querySelector('.pb_currency_value')).toHaveTextContent('320')
|
62
62
|
expect(currencyKit.querySelector('.unit')).toHaveTextContent('.20')
|
63
63
|
})
|
64
|
-
|
65
|
-
|
66
|
-
test('commaSeparator prop returns comma separated amount', () => {
|
67
|
-
render(
|
68
|
-
<Currency
|
69
|
-
amount="1234567890"
|
70
|
-
comma_separator
|
71
|
-
data={{ testid: 'comma-test' }}
|
72
|
-
/>
|
73
|
-
)
|
74
|
-
expect(screen.getByTestId('comma-test')).toHaveTextContent('1,234,567,890')
|
75
|
-
})
|
76
|
-
|
77
|
-
test('commaSeparator prop returns comma separated amount with decimals', () => {
|
78
|
-
render(
|
79
|
-
<Currency
|
80
|
-
amount="1234567890.12"
|
81
|
-
comma_separator
|
82
|
-
data={{ testid: 'comma-test-decimals' }}
|
83
|
-
/>
|
84
|
-
)
|
85
|
-
expect(screen.getByTestId('comma-test-decimals')).toHaveTextContent('1,234,567,890.12')
|
86
|
-
})
|
87
|
-
|
88
|
-
test('commaSeparator prop returns comma separated amount with decimals="matching"', () => {
|
89
|
-
render(
|
90
|
-
<Currency
|
91
|
-
amount="1234567890.12"
|
92
|
-
comma_separator
|
93
|
-
data={{ testid: 'comma-test-decimals-matching' }}
|
94
|
-
decimals="matching"
|
95
|
-
/>
|
96
|
-
)
|
97
|
-
expect(screen.getByTestId('comma-test-decimals-matching')).toHaveTextContent('1,234,567,890.12')
|
98
|
-
})
|
@@ -8,8 +8,7 @@ examples:
|
|
8
8
|
- currency_abbreviated: Abbreviate Larger Amounts
|
9
9
|
- currency_matching_decimals: Matching Decimals
|
10
10
|
- currency_unstyled: Unstyled
|
11
|
-
|
12
|
-
|
11
|
+
|
13
12
|
react:
|
14
13
|
- currency_variants: Variants
|
15
14
|
- currency_size: Size
|
@@ -18,7 +17,6 @@ examples:
|
|
18
17
|
- currency_abbreviated: Abbreviate Larger Amounts
|
19
18
|
- currency_matching_decimals: Matching Decimals
|
20
19
|
- currency_unstyled: Unstyled
|
21
|
-
- currency_comma_separator: Comma Separator
|
22
20
|
|
23
21
|
swift:
|
24
22
|
- currency_size_swift: Size
|
@@ -5,4 +5,3 @@ export { default as CurrencyNoSymbol } from './_currency_no_symbol.jsx'
|
|
5
5
|
export { default as CurrencyAbbreviated } from './_currency_abbreviated.jsx'
|
6
6
|
export { default as CurrencyMatchingDecimals } from './_currency_matching_decimals.jsx'
|
7
7
|
export { default as CurrencyUnstyled } from './_currency_unstyled.jsx'
|
8
|
-
export { default as CurrencyCommaSeparator } from './_currency_comma_separator.jsx'
|
@@ -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.date_area do %>
|
5
|
+
<%= pb_rails("timeline/date_area") do %>
|
6
|
+
<%= pb_rails("title", props: { text: "Any Kit Here", size: 2 }) %>
|
7
|
+
<% end %>
|
8
|
+
<% end %>
|
9
|
+
|
10
|
+
<% item.node_area do %>
|
11
|
+
<%= pb_rails("timeline/node_area", props: { icon: 'check', icon_color: 'teal' }) %>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<% item.detail_area 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.node_area do %>
|
24
|
+
<%= pb_rails("timeline/node_area") do %>
|
25
|
+
<%= pb_rails("pill", props: { text: "Any Kit" , variant: "success" }) %>
|
26
|
+
<% end %>
|
27
|
+
<% end %>
|
28
|
+
|
29
|
+
<% item.detail_area 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.Label>
|
38
|
+
<Pill text="Any Kit"
|
39
|
+
variant="success"
|
40
|
+
/>
|
41
|
+
</Timeline.Label>
|
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 date_area %>
|
3
|
+
<%= date_area %>
|
4
|
+
<% else %>
|
5
|
+
<%= pb_rails("timeline/date_area", 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 node_area %>
|
9
|
+
<%= node_area %>
|
10
|
+
<% else %>
|
11
|
+
<%= pb_rails("timeline/node_area", props: { icon: icon, icon_color: icon_color }) %>
|
12
|
+
<% end %>
|
21
13
|
|
22
|
-
|
23
|
-
<%=
|
24
|
-
|
14
|
+
<% if detail_area %>
|
15
|
+
<%= detail_area %>
|
16
|
+
<% else %>
|
17
|
+
<%= pb_rails("timeline/detail_area") 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 NodeArea < 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
|