ariadne_view_components 0.0.96 → 0.0.96.2

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 (33) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/app/assets/javascripts/ariadne_view_components.js.map +1 -1
  4. data/app/assets/stylesheets/ariadne_view_components.css +1 -1
  5. data/app/assets/stylesheets/ariadne_view_components.css.br +0 -0
  6. data/app/assets/stylesheets/ariadne_view_components.css.gz +0 -0
  7. data/app/components/ariadne/form/base_input_component.rb +1 -1
  8. data/app/components/ariadne/form/label_helper.rb +2 -1
  9. data/app/components/ariadne/layout/sidebar/component.rb +12 -3
  10. data/app/components/ariadne/ui/avatar/component.html.erb +1 -1
  11. data/app/components/ariadne/ui/avatar/component.rb +14 -6
  12. data/app/components/ariadne/ui/badge/component.rb +21 -22
  13. data/app/components/ariadne/ui/button/component.rb +7 -4
  14. data/app/components/ariadne/ui/dialog/component.rb +1 -1
  15. data/app/components/ariadne/ui/popover/component.rb +1 -1
  16. data/app/components/ariadne/ui/sidebar/component.rb +4 -14
  17. data/app/components/ariadne/ui/sidebar/content/component.html.erb +4 -5
  18. data/app/components/ariadne/ui/sidebar/content/component.rb +7 -17
  19. data/app/components/ariadne/ui/sidebar/footer/component.rb +3 -2
  20. data/app/components/ariadne/ui/sidebar/group/component.html.erb +3 -2
  21. data/app/components/ariadne/ui/sidebar/group/component.rb +4 -10
  22. data/app/components/ariadne/ui/sidebar/header/component.rb +3 -3
  23. data/app/components/ariadne/ui/sidebar/item/component.html.erb +19 -23
  24. data/app/components/ariadne/ui/sidebar/item/component.rb +15 -18
  25. data/app/components/ariadne/ui/table/component.rb +12 -0
  26. data/app/components/ariadne/ui/table/row/component.rb +3 -3
  27. data/app/components/ariadne/ui/typography/component.rb +7 -1
  28. data/app/frontend/stylesheets/theme.css +110 -96
  29. data/app/helpers/ariadne/form_helper.rb +1 -1
  30. data/app/lib/ariadne/view_component/html_attrs.rb +1 -1
  31. data/lib/ariadne/view_components/version.rb +1 -1
  32. data/lib/ariadne/yard/lookbook_docs_helper.rb +0 -2
  33. metadata +2 -2
@@ -45,20 +45,16 @@ module Ariadne
45
45
  style do
46
46
  base do
47
47
  [
48
+ "ariadne:inline-flex",
49
+ "ariadne:items-center",
50
+ "ariadne:gap-1",
48
51
  "ariadne:truncate",
49
- "ariadne:max-w-full",
50
- "ariadne:border-black/10",
51
- "ariadne:dark:border-white/10",
52
52
  "ariadne:text-content",
53
53
  "ariadne:dark:text-content-dark",
54
- "ariadne:outline-hidden",
55
- "ariadne:ring-offset-0",
56
- "ariadne:focus-visible:ring-2",
57
- "ariadne:ring-blue-400",
58
- "ariadne:dark:ring-blue-600",
59
- "ariadne:py-1",
60
- "ariadne:px-1.5",
61
- "ariadne:rounded-md",
54
+ "ariadne:py-0.5",
55
+ "ariadne:px-2",
56
+ "ariadne:rounded-full",
57
+ "ariadne:font-medium",
62
58
  ]
63
59
  end
64
60
 
@@ -67,7 +63,7 @@ module Ariadne
67
63
  include_colors!
68
64
 
69
65
  with_leading_item do
70
- yes { "ariadne:inline-flex ariadne:items-center" }
66
+ yes { "" }
71
67
  no { "ariadne:inline-block" }
72
68
  end
73
69
 
