playbook_ui 3.5.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +2 -1
  3. data/app/pb_kits/playbook/index.js +2 -1
  4. data/app/pb_kits/playbook/kits/pb_popover.js +4 -0
  5. data/app/pb_kits/playbook/packs/examples.js +5 -3
  6. data/app/pb_kits/playbook/packs/kits.js +2 -0
  7. data/app/pb_kits/playbook/packs/site_styles/docs/_kit_doc.scss +1 -1
  8. data/app/pb_kits/playbook/packs/site_styles/docs/_markdown.scss +1 -1
  9. data/app/pb_kits/playbook/packs/site_styles/docs/_spacing_tokens.scss +1 -1
  10. data/app/pb_kits/playbook/pb_card/card.rb +1 -6
  11. data/app/pb_kits/playbook/pb_currency/_currency.html.erb +6 -6
  12. data/app/pb_kits/playbook/pb_currency/_currency.jsx +38 -29
  13. data/app/pb_kits/playbook/pb_currency/_currency.scss +29 -29
  14. data/app/pb_kits/playbook/pb_currency/currency.rb +67 -75
  15. data/app/pb_kits/playbook/pb_currency/docs/_currency_default.jsx +3 -3
  16. data/app/pb_kits/playbook/pb_currency/docs/_currency_large.html.erb +7 -12
  17. data/app/pb_kits/playbook/pb_currency/docs/_currency_large.jsx +4 -4
  18. data/app/pb_kits/playbook/pb_currency/docs/_currency_small.html.erb +7 -12
  19. data/app/pb_kits/playbook/pb_form/_form_form_with.html.erb +10 -0
  20. data/app/pb_kits/playbook/pb_form/_form_simple_form.html.erb +10 -0
  21. data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +1 -1
  22. data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +35 -0
  23. data/app/pb_kits/playbook/pb_form/docs/_form_simple_form.html.erb +1 -1
  24. data/app/pb_kits/playbook/pb_form/docs/_form_simple_form_validate.html.erb +57 -0
  25. data/app/pb_kits/playbook/pb_form/docs/example.yml +2 -0
  26. data/app/pb_kits/playbook/pb_form/form.rb +1 -0
  27. data/app/pb_kits/playbook/pb_form/form/form_with_form.rb +1 -0
  28. data/app/pb_kits/playbook/pb_form/form/simple_form_form.rb +1 -0
  29. data/app/pb_kits/playbook/pb_form/form_builder/collection_select_field.rb +2 -0
  30. data/app/pb_kits/playbook/pb_form/form_builder/form_field_builder.rb +10 -1
  31. data/app/pb_kits/playbook/pb_form/form_builder/select_field.rb +2 -0
  32. data/app/pb_kits/playbook/pb_form/pb_form_validation.js +84 -0
  33. data/app/pb_kits/playbook/pb_popover/_popover.html.erb +29 -0
  34. data/app/pb_kits/playbook/pb_popover/_popover.js +54 -0
  35. data/app/pb_kits/playbook/pb_popover/_popover.jsx +23 -0
  36. data/app/pb_kits/playbook/pb_popover/_popover.scss +8 -0
  37. data/app/pb_kits/playbook/pb_popover/docs/_popover_default.html.erb +8 -0
  38. data/app/pb_kits/playbook/pb_popover/docs/_popover_default.jsx +10 -0
  39. data/app/pb_kits/playbook/pb_popover/docs/_popover_list.html.erb +12 -0
  40. data/app/pb_kits/playbook/pb_popover/docs/_popover_with_button.html.erb +4 -0
  41. data/app/pb_kits/playbook/pb_popover/docs/_popover_with_circle.html.erb +5 -0
  42. data/app/pb_kits/playbook/pb_popover/docs/example.yml +8 -0
  43. data/app/pb_kits/playbook/pb_popover/docs/index.js +1 -0
  44. data/app/pb_kits/playbook/pb_popover/popover.rb +23 -0
  45. data/app/pb_kits/playbook/pb_select/_select.html.erb +1 -1
  46. data/app/pb_kits/playbook/pb_select/_select.scss +18 -17
  47. data/app/pb_kits/playbook/pb_select/select.rb +5 -1
  48. data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.scss +1 -1
  49. data/app/pb_kits/playbook/pb_text_input/_text_input.html.erb +2 -0
  50. data/app/pb_kits/playbook/pb_text_input/text_input.rb +16 -0
  51. data/app/pb_kits/playbook/plugins/{pb_chart_plugin.js → pb_chart.js} +0 -0
  52. data/app/pb_kits/playbook/tokens/_colors.scss +2 -13
  53. data/app/pb_kits/playbook/tokens/_shadows.scss +3 -15
  54. data/app/pb_kits/playbook/vendor.js +8 -1
  55. data/app/views/playbook/pages/utilities.html.slim +1 -1
  56. data/lib/playbook/version.rb +1 -1
  57. metadata +19 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a0b28078834805bf57899264e987f4f63142ed9e9da7a4150e4567b46a2dfd28
