ariadne_view_components 0.0.12 → 0.0.13
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.d.ts +1 -0
- 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/tab-container-component.d.ts +1 -0
- data/app/assets/javascripts/tab-nav-component.d.ts +9 -0
- data/app/components/ariadne/ariadne.ts +3 -0
- data/app/components/ariadne/body_component.rb +1 -1
- data/app/components/ariadne/button_component.rb +2 -2
- data/app/components/ariadne/comment_component.html.erb +2 -6
- data/app/components/ariadne/comment_component.rb +1 -1
- data/app/components/ariadne/component.rb +3 -5
- data/app/components/ariadne/container_component.rb +1 -1
- data/app/components/ariadne/counter_component.rb +1 -1
- data/app/components/ariadne/flash_component.rb +1 -1
- data/app/components/ariadne/flex_component.rb +1 -1
- data/app/components/ariadne/footer_component.rb +1 -1
- data/app/components/ariadne/grid_component.html.erb +2 -2
- data/app/components/ariadne/grid_component.rb +10 -8
- data/app/components/ariadne/header_component.rb +1 -1
- data/app/components/ariadne/heroicon_component.html.erb +1 -1
- data/app/components/ariadne/heroicon_component.rb +1 -2
- data/app/components/ariadne/list_component.html.erb +3 -5
- data/app/components/ariadne/list_component.rb +5 -5
- data/app/components/ariadne/main_component.rb +1 -1
- data/app/components/ariadne/narrow_container_component.rb +1 -1
- data/app/components/ariadne/panel_bar_component.rb +2 -2
- data/app/components/ariadne/pill_component.rb +1 -1
- 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.rb +2 -2
- data/app/components/ariadne/tab-container-component.ts +24 -0
- data/app/components/ariadne/tab-nav-component.ts +34 -0
- data/app/components/ariadne/tab_component.html.erb +2 -6
- data/app/components/ariadne/tab_component.rb +77 -18
- data/app/components/ariadne/tab_container_component.erb +12 -0
- data/app/components/ariadne/tab_container_component.rb +61 -0
- data/app/components/ariadne/tab_nav_component.html.erb +7 -0
- data/app/components/ariadne/tab_nav_component.rb +72 -0
- data/app/components/ariadne/table_component.html.erb +17 -0
- data/app/components/ariadne/table_component.rb +281 -0
- data/app/components/ariadne/time_ago_component.rb +1 -1
- data/app/components/ariadne/timeline_component.rb +1 -1
- data/app/lib/ariadne/fetch_or_fallback_helper.rb +11 -3
- data/app/lib/ariadne/icon_helper.rb +17 -13
- data/lib/ariadne/view_components/constants.rb +2 -2
- data/lib/ariadne/view_components/statuses.rb +2 -2
- data/lib/ariadne/view_components/version.rb +1 -1
- data/lib/rubocop/config/default.yml +1 -1
- data/lib/tasks/docs.rake +5 -96
- data/static/arguments.yml +51 -15
- data/static/audited_at.json +9 -1
- data/static/classes.yml +157 -269
- data/static/constants.json +55 -15
- data/static/statuses.json +9 -1
- data/tailwind.config.js +11 -26
- metadata +13 -10
- data/app/components/ariadne/tab_bar_component.html.erb +0 -3
- data/app/components/ariadne/tab_bar_component.rb +0 -45
- data/app/lib/ariadne/join_style_arguments_helper.rb +0 -14
- data/app/lib/ariadne/tab_nav_helper.rb +0 -35
- data/app/lib/ariadne/tabbed_component_helper.rb +0 -39
- data/app/lib/ariadne/test_selector_helper.rb +0 -20
- data/app/lib/ariadne/underline_nav_helper.rb +0 -44
data/lib/tasks/docs.rake
CHANGED
@@ -47,7 +47,6 @@ 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::RichTextAreaComponent,
|
51
50
|
Ariadne::CommentComponent,
|
52
51
|
Ariadne::BodyComponent,
|
53
52
|
Ariadne::BlankslateComponent,
|
@@ -71,9 +70,12 @@ namespace :docs do
|
|
71
70
|
Ariadne::NarrowContainerComponent,
|
72
71
|
Ariadne::PanelBarComponent,
|
73
72
|
Ariadne::PillComponent,
|
73
|
+
Ariadne::RichTextAreaComponent,
|
74
74
|
Ariadne::SlideoverComponent,
|
75
75
|
Ariadne::TabComponent,
|
76
|
-
Ariadne::
|
76
|
+
Ariadne::TabContainerComponent,
|
77
|
+
Ariadne::TableComponent,
|
78
|
+
Ariadne::TabNavComponent,
|
77
79
|
Ariadne::Text,
|
78
80
|
Ariadne::TimeAgoComponent,
|
79
81
|
Ariadne::TimelineComponent,
|
@@ -258,62 +260,14 @@ namespace :docs do
|
|
258
260
|
raise
|
259
261
|
end
|
260
262
|
|
261
|
-
additional_classes = []
|
262
|
-
|
263
|
-
tailwind_utility_prefixes = ["bg-", "border-", "fill-", "stroke-", "text-"]
|
264
|
-
|
265
|
-
additional_color_classes = [
|
266
|
-
"billy-purple",
|
267
|
-
"state-closed",
|
268
|
-
"state-open",
|
269
|
-
]
|
270
|
-
|
271
|
-
additional_color_classes.each do |color_class|
|
272
|
-
tailwind_utility_prefixes.each do |prefix|
|
273
|
-
additional_classes.concat([".#{prefix}#{color_class}"])
|
274
|
-
end
|
275
|
-
end
|
276
|
-
|
277
|
-
Dir.glob("./app/components/**/*.rb") do |rb_filename|
|
278
|
-
content = File.read(rb_filename)
|
279
|
-
matches = content.scan(CLASS_REGEX)
|
280
|
-
|
281
|
-
if matches.present?
|
282
|
-
result = matches.flatten.compact.map { |c| c.split(" ") }.flatten.select { |r| r =~ /\A[0-9a-z:\-]+\z/ }.uniq
|
283
|
-
additional_classes.concat(result.map { |r| ".#{r}" }) if result.present?
|
284
|
-
end
|
285
|
-
end
|
286
|
-
|
287
|
-
final_list_of_classes = classes_found_in_examples.concat(additional_classes).uniq.sort
|
288
263
|
File.open("static/classes.yml", "w") do |f|
|
289
|
-
f.puts YAML.dump(
|
264
|
+
f.puts YAML.dump(classes_found_in_examples.uniq)
|
290
265
|
end
|
291
266
|
|
292
267
|
File.open("static/arguments.yml", "w") do |f|
|
293
268
|
f.puts YAML.dump(args_for_components)
|
294
269
|
end
|
295
270
|
|
296
|
-
# Build system arguments docs from BaseComponent
|
297
|
-
documentation = registry.get(Ariadne::BaseComponent.name)
|
298
|
-
File.open("docs/content/system-arguments.md", "w") do |f|
|
299
|
-
f.puts("---")
|
300
|
-
f.puts("title: System arguments")
|
301
|
-
f.puts("---")
|
302
|
-
f.puts
|
303
|
-
f.puts("<!-- Warning: AUTO-GENERATED file, do not edit. Add code comments to your Ruby instead <3 -->")
|
304
|
-
f.puts
|
305
|
-
f.puts(documentation.base_docstring)
|
306
|
-
f.puts
|
307
|
-
|
308
|
-
initialize_method = documentation.meths.find(&:constructor?)
|
309
|
-
|
310
|
-
f.puts(view_context.render(inline: initialize_method.base_docstring))
|
311
|
-
end
|
312
|
-
|
313
|
-
# Copy over ADR docs and insert them into the nav
|
314
|
-
# puts "Copying ADRs..."
|
315
|
-
# Rake::Task["docs:build_adrs"].invoke
|
316
|
-
|
317
271
|
puts "Markdown compiled."
|
318
272
|
|
319
273
|
if components_needing_docs.any?
|
@@ -322,51 +276,6 @@ namespace :docs do
|
|
322
276
|
end
|
323
277
|
end
|
324
278
|
|
325
|
-
# task :build_adrs do
|
326
|
-
# adr_content_dir = File.join("docs", "content", "adr")
|
327
|
-
|
328
|
-
# FileUtils.rm_rf(File.join(adr_content_dir))
|
329
|
-
# FileUtils.mkdir(adr_content_dir)
|
330
|
-
|
331
|
-
# nav_entries = Dir[File.join("adr", "*.md")].sort.map do |orig_path|
|
332
|
-
# orig_file_name = File.basename(orig_path)
|
333
|
-
# url_name = orig_file_name.chomp(".md")
|
334
|
-
|
335
|
-
# file_contents = File.read(orig_path)
|
336
|
-
# file_contents = <<~CONTENTS.sub(/\n+\z/, "\n")
|
337
|
-
# <!-- Warning: AUTO-GENERATED file, do not edit. Make changes to the files in the adr/ directory instead. -->
|
338
|
-
# #{file_contents}
|
339
|
-
# CONTENTS
|
340
|
-
|
341
|
-
# title_match = /^# (.+)/.match(file_contents)
|
342
|
-
# title = title_match[1]
|
343
|
-
|
344
|
-
# # Don't include initial ADR for recording ADRs
|
345
|
-
# next nil if title == "Record architecture decisions"
|
346
|
-
|
347
|
-
# File.write(File.join(adr_content_dir, orig_file_name), file_contents)
|
348
|
-
# puts "Copied #{orig_path}"
|
349
|
-
|
350
|
-
# { "title" => title, "url" => "/adr/#{url_name}" }
|
351
|
-
# end
|
352
|
-
|
353
|
-
# nav_yaml_file = File.join("docs", "src", "@primer", "gatsby-theme-doctocat", "nav.yml")
|
354
|
-
# nav_yaml = YAML.load_file(nav_yaml_file)
|
355
|
-
# adr_entry = {
|
356
|
-
# "title" => "Architecture decisions",
|
357
|
-
# "children" => nav_entries.compact,
|
358
|
-
# }
|
359
|
-
|
360
|
-
# existing_index = nav_yaml.index { |entry| entry["title"] == "Architecture decisions" }
|
361
|
-
# if existing_index
|
362
|
-
# nav_yaml[existing_index] = adr_entry
|
363
|
-
# else
|
364
|
-
# nav_yaml << adr_entry
|
365
|
-
# end
|
366
|
-
|
367
|
-
# File.write(nav_yaml_file, YAML.dump(nav_yaml))
|
368
|
-
# end
|
369
|
-
|
370
279
|
desc "Generate previews from documentation examples"
|
371
280
|
task :preview do
|
372
281
|
registry = generate_yard_registry
|
data/static/arguments.yml
CHANGED
@@ -476,7 +476,7 @@
|
|
476
476
|
- name: form_id
|
477
477
|
type: String
|
478
478
|
default: "`nil`"
|
479
|
-
description: The ID of any
|
479
|
+
description: The ID of any `form` tag to submit when the button is clicked.
|
480
480
|
- name: open_text
|
481
481
|
type: String
|
482
482
|
default: '`"Open"`'
|
@@ -493,17 +493,41 @@
|
|
493
493
|
type: Hash
|
494
494
|
default: "`{}`"
|
495
495
|
description: "[Classes and attributes](/classes-attributes)"
|
496
|
-
- component:
|
497
|
-
source: https://github.com/yettoapp/ariadne/ruby/view_components/tree/main/app/components/ariadne/
|
496
|
+
- component: Tab
|
497
|
+
source: https://github.com/yettoapp/ariadne/ruby/view_components/tree/main/app/components/ariadne/tab_component.rb
|
498
|
+
parameters:
|
499
|
+
- name: id
|
500
|
+
type: String
|
501
|
+
default: "`nil`"
|
502
|
+
description: The unique ID of the tab.
|
503
|
+
- name: selected
|
504
|
+
type: Boolean
|
505
|
+
default: "`false`"
|
506
|
+
description: Whether the tab is selected or not.
|
507
|
+
- name: with_panel
|
508
|
+
type: Boolean
|
509
|
+
default: "`false`"
|
510
|
+
description: Whether the Tab has an associated panel.
|
511
|
+
- name: href
|
512
|
+
type: String
|
513
|
+
default: '`""`'
|
514
|
+
description: The link to navigate to when the tab is clicked.
|
515
|
+
- name: classes
|
516
|
+
type: String
|
517
|
+
default: '`""`'
|
518
|
+
description: "[Classes and attributes](/classes-attributes)"
|
519
|
+
- name: attributes
|
520
|
+
type: Hash
|
521
|
+
default: "`{}`"
|
522
|
+
description: "[Classes and attributes](/classes-attributes)"
|
523
|
+
- component: TabContainer
|
524
|
+
source: https://github.com/yettoapp/ariadne/ruby/view_components/tree/main/app/components/ariadne/tab_container_component.rb
|
498
525
|
parameters:
|
499
|
-
- name: tag
|
500
|
-
type: Symbol, String
|
501
|
-
default: "`:nav`"
|
502
|
-
description: The rendered tag name.
|
503
526
|
- name: sr_label
|
504
527
|
type: String
|
505
528
|
default: N/A
|
506
|
-
description:
|
529
|
+
description: Sets an `aria-label` that helps assistive technology users understand
|
530
|
+
the purpose of the tabs.
|
507
531
|
- name: classes
|
508
532
|
type: String
|
509
533
|
default: '`""`'
|
@@ -512,17 +536,29 @@
|
|
512
536
|
type: Hash
|
513
537
|
default: "`{}`"
|
514
538
|
description: "[Classes and attributes](/classes-attributes)"
|
515
|
-
- component:
|
516
|
-
source: https://github.com/yettoapp/ariadne/ruby/view_components/tree/main/app/components/ariadne/
|
539
|
+
- component: TabNav
|
540
|
+
source: https://github.com/yettoapp/ariadne/ruby/view_components/tree/main/app/components/ariadne/tab_nav_component.rb
|
517
541
|
parameters:
|
542
|
+
- name: label
|
543
|
+
type: String
|
544
|
+
default: N/A
|
545
|
+
description: Sets an `aria-label` that helps assistive technology users understand
|
546
|
+
the purpose of the links, and distinguish it from similar elements.
|
518
547
|
- name: tag
|
519
548
|
type: Symbol, String
|
520
|
-
default: "`:
|
549
|
+
default: "`:nav`"
|
521
550
|
description: The rendered tag name.
|
522
|
-
- name:
|
523
|
-
type:
|
524
|
-
default: "`
|
525
|
-
description:
|
551
|
+
- name: classes
|
552
|
+
type: String
|
553
|
+
default: '`""`'
|
554
|
+
description: "[Classes and attributes](/classes-attributes)"
|
555
|
+
- name: attributes
|
556
|
+
type: Hash
|
557
|
+
default: "`{}`"
|
558
|
+
description: "[Classes and attributes](/classes-attributes)"
|
559
|
+
- component: Table
|
560
|
+
source: https://github.com/yettoapp/ariadne/ruby/view_components/tree/main/app/components/ariadne/table_component.rb
|
561
|
+
parameters:
|
526
562
|
- name: classes
|
527
563
|
type: String
|
528
564
|
default: '`""`'
|
data/static/audited_at.json
CHANGED
@@ -29,8 +29,16 @@
|
|
29
29
|
"Ariadne::PillComponent": "",
|
30
30
|
"Ariadne::RichTextAreaComponent": "",
|
31
31
|
"Ariadne::SlideoverComponent": "",
|
32
|
-
"Ariadne::TabBarComponent": "",
|
33
32
|
"Ariadne::TabComponent": "",
|
33
|
+
"Ariadne::TabContainerComponent": "",
|
34
|
+
"Ariadne::TabNavComponent": "",
|
35
|
+
"Ariadne::TableComponent": "",
|
36
|
+
"Ariadne::TableComponent::FooterItem": "",
|
37
|
+
"Ariadne::TableComponent::HeaderRowItem": "",
|
38
|
+
"Ariadne::TableComponent::PaginationBarItem": "",
|
39
|
+
"Ariadne::TableComponent::RowItem": "",
|
40
|
+
"Ariadne::TableComponent::RowItem::CellItem": "",
|
41
|
+
"Ariadne::TableComponent::RowItem::HeaderCellItem": "",
|
34
42
|
"Ariadne::Text": "",
|
35
43
|
"Ariadne::TimeAgoComponent": "",
|
36
44
|
"Ariadne::TimelineComponent": "",
|