material_design 0.9.1 → 0.10.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5cd4edaa73836367a47688dc4c71958243d528a4dc98d3c72d8994d62d51394d
4
- data.tar.gz: 37caf5262a8ab7f6b362355153e8a2f366f1f2eb8cbd3e104eb53ae11e3d7bf8
3
+ metadata.gz: a307b88cc59be7be5ace27be05f2201ae397e9046fc71c3141eba67d58fdff42
4
+ data.tar.gz: 482b6f76ba707e1483643896913101b72521dc98736e7af8d145baed3c46c02d
5
5
  SHA512:
6
- metadata.gz: 9b27f10fd39f2c79654ff56002e52979171647272140f9764494bf42b2af5539c18b11860f5d9505eb23435c895b8f364d33d7b7d3bd47bb135d4f0d4648eb07
7
- data.tar.gz: 2f9f0bb2e39c1956a1a3517bea036fe68c31211578ca1f20258e40ebfdbee1583b5fd0586b7984c659c3dda1279d43d33d2b9746e76edd99986d6eaa232a1f93
6
+ metadata.gz: 3ebb02dd9e0a39336e66673aef48467647949098404d3549a6dd396881c89f85a74141eff828d7091e53e3622b4b12edd96b90f0612eb5c0525463e63ec6515b
7
+ data.tar.gz: 1d9f16e88f991dfe4251d77aa06a327139fced3c3e7acea996f1db1d95c719f496259d43f4c09c8c0876a3f286977f47cf856b573053bea2de92e55316fc1b0a
@@ -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
+
@@ -1,11 +1,12 @@
1
1
  require "rails/railtie"
2
2
 
3
- module MyGem
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
@@ -1,3 +1,3 @@
1
1
  module MaterialDesign
2
- VERSION = "0.9.1"
2
+ VERSION = "0.10.0"
3
3
  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.9.1
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eduardo Yutaka Nakanishi
@@ -9,10 +9,10 @@ authors:
9
9
  - Mariana Negrão Trancoso
10
10
  - Prscila Sabino
11
11
  - Bianca Cristina Ramos
12
- autorequire:
12
+ autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2024-10-28 00:00:00.000000000 Z
15
+ date: 2024-10-30 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
@@ -2252,7 +2254,7 @@ licenses:
2252
2254
  - MIT
2253
2255
  metadata:
2254
2256
  homepage_uri: https://rubygems.org/gems/material_design
2255
- post_install_message:
2257
+ post_install_message:
2256
2258
  rdoc_options: []
2257
2259
  require_paths:
2258
2260
  - lib
@@ -2268,7 +2270,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
2268
2270
  version: '0'
2269
2271
  requirements: []
2270
2272
  rubygems_version: 3.5.21
2271
- signing_key:
2273
+ signing_key:
2272
2274
  specification_version: 4
2273
2275
  summary: Material Design
2274
2276
  test_files: []