playbook_ui 14.8.0.pre.alpha.PLAY1598floatinguiupgrade4563 → 14.8.0.pre.alpha.PLAY1615movenegativetoleftofcurrencysign4539
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_currency/_currency.tsx +7 -3
- data/app/pb_kits/playbook/pb_currency/currency.html.erb +2 -2
- data/app/pb_kits/playbook/pb_currency/currency.rb +17 -1
- data/dist/chunks/_typeahead-D0PihN_3.js +22 -0
- data/dist/chunks/_weekday_stacked-CVx1CzK-.js +45 -0
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +0 -321
- data/dist/playbook-doc.js +1 -1
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +4 -4
- data/dist/chunks/_typeahead-DUfnbpvK.js +0 -22
- data/dist/chunks/_weekday_stacked-CFiZk2PV.js +0 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd8c9650b23708306eeea2d36f0a87f8b065d8aa28fbd72bfef581827414c6da
|
4
|
+
data.tar.gz: e941e09a241073a2641e0a42b5e3b42e67db2cc6ea4fdf903d54bf8986b3e13c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ffec4416dafad8b69973e7f96276279ecdfc2aa2a9ada8c002a188fe99061db0b22a2a8a5b662a661bab1562b961b3c3db8f8924959b859383c1e9d17e4483b
|
7
|
+
data.tar.gz: d2b75f2d74f6ddb913b171976b07a372cbfa539524e06f36ece2f82dd377e66087290830c64735ddf9c158ded7fdb97aaab9fb6c6f1932df364104ef0a661b3e
|
@@ -101,7 +101,11 @@ const Currency = (props: CurrencyProps): React.ReactElement => {
|
|
101
101
|
return decimalPart ? `${formattedWhole}.${decimalPart}` : formattedWhole;
|
102
102
|
}
|
103
103
|
|
104
|
-
const
|
104
|
+
const swapNegative = size === "sm" && symbol !== ""
|
105
|
+
const handleNegative = amount.startsWith("-") && swapNegative ? "-" : ""
|
106
|
+
const getAbsoluteAmount = (amountString) => amountString.replace(/^-/,'')
|
107
|
+
const getAbbrOrFormatAmount = abbreviate ? getAbbreviatedValue('amount') : formatAmount(getMatchingDecimalAmount)
|
108
|
+
const getAmount = swapNegative ? getAbsoluteAmount(getAbbrOrFormatAmount) : getAbbrOrFormatAmount
|
105
109
|
const getAbbreviation = abbreviate ? getAbbreviatedValue('unit') : null
|
106
110
|
const getDecimalValue = abbreviate ? '' : getMatchingDecimalValue
|
107
111
|
|
@@ -118,7 +122,7 @@ const Currency = (props: CurrencyProps): React.ReactElement => {
|
|
118
122
|
<div className={`pb_currency_wrapper${variantClass || emphasizedClass}`}>
|
119
123
|
{unstyled ? (
|
120
124
|
<>
|
121
|
-
<div>{symbol}</div>
|
125
|
+
<div>{handleNegative}{symbol}</div>
|
122
126
|
<div>{getAmount}</div>
|
123
127
|
<div>
|
124
128
|
{getAbbreviation}
|
@@ -132,7 +136,7 @@ const Currency = (props: CurrencyProps): React.ReactElement => {
|
|
132
136
|
color="light"
|
133
137
|
dark={dark}
|
134
138
|
>
|
135
|
-
{symbol}
|
139
|
+
{handleNegative}{symbol}
|
136
140
|
</Body>
|
137
141
|
|
138
142
|
<Title
|
@@ -3,12 +3,12 @@
|
|
3
3
|
|
4
4
|
<div class=<%= "pb_currency_wrapper#{object.variant_class || object.emphasized_class}" %>>
|
5
5
|
<% if object.unstyled %>
|
6
|
-
<div><%= object.symbol %></div>
|
6
|
+
<div><%= object.negative_sign %><%= object.symbol %></div>
|
7
7
|
<div><%= object.title_props[:text] %></div>
|
8
8
|
<div><%= object.body_props[:text] %></div>
|
9
9
|
<% else %>
|
10
10
|
<%= pb_rails("body", props: object.currency_wrapper_props) do %>
|
11
|
-
<%= object.symbol %>
|
11
|
+
<%= object.negative_sign %><%= object.symbol %>
|
12
12
|
<% end %>
|
13
13
|
<%= pb_rails("title", props: object.title_props) %>
|
14
14
|
<%= pb_rails("body", props: object.body_props) %>
|
@@ -68,12 +68,20 @@ module Playbook
|
|
68
68
|
def title_props
|
69
69
|
{
|
70
70
|
size: size_value,
|
71
|
-
text:
|
71
|
+
text: swap_negative ? absolute_amount(abbr_or_format_amount) : abbr_or_format_amount,
|
72
72
|
classname: "pb_currency_value",
|
73
73
|
dark: dark,
|
74
74
|
}
|
75
75
|
end
|
76
76
|
|
77
|
+
def abbr_or_format_amount
|
78
|
+
abbreviate ? abbreviated_value : formatted_amount
|
79
|
+
end
|
80
|
+
|
81
|
+
def negative_sign
|
82
|
+
amount.starts_with?("-") && swap_negative ? "-" : ""
|
83
|
+
end
|
84
|
+
|
77
85
|
def body_props
|
78
86
|
{
|
79
87
|
text: units_element,
|
@@ -159,6 +167,14 @@ module Playbook
|
|
159
167
|
whole_value
|
160
168
|
end
|
161
169
|
end
|
170
|
+
|
171
|
+
def absolute_amount(amount_string)
|
172
|
+
amount_string.sub(/^-/, "")
|
173
|
+
end
|
174
|
+
|
175
|
+
def swap_negative
|
176
|
+
size == "sm" && symbol != ""
|
177
|
+
end
|
162
178
|
end
|
163
179
|
end
|
164
180
|
end
|