ariadne_view_components 0.0.34-aarch64-linux → 0.0.35-aarch64-linux

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +66 -5
  3. data/README.md +2 -2
  4. data/app/components/ariadne/avatar_component.rb +1 -1
  5. data/app/components/ariadne/avatar_stack_component.rb +7 -7
  6. data/app/components/ariadne/base_button.rb +2 -2
  7. data/app/components/ariadne/base_component.rb +2 -2
  8. data/app/components/ariadne/blankslate_component.rb +9 -9
  9. data/app/components/ariadne/body_component.rb +1 -1
  10. data/app/components/ariadne/button_component.rb +8 -6
  11. data/app/components/ariadne/clipboard_copy_component.rb +1 -1
  12. data/app/components/ariadne/comment_component/comment_component.html.erb +6 -6
  13. data/app/components/ariadne/comment_component.rb +5 -5
  14. data/app/components/ariadne/component.rb +0 -1
  15. data/app/components/ariadne/container_component.rb +1 -1
  16. data/app/components/ariadne/counter_component.rb +1 -1
  17. data/app/components/ariadne/details_component.rb +10 -9
  18. data/app/components/ariadne/dropdown/menu_component.rb +3 -3
  19. data/app/components/ariadne/dropdown_component/dropdown_component.html.erb +2 -2
  20. data/app/components/ariadne/dropdown_component.rb +52 -52
  21. data/app/components/ariadne/flash_component.rb +5 -5
  22. data/app/components/ariadne/flex_component/flex_component.html.erb +5 -0
  23. data/app/components/ariadne/flex_component.rb +10 -3
  24. data/app/components/ariadne/footer_component.rb +2 -2
  25. data/app/components/ariadne/grid_component.rb +4 -8
  26. data/app/components/ariadne/header_component.rb +7 -7
  27. data/app/components/ariadne/heading_component.rb +1 -1
  28. data/app/components/ariadne/heroicon_component.rb +2 -2
  29. data/app/components/ariadne/inline_flex_component.rb +7 -7
  30. data/app/components/ariadne/link_component.rb +3 -3
  31. data/app/components/ariadne/list_component.rb +10 -4
  32. data/app/components/ariadne/narrow_container_component.rb +1 -1
  33. data/app/components/ariadne/panel_bar_component.rb +3 -3
  34. data/app/components/ariadne/pill_component.rb +1 -1
  35. data/app/components/ariadne/rich_text_area_component/rich-text-area-component.ts +4 -4
  36. data/app/components/ariadne/rich_text_area_component.rb +1 -1
  37. data/app/components/ariadne/slideover_component.rb +3 -3
  38. data/app/components/ariadne/tab_component.rb +1 -1
  39. data/app/components/ariadne/tab_container_component/tab-container-component.ts +1 -1
  40. data/app/components/ariadne/tab_container_component.rb +7 -7
  41. data/app/components/ariadne/tab_nav_component.rb +5 -5
  42. data/app/components/ariadne/table_nav_component.rb +42 -42
  43. data/app/components/ariadne/time_ago_component.rb +1 -1
  44. data/app/components/ariadne/timeline_component.rb +1 -1
  45. data/app/components/ariadne/tooltip_component/tooltip-component.ts +5 -5
  46. data/app/components/ariadne/tooltip_component.rb +1 -1
  47. data/app/lib/ariadne/action_view_extensions/form_helper.rb +1 -1
  48. data/app/lib/ariadne/class_name_helper.rb +1 -1
  49. data/app/lib/ariadne/form_builder.rb +10 -10
  50. data/lib/ariadne/view_components/linters/argument_mappers/conversion_error.rb +10 -0
  51. data/lib/ariadne/view_components/linters/autocorrectable.rb +32 -0
  52. data/lib/ariadne/view_components/linters/base_linter.rb +202 -0
  53. data/lib/ariadne/view_components/linters/tag_tree_helpers.rb +76 -0
  54. data/lib/ariadne/view_components/version.rb +2 -1
  55. data/lib/tasks/build.rake +6 -0
  56. data/lib/tasks/coverage.rake +4 -1
  57. data/lib/tasks/docs.rake +5 -1
  58. data/lib/tasks/test.rake +19 -0
  59. data/static/classes.yml +3 -1
  60. metadata +8 -16
  61. data/app/assets/javascripts/ariadne-form-with.d.ts +0 -20
  62. data/app/assets/javascripts/ariadne-form.d.ts +0 -22
  63. data/app/assets/javascripts/ariadne.d.ts +0 -2
  64. data/app/assets/javascripts/ariadne_view_components.js +0 -8
  65. data/app/assets/javascripts/ariadne_view_components.js.map +0 -1
  66. data/app/assets/javascripts/clipboard-copy-component.d.ts +0 -4
  67. data/app/assets/javascripts/comment-component.d.ts +0 -12
  68. data/app/assets/javascripts/rich-text-area-component.d.ts +0 -6
  69. data/app/assets/javascripts/slideover-component.d.ts +0 -9
  70. data/app/assets/javascripts/tab-container-component.d.ts +0 -1
  71. data/app/assets/javascripts/tab-nav-component.d.ts +0 -9
  72. data/app/assets/javascripts/time-ago-component.d.ts +0 -1
  73. data/app/assets/javascripts/time_ago_component.d.ts +0 -1
  74. data/app/assets/javascripts/tooltip-component.d.ts +0 -24
