polaris_view_components 0.3.2 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/app/assets/javascripts/polaris_view_components/button_controller.js +48 -0
  4. data/app/assets/javascripts/polaris_view_components/index.js +11 -1
  5. data/app/assets/javascripts/polaris_view_components/modal_controller.js +25 -0
  6. data/app/assets/javascripts/polaris_view_components/polaris_controller.js +24 -0
  7. data/app/assets/javascripts/polaris_view_components/popover_controller.js +45 -0
  8. data/app/assets/javascripts/polaris_view_components/scrollable_controller.js +60 -0
  9. data/app/assets/javascripts/polaris_view_components/select_controller.js +6 -4
  10. data/app/assets/javascripts/polaris_view_components.js +1539 -5
  11. data/app/assets/stylesheets/polaris_view_components/custom.css +68 -0
  12. data/app/assets/stylesheets/polaris_view_components/shopify_navigation.css +0 -4
  13. data/app/assets/stylesheets/polaris_view_components/spacer_component.css +39 -0
  14. data/app/assets/stylesheets/polaris_view_components.css +93 -3
  15. data/app/assets/stylesheets/polaris_view_components.postcss.css +2 -0
  16. data/app/components/polaris/action.rb +3 -3
  17. data/app/components/polaris/action_list/item_component.html.erb +35 -0
  18. data/app/components/polaris/action_list/item_component.rb +41 -0
  19. data/app/components/polaris/action_list/section_component.html.erb +16 -0
  20. data/app/components/polaris/action_list/section_component.rb +26 -0
  21. data/app/components/polaris/action_list_component.html.erb +13 -0
  22. data/app/components/polaris/action_list_component.rb +25 -0
  23. data/app/components/polaris/application_component.rb +19 -19
  24. data/app/components/polaris/avatar_component.rb +1 -1
  25. data/app/components/polaris/badge_component.rb +1 -1
  26. data/app/components/polaris/banner_component.rb +6 -6
  27. data/app/components/polaris/base_button.rb +1 -1
  28. data/app/components/polaris/button_component.html.erb +13 -0
  29. data/app/components/polaris/button_group_component.rb +5 -5
  30. data/app/components/polaris/callout_card_component.rb +5 -5
  31. data/app/components/polaris/caption_component.rb +2 -2
  32. data/app/components/polaris/card/header_component.rb +1 -3
  33. data/app/components/polaris/card/section_component.rb +6 -2
  34. data/app/components/polaris/card_component.html.erb +4 -0
  35. data/app/components/polaris/card_component.rb +5 -6
  36. data/app/components/polaris/character_count.rb +10 -10
  37. data/app/components/polaris/checkbox_component.rb +4 -4
  38. data/app/components/polaris/choice_component.rb +1 -1
  39. data/app/components/polaris/choice_list_component.rb +4 -4
  40. data/app/components/polaris/data_table/cell_component.html.erb +18 -0
  41. data/app/components/polaris/data_table/cell_component.rb +49 -0
  42. data/app/components/polaris/data_table/column_component.rb +19 -0
  43. data/app/components/polaris/data_table_component.html.erb +77 -0
  44. data/app/components/polaris/data_table_component.rb +42 -0
  45. data/app/components/polaris/description_list_component.rb +3 -3
  46. data/app/components/polaris/display_text_component.rb +2 -2
  47. data/app/components/polaris/dropzone/component.rb +36 -38
  48. data/app/components/polaris/empty_state_component.html.erb +16 -11
  49. data/app/components/polaris/empty_state_component.rb +4 -3
  50. data/app/components/polaris/exception_list/item_component.rb +2 -2
  51. data/app/components/polaris/exception_list_component.rb +1 -1
  52. data/app/components/polaris/filters_component.html.erb +13 -0
  53. data/app/components/polaris/filters_component.rb +38 -0
  54. data/app/components/polaris/footer_help_component.rb +1 -1
  55. data/app/components/polaris/form_layout/group_component.rb +3 -3
  56. data/app/components/polaris/form_layout/item_component.rb +1 -1
  57. data/app/components/polaris/form_layout_component.rb +3 -3
  58. data/app/components/polaris/heading_component.rb +1 -1
  59. data/app/components/polaris/headless_button.html.erb +13 -0
  60. data/app/components/polaris/headless_button.rb +17 -5
  61. data/app/components/polaris/icon_component.rb +2 -2
  62. data/app/components/polaris/index_table/cell_component.rb +22 -0
  63. data/app/components/polaris/index_table/column_component.rb +13 -0
  64. data/app/components/polaris/index_table_component.html.erb +28 -0
  65. data/app/components/polaris/index_table_component.rb +25 -0
  66. data/app/components/polaris/inline_error_component.html.erb +2 -2
  67. data/app/components/polaris/inline_error_component.rb +7 -1
  68. data/app/components/polaris/label_component.rb +2 -2
  69. data/app/components/polaris/labelled_component.rb +2 -2
  70. data/app/components/polaris/layout/annotated_section.rb +1 -1
  71. data/app/components/polaris/layout/section.rb +2 -0
  72. data/app/components/polaris/layout_component.rb +3 -3
  73. data/app/components/polaris/link_component.rb +5 -3
  74. data/app/components/polaris/list_component.rb +3 -3
  75. data/app/components/polaris/modal/section_component.rb +19 -0
  76. data/app/components/polaris/modal_component.html.erb +79 -0
  77. data/app/components/polaris/modal_component.rb +98 -0
  78. data/app/components/polaris/page_actions_component.rb +21 -6
  79. data/app/components/polaris/page_component.rb +4 -4
  80. data/app/components/polaris/pagination_component.rb +1 -5
  81. data/app/components/polaris/popover/pane_component.html.erb +25 -0
  82. data/app/components/polaris/popover/pane_component.rb +20 -0
  83. data/app/components/polaris/popover/section_component.rb +19 -0
  84. data/app/components/polaris/popover_component.html.erb +38 -0
  85. data/app/components/polaris/popover_component.rb +90 -0
  86. data/app/components/polaris/progress_bar_component.rb +5 -5
  87. data/app/components/polaris/radio_button_component.rb +3 -3
  88. data/app/components/polaris/resource_item_component.html.erb +16 -6
  89. data/app/components/polaris/resource_item_component.rb +42 -9
  90. data/app/components/polaris/resource_list_component.html.erb +10 -0
  91. data/app/components/polaris/resource_list_component.rb +4 -10
  92. data/app/components/polaris/scrollable_component.html.erb +5 -0
  93. data/app/components/polaris/scrollable_component.rb +48 -0
  94. data/app/components/polaris/select_component.rb +10 -5
  95. data/app/components/polaris/setting_toggle_component.html.erb +10 -0
  96. data/app/components/polaris/setting_toggle_component.rb +24 -0
  97. data/app/components/polaris/shopify_navigation_component.rb +6 -6
  98. data/app/components/polaris/skeleton_body_text_component.rb +1 -1
  99. data/app/components/polaris/spacer_component.rb +50 -0
  100. data/app/components/polaris/spinner_component.rb +2 -2
  101. data/app/components/polaris/stack_component.rb +5 -5
  102. data/app/components/polaris/subheading_component.rb +1 -1
  103. data/app/components/polaris/tabs/tab_component.html.erb +10 -0
  104. data/app/components/polaris/tabs/tab_component.rb +34 -0
  105. data/app/components/polaris/tabs_component.html.erb +7 -0
  106. data/app/components/polaris/tabs_component.rb +37 -0
  107. data/app/components/polaris/tag_component.rb +2 -2
  108. data/app/components/polaris/text_container_component.rb +2 -2
  109. data/app/components/polaris/text_field_component.rb +8 -8
  110. data/app/components/polaris/text_style_component.rb +11 -2
  111. data/app/components/polaris/thumbnail_component.rb +2 -2
  112. data/app/helpers/polaris/form_builder.rb +30 -3
  113. data/app/helpers/polaris/url_helper.rb +3 -3
  114. data/app/helpers/polaris/view_helper.rb +26 -6
  115. data/app/validators/type_validator.rb +2 -2
  116. data/lib/generators/polaris_view_components/install_generator.rb +5 -5
  117. data/lib/polaris/view_components/engine.rb +6 -1
  118. data/lib/polaris/view_components/version.rb +1 -1
  119. data/lib/polaris_view_components.rb +1 -1
  120. metadata +45 -6
  121. data/app/components/polaris/choice_list/component.html.erb +0 -34
  122. data/app/components/polaris/choice_list/component.rb +0 -65
  123. data/app/helpers/polaris/action_helper.rb +0 -14