@@ -77,21 +73,24 @@ module Ariadne
77
73
  end
78
74
 
79
75
  size do
80
- xs { "ariadne:text-xs ariadne:leading-3" }
81
- sm { "ariadne:text-xs ariadne:leading-4" }
82
- md { "ariadne:text-base ariadne:leading-5" }
83
- lg { "ariadne:text-lg ariadne:leading-6" }
84
- xl { "ariadne:text-xl ariadne:leading-8" }
76
+ xs { "ariadne:text-xs ariadne:leading-3 ariadne:py-0" }
77
+ sm { "ariadne:text-xs ariadne:leading-4 ariadne:py-0.5" }
78
+ md { "ariadne:text-sm ariadne:leading-5 ariadne:py-0.5" }
79
+ lg { "ariadne:text-sm ariadne:leading-5 ariadne:py-1" }
80
+ xl { "ariadne:text-base ariadne:leading-6 ariadne:py-1" }
85
81
  end
86
82
  end
87
83
 
88
- compound(size: :xs, with_leading_item: :yes) { ["ariadne:pe-1 ariadne:ps-0.5"] }
89
- compound(size: :sm, with_leading_item: :yes) { ["ariadne:pe-1.5 ariadne:ps-0.5"] }
90
- compound(size: :md, with_leading_item: :yes) { ["ariadne:pe-1.5 ariadne:ps-0.5"] }
84
+ compound(size: :xs, with_leading_item: :yes) { ["ariadne:pe-1.5 ariadne:ps-1"] }
85
+ compound(size: :sm, with_leading_item: :yes) { ["ariadne:pe-2 ariadne:ps-1"] }
86
+ compound(size: :md, with_leading_item: :yes) { ["ariadne:pe-2 ariadne:ps-1"] }
91
87
 
92
- compound(size: :xs, with_leading_item: :no) { ["ariadne:px-1"] }
93
- compound(size: :sm, with_leading_item: :no) { ["ariadne:px-1.5"] }
88
+ compound(size: :xs, with_leading_item: :no) { ["ariadne:px-1.5"] }
89
+ compound(size: :sm, with_leading_item: :no) { ["ariadne:px-2"] }
94
90
  compound(size: :md, with_leading_item: :no) { ["ariadne:px-2"] }
91
+
92
+ # Add gray color as default
93
+ compound(color: :none) { ["ariadne:bg-gray-100 ariadne:text-gray-800"] }
95
94
  end
96
95
  end
97
96
  end
@@ -101,6 +101,7 @@ module Ariadne
101
101
  style do
102
102
  base do
103
103
  [
104
+ "ariadne:bg-background",
104
105
  "ariadne:inline-flex",
105
106
  "ariadne:items-center",
106
107
  "ariadne:justify-center",
@@ -108,7 +109,7 @@ module Ariadne
108
109
  "ariadne:gap-x-1.5",
109
110
  "ariadne:rounded",
110
111
  "ariadne:px-2",
111
- # "ariadne:py-1",
112
+ "ariadne:hover:cursor-pointer",
112
113
  "ariadne:font-semibold",
113
114
  "ariadne:shadow-sm",
114
115
  "ariadne:text-black",
@@ -125,11 +126,13 @@ module Ariadne
125
126
  scheme do
126
127
  primary do
127
128
  [
128
- "ariadne:bg-primary",
129
+ "ariadne:bg-purple-300",
130
+ "ariadne:dark:bg-purple-600",
131
+
129
132
  "ariadne:text-primary-foreground",
133
+ "ariadne:dark:text-primary-foreground",
130
134
 
131
135
  "ariadne:hover:enabled:bg-primary/90",
132
-
133
136
  "ariadne:disabled:opacity-50",
134
137
  ]
135
138
  end
@@ -275,7 +278,7 @@ module Ariadne
275
278
  return trimmed_content unless content.html_safe?
276
279
 
277
280
  # strip unsets `html_safe`, so we have to set it back again to guarantee that HTML blocks won't break
278
- trimmed_content.html_safe # rubocop:disable Rails/OutputSafety
281
+ trimmed_content.html_safe
279
282
  end
280
283
  end
281
284
  end
@@ -59,7 +59,7 @@ module Ariadne
59
59
  }
