relay_ui 0.2.3 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/lib/relay_ui/engine.rb +9 -11
  3. data/lib/relay_ui/version.rb +1 -1
  4. data/lib/rui/badges/base.rb +5 -1
  5. data/lib/rui/badges/blue.rb +3 -1
  6. data/lib/rui/badges/gray.rb +3 -1
  7. data/lib/rui/badges/green.rb +3 -1
  8. data/lib/rui/badges/purple.rb +3 -1
  9. data/lib/rui/badges/red.rb +3 -1
  10. data/lib/rui/badges/yellow.rb +3 -1
  11. data/lib/rui/badges.rb +3 -0
  12. data/lib/rui/base.rb +3 -8
  13. data/lib/rui/buttons/base.rb +9 -7
  14. data/lib/rui/buttons/destructive.rb +3 -1
  15. data/lib/rui/buttons/ghost.rb +3 -1
  16. data/lib/rui/buttons/outline.rb +3 -1
  17. data/lib/rui/buttons/primary.rb +3 -1
  18. data/lib/rui/buttons/secondary.rb +3 -1
  19. data/lib/rui/buttons.rb +3 -0
  20. data/lib/rui/card.rb +92 -0
  21. data/lib/rui/flash.rb +51 -0
  22. data/lib/rui/forms/checkbox.rb +25 -0
  23. data/lib/rui/forms/email.rb +19 -0
  24. data/lib/rui/forms/field_group.rb +5 -0
  25. data/lib/rui/forms/label.rb +7 -0
  26. data/lib/rui/forms/password.rb +18 -0
  27. data/lib/rui/forms/phone.rb +18 -0
  28. data/lib/rui/forms/radio.rb +22 -0
  29. data/lib/rui/forms/select.rb +24 -0
  30. data/lib/rui/forms/text.rb +17 -0
  31. data/lib/rui/forms/textarea.rb +18 -0
  32. data/lib/rui/forms.rb +3 -0
  33. data/lib/rui/helpers.rb +3 -0
  34. data/lib/rui/icon.rb +3 -1
  35. data/lib/rui/layout/body.rb +7 -0
  36. data/lib/rui/layout/main.rb +5 -0
  37. data/lib/rui/layout/page.rb +5 -0
  38. data/lib/rui/layout.rb +3 -0
  39. data/lib/rui/links/base.rb +5 -3
  40. data/lib/rui/links/destructive.rb +3 -1
  41. data/lib/rui/links/ghost.rb +3 -1
  42. data/lib/rui/links/outline.rb +3 -1
  43. data/lib/rui/links/primary.rb +3 -1
  44. data/lib/rui/links/secondary.rb +3 -1
  45. data/lib/rui/links.rb +3 -0
  46. data/lib/rui/markdown/generator.rb +2 -1
  47. data/lib/rui/markdown/safe.rb +3 -1
  48. data/lib/rui/markdown/safe_renderer.rb +3 -1
  49. data/lib/rui/markdown/unsafe.rb +3 -1
  50. data/lib/rui/markdown/unsafe_renderer.rb +9 -1
  51. data/lib/rui/markdown.rb +3 -0
  52. data/lib/rui/navigation/menu_button.rb +7 -0
  53. data/lib/rui/navigation/sidebar.rb +43 -0
  54. data/lib/rui/navigation/top.rb +19 -0
  55. data/lib/rui/navigation.rb +2 -50
  56. data/lib/rui/slideout.rb +9 -9
  57. data/lib/rui/table.rb +54 -0
  58. data/lib/rui/text.rb +5 -3
  59. metadata +70 -3
  60. data/dist/relay_ui/relay_ui.css +0 -595
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 26bbb6690e73af9858e034ddd1f4165dc3e566da75a598df32697bfbda4eb326
4
- data.tar.gz: a717467cf909cb32f506d9dd5f8cd0931256b6c8e05de7dfa02634ff943fadd2
3
+ metadata.gz: 7158b2530047c016d6353aba1125ad761104ae2f553656c3d28c40cf6fc74f4a
4
+ data.tar.gz: 917a96410664ca64d92e4f41c86d7af74ebcbdc27511dbcf167fc74bd45bec26
5
5
  SHA512:
