polaris_view_helpers 1.2.6 → 1.2.8

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: 46cd622157363c15517ca72ff25f31f0b8e367eb4361731f0c44986b7ac2c8e3
4
- data.tar.gz: 025d9ed58d39159178756d5782168d08f47b971476deb833140d4ac22aaca0c8
3
+ metadata.gz: 6b79e57706ef11800c0d27dcc55d59af042681c0596a7d25afc6bfebe85cd842
4
+ data.tar.gz: 89f83a5f90afa5dab5ef5c0034f4662a18e6db3027fe3d6d752ebe5e9e1939fb
5
5
  SHA512:
6
- metadata.gz: db32e6f2701c228dfc9cfd40c2a48e3b0df61cf857c1d0194f084ad6dd003617853a49d5699e33f187fb49305f1804622b358c2dae665c525438d2d24280023a
7
- data.tar.gz: d047d380428ab62c1346c8e0e929b64b6dc8aae2984cb2678babaa30dd6647b8f33698cc4b62f1f0a47514aafe8caf4a02abce73023d7ef3b0612939026904c8
6
+ metadata.gz: 98fb1faf0e7a6a00b50627e840140e913816e22c7acdc202e67ee60b421eef71eb7e99338c05e99cc36fe8a752cc7c7b057aa9679d9f80b5e5023c10e6f3e57f
7
+ data.tar.gz: 4dc81872f466b23bddff1a906fd6e3edf186cd21d3fe88dd0f0df2c9f1263485cada0fd28f3e9a96c43bab902f6023c3c3c1eea5c5c3b6c095ddf7506b0bb326
@@ -1,4 +1,4 @@
1
- <div class="Polaris-Card">
1
+ <div class="Polaris-Card <%= extra_class %>">
2
2
  <% if heading.present? %>
3
3
  <div class="Polaris-Card__Header">
4
4
  <h2 class="Polaris-Heading"><%= heading %></h2>
@@ -0,0 +1,5 @@
1
+ <span class="Polaris-Icon">
2
+ <span class="Polaris-Text--root Polaris-Text--bodySm Polaris-Text--regular Polaris-Text--visuallyHidden">
3
+ </span>
4
+ <%= pvh_svg name %>
5
+ </span>
@@ -5,6 +5,8 @@
5
5
  <li><%= message %></li>
6
6
  <% end %>
7
7
  </ul>
8
+
9
+ <%= capture(&block) %>
8
10
  <% end %>
9
11
  <p>&nbsp;</p>
10
12
  <% end %>
@@ -0,0 +1,7 @@
1
+ <span class="Polaris-Icon Polaris-Icon--colorHighlight Polaris-Icon--applyColor">
2
+ <span class="Polaris-VisuallyHidden"></span>
3
+ <svg viewBox="0 0 20 20" class="Polaris-Icon__Svg" focusable="false" aria-hidden="true">
4
+ <path fill-rule="evenodd" d="M10 20c5.514 0 10-4.486 10-10s-4.486-10-10-10-10 4.486-10 10 4.486 10 10 10zm1-6a1 1 0 1 1-2 0v-4a1 1 0 1 1 2 0v4zm-1-9a1 1 0 1 0 0 2 1 1 0 0 0 0-2z">
5
+ </path>
6
+ </svg>
7
+ </span>
@@ -0,0 +1,3 @@
1
+ <svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" class="Polaris-Icon__Svg" focusable="false" aria-hidden="true">
2
+ <path fill-rule="evenodd" d="M0 10a10 10 0 1020 0 10 10 0 00-20 0zm15.2-1.8a1 1 0 00-1.4-1.4L9 11.6 6.7 9.3a1 1 0 00-1.4 1.4l3 3c.4.4 1 .4 1.4 0l5.5-5.5z" fill="#5C5F62"/>
3
+ </svg>
@@ -14,6 +14,22 @@ module PolarisViewHelpers
14
14
  "pri-#{SecureRandom.hex(8)}"
15
15
  end
16
16
 