60
60
 
61
61
  # The main content within the dialog.
62
- renders_one :body, BaseComponent::ACCEPT_ANYTHING
62
+ renders_one :body, BaseComponent::ACCEPT_ANYTHING
63
63
 
64
64
  # Optional footer content to the dialog; usually form buttons for submit or cancel.
65
65
  #
@@ -58,7 +58,7 @@ module Ariadne
58
58
 
59
59
  html_attrs[:data] ||= {}
60
60
  html_attrs[:data] = {
61
- "#{stimulus_name}-target" => ["popover", html_attrs.fetch(:data, {}).fetch(:target, nil)].compact.join(" "),
61
+ "#{stimulus_name}-target" => ["popover", html_attrs.dig(:data, :target)].compact.join(" "),
62
62
  }.merge(html_attrs[:data])
63
63
  end
64
64
 
@@ -43,33 +43,23 @@ module Ariadne
43
43
  "ariadne:flex-col",
44
44
  "ariadne:h-screen",
45
45
  "ariadne:overflow-hidden",
46
- "ariadne:border-r",
47
- "ariadne:bg-white", # Add background color matching Figma
48
- "ariadne:border-zinc-100",
49
- "ariadne:dark:border-zinc-800", # Updated dark border color
50
46
  "ariadne:transition-all",
51
47
  "ariadne:duration-300",
52
48
  "ariadne:ease-in-out",
53
- "ariadne:z-20"
49
+ "ariadne:z-20",
54
50
  ]
55
51
  end
56
52
 
57
53
  variants do
58
- variant do
59
- default do
60
- []
61
- end
62
- end
63
-
64
54
  size do
65
55
  sm do
66
56
  ["ariadne:w-64 ariadne:data-[collapsed=true]:w-16"]
67
57
  end
68
-
58
+
69
59
  md do
70
60
  ["ariadne:w-72 ariadne:data-[collapsed=true]:w-20"]
71
61
  end
72
-
62
+
73
63
  lg do
74
64
  ["ariadne:w-80 ariadne:data-[collapsed=true]:w-24"]
75
65
  end
@@ -79,4 +69,4 @@ module Ariadne
79
69
  end
80
70
  end
81
71
  end
82
- end
72
+ end
@@ -1,14 +1,13 @@
1
1
  <div class="<%= style %>">
2
+ <% if custom_content %>
3
+ <%= custom_content %>
4
+ <% end %>
2
5
  <% if search %>
3
- <div class="ariadne:mb-4">
4
- <%= search %>
5
- </div>
6
+ <%= search %>
6
7
  <% end %>
7
8
  <% if groups.any? %>
8
9
  <% groups.each do |group| %>
9
10
  <%= group %>
10
11
  <% end %>
11
- <% elsif custom_content %>
12
- <%= custom_content %>
13
12
  <% end %>
14
13
  </div>
@@ -11,37 +11,27 @@ module Ariadne
11
11
  # Accepts any content for the sidebar
12
12
  renders_many :groups, Ariadne::UI::Sidebar::Group::Component
13
13
 
14
- # If no groups are used, any content can be passed directly
14
+ # Custom content can be placed anywhere within the sidebar content
15
15
  renders_one :custom_content, BaseComponent::ACCEPT_ANYTHING
16
-
17
- # Search box for the sidebar
18
- renders_one :search
19
16
 
20
- # Whether to render direct content with padding
21
- option :padded, default: -> { true }
17
+ # Search box for the sidebar
18
+ renders_one :search, BaseComponent::ACCEPT_ANYTHING
22
19
 
23
20
  style do
24
21
  base do
