polaris_view_components 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/polaris_view_components/autocomplete_controller.js +32 -15
- data/app/assets/javascripts/polaris_view_components/dropzone_controller.js +495 -0
- data/app/assets/javascripts/polaris_view_components/index.js +2 -0
- data/app/assets/javascripts/polaris_view_components/popover_controller.js +9 -2
- data/app/assets/javascripts/polaris_view_components/utils.js +23 -0
- data/app/assets/javascripts/polaris_view_components.js +533 -63
- data/app/assets/stylesheets/polaris_view_components/custom.css +38 -6
- data/app/assets/stylesheets/polaris_view_components.css +2102 -2021
- data/app/assets/stylesheets/polaris_view_components.postcss.css +1 -1
- data/app/components/polaris/action_list/item_component.rb +1 -1
- data/app/components/polaris/action_list/section_component.rb +1 -1
- data/app/components/polaris/action_list_component.rb +1 -1
- data/app/components/polaris/autocomplete/action_component.rb +1 -1
- data/app/components/polaris/autocomplete/option_component.rb +1 -1
- data/app/components/polaris/autocomplete/section_component.rb +1 -1
- data/app/components/polaris/autocomplete_component.rb +9 -2
- data/app/components/polaris/avatar_component.rb +1 -1
- data/app/components/polaris/badge_component.rb +1 -1
- data/app/components/polaris/banner_component.rb +2 -2
- data/app/components/polaris/base_button.rb +1 -1
- data/app/components/polaris/base_checkbox.rb +1 -1
- data/app/components/polaris/base_component.rb +1 -1
- data/app/components/polaris/base_radio_button.rb +1 -1
- data/app/components/polaris/button_group_component.rb +3 -3
- data/app/components/polaris/callout_card_component.rb +1 -1
- data/app/components/polaris/caption_component.rb +1 -1
- data/app/components/polaris/card/header_component.rb +1 -1
- data/app/components/polaris/card/section_component.rb +2 -2
- data/app/components/polaris/card_component.rb +1 -1
- data/app/components/polaris/checkbox_component.rb +1 -1
- data/app/components/polaris/choice_component.rb +1 -1
- data/app/components/polaris/choice_list_component.rb +1 -1
- data/app/components/polaris/component.rb +6 -1
- data/app/components/polaris/data_table/cell_component.rb +1 -1
- data/app/components/polaris/data_table/column_component.rb +1 -1
- data/app/components/polaris/data_table_component.rb +1 -1
- data/app/components/polaris/description_list_component.rb +2 -2
- data/app/components/polaris/display_text_component.rb +1 -1
- data/app/components/polaris/dropzone_component.html.erb +156 -0
- data/app/components/polaris/dropzone_component.rb +150 -0
- data/app/components/polaris/empty_state_component.rb +1 -1
- data/app/components/polaris/exception_list/item_component.rb +1 -1
- data/app/components/polaris/exception_list_component.rb +1 -1
- data/app/components/polaris/filters_component.rb +3 -3
- data/app/components/polaris/footer_help_component.rb +1 -1
- data/app/components/polaris/form_layout/group_component.rb +2 -2
- data/app/components/polaris/form_layout/item_component.rb +1 -1
- data/app/components/polaris/form_layout_component.rb +1 -1
- data/app/components/polaris/frame/save_bar_component.rb +1 -1
- data/app/components/polaris/frame/top_bar_component.rb +1 -1
- data/app/components/polaris/frame_component.rb +1 -1
- data/app/components/polaris/heading_component.rb +1 -1
- data/app/components/polaris/headless_button.rb +1 -1
- data/app/components/polaris/icon_component.rb +1 -1
- data/app/components/polaris/index_table/cell_component.rb +1 -1
- data/app/components/polaris/index_table/column_component.rb +1 -1
- data/app/components/polaris/index_table_component.rb +1 -1
- data/app/components/polaris/inline_error_component.rb +1 -1
- data/app/components/polaris/label_component.rb +1 -1
- data/app/components/polaris/labelled_component.rb +1 -1
- data/app/components/polaris/layout/annotated_section.rb +1 -1
- data/app/components/polaris/layout/section.rb +1 -1
- data/app/components/polaris/layout_component.rb +1 -1
- data/app/components/polaris/link_component.rb +1 -1
- data/app/components/polaris/list_component.rb +2 -2
- data/app/components/polaris/modal/section_component.rb +1 -1
- data/app/components/polaris/modal_component.rb +1 -1
- data/app/components/polaris/navigation/item_component.rb +2 -2
- data/app/components/polaris/navigation/section_component.rb +2 -2
- data/app/components/polaris/navigation_component.rb +1 -1
- data/app/components/polaris/option_list/checkbox_component.rb +1 -1
- data/app/components/polaris/option_list/option_component.rb +1 -1
- data/app/components/polaris/option_list/radio_button_component.rb +1 -1
- data/app/components/polaris/option_list/section_component.rb +1 -1
- data/app/components/polaris/option_list_component.rb +1 -1
- data/app/components/polaris/page_actions_component.rb +1 -1
- data/app/components/polaris/page_component.rb +1 -1
- data/app/components/polaris/pagination_component.rb +1 -1
- data/app/components/polaris/popover/pane_component.rb +1 -1
- data/app/components/polaris/popover/section_component.rb +1 -1
- data/app/components/polaris/popover_component.rb +10 -4
- data/app/components/polaris/progress_bar_component.rb +1 -1
- data/app/components/polaris/radio_button_component.rb +1 -1
- data/app/components/polaris/resource_item_component.rb +1 -1
- data/app/components/polaris/resource_list_component.rb +1 -1
- data/app/components/polaris/scrollable_component.rb +1 -1
- data/app/components/polaris/select_component.rb +1 -1
- data/app/components/polaris/setting_toggle_component.rb +1 -1
- data/app/components/polaris/shopify_navigation_component.rb +2 -2
- data/app/components/polaris/skeleton_body_text_component.rb +1 -1
- data/app/components/polaris/spacer_component.rb +1 -1
- data/app/components/polaris/spinner_component.rb +1 -1
- data/app/components/polaris/stack/item_component.rb +15 -0
- data/app/components/polaris/stack_component.rb +2 -18
- data/app/components/polaris/subheading_component.rb +1 -1
- data/app/components/polaris/tabs/tab_component.rb +1 -1
- data/app/components/polaris/tabs_component.rb +1 -1
- data/app/components/polaris/tag_component.rb +3 -2
- data/app/components/polaris/text_container_component.rb +1 -1
- data/app/components/polaris/text_field_component.rb +2 -2
- data/app/components/polaris/text_style_component.rb +1 -1
- data/app/components/polaris/thumbnail_component.rb +1 -1
- data/app/components/polaris/toast_component.rb +1 -1
- data/app/components/polaris/top_bar/user_menu_component.rb +1 -1
- data/app/components/polaris/visually_hidden_component.rb +1 -1
- data/app/helpers/polaris/form_builder.rb +14 -5
- data/app/helpers/polaris/view_helper.rb +2 -1
- data/lib/polaris/view_components/engine.rb +5 -1
- data/lib/polaris/view_components/version.rb +1 -1
- metadata +7 -9
- data/app/components/polaris/application_component.rb +0 -35
- data/app/components/polaris/dropzone/component.html.erb +0 -72
- data/app/components/polaris/dropzone/component.rb +0 -128
- data/app/components/polaris/dropzone/controller.js +0 -226
- data/app/components/polaris/dropzone/utils.js +0 -57
- data/app/components/polaris/new_component.rb +0 -10
- data/app/helpers/polaris/conditional_helper.rb +0 -11
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Polaris
|
4
|
-
class FiltersComponent < Polaris::
|
4
|
+
class FiltersComponent < Polaris::Component
|
5
5
|
renders_one :query, ->(**system_arguments) do
|
6
6
|
QueryComponent.new(disabled: @disabled, **system_arguments)
|
7
7
|
end
|
@@ -34,7 +34,7 @@ module Polaris
|
|
34
34
|
)
|
35
35
|
end
|
36
36
|
|
37
|
-
class QueryComponent < Polaris::
|
37
|
+
class QueryComponent < Polaris::Component
|
38
38
|
def initialize(clear_button: true, disabled: false, **system_arguments)
|
39
39
|
@disabled = disabled
|
40
40
|
@system_arguments = system_arguments.merge(
|
@@ -52,7 +52,7 @@ module Polaris
|
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
-
class ItemComponent < Polaris::
|
55
|
+
class ItemComponent < Polaris::Component
|
56
56
|
def initialize(label:, sectioned: true, width: nil, disabled: false, **system_arguments)
|
57
57
|
@label = label
|
58
58
|
@sectioned = sectioned
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Polaris
|
4
|
-
class FooterHelpComponent < Polaris::
|
4
|
+
class FooterHelpComponent < Polaris::Component
|
5
5
|
def initialize(**system_arguments)
|
6
6
|
@system_arguments = system_arguments
|
7
7
|
@system_arguments[:classes] = class_names(
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class Polaris::FormLayout::GroupComponent < Polaris::
|
1
|
+
class Polaris::FormLayout::GroupComponent < Polaris::Component
|
2
2
|
attr_reader :position
|
3
3
|
|
4
4
|
renders_many :items, "GroupItemComponent"
|
@@ -22,7 +22,7 @@ class Polaris::FormLayout::GroupComponent < Polaris::NewComponent
|
|
22
22
|
)
|
23
23
|
end
|
24
24
|
|
25
|
-
class GroupItemComponent < Polaris::
|
25
|
+
class GroupItemComponent < Polaris::Component
|
26
26
|
def initialize(**system_arguments)
|
27
27
|
@system_arguments = system_arguments
|
28
28
|
@system_arguments[:tag] = "div"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Polaris
|
4
|
-
class FormLayoutComponent < Polaris::
|
4
|
+
class FormLayoutComponent < Polaris::Component
|
5
5
|
renders_many :items, ->(**system_arguments) do
|
6
6
|
@counter += 1
|
7
7
|
Polaris::FormLayout::ItemComponent.new(position: @counter, **system_arguments)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Polaris
|
4
|
-
class LabelledComponent < Polaris::
|
4
|
+
class LabelledComponent < Polaris::Component
|
5
5
|
renders_one :label_action, ->(**system_arguments) do
|
6
6
|
Polaris::ButtonComponent.new(plain: true, **system_arguments)
|
7
7
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Polaris
|
4
|
-
class ListComponent < Polaris::
|
4
|
+
class ListComponent < Polaris::Component
|
5
5
|
renders_many :items, "ListItemComponent"
|
6
6
|
|
7
7
|
TYPE_DEFAULT = :bullet
|
@@ -28,7 +28,7 @@ module Polaris
|
|
28
28
|
)
|
29
29
|
end
|
30
30
|
|
31
|
-
class ListItemComponent < Polaris::
|
31
|
+
class ListItemComponent < Polaris::Component
|
32
32
|
def initialize(**system_arguments)
|
33
33
|
@system_arguments = system_arguments
|
34
34
|
@system_arguments[:tag] = :li
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Polaris
|
4
|
-
class ModalComponent < Polaris::
|
4
|
+
class ModalComponent < Polaris::Component
|
5
5
|
renders_one :close_button, ->(**system_arguments) do
|
6
6
|
button_arguments = @close_button_arguments.deep_merge(system_arguments)
|
7
7
|
render(Polaris::BaseComponent.new(**button_arguments)) do
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class Polaris::Navigation::ItemComponent < Polaris::
|
1
|
+
class Polaris::Navigation::ItemComponent < Polaris::Component
|
2
2
|
renders_many :sub_items, Polaris::Navigation::ItemComponent
|
3
3
|
renders_one :secondary_action, "SecondaryActionComponent"
|
4
4
|
|
@@ -47,7 +47,7 @@ class Polaris::Navigation::ItemComponent < Polaris::NewComponent
|
|
47
47
|
sub_items.any?(&:selected)
|
48
48
|
end
|
49
49
|
|
50
|
-
class SecondaryActionComponent < Polaris::
|
50
|
+
class SecondaryActionComponent < Polaris::Component
|
51
51
|
def initialize(url: nil, external: false, icon: nil, **system_arguments)
|
52
52
|
@url = url
|
53
53
|
@external = external
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class Polaris::Navigation::SectionComponent < Polaris::
|
1
|
+
class Polaris::Navigation::SectionComponent < Polaris::Component
|
2
2
|
renders_many :items, Polaris::Navigation::ItemComponent
|
3
3
|
renders_one :action, "ActionComponent"
|
4
4
|
|
@@ -26,7 +26,7 @@ class Polaris::Navigation::SectionComponent < Polaris::NewComponent
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
class ActionComponent < Polaris::
|
29
|
+
class ActionComponent < Polaris::Component
|
30
30
|
def initialize(url: nil, external: false, icon: nil, **system_arguments)
|
31
31
|
@url = url
|
32
32
|
@external = external
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class Polaris::OptionList::SectionComponent < Polaris::
|
1
|
+
class Polaris::OptionList::SectionComponent < Polaris::Component
|
2
2
|
renders_many :options, Polaris::OptionList::OptionComponent
|
3
3
|
renders_many :radio_buttons, ->(value:, **system_arguments) do
|
4
4
|
Polaris::OptionList::RadioButtonComponent.new(
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Polaris
|
4
|
-
class PageComponent < Polaris::
|
4
|
+
class PageComponent < Polaris::Component
|
5
5
|
renders_one :primary_action, ->(primary: true, **system_arguments) do
|
6
6
|
Polaris::ButtonComponent.new(primary: primary, **system_arguments)
|
7
7
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module Polaris
|
2
|
-
class PopoverComponent < Polaris::
|
2
|
+
class PopoverComponent < Polaris::Component
|
3
3
|
ALIGNMENT_DEFAULT = :center
|
4
4
|
ALIGNMENT_OPTIONS = [:left, :right, :center]
|
5
5
|
|
6
|
-
POSITION_DEFAULT = :
|
7
|
-
POSITION_OPTIONS = [:above, :below]
|
6
|
+
POSITION_DEFAULT = :auto
|
7
|
+
POSITION_OPTIONS = [:auto, :above, :below]
|
8
8
|
|
9
9
|
renders_one :button, ->(**system_arguments) do
|
10
10
|
system_arguments[:data] ||= {}
|
@@ -98,7 +98,13 @@ module Polaris
|
|
98
98
|
end
|
99
99
|
|
100
100
|
def popperjs_placement
|
101
|
-
placement =
|
101
|
+
placement =
|
102
|
+
case @position
|
103
|
+
when :above then "top"
|
104
|
+
when :below then "bottom"
|
105
|
+
else
|
106
|
+
"auto"
|
107
|
+
end
|
102
108
|
placement += "-start" if @alignment == :left
|
103
109
|
placement += "-end" if @alignment == :right
|
104
110
|
placement
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Polaris
|
4
|
-
class SettingToggleComponent < Polaris::
|
4
|
+
class SettingToggleComponent < Polaris::Component
|
5
5
|
renders_one :action, ->(**system_arguments) do
|
6
6
|
Polaris::ButtonComponent.new(primary: !@enabled, **system_arguments)
|
7
7
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Polaris
|
4
|
-
class ShopifyNavigationComponent < Polaris::
|
4
|
+
class ShopifyNavigationComponent < Polaris::Component
|
5
5
|
renders_many :links, ->(**system_arguments) do
|
6
6
|
ShopifyNavigationLinkComponent.new(auto_detect_active: @auto_detect_active, **system_arguments)
|
7
7
|
end
|
@@ -21,7 +21,7 @@ module Polaris
|
|
21
21
|
links.any?
|
22
22
|
end
|
23
23
|
|
24
|
-
class ShopifyNavigationLinkComponent < Polaris::
|
24
|
+
class ShopifyNavigationLinkComponent < Polaris::Component
|
25
25
|
def initialize(url:, auto_detect_active:, active: false, **system_arguments)
|
26
26
|
@url = url
|
27
27
|
@auto_detect_active = auto_detect_active
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class Polaris::Stack::ItemComponent < Polaris::Component
|
2
|
+
def initialize(fill: false, **system_arguments)
|
3
|
+
@system_arguments = system_arguments
|
4
|
+
@system_arguments[:tag] = "div"
|
5
|
+
@system_arguments[:classes] = class_names(
|
6
|
+
@system_arguments[:classes],
|
7
|
+
"Polaris-Stack__Item",
|
8
|
+
"Polaris-Stack__Item--fill": fill
|
9
|
+
)
|
10
|
+
end
|
11
|
+
|
12
|
+
def call
|
13
|
+
render(Polaris::BaseComponent.new(**@system_arguments)) { content }
|
14
|
+
end
|
15
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Polaris
|
4
|
-
class StackComponent < Polaris::
|
4
|
+
class StackComponent < Polaris::Component
|
5
5
|
ALIGNMENT_DEFAULT = :default
|
6
6
|
ALIGNMENT_MAPPINGS = {
|
7
7
|
ALIGNMENT_DEFAULT => "",
|
@@ -37,7 +37,7 @@ module Polaris
|
|
37
37
|
}
|
38
38
|
SPACING_OPTIONS = SPACING_MAPPINGS.keys
|
39
39
|
|
40
|
-
renders_many :items,
|
40
|
+
renders_many :items, Polaris::Stack::ItemComponent
|
41
41
|
|
42
42
|
def initialize(
|
43
43
|
alignment: ALIGNMENT_DEFAULT,
|
@@ -59,21 +59,5 @@ module Polaris
|
|
59
59
|
"Polaris-Stack--noWrap": !wrap
|
60
60
|
)
|
61
61
|
end
|
62
|
-
|
63
|
-
class StackItemComponent < Polaris::NewComponent
|
64
|
-
def initialize(fill: false, **system_arguments)
|
65
|
-
@system_arguments = system_arguments
|
66
|
-
@system_arguments[:tag] = "div"
|
67
|
-
@system_arguments[:classes] = class_names(
|
68
|
-
@system_arguments[:classes],
|
69
|
-
"Polaris-Stack__Item",
|
70
|
-
"Polaris-Stack__Item--fill": fill
|
71
|
-
)
|
72
|
-
end
|
73
|
-
|
74
|
-
def call
|
75
|
-
render(Polaris::BaseComponent.new(**@system_arguments)) { content }
|
76
|
-
end
|
77
|
-
end
|
78
62
|
end
|
79
63
|
end
|
@@ -1,11 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Polaris
|
4
|
-
class TagComponent < Polaris::
|
5
|
-
renders_one :remove_button, ->(**system_arguments) do
|
4
|
+
class TagComponent < Polaris::Component
|
5
|
+
renders_one :remove_button, ->(type: :button, **system_arguments) do
|
6
6
|
render Polaris::BaseButton.new(
|
7
7
|
classes: "Polaris-Tag__Button",
|
8
8
|
disabled: @disabled,
|
9
|
+
type: type,
|
9
10
|
**system_arguments
|
10
11
|
) do |button|
|
11
12
|
polaris_icon(name: "CancelSmallMinor")
|