playbook_ui 14.8.0.pre.rc.4 → 14.8.0.pre.rc.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +1 -1
  3. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_default_date.html.erb +42 -0
  4. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_default_date.jsx +44 -0
  5. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_default_date.md +1 -0
  6. data/app/pb_kits/playbook/pb_date_picker/docs/example.yml +2 -0
  7. data/app/pb_kits/playbook/pb_date_picker/docs/index.js +1 -0
  8. data/app/pb_kits/playbook/pb_date_picker/plugins/quickPick.tsx +17 -1
  9. data/app/pb_kits/playbook/pb_timeline/_timeline.scss +43 -1
  10. data/app/pb_kits/playbook/pb_timeline/_timeline.tsx +6 -2
  11. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_gap.html.erb +94 -0
  12. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_gap.jsx +180 -0
  13. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_gap.md +1 -0
  14. data/app/pb_kits/playbook/pb_timeline/docs/example.yml +5 -3
  15. data/app/pb_kits/playbook/pb_timeline/docs/index.js +2 -0
  16. data/app/pb_kits/playbook/pb_timeline/timeline.rb +11 -1
  17. data/app/pb_kits/playbook/pb_timeline/timeline.test.js +4 -4
  18. data/app/pb_kits/playbook/utilities/_hover.scss +27 -29
  19. data/app/pb_kits/playbook/utilities/globalProps.ts +2 -2
  20. data/app/pb_kits/playbook/utilities/test/globalProps/hover.test.js +79 -0
  21. data/dist/chunks/{_typeahead-DEskmS_o.js → _typeahead-DM5bD2ck.js} +2 -2
  22. data/dist/chunks/{_weekday_stacked-DBuVOrwj.js → _weekday_stacked-RuOgC2uD.js} +2 -2
  23. data/dist/chunks/{lib-DpxYMiKe.js → lib-GRGYd9YR.js} +1 -1
  24. data/dist/chunks/{pb_form_validation-LqRlnmi6.js → pb_form_validation-CS6rgdtE.js} +1 -1
  25. data/dist/chunks/vendor.js +1 -1
  26. data/dist/playbook-doc.js +1 -1
  27. data/dist/playbook-rails-react-bindings.js +1 -1
  28. data/dist/playbook-rails.js +1 -1
  29. data/dist/playbook.css +1 -1
  30. data/lib/playbook/hover.rb +1 -1
  31. data/lib/playbook/version.rb +1 -1
  32. metadata +13 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e5eaba271b01af2562c09afca2b2d80ed6854de00a39a3500e2a72b864121501
4
- data.tar.gz: f60a3a4cbe7b4c223be3a6549eee13461fe3f6dddfa4348a75921d60c5d822f0
3
+ metadata.gz: d627b06d309a6c7d0c0daa7237d7e6b367a10a02b4c838ea24b4fe636efc5fb5
4
+ data.tar.gz: c7d1ab8399cfde8133b8120e3476ba4abf1c4f4ef2eb3af0427e49723aa4648f
5
5
  SHA512:
6
- metadata.gz: 684d666faeeb9e7ddebdae3452900281f38723e17af9bf77b012d9198910b5b1a4a7ac07e4909d0a357d86cff1e443b9091e6a97d2e1d07024b720049bb4583e
7
- data.tar.gz: ab7b69a65c0db06928a95ee738f138fa3dafd9f90d363e7047cdd5645cf42163680d46b9d822066a3faaf1ee291dded00a19e8090b1e6e6191eca5fa3bef58c6
6
+ metadata.gz: cebda480fd5a9d3ee6f4e3a54948771126b478622fc12aefc524d818616b28625546a2673e08c2b2229c6396c6b61e7bd613c6d57aa7e2d11e97b5c7414a00d2
7
+ data.tar.gz: d2bf56befdf4788aaeeec043d775a33d6686b5c18b9c059455f281ac3d43f38dd12ea8d02a54355327b1e3982ff0722c06f602e061b892ea23422ac845c79892
@@ -143,7 +143,7 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
143
143
 