@@ -0,0 +1,68 @@
1
+ .Polaris--hidden {
2
+ display: none;
3
+ }
4
+
5
+ /* Add missing 1/4 section for layout */
6
+ @media (min-width: 30.625em) {
7
+ .Polaris-Layout__Section--oneFourth {
8
+ flex: 1 1 20rem;
9
+ min-width: 0;
10
+ }
11
+ }
12
+
13
+ /* Fix Tag removal link */
14
+ a.Polaris-Tag__Button {
15
+ height: auto;
16
+ }
17
+
18
+ /* Remove underline for sort link */
19
+
20
+ .Polaris-DataTable__Cell--sortable a {
21
+ text-decoration: none;
22
+ }
23
+
24
+ /* CardSection borders */
25
+ .Polaris-Card__Section--borderTop {
26
+ border-top: 0.1rem solid var(--p-divider);
27
+ }
28
+ .Polaris-Card__Section--borderBottom {
29
+ border-bottom: 0.1rem solid var(--p-divider);
30
+ }
31
+
32
+ /* IndexTable */
33
+
34
+ /* TODO: Remove after upgrade to Polaris 7.0.0 */
35
+ .Polaris-IndexTable__TableRow.Polaris-IndexTable__TableRow--unclickable {
36
+ cursor: auto;
37
+ }
38
+
39
+ /* TestStyle sizes */
40
+ .Polaris-TextStyle--sizeSmall {
41
+ font-size: 1.25rem;
42
+ }
43
+
44
+ /* Remove box-shadow from buttons and links */
45
+ .Polaris-Button::after,
46
+ .Polaris-Button:focus::after,
47
+ .Polaris-Breadcrumbs__Breadcrumb::after {
48
+ box-shadow: none !important;
49
+ }
50
+
51
+ .Polaris-Tabs__Tab:focus > .Polaris-Tabs__Title::after {
52
+ box-shadow: none !important;
53
+ }
54
+
55
+ /* ResourceItem */
56
+ .Polaris-ResourceItem__Owned--offset {
57
+ padding-left: 2rem;
58
+ }
59
+
60
+ /* Popover */
61
+ .Polaris-Popover {
62
+ margin: 0;
63
+ }
64
+
65
+ .Polaris-Popover__PopoverOverlay--closed {
66
+ visibility: hidden;
67
+ pointer-events: none;
68
+ }
@@ -106,10 +106,6 @@
106
106
  border-bottom: .3rem solid var(--p-action-primary)
