polaris_view_components 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +12 -2
  3. data/app/assets/javascripts/polaris_view_components/autocomplete_controller.js +119 -0
  4. data/app/assets/javascripts/polaris_view_components/button_controller.js +4 -5
  5. data/app/assets/javascripts/polaris_view_components/frame_controller.js +41 -0
  6. data/app/assets/javascripts/polaris_view_components/index.js +9 -1
  7. data/app/assets/javascripts/polaris_view_components/option_list_controller.js +41 -0
  8. data/app/assets/javascripts/polaris_view_components/polaris_controller.js +4 -0
  9. data/app/assets/javascripts/polaris_view_components/popover_controller.js +6 -2
  10. data/app/assets/javascripts/polaris_view_components/text_field_controller.js +4 -0
  11. data/app/assets/javascripts/polaris_view_components/toast_controller.js +68 -0
  12. data/app/assets/javascripts/polaris_view_components.js +415 -18
  13. data/app/assets/stylesheets/polaris_view_components/custom.css +41 -0
  14. data/app/assets/stylesheets/polaris_view_components.css +25 -0
  15. data/app/components/polaris/autocomplete/action_component.rb +7 -0
  16. data/app/components/polaris/autocomplete/option_component.rb +35 -0
  17. data/app/components/polaris/autocomplete/section_component.html.erb +9 -0
  18. data/app/components/polaris/autocomplete/section_component.rb +12 -0
  19. data/app/components/polaris/autocomplete_component.html.erb +30 -0
  20. data/app/components/polaris/autocomplete_component.rb +58 -0
  21. data/app/components/polaris/base_checkbox.rb +48 -0
  22. data/app/components/polaris/base_radio_button.rb +38 -0
  23. data/app/components/polaris/checkbox_component.html.erb +1 -5
  24. data/app/components/polaris/checkbox_component.rb +15 -8
  25. data/app/components/polaris/choice_list_component.rb +1 -1
  26. data/app/components/polaris/filters_component.html.erb +22 -0
  27. data/app/components/polaris/filters_component.rb +57 -4
  28. data/app/components/polaris/frame/save_bar_component.html.erb +23 -0
  29. data/app/components/polaris/frame/save_bar_component.rb +31 -0
  30. data/app/components/polaris/frame/top_bar_component.html.erb +30 -0
  31. data/app/components/polaris/frame/top_bar_component.rb +18 -0
  32. data/app/components/polaris/frame_component.html.erb +44 -0
  33. data/app/components/polaris/frame_component.rb +33 -0
  34. data/app/components/polaris/logo.rb +13 -0
  35. data/app/components/polaris/navigation/item_component.html.erb +31 -0
  36. data/app/components/polaris/navigation/item_component.rb +85 -0
  37. data/app/components/polaris/navigation/section_component.html.erb +17 -0
  38. data/app/components/polaris/navigation/section_component.rb +64 -0
  39. data/app/components/polaris/navigation_component.html.erb +29 -0
  40. data/app/components/polaris/navigation_component.rb +15 -0
  41. data/app/components/polaris/option_list/checkbox_component.html.erb +14 -0
  42. data/app/components/polaris/option_list/checkbox_component.rb +37 -0
  43. data/app/components/polaris/option_list/option_component.rb +24 -0
  44. data/app/components/polaris/option_list/radio_button_component.rb +54 -0
  45. data/app/components/polaris/option_list/section_component.html.erb +14 -0
  46. data/app/components/polaris/option_list/section_component.rb +53 -0
  47. data/app/components/polaris/option_list_component.html.erb +15 -0
  48. data/app/components/polaris/option_list_component.rb +67 -0
  49. data/app/components/polaris/popover_component.html.erb +2 -9
  50. data/app/components/polaris/popover_component.rb +17 -0
  51. data/app/components/polaris/radio_button_component.html.erb +1 -6
  52. data/app/components/polaris/radio_button_component.rb +14 -4
  53. data/app/components/polaris/text_field_component.rb +16 -2
  54. data/app/components/polaris/toast_component.html.erb +21 -0
  55. data/app/components/polaris/toast_component.rb +40 -0
  56. data/app/components/polaris/top_bar/user_menu_component.html.erb +19 -0
  57. data/app/components/polaris/top_bar/user_menu_component.rb +9 -0
  58. data/app/helpers/polaris/form_builder.rb +2 -2
  59. data/app/helpers/polaris/view_helper.rb +11 -0
  60. data/lib/polaris/view_components/engine.rb +5 -1
  61. data/lib/polaris/view_components/version.rb +1 -1
  62. metadata +46 -9
