sdr_view_components 0.19.1 → 0.21.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: b7e98c7b84b43710c239985c71175d49be411cfd26f70cec388b2391893a798d
4
- data.tar.gz: ba602671e45720b1b3f5bbe57e6e50d2f50a251a1c081b053d6c72b7f835b52e
3
+ metadata.gz: 9de1e10f3e04a4a00b584e85fa5b06d862916a2e403e7ab3966020e04ec3deb0
4
+ data.tar.gz: 2df79a660409c1bed817b6823d81c6718d052026434611757f3883604b5d9411
5
5
  SHA512:
6
- metadata.gz: 96b5ab0fb01f11779ed608befef00b365cb34d20edbcf6e7ef7c872c3821c65094f5f16262faaf1823166be3af00ccc799c71877e6f195a396cc7d4dc589eb9b
7
- data.tar.gz: e185afc99b4e87a0ae7da054dbbcca27e25ab3afb138dc8ef60fbed2aecdde83874fb30bb04d6aa3fa6134921dd5e726b592ff9bb74cfe2cda60ed3980be2ddc
6
+ metadata.gz: 94cd03e80e3fdca7e03e83456141569c53d888ec7a3ace284a6a0a9ceca187ae76471b859d3d5d3696b6311dbaa603e70f0516d4173532565cfd2ea81c6b306b
7
+ data.tar.gz: 31b2838609b00ac1171421cf4481e82c6db92695309e38687cff917f2c585b983f60c2e7dda7500b496e31b38465e2c02f8f5876cb15480e983c8bdc30342e51
data/README.md CHANGED
@@ -19,7 +19,7 @@ gem 'sdr_view_components'
19
19
  This set of components relies on the component library stylesheets, add:
20
20
 
21
21
  ```
22
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/sul-dlss/component-library@v2025-09-11/styles/sul.css">
22
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/sul-dlss/component-library@v2026-09-28/styles/sul.css">
23
23
  <%= stylesheet_link_tag "sdr_view_components", "data-turbo-track": "reload" %>
24
24
  ```
25
25
 
@@ -287,7 +287,7 @@ The [component-library](https://github.com/sul-dlss/component-library/) version
287
287
  ```
288
288
  def initialize
289
289
  # Default URL for the component library assets
290
- @component_library_url = 'https://cdn.jsdelivr.net/gh/sul-dlss/component-library@v2026-01-27'
290
+ @component_library_url = 'https://cdn.jsdelivr.net/gh/sul-dlss/component-library@v2026-09-28'
291
291
  end
292
292
  ```
293
293
 
@@ -8,35 +8,10 @@
8
8
  font-size: 2.25rem;
9
9
  }
10
10
 