4
- data.tar.gz: aeb49b9e4f1170ea5ed44cbd9fbf712c17c09658feda934185eb3fd71c12ffdc
3
+ metadata.gz: 78848474811b6e754736b7b5592e469d4121cddf79723c10c78342e0865b06e8
4
+ data.tar.gz: 90fc301b3b4dd2de5b5c9b65ba942a25b573504cc8134e09b155986519629149
5
5
  SHA512:
6
- metadata.gz: 35c87175dd140d1d6c86314678fa628e11f49fa4c2044771ad15db3c4d688bc4a2eff5918e59d1455f09f72fbbb6d22c85c0dc956a192d4cb94945680cea14e5
7
- data.tar.gz: 20ae14c1f20d443a89f133cd7e3335c20ca9ed01677a966b06754a3e28f4eed6d924c0bd7c895379e3f7ce81c34897776e73164604005e0ef16473017c0c720b
6
+ metadata.gz: 46f4271397f0d4a1d80cf5e079eca0f738b7f2154198640c74b0e4d7caac81dd413cd919dca53f8d833e9cdb270f53ad85f6b14485764300289ed61480bedb08
7
+ data.tar.gz: 8db3a7ba3f88a00750f935de3b44ae68ab1ee8c713a8798040914dec7c8837f8b8f493edb354a96dd81c96f2475f5faa72d83b9243aeafd0cd829fdf9daa2b2b
@@ -39,6 +39,7 @@
39
39
  @import 'pb_person/person';
40
40
  @import 'pb_person_contact/person_contact';
41
41
  @import 'pb_pill/pill';
42
+ @import 'pb_popover/popover';
42
43
  @import 'pb_progress_pills/progress_pills';
43
44
  @import 'pb_progress_simple/progress_simple';
44
45
  @import 'pb_radio/radio';
@@ -57,6 +58,6 @@
57
58
  @import 'pb_title_count/title_count';
58
59
  @import 'pb_title_detail/title_detail';
59
60
  @import 'pb_toggle/toggle';
61
+ @import 'pb_typeahead/typeahead';
60
62
  @import 'pb_user/user';
61
63
  @import 'pb_user_badge/user_badge';
62
- @import 'pb_typeahead/typeahead';
@@ -40,6 +40,7 @@ export OnlineStatus from './pb_online_status/_online_status.jsx'
40
40
  export Person from './pb_person/_person.jsx'
41
41
  export PersonContact from './pb_person_contact/_person_contact.jsx'
42
42
  export Pill from './pb_pill/_pill.jsx'
43
+ export Popover from './pb_popover/_popover.jsx'
43
44
  export ProgressPills from './pb_progress_pills/_progress_pills.jsx'
44
45
  export ProgressSimple from './pb_progress_simple/_progress_simple.jsx'
45
46
  export Radio from './pb_radio/_radio.jsx'
@@ -67,5 +68,5 @@ export barGraphSettings from './pb_bar_graph/barGraphSettings'
67
68
  export dashboardValueSettings from './pb_dashboard_value/dashboardValueSettings'
68
69
 
69
70
  // Other JS/Plugins
