turbo_material 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +247 -0
  4. data/Rakefile +8 -0
  5. data/app/assets/config/turbo_material_manifest.js +3 -0
  6. data/app/assets/dist/turbo_material/tailwind.css +1 -0
  7. data/app/assets/javascripts/turbo_material/material_checkbox_controller.js +12 -0
  8. data/app/assets/javascripts/turbo_material/material_chips_input_controller.js +140 -0
  9. data/app/assets/javascripts/turbo_material/material_chips_select_controller.js +111 -0
  10. data/app/assets/javascripts/turbo_material/material_dialog_controller.js +27 -0
  11. data/app/assets/javascripts/turbo_material/material_input_controller.js +10 -0
  12. data/app/assets/javascripts/turbo_material/material_list_controller.js +57 -0
  13. data/app/assets/javascripts/turbo_material/material_menu_surface_controller.js +11 -0
  14. data/app/assets/javascripts/turbo_material/material_radio_controller.js +10 -0
  15. data/app/assets/javascripts/turbo_material/material_ripple_controller.js +10 -0
  16. data/app/assets/javascripts/turbo_material/material_select_controller.js +10 -0
  17. data/app/assets/javascripts/turbo_material/material_switch_controller.js +14 -0
  18. data/app/assets/stylesheets/turbo_material/application.css +15 -0
  19. data/app/assets/stylesheets/turbo_material/application.tailwind.css +3 -0
  20. data/app/controllers/turbo_material/application_controller.rb +4 -0
  21. data/app/helpers/turbo_material/application_helper.rb +7 -0
  22. data/app/helpers/turbo_material/checkbox_helper.rb +7 -0
  23. data/app/helpers/turbo_material/chips_input_helper.rb +7 -0
  24. data/app/helpers/turbo_material/chips_select_helper.rb +7 -0
  25. data/app/helpers/turbo_material/input_helper.rb +7 -0
  26. data/app/helpers/turbo_material/modal_helper.rb +7 -0
  27. data/app/helpers/turbo_material/radio_helper.rb +7 -0
  28. data/app/helpers/turbo_material/select_helper.rb +7 -0
  29. data/app/helpers/turbo_material/switch_helper.rb +7 -0
  30. data/app/helpers/turbo_material/textarea_helper.rb +7 -0
  31. data/app/jobs/turbo_material/application_job.rb +4 -0
  32. data/app/mailers/turbo_material/application_mailer.rb +6 -0
  33. data/app/models/turbo_material/application_record.rb +5 -0
  34. data/app/views/components/_checkbox.html.erb +25 -0
  35. data/app/views/components/_chips_input.html.erb +36 -0
  36. data/app/views/components/_chips_input_options.html.erb +20 -0
  37. data/app/views/components/_chips_select.html.erb +56 -0
  38. data/app/views/components/_input.html.erb +32 -0
  39. data/app/views/components/_modal.html.erb +37 -0
  40. data/app/views/components/_radio.html.erb +28 -0
  41. data/app/views/components/_select.html.erb +67 -0
  42. data/app/views/components/_switch.html.erb +34 -0
  43. data/app/views/components/_textarea.html.erb +30 -0
  44. data/app/views/layouts/turbo_material/application.html.erb +21 -0
  45. data/config/importmap.rb +4 -0
  46. data/config/routes.rb +2 -0
  47. data/config/tailwind.config.js +26 -0
  48. data/lib/tasks/turbo_material_tasks.rake +4 -0
  49. data/lib/turbo_material/engine.rb +44 -0
  50. data/lib/turbo_material/version.rb +3 -0
  51. data/lib/turbo_material.rb +6 -0
  52. metadata +164 -0