@@ -36,15 +36,15 @@ module Ariadne
36
36
 
37
37
  # @example Default
38
38
  # <%= render(Ariadne::DropdownComponent.new) do |c| %>
39
- # <% c.button do %>
39
+ # <% c.with_button do %>
40
40
  # Dropdown
41
41
  # <% end %>
42
42
  #
43
- # <% c.menu do |menu| %>
44
- # <% menu.header { "Header" } %>
45
- # <% menu.item { "Item 1" } %>
46
- # <% menu.item { "Item 2" } %>
47
- # <% menu.item { "Item 3" } %>
43
+ # <% c.with_menu do |menu| %>
44
+ # <% menu.with_header { "Header" } %>
45
+ # <% menu.with_item { "Item 1" } %>
46
+ # <% menu.with_item { "Item 2" } %>
47
+ # <% menu.with_item { "Item 3" } %>
48
48
  # <% end %>
49
49
  # <% end %>
50
50
  #
@@ -54,95 +54,95 @@ module Ariadne
54
54
  # Dividers can be used to separate a group of items. They don't have any content.
55
55
  # @code
56
56
  # <%= render(Ariadne::DropdownComponent.new) do |c| %>
57
- # <% c.button do %>
57
+ # <% c.with_button do %>
58
58
  # Dropdown
59
59
  # <% end %>
60
60
  #
61
- # <% c.menu do |menu| %>
62
- # <% menu.header { "Header" } %>
63
- # <%= menu.item { "Item 1" } %>
64
- # <%= menu.item { "Item 2" } %>
65
- # <%= menu.item(divider: true) %>
66
- # <%= menu.item { "Item 3" } %>
67
- # <%= menu.item { "Item 4" } %>
68
- # <%= menu.item(divider: true) %>
69
- # <%= menu.item { "Item 5" } %>
70
- # <%= menu.item { "Item 6" } %>
61
+ # <% c.with_menu do |menu| %>
62
+ # <% menu.with_header { "Header" } %>
63
+ # <%= menu.with_item { "Item 1" } %>
64
+ # <%= menu.with_item { "Item 2" } %>
65
+ # <%= menu.with_item(divider: true) %>
66
+ # <%= menu.with_item { "Item 3" } %>
67
+ # <%= menu.with_item { "Item 4" } %>
68
+ # <%= menu.with_item(divider: true) %>
69
+ # <%= menu.with_item { "Item 5" } %>
70
+ # <%= menu.with_item { "Item 6" } %>
71
71
  # <% end %>
72
72
  # <% end %>
73
73
  #
74
74
  # @example With direction
75
75
  # <%= render(Ariadne::DropdownComponent.new) do |c| %>
76
- # <% c.button do %>
76
+ # <% c.with_button do %>
77
77
  # Dropdown
78
78
  # <% end %>
79
79
  #
80
- # <% c.menu(direction: :s) do |menu| %>
80
+ # <% c.with_menu(direction: :s) do |menu| %>
81
81
  # <% menu.header { "Header" } %>
82
- # <%= menu.item { "Item 1" } %>
83
- # <%= menu.item { "Item 2" } %>
84
- # <%= menu.item { "Item 3" } %>
85
- # <%= menu.item { "Item 4" } %>
82
+ # <%= menu.with_item { "Item 1" } %>
83
+ # <%= menu.with_item { "Item 2" } %>
84
+ # <%= menu.with_item { "Item 3" } %>
85
+ # <%= menu.with_item { "Item 4" } %>
86
86
  # <% end %>
87
87
  # <% end %>
88
88
  #
89
89
  # @example With caret
90
90
  # <%= render(Ariadne::DropdownComponent.new(with_caret: true)) do |c| %>
91
- # <% c.button do %>
91
+ # <% c.with_button do %>
92
92
  # Dropdown
93
93
  # <% end %>
94
94
  #
95
- # <% c.menu do |menu| %>
96
- # <% menu.header { "Header" } %>
97
- # <%= menu.item { "Item 1" } %>
98
- # <%= menu.item { "Item 2" } %>
99
- # <%= menu.item { "Item 3" } %>
100
- # <%= menu.item { "Item 4" } %>
95
+ # <% c.with_menu do |menu| %>
96
+ # <% menu.with_header { "Header" } %>
97
+ # <%= menu.with_item { "Item 1" } %>
98
+ # <%= menu.with_item { "Item 2" } %>
99
+ # <%= menu.with_item { "Item 3" } %>
100
+ # <%= menu.with_item { "Item 4" } %>
101
101
  # <% end %>
102
102
  # <% end %>
103
103
  #
104
104
  # @example Customizing the button
105
105
  # <%= render(Ariadne::DropdownComponent.new) do |c| %>
