keystone_ui 0.63.0 → 0.64.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: '0359f881db7160fc60d97b6496ecd4131d5450e7c66bfe1e0e94f9df35587a1d'
4
- data.tar.gz: 7eab7185a552a901d6f6858ee45d8b01f4ef06241b32f96f749953b8377a5aa1
3
+ metadata.gz: 744bf4d22f2232143e06b059582c78d97ba484510dbc06018efa4fdc8572010c
4
+ data.tar.gz: d91373a2339d58d2ec5cb3c134df11e9afe3614c4e8ddf189655beb2cd977d13
5
5
  SHA512:
6
- metadata.gz: 1e99aa1db1e7b14f3f1037223faec2577ced190386f0262336c279865026cc8d5598d6f58e36e00cf6d18ec80146efce621824d1e52c3bb8cc1be8f8abcc4e32
7
- data.tar.gz: 4cc34ebcc7c2a81b5433029becd7e6568c4480cede78661843a78f62da45f861d50bb6f5f3379e402f530a2bbe4adfd34ad7f6304c2e8514c346a2a44adbf5cd
6
+ metadata.gz: 991fc930a1fca362dbf3d4cf16ef19af55fe153f62017d95ada5e759f32b92b3ac17c220946fb7cad6e6d09e0910b309347d8681a9b950a7cf6067d6f21836a8
7
+ data.tar.gz: 49118580077c31a9fc48175381975322c03ed2e00d921288fbab589267a5d4a5179fae945c025412f7e7fed50679d5ee0efb28223e52a5122ffdbb4683723b14
@@ -1,4 +1,9 @@
1
1
  <a href="<%= @href %>" class="<%= item_classes %>">
2
- <%= @icon.html_safe %>
2
+ <span class="<%= ICON_CLASSES %>">
3
+ <%= @icon.html_safe %>
4
+ <% if counted? %>
5
+ <span class="<%= COUNT_CLASSES %>"><%= render count_badge %></span>
6
+ <% end %>
7
+ </span>
3
8
  <span class="<%= LABEL_CLASSES %>"><%= @label %></span>
4
9
  </a>
@@ -5,20 +5,31 @@ module Keystone
5
5
  class BottomNavItemComponent < ViewComponent::Base
6
6
  attr_reader :label, :href, :icon
7
7
 
8
- def initialize(label:, href:, icon:, active: false)
8
+ def initialize(label:, href:, icon:, active: false, count: nil)
9
9
  @label = label
10
10
  @href = href
11
11
  @icon = icon
12
12
  @active = active
13
+ @count = count
13
14
  end
14
15
 
15
16
  ITEM_BASE = "ks-bottom-nav-item"
16
17
  ACTIVE_CLASS = "active"
17
18
  LABEL_CLASSES = "ks-bottom-nav-label"
19
+ ICON_CLASSES = "relative"
20
+ COUNT_CLASSES = "absolute -top-2 -right-3"
18
21
 
19
22
  def item_classes
20
23
  @active ? "#{ITEM_BASE} #{ACTIVE_CLASS}" : ITEM_BASE
21
24
  end
25
+
26
+ def counted?
27
+ @count.to_i.positive?
28
+ end
29
+
30
+ def count_badge
31
+ BadgeComponent.new(label: @count.to_s, variant: :info)
32
+ end
22
33
  end
23
34
  end
24
35
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KeystoneUi
4
- VERSION = "0.63.0"
4
+ VERSION = "0.64.0"
5
5
  end
@@ -256,8 +256,9 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
256
256
  `ui_nav_dropdown(title:, area:, active: false)` takes a block holding the
257
257
  menu links.
258
258
  - `ui_bottom_nav` takes no keywords and a block of
259
- `ui_bottom_nav_item(label:, href:, icon:, active: false)` calls, where
260
- `icon:` is a raw SVG string. The bar is hidden from `lg:` up and inside a
259
+ `ui_bottom_nav_item(label:, href:, icon:, active: false, count: nil)` calls,
260
+ where `icon:` is a raw SVG string and `count:` above zero shows in a badge
261
+ over the icon. The bar is hidden from `lg:` up and inside a
261
262
  Hotwire Native web view.
262
263
  - `ui_mobile_header(title:, back_url:, subtitle: nil)` is hidden from `lg:`
263
264
  up and goes in the navbar's `mobile_left` slot. `back_url:` must be
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.63.0
4
+ version: 0.64.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Schneider