playbook_ui 4.12.0 → 4.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +2 -1
  3. data/app/pb_kits/playbook/data/menu.yml +2 -1
  4. data/app/pb_kits/playbook/index.js +3 -0
  5. data/app/pb_kits/playbook/packs/examples.js +4 -0
  6. data/app/pb_kits/playbook/packs/site_styles/docs/_color_utilities.scss +2 -0
  7. data/app/pb_kits/playbook/pb_card/_card.jsx +61 -3
  8. data/app/pb_kits/playbook/pb_card/_card.scss +51 -4
  9. data/app/pb_kits/playbook/pb_card/card_header.rb +22 -0
  10. data/app/pb_kits/playbook/pb_card/child_kits/_card_header.html.erb +7 -0
  11. data/app/pb_kits/playbook/pb_card/docs/_card_header.html.erb +19 -0
  12. data/app/pb_kits/playbook/pb_card/docs/_card_header.jsx +41 -0
  13. data/app/pb_kits/playbook/pb_card/docs/_card_header.md +1 -0
  14. data/app/pb_kits/playbook/pb_card/docs/_card_highlight.jsx +6 -0
  15. data/app/pb_kits/playbook/pb_card/docs/_card_highlight.md +1 -0
  16. data/app/pb_kits/playbook/pb_card/docs/_card_separator.jsx +8 -5
  17. data/app/pb_kits/playbook/pb_card/docs/_card_shadow.jsx +0 -4
  18. data/app/pb_kits/playbook/pb_card/docs/example.yml +2 -0
  19. data/app/pb_kits/playbook/pb_card/docs/index.js +1 -0
  20. data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.html.erb +15 -0
  21. data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.jsx +46 -0
  22. data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.scss +6 -0
  23. data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.rb +16 -0
  24. data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_dark.html.erb +1 -0
  25. data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_dark.jsx +13 -0
  26. data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_default.html.erb +1 -0
  27. data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_default.jsx +10 -0
  28. data/app/pb_kits/playbook/pb_date_time_stacked/docs/example.yml +11 -0
  29. data/app/pb_kits/playbook/pb_date_time_stacked/docs/index.js +2 -0
  30. data/app/pb_kits/playbook/pb_kit/dateTime.js +12 -0
  31. data/app/pb_kits/playbook/pb_kit/pb_date_time.rb +4 -0
  32. data/app/pb_kits/playbook/pb_logistic/_logistic.jsx +1 -1
  33. data/app/pb_kits/playbook/pb_table/_table.scss +24 -0
  34. data/app/pb_kits/playbook/pb_table/_table_row.html.erb +6 -0
  35. data/app/pb_kits/playbook/pb_table/_table_row.jsx +27 -0
  36. data/app/pb_kits/playbook/pb_table/docs/_table_side_highlight.html.erb +85 -0
  37. data/app/pb_kits/playbook/pb_table/docs/_table_side_highlight.jsx +96 -0
  38. data/app/pb_kits/playbook/pb_table/docs/_table_side_highlight.md +1 -0
  39. data/app/pb_kits/playbook/pb_table/docs/example.yml +2 -0
  40. data/app/pb_kits/playbook/pb_table/docs/index.js +1 -0
  41. data/app/pb_kits/playbook/pb_table/table_row.rb +22 -0
  42. data/app/pb_kits/playbook/pb_time_stacked/_time_stacked.html.erb +11 -0
  43. data/app/pb_kits/playbook/pb_time_stacked/_time_stacked.jsx +58 -0
  44. data/app/pb_kits/playbook/pb_time_stacked/_time_stacked.scss +20 -0
  45. data/app/pb_kits/playbook/pb_time_stacked/docs/_time_stacked_caption.html.erb +2 -0
  46. data/app/pb_kits/playbook/pb_time_stacked/docs/_time_stacked_caption.jsx +15 -0
  47. data/app/pb_kits/playbook/pb_time_stacked/docs/_time_stacked_dark.html.erb +1 -0
  48. data/app/pb_kits/playbook/pb_time_stacked/docs/_time_stacked_dark.jsx +15 -0
  49. data/app/pb_kits/playbook/pb_time_stacked/docs/_time_stacked_default.html.erb +2 -0
  50. data/app/pb_kits/playbook/pb_time_stacked/docs/_time_stacked_default.jsx +14 -0
  51. data/app/pb_kits/playbook/pb_time_stacked/docs/example.yml +13 -0
  52. data/app/pb_kits/playbook/pb_time_stacked/docs/index.js +3 -0
  53. data/app/pb_kits/playbook/pb_time_stacked/time_stacked.rb +63 -0
  54. data/app/pb_kits/playbook/tokens/_colors.scss +47 -0
  55. data/app/pb_kits/playbook/tokens/_spacing.scss +10 -10
  56. data/app/views/playbook/pages/utilities.html.slim +27 -0
  57. data/lib/playbook/version.rb +1 -1
  58. metadata +37 -5
  59. data/app/pb_kits/playbook/pb_card/child_kits/_card_body.scss +0 -24
