polaris_view_components 0.1.2 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +34 -3
  3. data/app/assets/javascripts/{polaris.js → polaris_view_components.js} +27 -33
  4. data/app/assets/stylesheets/polaris@6.6.0.css +4104 -0
  5. data/app/assets/stylesheets/polaris_view_components.css +3 -136
  6. data/app/assets/stylesheets/shopify_navigation.css +136 -0
  7. data/app/components/polaris/button_component.html.erb +1 -1
  8. data/app/components/polaris/button_component.rb +1 -85
  9. data/app/components/polaris/dropzone/controller.js +1 -1
  10. data/app/components/polaris/headless_button.html.erb +22 -0
  11. data/app/components/polaris/headless_button.rb +95 -0
  12. data/app/components/polaris/resource_item_component.html.erb +6 -5
  13. data/app/components/polaris/resource_item_component.rb +45 -12
  14. data/app/components/polaris/select_component.html.erb +11 -2
  15. data/app/components/polaris/select_component.rb +2 -0
  16. data/app/components/polaris/skeleton_body_text_component.html.erb +5 -0
  17. data/app/components/polaris/skeleton_body_text_component.rb +15 -0
  18. data/app/components/polaris/tag_component.html.erb +6 -0
  19. data/app/components/polaris/tag_component.rb +35 -0
  20. data/app/helpers/polaris/form_builder.rb +4 -0
  21. data/app/helpers/polaris/url_helper.rb +19 -0
  22. data/app/helpers/polaris/view_helper.rb +2 -0
  23. data/app/javascript/{polaris → polaris_view_components}/index.js +3 -1
  24. data/app/javascript/polaris_view_components/resource_item_controller.js +15 -0
  25. data/app/javascript/{polaris → polaris_view_components}/select_controller.js +1 -1
  26. data/app/javascript/{polaris → polaris_view_components}/text_field_controller.js +1 -2
  27. data/lib/generators/polaris_view_components/USAGE +5 -0
  28. data/lib/generators/polaris_view_components/install_generator.rb +35 -0
  29. data/lib/generators/polaris_view_components/templates/README +14 -0
  30. data/lib/generators/polaris_view_components/templates/stimulus_index.js +6 -0
  31. data/lib/polaris/view_components/engine.rb +4 -1
  32. data/lib/polaris/view_components/version.rb +1 -1
  33. metadata +22 -8
