playbook_ui 14.14.0.pre.alpha.pbntr500currencykithandlingofnullvalues6311 → 14.14.0.pre.alpha.play1755pbcontenttag6327

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: 17fca453caefd685c9ed41cdcc066aa79f6623d5bf4c9a8601a1e9f95ab47c26
4
- data.tar.gz: 2ed3fe8635e74c438de05d9c2d9c18d371d5e91abc0f43564f110cbc6ccaa381
3
+ metadata.gz: 9bd391f5c229dffe74bfe2394afc942a2f4b2a39d94c73720edc0d456ee7307f
4
+ data.tar.gz: 9ceb47d5d88b6d0c393214fc646ff346728ec143e87b11165383f2b80b418c9f
5
5
  SHA512:
6
- metadata.gz: c9da096a667206278c2029e809abad8cc4bd1e0923310d335532b8c8cfd267957bc77be6d1e3afffef2eb03d64ed1fb953cc5ebbff7e6f8e17336d85a5949d08
7
- data.tar.gz: 55c2c623531974e1bab492e272b3fa1cfa9996d3ab5efcb65d34ba0a0037d6e86d0576ea1376eeef937d4047f6adc92abb6194ce1ff0edd16e6c3db05d11f027
6
+ metadata.gz: 0306b000aa877e5bf7ca746d36e2dd0afdd7d3724c187fdaa44b3ed3cc789cfe4067a01e6699a4226d31fb9fa559bc4c9ca695cf09f7650d2663be85821f21d8
7
+ data.tar.gz: cf80ac9e99fc99d32e8855de6bf31f17ba8a3105976bd28c489e76afe4214c2752b34c125e7ddacd83c2cba74514e42280cc1d059c392482d236ac371f9ca2f0
@@ -21,7 +21,6 @@ type CurrencyProps = {
21
21
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
22
22
  id?: string,
23
23
  label?: string,
24
- nullDisplay?: string,
25
24
  size?: 'sm' | 'md' | 'lg',
26
25
  symbol?: string,
27
26
  variant?: 'default' | 'light' | 'bold',
@@ -50,7 +49,6 @@ const Currency = (props: CurrencyProps): React.ReactElement => {
50
49
  unit,
51
50
  className,
52
51
  label = '',
53
- nullDisplay = '',
54
52
  size = 'sm',
55
53
  symbol = '$',
56
54
  variant = 'default',
@@ -120,57 +118,44 @@ const Currency = (props: CurrencyProps): React.ReactElement => {
120
118
  id={id}
121
119
  >
122
120
  <Caption dark={dark}>{label}</Caption>
121
+
123
122
  <div className={`pb_currency_wrapper${variantClass || emphasizedClass}`}>
124
123
  {unstyled ? (
125
- nullDisplay && !amount ? (
126
- <div>{nullDisplay}</div>
127
- ) : (
128
- <>
129
- <div>{handleNegative}{symbol}</div>
130
- <div>{getAmount}</div>
131
- <div>
132
- {getAbbreviation}
133
- {unit ? unit : getDecimalValue}
134
- </div>
135
- </>
136
- )
124
+ <>
125
+ <div>{handleNegative}{symbol}</div>
126
+ <div>{getAmount}</div>
127
+ <div>
128
+ {getAbbreviation}
129
+ {unit ? unit : getDecimalValue}
130
+ </div>
131
+ </>
137
132
  ) : (
138
- nullDisplay && !amount ? (
133
+ <>
134
+ <Body
135
+ className="dollar_sign"
136
+ color="light"
137
+ dark={dark}
138
+ >
139
+ {handleNegative}{symbol}
140
+ </Body>
141
+
139
142
  <Title
140
143
  className="pb_currency_value"
141
144
  dark={dark}
142
145
  size={sizes[size]}
143
- >
144
- {nullDisplay}
145
- </Title>
146
- ) : (
147
- <>
148
- <Body
149
- className="dollar_sign"
150
- color="light"
151
- dark={dark}
152
- >
153
- {handleNegative}{symbol}
154
- </Body>
155
-
156
- <Title
157
- className="pb_currency_value"
158
- dark={dark}
159
- size={sizes[size]}
160
- >
161
- {getAmount}
162
- </Title>
163
-
164
- <Body
165
- className="unit"
166
- color="light"
167
- dark={dark}
168
- >
169
- {getAbbreviation}
170
- {unit ? unit : getDecimalValue}
171
- </Body>
172
- </>
173
- )
146
+ >
147
+ {getAmount}
148
+ </Title>
149
+
150
+ <Body
151
+ className="unit"
152
+ color="light"
153
+ dark={dark}
154
+ >
155
+ {getAbbreviation}
156
+ {unit ? unit : getDecimalValue}
157
+ </Body>
158
+ </>
174
159
  )}
175
160
  </div>
176
161
  </div>
@@ -1,24 +1,17 @@
1
1
  <%= pb_content_tag do %>
2
2
  <%= pb_rails("caption", props: object.caption_props) %>
3
+
3
4
  <div class=<%= "pb_currency_wrapper#{object.variant_class || object.emphasized_class}" %>>
4
5
  <% if object.unstyled %>
5
- <% if object.null_display && object.amount.blank? %>
6
- <div><%= object.null_display %></div>
7
- <% else %>
8
- <div><%= object.negative_sign %><%= object.symbol %></div>
9
- <div><%= object.title_props[:text] %></div>
10
- <div><%= object.body_props[:text] %></div>
11
- <% end %>
6
+ <div><%= object.negative_sign %><%= object.symbol %></div>
7
+ <div><%= object.title_props[:text] %></div>
8
+ <div><%= object.body_props[:text] %></div>
12
9
  <% else %>
13
- <% if object.null_display && object.amount.blank? %>
14
- <%= pb_rails("title", props: object.title_props) %>
15
- <% else %>
16
- <%= pb_rails("body", props: object.currency_wrapper_props) do %>
17
- <%= object.negative_sign %><%= object.symbol %>
18
- <% end %>
19
- <%= pb_rails("title", props: object.title_props) %>
20
- <%= pb_rails("body", props: object.body_props) %>
10
+ <%= pb_rails("body", props: object.currency_wrapper_props) do %>
11
+ <%= object.negative_sign %><%= object.symbol %>
21
12
  <% end %>
13
+ <%= pb_rails("title", props: object.title_props) %>
14
+ <%= pb_rails("body", props: object.body_props) %>
22
15
  <% end %>
23
16
  </div>
24
17
  <% end %>
@@ -46,9 +46,6 @@ module Playbook
46
46
  prop :comma_separator, type: Playbook::Props::Boolean,
47
47
  default: false
48
48
 
49
- prop :null_display, type: Playbook::Props::String,
50
- required: false
51
-
52
49
  def classname
53
50
  generate_classname("pb_currency_kit", align, size, dark_class)
54
51
  end
@@ -68,20 +65,10 @@ module Playbook
68
65
  }
69
66
  end
70
67
 
71
- def title_text
72
- if null_display
73
- null_display
74
- elsif swap_negative
75
- absolute_amount(abbr_or_format_amount)
76
- else
77
- abbr_or_format_amount
78
- end
79
- end
80
-
81
68
  def title_props
82
69
  {
83
70
  size: size_value,
84
- text: title_text,
71
+ text: swap_negative ? absolute_amount(abbr_or_format_amount) : abbr_or_format_amount,
85
72
  classname: "pb_currency_value",
86
73
  dark: dark,
87
74
  }
@@ -158,10 +145,8 @@ module Playbook
158
145
  1
159
146
  when "md"
160
147
  3
161
- when "sm"
162
- 4
163
148
  else
164
- 3
149
+ 4
165
150
  end
166
151
  end
167
152
 
@@ -10,7 +10,6 @@ examples:
10
10
  - currency_unstyled: Unstyled
11
11
  - currency_comma_separator: Comma Separator
12
12
  - currency_negative: Negative
13
- - currency_null_display: Null Display
14
13
 
15
14
  react:
16
15
  - currency_variants: Variants
@@ -22,7 +21,6 @@ examples:
22
21
  - currency_unstyled: Unstyled
23
22
  - currency_comma_separator: Comma Separator
24
23
  - currency_negative: Negative
25
- - currency_null_display: Null Display
26
24
 
27
25
  swift:
28
26
  - currency_size_swift: Size
@@ -6,5 +6,4 @@ export { default as CurrencyAbbreviated } from './_currency_abbreviated.jsx'
6
6
  export { default as CurrencyMatchingDecimals } from './_currency_matching_decimals.jsx'
7
7
  export { default as CurrencyUnstyled } from './_currency_unstyled.jsx'
8
8
  export { default as CurrencyCommaSeparator } from './_currency_comma_separator.jsx'
9
- export { default as CurrencyNegative } from './_currency_negative.jsx'
10
- export { default as CurrencyNullDisplay } from './_currency_null_display.jsx'
9
+ export { default as CurrencyNegative } from './_currency_negative.jsx'
@@ -1,8 +1,4 @@
1
- <%= content_tag(:div,
2
- aria: object.aria,
3
- data: object.data,
4
- class: object.classnames,
5
- **combined_html_options) do %>
1
+ <%= pb_content_tag do %>
6
2
  <% if object.label %>
7
3
  <label class="pb_select_kit_label" for="<%= object.name %>">
8
4
  <%= pb_rails("caption", props: { text: object.label, dark: object.dark }) %>
@@ -1,8 +1,4 @@
1
- <%= content_tag(:div,
2
- id: object.id,
3
- data: object.data,
4
- class: object.classname,
5
- **combined_html_options) do %>
1
+ <%= pb_content_tag do %>
6
2
 
7
3
  <% if object.multi %>
8
4
  <%= check_box_tag(object.name, object.value, object.checked, object.additional_input_options) %>
@@ -1,7 +1,4 @@
1
- <%= content_tag(:div,
2
- data: object.data,
3
- class: object.classname,
4
- **combined_html_options) do %>
1
+ <%= pb_content_tag do %>
5
2
 
6
3
  <%= pb_rails("selectable_card", props: {
7
4
  input_id: object.input_id,
@@ -1,8 +1,4 @@
1
- <%= content_tag(:div,
2
- id: object.id,
3
- data: object.data,
4
- class: object.classname,
5
- **combined_html_options) do %>
1
+ <%= pb_content_tag do %>
6
2
 
7
3
  <% if object.inputs == "disabled" %>
8
4