@@ -0,0 +1,30 @@
1
+ <%# locals: (form:, custom_controller: nil, custom_css: nil, disabled: false, required: false, name:, label: nil, id:, frame: nil, provide_hidden: false, value: nil, type: 'text', data: {}, rows: 8, cols: 40, maxlength: 140, helper: nil, parent: nil) %>
2
+ <label class="mdc-text-field mdc-text-field--filled mdc-text-field--textarea mdc-text-field--no-label !w-full p-2"
3
+ data-controller="<%= custom_controller || 'material-input' %>" <% if frame %>data-frame="<%= frame %>"<% end %>>
4
+ <span class="mdc-notched-outline">
5
+ <span class="mdc-notched-outline__leading"></span>
6
+ <span class="mdc-notched-outline__trailing"></span>
7
+ </span>
8
+
9
+ <%= form.text_area provide_hidden ? "#{name}_".to_sym : name.to_sym,
10
+ class: 'mdc-text-field__input', value: value || form&.object&.[](name.to_sym),
11
+ id: id, 'aria-labelledby' => id + '-label', required: required, disabled: disabled,
12
+ autocomplete: "off", data: { frame: frame }.compact, rows: rows, cols: cols, maxlength: maxlength
13
+ %>
14
+ <span class="mdc-text-field-character-counter">0 / <%= maxlength %></span>
15
+
16
+ <%- if provide_hidden -%>
17
+ <%= form.hidden_field name.to_sym, value: value, data: { frame: frame }.compact %>
18
+ <%- end -%>
19
+ </label>
20
+ <div class="mdc-text-field-helper-line">
21
+ <%- if helper -%>
22
+ <div class="mdc-text-field-helper-text" aria-hidden="true"><%= helper %></div>
23
+ <%- end -%>
24
+ <%- parent&.errors&.[](name.to_sym)&.each do |msg| -%>
25
+ <div class="mdc-text-field-helper-text--validation-msg text-sm text-red-500" aria-hidden="true">
26
+ <%= msg %>
27
+ </div>
28
+ <%- end -%>
29
+ </div>
30
+
@@ -0,0 +1,21 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Turbo material</title>
5
+ <%= csrf_meta_tags %>
6
+ <%= csp_meta_tag %>
7
+
8
+ <%= stylesheet_link_tag "turbo_material/tailwind", "data-turbo-track": "reload" %>
9
+
10
+ <%= javascript_importmap_tags %>
11
+
12
+ <%= javascript_import_module_tag "turbo_material/application" %>
13
+
14
+ <%= stylesheet_link_tag "turbo_material/application", media: "all" %>
15
+ </head>
16
+ <body>
17
+
18
+ <%= yield %>
19
+
20
+ </body>
21
+ </html>
@@ -0,0 +1,4 @@
1
+ pin_all_from File.expand_path("../app/assets/javascripts", __dir__)
2
+ pin "@rails/request.js", to: "https://ga.jspm.io/npm:@rails/request.js@0.0.9/src/index.js"
3
+ pin "stimulus-use", to: "https://ga.jspm.io/npm:stimulus-use@0.51.3/dist/index.js"
4
+ pin "hotkeys-js", to: "https://ga.jspm.io/npm:hotkeys-js@3.10.2/dist/hotkeys.esm.js"
data/config/routes.rb ADDED
@@ -0,0 +1,2 @@
1
+ TurboMaterial::Engine.routes.draw do
2
+ end
@@ -0,0 +1,26 @@
1
+ const defaultTheme = require('tailwindcss/defaultTheme')
2
+
3
+ module.exports = {
4
+ safelist: [
5
+ {
6
+ pattern: /prose/,
7
+ },
8
+ ],
9
+ content: [
10
+ './app/assets/stylesheets/**/*.css',
11
+ './app/views/**/*.html.erb'
12
+ ],
13
+ theme: {
14
+ extend: {
15
+ fontFamily: {
16
+ sans: ['Inter var', ...defaultTheme.fontFamily.sans],
17
+ },
18
+ },
19
+ },
20
+ plugins: [
21
+ require('@tailwindcss/forms'),
22
+ require('@tailwindcss/aspect-ratio'),
23
+ require('@tailwindcss/typography'),
24
+ require('@tailwindcss/container-queries'),
25
+ ]
26
+ }
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :turbo_material do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,44 @@
1
+ require "importmap-rails"
2
+
3
+ module TurboMaterial
4
+ class Engine < ::Rails::Engine
5
+ isolate_namespace TurboMaterial
6
+
7
+ initializer 'local_helper.action_controller' do
8
+ ActiveSupport.on_load :action_controller do
9
+ helper TurboMaterial::ApplicationHelper
10
+ helper TurboMaterial::InputHelper
11
+ helper TurboMaterial::CheckboxHelper
12
+ helper TurboMaterial::ChipsInputHelper
13
+ helper TurboMaterial::ChipsSelectHelper
14
+ helper TurboMaterial::ModalHelper
15
+ helper TurboMaterial::RadioHelper
16
+ helper TurboMaterial::SelectHelper
17
+ helper TurboMaterial::SwitchHelper
18
+ helper TurboMaterial::TextareaHelper
19
+ end
20
+ end
21
+
22
+ initializer "turbo_material.importmap", before: "importmap" do |app|
23
+ # NOTE: this will add pins from this engine to the main app
24
+ # https://github.com/rails/importmap-rails#composing-import-maps
25
+ app.config.importmap.paths << root.join("config/importmap.rb")
26
+
27
+ # NOTE: something about cache; I did not look into it.
28
+ # https://github.com/rails/importmap-rails#sweeping-the-cache-in-development-and-test
29
+ app.config.importmap.cache_sweepers << root.join("app/assets/javascripts")
30
+ end
31
+
32
+ # NOTE: add engine manifest to precompile assets in production
33
+ initializer "turbo_material.assets" do |app|
34
+ app.config.assets.precompile += %w[turbo_material_manifest]
35
+ end
36
+
37
+ initializer "turbo_material.precompile" do |app|
38
+ app.config.assets.paths << root.join("app/assets/javascripts")
39
+ app.config.assets.precompile << "turbo_material/application.js"
40
+ app.config.assets.paths << root.join("app/assets/dist")
41
+ app.config.assets.precompile << "turbo_material/tailwind.css"
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,3 @@
1
+ module TurboMaterial
2
+ VERSION = "0.1.1"
3
+ end
@@ -0,0 +1,6 @@
1
+ require "turbo_material/version"
2
+ require "turbo_material/engine"
3
+
4
+ module TurboMaterial
5
+ # Your code goes here...
6
+ end
metadata ADDED
@@ -0,0 +1,164 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: turbo_material
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Sergey Moiseev
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-01-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '7.1'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 7.1.2
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '7.1'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 7.1.2
33
+ - !ruby/object:Gem::Dependency
34
+ name: importmap-rails
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: 2.0.1
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: 2.0.1
47
+ - !ruby/object:Gem::Dependency
48
+ name: stimulus-rails
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '1.3'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '1.3'
61
+ - !ruby/object:Gem::Dependency
62
+ name: tailwindcss-rails
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '2.0'
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: 2.0.33
71
+ type: :runtime
72
+ prerelease: false
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - "~>"
76
+ - !ruby/object:Gem::Version
77
+ version: '2.0'
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: 2.0.33
81
+ description:
82
+ email:
83
+ - moiseev.sergey@gmail.com
84
+ executables: []
85
+ extensions: []
86
+ extra_rdoc_files: []
87
+ files:
88
+ - MIT-LICENSE
89
+ - README.md
90
+ - Rakefile
91
+ - app/assets/config/turbo_material_manifest.js
92
+ - app/assets/dist/turbo_material/tailwind.css
93
+ - app/assets/javascripts/turbo_material/material_checkbox_controller.js
94
+ - app/assets/javascripts/turbo_material/material_chips_input_controller.js
95
+ - app/assets/javascripts/turbo_material/material_chips_select_controller.js
96
+ - app/assets/javascripts/turbo_material/material_dialog_controller.js
97
+ - app/assets/javascripts/turbo_material/material_input_controller.js
98
+ - app/assets/javascripts/turbo_material/material_list_controller.js
99
+ - app/assets/javascripts/turbo_material/material_menu_surface_controller.js
100
+ - app/assets/javascripts/turbo_material/material_radio_controller.js
101
+ - app/assets/javascripts/turbo_material/material_ripple_controller.js
102
+ - app/assets/javascripts/turbo_material/material_select_controller.js
103
+ - app/assets/javascripts/turbo_material/material_switch_controller.js
104
+ - app/assets/stylesheets/turbo_material/application.css
105
+ - app/assets/stylesheets/turbo_material/application.tailwind.css
106
+ - app/controllers/turbo_material/application_controller.rb
107
+ - app/helpers/turbo_material/application_helper.rb
108
+ - app/helpers/turbo_material/checkbox_helper.rb
109
+ - app/helpers/turbo_material/chips_input_helper.rb
110
+ - app/helpers/turbo_material/chips_select_helper.rb
111
+ - app/helpers/turbo_material/input_helper.rb
112
+ - app/helpers/turbo_material/modal_helper.rb
113
+ - app/helpers/turbo_material/radio_helper.rb
114
+ - app/helpers/turbo_material/select_helper.rb
115
+ - app/helpers/turbo_material/switch_helper.rb
116
+ - app/helpers/turbo_material/textarea_helper.rb
117
+ - app/jobs/turbo_material/application_job.rb
118
+ - app/mailers/turbo_material/application_mailer.rb
119
+ - app/models/turbo_material/application_record.rb
120
+ - app/views/components/_checkbox.html.erb
121
+ - app/views/components/_chips_input.html.erb
122
+ - app/views/components/_chips_input_options.html.erb
123
+ - app/views/components/_chips_select.html.erb
124
+ - app/views/components/_input.html.erb
125
+ - app/views/components/_modal.html.erb
126
+ - app/views/components/_radio.html.erb
127
+ - app/views/components/_select.html.erb
128
+ - app/views/components/_switch.html.erb
129
+ - app/views/components/_textarea.html.erb
130
+ - app/views/layouts/turbo_material/application.html.erb
131
+ - config/importmap.rb
132
+ - config/routes.rb
133
+ - config/tailwind.config.js
134
+ - lib/tasks/turbo_material_tasks.rake
135
+ - lib/turbo_material.rb
136
+ - lib/turbo_material/engine.rb
137
+ - lib/turbo_material/version.rb
138
+ homepage: https://github.com/full-stack-biz/turbo_material
139
+ licenses:
140
+ - MIT
141
+ metadata:
142
+ allowed_push_host: https://rubygems.org
143
+ homepage_uri: https://github.com/full-stack-biz/turbo_material
144
+ source_code_uri: https://github.com/full-stack-biz/turbo_material
145
+ post_install_message:
146
+ rdoc_options: []
147
+ require_paths:
148
+ - lib
149
+ required_ruby_version: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - ">="
152
+ - !ruby/object:Gem::Version
153
+ version: '0'
154
+ required_rubygems_version: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - ">="
157
+ - !ruby/object:Gem::Version
158
+ version: '0'
159
+ requirements: []
160
+ rubygems_version: 3.4.10
161
+ signing_key:
162
+ specification_version: 4
163
+ summary: Material Web Components for Hotwire Turbo.
164
+ test_files: []