@@ -1,136 +1,3 @@
1
- .shp-Navigation {
2
- margin: 0 auto;
3
- padding: 0 2rem;
4
- max-width: 99.8rem;
5
- max-width: none;
6
- border-bottom: .1rem solid var(--p-border-subdued)
7
- }
8
-
9
- @media (max-width: 48.0625em) and (min-width: 30.625em),(min-width: 45.625em) {
10
- .shp-Navigation {
11
- padding: 0 2rem
12
- }
13
- }
14
-
15
- @media (min-width: 30.625em) {
16
- .shp-Navigation {
17
- padding: 0 2rem
18
- }
19
- }
20
-
21
- @media (max-width: 48.0625em) and (min-width: 46.5em),(min-width: 61.5em) {
22
- .shp-Navigation {
23
- padding: 0 3.2rem
24
- }
25
- }
26
-
27
- @media (min-width: 46.5em) {
28
- .shp-Navigation {
29
- padding: 0 3.2rem
30
- }
31
- }
32
-
33
- @media (max-width: 30.5625em) {
34
- .shp-Navigation {
35
- padding: 0 1.6rem
36
- }
37
- }
38
-
39
- .shp-Navigation_Items {
40
- display: flex;
41
- margin: 0;
42
- padding: 0 .2rem;
43
- list-style: none
44
- }
45
-
46
- .shp-Navigation_Item {
47
- display: flex;
48
- margin: 0;
49
- padding: 0
50
- }
51
-
52
- .shp-Navigation_Link {
53
- color: inherit;
54
- -webkit-appearance: none;
55
- -moz-appearance: none;
56
- appearance: none;
57
- margin: 0;
58
- padding: 0;
59
- background: none;
60
- border: none;
61
- font-size: inherit;
62
- line-height: inherit;
63
- font-size: 1.5rem;
64
- font-weight: 400;
65
- line-height: 2rem;
66
- text-transform: none;
67
- letter-spacing: normal;
68
- color: var(--p-text-subdued);
69
- position: relative;
70
- z-index: 400;
71
- justify-content: center;
72
- width: 100%;
73
- min-width: 100%;
74
- margin-top: 1px;
75
- margin-bottom: -1px;
76
- padding: 0 1.6rem;
77
- outline: none;
78
- text-align: center;
79
- white-space: nowrap;
80
- text-decoration: none;
81
- cursor: pointer
82
- }
83
-
84
- .shp-Navigation_Link:visited {
85
- color: inherit
86
- }
87
-
88
- .shp-Navigation_Link:focus {
89
- outline: none
90
- }
91
-
92
- @media (min-width: 40em) {
93
- .shp-Navigation_Link {
94
- font-size: 1.4rem
95
- }
96
- }
97
-
98
- .shp-Navigation_Link:hover {
99
- text-decoration: none
100
- }
101
-
102
- .shp-Navigation_Link:hover .shp-Navigation_LinkText {
103
- font-weight: 400;
104
- color: var(--p-text);
105
- text-decoration: none;
106
- border-bottom: .3rem solid var(--p-action-primary)
107
- }
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
- .shp-Navigation_Link:focus .shp-Navigation_LinkText {
114
- font-weight: 400;
115
- color: var(--p-text)
116
- }
117
-
118
- .shp-Navigation_LinkText {
119
- padding: 1.6rem 0 1.3rem 0;
120
- border-bottom: .3rem solid transparent
121
- }
122
-
123
- .shp-Navigation_LinkText {
124
- display: block;
125
- }
126
-
127
- [aria-selected='true'],
128
- .shp-Navigation_Link:focus .shp-Navigation_LinkText {
129
- font-weight: 400;
130
- color: var(--p-text)
131
- }
132
-
133
- [aria-selected='true'] .shp-Navigation_LinkText {
134
- color: var(--p-action-primary);
135
- border-bottom: .3rem solid var(--p-action-primary)
136
- }
1
+ /*
2
+ *= require_tree .
3
+ */
@@ -0,0 +1,136 @@
1
+ .shp-Navigation {
2
+ margin: 0 auto;
3
+ padding: 0 2rem;
4
+ max-width: 99.8rem;
5
+ max-width: none;
6
+ border-bottom: .1rem solid var(--p-border-subdued)
7
+ }
8
+
9
+ @media (max-width: 48.0625em) and (min-width: 30.625em),(min-width: 45.625em) {
10
+ .shp-Navigation {
11
+ padding: 0 2rem
12
+ }
13
+ }
14
+
15
+ @media (min-width: 30.625em) {
16
+ .shp-Navigation {
17
+ padding: 0 2rem
18
+ }
19
+ }
20
+
21
+ @media (max-width: 48.0625em) and (min-width: 46.5em),(min-width: 61.5em) {
22
+ .shp-Navigation {
23
+ padding: 0 3.2rem
24
+ }
25
+ }
26
+
27
+ @media (min-width: 46.5em) {
28
+ .shp-Navigation {
29
+ padding: 0 3.2rem
30
+ }
31
+ }
32
+
33
+ @media (max-width: 30.5625em) {
34
+ .shp-Navigation {
35
+ padding: 0 1.6rem
36
+ }
37
+ }
38
+
39
+ .shp-Navigation_Items {
40
+ display: flex;
41
+ margin: 0;
42
+ padding: 0 .2rem;
43
+ list-style: none
44
+ }
45
+
46
+ .shp-Navigation_Item {
47
+ display: flex;
48
+ margin: 0;
49
+ padding: 0
50
+ }
51
+
52
+ .shp-Navigation_Link {
53
+ color: inherit;
54
+ -webkit-appearance: none;
55
+ -moz-appearance: none;
56
+ appearance: none;
57
+ margin: 0;
58
+ padding: 0;
59
+ background: none;
60
+ border: none;
61
+ font-size: inherit;
62
+ line-height: inherit;
63
+ font-size: 1.5rem;
64
+ font-weight: 400;
65
+ line-height: 2rem;
66
+ text-transform: none;
67
+ letter-spacing: normal;
68
+ color: var(--p-text-subdued);
69
+ position: relative;
70
+ z-index: 400;
71
+ justify-content: center;
72
+ width: 100%;
73
+ min-width: 100%;
74
+ margin-top: 1px;
75
+ margin-bottom: -1px;
76
+ padding: 0 1.6rem;
77
+ outline: none;
78
+ text-align: center;
79
+ white-space: nowrap;
80
+ text-decoration: none;
81
+ cursor: pointer
82
+ }
83
+
84
+ .shp-Navigation_Link:visited {
85
+ color: inherit
86
+ }
87
+
88
+ .shp-Navigation_Link:focus {
89
+ outline: none
90
+ }
91
+
92
+ @media (min-width: 40em) {
93
+ .shp-Navigation_Link {
94
+ font-size: 1.4rem
95
+ }
96
+ }
97
+
98
+ .shp-Navigation_Link:hover {
99
+ text-decoration: none
100
+ }
101
+
102
+ .shp-Navigation_Link:hover .shp-Navigation_LinkText {
103
+ font-weight: 400;
104
+ color: var(--p-text);
105
+ text-decoration: none;
106
+ border-bottom: .3rem solid var(--p-action-primary)
107
+ }
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
+ .shp-Navigation_Link:focus .shp-Navigation_LinkText {
114
+ font-weight: 400;
115
+ color: var(--p-text)
116
+ }
117
+
118
+ .shp-Navigation_LinkText {
119
+ padding: 1.6rem 0 1.3rem 0;
120
+ border-bottom: .3rem solid transparent
121
+ }
122
+
123
+ .shp-Navigation_LinkText {
124
+ display: block;
125
+ }
126
+
127
+ [aria-selected='true'],
128
+ .shp-Navigation_Link:focus .shp-Navigation_LinkText {
129
+ font-weight: 400;
130
+ color: var(--p-text)
131
+ }
132
+
133
+ [aria-selected='true'] .shp-Navigation_LinkText {
134
+ color: var(--p-action-primary);
135
+ border-bottom: .3rem solid var(--p-action-primary)
136
+ }
@@ -1,4 +1,4 @@
1
- <%= render Polaris::BaseComponent.new(tag: @tag, **dynamic_arguments) do %>
1
+ <%= render Polaris::BaseComponent.new(tag: @tag, **system_arguments) do %>
2
2
  <span class="Polaris-Button__Content">
