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,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Polaris
4
+ class FiltersComponent < Polaris::NewComponent
5
+ renders_one :query, "QueryComponent"
6
+
7
+ def initialize(**system_arguments)
8
+ @system_arguments = system_arguments
9
+ end
10
+
11
+ def system_arguments
12
+ @system_arguments.tap do |opts|
13
+ opts[:tag] = "div"
14
+ opts[:classes] = class_names(
15
+ @system_arguments[:classes],
16
+ "Polaris-Filters"
17
+ )
18
+ end
19
+ end
20
+
21
+ class QueryComponent < Polaris::NewComponent
22
+ def initialize(clear_button: true, **system_arguments)
23
+ @system_arguments = system_arguments.merge(
24
+ label_hidden: true,
25
+ clear_button: clear_button
26
+ )
27
+ end
28
+
29
+ def call
30
+ polaris_text_field(**@system_arguments) do |text_field|
31
+ text_field.prefix do
32
+ polaris_icon(name: "SearchMinor")
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -6,7 +6,7 @@ module Polaris
6
6
  @system_arguments = system_arguments
7
7
  @system_arguments[:classes] = class_names(
8
8
  @system_arguments[:classes],
9
- "Polaris-FooterHelp",
9
+ "Polaris-FooterHelp"
10
10
  )
11
11
  end
12
12
  end
@@ -10,7 +10,7 @@ class Polaris::FormLayout::GroupComponent < Polaris::NewComponent
10
10
  @system_arguments[:tag] = "div"
11
11
  @system_arguments[:classes] = class_names(
12
12
  @system_arguments[:classes],
13
- "Polaris-FormLayout__Items",
13
+ "Polaris-FormLayout__Items"
14
14
  )
15
15
 
16
16
  @wrapper_arguments = {}
@@ -18,7 +18,7 @@ class Polaris::FormLayout::GroupComponent < Polaris::NewComponent
18
18
  @wrapper_arguments[:role] = "group"
19
19
  @wrapper_arguments[:classes] = class_names(
20
20
  "Polaris-FormLayout--grouped": !condensed,
21
- "Polaris-FormLayout--condensed": condensed,
21
+ "Polaris-FormLayout--condensed": condensed
22
22
  )
23
23
  end
24
24
 
@@ -28,7 +28,7 @@ class Polaris::FormLayout::GroupComponent < Polaris::NewComponent
28
28
  @system_arguments[:tag] = "div"
29
29
  @system_arguments[:classes] = class_names(
30
30
  @system_arguments[:classes],
31
- "Polaris-FormLayout__Item",
31
+ "Polaris-FormLayout__Item"
32
32
  )
33
33
  end
34
34
 
@@ -8,7 +8,7 @@ class Polaris::FormLayout::ItemComponent < Polaris::NewComponent
8
8
  @system_arguments[:tag] = "div"
9
9
  @system_arguments[:classes] = class_names(
10
10
  @system_arguments[:classes],
11
- "Polaris-FormLayout__Item",
11
+ "Polaris-FormLayout__Item"
12
12
  )
13
13
  end
14
14
 
@@ -2,11 +2,11 @@
2
2
 
3
3
  module Polaris
4
4
  class FormLayoutComponent < Polaris::NewComponent
5
- renders_many :items, -> (**system_arguments) do
5
+ renders_many :items, ->(**system_arguments) do
6
6
  @counter += 1
7
7
  Polaris::FormLayout::ItemComponent.new(position: @counter, **system_arguments)
8
8
  end
9
- renders_many :groups, -> (**system_arguments) do
9
+ renders_many :groups, ->(**system_arguments) do
10
10
  @counter += 1
11
11
  Polaris::FormLayout::GroupComponent.new(position: @counter, **system_arguments)
12
12
  end
@@ -18,7 +18,7 @@ module Polaris
18
18
  @system_arguments[:tag] = "div"
19
19
  @system_arguments[:classes] = class_names(
20
20
  @system_arguments[:classes],
21
- "Polaris-FormLayout",
21
+ "Polaris-FormLayout"
22
22
  )
23
23
  end
24
24
 
@@ -13,7 +13,7 @@ module Polaris
13
13
  @system_arguments[:tag] = element
14
14
  @system_arguments[:classes] = class_names(
15
15
  @system_arguments[:classes],
16
- 'Polaris-Heading'
16
+ "Polaris-Heading"
17
17
  )
18
18
  end
19
19
 
@@ -19,4 +19,17 @@
19
19
  <%= content %>
20
20
  </div>
21
21
  <% end %>