107
107
  }
108
108
 
109
- .shp-Navigation_Link:focus {
110
- box-shadow: inset 0 0 2px 0 rgba(92, 106, 196, .8), 0 0 2px 0 rgba(92, 106, 196, .8)
111
- }
112
-
113
109
  .shp-Navigation_Link:focus .shp-Navigation_LinkText {
114
110
  font-weight: 400;
115
111
  color: var(--p-text)
@@ -0,0 +1,39 @@
1
+ /* Vertical */
2
+ .Polaris-Spacer--verticalSpacingExtraTight {
3
+ height: 4px;
4
+ }
5
+ .Polaris-Spacer--verticalSpacingTight {
6
+ height: 8px;
7
+ }
8
+ .Polaris-Spacer--verticalSpacingBaseTight {
9
+ height: 12px;
10
+ }
11
+ .Polaris-Spacer--verticalSpacingBase {
12
+ height: 16px;
13
+ }
14
+ .Polaris-Spacer--verticalSpacingLoose {
15
+ height: 20px;
16
+ }
17
+ .Polaris-Spacer--verticalSpacingExtraLoose {
18
+ height: 32px;
19
+ }
20
+
21
+ /* Horizontal */
22
+ .Polaris-Spacer--horizontalSpacingExtraTight {
23
+ width: 4px;
24
+ }
25
+ .Polaris-Spacer--horizontalSpacingTight {
26
+ width: 8px;
27
+ }
28
+ .Polaris-Spacer--horizontalSpacingBaseTight {
29
+ width: 12px;
30
+ }
31
+ .Polaris-Spacer--horizontalSpacingBase {
32
+ width: 16px;
33
+ }
34
+ .Polaris-Spacer--horizontalSpacingLoose {
35
+ width: 20px;
36
+ }
37
+ .Polaris-Spacer--horizontalSpacingExtraLoose {
38
+ width: 32px;
39
+ }
@@ -2119,9 +2119,6 @@ html, body{ min-height:100%; height:100%; }
2119
2119
  text-decoration: none;
2120
2120
  border-bottom: .3rem solid var(--p-action-primary)
2121
2121
  }