144
144
  } else if (selectionType === "quickpick") {
145
145
  //------- QUICKPICK VARIANT PLUGIN -------------//
146
- pluginList.push(quickPickPlugin(thisRangesEndToday, customQuickPickDates))
146
+ pluginList.push(quickPickPlugin(thisRangesEndToday, customQuickPickDates, defaultDate as string))
147
147
  }
148
148
 
149
149
  // time selection
@@ -0,0 +1,42 @@
1
+ <%= pb_rails("date_picker", props: {
2
+ allow_input: true,
3
+ default_date: "This month",
4
+ end_date_id: "quick-pick-end-date",
5
+ end_date_name: "quick-pick-end-date",
6
+ mode: "range",
7
+ picker_id: "quick-pick-default-date",
8
+ placeholder: "mm/dd/yyyy to mm/dd/yyyy",
9
+ selection_type: "quickpick",
10
+ start_date_id: "quick-pick-start-date",
11
+ start_date_name: "quick-pick-start-date"
12
+ }) %>
13
+
14
+ <%= pb_rails("date_picker", props: {
15
+ allow_input: true,
16
+ custom_quick_pick_dates: {
17
+ dates: [
18
+ {
19
+ label: "Last 15 months",
20
+ value: {
21
+ timePeriod: "months",
22
+ amount: 15,
23
+ },
24
+ },
25
+ {
26
+ label: "First Week of June 2022",
27
+ value: ["06/01/2022", "06/07/2022"],
28
+ },
29
+ ],
30
+ },
31
+ default_date: "First Week of June 2022",
32
+ end_date_id: "quick-pick-end-date",
33
+ end_date_name: "quick-pick-end-date",
34
+ label: "Custom Date Picker",
35
+ mode: "range",
36
+ picker_id: "custom-quick-pick-default-date",
37
+ placeholder: "mm/dd/yyyy to mm/dd/yyyy",
38
+ selection_type: "quickpick",
39
+ start_date_id: "quick-pick-start-date",
40
+ start_date_name: "quick-pick-start-date"
41
+ }) %>
42
+
@@ -0,0 +1,44 @@
1
+ import React from "react"
2
+ import DatePicker from "../_date_picker"
3
+
4
+ const DatePickerQuickPickDefaultDate = (props) => (
5
+ <>
6
+ <DatePicker
7
+ allowInput
8
+ defaultDate="This month"
9
+ mode="range"
10
+ pickerId="quick-pick-default-date"
11
+ placeholder="mm/dd/yyyy to mm/dd/yyyy"
12
+ selectionType="quickpick"
13
+ {...props}
14
+ />
15
+
16
+ <DatePicker
17
+ allowInput
18
+ customQuickPickDates={{
19
+ dates: [
20
+ {
21
+ label: "Last 15 months",
22
+ value: {
23
+ timePeriod: "months",
24
+ amount: 15,
25
+ },
26
+ },
27
+ {
28
+ label: "First Week of June 2022",
29
+ value: ["06/01/2022", "06/07/2022"],
30
+ },
31
+ ],
32
+ }}
33
+ defaultDate="First Week of June 2022"
34
+ label="Custom Date Picker"
35
+ mode="range"
36
+ pickerId="custom-quick-pick-default-date"
37
+ placeholder="mm/dd/yyyy to mm/dd/yyyy"
38
+ selectionType="quickpick"
39
+ {...props}
40
+ />
41
+ </>
42
+ )
43
+
44
+ export default DatePickerQuickPickDefaultDate
@@ -0,0 +1 @@
1
+ To set a default value using Quick Pick, use the `defaultDate` or `default_date` prop. This prop should match one of the labels displayed in the UI of the dropdown menu.
@@ -12,6 +12,7 @@ examples:
12
12
  - date_picker_quick_pick_range_limit: Range (Quick Pick w/ “This” Range limit)
13
13
  - date_picker_quick_pick_custom: Custom Quick Pick Dates
14
14
  - date_picker_quick_pick_custom_override: Custom Quick Pick Dates (append to defaults)
15
+ - date_picker_quick_pick_default_date: Range (Quick Pick w/ Default Date)
15
16
  - date_picker_format: Format