11
- /* Toggle */
12
- .btn-group-toggle label.btn {
13
- --bs-btn-focus-box-shadow: 0 0 0 0.25rem rgb(var(--bs-btn-focus-shadow-rgb), .5);
14
- }
15
-
16
- .btn-group-toggle input:checked + label {
17
- background-color: var(--bs-primary);
18
- border-color: var(--bs-primary);
19
- color: #fff;
20
- }
21
-
22
- .btn-group-toggle input:not(:checked) + label {
23
- background-color: transparent;
24
- border-color: var(--bs-primary);
25
- color: var(--bs-primary);
26
- }
27
-
28
- .btn-group-toggle .btn-check:checked + .btn {
29
- background-color: var(--stanford-digital-blue);
30
- border-color: var(--stanford-digital-blue);
31
- color: #fff;
32
- }
33
-
34
- .btn-group-toggle :not(.btn-check:checked) + .btn {
35
- color: var(--stanford-digital-blue);
36
- border-color: var(--stanford-digital-blue);
37
- }
38
-
39
- .btn-group-toggle input:checked + label::before {
11
+ /* Toggle: the component library's .toggle-radio styles, plus a checkmark on the selected option.
12
+ A toggle of links (e.g., for switching views) marks the selected link with .active in place of :checked. */
13
+ .toggle-radio .btn-check:checked + .btn::before,
14
+ .toggle-radio .btn.active::before {
40
15
  display: inline-block;
41
16
  margin-right: 3px;
42
17
  font-family: bootstrap-icons;
@@ -44,6 +19,17 @@
44
19
  content: "\F633";
45
20
  }
46
21
 
22
+ /* Bootstrap styles a hovered radio label (.btn-check + .btn:hover) but not a hovered link,
23
+ so keep a link's colors on hover and, like a checked option, leave the selected one un-underlined. */
24
+ .toggle-radio .btn-group a.btn {
25
+ --bs-btn-hover-bg: var(--bs-btn-bg);
26
+ --bs-btn-hover-color: var(--bs-btn-color);
27
+ }
28
+
29
+ .toggle-radio .btn-group .btn.active:hover {
30
+ --btn-hover-decoration: none;
31
+ }
32
+
47
33
  /* Icon buttons */
48
34
  .icon-button.btn {
49
35
  --bs-btn-bg: transparent;
@@ -19,6 +19,11 @@ module SdrViewComponents
19
19
  end
20
20
 
21
21
  attr_reader :form, :field_name
22
+
23
+ # toggle-radio applies the component library's toggle styles.
24
+ def container_classes
25
+ merge_classes('toggle-radio', super)
26
+ end
22
27
  end
23
28
  end
24
29
  end
@@ -18,8 +18,9 @@ module SdrViewComponents
18
18
 
19
19
  attr_reader :form, :field_name, :label, :value, :data
20
20
 
21
+ # The component library's toggle-radio styles round each option, so no rounding classes are added here.
21
22
  def label_classes
22
- merge_classes('btn', @position == :left ? 'rounded-start-pill' : 'rounded-end-pill')
23
+ 'btn'
23
24
  end
24
25
  end
25
26
  end
@@ -1,5 +1,5 @@
1
1
  <%= tag.div class: classes, data: do %>
2
- <div class="col-md-3">
2
+ <%= tag.div class: tabs_classes do %>
3
3
  <%= tag.div class: 'nav nav-pills d-flex flex-column rounded-top rounded-bottom', role: 'tablist navigation', 'aria-orientation': 'vertical', tabindex: '0' do %>
4
4
  <% tabs.each do |tab| %>
5
5
  <% tab.active_tab_name = active_tab_name %>
@@ -7,14 +7,14 @@
7
7
  <% end %>
8
8
  <% end %>
9
9
  <span class="required mt-2">* Required</span>
10
- </div>
11
- <div class="col-md-9">
10
+ <% end %>
11
+ <%= tag.div class: panes_classes do %>
12
12
  <div class="tab-content h-100">
13
13
  <% panes.each do |pane| %>
14
14
  <% pane.active_tab_name = active_tab_name if pane.respond_to?(:active_tab_name=) %>
15
15
  <%= pane %>
16
16
  <% end %>
17
17
  </div>
18
- </div>
18
+ <% end %>
19
19
  <span id="<%= invalid_description_id %>" class="visually-hidden" data-sdr-tab-error-target="invalidDescription">Error: required fields missing</span>
20
20
  <% end %>
@@ -15,15 +15,19 @@ module SdrViewComponents
15
15
  renders_many :tabs, SdrViewComponents::TabForm::TabComponent
16
16
  renders_many :panes, ->(pane) { pane }
17
17
 
18
- def initialize(id:, active_tab_name:, classes: [], data: {})
18
+ # @param tabs_classes [String] grid classes for the tabs column
19
+ # @param panes_classes [String] grid classes for the panes column
20
+ def initialize(id:, active_tab_name:, classes: [], data: {}, tabs_classes: 'col-md-3', panes_classes: 'col-md-9') # rubocop:disable Metrics/ParameterLists
19
21
  @id = id
20
22
  @active_tab_name = active_tab_name
21
23
  @classes = classes
22
24
  @data = data
25
+ @tabs_classes = tabs_classes
26
+ @panes_classes = panes_classes
23
27
  super()
24
28
  end
25
29
 
26
- attr_reader :id, :active_tab_name
30
+ attr_reader :id, :active_tab_name, :tabs_classes, :panes_classes
27
31
 
28
32
  def classes
29
33
  # Provides tab-error, tab-form as the static default classes
@@ -8,7 +8,7 @@ module SdrViewComponents
8
8
 
9
9
  def initialize
10
10
  # Default URL for the component library assets
11
- @component_library_url = 'https://cdn.jsdelivr.net/gh/sul-dlss/component-library@v2026-01-27'
11
+ @component_library_url = 'https://cdn.jsdelivr.net/gh/sul-dlss/component-library@v2026-09-28'
12
12
  end
13
13
  end
14
14
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SdrViewComponents
4
- VERSION = '0.19.1'
4
+ VERSION = '0.21.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sdr_view_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.1
4
+ version: 0.21.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Collier