@@ -3,6 +3,7 @@ examples:
3
3
  - card_light: Default
4
4
  - card_dark: Dark Cards
5
5
  - card_highlight: Highlight Cards
6
+ - card_header: Header Cards
6
7
  - card_selected: Selected
7
8
  - card_padding: Padding Size
8
9
  - card_shadow: Shadow Size
@@ -12,6 +13,7 @@ examples:
12
13
  - card_light: Default
13
14
  - card_dark: Dark Cards
14
15
  - card_highlight: Highlight Cards
16
+ - card_header: Header Cards
15
17
  - card_selected: Selected
16
18
  - card_padding: Padding Size
17
19
  - card_shadow: Shadow Size
@@ -1,5 +1,6 @@
1
1
  export { default as CardLight } from './_card_light.jsx'
2
2
  export { default as CardHighlight } from './_card_highlight.jsx'
3
+ export { default as CardHeader } from './_card_header.jsx'
3
4
  export { default as CardSelected } from './_card_selected.jsx'
4
5
  export { default as CardPadding } from './_card_padding.jsx'
5
6
  export { default as CardShadow } from './_card_shadow.jsx'
@@ -0,0 +1,15 @@
1
+ <%= content_tag(:div,
2
+ id: object.id,
3
+ data: object.data,
4
+ class: object.classname) do %>
5
+
6
+ <%= pb_rails("flex", props: { orientation: "row", vertical: "center" }) do %>
7
+ <%= pb_rails("flex/flex_item") do %>
8
+ <%= pb_rails("date_stacked", props: { align: "right", date: object.date, reverse: true, size: "sm", dark: object.dark }) %>
9
+ <% end %>
10
+ <%= pb_rails("flex/flex_item") do %>
11
+ <%= pb_rails("time_stacked", props: { classname: "pb_date_time_stacked_kit", date: object.date, tag: "caption" }) %>
12
+ <% end %>
13
+ <% end %>
14
+
15
+ <% end %>
@@ -0,0 +1,46 @@
1
+ /* @flow */
2
+
3
+ import React from 'react'
4
+ import {
5
+ DateStacked,
6
+ Flex,
7
+ FlexItem,
8
+ TimeStacked,
9
+ } from '../'
10
+
11
+ type DateTimeStackedProps = {
12
+ data?: String,
13
+ id?: String,
14
+ date: Date,
15
+ dark: Boolean,
16
+ }
17
+
18
+ const DateTimeStacked = ({
19
+ date,
20
+ dark,
21
+ }: DateTimeStackedProps) => (
22
+ <Flex
23
+ orientation="row"
24
+ vertical="center"
25
+ >
26
+ <FlexItem>
27
+ <DateStacked
28
+ align="right"
29
+ dark={dark}
30
+ date={date}
31
+ reverse
32
+ size="sm"
33
+ />
34
+ </FlexItem>
35
+ <FlexItem>
36
+ <TimeStacked
37
+ className="pb_date_time_stacked_kit"
38
+ dark={dark}
39
+ date={date}
40
+ tag="caption"
41
+ />
42
+ </FlexItem>
43
+ </Flex>
44
+ )
45
+
46
+ export default DateTimeStacked
@@ -0,0 +1,6 @@
1
+ @import "../pb_title/title";
2
+ @import "../pb_body/body";
3
+
4
+ .pb_date_time_stacked_kit {
5
+ padding-left: $space-xs;
6
+ }
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Playbook
4
+ module PbDateTimeStacked
5
+ class DateTimeStacked
6
+ include Playbook::Props
7
+
8
+ partial "pb_date_time_stacked/date_time_stacked"
9
+
10
+ prop :date, type: Playbook::Props::Date,
11
+ default: ::DateTime.current
12
+ prop :dark, type: Playbook::Props::Boolean,
13
+ default: false
14
+ end
15
+ end
16
+ end
@@ -0,0 +1 @@
1
+ <%= pb_rails("date_time_stacked", props: { dark: true }) %>
@@ -0,0 +1,13 @@
1
+ import React from 'react'
2
+ import { DateTimeStacked } from '../../'
3
+
4
+ const DateTimeStackedDark = () => (
5
+ <div>
6
+ <DateTimeStacked
7
+ dark
8
+ date={new Date}
9
+ />
10
+ </div>
11
+ )
12
+
13
+ export default DateTimeStackedDark
@@ -0,0 +1 @@
1
+ <%= pb_rails("date_time_stacked") %>
@@ -0,0 +1,10 @@
1
+ import React from 'react'
2
+ import { DateTimeStacked } from '../../'
3
+
4
+ const DateTimeStackedDefault = () => (
5
+ <div>
6
+ <DateTimeStacked date={new Date} />
7
+ </div>
8
+ )
9
+
10
+ export default DateTimeStackedDefault
@@ -0,0 +1,11 @@
1
+ examples:
2
+
3
+ rails:
4
+ - date_time_stacked_default: Default
5
+ - date_time_stacked_dark: Dark
6
+
7
+
8
+ react:
9
+ - date_time_stacked_default: Default
10
+ - date_time_stacked_dark: Dark
11
+
@@ -0,0 +1,2 @@
1
+ export { default as DateTimeStackedDefault } from './_date_time_stacked_default.jsx'
2
+ export { default as DateTimeStackedDark } from './_date_time_stacked_dark.jsx'
@@ -72,4 +72,16 @@ export default class DateTime {
72
72
  toIso() {
73
73
  return this.value.toISOString()
74
74
  }
75
+
76
+ toTime() {
77
+ return this.value.strftime('%I:%M')
78
+ }
79
+
80
+ toTimezone() {
81
+ return this.value.strftime('%Z')
82
+ }
83
+
84
+ toTimeWithMeridian() {
85
+ return this.toTime() + this.toMeridian()
86
+ }
75
87
  }
