swedbank-pay-design-guide-jekyll-theme 2.5.5 → 2.6.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: 7efc8ed7b9bd61eaf3288c2a4a4e4d23c7f01fd631ef8946ba2d75e4ced2053a
4
- data.tar.gz: 88fe0fa979eb17b6cb91d827808f5552bb5408fd6eb7bc681ccb91cdf92209ed
3
+ metadata.gz: 5f064c159a68f7f5ad682ffc591d3f2bb7bac1fd8fa59eec465307b87fe6544a
4
+ data.tar.gz: e6214d9121ffbacd0723992c3dcbc3c7181c3e4e04c589f8e34b69592dea3057
5
5
  SHA512:
6
- metadata.gz: 2af7a399665ee6e819387dd0b283b655c1a03dbb61c4a03e8c9856c6074c2115283d520f100b63f4f1a85a2763a497a226ec19c2c1a77004290937f051945ba7
7
- data.tar.gz: 76ed7dd05bae395cded6af01da6309f9fda44cfbfae6574ba627b87a96d90fe94d47e99197748e5634cc934543e5a04e98b2b09b1652fe769f32b92d117ad97c
6
+ metadata.gz: 1d0a28aef9616de7940d184f845b6af4e99741d57a6397724a75ccbb0d0908160512699b61a68c35acf6b31ead7af147cea52e921c3e846759771dafb2888945
7
+ data.tar.gz: de9915b0c2305b9b49d8c80129339e38ecae283e84ba7b13efae52344b0920c61144659aab5786001cee2ddc793b0dad4a3429c9cdb7bf8e884c5efa708a2080
@@ -16,6 +16,7 @@ Original creator: https://sebnitu.com/2016/10/13/dynamic-menus-in-jekyll/
16
16
  placeholder="Search..." autocomplete="off" pattern=".{3,}"
17
17
  title="At least 3 characters">
18
18
  </form>
19
+ <p id="search-hint-text" class="hint-text">Tip: Try using quotes for more precise results.</p>
19
20
  {% endif %}
20
21
 
21
22
  <ul class="main-nav-ul">
@@ -26,6 +26,4 @@
26
26
  <p>{{ description | markdownify }}</p>
27
27
  {% endif %}
28
28
  </div>
29
-
30
- {% include github.html %}
31
29
  </div>
@@ -72,8 +72,8 @@
72
72
  </a>
73
73
  </header>
74
74
  <div class="documentation">
75
- <div class="form-group search-box search-expander">
76
- {% if site.search.enabled == true %}
75
+ <div id="search-box-container" class="form-group search-box search-expander">
76
+ {% if site.search.enabled == true and page.name != "search.md" %}
77
77
  <form class="search d-flex"
78
78
  method="get" action="{{ site.search.url | relative_url }}">
79
79
  <input name="q" type="text" id="tipue_search_input"
@@ -87,6 +87,7 @@
87
87
  <i class="material-icons-outlined" aria-hidden="true">search</i>
88
88
  </button>
89
89
  </form>
90
+ <p id="search-hint-text" class="hint-text">Tip: Try using quotes for more precise results.</p>
90
91
  {% endif %}
91
92
  </div>
92
93
  <div class="d-md-flex">
data/_layouts/search.html CHANGED
@@ -1,5 +1,23 @@
1
1
  ---
2
2
  layout: default
3
3
  ---
4
+ <form class="search d-flex" method="get" action="{{ site.search.url | relative_url }}">
5
+ <input name="q" type="text" id="tipue_search_input" class="form-control search-input"
6
+ placeholder="Search in documentation" onfocus="this.placeholder=''"
7
+ onblur="this.placeholder='Search in documentation'" pattern=".{3,}" title="At least 3 characters">
8
+ <script>
9
+ (function() {
10
+ var params = new URLSearchParams(window.location.search);
11
+ var q = params.get('q');
12
+ if (q) {
13
+ document.getElementById('tipue_search_input').value = q;
14
+ }
15
+ })();
16
+ </script>
17
+ <button id="search-btn" class="btn btn-primary btn-icon-lg" type="submit" aria-label="Search button">
18
+ <i class="material-icons-outlined" aria-hidden="true">search</i>
19
+ </button>
20
+ </form>
21
+ <p id="search-hint-text" class="hint-text mb-5">Tip: Try using quotes for more precise results. Ex: "online payments"</p>
4
22
 
5
- <div id="tipue_search_content"></div>
23
+ <div id="tipue_search_content"></div>
@@ -27,7 +27,7 @@ img {
27
27
  padding-left: 0;
28
28
  }
29
29
 
30
- .cards:has(.cards-cta){
30
+ .cards:has(.cards-cta) {
31
31
  min-width: 100% !important;
32
32
  }
33
33
 
@@ -442,43 +442,51 @@ body {
442
442
  }
443
443
  }
444
444
 
