playbook_ui 5.5.1.pre.alpha3 → 6.0.1.pre.alpha3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +0 -2
  3. data/app/pb_kits/playbook/data/menu.yml +0 -2
  4. data/app/pb_kits/playbook/index.js +0 -1
  5. data/app/pb_kits/playbook/packs/examples.js +0 -4
  6. data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.html.erb +21 -11
  7. data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.scss +10 -0
  8. data/app/pb_kits/playbook/pb_circle_chart/circle_chart.rb +14 -0
  9. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_block.html.erb +26 -0
  10. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_colors.html.erb +20 -0
  11. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_rounded.html.erb +22 -0
  12. data/app/pb_kits/playbook/pb_circle_chart/docs/example.yml +5 -1
  13. data/app/pb_kits/playbook/pb_date_picker/_date_picker.html.erb +2 -0
  14. data/app/pb_kits/playbook/pb_date_picker/_date_picker.jsx +5 -2
  15. data/app/pb_kits/playbook/pb_date_picker/_date_picker.scss +789 -2
  16. data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +4 -1
  17. data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +1 -1
  18. data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +1 -0
  19. data/app/pb_kits/playbook/pb_form/docs/_form_simple_form.html.erb +2 -2
  20. data/app/pb_kits/playbook/pb_form/docs/_form_simple_form_validate.html.erb +3 -1
  21. data/app/pb_kits/playbook/pb_form/form_builder/date_picker_field.rb +21 -2
  22. data/app/pb_kits/playbook/pb_image/_image.html.erb +2 -1
  23. data/app/pb_kits/playbook/pb_image/_image.jsx +31 -8
  24. data/app/pb_kits/playbook/pb_image/docs/_default_image.jsx +3 -3
  25. data/app/pb_kits/playbook/pb_label_value/_label_value.html.erb +20 -2
  26. data/app/pb_kits/playbook/pb_label_value/_label_value.jsx +109 -5
  27. data/app/pb_kits/playbook/pb_label_value/_label_value.scss +0 -10
  28. data/app/pb_kits/playbook/pb_label_value/docs/_description.md +3 -1
  29. data/app/pb_kits/playbook/pb_label_value/docs/_label_value_details.html.erb +39 -0
  30. data/app/pb_kits/playbook/pb_label_value/docs/_label_value_details.jsx +50 -0
  31. data/app/pb_kits/playbook/pb_label_value/docs/_label_value_details.md +1 -0
  32. data/app/pb_kits/playbook/pb_label_value/docs/_label_value_details_dark.html.erb +43 -0
  33. data/app/pb_kits/playbook/pb_label_value/docs/_label_value_details_dark.jsx +54 -0
  34. data/app/pb_kits/playbook/pb_label_value/docs/_label_value_details_examples.html.erb +72 -0
  35. data/app/pb_kits/playbook/pb_label_value/docs/_label_value_details_examples.jsx +92 -0
  36. data/app/pb_kits/playbook/pb_label_value/docs/_label_value_details_examples_dark.html.erb +80 -0
  37. data/app/pb_kits/playbook/pb_label_value/docs/_label_value_details_examples_dark.jsx +101 -0
  38. data/app/pb_kits/playbook/pb_label_value/docs/example.yml +9 -0
  39. data/app/pb_kits/playbook/pb_label_value/docs/index.js +5 -0
  40. data/app/pb_kits/playbook/pb_label_value/label_value.rb +19 -2
  41. data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx +5 -1
  42. data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.scss +12 -1
  43. data/app/pb_kits/playbook/pb_progress_simple/docs/_progress_simple_variants.html.erb +9 -0
  44. data/app/pb_kits/playbook/pb_progress_simple/docs/_progress_simple_variants.jsx +26 -0
  45. data/app/pb_kits/playbook/pb_progress_simple/docs/_progress_simple_variants.md +1 -0
  46. data/app/pb_kits/playbook/pb_progress_simple/docs/example.yml +2 -0
  47. data/app/pb_kits/playbook/pb_progress_simple/docs/index.js +2 -0
  48. data/app/pb_kits/playbook/pb_progress_simple/progress_simple.rb +8 -1
  49. data/app/pb_kits/playbook/pb_title/_title.scss +3 -4
  50. data/app/pb_kits/playbook/pb_title/title.rb +2 -2
  51. data/app/pb_kits/playbook/plugins/pb_chart.js +49 -4
  52. data/app/pb_kits/playbook/vendor.js +2 -0
  53. data/lib/playbook/version.rb +1 -1
  54. metadata +17 -22
  55. data/app/pb_kits/playbook/pb_date_picker/index.js +0 -11
  56. data/app/pb_kits/playbook/pb_installer/_installer.html.erb +0 -16
  57. data/app/pb_kits/playbook/pb_installer/_installer.jsx +0 -54
  58. data/app/pb_kits/playbook/pb_installer/_installer.scss +0 -7
  59. data/app/pb_kits/playbook/pb_installer/docs/_installer_default.html.erb +0 -8
  60. data/app/pb_kits/playbook/pb_installer/docs/_installer_default.jsx +0 -16
  61. data/app/pb_kits/playbook/pb_installer/docs/example.yml +0 -9
  62. data/app/pb_kits/playbook/pb_installer/docs/index.js +0 -1
  63. data/app/pb_kits/playbook/pb_installer/installer.rb +0 -18
  64. data/app/pb_kits/playbook/pb_label_value/docs/index.html.erb +0 -25
  65. data/app/pb_kits/playbook/pb_logistic/_logistic.html.erb +0 -20
  66. data/app/pb_kits/playbook/pb_logistic/_logistic.jsx +0 -111
  67. data/app/pb_kits/playbook/pb_logistic/_logistic.scss +0 -7
  68. data/app/pb_kits/playbook/pb_logistic/docs/_logistic_dark.html.erb +0 -27
  69. data/app/pb_kits/playbook/pb_logistic/docs/_logistic_dark.jsx +0 -39
  70. data/app/pb_kits/playbook/pb_logistic/docs/_logistic_default.html.erb +0 -24
  71. data/app/pb_kits/playbook/pb_logistic/docs/_logistic_default.jsx +0 -35
  72. data/app/pb_kits/playbook/pb_logistic/docs/example.yml +0 -11
  73. data/app/pb_kits/playbook/pb_logistic/docs/index.js +0 -2
  74. data/app/pb_kits/playbook/pb_logistic/logistic.rb +0 -31
