ariadne_view_components 0.0.6 → 0.0.7
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/ariadne-form-with.d.ts +20 -0
- data/app/assets/javascripts/ariadne-form.d.ts +22 -0
- data/app/assets/javascripts/ariadne.d.ts +1 -1
- data/app/assets/javascripts/ariadne_view_components.js +7 -1
- data/app/assets/javascripts/ariadne_view_components.js.map +1 -1
- data/app/assets/javascripts/comment-component.d.ts +13 -0
- data/app/assets/javascripts/rich-text-area-component.d.ts +4 -0
- data/app/{components/ariadne/time_ago_component.d.ts → assets/javascripts/time-ago-component.d.ts} +0 -0
- data/app/assets/stylesheets/application.ariadne_view_components.css +1 -0
- data/app/assets/stylesheets/prosemirror.css +323 -0
- data/app/components/ariadne/ariadne-form.ts +96 -0
- data/app/components/ariadne/ariadne.ts +8 -1
- data/app/components/ariadne/base_button.rb +6 -7
- data/app/components/ariadne/base_component.rb +13 -131
- data/app/components/ariadne/blankslate_component.html.erb +5 -5
- data/app/components/ariadne/blankslate_component.rb +4 -9
- data/app/components/ariadne/body_component.rb +1 -1
- data/app/components/ariadne/button_component.rb +7 -6
- data/app/components/ariadne/clipboard_copy_component.html.erb +3 -2
- data/app/components/ariadne/comment-component.ts +55 -0
- data/app/components/ariadne/comment_component.html.erb +17 -20
- data/app/components/ariadne/comment_component.rb +29 -17
- data/app/components/ariadne/component.rb +4 -4
- data/app/components/ariadne/container_component.rb +1 -1
- data/app/components/ariadne/counter_component.rb +4 -4
- data/app/components/ariadne/flash_component.html.erb +12 -12
- data/app/components/ariadne/flash_component.rb +16 -16
- data/app/components/ariadne/flex_component.rb +5 -7
- data/app/components/ariadne/footer_component.html.erb +1 -1
- data/app/components/ariadne/footer_component.rb +1 -1
- data/app/components/ariadne/grid_component.html.erb +4 -4
- data/app/components/ariadne/grid_component.rb +9 -9
- data/app/components/ariadne/header_component.html.erb +7 -7
- data/app/components/ariadne/header_component.rb +8 -8
- data/app/components/ariadne/heading_component.rb +3 -3
- data/app/components/ariadne/heroicon_component.rb +4 -4
- data/app/components/ariadne/inline_flex_component.rb +7 -7
- data/app/components/ariadne/link_component.rb +2 -2
- data/app/components/ariadne/list_component.rb +6 -5
- data/app/components/ariadne/narrow_container_component.html.erb +3 -0
- data/app/components/ariadne/narrow_container_component.rb +30 -0
- data/app/components/ariadne/panel_bar_component.html.erb +20 -0
- data/app/components/ariadne/panel_bar_component.rb +79 -0
- data/app/components/ariadne/pill_component.rb +2 -2
- data/app/components/ariadne/rich-text-area-component.ts +32 -0
- data/app/components/ariadne/rich_text_area_component.html.erb +6 -0
- data/app/components/ariadne/rich_text_area_component.rb +35 -0
- data/app/components/ariadne/slideover-component.ts +3 -3
- data/app/components/ariadne/slideover_component.html.erb +3 -3
- data/app/components/ariadne/slideover_component.rb +1 -1
- data/app/components/ariadne/tab_bar_component.html.erb +3 -0
- data/app/components/ariadne/tab_bar_component.rb +45 -0
- data/app/components/ariadne/tab_component.html.erb +7 -0
- data/app/components/ariadne/tab_component.rb +43 -0
- data/app/components/ariadne/{time_ago_component.ts → time-ago-component.ts} +0 -0
- data/app/components/ariadne/time_ago_component.rb +2 -2
- data/app/components/ariadne/timeline_component.html.erb +6 -6
- data/app/components/ariadne/tooltip-component.ts +3 -3
- data/app/components/ariadne/tooltip_component.html.erb +1 -1
- data/app/components/ariadne/tooltip_component.rb +1 -1
- data/app/lib/ariadne/action_view_extensions/form_helper.rb +4 -1
- data/app/lib/ariadne/fetch_or_fallback_helper.rb +3 -1
- data/app/lib/ariadne/form_builder.rb +10 -10
- data/app/lib/ariadne/icon_helper.rb +1 -1
- data/lib/ariadne/view_components/engine.rb +169 -3
- data/lib/ariadne/view_components/version.rb +1 -1
- data/lib/ariadne/view_components.rb +0 -1
- data/lib/rubocop/config/default.yml +0 -6
- data/lib/rubocop/cop/ariadne/no_tag_memoize.rb +1 -0
- data/lib/tasks/docs.rake +6 -1
- data/static/arguments.yml +99 -4
- data/static/audited_at.json +8 -2
- data/static/classes.yml +195 -181
- data/static/constants.json +112 -72
- data/static/statuses.json +8 -2
- metadata +42 -32
- data/app/assets/builds/ariadne_view_components.css +0 -1874
- data/app/components/ariadne/ariadne.d.ts +0 -1
- data/app/components/ariadne/ariadne.js +0 -9
- data/app/components/ariadne/clipboard-copy-component.d.ts +0 -4
- data/app/components/ariadne/clipboard-copy-component.js +0 -18
- data/app/components/ariadne/clipboard_copy_component.d.ts +0 -4
- data/app/components/ariadne/clipboard_copy_component.js +0 -18
- data/app/components/ariadne/slideover-component.d.ts +0 -9
- data/app/components/ariadne/slideover-component.js +0 -20
- data/app/components/ariadne/slideover_component.d.ts +0 -9
- data/app/components/ariadne/slideover_component.js +0 -19
- data/app/components/ariadne/time_ago_component.js +0 -1
- data/app/components/ariadne/tooltip-component.d.ts +0 -24
- data/app/components/ariadne/tooltip-component.js +0 -42
- data/lib/ariadne/classify/utilities.rb +0 -199
- data/lib/ariadne/classify/utilities.yml +0 -1817
- data/lib/ariadne/classify/validation.rb +0 -18
- data/lib/ariadne/classify.rb +0 -124
- data/lib/rubocop/cop/ariadne/ariadne_heroicon.rb +0 -252
- data/lib/rubocop/cop/ariadne/component_name_migration.rb +0 -35
- data/lib/rubocop/cop/ariadne/system_argument_instead_of_class.rb +0 -57
- data/lib/tasks/utilities.rake +0 -121
@@ -5,64 +5,64 @@ module Ariadne
|
|
5
5
|
class FormBuilder < ActionView::Helpers::FormBuilder
|
6
6
|
include ClassNameHelper
|
7
7
|
|
8
|
-
DEFAULT_SECTION_CLASSES = "pt-8 space-y-6 sm:pt-10 sm:space-y-5"
|
8
|
+
DEFAULT_SECTION_CLASSES = "ariadne-pt-8 ariadne-space-y-6 sm:ariadne-pt-10 sm:ariadne-space-y-5"
|
9
9
|
def section(classes: "", attributes: {}, &block)
|
10
10
|
actual_classes = class_names(DEFAULT_SECTION_CLASSES, classes)
|
11
11
|
options = { class: actual_classes, **attributes }
|
12
12
|
@template.content_tag(:div, **options, &block)
|
13
13
|
end
|
14
14
|
|
15
|
-
DEFAULT_SECTION_HEADING_CLASSES = "text-lg leading-6 font-medium text-gray-900"
|
15
|
+
DEFAULT_SECTION_HEADING_CLASSES = "ariadne-text-lg ariadne-leading-6 ariadne-font-medium ariadne-text-gray-900"
|
16
16
|
def heading(tag: :h3, classes: "", attributes: {}, &block)
|
17
17
|
actual_classes = class_names(DEFAULT_SECTION_HEADING_CLASSES, classes)
|
18
18
|
options = { class: actual_classes, **attributes }
|
19
19
|
@template.content_tag(tag, **options, &block)
|
20
20
|
end
|
21
21
|
|
22
|
-
DEFAULT_SECTION_SUBHEADING_CLASSES = "mt-1 max-w-2xl text-sm text-gray-500"
|
22
|
+
DEFAULT_SECTION_SUBHEADING_CLASSES = "ariadne-mt-1 ariadne-max-w-2xl ariadne-text-sm ariadne-text-gray-500"
|
23
23
|
def subheading(classes: "", attributes: {}, &block)
|
24
24
|
actual_classes = class_names(DEFAULT_SECTION_SUBHEADING_CLASSES, classes)
|
25
25
|
options = { class: actual_classes, **attributes }
|
26
26
|
@template.content_tag(:p, **options, &block)
|
27
27
|
end
|
28
28
|
|
29
|
-
DEFAULT_LABEL_CLASSES = "block text-sm font-medium text-gray-700 pl-2"
|
29
|
+
DEFAULT_LABEL_CLASSES = "ariadne-block ariadne-text-sm ariadne-font-medium ariadne-text-gray-700 ariadne-pl-2"
|
30
30
|
def label(object_name, content, ptions = {}, &block)
|
31
31
|
options[:class] = class_names(DEFAULT_LABEL_CLASSES, options.delete(:classes))
|
32
32
|
super(object_name, content, options, &block)
|
33
33
|
end
|
34
34
|
|
35
|
-
DEFAULT_TEXT_CLASSES = "shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 rounded-md"
|
35
|
+
DEFAULT_TEXT_CLASSES = "ariadne-shadow-sm focus:ariadne-ring-indigo-500 focus:ariadne-border-indigo-500 ariadne-block ariadne-w-full sm:ariadne-text-sm ariadne-border-gray-300 ariadne-rounded-md"
|
36
36
|
def text_field(method, options = {})
|
37
37
|
options[:class] = class_names(DEFAULT_TEXT_CLASSES, options.delete(:classes))
|
38
38
|
super(method, **options)
|
39
39
|
end
|
40
40
|
|
41
|
-
DEFAULT_CHECKBOX_CLASSES = "focus:ring-indigo-500 h-4 w-4 text-indigo-600 border-gray-300 rounded"
|
41
|
+
DEFAULT_CHECKBOX_CLASSES = "focus:ariadne-ring-indigo-500 ariadne-h-4 ariadne-w-4 ariadne-text-indigo-600 ariadne-border-gray-300 ariadne-rounded"
|
42
42
|
def check_box(method, options = {}, checked_value = "1", unchecked_value = "0")
|
43
43
|
options[:class] = class_names(DEFAULT_CHECKBOX_CLASSES, options.delete(:classes))
|
44
44
|
super(method, options, checked_value, unchecked_value)
|
45
45
|
end
|
46
46
|
|
47
|
-
DEFAULT_RADIO_CLASSES = "focus:ring-indigo-500 h-4 w-4 text-indigo-600 border-gray-300 rounded"
|
47
|
+
DEFAULT_RADIO_CLASSES = "focus:ariadne-ring-indigo-500 ariadne-h-4 ariadne-w-4 ariadne-text-indigo-600 ariadne-border-gray-300 ariadne-rounded"
|
48
48
|
def radio_button(method, tag_value, options = {})
|
49
49
|
options[:class] = class_names(DEFAULT_RADIO_CLASSES, options.delete(:classes))
|
50
50
|
super(method, tag_value, **options)
|
51
51
|
end
|
52
52
|
|
53
|
-
DEFAULT_TEXTAREA_CLASSES = "shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border border-gray-300 rounded-md"
|
53
|
+
DEFAULT_TEXTAREA_CLASSES = "ariadne-shadow-sm focus:ariadne-ring-indigo-500 focus:ariadne-border-indigo-500 ariadne-block ariadne-w-full sm:ariadne-text-sm ariadne-border ariadne-border-gray-300 ariadne-rounded-md"
|
54
54
|
def text_area(method, options = {})
|
55
55
|
options[:class] = class_names(DEFAULT_TEXTAREA_CLASSES, options.delete(:classes))
|
56
56
|
super(method, **options)
|
57
57
|
end
|
58
58
|
|
59
|
-
DEFAULT_EMAIL_CLASSES = "shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 rounded-md"
|
59
|
+
DEFAULT_EMAIL_CLASSES = "ariadne-shadow-sm focus:ariadne-ring-indigo-500 focus:ariadne-border-indigo-500 ariadne-block ariadne-w-full sm:ariadne-text-sm ariadne-border-gray-300 ariadne-rounded-md"
|
60
60
|
def email_field(method, options = {})
|
61
61
|
options[:class] = class_names(DEFAULT_EMAIL_CLASSES, options.delete(:classes))
|
62
62
|
super(method, **options)
|
63
63
|
end
|
64
64
|
|
65
|
-
DEFAULT_PASSWORD_CLASSES = "appearance-none block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm"
|
65
|
+
DEFAULT_PASSWORD_CLASSES = "ariadne-appearance-none ariadne-block ariadne-w-full ariadne-px-3 ariadne-py-2 ariadne-border ariadne-border-gray-300 ariadne-rounded-md ariadne-shadow-sm ariadne-placeholder-gray-400 focus:ariadne-outline-none focus:ariadne-ring-indigo-500 focus:ariadne-border-indigo-500 sm:ariadne-text-sm"
|
66
66
|
def password_field(method, options = {})
|
67
67
|
options[:class] = class_names(DEFAULT_PASSWORD_CLASSES, options.delete(:classes))
|
68
68
|
super(method, **options)
|
@@ -3,10 +3,16 @@
|
|
3
3
|
require "rails/engine"
|
4
4
|
|
5
5
|
require "view_component"
|
6
|
-
|
6
|
+
|
7
|
+
require "tailwind_merge"
|
8
|
+
require "simple_form"
|
7
9
|
|
8
10
|
module Ariadne
|
11
|
+
# The Ariadne gem is a collection of ViewComponents that can be used to build
|
12
|
+
# accessible, responsive, and consistent UIs for Yetto.
|
9
13
|
module ViewComponents
|
14
|
+
mattr_accessor :tailwind_merger
|
15
|
+
|
10
16
|
# :nodoc:
|
11
17
|
class Engine < ::Rails::Engine
|
12
18
|
isolate_namespace Ariadne::ViewComponents
|
@@ -30,8 +36,168 @@ module Ariadne
|
|
30
36
|
end
|
31
37
|
end
|
32
38
|
|
33
|
-
|
34
|
-
|
39
|
+
initializer "ariadne_view_components.simple_form" do |_app|
|
40
|
+
# Use this setup block to configure all options available in SimpleForm.
|
41
|
+
SimpleForm.setup do |config|
|
42
|
+
# Default class for buttons
|
43
|
+
config.button_class = "my-2 bg-blue-500 hover:bg-blue-700 text-white font-bold text-sm py-2 px-4 rounded"
|
44
|
+
|
45
|
+
# Define the default class of the input wrapper of the boolean input.
|
46
|
+
config.boolean_label_class = ""
|
47
|
+
|
48
|
+
# How the label text should be generated altogether with the required text.
|
49
|
+
config.label_text = lambda { |label, required, _explicit_label| "#{label} #{required}" }
|
50
|
+
|
51
|
+
# Define the way to render check boxes / radio buttons with labels.
|
52
|
+
config.boolean_style = :inline
|
53
|
+
|
54
|
+
# You can wrap each item in a collection of radio/check boxes with a tag
|
55
|
+
config.item_wrapper_tag = :div
|
56
|
+
|
57
|
+
# Defines if the default input wrapper class should be included in radio
|
58
|
+
# collection wrappers.
|
59
|
+
config.include_default_input_wrapper_class = false
|
60
|
+
|
61
|
+
# CSS class to add for error notification helper.
|
62
|
+
config.error_notification_class = "text-white px-6 py-4 border-0 rounded relative mb-4 bg-red-400"
|
63
|
+
|
64
|
+
# Method used to tidy up errors. Specify any Rails Array method.
|
65
|
+
# :first lists the first message for each field.
|
66
|
+
# :to_sentence to list all errors for each field.
|
67
|
+
config.error_method = :to_sentence
|
68
|
+
|
69
|
+
# add validation classes to `input_field`
|
70
|
+
config.input_field_error_class = "border-red-500"
|
71
|
+
config.input_field_valid_class = "border-green-400"
|
72
|
+
config.label_class = "text-sm font-medium text-gray-600"
|
73
|
+
|
74
|
+
# vertical forms
|
75
|
+
#
|
76
|
+
# vertical default_wrapper
|
77
|
+
config.wrappers(:vertical_form, tag: "div", class: "mb-4") do |b|
|
78
|
+
b.use(:html5)
|
79
|
+
b.use(:placeholder)
|
80
|
+
b.optional(:maxlength)
|
81
|
+
b.optional(:minlength)
|
82
|
+
b.optional(:pattern)
|
83
|
+
b.optional(:min_max)
|
84
|
+
b.optional(:readonly)
|
85
|
+
b.use(:label, class: "block", error_class: "text-red-500")
|
86
|
+
b.use(:input, class: "shadow appearance-none border border-gray-300 rounded w-full py-2 px-3 bg-white focus:outline-none focus:ring-0 focus:border-blue-500 text-gray-400 leading-6 transition-colors duration-200 ease-in-out", error_class: "border-red-500", valid_class: "border-green-400")
|
87
|
+
b.use(:full_error, wrap_with: { tag: "p", class: "mt-2 text-red-500 text-xs italic" })
|
88
|
+
b.use(:hint, wrap_with: { tag: "p", class: "mt-2 text-grey-700 text-xs italic" })
|
89
|
+
end
|
90
|
+
|
91
|
+
# vertical input for boolean (aka checkboxes)
|
92
|
+
config.wrappers(:vertical_boolean, tag: "div", class: "mb-4 flex items-start", error_class: "") do |b|
|
93
|
+
b.use(:html5)
|
94
|
+
b.optional(:readonly)
|
95
|
+
b.wrapper(tag: "div", class: "flex items-center h-5") do |ba|
|
96
|
+
ba.use(:input, class: "focus:ring-2 focus:ring-indigo-500:focus ring-offset-2 h-4 w-4 text-indigo-600 border-gray-300 rounded")
|
97
|
+
end
|
98
|
+
b.wrapper(tag: "div", class: "ml-3 text-sm") do |bb|
|
99
|
+
bb.use(:label, class: "block", error_class: "text-red-500")
|
100
|
+
bb.use(:hint, wrap_with: { tag: "p", class: "block text-grey-700 text-xs italic" })
|
101
|
+
bb.use(:full_error, wrap_with: { tag: "p", class: "block text-red-500 text-xs italic" })
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
# vertical input for radio buttons and check boxes
|
106
|
+
config.wrappers(:vertical_collection, item_wrapper_class: "flex items-center", item_label_class: "my-1 ml-3 block text-sm font-medium text-gray-400", tag: "div", class: "my-4") do |b|
|
107
|
+
b.use(:html5)
|
108
|
+
b.optional(:readonly)
|
109
|
+
b.wrapper(:legend_tag, tag: "legend", class: "text-sm font-medium text-gray-600", error_class: "text-red-500") do |ba|
|
110
|
+
ba.use(:label_text)
|
111
|
+
end
|
112
|
+
b.use(:input, class: "focus:ring-2 focus:ring-indigo-500 ring-offset-2 h-4 w-4 text-indigo-600 border-gray-300 rounded", error_class: "text-red-500", valid_class: "text-green-400")
|
113
|
+
b.use(:full_error, wrap_with: { tag: "p", class: "block mt-2 text-red-500 text-xs italic" })
|
114
|
+
b.use(:hint, wrap_with: { tag: "p", class: "mt-2 text-grey-700 text-xs italic" })
|
115
|
+
end
|
116
|
+
|
117
|
+
# vertical file input
|
118
|
+
config.wrappers(:vertical_file, tag: "div", class: "") do |b|
|
119
|
+
b.use(:html5)
|
120
|
+
b.use(:placeholder)
|
121
|
+
b.optional(:maxlength)
|
122
|
+
b.optional(:minlength)
|
123
|
+
b.optional(:readonly)
|
124
|
+
b.use(:label, class: "text-sm font-medium text-gray-600 block", error_class: "text-red-500")
|
125
|
+
b.use(:input, class: "w-full text-gray-500 px-3 py-2 border rounded", error_class: "text-red-500 border-red-500", valid_class: "text-green-400")
|
126
|
+
b.use(:full_error, wrap_with: { tag: "p", class: "mt-2 text-red-500 text-xs italic" })
|
127
|
+
b.use(:hint, wrap_with: { tag: "p", class: "mt-2 text-grey-700 text-xs italic" })
|
128
|
+
end
|
129
|
+
|
130
|
+
# vertical multi select
|
131
|
+
config.wrappers(:vertical_multi_select, tag: "div", class: "my-4", error_class: "f", valid_class: "") do |b|
|
132
|
+
b.use(:html5)
|
133
|
+
b.optional(:readonly)
|
134
|
+
b.wrapper(:legend_tag, tag: "legend", class: "text-sm font-medium text-gray-600", error_class: "text-red-500") do |ba|
|
135
|
+
ba.use(:label_text)
|
136
|
+
end
|
137
|
+
b.wrapper(tag: "div", class: "inline-flex space-x-1") do |ba|
|
138
|
+
# ba.use :input, class: 'flex w-auto w-auto text-gray-500 text-sm border-gray-300 rounded p-2', error_class: 'text-red-500', valid_class: 'text-green-400'
|
139
|
+
ba.use(:input, class: "flex w-auto w-auto shadow appearance-none border border-gray-300 rounded w-full p-2 bg-white focus:outline-none focus:border-blue-500 text-gray-400 leading-4 transition-colors duration-200 ease-in-out")
|
140
|
+
end
|
141
|
+
b.use(:full_error, wrap_with: { tag: "p", class: "mt-2 text-red-500 text-xs italic" })
|
142
|
+
b.use(:hint, wrap_with: { tag: "p", class: "mt-2 text-grey-700 text-xs italic" })
|
143
|
+
end
|
144
|
+
|
145
|
+
# vertical range input
|
146
|
+
config.wrappers(:vertical_range, tag: "div", class: "my-4", error_class: "text-red-500", valid_class: "text-green-400") do |b|
|
147
|
+
b.use(:html5)
|
148
|
+
b.use(:placeholder)
|
149
|
+
b.optional(:readonly)
|
150
|
+
b.optional(:step)
|
151
|
+
b.use(:label, class: "text-sm font-medium text-gray-600 block", error_class: "text-red-500")
|
152
|
+
b.wrapper(tag: "div", class: "flex items-center h-5") do |ba|
|
153
|
+
ba.use(:input, class: "rounded-lg overflow-hidden appearance-none bg-gray-400 h-3 w-full text-gray-300", error_class: "text-red-500", valid_class: "text-green-400")
|
154
|
+
end
|
155
|
+
b.use(:full_error, wrap_with: { tag: "p", class: "mt-2 text-red-500 text-xs italic" })
|
156
|
+
b.use(:hint, wrap_with: { tag: "p", class: "mt-2 text-grey-700 text-xs italic" })
|
157
|
+
end
|
158
|
+
|
159
|
+
# The default wrapper to be used by the FormBuilder.
|
160
|
+
config.default_wrapper = :vertical_form
|
161
|
+
|
162
|
+
# Custom wrappers for input types. This should be a hash containing an input
|
163
|
+
# type as key and the wrapper that will be used for all inputs with specified type.
|
164
|
+
config.wrapper_mappings = {
|
165
|
+
boolean: :vertical_boolean,
|
166
|
+
check_boxes: :vertical_collection,
|
167
|
+
date: :vertical_multi_select,
|
168
|
+
datetime: :vertical_multi_select,
|
169
|
+
file: :vertical_file,
|
170
|
+
radio_buttons: :vertical_collection,
|
171
|
+
range: :vertical_range,
|
172
|
+
time: :vertical_multi_select,
|
173
|
+
}
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
config.after_initialize do |_app|
|
178
|
+
# TODO: is any of this necessary???
|
179
|
+
ActionView::Base.field_error_proc = proc do |html_tag, instance_tag|
|
180
|
+
fragment = Nokogiri::HTML.fragment(html_tag)
|
181
|
+
field = fragment.at("input,select,textarea")
|
182
|
+
|
183
|
+
model = instance_tag.object
|
184
|
+
error_message = model.errors.full_messages.join(", ")
|
185
|
+
|
186
|
+
html = if field
|
187
|
+
field["class"] = "#{field["class"]} invalid"
|
188
|
+
html = <<-HTML
|
189
|
+
#{fragment}
|
190
|
+
<p class="error">#{error_message}</p>
|
191
|
+
HTML
|
192
|
+
html
|
193
|
+
else
|
194
|
+
html_tag
|
195
|
+
end
|
196
|
+
|
197
|
+
html.html_safe # rubocop:disable Rails/OutputSafety
|
198
|
+
end
|
199
|
+
|
200
|
+
Ariadne::ViewComponents.tailwind_merger = TailwindMerge::Merger.new
|
35
201
|
end
|
36
202
|
end
|
37
203
|
end
|
data/lib/tasks/docs.rake
CHANGED
@@ -47,7 +47,7 @@ namespace :docs do
|
|
47
47
|
# Rails controller for rendering arbitrary ERB
|
48
48
|
view_context = ApplicationController.new.tap { |c| c.request = ActionDispatch::TestRequest.create }.view_context
|
49
49
|
components = [
|
50
|
-
Ariadne::
|
50
|
+
Ariadne::RichTextAreaComponent,
|
51
51
|
Ariadne::CommentComponent,
|
52
52
|
Ariadne::BodyComponent,
|
53
53
|
Ariadne::BlankslateComponent,
|
@@ -58,6 +58,7 @@ namespace :docs do
|
|
58
58
|
Ariadne::CounterComponent,
|
59
59
|
Ariadne::GridComponent,
|
60
60
|
Ariadne::FlashComponent,
|
61
|
+
Ariadne::FlexComponent,
|
61
62
|
Ariadne::FooterComponent,
|
62
63
|
Ariadne::HeaderComponent,
|
63
64
|
Ariadne::HeadingComponent,
|
@@ -67,8 +68,12 @@ namespace :docs do
|
|
67
68
|
Ariadne::LinkComponent,
|
68
69
|
Ariadne::ListComponent,
|
69
70
|
Ariadne::MainComponent,
|
71
|
+
Ariadne::NarrowContainerComponent,
|
72
|
+
Ariadne::PanelBarComponent,
|
70
73
|
Ariadne::PillComponent,
|
71
74
|
Ariadne::SlideoverComponent,
|
75
|
+
Ariadne::TabComponent,
|
76
|
+
Ariadne::TabBarComponent,
|
72
77
|
Ariadne::Text,
|
73
78
|
Ariadne::TimeAgoComponent,
|
74
79
|
Ariadne::TimelineComponent,
|
data/static/arguments.yml
CHANGED
@@ -62,7 +62,7 @@
|
|
62
62
|
- name: scheme
|
63
63
|
type: Symbol
|
64
64
|
default: "`:default`"
|
65
|
-
description: One of `:danger`, `:default`, `:info`, `:success`, or `:warning`.
|
65
|
+
description: One of `:danger`, `:default`, `:info`, `:none`, `:success`, or `:warning`.
|
66
66
|
- name: size
|
67
67
|
type: Symbol
|
68
68
|
default: "`BaseButton::DEFAULT_SIZE`"
|
@@ -110,10 +110,18 @@
|
|
110
110
|
- component: Comment
|
111
111
|
source: https://github.com/yettoapp/ariadne/ruby/view_components/tree/main/app/components/ariadne/comment_component.rb
|
112
112
|
parameters:
|
113
|
-
- name:
|
113
|
+
- name: url
|
114
|
+
type: String
|
115
|
+
default: N/A
|
116
|
+
description: The URL to take action against.
|
117
|
+
- name: method
|
118
|
+
type: String
|
119
|
+
default: N/A
|
120
|
+
description: The method to use when submitting the form.
|
121
|
+
- name: sr_label
|
114
122
|
type: String
|
115
123
|
default: N/A
|
116
|
-
description:
|
124
|
+
description: A label to introduce these tabs for screen readers.
|
117
125
|
- name: classes
|
118
126
|
type: String
|
119
127
|
default: '`""`'
|
@@ -282,7 +290,7 @@
|
|
282
290
|
- name: variant
|
283
291
|
type: String
|
284
292
|
default: N/A
|
285
|
-
description: One of `outline`
|
293
|
+
description: One of `outline`, `solid`, or `mini`.
|
286
294
|
- name: size
|
287
295
|
type: Symbol
|
288
296
|
default: "`:sm`"
|
@@ -386,6 +394,32 @@
|
|
386
394
|
type: Hash
|
387
395
|
default: "`{}`"
|
388
396
|
description: "[Classes and attributes](/classes-attributes)"
|
397
|
+
- component: NarrowContainer
|
398
|
+
source: https://github.com/yettoapp/ariadne/ruby/view_components/tree/main/app/components/ariadne/narrow_container_component.rb
|
399
|
+
parameters:
|
400
|
+
- name: classes
|
401
|
+
type: String
|
402
|
+
default: '`""`'
|
403
|
+
description: "[Classes and attributes](/classes-attributes)"
|
404
|
+
- name: attributes
|
405
|
+
type: Hash
|
406
|
+
default: "`{}`"
|
407
|
+
description: "[Classes and attributes](/classes-attributes)"
|
408
|
+
- component: PanelBar
|
409
|
+
source: https://github.com/yettoapp/ariadne/ruby/view_components/tree/main/app/components/ariadne/panel_bar_component.rb
|
410
|
+
parameters:
|
411
|
+
- name: tag
|
412
|
+
type: Symbol, String
|
413
|
+
default: N/A
|
414
|
+
description: The rendered tag name.
|
415
|
+
- name: classes
|
416
|
+
type: String
|
417
|
+
default: '`""`'
|
418
|
+
description: "[Classes and attributes](/classes-attributes)"
|
419
|
+
- name: attributes
|
420
|
+
type: Hash
|
421
|
+
default: "`{}`"
|
422
|
+
description: "[Classes and attributes](/classes-attributes)"
|
389
423
|
- component: Pill
|
390
424
|
source: https://github.com/yettoapp/ariadne/ruby/view_components/tree/main/app/components/ariadne/pill_component.rb
|
391
425
|
parameters:
|
@@ -405,6 +439,29 @@
|
|
405
439
|
type: Hash
|
406
440
|
default: "`{}`"
|
407
441
|
description: "[Classes and attributes](/classes-attributes)"
|
442
|
+
- component: RichTextArea
|
443
|
+
source: https://github.com/yettoapp/ariadne/ruby/view_components/tree/main/app/components/ariadne/rich_text_area_component.rb
|
444
|
+
parameters:
|
445
|
+
- name: name
|
446
|
+
type: Symbol
|
447
|
+
default: N/A
|
448
|
+
description: Identifies the form/param name for this rich text area.
|
449
|
+
- name: sr_label
|
450
|
+
type: String
|
451
|
+
default: N/A
|
452
|
+
description: A label to introduce these tabs for screen readers.
|
453
|
+
- name: has_form
|
454
|
+
type: Boolean
|
455
|
+
default: "`true`"
|
456
|
+
description: Indicates whether this component is wrapped in a form.
|
457
|
+
- name: classes
|
458
|
+
type: String
|
459
|
+
default: '`""`'
|
460
|
+
description: "[Classes and attributes](/classes-attributes)"
|
461
|
+
- name: attributes
|
462
|
+
type: Hash
|
463
|
+
default: "`{}`"
|
464
|
+
description: "[Classes and attributes](/classes-attributes)"
|
408
465
|
- component: Slideover
|
409
466
|
source: https://github.com/yettoapp/ariadne/ruby/view_components/tree/main/app/components/ariadne/slideover_component.rb
|
410
467
|
parameters:
|
@@ -436,6 +493,44 @@
|
|
436
493
|
type: Hash
|
437
494
|
default: "`{}`"
|
438
495
|
description: "[Classes and attributes](/classes-attributes)"
|
496
|
+
- component: TabBar
|
497
|
+
source: https://github.com/yettoapp/ariadne/ruby/view_components/tree/main/app/components/ariadne/tab_bar_component.rb
|
498
|
+
parameters:
|
499
|
+
- name: tag
|
500
|
+
type: Symbol, String
|
501
|
+
default: "`:nav`"
|
502
|
+
description: The rendered tag name.
|
503
|
+
- name: sr_label
|
504
|
+
type: String
|
505
|
+
default: N/A
|
506
|
+
description: A label to introduce these tabs for screen readers.
|
507
|
+
- name: classes
|
508
|
+
type: String
|
509
|
+
default: '`""`'
|
510
|
+
description: "[Classes and attributes](/classes-attributes)"
|
511
|
+
- name: attributes
|
512
|
+
type: Hash
|
513
|
+
default: "`{}`"
|
514
|
+
description: "[Classes and attributes](/classes-attributes)"
|
515
|
+
- component: Tab
|
516
|
+
source: https://github.com/yettoapp/ariadne/ruby/view_components/tree/main/app/components/ariadne/tab_component.rb
|
517
|
+
parameters:
|
518
|
+
- name: tag
|
519
|
+
type: Symbol, String
|
520
|
+
default: "`:button`"
|
521
|
+
description: The rendered tag name.
|
522
|
+
- name: selected
|
523
|
+
type: Boolean
|
524
|
+
default: "`false`"
|
525
|
+
description: Whether the tab is selected or not.
|
526
|
+
- name: classes
|
527
|
+
type: String
|
528
|
+
default: '`""`'
|
529
|
+
description: "[Classes and attributes](/classes-attributes)"
|
530
|
+
- name: attributes
|
531
|
+
type: Hash
|
532
|
+
default: "`{}`"
|
533
|
+
description: "[Classes and attributes](/classes-attributes)"
|
439
534
|
- component: Text
|
440
535
|
source: https://github.com/yettoapp/ariadne/ruby/view_components/tree/main/app/components/ariadne/text.rb
|
441
536
|
parameters:
|
data/static/audited_at.json
CHANGED
@@ -13,7 +13,7 @@
|
|
13
13
|
"Ariadne::FlexComponent": "",
|
14
14
|
"Ariadne::FooterComponent": "",
|
15
15
|
"Ariadne::GridComponent": "",
|
16
|
-
"Ariadne::GridComponent::
|
16
|
+
"Ariadne::GridComponent::GridItem": "",
|
17
17
|
"Ariadne::HeaderComponent": "",
|
18
18
|
"Ariadne::HeadingComponent": "",
|
19
19
|
"Ariadne::HeroiconComponent": "",
|
@@ -21,10 +21,16 @@
|
|
21
21
|
"Ariadne::InlineFlexComponent": "",
|
22
22
|
"Ariadne::LinkComponent": "",
|
23
23
|
"Ariadne::ListComponent": "",
|
24
|
-
"Ariadne::ListComponent::
|
24
|
+
"Ariadne::ListComponent::ListItem": "",
|
25
25
|
"Ariadne::MainComponent": "",
|
26
|
+
"Ariadne::NarrowContainerComponent": "",
|
27
|
+
"Ariadne::PanelBarComponent": "",
|
28
|
+
"Ariadne::PanelBarComponent::PanelItem": "",
|
26
29
|
"Ariadne::PillComponent": "",
|
30
|
+
"Ariadne::RichTextAreaComponent": "",
|
27
31
|
"Ariadne::SlideoverComponent": "",
|
32
|
+
"Ariadne::TabBarComponent": "",
|
33
|
+
"Ariadne::TabComponent": "",
|
28
34
|
"Ariadne::Text": "",
|
29
35
|
"Ariadne::TimeAgoComponent": "",
|
30
36
|
"Ariadne::TimelineComponent": "",
|