2122
- .shp-Navigation_Link:focus {
2123
- box-shadow: inset 0 0 2px 0 rgba(92, 106, 196, .8), 0 0 2px 0 rgba(92, 106, 196, .8)
2124
- }
2125
2122
  .shp-Navigation_Link:focus .shp-Navigation_LinkText {
2126
2123
  font-weight: 400;
2127
2124
  color: var(--p-text)
@@ -2142,3 +2139,96 @@ html, body{ min-height:100%; height:100%; }
2142
2139
  color: var(--p-action-primary);
2143
2140
  border-bottom: .3rem solid var(--p-action-primary)
2144
2141
  }
2142
+ /* Vertical */
2143
+ .Polaris-Spacer--verticalSpacingExtraTight {
2144
+ height: 4px;
2145
+ }
2146
+ .Polaris-Spacer--verticalSpacingTight {
2147
+ height: 8px;
2148
+ }
2149
+ .Polaris-Spacer--verticalSpacingBaseTight {
2150
+ height: 12px;
2151
+ }
2152
+ .Polaris-Spacer--verticalSpacingBase {
2153
+ height: 16px;
2154
+ }
2155
+ .Polaris-Spacer--verticalSpacingLoose {
2156
+ height: 20px;
2157
+ }
2158
+ .Polaris-Spacer--verticalSpacingExtraLoose {
2159
+ height: 32px;
2160
+ }
2161
+ /* Horizontal */
2162
+ .Polaris-Spacer--horizontalSpacingExtraTight {
2163
+ width: 4px;
2164
+ }
2165
+ .Polaris-Spacer--horizontalSpacingTight {
2166
+ width: 8px;
2167
+ }
2168
+ .Polaris-Spacer--horizontalSpacingBaseTight {
2169
+ width: 12px;
2170
+ }
2171
+ .Polaris-Spacer--horizontalSpacingBase {
2172
+ width: 16px;
2173
+ }
2174
+ .Polaris-Spacer--horizontalSpacingLoose {
2175
+ width: 20px;
2176
+ }
2177
+ .Polaris-Spacer--horizontalSpacingExtraLoose {
2178
+ width: 32px;
2179
+ }
2180
+ .Polaris--hidden {
2181
+ display: none;
2182
+ }
2183
+ /* Add missing 1/4 section for layout */
2184
+ @media (min-width: 30.625em) {
2185
+ .Polaris-Layout__Section--oneFourth {
2186
+ flex: 1 1 20rem;
2187
+ min-width: 0;
2188
+ }
2189
+ }
2190
+ /* Fix Tag removal link */
2191
+ a.Polaris-Tag__Button {
2192
+ height: auto;
2193
+ }
2194
+ /* Remove underline for sort link */
2195
+ .Polaris-DataTable__Cell--sortable a {
2196
+ text-decoration: none;
2197
+ }
2198
+ /* CardSection borders */
2199
+ .Polaris-Card__Section--borderTop {
2200
+ border-top: 0.1rem solid var(--p-divider);
2201
+ }
2202
+ .Polaris-Card__Section--borderBottom {
2203
+ border-bottom: 0.1rem solid var(--p-divider);
2204
+ }
2205
+ /* IndexTable */
2206
+ /* TODO: Remove after upgrade to Polaris 7.0.0 */
2207
+ .Polaris-IndexTable__TableRow.Polaris-IndexTable__TableRow--unclickable {
2208
+ cursor: auto;
2209
+ }
2210
+ /* TestStyle sizes */
2211
+ .Polaris-TextStyle--sizeSmall {
2212
+ font-size: 1.25rem;
2213
+ }
2214
+ /* Remove box-shadow from buttons and links */
2215
+ .Polaris-Button::after,
2216
+ .Polaris-Button:focus::after,
2217
+ .Polaris-Breadcrumbs__Breadcrumb::after {
2218
+ box-shadow: none !important;
2219
+ }
2220
+ .Polaris-Tabs__Tab:focus > .Polaris-Tabs__Title::after {
2221
+ box-shadow: none !important;
2222
+ }
2223
+ /* ResourceItem */
2224
+ .Polaris-ResourceItem__Owned--offset {
2225
+ padding-left: 2rem;
2226
+ }
2227
+ /* Popover */
2228
+ .Polaris-Popover {
2229
+ margin: 0;
2230
+ }
2231
+ .Polaris-Popover__PopoverOverlay--closed {
2232
+ visibility: hidden;
2233
+ pointer-events: none;
2234
+ }
@@ -1,2 +1,4 @@
1
1
  @import "@shopify/polaris/dist/styles.css";