106
- # <% c.button(scheme: :info, size: :sm) do %>
106
+ # <% c.with_button(scheme: :info, size: :sm) do %>
107
107
  # Dropdown
108
108
  # <% end %>
109
109
  #
110
- # <% c.menu do |menu| %>
111
- # <% menu.header { "Header" } %>
112
- # <%= menu.item { "Item 1" } %>
113
- # <%= menu.item { "Item 2" } %>
114
- # <%= menu.item { "Item 3" } %>
115
- # <%= menu.item { "Item 4" } %>
110
+ # <% c.with_menu do |menu| %>
111
+ # <% menu.with_header { "Header" } %>
112
+ # <%= menu.with_item { "Item 1" } %>
113
+ # <%= menu.with_item { "Item 2" } %>
114
+ # <%= menu.with_item { "Item 3" } %>
115
+ # <%= menu.with_item { "Item 4" } %>
116
116
  # <% end %>
117
117
  # <% end %>
118
118
  #
119
119
  # @example Menu as list
120
120
  # <%= render(Ariadne::DropdownComponent.new) do |c| %>
121
- # <% c.button do %>
121
+ # <% c.with_button do %>
122
122
  # Dropdown
123
123
  # <% end %>
124
124
  #
125
- # <% c.menu(as: :list) do |menu| %>
126
- # <% menu.header { "Header" } %>
127
- # <% menu.item { "Item 1" } %>
128
- # <% menu.item { "Item 2" } %>
129
- # <% menu.item(divider: true) %>
130
- # <% menu.item { "Item 3" } %>
131
- # <% menu.item { "Item 4" } %>
125
+ # <% c.with_menu(as: :list) do |menu| %>
126
+ # <% menu.with_header { "Header" } %>
127
+ # <% menu.with_item { "Item 1" } %>
128
+ # <% menu.with_item { "Item 2" } %>
129
+ # <% menu.with_item(divider: true) %>
130
+ # <% menu.with_item { "Item 3" } %>
131
+ # <% menu.with_item { "Item 4" } %>
132
132
  # <% end %>
133
133
  # <% end %>
134
134
  #
135
135
  # @example Customizing menu items
136
136
  # <%= render(Ariadne::DropdownComponent.new) do |c| %>
137
- # <% c.button do %>
137
+ # <% c.with_button do %>
138
138
  # Dropdown
139
139
  # <% end %>
140
140
  #
141
- # <% c.menu do |menu| %>
142
- # <% menu.header { "Header" } %>
143
- # <% menu.item(tag: :button) { "Item 1" } %>
144
- # <% menu.item(classes: "ariadne-text-red-500") { "Item 2" } %>
145
- # <% menu.item { "Item 3" } %>
141
+ # <% c.with_menu do |menu| %>
142
+ # <% menu.with_header { "Header" } %>
143
+ # <% menu.with_item(tag: :button) { "Item 1" } %>
144
+ # <% menu.with_item(classes: "ariadne-text-red-500") { "Item 2" } %>
145
+ # <% menu.with_item { "Item 3" } %>
146
146
  # <% end %>
147
147
  # <% end %>
148
148
  #
@@ -152,7 +152,7 @@ module Ariadne
152
152
  # @param attributes [Hash] <%= link_to_attributes_docs %>
153
153
  def initialize(overlay: :default, with_caret: false, classes: "", attributes: {})
154
154
  @tag = check_incoming_tag(DEFAULT_TAG, tag)