25
22
  [
26
23
  "ariadne:flex",
27
24
  "ariadne:flex-col",
28
- "ariadne:gap-3",
25
+ "ariadne:gap-4",
29
26
  "ariadne:flex-1",
30
27
  "ariadne:overflow-y-auto",
31
- "ariadne:py-2",
32
- "ariadne:bg-white", # Match Figma background
28
+ "ariadne:p-4",
29
+ "ariadne:rounded-md",
33
30
  ]
34
31
  end
35
-
36
- variants do
37
- padded do
38
- yes { "ariadne:px-4" }
39
- no { "" }
40
- end
41
- end
42
32
  end
43
33
  end
44
34
  end
45
35
  end
46
36
  end
47
- end
37
+ end
@@ -23,7 +23,8 @@ module Ariadne
23
23
  "ariadne:flex",
24
24
  "ariadne:items-center",
25
25
  "ariadne:justify-between",
26
- "ariadne:p-4",
26
+ "ariadne:px-4",
27
+ "ariadne:py-3",
27
28
  "ariadne:border-t",
28
29
  "ariadne:border-zinc-100",
29
30
  "ariadne:dark:border-zinc-800",
@@ -51,4 +52,4 @@ module Ariadne
51
52
  end
52
53
  end
53
54
  end
54
- end
55
+ end
@@ -2,6 +2,9 @@
2
2
  id="<%= component_id %>"
3
3
  data-controller="<%= collapsible ? 'ariadne-ui-sidebar-group' : nil %>"
4
4
  data-ariadne-ui-sidebar-group-open-value="<%= default_open %>">
5
+ <% if custom_content %>
6
+ <%= custom_content %>
7
+ <% end %>
5
8
  <% if label.present? %>
6
9
  <div class="<%= style(:label) %>" <%= "data-action='click->ariadne-ui-sidebar-group#toggle'" if collapsible %>>
7
10
  <%= label %>
@@ -29,8 +32,6 @@
29
32
  <% items.each do |item| %>
30
33
  <%= item %>
31
34
  <% end %>
32
- <% elsif custom_content %>
33
- <%= custom_content %>
34
35
  <% end %>
35
36
  </div>
36
37
  </div>
@@ -9,7 +9,7 @@ module Ariadne
9
9
  # Used to organize related navigation items.
10
10
  class Component < Ariadne::BaseComponent
11
11
  # @param [String] label Label for the group
12
- option :label, default: -> { nil }
12
+ option :label, optional: true
13
13
 
14
14
  # @param [Boolean] collapsible Whether the group can be collapsed
15
15
  option :collapsible, default: -> { false }
@@ -29,7 +29,6 @@ module Ariadne
29
29
  "ariadne:flex",
30
30
  "ariadne:flex-col",
31
31
  "ariadne:gap-1",
32
- "ariadne:px-3",
33
32
  ]
34
33
  end
35
34
  end
