ariadne_view_components 0.0.6 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +28 -0
  3. data/README.md +5 -1
  4. data/app/assets/javascripts/ariadne-form-with.d.ts +20 -0
  5. data/app/assets/javascripts/ariadne-form.d.ts +22 -0
  6. data/app/assets/javascripts/ariadne.d.ts +1 -1
  7. data/app/assets/javascripts/ariadne_view_components.js +7 -1
  8. data/app/assets/javascripts/ariadne_view_components.js.map +1 -1
  9. data/app/assets/javascripts/comment-component.d.ts +13 -0
  10. data/app/assets/javascripts/rich-text-area-component.d.ts +4 -0
  11. data/app/{components/ariadne/time_ago_component.d.ts → assets/javascripts/time-ago-component.d.ts} +0 -0
  12. data/app/assets/stylesheets/{application.ariadne_view_components.css → ariadne_view_components.css} +1 -0
  13. data/app/assets/stylesheets/prosemirror.css +323 -0
  14. data/app/components/ariadne/ariadne-form.ts +96 -0
  15. data/app/components/ariadne/ariadne.ts +8 -1
  16. data/app/components/ariadne/base_button.rb +6 -7
  17. data/app/components/ariadne/base_component.rb +13 -131
  18. data/app/components/ariadne/blankslate_component.html.erb +5 -5
  19. data/app/components/ariadne/blankslate_component.rb +4 -9
  20. data/app/components/ariadne/body_component.rb +1 -1
  21. data/app/components/ariadne/button_component.rb +7 -6
  22. data/app/components/ariadne/clipboard_copy_component.html.erb +3 -2
  23. data/app/components/ariadne/comment-component.ts +55 -0
  24. data/app/components/ariadne/comment_component.html.erb +17 -20
  25. data/app/components/ariadne/comment_component.rb +29 -17
  26. data/app/components/ariadne/component.rb +4 -4
  27. data/app/components/ariadne/container_component.rb +1 -1
  28. data/app/components/ariadne/counter_component.rb +4 -4
  29. data/app/components/ariadne/flash_component.html.erb +12 -12
  30. data/app/components/ariadne/flash_component.rb +16 -16
  31. data/app/components/ariadne/flex_component.rb +5 -7
  32. data/app/components/ariadne/footer_component.html.erb +1 -1
  33. data/app/components/ariadne/footer_component.rb +1 -1
  34. data/app/components/ariadne/grid_component.html.erb +4 -4
  35. data/app/components/ariadne/grid_component.rb +9 -9
  36. data/app/components/ariadne/header_component.html.erb +7 -7
  37. data/app/components/ariadne/header_component.rb +8 -8
  38. data/app/components/ariadne/heading_component.rb +3 -3
  39. data/app/components/ariadne/heroicon_component.rb +4 -4
  40. data/app/components/ariadne/inline_flex_component.rb +7 -7
  41. data/app/components/ariadne/link_component.rb +2 -2
  42. data/app/components/ariadne/list_component.rb +6 -5
  43. data/app/components/ariadne/narrow_container_component.html.erb +3 -0
  44. data/app/components/ariadne/narrow_container_component.rb +30 -0
  45. data/app/components/ariadne/panel_bar_component.html.erb +20 -0
  46. data/app/components/ariadne/panel_bar_component.rb +79 -0
  47. data/app/components/ariadne/pill_component.rb +2 -2
  48. data/app/components/ariadne/rich-text-area-component.ts +32 -0
  49. data/app/components/ariadne/rich_text_area_component.html.erb +6 -0
  50. data/app/components/ariadne/rich_text_area_component.rb +35 -0
  51. data/app/components/ariadne/slideover-component.ts +3 -3
  52. data/app/components/ariadne/slideover_component.html.erb +3 -3
  53. data/app/components/ariadne/slideover_component.rb +1 -1
  54. data/app/components/ariadne/tab_bar_component.html.erb +3 -0
  55. data/app/components/ariadne/tab_bar_component.rb +45 -0
  56. data/app/components/ariadne/tab_component.html.erb +7 -0
  57. data/app/components/ariadne/tab_component.rb +43 -0
  58. data/app/components/ariadne/{time_ago_component.ts → time-ago-component.ts} +0 -0
  59. data/app/components/ariadne/time_ago_component.rb +2 -2
  60. data/app/components/ariadne/timeline_component.html.erb +6 -6
  61. data/app/components/ariadne/tooltip-component.ts +3 -3
  62. data/app/components/ariadne/tooltip_component.html.erb +1 -1
  63. data/app/components/ariadne/tooltip_component.rb +1 -1
  64. data/app/lib/ariadne/action_view_extensions/form_helper.rb +4 -1
  65. data/app/lib/ariadne/fetch_or_fallback_helper.rb +3 -1
  66. data/app/lib/ariadne/form_builder.rb +10 -10
  67. data/app/lib/ariadne/icon_helper.rb +1 -1
  68. data/exe/tailwindcss +21 -0
  69. data/lib/ariadne/view_components/commands.rb +90 -0
  70. data/lib/ariadne/view_components/engine.rb +41 -4
  71. data/lib/ariadne/view_components/upstream.rb +20 -0
  72. data/lib/ariadne/view_components/version.rb +1 -1
  73. data/lib/ariadne/view_components.rb +1 -1
  74. data/lib/rubocop/config/default.yml +0 -6
  75. data/lib/rubocop/cop/ariadne/no_tag_memoize.rb +1 -0
  76. data/lib/tasks/ariadne_view_components.rake +2 -1
  77. data/lib/tasks/build.rake +30 -0
  78. data/lib/tasks/docs.rake +6 -1
  79. data/static/arguments.yml +99 -4
  80. data/static/audited_at.json +8 -2
  81. data/static/classes.yml +195 -181
  82. data/static/constants.json +112 -72
  83. data/static/statuses.json +8 -2
  84. data/tailwind.config.js +65 -0
  85. metadata +38 -36
  86. data/app/assets/builds/ariadne_view_components.css +0 -1874
  87. data/app/components/ariadne/ariadne.d.ts +0 -1
  88. data/app/components/ariadne/ariadne.js +0 -9
  89. data/app/components/ariadne/clipboard-copy-component.d.ts +0 -4
  90. data/app/components/ariadne/clipboard-copy-component.js +0 -18
  91. data/app/components/ariadne/clipboard_copy_component.d.ts +0 -4
  92. data/app/components/ariadne/clipboard_copy_component.js +0 -18
  93. data/app/components/ariadne/slideover-component.d.ts +0 -9
  94. data/app/components/ariadne/slideover-component.js +0 -20
  95. data/app/components/ariadne/slideover_component.d.ts +0 -9
  96. data/app/components/ariadne/slideover_component.js +0 -19
  97. data/app/components/ariadne/time_ago_component.js +0 -1
  98. data/app/components/ariadne/tooltip-component.d.ts +0 -24
  99. data/app/components/ariadne/tooltip-component.js +0 -42
  100. data/lib/ariadne/classify/utilities.rb +0 -199
  101. data/lib/ariadne/classify/utilities.yml +0 -1817
  102. data/lib/ariadne/classify/validation.rb +0 -18
  103. data/lib/ariadne/classify.rb +0 -124
  104. data/lib/rubocop/cop/ariadne/ariadne_heroicon.rb +0 -252
  105. data/lib/rubocop/cop/ariadne/component_name_migration.rb +0 -35
  106. data/lib/rubocop/cop/ariadne/system_argument_instead_of_class.rb +0 -57
  107. 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)