70
- export pbChart from './plugins/pb_chart_plugin.js'
71
+ export pbChart from './plugins/pb_chart.js'
71
72
  export PbTypeahead from './pb_typeahead'
@@ -0,0 +1,4 @@
1
+ import Popover from '../pb_popover/_popover.jsx'
2
+
3
+ import WebpackerReact from 'webpacker-react'
4
+ WebpackerReact.setup({ Popover })
@@ -12,6 +12,7 @@ import WebpackerReact from 'webpacker-react'
12
12
  // Generated file from kit generator.
13
13
  // KIT EXAMPLES
14
14
 
15
+ import '../pb_form/pb_form_validation'
15
16
  import * as avatar from 'pb_avatar/docs'
16
17
  import * as Badge from 'pb_badge/docs'
17
18
  import * as BarGraph from 'pb_bar_graph/docs'
@@ -51,6 +52,7 @@ import * as OnlineStatus from 'pb_online_status/docs'
51
52
  import * as Person from 'pb_person/docs'
52
53
  import * as PersonContact from 'pb_person_contact/docs'
53
54
  import * as Pill from 'pb_pill/docs'
55
+ import * as Popover from 'pb_popover/docs'
54
56
  import * as ProgressPills from 'pb_progress_pills/docs'
55
57
  import * as ProgressSimple from 'pb_progress_simple/docs'
56
58
  import * as Radio from 'pb_radio/docs'
@@ -72,7 +74,9 @@ import * as TitleDetail from 'pb_title_detail/docs'
72
74
  import * as Toggle from 'pb_toggle/docs'
73
75
  import * as User from 'pb_user/docs'
74
76
  import * as UserBadge from 'pb_user_badge/docs'
77
+ import PbTypeahead from 'pb_typeahead'
75
78
 
79
+ PbTypeahead.start()
76
80
  WebpackerReact.setup(avatar)
77
81
  WebpackerReact.setup(Badge)
78
82
  WebpackerReact.setup(BarGraph)
@@ -112,6 +116,7 @@ WebpackerReact.setup(OnlineStatus)
112
116
  WebpackerReact.setup(Person)
113
117
  WebpackerReact.setup(PersonContact)
114
118
  WebpackerReact.setup(Pill)
119
+ WebpackerReact.setup(Popover)
115
120
  WebpackerReact.setup(ProgressPills)
116
121
  WebpackerReact.setup(ProgressSimple)
117
122
  WebpackerReact.setup(Radio)
@@ -133,6 +138,3 @@ WebpackerReact.setup(TitleDetail)
133
138
  WebpackerReact.setup(Toggle)
134
139
  WebpackerReact.setup(User)
135
140
  WebpackerReact.setup(UserBadge)
136
-
137
- import PbTypeahead from 'pb_typeahead'
138
- PbTypeahead.start()
@@ -36,6 +36,7 @@ import '../kits/pb_online_status.js'
36
36
  import '../kits/pb_person.js'
37
37
  import '../kits/pb_person_contact.js'
38
38
  import '../kits/pb_pill.js'
39
+ import '../kits/pb_popover.js'
39
40
  import '../kits/pb_progress_pills.js'
40
41
  import '../kits/pb_progress_simple.js'
41
42
  import '../kits/pb_radio.js'
@@ -57,3 +58,4 @@ import '../kits/pb_title_detail.js'
57
58
  import '../kits/pb_toggle.js'
58
59
  import '../kits/pb_user.js'
59
60
  import '../kits/pb_user_badge.js'
61
+
@@ -4,7 +4,7 @@
4
4
  margin-bottom: 20px;
5
5
  border: 1px solid $border-light;
6
6
  border-radius: 4px;
7
- box-shadow: 0 4px 10px $shadow_light;
7
+ box-shadow: 0 4px 10px $shadow;
8
8
  background: $white;
9
9
  overflow: hidden;
10
10
 
@@ -38,7 +38,7 @@
38
38
  color: #faf6e4;
39
39
  padding: 0.5rem 1.5rem;
40
40
  margin: 1rem 0;