16
17
  - date_picker_disabled: Disabled Dates
17
18
  - date_picker_min_max: Min Max
@@ -42,6 +43,7 @@ examples:
42
43
  - date_picker_quick_pick_range_limit: Range (Quick Pick w/ “This” Range limit)
43
44
  - date_picker_quick_pick_custom: Custom Quick Pick Dates
44
45
  - date_picker_quick_pick_custom_override: Custom Quick Pick Dates (append to defaults)
46
+ - date_picker_quick_pick_default_date: Range (Quick Pick w/ Default Date)
45
47
  - date_picker_format: Format
46
48
  - date_picker_disabled: Disabled Dates
47
49
  - date_picker_min_max: Min Max
@@ -25,3 +25,4 @@ export { default as DatePickerQuickPickRangeLimit } from './_date_picker_quick_p
25
25
  export { default as DatePickerOnClose } from './_date_picker_on_close.jsx'
26
26
  export { default as DatePickerQuickPickCustom } from './_date_picker_quick_pick_custom'
27
27
  export { default as DatePickerQuickPickCustomOverride } from './_date_picker_quick_pick_custom_override'
28
+ export { default as DatePickerQuickPickDefaultDate } from './_date_picker_quick_pick_default_date'
@@ -26,7 +26,7 @@ type customQuickPickDatesType = {
26
26
 
27
27
  let activeLabel = ""
28
28
 
29
- const quickPickPlugin = (thisRangesEndToday: boolean, customQuickPickDates: customQuickPickDatesType | undefined) => {
29
+ const quickPickPlugin = (thisRangesEndToday: boolean, customQuickPickDates: customQuickPickDatesType | undefined, defaultDate: string) => {
30
30
  return function (fp: FpTypes & any): any {
31
31
  const today = new Date()
32
32
  const yesterday = DateTime.getYesterdayDate(new Date())
@@ -185,6 +185,8 @@ const quickPickPlugin = (thisRangesEndToday: boolean, customQuickPickDates: cust
185
185
  return {
186
186
  // onReady is a hook from flatpickr that runs when calendar is in a ready state
187
187
  onReady(selectedDates: Array<Date>) {
188
+ let defaultDateRange
189
+
188
190
  // loop through the ranges and create an anchor tag for each range and add an event listener to set the date when user clicks on a date range
189
191
  for (const [label, range] of Object.entries(pluginData.ranges)) {
190
192
  addRangeButton(label).addEventListener('click', function () {
@@ -201,6 +203,14 @@ const quickPickPlugin = (thisRangesEndToday: boolean, customQuickPickDates: cust
201
203
  fp.close();
202
204
  }
203
205
  });
206
+
207
+ // check if there is a default date and set the default date range and label for quick pick
208
+ if (defaultDate) {
209
+ if (label.toLowerCase() === defaultDate.toLowerCase()) {
210
+ activeLabel = label
211
+ defaultDateRange = range
212
+ }
213
+ }
204
214
  }
205
215
  // conditional to check if there is a dropdown to add it to the calendar container and get it the classes it needs
206
216
  if (pluginData.rangesNav.children.length > 0) {
@@ -216,6 +226,12 @@ const quickPickPlugin = (thisRangesEndToday: boolean, customQuickPickDates: cust
216
226
  // function to give the active button the active class
217
227
  selectActiveRangeButton(selectedDates);
218
228
  }
229
+
230
+ // set the default date range if there is one and select the active button
231
+ if (defaultDateRange) {
232
+ fp.setDate(defaultDateRange, false);
233
+ selectActiveRangeButton(defaultDateRange);
234
+ }
219
235
  },
220
236
  onValueUpdate(selectedDates: Array<Date>) {
221
237
  selectActiveRangeButton(selectedDates)
@@ -8,6 +8,12 @@ $icon_margin: $space_xs/2;
8
8
  $icon_height: 28px;
9
9
  $height_from_top: $icon_height/2 - $connector_width/2;
10
10
 
11
+ // Add gap variables
12
+ $gap_xs: $height_from_top + $space_xs;
13
+ $gap_sm: $height_from_top + $space_sm;
14
+ $gap_md: $height_from_top + $space_md;
15
+ $gap_lg: $height_from_top + $space_lg;
16
+
11
17
  @mixin pb_timeline_line_solid($width, $height, $margin) {
12
18
  width: $width;
13
19
  height: $height;
@@ -156,7 +162,7 @@ $height_from_top: $icon_height/2 - $connector_width/2;
156
162
  }
157
163
  }
158
164
  }
159
- }
165
+ }
160
166
  }
161
167
  }
162
168
  &[class*=_vertical] {
@@ -266,5 +272,41 @@ $height_from_top: $icon_height/2 - $connector_width/2;
266
272
  }
267
273
  }
268
274
  }