2
2
  @import "./polaris_view_components/shopify_navigation.css";
3
+ @import "./polaris_view_components/spacer_component.css";
4
+ @import "./polaris_view_components/custom.css";
@@ -5,9 +5,9 @@ module Polaris
5
5
  def initialize(
6
6
  content:,
7
7
  url:,
8
- accessibility_label: '',
8
+ accessibility_label: "",
9
9
  external: false,
10
- id: '',
10
+ id: "",
11
11
  data: {}
12
12
  )
13
13
  @content = content
@@ -25,7 +25,7 @@ module Polaris
25
25
  external: @external,
26
26
  id: @id,
27
27
  url: @url,
28
- data: @data,
28
+ data: @data
29
29
  }
30
30
  end
31
31
  end
@@ -0,0 +1,35 @@
1
+ <li>
2
+ <%= render Polaris::BaseComponent.new(**system_arguments) do %>
3
+ <div class="Polaris-ActionList__Content">
4
+ <% if @icon.present? %>
5
+ <span class="Polaris-ActionList__Prefix">
6
+ <%= polaris_icon(name: @icon) %>
7
+ </span>
8
+ <% end %>
9
+ <% if prefix.present? %>
10
+ <span class="Polaris-ActionList__Prefix">
11
+ <%= prefix %>
12
+ </span>
13
+ <% end %>
14
+
15
+ <span class="Polaris-ActionList__Text">
16
+ <% if @help_text.present? %>
17
+ <span class="Polaris-ActionList__ContentBlock">
18
+ <span class="Polaris-ActionList__ContentBlockInner">
19
+ <%= content %>
20
+ </span>
21
+ <%= polaris_text_subdued { @help_text } %>
22
+ </span>
23
+ <% else %>
24
+ <%= content %>
25
+ <% end %>
26
+ </span>
27
+
28
+ <% if suffix.present? %>
29
+ <span class="Polaris-ActionList__Suffix">
30
+ <%= suffix %>
31
+ </span>
32
+ <% end %>
33
+ </div>
34
+ <% end %>
35
+ </li>
@@ -0,0 +1,41 @@
1
+ class Polaris::ActionList::ItemComponent < Polaris::NewComponent
2
+ renders_one :prefix
3
+ renders_one :suffix
4
+
5
+ def initialize(
6
+ url: nil,
7
+ icon: nil,
8
+ help_text: nil,
9
+ active: false,
10
+ destructive: false,
11
+ external: false,
12
+ **system_arguments
13
+ )
14
+ @url = url
15
+ @icon = icon
16
+ @help_text = help_text
17
+ @active = active
18
+ @destructive = destructive
19
+ @external = external
20
+ @system_arguments = system_arguments
21
+ end
22
+
23
+ def system_arguments
24
+ @system_arguments.tap do |opts|
25
+ if @url.present?
26
+ opts[:tag] = "a"
27
+ opts[:href] = @url
28
+ opts[:target] = "_blank" if @external
29
+ else
30
+ opts[:tag] = "button"
31
+ opts[:type] = "button"
32
+ end
33
+ opts[:classes] = class_names(
34
+ @system_arguments[:classes],
35
+ "Polaris-ActionList__Item",
36
+ "Polaris-ActionList--active": @active,
37
+ "Polaris-ActionList--destructive": @destructive
38
+ )
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,16 @@
1
+ <%= render Polaris::BaseComponent.new(**system_arguments) do %>
2
+ <% if @title.present? %>
3
+ <p class="<%= title_classes %>">
4
+ <%= @title %>
5
+ </p>
6
+ <% end %>
7
+ <ul class="Polaris-ActionList__Actions">
8
+ <% if items.present? %>
9
+ <% items.each do |item| %>
10
+ <%= item %>
11
+ <% end %>
12
+ <% else %>
13
+ <%= content %>
14
+ <% end %>
15
+ </ul>
16
+ <% end %>
@@ -0,0 +1,26 @@
1
+ class Polaris::ActionList::SectionComponent < Polaris::NewComponent
2
+ renders_many :items, Polaris::ActionList::ItemComponent
3
+
4
+ def initialize(position: 1, title: nil, **system_arguments)
5
+ @position = position
6
+ @title = title
7
+ @system_arguments = system_arguments
8
+ end
9
+
10
+ def system_arguments
11
+ @system_arguments.tap do |opts|
12
+ opts[:tag] = "div"
13
+ opts[:classes] = class_names(
14
+ @system_arguments[:classes],
15
+ "Polaris-ActionList__Section--withoutTitle": @title.blank?
16
+ )
17
+ end
18
+ end
19
+
20
+ def title_classes
21
+ class_names(
22
+ "Polaris-ActionList__Title",
23
+ "Polaris-ActionList--firstSectionWithTitle": @position == 1
24
+ )
25
+ end
26
+ end
@@ -0,0 +1,13 @@
1
+ <%= render Polaris::BaseComponent.new(**system_arguments) do %>
2
+ <% if sections.present? %>
3
+ <% sections.each do |section| %>
4
+ <%= section %>
5
+ <% end %>
6
+ <% else %>
7
+ <%= render Polaris::ActionList::SectionComponent.new do %>
8
+ <% items.each do |item| %>
9
+ <%= item %>
10
+ <% end %>
11
+ <% end %>
12
+ <% end %>
13
+ <% end %>
@@ -0,0 +1,25 @@
1
+ module Polaris
2
+ class ActionListComponent < Polaris::NewComponent
3
+ renders_many :items, Polaris::ActionList::ItemComponent
4
+ renders_many :sections, ->(**system_arguments) do
5
+ @counter += 1
6
+
7
+ Polaris::ActionList::SectionComponent.new(position: @counter, **system_arguments)
8
+ end
9
+
10
+ def initialize(**system_arguments)
11
+ @counter = 0
12
+ @system_arguments = system_arguments
13
+ end
14
+
15
+ def system_arguments
16
+ @system_arguments.tap do |opts|
17
+ opts[:tag] = "div"
18
+ opts[:classes] = class_names(
19
+ @system_arguments[:classes],
20
+ "Polaris-ActionList"
21
+ )
22
+ end
23
+ end
24
+ end
25
+ end
@@ -9,27 +9,27 @@ class Polaris::ApplicationComponent < ViewComponent::Base
9
9
 