3
3
  <% if @loading %>
4
4
  <span class="Polaris-Button__Spinner">
@@ -1,90 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Polaris
4
- class ButtonComponent < Polaris::NewComponent
5
- SIZE_DEFAULT = :medium
6
- SIZE_MAPPINGS = {
7
- SIZE_DEFAULT => "",
8
- :slim => "Polaris-Button--sizeSlim",
9
- :large => "Polaris-Button--sizeLarge",
10
- }
11
- SIZE_OPTIONS = SIZE_MAPPINGS.keys
12
-
13
- TEXT_ALIGN_DEFAULT = :default
14
- TEXT_ALIGN_MAPPINGS = {
15
- TEXT_ALIGN_DEFAULT => "",
16
- :left => "Polaris-Button--textAlignLeft",
17
- :center => "Polaris-Button--textAlignCenter",
18
- :right => "Polaris-Button--textAlignRight",
19
- }
20
- TEXT_ALIGN_OPTIONS = TEXT_ALIGN_MAPPINGS.keys
21
-
22
- renders_one :icon, IconComponent
23
-
24
- def initialize(
25
- url: nil,
26
- outline: false,
27
- plain: false,
28
- primary: false,
29
- pressed: false,
30
- monochrome: false,
31
- loading: false,
32
- destructive: false,
33
- disabled: false,
34
- external: false,
35
- full_width: false,
36
- submit: false,
37
- remove_underline: false,
38
- size: SIZE_DEFAULT,
39
- text_align: TEXT_ALIGN_DEFAULT,
40
- **system_arguments
41
- )
42
- @tag = url.present? ? 'a' : 'button'
43
- @text_classes = class_names(
44
- "Polaris-Button__Text",
45
- "Polaris-Button--removeUnderline": plain && monochrome && remove_underline
46
- )
47
- @loading = loading
48
-
49
- @system_arguments = system_arguments
50
- @system_arguments[:type] = submit ? 'submit' : 'button'
51
- if loading
52
- @system_arguments[:disabled] = true
53
- end
54
- if url.present?
55
- @system_arguments.delete(:type)
56
- @system_arguments[:href] = url
57
- @system_arguments[:target] = "_blank" if external
58
- end
59
- if disabled
60
- @system_arguments[:disabled] = disabled
61
- end
62
- @system_arguments[:classes] = class_names(
63
- @system_arguments[:classes],
64
- "Polaris-Button",
65
- SIZE_MAPPINGS[fetch_or_fallback(SIZE_OPTIONS, size, SIZE_DEFAULT)],
66
- TEXT_ALIGN_MAPPINGS[fetch_or_fallback(TEXT_ALIGN_OPTIONS, text_align, TEXT_ALIGN_DEFAULT)],
67
- "Polaris-Button--destructive": destructive,
68
- "Polaris-Button--disabled": disabled || loading,
69
- "Polaris-Button--loading": loading,
70
- "Polaris-Button--fullWidth": full_width,
71
- "Polaris-Button--monochrome": monochrome,
72
- "Polaris-Button--outline": outline,
73
- "Polaris-Button--plain": plain,
74
- "Polaris-Button--primary": primary,
75
- "Polaris-Button--pressed": pressed,
76
- "Polaris-Button--removeUnderline": (plain && monochrome && remove_underline)
77
- )
78
- end
79
-
80
- private
81
-
82
- def dynamic_arguments
83
- @system_arguments[:classes] = class_names(
84
- @system_arguments[:classes],
85
- "Polaris-Button--iconOnly": icon.present? && content.blank?,
86
- )
87
- @system_arguments
88
- end
4
+ class ButtonComponent < HeadlessButton
89
5
  end