@@ -0,0 +1,85 @@
1
+ class Polaris::Navigation::ItemComponent < Polaris::NewComponent
2
+ renders_many :sub_items, Polaris::Navigation::ItemComponent
3
+ renders_one :secondary_action, "SecondaryActionComponent"
4
+
5
+ attr_reader :selected
6
+
7
+ def initialize(
8
+ url:,
9
+ label:,
10
+ icon: nil,
11
+ badge: nil,
12
+ selected: false,
13
+ disabled: false,
14
+ **system_arguments
15
+ )
16
+ @url = url
17
+ @label = label
18
+ @icon = icon
19
+ @badge = badge
20
+ @selected = selected
21
+ @disabled = disabled
22
+ @system_arguments = system_arguments
23
+ end
24
+
25
+ def system_arguments
26
+ @system_arguments.tap do |opts|
27
+ opts[:tag] = "li"
28
+ opts[:classes] = class_names(
29
+ @system_arguments[:classes],
30
+ "Polaris-Navigation__ListItem"
31
+ )
32
+ end
33
+ end
34
+
35
+ def link_classes
36
+ class_names(
37
+ "Polaris-Navigation__Item",
38
+ "Polaris-Navigation__Item--selected": @selected,
39
+ "Polaris-Navigation--subNavigationActive": @selected || selected_sub_items?,
40
+ "Polaris-Navigation__Item--disabled": @disabled
41
+ )
42
+ end
43
+
44
+ def selected_sub_items?
45
+ return unless sub_items.present?
46
+
47
+ sub_items.any?(&:selected)
48
+ end
49
+
50
+ class SecondaryActionComponent < Polaris::NewComponent
51
+ def initialize(url: nil, external: false, icon: nil, **system_arguments)
52
+ @url = url
53
+ @external = external
54
+ @icon = icon
55
+ @system_arguments = system_arguments
56
+ end
57
+
58
+ def system_arguments
59
+ @system_arguments.tap do |opts|
60
+ if @url.present?
61
+ opts[:tag] = "a"
62
+ opts[:href] = @url
63
+ opts[:target] = "_blank" if @external
64
+ else
65
+ opts[:tag] = "button"
66
+ opts[:type] = "button"
67
+ end
68
+ opts[:classes] = class_names(
69
+ @system_arguments[:classes],
70
+ "Polaris-Navigation__SecondaryAction"
71
+ )
72
+ end
73
+ end
74
+
75
+ def call
76
+ render(Polaris::BaseComponent.new(**system_arguments)) do
77
+ if @icon.present?
78
+ render(Polaris::IconComponent.new(name: @icon))
79
+ else
80
+ content
81
+ end
82
+ end
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,17 @@
1
+ <%= render(Polaris::BaseComponent.new(**system_arguments)) do %>
2
+ <% if items.present? %>
3
+ <% if @title.present? %>
4
+ <li class="Polaris-Navigation__SectionHeading">
5
+ <span class="Polaris-Navigation__Text">
6
+ <%= @title %>
7
+ </span>
8
+ <%= action %>
9
+ </li>
10
+ <% end %>
11
+ <% items.each do |item| %>
12
+ <%= item %>
13
+ <% end %>
14
+ <% else %>
15
+ <%= content %>
16
+ <% end %>
17
+ <% end %>
@@ -0,0 +1,64 @@
1
+ class Polaris::Navigation::SectionComponent < Polaris::NewComponent
2
+ renders_many :items, Polaris::Navigation::ItemComponent
3
+ renders_one :action, "ActionComponent"
4
+
5
+ def initialize(
6
+ title: nil,
7
+ separator: false,
8
+ fill: false,
9
+ **system_arguments
10
+ )
11
+ @title = title
12
+ @separator = separator
13
+ @fill = fill
14
+ @system_arguments = system_arguments
15
+ end
16
+
17
+ def system_arguments
18
+ @system_arguments.tap do |opts|
19
+ opts[:tag] = "ul"
20
+ opts[:classes] = class_names(
21
+ @system_arguments[:classes],
22
+ "Polaris-Navigation__Section",
23
+ "Polaris-Navigation__Section--fill": @fill,
24
+ "Polaris-Navigation__Section--withSeparator": @separator
25
+ )
26
+ end
27
+ end
28
+
29
+ class ActionComponent < Polaris::NewComponent
30
+ def initialize(url: nil, external: false, icon: nil, **system_arguments)
31
+ @url = url
32
+ @external = external
33
+ @icon = icon
34
+ @system_arguments = system_arguments
35
+ end
36
+
37
+ def system_arguments
38
+ @system_arguments.tap do |opts|
39
+ if @url.present?
40
+ opts[:tag] = "a"
41
+ opts[:href] = @url
42
+ opts[:target] = "_blank" if @external
43
+ else
44
+ opts[:tag] = "button"
45
+ opts[:type] = "button"
46
+ end
47
+ opts[:classes] = class_names(
48
+ @system_arguments[:classes],
49
+ "Polaris-Navigation__Action"
50
+ )
51
+ end
52
+ end
53
+
54
+ def call
55
+ render(Polaris::BaseComponent.new(**system_arguments)) do
56
+ if @icon.present?
57
+ render(Polaris::IconComponent.new(name: @icon))
58
+ else
59
+ content
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,29 @@
1
+ <nav class="Polaris-Navigation">
2
+ <% if @logo.present? %>
3
+ <div class="Polaris-Navigation__LogoContainer">
4
+ <%= link_to(@logo.url,
5
+ class: "Polaris-Navigation__LogoLink",
6
+ style: "width: #{@logo.width}"
7
+ ) do %>
8
+ <%= image_tag @logo.src,
9
+ class: "Polaris-Navigation__Logo",
10
+ style: "width: #{@logo.width}",
11
+ alt: @logo.alt %>
12
+ <% end %>
13
+ </div>
14
+ <% end %>
15
+
16
+ <%= polaris_scrollable(classes: "Polaris-Navigation__PrimaryNavigation") do %>
17
+ <% if sections.present? %>
18
+ <% sections.each do |section| %>
19
+ <%= section %>
20
+ <% end %>
21
+ <% else %>
22
+ <%= render(Polaris::Navigation::SectionComponent.new) do %>
23
+ <% items.each do |item| %>
24
+ <%= item %>
25
+ <% end %>
26
+ <% end %>
27
+ <% end %>
28
+ <% end %>
29
+ </nav>
@@ -0,0 +1,15 @@
1
+ module Polaris
2
+ class NavigationComponent < Polaris::NewComponent
3
+ renders_many :sections, Polaris::Navigation::SectionComponent
4
+ renders_many :items, Polaris::Navigation::ItemComponent
5
+
6
+ def initialize(logo: nil, **system_arguments)
7
+ @logo = logo.is_a?(Hash) ? Polaris::Logo.new(**logo) : logo
8
+ @system_arguments = system_arguments
9
+ end
10
+
11
+ def renders?
12
+ sections.any? || items.any?
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,14 @@
1
+ <%= render(Polaris::BaseComponent.new(**wrapper_arguments)) do %>
2
+ <label class="Polaris-OptionList-Option__Label">
3
+ <div class="Polaris-OptionList-Option__Checkbox">
4
+ <div class="Polaris-OptionList-Checkbox">
5
+ <%= checkbox %>
6
+ <div class="Polaris-OptionList-Checkbox__Backdrop"></div>
7
+ <div class="Polaris-OptionList-Checkbox__Icon">
8
+ <%= polaris_icon(name: "TickMinor") %>
9
+ </div>
10
+ </div>
11
+ </div>
12
+ <%= @label %>
13
+ </label>
14
+ <% end %>
@@ -0,0 +1,37 @@
1
+ class Polaris::OptionList::CheckboxComponent < Polaris::NewComponent
2
+ def initialize(
3
+ label:,
4
+ value:,
5
+ wrapper_arguments: {},
6
+ **system_arguments
7
+ )
8
+ @label = label
9
+ @value = value
10
+ @wrapper_arguments = wrapper_arguments
11
+ @system_arguments = system_arguments
12
+ end
13
+
14
+ def wrapper_arguments
15
+ @wrapper_arguments.tap do |opts|
16
+ opts[:tag] = "li"
17
+ opts[:tabindex] = "-1"
18
+ opts[:classes] = class_names(
19
+ @wrapper_arguments[:classes],
20
+ "Polaris-OptionList-Option"
21
+ )
22
+ end
23
+ end
24
+
25
+ def system_arguments
26
+ @system_arguments.tap do |opts|
27
+ opts[:classes] = class_names(
28
+ @system_arguments[:classes],
29
+ "Polaris-OptionList-Checkbox__Input"
30
+ )
31
+ end
32
+ end
33
+
34
+ def checkbox
35
+ render Polaris::BaseCheckbox.new(value: @value, **system_arguments)
36
+ end
37
+ end
@@ -0,0 +1,24 @@
1
+ class Polaris::OptionList::OptionComponent < 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] = "li"
9
+ opts[:tabindex] = "-1"
10
+ opts[:classes] = class_names(
11
+ @system_arguments[:classes],
12
+ "Polaris-OptionList-Option"
13
+ )
14
+ end
15
+ end
16
+
17
+ def call
18
+ render(Polaris::BaseComponent.new(**system_arguments)) do
19
+ tag.label(class: "Polaris-OptionList-Option__Label") do
20
+ content
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,54 @@
1
+ class Polaris::OptionList::RadioButtonComponent < Polaris::NewComponent
2
+ def initialize(
3
+ label:,
4
+ value:,
5
+ wrapper_arguments: {},
6
+ **system_arguments
7
+ )
8
+ @label = label
9
+ @value = value
10
+ @wrapper_arguments = wrapper_arguments
11
+ @system_arguments = system_arguments
12
+ end
13
+
14
+ def wrapper_arguments
15
+ @wrapper_arguments.tap do |opts|
16
+ opts[:tag] = "li"
17
+ opts[:tabindex] = "-1"
18
+ opts[:classes] = class_names(
19
+ @wrapper_arguments[:classes],
20
+ "Polaris-OptionList-Option"
21
+ )
22
+ end
23
+ end
24
+
25
+ def system_arguments
26
+ @system_arguments.tap do |opts|
27
+ opts[:classes] = class_names(
28
+ @system_arguments[:classes],
29
+ "Polaris--hidden"
30
+ )
31
+ end
32
+ end
33
+
34
+ def call
35
+ render(Polaris::BaseComponent.new(**wrapper_arguments)) do
36
+ tag.label(
37
+ class: "Polaris-OptionList-Option__SingleSelectOption",
38
+ data: {
39
+ polaris_option_list_target: "radioButton",
40
+ action: "click->polaris-option-list#update"
41
+ }
42
+ ) do
43
+ safe_join [
44
+ radio_button,
45
+ @label
46
+ ]
47
+ end
48
+ end
49
+ end
50
+
51
+ def radio_button
52
+ render Polaris::BaseRadioButton.new(value: @value, **system_arguments)
53
+ end
54
+ end
@@ -0,0 +1,14 @@
1
+ <li>
2
+ <% if @title.present? %>
3
+ <p class="Polaris-OptionList__Title"><%= @title %></p>
4
+ <% end %>
5
+ <ul class="Polaris-OptionList__Options">
6
+ <% if items.present? %>
7
+ <% items.each do |item| %>
8
+ <%= item %>
9
+ <% end %>
10
+ <% else %>
11
+ <%= content %>
12
+ <% end %>
13
+ </ul>
14
+ </li>
@@ -0,0 +1,53 @@
1
+ class Polaris::OptionList::SectionComponent < Polaris::NewComponent
2
+ renders_many :options, Polaris::OptionList::OptionComponent
3
+ renders_many :radio_buttons, ->(value:, **system_arguments) do
4
+ Polaris::OptionList::RadioButtonComponent.new(
5
+ form: @form,
6
+ attribute: @attribute,
7
+ name: @name,
8
+ value: value,
9
+ checked: @selected.include?(value),
10
+ **system_arguments
11
+ )
12
+ end
13
+ renders_many :checkboxes, ->(value:, **system_arguments) do
14
+ Polaris::OptionList::CheckboxComponent.new(
15
+ form: @form,
16
+ attribute: @attribute,
17
+ name: @name && "#{@name}[]",
18
+ value: value,
19
+ checked: @selected.include?(value),
20
+ **system_arguments
21
+ )
22
+ end
23
+
24
+ def initialize(
25
+ title: nil,
26
+ form: nil,
27
+ attribute: nil,
28
+ name: nil,
29
+ selected: [],
30
+ **system_arguments
31
+ )
32
+ @title = title
33
+ @form = form
34
+ @attribute = attribute
35
+ @name = name
36
+ @selected = selected
37
+ @system_arguments = system_arguments
38
+ end
39
+
40
+ def system_arguments
41
+ @system_arguments.tap do |opts|
42
+ opts[:tag] = "ul"
43
+ opts[:classes] = class_names(
44
+ @system_arguments[:classes],
45
+ "Polaris-OptionList__Options"
46
+ )
47
+ end
48
+ end
49
+
50
+ def items
51
+ radio_buttons.presence || checkboxes.presence || options
52
+ end
53
+ end
@@ -0,0 +1,15 @@
1
+ <%= render(Polaris::BaseComponent.new(**system_arguments)) do %>
2
+ <% if sections.present? %>
3
+ <% sections.each do |section| %>
4
+ <%= section %>
5
+ <% end %>
6
+ <% elsif items.present? %>
7
+ <%= render(Polaris::OptionList::SectionComponent.new(title: @title)) do %>
8
+ <% items.each do |item| %>
9
+ <%= item %>
10
+ <% end %>
11
+ <% end %>
12
+ <% else %>
13
+ <%= content %>
14
+ <% end %>
15
+ <% end %>
@@ -0,0 +1,67 @@
1
+ module Polaris
2
+ class OptionListComponent < Polaris::NewComponent
3
+ renders_many :sections, ->(**system_arguments) do
4
+ Polaris::OptionList::SectionComponent.new(
5
+ form: @form,
6
+ attribute: @attribute,
7
+ name: @name,
8
+ selected: @selected,
9
+ **system_arguments
10
+ )
11
+ end
12
+ renders_many :options, Polaris::OptionList::OptionComponent
13
+ renders_many :radio_buttons, ->(value:, **system_arguments) do
14
+ Polaris::OptionList::RadioButtonComponent.new(
15
+ form: @form,
16
+ attribute: @attribute,
17
+ name: @name,
18
+ value: value,
19
+ checked: @selected.include?(value),
20
+ **system_arguments
21
+ )
22
+ end
23
+ renders_many :checkboxes, ->(value:, **system_arguments) do
24
+ Polaris::OptionList::CheckboxComponent.new(
25
+ form: @form,
26
+ attribute: @attribute,
27
+ name: @name && "#{@name}[]",
28
+ value: value,
29
+ checked: @selected.include?(value),
30
+ **system_arguments
31
+ )
32
+ end
33
+
34
+ def initialize(
35
+ title: nil,
36
+ form: nil,
37
+ attribute: nil,
38
+ name: nil,
39
+ selected: [],
40
+ **system_arguments
41
+ )
42
+ @title = title
43
+ @form = form
44
+ @attribute = attribute
45
+ @name = name
46
+ @selected = selected
47
+ @system_arguments = system_arguments
48
+ end
49
+
50
+ def system_arguments
51
+ @system_arguments.tap do |opts|
52
+ opts[:tag] = "ul"
53
+ opts[:data] ||= {}
54
+ prepend_option(opts[:data], :controller, "polaris-option-list")
55
+ opts[:data][:polaris_option_list_selected_class] = "Polaris-OptionList-Option--select"
56
+ opts[:classes] = class_names(
57
+ @system_arguments[:classes],
58
+ "Polaris-OptionList"
59
+ )
60
+ end
61
+ end
62
+
63
+ def items
64
+ radio_buttons.presence || checkboxes.presence || options
65
+ end
66
+ end
67
+ end
@@ -1,11 +1,4 @@
1
- <div
2
- data-controller="polaris-popover"
3
- data-polaris-popover-active-value="<%= @active %>"
4
- data-polaris-popover-placement-value="<%= popperjs_placement %>"
5
- data-polaris-popover-open-class="Polaris-Popover__PopoverOverlay--open"
6
- data-polaris-popover-closed-class="Polaris-Popover__PopoverOverlay--closed"
7
- style="<%= "display: inline-block;" if @inline %>"
8
- >
1
+ <%= render(Polaris::BaseComponent.new(**wrapper_arguments)) do %>
9
2
  <div data-polaris-popover-target="activator">
