polaris_view_components 1.3.0 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 78a6ae16cf340437e15af81ff47953f94b1f391af829678035890d5e990e1beb
4
- data.tar.gz: 07b81a71aaea4b0609c5e3479bb531076df8f65fb589f69aab40181029791414
3
+ metadata.gz: '07659b2a6fedf1e3d426e3e8a33ecbafc0e178d26604015f5deb4746764c42cb'
4
+ data.tar.gz: 0b78c075f082486d601be0902ae6c3a92641afd5d0261001cd624955011eb31d
5
5
  SHA512:
6
- metadata.gz: 6ad09a8dc61def4c7fb827d312e19d46b920bb79e804468ca1e9bc5cdac341755ec56ade63230368ff7890fe830d01a7f991116f263e1d03b056a10b9a2c3676
7
- data.tar.gz: e503ca46cc74f5c8ed8b87d73b517c3915f82c0147a99385fc58fa4f60a46596399149ca857b9348cbc2037fa5d77c67b12072684c397750833c2442361f681a
6
+ metadata.gz: a531b52c1a89c77a993d67fdb4c55f176f71fbf91bd7d09705a9ee2e0fda2b0a34c078b05ee42b5c85ff023f2db1995e0646572791bb49911378756ba560f8bc
7
+ data.tar.gz: be96664525ff3f02851bc178990b53eb982fb30764888aff42e0e5323552297867291cdbca3dc6e40fdfc5cfa1384d13e679267836d80ce1a8759957b1dd54c5
@@ -0,0 +1,14 @@
1
+ .NavigationList {
2
+ padding-top: var(--p-space-3);
3
+ padding-bottom: var(--p-space-3);
4
+
5
+ ul {
6
+ margin: 0;
7
+ padding-inline-start: 0;
8
+ }
9
+
10
+ .Polaris-Navigation__Item {
11
+ padding-bottom: var(--p-space-1);
12
+ padding-top: var(--p-space-1);
13
+ }
14
+ }
@@ -3453,6 +3453,18 @@ html[class~="Polaris-Summer-Editions-2023"] .Polaris-VideoThumbnail__Indicator {
3453
3453
  transform: rotate(45deg);
3454
3454
  background-color: var(--p-color-bg);
3455
3455
  }
3456
+ .NavigationList {
3457
+ padding-top: var(--p-space-3);
3458
+ padding-bottom: var(--p-space-3);
3459
+ }
3460
+ .NavigationList ul {
3461
+ margin: 0;
3462
+ padding-inline-start: 0;
3463
+ }
3464
+ .NavigationList .Polaris-Navigation__Item {
3465
+ padding-bottom: var(--p-space-1);
3466
+ padding-top: var(--p-space-1);
3467
+ }
3456
3468
  .Polaris--hidden {
3457
3469
  display: none !important;
3458
3470
  }
@@ -2,4 +2,5 @@
2
2
  @import "./polaris_view_components/shopify_navigation.pcss";
3
3
  @import "./polaris_view_components/spacer_component.pcss";
4
4
  @import "./polaris_view_components/tooltip_component.pcss";
5
+ @import "./polaris_view_components/navigation_list_component.pcss";
5
6
  @import "./polaris_view_components/custom.pcss";
@@ -0,0 +1,7 @@
1
+ <%= polaris_card(sectioned: false, classes: "NavigationList") do |card| %>
2
+ <ul>
3
+ <% items.each do |item| %>
4
+ <%= item %>
5
+ <% end %>
6
+ </ul>
7
+ <% end %>
@@ -0,0 +1,13 @@
1
+ module Polaris
2
+ class NavigationListComponent < Polaris::Component
3
+ renders_many :items, Polaris::Navigation::ItemComponent
4
+
5
+ def initialize(**system_arguments)
6
+ @system_arguments = system_arguments
7
+ end
8
+
9
+ def renders?
10
+ items.any?
11
+ end
12
+ end
13
+ end
@@ -108,12 +108,17 @@
108
108
  <% if has_pagination? %>
109
109
  <div class="Polaris-Page-Header__PaginationWrapper">
110
110
  <nav aria-label="Pagination">
111
- <%= polaris_button_group(segmented: true) do |group| %>
111
+ <%= polaris_button_group(segmented: @pagination_label.blank?) do |group| %>
112
112
  <% group.with_item do %>
113
113
  <%= polaris_button(url: @prev_url, outline: true, disabled: @prev_url.blank?) do |button| %>
114
114
  <% button.with_icon(name: "ChevronLeftMinor") %>
115
115
  <% end %>
116
116
  <% end %>
117
+ <% if @pagination_label.present? %>
118
+ <% group.with_item do %>
119
+ <div aria-live="polite"><%= @pagination_label %></div>
120
+ <% end %>
121
+ <% end %>
117
122
  <% group.with_item do %>