155
- @classes = class_names(
155
+ @classes = merge_class_names(
156
156
  DEFAULT_CLASSES,
157
157
  classes,
158
158
  )
@@ -63,9 +63,9 @@ module Ariadne
63
63
  renders_one :action, lambda { |tag: :div, classes: "", attributes: {}|
64
64
  tag = check_incoming_tag(:div, tag)
65
65
 
66
- actual_classes = class_names(classes)
66
+ actual_classes = merge_class_names(classes)
67
67
 
68
- Ariadne::BaseComponent.new(tag: tag, classes: actual_classes, attributes: attributes)
68
+ render(Ariadne::BaseComponent.new(tag: tag, classes: actual_classes, attributes: attributes))
69
69
  }
70
70
 
71
71
  # @example Schemes
@@ -79,13 +79,13 @@ module Ariadne
79
79
  #
80
80
  # @example Icon
81
81
  # <%= render(Ariadne::FlashComponent.new) do |component| %>
82
- # <% component.icon(icon: :"user-group", variant: HeroiconsHelper::Icon::VARIANT_OUTLINE) %>
82
+ # <% component.with_icon(icon: :"user-group", variant: HeroiconsHelper::Icon::VARIANT_OUTLINE) %>
83
83
  # Look at this icon.
84
84
  # <% end %>
85
85
  #
86
86
  # @example With actions
87
87
  # <%= render(Ariadne::FlashComponent.new) do |component| %>
88
- # <% component.action do %>
88
+ # <% component.with_action do %>
89
89
  # <%= render(Ariadne::ButtonComponent.new(size: :sm)) { "Take action" } %>
90
90
  # <% end %>
91
91
  # This is a flash message with actions!
@@ -104,7 +104,7 @@ module Ariadne
104
104
 
105
105
  @scheme = fetch_or_raise(VALID_CONTENT_SCHEMES, scheme)
106
106
 
107
- @classes = class_names(
107
+ @classes = merge_class_names(
108
108
  DEFAULT_CLASSES,
109
109
  CONTENT_SCHEME_CLASS_MAPPINGS[@scheme],
110
110
  classes,
@@ -0,0 +1,5 @@
1
+ <%= render Ariadne::BaseComponent.new(tag: @tag, classes: @classes, attributes: @attributes) do |component| %>
2
+ <% items.each do |item| %>
3
+ <%= item %>
4
+ <% end %>
5
+ <% end %>
@@ -10,6 +10,13 @@ module Ariadne
10
10
 
11
11
  VALID_TYPES = [:row, :column, :row_reverse, :column_reverse].freeze
12
12
 
13
+ # The sub-items(s) to render
14
+ renders_many :items, lambda { |static_content = nil, &block|
15
+ next static_content if static_content.present?
16
+
17
+ view_context.capture { block&.call }
18
+ }
19
+
13
20
  # @example Default
14
21
  #
15
22
  # <%= render(Ariadne::FlexComponent.new(type: :column)) { "Example" } %>
@@ -33,7 +40,7 @@ module Ariadne
33
40
  "ariadne-flex-col-reverse"
34
41
  end
35
42
 
36
- @classes = class_names(
43
+ @classes = merge_class_names(
37
44
  DEFAULT_CLASSES,
38
45
  classes,
39
46
  flex_class,
@@ -42,8 +49,8 @@ module Ariadne
42
49
  @attributes = attributes
43
50
  end
44
51
 
45
- def call
46
- render(Ariadne::BaseComponent.new(tag: @tag, classes: @classes, attributes: @attributes)) { content }
52
+ def render?
53
+ items?
47
54
  end
48
55
  end
49
56
  end
@@ -7,12 +7,12 @@ module Ariadne
7
7
 
8
8
  # @example Default
9
9
  #
10
- # <%= render(Ariadne::FooterComponent.new) %>
10
+ # <%= render(Ariadne::FooterComponent.new) { "Footer." } %>
11
11
  #
12
12
  # @param classes [String] <%= link_to_classes_docs %>
13
13
  # @param attributes [Hash] <%= link_to_attributes_docs %>
14
14
  def initialize(classes: "", attributes: {})
15
- @classes = class_names(
15
+ @classes = merge_class_names(
16
16
  DEFAULT_CLASSES,
17
17
  classes,
18
18
  )
@@ -17,7 +17,7 @@ module Ariadne
17
17
  # @param classes [String] <%= link_to_classes_docs %>
18
18
  # @param attributes [Hash] <%= link_to_attributes_docs %>
19
19
  def initialize(classes: "", attributes: {})
20
- @classes = class_names(
20
+ @classes = merge_class_names(
21
21
  DEFAULT_CLASSES,
22
22
  classes,
23
23
  )
@@ -34,7 +34,7 @@ module Ariadne
34
34
  DEFAULT_ENTRY_CLASSES = "ariadne-group ariadne-flex-1 ariadne-flex ariadne-flex-col ariadne-p-8 hover:ariadne-text-gray-500"
35
35
  renders_one :entry, lambda { |classes: "", attributes: {}, &block|
36
36
  view_context.capture do
37
- actual_classes = class_names(DEFAULT_ENTRY_CLASSES, classes)
37
+ actual_classes = merge_class_names(DEFAULT_ENTRY_CLASSES, classes)
38
38
  render(Ariadne::BaseComponent.new(tag: :div, classes: actual_classes, attributes: attributes)) { block&.call }
39
39
  end
40
40
  }
@@ -42,7 +42,7 @@ module Ariadne
42
42
  DEFAULT_ACTION_LINK_CLASSES = "ariadne-relative ariadne--mr-px ariadne-w-0 ariadne-flex-1 ariadne-inline-flex ariadne-items-center ariadne-justify-center ariadne-py-4 ariadne-text-sm ariadne-font-medium ariadne-border ariadne-border-transparent"
43
43
  DEFAULT_ACTION_LINK_COLORS = "ariadne-h-full hover:ariadne-text-gray-500"
44
44
  renders_many :actions, lambda { |href:, icon:, label:, size: Ariadne::HeroiconComponent::SIZE_DEFAULT, variant: HeroiconsHelper::Icon::VARIANT_SOLID, classes: "", attributes: {}, text_classes: ""|
45
- actual_classes = class_names(DEFAULT_ACTION_LINK_CLASSES, DEFAULT_ACTION_LINK_COLORS, classes)
45
+ actual_classes = merge_class_names(DEFAULT_ACTION_LINK_CLASSES, DEFAULT_ACTION_LINK_COLORS, classes)
46
46
  render(Ariadne::LinkComponent.new(href: href, classes: actual_classes, attributes: attributes)) do
47
47
  render(Ariadne::HeroiconComponent.new(icon: icon, size: size, variant: variant, text_classes: text_classes)) { label }
48
48
  end
@@ -55,13 +55,9 @@ module Ariadne
55
55
  attr_reader :classes, :attributes
56
56
 
57
57
  def initialize(classes: "", attributes: {})
58
- @classes = class_names(DEFAULT_ITEM_CLASSES, classes)
58
+ @classes = merge_class_names(DEFAULT_ITEM_CLASSES, classes)
59
59
  @attributes = attributes
60
60
  end
61
-
62
- def call
63
- render(Ariadne::BaseComponent.new(tag: :div, classes: @classes, attributes: @attributes))
64
- end
65
61
  end
66
62
  end
67
63
  end
@@ -23,10 +23,10 @@ module Ariadne
23
23
  @text = text
24
24
 
25
25
  if src.blank?
26
- actual_classes = class_names(DEFAULT_TEXT_LOGO_CLASSES, classes)
26
+ actual_classes = merge_class_names(DEFAULT_TEXT_LOGO_CLASSES, classes)
27
27
  Ariadne::Text.new(tag: :span, classes: actual_classes, attributes: attributes)
28
28
  else
29
- actual_classes = class_names(DEFAULT_IMAGE_LOGO_CLASSES, classes)
29
+ actual_classes = merge_class_names(DEFAULT_IMAGE_LOGO_CLASSES, classes)
30
30
  actual_attributes = { width: 40, height: 40 }.merge(attributes)
31
31
  @image_logo = Ariadne::ImageComponent.new(src: src, alt: alt, classes: actual_classes, attributes: actual_attributes)
32
32
  end
@@ -40,7 +40,7 @@ module Ariadne
40
40
  # @param attributes [Hash] <%= link_to_attributes_docs %>
41
41
  DEFAULT_NAV_LINK_CLASSES = "ariadne-inline-block ariadne-rounded-lg ariadne-py-1 ariadne-px-2 ariadne-text-sm text-slate-700 hover:bg-slate-100 hover:text-slate-900"
42
42
  renders_many :navigation_links, lambda { |tag: Ariadne::LinkComponent::DEFAULT_TAG, href:, classes: "", attributes: {}|
43
- actual_classes = class_names(DEFAULT_NAV_LINK_CLASSES, classes)
43
+ actual_classes = merge_class_names(DEFAULT_NAV_LINK_CLASSES, classes)
44
44
  Ariadne::LinkComponent.new(tag: tag, href: href, classes: actual_classes, attributes: attributes)
45
45
  }
46
46
 
@@ -51,7 +51,7 @@ module Ariadne
51
51
  # @param classes [String] <%= link_to_classes_docs %>
52
52
  # @param attributes [Hash] <%= link_to_attributes_docs %>
53
53
  renders_many :action_links, lambda { |tag: Ariadne::LinkComponent::DEFAULT_TAG, href:, classes: "", attributes: {}|
54
- actual_classes = class_names(DEFAULT_NAV_LINK_CLASSES, classes)
54
+ actual_classes = merge_class_names(DEFAULT_NAV_LINK_CLASSES, classes)
55
55
  Ariadne::LinkComponent.new(tag: tag, href: href, classes: actual_classes, attributes: attributes)
56
56
  }
57
57
 
@@ -63,13 +63,13 @@ module Ariadne
63
63
  # @param attributes [Hash] <%= link_to_attributes_docs %>
64
64
  DEFAULT_SIGNUP_LINK_CLASSES = "group ariadne-inline-flex ariadne-items-center ariadne-justify-center ariadne-rounded-full ariadne-py-2 ariadne-px-4 ariadne-text-sm ariadne-font-semibold focus:ariadne-outline-none focus-visible:ariadne-outline-2 focus-visible:outline-offset-2"
65
65
  renders_one :signup_link, lambda { |tag: Ariadne::LinkComponent::DEFAULT_TAG, href:, classes: "", attributes: {}|
66
- actual_classes = class_names(DEFAULT_SIGNUP_LINK_CLASSES, classes)
66
+ actual_classes = merge_class_names(DEFAULT_SIGNUP_LINK_CLASSES, classes)
67
67
  Ariadne::LinkComponent.new(tag: tag, href: href, classes: actual_classes, attributes: attributes)
68
68
  }
69
69
 
70
70
  DEFAULT_PROFILE_LINK_CLASSES = "group ariadne-inline-flex ariadne-items-center ariadne-justify-center ariadne-rounded-full ariadne-py-2 ariadne-px-4 ariadne-text-sm ariadne-font-semibold focus:ariadne-outline-none focus-visible:ariadne-outline-2 focus-visible:outline-offset-2"
71
71
  renders_one :profile_link, lambda { |tag: Ariadne::LinkComponent::DEFAULT_TAG, href:, classes: "", attributes: {}|
72
- actual_classes = class_names(DEFAULT_PROFILE_LINK_CLASSES, classes)
72
+ actual_classes = merge_class_names(DEFAULT_PROFILE_LINK_CLASSES, classes)
73
73
  Ariadne::LinkComponent.new(tag: tag, href: href, classes: actual_classes, attributes: attributes)
74
74
  }
75
75
 
@@ -84,7 +84,7 @@ module Ariadne
84
84
  # @param classes [String] <%= link_to_classes_docs %>
85
85
  # @param attributes [Hash] <%= link_to_attributes_docs %>
86
86
  def initialize(classes: "", attributes: {})
87
- @classes = class_names(
87
+ @classes = merge_class_names(
88
88
  DEFAULT_CLASSES,
89
89
  classes,
90
90
  )
@@ -39,7 +39,7 @@ module Ariadne
39
39
  @tag = fetch_or_raise(TAG_OPTIONS, tag)
40
40
  @attributes = attributes
41
41
 
42
- @classes = class_names(*TAG_TO_CLASSES[tag], classes)
42
+ @classes = merge_class_names(*TAG_TO_CLASSES[tag], classes)
43
43
  end
44
44
 
45
45
  def call
@@ -145,13 +145,13 @@ module Ariadne
145
145
  }
146
146
 
147
147
  @icon = heroicon(icon, variant: variant, **attributes)
148
- @classes = class_names(
148
+ @classes = merge_class_names(
149
149
  @icon.attributes[:class],
150
150
  classes,
151
151
  )
152
152
  @attributes.merge!(@icon.attributes.except(:class, :"aria-hidden"))
153
153
 
154
- @text_classes = class_names(DEFAULT_TEXT_CLASSES, text_classes)
154
+ @text_classes = merge_class_names(DEFAULT_TEXT_CLASSES, text_classes)
155
155
  @text_attributes = text_attributes
156
156
  end
157
157
 
@@ -28,7 +28,7 @@ module Ariadne
28
28
  DEFAULT_TEXT_CLOSED_CLASSES = "ariadne-text-state-closed"
29
29
  DEFAULT_TEXT_CLASSES = "ariadne-pl-2 ariadne-text-sm ariadne-font-medium"
30
30
  renders_one :icon, lambda { |tag: :svg, icon:, variant:, size: Ariadne::HeroiconComponent::SIZE_DEFAULT, classes: "", attributes: {}, text_classes: "", text_attributes: {}|
31
- actual_text_classes = class_names(DEFAULT_TEXT_CLASSES, text_classes)
31
+ actual_text_classes = merge_class_names(DEFAULT_TEXT_CLASSES, text_classes)
32
32
  Ariadne::HeroiconComponent.new(tag: tag, icon: icon, variant: variant, size: size, classes: classes, attributes: attributes, text_classes: actual_text_classes, text_attributes: text_attributes) { content }
33
33
  }
34
34
 
@@ -38,7 +38,7 @@ module Ariadne
38
38
 
39
39
  DEFAULT_LABEL_CLASSES = "ariadne-pl-2 ariadne-text-sm ariadne-font-medium"
40
40
  renders_one :text, lambda { |classes: "", attributes: {}|
41
- actual_classes = class_names(DEFAULT_LABEL_CLASSES, classes)
41
+ actual_classes = merge_class_names(DEFAULT_LABEL_CLASSES, classes)
42
42
  Ariadne::BaseComponent.new(tag: :span, classes: actual_classes, attributes: attributes) { content }
43
43
  }
44
44
 
@@ -47,17 +47,17 @@ module Ariadne
47
47
  # @example Default
48
48
  #
49
49
  # <%= render(Ariadne::InlineFlexComponent.new) do |c| %>
50
- # <% c.item { Ariadne::InlineFlexComponent::STATE_OPEN_SVG.html_safe } %>
50
+ # <% c.with_item { Ariadne::InlineFlexComponent::STATE_OPEN_SVG.html_safe } %>
51
51
  # <% end %>
52
52
  #
53
53
  # # TODO: STATE_CLOSED_SVG colors didn't show until it was listed in an example
54
54
  # <%= render(Ariadne::InlineFlexComponent.new) do |c| %>
55
- # <% c.item { Ariadne::InlineFlexComponent::STATE_CLOSED_SVG.html_safe } %>
55
+ # <% c.with_item { Ariadne::InlineFlexComponent::STATE_CLOSED_SVG.html_safe } %>
56
56
  # <% end %>
57
57
  #
58
58
  # <%= render(Ariadne::InlineFlexComponent.new) do |c| %>
59
- # <% c.icon(icon: :check, size: :sm, variant: HeroiconsHelper::Icon::VARIANT_SOLID) %>
60
- # <% c.text { "Closed" } %>
59
+ # <% c.with_icon(icon: :check, size: :sm, variant: HeroiconsHelper::Icon::VARIANT_SOLID) %>
60
+ # <% c.with_text { "Closed" } %>
61
61
  # <% end %>
62
62
  #
63
63
  # @param tag [Symbol, String] The rendered tag name
@@ -65,7 +65,7 @@ module Ariadne
65
65
  # @param attributes [Hash] <%= link_to_attributes_docs %>
66
66
  def initialize(tag: DEFAULT_TAG, classes: "", attributes: {})
67
67
  @tag = check_incoming_tag(DEFAULT_TAG, tag)
68
- @classes = class_names(DEFAULT_CLASSES, classes)
68
+ @classes = merge_class_names(DEFAULT_CLASSES, classes)
69
69
  @attributes = attributes
70
70
  end
71
71
  end
@@ -35,7 +35,7 @@ module Ariadne
35
35
  # Use tooltips sparingly and as a last resort. Consult the <%= link_to_component(Ariadne::TooltipComponent) %> documentation for more information.
36
36
  # @code
37
37
  # <%= render(Ariadne::LinkComponent.new(href: "#", attributes: { id: "link-with-tooltip" })) do |c| %>
38
- # <% c.tooltip(text: "Tooltip text") %>
38
+ # <% c.with_tooltip(text: "Tooltip text") %>
39
39
  # Link
40
40
  # <% end %>
41
41
  #
@@ -44,7 +44,7 @@ module Ariadne
44
44
  # @param actionable [Boolean] If true, adds additional classes to the link to make it more aware.
45
45
  # @param classes [String] <%= link_to_classes_docs %>
46
46
  # @param attributes [Hash] <%= link_to_attributes_docs %>
47
- def initialize(tag: DEFAULT_TAG, href:, actionable: false, classes: "", attributes: {})
47
+ def initialize(tag: DEFAULT_TAG, href:, actionable: false, classes: "", attributes: {})
48
48
  @tag = check_incoming_tag(DEFAULT_TAG, tag)
49
49
 
50
50
  @attributes = attributes
@@ -52,7 +52,7 @@ module Ariadne
52
52
 
53
53
  @id = @attributes[:id]
54
54
 
55
- @classes = class_names(DEFAULT_CLASSES, classes)
55
+ @classes = merge_class_names(DEFAULT_CLASSES, classes)
56
56
  @classes << DEFAULT_ACTIONABLE_CLASSES if actionable
57
57
  end
58
58
 
@@ -12,7 +12,7 @@ module Ariadne
12
12
  # <% numbers = [1, 2, 3] %>
13
13
  # <%= render(Ariadne::ListComponent.new) do |list| %>
14
14
  # <% numbers.each do |number| %>
15
- # <%= list.item do |item| %>
15
+ # <%= list.with_item do |item| %>
16
16
  # <%= number %>
17
17
  # <% end %>
18
18
  # <% end %>
@@ -23,10 +23,14 @@ module Ariadne
23
23
  # @param attributes [Hash] <%= link_to_attributes_docs %>
24
24
  def initialize(classes: "", attributes: {})
25
25
  @tag = DEFAULT_TAG
26
- @classes = class_names(DEFAULT_UL_CLASSES, classes)
26
+ @classes = merge_class_names(DEFAULT_UL_CLASSES, classes)
27
27
  @attributes = attributes
28
28
  end
29
29
 
30
+ def render?
31
+ items?
32
+ end
33
+
30
34
  # This component is part of `ListComponent` and should not be
31
35
  # used as a standalone component.
32
36
  class ListItem < Ariadne::Component
@@ -36,7 +40,7 @@ module Ariadne
36
40
 
37
41
  def initialize(link: {}, classes: "", attributes: {})
38
42
  @link = link
39
- @classes = class_names(DEFAULT_ITEM_CLASSES, classes)
43
+ @classes = merge_class_names(DEFAULT_ITEM_CLASSES, classes)
40
44
  @attributes = attributes
41
45
  end
42
46
 
@@ -51,7 +55,9 @@ module Ariadne
51
55
  def call
52
56
  render(Ariadne::BaseComponent.new(tag: :li, classes: @classes, attributes: @attributes)) do
53
57
  if linked?
54
- render(Ariadne::LinkComponent.new(href: @link[:href], classes: @link[:classes], attributes: @link[:attributes])) do
58
+ classes = @link[:classes] || ""
59
+ attributes = @link[:attributes] || {}
60
+ render(Ariadne::LinkComponent.new(href: @link[:href], classes: classes, attributes: attributes)) do
55
61
  content
56
62
  end
57
63
  else
@@ -19,7 +19,7 @@ module Ariadne
19
19
  # @param attributes [Hash] <%= link_to_attributes_docs %>
20
20
  def initialize(classes: "", attributes: {})
21
21
  @tag = :div
22
- @classes = class_names(
22
+ @classes = merge_class_names(
23
23
  DEFAULT_CLASSES,
24
24
  classes,
25
25
  )
@@ -21,7 +21,7 @@ module Ariadne
21
21
  # @param attributes [Hash] <%= link_to_attributes_docs %>
22
22
  def initialize(classes: "", attributes: {})
23
23
  @tag = DEFAULT_TAG
24
- @classes = class_names(
24
+ @classes = merge_class_names(
25
25
  DEFAULT_CLASSES,
26
26
  classes,
27
27
  )
@@ -58,9 +58,9 @@ module Ariadne
58
58
  def initialize(link: {}, classes: "", attributes: {})
59
59
  @link = link
60
60
  if @link.present?
61
- @link["classes"] = class_names(DEFAULT_WRAPPER_CLASSES, @link["classes"])
61
+ @link["classes"] = merge_class_names(DEFAULT_WRAPPER_CLASSES, @link["classes"])
62
62
  end
63
- @classes = class_names(DEFAULT_ITEM_CLASSES, classes)
63
+ @classes = merge_class_names(DEFAULT_ITEM_CLASSES, classes)
64
64
  @attributes = attributes
65
65
  end
66
66
 
@@ -28,7 +28,7 @@ module Ariadne
28
28
  @attributes["style"] = "background-color: rgba(#{@red}, #{@green}, #{@blue}, #{@alpha});"
29
29
  @text_color = contrast_of(@red, @green, @blue)
30
30
 
31
- @classes = class_names(
31
+ @classes = merge_class_names(
32
32
  DEFAULT_CLASSES,
33
33
  classes,
34
34
  @text_color,
@@ -25,12 +25,12 @@ export default class RichTextArea extends Controller {
25
25
  editorProps: {
26
26
  attributes: {
27
27
  class:
28
- 'ariadne-h-28 ariadne-max-h-48 ariadne-p-2 ariadne-rounded-lg ariadne-overflow-y-auto focus:ariadne-outline-none'
29
- }
28
+ 'ariadne-h-28 ariadne-max-h-48 ariadne-p-2 ariadne-rounded-lg ariadne-overflow-y-auto focus:ariadne-outline-none',
29
+ },
30
30
  },
31
31
  parseOptions: {
32
- preserveWhitespace: true
33
- }
32
+ preserveWhitespace: true,
33
+ },
34
34
  })
35
35
 
36
36
  const tiptapValueContainer = editorElement.previousElementSibling
@@ -23,7 +23,7 @@ module Ariadne
23
23
  @sr_label = sr_label
24
24
  @has_form = has_form
25
25
 
26
- @classes = class_names(
26
+ @classes = merge_class_names(
27
27
  DEFAULT_CLASSES,
28
28
  classes,
29
29
  )
@@ -16,7 +16,7 @@ module Ariadne
16
16
 
17
17
  DEFAULT_BUTTON_CLASSES = "ariadne-inline-flex ariadne-items-center ariadne-shadow-sm ariadne-px-4 ariadne-py-1.5 ariadne-pb-2 ariadne-text-sm ariadne-leading-5 ariadne-font-medium ariadne-rounded-full " + Ariadne::ButtonComponent::SCHEME_CLASS_MAPPINGS[:default]
18
18
  renders_one :open_button, lambda { |selected: false, classes: "", attributes: {}|
19
- actual_classes = class_names(DEFAULT_BUTTON_CLASSES, classes, selected ? "" : BASE_HIDDEN_CLASS)
19
+ actual_classes = merge_class_names(DEFAULT_BUTTON_CLASSES, classes, selected ? "" : BASE_HIDDEN_CLASS)
20
20
 
21
21
  attributes[:id] ||= "btnOpen"
22
22
  attributes[:"data-slideover-component-target"] ||= "slidePanel"
@@ -27,7 +27,7 @@ module Ariadne
27
27
  }
28
28
 
29
29
  renders_one :close_button, lambda { |selected: false, classes: "", attributes: {}|
30
- actual_classes = class_names(DEFAULT_BUTTON_CLASSES, classes, selected ? "" : BASE_HIDDEN_CLASS)
30
+ actual_classes = merge_class_names(DEFAULT_BUTTON_CLASSES, classes, selected ? "" : BASE_HIDDEN_CLASS)
31
31
 
32
32
  attributes[:id] ||= "btnClose"
33
33
  attributes[:"data-slideover-component-target"] ||= "slidePanel"
@@ -49,7 +49,7 @@ module Ariadne
49
49
  # @param attributes [Hash] <%= link_to_attributes_docs %>
50
50
  def initialize(tag: DEFAULT_TAG, direction:, open_text: "Open", close_text: "Close", classes: "", attributes: {})
51
51
  @tag = check_incoming_tag(DEFAULT_TAG, tag)
52
- @classes = class_names(
52
+ @classes = merge_class_names(
53
53
  DEFAULT_CLASSES,
54
54
  classes,
55
55
  )
@@ -63,7 +63,7 @@ module Ariadne
63
63
  @href = href
64
64
  @selected = selected
65
65
 
66
- @classes = class_names(
66
+ @classes = merge_class_names(
67
67
  DEFAULT_CLASSES,
68
68
  classes,
69
69
  )
@@ -5,7 +5,7 @@ const DEFAULT_SELECTED_CLASSES: string[] = ['ariadne-border-slate-500', 'ariadne
5
5
  const DEFAULT_UNSELECTED_CLASSES: string[] = [
6
6
  'ariadne-text-gray-500',
7
7
  'hover:ariadne-text-gray-700',
8
- 'hover:ariadne-border-gray-300'
8
+ 'hover:ariadne-border-gray-300',
9
9
  ]
10
10
 
11
11
  for (const tabContainer of document.getElementsByTagName('tab-container')) {