@@ -39,8 +38,7 @@ module Ariadne
39
38
  [
40
39
  "ariadne:text-xs",
41
40
  "ariadne:font-medium",
42
- "ariadne:text-zinc-500",
43
- "ariadne:dark:text-zinc-400",
41
+ "ariadne:sidebar-foreground",
44
42
  "ariadne:uppercase",
45
43
  "ariadne:tracking-wider",
46
44
  "ariadne:py-2",
@@ -57,16 +55,12 @@ module Ariadne
57
55
  [
58
56
  "ariadne:flex",
59
57
  "ariadne:flex-col",
60
- "ariadne:gap-0.5",
58
+ "ariadne:gap-1",
61
59
  ]
62
60
  end
63
61
 
64
62
  variants do
65
63
  collapsible do
66
- no do
67
- []
68
- end
69
-
70
64
  yes do
71
65
  [
72
66
  "ariadne:transition-all",
@@ -81,4 +75,4 @@ module Ariadne
81
75
  end
82
76
  end
83
77
  end
84
- end
78
+ end
@@ -23,11 +23,11 @@ module Ariadne
23
23
  "ariadne:flex",
24
24
  "ariadne:items-center",
25
25
  "ariadne:justify-between",
26
- "ariadne:p-4",
26
+ "ariadne:px-4",
27
+ "ariadne:py-3",
27
28
  "ariadne:border-b",
28
29
  "ariadne:border-zinc-100",
29
30
  "ariadne:dark:border-zinc-800",
30
- "ariadne:bg-white", # Match Figma
31
31
  ]
32
32
  end
33
33
 
@@ -51,4 +51,4 @@ module Ariadne
51
51
  end
52
52
  end
53
53
  end
54
- end
54
+ end
@@ -1,24 +1,20 @@
1
- <% tag_name = href.present? ? "a" : "div" %>
2
- <% tag_attributes = { class: style(current: current), data: { collapsed: false } } %>
3
- <% tag_attributes[:href] = href if href.present? %>
4
- <%= content_tag(tag_name, **tag_attributes) do %>
5
- <% if icon %>
6
- <span class="ariadne:flex ariadne:items-center ariadne:justify-center ariadne:w-5 ariadne:h-5 ariadne:flex-shrink-0">
7
- <%= icon %>
8
- </span>
9
- <% elsif icon_slot %>
10
- <span class="ariadne:flex ariadne:items-center ariadne:justify-center ariadne:w-5 ariadne:h-5 ariadne:flex-shrink-0">
11
- <%= icon_slot %>
12
- </span>
1
+ <%= content_tag(href.present? ? "a" : "div", data: { collapsed: false }, **html_attrs) do %>
2
+ <% if custom_content %>
3
+ <div class="ariadne:flex-1 ariadne:data-[sidebar-collapsed=true]:hidden"><%= custom_content %></div>
13
4
  <% end %>
14
- <% if label.present? %>
15
- <span class="ariadne:truncate ariadne:data-[sidebar-collapsed=true]:hidden"><%= label %></span>
16
- <% elsif custom_content %>
17
- <span class="ariadne:flex-1 ariadne:data-[sidebar-collapsed=true]:hidden"><%= custom_content %></span>
18
- <% end %>
19
- <% if badge %>
20
- <div class="ariadne:ml-auto ariadne:data-[sidebar-collapsed=true]:hidden">
21
- <%= badge %>
22
- </div>
23
- <% end %>
24
- <% end %>
5
+ <div class="ariadne:flex ariadne:items-center ariadne:w-full">
6
+ <% if icon %>
7
+ <span class="ariadne:flex mr-2 ariadne:items-center ariadne:justify-center ariadne:w-5 ariadne:h-5 ariadne:flex-shrink-0">
8
+ <%= icon %>
9
+ </span>
10
+ <% end %>
11
+ <% if label.present? %>
12
+ <span class="ariadne:truncate ariadne:data-[sidebar-collapsed=true]:hidden"><%= label %></span>
13
+ <% if badge %>
14
+ <span class="ariadne:ml-auto ariadne:inline-flex ariadne:items-center ariadne:py-0 ariadne:h-5 ariadne:data-[sidebar-collapsed=true]:hidden">
15
+ <%= badge %>
16
+ </span>
17
+ <% end %>
18
+ <% end %>
19
+ </div>
20
+ <% end %>
@@ -16,19 +16,27 @@ module Ariadne
16
16
 
17
17
  # @param [String] label Text label for the item
18
18
  option :label, default: -> { nil }
19
+ option :html_attrs, default: -> { {} }
19
20
 
20
21
  # Icon for the item
21
22
  renders_one :icon, Ariadne::UI::Heroicon::Component
22
-
23
23
  # Generic icon slot for custom icons
24
24
  renders_one :icon_slot, BaseComponent::ACCEPT_ANYTHING
25
25
 
26
26
  # Badge for the item (e.g., notification count)
27
- renders_one :badge, Ariadne::UI::Badge::Component
27
+ renders_one :badge, BaseComponent::ACCEPT_ANYTHING
28
28
 
29
29
  # Content for the item if not using label
30
30
  renders_one :custom_content, BaseComponent::ACCEPT_ANYTHING
31
31
 
32
+ accepts_html_attributes do |html_attrs|
33
+ html_attrs[:class] = merge_tailwind_classes([style(current: current), html_attrs[:class]].join(" "))
34
+
35
+ if href.present?
36
+ html_attrs[:href] = href
37
+ end
38
+ end
39
+
32
40
  style do
33
41
  base do
34
42
  [
@@ -44,28 +52,17 @@ module Ariadne
44
52
  "ariadne:outline-none",
45
53
  "ariadne:focus-visible:ring-2",
46
54
  "ariadne:focus-visible:ring-offset-2",
55
+ "ariadne:relative",
56
+ "ariadne:dark:hover:bg-purple-700/20",
47
57
  ]
48
58
  end
49
59
 
50
60
  variants do
51
61
  current do
52
- no do
53
- [
54
- "ariadne:text-zinc-700",
55
- "ariadne:dark:text-zinc-300",
56
- "ariadne:hover:bg-violet-50", # Purple hover state based on Figma
57
- "ariadne:hover:text-violet-700", # Text color on hover
58
- "ariadne:dark:hover:bg-violet-900",
59
- "ariadne:dark:hover:text-violet-300",
60
- ]
61
- end
62
-
63
62
  yes do
64
63
  [
65
- "ariadne:text-violet-700", # Purple active text based on Figma
66
- "ariadne:bg-violet-50", # Light purple background
67
- "ariadne:dark:text-violet-300",
68
- "ariadne:dark:bg-violet-900",
64
+ "ariadne:bg-purple-700/20",
65
+ "ariadne:dark:bg-purple-300/20",
69
66
  ]
70
67
  end
71
68
  end
@@ -75,4 +72,4 @@ module Ariadne
75
72
  end
76
73
  end
77
74
  end
78
- end
75
+ end
@@ -11,6 +11,18 @@ module Ariadne
11
11
  renders_many :rows, Ariadne::UI::Table::Row::Component
12
12
  renders_one :footer, Ariadne::UI::Table::Footer::Component
13
13
 
14
+ # TODO: Add hoverable variant to make the table rows hoverable
15
+ # variant :hoverable do
16
+ # style(:row) do
17
+ # base do
18
+ # [
19
+ # "ariadne:hover:bg-purple-300/50",
20
+ # "ariadne:hover:dark:bg-purple-600/50",
21
+ # ]
22
+ # end
23
+ # end
24
+ # end
25
+
14
26
  style :table do
15
27
  base do
16
28
  [
@@ -23,10 +23,10 @@ module Ariadne
23
23
  style :row do
24
24
  base do
25
25
  [
26
- "ariadne:border-b",
27
26
  "ariadne:transition-colors",
28
- "ariadne:hover:bg-muted/50",
29
- "ariadne:data-[state=selected]:bg-muted",
27
+ "ariadne:border-b",
28
+ "ariadne:border-gray-200",
29
+ "ariadne:dark:border-gray-800",
30
30
  ]
31
31
  end
32
32
  end
@@ -4,7 +4,7 @@
4
4
  module Ariadne
5
5
  module UI
6
6
  module Typography
7
- VALID_TYPES = [:title, :heading, :subheading, :ann, :lede, :code].freeze
7
+ VALID_TYPES = [:title, :heading, :subheading, :ann, :lede, :code, :text].freeze
8
8
 
9
9
  class Component < Ariadne::BaseComponent
10
10
  option :tag, optional: true
@@ -50,6 +50,12 @@ module Ariadne
50
50
 
51
51
  variants do
52
52
  size do
53
+ xs do
54
+ [
55
+ "ariadne:text-xs",
56
+ ]
57
+ end
58
+
53
59
  sm do
54
60
  [
55
61
  "ariadne:text-sm",