@ -0,0 +1,18 @@
|
||||
export default class extends HTMLElement {
|
||||
connectedCallback () {
|
||||
const dialog = document.getElementById(this.dataset.target)
|
||||
|
||||
this.querySelector('button').addEventListener('click', () => {
|
||||
if (dialog) {
|
||||
dialog.inert = false
|
||||
dialog.showModal()
|
||||
}
|
||||
})
|
||||
|
||||
if (dialog) {
|
||||
dialog.addEventListener('close', () => {
|
||||
dialog.inert = true
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 389 B After Width: | Height: | Size: 408 B |
|
Before Width: | Height: | Size: 397 B After Width: | Height: | Size: 416 B |
|
Before Width: | Height: | Size: 412 B After Width: | Height: | Size: 431 B |
|
Before Width: | Height: | Size: 318 B After Width: | Height: | Size: 337 B |
|
Before Width: | Height: | Size: 448 B After Width: | Height: | Size: 467 B |
|
Before Width: | Height: | Size: 409 B After Width: | Height: | Size: 428 B |
|
Before Width: | Height: | Size: 416 B After Width: | Height: | Size: 435 B |
|
Before Width: | Height: | Size: 584 B After Width: | Height: | Size: 603 B |
|
Before Width: | Height: | Size: 290 B After Width: | Height: | Size: 309 B |
@ -1,18 +1,22 @@
|
||||
<% uuid = local_assigns[:uuid] || SecureRandom.uuid %>
|
||||
<input type="checkbox" id="<%= uuid %>" class="modal-toggle">
|
||||
<div id="<%= local_assigns[:id] %>" class="modal items-start !animate-none overflow-y-auto">
|
||||
<% title_id = "#{uuid}-title" %>
|
||||
<%= tag.dialog id: uuid, class: "modal items-start overflow-y-auto", inert: true, "aria-labelledby": (title_id if local_assigns[:title]) do %>
|
||||
<div class="modal-box pt-4 pb-6 px-6 mt-20 max-h-none">
|
||||
<% if local_assigns[:title] %>
|
||||
<div class="flex justify-between items-center border-b pb-2 mb-2 font-medium">
|
||||
<span>
|
||||
<span id="<%= title_id %>">
|
||||
<%= local_assigns[:title] %>
|
||||
</span>
|
||||
<label for="<%= uuid %>" class="text-xl">×</label>
|
||||
<form method="dialog">
|
||||
<button class="text-xl cursor-pointer w-6 h-6" aria-label="<%= t('close') %>">×</button>
|
||||
</form>
|
||||
</div>
|
||||
<% end %>
|
||||
<div>
|
||||
<%= yield %>
|
||||
</div>
|
||||
</div>
|
||||
<label class="modal-backdrop" for="<%= uuid %>"></label>
|
||||
</div>
|
||||
<form method="dialog" class="modal-backdrop">
|
||||
<button aria-label="<%= t('close') %>"></button>
|
||||
</form>
|
||||
<% end %>
|
||||
|
||||