6
- metadata.gz: 6b210e15c31c9dc210e201c67862410d2b768c7cf4f7a838dcc07b92c0925c782a25abbe4323d3c12eb9930c694eba1ed1a16205da3be220f42a6ef36e6c9042
7
- data.tar.gz: 76d07201379e1e1bfbff8cb914b58012d8868a2dcee91146856bedca312ad07f20e1e7de1de07ce256b20bd9a8547ed6492e44de165588f435c9749b172265e3
6
+ metadata.gz: cad6bf23e5f39a374115580a70469e382cfdb3578f0c553a04394b73632902484ba479755430eed9ad5af782a7ec633f57fe8d97ea5e75404a7609463221ebf9
7
+ data.tar.gz: 9f9bc6189f61911c6691b73ba0e6822fd586d339c859714d492db5b5587d3e2fcc2ea5e6c20ae0b18fff65f92872124999798c66200a84308f119e5ce7aeeab1
@@ -1,18 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RUI
4
- class Engine < ::Rails::Engine
5
- isolate_namespace RUI
4
+ if defined?(Rails)
5
+ class Engine < ::Rails::Engine
6
+ isolate_namespace RUI
6
7
 
7
- initializer "relay_ui.assets.precompile" do |app|
8
- app.config.assets.paths << root.join("dist")
9
- end
10
-
11
- initializer "relay_ui.autoload.components" do
12
- Rails.autoloaders.main.push_dir(
13
- "#{Gem::Specification.find_by_name('relay_ui').gem_dir}/lib/rui",
14
- namespace: RUI
15
- )
8
+ initializer "relay_ui.autoload.components" do
9
+ Rails.autoloaders.main.push_dir(
10
+ "#{Gem::Specification.find_by_name('relay_ui').gem_dir}/lib/rui",
11
+ namespace: RUI
12
+ )
13
+ end
16
14
  end
17
15
  end
18
16
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RUI
4
- VERSION = "0.2.3"
4
+ VERSION = "0.3.0"
5
5
  end
@@ -1,5 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class RUI::Badges::Base < RUI::Base
2
4
  def view_template
3
- span(class: "rui:px-3 rui:py-0.5 rui:text-xs rui:rounded-full #{variant_classes}") { yield }
5
+ div do
6
+ span(class: "whitespace-nowrap px-3 py-0.5 text-xs rounded-full text-center font-medium #{variant_classes}") { yield }
7
+ end
4
8
  end
5
9
  end
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class RUI::Badges::Blue < RUI::Badges::Base
2
4
  private
3
5
 
4
- def variant_classes = "rui:bg-blue-100 rui:text-blue-700"
6
+ def variant_classes = "bg-blue-100 text-blue-700"
5
7
  end
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class RUI::Badges::Gray < RUI::Badges::Base
2
4
  private
3
5
 
4
- def variant_classes = "rui:bg-gray-100 rui:text-gray-700"
6
+ def variant_classes = "bg-gray-100 text-gray-700"
5
7
  end
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class RUI::Badges::Green < RUI::Badges::Base
2
4
  private
3
5
 
4
- def variant_classes = "rui:bg-green-100 rui:text-green-700"
6
+ def variant_classes = "bg-green-100 text-green-700"
5
7
  end
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class RUI::Badges::Purple < RUI::Badges::Base
2
4
  private
3
5
 
4
- def variant_classes = "rui:bg-purple-100 rui:text-purple-700"
6
+ def variant_classes = "bg-purple-100 text-purple-700"
5
7
  end
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class RUI::Badges::Red < RUI::Badges::Base
2
4
  private
3
5
 
4
- def variant_classes = "rui:bg-red-100 rui:text-red-700"
6
+ def variant_classes = "bg-red-100 text-red-700"
5
7
  end
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class RUI::Badges::Yellow < RUI::Badges::Base
2
4
  private
3
5
 
4
- def variant_classes = "rui:bg-yellow-100 rui:text-yellow-700"
6
+ def variant_classes = "bg-yellow-100 text-yellow-700"
5
7
  end
