swedbank-pay-design-guide-jekyll-theme 2.8.2 → 2.8.3

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: bef43c1bda12a011153336c8c23e3b82fbd5a8cc9525f1e8973e475052cee712
4
- data.tar.gz: 374ea1214fde77125e260129aa954d13a052b8bdc64d99cc35620e2fad253578
3
+ metadata.gz: 73c12f72d4d055a93ee0a31230c3d2d6a15ac118d716ed65c80655be4ad0a594
4
+ data.tar.gz: da99ecee1b960f6afde03e07a00c43794867693404e86a8394c30acb92cfd765
5
5
  SHA512:
6
- metadata.gz: 9dedc80e83d9446d65f7352774bbeffbbfd7dc57ae5ef30a6c5d87ffcd84752cbe66307ede6a8264d7d5e9bf6ef2c8000489a4a0127aa2c6d2dcc136fd79fbff
7
- data.tar.gz: 8d545455cf8025a821628c6d91553bb44733bcc9bf627f4ed71abc2f578d306c213b16bd091fd00e7a14ef84e20d74493ecf7a1b34d1fab860b3c66944b385b2
6
+ metadata.gz: dfe4d4a396b8a700f58a6d16aa4fa4bfcdb22326bee7555b94c25643bf3a32f45ca935f33a9ea54369d6be7b2d7ef7e4182fb50c0d68aa0ed8d321a0e62ecd39
7
+ data.tar.gz: 4bffd2489e69690385049f07c6061b4cee4d8736269ebc3cc78b73715f36bc5f27cbba1409f0f9c7e55d58d290cc2607a0804185fefa002ea47fdf0862d1bd59
@@ -8,7 +8,7 @@ json: json content
8
8
  <p class="code-view-header">
9
9
  {{ include.title}}
10
10
  {% if include.json %}
11
- <button aria-describedby="tooltipCopy" class="code-view-copy tooltip" aria-label="Copy json to clipboard" value='{{include.json}}' onclick='javascript:navigator.clipboard.writeText(this.value)'><i class="at-clipboard small" aria-hidden="true"></i><div role="tooltip">Copy json to clipboard</div></button>
11
+ {% include copy-button.html content=include.json label="Copy json to clipboard" tooltip="Copy json to clipboard" %}
12
12
  {% endif %}
13
13
  </p>
14
14
  {% if include.header %}
@@ -0,0 +1,11 @@
1
+ {%- comment -%}
2
+ **Parameters
3
+ content: Content to copy to clipboard
4
+ label: Aria label text (optional, defaults to "Copy to clipboard")
5
+ tooltip: Tooltip text (optional, defaults to "Copy to clipboard")
6
+ {%- endcomment -%}
7
+
8
+ {%- assign buttonLabel = include.label | default: "Copy to clipboard" -%}
9
+ {%- assign buttonTooltip = include.tooltip | default: "Copy to clipboard" -%}
10
+
11
+ <button aria-describedby="tooltipCopy" class="code-view-copy tooltip" aria-label="{{ buttonLabel }}" value='{{include.content}}' onclick='javascript:navigator.clipboard.writeText(this.value)'><i class="at-clipboard small" aria-hidden="true"></i><div role="tooltip">{{ buttonTooltip }}</div></button>
@@ -115,6 +115,7 @@
115
115
  <script src="{{ design_guide_url }}/scripts/dg.js" global="true" autoload="true"></script>
116
116
  <script src="{{ '/assets/js/swedbank-pay-design-guide-theme.js' | relative_url }}"></script>
117
117
  <script src="{{ '/assets/js/cookie-consent.js' | relative_url }}"></script>
118
+ <script src="{{ '/assets/js/enable-code-copy-in-table.js' | relative_url }}"></script>
118
119
  {%- if site.google_analytics.tracking_id %}
119
120
  {% include google_analytics.html %}
120
121
  {%- endif %}
data/_sass/code-view.scss CHANGED
@@ -17,6 +17,12 @@
17
17
  text-decoration: none;
18
18
  }
19
19
 
20
+ .enable-code-copy .code-view-copy {
21
+ background-color: inherit;
22
+ color: inherit;
23
+ display: inline-flex;
24
+ }
25
+
20
26
  .code-view {
21
27
  .code-view-table {
22
28
  .code-view-code {
@@ -0,0 +1,40 @@
1
+ // Automatically add copy buttons to tables with 'enable-copy' class
2
+ // Adds a copy button next to every <code> element in the table
3
+ document.addEventListener('DOMContentLoaded', function() {
4
+ // Find all tables with class enable-copy
5
+ document.querySelectorAll('table.enable-code-copy').forEach(table => {
6
+ // Find all <code> elements in the table
7
+ const codeElements = table.querySelectorAll('td code');
8
+
9
+ codeElements.forEach(codeElement => {
10
+ const value = codeElement.textContent.trim();
11
+
12
+ // Create copy button matching copy-button.html component
13
+ const button = document.createElement('button');
14
+ button.setAttribute('aria-describedby', 'tooltipCopy');
15
+ button.className = 'code-view-copy tooltip';
16
+ button.setAttribute('aria-label', 'Copy to clipboard');
17
+ button.value = value;
18
+ button.onclick = function() {
19
+ navigator.clipboard.writeText(this.value);
20
+ };
21
+
22
+ const icon = document.createElement('i');
23
+ icon.className = 'at-clipboard small';
24
+ icon.setAttribute('aria-hidden', 'true');
25
+
26
+ const tooltip = document.createElement('div');
27
+ tooltip.setAttribute('role', 'tooltip');
28
+ tooltip.textContent = 'Copy to clipboard';
29
+
30
+ button.appendChild(icon);
31
+ button.appendChild(tooltip);
32
+
33
+ // Add button after the code element
34
+ const cell = codeElement.parentElement;
35
+ cell.style.whiteSpace = 'nowrap';
36
+ cell.appendChild(document.createTextNode(' '));
37
+ cell.appendChild(button);
38
+ });
39
+ });
40
+ });
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.8.2'
7
+ '2.8.3'
8
8
  end
9
9
  end
10
10
  end
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.8.2
4
+ version: 2.8.3
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-12-19 00:00:00.000000000 Z
11
+ date: 2026-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -402,6 +402,7 @@ files:
402
402
  - _includes/card-table.html
403
403
  - _includes/card.html
404
404
  - _includes/code-example.html
405
+ - _includes/copy-button.html
405
406
  - _includes/doc-container.html
406
407
  - _includes/example-1.md
407
408
  - _includes/example-2.md
@@ -463,6 +464,7 @@ files:
463
464
  - assets/img/flag-no.svg
464
465
  - assets/img/flag-se.svg
465
466
  - assets/js/cookie-consent.js
467
+ - assets/js/enable-code-copy-in-table.js
466
468
  - assets/js/mermaid.min.js
467
469
  - assets/js/swedbank-pay-design-guide-theme.js
468
470
  - assets/puml-theme-swedbankpay.puml