10
10
  private
11
11
 
12
- def classes
13
- []
14
- end
12
+ def classes
13
+ []
14
+ end
15
15
 
16
- def additional_data
17
- {}
18
- end
16
+ def additional_data
17
+ {}
18
+ end
19
19
 
20
- def additional_aria
21
- {}
22
- end
20
+ def additional_aria
21
+ {}
22
+ end
23
23
 
24
- def content_tag_options
25
- {
26
- class: classes.compact,
27
- data: @data.merge(additional_data),
28
- aria: @aria.merge(additional_aria)
29
- }.merge(@html_options)
30
- end
24
+ def content_tag_options
25
+ {
26
+ class: classes.compact,
27
+ data: @data.merge(additional_data),
28
+ aria: @aria.merge(additional_aria)
29
+ }.merge(@html_options)
30
+ end
31
31
 
32
- def before_render
33
- validate!
34
- end
32
+ def before_render
33
+ validate!
34
+ end
35
35
  end
@@ -6,7 +6,7 @@ module Polaris
6
6
  SIZE_MAPPINGS = {
7
7
  small: "Polaris-Avatar--sizeSmall",
8
8
  medium: "Polaris-Avatar--sizeMedium",
9
- large: "Polaris-Avatar--sizeLarge",
9
+ large: "Polaris-Avatar--sizeLarge"
10
10
  }
11
11
  SIZE_OPTIONS = SIZE_MAPPINGS.keys
12
12
 
@@ -44,7 +44,7 @@ module Polaris
44
44
  "Polaris-Badge",
45
45
  PROGRESS_MAPPINGS[fetch_or_fallback(PROGRESS_OPTIONS, progress, PROGRESS_DEFAULT)],
46
46
  SIZE_MAPPINGS[fetch_or_fallback(SIZE_OPTIONS, size, SIZE_DEFAULT)],