22
+
23
+ <% if @disclosure.present? %>
24
+ <div class="Polaris-Button__Icon">
25
+ <% case @disclosure %>
26
+ <% when :down %>
27
+ <%= polaris_icon(name: "CaretDownMinor") %>
28
+ <% when :up %>
29
+ <%= polaris_icon(name: "CaretUpMinor") %>
30
+ <% when :select %>
31
+ <%= polaris_icon(name: "SelectMinor") %>
32
+ <% end %>
33
+ </div>
34
+ <% end %>
22
35
  </span>
@@ -6,7 +6,7 @@ module Polaris
6
6
  SIZE_MAPPINGS = {
7
7
  SIZE_DEFAULT => "",
8
8
  :slim => "Polaris-Button--sizeSlim",
9
- :large => "Polaris-Button--sizeLarge",
9
+ :large => "Polaris-Button--sizeLarge"
10
10
  }
11
11
  SIZE_OPTIONS = SIZE_MAPPINGS.keys
12
12
 
@@ -15,10 +15,13 @@ module Polaris
15
15
  TEXT_ALIGN_DEFAULT => "",
16
16
  :left => "Polaris-Button--textAlignLeft",
17
17
  :center => "Polaris-Button--textAlignCenter",
18
- :right => "Polaris-Button--textAlignRight",
18
+ :right => "Polaris-Button--textAlignRight"
19
19
  }
20
20
  TEXT_ALIGN_OPTIONS = TEXT_ALIGN_MAPPINGS.keys
21
21
 
22
+ DISCLOSURE_DEFAULT = false
23
+ DISCLOSURE_OPTIONS = [true, false, :down, :up, :select]
24
+
22
25
  renders_one :icon, IconComponent
23
26
 
24
27
  def initialize(
@@ -31,6 +34,8 @@ module Polaris
31
34
  loading: false,
32
35
  destructive: false,
33
36
  disabled: false,
37
+ disable_with_loader: false,
38
+ disclosure: DISCLOSURE_DEFAULT,
34
39
  external: false,
35
40
  full_width: false,
36
41
  submit: false,
@@ -39,15 +44,17 @@ module Polaris
39
44
  text_align: TEXT_ALIGN_DEFAULT,
40
45
  **system_arguments
41
46
  )
42
- @tag = url.present? ? 'a' : 'button'
47
+ @tag = url.present? ? "a" : "button"
43
48
  @text_classes = class_names(
44
49
  "Polaris-Button__Text",
45
50
  "Polaris-Button--removeUnderline": plain && monochrome && remove_underline
46
51
  )
47
52
  @loading = loading
53
+ @disclosure = fetch_or_fallback(DISCLOSURE_OPTIONS, disclosure, DISCLOSURE_DEFAULT)
54
+ @disclosure = :down if @disclosure === true
48
55
 
49
56
  @system_arguments = system_arguments
50
- @system_arguments[:type] = submit ? 'submit' : 'button'
57
+ @system_arguments[:type] = submit ? "submit" : "button"
51
58
  if loading
52
59
  @system_arguments[:disabled] = true
53
60
  end
@@ -59,6 +66,11 @@ module Polaris
59
66
  if disabled
60
67
  @system_arguments[:disabled] = disabled
61
68
  end
69
+ @system_arguments[:data] ||= {}
70
+ prepend_option(@system_arguments[:data], :controller, "polaris-button")
71
+ if disable_with_loader
72
+ prepend_option(@system_arguments[:data], :action, "polaris-button#disable")
73
+ end
62
74
  @system_arguments[:classes] = class_names(
63
75
  @system_arguments[:classes],
64
76
  "Polaris-Button",
@@ -80,7 +92,7 @@ module Polaris
80
92
  def system_arguments
81
93
  @system_arguments[:classes] = class_names(
82
94
  @system_arguments[:classes],
83
- "Polaris-Button--iconOnly": icon.present? && content.blank?,
95
+ "Polaris-Button--iconOnly": icon.present? && content.blank?
84
96
  )
85
97
  @system_arguments
86
98
  end
@@ -11,7 +11,7 @@ module Polaris
11
11
  :warning => "Polaris-Icon--colorWarning",
12
12
  :highlight => "Polaris-Icon--colorHighlight",
13
13
  :success => "Polaris-Icon--colorSuccess",
14
- :primary => "Polaris-Icon--colorPrimary",
14
+ :primary => "Polaris-Icon--colorPrimary"
15
15
  }
16
16
  COLOR_OPTIONS = COLOR_MAPPINGS.keys
17
17
 
@@ -29,7 +29,7 @@ module Polaris
29
29
  "Polaris-Icon",
