playbook_ui 4.0.0 → 4.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 78848474811b6e754736b7b5592e469d4121cddf79723c10c78342e0865b06e8
4
- data.tar.gz: 90fc301b3b4dd2de5b5c9b65ba942a25b573504cc8134e09b155986519629149
3
+ metadata.gz: 124b780708521b0e6a52e1579c0b9b77f08eba4e2ab69ffaf662fe48d2921f04
4
+ data.tar.gz: 606e82f8d846ea284aef6a59afb4c59ac79fc7403ac907f5290ec1c263ec52c9
5
5
  SHA512:
6
- metadata.gz: 46f4271397f0d4a1d80cf5e079eca0f738b7f2154198640c74b0e4d7caac81dd413cd919dca53f8d833e9cdb270f53ad85f6b14485764300289ed61480bedb08
7
- data.tar.gz: 8db3a7ba3f88a00750f935de3b44ae68ab1ee8c713a8798040914dec7c8837f8b8f493edb354a96dd81c96f2475f5faa72d83b9243aeafd0cd829fdf9daa2b2b
6
+ metadata.gz: 1e4055fedb2b599307caad79e47001fc8c8cd8e4519b83d50292131c38ccc91da73f48def47d3af8347b2825480384bf9a2846c58230c994a956a5b68da3d541
7
+ data.tar.gz: 206b7fd62d2114c7702b7c12de6c7b31f98c5ed4d5740322d8c5e552b13808343436cdb938b07d89089bd271442ba5050db4e9d69e3bf81b6ce232ada381999c
@@ -40,7 +40,6 @@ 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'
44
43
  export ProgressPills from './pb_progress_pills/_progress_pills.jsx'
45
44
  export ProgressSimple from './pb_progress_simple/_progress_simple.jsx'
46
45
  export Radio from './pb_radio/_radio.jsx'
@@ -52,7 +52,6 @@ import * as OnlineStatus from 'pb_online_status/docs'
52
52
  import * as Person from 'pb_person/docs'
53
53
  import * as PersonContact from 'pb_person_contact/docs'
54
54
  import * as Pill from 'pb_pill/docs'
55
- import * as Popover from 'pb_popover/docs'
56
55
  import * as ProgressPills from 'pb_progress_pills/docs'
57
56
  import * as ProgressSimple from 'pb_progress_simple/docs'
58
57
  import * as Radio from 'pb_radio/docs'
@@ -36,7 +36,6 @@ 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'
40
39
  import '../kits/pb_progress_pills.js'
41
40
  import '../kits/pb_progress_simple.js'
42
41
  import '../kits/pb_radio.js'
@@ -58,4 +57,3 @@ import '../kits/pb_title_detail.js'
58
57
  import '../kits/pb_toggle.js'
59
58
  import '../kits/pb_user.js'
60
59
  import '../kits/pb_user_badge.js'
61
-
@@ -8,6 +8,10 @@
8
8
  <div class="pb_currency_wrapper">
9
9
  <%= object.currency_symbol_element %>
10
10
  <%= object.amount_element %>
11
- <%= object.units_element %>
11
+ <%= pb_rails("body", props: {
12
+ text: object.units_element,
13
+ color: "light",
14
+ classname: "unit"
15
+ }) %>
12
16
  </div>
13
17
  <% end %>
@@ -8,9 +8,9 @@ import { buildCss } from '../utilities/props'
8
8
  type CurrencyProps = {
9
9
  align?: 'left' | 'center' | 'right',
10
10
  amount: string,
11
+ unit: string,
11
12
  className?: string,
12
13
  label?: string,
13
- separator?: '.' | ',',
14
14
  size?: 'sm' | 'lg',
15
15
  symbol?: string,
16
16
  }