47
- STATUS_MAPPINGS[fetch_or_fallback(STATUS_OPTIONS, status, STATUS_DEFAULT)],
47
+ STATUS_MAPPINGS[fetch_or_fallback(STATUS_OPTIONS, status, STATUS_DEFAULT)]
48
48
  )
49
49
  end
50
50
  end
@@ -8,14 +8,14 @@ module Polaris
8
8
  :success => "Polaris-Banner--statusSuccess",
9
9
  :info => "Polaris-Banner--statusInfo",
10
10
  :warning => "Polaris-Banner--statusWarning",
11
- :critical => "Polaris-Banner--statusCritical",
11
+ :critical => "Polaris-Banner--statusCritical"
12
12
  }
13
13
  STATUS_OPTIONS = STATUS_MAPPINGS.keys
14
14
 
15
15
  WITHIN_DEFAULT = :page
16
16
  WITHIN_MAPPINGS = {
17
17
  page: "Polaris-Banner--withinPage",
18
- container: "Polaris-Banner--withinContentContainer",
18
+ container: "Polaris-Banner--withinContentContainer"
19
19
  }
20
20
  WITHIN_OPTIONS = WITHIN_MAPPINGS.keys
21
21
 
@@ -24,14 +24,14 @@ module Polaris
24
24
  success: :success,
25
25
  info: :highlight,
26
26
  warning: :warning,
27
- critical: :critical,
27
+ critical: :critical
28
28
  }
29
29
 
30
- renders_one :action, -> (**system_arguments) do
30
+ renders_one :action, ->(**system_arguments) do
31
31
  Polaris::ButtonComponent.new(classes: "Polaris-Banner__Button", **system_arguments)
32
32
  end
33
33
  renders_one :secondary_action, "SecondaryAction"
34
- renders_one :dismiss_button, -> (**system_arguments) do
34
+ renders_one :dismiss_button, ->(**system_arguments) do
35
35
  render Polaris::ButtonComponent.new(plain: true, **system_arguments) do |button|
36
36
  button.icon(name: "CancelSmallMinor")
37
37
  end
@@ -55,7 +55,7 @@ module Polaris
55
55
  @system_arguments[:classes],
56
56
  "Polaris-Banner",
57
57
  STATUS_MAPPINGS[fetch_or_fallback(STATUS_OPTIONS, status, STATUS_DEFAULT)],
58
- WITHIN_MAPPINGS[fetch_or_fallback(WITHIN_OPTIONS, within, WITHIN_DEFAULT)],
58
+ WITHIN_MAPPINGS[fetch_or_fallback(WITHIN_OPTIONS, within, WITHIN_DEFAULT)]
59
59
  )
60
60
  end
61
61
 
@@ -10,7 +10,7 @@ module Polaris
10
10
  **system_arguments
11
11
  )
12
12
  @system_arguments = system_arguments
13
- @system_arguments[:tag] = url.present? ? 'a' : 'button'
13
+ @system_arguments[:tag] = url.present? ? "a" : "button"
14
14
  if loading
15
15
  @system_arguments[:disabled] = true
16
16
  end
@@ -20,5 +20,18 @@
20
20
  <%= content %>
21
21
  </div>
22
22
  <% end %>
23
+
24
+ <% if @disclosure.present? %>
25
+ <div class="Polaris-Button__Icon">
26
+ <% case @disclosure %>
27
+ <% when :down %>
28
+ <%= polaris_icon(name: "CaretDownMinor") %>
29
+ <% when :up %>
30
+ <%= polaris_icon(name: "CaretUpMinor") %>
31
+ <% when :select %>
32
+ <%= polaris_icon(name: "SelectMinor") %>
33
+ <% end %>
34
+ </div>
35
+ <% end %>
23
36
  </span>
24
37
  <% end %>
@@ -7,17 +7,17 @@ module Polaris
7
7
  SPACING_DEFAULT => "",
8
8
  :extra_tight => "Polaris-ButtonGroup--extraTight",
9
9
  :tight => "Polaris-ButtonGroup--tight",
10
- :loose => "Polaris-ButtonGroup--loose",
10
+ :loose => "Polaris-ButtonGroup--loose"
11
11
  }
12
12
  SPACING_OPTIONS = SPACING_MAPPINGS.keys
13
13
 