@@ -23,7 +23,7 @@ module Ariadne
23
23
 
24
24
  icon_presence!(icon, variant)
25
25
  variant_presence!(icon, variant)
26
- fetch_or_raise(HeroiconsHelper::Icon::VARIANTS, variant)
26
+ fetch_or_raise(HeroiconsHelper::Icon::VALID_VARIANTS, variant)
27
27
 
28
28
  true
29
29
  end
data/exe/tailwindcss ADDED
@@ -0,0 +1,21 @@
1
+ #! /usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ # because rubygems shims assume a gem's executables are Ruby
5
+
6
+ require "ariadne/view_components/commands"
7
+
8
+ begin
9
+ command = [Ariadne::ViewComponents::Commands.executable, *ARGV]
10
+ puts command.inspect
11
+ if Gem.win_platform?
12
+ # use system rather than exec as exec inexplicably fails to find the executable on Windows
13
+ # see related https://github.com/rubys/sprockets-esbuild/pull/4
14
+ system(*command, exception: true)
15
+ else
16
+ exec(*command)
17
+ end
18
+ rescue Ariadne::ViewComponents::Commands::UnsupportedPlatformException, Ariadne::ViewComponents::Commands::ExecutableNotFoundException => e
19
+ $stderr.puts("ERROR: " + e.message)
20
+ exit(1)
21
+ end
@@ -0,0 +1,90 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "upstream"
4
+
5
+ module Ariadne
6
+ module ViewComponents
7
+ # commands related to the upstream Tailwindcss project
8
+ module Commands
9
+ # raised when the host platform is not supported by upstream tailwindcss's binary releases
10
+ class UnsupportedPlatformException < StandardError
11
+ end
12
+
13
+ # raised when the tailwindcss executable could not be found where we expected it to be
14
+ class ExecutableNotFoundException < StandardError
15
+ end
16
+
17
+ class << self
18
+ def platform
19
+ [:cpu, :os].map { |m| Gem::Platform.local.send(m) }.join("-")
20
+ end
21
+
22
+ def executable(
23
+ exe_path: File.expand_path(File.join(__dir__, "..", "..", "exe"))
24
+ )
25
+ if Ariadne::ViewComponents::Upstream::NATIVE_PLATFORMS.keys.none? { |p| Gem::Platform.match(p) }
26
+ raise UnsupportedPlatformException, <<~MESSAGE
27
+ ariadne_view_components does not support the #{platform} platform
28
+ Please install tailwindcss following instructions at https://tailwindcss.com/docs/installation
29
+ MESSAGE
30
+ end
31
+
32
+ exe_path = Dir.glob(File.expand_path(File.join(exe_path, "*", "tailwindcss"))).find do |f|
33
+ Gem::Platform.match(File.basename(File.dirname(f)))
34
+ end
35
+
36
+ if exe_path.nil?
37
+ raise ExecutableNotFoundException, <<~MESSAGE
38
+ Cannot find the tailwindcss executable for #{platform} in #{exe_path}
39
+
40
+ If you're using bundler, please make sure you're on the latest bundler version:
41
+
42
+ gem install bundler
43
+ bundle update --bundler
44
+
45
+ Then make sure your lock file includes this platform by running:
46
+
47
+ bundle lock --add-platform #{platform}
48
+ bundle install
49
+
50
+ See `bundle lock --help` output for details.
51
+
52
+ If you're still seeing this message after taking those steps, try running
53
+ `bundle config` and ensure `force_ruby_platform` isn't set to `true`. See
54
+ https://github.com/rails/tailwindcss-rails#check-bundle_force_ruby_platform
55
+ for more details.
56
+ MESSAGE
57
+ end
58
+
59
+ exe_path
60
+ end
61
+
62
+ def compile_command(debug: false, **kwargs)
63
+ [
64
+ executable(**kwargs),
65
+ "-i", relative_path("app/assets/stylesheets/ariadne_view_components.css"),
66
+ "-o", relative_path("app/assets/builds/ariadne_view_components.css"),
67
+ "-c", relative_path("tailwind.config.js"),
68
+ ].tap do |command|
69
+ command << "--minify" unless debug
70
+ end
71
+ end
72
+
73
+ def watch_command(poll: false, **kwargs)
74
+ compile_command(**kwargs).tap do |command|
75
+ command << "-w"
76
+ command << "-p" if poll
77
+ end
78
+ end
79
+
80
+ def relative_path(path)
81
+ if defined?(Rails)
82
+ Rails.root.join(path).to_s
83
+ else
84
+ path
85
+ end
86
+ end
87
+ end
88
+ end
89
+ end
90
+ end
@@ -3,14 +3,21 @@
3
3
  require "rails/engine"
