plutonium 0.15.11 → 0.15.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/plutonium.js +3 -9
- data/app/assets/plutonium.js.map +2 -2
- data/app/assets/plutonium.min.js +5 -5
- data/app/assets/plutonium.min.js.map +3 -3
- data/app/views/plutonium/_flash_alerts.html.erb +1 -2
- data/app/views/plutonium/_flash_toasts.html.erb +1 -2
- data/lib/plutonium/ui/dyna_frame/host.rb +1 -1
- data/lib/plutonium/version.rb +1 -1
- data/src/js/controllers/resource_dismiss_controller.js +3 -13
- metadata +1 -1
@@ -20,7 +20,6 @@
|
|
20
20
|
%>
|
21
21
|
|
22
22
|
<div data-controller="resource-dismiss"
|
23
|
-
data-resource-dismiss-target="target"
|
24
23
|
data-resource-dismiss-after-value="6000"
|
25
24
|
class="flex items-center p-4 mb-4 text-<%= color %>-800 rounded-lg bg-<%= color %>-50 dark:bg-stone-300 dark:text-<%= color %>-400"
|
26
25
|
role="alert">
|
@@ -45,7 +44,7 @@
|
|
45
44
|
<div class="ms-3 text-sm font-normal"><%= msg %></div>
|
46
45
|
<button type="button"
|
47
46
|
class="ms-auto -mx-1.5 -my-1.5 bg-<%= color %>-50 text-<%= color %>-500 rounded-lg focus:ring-2 focus:ring-<%= color %>-400 p-1.5 hover:bg-<%= color %>-200 inline-flex items-center justify-center h-8 w-8 dark:bg-stone-300 dark:text-<%= color %>-400 dark:hover:bg-gray-700"
|
48
|
-
data-resource-dismiss
|
47
|
+
data-action="click->resource-dismiss#dismiss"
|
49
48
|
aria-label="Close">
|
50
49
|
<span class="sr-only">Close</span>
|
51
50
|
<svg class="w-3 h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 14">
|
@@ -19,7 +19,6 @@
|
|
19
19
|
%>
|
20
20
|
|
21
21
|
<div data-controller="resource-dismiss"
|
22
|
-
data-resource-dismiss-target="target"
|
23
22
|
data-resource-dismiss-after-value="6000"
|
24
23
|
class="fixed z-50 top-16 inset-x-0 mx-auto flex items-center w-full max-w-md p-4 text-gray-500 bg-<%= color %>-50 rounded-lg shadow dark:text-<%= color %>-400 dark:bg-gray-800 dark:border dark:border-gray-700 dark:shadow-none"
|
25
24
|
role="alert">
|
@@ -47,7 +46,7 @@
|
|
47
46
|
<div class="ms-3 text-sm font-normal"><%= msg %></div>
|
48
47
|
<button type="button"
|
49
48
|
class="ms-auto -mx-1.5 -my-1.5 bg-<%= color %>-50 text-<%= color %>-400 rounded-lg focus:ring-2 focus:ring-<%= color %>-400 p-1.5 hover:bg-<%= color %>-200 inline-flex items-center justify-center h-8 w-8 dark:text-<%= color %>-400 dark:bg-gray-800 dark:hover:bg-gray-700"
|
50
|
-
data-resource-dismiss
|
49
|
+
data-action="click->resource-dismiss#dismiss"
|
51
50
|
aria-label="Close">
|
52
51
|
<span class="sr-only">Close</span>
|
53
52
|
<svg class="w-3 h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 14">
|
@@ -12,7 +12,7 @@ module Plutonium
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def view_template(&)
|
15
|
-
turbo_frame_tag(@id, src: @src, loading: @loading, **@attributes, class:
|
15
|
+
turbo_frame_tag(@id, src: @src, loading: @loading, **@attributes, class: "dyna", refresh: "morph", &)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
data/lib/plutonium/version.rb
CHANGED
@@ -1,11 +1,7 @@
|
|
1
1
|
import { Controller } from "@hotwired/stimulus"
|
2
|
-
import { Dismiss } from 'flowbite';
|
3
|
-
|
4
2
|
|
5
3
|
// Connects to data-controller="resource-dismiss"
|
6
4
|
export default class extends Controller {
|
7
|
-
static targets = ["trigger", "target"]
|
8
|
-
|
9
5
|
static values = {
|
10
6
|
after: Number,
|
11
7
|
}
|
@@ -13,14 +9,9 @@ export default class extends Controller {
|
|
13
9
|
connect() {
|
14
10
|
console.log(`resource-dismiss connected: ${this.element}`)
|
15
11
|
|
16
|
-
// https://flowbite.com/docs/components/alerts/#javascript-behaviour
|
17
|
-
this.dismiss = new Dismiss(this.targetTarget, this.triggerTarget);
|
18
|
-
|
19
|
-
console.log(this.hasAfterValue)
|
20
|
-
console.log(this.afterValue)
|
21
12
|
if (this.hasAfterValue && this.afterValue > 0) {
|
22
13
|
this.autoDismissTimeout = setTimeout(() => {
|
23
|
-
this.
|
14
|
+
this.dismiss()
|
24
15
|
this.autoDismissTimeout = null
|
25
16
|
}, this.afterValue);
|
26
17
|
}
|
@@ -29,11 +20,10 @@ export default class extends Controller {
|
|
29
20
|
disconnect() {
|
30
21
|
if (this.autoDismissTimeout) clearTimeout(this.autoDismissTimeout)
|
31
22
|
|
32
|
-
this.dismiss = null
|
33
23
|
this.autoDismissTimeout = null
|
34
24
|
}
|
35
25
|
|
36
|
-
|
37
|
-
this.
|
26
|
+
dismiss() {
|
27
|
+
this.element.remove()
|
38
28
|
}
|
39
29
|
}
|