275
+ &[class*=_gap_xs] {
276
+ [class*=pb_timeline_item_kit] {
277
+ [class=pb_timeline_item_step] {
278
+ [class=pb_timeline_item_connector] {
279
+ height: $gap_xs !important;
280
+ }
281
+ }
282
+ }
283
+ }
284
+ &[class*=_gap_sm] {
285
+ [class*=pb_timeline_item_kit] {
286
+ [class=pb_timeline_item_step] {
287
+ [class=pb_timeline_item_connector] {
288
+ height: $gap_sm !important;
289
+ }
290
+ }
291
+ }
292
+ }
293
+ &[class*=_gap_md] {
294
+ [class*=pb_timeline_item_kit] {
295
+ [class=pb_timeline_item_step] {
296
+ [class=pb_timeline_item_connector] {
297
+ height: $gap_md !important;
298
+ }
299
+ }
300
+ }
301
+ }
302
+ &[class*=_gap_lg] {
303
+ [class*=pb_timeline_item_kit] {
304
+ [class=pb_timeline_item_step] {
305
+ [class=pb_timeline_item_connector] {
306
+ height: $gap_lg !important;
307
+ }
308
+ }
309
+ }
310
+ }
269
311
  }
270
312
  }
@@ -20,6 +20,7 @@ type TimelineProps = {
20
20
  id?: string,
21
21
  orientation?: string,
22
22
  showDate?: boolean,
23
+ gap?: 'xs' | 'sm' | 'md' | 'lg' | 'none',
23
24
  } & GlobalProps
24
25
 