4
4
 
5
5
  require "view_component"
6
- require "ariadne/classify/utilities"
6
+
7
+ require "tailwind_merge"
7
8
 
8
9
  module Ariadne
10
+ # The Ariadne gem is a collection of ViewComponents that can be used to build
11
+ # accessible, responsive, and consistent UIs for Yetto.
9
12
  module ViewComponents
13
+ mattr_accessor :tailwind_merger
14
+
10
15
  # :nodoc:
11
16
  class Engine < ::Rails::Engine
12
17
  isolate_namespace Ariadne::ViewComponents
13
- config.eager_load_paths = ["#{root}/app/components", "#{root}/app/lib"]
18
+
19
+ config.autoload_paths = ["#{root}/lib"]
20
+ config.eager_load_paths = ["#{root}/app/components", "#{root}/app/helpers", "#{root}/app/lib"]
14
21
 
15
22
  config.ariadne_view_components = ActiveSupport::OrderedOptions.new
16
23
 
@@ -30,8 +37,38 @@ module Ariadne
30
37
  end
31
38
  end
32
39
 
33
- config.after_initialize do |app|
34
- ::Ariadne::Classify::Utilities.validate_class_names = app.config.ariadne_view_components.delete(:validate_class_names)
40
+ initializer "ariadne_view_components.zeitwerk_ignore" do
41
+ Rails.autoloaders.each do |autoloader|
42
+ autoloader.ignore(Engine.root.join("lib", "ariadne", "view_components", "linters.rb"))
43
+ autoloader.ignore(Engine.root.join("lib", "ariadne", "view_components", "linters", "**", "*.rb"))
44
+ autoloader.ignore(Engine.root.join("lib", "ariadne", "view_components", "statuses.rb"))
45
+ end
46
+ end
47
+
48
+ config.after_initialize do |_app|
49
+ # TODO: is any of this necessary???
50
+ ActionView::Base.field_error_proc = proc do |html_tag, instance_tag|
51
+ fragment = Nokogiri::HTML.fragment(html_tag)
52
+ field = fragment.at("input,select,textarea")
53
+
54
+ model = instance_tag.object
55
+ error_message = model.errors.full_messages.join(", ")
56
+
57
+ html = if field
58
+ field["class"] = "#{field["class"]} invalid"
59
+ html = <<-HTML
60
+ #{fragment}
61
+ <p class="error">#{error_message}</p>
62
+ HTML
63
+ html
64
+ else
65
+ html_tag
66
+ end
67
+
68
+ html.html_safe # rubocop:disable Rails/OutputSafety
69
+ end
70
+
71
+ Ariadne::ViewComponents.tailwind_merger = TailwindMerge::Merger.new
35
72
  end
