playbook_ui_docs 16.3.0.pre.alpha.PLAY2779dropdowncustomeventtype14814 → 16.3.0.pre.alpha.PLAY2782RTEPOCs14847
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/app/pb_kits/playbook/pb_dropdown/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_lexxy_default.html.erb +1 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_lexxy_default.md +1 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_quill_default.html.erb +1 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_quill_default.md +1 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_tiptap_default.html.erb +1 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_tiptap_default.md +1 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/example.yml +3 -0
- metadata +8 -4
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_custom_event_type.html.erb +0 -224
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_custom_event_type.md +0 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: efef1934021c9309797dd15f3dbf712e4c95e8e8affebfa7192ff7f70e2048f0
|
|
4
|
+
data.tar.gz: a8bc4593e2739a3f311a48f2864e4a4591a35efabca6dc37d0633f1fd62e1a1c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bce457e3715a19e86a40cd38a254767aa433a05a36722af32916ec8ae03bbab1f69881af873befc897e5db34872d4a8e9397d91aeb4f21b93b11118d37929184
|
|
7
|
+
data.tar.gz: dc1acc8eb5433d3959757fc1a9a446367fc9a0d47ed0a837a365b808f04156b86827851c9d90d8916089ccee88a517a871329a9f1e277c78910c3b87e59fb089
|
|
@@ -33,7 +33,6 @@ examples:
|
|
|
33
33
|
- dropdown_quickpick_with_date_pickers_rails: Quick Pick with Date Pickers
|
|
34
34
|
- dropdown_quickpick_with_date_pickers_default_rails: Quick Pick with Date Pickers (Default Value)
|
|
35
35
|
- dropdown_required_indicator: Required Indicator
|
|
36
|
-
- dropdown_custom_event_type: Custom Event Type
|
|
37
36
|
|
|
38
37
|
react:
|
|
39
38
|
- dropdown_default: Default
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= pb_rails("rich_text_editor_lexxy", props: { input_options: { id: 'lexxy_editor_id', name: "hidden_input_name" }, placeholder: "Write something…" }) %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Lexxy (37signals / Lexical) kit — form-associated custom element; submits with the form like a textarea. Attachments disabled in this demo. Use `pb_rails("rich_text_editor_lexxy", props: { input_options: { id: "...", name: "..." }, placeholder: "..." })`.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= pb_rails("rich_text_editor_quill", props: { input_options: { id: 'hidden_input_id', name: "hidden_input_name" }, value: "Add your text here. You can format your text, add links, quotes, and bullets." }) %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Quill kit — framework-agnostic editor with Snow theme. Content is synced to a hidden input for Rails form submission. Use `pb_rails("rich_text_editor_quill", props: { input_options: { id: "...", name: "..." }, value: "..." })`.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= pb_rails("rich_text_editor_tiptap", props: { input_options: { id: 'hidden_input_id', name: "hidden_input_name" }, value: "Add your text here. You can format your text, add links, quotes, and bullets." }) %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
TipTap (vanilla JS) kit — no React. Same editor core as the React TipTap variant; content is synced to a hidden input for Rails form submission. Use `pb_rails("rich_text_editor_tiptap", props: { input_options: { id: "...", name: "..." }, value: "..." })`.
|
|
@@ -11,6 +11,9 @@ examples:
|
|
|
11
11
|
- rich_text_editor_inline: Inline
|
|
12
12
|
- rich_text_editor_required_indicator: Required Indicator
|
|
13
13
|
- rich_text_editor_preview: Preview
|
|
14
|
+
- rich_text_editor_tiptap_default: "TipTap (Vanilla JS)"
|
|
15
|
+
- rich_text_editor_quill_default: "Quill"
|
|
16
|
+
- rich_text_editor_lexxy_default: "Lexxy"
|
|
14
17
|
|
|
15
18
|
react:
|
|
16
19
|
- rich_text_editor_default: Default
|
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: 16.3.0.pre.alpha.
|
|
4
|
+
version: 16.3.0.pre.alpha.PLAY2782RTEPOCs14847
|
|
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: 2026-03-
|
|
12
|
+
date: 2026-03-09 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: playbook_ui
|
|
@@ -863,8 +863,6 @@ files:
|
|
|
863
863
|
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_closing_options.md
|
|
864
864
|
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_closing_options_rails.html.erb
|
|
865
865
|
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_closing_options_rails.md
|
|
866
|
-
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_custom_event_type.html.erb
|
|
867
|
-
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_custom_event_type.md
|
|
868
866
|
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default.jsx
|
|
869
867
|
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default.md
|
|
870
868
|
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_rails.html.erb
|
|
@@ -1984,10 +1982,14 @@ files:
|
|
|
1984
1982
|
- app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_inline.jsx
|
|
1985
1983
|
- app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_label.jsx
|
|
1986
1984
|
- app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_label.md
|
|
1985
|
+
- app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_lexxy_default.html.erb
|
|
1986
|
+
- app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_lexxy_default.md
|
|
1987
1987
|
- app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_more_extensions.jsx
|
|
1988
1988
|
- app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_more_extensions.md
|
|
1989
1989
|
- app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb
|
|
1990
1990
|
- app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx
|
|
1991
|
+
- app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_quill_default.html.erb
|
|
1992
|
+
- app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_quill_default.md
|
|
1991
1993
|
- app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_required_indicator.html.erb
|
|
1992
1994
|
- app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_required_indicator.jsx
|
|
1993
1995
|
- app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_required_indicator.md
|
|
@@ -1997,6 +1999,8 @@ files:
|
|
|
1997
1999
|
- app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_sticky.jsx
|
|
1998
2000
|
- app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_templates.html.erb
|
|
1999
2001
|
- app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_templates.jsx
|
|
2002
|
+
- app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_tiptap_default.html.erb
|
|
2003
|
+
- app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_tiptap_default.md
|
|
2000
2004
|
- app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_toolbar_bottom.html.erb
|
|
2001
2005
|
- app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_toolbar_bottom.jsx
|
|
2002
2006
|
- app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_toolbar_disabled.jsx
|
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
<%
|
|
2
|
-
default_options = [
|
|
3
|
-
{ label: 'United States', value: 'unitedStates', id: 'us' },
|
|
4
|
-
{ label: 'Canada', value: 'canada', id: 'ca' },
|
|
5
|
-
{ label: 'Pakistan', value: 'pakistan', id: 'pk' },
|
|
6
|
-
{ label: 'India', value: 'India', id: 'in' },
|
|
7
|
-
{ label: 'Mexico', value: 'Mexico', id: 'mx' },
|
|
8
|
-
]
|
|
9
|
-
|
|
10
|
-
multi_options = [
|
|
11
|
-
{ label: 'United States', value: 'unitedStates', id: 'us' },
|
|
12
|
-
{ label: 'Canada', value: 'canada', id: 'ca' },
|
|
13
|
-
{ label: 'Pakistan', value: 'pakistan', id: 'pk' },
|
|
14
|
-
{ label: 'India', value: 'india', id: 'in' },
|
|
15
|
-
{ label: 'United Kingdom', value: 'unitedKingdom', id: 'uk' },
|
|
16
|
-
]
|
|
17
|
-
|
|
18
|
-
autocomplete_options = [
|
|
19
|
-
{ label: "United States", value: "unitedStates", areaCode: "+1", icon: "🇺🇸", id: "us" },
|
|
20
|
-
{ label: "United Kingdom", value: "unitedKingdom", areaCode: "+44", icon: "🇬🇧", id: "gb" },
|
|
21
|
-
{ label: "Pakistan", value: "pakistan", areaCode: "+92", icon: "🇵🇰", id: "pk" },
|
|
22
|
-
]
|
|
23
|
-
|
|
24
|
-
custom_display_options = [
|
|
25
|
-
{ label: "Strong Bad", value: "strongBad", id: "strong-bad", status: "Offline" },
|
|
26
|
-
{ label: "Strong Mad", value: "strongMad", id: "strong-mad", status: "Online" },
|
|
27
|
-
{ label: "Strong Sad", value: "strongSad", id: "strong-sad", status: "Away" },
|
|
28
|
-
]
|
|
29
|
-
|
|
30
|
-
custom_display_content = capture do
|
|
31
|
-
pb_rails("flex", props: { align: "center" }) do
|
|
32
|
-
concat(pb_rails("avatar", props: { name: "", size: "xs", id: "cet-dropdown-avatar" }))
|
|
33
|
-
concat(pb_rails("body", props: { text: "", size: "xs", margin_x: "xs", id: "cet-dropdown-avatar-name" }))
|
|
34
|
-
concat(pb_rails("badge", props: { text: "", id: "cet-dropdown-avatar-status" }))
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
%>
|
|
38
|
-
|
|
39
|
-
<!-- Example 1: Default dropdown -->
|
|
40
|
-
<%= pb_rails("dropdown", props: {
|
|
41
|
-
custom_event_type: "form:submitted,pb:dropdown:clearRequest",
|
|
42
|
-
id: "dropdown-default-cet",
|
|
43
|
-
label: "Default dropdown",
|
|
44
|
-
margin_bottom: "sm",
|
|
45
|
-
options: default_options,
|
|
46
|
-
}) %>
|
|
47
|
-
<%= pb_rails("flex", props: { wrap: true, gap: "sm", align: "center", margin_bottom: "md" }) do %>
|
|
48
|
-
<%= pb_rails("button", props: { id: "clear-default-cet", text: "Clear", variant: "primary" }) %>
|
|
49
|
-
<%= pb_rails("button", props: { id: "select-default-cet", text: "Select Canada", variant: "secondary" }) %>
|
|
50
|
-
<%= pb_rails("button", props: { id: "simulate-default-cet", text: "Simulate form submit", variant: "secondary" }) %>
|
|
51
|
-
<% end %>
|
|
52
|
-
|
|
53
|
-
<script>
|
|
54
|
-
(function() {
|
|
55
|
-
var id = "dropdown-default-cet";
|
|
56
|
-
document.getElementById("clear-default-cet").addEventListener("click", function() {
|
|
57
|
-
document.dispatchEvent(new CustomEvent("pb:dropdown:clearRequest", { detail: { dropdownId: id } }));
|
|
58
|
-
});
|
|
59
|
-
document.getElementById("select-default-cet").addEventListener("click", function() {
|
|
60
|
-
document.dispatchEvent(new CustomEvent("pb:dropdown:select", { detail: { dropdownId: id, optionId: "ca" } }));
|
|
61
|
-
});
|
|
62
|
-
document.getElementById("simulate-default-cet").addEventListener("click", function() {
|
|
63
|
-
document.dispatchEvent(new CustomEvent("form:submitted", { detail: { dropdownId: id } }));
|
|
64
|
-
});
|
|
65
|
-
})();
|
|
66
|
-
</script>
|
|
67
|
-
|
|
68
|
-
<!-- Example 2: Multi select -->
|
|
69
|
-
<%= pb_rails("dropdown", props: {
|
|
70
|
-
custom_event_type: "form:submitted,pb:dropdown:clearRequest",
|
|
71
|
-
id: "dropdown-multi-cet",
|
|
72
|
-
label: "Multi select dropdown",
|
|
73
|
-
margin_bottom: "sm",
|
|
74
|
-
multi_select: true,
|
|
75
|
-
options: multi_options,
|
|
76
|
-
}) %>
|
|
77
|
-
<%= pb_rails("flex", props: { wrap: true, gap: "sm", align: "center", margin_bottom: "md" }) do %>
|
|
78
|
-
<%= pb_rails("button", props: { id: "clear-multi-cet", text: "Clear", variant: "primary" }) %>
|
|
79
|
-
<%= pb_rails("button", props: { id: "select-multi-cet", text: "Select US + UK", variant: "secondary" }) %>
|
|
80
|
-
<%= pb_rails("button", props: { id: "simulate-multi-cet", text: "Simulate form submit", variant: "secondary" }) %>
|
|
81
|
-
<% end %>
|
|
82
|
-
|
|
83
|
-
<script>
|
|
84
|
-
(function() {
|
|
85
|
-
var id = "dropdown-multi-cet";
|
|
86
|
-
document.getElementById("clear-multi-cet").addEventListener("click", function() {
|
|
87
|
-
document.dispatchEvent(new CustomEvent("pb:dropdown:clearRequest", { detail: { dropdownId: id } }));
|
|
88
|
-
});
|
|
89
|
-
document.getElementById("select-multi-cet").addEventListener("click", function() {
|
|
90
|
-
document.dispatchEvent(new CustomEvent("pb:dropdown:select", { detail: { dropdownId: id, optionIds: ["us", "uk"] } }));
|
|
91
|
-
});
|
|
92
|
-
document.getElementById("simulate-multi-cet").addEventListener("click", function() {
|
|
93
|
-
document.dispatchEvent(new CustomEvent("form:submitted", { detail: { dropdownId: id } }));
|
|
94
|
-
});
|
|
95
|
-
})();
|
|
96
|
-
</script>
|
|
97
|
-
|
|
98
|
-
<!-- Example 3: Autocomplete -->
|
|
99
|
-
<%= pb_rails("dropdown", props: {
|
|
100
|
-
autocomplete: true,
|
|
101
|
-
custom_event_type: "form:submitted,pb:dropdown:clearRequest",
|
|
102
|
-
id: "dropdown-autocomplete-cet",
|
|
103
|
-
label: "Autocomplete dropdown",
|
|
104
|
-
margin_bottom: "sm",
|
|
105
|
-
options: autocomplete_options,
|
|
106
|
-
}) %>
|
|
107
|
-
<%= pb_rails("flex", props: { wrap: true, gap: "sm", align: "center", margin_bottom: "md" }) do %>
|
|
108
|
-
<%= pb_rails("button", props: { id: "clear-autocomplete-cet", text: "Clear", variant: "primary" }) %>
|
|
109
|
-
<%= pb_rails("button", props: { id: "select-autocomplete-cet", text: "Select Pakistan", variant: "secondary" }) %>
|
|
110
|
-
<%= pb_rails("button", props: { id: "simulate-autocomplete-cet", text: "Simulate form submit", variant: "secondary" }) %>
|
|
111
|
-
<% end %>
|
|
112
|
-
|
|
113
|
-
<script>
|
|
114
|
-
(function() {
|
|
115
|
-
var id = "dropdown-autocomplete-cet";
|
|
116
|
-
document.getElementById("clear-autocomplete-cet").addEventListener("click", function() {
|
|
117
|
-
document.dispatchEvent(new CustomEvent("pb:dropdown:clearRequest", { detail: { dropdownId: id } }));
|
|
118
|
-
});
|
|
119
|
-
document.getElementById("select-autocomplete-cet").addEventListener("click", function() {
|
|
120
|
-
document.dispatchEvent(new CustomEvent("pb:dropdown:select", { detail: { dropdownId: id, optionId: "pk" } }));
|
|
121
|
-
});
|
|
122
|
-
document.getElementById("simulate-autocomplete-cet").addEventListener("click", function() {
|
|
123
|
-
document.dispatchEvent(new CustomEvent("form:submitted", { detail: { dropdownId: id } }));
|
|
124
|
-
});
|
|
125
|
-
})();
|
|
126
|
-
</script>
|
|
127
|
-
|
|
128
|
-
<!-- Example 4: Quick pick (Date Range) -->
|
|
129
|
-
<%= pb_rails("dropdown", props: {
|
|
130
|
-
custom_event_type: "form:submitted,pb:dropdown:clearRequest",
|
|
131
|
-
id: "dropdown-quickpick-cet",
|
|
132
|
-
label: "Quickpick dropdown",
|
|
133
|
-
margin_bottom: "sm",
|
|
134
|
-
variant: "quickpick",
|
|
135
|
-
}) %>
|
|
136
|
-
<%= pb_rails("flex", props: { wrap: true, gap: "sm", align: "center", margin_bottom: "md" }) do %>
|
|
137
|
-
<%= pb_rails("button", props: { id: "clear-quickpick-cet", text: "Clear", variant: "primary" }) %>
|
|
138
|
-
<%= pb_rails("button", props: { id: "select-quickpick-cet", text: "Select This Week", variant: "secondary" }) %>
|
|
139
|
-
<%= pb_rails("button", props: { id: "simulate-quickpick-cet", text: "Simulate form submit", variant: "secondary" }) %>
|
|
140
|
-
<% end %>
|
|
141
|
-
|
|
142
|
-
<script>
|
|
143
|
-
(function() {
|
|
144
|
-
var id = "dropdown-quickpick-cet";
|
|
145
|
-
document.getElementById("clear-quickpick-cet").addEventListener("click", function() {
|
|
146
|
-
document.dispatchEvent(new CustomEvent("pb:dropdown:clearRequest", { detail: { dropdownId: id } }));
|
|
147
|
-
});
|
|
148
|
-
document.getElementById("select-quickpick-cet").addEventListener("click", function() {
|
|
149
|
-
document.dispatchEvent(new CustomEvent("pb:dropdown:select", { detail: { dropdownId: id, optionId: "quickpick-this-week" } }));
|
|
150
|
-
});
|
|
151
|
-
document.getElementById("simulate-quickpick-cet").addEventListener("click", function() {
|
|
152
|
-
document.dispatchEvent(new CustomEvent("form:submitted", { detail: { dropdownId: id } }));
|
|
153
|
-
});
|
|
154
|
-
})();
|
|
155
|
-
</script>
|
|
156
|
-
|
|
157
|
-
<!-- Example 5: Custom display -->
|
|
158
|
-
<%= pb_rails("dropdown", props: {
|
|
159
|
-
custom_event_type: "form:submitted,pb:dropdown:clearRequest",
|
|
160
|
-
id: "dropdown-custom-display-cet",
|
|
161
|
-
label: "Custom display (Subcomponent) dropdown",
|
|
162
|
-
margin_bottom: "sm",
|
|
163
|
-
options: custom_display_options,
|
|
164
|
-
}) do %>
|
|
165
|
-
<%= pb_rails("dropdown/dropdown_trigger", props: { placeholder: "Select a User", custom_display: custom_display_content }) %>
|
|
166
|
-
<%= pb_rails("dropdown/dropdown_container") do %>
|
|
167
|
-
<% custom_display_options.each do |option| %>
|
|
168
|
-
<%= pb_rails("dropdown/dropdown_option", props: { option: option }) do %>
|
|
169
|
-
<%= pb_rails("flex", props: { align: "center", justify: "between" }) do %>
|
|
170
|
-
<%= pb_rails("flex/flex_item") do %>
|
|
171
|
-
<%= pb_rails("user", props: { name: option[:label], align: "left", avatar: true, orientation: "horizontal" }) %>
|
|
172
|
-
<% end %>
|
|
173
|
-
<%= pb_rails("flex/flex_item") do %>
|
|
174
|
-
<%= pb_rails("badge", props: { rounded: true, dark: true, text: option[:status], variant: option[:status] == "Offline" ? "neutral" : option[:status] == "Online" ? "success" : "warning" }) %>
|
|
175
|
-
<% end %>
|
|
176
|
-
<% end %>
|
|
177
|
-
<% end %>
|
|
178
|
-
<% end %>
|
|
179
|
-
<% end %>
|
|
180
|
-
<% end %>
|
|
181
|
-
<%= pb_rails("flex", props: { wrap: true, gap: "sm", align: "center", margin_bottom: "md" }) do %>
|
|
182
|
-
<%= pb_rails("button", props: { id: "clear-custom-display-cet", text: "Clear", variant: "primary" }) %>
|
|
183
|
-
<%= pb_rails("button", props: { id: "select-custom-display-cet", text: "Select Strong Sad", variant: "secondary" }) %>
|
|
184
|
-
<%= pb_rails("button", props: { id: "simulate-custom-display-cet", text: "Simulate form submit", variant: "secondary" }) %>
|
|
185
|
-
<% end %>
|
|
186
|
-
|
|
187
|
-
<script>
|
|
188
|
-
(function() {
|
|
189
|
-
var id = "dropdown-custom-display-cet";
|
|
190
|
-
document.getElementById("clear-custom-display-cet").addEventListener("click", function() {
|
|
191
|
-
document.dispatchEvent(new CustomEvent("pb:dropdown:clearRequest", { detail: { dropdownId: id } }));
|
|
192
|
-
});
|
|
193
|
-
document.getElementById("select-custom-display-cet").addEventListener("click", function() {
|
|
194
|
-
document.dispatchEvent(new CustomEvent("pb:dropdown:select", { detail: { dropdownId: id, optionId: "strong-sad" } }));
|
|
195
|
-
});
|
|
196
|
-
document.getElementById("simulate-custom-display-cet").addEventListener("click", function() {
|
|
197
|
-
document.dispatchEvent(new CustomEvent("form:submitted", { detail: { dropdownId: id } }));
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
document.addEventListener("pb:dropdown:selected", function(e) {
|
|
201
|
-
if (e.target && e.target.id === id && e.detail) {
|
|
202
|
-
var display = e.target.querySelector("[data-dropdown-trigger-custom-display]");
|
|
203
|
-
if (!display) return;
|
|
204
|
-
var nameEl = display.querySelector("#cet-dropdown-avatar-name");
|
|
205
|
-
if (nameEl) nameEl.textContent = e.detail.label;
|
|
206
|
-
var avatarEl = display.querySelector("#cet-dropdown-avatar");
|
|
207
|
-
if (avatarEl) {
|
|
208
|
-
var wrapper = avatarEl.querySelector(".avatar_wrapper");
|
|
209
|
-
if (wrapper) {
|
|
210
|
-
var initials = (e.detail.label[0] + (e.detail.label.split(" ").pop() || "")[0]).toUpperCase();
|
|
211
|
-
wrapper.dataset.name = e.detail.label;
|
|
212
|
-
wrapper.setAttribute("data-initials", initials);
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
var badgeEl = display.querySelector("#cet-dropdown-avatar-status");
|
|
216
|
-
if (badgeEl && e.detail.status) {
|
|
217
|
-
var variant = e.detail.status === "Online" ? "success" : e.detail.status === "Offline" ? "neutral" : "warning";
|
|
218
|
-
badgeEl.querySelector("span").textContent = e.detail.status;
|
|
219
|
-
badgeEl.className = "pb_badge_kit_" + variant;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
});
|
|
223
|
-
})();
|
|
224
|
-
</script>
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
The `custom_event_type` prop lets the dropdown clear when specific events are dispatched. Set it to a comma-separated list of event names (e.g. Turbo or app-specific); when any of those events fire with optional `detail: { dropdownId }`, the matching dropdown clears. You can also listen for selection changes (`pb:dropdown:selected`), clear by dispatching `pb:dropdown:clear`, or set the selection by dispatching `pb:dropdown:select` with `detail: { dropdownId, optionId }` (or `optionIds` for multi-select).
|
|
2
|
-
|
|
3
|
-
The examples show five distinct variants (default, multi select, autocomplete, quick pick, custom display). In each example, the first button clears the dropdown by dispatching a custom event that the dropdown listens for via `custom_event_type`. The second button sets the selection by dispatching `pb:dropdown:select`. The third button simulates a form submit by dispatching another custom event in `custom_event_type`, so the dropdown clears as it would after a real form submission.
|
|
4
|
-
|
|
5
|
-
Turbo events (e.g. `turbo:frame-load`, `turbo:frame-render`, `turbo:submit-end`) often fire for many actions or across the page, so using them as `custom_event_type` can clear the dropdown more often than intended. Use them when that scope is what you want; otherwise use app-specific event names and dispatch with `detail: { dropdownId }` when the action happens, or dispatch `pb:dropdown:clear` from your own handler.
|
|
6
|
-
|
|
7
|
-
Dropdowns with subcomponent structures that show custom displays (e.g. custom trigger or custom display) require a `pb:dropdown:selected` listener to update the visible UI from `event.detail` when a selection is made; clear is handled by the kit.
|