@@ -22,12 +22,15 @@ module Playbook
22
22
  default: "Date Picker"
23
23
  prop :max_date, type: Playbook::Props::String
24
24
  prop :min_date, type: Playbook::Props::String
25
+ prop :name, type: Playbook::Props::String
25
26
  prop :mode, type: Playbook::Props::String,
26
27
  default: "single"
27
28
  prop :picker_id, type: Playbook::Props::String
29
+ prop :required, type: Playbook::Props::Boolean,
30
+ default: false
28
31
 
29
32
  def classname
30
- generate_classname("pb_date_picker")
33
+ generate_classname("pb_date_picker_kit")
31
34
  end
32
35
 
33
36
  def error_class
@@ -24,7 +24,7 @@
24
24
  <%= form.text_area :example_text_area, props: { label: true } %>
25
25
  <%= form.select :example_select, [ ["Yes", 1], ["No", 2] ], props: { label: true } %>
26
26
  <%= form.collection_select :example_collection_select, example_collection, :value, :name, props: { label: true } %>
27
- <%= form.date_picker :example_date_picker, props: { picker_id: 'date-picker', default_date: 'blank' } %>
27
+ <%= form.date_picker :example_date_picker, props: { default_date: 'blank', name: "example[example_date_picker]", picker_id: "example_example_date_picker1" } %>
28
28
 
29
29
  <%= form.actions do |action| %>
