polaris_view_components 3.2.1 → 4.0.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.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/app/assets/fonts/OFL.txt +92 -0
  4. data/app/assets/fonts/ShopifyInterVariable-latin-ext.woff2 +0 -0
  5. data/app/assets/fonts/ShopifyInterVariable-latin.woff2 +0 -0
  6. data/app/assets/icons/polaris/AlertCircleFilledIcon.svg +1 -0
  7. data/app/assets/icons/polaris/CheckCircleFilledIcon.svg +1 -0
  8. data/app/assets/icons/polaris/InfoFilledIcon.svg +1 -0
  9. data/app/assets/javascripts/polaris_view_components/button_controller.js +6 -7
  10. data/app/assets/javascripts/polaris_view_components/dropzone_controller.js +2 -0
  11. data/app/assets/javascripts/polaris_view_components/index.js +2 -0
  12. data/app/assets/javascripts/polaris_view_components/popover_controller.js +33 -6
  13. data/app/assets/javascripts/polaris_view_components/tabs_controller.js +14 -0
  14. data/app/assets/javascripts/polaris_view_components.js +103 -7
  15. data/app/assets/stylesheets/polaris_view_components/action_list.pcss +19 -4
  16. data/app/assets/stylesheets/polaris_view_components/badge.pcss +75 -0
  17. data/app/assets/stylesheets/polaris_view_components/banner.pcss +132 -87
  18. data/app/assets/stylesheets/polaris_view_components/button.pcss +395 -61
  19. data/app/assets/stylesheets/polaris_view_components/callout_card.pcss +63 -2
  20. data/app/assets/stylesheets/polaris_view_components/card.pcss +130 -30
  21. data/app/assets/stylesheets/polaris_view_components/choice.pcss +80 -0
  22. data/app/assets/stylesheets/polaris_view_components/custom.pcss +6 -67
  23. data/app/assets/stylesheets/polaris_view_components/data_table.pcss +58 -2
  24. data/app/assets/stylesheets/polaris_view_components/description_list.pcss +34 -0
  25. data/app/assets/stylesheets/polaris_view_components/drop_zone.pcss +100 -0
  26. data/app/assets/stylesheets/polaris_view_components/fonts.pcss +27 -0
  27. data/app/assets/stylesheets/polaris_view_components/footer_help.pcss +24 -0
  28. data/app/assets/stylesheets/polaris_view_components/index_table.pcss +17 -2
  29. data/app/assets/stylesheets/polaris_view_components/media.pcss +126 -0
  30. data/app/assets/stylesheets/polaris_view_components/modal.pcss +115 -3
  31. data/app/assets/stylesheets/polaris_view_components/navigation.pcss +49 -0
  32. data/app/assets/stylesheets/polaris_view_components/navigation_list_component.pcss +73 -10
  33. data/app/assets/stylesheets/polaris_view_components/page.pcss +120 -10
  34. data/app/assets/stylesheets/polaris_view_components/pagination.pcss +6 -2
  35. data/app/assets/stylesheets/polaris_view_components/popover.pcss +13 -0
  36. data/app/assets/stylesheets/polaris_view_components/resource_list.pcss +100 -0
  37. data/app/assets/stylesheets/polaris_view_components/save_bar.pcss +35 -25
  38. data/app/assets/stylesheets/polaris_view_components/shopify_navigation.pcss +21 -18
  39. data/app/assets/stylesheets/polaris_view_components/tabs.pcss +69 -0
  40. data/app/assets/stylesheets/polaris_view_components/tag.pcss +45 -0
  41. data/app/assets/stylesheets/polaris_view_components/text_fields.pcss +226 -0
  42. data/app/assets/stylesheets/polaris_view_components/theme.pcss +386 -0
  43. data/app/assets/stylesheets/polaris_view_components/tooltip_component.pcss +7 -5
  44. data/app/assets/stylesheets/polaris_view_components/variables.pcss +1 -1
  45. data/app/assets/stylesheets/polaris_view_components.css +1766 -275
  46. data/app/assets/stylesheets/polaris_view_components.pcss +8 -0
  47. data/app/components/polaris/avatar_component.rb +1 -1
  48. data/app/components/polaris/banner_component.html.erb +27 -90
  49. data/app/components/polaris/banner_component.rb +4 -5
  50. data/app/components/polaris/button_component.html.erb +1 -9
  51. data/app/components/polaris/callout_card_component.html.erb +11 -7
  52. data/app/components/polaris/callout_card_component.rb +4 -3
  53. data/app/components/polaris/card/header_component.rb +1 -1
  54. data/app/components/polaris/card/section_component.html.erb +1 -1
  55. data/app/components/polaris/card/section_component.rb +2 -1
  56. data/app/components/polaris/card_component.html.erb +39 -37
  57. data/app/components/polaris/card_component.rb +3 -3
  58. data/app/components/polaris/checkbox_component.html.erb +2 -1
  59. data/app/components/polaris/checkbox_component.rb +0 -4
  60. data/app/components/polaris/dropzone_component.html.erb +12 -36
  61. data/app/components/polaris/headless_button.html.erb +1 -9
  62. data/app/components/polaris/headless_button.rb +13 -0
  63. data/app/components/polaris/modal_component.html.erb +6 -0
  64. data/app/components/polaris/page_component.html.erb +4 -4
  65. data/app/components/polaris/progress_bar_component.rb +4 -4
  66. data/app/components/polaris/resource_item/shortcut_actions_component.html.erb +6 -8
  67. data/app/components/polaris/resource_item/shortcut_actions_component.rb +5 -1
  68. data/app/components/polaris/resource_item_component.html.erb +4 -4
  69. data/app/components/polaris/resource_item_component.rb +4 -1
  70. data/app/components/polaris/spinner_component.html.erb +4 -9
  71. data/app/components/polaris/tabs_component.rb +2 -0
  72. data/lib/polaris/view_components/version.rb +1 -1
  73. metadata +18 -3