30
30
  COLOR_MAPPINGS[fetch_or_fallback(COLOR_OPTIONS, color, COLOR_DEFAULT)],
31
31
  "Polaris-Icon--hasBackdrop" => backdrop,
32
- "Polaris-Icon--applyColor" => color != :default,
32
+ "Polaris-Icon--applyColor" => color != :default
33
33
  )
34
34
  end
35
35
  end
@@ -0,0 +1,22 @@
1
+ class Polaris::IndexTable::CellComponent < Polaris::NewComponent
2
+ def initialize(flush: false, **system_arguments)
3
+ @flush = flush
4
+ @system_arguments = system_arguments
5
+ end
6
+
7
+ def system_arguments
8
+ {tag: "td"}.deep_merge(@system_arguments).tap do |args|
9
+ args[:classes] = class_names(
10
+ args[:classes],
11
+ "Polaris-IndexTable__TableCell",
12
+ "Polaris-IndexTable__TableCell--flush": @flush
13
+ )
14
+ end
15
+ end
16
+
17
+ def call
18
+ render(Polaris::BaseComponent.new(**system_arguments)) do
19
+ content
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,13 @@
1
+ class Polaris::IndexTable::ColumnComponent < Polaris::NewComponent
2
+ attr_reader :title, :flush
3
+
4
+ def initialize(title, flush: false, **system_arguments, &block)
5
+ @title = title
6
+ @flush = flush
7
+ @block = block
8
+ end
9
+
10
+ def call(row)
11
+ @block.call(row)
12
+ end
13
+ end
@@ -0,0 +1,28 @@
1
+ <%= render Polaris::BaseComponent.new(**system_arguments) do %>
2
+ <div class="Polaris-IndexTable-ScrollContainer">
3
+ <table class="Polaris-IndexTable__Table">
4
+ <thead>
5
+ <tr>
6
+ <% columns.each_with_index do |column, index| %>
7
+ <th class="Polaris-IndexTable__TableHeading">
8
+ <%= column.title %>
9
+ </th>
10
+ <% end %>
11
+ </tr>
12
+ </thead>
13
+ <tbody>
14
+ <% @data.each do |row| %>
15
+ <tr class="Polaris-IndexTable__TableRow Polaris-IndexTable__TableRow--unclickable">
16
+ <% columns.each_with_index do |column, index| %>
17
+ <%= render_cell(
18
+ flush: column.flush,
19
+ ) do %>
20
+ <%= column.call(row) %>
21
+ <% end %>
22
+ <% end %>
23
+ </tr>
24
+ <% end %>
25
+ </tbody>
26
+ </table>
27
+ </div>
28
+ <% end %>
@@ -0,0 +1,25 @@
1
+ module Polaris
2
+ class IndexTableComponent < Polaris::NewComponent
3
+ renders_many :columns, ->(title, **system_arguments, &block) do
4
+ IndexTable::ColumnComponent.new(title, **system_arguments, &block)
5
+ end
6
+
7
+ def initialize(data, **system_arguments)
8
+ @data = data
9
+ @system_arguments = system_arguments
10
+ end
11
+
12
+ def system_arguments
13
+ {tag: "div"}.deep_merge(@system_arguments).tap do |args|
14
+ args[:classes] = class_names(
15
+ args[:classes],
16
+ "Polaris-IndexTable"
17
+ )
18
+ end
19
+ end
20
+
21
+ def render_cell(**arguments, &block)
22
+ render(IndexTable::CellComponent.new(**arguments), &block)
23
+ end
24
+ end
25
+ end
@@ -1,6 +1,6 @@
1
- <div class="Polaris-InlineError">
1
+ <%= render(Polaris::BaseComponent.new(**@system_arguments)) do %>
2
2
  <div class="Polaris-InlineError__Icon">
3
3
  <%= polaris_icon(name: "AlertMinor") %>
4
4
  </div>
5
5
  <%= content %>
6
- </div>
6
+ <% end %>
@@ -2,7 +2,13 @@
2
2
 
3
3
  module Polaris
4
4
  class InlineErrorComponent < Polaris::NewComponent
5
- def initialize
5
+ def initialize(**system_arguments)
6
+ @system_arguments = system_arguments
7
+ @system_arguments[:tag] = "div"
8
+ @system_arguments[:classes] = class_names(
9
+ @system_arguments[:classes],
10
+ "Polaris-InlineError"
11
+ )
6
12
  end
7
13
 
8
14
  def renders?
@@ -19,13 +19,13 @@ module Polaris
19
19
  @system_arguments[:tag] = "div"
