material_design 0.9.1 → 0.10.1
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/assets/stylesheets/material_design/menus.css +57 -0
- data/app/helpers/material_design/menu_helper.rb +31 -0
- data/app/views/material_design/icons/_calendar_clock.html.erb +3 -0
- data/app/views/material_design/icons/_redo.html.erb +1 -1
- data/app/views/material_design/icons/_undo.html.erb +1 -1
- data/lib/material_design/railtie.rb +3 -2
- data/lib/material_design/version.rb +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a154c3607c9963a33de59c58656e499ca8bd96f5e8e432445266f9e8b680297
|
4
|
+
data.tar.gz: e8651559eba8df4251243b845bcca76a2e40d847492c8077c075a14c10383de6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9153d46098c847ce315e6daa39e6e62fa6a6bfa3e4ac059fd05418e9a794119cb831c47e97ed71d1765f52ec6a0a3bf1aa8e4695f8b67018c90d3f55b4e25699
|
7
|
+
data.tar.gz: 688681836e53a716483dbc45e990600d01ce7a86ded83529c7c869b96644cc1776ed7a736b3836b2a55bde0d466558482bec9fbfe5cc4bd8293684d190320241
|
@@ -0,0 +1,57 @@
|
|
1
|
+
.menu {
|
2
|
+
position: absolute;
|
3
|
+
min-width: 200px;
|
4
|
+
max-width: max-content;
|
5
|
+
border-radius: 0.5rem;
|
6
|
+
z-index: 20;
|
7
|
+
box-shadow: 0 2px 10px rgb(0, 2, 6, 0.3), 0 2px 10px rgb(0, 1, 2, 0.2);
|
8
|
+
|
9
|
+
@media (prefers-color-scheme: light) {
|
10
|
+
background: rgb(var(--md-sys-light-surface-container));
|
11
|
+
}
|
12
|
+
|
13
|
+
@media (prefers-color-scheme: dark) {
|
14
|
+
background: rgb(var(--md-sys-dark-surface-container));
|
15
|
+
}
|
16
|
+
|
17
|
+
.menu__item {
|
18
|
+
width: 100%;
|
19
|
+
display: flex;
|
20
|
+
gap: 0.75rem;
|
21
|
+
padding: 0.75rem 1rem;
|
22
|
+
cursor: pointer;
|
23
|
+
|
24
|
+
&.divider {
|
25
|
+
border-bottom: 1px solid;
|
26
|
+
|
27
|
+
@media (prefers-color-scheme: light) {
|
28
|
+
background: rgb(var(--md-sys-light-surface-variant));
|
29
|
+
}
|
30
|
+
|
31
|
+
@media (prefers-color-scheme: dark) {
|
32
|
+
background: rgb(var(--md-sys-dark-surface-variant));
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
&:hover {
|
37
|
+
@media (prefers-color-scheme: light) {
|
38
|
+
background: rgb(var(--md-sys-light-on-surface) / 0.08);
|
39
|
+
}
|
40
|
+
|
41
|
+
@media (prefers-color-scheme: dark) {
|
42
|
+
background: rgb(var(--md-sys-dark-on-surface) / 0.08);
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
&:active {
|
47
|
+
@media (prefers-color-scheme: light) {
|
48
|
+
background: rgb(var(--md-sys-light-surface-container-highest));
|
49
|
+
}
|
50
|
+
|
51
|
+
@media (prefers-color-scheme: dark) {
|
52
|
+
background: rgb(var(--md-sys-dark-surface-container-highest));
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
}
|
57
|
+
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module MaterialDesign
|
2
|
+
module MenuHelper
|
3
|
+
def md_menu(menu_options: [], data: {}, form: nil, attribute: nil)
|
4
|
+
content_tag(:div, class: "menu", data: data) do
|
5
|
+
menu_options.each do |option|
|
6
|
+
concat(menu_option(option, form, attribute))
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def menu_option(option, form, attribute)
|
12
|
+
if option[:path]
|
13
|
+
link_to option[:path], data: option[:data], method: option[:method] do
|
14
|
+
content_tag(:div, class: class_names("menu__item", divider: option[:divider])) do
|
15
|
+
concat(render("material_design/icons/icon", locals: { icon: option[:icon], size: 18 })) if option[:icon]
|
16
|
+
concat(content_tag(:span, option[:label]))
|
17
|
+
end
|
18
|
+
end
|
19
|
+
elsif form
|
20
|
+
form.label "#{attribute}_#{option[:value]}", option[:label] do
|
21
|
+
concat(form.radio_button attribute, option[:value], class: "hidden", onchange: option[:onchange], checked: option[:checked])
|
22
|
+
concat(content_tag(:div, class: class_names("menu__item", divider: option[:divider])) do
|
23
|
+
concat(render("material_design/icons/icon", locals: { icon: option[:icon], size: 18 })) if option[:icon]
|
24
|
+
concat(content_tag(:span, option[:label]))
|
25
|
+
end)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
@@ -0,0 +1,3 @@
|
|
1
|
+
<svg width="<%= locals[:size] %>" height="<%= locals[:size] %>" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2
|
+
<path d="M200-640h560v-80H200v80Zm0 0v-80 80Zm0 560q-33 0-56.5-23.5T120-160v-560q0-33 23.5-56.5T200-800h40v-80h80v80h320v-80h80v80h40q33 0 56.5 23.5T840-720v227q-19-9-39-15t-41-9v-43H200v400h252q7 22 16.5 42T491-80H200Zm520 40q-83 0-141.5-58.5T520-240q0-83 58.5-141.5T720-440q83 0 141.5 58.5T920-240q0 83-58.5 141.5T720-40Zm67-105 28-28-75-75v-112h-40v128l87 87Z" fill="currentColor"/>
|
3
|
+
</svg>
|
@@ -1,3 +1,3 @@
|
|
1
1
|
<svg width="<%= locals[:size] %>" height="<%= locals[:size] %>" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2
|
-
<path d="
|
2
|
+
<path d="M396-200q-97 0-166.5-63T160-420q0-94 69.5-157T396-640h252L544-744l56-56 200 200-200 200-56-56 104-104H396q-63 0-109.5 40T240-420q0 60 46.5 100T396-280h284v80H396Z" fill="currentColor"/>
|
3
3
|
</svg>
|
@@ -1,3 +1,3 @@
|
|
1
1
|
<svg width="<%= locals[:size] %>" height="<%= locals[:size] %>" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2
|
-
<path d="
|
2
|
+
<path d="M280-200v-80h284q63 0 109.5-40T720-420q0-60-46.5-100T564-560H312l104 104-56 56-200-200 200-200 56 56-104 104h252q97 0 166.5 63T800-420q0 94-69.5 157T564-200H280Z" fill="currentColor"/>
|
3
3
|
</svg>
|
@@ -1,11 +1,12 @@
|
|
1
1
|
require "rails/railtie"
|
2
2
|
|
3
|
-
module
|
3
|
+
module MaterialDesign
|
4
4
|
class Railtie < Rails::Railtie
|
5
5
|
initializer "material_design.action_controller" do
|
6
|
-
ActiveSupport.on_load(:action_controller_base) do
|
6
|
+
ActiveSupport.on_load(:action_controller_base) do
|
7
7
|
helper MaterialDesign::ButtonHelper
|
8
8
|
helper MaterialDesign::ChipHelper
|
9
|
+
helper MaterialDesign::MenuHelper
|
9
10
|
end
|
10
11
|
end
|
11
12
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: material_design
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eduardo Yutaka Nakanishi
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date:
|
15
|
+
date: 2025-04-14 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rails
|
@@ -76,6 +76,7 @@ files:
|
|
76
76
|
- app/assets/stylesheets/material_design/dividers.css
|
77
77
|
- app/assets/stylesheets/material_design/icons.css
|
78
78
|
- app/assets/stylesheets/material_design/lists.css
|
79
|
+
- app/assets/stylesheets/material_design/menus.css
|
79
80
|
- app/assets/stylesheets/material_design/navigation.css
|
80
81
|
- app/assets/stylesheets/material_design/segmented_button.css
|
81
82
|
- app/assets/stylesheets/material_design/tabs.css
|
@@ -84,6 +85,7 @@ files:
|
|
84
85
|
- app/helpers/material_design/application_helper.rb
|
85
86
|
- app/helpers/material_design/button_helper.rb
|
86
87
|
- app/helpers/material_design/chip_helper.rb
|
88
|
+
- app/helpers/material_design/menu_helper.rb
|
87
89
|
- app/javascript/material_design/application.js
|
88
90
|
- app/javascript/material_design/controllers/application.js
|
89
91
|
- app/javascript/material_design/controllers/filter_chip_controller.js
|
@@ -423,6 +425,7 @@ files:
|
|
423
425
|
- app/views/material_design/icons/_cached.html.erb
|
424
426
|
- app/views/material_design/icons/_cake.html.erb
|
425
427
|
- app/views/material_design/icons/_calculate.html.erb
|
428
|
+
- app/views/material_design/icons/_calendar_clock.html.erb
|
426
429
|
- app/views/material_design/icons/_calendar_month.html.erb
|
427
430
|
- app/views/material_design/icons/_calendar_today.html.erb
|
428
431
|
- app/views/material_design/icons/_calendar_view_day.html.erb
|
@@ -2267,7 +2270,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
2267
2270
|
- !ruby/object:Gem::Version
|
2268
2271
|
version: '0'
|
2269
2272
|
requirements: []
|
2270
|
-
rubygems_version: 3.5.
|
2273
|
+
rubygems_version: 3.5.13
|
2271
2274
|
signing_key:
|
2272
2275
|
specification_version: 4
|
2273
2276
|
summary: Material Design
|