keystone_ui 0.47.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: 20f1ebc15a9b1a15a854e634286e510b9b224167f3f56181ab756744afaa3f44
4
- data.tar.gz: a53452a7e08710ca4659937d39bb6d7384f84daa768f6d8afda29c330677a4a3
3
+ metadata.gz: c5188a7128c83107e3bb691fbbeb68733c14ff424e97bbbceea5cb4f901409a9
4
+ data.tar.gz: 897711fad313df1fad9c2d2f2d29fc881c7b26a66c59028842c18816b9fdd364
5
5
  SHA512:
6
- metadata.gz: 96a47743d927612dbc8cbed5b0ab0f12c8c34ae1df1555377613b1b33962b5a8ab15732e72983879724f03c18d79da3aec22d9973bc3b8a8396b9306b8f671dc
7
- data.tar.gz: 7a0a0e1d2910d253f1f424e65082cd63c3bd40e4b3dbf83cdc67186bfbff72e9116c4c8d4b548bfddf5c59a5ee8b6ceb18051f0a8489e3592a12bb95f2460db5
6
+ metadata.gz: 0ddc36bc018b6ebbd5be50aa7413eaddbc5380598ed7e0af989f3d241bf3522785c8def0d00aaf75b4dc733b45fbe37f18a13860570fcff137604d7f60b521cd
7
+ data.tar.gz: f95983f302a7fc742e5962b4477b3c21429b93cd9a1a2561390fdc33482483a6f1f68eb661770f9a9cd0cb63b592febd444f18bbce19eb886c4a526a5b9297a9
@@ -3,7 +3,7 @@
3
3
  module Keystone
4
4
  module Ui
5
5
  class BottomNavComponent < ViewComponent::Base
6
- NAV_CLASSES = "ks-bottom-nav lg:hidden hotwire-native:hidden"
6
+ NAV_CLASSES = "ks-bottom-nav lg:hidden hotwire-native:hidden print:hidden"
7
7
 
8
8
  def nav_classes
9
9
  NAV_CLASSES
@@ -3,7 +3,7 @@
3
3
  module Keystone
4
4
  module Ui
5
5
  class BreadcrumbsComponent < ViewComponent::Base
6
- CLASSES = "ks-mobile-header-back ks-breadcrumbs hidden lg:block text-sm"
6
+ CLASSES = "ks-mobile-header-back ks-breadcrumbs hidden lg:block text-sm print:hidden"
7
7
  SEPARATOR = "›"
8
8
 
9
9
  def initialize(trail:, current: nil)
@@ -3,7 +3,7 @@
3
3
  module Keystone
4
4
  module Ui
5
5
  class DesktopBackLinkComponent < ViewComponent::Base
6
- CLASSES = "ks-mobile-header-back ks-page-back hidden lg:inline-flex items-center"
6
+ CLASSES = "ks-mobile-header-back ks-page-back hidden lg:inline-flex items-center print:hidden"
7
7
  LABEL = "Back"
8
8
 
9
9
  def initialize(url:)
@@ -9,7 +9,7 @@ module Keystone
9
9
  </svg>
10
10
  SVG
11
11
 
12
- WRAPPER_CLASSES = "relative lg:hidden"
12
+ WRAPPER_CLASSES = "relative lg:hidden print:hidden"
13
13
  BUTTON_CLASSES = "ks-action-menu-button"
14
14
  DROPDOWN_CLASSES = "ks-action-menu hidden absolute right-0 z-50 w-48 origin-top-right"
15
15
 
@@ -15,7 +15,7 @@ module Keystone
15
15
  </svg>
16
16
  SVG
17
17
 
18
- WRAPPER_CLASSES = "lg:hidden"
18
+ WRAPPER_CLASSES = "lg:hidden print:hidden"
19
19
  BACK_LINK_CLASSES = "ks-mobile-header-back"
20
20
  TITLE_CLASSES = "ks-mobile-header-title absolute left-1/2 -translate-x-1/2 lg:hidden truncate max-w-[60%]"
21
21
  SUBTITLE_CLASSES = "ks-mobile-header-subtitle block text-xs truncate text-center"
@@ -3,7 +3,7 @@
3
3
  module Keystone
4
4
  module Ui
5
5
  class NavbarComponent < ViewComponent::Base
6
- NAV_BASE = "top-nav"
6
+ NAV_BASE = "top-nav print:hidden"
7
7
  NAV_STICKY = "sticky top-0 z-40"
8
8
  MOBILE_LEFT_CLASSES = "lg:hidden flex items-center"
9
9
  LOGO_CLASSES = "logo"
@@ -5,9 +5,9 @@ require "keystone_ui/visible_navigation"
5
5
  module Keystone
6
6
  module Ui
7
7
  class NavigationComponent < ViewComponent::Base
8
- TOP_BAR_CLASSES = "hidden lg:block sticky top-0 z-40"
8
+ TOP_BAR_CLASSES = "hidden lg:block sticky top-0 z-40 print:hidden"
9
9
  SIDEBAR_ROW_CLASSES = "lg:flex"
10
- SIDEBAR_CLASSES = "ks-sidebar hidden lg:flex lg:sticky lg:top-0 lg:h-screen shrink-0 overflow-y-auto"
10
+ SIDEBAR_CLASSES = "ks-sidebar hidden lg:flex lg:sticky lg:top-0 lg:h-screen shrink-0 overflow-y-auto print:hidden"
11
11
  SIDEBAR_LOGO_CLASSES = "ks-sidebar-logo"
12
12
  SIDEBAR_GROUP_CLASSES = "flex flex-col"
13
13
  SIDEBAR_GROUP_LABEL_CLASSES = "ks-sidebar-group-label"
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KeystoneUi
4
- VERSION = "0.47.0"
4
+ VERSION = "0.49.0"
5
5
  end
@@ -198,6 +198,9 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
198
198
 
199
199
  5. Wire navigation in the layout.
200
200
 
201
+ Every navigation component is left off a printed page, so a printed page or
202
+ a PDF holds only the page's content.
203
+
201
204
  - `ui_navigation` takes no keywords and a block holding the page content, so
202
205
  it goes around `yield`. It draws the tabs the app declares with
203
206
  `config.navigation_group` as a top bar of menus from `lg:` up, then the
@@ -417,7 +420,7 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
417
420
 
418
421
  10. Explain figures.
419
422
 
420
- - `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)`
421
424
  — `variant:` is `:neutral` `:success` `:danger` `:warning` `:info` and
422
425
  colours the value. `change:` is a signed number shown as `▲ 4.2%` in
423
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.47.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.22.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.22.0
25
+ version: 0.25.0
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: view_component
28
28
  requirement: !ruby/object:Gem::Requirement