10
3
  <% if activator.present? %>
11
4
  <%= activator %>
@@ -35,4 +28,4 @@
35
28
  <div class="Polaris-Popover__FocusTracker" tabindex="0"></div>
36
29
  <% end %>
37
30
  <% end %>
38
- </div>
31
+ <% end %>
@@ -24,6 +24,7 @@ module Polaris
24
24
  sectioned: false,
25
25
  alignment: ALIGNMENT_DEFAULT,
26
26
  position: POSITION_DEFAULT,
27
+ wrapper_arguments: {},
27
28
  **system_arguments
28
29
  )
29
30
  @active = active
@@ -35,11 +36,27 @@ module Polaris
35
36
  @sectioned = sectioned
36
37
  @alignment = fetch_or_fallback(ALIGNMENT_OPTIONS, alignment, ALIGNMENT_DEFAULT)
37
38
  @position = fetch_or_fallback(POSITION_OPTIONS, position, POSITION_DEFAULT)
39
+ @wrapper_arguments = wrapper_arguments
38
40
  @system_arguments = system_arguments
39
41
  @popover_arguments = {}
40
42
  @content_arguments = {}
41
43
  end
42
44
 
45
+ def wrapper_arguments
46
+ @wrapper_arguments.tap do |opts|
47
+ opts[:tag] = "div"
48
+ opts[:data] ||= {}
49
+ prepend_option(opts[:data], :controller, "polaris-popover")
50
+ opts[:data][:polaris_popover_active_value] = @active
51
+ opts[:data][:polaris_popover_placement_value] = popperjs_placement
52
+ opts[:data][:polaris_popover_open_class] = "Polaris-Popover__PopoverOverlay--open"
53
+ opts[:data][:polaris_popover_closed_class] = "Polaris-Popover__PopoverOverlay--closed"
54
+ if @inline
55
+ prepend_option(opts, :style, "display: inline-block;")
56
+ end
57
+ end
58
+ end
59
+
43
60
  def system_arguments