41
- box-shadow: 0 2px 10px $shadow_light;
41
+ box-shadow: 0 2px 10px $shadow;
42
42
  border-radius: 0.25rem;
43
43
  overflow: hidden;
44
44
  font-size: 1rem;
@@ -67,6 +67,6 @@ ul {
67
67
  div.pb--spacing_#{$name}{
68
68
  width: #{$value};
69
69
  height: 78px;
70
- background: $shadow_light;
70
+ background: $shadow;
71
71
  }
72
72
  }
@@ -1,10 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # DEPRECATION NOTICE - DO NOT USE Shadow Shallow and Shadow Default!
4
- # Shadow Options: Shallow and Default targed to be removed in release v4.0.0.
5
- # [https://github.com/powerhome/playbook/issues/550]
6
- # END DEPRECATION NOTICE
7
-
8
3
  module Playbook
9
4
  module PbCard
10
5
  class Card
@@ -17,7 +12,7 @@ module Playbook
17
12
  values: %w[none xs sm md lg xl],
18
13
  default: "md"
19
14
  prop :shadow, type: Playbook::Props::Enum,
20
- values: %w[none shallow default deep deeper deepest],
15
+ values: %w[none deep deeper deepest],
21
16
  default: "none"
22
17
  prop :highlight, type: Playbook::Props::Hash,
23
18
  default: {}
@@ -1,13 +1,13 @@
1
1
  <%= content_tag(:div,
2
2
  id: object.id,
3
3
  data: object.data,
4
- class: object.classname(object.kit_class)) do %>
4
+ class: object.classname) do %>
5
+
6
+ <%= object.label_element %>
5
7
 
6
- <%= object.label %>
7
8
  <div class="pb_currency_wrapper">
8
- <%= object.dollar_sign %>
9
- <%= object.value %>
10
- <%= object.unit %>
9
+ <%= object.currency_symbol_element %>
10
+ <%= object.amount_element %>
11
+ <%= object.units_element %>
11
12
  </div>
12
-
13
13
  <% end %>
@@ -1,26 +1,18 @@
1
1
  /* @flow */
2
2
 
3
3
  import React from 'react'
4
- import classnames from 'classnames'
5
4
 
6
5
  import { Body, Caption, Title } from '../'
7
6
  import { buildCss } from '../utilities/props'
8
7
 
9
8
  type CurrencyProps = {
10
9
  align?: 'left' | 'center' | 'right',
11
- className: String,
12
- currencySymbol: String,
13
- label?: String,
10
+ amount: string,
11
+ className?: string,
12
+ label?: string,
14
13
  separator?: '.' | ',',
15
14
  size?: 'sm' | 'lg',
16
- value?: String,
17
- units?: String,
18
- }
19
-
20
- const symbolCSS = (currencySymbol) => {
21
- return classnames({
22
- 'dollar_sign': currencySymbol === '$',
23
- })
15
+ symbol?: string,
24
16
  }
25
17
 
26
18
  const sizes = {
@@ -30,26 +22,43 @@ const sizes = {
30
22
 
31
23
  const Currency = ({
32
24
  align = 'left',
33
- currencySymbol = '$',
25
+ amount,
26
+ className,
34
27
  label = '',
35
28
  separator = '.',
36
29
  size = 'sm',
37
- units = '00',
38
- value,
39
- }: CurrencyProps) => (
40
- <div className={buildCss('pb_currency_kit', align)}>
41
- <Caption>{label}</Caption>
42
- <div className="pb_currency_wrapper">
43
- <Body className={symbolCSS(currencySymbol)}>{currencySymbol}</Body>
44
- <Title
45
- className="pb_currency_value"
46
- size={sizes[size]}
47
- >
48
- {`${value}${separator}`}
49
- </Title>
50
- <Body className="unit">{units}</Body>
30
+ symbol = '$',
31
+ }: CurrencyProps) => {
32
+ const [whole, decimal = '00'] = amount.split(separator)
33
+
34
+ return (
35
+ <div className={buildCss('pb_currency_kit', align, className)}>
36
+ <Caption>{label}</Caption>
37
+
38
+ <div className="pb_currency_wrapper">
39
+ <Body
40
+ className="dollar_sign"
41
+ color="light"
42
+ >
43
+ {symbol}
44
+ </Body>
45
+
46
+ <Title
47
+ className="pb_currency_value"
48
+ size={sizes[size]}
49
+ >
50
+ {`${whole}${separator}`}
51
+ </Title>
52
+
53
+ <Body
54
+ className="unit"
55
+ color="light"
56
+ >
57
+ {decimal}
58
+ </Body>
59
+ </div>
51
60
  </div>
52
- </div>
53
- )
61
+ )
62
+ }
54
63
 