@@ -1,19 +1,25 @@
1
1
  @import "./polaris_view_components/fonts.pcss";
2
2
  @import "@shopify/polaris/build/esm/styles.css";
3
3
  @import "./polaris_view_components/variables.pcss";
4
+ @import "./polaris_view_components/theme.pcss";
4
5
 
5
6
  @import "./polaris_view_components/action_list.pcss";
7
+ @import "./polaris_view_components/badge.pcss";
6
8
  @import "./polaris_view_components/banner.pcss";
7
9
  @import "./polaris_view_components/button.pcss";
8
10
  @import "./polaris_view_components/callout_card.pcss";
9
11
  @import "./polaris_view_components/card.pcss";
12
+ @import "./polaris_view_components/choice.pcss";
10
13
  @import "./polaris_view_components/collapsible.pcss";
11
14
  @import "./polaris_view_components/custom.pcss";
12
15
  @import "./polaris_view_components/data_table.pcss";
16
+ @import "./polaris_view_components/description_list.pcss";
17
+ @import "./polaris_view_components/drop_zone.pcss";
13
18
  @import "./polaris_view_components/footer_help.pcss";
14
19
  @import "./polaris_view_components/form_layout.pcss";
15
20
  @import "./polaris_view_components/index_table.pcss";
16
21
  @import "./polaris_view_components/list.pcss";
22
+ @import "./polaris_view_components/media.pcss";
17
23
  @import "./polaris_view_components/modal.pcss";
18
24
  @import "./polaris_view_components/navigation.pcss";
19
25
  @import "./polaris_view_components/navigation_list_component.pcss";
@@ -21,9 +27,11 @@
21
27
  @import "./polaris_view_components/page.pcss";
22
28
  @import "./polaris_view_components/pagination.pcss";
23
29
  @import "./polaris_view_components/popover.pcss";
30
+ @import "./polaris_view_components/resource_list.pcss";
24
31
  @import "./polaris_view_components/save_bar.pcss";
25
32
  @import "./polaris_view_components/shopify_navigation.pcss";
26
33
  @import "./polaris_view_components/spacer_component.pcss";
27
34
  @import "./polaris_view_components/tabs.pcss";
35
+ @import "./polaris_view_components/tag.pcss";
28
36
  @import "./polaris_view_components/text_fields.pcss";
29
37
  @import "./polaris_view_components/tooltip_component.pcss";
@@ -11,7 +11,7 @@ module Polaris
11
11
  }
12
12
  SIZE_OPTIONS = SIZE_MAPPINGS.keys
13
13
 