17
+ def polaris_icon(name = 'CircleTickMajor')
18
+ render(
19
+ partial: 'polaris/icon',
20
+ locals: {
21
+ name: name,
22
+ }
23
+ )
24
+ end
25
+
26
+ def pvh_svg(name)
27
+ our_path = File.dirname(__FILE__)
28
+ file_path = File.join(our_path, "..", "..", "app/views/polaris/icons/#{name}.svg")
29
+ return File.read(file_path).html_safe if File.exists?(file_path)
30
+ "(#{name} not found)"
31
+ end
32
+
17
33
  def polaris_choice_list(form:, attribute:, title:, selected:, choices:, data: nil)
18
34
  render(
19
35
  partial: 'polaris/choice_list',
@@ -70,8 +86,10 @@ module PolarisViewHelpers
70
86
  )
71
87
  end
72
88
 
73
- def polaris_layout_section(secondary: false, &block)
89
+ def polaris_layout_section(secondary: false, one_half: false, &block)
74
90
  extra_class = secondary ? "Polaris-Layout__Section--secondary" : ""
91
+ extra_class += " "
92
+ extra_class += one_half ? "Polaris-Layout__Section--oneHalf" : ""
75
93
  render(
76
94
  partial: 'polaris/layout_section',
77
95
  locals: { block: block, extra_class: extra_class }
@@ -168,10 +186,10 @@ module PolarisViewHelpers
168
186
  )
169
187
  end
170
188
 
171
- def polaris_model_errors model
189
+ def polaris_model_errors model, &block
172
190
  render(
173
191
  partial: 'polaris/model_errors',
174
- locals: { model: model }
192
+ locals: { model: model, block: block }
175
193
  )
176
194
  end
177
195
 
@@ -346,10 +364,10 @@ module PolarisViewHelpers
346
364
  )
347
365
  end
348
366
 
349
- def polaris_card(heading = nil, footer: nil, &block)
367
+ def polaris_card(heading = nil, footer: nil, extra_class: "", &block)
350
368
  render(
351
369
  partial: 'polaris/card',
352
- locals: { block: block, heading: heading, footer: footer }
370
+ locals: { block: block, heading: heading, footer: footer, extra_class: extra_class }
353
371
  )
354
372
  end
355
373
 
@@ -1,3 +1,3 @@
1
1
  module PolarisViewHelpers
2
- VERSION = "1.2.6"
2
+ VERSION = "1.2.8"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: polaris_view_helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.6
4
+ version: 1.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Green
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-17 00:00:00.000000000 Z
11
+ date: 2022-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -65,6 +65,7 @@ files:
65
65
  - app/views/polaris/_form_layout_item.html.erb
66
66
  - app/views/polaris/_form_layout_item_select.html.erb
67
67
  - app/views/polaris/_heading.html.erb
68
+ - app/views/polaris/_icon.html.erb
68
69
  - app/views/polaris/_layout.html.erb
69
70
  - app/views/polaris/_layout_section.html.erb
70
71
  - app/views/polaris/_link_to.html.erb
@@ -82,8 +83,10 @@ files:
82
83
  - app/views/polaris/_text_field.html.erb
83
84
  - app/views/polaris/_thumbnail.html.erb
84
85
  - app/views/polaris/banner_icons/_critical.html.erb
86
+ - app/views/polaris/banner_icons/_info.html.erb
85
87
  - app/views/polaris/banner_icons/_success.html.erb
86
88
  - app/views/polaris/banner_icons/_warning.html.erb
89
+ - app/views/polaris/icons/CircleTickMajor.svg
87
90
  - lib/polaris_view_helpers.rb
88
91
  - lib/polaris_view_helpers/helper.rb
89
92
  - lib/polaris_view_helpers/version.rb
@@ -342,7 +345,7 @@ homepage: http://www.octolabs.com/
342
345
  licenses:
343
346
  - MIT
344
347
  metadata: {}
345
- post_install_message:
348
+ post_install_message:
346
349
  rdoc_options: []
347
350
  require_paths:
348
351
  - lib
@@ -358,7 +361,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
358
361
  version: '0'
359
362
  requirements: []
360
363
  rubygems_version: 3.1.4
361
- signing_key:
364
+ signing_key:
362
365
  specification_version: 4
363
366
  summary: Rails helpers for Shopify Polaris.
364
367
  test_files: