keystone_ui 0.65.0 → 0.67.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: 1b6aa8d9a69506d5756e9c9dcd36da98466f4c6a2bcbb9dd6b978fbf8c0bf8c3
4
- data.tar.gz: 771d2441ab01b1ebfa9cc42c757bc9512aaa20a92e1c618361ff445c5b83d0c3
3
+ metadata.gz: e4db5d4f9a772d0b8370d841b7c8a294e5be90cfa2d3264d99e9d1c25ed2ebd7
4
+ data.tar.gz: 53019277eb7eb6f1d7f55964e70790fb6742739e4e525709a61b0e7fc001bd87
5
5
  SHA512:
6
- metadata.gz: deb285b833d1035d6657ec2ad10e506162cc8d67f4047969f21ccd1a19a32f6ad10a5627a974d485969fb7ec1fb901adcecac56e366c74b06732540710dd6c44
7
- data.tar.gz: 10f7e10e713bd6d4bd6ab5032283d7040d11beaf6fa5f52c7928abd67ecb6f74847ca5c9d7e63ffbdbd5c5bb909ec0e25f382397e952f15a2932a82cd2ead35e
6
+ metadata.gz: cf6f54d40679fef624f92677ea73a6a7d1e971e4862d7fe4a143c2ea3e719b2308cc53f3254791dbf433c24b80294e37c589cc69903579f31a7a8e6069835365
7
+ data.tar.gz: 26d67e1aca96aae7cc79faddc7476a6198007a96419a08c8b10cf2a7c1ea522af7d8220ca9920f6cd36165a84c6e911fc73c5596e023739e6aca8359e640371a
@@ -1,3 +1,4 @@
1
+ <% content_for :mobile_page_title, @title %>
1
2
  <% if action_url %>
2
3
  <% content_for :mobile_action_url, action_url %>
3
4
  <% content_for :mobile_action_label, action_label %>
@@ -1,3 +1,11 @@
1
+ <% if link_tabs? %>
2
+ <nav class="<%= classes %>">
3
+ <% tabs.each do |tab| %>
4
+ <a href="<%= tab[:href] %>" data-turbo-action="replace" class="<%= tab[:current] ? tab_classes : TAB_BASE_CLASSES %>"<% if tab[:current] %> aria-current="page" data-active<% end %>><%= tab[:label] %></a>
5
+ <% end %>
6
+ </nav>
7
+ <%= content %>
8
+ <% else %>
1
9
  <div data-controller="tab-switcher">
2
10
  <div class="<%= classes %>">
3
11
  <% tabs.each_with_index do |tab, index| %>
@@ -12,3 +20,4 @@
12
20
  </div>
13
21
  <%= content %>
14
22
  </div>
23
+ <% end %>
@@ -13,6 +13,10 @@ module Keystone
13
13
  @tabs = tabs
14
14
  end
15
15
 
16
+ def link_tabs?
17
+ tabs.any? && tabs.all?(Hash)
18
+ end
19
+
16
20
  def classes
17
21
  TAB_BAR_CLASSES
18
22
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KeystoneUi
4
- VERSION = "0.65.0"
4
+ VERSION = "0.67.0"
5
5
  end
@@ -629,6 +629,12 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
629
629
  rendered below the tabs. The first tab is active on load, and a click
630
630
  sends a `tab-switcher:change` event with the clicked index. Showing and
631
631
  hiding the panels is the app's code.
632
+ - `ui_tab_switcher(tabs:)` also takes link tabs, an array of hashes
633
+ `{ label:, href:, current: }`. Each is drawn as a link to its `href`, the
634
+ one with `current: true` is drawn active with `aria-current="page"`, and
635
+ following a tab is a Turbo visit that replaces the history entry. The
636
+ app reads the chosen tab from its params and draws only that tab's
637
+ content in the block.
632
638
  - `ui_swipe_deck(items:, empty_title: "All done!", empty_subtitle: nil)`
633
639
  takes a block yielding the deck, where `deck.item { |item| ... }` renders
634
640
  one card's face. Accepting sends a bubbling `swipe-deck:complete` event
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.65.0
4
+ version: 0.67.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Schneider