14
- SHAPE_DEFAULT = :round
14
+ SHAPE_DEFAULT = :square
15
15
  SHAPE_MAPPINGS = {
16
16
  square: "Polaris-Avatar--shapeSquare",
17
17
  round: "Polaris-Avatar--shapeRound"
@@ -1,101 +1,38 @@
1
- <% content_with_actions = capture do %>
2
- <%= polaris_vertical_stack(classes: "Polaris-Banner__ContentWrapper", gap: within_container? ? "1" : "3") do %>
3
- <% if content.present? || action || secondary_action %>
4
-
5
- <% if content.present? %>
6
- <%= polaris_box(padding_inline_end: within_container? ? "2" : nil) do %>
7
- <%= content %>
8
- <% end %>
9
- <% end %>
10
-
11
- <% if action || secondary_action %>
12
- <%= polaris_box do %>
13
- <%= polaris_button_group do |group| %>
14
- <% if action %>
15
- <% group.with_item do %>
16
- <%= polaris_box(padding_inline_end: "1") do %>
17
- <%= action %>
18
- <% end %>
19
- <% end %>
20
- <% end %>
21
-
22
- <% if secondary_action %>
23
- <% group.with_item do %>
24
- <%= secondary_action %>
25
- <% end %>
26
- <% end %>
27
- <% end %>
28
- <% end %>
29
- <% end %>
30
-
31
- <% end %>
32
- <% end %>
33
- <% end %>
34
-
35
1
  <%= render Polaris::BaseComponent.new(**system_arguments) do %>
36
- <% if has_title? && !within_container? %>
37
- <%= polaris_box(width: "100%") do %>
38
- <%= polaris_vertical_stack do %>
39
- <%= polaris_box(classes: "Polaris-Banner__TopBar") do %>
40
- <%= polaris_horizontal_stack(align: :space_between, block_align: :center, wrap: false, gap: "2") do %>
41
- <%= polaris_horizontal_stack(wrap: false, gap: "1") do %>
42
- <% unless @hide_icon %>
43
- <%= polaris_box do %>
44
- <%= render_icon %>
45
- <% end %>
46
- <% end %>
47
- <% if has_title? %>
48
- <%= polaris_text(as: :h2, variant: :headingSm, break_word: true) do %>
49
- <%= @title %>
50
- <% end %>
51
- <% end %>
52
- <% end %>
53
- <% if dismiss_button %>
54
- <%= polaris_box(classes: "Polaris-Banner__DismissButton") do %>
55
- <%= dismiss_button %>
56
- <% end %>
57
- <% end %>
2
+ <div class="Polaris-Banner__Body">
3
+ <div class="Polaris-Banner__ContentWrapper">
4
+ <% unless @hide_icon && !has_title? %>
5
+ <div class="Polaris-Banner__Heading">
6
+ <% unless @hide_icon %>
7
+ <span class="Polaris-Banner__InlineIcon"><%= render_icon %></span>
58
8
  <% end %>
59
- <% end %>
60
- <% if has_content? %>
61
- <%= polaris_box(padding: "4") do %>
62
- <%= content_with_actions %>
9
+ <% if has_title? %>
10
+ <%= polaris_text(as: :h2, variant: :headingSm, break_word: true) { @title } %>
63
11
  <% end %>
64
- <% end %>
12
+ </div>
65
13
  <% end %>
66
- <% end %>
67
- <% else %>
68
- <%= polaris_box(width: "100%", padding: within_container? ? "2" : "3") do %>
69
- <%= polaris_horizontal_stack(align: :space_between, block_align: :start, wrap: false, gap: "2") do %>
70
- <%= polaris_horizontal_stack(wrap: false, gap: "1") do %>
71
- <% unless @hide_icon %>
72
- <%= polaris_box(classes: "Polaris-Banner__InlineIcon") do %>
73
- <%= render_icon %>
14
+ <% if content.present? %>
15
+ <div class="Polaris-Banner__Message"><%= content %></div>
16
+ <% end %>
17
+ </div>
18
+ <% if action || secondary_action %>
19
+ <div class="Polaris-Banner__Actions">
20
+ <%= polaris_button_group do |group| %>
21
+ <% if action %>
22
+ <% group.with_item do %>
23
+ <%= action %>
74
24
  <% end %>
75
25
  <% end %>
76
- <%= polaris_box(
77
- padding: within_container? ? nil : "1",
78
- padding_block_start: (has_title? || within_container?) ? nil : "1_5",
79
- classes: has_title? ? nil : "Polaris-Banner__ContainerContentWrapper"
80
- ) do %>
81
- <%= polaris_vertical_stack(gap: "1") do %>
82
- <% if has_title? %>
83
- <%= polaris_text(as: :h2, variant: :headingSm, break_word: true) do %>
84
- <%= @title %>
85
- <% end %>
86
- <% end %>
87
- <% if has_content? %>
88
- <%= content_with_actions %>
89
- <% end %>
26
+ <% if secondary_action %>
27
+ <% group.with_item do %>
28
+ <%= secondary_action %>
90
29
  <% end %>
91
30
  <% end %>
92
31
  <% end %>
93
- <% if dismiss_button %>
94
- <%= polaris_box(classes: "Polaris-Banner__DismissButton") do %>
95
- <%= dismiss_button %>
96
- <% end %>
97
- <% end %>
98
- <% end %>
32
+ </div>
33
+ <% end %>
34
+ <% if dismiss_button %>
35
+ <div class="Polaris-Banner__DismissButton"><%= dismiss_button %></div>
99
36
  <% end %>
100
- <% end %>
37
+ </div>
101
38
  <% end %>
@@ -34,7 +34,7 @@ module Polaris
34
34
  Polaris::ButtonComponent.new(**system_arguments)
35
35
  end
36
36
  renders_one :dismiss_button, ->(**system_arguments) do
37
- render Polaris::ButtonComponent.new(plain: true, **system_arguments) do |button|
37
+ render Polaris::ButtonComponent.new(**{plain: true, aria: {label: "Dismiss"}}.deep_merge(system_arguments)) do |button|
38
38
  button.with_icon(name: "XSmallIcon")
39
39
  end
40
40
  end
@@ -76,11 +76,10 @@ module Polaris
76
76
 
77
77
  def default_icon(status)
78
78
  case status
79
- when :success then "CheckIcon"
80
- when :critical then "AlertDiamondIcon"
81
- when :warning then "AlertTriangleIcon"
79
+ when :success then "CheckCircleFilledIcon"
80
+ when :critical, :warning then "AlertCircleFilledIcon"
82
81
  else
83
- "InfoIcon"
82
+ "InfoFilledIcon"
84
83
  end
85
84
  end
86
85
 
@@ -1,19 +1,11 @@
1
1
  <% button_content = capture do %>
2
2
  <%= render Polaris::BaseComponent.new(tag: @tag, **system_arguments) do %>
3
+ <%= loading_spinner %>
3
4
  <span class="Polaris-Button__Content">
4
- <% if @loading %>
5
- <span class="Polaris-Button__Spinner">
6
- <%= polaris_spinner(size: :small) %>
7
- </span>
8
- <% end %>
9
-
10
5
  <% if icon.present? || @icon_name.present? %>
11
6
  <div class="Polaris-Button__Icon">
12
7
  <%= icon.presence || polaris_icon(name: @icon_name) %>
13
8
  </div>
14
- <% if content.present? && !@plain %>
15
- &nbsp;
16
- <% end %>
17
9
  <% end %>
18
10
 
19
11
  <% if content.present? %>
@@ -1,11 +1,5 @@
1
1
  <%= render Polaris::BaseComponent.new(**@system_arguments) do %>
2
2
  <div class="<%= container_classes %>">
3
- <% if dismiss_button %>
4
- <div class="Polaris-CalloutCard__Dismiss">
5
- <%= dismiss_button %>
6
- </div>
7
- <% end %>
8
-
9
3
  <div class="Polaris-LegacyCard__Section">
10
4
  <div class="Polaris-CalloutCard">
11
5
  <div class="Polaris-CalloutCard__Content">
@@ -39,8 +33,18 @@
39
33
  <% end %>
40
34
  </div>
41
35
 
42
- <img class="<%= image_classes %>" src="<%= @illustration %>" alt="">
36
+ <% if @illustration.present? %>
37
+ <div class="Polaris-CalloutCard__Illustration">
38
+ <img class="<%= image_classes %>" src="<%= @illustration %>" alt="">
39
+ </div>
40
+ <% end %>
43
41
  </div>
42
+
43
+ <% if dismiss_button %>
44
+ <div class="Polaris-CalloutCard__Dismiss">
45
+ <%= dismiss_button %>
46
+ </div>
47
+ <% end %>
44
48
  </div>
45
49
  </div>
46
50
  <% end %>
@@ -3,11 +3,11 @@
3
3
  module Polaris
4
4
  class CalloutCardComponent < Polaris::Component
5
5
  renders_one :primary_action, Polaris::ButtonComponent
6
- renders_one :secondary_action, ->(plain: true, **system_arguments) do
7
- Polaris::ButtonComponent.new(plain: plain, **system_arguments)
6
+ renders_one :secondary_action, ->(plain: true, monochrome: true, remove_underline: true, **system_arguments) do
7
+ Polaris::ButtonComponent.new(plain: plain, monochrome: monochrome, remove_underline: remove_underline, **system_arguments)
8
8
  end
9
9
  renders_one :dismiss_button, ->(**system_arguments) do
10
- render Polaris::ButtonComponent.new(plain: true, **system_arguments) do |button|
10
+ render Polaris::ButtonComponent.new(**{plain: true, monochrome: true, remove_underline: true, aria: {label: "Dismiss card"}}.deep_merge(system_arguments)) do |button|
11
11
  button.with_icon(name: "XSmallIcon")
12
12
  end
13
13
  end
@@ -30,6 +30,7 @@ module Polaris
30
30
 
31
31
  def container_classes
32
32
  class_names(
33
+ "Polaris-LegacyCard__Surface",
33
34
  "Polaris-CalloutCard__Container",
34
35
  "Polaris-CalloutCard--hasDismiss": dismiss_button.present?
35
36
  )
@@ -12,7 +12,7 @@ class Polaris::Card::HeaderComponent < Polaris::Component
12
12
  )
13
13
 
14
14
  @title = title
15
- @actions = actions.map { |a| a.merge(plain: true) }
15
+ @actions = actions
16
16
  end
17
17
 
18
18
  def simple?
@@ -2,7 +2,7 @@
2
2
  <% if @title.present? && @title.is_a?(String) %>
3
3
  <div class="Polaris-LegacyCard__SectionHeader">
4
4
  <% if @actions.present? %>
5
- <%= polaris_stack(alignment: :trailing) do |stack| %>
5
+ <%= polaris_stack(alignment: :center) do |stack| %>
6
6
  <% stack.with_item(fill: true) do %>
7
7
  <%= polaris_text(variant: :headingSm, as: :h3) { @title } %>
8
8
  <% end %>
@@ -17,6 +17,7 @@ class Polaris::Card::SectionComponent < Polaris::Component
17
17
  @system_arguments[:classes] = class_names(
18
18
  @system_arguments[:classes],
19
19
  "Polaris-LegacyCard__Section": !unstyled,
20
+ "Polaris-LegacyCard__Section--unstyled": unstyled,
20
21
  "Polaris-LegacyCard__Section--flush": flush,
21
22
  "Polaris-LegacyCard__Section--subdued": subdued,
22
23
  "Polaris-LegacyCard__Section--fullWidth": full_width,
@@ -25,7 +26,7 @@ class Polaris::Card::SectionComponent < Polaris::Component
25
26
  )
26
27
 
27
28
  @title = title
28
- @actions = actions.map { |a| a.merge(plain: true) }
29
+ @actions = actions
29
30
  end
30
31
 
31
32
  class Polaris::Card::SubsectionComponent < Polaris::Component
@@ -1,8 +1,4 @@
1
1
  <%= render Polaris::BaseComponent.new(**system_arguments) do %>
2
- <% if tabs.present? %>
3
- <%= tabs %>
4
- <% end %>
5
-
6
2
  <% if header.present? %>
7
3
  <%= header %>
8
4
  <% end %>
@@ -11,51 +7,57 @@
11
7
  <%= render Polaris::Card::HeaderComponent.new(title: @title, actions: @actions) %>
12
8
  <% end %>
13
9
 
14
- <% if sections.present? %>
15
- <% sections.each do |section| %>
16
- <%= section %>
10
+ <div class="Polaris-LegacyCard__Surface">
11
+ <% if tabs.present? %>
12
+ <%= tabs %>
17
13
  <% end %>
18
- <% end %>
19
14
 
20
- <% if content.present? %>
21
- <% if @sectioned %>
22
- <%= render Polaris::Card::SectionComponent.new do %>
15
+ <% if sections.present? %>
16
+ <% sections.each do |section| %>
17
+ <%= section %>
18
+ <% end %>
19
+ <% end %>
20
+
21
+ <% if content.present? %>
22
+ <% if @sectioned %>
23
+ <%= render Polaris::Card::SectionComponent.new do %>
24
+ <%= content %>
25
+ <% end %>
26
+ <% else %>
23
27
  <%= content %>
24
28
  <% end %>
25
- <% else %>
26
- <%= content %>
27
29
  <% end %>
28
- <% end %>
29
30
 
30
- <% if render_footer? %>
31
- <div class="<%= footer_classes %>">
32
- <%= polaris_button_group do |group| %>
33
- <% if @footer_action_alignment == :right %>
34
- <% secondary_footer_actions.each do |secondary_footer_action| %>
35
- <% group.with_item do %>
36
- <%= secondary_footer_action %>
31
+ <% if render_footer? %>
32
+ <div class="<%= footer_classes %>">
33
+ <%= polaris_button_group do |group| %>
34
+ <% if @footer_action_alignment == :right %>
35
+ <% secondary_footer_actions.each do |secondary_footer_action| %>
36
+ <% group.with_item do %>
37
+ <%= secondary_footer_action %>
38
+ <% end %>
37
39
  <% end %>
38
- <% end %>
39
40
 
40
- <% if primary_footer_action %>
41
- <% group.with_item do %>
42
- <%= primary_footer_action %>
41
+ <% if primary_footer_action %>
42
+ <% group.with_item do %>
43
+ <%= primary_footer_action %>
44
+ <% end %>
43
45
  <% end %>
44
- <% end %>
45
- <% else %>
46
- <% if primary_footer_action %>
47
- <% group.with_item do %>
48
- <%= primary_footer_action %>
46
+ <% else %>
47
+ <% if primary_footer_action %>
48
+ <% group.with_item do %>
49
+ <%= primary_footer_action %>
50
+ <% end %>
49
51
  <% end %>
50
- <% end %>
51
52
 
52
- <% secondary_footer_actions.each do |secondary_footer_action| %>
53
- <% group.with_item do %>
54
- <%= secondary_footer_action %>
53
+ <% secondary_footer_actions.each do |secondary_footer_action| %>
54
+ <% group.with_item do %>
55
+ <%= secondary_footer_action %>
56
+ <% end %>
55
57
  <% end %>
56
58
  <% end %>
57
59
  <% end %>
58
- <% end %>
59
- </div>
60
- <% end %>
60
+ </div>
61
+ <% end %>
62
+ </div>
61
63
  <% end %>
@@ -2,10 +2,10 @@
2
2
 
3
3
  module Polaris
4
4
  class CardComponent < Polaris::Component
5
- FOOTER_ACTION_ALIGNMENT_DEFAULT = :right
5
+ FOOTER_ACTION_ALIGNMENT_DEFAULT = :left
6
6
  FOOTER_ACTION_ALIGNMENT_MAPPINGS = {
7
- FOOTER_ACTION_ALIGNMENT_DEFAULT => "",
8
- :left => "Polaris-LegacyCard__LeftJustified"
7
+ right: "",
8
+ left: "Polaris-LegacyCard__LeftJustified"
9
9
  }
10
10
  FOOTER_ACTION_ALIGNMENT_OPTIONS = FOOTER_ACTION_ALIGNMENT_MAPPINGS.keys
11
11
 
@@ -5,7 +5,8 @@
5
5
  <span class="Polaris-Checkbox__Backdrop"></span>
6
6
 
7
7
  <span class="Polaris-Checkbox__Icon">
8
- <%= polaris_icon(name: icon_name) %>
8
+ <%= polaris_icon(name: "CheckSmallIcon", classes: "Polaris-Checkbox__CheckIcon") %>
9
+ <%= polaris_icon(name: "MinusIcon", classes: "Polaris-Checkbox__MinusIcon") %>
9
10
  </span>
10
11
  <% end %>
11
12
  <% end %>
@@ -63,10 +63,6 @@ module Polaris
63
63
  @checked == :indeterminate
64
64
  end
65
65
 
66
- def icon_name
67
- indeterminate? ? "MinusIcon" : "CheckSmallIcon"
68
- end
69
-
70
66
  def before_render
71
67
  validate!
72
68
  end
@@ -33,43 +33,19 @@
33
33
  <% if content.present? %>
34
34
  <%= content %>
35
35
  <% else %>
36
- <%= render Polaris::StackComponent.new(vertical: true, spacing: :tight) do |stack| %>
37
- <% unless @size == :medium %>
38
- <% stack.with_item do %>
39
- <img width="<%= @size == :small ? 20 : 40 %>" src="data:image/svg+xml,%3csvg fill='none' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M20 10a10 10 0 11-20 0 10 10 0 0120 0zM5.3 8.3l4-4a1 1 0 011.4 0l4 4a1 1 0 01-1.4 1.4L11 7.4V15a1 1 0 11-2 0V7.4L6.7 9.7a1 1 0 01-1.4-1.4z' fill='%235C5F62'/%3e%3c/svg%3e" alt="">
40
- <% end %>
41
- <% end %>
42
-
43
- <% unless @size == :small %>
44
- <% stack.with_item do %>
45
- <% if @size == :medium %>
46
- <div class="Polaris-DropZone-FileUpload__ActionTitle">
47
- <%= @file_upload_button %>
48
- </div>
49
- <% else %>
50
- <div class="Polaris-DropZone-FileUpload__Button">
51
- <%= @file_upload_button %>
52
- </div>
53
- <% end %>
54
- <% end %>
55
- <% end %>
56
-
57
- <% unless @size == :small %>
58
- <% stack.with_item do %>
59
- <% help_text = capture do %>
60
- <%= render Polaris::TextStyleComponent.new(variation: :subdued) do %>
61
- <%= @file_upload_help %>
62
- <% end %>
63
- <% end %>
64
-
65
- <% if @size == :medium %>
66
- <%= polaris_caption { help_text } %>
67
- <% else %>
68
- <%= help_text %>
69
- <% end %>
70
- <% end %>
36
+ <div class="Polaris-DropZone-FileUpload__Content">
37
+ <div class="Polaris-DropZone-FileUpload__UploadIcon">
38
+ <%= polaris_icon(name: "UploadIcon") %>
39
+ </div>
40
+ <div class="Polaris-DropZone-FileUpload__Button">
41
+ <%= @file_upload_button %>
42
+ </div>
43
+ <% if @file_upload_help.present? %>
44
+ <div class="Polaris-DropZone-FileUpload__HelpText">
45
+ <%= @file_upload_help %>
46
+ </div>
71
47
  <% end %>
72
- <% end %>
48
+ </div>
73
49
  <% end %>
74
50
  <% end %>
75
51
 
@@ -1,17 +1,9 @@
1
+ <%= loading_spinner %>
1
2
  <span class="Polaris-Button__Content">
2
- <% if @loading %>
3
- <span class="Polaris-Button__Spinner">
4
- <%= polaris_spinner(size: :small) %>
5
- </span>
6
- <% end %>
7
-
8
3
  <% if icon.present? || @icon_name.present? %>
9
4
  <div class="Polaris-Button__Icon">
10
5
  <%= icon || polaris_icon(name: @icon_name) %>
11
6
  </div>
12
- <% if content.present? %>
13
- &nbsp;
14
- <% end %>
15
7
  <% end %>
16
8
 
17
9
  <% if content.present? %>
@@ -19,6 +19,15 @@ module Polaris
19
19
  }
20
20
  TEXT_ALIGN_OPTIONS = TEXT_ALIGN_MAPPINGS.keys
21
21
 
22
+ SPINNER_HTML = <<~HTML.html_safe.freeze
23
+ <span class="Polaris-Button__Spinner" role="status" aria-label="Loading">
24
+ <svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
25
+ <circle class="Polaris-Button__SpinnerTrack" r="14" stroke-width="3" cx="22" cy="22" />
26
+ <circle class="Polaris-Button__SpinnerIndicator" pathLength="10" r="14" stroke-width="3" cx="22" cy="22" />
27
+ </svg>
28
+ </span>
29
+ HTML
30
+
22
31
  DISCLOSURE_DEFAULT = false
23
32
  DISCLOSURE_OPTIONS = [true, false, :down, :up, :select, :horizontal_dots]
24
33
 
@@ -101,6 +110,10 @@ module Polaris
101
110
  @system_arguments
102
111
  end
103
112
 
113
+ def loading_spinner
114
+ SPINNER_HTML if @loading
115
+ end
116
+
104
117
  def html_options
105
118
  options = system_arguments
106
119
  options[:class] = options[:classes]
@@ -50,6 +50,12 @@
50
50
  <% end %>
51
51
  <% end %>
52
52
  <% end %>
53
+ <% elsif close_button.present? %>
54
+ <%= close_button %>
55
+ <% else %>
56
+ <%= render(Polaris::BaseComponent.new(**close_button_arguments)) do %>
57
+ <%= polaris_icon(name: "XIcon", color: :base) %>
58
+ <% end %>
53
59
  <% end %>
54
60
 
55
61
  <% if @scrollable %>
@@ -13,7 +13,7 @@
13
13
  <div class="Polaris-Page-Header__BreadcrumbWrapper">
14
14
  <%= polaris_box(max_width: "100%", padding_inline_end: "2", print_hidden: true) do %>
15
15
  <nav role="navigation">
