ariadne_view_components 0.0.13-x64-mingw32 → 0.0.14-x64-mingw32
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_view_components.js +2 -2
- data/app/assets/javascripts/ariadne_view_components.js.map +1 -1
- data/app/assets/javascripts/comment-component.d.ts +1 -2
- data/app/assets/stylesheets/ariadne_view_components.css +1 -0
- data/app/assets/stylesheets/dropdown.css +46 -0
- data/app/assets/stylesheets/tooltip-component.css +8 -8
- data/app/components/ariadne/ariadne.ts +0 -2
- data/app/components/ariadne/avatar_component.rb +81 -0
- data/app/components/ariadne/avatar_stack_component.html.erb +12 -0
- data/app/components/ariadne/avatar_stack_component.rb +75 -0
- data/app/components/ariadne/base_button.rb +13 -4
- data/app/components/ariadne/blankslate_component.rb +4 -4
- data/app/components/ariadne/button_component.html.erb +1 -1
- data/app/components/ariadne/button_component.rb +9 -3
- data/app/components/ariadne/comment-component.ts +32 -50
- data/app/components/ariadne/comment_component.html.erb +32 -10
- data/app/components/ariadne/comment_component.rb +17 -5
- data/app/components/ariadne/details_component.html.erb +4 -0
- data/app/components/ariadne/details_component.rb +80 -0
- data/app/components/ariadne/dropdown/menu_component.html.erb +20 -0
- data/app/components/ariadne/dropdown/menu_component.rb +101 -0
- data/app/components/ariadne/dropdown/menu_component.ts +1 -0
- data/app/components/ariadne/dropdown_component.html.erb +8 -0
- data/app/components/ariadne/dropdown_component.rb +172 -0
- data/app/components/ariadne/flex_component.rb +1 -1
- data/app/components/ariadne/footer_component.html.erb +1 -1
- data/app/components/ariadne/header_component.rb +2 -2
- data/app/components/ariadne/heroicon_component.rb +6 -4
- data/app/components/ariadne/inline_flex_component.html.erb +1 -0
- data/app/components/ariadne/inline_flex_component.rb +8 -1
- data/app/components/ariadne/link_component.rb +2 -2
- data/app/components/ariadne/list_component.html.erb +2 -9
- data/app/components/ariadne/list_component.rb +11 -15
- data/app/components/ariadne/main_component.rb +1 -1
- data/app/components/ariadne/pill_component.rb +19 -5
- data/app/components/ariadne/rich-text-area-component.ts +4 -4
- data/app/components/ariadne/rich_text_area_component.html.erb +1 -1
- data/app/components/ariadne/rich_text_area_component.rb +1 -1
- data/app/components/ariadne/slideover_component.html.erb +1 -1
- data/app/components/ariadne/tab-container-component.ts +21 -21
- data/app/components/ariadne/tab_component.rb +4 -7
- data/app/components/ariadne/tab_container_component.rb +8 -2
- data/app/components/ariadne/tab_nav_component.html.erb +1 -1
- data/app/components/ariadne/tab_nav_component.rb +1 -1
- data/app/components/ariadne/table_nav_component.html.erb +52 -0
- data/app/components/ariadne/table_nav_component.rb +338 -0
- data/app/components/ariadne/tooltip_component.html.erb +1 -1
- data/app/components/ariadne/tooltip_component.rb +4 -4
- data/app/lib/ariadne/action_view_extensions/form_helper.rb +21 -7
- data/app/lib/ariadne/form_builder.rb +2 -2
- data/lib/ariadne/view_components/version.rb +1 -1
- data/lib/tasks/docs.rake +19 -3
- data/static/arguments.yml +103 -11
- data/static/audited_at.json +15 -7
- data/static/classes.yml +49 -45
- data/static/constants.json +179 -51
- data/static/statuses.json +15 -7
- data/tailwind.config.js +25 -1
- metadata +15 -4
- data/app/components/ariadne/table_component.html.erb +0 -17
- data/app/components/ariadne/table_component.rb +0 -281
@@ -1,281 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Ariadne
|
4
|
-
# Add a general description of component here
|
5
|
-
# Add additional usage considerations or best practices that may aid the user to use the component correctly.
|
6
|
-
# @accessibility Add any accessibility considerations
|
7
|
-
class TableComponent < Ariadne::Component
|
8
|
-
DEFAULT_CLASSES = "ariadne-min-w-full ariadne-divide-y ariadne-divide-gray-300 flex flex-col"
|
9
|
-
|
10
|
-
renders_one :header_row, "HeaderRowItem"
|
11
|
-
|
12
|
-
renders_many :rows, "RowItem"
|
13
|
-
|
14
|
-
renders_one :footer, "FooterItem"
|
15
|
-
|
16
|
-
# @example Default
|
17
|
-
#
|
18
|
-
# <%= render(Ariadne::TableComponent.new) do |table| %>
|
19
|
-
# <%= table.header_row do |header_row| %>
|
20
|
-
# <% header_row.cell do %>
|
21
|
-
# State
|
22
|
-
# <% end %>
|
23
|
-
# <% end %>
|
24
|
-
# <%= table.row do |row| %>
|
25
|
-
# <% row.cell do %>
|
26
|
-
# "California"
|
27
|
-
# <% end %>
|
28
|
-
# <% end %>
|
29
|
-
# <%= table.row do |row| %>
|
30
|
-
# <% row.cell do %>
|
31
|
-
# "New York"
|
32
|
-
# <% end %>
|
33
|
-
# <% end %>
|
34
|
-
# <%= table.row do |row| %>
|
35
|
-
# <% row.cell do %>
|
36
|
-
# "Texas"
|
37
|
-
# <% end %>
|
38
|
-
# <% end %>
|
39
|
-
# <% end %>
|
40
|
-
# @param classes [String] <%= link_to_classes_docs %>
|
41
|
-
# @param attributes [Hash] <%= link_to_attributes_docs %>
|
42
|
-
def initialize(classes: "", attributes: {})
|
43
|
-
@tag = :div
|
44
|
-
@classes = class_names(
|
45
|
-
DEFAULT_CLASSES,
|
46
|
-
classes,
|
47
|
-
)
|
48
|
-
|
49
|
-
@attributes = attributes
|
50
|
-
end
|
51
|
-
|
52
|
-
def has_header_row?
|
53
|
-
header_row.present?
|
54
|
-
end
|
55
|
-
|
56
|
-
def has_footer?
|
57
|
-
footer.present?
|
58
|
-
end
|
59
|
-
|
60
|
-
# This component is part of `TableComponent` and should not be
|
61
|
-
# used as a standalone component.
|
62
|
-
class RowItem < Ariadne::Component
|
63
|
-
DEFAULT_ROW_CLASSES = "ariadne-whitespace-nowrap ariadne-py-4 ariadne-pl-4 ariadne-pr-3 ariadne-text-sm sm:ariadne-pl-6 flex flex-row"
|
64
|
-
|
65
|
-
renders_many :cells, lambda { |classes: "", attributes: {}|
|
66
|
-
if @header
|
67
|
-
Ariadne::TableComponent::RowItem::HeaderCellItem.new(classes: classes, attributes: attributes)
|
68
|
-
else
|
69
|
-
Ariadne::TableComponent::RowItem::CellItem.new(classes: classes, attributes: attributes)
|
70
|
-
end
|
71
|
-
}
|
72
|
-
|
73
|
-
# @param link [Hash] #TODO: link attributes
|
74
|
-
def initialize(link: "", classes: "", attributes: {})
|
75
|
-
@header = false
|
76
|
-
@link = link
|
77
|
-
|
78
|
-
@classes = if @link.present?
|
79
|
-
class_names(
|
80
|
-
DEFAULT_ROW_CLASSES,
|
81
|
-
"ariadne-cursor-pointer",
|
82
|
-
classes,
|
83
|
-
)
|
84
|
-
else
|
85
|
-
class_names(
|
86
|
-
DEFAULT_ROW_CLASSES,
|
87
|
-
classes,
|
88
|
-
)
|
89
|
-
end
|
90
|
-
|
91
|
-
@attributes = attributes
|
92
|
-
end
|
93
|
-
|
94
|
-
def call
|
95
|
-
render(Ariadne::BaseComponent.new(tag: :li, classes: @classes, attributes: @attributes)) do
|
96
|
-
if linked?
|
97
|
-
render(Ariadne::LinkComponent.new(href: @link[:href], classes: @link[:classes], attributes: @link[:attributes])) do
|
98
|
-
cells.each do |cell|
|
99
|
-
concat(cell)
|
100
|
-
end
|
101
|
-
end
|
102
|
-
else
|
103
|
-
cells.each do |cell|
|
104
|
-
concat(cell)
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
private def linked?
|
111
|
-
@link.present?
|
112
|
-
end
|
113
|
-
|
114
|
-
# This component is part of `TableComponent` and should not be
|
115
|
-
# used as a standalone component.
|
116
|
-
class HeaderCellItem < Ariadne::TableComponent::RowItem
|
117
|
-
DEFAULT_HEADER_CELL_CLASSES = "ariadne-py-3.5 ariadne-pl-4 pr-3 ariadne-text-left ariadne-text-sm ariadne-font-semibold ariadne-text-gray-900 ariadne-sm:pl-6"
|
118
|
-
|
119
|
-
def initialize(classes: "", attributes: {})
|
120
|
-
@classes = class_names(
|
121
|
-
DEFAULT_HEADER_CELL_CLASSES,
|
122
|
-
classes,
|
123
|
-
)
|
124
|
-
|
125
|
-
@attributes = attributes
|
126
|
-
end
|
127
|
-
|
128
|
-
def call
|
129
|
-
render(Ariadne::BaseComponent.new(tag: :span, classes: @classes, attributes: @attributes)) { content }
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
# This component is part of `TableComponent` and should not be
|
134
|
-
# used as a standalone component.
|
135
|
-
class CellItem < Ariadne::TableComponent::RowItem
|
136
|
-
DEFAULT_CELL_CLASSES = ""
|
137
|
-
|
138
|
-
def initialize(classes: "", attributes: {})
|
139
|
-
@classes = class_names(
|
140
|
-
DEFAULT_CELL_CLASSES,
|
141
|
-
classes,
|
142
|
-
)
|
143
|
-
|
144
|
-
@attributes = attributes
|
145
|
-
end
|
146
|
-
|
147
|
-
def call
|
148
|
-
render(Ariadne::BaseComponent.new(tag: :span, classes: @classes, attributes: @attributes)) { content }
|
149
|
-
end
|
150
|
-
end
|
151
|
-
end
|
152
|
-
|
153
|
-
# This component is part of `TableComponent` and should not be
|
154
|
-
# used as a standalone component.
|
155
|
-
class HeaderRowItem < Ariadne::TableComponent::RowItem
|
156
|
-
DEFAULT_HEADER_CLASSES = "ariadne-bg-gray-50 flex flex-row"
|
157
|
-
|
158
|
-
def initialize(classes: "", attributes: {})
|
159
|
-
@header = true
|
160
|
-
|
161
|
-
@classes = class_names(
|
162
|
-
DEFAULT_HEADER_CLASSES,
|
163
|
-
classes,
|
164
|
-
)
|
165
|
-
|
166
|
-
@attributes = attributes
|
167
|
-
end
|
168
|
-
|
169
|
-
def call
|
170
|
-
render(Ariadne::BaseComponent.new(tag: :div, classes: @classes, attributes: @attributes)) do
|
171
|
-
cells.each do |cell|
|
172
|
-
concat(cell)
|
173
|
-
end
|
174
|
-
end
|
175
|
-
end
|
176
|
-
end
|
177
|
-
|
178
|
-
# This component is part of `TableComponent` and should not be
|
179
|
-
# used as a standalone component.
|
180
|
-
class FooterItem < Ariadne::Component
|
181
|
-
DEFAULT_CLASSES = "ariadne-border-none ariadne-flex ariadne-items-center ariadne-justify-between ariadne-px-4 ariadne-py-3 sm:ariadne-px-6"
|
182
|
-
|
183
|
-
DEFAULT_RESULT_CLASSES = "ariadne-text-sm ariadne-text-gray-700"
|
184
|
-
renders_one :records_info, lambda { |classes: "", attributes: {}|
|
185
|
-
actual_classes = class_names(DEFAULT_RESULT_CLASSES, classes)
|
186
|
-
Ariadne::BaseComponent.new(tag: :p, classes: actual_classes, attributes: attributes)
|
187
|
-
}
|
188
|
-
|
189
|
-
renders_one :pagination_bar, "Ariadne::TableComponent::PaginationBarItem"
|
190
|
-
|
191
|
-
def initialize(classes: "", attributes: {})
|
192
|
-
@classes = class_names(
|
193
|
-
DEFAULT_CLASSES,
|
194
|
-
classes,
|
195
|
-
)
|
196
|
-
|
197
|
-
@attributes = attributes
|
198
|
-
end
|
199
|
-
|
200
|
-
def call
|
201
|
-
render(Ariadne::BaseComponent.new(tag: :div, classes: @classes, attributes: @attributes)) do
|
202
|
-
records_info.to_s + pagination_bar.to_s
|
203
|
-
end
|
204
|
-
end
|
205
|
-
end
|
206
|
-
|
207
|
-
# This component is part of `TableComponent` and should not be
|
208
|
-
# used as a standalone component.
|
209
|
-
class PaginationBarItem < Ariadne::Component
|
210
|
-
DEFAULT_PREV_PAGE_CLASSES = "ariadne-relative ariadne-inline-flex ariadne-items-center ariadne-rounded-l-md ariadne-border ariadne-border-gray-300 ariadne-bg-white ariadne-px-2 ariadne-py-2 ariadne-text-sm ariadne-font-medium ariadne-text-gray-500 focus:ariadne-z-20"
|
211
|
-
renders_one :prev_page, lambda { |disabled: false, href:, classes: "", attributes: {}|
|
212
|
-
if disabled
|
213
|
-
actual_classes = class_names(DEFAULT_PREV_PAGE_CLASSES, classes)
|
214
|
-
|
215
|
-
render(Ariadne::BaseComponent.new(tag: :span, classes: actual_classes, attributes: attributes)) do
|
216
|
-
render(Ariadne::HeroiconComponent.new(icon: "chevron-left", size: :sm, variant: :mini, text_attributes: { "aria-hidden": true }, text_classes: "ariadne-sr-only"))
|
217
|
-
end
|
218
|
-
else
|
219
|
-
actual_classes = class_names(DEFAULT_PREV_PAGE_CLASSES, "hover:ariadne-bg-gray-50", classes)
|
220
|
-
attributes[:"aria-label"] = "previous"
|
221
|
-
|
222
|
-
render(Ariadne::LinkComponent.new(href: href, classes: actual_classes, attributes: attributes)) do
|
223
|
-
render(Ariadne::HeroiconComponent.new(icon: "chevron-left", size: :sm, variant: :mini, text_attributes: { "aria-hidden": true }, text_classes: "ariadne-sr-only"))
|
224
|
-
end
|
225
|
-
end
|
226
|
-
}
|
227
|
-
|
228
|
-
renders_one :page_list, lambda { |disabled: false, href:, classes: "", attributes: {}|
|
229
|
-
if disabled
|
230
|
-
actual_classes = class_names(DEFAULT_NEXT_PAGE_CLASSES, classes)
|
231
|
-
|
232
|
-
render(Ariadne::BaseComponent.new(tag: :span, classes: actual_classes, attributes: attributes)) do
|
233
|
-
render(Ariadne::HeroiconComponent.new(icon: "chevron-left", size: :sm, variant: :mini, text_attributes: { "aria-hidden": true }, text_classes: "ariadne-sr-only"))
|
234
|
-
end
|
235
|
-
else
|
236
|
-
actual_classes = class_names(DEFAULT_NEXT_PAGE_CLASSES, "hover:ariadne-bg-gray-50", classes)
|
237
|
-
attributes[:"aria-label"] = "next"
|
238
|
-
|
239
|
-
render(Ariadne::LinkComponent.new(href: href, classes: actual_classes, attributes: attributes)) do
|
240
|
-
render(Ariadne::HeroiconComponent.new(icon: "chevron-right", size: :sm, variant: :mini, text_attributes: { "aria-hidden": true }, text_classes: "ariadne-sr-only"))
|
241
|
-
end
|
242
|
-
end
|
243
|
-
}
|
244
|
-
|
245
|
-
DEFAULT_NEXT_PAGE_CLASSES = " ariadne-relative ariadne-inline-flex ariadne-items-center ariadne-rounded-r-md ariadne-border ariadne-border-gray-300 ariadne-bg-white ariadne-px-2 ariadne-py-2 ariadne-text-sm ariadne-font-medium ariadne-text-gray-500 focus:ariadne-z-20"
|
246
|
-
renders_one :next_page, lambda { |disabled: false, href:, classes: "", attributes: {}|
|
247
|
-
if disabled
|
248
|
-
actual_classes = class_names(DEFAULT_NEXT_PAGE_CLASSES, classes)
|
249
|
-
|
250
|
-
render(Ariadne::BaseComponent.new(tag: :span, classes: actual_classes, attributes: attributes)) do
|
251
|
-
render(Ariadne::HeroiconComponent.new(icon: "chevron-left", size: :sm, variant: :mini, text_attributes: { "aria-hidden": true }, text_classes: "ariadne-sr-only"))
|
252
|
-
end
|
253
|
-
else
|
254
|
-
actual_classes = class_names(DEFAULT_NEXT_PAGE_CLASSES, "hover:ariadne-bg-gray-50", classes)
|
255
|
-
attributes[:"aria-label"] = "next"
|
256
|
-
|
257
|
-
render(Ariadne::LinkComponent.new(href: href, classes: actual_classes, attributes: attributes)) do
|
258
|
-
render(Ariadne::HeroiconComponent.new(icon: "chevron-right", size: :sm, variant: :mini, text_attributes: { "aria-hidden": true }, text_classes: "ariadne-sr-only"))
|
259
|
-
end
|
260
|
-
end
|
261
|
-
}
|
262
|
-
|
263
|
-
DEFAULT_PAGINATOR_CLASSES = "ariadne-flex ariadne-items-center ariadne-justify-between ariadne-m-10"
|
264
|
-
def initialize(classes: "", attributes: {})
|
265
|
-
@classes = class_names(
|
266
|
-
DEFAULT_PAGINATOR_CLASSES,
|
267
|
-
classes,
|
268
|
-
)
|
269
|
-
|
270
|
-
@attributes = attributes
|
271
|
-
@attributes[:"aria-label"] ||= "paginator"
|
272
|
-
end
|
273
|
-
|
274
|
-
def call
|
275
|
-
render(Ariadne::BaseComponent.new(tag: :nav, classes: @classes, attributes: @attributes)) do
|
276
|
-
prev_page.to_s + next_page.to_s
|
277
|
-
end
|
278
|
-
end
|
279
|
-
end
|
280
|
-
end
|
281
|
-
end
|