plutonium 0.12.8 → 0.12.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,7 +8,7 @@
8
8
  <%= content %>
9
9
  </div>
10
10
 
11
- <div class="hidden absolute bottom-0 left-0 justify-center p-4 space-x-4 w-full lg:flex bg-white dark:bg-gray-800 z-20">
11
+ <div class="hidden absolute bottom-0 left-0 justify-center p-4 space-x-4 w-full lg:flex bg-white dark:bg-gray-800 z-20 border-r border-gray-200 dark:border-gray-700">
12
12
  <div data-controller="resource-drop-down">
13
13
  <button
14
14
  type="button"
@@ -3,11 +3,11 @@ module PlutoniumUi
3
3
  private
4
4
 
5
5
  def sidebar_class
6
- "fixed top-0 left-0 z-40 w-64 h-screen pt-14 transition-transform -translate-x-full bg-white border-r border-gray-200 lg:translate-x-0 dark:bg-gray-800 dark:border-gray-700"
6
+ "fixed top-0 left-0 z-40 w-64 h-screen pt-14 transition-transform -translate-x-full lg:translate-x-0"
7
7
  end
8
8
 
9
9
  def sidebar_container_class
10
- "overflow-y-auto py-5 px-3 h-full bg-white dark:bg-gray-800"
10
+ "overflow-y-auto py-5 px-3 h-full bg-white border-r border-gray-200 dark:bg-gray-800 dark:border-gray-700"
11
11
  end
12
12
  end
13
13
  end
@@ -3,10 +3,10 @@
3
3
  <button
4
4
  type="button"
5
5
  class="<%= link_button_class %> w-full transition duration-75"
6
- data-resource-drop-down-target="trigger"
7
- aria-controls="dropdown-<%= name.parameterize %>">
6
+ data-resource-collapse-target="trigger"
7
+ aria-controls="side-menu-item-<%= name.parameterize %>">
8
8
  <% if icon.present? %>
9
- <%= render_icon icon, size: :lg %>
9
+ <%= render_icon icon, size: :lg, classname: icon_class %>
10
10
  <% else %>
11
11
  <div class="shrink-0 w-6 h-6">
12
12
  &nbsp;
@@ -28,7 +28,7 @@
28
28
  </svg>
29
29
  </button>
30
30
 
31
- <ul id="dropdown-<%= name.parameterize %>" data-resource-drop-down-target="menu" class="hidden py-2 space-y-2">
31
+ <ul id="side-menu-item-<%= name.parameterize %>" data-resource-collapse-target="menu" class="hidden py-2 space-y-2">
32
32
  <% sub_items.each do |sub_item| %>
33
33
  <%#= sub_item %>
34
34
  <li>
@@ -43,9 +43,9 @@
43
43
  <% else %>
44
44
  <a
45
45
  href="<%= url %>"
46
- class="<%= link_button_class %>">
46
+ class="<%= link_link_class %>">
47
47
  <% if icon.present? %>
48
- <%= render_icon icon, size: :lg %>
48
+ <%= render_icon icon, size: :lg, classname: icon_class %>
49
49
  <% else %>
50
50
  <div class="shrink-0 w-6 h-6">
51
51
  &nbsp;
@@ -14,21 +14,27 @@ module PlutoniumUi
14
14
  {
15
15
  id: "sidebar-menu-item-#{name.parameterize}",
16
16
  classname: "sidebar-menu-item",
17
- controller: ["sidebar-menu-item", sub_items.any? ? "resource-drop-down" : nil],
18
- link_button_class: "group flex items-center rounded-lg p-2 text-base font-medium text-gray-900 hover:bg-gray-100 dark:text-white dark:hover:bg-gray-700",
17
+ controller: ["sidebar-menu-item", sub_items.any? ? "resource-collapse" : nil],
18
+ link_button_class: "flex items-center p-2 w-full text-base font-normal text-gray-900 rounded-lg transition duration-75 group hover:bg-gray-100 dark:text-white dark:hover:bg-gray-700",
19
+ link_link_class: "flex items-center p-2 text-base font-normal text-gray-900 rounded-lg dark:text-white hover:bg-gray-100 dark:hover:bg-gray-700 group",
19
20
  link_label_class: "flex-1 ml-3 text-left whitespace-nowrap",
20
- sub_link_button_class: "flex items-center p-2 pl-11 w-full text-base font-medium text-gray-900 rounded-lg transition duration-75 group hover:bg-gray-100 dark:text-white dark:hover:bg-gray-700"
21
+ sub_link_button_class: "flex items-center p-2 pl-11 w-full text-base font-normal text-gray-900 rounded-lg transition duration-75 group hover:bg-gray-100 dark:text-white dark:hover:bg-gray-700",
22
+ icon_class: "text-gray-400 transition duration-75 dark:text-gray-400 group-hover:text-gray-900 dark:group-hover:text-white"
21
23
  }