16
- <a class="Polaris-Breadcrumbs__Breadcrumb" href="<%= @back_url %>" data-polaris-unstyled="true">
16
+ <a class="Polaris-Breadcrumbs__Breadcrumb" href="<%= @back_url %>" aria-label="Back" data-polaris-unstyled="true">
17
17
  <span class="Polaris-Breadcrumbs__ContentWrapper">
18
18
  <span class="Polaris-Breadcrumbs__Icon">
19
19
  <%= polaris_icon(name: "ArrowLeftIcon") %>
@@ -108,9 +108,9 @@
108
108
  <% if has_pagination? %>
109
109
  <div class="Polaris-Page-Header__PaginationWrapper">
110
110
  <nav aria-label="Pagination">
111
- <%= polaris_button_group(segmented: @pagination_label.blank?) do |group| %>
111
+ <%= polaris_button_group(spacing: :extra_tight) do |group| %>
112
112
  <% group.with_item do %>
113
- <%= polaris_button(url: @prev_url, outline: true, disabled: @prev_url.blank?) do |button| %>
113
+ <%= polaris_button(url: @prev_url, outline: true, disabled: @prev_url.blank?, aria: {label: "Previous page"}) do |button| %>
114
114
  <% button.with_icon(name: "ChevronLeftIcon") %>
115
115
  <% end %>
116
116
  <% end %>
@@ -120,7 +120,7 @@
120
120
  <% end %>
121
121
  <% end %>
122
122
  <% group.with_item do %>
123
- <%= polaris_button(url: @next_url, outline: true, disabled: @next_url.blank?) do |button| %>
123
+ <%= polaris_button(url: @next_url, outline: true, disabled: @next_url.blank?, aria: {label: "Next page"}) do |button| %>
124
124
  <% button.with_icon(name: "ChevronRightIcon") %>
125
125
  <% end %>
126
126
  <% end %>
@@ -2,10 +2,10 @@
2
2
 
3
3
  module Polaris
4
4
  class ProgressBarComponent < Polaris::Component
5
- COLOR_DEFAULT = :highlight
5
+ COLOR_DEFAULT = :primary
6
6
  COLOR_MAPPINGS = {
7
- COLOR_DEFAULT => "Polaris-ProgressBar--colorHighlight",
8
- :primary => "Polaris-ProgressBar--colorPrimary",
7
+ COLOR_DEFAULT => "Polaris-ProgressBar--colorPrimary",
8
+ :highlight => "Polaris-ProgressBar--colorHighlight",
9
9
  :success => "Polaris-ProgressBar--colorSuccess",
10
10
  :critical => "Polaris-ProgressBar--colorCritical"
11
11
  }
@@ -46,7 +46,7 @@ module Polaris
46
46
  "Polaris-ProgressBar__IndicatorAppearDone"
47
47
  )
48
48
  args[:style] = styles_list(
49
- "--pc-progress-bar-duration": @animated ? "500ms" : "0ms",
49
+ "--pc-progress-bar-duration": @animated ? "200ms" : "0ms",
50
50
  "--pc-progress-bar-percent": @progress / 100.0
51
51
  )
52
52
  end
@@ -6,15 +6,13 @@
6
6
  <% end %>
7
7
  <% end %>
8
8
 
9
- <% if @persist_actions %>
10
- <%= render(Polaris::BaseComponent.new(**disclosure_arguments)) do %>
11
- <%= render(Polaris::PopoverComponent.new(**popover_arguments)) do |popover| %>
12
- <% popover.with_button(disclosure: :horizontal_dots, plain: true) %>
9
+ <%= render(Polaris::BaseComponent.new(**disclosure_arguments)) do %>
10
+ <%= render(Polaris::PopoverComponent.new(**popover_arguments)) do |popover| %>
11
+ <% popover.with_button(icon_name: "MenuHorizontalIcon", plain: true, monochrome: true, remove_underline: true, aria: { label: "More actions" }) %>
13
12
 
14
- <%= render(Polaris::ActionListComponent.new) do |action_list| %>
15
- <% buttons.each do |button| %>
16
- <% action_list.with_item(**button.action_list_item_arguments) { button.content } %>
17
- <% end %>
13
+ <%= render(Polaris::ActionListComponent.new) do |action_list| %>
14
+ <% buttons.each do |button| %>
15
+ <% action_list.with_item(**button.action_list_item_arguments) { button.content } %>
18
16
  <% end %>
19
17
  <% end %>
20
18
  <% end %>