36
73
  end
37
74
  end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Ariadne
4
+ module ViewComponents
5
+ # constants describing the upstream tailwindcss project
6
+ module Upstream
7
+ VERSION = "v3.1.8"
8
+
9
+ # rubygems platform name => upstream release filename
10
+ NATIVE_PLATFORMS = {
11
+ "arm64-darwin" => "tailwindcss-macos-arm64",
12
+ "x64-mingw32" => "tailwindcss-windows-x64.exe",
13
+ "x64-mingw-ucrt" => "tailwindcss-windows-x64.exe",
14
+ "x86_64-darwin" => "tailwindcss-macos-x64",
15
+ "x86_64-linux" => "tailwindcss-linux-x64",
16
+ "aarch64-linux" => "tailwindcss-linux-arm64",
17
+ }
18
+ end
19
+ end
20
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ariadne
4
4
  module ViewComponents
5
- VERSION = "0.0.6"
5
+ VERSION = "0.0.9"
6
6
  end
7
7
  end
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "ariadne/classify"
4
3
  require "ariadne/view_components/version"
5
4
  require "ariadne/view_components/engine"
6
5
  require "ariadne/view_components/constants"
6
+ require "ariadne/view_components/commands"
7
7
 
8
8
  module Ariadne
9
9
  # :nodoc:
@@ -4,11 +4,5 @@ require:
4
4
  AllCops:
5
5
  DisabledByDefault: true
6
6
 
7
- Ariadne/SystemArgumentInsteadOfClass:
8
- Enabled: true
9
-
10
7
  Ariadne/NoTagMemoize:
11
- Enabled: false
12
-
13
- Ariadne/AriadneHeroicon:
14
8
  Enabled: true
@@ -16,6 +16,7 @@ module RuboCop
16
16
  #
17
17
  # good
18
18
  # @attributes[:tag] = :h2
19
+ # TODO: TEST THIS
19
20
  class NoTagMemoize < RuboCop::Cop::Cop
20
21
  INVALID_MESSAGE = <<~STR
21
22
  Avoid `[:tag] ||=`. Instead, try one of the following:
@@ -2,7 +2,8 @@
2
2
 
3
3
  ERB_GLOB = "**/*.html{+*,}.erb"
4
4
  RB_GLOB = "**/*.rb"
5
- BLOCK_EXPR = /\s*((\s+|\))do|\{)(\s*\|[^|]*\|)?\s*\Z/.freeze # copied from Rails: action_view/template/handlers/erb/erubi.rb
5
+ # copied from Rails: action_view/template/handlers/erb/erubi.rb
6
+ BLOCK_EXPR = /\s*((\s+|\))do|\{)(\s*\|[^|]*\|)?\s*\Z/
6
7
 
7
8
  namespace :ariadne_view_components do
8
9
  desc "Report arguments used in each component"
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "ariadne/view_components/commands"
4
+
5
+ namespace :ariadne_view_components do
6
+ desc "Build Ariadne View Components CSS"
7
+ task :build do |_, args|
8
+ debug = args.extras.include?("debug")
9
+ command = Ariadne::ViewComponents::Commands.compile_command(debug: debug)
10
+ puts command.inspect
11
+ system(*command, exception: true)
12
+ end
13
+
14
+ desc "Watch and build Ariadne View Components CSS on file changes"
15
+ task :watch do |_, args|
16
+ debug = args.extras.include?("debug")
17
+ poll = args.extras.include?("poll")
18
+ command = Ariadne::ViewComponents::Commands.watch_command(debug: debug, poll: poll)
19
+ puts command.inspect
20
+ system(*command)
21
+ end
22
+ end
23
+
24
+ Rake::Task["assets:precompile"].enhance(["ariadne_view_components:build"]) if Rake::Task.task_defined?("assets:precompile")
25
+
26
+ if Rake::Task.task_defined?("test:prepare")
27
+ Rake::Task["test:prepare"].enhance(["ariadne_view_components:build"])
28
+ elsif Rake::Task.task_defined?("db:test:prepare")
29
+ Rake::Task["db:test:prepare"].enhance(["ariadne_view_components:build"])
30
+ 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::FlexComponent,
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: action
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: The action to take when the form is submitted.
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` and `solid`.
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:
@@ -13,7 +13,7 @@
13
13
  "Ariadne::FlexComponent": "",
14
14
  "Ariadne::FooterComponent": "",
15
15
  "Ariadne::GridComponent": "",
16
- "Ariadne::GridComponent::Item": "",
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::Item": "",
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": "",