25
26
  const Timeline = ({
@@ -31,13 +32,16 @@ const Timeline = ({
31
32
  id,
32
33
  orientation = 'horizontal',
33
34
  showDate = false,
35
+ gap = 'none',
34
36
  ...props
35
37
  }: TimelineProps): React.ReactElement => {
36
38
  const ariaProps = buildAriaProps(aria)
37
39
  const dataProps = buildDataProps(data)
38
40
  const htmlProps = buildHtmlProps(htmlOptions)
39
41
  const dateStyle = showDate === true ? '_with_date' : ''
40
- const timelineCss = buildCss('pb_timeline_kit', `_${orientation}`, dateStyle)
42
+ const gapStyle = gap === 'none' ? '' : `gap_${gap}`
43
+ const timelineCss = buildCss('pb_timeline_kit', `${orientation}`, dateStyle, gapStyle)
44
+
41
45
  return (
42
46
  <div
43
47
  {...ariaProps}
@@ -56,4 +60,4 @@ Timeline.Step = TimelineStep
56
60
  Timeline.Label = TimelineLabel
57
61
  Timeline.Detail = TimelineDetail
58
62
 
59
- export default Timeline
63
+ export default Timeline
@@ -0,0 +1,94 @@
1
+ <%= pb_rails("flex", props: { justify: "evenly" }) do %>
2
+ <%= pb_rails("flex/flex_item") do %>
3
+ <%= pb_rails("timeline", props: {orientation: "vertical", gap: "xs"}) do %>
4
+ <%= pb_rails("timeline/item", props: {icon: "user", icon_color: "royal"}) do %>
5
+ <%= pb_rails("body", props: {
6
+ text: "Conversation started",
7
+ color: "light"
8
+ }) %>
9
+ <% end %>
10
+ <%= pb_rails("timeline/item", props: {icon: "check", icon_color: "teal", line_style: "dotted"}) do %>
11
+ <%= pb_rails("body", props: {
12
+ text: "Trip #12422",
13
+ color: "light"
14
+ }) %>
15
+ <% end %>
16
+ <%= pb_rails("timeline/item", props: {icon: "credit-card", icon_color: "red"}) do %>
17
+ <%= pb_rails("body", props: {
18
+ text: "Refund issue #12422",
19
+ color: "light"
20
+ }) %>
21
+ <% end %>
22
+ <% end %>
23
+ <% end %>
24
+
25
+ <%= pb_rails("flex/flex_item") do %>
26
+ <%= pb_rails("timeline", props: {orientation: "vertical", gap: "sm"}) do %>
27
+ <%= pb_rails("timeline/item", props: {icon: "user", icon_color: "royal"}) do %>
28
+ <%= pb_rails("body", props: {
29
+ text: "Conversation started",
30
+ color: "light"
31
+ }) %>
32
+ <% end %>
33
+ <%= pb_rails("timeline/item", props: {icon: "check", icon_color: "teal", line_style: "dotted"}) do %>
34
+ <%= pb_rails("body", props: {
35
+ text: "Trip #12422",
36
+ color: "light"
37
+ }) %>
38
+ <% end %>
39
+ <%= pb_rails("timeline/item", props: {icon: "credit-card", icon_color: "red"}) do %>
40
+ <%= pb_rails("body", props: {
41
+ text: "Refund issue #12422",
42
+ color: "light"
43
+ }) %>
44
+ <% end %>
45
+ <% end %>
46
+ <% end %>
47
+
48
+ <%= pb_rails("flex/flex_item") do %>
49
+ <%= pb_rails("timeline", props: {orientation: "vertical", gap: "md"}) do %>
50
+ <%= pb_rails("timeline/item", props: {icon: "user", icon_color: "royal"}) do %>
51
+ <%= pb_rails("body", props: {
52
+ text: "Conversation started",
53
+ color: "light"
54
+ }) %>
55
+ <% end %>
56
+ <%= pb_rails("timeline/item", props: {icon: "check", icon_color: "teal", line_style: "dotted"}) do %>
57
+ <%= pb_rails("body", props: {
58
+ text: "Trip #12422",
59
+ color: "light"
60
+ }) %>
61
+ <% end %>
62
+ <%= pb_rails("timeline/item", props: {icon: "credit-card", icon_color: "red"}) do %>
63
+ <%= pb_rails("body", props: {
64
+ text: "Refund issue #12422",
65
+ color: "light"
66
+ }) %>
67
+ <% end %>
68
+ <% end %>
69
+ <% end %>
70
+
71
+ <%= pb_rails("flex/flex_item") do %>
72
+ <%= pb_rails("timeline", props: {orientation: "vertical", gap: "lg"}) do %>
73
+ <%= pb_rails("timeline/item", props: {icon: "user", icon_color: "royal"}) do %>
74
+ <%= pb_rails("body", props: {
75
+ text: "Conversation started",
76
+ color: "light"
77
+ }) %>
78
+ <% end %>
79
+ <%= pb_rails("timeline/item", props: {icon: "check", icon_color: "teal", line_style: "dotted"}) do %>
80
+ <%= pb_rails("body", props: {
81
+ text: "Trip #12422",
82
+ color: "light"
83
+ }) %>
84
+ <% end %>
85
+ <%= pb_rails("timeline/item", props: {icon: "credit-card", icon_color: "red"}) do %>
86
+ <%= pb_rails("body", props: {
87
+ text: "Refund issue #12422",
88
+ color: "light"
89
+ }) %>
90
+ <% end %>
91
+ <% end %>
92
+ <% end %>
93
+ <% end %>
94
+
@@ -0,0 +1,180 @@
1
+ import React from 'react'
2
+
3
+ import Timeline from '../_timeline'
4
+ import Flex from "../../pb_flex/_flex"
5
+ import FlexItem from "../../pb_flex/_flex_item"
6
+ import Body from '../../pb_body/_body'
7
+
8
+ const TimelineWithGap = (props) => (
9
+ <div>
10
+ <Flex justify="evenly">
11
+ <FlexItem>
12
+ <Timeline
13
+ gap="xs"
14
+ orientation="vertical"
15
+ >
16
+ <Timeline.Item
17
+ icon="user"
18
+ iconColor="royal"
19
+ {...props}
20
+ >
21
+ <Body
22
+ color="light"
23
+ text="Conversation started"
24
+ {...props}
25
+ />
26
+ </Timeline.Item>
27
+ <Timeline.Item
28
+ icon="check"
29
+ iconColor="teal"
30
+ lineStyle="dotted"
31
+ {...props}
32
+ >
33
+ <Body
34
+ color="light"
35
+ text="Trip #12422"
36
+ {...props}
37
+ />
38
+ </Timeline.Item>
39
+ <Timeline.Item
40
+ icon="credit-card"
41
+ iconColor="red"
42
+ {...props}
43
+ >
44
+ <Body
45
+ color="light"
46
+ text="Refund issue #12422"
47
+ {...props}
48
+ />
49
+ </Timeline.Item>
50
+ </Timeline>
51
+ </FlexItem>
52
+ <FlexItem>
53
+ <Timeline
54
+ gap="sm"
55
+ orientation="vertical"
56
+ >
57
+ <Timeline.Item
58
+ icon="user"
59
+ iconColor="royal"
60
+ {...props}
61
+ >
62
+ <Body
63
+ color="light"
64
+ text="Conversation started"
65
+ {...props}
66
+ />
67
+ </Timeline.Item>
68
+ <Timeline.Item
69
+ icon="check"
70
+ iconColor="teal"
71
+ lineStyle="dotted"
72
+ {...props}
73
+ >
74
+ <Body
75
+ color="light"
76
+ text="Trip #12422"
77
+ {...props}
78
+ />
79
+ </Timeline.Item>
80
+ <Timeline.Item
81
+ icon="credit-card"
82
+ iconColor="red"
83
+ {...props}
84
+ >
85
+ <Body
86
+ color="light"
87
+ text="Refund issue #12422"
88
+ {...props}
89
+ />
90
+ </Timeline.Item>
91
+ </Timeline>
92
+ </FlexItem>
93
+ <FlexItem>
94
+ <Timeline
95
+ gap="md"
96
+ orientation="vertical"
97
+ >
98
+ <Timeline.Item
99
+ icon="user"
100
+ iconColor="royal"
101
+ {...props}
102
+ >
103
+ <Body
104
+ color="light"
105
+ text="Conversation started"
106
+ {...props}
107
+ />
108
+ </Timeline.Item>
109
+ <Timeline.Item
110
+ icon="check"
111
+ iconColor="teal"
112
+ lineStyle="dotted"
113
+ {...props}
114
+ >
115
+ <Body
116
+ color="light"
117
+ text="Trip #12422"
118
+ {...props}
119
+ />
120
+ </Timeline.Item>
121
+ <Timeline.Item
122
+ icon="credit-card"
123
+ iconColor="red"
124
+ lineStyle="dotted"
125
+ {...props}
126
+ >
127
+ <Body
128
+ color="light"
129
+ text="Refund issue #12422"
130
+ {...props}
131
+ />
132
+ </Timeline.Item>
133
+ </Timeline>
134
+ </FlexItem>
135
+ <FlexItem>
136
+ <Timeline
137
+ gap="lg"
138
+ orientation="vertical"
139
+ >
140
+ <Timeline.Item
141
+ icon="user"
142
+ iconColor="royal"
143
+ {...props}
144
+ >
145
+ <Body
146
+ color="light"
147
+ text="Conversation started"
148
+ {...props}
149
+ />
150
+ </Timeline.Item>
151
+ <Timeline.Item
152
+ icon="check"
153
+ iconColor="teal"
154
+ lineStyle="dotted"
155
+ {...props}
156
+ >
157
+ <Body
158
+ color="light"
159
+ text="Trip #12422"
160
+ {...props}
161
+ />
162
+ </Timeline.Item>
163
+ <Timeline.Item
164
+ icon="credit-card"
165
+ iconColor="red"
166
+ {...props}
167
+ >
168
+ <Body
169
+ color="light"
170
+ text="Refund issue #12422"
171
+ {...props}
172
+ />
173
+ </Timeline.Item>
174
+ </Timeline>
175
+ </FlexItem>
176
+ </Flex>
177
+ </div>
178
+ )
179
+
180
+ export default TimelineWithGap
@@ -0,0 +1 @@
1
+ Use the optional `gap` prop to render the timeline kit with adjusted spacing between nodes. The `gap` prop will only work when utilized with a vertical timeline. Horizontal timelines will show no difference in spacing.
@@ -1,14 +1,16 @@
1
1
  examples:
2
-
2
+
3
3
  rails:
4
4
  - timeline_default: Default
5
5
  - timeline_vertical: Vertical
6
6
  - timeline_with_date: With Date
7
7
  - timeline_with_children: With Children
8
-
9
-
8
+ - timeline_with_gap: With Gap
9
+
10
+
10
11
  react:
11
12
  - timeline_default: Default
12
13
  - timeline_vertical: Vertical
13
14
  - timeline_with_date: With Date
14
15
  - timeline_with_children: With Children
16
+ - timeline_with_gap: With Gap
@@ -2,3 +2,5 @@ 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
4
  export { default as TimelineWithChildren } from './_timeline_with_children.jsx'
5
+ export { default as TimelineWithGap } from './_timeline_with_gap.jsx'
6
+
@@ -8,9 +8,15 @@ module Playbook
8
8
  default: "horizontal"
9
9
  prop :show_date, type: Playbook::Props::Boolean,
10
10
  default: false
11
+ prop :gap, type: Playbook::Props::Enum,
12
+ values: %w[xs sm md lg none],
13
+ default: "none"
11
14
 
12
15
  def classname
13
- generate_classname("pb_timeline_kit", orientation, date_class)
16
+ generate_classname("pb_timeline_kit",
17
+ orientation,
18
+ date_class,
19
+ gap_class)
14
20
  end
15
21
 
16
22
  private
@@ -18,6 +24,10 @@ module Playbook
18
24
  def date_class
19
25
  show_date ? "with_date" : nil
20
26
  end
27
+
28
+ def gap_class
29
+ gap == "none" ? nil : "gap_#{gap}"
30
+ end
21
31
  end
22
32
  end
23
33
  end
@@ -147,26 +147,26 @@ test('should pass id prop', () => {
147
147
  test('should have horizontal orientation by default', () => {
148
148
  render(<TimelineDefault />)
149
149
  const kit = screen.getByTestId(testId)
150
- expect(kit).toHaveClass('pb_timeline_kit__horizontal')
150
+ expect(kit).toHaveClass('pb_timeline_kit_horizontal')
151
151
  })
152
152
 
153
153
  test('should pass vertical orientation', () => {
154
154
  const props = { orientation: 'vertical' }
155
155
  render(<TimelineDefault {...props} />)
156
156
  const kit = screen.getByTestId(testId)
157
- expect(kit).toHaveClass('pb_timeline_kit__vertical')
157
+ expect(kit).toHaveClass('pb_timeline_kit_vertical')
158
158
  })
159
159
 
160
160
  test('should pass showDate prop', () => {
161
161
  const props = { showDate: true }
162
162
  render(<TimelineDefault {...props} />)
163
163
  const kit = screen.getByTestId(testId)
164
- expect(kit).toHaveClass('pb_timeline_kit__horizontal__with_date')
164
+ expect(kit).toHaveClass('pb_timeline_kit_horizontal__with_date')
165
165
  })
166
166
 
167
167
  test('should pass showDate prop with Children', () => {
168
168
  const props = { showDate: true }
169
169
  render(<TimelineWithChildren {...props} />)
170
170
  const kit = screen.getByTestId(testId)
171
- expect(kit).toHaveClass('pb_timeline_kit__horizontal__with_date')
171
+ expect(kit).toHaveClass('pb_timeline_kit_horizontal__with_date')
172
172
  })