445
+ #search-btn {
446
+ height: 56px;
447
+ border-top-left-radius: 0;
448
+ border-bottom-left-radius: 0;
449
+ }
450
+
451
+ .search-input {
452
+ border-top-right-radius: 0;
453
+ border-bottom-right-radius: 0;
454
+ }
455
+
445
456
  .search-box {
446
457
  position: absolute;
447
- right: 8rem;
448
- top: 1.5rem;
458
+ right: 1rem;
459
+ top: 1rem;
449
460
  z-index: 2;
450
461
 
451
-
452
- .search-input {
453
- border-top-right-radius: 0;
454
- border-bottom-right-radius: 0;
455
- }
456
-
457
- #search-btn {
458
- border-top-left-radius: 0;
459
- border-bottom-left-radius: 0;
460
- height: 56px;
461
- }
462
-
463
462
  @media screen and (max-width: $breakpoint-lg) {
464
463
  position: fixed;
465
464
  right: 1rem;
466
465
  top: 1rem;
467
466
  z-index: 401;
468
467
 
469
- #tipue_search_input {
470
- display: none;
471
- }
472
-
473
468
  #search-btn {
474
469
  border-top-left-radius: 8px;
475
470
  border-top-left-radius: var(--border-radius);
476
471
  border-bottom-left-radius: 8px;
477
472
  border-bottom-left-radius: var(--border-radius);
478
473
  }
474
+
475
+ #tipue_search_input,
476
+ #search-hint-text {
477
+ display: none;
478
+ }
479
+
480
+ #search-box-container {
481
+ max-width: 54px;
482
+ }
479
483
  }
480
484
  }
481
485
 