118
123
  <%= polaris_button(url: @next_url, outline: true, disabled: @next_url.blank?) do |button| %>
119
124
  <% button.with_icon(name: "ChevronRightMinor") %>
@@ -2,6 +2,8 @@
2
2
 
3
3
  module Polaris
4
4
  class PageComponent < Polaris::Component
5
+ include ActionView::Helpers::SanitizeHelper
6
+
5
7
  LONG_TITLE = 34
6
8
 
7
9
  renders_one :title_metadata
@@ -18,6 +20,7 @@ module Polaris
18
20
  back_url: nil,
19
21
  prev_url: nil,
20
22
  next_url: nil,
23
+ pagination_label: nil,
21
24
  narrow_width: false,
22
25
  full_width: false,
23
26
  divider: false,
@@ -30,6 +33,7 @@ module Polaris
30
33
  @back_url = back_url
31
34
  @prev_url = prev_url
32
35
  @next_url = next_url
36
+ @pagination_label = pagination_label
33
37
  @narrow_width = narrow_width
34
38
  @full_width = full_width
35
39
  @divider = divider
@@ -42,14 +46,19 @@ module Polaris
42
46
  tag: "div",
43
47
  classes: class_names(
44
48
  "Polaris-Page-Header--mobileView",
45
- "Polaris-Page-Header--mediumTitle": @title.present? && @title.length <= LONG_TITLE,
46
- "Polaris-Page-Header--longTitle": @title.present? && @title.length > LONG_TITLE,
49
+ "Polaris-Page-Header--mediumTitle": @title.present? && title_length <= LONG_TITLE,
50
+ "Polaris-Page-Header--longTitle": @title.present? && title_length > LONG_TITLE,
47
51
  "Polaris-Page-Header--hasNavigation": @back_url.present?,
48
52
  "Polaris-Page-Header--noBreadcrumbs": @back_url.blank?
49
53
  )
50
54
  }
51
55
  end
52
56
 
57
+ def title_length
58
+ stripped_title = strip_tags(@title)&.strip
59
+ stripped_title.present? ? stripped_title.length : 0
60
+ end
61
+
53
62
  def title_arguments
54
63
  {
55
64
  tag: "h1",
@@ -49,6 +49,7 @@ module Polaris
49
49
  modal: "Polaris::ModalComponent",
50
50
  modal_section: "Polaris::Modal::SectionComponent",
51
51
  navigation: "Polaris::NavigationComponent",
52
+ navigation_list: "Polaris::NavigationListComponent",
52
53
  option_list: "Polaris::OptionListComponent",
53
54
  page: "Polaris::PageComponent",
54
55
  page_actions: "Polaris::PageActionsComponent",
@@ -33,10 +33,7 @@ module Polaris
33
33
 
34
34
  initializer "polaris_view_components.helpers" do
35
35
  ActiveSupport.on_load(:action_controller_base) do
36
- require "polaris/view_helper"
37
36
  helper Polaris::ViewHelper
38
-
39
- require "polaris/url_helper"
40
37
  helper Polaris::UrlHelper
41
38
  end
42
39
  end
@@ -1,5 +1,5 @@
1
1
  module Polaris
2
2
  module ViewComponents
3
- VERSION = "1.3.0"
3
+ VERSION = "1.4.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: polaris_view_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Gamble
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-11-03 00:00:00.000000000 Z
12
+ date: 2024-01-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -738,6 +738,7 @@ files:
738
738
  - app/assets/stylesheets/polaris_view_components.css
739
739
  - app/assets/stylesheets/polaris_view_components.pcss
740
740
  - app/assets/stylesheets/polaris_view_components/custom.pcss
741
+ - app/assets/stylesheets/polaris_view_components/navigation_list_component.pcss
741
742
  - app/assets/stylesheets/polaris_view_components/shopify_navigation.pcss
742
743
  - app/assets/stylesheets/polaris_view_components/spacer_component.pcss
743
744
  - app/assets/stylesheets/polaris_view_components/tooltip_component.pcss
@@ -860,6 +861,8 @@ files:
860
861
  - app/components/polaris/navigation/section_component.rb
861
862
  - app/components/polaris/navigation_component.html.erb
862
863
  - app/components/polaris/navigation_component.rb
864
+ - app/components/polaris/navigation_list_component.html.erb
865
+ - app/components/polaris/navigation_list_component.rb
863
866
  - app/components/polaris/option_list/checkbox_component.html.erb
864
867
  - app/components/polaris/option_list/checkbox_component.rb
865
868
  - app/components/polaris/option_list/option_component.rb
@@ -974,7 +977,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
974
977
  - !ruby/object:Gem::Version
975
978
  version: '0'
976
979
  requirements: []
977
- rubygems_version: 3.4.18
980
+ rubygems_version: 3.4.22
978
981
  signing_key:
979
982
  specification_version: 4
980
983
  summary: ViewComponents for Polaris Design System