data/lib/rui/badges.rb ADDED
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RUI::Badges; end
data/lib/rui/base.rb CHANGED
@@ -1,13 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class RUI::Base < Phlex::HTML
4
- include Components
5
- include Phlex::Rails::Helpers::Routes
6
-
7
- if Rails.env.development?
8
- def before_template
9
- comment { "Before #{self.class.name}" }
10
- super
11
- end
4
+ def initialize(**attrs, &)
5
+ @attrs = attrs
6
+ super(&)
12
7
  end
13
8
  end
@@ -1,18 +1,20 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class RUI::Buttons::Base < RUI::Base
2
- def initialize(icon: nil, data: {})
4
+ def initialize(icon: nil, **attrs)
3
5
  @icon = icon
4
- @data = data
6
+ @attrs = attrs
5
7
  end
6
8
 
7
9
  def view_template
8
- button(class: classes, data: @data) do
9
- div(class: "rui:flex rui:flex-row rui:items-center rui:gap-2") do
10
+ button(class: classes, **@attrs) do
11
+ div(class: "flex flex-row items-center gap-2") do
10
12
  if @icon
11
- div(class: "rui:size-4 rui:my-1") do
13
+ div(class: "size-4 my-1") do
12
14
  render RUI::Icon.new(@icon)
13
15
  end
14
16
  end
15
- span { yield } if block_given?
17
+ span(class: "text-nowrap") { yield } if block_given?
16
18
  end
17
19
  end
18
20
  end
@@ -23,5 +25,5 @@ class RUI::Buttons::Base < RUI::Base
23
25
  "#{base_classes} #{variant_classes}"
24
26
  end
25
27
 
26
- def base_classes = "rui:inline-block rui:px-3 rui:py-1 rui:hover:cursor-pointer rui:rounded rui:transition rui:duration-200 rui:ease-in-out"
28
+ def base_classes = "inline-block px-2 py-1 hover:cursor-pointer rounded-md transition duration-200 ease-in-out"
27
29
  end
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class RUI::Buttons::Destructive < RUI::Buttons::Base
2
4
  private
3
5
 
4
- def variant_classes = "rui:bg-red-700 rui:hover:bg-red-900 rui:text-white"
6
+ def variant_classes = "bg-red-700 hover:bg-red-900 text-white border border-red-700 hover:border-red-900"
5
7
  end
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class RUI::Buttons::Ghost < RUI::Buttons::Base
2
4
  private
3
5
 
4
- def variant_classes = "rui:hover:bg-zinc-100"
6
+ def variant_classes = "hover:bg-zinc-100"
5
7
  end
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class RUI::Buttons::Outline < RUI::Buttons::Base
2
4
  private
3
5
 
4
- def variant_classes = "rui:border rui:rounded rui:border-zinc-700 rui:hover:border-zinc-900 rui:text-zinc-700 rui:hover:text-zinc-900 rui:hover:bg-zinc-100"
6
+ def variant_classes = "border rounded border-zinc-300 hover:border-zinc-700 text-zinc-700"
5
7
  end
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class RUI::Buttons::Primary < RUI::Buttons::Base
2
4
  private
3
5
 
4
- def variant_classes = "rui:bg-blue-700 rui:hover:bg-blue-900 rui:text-white"
6
+ def variant_classes = "bg-blue-700 hover:bg-blue-900 text-white border border-blue-700 hover:border-blue-900"
5
7
  end
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class RUI::Buttons::Secondary < RUI::Buttons::Base
2
4
  private
3
5
 
4
- def variant_classes = "rui:bg-zinc-700 rui:hover:bg-zinc-900 rui:text-white"
6
+ def variant_classes = "bg-zinc-700 hover:bg-zinc-900 text-white border border-zinc-700 hover:border-zinc-900"
5
7
  end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RUI::Buttons; end
