turbo_material 0.1.5 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -6
- data/app/views/components/_select.html.erb +2 -2
- data/lib/lookbook/checkbox_preview.rb +8 -0
- data/lib/lookbook/chips_input_preview.rb +14 -0
- data/lib/lookbook/chips_select_preview.rb +15 -0
- data/lib/lookbook/input_preview.rb +9 -0
- data/lib/lookbook/menu_button_preview.rb +7 -0
- data/lib/lookbook/modal_preview.rb +7 -0
- data/lib/lookbook/radio_preview.rb +9 -0
- data/lib/lookbook/select_preview.rb +13 -0
- data/lib/lookbook/switch_preview.rb +10 -0
- data/lib/lookbook/textarea_preview.rb +9 -0
- data/lib/turbo_material/version.rb +1 -1
- metadata +13 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c5202d5448845f0cc5510c5a877bdfc9d128d7d016b4eb42c73f6b3ff27cdd9
|
4
|
+
data.tar.gz: 7daaa56ab8ed778bf42d6a302b1fb64f7ef6741baffba33044147ea9a66d95ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c500bb6fe137b1300f5f58e4d16e9984f4f0e38c4cb072b44773e158a46ae183deadbc0712d462f7284a89a4bed2fa2197464349cb016a5945ccdc1360c671cd
|
7
|
+
data.tar.gz: 6a1b6fd662262bf5014aac7659e0c0858b291c3680540cd81366e37773437d03f9d4719915f5ad62ec15cfc952fba48525a1dd1c41e22bafe9ea7f49c7046bdc
|
data/README.md
CHANGED
@@ -211,6 +211,10 @@ aside.mdc-drawer.main-drawer {
|
|
211
211
|
}
|
212
212
|
```
|
213
213
|
|
214
|
+
## Tailwind Forms customizations leakage
|
215
|
+
|
216
|
+
This gem uses Tailwind for additional customizations, I am noticed that `@tailwindcss/forms` leaking to Material inputs adding partial white backgrounds. For now I would recommend to disable forms plugin while using this gem.
|
217
|
+
|
214
218
|
## Installation
|
215
219
|
Add this line to your application's Gemfile:
|
216
220
|
|
@@ -230,15 +234,13 @@ $ gem install turbo_material
|
|
230
234
|
|
231
235
|
## Lookbook documentation for components
|
232
236
|
|
233
|
-
Gem implements [Lookbook](https://lookbook.build) documentation for all components.
|
237
|
+
Gem implements [Lookbook](https://lookbook.build) documentation for all components. To use it in the application, add `gem 'lookbook'` to your Gemfile and run `bundle install`. Then add following to your `config/application.rb`:
|
234
238
|
|
235
|
-
```
|
236
|
-
|
237
|
-
cd test/dummy
|
238
|
-
foreman start -f Procfile.dev
|
239
|
+
```ruby
|
240
|
+
config.lookbook.preview_paths = [TurboMaterial::Engine.root.join('lib/lookbook')]
|
239
241
|
```
|
240
242
|
|
241
|
-
|
243
|
+
Or extend your existing config for `lookbook.preview_paths` with same value.
|
242
244
|
|
243
245
|
## Contributing
|
244
246
|
This gem is open for new contributions. Use [Material Components for Web documentation](https://github.com/material-components/material-components-web/tree/master/packages) as a references for missing functionality.
|
@@ -1,5 +1,5 @@
|
|
1
|
-
<%# locals: (form:, disabled: false, required: false, name:, label: nil, id:, checked: false, value: nil, parent: nil, frame: nil, selected_text: nil, fixed: false, options: [], hint: nil, helper: nil) %>
|
2
|
-
<div class="mdc-select mdc-select--filled
|
1
|
+
<%# locals: (form:, disabled: false, required: false, name:, label: nil, id:, checked: false, value: nil, parent: nil, frame: nil, selected_text: nil, fixed: false, options: [], hint: nil, helper: nil, additional_classes: 'w-full') %>
|
2
|
+
<div class="mdc-select mdc-select--filled <%= disabled ? ' mdc-select--disabled' : '' %><%= required ? ' mdc-select--required' : '' %> <%= additional_classes %>"
|
3
3
|
data-controller="material-select" <% if frame %> data-frame="<%= frame %>"<% end %> id="<%= id %>">
|
4
4
|
<%= form.hidden_field name.to_sym, value: value %>
|
5
5
|
<div class="mdc-select__anchor"
|
@@ -0,0 +1,8 @@
|
|
1
|
+
class CheckboxPreview < Lookbook::Preview
|
2
|
+
|
3
|
+
# @param label text
|
4
|
+
# @param disabled toggle
|
5
|
+
def default(label: 'Checkbox', disabled: false)
|
6
|
+
render 'common/form', helper_name: 'material_checkbox', label: label, name: 'checkbox', id: 'Checkbox', disabled: disabled
|
7
|
+
end
|
8
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class ChipsInputPreview < Lookbook::Preview
|
4
|
+
|
5
|
+
# @param label text
|
6
|
+
# @param disabled toggle
|
7
|
+
# @param required toggle
|
8
|
+
def default(label: 'Input', disabled: false, required: false)
|
9
|
+
render 'common/form', helper_name: 'material_chips_input',
|
10
|
+
url: '/countries', name: 'countries', label:, id: 'Input', disabled:,
|
11
|
+
required:,
|
12
|
+
options: Carmen::Country.all.map { |c| { id: c.alpha_3_code, label: c.name } }
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class ChipsSelectPreview < Lookbook::Preview
|
2
|
+
|
3
|
+
# @param label text
|
4
|
+
# @param disabled toggle
|
5
|
+
# @param required toggle
|
6
|
+
def default(label: 'Input', disabled: false, required: false)
|
7
|
+
render 'common/form', helper_name: 'material_chips_select', label: label, name: 'checkbox',
|
8
|
+
id: 'Input', disabled: disabled, value: [],
|
9
|
+
options: [
|
10
|
+
{ value: '1', label: 'Option 1' },
|
11
|
+
{ value: '2', label: 'Option 2' },
|
12
|
+
{ value: '3', label: 'Option 3' }
|
13
|
+
]
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
class InputPreview < Lookbook::Preview
|
2
|
+
|
3
|
+
# @param label text
|
4
|
+
# @param disabled toggle
|
5
|
+
# @param required toggle
|
6
|
+
def default(label: 'Input', disabled: false, required: false)
|
7
|
+
render 'common/form', helper_name: 'material_input', label: label, name: 'checkbox', id: 'Input', disabled: disabled, required: required
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
class RadioPreview < Lookbook::Preview
|
2
|
+
|
3
|
+
# @param label text
|
4
|
+
# @param disabled toggle
|
5
|
+
# @param required toggle
|
6
|
+
def default(label: 'Input', disabled: false, required: false)
|
7
|
+
render 'common/form', helper_name: 'material_radio', label: label, name: 'checkbox', id: 'Input', disabled: disabled, required: required
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class SelectPreview < Lookbook::Preview
|
2
|
+
|
3
|
+
# @param label text
|
4
|
+
# @param disabled toggle
|
5
|
+
# @param required toggle
|
6
|
+
def default(label: 'Select', disabled: false, required: false)
|
7
|
+
render 'common/form', helper_name: 'material_select', label: label, name: 'checkbox', id: 'Input', disabled: disabled, required: required, options: [
|
8
|
+
{ value: '', label: '-' },
|
9
|
+
{ value: 'on', label: 'On' },
|
10
|
+
{ value: 'off', label: 'Off' }
|
11
|
+
]
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
class SwitchPreview < Lookbook::Preview
|
2
|
+
|
3
|
+
# @param label text
|
4
|
+
# @param true_label text
|
5
|
+
# @param false_label text
|
6
|
+
# @param disabled toggle
|
7
|
+
def default(label: 'Switch', disabled: false, required: false, true_label: nil, false_label: nil)
|
8
|
+
render 'common/form', helper_name: 'material_switch', label: label, name: 'checkbox', id: 'Input', disabled: disabled, true_label: true_label, false_label: false_label
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
class TextareaPreview < Lookbook::Preview
|
2
|
+
|
3
|
+
# @param label text
|
4
|
+
# @param disabled toggle
|
5
|
+
# @param required toggle
|
6
|
+
def default(label: 'Text', disabled: false, required: false)
|
7
|
+
render 'common/form', helper_name: 'material_textarea', label: label, name: 'textarea', id: 'Text', disabled: disabled, required: required
|
8
|
+
end
|
9
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turbo_material
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergey Moiseev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -134,6 +134,16 @@ files:
|
|
134
134
|
- config/importmap.rb
|
135
135
|
- config/routes.rb
|
136
136
|
- config/tailwind.config.js
|
137
|
+
- lib/lookbook/checkbox_preview.rb
|
138
|
+
- lib/lookbook/chips_input_preview.rb
|
139
|
+
- lib/lookbook/chips_select_preview.rb
|
140
|
+
- lib/lookbook/input_preview.rb
|
141
|
+
- lib/lookbook/menu_button_preview.rb
|
142
|
+
- lib/lookbook/modal_preview.rb
|
143
|
+
- lib/lookbook/radio_preview.rb
|
144
|
+
- lib/lookbook/select_preview.rb
|
145
|
+
- lib/lookbook/switch_preview.rb
|
146
|
+
- lib/lookbook/textarea_preview.rb
|
137
147
|
- lib/tasks/turbo_material_tasks.rake
|
138
148
|
- lib/turbo_material.rb
|
139
149
|
- lib/turbo_material/engine.rb
|
@@ -160,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
160
170
|
- !ruby/object:Gem::Version
|
161
171
|
version: '0'
|
162
172
|
requirements: []
|
163
|
-
rubygems_version: 3.
|
173
|
+
rubygems_version: 3.4.12
|
164
174
|
signing_key:
|
165
175
|
specification_version: 4
|
166
176
|
summary: Material Web Components for Hotwire Turbo.
|