44
61
  @system_arguments.tap do |opts|
45
62
  opts[:tag] = "div"
@@ -1,11 +1,6 @@
1
1
  <%= render Polaris::ChoiceComponent.new(**wrapper_arguments) do %>
2
2
  <%= render Polaris::BaseComponent.new(**@system_arguments) do %>
3
- <% if @form.present? && @attribute.present? %>
4
- <%= @form.radio_button(@attribute, @value, @input_options) %>
5
- <% else %>
6
- <%= radio_button_tag(@name, @value, @checked, @input_options) %>
7
- <% end %>
8
-
3
+ <%= radio_button %>
9
4
  <span class="Polaris-RadioButton__Backdrop"></span>
10
5
  <% end %>
11
6
  <% end %>
@@ -20,6 +20,7 @@ module Polaris
20
20
  @attribute = attribute
21
21
  @name = name
22
22
  @checked = checked
23
+ @disabled = disabled
23
24
  @value = value
24
25
 
25
26
  @system_arguments = system_arguments
@@ -38,10 +39,7 @@ module Polaris
38
39
  }.merge(wrapper_arguments)
39
40
 
40
41
  @input_options = input_options
41
- @input_options[:aria] ||= {}
42
- @input_options[:disabled] = true if disabled
43
- @input_options[:aria][:checked] = checked
44
- @input_options[:class] = class_names(
42
+ @input_options[:classes] = class_names(
45
43
  @input_options[:classes],
46
44
  "Polaris-RadioButton__Input"
47
45
  )
@@ -51,5 +49,17 @@ module Polaris
51
49
  @wrapper_arguments[:children_content] = content
52
50
  @wrapper_arguments
53
51
  end
52
+
53
+ def radio_button
54
+ render Polaris::BaseRadioButton.new(
55
+ form: @form,
56
+ attribute: @attribute,
57
+ name: @name,
58
+ checked: @checked,
59
+ disabled: @disabled,
60
+ value: @value,
61
+ **@input_options
62
+ )
63
+ end
54
64
  end
55
65
  end
@@ -19,8 +19,8 @@ module Polaris
19
19
 
20
20
  attr_reader :value
21
21
 
22
- renders_one :prefix
23
- renders_one :suffix
22
+ renders_one :prefix, "Affix"
23
+ renders_one :suffix, "Affix"
24
24
  renders_one :connected_left
25
25
  renders_one :connected_right
26
26
 
@@ -179,5 +179,19 @@ module Polaris
179
179
  def render_number_buttons?
180
180
  @type == :number && !@disabled
181
181
  end
182
+
183
+ class Affix < Polaris::NewComponent
184
+ def initialize(icon: nil)
185
+ @icon = icon
186
+ end
187
+
188
+ def call
189
+ if @icon.present?
190
+ render Polaris::IconComponent.new(name: @icon)
191
+ else
192
+ content
193
+ end
194
+ end
195
+ end
182
196
  end
183
197
  end
@@ -0,0 +1,21 @@
1
+ <%= render(Polaris::BaseComponent.new(**system_arguments)) do %>
2
+ <div style="<%= polaris_inversed_colors %>">
3
+ <div class="<%= toast_classes %>">
4
+ <%= content %>
5
+
6
+ <% if action.present? %>
7
+ <div class="Polaris-Frame-Toast__Action">
8
+ <%= action %>
9
+ </div>
10
+ <% end %>
11
+
12
+ <button
13
+ data-action="polaris-toast#close"
14
+ type="button"
15
+ class="Polaris-Frame-Toast__CloseButton"
16
+ >
17
+ <%= polaris_icon(name: "MobileCancelMajor") %>
18
+ </button>
19
+ </div>
20
+ </div>
21
+ <% end %>