30
30
  <%= action.submit %>
@@ -27,6 +27,7 @@
27
27
  <%= form.text_area :example_text_area, props: { label: true, required: true } %>
28
28
  <%= form.select :example_select, [ ["Yes", 1], ["No", 2] ], props: { label: true, blank_selection: "Select One...", required: true } %>
29
29
  <%= form.collection_select :example_collection_select, example_collection, :value, :name, props: { label: true, blank_selection: "Select One...", required: true } %>
30
+ <%= form.date_picker :example_date_picker, props: { default_date: 'blank', name: "example[example_date_picker]", picker_id: "example_example_date_picker2", required: true } %>
30
31
 
31
32
  <%= form.actions do |action| %>
32
33
  <%= action.submit %>
@@ -14,7 +14,7 @@
14
14
  :example_text_area,
15
15
  :example_select_field,
16
16
  :example_collection_select_field,
17
- :example_date_picker
17
+ :example_date_picker_field
18
18
 
19
19
 
20
20
  def self.model_name
@@ -50,7 +50,7 @@
50
50
  <%= form.input :example_text_area, as: :text %>
51
51
  <%= form.select :example_select_field, [["Yes", 1], ["No", 2]], props: { label: true } %>
52
52
  <%= form.collection_select :example_collection_select_field, example_collection, :value, :name, props: { label: true } %>
53
- <%= form.date_picker :example_date_picker, props: { picker_id: 'date-picker', default_date: 'blank' } %>
53
+ <%= form.date_picker :example_date_picker_field, props: { default_date: 'blank', name: "example[example_date_picker]", picker_id: "example_example_date_picker3" } %>
54
54
 
55
55
  <%= form.actions do |action| %>
56
56
  <%= action.submit %>
@@ -13,7 +13,8 @@
13
13
  :example_url_field,
14
14
  :example_text_area,
15
15
  :example_select_field,
16
- :example_collection_select_field
16
+ :example_collection_select_field,
17
+ :example_date_picker_field
17
18
 
18
19
 
19
20
  def self.model_name
@@ -49,6 +50,7 @@
49
50
  <%= form.input :example_text_area, {as: :text, input_html: {props: {required: true}}} %>
50
51
  <%= form.select :example_select_field, [["Yes", 1], ["No", 2]], props: { required: true, blank_selection: "Select One...", label: true } %>
51
52
  <%= form.collection_select :example_collection_select_field, example_collection, :value, :name, props: { required: true, blank_selection: "Select One...", label: true } %>
53
+ <%= form.date_picker :example_date_picker_field, props: { default_date: 'blank', name: "example[example_date_picker]", picker_id: "example_example_date_picker4", required: true } %>
52
54
 
53
55
  <%= form.actions do |action| %>
54
56
  <%= action.submit %>
@@ -4,9 +4,28 @@ module Playbook
4
4
  module PbForm
5
5
  module FormBuilder
6
6
  module DatePickerField
7
- def date_picker(name, props: {})
8
- props[:name] = name
7
+ # def date_field(name, props: {})
8
+ # # props[:name] = name
9
9
 
10
+ # input = super(name)
11
+ # puts name
12
+ # puts input
13
+
14
+ # @template.pb_rails("date_picker", props: props) do
15
+ # input
16
+ # end
17
+ # end
18
+ # def date_picker(name, props: {})
19
+ # predicate = name.to_s.split("_")[0]
20
+ # html_name = "#{predicate}[#{name}]"
21
+ # id = predicate + "_" + name.to_s
22
+
23
+ # props[:name] = html_name
24
+ # props[:picker_id] = id
25
+
26
+ # @template.pb_rails("date_picker", props: props)
27
+ # end
28
+ def date_picker(_name, props: {})
10
29
  @template.pb_rails("date_picker", props: props)
11
30
  end
12
31
  end
@@ -3,4 +3,5 @@
3
3
  data: object.data.merge(src: object.url),
4
4
  class: object.classname,
