maquina-components 0.7.3 → 0.8.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 (70) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/calendar.css +48 -1
  3. data/app/assets/stylesheets/date_picker.css +13 -1
  4. data/app/assets/stylesheets/drawer.css +8 -8
  5. data/app/assets/stylesheets/form.css +58 -4
  6. data/app/assets/stylesheets/separator.css +6 -1
  7. data/app/assets/tailwind/maquina_components_engine/tokens.css +1 -0
  8. data/app/helpers/maquina_components/calendar_helper.rb +69 -0
  9. data/app/helpers/maquina_components/drawer_helper.rb +3 -5
  10. data/app/helpers/maquina_components/dropdown_menu_helper.rb +22 -5
  11. data/app/helpers/maquina_components/empty_helper.rb +3 -3
  12. data/app/helpers/maquina_components/icons_helper.rb +9 -5
  13. data/app/helpers/maquina_components/pagination_helper.rb +27 -5
  14. data/app/javascript/controllers/calendar_controller.js +114 -28
  15. data/app/javascript/controllers/combobox_controller.js +17 -2
  16. data/app/javascript/controllers/date_picker_controller.js +57 -21
  17. data/app/javascript/controllers/drawer_controller.js +66 -44
  18. data/app/javascript/controllers/drawer_trigger_controller.js +13 -0
  19. data/app/javascript/controllers/sidebar_controller.js +84 -42
  20. data/app/javascript/controllers/sidebar_trigger_controller.js +13 -0
  21. data/app/javascript/controllers/toast_controller.js +2 -3
  22. data/app/javascript/controllers/toaster_controller.js +23 -1
  23. data/app/javascript/controllers/toggle_group_controller.js +17 -6
  24. data/app/views/components/_badge.html.erb +1 -1
  25. data/app/views/components/_breadcrumbs.html.erb +7 -7
  26. data/app/views/components/_calendar.html.erb +39 -30
  27. data/app/views/components/_combobox.html.erb +2 -0
  28. data/app/views/components/_date_picker.html.erb +21 -33
  29. data/app/views/components/_drawer.html.erb +1 -1
  30. data/app/views/components/_menu_button.html.erb +1 -1
  31. data/app/views/components/_sidebar.html.erb +1 -1
  32. data/app/views/components/breadcrumbs/_ellipsis.html.erb +1 -1
  33. data/app/views/components/breadcrumbs/_item.html.erb +1 -1
  34. data/app/views/components/breadcrumbs/_link.html.erb +1 -1
  35. data/app/views/components/breadcrumbs/_list.html.erb +1 -1
  36. data/app/views/components/breadcrumbs/_page.html.erb +1 -1
  37. data/app/views/components/breadcrumbs/_separator.html.erb +1 -2
  38. data/app/views/components/calendar/_header.html.erb +28 -4
  39. data/app/views/components/calendar/_week.html.erb +7 -4
  40. data/app/views/components/card/_content.html.erb +1 -1
  41. data/app/views/components/card/_footer.html.erb +3 -10
  42. data/app/views/components/card/_header.html.erb +1 -1
  43. data/app/views/components/card/_title.html.erb +1 -1
  44. data/app/views/components/combobox/_option.html.erb +2 -2
  45. data/app/views/components/drawer/_close.html.erb +11 -5
  46. data/app/views/components/drawer/_content.html.erb +1 -1
  47. data/app/views/components/drawer/_footer.html.erb +1 -1
  48. data/app/views/components/drawer/_header.html.erb +1 -1
  49. data/app/views/components/drawer/_provider.html.erb +1 -1
  50. data/app/views/components/drawer/_trigger.html.erb +4 -2
  51. data/app/views/components/pagination/_ellipsis.html.erb +5 -8
  52. data/app/views/components/pagination/_link.html.erb +1 -1
  53. data/app/views/components/pagination/_next.html.erb +6 -7
  54. data/app/views/components/pagination/_previous.html.erb +6 -7
  55. data/app/views/components/sidebar/_content.html.erb +1 -1
  56. data/app/views/components/sidebar/_footer.html.erb +1 -1
  57. data/app/views/components/sidebar/_group.html.erb +1 -1
  58. data/app/views/components/sidebar/_header.html.erb +1 -1
  59. data/app/views/components/sidebar/_inset.html.erb +1 -1
  60. data/app/views/components/sidebar/_menu.html.erb +1 -1
  61. data/app/views/components/sidebar/_menu_button.html.erb +1 -1
  62. data/app/views/components/sidebar/_menu_item.html.erb +1 -1
  63. data/app/views/components/sidebar/_menu_link.html.erb +3 -3
  64. data/app/views/components/sidebar/_provider.html.erb +1 -1
  65. data/app/views/components/sidebar/_trigger.html.erb +1 -1
  66. data/app/views/components/stats/_stats_card.html.erb +7 -6
  67. data/app/views/components/toast/_action.html.erb +2 -1
  68. data/lib/generators/maquina_components/install/templates/theme.css.tt +11 -0
  69. data/lib/maquina_components/version.rb +1 -1
  70. metadata +1 -1
@@ -3,6 +3,6 @@
3
3
  breadcrumb_part: :list
4
4
  ) %>
5
5
 
6
- <%= content_tag :ol, class: css_classes, data: merged_data, **html_options do %>
6
+ <%= content_tag :ol, class: css_classes.presence, data: merged_data, **html_options do %>
7
7
  <%= yield %>
8
8
  <% end %>
@@ -3,6 +3,6 @@
3
3
  breadcrumb_part: :page
4
4
  ) %>
5
5
 
6
- <%= content_tag :span, role: "link", aria: {current: "page", disabled: true}, class: css_classes, data: merged_data, **html_options do %>
6
+ <%= content_tag :span, role: "link", aria: {current: "page", disabled: true}, class: css_classes.presence, data: merged_data, **html_options do %>
7
7
  <%= yield %>
8
8
  <% end %>
@@ -6,8 +6,7 @@
6
6
  <li
7
7
  role="presentation"
8
8
  aria-hidden="true"
9
- class="<%= css_classes %>"
10
- <%= tag.attributes(data: merged_data, **html_options) %>
9
+ <%= tag.attributes(class: css_classes.presence, data: merged_data, **html_options) %>
11
10
  >
12
11
  <% if icon == :custom %>
13
12
  <%= yield %>
@@ -1,4 +1,4 @@
1
- <%# locals: (month:, year:, month_name:, css_classes: "", **html_options) %>
1
+ <%# locals: (month:, year:, month_name:, caption_layout: :label, years: nil, month_options: nil, css_classes: "", **html_options) %>
2
2
  <% merged_data = merge_component_data(html_options, "calendar-part": "header") %>
3
3
 
4
4
  <%= content_tag :div, class: css_classes.presence, data: merged_data, **html_options do %>
@@ -9,9 +9,33 @@
9
9
  <%= builtin_icon_for :chevron_left, class: "size-4" %>
10
10
  </button>
11
11
 
12
- <div data-calendar-part="caption">
13
- <%= month_name %>
14
- </div>
12
+ <% if caption_layout.to_sym == :dropdown %>
13
+ <div data-calendar-part="dropdowns">
14
+ <select data-component="select"
15
+ data-calendar-part="month-select"
16
+ data-calendar-target="monthSelect"
17
+ data-action="change->calendar#selectMonth"
18
+ aria-label="<%= t("maquina_components.calendar.month", default: "Month") %>">
19
+ <% month_options.each do |name, value, disabled| %>
20
+ <%= tag.option name, value: value, selected: value == month, disabled: disabled %>
21
+ <% end %>
22
+ </select>
23
+
24
+ <select data-component="select"
25
+ data-calendar-part="year-select"
26
+ data-calendar-target="yearSelect"
27
+ data-action="change->calendar#selectYear"
28
+ aria-label="<%= t("maquina_components.calendar.year", default: "Year") %>">
29
+ <% years.each do |value| %>
30
+ <%= tag.option value, value: value, selected: value == year %>
31
+ <% end %>
32
+ </select>
33
+ </div>
34
+ <% else %>
35
+ <div data-calendar-part="caption">
36
+ <%= month_name %>
37
+ </div>
38
+ <% end %>
15
39
 
16
40
  <button type="button"
17
41
  data-action="click->calendar#nextMonth"
@@ -3,8 +3,14 @@
3
3
 
4
4
  <%= content_tag :div, role: "row", class: css_classes.presence, data: merged_data, **html_options do %>
5
5
  <% days.each do |day| %>
6
+ <% is_outside = day.month != display_month %>
7
+ <%# A hidden outside day keeps its grid column, so the month's first day
8
+ still lands under the right weekday %>
9
+ <% if is_outside && !show_outside_days %>
10
+ <%= tag.span aria: {hidden: true}, data: {calendar_part: "outside-day"} %>
11
+ <% next %>
12
+ <% end %>
6
13
  <%
7
- is_outside = day.month != display_month
8
14
  is_today = day == Date.current
9
15
  is_selected = selected_date && day == selected_date
10
16
  is_range_end = selected_end_date && day == selected_end_date
@@ -24,9 +30,6 @@
24
30
  "selected"
25
31
  end
26
32
 
27
- # Skip rendering if outside day and not showing them
28
- next if is_outside && !show_outside_days
29
-
30
33
  day_data = {
31
34
  "calendar-part": "day",
32
35
  "calendar-target": "day",
@@ -1,7 +1,7 @@
1
1
  <%# locals: (spacing: :default, css_classes: "", **html_options) %>
2
2
  <% merged_data = merge_component_data(html_options,
3
3
  card_part: :content,
4
- spacing: (spacing == :full ? :full : nil)
4
+ spacing: (spacing.to_sym == :full ? :full : nil)
5
5
  ).compact %>
6
6
 
7
7
  <%= content_tag :div, class: css_classes.presence, data: merged_data, **html_options do %>
@@ -1,15 +1,8 @@
1
1
  <%# locals: (align: :start, spacing: :default, css_classes: "", **html_options) %>
2
- <% align_value = case align.to_sym
3
- when :between then :between
4
- when :end then :end
5
- when :center then :center
6
- else nil
7
- end
8
-
9
- merged_data = merge_component_data(html_options,
2
+ <% merged_data = merge_component_data(html_options,
10
3
  card_part: :footer,
11
- align: align_value,
12
- spacing: (spacing == :full ? :full : nil)
4
+ align: align.to_sym.presence_in(%i[between end center]),
5
+ spacing: (spacing.to_sym == :full ? :full : nil)
13
6
  ).compact %>
14
7
 
15
8
  <%= content_tag :div, class: css_classes.presence, data: merged_data, **html_options do %>
@@ -1,7 +1,7 @@
1
1
  <%# locals: (layout: :column, css_classes: "", **html_options) %>
2
2
  <% merged_data = merge_component_data(html_options,
3
3
  card_part: :header,
4
- layout: (layout == :row ? :row : nil)
4
+ layout: (layout.to_sym == :row ? :row : nil)
5
5
  ).compact %>
6
6
 
7
7
  <%= content_tag :div, class: css_classes.presence, data: merged_data, **html_options do %>
@@ -1,7 +1,7 @@
1
1
  <%# locals: (text: nil, content: nil, size: :default, css_classes: "", **html_options) %>
2
2
  <% merged_data = merge_component_data(html_options,
3
3
  card_part: :title,
4
- size: (size == :sm ? :sm : nil)
4
+ size: (size.to_sym == :sm ? :sm : nil)
5
5
  ).compact %>
6
6
 
7
7
  <%= content_tag :div, class: css_classes.presence, data: merged_data, **html_options do %>
@@ -17,8 +17,8 @@
17
17
  class: css_classes.presence,
18
18
  data: merged_data,
19
19
  **html_options do %>
20
- <span data-combobox-part="check" class="<%= 'invisible' unless selected %>">
20
+ <%= tag.span data: {combobox_part: "check"}, class: ("invisible" unless selected) do %>
21
21
  <%= builtin_icon_for :check, class: "size-4" %>
22
- </span>
22
+ <% end %>
23
23
  <%= yield %>
24
24
  <% end %>
@@ -1,10 +1,16 @@
1
- <%# locals: (show_icon: true, css_classes: "", **html_options) %>
2
- <% merged_data = merge_component_data(html_options,
1
+ <%# locals: (show_icon: true, variant: nil, size: nil, css_classes: "", **html_options) %>
2
+ <%
3
+ # Without variant: it is the drawer's icon button (drawer.css). With one it
4
+ # renders as a regular data-component="button" in that variant and size.
5
+ button_data = variant ? {component: :button, variant: variant, size: size} : {}
6
+ merged_data = merge_component_data(html_options,
7
+ **button_data,
3
8
  drawer_part: :close,
4
9
  action: "click->drawer#close"
5
- ) %>
6
- <%= content_tag :button, type: :button, class: css_classes, data: merged_data, **html_options do %>
7
- <% if show_icon %>
10
+ )
11
+ %>
12
+ <%= content_tag :button, type: :button, class: css_classes.presence, data: merged_data, **html_options do %>
13
+ <% if show_icon %>
8
14
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
9
15
  <path d="M18 6 6 18"></path>
10
16
  <path d="m6 6 12 12"></path>
@@ -2,6 +2,6 @@
2
2
  <% merged_data = merge_component_data(html_options,
3
3
  drawer_part: :content
4
4
  ) %>
5
- <%= content_tag :div, class: css_classes, data: merged_data, **html_options do %>
5
+ <%= content_tag :div, class: css_classes.presence, data: merged_data, **html_options do %>
6
6
  <%= yield %>
7
7
  <% end %>
@@ -2,6 +2,6 @@
2
2
  <% merged_data = merge_component_data(html_options,
3
3
  drawer_part: :footer
4
4
  ) %>
5
- <%= content_tag :div, class: css_classes, data: merged_data, **html_options do %>
5
+ <%= content_tag :div, class: css_classes.presence, data: merged_data, **html_options do %>
6
6
  <%= yield %>
7
7
  <% end %>
@@ -2,7 +2,7 @@
2
2
  <% merged_data = merge_component_data(html_options,
3
3
  drawer_part: :header
4
4
  ) %>
5
- <%= content_tag :div, class: css_classes, data: merged_data, **html_options do %>
5
+ <%= content_tag :div, class: css_classes.presence, data: merged_data, **html_options do %>
6
6
  <div data-drawer-part="header-content">
7
7
  <%= yield %>
8
8
  </div>
@@ -18,6 +18,6 @@
18
18
  action: "keydown.meta+#{keyboard_shortcut}@window->drawer#toggleWithKeyboard keydown.ctrl+#{keyboard_shortcut}@window->drawer#toggleWithKeyboard keydown.esc@window->drawer#closeOnEscape"
19
19
  )
20
20
  %>
21
- <%= content_tag :div, id: provider_id, class: css_classes, data: merged_data, **html_options do %>
21
+ <%= content_tag :div, id: provider_id, class: css_classes.presence, data: merged_data, **html_options do %>
22
22
  <%= yield %>
23
23
  <% end %>
@@ -23,9 +23,11 @@
23
23
  action: "click->drawer-trigger#triggerClick",
24
24
  drawer_trigger_drawer_outlet: drawer_selector
25
25
  )
26
- button_data = merged_data.merge(component: "button")
26
+ # The variant:/size: locals style the button. A caller's data: { variant: }
27
+ # (the pre-0.7.4 workaround) still wins so existing markup keeps its look.
28
+ button_data = {variant: variant, size: size}.merge(merged_data, component: "button")
27
29
  %>
28
- <%= content_tag :button, type: :button, class: css_classes, data: button_data, **html_options do %>
30
+ <%= content_tag :button, type: :button, class: css_classes.presence, data: button_data, **html_options do %>
29
31
  <%= icon_for(icon_name) if icon_name %>
30
32
  <%= yield %>
31
33
  <% end %>
@@ -1,12 +1,9 @@
1
1
  <%# locals: (css_classes: "", **html_options) %>
2
- <% sr_label = t("maquina_components.pagination.more_pages", default: "More pages") %>
2
+ <% sr_label = t("maquina_components.pagination.more_pages", default: "More pages")
3
+ merged_data = merge_component_data(html_options, "pagination-part": "ellipsis") %>
3
4
 
4
- <span
5
- class="<%= css_classes.presence %>"
6
- data-pagination-part="ellipsis"
7
- aria-hidden="true"
8
- <%= tag.attributes(html_options.except(:data)) %>
9
- >
5
+ <%# Only the glyph is hidden from assistive tech, so the label is announced. %>
6
+ <%= content_tag :span, class: css_classes.presence, data: merged_data, **html_options do %>
10
7
  <svg
11
8
  xmlns="http://www.w3.org/2000/svg"
12
9
  width="24"
@@ -25,4 +22,4 @@
25
22
  </svg>
26
23
 
27
24
  <span class="sr-only"><%= sr_label %></span>
28
- </span>
25
+ <% end %>
@@ -1,7 +1,7 @@
1
1
  <%# locals: (href:, active: false, disabled: false, css_classes: "", **html_options) %>
2
2
  <% merged_data = merge_component_data(html_options,
3
3
  "pagination-part": "link",
4
- active: active
4
+ active: (active ? true : nil)
5
5
  ) %>
6
6
 
7
7
  <% if disabled %>
@@ -4,12 +4,11 @@
4
4
  merged_data = merge_component_data(html_options, "pagination-part": "next") %>
5
5
 
6
6
  <% if is_disabled %>
7
- <span
8
- class="<%= css_classes.presence %>"
9
- data-pagination-part="next"
10
- aria-disabled="true"
11
- <%= tag.attributes(html_options.except(:data)) %>
12
- >
7
+ <%= content_tag :span,
8
+ class: css_classes.presence,
9
+ data: merged_data,
10
+ "aria-disabled": "true",
11
+ **html_options do %>
13
12
  <% if show_label %>
14
13
  <span><%= display_label %></span>
15
14
  <% end %>
@@ -28,7 +27,7 @@
28
27
  >
29
28
  <path d="m9 18 6-6-6-6" />
30
29
  </svg>
31
- </span>
30
+ <% end %>
32
31
  <% else %>
33
32
  <%= link_to href,
34
33
  class: css_classes.presence,
@@ -4,12 +4,11 @@
4
4
  merged_data = merge_component_data(html_options, "pagination-part": "previous") %>
5
5
 
6
6
  <% if is_disabled %>
7
- <span
8
- class="<%= css_classes.presence %>"
9
- data-pagination-part="previous"
10
- aria-disabled="true"
11
- <%= tag.attributes(html_options.except(:data)) %>
12
- >
7
+ <%= content_tag :span,
8
+ class: css_classes.presence,
9
+ data: merged_data,
10
+ "aria-disabled": "true",
11
+ **html_options do %>
13
12
  <svg
14
13
  xmlns="http://www.w3.org/2000/svg"
15
14
  width="24"
@@ -28,7 +27,7 @@
28
27
  <% if show_label %>
29
28
  <span><%= display_label %></span>
30
29
  <% end %>
31
- </span>
30
+ <% end %>
32
31
  <% else %>
33
32
  <%= link_to href,
34
33
  class: css_classes.presence,
@@ -3,6 +3,6 @@
3
3
  sidebar_part: :content
4
4
  ) %>
5
5
 
6
- <%= content_tag :div, class: css_classes, data: merged_data, **html_options do %>
6
+ <%= content_tag :div, class: css_classes.presence, data: merged_data, **html_options do %>
7
7
  <%= yield %>
8
8
  <% end %>
@@ -3,6 +3,6 @@
3
3
  sidebar_part: :footer
4
4
  ) %>
5
5
 
6
- <%= content_tag :div, class: css_classes, data: merged_data, **html_options do %>
6
+ <%= content_tag :div, class: css_classes.presence, data: merged_data, **html_options do %>
7
7
  <%= yield %>
8
8
  <% end %>
@@ -3,7 +3,7 @@
3
3
  sidebar_part: :group
4
4
  ) %>
5
5
 
6
- <%= content_tag :div, class: css_classes, data: merged_data, **html_options do %>
6
+ <%= content_tag :div, class: css_classes.presence, data: merged_data, **html_options do %>
7
7
  <% if title.present? %>
8
8
  <div data-sidebar-part="group-label"><%= title %></div>
9
9
  <% end %>
@@ -3,6 +3,6 @@
3
3
  sidebar_part: :header
4
4
  ) %>
5
5
 
6
- <%= content_tag :div, class: css_classes, data: merged_data, **html_options do %>
6
+ <%= content_tag :div, class: css_classes.presence, data: merged_data, **html_options do %>
7
7
  <%= yield %>
8
8
  <% end %>
@@ -3,6 +3,6 @@
3
3
  sidebar_part: :inset
4
4
  ) %>
5
5
 
6
- <%= content_tag :main, class: css_classes, data: merged_data, **html_options do %>
6
+ <%= content_tag :main, class: css_classes.presence, data: merged_data, **html_options do %>
7
7
  <%= yield %>
8
8
  <% end %>
@@ -3,6 +3,6 @@
3
3
  sidebar_part: :menu
4
4
  ) %>
5
5
 
6
- <%= content_tag :ul, class: css_classes, data: merged_data, **html_options do %>
6
+ <%= content_tag :ul, class: css_classes.presence, data: merged_data, **html_options do %>
7
7
  <%= yield %>
8
8
  <% end %>
@@ -5,7 +5,7 @@
5
5
  active: (active ? true : nil)
6
6
  ) %>
7
7
 
8
- <%= link_to url, class: css_classes, data: merged_data,
8
+ <%= link_to url, class: css_classes.presence, data: merged_data,
9
9
  "aria-current": (active ? "page" : nil), **html_options do %>
10
10
  <% if icon_name.present? %>
11
11
  <%= icon_for(icon_name) %>
@@ -2,6 +2,6 @@
2
2
  <% merged_data =
3
3
  merge_component_data(html_options, sidebar_part: "menu-item") %>
4
4
 
5
- <%= content_tag :li, class: "group/menu-item #{css_classes}", data: merged_data, **html_options do %>
5
+ <%= content_tag :li, class: class_names("group/menu-item", css_classes), data: merged_data, **html_options do %>
6
6
  <%= yield %>
7
7
  <% end %>
@@ -4,14 +4,14 @@
4
4
  active: (active ? true : nil)
5
5
  ) %>
6
6
 
7
- <%= link_to url, class: css_classes, data: merged_data,
7
+ <%= link_to url, class: css_classes.presence, data: merged_data,
8
8
  "aria-current": (active ? "page" : nil), **html_options do %>
9
9
  <% if icon.present? || text_icon.present? %>
10
10
  <div data-sidebar-part="menu-avatar">
11
11
  <% if icon.present? %>
12
- <%= image_tag icon, class: icon_classes %>
12
+ <%= image_tag icon, class: icon_classes.presence %>
13
13
  <% elsif text_icon.present? %>
14
- <span class="<%= icon_classes %>"><%= text_icon %></span>
14
+ <%= tag.span text_icon, class: icon_classes.presence %>
15
15
  <% end %>
16
16
  </div>
17
17
  <% end %>
@@ -11,6 +11,6 @@
11
11
  action: "keydown.meta+#{keyboard_shortcut}@window->sidebar#toggleWithKeyboard keydown.ctrl+#{keyboard_shortcut}@window->sidebar#toggleWithKeyboard"
