ariadne_view_components 0.0.34-arm64-darwin → 0.0.35-arm64-darwin
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +66 -5
- data/README.md +2 -2
- data/app/components/ariadne/avatar_component.rb +1 -1
- data/app/components/ariadne/avatar_stack_component.rb +7 -7
- data/app/components/ariadne/base_button.rb +2 -2
- data/app/components/ariadne/base_component.rb +2 -2
- data/app/components/ariadne/blankslate_component.rb +9 -9
- data/app/components/ariadne/body_component.rb +1 -1
- data/app/components/ariadne/button_component.rb +8 -6
- data/app/components/ariadne/clipboard_copy_component.rb +1 -1
- data/app/components/ariadne/comment_component/comment_component.html.erb +6 -6
- data/app/components/ariadne/comment_component.rb +5 -5
- data/app/components/ariadne/component.rb +0 -1
- data/app/components/ariadne/container_component.rb +1 -1
- data/app/components/ariadne/counter_component.rb +1 -1
- data/app/components/ariadne/details_component.rb +10 -9
- data/app/components/ariadne/dropdown/menu_component.rb +3 -3
- data/app/components/ariadne/dropdown_component/dropdown_component.html.erb +2 -2
- data/app/components/ariadne/dropdown_component.rb +52 -52
- data/app/components/ariadne/flash_component.rb +5 -5
- data/app/components/ariadne/flex_component/flex_component.html.erb +5 -0
- data/app/components/ariadne/flex_component.rb +10 -3
- data/app/components/ariadne/footer_component.rb +2 -2
- data/app/components/ariadne/grid_component.rb +4 -8
- data/app/components/ariadne/header_component.rb +7 -7
- data/app/components/ariadne/heading_component.rb +1 -1
- data/app/components/ariadne/heroicon_component.rb +2 -2
- data/app/components/ariadne/inline_flex_component.rb +7 -7
- data/app/components/ariadne/link_component.rb +3 -3
- data/app/components/ariadne/list_component.rb +10 -4
- data/app/components/ariadne/narrow_container_component.rb +1 -1
- data/app/components/ariadne/panel_bar_component.rb +3 -3
- data/app/components/ariadne/pill_component.rb +1 -1
- data/app/components/ariadne/rich_text_area_component/rich-text-area-component.ts +4 -4
- data/app/components/ariadne/rich_text_area_component.rb +1 -1
- data/app/components/ariadne/slideover_component.rb +3 -3
- data/app/components/ariadne/tab_component.rb +1 -1
- data/app/components/ariadne/tab_container_component/tab-container-component.ts +1 -1
- data/app/components/ariadne/tab_container_component.rb +7 -7
- data/app/components/ariadne/tab_nav_component.rb +5 -5
- data/app/components/ariadne/table_nav_component.rb +42 -42
- data/app/components/ariadne/time_ago_component.rb +1 -1
- data/app/components/ariadne/timeline_component.rb +1 -1
- data/app/components/ariadne/tooltip_component/tooltip-component.ts +5 -5
- data/app/components/ariadne/tooltip_component.rb +1 -1
- data/app/lib/ariadne/action_view_extensions/form_helper.rb +1 -1
- data/app/lib/ariadne/class_name_helper.rb +1 -1
- data/app/lib/ariadne/form_builder.rb +10 -10
- data/lib/ariadne/view_components/linters/argument_mappers/conversion_error.rb +10 -0
- data/lib/ariadne/view_components/linters/autocorrectable.rb +32 -0
- data/lib/ariadne/view_components/linters/base_linter.rb +202 -0
- data/lib/ariadne/view_components/linters/tag_tree_helpers.rb +76 -0
- data/lib/ariadne/view_components/version.rb +2 -1
- data/lib/tasks/build.rake +6 -0
- data/lib/tasks/coverage.rake +4 -1
- data/lib/tasks/docs.rake +5 -1
- data/lib/tasks/test.rake +19 -0
- data/static/classes.yml +3 -1
- metadata +8 -16
- data/app/assets/javascripts/ariadne-form-with.d.ts +0 -20
- data/app/assets/javascripts/ariadne-form.d.ts +0 -22
- data/app/assets/javascripts/ariadne.d.ts +0 -2
- data/app/assets/javascripts/ariadne_view_components.js +0 -8
- data/app/assets/javascripts/ariadne_view_components.js.map +0 -1
- data/app/assets/javascripts/clipboard-copy-component.d.ts +0 -4
- data/app/assets/javascripts/comment-component.d.ts +0 -12
- data/app/assets/javascripts/rich-text-area-component.d.ts +0 -6
- data/app/assets/javascripts/slideover-component.d.ts +0 -9
- data/app/assets/javascripts/tab-container-component.d.ts +0 -1
- data/app/assets/javascripts/tab-nav-component.d.ts +0 -9
- data/app/assets/javascripts/time-ago-component.d.ts +0 -1
- data/app/assets/javascripts/time_ago_component.d.ts +0 -1
- 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.
|
39
|
+
# <% c.with_button do %>
|
40
40
|
# Dropdown
|
41
41
|
# <% end %>
|
42
42
|
#
|
43
|
-
# <% c.
|
44
|
-
# <% menu.
|
45
|
-
# <% menu.
|
46
|
-
# <% menu.
|
47
|
-
# <% menu.
|
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.
|
57
|
+
# <% c.with_button do %>
|
58
58
|
# Dropdown
|
59
59
|
# <% end %>
|
60
60
|
#
|
61
|
-
# <% c.
|
62
|
-
# <% menu.
|
63
|
-
# <%= menu.
|
64
|
-
# <%= menu.
|
65
|
-
# <%= menu.
|
66
|
-
# <%= menu.
|
67
|
-
# <%= menu.
|
68
|
-
# <%= menu.
|
69
|
-
# <%= menu.
|
70
|
-
# <%= menu.
|
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.
|
76
|
+
# <% c.with_button do %>
|
77
77
|
# Dropdown
|
78
78
|
# <% end %>
|
79
79
|
#
|
80
|
-
# <% c.
|
80
|
+
# <% c.with_menu(direction: :s) do |menu| %>
|
81
81
|
# <% menu.header { "Header" } %>
|
82
|
-
# <%= menu.
|
83
|
-
# <%= menu.
|
84
|
-
# <%= menu.
|
85
|
-
# <%= menu.
|
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.
|
91
|
+
# <% c.with_button do %>
|
92
92
|
# Dropdown
|
93
93
|
# <% end %>
|
94
94
|
#
|
95
|
-
# <% c.
|
96
|
-
# <% menu.
|
97
|
-
# <%= menu.
|
98
|
-
# <%= menu.
|
99
|
-
# <%= menu.
|
100
|
-
# <%= menu.
|
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.
|
106
|
+
# <% c.with_button(scheme: :info, size: :sm) do %>
|
107
107
|
# Dropdown
|
108
108
|
# <% end %>
|
109
109
|
#
|
110
|
-
# <% c.
|
111
|
-
# <% menu.
|
112
|
-
# <%= menu.
|
113
|
-
# <%= menu.
|
114
|
-
# <%= menu.
|
115
|
-
# <%= menu.
|
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.
|
121
|
+
# <% c.with_button do %>
|
122
122
|
# Dropdown
|
123
123
|
# <% end %>
|
124
124
|
#
|
125
|
-
# <% c.
|
126
|
-
# <% menu.
|
127
|
-
# <% menu.
|
128
|
-
# <% menu.
|
129
|
-
# <% menu.
|
130
|
-
# <% menu.
|
131
|
-
# <% menu.
|
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.
|
137
|
+
# <% c.with_button do %>
|
138
138
|
# Dropdown
|
139
139
|
# <% end %>
|
140
140
|
#
|
141
|
-
# <% c.
|
142
|
-
# <% menu.
|
143
|
-
# <% menu.
|
144
|
-
# <% menu.
|
145
|
-
# <% menu.
|
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 =
|
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 =
|
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.
|
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.
|
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 =
|
107
|
+
@classes = merge_class_names(
|
108
108
|
DEFAULT_CLASSES,
|
109
109
|
CONTENT_SCHEME_CLASS_MAPPINGS[@scheme],
|
110
110
|
classes,
|
@@ -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 =
|
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
|
46
|
-
|
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 =
|
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 =
|
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 =
|
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 =
|
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 =
|
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 =
|
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 =
|
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 =
|
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 =
|
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 =
|
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 =
|
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 =
|
87
|
+
@classes = merge_class_names(
|
88
88
|
DEFAULT_CLASSES,
|
89
89
|
classes,
|
90
90
|
)
|
@@ -145,13 +145,13 @@ module Ariadne
|
|
145
145
|
}
|
146
146
|
|
147
147
|
@icon = heroicon(icon, variant: variant, **attributes)
|
148
|
-
@classes =
|
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 =
|
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 =
|
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 =
|
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.
|
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.
|
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.
|
60
|
-
# <% c.
|
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 =
|
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.
|
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:,
|
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 =
|
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.
|
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 =
|
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 =
|
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
|
-
|
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
|
@@ -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 =
|
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"] =
|
61
|
+
@link["classes"] = merge_class_names(DEFAULT_WRAPPER_CLASSES, @link["classes"])
|
62
62
|
end
|
63
|
-
@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 =
|
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
|
@@ -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 =
|
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 =
|
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 =
|
52
|
+
@classes = merge_class_names(
|
53
53
|
DEFAULT_CLASSES,
|
54
54
|
classes,
|
55
55
|
)
|
@@ -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')) {
|