20
20
  @system_arguments[:classes] = class_names(
21
21
  @system_arguments[:classes],
22
- "Polaris-Label",
22
+ "Polaris-Label"
23
23
  )
24
24
 
25
25
  @label_options = {}
26
26
  @label_options[:class] = class_names(
27
27
  "Polaris-Label__Text",
28
- "Polaris-Label__RequiredIndicator": required,
28
+ "Polaris-Label__RequiredIndicator": required
29
29
  )
30
30
  end
31
31
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Polaris
4
4
  class LabelledComponent < Polaris::NewComponent
5
- renders_one :label_action, -> (**system_arguments) do
5
+ renders_one :label_action, ->(**system_arguments) do
6
6
  Polaris::ButtonComponent.new(plain: true, **system_arguments)
7
7
  end
8
8
 
@@ -38,7 +38,7 @@ module Polaris
38
38
  attribute: attribute,
39
39
  name: name,
40
40
  label: label,
41
- required: required,
41
+ required: required
42
42
  }
43
43
  end
44
44
 
@@ -13,7 +13,7 @@ module Polaris
13
13
  @system_arguments = system_arguments
14
14
  @system_arguments[:classes] = class_names(
15
15
  @system_arguments[:classes],
16
- "Polaris-Layout__AnnotatedSection",
16
+ "Polaris-Layout__AnnotatedSection"
17
17
  )
18
18
  end
19
19
  end
@@ -11,6 +11,7 @@ module Polaris
11
11
  full_width: false,
12
12
  one_half: false,
13
13
  one_third: false,
14
+ one_fourth: false,
14
15
  **system_arguments
15
16
  )
16
17
  @position = position
@@ -24,6 +25,7 @@ module Polaris
24
25
  "Polaris-Layout__Section--fullWidth" => full_width,
25
26
  "Polaris-Layout__Section--oneHalf" => one_half,
26
27
  "Polaris-Layout__Section--oneThird" => one_third,
28
+ "Polaris-Layout__Section--oneFourth" => one_fourth
27
29
  )
28
30
  end
29
31
 
@@ -9,7 +9,7 @@ module Polaris
9
9
  # @param one_half [Boolean] The section will only take up 50% of the width
10
10
  # @param one_third [Boolean] The section will only take up 33.33% of the width
11
11
  # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
12
- renders_many :sections, -> (**system_arguments) do
12
+ renders_many :sections, ->(**system_arguments) do
13
13
  @counter += 1
14
14
  Layout::Section.new(position: @counter, **system_arguments)
15
15
  end
@@ -19,7 +19,7 @@ module Polaris
19
19
  # @param title [String] Title
20
20
  # @param description [String] Description
21
21
  # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
22
- renders_many :annotated_sections, -> (**system_arguments) do
22
+ renders_many :annotated_sections, ->(**system_arguments) do
23
23
  @counter += 1
24
24
  Layout::AnnotatedSection.new(position: @counter, **system_arguments)
25
25
  end
@@ -29,7 +29,7 @@ module Polaris
29
29
  @system_arguments = system_arguments
30
30
  @system_arguments[:classes] = class_names(
31
31
  @system_arguments[:classes],
32
- 'Polaris-Layout'
32
+ "Polaris-Layout"
33
33
  )
34
34
  end
35
35
 
@@ -6,6 +6,7 @@ module Polaris
6
6
  url:,
7
7
  external: false,
8
8
  monochrome: false,
9
+ no_underline: false,
9
10
  **system_arguments
10
11
  )
11
12
  @url = url
@@ -23,14 +24,15 @@ module Polaris
23
24
  @system_arguments[:classes],
24
25
  "Polaris-Link",
25
26
  "Polaris-Link--monochrome" => monochrome,
27
+ "Polaris-Link--removeUnderline" => no_underline
26
28
  )
27
29
  end
28
30
 
29
31
  def call
30
32
  render(Polaris::BaseComponent.new(**@system_arguments)) do
31
33
  safe_join [
32
- content.strip,
33
- (external_icon if @external),
34
+ content.strip.html_safe,
35
+ (external_icon if @external)
34
36
  ].compact
35
37
  end
36
38
  end
@@ -40,7 +42,7 @@ module Polaris
40
42
  def external_icon
41
43
  tag.span(class: "Polaris-Link__IconLockup") do
42
44
  tag.span(class: "Polaris-Link__IconLayout") do
43
- polaris_icon(name: "ExternalSmallMinor", aria: { label: "(opens a new window)" })
45
+ polaris_icon(name: "ExternalSmallMinor", aria: {label: "(opens a new window)"})
44
46
  end
45
47
  end
46
48
  end