12
12
  ) %>
13
13
 
14
- <%= content_tag :div, id: id || "sidebar-provider", class: css_classes, data: merged_data, **html_options do %>
14
+ <%= content_tag :div, id: id || "sidebar-provider", class: css_classes.presence, data: merged_data, **html_options do %>
15
15
  <%= yield %>
16
16
  <% end %>
@@ -6,7 +6,7 @@
6
6
  sidebar_trigger_sidebar_outlet: "[data-outlet='sidebar']"
7
7
  ) %>
8
8
 
9
- <%= button_tag type: :button, class: css_classes, data: merged_data, **html_options do %>
9
+ <%= button_tag type: :button, class: css_classes.presence, data: merged_data, **html_options do %>
10
10
  <%= icon_for(icon_name) %>
11
11
  <span class="sr-only">Toggle Sidebar</span>
12
12
  <% end %>
@@ -5,8 +5,9 @@
5
5
  icon_classes = icon_classes.presence || icon_class
6
6
  value_classes = value_classes.presence || value_class
7
7
 
8
- # Legacy string icon names map to built-in icons; symbols pass straight
9
- # through; anything else renders as custom icon markup.
8
+ # Symbols resolve through icon_for (app icons first, then built-ins);
9
+ # legacy kebab-case strings map to built-in names; anything else renders
10
+ # as custom icon markup.
10
11
  legacy_icons = {
11
12
  "message-square" => :message_square,
12
13
  "arrow-up" => :arrow_up,
@@ -25,16 +26,16 @@
25
26
  <div data-stats-part="body">
26
27
  <div data-stats-part="text">
27
28
  <p data-stats-part="title"><%= title %></p>
28
- <p data-stats-part="value" class="<%= value_classes.presence %>"><%= value %></p>
29
+ <%= tag.p value, class: value_classes.presence, data: {stats_part: "value"} %>
29
30
  <% if subtitle.present? %>
30
31
  <p data-stats-part="subtitle"><%= subtitle %></p>
31
32
  <% end %>
32
33
  </div>
33
34
 
34
35
  <% if icon.present? %>
35
- <div data-stats-part="icon" class="<%= icon_classes.presence %>">
36
- <%= icon_name ? builtin_icon_for(icon_name, class: "size-8") : icon %>
37
- </div>
36
+ <%= tag.div class: icon_classes.presence, data: {stats_part: "icon"} do %>
37
+ <%= icon_name ? icon_for(icon_name, class: "size-8") : icon %>
38
+ <% end %>
38
39
  <% end %>
39
40
  </div>
40
41
  <% end %>
@@ -1,6 +1,7 @@
1
1
  <%# locals: (label:, href: nil, method: nil, css_classes: "", **html_options) %>
2
2
  <% merged_data = merge_component_data(html_options,
3
- toast_part: "action"
3
+ toast_part: "action",
4
+ action: ("toast#handleAction" if href.blank?)
4
5
  ) %>
5
6
 
6
7
  <% merged_data["turbo-method"] = method if method.present? %>
@@ -155,6 +155,17 @@
155
155
  --color-destructive: var(--destructive);
156
156
  --color-destructive-foreground: var(--destructive-foreground);
157
157
 
158
+ --color-success: var(--success);
159
+ --color-success-foreground: var(--success-foreground);
160
+
161
+ --color-warning: var(--warning);
162
+ --color-warning-foreground: var(--warning-foreground);
163
+
164
+ /* --info and --info-foreground are declared in the shape/state token block
165
+ the installer appends below this palette. */
166
+ --color-info: var(--info);
167
+ --color-info-foreground: var(--info-foreground);
168
+
158
169
  --color-input: var(--input);
159
170
  --color-border: var(--border);
160
171
  --color-ring: var(--ring);
@@ -1,3 +1,3 @@
1
1
  module MaquinaComponents
2
- VERSION = "0.7.3"
2
+ VERSION = "0.8.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maquina-components
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.3
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mario Alberto Chávez