90
6
  end
@@ -1,4 +1,4 @@
1
- import { Controller } from 'stimulus'
1
+ import { Controller } from "@hotwired/stimulus"
2
2
 
3
3
  import { fileAccepted, getDataTransferFiles } from './utils'
4
4
 
@@ -0,0 +1,22 @@
1
+ <span class="Polaris-Button__Content">
2
+ <% if @loading %>
3
+ <span class="Polaris-Button__Spinner">
4
+ <%= polaris_spinner(size: :small) %>
5
+ </span>
6
+ <% end %>
7
+
8
+ <% if icon.present? %>
9
+ <div class="Polaris-Button__Icon">
10
+ <%= icon %>
11
+ </div>
12
+ <% if content.present? %>
13
+ &nbsp;
14
+ <% end %>
15
+ <% end %>
16
+
17
+ <% if content.present? %>
18
+ <div class="<%= @text_classes %>">
19
+ <%= content %>
20
+ </div>
21
+ <% end %>
22
+ </span>
@@ -0,0 +1,95 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Polaris
4
+ class HeadlessButton < Polaris::NewComponent
5
+ SIZE_DEFAULT = :medium
6
+ SIZE_MAPPINGS = {
7
+ SIZE_DEFAULT => "",
8
+ :slim => "Polaris-Button--sizeSlim",
9
+ :large => "Polaris-Button--sizeLarge",
10
+ }
11
+ SIZE_OPTIONS = SIZE_MAPPINGS.keys
12
+
13
+ TEXT_ALIGN_DEFAULT = :default
14
+ TEXT_ALIGN_MAPPINGS = {
15
+ TEXT_ALIGN_DEFAULT => "",
16
+ :left => "Polaris-Button--textAlignLeft",
17
+ :center => "Polaris-Button--textAlignCenter",
18
+ :right => "Polaris-Button--textAlignRight",
19
+ }
20
+ TEXT_ALIGN_OPTIONS = TEXT_ALIGN_MAPPINGS.keys
21
+
22
+ renders_one :icon, IconComponent
23
+
24
+ def initialize(
25
+ url: nil,
26
+ outline: false,
27
+ plain: false,
28
+ primary: false,
29
+ pressed: false,
30
+ monochrome: false,
31
+ loading: false,
32
+ destructive: false,
33
+ disabled: false,
34
+ external: false,
35
+ full_width: false,
36
+ submit: false,
37
+ remove_underline: false,
38
+ size: SIZE_DEFAULT,
39
+ text_align: TEXT_ALIGN_DEFAULT,
40
+ **system_arguments
41
+ )
42
+ @tag = url.present? ? 'a' : 'button'
43
+ @text_classes = class_names(
44
+ "Polaris-Button__Text",
45
+ "Polaris-Button--removeUnderline": plain && monochrome && remove_underline
46
+ )
47
+ @loading = loading
48
+
49
+ @system_arguments = system_arguments
50
+ @system_arguments[:type] = submit ? 'submit' : 'button'
51
+ if loading
52
+ @system_arguments[:disabled] = true
53
+ end
54
+ if url.present?
55
+ @system_arguments.delete(:type)
56
+ @system_arguments[:href] = url
57
+ @system_arguments[:target] = "_blank" if external
58
+ end
59
+ if disabled
60
+ @system_arguments[:disabled] = disabled
61
+ end
62
+ @system_arguments[:classes] = class_names(
63
+ @system_arguments[:classes],
64
+ "Polaris-Button",
65
+ SIZE_MAPPINGS[fetch_or_fallback(SIZE_OPTIONS, size, SIZE_DEFAULT)],
66
+ TEXT_ALIGN_MAPPINGS[fetch_or_fallback(TEXT_ALIGN_OPTIONS, text_align, TEXT_ALIGN_DEFAULT)],
67
+ "Polaris-Button--destructive": destructive,
68
+ "Polaris-Button--disabled": disabled || loading,
69
+ "Polaris-Button--loading": loading,
70
+ "Polaris-Button--fullWidth": full_width,
71
+ "Polaris-Button--monochrome": monochrome,
72
+ "Polaris-Button--outline": outline,
73
+ "Polaris-Button--plain": plain,
74
+ "Polaris-Button--primary": primary,
75
+ "Polaris-Button--pressed": pressed,
76
+ "Polaris-Button--removeUnderline": (plain && monochrome && remove_underline)
77
+ )
78
+ end
79
+
80
+ def system_arguments
81
+ @system_arguments[:classes] = class_names(
82
+ @system_arguments[:classes],
83
+ "Polaris-Button--iconOnly": icon.present? && content.blank?,
84
+ )
85
+ @system_arguments
86
+ end
87
+
88
+ def html_options
89
+ options = system_arguments
90
+ options[:class] = options[:classes]
91
+ options.delete(:classes)
92
+ options
93
+ end
94
+ end
95
+ end
@@ -1,15 +1,16 @@
1
- <%= render(Polaris::BaseComponent.new(**@system_arguments)) do %>
1
+ <%= render(Polaris::BaseComponent.new(**wrapper_arguments)) do %>
2
2
  <div class="Polaris-ResourceItem__ItemWrapper">