@@ -7,11 +7,11 @@ module Polaris
7
7
  TYPE_DEFAULT = :bullet
8
8
  TYPE_TAG_MAPPINGS = {
9
9
  bullet: :ul,
10
- number: :ol,
10
+ number: :ol
11
11
  }
12
12
  TYPE_CLASS_MAPPINGS = {
13
13
  bullet: "",
14
- number: "Polaris-List--typeNumber",
14
+ number: "Polaris-List--typeNumber"
15
15
  }
16
16
  TYPE_OPTIONS = TYPE_TAG_MAPPINGS.keys
17
17
 
@@ -24,7 +24,7 @@ module Polaris
24
24
  @system_arguments[:classes] = class_names(
25
25
  @system_arguments[:classes],
26
26
  "Polaris-List",
27
- TYPE_CLASS_MAPPINGS[fetch_or_fallback(TYPE_OPTIONS, type, "")],
27
+ TYPE_CLASS_MAPPINGS[fetch_or_fallback(TYPE_OPTIONS, type, "")]
28
28
  )
29
29
  end
30
30
 
@@ -0,0 +1,19 @@
1
+ class Polaris::Modal::SectionComponent < Polaris::NewComponent
2
+ def initialize(**system_arguments)
3
+ @system_arguments = system_arguments
4
+ end
5
+
6
+ def system_arguments
7
+ @system_arguments.tap do |opts|
8
+ opts[:tag] = "div"
9
+ opts[:classes] = class_names(
10
+ @system_arguments[:classes],
11
+ "Polaris-Modal-Section"
12
+ )
13
+ end
14
+ end
15
+
16
+ def call
17
+ render(Polaris::BaseComponent.new(**system_arguments)) { content }
18
+ end
19
+ end
@@ -0,0 +1,79 @@
1
+ <% modal_content = capture do %>
2
+ <% if sections.present? %>
3
+ <% sections.each do |section| %>
4
+ <%= section %>
5
+ <% end %>
6
+ <% end %>
7
+
8
+ <% if content.present? %>
9
+ <% if @sectioned %>
10
+ <%= render Polaris::Modal::SectionComponent.new do %>
11
+ <%= content %>
12
+ <% end %>
13
+ <% else %>
14
+ <%= content %>
15
+ <% end %>
16
+ <% end %>
17
+ <% end %>
18
+
19
+ <%= render(Polaris::BaseComponent.new(**system_arguments)) do %>
20
+ <div>
21
+ <%= render(Polaris::BaseComponent.new(**dialog_arguments)) do %>
22
+ <div class="<%= modal_classes %>">
23
+ <div class="<%= header_classes %>">
24
+ <div class="Polaris-Modal-Header__Title">
25
+ <%= polaris_display_text(element: :h2, size: :small) do %>
26
+ <%= @title %>
27
+ <% end %>
28
+ </div>
29
+ <% if close_button.present? %>
30
+ <%= close_button %>
31
+ <% else %>
32
+ <%= render(Polaris::BaseComponent.new(**close_button_arguments)) do %>
33
+ <%= polaris_icon(name: "MobileCancelMajor", color: :base) %>
34
+ <% end %>
35
+ <% end %>
36
+ </div>
37
+
38
+ <div class="Polaris-Modal__BodyWrapper">
39
+ <% if @scrollable %>
40
+ <%= polaris_scrollable(classes: "Polaris-Modal__Body") do %>
41
+ <%= modal_content %>
42
+ <% end %>
43
+ <% else %>
44
+ <%= modal_content %>
45
+ <% end %>
46
+ </div>
47
+
48
+ <% if render_footer? %>
49
+ <div class="Polaris-Modal-Footer">
50
+ <div class="Polaris-Modal-Footer__FooterContent">
51
+ <%= polaris_stack(alignment: :center) do |stack| %>
52
+ <% stack.item(fill: true) do %>
53
+ <% end %>
54
+
55
+ <% stack.item do %>
56
+ <%= polaris_button_group do |group| %>
57
+ <% if secondary_actions %>
58
+ <% secondary_actions.each do |action| %>
59
+ <% group.item do %>
60
+ <%= action %>
61
+ <% end %>
62
+ <% end %>
63
+
64
+ <% if primary_action %>
65
+ <% group.item do %>
66
+ <%= primary_action %>
67
+ <% end %>
68
+ <% end %>
69
+ <% end %>
70
+ <% end %>
71
+ <% end %>
72
+ <% end %>
73
+ </div>
74
+ </div>
75
+ <% end %>
76
+ </div>
77
+ <% end %>
78
+ </div>
79
+ <% end %>