22
24
  end
23
25
 
24
26
  def filtered_attributes
25
- %i[link_button_class link_label_class sub_link_button_class]
27
+ %i[link_button_class link_label_class sub_link_button_class link_link_class icon_class]
26
28
  end
27
29
 
28
30
  def link_button_class
29
31
  raw_attributes_hash[:link_button_class]
30
32
  end
31
33
 
34
+ def link_link_class
35
+ raw_attributes_hash[:link_link_class]
36
+ end
37
+
32
38
  def link_label_class
33
39
  raw_attributes_hash[:link_label_class]
34
40
  end
@@ -36,6 +42,10 @@ module PlutoniumUi
36
42
  def sub_link_button_class
37
43
  raw_attributes_hash[:sub_link_button_class]
38
44
  end
45
+
46
+ def icon_class
47
+ raw_attributes_hash[:icon_class]
48
+ end
39
49
  end
40
50
  end
41
51
 
@@ -1,3 +1,3 @@
1
1
  module Plutonium
2
- VERSION = "0.12.8"
2
+ VERSION = "0.12.9"
3
3
  end
@@ -16,6 +16,7 @@ import TableToolbarController from "./table_toolbar_controller.js"
16
16
  import TableController from "./table_controller.js"
17
17
  import FormController from "./form_controller.js"
18
18
  import ResourceDropDownController from "./resource_drop_down_controller.js"
19
+ import ResourceCollapseController from "./resource_collapse_controller.js"
19
20
  import ResourceDismissController from "./resource_dismiss_controller.js"
20
21
  import FrameNavigatorController from "./frame_navigator_controller.js"
21
22
  import ColorModeController from "./color_mode_controller.js"
@@ -39,6 +40,7 @@ export default function (application) {
39
40
  application.register("table", TableController)
40
41
  application.register("form", FormController)
41
42
  application.register("resource-drop-down", ResourceDropDownController)
43
+ application.register("resource-collapse", ResourceCollapseController)
42
44
  application.register("resource-dismiss", ResourceDismissController)
43
45
  application.register("frame-navigator", FrameNavigatorController)
44
46
  application.register("color-mode", ColorModeController)
@@ -0,0 +1,30 @@
1
+ import { Controller } from "@hotwired/stimulus"
2
+ import { Collapse } from 'flowbite';
3
+
4
+
5
+ // Connects to data-controller="resource-collapse"
6
+ export default class extends Controller {
7
+ static targets = ["trigger", "menu"]
8
+
9
+ connect() {
10
+ console.log(`resource-collapse connected: ${this.element}`)
11
+
12
+ this.collapse = new Collapse(this.menuTarget, this.triggerTarget);
13
+ }
14
+
15
+ disconnect() {
16
+ this.collapse = null
17
+ }
18
+
19
+ toggle() {
20
+ this.collapse.toggle()
21
+ }
22
+
23
+ show() {
24
+ this.collapse.show()
25
+ }
26
+
27
+ hide() {
28
+ this.collapse.hide()
29
+ }
30
+ }
@@ -26,6 +26,6 @@ export default class extends Controller {
26
26
  }
27
27
 
28
28
  hide() {
29
- this.dropdown.show()
29
+ this.dropdown.hide()
30
30
  }
31
31
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plutonium
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.8
4
+ version: 0.12.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Froelich
@@ -1135,6 +1135,7 @@ files:
1135
1135
  - src/js/controllers/nav_user_section_controller.js
1136
1136
  - src/js/controllers/nested_resource_form_fields_controller.js
1137
1137
  - src/js/controllers/register_controllers.js
1138
+ - src/js/controllers/resource_collapse_controller.js
1138
1139
  - src/js/controllers/resource_dismiss_controller.js
1139
1140
  - src/js/controllers/resource_drop_down_controller.js
1140
1141
  - src/js/controllers/resource_header_controller.js