keystone_ui 0.48.0 → 0.49.0
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c5188a7128c83107e3bb691fbbeb68733c14ff424e97bbbceea5cb4f901409a9
|
|
4
|
+
data.tar.gz: 897711fad313df1fad9c2d2f2d29fc881c7b26a66c59028842c18816b9fdd364
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0ddc36bc018b6ebbd5be50aa7413eaddbc5380598ed7e0af989f3d241bf3522785c8def0d00aaf75b4dc733b45fbe37f18a13860570fcff137604d7f60b521cd
|
|
7
|
+
data.tar.gz: f95983f302a7fc742e5962b4477b3c21429b93cd9a1a2561390fdc33482483a6f1f68eb661770f9a9cd0cb63b592febd444f18bbce19eb886c4a526a5b9297a9
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
<% end %>
|
|
13
13
|
</div>
|
|
14
14
|
<p class="<%= value_classes %>">
|
|
15
|
-
<% if link? %><a href="<%= href %>" class="<%= value_link_classes %>"><%= value %></a><% else %><%= value %><% end %><% if suffix? %><span class="<%= suffix_classes %>"> <%= suffix %></span><% end %>
|
|
15
|
+
<% if missing? %><span class="<%= Keystone::Ui::StatCardComponent::FALLBACK_CLASSES %>"><%= fallback %></span><% elsif link? %><a href="<%= href %>" class="<%= value_link_classes %>"><%= value %></a><% else %><%= value %><% end %><% if suffix? %><span class="<%= suffix_classes %>"> <%= suffix %></span><% end %>
|
|
16
16
|
</p>
|
|
17
|
+
<% if note %><p class="<%= Keystone::Ui::StatCardComponent::NOTE_CLASSES %>"><%= note %></p><% end %>
|
|
17
18
|
<p class="<%= change_row_classes %>"><%= change_label %></p>
|
|
18
19
|
</div>
|
|
@@ -6,6 +6,7 @@ module Keystone
|
|
|
6
6
|
EMPHASIS_CLASSES = "ks-stat-card-emphasis"
|
|
7
7
|
HEADER_CLASSES = "ks-stat-card-header flex items-start justify-between"
|
|
8
8
|
CARD_CLASSES = "ks-metric-card relative"
|
|
9
|
+
PLAIN_CLASSES = "ks-metric-plain relative"
|
|
9
10
|
LABEL_CLASSES = "ks-stat-card-label text-sm"
|
|
10
11
|
VALUE_BASE_CLASSES = "ks-stat-card-value text-3xl"
|
|
11
12
|
SUFFIX_CLASSES = "ks-stat-card-suffix text-lg"
|
|
@@ -13,6 +14,8 @@ module Keystone
|
|
|
13
14
|
CHANGE_ROW_CLASSES = "ks-stat-card-change h-5 text-sm"
|
|
14
15
|
VALUE_LINK_CLASSES = "hover:underline focus:outline-none focus-visible:underline"
|
|
15
16
|
INFO_BUTTON_CLASSES = "ks-stat-card-info peer shrink-0 transition"
|
|
17
|
+
NOTE_CLASSES = "ks-stat-card-note text-sm"
|
|
18
|
+
FALLBACK_CLASSES = "ks-stat-card-fallback"
|
|
16
19
|
|
|
17
20
|
INFO_ICON = <<~SVG.freeze
|
|
18
21
|
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>
|
|
@@ -26,10 +29,13 @@ module Keystone
|
|
|
26
29
|
info: "ks-tone-info"
|
|
27
30
|
}.freeze
|
|
28
31
|
|
|
29
|
-
attr_reader :label, :value, :suffix, :definition, :calculation, :change, :href
|
|
32
|
+
attr_reader :label, :value, :suffix, :definition, :calculation, :change, :href, :note
|
|
30
33
|
|
|
31
|
-
def initialize(label:, value:, variant: :neutral, suffix: nil, definition: nil, calculation: nil, change: nil, href: nil)
|
|
34
|
+
def initialize(label:, value:, variant: :neutral, suffix: nil, definition: nil, calculation: nil, change: nil, href: nil, note: nil, plain: false, fallback: nil)
|
|
32
35
|
@label = label
|
|
36
|
+
@fallback = fallback
|
|
37
|
+
@note = note
|
|
38
|
+
@plain = plain
|
|
33
39
|
@value = value
|
|
34
40
|
@variant = variant
|
|
35
41
|
@suffix = suffix
|
|
@@ -39,8 +45,16 @@ module Keystone
|
|
|
39
45
|
@href = href
|
|
40
46
|
end
|
|
41
47
|
|
|
48
|
+
def missing?
|
|
49
|
+
@value.to_s.empty? && !@fallback.nil?
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def fallback
|
|
53
|
+
@fallback
|
|
54
|
+
end
|
|
55
|
+
|
|
42
56
|
def classes
|
|
43
|
-
CARD_CLASSES
|
|
57
|
+
@plain ? PLAIN_CLASSES : CARD_CLASSES
|
|
44
58
|
end
|
|
45
59
|
|
|
46
60
|
def label_classes
|
data/lib/keystone_ui/version.rb
CHANGED
|
@@ -420,7 +420,7 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
420
420
|
|
|
421
421
|
10. Explain figures.
|
|
422
422
|
|
|
423
|
-
- `ui_stat_card(label:, value:, variant: :neutral, suffix: nil, definition: nil, calculation: nil, change: nil, href: nil)`
|
|
423
|
+
- `ui_stat_card(label:, value:, variant: :neutral, suffix: nil, definition: nil, calculation: nil, change: nil, href: nil, note: nil, plain: false, fallback: nil)`
|
|
424
424
|
— `variant:` is `:neutral` `:success` `:danger` `:warning` `:info` and
|
|
425
425
|
colours the value. `change:` is a signed number shown as `▲ 4.2%` in
|
|
426
426
|
green, `▼` in red, or plain at zero. `href:` links the value only, so
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: keystone_ui
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.49.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tyler Schneider
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - ">="
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 0.
|
|
18
|
+
version: 0.25.0
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - ">="
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: 0.
|
|
25
|
+
version: 0.25.0
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: view_component
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|