486
+ .light {
487
+ color: white !important;
488
+ }
489
+
482
490
  .topbar-logo {
483
491
  @media screen and (max-width: $breakpoint-sm) {
484
492
  display: block;
@@ -7,7 +7,7 @@
7
7
 
8
8
  .title-header-container {
9
9
  width: 100%;
10
- padding: 3rem 1rem;
10
+ padding: 4rem 1rem;
11
11
 
12
12
  h1,
13
13
  h4,
@@ -96,7 +96,7 @@
96
96
 
97
97
  // Simple sidebar functionality while dg.js is being loaded
98
98
 
99
- function _handleSimpleSidebar (e) {
99
+ function _handleSimpleSidebar(e) {
100
100
  const target = e.target.parentElement.parentElement;
101
101
 
102
102
  if (target.tagName === "LI") {
@@ -121,7 +121,7 @@ function _handleSimpleSidebar (e) {
121
121
 
122
122
  // Remove simple sidebar functionality when proper sidebar functionality is loaded
123
123
  (function () {
124
- document.addEventListener("DOMContentLoaded", function(e) {
124
+ document.addEventListener("DOMContentLoaded", function (e) {
125
125
  const sidebar = document.querySelector(".sidebar");
126
126
 
127
127
  sidebar.removeEventListener("click", _handleSimpleSidebar);
@@ -131,7 +131,7 @@ function _handleSimpleSidebar (e) {
131
131
 
132
132
  // Override the topbar click to show and hide our own sidebar
133
133
  (function () {
134
- const isLeaf = function(currentUrl) {
134
+ const isLeaf = function (currentUrl) {
135
135
  const path = window.location.pathname;
136
136
  const href = currentUrl || window.location.href;
137
137
  const pathIndex = href.indexOf(path);
@@ -142,11 +142,11 @@ function _handleSimpleSidebar (e) {
142
142
  : false;
143
143
  };
144
144
 
145
- const isHome = function() {
145
+ const isHome = function () {
146
146
  return window.location.pathname === "/";
147
147
  };
148
148
 
149
- const controlVisibility = function(currentUrl) {
149
+ const controlVisibility = function (currentUrl) {
150
150
  const sidebar = document.querySelector(".sidebar");
151
151
  const overlay = document.querySelector("#overlay");
152
152
  const topbarButton = document.querySelector(".topbar-btn");
@@ -158,12 +158,10 @@ function _handleSimpleSidebar (e) {
158
158
  overlay.style.display = "none";
159
159
  topbarButton.style.display = "flex";
160
160
  topbarClose.style.display = "none";
161
- } else {
162
- sidebar.classList.add("visible");
163
161
  }
164
162
  };
165
163
 
166
- document.addEventListener("DOMContentLoaded", function() {
164
+ document.addEventListener("DOMContentLoaded", function () {
167
165
  const topbarButton = document.querySelector(".topbar-btn");
168
166
  const newTopbarButton = topbarButton.cloneNode(true);
169
167
  const sidebar = document.querySelector(".sidebar");
@@ -179,7 +177,7 @@ function _handleSimpleSidebar (e) {
179
177
  overlay.style.display = "block";
180
178
  }
181
179
 
182
- newTopbarButton.addEventListener("click", function(e) {
180
+ newTopbarButton.addEventListener("click", function (e) {
183
181
  if (sidebar.classList.contains("visible")) {
184
182
  sidebar.classList.remove("visible");
185
183
  newTopbarButton.style.display = "flex";
@@ -194,7 +192,7 @@ function _handleSimpleSidebar (e) {
194
192
  }
195
193
  });
196
194
 
197
- topbarClose.addEventListener("click", function(e) {
195
+ topbarClose.addEventListener("click", function (e) {
198
196
  if (sidebar.classList.contains("visible")) {
199
197
  sidebar.classList.remove("visible");
200
198
  newTopbarButton.style.display = "flex";
@@ -208,7 +206,7 @@ function _handleSimpleSidebar (e) {
208
206
  }
209
207
  });
210
208
 
211
- overlay.addEventListener("click", function(e) {
209
+ overlay.addEventListener("click", function (e) {
212
210
  if (sidebar.classList.contains("visible")) {
213
211
  sidebar.classList.remove("visible");
214
212
  newTopbarButton.style.display = "flex";
@@ -217,15 +215,15 @@ function _handleSimpleSidebar (e) {
217
215
  }
218
216
  });
219
217
 
220
- document.querySelectorAll(".nav-leaf a").forEach(function(a) {
221
- a.addEventListener("click", function(e) {
218
+ document.querySelectorAll(".nav-leaf a").forEach(function (a) {
219
+ a.addEventListener("click", function (e) {
222
220
  controlVisibility(e.target.href);
223
221
  });
224
222
  });
225
223
 
226
224
  topbarButton.parentNode.replaceChild(newTopbarButton, topbarButton);
227
225
 
228
- searchButton.addEventListener("click", function(e) {
226
+ searchButton.addEventListener("click", function (e) {
229
227
  const searchInput = document.querySelector(".search-input");
230
228
  const searchBtn = document.querySelector("#search-btn");
231
229
  return false;
@@ -233,9 +231,60 @@ function _handleSimpleSidebar (e) {
233
231
  });
234
232
  })();
235
233
 
234
+ //set SearchHintText color depending on background
235
+ (function () {
236
+ document.addEventListener("DOMContentLoaded", function () {
237
+ const searchHintTexts = document.querySelectorAll("#search-hint-text");
238
+ let visibleSearchHintText = null;
239
+ searchHintTexts.forEach(function (el) {
240
+ if (el.offsetParent !== null) { // visible in DOM
241
+ visibleSearchHintText = el;
242
+ }
243
+ });
244
+ if (visibleSearchHintText) {
245
+ let parentElement = visibleSearchHintText.parentElement;
246
+ let siblingWithTitleHeader = null;
247
+ if (parentElement && parentElement.nextElementSibling) {
248
+ siblingWithTitleHeader = parentElement.nextElementSibling.querySelector(".title-header");
249
+ }
250
+
251
+ let bgColor = "white";
252
+
253
+ if (siblingWithTitleHeader) {
254
+ bgColor = window.getComputedStyle(siblingWithTitleHeader).backgroundColor;
255
+ }
256
+
257
+ // Check for fully transparent background
258
+ const isTransparent = bgColor === "transparent" || /^rgba\(\s*\d+,\s*\d+,\s*\d+,\s*0\s*\)$/.test(bgColor);
259
+
260
+ // Function to calculate luminance
261
+ function getLuminance(rgb) {
262
+ const match = rgb.match(/\d+/g);
263
+ if (!match) return 1; // fallback to white
264
+ // Convert to sRGB
265
+ let [r, g, b] = match.map(Number).map(v => v / 255);
266
+ [r, g, b] = [r, g, b].map(c => {
267
+ return c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
268
+ });
269
+ return 0.2126 * r + 0.7152 * g + 0.0722 * b;
270
+ }
271
+
272
+ let luminance = 1; // default to high luminance
273
+ if (!isTransparent) {
274
+ luminance = getLuminance(bgColor);
275
+ }
276
+
277
+ // Set color: dark text on light bg, light text on dark bg
278
+ if (luminance > 0.5)
279
+ visibleSearchHintText.classList.remove("light");
280
+ else
281
+ visibleSearchHintText.classList.add("light");
282
+ }
283
+ });
284
+ })();
236
285
 
237
286
  // Initialize Tipue search
238
- (function() {
287
+ (function () {
239
288
  $(document).ready(function () {
240
289
  $("#tipue_search_input").tipuesearch();
241
290
  });
data/lib/gem_version.rb CHANGED
@@ -4,7 +4,7 @@ module Gem
4
4
  # Gem Specification
5
5
  class Specification
6
6
  def self.gem_version
7
- '2.5.5'
7
+ '2.6.0'
8
8
  end
9
9
  end
10
10
  end
@@ -65,9 +65,9 @@ module SwedbankPay
65
65
  end
66
66
 
67
67
  def change_root_class(current_page)
68
- return if current_page.path != '/'
69
-
70
- # On 'home', set the 'class' to 'sidebar dg-sidebar' to effectively remove 'has-secondary-nav'.
68
+ return unless current_page.path == '/search/' || current_page.path == '/'
69
+
70
+ # On 'home' or 'search', set the 'class' to 'sidebar dg-sidebar' to effectively remove 'has-secondary-nav'.
71
71
  current_page.doc.xpath('//*[@id="dg-sidebar"]').first.set_attribute('class', 'sidebar dg-sidebar')
72
72
  end
73
73
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swedbank-pay-design-guide-jekyll-theme
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.5
4
+ version: 2.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Swedbank Pay
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-06-10 00:00:00.000000000 Z
11
+ date: 2025-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday