maquina-components 0.1.2 → 0.2.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.
- checksums.yaml +4 -4
- data/README.md +349 -138
- data/app/assets/images/maquina.svg +1 -0
- data/app/assets/stylesheets/alert.css +143 -0
- data/app/assets/stylesheets/badge.css +145 -0
- data/app/assets/stylesheets/breadcrumbs.css +163 -0
- data/app/assets/stylesheets/card.css +128 -0
- data/app/assets/stylesheets/dropdown_menu.css +248 -0
- data/app/assets/stylesheets/empty.css +133 -0
- data/app/assets/stylesheets/form.css +617 -0
- data/app/assets/stylesheets/header.css +61 -0
- data/app/assets/stylesheets/maquina_components.css +143 -64
- data/app/assets/stylesheets/pagination.css +154 -0
- data/app/assets/stylesheets/sidebar.css +477 -0
- data/app/assets/stylesheets/table.css +205 -0
- data/app/assets/stylesheets/toggle_group.css +151 -0
- data/app/assets/tailwind/maquina_components_engine/engine.css +16 -0
- data/app/helpers/maquina_components/breadcrumbs_helper.rb +118 -0
- data/app/helpers/maquina_components/dropdown_menu_helper.rb +249 -0
- data/app/helpers/maquina_components/empty_helper.rb +102 -0
- data/app/helpers/{components → maquina_components}/icons_helper.rb +40 -3
- data/app/helpers/maquina_components/pagination_helper.rb +153 -0
- data/app/helpers/maquina_components/sidebar_helper.rb +63 -0
- data/app/helpers/maquina_components/table_helper.rb +144 -0
- data/app/helpers/maquina_components/toggle_group_helper.rb +172 -0
- data/app/javascript/controllers/breadcrumb_controller.js +71 -0
- data/app/javascript/controllers/dropdown_menu_controller.js +203 -0
- data/app/javascript/controllers/menu_button_controller.js +59 -0
- data/app/javascript/controllers/sidebar_controller.js +316 -0
- data/app/javascript/controllers/sidebar_trigger_controller.js +32 -0
- data/app/javascript/controllers/toggle_group_controller.js +178 -0
- data/app/views/components/_alert.html.erb +11 -10
- data/app/views/components/_badge.html.erb +10 -0
- data/app/views/components/_breadcrumbs.html.erb +16 -0
- data/app/views/components/_card.html.erb +4 -8
- data/app/views/components/_dropdown.html.erb +25 -0
- data/app/views/components/_dropdown_menu.html.erb +9 -0
- data/app/views/components/_empty.html.erb +10 -0
- data/app/views/components/_header.html.erb +8 -0
- data/app/views/components/_menu_button.html.erb +44 -0
- data/app/views/components/_pagination.html.erb +12 -33
- data/app/views/components/_separator.html.erb +11 -0
- data/app/views/components/_sidebar.html.erb +30 -20
- data/app/views/components/_simple_table.html.erb +49 -0
- data/app/views/components/_table.html.erb +21 -0
- data/app/views/components/_toggle_group.html.erb +24 -0
- data/app/views/components/alert/_description.html.erb +6 -0
- data/app/views/components/alert/_title.html.erb +6 -0
- data/app/views/components/breadcrumbs/_ellipsis.html.erb +9 -0
- data/app/views/components/breadcrumbs/_item.html.erb +8 -0
- data/app/views/components/breadcrumbs/_link.html.erb +8 -0
- data/app/views/components/breadcrumbs/_list.html.erb +8 -0
- data/app/views/components/breadcrumbs/_page.html.erb +8 -0
- data/app/views/components/breadcrumbs/_separator.html.erb +17 -0
- data/app/views/components/card/_action.html.erb +6 -0
- data/app/views/components/card/_content.html.erb +9 -0
- data/app/views/components/card/_description.html.erb +6 -0
- data/app/views/components/card/_footer.html.erb +17 -0
- data/app/views/components/card/_header.html.erb +9 -0
- data/app/views/components/card/_title.html.erb +9 -0
- data/app/views/components/dropdown_menu/_content.html.erb +20 -0
- data/app/views/components/dropdown_menu/_group.html.erb +12 -0
- data/app/views/components/dropdown_menu/_item.html.erb +29 -0
- data/app/views/components/dropdown_menu/_label.html.erb +13 -0
- data/app/views/components/dropdown_menu/_separator.html.erb +11 -0
- data/app/views/components/dropdown_menu/_shortcut.html.erb +12 -0
- data/app/views/components/dropdown_menu/_trigger.html.erb +24 -0
- data/app/views/components/empty/_content.html.erb +8 -0
- data/app/views/components/empty/_description.html.erb +12 -0
- data/app/views/components/empty/_header.html.erb +8 -0
- data/app/views/components/empty/_media.html.erb +13 -0
- data/app/views/components/empty/_title.html.erb +12 -0
- data/app/views/components/pagination/_content.html.erb +8 -0
- data/app/views/components/pagination/_ellipsis.html.erb +28 -0
- data/app/views/components/pagination/_item.html.erb +8 -0
- data/app/views/components/pagination/_link.html.erb +23 -0
- data/app/views/components/pagination/_next.html.erb +57 -0
- data/app/views/components/pagination/_previous.html.erb +57 -0
- data/app/views/components/sidebar/_content.html.erb +8 -0
- data/app/views/components/sidebar/_footer.html.erb +8 -0
- data/app/views/components/sidebar/_group.html.erb +12 -0
- data/app/views/components/sidebar/_header.html.erb +8 -0
- data/app/views/components/sidebar/_inset.html.erb +8 -0
- data/app/views/components/sidebar/_menu.html.erb +8 -0
- data/app/views/components/sidebar/_menu_button.html.erb +14 -0
- data/app/views/components/sidebar/_menu_item.html.erb +7 -0
- data/app/views/components/sidebar/_menu_link.html.erb +32 -0
- data/app/views/components/sidebar/_provider.html.erb +16 -0
- data/app/views/components/sidebar/_trigger.html.erb +12 -0
- data/app/views/components/stats/_stats_card.html.erb +100 -0
- data/app/views/components/stats/_stats_grid.html.erb +38 -0
- data/app/views/components/table/_body.html.erb +5 -0
- data/app/views/components/table/_caption.html.erb +5 -0
- data/app/views/components/table/_cell.html.erb +5 -0
- data/app/views/components/table/_footer.html.erb +5 -0
- data/app/views/components/table/_head.html.erb +8 -0
- data/app/views/components/table/_header.html.erb +8 -0
- data/app/views/components/table/_row.html.erb +8 -0
- data/app/views/components/toggle_group/_item.html.erb +19 -0
- data/config/importmap.rb +1 -0
- data/lib/generators/maquina_components/install/USAGE +39 -0
- data/lib/generators/maquina_components/install/install_generator.rb +123 -0
- data/lib/generators/maquina_components/install/templates/maquina_components_helper.rb.tt +68 -0
- data/lib/generators/maquina_components/install/templates/theme.css.tt +179 -0
- data/lib/maquina_components/engine.rb +10 -0
- data/lib/maquina_components/version.rb +1 -1
- metadata +116 -12
- data/app/helpers/components/pagination_helper.rb +0 -15
- data/app/views/components/_card_content.html.erb +0 -5
- data/app/views/components/_card_header.html.erb +0 -8
- data/app/views/components/_sidebar_content.html.erb +0 -8
- data/app/views/components/_sidebar_group.html.erb +0 -42
- data/app/views/components/_sidebar_header.html.erb +0 -3
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<%# locals: (spacing: :default, css_classes: "", **html_options) %>
|
|
2
|
+
<% merged_data = (html_options.delete(:data) || {}).merge(
|
|
3
|
+
card_part: :content,
|
|
4
|
+
spacing: (spacing == :full ? :full : nil)
|
|
5
|
+
).compact %>
|
|
6
|
+
|
|
7
|
+
<%= content_tag :div, class: css_classes.presence, data: merged_data, **html_options do %>
|
|
8
|
+
<%= yield %>
|
|
9
|
+
<% end %>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<%# locals: (text: nil, css_classes: "", **html_options) %>
|
|
2
|
+
<% merged_data = (html_options.delete(:data) || {}).merge(card_part: :description) %>
|
|
3
|
+
|
|
4
|
+
<%= content_tag :div, class: css_classes.presence, data: merged_data, **html_options do %>
|
|
5
|
+
<%= text || yield %>
|
|
6
|
+
<% end %>
|
|
@@ -0,0 +1,17 @@
|
|
|
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 = (html_options.delete(:data) || {}).merge(
|
|
10
|
+
card_part: :footer,
|
|
11
|
+
align: align_value,
|
|
12
|
+
spacing: (spacing == :full ? :full : nil)
|
|
13
|
+
).compact %>
|
|
14
|
+
|
|
15
|
+
<%= content_tag :div, class: css_classes.presence, data: merged_data, **html_options do %>
|
|
16
|
+
<%= yield %>
|
|
17
|
+
<% end %>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<%# locals: (layout: :column, css_classes: "", **html_options) %>
|
|
2
|
+
<% merged_data = (html_options.delete(:data) || {}).merge(
|
|
3
|
+
card_part: :header,
|
|
4
|
+
layout: (layout == :row ? :row : nil)
|
|
5
|
+
).compact %>
|
|
6
|
+
|
|
7
|
+
<%= content_tag :div, class: css_classes.presence, data: merged_data, **html_options do %>
|
|
8
|
+
<%= yield %>
|
|
9
|
+
<% end %>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<%# locals: (text: nil, size: :default, css_classes: "", **html_options) %>
|
|
2
|
+
<% merged_data = (html_options.delete(:data) || {}).merge(
|
|
3
|
+
card_part: :title,
|
|
4
|
+
size: (size == :sm ? :sm : nil)
|
|
5
|
+
).compact %>
|
|
6
|
+
|
|
7
|
+
<%= content_tag :div, class: css_classes.presence, data: merged_data, **html_options do %>
|
|
8
|
+
<%= text || yield %>
|
|
9
|
+
<% end %>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<%# locals: (align: :start, side: :bottom, width: :default, css_classes: "", **html_options) %>
|
|
2
|
+
<% merged_data = (html_options.delete(:data) || {}).merge(
|
|
3
|
+
"dropdown-menu-part": "content",
|
|
4
|
+
"dropdown-menu-target": "content",
|
|
5
|
+
align: align,
|
|
6
|
+
side: side,
|
|
7
|
+
width: width,
|
|
8
|
+
state: "closed"
|
|
9
|
+
) %>
|
|
10
|
+
|
|
11
|
+
<%= content_tag :div,
|
|
12
|
+
role: "menu",
|
|
13
|
+
aria: { orientation: "vertical" },
|
|
14
|
+
tabindex: "-1",
|
|
15
|
+
class: css_classes.presence,
|
|
16
|
+
data: merged_data,
|
|
17
|
+
hidden: true,
|
|
18
|
+
**html_options do %>
|
|
19
|
+
<%= yield %>
|
|
20
|
+
<% end %>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<%# locals: (css_classes: "", **html_options) %>
|
|
2
|
+
<% merged_data = (html_options.delete(:data) || {}).merge(
|
|
3
|
+
"dropdown-menu-part": "group"
|
|
4
|
+
) %>
|
|
5
|
+
|
|
6
|
+
<%= content_tag :div,
|
|
7
|
+
role: "group",
|
|
8
|
+
class: css_classes.presence,
|
|
9
|
+
data: merged_data,
|
|
10
|
+
**html_options do %>
|
|
11
|
+
<%= yield %>
|
|
12
|
+
<% end %>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<%# locals: (href: nil, method: nil, variant: :default, disabled: false, css_classes: "", **html_options) %>
|
|
2
|
+
<% merged_data = (html_options.delete(:data) || {}).merge(
|
|
3
|
+
"dropdown-menu-part": "item",
|
|
4
|
+
variant: variant
|
|
5
|
+
) %>
|
|
6
|
+
|
|
7
|
+
<% merged_data["turbo-method"] = method if method.present? %>
|
|
8
|
+
|
|
9
|
+
<% aria_attrs = {} %>
|
|
10
|
+
<% aria_attrs[:disabled] = "true" if disabled %>
|
|
11
|
+
|
|
12
|
+
<% tag_name = href.present? ? :a : :button %>
|
|
13
|
+
|
|
14
|
+
<% tag_options = {
|
|
15
|
+
role: "menuitem",
|
|
16
|
+
tabindex: "-1",
|
|
17
|
+
class: css_classes.presence,
|
|
18
|
+
data: merged_data,
|
|
19
|
+
aria: aria_attrs.presence,
|
|
20
|
+
disabled: (disabled unless href.present?),
|
|
21
|
+
**html_options
|
|
22
|
+
} %>
|
|
23
|
+
|
|
24
|
+
<% tag_options[:href] = href if href.present? %>
|
|
25
|
+
<% tag_options[:type] = "button" if tag_name == :button %>
|
|
26
|
+
|
|
27
|
+
<%= content_tag tag_name, **tag_options.compact do %>
|
|
28
|
+
<%= yield %>
|
|
29
|
+
<% end %>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<%# locals: (text: nil, inset: false, css_classes: "", **html_options) %>
|
|
2
|
+
<% merged_data = (html_options.delete(:data) || {}).merge(
|
|
3
|
+
"dropdown-menu-part": "label",
|
|
4
|
+
inset: inset
|
|
5
|
+
) %>
|
|
6
|
+
|
|
7
|
+
<%= content_tag :div, class: css_classes.presence, data: merged_data, **html_options do %>
|
|
8
|
+
<% if text.present? %>
|
|
9
|
+
<%= text %>
|
|
10
|
+
<% else %>
|
|
11
|
+
<%= yield %>
|
|
12
|
+
<% end %>
|
|
13
|
+
<% end %>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<%# locals: (css_classes: "", **html_options) %>
|
|
2
|
+
<% merged_data = (html_options.delete(:data) || {}).merge(
|
|
3
|
+
"dropdown-menu-part": "separator"
|
|
4
|
+
) %>
|
|
5
|
+
|
|
6
|
+
<%= content_tag :div, nil,
|
|
7
|
+
role: "separator",
|
|
8
|
+
aria: { orientation: "horizontal" },
|
|
9
|
+
class: css_classes.presence,
|
|
10
|
+
data: merged_data,
|
|
11
|
+
**html_options %>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<%# locals: (text: nil, css_classes: "", **html_options) %>
|
|
2
|
+
<% merged_data = (html_options.delete(:data) || {}).merge(
|
|
3
|
+
"dropdown-menu-part": "shortcut"
|
|
4
|
+
) %>
|
|
5
|
+
|
|
6
|
+
<%= content_tag :span, class: css_classes.presence, data: merged_data, **html_options do %>
|
|
7
|
+
<% if text.present? %>
|
|
8
|
+
<%= text %>
|
|
9
|
+
<% else %>
|
|
10
|
+
<%= yield %>
|
|
11
|
+
<% end %>
|
|
12
|
+
<% end %>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<%# locals: (variant: :outline, size: :default, as_child: false, css_classes: "", **html_options) %>
|
|
2
|
+
<% merged_data = (html_options.delete(:data) || {}).merge(
|
|
3
|
+
"dropdown-menu-target": "trigger",
|
|
4
|
+
action: "dropdown-menu#toggle"
|
|
5
|
+
) %>
|
|
6
|
+
|
|
7
|
+
<% if as_child %>
|
|
8
|
+
<%= yield %>
|
|
9
|
+
<% else %>
|
|
10
|
+
<% button_data = merged_data.merge(
|
|
11
|
+
component: "button",
|
|
12
|
+
variant: variant,
|
|
13
|
+
size: size
|
|
14
|
+
) %>
|
|
15
|
+
<%= content_tag :button,
|
|
16
|
+
type: "button",
|
|
17
|
+
class: css_classes.presence,
|
|
18
|
+
data: button_data,
|
|
19
|
+
aria: { haspopup: "menu", expanded: "false" },
|
|
20
|
+
**html_options do %>
|
|
21
|
+
<%= yield %>
|
|
22
|
+
<%= icon_for :chevron_down, data: { "dropdown-menu-target": "chevron" } %>
|
|
23
|
+
<% end %>
|
|
24
|
+
<% end %>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<%# locals: (text: nil, css_classes: "", **html_options) %>
|
|
2
|
+
<% merged_data = (html_options.delete(:data) || {}).merge(
|
|
3
|
+
"empty-part": "description"
|
|
4
|
+
) %>
|
|
5
|
+
|
|
6
|
+
<%= content_tag :p, class: css_classes.presence, data: merged_data, **html_options do %>
|
|
7
|
+
<% if text.present? %>
|
|
8
|
+
<%= text %>
|
|
9
|
+
<% else %>
|
|
10
|
+
<%= yield %>
|
|
11
|
+
<% end %>
|
|
12
|
+
<% end %>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<%# locals: (icon: nil, variant: :icon, css_classes: "", **html_options) %>
|
|
2
|
+
<% merged_data = (html_options.delete(:data) || {}).merge(
|
|
3
|
+
"empty-part": "media",
|
|
4
|
+
variant: variant
|
|
5
|
+
) %>
|
|
6
|
+
|
|
7
|
+
<%= content_tag :div, class: css_classes.presence, data: merged_data, **html_options do %>
|
|
8
|
+
<% if icon.present? && respond_to?(:icon_for) %>
|
|
9
|
+
<%= icon_for(icon) %>
|
|
10
|
+
<% elsif block_given? %>
|
|
11
|
+
<%= yield %>
|
|
12
|
+
<% end %>
|
|
13
|
+
<% end %>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<%# locals: (text: nil, css_classes: "", **html_options) %>
|
|
2
|
+
<% merged_data = (html_options.delete(:data) || {}).merge(
|
|
3
|
+
"empty-part": "title"
|
|
4
|
+
) %>
|
|
5
|
+
|
|
6
|
+
<%= content_tag :h3, class: css_classes.presence, data: merged_data, **html_options do %>
|
|
7
|
+
<% if text.present? %>
|
|
8
|
+
<%= text %>
|
|
9
|
+
<% else %>
|
|
10
|
+
<%= yield %>
|
|
11
|
+
<% end %>
|
|
12
|
+
<% end %>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<%# locals: (css_classes: "", **html_options) %>
|
|
2
|
+
<% merged_data = (html_options.delete(:data) || {}).merge(
|
|
3
|
+
"pagination-part": "content"
|
|
4
|
+
) %>
|
|
5
|
+
|
|
6
|
+
<%= content_tag :ul, class: css_classes.presence, data: merged_data, **html_options do %>
|
|
7
|
+
<%= yield %>
|
|
8
|
+
<% end %>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<%# locals: (css_classes: "", **html_options) %>
|
|
2
|
+
<% sr_label = t("maquina_components.pagination.more_pages", default: "More pages") %>
|
|
3
|
+
|
|
4
|
+
<span
|
|
5
|
+
class="<%= css_classes.presence %>"
|
|
6
|
+
data-pagination-part="ellipsis"
|
|
7
|
+
aria-hidden="true"
|
|
8
|
+
<%= tag.attributes(html_options.except(:data)) %>
|
|
9
|
+
>
|
|
10
|
+
<svg
|
|
11
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
12
|
+
width="24"
|
|
13
|
+
height="24"
|
|
14
|
+
viewBox="0 0 24 24"
|
|
15
|
+
fill="none"
|
|
16
|
+
stroke="currentColor"
|
|
17
|
+
stroke-width="2"
|
|
18
|
+
stroke-linecap="round"
|
|
19
|
+
stroke-linejoin="round"
|
|
20
|
+
aria-hidden="true"
|
|
21
|
+
>
|
|
22
|
+
<circle cx="12" cy="12" r="1" />
|
|
23
|
+
<circle cx="19" cy="12" r="1" />
|
|
24
|
+
<circle cx="5" cy="12" r="1" />
|
|
25
|
+
</svg>
|
|
26
|
+
|
|
27
|
+
<span class="sr-only"><%= sr_label %></span>
|
|
28
|
+
</span>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<%# locals: (href:, active: false, disabled: false, css_classes: "", **html_options) %>
|
|
2
|
+
<% merged_data = (html_options.delete(:data) || {}).merge(
|
|
3
|
+
"pagination-part": "link",
|
|
4
|
+
active: active
|
|
5
|
+
) %>
|
|
6
|
+
|
|
7
|
+
<% if disabled %>
|
|
8
|
+
<%= content_tag :span,
|
|
9
|
+
class: css_classes.presence,
|
|
10
|
+
data: merged_data,
|
|
11
|
+
"aria-disabled": "true",
|
|
12
|
+
**html_options do %>
|
|
13
|
+
<%= yield %>
|
|
14
|
+
<% end %>
|
|
15
|
+
<% else %>
|
|
16
|
+
<%= link_to href,
|
|
17
|
+
class: css_classes.presence,
|
|
18
|
+
data: merged_data,
|
|
19
|
+
"aria-current": (active ? "page" : nil),
|
|
20
|
+
**html_options do %>
|
|
21
|
+
<%= yield %>
|
|
22
|
+
<% end %>
|
|
23
|
+
<% end %>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<%# locals: (href: nil, label: nil, disabled: false, show_label: true, css_classes: "", **html_options) %>
|
|
2
|
+
<% is_disabled = disabled || href.nil?
|
|
3
|
+
display_label = label || t("maquina_components.pagination.next", default: "Next")
|
|
4
|
+
merged_data = (html_options.delete(:data) || {}).merge("pagination-part": "next") %>
|
|
5
|
+
|
|
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
|
+
>
|
|
13
|
+
<% if show_label %>
|
|
14
|
+
<span><%= display_label %></span>
|
|
15
|
+
<% end %>
|
|
16
|
+
|
|
17
|
+
<svg
|
|
18
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
19
|
+
width="24"
|
|
20
|
+
height="24"
|
|
21
|
+
viewBox="0 0 24 24"
|
|
22
|
+
fill="none"
|
|
23
|
+
stroke="currentColor"
|
|
24
|
+
stroke-width="2"
|
|
25
|
+
stroke-linecap="round"
|
|
26
|
+
stroke-linejoin="round"
|
|
27
|
+
aria-hidden="true"
|
|
28
|
+
>
|
|
29
|
+
<path d="m9 18 6-6-6-6" />
|
|
30
|
+
</svg>
|
|
31
|
+
</span>
|
|
32
|
+
<% else %>
|
|
33
|
+
<%= link_to href,
|
|
34
|
+
class: css_classes.presence,
|
|
35
|
+
data: merged_data,
|
|
36
|
+
"aria-label": display_label,
|
|
37
|
+
**html_options do %>
|
|
38
|
+
<% if show_label %>
|
|
39
|
+
<span><%= display_label %></span>
|
|
40
|
+
<% end %>
|
|
41
|
+
|
|
42
|
+
<svg
|
|
43
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
44
|
+
width="24"
|
|
45
|
+
height="24"
|
|
46
|
+
viewBox="0 0 24 24"
|
|
47
|
+
fill="none"
|
|
48
|
+
stroke="currentColor"
|
|
49
|
+
stroke-width="2"
|
|
50
|
+
stroke-linecap="round"
|
|
51
|
+
stroke-linejoin="round"
|
|
52
|
+
aria-hidden="true"
|
|
53
|
+
>
|
|
54
|
+
<path d="m9 18 6-6-6-6" />
|
|
55
|
+
</svg>
|
|
56
|
+
<% end %>
|
|
57
|
+
<% end %>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<%# locals: (href: nil, label: nil, disabled: false, show_label: true, css_classes: "", **html_options) %>
|
|
2
|
+
<% is_disabled = disabled || href.nil?
|
|
3
|
+
display_label = label || t("maquina_components.pagination.previous", default: "Previous")
|
|
4
|
+
merged_data = (html_options.delete(:data) || {}).merge("pagination-part": "previous") %>
|
|
5
|
+
|
|
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
|
+
>
|
|
13
|
+
<svg
|
|
14
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
15
|
+
width="24"
|
|
16
|
+
height="24"
|
|
17
|
+
viewBox="0 0 24 24"
|
|
18
|
+
fill="none"
|
|
19
|
+
stroke="currentColor"
|
|
20
|
+
stroke-width="2"
|
|
21
|
+
stroke-linecap="round"
|
|
22
|
+
stroke-linejoin="round"
|
|
23
|
+
aria-hidden="true"
|
|
24
|
+
>
|
|
25
|
+
<path d="m15 18-6-6 6-6" />
|
|
26
|
+
</svg>
|
|
27
|
+
|
|
28
|
+
<% if show_label %>
|
|
29
|
+
<span><%= display_label %></span>
|
|
30
|
+
<% end %>
|
|
31
|
+
</span>
|
|
32
|
+
<% else %>
|
|
33
|
+
<%= link_to href,
|
|
34
|
+
class: css_classes.presence,
|
|
35
|
+
data: merged_data,
|
|
36
|
+
"aria-label": display_label,
|
|
37
|
+
**html_options do %>
|
|
38
|
+
<svg
|
|
39
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
40
|
+
width="24"
|
|
41
|
+
height="24"
|
|
42
|
+
viewBox="0 0 24 24"
|
|
43
|
+
fill="none"
|
|
44
|
+
stroke="currentColor"
|
|
45
|
+
stroke-width="2"
|
|
46
|
+
stroke-linecap="round"
|
|
47
|
+
stroke-linejoin="round"
|
|
48
|
+
aria-hidden="true"
|
|
49
|
+
>
|
|
50
|
+
<path d="m15 18-6-6 6-6" />
|
|
51
|
+
</svg>
|
|
52
|
+
|
|
53
|
+
<% if show_label %>
|
|
54
|
+
<span><%= display_label %></span>
|
|
55
|
+
<% end %>
|
|
56
|
+
<% end %>
|
|
57
|
+
<% end %>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<%# locals: (title: nil, css_classes: "", **html_options) %>
|
|
2
|
+
<% merged_data = (html_options.delete(:data) || {}).merge(
|
|
3
|
+
sidebar_part: :group
|
|
4
|
+
) %>
|
|
5
|
+
|
|
6
|
+
<%= content_tag :div, class: css_classes, data: merged_data, **html_options do %>
|
|
7
|
+
<% if title.present? %>
|
|
8
|
+
<div data-sidebar-part="group-label"><%= title %></div>
|
|
9
|
+
<% end %>
|
|
10
|
+
|
|
11
|
+
<%= yield %>
|
|
12
|
+
<% end %>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<%# locals: (title:, url:, icon_name: nil, size: :default, active: false, css_classes: "", **html_options) %>
|
|
2
|
+
<% merged_data = (html_options.delete(:data) || {}).merge(
|
|
3
|
+
sidebar_part: "menu-button",
|
|
4
|
+
size: size,
|
|
5
|
+
active: active
|
|
6
|
+
) %>
|
|
7
|
+
|
|
8
|
+
<%= link_to url, class: css_classes, data: merged_data, **html_options do %>
|
|
9
|
+
<% if icon_name.present? %>
|
|
10
|
+
<%= icon_for(icon_name) %>
|
|
11
|
+
<% end %>
|
|
12
|
+
|
|
13
|
+
<span><%= title %></span>
|
|
14
|
+
<% end %>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<%# locals: (css_classes: "", **html_options) %>
|
|
2
|
+
<% merged_data =
|
|
3
|
+
(html_options.delete(:data) || {}).merge(sidebar_part: "menu-item") %>
|
|
4
|
+
|
|
5
|
+
<%= content_tag :li, class: "group/menu-item #{css_classes}", data: merged_data, **html_options do %>
|
|
6
|
+
<%= yield %>
|
|
7
|
+
<% end %>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<%# locals: (url: "#", active: false, title: nil, subtitle: nil, icon: nil, text_icon: nil, icon_classes: "", css_classes: "", **html_options) %>
|
|
2
|
+
<% merged_data = (html_options.delete(:data) || {}).merge(
|
|
3
|
+
sidebar_part: "menu-link",
|
|
4
|
+
active: active
|
|
5
|
+
) %>
|
|
6
|
+
|
|
7
|
+
<%= link_to url, class: css_classes, data: merged_data, **html_options do %>
|
|
8
|
+
<% if icon.present? || text_icon.present? %>
|
|
9
|
+
<div data-sidebar-part="menu-avatar">
|
|
10
|
+
<% if icon.present? %>
|
|
11
|
+
<%= image_tag icon, class: icon_classes %>
|
|
12
|
+
<% elsif text_icon.present? %>
|
|
13
|
+
<span class="<%= icon_classes %>"><%= text_icon %></span>
|
|
14
|
+
<% end %>
|
|
15
|
+
</div>
|
|
16
|
+
<% end %>
|
|
17
|
+
|
|
18
|
+
<% if title.present? || subtitle.present? %>
|
|
19
|
+
<div
|
|
20
|
+
class="flex flex-col gap-0.5 leading-none"
|
|
21
|
+
data-sidebar-hide-on-collapse
|
|
22
|
+
>
|
|
23
|
+
<% if title.present? %>
|
|
24
|
+
<span class="font-medium"><%= title %></span>
|
|
25
|
+
<% end %>
|
|
26
|
+
|
|
27
|
+
<% if subtitle.present? %>
|
|
28
|
+
<span class="text-xs text-sidebar-foreground/70"><%= subtitle %></span>
|
|
29
|
+
<% end %>
|
|
30
|
+
</div>
|
|
31
|
+
<% end %>
|
|
32
|
+
<% end %>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<%# locals: (default_open: true, variant: :inset, css_classes: "", cookie_name: "sidebar_state", keyboard_shortcut: "b", **html_options) %>
|
|
2
|
+
<% merged_data = (html_options.delete(:data) || {}).merge(
|
|
3
|
+
component: :sidebar,
|
|
4
|
+
variant: variant,
|
|
5
|
+
controller: "sidebar",
|
|
6
|
+
outlet: "sidebar",
|
|
7
|
+
sidebar_default_open_value: default_open,
|
|
8
|
+
sidebar_open_value: default_open,
|
|
9
|
+
sidebar_cookie_name_value: cookie_name,
|
|
10
|
+
sidebar_keyboard_shortcut_value: keyboard_shortcut,
|
|
11
|
+
action: "keydown.meta+#{keyboard_shortcut}@window->sidebar#toggleWithKeyboard keydown.ctrl+#{keyboard_shortcut}@window->sidebar#toggleWithKeyboard"
|
|
12
|
+
) %>
|
|
13
|
+
|
|
14
|
+
<%= content_tag :div, class: css_classes, data: merged_data, **html_options do %>
|
|
15
|
+
<%= yield %>
|
|
16
|
+
<% end %>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<%# locals: (icon_name:, css_classes: "", **html_options) %>
|
|
2
|
+
<% merged_data = (html_options.delete(:data) || {}).merge(
|
|
3
|
+
sidebar_part: :trigger,
|
|
4
|
+
controller: "sidebar-trigger",
|
|
5
|
+
action: "click->sidebar-trigger#triggerClick",
|
|
6
|
+
sidebar_trigger_sidebar_outlet: "[data-outlet='sidebar']"
|
|
7
|
+
) %>
|
|
8
|
+
|
|
9
|
+
<%= button_tag type: :button, class: css_classes, data: merged_data, **html_options do %>
|
|
10
|
+
<%= icon_for(icon_name) %>
|
|
11
|
+
<span class="sr-only">Toggle Sidebar</span>
|
|
12
|
+
<% end %>
|