data/lib/rui/card.rb ADDED
@@ -0,0 +1,92 @@
1
+ # frozen_string_literal: true
2
+
3
+ class RUI::Card < RUI::Base
4
+ def view_template(&)
5
+ div(role: "region", aria: { label: "Card" }, **@attrs) do
6
+ div(
7
+ class: "#{padding(capture(&))} flex flex-col gap-4 border border-zinc-300 rounded-lg overflow-hidden",
8
+ data: { component: "card" },
9
+ &
10
+ )
11
+ end
12
+ end
13
+
14
+ def header(&)
15
+ render Header.new(&)
16
+ end
17
+
18
+ def image(&)
19
+ img(src: capture(&))
20
+ end
21
+
22
+ def body(&)
23
+ div(class: "px-4", &)
24
+ end
25
+
26
+ def footer(&)
27
+ render Footer.new(&)
28
+ end
29
+
30
+ class Header < RUI::Base
31
+ def view_template(&)
32
+ header(class: "flex flex-row justify-between items-center gap-4 px-4", &)
33
+ end
34
+
35
+ def thumbnail(&)
36
+ img(src: capture(&), class: "inline-block rounded-full size-10")
37
+ end
38
+
39
+ def titles(&)
40
+ render Titles.new(&)
41
+ end
42
+
43
+ def actions(&)
44
+ div(class: "flex flex-row gap-2 items-center", &)
45
+ end
46
+
47
+ class Titles < RUI::Base
48
+ def view_template(&)
49
+ div(class: "grow shrink basis-0 flex flex-col", &)
50
+ end
51
+
52
+ def title(&)
53
+ h2(class: "text-xl font-semibold", &)
54
+ end
55
+
56
+ def subtitle(&)
57
+ h3(class: "text-lg", &)
58
+ end
59
+ end
60
+ end
61
+
62
+ class Footer < RUI::Base
63
+ def view_template(&)
64
+ footer(class: "flex flex-row justify-end items-center gap-4 px-4", &)
65
+ end
66
+
67
+ def actions(&)
68
+ render Actions.new(&)
69
+ end
70
+
71
+ class Actions < RUI::Base
72
+ def view_template(&)
73
+ div(class: "flex flex-row gap-2 items-center", &)
74
+ end
75
+
76
+ def action(href: "#", **kwargs, &)
77
+ a(href:, class: "text-blue-700 hover:underline uppercase text-sm font-semibold", **kwargs, &)
78
+ end
79
+ end
80
+ end
81
+
82
+ private
83
+
84
+ def padding(content)
85
+ return if content.empty?
86
+ padding = []
87
+ doc = Nokogiri::HTML::DocumentFragment.parse(content)
88
+ padding << "pt-4" if doc.children.first.name != "img"
89
+ padding << "pb-4" if doc.children.last.name != "img"
90
+ padding.join(" ")
91
+ end
92
+ end
data/lib/rui/flash.rb ADDED
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ class RUI::Flash < RUI::Base
4
+ def initialize(variant = "alert")
5
+ @variant = variant
6
+ end
7
+
8
+ def view_template
9
+ div(role: "alert", data: { controller: "flash" }, class: "lg:max-w-lg border p-3 lg:px-5 lg:py-3 rounded-lg opacity-0 transition-opacity duration-100 ease-in-out " + classes) do
10
+ div(class: "flex flex-row items-center justify-between gap-3") do
11
+ div(class: "w-6") { render RUI::Icon.new(icon) }
12
+ p(class: "w-full") { yield }
13
+ button(class: "w-6 hover:cursor-pointer", data: { action: "flash#close" }) do
14
+ render RUI::Icon.new("x")
15
+ end
16
+ end
17
+ end
18
+ end
19
+
20
+ private
21
+
22
+ def classes = {
23
+ "notice" => "bg-blue-50 text-blue-900 border-blue-500",
24
+ "success" => "bg-green-50 text-green-900 border-green-500",
25
+ "alert" => "bg-yellow-50 text-yellow-900 border-yellow-500",
26
+ "failure" => "bg-red-50 text-red-900 border-red-500"
27
+ }.fetch @variant, "bg-zinc-50 text-zinc-900 border-zinc-500"
28
+
29
+ def icon = {
30
+ "notice" => "info-circle",
31
+ "success" => "circle-check",
32
+ "alert" => "alert-triangle",
33
+ "failure" => "flag"
34
+ }.fetch @variant, "alert-circle-filled"
35
+
36
+ class Wrapper < RUI::Base
37
+ def view_template(&)
38
+ div(class: "fixed left-0 lg:left-auto bottom-0 right-0 m-5 lg:m-10 flex flex-col gap-3", &)
39
+ end
40
+ end
41
+
42
+ module Helper
43
+ def success(message)
44
+ flash[:success] = message
45
+ end
46
+
47
+ def failure(message)
48
+ flash[:failure] = message
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ class RUI::Forms::Checkbox < RUI::Base
4
+ def initialize(**kwargs)
5
+ @kwargs = kwargs
6
+ end
7
+
8
+ def view_template(&)
9
+ div(class: "flex flex-row gap-3 items-center") do
10
+ input(
11
+ type: "hidden",
12
+ value: "0",
13
+ autocomplete: "off",
14
+ **@kwargs
15
+ )
16
+ input(
17
+ type: "checkbox",
18
+ value: "1",
19
+ class: "appearance-none size-4 border border-zinc-300 rounded hover:border-zinc-500 hover:cursor-pointer checked:bg-blue-700",
20
+ **@kwargs
21
+ )
22
+ render RUI::Forms::Label.new(&) if block_given?
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ class RUI::Forms::Email < RUI::Base
4
+ def initialize(**kwargs)
5
+ @kwargs = kwargs
6
+ end
7
+
8
+ def view_template(&)
9
+ render RUI::Forms::FieldGroup.new do
10
+ render RUI::Forms::Label.new(&) if block_given?
11
+ input(
12
+ type: "email",
13
+ class: "border border-zinc-300 hover:border-zinc-400 rounded px-2 py-1",
14
+ **@kwargs
15
+ )
16
+ end
17
+ div
18
+ end
19
+ end
@@ -0,0 +1,5 @@
1
+ class RUI::Forms::FieldGroup < RUI::Base
2
+ def view_template(&)
3
+ div(class: "flex flex-col gap-1", &)
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class RUI::Forms::Label < RUI::Base
4
+ def view_template(&)
5
+ label(class: "text-sm font-semibold", &)
6
+ end
7
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ class RUI::Forms::Password < RUI::Base
4
+ def initialize(**kwargs)
5
+ @kwargs = kwargs
6
+ end
7
+
8
+ def view_template(&)
9
+ render RUI::Forms::FieldGroup.new do
10
+ render RUI::Forms::Label.new(&) if block_given?
11
+ input(
12
+ type: "password",
13
+ class: "border border-zinc-300 hover:border-zinc-400 rounded px-2 py-1",
14
+ **@kwargs
15
+ )
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ class RUI::Forms::Phone < RUI::Base
4
+ def initialize(**kwargs)
5
+ @kwargs = kwargs
6
+ end
7
+
8
+ def view_template(&)
9
+ render RUI::Forms::FieldGroup.new do
10
+ render RUI::Forms::Label.new(&) if block_given?
11
+ input(
12
+ type: :tel,
13
+ class: "border border-zinc-300 hover:border-zinc-400 rounded px-2 py-1",
14
+ **@kwargs
15
+ )
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ class RUI::Forms::Radio < RUI::Base
4
+ def initialize(label:, &)
5
+ @label = label
6
+ super(&)
7
+ end
8
+
9
+ def view_template
10
+ render RUI::Forms::FieldGroup.new do
11
+ render RUI::Forms::Label.new { @label }
12
+ yield
13
+ end
14
+ end
15
+
16
+ def option(**attrs, &)
17
+ div(class: "flex flex-row gap-3 items-center") do
18
+ input(class: "hover:cursor-pointer", type: :radio, **attrs)
19
+ label(&)
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ class RUI::Forms::Select < RUI::Base
4
+ def initialize(label:, **attrs, &)
5
+ @label = label
6
+ @attrs = attrs
7
+ super(&)
8
+ end
9
+
10
+ def view_template(&)
11
+ render RUI::Forms::FieldGroup.new do
12
+ render RUI::Forms::Label.new { @label }
13
+ select(
14
+ class: "border border-zinc-300 hover:border-zinc-400 rounded px-2 py-1.5 hover:cursor-pointer",
15
+ **@attrs,
16
+ &
17
+ )
18
+ end
19
+ end
20
+
21
+ def option(**attrs, &)
22
+ tag(:option, **attrs, &)
23
+ end
24
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ class RUI::Forms::Text < RUI::Base
4
+ def initialize(**kwargs)
5
+ @kwargs = kwargs
6
+ end
7
+
8
+ def view_template(&)
9
+ render RUI::Forms::FieldGroup.new do
10
+ render RUI::Forms::Label.new(&) if block_given?
11
+ input(
12
+ class: "border border-zinc-300 hover:border-zinc-400 rounded px-2 py-1",
13
+ **@kwargs
14
+ )
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ class RUI::Forms::Textarea < RUI::Base
4
+ def initialize(**kwargs)
5
+ @kwargs = kwargs
6
+ end
7
+
8
+ def view_template(&)
9
+ render RUI::Forms::FieldGroup.new do
10
+ render RUI::Forms::Label.new(&) if block_given?
11
+ textarea(
12
+ rows: 5,
13
+ class: "border border-zinc-300 hover:border-zinc-400 rounded px-2 py-1",
14
+ **@kwargs
15
+ )
16
+ end
17
+ end
18
+ end
data/lib/rui/forms.rb ADDED
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RUI::Forms; end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RUI::Helpers; end
data/lib/rui/icon.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "tabler_icons_ruby"
2
4
 
