turbo_material 0.3.4 → 0.3.5
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/README.md +55 -14
- data/Rakefile +5 -2
- data/app/assets/javascripts/turbo_material/material_chips_input_controller.js +10 -5
- data/app/assets/javascripts/turbo_material/material_chips_select_controller.js +10 -8
- data/app/assets/javascripts/turbo_material/material_drawer_controller.js +1 -11
- data/app/assets/javascripts/turbo_material/material_live_form_controller.js +81 -0
- data/app/assets/javascripts/turbo_material/material_menu_button_controller.js +11 -1
- data/app/views/common/_menu_contents.html.erb +1 -1
- data/app/views/components/_chip_set.html.erb +1 -1
- data/app/views/components/_chips_input.html.erb +5 -4
- data/app/views/components/_data_table.html.erb +5 -5
- data/app/views/components/_input.html.erb +1 -2
- data/app/views/components/_menu_button.html.erb +5 -4
- data/app/views/components/_modal.html.erb +5 -4
- data/app/views/components/_radio.html.erb +16 -20
- data/app/views/components/_select.html.erb +1 -2
- data/app/views/components/_switch.html.erb +2 -2
- data/app/views/components/_textarea.html.erb +1 -1
- data/app/views/lookbook/_data_table_headers.html.erb +1 -0
- data/app/views/lookbook/_data_table_rows.html.erb +6 -0
- data/app/views/lookbook/_drawer.html.erb +16 -0
- data/app/views/lookbook/_tooltip.html.erb +7 -0
- data/config/importmap.rb +1 -1
- data/lib/generators/turbo_material/install_generator.rb +2 -2
- data/lib/lookbook/chip_set_preview.rb +7 -0
- data/lib/lookbook/data_table_preview.rb +20 -0
- data/lib/lookbook/drawer_preview.rb +9 -0
- data/lib/lookbook/tooltip_preview.rb +8 -0
- data/lib/turbo_material/engine.rb +4 -8
- data/lib/turbo_material/version.rb +5 -1
- metadata +11 -3
- data/lib/turbo_material/post_install.rb +0 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d849c4052043a8f97f28b63570bf575b416400c6546d7c58d15b956926a852c5
|
|
4
|
+
data.tar.gz: fececa0b9159f4b469d39f7006b28d3d33acce302a3c9b610e70d13b014a8747
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c4c079e3d67ce542b61b0eb49d220003659bb0e9f857dac5a86b2471b9b5d191edcf1e6d6d9b00fe05b4ebe9af25a05afeb307d00ccc4052f24c601f5f5b9629
|
|
7
|
+
data.tar.gz: 771df3933b837efc574c93aa1df9f250e1b96794b2854fd115b349720df8c1186ec26531c82cb995412be5ae083ed54100c0f2fed67d0590c6a4daf59185276b
|
data/README.md
CHANGED
|
@@ -30,11 +30,13 @@ eagerLoadControllersFrom("turbo_material", application)
|
|
|
30
30
|
Add following to your `app/view/layouts/application.html.erb` in `<head>` section:
|
|
31
31
|
|
|
32
32
|
```erb
|
|
33
|
-
<link href="
|
|
34
|
-
<script src="
|
|
33
|
+
<link href="https://cdn.jsdelivr.net/npm/material-components-web@14.0.0/dist/material-components-web.min.css" rel="stylesheet" integrity="sha256-YPguGDqg55HB8+tbrJBbWuiF9J+XCK7sjscaiwFMTxI=" crossorigin="anonymous">
|
|
34
|
+
<script src="https://cdn.jsdelivr.net/npm/material-components-web@14.0.0/dist/material-components-web.min.js" integrity="sha256-8DHMt+TYs1kVcO+R+oZYTrHYIYwHUOChiQsqKb2BT3g=" crossorigin="anonymous"></script>
|
|
35
35
|
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
+
The `integrity` hashes match MDC 14.0.0 (`TurboMaterial::MDC_VERSION`); they are also available as `TurboMaterial::MDC_CSS_SRI` and `TurboMaterial::MDC_JS_SRI`.
|
|
39
|
+
|
|
38
40
|
Follow `test/dummy` in this project for examples.
|
|
39
41
|
|
|
40
42
|
### Material Components for Web customizations
|
|
@@ -310,19 +312,24 @@ Implements [Material Design Checkbox](https://github.com/material-components/mat
|
|
|
310
312
|
Implements [Material Design Radio button](https://github.com/material-components/material-components-web/tree/master/packages/mdc-radio) component.
|
|
311
313
|
|
|
312
314
|
```erb
|
|
313
|
-
<%= material_radio name: '
|
|
315
|
+
<%= material_radio name: 'size', id: 'size', form: form, label: 'Size', value: 'm',
|
|
316
|
+
options: [{ value: 's', label: 'Small' }, { value: 'm', label: 'Medium' }] %>
|
|
314
317
|
```
|
|
315
318
|
|
|
319
|
+
Renders one radio per option. Without `options` it renders Yes/No (`'true'`/`'false'`), and a blank `value` selects No.
|
|
320
|
+
|
|
316
321
|
#### Options
|
|
317
322
|
|
|
318
323
|
| Option | Type | Description |
|
|
319
324
|
| --- | --- | --- |
|
|
320
|
-
| `name` | String |
|
|
321
|
-
| `id` | String |
|
|
325
|
+
| `name` | String | Field name |
|
|
326
|
+
| `id` | String | ID prefix; each radio gets `<id>-1`, `<id>-2`, … |
|
|
322
327
|
| `form` | Object | Form object |
|
|
323
|
-
| `label` | String |
|
|
324
|
-
| `
|
|
325
|
-
| `value` | String |
|
|
328
|
+
| `label` | String | Group label |
|
|
329
|
+
| `options` | Array | `[{ value:, label: }]`, defaults to Yes/No |
|
|
330
|
+
| `value` | String | Currently selected value |
|
|
331
|
+
| `disabled` | Boolean | Whether the radios are disabled |
|
|
332
|
+
| `required` | Boolean | Whether a choice is required |
|
|
326
333
|
| `parent` | Object | Radio button parent |
|
|
327
334
|
|
|
328
335
|
### Switch button
|
|
@@ -330,16 +337,19 @@ Implements [Material Design Radio button](https://github.com/material-components
|
|
|
330
337
|
Implements [Material Design Switch button](https://github.com/material-components/material-components-web/tree/master/packages/mdc-switch) component.
|
|
331
338
|
|
|
332
339
|
```erb
|
|
333
|
-
<%= material_switch label: 'Switch', true_label: 'On', false_label: 'Off' %>
|
|
340
|
+
<%= material_switch form: form, name: 'notify', id: 'notify', label: 'Switch', true_label: 'On', false_label: 'Off' %>
|
|
334
341
|
```
|
|
335
342
|
|
|
336
343
|
#### Options
|
|
337
344
|
|
|
338
345
|
| Option | Type | Description |
|
|
339
346
|
| --- | --- | --- |
|
|
347
|
+
| `form` | Object | Form object |
|
|
348
|
+
| `name` | String | Field name (submitted through a hidden field) |
|
|
349
|
+
| `id` | String | Switch button ID, also used by its label |
|
|
350
|
+
| `value` | Boolean | Current state |
|
|
340
351
|
| `label` | String | Switch button label text |
|
|
341
352
|
| `disabled` | Boolean | Whether the switch is disabled |
|
|
342
|
-
| `required` | Boolean | Whether the switch is required |
|
|
343
353
|
| `true_label` | String | Text that displays when switch is on |
|
|
344
354
|
| `false_label` | String | Text that displays when switch is off |
|
|
345
355
|
|
|
@@ -400,9 +410,12 @@ Implements [Material Design Chip](https://github.com/material-components/materia
|
|
|
400
410
|
Implements [Material Design Chips Input](https://github.com/material-components/material-components-web/tree/master/packages/mdc-chips) component.
|
|
401
411
|
|
|
402
412
|
```erb
|
|
403
|
-
<%= material_chips_input form: form, name: 'tags',
|
|
413
|
+
<%= material_chips_input form: form, name: 'tags', id: 'tags', label: 'Tags', url: tags_path,
|
|
414
|
+
selected: [{ id: 1, label: 'Tag 1' }, { id: 2, label: 'Tag 2' }] %>
|
|
404
415
|
```
|
|
405
416
|
|
|
417
|
+
The hidden `name` field holds the comma-separated `id`s of the chips. Each `selected` and `options` entry needs an `id` and a `label`. The `url` endpoint receives `query`, `exclude` (current ids), `suffix`, `name` and `opened`, and responds with a Turbo Stream that re-renders `material_chips_input_options`.
|
|
418
|
+
|
|
406
419
|
#### Options
|
|
407
420
|
|
|
408
421
|
| Option | Type | Description |
|
|
@@ -417,9 +430,9 @@ Implements [Material Design Chips Input](https://github.com/material-components/
|
|
|
417
430
|
| `suffix` | String | Suffix of the input |
|
|
418
431
|
| `type` | String | Type of the input |
|
|
419
432
|
| `url` | String | URL for fetching options |
|
|
420
|
-
| `selected` | Array |
|
|
421
|
-
| `options` | Array |
|
|
422
|
-
| `value` | String |
|
|
433
|
+
| `selected` | Array | Selected chips, `[{ id:, label: }]` |
|
|
434
|
+
| `options` | Array | Available options, `[{ id:, label: }]` |
|
|
435
|
+
| `value` | String | Initial hidden value; defaults to the `selected` ids |
|
|
423
436
|
| `fixed` | Boolean | Whether the input is fixed |
|
|
424
437
|
| `prefetch` | Boolean | Whether to prefetch options |
|
|
425
438
|
| `additional_query_params` | Hash | Additional query parameters |
|
|
@@ -475,6 +488,9 @@ Implements [Material Design Data Table](https://github.com/material-components/m
|
|
|
475
488
|
| `pagy` | Object | Pagy object for pagination |
|
|
476
489
|
| `table_headers_partial` | String | Partial name for table headers |
|
|
477
490
|
| `table_contents_partial` | String | Partial name for table contents |
|
|
491
|
+
| `per_page_options` | Array | Rows-per-page choices, `[{ value:, label: }]`; default 10/25/50/100 |
|
|
492
|
+
|
|
493
|
+
The rows-per-page form uses the gem's `material-live-form` Stimulus controller: it submits on change (debounced 2s for text input, configurable with `data-material-live-form-delay-value`) and keeps focus and caret position across the Turbo re-render. Rows need `data-row-id`. Selecting rows sends `PUT <url>/<row id>/select` and `PUT <url>/select_all`; sorting visits `<url>?order=<column>&reverse=<bool>`.
|
|
478
494
|
|
|
479
495
|
### Data Table Row Checkbox
|
|
480
496
|
|
|
@@ -598,6 +614,31 @@ Implements [Material Design Tooltip](https://github.com/material-components/mate
|
|
|
598
614
|
| --- | --- |--------------------------------------|
|
|
599
615
|
| `id` | String | DOM ID of the element we displaying the tooltip for |
|
|
600
616
|
|
|
617
|
+
### Drawer
|
|
618
|
+
|
|
619
|
+
Stimulus controllers for the [Material Design Drawer](https://github.com/material-components/material-components-web/tree/master/packages/mdc-drawer); the markup is yours.
|
|
620
|
+
|
|
621
|
+
```erb
|
|
622
|
+
<button data-controller="drawer-button" data-drawer-button-material-drawer-outlet="#drawer"
|
|
623
|
+
data-action="click->drawer-button#click">menu</button>
|
|
624
|
+
<aside id="drawer" class="mdc-drawer mdc-drawer--dismissible mdc-drawer--right"
|
|
625
|
+
data-controller="material-drawer"
|
|
626
|
+
data-material-drawer-opened-value="true"
|
|
627
|
+
data-material-drawer-name-value="sidebar"
|
|
628
|
+
data-material-drawer-open-url-value="<%= drawer_open_path %>"
|
|
629
|
+
data-material-drawer-close-url-value="<%= drawer_close_path %>">
|
|
630
|
+
<div class="mdc-drawer__content">...</div>
|
|
631
|
+
</aside>
|
|
632
|
+
```
|
|
633
|
+
|
|
634
|
+
| Value | Description |
|
|
635
|
+
| --- | --- |
|
|
636
|
+
| `opened` | Initial state. When `true`, the drawer also opens at ≥1024px and closes below it as the viewport changes. Leave it out to keep MDC's default and send no request on load |
|
|
637
|
+
| `open-url`, `close-url` | Optional; receive `PUT` with `{ name }` whenever the drawer opens or closes, e.g. to remember the state in the session |
|
|
638
|
+
| `name` | Sent with those requests |
|
|
639
|
+
|
|
640
|
+
`drawer-button` hides itself unless the page has a `.mdc-drawer--dismissible.mdc-drawer--right` drawer.
|
|
641
|
+
|
|
601
642
|
## Lookbook documentation for components
|
|
602
643
|
|
|
603
644
|
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`:
|
data/Rakefile
CHANGED
|
@@ -5,6 +5,9 @@ require 'bundler/setup'
|
|
|
5
5
|
APP_RAKEFILE = File.expand_path('test/dummy/Rakefile', __dir__)
|
|
6
6
|
load 'rails/tasks/engine.rake'
|
|
7
7
|
|
|
8
|
-
load 'rails/tasks/statistics.rake'
|
|
9
|
-
|
|
10
8
|
require 'bundler/gem_tasks'
|
|
9
|
+
|
|
10
|
+
# engine.rake only defines app:test, which runs the dummy app's own test folder.
|
|
11
|
+
desc 'Run the engine tests'
|
|
12
|
+
task(:test) { sh 'bin/rails test' }
|
|
13
|
+
task default: :test
|
|
@@ -43,7 +43,7 @@ export default class extends Controller {
|
|
|
43
43
|
chipEl.append(text, icon);
|
|
44
44
|
this.chipsetEl.insertBefore(chipEl, this.hiddenTarget);
|
|
45
45
|
this.chips.addChip(chipEl);
|
|
46
|
-
this.
|
|
46
|
+
this.syncHidden();
|
|
47
47
|
this.search();
|
|
48
48
|
}
|
|
49
49
|
|
|
@@ -51,15 +51,20 @@ export default class extends Controller {
|
|
|
51
51
|
event.stopPropagation();
|
|
52
52
|
event.preventDefault();
|
|
53
53
|
const chip = this.element.querySelector(`.mdc-chip[data-value="${CSS.escape(event.target.dataset.value)}"]`);
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
// ponytail: chips have no ids, so MDC's getIndexOfChipById("") would hit the first chip
|
|
55
|
+
chip.remove();
|
|
56
|
+
this.syncHidden();
|
|
57
|
+
if (!this.hiddenTarget.value) {
|
|
57
58
|
this.input.foundation.adapter.floatLabel(false);
|
|
58
59
|
}
|
|
59
|
-
this.hiddenTarget.value = this.chips.chipsList.map((chip) => chip.root.dataset.value).join(',');
|
|
60
60
|
this.search();
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
// Read chips from the DOM so server-rendered `selected` chips count too.
|
|
64
|
+
syncHidden() {
|
|
65
|
+
this.hiddenTarget.value = Array.from(this.chipsetEl.querySelectorAll('.mdc-chip[data-value]'), (chip) => chip.dataset.value).join(',');
|
|
66
|
+
}
|
|
67
|
+
|
|
63
68
|
open() {
|
|
64
69
|
if ((this.opened && this.panelTarget.classList.contains('mdc-menu-surface--open')) || (parseInt(this.panelTarget.dataset.size) === 0)) return;
|
|
65
70
|
|
|
@@ -22,6 +22,7 @@ export default class extends Controller {
|
|
|
22
22
|
this.select.foundation.adapter.floatLabel(true);
|
|
23
23
|
this.selectedValue.forEach(item => {
|
|
24
24
|
let listItem = this.listItem(item);
|
|
25
|
+
if (!listItem) return; // selected value not among options
|
|
25
26
|
this.addChip(listItem.dataset.label, listItem.dataset.value, listItem.dataset.confirmed);
|
|
26
27
|
listItem.classList.add('!hidden');
|
|
27
28
|
});
|
|
@@ -59,9 +60,7 @@ export default class extends Controller {
|
|
|
59
60
|
chipEl.append(text, icon);
|
|
60
61
|
this.chipsetEl.appendChild(chipEl);
|
|
61
62
|
this.materialChipset.addChip(chipEl);
|
|
62
|
-
|
|
63
|
-
this.hiddenTarget.value = this.materialChipset.chipsList.map((chip) => chip.root.dataset.value).join(',');
|
|
64
|
-
}
|
|
63
|
+
this.syncHidden();
|
|
65
64
|
if (this.urlValue) {
|
|
66
65
|
post(this.urlValue, {
|
|
67
66
|
body: {
|
|
@@ -77,11 +76,8 @@ export default class extends Controller {
|
|
|
77
76
|
event.preventDefault();
|
|
78
77
|
const chip = this.element.querySelector(`.mdc-chip[data-value="${CSS.escape(event.target.dataset.value)}"]`);
|
|
79
78
|
this.chipsetEl.removeChild(chip);
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
const selected = this.listItem(event.target.dataset.value);
|
|
84
|
-
selected.classList.remove('!hidden');
|
|
79
|
+
this.syncHidden();
|
|
80
|
+
this.listItem(event.target.dataset.value)?.classList.remove('!hidden');
|
|
85
81
|
if (this.urlValue) {
|
|
86
82
|
destroy(`${this.urlValue}/${event.target.dataset.value}`, {
|
|
87
83
|
responseKind: "turbo-stream",
|
|
@@ -92,6 +88,12 @@ export default class extends Controller {
|
|
|
92
88
|
}
|
|
93
89
|
}
|
|
94
90
|
|
|
91
|
+
// Read chips from the DOM: MDCChipSet.chipsList keeps chips removed with removeChild.
|
|
92
|
+
syncHidden() {
|
|
93
|
+
if (!this.hasHiddenTarget) return;
|
|
94
|
+
this.hiddenTarget.value = Array.from(this.chipsetEl.querySelectorAll('.mdc-chip[data-value]'), (chip) => chip.dataset.value).join(',');
|
|
95
|
+
}
|
|
96
|
+
|
|
95
97
|
toggle(event) {
|
|
96
98
|
if (this.confirmableValue) {
|
|
97
99
|
event.stopPropagation();
|
|
@@ -11,7 +11,7 @@ export default class extends Controller {
|
|
|
11
11
|
|
|
12
12
|
connect() {
|
|
13
13
|
this.drawer = mdc.drawer.MDCDrawer.attachTo(this.element);
|
|
14
|
-
if (this.
|
|
14
|
+
if (this.hasOpenedValue) {
|
|
15
15
|
if (this.openedValue) {
|
|
16
16
|
this.open();
|
|
17
17
|
} else {
|
|
@@ -35,16 +35,6 @@ export default class extends Controller {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
isLg({ name, media, matches, event }) {
|
|
39
|
-
if (this.openedValue) {
|
|
40
|
-
if(matches) {
|
|
41
|
-
this.open();
|
|
42
|
-
} else {
|
|
43
|
-
this.close();
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
38
|
open() {
|
|
49
39
|
this.drawer.open = true;
|
|
50
40
|
if (this.openUrlValue) {
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Controller } from "@hotwired/stimulus";
|
|
2
|
+
|
|
3
|
+
// Auto-submits a form: debounced on `submit`, immediately on `submitNow`.
|
|
4
|
+
// Keeps focus and caret position across the Turbo re-render.
|
|
5
|
+
// Extracted from itu-online-admissions' live_form_controller (lodash debounce → setTimeout).
|
|
6
|
+
const FOCUSABLE_INPUTS = [
|
|
7
|
+
"text", "textarea", "number", "email", "password", "search", "tel", "url", "date", "time",
|
|
8
|
+
"datetime-local", "color", "range"
|
|
9
|
+
];
|
|
10
|
+
|
|
11
|
+
export default class extends Controller {
|
|
12
|
+
static values = { delay: { type: Number, default: 2000 } }
|
|
13
|
+
|
|
14
|
+
initialize() {
|
|
15
|
+
this.submitStart = this.submitStart.bind(this)
|
|
16
|
+
this.submitEnd = this.submitEnd.bind(this)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
connect() {
|
|
20
|
+
if (window.liveForm === undefined) {
|
|
21
|
+
window.liveForm = {}
|
|
22
|
+
document.addEventListener('turbo:submit-start', this.submitStart)
|
|
23
|
+
document.addEventListener('turbo:submit-end', this.submitEnd)
|
|
24
|
+
} else if (window.liveForm.focused) {
|
|
25
|
+
this.restoreFocus(window.liveForm.focused, window.liveForm.selectionStart, window.liveForm.selectionEnd)
|
|
26
|
+
window.liveForm = {}
|
|
27
|
+
}
|
|
28
|
+
this.element.classList.add('live-form');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
disconnect() {
|
|
32
|
+
clearTimeout(this.timer)
|
|
33
|
+
document.removeEventListener('turbo:submit-start', this.submitStart)
|
|
34
|
+
document.removeEventListener('turbo:submit-end', this.submitEnd)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
submitStart() {
|
|
38
|
+
document.body.classList.add('turbo-loading')
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
submitEnd() {
|
|
42
|
+
document.body.classList.remove('turbo-loading')
|
|
43
|
+
const active = document.activeElement || document.body
|
|
44
|
+
window.liveForm.selectionStart = active.selectionStart
|
|
45
|
+
window.liveForm.selectionEnd = active.selectionEnd
|
|
46
|
+
window.liveForm.focused = active.id
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
restoreFocus(focusedId, selectionStart, selectionEnd) {
|
|
50
|
+
const focused = document.getElementById(focusedId)
|
|
51
|
+
if (!focused || !FOCUSABLE_INPUTS.includes(focused.type)) return
|
|
52
|
+
if (focused.readOnly) focused.blur()
|
|
53
|
+
if (!focused.matches(":focus")) focused.focus()
|
|
54
|
+
if (focused.setSelectionRange && (focused.type === "text" || focused.type === "textarea")) {
|
|
55
|
+
focused.setSelectionRange(selectionStart, selectionEnd)
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
submit(event) {
|
|
60
|
+
if (event.target.dataset.autosave === "off") return
|
|
61
|
+
clearTimeout(this.timer)
|
|
62
|
+
this.timer = setTimeout(() => this.submitNow(event), this.delayValue)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
submitNow(event) {
|
|
66
|
+
clearTimeout(this.timer)
|
|
67
|
+
const frame = event.target.dataset.frame
|
|
68
|
+
if (frame !== undefined) {
|
|
69
|
+
let input = this.element.querySelector("input[type='hidden'][name='frame']")
|
|
70
|
+
if (!input) {
|
|
71
|
+
input = document.createElement("input")
|
|
72
|
+
input.type = "hidden"
|
|
73
|
+
input.name = "frame"
|
|
74
|
+
this.element.appendChild(input)
|
|
75
|
+
}
|
|
76
|
+
input.value = frame
|
|
77
|
+
}
|
|
78
|
+
this.element.requestSubmit()
|
|
79
|
+
setTimeout(() => this.element.querySelector("input[type='hidden'][name='frame']")?.remove(), 1000)
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -12,15 +12,25 @@ export default class extends Controller {
|
|
|
12
12
|
this.menu.setAnchorElement(button);
|
|
13
13
|
this.menu.setAnchorCorner(mdc.menu.Corner.BOTTOM_START);
|
|
14
14
|
this.menu.setFixedPosition(true);
|
|
15
|
+
// MDC's outside-click handler closes the menu before our click handler runs,
|
|
16
|
+
// so remember the state from before the click starts.
|
|
17
|
+
this.rememberOpen = () => { this.wasOpen = this.menu.open; };
|
|
18
|
+
button.addEventListener('pointerdown', this.rememberOpen);
|
|
19
|
+
button.addEventListener('keydown', this.rememberOpen);
|
|
20
|
+
this.button = button;
|
|
15
21
|
}
|
|
16
22
|
|
|
17
23
|
disconnect() {
|
|
24
|
+
this.button?.removeEventListener('pointerdown', this.rememberOpen);
|
|
25
|
+
this.button?.removeEventListener('keydown', this.rememberOpen);
|
|
18
26
|
this.menu?.destroy();
|
|
19
27
|
this.ripple?.destroy();
|
|
20
28
|
}
|
|
21
29
|
|
|
22
30
|
toggleMenu(event) {
|
|
23
|
-
|
|
31
|
+
const wasOpen = this.wasOpen ?? this.menu.open;
|
|
32
|
+
this.wasOpen = undefined;
|
|
33
|
+
if (wasOpen) {
|
|
24
34
|
this.close();
|
|
25
35
|
} else {
|
|
26
36
|
this.open();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<ul class="mdc-deprecated-list mdc-deprecated-list--icon-list" role="menu" aria-
|
|
1
|
+
<ul class="mdc-deprecated-list mdc-deprecated-list--icon-list" role="menu" aria-orientation="vertical" tabindex="-1">
|
|
2
2
|
<li class="mdc-deprecated-list-item" role="menuitem">
|
|
3
3
|
<span class="mdc-deprecated-list-item__ripple"></span>
|
|
4
4
|
<span class="mdc-deprecated-list-item__icon material-icons">person</span>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<%# locals: (chips: []) %>
|
|
2
|
-
<span class="mdc-chip-set" role="grid"
|
|
2
|
+
<span class="mdc-chip-set" role="grid">
|
|
3
3
|
<span class="mdc-chip-set__chips" role="presentation">
|
|
4
4
|
<%- chips.each do |chip| -%>
|
|
5
5
|
<%= material_chip label: chip[:label] %>
|
|
@@ -14,14 +14,15 @@
|
|
|
14
14
|
<span id="<%= id %>-label" class="mdc-floating-label top-6!"><%= label %></span>
|
|
15
15
|
<div class="mdc-chip-set mdc-chip-set--input pt-8! w-full" role="grid">
|
|
16
16
|
<%- selected.each do |chip| -%>
|
|
17
|
-
<div class="mdc-chip">
|
|
17
|
+
<div class="mdc-chip" data-value="<%= chip[:id] %>">
|
|
18
18
|
<div class="mdc-chip__text"><%= chip[:label] %></div>
|
|
19
|
-
|
|
19
|
+
<i class="material-icons mdc-chip__icon mdc-chip__icon--trailing" tabindex="0" role="button"
|
|
20
|
+
data-action="click->material-chips-input#removeChip" data-value="<%= chip[:id] %>">cancel</i>
|
|
20
21
|
</div>
|
|
21
22
|
<%- end -%>
|
|
22
|
-
<%= form.hidden_field name.to_sym, value: value, data: { 'material-chips-input-target': 'hidden' } %>
|
|
23
|
+
<%= form.hidden_field name.to_sym, value: value || selected.map { |chip| chip[:id] }.join(','), data: { 'material-chips-input-target': 'hidden' } %>
|
|
23
24
|
<%= form.text_field "#{name}_".to_sym,
|
|
24
|
-
class: 'mdc-text-field__input', value:
|
|
25
|
+
class: 'mdc-text-field__input', value: nil,
|
|
25
26
|
id: id, 'aria-labelledby' => id + '-label',
|
|
26
27
|
required: required,
|
|
27
28
|
disabled: disabled,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
<%# locals: (name:, table_body:, url:, table_params:, records:, selected_records:, pagy:, table_headers_partial:, table_contents_partial:) %>
|
|
1
|
+
<%# locals: (name:, table_body:, url:, table_params:, records:, selected_records:, pagy:, table_headers_partial:, table_contents_partial:, per_page_options: [10, 25, 50, 100].map { |n| { value: n, label: n.to_s } }) %>
|
|
2
2
|
<div class="mdc-data-table w-full" data-controller="material-data-table"
|
|
3
3
|
data-material-data-table-body-value="<%= table_body %>"
|
|
4
4
|
data-material-data-table-url-value="<%= url %>"
|
|
5
5
|
data-material-data-table-query-string-value="<%= table_params.to_query %>">
|
|
6
6
|
<div class="mdc-data-table__table-container">
|
|
7
|
-
<table class="mdc-data-table__table
|
|
7
|
+
<table class="mdc-data-table__table" aria-label="<%= name %>">
|
|
8
8
|
<thead>
|
|
9
9
|
<tr class="mdc-data-table__header-row">
|
|
10
10
|
<th class="mdc-data-table__header-cell mdc-data-table__header-cell--checkbox" role="columnheader" scope="col">
|
|
11
|
-
<div class="mdc-checkbox mdc-data-table__header-row-checkbox
|
|
11
|
+
<div class="mdc-checkbox mdc-data-table__header-row-checkbox">
|
|
12
12
|
<input type="checkbox" class="mdc-checkbox__native-control" aria-label="Toggle all rows"/>
|
|
13
13
|
<div class="mdc-checkbox__background">
|
|
14
14
|
<svg class="mdc-checkbox__checkmark" viewBox="0 0 24 24">
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
<%= form_with(url: url, method: :get, data: {
|
|
38
38
|
turbo_frame: table_body,
|
|
39
39
|
turbo_action: 'advance',
|
|
40
|
-
controller: 'live-form',
|
|
41
|
-
action: 'input->live-form#submit submit-now->live-form#submitNow' }, autocomplete: 'off') do |form| %>
|
|
40
|
+
controller: 'material-live-form',
|
|
41
|
+
action: 'input->material-live-form#submit submit-now->material-live-form#submitNow' }, autocomplete: 'off') do |form| %>
|
|
42
42
|
<% params.keys.select { |k| k.starts_with?('ransack') }.each do |key| -%>
|
|
43
43
|
<%= form.hidden_field key, value: params[key] %>
|
|
44
44
|
<%- end -%>
|
|
@@ -40,8 +40,7 @@
|
|
|
40
40
|
<div class="mdc-text-field-helper-text--validation-msg text-sm text-red-500 hidden jserror">
|
|
41
41
|
</div>
|
|
42
42
|
<%- parent&.errors&.[](name.to_sym)&.each do |msg| -%>
|
|
43
|
-
<div class="mdc-text-field-helper-text--validation-msg text-sm text-red-500"
|
|
44
|
-
aria-hidden="true">
|
|
43
|
+
<div class="mdc-text-field-helper-text--validation-msg text-sm text-red-500" role="alert">
|
|
45
44
|
<%= msg %>
|
|
46
45
|
</div>
|
|
47
46
|
<%- end -%>
|
|
@@ -11,10 +11,11 @@
|
|
|
11
11
|
</span>
|
|
12
12
|
</button>
|
|
13
13
|
<div class="mdc-menu mdc-menu-surface <%= custom_surface_css %>">
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
<%- else -%>
|
|
14
|
+
<%# block_given? is always true in a partial, so branch on the local %>
|
|
15
|
+
<%- if menu_contents_partial -%>
|
|
17
16
|
<%= render partial: menu_contents_partial %>
|
|
18
|
-
|
|
17
|
+
<%- else -%>
|
|
18
|
+
<%= yield %>
|
|
19
|
+
<%- end -%>
|
|
19
20
|
</div>
|
|
20
21
|
</div>
|
|
@@ -18,11 +18,12 @@
|
|
|
18
18
|
</div>
|
|
19
19
|
</h2>
|
|
20
20
|
<div id="<%= id %>-content" class="mdc-dialog__content">
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
<%- else -%>
|
|
21
|
+
<%# block_given? is always true in a partial, so branch on the local %>
|
|
22
|
+
<%- if contents_partial -%>
|
|
24
23
|
<%= render partial: contents_partial, locals: { form: form } %>
|
|
25
|
-
|
|
24
|
+
<%- else -%>
|
|
25
|
+
<%= yield %>
|
|
26
|
+
<%- end -%>
|
|
26
27
|
</div>
|
|
27
28
|
<div class="mdc-dialog__actions">
|
|
28
29
|
<button type="button" class="mdc-button mdc-dialog__button mdc-dialog__close" data-action="click->material-dialog#close">
|
|
@@ -1,28 +1,24 @@
|
|
|
1
|
-
<%# locals: (form:, disabled: false, required: false, name:, label: nil, id:, checked: false, value: nil, parent: nil) %>
|
|
1
|
+
<%# locals: (form:, disabled: false, required: false, name:, label: nil, id:, checked: false, value: nil, parent: nil, options: [{ value: 'true', label: 'Yes' }, { value: 'false', label: 'No' }]) %>
|
|
2
|
+
<%# ponytail: nil value selects 'false' so the default Yes/No keeps treating a blank boolean as No %>
|
|
3
|
+
<%- current = value.nil? ? 'false' : value.to_s -%>
|
|
2
4
|
<div class="mdc-form-field flex flex-col">
|
|
3
5
|
<label>
|
|
4
6
|
<%= label || name.capitalize %>
|
|
5
7
|
</label>
|
|
6
8
|
<div class="flex flex-row items-center w-full">
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
<div class="mdc-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
<%- options.each_with_index do |option, idx| -%>
|
|
10
|
+
<%- option_id = "#{id}-#{idx + 1}" -%>
|
|
11
|
+
<div class="mdc-radio <%= disabled ? 'mdc-radio--disabled' : '' %>" data-controller="material-radio">
|
|
12
|
+
<%= form.radio_button name.to_sym, option[:value], class: 'mdc-radio__native-control', id: option_id,
|
|
13
|
+
checked: option[:value].to_s == current, disabled: disabled, required: required %>
|
|
14
|
+
<div class="mdc-radio__background">
|
|
15
|
+
<div class="mdc-radio__outer-circle"></div>
|
|
16
|
+
<div class="mdc-radio__inner-circle"></div>
|
|
17
|
+
</div>
|
|
18
|
+
<div class="mdc-radio__ripple"></div>
|
|
19
|
+
<div class="mdc-radio__focus-ring"></div>
|
|
12
20
|
</div>
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
</div>
|
|
16
|
-
<label for="<%= id %>-1">Yes</label>
|
|
17
|
-
<div class="mdc-radio <%= disabled ? 'mdc-radio--disabled' : '' %>">
|
|
18
|
-
<%= form.radio_button name.to_sym, 'false', class: 'mdc-radio__native-control', id: id + '-2', checked: !value, disabled: disabled %>
|
|
19
|
-
<div class="mdc-radio__background">
|
|
20
|
-
<div class="mdc-radio__outer-circle"></div>
|
|
21
|
-
<div class="mdc-radio__inner-circle"></div>
|
|
22
|
-
</div>
|
|
23
|
-
<div class="mdc-radio__ripple"></div>
|
|
24
|
-
<div class="mdc-radio__focus-ring"></div>
|
|
25
|
-
</div>
|
|
26
|
-
<label for="<%= id %>-2">No</label>
|
|
21
|
+
<label for="<%= option_id %>"><%= option[:label] %></label>
|
|
22
|
+
<%- end -%>
|
|
27
23
|
</div>
|
|
28
24
|
</div>
|
|
@@ -51,8 +51,7 @@
|
|
|
51
51
|
<div class="mdc-text-field-helper-text" aria-hidden="true"><%= helper %></div>
|
|
52
52
|
<%- end -%>
|
|
53
53
|
<%- parent&.errors&.[](name.to_sym)&.each do |msg| -%>
|
|
54
|
-
<div class="mdc-text-field-helper-text--validation-msg text-sm text-red-500"
|
|
55
|
-
aria-hidden="true">
|
|
54
|
+
<div class="mdc-text-field-helper-text--validation-msg text-sm text-red-500" role="alert">
|
|
56
55
|
<%= msg %>
|
|
57
56
|
</div>
|
|
58
57
|
<%- end -%>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<%# locals: (form:, disabled: false, name:, label: nil, id:, value: nil, true_label: nil, false_label: nil, frame: nil) %>
|
|
2
2
|
<div data-controller="material-switch" <% if frame %> data-frame="<%= frame %>"<% end %>>
|
|
3
|
-
<button id="
|
|
3
|
+
<button id="<%= id %>"class="mdc-switch <%= cast_boolean(value) ? 'mdc-switch--selected' : '' %>"
|
|
4
4
|
type="button" role="switch" aria-checked="<%= cast_boolean(value) ? 'true' : 'false' %>" <% if disabled %>disabled<% end %>>
|
|
5
5
|
<div class="mdc-switch__track"></div>
|
|
6
6
|
<div class="mdc-switch__handle-track">
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
<div class="mdc-switch__focus-ring"></div>
|
|
24
24
|
</span>
|
|
25
25
|
</button>
|
|
26
|
-
<label for="
|
|
26
|
+
<label for="<%= id %>">
|
|
27
27
|
<% if cast_boolean(value) %>
|
|
28
28
|
<%= true_label || label %>
|
|
29
29
|
<% else %>
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
<div class="mdc-text-field-helper-text" aria-hidden="true"><%= helper %></div>
|
|
23
23
|
<%- end -%>
|
|
24
24
|
<%- parent&.errors&.[](name.to_sym)&.each do |msg| -%>
|
|
25
|
-
<div class="mdc-text-field-helper-text--validation-msg text-sm text-red-500"
|
|
25
|
+
<div class="mdc-text-field-helper-text--validation-msg text-sm text-red-500" role="alert">
|
|
26
26
|
<%= msg %>
|
|
27
27
|
</div>
|
|
28
28
|
<%- end -%>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= material_data_table_sortable_header label: 'Name', column_id: 'name', sort_value: aria_sort('name', default: true) %>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<%- records.each do |record| -%>
|
|
2
|
+
<tr class="mdc-data-table__row" data-row-id="<%= record[:id] %>">
|
|
3
|
+
<%= material_data_table_row_checkbox id: "row-#{record[:id]}", checked: selected_records.include?(record[:id]) %>
|
|
4
|
+
<td class="mdc-data-table__cell" id="row-<%= record[:id] %>"><%= record[:name] %></td>
|
|
5
|
+
</tr>
|
|
6
|
+
<%- end -%>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<%# locals: (opened:) %>
|
|
2
|
+
<div class="flex">
|
|
3
|
+
<div class="grow p-4">
|
|
4
|
+
<button class="mdc-icon-button material-icons" id="drawer-toggle"
|
|
5
|
+
data-controller="drawer-button" data-drawer-button-material-drawer-outlet="#drawer"
|
|
6
|
+
data-action="click->drawer-button#click">menu</button>
|
|
7
|
+
</div>
|
|
8
|
+
<aside id="drawer" class="mdc-drawer mdc-drawer--dismissible mdc-drawer--right"
|
|
9
|
+
data-controller="material-drawer"
|
|
10
|
+
data-material-drawer-opened-value="<%= opened %>"
|
|
11
|
+
data-material-drawer-name-value="preview"
|
|
12
|
+
data-material-drawer-open-url-value="/drawer/open"
|
|
13
|
+
data-material-drawer-close-url-value="/drawer/close">
|
|
14
|
+
<div class="mdc-drawer__content p-4">Drawer content</div>
|
|
15
|
+
</aside>
|
|
16
|
+
</div>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<%# locals: (text:) %>
|
|
2
|
+
<div class="p-6">
|
|
3
|
+
<button class="mdc-button" id="tooltip-anchor" aria-describedby="preview-tooltip" data-tooltip-id="preview-tooltip">
|
|
4
|
+
<span class="mdc-button__label">Hover me</span>
|
|
5
|
+
</button>
|
|
6
|
+
<%= material_tooltip(id: 'preview-tooltip') { text } %>
|
|
7
|
+
</div>
|
data/config/importmap.rb
CHANGED
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
pin_all_from File.expand_path('../app/assets/javascripts', __dir__)
|
|
4
4
|
pin '@rails/request.js', to: 'https://ga.jspm.io/npm:@rails/request.js@0.0.9/src/index.js'
|
|
5
5
|
pin 'stimulus-use', to: 'https://ga.jspm.io/npm:stimulus-use@0.51.3/dist/index.js'
|
|
6
|
-
pin 'hotkeys-js', to: 'https://ga.jspm.io/npm:hotkeys-js@3.10.2/dist/hotkeys.esm.js'
|
|
6
|
+
pin 'hotkeys-js', to: 'https://ga.jspm.io/npm:hotkeys-js@3.10.2/dist/hotkeys.esm.js' # imported by stimulus-use
|
|
@@ -7,8 +7,8 @@ module TurboMaterial
|
|
|
7
7
|
HEAD_LINKS = <<-HTML.rstrip.freeze
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
<link href="
|
|
11
|
-
<script src="
|
|
10
|
+
<link href="https://cdn.jsdelivr.net/npm/material-components-web@#{MDC_VERSION}/dist/material-components-web.min.css" rel="stylesheet" integrity="#{MDC_CSS_SRI}" crossorigin="anonymous">
|
|
11
|
+
<script src="https://cdn.jsdelivr.net/npm/material-components-web@#{MDC_VERSION}/dist/material-components-web.min.js" integrity="#{MDC_JS_SRI}" crossorigin="anonymous"></script>
|
|
12
12
|
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">#{' '}
|
|
13
13
|
HTML
|
|
14
14
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class DataTablePreview < Lookbook::Preview
|
|
4
|
+
Pagy = Data.define(:page, :limit, :count) do
|
|
5
|
+
def last = (count.to_f / limit).ceil
|
|
6
|
+
def from = ((page - 1) * limit) + 1
|
|
7
|
+
def to = [page * limit, count].min
|
|
8
|
+
def prev = page > 1 ? page - 1 : nil
|
|
9
|
+
def next = page < last ? page + 1 : nil
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def default
|
|
13
|
+
records = [{ id: 1, name: 'Alpha' }, { id: 2, name: 'Beta' }, { id: 3, name: 'Gamma' }]
|
|
14
|
+
render 'common/standalone', helper_name: 'material_data_table',
|
|
15
|
+
name: 'Items', table_body: 'items', url: '/items', table_params: {},
|
|
16
|
+
records:, selected_records: [2], pagy: Pagy.new(page: 1, limit: 10, count: 3),
|
|
17
|
+
table_headers_partial: 'lookbook/data_table_headers',
|
|
18
|
+
table_contents_partial: 'lookbook/data_table_rows'
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -29,16 +29,12 @@ module TurboMaterial
|
|
|
29
29
|
app.config.importmap.cache_sweepers << root.join('app/assets/javascripts')
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
-
#
|
|
32
|
+
# The manifest links every engine JS and CSS file for production precompile.
|
|
33
33
|
initializer 'turbo_material.assets' do |app|
|
|
34
|
-
app.config.assets
|
|
35
|
-
end
|
|
34
|
+
next unless app.config.respond_to?(:assets) # no asset pipeline in the host
|
|
36
35
|
|
|
37
|
-
|
|
38
|
-
app.config.assets.
|
|
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'
|
|
36
|
+
app.config.assets.paths << root.join('app/assets/javascripts') << root.join('app/assets/dist')
|
|
37
|
+
app.config.assets.precompile += %w[turbo_material_manifest] if app.config.assets.precompile # Sprockets only
|
|
42
38
|
end
|
|
43
39
|
end
|
|
44
40
|
end
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module TurboMaterial
|
|
4
|
-
VERSION = '0.3.
|
|
4
|
+
VERSION = '0.3.5'
|
|
5
5
|
MDC_VERSION = '14.0.0'
|
|
6
|
+
# SRI for MDC_VERSION's dist/*.min.{css,js}: "hash" (base64 SHA-256) from
|
|
7
|
+
# https://data.jsdelivr.com/v1/packages/npm/material-components-web@<version>. Update with MDC_VERSION.
|
|
8
|
+
MDC_CSS_SRI = 'sha256-YPguGDqg55HB8+tbrJBbWuiF9J+XCK7sjscaiwFMTxI='
|
|
9
|
+
MDC_JS_SRI = 'sha256-8DHMt+TYs1kVcO+R+oZYTrHYIYwHUOChiQsqKb2BT3g='
|
|
6
10
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: turbo_material
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sergey Moiseev
|
|
@@ -91,6 +91,7 @@ files:
|
|
|
91
91
|
- app/assets/javascripts/turbo_material/material_drawer_controller.js
|
|
92
92
|
- app/assets/javascripts/turbo_material/material_input_controller.js
|
|
93
93
|
- app/assets/javascripts/turbo_material/material_list_controller.js
|
|
94
|
+
- app/assets/javascripts/turbo_material/material_live_form_controller.js
|
|
94
95
|
- app/assets/javascripts/turbo_material/material_menu_button_controller.js
|
|
95
96
|
- app/assets/javascripts/turbo_material/material_menu_surface_controller.js
|
|
96
97
|
- app/assets/javascripts/turbo_material/material_radio_controller.js
|
|
@@ -145,13 +146,20 @@ files:
|
|
|
145
146
|
- app/views/components/data_table/_sortable_header.html.erb
|
|
146
147
|
- app/views/layouts/turbo_material/application.html.erb
|
|
147
148
|
- app/views/layouts/turbo_material/lookbook.html.erb
|
|
149
|
+
- app/views/lookbook/_data_table_headers.html.erb
|
|
150
|
+
- app/views/lookbook/_data_table_rows.html.erb
|
|
151
|
+
- app/views/lookbook/_drawer.html.erb
|
|
152
|
+
- app/views/lookbook/_tooltip.html.erb
|
|
148
153
|
- config/importmap.rb
|
|
149
154
|
- config/routes.rb
|
|
150
155
|
- config/tailwind.config.js
|
|
151
156
|
- lib/generators/turbo_material/install_generator.rb
|
|
152
157
|
- lib/lookbook/checkbox_preview.rb
|
|
158
|
+
- lib/lookbook/chip_set_preview.rb
|
|
153
159
|
- lib/lookbook/chips_input_preview.rb
|
|
154
160
|
- lib/lookbook/chips_select_preview.rb
|
|
161
|
+
- lib/lookbook/data_table_preview.rb
|
|
162
|
+
- lib/lookbook/drawer_preview.rb
|
|
155
163
|
- lib/lookbook/input_preview.rb
|
|
156
164
|
- lib/lookbook/menu_button_preview.rb
|
|
157
165
|
- lib/lookbook/modal_preview.rb
|
|
@@ -159,11 +167,11 @@ files:
|
|
|
159
167
|
- lib/lookbook/select_preview.rb
|
|
160
168
|
- lib/lookbook/switch_preview.rb
|
|
161
169
|
- lib/lookbook/textarea_preview.rb
|
|
170
|
+
- lib/lookbook/tooltip_preview.rb
|
|
162
171
|
- lib/tasks/install.rake
|
|
163
172
|
- lib/tasks/turbo_material_tasks.rake
|
|
164
173
|
- lib/turbo_material.rb
|
|
165
174
|
- lib/turbo_material/engine.rb
|
|
166
|
-
- lib/turbo_material/post_install.rb
|
|
167
175
|
- lib/turbo_material/version.rb
|
|
168
176
|
homepage: https://github.com/full-stack-biz/turbo_material
|
|
169
177
|
licenses:
|
|
@@ -192,7 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
192
200
|
- !ruby/object:Gem::Version
|
|
193
201
|
version: '0'
|
|
194
202
|
requirements: []
|
|
195
|
-
rubygems_version:
|
|
203
|
+
rubygems_version: 4.0.20
|
|
196
204
|
specification_version: 4
|
|
197
205
|
summary: Material Web Components for Hotwire Turbo.
|
|
198
206
|
test_files: []
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module TurboMaterial
|
|
4
|
-
def self.post_install
|
|
5
|
-
puts 'TurboMaterial: Running post install tasks...'
|
|
6
|
-
rescue StandardError => e
|
|
7
|
-
puts "TurboMaterial: Failed to update Tailwind configuration. Error: #{e.message}"
|
|
8
|
-
puts "You may need to run 'bin/rails turbo_material:install' manually to complete the setup."
|
|
9
|
-
end
|
|
10
|
-
end
|