14
- renders_many :buttons, -> (**system_arguments) do
14
+ renders_many :buttons, ->(**system_arguments) do
15
15
  @counter += 1
16
16
 
17
17
  ButtonGroupItemButtonComponent.new(position: @counter, **system_arguments)
18
18
  end
19
19
 
20
- renders_many :items, -> (**system_arguments) do
20
+ renders_many :items, ->(**system_arguments) do
21
21
  @counter += 1
22
22
 
23
23
  ButtonGroupItemComponent.new(position: @counter, **system_arguments)
@@ -47,7 +47,7 @@ module Polaris
47
47
  "Polaris-ButtonGroup",
48
48
  SPACING_MAPPINGS[fetch_or_fallback(SPACING_OPTIONS, spacing, SPACING_DEFAULT)],
49
49
  "Polaris-ButtonGroup--fullWidth": full_width,
50
- "Polaris-ButtonGroup--segmented": segmented,
50
+ "Polaris-ButtonGroup--segmented": segmented
51
51
  )
52
52
  end
53
53
 
@@ -97,7 +97,7 @@ module Polaris
97
97
  @system_arguments[:tag] = :div
98
98
  @system_arguments[:classes] = class_names(
99
99
  @system_arguments[:classes],
100
- "Polaris-ButtonGroup__Item",
100
+ "Polaris-ButtonGroup__Item"
101
101
  )
102
102
  end
103
103
 
@@ -3,10 +3,10 @@
3
3
  module Polaris
4
4
  class CalloutCardComponent < Polaris::NewComponent
5
5
  renders_one :primary_action, Polaris::ButtonComponent
6
- renders_one :secondary_action, -> (plain: true, **system_arguments) do
6
+ renders_one :secondary_action, ->(plain: true, **system_arguments) do
7
7
  Polaris::ButtonComponent.new(plain: plain, **system_arguments)
8
8
  end
9
- renders_one :dismiss_button, -> (**system_arguments) do
9
+ renders_one :dismiss_button, ->(**system_arguments) do
10
10
  render Polaris::ButtonComponent.new(plain: true, **system_arguments) do |button|
11
11
  button.icon(name: "CancelSmallMinor")
12
12
  end
@@ -24,21 +24,21 @@ module Polaris
24
24
  @system_arguments[:tag] = "div"
25
25
  @system_arguments[:classes] = class_names(
26
26
  @system_arguments[:classes],
27
- "Polaris-Card",
27
+ "Polaris-Card"
28
28
  )
29
29
  end
30
30
 
31
31
  def container_classes
32
32
  class_names(
33
33
  "Polaris-CalloutCard__Container",
34
- "Polaris-CalloutCard--hasDismiss": dismiss_button.present?,
34
+ "Polaris-CalloutCard--hasDismiss": dismiss_button.present?
35
35
  )
36
36
  end
37
37
 
38
38
  def image_classes
39
39
  class_names(
40
40
  "Polaris-CalloutCard__Image",
41
- "Polaris-CalloutCard__DismissImage": dismiss_button.present?,
41
+ "Polaris-CalloutCard__DismissImage": dismiss_button.present?
42
42
  )
43
43
  end
44
44
  end
@@ -4,10 +4,10 @@ module Polaris
4
4
  class CaptionComponent < Polaris::NewComponent
5
5
  def initialize(**system_arguments)
6
6
  @system_arguments = system_arguments
7
- @system_arguments[:tag] = 'p'
7
+ @system_arguments[:tag] = "p"
8
8
  @system_arguments[:classes] = class_names(
9
9
  @system_arguments[:classes],
10
- "Polaris-Caption",
10
+ "Polaris-Caption"
11
11
  )
12
12
  end
13
13
 
@@ -1,6 +1,4 @@
1
1
  class Polaris::Card::HeaderComponent < Polaris::NewComponent
2
- include Polaris::ActionHelper
3
-
4
2
  def initialize(
5
3
  title: "",
6
4
  actions: [],
@@ -10,7 +8,7 @@ class Polaris::Card::HeaderComponent < Polaris::NewComponent
10
8
  @system_arguments[:tag] = :div
11
9
  @system_arguments[:classes] = class_names(
12
10
  @system_arguments[:classes],
13
- "Polaris-Card__Header",
11
+ "Polaris-Card__Header"
14
12
  )
15
13
 
16
14
  @title = title