playbook_ui_docs 14.13.0.pre.rc.4 → 14.13.0.pre.rc.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_auto_close.html.erb +58 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_auto_close_rails.md +3 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/example.yml +1 -0
- metadata +5 -3
- /data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/{_fixed_confirmation_toast_auto_close.md → _fixed_confirmation_toast_auto_close_react.md} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6779ed94ba3c4c709776ccfc734a8dd9bc577054f2470f1d8fd462bc11e989cb
|
4
|
+
data.tar.gz: 425067fcf4814285d4c2cd863e27ad9da5bd2df1f33f493c7f95fc9ad9162ecc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da79f8f9fca0ea7574c74dd9f2c3fb0fcda40bb02bd230309363bc413a6b44368669ea9d591804754646bcf1b005a2217b1ed7365a10401ba98cb305557433ff
|
7
|
+
data.tar.gz: 64b4e5bf2af287f06f15232cf507d8e22ac3e44b5e2c4a6a2cfd40e6f5b4af78a878dd81cd8c01d73548b29409eba57daa65c259c44ac545c5f200355f3583e7
|
@@ -0,0 +1,58 @@
|
|
1
|
+
<%= pb_rails("button", props: { text: "Show Auto Close Toast", variant: "secondary", data: { toast: "#toast-auto-close" } }) %>
|
2
|
+
<%= pb_rails("button", props: { text: "Show Closeable Auto Close Toast", variant: "secondary", data: { toast: "#toast-auto-close-closeable" } }) %>
|
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
|
+
|
14
|
+
<%= pb_rails("fixed_confirmation_toast", props: {
|
15
|
+
auto_close: 10000,
|
16
|
+
closeable: true,
|
17
|
+
id: "toast-auto-close-closeable",
|
18
|
+
text: "I will disappear in 10 seconds.",
|
19
|
+
status: "tip",
|
20
|
+
vertical: "top",
|
21
|
+
horizontal: "center"
|
22
|
+
}) %>
|
23
|
+
|
24
|
+
<script>
|
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
|
+
}
|
36
|
+
|
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()
|
43
|
+
}
|
44
|
+
})
|
45
|
+
|
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)
|
52
|
+
newToast.style.display = "flex"
|
53
|
+
document.body.appendChild(newToast)
|
54
|
+
}
|
55
|
+
}
|
56
|
+
})
|
57
|
+
})
|
58
|
+
</script>
|
@@ -0,0 +1,3 @@
|
|
1
|
+
Auto close is used when you want the confirmation toast to close automatically after a certain time. `auto_close` property will be a delay number in ms.
|
2
|
+
|
3
|
+
The script tag in this code snippet is for demonstration purposes only. It clones the toasts in order to have it appear with a button click prompt and not upon initial page load. In a typical production environment the event triggering a fixed confirmation toast to appear would be handled by a controller or a separate javascript file.
|
@@ -5,6 +5,7 @@ examples:
|
|
5
5
|
- fixed_confirmation_toast_multi_line: Multi Line
|
6
6
|
- fixed_confirmation_toast_close: Click to Close
|
7
7
|
- fixed_confirmation_toast_positions: Click to Show Positions
|
8
|
+
- fixed_confirmation_toast_auto_close: Click to Show Auto Close
|
8
9
|
- fixed_confirmation_toast_children: Children
|
9
10
|
- fixed_confirmation_toast_custom_icon: Custom Icon
|
10
11
|
|
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.13.0.pre.rc.
|
4
|
+
version: 14.13.0.pre.rc.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Power UX
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2025-01-
|
12
|
+
date: 2025-01-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: playbook_ui
|
@@ -811,8 +811,10 @@ files:
|
|
811
811
|
- app/pb_kits/playbook/pb_filter/docs/example.yml
|
812
812
|
- app/pb_kits/playbook/pb_filter/docs/index.js
|
813
813
|
- app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_description.md
|
814
|
+
- app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_auto_close.html.erb
|
814
815
|
- app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_auto_close.jsx
|
815
|
-
- app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/
|
816
|
+
- app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_auto_close_rails.md
|
817
|
+
- app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_auto_close_react.md
|
816
818
|
- app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_children.html.erb
|
817
819
|
- app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_children.jsx
|
818
820
|
- app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_children.md
|