@@ -23,13 +23,13 @@ const sizes = {
23
23
  const Currency = ({
24
24
  align = 'left',
25
25
  amount,
26
+ unit,
26
27
  className,
27
28
  label = '',
28
- separator = '.',
29
29
  size = 'sm',
30
30
  symbol = '$',
31
31
  }: CurrencyProps) => {
32
- const [whole, decimal = '00'] = amount.split(separator)
32
+ const [whole, decimal = '00'] = amount.split('.')
33
33
 
34
34
  return (
35
35
  <div className={buildCss('pb_currency_kit', align, className)}>
@@ -47,14 +47,18 @@ const Currency = ({
47
47
  className="pb_currency_value"
48
48
  size={sizes[size]}
49
49
  >
50
- {`${whole}${separator}`}
50
+ {`${whole}`}
51
51
  </Title>
52
52
 
53
53
  <Body
54
54
  className="unit"
55
55
  color="light"
56
56
  >
57
- {decimal}
57
+ <If condition={unit}>
58
+ {unit}
59
+ <Else />
60
+ {`.${decimal}`}
61
+ </If>
58
62
  </Body>
59
63
  </div>
60
64
  </div>
@@ -19,15 +19,15 @@ module Playbook
19
19
  prop :label, type: Playbook::Props::String,
20
20
  default: ""
21
21
 
22
- prop :separator, type: Playbook::Props::String,
23
- default: "."
24
-
25
22
  prop :symbol, type: Playbook::Props::String,
26
23
  default: "$"
27
24
 
28
25
  prop :amount, type: Playbook::Props::String,
29
26
  required: true
30
27
 
28
+ prop :unit, type: Playbook::Props::String,
29
+ required: false
30
+
31
31
  def classname
32
32
  generate_classname("pb_currency_kit", align)
33
33
  end
@@ -54,11 +54,10 @@ module Playbook
54
54
  end
55
55
 
56
56
  def amount_element
57
- whole_part, _ = amount.split(separator)
58
-
57
+ whole_part = amount.split(".")
59
58
  pb_title = Playbook::PbTitle::Title.new(
60
59
  size: size_value,
61
- text: "#{whole_part}#{separator}",
60
+ text: whole_part.first.to_s,
62
61
  classname: "pb_currency_value"
63
62
  )
64
63
 
@@ -69,17 +68,12 @@ module Playbook
69
68
  end
70
69
 
71
70
  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
- )
71
+ _, decimal_part = amount.split(".")
72
+ if unit.nil?
73
+ decimal_part.nil? ? ".00" : ".#{decimal_part}"
74
+ else
75
+ unit
76
+ end
83
77
  end
84
78
 
85
79
  private
@@ -10,13 +10,15 @@ const CurrencyDefault = () => {
10
10
  />
11
11
  <Currency
12
12
  align="center"
13
- amount="2,000"
13
+ amount="342"
14
14
  label="Caption"
15
+ symbol="€"
15
16
  />
16
17
  <Currency
17
18
  align="right"
18
- amount="2,000"
19
+ amount="45"
19
20
  label="Caption"
21
+ unit="/mo"
20
22
  />
21
23
  </div>
22
24
  )
@@ -5,16 +5,16 @@
5
5
 
6
6
  <%= pb_rails("currency", props: {
7
7
  align: "center",
8
- amount: "2,000",
8
+ amount: "342",
9
9
  label: "Caption",
10
10
  size: "lg",
11
- symbol: "$",
11
+ symbol: "",
12
12
  }) %>
13
13
 
14
14
  <%= pb_rails("currency", props: {
15
15
  align: "right",
16
- amount: "2,000.00",
16
+ amount: "45",
17
17
  label: "Caption",
18
+ unit: "/mo",
18
19
  size: "lg",
19
- symbol: "$",
20
20
  }) %>
@@ -6,20 +6,22 @@ const CurrencyDefault = () => {
6
6
  <div>
7
7
  <Currency
8
8
  amount="2,000.50"
9
+ label="Caption"
9
10
  size="lg"
10
11
  />
11
12
  <Currency
12
13
  align="center"
13
- amount="2,000.00"
14
+ amount="342"
14
15
  label="Caption"
15
16
  size="lg"
16
- symbol="$$$"
17
+ symbol=""
17
18
  />
18
19
  <Currency
19
20
  align="right"
20
- amount="2,000"
21
+ amount="45"
21
22
  label="Caption"
22
23
  size="lg"
24
+ unit="/mo"
23
25
  />
24
26
  </div>
25
27
  )
@@ -1,20 +1,21 @@
1
1
  <%= pb_rails("currency", props: {
2
2
  label: "Caption",
3
- amount: "2,000",
3
+ amount: "2,000.50",
4
4
  size: "sm",
5
5
  }) %>
6
6
 
7
7
  <%= pb_rails("currency", props: {
8
8
  align: "center",
9
- amount: "2,000.50",
9
+ amount: "342",
10
10
  label: "Caption",
11
11
  size: "sm",
12
- symbol: "$$$",
12
+ symbol: "",
13
13
  }) %>
14
14
 
15
15
  <%= pb_rails("currency", props: {
16
16
  align: "right",
17
- amount: "2,000.00",
17
+ amount: "45",
18
18
  label: "Caption",
19
+ unit: "/mo",
19
20
  size: "sm",
20
21
  }) %>
@@ -5,4 +5,3 @@ examples:
5
5
  - popover_list: With any children
6
6
 
7
7
  react:
8
- - popover_default: Default
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Playbook
4
- VERSION = "4.0.0"
4
+ VERSION = "4.0.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: playbook_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Power UX
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-01-25 00:00:00.000000000 Z
12
+ date: 2020-01-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -438,7 +438,6 @@ files:
438
438
  - app/pb_kits/playbook/kits/pb_person.js
439
439
  - app/pb_kits/playbook/kits/pb_person_contact.js
440
440
  - app/pb_kits/playbook/kits/pb_pill.js
441
- - app/pb_kits/playbook/kits/pb_popover.js
442
441
  - app/pb_kits/playbook/kits/pb_progress_pills.js
443
442
  - app/pb_kits/playbook/kits/pb_progress_simple.js
444
443
  - app/pb_kits/playbook/kits/pb_radio.js
@@ -972,15 +971,12 @@ files:
972
971
  - app/pb_kits/playbook/pb_pill/pill.rb
973
972
  - app/pb_kits/playbook/pb_popover/_popover.html.erb
974
973
  - app/pb_kits/playbook/pb_popover/_popover.js
975
- - app/pb_kits/playbook/pb_popover/_popover.jsx
976
974
  - app/pb_kits/playbook/pb_popover/_popover.scss
977
975
  - app/pb_kits/playbook/pb_popover/docs/_popover_default.html.erb
978
- - app/pb_kits/playbook/pb_popover/docs/_popover_default.jsx
979
976
  - app/pb_kits/playbook/pb_popover/docs/_popover_list.html.erb
980
977
  - app/pb_kits/playbook/pb_popover/docs/_popover_with_button.html.erb
981
978
  - app/pb_kits/playbook/pb_popover/docs/_popover_with_circle.html.erb
982
979
  - app/pb_kits/playbook/pb_popover/docs/example.yml
983
- - app/pb_kits/playbook/pb_popover/docs/index.js
984
980
  - app/pb_kits/playbook/pb_popover/popover.rb
985
981
  - app/pb_kits/playbook/pb_progress_pills/_progress_pills.html.erb
986
982
  - app/pb_kits/playbook/pb_progress_pills/_progress_pills.jsx
@@ -1,4 +0,0 @@
1
- import Popover from '../pb_popover/_popover.jsx'
2
-
3
- import WebpackerReact from 'webpacker-react'
4
- WebpackerReact.setup({ Popover })
@@ -1,23 +0,0 @@
1
- /* @flow */
2
-
3
- import React from 'react'
4
-
5
- type PopoverProps = {
6
- className?: String,
7
- data?: String,
8
- id?: String,
9
- }
10
-
11
- const Popover = ({
12
- className,
13
- data,
14
- id,
15
- }: PopoverProps) => (
16
- <div>
17
- <p>{`className: ${className}`}</p>
18
- <p>{`data: ${data}`}</p>
19
- <p>{`id: ${id}`}</p>
20
- </div>
21
- )
22
-
23
- export default Popover
@@ -1,10 +0,0 @@
1
- import React from 'react'
2
- import { Popover } from '../../'
3
-
4
- const PopoverDefault = () => (
5
- <div>
6
- <Popover />
7
- </div>
8
- )
9
-
10
- export default PopoverDefault
@@ -1 +0,0 @@
1
- export { default as PopoverDefault } from './_popover_default.jsx'