3
- <div class="Polaris-ResourceItem" style="cursor: <%= @cursor %>;">
3
+ <%= render(Polaris::BaseComponent.new(**system_arguments)) do %>
4
4
  <% if @url %>
5
5
  <a
6
6
  class="Polaris-ResourceItem__Link"
7
7
  tabindex="0"
8
8
  href="<%= @url %>"
9
- data-polaris-unstyled="true"></a>
9
+ data-polaris-unstyled="true"
10
+ data-polaris-resource-item-target="link"></a>
10
11
  <% end %>
11
12
 
12
- <%= render(Polaris::BaseComponent.new(**@container_arguments)) do %>
13
+ <%= render(Polaris::BaseComponent.new(**container_arguments)) do %>
13
14
  <% if media.present? %>
14
15
  <div class="Polaris-ResourceItem__Owned">
15
16
  <div class="Polaris-ResourceItem__Media">
@@ -21,6 +22,6 @@
21
22
  <%= content %>
22
23
  </div>
23
24
  <% end %>
24
- </div>
25
+ <% end %>
25
26
  </div>
26
27
  <% end %>
@@ -16,27 +16,60 @@ module Polaris
16
16
 
17
17
  def initialize(
18
18
  url: nil,
19
- cursor: CURSOR_DEFAULT,
20
19
  vertical_alignment: ALIGNMENT_DEFAULT,
20
+ wrapper_arguments: {},
21
+ container_arguments: {},
21
22
  **system_arguments
22
23
  )
23
24
  @url = url
24
- @cursor = fetch_or_fallback(CURSOR_OPTIONS, cursor, CURSOR_DEFAULT)
25
-
25
+ @vertical_alignment = vertical_alignment
26
+ @wrapper_arguments = wrapper_arguments
27
+ @container_arguments = container_arguments
26
28
  @system_arguments = system_arguments