3
5
  class RUI::Icon < RUI::Base
@@ -6,6 +8,6 @@ class RUI::Icon < RUI::Base
6
8
  end
7
9
 
8
10
  def view_template
9
- raw TablerIconsRuby.render(@icon)
11
+ div { TablerIconsRuby.render(@icon) }
10
12
  end
11
13
  end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class RUI::Layout::Body < RUI::Base
4
+ def view_template(&)
5
+ body(class: "flex flex-col", data: { controller: "navigation" }, &)
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ class RUI::Layout::Main < RUI::Base
2
+ def view_template(&)
3
+ main(class: "p-5 lg:p-10 w-full max-w-[800px]", &)
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class RUI::Layout::Page < RUI::Base
2
+ def view_template(&)
3
+ div(class: "flex flex-row mt-25.5 lg:mt-14", &)
4
+ end
5
+ end
data/lib/rui/layout.rb ADDED
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RUI::Layout; end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class RUI::Links::Base < RUI::Base
2
4
  def initialize(href: "#", icon: nil, data: {})
3
5
  @href = href
@@ -7,9 +9,9 @@ class RUI::Links::Base < RUI::Base
7
9
 
8
10
  def view_template
9
11
  a(href: @href, class: classes, data: @data) do
10
- div(class: "rui:flex rui:flex-row rui:items-center rui:gap-2") do
12
+ div(class: "flex flex-row items-center gap-2") do
11
13
  if @icon