@@ -67,6 +67,10 @@ module Playbook
67
67
  @value.strftime("%l")
68
68
  end
69
69
 
70
+ def to_full_hour
71
+ @value.strftime("%I")
72
+ end
73
+
70
74
  def to_minutes
71
75
  @value.strftime("%M")
72
76
  end
@@ -6,7 +6,7 @@ import DateTime from '../pb_kit/dateTime.js'
6
6
  import { Body, Caption, Icon, Title } from '../'
7
7
 
8
8
  const dateString = (value: DateTime) => {
9
- const month = value.toMonthNumber()
9
+ const month = value.toMonthNum()
10
10
  const day = value.toDay()
11
11
 
12
12
  return ` · ${month}/${day}`
@@ -1 +1,25 @@
1
1
  @import "styles/all";
2
+ @import "../tokens/colors";
3
+
4
+ $pb_table_row_kit_side_highlight_colors: map-merge($status_colors, $product_colors);
5
+
6
+ @mixin pb_table_row_kit_side_highlight($background) {
7
+ box-shadow: inset 4px 0 0 0 $background;
8
+ border-top: 0px;
9
+ }
10
+
11
+ [class^=pb_table] {
12
+ tbody {
13
+ [class^=pb_table_row_kit] {
14
+ @each $color_name, $color_value in $pb_table_row_kit_side_highlight_colors {
15
+ &[class*=_side_highlight_#{$color_name}] {
16
+ td {
17
+ &:first-child {
18
+ @include pb_table_row_kit_side_highlight($color_value);
19
+ }
20
+ }
21
+ }
22
+ }
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,6 @@
1
+ <%= content_tag(:tr,
2
+ id: object.id,
3
+ data: object.data,
4
+ class: object.classname) do %>
5
+ <%= capture(&object.children) %>
6
+ <% end %>
@@ -0,0 +1,27 @@
1
+ /* @flow */
2
+ import React from 'react'
3
+ import classnames from 'classnames'
4
+ import { buildCss } from '../utilities/props'
5
+
6
+ type TableRowPropTypes = {
7
+ children: Array<React.ReactNode> | React.ReactNode,
8
+ className: String,
9
+ sideHighlightColor: String,
10
+ }
11
+
12
+ const TableRow = ({
13
+ children,
14
+ className,
15
+ sideHighlightColor = 'windows',
16
+ }: TableRowPropTypes) => {
17
+ const sideHighlightClass = sideHighlightColor != '' ? `side_highlight_${sideHighlightColor}` : null
18
+ const tableRowCss = buildCss('pb_table_row_kit', sideHighlightClass)
19
+
20
+ return (
21
+ <tr className={classnames(tableRowCss, className)}>
22
+ {children}
23
+ </tr>
24
+ )
25
+ }
26
+
27
+ export default TableRow
@@ -0,0 +1,85 @@
1
+ <%= pb_rails("table", props: { size: "md" }) do %>
2
+ <thead>
3
+ <tr>
4
+ <th>Product Colors</th>
5
+ <th>Column 2</th>
6
+ <th>Column 3</th>
7
+ <th>Column 4</th>
8
+ <th>Column 5</th>
9
+ </tr>
10
+ </thead>
11
+ <tbody>
12
+ <%= pb_rails("table/table_row", props: { side_highlight_color: "windows" }) do %>
13
+ <td>Windows</td>
14
+ <td>Value 2</td>
15
+ <td>Value 3</td>
16
+ <td>Value 4</td>
17
+ <td>Value 5</td>
18
+ <% end %>
19
+ <%= pb_rails("table/table_row", props: { side_highlight_color: "siding" }) do %>
20
+ <td>Siding</td>
21
+ <td>Value 2</td>
22
+ <td>Value 3</td>
23
+ <td>Value 4</td>
24
+ <td>Value 5</td>
25
+ <% end %>
26
+ <%= pb_rails("table/table_row", props: { side_highlight_color: "doors" }) do %>
27
+ <td>Doors</td>
28
+ <td>Value 2</td>
29
+ <td>Value 3</td>
30
+ <td>Value 4</td>
31
+ <td>Value 5</td>
32
+ <% end %>
33
+ <%= pb_rails("table/table_row", props: { side_highlight_color: "none" }) do %>
34
+ <td>None</td>
35
+ <td>Value 2</td>
36
+ <td>Value 3</td>
37
+ <td>Value 4</td>
38
+ <td>Value 5</td>
39
+ <% end %>
40
+ </tbody>
41
+ <% end %>
42
+
43
+ <br/>
44
+
45
+ <%= pb_rails("table", props: { size: "md" }) do %>
46
+ <thead>
47
+ <tr>
48
+ <th>Status Colors</th>
49
+ <th>Column 2</th>
50
+ <th>Column 3</th>
51
+ <th>Column 4</th>
52
+ <th>Column 5</th>
53
+ </tr>
54
+ </thead>
55
+ <tbody>
56
+ <%= pb_rails("table/table_row", props: { side_highlight_color: "success" }) do %>
57
+ <td>Success</td>
58
+ <td>Value 2</td>
59
+ <td>Value 3</td>
60
+ <td>Value 4</td>
61
+ <td>Value 5</td>
62
+ <% end %>
63
+ <%= pb_rails("table/table_row", props: { side_highlight_color: "warning" }) do %>
64
+ <td>Warning</td>
65
+ <td>Value 2</td>
66
+ <td>Value 3</td>
67
+ <td>Value 4</td>
68
+ <td>Value 5</td>
69
+ <% end %>
70
+ <%= pb_rails("table/table_row", props: { side_highlight_color: "error" }) do %>
71
+ <td>Error</td>
72
+ <td>Value 2</td>
73
+ <td>Value 3</td>
74
+ <td>Value 4</td>
75
+ <td>Value 5</td>
76
+ <% end %>
77
+ <%= pb_rails("table/table_row", props: { side_highlight_color: "none" }) do %>
78
+ <td>None</td>
79
+ <td>Value 2</td>
80
+ <td>Value 3</td>
81
+ <td>Value 4</td>
82
+ <td>Value 5</td>
83
+ <% end %>
84
+ </tbody>
85
+ <% end %>
@@ -0,0 +1,96 @@
1
+ import React from 'react'
2
+ import { Table, TableRow } from '../../'
3
+
4
+ const TableSideHighlight = () => {
5
+ return (
6
+ <div>
7
+ <Table size="md">
8
+ <thead>
9
+ <tr>
10
+ <th>{'Product colors'}</th>
11
+ <th>{'Column 2'}</th>
12
+ <th>{'Column 3'}</th>
13
+ <th>{'Column 4'}</th>
14
+ <th>{'Column 5'}</th>
15
+ </tr>
16
+ </thead>
17
+ <tbody>
18
+ <TableRow sideHighlightColor="windows">
19
+ <td>{'Windows'}</td>
20
+ <td>{'Value 2'}</td>
21
+ <td>{'Value 3'}</td>
22
+ <td>{'Value 4'}</td>
23
+ <td>{'Value 5'}</td>
24
+ </TableRow>
25
+ <TableRow sideHighlightColor="siding">
26
+ <td>{'Siding'}</td>
27
+ <td>{'Value 2'}</td>
28
+ <td>{'Value 3'}</td>
29
+ <td>{'Value 4'}</td>
30
+ <td>{'Value 5'}</td>
31
+ </TableRow>
32
+ <TableRow sideHighlightColor="doors">
33
+ <td>{'Doors'}</td>
34
+ <td>{'Value 2'}</td>
35
+ <td>{'Value 3'}</td>
36
+ <td>{'Value 4'}</td>
37
+ <td>{'Value 5'}</td>
38
+ </TableRow>
39
+ <TableRow sideHighlightColor="none">
40
+ <td>{'None'}</td>
41
+ <td>{'Value 2'}</td>
42
+ <td>{'Value 3'}</td>
43
+ <td>{'Value 4'}</td>
44
+ <td>{'Value 5'}</td>
45
+ </TableRow>
46
+ </tbody>
47
+ </Table>
48
+
49
+ <br />
50
+
51
+ <Table size="md">
52
+ <thead>
53
+ <tr>
54
+ <th>{'Status colors'}</th>
55
+ <th>{'Column 2'}</th>
56
+ <th>{'Column 3'}</th>
57
+ <th>{'Column 4'}</th>
58
+ <th>{'Column 5'}</th>
59
+ </tr>
60
+ </thead>
61
+ <tbody>
62
+ <TableRow sideHighlightColor="success">
63
+ <td>{'Success'}</td>
64
+ <td>{'Value 2'}</td>
65
+ <td>{'Value 3'}</td>
66
+ <td>{'Value 4'}</td>
67
+ <td>{'Value 5'}</td>
68
+ </TableRow>
69
+ <TableRow sideHighlightColor="warning">
70
+ <td>{'Warning'}</td>
71
+ <td>{'Value 2'}</td>
72
+ <td>{'Value 3'}</td>
73
+ <td>{'Value 4'}</td>
74
+ <td>{'Value 5'}</td>
75
+ </TableRow>
76
+ <TableRow sideHighlightColor="error">
77
+ <td>{'Error'}</td>
78
+ <td>{'Value 2'}</td>
79
+ <td>{'Value 3'}</td>
80
+ <td>{'Value 4'}</td>
81
+ <td>{'Value 5'}</td>
82
+ </TableRow>
83
+ <TableRow sideHighlightColor="none">
84
+ <td>{'None'}</td>
85
+ <td>{'Value 2'}</td>
86
+ <td>{'Value 3'}</td>
87
+ <td>{'Value 4'}</td>
88
+ <td>{'Value 5'}</td>
89
+ </TableRow>
90
+ </tbody>
91
+ </Table>
92
+ </div>
93
+ )
94
+ }
95
+
96
+ export default TableSideHighlight