27
- @system_arguments[:tag] = "li"
28
- @system_arguments[:classes] = class_names(
29
- @system_arguments[:classes],
30
- "Polaris-ResourceItem__ListItem",
31
- )
29
+ end
30
+
31
+ def wrapper_arguments
32
+ {
33
+ tag: "li",
34
+ data: {},
35
+ }.deep_merge(@wrapper_arguments).tap do |args|
36
+ args[:classes] = class_names(
37
+ args[:classes],
38
+ "Polaris-ResourceItem__ListItem",
39
+ )
40
+ prepend_option(args[:data], :controller, "polaris-resource-item")
41
+ end
42
+ end
32
43
 
33
- @container_arguments = {
44
+ def container_arguments
45
+ {
34
46
  tag: "div",
35
- classes: class_names(
47
+ }.deep_merge(@container_arguments).tap do |args|
48
+ args[:classes] = class_names(
49
+ args[:classes],
36
50
  "Polaris-ResourceItem__Container",
37
- ALIGNMENT_MAPPINGS[fetch_or_fallback(ALIGNMENT_OPTIONS, vertical_alignment, ALIGNMENT_DEFAULT)],
51
+ ALIGNMENT_MAPPINGS[fetch_or_fallback(ALIGNMENT_OPTIONS, @vertical_alignment, ALIGNMENT_DEFAULT)],
38
52
  )
39
- }
53
+ end
40
54
  end
55
+
56
+ def system_arguments
57
+ {
58
+ tag: "div",
59
+ data: {},
60
+ }.deep_merge(@system_arguments).tap do |args|
61
+ args[:classes] = class_names(
62
+ args[:classes],
63
+ "Polaris-ResourceItem",
64
+ )
65
+ prepend_option(args, :style, "cursor: #{cursor};")
66
+ prepend_option(args[:data], :action, "click->polaris-resource-item#open")
67
+ end
68
+ end
69
+
70
+ private
71
+ def cursor
72
+ @url.present? ? "pointer" : "default"
73
+ end
41
74
  end
42
75
  end
@@ -1,9 +1,18 @@
1
1
  <%= render Polaris::LabelledComponent.new(**@wrapper_arguments) do %>
2
2
  <%= render Polaris::BaseComponent.new(**@system_arguments) do %>
3
3
  <% if @form.present? && @attribute.present? %>
4
- <%= @form.select(@attribute, options_for_select(@options, @selected), @select_options, @input_options) %>
4
+ <%= @form.select(
5
+ @attribute,
6
+ options_for_select(@options, selected: @selected, disabled: @disabled_options),
7
+ @select_options,
8
+ @input_options,
9
+ ) %>
5
10
  <% else %>
6
- <%= select_tag(@name, options_for_select(@options, @selected), @input_options) %>
11
+ <%= select_tag(
12
+ @name,
13
+ options_for_select(@options, selected: @selected, disabled: @disabled_options),
14
+ @input_options,
15
+ ) %>
7
16
  <% end %>
8
17
 
9
18
  <div
@@ -8,6 +8,7 @@ module Polaris
8
8
  name: nil,
9
9
  options:,
10
10
  selected: nil,
11
+ disabled_options: nil,
11
12
  label: nil,
12
13
  label_hidden: false,
13
14
  label_inline: false,
@@ -26,6 +27,7 @@ module Polaris
26
27
  @name = name
27
28
  @options = options
28
29
  @selected = selected
30
+ @disabled_options = disabled_options
29
31
  @label = label
30
32
  @label_hidden = label_hidden
31
33
  @label_inline = label_inline
@@ -0,0 +1,5 @@
1
+ <%= render Polaris::BaseComponent.new(**@system_arguments) do %>
2
+ <% @lines.times do %>
3
+ <div class="Polaris-SkeletonBodyText"></div>
4
+ <% end %>
5
+ <% end %>
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Polaris
4
+ class SkeletonBodyTextComponent < Polaris::NewComponent
5
+ def initialize(lines: 3, **system_arguments)
6
+ @lines = lines
7
+ @system_arguments = system_arguments
8
+ @system_arguments[:tag] = "div"
9
+ @system_arguments[:classes] = class_names(
10
+ @system_arguments[:classes],
11
+ "Polaris-SkeletonBodyText__SkeletonBodyTextContainer",
12
+ )
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,6 @@
1
+ <%= render Polaris::BaseComponent.new(**system_arguments) do %>
2
+ <span class="Polaris-TagText">
3
+ <%= content %>
4
+ </span>
5
+ <%= remove_button %>
6
+ <% end %>