playbook_ui_docs 14.12.0.pre.alpha.PBNTR456fixedconftoastrailsautoclose5738 → 14.12.0.pre.alpha.PBNTR456fixedconftoastrailsautoclose5754

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2157a5705a89a2255f41b00ec03a170132064a685d54569e65986a30fbeded78
4
- data.tar.gz: 28701af4872b652ee0ae94d98219d66b6ba31f2177648836d7f8ef5679cbc7c6
3
+ metadata.gz: 78ad68a3a8cb94bf9de6d6caefa6d3918a6d6c469471e4dc32c88802a109feca
4
+ data.tar.gz: 65febeef99376d292a64ae2f677c65bbca8c9814a939d0d4d1c549347f6ec2dc
5
5
  SHA512:
6
- metadata.gz: f1093825873f938918776401eb41fecb72bdeef1e1d7f6a2458a409eb28e0943e9409fce1c0df605f047b2752a39c15098a98e5be89f1acbc86dad18efcef37d
7
- data.tar.gz: 5bbc66925afa97af118d5850c816af55f3bc019e0e0f8ca456e0dbb85ff11f28ee4466df2c4a235cbc0e379bc97585ea300806f9326368b2c75e597adb7dccc9
6
+ metadata.gz: ace02b69d3058994e0bf8b61569192e963feaf17b0b489b0285864ccb42f2b8580498c1a2d68654555de5e98d096d27e46fc4fc0e53e57bf8c5a26999947c484
7
+ data.tar.gz: cf1b1991c3ababd471f2bcc3404cd92b215d967ca0a473d2cac65e5b48646f3391b3b401479a6d03efa9215af844bd5c341ae9109f324409c66ab029487f163b
@@ -1,5 +1,16 @@
1
+ <%= pb_rails("button", props: { text: "Show Auto Close Toast", variant: "secondary", data: { toast: "#toast-auto-close" } }) %>
1
2
  <%= pb_rails("button", props: { text: "Show Closeable Auto Close Toast", variant: "secondary", data: { toast: "#toast-auto-close-closeable" } }) %>
2
3
 
4
+ <%= pb_rails("fixed_confirmation_toast", props: {
5
+ auto_close: 3000,
6
+ classname: "toast-to-hide",
7
+ id: "toast-auto-close",
8
+ text: "I will disappear in 3 seconds.",
9
+ status: "tip",
10
+ vertical: "top",
11
+ horizontal: "center"
12
+ }) %>
13
+
3
14
  <%= pb_rails("fixed_confirmation_toast", props: {
4
15
  auto_close: 10000,
5
16
  closeable: true,
@@ -11,23 +22,37 @@
11
22
  }) %>
12
23
 
13
24
  <script>
14
- document.addEventListener('DOMContentLoaded', () => {
15
- const toast10SecCloseable = document.querySelector("#toast-auto-close-closeable")
16
- const button10SecCloseable = document.querySelector("button[data-toast='#toast-auto-close-closeable']")
25
+ document.addEventListener('DOMContentLoaded', () => {
26
+ // Initialize toast elements and buttons
27
+ const toasts = {
28
+ '#toast-auto-close': document.querySelector("#toast-auto-close"),
29
+ '#toast-auto-close-closeable': document.querySelector("#toast-auto-close-closeable")
30
+ }
31
+
32
+ const buttons = {
33
+ '#toast-auto-close': document.querySelector("button[data-toast='#toast-auto-close']"),
34
+ '#toast-auto-close-closeable': document.querySelector("button[data-toast='#toast-auto-close-closeable']")
35
+ }
17
36
 
18
- const originalToast = toast10SecCloseable.cloneNode(true)
19
-
20
- if (toast10SecCloseable) {
21
- toast10SecCloseable.remove()
37
+ // Store original toasts and remove them from DOM
38
+ const originalToasts = {}
39
+ Object.entries(toasts).forEach(([id, toast]) => {
40
+ if (toast) {
41
+ originalToasts[id] = toast.cloneNode(true)
42
+ toast.remove()
22
43
  }
44
+ })
23
45
 
24
- if (button10SecCloseable) {
25
- button10SecCloseable.onclick = () => {
26
- const newToast = originalToast.cloneNode(true)
46
+ // Set up button click handlers
47
+ Object.keys(buttons).forEach((toastId) => {
48
+ const button = buttons[toastId]
49
+ if (button) {
50
+ button.onclick = () => {
51
+ const newToast = originalToasts[toastId].cloneNode(true)
27
52
  newToast.style.display = "flex"
28
-
29
53
  document.body.appendChild(newToast)
30
54
  }
31
55
  }
32
56
  })
57
+ })
33
58
  </script>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: playbook_ui_docs
3
3
  version: !ruby/object:Gem::Version
4
- version: 14.12.0.pre.alpha.PBNTR456fixedconftoastrailsautoclose5738
4
+ version: 14.12.0.pre.alpha.PBNTR456fixedconftoastrailsautoclose5754
5
5
  platform: ruby
6
6
  authors:
7
7
  - Power UX