12
- div(class: "rui:size-4 rui:my-1") do
14
+ div(class: "size-4 my-1") do
13
15
  render RUI::Icon.new(@icon)
14
16
  end
15
17
  end
@@ -24,5 +26,5 @@ class RUI::Links::Base < RUI::Base
24
26
  "#{base_classes} #{variant_classes}"
25
27
  end
26
28
 
27
- def base_classes = "rui:inline-block rui:px-3 rui:py-1 rui:hover:cursor-pointer rui:rounded rui:transition rui:duration-200 rui:ease-in-out"
29
+ def base_classes = "inline-block px-2 py-1 hover:cursor-pointer rounded transition duration-200 ease-in-out"
28
30
  end
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class RUI::Links::Destructive < RUI::Links::Base
2
4
  private
3
5
 
4
- def variant_classes = "rui:bg-red-700 rui:hover:bg-red-900 rui:text-white"
6
+ def variant_classes = "bg-red-700 hover:bg-red-900 text-white border border-red-700 hover:border-red-900"
5
7
  end
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class RUI::Links::Ghost < RUI::Links::Base
2
4
  private
3
5
 
4
- def variant_classes = "rui:hover:bg-zinc-100"
6
+ def variant_classes = "text-blue-700 hover:text-blue-900 hover:bg-zinc-100"
5
7
  end