polaris_view_components 0.3.1 → 0.5.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 (51) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/app/{javascript → assets/javascripts}/polaris_view_components/index.js +0 -0
  4. data/app/{javascript → assets/javascripts}/polaris_view_components/resource_item_controller.js +0 -0
  5. data/app/assets/javascripts/polaris_view_components/select_controller.js +14 -0
  6. data/app/{javascript → assets/javascripts}/polaris_view_components/text_field_controller.js +0 -0
  7. data/app/assets/javascripts/polaris_view_components.js +6 -4
  8. data/app/assets/stylesheets/polaris_view_components/custom.css +43 -0
  9. data/app/assets/stylesheets/{shopify_navigation.css → polaris_view_components/shopify_navigation.css} +0 -4
  10. data/app/assets/stylesheets/polaris_view_components/spacer_component.css +39 -0
  11. data/app/assets/stylesheets/polaris_view_components.css +2214 -3
  12. data/app/assets/stylesheets/polaris_view_components.postcss.css +4 -0
  13. data/app/components/polaris/card/header_component.rb +0 -2
  14. data/app/components/polaris/card/section_component.rb +5 -1
  15. data/app/components/polaris/card_component.rb +0 -2
  16. data/app/components/polaris/data_table/cell_component.html.erb +18 -0
  17. data/app/components/polaris/data_table/cell_component.rb +49 -0
  18. data/app/components/polaris/data_table/column_component.rb +19 -0
  19. data/app/components/polaris/data_table_component.html.erb +77 -0
  20. data/app/components/polaris/data_table_component.rb +42 -0
  21. data/app/components/polaris/dropzone/component.rb +0 -2
  22. data/app/components/polaris/empty_state_component.html.erb +16 -11
  23. data/app/components/polaris/empty_state_component.rb +1 -0
  24. data/app/components/polaris/filters_component.html.erb +13 -0
  25. data/app/components/polaris/filters_component.rb +38 -0
  26. data/app/components/polaris/index_table/cell_component.rb +22 -0
  27. data/app/components/polaris/index_table/column_component.rb +13 -0
  28. data/app/components/polaris/index_table_component.html.erb +28 -0
  29. data/app/components/polaris/index_table_component.rb +25 -0
  30. data/app/components/polaris/inline_error_component.html.erb +2 -2
  31. data/app/components/polaris/inline_error_component.rb +7 -1
  32. data/app/components/polaris/layout/section.rb +2 -0
  33. data/app/components/polaris/link_component.rb +3 -1
  34. data/app/components/polaris/page_actions_component.rb +15 -1
  35. data/app/components/polaris/resource_list_component.html.erb +10 -0
  36. data/app/components/polaris/resource_list_component.rb +2 -8
  37. data/app/components/polaris/select_component.rb +7 -2
  38. data/app/components/polaris/spacer_component.rb +50 -0
  39. data/app/components/polaris/stack_component.rb +1 -1
  40. data/app/components/polaris/tag_component.rb +2 -2
  41. data/app/components/polaris/text_style_component.rb +9 -0
  42. data/app/helpers/polaris/form_builder.rb +27 -2
  43. data/app/helpers/polaris/view_helper.rb +15 -3
  44. data/lib/polaris/view_components/engine.rb +0 -1
  45. data/lib/polaris/view_components/version.rb +1 -1
  46. metadata +23 -11
  47. data/app/assets/stylesheets/polaris@6.6.0.css +0 -4104
  48. data/app/components/polaris/choice_list/component.html.erb +0 -34
  49. data/app/components/polaris/choice_list/component.rb +0 -65
  50. data/app/helpers/polaris/action_helper.rb +0 -14
  51. data/app/javascript/polaris_view_components/select_controller.js +0 -12
@@ -1,34 +0,0 @@
1
- <%= field_set_tag(nil, content_tag_options) do %>
2
- <% if @title.present? %>
3
- <%= content_tag("legend", class: "Polaris-ChoiceList__Title") do %>
4
- <%= @title %>
5
- <% end %>
6
- <% end %>
7
-
8
- <ul class="Polaris-ChoiceList__Choices">
9
- <% choice_component = @allow_multiple ? Polaris::CheckboxComponent : Polaris::RadioButtonComponent %>
10
-
11
- <% @choices.each do |choice| %>
12
- <li>
13
- <%= render choice_component.new(
14
- form: @form,
15
- attribute: @attribute,
16
- name: final_name,
17
- value: choice[:value],
18
- label: choice[:label],
19
- disabled: choice[:disabled] || @disabled,
20
- checked: choice_is_selected?(choice),
21
- help_text: choice[:help_text],
22
- children_content: choice[:children_content],
23
- input_attrs: @input_attrs,
24
- ) %>
25
- </li>
26
- <% end %>
27
- </ul>
28
-
29
- <% if @error.present? %>
30
- <div class="Polaris-ChoiceList__ChoiceError">
31
- <%= polaris_inline_error { @error } %>
32
- </div>
33
- <% end %>
34
- <% end %>
@@ -1,65 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Polaris
4
- module ChoiceList
5
- class Component < Polaris::Component
6
- def initialize(
7
- choices:,
8
- form: nil,
9
- attribute: nil,
10
- name: nil,
11
- title: '',
12
- title_hidden: false,
13
- selected: [],
14
- allow_multiple: false,
15
- error: '',
16
- disabled: false,
17
- input_attrs: {},
18
- **args
19
- )
20
- super
21
-
22
- @choices = choices
23
- @form = form
24
- @attribute = attribute
25
-
26
- @name = name
27
- @title = title
28
- @title_hidden = title_hidden
29
- @selected = selected
30
- @allow_multiple = allow_multiple
31
- @error = error
32
- @disabled = disabled
33
- @input_attrs = input_attrs
34
- end
35
-
36
- def final_name
37
- return nil if @name.nil?
38
-
39
- @allow_multiple ? "#{@name}[]" : @name
40
- end
41
-
42
- def choice_is_selected?(choice)
43
- @selected.include? choice[:value]
44
- end
45
-
46
- private
47
-
48
- def classes
49
- classes = ['Polaris-ChoiceList']
50
-
51
- classes << 'Polaris-ChoiceList--titleHidden' if @title_hidden
52
-
53
- classes
54
- end
55
-
56
- def additional_aria
57
- super
58
-
59
- {
60
- invalid: @error.present?
61
- }
62
- end
63
- end
64
- end
65
- end
@@ -1,14 +0,0 @@
1
- module Polaris
2
- module ActionHelper
3
- def render_plain_action(action)
4
- case action
5
- when Hash
6
- action = action(**action)
7
- end
8
-
9
- render Polaris::ButtonComponent.new(**action.to_h.except(:content), plain: true) do
10
- action.content
11
- end
12
- end
13
- end
14
- end
@@ -1,12 +0,0 @@
1
- import { Controller } from "@hotwired/stimulus"
2
-
3
- export default class extends Controller {
4
- static targets = ['selectedOption']
5
-
6
- update(event) {
7
- const select = event.currentTarget
8
- const option = select.options[select.selectedIndex]
9
-
10
- this.selectedOptionTarget.innerText = option.text
11
- }
12
- }