5
5
  aria: object.aria,
6
- alt: object.alt) %>
6
+ src: object.url,
7
+ alt: object.alt) %>
@@ -2,21 +2,44 @@
2
2
 
3
3
  import React from 'react'
4
4
  import classnames from 'classnames'
5
+ import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
5
6
  import { spacing } from '../utilities/spacing.js'
6
7
 
7
8
  type ImageProps = {
8
- url: string,
9
- alt?: string,
9
+ alt?: String,
10
+ aria?: object,
11
+ className?: String,
12
+ data?: object,
13
+ id?: String,
14
+ url: String,
10
15
  }
11
16
 
12
17
  const Image = (props: ImageProps) => {
13
- const { alt = '', url = '' } = props
18
+ const {
19
+ alt = '',
20
+ aria = {},
21
+ className,
22
+ data = {},
23
+ id,
24
+ url = '',
25
+ } = props
26
+
27
+ const ariaProps = buildAriaProps(aria)
28
+ const classes = classnames(buildCss('pb_image lazyload blur_up'), className, spacing(props))
29
+ const dataProps = buildDataProps(data)
30
+
14
31
  return (
15
- <img
16
- alt={alt}
17
- className={classnames('pb_image_kit lazyload blur_up', spacing(props))}
18
- data-src={url}
19
- />
32
+ <div>
33
+ <img
34
+ {...ariaProps}
35
+ {...dataProps}
36
+ alt={alt}
37
+ className={classes}
38
+ data-src={url}
39
+ id={id}
40
+ src={url}
41
+ />
42
+ </div>
20
43
  )
21
44
  }
22
45
 
@@ -3,9 +3,9 @@ import { Image } from '../../'
3
3
 
4
4
  const DefaultImage = () => {
5
5
  return (
6
- <div>
7
- <Image url="https://unsplash.it/500/400/?image=634" />
8
- </div>
6
+ <Image
7
+ url="https://unsplash.it/500/400/?image=634"
8
+ />
9
9
  )
10
10
  }
11
11
 
@@ -3,6 +3,24 @@
3
3
  id: object.id,
4
4
  data: object.data,
5
5
  class: object.classname) do %>
6
- <%= pb_rails("caption", props: { text: object.label }) %>
7
- <%= pb_rails("body", props: { text: object.value }) %>
6
+ <%= pb_rails("caption", props: { text: object.label, dark: object.dark }) %>
7
+ <% if object.variant == "details" %>
8
+ <%= pb_rails("flex", props: {inline: true, vertical: "center"}) do %>
9
+ <%= pb_rails("body", props: { color: "light", dark: object.dark }) do %>
10
+ <%= pb_rails("icon", props: { icon: object.icon, fixed_width: true, margin_right: "xs", }) if object.icon.present? %>
11
+ <% end %>
12
+ <%= pb_rails("body", props: { text: object.description, color: "light", margin_right: "xs", dark: object.dark }) if object.description.present? %>
13
+ <% if object.active %>
14
+ <%= pb_rails("flex", props: {inline: true, vertical: "center"}) do %>
15
+ <%= pb_rails("title", props: { text: object.title, tag: "h4", size: 4, variant: "link", dark: object.dark }) if object.title.present? %>
16
+ <%= pb_rails("title", props: { text: object.date_element, tag: "span", size: 4, margin_left: "xs", variant: "link", dark: object.dark }) if object.date.present? %>
17
+ <% end %>
18
+ <% else %>
19
+ <%= pb_rails("title", props: { text: object.title, tag: "h4", size: 4, dark: object.dark }) if object.title.present? %>
20
+ <%= pb_rails("title", props: { text: object.date_element, tag: "span", size: 4, margin_left: "xs", dark: object.dark }) if object.date.present? %>
21
+ <% end %>
22
+ <% end %>
23
+ <% else %>
24
+ <%= pb_rails("body", props: { text: object.value, dark: object.dark }) if object.value.present? %>
25
+ <% end %>
8
26
  <% end %>