55
64
  export default Currency
@@ -1,40 +1,40 @@
1
1
 
2
- [class^=pb_currency_kit]{
3
- &[class*=_center] {
4
- & > [class^=pb_caption],
5
- & > [class^=pb_title],
6
- & > [class^=pb_body] {
7
- text-align: center;
8
- }
9
- & > [class*=pb_currency_wrapper] {
10
- justify-content: center;
2
+ [class^=pb_currency_kit] {
3
+ &[class*=_center] {
4
+ & > [class^=pb_caption],
5
+ & > [class^=pb_title],
6
+ & > [class^=pb_body] {
7
+ text-align: center;
8
+ }
9
+ & > [class*=pb_currency_wrapper] {
10
+ justify-content: center;
11
11
  }
12
12
  }
13
13
 
14
- &[class*=_right] {
15
- & > [class^=pb_caption],
16
- & > [class^=pb_title],
17
- & > [class^=pb_body] {
18
- text-align: right;
19
- }
20
- & > [class*=pb_currency_wrapper] {
14
+ &[class*=_right] {
15
+ & > [class^=pb_caption],
16
+ & > [class^=pb_title],
17
+ & > [class^=pb_body] {
18
+ text-align: right;
19
+ }
20
+ & > [class*=pb_currency_wrapper] {
21
21
  justify-content: flex-end;
22
22
  }
23
23
  }
24
24
  }
25
25
 
26
- [class^=pb_currency_wrapper] {
27
- display: flex;
26
+ [class^=pb_currency_wrapper] {
27
+ display: flex;
28
28
 
29
- & > [class*=dollar_sign] {
30
- display: flex;
31
- align-items: flex-start;
32
- }
33
- & > [class*=unit] {
34
- display: flex;
35
- align-items: flex-end;
36
- }
37
- & > [class*=pb_currency_value] {
38
- line-height: .9;
39
- }
29
+ & > [class*=dollar_sign] {
30
+ display: flex;
31
+ align-items: flex-start;
32
+ }
33
+ & > [class*=unit] {
34
+ display: flex;
35
+ align-items: flex-end;
40
36
  }
37
+ & > [class*=pb_currency_value] {
38
+ line-height: .9;
39
+ }
40
+ }
@@ -2,99 +2,91 @@
2
2
 
3
3
  module Playbook
4
4
  module PbCurrency
5
- class Currency < Playbook::PbKit::Base
6
- PROPS = %i[configured_align
7
- configured_classname
8
- configured_data
9
- configured_id
10
- configured_label
11
- configured_value
12
- configured_unit
13
- configured_dollar_sign
14
- configured_size].freeze
15
-
16
- def initialize(align: default_configuration,
17
- classname: default_configuration,
18
- data: default_configuration,
19
- id: default_configuration,
20
- label: default_configuration,
21
- value: default_configuration,
22
- unit: default_configuration,
23
- dollar_sign: default_configuration,
24
- size: default_configuration)
25
- self.configured_align = align
26
- self.configured_classname = classname
27
- self.configured_data = data
28
- self.configured_id = id
29
- self.configured_label = label
30
- self.configured_value = value
31
- self.configured_unit = unit
32
- self.configured_dollar_sign = dollar_sign
33
- self.configured_size = size
34
- end
5
+ class Currency
6
+ include ActionView::Context
7
+ include Playbook::Props
35
8
 
36
- def align
37
- align_options = %w[left center right]
38
- one_of_value(configured_align, align_options, "left")
39
- end
9
+ partial "pb_currency/currency"
40
10
 
41
- def dollar_sign
42
- pb_dollar_sign = Playbook::PbBody::Body.new(classname: "dollar_sign", color: "light") do
43
- default_value(configured_dollar_sign, "")
44
- end
45
- ApplicationController.renderer.render(partial: pb_dollar_sign, as: :object)
46
- end
11
+ prop :align, type: Playbook::Props::Enum,
12
+ values: %w[left center right],
13
+ default: "left"
47
14
 
48
- def label
49
- if is_set? configured_label
50
- pb_label = Playbook::PbCaption::Caption.new(text: configured_label)
51
- ApplicationController.renderer.render(partial: pb_label, as: :object)
52
- end
53
- end
15
+ prop :size, type: Playbook::Props::Enum,
16
+ values: %w[lg sm],
17
+ default: "sm"
54
18
 
55
- def size
56
- size_options = %w[lg sm]
57
- one_of_value(configured_size, size_options, "sm")
58
- end
19
+ prop :label, type: Playbook::Props::String,
20
+ default: ""
59
21
 
60
- def value_size
61
- size == "lg" ? 1 : 2
22
+ prop :separator, type: Playbook::Props::String,
23
+ default: "."
24
+
25
+ prop :symbol, type: Playbook::Props::String,
26
+ default: "$"
27
+
28
+ prop :amount, type: Playbook::Props::String,
29
+ required: true
30
+
31
+ def classname
32
+ generate_classname("pb_currency_kit", align)
62
33
  end
63
34
 
64
- def value
65
- if is_set? configured_value
66
- pb_title = Playbook::PbTitle::Title.new(size: value_size, text: configured_value, classname: "pb_currency_value")
67
- ApplicationController.renderer.render(partial: pb_title, as: :object)
68
- end
35
+ def currency_symbol_element
36
+ pb_dollar_sign = Playbook::PbBody::Body.new(
37
+ classname: "dollar_sign",
38
+ color: "light"
39
+ ) { symbol }
40
+
41
+ ApplicationController.renderer.render(
42
+ partial: pb_dollar_sign,
43
+ as: :object
44
+ )
69
45
  end
70
46
 
71
- def unit
72
- pb_unit = Playbook::PbBody::Body.new(classname: "unit", color: "light") do
73
- default_value(configured_unit, "")
74
- end
75
- ApplicationController.renderer.render(partial: pb_unit, as: :object)
47
+ def label_element
48
+ pb_label = Playbook::PbCaption::Caption.new(text: label)
49
+
50
+ ApplicationController.renderer.render(
51
+ partial: pb_label,
52
+ as: :object
53
+ )
76
54
  end
77
55
 
78
- def kit_class
79
- kit_options = [
80
- "pb_currency_kit",
81
- align,
82
- ]
83
- kit_options.join("_")
56
+ def amount_element
57
+ whole_part, _ = amount.split(separator)
58
+
59
+ pb_title = Playbook::PbTitle::Title.new(
60
+ size: size_value,
61
+ text: "#{whole_part}#{separator}",
62
+ classname: "pb_currency_value"
63
+ )
64
+
65
+ ApplicationController.renderer.render(
66
+ partial: pb_title,
67
+ as: :object
68
+ )
84
69
  end
85
70
 
86
- def to_partial_path
87
- "pb_currency/currency"
71
+ def units_element
72
+ _, decimal_part = amount.split(separator)
73
+
74
+ pb_unit = Playbook::PbBody::Body.new(
75
+ classname: "unit",
76
+ color: "light"
77
+ ) { decimal_part || "00" }
78
+
79
+ ApplicationController.renderer.render(
80
+ partial: pb_unit,
81
+ as: :object
82
+ )
88
83
  end
89
84
 
90
85
  private
91
86
 
92
- DEFAULT = Object.new
93
- private_constant :DEFAULT
94
- def default_configuration
95
- DEFAULT
87
+ def size_value
88
+ size == "lg" ? 1 : 2
96
89
  end
97
- attr_accessor(*PROPS)
98
90
  end
99
91
  end
100
92
  end