maquina-components 0.4.1 → 0.4.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.
- checksums.yaml +4 -4
- data/app/helpers/maquina_components/icons_helper.rb +22 -5
- data/app/views/components/_date_picker.html.erb +1 -1
- data/app/views/components/_menu_button.html.erb +1 -1
- data/app/views/components/_toast.html.erb +2 -2
- data/app/views/components/breadcrumbs/_ellipsis.html.erb +1 -1
- data/app/views/components/calendar/_header.html.erb +2 -2
- data/app/views/components/combobox/_input.html.erb +1 -1
- data/app/views/components/combobox/_option.html.erb +1 -1
- data/app/views/components/combobox/_trigger.html.erb +1 -1
- data/app/views/components/dropdown_menu/_trigger.html.erb +1 -1
- data/lib/maquina_components/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 55a2ec2879afb8976c7b668873da307a50d2a2798e003399dbc8c2d4d9779471
|
|
4
|
+
data.tar.gz: 2db272ca8f735467c06d2f37b133fb7da4156d9662b85cb19ec93ac9d84078f7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 719870f407619f1f4fe5714db8e77af06db45ae3272a58784f647c4280b8ef78d0c1e805e95b58ccdd2f439392652f1483f054c421b093621472bac8cfc34de9
|
|
7
|
+
data.tar.gz: 4bc447930b1e71135ef1012455d82a78de7be2483ba17fae25185239a459185b0ed29278ac49bc40c086ade7a8ed2bbc0bd248f4cce8505a26897c273e96246f
|
|
@@ -3,11 +3,31 @@ module MaquinaComponents
|
|
|
3
3
|
def icon_for(name, options = {})
|
|
4
4
|
return nil unless name
|
|
5
5
|
|
|
6
|
-
svg =
|
|
6
|
+
svg = main_icon_svg_for(name.to_sym) || icon_svg_for(name.to_sym)
|
|
7
7
|
return nil unless svg
|
|
8
8
|
|
|
9
|
+
apply_icon_options(svg, options)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# Internal icon helper for engine components. Always uses built-in SVGs
|
|
13
|
+
# so components work reliably regardless of the app's icon configuration.
|
|
14
|
+
def builtin_icon_for(name, options = {})
|
|
15
|
+
return nil unless name
|
|
16
|
+
|
|
17
|
+
svg = icon_svg_for(name.to_sym)
|
|
18
|
+
return nil unless svg
|
|
19
|
+
|
|
20
|
+
apply_icon_options(svg, options)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def main_icon_svg_for(name)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
private
|
|
27
|
+
|
|
28
|
+
def apply_icon_options(svg, options)
|
|
9
29
|
css_classes = options[:class]
|
|
10
|
-
svg = svg.gsub('class="', "class=\"#{css_classes} ")
|
|
30
|
+
svg = svg.gsub('class="', "class=\"#{css_classes} ") if css_classes
|
|
11
31
|
|
|
12
32
|
if options[:stroke_width]
|
|
13
33
|
svg = svg.gsub('stroke-width="2"', "stroke-width=\"#{options[:stroke_width]}\"")
|
|
@@ -16,9 +36,6 @@ module MaquinaComponents
|
|
|
16
36
|
svg.html_safe
|
|
17
37
|
end
|
|
18
38
|
|
|
19
|
-
def main_icon_svg_for(name)
|
|
20
|
-
end
|
|
21
|
-
|
|
22
39
|
def icon_svg_for(name)
|
|
23
40
|
case name
|
|
24
41
|
when :dollar
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
<%= "disabled" if disabled %>
|
|
69
69
|
aria-haspopup="dialog"
|
|
70
70
|
aria-expanded="false">
|
|
71
|
-
<%=
|
|
71
|
+
<%= builtin_icon_for :calendar, class: "size-4" %>
|
|
72
72
|
<span data-date-picker-target="display">
|
|
73
73
|
<%= display_value || placeholder || default_placeholder %>
|
|
74
74
|
</span>
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
**html_options do %>
|
|
27
27
|
<% if toast_icon %>
|
|
28
28
|
<div data-toast-part="icon">
|
|
29
|
-
<%=
|
|
29
|
+
<%= builtin_icon_for toast_icon, class: "size-5" %>
|
|
30
30
|
</div>
|
|
31
31
|
<% end %>
|
|
32
32
|
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
data-toast-part="close"
|
|
48
48
|
data-action="toast#dismiss"
|
|
49
49
|
aria-label="Dismiss notification">
|
|
50
|
-
<%=
|
|
50
|
+
<%= builtin_icon_for :x, class: "size-4" %>
|
|
51
51
|
</button>
|
|
52
52
|
<% end %>
|
|
53
53
|
<% end %>
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
data-action="click->calendar#previousMonth"
|
|
7
7
|
data-calendar-target="prevButton"
|
|
8
8
|
aria-label="Previous month">
|
|
9
|
-
<%=
|
|
9
|
+
<%= builtin_icon_for :chevron_left, class: "size-4" %>
|
|
10
10
|
</button>
|
|
11
11
|
|
|
12
12
|
<div data-calendar-part="caption">
|
|
@@ -17,6 +17,6 @@
|
|
|
17
17
|
data-action="click->calendar#nextMonth"
|
|
18
18
|
data-calendar-target="nextButton"
|
|
19
19
|
aria-label="Next month">
|
|
20
|
-
<%=
|
|
20
|
+
<%= builtin_icon_for :chevron_right, class: "size-4" %>
|
|
21
21
|
</button>
|
|
22
22
|
<% end %>
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
) %>
|
|
7
7
|
|
|
8
8
|
<div data-combobox-part="input-wrapper">
|
|
9
|
-
<%=
|
|
9
|
+
<%= builtin_icon_for :search, class: "size-4 shrink-0 opacity-50" %>
|
|
10
10
|
<%= tag.input type: "text",
|
|
11
11
|
placeholder: placeholder,
|
|
12
12
|
autocomplete: "off",
|
|
@@ -18,5 +18,5 @@
|
|
|
18
18
|
data: merged_data,
|
|
19
19
|
**html_options do %>
|
|
20
20
|
<span data-combobox-target="label"><%= placeholder %></span>
|
|
21
|
-
<%=
|
|
21
|
+
<%= builtin_icon_for :chevrons_up_down, class: "size-4 shrink-0 opacity-50" %>
|
|
22
22
|
<% end %>
|
|
@@ -19,6 +19,6 @@
|
|
|
19
19
|
aria: { haspopup: "menu", expanded: "false" },
|
|
20
20
|
**html_options do %>
|
|
21
21
|
<%= yield %>
|
|
22
|
-
<%=
|
|
22
|
+
<%= builtin_icon_for :chevron_down, data: { "dropdown-menu-target": "chevron" } %>
|
|
23
23
|
<% end %>
|
|
24
24
|
<% end %>
|