playbook_ui 15.6.0.pre.alpha.play265012993 → 15.6.0.pre.alpha.play266913088
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +3 -2
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +4 -0
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +95 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_background_colors_rails.html.erb +43 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_background_colors_rails.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_background_control_rails.html.erb +11 -5
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_background_control_rails.md +7 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_background.jsx +54 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_background.md +9 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_background_multi.jsx +80 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_background_multi.md +3 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +4 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +3 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +57 -0
- data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +0 -6
- data/app/pb_kits/playbook/pb_contact/_contact.tsx +51 -24
- data/app/pb_kits/playbook/pb_contact/contact.html.erb +53 -19
- data/app/pb_kits/playbook/pb_contact/contact.rb +11 -1
- data/app/pb_kits/playbook/pb_contact/contact.test.js +76 -0
- data/app/pb_kits/playbook/pb_contact/docs/_contact_unstyled.html.erb +33 -0
- data/app/pb_kits/playbook/pb_contact/docs/_contact_unstyled.jsx +46 -0
- data/app/pb_kits/playbook/pb_contact/docs/_contact_unstyled_rails.md +2 -0
- data/app/pb_kits/playbook/pb_contact/docs/_contact_unstyled_react.md +2 -0
- data/app/pb_kits/playbook/pb_contact/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_contact/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +16 -4
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range_pattern_rails.html.erb +23 -14
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range_pattern_rails.md +1 -1
- data/app/pb_kits/playbook/pb_dialog/_dialog.tsx +2 -1
- data/app/pb_kits/playbook/pb_dialog/dialog.html.erb +1 -1
- data/app/pb_kits/playbook/pb_dialog/dialog.rb +1 -0
- data/app/pb_kits/playbook/pb_dialog/dialog.test.jsx +14 -0
- data/app/pb_kits/playbook/pb_dialog/dialog_header.html.erb +5 -4
- data/app/pb_kits/playbook/pb_dialog/dialog_header.rb +2 -0
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_closeable.html.erb +24 -0
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_closeable.jsx +60 -0
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_closeable.md +3 -0
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_overflow_visible.html.erb +71 -0
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_overflow_visible.jsx +57 -0
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_overflow_visible_rails.md +1 -0
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_overflow_visible_react.md +1 -0
- data/app/pb_kits/playbook/pb_dialog/docs/example.yml +4 -0
- data/app/pb_kits/playbook/pb_dialog/docs/index.js +3 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_rails.html.erb +7 -5
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_default_dates.html.erb +19 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_rails.html.erb +12 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_rails.md +26 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_range_end_rails.html.erb +19 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_range_end_rails.md +1 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_with_date_pickers_default_rails.html.erb +30 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_with_date_pickers_default_rails.md +3 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_with_date_pickers_rails.html.erb +29 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_with_date_pickers_rails.md +13 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display_rails.html.erb +3 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +5 -0
- data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +4 -0
- data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +39 -5
- data/app/pb_kits/playbook/pb_dropdown/index.js +171 -3
- data/app/pb_kits/playbook/pb_dropdown/quickpick_helper.rb +75 -0
- data/app/pb_kits/playbook/pb_filter/Filter/FilterBackground.tsx +3 -3
- data/app/pb_kits/playbook/pb_legend/_legend.tsx +1 -6
- data/app/pb_kits/playbook/pb_legend/legend.html.erb +0 -1
- data/app/pb_kits/playbook/pb_table/_table.tsx +187 -33
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant.jsx +134 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant.md +34 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_rails.html.erb +101 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_rails.md +33 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_with_pagination.jsx +180 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_with_pagination.md +3 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_with_pagination_rails.html.erb +122 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_with_pagination_rails.md +3 -0
- data/app/pb_kits/playbook/pb_table/docs/example.yml +4 -0
- data/app/pb_kits/playbook/pb_table/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_table/table.html.erb +68 -12
- data/app/pb_kits/playbook/pb_table/table.rb +22 -3
- data/app/pb_kits/playbook/pb_table/table.test.js +143 -0
- data/app/pb_kits/playbook/pb_timeline/_item.tsx +3 -0
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_show_current_year.html.erb +60 -0
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_show_current_year.jsx +118 -0
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_show_current_year.md +1 -0
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_date.md +1 -1
- data/app/pb_kits/playbook/pb_timeline/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_timeline/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_timeline/item.html.erb +1 -1
- data/app/pb_kits/playbook/pb_timeline/item.rb +2 -0
- data/app/pb_kits/playbook/pb_timeline/label.html.erb +2 -1
- data/app/pb_kits/playbook/pb_timeline/label.rb +2 -0
- data/app/pb_kits/playbook/pb_timeline/subcomponents/Label.tsx +3 -0
- data/app/pb_kits/playbook/pb_timeline/timeline.test.js +51 -0
- data/dist/chunks/_typeahead-CbjBmIDu.js +6 -0
- data/dist/chunks/{lib-DDDLiZuu.js → lib-DxDBrGZX.js} +3 -3
- data/dist/chunks/vendor.js +3 -3
- data/dist/menu.yml +3 -4
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +42 -4
- data/dist/chunks/_typeahead-DMyvWpig.js +0 -6
|
@@ -184,3 +184,146 @@ test("when headerStyle is floating", () => {
|
|
|
184
184
|
const kit = renderKit(Table, props, { headerStyle: "floating" })
|
|
185
185
|
expect(kit).toHaveClass("pb_table table-sm table-responsive-collapse table-card header-floating table-collapse-sm")
|
|
186
186
|
})
|
|
187
|
+
|
|
188
|
+
test("renders withFilter variant with Card wrapper", () => {
|
|
189
|
+
const { container } = render(
|
|
190
|
+
<Table
|
|
191
|
+
data={{testid: "table-with-filter"}}
|
|
192
|
+
filterContent={<div>{"Mock Filter"}</div>}
|
|
193
|
+
title="Test Table"
|
|
194
|
+
variant="withFilter"
|
|
195
|
+
>
|
|
196
|
+
<Table.Head>
|
|
197
|
+
<Table.Row>
|
|
198
|
+
<Table.Header>{"Column 1"}</Table.Header>
|
|
199
|
+
</Table.Row>
|
|
200
|
+
</Table.Head>
|
|
201
|
+
<Table.Body>
|
|
202
|
+
<Table.Row>
|
|
203
|
+
<Table.Cell>{"Value 1"}</Table.Cell>
|
|
204
|
+
</Table.Row>
|
|
205
|
+
</Table.Body>
|
|
206
|
+
</Table>
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
const card = container.querySelector('.pb_card_kit')
|
|
210
|
+
expect(card).toBeInTheDocument()
|
|
211
|
+
const filter = container.querySelector('.pb_filter_kit')
|
|
212
|
+
expect(filter).toBeInTheDocument()
|
|
213
|
+
})
|
|
214
|
+
|
|
215
|
+
test("renders title when provided with withFilter variant", () => {
|
|
216
|
+
render(
|
|
217
|
+
<Table
|
|
218
|
+
filterContent={<div>{"Mock Filter"}</div>}
|
|
219
|
+
title="Test Title"
|
|
220
|
+
variant="withFilter"
|
|
221
|
+
>
|
|
222
|
+
<Table.Head>
|
|
223
|
+
<Table.Row>
|
|
224
|
+
<Table.Header>{"Column 1"}</Table.Header>
|
|
225
|
+
</Table.Row>
|
|
226
|
+
</Table.Head>
|
|
227
|
+
<Table.Body>
|
|
228
|
+
<Table.Row>
|
|
229
|
+
<Table.Cell>{"Value 1"}</Table.Cell>
|
|
230
|
+
</Table.Row>
|
|
231
|
+
</Table.Body>
|
|
232
|
+
</Table>
|
|
233
|
+
)
|
|
234
|
+
|
|
235
|
+
expect(screen.getByText("Test Title")).toBeInTheDocument()
|
|
236
|
+
})
|
|
237
|
+
|
|
238
|
+
test("renders filter component in withFilter variant", () => {
|
|
239
|
+
const { container } = render(
|
|
240
|
+
<Table
|
|
241
|
+
filterContent={<div data-testid="test-filter">{"Filter inputs"}</div>}
|
|
242
|
+
variant="withFilter"
|
|
243
|
+
>
|
|
244
|
+
<Table.Head>
|
|
245
|
+
<Table.Row>
|
|
246
|
+
<Table.Header>{"Column 1"}</Table.Header>
|
|
247
|
+
</Table.Row>
|
|
248
|
+
</Table.Head>
|
|
249
|
+
<Table.Body>
|
|
250
|
+
<Table.Row>
|
|
251
|
+
<Table.Cell>{"Value 1"}</Table.Cell>
|
|
252
|
+
</Table.Row>
|
|
253
|
+
</Table.Body>
|
|
254
|
+
</Table>
|
|
255
|
+
)
|
|
256
|
+
|
|
257
|
+
const filter = container.querySelector('.pb_filter_kit')
|
|
258
|
+
expect(filter).toBeInTheDocument()
|
|
259
|
+
})
|
|
260
|
+
|
|
261
|
+
test("renders SectionSeparator between filter and table in withFilter variant", () => {
|
|
262
|
+
const { container } = render(
|
|
263
|
+
<Table
|
|
264
|
+
filterContent={<div>{"Filter content"}</div>}
|
|
265
|
+
variant="withFilter"
|
|
266
|
+
>
|
|
267
|
+
<Table.Head>
|
|
268
|
+
<Table.Row>
|
|
269
|
+
<Table.Header>{"Column 1"}</Table.Header>
|
|
270
|
+
</Table.Row>
|
|
271
|
+
</Table.Head>
|
|
272
|
+
<Table.Body>
|
|
273
|
+
<Table.Row>
|
|
274
|
+
<Table.Cell>{"Value 1"}</Table.Cell>
|
|
275
|
+
</Table.Row>
|
|
276
|
+
</Table.Body>
|
|
277
|
+
</Table>
|
|
278
|
+
)
|
|
279
|
+
|
|
280
|
+
const separator = container.querySelector('.pb_section_separator_kit')
|
|
281
|
+
expect(separator).toBeInTheDocument()
|
|
282
|
+
})
|
|
283
|
+
|
|
284
|
+
test("does not render title when not provided with withFilter variant", () => {
|
|
285
|
+
const { container } = render(
|
|
286
|
+
<Table
|
|
287
|
+
filterContent={<div>{"Filter content"}</div>}
|
|
288
|
+
variant="withFilter"
|
|
289
|
+
>
|
|
290
|
+
<Table.Head>
|
|
291
|
+
<Table.Row>
|
|
292
|
+
<Table.Header>{"Column 1"}</Table.Header>
|
|
293
|
+
</Table.Row>
|
|
294
|
+
</Table.Head>
|
|
295
|
+
<Table.Body>
|
|
296
|
+
<Table.Row>
|
|
297
|
+
<Table.Cell>{"Value 1"}</Table.Cell>
|
|
298
|
+
</Table.Row>
|
|
299
|
+
</Table.Body>
|
|
300
|
+
</Table>
|
|
301
|
+
)
|
|
302
|
+
|
|
303
|
+
const title = container.querySelector('.pb_title_kit')
|
|
304
|
+
expect(title).not.toBeInTheDocument()
|
|
305
|
+
})
|
|
306
|
+
|
|
307
|
+
test("renders default variant without Card wrapper", () => {
|
|
308
|
+
render(
|
|
309
|
+
<Table
|
|
310
|
+
data={{testid: "default-table"}}
|
|
311
|
+
variant="default"
|
|
312
|
+
>
|
|
313
|
+
<Table.Head>
|
|
314
|
+
<Table.Row>
|
|
315
|
+
<Table.Header>{"Column 1"}</Table.Header>
|
|
316
|
+
</Table.Row>
|
|
317
|
+
</Table.Head>
|
|
318
|
+
<Table.Body>
|
|
319
|
+
<Table.Row>
|
|
320
|
+
<Table.Cell>{"Value 1"}</Table.Cell>
|
|
321
|
+
</Table.Row>
|
|
322
|
+
</Table.Body>
|
|
323
|
+
</Table>
|
|
324
|
+
)
|
|
325
|
+
|
|
326
|
+
const table = screen.getByTestId("default-table")
|
|
327
|
+
expect(table).toBeInTheDocument()
|
|
328
|
+
expect(table.closest('.pb_card_kit')).not.toBeInTheDocument()
|
|
329
|
+
})
|
|
@@ -18,6 +18,7 @@ type ItemProps = {
|
|
|
18
18
|
icon?: string,
|
|
19
19
|
iconColor?: 'default' | 'royal' | 'blue' | 'purple' | 'teal' | 'red' | 'yellow' | 'green',
|
|
20
20
|
lineStyle?: 'solid' | 'dotted',
|
|
21
|
+
showCurrentYear?: boolean,
|
|
21
22
|
} & GlobalProps
|
|
22
23
|
|
|
23
24
|
function isElementOfType<P>(
|
|
@@ -35,6 +36,7 @@ const TimelineItem = ({
|
|
|
35
36
|
icon = 'user',
|
|
36
37
|
iconColor = 'default',
|
|
37
38
|
lineStyle = 'solid',
|
|
39
|
+
showCurrentYear = false,
|
|
38
40
|
...props
|
|
39
41
|
}: ItemProps): React.ReactElement => {
|
|
40
42
|
const timelineItemCss = buildCss('pb_timeline_item_kit', lineStyle)
|
|
@@ -73,6 +75,7 @@ const TimelineItem = ({
|
|
|
73
75
|
<DateStacked
|
|
74
76
|
align="center"
|
|
75
77
|
date={date}
|
|
78
|
+
showCurrentYear={showCurrentYear}
|
|
76
79
|
size="sm"
|
|
77
80
|
/>
|
|
78
81
|
)}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<%= pb_rails("timeline", props: {orientation: "horizontal", show_date: true}) do %>
|
|
2
|
+
<%= pb_rails("timeline/item", props: {icon: "user", icon_color: "royal", line_style: "solid", date: Date.today, show_current_year: true }) do %>
|
|
3
|
+
<%= pb_rails("title_detail", props: {
|
|
4
|
+
title: "Jackson Heights",
|
|
5
|
+
detail: "37-27 74th Street"
|
|
6
|
+
}) %>
|
|
7
|
+
<% end %>
|
|
8
|
+
<%= pb_rails("timeline/item", props: {icon: "check", icon_color: "teal", line_style: "dotted" }) do %>
|
|
9
|
+
<%= pb_rails("title_detail", props: {
|
|
10
|
+
title: "Greenpoint",
|
|
11
|
+
detail: "81 Gate St Brooklyn"
|
|
12
|
+
}) %>
|
|
13
|
+
<% end %>
|
|
14
|
+
<%= pb_rails("timeline/item", props: { line_style: "solid"}) do |item| %>
|
|
15
|
+
<% item.label do %>
|
|
16
|
+
<%= pb_rails("timeline/label", props: { date: Date.today, show_current_year: true }) %>
|
|
17
|
+
<% end %>
|
|
18
|
+
<% item.step do %>
|
|
19
|
+
<%= pb_rails("timeline/step", props: { icon: 'map-marker-alt', icon_color: 'purple' }) %>
|
|
20
|
+
<% end %>
|
|
21
|
+
<% item.detail do %>
|
|
22
|
+
<%= pb_rails("title_detail", props: {
|
|
23
|
+
title: "Society Hill",
|
|
24
|
+
detail: "72 E St Astoria"
|
|
25
|
+
}) %>
|
|
26
|
+
<% end %>
|
|
27
|
+
<% end %>
|
|
28
|
+
<% end %>
|
|
29
|
+
|
|
30
|
+
<br /><br /><br />
|
|
31
|
+
|
|
32
|
+
<%= pb_rails("timeline", props: {orientation: "vertical", show_date: true}) do %>
|
|
33
|
+
<%= pb_rails("timeline/item", props: {icon: "user", icon_color: "royal", line_style: "solid", date: Date.today, show_current_year: true }) do %>
|
|
34
|
+
<%= pb_rails("title_detail", props: {
|
|
35
|
+
title: "Jackson Heights",
|
|
36
|
+
detail: "37-27 74th Street"
|
|
37
|
+
}) %>
|
|
38
|
+
<% end %>
|
|
39
|
+
<%= pb_rails("timeline/item", props: {icon: "check", icon_color: "teal", line_style: "dotted" }) do %>
|
|
40
|
+
<%= pb_rails("title_detail", props: {
|
|
41
|
+
title: "Greenpoint",
|
|
42
|
+
detail: "81 Gate St Brooklyn"
|
|
43
|
+
}) %>
|
|
44
|
+
<% end %>
|
|
45
|
+
<%= pb_rails("timeline/item", props: { line_style: "solid"}) do |item| %>
|
|
46
|
+
<% item.label do %>
|
|
47
|
+
<%= pb_rails("timeline/label", props: { date: Date.today, show_current_year: true }) %>
|
|
48
|
+
<% end %>
|
|
49
|
+
<% item.step do %>
|
|
50
|
+
<%= pb_rails("timeline/step", props: { icon: 'map-marker-alt', icon_color: 'purple' }) %>
|
|
51
|
+
<% end %>
|
|
52
|
+
<% item.detail do %>
|
|
53
|
+
<%= pb_rails("title_detail", props: {
|
|
54
|
+
title: "Society Hill",
|
|
55
|
+
detail: "72 E St Astoria"
|
|
56
|
+
}) %>
|
|
57
|
+
<% end %>
|
|
58
|
+
<% end %>
|
|
59
|
+
<% end %>
|
|
60
|
+
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import Timeline from '../_timeline'
|
|
4
|
+
import TitleDetail from '../../pb_title_detail/_title_detail'
|
|
5
|
+
|
|
6
|
+
const TimelineShowCurrentYear = (props) => (
|
|
7
|
+
<div>
|
|
8
|
+
<Timeline
|
|
9
|
+
orientation="horizontal"
|
|
10
|
+
showDate
|
|
11
|
+
{...props}
|
|
12
|
+
>
|
|
13
|
+
<Timeline.Item
|
|
14
|
+
date={new Date()}
|
|
15
|
+
icon="user"
|
|
16
|
+
iconColor="royal"
|
|
17
|
+
showCurrentYear
|
|
18
|
+
{...props}
|
|
19
|
+
>
|
|
20
|
+
<TitleDetail
|
|
21
|
+
detail="37-27 74th Street"
|
|
22
|
+
title="Jackson Heights"
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
</Timeline.Item>
|
|
26
|
+
<Timeline.Item
|
|
27
|
+
icon="check"
|
|
28
|
+
iconColor="teal"
|
|
29
|
+
lineStyle="dotted"
|
|
30
|
+
{...props}
|
|
31
|
+
>
|
|
32
|
+
<TitleDetail
|
|
33
|
+
detail="81 Gate St Brooklyn"
|
|
34
|
+
title="Greenpoint"
|
|
35
|
+
{...props}
|
|
36
|
+
/>
|
|
37
|
+
</Timeline.Item>
|
|
38
|
+
<Timeline.Item
|
|
39
|
+
lineStyle="solid"
|
|
40
|
+
{...props}
|
|
41
|
+
>
|
|
42
|
+
<Timeline.Label
|
|
43
|
+
date={new Date()}
|
|
44
|
+
showCurrentYear
|
|
45
|
+
/>
|
|
46
|
+
<Timeline.Step
|
|
47
|
+
icon="map-marker-alt"
|
|
48
|
+
iconColor="purple"
|
|
49
|
+
/>
|
|
50
|
+
<Timeline.Detail>
|
|
51
|
+
<TitleDetail
|
|
52
|
+
detail="72 E St Astoria"
|
|
53
|
+
title="Society Hill"
|
|
54
|
+
{...props}
|
|
55
|
+
/>
|
|
56
|
+
</Timeline.Detail>
|
|
57
|
+
</Timeline.Item>
|
|
58
|
+
</Timeline>
|
|
59
|
+
|
|
60
|
+
<br />
|
|
61
|
+
<br />
|
|
62
|
+
<br />
|
|
63
|
+
|
|
64
|
+
<Timeline
|
|
65
|
+
orientation="vertical"
|
|
66
|
+
showDate
|
|
67
|
+
{...props}
|
|
68
|
+
>
|
|
69
|
+
<Timeline.Item
|
|
70
|
+
date={new Date()}
|
|
71
|
+
icon="user"
|
|
72
|
+
iconColor="royal"
|
|
73
|
+
showCurrentYear
|
|
74
|
+
{...props}
|
|
75
|
+
>
|
|
76
|
+
<TitleDetail
|
|
77
|
+
detail="37-27 74th Street"
|
|
78
|
+
title="Jackson Heights"
|
|
79
|
+
{...props}
|
|
80
|
+
/>
|
|
81
|
+
</Timeline.Item>
|
|
82
|
+
<Timeline.Item
|
|
83
|
+
icon="check"
|
|
84
|
+
iconColor="teal"
|
|
85
|
+
lineStyle="dotted"
|
|
86
|
+
{...props}
|
|
87
|
+
>
|
|
88
|
+
<TitleDetail
|
|
89
|
+
detail="81 Gate St Brooklyn"
|
|
90
|
+
title="Greenpoint"
|
|
91
|
+
{...props}
|
|
92
|
+
/>
|
|
93
|
+
</Timeline.Item>
|
|
94
|
+
<Timeline.Item
|
|
95
|
+
lineStyle="solid"
|
|
96
|
+
{...props}
|
|
97
|
+
>
|
|
98
|
+
<Timeline.Label
|
|
99
|
+
date={new Date()}
|
|
100
|
+
showCurrentYear
|
|
101
|
+
/>
|
|
102
|
+
<Timeline.Step
|
|
103
|
+
icon="map-marker-alt"
|
|
104
|
+
iconColor="purple"
|
|
105
|
+
/>
|
|
106
|
+
<Timeline.Detail>
|
|
107
|
+
<TitleDetail
|
|
108
|
+
detail="72 E St Astoria"
|
|
109
|
+
title="Society Hill"
|
|
110
|
+
{...props}
|
|
111
|
+
/>
|
|
112
|
+
</Timeline.Detail>
|
|
113
|
+
</Timeline.Item>
|
|
114
|
+
</Timeline>
|
|
115
|
+
</div>
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
export default TimelineShowCurrentYear
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
By default, the Timeline kit does NOT display the year if it is the current year. If you want to display the current year you can do so by setting `showCurrentYear`/`show_current_year` to true. Pass it to `Timeline.Item`/`timeline/item` when using its `date` prop, or to `Timeline.Label`/`timeline/label` if following the "With Children" pattern.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Use the optional `showDate` prop to render the timeline kit with a visible date.
|
|
1
|
+
Use the optional `showDate` prop to render the timeline kit with a visible date. By default, if the date is from the current year, the year will not be displayed; however, if the date is NOT from the current year, the kit will display the year as well.
|
|
@@ -5,6 +5,7 @@ examples:
|
|
|
5
5
|
- timeline_vertical: Vertical
|
|
6
6
|
- timeline_with_date: With Date
|
|
7
7
|
- timeline_with_children: With Children
|
|
8
|
+
- timeline_show_current_year: Show Current Year
|
|
8
9
|
- timeline_with_gap: With Gap
|
|
9
10
|
|
|
10
11
|
|
|
@@ -13,4 +14,5 @@ examples:
|
|
|
13
14
|
- timeline_vertical: Vertical
|
|
14
15
|
- timeline_with_date: With Date
|
|
15
16
|
- timeline_with_children: With Children
|
|
17
|
+
- timeline_show_current_year: Show Current Year
|
|
16
18
|
- timeline_with_gap: With Gap
|
|
@@ -3,4 +3,5 @@ export { default as TimelineVertical } from './_timeline_vertical.jsx'
|
|
|
3
3
|
export { default as TimelineWithDate } from './_timeline_with_date.jsx'
|
|
4
4
|
export { default as TimelineWithChildren } from './_timeline_with_children.jsx'
|
|
5
5
|
export { default as TimelineWithGap } from './_timeline_with_gap.jsx'
|
|
6
|
+
export { default as TimelineShowCurrentYear } from './_timeline_show_current_year.jsx'
|
|
6
7
|
|
|
@@ -9,6 +9,7 @@ type TimelineLabelProps = {
|
|
|
9
9
|
children?: React.ReactNode,
|
|
10
10
|
className?: string,
|
|
11
11
|
htmlOptions?: { [key: string]: any },
|
|
12
|
+
showCurrentYear?: boolean,
|
|
12
13
|
} & GlobalProps
|
|
13
14
|
|
|
14
15
|
const TimelineLabel: React.FC<TimelineLabelProps> = ({
|
|
@@ -16,6 +17,7 @@ const TimelineLabel: React.FC<TimelineLabelProps> = ({
|
|
|
16
17
|
children,
|
|
17
18
|
className,
|
|
18
19
|
htmlOptions = {},
|
|
20
|
+
showCurrentYear = false,
|
|
19
21
|
...props
|
|
20
22
|
}) => {
|
|
21
23
|
const htmlProps = buildHtmlProps(htmlOptions)
|
|
@@ -28,6 +30,7 @@ const TimelineLabel: React.FC<TimelineLabelProps> = ({
|
|
|
28
30
|
{date && (
|
|
29
31
|
<DateStacked align="center"
|
|
30
32
|
date={date}
|
|
33
|
+
showCurrentYear={showCurrentYear}
|
|
31
34
|
size="sm"
|
|
32
35
|
/>
|
|
33
36
|
)}
|
|
@@ -170,3 +170,54 @@ test('should pass showDate prop with Children', () => {
|
|
|
170
170
|
const kit = screen.getByTestId(testId)
|
|
171
171
|
expect(kit).toHaveClass('pb_timeline_kit_horizontal_with_date')
|
|
172
172
|
})
|
|
173
|
+
|
|
174
|
+
test('should pass showCurrentYear prop to items with date', () => {
|
|
175
|
+
const currentYear = new Date().getFullYear().toString()
|
|
176
|
+
render(
|
|
177
|
+
<Timeline
|
|
178
|
+
data={{ testid: testId }}
|
|
179
|
+
showDate
|
|
180
|
+
>
|
|
181
|
+
<Timeline.Item
|
|
182
|
+
date={new Date()}
|
|
183
|
+
icon="user"
|
|
184
|
+
iconColor="royal"
|
|
185
|
+
showCurrentYear
|
|
186
|
+
>
|
|
187
|
+
<TitleDetail
|
|
188
|
+
detail="37-27 74th Street"
|
|
189
|
+
title="Jackson Heights"
|
|
190
|
+
/>
|
|
191
|
+
</Timeline.Item>
|
|
192
|
+
</Timeline>
|
|
193
|
+
)
|
|
194
|
+
const kit = screen.getByTestId(testId)
|
|
195
|
+
expect(kit).toBeInTheDocument()
|
|
196
|
+
const yearCaption = kit.querySelector('.pb_caption_kit_xs')
|
|
197
|
+
expect(yearCaption).toBeInTheDocument()
|
|
198
|
+
expect(yearCaption.textContent).toEqual(currentYear)
|
|
199
|
+
})
|
|
200
|
+
|
|
201
|
+
test('should not show current year by default', () => {
|
|
202
|
+
const currentYear = new Date().getFullYear().toString()
|
|
203
|
+
render(
|
|
204
|
+
<Timeline
|
|
205
|
+
data={{ testid: testId }}
|
|
206
|
+
showDate
|
|
207
|
+
>
|
|
208
|
+
<Timeline.Item
|
|
209
|
+
date={new Date()}
|
|
210
|
+
icon="user"
|
|
211
|
+
iconColor="royal"
|
|
212
|
+
>
|
|
213
|
+
<TitleDetail
|
|
214
|
+
detail="37-27 74th Street"
|
|
215
|
+
title="Jackson Heights"
|
|
216
|
+
/>
|
|
217
|
+
</Timeline.Item>
|
|
218
|
+
</Timeline>
|
|
219
|
+
)
|
|
220
|
+
const kit = screen.getByTestId(testId)
|
|
221
|
+
expect(kit).toBeInTheDocument()
|
|
222
|
+
expect(kit).not.toHaveTextContent(currentYear)
|
|
223
|
+
})
|