@@ -2,8 +2,9 @@
2
2
 
3
3
  import React from 'react'
4
4
  import classnames from 'classnames'
5
+ import DateTime from '../pb_kit/dateTime.js'
5
6
  import { buildAriaProps, buildDataProps } from '../utilities/props'
6
- import { Body, Caption } from '../'
7
+ import { Body, Caption, Flex, Icon, Title } from '../'
7
8
  import { spacing } from '../utilities/spacing.js'
8
9
 
9
10
  type LabelValueProps = {
@@ -13,21 +14,42 @@ type LabelValueProps = {
13
14
  data?: object,
14
15
  id?: String,
15
16
  label: String,
16
- value: String,
17
+ value?: String,
18
+ variant?: "default" | "details",
19
+ icon?: String,
20
+ description?: String,
21
+ title?: String,
22
+ date?: Date,
23
+ active?: Boolean
24
+ }
25
+
26
+ const dateString = (value: DateTime) => {
27
+ const month = value.toMonthNum()
28
+ const day = value.toDay()
29
+
30
+ return ` · ${month}/${day}`
17
31
  }
18
32
 
19
33
  const LabelValue = (props: LabelValueProps) => {
20
34
  const {
35
+ active = false,
21
36
  aria = {},
22
37
  className,
23
38
  dark = false,
24
39
  data = {},
40
+ date,
41
+ description,
42
+ icon,
25
43
  id,
26
44
  label,
27
- value } = props
45
+ title,
46
+ value,
47
+ variant = 'default',
48
+ } = props
28
49
 
29
50
  const ariaProps = buildAriaProps(aria)
30
51
  const dataProps = buildDataProps(data)
52
+ const formattedDate = new DateTime({ value: date })
31
53
  const themeStyle = dark === true ? '_dark' : ''
32
54
  const css = classnames(
33
55
  ['pb_label_value_kit' + themeStyle, className],
@@ -39,10 +61,92 @@ const LabelValue = (props: LabelValueProps) => {
39
61
  {...ariaProps}
40
62
  {...dataProps}
41
63
  className={css}
64
+ dark={dark}
65
+ description={description}
66
+ icon={icon}
42
67
  id={id}
68
+ title={title}
43
69
  >
44
- <Caption text={label} />
45
- <Body text={value} />
70
+ <Caption
71
+ dark={dark}
72
+ text={label}
73
+ />
74
+ <If condition={variant === 'details'}>
75
+ <Flex
76
+ inline
77
+ vertical="center"
78
+ >
79
+ <If condition={icon}>
80
+ <Body
81
+ color="light"
82
+ dark={dark}
83
+ marginRight="xs"
84
+ >
85
+ <Icon
86
+ dark={dark}
87
+ fixedWidth
88
+ icon={icon}
89
+ />
90
+ </Body>
91
+ </If>
92
+ <If condition={description}>
93
+ <Body
94
+ color="light"
95
+ dark={dark}
96
+ marginRight="xs"
97
+ text={description}
98
+ />
99
+ </If>
100
+ <Choose>
101
+ <When condition={active === true}>
102
+ <Flex
103
+ inline
104
+ vertical="center"
105
+ >
106
+ <If condition={title}>
107
+ <Title
108
+ dark={dark}
109
+ size={4}
110
+ text={title}
111
+ variant="link"
112
+ />
113
+ </If>
114
+ <If condition={date}>
115
+ <Title
116
+ dark={dark}
117
+ marginLeft="xs"
118
+ size={4}
119
+ text={' ' + dateString(formattedDate)}
120
+ variant="link"
121
+ />
122
+ </If>
123
+ </Flex>
124
+ </When>
125
+ <Otherwise>
126
+ <If condition={title}>
127
+ <Title
128
+ dark={dark}
129
+ size={4}
130
+ text={title}
131
+ />
132
+ </If>
133
+ <If condition={date}>
134
+ <Title
135
+ dark={dark}
136
+ marginLeft="xs"
137
+ size={4}
138
+ text={' ' + dateString(formattedDate)}
139
+ />
140
+ </If>
141
+ </Otherwise>
142
+ </Choose>
143
+ </Flex>
144
+ <Else />
145
+ <Body
146
+ dark={dark}
147
+ text={value}
148
+ />
149
+ </If>
46
150
  </div>
47
151
  )
48
152
  }
@@ -1,17 +1,7 @@
1
1
  @import "../tokens/spacing";
2
- @import "../pb_caption/caption";
3
- @import "../pb_body/body";
4
2
 
5
3
  [class^=pb_label_value_kit] {
6
4
  [class^=pb_caption_kit] {
7
5
  margin-bottom: $space-xs/1.5;
8
6
  }
9
- &[class*=_dark] {
10
- [class^=pb_caption_kit] {
11
- color: $text_dk_light;
12
- }
13
- [class^=pb_body_kit] {
14
- color: $text_dk_default;
15
- }
16
- }
17
7
  }
@@ -1 +1,3 @@
1
- This kit can be very versatile when used to display text data. It includes the caption kit and the body text kit.
1
+ This kit can be very versatile when used to display text data.
2
+
3
+ Variant `default` includes a label and text. However, variant `details` can be used if multiple elements are necessary in order to make it more descriptive. Variant `details` may include icon, light text, title and date, as well as the option to make it active (with link color) for clickability purposes.
@@ -0,0 +1,39 @@
1
+ <%= pb_rails("label_value", props: {
2
+ variant: "details",
3
+ label: "Installer",
4
+ icon: "truck",
5
+ title: "JD Installations LLC",
6
+ }) %>
7
+
8
+ <br>
9
+
10
+ <%= pb_rails("label_value", props: {
11
+ variant: "details",
12
+ label: "Project",
13
+ icon: "home",
14
+ description: "33-12345",
15
+ title: "Jefferson-Smith",
16
+ }) %>
17
+
18
+ <br>
19
+
20
+ <%= pb_rails("label_value", props: {
21
+ variant: "details",
22
+ label: "Project",
23
+ icon: "home",
24
+ description: "33-12345",
25
+ title: "Jefferson-Smith",
26
+ date: Date.new(2019, 11, 18)
27
+ }) %>
28
+
29
+ <br>
30
+
31
+ <%= pb_rails("label_value", props: {
32
+ variant: "details",
33
+ active: true,
34
+ label: "Project",
35
+ icon: "home",
36
+ description: "33-12345",
37
+ title: "Jefferson-Smith",
38
+ date: Date.new(2019, 11, 18)
39
+ }) %>
@@ -0,0 +1,50 @@
1
+ import React from 'react'
2
+ import { LabelValue } from '../../'
3
+
4
+ const LabelValueDetails = () => {
5
+ return (
6
+ <div>
7
+ <LabelValue
8
+ icon="truck"
9
+ label="Installer"
10
+ title="JD Installations LLC"
11
+ variant="details"
12
+ />
13
+
14
+ <br />
15
+
16
+ <LabelValue
17
+ description="33-12345"
18
+ icon="home"
19
+ label="Project"
20
+ title="Jefferson-Smith"
21
+ variant="details"
22
+ />
23
+
24
+ <br />
25
+
26
+ <LabelValue
27
+ date={new Date('18 Nov 2019')}
28
+ description="33-12345"
29
+ icon="home"
30
+ label="Project"
31
+ title="Jefferson-Smith"
32
+ variant="details"
33
+ />
34
+
35
+ <br />
36
+
37
+ <LabelValue
38
+ active
39
+ date={new Date('18 Nov 2019')}
40
+ description="33-12345"
41
+ icon="home"
42
+ label="Project"
43
+ title="Jefferson-Smith"
44
+ variant="details"
45
+ />
46
+ </div>
47
+ )
48
+ }
49
+
50
+ export default LabelValueDetails